From: support Date: Tue, 14 Feb 2023 13:53:45 +0000 (+0000) Subject: Built motion from commit 5293bb2a.|2.6.30 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22javascript:;//%22%7B%7Blicense.mail?a=commitdiff_plain;h=554872c1ebda375d033bf6ce75c12490ea308146;p=motion2.git Built motion from commit 5293bb2a.|2.6.30 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 72f5452..d062e76 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-14T09:25:44.676Z", + "time": "2023-02-14T13:44:36.275Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 6004fb7..6fd1f0f 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-02-14T09:25:44.676Z", + "time": "2023-02-14T13:44:36.275Z", "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 8e5fd28..ab45776 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 _0xa318=['contactManager','motionbar','urlForward','bot','script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING'];(function(_0x53c9f7,_0x5a709f){var _0x4ab248=function(_0x3eee34){while(--_0x3eee34){_0x53c9f7['push'](_0x53c9f7['shift']());}};_0x4ab248(++_0x5a709f);}(_0xa318,0x9c));var _0x8a31=function(_0x3635f7,_0x143c27){_0x3635f7=_0x3635f7-0x0;var _0x5a7f42=_0xa318[_0x3635f7];return _0x5a7f42;};'use strict';var Sequelize=require(_0x8a31('0x0'));module[_0x8a31('0x1')]={'name':{'type':Sequelize[_0x8a31('0x2')],'get':function(_0x581675){return this[_0x8a31('0x3')](_0x8a31('0x4'));}},'action':{'type':Sequelize[_0x8a31('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x8a31('0x6'),'integration',_0x8a31('0x7'),'jscripty',_0x8a31('0x8'),'browser',_0x8a31('0x9'),_0x8a31('0xa')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comment':_0x8a31('0xb')},'data2':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comment':_0x8a31('0xc')},'data3':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comment':_0x8a31('0xd')},'data4':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comments':_0x8a31('0xe')},'data5':{'type':Sequelize[_0x8a31('0x5')](0x1000),'comments':_0x8a31('0xf')},'data6':{'type':Sequelize['STRING'],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0x8a31('0x10')],'comments':_0x8a31('0x11')}}; \ No newline at end of file +var _0xe849=['exports','VIRTUAL','getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','STRING','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xe849,0x12b));var _0x9e84=function(_0x10a469,_0x1de6a0){_0x10a469=_0x10a469-0x0;var _0x3c8629=_0xe849[_0x10a469];return _0x3c8629;};'use strict';var Sequelize=require(_0x9e84('0x0'));module[_0x9e84('0x1')]={'name':{'type':Sequelize[_0x9e84('0x2')],'get':function(_0xccc8a0){return this[_0x9e84('0x3')](_0x9e84('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x9e84('0x5'),_0x9e84('0x6'),_0x9e84('0x7'),_0x9e84('0x8'),_0x9e84('0x9'),_0x9e84('0xa'),'bot',_0x9e84('0xb')]],'msg':_0x9e84('0xc')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x9e84('0xd')},'data2':{'type':Sequelize[_0x9e84('0xe')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x9e84('0xf')},'data5':{'type':Sequelize[_0x9e84('0xe')](0x1000),'comments':_0x9e84('0x10')},'data6':{'type':Sequelize['STRING'],'comments':_0x9e84('0x11')},'data7':{'type':Sequelize[_0x9e84('0x12')],'comments':_0x9e84('0x13')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 28a373c..568aa7e 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 _0xf1f8=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','update','then','destroy','error','stack','name','send','body','Action','params','catch','find','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x56b546,_0x4d5f71){var _0x245a8e=function(_0x3c3060){while(--_0x3c3060){_0x56b546['push'](_0x56b546['shift']());}};_0x245a8e(++_0x4d5f71);}(_0xf1f8,0xd0));var _0x8f1f=function(_0x12d366,_0x737b0){_0x12d366=_0x12d366-0x0;var _0x143aca=_0xf1f8[_0x12d366];return _0x143aca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f1f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8f1f('0x1'));var rp=require(_0x8f1f('0x2'));var moment=require(_0x8f1f('0x3'));var BPromise=require(_0x8f1f('0x4'));var Mustache=require(_0x8f1f('0x5'));var util=require(_0x8f1f('0x6'));var path=require(_0x8f1f('0x7'));var sox=require(_0x8f1f('0x8'));var csv=require(_0x8f1f('0x9'));var ejs=require(_0x8f1f('0xa'));var fs=require('fs');var fs_extra=require(_0x8f1f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x8f1f('0xc'));var jsforce=require(_0x8f1f('0xd'));var deskjs=require(_0x8f1f('0xe'));var toCsv=require(_0x8f1f('0x9'));var querystring=require(_0x8f1f('0xf'));var Papa=require('papaparse');var Redis=require(_0x8f1f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8f1f('0x11'));var hardwareService=require(_0x8f1f('0x12'));var logger=require(_0x8f1f('0x13'))('api');var utils=require(_0x8f1f('0x14'));var config=require(_0x8f1f('0x15'));var licenseUtil=require(_0x8f1f('0x16'));var db=require(_0x8f1f('0x17'))['db'];function respondWithStatusCode(_0x46fa9e,_0x571bfe){_0x571bfe=_0x571bfe||0xcc;return function(_0x4aa5ab){if(_0x4aa5ab){return _0x46fa9e['sendStatus'](_0x571bfe);}return _0x46fa9e[_0x8f1f('0x18')](_0x571bfe)[_0x8f1f('0x19')]();};}function respondWithResult(_0xb7b42d,_0xf75ad3){_0xf75ad3=_0xf75ad3||0xc8;return function(_0x3c1ac0){if(_0x3c1ac0){return _0xb7b42d[_0x8f1f('0x18')](_0xf75ad3)[_0x8f1f('0x1a')](_0x3c1ac0);}};}function respondWithFilteredResult(_0x4d2b3f,_0x1c7660){return function(_0x4ed6f5){if(_0x4ed6f5){var _0xba3b46=typeof _0x1c7660[_0x8f1f('0x1b')]==='undefined'&&typeof _0x1c7660[_0x8f1f('0x1c')]===_0x8f1f('0x1d');var _0x1ee918=_0x4ed6f5['count'];var _0x2eb2fb=_0xba3b46?0x0:_0x1c7660[_0x8f1f('0x1b')];var _0x2b0971=_0xba3b46?_0x4ed6f5[_0x8f1f('0x1e')]:_0x1c7660[_0x8f1f('0x1b')]+_0x1c7660[_0x8f1f('0x1c')];var _0x34aa32;if(_0x2b0971>=_0x1ee918){_0x2b0971=_0x1ee918;_0x34aa32=0xc8;}else{_0x34aa32=0xce;}_0x4d2b3f[_0x8f1f('0x18')](_0x34aa32);return _0x4d2b3f[_0x8f1f('0x1f')]('Content-Range',_0x2eb2fb+'-'+_0x2b0971+'/'+_0x1ee918)[_0x8f1f('0x1a')](_0x4ed6f5);}return null;};}function patchUpdates(_0x2b8f14){return function(_0x40429d){try{jsonpatch['apply'](_0x40429d,_0x2b8f14,!![]);}catch(_0x1eda2a){return BPromise['reject'](_0x1eda2a);}return _0x40429d['save']();};}function saveUpdates(_0x8ab211,_0x762946){return function(_0x160e6b){if(_0x160e6b){return _0x160e6b[_0x8f1f('0x20')](_0x8ab211)[_0x8f1f('0x21')](function(_0x48b860){return _0x48b860;});}return null;};}function removeEntity(_0x33d9ea,_0x4619d8){return function(_0x4de9c2){if(_0x4de9c2){return _0x4de9c2[_0x8f1f('0x22')]()[_0x8f1f('0x21')](function(){_0x33d9ea[_0x8f1f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d0be3,_0x501630){return function(_0x5b1b9f){if(!_0x5b1b9f){_0x2d0be3['sendStatus'](0x194);}return _0x5b1b9f;};}function handleError(_0x449225,_0x508b59){_0x508b59=_0x508b59||0x1f4;return function(_0x5b134b){logger[_0x8f1f('0x23')](_0x5b134b[_0x8f1f('0x24')]);if(_0x5b134b[_0x8f1f('0x25')]){delete _0x5b134b[_0x8f1f('0x25')];}_0x449225[_0x8f1f('0x18')](_0x508b59)[_0x8f1f('0x26')](_0x5b134b);};}exports[_0x8f1f('0x20')]=function(_0x535015,_0x5a36b8){if(_0x535015[_0x8f1f('0x27')]['id']){delete _0x535015[_0x8f1f('0x27')]['id'];}return db[_0x8f1f('0x28')]['find']({'where':{'id':_0x535015[_0x8f1f('0x29')]['id']}})['then'](handleEntityNotFound(_0x5a36b8,null))[_0x8f1f('0x21')](saveUpdates(_0x535015['body'],null))[_0x8f1f('0x21')](respondWithResult(_0x5a36b8,null))[_0x8f1f('0x2a')](handleError(_0x5a36b8,null));};exports[_0x8f1f('0x22')]=function(_0x4bd915,_0x4ee2b3){return db['Action'][_0x8f1f('0x2b')]({'where':{'id':_0x4bd915[_0x8f1f('0x29')]['id']}})[_0x8f1f('0x21')](handleEntityNotFound(_0x4ee2b3,null))[_0x8f1f('0x21')](removeEntity(_0x4ee2b3,null))[_0x8f1f('0x2a')](handleError(_0x4ee2b3,null));}; \ No newline at end of file +var _0xf372=['../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','destroy','stack','name','update','body','Action','params','catch','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x3661ca,_0xc9273e){var _0xf22108=function(_0x48b173){while(--_0x48b173){_0x3661ca['push'](_0x3661ca['shift']());}};_0xf22108(++_0xc9273e);}(_0xf372,0xcd));var _0x2f37=function(_0x14eba5,_0x1fcb02){_0x14eba5=_0x14eba5-0x0;var _0x121122=_0xf372[_0x14eba5];return _0x121122;};'use strict';var emlformat=require(_0x2f37('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f37('0x1'));var rp=require(_0x2f37('0x2'));var moment=require(_0x2f37('0x3'));var BPromise=require(_0x2f37('0x4'));var Mustache=require(_0x2f37('0x5'));var util=require(_0x2f37('0x6'));var path=require(_0x2f37('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2f37('0x8'));var fs=require('fs');var fs_extra=require(_0x2f37('0x9'));var _=require(_0x2f37('0xa'));var squel=require('squel');var crypto=require(_0x2f37('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2f37('0xc'));var Papa=require(_0x2f37('0xd'));var Redis=require(_0x2f37('0xe'));var authService=require(_0x2f37('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f37('0x10'));var logger=require(_0x2f37('0x11'))(_0x2f37('0x12'));var utils=require(_0x2f37('0x13'));var config=require(_0x2f37('0x14'));var licenseUtil=require(_0x2f37('0x15'));var db=require(_0x2f37('0x16'))['db'];function respondWithStatusCode(_0x26d339,_0x368b5d){_0x368b5d=_0x368b5d||0xcc;return function(_0x499cf4){if(_0x499cf4){return _0x26d339[_0x2f37('0x17')](_0x368b5d);}return _0x26d339[_0x2f37('0x18')](_0x368b5d)[_0x2f37('0x19')]();};}function respondWithResult(_0x58eb9a,_0xe2c00f){_0xe2c00f=_0xe2c00f||0xc8;return function(_0x1c843e){if(_0x1c843e){return _0x58eb9a[_0x2f37('0x18')](_0xe2c00f)[_0x2f37('0x1a')](_0x1c843e);}};}function respondWithFilteredResult(_0x5aca0f,_0x7e3533){return function(_0x5ded66){if(_0x5ded66){var _0x220e60=typeof _0x7e3533[_0x2f37('0x1b')]===_0x2f37('0x1c')&&typeof _0x7e3533[_0x2f37('0x1d')]===_0x2f37('0x1c');var _0x46029f=_0x5ded66[_0x2f37('0x1e')];var _0x5d3b2d=_0x220e60?0x0:_0x7e3533['offset'];var _0x5e3035=_0x220e60?_0x5ded66['count']:_0x7e3533[_0x2f37('0x1b')]+_0x7e3533['limit'];var _0x53ebf7;if(_0x5e3035>=_0x46029f){_0x5e3035=_0x46029f;_0x53ebf7=0xc8;}else{_0x53ebf7=0xce;}_0x5aca0f['status'](_0x53ebf7);return _0x5aca0f[_0x2f37('0x1f')]('Content-Range',_0x5d3b2d+'-'+_0x5e3035+'/'+_0x46029f)['json'](_0x5ded66);}return null;};}function patchUpdates(_0x5af4c2){return function(_0x35aa07){try{jsonpatch[_0x2f37('0x20')](_0x35aa07,_0x5af4c2,!![]);}catch(_0x47e22f){return BPromise[_0x2f37('0x21')](_0x47e22f);}return _0x35aa07[_0x2f37('0x22')]();};}function saveUpdates(_0x114737,_0x20b079){return function(_0x1a927f){if(_0x1a927f){return _0x1a927f['update'](_0x114737)[_0x2f37('0x23')](function(_0x36aaf8){return _0x36aaf8;});}return null;};}function removeEntity(_0x8d4465,_0x208da1){return function(_0x43e21a){if(_0x43e21a){return _0x43e21a[_0x2f37('0x24')]()[_0x2f37('0x23')](function(){_0x8d4465['status'](0xcc)[_0x2f37('0x19')]();});}};}function handleEntityNotFound(_0x23172b,_0x2233fe){return function(_0x3c4bcc){if(!_0x3c4bcc){_0x23172b[_0x2f37('0x17')](0x194);}return _0x3c4bcc;};}function handleError(_0x2f431f,_0x24694b){_0x24694b=_0x24694b||0x1f4;return function(_0x15a601){logger['error'](_0x15a601[_0x2f37('0x25')]);if(_0x15a601[_0x2f37('0x26')]){delete _0x15a601['name'];}_0x2f431f['status'](_0x24694b)['send'](_0x15a601);};}exports[_0x2f37('0x27')]=function(_0x1e61d4,_0x244207){if(_0x1e61d4[_0x2f37('0x28')]['id']){delete _0x1e61d4['body']['id'];}return db[_0x2f37('0x29')]['find']({'where':{'id':_0x1e61d4[_0x2f37('0x2a')]['id']}})[_0x2f37('0x23')](handleEntityNotFound(_0x244207,null))[_0x2f37('0x23')](saveUpdates(_0x1e61d4[_0x2f37('0x28')],null))[_0x2f37('0x23')](respondWithResult(_0x244207,null))[_0x2f37('0x2b')](handleError(_0x244207,null));};exports[_0x2f37('0x24')]=function(_0x277be,_0x4322b5){return db[_0x2f37('0x29')]['find']({'where':{'id':_0x277be[_0x2f37('0x2a')]['id']}})[_0x2f37('0x23')](handleEntityNotFound(_0x4322b5,null))[_0x2f37('0x23')](removeEntity(_0x4322b5,null))[_0x2f37('0x2b')](handleError(_0x4322b5,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 7893d30..c5eb1fe 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 _0x0c1a=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','tools_actions','lodash','util','../../config/logger'];(function(_0x2649d9,_0x513732){var _0x55c610=function(_0x274f07){while(--_0x274f07){_0x2649d9['push'](_0x2649d9['shift']());}};_0x55c610(++_0x513732);}(_0x0c1a,0x169));var _0xa0c1=function(_0x43af1f,_0x21d836){_0x43af1f=_0x43af1f-0x0;var _0x113ec2=_0x0c1a[_0x43af1f];return _0x113ec2;};'use strict';var _=require(_0xa0c1('0x0'));var util=require(_0xa0c1('0x1'));var logger=require(_0xa0c1('0x2'))(_0xa0c1('0x3'));var moment=require(_0xa0c1('0x4'));var BPromise=require(_0xa0c1('0x5'));var rp=require(_0xa0c1('0x6'));var fs=require('fs');var path=require(_0xa0c1('0x7'));var rimraf=require(_0xa0c1('0x8'));var config=require(_0xa0c1('0x9'));var attributes=require(_0xa0c1('0xa'));module['exports']=function(_0x3be00e,_0x3f194b){return _0x3be00e[_0xa0c1('0xb')]('Action',attributes,{'tableName':_0xa0c1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3aee=['rimraf','exports','define','Action','tools_actions','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x4f75f8,_0x2d3423){var _0x304380=function(_0x2c4f25){while(--_0x2c4f25){_0x4f75f8['push'](_0x4f75f8['shift']());}};_0x304380(++_0x2d3423);}(_0x3aee,0x131));var _0xe3ae=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0x3aee[_0x58999b];return _0x5efc3a;};'use strict';var _=require(_0xe3ae('0x0'));var util=require(_0xe3ae('0x1'));var logger=require('../../config/logger')(_0xe3ae('0x2'));var moment=require(_0xe3ae('0x3'));var BPromise=require(_0xe3ae('0x4'));var rp=require(_0xe3ae('0x5'));var fs=require('fs');var path=require(_0xe3ae('0x6'));var rimraf=require(_0xe3ae('0x7'));var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xe3ae('0x8')]=function(_0x238269,_0x20af09){return _0x238269[_0xe3ae('0x9')](_0xe3ae('0xa'),attributes,{'tableName':_0xe3ae('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index 42b8eb1..33ef109 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x275803,_0x148216){var _0x33a595=function(_0x16fed9){while(--_0x16fed9){_0x275803['push'](_0x275803['shift']());}};_0x33a595(++_0x148216);}(_0xabce,0x103));var _0xeabc=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xabce[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var moment=require(_0xeabc('0x2'));var BPromise=require(_0xeabc('0x3'));var rs=require(_0xeabc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeabc('0x5'));var logger=require(_0xeabc('0x6'))(_0xeabc('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xeabc('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x229ba4,_0x52ede8,_0x3bdc29){return new BPromise(function(_0x9417af,_0x8434c5){return client['request'](_0x229ba4,_0x3bdc29)[_0xeabc('0x9')](function(_0x341f16){logger[_0xeabc('0xa')](_0xeabc('0xb'),_0x52ede8,_0xeabc('0xc'));logger[_0xeabc('0xd')](_0xeabc('0xe'),_0x52ede8,_0xeabc('0xc'),JSON[_0xeabc('0xf')](_0x341f16));if(_0x341f16[_0xeabc('0x10')]){if(_0x341f16[_0xeabc('0x10')][_0xeabc('0x11')]===0x1f4){logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);return _0x8434c5(_0x341f16['error'][_0xeabc('0x12')]);}logger[_0xeabc('0x10')](_0xeabc('0xb'),_0x52ede8,_0x341f16['error']['message']);return _0x9417af(_0x341f16[_0xeabc('0x10')][_0xeabc('0x12')]);}else{logger[_0xeabc('0xa')]('Action,\x20%s,\x20%s',_0x52ede8,_0xeabc('0xc'));_0x9417af(_0x341f16[_0xeabc('0x13')]['message']);}})['catch'](function(_0x10fa8e){logger['error'](_0xeabc('0xb'),_0x52ede8,_0x10fa8e);_0x8434c5(_0x10fa8e);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x4975,0x86));var _0x5497=function(_0x2f0543,_0x3c160e){_0x2f0543=_0x2f0543-0x0;var _0x35900a=_0x4975[_0x2f0543];return _0x35900a;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('Action,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 412af97..584c5eb 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 _0x0c9a=['destroy','exports','util','path','connect-timeout','Router','../../config/environment','put','/:id','delete','isAuthenticated'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x0c9a,0x136));var _0xa0c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c9a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xa0c9('0x0'));var path=require(_0xa0c9('0x1'));var timeout=require(_0xa0c9('0x2'));var express=require('express');var router=express[_0xa0c9('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa0c9('0x4'));var controller=require('./action.controller');router[_0xa0c9('0x5')](_0xa0c9('0x6'),auth['isAuthenticated'](),controller['update']);router[_0xa0c9('0x7')](_0xa0c9('0x6'),auth[_0xa0c9('0x8')](),controller[_0xa0c9('0x9')]);module[_0xa0c9('0xa')]=router; \ No newline at end of file +var _0x1071=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','multer','util','connect-timeout','express','Router'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x1071,0xeb));var _0x1107=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x1071[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x1107('0x0'));var util=require(_0x1107('0x1'));var path=require('path');var timeout=require(_0x1107('0x2'));var express=require(_0x1107('0x3'));var router=express[_0x1107('0x4')]();var fs_extra=require(_0x1107('0x5'));var auth=require(_0x1107('0x6'));var interaction=require(_0x1107('0x7'));var config=require(_0x1107('0x8'));var controller=require(_0x1107('0x9'));router[_0x1107('0xa')](_0x1107('0xb'),auth[_0x1107('0xc')](),controller[_0x1107('0xd')]);router[_0x1107('0xe')](_0x1107('0xb'),auth[_0x1107('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 72ee61f..d268b04 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 _0xee14=['STRING','TEXT'];(function(_0x2135bd,_0x42ad02){var _0x394fec=function(_0x201817){while(--_0x201817){_0x2135bd['push'](_0x2135bd['shift']());}};_0x394fec(++_0x42ad02);}(_0xee14,0x13a));var _0x4ee1=function(_0x284692,_0x2c8094){_0x284692=_0x284692-0x0;var _0x63a287=_0xee14[_0x284692];return _0x63a287;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file +var _0x24ca=['sequelize','STRING','TEXT'];(function(_0x15503e,_0x2ce699){var _0x271c52=function(_0x39096a){while(--_0x39096a){_0x15503e['push'](_0x15503e['shift']());}};_0x271c52(++_0x2ce699);}(_0x24ca,0x1bc));var _0xa24c=function(_0x113e32,_0x5339f0){_0x113e32=_0x113e32-0x0;var _0x4ff939=_0x24ca[_0x113e32];return _0x4ff939;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'name':{'type':Sequelize[_0xa24c('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa24c('0x1')]},'parent':{'type':Sequelize[_0xa24c('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xa24c('0x2')]},'joins':{'type':Sequelize[_0xa24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 5c0e64c..3f2737f 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 _0x97e4=['fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','CustomReports','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','sort','where','pick','filters','VIRTUAL','filter','options','AnalyticCustomReport','includeAll','include','findAll','rows','merge','create','body','get','role','user','Reports','UserProfileSection','find','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','preview','join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','orderBy','alias','joins','parse','includes','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','toString','sequelize','QueryTypes','SELECT','left_join','cross_join','MAX(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','from','groupBy','order','DESC','parentKey','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','fork','../../components/export/','COUNT(*)','run','Limited\x20Query:','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv'];(function(_0x2cadbd,_0x504b02){var _0x56df1a=function(_0x8a225d){while(--_0x8a225d){_0x2cadbd['push'](_0x2cadbd['shift']());}};_0x56df1a(++_0x504b02);}(_0x97e4,0x98));var _0x497e=function(_0x5786f9,_0x59a148){_0x5786f9=_0x5786f9-0x0;var _0x22c3cf=_0x97e4[_0x5786f9];return _0x22c3cf;};'use strict';var emlformat=require(_0x497e('0x0'));var rimraf=require(_0x497e('0x1'));var zipdir=require(_0x497e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x497e('0x3'));var moment=require(_0x497e('0x4'));var BPromise=require(_0x497e('0x5'));var Mustache=require(_0x497e('0x6'));var util=require(_0x497e('0x7'));var path=require(_0x497e('0x8'));var sox=require('sox');var csv=require(_0x497e('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x497e('0xa'));var _=require(_0x497e('0xb'));var squel=require(_0x497e('0xc'));var crypto=require('crypto');var jsforce=require(_0x497e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x497e('0xe'));var Papa=require(_0x497e('0xf'));var Redis=require(_0x497e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x497e('0x11'));var as=require(_0x497e('0x12'));var hardwareService=require(_0x497e('0x13'));var logger=require(_0x497e('0x14'))(_0x497e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x497e('0x16'));var db=require(_0x497e('0x17'))['db'];var dbH=require(_0x497e('0x17'))['dbH'];function respondWithStatusCode(_0x1fa252,_0x2a2687){_0x2a2687=_0x2a2687||0xcc;return function(_0x4fb4d8){if(_0x4fb4d8){return _0x1fa252['sendStatus'](_0x2a2687);}return _0x1fa252[_0x497e('0x18')](_0x2a2687)[_0x497e('0x19')]();};}function respondWithResult(_0x781267,_0x3e779a){_0x3e779a=_0x3e779a||0xc8;return function(_0x18a2e7){if(_0x18a2e7){return _0x781267['status'](_0x3e779a)[_0x497e('0x1a')](_0x18a2e7);}};}function respondWithFilteredResult(_0x5727da,_0x324f6c){return function(_0x447d11){if(_0x447d11){var _0x10c3e9=typeof _0x324f6c[_0x497e('0x1b')]===_0x497e('0x1c')&&typeof _0x324f6c['limit']===_0x497e('0x1c');var _0xb5b0cb=_0x447d11[_0x497e('0x1d')];var _0x2ac36c=_0x10c3e9?0x0:_0x324f6c[_0x497e('0x1b')];var _0x2eac53=_0x10c3e9?_0x447d11[_0x497e('0x1d')]:_0x324f6c[_0x497e('0x1b')]+_0x324f6c[_0x497e('0x1e')];var _0x1ca114;if(_0x2eac53>=_0xb5b0cb){_0x2eac53=_0xb5b0cb;_0x1ca114=0xc8;}else{_0x1ca114=0xce;}_0x5727da['status'](_0x1ca114);return _0x5727da[_0x497e('0x1f')](_0x497e('0x20'),_0x2ac36c+'-'+_0x2eac53+'/'+_0xb5b0cb)[_0x497e('0x1a')](_0x447d11);}return null;};}function patchUpdates(_0x22bea3){return function(_0x387e6e){try{jsonpatch[_0x497e('0x21')](_0x387e6e,_0x22bea3,!![]);}catch(_0x9fca86){return BPromise['reject'](_0x9fca86);}return _0x387e6e[_0x497e('0x22')]();};}function saveUpdates(_0x39a19e,_0x1501a2){return function(_0x1e5ca9){if(_0x1e5ca9){return _0x1e5ca9['update'](_0x39a19e)['then'](function(_0x4408e7){return _0x4408e7;});}return null;};}function removeEntity(_0x5d26a9,_0x4162d7){return function(_0xede98e){if(_0xede98e){return _0xede98e['destroy']()[_0x497e('0x23')](function(){var _0x5b763a=_0xede98e['get']({'plain':!![]});var _0x4a954a=_0x497e('0x24');return db[_0x497e('0x25')][_0x497e('0x26')]({'where':{'type':_0x4a954a,'resourceId':_0x5b763a['id']}})[_0x497e('0x23')](function(){return _0xede98e;});})[_0x497e('0x23')](function(){_0x5d26a9[_0x497e('0x18')](0xcc)[_0x497e('0x19')]();});}};}function handleEntityNotFound(_0x42cbaa,_0x31b075){return function(_0x485d46){if(!_0x485d46){_0x42cbaa[_0x497e('0x27')](0x194);}return _0x485d46;};}function handleError(_0x37f398,_0x54844f){_0x54844f=_0x54844f||0x1f4;return function(_0x391acb){logger['error'](_0x391acb[_0x497e('0x28')]);if(_0x391acb[_0x497e('0x29')]){delete _0x391acb[_0x497e('0x29')];}_0x37f398['status'](_0x54844f)[_0x497e('0x2a')](_0x391acb);};}exports[_0x497e('0x2b')]=function(_0x1c2887,_0x81ffc){var _0x6fb532={},_0xb5eb52={},_0x4656ae={'count':0x0,'rows':[]};var _0x2d8b88=_[_0x497e('0x2c')](db['AnalyticCustomReport'][_0x497e('0x2d')],function(_0x2781cc){return{'name':_0x2781cc[_0x497e('0x2e')],'type':_0x2781cc[_0x497e('0x2f')][_0x497e('0x30')]};});_0xb5eb52[_0x497e('0x31')]=_['map'](_0x2d8b88,_0x497e('0x29'));_0xb5eb52[_0x497e('0x32')]=_[_0x497e('0x33')](_0x1c2887['query']);_0xb5eb52['filters']=_['intersection'](_0xb5eb52[_0x497e('0x31')],_0xb5eb52[_0x497e('0x32')]);_0x6fb532[_0x497e('0x34')]=_[_0x497e('0x35')](_0xb5eb52[_0x497e('0x31')],qs[_0x497e('0x36')](_0x1c2887[_0x497e('0x32')]['fields']));_0x6fb532[_0x497e('0x34')]=_0x6fb532[_0x497e('0x34')][_0x497e('0x37')]?_0x6fb532[_0x497e('0x34')]:_0xb5eb52[_0x497e('0x31')];if(!_0x1c2887[_0x497e('0x32')]['hasOwnProperty'](_0x497e('0x38'))){_0x6fb532[_0x497e('0x1e')]=qs[_0x497e('0x1e')](_0x1c2887[_0x497e('0x32')]['limit']);_0x6fb532['offset']=qs[_0x497e('0x1b')](_0x1c2887[_0x497e('0x32')][_0x497e('0x1b')]);}_0x6fb532['order']=qs['sort'](_0x1c2887[_0x497e('0x32')][_0x497e('0x39')]);_0x6fb532[_0x497e('0x3a')]=qs['filters'](_[_0x497e('0x3b')](_0x1c2887[_0x497e('0x32')],_0xb5eb52[_0x497e('0x3c')]),_0x2d8b88);if(_0x1c2887['query']['filter']){_0x6fb532[_0x497e('0x3a')]=_['merge'](_0x6fb532[_0x497e('0x3a')],{'$or':_[_0x497e('0x2c')](_0x2d8b88,function(_0x1dc903){if(_0x1dc903[_0x497e('0x2f')]!==_0x497e('0x3d')){var _0x2ffef6={};_0x2ffef6[_0x1dc903[_0x497e('0x29')]]={'$like':'%'+_0x1c2887[_0x497e('0x32')][_0x497e('0x3e')]+'%'};return _0x2ffef6;}})});}_0x6fb532=_['merge']({},_0x6fb532,_0x1c2887[_0x497e('0x3f')]);var _0x4d1a99={'where':_0x6fb532['where']};return db[_0x497e('0x40')]['count'](_0x4d1a99)[_0x497e('0x23')](function(_0x4213a1){_0x4656ae[_0x497e('0x1d')]=_0x4213a1;if(_0x1c2887[_0x497e('0x32')][_0x497e('0x41')]){_0x6fb532[_0x497e('0x42')]=[{'all':!![]}];}return db[_0x497e('0x40')][_0x497e('0x43')](_0x6fb532);})['then'](function(_0x46ad99){_0x4656ae[_0x497e('0x44')]=_0x46ad99;return _0x4656ae;})[_0x497e('0x23')](respondWithFilteredResult(_0x81ffc,_0x6fb532))['catch'](handleError(_0x81ffc,null));};exports['show']=function(_0x2900e9,_0x3dc4b9){var _0x517a14={'raw':![],'where':{'id':_0x2900e9['params']['id']}},_0x330ebf={};_0x330ebf[_0x497e('0x31')]=_[_0x497e('0x33')](db[_0x497e('0x40')][_0x497e('0x2d')]);_0x330ebf[_0x497e('0x32')]=_[_0x497e('0x33')](_0x2900e9[_0x497e('0x32')]);_0x330ebf['filters']=_[_0x497e('0x35')](_0x330ebf[_0x497e('0x31')],_0x330ebf['query']);_0x517a14['attributes']=_[_0x497e('0x35')](_0x330ebf[_0x497e('0x31')],qs[_0x497e('0x36')](_0x2900e9[_0x497e('0x32')][_0x497e('0x36')]));_0x517a14['attributes']=_0x517a14[_0x497e('0x34')][_0x497e('0x37')]?_0x517a14[_0x497e('0x34')]:_0x330ebf[_0x497e('0x31')];if(_0x2900e9[_0x497e('0x32')]['includeAll']){_0x517a14['include']=[{'all':!![]}];}_0x517a14=_[_0x497e('0x45')]({},_0x517a14,_0x2900e9[_0x497e('0x3f')]);return db[_0x497e('0x40')]['find'](_0x517a14)[_0x497e('0x23')](handleEntityNotFound(_0x3dc4b9,null))[_0x497e('0x23')](respondWithResult(_0x3dc4b9,null))['catch'](handleError(_0x3dc4b9,null));};exports[_0x497e('0x46')]=function(_0xc81a13,_0x5813b0){return db[_0x497e('0x40')][_0x497e('0x46')](_0xc81a13[_0x497e('0x47')],{})['then'](function(_0x4b574d){var _0x1bd07b=_0xc81a13['user'][_0x497e('0x48')]({'plain':!![]});if(!_0x1bd07b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bd07b[_0x497e('0x49')]===_0x497e('0x4a')){var _0x21b45d=_0x4b574d[_0x497e('0x48')]({'plain':!![]});var _0x402769=_0x497e('0x4b');return db[_0x497e('0x4c')][_0x497e('0x4d')]({'where':{'name':_0x402769,'userProfileId':_0x1bd07b['userProfileId']},'raw':!![]})[_0x497e('0x23')](function(_0xa467ff){if(_0xa467ff&&_0xa467ff['autoAssociation']===0x0){return db[_0x497e('0x25')]['create']({'name':_0x21b45d[_0x497e('0x29')],'resourceId':_0x21b45d['id'],'type':_0x497e('0x24'),'sectionId':_0xa467ff['id']},{})[_0x497e('0x23')](function(){return _0x4b574d;});}else{return _0x4b574d;}})[_0x497e('0x4e')](function(_0x312643){logger[_0x497e('0x4f')](_0x497e('0x50'),_0x312643);throw _0x312643;});}return _0x4b574d;})[_0x497e('0x23')](respondWithResult(_0x5813b0,0xc9))['catch'](handleError(_0x5813b0,null));};exports[_0x497e('0x51')]=function(_0x3d11d9,_0x557ead){if(_0x3d11d9['body']['id']){delete _0x3d11d9[_0x497e('0x47')]['id'];}return db['AnalyticCustomReport']['find']({'where':{'id':_0x3d11d9[_0x497e('0x52')]['id']}})[_0x497e('0x23')](handleEntityNotFound(_0x557ead,null))[_0x497e('0x23')](saveUpdates(_0x3d11d9[_0x497e('0x47')],null))[_0x497e('0x23')](respondWithResult(_0x557ead,null))['catch'](handleError(_0x557ead,null));};exports[_0x497e('0x26')]=function(_0x1ca283,_0x221249){return db['AnalyticCustomReport'][_0x497e('0x4d')]({'where':{'id':_0x1ca283['params']['id']}})[_0x497e('0x23')](handleEntityNotFound(_0x221249,null))[_0x497e('0x23')](removeEntity(_0x221249,null))[_0x497e('0x4e')](handleError(_0x221249,null));};exports[_0x497e('0x53')]=function(_0x5b88d4,_0x3665a5){var _0x4e5396=0xa;var _0x2944c0=[_0x497e('0x54'),'left_join',_0x497e('0x55'),'cross_join'];var _0x47ed1d={'SUM':_0x497e('0x56'),'COUNT':_0x497e('0x57'),'COUNT DISTINCT':_0x497e('0x58'),'MAX':'MAX(%s)','MIN':_0x497e('0x59'),'AVG':_0x497e('0x5a'),'GROUP_CONCAT':_0x497e('0x5b'),'GROUP_CONCAT ASC':_0x497e('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x37657e={'SEC_TO_TIME':_0x497e('0x5d'),'DATE':_0x497e('0x5e'),'HOUR':_0x497e('0x5f'),'ROUND':_0x497e('0x60'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1ae513=function(_0x1a3ae4){return!_['includes']([_0x497e('0x61'),_0x497e('0x62'),_0x497e('0x63'),_0x497e('0x64')],_0x1a3ae4);};var _0x3661c6=function(_0x266818){if(!_0x266818||!_0x266818['rules']['length']){return'';}for(var _0x6e9444='(',_0x42f7f7=0x0;_0x42f7f7<_0x266818[_0x497e('0x65')][_0x497e('0x37')];_0x42f7f7+=0x1){_0x42f7f7>0x0&&(_0x6e9444+='\x20'+_0x266818[_0x497e('0x66')]+'\x20');_0x6e9444+=_0x266818[_0x497e('0x65')][_0x42f7f7][_0x497e('0x67')]?_0x3661c6(_0x266818[_0x497e('0x65')][_0x42f7f7][_0x497e('0x67')]):_0x266818[_0x497e('0x65')][_0x42f7f7][_0x497e('0x68')]+'\x20'+_0x266818[_0x497e('0x65')][_0x42f7f7]['condition']+(_0x1ae513(_0x266818[_0x497e('0x65')][_0x42f7f7]['condition'])?'\x20'+_0x266818['rules'][_0x42f7f7][_0x497e('0x69')]:'');}return _0x6e9444+')';};var _0x149ae5={'where':{'id':_0x5b88d4['params']['id']}},_0x26868f,_0x263cf7,_0x89fb89,_0x1ef917,_0x1f5150;_0x149ae5=_['merge']({},_0x149ae5,_0x5b88d4['options']);return db[_0x497e('0x40')][_0x497e('0x4d')](_0x149ae5)[_0x497e('0x23')](function(_0x223bcf){if(_0x223bcf){_0x26868f=_0x223bcf;return _0x223bcf[_0x497e('0x6a')]();}return null;})[_0x497e('0x23')](function(_0x376831){if(_0x376831){if(!_0x376831['length']){throw new db[(_0x497e('0x6b'))][(_0x497e('0x6c'))](_0x497e('0x6d'),0x193);}_0x263cf7=_0x376831;return db[_0x497e('0x6e')]['findAll']({'raw':!![]});}return null;})[_0x497e('0x23')](function(_0x45bbf4){if(_0x45bbf4){_0x89fb89=_[_0x497e('0x6f')](_0x45bbf4,'id');var _0x5a3b38;var _0x93f34f=squel[_0x497e('0x70')]();_0x93f34f['from'](_0x26868f[_0x497e('0x71')]);for(var _0x2e3d1a=0x0;_0x2e3d1a<_0x263cf7[_0x497e('0x37')];_0x2e3d1a+=0x1){_0x5a3b38=_0x263cf7[_0x2e3d1a][_0x497e('0x72')]?_0x89fb89[_0x263cf7[_0x2e3d1a][_0x497e('0x72')]][_0x497e('0x73')]:_0x263cf7[_0x2e3d1a][_0x497e('0x68')];_0x5a3b38=_0x263cf7[_0x2e3d1a][_0x497e('0x74')]?_[_0x497e('0x75')](_0x47ed1d[_0x263cf7[_0x2e3d1a][_0x497e('0x74')]],'%s',_0x5a3b38):_0x5a3b38;_0x5a3b38=_0x263cf7[_0x2e3d1a][_0x497e('0x76')]?_[_0x497e('0x75')](_0x37657e[_0x263cf7[_0x2e3d1a][_0x497e('0x76')]],'%s',_0x5a3b38):_0x5a3b38;if(_0x263cf7[_0x2e3d1a]['groupBy']){_0x93f34f[_0x497e('0x67')](_0x5a3b38);}_0x263cf7[_0x2e3d1a][_0x497e('0x77')]&&_0x93f34f['order'](_0x5a3b38,_0x263cf7[_0x2e3d1a][_0x497e('0x77')]==='DESC'?![]:!![]);_0x93f34f['field'](_0x5a3b38,_0x263cf7[_0x2e3d1a][_0x497e('0x78')]||_0x5a3b38);}if(_0x26868f[_0x497e('0x79')]){_0x26868f[_0x497e('0x79')]=JSON[_0x497e('0x7a')](_0x26868f[_0x497e('0x79')]);for(var _0x39b964=0x0;_0x39b964<_0x26868f[_0x497e('0x79')][_0x497e('0x37')];_0x39b964+=0x1){if(_0x26868f[_0x497e('0x79')][_0x39b964]['type']&&_[_0x497e('0x7b')](_0x2944c0,_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x2f')])&&_0x26868f[_0x497e('0x79')][_0x39b964]['parentKey']&&_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7c')]&&_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7d')]){_0x93f34f[_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x2f')]](_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7c')],null,util[_0x497e('0x76')](_0x497e('0x7e'),_0x26868f['table'],_0x26868f[_0x497e('0x79')][_0x39b964]['parentKey'],_0x26868f['joins'][_0x39b964][_0x497e('0x7c')],_0x26868f[_0x497e('0x79')][_0x39b964][_0x497e('0x7d')]));}}}if(_0x26868f[_0x497e('0x7f')]){_0x26868f[_0x497e('0x7f')]=JSON[_0x497e('0x7a')](_0x26868f['conditions']);_0x93f34f['where'](_0x3661c6(_0x26868f[_0x497e('0x7f')][_0x497e('0x67')]));}_0x1f5150=_0x93f34f[_0x497e('0x80')]();_0x93f34f[_0x497e('0x1e')](_0x4e5396);_0x93f34f[_0x497e('0x1b')](0x0);logger[_0x497e('0x81')]('Limited\x20Query:',_0x93f34f[_0x497e('0x82')]());return dbH[_0x497e('0x83')][_0x497e('0x32')](_0x93f34f[_0x497e('0x82')](),{'type':dbH[_0x497e('0x83')][_0x497e('0x84')][_0x497e('0x85')]});}})[_0x497e('0x23')](respondWithResult(_0x3665a5,null))[_0x497e('0x4e')](handleError(_0x3665a5,null));};function runReport(_0x3f7563,_0x4c2cfa,_0x4e7a8d){var _0x8af9a8=_0x4c2cfa['name'];var _0x1093d9=0xa;var _0x329e86=[_0x497e('0x54'),_0x497e('0x86'),_0x497e('0x55'),_0x497e('0x87')];var _0x3f7c5c={'SUM':_0x497e('0x56'),'COUNT':_0x497e('0x57'),'COUNT DISTINCT':_0x497e('0x58'),'MAX':_0x497e('0x88'),'MIN':'MIN(%s)','AVG':_0x497e('0x5a'),'GROUP_CONCAT':_0x497e('0x5b'),'GROUP_CONCAT ASC':_0x497e('0x5c'),'GROUP_CONCAT DESC':_0x497e('0x89')};var _0x570572={'SEC_TO_TIME':_0x497e('0x5d'),'DATE':_0x497e('0x5e'),'HOUR':'HOUR(%s)','ROUND':_0x497e('0x60'),'UNIX_TIMESTAMP':_0x497e('0x8a')};var _0x20a7d1=function(_0x378d58){return!_[_0x497e('0x7b')]([_0x497e('0x61'),_0x497e('0x62'),_0x497e('0x63'),_0x497e('0x64')],_0x378d58);};var _0x11e63d=function(_0x5aa1a1){if(!_0x5aa1a1||!_0x5aa1a1['rules'][_0x497e('0x37')]){return'';}for(var _0x5a5df5='(',_0x35951c=0x0;_0x35951c<_0x5aa1a1[_0x497e('0x65')][_0x497e('0x37')];_0x35951c+=0x1){_0x35951c>0x0&&(_0x5a5df5+='\x20'+_0x5aa1a1[_0x497e('0x66')]+'\x20');_0x5a5df5+=_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x67')]?_0x11e63d(_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x67')]):_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x68')]+'\x20'+_0x5aa1a1[_0x497e('0x65')][_0x35951c]['condition']+(_0x20a7d1(_0x5aa1a1[_0x497e('0x65')][_0x35951c]['condition'])?'\x20'+_0x5aa1a1[_0x497e('0x65')][_0x35951c][_0x497e('0x69')]:'');}return _0x5a5df5+')';};var _0x55c08c={'where':{'id':_0x3f7563['id']}},_0x24dbc4,_0x5c7066,_0x59ebaf,_0x286912,_0x11dca0;_0x55c08c=_[_0x497e('0x45')]({},_0x55c08c,_0x4e7a8d);return db[_0x497e('0x40')][_0x497e('0x4d')](_0x55c08c)[_0x497e('0x23')](function(_0x459c04){if(_0x459c04){_0x24dbc4=_0x459c04;return _0x459c04[_0x497e('0x6a')]();}return null;})[_0x497e('0x23')](function(_0x2868f0){if(_0x2868f0){if(!_0x2868f0[_0x497e('0x37')]){throw new db[(_0x497e('0x6b'))][(_0x497e('0x6c'))](_0x497e('0x6d'),0x193);}_0x5c7066=_0x2868f0;return db[_0x497e('0x6e')][_0x497e('0x43')]({'raw':!![]});}return null;})['then'](function(_0x1d3fef){if(_0x1d3fef){_0x59ebaf=_[_0x497e('0x6f')](_0x1d3fef,'id');var _0x5f3bd8;var _0x191af6=squel[_0x497e('0x70')]();_0x191af6[_0x497e('0x8b')](_0x24dbc4[_0x497e('0x71')]);for(var _0x527310=0x0;_0x527310<_0x5c7066[_0x497e('0x37')];_0x527310+=0x1){_0x5f3bd8=_0x5c7066[_0x527310][_0x497e('0x72')]?_0x59ebaf[_0x5c7066[_0x527310][_0x497e('0x72')]][_0x497e('0x73')]:_0x5c7066[_0x527310]['field'];_0x5f3bd8=_0x5c7066[_0x527310][_0x497e('0x74')]?_[_0x497e('0x75')](_0x3f7c5c[_0x5c7066[_0x527310][_0x497e('0x74')]],'%s',_0x5f3bd8):_0x5f3bd8;_0x5f3bd8=_0x5c7066[_0x527310][_0x497e('0x76')]?_[_0x497e('0x75')](_0x570572[_0x5c7066[_0x527310][_0x497e('0x76')]],'%s',_0x5f3bd8):_0x5f3bd8;if(_0x5c7066[_0x527310][_0x497e('0x8c')]){_0x191af6[_0x497e('0x67')](_0x5f3bd8);}_0x5c7066[_0x527310][_0x497e('0x77')]&&_0x191af6[_0x497e('0x8d')](_0x5f3bd8,_0x5c7066[_0x527310][_0x497e('0x77')]===_0x497e('0x8e')?![]:!![]);_0x191af6[_0x497e('0x68')](_0x5f3bd8,_0x5c7066[_0x527310][_0x497e('0x78')]||_0x5f3bd8);}if(_0x24dbc4[_0x497e('0x79')]){_0x24dbc4[_0x497e('0x79')]=JSON[_0x497e('0x7a')](_0x24dbc4[_0x497e('0x79')]);for(var _0x554fb4=0x0;_0x554fb4<_0x24dbc4[_0x497e('0x79')][_0x497e('0x37')];_0x554fb4+=0x1){if(_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x2f')]&&_[_0x497e('0x7b')](_0x329e86,_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x2f')])&&_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x8f')]&&_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7c')]&&_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7d')]){_0x191af6[_0x24dbc4['joins'][_0x554fb4][_0x497e('0x2f')]](_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7c')],null,util[_0x497e('0x76')]('%s.%s\x20=\x20%s.%s',_0x24dbc4[_0x497e('0x71')],_0x24dbc4['joins'][_0x554fb4][_0x497e('0x8f')],_0x24dbc4[_0x497e('0x79')][_0x554fb4][_0x497e('0x7c')],_0x24dbc4[_0x497e('0x79')][_0x554fb4]['foreignKey']));}}}if(_0x24dbc4[_0x497e('0x7f')]){_0x24dbc4[_0x497e('0x7f')]=JSON['parse'](_0x24dbc4['conditions']);_0x191af6['where'](_0x11e63d(_0x24dbc4[_0x497e('0x7f')][_0x497e('0x67')]));}_0x11dca0=_0x191af6[_0x497e('0x80')]();_0x191af6[_0x497e('0x1e')](_0x1093d9);_0x191af6[_0x497e('0x1b')](0x0);return;}})[_0x497e('0x23')](function(){if(_0x4c2cfa[_0x497e('0x90')]===_0x497e('0x91')){return null;}var _0x52ca94=_[_0x497e('0x45')](_0x4c2cfa,{'name':_0x4c2cfa[_0x497e('0x92')]||_0x4c2cfa[_0x497e('0x29')]||_0x24dbc4['name'],'basename':_0x8af9a8,'savename':util[_0x497e('0x76')](_0x497e('0x93'),_0x4c2cfa[_0x497e('0x29')]||_0x24dbc4[_0x497e('0x29')],require(_0x497e('0x94'))[_0x497e('0x95')](0x4),_0x4c2cfa['output']||_0x497e('0x96')),'reportId':_0x24dbc4['id'],'reportType':'custom'});return db[_0x497e('0x97')][_0x497e('0x46')](_0x52ca94,{'raw':!![]});})[_0x497e('0x23')](function(_0x2d6181){if(_0x24dbc4[_0x497e('0x71')]==='cdr'){_0x11dca0[_0x497e('0x3a')](_0x24dbc4[_0x497e('0x71')]+_0x497e('0x98'),_0x4c2cfa[_0x497e('0x99')],_0x4c2cfa[_0x497e('0x9a')]);}else{_0x11dca0[_0x497e('0x3a')](_0x24dbc4[_0x497e('0x71')]+_0x497e('0x9b'),_0x4c2cfa[_0x497e('0x99')],_0x4c2cfa[_0x497e('0x9a')]);}if(_0x2d6181){logger['info'](_0x497e('0x9c'),_0x11dca0[_0x497e('0x82')]());require('child_process')[_0x497e('0x9d')](path[_0x497e('0x54')](__dirname,_0x497e('0x9e'),_0x2d6181[_0x497e('0x90')]),[_0x2d6181['id'],_0x11dca0[_0x497e('0x82')](),path[_0x497e('0x54')](__dirname,'../../files/reports',_0x2d6181['savename']),_0x8af9a8]);return _0x2d6181;}else{var _0x32b198=squel[_0x497e('0x70')]();_0x32b198['from']('('+_0x11dca0[_0x497e('0x82')]()+')','countTable');_0x32b198[_0x497e('0x68')](_0x497e('0x9f'),_0x497e('0x1d'));_0x11dca0[_0x497e('0x1e')](_0x4c2cfa[_0x497e('0x1e')]||_0x1093d9);_0x11dca0[_0x497e('0x1b')](_0x4c2cfa[_0x497e('0x1b')]||0x0);return dbH[_0x497e('0x83')]['query'](_0x32b198['toString'](),{'type':dbH[_0x497e('0x83')][_0x497e('0x84')][_0x497e('0x85')]})['then'](function(_0x53b586){if(!_0x53b586[_0x497e('0x37')]){_0x286912=0x0;}else{_0x286912=_0x53b586[0x0][_0x497e('0x1d')]||0x0;}return dbH[_0x497e('0x83')][_0x497e('0x32')](_0x11dca0[_0x497e('0x82')](),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0x497e('0x23')](function(_0x3d3397){return{'rows':_0x3d3397||[],'count':_0x286912};});}});}exports[_0x497e('0xa0')]=function(_0x79079a,_0x5d23c1){return runReport(_0x79079a['params'],_0x79079a[_0x497e('0x32')],_0x79079a[_0x497e('0x3f')])[_0x497e('0x23')](respondWithResult(_0x5d23c1,null))['catch'](handleError(_0x5d23c1,null));};exports['runReport']=runReport;exports[_0x497e('0x32')]=function(_0xe9a92,_0x3a3b81){var _0x258291=0xa;var _0x207796=['join',_0x497e('0x86'),'right_join',_0x497e('0x87')];var _0x240723={'SUM':_0x497e('0x56'),'COUNT':_0x497e('0x57'),'COUNT DISTINCT':_0x497e('0x58'),'MAX':_0x497e('0x88'),'MIN':_0x497e('0x59'),'AVG':_0x497e('0x5a'),'GROUP_CONCAT':_0x497e('0x5b'),'GROUP_CONCAT ASC':_0x497e('0x5c'),'GROUP_CONCAT DESC':_0x497e('0x89')};var _0x268673={'SEC_TO_TIME':_0x497e('0x5d'),'DATE':_0x497e('0x5e'),'HOUR':_0x497e('0x5f'),'ROUND':_0x497e('0x60'),'UNIX_TIMESTAMP':_0x497e('0x8a')};var _0x3daecd=function(_0x2173f8){return!_[_0x497e('0x7b')]([_0x497e('0x61'),_0x497e('0x62'),_0x497e('0x63'),_0x497e('0x64')],_0x2173f8);};var _0x50b3ca=function(_0x877883){if(!_0x877883||!_0x877883[_0x497e('0x65')][_0x497e('0x37')]){return'';}for(var _0x177b3d='(',_0x1979aa=0x0;_0x1979aa<_0x877883['rules'][_0x497e('0x37')];_0x1979aa+=0x1){_0x1979aa>0x0&&(_0x177b3d+='\x20'+_0x877883[_0x497e('0x66')]+'\x20');_0x177b3d+=_0x877883[_0x497e('0x65')][_0x1979aa]['group']?_0x50b3ca(_0x877883[_0x497e('0x65')][_0x1979aa]['group']):_0x877883['rules'][_0x1979aa][_0x497e('0x68')]+'\x20'+_0x877883[_0x497e('0x65')][_0x1979aa]['condition']+(_0x3daecd(_0x877883[_0x497e('0x65')][_0x1979aa]['condition'])?'\x20'+_0x877883['rules'][_0x1979aa]['value']:'');}return _0x177b3d+')';};var _0x488a30={'where':{'id':_0xe9a92['params']['id']}},_0x4f9181,_0x2fc5cf,_0x5c3051,_0x33536d,_0x512a20;_0x488a30=_['merge']({},_0x488a30,_0xe9a92['options']);return db[_0x497e('0x40')]['find'](_0x488a30)[_0x497e('0x23')](function(_0x4bfe25){if(_0x4bfe25){_0x4f9181=_0x4bfe25;return _0x4bfe25[_0x497e('0x6a')]();}return null;})['then'](function(_0x2ea56c){if(_0x2ea56c){if(!_0x2ea56c['length']){throw new db[(_0x497e('0x6b'))][(_0x497e('0x6c'))](_0x497e('0x6d'),0x193);}_0x2fc5cf=_0x2ea56c;return db[_0x497e('0x6e')][_0x497e('0x43')]({'raw':!![]});}return null;})['then'](function(_0x335447){if(_0x335447){_0x5c3051=_[_0x497e('0x6f')](_0x335447,'id');var _0x45c8bd;var _0x3acc9f=squel['select']();_0x3acc9f[_0x497e('0x8b')](_0x4f9181[_0x497e('0x71')]);for(var _0x3f9e84=0x0;_0x3f9e84<_0x2fc5cf['length'];_0x3f9e84+=0x1){_0x45c8bd=_0x2fc5cf[_0x3f9e84][_0x497e('0x72')]?_0x5c3051[_0x2fc5cf[_0x3f9e84]['MetricId']][_0x497e('0x73')]:_0x2fc5cf[_0x3f9e84][_0x497e('0x68')];_0x45c8bd=_0x2fc5cf[_0x3f9e84][_0x497e('0x74')]?_[_0x497e('0x75')](_0x240723[_0x2fc5cf[_0x3f9e84][_0x497e('0x74')]],'%s',_0x45c8bd):_0x45c8bd;_0x45c8bd=_0x2fc5cf[_0x3f9e84][_0x497e('0x76')]?_['replace'](_0x268673[_0x2fc5cf[_0x3f9e84][_0x497e('0x76')]],'%s',_0x45c8bd):_0x45c8bd;if(_0x2fc5cf[_0x3f9e84][_0x497e('0x8c')]){_0x3acc9f['group'](_0x45c8bd);}_0x2fc5cf[_0x3f9e84][_0x497e('0x77')]&&_0x3acc9f[_0x497e('0x8d')](_0x45c8bd,_0x2fc5cf[_0x3f9e84]['orderBy']==='DESC'?![]:!![]);_0x3acc9f[_0x497e('0x68')](_0x45c8bd,_0x2fc5cf[_0x3f9e84][_0x497e('0x78')]||_0x45c8bd);}if(_0x4f9181[_0x497e('0x79')]){_0x4f9181[_0x497e('0x79')]=JSON['parse'](_0x4f9181[_0x497e('0x79')]);for(var _0x2bf8be=0x0;_0x2bf8be<_0x4f9181[_0x497e('0x79')][_0x497e('0x37')];_0x2bf8be+=0x1){if(_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x2f')]&&_[_0x497e('0x7b')](_0x207796,_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x2f')])&&_0x4f9181[_0x497e('0x79')][_0x2bf8be]['parentKey']&&_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x7c')]&&_0x4f9181[_0x497e('0x79')][_0x2bf8be]['foreignKey']){_0x3acc9f[_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x2f')]](_0x4f9181['joins'][_0x2bf8be][_0x497e('0x7c')],null,util[_0x497e('0x76')](_0x497e('0x7e'),_0x4f9181['table'],_0x4f9181[_0x497e('0x79')][_0x2bf8be][_0x497e('0x8f')],_0x4f9181['joins'][_0x2bf8be]['foreignTable'],_0x4f9181['joins'][_0x2bf8be]['foreignKey']));}}}if(_0x4f9181['conditions']){_0x4f9181[_0x497e('0x7f')]=JSON[_0x497e('0x7a')](_0x4f9181['conditions']);_0x3acc9f[_0x497e('0x3a')](_0x50b3ca(_0x4f9181['conditions'][_0x497e('0x67')]));}_0x512a20=_0x3acc9f[_0x497e('0x80')]();_0x3acc9f[_0x497e('0x1e')](_0x258291);_0x3acc9f[_0x497e('0x1b')](0x0);logger['debug'](_0x497e('0xa1'),_0x3acc9f[_0x497e('0x82')]());return dbH[_0x497e('0x83')][_0x497e('0x32')](_0x3acc9f['toString'](),{'type':dbH[_0x497e('0x83')][_0x497e('0x84')][_0x497e('0x85')]});}})['then'](function(){return{'sql':_0x512a20[_0x497e('0x82')]()};})['then'](respondWithResult(_0x3a3b81,null))[_0x497e('0x4e')](handleError(_0x3a3b81,null));}; \ No newline at end of file +var _0x8f41=['UserProfileResource','destroy','sendStatus','error','name','send','index','map','AnalyticCustomReport','fieldName','type','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','rows','catch','rawAttributes','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','update','params','preview','join','left_join','right_join','COUNT(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','condition','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','parse','joins','includes','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','conditions','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','SUM(%s)','MIN(%s)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','value','ValidationErrorItem','keyBy','select','foreignKey','output','web','fullPath','%s-%s.%s','generate','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','SELECT','run','runReport','cross_join','COUNT(DISTINCT\x20%s)','MAX(%s)','Sequelize','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','get','CustomReports'];(function(_0xa3463d,_0x32f8da){var _0x50fd67=function(_0xb984fd){while(--_0xb984fd){_0xa3463d['push'](_0xa3463d['shift']());}};_0x50fd67(++_0x32f8da);}(_0x8f41,0x1c3));var _0x18f4=function(_0x3b0d76,_0x223d70){_0x3b0d76=_0x3b0d76-0x0;var _0x2295e0=_0x8f41[_0x3b0d76];return _0x2295e0;};'use strict';var emlformat=require(_0x18f4('0x0'));var rimraf=require(_0x18f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x18f4('0x2'));var rp=require(_0x18f4('0x3'));var moment=require(_0x18f4('0x4'));var BPromise=require(_0x18f4('0x5'));var Mustache=require(_0x18f4('0x6'));var util=require('util');var path=require(_0x18f4('0x7'));var sox=require(_0x18f4('0x8'));var csv=require(_0x18f4('0x9'));var ejs=require(_0x18f4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18f4('0xb'));var squel=require(_0x18f4('0xc'));var crypto=require(_0x18f4('0xd'));var jsforce=require(_0x18f4('0xe'));var deskjs=require(_0x18f4('0xf'));var toCsv=require(_0x18f4('0x9'));var querystring=require('querystring');var Papa=require(_0x18f4('0x10'));var Redis=require('ioredis');var authService=require(_0x18f4('0x11'));var qs=require(_0x18f4('0x12'));var as=require(_0x18f4('0x13'));var hardwareService=require(_0x18f4('0x14'));var logger=require(_0x18f4('0x15'))(_0x18f4('0x16'));var utils=require('../../config/utils');var config=require(_0x18f4('0x17'));var licenseUtil=require(_0x18f4('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x18f4('0x19'))[_0x18f4('0x1a')];function respondWithStatusCode(_0x5a0c52,_0x493731){_0x493731=_0x493731||0xcc;return function(_0x5652ca){if(_0x5652ca){return _0x5a0c52['sendStatus'](_0x493731);}return _0x5a0c52[_0x18f4('0x1b')](_0x493731)[_0x18f4('0x1c')]();};}function respondWithResult(_0x14f374,_0x10e956){_0x10e956=_0x10e956||0xc8;return function(_0x339fc1){if(_0x339fc1){return _0x14f374[_0x18f4('0x1b')](_0x10e956)[_0x18f4('0x1d')](_0x339fc1);}};}function respondWithFilteredResult(_0x1ca11b,_0x5628d0){return function(_0xcbeb56){if(_0xcbeb56){var _0x1ef08e=typeof _0x5628d0[_0x18f4('0x1e')]===_0x18f4('0x1f')&&typeof _0x5628d0[_0x18f4('0x20')]===_0x18f4('0x1f');var _0x5c63fc=_0xcbeb56[_0x18f4('0x21')];var _0x14318a=_0x1ef08e?0x0:_0x5628d0[_0x18f4('0x1e')];var _0x14b262=_0x1ef08e?_0xcbeb56[_0x18f4('0x21')]:_0x5628d0[_0x18f4('0x1e')]+_0x5628d0[_0x18f4('0x20')];var _0x3bee76;if(_0x14b262>=_0x5c63fc){_0x14b262=_0x5c63fc;_0x3bee76=0xc8;}else{_0x3bee76=0xce;}_0x1ca11b[_0x18f4('0x1b')](_0x3bee76);return _0x1ca11b[_0x18f4('0x22')](_0x18f4('0x23'),_0x14318a+'-'+_0x14b262+'/'+_0x5c63fc)[_0x18f4('0x1d')](_0xcbeb56);}return null;};}function patchUpdates(_0x224899){return function(_0x2762c5){try{jsonpatch[_0x18f4('0x24')](_0x2762c5,_0x224899,!![]);}catch(_0x1df3c1){return BPromise['reject'](_0x1df3c1);}return _0x2762c5[_0x18f4('0x25')]();};}function saveUpdates(_0x420cb3,_0x1a9aee){return function(_0x4b0030){if(_0x4b0030){return _0x4b0030['update'](_0x420cb3)[_0x18f4('0x26')](function(_0x300ab9){return _0x300ab9;});}return null;};}function removeEntity(_0x506a1a,_0x2cf648){return function(_0x97caf8){if(_0x97caf8){return _0x97caf8['destroy']()[_0x18f4('0x26')](function(){var _0x381939=_0x97caf8[_0x18f4('0x27')]({'plain':!![]});var _0x501491=_0x18f4('0x28');return db[_0x18f4('0x29')][_0x18f4('0x2a')]({'where':{'type':_0x501491,'resourceId':_0x381939['id']}})[_0x18f4('0x26')](function(){return _0x97caf8;});})[_0x18f4('0x26')](function(){_0x506a1a[_0x18f4('0x1b')](0xcc)[_0x18f4('0x1c')]();});}};}function handleEntityNotFound(_0x449430,_0x471e68){return function(_0x37a5ba){if(!_0x37a5ba){_0x449430[_0x18f4('0x2b')](0x194);}return _0x37a5ba;};}function handleError(_0x36a8dc,_0x18fbf3){_0x18fbf3=_0x18fbf3||0x1f4;return function(_0x1dc1b3){logger[_0x18f4('0x2c')](_0x1dc1b3['stack']);if(_0x1dc1b3[_0x18f4('0x2d')]){delete _0x1dc1b3[_0x18f4('0x2d')];}_0x36a8dc[_0x18f4('0x1b')](_0x18fbf3)[_0x18f4('0x2e')](_0x1dc1b3);};}exports[_0x18f4('0x2f')]=function(_0x20abdb,_0x1cc776){var _0x6523ed={},_0x2e6ecf={},_0xaa679a={'count':0x0,'rows':[]};var _0x666692=_[_0x18f4('0x30')](db[_0x18f4('0x31')]['rawAttributes'],function(_0x6a27fd){return{'name':_0x6a27fd[_0x18f4('0x32')],'type':_0x6a27fd[_0x18f4('0x33')]['key']};});_0x2e6ecf[_0x18f4('0x34')]=_[_0x18f4('0x30')](_0x666692,_0x18f4('0x2d'));_0x2e6ecf[_0x18f4('0x35')]=_[_0x18f4('0x36')](_0x20abdb[_0x18f4('0x35')]);_0x2e6ecf['filters']=_[_0x18f4('0x37')](_0x2e6ecf[_0x18f4('0x34')],_0x2e6ecf[_0x18f4('0x35')]);_0x6523ed['attributes']=_[_0x18f4('0x37')](_0x2e6ecf[_0x18f4('0x34')],qs[_0x18f4('0x38')](_0x20abdb[_0x18f4('0x35')][_0x18f4('0x38')]));_0x6523ed['attributes']=_0x6523ed[_0x18f4('0x39')]['length']?_0x6523ed['attributes']:_0x2e6ecf['model'];if(!_0x20abdb[_0x18f4('0x35')][_0x18f4('0x3a')](_0x18f4('0x3b'))){_0x6523ed[_0x18f4('0x20')]=qs[_0x18f4('0x20')](_0x20abdb[_0x18f4('0x35')][_0x18f4('0x20')]);_0x6523ed[_0x18f4('0x1e')]=qs[_0x18f4('0x1e')](_0x20abdb[_0x18f4('0x35')][_0x18f4('0x1e')]);}_0x6523ed[_0x18f4('0x3c')]=qs['sort'](_0x20abdb['query'][_0x18f4('0x3d')]);_0x6523ed[_0x18f4('0x3e')]=qs[_0x18f4('0x3f')](_['pick'](_0x20abdb[_0x18f4('0x35')],_0x2e6ecf[_0x18f4('0x3f')]),_0x666692);if(_0x20abdb[_0x18f4('0x35')][_0x18f4('0x40')]){_0x6523ed[_0x18f4('0x3e')]=_[_0x18f4('0x41')](_0x6523ed[_0x18f4('0x3e')],{'$or':_[_0x18f4('0x30')](_0x666692,function(_0x3b3986){if(_0x3b3986[_0x18f4('0x33')]!=='VIRTUAL'){var _0x1c1a6f={};_0x1c1a6f[_0x3b3986[_0x18f4('0x2d')]]={'$like':'%'+_0x20abdb[_0x18f4('0x35')]['filter']+'%'};return _0x1c1a6f;}})});}_0x6523ed=_[_0x18f4('0x41')]({},_0x6523ed,_0x20abdb[_0x18f4('0x42')]);var _0x32336a={'where':_0x6523ed[_0x18f4('0x3e')]};return db['AnalyticCustomReport'][_0x18f4('0x21')](_0x32336a)['then'](function(_0x4b15a4){_0xaa679a[_0x18f4('0x21')]=_0x4b15a4;if(_0x20abdb[_0x18f4('0x35')]['includeAll']){_0x6523ed[_0x18f4('0x43')]=[{'all':!![]}];}return db[_0x18f4('0x31')]['findAll'](_0x6523ed);})['then'](function(_0x462bf5){_0xaa679a[_0x18f4('0x44')]=_0x462bf5;return _0xaa679a;})[_0x18f4('0x26')](respondWithFilteredResult(_0x1cc776,_0x6523ed))[_0x18f4('0x45')](handleError(_0x1cc776,null));};exports['show']=function(_0x5bcde4,_0x1d5e40){var _0x576ac0={'raw':![],'where':{'id':_0x5bcde4['params']['id']}},_0x3883b9={};_0x3883b9[_0x18f4('0x34')]=_[_0x18f4('0x36')](db[_0x18f4('0x31')][_0x18f4('0x46')]);_0x3883b9[_0x18f4('0x35')]=_[_0x18f4('0x36')](_0x5bcde4['query']);_0x3883b9[_0x18f4('0x3f')]=_[_0x18f4('0x37')](_0x3883b9[_0x18f4('0x34')],_0x3883b9[_0x18f4('0x35')]);_0x576ac0['attributes']=_[_0x18f4('0x37')](_0x3883b9['model'],qs[_0x18f4('0x38')](_0x5bcde4[_0x18f4('0x35')][_0x18f4('0x38')]));_0x576ac0[_0x18f4('0x39')]=_0x576ac0[_0x18f4('0x39')][_0x18f4('0x47')]?_0x576ac0[_0x18f4('0x39')]:_0x3883b9[_0x18f4('0x34')];if(_0x5bcde4[_0x18f4('0x35')]['includeAll']){_0x576ac0[_0x18f4('0x43')]=[{'all':!![]}];}_0x576ac0=_['merge']({},_0x576ac0,_0x5bcde4['options']);return db[_0x18f4('0x31')]['find'](_0x576ac0)[_0x18f4('0x26')](handleEntityNotFound(_0x1d5e40,null))[_0x18f4('0x26')](respondWithResult(_0x1d5e40,null))[_0x18f4('0x45')](handleError(_0x1d5e40,null));};exports[_0x18f4('0x48')]=function(_0x43f559,_0x3b1cc7){return db[_0x18f4('0x31')][_0x18f4('0x48')](_0x43f559[_0x18f4('0x49')],{})[_0x18f4('0x26')](function(_0x224980){var _0x2b8fa6=_0x43f559[_0x18f4('0x4a')]['get']({'plain':!![]});if(!_0x2b8fa6)throw new Error(_0x18f4('0x4b'));if(_0x2b8fa6[_0x18f4('0x4c')]===_0x18f4('0x4a')){var _0x2d594d=_0x224980[_0x18f4('0x27')]({'plain':!![]});var _0x2e6b73=_0x18f4('0x4d');return db[_0x18f4('0x4e')][_0x18f4('0x4f')]({'where':{'name':_0x2e6b73,'userProfileId':_0x2b8fa6[_0x18f4('0x50')]},'raw':!![]})[_0x18f4('0x26')](function(_0x540816){if(_0x540816&&_0x540816[_0x18f4('0x51')]===0x0){return db[_0x18f4('0x29')][_0x18f4('0x48')]({'name':_0x2d594d[_0x18f4('0x2d')],'resourceId':_0x2d594d['id'],'type':_0x18f4('0x28'),'sectionId':_0x540816['id']},{})[_0x18f4('0x26')](function(){return _0x224980;});}else{return _0x224980;}})[_0x18f4('0x45')](function(_0x487b94){logger[_0x18f4('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x487b94);throw _0x487b94;});}return _0x224980;})[_0x18f4('0x26')](respondWithResult(_0x3b1cc7,0xc9))[_0x18f4('0x45')](handleError(_0x3b1cc7,null));};exports[_0x18f4('0x52')]=function(_0x15d797,_0xab6d25){if(_0x15d797[_0x18f4('0x49')]['id']){delete _0x15d797[_0x18f4('0x49')]['id'];}return db[_0x18f4('0x31')][_0x18f4('0x4f')]({'where':{'id':_0x15d797[_0x18f4('0x53')]['id']}})[_0x18f4('0x26')](handleEntityNotFound(_0xab6d25,null))['then'](saveUpdates(_0x15d797[_0x18f4('0x49')],null))[_0x18f4('0x26')](respondWithResult(_0xab6d25,null))[_0x18f4('0x45')](handleError(_0xab6d25,null));};exports[_0x18f4('0x2a')]=function(_0x390c30,_0x17e4a2){return db[_0x18f4('0x31')][_0x18f4('0x4f')]({'where':{'id':_0x390c30[_0x18f4('0x53')]['id']}})[_0x18f4('0x26')](handleEntityNotFound(_0x17e4a2,null))[_0x18f4('0x26')](removeEntity(_0x17e4a2,null))[_0x18f4('0x45')](handleError(_0x17e4a2,null));};exports[_0x18f4('0x54')]=function(_0x4e1e2f,_0x49a41d){var _0x52fbed=0xa;var _0x37788c=[_0x18f4('0x55'),_0x18f4('0x56'),_0x18f4('0x57'),'cross_join'];var _0x28fda5={'SUM':'SUM(%s)','COUNT':_0x18f4('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x18f4('0x59'),'GROUP_CONCAT':_0x18f4('0x5a'),'GROUP_CONCAT ASC':_0x18f4('0x5b'),'GROUP_CONCAT DESC':_0x18f4('0x5c')};var _0x30078a={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x18f4('0x5d'),'UNIX_TIMESTAMP':_0x18f4('0x5e')};var _0x17875b=function(_0x3f20cb){return!_['includes']([_0x18f4('0x5f'),_0x18f4('0x60'),_0x18f4('0x61'),_0x18f4('0x62')],_0x3f20cb);};var _0x3067af=function(_0x2909eb){if(!_0x2909eb||!_0x2909eb['rules']['length']){return'';}for(var _0x26e34f='(',_0x138d11=0x0;_0x138d11<_0x2909eb['rules']['length'];_0x138d11+=0x1){_0x138d11>0x0&&(_0x26e34f+='\x20'+_0x2909eb[_0x18f4('0x63')]+'\x20');_0x26e34f+=_0x2909eb[_0x18f4('0x64')][_0x138d11]['group']?_0x3067af(_0x2909eb[_0x18f4('0x64')][_0x138d11][_0x18f4('0x65')]):_0x2909eb[_0x18f4('0x64')][_0x138d11]['field']+'\x20'+_0x2909eb[_0x18f4('0x64')][_0x138d11][_0x18f4('0x66')]+(_0x17875b(_0x2909eb[_0x18f4('0x64')][_0x138d11][_0x18f4('0x66')])?'\x20'+_0x2909eb[_0x18f4('0x64')][_0x138d11]['value']:'');}return _0x26e34f+')';};var _0x4c178a={'where':{'id':_0x4e1e2f[_0x18f4('0x53')]['id']}},_0x16dc23,_0x48fae4,_0x135c42,_0x7f71f2,_0x1223c0;_0x4c178a=_['merge']({},_0x4c178a,_0x4e1e2f[_0x18f4('0x42')]);return db['AnalyticCustomReport'][_0x18f4('0x4f')](_0x4c178a)[_0x18f4('0x26')](function(_0x187400){if(_0x187400){_0x16dc23=_0x187400;return _0x187400[_0x18f4('0x67')]();}return null;})[_0x18f4('0x26')](function(_0xcf1343){if(_0xcf1343){if(!_0xcf1343[_0x18f4('0x47')]){throw new db['Sequelize']['ValidationErrorItem'](_0x18f4('0x68'),0x193);}_0x48fae4=_0xcf1343;return db[_0x18f4('0x69')][_0x18f4('0x6a')]({'raw':!![]});}return null;})[_0x18f4('0x26')](function(_0x2d8591){if(_0x2d8591){_0x135c42=_['keyBy'](_0x2d8591,'id');var _0x495362;var _0x5b7069=squel['select']();_0x5b7069['from'](_0x16dc23[_0x18f4('0x6b')]);for(var _0xe2607a=0x0;_0xe2607a<_0x48fae4[_0x18f4('0x47')];_0xe2607a+=0x1){_0x495362=_0x48fae4[_0xe2607a][_0x18f4('0x6c')]?_0x135c42[_0x48fae4[_0xe2607a]['MetricId']][_0x18f4('0x6d')]:_0x48fae4[_0xe2607a][_0x18f4('0x6e')];_0x495362=_0x48fae4[_0xe2607a][_0x18f4('0x6f')]?_['replace'](_0x28fda5[_0x48fae4[_0xe2607a][_0x18f4('0x6f')]],'%s',_0x495362):_0x495362;_0x495362=_0x48fae4[_0xe2607a][_0x18f4('0x70')]?_[_0x18f4('0x71')](_0x30078a[_0x48fae4[_0xe2607a]['format']],'%s',_0x495362):_0x495362;if(_0x48fae4[_0xe2607a][_0x18f4('0x72')]){_0x5b7069['group'](_0x495362);}_0x48fae4[_0xe2607a][_0x18f4('0x73')]&&_0x5b7069[_0x18f4('0x3c')](_0x495362,_0x48fae4[_0xe2607a][_0x18f4('0x73')]===_0x18f4('0x74')?![]:!![]);_0x5b7069[_0x18f4('0x6e')](_0x495362,_0x48fae4[_0xe2607a][_0x18f4('0x75')]||_0x495362);}if(_0x16dc23['joins']){_0x16dc23['joins']=JSON[_0x18f4('0x76')](_0x16dc23[_0x18f4('0x77')]);for(var _0x550384=0x0;_0x550384<_0x16dc23['joins'][_0x18f4('0x47')];_0x550384+=0x1){if(_0x16dc23[_0x18f4('0x77')][_0x550384]['type']&&_[_0x18f4('0x78')](_0x37788c,_0x16dc23['joins'][_0x550384][_0x18f4('0x33')])&&_0x16dc23['joins'][_0x550384]['parentKey']&&_0x16dc23[_0x18f4('0x77')][_0x550384]['foreignTable']&&_0x16dc23[_0x18f4('0x77')][_0x550384]['foreignKey']){_0x5b7069[_0x16dc23[_0x18f4('0x77')][_0x550384][_0x18f4('0x33')]](_0x16dc23[_0x18f4('0x77')][_0x550384][_0x18f4('0x79')],null,util['format'](_0x18f4('0x7a'),_0x16dc23['table'],_0x16dc23[_0x18f4('0x77')][_0x550384][_0x18f4('0x7b')],_0x16dc23['joins'][_0x550384][_0x18f4('0x79')],_0x16dc23[_0x18f4('0x77')][_0x550384]['foreignKey']));}}}if(_0x16dc23[_0x18f4('0x7c')]){_0x16dc23['conditions']=JSON[_0x18f4('0x76')](_0x16dc23[_0x18f4('0x7c')]);_0x5b7069[_0x18f4('0x3e')](_0x3067af(_0x16dc23['conditions']['group']));}_0x1223c0=_0x5b7069[_0x18f4('0x7d')]();_0x5b7069['limit'](_0x52fbed);_0x5b7069[_0x18f4('0x1e')](0x0);logger[_0x18f4('0x7e')](_0x18f4('0x7f'),_0x5b7069['toString']());return dbH[_0x18f4('0x80')]['query'](_0x5b7069[_0x18f4('0x81')](),{'type':dbH[_0x18f4('0x80')][_0x18f4('0x82')]['SELECT']});}})[_0x18f4('0x26')](respondWithResult(_0x49a41d,null))[_0x18f4('0x45')](handleError(_0x49a41d,null));};function runReport(_0x31968e,_0x19a537,_0x3c3821){var _0x5df7e9=_0x19a537['name'];var _0x4fc7a9=0xa;var _0x5287ca=[_0x18f4('0x55'),_0x18f4('0x56'),_0x18f4('0x57'),'cross_join'];var _0x10f805={'SUM':_0x18f4('0x83'),'COUNT':_0x18f4('0x58'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x18f4('0x84'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x18f4('0x5a'),'GROUP_CONCAT ASC':_0x18f4('0x5b'),'GROUP_CONCAT DESC':_0x18f4('0x5c')};var _0x363d41={'SEC_TO_TIME':_0x18f4('0x85'),'DATE':_0x18f4('0x86'),'HOUR':_0x18f4('0x87'),'ROUND':_0x18f4('0x5d'),'UNIX_TIMESTAMP':_0x18f4('0x5e')};var _0x43e1c8=function(_0x5f591a){return!_[_0x18f4('0x78')](['IS\x20NULL',_0x18f4('0x60'),_0x18f4('0x61'),_0x18f4('0x62')],_0x5f591a);};var _0xe5a813=function(_0x1bb5f8){if(!_0x1bb5f8||!_0x1bb5f8['rules'][_0x18f4('0x47')]){return'';}for(var _0x4a8805='(',_0xb36dc=0x0;_0xb36dc<_0x1bb5f8[_0x18f4('0x64')]['length'];_0xb36dc+=0x1){_0xb36dc>0x0&&(_0x4a8805+='\x20'+_0x1bb5f8[_0x18f4('0x63')]+'\x20');_0x4a8805+=_0x1bb5f8[_0x18f4('0x64')][_0xb36dc][_0x18f4('0x65')]?_0xe5a813(_0x1bb5f8[_0x18f4('0x64')][_0xb36dc]['group']):_0x1bb5f8[_0x18f4('0x64')][_0xb36dc][_0x18f4('0x6e')]+'\x20'+_0x1bb5f8[_0x18f4('0x64')][_0xb36dc]['condition']+(_0x43e1c8(_0x1bb5f8[_0x18f4('0x64')][_0xb36dc][_0x18f4('0x66')])?'\x20'+_0x1bb5f8[_0x18f4('0x64')][_0xb36dc][_0x18f4('0x88')]:'');}return _0x4a8805+')';};var _0x17c83d={'where':{'id':_0x31968e['id']}},_0x58535d,_0x1c2346,_0x2d5077,_0x73d35d,_0x239db4;_0x17c83d=_['merge']({},_0x17c83d,_0x3c3821);return db['AnalyticCustomReport'][_0x18f4('0x4f')](_0x17c83d)['then'](function(_0x730704){if(_0x730704){_0x58535d=_0x730704;return _0x730704[_0x18f4('0x67')]();}return null;})[_0x18f4('0x26')](function(_0x3957de){if(_0x3957de){if(!_0x3957de['length']){throw new db['Sequelize'][(_0x18f4('0x89'))](_0x18f4('0x68'),0x193);}_0x1c2346=_0x3957de;return db[_0x18f4('0x69')][_0x18f4('0x6a')]({'raw':!![]});}return null;})['then'](function(_0x6ea3d7){if(_0x6ea3d7){_0x2d5077=_[_0x18f4('0x8a')](_0x6ea3d7,'id');var _0x4ccf70;var _0x31c1ac=squel[_0x18f4('0x8b')]();_0x31c1ac['from'](_0x58535d['table']);for(var _0x1c326f=0x0;_0x1c326f<_0x1c2346[_0x18f4('0x47')];_0x1c326f+=0x1){_0x4ccf70=_0x1c2346[_0x1c326f]['MetricId']?_0x2d5077[_0x1c2346[_0x1c326f][_0x18f4('0x6c')]][_0x18f4('0x6d')]:_0x1c2346[_0x1c326f][_0x18f4('0x6e')];_0x4ccf70=_0x1c2346[_0x1c326f][_0x18f4('0x6f')]?_[_0x18f4('0x71')](_0x10f805[_0x1c2346[_0x1c326f][_0x18f4('0x6f')]],'%s',_0x4ccf70):_0x4ccf70;_0x4ccf70=_0x1c2346[_0x1c326f]['format']?_[_0x18f4('0x71')](_0x363d41[_0x1c2346[_0x1c326f][_0x18f4('0x70')]],'%s',_0x4ccf70):_0x4ccf70;if(_0x1c2346[_0x1c326f][_0x18f4('0x72')]){_0x31c1ac[_0x18f4('0x65')](_0x4ccf70);}_0x1c2346[_0x1c326f]['orderBy']&&_0x31c1ac[_0x18f4('0x3c')](_0x4ccf70,_0x1c2346[_0x1c326f][_0x18f4('0x73')]==='DESC'?![]:!![]);_0x31c1ac['field'](_0x4ccf70,_0x1c2346[_0x1c326f][_0x18f4('0x75')]||_0x4ccf70);}if(_0x58535d[_0x18f4('0x77')]){_0x58535d[_0x18f4('0x77')]=JSON[_0x18f4('0x76')](_0x58535d[_0x18f4('0x77')]);for(var _0x2f9909=0x0;_0x2f9909<_0x58535d[_0x18f4('0x77')][_0x18f4('0x47')];_0x2f9909+=0x1){if(_0x58535d['joins'][_0x2f9909][_0x18f4('0x33')]&&_[_0x18f4('0x78')](_0x5287ca,_0x58535d['joins'][_0x2f9909]['type'])&&_0x58535d['joins'][_0x2f9909][_0x18f4('0x7b')]&&_0x58535d[_0x18f4('0x77')][_0x2f9909][_0x18f4('0x79')]&&_0x58535d[_0x18f4('0x77')][_0x2f9909][_0x18f4('0x8c')]){_0x31c1ac[_0x58535d['joins'][_0x2f9909][_0x18f4('0x33')]](_0x58535d[_0x18f4('0x77')][_0x2f9909][_0x18f4('0x79')],null,util[_0x18f4('0x70')]('%s.%s\x20=\x20%s.%s',_0x58535d[_0x18f4('0x6b')],_0x58535d[_0x18f4('0x77')][_0x2f9909][_0x18f4('0x7b')],_0x58535d[_0x18f4('0x77')][_0x2f9909][_0x18f4('0x79')],_0x58535d['joins'][_0x2f9909]['foreignKey']));}}}if(_0x58535d[_0x18f4('0x7c')]){_0x58535d['conditions']=JSON[_0x18f4('0x76')](_0x58535d[_0x18f4('0x7c')]);_0x31c1ac[_0x18f4('0x3e')](_0xe5a813(_0x58535d[_0x18f4('0x7c')][_0x18f4('0x65')]));}_0x239db4=_0x31c1ac[_0x18f4('0x7d')]();_0x31c1ac[_0x18f4('0x20')](_0x4fc7a9);_0x31c1ac[_0x18f4('0x1e')](0x0);return;}})[_0x18f4('0x26')](function(){if(_0x19a537[_0x18f4('0x8d')]===_0x18f4('0x8e')){return null;}var _0x1d0e8f=_['merge'](_0x19a537,{'name':_0x19a537[_0x18f4('0x8f')]||_0x19a537[_0x18f4('0x2d')]||_0x58535d[_0x18f4('0x2d')],'basename':_0x5df7e9,'savename':util[_0x18f4('0x70')](_0x18f4('0x90'),_0x19a537[_0x18f4('0x2d')]||_0x58535d[_0x18f4('0x2d')],require('randomstring')[_0x18f4('0x91')](0x4),_0x19a537[_0x18f4('0x8d')]||_0x18f4('0x92')),'reportId':_0x58535d['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x18f4('0x48')](_0x1d0e8f,{'raw':!![]});})['then'](function(_0x4800d9){if(_0x58535d[_0x18f4('0x6b')]===_0x18f4('0x93')){_0x239db4[_0x18f4('0x3e')](_0x58535d[_0x18f4('0x6b')]+_0x18f4('0x94'),_0x19a537['startDate'],_0x19a537[_0x18f4('0x95')]);}else{_0x239db4[_0x18f4('0x3e')](_0x58535d[_0x18f4('0x6b')]+_0x18f4('0x96'),_0x19a537['startDate'],_0x19a537[_0x18f4('0x95')]);}if(_0x4800d9){logger[_0x18f4('0x97')](_0x18f4('0x98'),_0x239db4[_0x18f4('0x81')]());require(_0x18f4('0x99'))[_0x18f4('0x9a')](path[_0x18f4('0x55')](__dirname,'../../components/export/',_0x4800d9[_0x18f4('0x8d')]),[_0x4800d9['id'],_0x239db4['toString'](),path[_0x18f4('0x55')](__dirname,_0x18f4('0x9b'),_0x4800d9[_0x18f4('0x9c')]),_0x5df7e9]);return _0x4800d9;}else{var _0x3c8063=squel[_0x18f4('0x8b')]();_0x3c8063['from']('('+_0x239db4[_0x18f4('0x81')]()+')','countTable');_0x3c8063[_0x18f4('0x6e')]('COUNT(*)',_0x18f4('0x21'));_0x239db4[_0x18f4('0x20')](_0x19a537[_0x18f4('0x20')]||_0x4fc7a9);_0x239db4[_0x18f4('0x1e')](_0x19a537['offset']||0x0);return dbH['sequelize'][_0x18f4('0x35')](_0x3c8063[_0x18f4('0x81')](),{'type':dbH[_0x18f4('0x80')]['QueryTypes'][_0x18f4('0x9d')]})[_0x18f4('0x26')](function(_0x3016b3){if(!_0x3016b3[_0x18f4('0x47')]){_0x73d35d=0x0;}else{_0x73d35d=_0x3016b3[0x0][_0x18f4('0x21')]||0x0;}return dbH[_0x18f4('0x80')]['query'](_0x239db4['toString'](),{'type':dbH[_0x18f4('0x80')][_0x18f4('0x82')][_0x18f4('0x9d')]});})[_0x18f4('0x26')](function(_0x422e9f){return{'rows':_0x422e9f||[],'count':_0x73d35d};});}});}exports[_0x18f4('0x9e')]=function(_0x5717cf,_0x442955){return runReport(_0x5717cf[_0x18f4('0x53')],_0x5717cf[_0x18f4('0x35')],_0x5717cf[_0x18f4('0x42')])[_0x18f4('0x26')](respondWithResult(_0x442955,null))[_0x18f4('0x45')](handleError(_0x442955,null));};exports[_0x18f4('0x9f')]=runReport;exports[_0x18f4('0x35')]=function(_0x7e37b1,_0x41294b){var _0x9ab6d7=0xa;var _0x486a6f=[_0x18f4('0x55'),_0x18f4('0x56'),_0x18f4('0x57'),_0x18f4('0xa0')];var _0x30cb6d={'SUM':_0x18f4('0x83'),'COUNT':_0x18f4('0x58'),'COUNT DISTINCT':_0x18f4('0xa1'),'MAX':_0x18f4('0xa2'),'MIN':_0x18f4('0x84'),'AVG':_0x18f4('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x18f4('0x5b'),'GROUP_CONCAT DESC':_0x18f4('0x5c')};var _0x459070={'SEC_TO_TIME':_0x18f4('0x85'),'DATE':'DATE(%s)','HOUR':_0x18f4('0x87'),'ROUND':_0x18f4('0x5d'),'UNIX_TIMESTAMP':_0x18f4('0x5e')};var _0x520ac8=function(_0x343a92){return!_[_0x18f4('0x78')](['IS\x20NULL',_0x18f4('0x60'),_0x18f4('0x61'),_0x18f4('0x62')],_0x343a92);};var _0xa158b5=function(_0x55a239){if(!_0x55a239||!_0x55a239[_0x18f4('0x64')]['length']){return'';}for(var _0x116e1f='(',_0x6ad36a=0x0;_0x6ad36a<_0x55a239[_0x18f4('0x64')][_0x18f4('0x47')];_0x6ad36a+=0x1){_0x6ad36a>0x0&&(_0x116e1f+='\x20'+_0x55a239[_0x18f4('0x63')]+'\x20');_0x116e1f+=_0x55a239[_0x18f4('0x64')][_0x6ad36a]['group']?_0xa158b5(_0x55a239[_0x18f4('0x64')][_0x6ad36a]['group']):_0x55a239[_0x18f4('0x64')][_0x6ad36a][_0x18f4('0x6e')]+'\x20'+_0x55a239[_0x18f4('0x64')][_0x6ad36a][_0x18f4('0x66')]+(_0x520ac8(_0x55a239[_0x18f4('0x64')][_0x6ad36a][_0x18f4('0x66')])?'\x20'+_0x55a239[_0x18f4('0x64')][_0x6ad36a][_0x18f4('0x88')]:'');}return _0x116e1f+')';};var _0x3d0bc7={'where':{'id':_0x7e37b1[_0x18f4('0x53')]['id']}},_0x24644d,_0x1379d4,_0x13b4aa,_0x50330a,_0x370e2f;_0x3d0bc7=_[_0x18f4('0x41')]({},_0x3d0bc7,_0x7e37b1[_0x18f4('0x42')]);return db[_0x18f4('0x31')][_0x18f4('0x4f')](_0x3d0bc7)[_0x18f4('0x26')](function(_0x13bb7e){if(_0x13bb7e){_0x24644d=_0x13bb7e;return _0x13bb7e['getFields']();}return null;})[_0x18f4('0x26')](function(_0x5e02d7){if(_0x5e02d7){if(!_0x5e02d7[_0x18f4('0x47')]){throw new db[(_0x18f4('0xa3'))]['ValidationErrorItem'](_0x18f4('0x68'),0x193);}_0x1379d4=_0x5e02d7;return db[_0x18f4('0x69')][_0x18f4('0x6a')]({'raw':!![]});}return null;})[_0x18f4('0x26')](function(_0x5aaf6f){if(_0x5aaf6f){_0x13b4aa=_[_0x18f4('0x8a')](_0x5aaf6f,'id');var _0x144d3d;var _0x2958ce=squel[_0x18f4('0x8b')]();_0x2958ce['from'](_0x24644d['table']);for(var _0x1db7f2=0x0;_0x1db7f2<_0x1379d4['length'];_0x1db7f2+=0x1){_0x144d3d=_0x1379d4[_0x1db7f2][_0x18f4('0x6c')]?_0x13b4aa[_0x1379d4[_0x1db7f2]['MetricId']][_0x18f4('0x6d')]:_0x1379d4[_0x1db7f2][_0x18f4('0x6e')];_0x144d3d=_0x1379d4[_0x1db7f2][_0x18f4('0x6f')]?_[_0x18f4('0x71')](_0x30cb6d[_0x1379d4[_0x1db7f2]['function']],'%s',_0x144d3d):_0x144d3d;_0x144d3d=_0x1379d4[_0x1db7f2]['format']?_['replace'](_0x459070[_0x1379d4[_0x1db7f2]['format']],'%s',_0x144d3d):_0x144d3d;if(_0x1379d4[_0x1db7f2][_0x18f4('0x72')]){_0x2958ce[_0x18f4('0x65')](_0x144d3d);}_0x1379d4[_0x1db7f2]['orderBy']&&_0x2958ce[_0x18f4('0x3c')](_0x144d3d,_0x1379d4[_0x1db7f2][_0x18f4('0x73')]===_0x18f4('0x74')?![]:!![]);_0x2958ce[_0x18f4('0x6e')](_0x144d3d,_0x1379d4[_0x1db7f2][_0x18f4('0x75')]||_0x144d3d);}if(_0x24644d[_0x18f4('0x77')]){_0x24644d[_0x18f4('0x77')]=JSON[_0x18f4('0x76')](_0x24644d[_0x18f4('0x77')]);for(var _0x334dbf=0x0;_0x334dbf<_0x24644d[_0x18f4('0x77')][_0x18f4('0x47')];_0x334dbf+=0x1){if(_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x33')]&&_['includes'](_0x486a6f,_0x24644d['joins'][_0x334dbf]['type'])&&_0x24644d[_0x18f4('0x77')][_0x334dbf]['parentKey']&&_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x79')]&&_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x8c')]){_0x2958ce[_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x33')]](_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x79')],null,util[_0x18f4('0x70')](_0x18f4('0x7a'),_0x24644d[_0x18f4('0x6b')],_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x7b')],_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x79')],_0x24644d[_0x18f4('0x77')][_0x334dbf][_0x18f4('0x8c')]));}}}if(_0x24644d['conditions']){_0x24644d[_0x18f4('0x7c')]=JSON['parse'](_0x24644d[_0x18f4('0x7c')]);_0x2958ce[_0x18f4('0x3e')](_0xa158b5(_0x24644d[_0x18f4('0x7c')][_0x18f4('0x65')]));}_0x370e2f=_0x2958ce[_0x18f4('0x7d')]();_0x2958ce['limit'](_0x9ab6d7);_0x2958ce[_0x18f4('0x1e')](0x0);logger[_0x18f4('0x7e')]('Limited\x20Query:',_0x2958ce['toString']());return dbH[_0x18f4('0x80')]['query'](_0x2958ce['toString'](),{'type':dbH[_0x18f4('0x80')][_0x18f4('0x82')][_0x18f4('0x9d')]});}})[_0x18f4('0x26')](function(){return{'sql':_0x370e2f[_0x18f4('0x81')]()};})[_0x18f4('0x26')](respondWithResult(_0x41294b,null))[_0x18f4('0x45')](handleError(_0x41294b,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e7abd33..557eaea 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 _0x3bf4=['rimraf','../../config/environment','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xd81b5b,_0x15f6a7){var _0x52ffd9=function(_0x5571ea){while(--_0x5571ea){_0xd81b5b['push'](_0xd81b5b['shift']());}};_0x52ffd9(++_0x15f6a7);}(_0x3bf4,0xd6));var _0x43bf=function(_0x164331,_0x14b8ec){_0x164331=_0x164331-0x0;var _0x2d6c1f=_0x3bf4[_0x164331];return _0x2d6c1f;};'use strict';var _=require(_0x43bf('0x0'));var util=require(_0x43bf('0x1'));var logger=require(_0x43bf('0x2'))(_0x43bf('0x3'));var moment=require(_0x43bf('0x4'));var BPromise=require('bluebird');var rp=require(_0x43bf('0x5'));var fs=require('fs');var path=require(_0x43bf('0x6'));var rimraf=require(_0x43bf('0x7'));var config=require(_0x43bf('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x43bf('0x9')]=function(_0x51c582,_0x4c9852){return _0x51c582[_0x43bf('0xa')](_0x43bf('0xb'),attributes,{'tableName':_0x43bf('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7042=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api'];(function(_0x3e6695,_0x521f24){var _0x4001e2=function(_0x2fab96){while(--_0x2fab96){_0x3e6695['push'](_0x3e6695['shift']());}};_0x4001e2(++_0x521f24);}(_0x7042,0xdd));var _0x2704=function(_0x51f36c,_0x15345d){_0x51f36c=_0x51f36c-0x0;var _0x399cc5=_0x7042[_0x51f36c];return _0x399cc5;};'use strict';var _=require(_0x2704('0x0'));var util=require(_0x2704('0x1'));var logger=require(_0x2704('0x2'))(_0x2704('0x3'));var moment=require(_0x2704('0x4'));var BPromise=require(_0x2704('0x5'));var rp=require(_0x2704('0x6'));var fs=require('fs');var path=require(_0x2704('0x7'));var rimraf=require(_0x2704('0x8'));var config=require(_0x2704('0x9'));var attributes=require(_0x2704('0xa'));module[_0x2704('0xb')]=function(_0x2713a9,_0x26c951){return _0x2713a9[_0x2704('0xc')](_0x2704('0xd'),attributes,{'tableName':_0x2704('0xe'),'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 53502c5..9eeb037 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 _0x9558=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s'];(function(_0x4d1e0f,_0x1509bc){var _0x5a72f9=function(_0x5486c6){while(--_0x5486c6){_0x4d1e0f['push'](_0x4d1e0f['shift']());}};_0x5a72f9(++_0x1509bc);}(_0x9558,0x134));var _0x8955=function(_0x48cb7d,_0x3135a1){_0x48cb7d=_0x48cb7d-0x0;var _0x417b09=_0x9558[_0x48cb7d];return _0x417b09;};'use strict';var _=require(_0x8955('0x0'));var util=require(_0x8955('0x1'));var moment=require(_0x8955('0x2'));var BPromise=require(_0x8955('0x3'));var rs=require(_0x8955('0x4'));var fs=require('fs');var Redis=require(_0x8955('0x5'));var db=require(_0x8955('0x6'))['db'];var utils=require(_0x8955('0x7'));var logger=require(_0x8955('0x8'))(_0x8955('0x9'));var config=require(_0x8955('0xa'));var jayson=require(_0x8955('0xb'));var client=jayson[_0x8955('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1fd501,_0x1ec03f,_0x5ae3d0){return new BPromise(function(_0x5420c5,_0x455baf){return client[_0x8955('0xd')](_0x1fd501,_0x5ae3d0)[_0x8955('0xe')](function(_0x23b9b7){logger[_0x8955('0xf')](_0x8955('0x10'),_0x1ec03f,'request\x20sent');logger[_0x8955('0x11')](_0x8955('0x12'),_0x1ec03f,_0x8955('0x13'),JSON['stringify'](_0x23b9b7));if(_0x23b9b7[_0x8955('0x14')]){if(_0x23b9b7[_0x8955('0x14')][_0x8955('0x15')]===0x1f4){logger[_0x8955('0x14')](_0x8955('0x10'),_0x1ec03f,_0x23b9b7[_0x8955('0x14')][_0x8955('0x16')]);return _0x455baf(_0x23b9b7[_0x8955('0x14')]['message']);}logger[_0x8955('0x14')](_0x8955('0x10'),_0x1ec03f,_0x23b9b7[_0x8955('0x14')][_0x8955('0x16')]);return _0x5420c5(_0x23b9b7['error'][_0x8955('0x16')]);}else{logger[_0x8955('0xf')](_0x8955('0x10'),_0x1ec03f,'request\x20sent');_0x5420c5(_0x23b9b7[_0x8955('0x17')][_0x8955('0x16')]);}})[_0x8955('0x18')](function(_0x2c0d81){logger[_0x8955('0x14')](_0x8955('0x10'),_0x1ec03f,_0x2c0d81);_0x455baf(_0x2c0d81);});});} \ No newline at end of file +var _0x385a=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticCustomReport,\x20%s,\x20%s','result','catch','lodash'];(function(_0x1eb92d,_0x343504){var _0xe27986=function(_0xbe8840){while(--_0xbe8840){_0x1eb92d['push'](_0x1eb92d['shift']());}};_0xe27986(++_0x343504);}(_0x385a,0x125));var _0xa385=function(_0x85cf53,_0x171d35){_0x85cf53=_0x85cf53-0x0;var _0x4d203c=_0x385a[_0x85cf53];return _0x4d203c;};'use strict';var _=require(_0xa385('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa385('0x1'));var fs=require('fs');var Redis=require(_0xa385('0x2'));var db=require(_0xa385('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa385('0x4'));var config=require(_0xa385('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa385('0x6')][_0xa385('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xbcf9c2,_0x5b68dc,_0x37c6ed){return new BPromise(function(_0x33e02e,_0x3c965b){return client[_0xa385('0x8')](_0xbcf9c2,_0x37c6ed)[_0xa385('0x9')](function(_0x59078b){logger[_0xa385('0xa')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5b68dc,_0xa385('0xb'));logger[_0xa385('0xc')](_0xa385('0xd'),_0x5b68dc,'request\x20sent',JSON[_0xa385('0xe')](_0x59078b));if(_0x59078b[_0xa385('0xf')]){if(_0x59078b['error'][_0xa385('0x10')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x5b68dc,_0x59078b['error'][_0xa385('0x11')]);return _0x3c965b(_0x59078b[_0xa385('0xf')][_0xa385('0x11')]);}logger[_0xa385('0xf')](_0xa385('0x12'),_0x5b68dc,_0x59078b[_0xa385('0xf')][_0xa385('0x11')]);return _0x33e02e(_0x59078b['error'][_0xa385('0x11')]);}else{logger[_0xa385('0xa')](_0xa385('0x12'),_0x5b68dc,_0xa385('0xb'));_0x33e02e(_0x59078b[_0xa385('0x13')][_0xa385('0x11')]);}})[_0xa385('0x14')](function(_0x391072){logger['error'](_0xa385('0x12'),_0x5b68dc,_0x391072);_0x3c965b(_0x391072);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8e36bc8..80348e4 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 _0x7aa6=['query','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','/:id/preview','preview','/:id/run'];(function(_0x1c2560,_0x1d9304){var _0x2be4de=function(_0x3d6984){while(--_0x3d6984){_0x1c2560['push'](_0x1c2560['shift']());}};_0x2be4de(++_0x1d9304);}(_0x7aa6,0xcc));var _0x67aa=function(_0x10df58,_0x1ae2a4){_0x10df58=_0x10df58-0x0;var _0x4321ec=_0x7aa6[_0x10df58];return _0x4321ec;};'use strict';var multer=require('multer');var util=require(_0x67aa('0x0'));var path=require(_0x67aa('0x1'));var timeout=require(_0x67aa('0x2'));var express=require(_0x67aa('0x3'));var router=express[_0x67aa('0x4')]();var fs_extra=require(_0x67aa('0x5'));var auth=require(_0x67aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x67aa('0x7'));var controller=require(_0x67aa('0x8'));router[_0x67aa('0x9')]('/',auth[_0x67aa('0xa')](),controller[_0x67aa('0xb')]);router['get'](_0x67aa('0xc'),auth[_0x67aa('0xa')](),controller['show']);router['get'](_0x67aa('0xd'),auth[_0x67aa('0xa')](),controller[_0x67aa('0xe')]);router[_0x67aa('0x9')](_0x67aa('0xf'),auth[_0x67aa('0xa')](),controller['run']);router[_0x67aa('0x9')]('/:id/query',auth[_0x67aa('0xa')](),controller[_0x67aa('0x10')]);router[_0x67aa('0x11')]('/',auth[_0x67aa('0xa')](),controller[_0x67aa('0x12')]);router[_0x67aa('0x13')](_0x67aa('0xc'),auth[_0x67aa('0xa')](),controller['update']);router[_0x67aa('0x14')]('/:id',auth[_0x67aa('0xa')](),controller[_0x67aa('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4e39=['preview','/:id/run','run','/:id/query','query','post','create','put','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview'];(function(_0x33e366,_0x31f8f0){var _0xdab0c7=function(_0x58978c){while(--_0x58978c){_0x33e366['push'](_0x33e366['shift']());}};_0xdab0c7(++_0x31f8f0);}(_0x4e39,0xc3));var _0x94e3=function(_0x327cbf,_0x114362){_0x327cbf=_0x327cbf-0x0;var _0x409cb8=_0x4e39[_0x327cbf];return _0x409cb8;};'use strict';var multer=require('multer');var util=require(_0x94e3('0x0'));var path=require(_0x94e3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x94e3('0x2'));var auth=require(_0x94e3('0x3'));var interaction=require(_0x94e3('0x4'));var config=require(_0x94e3('0x5'));var controller=require(_0x94e3('0x6'));router[_0x94e3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x94e3('0x7')](_0x94e3('0x8'),auth[_0x94e3('0x9')](),controller[_0x94e3('0xa')]);router[_0x94e3('0x7')](_0x94e3('0xb'),auth[_0x94e3('0x9')](),controller[_0x94e3('0xc')]);router[_0x94e3('0x7')](_0x94e3('0xd'),auth[_0x94e3('0x9')](),controller[_0x94e3('0xe')]);router['get'](_0x94e3('0xf'),auth[_0x94e3('0x9')](),controller[_0x94e3('0x10')]);router[_0x94e3('0x11')]('/',auth[_0x94e3('0x9')](),controller[_0x94e3('0x12')]);router[_0x94e3('0x13')](_0x94e3('0x8'),auth[_0x94e3('0x9')](),controller['update']);router[_0x94e3('0x14')](_0x94e3('0x8'),auth[_0x94e3('0x9')](),controller[_0x94e3('0x15')]);module[_0x94e3('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 4de01b4..87bfbf3 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 _0x2675=['sequelize','STRING','TEXT'];(function(_0x1602ef,_0x447aba){var _0x5870ee=function(_0x4d94e7){while(--_0x4d94e7){_0x1602ef['push'](_0x1602ef['shift']());}};_0x5870ee(++_0x447aba);}(_0x2675,0x75));var _0x5267=function(_0x414bee,_0x1b19a4){_0x414bee=_0x414bee-0x0;var _0x3ab4df=_0x2675[_0x414bee];return _0x3ab4df;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x5267('0x1')]},'table':{'type':Sequelize[_0x5267('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x5267('0x2')]}}; \ No newline at end of file +var _0xfdbd=['sequelize','exports','STRING','TEXT'];(function(_0x86337d,_0x2b57c3){var _0x22b2c6=function(_0x180d16){while(--_0x180d16){_0x86337d['push'](_0x86337d['shift']());}};_0x22b2c6(++_0x2b57c3);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x2cf2e9,_0xd58ea1){_0x2cf2e9=_0x2cf2e9-0x0;var _0xd3670d=_0xfdbd[_0x2cf2e9];return _0xd3670d;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdfdb('0x2')]},'parent':{'type':Sequelize[_0xdfdb('0x2')]},'table':{'type':Sequelize[_0xdfdb('0x2')]},'conditions':{'type':Sequelize[_0xdfdb('0x3')]},'joins':{'type':Sequelize[_0xdfdb('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 016f5ba..51ae90d 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 _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','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/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x250853,_0x44ae5c){var _0x23732f=function(_0x3b5dca){while(--_0x3b5dca){_0x250853['push'](_0x250853['shift']());}};_0x23732f(++_0x44ae5c);}(_0x31f0,0xb7));var _0x031f=function(_0x5d6f4c,_0x1326b4){_0x5d6f4c=_0x5d6f4c-0x0;var _0x5961ab=_0x31f0[_0x5d6f4c];return _0x5961ab;};'use strict';var emlformat=require(_0x031f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x031f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x031f('0x2'));var moment=require(_0x031f('0x3'));var BPromise=require(_0x031f('0x4'));var Mustache=require(_0x031f('0x5'));var util=require('util');var path=require(_0x031f('0x6'));var sox=require(_0x031f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x031f('0x8'));var squel=require('squel');var crypto=require(_0x031f('0x9'));var jsforce=require(_0x031f('0xa'));var deskjs=require(_0x031f('0xb'));var toCsv=require(_0x031f('0xc'));var querystring=require('querystring');var Papa=require(_0x031f('0xd'));var Redis=require(_0x031f('0xe'));var authService=require(_0x031f('0xf'));var qs=require(_0x031f('0x10'));var as=require(_0x031f('0x11'));var hardwareService=require(_0x031f('0x12'));var logger=require(_0x031f('0x13'))(_0x031f('0x14'));var utils=require('../../config/utils');var config=require(_0x031f('0x15'));var licenseUtil=require(_0x031f('0x16'));var db=require(_0x031f('0x17'))['db'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file +var _0x4975=['set','Content-Range','save','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','index','AnalyticDefaultReport','rawAttributes','type','key','map','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','role','user','Reports','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','SUM(%s)','COUNT(%s)','MAX(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','joins','includes','parentKey','foreignKey','foreignTable','conditions','parse','debug','Limited\x20Query:','sequelize','QueryTypes','SELECT','left_join','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','HOUR(%s)','operator','Please\x20insert\x20at\x20least\x20one\x20field','alias','%s.%s\x20=\x20%s.%s','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','toString','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','run','runReport','cross_join','getFields','replace','clone','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x2bf352,_0x1b9c6e){var _0x521911=function(_0x41d5e6){while(--_0x41d5e6){_0x2bf352['push'](_0x2bf352['shift']());}};_0x521911(++_0x1b9c6e);}(_0x4975,0x86));var _0x5497=function(_0xdd7605,_0x538718){_0xdd7605=_0xdd7605-0x0;var _0x467e5f=_0x4975[_0xdd7605];return _0x467e5f;};'use strict';var emlformat=require(_0x5497('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5497('0x1'));var jsonpatch=require(_0x5497('0x2'));var rp=require(_0x5497('0x3'));var moment=require(_0x5497('0x4'));var BPromise=require(_0x5497('0x5'));var Mustache=require(_0x5497('0x6'));var util=require(_0x5497('0x7'));var path=require(_0x5497('0x8'));var sox=require(_0x5497('0x9'));var csv=require(_0x5497('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5497('0xb'));var _=require('lodash');var squel=require(_0x5497('0xc'));var crypto=require(_0x5497('0xd'));var jsforce=require(_0x5497('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5497('0xa'));var querystring=require('querystring');var Papa=require(_0x5497('0xf'));var Redis=require(_0x5497('0x10'));var authService=require(_0x5497('0x11'));var qs=require(_0x5497('0x12'));var as=require(_0x5497('0x13'));var hardwareService=require(_0x5497('0x14'));var logger=require(_0x5497('0x15'))(_0x5497('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5497('0x17'))['db'];var dbH=require(_0x5497('0x17'))[_0x5497('0x18')];function respondWithStatusCode(_0x984990,_0x747dc7){_0x747dc7=_0x747dc7||0xcc;return function(_0x365144){if(_0x365144){return _0x984990[_0x5497('0x19')](_0x747dc7);}return _0x984990[_0x5497('0x1a')](_0x747dc7)[_0x5497('0x1b')]();};}function respondWithResult(_0x1a4c74,_0x55f590){_0x55f590=_0x55f590||0xc8;return function(_0x11b0a9){if(_0x11b0a9){return _0x1a4c74['status'](_0x55f590)[_0x5497('0x1c')](_0x11b0a9);}};}function respondWithFilteredResult(_0x2bfd8a,_0x19e5f3){return function(_0x3ce50b){if(_0x3ce50b){var _0x37c18e=typeof _0x19e5f3[_0x5497('0x1d')]===_0x5497('0x1e')&&typeof _0x19e5f3['limit']==='undefined';var _0x3f4d20=_0x3ce50b[_0x5497('0x1f')];var _0x3a47fd=_0x37c18e?0x0:_0x19e5f3['offset'];var _0xbf1ba7=_0x37c18e?_0x3ce50b[_0x5497('0x1f')]:_0x19e5f3[_0x5497('0x1d')]+_0x19e5f3[_0x5497('0x20')];var _0x1b1b43;if(_0xbf1ba7>=_0x3f4d20){_0xbf1ba7=_0x3f4d20;_0x1b1b43=0xc8;}else{_0x1b1b43=0xce;}_0x2bfd8a[_0x5497('0x1a')](_0x1b1b43);return _0x2bfd8a[_0x5497('0x21')](_0x5497('0x22'),_0x3a47fd+'-'+_0xbf1ba7+'/'+_0x3f4d20)[_0x5497('0x1c')](_0x3ce50b);}return null;};}function patchUpdates(_0x3f54ef){return function(_0x186065){try{jsonpatch['apply'](_0x186065,_0x3f54ef,!![]);}catch(_0x720767){return BPromise['reject'](_0x720767);}return _0x186065[_0x5497('0x23')]();};}function saveUpdates(_0xd0868d,_0x44265c){return function(_0x2f587d){if(_0x2f587d){return _0x2f587d[_0x5497('0x24')](_0xd0868d)[_0x5497('0x25')](function(_0x5018fa){return _0x5018fa;});}return null;};}function removeEntity(_0x54043a,_0x1eefce){return function(_0x34b97f){if(_0x34b97f){return _0x34b97f[_0x5497('0x26')]()[_0x5497('0x25')](function(){var _0x5223b5=_0x34b97f[_0x5497('0x27')]({'plain':!![]});var _0x57268c=_0x5497('0x28');return db[_0x5497('0x29')][_0x5497('0x26')]({'where':{'type':_0x57268c,'resourceId':_0x5223b5['id']}})[_0x5497('0x25')](function(){return _0x34b97f;});})[_0x5497('0x25')](function(){_0x54043a[_0x5497('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4af5f4,_0x5406e2){return function(_0x583d06){if(!_0x583d06){_0x4af5f4['sendStatus'](0x194);}return _0x583d06;};}function handleError(_0x39a2b7,_0x48d146){_0x48d146=_0x48d146||0x1f4;return function(_0x5e9356){logger[_0x5497('0x2a')](_0x5e9356[_0x5497('0x2b')]);if(_0x5e9356[_0x5497('0x2c')]){delete _0x5e9356['name'];}_0x39a2b7['status'](_0x48d146)['send'](_0x5e9356);};}exports[_0x5497('0x2d')]=function(_0x471e0b,_0xf4c117){var _0x5b8f79={},_0x489f71={},_0x594866={'count':0x0,'rows':[]};var _0xa28dd8=_['map'](db[_0x5497('0x2e')][_0x5497('0x2f')],function(_0x77c575){return{'name':_0x77c575['fieldName'],'type':_0x77c575[_0x5497('0x30')][_0x5497('0x31')]};});_0x489f71['model']=_[_0x5497('0x32')](_0xa28dd8,_0x5497('0x2c'));_0x489f71[_0x5497('0x33')]=_['keys'](_0x471e0b[_0x5497('0x33')]);_0x489f71[_0x5497('0x34')]=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],_0x489f71[_0x5497('0x33')]);_0x5b8f79['attributes']=_[_0x5497('0x35')](_0x489f71[_0x5497('0x36')],qs['fields'](_0x471e0b[_0x5497('0x33')][_0x5497('0x37')]));_0x5b8f79[_0x5497('0x38')]=_0x5b8f79[_0x5497('0x38')][_0x5497('0x39')]?_0x5b8f79[_0x5497('0x38')]:_0x489f71['model'];if(!_0x471e0b[_0x5497('0x33')]['hasOwnProperty'](_0x5497('0x3a'))){_0x5b8f79[_0x5497('0x20')]=qs[_0x5497('0x20')](_0x471e0b['query']['limit']);_0x5b8f79[_0x5497('0x1d')]=qs[_0x5497('0x1d')](_0x471e0b[_0x5497('0x33')][_0x5497('0x1d')]);}_0x5b8f79[_0x5497('0x3b')]=qs[_0x5497('0x3c')](_0x471e0b['query'][_0x5497('0x3c')]);_0x5b8f79[_0x5497('0x3d')]=qs[_0x5497('0x34')](_[_0x5497('0x3e')](_0x471e0b[_0x5497('0x33')],_0x489f71[_0x5497('0x34')]),_0xa28dd8);if(_0x471e0b[_0x5497('0x33')][_0x5497('0x3f')]){_0x5b8f79[_0x5497('0x3d')]=_['merge'](_0x5b8f79[_0x5497('0x3d')],{'$or':_[_0x5497('0x32')](_0xa28dd8,function(_0x1e9616){if(_0x1e9616[_0x5497('0x30')]!==_0x5497('0x40')){var _0xa5ebe6={};_0xa5ebe6[_0x1e9616[_0x5497('0x2c')]]={'$like':'%'+_0x471e0b['query'][_0x5497('0x3f')]+'%'};return _0xa5ebe6;}})});}_0x5b8f79=_[_0x5497('0x41')]({},_0x5b8f79,_0x471e0b[_0x5497('0x42')]);var _0x35993c={'where':_0x5b8f79[_0x5497('0x3d')]};return db[_0x5497('0x2e')][_0x5497('0x1f')](_0x35993c)['then'](function(_0x2137bd){_0x594866[_0x5497('0x1f')]=_0x2137bd;if(_0x471e0b[_0x5497('0x33')][_0x5497('0x43')]){_0x5b8f79[_0x5497('0x44')]=[{'all':!![]}];}return db[_0x5497('0x2e')][_0x5497('0x45')](_0x5b8f79);})[_0x5497('0x25')](function(_0x2021ae){_0x594866[_0x5497('0x46')]=_0x2021ae;return _0x594866;})['then'](respondWithFilteredResult(_0xf4c117,_0x5b8f79))[_0x5497('0x47')](handleError(_0xf4c117,null));};exports['show']=function(_0x40822a,_0x9fc24){var _0x26ef01={'raw':!![],'where':{'id':_0x40822a[_0x5497('0x48')]['id']}},_0x3602ec={};_0x3602ec['model']=_[_0x5497('0x49')](db[_0x5497('0x2e')]['rawAttributes']);_0x3602ec[_0x5497('0x33')]=_['keys'](_0x40822a[_0x5497('0x33')]);_0x3602ec['filters']=_[_0x5497('0x35')](_0x3602ec[_0x5497('0x36')],_0x3602ec[_0x5497('0x33')]);_0x26ef01[_0x5497('0x38')]=_[_0x5497('0x35')](_0x3602ec['model'],qs['fields'](_0x40822a['query']['fields']));_0x26ef01[_0x5497('0x38')]=_0x26ef01[_0x5497('0x38')][_0x5497('0x39')]?_0x26ef01[_0x5497('0x38')]:_0x3602ec[_0x5497('0x36')];if(_0x40822a[_0x5497('0x33')][_0x5497('0x43')]){_0x26ef01[_0x5497('0x44')]=[{'all':!![]}];}_0x26ef01=_[_0x5497('0x41')]({},_0x26ef01,_0x40822a['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x26ef01)[_0x5497('0x25')](handleEntityNotFound(_0x9fc24,null))['then'](respondWithResult(_0x9fc24,null))[_0x5497('0x47')](handleError(_0x9fc24,null));};exports['create']=function(_0x12ffbc,_0x31f1ba){return db[_0x5497('0x2e')]['create'](_0x12ffbc[_0x5497('0x4b')],{})[_0x5497('0x25')](function(_0x515c3e){var _0x3abc92=_0x12ffbc['user'][_0x5497('0x27')]({'plain':!![]});if(!_0x3abc92)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3abc92[_0x5497('0x4c')]===_0x5497('0x4d')){var _0x26fd9f=_0x515c3e[_0x5497('0x27')]({'plain':!![]});var _0x25e80c=_0x5497('0x4e');return db[_0x5497('0x4f')][_0x5497('0x4a')]({'where':{'name':_0x25e80c,'userProfileId':_0x3abc92['userProfileId']},'raw':!![]})[_0x5497('0x25')](function(_0x5b2c22){if(_0x5b2c22&&_0x5b2c22['autoAssociation']===0x0){return db[_0x5497('0x29')][_0x5497('0x50')]({'name':_0x26fd9f['name'],'resourceId':_0x26fd9f['id'],'type':_0x5497('0x28'),'sectionId':_0x5b2c22['id']},{})[_0x5497('0x25')](function(){return _0x515c3e;});}else{return _0x515c3e;}})[_0x5497('0x47')](function(_0x3094c7){logger['error'](_0x5497('0x51'),_0x3094c7);throw _0x3094c7;});}return _0x515c3e;})['then'](respondWithResult(_0x31f1ba,0xc9))['catch'](handleError(_0x31f1ba,null));};exports[_0x5497('0x24')]=function(_0x33dd07,_0x2f7ec8){if(_0x33dd07['body']['id']){delete _0x33dd07['body']['id'];}return db[_0x5497('0x2e')]['find']({'where':{'id':_0x33dd07[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f7ec8,null))[_0x5497('0x25')](saveUpdates(_0x33dd07['body'],null))[_0x5497('0x25')](respondWithResult(_0x2f7ec8,null))[_0x5497('0x47')](handleError(_0x2f7ec8,null));};exports['destroy']=function(_0x418f17,_0x5dccfb){return db['AnalyticDefaultReport'][_0x5497('0x4a')]({'where':{'id':_0x418f17[_0x5497('0x48')]['id']}})['then'](handleEntityNotFound(_0x5dccfb,null))[_0x5497('0x25')](removeEntity(_0x5dccfb,null))[_0x5497('0x47')](handleError(_0x5dccfb,null));};exports[_0x5497('0x52')]=function(_0x28b2a3,_0x3fca40){var _0x25c75e=0xa;var _0x590be7=[_0x5497('0x53'),'left_join','right_join','cross_join'];var _0x1f3965={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x5497('0x56'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x25f349={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':'HOUR(%s)','ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x425995=function(_0xc783ce){return!_['includes']([_0x5497('0x5e'),_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0xc783ce);};var _0x5823f6=function(_0x31271c){if(!_0x31271c||!_0x31271c[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x542bcf='(',_0x1ab48f=0x0;_0x1ab48f<_0x31271c['rules']['length'];_0x1ab48f+=0x1){_0x1ab48f>0x0&&(_0x542bcf+='\x20'+_0x31271c['operator']+'\x20');_0x542bcf+=_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x63')]?_0x5823f6(_0x31271c[_0x5497('0x62')][_0x1ab48f]['group']):_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x64')]+'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x65')]+(_0x425995(_0x31271c['rules'][_0x1ab48f][_0x5497('0x65')])?'\x20'+_0x31271c[_0x5497('0x62')][_0x1ab48f][_0x5497('0x66')]:'');}return _0x542bcf+')';};var _0x49617c={'where':{'id':_0x28b2a3[_0x5497('0x48')]['id']}},_0x164de1,_0x465bed,_0xb3eec2,_0x4368e3,_0x1467c4;_0x49617c=_[_0x5497('0x41')]({},_0x49617c,_0x28b2a3['options']);return db[_0x5497('0x2e')][_0x5497('0x4a')](_0x49617c)[_0x5497('0x25')](function(_0x20efea){if(_0x20efea){_0x164de1=_0x20efea;return _0x20efea['getFields']();}return null;})['then'](function(_0x4a7360){if(_0x4a7360){if(!_0x4a7360[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x465bed=_0x4a7360;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x464df3){if(_0x464df3){_0xb3eec2=_[_0x5497('0x6a')](_0x464df3,'id');var _0x4338d4;var _0x3f38bf=squel[_0x5497('0x6b')]();_0x3f38bf[_0x5497('0x6c')](_0x164de1[_0x5497('0x6d')]);for(var _0x1fc6ad=0x0;_0x1fc6ad<_0x465bed['length'];_0x1fc6ad+=0x1){_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x6e')]?_0xb3eec2[_0x465bed[_0x1fc6ad][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x465bed[_0x1fc6ad]['field'];_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x70')]?_['replace'](_0x1f3965[_0x465bed[_0x1fc6ad][_0x5497('0x70')]],'%s',_0x4338d4):_0x4338d4;_0x4338d4=_0x465bed[_0x1fc6ad][_0x5497('0x71')]?_['replace'](_0x25f349[_0x465bed[_0x1fc6ad][_0x5497('0x71')]],'%s',_0x4338d4):_0x4338d4;if(_0x465bed[_0x1fc6ad][_0x5497('0x72')]){_0x3f38bf[_0x5497('0x63')](_0x4338d4);}_0x465bed[_0x1fc6ad][_0x5497('0x73')]&&_0x3f38bf['order'](_0x4338d4,_0x465bed[_0x1fc6ad][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x3f38bf[_0x5497('0x64')](_0x4338d4,_0x465bed[_0x1fc6ad]['alias']||_0x4338d4);}if(_0x164de1[_0x5497('0x75')]){_0x164de1[_0x5497('0x75')]=JSON['parse'](_0x164de1[_0x5497('0x75')]);for(var _0xebe694=0x0;_0xebe694<_0x164de1[_0x5497('0x75')]['length'];_0xebe694+=0x1){if(_0x164de1['joins'][_0xebe694][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x590be7,_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x30')])&&_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x77')]&&_0x164de1[_0x5497('0x75')][_0xebe694]['foreignTable']&&_0x164de1['joins'][_0xebe694][_0x5497('0x78')]){_0x3f38bf[_0x164de1[_0x5497('0x75')][_0xebe694]['type']](_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],null,util[_0x5497('0x71')]('%s.%s\x20=\x20%s.%s',_0x164de1[_0x5497('0x6d')],_0x164de1[_0x5497('0x75')][_0xebe694]['parentKey'],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x79')],_0x164de1[_0x5497('0x75')][_0xebe694][_0x5497('0x78')]));}}}if(_0x164de1[_0x5497('0x7a')]){_0x164de1['conditions']=JSON[_0x5497('0x7b')](_0x164de1[_0x5497('0x7a')]);_0x3f38bf[_0x5497('0x3d')](_0x5823f6(_0x164de1[_0x5497('0x7a')][_0x5497('0x63')]));}_0x1467c4=_0x3f38bf['clone']();_0x3f38bf[_0x5497('0x20')](_0x25c75e);_0x3f38bf[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')](_0x5497('0x7d'),_0x3f38bf['toString']());return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x3f38bf['toString'](),{'type':dbH[_0x5497('0x7e')][_0x5497('0x7f')][_0x5497('0x80')]});}})[_0x5497('0x25')](respondWithResult(_0x3fca40,null))['catch'](handleError(_0x3fca40,null));};function runReport(_0x547de7,_0x4ff64f,_0x5343d5){var _0x594761=_0x4ff64f[_0x5497('0x2c')];var _0x2375cc=0xa;var _0x15d0da=[_0x5497('0x53'),_0x5497('0x81'),'right_join','cross_join'];var _0x392987={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x4c41c4={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':_0x5497('0x5c'),'UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x22b019=function(_0x4aa4ba){return!_[_0x5497('0x76')](['IS\x20NULL',_0x5497('0x5f'),_0x5497('0x60'),_0x5497('0x61')],_0x4aa4ba);};var _0x5b0f9d=function(_0x59960b){if(!_0x59960b||!_0x59960b[_0x5497('0x62')][_0x5497('0x39')]){return'';}for(var _0x953b31='(',_0xeb52c9=0x0;_0xeb52c9<_0x59960b[_0x5497('0x62')][_0x5497('0x39')];_0xeb52c9+=0x1){_0xeb52c9>0x0&&(_0x953b31+='\x20'+_0x59960b[_0x5497('0x86')]+'\x20');_0x953b31+=_0x59960b[_0x5497('0x62')][_0xeb52c9]['group']?_0x5b0f9d(_0x59960b['rules'][_0xeb52c9]['group']):_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x64')]+'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x65')]+(_0x22b019(_0x59960b['rules'][_0xeb52c9]['condition'])?'\x20'+_0x59960b[_0x5497('0x62')][_0xeb52c9][_0x5497('0x66')]:'');}return _0x953b31+')';};var _0x5dd9bc={'where':{'id':_0x547de7['id']}},_0x83b240,_0x2fc11a,_0x3ce2ee,_0x36c09f,_0x51e9fb;_0x5dd9bc=_['merge']({},_0x5dd9bc,_0x5343d5);return db['AnalyticDefaultReport']['find'](_0x5dd9bc)['then'](function(_0x497295){if(_0x497295){_0x83b240=_0x497295;return _0x497295['getFields']();}return null;})[_0x5497('0x25')](function(_0x5aa5e1){if(_0x5aa5e1){if(!_0x5aa5e1[_0x5497('0x39')]){throw new db[(_0x5497('0x67'))][(_0x5497('0x68'))](_0x5497('0x87'),0x193);}_0x2fc11a=_0x5aa5e1;return db[_0x5497('0x69')][_0x5497('0x45')]({'raw':!![]});}return null;})['then'](function(_0x77d52c){if(_0x77d52c){_0x3ce2ee=_['keyBy'](_0x77d52c,'id');var _0x15a67d;var _0x2721b2=squel[_0x5497('0x6b')]();_0x2721b2[_0x5497('0x6c')](_0x83b240[_0x5497('0x6d')]);for(var _0x38fa59=0x0;_0x38fa59<_0x2fc11a[_0x5497('0x39')];_0x38fa59+=0x1){_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x6e')]?_0x3ce2ee[_0x2fc11a[_0x38fa59][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x2fc11a[_0x38fa59]['field'];_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x70')]?_['replace'](_0x392987[_0x2fc11a[_0x38fa59][_0x5497('0x70')]],'%s',_0x15a67d):_0x15a67d;_0x15a67d=_0x2fc11a[_0x38fa59][_0x5497('0x71')]?_['replace'](_0x4c41c4[_0x2fc11a[_0x38fa59][_0x5497('0x71')]],'%s',_0x15a67d):_0x15a67d;if(_0x2fc11a[_0x38fa59][_0x5497('0x72')]){_0x2721b2[_0x5497('0x63')](_0x15a67d);}_0x2fc11a[_0x38fa59][_0x5497('0x73')]&&_0x2721b2[_0x5497('0x3b')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x2721b2[_0x5497('0x64')](_0x15a67d,_0x2fc11a[_0x38fa59][_0x5497('0x88')]||_0x15a67d);}if(_0x83b240[_0x5497('0x75')]){_0x83b240[_0x5497('0x75')]=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x75')]);for(var _0x22426e=0x0;_0x22426e<_0x83b240['joins'][_0x5497('0x39')];_0x22426e+=0x1){if(_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]&&_[_0x5497('0x76')](_0x15d0da,_0x83b240[_0x5497('0x75')][_0x22426e]['type'])&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')]&&_0x83b240['joins'][_0x22426e]['foreignTable']&&_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]){_0x2721b2[_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x30')]](_0x83b240[_0x5497('0x75')][_0x22426e]['foreignTable'],null,util['format'](_0x5497('0x89'),_0x83b240['table'],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x77')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x79')],_0x83b240[_0x5497('0x75')][_0x22426e][_0x5497('0x78')]));}}}if(_0x83b240['conditions']){_0x83b240['conditions']=JSON[_0x5497('0x7b')](_0x83b240[_0x5497('0x7a')]);_0x2721b2[_0x5497('0x3d')](_0x5b0f9d(_0x83b240['conditions'][_0x5497('0x63')]));}_0x51e9fb=_0x2721b2['clone']();_0x2721b2[_0x5497('0x20')](_0x2375cc);_0x2721b2['offset'](0x0);return;}})['then'](function(){if(_0x4ff64f[_0x5497('0x8a')]===_0x5497('0x8b')){return null;}var _0x4ce768=_[_0x5497('0x41')](_0x4ff64f,{'name':_0x4ff64f[_0x5497('0x8c')]||_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],'basename':_0x594761,'savename':util['format'](_0x5497('0x8d'),_0x4ff64f[_0x5497('0x2c')]||_0x83b240[_0x5497('0x2c')],require(_0x5497('0x8e'))[_0x5497('0x8f')](0x4),_0x4ff64f['output']||_0x5497('0x90')),'reportId':_0x83b240['id'],'reportType':'default'});return db[_0x5497('0x91')][_0x5497('0x50')](_0x4ce768,{'raw':!![]});})[_0x5497('0x25')](function(_0x314db4){if(_0x83b240[_0x5497('0x6d')]===_0x5497('0x92')){_0x51e9fb[_0x5497('0x3d')](_0x83b240[_0x5497('0x6d')]+_0x5497('0x93'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}else{_0x51e9fb['where'](_0x83b240[_0x5497('0x6d')]+_0x5497('0x96'),_0x4ff64f[_0x5497('0x94')],_0x4ff64f[_0x5497('0x95')]);}if(_0x314db4){logger[_0x5497('0x97')](_0x5497('0x98'),_0x51e9fb[_0x5497('0x99')]());require(_0x5497('0x9a'))[_0x5497('0x9b')](path[_0x5497('0x53')](__dirname,_0x5497('0x9c'),_0x314db4['output']),[_0x314db4['id'],_0x51e9fb[_0x5497('0x99')](),path[_0x5497('0x53')](__dirname,_0x5497('0x9d'),_0x314db4[_0x5497('0x9e')]),_0x594761]);return _0x314db4;}else{var _0x46be08=squel[_0x5497('0x6b')]();_0x46be08[_0x5497('0x6c')]('('+_0x51e9fb[_0x5497('0x99')]()+')',_0x5497('0x9f'));_0x46be08[_0x5497('0x64')](_0x5497('0xa0'),_0x5497('0x1f'));_0x51e9fb[_0x5497('0x20')](_0x4ff64f[_0x5497('0x20')]||_0x2375cc);_0x51e9fb['offset'](_0x4ff64f['offset']||0x0);return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x46be08[_0x5497('0x99')](),{'type':dbH['sequelize'][_0x5497('0x7f')][_0x5497('0x80')]})[_0x5497('0x25')](function(_0x2bd48c){if(!_0x2bd48c[_0x5497('0x39')]){_0x36c09f=0x0;}else{_0x36c09f=_0x2bd48c[0x0][_0x5497('0x1f')]||0x0;}return dbH[_0x5497('0x7e')][_0x5497('0x33')](_0x51e9fb['toString'](),{'type':dbH['sequelize']['QueryTypes'][_0x5497('0x80')]});})[_0x5497('0x25')](function(_0x4dab6a){return{'rows':_0x4dab6a||[],'count':_0x36c09f};});}});}exports[_0x5497('0xa1')]=function(_0x27f42b,_0x1bef85){return runReport(_0x27f42b['params'],_0x27f42b[_0x5497('0x33')],_0x27f42b['options'])[_0x5497('0x25')](respondWithResult(_0x1bef85,null))[_0x5497('0x47')](handleError(_0x1bef85,null));};exports[_0x5497('0xa2')]=runReport;exports['query']=function(_0x1c3dad,_0xfba062){var _0x494cc3=0xa;var _0x401f04=[_0x5497('0x53'),_0x5497('0x81'),'right_join',_0x5497('0xa3')];var _0x1a5c32={'SUM':_0x5497('0x54'),'COUNT':_0x5497('0x55'),'COUNT DISTINCT':_0x5497('0x82'),'MAX':_0x5497('0x56'),'MIN':_0x5497('0x83'),'AVG':_0x5497('0x84'),'GROUP_CONCAT':_0x5497('0x57'),'GROUP_CONCAT ASC':_0x5497('0x58'),'GROUP_CONCAT DESC':_0x5497('0x59')};var _0x1dfb76={'SEC_TO_TIME':_0x5497('0x5a'),'DATE':_0x5497('0x5b'),'HOUR':_0x5497('0x85'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5497('0x5d')};var _0x5c2517=function(_0x367929){return!_[_0x5497('0x76')](['IS\x20NULL','IS\x20NOT\x20NULL',_0x5497('0x60'),_0x5497('0x61')],_0x367929);};var _0x2fd2e3=function(_0x2fe770){if(!_0x2fe770||!_0x2fe770['rules'][_0x5497('0x39')]){return'';}for(var _0x1299cd='(',_0x4c2b14=0x0;_0x4c2b14<_0x2fe770['rules'][_0x5497('0x39')];_0x4c2b14+=0x1){_0x4c2b14>0x0&&(_0x1299cd+='\x20'+_0x2fe770[_0x5497('0x86')]+'\x20');_0x1299cd+=_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x63')]?_0x2fd2e3(_0x2fe770[_0x5497('0x62')][_0x4c2b14]['group']):_0x2fe770['rules'][_0x4c2b14][_0x5497('0x64')]+'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14]['condition']+(_0x5c2517(_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x65')])?'\x20'+_0x2fe770[_0x5497('0x62')][_0x4c2b14][_0x5497('0x66')]:'');}return _0x1299cd+')';};var _0x358ec5={'where':{'id':_0x1c3dad['params']['id']}},_0x5cddbc,_0x188d21,_0xf92129,_0x2d5cc1,_0x4f9228;_0x358ec5=_[_0x5497('0x41')]({},_0x358ec5,_0x1c3dad[_0x5497('0x42')]);return db[_0x5497('0x2e')]['find'](_0x358ec5)[_0x5497('0x25')](function(_0x30a248){if(_0x30a248){_0x5cddbc=_0x30a248;return _0x30a248[_0x5497('0xa4')]();}return null;})['then'](function(_0x1d4c76){if(_0x1d4c76){if(!_0x1d4c76[_0x5497('0x39')]){throw new db['Sequelize']['ValidationErrorItem'](_0x5497('0x87'),0x193);}_0x188d21=_0x1d4c76;return db[_0x5497('0x69')]['findAll']({'raw':!![]});}return null;})[_0x5497('0x25')](function(_0x5001d5){if(_0x5001d5){_0xf92129=_[_0x5497('0x6a')](_0x5001d5,'id');var _0x2c58e6;var _0x300f3e=squel[_0x5497('0x6b')]();_0x300f3e[_0x5497('0x6c')](_0x5cddbc[_0x5497('0x6d')]);for(var _0x23732d=0x0;_0x23732d<_0x188d21['length'];_0x23732d+=0x1){_0x2c58e6=_0x188d21[_0x23732d]['MetricId']?_0xf92129[_0x188d21[_0x23732d][_0x5497('0x6e')]][_0x5497('0x6f')]:_0x188d21[_0x23732d]['field'];_0x2c58e6=_0x188d21[_0x23732d]['function']?_[_0x5497('0xa5')](_0x1a5c32[_0x188d21[_0x23732d][_0x5497('0x70')]],'%s',_0x2c58e6):_0x2c58e6;_0x2c58e6=_0x188d21[_0x23732d][_0x5497('0x71')]?_[_0x5497('0xa5')](_0x1dfb76[_0x188d21[_0x23732d][_0x5497('0x71')]],'%s',_0x2c58e6):_0x2c58e6;if(_0x188d21[_0x23732d][_0x5497('0x72')]){_0x300f3e['group'](_0x2c58e6);}_0x188d21[_0x23732d][_0x5497('0x73')]&&_0x300f3e[_0x5497('0x3b')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x73')]===_0x5497('0x74')?![]:!![]);_0x300f3e[_0x5497('0x64')](_0x2c58e6,_0x188d21[_0x23732d][_0x5497('0x88')]||_0x2c58e6);}if(_0x5cddbc['joins']){_0x5cddbc[_0x5497('0x75')]=JSON['parse'](_0x5cddbc[_0x5497('0x75')]);for(var _0x261804=0x0;_0x261804<_0x5cddbc[_0x5497('0x75')]['length'];_0x261804+=0x1){if(_0x5cddbc[_0x5497('0x75')][_0x261804]['type']&&_['includes'](_0x401f04,_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')])&&_0x5cddbc['joins'][_0x261804][_0x5497('0x77')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')]&&_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]){_0x300f3e[_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x30')]](_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],null,util['format'](_0x5497('0x89'),_0x5cddbc[_0x5497('0x6d')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x77')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x79')],_0x5cddbc[_0x5497('0x75')][_0x261804][_0x5497('0x78')]));}}}if(_0x5cddbc[_0x5497('0x7a')]){_0x5cddbc[_0x5497('0x7a')]=JSON[_0x5497('0x7b')](_0x5cddbc[_0x5497('0x7a')]);_0x300f3e[_0x5497('0x3d')](_0x2fd2e3(_0x5cddbc[_0x5497('0x7a')][_0x5497('0x63')]));}_0x4f9228=_0x300f3e[_0x5497('0xa6')]();_0x300f3e[_0x5497('0x20')](_0x494cc3);_0x300f3e[_0x5497('0x1d')](0x0);logger[_0x5497('0x7c')]('Limited\x20Query:',_0x300f3e[_0x5497('0x99')]());return dbH[_0x5497('0x7e')]['query'](_0x300f3e['toString'](),{'type':dbH[_0x5497('0x7e')]['QueryTypes'][_0x5497('0x80')]});}})[_0x5497('0x25')](function(){return{'sql':_0x4f9228[_0x5497('0x99')]()};})[_0x5497('0x25')](respondWithResult(_0xfba062,null))[_0x5497('0x47')](handleError(_0xfba062,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index cb46fb6..3f54def 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 _0x7eab=['request-promise','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','lodash','util','../../config/logger','api','bluebird'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x7eab,0x13f));var _0xb7ea=function(_0x33c315,_0x1fb576){_0x33c315=_0x33c315-0x0;var _0x3bdbc6=_0x7eab[_0x33c315];return _0x3bdbc6;};'use strict';var _=require(_0xb7ea('0x0'));var util=require(_0xb7ea('0x1'));var logger=require(_0xb7ea('0x2'))(_0xb7ea('0x3'));var moment=require('moment');var BPromise=require(_0xb7ea('0x4'));var rp=require(_0xb7ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7ea('0x6'));var config=require(_0xb7ea('0x7'));var attributes=require(_0xb7ea('0x8'));module[_0xb7ea('0x9')]=function(_0x1d902a,_0x51fd85){return _0x1d902a[_0xb7ea('0xa')](_0xb7ea('0xb'),attributes,{'tableName':'analytics_default_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf37a=['../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x2e6d03,_0x2c13e1){var _0x488dc2=function(_0x13f0cc){while(--_0x13f0cc){_0x2e6d03['push'](_0x2e6d03['shift']());}};_0x488dc2(++_0x2c13e1);}(_0xf37a,0x1f4));var _0xaf37=function(_0x2bc58d,_0x4e98c4){_0x2bc58d=_0x2bc58d-0x0;var _0x5d187a=_0xf37a[_0x2bc58d];return _0x5d187a;};'use strict';var _=require(_0xaf37('0x0'));var util=require(_0xaf37('0x1'));var logger=require('../../config/logger')(_0xaf37('0x2'));var moment=require(_0xaf37('0x3'));var BPromise=require(_0xaf37('0x4'));var rp=require(_0xaf37('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf37('0x6'));var config=require(_0xaf37('0x7'));var attributes=require(_0xaf37('0x8'));module[_0xaf37('0x9')]=function(_0x32d8ed,_0xb08fd0){return _0x32d8ed[_0xaf37('0xa')](_0xaf37('0xb'),attributes,{'tableName':_0xaf37('0xc'),'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 ad0faa2..bd0ae49 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 _0xce51=['then','AnalyticDefaultReport,\x20%s,\x20%s','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xce51,0x172));var _0x1ce5=function(_0x5dc03e,_0x54e60c){_0x5dc03e=_0x5dc03e-0x0;var _0x466a07=_0xce51[_0x5dc03e];return _0x466a07;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1ce5('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ce5('0x1'));var db=require(_0x1ce5('0x2'))['db'];var utils=require(_0x1ce5('0x3'));var logger=require(_0x1ce5('0x4'))(_0x1ce5('0x5'));var config=require(_0x1ce5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ce5('0x7')][_0x1ce5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x538e65,_0x12375b,_0x914eaa){return new BPromise(function(_0x49e44a,_0xc9f8d7){return client[_0x1ce5('0x9')](_0x538e65,_0x914eaa)[_0x1ce5('0xa')](function(_0x50d8b2){logger['info'](_0x1ce5('0xb'),_0x12375b,'request\x20sent');logger[_0x1ce5('0xc')](_0x1ce5('0xd'),_0x12375b,'request\x20sent',JSON[_0x1ce5('0xe')](_0x50d8b2));if(_0x50d8b2[_0x1ce5('0xf')]){if(_0x50d8b2[_0x1ce5('0xf')][_0x1ce5('0x10')]===0x1f4){logger[_0x1ce5('0xf')](_0x1ce5('0xb'),_0x12375b,_0x50d8b2['error']['message']);return _0xc9f8d7(_0x50d8b2[_0x1ce5('0xf')][_0x1ce5('0x11')]);}logger[_0x1ce5('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x12375b,_0x50d8b2[_0x1ce5('0xf')][_0x1ce5('0x11')]);return _0x49e44a(_0x50d8b2[_0x1ce5('0xf')]['message']);}else{logger[_0x1ce5('0x12')](_0x1ce5('0xb'),_0x12375b,_0x1ce5('0x13'));_0x49e44a(_0x50d8b2['result'][_0x1ce5('0x11')]);}})['catch'](function(_0x34d2c4){logger[_0x1ce5('0xf')](_0x1ce5('0xb'),_0x12375b,_0x34d2c4);_0xc9f8d7(_0x34d2c4);});});} \ No newline at end of file +var _0xaa68=['message','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xaa68,0x94));var _0x8aa6=function(_0x1e8bff,_0x5553bd){_0x1e8bff=_0x1e8bff-0x0;var _0x442d64=_0xaa68[_0x1e8bff];return _0x442d64;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8aa6('0x0'));var BPromise=require(_0x8aa6('0x1'));var rs=require(_0x8aa6('0x2'));var fs=require('fs');var Redis=require(_0x8aa6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8aa6('0x4'));var logger=require(_0x8aa6('0x5'))(_0x8aa6('0x6'));var config=require(_0x8aa6('0x7'));var jayson=require(_0x8aa6('0x8'));var client=jayson['client'][_0x8aa6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6ebb4f,_0x2c27aa,_0x5858c9){return new BPromise(function(_0x231f98,_0x365a0d){return client[_0x8aa6('0xa')](_0x6ebb4f,_0x5858c9)[_0x8aa6('0xb')](function(_0xe3f122){logger[_0x8aa6('0xc')](_0x8aa6('0xd'),_0x2c27aa,_0x8aa6('0xe'));logger[_0x8aa6('0xf')](_0x8aa6('0x10'),_0x2c27aa,_0x8aa6('0xe'),JSON[_0x8aa6('0x11')](_0xe3f122));if(_0xe3f122[_0x8aa6('0x12')]){if(_0xe3f122['error'][_0x8aa6('0x13')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2c27aa,_0xe3f122[_0x8aa6('0x12')]['message']);return _0x365a0d(_0xe3f122[_0x8aa6('0x12')][_0x8aa6('0x14')]);}logger[_0x8aa6('0x12')](_0x8aa6('0xd'),_0x2c27aa,_0xe3f122[_0x8aa6('0x12')][_0x8aa6('0x14')]);return _0x231f98(_0xe3f122['error'][_0x8aa6('0x14')]);}else{logger['info']('AnalyticDefaultReport,\x20%s,\x20%s',_0x2c27aa,_0x8aa6('0xe'));_0x231f98(_0xe3f122['result'][_0x8aa6('0x14')]);}})['catch'](function(_0x46e9dd){logger[_0x8aa6('0x12')](_0x8aa6('0xd'),_0x2c27aa,_0x46e9dd);_0x365a0d(_0x46e9dd);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 1c7344d..b58cf5c 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 _0x91c5=['get','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','index'];(function(_0x267900,_0x117fa7){var _0x2f95df=function(_0xac178c){while(--_0xac178c){_0x267900['push'](_0x267900['shift']());}};_0x2f95df(++_0x117fa7);}(_0x91c5,0x1c1));var _0x591c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91c5[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x591c('0x0'));var express=require(_0x591c('0x1'));var router=express[_0x591c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x591c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x591c('0x4'));var controller=require(_0x591c('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x591c('0x6')]);router[_0x591c('0x7')]('/:id',auth[_0x591c('0x8')](),controller[_0x591c('0x9')]);router[_0x591c('0x7')](_0x591c('0xa'),auth[_0x591c('0x8')](),controller[_0x591c('0xb')]);router[_0x591c('0x7')](_0x591c('0xc'),auth['isAuthenticated'](),controller[_0x591c('0xd')]);router[_0x591c('0x7')](_0x591c('0xe'),auth['isAuthenticated'](),controller[_0x591c('0xf')]);router[_0x591c('0x10')]('/',auth[_0x591c('0x8')](),controller[_0x591c('0x11')]);router[_0x591c('0x12')](_0x591c('0x13'),auth['isAuthenticated'](),controller[_0x591c('0x14')]);router[_0x591c('0x15')](_0x591c('0x13'),auth[_0x591c('0x8')](),controller[_0x591c('0x16')]);module[_0x591c('0x17')]=router; \ No newline at end of file +var _0x1335=['./analyticDefaultReport.controller','get','/:id','isAuthenticated','show','preview','run','/:id/query','query','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5a4e35,_0x2028e3){var _0x474a4c=function(_0x30e6a0){while(--_0x30e6a0){_0x5a4e35['push'](_0x5a4e35['shift']());}};_0x474a4c(++_0x2028e3);}(_0x1335,0x1f3));var _0x5133=function(_0xfffffa,_0x8b5d7a){_0xfffffa=_0xfffffa-0x0;var _0x3715e8=_0x1335[_0xfffffa];return _0x3715e8;};'use strict';var multer=require('multer');var util=require(_0x5133('0x0'));var path=require(_0x5133('0x1'));var timeout=require('connect-timeout');var express=require(_0x5133('0x2'));var router=express[_0x5133('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5133('0x4'));var interaction=require(_0x5133('0x5'));var config=require(_0x5133('0x6'));var controller=require(_0x5133('0x7'));router[_0x5133('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5133('0x8')](_0x5133('0x9'),auth[_0x5133('0xa')](),controller[_0x5133('0xb')]);router[_0x5133('0x8')]('/:id/preview',auth[_0x5133('0xa')](),controller[_0x5133('0xc')]);router['get']('/:id/run',auth[_0x5133('0xa')](),controller[_0x5133('0xd')]);router[_0x5133('0x8')](_0x5133('0xe'),auth[_0x5133('0xa')](),controller[_0x5133('0xf')]);router['post']('/',auth[_0x5133('0xa')](),controller[_0x5133('0x10')]);router[_0x5133('0x11')](_0x5133('0x9'),auth[_0x5133('0xa')](),controller[_0x5133('0x12')]);router[_0x5133('0x13')]('/:id',auth[_0x5133('0xa')](),controller[_0x5133('0x14')]);module[_0x5133('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 66d5209..713529c 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 _0xe8eb=['pdf','xlsx','DATE','ENUM','manual','scheduled','UNSIGNED','sequelize','moment','exports','STRING','csv'];(function(_0x374521,_0x4703fb){var _0x2120b9=function(_0x3f57b0){while(--_0x3f57b0){_0x374521['push'](_0x374521['shift']());}};_0x2120b9(++_0x4703fb);}(_0xe8eb,0x8b));var _0xbe8e=function(_0x5e9491,_0x129e18){_0x5e9491=_0x5e9491-0x0;var _0x2f6d97=_0xe8eb[_0x5e9491];return _0x2f6d97;};'use strict';var Sequelize=require(_0xbe8e('0x0'));var moment=require(_0xbe8e('0x1'));module[_0xbe8e('0x2')]={'name':{'type':Sequelize[_0xbe8e('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xbe8e('0x4'),_0xbe8e('0x5'),_0xbe8e('0x6')),'allowNull':![],'defaultValue':_0xbe8e('0x4')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0xbe8e('0x7')]},'status':{'type':Sequelize[_0xbe8e('0x3')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0xbe8e('0x8')](_0xbe8e('0x9'),_0xbe8e('0xa')),'allowNull':![],'defaultValue':_0xbe8e('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xbe8e('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x836b=['sequelize','moment','STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x836b,0x138));var _0xb836=function(_0x5d96f6,_0x44aeac){_0x5d96f6=_0x5d96f6-0x0;var _0x247d14=_0x836b[_0x5d96f6];return _0x247d14;};'use strict';var Sequelize=require(_0xb836('0x0'));var moment=require(_0xb836('0x1'));module['exports']={'name':{'type':Sequelize[_0xb836('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xb836('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0xb836('0x3')](_0xb836('0x4'),_0xb836('0x5'),_0xb836('0x6')),'allowNull':![],'defaultValue':_0xb836('0x4')},'savename':{'type':Sequelize[_0xb836('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xb836('0x7')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize[_0xb836('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM'](_0xb836('0x8'),_0xb836('0x9')),'allowNull':![],'defaultValue':_0xb836('0x8')},'reportId':{'type':Sequelize[_0xb836('0xa')](0xb)[_0xb836('0xb')]},'reportType':{'type':Sequelize[_0xb836('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 7fa4d2b..31e6b4a 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 _0x36d5=['find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','basename','output','existsSync','root','server/files/reports','savename','Sequelize','ValidationError','download','join','format','%s.%s','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','set','reject','save','then','destroy','get','ExtractedReports','error','stack','name','send','index','map','AnalyticExtractedReport','type','model','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x36d5,0x187));var _0x536d=function(_0x297dcf,_0x448cf5){_0x297dcf=_0x297dcf-0x0;var _0xe1699b=_0x36d5[_0x297dcf];return _0xe1699b;};'use strict';var emlformat=require(_0x536d('0x0'));var rimraf=require(_0x536d('0x1'));var zipdir=require(_0x536d('0x2'));var jsonpatch=require(_0x536d('0x3'));var rp=require('request-promise');var moment=require(_0x536d('0x4'));var BPromise=require(_0x536d('0x5'));var Mustache=require(_0x536d('0x6'));var util=require(_0x536d('0x7'));var path=require(_0x536d('0x8'));var sox=require(_0x536d('0x9'));var csv=require(_0x536d('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x536d('0xb'));var _=require(_0x536d('0xc'));var squel=require(_0x536d('0xd'));var crypto=require(_0x536d('0xe'));var jsforce=require(_0x536d('0xf'));var deskjs=require(_0x536d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x536d('0x11'));var Papa=require('papaparse');var Redis=require(_0x536d('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x536d('0x13'));var hardwareService=require(_0x536d('0x14'));var logger=require(_0x536d('0x15'))(_0x536d('0x16'));var utils=require(_0x536d('0x17'));var config=require(_0x536d('0x18'));var licenseUtil=require(_0x536d('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x252b8f,_0x50c62e){_0x50c62e=_0x50c62e||0xcc;return function(_0x3a4bef){if(_0x3a4bef){return _0x252b8f[_0x536d('0x1a')](_0x50c62e);}return _0x252b8f[_0x536d('0x1b')](_0x50c62e)['end']();};}function respondWithResult(_0x3d6b57,_0x138c60){_0x138c60=_0x138c60||0xc8;return function(_0x19df46){if(_0x19df46){return _0x3d6b57['status'](_0x138c60)[_0x536d('0x1c')](_0x19df46);}};}function respondWithFilteredResult(_0x253c8d,_0x48657d){return function(_0x5e2dad){if(_0x5e2dad){var _0x5df25c=typeof _0x48657d['offset']==='undefined'&&typeof _0x48657d['limit']==='undefined';var _0x2d8f57=_0x5e2dad[_0x536d('0x1d')];var _0xa45dde=_0x5df25c?0x0:_0x48657d[_0x536d('0x1e')];var _0x1d5620=_0x5df25c?_0x5e2dad[_0x536d('0x1d')]:_0x48657d[_0x536d('0x1e')]+_0x48657d[_0x536d('0x1f')];var _0x2302f7;if(_0x1d5620>=_0x2d8f57){_0x1d5620=_0x2d8f57;_0x2302f7=0xc8;}else{_0x2302f7=0xce;}_0x253c8d[_0x536d('0x1b')](_0x2302f7);return _0x253c8d[_0x536d('0x20')]('Content-Range',_0xa45dde+'-'+_0x1d5620+'/'+_0x2d8f57)[_0x536d('0x1c')](_0x5e2dad);}return null;};}function patchUpdates(_0x6c0317){return function(_0x1bd090){try{jsonpatch['apply'](_0x1bd090,_0x6c0317,!![]);}catch(_0x330465){return BPromise[_0x536d('0x21')](_0x330465);}return _0x1bd090[_0x536d('0x22')]();};}function saveUpdates(_0x115fab,_0x33570b){return function(_0x477a50){if(_0x477a50){return _0x477a50['update'](_0x115fab)[_0x536d('0x23')](function(_0x191490){return _0x191490;});}return null;};}function removeEntity(_0x32a859,_0x713a60){return function(_0x4a9b32){if(_0x4a9b32){return _0x4a9b32[_0x536d('0x24')]()[_0x536d('0x23')](function(){var _0x1241b0=_0x4a9b32[_0x536d('0x25')]({'plain':!![]});var _0x447d7d=_0x536d('0x26');return db['UserProfileResource'][_0x536d('0x24')]({'where':{'type':_0x447d7d,'resourceId':_0x1241b0['id']}})[_0x536d('0x23')](function(){return _0x4a9b32;});})[_0x536d('0x23')](function(){_0x32a859[_0x536d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x689dc2,_0x3ae27d){return function(_0x1ddebc){if(!_0x1ddebc){_0x689dc2['sendStatus'](0x194);}return _0x1ddebc;};}function handleError(_0x22df44,_0x139e97){_0x139e97=_0x139e97||0x1f4;return function(_0x5575ec){logger[_0x536d('0x27')](_0x5575ec[_0x536d('0x28')]);if(_0x5575ec[_0x536d('0x29')]){delete _0x5575ec[_0x536d('0x29')];}_0x22df44[_0x536d('0x1b')](_0x139e97)[_0x536d('0x2a')](_0x5575ec);};}exports[_0x536d('0x2b')]=function(_0x252079,_0x14c3b6){var _0x5877c4={},_0x1c7b1d={},_0x255bf0={'count':0x0,'rows':[]};var _0x39ad94=_[_0x536d('0x2c')](db[_0x536d('0x2d')]['rawAttributes'],function(_0x22c132){return{'name':_0x22c132['fieldName'],'type':_0x22c132[_0x536d('0x2e')]['key']};});_0x1c7b1d[_0x536d('0x2f')]=_['map'](_0x39ad94,_0x536d('0x29'));_0x1c7b1d[_0x536d('0x30')]=_[_0x536d('0x31')](_0x252079[_0x536d('0x30')]);_0x1c7b1d[_0x536d('0x32')]=_['intersection'](_0x1c7b1d['model'],_0x1c7b1d[_0x536d('0x30')]);_0x5877c4[_0x536d('0x33')]=_[_0x536d('0x34')](_0x1c7b1d[_0x536d('0x2f')],qs[_0x536d('0x35')](_0x252079[_0x536d('0x30')][_0x536d('0x35')]));_0x5877c4['attributes']=_0x5877c4[_0x536d('0x33')][_0x536d('0x36')]?_0x5877c4[_0x536d('0x33')]:_0x1c7b1d[_0x536d('0x2f')];if(!_0x252079[_0x536d('0x30')]['hasOwnProperty']('nolimit')){_0x5877c4['limit']=qs[_0x536d('0x1f')](_0x252079[_0x536d('0x30')][_0x536d('0x1f')]);_0x5877c4['offset']=qs[_0x536d('0x1e')](_0x252079['query']['offset']);}_0x5877c4[_0x536d('0x37')]=qs[_0x536d('0x38')](_0x252079[_0x536d('0x30')][_0x536d('0x38')]);_0x5877c4[_0x536d('0x39')]=qs[_0x536d('0x32')](_[_0x536d('0x3a')](_0x252079[_0x536d('0x30')],_0x1c7b1d[_0x536d('0x32')]),_0x39ad94);if(_0x252079[_0x536d('0x30')][_0x536d('0x3b')]){_0x5877c4[_0x536d('0x39')]=_[_0x536d('0x3c')](_0x5877c4[_0x536d('0x39')],{'$or':_[_0x536d('0x2c')](_0x39ad94,function(_0x1f255){if(_0x1f255[_0x536d('0x2e')]!==_0x536d('0x3d')){var _0x47e866={};_0x47e866[_0x1f255[_0x536d('0x29')]]={'$like':'%'+_0x252079[_0x536d('0x30')][_0x536d('0x3b')]+'%'};return _0x47e866;}})});}_0x5877c4=_[_0x536d('0x3c')]({},_0x5877c4,_0x252079[_0x536d('0x3e')]);var _0x1177c5={'where':_0x5877c4[_0x536d('0x39')]};return db[_0x536d('0x2d')][_0x536d('0x1d')](_0x1177c5)[_0x536d('0x23')](function(_0x529f71){_0x255bf0[_0x536d('0x1d')]=_0x529f71;if(_0x252079[_0x536d('0x30')][_0x536d('0x3f')]){_0x5877c4[_0x536d('0x40')]=[{'all':!![]}];}return db[_0x536d('0x2d')][_0x536d('0x41')](_0x5877c4);})[_0x536d('0x23')](function(_0x554ee6){_0x255bf0['rows']=_0x554ee6;return _0x255bf0;})[_0x536d('0x23')](respondWithFilteredResult(_0x14c3b6,_0x5877c4))[_0x536d('0x42')](handleError(_0x14c3b6,null));};exports[_0x536d('0x43')]=function(_0x277a78,_0x4d920b){var _0x2db727={'raw':!![],'where':{'id':_0x277a78[_0x536d('0x44')]['id']}},_0x37a47f={};_0x37a47f['model']=_[_0x536d('0x31')](db[_0x536d('0x2d')]['rawAttributes']);_0x37a47f[_0x536d('0x30')]=_[_0x536d('0x31')](_0x277a78[_0x536d('0x30')]);_0x37a47f[_0x536d('0x32')]=_[_0x536d('0x34')](_0x37a47f['model'],_0x37a47f['query']);_0x2db727[_0x536d('0x33')]=_[_0x536d('0x34')](_0x37a47f[_0x536d('0x2f')],qs[_0x536d('0x35')](_0x277a78[_0x536d('0x30')][_0x536d('0x35')]));_0x2db727[_0x536d('0x33')]=_0x2db727[_0x536d('0x33')][_0x536d('0x36')]?_0x2db727[_0x536d('0x33')]:_0x37a47f[_0x536d('0x2f')];if(_0x277a78[_0x536d('0x30')][_0x536d('0x3f')]){_0x2db727[_0x536d('0x40')]=[{'all':!![]}];}_0x2db727=_[_0x536d('0x3c')]({},_0x2db727,_0x277a78['options']);return db['AnalyticExtractedReport'][_0x536d('0x45')](_0x2db727)[_0x536d('0x23')](handleEntityNotFound(_0x4d920b,null))[_0x536d('0x23')](respondWithResult(_0x4d920b,null))[_0x536d('0x42')](handleError(_0x4d920b,null));};exports[_0x536d('0x46')]=function(_0x5579f4,_0x38535c){return db[_0x536d('0x2d')]['create'](_0x5579f4[_0x536d('0x47')],{})[_0x536d('0x23')](function(_0x54ab7d){var _0x3ee93d=_0x5579f4['user'][_0x536d('0x25')]({'plain':!![]});if(!_0x3ee93d)throw new Error(_0x536d('0x48'));if(_0x3ee93d[_0x536d('0x49')]===_0x536d('0x4a')){var _0x481961=_0x54ab7d[_0x536d('0x25')]({'plain':!![]});var _0x2567d3=_0x536d('0x26');return db['UserProfileSection'][_0x536d('0x45')]({'where':{'name':_0x2567d3,'userProfileId':_0x3ee93d[_0x536d('0x4b')]},'raw':!![]})[_0x536d('0x23')](function(_0x2daae1){if(_0x2daae1&&_0x2daae1[_0x536d('0x4c')]===0x0){return db['UserProfileResource'][_0x536d('0x46')]({'name':_0x481961[_0x536d('0x29')],'resourceId':_0x481961['id'],'type':_0x2daae1[_0x536d('0x29')],'sectionId':_0x2daae1['id']},{})[_0x536d('0x23')](function(){return _0x54ab7d;});}else{return _0x54ab7d;}})['catch'](function(_0x2dc587){logger['error'](_0x536d('0x4d'),_0x2dc587);throw _0x2dc587;});}return _0x54ab7d;})['then'](respondWithResult(_0x38535c,0xc9))[_0x536d('0x42')](handleError(_0x38535c,null));};exports[_0x536d('0x4e')]=function(_0x508abd,_0x3a476d){if(_0x508abd['body']['id']){delete _0x508abd[_0x536d('0x47')]['id'];}return db['AnalyticExtractedReport'][_0x536d('0x45')]({'where':{'id':_0x508abd[_0x536d('0x44')]['id']}})[_0x536d('0x23')](handleEntityNotFound(_0x3a476d,null))[_0x536d('0x23')](saveUpdates(_0x508abd[_0x536d('0x47')],null))['then'](respondWithResult(_0x3a476d,null))[_0x536d('0x42')](handleError(_0x3a476d,null));};exports[_0x536d('0x24')]=function(_0x404064,_0x5b2048){return db[_0x536d('0x2d')][_0x536d('0x45')]({'where':{'id':_0x404064[_0x536d('0x44')]['id']}})[_0x536d('0x23')](handleEntityNotFound(_0x5b2048,null))[_0x536d('0x23')](removeEntity(_0x5b2048,null))['catch'](handleError(_0x5b2048,null));};exports['download']=function(_0x41ad04,_0x1a33ac,_0x3a7c0d){return db[_0x536d('0x2d')][_0x536d('0x45')]({'where':{'id':_0x41ad04['params']['id']},'attributes':[_0x536d('0x29'),_0x536d('0x4f'),'savename',_0x536d('0x50')],'raw':!![]})[_0x536d('0x23')](handleEntityNotFound(_0x1a33ac,null))[_0x536d('0x23')](function(_0x446bb6){if(_0x446bb6){if(!fs[_0x536d('0x51')](path['join'](config[_0x536d('0x52')],_0x536d('0x53'),_0x446bb6[_0x536d('0x54')]))){throw new db[(_0x536d('0x55'))][(_0x536d('0x56'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x41ad04[_0x536d('0x30')]['exists']){return _0x1a33ac[_0x536d('0x1a')](0xc8);}return _0x1a33ac[_0x536d('0x57')](path[_0x536d('0x58')](config[_0x536d('0x52')],'server/files/reports',_0x446bb6[_0x536d('0x54')]),util[_0x536d('0x59')](_0x536d('0x5a'),_0x446bb6[_0x536d('0x4f')]||_0x446bb6[_0x536d('0x29')],_0x446bb6['output'][_0x536d('0x5b')]()));}})[_0x536d('0x42')](handleError(_0x1a33ac,null));}; \ No newline at end of file +var _0x5068=['attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticExtractedReport','includeAll','include','findAll','catch','show','params','keys','find','create','body','user','role','ExtractedReports','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','output','existsSync','join','root','Sequelize','exists','server/files/reports','%s.%s','basename','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','UserProfileResource','error','send','index','map','rawAttributes','type','key','model','name','query','filters','intersection'];(function(_0x1c05ce,_0xbc107b){var _0x114ec3=function(_0x3a4e08){while(--_0x3a4e08){_0x1c05ce['push'](_0x1c05ce['shift']());}};_0x114ec3(++_0xbc107b);}(_0x5068,0x13d));var _0x8506=function(_0x32d900,_0x2e9d45){_0x32d900=_0x32d900-0x0;var _0x558ea0=_0x5068[_0x32d900];return _0x558ea0;};'use strict';var emlformat=require(_0x8506('0x0'));var rimraf=require(_0x8506('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8506('0x2'));var rp=require(_0x8506('0x3'));var moment=require('moment');var BPromise=require(_0x8506('0x4'));var Mustache=require(_0x8506('0x5'));var util=require(_0x8506('0x6'));var path=require(_0x8506('0x7'));var sox=require(_0x8506('0x8'));var csv=require(_0x8506('0x9'));var ejs=require(_0x8506('0xa'));var fs=require('fs');var fs_extra=require(_0x8506('0xb'));var _=require('lodash');var squel=require(_0x8506('0xc'));var crypto=require(_0x8506('0xd'));var jsforce=require(_0x8506('0xe'));var deskjs=require(_0x8506('0xf'));var toCsv=require(_0x8506('0x9'));var querystring=require(_0x8506('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8506('0x11'));var qs=require(_0x8506('0x12'));var as=require(_0x8506('0x13'));var hardwareService=require(_0x8506('0x14'));var logger=require(_0x8506('0x15'))(_0x8506('0x16'));var utils=require(_0x8506('0x17'));var config=require(_0x8506('0x18'));var licenseUtil=require(_0x8506('0x19'));var db=require(_0x8506('0x1a'))['db'];function respondWithStatusCode(_0x186953,_0x44992d){_0x44992d=_0x44992d||0xcc;return function(_0x5a7497){if(_0x5a7497){return _0x186953[_0x8506('0x1b')](_0x44992d);}return _0x186953[_0x8506('0x1c')](_0x44992d)[_0x8506('0x1d')]();};}function respondWithResult(_0x4ea26e,_0x44e6a4){_0x44e6a4=_0x44e6a4||0xc8;return function(_0x20ff88){if(_0x20ff88){return _0x4ea26e['status'](_0x44e6a4)[_0x8506('0x1e')](_0x20ff88);}};}function respondWithFilteredResult(_0x1ea9cc,_0x3ab750){return function(_0x28ef05){if(_0x28ef05){var _0x4cb39a=typeof _0x3ab750[_0x8506('0x1f')]==='undefined'&&typeof _0x3ab750[_0x8506('0x20')]===_0x8506('0x21');var _0x922eb9=_0x28ef05[_0x8506('0x22')];var _0x5c0fad=_0x4cb39a?0x0:_0x3ab750[_0x8506('0x1f')];var _0x512819=_0x4cb39a?_0x28ef05['count']:_0x3ab750[_0x8506('0x1f')]+_0x3ab750[_0x8506('0x20')];var _0x8ce8d1;if(_0x512819>=_0x922eb9){_0x512819=_0x922eb9;_0x8ce8d1=0xc8;}else{_0x8ce8d1=0xce;}_0x1ea9cc[_0x8506('0x1c')](_0x8ce8d1);return _0x1ea9cc[_0x8506('0x23')](_0x8506('0x24'),_0x5c0fad+'-'+_0x512819+'/'+_0x922eb9)[_0x8506('0x1e')](_0x28ef05);}return null;};}function patchUpdates(_0xd6f91f){return function(_0x21610f){try{jsonpatch['apply'](_0x21610f,_0xd6f91f,!![]);}catch(_0x596598){return BPromise[_0x8506('0x25')](_0x596598);}return _0x21610f[_0x8506('0x26')]();};}function saveUpdates(_0x10e43b,_0x242afa){return function(_0x57ba18){if(_0x57ba18){return _0x57ba18[_0x8506('0x27')](_0x10e43b)[_0x8506('0x28')](function(_0xf3351){return _0xf3351;});}return null;};}function removeEntity(_0x56de59,_0x67ead3){return function(_0x37e804){if(_0x37e804){return _0x37e804[_0x8506('0x29')]()[_0x8506('0x28')](function(){var _0xdee4e=_0x37e804['get']({'plain':!![]});var _0x42d1d8='ExtractedReports';return db[_0x8506('0x2a')][_0x8506('0x29')]({'where':{'type':_0x42d1d8,'resourceId':_0xdee4e['id']}})['then'](function(){return _0x37e804;});})[_0x8506('0x28')](function(){_0x56de59['status'](0xcc)[_0x8506('0x1d')]();});}};}function handleEntityNotFound(_0x5ac71e,_0xa1c612){return function(_0x1f3d13){if(!_0x1f3d13){_0x5ac71e[_0x8506('0x1b')](0x194);}return _0x1f3d13;};}function handleError(_0x2f89b5,_0x51fae0){_0x51fae0=_0x51fae0||0x1f4;return function(_0x650141){logger[_0x8506('0x2b')](_0x650141['stack']);if(_0x650141['name']){delete _0x650141['name'];}_0x2f89b5[_0x8506('0x1c')](_0x51fae0)[_0x8506('0x2c')](_0x650141);};}exports[_0x8506('0x2d')]=function(_0x7e21ca,_0x278dca){var _0x10df3e={},_0x3e71b0={},_0x4ba65f={'count':0x0,'rows':[]};var _0x1d8bc4=_[_0x8506('0x2e')](db['AnalyticExtractedReport'][_0x8506('0x2f')],function(_0xc33d01){return{'name':_0xc33d01['fieldName'],'type':_0xc33d01[_0x8506('0x30')][_0x8506('0x31')]};});_0x3e71b0[_0x8506('0x32')]=_[_0x8506('0x2e')](_0x1d8bc4,_0x8506('0x33'));_0x3e71b0[_0x8506('0x34')]=_['keys'](_0x7e21ca[_0x8506('0x34')]);_0x3e71b0[_0x8506('0x35')]=_[_0x8506('0x36')](_0x3e71b0[_0x8506('0x32')],_0x3e71b0[_0x8506('0x34')]);_0x10df3e[_0x8506('0x37')]=_[_0x8506('0x36')](_0x3e71b0[_0x8506('0x32')],qs[_0x8506('0x38')](_0x7e21ca[_0x8506('0x34')][_0x8506('0x38')]));_0x10df3e[_0x8506('0x37')]=_0x10df3e[_0x8506('0x37')][_0x8506('0x39')]?_0x10df3e[_0x8506('0x37')]:_0x3e71b0['model'];if(!_0x7e21ca[_0x8506('0x34')][_0x8506('0x3a')]('nolimit')){_0x10df3e['limit']=qs[_0x8506('0x20')](_0x7e21ca['query'][_0x8506('0x20')]);_0x10df3e[_0x8506('0x1f')]=qs[_0x8506('0x1f')](_0x7e21ca['query']['offset']);}_0x10df3e[_0x8506('0x3b')]=qs[_0x8506('0x3c')](_0x7e21ca[_0x8506('0x34')][_0x8506('0x3c')]);_0x10df3e[_0x8506('0x3d')]=qs['filters'](_[_0x8506('0x3e')](_0x7e21ca['query'],_0x3e71b0[_0x8506('0x35')]),_0x1d8bc4);if(_0x7e21ca[_0x8506('0x34')][_0x8506('0x3f')]){_0x10df3e[_0x8506('0x3d')]=_['merge'](_0x10df3e[_0x8506('0x3d')],{'$or':_[_0x8506('0x2e')](_0x1d8bc4,function(_0x165637){if(_0x165637[_0x8506('0x30')]!==_0x8506('0x40')){var _0x8e1054={};_0x8e1054[_0x165637[_0x8506('0x33')]]={'$like':'%'+_0x7e21ca[_0x8506('0x34')]['filter']+'%'};return _0x8e1054;}})});}_0x10df3e=_[_0x8506('0x41')]({},_0x10df3e,_0x7e21ca[_0x8506('0x42')]);var _0xda6182={'where':_0x10df3e[_0x8506('0x3d')]};return db[_0x8506('0x43')]['count'](_0xda6182)['then'](function(_0x3a4f2c){_0x4ba65f[_0x8506('0x22')]=_0x3a4f2c;if(_0x7e21ca[_0x8506('0x34')][_0x8506('0x44')]){_0x10df3e[_0x8506('0x45')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8506('0x46')](_0x10df3e);})[_0x8506('0x28')](function(_0x3da5ae){_0x4ba65f['rows']=_0x3da5ae;return _0x4ba65f;})['then'](respondWithFilteredResult(_0x278dca,_0x10df3e))[_0x8506('0x47')](handleError(_0x278dca,null));};exports[_0x8506('0x48')]=function(_0x40bf02,_0xe7d196){var _0x2c6e28={'raw':!![],'where':{'id':_0x40bf02[_0x8506('0x49')]['id']}},_0x42abbd={};_0x42abbd[_0x8506('0x32')]=_[_0x8506('0x4a')](db[_0x8506('0x43')][_0x8506('0x2f')]);_0x42abbd['query']=_['keys'](_0x40bf02[_0x8506('0x34')]);_0x42abbd[_0x8506('0x35')]=_[_0x8506('0x36')](_0x42abbd[_0x8506('0x32')],_0x42abbd[_0x8506('0x34')]);_0x2c6e28[_0x8506('0x37')]=_[_0x8506('0x36')](_0x42abbd[_0x8506('0x32')],qs[_0x8506('0x38')](_0x40bf02['query']['fields']));_0x2c6e28[_0x8506('0x37')]=_0x2c6e28[_0x8506('0x37')][_0x8506('0x39')]?_0x2c6e28[_0x8506('0x37')]:_0x42abbd['model'];if(_0x40bf02[_0x8506('0x34')]['includeAll']){_0x2c6e28[_0x8506('0x45')]=[{'all':!![]}];}_0x2c6e28=_['merge']({},_0x2c6e28,_0x40bf02[_0x8506('0x42')]);return db[_0x8506('0x43')][_0x8506('0x4b')](_0x2c6e28)[_0x8506('0x28')](handleEntityNotFound(_0xe7d196,null))['then'](respondWithResult(_0xe7d196,null))[_0x8506('0x47')](handleError(_0xe7d196,null));};exports[_0x8506('0x4c')]=function(_0x11072f,_0x442ecd){return db[_0x8506('0x43')][_0x8506('0x4c')](_0x11072f[_0x8506('0x4d')],{})['then'](function(_0x223912){var _0x5385df=_0x11072f[_0x8506('0x4e')]['get']({'plain':!![]});if(!_0x5385df)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5385df[_0x8506('0x4f')]===_0x8506('0x4e')){var _0x462a53=_0x223912['get']({'plain':!![]});var _0x26a9e9=_0x8506('0x50');return db[_0x8506('0x51')][_0x8506('0x4b')]({'where':{'name':_0x26a9e9,'userProfileId':_0x5385df['userProfileId']},'raw':!![]})[_0x8506('0x28')](function(_0x3fc6f7){if(_0x3fc6f7&&_0x3fc6f7[_0x8506('0x52')]===0x0){return db[_0x8506('0x2a')][_0x8506('0x4c')]({'name':_0x462a53[_0x8506('0x33')],'resourceId':_0x462a53['id'],'type':_0x3fc6f7[_0x8506('0x33')],'sectionId':_0x3fc6f7['id']},{})[_0x8506('0x28')](function(){return _0x223912;});}else{return _0x223912;}})['catch'](function(_0x15c668){logger['error'](_0x8506('0x53'),_0x15c668);throw _0x15c668;});}return _0x223912;})['then'](respondWithResult(_0x442ecd,0xc9))[_0x8506('0x47')](handleError(_0x442ecd,null));};exports['update']=function(_0x4fccc2,_0x2380ca){if(_0x4fccc2['body']['id']){delete _0x4fccc2[_0x8506('0x4d')]['id'];}return db[_0x8506('0x43')]['find']({'where':{'id':_0x4fccc2[_0x8506('0x49')]['id']}})[_0x8506('0x28')](handleEntityNotFound(_0x2380ca,null))[_0x8506('0x28')](saveUpdates(_0x4fccc2['body'],null))[_0x8506('0x28')](respondWithResult(_0x2380ca,null))[_0x8506('0x47')](handleError(_0x2380ca,null));};exports[_0x8506('0x29')]=function(_0x1da8f4,_0x40e4be){return db[_0x8506('0x43')][_0x8506('0x4b')]({'where':{'id':_0x1da8f4[_0x8506('0x49')]['id']}})[_0x8506('0x28')](handleEntityNotFound(_0x40e4be,null))[_0x8506('0x28')](removeEntity(_0x40e4be,null))['catch'](handleError(_0x40e4be,null));};exports['download']=function(_0x52f59e,_0x45e84e,_0x4a61e8){return db[_0x8506('0x43')][_0x8506('0x4b')]({'where':{'id':_0x52f59e[_0x8506('0x49')]['id']},'attributes':[_0x8506('0x33'),'basename','savename',_0x8506('0x54')],'raw':!![]})[_0x8506('0x28')](handleEntityNotFound(_0x45e84e,null))[_0x8506('0x28')](function(_0x2e532b){if(_0x2e532b){if(!fs[_0x8506('0x55')](path[_0x8506('0x56')](config[_0x8506('0x57')],'server/files/reports',_0x2e532b['savename']))){throw new db[(_0x8506('0x58'))]['ValidationError']('Report\x20not\x20found\x20or\x20empty');}if(_0x52f59e['query'][_0x8506('0x59')]){return _0x45e84e['sendStatus'](0xc8);}return _0x45e84e['download'](path[_0x8506('0x56')](config[_0x8506('0x57')],_0x8506('0x5a'),_0x2e532b['savename']),util['format'](_0x8506('0x5b'),_0x2e532b[_0x8506('0x5c')]||_0x2e532b[_0x8506('0x33')],_0x2e532b[_0x8506('0x54')]['toLowerCase']()));}})[_0x8506('0x47')](handleError(_0x45e84e,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 567917c..708df3a 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 _0x6f21=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash'];(function(_0x35e327,_0x3cda24){var _0x4f2310=function(_0x2cf292){while(--_0x2cf292){_0x35e327['push'](_0x35e327['shift']());}};_0x4f2310(++_0x3cda24);}(_0x6f21,0xfb));var _0x16f2=function(_0x4faabc,_0x349a1e){_0x4faabc=_0x4faabc-0x0;var _0x42fc45=_0x6f21[_0x4faabc];return _0x42fc45;};'use strict';var _=require(_0x16f2('0x0'));var util=require(_0x16f2('0x1'));var logger=require(_0x16f2('0x2'))(_0x16f2('0x3'));var moment=require(_0x16f2('0x4'));var BPromise=require(_0x16f2('0x5'));var rp=require(_0x16f2('0x6'));var fs=require('fs');var path=require(_0x16f2('0x7'));var rimraf=require(_0x16f2('0x8'));var config=require(_0x16f2('0x9'));var attributes=require(_0x16f2('0xa'));module[_0x16f2('0xb')]=function(_0x193481,_0x120653){return _0x193481[_0x16f2('0xc')](_0x16f2('0xd'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3a8=['../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','util'];(function(_0x2752f4,_0x1652ca){var _0x5768c4=function(_0x32e25f){while(--_0x32e25f){_0x2752f4['push'](_0x2752f4['shift']());}};_0x5768c4(++_0x1652ca);}(_0xf3a8,0x11f));var _0x8f3a=function(_0x2e4caa,_0x4d0110){_0x2e4caa=_0x2e4caa-0x0;var _0x4a95f7=_0xf3a8[_0x2e4caa];return _0x4a95f7;};'use strict';var _=require('lodash');var util=require(_0x8f3a('0x0'));var logger=require(_0x8f3a('0x1'))('api');var moment=require(_0x8f3a('0x2'));var BPromise=require('bluebird');var rp=require(_0x8f3a('0x3'));var fs=require('fs');var path=require(_0x8f3a('0x4'));var rimraf=require(_0x8f3a('0x5'));var config=require(_0x8f3a('0x6'));var attributes=require(_0x8f3a('0x7'));module[_0x8f3a('0x8')]=function(_0x5928d8,_0x1a6d9a){return _0x5928d8[_0x8f3a('0x9')](_0x8f3a('0xa'),attributes,{'tableName':_0x8f3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js b/server/api/analyticExtractedReport/analyticExtractedReport.rpc.js index 0cb52ef..c3331a4 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 _0x10d0=['catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x10d0,0x13c));var _0x010d=function(_0xfcf442,_0x374291){_0xfcf442=_0xfcf442-0x0;var _0x5de656=_0x10d0[_0xfcf442];return _0x5de656;};'use strict';var _=require(_0x010d('0x0'));var util=require(_0x010d('0x1'));var moment=require('moment');var BPromise=require(_0x010d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x010d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x010d('0x4'));var logger=require(_0x010d('0x5'))(_0x010d('0x6'));var config=require('../../config/environment');var jayson=require(_0x010d('0x7'));var client=jayson[_0x010d('0x8')][_0x010d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c7cd,_0x293e9c,_0x19a106){return new BPromise(function(_0x2f9013,_0x2483ca){return client[_0x010d('0xa')](_0x48c7cd,_0x19a106)[_0x010d('0xb')](function(_0x282aad){logger['info'](_0x010d('0xc'),_0x293e9c,'request\x20sent');logger[_0x010d('0xd')](_0x010d('0xe'),_0x293e9c,_0x010d('0xf'),JSON[_0x010d('0x10')](_0x282aad));if(_0x282aad[_0x010d('0x11')]){if(_0x282aad[_0x010d('0x11')][_0x010d('0x12')]===0x1f4){logger['error'](_0x010d('0xc'),_0x293e9c,_0x282aad['error'][_0x010d('0x13')]);return _0x2483ca(_0x282aad[_0x010d('0x11')][_0x010d('0x13')]);}logger[_0x010d('0x11')](_0x010d('0xc'),_0x293e9c,_0x282aad[_0x010d('0x11')]['message']);return _0x2f9013(_0x282aad['error'][_0x010d('0x13')]);}else{logger['info']('AnalyticExtractedReport,\x20%s,\x20%s',_0x293e9c,'request\x20sent');_0x2f9013(_0x282aad['result'][_0x010d('0x13')]);}})[_0x010d('0x14')](function(_0x3faa6c){logger[_0x010d('0x11')](_0x010d('0xc'),_0x293e9c,_0x3faa6c);_0x2483ca(_0x3faa6c);});});} \ No newline at end of file +var _0xc069=['bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment'];(function(_0x2b6e48,_0xdb9926){var _0x319c86=function(_0x2b0947){while(--_0x2b0947){_0x2b6e48['push'](_0x2b6e48['shift']());}};_0x319c86(++_0xdb9926);}(_0xc069,0x70));var _0x9c06=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc069[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9c06('0x0'));var util=require(_0x9c06('0x1'));var moment=require(_0x9c06('0x2'));var BPromise=require(_0x9c06('0x3'));var rs=require(_0x9c06('0x4'));var fs=require('fs');var Redis=require(_0x9c06('0x5'));var db=require(_0x9c06('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c06('0x7'))(_0x9c06('0x8'));var config=require('../../config/environment');var jayson=require(_0x9c06('0x9'));var client=jayson[_0x9c06('0xa')][_0x9c06('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3db5a8,_0x42cd9c,_0xd53942){return new BPromise(function(_0x593213,_0xc1418b){return client[_0x9c06('0xc')](_0x3db5a8,_0xd53942)[_0x9c06('0xd')](function(_0x8b9fcc){logger[_0x9c06('0xe')](_0x9c06('0xf'),_0x42cd9c,'request\x20sent');logger['debug'](_0x9c06('0x10'),_0x42cd9c,'request\x20sent',JSON[_0x9c06('0x11')](_0x8b9fcc));if(_0x8b9fcc[_0x9c06('0x12')]){if(_0x8b9fcc['error'][_0x9c06('0x13')]===0x1f4){logger[_0x9c06('0x12')](_0x9c06('0xf'),_0x42cd9c,_0x8b9fcc[_0x9c06('0x12')]['message']);return _0xc1418b(_0x8b9fcc[_0x9c06('0x12')][_0x9c06('0x14')]);}logger['error'](_0x9c06('0xf'),_0x42cd9c,_0x8b9fcc[_0x9c06('0x12')][_0x9c06('0x14')]);return _0x593213(_0x8b9fcc[_0x9c06('0x12')][_0x9c06('0x14')]);}else{logger[_0x9c06('0xe')](_0x9c06('0xf'),_0x42cd9c,_0x9c06('0x15'));_0x593213(_0x8b9fcc['result'][_0x9c06('0x14')]);}})[_0x9c06('0x16')](function(_0x1dffd6){logger[_0x9c06('0x12')](_0x9c06('0xf'),_0x42cd9c,_0x1dffd6);_0xc1418b(_0x1dffd6);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 0d9b333..cdf16ec 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 _0x8771=['delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','put'];(function(_0x10f2dc,_0x3bd93b){var _0x3bbbc6=function(_0x2770dc){while(--_0x2770dc){_0x10f2dc['push'](_0x10f2dc['shift']());}};_0x3bbbc6(++_0x3bd93b);}(_0x8771,0x193));var _0x1877=function(_0x104e21,_0x2ea86f){_0x104e21=_0x104e21-0x0;var _0x605b37=_0x8771[_0x104e21];return _0x605b37;};'use strict';var multer=require(_0x1877('0x0'));var util=require(_0x1877('0x1'));var path=require(_0x1877('0x2'));var timeout=require('connect-timeout');var express=require(_0x1877('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1877('0x4'));var interaction=require(_0x1877('0x5'));var config=require(_0x1877('0x6'));var controller=require('./analyticExtractedReport.controller');router[_0x1877('0x7')]('/',auth[_0x1877('0x8')](),controller['index']);router[_0x1877('0x7')](_0x1877('0x9'),auth[_0x1877('0x8')](),controller[_0x1877('0xa')]);router[_0x1877('0x7')](_0x1877('0xb'),auth[_0x1877('0x8')](),controller['download']);router['post']('/',auth[_0x1877('0x8')](),controller['create']);router[_0x1877('0xc')](_0x1877('0x9'),auth[_0x1877('0x8')](),controller['update']);router[_0x1877('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x1877('0xe')]);module[_0x1877('0xf')]=router; \ No newline at end of file +var _0x34df=['download','post','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id','show','/:id/download'];(function(_0x5a1622,_0x5f0422){var _0x5a3072=function(_0x34d943){while(--_0x34d943){_0x5a1622['push'](_0x5a1622['shift']());}};_0x5a3072(++_0x5f0422);}(_0x34df,0xa2));var _0xf34d=function(_0x5ac1e5,_0x4b5012){_0x5ac1e5=_0x5ac1e5-0x0;var _0x1bccc6=_0x34df[_0x5ac1e5];return _0x1bccc6;};'use strict';var multer=require(_0xf34d('0x0'));var util=require(_0xf34d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf34d('0x2'));var router=express[_0xf34d('0x3')]();var fs_extra=require(_0xf34d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf34d('0x5'));var config=require(_0xf34d('0x6'));var controller=require(_0xf34d('0x7'));router[_0xf34d('0x8')]('/',auth[_0xf34d('0x9')](),controller[_0xf34d('0xa')]);router[_0xf34d('0x8')](_0xf34d('0xb'),auth[_0xf34d('0x9')](),controller[_0xf34d('0xc')]);router[_0xf34d('0x8')](_0xf34d('0xd'),auth['isAuthenticated'](),controller[_0xf34d('0xe')]);router[_0xf34d('0xf')]('/',auth[_0xf34d('0x9')](),controller[_0xf34d('0x10')]);router[_0xf34d('0x11')](_0xf34d('0xb'),auth[_0xf34d('0x9')](),controller[_0xf34d('0x12')]);router[_0xf34d('0x13')](_0xf34d('0xb'),auth['isAuthenticated'](),controller[_0xf34d('0x14')]);module[_0xf34d('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index bdb80f3..e731d16 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 _0xbc83=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0xf411cd,_0x2728a5){var _0xad4726=function(_0x124024){while(--_0x124024){_0xf411cd['push'](_0xf411cd['shift']());}};_0xad4726(++_0x2728a5);}(_0xbc83,0x17a));var _0x3bc8=function(_0x1c92a3,_0x4a196a){_0x1c92a3=_0x1c92a3-0x0;var _0xf30104=_0xbc83[_0x1c92a3];return _0xf30104;};'use strict';var Sequelize=require(_0x3bc8('0x0'));module['exports']={'field':{'type':Sequelize[_0x3bc8('0x1')]},'alias':{'type':Sequelize[_0x3bc8('0x2')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x3bc8('0x2')]},'groupBy':{'type':Sequelize[_0x3bc8('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x3bc8('0x2')]},'custom':{'type':Sequelize[_0x3bc8('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xe7f0=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x5ebf27,_0x4a656f){var _0x55f3ae=function(_0x5a2a58){while(--_0x5a2a58){_0x5ebf27['push'](_0x5ebf27['shift']());}};_0x55f3ae(++_0x4a656f);}(_0xe7f0,0x16a));var _0x0e7f=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0xe7f0[_0x2d4661];return _0x42ed1e;};'use strict';var Sequelize=require(_0x0e7f('0x0'));module[_0x0e7f('0x1')]={'field':{'type':Sequelize[_0x0e7f('0x2')]},'alias':{'type':Sequelize[_0x0e7f('0x3')]},'function':{'type':Sequelize[_0x0e7f('0x3')]},'format':{'type':Sequelize[_0x0e7f('0x3')]},'groupBy':{'type':Sequelize[_0x0e7f('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x0e7f('0x3')]},'custom':{'type':Sequelize[_0x0e7f('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 4ad9a5c..784defb 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 _0x8540=['squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','save','update','then','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','type','key','keys','query','intersection','model','attributes','fields','length','nolimit','limit','order','filters','pick','where','merge','map','VIRTUAL','filter','includeAll','include','findAll','rows','params','options','catch','create','body','bulkCreate','find','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0x29bcab,_0x53a015){var _0x2cb492=function(_0x24ee16){while(--_0x24ee16){_0x29bcab['push'](_0x29bcab['shift']());}};_0x2cb492(++_0x53a015);}(_0x8540,0x148));var _0x0854=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0x8540[_0x221ba2];return _0x47d08e;};'use strict';var emlformat=require(_0x0854('0x0'));var rimraf=require(_0x0854('0x1'));var zipdir=require(_0x0854('0x2'));var jsonpatch=require(_0x0854('0x3'));var rp=require(_0x0854('0x4'));var moment=require('moment');var BPromise=require(_0x0854('0x5'));var Mustache=require(_0x0854('0x6'));var util=require(_0x0854('0x7'));var path=require(_0x0854('0x8'));var sox=require(_0x0854('0x9'));var csv=require('to-csv');var ejs=require(_0x0854('0xa'));var fs=require('fs');var fs_extra=require(_0x0854('0xb'));var _=require('lodash');var squel=require(_0x0854('0xc'));var crypto=require('crypto');var jsforce=require(_0x0854('0xd'));var deskjs=require(_0x0854('0xe'));var toCsv=require(_0x0854('0xf'));var querystring=require(_0x0854('0x10'));var Papa=require(_0x0854('0x11'));var Redis=require('ioredis');var authService=require(_0x0854('0x12'));var qs=require(_0x0854('0x13'));var as=require(_0x0854('0x14'));var hardwareService=require(_0x0854('0x15'));var logger=require(_0x0854('0x16'))(_0x0854('0x17'));var utils=require(_0x0854('0x18'));var config=require(_0x0854('0x19'));var licenseUtil=require(_0x0854('0x1a'));var db=require(_0x0854('0x1b'))['db'];function respondWithStatusCode(_0x3a08ce,_0xca0485){_0xca0485=_0xca0485||0xcc;return function(_0x4e05d4){if(_0x4e05d4){return _0x3a08ce[_0x0854('0x1c')](_0xca0485);}return _0x3a08ce[_0x0854('0x1d')](_0xca0485)[_0x0854('0x1e')]();};}function respondWithResult(_0x3f4caf,_0xddea3f){_0xddea3f=_0xddea3f||0xc8;return function(_0x45fc41){if(_0x45fc41){return _0x3f4caf[_0x0854('0x1d')](_0xddea3f)[_0x0854('0x1f')](_0x45fc41);}};}function respondWithFilteredResult(_0x4d9fe6,_0x5d99ea){return function(_0x634fb3){if(_0x634fb3){var _0x24bd93=typeof _0x5d99ea[_0x0854('0x20')]===_0x0854('0x21')&&typeof _0x5d99ea['limit']===_0x0854('0x21');var _0x5d85cb=_0x634fb3['count'];var _0x3c1bd5=_0x24bd93?0x0:_0x5d99ea[_0x0854('0x20')];var _0x16354c=_0x24bd93?_0x634fb3[_0x0854('0x22')]:_0x5d99ea[_0x0854('0x20')]+_0x5d99ea['limit'];var _0x2dde3e;if(_0x16354c>=_0x5d85cb){_0x16354c=_0x5d85cb;_0x2dde3e=0xc8;}else{_0x2dde3e=0xce;}_0x4d9fe6['status'](_0x2dde3e);return _0x4d9fe6['set'](_0x0854('0x23'),_0x3c1bd5+'-'+_0x16354c+'/'+_0x5d85cb)[_0x0854('0x1f')](_0x634fb3);}return null;};}function patchUpdates(_0x4e3c96){return function(_0x26cb1e){try{jsonpatch['apply'](_0x26cb1e,_0x4e3c96,!![]);}catch(_0x3f2965){return BPromise['reject'](_0x3f2965);}return _0x26cb1e[_0x0854('0x24')]();};}function saveUpdates(_0x10d4ae,_0x4d65c9){return function(_0x4e1929){if(_0x4e1929){return _0x4e1929[_0x0854('0x25')](_0x10d4ae)[_0x0854('0x26')](function(_0x580d33){return _0x580d33;});}return null;};}function removeEntity(_0x46c267,_0x43d08c){return function(_0xf5fb95){if(_0xf5fb95){return _0xf5fb95['destroy']()[_0x0854('0x26')](function(){_0x46c267[_0x0854('0x1d')](0xcc)[_0x0854('0x1e')]();});}};}function handleEntityNotFound(_0x1c290e,_0x3b47c1){return function(_0x3f8fce){if(!_0x3f8fce){_0x1c290e['sendStatus'](0x194);}return _0x3f8fce;};}function handleError(_0x57878f,_0x216b90){_0x216b90=_0x216b90||0x1f4;return function(_0x16a363){logger[_0x0854('0x27')](_0x16a363[_0x0854('0x28')]);if(_0x16a363[_0x0854('0x29')]){delete _0x16a363[_0x0854('0x29')];}_0x57878f[_0x0854('0x1d')](_0x216b90)[_0x0854('0x2a')](_0x16a363);};}exports[_0x0854('0x2b')]=function(_0x456acd,_0x4a2798){var _0x3349c1={},_0x4c5629={},_0x28b399={'count':0x0,'rows':[]};var _0x157cee=_['map'](db[_0x0854('0x2c')][_0x0854('0x2d')],function(_0x540500){return{'name':_0x540500['fieldName'],'type':_0x540500[_0x0854('0x2e')][_0x0854('0x2f')]};});_0x4c5629['model']=_['map'](_0x157cee,_0x0854('0x29'));_0x4c5629['query']=_[_0x0854('0x30')](_0x456acd[_0x0854('0x31')]);_0x4c5629['filters']=_[_0x0854('0x32')](_0x4c5629[_0x0854('0x33')],_0x4c5629[_0x0854('0x31')]);_0x3349c1[_0x0854('0x34')]=_[_0x0854('0x32')](_0x4c5629[_0x0854('0x33')],qs[_0x0854('0x35')](_0x456acd[_0x0854('0x31')]['fields']));_0x3349c1['attributes']=_0x3349c1[_0x0854('0x34')][_0x0854('0x36')]?_0x3349c1[_0x0854('0x34')]:_0x4c5629['model'];if(!_0x456acd['query']['hasOwnProperty'](_0x0854('0x37'))){_0x3349c1[_0x0854('0x38')]=qs[_0x0854('0x38')](_0x456acd[_0x0854('0x31')][_0x0854('0x38')]);_0x3349c1[_0x0854('0x20')]=qs[_0x0854('0x20')](_0x456acd[_0x0854('0x31')][_0x0854('0x20')]);}_0x3349c1[_0x0854('0x39')]=qs['sort'](_0x456acd[_0x0854('0x31')]['sort']);_0x3349c1['where']=qs[_0x0854('0x3a')](_[_0x0854('0x3b')](_0x456acd[_0x0854('0x31')],_0x4c5629[_0x0854('0x3a')]),_0x157cee);if(_0x456acd['query']['filter']){_0x3349c1[_0x0854('0x3c')]=_[_0x0854('0x3d')](_0x3349c1[_0x0854('0x3c')],{'$or':_[_0x0854('0x3e')](_0x157cee,function(_0x47c662){if(_0x47c662[_0x0854('0x2e')]!==_0x0854('0x3f')){var _0x33668f={};_0x33668f[_0x47c662[_0x0854('0x29')]]={'$like':'%'+_0x456acd[_0x0854('0x31')][_0x0854('0x40')]+'%'};return _0x33668f;}})});}_0x3349c1=_['merge']({},_0x3349c1,_0x456acd['options']);var _0x2fb73b={'where':_0x3349c1[_0x0854('0x3c')]};return db[_0x0854('0x2c')]['count'](_0x2fb73b)[_0x0854('0x26')](function(_0x3751e0){_0x28b399[_0x0854('0x22')]=_0x3751e0;if(_0x456acd[_0x0854('0x31')][_0x0854('0x41')]){_0x3349c1[_0x0854('0x42')]=[{'all':!![]}];}return db[_0x0854('0x2c')][_0x0854('0x43')](_0x3349c1);})[_0x0854('0x26')](function(_0x1955ba){_0x28b399[_0x0854('0x44')]=_0x1955ba;return _0x28b399;})[_0x0854('0x26')](respondWithFilteredResult(_0x4a2798,_0x3349c1))['catch'](handleError(_0x4a2798,null));};exports['show']=function(_0x22e486,_0x1214a0){var _0x1f2824={'raw':![],'where':{'id':_0x22e486[_0x0854('0x45')]['id']}},_0x7163f={};_0x7163f[_0x0854('0x33')]=_[_0x0854('0x30')](db[_0x0854('0x2c')][_0x0854('0x2d')]);_0x7163f[_0x0854('0x31')]=_[_0x0854('0x30')](_0x22e486[_0x0854('0x31')]);_0x7163f['filters']=_[_0x0854('0x32')](_0x7163f[_0x0854('0x33')],_0x7163f['query']);_0x1f2824[_0x0854('0x34')]=_[_0x0854('0x32')](_0x7163f[_0x0854('0x33')],qs[_0x0854('0x35')](_0x22e486[_0x0854('0x31')][_0x0854('0x35')]));_0x1f2824[_0x0854('0x34')]=_0x1f2824[_0x0854('0x34')]['length']?_0x1f2824['attributes']:_0x7163f[_0x0854('0x33')];if(_0x22e486['query']['includeAll']){_0x1f2824[_0x0854('0x42')]=[{'all':!![]}];}_0x1f2824=_[_0x0854('0x3d')]({},_0x1f2824,_0x22e486[_0x0854('0x46')]);return db['AnalyticFieldReport']['find'](_0x1f2824)['then'](handleEntityNotFound(_0x1214a0,null))[_0x0854('0x26')](respondWithResult(_0x1214a0,null))[_0x0854('0x47')](handleError(_0x1214a0,null));};exports['create']=function(_0x513131,_0x21accf){return db[_0x0854('0x2c')][_0x0854('0x48')](_0x513131[_0x0854('0x49')],{})['then'](respondWithResult(_0x21accf,0xc9))[_0x0854('0x47')](handleError(_0x21accf,null));};exports['bulkCreate']=function(_0x18d65c,_0x53c150){return db[_0x0854('0x2c')][_0x0854('0x4a')](_0x18d65c[_0x0854('0x49')],{'raw':![],'individualHooks':!![]})[_0x0854('0x26')](respondWithResult(_0x53c150,0xc9))[_0x0854('0x47')](handleError(_0x53c150,null));};exports[_0x0854('0x25')]=function(_0x10d2ff,_0x3de010){if(_0x10d2ff[_0x0854('0x49')]['id']){delete _0x10d2ff[_0x0854('0x49')]['id'];}return db[_0x0854('0x2c')][_0x0854('0x4b')]({'where':{'id':_0x10d2ff[_0x0854('0x45')]['id']}})[_0x0854('0x26')](handleEntityNotFound(_0x3de010,null))[_0x0854('0x26')](saveUpdates(_0x10d2ff['body'],null))['then'](respondWithResult(_0x3de010,null))[_0x0854('0x47')](handleError(_0x3de010,null));};exports['destroy']=function(_0x169907,_0x3d193c){return db[_0x0854('0x2c')][_0x0854('0x4b')]({'where':{'id':_0x169907[_0x0854('0x45')]['id']}})['then'](handleEntityNotFound(_0x3d193c,null))[_0x0854('0x26')](removeEntity(_0x3d193c,null))[_0x0854('0x47')](handleError(_0x3d193c,null));};exports[_0x0854('0x4c')]=function(_0x32b0ed,_0x23091e){return db['AnalyticFieldReport'][_0x0854('0x4d')]({'where':{'id':_0x32b0ed['query'][_0x0854('0x4e')]||[]},'raw':![],'individualHooks':!![]})[_0x0854('0x26')](respondWithResult(_0x23091e,0xcc))['catch'](handleError(_0x23091e,null));};exports[_0x0854('0x4f')]=function(_0x2944dd,_0x4347f7,_0x194919){return db[_0x0854('0x50')][_0x0854('0x51')]({'where':{'id':_0x2944dd[_0x0854('0x45')]['id']}})[_0x0854('0x26')](handleEntityNotFound(_0x4347f7,null))['then'](function(_0x56a843){if(_0x56a843){return db[_0x0854('0x52')][_0x0854('0x53')](function(_0x266cb6){return db[_0x0854('0x2c')]['destroy']({'where':{'CustomReportId':_0x2944dd[_0x0854('0x45')]['id']},'transaction':_0x266cb6})[_0x0854('0x26')](function(_0x52ffb3){var _0x1e11f0=_[_0x0854('0x3e')](_0x2944dd[_0x0854('0x49')],function(_0x19977e){delete _0x19977e['id'];_0x19977e[_0x0854('0x54')]=_0x2944dd[_0x0854('0x45')]['id'];return _0x19977e;});return db[_0x0854('0x2c')][_0x0854('0x4a')](_0x1e11f0,{'transaction':_0x266cb6});});})[_0x0854('0x26')](function(){return db[_0x0854('0x2c')][_0x0854('0x43')]({'where':{'CustomReportId':_0x2944dd[_0x0854('0x45')]['id']}});});}})['then'](respondWithResult(_0x4347f7,null))[_0x0854('0x47')](handleError(_0x4347f7,null));}; \ No newline at end of file +var _0xfbce=['../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','AnalyticFieldReport','key','map','query','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','intersection','merge','find','create','bulkCreate','body','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','CustomReportId','eml-format','zip-dir','request-promise','moment','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5c17ff,_0x36ad7f){var _0x1fa5b7=function(_0x1c14f2){while(--_0x1c14f2){_0x5c17ff['push'](_0x5c17ff['shift']());}};_0x1fa5b7(++_0x36ad7f);}(_0xfbce,0x8d));var _0xefbc=function(_0x542677,_0x2c11c1){_0x542677=_0x542677-0x0;var _0x1026a1=_0xfbce[_0x542677];return _0x1026a1;};'use strict';var emlformat=require(_0xefbc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefbc('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xefbc('0x2'));var moment=require(_0xefbc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xefbc('0x4'));var util=require(_0xefbc('0x5'));var path=require(_0xefbc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xefbc('0x7'));var _=require(_0xefbc('0x8'));var squel=require(_0xefbc('0x9'));var crypto=require(_0xefbc('0xa'));var jsforce=require(_0xefbc('0xb'));var deskjs=require(_0xefbc('0xc'));var toCsv=require(_0xefbc('0xd'));var querystring=require(_0xefbc('0xe'));var Papa=require(_0xefbc('0xf'));var Redis=require(_0xefbc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xefbc('0x11'));var as=require(_0xefbc('0x12'));var hardwareService=require(_0xefbc('0x13'));var logger=require('../../config/logger')(_0xefbc('0x14'));var utils=require(_0xefbc('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xefbc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dc89d,_0x186cda){_0x186cda=_0x186cda||0xcc;return function(_0x13ba94){if(_0x13ba94){return _0x5dc89d[_0xefbc('0x17')](_0x186cda);}return _0x5dc89d[_0xefbc('0x18')](_0x186cda)[_0xefbc('0x19')]();};}function respondWithResult(_0x4b2ae9,_0xb465ad){_0xb465ad=_0xb465ad||0xc8;return function(_0x31c15c){if(_0x31c15c){return _0x4b2ae9[_0xefbc('0x18')](_0xb465ad)[_0xefbc('0x1a')](_0x31c15c);}};}function respondWithFilteredResult(_0x494125,_0x488b36){return function(_0x1e3340){if(_0x1e3340){var _0x4a478c=typeof _0x488b36['offset']===_0xefbc('0x1b')&&typeof _0x488b36[_0xefbc('0x1c')]===_0xefbc('0x1b');var _0x24863d=_0x1e3340['count'];var _0x5122a7=_0x4a478c?0x0:_0x488b36[_0xefbc('0x1d')];var _0x379a56=_0x4a478c?_0x1e3340[_0xefbc('0x1e')]:_0x488b36[_0xefbc('0x1d')]+_0x488b36[_0xefbc('0x1c')];var _0x34d55d;if(_0x379a56>=_0x24863d){_0x379a56=_0x24863d;_0x34d55d=0xc8;}else{_0x34d55d=0xce;}_0x494125[_0xefbc('0x18')](_0x34d55d);return _0x494125[_0xefbc('0x1f')](_0xefbc('0x20'),_0x5122a7+'-'+_0x379a56+'/'+_0x24863d)[_0xefbc('0x1a')](_0x1e3340);}return null;};}function patchUpdates(_0x13ec42){return function(_0x50b89b){try{jsonpatch[_0xefbc('0x21')](_0x50b89b,_0x13ec42,!![]);}catch(_0x286020){return BPromise[_0xefbc('0x22')](_0x286020);}return _0x50b89b[_0xefbc('0x23')]();};}function saveUpdates(_0x1b164f,_0x447695){return function(_0x45c9a1){if(_0x45c9a1){return _0x45c9a1['update'](_0x1b164f)[_0xefbc('0x24')](function(_0x534c9a){return _0x534c9a;});}return null;};}function removeEntity(_0x1d14dc,_0x3bb247){return function(_0x55b744){if(_0x55b744){return _0x55b744[_0xefbc('0x25')]()[_0xefbc('0x24')](function(){_0x1d14dc[_0xefbc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff68c,_0x2abdf7){return function(_0x2018a7){if(!_0x2018a7){_0x4ff68c[_0xefbc('0x17')](0x194);}return _0x2018a7;};}function handleError(_0xea1885,_0x5470c5){_0x5470c5=_0x5470c5||0x1f4;return function(_0x30b35b){logger[_0xefbc('0x26')](_0x30b35b['stack']);if(_0x30b35b[_0xefbc('0x27')]){delete _0x30b35b[_0xefbc('0x27')];}_0xea1885[_0xefbc('0x18')](_0x5470c5)[_0xefbc('0x28')](_0x30b35b);};}exports[_0xefbc('0x29')]=function(_0x44d7d9,_0x4d8708){var _0x21be47={},_0x30a79e={},_0x177f74={'count':0x0,'rows':[]};var _0x4a96f4=_['map'](db[_0xefbc('0x2a')]['rawAttributes'],function(_0x51a56b){return{'name':_0x51a56b['fieldName'],'type':_0x51a56b['type'][_0xefbc('0x2b')]};});_0x30a79e['model']=_[_0xefbc('0x2c')](_0x4a96f4,_0xefbc('0x27'));_0x30a79e['query']=_['keys'](_0x44d7d9[_0xefbc('0x2d')]);_0x30a79e['filters']=_['intersection'](_0x30a79e[_0xefbc('0x2e')],_0x30a79e[_0xefbc('0x2d')]);_0x21be47[_0xefbc('0x2f')]=_['intersection'](_0x30a79e[_0xefbc('0x2e')],qs['fields'](_0x44d7d9['query'][_0xefbc('0x30')]));_0x21be47['attributes']=_0x21be47[_0xefbc('0x2f')][_0xefbc('0x31')]?_0x21be47[_0xefbc('0x2f')]:_0x30a79e['model'];if(!_0x44d7d9[_0xefbc('0x2d')][_0xefbc('0x32')](_0xefbc('0x33'))){_0x21be47[_0xefbc('0x1c')]=qs[_0xefbc('0x1c')](_0x44d7d9[_0xefbc('0x2d')][_0xefbc('0x1c')]);_0x21be47[_0xefbc('0x1d')]=qs['offset'](_0x44d7d9['query'][_0xefbc('0x1d')]);}_0x21be47[_0xefbc('0x34')]=qs[_0xefbc('0x35')](_0x44d7d9[_0xefbc('0x2d')][_0xefbc('0x35')]);_0x21be47[_0xefbc('0x36')]=qs['filters'](_[_0xefbc('0x37')](_0x44d7d9[_0xefbc('0x2d')],_0x30a79e[_0xefbc('0x38')]),_0x4a96f4);if(_0x44d7d9['query'][_0xefbc('0x39')]){_0x21be47[_0xefbc('0x36')]=_['merge'](_0x21be47[_0xefbc('0x36')],{'$or':_[_0xefbc('0x2c')](_0x4a96f4,function(_0x56ad9c){if(_0x56ad9c[_0xefbc('0x3a')]!==_0xefbc('0x3b')){var _0x21755a={};_0x21755a[_0x56ad9c['name']]={'$like':'%'+_0x44d7d9[_0xefbc('0x2d')][_0xefbc('0x39')]+'%'};return _0x21755a;}})});}_0x21be47=_['merge']({},_0x21be47,_0x44d7d9[_0xefbc('0x3c')]);var _0xf6dca1={'where':_0x21be47[_0xefbc('0x36')]};return db[_0xefbc('0x2a')][_0xefbc('0x1e')](_0xf6dca1)['then'](function(_0x3b2026){_0x177f74[_0xefbc('0x1e')]=_0x3b2026;if(_0x44d7d9['query'][_0xefbc('0x3d')]){_0x21be47[_0xefbc('0x3e')]=[{'all':!![]}];}return db[_0xefbc('0x2a')][_0xefbc('0x3f')](_0x21be47);})[_0xefbc('0x24')](function(_0x26c532){_0x177f74[_0xefbc('0x40')]=_0x26c532;return _0x177f74;})[_0xefbc('0x24')](respondWithFilteredResult(_0x4d8708,_0x21be47))[_0xefbc('0x41')](handleError(_0x4d8708,null));};exports['show']=function(_0x478e11,_0x8702c7){var _0x369e39={'raw':![],'where':{'id':_0x478e11[_0xefbc('0x42')]['id']}},_0x2e1e6c={};_0x2e1e6c['model']=_[_0xefbc('0x43')](db['AnalyticFieldReport']['rawAttributes']);_0x2e1e6c[_0xefbc('0x2d')]=_['keys'](_0x478e11['query']);_0x2e1e6c[_0xefbc('0x38')]=_['intersection'](_0x2e1e6c[_0xefbc('0x2e')],_0x2e1e6c[_0xefbc('0x2d')]);_0x369e39[_0xefbc('0x2f')]=_[_0xefbc('0x44')](_0x2e1e6c['model'],qs[_0xefbc('0x30')](_0x478e11['query']['fields']));_0x369e39[_0xefbc('0x2f')]=_0x369e39[_0xefbc('0x2f')][_0xefbc('0x31')]?_0x369e39[_0xefbc('0x2f')]:_0x2e1e6c[_0xefbc('0x2e')];if(_0x478e11[_0xefbc('0x2d')]['includeAll']){_0x369e39[_0xefbc('0x3e')]=[{'all':!![]}];}_0x369e39=_[_0xefbc('0x45')]({},_0x369e39,_0x478e11[_0xefbc('0x3c')]);return db['AnalyticFieldReport'][_0xefbc('0x46')](_0x369e39)[_0xefbc('0x24')](handleEntityNotFound(_0x8702c7,null))[_0xefbc('0x24')](respondWithResult(_0x8702c7,null))[_0xefbc('0x41')](handleError(_0x8702c7,null));};exports[_0xefbc('0x47')]=function(_0x4bd6e1,_0x213334){return db[_0xefbc('0x2a')][_0xefbc('0x47')](_0x4bd6e1['body'],{})[_0xefbc('0x24')](respondWithResult(_0x213334,0xc9))[_0xefbc('0x41')](handleError(_0x213334,null));};exports['bulkCreate']=function(_0x41f476,_0x13e67b){return db[_0xefbc('0x2a')][_0xefbc('0x48')](_0x41f476[_0xefbc('0x49')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x13e67b,0xc9))[_0xefbc('0x41')](handleError(_0x13e67b,null));};exports['update']=function(_0x1f5d24,_0x3165c6){if(_0x1f5d24[_0xefbc('0x49')]['id']){delete _0x1f5d24['body']['id'];}return db[_0xefbc('0x2a')][_0xefbc('0x46')]({'where':{'id':_0x1f5d24[_0xefbc('0x42')]['id']}})['then'](handleEntityNotFound(_0x3165c6,null))[_0xefbc('0x24')](saveUpdates(_0x1f5d24[_0xefbc('0x49')],null))['then'](respondWithResult(_0x3165c6,null))[_0xefbc('0x41')](handleError(_0x3165c6,null));};exports['destroy']=function(_0x552c5a,_0x349908){return db[_0xefbc('0x2a')][_0xefbc('0x46')]({'where':{'id':_0x552c5a[_0xefbc('0x42')]['id']}})['then'](handleEntityNotFound(_0x349908,null))[_0xefbc('0x24')](removeEntity(_0x349908,null))[_0xefbc('0x41')](handleError(_0x349908,null));};exports[_0xefbc('0x4a')]=function(_0x449c71,_0x3bcb87){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x449c71['query'][_0xefbc('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0xefbc('0x24')](respondWithResult(_0x3bcb87,0xcc))[_0xefbc('0x41')](handleError(_0x3bcb87,null));};exports[_0xefbc('0x4c')]=function(_0x165e37,_0x17ed38,_0xf7c414){return db[_0xefbc('0x4d')][_0xefbc('0x4e')]({'where':{'id':_0x165e37[_0xefbc('0x42')]['id']}})[_0xefbc('0x24')](handleEntityNotFound(_0x17ed38,null))['then'](function(_0x158874){if(_0x158874){return db['sequelize']['transaction'](function(_0x1ff5d2){return db[_0xefbc('0x2a')][_0xefbc('0x25')]({'where':{'CustomReportId':_0x165e37['params']['id']},'transaction':_0x1ff5d2})[_0xefbc('0x24')](function(_0x3a12bc){var _0x2e877c=_[_0xefbc('0x2c')](_0x165e37[_0xefbc('0x49')],function(_0x17cceb){delete _0x17cceb['id'];_0x17cceb[_0xefbc('0x4f')]=_0x165e37[_0xefbc('0x42')]['id'];return _0x17cceb;});return db['AnalyticFieldReport']['bulkCreate'](_0x2e877c,{'transaction':_0x1ff5d2});});})['then'](function(){return db[_0xefbc('0x2a')][_0xefbc('0x3f')]({'where':{'CustomReportId':_0x165e37[_0xefbc('0x42')]['id']}});});}})['then'](respondWithResult(_0x17ed38,null))[_0xefbc('0x41')](handleError(_0x17ed38,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 7f73850..4ddb288 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 _0xeb36=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','lodash','util','../../config/logger','moment'];(function(_0x16b32f,_0x758d48){var _0xc94c5b=function(_0x21858e){while(--_0x21858e){_0x16b32f['push'](_0x16b32f['shift']());}};_0xc94c5b(++_0x758d48);}(_0xeb36,0x188));var _0x6eb3=function(_0x22fded,_0x52eb9b){_0x22fded=_0x22fded-0x0;var _0x41fa12=_0xeb36[_0x22fded];return _0x41fa12;};'use strict';var _=require(_0x6eb3('0x0'));var util=require(_0x6eb3('0x1'));var logger=require(_0x6eb3('0x2'))('api');var moment=require(_0x6eb3('0x3'));var BPromise=require(_0x6eb3('0x4'));var rp=require(_0x6eb3('0x5'));var fs=require('fs');var path=require(_0x6eb3('0x6'));var rimraf=require(_0x6eb3('0x7'));var config=require(_0x6eb3('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x6eb3('0x9')]=function(_0x56fcf4,_0x51f707){return _0x56fcf4[_0x6eb3('0xa')](_0x6eb3('0xb'),attributes,{'tableName':'analytics_report_fields','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd591=['rimraf','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x33f902,_0x5ddc80){var _0x11b073=function(_0x309b69){while(--_0x309b69){_0x33f902['push'](_0x33f902['shift']());}};_0x11b073(++_0x5ddc80);}(_0xd591,0xe2));var _0x1d59=function(_0x57c64e,_0x28e189){_0x57c64e=_0x57c64e-0x0;var _0x1780ea=_0xd591[_0x57c64e];return _0x1780ea;};'use strict';var _=require('lodash');var util=require(_0x1d59('0x0'));var logger=require(_0x1d59('0x1'))('api');var moment=require(_0x1d59('0x2'));var BPromise=require(_0x1d59('0x3'));var rp=require(_0x1d59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d59('0x5'));var config=require('../../config/environment');var attributes=require(_0x1d59('0x6'));module[_0x1d59('0x7')]=function(_0x517555,_0x4f15f0){return _0x517555[_0x1d59('0x8')](_0x1d59('0x9'),attributes,{'tableName':_0x1d59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 70162d8..75d78b0 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 _0xb187=['debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x9978d7,_0x118396){var _0x325558=function(_0x1007af){while(--_0x1007af){_0x9978d7['push'](_0x9978d7['shift']());}};_0x325558(++_0x118396);}(_0xb187,0x161));var _0x7b18=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0xb187[_0x4b775b];return _0xf84d39;};'use strict';var _=require(_0x7b18('0x0'));var util=require(_0x7b18('0x1'));var moment=require(_0x7b18('0x2'));var BPromise=require('bluebird');var rs=require(_0x7b18('0x3'));var fs=require('fs');var Redis=require(_0x7b18('0x4'));var db=require(_0x7b18('0x5'))['db'];var utils=require(_0x7b18('0x6'));var logger=require(_0x7b18('0x7'))(_0x7b18('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7b18('0x9')][_0x7b18('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4017a6,_0x28f986,_0x3a11b4){return new BPromise(function(_0x49fce9,_0x2a5ecb){return client[_0x7b18('0xb')](_0x4017a6,_0x3a11b4)[_0x7b18('0xc')](function(_0x2e73c7){logger[_0x7b18('0xd')](_0x7b18('0xe'),_0x28f986,'request\x20sent');logger[_0x7b18('0xf')]('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x28f986,'request\x20sent',JSON[_0x7b18('0x10')](_0x2e73c7));if(_0x2e73c7[_0x7b18('0x11')]){if(_0x2e73c7[_0x7b18('0x11')][_0x7b18('0x12')]===0x1f4){logger['error'](_0x7b18('0xe'),_0x28f986,_0x2e73c7[_0x7b18('0x11')][_0x7b18('0x13')]);return _0x2a5ecb(_0x2e73c7['error'][_0x7b18('0x13')]);}logger['error'](_0x7b18('0xe'),_0x28f986,_0x2e73c7['error'][_0x7b18('0x13')]);return _0x49fce9(_0x2e73c7[_0x7b18('0x11')][_0x7b18('0x13')]);}else{logger[_0x7b18('0xd')](_0x7b18('0xe'),_0x28f986,_0x7b18('0x14'));_0x49fce9(_0x2e73c7[_0x7b18('0x15')][_0x7b18('0x13')]);}})[_0x7b18('0x16')](function(_0x20148e){logger['error'](_0x7b18('0xe'),_0x28f986,_0x20148e);_0x2a5ecb(_0x20148e);});});} \ No newline at end of file +var _0x1b61=['AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info'];(function(_0x36828e,_0x1e401c){var _0x129fe3=function(_0x43c656){while(--_0x43c656){_0x36828e['push'](_0x36828e['shift']());}};_0x129fe3(++_0x1e401c);}(_0x1b61,0x15c));var _0x11b6=function(_0x22e746,_0x3337fe){_0x22e746=_0x22e746-0x0;var _0xc15f81=_0x1b61[_0x22e746];return _0xc15f81;};'use strict';var _=require(_0x11b6('0x0'));var util=require('util');var moment=require(_0x11b6('0x1'));var BPromise=require(_0x11b6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x11b6('0x3'))['db'];var utils=require(_0x11b6('0x4'));var logger=require(_0x11b6('0x5'))(_0x11b6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x11b6('0x7')][_0x11b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10928c,_0x5913c9,_0x304c3b){return new BPromise(function(_0x2b3bb3,_0x4bcac0){return client[_0x11b6('0x9')](_0x10928c,_0x304c3b)[_0x11b6('0xa')](function(_0x47c946){logger[_0x11b6('0xb')](_0x11b6('0xc'),_0x5913c9,_0x11b6('0xd'));logger[_0x11b6('0xe')](_0x11b6('0xf'),_0x5913c9,_0x11b6('0xd'),JSON['stringify'](_0x47c946));if(_0x47c946[_0x11b6('0x10')]){if(_0x47c946[_0x11b6('0x10')][_0x11b6('0x11')]===0x1f4){logger[_0x11b6('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x5913c9,_0x47c946['error'][_0x11b6('0x12')]);return _0x4bcac0(_0x47c946[_0x11b6('0x10')][_0x11b6('0x12')]);}logger[_0x11b6('0x10')](_0x11b6('0xc'),_0x5913c9,_0x47c946[_0x11b6('0x10')][_0x11b6('0x12')]);return _0x2b3bb3(_0x47c946[_0x11b6('0x10')][_0x11b6('0x12')]);}else{logger[_0x11b6('0xb')](_0x11b6('0xc'),_0x5913c9,_0x11b6('0xd'));_0x2b3bb3(_0x47c946['result'][_0x11b6('0x12')]);}})[_0x11b6('0x13')](function(_0x3e03e0){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x5913c9,_0x3e03e0);_0x4bcac0(_0x3e03e0);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2d86350..f21d734 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(_0x51303b,_0x4f7b7e){var _0x5b255f=function(_0x37d89d){while(--_0x37d89d){_0x51303b['push'](_0x51303b['shift']());}};_0x5b255f(++_0x4f7b7e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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(_0x1f41c0,_0x2fe473){var _0x339a12=function(_0x2112cb){while(--_0x2112cb){_0x1f41c0['push'](_0x1f41c0['shift']());}};_0x339a12(++_0x2fe473);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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 5461101..3ad1b9e 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 _0xc5c0=['sequelize','exports','STRING','TEXT'];(function(_0x4533a6,_0x4794c9){var _0x25bffa=function(_0x2cd4f3){while(--_0x2cd4f3){_0x4533a6['push'](_0x4533a6['shift']());}};_0x25bffa(++_0x4794c9);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x4d0bd1,_0x2f6c78){_0x4d0bd1=_0x4d0bd1-0x0;var _0x45abb0=_0xc5c0[_0x4d0bd1];return _0x45abb0;};'use strict';var Sequelize=require(_0x0c5c('0x0'));module[_0x0c5c('0x1')]={'name':{'type':Sequelize[_0x0c5c('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x0c5c('0x3')]},'description':{'type':Sequelize[_0x0c5c('0x2')]}}; \ No newline at end of file +var _0x8aa7=['name','TEXT','exports','STRING'];(function(_0x597a43,_0x491124){var _0x4b7c2c=function(_0x47460d){while(--_0x47460d){_0x597a43['push'](_0x597a43['shift']());}};_0x4b7c2c(++_0x491124);}(_0x8aa7,0xb6));var _0x78aa=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x8aa7[_0x403c20];return _0x2b271a;};'use strict';var Sequelize=require('sequelize');module[_0x78aa('0x0')]={'name':{'type':Sequelize[_0x78aa('0x1')],'allowNull':![],'unique':_0x78aa('0x2')},'table':{'type':Sequelize[_0x78aa('0x1')]},'metric':{'type':Sequelize[_0x78aa('0x3')]},'description':{'type':Sequelize[_0x78aa('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 2b43bd9..eaaccd5 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 _0x7fbe=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','AnalyticMetric','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','rows','show','params','create','body','role','user','Metrics','find','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x2e6b16,_0x31c2fb){var _0x185c18=function(_0x52fd7d){while(--_0x52fd7d){_0x2e6b16['push'](_0x2e6b16['shift']());}};_0x185c18(++_0x31c2fb);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x369829,_0x5149ad){_0x369829=_0x369829-0x0;var _0xb9c603=_0x7fbe[_0x369829];return _0xb9c603;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7fb('0x0'));var jsonpatch=require(_0xe7fb('0x1'));var rp=require(_0xe7fb('0x2'));var moment=require(_0xe7fb('0x3'));var BPromise=require(_0xe7fb('0x4'));var Mustache=require(_0xe7fb('0x5'));var util=require(_0xe7fb('0x6'));var path=require(_0xe7fb('0x7'));var sox=require(_0xe7fb('0x8'));var csv=require(_0xe7fb('0x9'));var ejs=require(_0xe7fb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7fb('0xb'));var _=require(_0xe7fb('0xc'));var squel=require(_0xe7fb('0xd'));var crypto=require('crypto');var jsforce=require(_0xe7fb('0xe'));var deskjs=require(_0xe7fb('0xf'));var toCsv=require(_0xe7fb('0x9'));var querystring=require(_0xe7fb('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe7fb('0x11'));var qs=require(_0xe7fb('0x12'));var as=require(_0xe7fb('0x13'));var hardwareService=require(_0xe7fb('0x14'));var logger=require(_0xe7fb('0x15'))(_0xe7fb('0x16'));var utils=require(_0xe7fb('0x17'));var config=require(_0xe7fb('0x18'));var licenseUtil=require(_0xe7fb('0x19'));var db=require(_0xe7fb('0x1a'))['db'];function respondWithStatusCode(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xcc;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0x1b')](_0x188e1d);}return _0x2437d4[_0xe7fb('0x1c')](_0x188e1d)['end']();};}function respondWithResult(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0xc8;return function(_0x5573ab){if(_0x5573ab){return _0x278b75[_0xe7fb('0x1c')](_0x2225e5)[_0xe7fb('0x1d')](_0x5573ab);}};}function respondWithFilteredResult(_0x482f7d,_0xa76acf){return function(_0x559129){if(_0x559129){var _0x12fff6=typeof _0xa76acf[_0xe7fb('0x1e')]===_0xe7fb('0x1f')&&typeof _0xa76acf[_0xe7fb('0x20')]==='undefined';var _0x892b0f=_0x559129['count'];var _0x293a47=_0x12fff6?0x0:_0xa76acf['offset'];var _0x1e77fd=_0x12fff6?_0x559129[_0xe7fb('0x21')]:_0xa76acf[_0xe7fb('0x1e')]+_0xa76acf[_0xe7fb('0x20')];var _0x5df1a1;if(_0x1e77fd>=_0x892b0f){_0x1e77fd=_0x892b0f;_0x5df1a1=0xc8;}else{_0x5df1a1=0xce;}_0x482f7d[_0xe7fb('0x1c')](_0x5df1a1);return _0x482f7d['set'](_0xe7fb('0x22'),_0x293a47+'-'+_0x1e77fd+'/'+_0x892b0f)['json'](_0x559129);}return null;};}function patchUpdates(_0x15f7a4){return function(_0x4ea664){try{jsonpatch[_0xe7fb('0x23')](_0x4ea664,_0x15f7a4,!![]);}catch(_0x135624){return BPromise['reject'](_0x135624);}return _0x4ea664[_0xe7fb('0x24')]();};}function saveUpdates(_0x4742bd,_0x3ae8f1){return function(_0x4dcb4b){if(_0x4dcb4b){return _0x4dcb4b[_0xe7fb('0x25')](_0x4742bd)[_0xe7fb('0x26')](function(_0x5da3d9){return _0x5da3d9;});}return null;};}function removeEntity(_0x5bea27,_0x52f08b){return function(_0x35e4db){if(_0x35e4db){return _0x35e4db['destroy']()['then'](function(){var _0x4026b1=_0x35e4db[_0xe7fb('0x27')]({'plain':!![]});var _0x2996ae='Metrics';return db[_0xe7fb('0x28')][_0xe7fb('0x29')]({'where':{'type':_0x2996ae,'resourceId':_0x4026b1['id']}})[_0xe7fb('0x26')](function(){return _0x35e4db;});})[_0xe7fb('0x26')](function(){_0x5bea27[_0xe7fb('0x1c')](0xcc)[_0xe7fb('0x2a')]();});}};}function handleEntityNotFound(_0x380130,_0x59e015){return function(_0x5df9f2){if(!_0x5df9f2){_0x380130[_0xe7fb('0x1b')](0x194);}return _0x5df9f2;};}function handleError(_0x3bdee9,_0xead63){_0xead63=_0xead63||0x1f4;return function(_0x4fd290){logger[_0xe7fb('0x2b')](_0x4fd290[_0xe7fb('0x2c')]);if(_0x4fd290[_0xe7fb('0x2d')]){delete _0x4fd290[_0xe7fb('0x2d')];}_0x3bdee9[_0xe7fb('0x1c')](_0xead63)[_0xe7fb('0x2e')](_0x4fd290);};}exports[_0xe7fb('0x2f')]=function(_0x3dd0be,_0x4ce993){var _0x3d1fb5={},_0x1742f3={},_0x29d1ca={'count':0x0,'rows':[]};var _0x547a04=_['map'](db[_0xe7fb('0x30')]['rawAttributes'],function(_0xac56b4){return{'name':_0xac56b4[_0xe7fb('0x31')],'type':_0xac56b4[_0xe7fb('0x32')][_0xe7fb('0x33')]};});_0x1742f3['model']=_[_0xe7fb('0x34')](_0x547a04,_0xe7fb('0x2d'));_0x1742f3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x3dd0be[_0xe7fb('0x35')]);_0x1742f3['filters']=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],_0x1742f3[_0xe7fb('0x35')]);_0x3d1fb5[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x1742f3[_0xe7fb('0x38')],qs[_0xe7fb('0x3a')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3a')]));_0x3d1fb5['attributes']=_0x3d1fb5[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x3d1fb5[_0xe7fb('0x39')]:_0x1742f3['model'];if(!_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3c')](_0xe7fb('0x3d'))){_0x3d1fb5[_0xe7fb('0x20')]=qs[_0xe7fb('0x20')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x20')]);_0x3d1fb5[_0xe7fb('0x1e')]=qs[_0xe7fb('0x1e')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x1e')]);}_0x3d1fb5[_0xe7fb('0x3e')]=qs[_0xe7fb('0x3f')](_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x3f')]);_0x3d1fb5[_0xe7fb('0x40')]=qs[_0xe7fb('0x41')](_[_0xe7fb('0x42')](_0x3dd0be[_0xe7fb('0x35')],_0x1742f3['filters']),_0x547a04);if(_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]){_0x3d1fb5[_0xe7fb('0x40')]=_[_0xe7fb('0x44')](_0x3d1fb5['where'],{'$or':_[_0xe7fb('0x34')](_0x547a04,function(_0x186418){if(_0x186418[_0xe7fb('0x32')]!==_0xe7fb('0x45')){var _0x49fe9d={};_0x49fe9d[_0x186418[_0xe7fb('0x2d')]]={'$like':'%'+_0x3dd0be[_0xe7fb('0x35')][_0xe7fb('0x43')]+'%'};return _0x49fe9d;}})});}_0x3d1fb5=_[_0xe7fb('0x44')]({},_0x3d1fb5,_0x3dd0be[_0xe7fb('0x46')]);var _0xb729fc={'where':_0x3d1fb5['where']};return db[_0xe7fb('0x30')][_0xe7fb('0x21')](_0xb729fc)[_0xe7fb('0x26')](function(_0x4b263d){_0x29d1ca[_0xe7fb('0x21')]=_0x4b263d;if(_0x3dd0be[_0xe7fb('0x35')]['includeAll']){_0x3d1fb5['include']=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x3d1fb5);})['then'](function(_0x900d67){_0x29d1ca[_0xe7fb('0x47')]=_0x900d67;return _0x29d1ca;})[_0xe7fb('0x26')](respondWithFilteredResult(_0x4ce993,_0x3d1fb5))['catch'](handleError(_0x4ce993,null));};exports[_0xe7fb('0x48')]=function(_0x58d743,_0x19277f){var _0x32cfa4={'raw':!![],'where':{'id':_0x58d743[_0xe7fb('0x49')]['id']}},_0x4d29d3={};_0x4d29d3[_0xe7fb('0x38')]=_[_0xe7fb('0x36')](db[_0xe7fb('0x30')]['rawAttributes']);_0x4d29d3[_0xe7fb('0x35')]=_[_0xe7fb('0x36')](_0x58d743[_0xe7fb('0x35')]);_0x4d29d3['filters']=_[_0xe7fb('0x37')](_0x4d29d3[_0xe7fb('0x38')],_0x4d29d3[_0xe7fb('0x35')]);_0x32cfa4[_0xe7fb('0x39')]=_[_0xe7fb('0x37')](_0x4d29d3['model'],qs[_0xe7fb('0x3a')](_0x58d743['query'][_0xe7fb('0x3a')]));_0x32cfa4[_0xe7fb('0x39')]=_0x32cfa4[_0xe7fb('0x39')][_0xe7fb('0x3b')]?_0x32cfa4[_0xe7fb('0x39')]:_0x4d29d3['model'];if(_0x58d743[_0xe7fb('0x35')]['includeAll']){_0x32cfa4['include']=[{'all':!![]}];}_0x32cfa4=_[_0xe7fb('0x44')]({},_0x32cfa4,_0x58d743[_0xe7fb('0x46')]);return db[_0xe7fb('0x30')]['find'](_0x32cfa4)[_0xe7fb('0x26')](handleEntityNotFound(_0x19277f,null))[_0xe7fb('0x26')](respondWithResult(_0x19277f,null))['catch'](handleError(_0x19277f,null));};exports['create']=function(_0x284bcb,_0x42270b){return db[_0xe7fb('0x30')][_0xe7fb('0x4a')](_0x284bcb[_0xe7fb('0x4b')],{})[_0xe7fb('0x26')](function(_0x18a590){var _0x347177=_0x284bcb['user'][_0xe7fb('0x27')]({'plain':!![]});if(!_0x347177)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x347177[_0xe7fb('0x4c')]===_0xe7fb('0x4d')){var _0x5cedfb=_0x18a590[_0xe7fb('0x27')]({'plain':!![]});var _0x5efd24=_0xe7fb('0x4e');return db['UserProfileSection'][_0xe7fb('0x4f')]({'where':{'name':_0x5efd24,'userProfileId':_0x347177['userProfileId']},'raw':!![]})[_0xe7fb('0x26')](function(_0x59158c){if(_0x59158c&&_0x59158c[_0xe7fb('0x50')]===0x0){return db[_0xe7fb('0x28')][_0xe7fb('0x4a')]({'name':_0x5cedfb[_0xe7fb('0x2d')],'resourceId':_0x5cedfb['id'],'type':_0x59158c[_0xe7fb('0x2d')],'sectionId':_0x59158c['id']},{})[_0xe7fb('0x26')](function(){return _0x18a590;});}else{return _0x18a590;}})[_0xe7fb('0x51')](function(_0x582a4a){logger['error'](_0xe7fb('0x52'),_0x582a4a);throw _0x582a4a;});}return _0x18a590;})['then'](respondWithResult(_0x42270b,0xc9))['catch'](handleError(_0x42270b,null));};exports['update']=function(_0x50b8df,_0x539252){if(_0x50b8df[_0xe7fb('0x4b')]['id']){delete _0x50b8df[_0xe7fb('0x4b')]['id'];}return db[_0xe7fb('0x30')][_0xe7fb('0x4f')]({'where':{'id':_0x50b8df['params']['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x539252,null))[_0xe7fb('0x26')](saveUpdates(_0x50b8df[_0xe7fb('0x4b')],null))['then'](respondWithResult(_0x539252,null))['catch'](handleError(_0x539252,null));};exports[_0xe7fb('0x29')]=function(_0x377e5f,_0x300b8e){return db['AnalyticMetric'][_0xe7fb('0x4f')]({'where':{'id':_0x377e5f[_0xe7fb('0x49')]['id']}})[_0xe7fb('0x26')](handleEntityNotFound(_0x300b8e,null))[_0xe7fb('0x26')](removeEntity(_0x300b8e,null))['catch'](handleError(_0x300b8e,null));}; \ No newline at end of file +var _0x81bd=['filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','AnalyticMetric','includeAll','include','findAll','rows','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','Metrics','stack','name','send','index','map','fieldName','query','keys'];(function(_0x56f9f8,_0x28498e){var _0x9728f3=function(_0x4c9295){while(--_0x4c9295){_0x56f9f8['push'](_0x56f9f8['shift']());}};_0x9728f3(++_0x28498e);}(_0x81bd,0x7c));var _0xd81b=function(_0x38af13,_0x3949a1){_0x38af13=_0x38af13-0x0;var _0x56a221=_0x81bd[_0x38af13];return _0x56a221;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x21dfff,_0x57f71d){_0x57f71d=_0x57f71d||0xcc;return function(_0x3f2405){if(_0x3f2405){return _0x21dfff[_0xd81b('0x1b')](_0x57f71d);}return _0x21dfff['status'](_0x57f71d)[_0xd81b('0x1c')]();};}function respondWithResult(_0x47dd04,_0x13dd00){_0x13dd00=_0x13dd00||0xc8;return function(_0x41bf7a){if(_0x41bf7a){return _0x47dd04[_0xd81b('0x1d')](_0x13dd00)[_0xd81b('0x1e')](_0x41bf7a);}};}function respondWithFilteredResult(_0x128162,_0x552215){return function(_0x1c620d){if(_0x1c620d){var _0x27b7a0=typeof _0x552215['offset']===_0xd81b('0x1f')&&typeof _0x552215[_0xd81b('0x20')]===_0xd81b('0x1f');var _0x15e860=_0x1c620d[_0xd81b('0x21')];var _0xc49b8d=_0x27b7a0?0x0:_0x552215[_0xd81b('0x22')];var _0x3d4d34=_0x27b7a0?_0x1c620d[_0xd81b('0x21')]:_0x552215[_0xd81b('0x22')]+_0x552215[_0xd81b('0x20')];var _0x453952;if(_0x3d4d34>=_0x15e860){_0x3d4d34=_0x15e860;_0x453952=0xc8;}else{_0x453952=0xce;}_0x128162[_0xd81b('0x1d')](_0x453952);return _0x128162[_0xd81b('0x23')](_0xd81b('0x24'),_0xc49b8d+'-'+_0x3d4d34+'/'+_0x15e860)[_0xd81b('0x1e')](_0x1c620d);}return null;};}function patchUpdates(_0x5f101a){return function(_0x4d566e){try{jsonpatch[_0xd81b('0x25')](_0x4d566e,_0x5f101a,!![]);}catch(_0x1b7876){return BPromise[_0xd81b('0x26')](_0x1b7876);}return _0x4d566e['save']();};}function saveUpdates(_0x19ed0e,_0x6571a6){return function(_0x542ee2){if(_0x542ee2){return _0x542ee2[_0xd81b('0x27')](_0x19ed0e)[_0xd81b('0x28')](function(_0x1670cd){return _0x1670cd;});}return null;};}function removeEntity(_0x1ad65c,_0x279176){return function(_0xcb4f91){if(_0xcb4f91){return _0xcb4f91[_0xd81b('0x29')]()[_0xd81b('0x28')](function(){var _0x341aec=_0xcb4f91[_0xd81b('0x2a')]({'plain':!![]});var _0x2ccedf=_0xd81b('0x2b');return db['UserProfileResource'][_0xd81b('0x29')]({'where':{'type':_0x2ccedf,'resourceId':_0x341aec['id']}})[_0xd81b('0x28')](function(){return _0xcb4f91;});})[_0xd81b('0x28')](function(){_0x1ad65c[_0xd81b('0x1d')](0xcc)[_0xd81b('0x1c')]();});}};}function handleEntityNotFound(_0x2d0d02,_0x3e28dd){return function(_0x73dc09){if(!_0x73dc09){_0x2d0d02[_0xd81b('0x1b')](0x194);}return _0x73dc09;};}function handleError(_0x483a3d,_0x469cc4){_0x469cc4=_0x469cc4||0x1f4;return function(_0x4e2eff){logger['error'](_0x4e2eff[_0xd81b('0x2c')]);if(_0x4e2eff[_0xd81b('0x2d')]){delete _0x4e2eff['name'];}_0x483a3d['status'](_0x469cc4)[_0xd81b('0x2e')](_0x4e2eff);};}exports[_0xd81b('0x2f')]=function(_0x1b1434,_0x289f54){var _0x1a1572={},_0x4654ba={},_0x5527ed={'count':0x0,'rows':[]};var _0x37d381=_[_0xd81b('0x30')](db['AnalyticMetric']['rawAttributes'],function(_0x165892){return{'name':_0x165892[_0xd81b('0x31')],'type':_0x165892['type']['key']};});_0x4654ba['model']=_[_0xd81b('0x30')](_0x37d381,_0xd81b('0x2d'));_0x4654ba[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x1b1434[_0xd81b('0x32')]);_0x4654ba[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x4654ba['model'],_0x4654ba[_0xd81b('0x32')]);_0x1a1572['attributes']=_[_0xd81b('0x35')](_0x4654ba[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x37')]));_0x1a1572[_0xd81b('0x38')]=_0x1a1572[_0xd81b('0x38')][_0xd81b('0x39')]?_0x1a1572[_0xd81b('0x38')]:_0x4654ba[_0xd81b('0x36')];if(!_0x1b1434[_0xd81b('0x32')][_0xd81b('0x3a')](_0xd81b('0x3b'))){_0x1a1572['limit']=qs['limit'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x20')]);_0x1a1572[_0xd81b('0x22')]=qs['offset'](_0x1b1434[_0xd81b('0x32')][_0xd81b('0x22')]);}_0x1a1572['order']=qs[_0xd81b('0x3c')](_0x1b1434[_0xd81b('0x32')]['sort']);_0x1a1572[_0xd81b('0x3d')]=qs['filters'](_[_0xd81b('0x3e')](_0x1b1434[_0xd81b('0x32')],_0x4654ba[_0xd81b('0x34')]),_0x37d381);if(_0x1b1434[_0xd81b('0x32')]['filter']){_0x1a1572[_0xd81b('0x3d')]=_[_0xd81b('0x3f')](_0x1a1572[_0xd81b('0x3d')],{'$or':_[_0xd81b('0x30')](_0x37d381,function(_0x3abd60){if(_0x3abd60[_0xd81b('0x40')]!==_0xd81b('0x41')){var _0x532ada={};_0x532ada[_0x3abd60[_0xd81b('0x2d')]]={'$like':'%'+_0x1b1434[_0xd81b('0x32')][_0xd81b('0x42')]+'%'};return _0x532ada;}})});}_0x1a1572=_['merge']({},_0x1a1572,_0x1b1434[_0xd81b('0x43')]);var _0x3a05f4={'where':_0x1a1572[_0xd81b('0x3d')]};return db[_0xd81b('0x44')][_0xd81b('0x21')](_0x3a05f4)['then'](function(_0x3dfba7){_0x5527ed[_0xd81b('0x21')]=_0x3dfba7;if(_0x1b1434[_0xd81b('0x32')][_0xd81b('0x45')]){_0x1a1572[_0xd81b('0x46')]=[{'all':!![]}];}return db[_0xd81b('0x44')][_0xd81b('0x47')](_0x1a1572);})[_0xd81b('0x28')](function(_0x4405a8){_0x5527ed[_0xd81b('0x48')]=_0x4405a8;return _0x5527ed;})[_0xd81b('0x28')](respondWithFilteredResult(_0x289f54,_0x1a1572))['catch'](handleError(_0x289f54,null));};exports[_0xd81b('0x49')]=function(_0x2778b3,_0x25824e){var _0xa5e391={'raw':!![],'where':{'id':_0x2778b3[_0xd81b('0x4a')]['id']}},_0x1e6654={};_0x1e6654[_0xd81b('0x36')]=_[_0xd81b('0x33')](db['AnalyticMetric']['rawAttributes']);_0x1e6654[_0xd81b('0x32')]=_[_0xd81b('0x33')](_0x2778b3[_0xd81b('0x32')]);_0x1e6654[_0xd81b('0x34')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],_0x1e6654[_0xd81b('0x32')]);_0xa5e391[_0xd81b('0x38')]=_[_0xd81b('0x35')](_0x1e6654[_0xd81b('0x36')],qs[_0xd81b('0x37')](_0x2778b3[_0xd81b('0x32')]['fields']));_0xa5e391[_0xd81b('0x38')]=_0xa5e391[_0xd81b('0x38')][_0xd81b('0x39')]?_0xa5e391[_0xd81b('0x38')]:_0x1e6654[_0xd81b('0x36')];if(_0x2778b3[_0xd81b('0x32')][_0xd81b('0x45')]){_0xa5e391[_0xd81b('0x46')]=[{'all':!![]}];}_0xa5e391=_[_0xd81b('0x3f')]({},_0xa5e391,_0x2778b3['options']);return db[_0xd81b('0x44')][_0xd81b('0x4b')](_0xa5e391)[_0xd81b('0x28')](handleEntityNotFound(_0x25824e,null))[_0xd81b('0x28')](respondWithResult(_0x25824e,null))['catch'](handleError(_0x25824e,null));};exports[_0xd81b('0x4c')]=function(_0x151127,_0x15030b){return db[_0xd81b('0x44')][_0xd81b('0x4c')](_0x151127[_0xd81b('0x4d')],{})[_0xd81b('0x28')](function(_0x43d7ce){var _0x133a76=_0x151127['user']['get']({'plain':!![]});if(!_0x133a76)throw new Error(_0xd81b('0x4e'));if(_0x133a76[_0xd81b('0x4f')]===_0xd81b('0x50')){var _0x4da281=_0x43d7ce[_0xd81b('0x2a')]({'plain':!![]});var _0x3d6ab3=_0xd81b('0x2b');return db[_0xd81b('0x51')]['find']({'where':{'name':_0x3d6ab3,'userProfileId':_0x133a76[_0xd81b('0x52')]},'raw':!![]})[_0xd81b('0x28')](function(_0x1b523c){if(_0x1b523c&&_0x1b523c[_0xd81b('0x53')]===0x0){return db[_0xd81b('0x54')]['create']({'name':_0x4da281[_0xd81b('0x2d')],'resourceId':_0x4da281['id'],'type':_0x1b523c[_0xd81b('0x2d')],'sectionId':_0x1b523c['id']},{})['then'](function(){return _0x43d7ce;});}else{return _0x43d7ce;}})[_0xd81b('0x55')](function(_0x315bd5){logger[_0xd81b('0x56')](_0xd81b('0x57'),_0x315bd5);throw _0x315bd5;});}return _0x43d7ce;})[_0xd81b('0x28')](respondWithResult(_0x15030b,0xc9))[_0xd81b('0x55')](handleError(_0x15030b,null));};exports[_0xd81b('0x27')]=function(_0x22f588,_0x3ed626){if(_0x22f588[_0xd81b('0x4d')]['id']){delete _0x22f588[_0xd81b('0x4d')]['id'];}return db['AnalyticMetric'][_0xd81b('0x4b')]({'where':{'id':_0x22f588['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x3ed626,null))[_0xd81b('0x28')](saveUpdates(_0x22f588[_0xd81b('0x4d')],null))[_0xd81b('0x28')](respondWithResult(_0x3ed626,null))[_0xd81b('0x55')](handleError(_0x3ed626,null));};exports[_0xd81b('0x29')]=function(_0x5c196a,_0x2d978d){return db[_0xd81b('0x44')]['find']({'where':{'id':_0x5c196a['params']['id']}})[_0xd81b('0x28')](handleEntityNotFound(_0x2d978d,null))['then'](removeEntity(_0x2d978d,null))[_0xd81b('0x55')](handleError(_0x2d978d,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 6d794ff..d823a31 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 _0x9206=['lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','AnalyticMetric','analytics_metrics'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x9206,0x176));var _0x6920=function(_0x55efaf,_0x17d618){_0x55efaf=_0x55efaf-0x0;var _0x207bd2=_0x9206[_0x55efaf];return _0x207bd2;};'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('./analyticMetric.attributes');module['exports']=function(_0x41c8c4,_0x4d67d7){return _0x41c8c4[_0x6920('0x8')](_0x6920('0x9'),attributes,{'tableName':_0x6920('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x90ec=['lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./analyticMetric.attributes','exports','AnalyticMetric','analytics_metrics'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0x90ec,0x1d4));var _0xc90e=function(_0x4892f8,_0x26e8ff){_0x4892f8=_0x4892f8-0x0;var _0x524e2f=_0x90ec[_0x4892f8];return _0x524e2f;};'use strict';var _=require(_0xc90e('0x0'));var util=require(_0xc90e('0x1'));var logger=require('../../config/logger')(_0xc90e('0x2'));var moment=require(_0xc90e('0x3'));var BPromise=require(_0xc90e('0x4'));var rp=require(_0xc90e('0x5'));var fs=require('fs');var path=require(_0xc90e('0x6'));var rimraf=require('rimraf');var config=require(_0xc90e('0x7'));var attributes=require(_0xc90e('0x8'));module[_0xc90e('0x9')]=function(_0x54a0a8,_0x259c62){return _0x54a0a8['define'](_0xc90e('0xa'),attributes,{'tableName':_0xc90e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 046d429..ef60029 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 _0x05a7=['../../config/logger','rpc','../../config/environment','http','request','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','AnalyticMetric,\x20%s,\x20%s','message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x3a723e,_0x59d99a){var _0x3e9c03=function(_0x4a6947){while(--_0x4a6947){_0x3a723e['push'](_0x3a723e['shift']());}};_0x3e9c03(++_0x59d99a);}(_0x05a7,0x113));var _0x705a=function(_0x5cfb92,_0x5797e6){_0x5cfb92=_0x5cfb92-0x0;var _0x1cd7c2=_0x05a7[_0x5cfb92];return _0x1cd7c2;};'use strict';var _=require(_0x705a('0x0'));var util=require('util');var moment=require(_0x705a('0x1'));var BPromise=require(_0x705a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x705a('0x3'))['db'];var utils=require(_0x705a('0x4'));var logger=require(_0x705a('0x5'))(_0x705a('0x6'));var config=require(_0x705a('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x705a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x398f75,_0x4a953e,_0x27eb98){return new BPromise(function(_0x5a9bd0,_0x57f622){return client[_0x705a('0x9')](_0x398f75,_0x27eb98)['then'](function(_0x101799){logger[_0x705a('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x4a953e,'request\x20sent');logger[_0x705a('0xb')](_0x705a('0xc'),_0x4a953e,_0x705a('0xd'),JSON[_0x705a('0xe')](_0x101799));if(_0x101799['error']){if(_0x101799['error'][_0x705a('0xf')]===0x1f4){logger[_0x705a('0x10')](_0x705a('0x11'),_0x4a953e,_0x101799[_0x705a('0x10')][_0x705a('0x12')]);return _0x57f622(_0x101799[_0x705a('0x10')][_0x705a('0x12')]);}logger[_0x705a('0x10')](_0x705a('0x11'),_0x4a953e,_0x101799['error'][_0x705a('0x12')]);return _0x5a9bd0(_0x101799[_0x705a('0x10')][_0x705a('0x12')]);}else{logger[_0x705a('0xa')]('AnalyticMetric,\x20%s,\x20%s',_0x4a953e,_0x705a('0xd'));_0x5a9bd0(_0x101799[_0x705a('0x13')][_0x705a('0x12')]);}})['catch'](function(_0xa3ec0b){logger[_0x705a('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x4a953e,_0xa3ec0b);_0x57f622(_0xa3ec0b);});});} \ No newline at end of file +var _0x9eb0=['result','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','client','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x25076c,_0x4a4a14){var _0x578937=function(_0x3be9bc){while(--_0x3be9bc){_0x25076c['push'](_0x25076c['shift']());}};_0x578937(++_0x4a4a14);}(_0x9eb0,0xd2));var _0x09eb=function(_0x22f458,_0x4a537b){_0x22f458=_0x22f458-0x0;var _0x3f0c85=_0x9eb0[_0x22f458];return _0x3f0c85;};'use strict';var _=require('lodash');var util=require(_0x09eb('0x0'));var moment=require(_0x09eb('0x1'));var BPromise=require(_0x09eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09eb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09eb('0x4'));var logger=require(_0x09eb('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x09eb('0x6'));var client=jayson[_0x09eb('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d203a,_0xd69198,_0x43efa5){return new BPromise(function(_0x51e6ac,_0x2e1aa1){return client['request'](_0x9d203a,_0x43efa5)[_0x09eb('0x8')](function(_0x108020){logger['info'](_0x09eb('0x9'),_0xd69198,_0x09eb('0xa'));logger[_0x09eb('0xb')](_0x09eb('0xc'),_0xd69198,'request\x20sent',JSON[_0x09eb('0xd')](_0x108020));if(_0x108020[_0x09eb('0xe')]){if(_0x108020[_0x09eb('0xe')][_0x09eb('0xf')]===0x1f4){logger[_0x09eb('0xe')](_0x09eb('0x9'),_0xd69198,_0x108020[_0x09eb('0xe')][_0x09eb('0x10')]);return _0x2e1aa1(_0x108020[_0x09eb('0xe')][_0x09eb('0x10')]);}logger[_0x09eb('0xe')](_0x09eb('0x9'),_0xd69198,_0x108020[_0x09eb('0xe')][_0x09eb('0x10')]);return _0x51e6ac(_0x108020['error'][_0x09eb('0x10')]);}else{logger[_0x09eb('0x11')](_0x09eb('0x9'),_0xd69198,_0x09eb('0xa'));_0x51e6ac(_0x108020[_0x09eb('0x12')][_0x09eb('0x10')]);}})['catch'](function(_0x562ad6){logger[_0x09eb('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0xd69198,_0x562ad6);_0x2e1aa1(_0x562ad6);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index e403636..9a1690d 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 _0x535d=['get','isAuthenticated','/:id','post','create','put','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticMetric.controller'];(function(_0x1c1815,_0x84870e){var _0x547581=function(_0x16acd9){while(--_0x16acd9){_0x1c1815['push'](_0x1c1815['shift']());}};_0x547581(++_0x84870e);}(_0x535d,0xe8));var _0xd535=function(_0x5da05a,_0x27fe46){_0x5da05a=_0x5da05a-0x0;var _0x1888ab=_0x535d[_0x5da05a];return _0x1888ab;};'use strict';var multer=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var path=require('path');var timeout=require(_0xd535('0x2'));var express=require(_0xd535('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd535('0x4'));var interaction=require(_0xd535('0x5'));var config=require(_0xd535('0x6'));var controller=require(_0xd535('0x7'));router[_0xd535('0x8')]('/',auth[_0xd535('0x9')](),controller['index']);router['get'](_0xd535('0xa'),auth[_0xd535('0x9')](),controller['show']);router[_0xd535('0xb')]('/',auth['isAuthenticated'](),controller[_0xd535('0xc')]);router[_0xd535('0xd')](_0xd535('0xa'),auth[_0xd535('0x9')](),controller['update']);router[_0xd535('0xe')](_0xd535('0xa'),auth[_0xd535('0x9')](),controller[_0xd535('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9a14=['get','/:id','isAuthenticated','post','create','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x56b36f,_0x4429f4){var _0x5e24e5=function(_0x339508){while(--_0x339508){_0x56b36f['push'](_0x56b36f['shift']());}};_0x5e24e5(++_0x4429f4);}(_0x9a14,0xa8));var _0x49a1=function(_0x5034ad,_0x60d655){_0x5034ad=_0x5034ad-0x0;var _0x31d7a4=_0x9a14[_0x5034ad];return _0x31d7a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49a1('0x0'));var timeout=require(_0x49a1('0x1'));var express=require(_0x49a1('0x2'));var router=express[_0x49a1('0x3')]();var fs_extra=require(_0x49a1('0x4'));var auth=require(_0x49a1('0x5'));var interaction=require(_0x49a1('0x6'));var config=require(_0x49a1('0x7'));var controller=require('./analyticMetric.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x49a1('0x8')](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller['show']);router[_0x49a1('0xb')]('/',auth[_0x49a1('0xa')](),controller[_0x49a1('0xc')]);router['put'](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller['update']);router[_0x49a1('0xd')](_0x49a1('0x9'),auth[_0x49a1('0xa')](),controller[_0x49a1('0xe')]);module[_0x49a1('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 3c9b304..5b0c073 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 _0x79d5=['sequelize','TEXT'];(function(_0x2641b0,_0x36b5d0){var _0x54731f=function(_0x55e555){while(--_0x55e555){_0x2641b0['push'](_0x2641b0['shift']());}};_0x54731f(++_0x36b5d0);}(_0x79d5,0xa0));var _0x579d=function(_0x409fb8,_0x5ab3d3){_0x409fb8=_0x409fb8-0x0;var _0x278270=_0x79d5[_0x409fb8];return _0x278270;};'use strict';var Sequelize=require(_0x579d('0x0'));module['exports']={'tree':{'type':Sequelize[_0x579d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x005c=['sequelize','TEXT'];(function(_0x299748,_0x1ad9d8){var _0x14ba0f=function(_0x3cf7af){while(--_0x3cf7af){_0x299748['push'](_0x299748['shift']());}};_0x14ba0f(++_0x1ad9d8);}(_0x005c,0x132));var _0xc005=function(_0x3a7d98,_0x1a7c63){_0x3a7d98=_0x3a7d98-0x0;var _0x59e881=_0x005c[_0x3a7d98];return _0x59e881;};'use strict';var Sequelize=require(_0xc005('0x0'));module['exports']={'tree':{'type':Sequelize[_0xc005('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5aff35e..7aa3475 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 _0x6d32=['fields','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','length','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','stack','name','index','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x6d32,0xec));var _0x26d3=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x6d32[_0x16b9ed];return _0x66b1f8;};'use strict';var emlformat=require(_0x26d3('0x0'));var rimraf=require(_0x26d3('0x1'));var zipdir=require(_0x26d3('0x2'));var jsonpatch=require(_0x26d3('0x3'));var rp=require(_0x26d3('0x4'));var moment=require('moment');var BPromise=require(_0x26d3('0x5'));var Mustache=require(_0x26d3('0x6'));var util=require(_0x26d3('0x7'));var path=require(_0x26d3('0x8'));var sox=require(_0x26d3('0x9'));var csv=require(_0x26d3('0xa'));var ejs=require(_0x26d3('0xb'));var fs=require('fs');var fs_extra=require(_0x26d3('0xc'));var _=require(_0x26d3('0xd'));var squel=require(_0x26d3('0xe'));var crypto=require(_0x26d3('0xf'));var jsforce=require(_0x26d3('0x10'));var deskjs=require(_0x26d3('0x11'));var toCsv=require(_0x26d3('0xa'));var querystring=require(_0x26d3('0x12'));var Papa=require(_0x26d3('0x13'));var Redis=require(_0x26d3('0x14'));var authService=require(_0x26d3('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x26d3('0x16'));var hardwareService=require(_0x26d3('0x17'));var logger=require(_0x26d3('0x18'))(_0x26d3('0x19'));var utils=require(_0x26d3('0x1a'));var config=require(_0x26d3('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x26d3('0x1c'))['db'];function respondWithStatusCode(_0x499264,_0x3f37bf){_0x3f37bf=_0x3f37bf||0xcc;return function(_0x439723){if(_0x439723){return _0x499264[_0x26d3('0x1d')](_0x3f37bf);}return _0x499264['status'](_0x3f37bf)['end']();};}function respondWithResult(_0x2c0434,_0x95bab0){_0x95bab0=_0x95bab0||0xc8;return function(_0x581f47){if(_0x581f47){return _0x2c0434[_0x26d3('0x1e')](_0x95bab0)[_0x26d3('0x1f')](_0x581f47);}};}function respondWithFilteredResult(_0x52a224,_0x3de04f){return function(_0x47f935){if(_0x47f935){var _0x12e0be=typeof _0x3de04f[_0x26d3('0x20')]===_0x26d3('0x21')&&typeof _0x3de04f[_0x26d3('0x22')]===_0x26d3('0x21');var _0xc26b55=_0x47f935[_0x26d3('0x23')];var _0x5b0caa=_0x12e0be?0x0:_0x3de04f['offset'];var _0x5ec453=_0x12e0be?_0x47f935[_0x26d3('0x23')]:_0x3de04f['offset']+_0x3de04f[_0x26d3('0x22')];var _0x4b281a;if(_0x5ec453>=_0xc26b55){_0x5ec453=_0xc26b55;_0x4b281a=0xc8;}else{_0x4b281a=0xce;}_0x52a224[_0x26d3('0x1e')](_0x4b281a);return _0x52a224[_0x26d3('0x24')](_0x26d3('0x25'),_0x5b0caa+'-'+_0x5ec453+'/'+_0xc26b55)[_0x26d3('0x1f')](_0x47f935);}return null;};}function patchUpdates(_0x266436){return function(_0xb3051e){try{jsonpatch[_0x26d3('0x26')](_0xb3051e,_0x266436,!![]);}catch(_0x4ed25c){return BPromise[_0x26d3('0x27')](_0x4ed25c);}return _0xb3051e['save']();};}function saveUpdates(_0x31ea87,_0x502f41){return function(_0x187785){if(_0x187785){return _0x187785['update'](_0x31ea87)[_0x26d3('0x28')](function(_0x3d2a1a){return _0x3d2a1a;});}return null;};}function removeEntity(_0xe595a9,_0x1e4afd){return function(_0xac1829){if(_0xac1829){return _0xac1829['destroy']()[_0x26d3('0x28')](function(){_0xe595a9[_0x26d3('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x161a5c,_0x15625f){return function(_0x44d098){if(!_0x44d098){_0x161a5c[_0x26d3('0x1d')](0x194);}return _0x44d098;};}function handleError(_0x31fddd,_0x4e2e49){_0x4e2e49=_0x4e2e49||0x1f4;return function(_0x58cb70){logger['error'](_0x58cb70[_0x26d3('0x29')]);if(_0x58cb70['name']){delete _0x58cb70[_0x26d3('0x2a')];}_0x31fddd[_0x26d3('0x1e')](_0x4e2e49)['send'](_0x58cb70);};}exports[_0x26d3('0x2b')]=function(_0x3f0633,_0x317f19){var _0x24c3f8={},_0x332ca3={},_0x2e6d34={'count':0x0,'rows':[]};var _0x3163cf=_['map'](db[_0x26d3('0x2c')][_0x26d3('0x2d')],function(_0x10cc47){return{'name':_0x10cc47[_0x26d3('0x2e')],'type':_0x10cc47[_0x26d3('0x2f')][_0x26d3('0x30')]};});_0x332ca3[_0x26d3('0x31')]=_[_0x26d3('0x32')](_0x3163cf,_0x26d3('0x2a'));_0x332ca3[_0x26d3('0x33')]=_[_0x26d3('0x34')](_0x3f0633[_0x26d3('0x33')]);_0x332ca3[_0x26d3('0x35')]=_[_0x26d3('0x36')](_0x332ca3['model'],_0x332ca3[_0x26d3('0x33')]);_0x24c3f8[_0x26d3('0x37')]=_[_0x26d3('0x36')](_0x332ca3['model'],qs[_0x26d3('0x38')](_0x3f0633[_0x26d3('0x33')]['fields']));_0x24c3f8[_0x26d3('0x37')]=_0x24c3f8[_0x26d3('0x37')]['length']?_0x24c3f8[_0x26d3('0x37')]:_0x332ca3[_0x26d3('0x31')];if(!_0x3f0633['query']['hasOwnProperty']('nolimit')){_0x24c3f8[_0x26d3('0x22')]=qs[_0x26d3('0x22')](_0x3f0633[_0x26d3('0x33')][_0x26d3('0x22')]);_0x24c3f8[_0x26d3('0x20')]=qs[_0x26d3('0x20')](_0x3f0633[_0x26d3('0x33')][_0x26d3('0x20')]);}_0x24c3f8['order']=qs['sort'](_0x3f0633['query'][_0x26d3('0x39')]);_0x24c3f8[_0x26d3('0x3a')]=qs[_0x26d3('0x35')](_[_0x26d3('0x3b')](_0x3f0633['query'],_0x332ca3[_0x26d3('0x35')]),_0x3163cf);if(_0x3f0633[_0x26d3('0x33')][_0x26d3('0x3c')]){_0x24c3f8[_0x26d3('0x3a')]=_[_0x26d3('0x3d')](_0x24c3f8['where'],{'$or':_[_0x26d3('0x32')](_0x3163cf,function(_0x4ae517){if(_0x4ae517['type']!==_0x26d3('0x3e')){var _0xca54ae={};_0xca54ae[_0x4ae517[_0x26d3('0x2a')]]={'$like':'%'+_0x3f0633[_0x26d3('0x33')][_0x26d3('0x3c')]+'%'};return _0xca54ae;}})});}_0x24c3f8=_['merge']({},_0x24c3f8,_0x3f0633['options']);var _0x26f36a={'where':_0x24c3f8['where']};return db[_0x26d3('0x2c')]['count'](_0x26f36a)['then'](function(_0x3d2866){_0x2e6d34[_0x26d3('0x23')]=_0x3d2866;if(_0x3f0633[_0x26d3('0x33')][_0x26d3('0x3f')]){_0x24c3f8[_0x26d3('0x40')]=[{'all':!![]}];}return db['AnalyticTreeReport']['findAll'](_0x24c3f8);})[_0x26d3('0x28')](function(_0x2ecdc6){_0x2e6d34['rows']=_0x2ecdc6;return _0x2e6d34;})['then'](respondWithFilteredResult(_0x317f19,_0x24c3f8))[_0x26d3('0x41')](handleError(_0x317f19,null));};exports[_0x26d3('0x42')]=function(_0x5d0a9b,_0x27be24){var _0x129fe7={'raw':!![],'where':{'id':_0x5d0a9b['params']['id']}},_0x8aa682={};_0x8aa682[_0x26d3('0x31')]=_['keys'](db[_0x26d3('0x2c')]['rawAttributes']);_0x8aa682[_0x26d3('0x33')]=_[_0x26d3('0x34')](_0x5d0a9b[_0x26d3('0x33')]);_0x8aa682[_0x26d3('0x35')]=_[_0x26d3('0x36')](_0x8aa682[_0x26d3('0x31')],_0x8aa682[_0x26d3('0x33')]);_0x129fe7[_0x26d3('0x37')]=_[_0x26d3('0x36')](_0x8aa682[_0x26d3('0x31')],qs[_0x26d3('0x38')](_0x5d0a9b[_0x26d3('0x33')][_0x26d3('0x38')]));_0x129fe7[_0x26d3('0x37')]=_0x129fe7[_0x26d3('0x37')][_0x26d3('0x43')]?_0x129fe7[_0x26d3('0x37')]:_0x8aa682[_0x26d3('0x31')];if(_0x5d0a9b[_0x26d3('0x33')]['includeAll']){_0x129fe7[_0x26d3('0x40')]=[{'all':!![]}];}_0x129fe7=_[_0x26d3('0x3d')]({},_0x129fe7,_0x5d0a9b[_0x26d3('0x44')]);return db['AnalyticTreeReport'][_0x26d3('0x45')](_0x129fe7)[_0x26d3('0x28')](handleEntityNotFound(_0x27be24,null))['then'](respondWithResult(_0x27be24,null))['catch'](handleError(_0x27be24,null));};exports[_0x26d3('0x46')]=function(_0x4b951f,_0x44f0f7){return db[_0x26d3('0x2c')]['create'](_0x4b951f['body'],{})[_0x26d3('0x28')](respondWithResult(_0x44f0f7,0xc9))[_0x26d3('0x41')](handleError(_0x44f0f7,null));};exports['update']=function(_0x547fa4,_0x1e05f3){if(_0x547fa4[_0x26d3('0x47')]['id']){delete _0x547fa4[_0x26d3('0x47')]['id'];}return db[_0x26d3('0x2c')][_0x26d3('0x45')]({'where':{'id':_0x547fa4[_0x26d3('0x48')]['id']}})['then'](handleEntityNotFound(_0x1e05f3,null))[_0x26d3('0x28')](saveUpdates(_0x547fa4[_0x26d3('0x47')],null))['then'](respondWithResult(_0x1e05f3,null))[_0x26d3('0x41')](handleError(_0x1e05f3,null));};exports['destroy']=function(_0x3fcaf0,_0x4784ff){return db[_0x26d3('0x2c')]['find']({'where':{'id':_0x3fcaf0[_0x26d3('0x48')]['id']}})['then'](handleEntityNotFound(_0x4784ff,null))['then'](removeEntity(_0x4784ff,null))[_0x26d3('0x41')](handleError(_0x4784ff,null));}; \ No newline at end of file +var _0xb31d=['fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','save','update','destroy','error','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes'];(function(_0x39b1f,_0x55ada0){var _0x4b4ead=function(_0xfaf2d5){while(--_0xfaf2d5){_0x39b1f['push'](_0x39b1f['shift']());}};_0x4b4ead(++_0x55ada0);}(_0xb31d,0x1d9));var _0xdb31=function(_0x3358cd,_0x284839){_0x3358cd=_0x3358cd-0x0;var _0xd08bf3=_0xb31d[_0x3358cd];return _0xd08bf3;};'use strict';var emlformat=require(_0xdb31('0x0'));var rimraf=require(_0xdb31('0x1'));var zipdir=require(_0xdb31('0x2'));var jsonpatch=require(_0xdb31('0x3'));var rp=require(_0xdb31('0x4'));var moment=require('moment');var BPromise=require(_0xdb31('0x5'));var Mustache=require(_0xdb31('0x6'));var util=require(_0xdb31('0x7'));var path=require('path');var sox=require(_0xdb31('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdb31('0x9'));var _=require(_0xdb31('0xa'));var squel=require(_0xdb31('0xb'));var crypto=require(_0xdb31('0xc'));var jsforce=require(_0xdb31('0xd'));var deskjs=require(_0xdb31('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdb31('0xf'));var Papa=require(_0xdb31('0x10'));var Redis=require('ioredis');var authService=require(_0xdb31('0x11'));var qs=require(_0xdb31('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdb31('0x13'));var logger=require(_0xdb31('0x14'))(_0xdb31('0x15'));var utils=require(_0xdb31('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdb31('0x17'));var db=require(_0xdb31('0x18'))['db'];function respondWithStatusCode(_0x307eac,_0x55ad07){_0x55ad07=_0x55ad07||0xcc;return function(_0x435284){if(_0x435284){return _0x307eac[_0xdb31('0x19')](_0x55ad07);}return _0x307eac[_0xdb31('0x1a')](_0x55ad07)[_0xdb31('0x1b')]();};}function respondWithResult(_0x196ba2,_0xc47f96){_0xc47f96=_0xc47f96||0xc8;return function(_0x49e006){if(_0x49e006){return _0x196ba2[_0xdb31('0x1a')](_0xc47f96)[_0xdb31('0x1c')](_0x49e006);}};}function respondWithFilteredResult(_0x249a09,_0x27329d){return function(_0x53af35){if(_0x53af35){var _0x5ca648=typeof _0x27329d['offset']==='undefined'&&typeof _0x27329d[_0xdb31('0x1d')]==='undefined';var _0x51a902=_0x53af35[_0xdb31('0x1e')];var _0x3ace97=_0x5ca648?0x0:_0x27329d[_0xdb31('0x1f')];var _0xb4131e=_0x5ca648?_0x53af35['count']:_0x27329d[_0xdb31('0x1f')]+_0x27329d['limit'];var _0x663c47;if(_0xb4131e>=_0x51a902){_0xb4131e=_0x51a902;_0x663c47=0xc8;}else{_0x663c47=0xce;}_0x249a09[_0xdb31('0x1a')](_0x663c47);return _0x249a09[_0xdb31('0x20')]('Content-Range',_0x3ace97+'-'+_0xb4131e+'/'+_0x51a902)[_0xdb31('0x1c')](_0x53af35);}return null;};}function patchUpdates(_0x1d1c41){return function(_0x2b4a71){try{jsonpatch[_0xdb31('0x21')](_0x2b4a71,_0x1d1c41,!![]);}catch(_0x880fba){return BPromise['reject'](_0x880fba);}return _0x2b4a71[_0xdb31('0x22')]();};}function saveUpdates(_0x5773f6,_0x3435d8){return function(_0xa59dd){if(_0xa59dd){return _0xa59dd[_0xdb31('0x23')](_0x5773f6)['then'](function(_0xd16243){return _0xd16243;});}return null;};}function removeEntity(_0x4f695c,_0x8bce12){return function(_0x312ec4){if(_0x312ec4){return _0x312ec4[_0xdb31('0x24')]()['then'](function(){_0x4f695c[_0xdb31('0x1a')](0xcc)[_0xdb31('0x1b')]();});}};}function handleEntityNotFound(_0x3e239b,_0x8ced99){return function(_0x2f781c){if(!_0x2f781c){_0x3e239b[_0xdb31('0x19')](0x194);}return _0x2f781c;};}function handleError(_0x51f7d7,_0x41ae0b){_0x41ae0b=_0x41ae0b||0x1f4;return function(_0x46d7e6){logger[_0xdb31('0x25')](_0x46d7e6['stack']);if(_0x46d7e6[_0xdb31('0x26')]){delete _0x46d7e6[_0xdb31('0x26')];}_0x51f7d7[_0xdb31('0x1a')](_0x41ae0b)[_0xdb31('0x27')](_0x46d7e6);};}exports[_0xdb31('0x28')]=function(_0x42849a,_0x1b35c8){var _0x45d83f={},_0x5e6b64={},_0x201776={'count':0x0,'rows':[]};var _0x3b0313=_[_0xdb31('0x29')](db[_0xdb31('0x2a')][_0xdb31('0x2b')],function(_0x4d85fe){return{'name':_0x4d85fe[_0xdb31('0x2c')],'type':_0x4d85fe['type'][_0xdb31('0x2d')]};});_0x5e6b64[_0xdb31('0x2e')]=_[_0xdb31('0x29')](_0x3b0313,_0xdb31('0x26'));_0x5e6b64['query']=_[_0xdb31('0x2f')](_0x42849a[_0xdb31('0x30')]);_0x5e6b64[_0xdb31('0x31')]=_[_0xdb31('0x32')](_0x5e6b64[_0xdb31('0x2e')],_0x5e6b64['query']);_0x45d83f[_0xdb31('0x33')]=_['intersection'](_0x5e6b64[_0xdb31('0x2e')],qs[_0xdb31('0x34')](_0x42849a[_0xdb31('0x30')]['fields']));_0x45d83f['attributes']=_0x45d83f[_0xdb31('0x33')][_0xdb31('0x35')]?_0x45d83f[_0xdb31('0x33')]:_0x5e6b64[_0xdb31('0x2e')];if(!_0x42849a['query'][_0xdb31('0x36')](_0xdb31('0x37'))){_0x45d83f['limit']=qs['limit'](_0x42849a[_0xdb31('0x30')][_0xdb31('0x1d')]);_0x45d83f['offset']=qs['offset'](_0x42849a['query'][_0xdb31('0x1f')]);}_0x45d83f['order']=qs[_0xdb31('0x38')](_0x42849a[_0xdb31('0x30')]['sort']);_0x45d83f[_0xdb31('0x39')]=qs[_0xdb31('0x31')](_[_0xdb31('0x3a')](_0x42849a[_0xdb31('0x30')],_0x5e6b64[_0xdb31('0x31')]),_0x3b0313);if(_0x42849a[_0xdb31('0x30')][_0xdb31('0x3b')]){_0x45d83f[_0xdb31('0x39')]=_[_0xdb31('0x3c')](_0x45d83f[_0xdb31('0x39')],{'$or':_[_0xdb31('0x29')](_0x3b0313,function(_0x33c92b){if(_0x33c92b[_0xdb31('0x3d')]!==_0xdb31('0x3e')){var _0x1068b7={};_0x1068b7[_0x33c92b[_0xdb31('0x26')]]={'$like':'%'+_0x42849a[_0xdb31('0x30')]['filter']+'%'};return _0x1068b7;}})});}_0x45d83f=_[_0xdb31('0x3c')]({},_0x45d83f,_0x42849a[_0xdb31('0x3f')]);var _0x11bc8e={'where':_0x45d83f[_0xdb31('0x39')]};return db[_0xdb31('0x2a')][_0xdb31('0x1e')](_0x11bc8e)[_0xdb31('0x40')](function(_0x235b78){_0x201776[_0xdb31('0x1e')]=_0x235b78;if(_0x42849a[_0xdb31('0x30')]['includeAll']){_0x45d83f[_0xdb31('0x41')]=[{'all':!![]}];}return db[_0xdb31('0x2a')][_0xdb31('0x42')](_0x45d83f);})['then'](function(_0x346343){_0x201776[_0xdb31('0x43')]=_0x346343;return _0x201776;})[_0xdb31('0x40')](respondWithFilteredResult(_0x1b35c8,_0x45d83f))[_0xdb31('0x44')](handleError(_0x1b35c8,null));};exports[_0xdb31('0x45')]=function(_0x5df42e,_0x3140df){var _0xd43eb6={'raw':!![],'where':{'id':_0x5df42e[_0xdb31('0x46')]['id']}},_0x5a2694={};_0x5a2694[_0xdb31('0x2e')]=_['keys'](db['AnalyticTreeReport']['rawAttributes']);_0x5a2694[_0xdb31('0x30')]=_['keys'](_0x5df42e[_0xdb31('0x30')]);_0x5a2694[_0xdb31('0x31')]=_[_0xdb31('0x32')](_0x5a2694['model'],_0x5a2694[_0xdb31('0x30')]);_0xd43eb6[_0xdb31('0x33')]=_['intersection'](_0x5a2694[_0xdb31('0x2e')],qs[_0xdb31('0x34')](_0x5df42e[_0xdb31('0x30')][_0xdb31('0x34')]));_0xd43eb6['attributes']=_0xd43eb6['attributes'][_0xdb31('0x35')]?_0xd43eb6[_0xdb31('0x33')]:_0x5a2694['model'];if(_0x5df42e['query'][_0xdb31('0x47')]){_0xd43eb6[_0xdb31('0x41')]=[{'all':!![]}];}_0xd43eb6=_[_0xdb31('0x3c')]({},_0xd43eb6,_0x5df42e['options']);return db[_0xdb31('0x2a')][_0xdb31('0x48')](_0xd43eb6)[_0xdb31('0x40')](handleEntityNotFound(_0x3140df,null))[_0xdb31('0x40')](respondWithResult(_0x3140df,null))[_0xdb31('0x44')](handleError(_0x3140df,null));};exports[_0xdb31('0x49')]=function(_0x4d0aeb,_0x3cf1ca){return db[_0xdb31('0x2a')][_0xdb31('0x49')](_0x4d0aeb[_0xdb31('0x4a')],{})[_0xdb31('0x40')](respondWithResult(_0x3cf1ca,0xc9))[_0xdb31('0x44')](handleError(_0x3cf1ca,null));};exports['update']=function(_0xbf5231,_0x5af691){if(_0xbf5231[_0xdb31('0x4a')]['id']){delete _0xbf5231[_0xdb31('0x4a')]['id'];}return db[_0xdb31('0x2a')][_0xdb31('0x48')]({'where':{'id':_0xbf5231[_0xdb31('0x46')]['id']}})['then'](handleEntityNotFound(_0x5af691,null))[_0xdb31('0x40')](saveUpdates(_0xbf5231['body'],null))[_0xdb31('0x40')](respondWithResult(_0x5af691,null))[_0xdb31('0x44')](handleError(_0x5af691,null));};exports[_0xdb31('0x24')]=function(_0x763c9b,_0x3e6d57){return db[_0xdb31('0x2a')][_0xdb31('0x48')]({'where':{'id':_0x763c9b[_0xdb31('0x46')]['id']}})[_0xdb31('0x40')](handleEntityNotFound(_0x3e6d57,null))['then'](removeEntity(_0x3e6d57,null))['catch'](handleError(_0x3e6d57,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index b0cf79f..1ccd94d 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 _0xa5f5=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','../../config/logger','api','bluebird','path'];(function(_0x2aebb2,_0x21f452){var _0x17406c=function(_0x7ae2df){while(--_0x7ae2df){_0x2aebb2['push'](_0x2aebb2['shift']());}};_0x17406c(++_0x21f452);}(_0xa5f5,0xe2));var _0x5a5f=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xa5f5[_0x599f41];return _0x2e4d58;};'use strict';var _=require(_0x5a5f('0x0'));var util=require('util');var logger=require(_0x5a5f('0x1'))(_0x5a5f('0x2'));var moment=require('moment');var BPromise=require(_0x5a5f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a5f('0x4'));var rimraf=require(_0x5a5f('0x5'));var config=require(_0x5a5f('0x6'));var attributes=require(_0x5a5f('0x7'));module[_0x5a5f('0x8')]=function(_0x2b6739,_0x457ab1){return _0x2b6739['define'](_0x5a5f('0x9'),attributes,{'tableName':_0x5a5f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d4e=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x5d4e,0xdd));var _0xe5d4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5d4e[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xe5d4('0x0'));var util=require(_0xe5d4('0x1'));var logger=require(_0xe5d4('0x2'))(_0xe5d4('0x3'));var moment=require(_0xe5d4('0x4'));var BPromise=require(_0xe5d4('0x5'));var rp=require(_0xe5d4('0x6'));var fs=require('fs');var path=require(_0xe5d4('0x7'));var rimraf=require(_0xe5d4('0x8'));var config=require(_0xe5d4('0x9'));var attributes=require(_0xe5d4('0xa'));module[_0xe5d4('0xb')]=function(_0x46166a,_0x40c75e){return _0x46166a['define'](_0xe5d4('0xc'),attributes,{'tableName':_0xe5d4('0xd'),'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 c321bb0..1640a15 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(_0x3f0573,_0x4029da){var _0x14e625=function(_0x502f51){while(--_0x502f51){_0x3f0573['push'](_0x3f0573['shift']());}};_0x14e625(++_0x4029da);}(_0xdb28,0x106));var _0x8db2=function(_0x2ae3d0,_0x454037){_0x2ae3d0=_0x2ae3d0-0x0;var _0xbfe1d5=_0xdb28[_0x2ae3d0];return _0xbfe1d5;};'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 _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2c7197,_0x28a0d9){var _0x37327f=function(_0x52aac4){while(--_0x52aac4){_0x2c7197['push'](_0x2c7197['shift']());}};_0x37327f(++_0x28a0d9);}(_0x5f2f,0x73));var _0xf5f2=function(_0xc7c59d,_0x57c4c5){_0xc7c59d=_0xc7c59d-0x0;var _0x48a06e=_0x5f2f[_0xc7c59d];return _0x48a06e;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 52dee1f..1bee525 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 _0x8319=['put','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x1b7b53,_0x287249){var _0x3a440d=function(_0x23b4e3){while(--_0x23b4e3){_0x1b7b53['push'](_0x1b7b53['shift']());}};_0x3a440d(++_0x287249);}(_0x8319,0x113));var _0x9831=function(_0x21ad00,_0x4bb7ef){_0x21ad00=_0x21ad00-0x0;var _0x157ca2=_0x8319[_0x21ad00];return _0x157ca2;};'use strict';var multer=require('multer');var util=require(_0x9831('0x0'));var path=require(_0x9831('0x1'));var timeout=require(_0x9831('0x2'));var express=require('express');var router=express[_0x9831('0x3')]();var fs_extra=require(_0x9831('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x9831('0x5'));var config=require('../../config/environment');var controller=require(_0x9831('0x6'));router[_0x9831('0x7')]('/',auth[_0x9831('0x8')](),controller[_0x9831('0x9')]);router['get'](_0x9831('0xa'),auth[_0x9831('0x8')](),controller[_0x9831('0xb')]);router[_0x9831('0xc')]('/',auth[_0x9831('0x8')](),controller[_0x9831('0xd')]);router[_0x9831('0xe')]('/:id',auth[_0x9831('0x8')](),controller['update']);router['delete'](_0x9831('0xa'),auth[_0x9831('0x8')](),controller[_0x9831('0xf')]);module[_0x9831('0x10')]=router; \ No newline at end of file +var _0xf13e=['../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','get','/:id','show','post','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x29416f,_0x535a3a){var _0x2ce5cf=function(_0x5f2c13){while(--_0x5f2c13){_0x29416f['push'](_0x29416f['shift']());}};_0x2ce5cf(++_0x535a3a);}(_0xf13e,0xb5));var _0xef13=function(_0x20099a,_0x2bf584){_0x20099a=_0x20099a-0x0;var _0x2c3649=_0xf13e[_0x20099a];return _0x2c3649;};'use strict';var multer=require('multer');var util=require(_0xef13('0x0'));var path=require(_0xef13('0x1'));var timeout=require(_0xef13('0x2'));var express=require('express');var router=express[_0xef13('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xef13('0x4'));var interaction=require(_0xef13('0x5'));var config=require(_0xef13('0x6'));var controller=require(_0xef13('0x7'));router['get']('/',auth[_0xef13('0x8')](),controller[_0xef13('0x9')]);router[_0xef13('0xa')](_0xef13('0xb'),auth['isAuthenticated'](),controller[_0xef13('0xc')]);router[_0xef13('0xd')]('/',auth[_0xef13('0x8')](),controller['create']);router['put']('/:id',auth[_0xef13('0x8')](),controller['update']);router[_0xef13('0xe')](_0xef13('0xb'),auth[_0xef13('0x8')](),controller[_0xef13('0xf')]);module[_0xef13('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index c83c93e..fe095b7 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 _0xf3cd=['exports','STRING','sequelize'];(function(_0xe9abdb,_0x382970){var _0x56ec13=function(_0x2c1450){while(--_0x2c1450){_0xe9abdb['push'](_0xe9abdb['shift']());}};_0x56ec13(++_0x382970);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x230bb8,_0xa1718){_0x230bb8=_0x230bb8-0x0;var _0x16cb9a=_0xf3cd[_0x230bb8];return _0x16cb9a;};'use strict';var Sequelize=require(_0xdf3c('0x0'));module[_0xdf3c('0x1')]={'name':{'type':Sequelize[_0xdf3c('0x2')]},'basename':{'type':Sequelize[_0xdf3c('0x2')]},'type':{'type':Sequelize[_0xdf3c('0x2')]}}; \ No newline at end of file +var _0xaa19=['STRING','sequelize','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xaa19,0x79));var _0x9aa1=function(_0x278d67,_0x2ee210){_0x278d67=_0x278d67-0x0;var _0x119d7b=_0xaa19[_0x278d67];return _0x119d7b;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'name':{'type':Sequelize[_0x9aa1('0x2')]},'basename':{'type':Sequelize[_0x9aa1('0x2')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 6105a36..223bb78 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 _0xbf29=['count','offset','set','Content-Range','apply','reject','then','destroy','sendStatus','error','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','Attachment','include','rows','catch','show','params','length','includeAll','find','get','createdAt','updatedAt','body','omit','create','file','originalname','basename','filename','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xbf29,0x19d));var _0x9bf2=function(_0x3caa7c,_0x5eab01){_0x3caa7c=_0x3caa7c-0x0;var _0x5e90a3=_0xbf29[_0x3caa7c];return _0x5e90a3;};'use strict';var emlformat=require(_0x9bf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9bf2('0x1'));var jsonpatch=require(_0x9bf2('0x2'));var rp=require(_0x9bf2('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9bf2('0x4'));var util=require(_0x9bf2('0x5'));var path=require(_0x9bf2('0x6'));var sox=require(_0x9bf2('0x7'));var csv=require(_0x9bf2('0x8'));var ejs=require(_0x9bf2('0x9'));var fs=require('fs');var fs_extra=require(_0x9bf2('0xa'));var _=require(_0x9bf2('0xb'));var squel=require(_0x9bf2('0xc'));var crypto=require(_0x9bf2('0xd'));var jsforce=require(_0x9bf2('0xe'));var deskjs=require(_0x9bf2('0xf'));var toCsv=require(_0x9bf2('0x8'));var querystring=require('querystring');var Papa=require(_0x9bf2('0x10'));var Redis=require(_0x9bf2('0x11'));var authService=require(_0x9bf2('0x12'));var qs=require(_0x9bf2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9bf2('0x14'));var logger=require(_0x9bf2('0x15'))(_0x9bf2('0x16'));var utils=require(_0x9bf2('0x17'));var config=require(_0x9bf2('0x18'));var licenseUtil=require(_0x9bf2('0x19'));var db=require(_0x9bf2('0x1a'))['db'];function respondWithStatusCode(_0x839e7,_0x57a874){_0x57a874=_0x57a874||0xcc;return function(_0x98faeb){if(_0x98faeb){return _0x839e7['sendStatus'](_0x57a874);}return _0x839e7[_0x9bf2('0x1b')](_0x57a874)[_0x9bf2('0x1c')]();};}function respondWithResult(_0xd74f3b,_0x1b1c05){_0x1b1c05=_0x1b1c05||0xc8;return function(_0x165c49){if(_0x165c49){return _0xd74f3b[_0x9bf2('0x1b')](_0x1b1c05)[_0x9bf2('0x1d')](_0x165c49);}};}function respondWithFilteredResult(_0x2c0093,_0xdfc53f){return function(_0x430068){if(_0x430068){var _0x33c1f4=typeof _0xdfc53f['offset']===_0x9bf2('0x1e')&&typeof _0xdfc53f[_0x9bf2('0x1f')]===_0x9bf2('0x1e');var _0x2c5ee1=_0x430068[_0x9bf2('0x20')];var _0x172f92=_0x33c1f4?0x0:_0xdfc53f[_0x9bf2('0x21')];var _0x35c9a9=_0x33c1f4?_0x430068[_0x9bf2('0x20')]:_0xdfc53f['offset']+_0xdfc53f[_0x9bf2('0x1f')];var _0xd3ea3e;if(_0x35c9a9>=_0x2c5ee1){_0x35c9a9=_0x2c5ee1;_0xd3ea3e=0xc8;}else{_0xd3ea3e=0xce;}_0x2c0093['status'](_0xd3ea3e);return _0x2c0093[_0x9bf2('0x22')](_0x9bf2('0x23'),_0x172f92+'-'+_0x35c9a9+'/'+_0x2c5ee1)[_0x9bf2('0x1d')](_0x430068);}return null;};}function patchUpdates(_0x181bfc){return function(_0x257f36){try{jsonpatch[_0x9bf2('0x24')](_0x257f36,_0x181bfc,!![]);}catch(_0x17b5b6){return BPromise[_0x9bf2('0x25')](_0x17b5b6);}return _0x257f36['save']();};}function saveUpdates(_0x114e97,_0x5beaf5){return function(_0x29f397){if(_0x29f397){return _0x29f397['update'](_0x114e97)[_0x9bf2('0x26')](function(_0x316d6b){return _0x316d6b;});}return null;};}function removeEntity(_0x5be9ac,_0x3c003f){return function(_0x79a835){if(_0x79a835){return _0x79a835[_0x9bf2('0x27')]()['then'](function(){_0x5be9ac['status'](0xcc)[_0x9bf2('0x1c')]();});}};}function handleEntityNotFound(_0x489192,_0xe8d178){return function(_0x1671eb){if(!_0x1671eb){_0x489192[_0x9bf2('0x28')](0x194);}return _0x1671eb;};}function handleError(_0x227ecc,_0x286c8a){_0x286c8a=_0x286c8a||0x1f4;return function(_0x35974e){logger[_0x9bf2('0x29')](_0x35974e['stack']);if(_0x35974e[_0x9bf2('0x2a')]){delete _0x35974e['name'];}_0x227ecc[_0x9bf2('0x1b')](_0x286c8a)['send'](_0x35974e);};}exports[_0x9bf2('0x2b')]=function(_0xaba6c9,_0x5ee754){var _0x1ff510={},_0x7b434a={},_0x34f706={'count':0x0,'rows':[]};var _0x2bede6=_[_0x9bf2('0x2c')](db['Attachment'][_0x9bf2('0x2d')],function(_0x83ee5a){return{'name':_0x83ee5a[_0x9bf2('0x2e')],'type':_0x83ee5a['type'][_0x9bf2('0x2f')]};});_0x7b434a[_0x9bf2('0x30')]=_['map'](_0x2bede6,_0x9bf2('0x2a'));_0x7b434a[_0x9bf2('0x31')]=_[_0x9bf2('0x32')](_0xaba6c9['query']);_0x7b434a[_0x9bf2('0x33')]=_[_0x9bf2('0x34')](_0x7b434a['model'],_0x7b434a[_0x9bf2('0x31')]);_0x1ff510['attributes']=_[_0x9bf2('0x34')](_0x7b434a['model'],qs[_0x9bf2('0x35')](_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x35')]));_0x1ff510[_0x9bf2('0x36')]=_0x1ff510[_0x9bf2('0x36')]['length']?_0x1ff510['attributes']:_0x7b434a[_0x9bf2('0x30')];if(!_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x37')](_0x9bf2('0x38'))){_0x1ff510[_0x9bf2('0x1f')]=qs[_0x9bf2('0x1f')](_0xaba6c9[_0x9bf2('0x31')]['limit']);_0x1ff510['offset']=qs[_0x9bf2('0x21')](_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x21')]);}_0x1ff510[_0x9bf2('0x39')]=qs[_0x9bf2('0x3a')](_0xaba6c9['query'][_0x9bf2('0x3a')]);_0x1ff510[_0x9bf2('0x3b')]=qs['filters'](_['pick'](_0xaba6c9['query'],_0x7b434a['filters']),_0x2bede6);if(_0xaba6c9[_0x9bf2('0x31')][_0x9bf2('0x3c')]){_0x1ff510[_0x9bf2('0x3b')]=_[_0x9bf2('0x3d')](_0x1ff510['where'],{'$or':_[_0x9bf2('0x2c')](_0x2bede6,function(_0x3ca6b3){if(_0x3ca6b3[_0x9bf2('0x3e')]!==_0x9bf2('0x3f')){var _0x16aa4e={};_0x16aa4e[_0x3ca6b3['name']]={'$like':'%'+_0xaba6c9[_0x9bf2('0x31')]['filter']+'%'};return _0x16aa4e;}})});}_0x1ff510=_['merge']({},_0x1ff510,_0xaba6c9[_0x9bf2('0x40')]);var _0x651cd7={'where':_0x1ff510[_0x9bf2('0x3b')]};return db[_0x9bf2('0x41')][_0x9bf2('0x20')](_0x651cd7)['then'](function(_0x4dc4a7){_0x34f706[_0x9bf2('0x20')]=_0x4dc4a7;if(_0xaba6c9[_0x9bf2('0x31')]['includeAll']){_0x1ff510[_0x9bf2('0x42')]=[{'all':!![]}];}return db[_0x9bf2('0x41')]['findAll'](_0x1ff510);})[_0x9bf2('0x26')](function(_0x282264){_0x34f706[_0x9bf2('0x43')]=_0x282264;return _0x34f706;})[_0x9bf2('0x26')](respondWithFilteredResult(_0x5ee754,_0x1ff510))[_0x9bf2('0x44')](handleError(_0x5ee754,null));};exports[_0x9bf2('0x45')]=function(_0x4c6d4b,_0x3d07b9){var _0x102e9c={'raw':!![],'where':{'id':_0x4c6d4b[_0x9bf2('0x46')]['id']}},_0x372014={};_0x372014[_0x9bf2('0x30')]=_[_0x9bf2('0x32')](db['Attachment'][_0x9bf2('0x2d')]);_0x372014['query']=_['keys'](_0x4c6d4b['query']);_0x372014[_0x9bf2('0x33')]=_['intersection'](_0x372014[_0x9bf2('0x30')],_0x372014[_0x9bf2('0x31')]);_0x102e9c[_0x9bf2('0x36')]=_[_0x9bf2('0x34')](_0x372014['model'],qs['fields'](_0x4c6d4b[_0x9bf2('0x31')][_0x9bf2('0x35')]));_0x102e9c[_0x9bf2('0x36')]=_0x102e9c[_0x9bf2('0x36')][_0x9bf2('0x47')]?_0x102e9c[_0x9bf2('0x36')]:_0x372014[_0x9bf2('0x30')];if(_0x4c6d4b[_0x9bf2('0x31')][_0x9bf2('0x48')]){_0x102e9c[_0x9bf2('0x42')]=[{'all':!![]}];}_0x102e9c=_['merge']({},_0x102e9c,_0x4c6d4b[_0x9bf2('0x40')]);return db[_0x9bf2('0x41')][_0x9bf2('0x49')](_0x102e9c)[_0x9bf2('0x26')](handleEntityNotFound(_0x3d07b9,null))[_0x9bf2('0x26')](respondWithResult(_0x3d07b9,null))[_0x9bf2('0x44')](handleError(_0x3d07b9,null));};exports['clone']=function(_0x51561e,_0x2d7cbd){var _0x4b2a8a={'where':{'id':_0x51561e['params']['id']}},_0x2d7d7d={};_0x2d7d7d[_0x9bf2('0x30')]=_[_0x9bf2('0x32')](db[_0x9bf2('0x41')][_0x9bf2('0x2d')]);_0x4b2a8a[_0x9bf2('0x36')]=_[_0x9bf2('0x34')](_0x2d7d7d[_0x9bf2('0x30')],qs[_0x9bf2('0x35')](_0x51561e[_0x9bf2('0x31')][_0x9bf2('0x35')]));_0x4b2a8a['attributes']=_0x4b2a8a[_0x9bf2('0x36')]['length']?_0x4b2a8a[_0x9bf2('0x36')]:_0x2d7d7d['model'];if(_0x51561e['query'][_0x9bf2('0x48')]){_0x4b2a8a['include']=[{'all':!![]}];}_0x4b2a8a=_['merge']({},_0x4b2a8a,_0x51561e[_0x9bf2('0x40')]);return db['Attachment'][_0x9bf2('0x49')](_0x4b2a8a)[_0x9bf2('0x26')](handleEntityNotFound(_0x2d7cbd,null))[_0x9bf2('0x26')](function(_0x4bfbe3){if(_0x4bfbe3){var _0x3715fe=_0x4bfbe3[_0x9bf2('0x4a')]({'plain':!![]});_0x3715fe=qs['omit'](_0x3715fe,['id',_0x9bf2('0x4b'),_0x9bf2('0x4c')]);_0x51561e[_0x9bf2('0x4d')]=_[_0x9bf2('0x4e')](_0x51561e[_0x9bf2('0x4d')],['id',_0x9bf2('0x4b'),_0x9bf2('0x4c')]);return db['Attachment'][_0x9bf2('0x4f')](_['merge'](_0x3715fe,_0x51561e[_0x9bf2('0x4d')]),{'include':_0x51561e['query'][_0x9bf2('0x48')]?[{'all':!![]}]:undefined});}})[_0x9bf2('0x26')](respondWithResult(_0x2d7cbd,0xc9))[_0x9bf2('0x44')](handleError(_0x2d7cbd,null));};exports['update']=function(_0x28d18c,_0x549eb3){if(_0x28d18c[_0x9bf2('0x4d')]['id']){delete _0x28d18c[_0x9bf2('0x4d')]['id'];}return db[_0x9bf2('0x41')][_0x9bf2('0x49')]({'where':{'id':_0x28d18c[_0x9bf2('0x46')]['id']}})['then'](handleEntityNotFound(_0x549eb3,null))[_0x9bf2('0x26')](saveUpdates(_0x28d18c['body'],null))[_0x9bf2('0x26')](respondWithResult(_0x549eb3,null))[_0x9bf2('0x44')](handleError(_0x549eb3,null));};exports[_0x9bf2('0x27')]=function(_0x9e48d7,_0x4098e7){return db[_0x9bf2('0x41')][_0x9bf2('0x49')]({'where':{'id':_0x9e48d7[_0x9bf2('0x46')]['id']}})[_0x9bf2('0x26')](handleEntityNotFound(_0x4098e7,null))[_0x9bf2('0x26')](removeEntity(_0x4098e7,null))['catch'](handleError(_0x4098e7,null));};exports[_0x9bf2('0x4f')]=function(_0x2c4f25,_0x3faf2f,_0x200b8f){_0x2c4f25['body'][_0x9bf2('0x2a')]=_0x2c4f25[_0x9bf2('0x50')][_0x9bf2('0x51')];_0x2c4f25[_0x9bf2('0x4d')][_0x9bf2('0x52')]=_0x2c4f25['file'][_0x9bf2('0x53')];_0x2c4f25[_0x9bf2('0x4d')][_0x9bf2('0x3e')]=_0x2c4f25[_0x9bf2('0x50')]['mimetype'];return db[_0x9bf2('0x41')][_0x9bf2('0x4f')](_0x2c4f25['body'])['then'](respondWithResult(_0x3faf2f,0xc9))[_0x9bf2('0x44')](handleError(_0x3faf2f,null));};exports['download']=function(_0x261f5a,_0x151302,_0x97b594){return db[_0x9bf2('0x41')]['findOne']({'where':{'id':_0x261f5a[_0x9bf2('0x46')]['id']},'raw':!![]})[_0x9bf2('0x26')](handleEntityNotFound(_0x151302,null))['then'](function(_0x3c7c4c){if(_0x3c7c4c){var _0x22ccf7=_0x3c7c4c[_0x9bf2('0x54')]!==null;var _0x540b55=path[_0x9bf2('0x55')](config[_0x9bf2('0x56')],_0x9bf2('0x57'));if(_0x22ccf7){_0x540b55=path[_0x9bf2('0x55')](_0x540b55,'offline-chat/');}var _0x58cd7f=path[_0x9bf2('0x55')](_0x540b55,_0x3c7c4c[_0x9bf2('0x52')]);return _0x151302[_0x9bf2('0x58')](_0x58cd7f);}})[_0x9bf2('0x44')](handleError(_0x151302,null));}; \ No newline at end of file +var _0x3bf9=['lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','sendStatus','stack','name','send','index','map','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','Attachment','includeAll','include','findAll','rows','then','catch','params','options','find','get','omit','createdAt','updatedAt','body','destroy','create','file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','bluebird','mustache','path','to-csv','ejs','fs-extra'];(function(_0x136a09,_0x39d148){var _0x188564=function(_0x2c9a3c){while(--_0x2c9a3c){_0x136a09['push'](_0x136a09['shift']());}};_0x188564(++_0x39d148);}(_0x3bf9,0xf4));var _0x93bf=function(_0x4c32f5,_0x3dbbf1){_0x4c32f5=_0x4c32f5-0x0;var _0x19cae9=_0x3bf9[_0x4c32f5];return _0x19cae9;};'use strict';var emlformat=require(_0x93bf('0x0'));var rimraf=require(_0x93bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x93bf('0x2'));var Mustache=require(_0x93bf('0x3'));var util=require('util');var path=require(_0x93bf('0x4'));var sox=require('sox');var csv=require(_0x93bf('0x5'));var ejs=require(_0x93bf('0x6'));var fs=require('fs');var fs_extra=require(_0x93bf('0x7'));var _=require(_0x93bf('0x8'));var squel=require('squel');var crypto=require(_0x93bf('0x9'));var jsforce=require(_0x93bf('0xa'));var deskjs=require(_0x93bf('0xb'));var toCsv=require(_0x93bf('0x5'));var querystring=require(_0x93bf('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x93bf('0xd'));var qs=require(_0x93bf('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x93bf('0xf'));var logger=require(_0x93bf('0x10'))(_0x93bf('0x11'));var utils=require(_0x93bf('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x93bf('0x13'))['db'];function respondWithStatusCode(_0x6d3f99,_0x2e56c8){_0x2e56c8=_0x2e56c8||0xcc;return function(_0x9ec6d0){if(_0x9ec6d0){return _0x6d3f99['sendStatus'](_0x2e56c8);}return _0x6d3f99['status'](_0x2e56c8)[_0x93bf('0x14')]();};}function respondWithResult(_0x1280b2,_0x2b19b0){_0x2b19b0=_0x2b19b0||0xc8;return function(_0xbeb215){if(_0xbeb215){return _0x1280b2[_0x93bf('0x15')](_0x2b19b0)[_0x93bf('0x16')](_0xbeb215);}};}function respondWithFilteredResult(_0x1cfc1b,_0x24eb6f){return function(_0x4cec80){if(_0x4cec80){var _0x341592=typeof _0x24eb6f[_0x93bf('0x17')]===_0x93bf('0x18')&&typeof _0x24eb6f[_0x93bf('0x19')]===_0x93bf('0x18');var _0x53f013=_0x4cec80[_0x93bf('0x1a')];var _0xa00f9b=_0x341592?0x0:_0x24eb6f[_0x93bf('0x17')];var _0x3d5b6d=_0x341592?_0x4cec80[_0x93bf('0x1a')]:_0x24eb6f[_0x93bf('0x17')]+_0x24eb6f[_0x93bf('0x19')];var _0x4942ea;if(_0x3d5b6d>=_0x53f013){_0x3d5b6d=_0x53f013;_0x4942ea=0xc8;}else{_0x4942ea=0xce;}_0x1cfc1b[_0x93bf('0x15')](_0x4942ea);return _0x1cfc1b[_0x93bf('0x1b')](_0x93bf('0x1c'),_0xa00f9b+'-'+_0x3d5b6d+'/'+_0x53f013)['json'](_0x4cec80);}return null;};}function patchUpdates(_0xaf649b){return function(_0x52f884){try{jsonpatch['apply'](_0x52f884,_0xaf649b,!![]);}catch(_0x4dab5b){return BPromise['reject'](_0x4dab5b);}return _0x52f884[_0x93bf('0x1d')]();};}function saveUpdates(_0x280abd,_0x3f4831){return function(_0x47180e){if(_0x47180e){return _0x47180e[_0x93bf('0x1e')](_0x280abd)['then'](function(_0x2347f1){return _0x2347f1;});}return null;};}function removeEntity(_0x4aeb2b,_0x37b841){return function(_0x3165e2){if(_0x3165e2){return _0x3165e2['destroy']()['then'](function(){_0x4aeb2b[_0x93bf('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53453e,_0x183f0d){return function(_0x554b6a){if(!_0x554b6a){_0x53453e[_0x93bf('0x1f')](0x194);}return _0x554b6a;};}function handleError(_0x3b92d0,_0x159d62){_0x159d62=_0x159d62||0x1f4;return function(_0x1f1090){logger['error'](_0x1f1090[_0x93bf('0x20')]);if(_0x1f1090[_0x93bf('0x21')]){delete _0x1f1090[_0x93bf('0x21')];}_0x3b92d0['status'](_0x159d62)[_0x93bf('0x22')](_0x1f1090);};}exports[_0x93bf('0x23')]=function(_0x5e9a8a,_0x4fa684){var _0x5b13fe={},_0x59d61a={},_0x4966fe={'count':0x0,'rows':[]};var _0x1e1686=_[_0x93bf('0x24')](db['Attachment'][_0x93bf('0x25')],function(_0xd80a1c){return{'name':_0xd80a1c['fieldName'],'type':_0xd80a1c['type'][_0x93bf('0x26')]};});_0x59d61a['model']=_[_0x93bf('0x24')](_0x1e1686,_0x93bf('0x21'));_0x59d61a[_0x93bf('0x27')]=_[_0x93bf('0x28')](_0x5e9a8a[_0x93bf('0x27')]);_0x59d61a[_0x93bf('0x29')]=_['intersection'](_0x59d61a[_0x93bf('0x2a')],_0x59d61a[_0x93bf('0x27')]);_0x5b13fe[_0x93bf('0x2b')]=_[_0x93bf('0x2c')](_0x59d61a[_0x93bf('0x2a')],qs[_0x93bf('0x2d')](_0x5e9a8a['query'][_0x93bf('0x2d')]));_0x5b13fe[_0x93bf('0x2b')]=_0x5b13fe['attributes'][_0x93bf('0x2e')]?_0x5b13fe[_0x93bf('0x2b')]:_0x59d61a[_0x93bf('0x2a')];if(!_0x5e9a8a[_0x93bf('0x27')][_0x93bf('0x2f')]('nolimit')){_0x5b13fe[_0x93bf('0x19')]=qs[_0x93bf('0x19')](_0x5e9a8a['query'][_0x93bf('0x19')]);_0x5b13fe[_0x93bf('0x17')]=qs[_0x93bf('0x17')](_0x5e9a8a[_0x93bf('0x27')][_0x93bf('0x17')]);}_0x5b13fe[_0x93bf('0x30')]=qs[_0x93bf('0x31')](_0x5e9a8a[_0x93bf('0x27')][_0x93bf('0x31')]);_0x5b13fe[_0x93bf('0x32')]=qs[_0x93bf('0x29')](_[_0x93bf('0x33')](_0x5e9a8a[_0x93bf('0x27')],_0x59d61a[_0x93bf('0x29')]),_0x1e1686);if(_0x5e9a8a[_0x93bf('0x27')]['filter']){_0x5b13fe[_0x93bf('0x32')]=_[_0x93bf('0x34')](_0x5b13fe[_0x93bf('0x32')],{'$or':_[_0x93bf('0x24')](_0x1e1686,function(_0x5b4fd9){if(_0x5b4fd9[_0x93bf('0x35')]!==_0x93bf('0x36')){var _0x593913={};_0x593913[_0x5b4fd9[_0x93bf('0x21')]]={'$like':'%'+_0x5e9a8a['query'][_0x93bf('0x37')]+'%'};return _0x593913;}})});}_0x5b13fe=_[_0x93bf('0x34')]({},_0x5b13fe,_0x5e9a8a['options']);var _0x4ebe14={'where':_0x5b13fe[_0x93bf('0x32')]};return db[_0x93bf('0x38')][_0x93bf('0x1a')](_0x4ebe14)['then'](function(_0x4c8a1e){_0x4966fe[_0x93bf('0x1a')]=_0x4c8a1e;if(_0x5e9a8a[_0x93bf('0x27')][_0x93bf('0x39')]){_0x5b13fe[_0x93bf('0x3a')]=[{'all':!![]}];}return db['Attachment'][_0x93bf('0x3b')](_0x5b13fe);})['then'](function(_0x387642){_0x4966fe[_0x93bf('0x3c')]=_0x387642;return _0x4966fe;})[_0x93bf('0x3d')](respondWithFilteredResult(_0x4fa684,_0x5b13fe))[_0x93bf('0x3e')](handleError(_0x4fa684,null));};exports['show']=function(_0xf38f18,_0x5a869a){var _0x1ce319={'raw':!![],'where':{'id':_0xf38f18[_0x93bf('0x3f')]['id']}},_0x476651={};_0x476651[_0x93bf('0x2a')]=_['keys'](db['Attachment'][_0x93bf('0x25')]);_0x476651[_0x93bf('0x27')]=_[_0x93bf('0x28')](_0xf38f18[_0x93bf('0x27')]);_0x476651[_0x93bf('0x29')]=_[_0x93bf('0x2c')](_0x476651[_0x93bf('0x2a')],_0x476651[_0x93bf('0x27')]);_0x1ce319['attributes']=_[_0x93bf('0x2c')](_0x476651[_0x93bf('0x2a')],qs[_0x93bf('0x2d')](_0xf38f18[_0x93bf('0x27')]['fields']));_0x1ce319[_0x93bf('0x2b')]=_0x1ce319[_0x93bf('0x2b')][_0x93bf('0x2e')]?_0x1ce319[_0x93bf('0x2b')]:_0x476651[_0x93bf('0x2a')];if(_0xf38f18['query'][_0x93bf('0x39')]){_0x1ce319[_0x93bf('0x3a')]=[{'all':!![]}];}_0x1ce319=_[_0x93bf('0x34')]({},_0x1ce319,_0xf38f18[_0x93bf('0x40')]);return db[_0x93bf('0x38')][_0x93bf('0x41')](_0x1ce319)[_0x93bf('0x3d')](handleEntityNotFound(_0x5a869a,null))[_0x93bf('0x3d')](respondWithResult(_0x5a869a,null))[_0x93bf('0x3e')](handleError(_0x5a869a,null));};exports['clone']=function(_0x2144bb,_0x59aa4d){var _0x46e4ba={'where':{'id':_0x2144bb[_0x93bf('0x3f')]['id']}},_0x245235={};_0x245235[_0x93bf('0x2a')]=_[_0x93bf('0x28')](db[_0x93bf('0x38')]['rawAttributes']);_0x46e4ba[_0x93bf('0x2b')]=_[_0x93bf('0x2c')](_0x245235['model'],qs[_0x93bf('0x2d')](_0x2144bb[_0x93bf('0x27')][_0x93bf('0x2d')]));_0x46e4ba['attributes']=_0x46e4ba[_0x93bf('0x2b')][_0x93bf('0x2e')]?_0x46e4ba[_0x93bf('0x2b')]:_0x245235[_0x93bf('0x2a')];if(_0x2144bb[_0x93bf('0x27')]['includeAll']){_0x46e4ba[_0x93bf('0x3a')]=[{'all':!![]}];}_0x46e4ba=_[_0x93bf('0x34')]({},_0x46e4ba,_0x2144bb[_0x93bf('0x40')]);return db['Attachment'][_0x93bf('0x41')](_0x46e4ba)[_0x93bf('0x3d')](handleEntityNotFound(_0x59aa4d,null))['then'](function(_0xd1271){if(_0xd1271){var _0x4692dc=_0xd1271[_0x93bf('0x42')]({'plain':!![]});_0x4692dc=qs[_0x93bf('0x43')](_0x4692dc,['id',_0x93bf('0x44'),_0x93bf('0x45')]);_0x2144bb[_0x93bf('0x46')]=_['omit'](_0x2144bb['body'],['id',_0x93bf('0x44'),'updatedAt']);return db[_0x93bf('0x38')]['create'](_['merge'](_0x4692dc,_0x2144bb[_0x93bf('0x46')]),{'include':_0x2144bb['query'][_0x93bf('0x39')]?[{'all':!![]}]:undefined});}})[_0x93bf('0x3d')](respondWithResult(_0x59aa4d,0xc9))['catch'](handleError(_0x59aa4d,null));};exports['update']=function(_0x3d8dd4,_0x27fc05){if(_0x3d8dd4[_0x93bf('0x46')]['id']){delete _0x3d8dd4['body']['id'];}return db[_0x93bf('0x38')][_0x93bf('0x41')]({'where':{'id':_0x3d8dd4[_0x93bf('0x3f')]['id']}})[_0x93bf('0x3d')](handleEntityNotFound(_0x27fc05,null))[_0x93bf('0x3d')](saveUpdates(_0x3d8dd4[_0x93bf('0x46')],null))[_0x93bf('0x3d')](respondWithResult(_0x27fc05,null))[_0x93bf('0x3e')](handleError(_0x27fc05,null));};exports[_0x93bf('0x47')]=function(_0x5ccbf7,_0x54c9bf){return db[_0x93bf('0x38')][_0x93bf('0x41')]({'where':{'id':_0x5ccbf7[_0x93bf('0x3f')]['id']}})['then'](handleEntityNotFound(_0x54c9bf,null))['then'](removeEntity(_0x54c9bf,null))[_0x93bf('0x3e')](handleError(_0x54c9bf,null));};exports[_0x93bf('0x48')]=function(_0xcbc0ab,_0x31652f,_0x48ed16){_0xcbc0ab[_0x93bf('0x46')][_0x93bf('0x21')]=_0xcbc0ab[_0x93bf('0x49')][_0x93bf('0x4a')];_0xcbc0ab[_0x93bf('0x46')][_0x93bf('0x4b')]=_0xcbc0ab['file']['filename'];_0xcbc0ab[_0x93bf('0x46')][_0x93bf('0x35')]=_0xcbc0ab['file'][_0x93bf('0x4c')];return db['Attachment'][_0x93bf('0x48')](_0xcbc0ab[_0x93bf('0x46')])['then'](respondWithResult(_0x31652f,0xc9))[_0x93bf('0x3e')](handleError(_0x31652f,null));};exports[_0x93bf('0x4d')]=function(_0x13204d,_0x2ea896,_0x488751){return db['Attachment'][_0x93bf('0x4e')]({'where':{'id':_0x13204d['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2ea896,null))[_0x93bf('0x3d')](function(_0x32d28a){if(_0x32d28a){var _0x143499=_0x32d28a[_0x93bf('0x4f')]!==null;var _0x509d14=path[_0x93bf('0x50')](config[_0x93bf('0x51')],_0x93bf('0x52'));if(_0x143499){_0x509d14=path[_0x93bf('0x50')](_0x509d14,_0x93bf('0x53'));}var _0xebdbf2=path['join'](_0x509d14,_0x32d28a[_0x93bf('0x4b')]);return _0x2ea896[_0x93bf('0x4d')](_0xebdbf2);}})['catch'](handleError(_0x2ea896,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index cb8bbc4..88d6644 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 _0xfdf9=['attachments','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./attachment.attributes','exports','Attachment'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xfdf9,0x1ae));var _0x9fdf=function(_0x2c4050,_0x1c56eb){_0x2c4050=_0x2c4050-0x0;var _0x536ef4=_0xfdf9[_0x2c4050];return _0x536ef4;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var logger=require(_0x9fdf('0x2'))(_0x9fdf('0x3'));var moment=require('moment');var BPromise=require(_0x9fdf('0x4'));var rp=require(_0x9fdf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9fdf('0x6'));var attributes=require(_0x9fdf('0x7'));module[_0x9fdf('0x8')]=function(_0xdaf153,_0x51ec43){return _0xdaf153['define'](_0x9fdf('0x9'),attributes,{'tableName':_0x9fdf('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d14=['define','util','api','moment','bluebird','path','../../config/environment','./attachment.attributes','exports'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x7d14,0x1a8));var _0x47d1=function(_0x117fb1,_0x4b9774){_0x117fb1=_0x117fb1-0x0;var _0x53db22=_0x7d14[_0x117fb1];return _0x53db22;};'use strict';var _=require('lodash');var util=require(_0x47d1('0x0'));var logger=require('../../config/logger')(_0x47d1('0x1'));var moment=require(_0x47d1('0x2'));var BPromise=require(_0x47d1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47d1('0x4'));var rimraf=require('rimraf');var config=require(_0x47d1('0x5'));var attributes=require(_0x47d1('0x6'));module[_0x47d1('0x7')]=function(_0x3acd27,_0x47333b){return _0x3acd27[_0x47d1('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 26f079e..ba75b1c 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 _0xa1fd=['jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','CreateAttachment','create','body','options','raw','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x21cb7f,_0x48cd16){_0x21cb7f=_0x21cb7f-0x0;var _0x5a079a=_0xa1fd[_0x21cb7f];return _0x5a079a;};'use strict';var _=require(_0xda1f('0x0'));var util=require(_0xda1f('0x1'));var moment=require(_0xda1f('0x2'));var BPromise=require(_0xda1f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xda1f('0x4'));var db=require(_0xda1f('0x5'))['db'];var utils=require(_0xda1f('0x6'));var logger=require(_0xda1f('0x7'))(_0xda1f('0x8'));var config=require('../../config/environment');var jayson=require(_0xda1f('0x9'));var client=jayson[_0xda1f('0xa')][_0xda1f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x552ba4,_0x33502e,_0x46a29e){return new BPromise(function(_0x199a8d,_0x338463){return client[_0xda1f('0xc')](_0x552ba4,_0x46a29e)[_0xda1f('0xd')](function(_0x1493f8){logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,'request\x20sent');logger[_0xda1f('0x10')](_0xda1f('0x11'),_0x33502e,_0xda1f('0x12'),JSON[_0xda1f('0x13')](_0x1493f8));if(_0x1493f8['error']){if(_0x1493f8['error'][_0xda1f('0x14')]===0x1f4){logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x338463(_0x1493f8['error'][_0xda1f('0x16')]);}logger[_0xda1f('0x15')](_0xda1f('0xf'),_0x33502e,_0x1493f8[_0xda1f('0x15')][_0xda1f('0x16')]);return _0x199a8d(_0x1493f8[_0xda1f('0x15')]['message']);}else{logger[_0xda1f('0xe')](_0xda1f('0xf'),_0x33502e,_0xda1f('0x12'));_0x199a8d(_0x1493f8[_0xda1f('0x17')]['message']);}})['catch'](function(_0x3020ea){logger['error'](_0xda1f('0xf'),_0x33502e,_0x3020ea);_0x338463(_0x3020ea);});});}exports[_0xda1f('0x18')]=function(_0x1e10af){var _0x59b7bf=this;return new Promise(function(_0xe81fc2,_0xe18a0a){return db['Attachment'][_0xda1f('0x19')](_0x1e10af[_0xda1f('0x1a')],{'raw':_0x1e10af['options']?_0x1e10af[_0xda1f('0x1b')][_0xda1f('0x1c')]===undefined?!![]:![]:!![]})[_0xda1f('0xd')](function(_0xe85e94){logger[_0xda1f('0xe')](_0xda1f('0x18'),_0x1e10af);logger[_0xda1f('0x10')](_0xda1f('0x18'),_0x1e10af,JSON[_0xda1f('0x13')](_0xe85e94));_0xe81fc2(_0xe85e94);})[_0xda1f('0x1d')](function(_0x1d510b){logger[_0xda1f('0x15')]('CreateAttachment',_0x1d510b[_0xda1f('0x16')],_0x1e10af);_0xe18a0a(_0x59b7bf['error'](0x1f4,_0x1d510b[_0xda1f('0x16')]));});});}; \ No newline at end of file +var _0xf53f=['create','options','raw','then','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','error','code','message','info','result','CreateAttachment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf53f,0x8d));var _0xff53=function(_0x532bbb,_0x466c76){_0x532bbb=_0x532bbb-0x0;var _0x32a4eb=_0xf53f[_0x532bbb];return _0x32a4eb;};'use strict';var _=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var moment=require(_0xff53('0x2'));var BPromise=require(_0xff53('0x3'));var rs=require(_0xff53('0x4'));var fs=require('fs');var Redis=require(_0xff53('0x5'));var db=require(_0xff53('0x6'))['db'];var utils=require(_0xff53('0x7'));var logger=require(_0xff53('0x8'))(_0xff53('0x9'));var config=require(_0xff53('0xa'));var jayson=require(_0xff53('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x27b397,_0x5751e7,_0x1c27bb){return new BPromise(function(_0x122746,_0x1bc4b3){return client['request'](_0x27b397,_0x1c27bb)['then'](function(_0x3c001d){logger['info'](_0xff53('0xc'),_0x5751e7,_0xff53('0xd'));logger['debug'](_0xff53('0xe'),_0x5751e7,_0xff53('0xd'),JSON['stringify'](_0x3c001d));if(_0x3c001d[_0xff53('0xf')]){if(_0x3c001d[_0xff53('0xf')][_0xff53('0x10')]===0x1f4){logger['error'](_0xff53('0xc'),_0x5751e7,_0x3c001d[_0xff53('0xf')][_0xff53('0x11')]);return _0x1bc4b3(_0x3c001d['error'][_0xff53('0x11')]);}logger[_0xff53('0xf')]('Attachment,\x20%s,\x20%s',_0x5751e7,_0x3c001d['error']['message']);return _0x122746(_0x3c001d['error'][_0xff53('0x11')]);}else{logger[_0xff53('0x12')](_0xff53('0xc'),_0x5751e7,'request\x20sent');_0x122746(_0x3c001d[_0xff53('0x13')]['message']);}})['catch'](function(_0x12e90b){logger[_0xff53('0xf')](_0xff53('0xc'),_0x5751e7,_0x12e90b);_0x1bc4b3(_0x12e90b);});});}exports[_0xff53('0x14')]=function(_0x38883f){var _0x319ce5=this;return new Promise(function(_0x14b502,_0x5e9ba6){return db['Attachment'][_0xff53('0x15')](_0x38883f['body'],{'raw':_0x38883f[_0xff53('0x16')]?_0x38883f[_0xff53('0x16')][_0xff53('0x17')]===undefined?!![]:![]:!![]})[_0xff53('0x18')](function(_0x39b3d1){logger[_0xff53('0x12')](_0xff53('0x14'),_0x38883f);logger[_0xff53('0x19')](_0xff53('0x14'),_0x38883f,JSON['stringify'](_0x39b3d1));_0x14b502(_0x39b3d1);})[_0xff53('0x1a')](function(_0x5cd878){logger['error']('CreateAttachment',_0x5cd878['message'],_0x38883f);_0x5e9ba6(_0x319ce5[_0xff53('0xf')](0x1f4,_0x5cd878[_0xff53('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index ecf0d64..d3d6541 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x296b2a,_0x4e53b2){var _0x3c9ac0=function(_0x5c38fb){while(--_0x5c38fb){_0x296b2a['push'](_0x296b2a['shift']());}};_0x3c9ac0(++_0x4e53b2);}(_0xb10b,0x12a));var _0xbb10=function(_0x5235a6,_0x680b76){_0x5235a6=_0x5235a6-0x0;var _0x1cf37e=_0xb10b[_0x5235a6];return _0x1cf37e;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x17782b,_0x2002a4){var _0x3e58d3=function(_0x568cbc){while(--_0x568cbc){_0x17782b['push'](_0x17782b['shift']());}};_0x3e58d3(++_0x2002a4);}(_0x2032,0xd9));var _0x2203=function(_0x36d597,_0x2c8d48){_0x36d597=_0x36d597-0x0;var _0x284878=_0x2032[_0x36d597];return _0x284878;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 1496e77..97b9a8a 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 _0x7beb=['user','blockDuration','blocked','add','minutes','clearBlockUser','getLicense','catch','message','login','ad-login','signToken','json','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','api','undefined','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blockedAt','online','admin'];(function(_0x4ca9d2,_0x408f4b){var _0x1232eb=function(_0x3a0122){while(--_0x3a0122){_0x4ca9d2['push'](_0x4ca9d2['shift']());}};_0x1232eb(++_0x408f4b);}(_0x7beb,0xc5));var _0xb7be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7beb[_0x3dd15e];return _0x231fd0;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0xb7be('0x0')];var moment=require(_0xb7be('0x1'));var ActiveDirectory=require(_0xb7be('0x2'));var BPromise=require(_0xb7be('0x3'));var util=require(_0xb7be('0x4'));var db=require('../../mysqldb')['db'];var authService=require(_0xb7be('0x5'));var utils=require(_0xb7be('0x6'));var config=require(_0xb7be('0x7'));var logger=require(_0xb7be('0x8'))(_0xb7be('0x9'));function isActiveDirectoryConfigured(_0x3983ad){var _0x190537=![];if(typeof _0x3983ad['activedirectory']!==_0xb7be('0xa')){_0x190537=_0x3983ad[_0xb7be('0xb')][_0xb7be('0xc')]&&_0x3983ad[_0xb7be('0xb')][_0xb7be('0xd')]&&_0x3983ad[_0xb7be('0xb')][_0xb7be('0xe')];}return _0x190537;}function adAuthenticate(_0x5c6e5c,_0x7b15b0,_0x79a76f){return new BPromise(function(_0x4bfe1f,_0x3908ec){try{var _0xfbf51d=new ActiveDirectory(_0x5c6e5c);_0xfbf51d[_0xb7be('0xf')](_0x7b15b0,_0x79a76f,function(_0x427e87,_0xf967fe){if(_0x427e87){logger[_0xb7be('0x10')](_0xb7be('0x11'),_0x7b15b0,util[_0xb7be('0x12')](_0x427e87,{'showHidden':![],'depth':null}));_0x3908ec(_0xb7be('0x13'));}else if(!_0xf967fe){logger[_0xb7be('0x10')](_0xb7be('0x14'),_0x7b15b0);_0x3908ec('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4bfe1f(_0xf967fe);}});}catch(_0x163045){_0x3908ec(_0x163045);}});}function ActiveDirectoryAuthenticate(_0x3e2472,_0x56ba65,_0xd47629,_0x11a1b3){var _0x56d0b1,_0x43a1fd;if(!isActiveDirectoryConfigured(config)){logger[_0xb7be('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x56ba65);return _0x11a1b3(null,![],{'message':_0xb7be('0x13')});}return db[_0xb7be('0x15')][_0xb7be('0x16')]({'where':{'id':0x1},'attributes':[_0xb7be('0x17'),'blockDuration'],'raw':!![]})[_0xb7be('0x18')](function(_0x3fa0dc){_0x56d0b1=_0x3fa0dc;if(!_0x56d0b1[_0xb7be('0x17')]){logger[_0xb7be('0x10')](_0xb7be('0x19'),_0x56ba65);throw new Error(_0xb7be('0x13'));}return _0x3e2472[_0xb7be('0x16')]({'attributes':['id',_0xb7be('0x1a'),_0xb7be('0x1b'),_0xb7be('0x1c'),_0xb7be('0x1d'),'disabled','blocked',_0xb7be('0x1e'),_0xb7be('0x1f')],'where':{'name':_0x56ba65,'role':{'$or':[_0xb7be('0x20'),_0xb7be('0x21'),'agent']},'adSsoEnabled':!![]}});})['then'](function(_0x39d22a){if(!_0x39d22a||_0x39d22a&&_0x39d22a[_0xb7be('0x1a')]!==_0x56ba65){throw new Error(_0xb7be('0x13'));}_0x43a1fd=_0x39d22a;var _0x29d3e0=_0x43a1fd['name']+'@'+config['activedirectory'][_0xb7be('0xe')];return adAuthenticate(config[_0xb7be('0xb')],_0x29d3e0,_0xd47629);})[_0xb7be('0x18')](function(_0x15f288){if(_0x43a1fd['disabled']){throw new Error(_0xb7be('0x13'));}if(_0x56d0b1[_0xb7be('0x22')]>0x0){if(_0x43a1fd[_0xb7be('0x23')]){if(moment(_0x43a1fd[_0xb7be('0x1e')])[_0xb7be('0x24')](_0x56d0b1[_0xb7be('0x22')],_0xb7be('0x25'))>moment()){throw new Error(_0xb7be('0x13'));}return utils[_0xb7be('0x26')](_0x43a1fd,0x0,![],null)[_0xb7be('0x18')](function(){return utils[_0xb7be('0x27')](_0x43a1fd);})[_0xb7be('0x18')](function(){return _0x11a1b3(null,_0x43a1fd);});}else{return utils[_0xb7be('0x27')](_0x43a1fd)['then'](function(){return _0x11a1b3(null,_0x43a1fd);});}}else{return utils[_0xb7be('0x27')](_0x43a1fd)[_0xb7be('0x18')](function(){return _0x11a1b3(null,_0x43a1fd);});}})[_0xb7be('0x28')](function(_0x2a7e91){return _0x11a1b3(null,![],_0x2a7e91);});}function handleError(_0x2bb12f,_0x196df7,_0x6e26e5){return _0x2bb12f['status'](_0x196df7||0x1f4)['send']({'message':_0x6e26e5?_0x6e26e5[_0xb7be('0x29')]||_0x6e26e5:''});}exports[_0xb7be('0x2a')]=function(_0x56aa67,_0x30099f,_0x52bb54){passport['authenticate'](_0xb7be('0x2b'),function(_0x5cef3f,_0x4257ab,_0x32a36a){var _0x4c52d9=_0x5cef3f||_0x32a36a;if(_0x4c52d9){return handleError(_0x30099f,0x191,_0x4c52d9);}if(!_0x4257ab){return handleError(_0x30099f,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x28c895={'payload':{'id':_0x4257ab['id'],'role':_0x4257ab[_0xb7be('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0xb7be('0x2c')](_0x28c895)[_0xb7be('0x18')](function(_0xbb43cf){_0x30099f[_0xb7be('0x2d')]({'id':_0x4257ab['id'],'token':_0xbb43cf,'statusCall':'','isAlreadyLogged':_0x4257ab['online']});});}})(_0x56aa67,_0x30099f,_0x52bb54);};passport['use'](_0xb7be('0x2b'),new LocalStrategy({'usernameField':_0xb7be('0x1a'),'passwordField':_0xb7be('0x1b')},function(_0x733749,_0x2a2b05,_0x1c30ea){return ActiveDirectoryAuthenticate(db['User'],_0x733749,_0x2a2b05,_0x1c30ea);})); \ No newline at end of file +var _0x1775=['baseDN','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled','blocked','online','admin','user','blockedAt','add','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','User','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/environment','activedirectory','undefined'];(function(_0x19318e,_0x46c067){var _0x425540=function(_0xb4e055){while(--_0xb4e055){_0x19318e['push'](_0x19318e['shift']());}};_0x425540(++_0x46c067);}(_0x1775,0x16d));var _0x5177=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1775[_0x17d9e3];return _0x14192d;};'use strict';var passport=require('passport');var LocalStrategy=require('passport-local')[_0x5177('0x0')];var moment=require(_0x5177('0x1'));var ActiveDirectory=require(_0x5177('0x2'));var BPromise=require(_0x5177('0x3'));var util=require(_0x5177('0x4'));var db=require(_0x5177('0x5'))['db'];var authService=require(_0x5177('0x6'));var utils=require(_0x5177('0x7'));var config=require(_0x5177('0x8'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x9b2d38){var _0x43e4a1=![];if(typeof _0x9b2d38[_0x5177('0x9')]!==_0x5177('0xa')){_0x43e4a1=_0x9b2d38['activedirectory'][_0x5177('0xb')]&&_0x9b2d38[_0x5177('0x9')]['url']&&_0x9b2d38['activedirectory'][_0x5177('0xc')];}return _0x43e4a1;}function adAuthenticate(_0x3437bd,_0x1c8c5d,_0x410400){return new BPromise(function(_0x387d43,_0x3ece0c){try{var _0x437063=new ActiveDirectory(_0x3437bd);_0x437063[_0x5177('0xd')](_0x1c8c5d,_0x410400,function(_0x58264d,_0x15541e){if(_0x58264d){logger[_0x5177('0xe')](_0x5177('0xf'),_0x1c8c5d,util[_0x5177('0x10')](_0x58264d,{'showHidden':![],'depth':null}));_0x3ece0c(_0x5177('0x11'));}else if(!_0x15541e){logger[_0x5177('0xe')](_0x5177('0x12'),_0x1c8c5d);_0x3ece0c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x387d43(_0x15541e);}});}catch(_0x4403e3){_0x3ece0c(_0x4403e3);}});}function ActiveDirectoryAuthenticate(_0x5773eb,_0x122742,_0x59b42e,_0xd9c6bb){var _0x51a62f,_0x1335bb;if(!isActiveDirectoryConfigured(config)){logger[_0x5177('0xe')](_0x5177('0x13'),_0x122742);return _0xd9c6bb(null,![],{'message':_0x5177('0x11')});}return db['Setting'][_0x5177('0x14')]({'where':{'id':0x1},'attributes':[_0x5177('0x15'),_0x5177('0x16')],'raw':!![]})[_0x5177('0x17')](function(_0x40cc97){_0x51a62f=_0x40cc97;if(!_0x51a62f[_0x5177('0x15')]){logger[_0x5177('0xe')](_0x5177('0x18'),_0x122742);throw new Error(_0x5177('0x11'));}return _0x5773eb[_0x5177('0x14')]({'attributes':['id',_0x5177('0x19'),_0x5177('0x1a'),_0x5177('0x1b'),'role',_0x5177('0x1c'),_0x5177('0x1d'),'blockedAt',_0x5177('0x1e')],'where':{'name':_0x122742,'role':{'$or':[_0x5177('0x1f'),_0x5177('0x20'),'agent']},'adSsoEnabled':!![]}});})[_0x5177('0x17')](function(_0x168905){if(!_0x168905||_0x168905&&_0x168905['name']!==_0x122742){throw new Error(_0x5177('0x11'));}_0x1335bb=_0x168905;var _0x5de98c=_0x1335bb[_0x5177('0x19')]+'@'+config[_0x5177('0x9')]['domain'];return adAuthenticate(config[_0x5177('0x9')],_0x5de98c,_0x59b42e);})[_0x5177('0x17')](function(_0x4edaf9){if(_0x1335bb[_0x5177('0x1c')]){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x51a62f[_0x5177('0x16')]>0x0){if(_0x1335bb[_0x5177('0x1d')]){if(moment(_0x1335bb[_0x5177('0x21')])[_0x5177('0x22')](_0x51a62f[_0x5177('0x16')],'minutes')>moment()){throw new Error(_0x5177('0x11'));}return utils[_0x5177('0x23')](_0x1335bb,0x0,![],null)[_0x5177('0x17')](function(){return utils['getLicense'](_0x1335bb);})[_0x5177('0x17')](function(){return _0xd9c6bb(null,_0x1335bb);});}else{return utils[_0x5177('0x24')](_0x1335bb)[_0x5177('0x17')](function(){return _0xd9c6bb(null,_0x1335bb);});}}else{return utils[_0x5177('0x24')](_0x1335bb)[_0x5177('0x17')](function(){return _0xd9c6bb(null,_0x1335bb);});}})['catch'](function(_0x516447){return _0xd9c6bb(null,![],_0x516447);});}function handleError(_0x596b1b,_0x3f5b34,_0x1a3bdb){return _0x596b1b[_0x5177('0x25')](_0x3f5b34||0x1f4)[_0x5177('0x26')]({'message':_0x1a3bdb?_0x1a3bdb[_0x5177('0x27')]||_0x1a3bdb:''});}exports[_0x5177('0x28')]=function(_0x364475,_0x370782,_0x32ca55){passport['authenticate'](_0x5177('0x29'),function(_0x4290e2,_0x583bc6,_0x45db02){var _0x4305ca=_0x4290e2||_0x45db02;if(_0x4305ca){return handleError(_0x370782,0x191,_0x4305ca);}if(!_0x583bc6){return handleError(_0x370782,0x194,{'message':_0x5177('0x2a')});}else{var _0x49b649={'payload':{'id':_0x583bc6['id'],'role':_0x583bc6['role']},'options':{'expiresIn':0x15180}};return authService[_0x5177('0x2b')](_0x49b649)[_0x5177('0x17')](function(_0x4c5188){_0x370782[_0x5177('0x2c')]({'id':_0x583bc6['id'],'token':_0x4c5188,'statusCall':'','isAlreadyLogged':_0x583bc6['online']});});}})(_0x364475,_0x370782,_0x32ca55);};passport[_0x5177('0x2d')](_0x5177('0x29'),new LocalStrategy({'usernameField':'name','passwordField':_0x5177('0x1a')},function(_0x2ee1c8,_0x1f0a5a,_0x352a7b){return ActiveDirectoryAuthenticate(db[_0x5177('0x2e')],_0x2ee1c8,_0x1f0a5a,_0x352a7b);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index f7f31a1..5bd9a69 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 _0xb3d9=['post','exports','Router'];(function(_0x2cfb48,_0x24b83b){var _0xc4594f=function(_0x3bc089){while(--_0x3bc089){_0x2cfb48['push'](_0x2cfb48['shift']());}};_0xc4594f(++_0x24b83b);}(_0xb3d9,0x18b));var _0x9b3d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3d9[_0x20a584];return _0x4b41a8;};'use strict';var express=require('express');var router=express[_0x9b3d('0x0')]();var controller=require('./authActiveDirectory.controller');router[_0x9b3d('0x1')]('/',controller['login']);module[_0x9b3d('0x2')]=router; \ No newline at end of file +var _0x3e45=['exports','express','./authActiveDirectory.controller','post','login'];(function(_0x21ab9a,_0x43eb66){var _0x15d4c6=function(_0x4932c2){while(--_0x4932c2){_0x21ab9a['push'](_0x21ab9a['shift']());}};_0x15d4c6(++_0x43eb66);}(_0x3e45,0x105));var _0x53e4=function(_0x3ab184,_0x1fa593){_0x3ab184=_0x3ab184-0x0;var _0x4765ac=_0x3e45[_0x3ab184];return _0x4765ac;};'use strict';var express=require(_0x53e4('0x0'));var router=express['Router']();var controller=require(_0x53e4('0x1'));router[_0x53e4('0x2')]('/',controller[_0x53e4('0x3')]);module[_0x53e4('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index d8a1025..a03740d 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(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x1c8301,_0xd9504c){_0x1c8301=_0x1c8301-0x0;var _0x4c4f05=_0x7a54[_0x1c8301];return _0x4c4f05;};'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(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x7a54,0x106));var _0x47a5=function(_0x15f3f6,_0x3ba6f4){_0x15f3f6=_0x15f3f6-0x0;var _0xc78ebf=_0x7a54[_0x15f3f6];return _0xc78ebf;};'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 994837d..b6f81ae 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 _0x6068=['passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','setTokenCookie','exports'];(function(_0x30f6c2,_0x4a187a){var _0x1a7f9d=function(_0x227f87){while(--_0x227f87){_0x30f6c2['push'](_0x30f6c2['shift']());}};_0x1a7f9d(++_0x4a187a);}(_0x6068,0x134));var _0x8606=function(_0x53f608,_0x256def){_0x53f608=_0x53f608-0x0;var _0x495b7d=_0x6068[_0x53f608];return _0x495b7d;};'use strict';var express=require('express');var passport=require(_0x8606('0x0'));var router=express[_0x8606('0x1')]();var controller=require(_0x8606('0x2'));var userController=require(_0x8606('0x3'));var authService=require(_0x8606('0x4'));router[_0x8606('0x5')]('/',controller[_0x8606('0x6')]);router[_0x8606('0x5')](_0x8606('0x7'),controller['callback'],authService[_0x8606('0x8')],userController[_0x8606('0x6')],authService[_0x8606('0x9')]);module[_0x8606('0xa')]=router; \ No newline at end of file +var _0xe943=['../user/user.controller.js','../../components/auth/service','callback','isMiddleware','login','setTokenCookie','passport','Router','./authGoogle.controller'];(function(_0x51c8ac,_0x28f4fc){var _0x6c565f=function(_0x2f61d4){while(--_0x2f61d4){_0x51c8ac['push'](_0x51c8ac['shift']());}};_0x6c565f(++_0x28f4fc);}(_0xe943,0xb1));var _0x3e94=function(_0x5e4563,_0x3ff918){_0x5e4563=_0x5e4563-0x0;var _0x8d1bf5=_0xe943[_0x5e4563];return _0x8d1bf5;};'use strict';var express=require('express');var passport=require(_0x3e94('0x0'));var router=express[_0x3e94('0x1')]();var controller=require(_0x3e94('0x2'));var userController=require(_0x3e94('0x3'));var authService=require(_0x3e94('0x4'));router['get']('/',controller['login']);router['get']('/callback',controller[_0x3e94('0x5')],authService[_0x3e94('0x6')],userController[_0x3e94('0x7')],authService[_0x3e94('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index a15d3d0..c0cd5b3 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 _0x66de=['error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','status','send','message','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','Email\x20parameter\x20is\x20missing','generate','body','toLowerCase','Setting','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','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','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','jayson/promise','lodash','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','blocked','blockedAt','admin','agent','authenticate','loginAttempts','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','format','\x22%s\x22\x20<%s>','user','SendMail'];(function(_0x1662a7,_0x38e198){var _0x2dab2a=function(_0x56288c){while(--_0x56288c){_0x1662a7['push'](_0x1662a7['shift']());}};_0x2dab2a(++_0x38e198);}(_0x66de,0x169));var _0xe66d=function(_0x47fb54,_0x28698c){_0x47fb54=_0x47fb54-0x0;var _0x1139a7=_0x66de[_0x47fb54];return _0x1139a7;};'use strict';var util=require('util');var passport=require(_0xe66d('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var jayson=require(_0xe66d('0x1'));var _=require(_0xe66d('0x2'));var rs=require('randomstring');var moment=require('moment');var db=require('../../mysqldb')['db'];var authService=require(_0xe66d('0x3'));var utils=require(_0xe66d('0x4'));var client=jayson[_0xe66d('0x5')][_0xe66d('0x6')]({'port':0x232b});function localAuthenticate(_0x44ca83,_0xba4e17,_0x36b23c,_0x24bd1d){var _0x251a27,_0x2719ba;return db['Setting'][_0xe66d('0x7')]({'where':{'id':0x1},'attributes':[_0xe66d('0x8'),_0xe66d('0x9')],'raw':!![]})[_0xe66d('0xa')](function(_0x1f68cf){_0x251a27=_0x1f68cf;return _0x44ca83[_0xe66d('0x7')]({'attributes':['id',_0xe66d('0xb'),_0xe66d('0xc'),_0xe66d('0xd'),_0xe66d('0xe'),'disabled',_0xe66d('0xf'),_0xe66d('0x10'),'loginAttempts'],'where':{'name':_0xba4e17,'role':{'$or':[_0xe66d('0x11'),'user',_0xe66d('0x12')]}}});})['then'](function(_0x460e5b){if(!_0x460e5b||_0x460e5b&&_0x460e5b[_0xe66d('0xb')]!==_0xba4e17){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2719ba=_0x460e5b;return _0x2719ba;}})[_0xe66d('0xa')](function(){_0x2719ba[_0xe66d('0x13')](_0x36b23c,function(_0xc26068,_0x1afe92){var _0x2ac2f0=_0x2719ba[_0xe66d('0x14')]+0x1;if(_0xc26068){return _0x24bd1d(_0xc26068);}else if(!_0x1afe92){if(_0x2719ba[_0xe66d('0x15')]){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}else if(_0x251a27[_0xe66d('0x8')]>0x0){if(_0x2719ba[_0xe66d('0xf')]){if(_0x251a27[_0xe66d('0x9')]>0x0){if(moment(_0x2719ba[_0xe66d('0x10')])[_0xe66d('0x17')](_0x251a27[_0xe66d('0x9')],_0xe66d('0x18'))>moment()){return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe66d('0x19')](_0x2719ba,_0x2ac2f0,![],null)[_0xe66d('0xa')](function(){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});});}}else{return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2ac2f0>=_0x251a27[_0xe66d('0x8')]){return utils[_0xe66d('0x19')](_0x2719ba,0x0,!![],moment())[_0xe66d('0xa')](function(){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});});}else{return utils[_0xe66d('0x19')](_0x2719ba,_0x2ac2f0,![],null)[_0xe66d('0xa')](function(){return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}}else{if(_0x2719ba[_0xe66d('0x15')]){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}else if(_0x251a27[_0xe66d('0x8')]>0x0){if(_0x2719ba[_0xe66d('0xf')]){if(_0x251a27[_0xe66d('0x9')]>0x0){if(moment(_0x2719ba['blockedAt'])[_0xe66d('0x17')](_0x251a27['blockDuration'],_0xe66d('0x18'))>moment()){return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}else{return utils[_0xe66d('0x19')](_0x2719ba,0x0,![],null)[_0xe66d('0xa')](function(){return utils['getLicense'](_0x2719ba);})[_0xe66d('0xa')](function(){return _0x24bd1d(null,_0x2719ba);});}}else{return _0x24bd1d(null,![],{'message':_0xe66d('0x16')});}}else{return utils['clearBlockUser'](_0x2719ba,0x0,![],null)[_0xe66d('0xa')](function(){return utils[_0xe66d('0x1a')](_0x2719ba);})[_0xe66d('0xa')](function(){return _0x24bd1d(null,_0x2719ba);})[_0xe66d('0x1b')](function(_0x291824){return _0x24bd1d(null,![],_0x291824);});}}else{if(_0x2719ba[_0xe66d('0xf')]){return _0x24bd1d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0xe66d('0x1a')](_0x2719ba)[_0xe66d('0xa')](function(){return _0x24bd1d(null,_0x2719ba);});}}}});})[_0xe66d('0x1b')](function(_0x1eb2cc){return _0x24bd1d(null,![],_0x1eb2cc);});}function sendServiceMail(_0x5ecc75){return db['MailAccount'][_0xe66d('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xe66d('0xb'),_0xe66d('0x1d')],'include':[{'model':db[_0xe66d('0x1e')],'as':_0xe66d('0x1f'),'include':[{'model':db[_0xe66d('0x20')],'as':_0xe66d('0x20')}]}]})[_0xe66d('0xa')](function(_0xda9181){if(!_0xda9181){throw new Error(_0xe66d('0x21'));}var _0x3b1603=_0xda9181['getSmtpOptions']();var _0x32a84d={'account':_0x3b1603,'message':_[_0xe66d('0x22')]({'from':util[_0xe66d('0x23')](_0xe66d('0x24'),_0xda9181['name'],_0xda9181[_0xe66d('0x1d')]||_0xda9181[_0xe66d('0x1f')][_0xe66d('0x25')])},_0x5ecc75)};return client['request'](_0xe66d('0x26'),_0x32a84d);})['then'](function(_0x53b47a){if(_0x53b47a[_0xe66d('0x27')]){throw new Error(util[_0xe66d('0x23')](_0xe66d('0x28'),_0x53b47a[_0xe66d('0x27')]['message']||JSON['stringify'](_0x53b47a['error'])));}return!![];});}function handleError(_0x2dbfca,_0x1b3223,_0x2e3fd2){return _0x2dbfca[_0xe66d('0x29')](_0x1b3223||0x1f4)[_0xe66d('0x2a')]({'message':_0x2e3fd2?_0x2e3fd2[_0xe66d('0x2b')]||_0x2e3fd2:''});}exports[_0xe66d('0x2c')]=function(_0x4bb9e7,_0x2bafd1,_0xa83e64){passport[_0xe66d('0x13')](_0xe66d('0x2d'),function(_0x5b8712,_0x39e3b7,_0x290329){var _0x2fbfd3=_0x5b8712||_0x290329;if(_0x2fbfd3){return handleError(_0x2bafd1,0x191,_0x2fbfd3);}if(!_0x39e3b7){return handleError(_0x2bafd1,0x194,{'message':_0xe66d('0x2e')});}else{var _0x5efe0e={'payload':{'id':_0x39e3b7['id'],'role':_0x39e3b7[_0xe66d('0xe')]},'options':{'expiresIn':0x15180}};return authService[_0xe66d('0x2f')](_0x5efe0e)[_0xe66d('0xa')](function(_0x337f1f){_0x2bafd1[_0xe66d('0x30')]({'id':_0x39e3b7['id'],'token':_0x337f1f,'statusCall':'','isAlreadyLogged':_0x39e3b7[_0xe66d('0x31')]});});}})(_0x4bb9e7,_0x2bafd1,_0xa83e64);};exports[_0xe66d('0x32')]=function(_0x4006b2,_0x6908cf){if(!_0x4006b2['body'][_0xe66d('0x1d')]){return handleError(_0x6908cf,0x1f4,{'message':_0xe66d('0x33')});}var _0x9ad157=rs[_0xe66d('0x34')]();_0x4006b2[_0xe66d('0x35')]['email']=_0x4006b2['body'][_0xe66d('0x1d')]['trim']()[_0xe66d('0x36')]();var _0x2fdc0c;return db[_0xe66d('0x37')]['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xe66d('0x9')],'raw':!![]})[_0xe66d('0xa')](function(_0xe9fb4a){_0x2fdc0c=_0xe9fb4a;return db['User'][_0xe66d('0x1c')]({'where':{'email':_0x4006b2[_0xe66d('0x35')][_0xe66d('0x1d')]}});})[_0xe66d('0xa')](function(_0x54f0b6){if(!_0x54f0b6){throw new Error(_0xe66d('0x38'));}if(_0x54f0b6[_0xe66d('0x15')]){throw new Error(_0xe66d('0x39'));}if(_0x54f0b6[_0xe66d('0xf')]){if(moment(_0x54f0b6[_0xe66d('0x10')])[_0xe66d('0x17')](_0x2fdc0c[_0xe66d('0x9')],_0xe66d('0x18'))>moment()){throw new Error(_0xe66d('0x3a'));}else{_0x54f0b6[_0xe66d('0xf')]=![];_0x54f0b6[_0xe66d('0x10')]=null;}}_0x54f0b6[_0xe66d('0x3b')]=_0x9ad157;_0x54f0b6['resetPasswordExpires']=Date[_0xe66d('0x3c')]()+0x36ee80;return _0x54f0b6[_0xe66d('0x3d')]();})[_0xe66d('0xa')](function(){return sendServiceMail({'to':_0x4006b2[_0xe66d('0x35')][_0xe66d('0x1d')],'subject':_0xe66d('0x3e'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0xe66d('0x3f')+_0xe66d('0x40')+_0x4006b2['headers']['host']+_0xe66d('0x41')+_0x9ad157+'\x0a\x0a'+_0xe66d('0x42')});})['then'](function(){_0x6908cf[_0xe66d('0x29')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x2eb4cb){return handleError(_0x6908cf,0x1f4,_0x2eb4cb);});};exports[_0xe66d('0x43')]=function(_0xcfb1e4,_0x17338c){return db[_0xe66d('0x44')][_0xe66d('0x1c')]({'where':{'resetPasswordToken':_0xcfb1e4[_0xe66d('0x45')][_0xe66d('0x46')],'resetPasswordExpires':{'$gt':Date['now']()}}})['then'](function(_0x478405){if(!_0x478405){throw new Error(_0xe66d('0x47'));}return db[_0xe66d('0x37')][_0xe66d('0x7')]({'attributes':['id',_0xe66d('0x48'),_0xe66d('0x49'),_0xe66d('0x4a')]})[_0xe66d('0xa')](function(_0x11b495){if(_0x11b495[_0xe66d('0x48')])authService['validatePasswordPattern'](_0xcfb1e4[_0xe66d('0x35')][_0xe66d('0xc')]);if(!_0x11b495['enforcePasswordHistory']||!_0x478405[_0xe66d('0x4b')])return _0x478405;authService[_0xe66d('0x4c')](_0xcfb1e4['body'][_0xe66d('0xc')],_0x478405[_0xe66d('0x4b')],_0x11b495[_0xe66d('0x4a')]);return _0x478405;})['then'](function(){_0x478405[_0xe66d('0xc')]=_0xcfb1e4[_0xe66d('0x35')][_0xe66d('0xc')];_0x478405['resetPasswordToken']=null;_0x478405[_0xe66d('0x4d')]=null;return _0x478405[_0xe66d('0x3d')]();});})['then'](function(){_0x17338c['status'](0xc8)['send']({'message':_0xe66d('0x4e')});})[_0xe66d('0x1b')](function(_0x1e8e8a){return handleError(_0x17338c,0x1f4,_0x1e8e8a);});};passport[_0xe66d('0x4f')](_0xe66d('0x2d'),new LocalStrategy({'usernameField':_0xe66d('0xb'),'passwordField':_0xe66d('0xc')},function(_0x272aff,_0x29d6a6,_0x3fc92a){return localAuthenticate(db[_0xe66d('0x44')],_0x272aff,_0x29d6a6,_0x3fc92a);})); \ No newline at end of file +var _0xf486=['allowedLoginAttempts','blockDuration','name','password','salt','role','disabled','blocked','blockedAt','loginAttempts','admin','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','add','minutes','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','format','\x22%s\x22\x20<%s>','user','SendMail','error','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','forgot','body','Email\x20parameter\x20is\x20missing','generate','Setting','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','User','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','passwordHistoryLimit','validatePasswordPattern','enforcePasswordHistory','validatePasswordHistory','previousPasswords','resetPasswordToken','save','use','local-login','util','passport-local','Strategy','jayson/promise','randomstring','../../mysqldb','../../components/auth/service','../../config/utils','client','findOne'];(function(_0x99ff61,_0x361951){var _0x3683d8=function(_0x4a55d9){while(--_0x4a55d9){_0x99ff61['push'](_0x99ff61['shift']());}};_0x3683d8(++_0x361951);}(_0xf486,0xda));var _0x6f48=function(_0x47959f,_0x1b4977){_0x47959f=_0x47959f-0x0;var _0x2ea8f7=_0xf486[_0x47959f];return _0x2ea8f7;};'use strict';var util=require(_0x6f48('0x0'));var passport=require('passport');var LocalStrategy=require(_0x6f48('0x1'))[_0x6f48('0x2')];var jayson=require(_0x6f48('0x3'));var _=require('lodash');var rs=require(_0x6f48('0x4'));var moment=require('moment');var db=require(_0x6f48('0x5'))['db'];var authService=require(_0x6f48('0x6'));var utils=require(_0x6f48('0x7'));var client=jayson[_0x6f48('0x8')]['http']({'port':0x232b});function localAuthenticate(_0x1e49b4,_0x25b409,_0x560262,_0x20e82f){var _0x3289fa,_0x3d38fd;return db['Setting'][_0x6f48('0x9')]({'where':{'id':0x1},'attributes':[_0x6f48('0xa'),_0x6f48('0xb')],'raw':!![]})['then'](function(_0x14c6d7){_0x3289fa=_0x14c6d7;return _0x1e49b4[_0x6f48('0x9')]({'attributes':['id',_0x6f48('0xc'),_0x6f48('0xd'),_0x6f48('0xe'),_0x6f48('0xf'),_0x6f48('0x10'),_0x6f48('0x11'),_0x6f48('0x12'),_0x6f48('0x13')],'where':{'name':_0x25b409,'role':{'$or':[_0x6f48('0x14'),'user','agent']}}});})[_0x6f48('0x15')](function(_0x591a8b){if(!_0x591a8b||_0x591a8b&&_0x591a8b[_0x6f48('0xc')]!==_0x25b409){throw new Error(_0x6f48('0x16'));}else{_0x3d38fd=_0x591a8b;return _0x3d38fd;}})[_0x6f48('0x15')](function(){_0x3d38fd['authenticate'](_0x560262,function(_0x1f0dea,_0x4443d5){var _0x45843d=_0x3d38fd[_0x6f48('0x13')]+0x1;if(_0x1f0dea){return _0x20e82f(_0x1f0dea);}else if(!_0x4443d5){if(_0x3d38fd[_0x6f48('0x10')]){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});}else if(_0x3289fa[_0x6f48('0xa')]>0x0){if(_0x3d38fd['blocked']){if(_0x3289fa['blockDuration']>0x0){if(moment(_0x3d38fd[_0x6f48('0x12')])['add'](_0x3289fa[_0x6f48('0xb')],'minutes')>moment()){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});}else{return utils['clearBlockUser'](_0x3d38fd,_0x45843d,![],null)[_0x6f48('0x15')](function(){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});});}}else{return _0x20e82f(null,![],{'message':_0x6f48('0x16')});}}else{if(_0x45843d>=_0x3289fa[_0x6f48('0xa')]){return utils[_0x6f48('0x17')](_0x3d38fd,0x0,!![],moment())[_0x6f48('0x15')](function(){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});});}else{return utils[_0x6f48('0x17')](_0x3d38fd,_0x45843d,![],null)[_0x6f48('0x15')](function(){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});});}}}else{return _0x20e82f(null,![],{'message':_0x6f48('0x16')});}}else{if(_0x3d38fd[_0x6f48('0x10')]){return _0x20e82f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x3289fa['allowedLoginAttempts']>0x0){if(_0x3d38fd['blocked']){if(_0x3289fa[_0x6f48('0xb')]>0x0){if(moment(_0x3d38fd[_0x6f48('0x12')])[_0x6f48('0x18')](_0x3289fa[_0x6f48('0xb')],_0x6f48('0x19'))>moment()){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});}else{return utils['clearBlockUser'](_0x3d38fd,0x0,![],null)['then'](function(){return utils['getLicense'](_0x3d38fd);})[_0x6f48('0x15')](function(){return _0x20e82f(null,_0x3d38fd);});}}else{return _0x20e82f(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x3d38fd,0x0,![],null)[_0x6f48('0x15')](function(){return utils[_0x6f48('0x1a')](_0x3d38fd);})[_0x6f48('0x15')](function(){return _0x20e82f(null,_0x3d38fd);})[_0x6f48('0x1b')](function(_0x5cc5ca){return _0x20e82f(null,![],_0x5cc5ca);});}}else{if(_0x3d38fd[_0x6f48('0x11')]){return _0x20e82f(null,![],{'message':_0x6f48('0x16')});}else{return utils[_0x6f48('0x1a')](_0x3d38fd)['then'](function(){return _0x20e82f(null,_0x3d38fd);});}}}});})[_0x6f48('0x1b')](function(_0x2e6347){return _0x20e82f(null,![],_0x2e6347);});}function sendServiceMail(_0x3d3e56){return db['MailAccount'][_0x6f48('0x1c')]({'where':{'service':!![]},'attributes':['id',_0x6f48('0xc'),_0x6f48('0x1d')],'include':[{'model':db[_0x6f48('0x1e')],'as':_0x6f48('0x1f'),'include':[{'model':db[_0x6f48('0x20')],'as':'CloudProvider'}]}]})[_0x6f48('0x15')](function(_0x5bfc6b){if(!_0x5bfc6b){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x947ad2=_0x5bfc6b[_0x6f48('0x21')]();var _0x18b7c3={'account':_0x947ad2,'message':_['merge']({'from':util[_0x6f48('0x22')](_0x6f48('0x23'),_0x5bfc6b[_0x6f48('0xc')],_0x5bfc6b[_0x6f48('0x1d')]||_0x5bfc6b['Smtp'][_0x6f48('0x24')])},_0x3d3e56)};return client['request'](_0x6f48('0x25'),_0x18b7c3);})['then'](function(_0xf998d4){if(_0xf998d4[_0x6f48('0x26')]){throw new Error(util[_0x6f48('0x22')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0xf998d4[_0x6f48('0x26')][_0x6f48('0x27')]||JSON[_0x6f48('0x28')](_0xf998d4[_0x6f48('0x26')])));}return!![];});}function handleError(_0x31c793,_0x1a2055,_0x10dcd4){return _0x31c793[_0x6f48('0x29')](_0x1a2055||0x1f4)[_0x6f48('0x2a')]({'message':_0x10dcd4?_0x10dcd4[_0x6f48('0x27')]||_0x10dcd4:''});}exports[_0x6f48('0x2b')]=function(_0x480175,_0x586745,_0x5cd925){passport['authenticate']('local-login',function(_0x2574dc,_0x4cd0ef,_0x470bf5){var _0x444afa=_0x2574dc||_0x470bf5;if(_0x444afa){return handleError(_0x586745,0x191,_0x444afa);}if(!_0x4cd0ef){return handleError(_0x586745,0x194,{'message':_0x6f48('0x2c')});}else{var _0x997b53={'payload':{'id':_0x4cd0ef['id'],'role':_0x4cd0ef[_0x6f48('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x6f48('0x2d')](_0x997b53)['then'](function(_0x1b45a2){_0x586745[_0x6f48('0x2e')]({'id':_0x4cd0ef['id'],'token':_0x1b45a2,'statusCall':'','isAlreadyLogged':_0x4cd0ef['online']});});}})(_0x480175,_0x586745,_0x5cd925);};exports[_0x6f48('0x2f')]=function(_0x34f1f8,_0x384230){if(!_0x34f1f8[_0x6f48('0x30')][_0x6f48('0x1d')]){return handleError(_0x384230,0x1f4,{'message':_0x6f48('0x31')});}var _0x3ee892=rs[_0x6f48('0x32')]();_0x34f1f8[_0x6f48('0x30')][_0x6f48('0x1d')]=_0x34f1f8[_0x6f48('0x30')][_0x6f48('0x1d')]['trim']()['toLowerCase']();var _0x44169d;return db[_0x6f48('0x33')][_0x6f48('0x9')]({'where':{'id':0x1},'attributes':[_0x6f48('0xa'),_0x6f48('0xb')],'raw':!![]})[_0x6f48('0x15')](function(_0x4172d7){_0x44169d=_0x4172d7;return db['User'][_0x6f48('0x1c')]({'where':{'email':_0x34f1f8[_0x6f48('0x30')][_0x6f48('0x1d')]}});})[_0x6f48('0x15')](function(_0xed0c4f){if(!_0xed0c4f){throw new Error(_0x6f48('0x34'));}if(_0xed0c4f[_0x6f48('0x10')]){throw new Error(_0x6f48('0x35'));}if(_0xed0c4f['blocked']){if(moment(_0xed0c4f[_0x6f48('0x12')])['add'](_0x44169d[_0x6f48('0xb')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0xed0c4f[_0x6f48('0x11')]=![];_0xed0c4f[_0x6f48('0x12')]=null;}}_0xed0c4f['resetPasswordToken']=_0x3ee892;_0xed0c4f[_0x6f48('0x36')]=Date[_0x6f48('0x37')]()+0x36ee80;return _0xed0c4f['save']();})['then'](function(){return sendServiceMail({'to':_0x34f1f8['body'][_0x6f48('0x1d')],'subject':_0x6f48('0x38'),'text':_0x6f48('0x39')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+'https://'+_0x34f1f8['headers'][_0x6f48('0x3a')]+_0x6f48('0x3b')+_0x3ee892+'\x0a\x0a'+_0x6f48('0x3c')});})['then'](function(){_0x384230[_0x6f48('0x29')](0xc8)['send']({'message':_0x6f48('0x3d')});})[_0x6f48('0x1b')](function(_0x32a814){return handleError(_0x384230,0x1f4,_0x32a814);});};exports[_0x6f48('0x3e')]=function(_0x2dc2aa,_0x5934b8){return db[_0x6f48('0x3f')][_0x6f48('0x1c')]({'where':{'resetPasswordToken':_0x2dc2aa['params'][_0x6f48('0x40')],'resetPasswordExpires':{'$gt':Date[_0x6f48('0x37')]()}}})[_0x6f48('0x15')](function(_0x5d521e){if(!_0x5d521e){throw new Error(_0x6f48('0x41'));}return db[_0x6f48('0x33')]['findOne']({'attributes':['id',_0x6f48('0x42'),'enforcePasswordHistory',_0x6f48('0x43')]})[_0x6f48('0x15')](function(_0x5be000){if(_0x5be000[_0x6f48('0x42')])authService[_0x6f48('0x44')](_0x2dc2aa['body'][_0x6f48('0xd')]);if(!_0x5be000[_0x6f48('0x45')]||!_0x5d521e['previousPasswords'])return _0x5d521e;authService[_0x6f48('0x46')](_0x2dc2aa[_0x6f48('0x30')][_0x6f48('0xd')],_0x5d521e[_0x6f48('0x47')],_0x5be000[_0x6f48('0x43')]);return _0x5d521e;})['then'](function(){_0x5d521e['password']=_0x2dc2aa[_0x6f48('0x30')]['password'];_0x5d521e[_0x6f48('0x48')]=null;_0x5d521e[_0x6f48('0x36')]=null;return _0x5d521e[_0x6f48('0x49')]();});})[_0x6f48('0x15')](function(){_0x5934b8[_0x6f48('0x29')](0xc8)[_0x6f48('0x2a')]({'message':'Password\x20reset!'});})[_0x6f48('0x1b')](function(_0x400409){return handleError(_0x5934b8,0x1f4,_0x400409);});};passport[_0x6f48('0x4a')](_0x6f48('0x4b'),new LocalStrategy({'usernameField':_0x6f48('0xc'),'passwordField':'password'},function(_0x36479a,_0x4f64bf,_0x2fe42e){return localAuthenticate(db['User'],_0x36479a,_0x4f64bf,_0x2fe42e);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index e2f8114..11dd3da 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 _0xe29f=['express','Router','post','login','/forgot','forgot','/reset/:token','exports'];(function(_0x532c00,_0xd68e93){var _0x3ae4ed=function(_0x11ec62){while(--_0x11ec62){_0x532c00['push'](_0x532c00['shift']());}};_0x3ae4ed(++_0xd68e93);}(_0xe29f,0x1e8));var _0xfe29=function(_0x3fa78c,_0x18b0f2){_0x3fa78c=_0x3fa78c-0x0;var _0x4cbcc9=_0xe29f[_0x3fa78c];return _0x4cbcc9;};'use strict';var express=require(_0xfe29('0x0'));var router=express[_0xfe29('0x1')]();var controller=require('./authLocal.controller');router[_0xfe29('0x2')]('/',controller[_0xfe29('0x3')]);router[_0xfe29('0x2')](_0xfe29('0x4'),controller[_0xfe29('0x5')]);router[_0xfe29('0x2')](_0xfe29('0x6'),controller['reset']);module[_0xfe29('0x7')]=router; \ No newline at end of file +var _0x9500=['express','Router','./authLocal.controller','post','login','/forgot','/reset/:token','reset','exports'];(function(_0xdeb72f,_0x3e87da){var _0x2b0aa7=function(_0x2d0591){while(--_0x2d0591){_0xdeb72f['push'](_0xdeb72f['shift']());}};_0x2b0aa7(++_0x3e87da);}(_0x9500,0x10e));var _0x0950=function(_0x3bc594,_0x5e5340){_0x3bc594=_0x3bc594-0x0;var _0xdcd6=_0x9500[_0x3bc594];return _0xdcd6;};'use strict';var express=require(_0x0950('0x0'));var router=express[_0x0950('0x1')]();var controller=require(_0x0950('0x2'));router[_0x0950('0x3')]('/',controller[_0x0950('0x4')]);router[_0x0950('0x3')](_0x0950('0x5'),controller['forgot']);router[_0x0950('0x3')](_0x0950('0x6'),controller[_0x0950('0x7')]);module[_0x0950('0x8')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3496d51..935aaef 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 _0xe099=['BOOLEAN','INTEGER','STRING'];(function(_0x4fa438,_0x1f15a7){var _0x4e3958=function(_0x28f510){while(--_0x28f510){_0x4fa438['push'](_0x4fa438['shift']());}};_0x4e3958(++_0x1f15a7);}(_0xe099,0x1b2));var _0x9e09=function(_0x40be47,_0x45b591){_0x40be47=_0x40be47-0x0;var _0x468f9f=_0xe099[_0x40be47];return _0x468f9f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9e09('0x0')],'allowNull':![]},'channel':{'type':Sequelize[_0x9e09('0x0')]},'description':{'type':Sequelize[_0x9e09('0x0')]},'status':{'type':Sequelize[_0x9e09('0x1')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9e09('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0xfa98=['BOOLEAN','INTEGER','sequelize','STRING'];(function(_0x1e52f6,_0x1de979){var _0xd80e3=function(_0x46791a){while(--_0x46791a){_0x1e52f6['push'](_0x1e52f6['shift']());}};_0xd80e3(++_0x1de979);}(_0xfa98,0x112));var _0x8fa9=function(_0x827286,_0x344e5c){_0x827286=_0x827286-0x0;var _0x31e0d4=_0xfa98[_0x827286];return _0x31e0d4;};'use strict';var Sequelize=require(_0x8fa9('0x0'));module['exports']={'name':{'type':Sequelize[_0x8fa9('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x8fa9('0x1')]},'description':{'type':Sequelize[_0x8fa9('0x1')]},'status':{'type':Sequelize[_0x8fa9('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x8fa9('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 ed5ca2a..c5031c6 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 _0x1952=['offset','limit','Content-Range','json','apply','reject','save','then','end','error','stack','name','send','index','Automation','rawAttributes','fieldName','type','key','map','query','keys','filters','attributes','fields','length','model','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','intersection','create','body','update','find','addConditions','ids','omit','getConditions','findOne','hasOwnProperty','addActions','Action','getActions','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','undefined','count'];(function(_0x224f65,_0x4750bf){var _0x3f921c=function(_0x1b5f64){while(--_0x1b5f64){_0x224f65['push'](_0x224f65['shift']());}};_0x3f921c(++_0x4750bf);}(_0x1952,0xdd));var _0x2195=function(_0x18ebd4,_0x318045){_0x18ebd4=_0x18ebd4-0x0;var _0x37960f=_0x1952[_0x18ebd4];return _0x37960f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2195('0x0'));var jsonpatch=require(_0x2195('0x1'));var rp=require(_0x2195('0x2'));var moment=require(_0x2195('0x3'));var BPromise=require(_0x2195('0x4'));var Mustache=require(_0x2195('0x5'));var util=require(_0x2195('0x6'));var path=require(_0x2195('0x7'));var sox=require(_0x2195('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2195('0x9'));var _=require(_0x2195('0xa'));var squel=require(_0x2195('0xb'));var crypto=require(_0x2195('0xc'));var jsforce=require(_0x2195('0xd'));var deskjs=require(_0x2195('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2195('0xf'));var Redis=require(_0x2195('0x10'));var authService=require(_0x2195('0x11'));var qs=require(_0x2195('0x12'));var as=require(_0x2195('0x13'));var hardwareService=require(_0x2195('0x14'));var logger=require(_0x2195('0x15'))(_0x2195('0x16'));var utils=require(_0x2195('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318fa9,_0x40ccfa){_0x40ccfa=_0x40ccfa||0xcc;return function(_0x34e5ef){if(_0x34e5ef){return _0x318fa9[_0x2195('0x18')](_0x40ccfa);}return _0x318fa9[_0x2195('0x19')](_0x40ccfa)['end']();};}function respondWithResult(_0x5b504e,_0x580204){_0x580204=_0x580204||0xc8;return function(_0x230958){if(_0x230958){return _0x5b504e['status'](_0x580204)['json'](_0x230958);}};}function respondWithFilteredResult(_0x516617,_0x441790){return function(_0x4c1e2b){if(_0x4c1e2b){var _0x105a92=typeof _0x441790['offset']===_0x2195('0x1a')&&typeof _0x441790['limit']===_0x2195('0x1a');var _0x2d3e9b=_0x4c1e2b[_0x2195('0x1b')];var _0x390b36=_0x105a92?0x0:_0x441790[_0x2195('0x1c')];var _0x10a213=_0x105a92?_0x4c1e2b[_0x2195('0x1b')]:_0x441790[_0x2195('0x1c')]+_0x441790[_0x2195('0x1d')];var _0x903a0a;if(_0x10a213>=_0x2d3e9b){_0x10a213=_0x2d3e9b;_0x903a0a=0xc8;}else{_0x903a0a=0xce;}_0x516617[_0x2195('0x19')](_0x903a0a);return _0x516617['set'](_0x2195('0x1e'),_0x390b36+'-'+_0x10a213+'/'+_0x2d3e9b)[_0x2195('0x1f')](_0x4c1e2b);}return null;};}function patchUpdates(_0x52b35e){return function(_0x2477d3){try{jsonpatch[_0x2195('0x20')](_0x2477d3,_0x52b35e,!![]);}catch(_0xe99e90){return BPromise[_0x2195('0x21')](_0xe99e90);}return _0x2477d3[_0x2195('0x22')]();};}function saveUpdates(_0x22e39c,_0x2769fd){return function(_0x31be88){if(_0x31be88){return _0x31be88['update'](_0x22e39c)['then'](function(_0x2b1339){return _0x2b1339;});}return null;};}function removeEntity(_0x468c50,_0x1b86aa){return function(_0x321808){if(_0x321808){return _0x321808['destroy']()[_0x2195('0x23')](function(){_0x468c50[_0x2195('0x19')](0xcc)[_0x2195('0x24')]();});}};}function handleEntityNotFound(_0x626274,_0x59d1b3){return function(_0x668bf6){if(!_0x668bf6){_0x626274[_0x2195('0x18')](0x194);}return _0x668bf6;};}function handleError(_0x577647,_0x5d6701){_0x5d6701=_0x5d6701||0x1f4;return function(_0x2f9b4a){logger[_0x2195('0x25')](_0x2f9b4a[_0x2195('0x26')]);if(_0x2f9b4a['name']){delete _0x2f9b4a[_0x2195('0x27')];}_0x577647['status'](_0x5d6701)[_0x2195('0x28')](_0x2f9b4a);};}exports[_0x2195('0x29')]=function(_0x26c40b,_0x13c0e){var _0x4ec88f={},_0x299493={},_0x4e3ad9={'count':0x0,'rows':[]};var _0x14bad2=_['map'](db[_0x2195('0x2a')][_0x2195('0x2b')],function(_0x598990){return{'name':_0x598990[_0x2195('0x2c')],'type':_0x598990[_0x2195('0x2d')][_0x2195('0x2e')]};});_0x299493['model']=_[_0x2195('0x2f')](_0x14bad2,_0x2195('0x27'));_0x299493[_0x2195('0x30')]=_[_0x2195('0x31')](_0x26c40b[_0x2195('0x30')]);_0x299493[_0x2195('0x32')]=_['intersection'](_0x299493['model'],_0x299493[_0x2195('0x30')]);_0x4ec88f[_0x2195('0x33')]=_['intersection'](_0x299493['model'],qs[_0x2195('0x34')](_0x26c40b[_0x2195('0x30')][_0x2195('0x34')]));_0x4ec88f[_0x2195('0x33')]=_0x4ec88f[_0x2195('0x33')][_0x2195('0x35')]?_0x4ec88f['attributes']:_0x299493[_0x2195('0x36')];if(!_0x26c40b[_0x2195('0x30')]['hasOwnProperty'](_0x2195('0x37'))){_0x4ec88f[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x26c40b[_0x2195('0x30')][_0x2195('0x1d')]);_0x4ec88f[_0x2195('0x1c')]=qs['offset'](_0x26c40b[_0x2195('0x30')][_0x2195('0x1c')]);}_0x4ec88f[_0x2195('0x38')]=qs[_0x2195('0x39')](_0x26c40b['query'][_0x2195('0x39')]);_0x4ec88f[_0x2195('0x3a')]=qs['filters'](_[_0x2195('0x3b')](_0x26c40b[_0x2195('0x30')],_0x299493['filters']),_0x14bad2);if(_0x26c40b[_0x2195('0x30')][_0x2195('0x3c')]){_0x4ec88f[_0x2195('0x3a')]=_['merge'](_0x4ec88f['where'],{'$or':_[_0x2195('0x2f')](_0x14bad2,function(_0x505a26){if(_0x505a26[_0x2195('0x2d')]!=='VIRTUAL'){var _0x538707={};_0x538707[_0x505a26[_0x2195('0x27')]]={'$like':'%'+_0x26c40b[_0x2195('0x30')][_0x2195('0x3c')]+'%'};return _0x538707;}})});}_0x4ec88f=_[_0x2195('0x3d')]({},_0x4ec88f,_0x26c40b[_0x2195('0x3e')]);var _0x3faaa5={'where':_0x4ec88f['where']};return db['Automation'][_0x2195('0x1b')](_0x3faaa5)['then'](function(_0x293044){_0x4e3ad9[_0x2195('0x1b')]=_0x293044;if(_0x26c40b[_0x2195('0x30')][_0x2195('0x3f')]){_0x4ec88f[_0x2195('0x40')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x4ec88f);})[_0x2195('0x23')](function(_0x543dc8){_0x4e3ad9[_0x2195('0x41')]=_0x543dc8;return _0x4e3ad9;})[_0x2195('0x23')](respondWithFilteredResult(_0x13c0e,_0x4ec88f))[_0x2195('0x42')](handleError(_0x13c0e,null));};exports[_0x2195('0x43')]=function(_0x5f4566,_0x41c41b){var _0x23a7b5={'raw':![],'where':{'id':_0x5f4566[_0x2195('0x44')]['id']}},_0x3131ca={};_0x3131ca[_0x2195('0x36')]=_['keys'](db[_0x2195('0x2a')][_0x2195('0x2b')]);_0x3131ca[_0x2195('0x30')]=_[_0x2195('0x31')](_0x5f4566[_0x2195('0x30')]);_0x3131ca[_0x2195('0x32')]=_[_0x2195('0x45')](_0x3131ca[_0x2195('0x36')],_0x3131ca['query']);_0x23a7b5[_0x2195('0x33')]=_[_0x2195('0x45')](_0x3131ca[_0x2195('0x36')],qs[_0x2195('0x34')](_0x5f4566['query'][_0x2195('0x34')]));_0x23a7b5[_0x2195('0x33')]=_0x23a7b5['attributes'][_0x2195('0x35')]?_0x23a7b5['attributes']:_0x3131ca['model'];if(_0x5f4566[_0x2195('0x30')][_0x2195('0x3f')]){_0x23a7b5[_0x2195('0x40')]=[{'all':!![]}];}_0x23a7b5=_[_0x2195('0x3d')]({},_0x23a7b5,_0x5f4566[_0x2195('0x3e')]);return db[_0x2195('0x2a')]['find'](_0x23a7b5)[_0x2195('0x23')](handleEntityNotFound(_0x41c41b,null))[_0x2195('0x23')](respondWithResult(_0x41c41b,null))[_0x2195('0x42')](handleError(_0x41c41b,null));};exports[_0x2195('0x46')]=function(_0x4994f3,_0x47fc78){return db[_0x2195('0x2a')][_0x2195('0x46')](_0x4994f3[_0x2195('0x47')],{})[_0x2195('0x23')](respondWithResult(_0x47fc78,0xc9))['catch'](handleError(_0x47fc78,null));};exports[_0x2195('0x48')]=function(_0x312cdc,_0x5cacc0){if(_0x312cdc[_0x2195('0x47')]['id']){delete _0x312cdc[_0x2195('0x47')]['id'];}return db['Automation'][_0x2195('0x49')]({'where':{'id':_0x312cdc[_0x2195('0x44')]['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x5cacc0,null))[_0x2195('0x23')](saveUpdates(_0x312cdc[_0x2195('0x47')],null))[_0x2195('0x23')](respondWithResult(_0x5cacc0,null))[_0x2195('0x42')](handleError(_0x5cacc0,null));};exports['destroy']=function(_0x3d1799,_0x17f0fa){return db[_0x2195('0x2a')][_0x2195('0x49')]({'where':{'id':_0x3d1799['params']['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x17f0fa,null))['then'](removeEntity(_0x17f0fa,null))['catch'](handleError(_0x17f0fa,null));};exports['addConditions']=function(_0x31fc1,_0x413c47,_0x5cea91){return db['Condition'][_0x2195('0x49')]({'where':{'id':_0x31fc1['params']['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x413c47,null))[_0x2195('0x23')](function(_0x17396f){if(_0x17396f){return _0x17396f[_0x2195('0x4a')](_0x31fc1[_0x2195('0x47')][_0x2195('0x4b')],_[_0x2195('0x4c')](_0x31fc1[_0x2195('0x47')],['ids','id'])||{});}})[_0x2195('0x23')](respondWithResult(_0x413c47,null))[_0x2195('0x42')](handleError(_0x413c47,null));};exports[_0x2195('0x4d')]=function(_0x5ebeb6,_0x421cd2,_0xe9eff2){var _0xd3d038={};var _0x2f7445={};var _0xd70647;var _0x4ccc38;return db[_0x2195('0x2a')][_0x2195('0x4e')]({'where':{'id':_0x5ebeb6[_0x2195('0x44')]['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x421cd2,null))[_0x2195('0x23')](function(_0x486aa1){if(_0x486aa1){_0xd70647=_0x486aa1;_0x2f7445[_0x2195('0x36')]=_[_0x2195('0x31')](db['Condition']['rawAttributes']);_0x2f7445[_0x2195('0x30')]=_[_0x2195('0x31')](_0x5ebeb6[_0x2195('0x30')]);_0x2f7445[_0x2195('0x32')]=_[_0x2195('0x45')](_0x2f7445[_0x2195('0x36')],_0x2f7445[_0x2195('0x30')]);_0xd3d038['attributes']=_[_0x2195('0x45')](_0x2f7445[_0x2195('0x36')],qs[_0x2195('0x34')](_0x5ebeb6['query'][_0x2195('0x34')]));_0xd3d038[_0x2195('0x33')]=_0xd3d038['attributes'][_0x2195('0x35')]?_0xd3d038[_0x2195('0x33')]:_0x2f7445['model'];_0xd3d038[_0x2195('0x38')]=qs[_0x2195('0x39')](_0x5ebeb6['query'][_0x2195('0x39')]);_0xd3d038[_0x2195('0x3a')]=qs[_0x2195('0x32')](_['pick'](_0x5ebeb6[_0x2195('0x30')],_0x2f7445[_0x2195('0x32')]));if(_0x5ebeb6[_0x2195('0x30')]['filter']){_0xd3d038[_0x2195('0x3a')]=_['merge'](_0xd3d038[_0x2195('0x3a')],{'$or':_[_0x2195('0x2f')](_0xd3d038[_0x2195('0x33')],function(_0x390b89){var _0x571d4e={};_0x571d4e[_0x390b89]={'$like':'%'+_0x5ebeb6[_0x2195('0x30')][_0x2195('0x3c')]+'%'};return _0x571d4e;})});}_0xd3d038=_[_0x2195('0x3d')]({},_0xd3d038,_0x5ebeb6[_0x2195('0x3e')]);return _0xd70647['getConditions'](_0xd3d038);}})[_0x2195('0x23')](function(_0x36f18e){if(_0x36f18e){_0x4ccc38=_0x36f18e[_0x2195('0x35')];if(!_0x5ebeb6[_0x2195('0x30')][_0x2195('0x4f')](_0x2195('0x37'))){_0xd3d038[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x5ebeb6[_0x2195('0x30')][_0x2195('0x1d')]);_0xd3d038[_0x2195('0x1c')]=qs['offset'](_0x5ebeb6[_0x2195('0x30')]['offset']);}return _0xd70647[_0x2195('0x4d')](_0xd3d038);}})[_0x2195('0x23')](function(_0x78e3ad){if(_0x78e3ad){return _0x78e3ad?{'count':_0x4ccc38,'rows':_0x78e3ad}:null;}})[_0x2195('0x23')](respondWithResult(_0x421cd2,null))[_0x2195('0x42')](handleError(_0x421cd2,null));};exports[_0x2195('0x50')]=function(_0x4ae862,_0x474a4e,_0x21bf10){return db[_0x2195('0x51')]['find']({'where':{'id':_0x4ae862[_0x2195('0x44')]['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x474a4e,null))['then'](function(_0x381fdb){if(_0x381fdb){return _0x381fdb[_0x2195('0x50')](_0x4ae862[_0x2195('0x47')][_0x2195('0x4b')],_[_0x2195('0x4c')](_0x4ae862[_0x2195('0x47')],[_0x2195('0x4b'),'id'])||{});}})['then'](respondWithResult(_0x474a4e,null))[_0x2195('0x42')](handleError(_0x474a4e,null));};exports['getActions']=function(_0x4f8188,_0x25e5c0,_0x399706){var _0x4b6894={};var _0x1c2d1d={};var _0x3285d4;var _0x40f32d;return db[_0x2195('0x2a')]['findOne']({'where':{'id':_0x4f8188['params']['id']}})[_0x2195('0x23')](handleEntityNotFound(_0x25e5c0,null))[_0x2195('0x23')](function(_0x436a33){if(_0x436a33){_0x3285d4=_0x436a33;_0x1c2d1d[_0x2195('0x36')]=_[_0x2195('0x31')](db[_0x2195('0x51')][_0x2195('0x2b')]);_0x1c2d1d[_0x2195('0x30')]=_[_0x2195('0x31')](_0x4f8188['query']);_0x1c2d1d[_0x2195('0x32')]=_[_0x2195('0x45')](_0x1c2d1d[_0x2195('0x36')],_0x1c2d1d[_0x2195('0x30')]);_0x4b6894[_0x2195('0x33')]=_['intersection'](_0x1c2d1d[_0x2195('0x36')],qs['fields'](_0x4f8188['query'][_0x2195('0x34')]));_0x4b6894[_0x2195('0x33')]=_0x4b6894[_0x2195('0x33')]['length']?_0x4b6894[_0x2195('0x33')]:_0x1c2d1d[_0x2195('0x36')];_0x4b6894['order']=qs[_0x2195('0x39')](_0x4f8188[_0x2195('0x30')][_0x2195('0x39')]);_0x4b6894[_0x2195('0x3a')]=qs[_0x2195('0x32')](_['pick'](_0x4f8188[_0x2195('0x30')],_0x1c2d1d['filters']));if(_0x4f8188['query'][_0x2195('0x3c')]){_0x4b6894[_0x2195('0x3a')]=_[_0x2195('0x3d')](_0x4b6894['where'],{'$or':_[_0x2195('0x2f')](_0x4b6894[_0x2195('0x33')],function(_0x2fc49b){var _0x566c9b={};_0x566c9b[_0x2fc49b]={'$like':'%'+_0x4f8188[_0x2195('0x30')][_0x2195('0x3c')]+'%'};return _0x566c9b;})});}_0x4b6894=_['merge']({},_0x4b6894,_0x4f8188['options']);return _0x3285d4[_0x2195('0x52')](_0x4b6894);}})['then'](function(_0x4dcee9){if(_0x4dcee9){_0x40f32d=_0x4dcee9[_0x2195('0x35')];if(!_0x4f8188['query'][_0x2195('0x4f')](_0x2195('0x37'))){_0x4b6894[_0x2195('0x1d')]=qs[_0x2195('0x1d')](_0x4f8188['query'][_0x2195('0x1d')]);_0x4b6894[_0x2195('0x1c')]=qs[_0x2195('0x1c')](_0x4f8188[_0x2195('0x30')][_0x2195('0x1c')]);}return _0x3285d4[_0x2195('0x52')](_0x4b6894);}})[_0x2195('0x23')](function(_0x374038){if(_0x374038){return _0x374038?{'count':_0x40f32d,'rows':_0x374038}:null;}})['then'](respondWithResult(_0x25e5c0,null))['catch'](handleError(_0x25e5c0,null));}; \ No newline at end of file +var _0xb6c4=['keys','filters','intersection','query','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','addConditions','Condition','ids','omit','findOne','getConditions','nolimit','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','mustache','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','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','Automation','rawAttributes','fieldName','type','key','model','map'];(function(_0x5631ce,_0x5a9a02){var _0x2918bb=function(_0x36042f){while(--_0x36042f){_0x5631ce['push'](_0x5631ce['shift']());}};_0x2918bb(++_0x5a9a02);}(_0xb6c4,0x1c7));var _0x4b6c=function(_0x4999c3,_0x54660b){_0x4999c3=_0x4999c3-0x0;var _0x55863a=_0xb6c4[_0x4999c3];return _0x55863a;};'use strict';var emlformat=require(_0x4b6c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b6c('0x1'));var jsonpatch=require(_0x4b6c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4b6c('0x3'));var util=require('util');var path=require(_0x4b6c('0x4'));var sox=require(_0x4b6c('0x5'));var csv=require(_0x4b6c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b6c('0x7'));var _=require(_0x4b6c('0x8'));var squel=require(_0x4b6c('0x9'));var crypto=require(_0x4b6c('0xa'));var jsforce=require(_0x4b6c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4b6c('0x6'));var querystring=require(_0x4b6c('0xc'));var Papa=require(_0x4b6c('0xd'));var Redis=require(_0x4b6c('0xe'));var authService=require(_0x4b6c('0xf'));var qs=require(_0x4b6c('0x10'));var as=require(_0x4b6c('0x11'));var hardwareService=require(_0x4b6c('0x12'));var logger=require(_0x4b6c('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b6c('0x14'));var db=require(_0x4b6c('0x15'))['db'];function respondWithStatusCode(_0x112fc7,_0x220f3b){_0x220f3b=_0x220f3b||0xcc;return function(_0x1dee4c){if(_0x1dee4c){return _0x112fc7[_0x4b6c('0x16')](_0x220f3b);}return _0x112fc7['status'](_0x220f3b)[_0x4b6c('0x17')]();};}function respondWithResult(_0x65ba6c,_0x261a23){_0x261a23=_0x261a23||0xc8;return function(_0x4ff32c){if(_0x4ff32c){return _0x65ba6c['status'](_0x261a23)[_0x4b6c('0x18')](_0x4ff32c);}};}function respondWithFilteredResult(_0xe95fe,_0x3a46eb){return function(_0x3ba285){if(_0x3ba285){var _0x2b2164=typeof _0x3a46eb['offset']==='undefined'&&typeof _0x3a46eb[_0x4b6c('0x19')]===_0x4b6c('0x1a');var _0x13ead9=_0x3ba285[_0x4b6c('0x1b')];var _0x4f7eda=_0x2b2164?0x0:_0x3a46eb['offset'];var _0x4d2688=_0x2b2164?_0x3ba285[_0x4b6c('0x1b')]:_0x3a46eb[_0x4b6c('0x1c')]+_0x3a46eb[_0x4b6c('0x19')];var _0x29de1f;if(_0x4d2688>=_0x13ead9){_0x4d2688=_0x13ead9;_0x29de1f=0xc8;}else{_0x29de1f=0xce;}_0xe95fe[_0x4b6c('0x1d')](_0x29de1f);return _0xe95fe[_0x4b6c('0x1e')](_0x4b6c('0x1f'),_0x4f7eda+'-'+_0x4d2688+'/'+_0x13ead9)[_0x4b6c('0x18')](_0x3ba285);}return null;};}function patchUpdates(_0x3f20f6){return function(_0x393be5){try{jsonpatch[_0x4b6c('0x20')](_0x393be5,_0x3f20f6,!![]);}catch(_0x1b1a9c){return BPromise[_0x4b6c('0x21')](_0x1b1a9c);}return _0x393be5[_0x4b6c('0x22')]();};}function saveUpdates(_0x344aaf,_0x2e6b6c){return function(_0x4cc4ff){if(_0x4cc4ff){return _0x4cc4ff[_0x4b6c('0x23')](_0x344aaf)[_0x4b6c('0x24')](function(_0x19c228){return _0x19c228;});}return null;};}function removeEntity(_0x368fa0,_0x6d1101){return function(_0x291366){if(_0x291366){return _0x291366[_0x4b6c('0x25')]()[_0x4b6c('0x24')](function(){_0x368fa0[_0x4b6c('0x1d')](0xcc)[_0x4b6c('0x17')]();});}};}function handleEntityNotFound(_0x5cb9b3,_0x493585){return function(_0x258638){if(!_0x258638){_0x5cb9b3[_0x4b6c('0x16')](0x194);}return _0x258638;};}function handleError(_0x10cd61,_0x1bde73){_0x1bde73=_0x1bde73||0x1f4;return function(_0x44e255){logger[_0x4b6c('0x26')](_0x44e255['stack']);if(_0x44e255[_0x4b6c('0x27')]){delete _0x44e255[_0x4b6c('0x27')];}_0x10cd61[_0x4b6c('0x1d')](_0x1bde73)[_0x4b6c('0x28')](_0x44e255);};}exports[_0x4b6c('0x29')]=function(_0x140349,_0x334cff){var _0x4869b9={},_0x136291={},_0x2cbe71={'count':0x0,'rows':[]};var _0x8fdc6c=_['map'](db[_0x4b6c('0x2a')][_0x4b6c('0x2b')],function(_0x254944){return{'name':_0x254944[_0x4b6c('0x2c')],'type':_0x254944[_0x4b6c('0x2d')][_0x4b6c('0x2e')]};});_0x136291[_0x4b6c('0x2f')]=_[_0x4b6c('0x30')](_0x8fdc6c,_0x4b6c('0x27'));_0x136291['query']=_[_0x4b6c('0x31')](_0x140349['query']);_0x136291[_0x4b6c('0x32')]=_[_0x4b6c('0x33')](_0x136291[_0x4b6c('0x2f')],_0x136291[_0x4b6c('0x34')]);_0x4869b9[_0x4b6c('0x35')]=_['intersection'](_0x136291[_0x4b6c('0x2f')],qs[_0x4b6c('0x36')](_0x140349[_0x4b6c('0x34')][_0x4b6c('0x36')]));_0x4869b9[_0x4b6c('0x35')]=_0x4869b9[_0x4b6c('0x35')]['length']?_0x4869b9[_0x4b6c('0x35')]:_0x136291[_0x4b6c('0x2f')];if(!_0x140349[_0x4b6c('0x34')][_0x4b6c('0x37')]('nolimit')){_0x4869b9[_0x4b6c('0x19')]=qs[_0x4b6c('0x19')](_0x140349['query'][_0x4b6c('0x19')]);_0x4869b9[_0x4b6c('0x1c')]=qs['offset'](_0x140349['query'][_0x4b6c('0x1c')]);}_0x4869b9[_0x4b6c('0x38')]=qs[_0x4b6c('0x39')](_0x140349[_0x4b6c('0x34')]['sort']);_0x4869b9[_0x4b6c('0x3a')]=qs['filters'](_[_0x4b6c('0x3b')](_0x140349[_0x4b6c('0x34')],_0x136291['filters']),_0x8fdc6c);if(_0x140349[_0x4b6c('0x34')]['filter']){_0x4869b9[_0x4b6c('0x3a')]=_[_0x4b6c('0x3c')](_0x4869b9[_0x4b6c('0x3a')],{'$or':_[_0x4b6c('0x30')](_0x8fdc6c,function(_0x5734cb){if(_0x5734cb[_0x4b6c('0x2d')]!=='VIRTUAL'){var _0x97a919={};_0x97a919[_0x5734cb[_0x4b6c('0x27')]]={'$like':'%'+_0x140349[_0x4b6c('0x34')][_0x4b6c('0x3d')]+'%'};return _0x97a919;}})});}_0x4869b9=_[_0x4b6c('0x3c')]({},_0x4869b9,_0x140349['options']);var _0x151bf3={'where':_0x4869b9[_0x4b6c('0x3a')]};return db['Automation'][_0x4b6c('0x1b')](_0x151bf3)['then'](function(_0x18d47f){_0x2cbe71[_0x4b6c('0x1b')]=_0x18d47f;if(_0x140349[_0x4b6c('0x34')][_0x4b6c('0x3e')]){_0x4869b9[_0x4b6c('0x3f')]=[{'all':!![]}];}return db[_0x4b6c('0x2a')][_0x4b6c('0x40')](_0x4869b9);})[_0x4b6c('0x24')](function(_0x2c53ad){_0x2cbe71[_0x4b6c('0x41')]=_0x2c53ad;return _0x2cbe71;})['then'](respondWithFilteredResult(_0x334cff,_0x4869b9))[_0x4b6c('0x42')](handleError(_0x334cff,null));};exports[_0x4b6c('0x43')]=function(_0x43ddc4,_0x57c07f){var _0x2389f3={'raw':![],'where':{'id':_0x43ddc4[_0x4b6c('0x44')]['id']}},_0xfe3c57={};_0xfe3c57[_0x4b6c('0x2f')]=_[_0x4b6c('0x31')](db['Automation']['rawAttributes']);_0xfe3c57[_0x4b6c('0x34')]=_['keys'](_0x43ddc4[_0x4b6c('0x34')]);_0xfe3c57[_0x4b6c('0x32')]=_['intersection'](_0xfe3c57[_0x4b6c('0x2f')],_0xfe3c57[_0x4b6c('0x34')]);_0x2389f3[_0x4b6c('0x35')]=_[_0x4b6c('0x33')](_0xfe3c57[_0x4b6c('0x2f')],qs[_0x4b6c('0x36')](_0x43ddc4[_0x4b6c('0x34')][_0x4b6c('0x36')]));_0x2389f3[_0x4b6c('0x35')]=_0x2389f3[_0x4b6c('0x35')][_0x4b6c('0x45')]?_0x2389f3['attributes']:_0xfe3c57[_0x4b6c('0x2f')];if(_0x43ddc4[_0x4b6c('0x34')][_0x4b6c('0x3e')]){_0x2389f3[_0x4b6c('0x3f')]=[{'all':!![]}];}_0x2389f3=_['merge']({},_0x2389f3,_0x43ddc4[_0x4b6c('0x46')]);return db[_0x4b6c('0x2a')][_0x4b6c('0x47')](_0x2389f3)[_0x4b6c('0x24')](handleEntityNotFound(_0x57c07f,null))['then'](respondWithResult(_0x57c07f,null))[_0x4b6c('0x42')](handleError(_0x57c07f,null));};exports[_0x4b6c('0x48')]=function(_0x82167,_0x4cd01f){return db[_0x4b6c('0x2a')][_0x4b6c('0x48')](_0x82167[_0x4b6c('0x49')],{})[_0x4b6c('0x24')](respondWithResult(_0x4cd01f,0xc9))[_0x4b6c('0x42')](handleError(_0x4cd01f,null));};exports[_0x4b6c('0x23')]=function(_0x362216,_0x3f7938){if(_0x362216[_0x4b6c('0x49')]['id']){delete _0x362216[_0x4b6c('0x49')]['id'];}return db[_0x4b6c('0x2a')]['find']({'where':{'id':_0x362216['params']['id']}})[_0x4b6c('0x24')](handleEntityNotFound(_0x3f7938,null))[_0x4b6c('0x24')](saveUpdates(_0x362216[_0x4b6c('0x49')],null))[_0x4b6c('0x24')](respondWithResult(_0x3f7938,null))['catch'](handleError(_0x3f7938,null));};exports['destroy']=function(_0x30b372,_0xdedd33){return db['Automation']['find']({'where':{'id':_0x30b372[_0x4b6c('0x44')]['id']}})[_0x4b6c('0x24')](handleEntityNotFound(_0xdedd33,null))[_0x4b6c('0x24')](removeEntity(_0xdedd33,null))['catch'](handleError(_0xdedd33,null));};exports[_0x4b6c('0x4a')]=function(_0x3b65c8,_0x1a158d,_0x5a5fc4){return db[_0x4b6c('0x4b')][_0x4b6c('0x47')]({'where':{'id':_0x3b65c8['params']['id']}})['then'](handleEntityNotFound(_0x1a158d,null))[_0x4b6c('0x24')](function(_0x43d305){if(_0x43d305){return _0x43d305[_0x4b6c('0x4a')](_0x3b65c8[_0x4b6c('0x49')][_0x4b6c('0x4c')],_[_0x4b6c('0x4d')](_0x3b65c8[_0x4b6c('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x1a158d,null))['catch'](handleError(_0x1a158d,null));};exports['getConditions']=function(_0xe8cbe2,_0x3072d8,_0x365e8f){var _0x435c9d={};var _0x1a7b18={};var _0x33ab3b;var _0x2e3191;return db['Automation'][_0x4b6c('0x4e')]({'where':{'id':_0xe8cbe2['params']['id']}})[_0x4b6c('0x24')](handleEntityNotFound(_0x3072d8,null))['then'](function(_0x13a18d){if(_0x13a18d){_0x33ab3b=_0x13a18d;_0x1a7b18[_0x4b6c('0x2f')]=_[_0x4b6c('0x31')](db[_0x4b6c('0x4b')]['rawAttributes']);_0x1a7b18[_0x4b6c('0x34')]=_['keys'](_0xe8cbe2[_0x4b6c('0x34')]);_0x1a7b18[_0x4b6c('0x32')]=_[_0x4b6c('0x33')](_0x1a7b18[_0x4b6c('0x2f')],_0x1a7b18[_0x4b6c('0x34')]);_0x435c9d[_0x4b6c('0x35')]=_[_0x4b6c('0x33')](_0x1a7b18[_0x4b6c('0x2f')],qs[_0x4b6c('0x36')](_0xe8cbe2[_0x4b6c('0x34')][_0x4b6c('0x36')]));_0x435c9d['attributes']=_0x435c9d[_0x4b6c('0x35')][_0x4b6c('0x45')]?_0x435c9d[_0x4b6c('0x35')]:_0x1a7b18['model'];_0x435c9d['order']=qs[_0x4b6c('0x39')](_0xe8cbe2[_0x4b6c('0x34')]['sort']);_0x435c9d['where']=qs['filters'](_[_0x4b6c('0x3b')](_0xe8cbe2[_0x4b6c('0x34')],_0x1a7b18[_0x4b6c('0x32')]));if(_0xe8cbe2['query'][_0x4b6c('0x3d')]){_0x435c9d[_0x4b6c('0x3a')]=_[_0x4b6c('0x3c')](_0x435c9d[_0x4b6c('0x3a')],{'$or':_[_0x4b6c('0x30')](_0x435c9d[_0x4b6c('0x35')],function(_0x369751){var _0x2e52f3={};_0x2e52f3[_0x369751]={'$like':'%'+_0xe8cbe2[_0x4b6c('0x34')][_0x4b6c('0x3d')]+'%'};return _0x2e52f3;})});}_0x435c9d=_['merge']({},_0x435c9d,_0xe8cbe2[_0x4b6c('0x46')]);return _0x33ab3b[_0x4b6c('0x4f')](_0x435c9d);}})[_0x4b6c('0x24')](function(_0x424f56){if(_0x424f56){_0x2e3191=_0x424f56['length'];if(!_0xe8cbe2[_0x4b6c('0x34')][_0x4b6c('0x37')](_0x4b6c('0x50'))){_0x435c9d[_0x4b6c('0x19')]=qs[_0x4b6c('0x19')](_0xe8cbe2[_0x4b6c('0x34')][_0x4b6c('0x19')]);_0x435c9d['offset']=qs['offset'](_0xe8cbe2['query']['offset']);}return _0x33ab3b[_0x4b6c('0x4f')](_0x435c9d);}})[_0x4b6c('0x24')](function(_0x2713b8){if(_0x2713b8){return _0x2713b8?{'count':_0x2e3191,'rows':_0x2713b8}:null;}})[_0x4b6c('0x24')](respondWithResult(_0x3072d8,null))[_0x4b6c('0x42')](handleError(_0x3072d8,null));};exports[_0x4b6c('0x51')]=function(_0x39fe74,_0x1e0ff6,_0x17da5a){return db[_0x4b6c('0x52')][_0x4b6c('0x47')]({'where':{'id':_0x39fe74[_0x4b6c('0x44')]['id']}})[_0x4b6c('0x24')](handleEntityNotFound(_0x1e0ff6,null))[_0x4b6c('0x24')](function(_0x200456){if(_0x200456){return _0x200456[_0x4b6c('0x51')](_0x39fe74[_0x4b6c('0x49')][_0x4b6c('0x4c')],_[_0x4b6c('0x4d')](_0x39fe74[_0x4b6c('0x49')],[_0x4b6c('0x4c'),'id'])||{});}})[_0x4b6c('0x24')](respondWithResult(_0x1e0ff6,null))[_0x4b6c('0x42')](handleError(_0x1e0ff6,null));};exports['getActions']=function(_0x2a15d0,_0x20b7ad,_0x2f9bca){var _0x6f18ba={};var _0x4b9b3a={};var _0x599da4;var _0x32f734;return db[_0x4b6c('0x2a')][_0x4b6c('0x4e')]({'where':{'id':_0x2a15d0[_0x4b6c('0x44')]['id']}})['then'](handleEntityNotFound(_0x20b7ad,null))['then'](function(_0x2fc410){if(_0x2fc410){_0x599da4=_0x2fc410;_0x4b9b3a[_0x4b6c('0x2f')]=_[_0x4b6c('0x31')](db[_0x4b6c('0x52')][_0x4b6c('0x2b')]);_0x4b9b3a[_0x4b6c('0x34')]=_[_0x4b6c('0x31')](_0x2a15d0[_0x4b6c('0x34')]);_0x4b9b3a[_0x4b6c('0x32')]=_[_0x4b6c('0x33')](_0x4b9b3a[_0x4b6c('0x2f')],_0x4b9b3a[_0x4b6c('0x34')]);_0x6f18ba[_0x4b6c('0x35')]=_[_0x4b6c('0x33')](_0x4b9b3a[_0x4b6c('0x2f')],qs[_0x4b6c('0x36')](_0x2a15d0[_0x4b6c('0x34')][_0x4b6c('0x36')]));_0x6f18ba['attributes']=_0x6f18ba[_0x4b6c('0x35')]['length']?_0x6f18ba[_0x4b6c('0x35')]:_0x4b9b3a[_0x4b6c('0x2f')];_0x6f18ba[_0x4b6c('0x38')]=qs['sort'](_0x2a15d0[_0x4b6c('0x34')][_0x4b6c('0x39')]);_0x6f18ba[_0x4b6c('0x3a')]=qs[_0x4b6c('0x32')](_[_0x4b6c('0x3b')](_0x2a15d0[_0x4b6c('0x34')],_0x4b9b3a[_0x4b6c('0x32')]));if(_0x2a15d0[_0x4b6c('0x34')][_0x4b6c('0x3d')]){_0x6f18ba[_0x4b6c('0x3a')]=_[_0x4b6c('0x3c')](_0x6f18ba[_0x4b6c('0x3a')],{'$or':_['map'](_0x6f18ba[_0x4b6c('0x35')],function(_0x21d19b){var _0x242c40={};_0x242c40[_0x21d19b]={'$like':'%'+_0x2a15d0['query']['filter']+'%'};return _0x242c40;})});}_0x6f18ba=_[_0x4b6c('0x3c')]({},_0x6f18ba,_0x2a15d0[_0x4b6c('0x46')]);return _0x599da4[_0x4b6c('0x53')](_0x6f18ba);}})[_0x4b6c('0x24')](function(_0xac0734){if(_0xac0734){_0x32f734=_0xac0734[_0x4b6c('0x45')];if(!_0x2a15d0[_0x4b6c('0x34')]['hasOwnProperty'](_0x4b6c('0x50'))){_0x6f18ba[_0x4b6c('0x19')]=qs['limit'](_0x2a15d0[_0x4b6c('0x34')]['limit']);_0x6f18ba[_0x4b6c('0x1c')]=qs[_0x4b6c('0x1c')](_0x2a15d0['query'][_0x4b6c('0x1c')]);}return _0x599da4[_0x4b6c('0x53')](_0x6f18ba);}})[_0x4b6c('0x24')](function(_0x18fc0f){if(_0x18fc0f){return _0x18fc0f?{'count':_0x32f734,'rows':_0x18fc0f}:null;}})[_0x4b6c('0x24')](respondWithResult(_0x20b7ad,null))[_0x4b6c('0x42')](handleError(_0x20b7ad,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index f282717..8156332 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 _0x0e4e=['util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','lodash'];(function(_0x5e38f9,_0x5db6c4){var _0x4a914f=function(_0x369d29){while(--_0x369d29){_0x5e38f9['push'](_0x5e38f9['shift']());}};_0x4a914f(++_0x5db6c4);}(_0x0e4e,0x15e));var _0xe0e4=function(_0x1b69aa,_0x5aa147){_0x1b69aa=_0x1b69aa-0x0;var _0x42647d=_0x0e4e[_0x1b69aa];return _0x42647d;};'use strict';var _=require(_0xe0e4('0x0'));var util=require(_0xe0e4('0x1'));var logger=require(_0xe0e4('0x2'))('api');var moment=require(_0xe0e4('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0e4('0x4'));var fs=require('fs');var path=require(_0xe0e4('0x5'));var rimraf=require(_0xe0e4('0x6'));var config=require(_0xe0e4('0x7'));var attributes=require(_0xe0e4('0x8'));module[_0xe0e4('0x9')]=function(_0xcbf2cc,_0x454d2e){return _0xcbf2cc[_0xe0e4('0xa')](_0xe0e4('0xb'),attributes,{'tableName':_0xe0e4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b8a=['Automation','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./automation.attributes','exports','define'];(function(_0x5f213f,_0x1885d0){var _0x12be75=function(_0x2fe76f){while(--_0x2fe76f){_0x5f213f['push'](_0x5f213f['shift']());}};_0x12be75(++_0x1885d0);}(_0x1b8a,0x17a));var _0xa1b8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x1b8a[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0xa1b8('0x0'));var util=require(_0xa1b8('0x1'));var logger=require(_0xa1b8('0x2'))(_0xa1b8('0x3'));var moment=require(_0xa1b8('0x4'));var BPromise=require(_0xa1b8('0x5'));var rp=require(_0xa1b8('0x6'));var fs=require('fs');var path=require(_0xa1b8('0x7'));var rimraf=require(_0xa1b8('0x8'));var config=require('../../config/environment');var attributes=require(_0xa1b8('0x9'));module[_0xa1b8('0xa')]=function(_0x12efec,_0x24b051){return _0x12efec[_0xa1b8('0xb')](_0xa1b8('0xc'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 953028a..6fae16e 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 _0xf9ac=['info','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','Automation,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','then'];(function(_0x5dde65,_0x1eb6f7){var _0x1e9245=function(_0x5ce237){while(--_0x5ce237){_0x5dde65['push'](_0x5dde65['shift']());}};_0x1e9245(++_0x1eb6f7);}(_0xf9ac,0x87));var _0xcf9a=function(_0x4eb5a8,_0x35684b){_0x4eb5a8=_0x4eb5a8-0x0;var _0x29b9fb=_0xf9ac[_0x4eb5a8];return _0x29b9fb;};'use strict';var _=require(_0xcf9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xcf9a('0x1'));var rs=require(_0xcf9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf9a('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcf9a('0x5'));var client=jayson[_0xcf9a('0x6')][_0xcf9a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x235e47,_0x54ebf6,_0x33a1a6){return new BPromise(function(_0x3d2f54,_0x4c0665){return client['request'](_0x235e47,_0x33a1a6)[_0xcf9a('0x8')](function(_0x579cf9){logger[_0xcf9a('0x9')]('Automation,\x20%s,\x20%s',_0x54ebf6,_0xcf9a('0xa'));logger['debug'](_0xcf9a('0xb'),_0x54ebf6,_0xcf9a('0xa'),JSON[_0xcf9a('0xc')](_0x579cf9));if(_0x579cf9['error']){if(_0x579cf9['error']['code']===0x1f4){logger[_0xcf9a('0xd')](_0xcf9a('0xe'),_0x54ebf6,_0x579cf9['error'][_0xcf9a('0xf')]);return _0x4c0665(_0x579cf9[_0xcf9a('0xd')][_0xcf9a('0xf')]);}logger['error'](_0xcf9a('0xe'),_0x54ebf6,_0x579cf9['error']['message']);return _0x3d2f54(_0x579cf9['error']['message']);}else{logger[_0xcf9a('0x9')](_0xcf9a('0xe'),_0x54ebf6,_0xcf9a('0xa'));_0x3d2f54(_0x579cf9[_0xcf9a('0x10')][_0xcf9a('0xf')]);}})[_0xcf9a('0x11')](function(_0x25dc10){logger['error'](_0xcf9a('0xe'),_0x54ebf6,_0x25dc10);_0x4c0665(_0x25dc10);});});} \ No newline at end of file +var _0x3445=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Automation,\x20%s,\x20%s'];(function(_0x270e59,_0x373914){var _0x115eb2=function(_0xce15dc){while(--_0xce15dc){_0x270e59['push'](_0x270e59['shift']());}};_0x115eb2(++_0x373914);}(_0x3445,0x1b7));var _0x5344=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3445[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5344('0x0'));var util=require(_0x5344('0x1'));var moment=require(_0x5344('0x2'));var BPromise=require(_0x5344('0x3'));var rs=require(_0x5344('0x4'));var fs=require('fs');var Redis=require(_0x5344('0x5'));var db=require(_0x5344('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5344('0x7'));var config=require(_0x5344('0x8'));var jayson=require(_0x5344('0x9'));var client=jayson[_0x5344('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ffe5f,_0x5642cb,_0x5a4f52){return new BPromise(function(_0x3f638c,_0x4adb8a){return client['request'](_0x4ffe5f,_0x5a4f52)[_0x5344('0xb')](function(_0xbc5346){logger[_0x5344('0xc')]('Automation,\x20%s,\x20%s',_0x5642cb,_0x5344('0xd'));logger[_0x5344('0xe')](_0x5344('0xf'),_0x5642cb,_0x5344('0xd'),JSON[_0x5344('0x10')](_0xbc5346));if(_0xbc5346[_0x5344('0x11')]){if(_0xbc5346['error'][_0x5344('0x12')]===0x1f4){logger[_0x5344('0x11')]('Automation,\x20%s,\x20%s',_0x5642cb,_0xbc5346[_0x5344('0x11')]['message']);return _0x4adb8a(_0xbc5346[_0x5344('0x11')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x5642cb,_0xbc5346[_0x5344('0x11')][_0x5344('0x13')]);return _0x3f638c(_0xbc5346[_0x5344('0x11')][_0x5344('0x13')]);}else{logger[_0x5344('0xc')](_0x5344('0x14'),_0x5642cb,_0x5344('0xd'));_0x3f638c(_0xbc5346[_0x5344('0x15')][_0x5344('0x13')]);}})[_0x5344('0x16')](function(_0x4ae241){logger[_0x5344('0x11')](_0x5344('0x14'),_0x5642cb,_0x4ae241);_0x4adb8a(_0x4ae241);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 0cf3021..f9a94da 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 _0x28aa=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','index','/:id','isAuthenticated','show','/:id/conditions','getConditions','/:id/actions','getActions','post','addConditions','put','update','delete','destroy','exports','util','path'];(function(_0x472ae7,_0x525a04){var _0x294c08=function(_0x1dc144){while(--_0x1dc144){_0x472ae7['push'](_0x472ae7['shift']());}};_0x294c08(++_0x525a04);}(_0x28aa,0xf8));var _0xa28a=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x28aa[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require(_0xa28a('0x0'));var path=require(_0xa28a('0x1'));var timeout=require(_0xa28a('0x2'));var express=require(_0xa28a('0x3'));var router=express[_0xa28a('0x4')]();var fs_extra=require(_0xa28a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa28a('0x6'));var config=require(_0xa28a('0x7'));var controller=require(_0xa28a('0x8'));router[_0xa28a('0x9')]('/',auth['isAuthenticated'](),controller[_0xa28a('0xa')]);router[_0xa28a('0x9')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0xd')]);router[_0xa28a('0x9')](_0xa28a('0xe'),auth[_0xa28a('0xc')](),controller[_0xa28a('0xf')]);router[_0xa28a('0x9')](_0xa28a('0x10'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x11')]);router[_0xa28a('0x12')]('/',auth[_0xa28a('0xc')](),controller['create']);router[_0xa28a('0x12')](_0xa28a('0xe'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x13')]);router['post'](_0xa28a('0x10'),auth[_0xa28a('0xc')](),controller['addActions']);router[_0xa28a('0x14')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x15')]);router[_0xa28a('0x16')](_0xa28a('0xb'),auth[_0xa28a('0xc')](),controller[_0xa28a('0x17')]);module[_0xa28a('0x18')]=router; \ No newline at end of file +var _0xbc82=['isAuthenticated','show','get','/:id/conditions','post','create','addConditions','/:id/actions','addActions','put','/:id','update','delete','destroy','multer','express','../../components/auth/service','./automation.controller','index'];(function(_0x88d3a,_0x5541d5){var _0x549872=function(_0x129617){while(--_0x129617){_0x88d3a['push'](_0x88d3a['shift']());}};_0x549872(++_0x5541d5);}(_0xbc82,0x13e));var _0x2bc8=function(_0x5ef539,_0x4217c9){_0x5ef539=_0x5ef539-0x0;var _0x2be138=_0xbc82[_0x5ef539];return _0x2be138;};'use strict';var multer=require(_0x2bc8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2bc8('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2bc8('0x2'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2bc8('0x3'));router['get']('/',auth['isAuthenticated'](),controller[_0x2bc8('0x4')]);router['get']('/:id',auth[_0x2bc8('0x5')](),controller[_0x2bc8('0x6')]);router[_0x2bc8('0x7')](_0x2bc8('0x8'),auth[_0x2bc8('0x5')](),controller['getConditions']);router[_0x2bc8('0x7')]('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router[_0x2bc8('0x9')]('/',auth[_0x2bc8('0x5')](),controller[_0x2bc8('0xa')]);router[_0x2bc8('0x9')](_0x2bc8('0x8'),auth[_0x2bc8('0x5')](),controller[_0x2bc8('0xb')]);router[_0x2bc8('0x9')](_0x2bc8('0xc'),auth['isAuthenticated'](),controller[_0x2bc8('0xd')]);router[_0x2bc8('0xe')](_0x2bc8('0xf'),auth[_0x2bc8('0x5')](),controller[_0x2bc8('0x10')]);router[_0x2bc8('0x11')](_0x2bc8('0xf'),auth[_0x2bc8('0x5')](),controller[_0x2bc8('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index e610e95..55710f9 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 _0x8251=['exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','#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','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x8251,0x8f));var _0x1825=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8251[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x1825('0x0'));module[_0x1825('0x1')]={'name':{'type':Sequelize[_0x1825('0x2')],'unique':_0x1825('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1825('0x4')](_0x1825('0x5')),'allowNull':![],'defaultValue':_0x1825('0x5')},'description':{'type':Sequelize[_0x1825('0x2')]},'active':{'type':Sequelize[_0x1825('0x6')],'defaultValue':0x0,'comment':_0x1825('0x7')},'limitCalls':{'type':Sequelize[_0x1825('0x8')](0x4)[_0x1825('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1825('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1825('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1825('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1825('0x9')],'defaultValue':0x3,'comment':_0x1825('0xe')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x1825('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1825('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1825('0xf'),'never',_0x1825('0x10')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1825('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1825('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x1825('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1825('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1825('0x8')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1825('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1825('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1825('0x14')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1825('0x15')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1825('0x8')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1825('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1825('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1825('0x8')](0x9)[_0x1825('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1825('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1825('0x4')](_0x1825('0x19'),_0x1825('0x1a')),'defaultValue':_0x1825('0x19')},'dialPrefix':{'type':Sequelize[_0x1825('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1825('0x1b')},'dialCutDigit':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1825('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1825('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x1d')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1825('0x8')](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1825('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1825('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1825('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1825('0x23')}}; \ No newline at end of file +var _0xfa9e=['STRING','name','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','ENUM','never','onlyIfOpen','always','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports'];(function(_0x3fb81f,_0x1c20f4){var _0x5d4769=function(_0x4ebdd3){while(--_0x4ebdd3){_0x3fb81f['push'](_0x3fb81f['shift']());}};_0x5d4769(++_0x1c20f4);}(_0xfa9e,0x1de));var _0xefa9=function(_0x4dbdeb,_0x52d5b8){_0x4dbdeb=_0x4dbdeb-0x0;var _0x19bc36=_0xfa9e[_0x4dbdeb];return _0x19bc36;};'use strict';var Sequelize=require(_0xefa9('0x0'));module[_0xefa9('0x1')]={'name':{'type':Sequelize[_0xefa9('0x2')],'unique':_0xefa9('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xefa9('0x4')),'allowNull':![],'defaultValue':_0xefa9('0x4')},'description':{'type':Sequelize[_0xefa9('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xefa9('0x5')},'limitCalls':{'type':Sequelize[_0xefa9('0x6')](0x4)[_0xefa9('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xefa9('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xefa9('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xefa9('0x6')](0x5)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xefa9('0x9')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xefa9('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'comment':_0xefa9('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xefa9('0xc')},'dialTimezone':{'type':Sequelize[_0xefa9('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xefa9('0x2')],'defaultValue':_0xefa9('0xd')},'dialCheckDuplicateType':{'type':Sequelize[_0xefa9('0xe')]('always',_0xefa9('0xf'),_0xefa9('0x10')),'defaultValue':_0xefa9('0x11')},'dialAMDActive':{'type':Sequelize[_0xefa9('0x12')],'defaultValue':0x0,'comment':_0xefa9('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xefa9('0x6')](0x9)[_0xefa9('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xefa9('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xefa9('0x6')](0x9)[_0xefa9('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xefa9('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xefa9('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xefa9('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xefa9('0x6')](0x9)[_0xefa9('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xefa9('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xefa9('0x6')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xefa9('0x6')](0x9)[_0xefa9('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xefa9('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xefa9('0x6')](0x9)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xefa9('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xefa9('0x6')](0x5)[_0xefa9('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xefa9('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xefa9('0x6')](0x9)[_0xefa9('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xefa9('0x1b'),_0xefa9('0x1c')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xefa9('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xefa9('0x1d')},'dialCutDigit':{'type':Sequelize[_0xefa9('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xefa9('0x1e')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xefa9('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xefa9('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xefa9('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xefa9('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xefa9('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xefa9('0x6')](0x5)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xefa9('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xefa9('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xefa9('0x6')](0x5)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xefa9('0x25')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xefa9('0x6')](0x3)[_0xefa9('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xefa9('0x26')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xefa9('0x6')](0x5)[_0xefa9('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xefa9('0x27')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 0c6c455..3000fb8 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 _0x7fce=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','omit','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','CampaignId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','ListId','createdAt','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','destroy','get','UserProfileResource','sendStatus','error','name','send','map','Campaign','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','rows','catch','show','params','rawAttributes','options','find'];(function(_0x16e906,_0x27f2f8){var _0x20d8ed=function(_0x5ac187){while(--_0x5ac187){_0x16e906['push'](_0x16e906['shift']());}};_0x20d8ed(++_0x27f2f8);}(_0x7fce,0xdc));var _0xe7fc=function(_0x1c2dba,_0x563270){_0x1c2dba=_0x1c2dba-0x0;var _0x300d47=_0x7fce[_0x1c2dba];return _0x300d47;};'use strict';var emlformat=require(_0xe7fc('0x0'));var rimraf=require(_0xe7fc('0x1'));var zipdir=require(_0xe7fc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7fc('0x3'));var moment=require('moment');var BPromise=require(_0xe7fc('0x4'));var Mustache=require('mustache');var util=require(_0xe7fc('0x5'));var path=require(_0xe7fc('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe7fc('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe7fc('0x8'));var squel=require(_0xe7fc('0x9'));var crypto=require(_0xe7fc('0xa'));var jsforce=require(_0xe7fc('0xb'));var deskjs=require(_0xe7fc('0xc'));var toCsv=require('to-csv');var querystring=require(_0xe7fc('0xd'));var Papa=require('papaparse');var Redis=require(_0xe7fc('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xe7fc('0xf'));var as=require(_0xe7fc('0x10'));var hardwareService=require(_0xe7fc('0x11'));var logger=require(_0xe7fc('0x12'))('api');var utils=require(_0xe7fc('0x13'));var config=require(_0xe7fc('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x243600,_0x59da2e){_0x59da2e=_0x59da2e||0xcc;return function(_0x38512a){if(_0x38512a){return _0x243600['sendStatus'](_0x59da2e);}return _0x243600['status'](_0x59da2e)[_0xe7fc('0x15')]();};}function respondWithResult(_0x14fcbf,_0x235692){_0x235692=_0x235692||0xc8;return function(_0x307f58){if(_0x307f58){return _0x14fcbf[_0xe7fc('0x16')](_0x235692)['json'](_0x307f58);}};}function respondWithFilteredResult(_0x272cd5,_0x5ce83f){return function(_0x4da73b){if(_0x4da73b){var _0x1302e5=typeof _0x5ce83f[_0xe7fc('0x17')]===_0xe7fc('0x18')&&typeof _0x5ce83f[_0xe7fc('0x19')]==='undefined';var _0x552429=_0x4da73b['count'];var _0x4aa4f0=_0x1302e5?0x0:_0x5ce83f['offset'];var _0x490a99=_0x1302e5?_0x4da73b[_0xe7fc('0x1a')]:_0x5ce83f['offset']+_0x5ce83f[_0xe7fc('0x19')];var _0xb43fde;if(_0x490a99>=_0x552429){_0x490a99=_0x552429;_0xb43fde=0xc8;}else{_0xb43fde=0xce;}_0x272cd5[_0xe7fc('0x16')](_0xb43fde);return _0x272cd5[_0xe7fc('0x1b')](_0xe7fc('0x1c'),_0x4aa4f0+'-'+_0x490a99+'/'+_0x552429)[_0xe7fc('0x1d')](_0x4da73b);}return null;};}function patchUpdates(_0x329051){return function(_0x763103){try{jsonpatch['apply'](_0x763103,_0x329051,!![]);}catch(_0x39c75a){return BPromise[_0xe7fc('0x1e')](_0x39c75a);}return _0x763103['save']();};}function saveUpdates(_0x587dee,_0x35bb53){return function(_0x3c31e7){if(_0x3c31e7){return _0x3c31e7[_0xe7fc('0x1f')](_0x587dee)[_0xe7fc('0x20')](function(_0x26977a){return _0x26977a;});}return null;};}function removeEntity(_0x11c5a3,_0x3f850f){return function(_0x1731b6){if(_0x1731b6){return _0x1731b6[_0xe7fc('0x21')]()[_0xe7fc('0x20')](function(){var _0x1d1348=_0x1731b6[_0xe7fc('0x22')]({'plain':!![]});var _0x12ebdd='IvrCampaigns';return db[_0xe7fc('0x23')][_0xe7fc('0x21')]({'where':{'type':_0x12ebdd,'resourceId':_0x1d1348['id']}})[_0xe7fc('0x20')](function(){return _0x1731b6;});})[_0xe7fc('0x20')](function(){_0x11c5a3[_0xe7fc('0x16')](0xcc)[_0xe7fc('0x15')]();});}};}function handleEntityNotFound(_0x553ac5,_0x1a82e8){return function(_0x1ceedc){if(!_0x1ceedc){_0x553ac5[_0xe7fc('0x24')](0x194);}return _0x1ceedc;};}function handleError(_0x3e3798,_0x2f1628){_0x2f1628=_0x2f1628||0x1f4;return function(_0x4416b5){logger[_0xe7fc('0x25')](_0x4416b5['stack']);if(_0x4416b5[_0xe7fc('0x26')]){delete _0x4416b5[_0xe7fc('0x26')];}_0x3e3798['status'](_0x2f1628)[_0xe7fc('0x27')](_0x4416b5);};}exports['index']=function(_0x39d908,_0x27255a){var _0x547219={},_0x2b3830={},_0x4fe326={'count':0x0,'rows':[]};var _0x245965=_[_0xe7fc('0x28')](db[_0xe7fc('0x29')]['rawAttributes'],function(_0x36a043){return{'name':_0x36a043['fieldName'],'type':_0x36a043[_0xe7fc('0x2a')][_0xe7fc('0x2b')]};});_0x2b3830['model']=_['map'](_0x245965,'name');_0x2b3830['query']=_[_0xe7fc('0x2c')](_0x39d908[_0xe7fc('0x2d')]);_0x2b3830[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x2b3830[_0xe7fc('0x30')],_0x2b3830[_0xe7fc('0x2d')]);_0x547219[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x2b3830[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x39d908['query'][_0xe7fc('0x32')]));_0x547219[_0xe7fc('0x31')]=_0x547219[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x547219[_0xe7fc('0x31')]:_0x2b3830['model'];if(!_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x547219[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x547219[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x547219[_0xe7fc('0x36')]=qs['sort'](_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x547219[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_[_0xe7fc('0x39')](_0x39d908['query'],_0x2b3830[_0xe7fc('0x2e')]),_0x245965);if(_0x39d908[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x547219[_0xe7fc('0x38')]=_[_0xe7fc('0x3b')](_0x547219[_0xe7fc('0x38')],{'$or':_['map'](_0x245965,function(_0x5586d8){if(_0x5586d8['type']!=='VIRTUAL'){var _0x4fd29e={};_0x4fd29e[_0x5586d8[_0xe7fc('0x26')]]={'$like':'%'+_0x39d908[_0xe7fc('0x2d')]['filter']+'%'};return _0x4fd29e;}})});}_0x547219=_[_0xe7fc('0x3b')]({},_0x547219,_0x39d908['options']);var _0x280025={'where':_0x547219[_0xe7fc('0x38')]};return db[_0xe7fc('0x29')][_0xe7fc('0x1a')](_0x280025)[_0xe7fc('0x20')](function(_0x3e35c7){_0x4fe326['count']=_0x3e35c7;if(_0x39d908[_0xe7fc('0x2d')]['includeAll']){_0x547219[_0xe7fc('0x3c')]=[{'all':!![]}];}return db[_0xe7fc('0x29')]['findAll'](_0x547219);})[_0xe7fc('0x20')](function(_0x3ce7ad){_0x4fe326[_0xe7fc('0x3d')]=_0x3ce7ad;return _0x4fe326;})[_0xe7fc('0x20')](respondWithFilteredResult(_0x27255a,_0x547219))[_0xe7fc('0x3e')](handleError(_0x27255a,null));};exports[_0xe7fc('0x3f')]=function(_0x3f47aa,_0xab81b8){var _0x31473a={'raw':![],'where':{'id':_0x3f47aa[_0xe7fc('0x40')]['id']}},_0x118e94={};_0x118e94[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x29')][_0xe7fc('0x41')]);_0x118e94[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x3f47aa['query']);_0x118e94[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x118e94[_0xe7fc('0x30')],_0x118e94['query']);_0x31473a[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x118e94[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x3f47aa[_0xe7fc('0x2d')]['fields']));_0x31473a['attributes']=_0x31473a[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x31473a[_0xe7fc('0x31')]:_0x118e94[_0xe7fc('0x30')];if(_0x3f47aa[_0xe7fc('0x2d')]['includeAll']){_0x31473a[_0xe7fc('0x3c')]=[{'all':!![]}];}_0x31473a=_[_0xe7fc('0x3b')]({},_0x31473a,_0x3f47aa[_0xe7fc('0x42')]);return db[_0xe7fc('0x29')][_0xe7fc('0x43')](_0x31473a)[_0xe7fc('0x20')](handleEntityNotFound(_0xab81b8,null))[_0xe7fc('0x20')](respondWithResult(_0xab81b8,null))[_0xe7fc('0x3e')](handleError(_0xab81b8,null));};exports[_0xe7fc('0x44')]=function(_0x45edbf,_0x533f31){return db[_0xe7fc('0x29')]['create'](_0x45edbf[_0xe7fc('0x45')],{})[_0xe7fc('0x20')](function(_0x1129dd){var _0xc204f7=_0x45edbf[_0xe7fc('0x46')][_0xe7fc('0x22')]({'plain':!![]});if(!_0xc204f7)throw new Error(_0xe7fc('0x47'));if(_0xc204f7[_0xe7fc('0x48')]===_0xe7fc('0x46')){var _0x535afb=_0x1129dd[_0xe7fc('0x22')]({'plain':!![]});var _0xf553c1=_0xe7fc('0x49');return db[_0xe7fc('0x4a')][_0xe7fc('0x43')]({'where':{'name':_0xf553c1,'userProfileId':_0xc204f7[_0xe7fc('0x4b')]},'raw':!![]})['then'](function(_0x1ecaf1){if(_0x1ecaf1&&_0x1ecaf1[_0xe7fc('0x4c')]===0x0){return db[_0xe7fc('0x23')][_0xe7fc('0x44')]({'name':_0x535afb[_0xe7fc('0x26')],'resourceId':_0x535afb['id'],'type':_0x1ecaf1[_0xe7fc('0x26')],'sectionId':_0x1ecaf1['id']},{})['then'](function(){return _0x1129dd;});}else{return _0x1129dd;}})['catch'](function(_0x3d5f19){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d5f19);throw _0x3d5f19;});}return _0x1129dd;})[_0xe7fc('0x20')](respondWithResult(_0x533f31,0xc9))[_0xe7fc('0x3e')](handleError(_0x533f31,null));};exports[_0xe7fc('0x4d')]=function(_0x2cf52f,_0x2246d8){var _0x1fbd9d={'where':{'id':_0x2cf52f[_0xe7fc('0x40')]['id']}},_0x3fab1f={};_0x3fab1f[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x29')]['rawAttributes']);_0x1fbd9d[_0xe7fc('0x31')]=_['intersection'](_0x3fab1f[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x2cf52f[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x1fbd9d[_0xe7fc('0x31')]=_0x1fbd9d[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x1fbd9d[_0xe7fc('0x31')]:_0x3fab1f['model'];if(_0x2cf52f[_0xe7fc('0x2d')][_0xe7fc('0x4e')]){_0x1fbd9d['include']=[{'all':!![]}];}_0x1fbd9d=_[_0xe7fc('0x3b')]({},_0x1fbd9d,_0x2cf52f[_0xe7fc('0x42')]);return db[_0xe7fc('0x29')][_0xe7fc('0x43')](_0x1fbd9d)[_0xe7fc('0x20')](handleEntityNotFound(_0x2246d8,null))['then'](function(_0x1807b2){if(_0x1807b2){var _0x12c4ab=_0x1807b2[_0xe7fc('0x22')]({'plain':!![]});_0x12c4ab=qs[_0xe7fc('0x4f')](_0x12c4ab,['id','createdAt',_0xe7fc('0x50')]);_0x2cf52f[_0xe7fc('0x45')]=_[_0xe7fc('0x4f')](_0x2cf52f['body'],['id','createdAt',_0xe7fc('0x50')]);return db[_0xe7fc('0x29')][_0xe7fc('0x44')](_[_0xe7fc('0x3b')](_0x12c4ab,_0x2cf52f[_0xe7fc('0x45')]),{'include':_0x2cf52f[_0xe7fc('0x2d')]['includeAll']?[{'all':!![]}]:undefined})[_0xe7fc('0x20')](function(_0x4d9a11){var _0x31fbeb=_0x2cf52f[_0xe7fc('0x46')]['get']({'plain':!![]});if(!_0x31fbeb)throw new Error(_0xe7fc('0x47'));if(_0x31fbeb['role']==='user'){var _0x567ab9=_0x4d9a11[_0xe7fc('0x22')]({'plain':!![]});var _0x270505=_0xe7fc('0x49');return db['UserProfileSection']['find']({'where':{'name':_0x270505,'userProfileId':_0x31fbeb['userProfileId']},'raw':!![]})['then'](function(_0x3ea15b){if(_0x3ea15b&&_0x3ea15b[_0xe7fc('0x4c')]===0x0){return db[_0xe7fc('0x23')][_0xe7fc('0x44')]({'name':_0x567ab9[_0xe7fc('0x26')],'resourceId':_0x567ab9['id'],'type':_0x3ea15b[_0xe7fc('0x26')],'sectionId':_0x3ea15b['id']},{})[_0xe7fc('0x20')](function(){return _0x4d9a11;});}else{return _0x4d9a11;}})[_0xe7fc('0x3e')](function(_0x371a7f){logger['error'](_0xe7fc('0x51'),_0x371a7f);throw _0x371a7f;});}return _0x4d9a11;});}})['then'](respondWithResult(_0x2246d8,0xc9))[_0xe7fc('0x3e')](handleError(_0x2246d8,null));};exports[_0xe7fc('0x1f')]=function(_0x30c2e1,_0x561e5a){if(_0x30c2e1[_0xe7fc('0x45')]['id']){delete _0x30c2e1[_0xe7fc('0x45')]['id'];}return db['Campaign'][_0xe7fc('0x43')]({'where':{'id':_0x30c2e1[_0xe7fc('0x40')]['id']}})['then'](handleEntityNotFound(_0x561e5a,null))[_0xe7fc('0x20')](saveUpdates(_0x30c2e1[_0xe7fc('0x45')],null))[_0xe7fc('0x20')](respondWithResult(_0x561e5a,null))['catch'](handleError(_0x561e5a,null));};exports[_0xe7fc('0x21')]=function(_0x5cad9e,_0x51838f){return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x5cad9e[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x51838f,null))[_0xe7fc('0x20')](removeEntity(_0x51838f,null))[_0xe7fc('0x3e')](handleError(_0x51838f,null));};exports['getHoppers']=function(_0x3f4dea,_0x2dc3db,_0x390a6e){var _0x26a1a4={'raw':!![],'where':{}};var _0x58a981={};var _0x1b9dff={'count':0x0,'rows':[]};return db[_0xe7fc('0x29')][_0xe7fc('0x52')]({'where':{'id':_0x3f4dea['params']['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x2dc3db,null))[_0xe7fc('0x20')](function(_0x59baff){if(_0x59baff){_0x58a981[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x53')][_0xe7fc('0x41')]);_0x58a981[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x3f4dea[_0xe7fc('0x2d')]);_0x58a981[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x58a981['model'],_0x58a981['query']);_0x26a1a4['attributes']=_[_0xe7fc('0x2f')](_0x58a981[_0xe7fc('0x30')],qs['fields'](_0x3f4dea[_0xe7fc('0x2d')]['fields']));_0x26a1a4[_0xe7fc('0x31')]=_0x26a1a4['attributes'][_0xe7fc('0x33')]?_0x26a1a4[_0xe7fc('0x31')]:_0x58a981[_0xe7fc('0x30')];if(!_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x26a1a4[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x26a1a4[_0xe7fc('0x17')]=qs['offset'](_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x26a1a4[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x3f4dea['query'][_0xe7fc('0x37')]);_0x26a1a4[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_['pick'](_0x3f4dea[_0xe7fc('0x2d')],_0x58a981[_0xe7fc('0x2e')]));_0x26a1a4[_0xe7fc('0x38')][_0xe7fc('0x54')]=_0x59baff['id'];if(_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x26a1a4[_0xe7fc('0x38')]=_[_0xe7fc('0x3b')](_0x26a1a4['where'],{'$or':_[_0xe7fc('0x28')](_0x26a1a4['attributes'],function(_0x2cdd29){var _0xc5621f={};_0xc5621f[_0x2cdd29]={'$like':'%'+_0x3f4dea[_0xe7fc('0x2d')]['filter']+'%'};return _0xc5621f;})});}_0x26a1a4=_[_0xe7fc('0x3b')]({},_0x26a1a4,_0x3f4dea[_0xe7fc('0x42')]);return db[_0xe7fc('0x53')]['count']({'where':_0x26a1a4[_0xe7fc('0x38')]})['then'](function(_0x7cfe41){_0x1b9dff[_0xe7fc('0x1a')]=_0x7cfe41;if(_0x3f4dea[_0xe7fc('0x2d')][_0xe7fc('0x4e')]){_0x26a1a4[_0xe7fc('0x3c')]=[{'all':!![]}];}return db['CmHopper'][_0xe7fc('0x55')](_0x26a1a4);})[_0xe7fc('0x20')](function(_0x9e3d14){_0x1b9dff['rows']=_0x9e3d14;return _0x1b9dff;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x2dc3db,_0x26a1a4))['catch'](handleError(_0x2dc3db,null));};exports[_0xe7fc('0x56')]=function(_0x5256ad,_0x55ca6f,_0x195b86){var _0x116702={'raw':!![],'where':{}};var _0x3ca583={};var _0x9445bb={'count':0x0,'rows':[]};return db[_0xe7fc('0x29')][_0xe7fc('0x52')]({'where':{'id':_0x5256ad[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x55ca6f,null))[_0xe7fc('0x20')](function(_0x23a31b){if(_0x23a31b){_0x3ca583[_0xe7fc('0x30')]=_[_0xe7fc('0x2c')](db[_0xe7fc('0x57')]['rawAttributes']);_0x3ca583[_0xe7fc('0x2d')]=_['keys'](_0x5256ad[_0xe7fc('0x2d')]);_0x3ca583[_0xe7fc('0x2e')]=_['intersection'](_0x3ca583['model'],_0x3ca583[_0xe7fc('0x2d')]);_0x116702['attributes']=_[_0xe7fc('0x2f')](_0x3ca583[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x116702[_0xe7fc('0x31')]=_0x116702[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x116702[_0xe7fc('0x31')]:_0x3ca583[_0xe7fc('0x30')];if(!_0x5256ad['query'][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x116702['limit']=qs[_0xe7fc('0x19')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x116702[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x116702[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x116702[_0xe7fc('0x38')]=qs['filters'](_[_0xe7fc('0x39')](_0x5256ad[_0xe7fc('0x2d')],_0x3ca583[_0xe7fc('0x2e')]));_0x116702['where']['CampaignId']=_0x23a31b['id'];if(_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x116702[_0xe7fc('0x38')]=_['merge'](_0x116702[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x116702['attributes'],function(_0x9fd013){var _0x4ae3bf={};_0x4ae3bf[_0x9fd013]={'$like':'%'+_0x5256ad[_0xe7fc('0x2d')][_0xe7fc('0x3a')]+'%'};return _0x4ae3bf;})});}_0x116702=_[_0xe7fc('0x3b')]({},_0x116702,_0x5256ad[_0xe7fc('0x42')]);return db[_0xe7fc('0x57')][_0xe7fc('0x1a')]({'where':_0x116702[_0xe7fc('0x38')]})[_0xe7fc('0x20')](function(_0x466296){_0x9445bb[_0xe7fc('0x1a')]=_0x466296;if(_0x5256ad[_0xe7fc('0x2d')]['includeAll']){_0x116702['include']=[{'all':!![]}];}return db[_0xe7fc('0x57')][_0xe7fc('0x55')](_0x116702);})['then'](function(_0x2f501f){_0x9445bb[_0xe7fc('0x3d')]=_0x2f501f;return _0x9445bb;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x55ca6f,_0x116702))[_0xe7fc('0x3e')](handleError(_0x55ca6f,null));};exports[_0xe7fc('0x58')]=function(_0x1034fe,_0x3416d6,_0x19b496){var _0x323580={'raw':!![],'where':{}};var _0x269675={};var _0x274a98={'count':0x0,'rows':[]};return db['Campaign'][_0xe7fc('0x52')]({'where':{'id':_0x1034fe[_0xe7fc('0x40')]['id']}})['then'](handleEntityNotFound(_0x3416d6,null))[_0xe7fc('0x20')](function(_0x598e79){if(_0x598e79){_0x269675[_0xe7fc('0x30')]=_['keys'](db['CmHopperFinal'][_0xe7fc('0x41')]);_0x269675[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x1034fe['query']);_0x269675['filters']=_[_0xe7fc('0x2f')](_0x269675['model'],_0x269675[_0xe7fc('0x2d')]);_0x323580[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x269675[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x1034fe['query'][_0xe7fc('0x32')]));_0x323580[_0xe7fc('0x31')]=_0x323580[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x323580[_0xe7fc('0x31')]:_0x269675['model'];if(!_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x323580[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x323580[_0xe7fc('0x17')]=qs['offset'](_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x323580[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x1034fe[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x323580[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_['pick'](_0x1034fe[_0xe7fc('0x2d')],_0x269675[_0xe7fc('0x2e')]));_0x323580[_0xe7fc('0x38')]['CampaignId']=_0x598e79['id'];if(_0x1034fe[_0xe7fc('0x2d')]['filter']){_0x323580[_0xe7fc('0x38')]=_['merge'](_0x323580[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x323580[_0xe7fc('0x31')],function(_0x3df140){var _0x1c6d19={};_0x1c6d19[_0x3df140]={'$like':'%'+_0x1034fe['query']['filter']+'%'};return _0x1c6d19;})});}_0x323580=_[_0xe7fc('0x3b')]({},_0x323580,_0x1034fe[_0xe7fc('0x42')]);return db[_0xe7fc('0x59')][_0xe7fc('0x1a')]({'where':_0x323580['where']})[_0xe7fc('0x20')](function(_0x445332){_0x274a98[_0xe7fc('0x1a')]=_0x445332;if(_0x1034fe[_0xe7fc('0x2d')]['includeAll']){_0x323580[_0xe7fc('0x3c')]=[{'all':!![]}];}return db[_0xe7fc('0x59')][_0xe7fc('0x55')](_0x323580);})[_0xe7fc('0x20')](function(_0x303ba8){_0x274a98[_0xe7fc('0x3d')]=_0x303ba8;return _0x274a98;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x3416d6,_0x323580))[_0xe7fc('0x3e')](handleError(_0x3416d6,null));};exports[_0xe7fc('0x5a')]=function(_0x5e4652,_0x234629,_0x18ba9b){var _0x13d64b={'raw':!![],'where':{}};var _0x4a0432={};var _0x3a9f96={'count':0x0,'rows':[]};return db['Campaign'][_0xe7fc('0x52')]({'where':{'id':_0x5e4652['params']['id']}})['then'](handleEntityNotFound(_0x234629,null))[_0xe7fc('0x20')](function(_0x177f8f){if(_0x177f8f){_0x4a0432['model']=_[_0xe7fc('0x2c')](db['CmHopperBlack'][_0xe7fc('0x41')]);_0x4a0432[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x5e4652[_0xe7fc('0x2d')]);_0x4a0432['filters']=_[_0xe7fc('0x2f')](_0x4a0432['model'],_0x4a0432['query']);_0x13d64b[_0xe7fc('0x31')]=_[_0xe7fc('0x2f')](_0x4a0432[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x13d64b[_0xe7fc('0x31')]=_0x13d64b[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x13d64b[_0xe7fc('0x31')]:_0x4a0432[_0xe7fc('0x30')];if(!_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x34')]('nolimit')){_0x13d64b[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x5e4652['query']['limit']);_0x13d64b[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}_0x13d64b[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x5e4652['query'][_0xe7fc('0x37')]);_0x13d64b[_0xe7fc('0x38')]=qs[_0xe7fc('0x2e')](_[_0xe7fc('0x39')](_0x5e4652[_0xe7fc('0x2d')],_0x4a0432[_0xe7fc('0x2e')]));_0x13d64b[_0xe7fc('0x38')]['CampaignId']=_0x177f8f['id'];if(_0x5e4652['query'][_0xe7fc('0x3a')]){_0x13d64b[_0xe7fc('0x38')]=_[_0xe7fc('0x3b')](_0x13d64b[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x13d64b[_0xe7fc('0x31')],function(_0x12cb64){var _0x263504={};_0x263504[_0x12cb64]={'$like':'%'+_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x3a')]+'%'};return _0x263504;})});}_0x13d64b=_['merge']({},_0x13d64b,_0x5e4652['options']);return db['CmHopperBlack'][_0xe7fc('0x1a')]({'where':_0x13d64b[_0xe7fc('0x38')]})[_0xe7fc('0x20')](function(_0x214c7c){_0x3a9f96[_0xe7fc('0x1a')]=_0x214c7c;if(_0x5e4652[_0xe7fc('0x2d')][_0xe7fc('0x4e')]){_0x13d64b[_0xe7fc('0x3c')]=[{'all':!![]}];}return db[_0xe7fc('0x5b')][_0xe7fc('0x55')](_0x13d64b);})[_0xe7fc('0x20')](function(_0x298849){_0x3a9f96[_0xe7fc('0x3d')]=_0x298849;return _0x3a9f96;});}})[_0xe7fc('0x20')](respondWithFilteredResult(_0x234629,_0x13d64b))[_0xe7fc('0x3e')](handleError(_0x234629,null));};exports[_0xe7fc('0x5c')]=function(_0x3b3017,_0x18f5a4,_0x5cf31b){var _0x415dbe={};var _0x454ec2={};var _0x243105;var _0x2eccd5;return db['Campaign'][_0xe7fc('0x52')]({'where':{'id':_0x3b3017[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x18f5a4,null))[_0xe7fc('0x20')](function(_0x338afb){if(_0x338afb){_0x243105=_0x338afb;_0x454ec2[_0xe7fc('0x30')]=_['keys'](db['CmList'][_0xe7fc('0x41')]);_0x454ec2['query']=_['keys'](_0x3b3017['query']);_0x454ec2[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x454ec2[_0xe7fc('0x30')],_0x454ec2[_0xe7fc('0x2d')]);_0x415dbe['attributes']=_['intersection'](_0x454ec2[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x32')]));_0x415dbe[_0xe7fc('0x31')]=_0x415dbe[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x415dbe[_0xe7fc('0x31')]:_0x454ec2[_0xe7fc('0x30')];_0x415dbe[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x415dbe[_0xe7fc('0x38')]=qs['filters'](_[_0xe7fc('0x39')](_0x3b3017[_0xe7fc('0x2d')],_0x454ec2['filters']));if(_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x415dbe[_0xe7fc('0x38')]=_['merge'](_0x415dbe[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x415dbe['attributes'],function(_0x4e22e0){var _0x21c42b={};_0x21c42b[_0x4e22e0]={'$like':'%'+_0x3b3017['query'][_0xe7fc('0x3a')]+'%'};return _0x21c42b;})});}_0x415dbe=_[_0xe7fc('0x3b')]({},_0x415dbe,_0x3b3017[_0xe7fc('0x42')]);return _0x243105[_0xe7fc('0x5c')](_0x415dbe);}})[_0xe7fc('0x20')](function(_0x5dae71){if(_0x5dae71){_0x2eccd5=_0x5dae71[_0xe7fc('0x33')];if(!_0x3b3017[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x415dbe[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x3b3017['query'][_0xe7fc('0x19')]);_0x415dbe['offset']=qs[_0xe7fc('0x17')](_0x3b3017['query'][_0xe7fc('0x17')]);}return _0x243105['getLists'](_0x415dbe);}})['then'](function(_0x4521fa){if(_0x4521fa){return _0x4521fa?{'count':_0x2eccd5,'rows':_0x4521fa}:null;}})[_0xe7fc('0x20')](respondWithResult(_0x18f5a4,null))[_0xe7fc('0x3e')](handleError(_0x18f5a4,null));};exports[_0xe7fc('0x5d')]=function(_0x2bb619,_0x3ef536,_0x41206a){var _0x26e587,_0x215532;var _0x237160=[];var _0x2ee092=moment()[_0xe7fc('0x5e')](_0xe7fc('0x5f'));return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x2bb619['params']['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x3ef536,null))[_0xe7fc('0x20')](function(_0xd37ad){if(_0xd37ad){_0x215532=_0xd37ad;return _0xd37ad[_0xe7fc('0x5d')](_0x2bb619[_0xe7fc('0x45')][_0xe7fc('0x60')],_['omit'](_0x2bb619[_0xe7fc('0x45')],[_0xe7fc('0x60'),'id'])||{});}return null;})[_0xe7fc('0x61')](function(_0x2b120d){var _0xd8b989;var _0x1ea67b;_0x26e587=_0x2b120d||[];var _0x4849a0=[];if(_0x2b120d){for(var _0x2892cb=0x0;_0x2892cb<_0x2b120d[_0xe7fc('0x33')];_0x2892cb+=0x1){var _0x6cef1f=_0x2b120d[_0x2892cb][_0xe7fc('0x22')]({'plain':!![]});_0x215532['dialCheckDuplicateType']=_0x2bb619[_0xe7fc('0x45')][_0xe7fc('0x62')]?_0x2bb619[_0xe7fc('0x45')][_0xe7fc('0x62')]:_0x215532[_0xe7fc('0x62')];switch(_0x215532[_0xe7fc('0x62')]){case _0xe7fc('0x63'):_0xd8b989=squel[_0xe7fc('0x64')]()['into'](_0xe7fc('0x65'))[_0xe7fc('0x66')]([_0xe7fc('0x67'),'scheduledAt',_0xe7fc('0x68'),'ListId','CampaignId','createdAt','updatedAt'],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),'phone')[_0xe7fc('0x6a')](_0xe7fc('0x6b'),_0xe7fc('0x6c'))[_0xe7fc('0x6a')]('id',_0xe7fc('0x68'))[_0xe7fc('0x6a')](_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),_0xe7fc('0x6f'))['field'](_0x2bb619[_0xe7fc('0x40')]['id'][_0xe7fc('0x6e')](),_0xe7fc('0x54'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27',_0xe7fc('0x70'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27',_0xe7fc('0x50'))[_0xe7fc('0x71')](_0xe7fc('0x72'))[_0xe7fc('0x38')]('deletedAt\x20IS\x20NULL')[_0xe7fc('0x38')](_0xe7fc('0x73'),_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')]())[_0xe7fc('0x38')](_0xe7fc('0x74'))[_0xe7fc('0x38')](_0xe7fc('0x75'),squel[_0xe7fc('0x69')]()['field']('COALESCE(calleridnum,\x27\x27)')[_0xe7fc('0x71')](_0xe7fc('0x76'))['where'](_0xe7fc('0x77'),_0x2bb619[_0xe7fc('0x40')]['id']['toString']()))[_0xe7fc('0x38')](_0xe7fc('0x75'),squel['select']()['field'](_0xe7fc('0x78'))['from'](_0xe7fc('0x65'))[_0xe7fc('0x38')](_0xe7fc('0x77'),_0x2bb619['params']['id'][_0xe7fc('0x6e')]())))['toString']();break;case _0xe7fc('0x79'):_0xd8b989=squel['insert']()[_0xe7fc('0x7a')]('cm_hopper')[_0xe7fc('0x66')]([_0xe7fc('0x67'),_0xe7fc('0x6c'),_0xe7fc('0x68'),_0xe7fc('0x6f'),_0xe7fc('0x54'),_0xe7fc('0x70'),_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),_0xe7fc('0x67'))[_0xe7fc('0x6a')](_0xe7fc('0x6b'),_0xe7fc('0x6c'))[_0xe7fc('0x6a')]('id','ContactId')[_0xe7fc('0x6a')](_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),_0xe7fc('0x6f'))['field'](_0x2bb619['params']['id'][_0xe7fc('0x6e')](),'CampaignId')[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','createdAt')['field']('\x27'+_0x2ee092+'\x27',_0xe7fc('0x50'))['from'](_0xe7fc('0x72'))['where'](_0xe7fc('0x7b'))[_0xe7fc('0x38')]('ListId\x20=\x20?',_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xe7fc('0x38')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x78'))[_0xe7fc('0x71')]('cm_hopper')['where'](_0xe7fc('0x77'),_0x2bb619[_0xe7fc('0x40')]['id']['toString']())))['toString']();break;default:_0xd8b989=squel[_0xe7fc('0x64')]()[_0xe7fc('0x7a')]('cm_hopper')[_0xe7fc('0x66')](['phone','scheduledAt',_0xe7fc('0x68'),_0xe7fc('0x6f'),_0xe7fc('0x54'),_0xe7fc('0x70'),_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),'phone')['field'](_0xe7fc('0x6b'),_0xe7fc('0x6c'))[_0xe7fc('0x6a')]('id',_0xe7fc('0x68'))[_0xe7fc('0x6a')](_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),'ListId')[_0xe7fc('0x6a')](_0x2bb619[_0xe7fc('0x40')]['id'][_0xe7fc('0x6e')](),'CampaignId')[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27',_0xe7fc('0x70'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','updatedAt')[_0xe7fc('0x71')](_0xe7fc('0x72'))[_0xe7fc('0x38')]('deletedAt\x20IS\x20NULL')[_0xe7fc('0x38')](_0xe7fc('0x73'),_0x6cef1f[_0xe7fc('0x6d')][_0xe7fc('0x6e')]())[_0xe7fc('0x38')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x1ea67b=squel['insert']()['into'](_0xe7fc('0x7c'))['fromQuery']([_0xe7fc('0x7d'),_0xe7fc('0x6c'),_0xe7fc('0x67'),_0xe7fc('0x7e'),_0xe7fc('0x70'),_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()['field'](_0xe7fc('0x7f'),'id')[_0xe7fc('0x6a')](_0xe7fc('0x6b'),'scheduledAt')[_0xe7fc('0x6a')](_0xe7fc('0x80'),_0xe7fc('0x67'))[_0xe7fc('0x6a')](_0xe7fc('0x81'),_0xe7fc('0x7e'))[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','createdAt')[_0xe7fc('0x6a')]('\x27'+_0x2ee092+'\x27','updatedAt')[_0xe7fc('0x71')](_0xe7fc('0x82'),'ci')[_0xe7fc('0x83')](_0xe7fc('0x65'),'h',_0xe7fc('0x84'))['where'](_0xe7fc('0x85'),_0x6cef1f['CmListId'][_0xe7fc('0x6e')]())[_0xe7fc('0x38')](_0xe7fc('0x86'),_0x2bb619['params']['id'][_0xe7fc('0x6e')]())[_0xe7fc('0x38')](_0xe7fc('0x87'),_0x2ee092))[_0xe7fc('0x6e')]();_0x4849a0[_0xe7fc('0x88')](db['sequelize'][_0xe7fc('0x2d')](_0xd8b989));_0x237160[_0xe7fc('0x88')](db[_0xe7fc('0x89')][_0xe7fc('0x2d')](_0x1ea67b));}return BPromise[_0xe7fc('0x8a')](_0x4849a0);}})[_0xe7fc('0x20')](function(){return BPromise[_0xe7fc('0x8a')](_0x237160);})[_0xe7fc('0x20')](function(){return _0x26e587;})[_0xe7fc('0x20')](respondWithResult(_0x3ef536,null))['catch'](handleError(_0x3ef536,null));};exports[_0xe7fc('0x8b')]=function(_0x2e8fd6,_0x30c72c,_0x394ca4){return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x2e8fd6[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x30c72c,null))[_0xe7fc('0x20')](function(_0x442408){if(_0x442408){return _0x442408[_0xe7fc('0x8b')](_0x2e8fd6[_0xe7fc('0x2d')][_0xe7fc('0x60')]);}})[_0xe7fc('0x20')](function(_0x332e1b){if(_0x332e1b){return db[_0xe7fc('0x53')][_0xe7fc('0x21')]({'where':{'ListId':_0x2e8fd6['query'][_0xe7fc('0x60')],'CampaignId':_0x2e8fd6['params']['id']}})['then'](function(){return _0x332e1b;});}})['then'](respondWithStatusCode(_0x30c72c,null))[_0xe7fc('0x3e')](handleError(_0x30c72c,null));};exports[_0xe7fc('0x8c')]=function(_0x3acdb5,_0x464702,_0x5ce4cd){var _0x3fb020={};var _0x41ea88={};var _0x66fa8e;var _0x268f6a;return db[_0xe7fc('0x29')][_0xe7fc('0x52')]({'where':{'id':_0x3acdb5['params']['id']}})['then'](handleEntityNotFound(_0x464702,null))['then'](function(_0x10d59e){if(_0x10d59e){_0x66fa8e=_0x10d59e;_0x41ea88['model']=_['keys'](db[_0xe7fc('0x8d')][_0xe7fc('0x41')]);_0x41ea88[_0xe7fc('0x2d')]=_[_0xe7fc('0x2c')](_0x3acdb5['query']);_0x41ea88[_0xe7fc('0x2e')]=_[_0xe7fc('0x2f')](_0x41ea88[_0xe7fc('0x30')],_0x41ea88[_0xe7fc('0x2d')]);_0x3fb020['attributes']=_['intersection'](_0x41ea88[_0xe7fc('0x30')],qs[_0xe7fc('0x32')](_0x3acdb5[_0xe7fc('0x2d')]['fields']));_0x3fb020[_0xe7fc('0x31')]=_0x3fb020[_0xe7fc('0x31')][_0xe7fc('0x33')]?_0x3fb020['attributes']:_0x41ea88['model'];_0x3fb020[_0xe7fc('0x36')]=qs[_0xe7fc('0x37')](_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x37')]);_0x3fb020['where']=qs[_0xe7fc('0x2e')](_[_0xe7fc('0x39')](_0x3acdb5[_0xe7fc('0x2d')],_0x41ea88['filters']));if(_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x3a')]){_0x3fb020[_0xe7fc('0x38')]=_['merge'](_0x3fb020[_0xe7fc('0x38')],{'$or':_[_0xe7fc('0x28')](_0x3fb020[_0xe7fc('0x31')],function(_0x5921bc){var _0x5024b6={};_0x5024b6[_0x5921bc]={'$like':'%'+_0x3acdb5['query'][_0xe7fc('0x3a')]+'%'};return _0x5024b6;})});}_0x3fb020=_[_0xe7fc('0x3b')]({},_0x3fb020,_0x3acdb5['options']);return _0x66fa8e['getBlackLists'](_0x3fb020);}})[_0xe7fc('0x20')](function(_0x375035){if(_0x375035){_0x268f6a=_0x375035[_0xe7fc('0x33')];if(!_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x34')](_0xe7fc('0x35'))){_0x3fb020[_0xe7fc('0x19')]=qs[_0xe7fc('0x19')](_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x19')]);_0x3fb020[_0xe7fc('0x17')]=qs[_0xe7fc('0x17')](_0x3acdb5[_0xe7fc('0x2d')][_0xe7fc('0x17')]);}return _0x66fa8e[_0xe7fc('0x8c')](_0x3fb020);}})[_0xe7fc('0x20')](function(_0x5d3b52){if(_0x5d3b52){return _0x5d3b52?{'count':_0x268f6a,'rows':_0x5d3b52}:null;}})[_0xe7fc('0x20')](respondWithResult(_0x464702,null))[_0xe7fc('0x3e')](handleError(_0x464702,null));};exports[_0xe7fc('0x8e')]=function(_0xfe96fd,_0x4380b1,_0x2ce23f){var _0x18abc3,_0xb0ffa6;var _0x81eabb=[];var _0x7cda06=moment()['format'](_0xe7fc('0x5f'));return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0xfe96fd[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x4380b1,null))[_0xe7fc('0x20')](function(_0x521834){if(_0x521834){_0xb0ffa6=_0x521834;return _0x521834[_0xe7fc('0x8e')](_0xfe96fd[_0xe7fc('0x45')][_0xe7fc('0x60')],_[_0xe7fc('0x4f')](_0xfe96fd['body'],['ids','id'])||{});}return null;})['spread'](function(_0x14444f){var _0x5a0bdb;var _0x62f194;_0x18abc3=_0x14444f||[];var _0x524203=[];if(_0x14444f){for(var _0x129496=0x0;_0x129496<_0x14444f[_0xe7fc('0x33')];_0x129496+=0x1){var _0x1e2aae=_0x14444f[_0x129496]['get']({'plain':!![]});_0x5a0bdb=squel[_0xe7fc('0x64')]()['into']('cm_hopper_black')[_0xe7fc('0x66')](['phone',_0xe7fc('0x68'),_0xe7fc('0x6f'),_0xe7fc('0x54'),'createdAt',_0xe7fc('0x50')],squel[_0xe7fc('0x69')]()[_0xe7fc('0x6a')](_0xe7fc('0x67'),_0xe7fc('0x67'))[_0xe7fc('0x6a')]('id',_0xe7fc('0x68'))['field'](_0x1e2aae[_0xe7fc('0x6d')][_0xe7fc('0x6e')](),'ListId')[_0xe7fc('0x6a')](_0xfe96fd[_0xe7fc('0x40')]['id'][_0xe7fc('0x6e')](),_0xe7fc('0x54'))[_0xe7fc('0x6a')]('NOW()',_0xe7fc('0x70'))[_0xe7fc('0x6a')](_0xe7fc('0x6b'),_0xe7fc('0x50'))[_0xe7fc('0x71')](_0xe7fc('0x72'))['where'](_0xe7fc('0x7b'))[_0xe7fc('0x38')]('ListId\x20=\x20?',_0x1e2aae[_0xe7fc('0x6d')]['toString']())[_0xe7fc('0x38')](_0xe7fc('0x74')))[_0xe7fc('0x6e')]();_0x524203[_0xe7fc('0x88')](db[_0xe7fc('0x89')][_0xe7fc('0x2d')](_0x5a0bdb));}return BPromise[_0xe7fc('0x8a')](_0x524203);}})[_0xe7fc('0x20')](function(){return _0x18abc3;})[_0xe7fc('0x20')](respondWithResult(_0x4380b1,null))[_0xe7fc('0x3e')](handleError(_0x4380b1,null));};exports[_0xe7fc('0x8f')]=function(_0x44c20a,_0x47d3d5,_0x1f6e34){return db[_0xe7fc('0x29')][_0xe7fc('0x43')]({'where':{'id':_0x44c20a[_0xe7fc('0x40')]['id']}})[_0xe7fc('0x20')](handleEntityNotFound(_0x47d3d5,null))['then'](function(_0x39b319){if(_0x39b319){return _0x39b319['removeBlackLists'](_0x44c20a[_0xe7fc('0x2d')][_0xe7fc('0x60')]);}})[_0xe7fc('0x20')](function(_0x178888){if(_0x178888){return db[_0xe7fc('0x5b')]['destroy']({'where':{'ListId':_0x44c20a[_0xe7fc('0x2d')][_0xe7fc('0x60')],'CampaignId':_0x44c20a[_0xe7fc('0x40')]['id']}})['then'](function(){return _0x178888;});}})[_0xe7fc('0x20')](respondWithStatusCode(_0x47d3d5,null))[_0xe7fc('0x3e')](handleError(_0x47d3d5,null));}; \ No newline at end of file +var _0x7275=['scheduledAt','ContactId','ListId','phone','NOW()','field','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_hopper_additional_phones','cmHopperId','h.id','ci.OrderBY','OrderBy','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','UserProfileResource','destroy','stack','name','index','map','Campaign','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','create','UserProfileSection','getHoppers','findOne','CmHopper','order','CampaignId','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','addLists','format','YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery'];(function(_0x5e65cf,_0x4b15c6){var _0x1de15c=function(_0x9d1980){while(--_0x9d1980){_0x5e65cf['push'](_0x5e65cf['shift']());}};_0x1de15c(++_0x4b15c6);}(_0x7275,0x143));var _0x5727=function(_0x3b44a0,_0x240182){_0x3b44a0=_0x3b44a0-0x0;var _0x359a80=_0x7275[_0x3b44a0];return _0x359a80;};'use strict';var emlformat=require(_0x5727('0x0'));var rimraf=require(_0x5727('0x1'));var zipdir=require(_0x5727('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5727('0x3'));var moment=require('moment');var BPromise=require(_0x5727('0x4'));var Mustache=require(_0x5727('0x5'));var util=require('util');var path=require(_0x5727('0x6'));var sox=require(_0x5727('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5727('0x8'));var squel=require('squel');var crypto=require(_0x5727('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5727('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5727('0xb'));var Papa=require(_0x5727('0xc'));var Redis=require('ioredis');var authService=require(_0x5727('0xd'));var qs=require(_0x5727('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5727('0xf'));var logger=require(_0x5727('0x10'))('api');var utils=require(_0x5727('0x11'));var config=require(_0x5727('0x12'));var licenseUtil=require(_0x5727('0x13'));var db=require(_0x5727('0x14'))['db'];function respondWithStatusCode(_0x362b0e,_0x45ec3c){_0x45ec3c=_0x45ec3c||0xcc;return function(_0x48c6f4){if(_0x48c6f4){return _0x362b0e[_0x5727('0x15')](_0x45ec3c);}return _0x362b0e[_0x5727('0x16')](_0x45ec3c)[_0x5727('0x17')]();};}function respondWithResult(_0x242b6a,_0x2a01df){_0x2a01df=_0x2a01df||0xc8;return function(_0x463721){if(_0x463721){return _0x242b6a[_0x5727('0x16')](_0x2a01df)['json'](_0x463721);}};}function respondWithFilteredResult(_0x24e514,_0x284633){return function(_0x1dcefc){if(_0x1dcefc){var _0x12b045=typeof _0x284633[_0x5727('0x18')]===_0x5727('0x19')&&typeof _0x284633[_0x5727('0x1a')]==='undefined';var _0x11d52c=_0x1dcefc['count'];var _0x360be0=_0x12b045?0x0:_0x284633[_0x5727('0x18')];var _0x55fc33=_0x12b045?_0x1dcefc[_0x5727('0x1b')]:_0x284633[_0x5727('0x18')]+_0x284633[_0x5727('0x1a')];var _0x35e30f;if(_0x55fc33>=_0x11d52c){_0x55fc33=_0x11d52c;_0x35e30f=0xc8;}else{_0x35e30f=0xce;}_0x24e514[_0x5727('0x16')](_0x35e30f);return _0x24e514['set']('Content-Range',_0x360be0+'-'+_0x55fc33+'/'+_0x11d52c)[_0x5727('0x1c')](_0x1dcefc);}return null;};}function patchUpdates(_0xb99c6e){return function(_0x84c9e2){try{jsonpatch[_0x5727('0x1d')](_0x84c9e2,_0xb99c6e,!![]);}catch(_0xf584e8){return BPromise[_0x5727('0x1e')](_0xf584e8);}return _0x84c9e2[_0x5727('0x1f')]();};}function saveUpdates(_0x5c63ef,_0x4aa3af){return function(_0x476a47){if(_0x476a47){return _0x476a47[_0x5727('0x20')](_0x5c63ef)['then'](function(_0x1cb06f){return _0x1cb06f;});}return null;};}function removeEntity(_0xb217a7,_0x3775b5){return function(_0x4a3e6b){if(_0x4a3e6b){return _0x4a3e6b['destroy']()[_0x5727('0x21')](function(){var _0x179e74=_0x4a3e6b['get']({'plain':!![]});var _0x41cd74='IvrCampaigns';return db[_0x5727('0x22')][_0x5727('0x23')]({'where':{'type':_0x41cd74,'resourceId':_0x179e74['id']}})['then'](function(){return _0x4a3e6b;});})['then'](function(){_0xb217a7[_0x5727('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c5305,_0x3dd7d2){return function(_0x161f5){if(!_0x161f5){_0x4c5305[_0x5727('0x15')](0x194);}return _0x161f5;};}function handleError(_0xf82573,_0x3afd59){_0x3afd59=_0x3afd59||0x1f4;return function(_0x56e93d){logger['error'](_0x56e93d[_0x5727('0x24')]);if(_0x56e93d[_0x5727('0x25')]){delete _0x56e93d[_0x5727('0x25')];}_0xf82573[_0x5727('0x16')](_0x3afd59)['send'](_0x56e93d);};}exports[_0x5727('0x26')]=function(_0x4b8ce3,_0x1d81ab){var _0x4bdae7={},_0x19636b={},_0x5a6827={'count':0x0,'rows':[]};var _0xe3a786=_[_0x5727('0x27')](db[_0x5727('0x28')][_0x5727('0x29')],function(_0x58080b){return{'name':_0x58080b[_0x5727('0x2a')],'type':_0x58080b[_0x5727('0x2b')]['key']};});_0x19636b['model']=_[_0x5727('0x27')](_0xe3a786,_0x5727('0x25'));_0x19636b[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x4b8ce3[_0x5727('0x2c')]);_0x19636b['filters']=_[_0x5727('0x2e')](_0x19636b[_0x5727('0x2f')],_0x19636b[_0x5727('0x2c')]);_0x4bdae7[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x19636b[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x4b8ce3[_0x5727('0x2c')][_0x5727('0x31')]));_0x4bdae7[_0x5727('0x30')]=_0x4bdae7[_0x5727('0x30')][_0x5727('0x32')]?_0x4bdae7[_0x5727('0x30')]:_0x19636b[_0x5727('0x2f')];if(!_0x4b8ce3['query'][_0x5727('0x33')](_0x5727('0x34'))){_0x4bdae7[_0x5727('0x1a')]=qs[_0x5727('0x1a')](_0x4b8ce3[_0x5727('0x2c')]['limit']);_0x4bdae7[_0x5727('0x18')]=qs[_0x5727('0x18')](_0x4b8ce3[_0x5727('0x2c')]['offset']);}_0x4bdae7['order']=qs[_0x5727('0x35')](_0x4b8ce3['query']['sort']);_0x4bdae7['where']=qs['filters'](_[_0x5727('0x36')](_0x4b8ce3[_0x5727('0x2c')],_0x19636b[_0x5727('0x37')]),_0xe3a786);if(_0x4b8ce3['query'][_0x5727('0x38')]){_0x4bdae7[_0x5727('0x39')]=_[_0x5727('0x3a')](_0x4bdae7['where'],{'$or':_[_0x5727('0x27')](_0xe3a786,function(_0x1eeac5){if(_0x1eeac5[_0x5727('0x2b')]!=='VIRTUAL'){var _0xfa0b1e={};_0xfa0b1e[_0x1eeac5['name']]={'$like':'%'+_0x4b8ce3[_0x5727('0x2c')][_0x5727('0x38')]+'%'};return _0xfa0b1e;}})});}_0x4bdae7=_['merge']({},_0x4bdae7,_0x4b8ce3[_0x5727('0x3b')]);var _0xa8269b={'where':_0x4bdae7[_0x5727('0x39')]};return db[_0x5727('0x28')][_0x5727('0x1b')](_0xa8269b)[_0x5727('0x21')](function(_0x1e580f){_0x5a6827['count']=_0x1e580f;if(_0x4b8ce3[_0x5727('0x2c')][_0x5727('0x3c')]){_0x4bdae7[_0x5727('0x3d')]=[{'all':!![]}];}return db['Campaign'][_0x5727('0x3e')](_0x4bdae7);})[_0x5727('0x21')](function(_0x47074e){_0x5a6827[_0x5727('0x3f')]=_0x47074e;return _0x5a6827;})[_0x5727('0x21')](respondWithFilteredResult(_0x1d81ab,_0x4bdae7))[_0x5727('0x40')](handleError(_0x1d81ab,null));};exports[_0x5727('0x41')]=function(_0x4da232,_0x91b888){var _0x245189={'raw':![],'where':{'id':_0x4da232[_0x5727('0x42')]['id']}},_0x7620cd={};_0x7620cd[_0x5727('0x2f')]=_[_0x5727('0x2d')](db[_0x5727('0x28')][_0x5727('0x29')]);_0x7620cd[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x4da232[_0x5727('0x2c')]);_0x7620cd[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x7620cd[_0x5727('0x2f')],_0x7620cd[_0x5727('0x2c')]);_0x245189[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x7620cd[_0x5727('0x2f')],qs['fields'](_0x4da232['query'][_0x5727('0x31')]));_0x245189[_0x5727('0x30')]=_0x245189['attributes'][_0x5727('0x32')]?_0x245189['attributes']:_0x7620cd[_0x5727('0x2f')];if(_0x4da232[_0x5727('0x2c')][_0x5727('0x3c')]){_0x245189[_0x5727('0x3d')]=[{'all':!![]}];}_0x245189=_['merge']({},_0x245189,_0x4da232['options']);return db[_0x5727('0x28')][_0x5727('0x43')](_0x245189)[_0x5727('0x21')](handleEntityNotFound(_0x91b888,null))[_0x5727('0x21')](respondWithResult(_0x91b888,null))[_0x5727('0x40')](handleError(_0x91b888,null));};exports['create']=function(_0x40887d,_0xb168c){return db[_0x5727('0x28')]['create'](_0x40887d[_0x5727('0x44')],{})[_0x5727('0x21')](function(_0x318c43){var _0x43cb66=_0x40887d[_0x5727('0x45')][_0x5727('0x46')]({'plain':!![]});if(!_0x43cb66)throw new Error(_0x5727('0x47'));if(_0x43cb66[_0x5727('0x48')]==='user'){var _0x9a3222=_0x318c43[_0x5727('0x46')]({'plain':!![]});var _0x4a7417=_0x5727('0x49');return db['UserProfileSection'][_0x5727('0x43')]({'where':{'name':_0x4a7417,'userProfileId':_0x43cb66[_0x5727('0x4a')]},'raw':!![]})[_0x5727('0x21')](function(_0x50e166){if(_0x50e166&&_0x50e166[_0x5727('0x4b')]===0x0){return db[_0x5727('0x22')]['create']({'name':_0x9a3222[_0x5727('0x25')],'resourceId':_0x9a3222['id'],'type':_0x50e166[_0x5727('0x25')],'sectionId':_0x50e166['id']},{})[_0x5727('0x21')](function(){return _0x318c43;});}else{return _0x318c43;}})[_0x5727('0x40')](function(_0xa68aa1){logger[_0x5727('0x4c')](_0x5727('0x4d'),_0xa68aa1);throw _0xa68aa1;});}return _0x318c43;})[_0x5727('0x21')](respondWithResult(_0xb168c,0xc9))[_0x5727('0x40')](handleError(_0xb168c,null));};exports[_0x5727('0x4e')]=function(_0x3151cd,_0x169d11){var _0x29cee7={'where':{'id':_0x3151cd[_0x5727('0x42')]['id']}},_0x273085={};_0x273085['model']=_['keys'](db[_0x5727('0x28')][_0x5727('0x29')]);_0x29cee7['attributes']=_['intersection'](_0x273085['model'],qs[_0x5727('0x31')](_0x3151cd[_0x5727('0x2c')][_0x5727('0x31')]));_0x29cee7[_0x5727('0x30')]=_0x29cee7[_0x5727('0x30')][_0x5727('0x32')]?_0x29cee7[_0x5727('0x30')]:_0x273085[_0x5727('0x2f')];if(_0x3151cd[_0x5727('0x2c')][_0x5727('0x3c')]){_0x29cee7[_0x5727('0x3d')]=[{'all':!![]}];}_0x29cee7=_[_0x5727('0x3a')]({},_0x29cee7,_0x3151cd['options']);return db[_0x5727('0x28')]['find'](_0x29cee7)[_0x5727('0x21')](handleEntityNotFound(_0x169d11,null))[_0x5727('0x21')](function(_0x21c1b1){if(_0x21c1b1){var _0x180f05=_0x21c1b1[_0x5727('0x46')]({'plain':!![]});_0x180f05=qs['omit'](_0x180f05,['id',_0x5727('0x4f'),_0x5727('0x50')]);_0x3151cd[_0x5727('0x44')]=_[_0x5727('0x51')](_0x3151cd['body'],['id',_0x5727('0x4f'),_0x5727('0x50')]);return db[_0x5727('0x28')][_0x5727('0x52')](_[_0x5727('0x3a')](_0x180f05,_0x3151cd[_0x5727('0x44')]),{'include':_0x3151cd['query'][_0x5727('0x3c')]?[{'all':!![]}]:undefined})[_0x5727('0x21')](function(_0x1ba6eb){var _0xfccdb7=_0x3151cd[_0x5727('0x45')]['get']({'plain':!![]});if(!_0xfccdb7)throw new Error(_0x5727('0x47'));if(_0xfccdb7[_0x5727('0x48')]===_0x5727('0x45')){var _0x324e95=_0x1ba6eb[_0x5727('0x46')]({'plain':!![]});var _0x5c90f0=_0x5727('0x49');return db[_0x5727('0x53')][_0x5727('0x43')]({'where':{'name':_0x5c90f0,'userProfileId':_0xfccdb7[_0x5727('0x4a')]},'raw':!![]})[_0x5727('0x21')](function(_0x433b09){if(_0x433b09&&_0x433b09['autoAssociation']===0x0){return db[_0x5727('0x22')][_0x5727('0x52')]({'name':_0x324e95[_0x5727('0x25')],'resourceId':_0x324e95['id'],'type':_0x433b09[_0x5727('0x25')],'sectionId':_0x433b09['id']},{})[_0x5727('0x21')](function(){return _0x1ba6eb;});}else{return _0x1ba6eb;}})[_0x5727('0x40')](function(_0x709762){logger['error'](_0x5727('0x4d'),_0x709762);throw _0x709762;});}return _0x1ba6eb;});}})[_0x5727('0x21')](respondWithResult(_0x169d11,0xc9))[_0x5727('0x40')](handleError(_0x169d11,null));};exports[_0x5727('0x20')]=function(_0x59bf27,_0x38c627){if(_0x59bf27[_0x5727('0x44')]['id']){delete _0x59bf27[_0x5727('0x44')]['id'];}return db[_0x5727('0x28')][_0x5727('0x43')]({'where':{'id':_0x59bf27['params']['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x38c627,null))[_0x5727('0x21')](saveUpdates(_0x59bf27['body'],null))[_0x5727('0x21')](respondWithResult(_0x38c627,null))[_0x5727('0x40')](handleError(_0x38c627,null));};exports[_0x5727('0x23')]=function(_0x1e2f3b,_0xc37b31){return db['Campaign'][_0x5727('0x43')]({'where':{'id':_0x1e2f3b[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0xc37b31,null))[_0x5727('0x21')](removeEntity(_0xc37b31,null))[_0x5727('0x40')](handleError(_0xc37b31,null));};exports[_0x5727('0x54')]=function(_0x4d78ba,_0x1c62be,_0x297d4e){var _0x370a65={'raw':!![],'where':{}};var _0x1b417b={};var _0x318b0d={'count':0x0,'rows':[]};return db[_0x5727('0x28')][_0x5727('0x55')]({'where':{'id':_0x4d78ba[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0x1c62be,null))[_0x5727('0x21')](function(_0x261cc6){if(_0x261cc6){_0x1b417b[_0x5727('0x2f')]=_['keys'](db[_0x5727('0x56')]['rawAttributes']);_0x1b417b[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x4d78ba[_0x5727('0x2c')]);_0x1b417b[_0x5727('0x37')]=_['intersection'](_0x1b417b[_0x5727('0x2f')],_0x1b417b[_0x5727('0x2c')]);_0x370a65[_0x5727('0x30')]=_['intersection'](_0x1b417b[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x4d78ba['query'][_0x5727('0x31')]));_0x370a65['attributes']=_0x370a65[_0x5727('0x30')][_0x5727('0x32')]?_0x370a65[_0x5727('0x30')]:_0x1b417b[_0x5727('0x2f')];if(!_0x4d78ba[_0x5727('0x2c')]['hasOwnProperty'](_0x5727('0x34'))){_0x370a65[_0x5727('0x1a')]=qs['limit'](_0x4d78ba[_0x5727('0x2c')][_0x5727('0x1a')]);_0x370a65['offset']=qs[_0x5727('0x18')](_0x4d78ba[_0x5727('0x2c')]['offset']);}_0x370a65[_0x5727('0x57')]=qs[_0x5727('0x35')](_0x4d78ba['query'][_0x5727('0x35')]);_0x370a65[_0x5727('0x39')]=qs[_0x5727('0x37')](_[_0x5727('0x36')](_0x4d78ba[_0x5727('0x2c')],_0x1b417b[_0x5727('0x37')]));_0x370a65[_0x5727('0x39')][_0x5727('0x58')]=_0x261cc6['id'];if(_0x4d78ba['query'][_0x5727('0x38')]){_0x370a65['where']=_[_0x5727('0x3a')](_0x370a65[_0x5727('0x39')],{'$or':_[_0x5727('0x27')](_0x370a65[_0x5727('0x30')],function(_0x424b5a){var _0x7f4b90={};_0x7f4b90[_0x424b5a]={'$like':'%'+_0x4d78ba[_0x5727('0x2c')][_0x5727('0x38')]+'%'};return _0x7f4b90;})});}_0x370a65=_[_0x5727('0x3a')]({},_0x370a65,_0x4d78ba['options']);return db[_0x5727('0x56')][_0x5727('0x1b')]({'where':_0x370a65[_0x5727('0x39')]})[_0x5727('0x21')](function(_0x394c48){_0x318b0d[_0x5727('0x1b')]=_0x394c48;if(_0x4d78ba[_0x5727('0x2c')][_0x5727('0x3c')]){_0x370a65['include']=[{'all':!![]}];}return db[_0x5727('0x56')][_0x5727('0x3e')](_0x370a65);})[_0x5727('0x21')](function(_0x4328d3){_0x318b0d[_0x5727('0x3f')]=_0x4328d3;return _0x318b0d;});}})[_0x5727('0x21')](respondWithFilteredResult(_0x1c62be,_0x370a65))[_0x5727('0x40')](handleError(_0x1c62be,null));};exports['getHopperHistories']=function(_0x1b10b7,_0x35de7b,_0x132879){var _0x3db853={'raw':!![],'where':{}};var _0x4abf7e={};var _0x28ee57={'count':0x0,'rows':[]};return db['Campaign'][_0x5727('0x55')]({'where':{'id':_0x1b10b7[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0x35de7b,null))['then'](function(_0x3ac017){if(_0x3ac017){_0x4abf7e[_0x5727('0x2f')]=_[_0x5727('0x2d')](db['CmHopperHistory']['rawAttributes']);_0x4abf7e[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x1b10b7['query']);_0x4abf7e[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x4abf7e[_0x5727('0x2f')],_0x4abf7e[_0x5727('0x2c')]);_0x3db853[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x4abf7e[_0x5727('0x2f')],qs['fields'](_0x1b10b7[_0x5727('0x2c')]['fields']));_0x3db853[_0x5727('0x30')]=_0x3db853['attributes'][_0x5727('0x32')]?_0x3db853['attributes']:_0x4abf7e[_0x5727('0x2f')];if(!_0x1b10b7[_0x5727('0x2c')][_0x5727('0x33')](_0x5727('0x34'))){_0x3db853['limit']=qs[_0x5727('0x1a')](_0x1b10b7[_0x5727('0x2c')][_0x5727('0x1a')]);_0x3db853[_0x5727('0x18')]=qs[_0x5727('0x18')](_0x1b10b7[_0x5727('0x2c')][_0x5727('0x18')]);}_0x3db853[_0x5727('0x57')]=qs['sort'](_0x1b10b7[_0x5727('0x2c')][_0x5727('0x35')]);_0x3db853[_0x5727('0x39')]=qs[_0x5727('0x37')](_[_0x5727('0x36')](_0x1b10b7[_0x5727('0x2c')],_0x4abf7e['filters']));_0x3db853[_0x5727('0x39')][_0x5727('0x58')]=_0x3ac017['id'];if(_0x1b10b7[_0x5727('0x2c')]['filter']){_0x3db853[_0x5727('0x39')]=_[_0x5727('0x3a')](_0x3db853[_0x5727('0x39')],{'$or':_['map'](_0x3db853[_0x5727('0x30')],function(_0x54d139){var _0x6ec164={};_0x6ec164[_0x54d139]={'$like':'%'+_0x1b10b7[_0x5727('0x2c')]['filter']+'%'};return _0x6ec164;})});}_0x3db853=_[_0x5727('0x3a')]({},_0x3db853,_0x1b10b7['options']);return db[_0x5727('0x59')][_0x5727('0x1b')]({'where':_0x3db853[_0x5727('0x39')]})[_0x5727('0x21')](function(_0x316559){_0x28ee57[_0x5727('0x1b')]=_0x316559;if(_0x1b10b7[_0x5727('0x2c')]['includeAll']){_0x3db853[_0x5727('0x3d')]=[{'all':!![]}];}return db[_0x5727('0x59')]['findAll'](_0x3db853);})[_0x5727('0x21')](function(_0xd40492){_0x28ee57[_0x5727('0x3f')]=_0xd40492;return _0x28ee57;});}})['then'](respondWithFilteredResult(_0x35de7b,_0x3db853))['catch'](handleError(_0x35de7b,null));};exports[_0x5727('0x5a')]=function(_0x395999,_0x5c44e1,_0x2c99dd){var _0x582926={'raw':!![],'where':{}};var _0x4312f0={};var _0x424cc0={'count':0x0,'rows':[]};return db[_0x5727('0x28')][_0x5727('0x55')]({'where':{'id':_0x395999[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0x5c44e1,null))[_0x5727('0x21')](function(_0x35af92){if(_0x35af92){_0x4312f0['model']=_[_0x5727('0x2d')](db[_0x5727('0x5b')][_0x5727('0x29')]);_0x4312f0[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x395999[_0x5727('0x2c')]);_0x4312f0[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x4312f0[_0x5727('0x2f')],_0x4312f0[_0x5727('0x2c')]);_0x582926[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x4312f0[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x395999[_0x5727('0x2c')][_0x5727('0x31')]));_0x582926[_0x5727('0x30')]=_0x582926[_0x5727('0x30')][_0x5727('0x32')]?_0x582926[_0x5727('0x30')]:_0x4312f0[_0x5727('0x2f')];if(!_0x395999[_0x5727('0x2c')]['hasOwnProperty']('nolimit')){_0x582926[_0x5727('0x1a')]=qs[_0x5727('0x1a')](_0x395999[_0x5727('0x2c')][_0x5727('0x1a')]);_0x582926['offset']=qs[_0x5727('0x18')](_0x395999[_0x5727('0x2c')]['offset']);}_0x582926[_0x5727('0x57')]=qs[_0x5727('0x35')](_0x395999['query'][_0x5727('0x35')]);_0x582926[_0x5727('0x39')]=qs[_0x5727('0x37')](_['pick'](_0x395999[_0x5727('0x2c')],_0x4312f0['filters']));_0x582926[_0x5727('0x39')][_0x5727('0x58')]=_0x35af92['id'];if(_0x395999[_0x5727('0x2c')][_0x5727('0x38')]){_0x582926['where']=_[_0x5727('0x3a')](_0x582926[_0x5727('0x39')],{'$or':_[_0x5727('0x27')](_0x582926[_0x5727('0x30')],function(_0x462ca3){var _0x5149a5={};_0x5149a5[_0x462ca3]={'$like':'%'+_0x395999[_0x5727('0x2c')][_0x5727('0x38')]+'%'};return _0x5149a5;})});}_0x582926=_[_0x5727('0x3a')]({},_0x582926,_0x395999[_0x5727('0x3b')]);return db[_0x5727('0x5b')][_0x5727('0x1b')]({'where':_0x582926[_0x5727('0x39')]})[_0x5727('0x21')](function(_0x249a2b){_0x424cc0['count']=_0x249a2b;if(_0x395999[_0x5727('0x2c')][_0x5727('0x3c')]){_0x582926[_0x5727('0x3d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x5727('0x3e')](_0x582926);})[_0x5727('0x21')](function(_0x4abf54){_0x424cc0[_0x5727('0x3f')]=_0x4abf54;return _0x424cc0;});}})[_0x5727('0x21')](respondWithFilteredResult(_0x5c44e1,_0x582926))[_0x5727('0x40')](handleError(_0x5c44e1,null));};exports[_0x5727('0x5c')]=function(_0x593802,_0x243b26,_0x33b426){var _0x508938={'raw':!![],'where':{}};var _0x4dc5d5={};var _0xe21b25={'count':0x0,'rows':[]};return db[_0x5727('0x28')][_0x5727('0x55')]({'where':{'id':_0x593802[_0x5727('0x42')]['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x243b26,null))['then'](function(_0x53eb58){if(_0x53eb58){_0x4dc5d5['model']=_[_0x5727('0x2d')](db[_0x5727('0x5d')][_0x5727('0x29')]);_0x4dc5d5[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x593802[_0x5727('0x2c')]);_0x4dc5d5['filters']=_[_0x5727('0x2e')](_0x4dc5d5[_0x5727('0x2f')],_0x4dc5d5[_0x5727('0x2c')]);_0x508938['attributes']=_[_0x5727('0x2e')](_0x4dc5d5[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x593802[_0x5727('0x2c')][_0x5727('0x31')]));_0x508938[_0x5727('0x30')]=_0x508938[_0x5727('0x30')][_0x5727('0x32')]?_0x508938[_0x5727('0x30')]:_0x4dc5d5[_0x5727('0x2f')];if(!_0x593802[_0x5727('0x2c')][_0x5727('0x33')](_0x5727('0x34'))){_0x508938[_0x5727('0x1a')]=qs[_0x5727('0x1a')](_0x593802[_0x5727('0x2c')][_0x5727('0x1a')]);_0x508938[_0x5727('0x18')]=qs['offset'](_0x593802['query']['offset']);}_0x508938['order']=qs[_0x5727('0x35')](_0x593802[_0x5727('0x2c')]['sort']);_0x508938['where']=qs[_0x5727('0x37')](_[_0x5727('0x36')](_0x593802[_0x5727('0x2c')],_0x4dc5d5['filters']));_0x508938[_0x5727('0x39')][_0x5727('0x58')]=_0x53eb58['id'];if(_0x593802[_0x5727('0x2c')]['filter']){_0x508938[_0x5727('0x39')]=_[_0x5727('0x3a')](_0x508938['where'],{'$or':_[_0x5727('0x27')](_0x508938[_0x5727('0x30')],function(_0x1e799b){var _0xa62b6c={};_0xa62b6c[_0x1e799b]={'$like':'%'+_0x593802[_0x5727('0x2c')][_0x5727('0x38')]+'%'};return _0xa62b6c;})});}_0x508938=_[_0x5727('0x3a')]({},_0x508938,_0x593802['options']);return db[_0x5727('0x5d')][_0x5727('0x1b')]({'where':_0x508938[_0x5727('0x39')]})[_0x5727('0x21')](function(_0x5692b8){_0xe21b25[_0x5727('0x1b')]=_0x5692b8;if(_0x593802[_0x5727('0x2c')][_0x5727('0x3c')]){_0x508938[_0x5727('0x3d')]=[{'all':!![]}];}return db[_0x5727('0x5d')][_0x5727('0x3e')](_0x508938);})[_0x5727('0x21')](function(_0x4a9a09){_0xe21b25[_0x5727('0x3f')]=_0x4a9a09;return _0xe21b25;});}})['then'](respondWithFilteredResult(_0x243b26,_0x508938))[_0x5727('0x40')](handleError(_0x243b26,null));};exports['getLists']=function(_0x2b6dd1,_0x49ecc4,_0x373479){var _0x367996={};var _0x2a6197={};var _0x38f57a;var _0x15f762;return db[_0x5727('0x28')][_0x5727('0x55')]({'where':{'id':_0x2b6dd1[_0x5727('0x42')]['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x49ecc4,null))[_0x5727('0x21')](function(_0x19cf5a){if(_0x19cf5a){_0x38f57a=_0x19cf5a;_0x2a6197[_0x5727('0x2f')]=_['keys'](db[_0x5727('0x5e')][_0x5727('0x29')]);_0x2a6197[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x2b6dd1[_0x5727('0x2c')]);_0x2a6197[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x2a6197[_0x5727('0x2f')],_0x2a6197['query']);_0x367996[_0x5727('0x30')]=_[_0x5727('0x2e')](_0x2a6197[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x2b6dd1[_0x5727('0x2c')][_0x5727('0x31')]));_0x367996[_0x5727('0x30')]=_0x367996['attributes']['length']?_0x367996[_0x5727('0x30')]:_0x2a6197[_0x5727('0x2f')];_0x367996[_0x5727('0x57')]=qs[_0x5727('0x35')](_0x2b6dd1[_0x5727('0x2c')]['sort']);_0x367996[_0x5727('0x39')]=qs['filters'](_['pick'](_0x2b6dd1['query'],_0x2a6197[_0x5727('0x37')]));if(_0x2b6dd1[_0x5727('0x2c')][_0x5727('0x38')]){_0x367996[_0x5727('0x39')]=_[_0x5727('0x3a')](_0x367996[_0x5727('0x39')],{'$or':_[_0x5727('0x27')](_0x367996[_0x5727('0x30')],function(_0x23c9d3){var _0x3e0b25={};_0x3e0b25[_0x23c9d3]={'$like':'%'+_0x2b6dd1['query'][_0x5727('0x38')]+'%'};return _0x3e0b25;})});}_0x367996=_[_0x5727('0x3a')]({},_0x367996,_0x2b6dd1['options']);return _0x38f57a['getLists'](_0x367996);}})['then'](function(_0x49051a){if(_0x49051a){_0x15f762=_0x49051a[_0x5727('0x32')];if(!_0x2b6dd1[_0x5727('0x2c')][_0x5727('0x33')](_0x5727('0x34'))){_0x367996[_0x5727('0x1a')]=qs['limit'](_0x2b6dd1[_0x5727('0x2c')]['limit']);_0x367996[_0x5727('0x18')]=qs[_0x5727('0x18')](_0x2b6dd1[_0x5727('0x2c')][_0x5727('0x18')]);}return _0x38f57a['getLists'](_0x367996);}})[_0x5727('0x21')](function(_0x59f549){if(_0x59f549){return _0x59f549?{'count':_0x15f762,'rows':_0x59f549}:null;}})['then'](respondWithResult(_0x49ecc4,null))[_0x5727('0x40')](handleError(_0x49ecc4,null));};exports[_0x5727('0x5f')]=function(_0x5a1596,_0xcdf346,_0x891692){var _0x35c8e1,_0x152ce5;var _0x21ea42=[];var _0x11e075=moment()[_0x5727('0x60')](_0x5727('0x61'));return db[_0x5727('0x28')][_0x5727('0x43')]({'where':{'id':_0x5a1596[_0x5727('0x42')]['id']}})['then'](handleEntityNotFound(_0xcdf346,null))['then'](function(_0xba92f6){if(_0xba92f6){_0x152ce5=_0xba92f6;return _0xba92f6[_0x5727('0x5f')](_0x5a1596[_0x5727('0x44')][_0x5727('0x62')],_[_0x5727('0x51')](_0x5a1596[_0x5727('0x44')],[_0x5727('0x62'),'id'])||{});}return null;})[_0x5727('0x63')](function(_0x5735d5){var _0x5ebf9c;var _0x1c0890;_0x35c8e1=_0x5735d5||[];var _0x594bc4=[];if(_0x5735d5){for(var _0x5c2a2b=0x0;_0x5c2a2b<_0x5735d5['length'];_0x5c2a2b+=0x1){var _0x368a1a=_0x5735d5[_0x5c2a2b]['get']({'plain':!![]});_0x152ce5[_0x5727('0x64')]=_0x5a1596[_0x5727('0x44')]['dialCheckDuplicateType']?_0x5a1596[_0x5727('0x44')][_0x5727('0x64')]:_0x152ce5[_0x5727('0x64')];switch(_0x152ce5[_0x5727('0x64')]){case _0x5727('0x65'):_0x5ebf9c=squel[_0x5727('0x66')]()[_0x5727('0x67')](_0x5727('0x68'))[_0x5727('0x69')](['phone',_0x5727('0x6a'),_0x5727('0x6b'),_0x5727('0x6c'),'CampaignId','createdAt','updatedAt'],squel['select']()['field'](_0x5727('0x6d'),_0x5727('0x6d'))['field'](_0x5727('0x6e'),_0x5727('0x6a'))['field']('id',_0x5727('0x6b'))[_0x5727('0x6f')](_0x368a1a['CmListId'][_0x5727('0x70')](),_0x5727('0x6c'))[_0x5727('0x6f')](_0x5a1596['params']['id'][_0x5727('0x70')](),_0x5727('0x58'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27',_0x5727('0x4f'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27',_0x5727('0x50'))['from'](_0x5727('0x71'))[_0x5727('0x39')](_0x5727('0x72'))[_0x5727('0x39')](_0x5727('0x73'),_0x368a1a[_0x5727('0x74')][_0x5727('0x70')]())[_0x5727('0x39')](_0x5727('0x75'))[_0x5727('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0x5727('0x76')]()[_0x5727('0x6f')](_0x5727('0x77'))[_0x5727('0x78')]('cm_hopper_final')[_0x5727('0x39')](_0x5727('0x79'),_0x5a1596[_0x5727('0x42')]['id']['toString']()))[_0x5727('0x39')](_0x5727('0x7a'),squel[_0x5727('0x76')]()['field'](_0x5727('0x7b'))['from'](_0x5727('0x68'))[_0x5727('0x39')](_0x5727('0x79'),_0x5a1596[_0x5727('0x42')]['id']['toString']())))[_0x5727('0x70')]();break;case _0x5727('0x7c'):_0x5ebf9c=squel[_0x5727('0x66')]()['into'](_0x5727('0x68'))[_0x5727('0x69')](['phone','scheduledAt',_0x5727('0x6b'),_0x5727('0x6c'),_0x5727('0x58'),'createdAt',_0x5727('0x50')],squel[_0x5727('0x76')]()[_0x5727('0x6f')]('phone',_0x5727('0x6d'))[_0x5727('0x6f')](_0x5727('0x6e'),_0x5727('0x6a'))[_0x5727('0x6f')]('id','ContactId')[_0x5727('0x6f')](_0x368a1a[_0x5727('0x74')][_0x5727('0x70')](),'ListId')[_0x5727('0x6f')](_0x5a1596['params']['id'][_0x5727('0x70')](),_0x5727('0x58'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27',_0x5727('0x4f'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27',_0x5727('0x50'))[_0x5727('0x78')](_0x5727('0x71'))[_0x5727('0x39')](_0x5727('0x72'))[_0x5727('0x39')](_0x5727('0x73'),_0x368a1a['CmListId'][_0x5727('0x70')]())['where'](_0x5727('0x75'))[_0x5727('0x39')](_0x5727('0x7a'),squel[_0x5727('0x76')]()[_0x5727('0x6f')](_0x5727('0x7b'))['from'](_0x5727('0x68'))[_0x5727('0x39')]('CampaignId\x20=\x20?',_0x5a1596[_0x5727('0x42')]['id'][_0x5727('0x70')]())))[_0x5727('0x70')]();break;default:_0x5ebf9c=squel[_0x5727('0x66')]()[_0x5727('0x67')](_0x5727('0x68'))[_0x5727('0x69')]([_0x5727('0x6d'),_0x5727('0x6a'),_0x5727('0x6b'),_0x5727('0x6c'),'CampaignId',_0x5727('0x4f'),_0x5727('0x50')],squel[_0x5727('0x76')]()[_0x5727('0x6f')]('phone',_0x5727('0x6d'))[_0x5727('0x6f')](_0x5727('0x6e'),_0x5727('0x6a'))[_0x5727('0x6f')]('id',_0x5727('0x6b'))[_0x5727('0x6f')](_0x368a1a['CmListId']['toString'](),_0x5727('0x6c'))[_0x5727('0x6f')](_0x5a1596[_0x5727('0x42')]['id'][_0x5727('0x70')](),_0x5727('0x58'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27',_0x5727('0x4f'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27',_0x5727('0x50'))[_0x5727('0x78')]('cm_contacts')[_0x5727('0x39')](_0x5727('0x72'))[_0x5727('0x39')](_0x5727('0x73'),_0x368a1a[_0x5727('0x74')][_0x5727('0x70')]())[_0x5727('0x39')](_0x5727('0x75')))[_0x5727('0x70')]();}_0x1c0890=squel[_0x5727('0x66')]()[_0x5727('0x67')](_0x5727('0x7d'))[_0x5727('0x69')]([_0x5727('0x7e'),'scheduledAt','phone','OrderBy',_0x5727('0x4f'),_0x5727('0x50')],squel[_0x5727('0x76')]()[_0x5727('0x6f')](_0x5727('0x7f'),'id')[_0x5727('0x6f')]('NOW()',_0x5727('0x6a'))[_0x5727('0x6f')]('ci.item',_0x5727('0x6d'))[_0x5727('0x6f')](_0x5727('0x80'),_0x5727('0x81'))[_0x5727('0x6f')]('\x27'+_0x11e075+'\x27','createdAt')['field']('\x27'+_0x11e075+'\x27',_0x5727('0x50'))[_0x5727('0x78')](_0x5727('0x82'),'ci')[_0x5727('0x83')](_0x5727('0x68'),'h',_0x5727('0x84'))[_0x5727('0x39')]('h.ListId\x20=\x20?',_0x368a1a[_0x5727('0x74')][_0x5727('0x70')]())[_0x5727('0x39')](_0x5727('0x85'),_0x5a1596[_0x5727('0x42')]['id'][_0x5727('0x70')]())[_0x5727('0x39')](_0x5727('0x86'),_0x11e075))[_0x5727('0x70')]();_0x594bc4[_0x5727('0x87')](db[_0x5727('0x88')][_0x5727('0x2c')](_0x5ebf9c));_0x21ea42[_0x5727('0x87')](db[_0x5727('0x88')][_0x5727('0x2c')](_0x1c0890));}return BPromise['all'](_0x594bc4);}})[_0x5727('0x21')](function(){return BPromise['all'](_0x21ea42);})[_0x5727('0x21')](function(){return _0x35c8e1;})['then'](respondWithResult(_0xcdf346,null))[_0x5727('0x40')](handleError(_0xcdf346,null));};exports['removeLists']=function(_0x406b67,_0x350346,_0x16a1d9){return db[_0x5727('0x28')][_0x5727('0x43')]({'where':{'id':_0x406b67[_0x5727('0x42')]['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x350346,null))[_0x5727('0x21')](function(_0x14dbec){if(_0x14dbec){return _0x14dbec[_0x5727('0x89')](_0x406b67[_0x5727('0x2c')][_0x5727('0x62')]);}})['then'](function(_0x3aee90){if(_0x3aee90){return db[_0x5727('0x56')][_0x5727('0x23')]({'where':{'ListId':_0x406b67[_0x5727('0x2c')][_0x5727('0x62')],'CampaignId':_0x406b67[_0x5727('0x42')]['id']}})[_0x5727('0x21')](function(){return _0x3aee90;});}})[_0x5727('0x21')](respondWithStatusCode(_0x350346,null))[_0x5727('0x40')](handleError(_0x350346,null));};exports[_0x5727('0x8a')]=function(_0x1dd299,_0x364735,_0x3fbc52){var _0xab3bb0={};var _0x5cdca0={};var _0x40d52b;var _0x4de535;return db[_0x5727('0x28')][_0x5727('0x55')]({'where':{'id':_0x1dd299[_0x5727('0x42')]['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x364735,null))[_0x5727('0x21')](function(_0x37c99b){if(_0x37c99b){_0x40d52b=_0x37c99b;_0x5cdca0[_0x5727('0x2f')]=_[_0x5727('0x2d')](db['CmList'][_0x5727('0x29')]);_0x5cdca0[_0x5727('0x2c')]=_[_0x5727('0x2d')](_0x1dd299[_0x5727('0x2c')]);_0x5cdca0[_0x5727('0x37')]=_[_0x5727('0x2e')](_0x5cdca0['model'],_0x5cdca0['query']);_0xab3bb0[_0x5727('0x30')]=_['intersection'](_0x5cdca0[_0x5727('0x2f')],qs[_0x5727('0x31')](_0x1dd299[_0x5727('0x2c')][_0x5727('0x31')]));_0xab3bb0[_0x5727('0x30')]=_0xab3bb0[_0x5727('0x30')][_0x5727('0x32')]?_0xab3bb0[_0x5727('0x30')]:_0x5cdca0['model'];_0xab3bb0[_0x5727('0x57')]=qs[_0x5727('0x35')](_0x1dd299[_0x5727('0x2c')][_0x5727('0x35')]);_0xab3bb0[_0x5727('0x39')]=qs[_0x5727('0x37')](_[_0x5727('0x36')](_0x1dd299['query'],_0x5cdca0[_0x5727('0x37')]));if(_0x1dd299[_0x5727('0x2c')][_0x5727('0x38')]){_0xab3bb0[_0x5727('0x39')]=_['merge'](_0xab3bb0[_0x5727('0x39')],{'$or':_[_0x5727('0x27')](_0xab3bb0[_0x5727('0x30')],function(_0x1a7b7f){var _0x18efd3={};_0x18efd3[_0x1a7b7f]={'$like':'%'+_0x1dd299['query'][_0x5727('0x38')]+'%'};return _0x18efd3;})});}_0xab3bb0=_[_0x5727('0x3a')]({},_0xab3bb0,_0x1dd299[_0x5727('0x3b')]);return _0x40d52b[_0x5727('0x8a')](_0xab3bb0);}})[_0x5727('0x21')](function(_0x449dda){if(_0x449dda){_0x4de535=_0x449dda[_0x5727('0x32')];if(!_0x1dd299[_0x5727('0x2c')][_0x5727('0x33')]('nolimit')){_0xab3bb0[_0x5727('0x1a')]=qs[_0x5727('0x1a')](_0x1dd299['query'][_0x5727('0x1a')]);_0xab3bb0[_0x5727('0x18')]=qs['offset'](_0x1dd299[_0x5727('0x2c')][_0x5727('0x18')]);}return _0x40d52b[_0x5727('0x8a')](_0xab3bb0);}})[_0x5727('0x21')](function(_0x2565a0){if(_0x2565a0){return _0x2565a0?{'count':_0x4de535,'rows':_0x2565a0}:null;}})[_0x5727('0x21')](respondWithResult(_0x364735,null))[_0x5727('0x40')](handleError(_0x364735,null));};exports['addBlackLists']=function(_0x32cf23,_0x2476c7,_0xed8ef){var _0x16b7da,_0x1847fc;var _0x7129b3=[];var _0xaf181=moment()[_0x5727('0x60')](_0x5727('0x61'));return db[_0x5727('0x28')][_0x5727('0x43')]({'where':{'id':_0x32cf23[_0x5727('0x42')]['id']}})[_0x5727('0x21')](handleEntityNotFound(_0x2476c7,null))[_0x5727('0x21')](function(_0xabc143){if(_0xabc143){_0x1847fc=_0xabc143;return _0xabc143[_0x5727('0x8b')](_0x32cf23[_0x5727('0x44')][_0x5727('0x62')],_[_0x5727('0x51')](_0x32cf23[_0x5727('0x44')],[_0x5727('0x62'),'id'])||{});}return null;})[_0x5727('0x63')](function(_0xad2899){var _0x1a69ca;var _0x4e064c;_0x16b7da=_0xad2899||[];var _0x239566=[];if(_0xad2899){for(var _0x42a128=0x0;_0x42a128<_0xad2899[_0x5727('0x32')];_0x42a128+=0x1){var _0x41f86a=_0xad2899[_0x42a128][_0x5727('0x46')]({'plain':!![]});_0x1a69ca=squel[_0x5727('0x66')]()[_0x5727('0x67')](_0x5727('0x8c'))[_0x5727('0x69')](['phone',_0x5727('0x6b'),_0x5727('0x6c'),_0x5727('0x58'),_0x5727('0x4f'),_0x5727('0x50')],squel[_0x5727('0x76')]()[_0x5727('0x6f')](_0x5727('0x6d'),_0x5727('0x6d'))['field']('id',_0x5727('0x6b'))[_0x5727('0x6f')](_0x41f86a[_0x5727('0x74')]['toString'](),_0x5727('0x6c'))['field'](_0x32cf23['params']['id']['toString'](),'CampaignId')[_0x5727('0x6f')](_0x5727('0x6e'),_0x5727('0x4f'))[_0x5727('0x6f')](_0x5727('0x6e'),_0x5727('0x50'))['from'](_0x5727('0x71'))[_0x5727('0x39')](_0x5727('0x72'))['where']('ListId\x20=\x20?',_0x41f86a['CmListId'][_0x5727('0x70')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x5727('0x70')]();_0x239566['push'](db[_0x5727('0x88')][_0x5727('0x2c')](_0x1a69ca));}return BPromise[_0x5727('0x8d')](_0x239566);}})[_0x5727('0x21')](function(){return _0x16b7da;})[_0x5727('0x21')](respondWithResult(_0x2476c7,null))[_0x5727('0x40')](handleError(_0x2476c7,null));};exports['removeBlackLists']=function(_0x1c1738,_0x3909a6,_0x4f3b29){return db['Campaign'][_0x5727('0x43')]({'where':{'id':_0x1c1738['params']['id']}})['then'](handleEntityNotFound(_0x3909a6,null))[_0x5727('0x21')](function(_0x5eb419){if(_0x5eb419){return _0x5eb419[_0x5727('0x8e')](_0x1c1738[_0x5727('0x2c')][_0x5727('0x62')]);}})[_0x5727('0x21')](function(_0x4a3c6b){if(_0x4a3c6b){return db[_0x5727('0x5d')][_0x5727('0x23')]({'where':{'ListId':_0x1c1738['query'][_0x5727('0x62')],'CampaignId':_0x1c1738['params']['id']}})[_0x5727('0x21')](function(){return _0x4a3c6b;});}})['then'](respondWithStatusCode(_0x3909a6,null))[_0x5727('0x40')](handleError(_0x3909a6,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index f022b86..7963470 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index b6b4ea1..03b8ee0 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 _0x2121=['request\x20sent','stringify','error','message','GetCampaign','Campaign','options','raw','where','limit','include','map','model','attributes','debug','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','Campaign,\x20%s,\x20%s'];(function(_0x135d6d,_0x3fe57e){var _0x14ff9a=function(_0x2a6021){while(--_0x2a6021){_0x135d6d['push'](_0x135d6d['shift']());}};_0x14ff9a(++_0x3fe57e);}(_0x2121,0x1b4));var _0x1212=function(_0x20e21b,_0x456996){_0x20e21b=_0x20e21b-0x0;var _0x3c4627=_0x2121[_0x20e21b];return _0x3c4627;};'use strict';var _=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1212('0x2'));var fs=require('fs');var Redis=require(_0x1212('0x3'));var db=require(_0x1212('0x4'))['db'];var utils=require(_0x1212('0x5'));var logger=require(_0x1212('0x6'))('rpc');var config=require(_0x1212('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1212('0x8')][_0x1212('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20fadc,_0x1b1ef5,_0x233a53){return new BPromise(function(_0x642ed5,_0x4a3d2a){return client[_0x1212('0xa')](_0x20fadc,_0x233a53)[_0x1212('0xb')](function(_0x434d23){logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x1b1ef5,_0x1212('0xe'),JSON[_0x1212('0xf')](_0x434d23));if(_0x434d23[_0x1212('0x10')]){if(_0x434d23[_0x1212('0x10')]['code']===0x1f4){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x4a3d2a(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);return _0x642ed5(_0x434d23[_0x1212('0x10')][_0x1212('0x11')]);}else{logger[_0x1212('0xc')](_0x1212('0xd'),_0x1b1ef5,_0x1212('0xe'));_0x642ed5(_0x434d23['result']['message']);}})['catch'](function(_0x3cfe21){logger[_0x1212('0x10')](_0x1212('0xd'),_0x1b1ef5,_0x3cfe21);_0x4a3d2a(_0x3cfe21);});});}exports[_0x1212('0x12')]=function(_0x3cf284){var _0x3face0=this;return new Promise(function(_0xb0dc88,_0x22eefb){return db[_0x1212('0x13')]['findAll']({'raw':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x15')]===undefined?!![]:![]:!![],'where':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x16')]||null:null,'attributes':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')]['attributes']||null:null,'limit':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x17')]||null:null,'include':_0x3cf284[_0x1212('0x14')]?_0x3cf284[_0x1212('0x14')][_0x1212('0x18')]?_[_0x1212('0x19')](_0x3cf284[_0x1212('0x14')]['include'],function(_0x58ab5b){return{'model':db[_0x58ab5b['model']],'as':_0x58ab5b['as'],'attributes':_0x58ab5b['attributes'],'include':_0x58ab5b['include']?_[_0x1212('0x19')](_0x58ab5b[_0x1212('0x18')],function(_0x4c32a7){return{'model':db[_0x4c32a7[_0x1212('0x1a')]],'as':_0x4c32a7['as'],'attributes':_0x4c32a7[_0x1212('0x1b')],'include':_0x4c32a7['include']?_[_0x1212('0x19')](_0x4c32a7[_0x1212('0x18')],function(_0x4630b4){return{'model':db[_0x4630b4[_0x1212('0x1a')]],'as':_0x4630b4['as'],'attributes':_0x4630b4[_0x1212('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1212('0xb')](function(_0x2750b0){logger[_0x1212('0xc')]('GetCampaign',_0x3cf284);logger[_0x1212('0x1c')](_0x1212('0x12'),_0x3cf284,JSON[_0x1212('0xf')](_0x2750b0));_0xb0dc88(_0x2750b0);})[_0x1212('0x1d')](function(_0x17d0f6){logger[_0x1212('0x10')](_0x1212('0x12'),_0x17d0f6[_0x1212('0x11')],_0x3cf284);_0x22eefb(_0x3face0[_0x1212('0x10')](0x1f4,_0x17d0f6[_0x1212('0x11')]));});});}; \ No newline at end of file +var _0xd6ce=['raw','attributes','limit','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','GetCampaign','Campaign','options'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd6ce,0x127));var _0xed6c=function(_0x1e01aa,_0x4868d6){_0x1e01aa=_0x1e01aa-0x0;var _0x3b40cf=_0xd6ce[_0x1e01aa];return _0x3b40cf;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var moment=require(_0xed6c('0x2'));var BPromise=require(_0xed6c('0x3'));var rs=require(_0xed6c('0x4'));var fs=require('fs');var Redis=require(_0xed6c('0x5'));var db=require(_0xed6c('0x6'))['db'];var utils=require(_0xed6c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xed6c('0x8'));var jayson=require(_0xed6c('0x9'));var client=jayson[_0xed6c('0xa')][_0xed6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6546,_0x5e0e3a,_0x7668a7){return new BPromise(function(_0x46e2c4,_0x4fd673){return client['request'](_0x4a6546,_0x7668a7)[_0xed6c('0xc')](function(_0xc996c4){logger[_0xed6c('0xd')](_0xed6c('0xe'),_0x5e0e3a,'request\x20sent');logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x5e0e3a,'request\x20sent',JSON[_0xed6c('0xf')](_0xc996c4));if(_0xc996c4['error']){if(_0xc996c4['error'][_0xed6c('0x10')]===0x1f4){logger[_0xed6c('0x11')]('Campaign,\x20%s,\x20%s',_0x5e0e3a,_0xc996c4[_0xed6c('0x11')]['message']);return _0x4fd673(_0xc996c4[_0xed6c('0x11')][_0xed6c('0x12')]);}logger['error'](_0xed6c('0xe'),_0x5e0e3a,_0xc996c4[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x46e2c4(_0xc996c4[_0xed6c('0x11')]['message']);}else{logger['info'](_0xed6c('0xe'),_0x5e0e3a,_0xed6c('0x13'));_0x46e2c4(_0xc996c4[_0xed6c('0x14')]['message']);}})[_0xed6c('0x15')](function(_0x526c54){logger[_0xed6c('0x11')](_0xed6c('0xe'),_0x5e0e3a,_0x526c54);_0x4fd673(_0x526c54);});});}exports[_0xed6c('0x16')]=function(_0x1fe8c0){var _0x4a920e=this;return new Promise(function(_0x387ba1,_0x1856f7){return db[_0xed6c('0x17')]['findAll']({'raw':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')][_0xed6c('0x19')]===undefined?!![]:![]:!![],'where':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')]['where']||null:null,'attributes':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0['options'][_0xed6c('0x1a')]||null:null,'limit':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')][_0xed6c('0x1b')]||null:null,'include':_0x1fe8c0['options']?_0x1fe8c0[_0xed6c('0x18')]['include']?_[_0xed6c('0x1c')](_0x1fe8c0['options'][_0xed6c('0x1d')],function(_0x21e0ba){return{'model':db[_0x21e0ba[_0xed6c('0x1e')]],'as':_0x21e0ba['as'],'attributes':_0x21e0ba[_0xed6c('0x1a')],'include':_0x21e0ba[_0xed6c('0x1d')]?_[_0xed6c('0x1c')](_0x21e0ba[_0xed6c('0x1d')],function(_0x27fb6c){return{'model':db[_0x27fb6c[_0xed6c('0x1e')]],'as':_0x27fb6c['as'],'attributes':_0x27fb6c[_0xed6c('0x1a')],'include':_0x27fb6c[_0xed6c('0x1d')]?_['map'](_0x27fb6c[_0xed6c('0x1d')],function(_0x27484c){return{'model':db[_0x27484c[_0xed6c('0x1e')]],'as':_0x27484c['as'],'attributes':_0x27484c[_0xed6c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xed6c('0xc')](function(_0x3574a3){logger['info'](_0xed6c('0x16'),_0x1fe8c0);logger[_0xed6c('0x1f')](_0xed6c('0x16'),_0x1fe8c0,JSON['stringify'](_0x3574a3));_0x387ba1(_0x3574a3);})['catch'](function(_0x531cd0){logger['error'](_0xed6c('0x16'),_0x531cd0['message'],_0x1fe8c0);_0x1856f7(_0x4a920e[_0xed6c('0x11')](0x1f4,_0x531cd0['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5d5ce2c..e928a0e 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 _0x6e73=['addLists','addBlackLists','put','update','destroy','delete','/:id/blacklists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getBlackLists','post','create','/:id/clone','clone','/:id/lists'];(function(_0x5d2cf3,_0x16bfd2){var _0x45a3fc=function(_0x24e67f){while(--_0x24e67f){_0x5d2cf3['push'](_0x5d2cf3['shift']());}};_0x45a3fc(++_0x16bfd2);}(_0x6e73,0x110));var _0x36e7=function(_0xcf1602,_0x1da275){_0xcf1602=_0xcf1602-0x0;var _0x2bfa18=_0x6e73[_0xcf1602];return _0x2bfa18;};'use strict';var multer=require(_0x36e7('0x0'));var util=require(_0x36e7('0x1'));var path=require(_0x36e7('0x2'));var timeout=require(_0x36e7('0x3'));var express=require(_0x36e7('0x4'));var router=express[_0x36e7('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x36e7('0x6'));var interaction=require(_0x36e7('0x7'));var config=require(_0x36e7('0x8'));var controller=require(_0x36e7('0x9'));router[_0x36e7('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x36e7('0xa')](_0x36e7('0xb'),auth[_0x36e7('0xc')](),controller[_0x36e7('0xd')]);router[_0x36e7('0xa')](_0x36e7('0xe'),auth[_0x36e7('0xc')](),controller[_0x36e7('0xf')]);router[_0x36e7('0xa')](_0x36e7('0x10'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x11')]);router[_0x36e7('0xa')](_0x36e7('0x12'),auth[_0x36e7('0xc')](),controller['getHopperFinals']);router['get']('/:id/hopper_black',auth[_0x36e7('0xc')](),controller['getHopperBlacks']);router[_0x36e7('0xa')]('/:id/lists',auth['isAuthenticated'](),controller['getLists']);router['get']('/:id/blacklists',auth[_0x36e7('0xc')](),controller[_0x36e7('0x13')]);router[_0x36e7('0x14')]('/',auth[_0x36e7('0xc')](),controller[_0x36e7('0x15')]);router['post'](_0x36e7('0x16'),auth['isAuthenticated'](),controller[_0x36e7('0x17')]);router['post'](_0x36e7('0x18'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x19')]);router[_0x36e7('0x14')]('/:id/blacklists',auth[_0x36e7('0xc')](),controller[_0x36e7('0x1a')]);router[_0x36e7('0x1b')]('/:id',auth[_0x36e7('0xc')](),controller[_0x36e7('0x1c')]);router['delete'](_0x36e7('0xb'),auth[_0x36e7('0xc')](),controller[_0x36e7('0x1d')]);router[_0x36e7('0x1e')](_0x36e7('0x18'),auth[_0x36e7('0xc')](),controller['removeLists']);router[_0x36e7('0x1e')](_0x36e7('0x1f'),auth[_0x36e7('0xc')](),controller['removeBlackLists']);module[_0x36e7('0x20')]=router; \ No newline at end of file +var _0x884b=['/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','getBlackLists','post','create','clone','addLists','/:id/blacklists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','getHopperHistories','getHopperFinals'];(function(_0x45d501,_0x1901b7){var _0x290355=function(_0x43205f){while(--_0x43205f){_0x45d501['push'](_0x45d501['shift']());}};_0x290355(++_0x1901b7);}(_0x884b,0x99));var _0xb884=function(_0x1562a2,_0x2e4655){_0x1562a2=_0x1562a2-0x0;var _0x39a636=_0x884b[_0x1562a2];return _0x39a636;};'use strict';var multer=require(_0xb884('0x0'));var util=require(_0xb884('0x1'));var path=require(_0xb884('0x2'));var timeout=require(_0xb884('0x3'));var express=require(_0xb884('0x4'));var router=express[_0xb884('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb884('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb884('0x7'));var controller=require(_0xb884('0x8'));router[_0xb884('0x9')]('/',auth[_0xb884('0xa')](),controller[_0xb884('0xb')]);router['get'](_0xb884('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb884('0xd'),auth[_0xb884('0xa')](),controller[_0xb884('0xe')]);router[_0xb884('0x9')]('/:id/hopper_histories',auth[_0xb884('0xa')](),controller[_0xb884('0xf')]);router[_0xb884('0x9')]('/:id/hopper_finals',auth[_0xb884('0xa')](),controller[_0xb884('0x10')]);router[_0xb884('0x9')](_0xb884('0x11'),auth['isAuthenticated'](),controller[_0xb884('0x12')]);router[_0xb884('0x9')](_0xb884('0x13'),auth[_0xb884('0xa')](),controller[_0xb884('0x14')]);router[_0xb884('0x9')]('/:id/blacklists',auth[_0xb884('0xa')](),controller[_0xb884('0x15')]);router[_0xb884('0x16')]('/',auth['isAuthenticated'](),controller[_0xb884('0x17')]);router[_0xb884('0x16')]('/:id/clone',auth[_0xb884('0xa')](),controller[_0xb884('0x18')]);router[_0xb884('0x16')](_0xb884('0x13'),auth['isAuthenticated'](),controller[_0xb884('0x19')]);router['post'](_0xb884('0x1a'),auth[_0xb884('0xa')](),controller['addBlackLists']);router[_0xb884('0x1b')](_0xb884('0xc'),auth[_0xb884('0xa')](),controller[_0xb884('0x1c')]);router[_0xb884('0x1d')]('/:id',auth[_0xb884('0xa')](),controller[_0xb884('0x1e')]);router[_0xb884('0x1d')](_0xb884('0x13'),auth[_0xb884('0xa')](),controller[_0xb884('0x1f')]);router[_0xb884('0x1d')](_0xb884('0x1a'),auth[_0xb884('0xa')](),controller[_0xb884('0x20')]);module[_0xb884('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 55d79ae..d4a5163 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 _0xfb09=['sequelize','exports','STRING','VIRTUAL','getDataValue','key'];(function(_0x3f9584,_0x5ab12c){var _0x9d54c=function(_0x2882df){while(--_0x2882df){_0x3f9584['push'](_0x3f9584['shift']());}};_0x9d54c(++_0x5ab12c);}(_0xfb09,0xa8));var _0x9fb0=function(_0x4138ac,_0x300097){_0x4138ac=_0x4138ac-0x0;var _0x66154=_0xfb09[_0x4138ac];return _0x66154;};'use strict';var Sequelize=require(_0x9fb0('0x0'));module[_0x9fb0('0x1')]={'key':{'type':Sequelize[_0x9fb0('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0x9fb0('0x2')]},'name':{'type':Sequelize[_0x9fb0('0x3')],'get':function(){return this[_0x9fb0('0x4')](_0x9fb0('0x5'));}}}; \ No newline at end of file +var _0x5fe3=['exports','STRING','TEXT','medium','getDataValue','key'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x5fe3,0x114));var _0x35fe=function(_0x4ed32d,_0x327695){_0x4ed32d=_0x4ed32d-0x0;var _0xf624df=_0x5fe3[_0x4ed32d];return _0xf624df;};'use strict';var Sequelize=require('sequelize');module[_0x35fe('0x0')]={'key':{'type':Sequelize[_0x35fe('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x35fe('0x2')],'length':_0x35fe('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x35fe('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x35fe('0x4')](_0x35fe('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 18dc0eb..5564f27 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 _0xb097=['pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','get','CannedAnswers','name','send','index','map','CannedAnswer','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb097,0xcc));var _0x7b09=function(_0x593e4c,_0x5b965b){_0x593e4c=_0x593e4c-0x0;var _0x15171a=_0xb097[_0x593e4c];return _0x15171a;};'use strict';var emlformat=require(_0x7b09('0x0'));var rimraf=require(_0x7b09('0x1'));var zipdir=require(_0x7b09('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7b09('0x3'));var BPromise=require(_0x7b09('0x4'));var Mustache=require('mustache');var util=require(_0x7b09('0x5'));var path=require(_0x7b09('0x6'));var sox=require('sox');var csv=require(_0x7b09('0x7'));var ejs=require(_0x7b09('0x8'));var fs=require('fs');var fs_extra=require(_0x7b09('0x9'));var _=require(_0x7b09('0xa'));var squel=require(_0x7b09('0xb'));var crypto=require(_0x7b09('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x7b09('0xd'));var toCsv=require(_0x7b09('0x7'));var querystring=require(_0x7b09('0xe'));var Papa=require(_0x7b09('0xf'));var Redis=require(_0x7b09('0x10'));var authService=require(_0x7b09('0x11'));var qs=require(_0x7b09('0x12'));var as=require(_0x7b09('0x13'));var hardwareService=require(_0x7b09('0x14'));var logger=require(_0x7b09('0x15'))(_0x7b09('0x16'));var utils=require(_0x7b09('0x17'));var config=require(_0x7b09('0x18'));var licenseUtil=require(_0x7b09('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ebb8f,_0x3391d4){_0x3391d4=_0x3391d4||0xcc;return function(_0x251ad1){if(_0x251ad1){return _0x2ebb8f[_0x7b09('0x1a')](_0x3391d4);}return _0x2ebb8f['status'](_0x3391d4)[_0x7b09('0x1b')]();};}function respondWithResult(_0x52c32b,_0x4f3ec7){_0x4f3ec7=_0x4f3ec7||0xc8;return function(_0x429ddf){if(_0x429ddf){return _0x52c32b[_0x7b09('0x1c')](_0x4f3ec7)[_0x7b09('0x1d')](_0x429ddf);}};}function respondWithFilteredResult(_0x13b632,_0x139480){return function(_0x5eed78){if(_0x5eed78){var _0x3d1157=typeof _0x139480[_0x7b09('0x1e')]===_0x7b09('0x1f')&&typeof _0x139480[_0x7b09('0x20')]===_0x7b09('0x1f');var _0x4637dc=_0x5eed78[_0x7b09('0x21')];var _0x1f73d7=_0x3d1157?0x0:_0x139480[_0x7b09('0x1e')];var _0x420702=_0x3d1157?_0x5eed78['count']:_0x139480['offset']+_0x139480['limit'];var _0xfa03e8;if(_0x420702>=_0x4637dc){_0x420702=_0x4637dc;_0xfa03e8=0xc8;}else{_0xfa03e8=0xce;}_0x13b632[_0x7b09('0x1c')](_0xfa03e8);return _0x13b632[_0x7b09('0x22')]('Content-Range',_0x1f73d7+'-'+_0x420702+'/'+_0x4637dc)['json'](_0x5eed78);}return null;};}function patchUpdates(_0x17b191){return function(_0x1d2d73){try{jsonpatch[_0x7b09('0x23')](_0x1d2d73,_0x17b191,!![]);}catch(_0x5197bd){return BPromise['reject'](_0x5197bd);}return _0x1d2d73[_0x7b09('0x24')]();};}function saveUpdates(_0x26caf7,_0x4af089){return function(_0x2e4175){if(_0x2e4175){return _0x2e4175[_0x7b09('0x25')](_0x26caf7)['then'](function(_0x15ee35){return _0x15ee35;});}return null;};}function removeEntity(_0x38f356,_0x2e58a8){return function(_0x1e08c3){if(_0x1e08c3){return _0x1e08c3[_0x7b09('0x26')]()[_0x7b09('0x27')](function(){var _0xe267ac=_0x1e08c3[_0x7b09('0x28')]({'plain':!![]});var _0x5b0f63=_0x7b09('0x29');return db['UserProfileResource'][_0x7b09('0x26')]({'where':{'type':_0x5b0f63,'resourceId':_0xe267ac['id']}})[_0x7b09('0x27')](function(){return _0x1e08c3;});})[_0x7b09('0x27')](function(){_0x38f356['status'](0xcc)[_0x7b09('0x1b')]();});}};}function handleEntityNotFound(_0x37f319,_0x36faa5){return function(_0x8a849e){if(!_0x8a849e){_0x37f319[_0x7b09('0x1a')](0x194);}return _0x8a849e;};}function handleError(_0x1297c4,_0x24867c){_0x24867c=_0x24867c||0x1f4;return function(_0x4535dd){logger['error'](_0x4535dd['stack']);if(_0x4535dd[_0x7b09('0x2a')]){delete _0x4535dd[_0x7b09('0x2a')];}_0x1297c4['status'](_0x24867c)[_0x7b09('0x2b')](_0x4535dd);};}exports[_0x7b09('0x2c')]=function(_0x5551d6,_0x442c11){var _0x206343={},_0xa3e5ec={},_0x47c016={'count':0x0,'rows':[]};var _0x546bf7=_[_0x7b09('0x2d')](db[_0x7b09('0x2e')]['rawAttributes'],function(_0x225494){return{'name':_0x225494[_0x7b09('0x2f')],'type':_0x225494['type'][_0x7b09('0x30')]};});_0xa3e5ec[_0x7b09('0x31')]=_['map'](_0x546bf7,_0x7b09('0x2a'));_0xa3e5ec[_0x7b09('0x32')]=_[_0x7b09('0x33')](_0x5551d6[_0x7b09('0x32')]);_0xa3e5ec['filters']=_['intersection'](_0xa3e5ec[_0x7b09('0x31')],_0xa3e5ec[_0x7b09('0x32')]);_0x206343[_0x7b09('0x34')]=_[_0x7b09('0x35')](_0xa3e5ec[_0x7b09('0x31')],qs[_0x7b09('0x36')](_0x5551d6[_0x7b09('0x32')]['fields']));_0x206343[_0x7b09('0x34')]=_0x206343['attributes'][_0x7b09('0x37')]?_0x206343[_0x7b09('0x34')]:_0xa3e5ec[_0x7b09('0x31')];if(!_0x5551d6[_0x7b09('0x32')][_0x7b09('0x38')]('nolimit')){_0x206343['limit']=qs[_0x7b09('0x20')](_0x5551d6['query']['limit']);_0x206343[_0x7b09('0x1e')]=qs[_0x7b09('0x1e')](_0x5551d6[_0x7b09('0x32')]['offset']);}_0x206343['order']=qs[_0x7b09('0x39')](_0x5551d6[_0x7b09('0x32')][_0x7b09('0x39')]);_0x206343[_0x7b09('0x3a')]=qs[_0x7b09('0x3b')](_[_0x7b09('0x3c')](_0x5551d6[_0x7b09('0x32')],_0xa3e5ec['filters']),_0x546bf7);if(_0x5551d6[_0x7b09('0x32')][_0x7b09('0x3d')]){_0x206343[_0x7b09('0x3a')]=_[_0x7b09('0x3e')](_0x206343[_0x7b09('0x3a')],{'$or':[{'key':{'$like':'%'+_0x5551d6[_0x7b09('0x32')][_0x7b09('0x3d')]+'%'}},{'value':{'$like':'%'+_0x5551d6['query']['filter']+'%'}}]});}_0x206343=_[_0x7b09('0x3e')]({},_0x206343,_0x5551d6[_0x7b09('0x3f')]);var _0x6fb9a8={'where':_0x206343[_0x7b09('0x3a')]};return db[_0x7b09('0x2e')][_0x7b09('0x21')](_0x6fb9a8)[_0x7b09('0x27')](function(_0x39906d){_0x47c016[_0x7b09('0x21')]=_0x39906d;if(_0x5551d6[_0x7b09('0x32')][_0x7b09('0x40')]){_0x206343[_0x7b09('0x41')]=[{'all':!![]}];}return db[_0x7b09('0x2e')][_0x7b09('0x42')](_0x206343);})['then'](function(_0xcdd95b){_0x47c016[_0x7b09('0x43')]=_0xcdd95b;return _0x47c016;})[_0x7b09('0x27')](respondWithFilteredResult(_0x442c11,_0x206343))[_0x7b09('0x44')](handleError(_0x442c11,null));};exports[_0x7b09('0x45')]=function(_0x47fcb0,_0x108914){var _0x2ff7b6={'raw':!![],'where':{'id':_0x47fcb0[_0x7b09('0x46')]['id']}},_0x4bf86b={};_0x4bf86b[_0x7b09('0x31')]=_[_0x7b09('0x33')](db[_0x7b09('0x2e')]['rawAttributes']);_0x4bf86b[_0x7b09('0x32')]=_['keys'](_0x47fcb0['query']);_0x4bf86b[_0x7b09('0x3b')]=_[_0x7b09('0x35')](_0x4bf86b[_0x7b09('0x31')],_0x4bf86b[_0x7b09('0x32')]);_0x2ff7b6[_0x7b09('0x34')]=_[_0x7b09('0x35')](_0x4bf86b[_0x7b09('0x31')],qs['fields'](_0x47fcb0[_0x7b09('0x32')][_0x7b09('0x36')]));_0x2ff7b6[_0x7b09('0x34')]=_0x2ff7b6[_0x7b09('0x34')][_0x7b09('0x37')]?_0x2ff7b6[_0x7b09('0x34')]:_0x4bf86b[_0x7b09('0x31')];if(_0x47fcb0['query'][_0x7b09('0x40')]){_0x2ff7b6['include']=[{'all':!![]}];}_0x2ff7b6=_[_0x7b09('0x3e')]({},_0x2ff7b6,_0x47fcb0[_0x7b09('0x3f')]);return db[_0x7b09('0x2e')]['find'](_0x2ff7b6)[_0x7b09('0x27')](handleEntityNotFound(_0x108914,null))[_0x7b09('0x27')](respondWithResult(_0x108914,null))[_0x7b09('0x44')](handleError(_0x108914,null));};exports[_0x7b09('0x25')]=function(_0x9b0c8a,_0x4f4a68){if(_0x9b0c8a[_0x7b09('0x47')]['id']){delete _0x9b0c8a[_0x7b09('0x47')]['id'];}return db[_0x7b09('0x2e')][_0x7b09('0x48')]({'where':{'id':_0x9b0c8a[_0x7b09('0x46')]['id']}})[_0x7b09('0x27')](handleEntityNotFound(_0x4f4a68,null))['then'](saveUpdates(_0x9b0c8a[_0x7b09('0x47')],null))['then'](respondWithResult(_0x4f4a68,null))[_0x7b09('0x44')](handleError(_0x4f4a68,null));};exports[_0x7b09('0x26')]=function(_0x4500fd,_0x367536){return db[_0x7b09('0x2e')][_0x7b09('0x48')]({'where':{'id':_0x4500fd['params']['id']}})[_0x7b09('0x27')](handleEntityNotFound(_0x367536,null))[_0x7b09('0x27')](removeEntity(_0x367536,null))[_0x7b09('0x44')](handleError(_0x367536,null));};exports[_0x7b09('0x49')]=function(_0x2bae25,_0x29bb3c){var _0x53cd23={'key':_0x2bae25[_0x7b09('0x47')][_0x7b09('0x30')]};if(_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4a')]){_0x53cd23[_0x7b09('0x4a')]=_0x2bae25['body'][_0x7b09('0x4a')];}else if(_0x2bae25['body'][_0x7b09('0x4b')]){_0x53cd23[_0x7b09('0x4b')]=_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4b')];}else if(_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4c')]){_0x53cd23['OpenchannelAccountId']=_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4c')];}else if(_0x2bae25[_0x7b09('0x47')][_0x7b09('0x4d')]){_0x53cd23['ChatWebsiteId']=_0x2bae25['body'][_0x7b09('0x4d')];}return db['CannedAnswer'][_0x7b09('0x48')]({'where':_0x53cd23})[_0x7b09('0x27')](function(_0x52c1d4){if(_0x52c1d4){throw new db[(_0x7b09('0x4e'))][(_0x7b09('0x4f'))](_0x7b09('0x50'));}return db[_0x7b09('0x2e')][_0x7b09('0x49')](_0x2bae25[_0x7b09('0x47')]);})['then'](function(_0x144d52){var _0x26d41b=_0x2bae25[_0x7b09('0x51')]['get']({'plain':!![]});if(!_0x26d41b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26d41b[_0x7b09('0x52')]===_0x7b09('0x51')){var _0x1466fb=_0x144d52[_0x7b09('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x7b09('0x48')]({'where':{'name':_0x7b09('0x29'),'userProfileId':_0x26d41b[_0x7b09('0x53')]},'raw':!![]})[_0x7b09('0x27')](function(_0x41d08f){if(_0x41d08f&&_0x41d08f[_0x7b09('0x54')]===0x0){return db[_0x7b09('0x55')]['create']({'name':_0x1466fb[_0x7b09('0x2a')],'resourceId':_0x1466fb['id'],'type':_0x41d08f[_0x7b09('0x2a')],'sectionId':_0x41d08f['id']},{})[_0x7b09('0x27')](function(){return _0x144d52;});}else{return _0x144d52;}})[_0x7b09('0x44')](function(_0xab3131){logger[_0x7b09('0x56')](_0x7b09('0x57'),_0xab3131);throw _0xab3131;});}return _0x144d52;})[_0x7b09('0x27')](respondWithResult(_0x29bb3c,0xc9))['catch'](handleError(_0x29bb3c,null));}; \ No newline at end of file +var _0x72c9=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','then','destroy','get','CannedAnswers','UserProfileResource','sendStatus','error','stack','name','index','CannedAnswer','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','findAll','catch','show','params','length','find','update','body','create','MailAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x72c9,0x102));var _0x972c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x72c9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x972c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x972c('0x1'));var jsonpatch=require(_0x972c('0x2'));var rp=require(_0x972c('0x3'));var moment=require(_0x972c('0x4'));var BPromise=require(_0x972c('0x5'));var Mustache=require(_0x972c('0x6'));var util=require(_0x972c('0x7'));var path=require(_0x972c('0x8'));var sox=require(_0x972c('0x9'));var csv=require(_0x972c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x972c('0xb'));var _=require(_0x972c('0xc'));var squel=require(_0x972c('0xd'));var crypto=require(_0x972c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x972c('0xf'));var toCsv=require(_0x972c('0xa'));var querystring=require(_0x972c('0x10'));var Papa=require(_0x972c('0x11'));var Redis=require(_0x972c('0x12'));var authService=require(_0x972c('0x13'));var qs=require(_0x972c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x972c('0x15'));var logger=require(_0x972c('0x16'))('api');var utils=require(_0x972c('0x17'));var config=require(_0x972c('0x18'));var licenseUtil=require(_0x972c('0x19'));var db=require(_0x972c('0x1a'))['db'];function respondWithStatusCode(_0x3f885b,_0x18c2b4){_0x18c2b4=_0x18c2b4||0xcc;return function(_0x518a04){if(_0x518a04){return _0x3f885b['sendStatus'](_0x18c2b4);}return _0x3f885b[_0x972c('0x1b')](_0x18c2b4)[_0x972c('0x1c')]();};}function respondWithResult(_0x50e95c,_0x6c013c){_0x6c013c=_0x6c013c||0xc8;return function(_0x3497d5){if(_0x3497d5){return _0x50e95c['status'](_0x6c013c)[_0x972c('0x1d')](_0x3497d5);}};}function respondWithFilteredResult(_0x3d0261,_0x41901d){return function(_0x58c0a9){if(_0x58c0a9){var _0x2615b0=typeof _0x41901d['offset']==='undefined'&&typeof _0x41901d[_0x972c('0x1e')]===_0x972c('0x1f');var _0x244633=_0x58c0a9[_0x972c('0x20')];var _0x1bbd6a=_0x2615b0?0x0:_0x41901d[_0x972c('0x21')];var _0x44db61=_0x2615b0?_0x58c0a9[_0x972c('0x20')]:_0x41901d[_0x972c('0x21')]+_0x41901d[_0x972c('0x1e')];var _0x26218f;if(_0x44db61>=_0x244633){_0x44db61=_0x244633;_0x26218f=0xc8;}else{_0x26218f=0xce;}_0x3d0261['status'](_0x26218f);return _0x3d0261[_0x972c('0x22')](_0x972c('0x23'),_0x1bbd6a+'-'+_0x44db61+'/'+_0x244633)[_0x972c('0x1d')](_0x58c0a9);}return null;};}function patchUpdates(_0xaf42c7){return function(_0x397665){try{jsonpatch[_0x972c('0x24')](_0x397665,_0xaf42c7,!![]);}catch(_0x467b43){return BPromise['reject'](_0x467b43);}return _0x397665[_0x972c('0x25')]();};}function saveUpdates(_0x35f500,_0x2dbdfc){return function(_0x58a489){if(_0x58a489){return _0x58a489['update'](_0x35f500)[_0x972c('0x26')](function(_0x340da5){return _0x340da5;});}return null;};}function removeEntity(_0xc6638f,_0x4f77c9){return function(_0xcb2d66){if(_0xcb2d66){return _0xcb2d66[_0x972c('0x27')]()[_0x972c('0x26')](function(){var _0x42b40f=_0xcb2d66[_0x972c('0x28')]({'plain':!![]});var _0x592bbf=_0x972c('0x29');return db[_0x972c('0x2a')][_0x972c('0x27')]({'where':{'type':_0x592bbf,'resourceId':_0x42b40f['id']}})[_0x972c('0x26')](function(){return _0xcb2d66;});})['then'](function(){_0xc6638f[_0x972c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a637,_0x524a04){return function(_0x56e6b8){if(!_0x56e6b8){_0x26a637[_0x972c('0x2b')](0x194);}return _0x56e6b8;};}function handleError(_0x3fbf20,_0x2ff142){_0x2ff142=_0x2ff142||0x1f4;return function(_0x5386f1){logger[_0x972c('0x2c')](_0x5386f1[_0x972c('0x2d')]);if(_0x5386f1['name']){delete _0x5386f1[_0x972c('0x2e')];}_0x3fbf20[_0x972c('0x1b')](_0x2ff142)['send'](_0x5386f1);};}exports[_0x972c('0x2f')]=function(_0x52f26f,_0x4e4d34){var _0x42e492={},_0x549c38={},_0x175dca={'count':0x0,'rows':[]};var _0x57052=_['map'](db[_0x972c('0x30')][_0x972c('0x31')],function(_0x693992){return{'name':_0x693992[_0x972c('0x32')],'type':_0x693992[_0x972c('0x33')][_0x972c('0x34')]};});_0x549c38[_0x972c('0x35')]=_[_0x972c('0x36')](_0x57052,_0x972c('0x2e'));_0x549c38['query']=_[_0x972c('0x37')](_0x52f26f[_0x972c('0x38')]);_0x549c38[_0x972c('0x39')]=_['intersection'](_0x549c38['model'],_0x549c38[_0x972c('0x38')]);_0x42e492[_0x972c('0x3a')]=_[_0x972c('0x3b')](_0x549c38['model'],qs[_0x972c('0x3c')](_0x52f26f[_0x972c('0x38')][_0x972c('0x3c')]));_0x42e492[_0x972c('0x3a')]=_0x42e492[_0x972c('0x3a')]['length']?_0x42e492['attributes']:_0x549c38['model'];if(!_0x52f26f[_0x972c('0x38')][_0x972c('0x3d')](_0x972c('0x3e'))){_0x42e492[_0x972c('0x1e')]=qs[_0x972c('0x1e')](_0x52f26f['query']['limit']);_0x42e492['offset']=qs[_0x972c('0x21')](_0x52f26f[_0x972c('0x38')]['offset']);}_0x42e492['order']=qs[_0x972c('0x3f')](_0x52f26f[_0x972c('0x38')]['sort']);_0x42e492['where']=qs[_0x972c('0x39')](_[_0x972c('0x40')](_0x52f26f[_0x972c('0x38')],_0x549c38[_0x972c('0x39')]),_0x57052);if(_0x52f26f[_0x972c('0x38')][_0x972c('0x41')]){_0x42e492[_0x972c('0x42')]=_[_0x972c('0x43')](_0x42e492[_0x972c('0x42')],{'$or':[{'key':{'$like':'%'+_0x52f26f['query'][_0x972c('0x41')]+'%'}},{'value':{'$like':'%'+_0x52f26f[_0x972c('0x38')][_0x972c('0x41')]+'%'}}]});}_0x42e492=_[_0x972c('0x43')]({},_0x42e492,_0x52f26f[_0x972c('0x44')]);var _0x3e7801={'where':_0x42e492[_0x972c('0x42')]};return db['CannedAnswer'][_0x972c('0x20')](_0x3e7801)[_0x972c('0x26')](function(_0x4ec44a){_0x175dca['count']=_0x4ec44a;if(_0x52f26f['query'][_0x972c('0x45')]){_0x42e492['include']=[{'all':!![]}];}return db[_0x972c('0x30')][_0x972c('0x46')](_0x42e492);})[_0x972c('0x26')](function(_0x454c2b){_0x175dca['rows']=_0x454c2b;return _0x175dca;})[_0x972c('0x26')](respondWithFilteredResult(_0x4e4d34,_0x42e492))[_0x972c('0x47')](handleError(_0x4e4d34,null));};exports[_0x972c('0x48')]=function(_0x532d49,_0x50a463){var _0x3be3e7={'raw':!![],'where':{'id':_0x532d49[_0x972c('0x49')]['id']}},_0x2bfe0d={};_0x2bfe0d[_0x972c('0x35')]=_[_0x972c('0x37')](db[_0x972c('0x30')][_0x972c('0x31')]);_0x2bfe0d[_0x972c('0x38')]=_['keys'](_0x532d49['query']);_0x2bfe0d[_0x972c('0x39')]=_[_0x972c('0x3b')](_0x2bfe0d[_0x972c('0x35')],_0x2bfe0d['query']);_0x3be3e7[_0x972c('0x3a')]=_[_0x972c('0x3b')](_0x2bfe0d[_0x972c('0x35')],qs[_0x972c('0x3c')](_0x532d49['query'][_0x972c('0x3c')]));_0x3be3e7[_0x972c('0x3a')]=_0x3be3e7[_0x972c('0x3a')][_0x972c('0x4a')]?_0x3be3e7[_0x972c('0x3a')]:_0x2bfe0d['model'];if(_0x532d49[_0x972c('0x38')]['includeAll']){_0x3be3e7['include']=[{'all':!![]}];}_0x3be3e7=_['merge']({},_0x3be3e7,_0x532d49[_0x972c('0x44')]);return db[_0x972c('0x30')][_0x972c('0x4b')](_0x3be3e7)[_0x972c('0x26')](handleEntityNotFound(_0x50a463,null))['then'](respondWithResult(_0x50a463,null))[_0x972c('0x47')](handleError(_0x50a463,null));};exports[_0x972c('0x4c')]=function(_0xb44496,_0x5862af){if(_0xb44496[_0x972c('0x4d')]['id']){delete _0xb44496[_0x972c('0x4d')]['id'];}return db[_0x972c('0x30')][_0x972c('0x4b')]({'where':{'id':_0xb44496['params']['id']}})[_0x972c('0x26')](handleEntityNotFound(_0x5862af,null))[_0x972c('0x26')](saveUpdates(_0xb44496[_0x972c('0x4d')],null))[_0x972c('0x26')](respondWithResult(_0x5862af,null))[_0x972c('0x47')](handleError(_0x5862af,null));};exports[_0x972c('0x27')]=function(_0x2df9d6,_0x63b7a1){return db['CannedAnswer'][_0x972c('0x4b')]({'where':{'id':_0x2df9d6[_0x972c('0x49')]['id']}})[_0x972c('0x26')](handleEntityNotFound(_0x63b7a1,null))[_0x972c('0x26')](removeEntity(_0x63b7a1,null))[_0x972c('0x47')](handleError(_0x63b7a1,null));};exports[_0x972c('0x4e')]=function(_0x1dc66a,_0x2b9f44){var _0x1f66a5={'key':_0x1dc66a[_0x972c('0x4d')]['key']};if(_0x1dc66a[_0x972c('0x4d')][_0x972c('0x4f')]){_0x1f66a5['MailAccountId']=_0x1dc66a[_0x972c('0x4d')]['MailAccountId'];}else if(_0x1dc66a[_0x972c('0x4d')]['SmsAccountId']){_0x1f66a5['SmsAccountId']=_0x1dc66a['body']['SmsAccountId'];}else if(_0x1dc66a['body']['OpenchannelAccountId']){_0x1f66a5[_0x972c('0x50')]=_0x1dc66a[_0x972c('0x4d')]['OpenchannelAccountId'];}else if(_0x1dc66a['body'][_0x972c('0x51')]){_0x1f66a5['ChatWebsiteId']=_0x1dc66a['body']['ChatWebsiteId'];}return db[_0x972c('0x30')][_0x972c('0x4b')]({'where':_0x1f66a5})[_0x972c('0x26')](function(_0x137095){if(_0x137095){throw new db[(_0x972c('0x52'))][(_0x972c('0x53'))](_0x972c('0x54'));}return db['CannedAnswer'][_0x972c('0x4e')](_0x1dc66a[_0x972c('0x4d')]);})['then'](function(_0x39496e){var _0x9b0e50=_0x1dc66a[_0x972c('0x55')][_0x972c('0x28')]({'plain':!![]});if(!_0x9b0e50)throw new Error(_0x972c('0x56'));if(_0x9b0e50['role']===_0x972c('0x55')){var _0x11e82a=_0x39496e[_0x972c('0x28')]({'plain':!![]});return db[_0x972c('0x57')]['find']({'where':{'name':_0x972c('0x29'),'userProfileId':_0x9b0e50[_0x972c('0x58')]},'raw':!![]})[_0x972c('0x26')](function(_0x4cd977){if(_0x4cd977&&_0x4cd977[_0x972c('0x59')]===0x0){return db['UserProfileResource'][_0x972c('0x4e')]({'name':_0x11e82a[_0x972c('0x2e')],'resourceId':_0x11e82a['id'],'type':_0x4cd977['name'],'sectionId':_0x4cd977['id']},{})['then'](function(){return _0x39496e;});}else{return _0x39496e;}})[_0x972c('0x47')](function(_0x566d77){logger[_0x972c('0x2c')](_0x972c('0x5a'),_0x566d77);throw _0x566d77;});}return _0x39496e;})[_0x972c('0x26')](respondWithResult(_0x2b9f44,0xc9))[_0x972c('0x47')](handleError(_0x2b9f44,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f2a6140..74509f9 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 _0x59d0=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x5b6ba1,_0x49f578){var _0x417c60=function(_0x562ffb){while(--_0x562ffb){_0x5b6ba1['push'](_0x5b6ba1['shift']());}};_0x417c60(++_0x49f578);}(_0x59d0,0x129));var _0x059d=function(_0x1448d8,_0x51afba){_0x1448d8=_0x1448d8-0x0;var _0x108f1f=_0x59d0[_0x1448d8];return _0x108f1f;};'use strict';var _=require(_0x059d('0x0'));var util=require('util');var logger=require(_0x059d('0x1'))(_0x059d('0x2'));var moment=require('moment');var BPromise=require(_0x059d('0x3'));var rp=require(_0x059d('0x4'));var fs=require('fs');var path=require(_0x059d('0x5'));var rimraf=require(_0x059d('0x6'));var config=require(_0x059d('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x059d('0x8')]=function(_0x45943d,_0x364db8){return _0x45943d[_0x059d('0x9')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x059d('0xa'),'collate':_0x059d('0xb')});}; \ No newline at end of file +var _0xaf4c=['../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x51d22a,_0x6cc2ee){_0x51d22a=_0x51d22a-0x0;var _0xc44c8a=_0xaf4c[_0x51d22a];return _0xc44c8a;};'use strict';var _=require('lodash');var util=require(_0xcaf4('0x0'));var logger=require(_0xcaf4('0x1'))('api');var moment=require(_0xcaf4('0x2'));var BPromise=require(_0xcaf4('0x3'));var rp=require(_0xcaf4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcaf4('0x5'));var config=require(_0xcaf4('0x6'));var attributes=require(_0xcaf4('0x7'));module['exports']=function(_0x21ad95,_0x548527){return _0x21ad95[_0xcaf4('0x8')](_0xcaf4('0x9'),attributes,{'tableName':_0xcaf4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcaf4('0xb'),'collate':_0xcaf4('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index b64c290..1cf81f1 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(_0x5bb0ed,_0x21ea31){var _0x541335=function(_0x29dce9){while(--_0x29dce9){_0x5bb0ed['push'](_0x5bb0ed['shift']());}};_0x541335(++_0x21ea31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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(_0x2a9e92,_0x12e91a){var _0x8f945b=function(_0x306595){while(--_0x306595){_0x2a9e92['push'](_0x2a9e92['shift']());}};_0x8f945b(++_0x12e91a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 6a913b8..28e7500 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 _0xb795=['./cannedAnswer.controller','get','index','isAuthenticated','show','put','/:id','update','destroy','multer','path','connect-timeout','express','fs-extra','../../config/environment'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xb795,0x180));var _0x5b79=function(_0x276c8d,_0x437fa6){_0x276c8d=_0x276c8d-0x0;var _0x51c99f=_0xb795[_0x276c8d];return _0x51c99f;};'use strict';var multer=require(_0x5b79('0x0'));var util=require('util');var path=require(_0x5b79('0x1'));var timeout=require(_0x5b79('0x2'));var express=require(_0x5b79('0x3'));var router=express['Router']();var fs_extra=require(_0x5b79('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b79('0x5'));var controller=require(_0x5b79('0x6'));router[_0x5b79('0x7')]('/',auth['isAuthenticated'](),controller[_0x5b79('0x8')]);router['get']('/:id',auth[_0x5b79('0x9')](),controller[_0x5b79('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x5b79('0xb')](_0x5b79('0xc'),auth[_0x5b79('0x9')](),controller[_0x5b79('0xd')]);router['delete'](_0x5b79('0xc'),auth[_0x5b79('0x9')](),controller[_0x5b79('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1cf3=['create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id'];(function(_0x20b035,_0x33e530){var _0x26d5ec=function(_0x34fafa){while(--_0x34fafa){_0x20b035['push'](_0x20b035['shift']());}};_0x26d5ec(++_0x33e530);}(_0x1cf3,0x18c));var _0x31cf=function(_0x1cbc53,_0x50846c){_0x1cbc53=_0x1cbc53-0x0;var _0x4ec2c2=_0x1cf3[_0x1cbc53];return _0x4ec2c2;};'use strict';var multer=require(_0x31cf('0x0'));var util=require(_0x31cf('0x1'));var path=require(_0x31cf('0x2'));var timeout=require(_0x31cf('0x3'));var express=require(_0x31cf('0x4'));var router=express[_0x31cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x31cf('0x6'));var interaction=require(_0x31cf('0x7'));var config=require(_0x31cf('0x8'));var controller=require('./cannedAnswer.controller');router[_0x31cf('0x9')]('/',auth[_0x31cf('0xa')](),controller['index']);router[_0x31cf('0x9')](_0x31cf('0xb'),auth[_0x31cf('0xa')](),controller['show']);router['post']('/',auth[_0x31cf('0xa')](),controller[_0x31cf('0xc')]);router[_0x31cf('0xd')](_0x31cf('0xb'),auth[_0x31cf('0xa')](),controller[_0x31cf('0xe')]);router[_0x31cf('0xf')](_0x31cf('0xb'),auth[_0x31cf('0xa')](),controller[_0x31cf('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 7adc6be..65f6579 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 _0x1db3=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x58cc27,_0xc4c30b){var _0x40a3ec=function(_0xbb4c7c){while(--_0xbb4c7c){_0x58cc27['push'](_0x58cc27['shift']());}};_0x40a3ec(++_0xc4c30b);}(_0x1db3,0x1e5));var _0x31db=function(_0x163abc,_0x5ae42e){_0x163abc=_0x163abc-0x0;var _0x43ab13=_0x1db3[_0x163abc];return _0x43ab13;};'use strict';var Sequelize=require('sequelize');module[_0x31db('0x0')]={'calldate':{'type':Sequelize[_0x31db('0x1')],'allowNull':![],'defaultValue':_0x31db('0x2')},'clid':{'type':Sequelize[_0x31db('0x3')]},'src':{'type':Sequelize[_0x31db('0x3')]},'dst':{'type':Sequelize[_0x31db('0x3')]},'dcontext':{'type':Sequelize[_0x31db('0x3')]},'channel':{'type':Sequelize[_0x31db('0x3')]},'dstchannel':{'type':Sequelize[_0x31db('0x3')]},'lastapp':{'type':Sequelize[_0x31db('0x3')]},'lastdata':{'type':Sequelize[_0x31db('0x3')]},'duration':{'type':Sequelize[_0x31db('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x31db('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x31db('0x3')]},'amaflags':{'type':Sequelize[_0x31db('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x31db('0x3')]},'userfield':{'type':Sequelize[_0x31db('0x3')]},'uniqueid':{'type':Sequelize[_0x31db('0x3')]},'linkedid':{'type':Sequelize[_0x31db('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x31db('0x3')]},'type':{'type':Sequelize[_0x31db('0x3')]},'tag':{'type':Sequelize[_0x31db('0x3')]}}; \ No newline at end of file +var _0x9d02=['sequelize','DATE','STRING','INTEGER'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x9d02,0x118));var _0x29d0=function(_0x4daacb,_0x156b7e){_0x4daacb=_0x4daacb-0x0;var _0xd4f99c=_0x9d02[_0x4daacb];return _0xd4f99c;};'use strict';var Sequelize=require(_0x29d0('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x29d0('0x1')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x29d0('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x29d0('0x2')]},'dcontext':{'type':Sequelize[_0x29d0('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x29d0('0x2')]},'lastapp':{'type':Sequelize[_0x29d0('0x2')]},'lastdata':{'type':Sequelize[_0x29d0('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x29d0('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x29d0('0x2')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x29d0('0x2')]},'linkedid':{'type':Sequelize[_0x29d0('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x29d0('0x2')]},'type':{'type':Sequelize[_0x29d0('0x2')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 2538496..1d555a7 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 _0x7bae=['hasOwnProperty','order','sort','where','filter','type','merge','options','includeAll','include','catch','show','params','keys','find','create','body','destroy','describe','zip-dir','fast-json-patch','moment','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','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','Cdr','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x7bae,0x13b));var _0xe7ba=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x7bae[_0x3de8a4];return _0x4635cf;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['map'](_0x587c7d,_0xe7ba('0x29'));_0x369451['query']=_['keys'](_0x48c869[_0xe7ba('0x31')]);_0x369451[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7['attributes']=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x34')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x92fe7['attributes']=_0x92fe7[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x92fe7['attributes']:_0x369451[_0xe7ba('0x30')];if(!_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x37')]('nolimit')){_0x92fe7[_0xe7ba('0x1e')]=qs[_0xe7ba('0x1e')](_0x48c869['query'][_0xe7ba('0x1e')]);_0x92fe7[_0xe7ba('0x20')]=qs[_0xe7ba('0x20')](_0x48c869['query'][_0xe7ba('0x20')]);}_0x92fe7[_0xe7ba('0x38')]=qs['sort'](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x39')]);_0x92fe7[_0xe7ba('0x3a')]=qs['filters'](_['pick'](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x32')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3b')]){_0x92fe7[_0xe7ba('0x3a')]=_['merge'](_0x92fe7[_0xe7ba('0x3a')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x3139a6){if(_0x3139a6[_0xe7ba('0x3c')]!=='VIRTUAL'){var _0xe67917={};_0xe67917[_0x3139a6[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3b')]+'%'};return _0xe67917;}})});}_0x92fe7=_[_0xe7ba('0x3d')]({},_0x92fe7,_0x48c869[_0xe7ba('0x3e')]);var _0x124cc4={'where':_0x92fe7['where']};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x124cc4)[_0xe7ba('0x26')](function(_0x401b0a){_0x4bf5f9[_0xe7ba('0x1f')]=_0x401b0a;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x3f')]){_0x92fe7[_0xe7ba('0x40')]=[{'all':!![]}];}return db[_0xe7ba('0x2c')]['findAll'](_0x92fe7);})[_0xe7ba('0x26')](function(_0x417734){_0x4bf5f9['rows']=_0x417734;return _0x4bf5f9;})['then'](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x41')](handleError(_0x102925,null));};exports[_0xe7ba('0x42')]=function(_0x368af2,_0x5589c4){var _0x249e1d={'raw':!![],'where':{'id':_0x368af2[_0xe7ba('0x43')]['id']}},_0x82246e={};_0x82246e[_0xe7ba('0x30')]=_[_0xe7ba('0x44')](db['Cdr'][_0xe7ba('0x2d')]);_0x82246e['query']=_[_0xe7ba('0x44')](_0x368af2[_0xe7ba('0x31')]);_0x82246e[_0xe7ba('0x32')]=_[_0xe7ba('0x33')](_0x82246e[_0xe7ba('0x30')],_0x82246e[_0xe7ba('0x31')]);_0x249e1d[_0xe7ba('0x35')]=_[_0xe7ba('0x33')](_0x82246e['model'],qs[_0xe7ba('0x34')](_0x368af2[_0xe7ba('0x31')][_0xe7ba('0x34')]));_0x249e1d[_0xe7ba('0x35')]=_0x249e1d[_0xe7ba('0x35')][_0xe7ba('0x36')]?_0x249e1d[_0xe7ba('0x35')]:_0x82246e[_0xe7ba('0x30')];if(_0x368af2[_0xe7ba('0x31')][_0xe7ba('0x3f')]){_0x249e1d['include']=[{'all':!![]}];}_0x249e1d=_[_0xe7ba('0x3d')]({},_0x249e1d,_0x368af2['options']);return db[_0xe7ba('0x2c')][_0xe7ba('0x45')](_0x249e1d)[_0xe7ba('0x26')](handleEntityNotFound(_0x5589c4,null))[_0xe7ba('0x26')](respondWithResult(_0x5589c4,null))[_0xe7ba('0x41')](handleError(_0x5589c4,null));};exports[_0xe7ba('0x46')]=function(_0x48ae57,_0x271592){return db[_0xe7ba('0x2c')][_0xe7ba('0x46')](_0x48ae57[_0xe7ba('0x47')],{})[_0xe7ba('0x26')](respondWithResult(_0x271592,0xc9))[_0xe7ba('0x41')](handleError(_0x271592,null));};exports[_0xe7ba('0x25')]=function(_0x266ace,_0x272cb9){if(_0x266ace[_0xe7ba('0x47')]['id']){delete _0x266ace[_0xe7ba('0x47')]['id'];}return db['Cdr'][_0xe7ba('0x45')]({'where':{'id':_0x266ace[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x272cb9,null))[_0xe7ba('0x26')](saveUpdates(_0x266ace[_0xe7ba('0x47')],null))[_0xe7ba('0x26')](respondWithResult(_0x272cb9,null))['catch'](handleError(_0x272cb9,null));};exports[_0xe7ba('0x48')]=function(_0x3ee828,_0x520477){return db[_0xe7ba('0x2c')][_0xe7ba('0x45')]({'where':{'id':_0x3ee828[_0xe7ba('0x43')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0x520477,null))['then'](removeEntity(_0x520477,null))['catch'](handleError(_0x520477,null));};exports[_0xe7ba('0x49')]=function(_0x2cfdc3,_0x285743){return db['Cdr'][_0xe7ba('0x49')]()[_0xe7ba('0x26')](respondWithResult(_0x285743,null))[_0xe7ba('0x41')](handleError(_0x285743,null));}; \ No newline at end of file +var _0x1db9=['merge','VIRTUAL','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x217542,_0x15cc22){var _0x4bb071=function(_0x5f471b){while(--_0x5f471b){_0x217542['push'](_0x217542['shift']());}};_0x4bb071(++_0x15cc22);}(_0x1db9,0x176));var _0x91db=function(_0x188e16,_0x2c1952){_0x188e16=_0x188e16-0x0;var _0x3cdc6b=_0x1db9[_0x188e16];return _0x3cdc6b;};'use strict';var emlformat=require(_0x91db('0x0'));var rimraf=require(_0x91db('0x1'));var zipdir=require(_0x91db('0x2'));var jsonpatch=require(_0x91db('0x3'));var rp=require(_0x91db('0x4'));var moment=require(_0x91db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x91db('0x6'));var util=require(_0x91db('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x91db('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91db('0x9'));var squel=require(_0x91db('0xa'));var crypto=require(_0x91db('0xb'));var jsforce=require(_0x91db('0xc'));var deskjs=require(_0x91db('0xd'));var toCsv=require('to-csv');var querystring=require(_0x91db('0xe'));var Papa=require('papaparse');var Redis=require(_0x91db('0xf'));var authService=require(_0x91db('0x10'));var qs=require(_0x91db('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91db('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x91db('0x13'));var licenseUtil=require(_0x91db('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x540c48,_0x2b9b98){_0x2b9b98=_0x2b9b98||0xcc;return function(_0x329277){if(_0x329277){return _0x540c48[_0x91db('0x15')](_0x2b9b98);}return _0x540c48[_0x91db('0x16')](_0x2b9b98)[_0x91db('0x17')]();};}function respondWithResult(_0x4c3124,_0x371158){_0x371158=_0x371158||0xc8;return function(_0x285052){if(_0x285052){return _0x4c3124[_0x91db('0x16')](_0x371158)[_0x91db('0x18')](_0x285052);}};}function respondWithFilteredResult(_0x2df307,_0x33b39d){return function(_0x260b56){if(_0x260b56){var _0x143bc4=typeof _0x33b39d[_0x91db('0x19')]===_0x91db('0x1a')&&typeof _0x33b39d[_0x91db('0x1b')]===_0x91db('0x1a');var _0x5f5440=_0x260b56[_0x91db('0x1c')];var _0x23d125=_0x143bc4?0x0:_0x33b39d[_0x91db('0x19')];var _0x42e66c=_0x143bc4?_0x260b56[_0x91db('0x1c')]:_0x33b39d[_0x91db('0x19')]+_0x33b39d['limit'];var _0x4ae820;if(_0x42e66c>=_0x5f5440){_0x42e66c=_0x5f5440;_0x4ae820=0xc8;}else{_0x4ae820=0xce;}_0x2df307[_0x91db('0x16')](_0x4ae820);return _0x2df307[_0x91db('0x1d')](_0x91db('0x1e'),_0x23d125+'-'+_0x42e66c+'/'+_0x5f5440)[_0x91db('0x18')](_0x260b56);}return null;};}function patchUpdates(_0x50cf9c){return function(_0x168dea){try{jsonpatch[_0x91db('0x1f')](_0x168dea,_0x50cf9c,!![]);}catch(_0x6e3ca6){return BPromise[_0x91db('0x20')](_0x6e3ca6);}return _0x168dea[_0x91db('0x21')]();};}function saveUpdates(_0x31b96c,_0xaad1f6){return function(_0x8e323f){if(_0x8e323f){return _0x8e323f[_0x91db('0x22')](_0x31b96c)[_0x91db('0x23')](function(_0x554454){return _0x554454;});}return null;};}function removeEntity(_0x58774f,_0x134caa){return function(_0x2ac8d5){if(_0x2ac8d5){return _0x2ac8d5['destroy']()[_0x91db('0x23')](function(){_0x58774f[_0x91db('0x16')](0xcc)[_0x91db('0x17')]();});}};}function handleEntityNotFound(_0x6e3a9c,_0x3729d3){return function(_0x4e2a8f){if(!_0x4e2a8f){_0x6e3a9c['sendStatus'](0x194);}return _0x4e2a8f;};}function handleError(_0x42e53f,_0x2f0b86){_0x2f0b86=_0x2f0b86||0x1f4;return function(_0x329118){logger['error'](_0x329118[_0x91db('0x24')]);if(_0x329118[_0x91db('0x25')]){delete _0x329118[_0x91db('0x25')];}_0x42e53f[_0x91db('0x16')](_0x2f0b86)['send'](_0x329118);};}exports[_0x91db('0x26')]=function(_0x2a00d1,_0x1805ef){var _0x49c504={},_0x2ff6c8={},_0x69fdc2={'count':0x0,'rows':[]};var _0x2d3ebd=_[_0x91db('0x27')](db[_0x91db('0x28')][_0x91db('0x29')],function(_0x2e6a27){return{'name':_0x2e6a27[_0x91db('0x2a')],'type':_0x2e6a27[_0x91db('0x2b')][_0x91db('0x2c')]};});_0x2ff6c8[_0x91db('0x2d')]=_[_0x91db('0x27')](_0x2d3ebd,_0x91db('0x25'));_0x2ff6c8[_0x91db('0x2e')]=_['keys'](_0x2a00d1[_0x91db('0x2e')]);_0x2ff6c8[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],_0x2ff6c8[_0x91db('0x2e')]);_0x49c504['attributes']=_[_0x91db('0x30')](_0x2ff6c8[_0x91db('0x2d')],qs[_0x91db('0x31')](_0x2a00d1['query'][_0x91db('0x31')]));_0x49c504['attributes']=_0x49c504[_0x91db('0x32')][_0x91db('0x33')]?_0x49c504[_0x91db('0x32')]:_0x2ff6c8[_0x91db('0x2d')];if(!_0x2a00d1['query'][_0x91db('0x34')](_0x91db('0x35'))){_0x49c504[_0x91db('0x1b')]=qs['limit'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x1b')]);_0x49c504['offset']=qs[_0x91db('0x19')](_0x2a00d1[_0x91db('0x2e')]['offset']);}_0x49c504[_0x91db('0x36')]=qs['sort'](_0x2a00d1[_0x91db('0x2e')][_0x91db('0x37')]);_0x49c504['where']=qs['filters'](_['pick'](_0x2a00d1[_0x91db('0x2e')],_0x2ff6c8[_0x91db('0x2f')]),_0x2d3ebd);if(_0x2a00d1['query'][_0x91db('0x38')]){_0x49c504[_0x91db('0x39')]=_[_0x91db('0x3a')](_0x49c504[_0x91db('0x39')],{'$or':_[_0x91db('0x27')](_0x2d3ebd,function(_0x3cccc7){if(_0x3cccc7[_0x91db('0x2b')]!==_0x91db('0x3b')){var _0xcdc472={};_0xcdc472[_0x3cccc7[_0x91db('0x25')]]={'$like':'%'+_0x2a00d1[_0x91db('0x2e')]['filter']+'%'};return _0xcdc472;}})});}_0x49c504=_[_0x91db('0x3a')]({},_0x49c504,_0x2a00d1['options']);var _0x14de6d={'where':_0x49c504[_0x91db('0x39')]};return db['Cdr'][_0x91db('0x1c')](_0x14de6d)[_0x91db('0x23')](function(_0x16a7e9){_0x69fdc2[_0x91db('0x1c')]=_0x16a7e9;if(_0x2a00d1[_0x91db('0x2e')]['includeAll']){_0x49c504[_0x91db('0x3c')]=[{'all':!![]}];}return db[_0x91db('0x28')][_0x91db('0x3d')](_0x49c504);})['then'](function(_0x4733a4){_0x69fdc2[_0x91db('0x3e')]=_0x4733a4;return _0x69fdc2;})[_0x91db('0x23')](respondWithFilteredResult(_0x1805ef,_0x49c504))['catch'](handleError(_0x1805ef,null));};exports[_0x91db('0x3f')]=function(_0x2b7830,_0x29831c){var _0x3d73a7={'raw':!![],'where':{'id':_0x2b7830['params']['id']}},_0x3609e1={};_0x3609e1[_0x91db('0x2d')]=_['keys'](db[_0x91db('0x28')][_0x91db('0x29')]);_0x3609e1[_0x91db('0x2e')]=_[_0x91db('0x40')](_0x2b7830[_0x91db('0x2e')]);_0x3609e1[_0x91db('0x2f')]=_[_0x91db('0x30')](_0x3609e1[_0x91db('0x2d')],_0x3609e1[_0x91db('0x2e')]);_0x3d73a7[_0x91db('0x32')]=_[_0x91db('0x30')](_0x3609e1['model'],qs['fields'](_0x2b7830[_0x91db('0x2e')][_0x91db('0x31')]));_0x3d73a7[_0x91db('0x32')]=_0x3d73a7['attributes'][_0x91db('0x33')]?_0x3d73a7[_0x91db('0x32')]:_0x3609e1[_0x91db('0x2d')];if(_0x2b7830[_0x91db('0x2e')][_0x91db('0x41')]){_0x3d73a7['include']=[{'all':!![]}];}_0x3d73a7=_[_0x91db('0x3a')]({},_0x3d73a7,_0x2b7830['options']);return db[_0x91db('0x28')][_0x91db('0x42')](_0x3d73a7)[_0x91db('0x23')](handleEntityNotFound(_0x29831c,null))[_0x91db('0x23')](respondWithResult(_0x29831c,null))[_0x91db('0x43')](handleError(_0x29831c,null));};exports[_0x91db('0x44')]=function(_0x17f7b3,_0xd5a8fb){return db[_0x91db('0x28')]['create'](_0x17f7b3['body'],{})[_0x91db('0x23')](respondWithResult(_0xd5a8fb,0xc9))[_0x91db('0x43')](handleError(_0xd5a8fb,null));};exports[_0x91db('0x22')]=function(_0x410423,_0x27e224){if(_0x410423['body']['id']){delete _0x410423[_0x91db('0x45')]['id'];}return db[_0x91db('0x28')][_0x91db('0x42')]({'where':{'id':_0x410423[_0x91db('0x46')]['id']}})[_0x91db('0x23')](handleEntityNotFound(_0x27e224,null))['then'](saveUpdates(_0x410423[_0x91db('0x45')],null))[_0x91db('0x23')](respondWithResult(_0x27e224,null))[_0x91db('0x43')](handleError(_0x27e224,null));};exports[_0x91db('0x47')]=function(_0x50b269,_0x3d8dfb){return db['Cdr']['find']({'where':{'id':_0x50b269[_0x91db('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d8dfb,null))[_0x91db('0x23')](removeEntity(_0x3d8dfb,null))['catch'](handleError(_0x3d8dfb,null));};exports['describe']=function(_0x2c30ff,_0x371277){return db[_0x91db('0x28')]['describe']()[_0x91db('0x23')](respondWithResult(_0x371277,null))[_0x91db('0x43')](handleError(_0x371277,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2c81da1..29debde 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0xd9154f,_0xc8881d){var _0x865cd8=function(_0x296469){while(--_0x296469){_0xd9154f['push'](_0xd9154f['shift']());}};_0x865cd8(++_0xc8881d);}(_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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x1f8d14,_0x36070d){var _0x2d8830=function(_0x42ce94){while(--_0x42ce94){_0x1f8d14['push'](_0x1f8d14['shift']());}};_0x2d8830(++_0x36070d);}(_0x7a54,0x106));var _0x47a5=function(_0x42ea60,_0x127d2f){_0x42ea60=_0x42ea60-0x0;var _0x1053d1=_0x7a54[_0x42ea60];return _0x1053d1;};'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 cbf7b0e..5a8936e 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 _0x170b=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s'];(function(_0x54c33a,_0x17ad4e){var _0x2590fa=function(_0x8a1afb){while(--_0x8a1afb){_0x54c33a['push'](_0x54c33a['shift']());}};_0x2590fa(++_0x17ad4e);}(_0x170b,0x1e2));var _0xb170=function(_0x26ea61,_0x1b983c){_0x26ea61=_0x26ea61-0x0;var _0x1b89c4=_0x170b[_0x26ea61];return _0x1b89c4;};'use strict';var _=require(_0xb170('0x0'));var util=require(_0xb170('0x1'));var moment=require(_0xb170('0x2'));var BPromise=require(_0xb170('0x3'));var rs=require(_0xb170('0x4'));var fs=require('fs');var Redis=require(_0xb170('0x5'));var db=require(_0xb170('0x6'))['db'];var utils=require(_0xb170('0x7'));var logger=require(_0xb170('0x8'))(_0xb170('0x9'));var config=require(_0xb170('0xa'));var jayson=require(_0xb170('0xb'));var client=jayson[_0xb170('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f1f75,_0x2dc437,_0x1672fc){return new BPromise(function(_0x3e5362,_0x5a2573){return client['request'](_0x2f1f75,_0x1672fc)[_0xb170('0xd')](function(_0x196327){logger['info'](_0xb170('0xe'),_0x2dc437,_0xb170('0xf'));logger[_0xb170('0x10')](_0xb170('0x11'),_0x2dc437,_0xb170('0xf'),JSON[_0xb170('0x12')](_0x196327));if(_0x196327[_0xb170('0x13')]){if(_0x196327[_0xb170('0x13')][_0xb170('0x14')]===0x1f4){logger[_0xb170('0x13')](_0xb170('0xe'),_0x2dc437,_0x196327[_0xb170('0x13')][_0xb170('0x15')]);return _0x5a2573(_0x196327[_0xb170('0x13')]['message']);}logger['error'](_0xb170('0xe'),_0x2dc437,_0x196327[_0xb170('0x13')][_0xb170('0x15')]);return _0x3e5362(_0x196327['error'][_0xb170('0x15')]);}else{logger[_0xb170('0x16')](_0xb170('0xe'),_0x2dc437,_0xb170('0xf'));_0x3e5362(_0x196327[_0xb170('0x17')][_0xb170('0x15')]);}})[_0xb170('0x18')](function(_0x1041d4){logger[_0xb170('0x13')](_0xb170('0xe'),_0x2dc437,_0x1041d4);_0x5a2573(_0x1041d4);});});} \ No newline at end of file +var _0x08c6=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x22999d,_0xe112e8){var _0x22ccd4=function(_0x21426c){while(--_0x21426c){_0x22999d['push'](_0x22999d['shift']());}};_0x22ccd4(++_0xe112e8);}(_0x08c6,0x175));var _0x608c=function(_0x28aea5,_0x3bb12e){_0x28aea5=_0x28aea5-0x0;var _0x6a55f9=_0x08c6[_0x28aea5];return _0x6a55f9;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x608c('0x0'));var BPromise=require(_0x608c('0x1'));var rs=require(_0x608c('0x2'));var fs=require('fs');var Redis=require(_0x608c('0x3'));var db=require(_0x608c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x608c('0x5'))(_0x608c('0x6'));var config=require(_0x608c('0x7'));var jayson=require(_0x608c('0x8'));var client=jayson[_0x608c('0x9')][_0x608c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7ad40a,_0x6a7ea7,_0x24fb05){return new BPromise(function(_0x1b94d8,_0x30be48){return client['request'](_0x7ad40a,_0x24fb05)[_0x608c('0xb')](function(_0x92fb2f){logger[_0x608c('0xc')](_0x608c('0xd'),_0x6a7ea7,_0x608c('0xe'));logger[_0x608c('0xf')](_0x608c('0x10'),_0x6a7ea7,'request\x20sent',JSON[_0x608c('0x11')](_0x92fb2f));if(_0x92fb2f[_0x608c('0x12')]){if(_0x92fb2f[_0x608c('0x12')]['code']===0x1f4){logger[_0x608c('0x12')]('Cdr,\x20%s,\x20%s',_0x6a7ea7,_0x92fb2f[_0x608c('0x12')][_0x608c('0x13')]);return _0x30be48(_0x92fb2f[_0x608c('0x12')][_0x608c('0x13')]);}logger[_0x608c('0x12')]('Cdr,\x20%s,\x20%s',_0x6a7ea7,_0x92fb2f['error'][_0x608c('0x13')]);return _0x1b94d8(_0x92fb2f['error'][_0x608c('0x13')]);}else{logger[_0x608c('0xc')]('Cdr,\x20%s,\x20%s',_0x6a7ea7,'request\x20sent');_0x1b94d8(_0x92fb2f['result'][_0x608c('0x13')]);}})[_0x608c('0x14')](function(_0x2cb744){logger[_0x608c('0x12')](_0x608c('0xd'),_0x6a7ea7,_0x2cb744);_0x30be48(_0x2cb744);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index dc30edb..aa2795b 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(_0x4fde9a,_0x5d1eda){var _0x58f321=function(_0x278061){while(--_0x278061){_0x4fde9a['push'](_0x4fde9a['shift']());}};_0x58f321(++_0x5d1eda);}(_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(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 0077574..21ce19a 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 _0xa7e0=['sequelize','STRING','noop'];(function(_0x27c8f3,_0x35f6e8){var _0x4b8d62=function(_0x2261ef){while(--_0x2261ef){_0x27c8f3['push'](_0x27c8f3['shift']());}};_0x4b8d62(++_0x35f6e8);}(_0xa7e0,0x1e0));var _0x0a7e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa7e0[_0x30ae5e];return _0x1f2e93;};'use strict';var Sequelize=require(_0x0a7e('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0a7e('0x1')],'allowNull':![],'defaultValue':_0x0a7e('0x2')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0a7e('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x3c34=['exports','noop','TEXT','STRING','sequelize'];(function(_0x5d6935,_0x3e19e8){var _0x91d517=function(_0xc30ba9){while(--_0xc30ba9){_0x5d6935['push'](_0x5d6935['shift']());}};_0x91d517(++_0x3e19e8);}(_0x3c34,0x180));var _0x43c3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x3c34[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x43c3('0x0'));module[_0x43c3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x43c3('0x2')},'appdata':{'type':Sequelize[_0x43c3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x43c3('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 56ca651..e28e209 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 _0x0d74=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','save','update','then','destroy','error','stack','name','show','params','model','ChatApplication','rawAttributes','query','keys','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','request-promise','moment','util','path','sox','to-csv','squel','jsforce'];(function(_0x5bf79a,_0x2eaa1d){var _0x3ff10f=function(_0x48523){while(--_0x48523){_0x5bf79a['push'](_0x5bf79a['shift']());}};_0x3ff10f(++_0x2eaa1d);}(_0x0d74,0x146));var _0x40d7=function(_0x9f8eea,_0x4bcf8b){_0x9f8eea=_0x9f8eea-0x0;var _0x3b08b3=_0x0d74[_0x9f8eea];return _0x3b08b3;};'use strict';var emlformat=require(_0x40d7('0x0'));var rimraf=require(_0x40d7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x40d7('0x2'));var moment=require(_0x40d7('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x40d7('0x4'));var path=require(_0x40d7('0x5'));var sox=require(_0x40d7('0x6'));var csv=require(_0x40d7('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x40d7('0x8'));var crypto=require('crypto');var jsforce=require(_0x40d7('0x9'));var deskjs=require(_0x40d7('0xa'));var toCsv=require('to-csv');var querystring=require(_0x40d7('0xb'));var Papa=require(_0x40d7('0xc'));var Redis=require(_0x40d7('0xd'));var authService=require(_0x40d7('0xe'));var qs=require(_0x40d7('0xf'));var as=require(_0x40d7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x40d7('0x11'))(_0x40d7('0x12'));var utils=require(_0x40d7('0x13'));var config=require(_0x40d7('0x14'));var licenseUtil=require(_0x40d7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43f1d8,_0xa08fd6){_0xa08fd6=_0xa08fd6||0xcc;return function(_0x3723a4){if(_0x3723a4){return _0x43f1d8[_0x40d7('0x16')](_0xa08fd6);}return _0x43f1d8['status'](_0xa08fd6)[_0x40d7('0x17')]();};}function respondWithResult(_0x4cb402,_0x14c12b){_0x14c12b=_0x14c12b||0xc8;return function(_0x2acc5b){if(_0x2acc5b){return _0x4cb402[_0x40d7('0x18')](_0x14c12b)[_0x40d7('0x19')](_0x2acc5b);}};}function respondWithFilteredResult(_0x1acc2f,_0x67d691){return function(_0x473fea){if(_0x473fea){var _0x55a7e0=typeof _0x67d691['offset']==='undefined'&&typeof _0x67d691[_0x40d7('0x1a')]===_0x40d7('0x1b');var _0x486d75=_0x473fea['count'];var _0x120964=_0x55a7e0?0x0:_0x67d691['offset'];var _0x4ed97e=_0x55a7e0?_0x473fea[_0x40d7('0x1c')]:_0x67d691[_0x40d7('0x1d')]+_0x67d691[_0x40d7('0x1a')];var _0x44fa91;if(_0x4ed97e>=_0x486d75){_0x4ed97e=_0x486d75;_0x44fa91=0xc8;}else{_0x44fa91=0xce;}_0x1acc2f[_0x40d7('0x18')](_0x44fa91);return _0x1acc2f[_0x40d7('0x1e')](_0x40d7('0x1f'),_0x120964+'-'+_0x4ed97e+'/'+_0x486d75)[_0x40d7('0x19')](_0x473fea);}return null;};}function patchUpdates(_0x5eb3c1){return function(_0x4c47cf){try{jsonpatch['apply'](_0x4c47cf,_0x5eb3c1,!![]);}catch(_0x34ea1d){return BPromise['reject'](_0x34ea1d);}return _0x4c47cf[_0x40d7('0x20')]();};}function saveUpdates(_0x145422,_0x985914){return function(_0x1a441a){if(_0x1a441a){return _0x1a441a[_0x40d7('0x21')](_0x145422)[_0x40d7('0x22')](function(_0xfec685){return _0xfec685;});}return null;};}function removeEntity(_0x3ccae9,_0x51180d){return function(_0x1cb3b2){if(_0x1cb3b2){return _0x1cb3b2[_0x40d7('0x23')]()['then'](function(){_0x3ccae9[_0x40d7('0x18')](0xcc)[_0x40d7('0x17')]();});}};}function handleEntityNotFound(_0x38276c,_0x29c62b){return function(_0x528ab5){if(!_0x528ab5){_0x38276c['sendStatus'](0x194);}return _0x528ab5;};}function handleError(_0x4889df,_0x4e7d84){_0x4e7d84=_0x4e7d84||0x1f4;return function(_0x539985){logger[_0x40d7('0x24')](_0x539985[_0x40d7('0x25')]);if(_0x539985[_0x40d7('0x26')]){delete _0x539985[_0x40d7('0x26')];}_0x4889df['status'](_0x4e7d84)['send'](_0x539985);};}exports[_0x40d7('0x27')]=function(_0x2b5f11,_0x4503cc){var _0x532ed5={'raw':!![],'where':{'id':_0x2b5f11[_0x40d7('0x28')]['id']}},_0x4fdf53={};_0x4fdf53[_0x40d7('0x29')]=_['keys'](db[_0x40d7('0x2a')][_0x40d7('0x2b')]);_0x4fdf53[_0x40d7('0x2c')]=_[_0x40d7('0x2d')](_0x2b5f11['query']);_0x4fdf53['filters']=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],_0x4fdf53[_0x40d7('0x2c')]);_0x532ed5[_0x40d7('0x2f')]=_[_0x40d7('0x2e')](_0x4fdf53[_0x40d7('0x29')],qs[_0x40d7('0x30')](_0x2b5f11['query'][_0x40d7('0x30')]));_0x532ed5[_0x40d7('0x2f')]=_0x532ed5[_0x40d7('0x2f')]['length']?_0x532ed5[_0x40d7('0x2f')]:_0x4fdf53[_0x40d7('0x29')];if(_0x2b5f11[_0x40d7('0x2c')][_0x40d7('0x31')]){_0x532ed5[_0x40d7('0x32')]=[{'all':!![]}];}_0x532ed5=_[_0x40d7('0x33')]({},_0x532ed5,_0x2b5f11[_0x40d7('0x34')]);return db['ChatApplication'][_0x40d7('0x35')](_0x532ed5)[_0x40d7('0x22')](handleEntityNotFound(_0x4503cc,null))[_0x40d7('0x22')](respondWithResult(_0x4503cc,null))[_0x40d7('0x36')](handleError(_0x4503cc,null));};exports[_0x40d7('0x21')]=function(_0x2d1ee6,_0x1e6f08){if(_0x2d1ee6[_0x40d7('0x37')]['id']){delete _0x2d1ee6['body']['id'];}return db['ChatApplication'][_0x40d7('0x35')]({'where':{'id':_0x2d1ee6[_0x40d7('0x28')]['id']}})['then'](handleEntityNotFound(_0x1e6f08,null))['then'](saveUpdates(_0x2d1ee6['body'],null))[_0x40d7('0x22')](respondWithResult(_0x1e6f08,null))['catch'](handleError(_0x1e6f08,null));};exports[_0x40d7('0x23')]=function(_0x56b17c,_0x798ba7){return db[_0x40d7('0x2a')][_0x40d7('0x35')]({'where':{'id':_0x56b17c[_0x40d7('0x28')]['id']}})[_0x40d7('0x22')](handleEntityNotFound(_0x798ba7,null))['then'](removeEntity(_0x798ba7,null))[_0x40d7('0x36')](handleError(_0x798ba7,null));}; \ No newline at end of file +var _0xf151=['include','merge','options','catch','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','show','params','model','ChatApplication','query','filters','intersection','attributes','fields','length','includeAll'];(function(_0x82140,_0x3a9d87){var _0x2b15a6=function(_0x2b565e){while(--_0x2b565e){_0x82140['push'](_0x82140['shift']());}};_0x2b15a6(++_0x3a9d87);}(_0xf151,0xab));var _0x1f15=function(_0x92409b,_0x55269e){_0x92409b=_0x92409b-0x0;var _0x591e10=_0xf151[_0x92409b];return _0x591e10;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1f15('0x0'));var jsonpatch=require(_0x1f15('0x1'));var rp=require(_0x1f15('0x2'));var moment=require(_0x1f15('0x3'));var BPromise=require(_0x1f15('0x4'));var Mustache=require(_0x1f15('0x5'));var util=require(_0x1f15('0x6'));var path=require(_0x1f15('0x7'));var sox=require('sox');var csv=require(_0x1f15('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1f15('0x9'));var crypto=require(_0x1f15('0xa'));var jsforce=require(_0x1f15('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1f15('0x8'));var querystring=require(_0x1f15('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1f15('0xd'));var qs=require(_0x1f15('0xe'));var as=require(_0x1f15('0xf'));var hardwareService=require(_0x1f15('0x10'));var logger=require('../../config/logger')(_0x1f15('0x11'));var utils=require(_0x1f15('0x12'));var config=require(_0x1f15('0x13'));var licenseUtil=require(_0x1f15('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5823c3,_0x340109){_0x340109=_0x340109||0xcc;return function(_0x94e8e4){if(_0x94e8e4){return _0x5823c3[_0x1f15('0x15')](_0x340109);}return _0x5823c3[_0x1f15('0x16')](_0x340109)[_0x1f15('0x17')]();};}function respondWithResult(_0x2ed0b8,_0x5a9f14){_0x5a9f14=_0x5a9f14||0xc8;return function(_0xfafc5c){if(_0xfafc5c){return _0x2ed0b8[_0x1f15('0x16')](_0x5a9f14)[_0x1f15('0x18')](_0xfafc5c);}};}function respondWithFilteredResult(_0x387c36,_0x48ef33){return function(_0x428133){if(_0x428133){var _0x5baa48=typeof _0x48ef33[_0x1f15('0x19')]===_0x1f15('0x1a')&&typeof _0x48ef33[_0x1f15('0x1b')]==='undefined';var _0x586a7d=_0x428133[_0x1f15('0x1c')];var _0xdf70ed=_0x5baa48?0x0:_0x48ef33[_0x1f15('0x19')];var _0x5529d7=_0x5baa48?_0x428133[_0x1f15('0x1c')]:_0x48ef33['offset']+_0x48ef33[_0x1f15('0x1b')];var _0x439ef1;if(_0x5529d7>=_0x586a7d){_0x5529d7=_0x586a7d;_0x439ef1=0xc8;}else{_0x439ef1=0xce;}_0x387c36['status'](_0x439ef1);return _0x387c36['set'](_0x1f15('0x1d'),_0xdf70ed+'-'+_0x5529d7+'/'+_0x586a7d)['json'](_0x428133);}return null;};}function patchUpdates(_0x4542a8){return function(_0x2916b5){try{jsonpatch[_0x1f15('0x1e')](_0x2916b5,_0x4542a8,!![]);}catch(_0x3b1416){return BPromise[_0x1f15('0x1f')](_0x3b1416);}return _0x2916b5[_0x1f15('0x20')]();};}function saveUpdates(_0x2bdd64,_0x588c78){return function(_0x4888c8){if(_0x4888c8){return _0x4888c8[_0x1f15('0x21')](_0x2bdd64)[_0x1f15('0x22')](function(_0x4fa0f4){return _0x4fa0f4;});}return null;};}function removeEntity(_0x57cb54,_0x303d93){return function(_0x49fe69){if(_0x49fe69){return _0x49fe69[_0x1f15('0x23')]()['then'](function(){_0x57cb54[_0x1f15('0x16')](0xcc)[_0x1f15('0x17')]();});}};}function handleEntityNotFound(_0x41559e,_0x46e8a7){return function(_0x262121){if(!_0x262121){_0x41559e[_0x1f15('0x15')](0x194);}return _0x262121;};}function handleError(_0x4305c0,_0x317bfc){_0x317bfc=_0x317bfc||0x1f4;return function(_0x42e5e3){logger['error'](_0x42e5e3[_0x1f15('0x24')]);if(_0x42e5e3['name']){delete _0x42e5e3[_0x1f15('0x25')];}_0x4305c0[_0x1f15('0x16')](_0x317bfc)['send'](_0x42e5e3);};}exports[_0x1f15('0x26')]=function(_0x610939,_0x1a5a14){var _0x4be862={'raw':!![],'where':{'id':_0x610939[_0x1f15('0x27')]['id']}},_0x38ce55={};_0x38ce55[_0x1f15('0x28')]=_['keys'](db[_0x1f15('0x29')]['rawAttributes']);_0x38ce55[_0x1f15('0x2a')]=_['keys'](_0x610939[_0x1f15('0x2a')]);_0x38ce55[_0x1f15('0x2b')]=_[_0x1f15('0x2c')](_0x38ce55[_0x1f15('0x28')],_0x38ce55[_0x1f15('0x2a')]);_0x4be862[_0x1f15('0x2d')]=_[_0x1f15('0x2c')](_0x38ce55[_0x1f15('0x28')],qs['fields'](_0x610939['query'][_0x1f15('0x2e')]));_0x4be862[_0x1f15('0x2d')]=_0x4be862[_0x1f15('0x2d')][_0x1f15('0x2f')]?_0x4be862[_0x1f15('0x2d')]:_0x38ce55[_0x1f15('0x28')];if(_0x610939['query'][_0x1f15('0x30')]){_0x4be862[_0x1f15('0x31')]=[{'all':!![]}];}_0x4be862=_[_0x1f15('0x32')]({},_0x4be862,_0x610939[_0x1f15('0x33')]);return db['ChatApplication']['find'](_0x4be862)['then'](handleEntityNotFound(_0x1a5a14,null))['then'](respondWithResult(_0x1a5a14,null))[_0x1f15('0x34')](handleError(_0x1a5a14,null));};exports[_0x1f15('0x21')]=function(_0x33ba93,_0x23c1d9){if(_0x33ba93['body']['id']){delete _0x33ba93[_0x1f15('0x35')]['id'];}return db['ChatApplication'][_0x1f15('0x36')]({'where':{'id':_0x33ba93[_0x1f15('0x27')]['id']}})[_0x1f15('0x22')](handleEntityNotFound(_0x23c1d9,null))[_0x1f15('0x22')](saveUpdates(_0x33ba93[_0x1f15('0x35')],null))[_0x1f15('0x22')](respondWithResult(_0x23c1d9,null))['catch'](handleError(_0x23c1d9,null));};exports[_0x1f15('0x23')]=function(_0x24ea8f,_0x5a61a7){return db[_0x1f15('0x29')][_0x1f15('0x36')]({'where':{'id':_0x24ea8f[_0x1f15('0x27')]['id']}})['then'](handleEntityNotFound(_0x5a61a7,null))[_0x1f15('0x22')](removeEntity(_0x5a61a7,null))[_0x1f15('0x34')](handleError(_0x5a61a7,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index f0ae709..80ebcd3 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 _0xf109=['../../config/logger','request-promise','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xf109,0xce));var _0x9f10=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xf109[_0x26f702];return _0x11417d;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var logger=require(_0x9f10('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9f10('0x3'));var fs=require('fs');var path=require(_0x9f10('0x4'));var rimraf=require(_0x9f10('0x5'));var config=require(_0x9f10('0x6'));var attributes=require(_0x9f10('0x7'));module[_0x9f10('0x8')]=function(_0x408fe8,_0xd3137b){return _0x408fe8[_0x9f10('0x9')](_0x9f10('0xa'),attributes,{'tableName':_0x9f10('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x9f10('0xc')});}; \ No newline at end of file +var _0x3667=['request-promise','path','../../config/environment','./chatApplication.attributes','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x2856ac,_0xc869b1){var _0x5ac549=function(_0x207332){while(--_0x207332){_0x2856ac['push'](_0x2856ac['shift']());}};_0x5ac549(++_0xc869b1);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var moment=require(_0x7366('0x4'));var BPromise=require('bluebird');var rp=require(_0x7366('0x5'));var fs=require('fs');var path=require(_0x7366('0x6'));var rimraf=require('rimraf');var config=require(_0x7366('0x7'));var attributes=require(_0x7366('0x8'));module[_0x7366('0x9')]=function(_0x1c0cf4,_0x101e3d){return _0x1c0cf4['define'](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7366('0xc'),'collate':_0x7366('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index fe66dda..56e24cd 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 _0xd686=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','util'];(function(_0x4715d2,_0x3371b2){var _0x141811=function(_0x520bc6){while(--_0x520bc6){_0x4715d2['push'](_0x4715d2['shift']());}};_0x141811(++_0x3371b2);}(_0xd686,0x1cd));var _0x6d68=function(_0x31b5a5,_0x44376a){_0x31b5a5=_0x31b5a5-0x0;var _0x364cc9=_0xd686[_0x31b5a5];return _0x364cc9;};'use strict';var _=require('lodash');var util=require(_0x6d68('0x0'));var moment=require(_0x6d68('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d68('0x2'));var db=require(_0x6d68('0x3'))['db'];var utils=require(_0x6d68('0x4'));var logger=require(_0x6d68('0x5'))(_0x6d68('0x6'));var config=require(_0x6d68('0x7'));var jayson=require(_0x6d68('0x8'));var client=jayson[_0x6d68('0x9')][_0x6d68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd86128,_0x2a453f,_0xb71e58){return new BPromise(function(_0x429455,_0x5ae778){return client[_0x6d68('0xb')](_0xd86128,_0xb71e58)[_0x6d68('0xc')](function(_0x5d4daf){logger[_0x6d68('0xd')](_0x6d68('0xe'),_0x2a453f,'request\x20sent');logger[_0x6d68('0xf')](_0x6d68('0x10'),_0x2a453f,'request\x20sent',JSON[_0x6d68('0x11')](_0x5d4daf));if(_0x5d4daf['error']){if(_0x5d4daf[_0x6d68('0x12')]['code']===0x1f4){logger[_0x6d68('0x12')](_0x6d68('0xe'),_0x2a453f,_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);return _0x5ae778(_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x2a453f,_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);return _0x429455(_0x5d4daf[_0x6d68('0x12')][_0x6d68('0x13')]);}else{logger[_0x6d68('0xd')](_0x6d68('0xe'),_0x2a453f,_0x6d68('0x14'));_0x429455(_0x5d4daf[_0x6d68('0x15')][_0x6d68('0x13')]);}})['catch'](function(_0x32c3f0){logger[_0x6d68('0x12')](_0x6d68('0xe'),_0x2a453f,_0x32c3f0);_0x5ae778(_0x32c3f0);});});} \ No newline at end of file +var _0x2abc=['../../config/environment','jayson/promise','client','http','request','then','info','ChatApplication,\x20%s,\x20%s','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x3abd88,_0x523afc){var _0xb71ddd=function(_0x3ad5eb){while(--_0x3ad5eb){_0x3abd88['push'](_0x3abd88['shift']());}};_0xb71ddd(++_0x523afc);}(_0x2abc,0xec));var _0xc2ab=function(_0x5b021d,_0x20ca0c){_0x5b021d=_0x5b021d-0x0;var _0x450187=_0x2abc[_0x5b021d];return _0x450187;};'use strict';var _=require(_0xc2ab('0x0'));var util=require(_0xc2ab('0x1'));var moment=require(_0xc2ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2ab('0x3'));var db=require(_0xc2ab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc2ab('0x5'))('rpc');var config=require(_0xc2ab('0x6'));var jayson=require(_0xc2ab('0x7'));var client=jayson[_0xc2ab('0x8')][_0xc2ab('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x32a37c,_0x420b75,_0x1aa359){return new BPromise(function(_0x36c2d4,_0x1884c6){return client[_0xc2ab('0xa')](_0x32a37c,_0x1aa359)[_0xc2ab('0xb')](function(_0xcdbfbb){logger[_0xc2ab('0xc')](_0xc2ab('0xd'),_0x420b75,'request\x20sent');logger['debug'](_0xc2ab('0xe'),_0x420b75,'request\x20sent',JSON[_0xc2ab('0xf')](_0xcdbfbb));if(_0xcdbfbb['error']){if(_0xcdbfbb[_0xc2ab('0x10')][_0xc2ab('0x11')]===0x1f4){logger[_0xc2ab('0x10')]('ChatApplication,\x20%s,\x20%s',_0x420b75,_0xcdbfbb[_0xc2ab('0x10')][_0xc2ab('0x12')]);return _0x1884c6(_0xcdbfbb[_0xc2ab('0x10')][_0xc2ab('0x12')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x420b75,_0xcdbfbb[_0xc2ab('0x10')][_0xc2ab('0x12')]);return _0x36c2d4(_0xcdbfbb[_0xc2ab('0x10')][_0xc2ab('0x12')]);}else{logger[_0xc2ab('0xc')](_0xc2ab('0xd'),_0x420b75,_0xc2ab('0x13'));_0x36c2d4(_0xcdbfbb[_0xc2ab('0x14')][_0xc2ab('0x12')]);}})[_0xc2ab('0x15')](function(_0x25c840){logger[_0xc2ab('0x10')](_0xc2ab('0xd'),_0x420b75,_0x25c840);_0x1884c6(_0x25c840);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index ef22fe8..90851b8 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 _0x8f5f=['delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','put'];(function(_0xe4fa3d,_0x405634){var _0x150d66=function(_0x439ae7){while(--_0x439ae7){_0xe4fa3d['push'](_0xe4fa3d['shift']());}};_0x150d66(++_0x405634);}(_0x8f5f,0xc5));var _0xf8f5=function(_0x46800d,_0x588500){_0x46800d=_0x46800d-0x0;var _0x3824cd=_0x8f5f[_0x46800d];return _0x3824cd;};'use strict';var multer=require(_0xf8f5('0x0'));var util=require(_0xf8f5('0x1'));var path=require(_0xf8f5('0x2'));var timeout=require(_0xf8f5('0x3'));var express=require(_0xf8f5('0x4'));var router=express[_0xf8f5('0x5')]();var fs_extra=require(_0xf8f5('0x6'));var auth=require(_0xf8f5('0x7'));var interaction=require(_0xf8f5('0x8'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xf8f5('0x9')](_0xf8f5('0xa'),auth[_0xf8f5('0xb')](),controller['show']);router[_0xf8f5('0xc')](_0xf8f5('0xa'),auth[_0xf8f5('0xb')](),controller['update']);router[_0xf8f5('0xd')](_0xf8f5('0xa'),auth[_0xf8f5('0xb')](),controller['destroy']);module[_0xf8f5('0xe')]=router; \ No newline at end of file +var _0x616c=['show','put','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x4f2a68,_0x309542){var _0x474071=function(_0xb94b16){while(--_0xb94b16){_0x4f2a68['push'](_0x4f2a68['shift']());}};_0x474071(++_0x309542);}(_0x616c,0x1d0));var _0xc616=function(_0x13530c,_0x471a08){_0x13530c=_0x13530c-0x0;var _0x2b558d=_0x616c[_0x13530c];return _0x2b558d;};'use strict';var multer=require(_0xc616('0x0'));var util=require(_0xc616('0x1'));var path=require(_0xc616('0x2'));var timeout=require(_0xc616('0x3'));var express=require(_0xc616('0x4'));var router=express[_0xc616('0x5')]();var fs_extra=require(_0xc616('0x6'));var auth=require(_0xc616('0x7'));var interaction=require(_0xc616('0x8'));var config=require(_0xc616('0x9'));var controller=require('./chatApplication.controller');router[_0xc616('0xa')]('/:id',auth[_0xc616('0xb')](),controller[_0xc616('0xc')]);router[_0xc616('0xd')](_0xc616('0xe'),auth[_0xc616('0xb')](),controller[_0xc616('0xf')]);router['delete'](_0xc616('0xe'),auth[_0xc616('0xb')](),controller[_0xc616('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index e7a7934..7316e8c 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 _0xdbce=['STRING','BOOLEAN','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdbce,0x1f1));var _0xedbc=function(_0xdd2bbd,_0xaf1161){_0xdd2bbd=_0xdd2bbd-0x0;var _0x449fc8=_0xdbce[_0xdd2bbd];return _0x449fc8;};'use strict';var Sequelize=require(_0xedbc('0x0'));module['exports']={'name':{'type':Sequelize[_0xedbc('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xedbc('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x0984=['exports','STRING','BOOLEAN','sequelize'];(function(_0x55d694,_0x2bfe21){var _0x102ca0=function(_0x40294f){while(--_0x40294f){_0x55d694['push'](_0x55d694['shift']());}};_0x102ca0(++_0x2bfe21);}(_0x0984,0xff));var _0x4098=function(_0x306ee6,_0x16febb){_0x306ee6=_0x306ee6-0x0;var _0x47ab12=_0x0984[_0x306ee6];return _0x47ab12;};'use strict';var Sequelize=require(_0x4098('0x0'));module[_0x4098('0x1')]={'name':{'type':Sequelize[_0x4098('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x4098('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 e13caa6..bfbd01e 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 _0x7363=['body','update','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','options','removeMembers','addMessage','ChatGroupId','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','reject','then','destroy','name','send','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ChatGroup','count','includeAll','include','findAll','catch','show','params','intersection','find','create'];(function(_0x34eb1d,_0x116a4d){var _0x53266b=function(_0x2c52aa){while(--_0x2c52aa){_0x34eb1d['push'](_0x34eb1d['shift']());}};_0x53266b(++_0x116a4d);}(_0x7363,0x131));var _0x3736=function(_0x3a8e15,_0x38e90d){_0x3a8e15=_0x3a8e15-0x0;var _0x4de790=_0x7363[_0x3a8e15];return _0x4de790;};'use strict';var emlformat=require(_0x3736('0x0'));var rimraf=require(_0x3736('0x1'));var zipdir=require(_0x3736('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3736('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3736('0x4'));var util=require(_0x3736('0x5'));var path=require(_0x3736('0x6'));var sox=require(_0x3736('0x7'));var csv=require(_0x3736('0x8'));var ejs=require(_0x3736('0x9'));var fs=require('fs');var fs_extra=require(_0x3736('0xa'));var _=require(_0x3736('0xb'));var squel=require(_0x3736('0xc'));var crypto=require(_0x3736('0xd'));var jsforce=require(_0x3736('0xe'));var deskjs=require(_0x3736('0xf'));var toCsv=require(_0x3736('0x8'));var querystring=require(_0x3736('0x10'));var Papa=require(_0x3736('0x11'));var Redis=require(_0x3736('0x12'));var authService=require(_0x3736('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3736('0x14'));var logger=require(_0x3736('0x15'))('api');var utils=require(_0x3736('0x16'));var config=require(_0x3736('0x17'));var licenseUtil=require(_0x3736('0x18'));var db=require(_0x3736('0x19'))['db'];config[_0x3736('0x1a')]=_['defaults'](config[_0x3736('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x3736('0x1b'))(new Redis(config[_0x3736('0x1a')]));require('./chatGroup.socket')[_0x3736('0x1c')](socket);function respondWithStatusCode(_0x7de163,_0x2c2b2b){_0x2c2b2b=_0x2c2b2b||0xcc;return function(_0x2982ef){if(_0x2982ef){return _0x7de163[_0x3736('0x1d')](_0x2c2b2b);}return _0x7de163[_0x3736('0x1e')](_0x2c2b2b)[_0x3736('0x1f')]();};}function respondWithResult(_0x59a0f3,_0x5b6dbf){_0x5b6dbf=_0x5b6dbf||0xc8;return function(_0x35f3c3){if(_0x35f3c3){return _0x59a0f3[_0x3736('0x1e')](_0x5b6dbf)[_0x3736('0x20')](_0x35f3c3);}};}function respondWithFilteredResult(_0x831bf6,_0x3c0403){return function(_0x41890b){if(_0x41890b){var _0x3fb742=typeof _0x3c0403[_0x3736('0x21')]===_0x3736('0x22')&&typeof _0x3c0403[_0x3736('0x23')]===_0x3736('0x22');var _0x3c6a48=_0x41890b['count'];var _0xadb50a=_0x3fb742?0x0:_0x3c0403[_0x3736('0x21')];var _0x3b80b0=_0x3fb742?_0x41890b['count']:_0x3c0403[_0x3736('0x21')]+_0x3c0403['limit'];var _0x48b690;if(_0x3b80b0>=_0x3c6a48){_0x3b80b0=_0x3c6a48;_0x48b690=0xc8;}else{_0x48b690=0xce;}_0x831bf6[_0x3736('0x1e')](_0x48b690);return _0x831bf6[_0x3736('0x24')](_0x3736('0x25'),_0xadb50a+'-'+_0x3b80b0+'/'+_0x3c6a48)[_0x3736('0x20')](_0x41890b);}return null;};}function patchUpdates(_0x19e1e6){return function(_0x8651e4){try{jsonpatch['apply'](_0x8651e4,_0x19e1e6,!![]);}catch(_0x79cb3a){return BPromise[_0x3736('0x26')](_0x79cb3a);}return _0x8651e4['save']();};}function saveUpdates(_0x765ac6,_0xe06804){return function(_0x17b09d){if(_0x17b09d){return _0x17b09d['update'](_0x765ac6)[_0x3736('0x27')](function(_0x541c6f){return _0x541c6f;});}return null;};}function removeEntity(_0x4a9fca,_0x280a6e){return function(_0x54675c){if(_0x54675c){return _0x54675c[_0x3736('0x28')]()[_0x3736('0x27')](function(){_0x4a9fca[_0x3736('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3620aa,_0x3ffea0){return function(_0x5a59cb){if(!_0x5a59cb){_0x3620aa[_0x3736('0x1d')](0x194);}return _0x5a59cb;};}function handleError(_0x3f7b52,_0x4a5be1){_0x4a5be1=_0x4a5be1||0x1f4;return function(_0x5bf4fb){logger['error'](_0x5bf4fb['stack']);if(_0x5bf4fb[_0x3736('0x29')]){delete _0x5bf4fb[_0x3736('0x29')];}_0x3f7b52[_0x3736('0x1e')](_0x4a5be1)[_0x3736('0x2a')](_0x5bf4fb);};}exports['index']=function(_0x3665e9,_0x995f3f){var _0x59c0c6={},_0x3fd5c0={},_0x7a0c7={'count':0x0,'rows':[]};var _0x4c8414=_['map'](db['ChatGroup'][_0x3736('0x2b')],function(_0x2ec704){return{'name':_0x2ec704[_0x3736('0x2c')],'type':_0x2ec704[_0x3736('0x2d')][_0x3736('0x2e')]};});_0x3fd5c0[_0x3736('0x2f')]=_[_0x3736('0x30')](_0x4c8414,'name');_0x3fd5c0['query']=_[_0x3736('0x31')](_0x3665e9[_0x3736('0x32')]);_0x3fd5c0[_0x3736('0x33')]=_['intersection'](_0x3fd5c0[_0x3736('0x2f')],_0x3fd5c0[_0x3736('0x32')]);_0x59c0c6[_0x3736('0x34')]=_['intersection'](_0x3fd5c0[_0x3736('0x2f')],qs[_0x3736('0x35')](_0x3665e9['query']['fields']));_0x59c0c6['attributes']=_0x59c0c6[_0x3736('0x34')][_0x3736('0x36')]?_0x59c0c6[_0x3736('0x34')]:_0x3fd5c0[_0x3736('0x2f')];if(!_0x3665e9[_0x3736('0x32')][_0x3736('0x37')](_0x3736('0x38'))){_0x59c0c6[_0x3736('0x23')]=qs['limit'](_0x3665e9['query'][_0x3736('0x23')]);_0x59c0c6[_0x3736('0x21')]=qs['offset'](_0x3665e9['query']['offset']);}_0x59c0c6[_0x3736('0x39')]=qs['sort'](_0x3665e9[_0x3736('0x32')][_0x3736('0x3a')]);_0x59c0c6[_0x3736('0x3b')]=qs[_0x3736('0x33')](_[_0x3736('0x3c')](_0x3665e9[_0x3736('0x32')],_0x3fd5c0[_0x3736('0x33')]),_0x4c8414);if(_0x3665e9['query'][_0x3736('0x3d')]){_0x59c0c6['where']=_[_0x3736('0x3e')](_0x59c0c6[_0x3736('0x3b')],{'$or':_[_0x3736('0x30')](_0x4c8414,function(_0x4db312){if(_0x4db312[_0x3736('0x2d')]!==_0x3736('0x3f')){var _0x6194da={};_0x6194da[_0x4db312[_0x3736('0x29')]]={'$like':'%'+_0x3665e9[_0x3736('0x32')][_0x3736('0x3d')]+'%'};return _0x6194da;}})});}_0x59c0c6=_[_0x3736('0x3e')]({},_0x59c0c6,_0x3665e9['options']);var _0x4c1053={'where':_0x59c0c6[_0x3736('0x3b')]};return db[_0x3736('0x40')]['count'](_0x4c1053)[_0x3736('0x27')](function(_0x22d192){_0x7a0c7[_0x3736('0x41')]=_0x22d192;if(_0x3665e9['query'][_0x3736('0x42')]){_0x59c0c6[_0x3736('0x43')]=[{'all':!![]}];}return db[_0x3736('0x40')][_0x3736('0x44')](_0x59c0c6);})[_0x3736('0x27')](function(_0x39fff7){_0x7a0c7['rows']=_0x39fff7;return _0x7a0c7;})[_0x3736('0x27')](respondWithFilteredResult(_0x995f3f,_0x59c0c6))[_0x3736('0x45')](handleError(_0x995f3f,null));};exports[_0x3736('0x46')]=function(_0x24bc77,_0x33dec4){var _0x4d031b={'raw':!![],'where':{'id':_0x24bc77[_0x3736('0x47')]['id']}},_0x206f00={};_0x206f00[_0x3736('0x2f')]=_[_0x3736('0x31')](db[_0x3736('0x40')][_0x3736('0x2b')]);_0x206f00[_0x3736('0x32')]=_[_0x3736('0x31')](_0x24bc77['query']);_0x206f00['filters']=_[_0x3736('0x48')](_0x206f00[_0x3736('0x2f')],_0x206f00['query']);_0x4d031b['attributes']=_[_0x3736('0x48')](_0x206f00[_0x3736('0x2f')],qs[_0x3736('0x35')](_0x24bc77['query'][_0x3736('0x35')]));_0x4d031b[_0x3736('0x34')]=_0x4d031b[_0x3736('0x34')][_0x3736('0x36')]?_0x4d031b[_0x3736('0x34')]:_0x206f00[_0x3736('0x2f')];if(_0x24bc77['query'][_0x3736('0x42')]){_0x4d031b[_0x3736('0x43')]=[{'all':!![]}];}_0x4d031b=_['merge']({},_0x4d031b,_0x24bc77['options']);return db[_0x3736('0x40')][_0x3736('0x49')](_0x4d031b)[_0x3736('0x27')](handleEntityNotFound(_0x33dec4,null))[_0x3736('0x27')](respondWithResult(_0x33dec4,null))[_0x3736('0x45')](handleError(_0x33dec4,null));};exports[_0x3736('0x4a')]=function(_0x4e68d2,_0x349239){return db[_0x3736('0x40')][_0x3736('0x4a')](_0x4e68d2[_0x3736('0x4b')],{})['then'](respondWithResult(_0x349239,0xc9))['catch'](handleError(_0x349239,null));};exports[_0x3736('0x4c')]=function(_0x53fc39,_0x85ee83){if(_0x53fc39[_0x3736('0x4b')]['id']){delete _0x53fc39[_0x3736('0x4b')]['id'];}return db[_0x3736('0x40')][_0x3736('0x49')]({'where':{'id':_0x53fc39[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x85ee83,null))[_0x3736('0x27')](saveUpdates(_0x53fc39[_0x3736('0x4b')],null))[_0x3736('0x27')](respondWithResult(_0x85ee83,null))['catch'](handleError(_0x85ee83,null));};exports['destroy']=function(_0xb66f9d,_0x257053){return db['ChatGroup'][_0x3736('0x49')]({'where':{'id':_0xb66f9d['params']['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x257053,null))[_0x3736('0x27')](removeEntity(_0x257053,null))[_0x3736('0x45')](handleError(_0x257053,null));};exports['describe']=function(_0x2f41cb,_0x4dd9e6){return db[_0x3736('0x40')]['describe']()[_0x3736('0x27')](respondWithResult(_0x4dd9e6,null))[_0x3736('0x45')](handleError(_0x4dd9e6,null));};exports[_0x3736('0x4d')]=function(_0x2d4640,_0x31f83f,_0x46cb38){return db[_0x3736('0x4e')][_0x3736('0x41')]({'where':{'ChatGroupId':_0x2d4640[_0x3736('0x47')]['id'],'ToId':_0x2d4640[_0x3736('0x4f')]['id'],'read':![]}})['then'](function(_0x54dcca){return{'id':_[_0x3736('0x50')](_0x2d4640[_0x3736('0x47')]['id']),'count':_0x54dcca};})[_0x3736('0x27')](respondWithResult(_0x31f83f,null))[_0x3736('0x45')](handleError(_0x31f83f,null));};exports[_0x3736('0x51')]=function(_0x2932a3,_0x5a31f7,_0xeeda29){return db[_0x3736('0x40')]['find']({'where':{'id':_0x2932a3[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x5a31f7,null))['then'](function(_0x5de494){if(_0x5de494){return _0x5de494[_0x3736('0x51')](_0x2932a3['body'][_0x3736('0x52')],_[_0x3736('0x53')](_0x2932a3[_0x3736('0x4b')],[_0x3736('0x52'),'id'])||{});}})['then'](respondWithResult(_0x5a31f7,null))[_0x3736('0x45')](handleError(_0x5a31f7,null));};exports[_0x3736('0x54')]=function(_0x4207bb,_0x13de7c,_0x2fe073){var _0x580276={};var _0x45623b={};var _0x3919f6;var _0x55e72f;return db[_0x3736('0x40')][_0x3736('0x55')]({'where':{'id':_0x4207bb[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x13de7c,null))[_0x3736('0x27')](function(_0x48b31a){if(_0x48b31a){_0x3919f6=_0x48b31a;_0x45623b[_0x3736('0x2f')]=_['keys'](db[_0x3736('0x56')]['rawAttributes']);_0x45623b['query']=_['keys'](_0x4207bb['query']);_0x45623b[_0x3736('0x33')]=_['intersection'](_0x45623b['model'],_0x45623b[_0x3736('0x32')]);_0x580276[_0x3736('0x34')]=_[_0x3736('0x48')](_0x45623b[_0x3736('0x2f')],qs['fields'](_0x4207bb[_0x3736('0x32')][_0x3736('0x35')]));_0x580276[_0x3736('0x34')]=_0x580276[_0x3736('0x34')][_0x3736('0x36')]?_0x580276['attributes']:_0x45623b[_0x3736('0x2f')];_0x580276[_0x3736('0x39')]=qs[_0x3736('0x3a')](_0x4207bb[_0x3736('0x32')][_0x3736('0x3a')]);_0x580276['where']=qs[_0x3736('0x33')](_[_0x3736('0x3c')](_0x4207bb[_0x3736('0x32')],_0x45623b[_0x3736('0x33')]));if(_0x4207bb[_0x3736('0x32')]['filter']){_0x580276[_0x3736('0x3b')]=_['merge'](_0x580276[_0x3736('0x3b')],{'$or':_[_0x3736('0x30')](_0x580276[_0x3736('0x34')],function(_0x68afad){var _0xa00949={};_0xa00949[_0x68afad]={'$like':'%'+_0x4207bb[_0x3736('0x32')]['filter']+'%'};return _0xa00949;})});}_0x580276=_[_0x3736('0x3e')]({},_0x580276,_0x4207bb[_0x3736('0x57')]);return _0x3919f6['getMembers'](_0x580276);}})[_0x3736('0x27')](function(_0x35a7f8){if(_0x35a7f8){_0x55e72f=_0x35a7f8[_0x3736('0x36')];if(!_0x4207bb[_0x3736('0x32')]['hasOwnProperty'](_0x3736('0x38'))){_0x580276[_0x3736('0x23')]=qs['limit'](_0x4207bb['query']['limit']);_0x580276[_0x3736('0x21')]=qs[_0x3736('0x21')](_0x4207bb[_0x3736('0x32')][_0x3736('0x21')]);}return _0x3919f6[_0x3736('0x54')](_0x580276);}})[_0x3736('0x27')](function(_0x57b3e7){if(_0x57b3e7){return _0x57b3e7?{'count':_0x55e72f,'rows':_0x57b3e7}:null;}})[_0x3736('0x27')](respondWithResult(_0x13de7c,null))[_0x3736('0x45')](handleError(_0x13de7c,null));};exports[_0x3736('0x58')]=function(_0x33653e,_0x9d8386,_0x3bd747){return db[_0x3736('0x40')][_0x3736('0x49')]({'where':{'id':_0x33653e[_0x3736('0x47')]['id']}})['then'](handleEntityNotFound(_0x9d8386,null))['then'](function(_0x5dc4ae){if(_0x5dc4ae){return _0x5dc4ae[_0x3736('0x58')](_0x33653e['query'][_0x3736('0x52')]);}})[_0x3736('0x27')](respondWithStatusCode(_0x9d8386,null))['catch'](handleError(_0x9d8386,null));};exports[_0x3736('0x59')]=function(_0x520bf9,_0x9d494d,_0x5d3aee){if(_0x520bf9[_0x3736('0x4b')]['id']){delete _0x520bf9['body']['id'];}return db[_0x3736('0x40')][_0x3736('0x49')]({'where':{'id':_0x520bf9[_0x3736('0x47')]['id']}})[_0x3736('0x27')](handleEntityNotFound(_0x9d494d,null))[_0x3736('0x27')](function(_0x1f19de){if(_0x1f19de){_0x520bf9[_0x3736('0x4b')][_0x3736('0x5a')]=_0x1f19de['id'];return db[_0x3736('0x4e')][_0x3736('0x4a')](_0x520bf9['body']);}})['then'](respondWithResult(_0x9d494d,null))['catch'](handleError(_0x9d494d,null));};exports['getMessages']=function(_0xe4d0bf,_0x537243,_0xb4dec){var _0xd1efdb={};var _0x3f833={};var _0x1cca39;var _0x2539a1;return db[_0x3736('0x40')][_0x3736('0x55')]({'where':{'id':_0xe4d0bf[_0x3736('0x47')]['id']}})['then'](handleEntityNotFound(_0x537243,null))[_0x3736('0x27')](function(_0x434815){if(_0x434815){_0x1cca39=_0x434815;_0x3f833[_0x3736('0x2f')]=_[_0x3736('0x31')](db[_0x3736('0x4e')]['rawAttributes']);_0x3f833[_0x3736('0x32')]=_[_0x3736('0x31')](_0xe4d0bf['query']);_0x3f833['filters']=_[_0x3736('0x48')](_0x3f833[_0x3736('0x2f')],_0x3f833['query']);_0xd1efdb['attributes']=_[_0x3736('0x48')](_0x3f833['model'],qs['fields'](_0xe4d0bf[_0x3736('0x32')][_0x3736('0x35')]));_0xd1efdb[_0x3736('0x34')]=_0xd1efdb['attributes'][_0x3736('0x36')]?_0xd1efdb[_0x3736('0x34')]:_0x3f833[_0x3736('0x2f')];_0xd1efdb[_0x3736('0x39')]=qs['sort'](_0xe4d0bf[_0x3736('0x32')]['sort']);_0xd1efdb[_0x3736('0x3b')]=qs[_0x3736('0x33')](_[_0x3736('0x3c')](_0xe4d0bf['query'],_0x3f833[_0x3736('0x33')]));if(_0xe4d0bf['query'][_0x3736('0x3d')]){_0xd1efdb[_0x3736('0x3b')]=_['merge'](_0xd1efdb[_0x3736('0x3b')],{'$or':_['map'](_0xd1efdb[_0x3736('0x34')],function(_0x9faa0b){var _0x1e730f={};_0x1e730f[_0x9faa0b]={'$like':'%'+_0xe4d0bf['query']['filter']+'%'};return _0x1e730f;})});}if(_0xe4d0bf[_0x3736('0x32')]['$gte']){var _0x3d6b77=_0xe4d0bf[_0x3736('0x32')][_0x3736('0x5b')][_0x3736('0x5c')](',');var _0x4bde31={};_0x4bde31[_0x3d6b77[0x0]]={'$gte':moment(_0x3d6b77[0x1])[_0x3736('0x5d')](_0x3736('0x5e'))};_0xd1efdb[_0x3736('0x3b')]=_[_0x3736('0x3e')](_0xd1efdb[_0x3736('0x3b')],_0x4bde31);}_0xd1efdb=_[_0x3736('0x3e')]({},_0xd1efdb,_0xe4d0bf[_0x3736('0x57')]);return _0x1cca39['getMessages'](_0xd1efdb);}})[_0x3736('0x27')](function(_0x1b2269){if(_0x1b2269){_0x2539a1=_0x1b2269[_0x3736('0x36')];if(!_0xe4d0bf[_0x3736('0x32')][_0x3736('0x37')](_0x3736('0x38'))){_0xd1efdb['limit']=qs[_0x3736('0x23')](_0xe4d0bf['query'][_0x3736('0x23')]);_0xd1efdb[_0x3736('0x21')]=qs[_0x3736('0x21')](_0xe4d0bf[_0x3736('0x32')]['offset']);}return _0x1cca39['getMessages'](_0xd1efdb);}})['then'](function(_0x4f6934){if(_0x4f6934){return _0x4f6934?{'count':_0x2539a1,'rows':_0x4f6934}:null;}})[_0x3736('0x27')](respondWithResult(_0x537243,null))[_0x3736('0x45')](handleError(_0x537243,null));}; \ No newline at end of file +var _0x5d78=['fields','attributes','hasOwnProperty','sort','where','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','create','update','body','find','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','order','pick','nolimit','addMessage','getMessages','length','$gte','format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','ChatGroup','rawAttributes','type','key','model','map','query','filters','intersection'];(function(_0x501bc7,_0x4b1ca0){var _0x5cbdd0=function(_0x2cb6d3){while(--_0x2cb6d3){_0x501bc7['push'](_0x501bc7['shift']());}};_0x5cbdd0(++_0x4b1ca0);}(_0x5d78,0x88));var _0x85d7=function(_0x5ecfe3,_0x264af5){_0x5ecfe3=_0x5ecfe3-0x0;var _0x407f52=_0x5d78[_0x5ecfe3];return _0x407f52;};'use strict';var emlformat=require(_0x85d7('0x0'));var rimraf=require(_0x85d7('0x1'));var zipdir=require(_0x85d7('0x2'));var jsonpatch=require(_0x85d7('0x3'));var rp=require(_0x85d7('0x4'));var moment=require(_0x85d7('0x5'));var BPromise=require(_0x85d7('0x6'));var Mustache=require(_0x85d7('0x7'));var util=require(_0x85d7('0x8'));var path=require(_0x85d7('0x9'));var sox=require(_0x85d7('0xa'));var csv=require(_0x85d7('0xb'));var ejs=require(_0x85d7('0xc'));var fs=require('fs');var fs_extra=require(_0x85d7('0xd'));var _=require(_0x85d7('0xe'));var squel=require(_0x85d7('0xf'));var crypto=require(_0x85d7('0x10'));var jsforce=require(_0x85d7('0x11'));var deskjs=require(_0x85d7('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x85d7('0x13'));var Redis=require(_0x85d7('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x85d7('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d7('0x16'))(_0x85d7('0x17'));var utils=require(_0x85d7('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x85d7('0x19'));var db=require('../../mysqldb')['db'];config[_0x85d7('0x1a')]=_[_0x85d7('0x1b')](config[_0x85d7('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x85d7('0x1c'))(new Redis(config['redis']));require(_0x85d7('0x1d'))[_0x85d7('0x1e')](socket);function respondWithStatusCode(_0x1f2df5,_0x3ae5e6){_0x3ae5e6=_0x3ae5e6||0xcc;return function(_0x33ca77){if(_0x33ca77){return _0x1f2df5['sendStatus'](_0x3ae5e6);}return _0x1f2df5[_0x85d7('0x1f')](_0x3ae5e6)[_0x85d7('0x20')]();};}function respondWithResult(_0xe5686,_0x3b678f){_0x3b678f=_0x3b678f||0xc8;return function(_0x5aab1f){if(_0x5aab1f){return _0xe5686[_0x85d7('0x1f')](_0x3b678f)[_0x85d7('0x21')](_0x5aab1f);}};}function respondWithFilteredResult(_0x452d11,_0x5dae9f){return function(_0x426c53){if(_0x426c53){var _0x2c4f42=typeof _0x5dae9f[_0x85d7('0x22')]===_0x85d7('0x23')&&typeof _0x5dae9f[_0x85d7('0x24')]===_0x85d7('0x23');var _0x34fa40=_0x426c53[_0x85d7('0x25')];var _0x58b97a=_0x2c4f42?0x0:_0x5dae9f[_0x85d7('0x22')];var _0x7ab703=_0x2c4f42?_0x426c53['count']:_0x5dae9f['offset']+_0x5dae9f[_0x85d7('0x24')];var _0x3c673f;if(_0x7ab703>=_0x34fa40){_0x7ab703=_0x34fa40;_0x3c673f=0xc8;}else{_0x3c673f=0xce;}_0x452d11[_0x85d7('0x1f')](_0x3c673f);return _0x452d11[_0x85d7('0x26')](_0x85d7('0x27'),_0x58b97a+'-'+_0x7ab703+'/'+_0x34fa40)[_0x85d7('0x21')](_0x426c53);}return null;};}function patchUpdates(_0x332731){return function(_0x48f690){try{jsonpatch[_0x85d7('0x28')](_0x48f690,_0x332731,!![]);}catch(_0x17c881){return BPromise[_0x85d7('0x29')](_0x17c881);}return _0x48f690[_0x85d7('0x2a')]();};}function saveUpdates(_0x3b04af,_0x498da1){return function(_0x487e5e){if(_0x487e5e){return _0x487e5e['update'](_0x3b04af)[_0x85d7('0x2b')](function(_0x14309f){return _0x14309f;});}return null;};}function removeEntity(_0x2323e1,_0x4b5b63){return function(_0x46917b){if(_0x46917b){return _0x46917b['destroy']()['then'](function(){_0x2323e1[_0x85d7('0x1f')](0xcc)[_0x85d7('0x20')]();});}};}function handleEntityNotFound(_0xfc8753,_0x5f0516){return function(_0x22aa6a){if(!_0x22aa6a){_0xfc8753['sendStatus'](0x194);}return _0x22aa6a;};}function handleError(_0xe4ab78,_0x37c8cd){_0x37c8cd=_0x37c8cd||0x1f4;return function(_0x48196e){logger[_0x85d7('0x2c')](_0x48196e[_0x85d7('0x2d')]);if(_0x48196e['name']){delete _0x48196e[_0x85d7('0x2e')];}_0xe4ab78[_0x85d7('0x1f')](_0x37c8cd)[_0x85d7('0x2f')](_0x48196e);};}exports[_0x85d7('0x30')]=function(_0x387b0d,_0x3630b7){var _0x1ef7b3={},_0x341a3c={},_0x533570={'count':0x0,'rows':[]};var _0x44e7f9=_['map'](db[_0x85d7('0x31')][_0x85d7('0x32')],function(_0x4eec96){return{'name':_0x4eec96['fieldName'],'type':_0x4eec96[_0x85d7('0x33')][_0x85d7('0x34')]};});_0x341a3c[_0x85d7('0x35')]=_[_0x85d7('0x36')](_0x44e7f9,'name');_0x341a3c[_0x85d7('0x37')]=_['keys'](_0x387b0d['query']);_0x341a3c[_0x85d7('0x38')]=_['intersection'](_0x341a3c[_0x85d7('0x35')],_0x341a3c['query']);_0x1ef7b3['attributes']=_[_0x85d7('0x39')](_0x341a3c[_0x85d7('0x35')],qs['fields'](_0x387b0d[_0x85d7('0x37')][_0x85d7('0x3a')]));_0x1ef7b3[_0x85d7('0x3b')]=_0x1ef7b3[_0x85d7('0x3b')]['length']?_0x1ef7b3[_0x85d7('0x3b')]:_0x341a3c[_0x85d7('0x35')];if(!_0x387b0d[_0x85d7('0x37')][_0x85d7('0x3c')]('nolimit')){_0x1ef7b3[_0x85d7('0x24')]=qs[_0x85d7('0x24')](_0x387b0d[_0x85d7('0x37')]['limit']);_0x1ef7b3['offset']=qs[_0x85d7('0x22')](_0x387b0d['query'][_0x85d7('0x22')]);}_0x1ef7b3['order']=qs[_0x85d7('0x3d')](_0x387b0d[_0x85d7('0x37')][_0x85d7('0x3d')]);_0x1ef7b3[_0x85d7('0x3e')]=qs[_0x85d7('0x38')](_['pick'](_0x387b0d[_0x85d7('0x37')],_0x341a3c[_0x85d7('0x38')]),_0x44e7f9);if(_0x387b0d[_0x85d7('0x37')][_0x85d7('0x3f')]){_0x1ef7b3[_0x85d7('0x3e')]=_['merge'](_0x1ef7b3[_0x85d7('0x3e')],{'$or':_['map'](_0x44e7f9,function(_0x292140){if(_0x292140[_0x85d7('0x33')]!=='VIRTUAL'){var _0x12e022={};_0x12e022[_0x292140[_0x85d7('0x2e')]]={'$like':'%'+_0x387b0d[_0x85d7('0x37')]['filter']+'%'};return _0x12e022;}})});}_0x1ef7b3=_[_0x85d7('0x40')]({},_0x1ef7b3,_0x387b0d[_0x85d7('0x41')]);var _0x13e738={'where':_0x1ef7b3['where']};return db[_0x85d7('0x31')]['count'](_0x13e738)[_0x85d7('0x2b')](function(_0x3fc9c0){_0x533570[_0x85d7('0x25')]=_0x3fc9c0;if(_0x387b0d[_0x85d7('0x37')][_0x85d7('0x42')]){_0x1ef7b3['include']=[{'all':!![]}];}return db[_0x85d7('0x31')][_0x85d7('0x43')](_0x1ef7b3);})[_0x85d7('0x2b')](function(_0x1b64da){_0x533570[_0x85d7('0x44')]=_0x1b64da;return _0x533570;})['then'](respondWithFilteredResult(_0x3630b7,_0x1ef7b3))[_0x85d7('0x45')](handleError(_0x3630b7,null));};exports[_0x85d7('0x46')]=function(_0x5d8acd,_0x399519){var _0x4485b0={'raw':!![],'where':{'id':_0x5d8acd[_0x85d7('0x47')]['id']}},_0x943784={};_0x943784[_0x85d7('0x35')]=_[_0x85d7('0x48')](db['ChatGroup'][_0x85d7('0x32')]);_0x943784[_0x85d7('0x37')]=_['keys'](_0x5d8acd[_0x85d7('0x37')]);_0x943784[_0x85d7('0x38')]=_['intersection'](_0x943784[_0x85d7('0x35')],_0x943784[_0x85d7('0x37')]);_0x4485b0['attributes']=_['intersection'](_0x943784[_0x85d7('0x35')],qs[_0x85d7('0x3a')](_0x5d8acd['query'][_0x85d7('0x3a')]));_0x4485b0[_0x85d7('0x3b')]=_0x4485b0[_0x85d7('0x3b')]['length']?_0x4485b0[_0x85d7('0x3b')]:_0x943784['model'];if(_0x5d8acd[_0x85d7('0x37')][_0x85d7('0x42')]){_0x4485b0[_0x85d7('0x49')]=[{'all':!![]}];}_0x4485b0=_[_0x85d7('0x40')]({},_0x4485b0,_0x5d8acd[_0x85d7('0x41')]);return db[_0x85d7('0x31')]['find'](_0x4485b0)[_0x85d7('0x2b')](handleEntityNotFound(_0x399519,null))['then'](respondWithResult(_0x399519,null))[_0x85d7('0x45')](handleError(_0x399519,null));};exports[_0x85d7('0x4a')]=function(_0xc3116d,_0x35a23f){return db[_0x85d7('0x31')]['create'](_0xc3116d['body'],{})[_0x85d7('0x2b')](respondWithResult(_0x35a23f,0xc9))['catch'](handleError(_0x35a23f,null));};exports[_0x85d7('0x4b')]=function(_0xd69a08,_0x44713b){if(_0xd69a08[_0x85d7('0x4c')]['id']){delete _0xd69a08[_0x85d7('0x4c')]['id'];}return db['ChatGroup'][_0x85d7('0x4d')]({'where':{'id':_0xd69a08['params']['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x44713b,null))['then'](saveUpdates(_0xd69a08[_0x85d7('0x4c')],null))['then'](respondWithResult(_0x44713b,null))[_0x85d7('0x45')](handleError(_0x44713b,null));};exports[_0x85d7('0x4e')]=function(_0x21dfe2,_0x2d41eb){return db[_0x85d7('0x31')][_0x85d7('0x4d')]({'where':{'id':_0x21dfe2[_0x85d7('0x47')]['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x2d41eb,null))[_0x85d7('0x2b')](removeEntity(_0x2d41eb,null))[_0x85d7('0x45')](handleError(_0x2d41eb,null));};exports[_0x85d7('0x4f')]=function(_0x5b33d2,_0x44ac23){return db['ChatGroup'][_0x85d7('0x4f')]()[_0x85d7('0x2b')](respondWithResult(_0x44ac23,null))[_0x85d7('0x45')](handleError(_0x44ac23,null));};exports[_0x85d7('0x50')]=function(_0x13c150,_0x2dd1fa,_0x38edd9){return db[_0x85d7('0x51')]['count']({'where':{'ChatGroupId':_0x13c150[_0x85d7('0x47')]['id'],'ToId':_0x13c150[_0x85d7('0x52')]['id'],'read':![]}})[_0x85d7('0x2b')](function(_0x19eb51){return{'id':_[_0x85d7('0x53')](_0x13c150[_0x85d7('0x47')]['id']),'count':_0x19eb51};})[_0x85d7('0x2b')](respondWithResult(_0x2dd1fa,null))[_0x85d7('0x45')](handleError(_0x2dd1fa,null));};exports['addMembers']=function(_0x2dd5c1,_0x1b8b2,_0x1c252b){return db[_0x85d7('0x31')][_0x85d7('0x4d')]({'where':{'id':_0x2dd5c1['params']['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x1b8b2,null))[_0x85d7('0x2b')](function(_0x514eb6){if(_0x514eb6){return _0x514eb6[_0x85d7('0x54')](_0x2dd5c1['body'][_0x85d7('0x55')],_[_0x85d7('0x56')](_0x2dd5c1[_0x85d7('0x4c')],[_0x85d7('0x55'),'id'])||{});}})[_0x85d7('0x2b')](respondWithResult(_0x1b8b2,null))[_0x85d7('0x45')](handleError(_0x1b8b2,null));};exports[_0x85d7('0x57')]=function(_0x41f3c8,_0x45b7b7,_0x333682){var _0x14a06c={};var _0x41a62f={};var _0x38b728;var _0x972169;return db[_0x85d7('0x31')][_0x85d7('0x58')]({'where':{'id':_0x41f3c8['params']['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x45b7b7,null))[_0x85d7('0x2b')](function(_0x1fd0d3){if(_0x1fd0d3){_0x38b728=_0x1fd0d3;_0x41a62f[_0x85d7('0x35')]=_['keys'](db['User'][_0x85d7('0x32')]);_0x41a62f['query']=_['keys'](_0x41f3c8[_0x85d7('0x37')]);_0x41a62f['filters']=_[_0x85d7('0x39')](_0x41a62f['model'],_0x41a62f[_0x85d7('0x37')]);_0x14a06c[_0x85d7('0x3b')]=_['intersection'](_0x41a62f[_0x85d7('0x35')],qs[_0x85d7('0x3a')](_0x41f3c8['query']['fields']));_0x14a06c[_0x85d7('0x3b')]=_0x14a06c[_0x85d7('0x3b')]['length']?_0x14a06c[_0x85d7('0x3b')]:_0x41a62f[_0x85d7('0x35')];_0x14a06c[_0x85d7('0x59')]=qs[_0x85d7('0x3d')](_0x41f3c8[_0x85d7('0x37')][_0x85d7('0x3d')]);_0x14a06c['where']=qs[_0x85d7('0x38')](_[_0x85d7('0x5a')](_0x41f3c8['query'],_0x41a62f[_0x85d7('0x38')]));if(_0x41f3c8[_0x85d7('0x37')][_0x85d7('0x3f')]){_0x14a06c['where']=_[_0x85d7('0x40')](_0x14a06c['where'],{'$or':_['map'](_0x14a06c[_0x85d7('0x3b')],function(_0x2f88ff){var _0x1dcd3c={};_0x1dcd3c[_0x2f88ff]={'$like':'%'+_0x41f3c8[_0x85d7('0x37')][_0x85d7('0x3f')]+'%'};return _0x1dcd3c;})});}_0x14a06c=_[_0x85d7('0x40')]({},_0x14a06c,_0x41f3c8[_0x85d7('0x41')]);return _0x38b728[_0x85d7('0x57')](_0x14a06c);}})[_0x85d7('0x2b')](function(_0xe0ee7b){if(_0xe0ee7b){_0x972169=_0xe0ee7b['length'];if(!_0x41f3c8[_0x85d7('0x37')][_0x85d7('0x3c')](_0x85d7('0x5b'))){_0x14a06c[_0x85d7('0x24')]=qs['limit'](_0x41f3c8[_0x85d7('0x37')][_0x85d7('0x24')]);_0x14a06c['offset']=qs['offset'](_0x41f3c8[_0x85d7('0x37')]['offset']);}return _0x38b728[_0x85d7('0x57')](_0x14a06c);}})[_0x85d7('0x2b')](function(_0x4b0abe){if(_0x4b0abe){return _0x4b0abe?{'count':_0x972169,'rows':_0x4b0abe}:null;}})[_0x85d7('0x2b')](respondWithResult(_0x45b7b7,null))['catch'](handleError(_0x45b7b7,null));};exports['removeMembers']=function(_0x5d1179,_0x448df5,_0x51a10a){return db[_0x85d7('0x31')]['find']({'where':{'id':_0x5d1179[_0x85d7('0x47')]['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x448df5,null))[_0x85d7('0x2b')](function(_0x1e57a3){if(_0x1e57a3){return _0x1e57a3['removeMembers'](_0x5d1179[_0x85d7('0x37')][_0x85d7('0x55')]);}})[_0x85d7('0x2b')](respondWithStatusCode(_0x448df5,null))['catch'](handleError(_0x448df5,null));};exports[_0x85d7('0x5c')]=function(_0x4cb237,_0x3f775e,_0x5e89d2){if(_0x4cb237[_0x85d7('0x4c')]['id']){delete _0x4cb237['body']['id'];}return db[_0x85d7('0x31')][_0x85d7('0x4d')]({'where':{'id':_0x4cb237['params']['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x3f775e,null))[_0x85d7('0x2b')](function(_0x2777f1){if(_0x2777f1){_0x4cb237['body']['ChatGroupId']=_0x2777f1['id'];return db[_0x85d7('0x51')][_0x85d7('0x4a')](_0x4cb237['body']);}})[_0x85d7('0x2b')](respondWithResult(_0x3f775e,null))[_0x85d7('0x45')](handleError(_0x3f775e,null));};exports[_0x85d7('0x5d')]=function(_0x115be8,_0x24afa6,_0x4607d4){var _0x1f4abc={};var _0x2f5746={};var _0x9768aa;var _0x448ba7;return db[_0x85d7('0x31')][_0x85d7('0x58')]({'where':{'id':_0x115be8['params']['id']}})[_0x85d7('0x2b')](handleEntityNotFound(_0x24afa6,null))['then'](function(_0x183867){if(_0x183867){_0x9768aa=_0x183867;_0x2f5746[_0x85d7('0x35')]=_[_0x85d7('0x48')](db[_0x85d7('0x51')][_0x85d7('0x32')]);_0x2f5746['query']=_[_0x85d7('0x48')](_0x115be8[_0x85d7('0x37')]);_0x2f5746[_0x85d7('0x38')]=_[_0x85d7('0x39')](_0x2f5746['model'],_0x2f5746[_0x85d7('0x37')]);_0x1f4abc[_0x85d7('0x3b')]=_[_0x85d7('0x39')](_0x2f5746[_0x85d7('0x35')],qs[_0x85d7('0x3a')](_0x115be8['query'][_0x85d7('0x3a')]));_0x1f4abc['attributes']=_0x1f4abc[_0x85d7('0x3b')][_0x85d7('0x5e')]?_0x1f4abc[_0x85d7('0x3b')]:_0x2f5746['model'];_0x1f4abc[_0x85d7('0x59')]=qs[_0x85d7('0x3d')](_0x115be8[_0x85d7('0x37')][_0x85d7('0x3d')]);_0x1f4abc[_0x85d7('0x3e')]=qs[_0x85d7('0x38')](_[_0x85d7('0x5a')](_0x115be8[_0x85d7('0x37')],_0x2f5746[_0x85d7('0x38')]));if(_0x115be8[_0x85d7('0x37')][_0x85d7('0x3f')]){_0x1f4abc[_0x85d7('0x3e')]=_[_0x85d7('0x40')](_0x1f4abc[_0x85d7('0x3e')],{'$or':_['map'](_0x1f4abc[_0x85d7('0x3b')],function(_0x1fa39e){var _0x1eca1a={};_0x1eca1a[_0x1fa39e]={'$like':'%'+_0x115be8[_0x85d7('0x37')][_0x85d7('0x3f')]+'%'};return _0x1eca1a;})});}if(_0x115be8[_0x85d7('0x37')][_0x85d7('0x5f')]){var _0x2c1e02=_0x115be8[_0x85d7('0x37')]['$gte']['split'](',');var _0x559c84={};_0x559c84[_0x2c1e02[0x0]]={'$gte':moment(_0x2c1e02[0x1])[_0x85d7('0x60')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1f4abc[_0x85d7('0x3e')]=_[_0x85d7('0x40')](_0x1f4abc[_0x85d7('0x3e')],_0x559c84);}_0x1f4abc=_[_0x85d7('0x40')]({},_0x1f4abc,_0x115be8[_0x85d7('0x41')]);return _0x9768aa[_0x85d7('0x5d')](_0x1f4abc);}})[_0x85d7('0x2b')](function(_0x2263c8){if(_0x2263c8){_0x448ba7=_0x2263c8['length'];if(!_0x115be8[_0x85d7('0x37')][_0x85d7('0x3c')]('nolimit')){_0x1f4abc['limit']=qs['limit'](_0x115be8['query']['limit']);_0x1f4abc[_0x85d7('0x22')]=qs['offset'](_0x115be8[_0x85d7('0x37')][_0x85d7('0x22')]);}return _0x9768aa[_0x85d7('0x5d')](_0x1f4abc);}})[_0x85d7('0x2b')](function(_0x2f1715){if(_0x2f1715){return _0x2f1715?{'count':_0x448ba7,'rows':_0x2f1715}:null;}})['then'](respondWithResult(_0x24afa6,null))[_0x85d7('0x45')](handleError(_0x24afa6,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 9f196f0..0095702 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 _0x5e6e=['save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5e6e,0x74));var _0xe5e6=function(_0x220d56,_0x153929){_0x220d56=_0x220d56-0x0;var _0xd37143=_0x5e6e[_0x220d56];return _0xd37143;};'use strict';var EventEmitter=require(_0xe5e6('0x0'));var ChatGroup=require(_0xe5e6('0x1'))['db'][_0xe5e6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xe5e6('0x3')](0x0);var events={'afterCreate':_0xe5e6('0x4'),'afterUpdate':_0xe5e6('0x5'),'afterDestroy':_0xe5e6('0x6')};function emitEvent(_0x2df215){return function(_0x5a09a3,_0x301b71,_0x1a8b1c){ChatGroupEvents[_0xe5e6('0x7')](_0x2df215+':'+_0x5a09a3['id'],_0x5a09a3);ChatGroupEvents[_0xe5e6('0x7')](_0x2df215,_0x5a09a3);_0x1a8b1c(null);};}for(var e in events){if(events[_0xe5e6('0x8')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xe5e6('0x9')]=ChatGroupEvents; \ No newline at end of file +var _0xe3a5=['../../mysqldb','ChatGroup','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x23dcff,_0x16f503){var _0x1a42d9=function(_0x4977a3){while(--_0x4977a3){_0x23dcff['push'](_0x23dcff['shift']());}};_0x1a42d9(++_0x16f503);}(_0xe3a5,0x127));var _0x5e3a=function(_0x134771,_0x22cd7c){_0x134771=_0x134771-0x0;var _0x302010=_0xe3a5[_0x134771];return _0x302010;};'use strict';var EventEmitter=require(_0x5e3a('0x0'));var ChatGroup=require(_0x5e3a('0x1'))['db'][_0x5e3a('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x5e3a('0x3'),'afterDestroy':_0x5e3a('0x4')};function emitEvent(_0x1e867c){return function(_0x597a22,_0x40aa58,_0x30f110){ChatGroupEvents[_0x5e3a('0x5')](_0x1e867c+':'+_0x597a22['id'],_0x597a22);ChatGroupEvents[_0x5e3a('0x5')](_0x1e867c,_0x597a22);_0x30f110(null);};}for(var e in events){if(events[_0x5e3a('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x5e3a('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 259ab90..70eb0f4 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 _0x6f2f=['../../config/environment','./chatGroup.attributes','exports','define','ChatGroup','util','moment','bluebird','request-promise','rimraf'];(function(_0x5e4ca8,_0x3e156c){var _0x21ef16=function(_0x43ae45){while(--_0x43ae45){_0x5e4ca8['push'](_0x5e4ca8['shift']());}};_0x21ef16(++_0x3e156c);}(_0x6f2f,0x1ef));var _0xf6f2=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x6f2f[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var util=require(_0xf6f2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xf6f2('0x1'));var BPromise=require(_0xf6f2('0x2'));var rp=require(_0xf6f2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf6f2('0x4'));var config=require(_0xf6f2('0x5'));var attributes=require(_0xf6f2('0x6'));module[_0xf6f2('0x7')]=function(_0x1a6a99,_0x209916){return _0x1a6a99[_0xf6f2('0x8')](_0xf6f2('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x36b1=['path','../../config/environment','exports','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x3d09e2,_0x58e784){var _0x5d03cd=function(_0x40f355){while(--_0x40f355){_0x3d09e2['push'](_0x3d09e2['shift']());}};_0x5d03cd(++_0x58e784);}(_0x36b1,0x18d));var _0x136b=function(_0x1c528a,_0x1a59d0){_0x1c528a=_0x1c528a-0x0;var _0x53de3e=_0x36b1[_0x1c528a];return _0x53de3e;};'use strict';var _=require(_0x136b('0x0'));var util=require(_0x136b('0x1'));var logger=require(_0x136b('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x136b('0x3'));var rimraf=require('rimraf');var config=require(_0x136b('0x4'));var attributes=require('./chatGroup.attributes');module[_0x136b('0x5')]=function(_0x276766,_0x5b36e1){return _0x276766['define'](_0x136b('0x6'),attributes,{'tableName':_0x136b('0x7'),'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 c1932c5..213628c 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 _0x615a=['error','ChatGroup,\x20%s,\x20%s','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x32cd7f,_0x3c7b2a){var _0x197196=function(_0x3e0ebd){while(--_0x3e0ebd){_0x32cd7f['push'](_0x32cd7f['shift']());}};_0x197196(++_0x3c7b2a);}(_0x615a,0x119));var _0xa615=function(_0x2059df,_0x367401){_0x2059df=_0x2059df-0x0;var _0xdd848b=_0x615a[_0x2059df];return _0xdd848b;};'use strict';var _=require(_0xa615('0x0'));var util=require('util');var moment=require(_0xa615('0x1'));var BPromise=require('bluebird');var rs=require(_0xa615('0x2'));var fs=require('fs');var Redis=require(_0xa615('0x3'));var db=require(_0xa615('0x4'))['db'];var utils=require(_0xa615('0x5'));var logger=require('../../config/logger')(_0xa615('0x6'));var config=require(_0xa615('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa615('0x8')]['http']({'port':0x232a});config[_0xa615('0x9')]=_[_0xa615('0xa')](config[_0xa615('0x9')],{'host':_0xa615('0xb'),'port':0x18eb});var socket=require(_0xa615('0xc'))(new Redis(config['redis']));require(_0xa615('0xd'))['register'](socket);function respondWithRpcPromise(_0x2b952d,_0x3fbfe1,_0x5a6664){return new BPromise(function(_0x3b1698,_0xf1cbca){return client[_0xa615('0xe')](_0x2b952d,_0x5a6664)[_0xa615('0xf')](function(_0x2530ec){logger['info']('ChatGroup,\x20%s,\x20%s',_0x3fbfe1,_0xa615('0x10'));logger['debug'](_0xa615('0x11'),_0x3fbfe1,_0xa615('0x10'),JSON[_0xa615('0x12')](_0x2530ec));if(_0x2530ec[_0xa615('0x13')]){if(_0x2530ec['error']['code']===0x1f4){logger[_0xa615('0x13')](_0xa615('0x14'),_0x3fbfe1,_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);return _0xf1cbca(_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);}logger[_0xa615('0x13')](_0xa615('0x14'),_0x3fbfe1,_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);return _0x3b1698(_0x2530ec[_0xa615('0x13')][_0xa615('0x15')]);}else{logger[_0xa615('0x16')](_0xa615('0x14'),_0x3fbfe1,_0xa615('0x10'));_0x3b1698(_0x2530ec[_0xa615('0x17')][_0xa615('0x15')]);}})[_0xa615('0x18')](function(_0x1eb384){logger['error'](_0xa615('0x14'),_0x3fbfe1,_0x1eb384);_0xf1cbca(_0x1eb384);});});} \ No newline at end of file +var _0xc57c=['defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x2a5129,_0x19de86){var _0x169fe1=function(_0xacbaa2){while(--_0xacbaa2){_0x2a5129['push'](_0x2a5129['shift']());}};_0x169fe1(++_0x19de86);}(_0xc57c,0x149));var _0xcc57=function(_0x58c78b,_0x44a579){_0x58c78b=_0x58c78b-0x0;var _0x21757b=_0xc57c[_0x58c78b];return _0x21757b;};'use strict';var _=require(_0xcc57('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcc57('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcc57('0x2'));var logger=require('../../config/logger')(_0xcc57('0x3'));var config=require(_0xcc57('0x4'));var jayson=require(_0xcc57('0x5'));var client=jayson[_0xcc57('0x6')][_0xcc57('0x7')]({'port':0x232a});config[_0xcc57('0x8')]=_[_0xcc57('0x9')](config['redis'],{'host':_0xcc57('0xa'),'port':0x18eb});var socket=require(_0xcc57('0xb'))(new Redis(config[_0xcc57('0x8')]));require(_0xcc57('0xc'))[_0xcc57('0xd')](socket);function respondWithRpcPromise(_0x1a8031,_0x35916b,_0x551a73){return new BPromise(function(_0x4c7e7c,_0x51be8c){return client[_0xcc57('0xe')](_0x1a8031,_0x551a73)[_0xcc57('0xf')](function(_0x5a5444){logger[_0xcc57('0x10')](_0xcc57('0x11'),_0x35916b,_0xcc57('0x12'));logger[_0xcc57('0x13')](_0xcc57('0x14'),_0x35916b,_0xcc57('0x12'),JSON[_0xcc57('0x15')](_0x5a5444));if(_0x5a5444[_0xcc57('0x16')]){if(_0x5a5444[_0xcc57('0x16')][_0xcc57('0x17')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x35916b,_0x5a5444['error'][_0xcc57('0x18')]);return _0x51be8c(_0x5a5444[_0xcc57('0x16')][_0xcc57('0x18')]);}logger[_0xcc57('0x16')](_0xcc57('0x11'),_0x35916b,_0x5a5444['error'][_0xcc57('0x18')]);return _0x4c7e7c(_0x5a5444[_0xcc57('0x16')]['message']);}else{logger[_0xcc57('0x10')]('ChatGroup,\x20%s,\x20%s',_0x35916b,_0xcc57('0x12'));_0x4c7e7c(_0x5a5444['result'][_0xcc57('0x18')]);}})[_0xcc57('0x19')](function(_0x24b749){logger['error'](_0xcc57('0x11'),_0x35916b,_0x24b749);_0x51be8c(_0x24b749);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 06c9a82..46ea2f2 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 _0x6339=['length','chatGroup:','./chatGroup.events','remove','update','emit'];(function(_0x3ae1cc,_0x2ab3e6){var _0x51a273=function(_0x22761a){while(--_0x22761a){_0x3ae1cc['push'](_0x3ae1cc['shift']());}};_0x51a273(++_0x2ab3e6);}(_0x6339,0x98));var _0x9633=function(_0x5c3bce,_0x6a925c){_0x5c3bce=_0x5c3bce-0x0;var _0x38c996=_0x6339[_0x5c3bce];return _0x38c996;};'use strict';var ChatGroupEvents=require(_0x9633('0x0'));var events=['save',_0x9633('0x1'),_0x9633('0x2')];function createListener(_0x4fac89,_0x4b5440){return function(_0x40cc8c){_0x4b5440[_0x9633('0x3')](_0x4fac89,_0x40cc8c);};}function removeListener(_0x18e084,_0x59387d){return function(){ChatGroupEvents['removeListener'](_0x18e084,_0x59387d);};}exports['register']=function(_0x2faaff){for(var _0x344a8e=0x0,_0x4599e3=events[_0x9633('0x4')];_0x344a8e<_0x4599e3;_0x344a8e++){var _0xeca78d=events[_0x344a8e];var _0x2937d4=createListener(_0x9633('0x5')+_0xeca78d,_0x2faaff);ChatGroupEvents['on'](_0xeca78d,_0x2937d4);}}; \ No newline at end of file +var _0x9001=['chatGroup:','./chatGroup.events','save','remove','update','removeListener','register','length'];(function(_0x5cb367,_0x27ec9d){var _0x279365=function(_0x1d9d85){while(--_0x1d9d85){_0x5cb367['push'](_0x5cb367['shift']());}};_0x279365(++_0x27ec9d);}(_0x9001,0x109));var _0x1900=function(_0x458d26,_0x9f67b8){_0x458d26=_0x458d26-0x0;var _0x4bb206=_0x9001[_0x458d26];return _0x4bb206;};'use strict';var ChatGroupEvents=require(_0x1900('0x0'));var events=[_0x1900('0x1'),_0x1900('0x2'),_0x1900('0x3')];function createListener(_0x46b6be,_0x449052){return function(_0x2d76a7){_0x449052['emit'](_0x46b6be,_0x2d76a7);};}function removeListener(_0x1bbf6c,_0x1ca4b4){return function(){ChatGroupEvents[_0x1900('0x4')](_0x1bbf6c,_0x1ca4b4);};}exports[_0x1900('0x5')]=function(_0x2a0ae6){for(var _0x1ceb35=0x0,_0x32cebe=events[_0x1900('0x6')];_0x1ceb35<_0x32cebe;_0x1ceb35++){var _0x66d3f7=events[_0x1ceb35];var _0x3934a1=createListener(_0x1900('0x7')+_0x66d3f7,_0x2a0ae6);ChatGroupEvents['on'](_0x66d3f7,_0x3934a1);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index f03e11e..3673b20 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 _0x269d=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','delete','removeMembers','exports','express','Router'];(function(_0x4fa489,_0x4cba6b){var _0x41d2ce=function(_0x364060){while(--_0x364060){_0x4fa489['push'](_0x4fa489['shift']());}};_0x41d2ce(++_0x4cba6b);}(_0x269d,0xbe));var _0xd269=function(_0x2f9922,_0x3eea19){_0x2f9922=_0x2f9922-0x0;var _0x963e1c=_0x269d[_0x2f9922];return _0x963e1c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd269('0x0'));var router=express[_0xd269('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xd269('0x2'));var interaction=require(_0xd269('0x3'));var config=require(_0xd269('0x4'));var controller=require('./chatGroup.controller');router['get']('/',auth[_0xd269('0x5')](),controller[_0xd269('0x6')]);router[_0xd269('0x7')](_0xd269('0x8'),auth['isAuthenticated'](),controller[_0xd269('0x9')]);router[_0xd269('0x7')](_0xd269('0xa'),auth[_0xd269('0x5')](),controller[_0xd269('0xb')]);router[_0xd269('0x7')]('/:id/unread',auth['isAuthenticated'](),controller[_0xd269('0xc')]);router[_0xd269('0x7')](_0xd269('0xd'),auth['isAuthenticated'](),controller[_0xd269('0xe')]);router[_0xd269('0x7')](_0xd269('0xf'),auth[_0xd269('0x5')](),controller['getMessages']);router[_0xd269('0x10')]('/',auth[_0xd269('0x5')](),controller[_0xd269('0x11')]);router[_0xd269('0x10')](_0xd269('0xd'),auth['isAuthenticated'](),controller[_0xd269('0x12')]);router[_0xd269('0x10')](_0xd269('0xf'),auth['isAuthenticated'](),controller[_0xd269('0x13')]);router[_0xd269('0x14')](_0xd269('0xa'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xd269('0x15')](_0xd269('0xd'),auth[_0xd269('0x5')](),controller[_0xd269('0x16')]);module[_0xd269('0x17')]=router; \ No newline at end of file +var _0xaa3f=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','getUnread','/:id/members','getMembers','getMessages','create','addMembers','post','addMessage','put','update','delete','destroy','removeMembers'];(function(_0x179314,_0x32d3a2){var _0x3556f7=function(_0x16244e){while(--_0x16244e){_0x179314['push'](_0x179314['shift']());}};_0x3556f7(++_0x32d3a2);}(_0xaa3f,0xe9));var _0xfaa3=function(_0x2e5a17,_0x558f0e){_0x2e5a17=_0x2e5a17-0x0;var _0x24f53d=_0xaa3f[_0x2e5a17];return _0x24f53d;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfaa3('0x7'));var config=require('../../config/environment');var controller=require(_0xfaa3('0x8'));router[_0xfaa3('0x9')]('/',auth[_0xfaa3('0xa')](),controller['index']);router['get'](_0xfaa3('0xb'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0xc')]);router['get'](_0xfaa3('0xd'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0xe')]);router[_0xfaa3('0x9')]('/:id/unread',auth[_0xfaa3('0xa')](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x9')](_0xfaa3('0x10'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x11')]);router[_0xfaa3('0x9')]('/:id/messages',auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x12')]);router['post']('/',auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x13')]);router['post'](_0xfaa3('0x10'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x14')]);router[_0xfaa3('0x15')]('/:id/messages',auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x16')]);router[_0xfaa3('0x17')](_0xfaa3('0xd'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x18')]);router[_0xfaa3('0x19')](_0xfaa3('0xd'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x1a')]);router[_0xfaa3('0x19')](_0xfaa3('0x10'),auth[_0xfaa3('0xa')](),controller[_0xfaa3('0x1b')]);module[_0xfaa3('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 7c19fad..1431d3f 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 _0x60d3=['STRING','DATE','TEXT','long','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x60d3,0xc1));var _0x360d=function(_0x26b622,_0x237e9e){_0x26b622=_0x26b622-0x0;var _0x58a028=_0x60d3[_0x26b622];return _0x58a028;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x360d('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x360d('0x1')]},'ratingType':{'type':Sequelize[_0x360d('0x2')](_0x360d('0x3'),_0x360d('0x4')),'defaultValue':_0x360d('0x3')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x360d('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x360d('0x6')]},'disposition':{'type':Sequelize[_0x360d('0x5')]},'secondDisposition':{'type':Sequelize[_0x360d('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x360d('0x5')]},'browserName':{'type':Sequelize[_0x360d('0x5')]},'browserVersion':{'type':Sequelize[_0x360d('0x5')]},'osName':{'type':Sequelize[_0x360d('0x5')]},'osVersion':{'type':Sequelize[_0x360d('0x5')]},'deviceModel':{'type':Sequelize[_0x360d('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x360d('0x5')]},'referer':{'type':Sequelize[_0x360d('0x7')]},'customerIp':{'type':Sequelize[_0x360d('0x5')]},'formData':{'type':Sequelize[_0x360d('0x7')](_0x360d('0x8'))},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0x360d('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x360d('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x360d('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x360d('0x0')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x4535=['BOOLEAN','INTEGER','thumb','star','TEXT','DATE','STRING','ENUM','exports'];(function(_0x30821a,_0x61e78b){var _0x6db77=function(_0x384c45){while(--_0x384c45){_0x30821a['push'](_0x30821a['shift']());}};_0x6db77(++_0x61e78b);}(_0x4535,0xb3));var _0x5453=function(_0x1de777,_0x34ef16){_0x1de777=_0x1de777-0x0;var _0x11a982=_0x4535[_0x1de777];return _0x11a982;};'use strict';var Sequelize=require('sequelize');module[_0x5453('0x0')]={'closed':{'type':Sequelize[_0x5453('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x5453('0x2')]},'ratingType':{'type':Sequelize['ENUM']('star',_0x5453('0x3')),'defaultValue':_0x5453('0x4')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0x5453('0x5')]},'mailTranscript':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x5453('0x6')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5453('0x7')]},'thirdDisposition':{'type':Sequelize[_0x5453('0x7')]},'note':{'type':Sequelize[_0x5453('0x7')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize[_0x5453('0x7')]},'osName':{'type':Sequelize[_0x5453('0x7')]},'osVersion':{'type':Sequelize[_0x5453('0x7')]},'deviceModel':{'type':Sequelize[_0x5453('0x7')]},'deviceVendor':{'type':Sequelize[_0x5453('0x7')]},'deviceType':{'type':Sequelize[_0x5453('0x7')]},'referer':{'type':Sequelize[_0x5453('0x5')]},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x5453('0x5')]('long')},'read1stAt':{'type':Sequelize[_0x5453('0x6')]},'lastMsgAt':{'type':Sequelize[_0x5453('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x5453('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x5453('0x7')]},'customerPort':{'type':Sequelize[_0x5453('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x5453('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x5453('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 90c6e55..cedd441 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 _0xc812=['downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','bluebird','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatInteraction.socket','register','jayson/promise','http','request','then','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','result','sendStatus','end','json','offset','limit','undefined','count','status','destroy','stack','name','send','render','body','contact','agent','interaction','account','index','map','rawAttributes','fieldName','type','findAll','catch','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','ChatInteraction','find','create','update','describe','createVidaooSession','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','parse','metadata','Sequelize','Error\x20in\x20conversion\x20vidaooMetadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','UserId','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','attachmentDownload','attachId','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ChatWebsiteId','ContactId','agentAlias','System','customer','format','Visitor','agentIdentifier','agent_alias','alias','%s%d','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','secret','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','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','where','pick','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','ChatInteractionId','filter','push','addTags','spread','Tag','color','emit','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','Contact','firstName','lastName','direction','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','toString','browserName','osName','customerPort','tail','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','views'];(function(_0x5cac67,_0x1837d3){var _0x27ce41=function(_0x17910f){while(--_0x17910f){_0x5cac67['push'](_0x5cac67['shift']());}};_0x27ce41(++_0x1837d3);}(_0xc812,0x1b2));var _0x2c81=function(_0x13ddc6,_0x4d5530){_0x13ddc6=_0x13ddc6-0x0;var _0x4202fd=_0xc812[_0x13ddc6];return _0x4202fd;};'use strict';var rimraf=require(_0x2c81('0x0'));var zipdir=require(_0x2c81('0x1'));var rp=require(_0x2c81('0x2'));var moment=require('moment');var BPromise=require(_0x2c81('0x3'));var Mustache=require('mustache');var util=require(_0x2c81('0x4'));var path=require(_0x2c81('0x5'));var ejs=require(_0x2c81('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x2c81('0x7'));var interaction=require(_0x2c81('0x8'));var qs=require(_0x2c81('0x9'));var pdf=require(_0x2c81('0xa'));var logger=require(_0x2c81('0xb'))(_0x2c81('0xc'));var config=require(_0x2c81('0xd'));var db=require(_0x2c81('0xe'))['db'];config['redis']=_[_0x2c81('0xf')](config[_0x2c81('0x10')],{'host':_0x2c81('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2c81('0x10')]));require(_0x2c81('0x12'))[_0x2c81('0x13')](socket);var jayson=require(_0x2c81('0x14'));var client=jayson['client'][_0x2c81('0x15')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x354fae,_0x50d103,_0x49704f,_0x1292d6){return new BPromise(function(_0x582c03,_0x4c6610){var _0x2909f4=_0x1292d6||client;return _0x2909f4[_0x2c81('0x16')](_0x354fae,_0x49704f)[_0x2c81('0x17')](function(_0x229249){logger[_0x2c81('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x50d103,_0x2c81('0x19'));logger['debug'](_0x2c81('0x1a'),_0x50d103,_0x2c81('0x19'),JSON[_0x2c81('0x1b')](_0x229249));if(_0x229249[_0x2c81('0x1c')]){if(_0x229249['error'][_0x2c81('0x1d')]===0x1f4){logger[_0x2c81('0x1c')](_0x2c81('0x1e'),_0x50d103,_0x229249[_0x2c81('0x1c')]['message']);return _0x4c6610(_0x229249[_0x2c81('0x1c')][_0x2c81('0x1f')]);}logger[_0x2c81('0x1c')](_0x2c81('0x1e'),_0x50d103,_0x229249['error'][_0x2c81('0x1f')]);return _0x582c03(_0x229249[_0x2c81('0x1c')]['message']);}else{logger[_0x2c81('0x18')](_0x2c81('0x1e'),_0x50d103,_0x2c81('0x19'));_0x582c03(_0x229249[_0x2c81('0x20')][_0x2c81('0x1f')]);}})['catch'](function(_0x17ee0c){logger['error'](_0x2c81('0x1e'),_0x50d103,_0x17ee0c);_0x4c6610(_0x17ee0c);});});}function respondWithStatusCode(_0x12f92d,_0x12f892){_0x12f892=_0x12f892||0xcc;return function(_0x5b2b76){if(_0x5b2b76){return _0x12f92d[_0x2c81('0x21')](_0x12f892);}return _0x12f92d['status'](_0x12f892)[_0x2c81('0x22')]();};}function respondWithResult(_0x1dcfff,_0x363562){_0x363562=_0x363562||0xc8;return function(_0xdf6d50){if(_0xdf6d50){return _0x1dcfff['status'](_0x363562)[_0x2c81('0x23')](_0xdf6d50);}};}function respondWithFilteredResult(_0x56bfb9,_0x25f8d0){return function(_0x2cdeb1){if(_0x2cdeb1){var _0x45865b=typeof _0x25f8d0[_0x2c81('0x24')]==='undefined'&&typeof _0x25f8d0[_0x2c81('0x25')]===_0x2c81('0x26');var _0x48d812=_0x2cdeb1[_0x2c81('0x27')];var _0x2e6825=_0x45865b?0x0:_0x25f8d0[_0x2c81('0x24')];var _0x2c98b1=_0x45865b?_0x2cdeb1[_0x2c81('0x27')]:_0x25f8d0[_0x2c81('0x24')]+_0x25f8d0[_0x2c81('0x25')];var _0x53b7d4;if(_0x2c98b1>=_0x48d812){_0x2c98b1=_0x48d812;_0x53b7d4=0xc8;}else{_0x53b7d4=0xce;}_0x56bfb9[_0x2c81('0x28')](_0x53b7d4);return _0x56bfb9['set']('Content-Range',_0x2e6825+'-'+_0x2c98b1+'/'+_0x48d812)[_0x2c81('0x23')](_0x2cdeb1);}return null;};}function saveUpdates(_0x191c8c){return function(_0x290594){if(_0x290594){return _0x290594['update'](_0x191c8c)[_0x2c81('0x17')](function(_0x5dfc53){return _0x5dfc53;});}return null;};}function removeEntity(_0x3a5a8f){return function(_0x402bee){if(_0x402bee){return _0x402bee[_0x2c81('0x29')]()['then'](function(){_0x3a5a8f[_0x2c81('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30d624){return function(_0x1e5f3d){if(!_0x1e5f3d){_0x30d624[_0x2c81('0x21')](0x194);}return _0x1e5f3d;};}function handleError(_0x3f8a38,_0x51cb52){_0x51cb52=_0x51cb52||0x1f4;return function(_0x5ac1ab){logger['error'](_0x5ac1ab[_0x2c81('0x2a')]);if(_0x5ac1ab[_0x2c81('0x2b')]){delete _0x5ac1ab[_0x2c81('0x2b')];}_0x3f8a38[_0x2c81('0x28')](_0x51cb52)[_0x2c81('0x2c')](_0x5ac1ab);};}function getMustacheRender(_0x4ce07e,_0x422f35){return Mustache[_0x2c81('0x2d')](_0x4ce07e,_['merge'](_0x422f35[_0x2c81('0x2e')],{'contact':_0x422f35[_0x2c81('0x2f')],'message':_0x422f35[_0x2c81('0x1f')],'agent':_0x422f35[_0x2c81('0x30')],'interaction':_0x422f35[_0x2c81('0x31')],'account':_0x422f35[_0x2c81('0x32')]}))||'';}exports[_0x2c81('0x33')]=function(_0x38816c,_0xd2f725){var _0x33149e={};var _0x5f302d=_[_0x2c81('0x34')](db['ChatInteraction'][_0x2c81('0x35')],function(_0x252403){return{'name':_0x252403[_0x2c81('0x36')],'type':_0x252403[_0x2c81('0x37')]['key']};});_0x33149e=qs['getOptions'](_0x5f302d,_0x38816c);return interaction[_0x2c81('0x38')]('chat',_0x38816c['query'],_0x38816c['user'],_0x33149e,_0x5f302d)[_0x2c81('0x17')](respondWithFilteredResult(_0xd2f725,_0x33149e))[_0x2c81('0x39')](handleError(_0xd2f725,null));};exports[_0x2c81('0x3a')]=function(_0x136a52,_0xf1af4b){var _0x358442={'raw':![],'where':{'id':_0x136a52[_0x2c81('0x3b')]['id']}},_0x290680={};_0x290680[_0x2c81('0x3c')]=_[_0x2c81('0x3d')](db['ChatInteraction'][_0x2c81('0x35')]);_0x290680[_0x2c81('0x3e')]=_['keys'](_0x136a52['query']);_0x290680['filters']=_['intersection'](_0x290680['model'],_0x290680[_0x2c81('0x3e')]);_0x358442['attributes']=_[_0x2c81('0x3f')](_0x290680['model'],qs[_0x2c81('0x40')](_0x136a52[_0x2c81('0x3e')][_0x2c81('0x40')]));_0x358442[_0x2c81('0x41')]=_0x358442['attributes'][_0x2c81('0x42')]?_0x358442[_0x2c81('0x41')]:_0x290680[_0x2c81('0x3c')];if(_0x136a52[_0x2c81('0x3e')][_0x2c81('0x43')]){_0x358442[_0x2c81('0x44')]=[{'all':!![]}];}_0x358442=_[_0x2c81('0x45')]({},_0x358442,_0x136a52[_0x2c81('0x46')]);return db[_0x2c81('0x47')][_0x2c81('0x48')](_0x358442)[_0x2c81('0x17')](handleEntityNotFound(_0xf1af4b,null))[_0x2c81('0x17')](respondWithResult(_0xf1af4b,null))[_0x2c81('0x39')](handleError(_0xf1af4b,null));};exports['create']=function(_0x23c689,_0x684d0e){return db[_0x2c81('0x47')][_0x2c81('0x49')](_0x23c689[_0x2c81('0x2e')],{})[_0x2c81('0x17')](respondWithResult(_0x684d0e,0xc9))[_0x2c81('0x39')](handleError(_0x684d0e,null));};exports[_0x2c81('0x4a')]=function(_0x44f5ae,_0xfa20a5){if(_0x44f5ae[_0x2c81('0x2e')]['id']){delete _0x44f5ae[_0x2c81('0x2e')]['id'];}return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x44f5ae[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0xfa20a5,null))[_0x2c81('0x17')](saveUpdates(_0x44f5ae[_0x2c81('0x2e')],null))[_0x2c81('0x17')](respondWithResult(_0xfa20a5,null))['catch'](handleError(_0xfa20a5,null));};exports[_0x2c81('0x29')]=function(_0x5a9de6,_0x497373){return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x5a9de6[_0x2c81('0x3b')]['id']}})['then'](handleEntityNotFound(_0x497373,null))[_0x2c81('0x17')](removeEntity(_0x497373,null))['catch'](handleError(_0x497373,null));};exports[_0x2c81('0x4b')]=function(_0x11ab98,_0x3f91c3){return db['ChatInteraction']['describe']()[_0x2c81('0x17')](respondWithResult(_0x3f91c3,null))[_0x2c81('0x39')](handleError(_0x3f91c3,null));};exports[_0x2c81('0x4c')]=function(_0x481dda,_0x487505){var _0x371514=_0x481dda['params']['id'];var _0x2f5fbd;var _0x328d0b;var _0x2e3be8;return db[_0x2c81('0x47')]['findOne']({'where':{'id':_0x371514}})[_0x2c81('0x17')](function(_0x53fd80){_0x2f5fbd=_0x53fd80;return db[_0x2c81('0x4d')][_0x2c81('0x4e')]({'where':{'id':_0x53fd80['ChatWebsiteId']},'attributes':['id',_0x2c81('0x4f'),_0x2c81('0x50'),_0x2c81('0x51'),'vidaooNote',_0x2c81('0x52')],'raw':!![]});})['then'](function(_0x4e1302){if(_0x4e1302&&_0x4e1302[_0x2c81('0x4f')]&&_0x4e1302[_0x2c81('0x50')]){_0x328d0b=_0x4e1302;var _0x554b49={'interaction':{'id':_0x371514},'agent':{'id':_0x481dda[_0x2c81('0x53')]['id'],'name':_0x481dda['user'][_0x2c81('0x2b')],'fullname':_0x481dda[_0x2c81('0x53')][_0x2c81('0x54')],'email':_0x481dda[_0x2c81('0x53')][_0x2c81('0x55')]},'contact':_0x481dda[_0x2c81('0x2e')][_0x2c81('0x2f')],'account':_0x481dda[_0x2c81('0x2e')][_0x2c81('0x32')]};var _0x545151={'rejectUnauthorized':![],'method':_0x2c81('0x56'),'url':_0x2c81('0x57'),'headers':{'X-APIKEY':_0x4e1302[_0x2c81('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x481dda[_0x2c81('0x53')]['email']],'buttons':null,'topic':_0x328d0b['vidaooTopic'],'note':_[_0x2c81('0x58')](_0x328d0b[_0x2c81('0x59')])?null:getMustacheRender(_0x328d0b[_0x2c81('0x59')],_0x554b49),'metadata':null},'redirect':_0x2c81('0x5a'),'json':!![]};try{if(!_['isNull'](_0x328d0b[_0x2c81('0x52')])){var _0x8898d2=getMustacheRender(_0x328d0b[_0x2c81('0x52')],_0x554b49);var _0x4c394b=JSON[_0x2c81('0x5b')](_0x8898d2);_0x545151[_0x2c81('0x2e')][_0x2c81('0x5c')]=_0x4c394b;}}catch(_0x4e405a){throw new db[(_0x2c81('0x5d'))]['ValidationError'](_0x2c81('0x5e'));}return rp(_0x545151);}else{throw new db[(_0x2c81('0x5d'))][(_0x2c81('0x5f'))](_0x2c81('0x60'));}})['then'](function(_0x5eb9d3){_0x2e3be8=_0x5eb9d3;if(_0x2e3be8['id']){var _0x166601={'body':_0x2e3be8['join_url'],'ChatWebsiteId':_0x328d0b['id'],'ChatInteractionId':_0x2f5fbd['id'],'direction':_0x2c81('0x61'),'UserId':_0x481dda[_0x2c81('0x53')]['id']};return db['ChatMessage'][_0x2c81('0x49')](_0x166601,{});}else{throw new db[(_0x2c81('0x5d'))]['ValidationError'](_0x2c81('0x62'));}})[_0x2c81('0x17')](function(){return _0x2f5fbd[_0x2c81('0x63')]({'vidaooSessionId':_0x2e3be8['id']});})[_0x2c81('0x17')](respondWithResult(_0x487505,null))[_0x2c81('0x39')](handleError(_0x487505,null));};exports[_0x2c81('0x64')]=function(_0x44024b,_0xe068ca){if(_0x44024b[_0x2c81('0x2e')]['id']){delete _0x44024b[_0x2c81('0x2e')]['id'];}return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x44024b['params']['id']},'include':[{'model':db[_0x2c81('0x65')],'as':'Contact'}]})[_0x2c81('0x17')](handleEntityNotFound(_0xe068ca,null))[_0x2c81('0x17')](saveUpdates(_0x44024b['body'],null))[_0x2c81('0x17')](respondWithResult(_0xe068ca,null))[_0x2c81('0x39')](handleError(_0xe068ca,null));};exports[_0x2c81('0x66')]=function(_0x26cafa,_0x43c331){if(_0x26cafa['body']['id']){delete _0x26cafa[_0x2c81('0x2e')]['id'];}return db[_0x2c81('0x47')]['find']({'where':{'id':_0x26cafa[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](function(_0x13ce38){if(!_0x13ce38){logger['error'](_0x2c81('0x67'),_0x2c81('0x66'),0x194,'entity\x20not\x20found');_0x43c331['sendStatus'](0x194);}else{if(_0x13ce38[_0x2c81('0x68')]){throw new db[(_0x2c81('0x5d'))]['ValidationError']('Interaction\x20already\x20assigned');}}return _0x13ce38;})[_0x2c81('0x17')](function(_0x2889bc){if(_0x2889bc){return _0x2889bc[_0x2c81('0x4a')]({'closed':_0x26cafa['body'][_0x2c81('0x69')],'disposition':_0x26cafa[_0x2c81('0x2e')][_0x2c81('0x6a')]})[_0x2c81('0x17')](function(_0x2d18d7){return _0x2d18d7;});}})[_0x2c81('0x17')](function(){return respondWithRpcPromise(_0x2c81('0x6b'),_0x2c81('0x66'),_0x26cafa[_0x2c81('0x2e')],client9004);})[_0x2c81('0x17')](respondWithResult(_0x43c331,null))[_0x2c81('0x39')](handleError(_0x43c331,null));};exports[_0x2c81('0x6c')]=function(_0x32b606,_0x445f9f){_0x32b606['body'][_0x2c81('0x2b')]=_0x32b606[_0x2c81('0x6d')][_0x2c81('0x6e')];_0x32b606[_0x2c81('0x2e')][_0x2c81('0x6f')]=_0x32b606[_0x2c81('0x6d')][_0x2c81('0x70')];_0x32b606[_0x2c81('0x2e')][_0x2c81('0x37')]=_0x32b606[_0x2c81('0x6d')][_0x2c81('0x71')];return db[_0x2c81('0x72')][_0x2c81('0x49')](_0x32b606[_0x2c81('0x2e')])[_0x2c81('0x17')](respondWithResult(_0x445f9f,0xc9))[_0x2c81('0x39')](handleError(_0x445f9f,null));};exports[_0x2c81('0x73')]=function(_0x1294bd,_0x3338de){return db['ChatInteraction'][_0x2c81('0x4e')]({'where':{'id':_0x1294bd[_0x2c81('0x3b')]['id']},'raw':!![]})[_0x2c81('0x17')](handleEntityNotFound(_0x3338de,null))['then'](function(_0x57544b){if(_0x57544b){if(_0x57544b[_0x2c81('0x69')]){return _0x3338de[_0x2c81('0x28')](0x193)[_0x2c81('0x23')]({'status':0x193,'message':'Unauthorized'});}return db['Attachment'][_0x2c81('0x4e')]({'where':{'id':_0x1294bd['query'][_0x2c81('0x74')]},'raw':!![]})[_0x2c81('0x17')](handleEntityNotFound(_0x3338de,null));}})[_0x2c81('0x17')](function(_0x1c2896){if(_0x1c2896){var _0x16423e=_0x1c2896[_0x2c81('0x75')]!==null;var _0x58b1f9=path['join'](config[_0x2c81('0x76')],_0x2c81('0x77'));if(_0x16423e){_0x58b1f9=path['join'](_0x58b1f9,_0x2c81('0x78'));}var _0x1446fe=path[_0x2c81('0x79')](_0x58b1f9,_0x1c2896[_0x2c81('0x6f')]);return _0x3338de[_0x2c81('0x7a')](_0x1446fe);}})['catch'](handleError(_0x3338de,null));};exports[_0x2c81('0x7b')]=function(_0xfa17b2,_0x3e9d65){var _0x29116a=null;var _0x829364=null;var _0xec56f7=null;if(_0xfa17b2[_0x2c81('0x2e')]['id']){delete _0xfa17b2[_0x2c81('0x2e')]['id'];}if(_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x7c')]){_0xec56f7=path[_0x2c81('0x79')](config[_0x2c81('0x76')],_0x2c81('0x7d'),util['format'](_0x2c81('0x7e'),Date[_0x2c81('0x7f')]()));_0xfa17b2['body'][_0x2c81('0x80')]=_0xec56f7;}return db['ChatInteraction']['find']({'where':{'id':_0xfa17b2[_0x2c81('0x3b')]['id']},'include':[{'model':db[_0x2c81('0x81')],'as':_0x2c81('0x82'),'include':[{'model':db[_0x2c81('0x83')],'as':_0x2c81('0x83')}]}]})[_0x2c81('0x17')](handleEntityNotFound(_0x3e9d65,null))[_0x2c81('0x17')](saveUpdates(_0xfa17b2['body'],null))[_0x2c81('0x17')](function(_0x31034e){if(_0x31034e){_0x29116a=_0x31034e;return db[_0x2c81('0x4d')][_0x2c81('0x48')]({'where':{'id':_0x29116a[_0x2c81('0x84')]}});}})[_0x2c81('0x17')](function(_0x3b98af){if(_0x3b98af){_0x829364=_0x3b98af;return db[_0x2c81('0x65')][_0x2c81('0x48')]({'where':{'id':_0x29116a[_0x2c81('0x85')]}});}})['then'](function(_0xb46680){if(_0xb46680){if(_0xec56f7){var _0x2b71a1=null;for(var _0xca4b1e=0x1;_0xca4b1e<_0x29116a[_0x2c81('0x82')][_0x2c81('0x42')];++_0xca4b1e){_0x2b71a1=_0x29116a[_0x2c81('0x82')][_0xca4b1e];var _0x5eed35=_0x2b71a1[_0x2c81('0x68')]?util['format']('%s%d',_0x829364[_0x2c81('0x86')],_0x2b71a1[_0x2c81('0x68')]):_0x2c81('0x87');var _0x9d8ec9=_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x88')]||util[_0x2c81('0x89')]('%s%d',_0x2c81('0x8a'),_0x2b71a1[_0x2c81('0x85')]);switch(_0x829364[_0x2c81('0x8b')]){case'website_alias':_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?util[_0x2c81('0x89')]('%s%d',_0x829364[_0x2c81('0x86')],_0x2b71a1['UserId']):_0x2c81('0x87');break;case _0x2c81('0x8c'):_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?_0x2b71a1[_0x2c81('0x83')][_0x2c81('0x8d')]||_0x2b71a1[_0x2c81('0x83')][_0x2c81('0x54')]:_0x2c81('0x87');break;case'agent_fullname':_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?_0x2b71a1[_0x2c81('0x83')][_0x2c81('0x54')]:'System';break;default:_0x5eed35=_0x2b71a1[_0x2c81('0x68')]?util['format'](_0x2c81('0x8e'),_0x829364[_0x2c81('0x86')],_0x2b71a1[_0x2c81('0x68')]):_0x2c81('0x87');}var _0x14eb14=util[_0x2c81('0x89')](_0x2c81('0x8f'),moment(_0x2b71a1[_0x2c81('0x90')])[_0x2c81('0x89')](_0x2c81('0x91')),_0x2b71a1['direction']==='in'?_0x9d8ec9:_0x5eed35,_0x2b71a1['body']);if(!_0x2b71a1[_0x2c81('0x92')]){fs['appendFileSync'](_0xec56f7,_0x14eb14);}}return db['MailAccount'][_0x2c81('0x4e')]({'where':{'service':!![]},'include':[{'model':db[_0x2c81('0x93')],'as':_0x2c81('0x94'),'raw':!![],'include':[{'model':db[_0x2c81('0x95')],'as':_0x2c81('0x95'),'raw':!![]}]}]});}}})['then'](function(_0x27eb0f){if(!_0x27eb0f||!_0x27eb0f['Smtp']||!_0xfa17b2[_0x2c81('0x2e')])return _0x29116a;var _0x6ea3ae=_0x27eb0f[_0x2c81('0x96')]();return respondWithRpcPromise('SendMail',_0x2c81('0x97'),{'account':_0x6ea3ae,'message':{'from':util[_0x2c81('0x89')](_0x2c81('0x98'),_0x27eb0f['name'],_0x27eb0f[_0x2c81('0x55')]||_0x27eb0f[_0x2c81('0x94')][_0x2c81('0x53')]),'to':_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x7c')],'subject':_0x2c81('0x99'),'text':util[_0x2c81('0x89')](_0x2c81('0x9a'),_0xfa17b2[_0x2c81('0x2e')][_0x2c81('0x7c')]),'attachments':[{'path':_0xec56f7}]}})[_0x2c81('0x17')](function(){return _0x29116a;})['catch'](function(_0x5a5c62){logger[_0x2c81('0x1c')](_0x5a5c62);});})[_0x2c81('0x17')](respondWithStatusCode(_0x3e9d65,0xc8))[_0x2c81('0x39')](handleError(_0x3e9d65,null));};exports['addMessage']=function(_0x17aa03,_0x31debf){return db[_0x2c81('0x81')]['find']({'where':{'id':_0x17aa03[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0x31debf,null))[_0x2c81('0x17')](function(_0x46e63a){if(_0x46e63a){return _0x46e63a[_0x2c81('0x9b')](_0x17aa03[_0x2c81('0x2e')][_0x2c81('0x9c')],_[_0x2c81('0x9d')](_0x17aa03[_0x2c81('0x2e')],[_0x2c81('0x9c'),'id'])||{});}})['then'](respondWithResult(_0x31debf,null))[_0x2c81('0x39')](handleError(_0x31debf,null));};exports[_0x2c81('0x9e')]=function(_0x449854,_0xbf2fba){var _0x59e407={'raw':![],'where':{}};var _0x4459ec={};var _0x43486b={'count':0x0,'rows':[]};return db[_0x2c81('0x47')]['findOne']({'where':{'id':_0x449854[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0xbf2fba,null))[_0x2c81('0x17')](function(_0x3f7df9){if(_0x3f7df9){_0x4459ec['model']=_[_0x2c81('0x3d')](db[_0x2c81('0x81')]['rawAttributes']);_0x4459ec['query']=_[_0x2c81('0x3d')](_0x449854[_0x2c81('0x3e')]);_0x4459ec[_0x2c81('0x9f')]=_['intersection'](_0x4459ec[_0x2c81('0x3c')],_0x4459ec[_0x2c81('0x3e')]);_0x59e407['attributes']=_[_0x2c81('0x3f')](_0x4459ec[_0x2c81('0x3c')],qs[_0x2c81('0x40')](_0x449854[_0x2c81('0x3e')]['fields']));_0x59e407[_0x2c81('0x41')]=_0x59e407[_0x2c81('0x41')][_0x2c81('0x42')]?_0x59e407['attributes']:_0x4459ec[_0x2c81('0x3c')];if(!_0x449854[_0x2c81('0x3e')][_0x2c81('0xa0')](_0x2c81('0xa1'))){_0x59e407['limit']=qs[_0x2c81('0x25')](_0x449854[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x59e407[_0x2c81('0x24')]=qs[_0x2c81('0x24')](_0x449854[_0x2c81('0x3e')][_0x2c81('0x24')]);}_0x59e407[_0x2c81('0xa2')]=qs['sort'](_0x449854[_0x2c81('0x3e')][_0x2c81('0xa3')]);_0x59e407[_0x2c81('0xa4')]=qs[_0x2c81('0x9f')](_[_0x2c81('0xa5')](_0x449854['query'],_0x4459ec['filters']));_0x59e407[_0x2c81('0xa4')]['ChatInteractionId']=_0x3f7df9['id'];if(_0x449854['query']['filter']){_0x59e407[_0x2c81('0xa4')]=_['merge'](_0x59e407[_0x2c81('0xa4')],{'$or':_[_0x2c81('0x34')](_0x59e407[_0x2c81('0x41')],function(_0x5a674a){var _0x150a9b={};_0x150a9b[_0x5a674a]={'$like':'%'+_0x449854['query']['filter']+'%'};return _0x150a9b;})});}if(_0x449854['query'][_0x2c81('0xa6')]){var _0x197530=_0x449854['query'][_0x2c81('0xa6')][_0x2c81('0xa7')](',');var _0x2ba35b={};_0x2ba35b[_0x197530[0x0]]={'$gte':moment(_0x197530[0x1])['format'](_0x2c81('0xa8'))};_0x59e407[_0x2c81('0xa4')]=_[_0x2c81('0x45')](_0x59e407[_0x2c81('0xa4')],_0x2ba35b);}_0x59e407=_[_0x2c81('0x45')]({},_0x59e407,_0x449854[_0x2c81('0x46')]);return db['ChatMessage'][_0x2c81('0x27')]({'where':_0x59e407[_0x2c81('0xa4')]})[_0x2c81('0x17')](function(_0x3bffcf){_0x43486b[_0x2c81('0x27')]=_0x3bffcf;if(_0x449854[_0x2c81('0x3e')]['includeAll']){_0x59e407['include']=[{'all':!![]}];}return db[_0x2c81('0x81')]['findAll'](_0x59e407);})[_0x2c81('0x17')](function(_0x22205a){_0x43486b[_0x2c81('0xa9')]=_0x22205a;return _0x43486b;});}})['then'](respondWithFilteredResult(_0xbf2fba,_0x59e407))[_0x2c81('0x39')](handleError(_0xbf2fba,null));};exports[_0x2c81('0xaa')]=function(_0xd884d8,_0x1edb89){var _0x4b5059={'where':{}},_0x2bbfb6={},_0x470780={'count':0x0,'rows':[]};return db[_0x2c81('0x47')]['findOne']({'where':{'id':_0xd884d8[_0x2c81('0x3b')]['id']}})['then'](handleEntityNotFound(_0x1edb89,null))[_0x2c81('0x17')](function(_0x2e24ca){if(_0x2e24ca){_0x2bbfb6['model']=_[_0x2c81('0x3d')](db['ChatMessage']['rawAttributes']);_0x2bbfb6[_0x2c81('0x3e')]=_[_0x2c81('0x3d')](_0xd884d8[_0x2c81('0x3e')]);_0x2bbfb6[_0x2c81('0x9f')]=_[_0x2c81('0x3f')](_0x2bbfb6[_0x2c81('0x3c')],_0x2bbfb6[_0x2c81('0x3e')]);_0x4b5059[_0x2c81('0x41')]=_[_0x2c81('0x3f')](_0x2bbfb6[_0x2c81('0x3c')],qs[_0x2c81('0x40')](_0xd884d8[_0x2c81('0x3e')][_0x2c81('0x40')]));_0x4b5059['attributes']=_0x4b5059[_0x2c81('0x41')][_0x2c81('0x42')]?_0x4b5059['attributes']:_0x2bbfb6[_0x2c81('0x3c')];if(!_0xd884d8[_0x2c81('0x3e')][_0x2c81('0xa0')]('nolimit')){_0x4b5059[_0x2c81('0x25')]=qs[_0x2c81('0x25')](_0xd884d8[_0x2c81('0x3e')][_0x2c81('0x25')]);_0x4b5059[_0x2c81('0x24')]=qs[_0x2c81('0x24')](_0xd884d8[_0x2c81('0x3e')][_0x2c81('0x24')]);}_0x4b5059[_0x2c81('0xa2')]=qs[_0x2c81('0xa3')](_0xd884d8[_0x2c81('0x3e')]['sort']);_0x4b5059['where']=qs[_0x2c81('0x9f')](_[_0x2c81('0xa5')](_0xd884d8[_0x2c81('0x3e')],_0x2bbfb6[_0x2c81('0x9f')]));_0x4b5059[_0x2c81('0xa4')][_0x2c81('0xab')]=_0x2e24ca['id'];if(_0xd884d8[_0x2c81('0x3e')][_0x2c81('0xac')]){_0x4b5059[_0x2c81('0xa4')]=_['merge'](_0x4b5059['where'],{'$or':_[_0x2c81('0x34')](_0x4b5059[_0x2c81('0x41')],function(_0x2c6e39){var _0x40c65b={};_0x40c65b[_0x2c6e39]={'$like':'%'+_0xd884d8[_0x2c81('0x3e')][_0x2c81('0xac')]+'%'};return _0x40c65b;})});}_0x4b5059[_0x2c81('0xa4')][_0x2c81('0x92')]=![];if(_0xd884d8[_0x2c81('0x3e')]['id']){_0x4b5059[_0x2c81('0xa4')]['id']={'$gt':_0xd884d8[_0x2c81('0x3e')]['id']};}_0x4b5059=_[_0x2c81('0x45')]({},_0x4b5059,_0xd884d8[_0x2c81('0x46')]);return db[_0x2c81('0x81')][_0x2c81('0x27')]({'where':_0x4b5059['where']})[_0x2c81('0x17')](function(_0x43a4f8){_0x470780[_0x2c81('0x27')]=_0x43a4f8;_0x4b5059[_0x2c81('0x44')]=[];if(_0xd884d8[_0x2c81('0x3e')]['includeAgent']){_0x4b5059[_0x2c81('0x44')][_0x2c81('0xad')]({'model':db['User'],'as':_0x2c81('0x83'),'attributes':['id',_0x2c81('0x54'),_0x2c81('0x8d')]});}if(_0xd884d8[_0x2c81('0x3e')]['includeAll']){_0x4b5059[_0x2c81('0x44')]=[{'all':!![]}];}return db[_0x2c81('0x81')][_0x2c81('0x38')](_0x4b5059);})['then'](function(_0x16eafb){_0x470780[_0x2c81('0xa9')]=_0x16eafb;return _0x470780;});}})['then'](respondWithFilteredResult(_0x1edb89,_0x4b5059))['catch'](handleError(_0x1edb89,null));};exports[_0x2c81('0xae')]=function(_0x536d8d,_0x337919){return db[_0x2c81('0x47')]['find']({'where':{'id':_0x536d8d[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0x337919,null))['then'](function(_0x6e391){if(_0x6e391){return _0x6e391['setTags'](_0x536d8d[_0x2c81('0x2e')][_0x2c81('0x9c')],_['omit'](_0x536d8d[_0x2c81('0x2e')],[_0x2c81('0x9c'),'id'])||{})[_0x2c81('0xaf')](function(){return db[_0x2c81('0xb0')][_0x2c81('0x38')]({'attributes':['id',_0x2c81('0x2b'),_0x2c81('0xb1')],'where':{'id':_0x536d8d[_0x2c81('0x2e')][_0x2c81('0x9c')]}});})[_0x2c81('0x17')](function(_0x55b2a9){socket[_0x2c81('0xb2')]('chatInteractionTags:save',{'id':Number(_0x536d8d[_0x2c81('0x3b')]['id']),'tags':_0x55b2a9||[]});return{'id':Number(_0x536d8d[_0x2c81('0x3b')]['id']),'tags':_0x55b2a9||[]};});}})[_0x2c81('0x17')](respondWithResult(_0x337919,null))[_0x2c81('0x39')](handleError(_0x337919,null));};exports[_0x2c81('0xb3')]=function(_0x1a19ed,_0x16cf24){return db['ChatInteraction'][_0x2c81('0x48')]({'where':{'id':_0x1a19ed[_0x2c81('0x3b')]['id']}})[_0x2c81('0x17')](handleEntityNotFound(_0x16cf24,null))[_0x2c81('0x17')](function(_0x4fdfdd){if(_0x4fdfdd){return _0x4fdfdd['removeTags'](_0x1a19ed['query'][_0x2c81('0x9c')]);}})[_0x2c81('0x17')](respondWithStatusCode(_0x16cf24,null))[_0x2c81('0x39')](handleError(_0x16cf24,null));};exports[_0x2c81('0x7a')]=function(_0x2c22e7,_0xf23ba9){var _0x3d3418=moment()['unix']()['toString']();var _0x43ec1e=path[_0x2c81('0x79')](config['root'],_0x2c81('0xb4'),_0x2c81('0xb5'),_0x2c81('0xb6'));var _0x48f479=path[_0x2c81('0x79')](config[_0x2c81('0x76')],_0x2c81('0xb4'),_0x2c81('0xb5'),_0x2c81('0xb7'));var _0x75f8a7=path[_0x2c81('0x79')](_0x43ec1e,_0x3d3418);var _0x8a873b=util[_0x2c81('0x89')](_0x2c81('0xb8'),_0x2c22e7[_0x2c81('0x3b')]['id'],_0x3d3418);var _0x5b2dba=path[_0x2c81('0x79')](_0x43ec1e,_0x8a873b);var _0x5ed7bc=[];_0x5ed7bc[_0x2c81('0xad')]({'model':db['User'],'as':'User','attributes':['id',_0x2c81('0x54')],'raw':!![]});_0x5ed7bc['push']({'model':db[_0x2c81('0x65')],'as':_0x2c81('0xb9'),'attributes':['id',_0x2c81('0xba'),_0x2c81('0xbb')],'raw':!![]});if(_0x2c22e7[_0x2c81('0x3e')][_0x2c81('0xb7')]){_0x5ed7bc[_0x2c81('0xad')]({'model':db[_0x2c81('0x72')],'as':_0x2c81('0x72'),'raw':!![]});}var _0x3f1bda=[{'model':db['ChatMessage'],'as':_0x2c81('0x82'),'attributes':['id',_0x2c81('0x2e'),'createdAt',_0x2c81('0xbc'),'secret','read'],'include':_0x5ed7bc}];_0x3f1bda['push']({'model':db[_0x2c81('0x4d')],'as':_0x2c81('0xbd'),'attributes':['id',_0x2c81('0x2b')]});_0x3f1bda[_0x2c81('0xad')]({'model':db['User'],'as':_0x2c81('0xbe'),'attributes':['id','fullname']});return db[_0x2c81('0x47')][_0x2c81('0x48')]({'where':{'id':_0x2c22e7[_0x2c81('0x3b')]['id']},'include':_0x3f1bda})['then'](handleEntityNotFound(_0xf23ba9,null))[_0x2c81('0x17')](function(_0x336018){if(_0x336018){var _0x162646=_0x336018[_0x2c81('0xbf')]({'plain':!![]});fs[_0x2c81('0xc0')](_0x75f8a7);var _0x4ca785={'channel':_0x2c81('0xc1'),'account':_0x162646[_0x2c81('0xbd')]['name'],'agent':_0x162646['Owner']?_0x162646['Owner'][_0x2c81('0x54')]:_0x2c81('0xc2'),'createdAt':moment(_0x162646[_0x2c81('0x90')])[_0x2c81('0x89')](_0x2c81('0xa8'))['toString'](),'closedAt':_0x162646[_0x2c81('0x69')]?moment(_0x162646[_0x2c81('0xc3')])['format'](_0x2c81('0xa8'))[_0x2c81('0xc4')]():'','disposition':_0x162646[_0x2c81('0x6a')],'chatInfo':{'browser':_0x162646[_0x2c81('0xc5')],'os':_0x162646[_0x2c81('0xc6')],'referer':_0x162646['referer'],'customerIp':_0x162646['customerIp'],'customerPort':_0x162646[_0x2c81('0xc7')]?_0x162646[_0x2c81('0xc7')]:'N.A.'},'messages':_(_0x162646[_0x2c81('0x82')])[_0x2c81('0xc8')]()[_0x2c81('0xac')]({'secret':![]})[_0x2c81('0x34')](function(_0x5e1b23){if(_0x5e1b23[_0x2c81('0x72')]){var _0x7fdfe6=path['join'](_0x48f479,_0x5e1b23['Attachment'][_0x2c81('0x6f')]);if(fs[_0x2c81('0xc9')](_0x7fdfe6)){fs[_0x2c81('0xca')](_0x7fdfe6)[_0x2c81('0xcb')](fs[_0x2c81('0xcc')](path[_0x2c81('0x79')](_0x75f8a7,_0x5e1b23[_0x2c81('0x72')][_0x2c81('0x6f')])));}}return{'date':moment(_0x5e1b23['createdAt'])[_0x2c81('0x89')](_0x2c81('0xa8'))[_0x2c81('0xc4')](),'sender':_0x5e1b23[_0x2c81('0xbc')]===_0x2c81('0x61')?_0x5e1b23['User']?_0x5e1b23[_0x2c81('0x83')][_0x2c81('0x54')]:_0x2c81('0x87'):_0x5e1b23[_0x2c81('0xb9')][_0x2c81('0xba')]+(_0x5e1b23[_0x2c81('0xb9')]['lastName']?'\x20'+_0x5e1b23['Contact'][_0x2c81('0xbb')]:''),'body':_0x5e1b23[_0x2c81('0x72')]?_0x5e1b23['Attachment'][_0x2c81('0x6f')]:_0x5e1b23[_0x2c81('0x2e')],'direction':_0x5e1b23[_0x2c81('0xbc')]===_0x2c81('0x61')?'A':'C','secret':_0x5e1b23[_0x2c81('0x92')],'read':_0x5e1b23['read'],'attachment':_0x5e1b23['Attachment']};})[_0x2c81('0xcd')]()};return ejs[_0x2c81('0xce')](path['join'](config[_0x2c81('0x76')],_0x2c81('0xb4'),_0x2c81('0xcf'),_0x2c81('0xd0')),{'interaction':_0x4ca785})[_0x2c81('0x17')](function(_0x1c05b2){var _0x20d06d=path[_0x2c81('0x79')](_0x75f8a7,_0x2c81('0xd1')+_0x162646['id']+'-'+_0x3d3418+_0x2c81('0xd2'));var _0xd3637c={'path':_0x20d06d,'channel':_0x2c81('0xc1'),'interactionId':_0x162646['id']};return pdf[_0x2c81('0xd3')](_0x1c05b2,_0xd3637c);})[_0x2c81('0x17')](function(){return new Promise(function(_0x39d415,_0x1dbf95){zipdir(_0x75f8a7,{'saveTo':_0x5b2dba},function(_0x379c7a,_0x3e7be0){if(_0x379c7a)return _0x1dbf95(_0x379c7a);return _0x39d415(_0x3e7be0);});})['then'](function(){return new BPromise(function(_0x322aaa,_0x3ef971){rimraf(_0x75f8a7,function(_0x54af54){if(_0x54af54)_0x3ef971(_0x54af54);return _0x322aaa();});});})[_0x2c81('0x17')](function(){return _0xf23ba9['download'](_0x5b2dba,_0x8a873b,function(_0x4421a3){if(_0x4421a3){logger[_0x2c81('0x1c')](_0x2c81('0xd4'),_0x4421a3);}else{fs[_0x2c81('0xd5')](_0x5b2dba);}});});});}else{return _0xf23ba9['sendStatus'](0xc8);}})[_0x2c81('0x39')](handleError(_0xf23ba9,null));}; \ No newline at end of file +var _0xb756=['Account','Owner','Chat','N.A.','osName','customerIp','customerPort','tail','existsSync','createReadStream','createWriteStream','lastName','renderFile','views','transcript-','err','unlinkSync','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./chatInteraction.socket','register','jayson/promise','http','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatInteraction,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','limit','undefined','set','stack','send','render','merge','body','agent','interaction','account','index','map','ChatInteraction','fieldName','type','getOptions','findAll','chat','query','show','params','model','rawAttributes','intersection','fields','attributes','length','includeAll','include','options','find','create','update','destroy','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooEscalation','vidaooNote','vidaooMetadata','vidaooApiKey','user','name','fullname','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Sequelize','ValidationError','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','UserId','Interaction\x20already\x20assigned','disposition','AbandonInteraction','attachmentUpload','file','basename','mimetype','closed','Attachment','attachId','ChatOfflineMessageId','join','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','User','ContactId','Messages','%s%d','agentAlias','System','customer','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','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','omit','keys','hasOwnProperty','nolimit','order','sort','where','filters','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','count','getMyMessages','pick','includeAgent','push','rows','addTags','setTags','ids','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','transcript-%d-%s.zip','firstName','attachments','read'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0xb756,0x1ad));var _0x6b75=function(_0x452cc3,_0x3bca5c){_0x452cc3=_0x452cc3-0x0;var _0x10bd3e=_0xb756[_0x452cc3];return _0x10bd3e;};'use strict';var rimraf=require(_0x6b75('0x0'));var zipdir=require(_0x6b75('0x1'));var rp=require(_0x6b75('0x2'));var moment=require(_0x6b75('0x3'));var BPromise=require(_0x6b75('0x4'));var Mustache=require(_0x6b75('0x5'));var util=require('util');var path=require(_0x6b75('0x6'));var ejs=require(_0x6b75('0x7'));var fs=require('fs');var _=require(_0x6b75('0x8'));var Redis=require('ioredis');var interaction=require(_0x6b75('0x9'));var qs=require(_0x6b75('0xa'));var pdf=require('../../components/export/pdf');var logger=require(_0x6b75('0xb'))(_0x6b75('0xc'));var config=require(_0x6b75('0xd'));var db=require(_0x6b75('0xe'))['db'];config[_0x6b75('0xf')]=_[_0x6b75('0x10')](config[_0x6b75('0xf')],{'host':_0x6b75('0x11'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6b75('0x12'))[_0x6b75('0x13')](socket);var jayson=require(_0x6b75('0x14'));var client=jayson['client'][_0x6b75('0x15')]({'port':0x232b});var client9004=jayson['client'][_0x6b75('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x1f49d2,_0x518073,_0x2b8fdc,_0x5a4bcd){return new BPromise(function(_0x233d4c,_0xa542ab){var _0x9f95c6=_0x5a4bcd||client;return _0x9f95c6['request'](_0x1f49d2,_0x2b8fdc)[_0x6b75('0x16')](function(_0x18d73d){logger[_0x6b75('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x518073,_0x6b75('0x18'));logger[_0x6b75('0x19')](_0x6b75('0x1a'),_0x518073,_0x6b75('0x18'),JSON[_0x6b75('0x1b')](_0x18d73d));if(_0x18d73d[_0x6b75('0x1c')]){if(_0x18d73d[_0x6b75('0x1c')][_0x6b75('0x1d')]===0x1f4){logger['error']('ChatInteraction,\x20%s,\x20%s',_0x518073,_0x18d73d[_0x6b75('0x1c')][_0x6b75('0x1e')]);return _0xa542ab(_0x18d73d[_0x6b75('0x1c')][_0x6b75('0x1e')]);}logger['error'](_0x6b75('0x1f'),_0x518073,_0x18d73d[_0x6b75('0x1c')][_0x6b75('0x1e')]);return _0x233d4c(_0x18d73d[_0x6b75('0x1c')][_0x6b75('0x1e')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x518073,_0x6b75('0x18'));_0x233d4c(_0x18d73d[_0x6b75('0x20')][_0x6b75('0x1e')]);}})[_0x6b75('0x21')](function(_0xe8fe47){logger[_0x6b75('0x1c')](_0x6b75('0x1f'),_0x518073,_0xe8fe47);_0xa542ab(_0xe8fe47);});});}function respondWithStatusCode(_0xa272b1,_0x12c6f4){_0x12c6f4=_0x12c6f4||0xcc;return function(_0x45b8cf){if(_0x45b8cf){return _0xa272b1[_0x6b75('0x22')](_0x12c6f4);}return _0xa272b1['status'](_0x12c6f4)[_0x6b75('0x23')]();};}function respondWithResult(_0x3e237a,_0x61ddc1){_0x61ddc1=_0x61ddc1||0xc8;return function(_0x34b331){if(_0x34b331){return _0x3e237a[_0x6b75('0x24')](_0x61ddc1)[_0x6b75('0x25')](_0x34b331);}};}function respondWithFilteredResult(_0x39eeec,_0x227981){return function(_0x2b96f4){if(_0x2b96f4){var _0x100558=typeof _0x227981[_0x6b75('0x26')]==='undefined'&&typeof _0x227981[_0x6b75('0x27')]===_0x6b75('0x28');var _0x28ac45=_0x2b96f4['count'];var _0x3e6788=_0x100558?0x0:_0x227981[_0x6b75('0x26')];var _0x146ee3=_0x100558?_0x2b96f4['count']:_0x227981[_0x6b75('0x26')]+_0x227981['limit'];var _0x4deda9;if(_0x146ee3>=_0x28ac45){_0x146ee3=_0x28ac45;_0x4deda9=0xc8;}else{_0x4deda9=0xce;}_0x39eeec[_0x6b75('0x24')](_0x4deda9);return _0x39eeec[_0x6b75('0x29')]('Content-Range',_0x3e6788+'-'+_0x146ee3+'/'+_0x28ac45)[_0x6b75('0x25')](_0x2b96f4);}return null;};}function saveUpdates(_0xd36dd5){return function(_0x3a36fc){if(_0x3a36fc){return _0x3a36fc['update'](_0xd36dd5)['then'](function(_0xe64f4a){return _0xe64f4a;});}return null;};}function removeEntity(_0x4ccfe2){return function(_0x352468){if(_0x352468){return _0x352468['destroy']()[_0x6b75('0x16')](function(){_0x4ccfe2[_0x6b75('0x24')](0xcc)[_0x6b75('0x23')]();});}};}function handleEntityNotFound(_0xa0e51f){return function(_0x2d259e){if(!_0x2d259e){_0xa0e51f[_0x6b75('0x22')](0x194);}return _0x2d259e;};}function handleError(_0x43d801,_0xb9a32e){_0xb9a32e=_0xb9a32e||0x1f4;return function(_0x3ff043){logger['error'](_0x3ff043[_0x6b75('0x2a')]);if(_0x3ff043['name']){delete _0x3ff043['name'];}_0x43d801['status'](_0xb9a32e)[_0x6b75('0x2b')](_0x3ff043);};}function getMustacheRender(_0x36e811,_0x534e63){return Mustache[_0x6b75('0x2c')](_0x36e811,_[_0x6b75('0x2d')](_0x534e63[_0x6b75('0x2e')],{'contact':_0x534e63['contact'],'message':_0x534e63[_0x6b75('0x1e')],'agent':_0x534e63[_0x6b75('0x2f')],'interaction':_0x534e63[_0x6b75('0x30')],'account':_0x534e63[_0x6b75('0x31')]}))||'';}exports[_0x6b75('0x32')]=function(_0x4ec2e1,_0x1f9e83){var _0x4327e9={};var _0x3c0044=_[_0x6b75('0x33')](db[_0x6b75('0x34')]['rawAttributes'],function(_0x358725){return{'name':_0x358725[_0x6b75('0x35')],'type':_0x358725[_0x6b75('0x36')]['key']};});_0x4327e9=qs[_0x6b75('0x37')](_0x3c0044,_0x4ec2e1);return interaction[_0x6b75('0x38')](_0x6b75('0x39'),_0x4ec2e1[_0x6b75('0x3a')],_0x4ec2e1['user'],_0x4327e9,_0x3c0044)[_0x6b75('0x16')](respondWithFilteredResult(_0x1f9e83,_0x4327e9))[_0x6b75('0x21')](handleError(_0x1f9e83,null));};exports[_0x6b75('0x3b')]=function(_0x369a18,_0x271ec5){var _0x22bf49={'raw':![],'where':{'id':_0x369a18[_0x6b75('0x3c')]['id']}},_0x2945b6={};_0x2945b6[_0x6b75('0x3d')]=_['keys'](db[_0x6b75('0x34')][_0x6b75('0x3e')]);_0x2945b6[_0x6b75('0x3a')]=_['keys'](_0x369a18['query']);_0x2945b6['filters']=_[_0x6b75('0x3f')](_0x2945b6[_0x6b75('0x3d')],_0x2945b6['query']);_0x22bf49['attributes']=_[_0x6b75('0x3f')](_0x2945b6['model'],qs[_0x6b75('0x40')](_0x369a18[_0x6b75('0x3a')][_0x6b75('0x40')]));_0x22bf49['attributes']=_0x22bf49[_0x6b75('0x41')][_0x6b75('0x42')]?_0x22bf49['attributes']:_0x2945b6[_0x6b75('0x3d')];if(_0x369a18[_0x6b75('0x3a')][_0x6b75('0x43')]){_0x22bf49[_0x6b75('0x44')]=[{'all':!![]}];}_0x22bf49=_[_0x6b75('0x2d')]({},_0x22bf49,_0x369a18[_0x6b75('0x45')]);return db[_0x6b75('0x34')][_0x6b75('0x46')](_0x22bf49)[_0x6b75('0x16')](handleEntityNotFound(_0x271ec5,null))[_0x6b75('0x16')](respondWithResult(_0x271ec5,null))[_0x6b75('0x21')](handleError(_0x271ec5,null));};exports[_0x6b75('0x47')]=function(_0x58374b,_0xb4f0d5){return db[_0x6b75('0x34')]['create'](_0x58374b[_0x6b75('0x2e')],{})['then'](respondWithResult(_0xb4f0d5,0xc9))['catch'](handleError(_0xb4f0d5,null));};exports[_0x6b75('0x48')]=function(_0x53d787,_0x394248){if(_0x53d787[_0x6b75('0x2e')]['id']){delete _0x53d787[_0x6b75('0x2e')]['id'];}return db[_0x6b75('0x34')][_0x6b75('0x46')]({'where':{'id':_0x53d787[_0x6b75('0x3c')]['id']}})[_0x6b75('0x16')](handleEntityNotFound(_0x394248,null))[_0x6b75('0x16')](saveUpdates(_0x53d787[_0x6b75('0x2e')],null))[_0x6b75('0x16')](respondWithResult(_0x394248,null))['catch'](handleError(_0x394248,null));};exports[_0x6b75('0x49')]=function(_0xd056e0,_0x53fef3){return db[_0x6b75('0x34')]['find']({'where':{'id':_0xd056e0[_0x6b75('0x3c')]['id']}})[_0x6b75('0x16')](handleEntityNotFound(_0x53fef3,null))['then'](removeEntity(_0x53fef3,null))[_0x6b75('0x21')](handleError(_0x53fef3,null));};exports['describe']=function(_0x15f41e,_0x42f0ca){return db[_0x6b75('0x34')][_0x6b75('0x4a')]()[_0x6b75('0x16')](respondWithResult(_0x42f0ca,null))[_0x6b75('0x21')](handleError(_0x42f0ca,null));};exports['createVidaooSession']=function(_0x4599e0,_0x1f2cc0){var _0x1379fc=_0x4599e0[_0x6b75('0x3c')]['id'];var _0x13094a;var _0x343e79;var _0x57efa5;return db[_0x6b75('0x34')][_0x6b75('0x4b')]({'where':{'id':_0x1379fc}})[_0x6b75('0x16')](function(_0x2dc813){_0x13094a=_0x2dc813;return db[_0x6b75('0x4c')][_0x6b75('0x4b')]({'where':{'id':_0x2dc813[_0x6b75('0x4d')]},'attributes':['id','vidaooApiKey',_0x6b75('0x4e'),'vidaooTopic',_0x6b75('0x4f'),_0x6b75('0x50')],'raw':!![]});})['then'](function(_0x193aaf){if(_0x193aaf&&_0x193aaf[_0x6b75('0x51')]&&_0x193aaf[_0x6b75('0x4e')]){_0x343e79=_0x193aaf;var _0x5990bd={'interaction':{'id':_0x1379fc},'agent':{'id':_0x4599e0[_0x6b75('0x52')]['id'],'name':_0x4599e0[_0x6b75('0x52')][_0x6b75('0x53')],'fullname':_0x4599e0['user'][_0x6b75('0x54')],'email':_0x4599e0[_0x6b75('0x52')]['email']},'contact':_0x4599e0['body'][_0x6b75('0x55')],'account':_0x4599e0['body'][_0x6b75('0x31')]};var _0xe07baa={'rejectUnauthorized':![],'method':_0x6b75('0x56'),'url':_0x6b75('0x57'),'headers':{'X-APIKEY':_0x193aaf[_0x6b75('0x51')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4599e0['user']['email']],'buttons':null,'topic':_0x343e79['vidaooTopic'],'note':_[_0x6b75('0x58')](_0x343e79[_0x6b75('0x4f')])?null:getMustacheRender(_0x343e79[_0x6b75('0x4f')],_0x5990bd),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0x6b75('0x58')](_0x343e79[_0x6b75('0x50')])){var _0x3e4b53=getMustacheRender(_0x343e79[_0x6b75('0x50')],_0x5990bd);var _0x37a5f2=JSON[_0x6b75('0x59')](_0x3e4b53);_0xe07baa[_0x6b75('0x2e')][_0x6b75('0x5a')]=_0x37a5f2;}}catch(_0x306dbe){throw new db[(_0x6b75('0x5b'))]['ValidationError']('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0xe07baa);}else{throw new db[(_0x6b75('0x5b'))][(_0x6b75('0x5c'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x6b75('0x16')](function(_0x428437){_0x57efa5=_0x428437;if(_0x57efa5['id']){var _0x5af184={'body':_0x57efa5[_0x6b75('0x5d')],'ChatWebsiteId':_0x343e79['id'],'ChatInteractionId':_0x13094a['id'],'direction':_0x6b75('0x5e'),'UserId':_0x4599e0[_0x6b75('0x52')]['id']};return db[_0x6b75('0x5f')]['create'](_0x5af184,{});}else{throw new db[(_0x6b75('0x5b'))]['ValidationError'](_0x6b75('0x60'));}})['then'](function(){return _0x13094a[_0x6b75('0x61')]({'vidaooSessionId':_0x57efa5['id']});})[_0x6b75('0x16')](respondWithResult(_0x1f2cc0,null))[_0x6b75('0x21')](handleError(_0x1f2cc0,null));};exports[_0x6b75('0x62')]=function(_0x1e3b2d,_0xc7bfd6){if(_0x1e3b2d[_0x6b75('0x2e')]['id']){delete _0x1e3b2d[_0x6b75('0x2e')]['id'];}return db[_0x6b75('0x34')][_0x6b75('0x46')]({'where':{'id':_0x1e3b2d[_0x6b75('0x3c')]['id']},'include':[{'model':db[_0x6b75('0x63')],'as':_0x6b75('0x64')}]})[_0x6b75('0x16')](handleEntityNotFound(_0xc7bfd6,null))[_0x6b75('0x16')](saveUpdates(_0x1e3b2d[_0x6b75('0x2e')],null))[_0x6b75('0x16')](respondWithResult(_0xc7bfd6,null))[_0x6b75('0x21')](handleError(_0xc7bfd6,null));};exports[_0x6b75('0x65')]=function(_0x5b4c50,_0x4a3e72){if(_0x5b4c50[_0x6b75('0x2e')]['id']){delete _0x5b4c50[_0x6b75('0x2e')]['id'];}return db[_0x6b75('0x34')][_0x6b75('0x46')]({'where':{'id':_0x5b4c50[_0x6b75('0x3c')]['id']}})['then'](function(_0x2eb25a){if(!_0x2eb25a){logger[_0x6b75('0x1c')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x6b75('0x65'),0x194,'entity\x20not\x20found');_0x4a3e72['sendStatus'](0x194);}else{if(_0x2eb25a[_0x6b75('0x66')]){throw new db[(_0x6b75('0x5b'))][(_0x6b75('0x5c'))](_0x6b75('0x67'));}}return _0x2eb25a;})[_0x6b75('0x16')](function(_0x4f2c18){if(_0x4f2c18){return _0x4f2c18[_0x6b75('0x48')]({'closed':_0x5b4c50['body']['closed'],'disposition':_0x5b4c50['body'][_0x6b75('0x68')]})['then'](function(_0x38ac48){return _0x38ac48;});}})[_0x6b75('0x16')](function(){return respondWithRpcPromise(_0x6b75('0x69'),_0x6b75('0x65'),_0x5b4c50[_0x6b75('0x2e')],client9004);})[_0x6b75('0x16')](respondWithResult(_0x4a3e72,null))[_0x6b75('0x21')](handleError(_0x4a3e72,null));};exports[_0x6b75('0x6a')]=function(_0x6920a6,_0x33215b){_0x6920a6['body'][_0x6b75('0x53')]=_0x6920a6[_0x6b75('0x6b')]['originalname'];_0x6920a6['body'][_0x6b75('0x6c')]=_0x6920a6[_0x6b75('0x6b')]['filename'];_0x6920a6[_0x6b75('0x2e')][_0x6b75('0x36')]=_0x6920a6[_0x6b75('0x6b')][_0x6b75('0x6d')];return db['Attachment']['create'](_0x6920a6[_0x6b75('0x2e')])[_0x6b75('0x16')](respondWithResult(_0x33215b,0xc9))[_0x6b75('0x21')](handleError(_0x33215b,null));};exports['attachmentDownload']=function(_0x3fd977,_0x2f296c){return db[_0x6b75('0x34')]['findOne']({'where':{'id':_0x3fd977[_0x6b75('0x3c')]['id']},'raw':!![]})[_0x6b75('0x16')](handleEntityNotFound(_0x2f296c,null))[_0x6b75('0x16')](function(_0x154093){if(_0x154093){if(_0x154093[_0x6b75('0x6e')]){return _0x2f296c[_0x6b75('0x24')](0x193)['json']({'status':0x193,'message':'Unauthorized'});}return db[_0x6b75('0x6f')][_0x6b75('0x4b')]({'where':{'id':_0x3fd977[_0x6b75('0x3a')][_0x6b75('0x70')]},'raw':!![]})['then'](handleEntityNotFound(_0x2f296c,null));}})['then'](function(_0x3b6e0b){if(_0x3b6e0b){var _0x41053b=_0x3b6e0b[_0x6b75('0x71')]!==null;var _0x15d271=path[_0x6b75('0x72')](config['root'],'server/files/attachments/');if(_0x41053b){_0x15d271=path['join'](_0x15d271,_0x6b75('0x73'));}var _0x1253cd=path[_0x6b75('0x72')](_0x15d271,_0x3b6e0b[_0x6b75('0x6c')]);return _0x2f296c[_0x6b75('0x74')](_0x1253cd);}})[_0x6b75('0x21')](handleError(_0x2f296c,null));};exports[_0x6b75('0x75')]=function(_0xd0e87f,_0x237d49){var _0x15f925=null;var _0x2f609b=null;var _0x299e00=null;if(_0xd0e87f[_0x6b75('0x2e')]['id']){delete _0xd0e87f['body']['id'];}if(_0xd0e87f[_0x6b75('0x2e')][_0x6b75('0x76')]){_0x299e00=path[_0x6b75('0x72')](config[_0x6b75('0x77')],_0x6b75('0x78'),util[_0x6b75('0x79')](_0x6b75('0x7a'),Date[_0x6b75('0x7b')]()));_0xd0e87f[_0x6b75('0x2e')][_0x6b75('0x7c')]=_0x299e00;}return db['ChatInteraction'][_0x6b75('0x46')]({'where':{'id':_0xd0e87f[_0x6b75('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db['User'],'as':_0x6b75('0x7d')}]}]})[_0x6b75('0x16')](handleEntityNotFound(_0x237d49,null))[_0x6b75('0x16')](saveUpdates(_0xd0e87f[_0x6b75('0x2e')],null))[_0x6b75('0x16')](function(_0x5504bd){if(_0x5504bd){_0x15f925=_0x5504bd;return db[_0x6b75('0x4c')][_0x6b75('0x46')]({'where':{'id':_0x15f925[_0x6b75('0x4d')]}});}})[_0x6b75('0x16')](function(_0x2915ba){if(_0x2915ba){_0x2f609b=_0x2915ba;return db['CmContact'][_0x6b75('0x46')]({'where':{'id':_0x15f925[_0x6b75('0x7e')]}});}})['then'](function(_0x7ca95b){if(_0x7ca95b){if(_0x299e00){var _0x635251=null;for(var _0x5bcefd=0x1;_0x5bcefd<_0x15f925[_0x6b75('0x7f')]['length'];++_0x5bcefd){_0x635251=_0x15f925[_0x6b75('0x7f')][_0x5bcefd];var _0x3567a9=_0x635251['UserId']?util[_0x6b75('0x79')](_0x6b75('0x80'),_0x2f609b[_0x6b75('0x81')],_0x635251[_0x6b75('0x66')]):_0x6b75('0x82');var _0x5ad712=_0xd0e87f[_0x6b75('0x2e')][_0x6b75('0x83')]||util[_0x6b75('0x79')](_0x6b75('0x80'),_0x6b75('0x84'),_0x635251[_0x6b75('0x7e')]);switch(_0x2f609b[_0x6b75('0x85')]){case _0x6b75('0x86'):_0x3567a9=_0x635251[_0x6b75('0x66')]?util['format'](_0x6b75('0x80'),_0x2f609b[_0x6b75('0x81')],_0x635251[_0x6b75('0x66')]):'System';break;case _0x6b75('0x87'):_0x3567a9=_0x635251[_0x6b75('0x66')]?_0x635251['User'][_0x6b75('0x88')]||_0x635251[_0x6b75('0x7d')][_0x6b75('0x54')]:_0x6b75('0x82');break;case _0x6b75('0x89'):_0x3567a9=_0x635251['UserId']?_0x635251[_0x6b75('0x7d')][_0x6b75('0x54')]:_0x6b75('0x82');break;default:_0x3567a9=_0x635251[_0x6b75('0x66')]?util[_0x6b75('0x79')](_0x6b75('0x80'),_0x2f609b['agentAlias'],_0x635251[_0x6b75('0x66')]):_0x6b75('0x82');}var _0x4395bf=util[_0x6b75('0x79')]('[%s]\x20%s:\x20%s\x0a',moment(_0x635251[_0x6b75('0x8a')])[_0x6b75('0x79')](_0x6b75('0x8b')),_0x635251[_0x6b75('0x8c')]==='in'?_0x5ad712:_0x3567a9,_0x635251[_0x6b75('0x2e')]);if(!_0x635251[_0x6b75('0x8d')]){fs[_0x6b75('0x8e')](_0x299e00,_0x4395bf);}}return db[_0x6b75('0x8f')][_0x6b75('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x6b75('0x90')],'as':_0x6b75('0x91'),'raw':!![],'include':[{'model':db[_0x6b75('0x92')],'as':_0x6b75('0x92'),'raw':!![]}]}]});}}})[_0x6b75('0x16')](function(_0x3d4095){if(!_0x3d4095||!_0x3d4095[_0x6b75('0x91')]||!_0xd0e87f[_0x6b75('0x2e')])return _0x15f925;var _0x5c84c5=_0x3d4095[_0x6b75('0x93')]();return respondWithRpcPromise(_0x6b75('0x94'),_0x6b75('0x95'),{'account':_0x5c84c5,'message':{'from':util['format'](_0x6b75('0x96'),_0x3d4095[_0x6b75('0x53')],_0x3d4095['email']||_0x3d4095['Smtp'][_0x6b75('0x52')]),'to':_0xd0e87f[_0x6b75('0x2e')][_0x6b75('0x76')],'subject':_0x6b75('0x97'),'text':util['format'](_0x6b75('0x98'),_0xd0e87f[_0x6b75('0x2e')][_0x6b75('0x76')]),'attachments':[{'path':_0x299e00}]}})['then'](function(){return _0x15f925;})[_0x6b75('0x21')](function(_0x57d6e0){logger[_0x6b75('0x1c')](_0x57d6e0);});})[_0x6b75('0x16')](respondWithStatusCode(_0x237d49,0xc8))[_0x6b75('0x21')](handleError(_0x237d49,null));};exports[_0x6b75('0x99')]=function(_0x27ba08,_0x1df24d){return db[_0x6b75('0x5f')][_0x6b75('0x46')]({'where':{'id':_0x27ba08[_0x6b75('0x3c')]['id']}})[_0x6b75('0x16')](handleEntityNotFound(_0x1df24d,null))[_0x6b75('0x16')](function(_0x3b3e48){if(_0x3b3e48){return _0x3b3e48[_0x6b75('0x99')](_0x27ba08[_0x6b75('0x2e')]['ids'],_[_0x6b75('0x9a')](_0x27ba08['body'],['ids','id'])||{});}})[_0x6b75('0x16')](respondWithResult(_0x1df24d,null))['catch'](handleError(_0x1df24d,null));};exports['getMessages']=function(_0x15cb5a,_0x1fabea){var _0x5c12f9={'raw':![],'where':{}};var _0x592c5a={};var _0x1e3a31={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6b75('0x4b')]({'where':{'id':_0x15cb5a[_0x6b75('0x3c')]['id']}})['then'](handleEntityNotFound(_0x1fabea,null))[_0x6b75('0x16')](function(_0x37bfa8){if(_0x37bfa8){_0x592c5a[_0x6b75('0x3d')]=_['keys'](db[_0x6b75('0x5f')][_0x6b75('0x3e')]);_0x592c5a[_0x6b75('0x3a')]=_[_0x6b75('0x9b')](_0x15cb5a['query']);_0x592c5a['filters']=_[_0x6b75('0x3f')](_0x592c5a[_0x6b75('0x3d')],_0x592c5a[_0x6b75('0x3a')]);_0x5c12f9[_0x6b75('0x41')]=_[_0x6b75('0x3f')](_0x592c5a[_0x6b75('0x3d')],qs[_0x6b75('0x40')](_0x15cb5a[_0x6b75('0x3a')]['fields']));_0x5c12f9[_0x6b75('0x41')]=_0x5c12f9[_0x6b75('0x41')][_0x6b75('0x42')]?_0x5c12f9[_0x6b75('0x41')]:_0x592c5a[_0x6b75('0x3d')];if(!_0x15cb5a['query'][_0x6b75('0x9c')](_0x6b75('0x9d'))){_0x5c12f9[_0x6b75('0x27')]=qs[_0x6b75('0x27')](_0x15cb5a[_0x6b75('0x3a')][_0x6b75('0x27')]);_0x5c12f9[_0x6b75('0x26')]=qs[_0x6b75('0x26')](_0x15cb5a[_0x6b75('0x3a')][_0x6b75('0x26')]);}_0x5c12f9[_0x6b75('0x9e')]=qs[_0x6b75('0x9f')](_0x15cb5a['query'][_0x6b75('0x9f')]);_0x5c12f9[_0x6b75('0xa0')]=qs[_0x6b75('0xa1')](_['pick'](_0x15cb5a['query'],_0x592c5a[_0x6b75('0xa1')]));_0x5c12f9['where'][_0x6b75('0xa2')]=_0x37bfa8['id'];if(_0x15cb5a['query'][_0x6b75('0xa3')]){_0x5c12f9[_0x6b75('0xa0')]=_[_0x6b75('0x2d')](_0x5c12f9[_0x6b75('0xa0')],{'$or':_[_0x6b75('0x33')](_0x5c12f9['attributes'],function(_0x5c718e){var _0x5c39a6={};_0x5c39a6[_0x5c718e]={'$like':'%'+_0x15cb5a['query'][_0x6b75('0xa3')]+'%'};return _0x5c39a6;})});}if(_0x15cb5a['query'][_0x6b75('0xa4')]){var _0xa40e72=_0x15cb5a['query'][_0x6b75('0xa4')][_0x6b75('0xa5')](',');var _0x30a01f={};_0x30a01f[_0xa40e72[0x0]]={'$gte':moment(_0xa40e72[0x1])['format'](_0x6b75('0xa6'))};_0x5c12f9[_0x6b75('0xa0')]=_[_0x6b75('0x2d')](_0x5c12f9[_0x6b75('0xa0')],_0x30a01f);}_0x5c12f9=_['merge']({},_0x5c12f9,_0x15cb5a[_0x6b75('0x45')]);return db[_0x6b75('0x5f')][_0x6b75('0xa7')]({'where':_0x5c12f9[_0x6b75('0xa0')]})['then'](function(_0x3b5e64){_0x1e3a31[_0x6b75('0xa7')]=_0x3b5e64;if(_0x15cb5a['query'][_0x6b75('0x43')]){_0x5c12f9[_0x6b75('0x44')]=[{'all':!![]}];}return db[_0x6b75('0x5f')][_0x6b75('0x38')](_0x5c12f9);})['then'](function(_0x2ba9aa){_0x1e3a31['rows']=_0x2ba9aa;return _0x1e3a31;});}})[_0x6b75('0x16')](respondWithFilteredResult(_0x1fabea,_0x5c12f9))[_0x6b75('0x21')](handleError(_0x1fabea,null));};exports[_0x6b75('0xa8')]=function(_0x52e82f,_0x52b83e){var _0x512c34={'where':{}},_0x4abdc4={},_0x6fadca={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x6b75('0x4b')]({'where':{'id':_0x52e82f[_0x6b75('0x3c')]['id']}})[_0x6b75('0x16')](handleEntityNotFound(_0x52b83e,null))['then'](function(_0x1f61a1){if(_0x1f61a1){_0x4abdc4[_0x6b75('0x3d')]=_[_0x6b75('0x9b')](db[_0x6b75('0x5f')]['rawAttributes']);_0x4abdc4['query']=_[_0x6b75('0x9b')](_0x52e82f['query']);_0x4abdc4[_0x6b75('0xa1')]=_[_0x6b75('0x3f')](_0x4abdc4[_0x6b75('0x3d')],_0x4abdc4[_0x6b75('0x3a')]);_0x512c34[_0x6b75('0x41')]=_[_0x6b75('0x3f')](_0x4abdc4[_0x6b75('0x3d')],qs[_0x6b75('0x40')](_0x52e82f[_0x6b75('0x3a')]['fields']));_0x512c34[_0x6b75('0x41')]=_0x512c34['attributes'][_0x6b75('0x42')]?_0x512c34[_0x6b75('0x41')]:_0x4abdc4[_0x6b75('0x3d')];if(!_0x52e82f[_0x6b75('0x3a')][_0x6b75('0x9c')](_0x6b75('0x9d'))){_0x512c34['limit']=qs[_0x6b75('0x27')](_0x52e82f[_0x6b75('0x3a')][_0x6b75('0x27')]);_0x512c34[_0x6b75('0x26')]=qs[_0x6b75('0x26')](_0x52e82f['query'][_0x6b75('0x26')]);}_0x512c34[_0x6b75('0x9e')]=qs['sort'](_0x52e82f[_0x6b75('0x3a')][_0x6b75('0x9f')]);_0x512c34[_0x6b75('0xa0')]=qs[_0x6b75('0xa1')](_[_0x6b75('0xa9')](_0x52e82f[_0x6b75('0x3a')],_0x4abdc4['filters']));_0x512c34[_0x6b75('0xa0')][_0x6b75('0xa2')]=_0x1f61a1['id'];if(_0x52e82f[_0x6b75('0x3a')]['filter']){_0x512c34['where']=_[_0x6b75('0x2d')](_0x512c34[_0x6b75('0xa0')],{'$or':_[_0x6b75('0x33')](_0x512c34[_0x6b75('0x41')],function(_0x450c30){var _0x490eab={};_0x490eab[_0x450c30]={'$like':'%'+_0x52e82f[_0x6b75('0x3a')][_0x6b75('0xa3')]+'%'};return _0x490eab;})});}_0x512c34[_0x6b75('0xa0')]['secret']=![];if(_0x52e82f[_0x6b75('0x3a')]['id']){_0x512c34[_0x6b75('0xa0')]['id']={'$gt':_0x52e82f[_0x6b75('0x3a')]['id']};}_0x512c34=_['merge']({},_0x512c34,_0x52e82f['options']);return db[_0x6b75('0x5f')][_0x6b75('0xa7')]({'where':_0x512c34[_0x6b75('0xa0')]})[_0x6b75('0x16')](function(_0x45b411){_0x6fadca[_0x6b75('0xa7')]=_0x45b411;_0x512c34['include']=[];if(_0x52e82f[_0x6b75('0x3a')][_0x6b75('0xaa')]){_0x512c34[_0x6b75('0x44')][_0x6b75('0xab')]({'model':db[_0x6b75('0x7d')],'as':'User','attributes':['id','fullname',_0x6b75('0x88')]});}if(_0x52e82f[_0x6b75('0x3a')][_0x6b75('0x43')]){_0x512c34[_0x6b75('0x44')]=[{'all':!![]}];}return db['ChatMessage'][_0x6b75('0x38')](_0x512c34);})[_0x6b75('0x16')](function(_0x581a3e){_0x6fadca[_0x6b75('0xac')]=_0x581a3e;return _0x6fadca;});}})[_0x6b75('0x16')](respondWithFilteredResult(_0x52b83e,_0x512c34))[_0x6b75('0x21')](handleError(_0x52b83e,null));};exports[_0x6b75('0xad')]=function(_0x257ac7,_0x42f70b){return db[_0x6b75('0x34')][_0x6b75('0x46')]({'where':{'id':_0x257ac7['params']['id']}})[_0x6b75('0x16')](handleEntityNotFound(_0x42f70b,null))[_0x6b75('0x16')](function(_0x5f5b43){if(_0x5f5b43){return _0x5f5b43[_0x6b75('0xae')](_0x257ac7[_0x6b75('0x2e')][_0x6b75('0xaf')],_['omit'](_0x257ac7['body'],['ids','id'])||{})[_0x6b75('0xb0')](function(){return db[_0x6b75('0xb1')]['findAll']({'attributes':['id',_0x6b75('0x53'),'color'],'where':{'id':_0x257ac7[_0x6b75('0x2e')][_0x6b75('0xaf')]}});})['then'](function(_0x521184){socket[_0x6b75('0xb2')](_0x6b75('0xb3'),{'id':Number(_0x257ac7[_0x6b75('0x3c')]['id']),'tags':_0x521184||[]});return{'id':Number(_0x257ac7['params']['id']),'tags':_0x521184||[]};});}})['then'](respondWithResult(_0x42f70b,null))['catch'](handleError(_0x42f70b,null));};exports[_0x6b75('0xb4')]=function(_0xcec860,_0x335314){return db[_0x6b75('0x34')]['find']({'where':{'id':_0xcec860[_0x6b75('0x3c')]['id']}})[_0x6b75('0x16')](handleEntityNotFound(_0x335314,null))[_0x6b75('0x16')](function(_0x288ce2){if(_0x288ce2){return _0x288ce2[_0x6b75('0xb4')](_0xcec860['query'][_0x6b75('0xaf')]);}})[_0x6b75('0x16')](respondWithStatusCode(_0x335314,null))[_0x6b75('0x21')](handleError(_0x335314,null));};exports[_0x6b75('0x74')]=function(_0xb4529e,_0x2c91f8){var _0x2b1e23=moment()[_0x6b75('0xb5')]()[_0x6b75('0xb6')]();var _0x5c0a24=path['join'](config[_0x6b75('0x77')],_0x6b75('0xb7'),_0x6b75('0xb8'),'tmp');var _0x7d36=path[_0x6b75('0x72')](config[_0x6b75('0x77')],_0x6b75('0xb7'),_0x6b75('0xb8'),'attachments');var _0x56ba11=path['join'](_0x5c0a24,_0x2b1e23);var _0x694dee=util[_0x6b75('0x79')](_0x6b75('0xb9'),_0xb4529e[_0x6b75('0x3c')]['id'],_0x2b1e23);var _0x1a21da=path[_0x6b75('0x72')](_0x5c0a24,_0x694dee);var _0x284258=[];_0x284258['push']({'model':db[_0x6b75('0x7d')],'as':_0x6b75('0x7d'),'attributes':['id','fullname'],'raw':!![]});_0x284258[_0x6b75('0xab')]({'model':db['CmContact'],'as':_0x6b75('0x64'),'attributes':['id',_0x6b75('0xba'),'lastName'],'raw':!![]});if(_0xb4529e[_0x6b75('0x3a')][_0x6b75('0xbb')]){_0x284258['push']({'model':db[_0x6b75('0x6f')],'as':_0x6b75('0x6f'),'raw':!![]});}var _0x443ab8=[{'model':db['ChatMessage'],'as':'Messages','attributes':['id',_0x6b75('0x2e'),_0x6b75('0x8a'),_0x6b75('0x8c'),_0x6b75('0x8d'),_0x6b75('0xbc')],'include':_0x284258}];_0x443ab8[_0x6b75('0xab')]({'model':db['ChatWebsite'],'as':_0x6b75('0xbd'),'attributes':['id','name']});_0x443ab8['push']({'model':db[_0x6b75('0x7d')],'as':_0x6b75('0xbe'),'attributes':['id',_0x6b75('0x54')]});return db[_0x6b75('0x34')]['find']({'where':{'id':_0xb4529e[_0x6b75('0x3c')]['id']},'include':_0x443ab8})[_0x6b75('0x16')](handleEntityNotFound(_0x2c91f8,null))[_0x6b75('0x16')](function(_0xff24fe){if(_0xff24fe){var _0x50537c=_0xff24fe['get']({'plain':!![]});fs['mkdirSync'](_0x56ba11);var _0x18bec2={'channel':_0x6b75('0xbf'),'account':_0x50537c[_0x6b75('0xbd')][_0x6b75('0x53')],'agent':_0x50537c['Owner']?_0x50537c['Owner']['fullname']:_0x6b75('0xc0'),'createdAt':moment(_0x50537c[_0x6b75('0x8a')])[_0x6b75('0x79')](_0x6b75('0xa6'))[_0x6b75('0xb6')](),'closedAt':_0x50537c[_0x6b75('0x6e')]?moment(_0x50537c['closedAt'])[_0x6b75('0x79')](_0x6b75('0xa6'))[_0x6b75('0xb6')]():'','disposition':_0x50537c[_0x6b75('0x68')],'chatInfo':{'browser':_0x50537c['browserName'],'os':_0x50537c[_0x6b75('0xc1')],'referer':_0x50537c['referer'],'customerIp':_0x50537c[_0x6b75('0xc2')],'customerPort':_0x50537c['customerPort']?_0x50537c[_0x6b75('0xc3')]:_0x6b75('0xc0')},'messages':_(_0x50537c[_0x6b75('0x7f')])[_0x6b75('0xc4')]()[_0x6b75('0xa3')]({'secret':![]})[_0x6b75('0x33')](function(_0x180ad2){if(_0x180ad2[_0x6b75('0x6f')]){var _0x21583a=path[_0x6b75('0x72')](_0x7d36,_0x180ad2[_0x6b75('0x6f')][_0x6b75('0x6c')]);if(fs[_0x6b75('0xc5')](_0x21583a)){fs[_0x6b75('0xc6')](_0x21583a)['pipe'](fs[_0x6b75('0xc7')](path['join'](_0x56ba11,_0x180ad2[_0x6b75('0x6f')]['basename'])));}}return{'date':moment(_0x180ad2['createdAt'])[_0x6b75('0x79')](_0x6b75('0xa6'))[_0x6b75('0xb6')](),'sender':_0x180ad2[_0x6b75('0x8c')]===_0x6b75('0x5e')?_0x180ad2[_0x6b75('0x7d')]?_0x180ad2[_0x6b75('0x7d')][_0x6b75('0x54')]:_0x6b75('0x82'):_0x180ad2[_0x6b75('0x64')][_0x6b75('0xba')]+(_0x180ad2['Contact'][_0x6b75('0xc8')]?'\x20'+_0x180ad2['Contact'][_0x6b75('0xc8')]:''),'body':_0x180ad2[_0x6b75('0x6f')]?_0x180ad2['Attachment'][_0x6b75('0x6c')]:_0x180ad2[_0x6b75('0x2e')],'direction':_0x180ad2[_0x6b75('0x8c')]===_0x6b75('0x5e')?'A':'C','secret':_0x180ad2[_0x6b75('0x8d')],'read':_0x180ad2[_0x6b75('0xbc')],'attachment':_0x180ad2[_0x6b75('0x6f')]};})['value']()};return ejs[_0x6b75('0xc9')](path[_0x6b75('0x72')](config[_0x6b75('0x77')],_0x6b75('0xb7'),_0x6b75('0xca'),'downloadInteraction.ejs'),{'interaction':_0x18bec2})[_0x6b75('0x16')](function(_0x49cfd0){var _0x46d413=path[_0x6b75('0x72')](_0x56ba11,_0x6b75('0xcb')+_0x50537c['id']+'-'+_0x2b1e23+'.pdf');var _0x2687dd={'path':_0x46d413,'channel':_0x6b75('0xbf'),'interactionId':_0x50537c['id']};return pdf['createPdfFromHTML'](_0x49cfd0,_0x2687dd);})[_0x6b75('0x16')](function(){return new Promise(function(_0x328555,_0x453337){zipdir(_0x56ba11,{'saveTo':_0x1a21da},function(_0x309cd3,_0x4bee16){if(_0x309cd3)return _0x453337(_0x309cd3);return _0x328555(_0x4bee16);});})[_0x6b75('0x16')](function(){return new BPromise(function(_0x51b193,_0x1f0760){rimraf(_0x56ba11,function(_0xcce6b5){if(_0xcce6b5)_0x1f0760(_0xcce6b5);return _0x51b193();});});})[_0x6b75('0x16')](function(){return _0x2c91f8['download'](_0x1a21da,_0x694dee,function(_0x296c3f){if(_0x296c3f){logger[_0x6b75('0x1c')](_0x6b75('0xcc'),_0x296c3f);}else{fs[_0x6b75('0xcd')](_0x1a21da);}});});});}else{return _0x2c91f8[_0x6b75('0x22')](0xc8);}})[_0x6b75('0x21')](handleError(_0x2c91f8,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 7d2a1e8..afb81bb 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 _0xa373=['remove','getUsers','then','setDataValue','Users','map','length','emit','catch','hasOwnProperty','hook','events','ChatInteraction','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x10a131,_0x3dc92b){var _0x51c8e2=function(_0x4c60a9){while(--_0x4c60a9){_0x10a131['push'](_0x10a131['shift']());}};_0x51c8e2(++_0x3dc92b);}(_0xa373,0xbf));var _0x3a37=function(_0x689537,_0x5ce66b){_0x689537=_0x689537-0x0;var _0xb1b3f0=_0xa373[_0x689537];return _0xb1b3f0;};'use strict';var EventEmitter=require(_0x3a37('0x0'));var ChatInteraction=require('../../mysqldb')['db'][_0x3a37('0x1')];var ChatMessage=require(_0x3a37('0x2'))['db'][_0x3a37('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3a37('0x4')](0x0);var events={'afterCreate':_0x3a37('0x5'),'afterUpdate':_0x3a37('0x6'),'afterDestroy':_0x3a37('0x7')};function emitEvent(_0x31de69){return function(_0x3869a0,_0x29e23d,_0x4ee072){_0x3869a0[_0x3a37('0x8')]({'attributes':['id'],'raw':!![]})[_0x3a37('0x9')](function(_0x210e5b){_0x3869a0[_0x3a37('0xa')](_0x3a37('0xb'),_0x210e5b[_0x3a37('0xc')](function(_0x24109d){return{'id':_0x24109d['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x3869a0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3a37('0x9')](function(_0x950c92){_0x3869a0['setDataValue']('unreadMessages',_0x950c92[_0x3a37('0xd')]);ChatInteractionEvents[_0x3a37('0xe')](_0x31de69+':'+_0x3869a0['id'],_0x3869a0);ChatInteractionEvents[_0x3a37('0xe')](_0x31de69,_0x3869a0);_0x4ee072(null);})[_0x3a37('0xf')](_0x4ee072(null));};}for(var e in events){if(events[_0x3a37('0x10')](e)){var event=events[e];ChatInteraction[_0x3a37('0x11')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0x073b=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','getUsers','then','setDataValue','Users','findAll','length','emit','hasOwnProperty','hook','events'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x073b,0x1a3));var _0xb073=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x073b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xb073('0x0'));var ChatInteraction=require(_0xb073('0x1'))['db'][_0xb073('0x2')];var ChatMessage=require(_0xb073('0x1'))['db'][_0xb073('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb073('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x36ca02){return function(_0x3761b8,_0x4ba8f2,_0x3ad865){_0x3761b8[_0xb073('0x5')]({'attributes':['id'],'raw':!![]})[_0xb073('0x6')](function(_0x1d8353){_0x3761b8[_0xb073('0x7')](_0xb073('0x8'),_0x1d8353['map'](function(_0x688a1b){return{'id':_0x688a1b['id']};}));return ChatMessage[_0xb073('0x9')]({'where':{'ChatInteractionId':_0x3761b8['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb073('0x6')](function(_0x1c10a1){_0x3761b8[_0xb073('0x7')]('unreadMessages',_0x1c10a1[_0xb073('0xa')]);ChatInteractionEvents[_0xb073('0xb')](_0x36ca02+':'+_0x3761b8['id'],_0x3761b8);ChatInteractionEvents[_0xb073('0xb')](_0x36ca02,_0x3761b8);_0x3ad865(null);})['catch'](_0x3ad865(null));};}for(var e in events){if(events[_0xb073('0xc')](e)){var event=events[e];ChatInteraction[_0xb073('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 4fcbac7..7aeabf5 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 _0x7a8b=['../../config/logger','bluebird','request-promise','path','rimraf','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x4bebfa,_0x58b358){var _0xb8d6e5=function(_0x52a67d){while(--_0x52a67d){_0x4bebfa['push'](_0x4bebfa['shift']());}};_0xb8d6e5(++_0x58b358);}(_0x7a8b,0x1db));var _0xb7a8=function(_0xcc0214,_0x1a0248){_0xcc0214=_0xcc0214-0x0;var _0x28a82f=_0x7a8b[_0xcc0214];return _0x28a82f;};'use strict';var _=require('lodash');var util=require(_0xb7a8('0x0'));var logger=require(_0xb7a8('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb7a8('0x2'));var rp=require(_0xb7a8('0x3'));var fs=require('fs');var path=require(_0xb7a8('0x4'));var rimraf=require(_0xb7a8('0x5'));var config=require('../../config/environment');var attributes=require(_0xb7a8('0x6'));module[_0xb7a8('0x7')]=function(_0x23d7a2,_0x460fff){return _0x23d7a2[_0xb7a8('0x8')](_0xb7a8('0x9'),attributes,{'tableName':_0xb7a8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xf0dcb3,_0x1179d1,_0x13708e){if(_0xf0dcb3[_0xb7a8('0xb')](_0xb7a8('0xc'))){_0xf0dcb3[_0xb7a8('0xd')]=moment()['format'](_0xb7a8('0xe'));}_0x13708e(null,_0xf0dcb3);}},'charset':_0xb7a8('0xf'),'collate':_0xb7a8('0x10')});}; \ No newline at end of file +var _0x9419=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','ChatInteraction','chat_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3d38c3,_0x20192a){var _0x4f04f9=function(_0x2a484c){while(--_0x2a484c){_0x3d38c3['push'](_0x3d38c3['shift']());}};_0x4f04f9(++_0x20192a);}(_0x9419,0x1a6));var _0x9941=function(_0x197185,_0x251145){_0x197185=_0x197185-0x0;var _0x2c8af1=_0x9419[_0x197185];return _0x2c8af1;};'use strict';var _=require(_0x9941('0x0'));var util=require(_0x9941('0x1'));var logger=require(_0x9941('0x2'))(_0x9941('0x3'));var moment=require(_0x9941('0x4'));var BPromise=require(_0x9941('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9941('0x6'));var rimraf=require(_0x9941('0x7'));var config=require(_0x9941('0x8'));var attributes=require('./chatInteraction.attributes');module[_0x9941('0x9')]=function(_0x5d7ee8,_0xdd4f16){return _0x5d7ee8[_0x9941('0xa')](_0x9941('0xb'),attributes,{'tableName':_0x9941('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4af13f,_0x1b6d5b,_0x12f819){if(_0x4af13f[_0x9941('0xd')](_0x9941('0xe'))){_0x4af13f[_0x9941('0xf')]=moment()[_0x9941('0x10')](_0x9941('0x11'));}_0x12f819(null,_0x4af13f);}},'charset':_0x9941('0x12'),'collate':_0x9941('0x13')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 6e5fa54..aa19939 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 _0x40d9=['info','ChatInteraction,\x20%s,\x20%s','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x40e6e7,_0x187f3d){var _0x1bf123=function(_0x14f24e){while(--_0x14f24e){_0x40e6e7['push'](_0x40e6e7['shift']());}};_0x1bf123(++_0x187f3d);}(_0x40d9,0x1a1));var _0x940d=function(_0x1538d1,_0x3eab18){_0x1538d1=_0x1538d1-0x0;var _0xe84c01=_0x40d9[_0x1538d1];return _0xe84c01;};'use strict';var _=require(_0x940d('0x0'));var util=require(_0x940d('0x1'));var moment=require(_0x940d('0x2'));var BPromise=require(_0x940d('0x3'));var rs=require(_0x940d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x940d('0x5'));var logger=require(_0x940d('0x6'))(_0x940d('0x7'));var config=require('../../config/environment');var jayson=require(_0x940d('0x8'));var client=jayson['client'][_0x940d('0x9')]({'port':0x232a});config[_0x940d('0xa')]=_['defaults'](config['redis'],{'host':_0x940d('0xb'),'port':0x18eb});var socket=require(_0x940d('0xc'))(new Redis(config['redis']));require(_0x940d('0xd'))[_0x940d('0xe')](socket);function respondWithRpcPromise(_0x35b834,_0x3bd710,_0x3b08b6){return new BPromise(function(_0x11ced4,_0x46b3c7){return client[_0x940d('0xf')](_0x35b834,_0x3b08b6)[_0x940d('0x10')](function(_0x1731be){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x3bd710,_0x940d('0x11'));logger[_0x940d('0x12')](_0x940d('0x13'),_0x3bd710,_0x940d('0x11'),JSON[_0x940d('0x14')](_0x1731be));if(_0x1731be[_0x940d('0x15')]){if(_0x1731be[_0x940d('0x15')]['code']===0x1f4){logger[_0x940d('0x15')]('ChatInteraction,\x20%s,\x20%s',_0x3bd710,_0x1731be['error'][_0x940d('0x16')]);return _0x46b3c7(_0x1731be[_0x940d('0x15')]['message']);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x3bd710,_0x1731be[_0x940d('0x15')][_0x940d('0x16')]);return _0x11ced4(_0x1731be[_0x940d('0x15')]['message']);}else{logger[_0x940d('0x17')](_0x940d('0x18'),_0x3bd710,'request\x20sent');_0x11ced4(_0x1731be[_0x940d('0x19')][_0x940d('0x16')]);}})[_0x940d('0x1a')](function(_0x1e5e19){logger[_0x940d('0x15')](_0x940d('0x18'),_0x3bd710,_0x1e5e19);_0x46b3c7(_0x1e5e19);});});}exports[_0x940d('0x1b')]=function(_0x3302af){var _0x5bed7d=this;return new Promise(function(_0x55c243,_0x561122){return db['ChatInteraction'][_0x940d('0x1c')](_0x3302af[_0x940d('0x1d')],{'raw':_0x3302af[_0x940d('0x1e')]?_0x3302af[_0x940d('0x1e')][_0x940d('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3302af[_0x940d('0x1e')]?_0x3302af['options'][_0x940d('0x20')]||null:null,'attributes':_0x3302af[_0x940d('0x1e')]?_0x3302af['options'][_0x940d('0x21')]||null:null,'limit':_0x3302af[_0x940d('0x1e')]?_0x3302af[_0x940d('0x1e')]['limit']||null:null})['then'](function(_0x14141d){logger[_0x940d('0x17')](_0x940d('0x1b'),_0x3302af);logger[_0x940d('0x12')]('UpdateChatInteraction',_0x3302af,JSON['stringify'](_0x14141d));_0x55c243(_0x14141d);})[_0x940d('0x1a')](function(_0x220122){logger[_0x940d('0x15')](_0x940d('0x1b'),_0x220122['message'],_0x3302af);_0x561122(_0x5bed7d[_0x940d('0x15')](0x1f4,_0x220122[_0x940d('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x735ca0){return new Promise(function(_0x24731c,_0x226358){return db['ChatInteraction'][_0x940d('0x22')]({'where':_0x735ca0[_0x940d('0x1e')]?_0x735ca0[_0x940d('0x1e')][_0x940d('0x20')]||null:null})[_0x940d('0x10')](function(_0x54ffa3){if(_0x54ffa3){return _0x54ffa3[_0x940d('0x23')](_0x735ca0[_0x940d('0x1d')][_0x940d('0x24')],_[_0x940d('0x25')](_0x735ca0[_0x940d('0x1d')],[_0x940d('0x24'),'id'])||{});}})[_0x940d('0x26')](function(_0x5be2a2){logger['info'](_0x940d('0x27'),_0x735ca0);logger[_0x940d('0x12')](_0x940d('0x27'),_0x735ca0,JSON[_0x940d('0x14')](_0x5be2a2));_0x24731c(_0x5be2a2);})[_0x940d('0x1a')](function(_0x59f68f){logger[_0x940d('0x15')](_0x940d('0x27'),_0x59f68f['message'],_0x735ca0);_0x226358(_this[_0x940d('0x15')](0x1f4,_0x59f68f[_0x940d('0x16')]));});});}; \ No newline at end of file +var _0xf976=['register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','UpdateChatInteraction','update','options','raw','where','limit','stringify','catch','find','addTags','ids','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','defaults','redis','socket.io-emitter'];(function(_0x135cd7,_0x6bdc01){var _0x300a1d=function(_0x4f292e){while(--_0x4f292e){_0x135cd7['push'](_0x135cd7['shift']());}};_0x300a1d(++_0x6bdc01);}(_0xf976,0xfd));var _0x6f97=function(_0x1c6ab4,_0x132809){_0x1c6ab4=_0x1c6ab4-0x0;var _0x473573=_0xf976[_0x1c6ab4];return _0x473573;};'use strict';var _=require(_0x6f97('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6f97('0x1'));var rs=require(_0x6f97('0x2'));var fs=require('fs');var Redis=require(_0x6f97('0x3'));var db=require(_0x6f97('0x4'))['db'];var utils=require(_0x6f97('0x5'));var logger=require(_0x6f97('0x6'))(_0x6f97('0x7'));var config=require(_0x6f97('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6f97('0x9')]({'port':0x232a});config['redis']=_[_0x6f97('0xa')](config[_0x6f97('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x6f97('0xc'))(new Redis(config[_0x6f97('0xb')]));require('./chatInteraction.socket')[_0x6f97('0xd')](socket);function respondWithRpcPromise(_0x2672d0,_0xc3cdbb,_0x25430f){return new BPromise(function(_0x202da5,_0x8384c){return client[_0x6f97('0xe')](_0x2672d0,_0x25430f)[_0x6f97('0xf')](function(_0x247fbf){logger[_0x6f97('0x10')](_0x6f97('0x11'),_0xc3cdbb,'request\x20sent');logger[_0x6f97('0x12')](_0x6f97('0x13'),_0xc3cdbb,'request\x20sent',JSON['stringify'](_0x247fbf));if(_0x247fbf['error']){if(_0x247fbf[_0x6f97('0x14')][_0x6f97('0x15')]===0x1f4){logger[_0x6f97('0x14')](_0x6f97('0x11'),_0xc3cdbb,_0x247fbf[_0x6f97('0x14')]['message']);return _0x8384c(_0x247fbf[_0x6f97('0x14')][_0x6f97('0x16')]);}logger[_0x6f97('0x14')](_0x6f97('0x11'),_0xc3cdbb,_0x247fbf[_0x6f97('0x14')][_0x6f97('0x16')]);return _0x202da5(_0x247fbf[_0x6f97('0x14')][_0x6f97('0x16')]);}else{logger[_0x6f97('0x10')](_0x6f97('0x11'),_0xc3cdbb,_0x6f97('0x17'));_0x202da5(_0x247fbf[_0x6f97('0x18')]['message']);}})['catch'](function(_0x385d3e){logger[_0x6f97('0x14')](_0x6f97('0x11'),_0xc3cdbb,_0x385d3e);_0x8384c(_0x385d3e);});});}exports[_0x6f97('0x19')]=function(_0x1fd72d){var _0x53d192=this;return new Promise(function(_0x3a8a02,_0x21ae5e){return db['ChatInteraction'][_0x6f97('0x1a')](_0x1fd72d['body'],{'raw':_0x1fd72d['options']?_0x1fd72d[_0x6f97('0x1b')][_0x6f97('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fd72d[_0x6f97('0x1b')]?_0x1fd72d[_0x6f97('0x1b')][_0x6f97('0x1d')]||null:null,'attributes':_0x1fd72d[_0x6f97('0x1b')]?_0x1fd72d[_0x6f97('0x1b')]['attributes']||null:null,'limit':_0x1fd72d[_0x6f97('0x1b')]?_0x1fd72d[_0x6f97('0x1b')][_0x6f97('0x1e')]||null:null})[_0x6f97('0xf')](function(_0x5579d3){logger[_0x6f97('0x10')]('UpdateChatInteraction',_0x1fd72d);logger[_0x6f97('0x12')]('UpdateChatInteraction',_0x1fd72d,JSON[_0x6f97('0x1f')](_0x5579d3));_0x3a8a02(_0x5579d3);})[_0x6f97('0x20')](function(_0x561abe){logger[_0x6f97('0x14')]('UpdateChatInteraction',_0x561abe[_0x6f97('0x16')],_0x1fd72d);_0x21ae5e(_0x53d192['error'](0x1f4,_0x561abe[_0x6f97('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x3d559a){return new Promise(function(_0x11da4f,_0x27f35e){return db['ChatInteraction'][_0x6f97('0x21')]({'where':_0x3d559a['options']?_0x3d559a[_0x6f97('0x1b')]['where']||null:null})['then'](function(_0x15f227){if(_0x15f227){return _0x15f227[_0x6f97('0x22')](_0x3d559a['body'][_0x6f97('0x23')],_['omit'](_0x3d559a['body'],[_0x6f97('0x23'),'id'])||{});}})[_0x6f97('0x24')](function(_0x434dd3){logger['info'](_0x6f97('0x25'),_0x3d559a);logger[_0x6f97('0x12')]('AddTags',_0x3d559a,JSON[_0x6f97('0x1f')](_0x434dd3));_0x11da4f(_0x434dd3);})[_0x6f97('0x20')](function(_0x227e76){logger['error']('AddTags',_0x227e76[_0x6f97('0x16')],_0x3d559a);_0x27f35e(_this['error'](0x1f4,_0x227e76['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 378dd16..20edb8d 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 _0x3bef=['update','emit','register','length','chatInteraction:','./chatInteraction.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bef,0x185));var _0xf3be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3bef[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0xf3be('0x0'));var events=[_0xf3be('0x1'),_0xf3be('0x2'),_0xf3be('0x3')];function createListener(_0x432a61,_0x2e37d1){return function(_0xdc837){_0x2e37d1[_0xf3be('0x4')](_0x432a61,_0xdc837);};}function removeListener(_0x34c0a3,_0x1098df){return function(){ChatInteractionEvents['removeListener'](_0x34c0a3,_0x1098df);};}exports[_0xf3be('0x5')]=function(_0x83a255){for(var _0x30494e=0x0,_0x1835bf=events[_0xf3be('0x6')];_0x30494e<_0x1835bf;_0x30494e++){var _0x48e92c=events[_0x30494e];var _0x363b33=createListener(_0xf3be('0x7')+_0x48e92c,_0x83a255);ChatInteractionEvents['on'](_0x48e92c,_0x363b33);}}; \ No newline at end of file +var _0x0e82=['update','emit','removeListener','length','./chatInteraction.events','save','remove'];(function(_0x19da20,_0x48f324){var _0x5bec84=function(_0x18f2e9){while(--_0x18f2e9){_0x19da20['push'](_0x19da20['shift']());}};_0x5bec84(++_0x48f324);}(_0x0e82,0x1e7));var _0x20e8=function(_0x50f19a,_0xa5fafe){_0x50f19a=_0x50f19a-0x0;var _0xde90b6=_0x0e82[_0x50f19a];return _0xde90b6;};'use strict';var ChatInteractionEvents=require(_0x20e8('0x0'));var events=[_0x20e8('0x1'),_0x20e8('0x2'),_0x20e8('0x3')];function createListener(_0x3f2bc3,_0x591a92){return function(_0x323913){_0x591a92[_0x20e8('0x4')](_0x3f2bc3,_0x323913);};}function removeListener(_0x3fba19,_0x521f85){return function(){ChatInteractionEvents[_0x20e8('0x5')](_0x3fba19,_0x521f85);};}exports['register']=function(_0x478dc8){for(var _0x58e0af=0x0,_0x395493=events[_0x20e8('0x6')];_0x58e0af<_0x395493;_0x58e0af++){var _0xf11108=events[_0x58e0af];var _0x4ba44d=createListener('chatInteraction:'+_0xf11108,_0x478dc8);ChatInteractionEvents['on'](_0xf11108,_0x4ba44d);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index bea3f80..e4272f5 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 _0xa0ce=['fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','getMyMessages','create','post','/:id/vidaoo','createVidaooSession','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','/:id','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','path','express','Router'];(function(_0x24a82,_0x836580){var _0x37095d=function(_0x5bb2fc){while(--_0x5bb2fc){_0x24a82['push'](_0x24a82['shift']());}};_0x37095d(++_0x836580);}(_0xa0ce,0x128));var _0xea0c=function(_0xb97296,_0x12205e){_0xb97296=_0xb97296-0x0;var _0x22ab83=_0xa0ce[_0xb97296];return _0x22ab83;};'use strict';var multer=require(_0xea0c('0x0'));var util=require('util');var path=require(_0xea0c('0x1'));var timeout=require('connect-timeout');var express=require(_0xea0c('0x2'));var router=express[_0xea0c('0x3')]();var fs_extra=require(_0xea0c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xea0c('0x5'));var config=require(_0xea0c('0x6'));var controller=require(_0xea0c('0x7'));router[_0xea0c('0x8')]('/',auth[_0xea0c('0x9')](),controller[_0xea0c('0xa')]);router[_0xea0c('0x8')]('/describe',auth[_0xea0c('0x9')](),controller[_0xea0c('0xb')]);router['get']('/:id',auth[_0xea0c('0xc')](),controller[_0xea0c('0xd')]);router['get'](_0xea0c('0xe'),auth[_0xea0c('0xc')](),controller[_0xea0c('0xf')]);router['get'](_0xea0c('0x10'),auth[_0xea0c('0x9')](),controller[_0xea0c('0x11')]);router[_0xea0c('0x8')]('/:id/my_messages',auth[_0xea0c('0xc')](),controller[_0xea0c('0x12')]);router['get']('/:id/download',auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xea0c('0x9')](),controller[_0xea0c('0x13')]);router[_0xea0c('0x14')](_0xea0c('0x15'),auth['isAuthenticated'](),controller[_0xea0c('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36846e,_0x43f65b,_0x51573b){_0x51573b(null,path['join'](config[_0xea0c('0x17')],_0xea0c('0x18')));},'filename':function(_0x21c28f,_0x1fc0ac,_0xcedbd6){_0xcedbd6(null,util['format'](_0xea0c('0x19'),Date[_0xea0c('0x1a')](),_0x1fc0ac[_0xea0c('0x1b')][_0xea0c('0x1c')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xea0c('0x14')](_0xea0c('0x1d'),upload[_0xea0c('0x1e')](_0xea0c('0x1f')),controller[_0xea0c('0x20')]);router[_0xea0c('0x14')](_0xea0c('0x10'),auth[_0xea0c('0xc')](),controller[_0xea0c('0x21')]);router[_0xea0c('0x14')](_0xea0c('0x22'),auth['isAuthenticated'](),interaction[_0xea0c('0x23')](_0xea0c('0x24'),_0xea0c('0x25')),controller[_0xea0c('0x26')]);router[_0xea0c('0x27')](_0xea0c('0x28'),auth[_0xea0c('0x9')](),interaction[_0xea0c('0x23')](_0xea0c('0x24'),'chatinteraction:update'),controller['update']);router[_0xea0c('0x27')]('/:id/custom_update',controller['customUpdate']);router[_0xea0c('0x27')](_0xea0c('0x29'),auth[_0xea0c('0xc')](),controller[_0xea0c('0x2a')]);router[_0xea0c('0x27')](_0xea0c('0x2b'),controller[_0xea0c('0x2c')]);router[_0xea0c('0x2d')](_0xea0c('0x28'),auth[_0xea0c('0x9')](),interaction[_0xea0c('0x23')](_0xea0c('0x24'),_0xea0c('0x2e')),controller[_0xea0c('0x2f')]);router[_0xea0c('0x2d')](_0xea0c('0x22'),auth[_0xea0c('0x9')](),controller[_0xea0c('0x30')]);module[_0xea0c('0x31')]=router; \ No newline at end of file +var _0x7074=['put','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','chatinteraction:update'];(function(_0x4505fe,_0x40e067){var _0x3f56b7=function(_0x41cb8b){while(--_0x41cb8b){_0x4505fe['push'](_0x4505fe['shift']());}};_0x3f56b7(++_0x40e067);}(_0x7074,0xb3));var _0x4707=function(_0x6e2c11,_0x58c8c2){_0x6e2c11=_0x6e2c11-0x0;var _0x51ee89=_0x7074[_0x6e2c11];return _0x51ee89;};'use strict';var multer=require(_0x4707('0x0'));var util=require(_0x4707('0x1'));var path=require(_0x4707('0x2'));var timeout=require(_0x4707('0x3'));var express=require('express');var router=express[_0x4707('0x4')]();var fs_extra=require(_0x4707('0x5'));var auth=require(_0x4707('0x6'));var interaction=require(_0x4707('0x7'));var config=require(_0x4707('0x8'));var controller=require(_0x4707('0x9'));router[_0x4707('0xa')]('/',auth[_0x4707('0xb')](),controller[_0x4707('0xc')]);router[_0x4707('0xa')](_0x4707('0xd'),auth[_0x4707('0xb')](),controller[_0x4707('0xe')]);router[_0x4707('0xa')](_0x4707('0xf'),auth[_0x4707('0x10')](),controller[_0x4707('0x11')]);router[_0x4707('0xa')](_0x4707('0x12'),auth['isChatInteractionAuthorized'](),controller['attachmentDownload']);router[_0x4707('0xa')](_0x4707('0x13'),auth[_0x4707('0xb')](),controller[_0x4707('0x14')]);router[_0x4707('0xa')](_0x4707('0x15'),auth[_0x4707('0x10')](),controller[_0x4707('0x16')]);router[_0x4707('0xa')](_0x4707('0x17'),auth[_0x4707('0xb')](),controller[_0x4707('0x18')]);router[_0x4707('0x19')]('/',auth[_0x4707('0xb')](),controller[_0x4707('0x1a')]);router['post'](_0x4707('0x1b'),auth[_0x4707('0xb')](),controller[_0x4707('0x1c')]);var upload=multer({'storage':multer[_0x4707('0x1d')]({'destination':function(_0x352b93,_0xd7b775,_0x53b616){_0x53b616(null,path['join'](config[_0x4707('0x1e')],_0x4707('0x1f')));},'filename':function(_0xc0fc3b,_0x551dea,_0x23a30f){_0x23a30f(null,util[_0x4707('0x20')](_0x4707('0x21'),Date[_0x4707('0x22')](),_0x551dea[_0x4707('0x23')][_0x4707('0x24')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x4707('0x19')](_0x4707('0x25'),upload[_0x4707('0x26')](_0x4707('0x27')),controller[_0x4707('0x28')]);router[_0x4707('0x19')](_0x4707('0x13'),auth[_0x4707('0x10')](),controller['addMessage']);router[_0x4707('0x19')](_0x4707('0x29'),auth[_0x4707('0xb')](),interaction[_0x4707('0x2a')]('chat',_0x4707('0x2b')),controller['addTags']);router['put'](_0x4707('0xf'),auth[_0x4707('0xb')](),interaction['tracked']('chat',_0x4707('0x2c')),controller['update']);router[_0x4707('0x2d')](_0x4707('0x2e'),controller[_0x4707('0x2f')]);router['put'](_0x4707('0x30'),auth[_0x4707('0x10')](),controller['abandon']);router[_0x4707('0x2d')](_0x4707('0x31'),controller[_0x4707('0x32')]);router[_0x4707('0x33')](_0x4707('0xf'),auth[_0x4707('0xb')](),interaction['tracked']('chat',_0x4707('0x34')),controller[_0x4707('0x35')]);router[_0x4707('0x33')](_0x4707('0x29'),auth['isAuthenticated'](),controller[_0x4707('0x36')]);module[_0x4707('0x37')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index c5fddfa..7e842f5 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 _0xf151=['TEXT','medium','BOOLEAN','sequelize','exports'];(function(_0x27c63a,_0x443297){var _0x1018ca=function(_0x1902d0){while(--_0x1902d0){_0x27c63a['push'](_0x27c63a['shift']());}};_0x1018ca(++_0x443297);}(_0xf151,0x6c));var _0x1f15=function(_0x3faf6f,_0x389fde){_0x3faf6f=_0x3faf6f-0x0;var _0x402a53=_0xf151[_0x3faf6f];return _0x402a53;};'use strict';var Sequelize=require(_0x1f15('0x0'));module[_0x1f15('0x1')]={'body':{'type':Sequelize[_0x1f15('0x2')](_0x1f15('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1f15('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1d26=['exports','TEXT','medium','BOOLEAN','INTEGER','sequelize'];(function(_0x469b32,_0x30c052){var _0x5c3e2d=function(_0x1f16dd){while(--_0x1f16dd){_0x469b32['push'](_0x469b32['shift']());}};_0x5c3e2d(++_0x30c052);}(_0x1d26,0x65));var _0x61d2=function(_0x53b133,_0x176261){_0x53b133=_0x53b133-0x0;var _0x5647e0=_0x1d26[_0x53b133];return _0x5647e0;};'use strict';var Sequelize=require(_0x61d2('0x0'));module[_0x61d2('0x1')]={'body':{'type':Sequelize[_0x61d2('0x2')](_0x61d2('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x61d2('0x4')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x61d2('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 9fc2bc2..43a4b7e 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 _0xeac0=['findAll','rows','catch','show','params','includeAll','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','merge','type','VIRTUAL','options','ChatInternalMessage','include'];(function(_0x308e4f,_0x134e25){var _0x17ab35=function(_0x2cfcd9){while(--_0x2cfcd9){_0x308e4f['push'](_0x308e4f['shift']());}};_0x17ab35(++_0x134e25);}(_0xeac0,0x1db));var _0x0eac=function(_0x406ade,_0x1eccbd){_0x406ade=_0x406ade-0x0;var _0x13962e=_0xeac0[_0x406ade];return _0x13962e;};'use strict';var emlformat=require(_0x0eac('0x0'));var rimraf=require(_0x0eac('0x1'));var zipdir=require(_0x0eac('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0eac('0x3'));var moment=require(_0x0eac('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0eac('0x5'));var util=require(_0x0eac('0x6'));var path=require(_0x0eac('0x7'));var sox=require(_0x0eac('0x8'));var csv=require(_0x0eac('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0eac('0xa'));var crypto=require('crypto');var jsforce=require(_0x0eac('0xb'));var deskjs=require(_0x0eac('0xc'));var toCsv=require(_0x0eac('0x9'));var querystring=require(_0x0eac('0xd'));var Papa=require(_0x0eac('0xe'));var Redis=require(_0x0eac('0xf'));var authService=require(_0x0eac('0x10'));var qs=require(_0x0eac('0x11'));var as=require(_0x0eac('0x12'));var hardwareService=require(_0x0eac('0x13'));var logger=require(_0x0eac('0x14'))(_0x0eac('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0eac('0x16'))['db'];config[_0x0eac('0x17')]=_[_0x0eac('0x18')](config[_0x0eac('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x0eac('0x19'))(new Redis(config[_0x0eac('0x17')]));require('./chatInternalMessage.socket')[_0x0eac('0x1a')](socket);function respondWithStatusCode(_0x41d172,_0x1f4ffc){_0x1f4ffc=_0x1f4ffc||0xcc;return function(_0x11c9be){if(_0x11c9be){return _0x41d172[_0x0eac('0x1b')](_0x1f4ffc);}return _0x41d172[_0x0eac('0x1c')](_0x1f4ffc)[_0x0eac('0x1d')]();};}function respondWithResult(_0x4d2835,_0x1ce6a1){_0x1ce6a1=_0x1ce6a1||0xc8;return function(_0xdbf5f8){if(_0xdbf5f8){return _0x4d2835[_0x0eac('0x1c')](_0x1ce6a1)[_0x0eac('0x1e')](_0xdbf5f8);}};}function respondWithFilteredResult(_0x33be07,_0x5612b4){return function(_0x521ed1){if(_0x521ed1){var _0x2cc53e=typeof _0x5612b4['offset']===_0x0eac('0x1f')&&typeof _0x5612b4[_0x0eac('0x20')]===_0x0eac('0x1f');var _0x4f9f2d=_0x521ed1[_0x0eac('0x21')];var _0x15fce4=_0x2cc53e?0x0:_0x5612b4[_0x0eac('0x22')];var _0x3725db=_0x2cc53e?_0x521ed1['count']:_0x5612b4[_0x0eac('0x22')]+_0x5612b4[_0x0eac('0x20')];var _0x262536;if(_0x3725db>=_0x4f9f2d){_0x3725db=_0x4f9f2d;_0x262536=0xc8;}else{_0x262536=0xce;}_0x33be07['status'](_0x262536);return _0x33be07[_0x0eac('0x23')](_0x0eac('0x24'),_0x15fce4+'-'+_0x3725db+'/'+_0x4f9f2d)[_0x0eac('0x1e')](_0x521ed1);}return null;};}function patchUpdates(_0x5bcfbf){return function(_0xb7ea8c){try{jsonpatch['apply'](_0xb7ea8c,_0x5bcfbf,!![]);}catch(_0x106aff){return BPromise[_0x0eac('0x25')](_0x106aff);}return _0xb7ea8c[_0x0eac('0x26')]();};}function saveUpdates(_0xcc7764,_0x15ef0f){return function(_0x2bac22){if(_0x2bac22){return _0x2bac22[_0x0eac('0x27')](_0xcc7764)[_0x0eac('0x28')](function(_0x364e22){return _0x364e22;});}return null;};}function removeEntity(_0x43c5c7,_0x2dbf19){return function(_0x3139ff){if(_0x3139ff){return _0x3139ff[_0x0eac('0x29')]()['then'](function(){_0x43c5c7[_0x0eac('0x1c')](0xcc)[_0x0eac('0x1d')]();});}};}function handleEntityNotFound(_0x456d6f,_0x435bd3){return function(_0x5912e0){if(!_0x5912e0){_0x456d6f[_0x0eac('0x1b')](0x194);}return _0x5912e0;};}function handleError(_0x21b5ad,_0x2c4a55){_0x2c4a55=_0x2c4a55||0x1f4;return function(_0x2721b4){logger['error'](_0x2721b4['stack']);if(_0x2721b4[_0x0eac('0x2a')]){delete _0x2721b4[_0x0eac('0x2a')];}_0x21b5ad[_0x0eac('0x1c')](_0x2c4a55)[_0x0eac('0x2b')](_0x2721b4);};}exports[_0x0eac('0x2c')]=function(_0x275684,_0x5f5ba1){var _0x122080={},_0x1ec46e={},_0x5fc801={'count':0x0,'rows':[]};var _0x537a9a=_[_0x0eac('0x2d')](db['ChatInternalMessage'][_0x0eac('0x2e')],function(_0x1ac506){return{'name':_0x1ac506[_0x0eac('0x2f')],'type':_0x1ac506['type']['key']};});_0x1ec46e[_0x0eac('0x30')]=_[_0x0eac('0x2d')](_0x537a9a,_0x0eac('0x2a'));_0x1ec46e[_0x0eac('0x31')]=_[_0x0eac('0x32')](_0x275684[_0x0eac('0x31')]);_0x1ec46e[_0x0eac('0x33')]=_[_0x0eac('0x34')](_0x1ec46e[_0x0eac('0x30')],_0x1ec46e[_0x0eac('0x31')]);_0x122080[_0x0eac('0x35')]=_[_0x0eac('0x34')](_0x1ec46e[_0x0eac('0x30')],qs['fields'](_0x275684[_0x0eac('0x31')][_0x0eac('0x36')]));_0x122080[_0x0eac('0x35')]=_0x122080[_0x0eac('0x35')][_0x0eac('0x37')]?_0x122080[_0x0eac('0x35')]:_0x1ec46e['model'];if(!_0x275684[_0x0eac('0x31')]['hasOwnProperty']('nolimit')){_0x122080[_0x0eac('0x20')]=qs['limit'](_0x275684[_0x0eac('0x31')]['limit']);_0x122080[_0x0eac('0x22')]=qs[_0x0eac('0x22')](_0x275684[_0x0eac('0x31')][_0x0eac('0x22')]);}_0x122080[_0x0eac('0x38')]=qs[_0x0eac('0x39')](_0x275684[_0x0eac('0x31')]['sort']);_0x122080['where']=qs[_0x0eac('0x33')](_['pick'](_0x275684['query'],_0x1ec46e[_0x0eac('0x33')]),_0x537a9a);if(_0x275684[_0x0eac('0x31')][_0x0eac('0x3a')]){_0x122080['where']=_[_0x0eac('0x3b')](_0x122080['where'],{'$or':_[_0x0eac('0x2d')](_0x537a9a,function(_0x2c3d3e){if(_0x2c3d3e[_0x0eac('0x3c')]!==_0x0eac('0x3d')){var _0x21e6e0={};_0x21e6e0[_0x2c3d3e[_0x0eac('0x2a')]]={'$like':'%'+_0x275684[_0x0eac('0x31')]['filter']+'%'};return _0x21e6e0;}})});}_0x122080=_[_0x0eac('0x3b')]({},_0x122080,_0x275684[_0x0eac('0x3e')]);var _0x342945={'where':_0x122080['where']};return db[_0x0eac('0x3f')]['count'](_0x342945)[_0x0eac('0x28')](function(_0x30806b){_0x5fc801['count']=_0x30806b;if(_0x275684[_0x0eac('0x31')]['includeAll']){_0x122080[_0x0eac('0x40')]=[{'all':!![]}];}return db[_0x0eac('0x3f')][_0x0eac('0x41')](_0x122080);})[_0x0eac('0x28')](function(_0x2da445){_0x5fc801[_0x0eac('0x42')]=_0x2da445;return _0x5fc801;})['then'](respondWithFilteredResult(_0x5f5ba1,_0x122080))[_0x0eac('0x43')](handleError(_0x5f5ba1,null));};exports[_0x0eac('0x44')]=function(_0x24719f,_0x335cb1){var _0x37fec8={'raw':!![],'where':{'id':_0x24719f[_0x0eac('0x45')]['id']}},_0x1e8438={};_0x1e8438[_0x0eac('0x30')]=_[_0x0eac('0x32')](db['ChatInternalMessage'][_0x0eac('0x2e')]);_0x1e8438[_0x0eac('0x31')]=_[_0x0eac('0x32')](_0x24719f[_0x0eac('0x31')]);_0x1e8438['filters']=_[_0x0eac('0x34')](_0x1e8438[_0x0eac('0x30')],_0x1e8438['query']);_0x37fec8[_0x0eac('0x35')]=_[_0x0eac('0x34')](_0x1e8438[_0x0eac('0x30')],qs[_0x0eac('0x36')](_0x24719f[_0x0eac('0x31')][_0x0eac('0x36')]));_0x37fec8[_0x0eac('0x35')]=_0x37fec8[_0x0eac('0x35')][_0x0eac('0x37')]?_0x37fec8['attributes']:_0x1e8438[_0x0eac('0x30')];if(_0x24719f[_0x0eac('0x31')][_0x0eac('0x46')]){_0x37fec8[_0x0eac('0x40')]=[{'all':!![]}];}_0x37fec8=_['merge']({},_0x37fec8,_0x24719f[_0x0eac('0x3e')]);return db[_0x0eac('0x3f')]['find'](_0x37fec8)['then'](handleEntityNotFound(_0x335cb1,null))['then'](respondWithResult(_0x335cb1,null))[_0x0eac('0x43')](handleError(_0x335cb1,null));};exports['create']=function(_0x19adea,_0x34789e){return db[_0x0eac('0x3f')][_0x0eac('0x47')](_0x19adea['body'],{})[_0x0eac('0x28')](respondWithResult(_0x34789e,0xc9))[_0x0eac('0x43')](handleError(_0x34789e,null));};exports[_0x0eac('0x27')]=function(_0x493f5c,_0x4bff78){if(_0x493f5c[_0x0eac('0x48')]['id']){delete _0x493f5c[_0x0eac('0x48')]['id'];}return db['ChatInternalMessage'][_0x0eac('0x49')]({'where':{'id':_0x493f5c['params']['id']}})[_0x0eac('0x28')](handleEntityNotFound(_0x4bff78,null))[_0x0eac('0x28')](saveUpdates(_0x493f5c[_0x0eac('0x48')],null))[_0x0eac('0x28')](respondWithResult(_0x4bff78,null))['catch'](handleError(_0x4bff78,null));};exports['destroy']=function(_0x161cd7,_0x78b013){return db['ChatInternalMessage']['find']({'where':{'id':_0x161cd7['params']['id']}})[_0x0eac('0x28')](handleEntityNotFound(_0x78b013,null))[_0x0eac('0x28')](removeEntity(_0x78b013,null))[_0x0eac('0x43')](handleError(_0x78b013,null));};exports[_0x0eac('0x4a')]=function(_0x56a26d,_0x586f4e){return db[_0x0eac('0x3f')][_0x0eac('0x4a')]()[_0x0eac('0x28')](respondWithResult(_0x586f4e,null))[_0x0eac('0x43')](handleError(_0x586f4e,null));};function wrapUser(_0x22fc83){return function(_0x5b0fa3){var _0xa4101f=_0x22fc83[_0x0eac('0x4b')]({'plain':!![]});_0xa4101f[_0x0eac('0x4c')]=[];if(_0x5b0fa3){_0xa4101f[_0x0eac('0x4d')]=_0x5b0fa3[_0x0eac('0x4e')];_0xa4101f[_0x0eac('0x4f')]=_0x5b0fa3;}else{_0xa4101f[_0x0eac('0x4d')]=moment(0x0)[_0x0eac('0x50')](_0x0eac('0x51'));_0xa4101f[_0x0eac('0x4f')]={};}return _0xa4101f;};}exports[_0x0eac('0x52')]=function(_0x439c07,_0x510cbc,_0x1521d3){var _0x4939b4=[];return db['User'][_0x0eac('0x41')]({'where':{'role':[_0x0eac('0x53'),_0x0eac('0x54'),_0x0eac('0x55')]},'attributes':['id','fullname','name','role','userpic','internal',_0x0eac('0x56'),_0x0eac('0x57'),_0x0eac('0x58'),_0x0eac('0x59')],'order':qs[_0x0eac('0x39')](_0x0eac('0x5a')),'include':[{'model':db[_0x0eac('0x5b')],'as':_0x0eac('0x5c'),'attributes':['id',_0x0eac('0x2a'),'type'],'through':{'attributes':[]}}]})[_0x0eac('0x28')](function(_0x47ed43){if(_0x47ed43){var _0x49bde6=_0x439c07[_0x0eac('0x55')][_0x0eac('0x4b')]({'plain':!![]});if(!_0x49bde6)throw new Error(_0x0eac('0x5d'));if(_0x49bde6[_0x0eac('0x5e')]==='user'){return db[_0x0eac('0x5f')][_0x0eac('0x49')]({'where':{'name':_0x0eac('0x60'),'userProfileId':_0x49bde6[_0x0eac('0x61')]},'raw':!![]})[_0x0eac('0x28')](function(_0x50ce63){if(_0x50ce63){if(_0x50ce63[_0x0eac('0x62')]===0x0){return db[_0x0eac('0x63')][_0x0eac('0x41')]({'where':{'sectionId':_0x50ce63['id']},'raw':!![]})['then'](function(_0x469413){var _0x282d5c=[];if(_[_0x0eac('0x64')](_0x469413)){_0x282d5c=_['filter'](_0x47ed43,function(_0x42290c){if(_0x42290c[_0x0eac('0x5e')]!==_0x0eac('0x53')){return _0x42290c;}});return _0x282d5c;}else{for(var _0x37c4de=0x0;_0x37c4de<_0x47ed43['length'];_0x37c4de++){var _0x4f230e=_0x47ed43[_0x37c4de];if(_0x4f230e[_0x0eac('0x5e')]===_0x0eac('0x53')){var _0x475ccc=_[_0x0eac('0x49')](_0x469413,function(_0x27d709){return _0x27d709[_0x0eac('0x65')]===_0x4f230e['id'];});if(_0x475ccc)_0x282d5c[_0x0eac('0x66')](_0x4f230e);}else{_0x282d5c['push'](_0x4f230e);}}return _0x282d5c;}});}else{return _0x47ed43;}}else{var _0x28e61f=_[_0x0eac('0x3a')](_0x47ed43,function(_0x2b8a44){if(_0x2b8a44[_0x0eac('0x5e')]!==_0x0eac('0x53')){return _0x2b8a44;}});return _0x28e61f;}});}else{return _0x47ed43;}}})['then'](function(_0x4f2616){var _0x2fcb9d=[];if(_0x4f2616){_0x4939b4=_0x4f2616;for(var _0xea141=0x0;_0xea141<_0x4f2616[_0x0eac('0x37')];_0xea141+=0x1){_0x4939b4[_0xea141]['messages']=[];_0x2fcb9d[_0x0eac('0x66')](db[_0x0eac('0x3f')][_0x0eac('0x49')]({'where':{'FromId':[_0x439c07[_0x0eac('0x55')]['id'],_0x4f2616[_0xea141]['id']],'ToId':[_0x439c07[_0x0eac('0x55')]['id'],_0x4f2616[_0xea141]['id']],'ChatGroupId':null},'attributes':['id',_0x0eac('0x4e'),_0x0eac('0x67'),_0x0eac('0x68'),_0x0eac('0x69'),_0x0eac('0x48')],'order':qs['sort'](_0x0eac('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x0eac('0x28')](wrapUser(_0x4f2616[_0xea141])));}return BPromise[_0x0eac('0x6b')](_0x2fcb9d);}return[];})[_0x0eac('0x28')](function(_0x4c8133){return{'rows':_0x4c8133,'count':_0x4c8133[_0x0eac('0x37')]};})[_0x0eac('0x28')](respondWithResult(_0x510cbc,null))['catch'](handleError(_0x510cbc,null));}; \ No newline at end of file +var _0xea05=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','resourceId','push','messages','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','status','end','json','limit','count','offset','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','index','fieldName','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filters','map','type','VIRTUAL','filter','merge','options','ChatInternalMessage','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','body','describe','get','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','fullname','role','userpic','internal','online','lastLoginAt','showWebBar','-online','VoiceQueue','VoiceQueues'];(function(_0x5c9b80,_0x2b2722){var _0x363d13=function(_0x3c77ba){while(--_0x3c77ba){_0x5c9b80['push'](_0x5c9b80['shift']());}};_0x363d13(++_0x2b2722);}(_0xea05,0x83));var _0x5ea0=function(_0x84b8c7,_0x5962ba){_0x84b8c7=_0x84b8c7-0x0;var _0x3aadf3=_0xea05[_0x84b8c7];return _0x3aadf3;};'use strict';var emlformat=require(_0x5ea0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5ea0('0x1'));var jsonpatch=require(_0x5ea0('0x2'));var rp=require('request-promise');var moment=require(_0x5ea0('0x3'));var BPromise=require(_0x5ea0('0x4'));var Mustache=require('mustache');var util=require(_0x5ea0('0x5'));var path=require(_0x5ea0('0x6'));var sox=require(_0x5ea0('0x7'));var csv=require(_0x5ea0('0x8'));var ejs=require(_0x5ea0('0x9'));var fs=require('fs');var fs_extra=require(_0x5ea0('0xa'));var _=require(_0x5ea0('0xb'));var squel=require(_0x5ea0('0xc'));var crypto=require(_0x5ea0('0xd'));var jsforce=require(_0x5ea0('0xe'));var deskjs=require(_0x5ea0('0xf'));var toCsv=require(_0x5ea0('0x8'));var querystring=require(_0x5ea0('0x10'));var Papa=require(_0x5ea0('0x11'));var Redis=require(_0x5ea0('0x12'));var authService=require(_0x5ea0('0x13'));var qs=require(_0x5ea0('0x14'));var as=require(_0x5ea0('0x15'));var hardwareService=require(_0x5ea0('0x16'));var logger=require(_0x5ea0('0x17'))(_0x5ea0('0x18'));var utils=require(_0x5ea0('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x5ea0('0x1a'));var db=require(_0x5ea0('0x1b'))['db'];config[_0x5ea0('0x1c')]=_[_0x5ea0('0x1d')](config[_0x5ea0('0x1c')],{'host':_0x5ea0('0x1e'),'port':0x18eb});var socket=require(_0x5ea0('0x1f'))(new Redis(config[_0x5ea0('0x1c')]));require(_0x5ea0('0x20'))[_0x5ea0('0x21')](socket);function respondWithStatusCode(_0x27f9a0,_0x2e9a80){_0x2e9a80=_0x2e9a80||0xcc;return function(_0x226785){if(_0x226785){return _0x27f9a0['sendStatus'](_0x2e9a80);}return _0x27f9a0[_0x5ea0('0x22')](_0x2e9a80)[_0x5ea0('0x23')]();};}function respondWithResult(_0xc2c60d,_0x2e5e97){_0x2e5e97=_0x2e5e97||0xc8;return function(_0x29a37c){if(_0x29a37c){return _0xc2c60d[_0x5ea0('0x22')](_0x2e5e97)[_0x5ea0('0x24')](_0x29a37c);}};}function respondWithFilteredResult(_0x47d8c5,_0x598f47){return function(_0x16db39){if(_0x16db39){var _0x586cd5=typeof _0x598f47['offset']==='undefined'&&typeof _0x598f47[_0x5ea0('0x25')]==='undefined';var _0x56467d=_0x16db39[_0x5ea0('0x26')];var _0x4cb2fc=_0x586cd5?0x0:_0x598f47[_0x5ea0('0x27')];var _0x434f02=_0x586cd5?_0x16db39[_0x5ea0('0x26')]:_0x598f47[_0x5ea0('0x27')]+_0x598f47[_0x5ea0('0x25')];var _0xeaefd8;if(_0x434f02>=_0x56467d){_0x434f02=_0x56467d;_0xeaefd8=0xc8;}else{_0xeaefd8=0xce;}_0x47d8c5['status'](_0xeaefd8);return _0x47d8c5['set']('Content-Range',_0x4cb2fc+'-'+_0x434f02+'/'+_0x56467d)[_0x5ea0('0x24')](_0x16db39);}return null;};}function patchUpdates(_0xbce8ce){return function(_0x2bb4db){try{jsonpatch[_0x5ea0('0x28')](_0x2bb4db,_0xbce8ce,!![]);}catch(_0x5a8b46){return BPromise[_0x5ea0('0x29')](_0x5a8b46);}return _0x2bb4db[_0x5ea0('0x2a')]();};}function saveUpdates(_0x4a2d3b,_0x245752){return function(_0x56ed3e){if(_0x56ed3e){return _0x56ed3e[_0x5ea0('0x2b')](_0x4a2d3b)['then'](function(_0x3dadc7){return _0x3dadc7;});}return null;};}function removeEntity(_0x37a659,_0x14cfb5){return function(_0x48afb8){if(_0x48afb8){return _0x48afb8[_0x5ea0('0x2c')]()[_0x5ea0('0x2d')](function(){_0x37a659[_0x5ea0('0x22')](0xcc)[_0x5ea0('0x23')]();});}};}function handleEntityNotFound(_0x5e2f4e,_0x4ac6ec){return function(_0x57e07f){if(!_0x57e07f){_0x5e2f4e[_0x5ea0('0x2e')](0x194);}return _0x57e07f;};}function handleError(_0x1ead56,_0x1d6118){_0x1d6118=_0x1d6118||0x1f4;return function(_0x2bb165){logger[_0x5ea0('0x2f')](_0x2bb165[_0x5ea0('0x30')]);if(_0x2bb165[_0x5ea0('0x31')]){delete _0x2bb165[_0x5ea0('0x31')];}_0x1ead56[_0x5ea0('0x22')](_0x1d6118)['send'](_0x2bb165);};}exports[_0x5ea0('0x32')]=function(_0x379a8a,_0x31491e){var _0x2c095b={},_0x36c3c7={},_0x568322={'count':0x0,'rows':[]};var _0x42061c=_['map'](db['ChatInternalMessage']['rawAttributes'],function(_0x83e0f5){return{'name':_0x83e0f5[_0x5ea0('0x33')],'type':_0x83e0f5['type']['key']};});_0x36c3c7[_0x5ea0('0x34')]=_['map'](_0x42061c,_0x5ea0('0x31'));_0x36c3c7[_0x5ea0('0x35')]=_[_0x5ea0('0x36')](_0x379a8a[_0x5ea0('0x35')]);_0x36c3c7['filters']=_[_0x5ea0('0x37')](_0x36c3c7[_0x5ea0('0x34')],_0x36c3c7[_0x5ea0('0x35')]);_0x2c095b[_0x5ea0('0x38')]=_[_0x5ea0('0x37')](_0x36c3c7[_0x5ea0('0x34')],qs[_0x5ea0('0x39')](_0x379a8a[_0x5ea0('0x35')][_0x5ea0('0x39')]));_0x2c095b[_0x5ea0('0x38')]=_0x2c095b[_0x5ea0('0x38')][_0x5ea0('0x3a')]?_0x2c095b['attributes']:_0x36c3c7['model'];if(!_0x379a8a[_0x5ea0('0x35')]['hasOwnProperty'](_0x5ea0('0x3b'))){_0x2c095b['limit']=qs[_0x5ea0('0x25')](_0x379a8a[_0x5ea0('0x35')][_0x5ea0('0x25')]);_0x2c095b[_0x5ea0('0x27')]=qs['offset'](_0x379a8a['query'][_0x5ea0('0x27')]);}_0x2c095b[_0x5ea0('0x3c')]=qs[_0x5ea0('0x3d')](_0x379a8a[_0x5ea0('0x35')]['sort']);_0x2c095b[_0x5ea0('0x3e')]=qs['filters'](_[_0x5ea0('0x3f')](_0x379a8a[_0x5ea0('0x35')],_0x36c3c7[_0x5ea0('0x40')]),_0x42061c);if(_0x379a8a[_0x5ea0('0x35')]['filter']){_0x2c095b[_0x5ea0('0x3e')]=_['merge'](_0x2c095b[_0x5ea0('0x3e')],{'$or':_[_0x5ea0('0x41')](_0x42061c,function(_0x44000a){if(_0x44000a[_0x5ea0('0x42')]!==_0x5ea0('0x43')){var _0x3e98d6={};_0x3e98d6[_0x44000a['name']]={'$like':'%'+_0x379a8a[_0x5ea0('0x35')][_0x5ea0('0x44')]+'%'};return _0x3e98d6;}})});}_0x2c095b=_[_0x5ea0('0x45')]({},_0x2c095b,_0x379a8a[_0x5ea0('0x46')]);var _0x484df1={'where':_0x2c095b[_0x5ea0('0x3e')]};return db[_0x5ea0('0x47')]['count'](_0x484df1)[_0x5ea0('0x2d')](function(_0xaf5df4){_0x568322[_0x5ea0('0x26')]=_0xaf5df4;if(_0x379a8a[_0x5ea0('0x35')][_0x5ea0('0x48')]){_0x2c095b[_0x5ea0('0x49')]=[{'all':!![]}];}return db['ChatInternalMessage'][_0x5ea0('0x4a')](_0x2c095b);})['then'](function(_0x3559cd){_0x568322[_0x5ea0('0x4b')]=_0x3559cd;return _0x568322;})[_0x5ea0('0x2d')](respondWithFilteredResult(_0x31491e,_0x2c095b))['catch'](handleError(_0x31491e,null));};exports[_0x5ea0('0x4c')]=function(_0x2213c8,_0x2222a8){var _0xb1a8f3={'raw':!![],'where':{'id':_0x2213c8[_0x5ea0('0x4d')]['id']}},_0x4ce40b={};_0x4ce40b['model']=_[_0x5ea0('0x36')](db[_0x5ea0('0x47')][_0x5ea0('0x4e')]);_0x4ce40b[_0x5ea0('0x35')]=_[_0x5ea0('0x36')](_0x2213c8[_0x5ea0('0x35')]);_0x4ce40b[_0x5ea0('0x40')]=_['intersection'](_0x4ce40b['model'],_0x4ce40b[_0x5ea0('0x35')]);_0xb1a8f3[_0x5ea0('0x38')]=_[_0x5ea0('0x37')](_0x4ce40b[_0x5ea0('0x34')],qs[_0x5ea0('0x39')](_0x2213c8['query'][_0x5ea0('0x39')]));_0xb1a8f3['attributes']=_0xb1a8f3['attributes']['length']?_0xb1a8f3[_0x5ea0('0x38')]:_0x4ce40b['model'];if(_0x2213c8['query'][_0x5ea0('0x48')]){_0xb1a8f3['include']=[{'all':!![]}];}_0xb1a8f3=_['merge']({},_0xb1a8f3,_0x2213c8[_0x5ea0('0x46')]);return db['ChatInternalMessage'][_0x5ea0('0x4f')](_0xb1a8f3)[_0x5ea0('0x2d')](handleEntityNotFound(_0x2222a8,null))[_0x5ea0('0x2d')](respondWithResult(_0x2222a8,null))[_0x5ea0('0x50')](handleError(_0x2222a8,null));};exports['create']=function(_0x37b7d4,_0x3aa424){return db[_0x5ea0('0x47')]['create'](_0x37b7d4['body'],{})[_0x5ea0('0x2d')](respondWithResult(_0x3aa424,0xc9))[_0x5ea0('0x50')](handleError(_0x3aa424,null));};exports[_0x5ea0('0x2b')]=function(_0x1b64c2,_0x4f7f52){if(_0x1b64c2['body']['id']){delete _0x1b64c2[_0x5ea0('0x51')]['id'];}return db[_0x5ea0('0x47')][_0x5ea0('0x4f')]({'where':{'id':_0x1b64c2[_0x5ea0('0x4d')]['id']}})[_0x5ea0('0x2d')](handleEntityNotFound(_0x4f7f52,null))[_0x5ea0('0x2d')](saveUpdates(_0x1b64c2[_0x5ea0('0x51')],null))[_0x5ea0('0x2d')](respondWithResult(_0x4f7f52,null))[_0x5ea0('0x50')](handleError(_0x4f7f52,null));};exports[_0x5ea0('0x2c')]=function(_0x51b1d5,_0x3351d6){return db[_0x5ea0('0x47')][_0x5ea0('0x4f')]({'where':{'id':_0x51b1d5[_0x5ea0('0x4d')]['id']}})[_0x5ea0('0x2d')](handleEntityNotFound(_0x3351d6,null))['then'](removeEntity(_0x3351d6,null))['catch'](handleError(_0x3351d6,null));};exports[_0x5ea0('0x52')]=function(_0x25862d,_0x24702e){return db[_0x5ea0('0x47')]['describe']()[_0x5ea0('0x2d')](respondWithResult(_0x24702e,null))[_0x5ea0('0x50')](handleError(_0x24702e,null));};function wrapUser(_0x2ecb8d){return function(_0x4a7a67){var _0x2ba0cd=_0x2ecb8d[_0x5ea0('0x53')]({'plain':!![]});_0x2ba0cd['messages']=[];if(_0x4a7a67){_0x2ba0cd['lastMessageAt']=_0x4a7a67[_0x5ea0('0x54')];_0x2ba0cd[_0x5ea0('0x55')]=_0x4a7a67;}else{_0x2ba0cd[_0x5ea0('0x56')]=moment(0x0)[_0x5ea0('0x57')](_0x5ea0('0x58'));_0x2ba0cd[_0x5ea0('0x55')]={};}return _0x2ba0cd;};}exports[_0x5ea0('0x59')]=function(_0xf22317,_0x5923f3,_0x22a509){var _0x1c7ec9=[];return db[_0x5ea0('0x5a')][_0x5ea0('0x4a')]({'where':{'role':[_0x5ea0('0x5b'),_0x5ea0('0x5c'),'user']},'attributes':['id',_0x5ea0('0x5d'),'name',_0x5ea0('0x5e'),_0x5ea0('0x5f'),_0x5ea0('0x60'),_0x5ea0('0x61'),_0x5ea0('0x62'),'allowmessenger',_0x5ea0('0x63')],'order':qs[_0x5ea0('0x3d')](_0x5ea0('0x64')),'include':[{'model':db[_0x5ea0('0x65')],'as':_0x5ea0('0x66'),'attributes':['id',_0x5ea0('0x31'),_0x5ea0('0x42')],'through':{'attributes':[]}}]})['then'](function(_0xc2f8e){if(_0xc2f8e){var _0x5e06f3=_0xf22317[_0x5ea0('0x67')][_0x5ea0('0x53')]({'plain':!![]});if(!_0x5e06f3)throw new Error(_0x5ea0('0x68'));if(_0x5e06f3[_0x5ea0('0x5e')]===_0x5ea0('0x67')){return db[_0x5ea0('0x69')][_0x5ea0('0x4f')]({'where':{'name':_0x5ea0('0x6a'),'userProfileId':_0x5e06f3['userProfileId']},'raw':!![]})['then'](function(_0x4f0f13){if(_0x4f0f13){if(_0x4f0f13[_0x5ea0('0x6b')]===0x0){return db[_0x5ea0('0x6c')]['findAll']({'where':{'sectionId':_0x4f0f13['id']},'raw':!![]})['then'](function(_0x19d850){var _0x2c8eb1=[];if(_[_0x5ea0('0x6d')](_0x19d850)){_0x2c8eb1=_[_0x5ea0('0x44')](_0xc2f8e,function(_0xfed606){if(_0xfed606[_0x5ea0('0x5e')]!=='agent'){return _0xfed606;}});return _0x2c8eb1;}else{for(var _0x2903a5=0x0;_0x2903a5<_0xc2f8e[_0x5ea0('0x3a')];_0x2903a5++){var _0x11ac33=_0xc2f8e[_0x2903a5];if(_0x11ac33[_0x5ea0('0x5e')]===_0x5ea0('0x5b')){var _0x183b8e=_[_0x5ea0('0x4f')](_0x19d850,function(_0x1a4242){return _0x1a4242[_0x5ea0('0x6e')]===_0x11ac33['id'];});if(_0x183b8e)_0x2c8eb1['push'](_0x11ac33);}else{_0x2c8eb1[_0x5ea0('0x6f')](_0x11ac33);}}return _0x2c8eb1;}});}else{return _0xc2f8e;}}else{var _0x36270a=_[_0x5ea0('0x44')](_0xc2f8e,function(_0x24af22){if(_0x24af22['role']!==_0x5ea0('0x5b')){return _0x24af22;}});return _0x36270a;}});}else{return _0xc2f8e;}}})[_0x5ea0('0x2d')](function(_0x1e0bd7){var _0x39123c=[];if(_0x1e0bd7){_0x1c7ec9=_0x1e0bd7;for(var _0x4cb482=0x0;_0x4cb482<_0x1e0bd7['length'];_0x4cb482+=0x1){_0x1c7ec9[_0x4cb482][_0x5ea0('0x70')]=[];_0x39123c[_0x5ea0('0x6f')](db[_0x5ea0('0x47')]['find']({'where':{'FromId':[_0xf22317[_0x5ea0('0x67')]['id'],_0x1e0bd7[_0x4cb482]['id']],'ToId':[_0xf22317[_0x5ea0('0x67')]['id'],_0x1e0bd7[_0x4cb482]['id']],'ChatGroupId':null},'attributes':['id','createdAt','FromId',_0x5ea0('0x71'),_0x5ea0('0x72'),_0x5ea0('0x51')],'order':qs[_0x5ea0('0x3d')](_0x5ea0('0x73')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x5ea0('0x2d')](wrapUser(_0x1e0bd7[_0x4cb482])));}return BPromise[_0x5ea0('0x74')](_0x39123c);}return[];})[_0x5ea0('0x2d')](function(_0x37919f){return{'rows':_0x37919f,'count':_0x37919f['length']};})['then'](respondWithResult(_0x5923f3,null))[_0x5ea0('0x50')](handleError(_0x5923f3,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index f22d372..13512b3 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 _0x8074=['save','update','remove','emit','exports','events','../../mysqldb','ChatInternalMessage'];(function(_0x5c6244,_0x112ab8){var _0x5800ce=function(_0x304e3d){while(--_0x304e3d){_0x5c6244['push'](_0x5c6244['shift']());}};_0x5800ce(++_0x112ab8);}(_0x8074,0x175));var _0x4807=function(_0x4dd37d,_0xfa992f){_0x4dd37d=_0x4dd37d-0x0;var _0x59e3e4=_0x8074[_0x4dd37d];return _0x59e3e4;};'use strict';var EventEmitter=require(_0x4807('0x0'));var ChatInternalMessage=require(_0x4807('0x1'))['db'][_0x4807('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4807('0x3'),'afterUpdate':_0x4807('0x4'),'afterDestroy':_0x4807('0x5')};function emitEvent(_0x52ee5e){return function(_0x53ce14,_0x1d05e7,_0x268da1){ChatInternalMessageEvents[_0x4807('0x6')](_0x52ee5e+':'+_0x53ce14['id'],_0x53ce14);ChatInternalMessageEvents[_0x4807('0x6')](_0x52ee5e,_0x53ce14);_0x268da1(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x4807('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xb346=['events','../../mysqldb','setMaxListeners','save','update','remove','exports'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb346,0xcb));var _0x6b34=function(_0x4cad3a,_0xdce040){_0x4cad3a=_0x4cad3a-0x0;var _0x3d20b2=_0xb346[_0x4cad3a];return _0x3d20b2;};'use strict';var EventEmitter=require(_0x6b34('0x0'));var ChatInternalMessage=require(_0x6b34('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x6b34('0x2')](0x0);var events={'afterCreate':_0x6b34('0x3'),'afterUpdate':_0x6b34('0x4'),'afterDestroy':_0x6b34('0x5')};function emitEvent(_0x59805e){return function(_0x5e1406,_0x56e6dd,_0x49c8ec){ChatInternalMessageEvents['emit'](_0x59805e+':'+_0x5e1406['id'],_0x5e1406);ChatInternalMessageEvents['emit'](_0x59805e,_0x5e1406);_0x49c8ec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0x6b34('0x6')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3b5a2a4..4f43569 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 _0x8f77=['bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4_unicode_ci','lodash','util','api','moment'];(function(_0x4c1e63,_0x296a91){var _0x45d095=function(_0x351b45){while(--_0x351b45){_0x4c1e63['push'](_0x4c1e63['shift']());}};_0x45d095(++_0x296a91);}(_0x8f77,0x168));var _0x78f7=function(_0x317894,_0x592674){_0x317894=_0x317894-0x0;var _0x3aacf7=_0x8f77[_0x317894];return _0x3aacf7;};'use strict';var _=require(_0x78f7('0x0'));var util=require(_0x78f7('0x1'));var logger=require('../../config/logger')(_0x78f7('0x2'));var moment=require(_0x78f7('0x3'));var BPromise=require(_0x78f7('0x4'));var rp=require(_0x78f7('0x5'));var fs=require('fs');var path=require(_0x78f7('0x6'));var rimraf=require(_0x78f7('0x7'));var config=require(_0x78f7('0x8'));var attributes=require(_0x78f7('0x9'));module['exports']=function(_0x5adb2c,_0x30ec96){return _0x5adb2c[_0x78f7('0xa')](_0x78f7('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x78f7('0xc')});}; \ No newline at end of file +var _0xbbba=['rimraf','../../config/environment','./chatInternalMessage.attributes','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbbba,0x1d5));var _0xabbb=function(_0x46ef1d,_0x24926){_0x46ef1d=_0x46ef1d-0x0;var _0x49ce69=_0xbbba[_0x46ef1d];return _0x49ce69;};'use strict';var _=require(_0xabbb('0x0'));var util=require('util');var logger=require(_0xabbb('0x1'))(_0xabbb('0x2'));var moment=require(_0xabbb('0x3'));var BPromise=require(_0xabbb('0x4'));var rp=require(_0xabbb('0x5'));var fs=require('fs');var path=require(_0xabbb('0x6'));var rimraf=require(_0xabbb('0x7'));var config=require(_0xabbb('0x8'));var attributes=require(_0xabbb('0x9'));module['exports']=function(_0x239819,_0x197656){return _0x239819[_0xabbb('0xa')](_0xabbb('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabbb('0xc'),'collate':_0xabbb('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 1ac3c35..da1b965 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 _0xda7f=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x4529c2,_0x18370a){var _0x173e80=function(_0x4e7fa3){while(--_0x4e7fa3){_0x4529c2['push'](_0x4529c2['shift']());}};_0x173e80(++_0x18370a);}(_0xda7f,0xc6));var _0xfda7=function(_0x2d3ba8,_0x168519){_0x2d3ba8=_0x2d3ba8-0x0;var _0x41b210=_0xda7f[_0x2d3ba8];return _0x41b210;};'use strict';var _=require(_0xfda7('0x0'));var util=require('util');var moment=require(_0xfda7('0x1'));var BPromise=require(_0xfda7('0x2'));var rs=require(_0xfda7('0x3'));var fs=require('fs');var Redis=require(_0xfda7('0x4'));var db=require(_0xfda7('0x5'))['db'];var utils=require(_0xfda7('0x6'));var logger=require(_0xfda7('0x7'))(_0xfda7('0x8'));var config=require('../../config/environment');var jayson=require(_0xfda7('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfda7('0xa')]=_[_0xfda7('0xb')](config[_0xfda7('0xa')],{'host':_0xfda7('0xc'),'port':0x18eb});var socket=require(_0xfda7('0xd'))(new Redis(config[_0xfda7('0xa')]));require(_0xfda7('0xe'))[_0xfda7('0xf')](socket);function respondWithRpcPromise(_0x20ffe4,_0x2c812c,_0x147837){return new BPromise(function(_0xddf6d8,_0x24f16e){return client['request'](_0x20ffe4,_0x147837)['then'](function(_0x24363e){logger[_0xfda7('0x10')](_0xfda7('0x11'),_0x2c812c,'request\x20sent');logger[_0xfda7('0x12')](_0xfda7('0x13'),_0x2c812c,_0xfda7('0x14'),JSON['stringify'](_0x24363e));if(_0x24363e[_0xfda7('0x15')]){if(_0x24363e[_0xfda7('0x15')][_0xfda7('0x16')]===0x1f4){logger[_0xfda7('0x15')](_0xfda7('0x11'),_0x2c812c,_0x24363e['error'][_0xfda7('0x17')]);return _0x24f16e(_0x24363e[_0xfda7('0x15')][_0xfda7('0x17')]);}logger[_0xfda7('0x15')](_0xfda7('0x11'),_0x2c812c,_0x24363e[_0xfda7('0x15')][_0xfda7('0x17')]);return _0xddf6d8(_0x24363e[_0xfda7('0x15')]['message']);}else{logger['info'](_0xfda7('0x11'),_0x2c812c,_0xfda7('0x14'));_0xddf6d8(_0x24363e[_0xfda7('0x18')][_0xfda7('0x17')]);}})[_0xfda7('0x19')](function(_0x337cd0){logger[_0xfda7('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2c812c,_0x337cd0);_0x24f16e(_0x337cd0);});});} \ No newline at end of file +var _0x7764=['localhost','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','bluebird','randomstring','rpc','../../config/environment','http','redis','defaults'];(function(_0x5f1b75,_0x29f705){var _0x416250=function(_0x579136){while(--_0x579136){_0x5f1b75['push'](_0x5f1b75['shift']());}};_0x416250(++_0x29f705);}(_0x7764,0xa8));var _0x4776=function(_0x6a0266,_0x1552d6){_0x6a0266=_0x6a0266-0x0;var _0x309e00=_0x7764[_0x6a0266];return _0x309e00;};'use strict';var _=require(_0x4776('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4776('0x1'));var rs=require(_0x4776('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4776('0x3'));var config=require(_0x4776('0x4'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4776('0x5')]({'port':0x232a});config[_0x4776('0x6')]=_[_0x4776('0x7')](config[_0x4776('0x6')],{'host':_0x4776('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4776('0x6')]));require(_0x4776('0x9'))[_0x4776('0xa')](socket);function respondWithRpcPromise(_0x54c704,_0x4e7ce4,_0x7510b3){return new BPromise(function(_0x13be9b,_0x351038){return client[_0x4776('0xb')](_0x54c704,_0x7510b3)[_0x4776('0xc')](function(_0x1899d5){logger['info'](_0x4776('0xd'),_0x4e7ce4,'request\x20sent');logger['debug'](_0x4776('0xe'),_0x4e7ce4,_0x4776('0xf'),JSON['stringify'](_0x1899d5));if(_0x1899d5[_0x4776('0x10')]){if(_0x1899d5['error'][_0x4776('0x11')]===0x1f4){logger[_0x4776('0x10')](_0x4776('0xd'),_0x4e7ce4,_0x1899d5['error'][_0x4776('0x12')]);return _0x351038(_0x1899d5[_0x4776('0x10')]['message']);}logger[_0x4776('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x4e7ce4,_0x1899d5[_0x4776('0x10')]['message']);return _0x13be9b(_0x1899d5[_0x4776('0x10')][_0x4776('0x12')]);}else{logger[_0x4776('0x13')](_0x4776('0xd'),_0x4e7ce4,_0x4776('0xf'));_0x13be9b(_0x1899d5[_0x4776('0x14')]['message']);}})[_0x4776('0x15')](function(_0x1b080a){logger[_0x4776('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x4e7ce4,_0x1b080a);_0x351038(_0x1b080a);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 34cca02..2fcdc17 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 _0xef6d=['./chatInternalMessage.events','remove','update','emit','removeListener','register','length'];(function(_0xa259f8,_0x328468){var _0x1c6122=function(_0x25a2d2){while(--_0x25a2d2){_0xa259f8['push'](_0xa259f8['shift']());}};_0x1c6122(++_0x328468);}(_0xef6d,0x9a));var _0xdef6=function(_0x563b83,_0x127542){_0x563b83=_0x563b83-0x0;var _0x327e62=_0xef6d[_0x563b83];return _0x327e62;};'use strict';var ChatInternalMessageEvents=require(_0xdef6('0x0'));var events=['save',_0xdef6('0x1'),_0xdef6('0x2')];function createListener(_0x3181ab,_0x45611e){return function(_0x21a1ae){_0x45611e[_0xdef6('0x3')](_0x3181ab,_0x21a1ae);};}function removeListener(_0x2333a2,_0x1a0fb1){return function(){ChatInternalMessageEvents[_0xdef6('0x4')](_0x2333a2,_0x1a0fb1);};}exports[_0xdef6('0x5')]=function(_0x102c3f){for(var _0x3cc298=0x0,_0x187faa=events[_0xdef6('0x6')];_0x3cc298<_0x187faa;_0x3cc298++){var _0x4b0e11=events[_0x3cc298];var _0x23af9f=createListener('chatInternalMessage:'+_0x4b0e11,_0x102c3f);ChatInternalMessageEvents['on'](_0x4b0e11,_0x23af9f);}}; \ No newline at end of file +var _0x410c=['update','removeListener','register','length','chatInternalMessage:','./chatInternalMessage.events','save','remove'];(function(_0x414407,_0x126c2d){var _0x556184=function(_0x2fd6d4){while(--_0x2fd6d4){_0x414407['push'](_0x414407['shift']());}};_0x556184(++_0x126c2d);}(_0x410c,0x75));var _0xc410=function(_0x1a43a8,_0x2396dc){_0x1a43a8=_0x1a43a8-0x0;var _0x4a7b9b=_0x410c[_0x1a43a8];return _0x4a7b9b;};'use strict';var ChatInternalMessageEvents=require(_0xc410('0x0'));var events=[_0xc410('0x1'),_0xc410('0x2'),_0xc410('0x3')];function createListener(_0x361d70,_0x1e7227){return function(_0x384ed4){_0x1e7227['emit'](_0x361d70,_0x384ed4);};}function removeListener(_0x21c3fe,_0x3c64d6){return function(){ChatInternalMessageEvents[_0xc410('0x4')](_0x21c3fe,_0x3c64d6);};}exports[_0xc410('0x5')]=function(_0xe914d7){for(var _0x35554a=0x0,_0x13d91d=events[_0xc410('0x6')];_0x35554a<_0x13d91d;_0x35554a++){var _0x402f89=events[_0x35554a];var _0x32039a=createListener(_0xc410('0x7')+_0x402f89,_0xe914d7);ChatInternalMessageEvents['on'](_0x402f89,_0x32039a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 97d5115..4f55398 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 _0xf2b9=['post','create','put','update','delete','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','describe','/users','getUsers','/:id','show'];(function(_0x385567,_0x40550f){var _0x49cf95=function(_0x4d3081){while(--_0x4d3081){_0x385567['push'](_0x385567['shift']());}};_0x49cf95(++_0x40550f);}(_0xf2b9,0x123));var _0x9f2b=function(_0x823d69,_0x2f7e02){_0x823d69=_0x823d69-0x0;var _0x2b2073=_0xf2b9[_0x823d69];return _0x2b2073;};'use strict';var multer=require(_0x9f2b('0x0'));var util=require(_0x9f2b('0x1'));var path=require(_0x9f2b('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f2b('0x3'));var router=express[_0x9f2b('0x4')]();var fs_extra=require(_0x9f2b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9f2b('0x6'));var config=require(_0x9f2b('0x7'));var controller=require(_0x9f2b('0x8'));router[_0x9f2b('0x9')]('/',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0xb')]);router[_0x9f2b('0x9')]('/describe',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0xc')]);router['get'](_0x9f2b('0xd'),auth['isAuthenticated'](),controller[_0x9f2b('0xe')]);router['get'](_0x9f2b('0xf'),auth[_0x9f2b('0xa')](),controller[_0x9f2b('0x10')]);router[_0x9f2b('0x11')]('/',auth[_0x9f2b('0xa')](),controller[_0x9f2b('0x12')]);router[_0x9f2b('0x13')](_0x9f2b('0xf'),controller[_0x9f2b('0x14')]);router[_0x9f2b('0x15')]('/:id',auth[_0x9f2b('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6ac5=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','post','update','delete','destroy','exports'];(function(_0x1acfe8,_0x29e1ac){var _0x295faf=function(_0x59a9b5){while(--_0x59a9b5){_0x1acfe8['push'](_0x1acfe8['shift']());}};_0x295faf(++_0x29e1ac);}(_0x6ac5,0x18c));var _0x56ac=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ac5[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x56ac('0x0'));var path=require(_0x56ac('0x1'));var timeout=require(_0x56ac('0x2'));var express=require(_0x56ac('0x3'));var router=express[_0x56ac('0x4')]();var fs_extra=require(_0x56ac('0x5'));var auth=require(_0x56ac('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x56ac('0x7'));var controller=require(_0x56ac('0x8'));router[_0x56ac('0x9')]('/',auth[_0x56ac('0xa')](),controller[_0x56ac('0xb')]);router[_0x56ac('0x9')](_0x56ac('0xc'),auth[_0x56ac('0xa')](),controller[_0x56ac('0xd')]);router[_0x56ac('0x9')](_0x56ac('0xe'),auth[_0x56ac('0xa')](),controller[_0x56ac('0xf')]);router['get'](_0x56ac('0x10'),auth[_0x56ac('0xa')](),controller['show']);router[_0x56ac('0x11')]('/',auth[_0x56ac('0xa')](),controller['create']);router['put'](_0x56ac('0x10'),controller[_0x56ac('0x12')]);router[_0x56ac('0x13')](_0x56ac('0x10'),auth[_0x56ac('0xa')](),controller[_0x56ac('0x14')]);module[_0x56ac('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 6890532..d6110e4 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 _0x6ae2=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x32b542,_0x4512fa){var _0x554d54=function(_0x35cdfc){while(--_0x35cdfc){_0x32b542['push'](_0x32b542['shift']());}};_0x554d54(++_0x4512fa);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x266a1a,_0x28c25f){_0x266a1a=_0x266a1a-0x0;var _0x245e51=_0x6ae2[_0x266a1a];return _0x245e51;};'use strict';var Sequelize=require(_0x26ae('0x0'));module[_0x26ae('0x1')]={'body':{'type':Sequelize[_0x26ae('0x2')](_0x26ae('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x26ae('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x26ae('0x5')]('in',_0x26ae('0x6')),'defaultValue':_0x26ae('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x26ae('0x7')]},'providerResponse':{'type':Sequelize[_0x26ae('0x2')]}}; \ No newline at end of file +var _0xdf92=['out','DATE','STRING','TEXT','sequelize','medium','BOOLEAN','ENUM'];(function(_0x1ea553,_0x54ad76){var _0x472d6b=function(_0x2e8fe0){while(--_0x2e8fe0){_0x1ea553['push'](_0x1ea553['shift']());}};_0x472d6b(++_0x54ad76);}(_0xdf92,0x10c));var _0x2df9=function(_0x269943,_0xcf2a69){_0x269943=_0x269943-0x0;var _0x1fa986=_0xdf92[_0x269943];return _0x1fa986;};'use strict';var Sequelize=require(_0x2df9('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2df9('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2df9('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x2df9('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x2df9('0x3')]('in',_0x2df9('0x4')),'defaultValue':_0x2df9('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x2df9('0x5')]},'providerName':{'type':Sequelize[_0x2df9('0x6')]},'providerResponse':{'type':Sequelize[_0x2df9('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 8434e8b..93ddd7c 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 _0xf5cd=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','client','http','request','then','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','sendStatus','status','json','offset','undefined','count','limit','set','apply','reject','update','end','send','index','map','ChatMessage','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','destroy','describe','accept','chat','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteraction','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','name','channel','EventManager','acceptmessage','parse','formData','chat-interactions','ChatInteractionId','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','motionChannel','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x31c1af,_0x35051d){var _0x10b974=function(_0x3eaf34){while(--_0x3eaf34){_0x31c1af['push'](_0x31c1af['shift']());}};_0x10b974(++_0x35051d);}(_0xf5cd,0xf5));var _0xdf5c=function(_0x5ce5d6,_0x294bef){_0x5ce5d6=_0x5ce5d6-0x0;var _0x1ae010=_0xf5cd[_0x5ce5d6];return _0x1ae010;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdf5c('0x0'));var zipdir=require(_0xdf5c('0x1'));var jsonpatch=require(_0xdf5c('0x2'));var rp=require(_0xdf5c('0x3'));var moment=require(_0xdf5c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdf5c('0x5'));var util=require(_0xdf5c('0x6'));var path=require('path');var sox=require(_0xdf5c('0x7'));var csv=require('to-csv');var ejs=require(_0xdf5c('0x8'));var fs=require('fs');var fs_extra=require(_0xdf5c('0x9'));var _=require(_0xdf5c('0xa'));var squel=require('squel');var crypto=require(_0xdf5c('0xb'));var jsforce=require(_0xdf5c('0xc'));var deskjs=require(_0xdf5c('0xd'));var toCsv=require(_0xdf5c('0xe'));var querystring=require(_0xdf5c('0xf'));var Papa=require(_0xdf5c('0x10'));var Redis=require(_0xdf5c('0x11'));var authService=require(_0xdf5c('0x12'));var qs=require(_0xdf5c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdf5c('0x14'));var logger=require(_0xdf5c('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdf5c('0x16'));var licenseUtil=require(_0xdf5c('0x17'));var db=require(_0xdf5c('0x18'))['db'];config[_0xdf5c('0x19')]=_['defaults'](config[_0xdf5c('0x19')],{'host':_0xdf5c('0x1a'),'port':0x18eb});var socket=require(_0xdf5c('0x1b'))(new Redis(config[_0xdf5c('0x19')]));require('./chatMessage.socket')['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xdf5c('0x1c')][_0xdf5c('0x1d')]({'port':0x232c});var client9002=jayson[_0xdf5c('0x1c')][_0xdf5c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x58d52b,_0x2c6101,_0x2d5d79,_0x24247d){return new BPromise(function(_0x338818,_0x316a3f){var _0x2d9471=_0x24247d||client;return _0x2d9471[_0xdf5c('0x1e')](_0x58d52b,_0x2d5d79)[_0xdf5c('0x1f')](function(_0x2f58e1){logger['info'](_0xdf5c('0x20'),_0x2c6101,_0xdf5c('0x21'));logger[_0xdf5c('0x22')](_0xdf5c('0x23'),_0x2c6101,'request\x20sent',JSON[_0xdf5c('0x24')](_0x2f58e1));if(_0x2f58e1[_0xdf5c('0x25')]){if(_0x2f58e1[_0xdf5c('0x25')]['code']===0x1f4){logger[_0xdf5c('0x25')]('ChatMessage,\x20%s,\x20%s',_0x2c6101,_0x2f58e1[_0xdf5c('0x25')][_0xdf5c('0x26')]);return _0x316a3f(_0x2f58e1['error']['message']);}logger['error'](_0xdf5c('0x20'),_0x2c6101,_0x2f58e1[_0xdf5c('0x25')][_0xdf5c('0x26')]);return _0x338818(_0x2f58e1['error'][_0xdf5c('0x26')]);}else{logger[_0xdf5c('0x27')](_0xdf5c('0x20'),_0x2c6101,_0xdf5c('0x21'));_0x338818(_0x2f58e1[_0xdf5c('0x28')][_0xdf5c('0x26')]);}})['catch'](function(_0x5ef559){logger['error'](_0xdf5c('0x20'),_0x2c6101,_0x5ef559);_0x316a3f(_0x5ef559);});});}function respondWithStatusCode(_0x926e13,_0x4dd24b){_0x4dd24b=_0x4dd24b||0xcc;return function(_0xe7f220){if(_0xe7f220){return _0x926e13[_0xdf5c('0x29')](_0x4dd24b);}return _0x926e13[_0xdf5c('0x2a')](_0x4dd24b)['end']();};}function respondWithResult(_0x4672fb,_0x5424fa){_0x5424fa=_0x5424fa||0xc8;return function(_0x2ea18b){if(_0x2ea18b){return _0x4672fb[_0xdf5c('0x2a')](_0x5424fa)[_0xdf5c('0x2b')](_0x2ea18b);}};}function respondWithFilteredResult(_0x1de4b7,_0x3f0a98){return function(_0x413cbe){if(_0x413cbe){var _0x2781b7=typeof _0x3f0a98[_0xdf5c('0x2c')]==='undefined'&&typeof _0x3f0a98['limit']===_0xdf5c('0x2d');var _0x15ceef=_0x413cbe['count'];var _0x218b47=_0x2781b7?0x0:_0x3f0a98[_0xdf5c('0x2c')];var _0x2ddfbb=_0x2781b7?_0x413cbe[_0xdf5c('0x2e')]:_0x3f0a98[_0xdf5c('0x2c')]+_0x3f0a98[_0xdf5c('0x2f')];var _0x17c658;if(_0x2ddfbb>=_0x15ceef){_0x2ddfbb=_0x15ceef;_0x17c658=0xc8;}else{_0x17c658=0xce;}_0x1de4b7[_0xdf5c('0x2a')](_0x17c658);return _0x1de4b7[_0xdf5c('0x30')]('Content-Range',_0x218b47+'-'+_0x2ddfbb+'/'+_0x15ceef)[_0xdf5c('0x2b')](_0x413cbe);}return null;};}function patchUpdates(_0x32970f){return function(_0x591927){try{jsonpatch[_0xdf5c('0x31')](_0x591927,_0x32970f,!![]);}catch(_0x56d96c){return BPromise[_0xdf5c('0x32')](_0x56d96c);}return _0x591927['save']();};}function saveUpdates(_0x14bd03,_0xbde3d0){return function(_0x5e54f0){if(_0x5e54f0){return _0x5e54f0[_0xdf5c('0x33')](_0x14bd03)[_0xdf5c('0x1f')](function(_0x19b9a2){return _0x19b9a2;});}return null;};}function removeEntity(_0x5033c0,_0x1c5f46){return function(_0x3b6053){if(_0x3b6053){return _0x3b6053['destroy']()[_0xdf5c('0x1f')](function(){_0x5033c0[_0xdf5c('0x2a')](0xcc)[_0xdf5c('0x34')]();});}};}function handleEntityNotFound(_0x2c9c6a,_0x509d63){return function(_0x1de5c1){if(!_0x1de5c1){_0x2c9c6a[_0xdf5c('0x29')](0x194);}return _0x1de5c1;};}function handleError(_0x508654,_0xe7e9b9){_0xe7e9b9=_0xe7e9b9||0x1f4;return function(_0x2c6f54){logger['error'](_0x2c6f54['stack']);if(_0x2c6f54['name']){delete _0x2c6f54['name'];}_0x508654[_0xdf5c('0x2a')](_0xe7e9b9)[_0xdf5c('0x35')](_0x2c6f54);};}exports[_0xdf5c('0x36')]=function(_0x201cad,_0x18d6db){var _0x115c55={},_0x35f60d={},_0x399243={'count':0x0,'rows':[]};var _0x709921=_[_0xdf5c('0x37')](db[_0xdf5c('0x38')][_0xdf5c('0x39')],function(_0x45a427){return{'name':_0x45a427['fieldName'],'type':_0x45a427[_0xdf5c('0x3a')][_0xdf5c('0x3b')]};});_0x35f60d['model']=_[_0xdf5c('0x37')](_0x709921,'name');_0x35f60d[_0xdf5c('0x3c')]=_[_0xdf5c('0x3d')](_0x201cad[_0xdf5c('0x3c')]);_0x35f60d[_0xdf5c('0x3e')]=_[_0xdf5c('0x3f')](_0x35f60d[_0xdf5c('0x40')],_0x35f60d[_0xdf5c('0x3c')]);_0x115c55[_0xdf5c('0x41')]=_[_0xdf5c('0x3f')](_0x35f60d[_0xdf5c('0x40')],qs[_0xdf5c('0x42')](_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x42')]));_0x115c55[_0xdf5c('0x41')]=_0x115c55[_0xdf5c('0x41')]['length']?_0x115c55[_0xdf5c('0x41')]:_0x35f60d[_0xdf5c('0x40')];if(!_0x201cad['query']['hasOwnProperty'](_0xdf5c('0x43'))){_0x115c55[_0xdf5c('0x2f')]=qs[_0xdf5c('0x2f')](_0x201cad['query'][_0xdf5c('0x2f')]);_0x115c55[_0xdf5c('0x2c')]=qs['offset'](_0x201cad[_0xdf5c('0x3c')]['offset']);}_0x115c55[_0xdf5c('0x44')]=qs[_0xdf5c('0x45')](_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x45')]);_0x115c55[_0xdf5c('0x46')]=qs[_0xdf5c('0x3e')](_[_0xdf5c('0x47')](_0x201cad[_0xdf5c('0x3c')],_0x35f60d[_0xdf5c('0x3e')]),_0x709921);if(_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x48')]){_0x115c55[_0xdf5c('0x46')]=_[_0xdf5c('0x49')](_0x115c55[_0xdf5c('0x46')],{'$or':_[_0xdf5c('0x37')](_0x709921,function(_0x3a17f4){if(_0x3a17f4[_0xdf5c('0x3a')]!=='VIRTUAL'){var _0x56e970={};_0x56e970[_0x3a17f4['name']]={'$like':'%'+_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x48')]+'%'};return _0x56e970;}})});}_0x115c55=_['merge']({},_0x115c55,_0x201cad['options']);var _0x86211b={'where':_0x115c55[_0xdf5c('0x46')]};return db[_0xdf5c('0x38')][_0xdf5c('0x2e')](_0x86211b)['then'](function(_0x55e954){_0x399243['count']=_0x55e954;if(_0x201cad[_0xdf5c('0x3c')][_0xdf5c('0x4a')]){_0x115c55[_0xdf5c('0x4b')]=[{'all':!![]}];}return db[_0xdf5c('0x38')][_0xdf5c('0x4c')](_0x115c55);})[_0xdf5c('0x1f')](function(_0x2ad430){_0x399243[_0xdf5c('0x4d')]=_0x2ad430;return _0x399243;})['then'](respondWithFilteredResult(_0x18d6db,_0x115c55))[_0xdf5c('0x4e')](handleError(_0x18d6db,null));};exports[_0xdf5c('0x4f')]=function(_0x46034c,_0x5ad0f4){var _0x434e1f={'raw':!![],'where':{'id':_0x46034c[_0xdf5c('0x50')]['id']}},_0x1047c6={};_0x1047c6['model']=_[_0xdf5c('0x3d')](db[_0xdf5c('0x38')][_0xdf5c('0x39')]);_0x1047c6['query']=_[_0xdf5c('0x3d')](_0x46034c['query']);_0x1047c6[_0xdf5c('0x3e')]=_[_0xdf5c('0x3f')](_0x1047c6[_0xdf5c('0x40')],_0x1047c6[_0xdf5c('0x3c')]);_0x434e1f[_0xdf5c('0x41')]=_[_0xdf5c('0x3f')](_0x1047c6['model'],qs[_0xdf5c('0x42')](_0x46034c[_0xdf5c('0x3c')][_0xdf5c('0x42')]));_0x434e1f[_0xdf5c('0x41')]=_0x434e1f[_0xdf5c('0x41')][_0xdf5c('0x51')]?_0x434e1f[_0xdf5c('0x41')]:_0x1047c6[_0xdf5c('0x40')];if(_0x46034c[_0xdf5c('0x3c')][_0xdf5c('0x4a')]){_0x434e1f['include']=[{'all':!![]}];}_0x434e1f=_[_0xdf5c('0x49')]({},_0x434e1f,_0x46034c[_0xdf5c('0x52')]);return db['ChatMessage'][_0xdf5c('0x53')](_0x434e1f)[_0xdf5c('0x1f')](handleEntityNotFound(_0x5ad0f4,null))['then'](respondWithResult(_0x5ad0f4,null))[_0xdf5c('0x4e')](handleError(_0x5ad0f4,null));};exports['create']=function(_0x37ddb8,_0x2ec1b2){return db[_0xdf5c('0x38')]['create'](_0x37ddb8[_0xdf5c('0x54')],{})[_0xdf5c('0x1f')](respondWithResult(_0x2ec1b2,0xc9))[_0xdf5c('0x4e')](handleError(_0x2ec1b2,null));};exports[_0xdf5c('0x33')]=function(_0x34afe7,_0x59a10f){if(_0x34afe7[_0xdf5c('0x54')]['id']){delete _0x34afe7[_0xdf5c('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x34afe7[_0xdf5c('0x50')]['id']}})['then'](handleEntityNotFound(_0x59a10f,null))[_0xdf5c('0x1f')](saveUpdates(_0x34afe7[_0xdf5c('0x54')],null))[_0xdf5c('0x1f')](respondWithResult(_0x59a10f,null))[_0xdf5c('0x4e')](handleError(_0x59a10f,null));};exports[_0xdf5c('0x55')]=function(_0x5222b3,_0x59df16){return db[_0xdf5c('0x38')][_0xdf5c('0x53')]({'where':{'id':_0x5222b3['params']['id']}})[_0xdf5c('0x1f')](handleEntityNotFound(_0x59df16,null))[_0xdf5c('0x1f')](removeEntity(_0x59df16,null))['catch'](handleError(_0x59df16,null));};exports[_0xdf5c('0x56')]=function(_0x1c7e16,_0xd3b694){return db['ChatMessage'][_0xdf5c('0x56')]()[_0xdf5c('0x1f')](respondWithResult(_0xd3b694,null))[_0xdf5c('0x4e')](handleError(_0xd3b694,null));};var interaction_log=require('../../config/logger')('chat-interactions');exports[_0xdf5c('0x57')]=function(_0x41ad54,_0xbd1f43,_0x1f34a9){var _0xedc47e={'agent':{},'channel':_0xdf5c('0x58')};if(_0x41ad54[_0xdf5c('0x54')]['id']){delete _0x41ad54['body']['id'];}_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x59')]=!![];_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5a')]=moment()[_0xdf5c('0x5b')](_0xdf5c('0x5c'));_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5d')]=_0x41ad54['body']['UserId']||_0x41ad54[_0xdf5c('0x5e')]['id'];_0xedc47e[_0xdf5c('0x5f')]['id']=_0x41ad54['body'][_0xdf5c('0x5d')];return db[_0xdf5c('0x38')][_0xdf5c('0x53')]({'where':{'id':_0x41ad54[_0xdf5c('0x50')]['id'],'UserId':null}})[_0xdf5c('0x1f')](handleEntityNotFound(_0xbd1f43,null))[_0xdf5c('0x1f')](saveUpdates(_0x41ad54[_0xdf5c('0x54')],null))[_0xdf5c('0x1f')](function(_0x96c4b3){if(_0x96c4b3){_0xedc47e[_0xdf5c('0x26')]=_0x96c4b3[_0xdf5c('0x60')]({'plain':!![]});return db[_0xdf5c('0x61')][_0xdf5c('0x53')]({'where':{'id':_0x96c4b3['ChatInteractionId']}});}return null;})[_0xdf5c('0x1f')](handleEntityNotFound(_0xbd1f43,null))['then'](function(_0x4a3c8d){if(_0x4a3c8d){return _0x4a3c8d[_0xdf5c('0x33')]({'UserId':_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5d')],'read1stAt':_[_0xdf5c('0x62')](_0x4a3c8d[_0xdf5c('0x63')])?moment()['format'](_0xdf5c('0x5c')):undefined});}return null;})[_0xdf5c('0x1f')](function(_0x265e8f){if(_0x265e8f){_0xedc47e['interaction']=_0x265e8f['get']({'plain':!![]});interaction_log[_0xdf5c('0x27')](_0xdf5c('0x64'),_0x41ad54['user']['id'],_0x41ad54[_0xdf5c('0x5e')]['name'],_0x41ad54[_0xdf5c('0x5e')][_0xdf5c('0x65')],_0xedc47e['interaction']['id'],_0x41ad54[_0xdf5c('0x54')]?JSON[_0xdf5c('0x24')](_0x41ad54['body']):'null');return respondWithRpcPromise(_0xdf5c('0x66'),'acceptMessage',_0xedc47e);}return null;})[_0xdf5c('0x1f')](function(_0x3f53a6){var _0x37dde2=_0xdf5c('0x67')+_0x3f53a6[_0xdf5c('0x26')][_0xdf5c('0x68')];return db['sequelize']['query'](_0x37dde2,{'type':db[_0xdf5c('0x69')][_0xdf5c('0x6a')]['SELECT'],'raw':!![]})[_0xdf5c('0x1f')](function(_0x149705){return _0x149705;});})['then'](function(_0x4b7bbd){if(_0x4b7bbd){_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x6b')]=_0x4b7bbd[0x0];if(!_0x41ad54[_0xdf5c('0x54')]['UserId'])return;return db[_0xdf5c('0x6c')]['find']({'where':{'id':_0x41ad54[_0xdf5c('0x54')][_0xdf5c('0x5d')],'role':_0xdf5c('0x5f')},'attributes':['id','name',_0xdf5c('0x6d'),_0xdf5c('0x6e'),_0xdf5c('0x6f')],'raw':!![]});}return null;})[_0xdf5c('0x1f')](function(_0x5b6bdf){if(!_0x5b6bdf)return null;_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x5f')]=_0x5b6bdf;return _0xedc47e;})[_0xdf5c('0x1f')](function(_0x3eb27a){if(_0x3eb27a){if(_0x41ad54[_0xdf5c('0x54')]['manual']){_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x70')]=util[_0xdf5c('0x5b')](_0xdf5c('0x71'),_0x41ad54[_0xdf5c('0x5e')][_0xdf5c('0x72')]);_0xedc47e[_0xdf5c('0x26')][_0xdf5c('0x73')]=_0xedc47e[_0xdf5c('0x73')];_0xedc47e['message']['motionChannel']=_0xedc47e[_0xdf5c('0x73')];_0xedc47e[_0xdf5c('0x26')]['event']=_0xdf5c('0x57');return respondWithRpcPromise(_0xdf5c('0x74'),_0xdf5c('0x74'),{'event':_0xdf5c('0x75'),'message':_['merge'](_0xedc47e[_0xdf5c('0x26')],JSON[_0xdf5c('0x76')](_0xedc47e['interaction'][_0xdf5c('0x77')]))},client9002)[_0xdf5c('0x1f')](function(){return _0xedc47e;});}return _0xedc47e;}return null;})['then'](respondWithResult(_0xbd1f43,null))[_0xdf5c('0x4e')](handleError(_0xbd1f43,null));};var interaction_log=require(_0xdf5c('0x15'))(_0xdf5c('0x78'));exports[_0xdf5c('0x32')]=function(_0x3bc0fb,_0x4c5f5e,_0x430631){var _0x5682d9={'agent':{},'channel':_0xdf5c('0x58')};if(_0x3bc0fb['body']['id']){delete _0x3bc0fb[_0xdf5c('0x54')]['id'];}_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')]=_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')]||_0x3bc0fb[_0xdf5c('0x5e')]['id'];_0x5682d9[_0xdf5c('0x5f')]['id']=_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')];return db[_0xdf5c('0x38')][_0xdf5c('0x53')]({'where':{'id':_0x3bc0fb[_0xdf5c('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4c5f5e,null))[_0xdf5c('0x1f')](function(_0x2fd0a9){if(_0x2fd0a9){_0x5682d9[_0xdf5c('0x26')]=_0x2fd0a9[_0xdf5c('0x60')]({'plain':!![]});return db[_0xdf5c('0x61')]['find']({'where':{'id':_0x2fd0a9[_0xdf5c('0x79')]}});}return null;})[_0xdf5c('0x1f')](handleEntityNotFound(_0x4c5f5e,null))[_0xdf5c('0x1f')](function(_0x251049){if(_0x251049){_0x5682d9[_0xdf5c('0x7a')]=_0x251049[_0xdf5c('0x60')]({'plain':!![]});interaction_log[_0xdf5c('0x27')](_0xdf5c('0x7b'),_0x3bc0fb[_0xdf5c('0x5e')]['id'],_0x3bc0fb['user'][_0xdf5c('0x72')],_0x3bc0fb[_0xdf5c('0x5e')]['role'],_0x5682d9[_0xdf5c('0x7a')]['id'],_0x3bc0fb['body']?JSON['stringify'](_0x3bc0fb[_0xdf5c('0x54')]):'null');return respondWithRpcPromise(_0xdf5c('0x7c'),_0xdf5c('0x7d'),_0x5682d9);}return null;})['then'](function(_0x2630b4){var _0x19da34=_0xdf5c('0x67')+_0x2630b4[_0xdf5c('0x26')][_0xdf5c('0x68')];return db[_0xdf5c('0x7e')]['query'](_0x19da34,{'type':db[_0xdf5c('0x69')]['QueryTypes']['SELECT'],'raw':!![]})[_0xdf5c('0x1f')](function(_0x535f9e){return _0x535f9e;});})['then'](function(_0x22441a){if(_0x22441a){_0x5682d9[_0xdf5c('0x26')]['contact']=_0x22441a[0x0];if(!_0x3bc0fb[_0xdf5c('0x54')][_0xdf5c('0x5d')])return;return db[_0xdf5c('0x6c')][_0xdf5c('0x53')]({'where':{'id':_0x3bc0fb[_0xdf5c('0x54')]['UserId'],'role':_0xdf5c('0x5f')},'attributes':['id','name',_0xdf5c('0x6d'),_0xdf5c('0x6e'),_0xdf5c('0x6f')],'raw':!![]});}return null;})[_0xdf5c('0x1f')](function(_0x35b2f5){if(!_0x35b2f5)return null;_0x5682d9[_0xdf5c('0x26')][_0xdf5c('0x5f')]=_0x35b2f5;return _0x5682d9;})[_0xdf5c('0x1f')](function(_0x41260c){if(_0x41260c){_0x41260c[_0xdf5c('0x26')][_0xdf5c('0x70')]=util[_0xdf5c('0x5b')]('SIP/%s',_0x3bc0fb[_0xdf5c('0x5e')][_0xdf5c('0x72')]);_0x41260c[_0xdf5c('0x26')][_0xdf5c('0x73')]=_0x5682d9[_0xdf5c('0x73')];_0x41260c['message'][_0xdf5c('0x7f')]=_0x5682d9['channel'];_0x41260c[_0xdf5c('0x26')]['event']=_0xdf5c('0x32');respondWithRpcPromise(_0xdf5c('0x74'),_0xdf5c('0x74'),{'event':_0xdf5c('0x80'),'message':_['merge'](_0x5682d9[_0xdf5c('0x26')],JSON['parse'](_0x5682d9[_0xdf5c('0x7a')]['formData']))},client9002);return _0x5682d9;}return null;})[_0xdf5c('0x1f')](respondWithResult(_0x4c5f5e,null))[_0xdf5c('0x4e')](handleError(_0x4c5f5e,null));}; \ No newline at end of file +var _0xdb4c=['describe','chat-interactions','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','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','sequelize','Sequelize','QueryTypes','SELECT','contact','User','internal','agent','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','acceptmessage','parse','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','fullname','rejectmessage','formData','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','name','send','index','map','ChatMessage','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','show','params','find','create','body'];(function(_0x10a12a,_0xee7529){var _0x1905af=function(_0x41c8b4){while(--_0x41c8b4){_0x10a12a['push'](_0x10a12a['shift']());}};_0x1905af(++_0xee7529);}(_0xdb4c,0xad));var _0xcdb4=function(_0x4c1195,_0x50429d){_0x4c1195=_0x4c1195-0x0;var _0x1bb47f=_0xdb4c[_0x4c1195];return _0x1bb47f;};'use strict';var emlformat=require(_0xcdb4('0x0'));var rimraf=require(_0xcdb4('0x1'));var zipdir=require(_0xcdb4('0x2'));var jsonpatch=require(_0xcdb4('0x3'));var rp=require(_0xcdb4('0x4'));var moment=require(_0xcdb4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcdb4('0x6'));var path=require(_0xcdb4('0x7'));var sox=require(_0xcdb4('0x8'));var csv=require(_0xcdb4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcdb4('0xa'));var squel=require('squel');var crypto=require(_0xcdb4('0xb'));var jsforce=require(_0xcdb4('0xc'));var deskjs=require(_0xcdb4('0xd'));var toCsv=require(_0xcdb4('0x9'));var querystring=require(_0xcdb4('0xe'));var Papa=require(_0xcdb4('0xf'));var Redis=require(_0xcdb4('0x10'));var authService=require(_0xcdb4('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdb4('0x12'));var logger=require(_0xcdb4('0x13'))(_0xcdb4('0x14'));var utils=require(_0xcdb4('0x15'));var config=require(_0xcdb4('0x16'));var licenseUtil=require(_0xcdb4('0x17'));var db=require(_0xcdb4('0x18'))['db'];config[_0xcdb4('0x19')]=_['defaults'](config['redis'],{'host':_0xcdb4('0x1a'),'port':0x18eb});var socket=require(_0xcdb4('0x1b'))(new Redis(config['redis']));require(_0xcdb4('0x1c'))[_0xcdb4('0x1d')](socket);var jayson=require(_0xcdb4('0x1e'));var client=jayson[_0xcdb4('0x1f')][_0xcdb4('0x20')]({'port':0x232c});var client9002=jayson[_0xcdb4('0x1f')][_0xcdb4('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x534c15,_0x7ed212,_0xb73a00,_0x1394f8){return new BPromise(function(_0x20237e,_0x44f582){var _0x3ebc90=_0x1394f8||client;return _0x3ebc90[_0xcdb4('0x21')](_0x534c15,_0xb73a00)[_0xcdb4('0x22')](function(_0x43c8ec){logger[_0xcdb4('0x23')](_0xcdb4('0x24'),_0x7ed212,_0xcdb4('0x25'));logger[_0xcdb4('0x26')](_0xcdb4('0x27'),_0x7ed212,_0xcdb4('0x25'),JSON[_0xcdb4('0x28')](_0x43c8ec));if(_0x43c8ec['error']){if(_0x43c8ec[_0xcdb4('0x29')]['code']===0x1f4){logger[_0xcdb4('0x29')](_0xcdb4('0x24'),_0x7ed212,_0x43c8ec[_0xcdb4('0x29')][_0xcdb4('0x2a')]);return _0x44f582(_0x43c8ec[_0xcdb4('0x29')][_0xcdb4('0x2a')]);}logger[_0xcdb4('0x29')](_0xcdb4('0x24'),_0x7ed212,_0x43c8ec['error'][_0xcdb4('0x2a')]);return _0x20237e(_0x43c8ec['error'][_0xcdb4('0x2a')]);}else{logger['info'](_0xcdb4('0x24'),_0x7ed212,_0xcdb4('0x25'));_0x20237e(_0x43c8ec[_0xcdb4('0x2b')][_0xcdb4('0x2a')]);}})[_0xcdb4('0x2c')](function(_0x2e33a2){logger[_0xcdb4('0x29')](_0xcdb4('0x24'),_0x7ed212,_0x2e33a2);_0x44f582(_0x2e33a2);});});}function respondWithStatusCode(_0x753f51,_0x2c6c99){_0x2c6c99=_0x2c6c99||0xcc;return function(_0xf60e5c){if(_0xf60e5c){return _0x753f51[_0xcdb4('0x2d')](_0x2c6c99);}return _0x753f51[_0xcdb4('0x2e')](_0x2c6c99)[_0xcdb4('0x2f')]();};}function respondWithResult(_0x23f769,_0x1bf9d5){_0x1bf9d5=_0x1bf9d5||0xc8;return function(_0xa63fb6){if(_0xa63fb6){return _0x23f769['status'](_0x1bf9d5)['json'](_0xa63fb6);}};}function respondWithFilteredResult(_0x648ad8,_0x27fc31){return function(_0x264c6b){if(_0x264c6b){var _0x217db5=typeof _0x27fc31['offset']===_0xcdb4('0x30')&&typeof _0x27fc31[_0xcdb4('0x31')]===_0xcdb4('0x30');var _0x251e90=_0x264c6b[_0xcdb4('0x32')];var _0x515269=_0x217db5?0x0:_0x27fc31[_0xcdb4('0x33')];var _0x4314e0=_0x217db5?_0x264c6b[_0xcdb4('0x32')]:_0x27fc31['offset']+_0x27fc31[_0xcdb4('0x31')];var _0x8cbe3c;if(_0x4314e0>=_0x251e90){_0x4314e0=_0x251e90;_0x8cbe3c=0xc8;}else{_0x8cbe3c=0xce;}_0x648ad8[_0xcdb4('0x2e')](_0x8cbe3c);return _0x648ad8['set'](_0xcdb4('0x34'),_0x515269+'-'+_0x4314e0+'/'+_0x251e90)[_0xcdb4('0x35')](_0x264c6b);}return null;};}function patchUpdates(_0x2554c9){return function(_0x2883c1){try{jsonpatch[_0xcdb4('0x36')](_0x2883c1,_0x2554c9,!![]);}catch(_0xbfba40){return BPromise[_0xcdb4('0x37')](_0xbfba40);}return _0x2883c1[_0xcdb4('0x38')]();};}function saveUpdates(_0x257612,_0xe7fdde){return function(_0x46fe52){if(_0x46fe52){return _0x46fe52[_0xcdb4('0x39')](_0x257612)[_0xcdb4('0x22')](function(_0x4e11f4){return _0x4e11f4;});}return null;};}function removeEntity(_0x37ea7e,_0x1192e9){return function(_0x1ff217){if(_0x1ff217){return _0x1ff217[_0xcdb4('0x3a')]()[_0xcdb4('0x22')](function(){_0x37ea7e[_0xcdb4('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb99861,_0x1d7e10){return function(_0x537d4d){if(!_0x537d4d){_0xb99861[_0xcdb4('0x2d')](0x194);}return _0x537d4d;};}function handleError(_0x53c72b,_0x51950e){_0x51950e=_0x51950e||0x1f4;return function(_0x1d548f){logger[_0xcdb4('0x29')](_0x1d548f['stack']);if(_0x1d548f[_0xcdb4('0x3b')]){delete _0x1d548f[_0xcdb4('0x3b')];}_0x53c72b[_0xcdb4('0x2e')](_0x51950e)[_0xcdb4('0x3c')](_0x1d548f);};}exports[_0xcdb4('0x3d')]=function(_0xdb1979,_0x5e390e){var _0x34ac30={},_0x497e7c={},_0x2ac2e1={'count':0x0,'rows':[]};var _0x1657a0=_[_0xcdb4('0x3e')](db[_0xcdb4('0x3f')]['rawAttributes'],function(_0x43d138){return{'name':_0x43d138[_0xcdb4('0x40')],'type':_0x43d138[_0xcdb4('0x41')]['key']};});_0x497e7c[_0xcdb4('0x42')]=_['map'](_0x1657a0,_0xcdb4('0x3b'));_0x497e7c[_0xcdb4('0x43')]=_[_0xcdb4('0x44')](_0xdb1979[_0xcdb4('0x43')]);_0x497e7c['filters']=_[_0xcdb4('0x45')](_0x497e7c[_0xcdb4('0x42')],_0x497e7c[_0xcdb4('0x43')]);_0x34ac30[_0xcdb4('0x46')]=_[_0xcdb4('0x45')](_0x497e7c[_0xcdb4('0x42')],qs['fields'](_0xdb1979[_0xcdb4('0x43')][_0xcdb4('0x47')]));_0x34ac30[_0xcdb4('0x46')]=_0x34ac30[_0xcdb4('0x46')][_0xcdb4('0x48')]?_0x34ac30['attributes']:_0x497e7c[_0xcdb4('0x42')];if(!_0xdb1979[_0xcdb4('0x43')][_0xcdb4('0x49')](_0xcdb4('0x4a'))){_0x34ac30['limit']=qs[_0xcdb4('0x31')](_0xdb1979[_0xcdb4('0x43')][_0xcdb4('0x31')]);_0x34ac30[_0xcdb4('0x33')]=qs[_0xcdb4('0x33')](_0xdb1979[_0xcdb4('0x43')][_0xcdb4('0x33')]);}_0x34ac30[_0xcdb4('0x4b')]=qs[_0xcdb4('0x4c')](_0xdb1979[_0xcdb4('0x43')][_0xcdb4('0x4c')]);_0x34ac30[_0xcdb4('0x4d')]=qs[_0xcdb4('0x4e')](_[_0xcdb4('0x4f')](_0xdb1979[_0xcdb4('0x43')],_0x497e7c[_0xcdb4('0x4e')]),_0x1657a0);if(_0xdb1979[_0xcdb4('0x43')][_0xcdb4('0x50')]){_0x34ac30[_0xcdb4('0x4d')]=_['merge'](_0x34ac30[_0xcdb4('0x4d')],{'$or':_[_0xcdb4('0x3e')](_0x1657a0,function(_0x3e0acb){if(_0x3e0acb[_0xcdb4('0x41')]!=='VIRTUAL'){var _0x4024ed={};_0x4024ed[_0x3e0acb['name']]={'$like':'%'+_0xdb1979[_0xcdb4('0x43')]['filter']+'%'};return _0x4024ed;}})});}_0x34ac30=_[_0xcdb4('0x51')]({},_0x34ac30,_0xdb1979[_0xcdb4('0x52')]);var _0x303031={'where':_0x34ac30[_0xcdb4('0x4d')]};return db[_0xcdb4('0x3f')][_0xcdb4('0x32')](_0x303031)[_0xcdb4('0x22')](function(_0x47e235){_0x2ac2e1[_0xcdb4('0x32')]=_0x47e235;if(_0xdb1979[_0xcdb4('0x43')]['includeAll']){_0x34ac30[_0xcdb4('0x53')]=[{'all':!![]}];}return db[_0xcdb4('0x3f')][_0xcdb4('0x54')](_0x34ac30);})[_0xcdb4('0x22')](function(_0x3a2027){_0x2ac2e1[_0xcdb4('0x55')]=_0x3a2027;return _0x2ac2e1;})[_0xcdb4('0x22')](respondWithFilteredResult(_0x5e390e,_0x34ac30))['catch'](handleError(_0x5e390e,null));};exports[_0xcdb4('0x56')]=function(_0x57b975,_0x1b348f){var _0x46c972={'raw':!![],'where':{'id':_0x57b975[_0xcdb4('0x57')]['id']}},_0x367b69={};_0x367b69[_0xcdb4('0x42')]=_[_0xcdb4('0x44')](db['ChatMessage']['rawAttributes']);_0x367b69[_0xcdb4('0x43')]=_[_0xcdb4('0x44')](_0x57b975[_0xcdb4('0x43')]);_0x367b69[_0xcdb4('0x4e')]=_[_0xcdb4('0x45')](_0x367b69['model'],_0x367b69[_0xcdb4('0x43')]);_0x46c972[_0xcdb4('0x46')]=_['intersection'](_0x367b69[_0xcdb4('0x42')],qs[_0xcdb4('0x47')](_0x57b975['query'][_0xcdb4('0x47')]));_0x46c972[_0xcdb4('0x46')]=_0x46c972['attributes'][_0xcdb4('0x48')]?_0x46c972['attributes']:_0x367b69['model'];if(_0x57b975['query']['includeAll']){_0x46c972[_0xcdb4('0x53')]=[{'all':!![]}];}_0x46c972=_[_0xcdb4('0x51')]({},_0x46c972,_0x57b975[_0xcdb4('0x52')]);return db[_0xcdb4('0x3f')][_0xcdb4('0x58')](_0x46c972)['then'](handleEntityNotFound(_0x1b348f,null))['then'](respondWithResult(_0x1b348f,null))['catch'](handleError(_0x1b348f,null));};exports[_0xcdb4('0x59')]=function(_0x380e46,_0xe00bf9){return db[_0xcdb4('0x3f')][_0xcdb4('0x59')](_0x380e46['body'],{})[_0xcdb4('0x22')](respondWithResult(_0xe00bf9,0xc9))['catch'](handleError(_0xe00bf9,null));};exports['update']=function(_0x57f7bc,_0x4e97fc){if(_0x57f7bc[_0xcdb4('0x5a')]['id']){delete _0x57f7bc[_0xcdb4('0x5a')]['id'];}return db['ChatMessage'][_0xcdb4('0x58')]({'where':{'id':_0x57f7bc['params']['id']}})[_0xcdb4('0x22')](handleEntityNotFound(_0x4e97fc,null))[_0xcdb4('0x22')](saveUpdates(_0x57f7bc['body'],null))[_0xcdb4('0x22')](respondWithResult(_0x4e97fc,null))[_0xcdb4('0x2c')](handleError(_0x4e97fc,null));};exports[_0xcdb4('0x3a')]=function(_0x5b5262,_0x431733){return db[_0xcdb4('0x3f')][_0xcdb4('0x58')]({'where':{'id':_0x5b5262[_0xcdb4('0x57')]['id']}})[_0xcdb4('0x22')](handleEntityNotFound(_0x431733,null))[_0xcdb4('0x22')](removeEntity(_0x431733,null))[_0xcdb4('0x2c')](handleError(_0x431733,null));};exports[_0xcdb4('0x5b')]=function(_0x31969d,_0x595331){return db[_0xcdb4('0x3f')][_0xcdb4('0x5b')]()[_0xcdb4('0x22')](respondWithResult(_0x595331,null))[_0xcdb4('0x2c')](handleError(_0x595331,null));};var interaction_log=require(_0xcdb4('0x13'))(_0xcdb4('0x5c'));exports['accept']=function(_0x619cb0,_0x2ec3ea,_0x5349fe){var _0x39f217={'agent':{},'channel':_0xcdb4('0x5d')};if(_0x619cb0['body']['id']){delete _0x619cb0['body']['id'];}_0x619cb0[_0xcdb4('0x5a')]['read']=!![];_0x619cb0[_0xcdb4('0x5a')][_0xcdb4('0x5e')]=moment()[_0xcdb4('0x5f')](_0xcdb4('0x60'));_0x619cb0[_0xcdb4('0x5a')][_0xcdb4('0x61')]=_0x619cb0['body'][_0xcdb4('0x61')]||_0x619cb0[_0xcdb4('0x62')]['id'];_0x39f217['agent']['id']=_0x619cb0[_0xcdb4('0x5a')][_0xcdb4('0x61')];return db['ChatMessage'][_0xcdb4('0x58')]({'where':{'id':_0x619cb0[_0xcdb4('0x57')]['id'],'UserId':null}})[_0xcdb4('0x22')](handleEntityNotFound(_0x2ec3ea,null))[_0xcdb4('0x22')](saveUpdates(_0x619cb0[_0xcdb4('0x5a')],null))[_0xcdb4('0x22')](function(_0xe3fd3){if(_0xe3fd3){_0x39f217[_0xcdb4('0x2a')]=_0xe3fd3[_0xcdb4('0x63')]({'plain':!![]});return db[_0xcdb4('0x64')][_0xcdb4('0x58')]({'where':{'id':_0xe3fd3[_0xcdb4('0x65')]}});}return null;})[_0xcdb4('0x22')](handleEntityNotFound(_0x2ec3ea,null))['then'](function(_0x4b4fb4){if(_0x4b4fb4){return _0x4b4fb4[_0xcdb4('0x39')]({'UserId':_0x619cb0[_0xcdb4('0x5a')][_0xcdb4('0x61')],'read1stAt':_[_0xcdb4('0x66')](_0x4b4fb4[_0xcdb4('0x67')])?moment()['format'](_0xcdb4('0x60')):undefined});}return null;})[_0xcdb4('0x22')](function(_0x4f8481){if(_0x4f8481){_0x39f217[_0xcdb4('0x68')]=_0x4f8481[_0xcdb4('0x63')]({'plain':!![]});interaction_log[_0xcdb4('0x23')](_0xcdb4('0x69'),_0x619cb0[_0xcdb4('0x62')]['id'],_0x619cb0['user'][_0xcdb4('0x3b')],_0x619cb0['user'][_0xcdb4('0x6a')],_0x39f217['interaction']['id'],_0x619cb0['body']?JSON[_0xcdb4('0x28')](_0x619cb0[_0xcdb4('0x5a')]):_0xcdb4('0x6b'));return respondWithRpcPromise(_0xcdb4('0x6c'),'acceptMessage',_0x39f217);}return null;})['then'](function(_0x5c0ebf){var _0x4d8bca=_0xcdb4('0x6d')+_0x5c0ebf[_0xcdb4('0x2a')]['ContactId'];return db[_0xcdb4('0x6e')]['query'](_0x4d8bca,{'type':db[_0xcdb4('0x6f')][_0xcdb4('0x70')][_0xcdb4('0x71')],'raw':!![]})[_0xcdb4('0x22')](function(_0x62d4b4){return _0x62d4b4;});})[_0xcdb4('0x22')](function(_0x1f16b9){if(_0x1f16b9){_0x39f217[_0xcdb4('0x2a')][_0xcdb4('0x72')]=_0x1f16b9[0x0];if(!_0x619cb0[_0xcdb4('0x5a')][_0xcdb4('0x61')])return;return db[_0xcdb4('0x73')][_0xcdb4('0x58')]({'where':{'id':_0x619cb0[_0xcdb4('0x5a')]['UserId'],'role':'agent'},'attributes':['id',_0xcdb4('0x3b'),'fullname','email',_0xcdb4('0x74')],'raw':!![]});}return null;})[_0xcdb4('0x22')](function(_0x527ae3){if(!_0x527ae3)return null;_0x39f217[_0xcdb4('0x2a')][_0xcdb4('0x75')]=_0x527ae3;return _0x39f217;})[_0xcdb4('0x22')](function(_0x23e49c){if(_0x23e49c){if(_0x619cb0[_0xcdb4('0x5a')]['manual']){_0x39f217['message'][_0xcdb4('0x76')]=util[_0xcdb4('0x5f')](_0xcdb4('0x77'),_0x619cb0[_0xcdb4('0x62')][_0xcdb4('0x3b')]);_0x39f217[_0xcdb4('0x2a')]['channel']=_0x39f217[_0xcdb4('0x78')];_0x39f217[_0xcdb4('0x2a')][_0xcdb4('0x79')]=_0x39f217['channel'];_0x39f217[_0xcdb4('0x2a')][_0xcdb4('0x7a')]=_0xcdb4('0x7b');return respondWithRpcPromise('EventManager',_0xcdb4('0x7c'),{'event':_0xcdb4('0x7d'),'message':_['merge'](_0x39f217['message'],JSON[_0xcdb4('0x7e')](_0x39f217[_0xcdb4('0x68')]['formData']))},client9002)[_0xcdb4('0x22')](function(){return _0x39f217;});}return _0x39f217;}return null;})['then'](respondWithResult(_0x2ec3ea,null))['catch'](handleError(_0x2ec3ea,null));};var interaction_log=require(_0xcdb4('0x13'))(_0xcdb4('0x5c'));exports[_0xcdb4('0x37')]=function(_0x21cd3c,_0x403fac,_0x21e407){var _0x57ca8a={'agent':{},'channel':'chat'};if(_0x21cd3c[_0xcdb4('0x5a')]['id']){delete _0x21cd3c[_0xcdb4('0x5a')]['id'];}_0x21cd3c[_0xcdb4('0x5a')][_0xcdb4('0x61')]=_0x21cd3c['body'][_0xcdb4('0x61')]||_0x21cd3c[_0xcdb4('0x62')]['id'];_0x57ca8a[_0xcdb4('0x75')]['id']=_0x21cd3c[_0xcdb4('0x5a')]['UserId'];return db[_0xcdb4('0x3f')][_0xcdb4('0x58')]({'where':{'id':_0x21cd3c['params']['id'],'UserId':null}})[_0xcdb4('0x22')](handleEntityNotFound(_0x403fac,null))[_0xcdb4('0x22')](function(_0x4d2123){if(_0x4d2123){_0x57ca8a[_0xcdb4('0x2a')]=_0x4d2123['get']({'plain':!![]});return db['ChatInteraction'][_0xcdb4('0x58')]({'where':{'id':_0x4d2123[_0xcdb4('0x65')]}});}return null;})[_0xcdb4('0x22')](handleEntityNotFound(_0x403fac,null))[_0xcdb4('0x22')](function(_0x2a447e){if(_0x2a447e){_0x57ca8a[_0xcdb4('0x68')]=_0x2a447e[_0xcdb4('0x63')]({'plain':!![]});interaction_log[_0xcdb4('0x23')](_0xcdb4('0x7f'),_0x21cd3c['user']['id'],_0x21cd3c[_0xcdb4('0x62')][_0xcdb4('0x3b')],_0x21cd3c[_0xcdb4('0x62')]['role'],_0x57ca8a[_0xcdb4('0x68')]['id'],_0x21cd3c['body']?JSON[_0xcdb4('0x28')](_0x21cd3c[_0xcdb4('0x5a')]):'null');return respondWithRpcPromise('RejectMessage',_0xcdb4('0x80'),_0x57ca8a);}return null;})['then'](function(_0x3a1b00){var _0xfa257=_0xcdb4('0x6d')+_0x3a1b00[_0xcdb4('0x2a')]['ContactId'];return db[_0xcdb4('0x6e')][_0xcdb4('0x43')](_0xfa257,{'type':db[_0xcdb4('0x6f')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x1f3cfc){return _0x1f3cfc;});})[_0xcdb4('0x22')](function(_0x4ae377){if(_0x4ae377){_0x57ca8a[_0xcdb4('0x2a')][_0xcdb4('0x72')]=_0x4ae377[0x0];if(!_0x21cd3c[_0xcdb4('0x5a')]['UserId'])return;return db[_0xcdb4('0x73')][_0xcdb4('0x58')]({'where':{'id':_0x21cd3c['body'][_0xcdb4('0x61')],'role':_0xcdb4('0x75')},'attributes':['id',_0xcdb4('0x3b'),_0xcdb4('0x81'),'email',_0xcdb4('0x74')],'raw':!![]});}return null;})['then'](function(_0x46928b){if(!_0x46928b)return null;_0x57ca8a[_0xcdb4('0x2a')][_0xcdb4('0x75')]=_0x46928b;return _0x57ca8a;})[_0xcdb4('0x22')](function(_0x48ae7e){if(_0x48ae7e){_0x48ae7e[_0xcdb4('0x2a')][_0xcdb4('0x76')]=util['format'](_0xcdb4('0x77'),_0x21cd3c[_0xcdb4('0x62')][_0xcdb4('0x3b')]);_0x48ae7e['message'][_0xcdb4('0x78')]=_0x57ca8a[_0xcdb4('0x78')];_0x48ae7e[_0xcdb4('0x2a')][_0xcdb4('0x79')]=_0x57ca8a[_0xcdb4('0x78')];_0x48ae7e[_0xcdb4('0x2a')][_0xcdb4('0x7a')]='reject';respondWithRpcPromise(_0xcdb4('0x7c'),_0xcdb4('0x7c'),{'event':_0xcdb4('0x82'),'message':_[_0xcdb4('0x51')](_0x57ca8a[_0xcdb4('0x2a')],JSON['parse'](_0x57ca8a['interaction'][_0xcdb4('0x83')]))},client9002);return _0x57ca8a;}return null;})[_0xcdb4('0x22')](respondWithResult(_0x403fac,null))[_0xcdb4('0x2c')](handleError(_0x403fac,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 7f055da..c4409b2 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 _0xcd23=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x1a3e23,_0xce45e){var _0x5ee0d8=function(_0x4b932f){while(--_0x4b932f){_0x1a3e23['push'](_0x1a3e23['shift']());}};_0x5ee0d8(++_0xce45e);}(_0xcd23,0xf4));var _0x3cd2=function(_0x545dd1,_0x5d6d32){_0x545dd1=_0x545dd1-0x0;var _0xb9692b=_0xcd23[_0x545dd1];return _0xb9692b;};'use strict';var EventEmitter=require(_0x3cd2('0x0'));var ChatMessage=require(_0x3cd2('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x3cd2('0x2')](0x0);var events={'afterCreate':_0x3cd2('0x3'),'afterUpdate':_0x3cd2('0x4'),'afterDestroy':_0x3cd2('0x5')};function emitEvent(_0x509114){return function(_0x363b40,_0x3a54a7,_0x4c6d2d){ChatMessageEvents[_0x3cd2('0x6')](_0x509114+':'+_0x363b40['id'],_0x363b40);ChatMessageEvents[_0x3cd2('0x6')](_0x509114,_0x363b40);_0x4c6d2d(null);};}for(var e in events){if(events[_0x3cd2('0x7')](e)){var event=events[e];ChatMessage[_0x3cd2('0x8')](e,emitEvent(event));}}module[_0x3cd2('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x31f8=['hook','exports','../../mysqldb','ChatMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x286726,_0x20a337){var _0xcd4fe9=function(_0x4d7da6){while(--_0x4d7da6){_0x286726['push'](_0x286726['shift']());}};_0xcd4fe9(++_0x20a337);}(_0x31f8,0x161));var _0x831f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x31f8[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0x831f('0x0'))['db'][_0x831f('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x831f('0x2')](0x0);var events={'afterCreate':_0x831f('0x3'),'afterUpdate':_0x831f('0x4'),'afterDestroy':'remove'};function emitEvent(_0x564744){return function(_0x273355,_0x21a21a,_0xa4fd60){ChatMessageEvents[_0x831f('0x5')](_0x564744+':'+_0x273355['id'],_0x273355);ChatMessageEvents[_0x831f('0x5')](_0x564744,_0x273355);_0xa4fd60(null);};}for(var e in events){if(events[_0x831f('0x6')](e)){var event=events[e];ChatMessage[_0x831f('0x7')](e,emitEvent(event));}}module[_0x831f('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 cff9f70..6acf056 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 _0x0dec=['update','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','ChatInteraction','findOne','ChatInteractionId','then'];(function(_0x6b488c,_0x1c8ff4){var _0x15b819=function(_0x4d876a){while(--_0x4d876a){_0x6b488c['push'](_0x6b488c['shift']());}};_0x15b819(++_0x1c8ff4);}(_0x0dec,0x11c));var _0xc0de=function(_0x44bbc8,_0x1d350f){_0x44bbc8=_0x44bbc8-0x0;var _0x3d814a=_0x0dec[_0x44bbc8];return _0x3d814a;};'use strict';var _=require(_0xc0de('0x0'));var util=require(_0xc0de('0x1'));var logger=require(_0xc0de('0x2'))(_0xc0de('0x3'));var moment=require('moment');var BPromise=require(_0xc0de('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc0de('0x5'));var config=require(_0xc0de('0x6'));var attributes=require(_0xc0de('0x7'));module[_0xc0de('0x8')]=function(_0xae49db,_0x194937){return _0xae49db[_0xc0de('0x9')](_0xc0de('0xa'),attributes,{'tableName':_0xc0de('0xb'),'paranoid':![],'indexes':[{'name':_0xc0de('0xc'),'fields':[_0xc0de('0xd')],'type':_0xc0de('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x7fb69a,_0x46ed3f,_0x3a169a){var _0xd27e9f=_0xae49db[_0xc0de('0xf')];var _0x285146=_0x7fb69a[_0xc0de('0x10')]({'plain':!![]});if(_0x285146[_0xc0de('0x11')][_0xc0de('0x12')]()==='in'||_0x285146[_0xc0de('0x11')][_0xc0de('0x12')]()===_0xc0de('0x13')&&!_0x285146[_0xc0de('0x14')]&&!_['isNil'](_0x285146[_0xc0de('0x15')])){_0xd27e9f[_0xc0de('0x16')][_0xc0de('0x17')]({'where':{'id':_0x285146[_0xc0de('0x18')]}})[_0xc0de('0x19')](function(_0x7fae0c){if(_0x7fae0c){_0x7fae0c[_0xc0de('0x1a')]({'lastMsgAt':_0x285146[_0xc0de('0x1b')],'lastMsgDirection':_0x285146[_0xc0de('0x11')][_0xc0de('0x12')]()});}})[_0xc0de('0x1c')](function(_0x7f1e4d){console['error'](_0x7f1e4d);});}_0x3a169a();}},'charset':_0xc0de('0x1d'),'collate':_0xc0de('0x1e')});}; \ No newline at end of file +var _0xdc91=['api','moment','request-promise','path','rimraf','./chatMessage.attributes','define','ChatMessage','chat_messages','body','models','direction','toLowerCase','out','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x339ded,_0xb38a57){var _0x37f8dc=function(_0x2ba951){while(--_0x2ba951){_0x339ded['push'](_0x339ded['shift']());}};_0x37f8dc(++_0xb38a57);}(_0xdc91,0x183));var _0x1dc9=function(_0x2b40e1,_0x495c47){_0x2b40e1=_0x2b40e1-0x0;var _0x30b65c=_0xdc91[_0x2b40e1];return _0x30b65c;};'use strict';var _=require(_0x1dc9('0x0'));var util=require(_0x1dc9('0x1'));var logger=require(_0x1dc9('0x2'))(_0x1dc9('0x3'));var moment=require(_0x1dc9('0x4'));var BPromise=require('bluebird');var rp=require(_0x1dc9('0x5'));var fs=require('fs');var path=require(_0x1dc9('0x6'));var rimraf=require(_0x1dc9('0x7'));var config=require('../../config/environment');var attributes=require(_0x1dc9('0x8'));module['exports']=function(_0x167133,_0x1a596b){return _0x167133[_0x1dc9('0x9')](_0x1dc9('0xa'),attributes,{'tableName':_0x1dc9('0xb'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x1dc9('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53e9f7,_0x5e0f40,_0x223d4e){var _0x49330e=_0x167133[_0x1dc9('0xd')];var _0x3231e9=_0x53e9f7['get']({'plain':!![]});if(_0x3231e9[_0x1dc9('0xe')][_0x1dc9('0xf')]()==='in'||_0x3231e9[_0x1dc9('0xe')][_0x1dc9('0xf')]()===_0x1dc9('0x10')&&!_0x3231e9['secret']&&!_[_0x1dc9('0x11')](_0x3231e9[_0x1dc9('0x12')])){_0x49330e[_0x1dc9('0x13')][_0x1dc9('0x14')]({'where':{'id':_0x3231e9[_0x1dc9('0x15')]}})['then'](function(_0x5852fe){if(_0x5852fe){_0x5852fe[_0x1dc9('0x16')]({'lastMsgAt':_0x3231e9['createdAt'],'lastMsgDirection':_0x3231e9[_0x1dc9('0xe')][_0x1dc9('0xf')]()});}})[_0x1dc9('0x17')](function(_0x1abf27){console['error'](_0x1abf27);});}_0x223d4e();}},'charset':_0x1dc9('0x18'),'collate':_0x1dc9('0x19')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 9eae1be..57e3e50 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 _0x4371=['ChatMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatMessage,\x20%s,\x20%s','message','result','CreateChatMessage'];(function(_0x2ef141,_0x3be740){var _0x47c2c0=function(_0x3f0a6a){while(--_0x3f0a6a){_0x2ef141['push'](_0x2ef141['shift']());}};_0x47c2c0(++_0x3be740);}(_0x4371,0x192));var _0x1437=function(_0x4dd4a1,_0x5ca922){_0x4dd4a1=_0x4dd4a1-0x0;var _0x168d0f=_0x4371[_0x4dd4a1];return _0x168d0f;};'use strict';var _=require(_0x1437('0x0'));var util=require(_0x1437('0x1'));var moment=require(_0x1437('0x2'));var BPromise=require(_0x1437('0x3'));var rs=require(_0x1437('0x4'));var fs=require('fs');var Redis=require(_0x1437('0x5'));var db=require(_0x1437('0x6'))['db'];var utils=require(_0x1437('0x7'));var logger=require(_0x1437('0x8'))(_0x1437('0x9'));var config=require('../../config/environment');var jayson=require(_0x1437('0xa'));var client=jayson['client'][_0x1437('0xb')]({'port':0x232a});config['redis']=_[_0x1437('0xc')](config[_0x1437('0xd')],{'host':_0x1437('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1437('0xd')]));require(_0x1437('0xf'))[_0x1437('0x10')](socket);function respondWithRpcPromise(_0x2d7aaf,_0x3d63a7,_0x112c80){return new BPromise(function(_0x1bf039,_0x500c90){return client[_0x1437('0x11')](_0x2d7aaf,_0x112c80)[_0x1437('0x12')](function(_0x144db4){logger[_0x1437('0x13')]('ChatMessage,\x20%s,\x20%s',_0x3d63a7,'request\x20sent');logger[_0x1437('0x14')](_0x1437('0x15'),_0x3d63a7,_0x1437('0x16'),JSON[_0x1437('0x17')](_0x144db4));if(_0x144db4[_0x1437('0x18')]){if(_0x144db4['error'][_0x1437('0x19')]===0x1f4){logger[_0x1437('0x18')](_0x1437('0x1a'),_0x3d63a7,_0x144db4[_0x1437('0x18')][_0x1437('0x1b')]);return _0x500c90(_0x144db4['error'][_0x1437('0x1b')]);}logger[_0x1437('0x18')](_0x1437('0x1a'),_0x3d63a7,_0x144db4['error'][_0x1437('0x1b')]);return _0x1bf039(_0x144db4[_0x1437('0x18')][_0x1437('0x1b')]);}else{logger['info'](_0x1437('0x1a'),_0x3d63a7,_0x1437('0x16'));_0x1bf039(_0x144db4[_0x1437('0x1c')][_0x1437('0x1b')]);}})['catch'](function(_0x1a1129){logger[_0x1437('0x18')]('ChatMessage,\x20%s,\x20%s',_0x3d63a7,_0x1a1129);_0x500c90(_0x1a1129);});});}exports[_0x1437('0x1d')]=function(_0x460681){var _0x629873=this;return new Promise(function(_0x3d0998,_0x31306c){return db[_0x1437('0x1e')][_0x1437('0x1f')](_0x460681[_0x1437('0x20')],{'raw':_0x460681[_0x1437('0x21')]?_0x460681[_0x1437('0x21')][_0x1437('0x22')]===undefined?!![]:![]:!![]})[_0x1437('0x12')](function(_0x18d14f){logger['info'](_0x1437('0x1d'),_0x460681);logger[_0x1437('0x14')](_0x1437('0x1d'),_0x460681,JSON[_0x1437('0x17')](_0x18d14f));_0x3d0998(_0x18d14f);})[_0x1437('0x23')](function(_0x940356){logger[_0x1437('0x18')](_0x1437('0x1d'),_0x940356['message'],_0x460681);_0x31306c(_0x629873['error'](0x1f4,_0x940356[_0x1437('0x1b')]));});});}; \ No newline at end of file +var _0xb044=['localhost','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ChatMessage','create','options','raw','CreateChatMessage','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1ca29f,_0x318ac5){var _0x576c3b=function(_0x40caab){while(--_0x40caab){_0x1ca29f['push'](_0x1ca29f['shift']());}};_0x576c3b(++_0x318ac5);}(_0xb044,0x74));var _0x4b04=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xb044[_0x19950b];return _0x3c6b41;};'use strict';var _=require('lodash');var util=require(_0x4b04('0x0'));var moment=require('moment');var BPromise=require(_0x4b04('0x1'));var rs=require(_0x4b04('0x2'));var fs=require('fs');var Redis=require(_0x4b04('0x3'));var db=require(_0x4b04('0x4'))['db'];var utils=require(_0x4b04('0x5'));var logger=require(_0x4b04('0x6'))(_0x4b04('0x7'));var config=require('../../config/environment');var jayson=require(_0x4b04('0x8'));var client=jayson[_0x4b04('0x9')][_0x4b04('0xa')]({'port':0x232a});config[_0x4b04('0xb')]=_['defaults'](config[_0x4b04('0xb')],{'host':_0x4b04('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4b04('0xb')]));require(_0x4b04('0xd'))[_0x4b04('0xe')](socket);function respondWithRpcPromise(_0x37063c,_0x24951c,_0x8df528){return new BPromise(function(_0x74d1e3,_0x3f288e){return client[_0x4b04('0xf')](_0x37063c,_0x8df528)[_0x4b04('0x10')](function(_0x3033fd){logger[_0x4b04('0x11')](_0x4b04('0x12'),_0x24951c,'request\x20sent');logger[_0x4b04('0x13')](_0x4b04('0x14'),_0x24951c,_0x4b04('0x15'),JSON['stringify'](_0x3033fd));if(_0x3033fd[_0x4b04('0x16')]){if(_0x3033fd[_0x4b04('0x16')]['code']===0x1f4){logger['error'](_0x4b04('0x12'),_0x24951c,_0x3033fd[_0x4b04('0x16')]['message']);return _0x3f288e(_0x3033fd['error'][_0x4b04('0x17')]);}logger['error'](_0x4b04('0x12'),_0x24951c,_0x3033fd[_0x4b04('0x16')][_0x4b04('0x17')]);return _0x74d1e3(_0x3033fd['error'][_0x4b04('0x17')]);}else{logger[_0x4b04('0x11')](_0x4b04('0x12'),_0x24951c,_0x4b04('0x15'));_0x74d1e3(_0x3033fd[_0x4b04('0x18')][_0x4b04('0x17')]);}})[_0x4b04('0x19')](function(_0x7b056a){logger[_0x4b04('0x16')](_0x4b04('0x12'),_0x24951c,_0x7b056a);_0x3f288e(_0x7b056a);});});}exports['CreateChatMessage']=function(_0x36cf00){var _0x469ce7=this;return new Promise(function(_0x54c3e9,_0x238b1a){return db[_0x4b04('0x1a')][_0x4b04('0x1b')](_0x36cf00['body'],{'raw':_0x36cf00[_0x4b04('0x1c')]?_0x36cf00['options'][_0x4b04('0x1d')]===undefined?!![]:![]:!![]})[_0x4b04('0x10')](function(_0x5d121f){logger[_0x4b04('0x11')](_0x4b04('0x1e'),_0x36cf00);logger[_0x4b04('0x13')](_0x4b04('0x1e'),_0x36cf00,JSON[_0x4b04('0x1f')](_0x5d121f));_0x54c3e9(_0x5d121f);})[_0x4b04('0x19')](function(_0x14f697){logger['error'](_0x4b04('0x1e'),_0x14f697[_0x4b04('0x17')],_0x36cf00);_0x238b1a(_0x469ce7[_0x4b04('0x16')](0x1f4,_0x14f697['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 7fede85..8e9542b 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 _0x3baf=['save','remove','update','emit','removeListener','register','chatMessage:','./chatMessage.events'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x3baf,0xf7));var _0xf3ba=function(_0x5193cd,_0xcd459f){_0x5193cd=_0x5193cd-0x0;var _0x264954=_0x3baf[_0x5193cd];return _0x264954;};'use strict';var ChatMessageEvents=require(_0xf3ba('0x0'));var events=[_0xf3ba('0x1'),_0xf3ba('0x2'),_0xf3ba('0x3')];function createListener(_0x29bbc2,_0x22f9c0){return function(_0xfce22){_0x22f9c0[_0xf3ba('0x4')](_0x29bbc2,_0xfce22);};}function removeListener(_0x3e6058,_0x1ae6e6){return function(){ChatMessageEvents[_0xf3ba('0x5')](_0x3e6058,_0x1ae6e6);};}exports[_0xf3ba('0x6')]=function(_0x475268){for(var _0x2e6df2=0x0,_0x1284b7=events['length'];_0x2e6df2<_0x1284b7;_0x2e6df2++){var _0x579135=events[_0x2e6df2];var _0x5ab058=createListener(_0xf3ba('0x7')+_0x579135,_0x475268);ChatMessageEvents['on'](_0x579135,_0x5ab058);}}; \ No newline at end of file +var _0x6f47=['chatMessage:','save','remove','removeListener','register','length'];(function(_0x44f56d,_0x343df3){var _0x2a37da=function(_0x3f7b79){while(--_0x3f7b79){_0x44f56d['push'](_0x44f56d['shift']());}};_0x2a37da(++_0x343df3);}(_0x6f47,0xc7));var _0x76f4=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6f47[_0x21a9d9];return _0x46adce;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x76f4('0x0'),_0x76f4('0x1'),'update'];function createListener(_0x2092f3,_0x5765c1){return function(_0x698b39){_0x5765c1['emit'](_0x2092f3,_0x698b39);};}function removeListener(_0xe214ad,_0xc5dddc){return function(){ChatMessageEvents[_0x76f4('0x2')](_0xe214ad,_0xc5dddc);};}exports[_0x76f4('0x3')]=function(_0x5754ca){for(var _0x35602f=0x0,_0xfc2405=events[_0x76f4('0x4')];_0x35602f<_0xfc2405;_0x35602f++){var _0x497f99=events[_0x35602f];var _0x1a3172=createListener(_0x76f4('0x5')+_0x497f99,_0x5754ca);ChatMessageEvents['on'](_0x497f99,_0x1a3172);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 1e9658d..f6b2e85 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 _0x078f=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','tracked','chatmessage:create','create','put','accept','/:id/reject','reject','delete','destroy','exports','util'];(function(_0x23d47a,_0x5550e8){var _0x22d3c0=function(_0x4a550f){while(--_0x4a550f){_0x23d47a['push'](_0x23d47a['shift']());}};_0x22d3c0(++_0x5550e8);}(_0x078f,0xb5));var _0xf078=function(_0x522ae8,_0x3b637e){_0x522ae8=_0x522ae8-0x0;var _0x3189b9=_0x078f[_0x522ae8];return _0x3189b9;};'use strict';var multer=require('multer');var util=require(_0xf078('0x0'));var path=require(_0xf078('0x1'));var timeout=require(_0xf078('0x2'));var express=require('express');var router=express[_0xf078('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf078('0x4'));var interaction=require(_0xf078('0x5'));var config=require(_0xf078('0x6'));var controller=require(_0xf078('0x7'));router[_0xf078('0x8')]('/',auth['isAuthenticated'](),controller[_0xf078('0x9')]);router['get'](_0xf078('0xa'),auth['isAuthenticated'](),controller[_0xf078('0xb')]);router[_0xf078('0x8')](_0xf078('0xc'),auth[_0xf078('0xd')](),controller[_0xf078('0xe')]);router[_0xf078('0xf')]('/',auth['isAuthenticated'](),interaction[_0xf078('0x10')]('chat',_0xf078('0x11')),controller[_0xf078('0x12')]);router[_0xf078('0x13')](_0xf078('0xc'),controller['update']);router['put']('/:id/accept',auth['isAuthenticated'](),controller[_0xf078('0x14')]);router[_0xf078('0x13')](_0xf078('0x15'),auth['isAuthenticated'](),controller[_0xf078('0x16')]);router[_0xf078('0x17')]('/:id',auth[_0xf078('0xd')](),controller[_0xf078('0x18')]);module[_0xf078('0x19')]=router; \ No newline at end of file +var _0xfa13=['put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','chat','chatmessage:create','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa13,0x99));var _0x3fa1=function(_0x4d69b5,_0x1a58d6){_0x4d69b5=_0x4d69b5-0x0;var _0x2838c6=_0xfa13[_0x4d69b5];return _0x2838c6;};'use strict';var multer=require(_0x3fa1('0x0'));var util=require('util');var path=require(_0x3fa1('0x1'));var timeout=require(_0x3fa1('0x2'));var express=require(_0x3fa1('0x3'));var router=express[_0x3fa1('0x4')]();var fs_extra=require(_0x3fa1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x3fa1('0x6'));var config=require(_0x3fa1('0x7'));var controller=require(_0x3fa1('0x8'));router[_0x3fa1('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fa1('0xa')]);router['get'](_0x3fa1('0xb'),auth[_0x3fa1('0xc')](),controller[_0x3fa1('0xd')]);router['get'](_0x3fa1('0xe'),auth[_0x3fa1('0xc')](),controller[_0x3fa1('0xf')]);router[_0x3fa1('0x10')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x3fa1('0x11'),_0x3fa1('0x12')),controller[_0x3fa1('0x13')]);router['put'](_0x3fa1('0xe'),controller[_0x3fa1('0x14')]);router[_0x3fa1('0x15')](_0x3fa1('0x16'),auth['isAuthenticated'](),controller[_0x3fa1('0x17')]);router[_0x3fa1('0x15')](_0x3fa1('0x18'),auth[_0x3fa1('0xc')](),controller[_0x3fa1('0x19')]);router[_0x3fa1('0x1a')](_0x3fa1('0xe'),auth[_0x3fa1('0xc')](),controller[_0x3fa1('0x1b')]);module[_0x3fa1('0x1c')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 6f0ff8d..4cdb46e 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 _0x5f66=['medium','TEXT','exports'];(function(_0x1db288,_0x52f105){var _0x336800=function(_0x1cd1c2){while(--_0x1cd1c2){_0x1db288['push'](_0x1db288['shift']());}};_0x336800(++_0x52f105);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('0x1')),'allowNull':![]}}; \ No newline at end of file +var _0x2032=['medium','exports','TEXT'];(function(_0x2eef32,_0x29f149){var _0x279e3f=function(_0x25acd1){while(--_0x25acd1){_0x2eef32['push'](_0x2eef32['shift']());}};_0x279e3f(++_0x29f149);}(_0x2032,0xd9));var _0x2203=function(_0x5c9c35,_0x2820de){_0x5c9c35=_0x5c9c35-0x0;var _0x43378b=_0x2032[_0x5c9c35];return _0x43378b;};'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 656de18..9504dc1 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(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x7a54,0x106));var _0x47a5=function(_0x5eae06,_0x227bf2){_0x5eae06=_0x5eae06-0x0;var _0x34a70f=_0x7a54[_0x5eae06];return _0x34a70f;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0x7a54,0x106));var _0x47a5=function(_0x5e4068,_0x1345a5){_0x5e4068=_0x5e4068-0x0;var _0x22a540=_0x7a54[_0x5e4068];return _0x22a540;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 268d15d..feaa35f 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 _0x2ad6=['exports','events','ChatOfflineMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x2b8286,_0xe3d644){var _0x14af6c=function(_0x51a015){while(--_0x51a015){_0x2b8286['push'](_0x2b8286['shift']());}};_0x14af6c(++_0xe3d644);}(_0x2ad6,0x1a1));var _0x62ad=function(_0xdeb232,_0x18eb34){_0xdeb232=_0xdeb232-0x0;var _0x2191b0=_0x2ad6[_0xdeb232];return _0x2191b0;};'use strict';var EventEmitter=require(_0x62ad('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x62ad('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x62ad('0x2')](0x0);var events={'afterCreate':_0x62ad('0x3'),'afterUpdate':_0x62ad('0x4'),'afterDestroy':'remove'};function emitEvent(_0x989270){return function(_0x750cc9,_0xd24c4c,_0x1142ee){ChatOfflineMessageEvents[_0x62ad('0x5')](_0x989270+':'+_0x750cc9['id'],_0x750cc9);ChatOfflineMessageEvents['emit'](_0x989270,_0x750cc9);_0x1142ee(null);};}for(var e in events){if(events[_0x62ad('0x6')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module[_0x62ad('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xe60e=['save','update','emit','hasOwnProperty','hook','exports','events','ChatOfflineMessage','setMaxListeners'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0xe60e,0x8d));var _0xee60=function(_0x4e7261,_0x5d624d){_0x4e7261=_0x4e7261-0x0;var _0x37d87b=_0xe60e[_0x4e7261];return _0x37d87b;};'use strict';var EventEmitter=require(_0xee60('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0xee60('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xee60('0x2')](0x0);var events={'afterCreate':_0xee60('0x3'),'afterUpdate':_0xee60('0x4'),'afterDestroy':'remove'};function emitEvent(_0xa15205){return function(_0x4e6fa1,_0x3e2308,_0x2f2794){ChatOfflineMessageEvents[_0xee60('0x5')](_0xa15205+':'+_0x4e6fa1['id'],_0x4e6fa1);ChatOfflineMessageEvents[_0xee60('0x5')](_0xa15205,_0x4e6fa1);_0x2f2794(null);};}for(var e in events){if(events[_0xee60('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xee60('0x7')](e,emitEvent(event));}}module[_0xee60('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 9abad0d..ba5a113 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 _0x6b7a=['exports','define','ChatOfflineMessage','chat_offline_messages'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0x6b7a,0x108));var _0xa6b7=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x6b7a[_0x1ab0e6];return _0x248815;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0xa6b7('0x0')]=function(_0x34d09c){return _0x34d09c[_0xa6b7('0x1')](_0xa6b7('0x2'),attributes,{'tableName':_0xa6b7('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x74a0=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages'];(function(_0x33403b,_0x5cca9c){var _0x2d8657=function(_0x171e25){while(--_0x171e25){_0x33403b['push'](_0x33403b['shift']());}};_0x2d8657(++_0x5cca9c);}(_0x74a0,0x92));var _0x074a=function(_0x5ed085,_0x3f03e3){_0x5ed085=_0x5ed085-0x0;var _0x36da7b=_0x74a0[_0x5ed085];return _0x36da7b;};'use strict';var attributes=require(_0x074a('0x0'));module[_0x074a('0x1')]=function(_0x49a680){return _0x49a680['define'](_0x074a('0x2'),attributes,{'tableName':_0x074a('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x074a('0x4'),'collate':_0x074a('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 51f1e9e..ea4755a 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 _0xa2f5=['http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x32e90a,_0x317d6f){var _0x3ad167=function(_0x5ece84){while(--_0x5ece84){_0x32e90a['push'](_0x32e90a['shift']());}};_0x3ad167(++_0x317d6f);}(_0xa2f5,0xf2));var _0x5a2f=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa2f5[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x5a2f('0x0'));var util=require(_0x5a2f('0x1'));var moment=require(_0x5a2f('0x2'));var BPromise=require(_0x5a2f('0x3'));var rs=require(_0x5a2f('0x4'));var fs=require('fs');var Redis=require(_0x5a2f('0x5'));var db=require(_0x5a2f('0x6'))['db'];var utils=require(_0x5a2f('0x7'));var logger=require(_0x5a2f('0x8'))(_0x5a2f('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x5a2f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x417d87,_0x5da183,_0x2d6392){return new BPromise(function(_0x1033db,_0x214637){return client[_0x5a2f('0xb')](_0x417d87,_0x2d6392)['then'](function(_0x58e639){logger['info'](_0x5a2f('0xc'),_0x5da183,_0x5a2f('0xd'));logger[_0x5a2f('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x5da183,_0x5a2f('0xd'),JSON[_0x5a2f('0xf')](_0x58e639));if(_0x58e639['error']){if(_0x58e639[_0x5a2f('0x10')]['code']===0x1f4){logger['error'](_0x5a2f('0xc'),_0x5da183,_0x58e639[_0x5a2f('0x10')][_0x5a2f('0x11')]);return _0x214637(_0x58e639['error'][_0x5a2f('0x11')]);}logger[_0x5a2f('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da183,_0x58e639['error'][_0x5a2f('0x11')]);return _0x1033db(_0x58e639[_0x5a2f('0x10')]['message']);}else{logger[_0x5a2f('0x12')](_0x5a2f('0xc'),_0x5da183,_0x5a2f('0xd'));_0x1033db(_0x58e639[_0x5a2f('0x13')][_0x5a2f('0x11')]);}})[_0x5a2f('0x14')](function(_0x566cd0){logger[_0x5a2f('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5da183,_0x566cd0);_0x214637(_0x566cd0);});});} \ No newline at end of file +var _0x9c5b=['ChatOfflineMessage,\x20%s,\x20%s','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x4b7976,_0x55e10b){var _0x422298=function(_0x531d4b){while(--_0x531d4b){_0x4b7976['push'](_0x4b7976['shift']());}};_0x422298(++_0x55e10b);}(_0x9c5b,0x127));var _0xb9c5=function(_0x2f3370,_0x28e72a){_0x2f3370=_0x2f3370-0x0;var _0xf8db52=_0x9c5b[_0x2f3370];return _0xf8db52;};'use strict';var _=require(_0xb9c5('0x0'));var util=require(_0xb9c5('0x1'));var moment=require(_0xb9c5('0x2'));var BPromise=require(_0xb9c5('0x3'));var rs=require(_0xb9c5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb9c5('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb9c5('0x6'));var config=require(_0xb9c5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9c5('0x8')][_0xb9c5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x237363,_0x4750a5,_0x24dc7c){return new BPromise(function(_0x18d941,_0x216ba8){return client[_0xb9c5('0xa')](_0x237363,_0x24dc7c)[_0xb9c5('0xb')](function(_0x5f04bc){logger[_0xb9c5('0xc')](_0xb9c5('0xd'),_0x4750a5,'request\x20sent');logger[_0xb9c5('0xe')](_0xb9c5('0xf'),_0x4750a5,_0xb9c5('0x10'),JSON['stringify'](_0x5f04bc));if(_0x5f04bc[_0xb9c5('0x11')]){if(_0x5f04bc[_0xb9c5('0x11')][_0xb9c5('0x12')]===0x1f4){logger[_0xb9c5('0x11')](_0xb9c5('0xd'),_0x4750a5,_0x5f04bc[_0xb9c5('0x11')]['message']);return _0x216ba8(_0x5f04bc['error'][_0xb9c5('0x13')]);}logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x4750a5,_0x5f04bc[_0xb9c5('0x11')][_0xb9c5('0x13')]);return _0x18d941(_0x5f04bc['error'][_0xb9c5('0x13')]);}else{logger[_0xb9c5('0xc')](_0xb9c5('0xd'),_0x4750a5,_0xb9c5('0x10'));_0x18d941(_0x5f04bc[_0xb9c5('0x14')]['message']);}})[_0xb9c5('0x15')](function(_0x1a219f){logger[_0xb9c5('0x11')](_0xb9c5('0xd'),_0x4750a5,_0x1a219f);_0x216ba8(_0x1a219f);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index d6d3c04..e814b5f 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 _0xb9d6=['/describe','/:id','show','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index'];(function(_0x43026b,_0x928d8c){var _0x4a96cd=function(_0x362cbd){while(--_0x362cbd){_0x43026b['push'](_0x43026b['shift']());}};_0x4a96cd(++_0x928d8c);}(_0xb9d6,0x13d));var _0x6b9d=function(_0x1eebe4,_0x27f7b4){_0x1eebe4=_0x1eebe4-0x0;var _0x46f639=_0xb9d6[_0x1eebe4];return _0x46f639;};'use strict';var multer=require(_0x6b9d('0x0'));var util=require(_0x6b9d('0x1'));var path=require(_0x6b9d('0x2'));var timeout=require(_0x6b9d('0x3'));var express=require('express');var router=express[_0x6b9d('0x4')]();var fs_extra=require(_0x6b9d('0x5'));var auth=require(_0x6b9d('0x6'));var interaction=require(_0x6b9d('0x7'));var config=require(_0x6b9d('0x8'));var controller=require(_0x6b9d('0x9'));router[_0x6b9d('0xa')]('/',auth[_0x6b9d('0xb')](),controller[_0x6b9d('0xc')]);router[_0x6b9d('0xa')](_0x6b9d('0xd'),auth[_0x6b9d('0xb')](),controller['describe']);router[_0x6b9d('0xa')](_0x6b9d('0xe'),auth['isAuthenticated'](),controller[_0x6b9d('0xf')]);router[_0x6b9d('0x10')]('/',auth[_0x6b9d('0xb')](),controller['create']);router[_0x6b9d('0x11')](_0x6b9d('0xe'),auth[_0x6b9d('0xb')](),controller[_0x6b9d('0x12')]);router[_0x6b9d('0x13')](_0x6b9d('0xe'),auth[_0x6b9d('0xb')](),controller[_0x6b9d('0x14')]);module[_0x6b9d('0x15')]=router; \ No newline at end of file +var _0x84fa=['delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','isAuthenticated','index','get','/describe','describe','show','post','create','/:id','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x84fa,0x9d));var _0xa84f=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x84fa[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0xa84f('0x0'));var util=require(_0xa84f('0x1'));var path=require('path');var timeout=require(_0xa84f('0x2'));var express=require(_0xa84f('0x3'));var router=express[_0xa84f('0x4')]();var fs_extra=require(_0xa84f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa84f('0x6'));var config=require(_0xa84f('0x7'));var controller=require(_0xa84f('0x8'));router['get']('/',auth[_0xa84f('0x9')](),controller[_0xa84f('0xa')]);router[_0xa84f('0xb')](_0xa84f('0xc'),auth[_0xa84f('0x9')](),controller[_0xa84f('0xd')]);router[_0xa84f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xa84f('0xe')]);router[_0xa84f('0xf')]('/',auth[_0xa84f('0x9')](),controller[_0xa84f('0x10')]);router['put'](_0xa84f('0x11'),auth[_0xa84f('0x9')](),controller[_0xa84f('0x12')]);router[_0xa84f('0x13')]('/:id',auth[_0xa84f('0x9')](),controller[_0xa84f('0x14')]);module[_0xa84f('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 9552440..e7ab503 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 _0xca8a=['timeout','INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0xca8a,0xc6));var _0xaca8=function(_0x5bd922,_0x2a6c2b){_0x5bd922=_0x5bd922-0x0;var _0x90ef93=_0xca8a[_0x5bd922];return _0x90ef93;};'use strict';var Sequelize=require(_0xaca8('0x0'));module[_0xaca8('0x1')]={'name':{'type':Sequelize[_0xaca8('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xaca8('0x3')](_0xaca8('0x4'),_0xaca8('0x5')),'defaultValue':_0xaca8('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xaca8('0x6')]}}; \ No newline at end of file +var _0xd4be=['mouseOver','STRING','INTEGER','exports'];(function(_0x478f5a,_0x272c62){var _0x4e15d7=function(_0x157556){while(--_0x157556){_0x478f5a['push'](_0x478f5a['shift']());}};_0x4e15d7(++_0x272c62);}(_0xd4be,0x16f));var _0xed4b=function(_0x591d02,_0x513f71){_0x591d02=_0x591d02-0x0;var _0x39b52b=_0xd4be[_0x591d02];return _0x39b52b;};'use strict';var Sequelize=require('sequelize');module[_0xed4b('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xed4b('0x1'),'timeout'),'defaultValue':_0xed4b('0x1')},'selector':{'type':Sequelize[_0xed4b('0x2')]},'timeout':{'type':Sequelize[_0xed4b('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index f107bb9..645e030 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 _0xfdb3=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','save','then','destroy','stack','name','send','show','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','model','fields','length','merge','options','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x1f0077,_0x328f99){var _0x353a1d=function(_0x5927fb){while(--_0x5927fb){_0x1f0077['push'](_0x1f0077['shift']());}};_0x353a1d(++_0x328f99);}(_0xfdb3,0x10c));var _0x3fdb=function(_0x5e185b,_0x853f33){_0x5e185b=_0x5e185b-0x0;var _0x19044d=_0xfdb3[_0x5e185b];return _0x19044d;};'use strict';var emlformat=require(_0x3fdb('0x0'));var rimraf=require(_0x3fdb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3fdb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x3fdb('0x3'));var Mustache=require('mustache');var util=require(_0x3fdb('0x4'));var path=require(_0x3fdb('0x5'));var sox=require(_0x3fdb('0x6'));var csv=require(_0x3fdb('0x7'));var ejs=require(_0x3fdb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fdb('0x9'));var squel=require(_0x3fdb('0xa'));var crypto=require(_0x3fdb('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3fdb('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3fdb('0xd'));var Papa=require(_0x3fdb('0xe'));var Redis=require(_0x3fdb('0xf'));var authService=require(_0x3fdb('0x10'));var qs=require(_0x3fdb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3fdb('0x12'));var config=require(_0x3fdb('0x13'));var licenseUtil=require(_0x3fdb('0x14'));var db=require(_0x3fdb('0x15'))['db'];function respondWithStatusCode(_0x3cc79c,_0x41f371){_0x41f371=_0x41f371||0xcc;return function(_0x416962){if(_0x416962){return _0x3cc79c[_0x3fdb('0x16')](_0x41f371);}return _0x3cc79c[_0x3fdb('0x17')](_0x41f371)[_0x3fdb('0x18')]();};}function respondWithResult(_0x4eab69,_0x35a660){_0x35a660=_0x35a660||0xc8;return function(_0x1a5dd8){if(_0x1a5dd8){return _0x4eab69['status'](_0x35a660)[_0x3fdb('0x19')](_0x1a5dd8);}};}function respondWithFilteredResult(_0x31cd0e,_0x182635){return function(_0x39c573){if(_0x39c573){var _0x5a9b95=typeof _0x182635['offset']==='undefined'&&typeof _0x182635[_0x3fdb('0x1a')]===_0x3fdb('0x1b');var _0x11d57d=_0x39c573[_0x3fdb('0x1c')];var _0x212ab6=_0x5a9b95?0x0:_0x182635['offset'];var _0x224035=_0x5a9b95?_0x39c573[_0x3fdb('0x1c')]:_0x182635[_0x3fdb('0x1d')]+_0x182635[_0x3fdb('0x1a')];var _0x370f84;if(_0x224035>=_0x11d57d){_0x224035=_0x11d57d;_0x370f84=0xc8;}else{_0x370f84=0xce;}_0x31cd0e['status'](_0x370f84);return _0x31cd0e[_0x3fdb('0x1e')](_0x3fdb('0x1f'),_0x212ab6+'-'+_0x224035+'/'+_0x11d57d)[_0x3fdb('0x19')](_0x39c573);}return null;};}function patchUpdates(_0x1bbad7){return function(_0x403f48){try{jsonpatch['apply'](_0x403f48,_0x1bbad7,!![]);}catch(_0x76431d){return BPromise['reject'](_0x76431d);}return _0x403f48[_0x3fdb('0x20')]();};}function saveUpdates(_0x490744,_0x516440){return function(_0x48b674){if(_0x48b674){return _0x48b674['update'](_0x490744)[_0x3fdb('0x21')](function(_0x264913){return _0x264913;});}return null;};}function removeEntity(_0xaf7c32,_0xac9aac){return function(_0x111cb8){if(_0x111cb8){return _0x111cb8[_0x3fdb('0x22')]()['then'](function(){_0xaf7c32['status'](0xcc)[_0x3fdb('0x18')]();});}};}function handleEntityNotFound(_0xc0410d,_0x5c30b5){return function(_0xaf7f8f){if(!_0xaf7f8f){_0xc0410d['sendStatus'](0x194);}return _0xaf7f8f;};}function handleError(_0x47d667,_0x1b9c4b){_0x1b9c4b=_0x1b9c4b||0x1f4;return function(_0x24278c){logger['error'](_0x24278c[_0x3fdb('0x23')]);if(_0x24278c['name']){delete _0x24278c[_0x3fdb('0x24')];}_0x47d667[_0x3fdb('0x17')](_0x1b9c4b)[_0x3fdb('0x25')](_0x24278c);};}exports[_0x3fdb('0x26')]=function(_0x3d6fbe,_0x37f3d7){var _0x442dbc={'raw':!![],'where':{'id':_0x3d6fbe['params']['id']}},_0x29be8e={};_0x29be8e['model']=_[_0x3fdb('0x27')](db[_0x3fdb('0x28')][_0x3fdb('0x29')]);_0x29be8e[_0x3fdb('0x2a')]=_[_0x3fdb('0x27')](_0x3d6fbe[_0x3fdb('0x2a')]);_0x29be8e[_0x3fdb('0x2b')]=_[_0x3fdb('0x2c')](_0x29be8e['model'],_0x29be8e[_0x3fdb('0x2a')]);_0x442dbc[_0x3fdb('0x2d')]=_[_0x3fdb('0x2c')](_0x29be8e[_0x3fdb('0x2e')],qs[_0x3fdb('0x2f')](_0x3d6fbe[_0x3fdb('0x2a')][_0x3fdb('0x2f')]));_0x442dbc[_0x3fdb('0x2d')]=_0x442dbc[_0x3fdb('0x2d')][_0x3fdb('0x30')]?_0x442dbc[_0x3fdb('0x2d')]:_0x29be8e[_0x3fdb('0x2e')];if(_0x3d6fbe[_0x3fdb('0x2a')]['includeAll']){_0x442dbc['include']=[{'all':!![]}];}_0x442dbc=_[_0x3fdb('0x31')]({},_0x442dbc,_0x3d6fbe[_0x3fdb('0x32')]);return db[_0x3fdb('0x28')][_0x3fdb('0x33')](_0x442dbc)[_0x3fdb('0x21')](handleEntityNotFound(_0x37f3d7,null))[_0x3fdb('0x21')](respondWithResult(_0x37f3d7,null))[_0x3fdb('0x34')](handleError(_0x37f3d7,null));};exports[_0x3fdb('0x35')]=function(_0xba3e2,_0x530b2a){return db[_0x3fdb('0x28')]['create'](_0xba3e2[_0x3fdb('0x36')],{})[_0x3fdb('0x21')](respondWithResult(_0x530b2a,0xc9))[_0x3fdb('0x34')](handleError(_0x530b2a,null));};exports['update']=function(_0x29cdfa,_0x324037){if(_0x29cdfa['body']['id']){delete _0x29cdfa[_0x3fdb('0x36')]['id'];}return db[_0x3fdb('0x28')][_0x3fdb('0x33')]({'where':{'id':_0x29cdfa[_0x3fdb('0x37')]['id']}})['then'](handleEntityNotFound(_0x324037,null))[_0x3fdb('0x21')](saveUpdates(_0x29cdfa[_0x3fdb('0x36')],null))['then'](respondWithResult(_0x324037,null))[_0x3fdb('0x34')](handleError(_0x324037,null));};exports[_0x3fdb('0x22')]=function(_0x23e574,_0x183db1){return db[_0x3fdb('0x28')][_0x3fdb('0x33')]({'where':{'id':_0x23e574['params']['id']}})[_0x3fdb('0x21')](handleEntityNotFound(_0x183db1,null))['then'](removeEntity(_0x183db1,null))[_0x3fdb('0x34')](handleError(_0x183db1,null));}; \ No newline at end of file +var _0x379e=['keys','rawAttributes','query','filters','intersection','model','attributes','length','includeAll','include','options','ChatProactiveAction','find','catch','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','count','set','Content-Range','reject','save','then','destroy','error','stack','name','send','show','params'];(function(_0x250298,_0x5a869a){var _0x798dbf=function(_0x1d9551){while(--_0x1d9551){_0x250298['push'](_0x250298['shift']());}};_0x798dbf(++_0x5a869a);}(_0x379e,0x104));var _0xe379=function(_0x18e088,_0x28bb43){_0x18e088=_0x18e088-0x0;var _0x278fe3=_0x379e[_0x18e088];return _0x278fe3;};'use strict';var emlformat=require(_0xe379('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe379('0x1'));var moment=require(_0xe379('0x2'));var BPromise=require(_0xe379('0x3'));var Mustache=require(_0xe379('0x4'));var util=require(_0xe379('0x5'));var path=require(_0xe379('0x6'));var sox=require(_0xe379('0x7'));var csv=require('to-csv');var ejs=require(_0xe379('0x8'));var fs=require('fs');var fs_extra=require(_0xe379('0x9'));var _=require(_0xe379('0xa'));var squel=require(_0xe379('0xb'));var crypto=require(_0xe379('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe379('0xd'));var toCsv=require(_0xe379('0xe'));var querystring=require(_0xe379('0xf'));var Papa=require(_0xe379('0x10'));var Redis=require(_0xe379('0x11'));var authService=require(_0xe379('0x12'));var qs=require(_0xe379('0x13'));var as=require(_0xe379('0x14'));var hardwareService=require(_0xe379('0x15'));var logger=require('../../config/logger')(_0xe379('0x16'));var utils=require(_0xe379('0x17'));var config=require(_0xe379('0x18'));var licenseUtil=require(_0xe379('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c6562,_0x2642a8){_0x2642a8=_0x2642a8||0xcc;return function(_0x45cf1a){if(_0x45cf1a){return _0x4c6562[_0xe379('0x1a')](_0x2642a8);}return _0x4c6562[_0xe379('0x1b')](_0x2642a8)[_0xe379('0x1c')]();};}function respondWithResult(_0x1ee8e0,_0x2a5b60){_0x2a5b60=_0x2a5b60||0xc8;return function(_0x70d82){if(_0x70d82){return _0x1ee8e0['status'](_0x2a5b60)[_0xe379('0x1d')](_0x70d82);}};}function respondWithFilteredResult(_0xab59c7,_0x20eaaf){return function(_0x105d7f){if(_0x105d7f){var _0x3d9351=typeof _0x20eaaf[_0xe379('0x1e')]==='undefined'&&typeof _0x20eaaf[_0xe379('0x1f')]==='undefined';var _0x2c2bd9=_0x105d7f['count'];var _0x150d92=_0x3d9351?0x0:_0x20eaaf[_0xe379('0x1e')];var _0xe4f3d1=_0x3d9351?_0x105d7f[_0xe379('0x20')]:_0x20eaaf['offset']+_0x20eaaf[_0xe379('0x1f')];var _0x260b2e;if(_0xe4f3d1>=_0x2c2bd9){_0xe4f3d1=_0x2c2bd9;_0x260b2e=0xc8;}else{_0x260b2e=0xce;}_0xab59c7[_0xe379('0x1b')](_0x260b2e);return _0xab59c7[_0xe379('0x21')](_0xe379('0x22'),_0x150d92+'-'+_0xe4f3d1+'/'+_0x2c2bd9)['json'](_0x105d7f);}return null;};}function patchUpdates(_0x2c749e){return function(_0x3a8d17){try{jsonpatch['apply'](_0x3a8d17,_0x2c749e,!![]);}catch(_0x39ec4d){return BPromise[_0xe379('0x23')](_0x39ec4d);}return _0x3a8d17[_0xe379('0x24')]();};}function saveUpdates(_0x2e946f,_0x32f43e){return function(_0x10b3c3){if(_0x10b3c3){return _0x10b3c3['update'](_0x2e946f)[_0xe379('0x25')](function(_0x32e16e){return _0x32e16e;});}return null;};}function removeEntity(_0x21e31b,_0x48b543){return function(_0x38236b){if(_0x38236b){return _0x38236b[_0xe379('0x26')]()['then'](function(){_0x21e31b[_0xe379('0x1b')](0xcc)[_0xe379('0x1c')]();});}};}function handleEntityNotFound(_0x4da256,_0x544bf3){return function(_0x22f596){if(!_0x22f596){_0x4da256[_0xe379('0x1a')](0x194);}return _0x22f596;};}function handleError(_0x26ba82,_0x4aa041){_0x4aa041=_0x4aa041||0x1f4;return function(_0x17ba51){logger[_0xe379('0x27')](_0x17ba51[_0xe379('0x28')]);if(_0x17ba51[_0xe379('0x29')]){delete _0x17ba51['name'];}_0x26ba82[_0xe379('0x1b')](_0x4aa041)[_0xe379('0x2a')](_0x17ba51);};}exports[_0xe379('0x2b')]=function(_0x50b0aa,_0x33037d){var _0x120239={'raw':!![],'where':{'id':_0x50b0aa[_0xe379('0x2c')]['id']}},_0x5d9ca1={};_0x5d9ca1['model']=_[_0xe379('0x2d')](db['ChatProactiveAction'][_0xe379('0x2e')]);_0x5d9ca1[_0xe379('0x2f')]=_[_0xe379('0x2d')](_0x50b0aa[_0xe379('0x2f')]);_0x5d9ca1[_0xe379('0x30')]=_[_0xe379('0x31')](_0x5d9ca1[_0xe379('0x32')],_0x5d9ca1['query']);_0x120239[_0xe379('0x33')]=_[_0xe379('0x31')](_0x5d9ca1[_0xe379('0x32')],qs['fields'](_0x50b0aa[_0xe379('0x2f')]['fields']));_0x120239['attributes']=_0x120239[_0xe379('0x33')][_0xe379('0x34')]?_0x120239[_0xe379('0x33')]:_0x5d9ca1[_0xe379('0x32')];if(_0x50b0aa['query'][_0xe379('0x35')]){_0x120239[_0xe379('0x36')]=[{'all':!![]}];}_0x120239=_['merge']({},_0x120239,_0x50b0aa[_0xe379('0x37')]);return db[_0xe379('0x38')][_0xe379('0x39')](_0x120239)[_0xe379('0x25')](handleEntityNotFound(_0x33037d,null))['then'](respondWithResult(_0x33037d,null))[_0xe379('0x3a')](handleError(_0x33037d,null));};exports['create']=function(_0xdc957d,_0x38d971){return db[_0xe379('0x38')][_0xe379('0x3b')](_0xdc957d[_0xe379('0x3c')],{})['then'](respondWithResult(_0x38d971,0xc9))[_0xe379('0x3a')](handleError(_0x38d971,null));};exports['update']=function(_0x42e7ca,_0x199e28){if(_0x42e7ca[_0xe379('0x3c')]['id']){delete _0x42e7ca['body']['id'];}return db[_0xe379('0x38')][_0xe379('0x39')]({'where':{'id':_0x42e7ca[_0xe379('0x2c')]['id']}})[_0xe379('0x25')](handleEntityNotFound(_0x199e28,null))['then'](saveUpdates(_0x42e7ca[_0xe379('0x3c')],null))['then'](respondWithResult(_0x199e28,null))[_0xe379('0x3a')](handleError(_0x199e28,null));};exports[_0xe379('0x26')]=function(_0x44bfce,_0x12e67e){return db[_0xe379('0x38')][_0xe379('0x39')]({'where':{'id':_0x44bfce['params']['id']}})[_0xe379('0x25')](handleEntityNotFound(_0x12e67e,null))['then'](removeEntity(_0x12e67e,null))[_0xe379('0x3a')](handleError(_0x12e67e,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 2d03d58..5852181 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 _0xaa15=['./chatProactiveAction.attributes','define','ChatProactiveAction','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x4f48b2,_0x39af74){var _0x58f40f=function(_0x2d6934){while(--_0x2d6934){_0x4f48b2['push'](_0x4f48b2['shift']());}};_0x58f40f(++_0x39af74);}(_0xaa15,0x107));var _0x5aa1=function(_0x14a72c,_0x3484f0){_0x14a72c=_0x14a72c-0x0;var _0x5de299=_0xaa15[_0x14a72c];return _0x5de299;};'use strict';var _=require(_0x5aa1('0x0'));var util=require('util');var logger=require(_0x5aa1('0x1'))('api');var moment=require(_0x5aa1('0x2'));var BPromise=require(_0x5aa1('0x3'));var rp=require(_0x5aa1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5aa1('0x5'));var config=require(_0x5aa1('0x6'));var attributes=require(_0x5aa1('0x7'));module['exports']=function(_0x2edb8a,_0x2a88d3){return _0x2edb8a[_0x5aa1('0x8')](_0x5aa1('0x9'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a5f=['rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x392bd3,_0x563eef){var _0x2b53d8=function(_0x2b372c){while(--_0x2b372c){_0x392bd3['push'](_0x392bd3['shift']());}};_0x2b53d8(++_0x563eef);}(_0x4a5f,0x13f));var _0xf4a5=function(_0x301075,_0x33b785){_0x301075=_0x301075-0x0;var _0x1a04c5=_0x4a5f[_0x301075];return _0x1a04c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4a5('0x0'))(_0xf4a5('0x1'));var moment=require(_0xf4a5('0x2'));var BPromise=require(_0xf4a5('0x3'));var rp=require(_0xf4a5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf4a5('0x5'));var config=require(_0xf4a5('0x6'));var attributes=require(_0xf4a5('0x7'));module[_0xf4a5('0x8')]=function(_0x264e5e,_0x1d9a92){return _0x264e5e[_0xf4a5('0x9')](_0xf4a5('0xa'),attributes,{'tableName':_0xf4a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.rpc.js b/server/api/chatProactiveAction/chatProactiveAction.rpc.js index 6603c6d..96c880c 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 _0x8972=['../../config/logger','rpc','../../config/environment','jayson/promise','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x533ef3,_0x42fc7c){var _0x25ceac=function(_0x462932){while(--_0x462932){_0x533ef3['push'](_0x533ef3['shift']());}};_0x25ceac(++_0x42fc7c);}(_0x8972,0x1aa));var _0x2897=function(_0x4ea5eb,_0x31360f){_0x4ea5eb=_0x4ea5eb-0x0;var _0xaf3912=_0x8972[_0x4ea5eb];return _0xaf3912;};'use strict';var _=require(_0x2897('0x0'));var util=require(_0x2897('0x1'));var moment=require(_0x2897('0x2'));var BPromise=require(_0x2897('0x3'));var rs=require(_0x2897('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2897('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2897('0x6'))(_0x2897('0x7'));var config=require(_0x2897('0x8'));var jayson=require(_0x2897('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x560c6e,_0x58058a,_0x522254){return new BPromise(function(_0x26190d,_0x2e847c){return client['request'](_0x560c6e,_0x522254)['then'](function(_0x56fd9e){logger[_0x2897('0xa')](_0x2897('0xb'),_0x58058a,_0x2897('0xc'));logger[_0x2897('0xd')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x58058a,_0x2897('0xc'),JSON[_0x2897('0xe')](_0x56fd9e));if(_0x56fd9e[_0x2897('0xf')]){if(_0x56fd9e['error']['code']===0x1f4){logger[_0x2897('0xf')]('ChatProactiveAction,\x20%s,\x20%s',_0x58058a,_0x56fd9e[_0x2897('0xf')]['message']);return _0x2e847c(_0x56fd9e[_0x2897('0xf')][_0x2897('0x10')]);}logger['error'](_0x2897('0xb'),_0x58058a,_0x56fd9e[_0x2897('0xf')][_0x2897('0x10')]);return _0x26190d(_0x56fd9e[_0x2897('0xf')][_0x2897('0x10')]);}else{logger[_0x2897('0xa')](_0x2897('0xb'),_0x58058a,_0x2897('0xc'));_0x26190d(_0x56fd9e['result'][_0x2897('0x10')]);}})[_0x2897('0x11')](function(_0x1a34da){logger[_0x2897('0xf')](_0x2897('0xb'),_0x58058a,_0x1a34da);_0x2e847c(_0x1a34da);});});} \ No newline at end of file +var _0xf87d=['message','result','catch','lodash','util','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x428a3a,_0x387221){var _0x43a093=function(_0x8f9068){while(--_0x8f9068){_0x428a3a['push'](_0x428a3a['shift']());}};_0x43a093(++_0x387221);}(_0xf87d,0x8f));var _0xdf87=function(_0x194c1a,_0x33002c){_0x194c1a=_0x194c1a-0x0;var _0x4dc225=_0xf87d[_0x194c1a];return _0x4dc225;};'use strict';var _=require(_0xdf87('0x0'));var util=require(_0xdf87('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdf87('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdf87('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdf87('0x4'));var config=require(_0xdf87('0x5'));var jayson=require(_0xdf87('0x6'));var client=jayson[_0xdf87('0x7')][_0xdf87('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x580d8c,_0x2ec395,_0x24f815){return new BPromise(function(_0x439421,_0x4009c6){return client[_0xdf87('0x9')](_0x580d8c,_0x24f815)[_0xdf87('0xa')](function(_0x4d1f7f){logger[_0xdf87('0xb')](_0xdf87('0xc'),_0x2ec395,'request\x20sent');logger['debug'](_0xdf87('0xd'),_0x2ec395,_0xdf87('0xe'),JSON[_0xdf87('0xf')](_0x4d1f7f));if(_0x4d1f7f[_0xdf87('0x10')]){if(_0x4d1f7f[_0xdf87('0x10')]['code']===0x1f4){logger[_0xdf87('0x10')](_0xdf87('0xc'),_0x2ec395,_0x4d1f7f[_0xdf87('0x10')][_0xdf87('0x11')]);return _0x4009c6(_0x4d1f7f['error'][_0xdf87('0x11')]);}logger[_0xdf87('0x10')](_0xdf87('0xc'),_0x2ec395,_0x4d1f7f[_0xdf87('0x10')][_0xdf87('0x11')]);return _0x439421(_0x4d1f7f[_0xdf87('0x10')][_0xdf87('0x11')]);}else{logger[_0xdf87('0xb')](_0xdf87('0xc'),_0x2ec395,_0xdf87('0xe'));_0x439421(_0x4d1f7f[_0xdf87('0x12')][_0xdf87('0x11')]);}})[_0xdf87('0x13')](function(_0x3a8be1){logger[_0xdf87('0x10')](_0xdf87('0xc'),_0x2ec395,_0x3a8be1);_0x4009c6(_0x3a8be1);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 937900c..4f0808d 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 _0x6aa7=['/:id','show','post','isAuthenticated','put','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x9c4ce,_0x26dfad){var _0x550c42=function(_0x2f2bf5){while(--_0x2f2bf5){_0x9c4ce['push'](_0x9c4ce['shift']());}};_0x550c42(++_0x26dfad);}(_0x6aa7,0x178));var _0x76aa=function(_0x36a20d,_0x12281c){_0x36a20d=_0x36a20d-0x0;var _0x288a39=_0x6aa7[_0x36a20d];return _0x288a39;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./chatProactiveAction.controller');router['get'](_0x76aa('0x8'),auth['isAuthenticated'](),controller[_0x76aa('0x9')]);router[_0x76aa('0xa')]('/',auth[_0x76aa('0xb')](),controller['create']);router[_0x76aa('0xc')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller['update']);router[_0x76aa('0xd')](_0x76aa('0x8'),auth[_0x76aa('0xb')](),controller[_0x76aa('0xe')]);module[_0x76aa('0xf')]=router; \ No newline at end of file +var _0x2eb2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2eb2,0x19f));var _0x22eb=function(_0x4d07cc,_0x587613){_0x4d07cc=_0x4d07cc-0x0;var _0x42de3b=_0x2eb2[_0x4d07cc];return _0x42de3b;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x22eb('0x7')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xa')]);router[_0x22eb('0xb')]('/',auth[_0x22eb('0x9')](),controller[_0x22eb('0xc')]);router[_0x22eb('0xd')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')]('/:id',auth[_0x22eb('0x9')](),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 e83f1ec..c761e9c 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 _0xcb7a=['INTEGER','rrmemory','exports','STRING','name'];(function(_0x3420e5,_0x67fec0){var _0x1e9141=function(_0x4babb2){while(--_0x4babb2){_0x3420e5['push'](_0x3420e5['shift']());}};_0x1e9141(++_0x67fec0);}(_0xcb7a,0xf2));var _0xacb7=function(_0x588fad,_0x424bb7){_0x588fad=_0x588fad-0x0;var _0x2ef8a8=_0xcb7a[_0x588fad];return _0x2ef8a8;};'use strict';var Sequelize=require('sequelize');module[_0xacb7('0x0')]={'name':{'type':Sequelize[_0xacb7('0x1')],'unique':_0xacb7('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xacb7('0x1')]},'timeout':{'type':Sequelize[_0xacb7('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xacb7('0x4'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x308d=['ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x1a56a5,_0x470d46){var _0x27a7c1=function(_0x25c805){while(--_0x25c805){_0x1a56a5['push'](_0x1a56a5['shift']());}};_0x27a7c1(++_0x470d46);}(_0x308d,0x93));var _0xd308=function(_0x58f044,_0x2a1862){_0x58f044=_0x58f044-0x0;var _0x3b3c69=_0x308d[_0x58f044];return _0x3b3c69;};'use strict';var Sequelize=require(_0xd308('0x0'));module[_0xd308('0x1')]={'name':{'type':Sequelize[_0xd308('0x2')],'unique':_0xd308('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd308('0x2')]},'timeout':{'type':Sequelize[_0xd308('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd308('0x5')](_0xd308('0x6'),'beepall',_0xd308('0x7'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 4b6aa3f..4d2bdb7 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 _0x6b3a=['push','sequelize','toString','QueryTypes','SELECT','every','includes','all','isEmpty','addAgents','omit','userChatQueue:save','removeAgents','userChatQueue:remove','order','getAgents','hasOwnProperty','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','destroy','ChatQueues','UserProfileResource','then','send','index','ChatQueue','rawAttributes','fieldName','type','getOptions','include','query','findAll','rows','model','keys','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','autoAssociation','name','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','describe','getMembers','nolimit','sort','where','pick','ChatQueueId','filter','map','UserChatQueue','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','online','voicePause','flatMap','transaction','each','findOrCreate','forEach','emit','removeTeams','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?'];(function(_0xd6a1c9,_0x203324){var _0x51ea29=function(_0x165a30){while(--_0x165a30){_0xd6a1c9['push'](_0xd6a1c9['shift']());}};_0x51ea29(++_0x203324);}(_0x6b3a,0x17c));var _0xa6b3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6b3a[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xa6b3('0x0'));var util=require(_0xa6b3('0x1'));var _=require(_0xa6b3('0x2'));var squel=require(_0xa6b3('0x3'));var Redis=require(_0xa6b3('0x4'));var qs=require(_0xa6b3('0x5'));var logger=require('../../config/logger')(_0xa6b3('0x6'));var config=require(_0xa6b3('0x7'));var db=require(_0xa6b3('0x8'))['db'];config['redis']=_[_0xa6b3('0x9')](config[_0xa6b3('0xa')],{'host':_0xa6b3('0xb'),'port':0x18eb});var socket=require(_0xa6b3('0xc'))(new Redis(config['redis']));require('./chatQueue.socket')[_0xa6b3('0xd')](socket);function respondWithStatusCode(_0x1d1ef8,_0x1d52a9){_0x1d52a9=_0x1d52a9||0xcc;return function(_0x43c67f){if(_0x43c67f){return _0x1d1ef8[_0xa6b3('0xe')](_0x1d52a9);}return _0x1d1ef8[_0xa6b3('0xf')](_0x1d52a9)[_0xa6b3('0x10')]();};}function respondWithResult(_0x4a6d8c,_0x498bd0){_0x498bd0=_0x498bd0||0xc8;return function(_0x1f8821){if(_0x1f8821){return _0x4a6d8c[_0xa6b3('0xf')](_0x498bd0)[_0xa6b3('0x11')](_0x1f8821);}};}function respondWithFilteredResult(_0x312b62,_0x4dd876){return function(_0x10da06){if(_0x10da06){var _0x20f073=typeof _0x4dd876[_0xa6b3('0x12')]==='undefined'&&typeof _0x4dd876[_0xa6b3('0x13')]===_0xa6b3('0x14');var _0x4413d2=_0x10da06[_0xa6b3('0x15')];var _0x1b37d1=_0x20f073?0x0:_0x4dd876['offset'];var _0x4067d9=_0x20f073?_0x10da06[_0xa6b3('0x15')]:_0x4dd876[_0xa6b3('0x12')]+_0x4dd876[_0xa6b3('0x13')];var _0x3efd35;if(_0x4067d9>=_0x4413d2){_0x4067d9=_0x4413d2;_0x3efd35=0xc8;}else{_0x3efd35=0xce;}_0x312b62[_0xa6b3('0xf')](_0x3efd35);return _0x312b62[_0xa6b3('0x16')](_0xa6b3('0x17'),_0x1b37d1+'-'+_0x4067d9+'/'+_0x4413d2)[_0xa6b3('0x11')](_0x10da06);}return null;};}function saveUpdates(_0x105d01){return function(_0x31bcfd){if(_0x31bcfd){return _0x31bcfd['update'](_0x105d01)['then'](function(_0x1f16cf){return _0x1f16cf;});}return null;};}function removeEntity(_0x42b933){return function(_0x42d924){if(_0x42d924){return _0x42d924[_0xa6b3('0x18')]()['then'](function(){var _0x57f680=_0x42d924['get']({'plain':!![]});var _0x3599eb=_0xa6b3('0x19');return db[_0xa6b3('0x1a')][_0xa6b3('0x18')]({'where':{'type':_0x3599eb,'resourceId':_0x57f680['id']}})[_0xa6b3('0x1b')](function(){return _0x42d924;});})[_0xa6b3('0x1b')](function(){_0x42b933[_0xa6b3('0xf')](0xcc)[_0xa6b3('0x10')]();});}};}function handleEntityNotFound(_0x5234b7){return function(_0x4ce018){if(!_0x4ce018){_0x5234b7[_0xa6b3('0xe')](0x194);}return _0x4ce018;};}function handleError(_0x2388eb,_0x22161b){_0x22161b=_0x22161b||0x1f4;return function(_0x158e02){logger['error'](_0x158e02['stack']);if(_0x158e02['name']){delete _0x158e02['name'];}_0x2388eb[_0xa6b3('0xf')](_0x22161b)[_0xa6b3('0x1c')](_0x158e02);};}exports[_0xa6b3('0x1d')]=function(_0x15e88f,_0xaa7f39){var _0x8e4f6c={};var _0x110565={'count':0x0,'rows':[]};var _0x56dfd3=_['map'](db[_0xa6b3('0x1e')][_0xa6b3('0x1f')],function(_0xca6802){return{'name':_0xca6802[_0xa6b3('0x20')],'type':_0xca6802[_0xa6b3('0x21')]['key']};});_0x8e4f6c=qs[_0xa6b3('0x22')](_0x56dfd3,_0x15e88f);var _0x109c28={'where':_0x8e4f6c['where']};return db[_0xa6b3('0x1e')][_0xa6b3('0x15')](_0x109c28)['then'](function(_0x2e4861){_0x110565[_0xa6b3('0x15')]=_0x2e4861;_0x8e4f6c[_0xa6b3('0x23')]=qs[_0xa6b3('0x23')](_0x15e88f[_0xa6b3('0x24')]);return db['ChatQueue'][_0xa6b3('0x25')](_0x8e4f6c);})[_0xa6b3('0x1b')](function(_0x1a8914){_0x110565[_0xa6b3('0x26')]=_0x1a8914;return _0x110565;})[_0xa6b3('0x1b')](respondWithFilteredResult(_0xaa7f39,_0x8e4f6c))['catch'](handleError(_0xaa7f39,null));};exports['show']=function(_0x4c001b,_0x5eee57){var _0x1762cc={'raw':!![],'where':{'id':_0x4c001b['params']['id']}},_0x60b1e6={};_0x60b1e6[_0xa6b3('0x27')]=_[_0xa6b3('0x28')](db['ChatQueue']['rawAttributes']);_0x60b1e6[_0xa6b3('0x24')]=_[_0xa6b3('0x28')](_0x4c001b[_0xa6b3('0x24')]);_0x60b1e6[_0xa6b3('0x29')]=_['intersection'](_0x60b1e6[_0xa6b3('0x27')],_0x60b1e6['query']);_0x1762cc[_0xa6b3('0x2a')]=_[_0xa6b3('0x2b')](_0x60b1e6[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x4c001b[_0xa6b3('0x24')][_0xa6b3('0x2c')]));_0x1762cc[_0xa6b3('0x2a')]=_0x1762cc[_0xa6b3('0x2a')][_0xa6b3('0x2d')]?_0x1762cc[_0xa6b3('0x2a')]:_0x60b1e6[_0xa6b3('0x27')];if(_0x4c001b[_0xa6b3('0x24')][_0xa6b3('0x2e')]){_0x1762cc['include']=[{'all':!![]}];}_0x1762cc=_[_0xa6b3('0x2f')]({},_0x1762cc,_0x4c001b[_0xa6b3('0x30')]);return db[_0xa6b3('0x1e')][_0xa6b3('0x31')](_0x1762cc)[_0xa6b3('0x1b')](handleEntityNotFound(_0x5eee57,null))[_0xa6b3('0x1b')](respondWithResult(_0x5eee57,null))[_0xa6b3('0x32')](handleError(_0x5eee57,null));};exports['create']=function(_0x38dd49,_0x1a41d3){return db[_0xa6b3('0x1e')][_0xa6b3('0x33')](_0x38dd49['body'],{})[_0xa6b3('0x1b')](function(_0x169519){var _0x4a090a=_0x38dd49[_0xa6b3('0x34')]['get']({'plain':!![]});if(!_0x4a090a)throw new Error(_0xa6b3('0x35'));if(_0x4a090a['role']===_0xa6b3('0x34')){var _0x2265c1=_0x169519[_0xa6b3('0x36')]({'plain':!![]});var _0x4a9ce4=_0xa6b3('0x19');return db['UserProfileSection'][_0xa6b3('0x31')]({'where':{'name':_0x4a9ce4,'userProfileId':_0x4a090a['userProfileId']},'raw':!![]})['then'](function(_0x3d9c43){if(_0x3d9c43&&_0x3d9c43[_0xa6b3('0x37')]===0x0){return db[_0xa6b3('0x1a')][_0xa6b3('0x33')]({'name':_0x2265c1[_0xa6b3('0x38')],'resourceId':_0x2265c1['id'],'type':_0x3d9c43[_0xa6b3('0x38')],'sectionId':_0x3d9c43['id']},{})[_0xa6b3('0x1b')](function(){return _0x169519;});}else{return _0x169519;}})[_0xa6b3('0x32')](function(_0x12b01d){logger[_0xa6b3('0x39')](_0xa6b3('0x3a'),_0x12b01d);throw _0x12b01d;});}return _0x169519;})[_0xa6b3('0x1b')](respondWithResult(_0x1a41d3,0xc9))[_0xa6b3('0x32')](handleError(_0x1a41d3,null));};exports[_0xa6b3('0x3b')]=function(_0x4265e9,_0xe421a4){if(_0x4265e9[_0xa6b3('0x3c')]['id']){delete _0x4265e9['body']['id'];}return db[_0xa6b3('0x1e')][_0xa6b3('0x31')]({'where':{'id':_0x4265e9[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0xe421a4,null))[_0xa6b3('0x1b')](saveUpdates(_0x4265e9[_0xa6b3('0x3c')],null))[_0xa6b3('0x1b')](respondWithResult(_0xe421a4,null))['catch'](handleError(_0xe421a4,null));};exports['destroy']=function(_0x397b3d,_0x59b450){return db[_0xa6b3('0x1e')][_0xa6b3('0x31')]({'where':{'id':_0x397b3d[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x59b450,null))[_0xa6b3('0x1b')](removeEntity(_0x59b450,null))[_0xa6b3('0x32')](handleError(_0x59b450,null));};exports[_0xa6b3('0x3e')]=function(_0xd0957a,_0xe71e15){return db['ChatQueue'][_0xa6b3('0x3e')]()['then'](respondWithResult(_0xe71e15,null))[_0xa6b3('0x32')](handleError(_0xe71e15,null));};exports[_0xa6b3('0x3f')]=function(_0x328207,_0x255886){var _0x2161ca={'raw':!![],'where':{}},_0x18df8e={},_0x5c7394;return db['ChatQueue']['findOne']({'where':{'id':_0x328207[_0xa6b3('0x3d')]['id']}})['then'](handleEntityNotFound(_0x255886,null))['then'](function(_0x37e28b){if(_0x37e28b){_0x5c7394=_0x37e28b['get']({'plain':!![]});_0x18df8e[_0xa6b3('0x27')]=_[_0xa6b3('0x28')](db['UserChatQueue'][_0xa6b3('0x1f')]);_0x18df8e[_0xa6b3('0x24')]=_[_0xa6b3('0x28')](_0x328207[_0xa6b3('0x24')]);_0x18df8e[_0xa6b3('0x29')]=_[_0xa6b3('0x2b')](_0x18df8e['model'],_0x18df8e['query']);_0x2161ca[_0xa6b3('0x2a')]=_[_0xa6b3('0x2b')](_0x18df8e[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x328207['query']['fields']));_0x2161ca[_0xa6b3('0x2a')]=_0x2161ca['attributes'][_0xa6b3('0x2d')]?_0x2161ca[_0xa6b3('0x2a')]:_0x18df8e[_0xa6b3('0x27')];if(!_0x328207[_0xa6b3('0x24')]['hasOwnProperty'](_0xa6b3('0x40'))){_0x2161ca[_0xa6b3('0x13')]=qs[_0xa6b3('0x13')](_0x328207[_0xa6b3('0x24')]['limit']);_0x2161ca[_0xa6b3('0x12')]=qs[_0xa6b3('0x12')](_0x328207[_0xa6b3('0x24')][_0xa6b3('0x12')]);}_0x2161ca['order']=qs[_0xa6b3('0x41')](_0x328207['query'][_0xa6b3('0x41')]);_0x2161ca[_0xa6b3('0x42')]=qs[_0xa6b3('0x29')](_[_0xa6b3('0x43')](_0x328207[_0xa6b3('0x24')],_0x18df8e['filters']));_0x2161ca['where'][_0xa6b3('0x44')]=_0x37e28b['id'];if(_0x328207[_0xa6b3('0x24')][_0xa6b3('0x45')]){_0x2161ca[_0xa6b3('0x42')]=_[_0xa6b3('0x2f')](_0x2161ca[_0xa6b3('0x42')],{'$or':_[_0xa6b3('0x46')](_0x2161ca[_0xa6b3('0x2a')],function(_0x596647){var _0x3b213d={};_0x3b213d[_0x596647]={'$like':'%'+_0x328207['query'][_0xa6b3('0x45')]+'%'};return _0x3b213d;})});}_0x2161ca=_[_0xa6b3('0x2f')]({},_0x2161ca,_0x328207[_0xa6b3('0x30')]);return db[_0xa6b3('0x47')]['findAll'](_0x2161ca);}})[_0xa6b3('0x1b')](function(_0x5ae544){if(_0x5ae544){return db[_0xa6b3('0x48')][_0xa6b3('0x49')]({'where':{'id':_[_0xa6b3('0x46')](_0x5ae544,_0xa6b3('0x4a')),'role':_0xa6b3('0x4b')},'attributes':['id',_0xa6b3('0x38'),'chatPause',_0xa6b3('0x4c'),_0xa6b3('0x4d')]});}})[_0xa6b3('0x1b')](function(_0x379847){if(_0x379847){return{'count':_0x379847[_0xa6b3('0x15')],'rows':_[_0xa6b3('0x46')](_0x379847[_0xa6b3('0x26')],function(_0x379932){return{'membername':_0x379932[_0xa6b3('0x38')],'UserId':_0x379932['id'],'queue_name':_0x5c7394[_0xa6b3('0x38')],'ChatQueueId':_0x5c7394['id'],'interface':util[_0xa6b3('0x4e')](_0xa6b3('0x4f'),'SIP',_0x379932['name']),'penalty':0x0,'paused':_0x379932['chatPause'],'createdAt':_0x379932[_0xa6b3('0x4d')],'updatedAt':_0x379932['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xa6b3('0x1b')](respondWithFilteredResult(_0x255886,_0x2161ca))[_0xa6b3('0x32')](handleError(_0x255886,null));};exports[_0xa6b3('0x50')]=function(_0x183023,_0x5acf69){var _0xcb35e7={};var _0x5e8e5c={};var _0x419cac;var _0x99608;return db[_0xa6b3('0x1e')][_0xa6b3('0x51')]({'where':{'id':_0x183023['params']['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x5acf69,null))[_0xa6b3('0x1b')](function(_0x126ad1){if(_0x126ad1){_0x419cac=_0x126ad1;_0x5e8e5c[_0xa6b3('0x27')]=_['keys'](db[_0xa6b3('0x52')][_0xa6b3('0x1f')]);_0x5e8e5c[_0xa6b3('0x24')]=_['keys'](_0x183023[_0xa6b3('0x24')]);_0x5e8e5c[_0xa6b3('0x29')]=_[_0xa6b3('0x2b')](_0x5e8e5c[_0xa6b3('0x27')],_0x5e8e5c[_0xa6b3('0x24')]);_0xcb35e7[_0xa6b3('0x2a')]=_['intersection'](_0x5e8e5c[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x183023[_0xa6b3('0x24')][_0xa6b3('0x2c')]));_0xcb35e7[_0xa6b3('0x2a')]=_0xcb35e7[_0xa6b3('0x2a')][_0xa6b3('0x2d')]?_0xcb35e7['attributes']:_0x5e8e5c[_0xa6b3('0x27')];_0xcb35e7['order']=qs[_0xa6b3('0x41')](_0x183023[_0xa6b3('0x24')][_0xa6b3('0x41')]);_0xcb35e7['where']=qs[_0xa6b3('0x29')](_['pick'](_0x183023['query'],_0x5e8e5c[_0xa6b3('0x29')]));if(_0x183023[_0xa6b3('0x24')]['filter']){_0xcb35e7[_0xa6b3('0x42')]=_[_0xa6b3('0x2f')](_0xcb35e7[_0xa6b3('0x42')],{'$or':_['map'](_0xcb35e7[_0xa6b3('0x2a')],function(_0x4fe33a){var _0x486234={};_0x486234[_0x4fe33a]={'$like':'%'+_0x183023[_0xa6b3('0x24')]['filter']+'%'};return _0x486234;})});}_0xcb35e7=_[_0xa6b3('0x2f')]({},_0xcb35e7,_0x183023[_0xa6b3('0x30')]);return _0x419cac[_0xa6b3('0x50')](_0xcb35e7);}})[_0xa6b3('0x1b')](function(_0x5fd978){if(_0x5fd978){_0x99608=_0x5fd978[_0xa6b3('0x2d')];if(!_0x183023[_0xa6b3('0x24')]['hasOwnProperty'](_0xa6b3('0x40'))){_0xcb35e7['limit']=qs['limit'](_0x183023[_0xa6b3('0x24')][_0xa6b3('0x13')]);_0xcb35e7[_0xa6b3('0x12')]=qs['offset'](_0x183023['query'][_0xa6b3('0x12')]);}return _0x419cac[_0xa6b3('0x50')](_0xcb35e7);}})[_0xa6b3('0x1b')](function(_0x4b0394){if(_0x4b0394){return _0x4b0394?{'count':_0x99608,'rows':_0x4b0394}:null;}})[_0xa6b3('0x1b')](respondWithResult(_0x5acf69,null))[_0xa6b3('0x32')](handleError(_0x5acf69,null));};exports[_0xa6b3('0x53')]=function(_0x20e4c5,_0x2a410b){var _0x2a89b9=_0x20e4c5[_0xa6b3('0x3c')][_0xa6b3('0x54')];return db[_0xa6b3('0x52')]['findAll']({'where':{'id':_0x2a89b9},'attributes':['id'],'include':[{'model':db[_0xa6b3('0x48')],'as':'Agents','attributes':['id','name',_0xa6b3('0x55'),_0xa6b3('0x56'),'interface'],'raw':!![]}]})['then'](function(_0x5520c1){if(_0x5520c1){var _0x344ea0=_[_0xa6b3('0x57')](_0x5520c1,function(_0x446542){var _0x5d7a03=_0x446542[_0xa6b3('0x36')]({'plain':!![]});return _0x5d7a03['Agents'];});return db[_0xa6b3('0x1e')][_0xa6b3('0x31')]({'where':{'id':_0x20e4c5[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](function(_0x36fdb4){return db['sequelize'][_0xa6b3('0x58')](function(_0x1db2d3){return _0x36fdb4['addTeams'](_0x2a89b9,{'transaction':_0x1db2d3})[_0xa6b3('0x1b')](function(){return BPromise[_0xa6b3('0x59')](_0x344ea0,function(_0x596b24){return db[_0xa6b3('0x47')][_0xa6b3('0x5a')]({'where':{'UserId':_0x596b24['id'],'ChatQueueId':_0x20e4c5[_0xa6b3('0x3d')]['id']},'transaction':_0x1db2d3});});})['then'](function(){_0x344ea0[_0xa6b3('0x5b')](function(_0x5c1ae4){socket[_0xa6b3('0x5c')]('userChatQueue:save',{'UserId':_0x5c1ae4['id'],'ChatQueueId':_0x36fdb4['id']});});});});});}})[_0xa6b3('0x1b')](respondWithStatusCode(_0x2a410b,null))[_0xa6b3('0x32')](handleError(_0x2a410b,null));};exports[_0xa6b3('0x5d')]=function(_0x15f836,_0x591e86){return db[_0xa6b3('0x52')]['findAll']({'where':{'id':_0x15f836[_0xa6b3('0x24')][_0xa6b3('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xa6b3('0x5e'),'attributes':['id'],'raw':!![]}]})[_0xa6b3('0x1b')](handleEntityNotFound(_0x591e86,null))[_0xa6b3('0x1b')](function(_0x3929ce){var _0x5ebd47=_[_0xa6b3('0x46')](_0x3929ce,'id');var _0x42998f=[];var _0x4a71d9=[];var _0x5e31b5=squel[_0xa6b3('0x5f')]();_0x5e31b5[_0xa6b3('0x60')](_0xa6b3('0x61'))[_0xa6b3('0x62')](_0xa6b3('0x63'),'tq')[_0xa6b3('0x64')](_0xa6b3('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xa6b3('0x66'),_0x15f836[_0xa6b3('0x3d')]['id']);for(var _0xae2e18=0x0;_0xae2e18<_0x3929ce[_0xa6b3('0x2d')];_0xae2e18+=0x1){let _0x347418=_0x3929ce[_0xae2e18];for(var _0x1ed755=0x0;_0x1ed755<_0x347418[_0xa6b3('0x5e')][_0xa6b3('0x2d')];_0x1ed755+=0x1){let _0x2e5e56=_0x347418[_0xa6b3('0x5e')][_0x1ed755];var _0x49dd5f=_0x5e31b5['clone']();_0x49dd5f[_0xa6b3('0x42')](_0xa6b3('0x67'),_0x2e5e56['id']);_0x4a71d9[_0xa6b3('0x68')](db[_0xa6b3('0x69')][_0xa6b3('0x24')](_0x49dd5f[_0xa6b3('0x6a')](),{'type':db[_0xa6b3('0x69')][_0xa6b3('0x6b')][_0xa6b3('0x6c')]})[_0xa6b3('0x1b')](function(_0x2b99a9){if(_0x2b99a9[_0xa6b3('0x2d')]===0x1){return _0x2e5e56['id'];}else{var _0x3e931f=_[_0xa6b3('0x6d')](_[_0xa6b3('0x46')](_0x2b99a9,'TeamId'),function(_0x18b9c1){return _[_0xa6b3('0x6e')](_0x5ebd47,_0x18b9c1);});if(_0x3e931f){return _0x2e5e56['id'];}}}));}}return BPromise[_0xa6b3('0x6f')](_0x4a71d9)[_0xa6b3('0x1b')](function(_0x48dd84){_0x42998f=_(_0x42998f)['union'](_0x48dd84)['compact']()['value']();return db['ChatQueue'][_0xa6b3('0x31')]({'where':{'id':_0x15f836[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](function(_0x20dff5){return db[_0xa6b3('0x69')][_0xa6b3('0x58')](function(_0x8c02e8){return _0x20dff5[_0xa6b3('0x5d')](_0x15f836[_0xa6b3('0x24')]['ids'],{'transaction':_0x8c02e8})['then'](function(){if(!_[_0xa6b3('0x70')](_0x42998f)){return _0x20dff5['removeAgents'](_0x42998f,{'transaction':_0x8c02e8});}})['then'](function(){_0x42998f[_0xa6b3('0x5b')](function(_0x1bb730){socket[_0xa6b3('0x5c')]('userChatQueue:remove',{'UserId':_0x1bb730,'ChatQueueId':_0x20dff5['id']});});});});});});})['then'](respondWithStatusCode(_0x591e86,null))['catch'](handleError(_0x591e86,null));};exports[_0xa6b3('0x71')]=function(_0x3f26c1,_0x3dad4d){return db['ChatQueue']['find']({'where':{'id':_0x3f26c1['params']['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x3dad4d,null))[_0xa6b3('0x1b')](function(_0x1e4c3b){if(_0x1e4c3b){return _0x1e4c3b['addAgents'](_0x3f26c1[_0xa6b3('0x3c')][_0xa6b3('0x54')],_[_0xa6b3('0x72')](_0x3f26c1[_0xa6b3('0x3c')],[_0xa6b3('0x54'),'id'])||{})['spread'](function(_0x5cdda4){for(var _0x30f63d=0x0;_0x30f63d<_0x3f26c1[_0xa6b3('0x3c')][_0xa6b3('0x54')][_0xa6b3('0x2d')];_0x30f63d+=0x1){socket['emit'](_0xa6b3('0x73'),{'UserId':Number(_0x3f26c1[_0xa6b3('0x3c')][_0xa6b3('0x54')][_0x30f63d]),'ChatQueueId':Number(_0x3f26c1['params']['id'])});}return _0x5cdda4;});}})[_0xa6b3('0x1b')](respondWithResult(_0x3dad4d,null))[_0xa6b3('0x32')](handleError(_0x3dad4d,null));};exports[_0xa6b3('0x74')]=function(_0x235e8e,_0x388751){return db[_0xa6b3('0x1e')]['find']({'where':{'id':_0x235e8e[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x388751,null))['then'](function(_0x25d3b0){if(_0x25d3b0){return _0x25d3b0[_0xa6b3('0x74')](_0x235e8e['query']['ids'])[_0xa6b3('0x1b')](function(){if(_['isArray'](_0x235e8e[_0xa6b3('0x24')][_0xa6b3('0x54')])){for(var _0x1bfc4a=0x0;_0x1bfc4a<_0x235e8e[_0xa6b3('0x24')][_0xa6b3('0x54')]['length'];_0x1bfc4a+=0x1){socket[_0xa6b3('0x5c')](_0xa6b3('0x75'),{'UserId':Number(_0x235e8e[_0xa6b3('0x24')][_0xa6b3('0x54')][_0x1bfc4a]),'ChatQueueId':Number(_0x235e8e[_0xa6b3('0x3d')]['id'])});}}else{socket[_0xa6b3('0x5c')](_0xa6b3('0x75'),{'UserId':Number(_0x235e8e[_0xa6b3('0x24')]['ids']),'ChatQueueId':Number(_0x235e8e[_0xa6b3('0x3d')]['id'])});}});}})[_0xa6b3('0x1b')](respondWithStatusCode(_0x388751,null))[_0xa6b3('0x32')](handleError(_0x388751,null));};exports['getAgents']=function(_0x5402cc,_0x35d4fd){var _0x1d8f65={};var _0x512229={};var _0x56519a;var _0x10d3df;return db[_0xa6b3('0x1e')][_0xa6b3('0x51')]({'where':{'id':_0x5402cc[_0xa6b3('0x3d')]['id']}})[_0xa6b3('0x1b')](handleEntityNotFound(_0x35d4fd,null))[_0xa6b3('0x1b')](function(_0x40c2f8){if(_0x40c2f8){_0x56519a=_0x40c2f8;_0x512229['model']=_[_0xa6b3('0x28')](db[_0xa6b3('0x48')][_0xa6b3('0x1f')]);_0x512229[_0xa6b3('0x24')]=_[_0xa6b3('0x28')](_0x5402cc['query']);_0x512229['filters']=_[_0xa6b3('0x2b')](_0x512229[_0xa6b3('0x27')],_0x512229['query']);_0x1d8f65[_0xa6b3('0x2a')]=_[_0xa6b3('0x2b')](_0x512229[_0xa6b3('0x27')],qs[_0xa6b3('0x2c')](_0x5402cc['query'][_0xa6b3('0x2c')]));_0x1d8f65['attributes']=_0x1d8f65[_0xa6b3('0x2a')]['length']?_0x1d8f65[_0xa6b3('0x2a')]:_0x512229[_0xa6b3('0x27')];_0x1d8f65[_0xa6b3('0x76')]=qs[_0xa6b3('0x41')](_0x5402cc[_0xa6b3('0x24')][_0xa6b3('0x41')]);_0x1d8f65[_0xa6b3('0x42')]=qs[_0xa6b3('0x29')](_[_0xa6b3('0x43')](_0x5402cc[_0xa6b3('0x24')],_0x512229[_0xa6b3('0x29')]));if(_0x5402cc[_0xa6b3('0x24')][_0xa6b3('0x45')]){_0x1d8f65[_0xa6b3('0x42')]=_[_0xa6b3('0x2f')](_0x1d8f65['where'],{'$or':_[_0xa6b3('0x46')](_0x1d8f65[_0xa6b3('0x2a')],function(_0x4cb711){var _0x5829c9={};_0x5829c9[_0x4cb711]={'$like':'%'+_0x5402cc['query'][_0xa6b3('0x45')]+'%'};return _0x5829c9;})});}_0x1d8f65=_[_0xa6b3('0x2f')]({},_0x1d8f65,_0x5402cc[_0xa6b3('0x30')]);return _0x56519a[_0xa6b3('0x77')](_0x1d8f65);}})[_0xa6b3('0x1b')](function(_0x2dbd69){if(_0x2dbd69){_0x10d3df=_0x2dbd69[_0xa6b3('0x2d')];if(!_0x5402cc[_0xa6b3('0x24')][_0xa6b3('0x78')](_0xa6b3('0x40'))){_0x1d8f65[_0xa6b3('0x13')]=qs[_0xa6b3('0x13')](_0x5402cc[_0xa6b3('0x24')]['limit']);_0x1d8f65['offset']=qs['offset'](_0x5402cc['query']['offset']);}return _0x56519a[_0xa6b3('0x77')](_0x1d8f65);}})[_0xa6b3('0x1b')](function(_0x25cb41){if(_0x25cb41){return _0x25cb41?{'count':_0x10d3df,'rows':_0x25cb41}:null;}})[_0xa6b3('0x1b')](respondWithResult(_0x35d4fd,null))[_0xa6b3('0x32')](handleError(_0x35d4fd,null));}; \ No newline at end of file +var _0x9572=['UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','options','findAll','UserId','chatPause','updatedAt','createdAt','rows','format','SIP','getTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','findOrCreate','forEach','emit','removeTeams','field','tq.TeamId','from','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./chatQueue.socket','sendStatus','status','json','offset','undefined','limit','count','set','update','then','get','ChatQueues','UserProfileResource','end','error','stack','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','where','include','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','findOne'];(function(_0x5698a9,_0x4ae7c7){var _0x3be696=function(_0x396896){while(--_0x396896){_0x5698a9['push'](_0x5698a9['shift']());}};_0x3be696(++_0x4ae7c7);}(_0x9572,0x135));var _0x2957=function(_0x476ad7,_0xcbc856){_0x476ad7=_0x476ad7-0x0;var _0xf09e30=_0x9572[_0x476ad7];return _0xf09e30;};'use strict';var BPromise=require(_0x2957('0x0'));var util=require(_0x2957('0x1'));var _=require('lodash');var squel=require(_0x2957('0x2'));var Redis=require(_0x2957('0x3'));var qs=require(_0x2957('0x4'));var logger=require('../../config/logger')(_0x2957('0x5'));var config=require(_0x2957('0x6'));var db=require(_0x2957('0x7'))['db'];config[_0x2957('0x8')]=_['defaults'](config[_0x2957('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x2957('0x9'))(new Redis(config['redis']));require(_0x2957('0xa'))['register'](socket);function respondWithStatusCode(_0xa0a0dd,_0x585f47){_0x585f47=_0x585f47||0xcc;return function(_0x7d92b2){if(_0x7d92b2){return _0xa0a0dd[_0x2957('0xb')](_0x585f47);}return _0xa0a0dd[_0x2957('0xc')](_0x585f47)['end']();};}function respondWithResult(_0x3ea8e1,_0x14c4a0){_0x14c4a0=_0x14c4a0||0xc8;return function(_0x17bd86){if(_0x17bd86){return _0x3ea8e1['status'](_0x14c4a0)[_0x2957('0xd')](_0x17bd86);}};}function respondWithFilteredResult(_0x33b746,_0x26a264){return function(_0x2233a3){if(_0x2233a3){var _0x40338c=typeof _0x26a264[_0x2957('0xe')]===_0x2957('0xf')&&typeof _0x26a264[_0x2957('0x10')]===_0x2957('0xf');var _0x7c03c4=_0x2233a3[_0x2957('0x11')];var _0x36321a=_0x40338c?0x0:_0x26a264[_0x2957('0xe')];var _0x585ccf=_0x40338c?_0x2233a3[_0x2957('0x11')]:_0x26a264[_0x2957('0xe')]+_0x26a264[_0x2957('0x10')];var _0x32f65a;if(_0x585ccf>=_0x7c03c4){_0x585ccf=_0x7c03c4;_0x32f65a=0xc8;}else{_0x32f65a=0xce;}_0x33b746['status'](_0x32f65a);return _0x33b746[_0x2957('0x12')]('Content-Range',_0x36321a+'-'+_0x585ccf+'/'+_0x7c03c4)[_0x2957('0xd')](_0x2233a3);}return null;};}function saveUpdates(_0x9e7024){return function(_0x4c0c8a){if(_0x4c0c8a){return _0x4c0c8a[_0x2957('0x13')](_0x9e7024)[_0x2957('0x14')](function(_0x5a11d8){return _0x5a11d8;});}return null;};}function removeEntity(_0xda9068){return function(_0x36299a){if(_0x36299a){return _0x36299a['destroy']()[_0x2957('0x14')](function(){var _0x1cdbc0=_0x36299a[_0x2957('0x15')]({'plain':!![]});var _0x503a8e=_0x2957('0x16');return db[_0x2957('0x17')]['destroy']({'where':{'type':_0x503a8e,'resourceId':_0x1cdbc0['id']}})[_0x2957('0x14')](function(){return _0x36299a;});})['then'](function(){_0xda9068[_0x2957('0xc')](0xcc)[_0x2957('0x18')]();});}};}function handleEntityNotFound(_0x24efa6){return function(_0xcfd76c){if(!_0xcfd76c){_0x24efa6[_0x2957('0xb')](0x194);}return _0xcfd76c;};}function handleError(_0x385660,_0x1e44f8){_0x1e44f8=_0x1e44f8||0x1f4;return function(_0x519f12){logger[_0x2957('0x19')](_0x519f12[_0x2957('0x1a')]);if(_0x519f12[_0x2957('0x1b')]){delete _0x519f12['name'];}_0x385660['status'](_0x1e44f8)[_0x2957('0x1c')](_0x519f12);};}exports[_0x2957('0x1d')]=function(_0x20eb5a,_0x45e84e){var _0x67d53e={};var _0x2ff8a={'count':0x0,'rows':[]};var _0x543296=_[_0x2957('0x1e')](db[_0x2957('0x1f')][_0x2957('0x20')],function(_0x5aaf64){return{'name':_0x5aaf64[_0x2957('0x21')],'type':_0x5aaf64[_0x2957('0x22')]['key']};});_0x67d53e=qs['getOptions'](_0x543296,_0x20eb5a);var _0x1dac2b={'where':_0x67d53e[_0x2957('0x23')]};return db['ChatQueue']['count'](_0x1dac2b)[_0x2957('0x14')](function(_0x23c3ec){_0x2ff8a[_0x2957('0x11')]=_0x23c3ec;_0x67d53e['include']=qs[_0x2957('0x24')](_0x20eb5a['query']);return db[_0x2957('0x1f')]['findAll'](_0x67d53e);})[_0x2957('0x14')](function(_0x12b938){_0x2ff8a['rows']=_0x12b938;return _0x2ff8a;})[_0x2957('0x14')](respondWithFilteredResult(_0x45e84e,_0x67d53e))[_0x2957('0x25')](handleError(_0x45e84e,null));};exports[_0x2957('0x26')]=function(_0x4c658e,_0x3d8b66){var _0x559253={'raw':!![],'where':{'id':_0x4c658e[_0x2957('0x27')]['id']}},_0x27726f={};_0x27726f[_0x2957('0x28')]=_[_0x2957('0x29')](db[_0x2957('0x1f')]['rawAttributes']);_0x27726f['query']=_['keys'](_0x4c658e[_0x2957('0x2a')]);_0x27726f[_0x2957('0x2b')]=_[_0x2957('0x2c')](_0x27726f[_0x2957('0x28')],_0x27726f[_0x2957('0x2a')]);_0x559253[_0x2957('0x2d')]=_['intersection'](_0x27726f[_0x2957('0x28')],qs['fields'](_0x4c658e['query'][_0x2957('0x2e')]));_0x559253['attributes']=_0x559253[_0x2957('0x2d')][_0x2957('0x2f')]?_0x559253[_0x2957('0x2d')]:_0x27726f[_0x2957('0x28')];if(_0x4c658e['query'][_0x2957('0x30')]){_0x559253[_0x2957('0x24')]=[{'all':!![]}];}_0x559253=_[_0x2957('0x31')]({},_0x559253,_0x4c658e['options']);return db[_0x2957('0x1f')][_0x2957('0x32')](_0x559253)[_0x2957('0x14')](handleEntityNotFound(_0x3d8b66,null))[_0x2957('0x14')](respondWithResult(_0x3d8b66,null))['catch'](handleError(_0x3d8b66,null));};exports['create']=function(_0xf45618,_0xeea1a3){return db['ChatQueue']['create'](_0xf45618[_0x2957('0x33')],{})['then'](function(_0x44b52e){var _0x59f914=_0xf45618[_0x2957('0x34')][_0x2957('0x15')]({'plain':!![]});if(!_0x59f914)throw new Error(_0x2957('0x35'));if(_0x59f914[_0x2957('0x36')]==='user'){var _0x17c655=_0x44b52e['get']({'plain':!![]});var _0x5d8435='ChatQueues';return db[_0x2957('0x37')][_0x2957('0x32')]({'where':{'name':_0x5d8435,'userProfileId':_0x59f914[_0x2957('0x38')]},'raw':!![]})['then'](function(_0xc0eed9){if(_0xc0eed9&&_0xc0eed9[_0x2957('0x39')]===0x0){return db[_0x2957('0x17')][_0x2957('0x3a')]({'name':_0x17c655['name'],'resourceId':_0x17c655['id'],'type':_0xc0eed9['name'],'sectionId':_0xc0eed9['id']},{})[_0x2957('0x14')](function(){return _0x44b52e;});}else{return _0x44b52e;}})[_0x2957('0x25')](function(_0xabac04){logger['error'](_0x2957('0x3b'),_0xabac04);throw _0xabac04;});}return _0x44b52e;})[_0x2957('0x14')](respondWithResult(_0xeea1a3,0xc9))[_0x2957('0x25')](handleError(_0xeea1a3,null));};exports['update']=function(_0x3a3b27,_0x5b6f0c){if(_0x3a3b27[_0x2957('0x33')]['id']){delete _0x3a3b27[_0x2957('0x33')]['id'];}return db[_0x2957('0x1f')][_0x2957('0x32')]({'where':{'id':_0x3a3b27[_0x2957('0x27')]['id']}})[_0x2957('0x14')](handleEntityNotFound(_0x5b6f0c,null))[_0x2957('0x14')](saveUpdates(_0x3a3b27['body'],null))[_0x2957('0x14')](respondWithResult(_0x5b6f0c,null))[_0x2957('0x25')](handleError(_0x5b6f0c,null));};exports[_0x2957('0x3c')]=function(_0x3e3110,_0xe0a5ec){return db[_0x2957('0x1f')][_0x2957('0x32')]({'where':{'id':_0x3e3110['params']['id']}})[_0x2957('0x14')](handleEntityNotFound(_0xe0a5ec,null))[_0x2957('0x14')](removeEntity(_0xe0a5ec,null))[_0x2957('0x25')](handleError(_0xe0a5ec,null));};exports['describe']=function(_0x47bf2c,_0x243cb5){return db[_0x2957('0x1f')][_0x2957('0x3d')]()[_0x2957('0x14')](respondWithResult(_0x243cb5,null))[_0x2957('0x25')](handleError(_0x243cb5,null));};exports['getMembers']=function(_0x43a970,_0x2bbc9a){var _0x4b17d1={'raw':!![],'where':{}},_0xedac2b={},_0xf6c63c;return db['ChatQueue'][_0x2957('0x3e')]({'where':{'id':_0x43a970[_0x2957('0x27')]['id']}})['then'](handleEntityNotFound(_0x2bbc9a,null))[_0x2957('0x14')](function(_0x2fbef3){if(_0x2fbef3){_0xf6c63c=_0x2fbef3[_0x2957('0x15')]({'plain':!![]});_0xedac2b[_0x2957('0x28')]=_[_0x2957('0x29')](db[_0x2957('0x3f')][_0x2957('0x20')]);_0xedac2b[_0x2957('0x2a')]=_['keys'](_0x43a970['query']);_0xedac2b[_0x2957('0x2b')]=_[_0x2957('0x2c')](_0xedac2b['model'],_0xedac2b['query']);_0x4b17d1[_0x2957('0x2d')]=_[_0x2957('0x2c')](_0xedac2b[_0x2957('0x28')],qs[_0x2957('0x2e')](_0x43a970[_0x2957('0x2a')][_0x2957('0x2e')]));_0x4b17d1[_0x2957('0x2d')]=_0x4b17d1[_0x2957('0x2d')][_0x2957('0x2f')]?_0x4b17d1[_0x2957('0x2d')]:_0xedac2b[_0x2957('0x28')];if(!_0x43a970[_0x2957('0x2a')][_0x2957('0x40')](_0x2957('0x41'))){_0x4b17d1[_0x2957('0x10')]=qs[_0x2957('0x10')](_0x43a970[_0x2957('0x2a')]['limit']);_0x4b17d1[_0x2957('0xe')]=qs[_0x2957('0xe')](_0x43a970[_0x2957('0x2a')][_0x2957('0xe')]);}_0x4b17d1[_0x2957('0x42')]=qs[_0x2957('0x43')](_0x43a970[_0x2957('0x2a')][_0x2957('0x43')]);_0x4b17d1['where']=qs[_0x2957('0x2b')](_[_0x2957('0x44')](_0x43a970[_0x2957('0x2a')],_0xedac2b[_0x2957('0x2b')]));_0x4b17d1['where'][_0x2957('0x45')]=_0x2fbef3['id'];if(_0x43a970[_0x2957('0x2a')][_0x2957('0x46')]){_0x4b17d1[_0x2957('0x23')]=_[_0x2957('0x31')](_0x4b17d1[_0x2957('0x23')],{'$or':_[_0x2957('0x1e')](_0x4b17d1['attributes'],function(_0x50ffb3){var _0xc9d204={};_0xc9d204[_0x50ffb3]={'$like':'%'+_0x43a970[_0x2957('0x2a')][_0x2957('0x46')]+'%'};return _0xc9d204;})});}_0x4b17d1=_[_0x2957('0x31')]({},_0x4b17d1,_0x43a970[_0x2957('0x47')]);return db['UserChatQueue'][_0x2957('0x48')](_0x4b17d1);}})[_0x2957('0x14')](function(_0x1df0fa){if(_0x1df0fa){return db['User']['findAndCountAll']({'where':{'id':_[_0x2957('0x1e')](_0x1df0fa,_0x2957('0x49')),'role':'agent'},'attributes':['id','name',_0x2957('0x4a'),_0x2957('0x4b'),_0x2957('0x4c')]});}})[_0x2957('0x14')](function(_0x39ae14){if(_0x39ae14){return{'count':_0x39ae14[_0x2957('0x11')],'rows':_[_0x2957('0x1e')](_0x39ae14[_0x2957('0x4d')],function(_0x2c952b){return{'membername':_0x2c952b[_0x2957('0x1b')],'UserId':_0x2c952b['id'],'queue_name':_0xf6c63c[_0x2957('0x1b')],'ChatQueueId':_0xf6c63c['id'],'interface':util[_0x2957('0x4e')]('%s/%s',_0x2957('0x4f'),_0x2c952b[_0x2957('0x1b')]),'penalty':0x0,'paused':_0x2c952b[_0x2957('0x4a')],'createdAt':_0x2c952b[_0x2957('0x4c')],'updatedAt':_0x2c952b[_0x2957('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2bbc9a,_0x4b17d1))['catch'](handleError(_0x2bbc9a,null));};exports[_0x2957('0x50')]=function(_0x47c948,_0x46d500){var _0x161960={};var _0x41ec2e={};var _0x39dd66;var _0x1b727a;return db['ChatQueue'][_0x2957('0x3e')]({'where':{'id':_0x47c948[_0x2957('0x27')]['id']}})[_0x2957('0x14')](handleEntityNotFound(_0x46d500,null))[_0x2957('0x14')](function(_0x68c6a3){if(_0x68c6a3){_0x39dd66=_0x68c6a3;_0x41ec2e[_0x2957('0x28')]=_[_0x2957('0x29')](db['Team'][_0x2957('0x20')]);_0x41ec2e[_0x2957('0x2a')]=_['keys'](_0x47c948['query']);_0x41ec2e[_0x2957('0x2b')]=_[_0x2957('0x2c')](_0x41ec2e['model'],_0x41ec2e[_0x2957('0x2a')]);_0x161960[_0x2957('0x2d')]=_[_0x2957('0x2c')](_0x41ec2e['model'],qs['fields'](_0x47c948[_0x2957('0x2a')][_0x2957('0x2e')]));_0x161960[_0x2957('0x2d')]=_0x161960[_0x2957('0x2d')]['length']?_0x161960[_0x2957('0x2d')]:_0x41ec2e[_0x2957('0x28')];_0x161960[_0x2957('0x42')]=qs[_0x2957('0x43')](_0x47c948[_0x2957('0x2a')][_0x2957('0x43')]);_0x161960[_0x2957('0x23')]=qs[_0x2957('0x2b')](_[_0x2957('0x44')](_0x47c948[_0x2957('0x2a')],_0x41ec2e['filters']));if(_0x47c948[_0x2957('0x2a')][_0x2957('0x46')]){_0x161960['where']=_['merge'](_0x161960['where'],{'$or':_[_0x2957('0x1e')](_0x161960[_0x2957('0x2d')],function(_0x4b715c){var _0x289ad3={};_0x289ad3[_0x4b715c]={'$like':'%'+_0x47c948[_0x2957('0x2a')][_0x2957('0x46')]+'%'};return _0x289ad3;})});}_0x161960=_['merge']({},_0x161960,_0x47c948[_0x2957('0x47')]);return _0x39dd66[_0x2957('0x50')](_0x161960);}})[_0x2957('0x14')](function(_0x4330c9){if(_0x4330c9){_0x1b727a=_0x4330c9[_0x2957('0x2f')];if(!_0x47c948['query'][_0x2957('0x40')](_0x2957('0x41'))){_0x161960[_0x2957('0x10')]=qs[_0x2957('0x10')](_0x47c948[_0x2957('0x2a')][_0x2957('0x10')]);_0x161960[_0x2957('0xe')]=qs[_0x2957('0xe')](_0x47c948[_0x2957('0x2a')][_0x2957('0xe')]);}return _0x39dd66[_0x2957('0x50')](_0x161960);}})[_0x2957('0x14')](function(_0xdf13b1){if(_0xdf13b1){return _0xdf13b1?{'count':_0x1b727a,'rows':_0xdf13b1}:null;}})[_0x2957('0x14')](respondWithResult(_0x46d500,null))[_0x2957('0x25')](handleError(_0x46d500,null));};exports['addTeams']=function(_0x111a57,_0x141898){var _0x58be40=_0x111a57[_0x2957('0x33')][_0x2957('0x51')];return db[_0x2957('0x52')][_0x2957('0x48')]({'where':{'id':_0x58be40},'attributes':['id'],'include':[{'model':db[_0x2957('0x53')],'as':_0x2957('0x54'),'attributes':['id',_0x2957('0x1b'),_0x2957('0x55'),_0x2957('0x56'),_0x2957('0x57')],'raw':!![]}]})[_0x2957('0x14')](function(_0x438b1b){if(_0x438b1b){var _0x362f5b=_[_0x2957('0x58')](_0x438b1b,function(_0xa75c9){var _0x5ebde9=_0xa75c9['get']({'plain':!![]});return _0x5ebde9[_0x2957('0x54')];});return db[_0x2957('0x1f')]['find']({'where':{'id':_0x111a57['params']['id']}})[_0x2957('0x14')](function(_0xdcfd0f){return db[_0x2957('0x59')][_0x2957('0x5a')](function(_0x378a38){return _0xdcfd0f[_0x2957('0x5b')](_0x58be40,{'transaction':_0x378a38})[_0x2957('0x14')](function(){return BPromise['each'](_0x362f5b,function(_0xa4c0ad){return db['UserChatQueue'][_0x2957('0x5c')]({'where':{'UserId':_0xa4c0ad['id'],'ChatQueueId':_0x111a57['params']['id']},'transaction':_0x378a38});});})['then'](function(){_0x362f5b[_0x2957('0x5d')](function(_0x4b7706){socket[_0x2957('0x5e')]('userChatQueue:save',{'UserId':_0x4b7706['id'],'ChatQueueId':_0xdcfd0f['id']});});});});});}})[_0x2957('0x14')](respondWithStatusCode(_0x141898,null))[_0x2957('0x25')](handleError(_0x141898,null));};exports[_0x2957('0x5f')]=function(_0x1e4df9,_0x1b6850){return db[_0x2957('0x52')][_0x2957('0x48')]({'where':{'id':_0x1e4df9['query'][_0x2957('0x51')]},'attributes':['id'],'include':[{'model':db[_0x2957('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2957('0x14')](handleEntityNotFound(_0x1b6850,null))[_0x2957('0x14')](function(_0x153e84){var _0x1e4404=_[_0x2957('0x1e')](_0x153e84,'id');var _0xc80f8d=[];var _0x1a8415=[];var _0x34e74e=squel['select']();_0x34e74e[_0x2957('0x60')](_0x2957('0x61'))[_0x2957('0x62')](_0x2957('0x63'),'tq')[_0x2957('0x64')]('user_has_teams','ut',_0x2957('0x65'))[_0x2957('0x23')](_0x2957('0x66'),_0x1e4df9[_0x2957('0x27')]['id']);for(var _0x287cb6=0x0;_0x287cb6<_0x153e84['length'];_0x287cb6+=0x1){let _0xb4da98=_0x153e84[_0x287cb6];for(var _0x3c21d5=0x0;_0x3c21d5<_0xb4da98[_0x2957('0x54')][_0x2957('0x2f')];_0x3c21d5+=0x1){let _0x39b4c8=_0xb4da98[_0x2957('0x54')][_0x3c21d5];var _0x29cc96=_0x34e74e[_0x2957('0x67')]();_0x29cc96[_0x2957('0x23')](_0x2957('0x68'),_0x39b4c8['id']);_0x1a8415[_0x2957('0x69')](db['sequelize']['query'](_0x29cc96['toString'](),{'type':db[_0x2957('0x59')][_0x2957('0x6a')][_0x2957('0x6b')]})[_0x2957('0x14')](function(_0x547642){if(_0x547642[_0x2957('0x2f')]===0x1){return _0x39b4c8['id'];}else{var _0x181707=_[_0x2957('0x6c')](_['map'](_0x547642,_0x2957('0x6d')),function(_0x5a9f50){return _[_0x2957('0x6e')](_0x1e4404,_0x5a9f50);});if(_0x181707){return _0x39b4c8['id'];}}}));}}return BPromise[_0x2957('0x6f')](_0x1a8415)[_0x2957('0x14')](function(_0x1a77f8){_0xc80f8d=_(_0xc80f8d)[_0x2957('0x70')](_0x1a77f8)[_0x2957('0x71')]()[_0x2957('0x72')]();return db[_0x2957('0x1f')][_0x2957('0x32')]({'where':{'id':_0x1e4df9[_0x2957('0x27')]['id']}})['then'](function(_0x357365){return db[_0x2957('0x59')][_0x2957('0x5a')](function(_0x3264ef){return _0x357365[_0x2957('0x5f')](_0x1e4df9['query'][_0x2957('0x51')],{'transaction':_0x3264ef})[_0x2957('0x14')](function(){if(!_[_0x2957('0x73')](_0xc80f8d)){return _0x357365[_0x2957('0x74')](_0xc80f8d,{'transaction':_0x3264ef});}})[_0x2957('0x14')](function(){_0xc80f8d['forEach'](function(_0x46caae){socket[_0x2957('0x5e')](_0x2957('0x75'),{'UserId':_0x46caae,'ChatQueueId':_0x357365['id']});});});});});});})[_0x2957('0x14')](respondWithStatusCode(_0x1b6850,null))[_0x2957('0x25')](handleError(_0x1b6850,null));};exports['addAgents']=function(_0xec37ad,_0x525959){return db[_0x2957('0x1f')][_0x2957('0x32')]({'where':{'id':_0xec37ad[_0x2957('0x27')]['id']}})[_0x2957('0x14')](handleEntityNotFound(_0x525959,null))[_0x2957('0x14')](function(_0x16459a){if(_0x16459a){return _0x16459a[_0x2957('0x76')](_0xec37ad['body'][_0x2957('0x51')],_[_0x2957('0x77')](_0xec37ad['body'],[_0x2957('0x51'),'id'])||{})[_0x2957('0x78')](function(_0x2f6f27){for(var _0x50f3be=0x0;_0x50f3be<_0xec37ad['body'][_0x2957('0x51')][_0x2957('0x2f')];_0x50f3be+=0x1){socket['emit'](_0x2957('0x79'),{'UserId':Number(_0xec37ad['body']['ids'][_0x50f3be]),'ChatQueueId':Number(_0xec37ad[_0x2957('0x27')]['id'])});}return _0x2f6f27;});}})[_0x2957('0x14')](respondWithResult(_0x525959,null))['catch'](handleError(_0x525959,null));};exports[_0x2957('0x74')]=function(_0x5244c3,_0x5bb60f){return db[_0x2957('0x1f')][_0x2957('0x32')]({'where':{'id':_0x5244c3['params']['id']}})[_0x2957('0x14')](handleEntityNotFound(_0x5bb60f,null))[_0x2957('0x14')](function(_0x2dcf76){if(_0x2dcf76){return _0x2dcf76[_0x2957('0x74')](_0x5244c3['query'][_0x2957('0x51')])[_0x2957('0x14')](function(){if(_[_0x2957('0x7a')](_0x5244c3['query'][_0x2957('0x51')])){for(var _0x287ee8=0x0;_0x287ee8<_0x5244c3[_0x2957('0x2a')][_0x2957('0x51')][_0x2957('0x2f')];_0x287ee8+=0x1){socket[_0x2957('0x5e')](_0x2957('0x75'),{'UserId':Number(_0x5244c3['query'][_0x2957('0x51')][_0x287ee8]),'ChatQueueId':Number(_0x5244c3[_0x2957('0x27')]['id'])});}}else{socket[_0x2957('0x5e')](_0x2957('0x75'),{'UserId':Number(_0x5244c3[_0x2957('0x2a')]['ids']),'ChatQueueId':Number(_0x5244c3[_0x2957('0x27')]['id'])});}});}})[_0x2957('0x14')](respondWithStatusCode(_0x5bb60f,null))[_0x2957('0x25')](handleError(_0x5bb60f,null));};exports['getAgents']=function(_0x52d87f,_0x267bc5){var _0xb75c3c={};var _0x3c0cbd={};var _0x411e98;var _0x6e9c27;return db[_0x2957('0x1f')][_0x2957('0x3e')]({'where':{'id':_0x52d87f[_0x2957('0x27')]['id']}})[_0x2957('0x14')](handleEntityNotFound(_0x267bc5,null))[_0x2957('0x14')](function(_0x22ac86){if(_0x22ac86){_0x411e98=_0x22ac86;_0x3c0cbd[_0x2957('0x28')]=_[_0x2957('0x29')](db[_0x2957('0x53')]['rawAttributes']);_0x3c0cbd[_0x2957('0x2a')]=_[_0x2957('0x29')](_0x52d87f[_0x2957('0x2a')]);_0x3c0cbd[_0x2957('0x2b')]=_['intersection'](_0x3c0cbd[_0x2957('0x28')],_0x3c0cbd['query']);_0xb75c3c[_0x2957('0x2d')]=_['intersection'](_0x3c0cbd[_0x2957('0x28')],qs[_0x2957('0x2e')](_0x52d87f[_0x2957('0x2a')]['fields']));_0xb75c3c[_0x2957('0x2d')]=_0xb75c3c[_0x2957('0x2d')][_0x2957('0x2f')]?_0xb75c3c['attributes']:_0x3c0cbd[_0x2957('0x28')];_0xb75c3c[_0x2957('0x42')]=qs['sort'](_0x52d87f['query']['sort']);_0xb75c3c[_0x2957('0x23')]=qs[_0x2957('0x2b')](_[_0x2957('0x44')](_0x52d87f[_0x2957('0x2a')],_0x3c0cbd[_0x2957('0x2b')]));if(_0x52d87f[_0x2957('0x2a')][_0x2957('0x46')]){_0xb75c3c[_0x2957('0x23')]=_[_0x2957('0x31')](_0xb75c3c[_0x2957('0x23')],{'$or':_[_0x2957('0x1e')](_0xb75c3c[_0x2957('0x2d')],function(_0x4e36a2){var _0x21edf6={};_0x21edf6[_0x4e36a2]={'$like':'%'+_0x52d87f[_0x2957('0x2a')]['filter']+'%'};return _0x21edf6;})});}_0xb75c3c=_['merge']({},_0xb75c3c,_0x52d87f[_0x2957('0x47')]);return _0x411e98['getAgents'](_0xb75c3c);}})[_0x2957('0x14')](function(_0x371554){if(_0x371554){_0x6e9c27=_0x371554[_0x2957('0x2f')];if(!_0x52d87f[_0x2957('0x2a')][_0x2957('0x40')](_0x2957('0x41'))){_0xb75c3c[_0x2957('0x10')]=qs['limit'](_0x52d87f[_0x2957('0x2a')]['limit']);_0xb75c3c[_0x2957('0xe')]=qs[_0x2957('0xe')](_0x52d87f[_0x2957('0x2a')][_0x2957('0xe')]);}return _0x411e98[_0x2957('0x7b')](_0xb75c3c);}})['then'](function(_0x3c4696){if(_0x3c4696){return _0x3c4696?{'count':_0x6e9c27,'rows':_0x3c4696}:null;}})[_0x2957('0x14')](respondWithResult(_0x267bc5,null))['catch'](handleError(_0x267bc5,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index f2aaf39..e33e266 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 _0x6057=['emit','hasOwnProperty','events','../../mysqldb','update','remove'];(function(_0x471969,_0x3397bc){var _0x3ee654=function(_0x147130){while(--_0x147130){_0x471969['push'](_0x471969['shift']());}};_0x3ee654(++_0x3397bc);}(_0x6057,0x8c));var _0x7605=function(_0xf0bc07,_0x510ebf){_0xf0bc07=_0xf0bc07-0x0;var _0x1c50c2=_0x6057[_0xf0bc07];return _0x1c50c2;};'use strict';var EventEmitter=require(_0x7605('0x0'));var ChatQueue=require(_0x7605('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x7605('0x2'),'afterDestroy':_0x7605('0x3')};function emitEvent(_0x75d1d9){return function(_0x1425ff,_0x222bc7,_0x406c25){ChatQueueEvents[_0x7605('0x4')](_0x75d1d9+':'+_0x1425ff['id'],_0x1425ff);ChatQueueEvents['emit'](_0x75d1d9,_0x1425ff);_0x406c25(null);};}for(var e in events){if(events[_0x7605('0x5')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x03af=['events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5dd2ac,_0x425ec3){var _0x5e7b59=function(_0x84f04a){while(--_0x84f04a){_0x5dd2ac['push'](_0x5dd2ac['shift']());}};_0x5e7b59(++_0x425ec3);}(_0x03af,0xaf));var _0xf03a=function(_0x4a4ef3,_0xde0dc3){_0x4a4ef3=_0x4a4ef3-0x0;var _0x5908ed=_0x03af[_0x4a4ef3];return _0x5908ed;};'use strict';var EventEmitter=require(_0xf03a('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf03a('0x1')](0x0);var events={'afterCreate':_0xf03a('0x2'),'afterUpdate':_0xf03a('0x3'),'afterDestroy':_0xf03a('0x4')};function emitEvent(_0x36ddc6){return function(_0x48b0aa,_0x1cb068,_0x188ceb){ChatQueueEvents[_0xf03a('0x5')](_0x36ddc6+':'+_0x48b0aa['id'],_0x48b0aa);ChatQueueEvents[_0xf03a('0x5')](_0x36ddc6,_0x48b0aa);_0x188ceb(null);};}for(var e in events){if(events[_0xf03a('0x6')](e)){var event=events[e];ChatQueue['hook'](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 1fd3d16..24a444b 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 _0x7ca0=['moment','bluebird','request-promise','path','exports','lodash','../../config/logger'];(function(_0x5c5b4d,_0x3b4781){var _0x448a9e=function(_0x44710f){while(--_0x44710f){_0x5c5b4d['push'](_0x5c5b4d['shift']());}};_0x448a9e(++_0x3b4781);}(_0x7ca0,0x1cc));var _0x07ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7ca0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x07ca('0x0'));var util=require('util');var logger=require(_0x07ca('0x1'))('api');var moment=require(_0x07ca('0x2'));var BPromise=require(_0x07ca('0x3'));var rp=require(_0x07ca('0x4'));var fs=require('fs');var path=require(_0x07ca('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatQueue.attributes');module[_0x07ca('0x6')]=function(_0x3bf799,_0x129ba1){return _0x3bf799['define']('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa953=['lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatQueue.attributes','define','chat_queues'];(function(_0xcb249e,_0x6ea51f){var _0x4b09ea=function(_0x1b6007){while(--_0x1b6007){_0xcb249e['push'](_0xcb249e['shift']());}};_0x4b09ea(++_0x6ea51f);}(_0xa953,0x10e));var _0x3a95=function(_0x1b591b,_0x6d2e2b){_0x1b591b=_0x1b591b-0x0;var _0x3c24f0=_0xa953[_0x1b591b];return _0x3c24f0;};'use strict';var _=require(_0x3a95('0x0'));var util=require('util');var logger=require(_0x3a95('0x1'))(_0x3a95('0x2'));var moment=require('moment');var BPromise=require(_0x3a95('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3a95('0x4'));var rimraf=require(_0x3a95('0x5'));var config=require(_0x3a95('0x6'));var attributes=require(_0x3a95('0x7'));module['exports']=function(_0x78f6c1,_0x122292){return _0x78f6c1[_0x3a95('0x8')]('ChatQueue',attributes,{'tableName':_0x3a95('0x9'),'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 c671035..f27488c 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 _0xbdbe=['model','attributes','raw','ShowChatQueue','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ChatQueue,\x20%s,\x20%s','message','result','GetChatQueue','findAll','options','where','limit','include','map'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0xbdbe,0x1f3));var _0xebdb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbdbe[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xebdb('0x0'));var util=require('util');var moment=require(_0xebdb('0x1'));var BPromise=require('bluebird');var rs=require(_0xebdb('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebdb('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xebdb('0x4'))('rpc');var config=require(_0xebdb('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xebdb('0x6')][_0xebdb('0x7')]({'port':0x232a});config[_0xebdb('0x8')]=_[_0xebdb('0x9')](config[_0xebdb('0x8')],{'host':_0xebdb('0xa'),'port':0x18eb});var socket=require(_0xebdb('0xb'))(new Redis(config[_0xebdb('0x8')]));require(_0xebdb('0xc'))[_0xebdb('0xd')](socket);function respondWithRpcPromise(_0x3b2730,_0x54a360,_0xcdbd2d){return new BPromise(function(_0x1622d5,_0x557d85){return client[_0xebdb('0xe')](_0x3b2730,_0xcdbd2d)[_0xebdb('0xf')](function(_0x2379d3){logger[_0xebdb('0x10')]('ChatQueue,\x20%s,\x20%s',_0x54a360,'request\x20sent');logger[_0xebdb('0x11')](_0xebdb('0x12'),_0x54a360,_0xebdb('0x13'),JSON[_0xebdb('0x14')](_0x2379d3));if(_0x2379d3['error']){if(_0x2379d3[_0xebdb('0x15')][_0xebdb('0x16')]===0x1f4){logger[_0xebdb('0x15')](_0xebdb('0x17'),_0x54a360,_0x2379d3[_0xebdb('0x15')][_0xebdb('0x18')]);return _0x557d85(_0x2379d3[_0xebdb('0x15')][_0xebdb('0x18')]);}logger[_0xebdb('0x15')](_0xebdb('0x17'),_0x54a360,_0x2379d3['error'][_0xebdb('0x18')]);return _0x1622d5(_0x2379d3['error']['message']);}else{logger[_0xebdb('0x10')](_0xebdb('0x17'),_0x54a360,'request\x20sent');_0x1622d5(_0x2379d3[_0xebdb('0x19')][_0xebdb('0x18')]);}})['catch'](function(_0x2de2f5){logger['error']('ChatQueue,\x20%s,\x20%s',_0x54a360,_0x2de2f5);_0x557d85(_0x2de2f5);});});}exports[_0xebdb('0x1a')]=function(_0x253c65){var _0x28e85b=this;return new Promise(function(_0x5c76cc,_0x38a4dd){return db['ChatQueue'][_0xebdb('0x1b')]({'raw':_0x253c65[_0xebdb('0x1c')]?_0x253c65['options']['raw']===undefined?!![]:![]:!![],'where':_0x253c65[_0xebdb('0x1c')]?_0x253c65['options'][_0xebdb('0x1d')]||null:null,'attributes':_0x253c65[_0xebdb('0x1c')]?_0x253c65[_0xebdb('0x1c')]['attributes']||null:null,'limit':_0x253c65['options']?_0x253c65[_0xebdb('0x1c')][_0xebdb('0x1e')]||null:null,'include':_0x253c65[_0xebdb('0x1c')]?_0x253c65[_0xebdb('0x1c')][_0xebdb('0x1f')]?_[_0xebdb('0x20')](_0x253c65[_0xebdb('0x1c')][_0xebdb('0x1f')],function(_0x5b721f){return{'model':db[_0x5b721f[_0xebdb('0x21')]],'as':_0x5b721f['as'],'attributes':_0x5b721f[_0xebdb('0x22')],'include':_0x5b721f[_0xebdb('0x1f')]?_['map'](_0x5b721f[_0xebdb('0x1f')],function(_0x59d9f7){return{'model':db[_0x59d9f7[_0xebdb('0x21')]],'as':_0x59d9f7['as'],'attributes':_0x59d9f7[_0xebdb('0x22')],'include':_0x59d9f7['include']?_[_0xebdb('0x20')](_0x59d9f7['include'],function(_0x497642){return{'model':db[_0x497642[_0xebdb('0x21')]],'as':_0x497642['as'],'attributes':_0x497642[_0xebdb('0x22')]};}):[]};}):[]};}):[]:[]})[_0xebdb('0xf')](function(_0x5136f2){logger[_0xebdb('0x10')](_0xebdb('0x1a'),_0x253c65);logger[_0xebdb('0x11')](_0xebdb('0x1a'),_0x253c65,JSON[_0xebdb('0x14')](_0x5136f2));_0x5c76cc(_0x5136f2);})['catch'](function(_0x538920){logger[_0xebdb('0x15')](_0xebdb('0x1a'),_0x538920['message'],_0x253c65);_0x38a4dd(_0x28e85b['error'](0x1f4,_0x538920['message']));});});};exports['ShowChatQueue']=function(_0x2ba46e){var _0x5f578a=this;return new Promise(function(_0x38637c,_0xd1843){return db['ChatQueue']['find']({'raw':_0x2ba46e[_0xebdb('0x1c')]?_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x23')]===undefined?!![]:![]:!![],'where':_0x2ba46e['options']?_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x1d')]||null:null,'attributes':_0x2ba46e[_0xebdb('0x1c')]?_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x22')]||null:null,'include':_0x2ba46e[_0xebdb('0x1c')]?_0x2ba46e['options'][_0xebdb('0x1f')]?_[_0xebdb('0x20')](_0x2ba46e[_0xebdb('0x1c')][_0xebdb('0x1f')],function(_0x3dc8d3){return{'model':db[_0x3dc8d3[_0xebdb('0x21')]],'as':_0x3dc8d3['as'],'attributes':_0x3dc8d3[_0xebdb('0x22')],'include':_0x3dc8d3[_0xebdb('0x1f')]?_[_0xebdb('0x20')](_0x3dc8d3['include'],function(_0x4fb00a){return{'model':db[_0x4fb00a['model']],'as':_0x4fb00a['as'],'attributes':_0x4fb00a[_0xebdb('0x22')],'include':_0x4fb00a[_0xebdb('0x1f')]?_['map'](_0x4fb00a[_0xebdb('0x1f')],function(_0x31fb4c){return{'model':db[_0x31fb4c['model']],'as':_0x31fb4c['as'],'attributes':_0x31fb4c[_0xebdb('0x22')]};}):[]};}):[]};}):[]:[]})[_0xebdb('0xf')](function(_0x4dd3c2){logger['info'](_0xebdb('0x24'),_0x2ba46e);logger[_0xebdb('0x11')](_0xebdb('0x24'),_0x2ba46e,JSON['stringify'](_0x4dd3c2));_0x38637c(_0x4dd3c2);})[_0xebdb('0x25')](function(_0x123644){logger[_0xebdb('0x15')](_0xebdb('0x24'),_0x123644[_0xebdb('0x18')],_0x2ba46e);_0xd1843(_0x5f578a[_0xebdb('0x15')](0x1f4,_0x123644[_0xebdb('0x18')]));});});}; \ No newline at end of file +var _0x29c4=['request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','findAll','options','raw','where','attributes','limit','include','map','debug','catch','find','model','ShowChatQueue','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x29c4,0x155));var _0x429c=function(_0x40033f,_0x5633ff){_0x40033f=_0x40033f-0x0;var _0x3b301f=_0x29c4[_0x40033f];return _0x3b301f;};'use strict';var _=require(_0x429c('0x0'));var util=require('util');var moment=require(_0x429c('0x1'));var BPromise=require('bluebird');var rs=require(_0x429c('0x2'));var fs=require('fs');var Redis=require(_0x429c('0x3'));var db=require(_0x429c('0x4'))['db'];var utils=require(_0x429c('0x5'));var logger=require(_0x429c('0x6'))('rpc');var config=require(_0x429c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x429c('0x8')][_0x429c('0x9')]({'port':0x232a});config[_0x429c('0xa')]=_[_0x429c('0xb')](config['redis'],{'host':_0x429c('0xc'),'port':0x18eb});var socket=require(_0x429c('0xd'))(new Redis(config['redis']));require(_0x429c('0xe'))[_0x429c('0xf')](socket);function respondWithRpcPromise(_0xc66556,_0x1634d5,_0x2ad2f2){return new BPromise(function(_0x1f2ee0,_0x272a6a){return client['request'](_0xc66556,_0x2ad2f2)[_0x429c('0x10')](function(_0xc8f7d7){logger[_0x429c('0x11')](_0x429c('0x12'),_0x1634d5,_0x429c('0x13'));logger['debug'](_0x429c('0x14'),_0x1634d5,'request\x20sent',JSON[_0x429c('0x15')](_0xc8f7d7));if(_0xc8f7d7[_0x429c('0x16')]){if(_0xc8f7d7[_0x429c('0x16')][_0x429c('0x17')]===0x1f4){logger[_0x429c('0x16')]('ChatQueue,\x20%s,\x20%s',_0x1634d5,_0xc8f7d7[_0x429c('0x16')][_0x429c('0x18')]);return _0x272a6a(_0xc8f7d7['error'][_0x429c('0x18')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x1634d5,_0xc8f7d7[_0x429c('0x16')][_0x429c('0x18')]);return _0x1f2ee0(_0xc8f7d7[_0x429c('0x16')][_0x429c('0x18')]);}else{logger['info'](_0x429c('0x12'),_0x1634d5,_0x429c('0x13'));_0x1f2ee0(_0xc8f7d7[_0x429c('0x19')][_0x429c('0x18')]);}})['catch'](function(_0x27a61c){logger[_0x429c('0x16')](_0x429c('0x12'),_0x1634d5,_0x27a61c);_0x272a6a(_0x27a61c);});});}exports[_0x429c('0x1a')]=function(_0x10ebb8){var _0x51b75a=this;return new Promise(function(_0xe7774a,_0x5029f7){return db['ChatQueue'][_0x429c('0x1b')]({'raw':_0x10ebb8[_0x429c('0x1c')]?_0x10ebb8[_0x429c('0x1c')][_0x429c('0x1d')]===undefined?!![]:![]:!![],'where':_0x10ebb8['options']?_0x10ebb8[_0x429c('0x1c')][_0x429c('0x1e')]||null:null,'attributes':_0x10ebb8['options']?_0x10ebb8['options'][_0x429c('0x1f')]||null:null,'limit':_0x10ebb8[_0x429c('0x1c')]?_0x10ebb8[_0x429c('0x1c')][_0x429c('0x20')]||null:null,'include':_0x10ebb8[_0x429c('0x1c')]?_0x10ebb8[_0x429c('0x1c')][_0x429c('0x21')]?_[_0x429c('0x22')](_0x10ebb8['options'][_0x429c('0x21')],function(_0x30aa64){return{'model':db[_0x30aa64['model']],'as':_0x30aa64['as'],'attributes':_0x30aa64[_0x429c('0x1f')],'include':_0x30aa64[_0x429c('0x21')]?_['map'](_0x30aa64['include'],function(_0x463b01){return{'model':db[_0x463b01['model']],'as':_0x463b01['as'],'attributes':_0x463b01[_0x429c('0x1f')],'include':_0x463b01[_0x429c('0x21')]?_[_0x429c('0x22')](_0x463b01[_0x429c('0x21')],function(_0x5ef906){return{'model':db[_0x5ef906['model']],'as':_0x5ef906['as'],'attributes':_0x5ef906['attributes']};}):[]};}):[]};}):[]:[]})[_0x429c('0x10')](function(_0x542ebc){logger[_0x429c('0x11')](_0x429c('0x1a'),_0x10ebb8);logger[_0x429c('0x23')]('GetChatQueue',_0x10ebb8,JSON[_0x429c('0x15')](_0x542ebc));_0xe7774a(_0x542ebc);})[_0x429c('0x24')](function(_0x455cd2){logger['error']('GetChatQueue',_0x455cd2[_0x429c('0x18')],_0x10ebb8);_0x5029f7(_0x51b75a['error'](0x1f4,_0x455cd2[_0x429c('0x18')]));});});};exports['ShowChatQueue']=function(_0x58d665){var _0x52d1ac=this;return new Promise(function(_0x51f57e,_0x42abb4){return db['ChatQueue'][_0x429c('0x25')]({'raw':_0x58d665[_0x429c('0x1c')]?_0x58d665['options'][_0x429c('0x1d')]===undefined?!![]:![]:!![],'where':_0x58d665['options']?_0x58d665['options'][_0x429c('0x1e')]||null:null,'attributes':_0x58d665[_0x429c('0x1c')]?_0x58d665[_0x429c('0x1c')]['attributes']||null:null,'include':_0x58d665[_0x429c('0x1c')]?_0x58d665['options'][_0x429c('0x21')]?_[_0x429c('0x22')](_0x58d665[_0x429c('0x1c')]['include'],function(_0x284275){return{'model':db[_0x284275[_0x429c('0x26')]],'as':_0x284275['as'],'attributes':_0x284275[_0x429c('0x1f')],'include':_0x284275['include']?_[_0x429c('0x22')](_0x284275[_0x429c('0x21')],function(_0x4e14d5){return{'model':db[_0x4e14d5[_0x429c('0x26')]],'as':_0x4e14d5['as'],'attributes':_0x4e14d5[_0x429c('0x1f')],'include':_0x4e14d5[_0x429c('0x21')]?_['map'](_0x4e14d5['include'],function(_0x4623ce){return{'model':db[_0x4623ce[_0x429c('0x26')]],'as':_0x4623ce['as'],'attributes':_0x4623ce[_0x429c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x429c('0x10')](function(_0x335b65){logger['info'](_0x429c('0x27'),_0x58d665);logger['debug'](_0x429c('0x27'),_0x58d665,JSON['stringify'](_0x335b65));_0x51f57e(_0x335b65);})[_0x429c('0x24')](function(_0x4a3bdb){logger['error'](_0x429c('0x27'),_0x4a3bdb[_0x429c('0x18')],_0x58d665);_0x42abb4(_0x52d1ac['error'](0x1f4,_0x4a3bdb[_0x429c('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index fbaae46..60c6441 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 _0x6f0d=['update','emit','removeListener','length','save','remove'];(function(_0x70a8a5,_0x35a384){var _0x2b563b=function(_0x4bbb5b){while(--_0x4bbb5b){_0x70a8a5['push'](_0x70a8a5['shift']());}};_0x2b563b(++_0x35a384);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x2e9f87,_0x246ba8){_0x2e9f87=_0x2e9f87-0x0;var _0x43eb1c=_0x6f0d[_0x2e9f87];return _0x43eb1c;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0xd6f0('0x0'),_0xd6f0('0x1'),_0xd6f0('0x2')];function createListener(_0x107a8c,_0x573473){return function(_0x275230){_0x573473[_0xd6f0('0x3')](_0x107a8c,_0x275230);};}function removeListener(_0x2f78fb,_0x25344b){return function(){ChatQueueEvents[_0xd6f0('0x4')](_0x2f78fb,_0x25344b);};}exports['register']=function(_0x2d2ce6){for(var _0x4a8b0c=0x0,_0xe21ac4=events[_0xd6f0('0x5')];_0x4a8b0c<_0xe21ac4;_0x4a8b0c++){var _0x8b89a9=events[_0x4a8b0c];var _0x1a48a0=createListener('chatQueue:'+_0x8b89a9,_0x2d2ce6);ChatQueueEvents['on'](_0x8b89a9,_0x1a48a0);}}; \ No newline at end of file +var _0x303a=['removeListener','register','length','./chatQueue.events','remove','update','emit'];(function(_0x447288,_0xd40fa7){var _0x594ef5=function(_0x5bc8f3){while(--_0x5bc8f3){_0x447288['push'](_0x447288['shift']());}};_0x594ef5(++_0xd40fa7);}(_0x303a,0x1a0));var _0xa303=function(_0x5ad3cb,_0x4ff404){_0x5ad3cb=_0x5ad3cb-0x0;var _0xbea1e2=_0x303a[_0x5ad3cb];return _0xbea1e2;};'use strict';var ChatQueueEvents=require(_0xa303('0x0'));var events=['save',_0xa303('0x1'),_0xa303('0x2')];function createListener(_0x36e548,_0x19d27a){return function(_0x594b49){_0x19d27a[_0xa303('0x3')](_0x36e548,_0x594b49);};}function removeListener(_0x26b47c,_0x38a354){return function(){ChatQueueEvents[_0xa303('0x4')](_0x26b47c,_0x38a354);};}exports[_0xa303('0x5')]=function(_0x1c7ee9){for(var _0x2bc3d7=0x0,_0x3f61f1=events[_0xa303('0x6')];_0x2bc3d7<_0x3f61f1;_0x2bc3d7++){var _0x5d95fd=events[_0x2bc3d7];var _0x51e1ee=createListener('chatQueue:'+_0x5d95fd,_0x1c7ee9);ChatQueueEvents['on'](_0x5d95fd,_0x51e1ee);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1864af2..38c2e94 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 _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(_0x5cae73,_0x7deb8f){var _0x2722ce=function(_0x702135){while(--_0x702135){_0x5cae73['push'](_0x5cae73['shift']());}};_0x2722ce(++_0x7deb8f);}(_0x55ca,0x126));var _0xa55c=function(_0x143a91,_0x235332){_0x143a91=_0x143a91-0x0;var _0x1906f5=_0x55ca[_0x143a91];return _0x1906f5;};'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 +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(_0x3dc948,_0x5568f8){var _0x1ca1cf=function(_0xe3d57a){while(--_0xe3d57a){_0x3dc948['push'](_0x3dc948['shift']());}};_0x1ca1cf(++_0x5568f8);}(_0x55ca,0x126));var _0xa55c=function(_0x2f35a2,_0x9c1ac){_0x2f35a2=_0x2f35a2-0x0;var _0x503004=_0x55ca[_0x2f35a2];return _0x503004;};'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 518246e..903e7dd 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 _0xea3a=['sequelize','exports','STRING','DATE','moment'];(function(_0x35df37,_0x927820){var _0x30f707=function(_0x1b0475){while(--_0x1b0475){_0x35df37['push'](_0x35df37['shift']());}};_0x30f707(++_0x927820);}(_0xea3a,0x13f));var _0xaea3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xea3a[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xaea3('0x0'));var Sequelize=require(_0xaea3('0x1'));module[_0xaea3('0x2')]={'uniqueid':{'type':Sequelize[_0xaea3('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaea3('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xaea3('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xaea3('0x3')]}}; \ No newline at end of file +var _0xbd76=['DATE','moment','sequelize','exports','STRING'];(function(_0x5c6548,_0x3b46bb){var _0x15eceb=function(_0x2b076e){while(--_0x2b076e){_0x5c6548['push'](_0x5c6548['shift']());}};_0x15eceb(++_0x3b46bb);}(_0xbd76,0x105));var _0x6bd7=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0xbd76[_0x278e3c];return _0x3e2d9b;};'use strict';var moment=require(_0x6bd7('0x0'));var Sequelize=require(_0x6bd7('0x1'));module[_0x6bd7('0x2')]={'uniqueid':{'type':Sequelize[_0x6bd7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x6bd7('0x3')]},'joinAt':{'type':Sequelize[_0x6bd7('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x6bd7('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index b8b12f8..78a86d3 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 _0x9d56=['end','offset','limit','undefined','count','set','Content-Range','json','apply','save','update','then','destroy','sendStatus','error','name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','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','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status'];(function(_0x2578d1,_0x2990b6){var _0x2567da=function(_0x5be91b){while(--_0x5be91b){_0x2578d1['push'](_0x2578d1['shift']());}};_0x2567da(++_0x2990b6);}(_0x9d56,0x122));var _0x69d5=function(_0x21105e,_0x4a91a7){_0x21105e=_0x21105e-0x0;var _0x15988c=_0x9d56[_0x21105e];return _0x15988c;};'use strict';var emlformat=require(_0x69d5('0x0'));var rimraf=require(_0x69d5('0x1'));var zipdir=require(_0x69d5('0x2'));var jsonpatch=require(_0x69d5('0x3'));var rp=require('request-promise');var moment=require(_0x69d5('0x4'));var BPromise=require(_0x69d5('0x5'));var Mustache=require(_0x69d5('0x6'));var util=require(_0x69d5('0x7'));var path=require(_0x69d5('0x8'));var sox=require('sox');var csv=require(_0x69d5('0x9'));var ejs=require(_0x69d5('0xa'));var fs=require('fs');var fs_extra=require(_0x69d5('0xb'));var _=require(_0x69d5('0xc'));var squel=require(_0x69d5('0xd'));var crypto=require(_0x69d5('0xe'));var jsforce=require(_0x69d5('0xf'));var deskjs=require(_0x69d5('0x10'));var toCsv=require(_0x69d5('0x9'));var querystring=require(_0x69d5('0x11'));var Papa=require(_0x69d5('0x12'));var Redis=require(_0x69d5('0x13'));var authService=require(_0x69d5('0x14'));var qs=require(_0x69d5('0x15'));var as=require(_0x69d5('0x16'));var hardwareService=require(_0x69d5('0x17'));var logger=require(_0x69d5('0x18'))(_0x69d5('0x19'));var utils=require(_0x69d5('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0x69d5('0x1b'));var db=require(_0x69d5('0x1c'))['db'];function respondWithStatusCode(_0x2cc733,_0x4641a7){_0x4641a7=_0x4641a7||0xcc;return function(_0x1c34d9){if(_0x1c34d9){return _0x2cc733['sendStatus'](_0x4641a7);}return _0x2cc733[_0x69d5('0x1d')](_0x4641a7)[_0x69d5('0x1e')]();};}function respondWithResult(_0x263954,_0x134e84){_0x134e84=_0x134e84||0xc8;return function(_0x56843c){if(_0x56843c){return _0x263954['status'](_0x134e84)['json'](_0x56843c);}};}function respondWithFilteredResult(_0x279ce5,_0x33cf2e){return function(_0x56bbbc){if(_0x56bbbc){var _0x28492b=typeof _0x33cf2e[_0x69d5('0x1f')]==='undefined'&&typeof _0x33cf2e[_0x69d5('0x20')]===_0x69d5('0x21');var _0x304417=_0x56bbbc[_0x69d5('0x22')];var _0x16e628=_0x28492b?0x0:_0x33cf2e[_0x69d5('0x1f')];var _0x6763ac=_0x28492b?_0x56bbbc[_0x69d5('0x22')]:_0x33cf2e['offset']+_0x33cf2e[_0x69d5('0x20')];var _0x16c02c;if(_0x6763ac>=_0x304417){_0x6763ac=_0x304417;_0x16c02c=0xc8;}else{_0x16c02c=0xce;}_0x279ce5[_0x69d5('0x1d')](_0x16c02c);return _0x279ce5[_0x69d5('0x23')](_0x69d5('0x24'),_0x16e628+'-'+_0x6763ac+'/'+_0x304417)[_0x69d5('0x25')](_0x56bbbc);}return null;};}function patchUpdates(_0x1f9ed7){return function(_0xc557e3){try{jsonpatch[_0x69d5('0x26')](_0xc557e3,_0x1f9ed7,!![]);}catch(_0x497c1a){return BPromise['reject'](_0x497c1a);}return _0xc557e3[_0x69d5('0x27')]();};}function saveUpdates(_0x3fc1a4,_0xa81fe0){return function(_0x1558b6){if(_0x1558b6){return _0x1558b6[_0x69d5('0x28')](_0x3fc1a4)[_0x69d5('0x29')](function(_0x1ec0d3){return _0x1ec0d3;});}return null;};}function removeEntity(_0x22e984,_0x23ee57){return function(_0x49b3f5){if(_0x49b3f5){return _0x49b3f5[_0x69d5('0x2a')]()[_0x69d5('0x29')](function(){_0x22e984[_0x69d5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2e1d8d,_0x53ea6e){return function(_0x5e27e7){if(!_0x5e27e7){_0x2e1d8d[_0x69d5('0x2b')](0x194);}return _0x5e27e7;};}function handleError(_0x49b94f,_0x27ffd8){_0x27ffd8=_0x27ffd8||0x1f4;return function(_0x7636f2){logger[_0x69d5('0x2c')](_0x7636f2['stack']);if(_0x7636f2[_0x69d5('0x2d')]){delete _0x7636f2[_0x69d5('0x2d')];}_0x49b94f[_0x69d5('0x1d')](_0x27ffd8)['send'](_0x7636f2);};}exports['index']=function(_0x3f0ced,_0x41173f){var _0x2892a6={},_0x4d8fb={},_0xf4edd9={'count':0x0,'rows':[]};var _0x4d961f=_[_0x69d5('0x2e')](db[_0x69d5('0x2f')][_0x69d5('0x30')],function(_0x252f43){return{'name':_0x252f43[_0x69d5('0x31')],'type':_0x252f43[_0x69d5('0x32')][_0x69d5('0x33')]};});_0x4d8fb[_0x69d5('0x34')]=_['map'](_0x4d961f,_0x69d5('0x2d'));_0x4d8fb[_0x69d5('0x35')]=_['keys'](_0x3f0ced[_0x69d5('0x35')]);_0x4d8fb['filters']=_[_0x69d5('0x36')](_0x4d8fb[_0x69d5('0x34')],_0x4d8fb[_0x69d5('0x35')]);_0x2892a6['attributes']=_[_0x69d5('0x36')](_0x4d8fb[_0x69d5('0x34')],qs['fields'](_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x37')]));_0x2892a6[_0x69d5('0x38')]=_0x2892a6['attributes'][_0x69d5('0x39')]?_0x2892a6[_0x69d5('0x38')]:_0x4d8fb[_0x69d5('0x34')];if(!_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x3a')](_0x69d5('0x3b'))){_0x2892a6[_0x69d5('0x20')]=qs[_0x69d5('0x20')](_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x20')]);_0x2892a6[_0x69d5('0x1f')]=qs[_0x69d5('0x1f')](_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x1f')]);}_0x2892a6[_0x69d5('0x3c')]=qs[_0x69d5('0x3d')](_0x3f0ced[_0x69d5('0x35')]['sort']);_0x2892a6[_0x69d5('0x3e')]=qs[_0x69d5('0x3f')](_[_0x69d5('0x40')](_0x3f0ced['query'],_0x4d8fb[_0x69d5('0x3f')]),_0x4d961f);if(_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x41')]){_0x2892a6['where']=_[_0x69d5('0x42')](_0x2892a6['where'],{'$or':_[_0x69d5('0x2e')](_0x4d961f,function(_0x1ae187){if(_0x1ae187[_0x69d5('0x32')]!=='VIRTUAL'){var _0x45ca18={};_0x45ca18[_0x1ae187[_0x69d5('0x2d')]]={'$like':'%'+_0x3f0ced[_0x69d5('0x35')][_0x69d5('0x41')]+'%'};return _0x45ca18;}})});}_0x2892a6=_['merge']({},_0x2892a6,_0x3f0ced[_0x69d5('0x43')]);var _0x661bca={'where':_0x2892a6[_0x69d5('0x3e')]};return db[_0x69d5('0x2f')][_0x69d5('0x22')](_0x661bca)[_0x69d5('0x29')](function(_0x51a8f1){_0xf4edd9[_0x69d5('0x22')]=_0x51a8f1;if(_0x3f0ced['query']['includeAll']){_0x2892a6[_0x69d5('0x44')]=[{'all':!![]}];}return db[_0x69d5('0x2f')][_0x69d5('0x45')](_0x2892a6);})[_0x69d5('0x29')](function(_0xa93202){_0xf4edd9[_0x69d5('0x46')]=_0xa93202;return _0xf4edd9;})[_0x69d5('0x29')](respondWithFilteredResult(_0x41173f,_0x2892a6))[_0x69d5('0x47')](handleError(_0x41173f,null));};exports[_0x69d5('0x48')]=function(_0x23527b,_0x13075d){var _0x5d2ba2={'raw':!![],'where':{'id':_0x23527b['params']['id']}},_0x4cf243={};_0x4cf243['model']=_[_0x69d5('0x49')](db[_0x69d5('0x2f')][_0x69d5('0x30')]);_0x4cf243[_0x69d5('0x35')]=_[_0x69d5('0x49')](_0x23527b[_0x69d5('0x35')]);_0x4cf243['filters']=_['intersection'](_0x4cf243[_0x69d5('0x34')],_0x4cf243[_0x69d5('0x35')]);_0x5d2ba2[_0x69d5('0x38')]=_[_0x69d5('0x36')](_0x4cf243[_0x69d5('0x34')],qs[_0x69d5('0x37')](_0x23527b[_0x69d5('0x35')][_0x69d5('0x37')]));_0x5d2ba2['attributes']=_0x5d2ba2['attributes'][_0x69d5('0x39')]?_0x5d2ba2[_0x69d5('0x38')]:_0x4cf243[_0x69d5('0x34')];if(_0x23527b[_0x69d5('0x35')][_0x69d5('0x4a')]){_0x5d2ba2[_0x69d5('0x44')]=[{'all':!![]}];}_0x5d2ba2=_['merge']({},_0x5d2ba2,_0x23527b['options']);return db[_0x69d5('0x2f')][_0x69d5('0x4b')](_0x5d2ba2)[_0x69d5('0x29')](handleEntityNotFound(_0x13075d,null))[_0x69d5('0x29')](respondWithResult(_0x13075d,null))[_0x69d5('0x47')](handleError(_0x13075d,null));};exports[_0x69d5('0x4c')]=function(_0x37a47e,_0x173e85){return db[_0x69d5('0x2f')][_0x69d5('0x4c')](_0x37a47e['body'],{})[_0x69d5('0x29')](respondWithResult(_0x173e85,0xc9))[_0x69d5('0x47')](handleError(_0x173e85,null));};exports[_0x69d5('0x28')]=function(_0x4497b4,_0x1a4ed4){if(_0x4497b4['body']['id']){delete _0x4497b4[_0x69d5('0x4d')]['id'];}return db['ChatQueueReport'][_0x69d5('0x4b')]({'where':{'id':_0x4497b4[_0x69d5('0x4e')]['id']}})[_0x69d5('0x29')](handleEntityNotFound(_0x1a4ed4,null))['then'](saveUpdates(_0x4497b4[_0x69d5('0x4d')],null))[_0x69d5('0x29')](respondWithResult(_0x1a4ed4,null))[_0x69d5('0x47')](handleError(_0x1a4ed4,null));};exports[_0x69d5('0x2a')]=function(_0x153ca4,_0x5266ce){return db[_0x69d5('0x2f')][_0x69d5('0x4b')]({'where':{'id':_0x153ca4[_0x69d5('0x4e')]['id']}})[_0x69d5('0x29')](handleEntityNotFound(_0x5266ce,null))[_0x69d5('0x29')](removeEntity(_0x5266ce,null))[_0x69d5('0x47')](handleError(_0x5266ce,null));};exports[_0x69d5('0x4f')]=function(_0xa04ef2,_0x2ef443){return db[_0x69d5('0x2f')][_0x69d5('0x4f')]()[_0x69d5('0x29')](respondWithResult(_0x2ef443,null))[_0x69d5('0x47')](handleError(_0x2ef443,null));}; \ No newline at end of file +var _0x5078=['sort','where','filters','merge','filter','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','map','ChatQueueReport','rawAttributes','fieldName','type','key','keys','query','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order'];(function(_0x2e3549,_0x76d0d5){var _0x5730d0=function(_0x52229c){while(--_0x52229c){_0x2e3549['push'](_0x2e3549['shift']());}};_0x5730d0(++_0x76d0d5);}(_0x5078,0x148));var _0x8507=function(_0x289ca3,_0xe8a2b2){_0x289ca3=_0x289ca3-0x0;var _0x5c9954=_0x5078[_0x289ca3];return _0x5c9954;};'use strict';var emlformat=require(_0x8507('0x0'));var rimraf=require(_0x8507('0x1'));var zipdir=require(_0x8507('0x2'));var jsonpatch=require(_0x8507('0x3'));var rp=require(_0x8507('0x4'));var moment=require(_0x8507('0x5'));var BPromise=require(_0x8507('0x6'));var Mustache=require(_0x8507('0x7'));var util=require(_0x8507('0x8'));var path=require(_0x8507('0x9'));var sox=require(_0x8507('0xa'));var csv=require(_0x8507('0xb'));var ejs=require(_0x8507('0xc'));var fs=require('fs');var fs_extra=require(_0x8507('0xd'));var _=require(_0x8507('0xe'));var squel=require(_0x8507('0xf'));var crypto=require('crypto');var jsforce=require(_0x8507('0x10'));var deskjs=require(_0x8507('0x11'));var toCsv=require(_0x8507('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8507('0x12'));var authService=require(_0x8507('0x13'));var qs=require(_0x8507('0x14'));var as=require(_0x8507('0x15'));var hardwareService=require(_0x8507('0x16'));var logger=require(_0x8507('0x17'))(_0x8507('0x18'));var utils=require('../../config/utils');var config=require(_0x8507('0x19'));var licenseUtil=require(_0x8507('0x1a'));var db=require(_0x8507('0x1b'))['db'];function respondWithStatusCode(_0x31109f,_0x21a236){_0x21a236=_0x21a236||0xcc;return function(_0x5c41e2){if(_0x5c41e2){return _0x31109f['sendStatus'](_0x21a236);}return _0x31109f[_0x8507('0x1c')](_0x21a236)[_0x8507('0x1d')]();};}function respondWithResult(_0x1f5550,_0x3bafeb){_0x3bafeb=_0x3bafeb||0xc8;return function(_0x2ea0e1){if(_0x2ea0e1){return _0x1f5550[_0x8507('0x1c')](_0x3bafeb)['json'](_0x2ea0e1);}};}function respondWithFilteredResult(_0x4f5aa0,_0x58ff83){return function(_0x1ec9b8){if(_0x1ec9b8){var _0x3f1ed1=typeof _0x58ff83['offset']===_0x8507('0x1e')&&typeof _0x58ff83[_0x8507('0x1f')]===_0x8507('0x1e');var _0x412aee=_0x1ec9b8[_0x8507('0x20')];var _0x13b285=_0x3f1ed1?0x0:_0x58ff83[_0x8507('0x21')];var _0x36e387=_0x3f1ed1?_0x1ec9b8['count']:_0x58ff83['offset']+_0x58ff83[_0x8507('0x1f')];var _0xc556a4;if(_0x36e387>=_0x412aee){_0x36e387=_0x412aee;_0xc556a4=0xc8;}else{_0xc556a4=0xce;}_0x4f5aa0[_0x8507('0x1c')](_0xc556a4);return _0x4f5aa0[_0x8507('0x22')](_0x8507('0x23'),_0x13b285+'-'+_0x36e387+'/'+_0x412aee)['json'](_0x1ec9b8);}return null;};}function patchUpdates(_0x1b8dbf){return function(_0x16501a){try{jsonpatch[_0x8507('0x24')](_0x16501a,_0x1b8dbf,!![]);}catch(_0x192f1c){return BPromise[_0x8507('0x25')](_0x192f1c);}return _0x16501a[_0x8507('0x26')]();};}function saveUpdates(_0x42e5ff,_0x2dc900){return function(_0x539cf9){if(_0x539cf9){return _0x539cf9[_0x8507('0x27')](_0x42e5ff)[_0x8507('0x28')](function(_0x37fd9c){return _0x37fd9c;});}return null;};}function removeEntity(_0x40ad72,_0x873ec4){return function(_0x438001){if(_0x438001){return _0x438001[_0x8507('0x29')]()[_0x8507('0x28')](function(){_0x40ad72['status'](0xcc)[_0x8507('0x1d')]();});}};}function handleEntityNotFound(_0x24fc61,_0x188ae0){return function(_0x5a559e){if(!_0x5a559e){_0x24fc61[_0x8507('0x2a')](0x194);}return _0x5a559e;};}function handleError(_0x15c710,_0x404d73){_0x404d73=_0x404d73||0x1f4;return function(_0x160402){logger['error'](_0x160402[_0x8507('0x2b')]);if(_0x160402[_0x8507('0x2c')]){delete _0x160402[_0x8507('0x2c')];}_0x15c710[_0x8507('0x1c')](_0x404d73)[_0x8507('0x2d')](_0x160402);};}exports['index']=function(_0x23c6e1,_0xb01c06){var _0x232182={},_0x2ca452={},_0x25fe12={'count':0x0,'rows':[]};var _0x8b5a47=_[_0x8507('0x2e')](db[_0x8507('0x2f')][_0x8507('0x30')],function(_0x6e9a38){return{'name':_0x6e9a38[_0x8507('0x31')],'type':_0x6e9a38[_0x8507('0x32')][_0x8507('0x33')]};});_0x2ca452['model']=_['map'](_0x8b5a47,_0x8507('0x2c'));_0x2ca452['query']=_[_0x8507('0x34')](_0x23c6e1[_0x8507('0x35')]);_0x2ca452['filters']=_['intersection'](_0x2ca452['model'],_0x2ca452[_0x8507('0x35')]);_0x232182[_0x8507('0x36')]=_[_0x8507('0x37')](_0x2ca452[_0x8507('0x38')],qs[_0x8507('0x39')](_0x23c6e1[_0x8507('0x35')]['fields']));_0x232182['attributes']=_0x232182[_0x8507('0x36')][_0x8507('0x3a')]?_0x232182[_0x8507('0x36')]:_0x2ca452['model'];if(!_0x23c6e1['query'][_0x8507('0x3b')](_0x8507('0x3c'))){_0x232182['limit']=qs[_0x8507('0x1f')](_0x23c6e1[_0x8507('0x35')]['limit']);_0x232182['offset']=qs['offset'](_0x23c6e1[_0x8507('0x35')][_0x8507('0x21')]);}_0x232182[_0x8507('0x3d')]=qs[_0x8507('0x3e')](_0x23c6e1['query']['sort']);_0x232182[_0x8507('0x3f')]=qs[_0x8507('0x40')](_['pick'](_0x23c6e1[_0x8507('0x35')],_0x2ca452[_0x8507('0x40')]),_0x8b5a47);if(_0x23c6e1[_0x8507('0x35')]['filter']){_0x232182[_0x8507('0x3f')]=_[_0x8507('0x41')](_0x232182[_0x8507('0x3f')],{'$or':_[_0x8507('0x2e')](_0x8b5a47,function(_0x46e6dd){if(_0x46e6dd[_0x8507('0x32')]!=='VIRTUAL'){var _0x42e640={};_0x42e640[_0x46e6dd[_0x8507('0x2c')]]={'$like':'%'+_0x23c6e1['query'][_0x8507('0x42')]+'%'};return _0x42e640;}})});}_0x232182=_[_0x8507('0x41')]({},_0x232182,_0x23c6e1['options']);var _0x2297a8={'where':_0x232182['where']};return db[_0x8507('0x2f')][_0x8507('0x20')](_0x2297a8)['then'](function(_0x2d344e){_0x25fe12['count']=_0x2d344e;if(_0x23c6e1[_0x8507('0x35')][_0x8507('0x43')]){_0x232182[_0x8507('0x44')]=[{'all':!![]}];}return db[_0x8507('0x2f')][_0x8507('0x45')](_0x232182);})[_0x8507('0x28')](function(_0x54d8d3){_0x25fe12[_0x8507('0x46')]=_0x54d8d3;return _0x25fe12;})[_0x8507('0x28')](respondWithFilteredResult(_0xb01c06,_0x232182))[_0x8507('0x47')](handleError(_0xb01c06,null));};exports[_0x8507('0x48')]=function(_0x57083e,_0x260a98){var _0x2e49d0={'raw':!![],'where':{'id':_0x57083e[_0x8507('0x49')]['id']}},_0x55b156={};_0x55b156[_0x8507('0x38')]=_[_0x8507('0x34')](db['ChatQueueReport'][_0x8507('0x30')]);_0x55b156['query']=_[_0x8507('0x34')](_0x57083e[_0x8507('0x35')]);_0x55b156[_0x8507('0x40')]=_[_0x8507('0x37')](_0x55b156['model'],_0x55b156[_0x8507('0x35')]);_0x2e49d0[_0x8507('0x36')]=_[_0x8507('0x37')](_0x55b156[_0x8507('0x38')],qs['fields'](_0x57083e['query']['fields']));_0x2e49d0[_0x8507('0x36')]=_0x2e49d0[_0x8507('0x36')][_0x8507('0x3a')]?_0x2e49d0[_0x8507('0x36')]:_0x55b156[_0x8507('0x38')];if(_0x57083e[_0x8507('0x35')]['includeAll']){_0x2e49d0[_0x8507('0x44')]=[{'all':!![]}];}_0x2e49d0=_[_0x8507('0x41')]({},_0x2e49d0,_0x57083e['options']);return db[_0x8507('0x2f')][_0x8507('0x4a')](_0x2e49d0)[_0x8507('0x28')](handleEntityNotFound(_0x260a98,null))[_0x8507('0x28')](respondWithResult(_0x260a98,null))[_0x8507('0x47')](handleError(_0x260a98,null));};exports[_0x8507('0x4b')]=function(_0x4858b6,_0x5e119e){return db['ChatQueueReport'][_0x8507('0x4b')](_0x4858b6[_0x8507('0x4c')],{})[_0x8507('0x28')](respondWithResult(_0x5e119e,0xc9))[_0x8507('0x47')](handleError(_0x5e119e,null));};exports[_0x8507('0x27')]=function(_0x2c3a5d,_0x5bb3c4){if(_0x2c3a5d[_0x8507('0x4c')]['id']){delete _0x2c3a5d[_0x8507('0x4c')]['id'];}return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x2c3a5d[_0x8507('0x49')]['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x5bb3c4,null))['then'](saveUpdates(_0x2c3a5d['body'],null))[_0x8507('0x28')](respondWithResult(_0x5bb3c4,null))[_0x8507('0x47')](handleError(_0x5bb3c4,null));};exports[_0x8507('0x29')]=function(_0x75b763,_0x50465d){return db[_0x8507('0x2f')][_0x8507('0x4a')]({'where':{'id':_0x75b763['params']['id']}})[_0x8507('0x28')](handleEntityNotFound(_0x50465d,null))[_0x8507('0x28')](removeEntity(_0x50465d,null))['catch'](handleError(_0x50465d,null));};exports[_0x8507('0x4d')]=function(_0x109b91,_0x447978){return db[_0x8507('0x2f')][_0x8507('0x4d')]()[_0x8507('0x28')](respondWithResult(_0x447978,null))[_0x8507('0x47')](handleError(_0x447978,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 54a1b93..06744e5 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 _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0xbcacfd,_0x5d02ab){var _0x3cba9e=function(_0x5d6b95){while(--_0x5d6b95){_0xbcacfd['push'](_0xbcacfd['shift']());}};_0x3cba9e(++_0x5d02ab);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x6505c,_0x5329a7){var _0x1a7a96=function(_0x5bb1c6){while(--_0x5bb1c6){_0x6505c['push'](_0x6505c['shift']());}};_0x1a7a96(++_0x5329a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x33efcc,_0x2ebf86){_0x33efcc=_0x33efcc-0x0;var _0x2e9f19=_0xb10b[_0x33efcc];return _0x2e9f19;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index fe69e51..96cfa47 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 _0xa2b6=['then','UpdateChatQueueReport','update','body','where','limit','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','options','raw'];(function(_0x4067ac,_0x363603){var _0x53d74d=function(_0x492ad4){while(--_0x492ad4){_0x4067ac['push'](_0x4067ac['shift']());}};_0x53d74d(++_0x363603);}(_0xa2b6,0x1a6));var _0x6a2b=function(_0x5aa4ac,_0x74073a){_0x5aa4ac=_0x5aa4ac-0x0;var _0x31dfb8=_0xa2b6[_0x5aa4ac];return _0x31dfb8;};'use strict';var _=require(_0x6a2b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x6a2b('0x1'));var rs=require(_0x6a2b('0x2'));var fs=require('fs');var Redis=require(_0x6a2b('0x3'));var db=require(_0x6a2b('0x4'))['db'];var utils=require(_0x6a2b('0x5'));var logger=require(_0x6a2b('0x6'))(_0x6a2b('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a2b('0x8'));var client=jayson[_0x6a2b('0x9')][_0x6a2b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d6d5e,_0xfbd0c4,_0x17528d){return new BPromise(function(_0x2edd87,_0x5f1260){return client[_0x6a2b('0xb')](_0x4d6d5e,_0x17528d)['then'](function(_0x4c2c8b){logger[_0x6a2b('0xc')](_0x6a2b('0xd'),_0xfbd0c4,_0x6a2b('0xe'));logger['debug'](_0x6a2b('0xf'),_0xfbd0c4,_0x6a2b('0xe'),JSON[_0x6a2b('0x10')](_0x4c2c8b));if(_0x4c2c8b['error']){if(_0x4c2c8b[_0x6a2b('0x11')]['code']===0x1f4){logger[_0x6a2b('0x11')](_0x6a2b('0xd'),_0xfbd0c4,_0x4c2c8b[_0x6a2b('0x11')][_0x6a2b('0x12')]);return _0x5f1260(_0x4c2c8b['error'][_0x6a2b('0x12')]);}logger[_0x6a2b('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0xfbd0c4,_0x4c2c8b[_0x6a2b('0x11')][_0x6a2b('0x12')]);return _0x2edd87(_0x4c2c8b['error']['message']);}else{logger[_0x6a2b('0xc')](_0x6a2b('0xd'),_0xfbd0c4,_0x6a2b('0xe'));_0x2edd87(_0x4c2c8b[_0x6a2b('0x13')][_0x6a2b('0x12')]);}})[_0x6a2b('0x14')](function(_0x237151){logger['error'](_0x6a2b('0xd'),_0xfbd0c4,_0x237151);_0x5f1260(_0x237151);});});}exports[_0x6a2b('0x15')]=function(_0x149b51){var _0x98920=this;return new Promise(function(_0x20ad3a,_0x4db38d){return db[_0x6a2b('0x16')][_0x6a2b('0x17')](_0x149b51['body'],{'raw':_0x149b51[_0x6a2b('0x18')]?_0x149b51[_0x6a2b('0x18')][_0x6a2b('0x19')]===undefined?!![]:![]:!![]})[_0x6a2b('0x1a')](function(_0x2f9642){logger['info'](_0x6a2b('0x15'),_0x149b51);logger['debug']('CreateChatQueueReport',_0x149b51,JSON[_0x6a2b('0x10')](_0x2f9642));_0x20ad3a(_0x2f9642);})[_0x6a2b('0x14')](function(_0x30d78d){logger[_0x6a2b('0x11')](_0x6a2b('0x15'),_0x30d78d[_0x6a2b('0x12')],_0x149b51);_0x4db38d(_0x98920[_0x6a2b('0x11')](0x1f4,_0x30d78d[_0x6a2b('0x12')]));});});};exports[_0x6a2b('0x1b')]=function(_0xda7851){var _0x5e83be=this;return new Promise(function(_0x352949,_0x6389bb){return db[_0x6a2b('0x16')][_0x6a2b('0x1c')](_0xda7851[_0x6a2b('0x1d')],{'raw':_0xda7851[_0x6a2b('0x18')]?_0xda7851[_0x6a2b('0x18')][_0x6a2b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xda7851[_0x6a2b('0x18')]?_0xda7851[_0x6a2b('0x18')][_0x6a2b('0x1e')]||null:null,'attributes':_0xda7851['options']?_0xda7851[_0x6a2b('0x18')]['attributes']||null:null,'limit':_0xda7851[_0x6a2b('0x18')]?_0xda7851[_0x6a2b('0x18')][_0x6a2b('0x1f')]||null:null})[_0x6a2b('0x1a')](function(_0x4d2877){logger[_0x6a2b('0xc')](_0x6a2b('0x1b'),_0xda7851);logger['debug'](_0x6a2b('0x1b'),_0xda7851,JSON['stringify'](_0x4d2877));_0x352949(_0x4d2877);})[_0x6a2b('0x14')](function(_0x3c6f34){logger[_0x6a2b('0x11')](_0x6a2b('0x1b'),_0x3c6f34[_0x6a2b('0x12')],_0xda7851);_0x6389bb(_0x5e83be[_0x6a2b('0x11')](0x1f4,_0x3c6f34[_0x6a2b('0x12')]));});});}; \ No newline at end of file +var _0x2652=['raw','UpdateChatQueueReport','ChatQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatQueueReport,\x20%s,\x20%s','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateChatQueueReport','create','body','options'];(function(_0x4cdf4b,_0x5b07c6){var _0x4eb51d=function(_0x69775b){while(--_0x69775b){_0x4cdf4b['push'](_0x4cdf4b['shift']());}};_0x4eb51d(++_0x5b07c6);}(_0x2652,0x1e1));var _0x2265=function(_0x137388,_0x1b6e88){_0x137388=_0x137388-0x0;var _0x999e43=_0x2652[_0x137388];return _0x999e43;};'use strict';var _=require(_0x2265('0x0'));var util=require(_0x2265('0x1'));var moment=require(_0x2265('0x2'));var BPromise=require(_0x2265('0x3'));var rs=require(_0x2265('0x4'));var fs=require('fs');var Redis=require(_0x2265('0x5'));var db=require(_0x2265('0x6'))['db'];var utils=require(_0x2265('0x7'));var logger=require(_0x2265('0x8'))(_0x2265('0x9'));var config=require(_0x2265('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2265('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a0f42,_0x42a98b,_0x5536fd){return new BPromise(function(_0xd3b591,_0x5452f4){return client[_0x2265('0xc')](_0x5a0f42,_0x5536fd)[_0x2265('0xd')](function(_0x23304c){logger[_0x2265('0xe')](_0x2265('0xf'),_0x42a98b,'request\x20sent');logger[_0x2265('0x10')](_0x2265('0x11'),_0x42a98b,_0x2265('0x12'),JSON[_0x2265('0x13')](_0x23304c));if(_0x23304c[_0x2265('0x14')]){if(_0x23304c[_0x2265('0x14')][_0x2265('0x15')]===0x1f4){logger[_0x2265('0x14')](_0x2265('0xf'),_0x42a98b,_0x23304c[_0x2265('0x14')][_0x2265('0x16')]);return _0x5452f4(_0x23304c[_0x2265('0x14')][_0x2265('0x16')]);}logger[_0x2265('0x14')](_0x2265('0xf'),_0x42a98b,_0x23304c['error']['message']);return _0xd3b591(_0x23304c[_0x2265('0x14')]['message']);}else{logger[_0x2265('0xe')](_0x2265('0xf'),_0x42a98b,_0x2265('0x12'));_0xd3b591(_0x23304c[_0x2265('0x17')]['message']);}})[_0x2265('0x18')](function(_0x551e74){logger[_0x2265('0x14')]('ChatQueueReport,\x20%s,\x20%s',_0x42a98b,_0x551e74);_0x5452f4(_0x551e74);});});}exports[_0x2265('0x19')]=function(_0x298752){var _0x199730=this;return new Promise(function(_0x5150d2,_0x1285a9){return db['ChatQueueReport'][_0x2265('0x1a')](_0x298752[_0x2265('0x1b')],{'raw':_0x298752[_0x2265('0x1c')]?_0x298752[_0x2265('0x1c')][_0x2265('0x1d')]===undefined?!![]:![]:!![]})[_0x2265('0xd')](function(_0x217202){logger[_0x2265('0xe')](_0x2265('0x19'),_0x298752);logger['debug'](_0x2265('0x19'),_0x298752,JSON['stringify'](_0x217202));_0x5150d2(_0x217202);})[_0x2265('0x18')](function(_0x19315){logger['error'](_0x2265('0x19'),_0x19315[_0x2265('0x16')],_0x298752);_0x1285a9(_0x199730[_0x2265('0x14')](0x1f4,_0x19315['message']));});});};exports[_0x2265('0x1e')]=function(_0x3cdaee){var _0x1702dc=this;return new Promise(function(_0x48697e,_0x2b3c55){return db[_0x2265('0x1f')][_0x2265('0x20')](_0x3cdaee[_0x2265('0x1b')],{'raw':_0x3cdaee[_0x2265('0x1c')]?_0x3cdaee[_0x2265('0x1c')][_0x2265('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cdaee['options']?_0x3cdaee['options']['where']||null:null,'attributes':_0x3cdaee[_0x2265('0x1c')]?_0x3cdaee[_0x2265('0x1c')]['attributes']||null:null,'limit':_0x3cdaee[_0x2265('0x1c')]?_0x3cdaee['options'][_0x2265('0x21')]||null:null})[_0x2265('0xd')](function(_0x48419e){logger[_0x2265('0xe')](_0x2265('0x1e'),_0x3cdaee);logger['debug'](_0x2265('0x1e'),_0x3cdaee,JSON['stringify'](_0x48419e));_0x48697e(_0x48419e);})[_0x2265('0x18')](function(_0x594b8a){logger[_0x2265('0x14')](_0x2265('0x1e'),_0x594b8a[_0x2265('0x16')],_0x3cdaee);_0x2b3c55(_0x1702dc[_0x2265('0x14')](0x1f4,_0x594b8a[_0x2265('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 3a197e7..0aa07ce 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 _0xf329=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x13ea36,_0x2805ad){var _0x312066=function(_0xfbee88){while(--_0xfbee88){_0x13ea36['push'](_0x13ea36['shift']());}};_0x312066(++_0x2805ad);}(_0xf329,0x1a3));var _0x9f32=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf329[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x9f32('0x0'));var util=require(_0x9f32('0x1'));var path=require('path');var timeout=require(_0x9f32('0x2'));var express=require(_0x9f32('0x3'));var router=express[_0x9f32('0x4')]();var fs_extra=require(_0x9f32('0x5'));var auth=require(_0x9f32('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9f32('0x7'));var controller=require(_0x9f32('0x8'));router[_0x9f32('0x9')]('/',auth[_0x9f32('0xa')](),controller[_0x9f32('0xb')]);router[_0x9f32('0x9')](_0x9f32('0xc'),auth[_0x9f32('0xa')](),controller[_0x9f32('0xd')]);router[_0x9f32('0x9')](_0x9f32('0xe'),auth['isAuthenticated'](),controller[_0x9f32('0xf')]);router['post']('/',auth[_0x9f32('0xa')](),controller[_0x9f32('0x10')]);router[_0x9f32('0x11')](_0x9f32('0xe'),auth['isAuthenticated'](),controller[_0x9f32('0x12')]);router[_0x9f32('0x13')](_0x9f32('0xe'),auth[_0x9f32('0xa')](),controller['destroy']);module[_0x9f32('0x14')]=router; \ No newline at end of file +var _0x9c4a=['create','put','update','destroy','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','post'];(function(_0x31e245,_0xa8f086){var _0x4315a3=function(_0x14b2ae){while(--_0x14b2ae){_0x31e245['push'](_0x31e245['shift']());}};_0x4315a3(++_0xa8f086);}(_0x9c4a,0x121));var _0xa9c4=function(_0x391c55,_0x168617){_0x391c55=_0x391c55-0x0;var _0xa434e0=_0x9c4a[_0x391c55];return _0xa434e0;};'use strict';var multer=require(_0xa9c4('0x0'));var util=require('util');var path=require(_0xa9c4('0x1'));var timeout=require(_0xa9c4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa9c4('0x3'));var auth=require(_0xa9c4('0x4'));var interaction=require(_0xa9c4('0x5'));var config=require(_0xa9c4('0x6'));var controller=require(_0xa9c4('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xa9c4('0x8')]);router[_0xa9c4('0x9')](_0xa9c4('0xa'),auth[_0xa9c4('0xb')](),controller[_0xa9c4('0xc')]);router[_0xa9c4('0x9')](_0xa9c4('0xd'),auth[_0xa9c4('0xb')](),controller['show']);router[_0xa9c4('0xe')]('/',auth['isAuthenticated'](),controller[_0xa9c4('0xf')]);router[_0xa9c4('0x10')](_0xa9c4('0xd'),auth[_0xa9c4('0xb')](),controller[_0xa9c4('0x11')]);router['delete'](_0xa9c4('0xd'),auth['isAuthenticated'](),controller[_0xa9c4('0x12')]);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 6370781..a89dea2 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 _0xf4eb=['NOW','moment','account','queue','DATE'];(function(_0x5634df,_0x332cf8){var _0x4f2d43=function(_0x5a6a03){while(--_0x5a6a03){_0x5634df['push'](_0x5634df['shift']());}};_0x4f2d43(++_0x332cf8);}(_0xf4eb,0xec));var _0xbf4e=function(_0x5ca74a,_0x3a057c){_0x5ca74a=_0x5ca74a-0x0;var _0x96e793=_0xf4eb[_0x5ca74a];return _0x96e793;};'use strict';var moment=require(_0xbf4e('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xbf4e('0x1'),'agent','queue'),'allowNull':![],'defaultValue':_0xbf4e('0x2')},'transferredAt':{'type':Sequelize[_0xbf4e('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xbf4e('0x4')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x3816c2,_0xb221e1){var _0x144669=function(_0x149c29){while(--_0x149c29){_0x3816c2['push'](_0x3816c2['shift']());}};_0x144669(++_0xb221e1);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1186e8,_0x507e26){_0x1186e8=_0x1186e8-0x0;var _0x5bddc4=_0x9bde[_0x1186e8];return _0x5bddc4;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 2ef2006..8f0ed07 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 _0x8d02=['ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','sox'];(function(_0x4f0f32,_0x5f4739){var _0x40dcd4=function(_0x40591e){while(--_0x40591e){_0x4f0f32['push'](_0x4f0f32['shift']());}};_0x40dcd4(++_0x5f4739);}(_0x8d02,0xda));var _0x28d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d02[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0x28d0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x28d0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x28d0('0x2'));var moment=require(_0x28d0('0x3'));var BPromise=require(_0x28d0('0x4'));var Mustache=require(_0x28d0('0x5'));var util=require('util');var path=require('path');var sox=require(_0x28d0('0x6'));var csv=require('to-csv');var ejs=require(_0x28d0('0x7'));var fs=require('fs');var fs_extra=require(_0x28d0('0x8'));var _=require('lodash');var squel=require(_0x28d0('0x9'));var crypto=require(_0x28d0('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x28d0('0xb'));var toCsv=require(_0x28d0('0xc'));var querystring=require(_0x28d0('0xd'));var Papa=require(_0x28d0('0xe'));var Redis=require(_0x28d0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x28d0('0x10'));var as=require(_0x28d0('0x11'));var hardwareService=require(_0x28d0('0x12'));var logger=require(_0x28d0('0x13'))(_0x28d0('0x14'));var utils=require(_0x28d0('0x15'));var config=require(_0x28d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x28d0('0x17'))['db'];function respondWithStatusCode(_0xd3bbf5,_0x39acde){_0x39acde=_0x39acde||0xcc;return function(_0x3dba0f){if(_0x3dba0f){return _0xd3bbf5['sendStatus'](_0x39acde);}return _0xd3bbf5['status'](_0x39acde)[_0x28d0('0x18')]();};}function respondWithResult(_0x38ec12,_0x4e9601){_0x4e9601=_0x4e9601||0xc8;return function(_0x57b769){if(_0x57b769){return _0x38ec12['status'](_0x4e9601)[_0x28d0('0x19')](_0x57b769);}};}function respondWithFilteredResult(_0x30a606,_0x3ef19b){return function(_0x4a950f){if(_0x4a950f){var _0x4ad6d4=typeof _0x3ef19b[_0x28d0('0x1a')]===_0x28d0('0x1b')&&typeof _0x3ef19b[_0x28d0('0x1c')]==='undefined';var _0x1129b8=_0x4a950f[_0x28d0('0x1d')];var _0x4d3ada=_0x4ad6d4?0x0:_0x3ef19b[_0x28d0('0x1a')];var _0x8fd22a=_0x4ad6d4?_0x4a950f[_0x28d0('0x1d')]:_0x3ef19b['offset']+_0x3ef19b[_0x28d0('0x1c')];var _0x3b3bfd;if(_0x8fd22a>=_0x1129b8){_0x8fd22a=_0x1129b8;_0x3b3bfd=0xc8;}else{_0x3b3bfd=0xce;}_0x30a606[_0x28d0('0x1e')](_0x3b3bfd);return _0x30a606['set'](_0x28d0('0x1f'),_0x4d3ada+'-'+_0x8fd22a+'/'+_0x1129b8)['json'](_0x4a950f);}return null;};}function patchUpdates(_0x588a0d){return function(_0x3933ca){try{jsonpatch[_0x28d0('0x20')](_0x3933ca,_0x588a0d,!![]);}catch(_0x53bfaa){return BPromise[_0x28d0('0x21')](_0x53bfaa);}return _0x3933ca[_0x28d0('0x22')]();};}function saveUpdates(_0x48428b,_0x101bc9){return function(_0x556df9){if(_0x556df9){return _0x556df9[_0x28d0('0x23')](_0x48428b)[_0x28d0('0x24')](function(_0x98ee3){return _0x98ee3;});}return null;};}function removeEntity(_0x3b89ca,_0x4f1db7){return function(_0x4f3976){if(_0x4f3976){return _0x4f3976[_0x28d0('0x25')]()[_0x28d0('0x24')](function(){_0x3b89ca[_0x28d0('0x1e')](0xcc)[_0x28d0('0x18')]();});}};}function handleEntityNotFound(_0x42c5cf,_0x8dca0c){return function(_0x35909e){if(!_0x35909e){_0x42c5cf[_0x28d0('0x26')](0x194);}return _0x35909e;};}function handleError(_0x30fbb9,_0x3416c7){_0x3416c7=_0x3416c7||0x1f4;return function(_0x28c6fc){logger[_0x28d0('0x27')](_0x28c6fc[_0x28d0('0x28')]);if(_0x28c6fc[_0x28d0('0x29')]){delete _0x28c6fc[_0x28d0('0x29')];}_0x30fbb9[_0x28d0('0x1e')](_0x3416c7)[_0x28d0('0x2a')](_0x28c6fc);};}exports[_0x28d0('0x2b')]=function(_0x45dca8,_0x2b0229){var _0x1fa18={},_0x2b9659={},_0x44ec2e={'count':0x0,'rows':[]};var _0x13b395=_[_0x28d0('0x2c')](db[_0x28d0('0x2d')][_0x28d0('0x2e')],function(_0x29e546){return{'name':_0x29e546[_0x28d0('0x2f')],'type':_0x29e546[_0x28d0('0x30')][_0x28d0('0x31')]};});_0x2b9659[_0x28d0('0x32')]=_[_0x28d0('0x2c')](_0x13b395,_0x28d0('0x29'));_0x2b9659[_0x28d0('0x33')]=_[_0x28d0('0x34')](_0x45dca8['query']);_0x2b9659[_0x28d0('0x35')]=_[_0x28d0('0x36')](_0x2b9659[_0x28d0('0x32')],_0x2b9659[_0x28d0('0x33')]);_0x1fa18['attributes']=_[_0x28d0('0x36')](_0x2b9659['model'],qs[_0x28d0('0x37')](_0x45dca8[_0x28d0('0x33')]['fields']));_0x1fa18[_0x28d0('0x38')]=_0x1fa18[_0x28d0('0x38')][_0x28d0('0x39')]?_0x1fa18[_0x28d0('0x38')]:_0x2b9659[_0x28d0('0x32')];if(!_0x45dca8[_0x28d0('0x33')]['hasOwnProperty']('nolimit')){_0x1fa18['limit']=qs[_0x28d0('0x1c')](_0x45dca8['query'][_0x28d0('0x1c')]);_0x1fa18[_0x28d0('0x1a')]=qs['offset'](_0x45dca8[_0x28d0('0x33')][_0x28d0('0x1a')]);}_0x1fa18['order']=qs['sort'](_0x45dca8[_0x28d0('0x33')][_0x28d0('0x3a')]);_0x1fa18[_0x28d0('0x3b')]=qs[_0x28d0('0x35')](_[_0x28d0('0x3c')](_0x45dca8[_0x28d0('0x33')],_0x2b9659[_0x28d0('0x35')]),_0x13b395);if(_0x45dca8['query'][_0x28d0('0x3d')]){_0x1fa18['where']=_[_0x28d0('0x3e')](_0x1fa18[_0x28d0('0x3b')],{'$or':_[_0x28d0('0x2c')](_0x13b395,function(_0x29bac6){if(_0x29bac6[_0x28d0('0x30')]!==_0x28d0('0x3f')){var _0x17e1d9={};_0x17e1d9[_0x29bac6[_0x28d0('0x29')]]={'$like':'%'+_0x45dca8[_0x28d0('0x33')][_0x28d0('0x3d')]+'%'};return _0x17e1d9;}})});}_0x1fa18=_[_0x28d0('0x3e')]({},_0x1fa18,_0x45dca8[_0x28d0('0x40')]);var _0xe42ba9={'where':_0x1fa18[_0x28d0('0x3b')]};return db[_0x28d0('0x2d')][_0x28d0('0x1d')](_0xe42ba9)[_0x28d0('0x24')](function(_0x3a3343){_0x44ec2e[_0x28d0('0x1d')]=_0x3a3343;if(_0x45dca8[_0x28d0('0x33')][_0x28d0('0x41')]){_0x1fa18[_0x28d0('0x42')]=[{'all':!![]}];}return db[_0x28d0('0x2d')][_0x28d0('0x43')](_0x1fa18);})['then'](function(_0x4a140b){_0x44ec2e[_0x28d0('0x44')]=_0x4a140b;return _0x44ec2e;})[_0x28d0('0x24')](respondWithFilteredResult(_0x2b0229,_0x1fa18))[_0x28d0('0x45')](handleError(_0x2b0229,null));};exports['show']=function(_0x334d69,_0x2816d3){var _0x536f73={'raw':!![],'where':{'id':_0x334d69[_0x28d0('0x46')]['id']}},_0x43a5f6={};_0x43a5f6[_0x28d0('0x32')]=_[_0x28d0('0x34')](db[_0x28d0('0x2d')][_0x28d0('0x2e')]);_0x43a5f6['query']=_[_0x28d0('0x34')](_0x334d69[_0x28d0('0x33')]);_0x43a5f6[_0x28d0('0x35')]=_[_0x28d0('0x36')](_0x43a5f6[_0x28d0('0x32')],_0x43a5f6['query']);_0x536f73[_0x28d0('0x38')]=_['intersection'](_0x43a5f6['model'],qs[_0x28d0('0x37')](_0x334d69[_0x28d0('0x33')]['fields']));_0x536f73[_0x28d0('0x38')]=_0x536f73['attributes'][_0x28d0('0x39')]?_0x536f73[_0x28d0('0x38')]:_0x43a5f6[_0x28d0('0x32')];if(_0x334d69[_0x28d0('0x33')]['includeAll']){_0x536f73[_0x28d0('0x42')]=[{'all':!![]}];}_0x536f73=_[_0x28d0('0x3e')]({},_0x536f73,_0x334d69[_0x28d0('0x40')]);return db[_0x28d0('0x2d')][_0x28d0('0x47')](_0x536f73)[_0x28d0('0x24')](handleEntityNotFound(_0x2816d3,null))[_0x28d0('0x24')](respondWithResult(_0x2816d3,null))[_0x28d0('0x45')](handleError(_0x2816d3,null));};exports[_0x28d0('0x48')]=function(_0x3b0c55,_0x4d0674){return db['ChatTransferReport'][_0x28d0('0x48')](_0x3b0c55[_0x28d0('0x49')],{})[_0x28d0('0x24')](respondWithResult(_0x4d0674,0xc9))['catch'](handleError(_0x4d0674,null));};exports[_0x28d0('0x23')]=function(_0x4fb803,_0x2d753b){if(_0x4fb803[_0x28d0('0x49')]['id']){delete _0x4fb803[_0x28d0('0x49')]['id'];}return db[_0x28d0('0x2d')][_0x28d0('0x47')]({'where':{'id':_0x4fb803['params']['id']}})[_0x28d0('0x24')](handleEntityNotFound(_0x2d753b,null))[_0x28d0('0x24')](saveUpdates(_0x4fb803[_0x28d0('0x49')],null))[_0x28d0('0x24')](respondWithResult(_0x2d753b,null))[_0x28d0('0x45')](handleError(_0x2d753b,null));};exports[_0x28d0('0x25')]=function(_0x1e946e,_0x3abeeb){return db['ChatTransferReport']['find']({'where':{'id':_0x1e946e['params']['id']}})['then'](handleEntityNotFound(_0x3abeeb,null))[_0x28d0('0x24')](removeEntity(_0x3abeeb,null))[_0x28d0('0x45')](handleError(_0x3abeeb,null));};exports[_0x28d0('0x4a')]=function(_0x514fb6,_0x8f2cb3){return db[_0x28d0('0x2d')]['describe']()['then'](respondWithResult(_0x8f2cb3,null))[_0x28d0('0x45')](handleError(_0x8f2cb3,null));}; \ No newline at end of file +var _0x4ad2=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','stack','name','send','index','rawAttributes','type','key','query','keys','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','map','VIRTUAL','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x415f77,_0x4ef1a4){var _0x1ef989=function(_0x43313f){while(--_0x43313f){_0x415f77['push'](_0x415f77['shift']());}};_0x1ef989(++_0x4ef1a4);}(_0x4ad2,0xe2));var _0x24ad=function(_0x347896,_0x32f190){_0x347896=_0x347896-0x0;var _0x190a68=_0x4ad2[_0x347896];return _0x190a68;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x24ad('0x0'));var jsonpatch=require(_0x24ad('0x1'));var rp=require(_0x24ad('0x2'));var moment=require(_0x24ad('0x3'));var BPromise=require(_0x24ad('0x4'));var Mustache=require('mustache');var util=require(_0x24ad('0x5'));var path=require(_0x24ad('0x6'));var sox=require(_0x24ad('0x7'));var csv=require(_0x24ad('0x8'));var ejs=require(_0x24ad('0x9'));var fs=require('fs');var fs_extra=require(_0x24ad('0xa'));var _=require(_0x24ad('0xb'));var squel=require(_0x24ad('0xc'));var crypto=require(_0x24ad('0xd'));var jsforce=require(_0x24ad('0xe'));var deskjs=require(_0x24ad('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x24ad('0x10'));var authService=require(_0x24ad('0x11'));var qs=require(_0x24ad('0x12'));var as=require(_0x24ad('0x13'));var hardwareService=require(_0x24ad('0x14'));var logger=require(_0x24ad('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x24ad('0x16'));var licenseUtil=require(_0x24ad('0x17'));var db=require(_0x24ad('0x18'))['db'];function respondWithStatusCode(_0x3c81a9,_0xf47403){_0xf47403=_0xf47403||0xcc;return function(_0x52b241){if(_0x52b241){return _0x3c81a9[_0x24ad('0x19')](_0xf47403);}return _0x3c81a9[_0x24ad('0x1a')](_0xf47403)[_0x24ad('0x1b')]();};}function respondWithResult(_0x87d673,_0x50c1f3){_0x50c1f3=_0x50c1f3||0xc8;return function(_0x12a19f){if(_0x12a19f){return _0x87d673[_0x24ad('0x1a')](_0x50c1f3)[_0x24ad('0x1c')](_0x12a19f);}};}function respondWithFilteredResult(_0xc9ce49,_0x5e772c){return function(_0x4d3e2c){if(_0x4d3e2c){var _0x578c6d=typeof _0x5e772c[_0x24ad('0x1d')]===_0x24ad('0x1e')&&typeof _0x5e772c[_0x24ad('0x1f')]===_0x24ad('0x1e');var _0x1dacff=_0x4d3e2c[_0x24ad('0x20')];var _0x2f0917=_0x578c6d?0x0:_0x5e772c[_0x24ad('0x1d')];var _0x425442=_0x578c6d?_0x4d3e2c[_0x24ad('0x20')]:_0x5e772c['offset']+_0x5e772c[_0x24ad('0x1f')];var _0x5b88c7;if(_0x425442>=_0x1dacff){_0x425442=_0x1dacff;_0x5b88c7=0xc8;}else{_0x5b88c7=0xce;}_0xc9ce49[_0x24ad('0x1a')](_0x5b88c7);return _0xc9ce49[_0x24ad('0x21')]('Content-Range',_0x2f0917+'-'+_0x425442+'/'+_0x1dacff)[_0x24ad('0x1c')](_0x4d3e2c);}return null;};}function patchUpdates(_0x19f890){return function(_0x36a015){try{jsonpatch[_0x24ad('0x22')](_0x36a015,_0x19f890,!![]);}catch(_0x35d43c){return BPromise[_0x24ad('0x23')](_0x35d43c);}return _0x36a015[_0x24ad('0x24')]();};}function saveUpdates(_0x2bfcda,_0xb1c2e0){return function(_0x3d6ee1){if(_0x3d6ee1){return _0x3d6ee1[_0x24ad('0x25')](_0x2bfcda)[_0x24ad('0x26')](function(_0x1c3efb){return _0x1c3efb;});}return null;};}function removeEntity(_0x15dfaf,_0x280d5f){return function(_0x31f629){if(_0x31f629){return _0x31f629['destroy']()[_0x24ad('0x26')](function(){_0x15dfaf['status'](0xcc)[_0x24ad('0x1b')]();});}};}function handleEntityNotFound(_0x4e63a8,_0x64e2eb){return function(_0x128f67){if(!_0x128f67){_0x4e63a8[_0x24ad('0x19')](0x194);}return _0x128f67;};}function handleError(_0x579540,_0x17beca){_0x17beca=_0x17beca||0x1f4;return function(_0xd14f9b){logger['error'](_0xd14f9b[_0x24ad('0x27')]);if(_0xd14f9b[_0x24ad('0x28')]){delete _0xd14f9b['name'];}_0x579540[_0x24ad('0x1a')](_0x17beca)[_0x24ad('0x29')](_0xd14f9b);};}exports[_0x24ad('0x2a')]=function(_0x3b36cf,_0x55ec4e){var _0xb849ef={},_0x393004={},_0x20a51f={'count':0x0,'rows':[]};var _0x52dcb3=_['map'](db['ChatTransferReport'][_0x24ad('0x2b')],function(_0x3e75ca){return{'name':_0x3e75ca['fieldName'],'type':_0x3e75ca[_0x24ad('0x2c')][_0x24ad('0x2d')]};});_0x393004['model']=_['map'](_0x52dcb3,'name');_0x393004[_0x24ad('0x2e')]=_[_0x24ad('0x2f')](_0x3b36cf[_0x24ad('0x2e')]);_0x393004[_0x24ad('0x30')]=_[_0x24ad('0x31')](_0x393004['model'],_0x393004[_0x24ad('0x2e')]);_0xb849ef[_0x24ad('0x32')]=_[_0x24ad('0x31')](_0x393004['model'],qs['fields'](_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x33')]));_0xb849ef[_0x24ad('0x32')]=_0xb849ef[_0x24ad('0x32')][_0x24ad('0x34')]?_0xb849ef['attributes']:_0x393004[_0x24ad('0x35')];if(!_0x3b36cf['query'][_0x24ad('0x36')](_0x24ad('0x37'))){_0xb849ef[_0x24ad('0x1f')]=qs[_0x24ad('0x1f')](_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x1f')]);_0xb849ef[_0x24ad('0x1d')]=qs[_0x24ad('0x1d')](_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x1d')]);}_0xb849ef[_0x24ad('0x38')]=qs[_0x24ad('0x39')](_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x39')]);_0xb849ef['where']=qs[_0x24ad('0x30')](_[_0x24ad('0x3a')](_0x3b36cf[_0x24ad('0x2e')],_0x393004[_0x24ad('0x30')]),_0x52dcb3);if(_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x3b')]){_0xb849ef[_0x24ad('0x3c')]=_[_0x24ad('0x3d')](_0xb849ef['where'],{'$or':_[_0x24ad('0x3e')](_0x52dcb3,function(_0x438082){if(_0x438082['type']!==_0x24ad('0x3f')){var _0x32f6f8={};_0x32f6f8[_0x438082[_0x24ad('0x28')]]={'$like':'%'+_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x3b')]+'%'};return _0x32f6f8;}})});}_0xb849ef=_[_0x24ad('0x3d')]({},_0xb849ef,_0x3b36cf['options']);var _0x5f000c={'where':_0xb849ef[_0x24ad('0x3c')]};return db[_0x24ad('0x40')]['count'](_0x5f000c)[_0x24ad('0x26')](function(_0x50da38){_0x20a51f[_0x24ad('0x20')]=_0x50da38;if(_0x3b36cf[_0x24ad('0x2e')][_0x24ad('0x41')]){_0xb849ef[_0x24ad('0x42')]=[{'all':!![]}];}return db[_0x24ad('0x40')][_0x24ad('0x43')](_0xb849ef);})['then'](function(_0x1e13f6){_0x20a51f[_0x24ad('0x44')]=_0x1e13f6;return _0x20a51f;})['then'](respondWithFilteredResult(_0x55ec4e,_0xb849ef))[_0x24ad('0x45')](handleError(_0x55ec4e,null));};exports[_0x24ad('0x46')]=function(_0x36cb56,_0x112d50){var _0x1ca49d={'raw':!![],'where':{'id':_0x36cb56[_0x24ad('0x47')]['id']}},_0x617083={};_0x617083[_0x24ad('0x35')]=_[_0x24ad('0x2f')](db[_0x24ad('0x40')]['rawAttributes']);_0x617083[_0x24ad('0x2e')]=_[_0x24ad('0x2f')](_0x36cb56[_0x24ad('0x2e')]);_0x617083[_0x24ad('0x30')]=_['intersection'](_0x617083[_0x24ad('0x35')],_0x617083[_0x24ad('0x2e')]);_0x1ca49d[_0x24ad('0x32')]=_[_0x24ad('0x31')](_0x617083[_0x24ad('0x35')],qs[_0x24ad('0x33')](_0x36cb56['query'][_0x24ad('0x33')]));_0x1ca49d[_0x24ad('0x32')]=_0x1ca49d[_0x24ad('0x32')][_0x24ad('0x34')]?_0x1ca49d[_0x24ad('0x32')]:_0x617083['model'];if(_0x36cb56[_0x24ad('0x2e')][_0x24ad('0x41')]){_0x1ca49d[_0x24ad('0x42')]=[{'all':!![]}];}_0x1ca49d=_[_0x24ad('0x3d')]({},_0x1ca49d,_0x36cb56['options']);return db[_0x24ad('0x40')][_0x24ad('0x48')](_0x1ca49d)[_0x24ad('0x26')](handleEntityNotFound(_0x112d50,null))[_0x24ad('0x26')](respondWithResult(_0x112d50,null))[_0x24ad('0x45')](handleError(_0x112d50,null));};exports[_0x24ad('0x49')]=function(_0x67db25,_0x48167c){return db['ChatTransferReport'][_0x24ad('0x49')](_0x67db25[_0x24ad('0x4a')],{})[_0x24ad('0x26')](respondWithResult(_0x48167c,0xc9))['catch'](handleError(_0x48167c,null));};exports[_0x24ad('0x25')]=function(_0x515ee1,_0x20b1c2){if(_0x515ee1[_0x24ad('0x4a')]['id']){delete _0x515ee1[_0x24ad('0x4a')]['id'];}return db[_0x24ad('0x40')][_0x24ad('0x48')]({'where':{'id':_0x515ee1[_0x24ad('0x47')]['id']}})[_0x24ad('0x26')](handleEntityNotFound(_0x20b1c2,null))[_0x24ad('0x26')](saveUpdates(_0x515ee1[_0x24ad('0x4a')],null))[_0x24ad('0x26')](respondWithResult(_0x20b1c2,null))[_0x24ad('0x45')](handleError(_0x20b1c2,null));};exports[_0x24ad('0x4b')]=function(_0x38c0f8,_0x52faa5){return db[_0x24ad('0x40')]['find']({'where':{'id':_0x38c0f8[_0x24ad('0x47')]['id']}})['then'](handleEntityNotFound(_0x52faa5,null))['then'](removeEntity(_0x52faa5,null))[_0x24ad('0x45')](handleError(_0x52faa5,null));};exports['describe']=function(_0x4cd728,_0x1a71a7){return db[_0x24ad('0x40')][_0x24ad('0x4c')]()[_0x24ad('0x26')](respondWithResult(_0x1a71a7,null))[_0x24ad('0x45')](handleError(_0x1a71a7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 3e69661..d2d4727 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 _0x347c=['ChatTransferReport','uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','define'];(function(_0x2d67b4,_0x4ca8fe){var _0x4cd582=function(_0x21180a){while(--_0x21180a){_0x2d67b4['push'](_0x2d67b4['shift']());}};_0x4cd582(++_0x4ca8fe);}(_0x347c,0x16a));var _0xc347=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x347c[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0xc347('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc347('0x1'));var moment=require(_0xc347('0x2'));var BPromise=require('bluebird');var rp=require(_0xc347('0x3'));var fs=require('fs');var path=require(_0xc347('0x4'));var rimraf=require(_0xc347('0x5'));var config=require(_0xc347('0x6'));var attributes=require(_0xc347('0x7'));module[_0xc347('0x8')]=function(_0x423426,_0x503779){return _0x423426[_0xc347('0x9')](_0xc347('0xa'),attributes,{'tableName':'report_chat_transfer','paranoid':![],'indexes':[{'name':_0xc347('0xb'),'fields':[_0xc347('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6b2d=['../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x31dbc2,_0x38fb3c){var _0x22eb5c=function(_0x5b63bf){while(--_0x5b63bf){_0x31dbc2['push'](_0x31dbc2['shift']());}};_0x22eb5c(++_0x38fb3c);}(_0x6b2d,0x18d));var _0xd6b2=function(_0x1ff19c,_0xd5d1c7){_0x1ff19c=_0x1ff19c-0x0;var _0x475fd4=_0x6b2d[_0x1ff19c];return _0x475fd4;};'use strict';var _=require(_0xd6b2('0x0'));var util=require(_0xd6b2('0x1'));var logger=require(_0xd6b2('0x2'))(_0xd6b2('0x3'));var moment=require(_0xd6b2('0x4'));var BPromise=require(_0xd6b2('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6b2('0x6'));var rimraf=require(_0xd6b2('0x7'));var config=require(_0xd6b2('0x8'));var attributes=require(_0xd6b2('0x9'));module[_0xd6b2('0xa')]=function(_0x5a04d6,_0x34ce21){return _0x5a04d6[_0xd6b2('0xb')](_0xd6b2('0xc'),attributes,{'tableName':_0xd6b2('0xd'),'paranoid':![],'indexes':[{'name':_0xd6b2('0xe'),'fields':[_0xd6b2('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 55bd851..87a19fd 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 _0x6c0f=['info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x7ad123,_0xeeeef3){var _0x37d073=function(_0x51367b){while(--_0x51367b){_0x7ad123['push'](_0x7ad123['shift']());}};_0x37d073(++_0xeeeef3);}(_0x6c0f,0x15c));var _0xf6c0=function(_0x5d6a08,_0x5f3a16){_0x5d6a08=_0x5d6a08-0x0;var _0x1f9acc=_0x6c0f[_0x5d6a08];return _0x1f9acc;};'use strict';var _=require(_0xf6c0('0x0'));var util=require('util');var moment=require(_0xf6c0('0x1'));var BPromise=require('bluebird');var rs=require(_0xf6c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6c0('0x3'))['db'];var utils=require(_0xf6c0('0x4'));var logger=require('../../config/logger')(_0xf6c0('0x5'));var config=require(_0xf6c0('0x6'));var jayson=require(_0xf6c0('0x7'));var client=jayson[_0xf6c0('0x8')][_0xf6c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41eef1,_0x4dbf84,_0x156324){return new BPromise(function(_0x4fe409,_0x105926){return client[_0xf6c0('0xa')](_0x41eef1,_0x156324)[_0xf6c0('0xb')](function(_0x30ec9b){logger[_0xf6c0('0xc')](_0xf6c0('0xd'),_0x4dbf84,_0xf6c0('0xe'));logger[_0xf6c0('0xf')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4dbf84,_0xf6c0('0xe'),JSON[_0xf6c0('0x10')](_0x30ec9b));if(_0x30ec9b[_0xf6c0('0x11')]){if(_0x30ec9b[_0xf6c0('0x11')]['code']===0x1f4){logger[_0xf6c0('0x11')](_0xf6c0('0xd'),_0x4dbf84,_0x30ec9b['error'][_0xf6c0('0x12')]);return _0x105926(_0x30ec9b[_0xf6c0('0x11')][_0xf6c0('0x12')]);}logger['error'](_0xf6c0('0xd'),_0x4dbf84,_0x30ec9b[_0xf6c0('0x11')][_0xf6c0('0x12')]);return _0x4fe409(_0x30ec9b['error'][_0xf6c0('0x12')]);}else{logger[_0xf6c0('0xc')](_0xf6c0('0xd'),_0x4dbf84,_0xf6c0('0xe'));_0x4fe409(_0x30ec9b[_0xf6c0('0x13')]['message']);}})['catch'](function(_0x518eff){logger['error'](_0xf6c0('0xd'),_0x4dbf84,_0x518eff);_0x105926(_0x518eff);});});} \ No newline at end of file +var _0x0f87=['../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','moment','ioredis'];(function(_0x1341a6,_0x23816a){var _0x37658e=function(_0xbe0a4d){while(--_0xbe0a4d){_0x1341a6['push'](_0x1341a6['shift']());}};_0x37658e(++_0x23816a);}(_0x0f87,0x97));var _0x70f8=function(_0x566fca,_0x2a0a1c){_0x566fca=_0x566fca-0x0;var _0x38e666=_0x0f87[_0x566fca];return _0x38e666;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x70f8('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x70f8('0x1'));var db=require(_0x70f8('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x70f8('0x3'))('rpc');var config=require(_0x70f8('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x70f8('0x5')][_0x70f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x13db1a,_0x54f704,_0x5c84dd){return new BPromise(function(_0x405bf7,_0x208e2c){return client[_0x70f8('0x7')](_0x13db1a,_0x5c84dd)['then'](function(_0x5629aa){logger[_0x70f8('0x8')](_0x70f8('0x9'),_0x54f704,_0x70f8('0xa'));logger['debug'](_0x70f8('0xb'),_0x54f704,_0x70f8('0xa'),JSON[_0x70f8('0xc')](_0x5629aa));if(_0x5629aa[_0x70f8('0xd')]){if(_0x5629aa[_0x70f8('0xd')][_0x70f8('0xe')]===0x1f4){logger['error'](_0x70f8('0x9'),_0x54f704,_0x5629aa[_0x70f8('0xd')][_0x70f8('0xf')]);return _0x208e2c(_0x5629aa['error'][_0x70f8('0xf')]);}logger[_0x70f8('0xd')](_0x70f8('0x9'),_0x54f704,_0x5629aa[_0x70f8('0xd')][_0x70f8('0xf')]);return _0x405bf7(_0x5629aa['error'][_0x70f8('0xf')]);}else{logger[_0x70f8('0x8')](_0x70f8('0x9'),_0x54f704,_0x70f8('0xa'));_0x405bf7(_0x5629aa['result']['message']);}})[_0x70f8('0x10')](function(_0x13499e){logger['error'](_0x70f8('0x9'),_0x54f704,_0x13499e);_0x208e2c(_0x13499e);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 53df50e..88a553b 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 _0x502b=['put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','index','/:id','isAuthenticated','show','post','create'];(function(_0x1a5e46,_0x39c459){var _0x2edd08=function(_0x21e7b9){while(--_0x21e7b9){_0x1a5e46['push'](_0x1a5e46['shift']());}};_0x2edd08(++_0x39c459);}(_0x502b,0xdf));var _0xb502=function(_0x1a5946,_0x426991){_0x1a5946=_0x1a5946-0x0;var _0x25e9d5=_0x502b[_0x1a5946];return _0x25e9d5;};'use strict';var multer=require(_0xb502('0x0'));var util=require(_0xb502('0x1'));var path=require(_0xb502('0x2'));var timeout=require(_0xb502('0x3'));var express=require(_0xb502('0x4'));var router=express[_0xb502('0x5')]();var fs_extra=require(_0xb502('0x6'));var auth=require(_0xb502('0x7'));var interaction=require(_0xb502('0x8'));var config=require('../../config/environment');var controller=require(_0xb502('0x9'));router[_0xb502('0xa')]('/',auth['isAuthenticated'](),controller[_0xb502('0xb')]);router[_0xb502('0xa')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0xb502('0xc'),auth[_0xb502('0xd')](),controller[_0xb502('0xe')]);router[_0xb502('0xf')]('/',auth[_0xb502('0xd')](),controller[_0xb502('0x10')]);router[_0xb502('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xb502('0x12')]);router[_0xb502('0x13')](_0xb502('0xc'),auth[_0xb502('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa5be=['express','Router','fs-extra','../../components/auth/service','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','update','delete','exports','multer','util','connect-timeout'];(function(_0x56964b,_0x57ebf7){var _0x1b348f=function(_0x26cc10){while(--_0x26cc10){_0x56964b['push'](_0x56964b['shift']());}};_0x1b348f(++_0x57ebf7);}(_0xa5be,0x1bf));var _0xea5b=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa5be[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0xea5b('0x0'));var util=require(_0xea5b('0x1'));var path=require('path');var timeout=require(_0xea5b('0x2'));var express=require(_0xea5b('0x3'));var router=express[_0xea5b('0x4')]();var fs_extra=require(_0xea5b('0x5'));var auth=require(_0xea5b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xea5b('0x7'));router[_0xea5b('0x8')]('/',auth[_0xea5b('0x9')](),controller['index']);router[_0xea5b('0x8')](_0xea5b('0xa'),auth[_0xea5b('0x9')](),controller[_0xea5b('0xb')]);router[_0xea5b('0x8')](_0xea5b('0xc'),auth[_0xea5b('0x9')](),controller['show']);router[_0xea5b('0xd')]('/',auth['isAuthenticated'](),controller[_0xea5b('0xe')]);router['put'](_0xea5b('0xc'),auth[_0xea5b('0x9')](),controller[_0xea5b('0xf')]);router[_0xea5b('0x10')]('/:id',auth[_0xea5b('0x9')](),controller['destroy']);module[_0xea5b('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 8bde91e..033ed73 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 _0xddfb=['STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','input','name','getDataValue','parse','onlineForm','setDataValue','stringify','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','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','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports'];(function(_0x77fd25,_0x226ea2){var _0xe14528=function(_0x1551d5){while(--_0x1551d5){_0x77fd25['push'](_0x77fd25['shift']());}};_0xe14528(++_0x226ea2);}(_0xddfb,0x101));var _0xbddf=function(_0x4b2d73,_0x57f61f){_0x4b2d73=_0x4b2d73-0x0;var _0x590b2c=_0xddfb[_0x4b2d73];return _0x590b2c;};'use strict';var Sequelize=require(_0xbddf('0x0'));var rs=require(_0xbddf('0x1'));module[_0xbddf('0x2')]={'name':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize[_0xbddf('0x3')]},'mapKey':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x4')},'mapKeyOffline':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'email'},'key':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x5')},'customerAlias':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':_0xbddf('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbddf('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xbddf('0x3')]},'animation':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xbddf('0xa')](_0xbddf('0xb'),'squared'),'defaultValue':_0xbddf('0xb')},'header_online':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0xd')},'header_offline':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xe')},'download_transcript':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xbddf('0xf')]},'closingQuestion':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x13')},'closingMessage':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x14')},'closingMessageButton':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xd')},'skipMessageButton':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x15')},'conditionAgreement':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xbddf('0xa')](_0xbddf('0x16'),_0xbddf('0x17')),'defaultValue':_0xbddf('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xbddf('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xbddf('0x18'),'variable':null,'config':{'placeholder':_0xbddf('0x19'),'type':'text','required':!![]},'props':{'title':_0xbddf('0x19'),'helpText':''}},{'type':_0xbddf('0x18'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xbddf('0x4'),'type':_0xbddf('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xbddf('0x1a')]('onlineForm')?JSON[_0xbddf('0x1b')](this['getDataValue'](_0xbddf('0x1c'))):{};},'set':function(_0x267db7){return this[_0xbddf('0x1d')](_0xbddf('0x1c'),JSON[_0xbddf('0x1e')](_0x267db7));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':'input','props':{'title':_0xbddf('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0xbddf('0x4'),'type':_0xbddf('0x4')},'variable':null},{'type':_0xbddf('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xbddf('0x20'),'helpText':_0xbddf('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0xbddf('0x1a')](_0xbddf('0x22'))?JSON['parse'](this[_0xbddf('0x1a')](_0xbddf('0x22'))):{};},'set':function(_0x7668de){return this[_0xbddf('0x1d')](_0xbddf('0x22'),JSON[_0xbddf('0x1e')](_0x7668de));}},'token':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xbddf('0x3')]},'forwardOffline':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xbddf('0x3')]},'waitingTitle':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x25')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x27')},'skipUnmanaged':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x15')},'sendUnmanaged':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xbddf('0xf')]},'showAgentAvatar':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xbddf('0xf')],'defaultValue':function(){return _0xbddf('0x28');}},'notificationSound':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xbddf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbddf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x2b')},'messagesAlignment':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':_0xbddf('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xbddf('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':_0xbddf('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbddf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize['STRING'],'defaultValue':_0xbddf('0x2e')},'systemAvatar':{'type':Sequelize[_0xbddf('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbddf('0x8')],'comment':_0xbddf('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![],'comment':_0xbddf('0x30'),'set':function(_0x5ef7c6){if(!_0x5ef7c6)this[_0xbddf('0x1d')](_0xbddf('0x31'),null);this[_0xbddf('0x1d')](_0xbddf('0x32'),_0x5ef7c6);}},'vidaooEscalation':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xbddf('0x3')]},'vidaooTopic':{'type':Sequelize[_0xbddf('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize[_0xbddf('0x3')],'defaultValue':function(){return _0xbddf('0x33');}},'vidaooMetadata':{'type':Sequelize[_0xbddf('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xbddf('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x987c=['Skip','Feedback','thumb','star','TEXT','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','textarea','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','ENUM','squared','rounded','We\x20are\x20here!','Send','INTEGER','Powered\x20by\x20xCALLY','BOOLEAN','Form\x20properly\x20submitted','Form\x20submission\x20error','Thanks\x20you\x20for\x20your\x20time!'];(function(_0x124a1e,_0x5d61be){var _0x15bc7a=function(_0x178bf1){while(--_0x178bf1){_0x124a1e['push'](_0x124a1e['shift']());}};_0x15bc7a(++_0x5d61be);}(_0x987c,0x144));var _0xc987=function(_0x4367d3,_0x4d531a){_0x4367d3=_0x4367d3-0x0;var _0x2d75b1=_0x987c[_0x4367d3];return _0x2d75b1;};'use strict';var Sequelize=require(_0xc987('0x0'));var rs=require(_0xc987('0x1'));module[_0xc987('0x2')]={'name':{'type':Sequelize[_0xc987('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc987('0x4')},'description':{'type':Sequelize[_0xc987('0x3')]},'mapKey':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x5')},'mapKeyOffline':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x5')},'key':{'type':Sequelize[_0xc987('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x6')},'customerAlias':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xc987('0x3')],'allowNull':![],'defaultValue':_0xc987('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xc987('0x3')],'allowNull':![],'defaultValue':_0xc987('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xc987('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xc987('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xc987('0x3')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xc987('0x8')]('rounded',_0xc987('0x9')),'defaultValue':_0xc987('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0xc987('0xb')},'start_chat_button':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0xc')},'header_offline':{'type':Sequelize['STRING'],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xc987('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xc987('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x11')},'noteTitle':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x12')},'closingMessageButton':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0xc')},'skipMessageButton':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x13')},'conditionAgreement':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x14')},'ratingType':{'type':Sequelize[_0xc987('0x8')]('star',_0xc987('0x15')),'defaultValue':_0xc987('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xc987('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xc987('0x17')],'defaultValue':function(){return JSON[_0xc987('0x18')]({'items':[{'type':_0xc987('0x19'),'variable':null,'config':{'placeholder':_0xc987('0x1a'),'type':_0xc987('0x1b'),'required':!![]},'props':{'title':_0xc987('0x1a'),'helpText':''}},{'type':_0xc987('0x19'),'props':{'title':_0xc987('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc987('0x5'),'type':_0xc987('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0xc987('0x1c'))?JSON[_0xc987('0x1d')](this[_0xc987('0x1e')]('onlineForm')):{};},'set':function(_0x23859a){return this[_0xc987('0x1f')](_0xc987('0x1c'),JSON[_0xc987('0x18')](_0x23859a));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xc987('0x18')]({'items':[{'type':_0xc987('0x19'),'props':{'title':_0xc987('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xc987('0x5'),'type':_0xc987('0x5')},'variable':null},{'type':_0xc987('0x20'),'config':{'placeholder':'Comments'},'props':{'title':_0xc987('0x21'),'helpText':_0xc987('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0xc987('0x1e')]('offlineForm')?JSON[_0xc987('0x1d')](this[_0xc987('0x1e')](_0xc987('0x23'))):{};},'set':function(_0x4ac230){return this[_0xc987('0x1f')](_0xc987('0x23'),JSON[_0xc987('0x18')](_0x4ac230));}},'token':{'type':Sequelize[_0xc987('0x3')],'defaultValue':function(){return rs[_0xc987('0x24')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xc987('0x3')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xc987('0x3')]},'waitingTitle':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x25')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xc987('0x26')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xc987('0x13')},'sendUnmanaged':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xc987('0x17')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0xc987('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc987('0x17')],'defaultValue':function(){return _0xc987('0x27');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x28')},'waitForTheAssignedAgent':{'type':Sequelize[_0xc987('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc987('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xc987('0x29')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xc987('0x3')],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xc987('0x2a')},'defaultTitle':{'type':Sequelize[_0xc987('0x3')]},'customerAvatar':{'type':Sequelize[_0xc987('0x17')]},'showCustomerAvatar':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xc987('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xc987('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xc987('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc987('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xc987('0x3')],'defaultValue':_0xc987('0x2b')},'systemAvatar':{'type':Sequelize[_0xc987('0x17')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xc987('0x2c')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xc987('0x2d'),'set':function(_0x3791a5){if(!_0x3791a5)this[_0xc987('0x1f')](_0xc987('0x2e'),null);this['setDataValue'](_0xc987('0x2f'),_0x3791a5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xc987('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xc987('0x30');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xc987('0xf')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xc987('0x17')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 02c4609..a4989fb 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 _0x2123=['offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','findOne','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','email','MailAccountId','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','Chat','notifyMail','server','attachments','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','server/files/chat/iframe.ejs','3.10.1','origin','testWebsiteWithWildcard','x-real-ip','connection','remoteAddress','replace','render','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','stack','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','json','offset','undefined','limit','count','set','update','get','ChatWebsites','UserProfileResource','destroy','end','name','send','user-agent-parser','user-agent','getResult','customerIp','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','format','%s\x20%s','version','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','mandatoryDispositionPause','map','rawAttributes','fieldName','query','keys','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','ChatWebsite','includeAll','include','findAll','show','Pause','intersection','find','create','body','address','forEach','trim','testWildcardValidity','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','params','describe','ChatWebsiteId','Disposition','getDispositions','length','pick','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','filename','addAvatar','agentAvatar','file','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','root','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','timezone','ifTime','notify','chat','from','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','mapKey','CmList','List','CmContact','ChatApplication','Intervals','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','applications','orderBy','Applications','priority','asc','account','list','Contacts','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','unshift','waitForTheAssignedQueue','Start','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype'];(function(_0x3d1ed2,_0x4975c3){var _0x39b31c=function(_0x23630c){while(--_0x23630c){_0x3d1ed2['push'](_0x3d1ed2['shift']());}};_0x39b31c(++_0x4975c3);}(_0x2123,0x190));var _0x3212=function(_0x115e68,_0x26a20a){_0x115e68=_0x115e68-0x0;var _0x1510be=_0x2123[_0x115e68];return _0x1510be;};'use strict';var Mustache=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var ejs=require(_0x3212('0x3'));var fs=require('fs');var fs_extra=require(_0x3212('0x4'));var _=require(_0x3212('0x5'));var querystring=require(_0x3212('0x6'));var htmlToText=require(_0x3212('0x7'));var Redis=require(_0x3212('0x8'));var jayson=require(_0x3212('0x9'));var qs=require(_0x3212('0xa'));var logger=require(_0x3212('0xb'))('api');var config=require(_0x3212('0xc'));var APIBadRequestError=require(_0x3212('0xd'))[_0x3212('0xe')];var APINotFoundError=require('../../errors/api')[_0x3212('0xf')];var APIOutOfIntervalError=require('../../errors/api')[_0x3212('0x10')];var APIHandleError=require(_0x3212('0xd'))[_0x3212('0x11')];var APIConflictError=require(_0x3212('0xd'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x3212('0x12'))[_0x3212('0x13')];var db=require(_0x3212('0x14'))['db'];config[_0x3212('0x15')]=_[_0x3212('0x16')](config[_0x3212('0x15')],{'host':_0x3212('0x17'),'port':0x18eb});var socket=require(_0x3212('0x18'))(new Redis(config[_0x3212('0x15')]));require(_0x3212('0x19'))[_0x3212('0x1a')](socket);var client=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x232c});var client9002=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x232a});var client9003=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x232b});var client9001=jayson[_0x3212('0x1b')][_0x3212('0x1c')]({'port':0x2329});function respondWithRpcPromise(_0x46c5f5,_0x42069c,_0x1ef2f7,_0x5b2ab8){return new Promise(function(_0x43a642,_0x1719a5){var _0x2720c6=_0x5b2ab8||client;return _0x2720c6[_0x3212('0x1d')](_0x46c5f5,_0x1ef2f7)[_0x3212('0x1e')](function(_0x34ce95){logger[_0x3212('0x1f')]('ChatWebsite,\x20%s,\x20%s',_0x42069c,'request\x20sent');logger[_0x3212('0x20')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x42069c,_0x3212('0x21'),JSON[_0x3212('0x22')](_0x34ce95));if(_0x34ce95[_0x3212('0x23')]){if(_0x34ce95[_0x3212('0x23')][_0x3212('0x24')]===0x1f4){logger['error'](_0x3212('0x25'),_0x42069c,_0x34ce95[_0x3212('0x23')]['message']);return _0x1719a5(_0x34ce95[_0x3212('0x23')][_0x3212('0x26')]);}logger[_0x3212('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x42069c,_0x34ce95['error'][_0x3212('0x26')]);return _0x43a642(_0x34ce95[_0x3212('0x23')][_0x3212('0x26')]);}else{logger[_0x3212('0x1f')](_0x3212('0x25'),_0x42069c,_0x3212('0x21'));_0x43a642(_0x34ce95['result']['message']);}})[_0x3212('0x27')](function(_0x47cfdc){logger[_0x3212('0x23')](_0x3212('0x25'),_0x42069c,_0x47cfdc);_0x1719a5(_0x47cfdc);});});}function respondWithStatusCode(_0x3319d0,_0x5bb0a5){_0x5bb0a5=_0x5bb0a5||0xcc;return function(_0x2d1b92){if(_0x2d1b92){return _0x3319d0[_0x3212('0x28')](_0x5bb0a5);}return _0x3319d0[_0x3212('0x29')](_0x5bb0a5)['end']();};}function respondWithResult(_0x206980,_0x35b4eb){_0x35b4eb=_0x35b4eb||0xc8;return function(_0x108eee){if(_0x108eee){return _0x206980[_0x3212('0x29')](_0x35b4eb)[_0x3212('0x2a')](_0x108eee);}};}function respondWithFilteredResult(_0x1638c5,_0x16df03){return function(_0x3813a3){if(_0x3813a3){var _0x1de338=typeof _0x16df03[_0x3212('0x2b')]===_0x3212('0x2c')&&typeof _0x16df03[_0x3212('0x2d')]==='undefined';var _0x1e2660=_0x3813a3[_0x3212('0x2e')];var _0x4726fb=_0x1de338?0x0:_0x16df03[_0x3212('0x2b')];var _0x402a01=_0x1de338?_0x3813a3[_0x3212('0x2e')]:_0x16df03[_0x3212('0x2b')]+_0x16df03['limit'];var _0x3cbd1a;if(_0x402a01>=_0x1e2660){_0x402a01=_0x1e2660;_0x3cbd1a=0xc8;}else{_0x3cbd1a=0xce;}_0x1638c5['status'](_0x3cbd1a);return _0x1638c5[_0x3212('0x2f')]('Content-Range',_0x4726fb+'-'+_0x402a01+'/'+_0x1e2660)[_0x3212('0x2a')](_0x3813a3);}return null;};}function saveUpdates(_0x4ddc8f){return function(_0x4d17bb){if(_0x4d17bb){return _0x4d17bb[_0x3212('0x30')](_0x4ddc8f)['then'](function(_0x294422){return _0x294422;});}return null;};}function removeEntity(_0x3754ce){return function(_0x2c664b){if(_0x2c664b){return _0x2c664b['destroy']()[_0x3212('0x1e')](function(){var _0x412740=_0x2c664b[_0x3212('0x31')]({'plain':!![]});var _0x487ce4=_0x3212('0x32');return db[_0x3212('0x33')][_0x3212('0x34')]({'where':{'type':_0x487ce4,'resourceId':_0x412740['id']}})[_0x3212('0x1e')](function(){return _0x2c664b;});})[_0x3212('0x1e')](function(){_0x3754ce['status'](0xcc)[_0x3212('0x35')]();});}};}function handleEntityNotFound(_0x3fc885){return function(_0x422b7b){if(!_0x422b7b){_0x3fc885['sendStatus'](0x194);}return _0x422b7b;};}function handleError(_0x42f481,_0x410961){_0x410961=_0x410961||0x1f4;return function(_0x40a602){logger[_0x3212('0x23')](_0x40a602['stack']);if(_0x40a602[_0x3212('0x36')]){delete _0x40a602[_0x3212('0x36')];}_0x42f481[_0x3212('0x29')](_0x410961)[_0x3212('0x37')](_0x40a602);};}function createInteractionObject(_0x5ae0cc,_0x4e5349,_0x539b7a,_0x540dfc){var _0xb2908a=require(_0x3212('0x38'));var _0x3f8018=new _0xb2908a();var _0x87587d=_0x3f8018['setUA'](_0x539b7a[_0x3212('0x39')])[_0x3212('0x3a')]();var _0x18e20=_0x4e5349[_0x3212('0x3b')];if(_0x539b7a['cf-connecting-ip']){_0x18e20=_0x539b7a['cf-connecting-ip'];}else if(_0x539b7a[_0x3212('0x3c')]){_0x18e20=_[_0x3212('0x3d')](_0x539b7a[_0x3212('0x3c')][_0x3212('0x3e')](','));}return{'ContactId':_0x540dfc['id'],'ChatWebsiteId':_0x5ae0cc,'from':(_0x540dfc[_0x3212('0x3f')]||'')+'\x20'+(_0x540dfc[_0x3212('0x40')]||''),'customerIp':_0x18e20,'customerPort':_0x539b7a[_0x3212('0x41')]?_0x539b7a['x-real-port']:null,'referer':_0x4e5349[_0x3212('0x42')],'browserName':_0x87587d[_0x3212('0x43')][_0x3212('0x36')]&&_0x87587d[_0x3212('0x43')]['version']?util[_0x3212('0x44')](_0x3212('0x45'),_0x87587d[_0x3212('0x43')][_0x3212('0x36')],_0x87587d['browser'][_0x3212('0x46')]):'unknown','browserVersion':_0x87587d[_0x3212('0x43')][_0x3212('0x46')]||_0x3212('0x47'),'osName':util[_0x3212('0x44')](_0x3212('0x45'),_0x87587d['os'][_0x3212('0x36')],_0x87587d['os'][_0x3212('0x46')]),'osVersion':_0x87587d['os'][_0x3212('0x46')],'deviceModel':_0x87587d['device'][_0x3212('0x48')]&&_0x87587d[_0x3212('0x49')][_0x3212('0x4a')]?util[_0x3212('0x44')](_0x3212('0x4b'),_0x87587d[_0x3212('0x49')][_0x3212('0x48')],_0x87587d['device'][_0x3212('0x4a')],_0x87587d[_0x3212('0x49')][_0x3212('0x4c')]):null,'deviceVendor':_0x87587d[_0x3212('0x49')]['vendor'],'deviceType':_0x87587d['device']['type'],'formData':JSON['stringify'](_0x4e5349)};}exports[_0x3212('0x4d')]=function(_0x5b1fc5,_0x22de3d){var _0x661418={'include':[{'model':db['Pause'],'as':_0x3212('0x4e')}]},_0xa6854f={},_0x29f95c={'count':0x0,'rows':[]};var _0xb7124f=_[_0x3212('0x4f')](db['ChatWebsite'][_0x3212('0x50')],function(_0x341286){return{'name':_0x341286[_0x3212('0x51')],'type':_0x341286[_0x3212('0x4c')]['key']};});_0xa6854f[_0x3212('0x48')]=_[_0x3212('0x4f')](_0xb7124f,'name');_0xa6854f[_0x3212('0x52')]=_[_0x3212('0x53')](_0x5b1fc5[_0x3212('0x52')]);_0xa6854f['filters']=_['intersection'](_0xa6854f[_0x3212('0x48')],_0xa6854f[_0x3212('0x52')]);_0x661418[_0x3212('0x54')]=_['intersection'](_0xa6854f[_0x3212('0x48')],qs[_0x3212('0x55')](_0x5b1fc5['query'][_0x3212('0x55')]));_0x661418[_0x3212('0x54')]=_0x661418[_0x3212('0x54')]['length']?_0x661418['attributes']:_0xa6854f[_0x3212('0x48')];if(!_0x5b1fc5[_0x3212('0x52')][_0x3212('0x56')](_0x3212('0x57'))){_0x661418['limit']=qs[_0x3212('0x2d')](_0x5b1fc5[_0x3212('0x52')][_0x3212('0x2d')]);_0x661418['offset']=qs[_0x3212('0x2b')](_0x5b1fc5['query'][_0x3212('0x2b')]);}_0x661418[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x5b1fc5[_0x3212('0x52')]['sort']);_0x661418[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_['pick'](_0x5b1fc5[_0x3212('0x52')],_0xa6854f[_0x3212('0x5b')]),_0xb7124f);if(_0x5b1fc5[_0x3212('0x52')][_0x3212('0x5c')]){_0x661418[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x661418[_0x3212('0x5a')],{'$or':_['map'](_0xb7124f,function(_0xe5878d){if(_0xe5878d[_0x3212('0x4c')]!==_0x3212('0x5e')){var _0x8f9c82={};_0x8f9c82[_0xe5878d['name']]={'$like':'%'+_0x5b1fc5['query']['filter']+'%'};return _0x8f9c82;}})});}_0x661418=_['merge']({},_0x661418,_0x5b1fc5[_0x3212('0x5f')]);var _0x5eb862={'where':_0x661418[_0x3212('0x5a')]};return db[_0x3212('0x60')][_0x3212('0x2e')](_0x5eb862)[_0x3212('0x1e')](function(_0xdf24b8){_0x29f95c[_0x3212('0x2e')]=_0xdf24b8;if(_0x5b1fc5[_0x3212('0x52')][_0x3212('0x61')]){_0x661418[_0x3212('0x62')]=[{'all':!![]}];}return db[_0x3212('0x60')][_0x3212('0x63')](_0x661418);})['then'](function(_0x51751b){_0x29f95c['rows']=_0x51751b;return _0x29f95c;})[_0x3212('0x1e')](respondWithFilteredResult(_0x22de3d,_0x661418))[_0x3212('0x27')](handleError(_0x22de3d,null));};exports[_0x3212('0x64')]=function(_0x4228b7,_0x3f1e7c){var _0x81656={'raw':![],'where':{'id':_0x4228b7['params']['id']},'include':[{'model':db[_0x3212('0x65')],'as':_0x3212('0x4e')}]},_0x4b60cf={};_0x4b60cf['model']=_['keys'](db[_0x3212('0x60')][_0x3212('0x50')]);_0x4b60cf['query']=_[_0x3212('0x53')](_0x4228b7[_0x3212('0x52')]);_0x4b60cf[_0x3212('0x5b')]=_[_0x3212('0x66')](_0x4b60cf[_0x3212('0x48')],_0x4b60cf['query']);_0x81656[_0x3212('0x54')]=_[_0x3212('0x66')](_0x4b60cf[_0x3212('0x48')],qs[_0x3212('0x55')](_0x4228b7['query'][_0x3212('0x55')]));_0x81656[_0x3212('0x54')]=_0x81656[_0x3212('0x54')]['length']?_0x81656[_0x3212('0x54')]:_0x4b60cf[_0x3212('0x48')];if(_0x4228b7[_0x3212('0x52')][_0x3212('0x61')]){_0x81656['include']=[{'all':!![]}];}_0x81656=_[_0x3212('0x5d')]({},_0x81656,_0x4228b7[_0x3212('0x5f')]);return db[_0x3212('0x60')][_0x3212('0x67')](_0x81656)['then'](handleEntityNotFound(_0x3f1e7c,null))[_0x3212('0x1e')](respondWithResult(_0x3f1e7c,null))[_0x3212('0x27')](handleError(_0x3f1e7c,null));};exports[_0x3212('0x68')]=function(_0x116301,_0x5c39b2){var _0x30c039=null;_0x116301[_0x3212('0x69')][_0x3212('0x6a')][_0x3212('0x3e')](',')[_0x3212('0x6b')](_0x3ae978=>{if(_0x3ae978[_0x3212('0x6c')]()!==''&&!wildcardUtils[_0x3212('0x6d')](_0x3ae978[_0x3212('0x6c')]())){_0x30c039=new APIBadRequestError('\x22'+_0x3ae978['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x30c039){return handleError(_0x5c39b2,null)(_0x30c039);}return db[_0x3212('0x60')][_0x3212('0x68')](_0x116301['body'],{})[_0x3212('0x1e')](function(_0x241551){var _0x46dff8=_0x116301[_0x3212('0x6e')]['get']({'plain':!![]});if(!_0x46dff8)throw new Error(_0x3212('0x6f'));if(_0x46dff8[_0x3212('0x70')]===_0x3212('0x6e')){var _0x1298d5=_0x241551[_0x3212('0x31')]({'plain':!![]});var _0x3f92c1='ChatWebsites';return db[_0x3212('0x71')][_0x3212('0x67')]({'where':{'name':_0x3f92c1,'userProfileId':_0x46dff8['userProfileId']},'raw':!![]})['then'](function(_0xa2962b){if(_0xa2962b&&_0xa2962b[_0x3212('0x72')]===0x0){return db[_0x3212('0x33')][_0x3212('0x68')]({'name':_0x1298d5[_0x3212('0x36')],'resourceId':_0x1298d5['id'],'type':_0xa2962b['name'],'sectionId':_0xa2962b['id']},{})[_0x3212('0x1e')](function(){return _0x241551;});}else{return _0x241551;}})[_0x3212('0x27')](function(_0x5b2a69){logger[_0x3212('0x23')](_0x3212('0x73'),_0x5b2a69);throw _0x5b2a69;});}return _0x241551;})['then'](respondWithResult(_0x5c39b2,0xc9))[_0x3212('0x27')](handleError(_0x5c39b2,null));};exports[_0x3212('0x30')]=function(_0x1653b0,_0x4f1c35){var _0x304e0a=null;_0x1653b0['body']['address']['split'](',')[_0x3212('0x6b')](_0x4a6d23=>{if(_0x4a6d23[_0x3212('0x6c')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x4a6d23[_0x3212('0x6c')]())){_0x304e0a=new APIBadRequestError('\x22'+_0x4a6d23[_0x3212('0x6c')]()+_0x3212('0x74'));}});if(_0x304e0a){return handleError(_0x4f1c35,null)(_0x304e0a);}if(_0x1653b0[_0x3212('0x69')]['id']){delete _0x1653b0[_0x3212('0x69')]['id'];}return db['ChatWebsite'][_0x3212('0x67')]({'where':{'id':_0x1653b0[_0x3212('0x75')]['id']},'include':[{'model':db[_0x3212('0x65')],'as':_0x3212('0x4e')}]})[_0x3212('0x1e')](handleEntityNotFound(_0x4f1c35,null))[_0x3212('0x1e')](saveUpdates(_0x1653b0['body'],null))[_0x3212('0x1e')](respondWithResult(_0x4f1c35,null))[_0x3212('0x27')](handleError(_0x4f1c35,null));};exports[_0x3212('0x34')]=function(_0x1d9afc,_0x45c5ec){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x1d9afc[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x45c5ec,null))[_0x3212('0x1e')](removeEntity(_0x45c5ec,null))['catch'](handleError(_0x45c5ec,null));};exports['describe']=function(_0x10e970,_0x301b41){return db['ChatWebsite'][_0x3212('0x76')]()['then'](respondWithResult(_0x301b41,null))['catch'](handleError(_0x301b41,null));};exports['addDisposition']=function(_0x4e307d,_0x4f70b2){if(_0x4e307d['body']['id']){delete _0x4e307d['body']['id'];}return db[_0x3212('0x60')]['find']({'where':{'id':_0x4e307d[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x4f70b2,null))[_0x3212('0x1e')](function(_0x295c99){if(_0x295c99){_0x4e307d[_0x3212('0x69')][_0x3212('0x77')]=_0x295c99['id'];return db[_0x3212('0x78')][_0x3212('0x68')](_0x4e307d[_0x3212('0x69')]);}})[_0x3212('0x1e')](respondWithResult(_0x4f70b2,null))[_0x3212('0x27')](handleError(_0x4f70b2,null));};exports[_0x3212('0x79')]=function(_0x177a58,_0x578101){var _0x7110c1={'raw':![],'where':{}};var _0x4c8dc8={};var _0x114d34={'count':0x0,'rows':[]};return db[_0x3212('0x60')]['findOne']({'where':{'id':_0x177a58['params']['id']}})['then'](handleEntityNotFound(_0x578101,null))[_0x3212('0x1e')](function(_0x4f63fa){if(_0x4f63fa){_0x4c8dc8['model']=_[_0x3212('0x53')](db[_0x3212('0x78')][_0x3212('0x50')]);_0x4c8dc8[_0x3212('0x52')]=_[_0x3212('0x53')](_0x177a58[_0x3212('0x52')]);_0x4c8dc8['filters']=_['intersection'](_0x4c8dc8['model'],_0x4c8dc8['query']);_0x7110c1[_0x3212('0x54')]=_[_0x3212('0x66')](_0x4c8dc8['model'],qs['fields'](_0x177a58['query'][_0x3212('0x55')]));_0x7110c1['attributes']=_0x7110c1[_0x3212('0x54')][_0x3212('0x7a')]?_0x7110c1[_0x3212('0x54')]:_0x4c8dc8[_0x3212('0x48')];if(!_0x177a58[_0x3212('0x52')][_0x3212('0x56')](_0x3212('0x57'))){_0x7110c1[_0x3212('0x2d')]=qs['limit'](_0x177a58[_0x3212('0x52')][_0x3212('0x2d')]);_0x7110c1[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0x177a58[_0x3212('0x52')]['offset']);}_0x7110c1[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x177a58['query'][_0x3212('0x59')]);_0x7110c1[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x177a58[_0x3212('0x52')],_0x4c8dc8[_0x3212('0x5b')]));_0x7110c1[_0x3212('0x5a')]['ChatWebsiteId']=_0x4f63fa['id'];if(_0x177a58[_0x3212('0x52')][_0x3212('0x5c')]){_0x7110c1[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x7110c1[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x7110c1[_0x3212('0x54')],function(_0x22c08b){var _0x2509f9={};_0x2509f9[_0x22c08b]={'$like':'%'+_0x177a58[_0x3212('0x52')]['filter']+'%'};return _0x2509f9;})});}_0x7110c1=_[_0x3212('0x5d')]({},_0x7110c1,_0x177a58[_0x3212('0x5f')]);return db['Disposition']['count']({'where':_0x7110c1['where']})[_0x3212('0x1e')](function(_0x4e6b83){_0x114d34[_0x3212('0x2e')]=_0x4e6b83;if(_0x177a58['query']['includeAll']){_0x7110c1[_0x3212('0x62')]=[{'all':!![]}];}return db['Disposition'][_0x3212('0x63')](_0x7110c1);})[_0x3212('0x1e')](function(_0x836bb8){_0x114d34[_0x3212('0x7c')]=_0x836bb8;return _0x114d34;});}})['then'](respondWithFilteredResult(_0x578101,_0x7110c1))[_0x3212('0x27')](handleError(_0x578101,null));};exports[_0x3212('0x7d')]=function(_0x415288,_0x480fae){return db[_0x3212('0x60')]['find']({'where':{'id':_0x415288[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x480fae,null))[_0x3212('0x1e')](function(_0x2fe8f6){if(_0x2fe8f6){return _0x2fe8f6['removeDispositions'](_0x415288[_0x3212('0x52')][_0x3212('0x7e')]);}})[_0x3212('0x1e')](respondWithStatusCode(_0x480fae,null))[_0x3212('0x27')](handleError(_0x480fae,null));};exports[_0x3212('0x7f')]=function(_0x374c2,_0x3a9749){if(_0x374c2[_0x3212('0x69')]['id']){delete _0x374c2['body']['id'];}return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x374c2['params']['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x3a9749,null))[_0x3212('0x1e')](function(_0x3650af){if(_0x3650af){_0x374c2[_0x3212('0x69')][_0x3212('0x77')]=_0x3650af['id'];return db['CannedAnswer'][_0x3212('0x68')](_0x374c2[_0x3212('0x69')]);}})[_0x3212('0x1e')](respondWithResult(_0x3a9749,null))[_0x3212('0x27')](handleError(_0x3a9749,null));};exports[_0x3212('0x80')]=function(_0x5dc8d1,_0x56612b){var _0x2aa5d5={'raw':![],'where':{}};var _0x5735e7={};var _0x285fb0={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x5dc8d1[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x56612b,null))[_0x3212('0x1e')](function(_0x589c12){if(_0x589c12){_0x5735e7[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0x81')][_0x3212('0x50')]);_0x5735e7[_0x3212('0x52')]=_[_0x3212('0x53')](_0x5dc8d1[_0x3212('0x52')]);_0x5735e7[_0x3212('0x5b')]=_[_0x3212('0x66')](_0x5735e7['model'],_0x5735e7[_0x3212('0x52')]);_0x2aa5d5[_0x3212('0x54')]=_[_0x3212('0x66')](_0x5735e7['model'],qs[_0x3212('0x55')](_0x5dc8d1[_0x3212('0x52')][_0x3212('0x55')]));_0x2aa5d5[_0x3212('0x54')]=_0x2aa5d5[_0x3212('0x54')][_0x3212('0x7a')]?_0x2aa5d5[_0x3212('0x54')]:_0x5735e7[_0x3212('0x48')];if(!_0x5dc8d1['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x2aa5d5[_0x3212('0x2d')]=qs[_0x3212('0x2d')](_0x5dc8d1[_0x3212('0x52')][_0x3212('0x2d')]);_0x2aa5d5[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0x5dc8d1[_0x3212('0x52')][_0x3212('0x2b')]);}_0x2aa5d5[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x5dc8d1[_0x3212('0x52')]['sort']);_0x2aa5d5[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x5dc8d1[_0x3212('0x52')],_0x5735e7[_0x3212('0x5b')]));_0x2aa5d5[_0x3212('0x5a')][_0x3212('0x77')]=_0x589c12['id'];if(_0x5dc8d1[_0x3212('0x52')]['filter']){_0x2aa5d5[_0x3212('0x5a')]=_['merge'](_0x2aa5d5[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x2aa5d5[_0x3212('0x54')],function(_0x4ae27a){var _0x5df8f9={};_0x5df8f9[_0x4ae27a]={'$like':'%'+_0x5dc8d1['query'][_0x3212('0x5c')]+'%'};return _0x5df8f9;})});}_0x2aa5d5=_[_0x3212('0x5d')]({},_0x2aa5d5,_0x5dc8d1['options']);return db[_0x3212('0x81')][_0x3212('0x2e')]({'where':_0x2aa5d5[_0x3212('0x5a')]})[_0x3212('0x1e')](function(_0x42b39a){_0x285fb0[_0x3212('0x2e')]=_0x42b39a;if(_0x5dc8d1[_0x3212('0x52')][_0x3212('0x61')]){_0x2aa5d5['include']=[{'all':!![]}];}return db[_0x3212('0x81')][_0x3212('0x63')](_0x2aa5d5);})[_0x3212('0x1e')](function(_0x162a7d){_0x285fb0[_0x3212('0x7c')]=_0x162a7d;return _0x285fb0;});}})['then'](respondWithFilteredResult(_0x56612b,_0x2aa5d5))[_0x3212('0x27')](handleError(_0x56612b,null));};exports[_0x3212('0x82')]=function(_0x1e3424,_0x2d3563){return db[_0x3212('0x60')]['find']({'where':{'id':_0x1e3424[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x2d3563,null))['then'](function(_0x5671c3){if(_0x5671c3){return _0x5671c3['removeAnswers'](_0x1e3424[_0x3212('0x52')][_0x3212('0x7e')]);}})[_0x3212('0x1e')](respondWithStatusCode(_0x2d3563,null))[_0x3212('0x27')](handleError(_0x2d3563,null));};exports[_0x3212('0x83')]=function(_0x3e3499,_0x161ca1){_0x3e3499[_0x3212('0x69')]['sitepic']=_0x3e3499['file'][_0x3212('0x84')];return db[_0x3212('0x60')]['find']({'where':{'id':_0x3e3499[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x161ca1,null))['then'](saveUpdates(_0x3e3499[_0x3212('0x69')],null))['then'](respondWithResult(_0x161ca1,null))['catch'](handleError(_0x161ca1,null));};exports[_0x3212('0x85')]=function(_0x3429ca,_0x11c234){_0x3429ca[_0x3212('0x69')][_0x3212('0x86')]=_0x3429ca[_0x3212('0x87')]['filename'];return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x3429ca['params']['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x11c234,null))[_0x3212('0x1e')](saveUpdates(_0x3429ca[_0x3212('0x69')],null))['then'](respondWithResult(_0x11c234,null))[_0x3212('0x27')](handleError(_0x11c234,null));};exports['addCustomerAvatar']=function(_0x14ff48,_0x584b80){_0x14ff48['body']['customerAvatar']=_0x14ff48[_0x3212('0x87')][_0x3212('0x84')];return db['ChatWebsite'][_0x3212('0x67')]({'where':{'id':_0x14ff48[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x584b80,null))[_0x3212('0x1e')](saveUpdates(_0x14ff48[_0x3212('0x69')],null))[_0x3212('0x1e')](respondWithResult(_0x584b80,null))[_0x3212('0x27')](handleError(_0x584b80,null));};exports[_0x3212('0x88')]=function(_0x272cec,_0x5746b9){_0x272cec[_0x3212('0x69')][_0x3212('0x89')]=_0x272cec[_0x3212('0x87')][_0x3212('0x84')];return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x272cec[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x5746b9,null))[_0x3212('0x1e')](saveUpdates(_0x272cec[_0x3212('0x69')],null))[_0x3212('0x1e')](respondWithResult(_0x5746b9,null))[_0x3212('0x27')](handleError(_0x5746b9,null));};exports[_0x3212('0x8a')]=function(_0x4ef7ae,_0x582479){var _0x13441a=path[_0x3212('0x8b')](config['root'],_0x3212('0x8c'));var _0x5e493f={'where':{'id':_0x4ef7ae[_0x3212('0x75')]['id']},'attributes':['id',_0x3212('0x8d')],'raw':!![]};var _0x5b77cf=![];return require(_0x3212('0x8e'))[_0x3212('0x8f')]()[_0x3212('0x1e')](function(_0x397ecc){if(_0x397ecc){_0x5b77cf=_0x397ecc[_0x3212('0x90')];}})['then'](function(){return db[_0x3212('0x60')][_0x3212('0x67')](_0x5e493f);})[_0x3212('0x1e')](handleEntityNotFound(_0x582479,null))[_0x3212('0x1e')](function(_0x5f5ceb){if(_0x5f5ceb){if(!_[_0x3212('0x91')](_0x5f5ceb[_0x3212('0x8d')])){if(fs[_0x3212('0x92')](path[_0x3212('0x8b')](config['root'],_0x3212('0x93'),_0x5f5ceb['sitepic']))&&_0x5b77cf){_0x13441a=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x93'),_0x5f5ceb['sitepic']);}}return _0x582479[_0x3212('0x95')](_0x13441a);}})['catch'](handleError(_0x582479,null));};exports['getAvatar']=function(_0x4ab1c5,_0x2c895a){var _0x211434=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x96'));var _0x59bc64={'where':{'id':_0x4ab1c5[_0x3212('0x75')]['id']},'attributes':['id',_0x3212('0x86')],'raw':!![]};return db[_0x3212('0x60')]['find'](_0x59bc64)[_0x3212('0x1e')](handleEntityNotFound(_0x2c895a,null))[_0x3212('0x1e')](function(_0xfabca5){if(_0xfabca5){if(!_['isNil'](_0xfabca5[_0x3212('0x86')])){if(fs[_0x3212('0x92')](path[_0x3212('0x8b')](config[_0x3212('0x94')],'server/files/images/avatars/',_0xfabca5[_0x3212('0x86')]))){_0x211434=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x97'),_0xfabca5[_0x3212('0x86')]);}}return _0x2c895a[_0x3212('0x95')](_0x211434);}})[_0x3212('0x27')](handleError(_0x2c895a,null));};exports[_0x3212('0x98')]=function(_0x150df7,_0x114f32){var _0x2e7a06=path['join'](config[_0x3212('0x94')],_0x3212('0x99'));var _0x248809={'where':{'id':_0x150df7['params']['id']},'attributes':['id',_0x3212('0x9a'),'showCustomerAvatar'],'raw':!![]};return db[_0x3212('0x60')][_0x3212('0x67')](_0x248809)[_0x3212('0x1e')](handleEntityNotFound(_0x114f32,null))[_0x3212('0x1e')](function(_0x484a1c){if(_0x484a1c){if(!_['isNil'](_0x484a1c[_0x3212('0x9a')])){if(fs['existsSync'](path['join'](config[_0x3212('0x94')],_0x3212('0x97'),_0x484a1c[_0x3212('0x9a')]))&&_0x484a1c['showCustomerAvatar']){_0x2e7a06=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x97'),_0x484a1c['customerAvatar']);}}return _0x114f32[_0x3212('0x95')](_0x2e7a06);}})[_0x3212('0x27')](handleError(_0x114f32,null));};exports['getSystemAvatar']=function(_0x421019,_0x38bfb7){var _0x39b919=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x9b'));var _0x36cd12={'where':{'id':_0x421019[_0x3212('0x75')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x3212('0x60')][_0x3212('0x67')](_0x36cd12)[_0x3212('0x1e')](handleEntityNotFound(_0x38bfb7,null))['then'](function(_0x58ddce){if(_0x58ddce){if(!_['isNil'](_0x58ddce[_0x3212('0x89')])){if(fs[_0x3212('0x92')](path[_0x3212('0x8b')](config['root'],_0x3212('0x97'),_0x58ddce[_0x3212('0x89')]))){_0x39b919=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x97'),_0x58ddce[_0x3212('0x89')]);}}return _0x38bfb7[_0x3212('0x95')](_0x39b919);}})[_0x3212('0x27')](handleError(_0x38bfb7,null));};function checkWebsiteInterval(_0x117d5e){var _0x3f5c7a=_0x117d5e[_0x3212('0x9c')];if(!_0x3f5c7a){return Promise[_0x3212('0x9d')](_0x117d5e);}var _0x23c357=_0x117d5e[_0x3212('0x9e')]||undefined;return _0x3f5c7a[_0x3212('0x9f')](_0x23c357)['then'](function(_0x5410ee){if(!_0x5410ee){throw new APIOutOfIntervalError();}return _0x117d5e;});}exports[_0x3212('0xa0')]=function(_0x276440,_0x50ed8d){var _0x151c1b={'body':_0x276440['body'],'channel':_0x3212('0xa1')};var _0x52a17c=[];var _0x2416bb=[];var _0x299400={};var _0x5f6c86=![];if(_0x276440[_0x3212('0x69')]['id']){delete _0x276440[_0x3212('0x69')]['id'];}if(_[_0x3212('0x91')](_0x276440[_0x3212('0x69')][_0x3212('0xa2')])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x3212('0x91')](_0x276440[_0x3212('0x69')]['mapKey'])){throw new APIBadRequestError(_0x3212('0xa3'));}if(_['isEmpty'](_0x276440[_0x3212('0x69')]['body'])){throw new APIBadRequestError(_0x3212('0xa4'));}var _0x99efa3=_0x276440[_0x3212('0x69')][_0x3212('0x3b')]&&_0x276440[_0x3212('0x69')][_0x3212('0x42')];return db['CmContact'][_0x3212('0x76')]()[_0x3212('0x1e')](function(_0x2b4188){if(!_0x2b4188){throw new Error('No\x20available\x20attributes');}_0x52a17c=Object[_0x3212('0x53')](_0x2b4188)[_0x3212('0x5c')](function(_0xaa863f){return![_0x3212('0xa5'),_0x3212('0xa6')][_0x3212('0xa7')](_0xaa863f);});_0x2416bb=Object[_0x3212('0x53')](_0x2b4188)[_0x3212('0x5c')](function(_0x2ae201){return![_0x3212('0xa5'),_0x3212('0xa6'),_0x3212('0xa8'),_0x3212('0xa9')]['includes'](_0x2ae201);});if(!_['includes'](_0x2416bb,_0x276440[_0x3212('0x69')]['mapKey'])){throw new APIBadRequestError(_0x3212('0xaa')+_0x2416bb['join'](',\x20'));}_0x299400[_0x276440[_0x3212('0x69')][_0x3212('0xab')]]=_0x276440[_0x3212('0x69')][_0x3212('0xa2')];})[_0x3212('0x1e')](function(){return db['ChatWebsite'][_0x3212('0x67')]({'where':{'id':_0x276440['params']['id']},'include':[{'model':db[_0x3212('0xac')],'as':_0x3212('0xad'),'include':[{'model':db[_0x3212('0xae')],'as':'Contacts','where':_0x299400,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x3212('0xaf')],'as':'Applications'},{'model':db['Interval'],'as':_0x3212('0x9c'),'include':[{'model':db[_0x3212('0x9c')],'as':_0x3212('0xb0'),'attributes':['id',_0x3212('0xb1')],'raw':!![]}]}]});})[_0x3212('0x1e')](function(_0x1d04fa){if(!_0x1d04fa){throw new APINotFoundError(util[_0x3212('0x44')](_0x3212('0xb2'),_0x276440[_0x3212('0x75')]['id']));}if(_0x99efa3){return checkWebsiteInterval(_0x1d04fa);}return _0x1d04fa;})['then'](function(_0x130b7a){_0x151c1b['account']=_0x130b7a;_0x151c1b[_0x3212('0xb3')]=_[_0x3212('0xb4')](_0x130b7a[_0x3212('0xb5')],[_0x3212('0xb6')],[_0x3212('0xb7')]);if(_0x151c1b[_0x3212('0xb8')][_0x3212('0xb5')]){delete _0x151c1b['account'][_0x3212('0xb5')];}_0x151c1b[_0x3212('0xb9')]=_0x130b7a[_0x3212('0xad')]||{'id':_0x130b7a[_0x3212('0xa9')]};if(_0x151c1b[_0x3212('0xb9')]&&_0x151c1b['list'][_0x3212('0xba')]['length']){return _0x151c1b['list']['Contacts'][0x0];}var _0x3d8761=_['defaults'](_0x276440['body'],{'firstName':_0x276440[_0x3212('0x69')]['from'],'ListId':_0x130b7a[_0x3212('0xa9')]});_0x3d8761[_0x276440[_0x3212('0x69')]['mapKey']]=_0x276440[_0x3212('0x69')][_0x3212('0xa2')];return db[_0x3212('0xae')][_0x3212('0x68')](_0x3d8761,{'fields':_0x52a17c,'raw':!![]});})[_0x3212('0x1e')](function(_0x3e57a8){_0x151c1b['contact']=_0x3e57a8;var _0x5cb478=createInteractionObject(_0x276440['params']['id'],_0x276440[_0x3212('0x69')],_0x276440[_0x3212('0xbb')],_0x3e57a8);var _0x14a707={'ChatWebsiteId':_0x276440[_0x3212('0x75')]['id']};if(_0x276440[_0x3212('0x69')]['threadId']){_0x14a707[_0x3212('0xbc')]=_0x276440[_0x3212('0x69')][_0x3212('0xbc')];_0x14a707[_0x3212('0xbd')]=![];return db[_0x3212('0xbe')][_0x3212('0x67')]({'where':_0x14a707})['then'](function(_0x2b8e20){var _0x2a3824=_0x276440['body'][_0x3212('0x3b')]&&_0x276440[_0x3212('0x69')][_0x3212('0x42')];if(_0x2b8e20){_0x5f6c86=!![];return _0x2b8e20;}else if(!_0x2a3824&&_0x2b8e20&&_0x2b8e20[_0x3212('0xbd')]){throw new APIConflictError(_0x3212('0xbf'));}_0x5cb478[_0x3212('0xbc')]=_0x276440['body']['threadId'];_0x5cb478[_0x3212('0xc0')]=_0x276440[_0x3212('0x69')][_0x3212('0xc0')];return db[_0x3212('0xbe')][_0x3212('0x68')](_0x5cb478);});}_0x14a707[_0x3212('0xc1')]=_0x3e57a8['id'];if(_0x276440[_0x3212('0x69')][_0x3212('0xc2')]&&_0x276440[_0x3212('0x69')][_0x3212('0xc2')]['id']){_0x14a707['id']=_0x276440[_0x3212('0x69')][_0x3212('0xc2')]['id'];return db['ChatInteraction'][_0x3212('0x67')]({'where':_0x14a707})[_0x3212('0x1e')](function(_0x241113){var _0x521fdd=_0x276440[_0x3212('0x69')][_0x3212('0x3b')]&&_0x276440[_0x3212('0x69')][_0x3212('0x42')];if(!_0x521fdd&&_0x241113&&_0x241113[_0x3212('0xbd')]){throw new APIConflictError(_0x3212('0xbf'));}else if(_0x241113){_0x5f6c86=!![];return _0x241113;}else{return db[_0x3212('0xbe')][_0x3212('0x68')](_0x5cb478);}});}return db[_0x3212('0xbe')][_0x3212('0x68')](_0x5cb478);})[_0x3212('0x1e')](function(_0x134fe5){if(!_0x5f6c86){return _0x134fe5;}var _0x1f3741={'from':(_0x151c1b[_0x3212('0xc3')]['firstName']||'')+'\x20'+(_0x151c1b[_0x3212('0xc3')][_0x3212('0x40')]||'')};if(_0x276440[_0x3212('0x69')][_0x3212('0xbc')]&&_0x276440['body']['messageId']&&_0x276440[_0x3212('0x69')][_0x3212('0xbc')]!=_0x276440[_0x3212('0x69')][_0x3212('0xc4')]){_0x1f3741[_0x3212('0xbc')]=_0x276440[_0x3212('0x69')][_0x3212('0xc4')];}return _0x134fe5['update'](_0x1f3741);})[_0x3212('0x1e')](function(_0x23027f){_0x151c1b[_0x3212('0xc2')]=_0x23027f[_0x3212('0x31')]({'plain':!![]});_0x151c1b[_0x3212('0xc2')][_0x3212('0xc5')]=!_0x5f6c86;if(_0x151c1b['interaction'][_0x3212('0xc5')]){if(_0x151c1b[_0x3212('0xb8')][_0x3212('0xc6')]){_0x151c1b[_0x3212('0xb3')][_0x3212('0xc7')]({'id':0x0,'priority':_0x151c1b[_0x3212('0xb3')][_0x3212('0x7a')]+0x1,'app':_0x3212('0xc8'),'appdata':_0x3212('0xc9'),'interval':_0x3212('0xca')});}}return db[_0x3212('0xcb')][_0x3212('0x68')]({'body':_0x276440[_0x3212('0x69')][_0x3212('0x69')],'ChatWebsiteId':_0x276440['params']['id'],'ChatInteractionId':_0x23027f['id'],'direction':'in','ContactId':_0x151c1b[_0x3212('0xc3')]['id'],'AttachmentId':_0x276440[_0x3212('0x69')][_0x3212('0xcc')]});})[_0x3212('0x1e')](function(_0x3338c3){_0x151c1b[_0x3212('0x26')]=_0x3338c3;if(!_0x151c1b['interaction'][_0x3212('0xcd')]){return;}return db[_0x3212('0xce')][_0x3212('0x67')]({'attributes':['id',_0x3212('0x36')],'where':{'id':_0x151c1b[_0x3212('0xc2')]['UserId']}});})[_0x3212('0x1e')](function(_0x1aaffb){if(_0x1aaffb){_0x151c1b[_0x3212('0xb3')]['unshift']({'id':0x0,'priority':0x0,'app':_0x3212('0xcf'),'appdata':_0x1aaffb[_0x3212('0x36')]+','+(_0x151c1b[_0x3212('0xb8')][_0x3212('0xd0')]||0xa),'interval':'*,*,*,*'});_0x151c1b[_0x3212('0xd1')]=!![];}if(!_0x151c1b['interaction'][_0x3212('0xd2')]){return;}return db[_0x3212('0xd3')][_0x3212('0x67')]({'attributes':['id',_0x3212('0x36')],'where':{'id':_0x151c1b[_0x3212('0xc2')][_0x3212('0xd2')]}});})['then'](function(_0x335207){if(_0x335207){_0x151c1b[_0x3212('0xb3')][_0x3212('0xd4')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x335207[_0x3212('0x36')]+','+(_0x151c1b[_0x3212('0xb8')][_0x3212('0xd5')]||0x12c),'interval':_0x3212('0xca')});}return respondWithRpcPromise(_0x3212('0xd6'),'startRouting',_0x151c1b);})[_0x3212('0x1e')](function(_0x2db4d7){respondWithRpcPromise(_0x3212('0xd7'),_0x3212('0xd7'),{'event':'notify','message':_0x2db4d7},client9002);return _0x2db4d7;})[_0x3212('0x1e')](respondWithResult(_0x50ed8d,null))['catch'](APIHandleError(_0x50ed8d));};exports[_0x3212('0xd8')]=function(_0x5044dd,_0x3551bc){var _0x2ac9a0,_0x114525,_0x499fb0;var _0x4e427b=[];var _0x3794aa={};var _0x22c635=_0x5044dd[_0x3212('0xd9')]||[];var _0x455d2d=[];var _0x54e195;return db[_0x3212('0xae')][_0x3212('0x76')]()[_0x3212('0x1e')](function(_0x1c628b){if(!_0x1c628b){throw new db[(_0x3212('0xda'))][(_0x3212('0xdb'))](_0x3212('0xdc'));}_0x4e427b=_[_0x3212('0xdd')](_['keys'](_0x1c628b),[_0x3212('0xa5'),_0x3212('0xa6'),'CompanyId',_0x3212('0xa9')]);if(_0x5044dd[_0x3212('0x69')]['id']){delete _0x5044dd[_0x3212('0x69')]['id'];}if(_[_0x3212('0x91')](_0x5044dd[_0x3212('0x69')][_0x3212('0xa2')])){throw _0x3551bc['status'](0x1f4)[_0x3212('0x37')](new db['Sequelize'][(_0x3212('0xdb'))](_0x3212('0xde')));}if(_[_0x3212('0x91')](_0x5044dd['body'][_0x3212('0x69')])||_0x5044dd[_0x3212('0x69')][_0x3212('0x69')]===''){throw _0x3551bc[_0x3212('0x29')](0x1f4)[_0x3212('0x37')](new db[(_0x3212('0xda'))][(_0x3212('0xdb'))](_0x3212('0xdf')));}if(_[_0x3212('0x91')](_0x5044dd['body'][_0x3212('0xe0')])){throw _0x3551bc[_0x3212('0x29')](0x1f4)[_0x3212('0x37')](new db[(_0x3212('0xda'))][(_0x3212('0xdb'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4e427b));}if(!_['includes'](_0x4e427b,_0x5044dd[_0x3212('0x69')]['mapKeyOffline'])){throw _0x3551bc[_0x3212('0x29')](0x1f4)['send'](new db[(_0x3212('0xda'))][(_0x3212('0xdb'))](_0x3212('0xe1')+_0x4e427b));}_0x3794aa[_0x5044dd['body'][_0x3212('0xe0')]]=_0x5044dd[_0x3212('0x69')]['from'];})['then'](function(){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x5044dd[_0x3212('0x75')]['id']},'include':[{'model':db['CmList'],'as':_0x3212('0xad')},{'model':db['MailAccount'],'as':_0x3212('0xe2')}]});})['then'](handleEntityNotFound(_0x3551bc,null))['then'](function(_0x236981){if(_0x236981&&_0x236981[_0x3212('0xad')]){_0x114525=_0x236981;var _0x1ae319=_[_0x3212('0x16')](_0x5044dd[_0x3212('0x69')],{'firstName':_0x5044dd[_0x3212('0x69')]['from'],'phone':_0x5044dd[_0x3212('0x69')][_0x3212('0xa2')],'ListId':_0x236981['ListId']});_0x1ae319[_0x5044dd[_0x3212('0x69')][_0x3212('0xe0')]]=_0x5044dd[_0x3212('0x69')][_0x3212('0xa2')];return db[_0x3212('0xae')][_0x3212('0xe3')]({'where':_0x3794aa,'defaults':_0x1ae319});}})[_0x3212('0xe4')](function(_0xd5ed8a){if(_0xd5ed8a){_0x499fb0=_0xd5ed8a;var _0x57b8b6=fs[_0x3212('0xe5')](path['join'](config['root'],_0x3212('0xe6')),_0x3212('0xe7'));var _0x47ab77=ejs['render'](_0x57b8b6,{'body':_[_0x3212('0xe8')](_0x5044dd[_0x3212('0x69')]['body']),'bodyTitle':_0x114525[_0x3212('0xe9')]});return db[_0x3212('0xea')][_0x3212('0x68')]({'body':_0x47ab77,'plainBody':htmlToText[_0x3212('0xeb')](_0x47ab77),'ContactId':_0xd5ed8a['id'],'ChatWebsiteId':_0x114525['id']});}})['then'](function(_0x22c557){_0x54e195=_0x22c557;if(_0x22c635[_0x3212('0x7a')]){var _0x55621c=_0x22c635['map'](function(_0x452503){return{'name':_0x452503[_0x3212('0xec')],'basename':_0x452503[_0x3212('0x84')],'type':_0x452503[_0x3212('0xed')],'ChatOfflineMessageId':_0x22c557['id']};});_0x455d2d=_0x55621c[_0x3212('0x4f')](_0x13f591=>{var _0x52a99e={'filename':_0x13f591['name'],'path':path[_0x3212('0x8b')](config['root'],'server','files','attachments',_0x3212('0xee'),_0x13f591[_0x3212('0xef')])};return _0x52a99e;});if(!_0x114525[_0x3212('0xf0')]){return db[_0x3212('0xf1')]['transaction'](function(_0x409508){return db[_0x3212('0xf2')][_0x3212('0xf3')](_0x55621c,{'transaction':_0x409508});});}}})[_0x3212('0x1e')](function(){if(_0x54e195){_0x2ac9a0=_0x54e195;return db[_0x3212('0xe2')][_0x3212('0xf4')]({'where':{'service':!![]},'include':[{'model':db[_0x3212('0xf5')],'as':_0x3212('0xf6'),'raw':!![],'include':[{'model':db[_0x3212('0xf7')],'as':'CloudProvider','raw':!![]}]}]});}})['then'](function(_0x184e57){if(_0x184e57&&_0x184e57[_0x3212('0xf6')]&&_0x114525[_0x3212('0xf8')]&&_0x114525[_0x3212('0xf9')]){var _0x282bcf=_0x184e57[_0x3212('0xfa')]();return respondWithRpcPromise(_0x3212('0xfb'),'sendMail',{'account':_0x282bcf,'message':{'from':util[_0x3212('0x44')](_0x3212('0xfc'),_0x184e57['name'],_0x184e57[_0x3212('0xfd')]||_0x184e57[_0x3212('0xf6')][_0x3212('0x6e')]),'to':_0x114525[_0x3212('0xf9')],'subject':_0x114525['offlineMessageSubject'],'html':_0x2ac9a0[_0x3212('0x69')],'attachments':_0x455d2d}},client9003)[_0x3212('0x1e')](function(){return _0x2ac9a0;})[_0x3212('0x27')](function(_0x562e85){logger[_0x3212('0x23')](_0x562e85);});}})[_0x3212('0x1e')](function(){if(_0x114525&&_0x114525['openNewInteraction']&&_0x114525[_0x3212('0xfe')]){var _0x14fcf7=[];if(_0x22c635[_0x3212('0x7a')]){_0x14fcf7=_0x22c635['map'](function(_0x29b1ab){return{'name':_0x29b1ab[_0x3212('0xec')],'basename':_0x29b1ab[_0x3212('0x84')],'type':_0x29b1ab[_0x3212('0xed')],'ChatOfflineMessageId':_0x54e195['id']};});}var _0x51e780;if(!_[_0x3212('0x91')](_0x114525[_0x3212('0xff')])){var _0x528e3e=_['map'](_0x5044dd[_0x3212('0x69')],function(_0x44988f){return _0x44988f;});var _0x439337=_[_0x3212('0x100')](_0x528e3e)[0x0];var _0x50b201=_[_0x3212('0x101')](_0x439337,function(_0x14c9af){return _0x14c9af;});_0x51e780=_0x50b201[0x1][_0x114525[_0x3212('0xff')]];}var _0x50f128={'from':_0x499fb0[_0x3212('0xfd')],'firstName':_0x499fb0[_0x3212('0x3f')],'lastName':_0x499fb0[_0x3212('0x40')],'mapKey':_0x3212('0xfd'),'message':{'from':_0x499fb0[_0x3212('0xfd')],'to':_0x114525[_0x3212('0xe2')][_0x3212('0xfd')],'cc':'','subject':_['isNil'](_0x51e780)?_0x114525[_0x3212('0x102')]:_0x51e780,'messageId':'','sentAt':new Date(),'attach':_0x14fcf7[_0x3212('0x7a')],'attachments':_0x14fcf7,'originChannel':_0x3212('0x103'),'ChatWebsiteId':_0x114525['id'],'ChatOfflineMessageId':_0x2ac9a0['id'],'originTo':_0x114525[_0x3212('0xe2')]['email']},'body':_0x2ac9a0['body']};var _0x2bedb4={'account':{'id':_0x114525[_0x3212('0xfe')]},'body':_0x50f128,'log':'NotifyMailAccount'};return respondWithRpcPromise('NotifyMailAccount',_0x3212('0x104'),_0x2bedb4,client9001)[_0x3212('0x1e')](function(){return _0x2ac9a0;})[_0x3212('0x27')](function(_0x52c52a){logger[_0x3212('0x23')](_0x52c52a);});}return;})[_0x3212('0x1e')](function(){if(_0x2ac9a0){return _0x2ac9a0;}})['then'](respondWithResult(_0x3551bc,null))[_0x3212('0x27')](function(){for(var _0x116961 of _0x22c635){var _0x3e3ab7=path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x105'),_0x3212('0xd9'),_0x3212('0x106'),'offline-chat',_0x116961['filename']);fs_extra[_0x3212('0x107')](_0x3e3ab7)['catch'](function(_0x4e242f){logger[_0x3212('0x23')](_0x3212('0x108'),_0x3e3ab7,_0x4e242f);});}});};exports[_0x3212('0x109')]=function(_0x58b237,_0x234330){return db[_0x3212('0xbe')]['find']({'where':{'id':_0x58b237[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x234330,null))[_0x3212('0x1e')](function(_0x5cba55){if(_0x5cba55){return _0x5cba55[_0x3212('0x109')](_0x58b237['body'][_0x3212('0x7e')],_[_0x3212('0x10a')](_0x58b237[_0x3212('0x69')],[_0x3212('0x7e'),'id'])||{});}})[_0x3212('0x1e')](respondWithResult(_0x234330,null))['catch'](handleError(_0x234330,null));};exports[_0x3212('0x10b')]=function(_0x3c0359,_0x23e662){var _0x134dbc={'raw':![],'where':{}};var _0x2e9a0f={};var _0x1c0adc={'count':0x0,'rows':[]};return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0x3c0359[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x23e662,null))[_0x3212('0x1e')](function(_0x572101){if(_0x572101){_0x2e9a0f[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xbe')][_0x3212('0x50')]);_0x2e9a0f['query']=_[_0x3212('0x53')](_0x3c0359[_0x3212('0x52')]);_0x2e9a0f['filters']=_['intersection'](_0x2e9a0f[_0x3212('0x48')],_0x2e9a0f[_0x3212('0x52')]);_0x134dbc['attributes']=_[_0x3212('0x66')](_0x2e9a0f[_0x3212('0x48')],qs['fields'](_0x3c0359[_0x3212('0x52')][_0x3212('0x55')]));_0x134dbc[_0x3212('0x54')]=_0x134dbc[_0x3212('0x54')][_0x3212('0x7a')]?_0x134dbc[_0x3212('0x54')]:_0x2e9a0f['model'];if(!_0x3c0359['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x134dbc[_0x3212('0x2d')]=qs['limit'](_0x3c0359[_0x3212('0x52')][_0x3212('0x2d')]);_0x134dbc[_0x3212('0x2b')]=qs['offset'](_0x3c0359[_0x3212('0x52')][_0x3212('0x2b')]);}_0x134dbc['order']=qs[_0x3212('0x59')](_0x3c0359[_0x3212('0x52')]['sort']);_0x134dbc['where']=qs[_0x3212('0x5b')](_['pick'](_0x3c0359[_0x3212('0x52')],_0x2e9a0f['filters']));_0x134dbc['where'][_0x3212('0x77')]=_0x572101['id'];if(_0x3c0359['query'][_0x3212('0x5c')]){_0x134dbc[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x134dbc['where'],{'$or':_[_0x3212('0x4f')](_0x134dbc['attributes'],function(_0x3348ba){var _0x513862={};_0x513862[_0x3348ba]={'$like':'%'+_0x3c0359[_0x3212('0x52')][_0x3212('0x5c')]+'%'};return _0x513862;})});}_0x134dbc=_[_0x3212('0x5d')]({},_0x134dbc,_0x3c0359[_0x3212('0x5f')]);return db[_0x3212('0xbe')][_0x3212('0x2e')]({'where':_0x134dbc[_0x3212('0x5a')]})[_0x3212('0x1e')](function(_0x481352){_0x1c0adc['count']=_0x481352;if(_0x3c0359[_0x3212('0x52')][_0x3212('0x61')]){_0x134dbc[_0x3212('0x62')]=[{'model':db[_0x3212('0xae')],'as':_0x3212('0x10c'),'required':![]},{'model':db[_0x3212('0xce')],'as':_0x3212('0x10d'),'attributes':[_0x3212('0x36'),'fullname',_0x3212('0x10e')],'required':![]},{'model':db[_0x3212('0x10f')],'as':_0x3212('0x110'),'attributes':['id',_0x3212('0x36'),_0x3212('0x111')],'where':_0x3c0359['query'][_0x3212('0x112')]?{'id':_0x3c0359[_0x3212('0x52')][_0x3212('0x112')]}:undefined,'required':_0x3c0359[_0x3212('0x52')]['tag']?!![]:![]}];}return db['ChatInteraction'][_0x3212('0x63')](_0x134dbc);})[_0x3212('0x1e')](function(_0x1b2e77){_0x1c0adc[_0x3212('0x7c')]=_0x1b2e77;return _0x1c0adc;});}})[_0x3212('0x1e')](respondWithFilteredResult(_0x23e662,_0x134dbc))[_0x3212('0x27')](handleError(_0x23e662,null));};exports[_0x3212('0x113')]=function(_0x4f356c,_0xa129d1){var _0x563b6a=0x0;var _0x1fb2d2=0x0;var _0x5845c6=![];var _0x163030;var _0xf24677;return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x4f356c[_0x3212('0x75')]['id']},'include':[{'model':db[_0x3212('0x9c')],'as':_0x3212('0x9c'),'include':[{'model':db[_0x3212('0x9c')],'as':_0x3212('0xb0'),'attributes':['id',_0x3212('0xb1')]}]}]})[_0x3212('0x1e')](handleEntityNotFound(_0xa129d1,null))[_0x3212('0x1e')](function(_0xcdb3a6){if(_0xcdb3a6){_0x163030=_0xcdb3a6;return _0xcdb3a6[_0x3212('0x114')]({'raw':!![]});}})[_0x3212('0x1e')](function(_0x2c0ae1){if(_0x163030){if(_0x2c0ae1){_0xf24677=_0x2c0ae1;}}return require(_0x3212('0x8e'))['getLicense']();})['then'](function(_0x11a5d6){if(_0x11a5d6){_0x1fb2d2=_0x11a5d6[_0x3212('0x115')];_0x5845c6=_0x11a5d6[_0x3212('0x90')];}})[_0x3212('0x1e')](function(){return db[_0x3212('0xbe')][_0x3212('0x2e')]({'where':{'closed':![]}});})['then'](function(_0x5a2155){_0x563b6a=_0x5a2155;if(_0x1fb2d2&&_0x5a2155>_0x1fb2d2){return db[_0x3212('0x116')]['findOne']({'where':{'id':0x1}})[_0x3212('0x1e')](function(_0x159c64){if(_0x159c64){_0x159c64[_0x3212('0x117')]('chatLicenseExceeded');}});}})[_0x3212('0x1e')](function(){var _0x169102=_0x163030['Interval'];var _0x110441=_0x163030[_0x3212('0x9e')]||undefined;return _0x169102?_0x169102[_0x3212('0x9f')](_0x110441):!![];})[_0x3212('0x1e')](function(_0x2acbd9){var _0x29335d=fs[_0x3212('0xe5')](path[_0x3212('0x8b')](config[_0x3212('0x94')],_0x3212('0x118')),_0x3212('0xe7'));var _0xf36a6f=_0x3212('0x119');var _0x2f4434=![];var _0x522927,_0x5575f2;if(_0x4f356c[_0x3212('0xbb')][_0x3212('0x42')]){_0x522927=new URL(_0x4f356c['headers'][_0x3212('0x42')])[_0x3212('0x11a')];}else if(_0x4f356c[_0x3212('0xbb')][_0x3212('0x11a')]){_0x522927=new URL(_0x4f356c['headers']['origin'])[_0x3212('0x11a')];}else{_0x522927='http://localhost:9000';}_0x5575f2=typeof _0x163030['address'][_0x3212('0x3e')](',')[_0x3212('0x67')](function(_0x1ff53b){return wildcardUtils[_0x3212('0x11b')](_0x1ff53b,_0x522927);})!=='undefined';var _0x48706f={'chatVersion':_0xf36a6f,'chatWebsiteAddressOrigin':_0x5575f2?_0x522927:_0x163030['address'],'remote':_0x163030['remote'],'query':querystring['stringify'](_[_0x3212('0x5d')](_0x163030[_0x3212('0x31')]({'plain':!![]}),{'customerIp':_0x4f356c[_0x3212('0xbb')][_0x3212('0x3c')]||_0x4f356c['headers'][_0x3212('0x11c')]||_0x4f356c[_0x3212('0x11d')][_0x3212('0x11e')]||_0x4f356c['ip'],'referer':_0x4f356c[_0x3212('0xbb')][_0x3212('0x42')],'openedInteractions':_0x563b6a,'maxInteractions':_0x1fb2d2,'virtual':_0x5845c6[_0x3212('0x115')],'online':_0x2acbd9,'custom':_0x5845c6,'address':_0x5575f2?_0x522927:null}))[_0x3212('0x11f')](/'/g,'\x5c\x27')};_0xa129d1[_0x3212('0x37')](ejs[_0x3212('0x120')](Mustache['render'](_0x29335d,_0x48706f),{'proactiveActions':_0xf24677,'alignment':_0x163030[_0x3212('0x121')],'verticalAlignment':_0x163030[_0x3212('0x122')],'div_color':_0x163030[_0x3212('0x111')],'labelText':_0x163030[_0x3212('0x123')],'text_color':_0x163030[_0x3212('0x124')],'text_button_color':_0x163030['textButtonColor'],'button_color':_0x163030[_0x3212('0x125')],'background_color':_0x163030[_0x3212('0x126')],'hideWhenOffline':_0x163030[_0x3212('0x127')],'intervalId':_0x163030[_0x3212('0x128')],'isDevelopment':_0x2f4434,'chatVersion':_0xf36a6f}));})[_0x3212('0x27')](handleError(_0xa129d1,null));};exports['addApplications']=function(_0x544b12,_0x2f043f){var _0x884c93=_0x544b12[_0x3212('0x75')]['id'];var _0x100d6c=_0x544b12[_0x3212('0x69')];var _0x370293=0xc8;var _0x14e5cb=null;return db[_0x3212('0xf1')][_0x3212('0x129')]({'isolationLevel':db[_0x3212('0xf1')][_0x3212('0x12a')][_0x3212('0x12b')][_0x3212('0x12c')]},function(_0x7def32){return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0x884c93},'transaction':_0x7def32})[_0x3212('0x1e')](function(_0x3da674){if(_0x3da674){return db['ChatApplication'][_0x3212('0x34')]({'where':{'ChatWebsiteId':_0x884c93},'transaction':_0x7def32})[_0x3212('0x1e')](function(){var _0x239dd3=_[_0x3212('0x4f')](_0x100d6c,function(_0x4327b0){_0x4327b0[_0x3212('0x77')]=_0x884c93;return _0x4327b0;});return db[_0x3212('0xaf')]['bulkCreate'](_0x239dd3,{'transaction':_0x7def32});});}else{_0x370293=0x194;_0x14e5cb=[];}});})['then'](function(){if(_0x370293!==0x194){return db[_0x3212('0xaf')][_0x3212('0x12d')]({'where':{'ChatWebsiteId':_0x884c93},'order':_0x3212('0xb6')})[_0x3212('0x1e')](function(_0xdea68e){_0x14e5cb=_0xdea68e;});}})[_0x3212('0x27')](function(_0x1af398){_0x370293=0x1f4;logger[_0x3212('0x23')](_0x1af398[_0x3212('0x12e')]);if(_0x1af398[_0x3212('0x36')]){delete _0x1af398[_0x3212('0x36')];}_0x14e5cb=_0x1af398;})[_0x3212('0x12f')](function(){if(_0x14e5cb===null){_0x2f043f['sendStatus'](_0x370293);}else{if(_0x370293===0x1f4){_0x2f043f[_0x3212('0x29')](_0x370293)[_0x3212('0x37')](_0x14e5cb);}else{_0x2f043f['status'](_0x370293)[_0x3212('0x2a')](_0x14e5cb);}}});};exports['getApplications']=function(_0xa585b5,_0x57efa5){var _0x5caf79={};var _0x416d7c={};var _0xd840aa;var _0x3f5771;return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0xa585b5[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x57efa5,null))['then'](function(_0xb75803){if(_0xb75803){_0xd840aa=_0xb75803;_0x416d7c[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xaf')][_0x3212('0x50')]);_0x416d7c[_0x3212('0x52')]=_['keys'](_0xa585b5[_0x3212('0x52')]);_0x416d7c[_0x3212('0x5b')]=_['intersection'](_0x416d7c[_0x3212('0x48')],_0x416d7c[_0x3212('0x52')]);_0x5caf79[_0x3212('0x54')]=_[_0x3212('0x66')](_0x416d7c['model'],qs[_0x3212('0x55')](_0xa585b5['query'][_0x3212('0x55')]));_0x5caf79['attributes']=_0x5caf79['attributes'][_0x3212('0x7a')]?_0x5caf79[_0x3212('0x54')]:_0x416d7c['model'];_0x5caf79[_0x3212('0x58')]=qs['sort'](_0xa585b5[_0x3212('0x52')][_0x3212('0x59')]);_0x5caf79['where']=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0xa585b5['query'],_0x416d7c[_0x3212('0x5b')]));if(_0xa585b5[_0x3212('0x52')][_0x3212('0x5c')]){_0x5caf79[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x5caf79[_0x3212('0x5a')],{'$or':_['map'](_0x5caf79[_0x3212('0x54')],function(_0x592ffc){var _0x4b4e6b={};_0x4b4e6b[_0x592ffc]={'$like':'%'+_0xa585b5[_0x3212('0x52')][_0x3212('0x5c')]+'%'};return _0x4b4e6b;})});}_0x5caf79=_[_0x3212('0x5d')]({},_0x5caf79,_0xa585b5[_0x3212('0x5f')]);return _0xd840aa[_0x3212('0x130')](_0x5caf79);}})[_0x3212('0x1e')](function(_0x19fd6a){if(_0x19fd6a){_0x3f5771=_0x19fd6a[_0x3212('0x7a')];if(!_0xa585b5['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x5caf79['limit']=qs[_0x3212('0x2d')](_0xa585b5[_0x3212('0x52')][_0x3212('0x2d')]);_0x5caf79[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0xa585b5['query'][_0x3212('0x2b')]);}return _0xd840aa[_0x3212('0x130')](_0x5caf79);}})[_0x3212('0x1e')](function(_0x2dedd9){if(_0x2dedd9){return _0x2dedd9?{'count':_0x3f5771,'rows':_0x2dedd9}:null;}})[_0x3212('0x1e')](respondWithResult(_0x57efa5,null))[_0x3212('0x27')](handleError(_0x57efa5,null));};exports[_0x3212('0x131')]=function(_0x56fe82,_0x787711){return db[_0x3212('0x132')]['find']({'where':{'id':_0x56fe82[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x787711,null))['then'](function(_0x4164ae){if(_0x4164ae){return _0x4164ae['addProactiveActions'](_0x56fe82[_0x3212('0x69')][_0x3212('0x7e')],_[_0x3212('0x10a')](_0x56fe82[_0x3212('0x69')],[_0x3212('0x7e'),'id'])||{});}})[_0x3212('0x1e')](respondWithResult(_0x787711,null))[_0x3212('0x27')](handleError(_0x787711,null));};exports[_0x3212('0x114')]=function(_0x348509,_0x5391c8){var _0x3d287c={};var _0x45cd82={};var _0x3c64a1;var _0x43c895;return db[_0x3212('0x60')][_0x3212('0xf4')]({'where':{'id':_0x348509['params']['id']}})['then'](handleEntityNotFound(_0x5391c8,null))[_0x3212('0x1e')](function(_0xddb1b6){if(_0xddb1b6){_0x3c64a1=_0xddb1b6;_0x45cd82[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0x133')][_0x3212('0x50')]);_0x45cd82[_0x3212('0x52')]=_['keys'](_0x348509['query']);_0x45cd82[_0x3212('0x5b')]=_['intersection'](_0x45cd82[_0x3212('0x48')],_0x45cd82['query']);_0x3d287c[_0x3212('0x54')]=_[_0x3212('0x66')](_0x45cd82[_0x3212('0x48')],qs['fields'](_0x348509[_0x3212('0x52')][_0x3212('0x55')]));_0x3d287c[_0x3212('0x54')]=_0x3d287c[_0x3212('0x54')]['length']?_0x3d287c['attributes']:_0x45cd82[_0x3212('0x48')];_0x3d287c['order']=qs['sort'](_0x348509[_0x3212('0x52')]['sort']);_0x3d287c[_0x3212('0x5a')]=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x348509[_0x3212('0x52')],_0x45cd82[_0x3212('0x5b')]));if(_0x348509[_0x3212('0x52')][_0x3212('0x5c')]){_0x3d287c[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x3d287c[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x3d287c[_0x3212('0x54')],function(_0x1bc301){var _0x44d8b0={};_0x44d8b0[_0x1bc301]={'$like':'%'+_0x348509[_0x3212('0x52')][_0x3212('0x5c')]+'%'};return _0x44d8b0;})});}_0x3d287c=_[_0x3212('0x5d')]({},_0x3d287c,_0x348509['options']);return _0x3c64a1[_0x3212('0x114')](_0x3d287c);}})['then'](function(_0x26f991){if(_0x26f991){_0x43c895=_0x26f991[_0x3212('0x7a')];if(!_0x348509['query'][_0x3212('0x56')](_0x3212('0x57'))){_0x3d287c[_0x3212('0x2d')]=qs['limit'](_0x348509[_0x3212('0x52')][_0x3212('0x2d')]);_0x3d287c['offset']=qs[_0x3212('0x2b')](_0x348509['query']['offset']);}return _0x3c64a1['getProactiveActions'](_0x3d287c);}})[_0x3212('0x1e')](function(_0x5c769f){if(_0x5c769f){return _0x5c769f?{'count':_0x43c895,'rows':_0x5c769f}:null;}})[_0x3212('0x1e')](respondWithResult(_0x5391c8,null))['catch'](handleError(_0x5391c8,null));};exports['getFields']=function(_0x2b5b0e,_0x1aa61b){var _0xcb81c7=_0x2b5b0e[_0x3212('0x52')][_0x3212('0x134')]==='false'?_0x3212('0x135'):'onlineForm';return db['ChatWebsite']['find']({'attributes':['id',_0xcb81c7],'where':{'id':_0x2b5b0e['params']['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x1aa61b,null))['then'](function(_0x1982c7){if(_0x1982c7){var _0x49df5a=_0x1982c7[_0xcb81c7];var _0x3b88ab=_0x49df5a&&_0x49df5a[_0x3212('0x136')]?_0x49df5a['items']:[];_0x1aa61b[_0x3212('0x37')]({'fromKey':_[_0x3212('0x91')](_0x49df5a[_0x3212('0x137')])?undefined:_0x49df5a[_0x3212('0x137')],'count':_0x3b88ab[_0x3212('0x7a')],'rows':_0x3b88ab});}})[_0x3212('0x27')](handleError(_0x1aa61b,null));};exports['getOfflineMessages']=function(_0x8590d5,_0xa77e1){var _0x885068={'raw':![],'where':{}};var _0x4fedb5={};var _0x2dbb3b={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x3212('0xf4')]({'where':{'id':_0x8590d5[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0xa77e1,null))[_0x3212('0x1e')](function(_0x322b5e){if(_0x322b5e){_0x4fedb5[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xea')][_0x3212('0x50')]);_0x4fedb5[_0x3212('0x52')]=_[_0x3212('0x53')](_0x8590d5[_0x3212('0x52')]);_0x4fedb5['filters']=_[_0x3212('0x66')](_0x4fedb5['model'],_0x4fedb5[_0x3212('0x52')]);_0x885068[_0x3212('0x54')]=_[_0x3212('0x66')](_0x4fedb5[_0x3212('0x48')],qs[_0x3212('0x55')](_0x8590d5['query'][_0x3212('0x55')]));_0x885068[_0x3212('0x54')]=_0x885068[_0x3212('0x54')][_0x3212('0x7a')]?_0x885068['attributes']:_0x4fedb5['model'];if(!_0x8590d5[_0x3212('0x52')][_0x3212('0x56')](_0x3212('0x57'))){_0x885068[_0x3212('0x2d')]=qs[_0x3212('0x2d')](_0x8590d5[_0x3212('0x52')][_0x3212('0x2d')]);_0x885068[_0x3212('0x2b')]=qs[_0x3212('0x2b')](_0x8590d5[_0x3212('0x52')][_0x3212('0x2b')]);}_0x885068[_0x3212('0x58')]=qs['sort'](_0x8590d5[_0x3212('0x52')][_0x3212('0x59')]);_0x885068['where']=qs[_0x3212('0x5b')](_[_0x3212('0x7b')](_0x8590d5[_0x3212('0x52')],_0x4fedb5[_0x3212('0x5b')]));_0x885068[_0x3212('0x5a')][_0x3212('0x77')]=_0x322b5e['id'];if(_0x8590d5[_0x3212('0x52')][_0x3212('0x5c')]){_0x885068[_0x3212('0x5a')]=_[_0x3212('0x5d')](_0x885068[_0x3212('0x5a')],{'$or':_[_0x3212('0x4f')](_0x885068[_0x3212('0x54')],function(_0x308a46){var _0x3a392d={};_0x3a392d[_0x308a46]={'$like':'%'+_0x8590d5['query'][_0x3212('0x5c')]+'%'};return _0x3a392d;})});}_0x885068=_[_0x3212('0x5d')]({},_0x885068,_0x8590d5[_0x3212('0x5f')]);return db[_0x3212('0xea')]['count']({'where':_0x885068['where']})['then'](function(_0x19ec90){_0x2dbb3b['count']=_0x19ec90;if(_0x8590d5['query'][_0x3212('0x61')]){_0x885068[_0x3212('0x62')]=[{'all':!![]}];}else{_0x885068['include']=[{'model':db[_0x3212('0xae')],'as':_0x3212('0x10c'),'required':![]},{'model':db[_0x3212('0xf2')],'as':'Attachments','required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x885068);})['then'](function(_0x19bd8b){_0x2dbb3b[_0x3212('0x7c')]=_0x19bd8b;return _0x2dbb3b;});}})[_0x3212('0x1e')](respondWithFilteredResult(_0xa77e1,_0x885068))[_0x3212('0x27')](handleError(_0xa77e1,null));};exports[_0x3212('0x138')]=function(_0x141c16,_0x145dd3){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x141c16[_0x3212('0x75')]['id']}})['then'](handleEntityNotFound(_0x145dd3,null))[_0x3212('0x1e')](function(_0x15a812){if(_0x15a812){return _0x15a812[_0x3212('0x138')](_0x141c16[_0x3212('0x69')][_0x3212('0x7e')],_[_0x3212('0x10a')](_0x141c16['body'],['ids','id'])||{})['spread'](function(_0x4e3ff3){for(var _0x5dda62=0x0;_0x5dda62<_0x141c16[_0x3212('0x69')][_0x3212('0x7e')][_0x3212('0x7a')];_0x5dda62+=0x1){socket['emit'](_0x3212('0x139'),{'UserId':Number(_0x141c16[_0x3212('0x69')]['ids'][_0x5dda62]),'ChatWebsiteId':Number(_0x141c16['params']['id'])});}return _0x4e3ff3;});}})[_0x3212('0x1e')](respondWithResult(_0x145dd3,null))['catch'](handleError(_0x145dd3,null));};exports[_0x3212('0x13a')]=function(_0x1fb016,_0x230999){return db[_0x3212('0x60')][_0x3212('0x67')]({'where':{'id':_0x1fb016[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x230999,null))[_0x3212('0x1e')](function(_0x4d21b0){if(_0x4d21b0){return _0x4d21b0[_0x3212('0x13a')](_0x1fb016['query'][_0x3212('0x7e')])['then'](function(){if(_[_0x3212('0x13b')](_0x1fb016[_0x3212('0x52')][_0x3212('0x7e')])){for(var _0xee24a7=0x0;_0xee24a7<_0x1fb016[_0x3212('0x52')][_0x3212('0x7e')][_0x3212('0x7a')];_0xee24a7+=0x1){socket[_0x3212('0x13c')](_0x3212('0x13d'),{'UserId':Number(_0x1fb016[_0x3212('0x52')][_0x3212('0x7e')][_0xee24a7]),'ChatWebsiteId':Number(_0x1fb016[_0x3212('0x75')]['id'])});}}else{socket[_0x3212('0x13c')]('userChatWebsite:remove',{'UserId':Number(_0x1fb016['query'][_0x3212('0x7e')]),'ChatWebsiteId':Number(_0x1fb016[_0x3212('0x75')]['id'])});}});}})['then'](respondWithStatusCode(_0x230999,null))[_0x3212('0x27')](handleError(_0x230999,null));};exports['getAgents']=function(_0x5e9fa9,_0x668041){var _0x262d20={};var _0x1561da={};var _0x48c23d;var _0x44cd1;return db[_0x3212('0x60')]['findOne']({'where':{'id':_0x5e9fa9[_0x3212('0x75')]['id']}})[_0x3212('0x1e')](handleEntityNotFound(_0x668041,null))[_0x3212('0x1e')](function(_0xc13e4d){if(_0xc13e4d){_0x48c23d=_0xc13e4d;_0x1561da[_0x3212('0x48')]=_[_0x3212('0x53')](db[_0x3212('0xce')]['rawAttributes']);_0x1561da[_0x3212('0x52')]=_[_0x3212('0x53')](_0x5e9fa9['query']);_0x1561da[_0x3212('0x5b')]=_['intersection'](_0x1561da[_0x3212('0x48')],_0x1561da['query']);_0x262d20[_0x3212('0x54')]=_[_0x3212('0x66')](_0x1561da['model'],qs[_0x3212('0x55')](_0x5e9fa9[_0x3212('0x52')][_0x3212('0x55')]));_0x262d20[_0x3212('0x54')]=_0x262d20[_0x3212('0x54')][_0x3212('0x7a')]?_0x262d20[_0x3212('0x54')]:_0x1561da[_0x3212('0x48')];_0x262d20[_0x3212('0x58')]=qs[_0x3212('0x59')](_0x5e9fa9[_0x3212('0x52')]['sort']);_0x262d20['where']=qs['filters'](_[_0x3212('0x7b')](_0x5e9fa9[_0x3212('0x52')],_0x1561da[_0x3212('0x5b')]));if(_0x5e9fa9[_0x3212('0x52')][_0x3212('0x5c')]){_0x262d20['where']=_[_0x3212('0x5d')](_0x262d20['where'],{'$or':_['map'](_0x262d20[_0x3212('0x54')],function(_0x38d073){var _0xafb9cc={};_0xafb9cc[_0x38d073]={'$like':'%'+_0x5e9fa9['query']['filter']+'%'};return _0xafb9cc;})});}_0x262d20=_['merge']({},_0x262d20,_0x5e9fa9['options']);return _0x48c23d['getAgents'](_0x262d20);}})['then'](function(_0x3e82ec){if(_0x3e82ec){_0x44cd1=_0x3e82ec[_0x3212('0x7a')];if(!_0x5e9fa9[_0x3212('0x52')]['hasOwnProperty'](_0x3212('0x57'))){_0x262d20[_0x3212('0x2d')]=qs[_0x3212('0x2d')](_0x5e9fa9['query'][_0x3212('0x2d')]);_0x262d20[_0x3212('0x2b')]=qs['offset'](_0x5e9fa9[_0x3212('0x52')][_0x3212('0x2b')]);}return _0x48c23d[_0x3212('0x13e')](_0x262d20);}})[_0x3212('0x1e')](function(_0x508579){if(_0x508579){return _0x508579?{'count':_0x44cd1,'rows':_0x508579}:null;}})[_0x3212('0x1e')](respondWithResult(_0x668041,null))[_0x3212('0x27')](handleError(_0x668041,null));}; \ No newline at end of file +var _0x4d9e=['waitForTheAssignedQueue','Start','startRouting','EventManager','offline','Sequelize','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','render','offlineMessageBody','ChatOfflineMessage','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','Chat','NotifyMailAccount','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','color','tag','interval','getProactiveActions','getLicense','virtual','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','http://localhost:9000','remote','x-real-ip','connection','remoteAddress','replace','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','READ_COMMITTED','findAndCountAll','getApplications','addProactiveActions','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','ejs','lodash','html-to-text','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','http','client','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','status','end','json','undefined','limit','count','offset','set','Content-Range','update','destroy','then','UserProfileResource','sendStatus','stack','name','send','user-agent-parser','setUA','user-agent','getResult','x-forwarded-for','first','split','firstName','lastName','x-real-port','browser','format','%s\x20%s','version','unknown','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','show','keys','includeAll','include','find','body','address','forEach','trim','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','params','describe','addDisposition','Disposition','getDispositions','findOne','ChatWebsiteId','filter','findAll','rows','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','file','filename','addAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','server/files/images/logos/','join','root','server/files/images/avatars/default_avatar.png','agentAvatar','server/files/images/avatars/','download','showCustomerAvatar','getSystemAvatar','Interval','resolve','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','customerIp','CmContact','createdAt','updatedAt','CompanyId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','List','Contacts','DESC','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','ListId','headers','threadId','closed','ChatInteraction','referer','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','contact','messageId','created','*,*,*,*','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue'];(function(_0x2e7a79,_0x30f013){var _0x29e00f=function(_0x51b9b7){while(--_0x51b9b7){_0x2e7a79['push'](_0x2e7a79['shift']());}};_0x29e00f(++_0x30f013);}(_0x4d9e,0x18c));var _0xe4d9=function(_0x3c91ab,_0x50d459){_0x3c91ab=_0x3c91ab-0x0;var _0x57d552=_0x4d9e[_0x3c91ab];return _0x57d552;};'use strict';var Mustache=require(_0xe4d9('0x0'));var util=require('util');var path=require('path');var ejs=require(_0xe4d9('0x1'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4d9('0x2'));var querystring=require('querystring');var htmlToText=require(_0xe4d9('0x3'));var Redis=require(_0xe4d9('0x4'));var jayson=require('jayson/promise');var qs=require(_0xe4d9('0x5'));var logger=require(_0xe4d9('0x6'))(_0xe4d9('0x7'));var config=require(_0xe4d9('0x8'));var APIBadRequestError=require(_0xe4d9('0x9'))[_0xe4d9('0xa')];var APINotFoundError=require('../../errors/api')[_0xe4d9('0xb')];var APIOutOfIntervalError=require(_0xe4d9('0x9'))[_0xe4d9('0xc')];var APIHandleError=require(_0xe4d9('0x9'))[_0xe4d9('0xd')];var APIConflictError=require(_0xe4d9('0x9'))['APIConflictError'];var wildcardUtils=require(_0xe4d9('0xe'));var URL=require(_0xe4d9('0xf'))[_0xe4d9('0x10')];var db=require(_0xe4d9('0x11'))['db'];config[_0xe4d9('0x12')]=_[_0xe4d9('0x13')](config[_0xe4d9('0x12')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client'][_0xe4d9('0x14')]({'port':0x232a});var client9003=jayson[_0xe4d9('0x15')][_0xe4d9('0x14')]({'port':0x232b});var client9001=jayson['client'][_0xe4d9('0x14')]({'port':0x2329});function respondWithRpcPromise(_0x3f6ce4,_0xe4f133,_0x4283f7,_0x58d0cf){return new Promise(function(_0x331ef3,_0x35cbc2){var _0x4687f8=_0x58d0cf||client;return _0x4687f8['request'](_0x3f6ce4,_0x4283f7)['then'](function(_0x7abb80){logger[_0xe4d9('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xe4f133,_0xe4d9('0x17'));logger['debug'](_0xe4d9('0x18'),_0xe4f133,_0xe4d9('0x17'),JSON[_0xe4d9('0x19')](_0x7abb80));if(_0x7abb80[_0xe4d9('0x1a')]){if(_0x7abb80['error'][_0xe4d9('0x1b')]===0x1f4){logger[_0xe4d9('0x1a')](_0xe4d9('0x1c'),_0xe4f133,_0x7abb80[_0xe4d9('0x1a')][_0xe4d9('0x1d')]);return _0x35cbc2(_0x7abb80[_0xe4d9('0x1a')][_0xe4d9('0x1d')]);}logger[_0xe4d9('0x1a')](_0xe4d9('0x1c'),_0xe4f133,_0x7abb80['error'][_0xe4d9('0x1d')]);return _0x331ef3(_0x7abb80[_0xe4d9('0x1a')]['message']);}else{logger[_0xe4d9('0x16')]('ChatWebsite,\x20%s,\x20%s',_0xe4f133,_0xe4d9('0x17'));_0x331ef3(_0x7abb80[_0xe4d9('0x1e')]['message']);}})[_0xe4d9('0x1f')](function(_0x32e7da){logger['error'](_0xe4d9('0x1c'),_0xe4f133,_0x32e7da);_0x35cbc2(_0x32e7da);});});}function respondWithStatusCode(_0x2af9b0,_0x36444c){_0x36444c=_0x36444c||0xcc;return function(_0x5bb43b){if(_0x5bb43b){return _0x2af9b0['sendStatus'](_0x36444c);}return _0x2af9b0[_0xe4d9('0x20')](_0x36444c)[_0xe4d9('0x21')]();};}function respondWithResult(_0x52ef56,_0x5dddd2){_0x5dddd2=_0x5dddd2||0xc8;return function(_0x4954b5){if(_0x4954b5){return _0x52ef56['status'](_0x5dddd2)[_0xe4d9('0x22')](_0x4954b5);}};}function respondWithFilteredResult(_0x48d481,_0x40ffd0){return function(_0x1f3d90){if(_0x1f3d90){var _0x4192bb=typeof _0x40ffd0['offset']===_0xe4d9('0x23')&&typeof _0x40ffd0[_0xe4d9('0x24')]===_0xe4d9('0x23');var _0x45e8a3=_0x1f3d90[_0xe4d9('0x25')];var _0x1904d1=_0x4192bb?0x0:_0x40ffd0[_0xe4d9('0x26')];var _0x449cb8=_0x4192bb?_0x1f3d90[_0xe4d9('0x25')]:_0x40ffd0[_0xe4d9('0x26')]+_0x40ffd0[_0xe4d9('0x24')];var _0x29a121;if(_0x449cb8>=_0x45e8a3){_0x449cb8=_0x45e8a3;_0x29a121=0xc8;}else{_0x29a121=0xce;}_0x48d481['status'](_0x29a121);return _0x48d481[_0xe4d9('0x27')](_0xe4d9('0x28'),_0x1904d1+'-'+_0x449cb8+'/'+_0x45e8a3)[_0xe4d9('0x22')](_0x1f3d90);}return null;};}function saveUpdates(_0x3721a0){return function(_0xa444d0){if(_0xa444d0){return _0xa444d0[_0xe4d9('0x29')](_0x3721a0)['then'](function(_0x532414){return _0x532414;});}return null;};}function removeEntity(_0x4d7f17){return function(_0x270cad){if(_0x270cad){return _0x270cad[_0xe4d9('0x2a')]()[_0xe4d9('0x2b')](function(){var _0x4f8abf=_0x270cad['get']({'plain':!![]});var _0x5ad794='ChatWebsites';return db[_0xe4d9('0x2c')][_0xe4d9('0x2a')]({'where':{'type':_0x5ad794,'resourceId':_0x4f8abf['id']}})['then'](function(){return _0x270cad;});})[_0xe4d9('0x2b')](function(){_0x4d7f17[_0xe4d9('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x831143){return function(_0x20e78a){if(!_0x20e78a){_0x831143[_0xe4d9('0x2d')](0x194);}return _0x20e78a;};}function handleError(_0x4f7a6c,_0x3321f8){_0x3321f8=_0x3321f8||0x1f4;return function(_0x37a825){logger[_0xe4d9('0x1a')](_0x37a825[_0xe4d9('0x2e')]);if(_0x37a825[_0xe4d9('0x2f')]){delete _0x37a825[_0xe4d9('0x2f')];}_0x4f7a6c[_0xe4d9('0x20')](_0x3321f8)[_0xe4d9('0x30')](_0x37a825);};}function createInteractionObject(_0x234b62,_0x34f72f,_0x5601cc,_0x35b5f5){var _0x20aef6=require(_0xe4d9('0x31'));var _0x27028d=new _0x20aef6();var _0x26a721=_0x27028d[_0xe4d9('0x32')](_0x5601cc[_0xe4d9('0x33')])[_0xe4d9('0x34')]();var _0x96a350=_0x34f72f['customerIp'];if(_0x5601cc['cf-connecting-ip']){_0x96a350=_0x5601cc['cf-connecting-ip'];}else if(_0x5601cc[_0xe4d9('0x35')]){_0x96a350=_[_0xe4d9('0x36')](_0x5601cc[_0xe4d9('0x35')][_0xe4d9('0x37')](','));}return{'ContactId':_0x35b5f5['id'],'ChatWebsiteId':_0x234b62,'from':(_0x35b5f5[_0xe4d9('0x38')]||'')+'\x20'+(_0x35b5f5[_0xe4d9('0x39')]||''),'customerIp':_0x96a350,'customerPort':_0x5601cc[_0xe4d9('0x3a')]?_0x5601cc['x-real-port']:null,'referer':_0x34f72f['referer'],'browserName':_0x26a721['browser'][_0xe4d9('0x2f')]&&_0x26a721[_0xe4d9('0x3b')]['version']?util[_0xe4d9('0x3c')](_0xe4d9('0x3d'),_0x26a721[_0xe4d9('0x3b')][_0xe4d9('0x2f')],_0x26a721['browser'][_0xe4d9('0x3e')]):_0xe4d9('0x3f'),'browserVersion':_0x26a721[_0xe4d9('0x3b')][_0xe4d9('0x3e')]||_0xe4d9('0x3f'),'osName':util[_0xe4d9('0x3c')](_0xe4d9('0x3d'),_0x26a721['os'][_0xe4d9('0x2f')],_0x26a721['os'][_0xe4d9('0x3e')]),'osVersion':_0x26a721['os'][_0xe4d9('0x3e')],'deviceModel':_0x26a721[_0xe4d9('0x40')]['model']&&_0x26a721[_0xe4d9('0x40')][_0xe4d9('0x41')]?util[_0xe4d9('0x3c')](_0xe4d9('0x42'),_0x26a721[_0xe4d9('0x40')]['model'],_0x26a721[_0xe4d9('0x40')][_0xe4d9('0x41')],_0x26a721[_0xe4d9('0x40')][_0xe4d9('0x43')]):null,'deviceVendor':_0x26a721[_0xe4d9('0x40')][_0xe4d9('0x41')],'deviceType':_0x26a721[_0xe4d9('0x40')][_0xe4d9('0x43')],'formData':JSON[_0xe4d9('0x19')](_0x34f72f)};}exports[_0xe4d9('0x44')]=function(_0x5510e7,_0x246550){var _0x179117={'include':[{'model':db[_0xe4d9('0x45')],'as':_0xe4d9('0x46')}]},_0x96ead7={},_0x54bf07={'count':0x0,'rows':[]};var _0x79baad=_[_0xe4d9('0x47')](db[_0xe4d9('0x48')][_0xe4d9('0x49')],function(_0x126b6c){return{'name':_0x126b6c['fieldName'],'type':_0x126b6c[_0xe4d9('0x43')][_0xe4d9('0x4a')]};});_0x96ead7[_0xe4d9('0x4b')]=_[_0xe4d9('0x47')](_0x79baad,_0xe4d9('0x2f'));_0x96ead7[_0xe4d9('0x4c')]=_['keys'](_0x5510e7[_0xe4d9('0x4c')]);_0x96ead7[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x96ead7[_0xe4d9('0x4b')],_0x96ead7[_0xe4d9('0x4c')]);_0x179117[_0xe4d9('0x4f')]=_['intersection'](_0x96ead7[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x5510e7['query'][_0xe4d9('0x50')]));_0x179117['attributes']=_0x179117[_0xe4d9('0x4f')][_0xe4d9('0x51')]?_0x179117['attributes']:_0x96ead7[_0xe4d9('0x4b')];if(!_0x5510e7['query'][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x179117[_0xe4d9('0x24')]=qs['limit'](_0x5510e7[_0xe4d9('0x4c')][_0xe4d9('0x24')]);_0x179117['offset']=qs[_0xe4d9('0x26')](_0x5510e7[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}_0x179117[_0xe4d9('0x54')]=qs['sort'](_0x5510e7['query'][_0xe4d9('0x55')]);_0x179117[_0xe4d9('0x56')]=qs[_0xe4d9('0x4d')](_[_0xe4d9('0x57')](_0x5510e7[_0xe4d9('0x4c')],_0x96ead7[_0xe4d9('0x4d')]),_0x79baad);if(_0x5510e7['query']['filter']){_0x179117[_0xe4d9('0x56')]=_[_0xe4d9('0x58')](_0x179117[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x79baad,function(_0xfe53b8){if(_0xfe53b8[_0xe4d9('0x43')]!=='VIRTUAL'){var _0x4ac680={};_0x4ac680[_0xfe53b8[_0xe4d9('0x2f')]]={'$like':'%'+_0x5510e7[_0xe4d9('0x4c')]['filter']+'%'};return _0x4ac680;}})});}_0x179117=_[_0xe4d9('0x58')]({},_0x179117,_0x5510e7[_0xe4d9('0x59')]);var _0x281fda={'where':_0x179117['where']};return db[_0xe4d9('0x48')]['count'](_0x281fda)[_0xe4d9('0x2b')](function(_0x13b008){_0x54bf07[_0xe4d9('0x25')]=_0x13b008;if(_0x5510e7['query']['includeAll']){_0x179117['include']=[{'all':!![]}];}return db[_0xe4d9('0x48')]['findAll'](_0x179117);})[_0xe4d9('0x2b')](function(_0x4c37a6){_0x54bf07['rows']=_0x4c37a6;return _0x54bf07;})[_0xe4d9('0x2b')](respondWithFilteredResult(_0x246550,_0x179117))[_0xe4d9('0x1f')](handleError(_0x246550,null));};exports[_0xe4d9('0x5a')]=function(_0x1469b8,_0x1ef819){var _0x580bb4={'raw':![],'where':{'id':_0x1469b8['params']['id']},'include':[{'model':db['Pause'],'as':_0xe4d9('0x46')}]},_0x49a622={};_0x49a622[_0xe4d9('0x4b')]=_[_0xe4d9('0x5b')](db[_0xe4d9('0x48')][_0xe4d9('0x49')]);_0x49a622[_0xe4d9('0x4c')]=_[_0xe4d9('0x5b')](_0x1469b8['query']);_0x49a622['filters']=_[_0xe4d9('0x4e')](_0x49a622[_0xe4d9('0x4b')],_0x49a622[_0xe4d9('0x4c')]);_0x580bb4[_0xe4d9('0x4f')]=_[_0xe4d9('0x4e')](_0x49a622[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x1469b8[_0xe4d9('0x4c')][_0xe4d9('0x50')]));_0x580bb4[_0xe4d9('0x4f')]=_0x580bb4[_0xe4d9('0x4f')][_0xe4d9('0x51')]?_0x580bb4['attributes']:_0x49a622[_0xe4d9('0x4b')];if(_0x1469b8[_0xe4d9('0x4c')][_0xe4d9('0x5c')]){_0x580bb4[_0xe4d9('0x5d')]=[{'all':!![]}];}_0x580bb4=_['merge']({},_0x580bb4,_0x1469b8['options']);return db['ChatWebsite'][_0xe4d9('0x5e')](_0x580bb4)[_0xe4d9('0x2b')](handleEntityNotFound(_0x1ef819,null))[_0xe4d9('0x2b')](respondWithResult(_0x1ef819,null))[_0xe4d9('0x1f')](handleError(_0x1ef819,null));};exports['create']=function(_0x53975f,_0x383cd4){var _0xf41d89=null;_0x53975f[_0xe4d9('0x5f')][_0xe4d9('0x60')][_0xe4d9('0x37')](',')[_0xe4d9('0x61')](_0x4bb111=>{if(_0x4bb111[_0xe4d9('0x62')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x4bb111[_0xe4d9('0x62')]())){_0xf41d89=new APIBadRequestError('\x22'+_0x4bb111[_0xe4d9('0x62')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0xf41d89){return handleError(_0x383cd4,null)(_0xf41d89);}return db[_0xe4d9('0x48')][_0xe4d9('0x63')](_0x53975f['body'],{})[_0xe4d9('0x2b')](function(_0x655901){var _0x46d795=_0x53975f[_0xe4d9('0x64')][_0xe4d9('0x65')]({'plain':!![]});if(!_0x46d795)throw new Error(_0xe4d9('0x66'));if(_0x46d795['role']==='user'){var _0x3473ad=_0x655901['get']({'plain':!![]});var _0x10ef01='ChatWebsites';return db['UserProfileSection'][_0xe4d9('0x5e')]({'where':{'name':_0x10ef01,'userProfileId':_0x46d795[_0xe4d9('0x67')]},'raw':!![]})[_0xe4d9('0x2b')](function(_0x5b0471){if(_0x5b0471&&_0x5b0471[_0xe4d9('0x68')]===0x0){return db['UserProfileResource'][_0xe4d9('0x63')]({'name':_0x3473ad[_0xe4d9('0x2f')],'resourceId':_0x3473ad['id'],'type':_0x5b0471[_0xe4d9('0x2f')],'sectionId':_0x5b0471['id']},{})[_0xe4d9('0x2b')](function(){return _0x655901;});}else{return _0x655901;}})['catch'](function(_0x3b9fd3){logger[_0xe4d9('0x1a')](_0xe4d9('0x69'),_0x3b9fd3);throw _0x3b9fd3;});}return _0x655901;})[_0xe4d9('0x2b')](respondWithResult(_0x383cd4,0xc9))[_0xe4d9('0x1f')](handleError(_0x383cd4,null));};exports[_0xe4d9('0x29')]=function(_0x1fa518,_0x2ce194){var _0x29c3fe=null;_0x1fa518['body'][_0xe4d9('0x60')]['split'](',')[_0xe4d9('0x61')](_0x2847b9=>{if(_0x2847b9[_0xe4d9('0x62')]()!==''&&!wildcardUtils[_0xe4d9('0x6a')](_0x2847b9['trim']())){_0x29c3fe=new APIBadRequestError('\x22'+_0x2847b9['trim']()+_0xe4d9('0x6b'));}});if(_0x29c3fe){return handleError(_0x2ce194,null)(_0x29c3fe);}if(_0x1fa518[_0xe4d9('0x5f')]['id']){delete _0x1fa518[_0xe4d9('0x5f')]['id'];}return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x1fa518[_0xe4d9('0x6c')]['id']},'include':[{'model':db[_0xe4d9('0x45')],'as':_0xe4d9('0x46')}]})[_0xe4d9('0x2b')](handleEntityNotFound(_0x2ce194,null))['then'](saveUpdates(_0x1fa518[_0xe4d9('0x5f')],null))[_0xe4d9('0x2b')](respondWithResult(_0x2ce194,null))['catch'](handleError(_0x2ce194,null));};exports[_0xe4d9('0x2a')]=function(_0x440457,_0x1b5c79){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x440457['params']['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x1b5c79,null))[_0xe4d9('0x2b')](removeEntity(_0x1b5c79,null))[_0xe4d9('0x1f')](handleError(_0x1b5c79,null));};exports[_0xe4d9('0x6d')]=function(_0x458eea,_0x354259){return db[_0xe4d9('0x48')][_0xe4d9('0x6d')]()[_0xe4d9('0x2b')](respondWithResult(_0x354259,null))['catch'](handleError(_0x354259,null));};exports[_0xe4d9('0x6e')]=function(_0x5442b7,_0x28fb7d){if(_0x5442b7[_0xe4d9('0x5f')]['id']){delete _0x5442b7[_0xe4d9('0x5f')]['id'];}return db[_0xe4d9('0x48')]['find']({'where':{'id':_0x5442b7[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x28fb7d,null))['then'](function(_0x23bcfe){if(_0x23bcfe){_0x5442b7[_0xe4d9('0x5f')]['ChatWebsiteId']=_0x23bcfe['id'];return db[_0xe4d9('0x6f')][_0xe4d9('0x63')](_0x5442b7[_0xe4d9('0x5f')]);}})[_0xe4d9('0x2b')](respondWithResult(_0x28fb7d,null))[_0xe4d9('0x1f')](handleError(_0x28fb7d,null));};exports[_0xe4d9('0x70')]=function(_0x28b900,_0x23d38f){var _0x3e1fd4={'raw':![],'where':{}};var _0x5429fa={};var _0xdfe0af={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xe4d9('0x71')]({'where':{'id':_0x28b900['params']['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x23d38f,null))[_0xe4d9('0x2b')](function(_0x1a7596){if(_0x1a7596){_0x5429fa[_0xe4d9('0x4b')]=_[_0xe4d9('0x5b')](db[_0xe4d9('0x6f')][_0xe4d9('0x49')]);_0x5429fa[_0xe4d9('0x4c')]=_['keys'](_0x28b900[_0xe4d9('0x4c')]);_0x5429fa[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x5429fa[_0xe4d9('0x4b')],_0x5429fa[_0xe4d9('0x4c')]);_0x3e1fd4[_0xe4d9('0x4f')]=_[_0xe4d9('0x4e')](_0x5429fa[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x28b900[_0xe4d9('0x4c')][_0xe4d9('0x50')]));_0x3e1fd4[_0xe4d9('0x4f')]=_0x3e1fd4[_0xe4d9('0x4f')]['length']?_0x3e1fd4[_0xe4d9('0x4f')]:_0x5429fa[_0xe4d9('0x4b')];if(!_0x28b900['query'][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x3e1fd4['limit']=qs[_0xe4d9('0x24')](_0x28b900[_0xe4d9('0x4c')][_0xe4d9('0x24')]);_0x3e1fd4[_0xe4d9('0x26')]=qs[_0xe4d9('0x26')](_0x28b900[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}_0x3e1fd4[_0xe4d9('0x54')]=qs[_0xe4d9('0x55')](_0x28b900[_0xe4d9('0x4c')][_0xe4d9('0x55')]);_0x3e1fd4[_0xe4d9('0x56')]=qs[_0xe4d9('0x4d')](_['pick'](_0x28b900['query'],_0x5429fa['filters']));_0x3e1fd4[_0xe4d9('0x56')][_0xe4d9('0x72')]=_0x1a7596['id'];if(_0x28b900['query']['filter']){_0x3e1fd4[_0xe4d9('0x56')]=_['merge'](_0x3e1fd4[_0xe4d9('0x56')],{'$or':_['map'](_0x3e1fd4[_0xe4d9('0x4f')],function(_0x133f5a){var _0x5b2782={};_0x5b2782[_0x133f5a]={'$like':'%'+_0x28b900[_0xe4d9('0x4c')][_0xe4d9('0x73')]+'%'};return _0x5b2782;})});}_0x3e1fd4=_[_0xe4d9('0x58')]({},_0x3e1fd4,_0x28b900['options']);return db[_0xe4d9('0x6f')][_0xe4d9('0x25')]({'where':_0x3e1fd4[_0xe4d9('0x56')]})[_0xe4d9('0x2b')](function(_0xaab18c){_0xdfe0af[_0xe4d9('0x25')]=_0xaab18c;if(_0x28b900[_0xe4d9('0x4c')][_0xe4d9('0x5c')]){_0x3e1fd4[_0xe4d9('0x5d')]=[{'all':!![]}];}return db[_0xe4d9('0x6f')][_0xe4d9('0x74')](_0x3e1fd4);})[_0xe4d9('0x2b')](function(_0x1936ab){_0xdfe0af[_0xe4d9('0x75')]=_0x1936ab;return _0xdfe0af;});}})[_0xe4d9('0x2b')](respondWithFilteredResult(_0x23d38f,_0x3e1fd4))[_0xe4d9('0x1f')](handleError(_0x23d38f,null));};exports[_0xe4d9('0x76')]=function(_0x35af23,_0x2c1ac4){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x35af23[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x2c1ac4,null))[_0xe4d9('0x2b')](function(_0x558f1e){if(_0x558f1e){return _0x558f1e[_0xe4d9('0x76')](_0x35af23[_0xe4d9('0x4c')][_0xe4d9('0x77')]);}})[_0xe4d9('0x2b')](respondWithStatusCode(_0x2c1ac4,null))[_0xe4d9('0x1f')](handleError(_0x2c1ac4,null));};exports['addAnswer']=function(_0x2dcdf9,_0x57adb6){if(_0x2dcdf9[_0xe4d9('0x5f')]['id']){delete _0x2dcdf9[_0xe4d9('0x5f')]['id'];}return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x2dcdf9[_0xe4d9('0x6c')]['id']}})['then'](handleEntityNotFound(_0x57adb6,null))[_0xe4d9('0x2b')](function(_0x27404d){if(_0x27404d){_0x2dcdf9[_0xe4d9('0x5f')][_0xe4d9('0x72')]=_0x27404d['id'];return db['CannedAnswer']['create'](_0x2dcdf9[_0xe4d9('0x5f')]);}})[_0xe4d9('0x2b')](respondWithResult(_0x57adb6,null))['catch'](handleError(_0x57adb6,null));};exports[_0xe4d9('0x78')]=function(_0x35a316,_0x312699){var _0x2ab4a3={'raw':![],'where':{}};var _0x40a04f={};var _0x28c84a={'count':0x0,'rows':[]};return db[_0xe4d9('0x48')][_0xe4d9('0x71')]({'where':{'id':_0x35a316[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x312699,null))[_0xe4d9('0x2b')](function(_0x52a87d){if(_0x52a87d){_0x40a04f[_0xe4d9('0x4b')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x40a04f[_0xe4d9('0x4c')]=_[_0xe4d9('0x5b')](_0x35a316[_0xe4d9('0x4c')]);_0x40a04f[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x40a04f[_0xe4d9('0x4b')],_0x40a04f[_0xe4d9('0x4c')]);_0x2ab4a3['attributes']=_[_0xe4d9('0x4e')](_0x40a04f[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x35a316[_0xe4d9('0x4c')][_0xe4d9('0x50')]));_0x2ab4a3['attributes']=_0x2ab4a3[_0xe4d9('0x4f')][_0xe4d9('0x51')]?_0x2ab4a3['attributes']:_0x40a04f[_0xe4d9('0x4b')];if(!_0x35a316[_0xe4d9('0x4c')][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x2ab4a3['limit']=qs[_0xe4d9('0x24')](_0x35a316['query'][_0xe4d9('0x24')]);_0x2ab4a3[_0xe4d9('0x26')]=qs[_0xe4d9('0x26')](_0x35a316[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}_0x2ab4a3[_0xe4d9('0x54')]=qs[_0xe4d9('0x55')](_0x35a316['query']['sort']);_0x2ab4a3[_0xe4d9('0x56')]=qs[_0xe4d9('0x4d')](_[_0xe4d9('0x57')](_0x35a316[_0xe4d9('0x4c')],_0x40a04f['filters']));_0x2ab4a3['where']['ChatWebsiteId']=_0x52a87d['id'];if(_0x35a316[_0xe4d9('0x4c')][_0xe4d9('0x73')]){_0x2ab4a3[_0xe4d9('0x56')]=_[_0xe4d9('0x58')](_0x2ab4a3[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x2ab4a3[_0xe4d9('0x4f')],function(_0x3d0dca){var _0x57a98f={};_0x57a98f[_0x3d0dca]={'$like':'%'+_0x35a316[_0xe4d9('0x4c')][_0xe4d9('0x73')]+'%'};return _0x57a98f;})});}_0x2ab4a3=_['merge']({},_0x2ab4a3,_0x35a316['options']);return db[_0xe4d9('0x79')][_0xe4d9('0x25')]({'where':_0x2ab4a3[_0xe4d9('0x56')]})[_0xe4d9('0x2b')](function(_0x5bf730){_0x28c84a[_0xe4d9('0x25')]=_0x5bf730;if(_0x35a316[_0xe4d9('0x4c')]['includeAll']){_0x2ab4a3[_0xe4d9('0x5d')]=[{'all':!![]}];}return db['CannedAnswer'][_0xe4d9('0x74')](_0x2ab4a3);})['then'](function(_0x317cec){_0x28c84a['rows']=_0x317cec;return _0x28c84a;});}})[_0xe4d9('0x2b')](respondWithFilteredResult(_0x312699,_0x2ab4a3))[_0xe4d9('0x1f')](handleError(_0x312699,null));};exports[_0xe4d9('0x7a')]=function(_0x393384,_0x255b71){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x393384[_0xe4d9('0x6c')]['id']}})['then'](handleEntityNotFound(_0x255b71,null))[_0xe4d9('0x2b')](function(_0x552a22){if(_0x552a22){return _0x552a22[_0xe4d9('0x7a')](_0x393384[_0xe4d9('0x4c')][_0xe4d9('0x77')]);}})[_0xe4d9('0x2b')](respondWithStatusCode(_0x255b71,null))[_0xe4d9('0x1f')](handleError(_0x255b71,null));};exports[_0xe4d9('0x7b')]=function(_0x543c7b,_0x308859){_0x543c7b[_0xe4d9('0x5f')][_0xe4d9('0x7c')]=_0x543c7b[_0xe4d9('0x7d')][_0xe4d9('0x7e')];return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x543c7b[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x308859,null))['then'](saveUpdates(_0x543c7b['body'],null))[_0xe4d9('0x2b')](respondWithResult(_0x308859,null))[_0xe4d9('0x1f')](handleError(_0x308859,null));};exports[_0xe4d9('0x7f')]=function(_0x280160,_0x5a5446){_0x280160[_0xe4d9('0x5f')]['agentAvatar']=_0x280160[_0xe4d9('0x7d')][_0xe4d9('0x7e')];return db['ChatWebsite']['find']({'where':{'id':_0x280160[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x5a5446,null))[_0xe4d9('0x2b')](saveUpdates(_0x280160[_0xe4d9('0x5f')],null))[_0xe4d9('0x2b')](respondWithResult(_0x5a5446,null))[_0xe4d9('0x1f')](handleError(_0x5a5446,null));};exports[_0xe4d9('0x80')]=function(_0x2af820,_0x4fdebb){_0x2af820[_0xe4d9('0x5f')][_0xe4d9('0x81')]=_0x2af820[_0xe4d9('0x7d')]['filename'];return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x2af820['params']['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x4fdebb,null))[_0xe4d9('0x2b')](saveUpdates(_0x2af820[_0xe4d9('0x5f')],null))[_0xe4d9('0x2b')](respondWithResult(_0x4fdebb,null))[_0xe4d9('0x1f')](handleError(_0x4fdebb,null));};exports['addSystemAvatar']=function(_0x3e69ba,_0x53aa65){_0x3e69ba['body'][_0xe4d9('0x82')]=_0x3e69ba[_0xe4d9('0x7d')]['filename'];return db['ChatWebsite'][_0xe4d9('0x5e')]({'where':{'id':_0x3e69ba[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x53aa65,null))[_0xe4d9('0x2b')](saveUpdates(_0x3e69ba[_0xe4d9('0x5f')],null))[_0xe4d9('0x2b')](respondWithResult(_0x53aa65,null))[_0xe4d9('0x1f')](handleError(_0x53aa65,null));};exports[_0xe4d9('0x83')]=function(_0x1794e1,_0x59dcff){var _0x175eed=path['join'](config['root'],_0xe4d9('0x84'));var _0x7e202d={'where':{'id':_0x1794e1['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x576fcf=![];return require(_0xe4d9('0x85'))['getLicense']()[_0xe4d9('0x2b')](function(_0x4c8cd1){if(_0x4c8cd1){_0x576fcf=_0x4c8cd1[_0xe4d9('0x86')];}})[_0xe4d9('0x2b')](function(){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')](_0x7e202d);})['then'](handleEntityNotFound(_0x59dcff,null))[_0xe4d9('0x2b')](function(_0x14b55f){if(_0x14b55f){if(!_[_0xe4d9('0x87')](_0x14b55f[_0xe4d9('0x7c')])){if(fs[_0xe4d9('0x88')](path['join'](config['root'],_0xe4d9('0x89'),_0x14b55f[_0xe4d9('0x7c')]))&&_0x576fcf){_0x175eed=path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0x89'),_0x14b55f[_0xe4d9('0x7c')]);}}return _0x59dcff['download'](_0x175eed);}})[_0xe4d9('0x1f')](handleError(_0x59dcff,null));};exports['getAvatar']=function(_0x5e6f0f,_0x1fbcad){var _0x446551=path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0x8c'));var _0x4eb401={'where':{'id':_0x5e6f0f[_0xe4d9('0x6c')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xe4d9('0x48')][_0xe4d9('0x5e')](_0x4eb401)[_0xe4d9('0x2b')](handleEntityNotFound(_0x1fbcad,null))['then'](function(_0x392bef){if(_0x392bef){if(!_['isNil'](_0x392bef['agentAvatar'])){if(fs[_0xe4d9('0x88')](path[_0xe4d9('0x8a')](config['root'],'server/files/images/avatars/',_0x392bef[_0xe4d9('0x8d')]))){_0x446551=path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0x8e'),_0x392bef[_0xe4d9('0x8d')]);}}return _0x1fbcad[_0xe4d9('0x8f')](_0x446551);}})[_0xe4d9('0x1f')](handleError(_0x1fbcad,null));};exports['getCustomerAvatar']=function(_0x4c69ee,_0x704678){var _0x22ef03=path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],'server/files/images/avatars/customer_avatar.png');var _0x15ad99={'where':{'id':_0x4c69ee[_0xe4d9('0x6c')]['id']},'attributes':['id',_0xe4d9('0x81'),_0xe4d9('0x90')],'raw':!![]};return db[_0xe4d9('0x48')][_0xe4d9('0x5e')](_0x15ad99)[_0xe4d9('0x2b')](handleEntityNotFound(_0x704678,null))[_0xe4d9('0x2b')](function(_0x41ff9f){if(_0x41ff9f){if(!_[_0xe4d9('0x87')](_0x41ff9f['customerAvatar'])){if(fs[_0xe4d9('0x88')](path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0x8e'),_0x41ff9f[_0xe4d9('0x81')]))&&_0x41ff9f[_0xe4d9('0x90')]){_0x22ef03=path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0x8e'),_0x41ff9f['customerAvatar']);}}return _0x704678[_0xe4d9('0x8f')](_0x22ef03);}})[_0xe4d9('0x1f')](handleError(_0x704678,null));};exports[_0xe4d9('0x91')]=function(_0x4cacc0,_0x4697d0){var _0x538db5=path[_0xe4d9('0x8a')](config['root'],'server/files/images/avatars/system_avatar.png');var _0x5839c5={'where':{'id':_0x4cacc0[_0xe4d9('0x6c')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite'][_0xe4d9('0x5e')](_0x5839c5)[_0xe4d9('0x2b')](handleEntityNotFound(_0x4697d0,null))[_0xe4d9('0x2b')](function(_0x4e0e73){if(_0x4e0e73){if(!_[_0xe4d9('0x87')](_0x4e0e73[_0xe4d9('0x82')])){if(fs[_0xe4d9('0x88')](path['join'](config[_0xe4d9('0x8b')],_0xe4d9('0x8e'),_0x4e0e73[_0xe4d9('0x82')]))){_0x538db5=path[_0xe4d9('0x8a')](config['root'],_0xe4d9('0x8e'),_0x4e0e73[_0xe4d9('0x82')]);}}return _0x4697d0['download'](_0x538db5);}})[_0xe4d9('0x1f')](handleError(_0x4697d0,null));};function checkWebsiteInterval(_0x46c5c4){var _0xed4466=_0x46c5c4[_0xe4d9('0x92')];if(!_0xed4466){return Promise[_0xe4d9('0x93')](_0x46c5c4);}var _0x3d5ad2=_0x46c5c4[_0xe4d9('0x94')]||undefined;return _0xed4466[_0xe4d9('0x95')](_0x3d5ad2)['then'](function(_0x1d1b63){if(!_0x1d1b63){throw new APIOutOfIntervalError();}return _0x46c5c4;});}exports[_0xe4d9('0x96')]=function(_0x15945a,_0x3c2a9e){var _0x7f62c6={'body':_0x15945a[_0xe4d9('0x5f')],'channel':_0xe4d9('0x97')};var _0x1dadff=[];var _0x36584b=[];var _0x388c77={};var _0x5d2e5a=![];if(_0x15945a[_0xe4d9('0x5f')]['id']){delete _0x15945a[_0xe4d9('0x5f')]['id'];}if(_['isNil'](_0x15945a['body'][_0xe4d9('0x98')])){throw new APIBadRequestError(_0xe4d9('0x99'));}if(_[_0xe4d9('0x87')](_0x15945a['body'][_0xe4d9('0x9a')])){throw new APIBadRequestError(_0xe4d9('0x9b'));}if(_['isEmpty'](_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x5f')])){throw new APIBadRequestError(_0xe4d9('0x9c'));}var _0xcfc051=_0x15945a['body'][_0xe4d9('0x9d')]&&_0x15945a['body']['referer'];return db[_0xe4d9('0x9e')][_0xe4d9('0x6d')]()['then'](function(_0x1571e8){if(!_0x1571e8){throw new Error('No\x20available\x20attributes');}_0x1dadff=Object[_0xe4d9('0x5b')](_0x1571e8)['filter'](function(_0x230c52){return![_0xe4d9('0x9f'),_0xe4d9('0xa0')]['includes'](_0x230c52);});_0x36584b=Object[_0xe4d9('0x5b')](_0x1571e8)['filter'](function(_0x248782){return![_0xe4d9('0x9f'),'updatedAt',_0xe4d9('0xa1'),'ListId'][_0xe4d9('0xa2')](_0x248782);});if(!_[_0xe4d9('0xa2')](_0x36584b,_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x9a')])){throw new APIBadRequestError(_0xe4d9('0xa3')+_0x36584b[_0xe4d9('0x8a')](',\x20'));}_0x388c77[_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x9a')]]=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x98')];})[_0xe4d9('0x2b')](function(){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x15945a[_0xe4d9('0x6c')]['id']},'include':[{'model':db['CmList'],'as':_0xe4d9('0xa4'),'include':[{'model':db[_0xe4d9('0x9e')],'as':_0xe4d9('0xa5'),'where':_0x388c77,'limit':0x1,'order':[[_0xe4d9('0xa0'),_0xe4d9('0xa6')]]}]},{'model':db[_0xe4d9('0xa7')],'as':_0xe4d9('0xa8')},{'model':db['Interval'],'as':_0xe4d9('0x92'),'include':[{'model':db[_0xe4d9('0x92')],'as':_0xe4d9('0xa9'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0xe4d9('0x2b')](function(_0x1c04ed){if(!_0x1c04ed){throw new APINotFoundError(util[_0xe4d9('0x3c')](_0xe4d9('0xaa'),_0x15945a[_0xe4d9('0x6c')]['id']));}if(_0xcfc051){return checkWebsiteInterval(_0x1c04ed);}return _0x1c04ed;})[_0xe4d9('0x2b')](function(_0x2e0efe){_0x7f62c6[_0xe4d9('0xab')]=_0x2e0efe;_0x7f62c6[_0xe4d9('0xac')]=_[_0xe4d9('0xad')](_0x2e0efe[_0xe4d9('0xa8')],[_0xe4d9('0xae')],[_0xe4d9('0xaf')]);if(_0x7f62c6[_0xe4d9('0xab')][_0xe4d9('0xa8')]){delete _0x7f62c6[_0xe4d9('0xab')][_0xe4d9('0xa8')];}_0x7f62c6['list']=_0x2e0efe[_0xe4d9('0xa4')]||{'id':_0x2e0efe['ListId']};if(_0x7f62c6[_0xe4d9('0xb0')]&&_0x7f62c6['list']['Contacts'][_0xe4d9('0x51')]){return _0x7f62c6['list'][_0xe4d9('0xa5')][0x0];}var _0x1ada99=_[_0xe4d9('0x13')](_0x15945a[_0xe4d9('0x5f')],{'firstName':_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x98')],'ListId':_0x2e0efe[_0xe4d9('0xb1')]});_0x1ada99[_0x15945a['body'][_0xe4d9('0x9a')]]=_0x15945a[_0xe4d9('0x5f')]['from'];return db['CmContact']['create'](_0x1ada99,{'fields':_0x1dadff,'raw':!![]});})[_0xe4d9('0x2b')](function(_0x383dcf){_0x7f62c6['contact']=_0x383dcf;var _0x34b65=createInteractionObject(_0x15945a[_0xe4d9('0x6c')]['id'],_0x15945a[_0xe4d9('0x5f')],_0x15945a[_0xe4d9('0xb2')],_0x383dcf);var _0x398aad={'ChatWebsiteId':_0x15945a[_0xe4d9('0x6c')]['id']};if(_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xb3')]){_0x398aad['threadId']=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xb3')];_0x398aad[_0xe4d9('0xb4')]=![];return db[_0xe4d9('0xb5')][_0xe4d9('0x5e')]({'where':_0x398aad})['then'](function(_0x3b639e){var _0x1f6960=_0x15945a['body'][_0xe4d9('0x9d')]&&_0x15945a['body'][_0xe4d9('0xb6')];if(_0x3b639e){_0x5d2e5a=!![];return _0x3b639e;}else if(!_0x1f6960&&_0x3b639e&&_0x3b639e[_0xe4d9('0xb4')]){throw new APIConflictError(_0xe4d9('0xb7'));}_0x34b65[_0xe4d9('0xb3')]=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xb3')];_0x34b65[_0xe4d9('0xb8')]=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xb8')];return db[_0xe4d9('0xb5')][_0xe4d9('0x63')](_0x34b65);});}_0x398aad[_0xe4d9('0xb9')]=_0x383dcf['id'];if(_0x15945a['body'][_0xe4d9('0xba')]&&_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xba')]['id']){_0x398aad['id']=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xba')]['id'];return db[_0xe4d9('0xb5')][_0xe4d9('0x5e')]({'where':_0x398aad})[_0xe4d9('0x2b')](function(_0x3d56d6){var _0x8c2807=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x9d')]&&_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xb6')];if(!_0x8c2807&&_0x3d56d6&&_0x3d56d6['closed']){throw new APIConflictError(_0xe4d9('0xb7'));}else if(_0x3d56d6){_0x5d2e5a=!![];return _0x3d56d6;}else{return db[_0xe4d9('0xb5')][_0xe4d9('0x63')](_0x34b65);}});}return db[_0xe4d9('0xb5')][_0xe4d9('0x63')](_0x34b65);})[_0xe4d9('0x2b')](function(_0x133565){if(!_0x5d2e5a){return _0x133565;}var _0x3da039={'from':(_0x7f62c6['contact']['firstName']||'')+'\x20'+(_0x7f62c6[_0xe4d9('0xbb')]['lastName']||'')};if(_0x15945a['body'][_0xe4d9('0xb3')]&&_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xbc')]&&_0x15945a['body']['threadId']!=_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0xbc')]){_0x3da039[_0xe4d9('0xb3')]=_0x15945a['body'][_0xe4d9('0xbc')];}return _0x133565[_0xe4d9('0x29')](_0x3da039);})[_0xe4d9('0x2b')](function(_0x4e384c){_0x7f62c6[_0xe4d9('0xba')]=_0x4e384c['get']({'plain':!![]});_0x7f62c6[_0xe4d9('0xba')][_0xe4d9('0xbd')]=!_0x5d2e5a;if(_0x7f62c6[_0xe4d9('0xba')][_0xe4d9('0xbd')]){if(_0x7f62c6[_0xe4d9('0xab')]['autoclose']){_0x7f62c6[_0xe4d9('0xac')]['push']({'id':0x0,'priority':_0x7f62c6[_0xe4d9('0xac')][_0xe4d9('0x51')]+0x1,'app':'close','appdata':'unmanaged','interval':_0xe4d9('0xbe')});}}return db['ChatMessage'][_0xe4d9('0x63')]({'body':_0x15945a[_0xe4d9('0x5f')][_0xe4d9('0x5f')],'ChatWebsiteId':_0x15945a[_0xe4d9('0x6c')]['id'],'ChatInteractionId':_0x4e384c['id'],'direction':'in','ContactId':_0x7f62c6[_0xe4d9('0xbb')]['id'],'AttachmentId':_0x15945a[_0xe4d9('0x5f')]['AttachmentId']});})[_0xe4d9('0x2b')](function(_0x55da19){_0x7f62c6[_0xe4d9('0x1d')]=_0x55da19;if(!_0x7f62c6[_0xe4d9('0xba')][_0xe4d9('0xbf')]){return;}return db['User'][_0xe4d9('0x5e')]({'attributes':['id',_0xe4d9('0x2f')],'where':{'id':_0x7f62c6[_0xe4d9('0xba')]['UserId']}});})[_0xe4d9('0x2b')](function(_0x2c508a){if(_0x2c508a){_0x7f62c6[_0xe4d9('0xac')][_0xe4d9('0xc0')]({'id':0x0,'priority':0x0,'app':_0xe4d9('0xc1'),'appdata':_0x2c508a[_0xe4d9('0x2f')]+','+(_0x7f62c6[_0xe4d9('0xab')][_0xe4d9('0xc2')]||0xa),'interval':_0xe4d9('0xbe')});_0x7f62c6[_0xe4d9('0xc3')]=!![];}if(!_0x7f62c6[_0xe4d9('0xba')][_0xe4d9('0xc4')]){return;}return db[_0xe4d9('0xc5')][_0xe4d9('0x5e')]({'attributes':['id',_0xe4d9('0x2f')],'where':{'id':_0x7f62c6[_0xe4d9('0xba')][_0xe4d9('0xc4')]}});})[_0xe4d9('0x2b')](function(_0x5c623f){if(_0x5c623f){_0x7f62c6[_0xe4d9('0xac')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x5c623f['name']+','+(_0x7f62c6[_0xe4d9('0xab')][_0xe4d9('0xc6')]||0x12c),'interval':_0xe4d9('0xbe')});}return respondWithRpcPromise(_0xe4d9('0xc7'),_0xe4d9('0xc8'),_0x7f62c6);})[_0xe4d9('0x2b')](function(_0x94f6a7){respondWithRpcPromise(_0xe4d9('0xc9'),_0xe4d9('0xc9'),{'event':'notify','message':_0x94f6a7},client9002);return _0x94f6a7;})['then'](respondWithResult(_0x3c2a9e,null))['catch'](APIHandleError(_0x3c2a9e));};exports[_0xe4d9('0xca')]=function(_0x4b4548,_0x3494df){var _0x4df66a,_0x17d710,_0x41c729;var _0x578769=[];var _0x50a75a={};var _0x5864db=_0x4b4548['files']||[];var _0x19e9ed=[];var _0x5e6be9;return db[_0xe4d9('0x9e')][_0xe4d9('0x6d')]()['then'](function(_0x1f325d){if(!_0x1f325d){throw new db[(_0xe4d9('0xcb'))]['ValidationError']('no\x20available\x20attributes');}_0x578769=_['difference'](_[_0xe4d9('0x5b')](_0x1f325d),[_0xe4d9('0x9f'),_0xe4d9('0xa0'),_0xe4d9('0xa1'),_0xe4d9('0xb1')]);if(_0x4b4548[_0xe4d9('0x5f')]['id']){delete _0x4b4548[_0xe4d9('0x5f')]['id'];}if(_[_0xe4d9('0x87')](_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0x98')])){throw _0x3494df['status'](0x1f4)[_0xe4d9('0x30')](new db['Sequelize'][(_0xe4d9('0xcc'))](_0xe4d9('0xcd')));}if(_[_0xe4d9('0x87')](_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0x5f')])||_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0x5f')]===''){throw _0x3494df[_0xe4d9('0x20')](0x1f4)[_0xe4d9('0x30')](new db[(_0xe4d9('0xcb'))]['ValidationError'](_0xe4d9('0xce')));}if(_[_0xe4d9('0x87')](_0x4b4548['body']['mapKeyOffline'])){throw _0x3494df['status'](0x1f4)[_0xe4d9('0x30')](new db[(_0xe4d9('0xcb'))]['ValidationError'](_0xe4d9('0xcf')+_0x578769));}if(!_[_0xe4d9('0xa2')](_0x578769,_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0xd0')])){throw _0x3494df[_0xe4d9('0x20')](0x1f4)[_0xe4d9('0x30')](new db[(_0xe4d9('0xcb'))]['ValidationError'](_0xe4d9('0xd1')+_0x578769));}_0x50a75a[_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0xd0')]]=_0x4b4548['body']['from'];})['then'](function(){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0x4b4548[_0xe4d9('0x6c')]['id']},'include':[{'model':db[_0xe4d9('0xd2')],'as':_0xe4d9('0xa4')},{'model':db[_0xe4d9('0xd3')],'as':'MailAccount'}]});})[_0xe4d9('0x2b')](handleEntityNotFound(_0x3494df,null))['then'](function(_0x2c7c2a){if(_0x2c7c2a&&_0x2c7c2a[_0xe4d9('0xa4')]){_0x17d710=_0x2c7c2a;var _0xb81039=_['defaults'](_0x4b4548[_0xe4d9('0x5f')],{'firstName':_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0x98')],'phone':_0x4b4548['body'][_0xe4d9('0x98')],'ListId':_0x2c7c2a[_0xe4d9('0xb1')]});_0xb81039[_0x4b4548['body']['mapKeyOffline']]=_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0x98')];return db[_0xe4d9('0x9e')][_0xe4d9('0xd4')]({'where':_0x50a75a,'defaults':_0xb81039});}})[_0xe4d9('0xd5')](function(_0x37c884){if(_0x37c884){_0x41c729=_0x37c884;var _0x47c661=fs[_0xe4d9('0xd6')](path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],'server/files/templates/chatOfflineMessage.ejs'),'utf8');var _0x4b3324=ejs[_0xe4d9('0xd7')](_0x47c661,{'body':_['toPairs'](_0x4b4548[_0xe4d9('0x5f')][_0xe4d9('0x5f')]),'bodyTitle':_0x17d710[_0xe4d9('0xd8')]});return db[_0xe4d9('0xd9')]['create']({'body':_0x4b3324,'plainBody':htmlToText['fromString'](_0x4b3324),'ContactId':_0x37c884['id'],'ChatWebsiteId':_0x17d710['id']});}})[_0xe4d9('0x2b')](function(_0x4410e7){_0x5e6be9=_0x4410e7;if(_0x5864db[_0xe4d9('0x51')]){var _0x5480dc=_0x5864db['map'](function(_0x1c999a){return{'name':_0x1c999a[_0xe4d9('0xda')],'basename':_0x1c999a[_0xe4d9('0x7e')],'type':_0x1c999a[_0xe4d9('0xdb')],'ChatOfflineMessageId':_0x4410e7['id']};});_0x19e9ed=_0x5480dc[_0xe4d9('0x47')](_0xbc8304=>{var _0x1355cb={'filename':_0xbc8304[_0xe4d9('0x2f')],'path':path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0xdc'),_0xe4d9('0xdd'),_0xe4d9('0xde'),_0xe4d9('0xdf'),_0xbc8304['basename'])};return _0x1355cb;});if(!_0x17d710[_0xe4d9('0xe0')]){return db['sequelize'][_0xe4d9('0xe1')](function(_0xa771fe){return db[_0xe4d9('0xe2')][_0xe4d9('0xe3')](_0x5480dc,{'transaction':_0xa771fe});});}}})[_0xe4d9('0x2b')](function(){if(_0x5e6be9){_0x4df66a=_0x5e6be9;return db[_0xe4d9('0xd3')][_0xe4d9('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0xe4d9('0xe4')],'as':_0xe4d9('0xe5'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xe4d9('0xe6'),'raw':!![]}]}]});}})['then'](function(_0x3f1f8b){if(_0x3f1f8b&&_0x3f1f8b[_0xe4d9('0xe5')]&&_0x17d710[_0xe4d9('0xe7')]&&_0x17d710[_0xe4d9('0xe8')]){var _0x4fe0ae=_0x3f1f8b[_0xe4d9('0xe9')]();return respondWithRpcPromise(_0xe4d9('0xea'),_0xe4d9('0xeb'),{'account':_0x4fe0ae,'message':{'from':util[_0xe4d9('0x3c')](_0xe4d9('0xec'),_0x3f1f8b[_0xe4d9('0x2f')],_0x3f1f8b[_0xe4d9('0xed')]||_0x3f1f8b[_0xe4d9('0xe5')][_0xe4d9('0x64')]),'to':_0x17d710[_0xe4d9('0xe8')],'subject':_0x17d710[_0xe4d9('0xee')],'html':_0x4df66a[_0xe4d9('0x5f')],'attachments':_0x19e9ed}},client9003)[_0xe4d9('0x2b')](function(){return _0x4df66a;})['catch'](function(_0x33252b){logger['error'](_0x33252b);});}})[_0xe4d9('0x2b')](function(){if(_0x17d710&&_0x17d710['openNewInteraction']&&_0x17d710['MailAccountId']){var _0x31fbc7=[];if(_0x5864db['length']){_0x31fbc7=_0x5864db[_0xe4d9('0x47')](function(_0x19b039){return{'name':_0x19b039[_0xe4d9('0xda')],'basename':_0x19b039[_0xe4d9('0x7e')],'type':_0x19b039[_0xe4d9('0xdb')],'ChatOfflineMessageId':_0x5e6be9['id']};});}var _0x16f465;if(!_[_0xe4d9('0x87')](_0x17d710[_0xe4d9('0xef')])){var _0x58e7d9=_[_0xe4d9('0x47')](_0x4b4548['body'],function(_0x3ba744){return _0x3ba744;});var _0x1b7d64=_[_0xe4d9('0xf0')](_0x58e7d9)[0x0];var _0x20b63f=_[_0xe4d9('0xf1')](_0x1b7d64,function(_0x1387ea){return _0x1387ea;});_0x16f465=_0x20b63f[0x1][_0x17d710[_0xe4d9('0xef')]];}var _0x11a94e={'from':_0x41c729[_0xe4d9('0xed')],'firstName':_0x41c729[_0xe4d9('0x38')],'lastName':_0x41c729[_0xe4d9('0x39')],'mapKey':_0xe4d9('0xed'),'message':{'from':_0x41c729[_0xe4d9('0xed')],'to':_0x17d710[_0xe4d9('0xd3')][_0xe4d9('0xed')],'cc':'','subject':_[_0xe4d9('0x87')](_0x16f465)?_0x17d710[_0xe4d9('0xee')]:_0x16f465,'messageId':'','sentAt':new Date(),'attach':_0x31fbc7[_0xe4d9('0x51')],'attachments':_0x31fbc7,'originChannel':_0xe4d9('0xf2'),'ChatWebsiteId':_0x17d710['id'],'ChatOfflineMessageId':_0x4df66a['id'],'originTo':_0x17d710['MailAccount'][_0xe4d9('0xed')]},'body':_0x4df66a[_0xe4d9('0x5f')]};var _0x510c47={'account':{'id':_0x17d710['MailAccountId']},'body':_0x11a94e,'log':_0xe4d9('0xf3')};return respondWithRpcPromise(_0xe4d9('0xf3'),'notifyMail',_0x510c47,client9001)[_0xe4d9('0x2b')](function(){return _0x4df66a;})[_0xe4d9('0x1f')](function(_0x1c3706){logger[_0xe4d9('0x1a')](_0x1c3706);});}return;})[_0xe4d9('0x2b')](function(){if(_0x4df66a){return _0x4df66a;}})[_0xe4d9('0x2b')](respondWithResult(_0x3494df,null))[_0xe4d9('0x1f')](function(){for(var _0x395f5d of _0x5864db){var _0x1c671a=path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0xdc'),_0xe4d9('0xdd'),_0xe4d9('0xde'),_0xe4d9('0xdf'),_0x395f5d['filename']);fs_extra['remove'](_0x1c671a)['catch'](function(_0x602b60){logger[_0xe4d9('0x1a')]('Could\x20not\x20remove\x20attachment\x20file',_0x1c671a,_0x602b60);});}});};exports[_0xe4d9('0xf4')]=function(_0x43791f,_0x5aaadb){return db[_0xe4d9('0xb5')]['find']({'where':{'id':_0x43791f[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x5aaadb,null))['then'](function(_0x466ed2){if(_0x466ed2){return _0x466ed2[_0xe4d9('0xf4')](_0x43791f[_0xe4d9('0x5f')][_0xe4d9('0x77')],_[_0xe4d9('0xf5')](_0x43791f['body'],[_0xe4d9('0x77'),'id'])||{});}})['then'](respondWithResult(_0x5aaadb,null))['catch'](handleError(_0x5aaadb,null));};exports[_0xe4d9('0xf6')]=function(_0x46e6f6,_0x1f00b4){var _0x3a5601={'raw':![],'where':{}};var _0x11d23e={};var _0x10108d={'count':0x0,'rows':[]};return db[_0xe4d9('0x48')]['findOne']({'where':{'id':_0x46e6f6['params']['id']}})['then'](handleEntityNotFound(_0x1f00b4,null))['then'](function(_0x41e499){if(_0x41e499){_0x11d23e['model']=_['keys'](db[_0xe4d9('0xb5')][_0xe4d9('0x49')]);_0x11d23e[_0xe4d9('0x4c')]=_['keys'](_0x46e6f6[_0xe4d9('0x4c')]);_0x11d23e[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x11d23e[_0xe4d9('0x4b')],_0x11d23e[_0xe4d9('0x4c')]);_0x3a5601[_0xe4d9('0x4f')]=_[_0xe4d9('0x4e')](_0x11d23e[_0xe4d9('0x4b')],qs['fields'](_0x46e6f6[_0xe4d9('0x4c')][_0xe4d9('0x50')]));_0x3a5601[_0xe4d9('0x4f')]=_0x3a5601[_0xe4d9('0x4f')][_0xe4d9('0x51')]?_0x3a5601[_0xe4d9('0x4f')]:_0x11d23e['model'];if(!_0x46e6f6[_0xe4d9('0x4c')][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x3a5601[_0xe4d9('0x24')]=qs[_0xe4d9('0x24')](_0x46e6f6[_0xe4d9('0x4c')][_0xe4d9('0x24')]);_0x3a5601['offset']=qs[_0xe4d9('0x26')](_0x46e6f6[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}_0x3a5601[_0xe4d9('0x54')]=qs['sort'](_0x46e6f6[_0xe4d9('0x4c')]['sort']);_0x3a5601['where']=qs[_0xe4d9('0x4d')](_[_0xe4d9('0x57')](_0x46e6f6['query'],_0x11d23e[_0xe4d9('0x4d')]));_0x3a5601[_0xe4d9('0x56')]['ChatWebsiteId']=_0x41e499['id'];if(_0x46e6f6[_0xe4d9('0x4c')][_0xe4d9('0x73')]){_0x3a5601[_0xe4d9('0x56')]=_['merge'](_0x3a5601[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x3a5601[_0xe4d9('0x4f')],function(_0x42f7c3){var _0x115b46={};_0x115b46[_0x42f7c3]={'$like':'%'+_0x46e6f6['query'][_0xe4d9('0x73')]+'%'};return _0x115b46;})});}_0x3a5601=_['merge']({},_0x3a5601,_0x46e6f6[_0xe4d9('0x59')]);return db[_0xe4d9('0xb5')][_0xe4d9('0x25')]({'where':_0x3a5601['where']})[_0xe4d9('0x2b')](function(_0x3f8b57){_0x10108d[_0xe4d9('0x25')]=_0x3f8b57;if(_0x46e6f6['query'][_0xe4d9('0x5c')]){_0x3a5601[_0xe4d9('0x5d')]=[{'model':db[_0xe4d9('0x9e')],'as':_0xe4d9('0xf7'),'required':![]},{'model':db[_0xe4d9('0xf8')],'as':_0xe4d9('0xf9'),'attributes':[_0xe4d9('0x2f'),_0xe4d9('0xfa'),_0xe4d9('0xfb')],'required':![]},{'model':db[_0xe4d9('0xfc')],'as':'Tags','attributes':['id',_0xe4d9('0x2f'),_0xe4d9('0xfd')],'where':_0x46e6f6['query'][_0xe4d9('0xfe')]?{'id':_0x46e6f6['query'][_0xe4d9('0xfe')]}:undefined,'required':_0x46e6f6[_0xe4d9('0x4c')]['tag']?!![]:![]}];}return db[_0xe4d9('0xb5')][_0xe4d9('0x74')](_0x3a5601);})['then'](function(_0x226d54){_0x10108d[_0xe4d9('0x75')]=_0x226d54;return _0x10108d;});}})[_0xe4d9('0x2b')](respondWithFilteredResult(_0x1f00b4,_0x3a5601))[_0xe4d9('0x1f')](handleError(_0x1f00b4,null));};exports['getSnippet']=function(_0x372289,_0x5d8270){var _0x40989a=0x0;var _0x490b9f=0x0;var _0x227827=![];var _0x5abfee;var _0x4b964c;return db['ChatWebsite']['find']({'where':{'id':_0x372289[_0xe4d9('0x6c')]['id']},'include':[{'model':db[_0xe4d9('0x92')],'as':_0xe4d9('0x92'),'include':[{'model':db[_0xe4d9('0x92')],'as':_0xe4d9('0xa9'),'attributes':['id',_0xe4d9('0xff')]}]}]})[_0xe4d9('0x2b')](handleEntityNotFound(_0x5d8270,null))[_0xe4d9('0x2b')](function(_0x5b1059){if(_0x5b1059){_0x5abfee=_0x5b1059;return _0x5b1059[_0xe4d9('0x100')]({'raw':!![]});}})['then'](function(_0x34161d){if(_0x5abfee){if(_0x34161d){_0x4b964c=_0x34161d;}}return require(_0xe4d9('0x85'))[_0xe4d9('0x101')]();})['then'](function(_0x298917){if(_0x298917){_0x490b9f=_0x298917[_0xe4d9('0x102')];_0x227827=_0x298917[_0xe4d9('0x86')];}})[_0xe4d9('0x2b')](function(){return db[_0xe4d9('0xb5')][_0xe4d9('0x25')]({'where':{'closed':![]}});})['then'](function(_0x43abd5){_0x40989a=_0x43abd5;if(_0x490b9f&&_0x43abd5>_0x490b9f){return db['License']['findOne']({'where':{'id':0x1}})[_0xe4d9('0x2b')](function(_0x469323){if(_0x469323){_0x469323[_0xe4d9('0x103')](_0xe4d9('0x104'));}});}})['then'](function(){var _0x29aebc=_0x5abfee[_0xe4d9('0x92')];var _0xc06a39=_0x5abfee[_0xe4d9('0x94')]||undefined;return _0x29aebc?_0x29aebc['ifTime'](_0xc06a39):!![];})[_0xe4d9('0x2b')](function(_0x12f9f0){var _0x55a7da=fs[_0xe4d9('0xd6')](path[_0xe4d9('0x8a')](config[_0xe4d9('0x8b')],_0xe4d9('0x105')),_0xe4d9('0x106'));var _0x5756b3='3.10.1';var _0x50142a=![];var _0xb9fbd1,_0x15eec4;if(_0x372289[_0xe4d9('0xb2')][_0xe4d9('0xb6')]){_0xb9fbd1=new URL(_0x372289['headers'][_0xe4d9('0xb6')])[_0xe4d9('0x107')];}else if(_0x372289[_0xe4d9('0xb2')][_0xe4d9('0x107')]){_0xb9fbd1=new URL(_0x372289[_0xe4d9('0xb2')][_0xe4d9('0x107')])[_0xe4d9('0x107')];}else{_0xb9fbd1=_0xe4d9('0x108');}_0x15eec4=typeof _0x5abfee['address'][_0xe4d9('0x37')](',')[_0xe4d9('0x5e')](function(_0x182b98){return wildcardUtils['testWebsiteWithWildcard'](_0x182b98,_0xb9fbd1);})!==_0xe4d9('0x23');var _0x56718d={'chatVersion':_0x5756b3,'chatWebsiteAddressOrigin':_0x15eec4?_0xb9fbd1:_0x5abfee[_0xe4d9('0x60')],'remote':_0x5abfee[_0xe4d9('0x109')],'query':querystring[_0xe4d9('0x19')](_[_0xe4d9('0x58')](_0x5abfee[_0xe4d9('0x65')]({'plain':!![]}),{'customerIp':_0x372289[_0xe4d9('0xb2')]['x-forwarded-for']||_0x372289['headers'][_0xe4d9('0x10a')]||_0x372289[_0xe4d9('0x10b')][_0xe4d9('0x10c')]||_0x372289['ip'],'referer':_0x372289[_0xe4d9('0xb2')]['referer'],'openedInteractions':_0x40989a,'maxInteractions':_0x490b9f,'virtual':_0x227827[_0xe4d9('0x102')],'online':_0x12f9f0,'custom':_0x227827,'address':_0x15eec4?_0xb9fbd1:null}))[_0xe4d9('0x10d')](/'/g,'\x5c\x27')};_0x5d8270[_0xe4d9('0x30')](ejs['render'](Mustache[_0xe4d9('0xd7')](_0x55a7da,_0x56718d),{'proactiveActions':_0x4b964c,'alignment':_0x5abfee['alignment'],'verticalAlignment':_0x5abfee['verticalAlignment'],'div_color':_0x5abfee[_0xe4d9('0xfd')],'labelText':_0x5abfee[_0xe4d9('0x10e')],'text_color':_0x5abfee[_0xe4d9('0x10f')],'text_button_color':_0x5abfee['textButtonColor'],'button_color':_0x5abfee[_0xe4d9('0x110')],'background_color':_0x5abfee[_0xe4d9('0x111')],'hideWhenOffline':_0x5abfee[_0xe4d9('0x112')],'intervalId':_0x5abfee[_0xe4d9('0x113')],'isDevelopment':_0x50142a,'chatVersion':_0x5756b3}));})[_0xe4d9('0x1f')](handleError(_0x5d8270,null));};exports[_0xe4d9('0x114')]=function(_0x43f24a,_0x289c07){var _0x35975a=_0x43f24a[_0xe4d9('0x6c')]['id'];var _0x19b531=_0x43f24a[_0xe4d9('0x5f')];var _0x4b9b00=0xc8;var _0x38c655=null;return db[_0xe4d9('0x115')][_0xe4d9('0xe1')]({'isolationLevel':db['sequelize'][_0xe4d9('0x116')]['ISOLATION_LEVELS'][_0xe4d9('0x117')]},function(_0x5b304f){return db['ChatWebsite'][_0xe4d9('0x71')]({'where':{'id':_0x35975a},'transaction':_0x5b304f})[_0xe4d9('0x2b')](function(_0x30946d){if(_0x30946d){return db[_0xe4d9('0xa7')]['destroy']({'where':{'ChatWebsiteId':_0x35975a},'transaction':_0x5b304f})[_0xe4d9('0x2b')](function(){var _0x3c9f65=_['map'](_0x19b531,function(_0x5c82fb){_0x5c82fb[_0xe4d9('0x72')]=_0x35975a;return _0x5c82fb;});return db[_0xe4d9('0xa7')][_0xe4d9('0xe3')](_0x3c9f65,{'transaction':_0x5b304f});});}else{_0x4b9b00=0x194;_0x38c655=[];}});})[_0xe4d9('0x2b')](function(){if(_0x4b9b00!==0x194){return db[_0xe4d9('0xa7')][_0xe4d9('0x118')]({'where':{'ChatWebsiteId':_0x35975a},'order':_0xe4d9('0xae')})['then'](function(_0x3ee853){_0x38c655=_0x3ee853;});}})[_0xe4d9('0x1f')](function(_0x1f8a9b){_0x4b9b00=0x1f4;logger[_0xe4d9('0x1a')](_0x1f8a9b[_0xe4d9('0x2e')]);if(_0x1f8a9b['name']){delete _0x1f8a9b[_0xe4d9('0x2f')];}_0x38c655=_0x1f8a9b;})['finally'](function(){if(_0x38c655===null){_0x289c07[_0xe4d9('0x2d')](_0x4b9b00);}else{if(_0x4b9b00===0x1f4){_0x289c07['status'](_0x4b9b00)[_0xe4d9('0x30')](_0x38c655);}else{_0x289c07[_0xe4d9('0x20')](_0x4b9b00)[_0xe4d9('0x22')](_0x38c655);}}});};exports[_0xe4d9('0x119')]=function(_0x1a95ce,_0x3459b7){var _0x587fdb={};var _0x39d16e={};var _0x2554be;var _0x57004e;return db[_0xe4d9('0x48')][_0xe4d9('0x71')]({'where':{'id':_0x1a95ce[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x3459b7,null))['then'](function(_0x12e1c6){if(_0x12e1c6){_0x2554be=_0x12e1c6;_0x39d16e[_0xe4d9('0x4b')]=_['keys'](db[_0xe4d9('0xa7')]['rawAttributes']);_0x39d16e['query']=_['keys'](_0x1a95ce['query']);_0x39d16e[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x39d16e['model'],_0x39d16e[_0xe4d9('0x4c')]);_0x587fdb['attributes']=_['intersection'](_0x39d16e[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x1a95ce['query'][_0xe4d9('0x50')]));_0x587fdb[_0xe4d9('0x4f')]=_0x587fdb[_0xe4d9('0x4f')][_0xe4d9('0x51')]?_0x587fdb[_0xe4d9('0x4f')]:_0x39d16e['model'];_0x587fdb[_0xe4d9('0x54')]=qs[_0xe4d9('0x55')](_0x1a95ce[_0xe4d9('0x4c')][_0xe4d9('0x55')]);_0x587fdb[_0xe4d9('0x56')]=qs[_0xe4d9('0x4d')](_['pick'](_0x1a95ce[_0xe4d9('0x4c')],_0x39d16e[_0xe4d9('0x4d')]));if(_0x1a95ce[_0xe4d9('0x4c')]['filter']){_0x587fdb[_0xe4d9('0x56')]=_[_0xe4d9('0x58')](_0x587fdb[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x587fdb[_0xe4d9('0x4f')],function(_0x74ec26){var _0x8a5b69={};_0x8a5b69[_0x74ec26]={'$like':'%'+_0x1a95ce['query'][_0xe4d9('0x73')]+'%'};return _0x8a5b69;})});}_0x587fdb=_[_0xe4d9('0x58')]({},_0x587fdb,_0x1a95ce[_0xe4d9('0x59')]);return _0x2554be[_0xe4d9('0x119')](_0x587fdb);}})[_0xe4d9('0x2b')](function(_0x24e540){if(_0x24e540){_0x57004e=_0x24e540[_0xe4d9('0x51')];if(!_0x1a95ce[_0xe4d9('0x4c')][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x587fdb[_0xe4d9('0x24')]=qs[_0xe4d9('0x24')](_0x1a95ce[_0xe4d9('0x4c')][_0xe4d9('0x24')]);_0x587fdb[_0xe4d9('0x26')]=qs[_0xe4d9('0x26')](_0x1a95ce[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}return _0x2554be['getApplications'](_0x587fdb);}})[_0xe4d9('0x2b')](function(_0x5adc06){if(_0x5adc06){return _0x5adc06?{'count':_0x57004e,'rows':_0x5adc06}:null;}})[_0xe4d9('0x2b')](respondWithResult(_0x3459b7,null))['catch'](handleError(_0x3459b7,null));};exports[_0xe4d9('0x11a')]=function(_0x4822e2,_0x336afc){return db['chatProactiveAction'][_0xe4d9('0x5e')]({'where':{'id':_0x4822e2[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x336afc,null))['then'](function(_0x3378d9){if(_0x3378d9){return _0x3378d9['addProactiveActions'](_0x4822e2[_0xe4d9('0x5f')][_0xe4d9('0x77')],_['omit'](_0x4822e2[_0xe4d9('0x5f')],[_0xe4d9('0x77'),'id'])||{});}})['then'](respondWithResult(_0x336afc,null))['catch'](handleError(_0x336afc,null));};exports['getProactiveActions']=function(_0x3186ae,_0x3dbd36){var _0x40c641={};var _0x28b529={};var _0x5dcc05;var _0x3a0339;return db[_0xe4d9('0x48')][_0xe4d9('0x71')]({'where':{'id':_0x3186ae[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x3dbd36,null))[_0xe4d9('0x2b')](function(_0x9d1543){if(_0x9d1543){_0x5dcc05=_0x9d1543;_0x28b529['model']=_['keys'](db['ChatProactiveAction'][_0xe4d9('0x49')]);_0x28b529[_0xe4d9('0x4c')]=_[_0xe4d9('0x5b')](_0x3186ae['query']);_0x28b529[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x28b529['model'],_0x28b529[_0xe4d9('0x4c')]);_0x40c641['attributes']=_[_0xe4d9('0x4e')](_0x28b529[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x3186ae[_0xe4d9('0x4c')]['fields']));_0x40c641['attributes']=_0x40c641[_0xe4d9('0x4f')][_0xe4d9('0x51')]?_0x40c641['attributes']:_0x28b529['model'];_0x40c641[_0xe4d9('0x54')]=qs['sort'](_0x3186ae['query'][_0xe4d9('0x55')]);_0x40c641['where']=qs[_0xe4d9('0x4d')](_['pick'](_0x3186ae[_0xe4d9('0x4c')],_0x28b529[_0xe4d9('0x4d')]));if(_0x3186ae[_0xe4d9('0x4c')]['filter']){_0x40c641['where']=_['merge'](_0x40c641[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x40c641[_0xe4d9('0x4f')],function(_0x17ed69){var _0x4e8ac0={};_0x4e8ac0[_0x17ed69]={'$like':'%'+_0x3186ae[_0xe4d9('0x4c')][_0xe4d9('0x73')]+'%'};return _0x4e8ac0;})});}_0x40c641=_[_0xe4d9('0x58')]({},_0x40c641,_0x3186ae['options']);return _0x5dcc05[_0xe4d9('0x100')](_0x40c641);}})[_0xe4d9('0x2b')](function(_0x59b3a5){if(_0x59b3a5){_0x3a0339=_0x59b3a5[_0xe4d9('0x51')];if(!_0x3186ae[_0xe4d9('0x4c')][_0xe4d9('0x52')]('nolimit')){_0x40c641[_0xe4d9('0x24')]=qs[_0xe4d9('0x24')](_0x3186ae['query']['limit']);_0x40c641[_0xe4d9('0x26')]=qs[_0xe4d9('0x26')](_0x3186ae[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}return _0x5dcc05['getProactiveActions'](_0x40c641);}})['then'](function(_0x11e637){if(_0x11e637){return _0x11e637?{'count':_0x3a0339,'rows':_0x11e637}:null;}})[_0xe4d9('0x2b')](respondWithResult(_0x3dbd36,null))[_0xe4d9('0x1f')](handleError(_0x3dbd36,null));};exports['getFields']=function(_0x4f327f,_0x1f84d0){var _0xcfc14c=_0x4f327f[_0xe4d9('0x4c')][_0xe4d9('0x11b')]===_0xe4d9('0x11c')?_0xe4d9('0x11d'):_0xe4d9('0x11e');return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'attributes':['id',_0xcfc14c],'where':{'id':_0x4f327f[_0xe4d9('0x6c')]['id']}})['then'](handleEntityNotFound(_0x1f84d0,null))[_0xe4d9('0x2b')](function(_0x59dd0e){if(_0x59dd0e){var _0x587483=_0x59dd0e[_0xcfc14c];var _0x165186=_0x587483&&_0x587483['items']?_0x587483[_0xe4d9('0x11f')]:[];_0x1f84d0[_0xe4d9('0x30')]({'fromKey':_[_0xe4d9('0x87')](_0x587483[_0xe4d9('0x120')])?undefined:_0x587483[_0xe4d9('0x120')],'count':_0x165186[_0xe4d9('0x51')],'rows':_0x165186});}})[_0xe4d9('0x1f')](handleError(_0x1f84d0,null));};exports[_0xe4d9('0x121')]=function(_0x30510b,_0x4c8947){var _0x266ffa={'raw':![],'where':{}};var _0x2602d8={};var _0x3e8982={'count':0x0,'rows':[]};return db[_0xe4d9('0x48')][_0xe4d9('0x71')]({'where':{'id':_0x30510b[_0xe4d9('0x6c')]['id']}})['then'](handleEntityNotFound(_0x4c8947,null))[_0xe4d9('0x2b')](function(_0x40d1a3){if(_0x40d1a3){_0x2602d8['model']=_[_0xe4d9('0x5b')](db['ChatOfflineMessage'][_0xe4d9('0x49')]);_0x2602d8[_0xe4d9('0x4c')]=_['keys'](_0x30510b[_0xe4d9('0x4c')]);_0x2602d8[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x2602d8['model'],_0x2602d8['query']);_0x266ffa[_0xe4d9('0x4f')]=_['intersection'](_0x2602d8[_0xe4d9('0x4b')],qs['fields'](_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x50')]));_0x266ffa[_0xe4d9('0x4f')]=_0x266ffa['attributes']['length']?_0x266ffa[_0xe4d9('0x4f')]:_0x2602d8['model'];if(!_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x266ffa['limit']=qs[_0xe4d9('0x24')](_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x24')]);_0x266ffa[_0xe4d9('0x26')]=qs[_0xe4d9('0x26')](_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x26')]);}_0x266ffa['order']=qs[_0xe4d9('0x55')](_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x55')]);_0x266ffa['where']=qs[_0xe4d9('0x4d')](_['pick'](_0x30510b[_0xe4d9('0x4c')],_0x2602d8['filters']));_0x266ffa[_0xe4d9('0x56')][_0xe4d9('0x72')]=_0x40d1a3['id'];if(_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x73')]){_0x266ffa['where']=_[_0xe4d9('0x58')](_0x266ffa[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x266ffa[_0xe4d9('0x4f')],function(_0x1b5e4a){var _0x4f9805={};_0x4f9805[_0x1b5e4a]={'$like':'%'+_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x73')]+'%'};return _0x4f9805;})});}_0x266ffa=_['merge']({},_0x266ffa,_0x30510b[_0xe4d9('0x59')]);return db[_0xe4d9('0xd9')][_0xe4d9('0x25')]({'where':_0x266ffa[_0xe4d9('0x56')]})[_0xe4d9('0x2b')](function(_0x4f8ef3){_0x3e8982[_0xe4d9('0x25')]=_0x4f8ef3;if(_0x30510b[_0xe4d9('0x4c')][_0xe4d9('0x5c')]){_0x266ffa['include']=[{'all':!![]}];}else{_0x266ffa['include']=[{'model':db[_0xe4d9('0x9e')],'as':_0xe4d9('0xf7'),'required':![]},{'model':db[_0xe4d9('0xe2')],'as':_0xe4d9('0x122'),'required':![]}];}return db['ChatOfflineMessage'][_0xe4d9('0x74')](_0x266ffa);})[_0xe4d9('0x2b')](function(_0x1f79e9){_0x3e8982[_0xe4d9('0x75')]=_0x1f79e9;return _0x3e8982;});}})[_0xe4d9('0x2b')](respondWithFilteredResult(_0x4c8947,_0x266ffa))[_0xe4d9('0x1f')](handleError(_0x4c8947,null));};exports[_0xe4d9('0x123')]=function(_0xecb7e8,_0x4488d0){return db[_0xe4d9('0x48')][_0xe4d9('0x5e')]({'where':{'id':_0xecb7e8['params']['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x4488d0,null))['then'](function(_0x57f07e){if(_0x57f07e){return _0x57f07e[_0xe4d9('0x123')](_0xecb7e8[_0xe4d9('0x5f')]['ids'],_[_0xe4d9('0xf5')](_0xecb7e8['body'],[_0xe4d9('0x77'),'id'])||{})[_0xe4d9('0xd5')](function(_0x23098a){for(var _0x15f432=0x0;_0x15f432<_0xecb7e8[_0xe4d9('0x5f')][_0xe4d9('0x77')]['length'];_0x15f432+=0x1){socket[_0xe4d9('0x124')]('userChatWebsite:save',{'UserId':Number(_0xecb7e8[_0xe4d9('0x5f')][_0xe4d9('0x77')][_0x15f432]),'ChatWebsiteId':Number(_0xecb7e8[_0xe4d9('0x6c')]['id'])});}return _0x23098a;});}})[_0xe4d9('0x2b')](respondWithResult(_0x4488d0,null))[_0xe4d9('0x1f')](handleError(_0x4488d0,null));};exports[_0xe4d9('0x125')]=function(_0x567d85,_0x567a86){return db['ChatWebsite']['find']({'where':{'id':_0x567d85['params']['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x567a86,null))[_0xe4d9('0x2b')](function(_0x36acb0){if(_0x36acb0){return _0x36acb0[_0xe4d9('0x125')](_0x567d85[_0xe4d9('0x4c')][_0xe4d9('0x77')])['then'](function(){if(_[_0xe4d9('0x126')](_0x567d85[_0xe4d9('0x4c')][_0xe4d9('0x77')])){for(var _0x872574=0x0;_0x872574<_0x567d85['query']['ids'][_0xe4d9('0x51')];_0x872574+=0x1){socket['emit'](_0xe4d9('0x127'),{'UserId':Number(_0x567d85[_0xe4d9('0x4c')][_0xe4d9('0x77')][_0x872574]),'ChatWebsiteId':Number(_0x567d85['params']['id'])});}}else{socket[_0xe4d9('0x124')]('userChatWebsite:remove',{'UserId':Number(_0x567d85[_0xe4d9('0x4c')]['ids']),'ChatWebsiteId':Number(_0x567d85[_0xe4d9('0x6c')]['id'])});}});}})[_0xe4d9('0x2b')](respondWithStatusCode(_0x567a86,null))['catch'](handleError(_0x567a86,null));};exports[_0xe4d9('0x128')]=function(_0x1365d8,_0x52f18a){var _0x4fcfe2={};var _0x51909d={};var _0x2a1ada;var _0x57226d;return db[_0xe4d9('0x48')][_0xe4d9('0x71')]({'where':{'id':_0x1365d8[_0xe4d9('0x6c')]['id']}})[_0xe4d9('0x2b')](handleEntityNotFound(_0x52f18a,null))['then'](function(_0x1810b6){if(_0x1810b6){_0x2a1ada=_0x1810b6;_0x51909d['model']=_[_0xe4d9('0x5b')](db[_0xe4d9('0xf8')]['rawAttributes']);_0x51909d[_0xe4d9('0x4c')]=_['keys'](_0x1365d8[_0xe4d9('0x4c')]);_0x51909d[_0xe4d9('0x4d')]=_[_0xe4d9('0x4e')](_0x51909d[_0xe4d9('0x4b')],_0x51909d[_0xe4d9('0x4c')]);_0x4fcfe2[_0xe4d9('0x4f')]=_[_0xe4d9('0x4e')](_0x51909d[_0xe4d9('0x4b')],qs[_0xe4d9('0x50')](_0x1365d8[_0xe4d9('0x4c')][_0xe4d9('0x50')]));_0x4fcfe2['attributes']=_0x4fcfe2[_0xe4d9('0x4f')]['length']?_0x4fcfe2[_0xe4d9('0x4f')]:_0x51909d[_0xe4d9('0x4b')];_0x4fcfe2[_0xe4d9('0x54')]=qs['sort'](_0x1365d8[_0xe4d9('0x4c')][_0xe4d9('0x55')]);_0x4fcfe2[_0xe4d9('0x56')]=qs[_0xe4d9('0x4d')](_[_0xe4d9('0x57')](_0x1365d8[_0xe4d9('0x4c')],_0x51909d[_0xe4d9('0x4d')]));if(_0x1365d8[_0xe4d9('0x4c')][_0xe4d9('0x73')]){_0x4fcfe2[_0xe4d9('0x56')]=_[_0xe4d9('0x58')](_0x4fcfe2[_0xe4d9('0x56')],{'$or':_[_0xe4d9('0x47')](_0x4fcfe2['attributes'],function(_0x4755b1){var _0x5663ed={};_0x5663ed[_0x4755b1]={'$like':'%'+_0x1365d8[_0xe4d9('0x4c')][_0xe4d9('0x73')]+'%'};return _0x5663ed;})});}_0x4fcfe2=_[_0xe4d9('0x58')]({},_0x4fcfe2,_0x1365d8[_0xe4d9('0x59')]);return _0x2a1ada[_0xe4d9('0x128')](_0x4fcfe2);}})[_0xe4d9('0x2b')](function(_0x18064b){if(_0x18064b){_0x57226d=_0x18064b[_0xe4d9('0x51')];if(!_0x1365d8[_0xe4d9('0x4c')][_0xe4d9('0x52')](_0xe4d9('0x53'))){_0x4fcfe2[_0xe4d9('0x24')]=qs[_0xe4d9('0x24')](_0x1365d8[_0xe4d9('0x4c')][_0xe4d9('0x24')]);_0x4fcfe2['offset']=qs['offset'](_0x1365d8['query']['offset']);}return _0x2a1ada[_0xe4d9('0x128')](_0x4fcfe2);}})[_0xe4d9('0x2b')](function(_0x5798cf){if(_0x5798cf){return _0x5798cf?{'count':_0x57226d,'rows':_0x5798cf}:null;}})[_0xe4d9('0x2b')](respondWithResult(_0x52f18a,null))[_0xe4d9('0x1f')](handleError(_0x52f18a,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index fb92f78..9d7ad70 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 _0x581a=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x34a49c,_0x311bf9){var _0x178e9d=function(_0x5dd714){while(--_0x5dd714){_0x34a49c['push'](_0x34a49c['shift']());}};_0x178e9d(++_0x311bf9);}(_0x581a,0x127));var _0xa581=function(_0x5c7e81,_0x10384d){_0x5c7e81=_0x5c7e81-0x0;var _0xf51111=_0x581a[_0x5c7e81];return _0xf51111;};'use strict';var EventEmitter=require(_0xa581('0x0'));var ChatWebsite=require(_0xa581('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xa581('0x2')](0x0);var events={'afterCreate':_0xa581('0x3'),'afterUpdate':_0xa581('0x4'),'afterDestroy':_0xa581('0x5')};function emitEvent(_0x3f5c21){return function(_0x4e64cc,_0x4e65d7,_0x198faf){ChatWebsiteEvents['emit'](_0x3f5c21+':'+_0x4e64cc['id'],_0x4e64cc);ChatWebsiteEvents[_0xa581('0x6')](_0x3f5c21,_0x4e64cc);_0x198faf(null);};}for(var e in events){if(events[_0xa581('0x7')](e)){var event=events[e];ChatWebsite[_0xa581('0x8')](e,emitEvent(event));}}module[_0xa581('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0x24cd=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update'];(function(_0x4ac320,_0x1a0f52){var _0x479cf7=function(_0x4c77ec){while(--_0x4c77ec){_0x4ac320['push'](_0x4ac320['shift']());}};_0x479cf7(++_0x1a0f52);}(_0x24cd,0x83));var _0xd24c=function(_0x52d1ad,_0x5e94dc){_0x52d1ad=_0x52d1ad-0x0;var _0x264739=_0x24cd[_0x52d1ad];return _0x264739;};'use strict';var EventEmitter=require(_0xd24c('0x0'));var ChatWebsite=require(_0xd24c('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xd24c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd24c('0x3'),'afterDestroy':_0xd24c('0x4')};function emitEvent(_0x3bd534){return function(_0x4d515c,_0x21a58c,_0x32001a){ChatWebsiteEvents['emit'](_0x3bd534+':'+_0x4d515c['id'],_0x4d515c);ChatWebsiteEvents[_0xd24c('0x5')](_0x3bd534,_0x4d515c);_0x32001a(null);};}for(var e in events){if(events[_0xd24c('0x6')](e)){var event=events[e];ChatWebsite[_0xd24c('0x7')](e,emitEvent(event));}}module[_0xd24c('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 18c372c..a579984 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 _0x84a3=['api','moment','bluebird','path','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x59bf3e,_0x3a8e33){var _0x4a2340=function(_0x570a75){while(--_0x570a75){_0x59bf3e['push'](_0x59bf3e['shift']());}};_0x4a2340(++_0x3a8e33);}(_0x84a3,0x1a0));var _0x384a=function(_0x35ea7c,_0x4aa05d){_0x35ea7c=_0x35ea7c-0x0;var _0x56bdfc=_0x84a3[_0x35ea7c];return _0x56bdfc;};'use strict';var _=require(_0x384a('0x0'));var util=require(_0x384a('0x1'));var logger=require('../../config/logger')(_0x384a('0x2'));var moment=require(_0x384a('0x3'));var BPromise=require(_0x384a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x384a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x384a('0x6'));module[_0x384a('0x7')]=function(_0x3a36f4,_0x314d52){return _0x3a36f4[_0x384a('0x8')](_0x384a('0x9'),attributes,{'tableName':_0x384a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x38ae=['moment','bluebird','path','define','ChatWebsite','chat_websites','lodash','util','api'];(function(_0xbc1a4b,_0x4dfbe4){var _0x108b87=function(_0x409062){while(--_0x409062){_0xbc1a4b['push'](_0xbc1a4b['shift']());}};_0x108b87(++_0x4dfbe4);}(_0x38ae,0x10b));var _0xe38a=function(_0x504c5f,_0x4c9421){_0x504c5f=_0x504c5f-0x0;var _0x483c8e=_0x38ae[_0x504c5f];return _0x483c8e;};'use strict';var _=require(_0xe38a('0x0'));var util=require(_0xe38a('0x1'));var logger=require('../../config/logger')(_0xe38a('0x2'));var moment=require(_0xe38a('0x3'));var BPromise=require(_0xe38a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe38a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x81bf16,_0x3684b3){return _0x81bf16[_0xe38a('0x6')](_0xe38a('0x7'),attributes,{'tableName':_0xe38a('0x8'),'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 8d5fe54..8daac12 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 _0xd105=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0xd105,0x194));var _0x5d10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd105[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x5d10('0x0'));var util=require(_0x5d10('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5d10('0x2'));var fs=require('fs');var Redis=require(_0x5d10('0x3'));var db=require(_0x5d10('0x4'))['db'];var utils=require(_0x5d10('0x5'));var logger=require(_0x5d10('0x6'))(_0x5d10('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d10('0x8'));var client=jayson['client'][_0x5d10('0x9')]({'port':0x232a});config['redis']=_[_0x5d10('0xa')](config[_0x5d10('0xb')],{'host':_0x5d10('0xc'),'port':0x18eb});var socket=require(_0x5d10('0xd'))(new Redis(config[_0x5d10('0xb')]));require(_0x5d10('0xe'))['register'](socket);function respondWithRpcPromise(_0x3c328f,_0x1b7775,_0x131652){return new BPromise(function(_0x3fe30b,_0x51511d){return client[_0x5d10('0xf')](_0x3c328f,_0x131652)['then'](function(_0x5710c5){logger['info'](_0x5d10('0x10'),_0x1b7775,_0x5d10('0x11'));logger[_0x5d10('0x12')](_0x5d10('0x13'),_0x1b7775,'request\x20sent',JSON[_0x5d10('0x14')](_0x5710c5));if(_0x5710c5[_0x5d10('0x15')]){if(_0x5710c5['error'][_0x5d10('0x16')]===0x1f4){logger['error'](_0x5d10('0x10'),_0x1b7775,_0x5710c5[_0x5d10('0x15')][_0x5d10('0x17')]);return _0x51511d(_0x5710c5['error'][_0x5d10('0x17')]);}logger['error'](_0x5d10('0x10'),_0x1b7775,_0x5710c5[_0x5d10('0x15')][_0x5d10('0x17')]);return _0x3fe30b(_0x5710c5['error'][_0x5d10('0x17')]);}else{logger[_0x5d10('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x1b7775,_0x5d10('0x11'));_0x3fe30b(_0x5710c5[_0x5d10('0x19')]['message']);}})[_0x5d10('0x1a')](function(_0x31b5b7){logger['error'](_0x5d10('0x10'),_0x1b7775,_0x31b5b7);_0x51511d(_0x31b5b7);});});} \ No newline at end of file +var _0x0267=['request','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register'];(function(_0x2ae786,_0xdcf97c){var _0x50dc01=function(_0x128343){while(--_0x128343){_0x2ae786['push'](_0x2ae786['shift']());}};_0x50dc01(++_0xdcf97c);}(_0x0267,0x177));var _0x7026=function(_0x3e9b13,_0x370a4b){_0x3e9b13=_0x3e9b13-0x0;var _0x1e9555=_0x0267[_0x3e9b13];return _0x1e9555;};'use strict';var _=require(_0x7026('0x0'));var util=require(_0x7026('0x1'));var moment=require(_0x7026('0x2'));var BPromise=require(_0x7026('0x3'));var rs=require(_0x7026('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7026('0x5'))['db'];var utils=require(_0x7026('0x6'));var logger=require('../../config/logger')(_0x7026('0x7'));var config=require(_0x7026('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7026('0x9')][_0x7026('0xa')]({'port':0x232a});config[_0x7026('0xb')]=_[_0x7026('0xc')](config[_0x7026('0xb')],{'host':_0x7026('0xd'),'port':0x18eb});var socket=require(_0x7026('0xe'))(new Redis(config[_0x7026('0xb')]));require(_0x7026('0xf'))[_0x7026('0x10')](socket);function respondWithRpcPromise(_0x4bf39e,_0x1af209,_0x4c3751){return new BPromise(function(_0xd73f8a,_0x4bc272){return client[_0x7026('0x11')](_0x4bf39e,_0x4c3751)['then'](function(_0x10c45e){logger['info'](_0x7026('0x12'),_0x1af209,'request\x20sent');logger[_0x7026('0x13')](_0x7026('0x14'),_0x1af209,'request\x20sent',JSON[_0x7026('0x15')](_0x10c45e));if(_0x10c45e[_0x7026('0x16')]){if(_0x10c45e[_0x7026('0x16')][_0x7026('0x17')]===0x1f4){logger[_0x7026('0x16')](_0x7026('0x12'),_0x1af209,_0x10c45e[_0x7026('0x16')][_0x7026('0x18')]);return _0x4bc272(_0x10c45e[_0x7026('0x16')][_0x7026('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x1af209,_0x10c45e['error']['message']);return _0xd73f8a(_0x10c45e[_0x7026('0x16')][_0x7026('0x18')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x1af209,_0x7026('0x19'));_0xd73f8a(_0x10c45e[_0x7026('0x1a')]['message']);}})[_0x7026('0x1b')](function(_0x1f377a){logger[_0x7026('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x1af209,_0x1f377a);_0x4bc272(_0x1f377a);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2b3969d..eef6313 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 _0xa686=['register','chatWebsite:','./chatWebsite.events','save','remove','update','removeListener'];(function(_0x3214c7,_0x47e426){var _0x206cb4=function(_0xb9b6be){while(--_0xb9b6be){_0x3214c7['push'](_0x3214c7['shift']());}};_0x206cb4(++_0x47e426);}(_0xa686,0xfe));var _0x6a68=function(_0x534602,_0x548725){_0x534602=_0x534602-0x0;var _0xa1e3f2=_0xa686[_0x534602];return _0xa1e3f2;};'use strict';var ChatWebsiteEvents=require(_0x6a68('0x0'));var events=[_0x6a68('0x1'),_0x6a68('0x2'),_0x6a68('0x3')];function createListener(_0x92f542,_0x467f6d){return function(_0x3361c1){_0x467f6d['emit'](_0x92f542,_0x3361c1);};}function removeListener(_0x46eebb,_0x4122a6){return function(){ChatWebsiteEvents[_0x6a68('0x4')](_0x46eebb,_0x4122a6);};}exports[_0x6a68('0x5')]=function(_0x2568be){for(var _0x2e4d45=0x0,_0x59b056=events['length'];_0x2e4d45<_0x59b056;_0x2e4d45++){var _0x22e3bc=events[_0x2e4d45];var _0x49821c=createListener(_0x6a68('0x6')+_0x22e3bc,_0x2568be);ChatWebsiteEvents['on'](_0x22e3bc,_0x49821c);}}; \ No newline at end of file +var _0x5551=['removeListener','length','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0x20b29c,_0xe22528){var _0x20d81b=function(_0xd63a71){while(--_0xd63a71){_0x20b29c['push'](_0x20b29c['shift']());}};_0x20d81b(++_0xe22528);}(_0x5551,0x1e9));var _0x1555=function(_0x2d7a4d,_0x36759a){_0x2d7a4d=_0x2d7a4d-0x0;var _0x41e8ae=_0x5551[_0x2d7a4d];return _0x41e8ae;};'use strict';var ChatWebsiteEvents=require(_0x1555('0x0'));var events=['save',_0x1555('0x1'),_0x1555('0x2')];function createListener(_0x987cc0,_0x485736){return function(_0x21c02e){_0x485736['emit'](_0x987cc0,_0x21c02e);};}function removeListener(_0x36f898,_0x3851d4){return function(){ChatWebsiteEvents[_0x1555('0x3')](_0x36f898,_0x3851d4);};}exports['register']=function(_0x186cf6){for(var _0x57477e=0x0,_0x1ae2ec=events[_0x1555('0x4')];_0x57477e<_0x1ae2ec;_0x57477e++){var _0x19e037=events[_0x57477e];var _0x57015c=createListener(_0x1555('0x5')+_0x19e037,_0x186cf6);ChatWebsiteEvents['on'](_0x19e037,_0x57015c);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index a72dfa7..6ec1f88 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedf1=['trim','([\x5cw]+)','localhost','../../../utils/misc','escapeRegExp','replace','test'];(function(_0x1e3a2e,_0x5131d0){var _0x3e6769=function(_0x3bf600){while(--_0x3bf600){_0x1e3a2e['push'](_0x1e3a2e['shift']());}};_0x3e6769(++_0x5131d0);}(_0xedf1,0xb2));var _0x1edf=function(_0xd69543,_0x5a1041){_0xd69543=_0xd69543-0x0;var _0x3588cb=_0xedf1[_0xd69543];return _0x3588cb;};var escapeRegExp=require(_0x1edf('0x0'))[_0x1edf('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0xdf58cf){var _0x462fc4=!![];try{new URL(_0xdf58cf[_0x1edf('0x2')]('*','localhost'));}catch(_0x224972){_0x462fc4=![];}return _0x462fc4&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x1edf('0x3')](_0xdf58cf);}function testWebsiteWithWildcard(_0x3a5efd,_0x5ec722){var _0x52238d;var _0x1b84af=escapeRegExp(_0x3a5efd[_0x1edf('0x4')]()[_0x1edf('0x2')](/\/$/,''))[_0x1edf('0x2')]('\x5c*',_0x1edf('0x5'));try{new URL(_0x3a5efd[_0x1edf('0x2')]('\x5c*',_0x1edf('0x6')));_0x52238d=new RegExp(_0x1b84af)[_0x1edf('0x3')](_0x5ec722);}catch(_0x30a13f){_0x52238d=![];}return _0x52238d;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x3e4d=['test','../../../utils/misc','url','replace','localhost','trim','([\x5cw]+)'];(function(_0x563840,_0xfd1827){var _0x161d43=function(_0x391a64){while(--_0x391a64){_0x563840['push'](_0x563840['shift']());}};_0x161d43(++_0xfd1827);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x1af0e1,_0x35e119){_0x1af0e1=_0x1af0e1-0x0;var _0x482f73=_0x3e4d[_0x1af0e1];return _0x482f73;};var escapeRegExp=require(_0xd3e4('0x0'))['escapeRegExp'];var URL=require(_0xd3e4('0x1'))['URL'];function testWildcardValidity(_0x5bd2ea){var _0x485e9d=!![];try{new URL(_0x5bd2ea[_0xd3e4('0x2')]('*',_0xd3e4('0x3')));}catch(_0x2c7be8){_0x485e9d=![];}return _0x485e9d&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x5bd2ea);}function testWebsiteWithWildcard(_0xc5abea,_0x5976c1){var _0x4b9a10;var _0x7b42fe=escapeRegExp(_0xc5abea[_0xd3e4('0x4')]()[_0xd3e4('0x2')](/\/$/,''))[_0xd3e4('0x2')]('\x5c*',_0xd3e4('0x5'));try{new URL(_0xc5abea['replace']('\x5c*',_0xd3e4('0x3')));_0x4b9a10=new RegExp(_0x7b42fe)[_0xd3e4('0x6')](_0x5976c1);}catch(_0x279f4c){_0x4b9a10=![];}return _0x4b9a10;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index df19ac3..7a8c45e 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 _0xa2b3=['single','file','server/files/images/avatars/','%s-%s','addAvatar','addSystemAvatar','notify','server/files','attachments','ensureDir','replace','extname','/:id/offline','offline','/:id/interactions','/:id/applications','/:id/users','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','/:id/canned_answers','/:id/logo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','getOfflineMessages','post','create','addAnswer','diskStorage','join','root','server/files/images/logos/','format','now','originalname'];(function(_0x19ac90,_0x554f04){var _0x4b9d7d=function(_0x3efc03){while(--_0x3efc03){_0x19ac90['push'](_0x19ac90['shift']());}};_0x4b9d7d(++_0x554f04);}(_0xa2b3,0x162));var _0x3a2b=function(_0x742cb3,_0x43cb32){_0x742cb3=_0x742cb3-0x0;var _0x191a5d=_0xa2b3[_0x742cb3];return _0x191a5d;};'use strict';var multer=require('multer');var util=require(_0x3a2b('0x0'));var path=require(_0x3a2b('0x1'));var timeout=require(_0x3a2b('0x2'));var express=require(_0x3a2b('0x3'));var router=express['Router']();var fs_extra=require(_0x3a2b('0x4'));var auth=require(_0x3a2b('0x5'));var interaction=require(_0x3a2b('0x6'));var config=require(_0x3a2b('0x7'));var controller=require(_0x3a2b('0x8'));router[_0x3a2b('0x9')]('/',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0xb')]);router[_0x3a2b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3a2b('0xc')]);router[_0x3a2b('0x9')](_0x3a2b('0xd'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0xe')]);router[_0x3a2b('0x9')](_0x3a2b('0xf'),auth[_0x3a2b('0xa')](),controller['getDispositions']);router['get'](_0x3a2b('0x10'),auth[_0x3a2b('0xa')](),controller['getAnswers']);router[_0x3a2b('0x9')](_0x3a2b('0x11'),controller['getLogo']);router['get'](_0x3a2b('0x12'),controller[_0x3a2b('0x13')]);router[_0x3a2b('0x9')](_0x3a2b('0x14'),controller[_0x3a2b('0x15')]);router[_0x3a2b('0x9')](_0x3a2b('0x16'),controller[_0x3a2b('0x17')]);router['get']('/:id/interactions',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x18')]);router[_0x3a2b('0x9')](_0x3a2b('0x19'),controller['getSnippet']);router['get']('/:id/applications',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x1a')]);router[_0x3a2b('0x9')](_0x3a2b('0x1b'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x1c')]);router[_0x3a2b('0x9')](_0x3a2b('0x1d'),controller[_0x3a2b('0x1e')]);router[_0x3a2b('0x9')]('/:id/offline_messages',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x1f')]);router[_0x3a2b('0x9')]('/:id/users',auth[_0x3a2b('0xa')](),controller['getAgents']);router[_0x3a2b('0x20')]('/',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x21')]);router['post']('/:id/dispositions',auth[_0x3a2b('0xa')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x22')]);var upload=multer({'storage':multer[_0x3a2b('0x23')]({'destination':function(_0x32e46b,_0x586a03,_0x32fcb7){_0x32fcb7(null,path[_0x3a2b('0x24')](config[_0x3a2b('0x25')],_0x3a2b('0x26')));},'filename':function(_0x40de23,_0x4bf2d0,_0x2d9a67){_0x2d9a67(null,util[_0x3a2b('0x27')]('%s-%s',Date[_0x3a2b('0x28')](),_0x4bf2d0[_0x3a2b('0x29')]));}})});router[_0x3a2b('0x20')](_0x3a2b('0x11'),upload[_0x3a2b('0x2a')](_0x3a2b('0x2b')),controller['addLogo']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x22e01e,_0x5779dc,_0xdb2717){_0xdb2717(null,path[_0x3a2b('0x24')](config['root'],_0x3a2b('0x2c')));},'filename':function(_0x478150,_0x5cd491,_0x386de6){_0x386de6(null,util[_0x3a2b('0x27')](_0x3a2b('0x2d'),Date[_0x3a2b('0x28')](),_0x5cd491[_0x3a2b('0x29')]));}})});router['post']('/:id/avatar',upload['single']('file'),controller[_0x3a2b('0x2e')]);var upload=multer({'storage':multer[_0x3a2b('0x23')]({'destination':function(_0x3dbca4,_0x597e81,_0x556ea4){_0x556ea4(null,path['join'](config['root'],_0x3a2b('0x2c')));},'filename':function(_0x5f4a63,_0x4f5650,_0x449ae2){_0x449ae2(null,util[_0x3a2b('0x27')](_0x3a2b('0x2d'),Date[_0x3a2b('0x28')](),_0x4f5650[_0x3a2b('0x29')]));}})});router[_0x3a2b('0x20')](_0x3a2b('0x14'),upload[_0x3a2b('0x2a')]('file'),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x41491f,_0x56dfca,_0xbb54b3){_0xbb54b3(null,path['join'](config[_0x3a2b('0x25')],_0x3a2b('0x2c')));},'filename':function(_0xc584bb,_0x34465c,_0x1af7c8){_0x1af7c8(null,util[_0x3a2b('0x27')](_0x3a2b('0x2d'),Date['now'](),_0x34465c[_0x3a2b('0x29')]));}})});router[_0x3a2b('0x20')](_0x3a2b('0x16'),upload[_0x3a2b('0x2a')](_0x3a2b('0x2b')),controller[_0x3a2b('0x2f')]);router[_0x3a2b('0x20')]('/:id/notify',controller[_0x3a2b('0x30')]);const offlineUploadMulter=multer({'storage':multer[_0x3a2b('0x23')]({'destination':function(_0x59baa1,_0x8deb87,_0x2dde22){const _0xa7aa76=path[_0x3a2b('0x24')](config[_0x3a2b('0x25')],_0x3a2b('0x31'),_0x3a2b('0x32'),'offline-chat');fs_extra[_0x3a2b('0x33')](_0xa7aa76,function(){_0x2dde22(null,_0xa7aa76);});},'filename':function(_0xef8faf,_0x27331a,_0x3bed3d){const _0x20e107=_0x27331a[_0x3a2b('0x29')][_0x3a2b('0x34')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x28c512=path[_0x3a2b('0x35')](_0x20e107);const _0x3f9236=Date[_0x3a2b('0x28')]()+'-'+_0x20e107[_0x3a2b('0x34')](_0x28c512,'')+_0x28c512;_0x3bed3d(null,_0x3f9236);}})});router[_0x3a2b('0x20')](_0x3a2b('0x36'),offlineUploadMulter['any'](),controller[_0x3a2b('0x37')]);router[_0x3a2b('0x20')](_0x3a2b('0x38'),auth['isAuthenticated'](),controller['addInteraction']);router[_0x3a2b('0x20')](_0x3a2b('0x39'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x3a2b('0x1b'),auth[_0x3a2b('0xa')](),controller['addProactiveActions']);router['post'](_0x3a2b('0x3a'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x3b')]);router['put'](_0x3a2b('0xd'),auth['isAuthenticated'](),controller[_0x3a2b('0x3c')]);router[_0x3a2b('0x3d')](_0x3a2b('0xd'),auth['isAuthenticated'](),controller[_0x3a2b('0x3e')]);router[_0x3a2b('0x3d')](_0x3a2b('0xf'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x3f')]);router[_0x3a2b('0x3d')](_0x3a2b('0x10'),auth['isAuthenticated'](),controller[_0x3a2b('0x40')]);router['delete'](_0x3a2b('0x3a'),auth[_0x3a2b('0xa')](),controller[_0x3a2b('0x41')]);module['exports']=router; \ No newline at end of file +var _0x8235=['single','file','addLogo','server/files/images/avatars/','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','/:id/applications','/:id/proactive_actions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname'];(function(_0x3f8238,_0x196436){var _0x30de26=function(_0x1d0ca8){while(--_0x1d0ca8){_0x3f8238['push'](_0x3f8238['shift']());}};_0x30de26(++_0x196436);}(_0x8235,0xb4));var _0x5823=function(_0x255255,_0x25f03d){_0x255255=_0x255255-0x0;var _0x46feba=_0x8235[_0x255255];return _0x46feba;};'use strict';var multer=require(_0x5823('0x0'));var util=require(_0x5823('0x1'));var path=require(_0x5823('0x2'));var timeout=require(_0x5823('0x3'));var express=require(_0x5823('0x4'));var router=express[_0x5823('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5823('0x6'));var interaction=require(_0x5823('0x7'));var config=require(_0x5823('0x8'));var controller=require(_0x5823('0x9'));router[_0x5823('0xa')]('/',auth[_0x5823('0xb')](),controller[_0x5823('0xc')]);router[_0x5823('0xa')](_0x5823('0xd'),auth[_0x5823('0xb')](),controller[_0x5823('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5823('0xa')](_0x5823('0xf'),auth[_0x5823('0xb')](),controller[_0x5823('0x10')]);router['get']('/:id/canned_answers',auth[_0x5823('0xb')](),controller[_0x5823('0x11')]);router[_0x5823('0xa')]('/:id/logo',controller['getLogo']);router[_0x5823('0xa')](_0x5823('0x12'),controller[_0x5823('0x13')]);router[_0x5823('0xa')](_0x5823('0x14'),controller[_0x5823('0x15')]);router[_0x5823('0xa')](_0x5823('0x16'),controller[_0x5823('0x17')]);router[_0x5823('0xa')]('/:id/interactions',auth[_0x5823('0xb')](),controller[_0x5823('0x18')]);router[_0x5823('0xa')](_0x5823('0x19'),controller['getSnippet']);router[_0x5823('0xa')](_0x5823('0x1a'),auth[_0x5823('0xb')](),controller['getApplications']);router[_0x5823('0xa')](_0x5823('0x1b'),auth[_0x5823('0xb')](),controller['getProactiveActions']);router[_0x5823('0xa')](_0x5823('0x1c'),controller['getFields']);router[_0x5823('0xa')](_0x5823('0x1d'),auth['isAuthenticated'](),controller[_0x5823('0x1e')]);router[_0x5823('0xa')](_0x5823('0x1f'),auth['isAuthenticated'](),controller[_0x5823('0x20')]);router['post']('/',auth[_0x5823('0xb')](),controller['create']);router[_0x5823('0x21')](_0x5823('0xf'),auth[_0x5823('0xb')](),controller[_0x5823('0x22')]);router[_0x5823('0x21')](_0x5823('0x23'),auth[_0x5823('0xb')](),controller[_0x5823('0x24')]);var upload=multer({'storage':multer[_0x5823('0x25')]({'destination':function(_0x57b5b6,_0x23edd6,_0xe5a9a6){_0xe5a9a6(null,path[_0x5823('0x26')](config[_0x5823('0x27')],_0x5823('0x28')));},'filename':function(_0x3c13fd,_0x3e2c14,_0xcc95f6){_0xcc95f6(null,util[_0x5823('0x29')](_0x5823('0x2a'),Date[_0x5823('0x2b')](),_0x3e2c14[_0x5823('0x2c')]));}})});router['post']('/:id/logo',upload[_0x5823('0x2d')](_0x5823('0x2e')),controller[_0x5823('0x2f')]);var upload=multer({'storage':multer[_0x5823('0x25')]({'destination':function(_0x5bc141,_0x569049,_0xbc082d){_0xbc082d(null,path[_0x5823('0x26')](config[_0x5823('0x27')],_0x5823('0x30')));},'filename':function(_0x1e3782,_0xd43be1,_0x2bf478){_0x2bf478(null,util[_0x5823('0x29')](_0x5823('0x2a'),Date[_0x5823('0x2b')](),_0xd43be1[_0x5823('0x2c')]));}})});router[_0x5823('0x21')](_0x5823('0x12'),upload['single'](_0x5823('0x2e')),controller[_0x5823('0x31')]);var upload=multer({'storage':multer[_0x5823('0x25')]({'destination':function(_0x226aa8,_0x166171,_0x3cfb33){_0x3cfb33(null,path[_0x5823('0x26')](config[_0x5823('0x27')],_0x5823('0x30')));},'filename':function(_0x440223,_0x43ad45,_0x71f8e5){_0x71f8e5(null,util[_0x5823('0x29')](_0x5823('0x2a'),Date[_0x5823('0x2b')](),_0x43ad45[_0x5823('0x2c')]));}})});router[_0x5823('0x21')](_0x5823('0x14'),upload[_0x5823('0x2d')](_0x5823('0x2e')),controller[_0x5823('0x32')]);var upload=multer({'storage':multer[_0x5823('0x25')]({'destination':function(_0x5db0dd,_0x2aa8ba,_0x4bd4e2){_0x4bd4e2(null,path['join'](config['root'],_0x5823('0x30')));},'filename':function(_0x5d6d0d,_0x15b965,_0x549da8){_0x549da8(null,util['format']('%s-%s',Date[_0x5823('0x2b')](),_0x15b965[_0x5823('0x2c')]));}})});router[_0x5823('0x21')]('/:id/system_avatar',upload[_0x5823('0x2d')](_0x5823('0x2e')),controller[_0x5823('0x33')]);router['post'](_0x5823('0x34'),controller[_0x5823('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x542ee7,_0x3220f7,_0x426a62){const _0x4e0f63=path[_0x5823('0x26')](config[_0x5823('0x27')],_0x5823('0x36'),_0x5823('0x37'),_0x5823('0x38'));fs_extra[_0x5823('0x39')](_0x4e0f63,function(){_0x426a62(null,_0x4e0f63);});},'filename':function(_0x48a186,_0x31145a,_0x2f5d88){const _0x55aaa4=_0x31145a[_0x5823('0x2c')][_0x5823('0x3a')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x2a88b6=path[_0x5823('0x3b')](_0x55aaa4);const _0x340fe8=Date[_0x5823('0x2b')]()+'-'+_0x55aaa4[_0x5823('0x3a')](_0x2a88b6,'')+_0x2a88b6;_0x2f5d88(null,_0x340fe8);}})});router['post'](_0x5823('0x3c'),offlineUploadMulter[_0x5823('0x3d')](),controller[_0x5823('0x3e')]);router[_0x5823('0x21')]('/:id/interactions',auth[_0x5823('0xb')](),controller[_0x5823('0x3f')]);router[_0x5823('0x21')](_0x5823('0x1a'),auth[_0x5823('0xb')](),controller[_0x5823('0x40')]);router[_0x5823('0x21')]('/:id/proactive_actions',auth['isAuthenticated'](),controller[_0x5823('0x41')]);router[_0x5823('0x21')](_0x5823('0x1f'),auth[_0x5823('0xb')](),controller[_0x5823('0x42')]);router[_0x5823('0x43')]('/:id',auth[_0x5823('0xb')](),controller[_0x5823('0x44')]);router[_0x5823('0x45')]('/:id',auth[_0x5823('0xb')](),controller[_0x5823('0x46')]);router['delete'](_0x5823('0xf'),auth['isAuthenticated'](),controller[_0x5823('0x47')]);router[_0x5823('0x45')](_0x5823('0x23'),auth[_0x5823('0xb')](),controller[_0x5823('0x48')]);router['delete'](_0x5823('0x1f'),auth['isAuthenticated'](),controller[_0x5823('0x49')]);module[_0x5823('0x4a')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index db93428..f0fd21e 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 _0x6c18=['Router','env','expressEndpoint','use','beaver-logger/server','express','../components/auth/service'];(function(_0x38ced4,_0x24263f){var _0x547c07=function(_0x279fc4){while(--_0x279fc4){_0x38ced4['push'](_0x38ced4['shift']());}};_0x547c07(++_0x24263f);}(_0x6c18,0x1a1));var _0x86c1=function(_0x4c3b80,_0x196af9){_0x4c3b80=_0x4c3b80-0x0;var _0x3290a1=_0x6c18[_0x4c3b80];return _0x3290a1;};var beaverLogger=require(_0x86c1('0x0'));var express=require(_0x86c1('0x1'));var auth=require(_0x86c1('0x2'));var config=require('../config/environment');var router=express[_0x86c1('0x3')]();var isProduction=config[_0x86c1('0x4')]==='production'||![];function clientSideLogs(_0x2fb387,_0xa121ff,_0x3d6b3f){var _0x158b1c=_0x2fb387['app']['get']('client-side-logger');if(!_0x158b1c){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0x86c1('0x5')]({'uri':'/client-logs','logger':_0x158b1c,'enableCors':!isProduction})(_0x2fb387,_0xa121ff,_0x3d6b3f);}router[_0x86c1('0x6')](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x1d2e=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../config/environment','Router','env','production','app','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x253ae6,_0xc0f0f9){var _0x13157a=function(_0x35210f){while(--_0x35210f){_0x253ae6['push'](_0x253ae6['shift']());}};_0x13157a(++_0xc0f0f9);}(_0x1d2e,0x7c));var _0xe1d2=function(_0x3ba38b,_0x39c0be){_0x3ba38b=_0x3ba38b-0x0;var _0x574206=_0x1d2e[_0x3ba38b];return _0x574206;};var beaverLogger=require(_0xe1d2('0x0'));var express=require(_0xe1d2('0x1'));var auth=require('../components/auth/service');var config=require(_0xe1d2('0x2'));var router=express[_0xe1d2('0x3')]();var isProduction=config[_0xe1d2('0x4')]===_0xe1d2('0x5')||![];function clientSideLogs(_0x2cc8e6,_0x4fda83,_0x34d59e){var _0x335f61=_0x2cc8e6[_0xe1d2('0x6')][_0xe1d2('0x7')](_0xe1d2('0x8'));if(!_0x335f61){throw new Error(_0xe1d2('0x9'));}return beaverLogger[_0xe1d2('0xa')]({'uri':_0xe1d2('0xb'),'logger':_0x335f61,'enableCors':!isProduction})(_0x2cc8e6,_0x4fda83,_0x34d59e);}router[_0xe1d2('0xc')](auth[_0xe1d2('0xd')](),clientSideLogs);module[_0xe1d2('0xe')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index e4a6d63..5d9af1a 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 _0x7c19=['ENUM','AmazonAWS','Google','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING'];(function(_0x100e36,_0x4da225){var _0x1df0c9=function(_0xe4b84f){while(--_0xe4b84f){_0x100e36['push'](_0x100e36['shift']());}};_0x1df0c9(++_0x4da225);}(_0x7c19,0x174));var _0x97c1=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x7c19[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x97c1('0x0'));module[_0x97c1('0x1')]={'name':{'type':Sequelize[_0x97c1('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x97c1('0x3')](_0x97c1('0x4'),_0x97c1('0x5'),_0x97c1('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x97c1('0x3')]('Outlook365',_0x97c1('0x7'))},'data1':{'type':Sequelize[_0x97c1('0x2')],'comment':_0x97c1('0x8')},'data2':{'type':Sequelize[_0x97c1('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x97c1('0x2')],'comment':_0x97c1('0x9')},'data4':{'type':Sequelize[_0x97c1('0x2')],'comment':_0x97c1('0xa')},'data5':{'type':Sequelize[_0x97c1('0xb')],'comment':_0x97c1('0xc')},'data6':{'type':Sequelize[_0x97c1('0xb')],'comment':_0x97c1('0xd')},'data7':{'type':Sequelize[_0x97c1('0xb')],'comment':_0x97c1('0xe')}}; \ No newline at end of file +var _0x2ccd=['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','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x17e735,_0x328f40){var _0x1824d6=function(_0x4460fe){while(--_0x4460fe){_0x17e735['push'](_0x17e735['shift']());}};_0x1824d6(++_0x328f40);}(_0x2ccd,0x8e));var _0xd2cc=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2ccd[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xd2cc('0x0'));module['exports']={'name':{'type':Sequelize[_0xd2cc('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd2cc('0x2')](_0xd2cc('0x3'),'Google',_0xd2cc('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd2cc('0x2')](_0xd2cc('0x5'),_0xd2cc('0x6'))},'data1':{'type':Sequelize[_0xd2cc('0x1')],'comment':_0xd2cc('0x7')},'data2':{'type':Sequelize[_0xd2cc('0x1')],'comment':_0xd2cc('0x8')},'data3':{'type':Sequelize['STRING'],'comment':_0xd2cc('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0xd2cc('0xa')},'data5':{'type':Sequelize[_0xd2cc('0xb')],'comment':_0xd2cc('0xc')},'data6':{'type':Sequelize['TEXT'],'comment':_0xd2cc('0xd')},'data7':{'type':Sequelize[_0xd2cc('0xb')],'comment':_0xd2cc('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e78f9d0..c7fc11b 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 _0x1846=['Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','find','destroy','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','base64','isValidIdToken','oauth2Claims','del','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:error','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','api','./cloudProvider.oauth','redis','defaults','localhost','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','sendStatus','error','name','send','padEnd','map','CloudProvider','fieldName','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','merge','type','VIRTUAL','filter','options','includeAll','include','rows','service','data3','catch','show','params','MicrosoftAzure','decryptString','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','values','includes'];(function(_0x420085,_0x4fde85){var _0x617837=function(_0x2c94cc){while(--_0x2c94cc){_0x420085['push'](_0x420085['shift']());}};_0x617837(++_0x4fde85);}(_0x1846,0x179));var _0x6184=function(_0x27c24d,_0x2b50f1){_0x27c24d=_0x27c24d-0x0;var _0x14e722=_0x1846[_0x27c24d];return _0x14e722;};'use strict';var _=require(_0x6184('0x0'));var Redis=require(_0x6184('0x1'));var qs=require(_0x6184('0x2'));var encryptor=require(_0x6184('0x3'));var config=require(_0x6184('0x4'));var logger=require('../../config/logger')(_0x6184('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x6184('0x6'));config[_0x6184('0x7')]=_[_0x6184('0x8')](config['redis'],{'host':_0x6184('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6184('0x7')]));var redis=new Redis(config[_0x6184('0x7')]);function respondWithStatusCode(_0x4c4214,_0x36f382){_0x36f382=_0x36f382||0xcc;return function(_0x4c74e7){if(_0x4c74e7){return _0x4c4214['sendStatus'](_0x36f382);}return _0x4c4214[_0x6184('0xa')](_0x36f382)[_0x6184('0xb')]();};}function respondWithResult(_0x1d5be5,_0x4c65de){_0x4c65de=_0x4c65de||0xc8;return function(_0x2769f6){if(_0x2769f6){return _0x1d5be5['status'](_0x4c65de)[_0x6184('0xc')](_0x2769f6);}};}function respondWithFilteredResult(_0x439ebe,_0x290748){return function(_0x3c5104){if(_0x3c5104){var _0x2d3671=typeof _0x290748[_0x6184('0xd')]===_0x6184('0xe')&&typeof _0x290748[_0x6184('0xf')]==='undefined';var _0x502bb3=_0x3c5104['count'];var _0x360c21=_0x2d3671?0x0:_0x290748[_0x6184('0xd')];var _0x5791a3=_0x2d3671?_0x3c5104[_0x6184('0x10')]:_0x290748[_0x6184('0xd')]+_0x290748['limit'];var _0x5e2c4e;if(_0x5791a3>=_0x502bb3){_0x5791a3=_0x502bb3;_0x5e2c4e=0xc8;}else{_0x5e2c4e=0xce;}_0x439ebe['status'](_0x5e2c4e);return _0x439ebe[_0x6184('0x11')](_0x6184('0x12'),_0x360c21+'-'+_0x5791a3+'/'+_0x502bb3)[_0x6184('0xc')](_0x3c5104);}return null;};}function saveUpdates(_0x51f531){return function(_0x1eb58e){if(_0x1eb58e){return _0x1eb58e[_0x6184('0x13')](_0x51f531)[_0x6184('0x14')](function(_0x16f1cb){return _0x16f1cb;});}return null;};}function removeEntity(_0x46d80b){return function(_0x776a31){if(_0x776a31){return _0x776a31['destroy']()[_0x6184('0x14')](function(){_0x46d80b[_0x6184('0xa')](0xcc)[_0x6184('0xb')]();});}};}function handleEntityNotFound(_0xbc1ab9){return function(_0x47c36e){if(!_0x47c36e){_0xbc1ab9[_0x6184('0x15')](0x194);}return _0x47c36e;};}function handleError(_0x4951a9,_0x1b2894){_0x1b2894=_0x1b2894||0x1f4;return function(_0x33d70a){logger[_0x6184('0x16')](_0x33d70a['stack']);if(_0x33d70a['name']){delete _0x33d70a[_0x6184('0x17')];}_0x4951a9[_0x6184('0xa')](_0x1b2894)[_0x6184('0x18')](_0x33d70a);};}function maskClientSecret(_0x9a2625){return _[_0x6184('0x19')](_0x9a2625['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x1db518,_0x14ad0a){var _0x1d017c={},_0x48259d={},_0x257096={'count':0x0,'rows':[]};var _0x3f96d5=_[_0x6184('0x1a')](db[_0x6184('0x1b')]['rawAttributes'],function(_0x31895b){return{'name':_0x31895b[_0x6184('0x1c')],'type':_0x31895b['type']['key']};});_0x48259d[_0x6184('0x1d')]=_['map'](_0x3f96d5,_0x6184('0x17'));_0x48259d[_0x6184('0x1e')]=_[_0x6184('0x1f')](_0x1db518[_0x6184('0x1e')]);_0x48259d['filters']=_[_0x6184('0x20')](_0x48259d[_0x6184('0x1d')],_0x48259d[_0x6184('0x1e')]);_0x1d017c['attributes']=_['intersection'](_0x48259d[_0x6184('0x1d')],qs[_0x6184('0x21')](_0x1db518['query'][_0x6184('0x21')]));_0x1d017c['attributes']=_0x1d017c[_0x6184('0x22')][_0x6184('0x23')]?_0x1d017c[_0x6184('0x22')]:_0x48259d['model'];if(!_0x1db518['query'][_0x6184('0x24')]('nolimit')){_0x1d017c['limit']=qs[_0x6184('0xf')](_0x1db518['query'][_0x6184('0xf')]);_0x1d017c['offset']=qs[_0x6184('0xd')](_0x1db518[_0x6184('0x1e')]['offset']);}_0x1d017c[_0x6184('0x25')]=qs['sort'](_0x1db518['query'][_0x6184('0x26')]);_0x1d017c[_0x6184('0x27')]=qs[_0x6184('0x28')](_['pick'](_0x1db518[_0x6184('0x1e')],_0x48259d[_0x6184('0x28')]),_0x3f96d5);if(_0x1db518[_0x6184('0x1e')]['filter']){_0x1d017c['where']=_[_0x6184('0x29')](_0x1d017c[_0x6184('0x27')],{'$or':_[_0x6184('0x1a')](_0x3f96d5,function(_0x3ea1af){if(_0x3ea1af[_0x6184('0x2a')]!==_0x6184('0x2b')){var _0x3fb7c6={};_0x3fb7c6[_0x3ea1af[_0x6184('0x17')]]={'$like':'%'+_0x1db518[_0x6184('0x1e')][_0x6184('0x2c')]+'%'};return _0x3fb7c6;}})});}_0x1d017c=_[_0x6184('0x29')]({},_0x1d017c,_0x1db518[_0x6184('0x2d')]);var _0x24dad5={'where':_0x1d017c[_0x6184('0x27')]};return db[_0x6184('0x1b')]['count'](_0x24dad5)[_0x6184('0x14')](function(_0x29e5e9){_0x257096[_0x6184('0x10')]=_0x29e5e9;if(_0x1db518[_0x6184('0x1e')][_0x6184('0x2e')]){_0x1d017c[_0x6184('0x2f')]=[{'all':!![]}];}return db[_0x6184('0x1b')]['findAll'](_0x1d017c);})[_0x6184('0x14')](function(_0x167a8c){_0x257096[_0x6184('0x30')]=_[_0x6184('0x1a')](_0x167a8c,function(_0x2ef894){if(_0x2ef894[_0x6184('0x31')]==='MicrosoftAzure'){var _0x304cb4=encryptor['decryptString'](_0x2ef894[_0x6184('0x32')]);_0x2ef894[_0x6184('0x32')]=maskClientSecret(_0x304cb4);}return _0x2ef894;});return _0x257096;})[_0x6184('0x14')](respondWithFilteredResult(_0x14ad0a,_0x1d017c))[_0x6184('0x33')](handleError(_0x14ad0a,null));};exports[_0x6184('0x34')]=function(_0x479fd5,_0x1ee2ba){var _0x5744ce={'raw':!![],'where':{'id':_0x479fd5[_0x6184('0x35')]['id']}},_0x51bb4c={};_0x51bb4c[_0x6184('0x1d')]=_[_0x6184('0x1f')](db[_0x6184('0x1b')]['rawAttributes']);_0x51bb4c['query']=_[_0x6184('0x1f')](_0x479fd5[_0x6184('0x1e')]);_0x51bb4c['filters']=_[_0x6184('0x20')](_0x51bb4c[_0x6184('0x1d')],_0x51bb4c[_0x6184('0x1e')]);_0x5744ce[_0x6184('0x22')]=_[_0x6184('0x20')](_0x51bb4c[_0x6184('0x1d')],qs[_0x6184('0x21')](_0x479fd5[_0x6184('0x1e')][_0x6184('0x21')]));_0x5744ce[_0x6184('0x22')]=_0x5744ce[_0x6184('0x22')]['length']?_0x5744ce[_0x6184('0x22')]:_0x51bb4c[_0x6184('0x1d')];if(_0x479fd5[_0x6184('0x1e')]['includeAll']){_0x5744ce[_0x6184('0x2f')]=[{'all':!![]}];}_0x5744ce=_[_0x6184('0x29')]({},_0x5744ce,_0x479fd5['options']);return db[_0x6184('0x1b')]['find'](_0x5744ce)['then'](handleEntityNotFound(_0x1ee2ba,null))[_0x6184('0x14')](function(_0x42a4b2){if(_0x42a4b2[_0x6184('0x31')]===_0x6184('0x36')){var _0x344142=encryptor[_0x6184('0x37')](_0x42a4b2[_0x6184('0x32')]);_0x42a4b2[_0x6184('0x32')]=maskClientSecret(_0x344142);}return _0x42a4b2;})['then'](respondWithResult(_0x1ee2ba,null))['catch'](handleError(_0x1ee2ba,null));};exports[_0x6184('0x38')]=function(_0x27e678,_0x38e4d2){if(!_0x27e678[_0x6184('0x39')][_0x6184('0x17')])throw new Error(_0x6184('0x3a'));if(!_0x27e678['body'][_0x6184('0x31')])throw new Error(_0x6184('0x3b'));var _0x1f42b2=db[_0x6184('0x1b')][_0x6184('0x3c')][_0x6184('0x31')][_0x6184('0x3d')];if(!_0x1f42b2[_0x6184('0x3e')](_0x27e678['body'][_0x6184('0x31')]))throw new Error(_0x6184('0x3f')+_0x1f42b2[_0x6184('0x40')](',\x20'));if(_0x27e678['body'][_0x6184('0x31')]===_0x6184('0x36')&&_0x27e678['body'][_0x6184('0x32')]){_0x27e678[_0x6184('0x39')]['data3']=encryptor[_0x6184('0x41')](_0x27e678[_0x6184('0x39')][_0x6184('0x32')]);}return db[_0x6184('0x1b')][_0x6184('0x38')](_0x27e678[_0x6184('0x39')],{})[_0x6184('0x14')](respondWithResult(_0x38e4d2,0xc9))[_0x6184('0x33')](handleError(_0x38e4d2,null));};exports[_0x6184('0x13')]=function(_0x3626d9,_0x5d231b){if(_0x3626d9[_0x6184('0x39')]['id']){delete _0x3626d9[_0x6184('0x39')]['id'];}return db[_0x6184('0x1b')][_0x6184('0x42')]({'where':{'id':_0x3626d9['params']['id']}})[_0x6184('0x14')](handleEntityNotFound(_0x5d231b,null))[_0x6184('0x14')](function(_0xf7e50e){if(_0xf7e50e[_0x6184('0x31')]===_0x6184('0x36')&&_0x3626d9[_0x6184('0x39')]['data3']){_0x3626d9['body'][_0x6184('0x32')]=encryptor[_0x6184('0x41')](_0x3626d9[_0x6184('0x39')]['data3']);}return _0xf7e50e;})[_0x6184('0x14')](saveUpdates(_0x3626d9[_0x6184('0x39')],null))[_0x6184('0x14')](respondWithResult(_0x5d231b,null))[_0x6184('0x33')](handleError(_0x5d231b,null));};exports[_0x6184('0x43')]=function(_0x499b16,_0x3d3641){return db[_0x6184('0x1b')]['find']({'where':{'id':_0x499b16[_0x6184('0x35')]['id']}})[_0x6184('0x14')](handleEntityNotFound(_0x3d3641,null))[_0x6184('0x14')](removeEntity(_0x3d3641,null))[_0x6184('0x33')](handleError(_0x3d3641,null));};exports[_0x6184('0x44')]=function(_0x4a56a3,_0x4d1d7c){return db['CloudProvider'][_0x6184('0x45')]({'where':{'id':_0x4a56a3['params']['id']},'raw':!![]})[_0x6184('0x14')](function(_0x5ed1d4){if(!_0x5ed1d4)return _0x4d1d7c[_0x6184('0x15')](0x194);return{'url':oauth[_0x6184('0x46')](_0x5ed1d4,_0x4a56a3[_0x6184('0x47')]['id'])};})['then'](respondWithResult(_0x4d1d7c,null))[_0x6184('0x33')](handleError(_0x4d1d7c,null));};exports[_0x6184('0x48')]=function(_0xf9554c,_0xb4dd3){var _0x7e08b9=_0xf9554c[_0x6184('0x39')];var _0x74d3a7;var _0x4183d5;if(_0x7e08b9[_0x6184('0x16')])throw _0x7e08b9;redis['get'](_0x7e08b9[_0x6184('0x49')])['then'](function(_0x64fb30){if(!_0x64fb30)throw new Error(_0x6184('0x4a'));_0x74d3a7=JSON['parse'](_0x64fb30);var _0x5ba478=Buffer['from'](_0x7e08b9[_0x6184('0x49')],_0x6184('0x4b'))['toString']('ascii');_0x4183d5=JSON['parse'](_0x5ba478);if(!oauth[_0x6184('0x4c')](_0x7e08b9['id_token'],_0x74d3a7[_0x6184('0x4d')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0x6184('0x4e')](_0x7e08b9[_0x6184('0x49')]);return oauth[_0x6184('0x4f')](_0x7e08b9[_0x6184('0x50')],_0x74d3a7);})[_0x6184('0x14')](function(_0x405061){_0x74d3a7['data5']=_0x405061[_0x6184('0x51')];_0x74d3a7[_0x6184('0x52')]=_0x405061[_0x6184('0x53')];return db[_0x6184('0x1b')][_0x6184('0x13')]({'data5':_0x74d3a7['data5'],'data6':_0x74d3a7['data6']},{'where':{'id':_0x74d3a7['id']}});})['then'](function(){oauth[_0x6184('0x54')](_0x74d3a7);socket['emit']('microsoftAuthorization:success',{'id':_0x4183d5['id']});return;})[_0x6184('0x14')](respondWithStatusCode(_0xb4dd3,null))['catch'](function(_0x222e8a){if(_0x4183d5){socket['emit'](_0x6184('0x55'),{'id':_0x4183d5['id']});}if(!_0x74d3a7){logger[_0x6184('0x16')]('Invalid\x20authentication\x20state\x20parameter',_0x222e8a);return _0xb4dd3[_0x6184('0xa')](0x1f4)[_0x6184('0x18')](_0x222e8a[_0x6184('0x56')]);}logger[_0x6184('0x16')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x74d3a7['id'],JSON[_0x6184('0x57')](_0x222e8a));});}; \ No newline at end of file +var _0x02cf=['defaults','redis','localhost','socket.io-emitter','sendStatus','end','status','offset','undefined','limit','count','set','json','update','then','destroy','error','stack','name','send','padEnd','index','map','CloudProvider','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','VIRTUAL','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','keys','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','oauth2MicrosoftAuthorize','findOne','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth'];(function(_0x346045,_0x3ce566){var _0x3d1573=function(_0x1fb641){while(--_0x1fb641){_0x346045['push'](_0x346045['shift']());}};_0x3d1573(++_0x3ce566);}(_0x02cf,0x1e1));var _0xf02c=function(_0x5d2a3e,_0x5ba125){_0x5d2a3e=_0x5d2a3e-0x0;var _0x32424e=_0x02cf[_0x5d2a3e];return _0x32424e;};'use strict';var _=require(_0xf02c('0x0'));var Redis=require(_0xf02c('0x1'));var qs=require(_0xf02c('0x2'));var encryptor=require(_0xf02c('0x3'));var config=require(_0xf02c('0x4'));var logger=require(_0xf02c('0x5'))(_0xf02c('0x6'));var db=require(_0xf02c('0x7'))['db'];var oauth=require(_0xf02c('0x8'));config['redis']=_[_0xf02c('0x9')](config[_0xf02c('0xa')],{'host':_0xf02c('0xb'),'port':0x18eb});var socket=require(_0xf02c('0xc'))(new Redis(config[_0xf02c('0xa')]));var redis=new Redis(config[_0xf02c('0xa')]);function respondWithStatusCode(_0x4288fc,_0x2a33d7){_0x2a33d7=_0x2a33d7||0xcc;return function(_0x445add){if(_0x445add){return _0x4288fc[_0xf02c('0xd')](_0x2a33d7);}return _0x4288fc['status'](_0x2a33d7)[_0xf02c('0xe')]();};}function respondWithResult(_0x451ca2,_0x5576f2){_0x5576f2=_0x5576f2||0xc8;return function(_0x172b9e){if(_0x172b9e){return _0x451ca2[_0xf02c('0xf')](_0x5576f2)['json'](_0x172b9e);}};}function respondWithFilteredResult(_0x48c9d7,_0x5337a4){return function(_0x44dd04){if(_0x44dd04){var _0xce566d=typeof _0x5337a4[_0xf02c('0x10')]===_0xf02c('0x11')&&typeof _0x5337a4[_0xf02c('0x12')]===_0xf02c('0x11');var _0x3ddb67=_0x44dd04[_0xf02c('0x13')];var _0x21f45c=_0xce566d?0x0:_0x5337a4[_0xf02c('0x10')];var _0x196c7c=_0xce566d?_0x44dd04[_0xf02c('0x13')]:_0x5337a4[_0xf02c('0x10')]+_0x5337a4[_0xf02c('0x12')];var _0x2dfa3b;if(_0x196c7c>=_0x3ddb67){_0x196c7c=_0x3ddb67;_0x2dfa3b=0xc8;}else{_0x2dfa3b=0xce;}_0x48c9d7[_0xf02c('0xf')](_0x2dfa3b);return _0x48c9d7[_0xf02c('0x14')]('Content-Range',_0x21f45c+'-'+_0x196c7c+'/'+_0x3ddb67)[_0xf02c('0x15')](_0x44dd04);}return null;};}function saveUpdates(_0x11d02f){return function(_0x54e6f9){if(_0x54e6f9){return _0x54e6f9[_0xf02c('0x16')](_0x11d02f)[_0xf02c('0x17')](function(_0x18f26c){return _0x18f26c;});}return null;};}function removeEntity(_0x22791f){return function(_0xafd96){if(_0xafd96){return _0xafd96[_0xf02c('0x18')]()[_0xf02c('0x17')](function(){_0x22791f['status'](0xcc)[_0xf02c('0xe')]();});}};}function handleEntityNotFound(_0x11d72c){return function(_0x500e0f){if(!_0x500e0f){_0x11d72c['sendStatus'](0x194);}return _0x500e0f;};}function handleError(_0x2d3e89,_0x3cd911){_0x3cd911=_0x3cd911||0x1f4;return function(_0x1ca19c){logger[_0xf02c('0x19')](_0x1ca19c[_0xf02c('0x1a')]);if(_0x1ca19c[_0xf02c('0x1b')]){delete _0x1ca19c[_0xf02c('0x1b')];}_0x2d3e89['status'](_0x3cd911)[_0xf02c('0x1c')](_0x1ca19c);};}function maskClientSecret(_0xc66c45){return _[_0xf02c('0x1d')](_0xc66c45['slice'](0x0,0x3),0x14,'*');}exports[_0xf02c('0x1e')]=function(_0x562cc8,_0x51c385){var _0x4dfb9d={},_0x3e649e={},_0x25a532={'count':0x0,'rows':[]};var _0x2aaab5=_[_0xf02c('0x1f')](db[_0xf02c('0x20')][_0xf02c('0x21')],function(_0x596ab6){return{'name':_0x596ab6[_0xf02c('0x22')],'type':_0x596ab6[_0xf02c('0x23')][_0xf02c('0x24')]};});_0x3e649e[_0xf02c('0x25')]=_[_0xf02c('0x1f')](_0x2aaab5,_0xf02c('0x1b'));_0x3e649e[_0xf02c('0x26')]=_['keys'](_0x562cc8[_0xf02c('0x26')]);_0x3e649e[_0xf02c('0x27')]=_[_0xf02c('0x28')](_0x3e649e['model'],_0x3e649e[_0xf02c('0x26')]);_0x4dfb9d[_0xf02c('0x29')]=_[_0xf02c('0x28')](_0x3e649e[_0xf02c('0x25')],qs[_0xf02c('0x2a')](_0x562cc8['query'][_0xf02c('0x2a')]));_0x4dfb9d[_0xf02c('0x29')]=_0x4dfb9d[_0xf02c('0x29')][_0xf02c('0x2b')]?_0x4dfb9d[_0xf02c('0x29')]:_0x3e649e['model'];if(!_0x562cc8[_0xf02c('0x26')]['hasOwnProperty']('nolimit')){_0x4dfb9d[_0xf02c('0x12')]=qs[_0xf02c('0x12')](_0x562cc8['query'][_0xf02c('0x12')]);_0x4dfb9d[_0xf02c('0x10')]=qs[_0xf02c('0x10')](_0x562cc8['query'][_0xf02c('0x10')]);}_0x4dfb9d[_0xf02c('0x2c')]=qs['sort'](_0x562cc8['query'][_0xf02c('0x2d')]);_0x4dfb9d[_0xf02c('0x2e')]=qs['filters'](_['pick'](_0x562cc8[_0xf02c('0x26')],_0x3e649e[_0xf02c('0x27')]),_0x2aaab5);if(_0x562cc8['query'][_0xf02c('0x2f')]){_0x4dfb9d[_0xf02c('0x2e')]=_[_0xf02c('0x30')](_0x4dfb9d[_0xf02c('0x2e')],{'$or':_[_0xf02c('0x1f')](_0x2aaab5,function(_0x135b38){if(_0x135b38[_0xf02c('0x23')]!==_0xf02c('0x31')){var _0x4fd900={};_0x4fd900[_0x135b38[_0xf02c('0x1b')]]={'$like':'%'+_0x562cc8[_0xf02c('0x26')]['filter']+'%'};return _0x4fd900;}})});}_0x4dfb9d=_[_0xf02c('0x30')]({},_0x4dfb9d,_0x562cc8['options']);var _0x5dd21e={'where':_0x4dfb9d[_0xf02c('0x2e')]};return db[_0xf02c('0x20')][_0xf02c('0x13')](_0x5dd21e)[_0xf02c('0x17')](function(_0x59e212){_0x25a532[_0xf02c('0x13')]=_0x59e212;if(_0x562cc8[_0xf02c('0x26')]['includeAll']){_0x4dfb9d[_0xf02c('0x32')]=[{'all':!![]}];}return db['CloudProvider']['findAll'](_0x4dfb9d);})['then'](function(_0x694dfb){_0x25a532[_0xf02c('0x33')]=_[_0xf02c('0x1f')](_0x694dfb,function(_0x42b138){if(_0x42b138[_0xf02c('0x34')]===_0xf02c('0x35')){var _0x48528e=encryptor[_0xf02c('0x36')](_0x42b138[_0xf02c('0x37')]);_0x42b138['data3']=maskClientSecret(_0x48528e);}return _0x42b138;});return _0x25a532;})[_0xf02c('0x17')](respondWithFilteredResult(_0x51c385,_0x4dfb9d))[_0xf02c('0x38')](handleError(_0x51c385,null));};exports[_0xf02c('0x39')]=function(_0x4bb252,_0x36da61){var _0x5665af={'raw':!![],'where':{'id':_0x4bb252['params']['id']}},_0x5ef204={};_0x5ef204[_0xf02c('0x25')]=_[_0xf02c('0x3a')](db[_0xf02c('0x20')][_0xf02c('0x21')]);_0x5ef204[_0xf02c('0x26')]=_[_0xf02c('0x3a')](_0x4bb252[_0xf02c('0x26')]);_0x5ef204[_0xf02c('0x27')]=_['intersection'](_0x5ef204[_0xf02c('0x25')],_0x5ef204['query']);_0x5665af[_0xf02c('0x29')]=_[_0xf02c('0x28')](_0x5ef204[_0xf02c('0x25')],qs[_0xf02c('0x2a')](_0x4bb252['query'][_0xf02c('0x2a')]));_0x5665af[_0xf02c('0x29')]=_0x5665af[_0xf02c('0x29')]['length']?_0x5665af['attributes']:_0x5ef204[_0xf02c('0x25')];if(_0x4bb252[_0xf02c('0x26')]['includeAll']){_0x5665af[_0xf02c('0x32')]=[{'all':!![]}];}_0x5665af=_[_0xf02c('0x30')]({},_0x5665af,_0x4bb252[_0xf02c('0x3b')]);return db['CloudProvider'][_0xf02c('0x3c')](_0x5665af)[_0xf02c('0x17')](handleEntityNotFound(_0x36da61,null))[_0xf02c('0x17')](function(_0xa467af){if(_0xa467af['service']===_0xf02c('0x35')){var _0x267054=encryptor[_0xf02c('0x36')](_0xa467af[_0xf02c('0x37')]);_0xa467af[_0xf02c('0x37')]=maskClientSecret(_0x267054);}return _0xa467af;})[_0xf02c('0x17')](respondWithResult(_0x36da61,null))['catch'](handleError(_0x36da61,null));};exports[_0xf02c('0x3d')]=function(_0x4c497c,_0x3e9067){if(!_0x4c497c[_0xf02c('0x3e')][_0xf02c('0x1b')])throw new Error(_0xf02c('0x3f'));if(!_0x4c497c[_0xf02c('0x3e')][_0xf02c('0x34')])throw new Error(_0xf02c('0x40'));var _0x302540=db[_0xf02c('0x20')]['rawAttributes'][_0xf02c('0x34')]['values'];if(!_0x302540[_0xf02c('0x41')](_0x4c497c[_0xf02c('0x3e')]['service']))throw new Error(_0xf02c('0x42')+_0x302540[_0xf02c('0x43')](',\x20'));if(_0x4c497c[_0xf02c('0x3e')]['service']===_0xf02c('0x35')&&_0x4c497c[_0xf02c('0x3e')][_0xf02c('0x37')]){_0x4c497c[_0xf02c('0x3e')][_0xf02c('0x37')]=encryptor[_0xf02c('0x44')](_0x4c497c['body'][_0xf02c('0x37')]);}return db['CloudProvider'][_0xf02c('0x3d')](_0x4c497c[_0xf02c('0x3e')],{})['then'](respondWithResult(_0x3e9067,0xc9))[_0xf02c('0x38')](handleError(_0x3e9067,null));};exports[_0xf02c('0x16')]=function(_0x228d14,_0x506924){if(_0x228d14[_0xf02c('0x3e')]['id']){delete _0x228d14['body']['id'];}return db[_0xf02c('0x20')][_0xf02c('0x3c')]({'where':{'id':_0x228d14[_0xf02c('0x45')]['id']}})['then'](handleEntityNotFound(_0x506924,null))['then'](function(_0x361fbf){if(_0x361fbf[_0xf02c('0x34')]===_0xf02c('0x35')&&_0x228d14['body'][_0xf02c('0x37')]){_0x228d14[_0xf02c('0x3e')][_0xf02c('0x37')]=encryptor['encryptString'](_0x228d14[_0xf02c('0x3e')][_0xf02c('0x37')]);}return _0x361fbf;})[_0xf02c('0x17')](saveUpdates(_0x228d14[_0xf02c('0x3e')],null))[_0xf02c('0x17')](respondWithResult(_0x506924,null))[_0xf02c('0x38')](handleError(_0x506924,null));};exports[_0xf02c('0x18')]=function(_0x4887f9,_0x259b58){return db[_0xf02c('0x20')][_0xf02c('0x3c')]({'where':{'id':_0x4887f9[_0xf02c('0x45')]['id']}})[_0xf02c('0x17')](handleEntityNotFound(_0x259b58,null))[_0xf02c('0x17')](removeEntity(_0x259b58,null))[_0xf02c('0x38')](handleError(_0x259b58,null));};exports[_0xf02c('0x46')]=function(_0x19662d,_0x1bba89){return db['CloudProvider'][_0xf02c('0x47')]({'where':{'id':_0x19662d[_0xf02c('0x45')]['id']},'raw':!![]})['then'](function(_0x5dd6e2){if(!_0x5dd6e2)return _0x1bba89[_0xf02c('0xd')](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x5dd6e2,_0x19662d['user']['id'])};})[_0xf02c('0x17')](respondWithResult(_0x1bba89,null))[_0xf02c('0x38')](handleError(_0x1bba89,null));};exports[_0xf02c('0x48')]=function(_0x5d7ec0,_0x58e77e){var _0x5cad7f=_0x5d7ec0[_0xf02c('0x3e')];var _0x23474c;var _0x3d9e29;if(_0x5cad7f['error'])throw _0x5cad7f;redis[_0xf02c('0x49')](_0x5cad7f[_0xf02c('0x4a')])[_0xf02c('0x17')](function(_0x259737){if(!_0x259737)throw new Error(_0xf02c('0x4b'));_0x23474c=JSON[_0xf02c('0x4c')](_0x259737);var _0xfb79e4=Buffer[_0xf02c('0x4d')](_0x5cad7f['state'],_0xf02c('0x4e'))[_0xf02c('0x4f')](_0xf02c('0x50'));_0x3d9e29=JSON['parse'](_0xfb79e4);if(!oauth[_0xf02c('0x51')](_0x5cad7f[_0xf02c('0x52')],_0x23474c[_0xf02c('0x53')]))throw new Error(_0xf02c('0x54'));redis[_0xf02c('0x55')](_0x5cad7f['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x5cad7f[_0xf02c('0x56')],_0x23474c);})['then'](function(_0x3b9af0){_0x23474c[_0xf02c('0x57')]=_0x3b9af0[_0xf02c('0x58')];_0x23474c[_0xf02c('0x59')]=_0x3b9af0[_0xf02c('0x5a')];return db[_0xf02c('0x20')][_0xf02c('0x16')]({'data5':_0x23474c[_0xf02c('0x57')],'data6':_0x23474c[_0xf02c('0x59')]},{'where':{'id':_0x23474c['id']}});})['then'](function(){oauth[_0xf02c('0x5b')](_0x23474c);socket[_0xf02c('0x5c')](_0xf02c('0x5d'),{'id':_0x3d9e29['id']});return;})[_0xf02c('0x17')](respondWithStatusCode(_0x58e77e,null))[_0xf02c('0x38')](function(_0x56e3ad){if(_0x3d9e29){socket[_0xf02c('0x5c')](_0xf02c('0x5e'),{'id':_0x3d9e29['id']});}if(!_0x23474c){logger['error'](_0xf02c('0x5f'),_0x56e3ad);return _0x58e77e[_0xf02c('0xf')](0x1f4)[_0xf02c('0x1c')](_0x56e3ad['message']);}logger[_0xf02c('0x19')](_0xf02c('0x60'),_0x23474c['id'],JSON[_0xf02c('0x61')](_0x56e3ad));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index ddc1351..6d668ef 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 _0x932f=['api','bluebird','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','util','../../config/logger'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x932f,0x103));var _0xf932=function(_0x5e2301,_0x4d8038){_0x5e2301=_0x5e2301-0x0;var _0x370597=_0x932f[_0x5e2301];return _0x370597;};'use strict';var _=require('lodash');var util=require(_0xf932('0x0'));var logger=require(_0xf932('0x1'))(_0xf932('0x2'));var moment=require('moment');var BPromise=require(_0xf932('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf932('0x4'));module[_0xf932('0x5')]=function(_0x24703e,_0x478159){return _0x24703e[_0xf932('0x6')](_0xf932('0x7'),attributes,{'tableName':_0xf932('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x575d=['path','rimraf','../../config/environment','./cloudProvider.attributes','exports','CloudProvider','cloud_providers','lodash','util','api','moment','request-promise'];(function(_0x21ed1d,_0x5674c7){var _0x51c9ba=function(_0x3f9425){while(--_0x3f9425){_0x21ed1d['push'](_0x21ed1d['shift']());}};_0x51c9ba(++_0x5674c7);}(_0x575d,0xd3));var _0xd575=function(_0x366cbf,_0x1d399d){_0x366cbf=_0x366cbf-0x0;var _0x214bee=_0x575d[_0x366cbf];return _0x214bee;};'use strict';var _=require(_0xd575('0x0'));var util=require(_0xd575('0x1'));var logger=require('../../config/logger')(_0xd575('0x2'));var moment=require(_0xd575('0x3'));var BPromise=require('bluebird');var rp=require(_0xd575('0x4'));var fs=require('fs');var path=require(_0xd575('0x5'));var rimraf=require(_0xd575('0x6'));var config=require(_0xd575('0x7'));var attributes=require(_0xd575('0x8'));module[_0xd575('0x9')]=function(_0x1d5c9d,_0x2755d8){return _0x1d5c9d['define'](_0xd575('0xa'),attributes,{'tableName':_0xd575('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index d533e4e..2b9e37f 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 _0x393a=['openid','profile','email','offline_access','https://outlook.office.com/SMTP.Send','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','data2','id_token','from','toString','base64','randomBytes','hex','client_id','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','value','oauth2Claims','oauth2/','data1','set','stringify','decode','payload','issuer','isAfter','unix','exp','resolve','then','data3','refresh_token','data6','data5','CloudProvider','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','POST','intervals','bind','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0'];(function(_0x1b349a,_0x22222c){var _0x5d1f7c=function(_0x368d7c){while(--_0x368d7c){_0x1b349a['push'](_0x1b349a['shift']());}};_0x5d1f7c(++_0x22222c);}(_0x393a,0x1c9));var _0xa393=function(_0x514038,_0x450ef3){_0x514038=_0x514038-0x0;var _0x589720=_0x393a[_0x514038];return _0x589720;};'use strict';var _=require(_0xa393('0x0'));var crypto=require(_0xa393('0x1'));var jwt=require(_0xa393('0x2'));var moment=require(_0xa393('0x3'));var Redis=require(_0xa393('0x4'));var rp=require(_0xa393('0x5'));var util=require(_0xa393('0x6'));var encryptor=require(_0xa393('0x7'));var config=require(_0xa393('0x8'));var logger=require(_0xa393('0x9'))(_0xa393('0xa'));var schedule=require(_0xa393('0xb'));var db=require(_0xa393('0xc'))['db'];config[_0xa393('0xd')]=_[_0xa393('0xe')](config[_0xa393('0xd')],{'host':_0xa393('0xf'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xa393('0x10');var AZURE_AUTH_SCOPES={'Outlook365':[_0xa393('0x11'),_0xa393('0x12'),_0xa393('0x13'),_0xa393('0x14'),'https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All',_0xa393('0x15')],'Dynamics365':[_0xa393('0x11'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT=_0xa393('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x32f0a7){var _0x1a4edd=_[_0xa393('0x17')](AZURE_AUTH_SCOPES[_0x32f0a7[_0xa393('0x18')]]);if(_0x32f0a7[_0xa393('0x18')]===_0xa393('0x19'))_0x1a4edd[_0xa393('0x1a')](_0x32f0a7[_0xa393('0x1b')]+_0xa393('0x1c'));return _0x1a4edd[_0xa393('0x1d')]('\x20');}function getAccessTokenScope(_0x1108be){if(_0x1108be[_0xa393('0x18')]===_0xa393('0x1e'))return _0xa393('0x1f');if(_0x1108be[_0xa393('0x18')]===_0xa393('0x19'))return _0x1108be[_0xa393('0x1b')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x13977d,_0x236901){var _0x27e7de=MICROSOFT_AUTH_URL[_0xa393('0x20')](_0xa393('0x21'),_0x13977d[_0xa393('0x22')]);var _0x3630a2=['code',_0xa393('0x23')];var _0x242117=Buffer[_0xa393('0x24')](JSON['stringify']({'id':_0x236901}))[_0xa393('0x25')](_0xa393('0x26'));var _0x1dbab6=crypto[_0xa393('0x27')](0x10)['toString'](_0xa393('0x28'));var _0x1ad011=getAuthorizationScopes(_0x13977d);var _0x5b746e=[{'key':_0xa393('0x29'),'value':_0x13977d['data1']},{'key':_0xa393('0x2a'),'value':encodeURIComponent(_0x3630a2[_0xa393('0x1d')]('\x20'))},{'key':_0xa393('0x2b'),'value':_0x13977d[_0xa393('0x2c')]},{'key':_0xa393('0x2d'),'value':_0xa393('0x2e')},{'key':_0xa393('0x2f'),'value':encodeURIComponent(_0x1ad011)},{'key':_0xa393('0x30'),'value':_0x242117},{'key':_0xa393('0x31'),'value':_0x1dbab6},{'key':_0xa393('0x32'),'value':_0xa393('0x33')}];var _0x387025=_0x27e7de+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xa393('0x17')](_0x5b746e,function(_0x58909f){return _0x58909f['key']+'='+_0x58909f[_0xa393('0x34')];})[_0xa393('0x1d')]('&');_0x13977d[_0xa393('0x35')]={'issuer':_0x27e7de[_0xa393('0x20')](_0xa393('0x36'),''),'audience':_0x13977d[_0xa393('0x37')],'state':_0x242117,'nonce':_0x1dbab6};redis[_0xa393('0x38')](_0x242117,JSON[_0xa393('0x39')](_0x13977d));return _0x387025;}function isValidIdToken(_0x28645c,_0x1ed17e){try{var _0x480d17=jwt[_0xa393('0x3a')](_0x28645c,{'complete':!![]});var _0x5e2415=_0x480d17[_0xa393('0x3b')];if(_0x5e2415['iss']!==_0x1ed17e[_0xa393('0x3c')])return![];if(_0x5e2415['aud']!==_0x1ed17e['audience'])return![];if(_0x5e2415['nonce']!==_0x1ed17e[_0xa393('0x31')])return![];if(moment()[_0xa393('0x3d')](moment[_0xa393('0x3e')](_0x5e2415[_0xa393('0x3f')])))return![];return!![];}catch(_0x334937){throw _0x334937;}}function refreshOauth2MicrosoftAccessToken(_0x32e6d3){return Promise[_0xa393('0x40')]()[_0xa393('0x41')](function(){if(_0x32e6d3[_0xa393('0x42')])return _0x32e6d3;return db['CloudProvider']['findOne']({'where':{'id':_0x32e6d3['id']},'raw':!![]});})[_0xa393('0x41')](function(_0x1bcfdc){var _0x3ef367={'grant_type':_0xa393('0x43'),'refresh_token':_0x1bcfdc[_0xa393('0x44')],'scope':getAccessTokenScope(_0x1bcfdc),'redirect_uri':_0x1bcfdc['data4'],'client_id':_0x1bcfdc['data1'],'client_secret':encryptor['decryptString'](_0x1bcfdc[_0xa393('0x42')])};var _0x328720={'method':'POST','uri':MICROSOFT_AUTH_URL[_0xa393('0x20')](_0xa393('0x21'),_0x1bcfdc['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3ef367,'json':!![]};return rp(_0x328720);})[_0xa393('0x41')](function(_0x4ea550){_0x32e6d3[_0xa393('0x45')]=_0x4ea550['access_token'];_0x32e6d3[_0xa393('0x44')]=_0x4ea550[_0xa393('0x43')];return db[_0xa393('0x46')]['update']({'data5':_0x32e6d3[_0xa393('0x45')],'data6':_0x32e6d3[_0xa393('0x44')]},{'where':{'id':_0x32e6d3['id']}});})['then'](function(){return _0x32e6d3;})['catch'](function(_0x422721){logger[_0xa393('0x47')](_0xa393('0x48'),_0x32e6d3['id'],_0x422721);});}function getOauth2MicrosoftAccessToken(_0x2caad1,_0x1f2854){var _0x9df3c3={'grant_type':_0xa393('0x49'),'code':_0x2caad1,'scope':getAccessTokenScope(_0x1f2854),'redirect_uri':_0x1f2854['data4'],'client_id':_0x1f2854[_0xa393('0x37')],'client_secret':encryptor['decryptString'](_0x1f2854[_0xa393('0x42')])};var _0x4d30dc={'method':_0xa393('0x4a'),'uri':MICROSOFT_AUTH_URL[_0xa393('0x20')](_0xa393('0x21'),_0x1f2854[_0xa393('0x22')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x9df3c3,'json':!![]};return rp(_0x4d30dc);}function startRefreshInterval(_0x58832b){var _0x343430=schedule[_0xa393('0x4b')];if(_0x343430[_0x58832b['id']])clearInterval(_0x343430[_0x58832b['id']]);_0x343430[_0x58832b['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xa393('0x4c')](this,{'id':_0x58832b['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xa393('0x4b')]=_0x343430;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xa393('0x41')](function(_0x3bd3e5){var _0x804b2c=_0x3bd3e5['map'](function(_0xd11ff8){return refreshOauth2MicrosoftAccessToken(_0xd11ff8)[_0xa393('0x41')](function(_0x155909){startRefreshInterval(_0x155909);});});return Promise['all'](_0x804b2c);})['catch'](function(_0x631962){var _0x213204=_0x631962?util['inspect'](_0x631962,{'showHidden':![],'depth':null}):'';logger['error'](_0xa393('0x4d'),_0x213204);});}module[_0xa393('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x3de1=['offline_access','https://outlook.office.com/POP.AccessAsUser.All','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','https://outlook.office365.com/IMAP.AccessAsUser.All','replace','{TENANT_ID}','code','id_token','from','stringify','toString','randomBytes','client_id','data1','response_type','redirect_uri','response_mode','form_post','scope','nonce','login','key','value','oauth2Claims','set','decode','issuer','aud','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data4','data5','access_token','data6','authorization_code','decryptString','data2','intervals','bind','findAll','all','catch','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','openid','profile'];(function(_0x1f1ec7,_0x31fb11){var _0x325216=function(_0x3343bb){while(--_0x3343bb){_0x1f1ec7['push'](_0x1f1ec7['shift']());}};_0x325216(++_0x31fb11);}(_0x3de1,0x11b));var _0x13de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3de1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x13de('0x0'));var crypto=require(_0x13de('0x1'));var jwt=require(_0x13de('0x2'));var moment=require(_0x13de('0x3'));var Redis=require('ioredis');var rp=require('request-promise');var util=require('util');var encryptor=require(_0x13de('0x4'));var config=require(_0x13de('0x5'));var logger=require(_0x13de('0x6'))(_0x13de('0x7'));var schedule=require('../../config/schedule/cloud-provider');var db=require(_0x13de('0x8'))['db'];config[_0x13de('0x9')]=_[_0x13de('0xa')](config[_0x13de('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':[_0x13de('0xb'),_0x13de('0xc'),'email',_0x13de('0xd'),'https://outlook.office365.com/IMAP.AccessAsUser.All',_0x13de('0xe'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':['openid','offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x13de('0xf');var MICROSOFT_TOKEN_ENDPOINT=_0x13de('0x10');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x448aec){var _0x526b6f=_[_0x13de('0x11')](AZURE_AUTH_SCOPES[_0x448aec[_0x13de('0x12')]]);if(_0x448aec['type']===_0x13de('0x13'))_0x526b6f[_0x13de('0x14')](_0x448aec[_0x13de('0x15')]+_0x13de('0x16'));return _0x526b6f[_0x13de('0x17')]('\x20');}function getAccessTokenScope(_0x2b8a2b){if(_0x2b8a2b[_0x13de('0x12')]===_0x13de('0x18'))return _0x13de('0x19');if(_0x2b8a2b['type']===_0x13de('0x13'))return _0x2b8a2b['data7']+_0x13de('0x16');}function generateMicrosoftAuthorizationUrl(_0x41eb50,_0x27257b){var _0x3d095d=MICROSOFT_AUTH_URL[_0x13de('0x1a')](_0x13de('0x1b'),_0x41eb50['data2']);var _0x49bb16=[_0x13de('0x1c'),_0x13de('0x1d')];var _0x1db9b7=Buffer[_0x13de('0x1e')](JSON[_0x13de('0x1f')]({'id':_0x27257b}))[_0x13de('0x20')]('base64');var _0x4a3c09=crypto[_0x13de('0x21')](0x10)[_0x13de('0x20')]('hex');var _0x446842=getAuthorizationScopes(_0x41eb50);var _0x3b435e=[{'key':_0x13de('0x22'),'value':_0x41eb50[_0x13de('0x23')]},{'key':_0x13de('0x24'),'value':encodeURIComponent(_0x49bb16['join']('\x20'))},{'key':_0x13de('0x25'),'value':_0x41eb50['data4']},{'key':_0x13de('0x26'),'value':_0x13de('0x27')},{'key':_0x13de('0x28'),'value':encodeURIComponent(_0x446842)},{'key':'state','value':_0x1db9b7},{'key':_0x13de('0x29'),'value':_0x4a3c09},{'key':'prompt','value':_0x13de('0x2a')}];var _0x17b11d=_0x3d095d+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x13de('0x11')](_0x3b435e,function(_0x3e6c99){return _0x3e6c99[_0x13de('0x2b')]+'='+_0x3e6c99[_0x13de('0x2c')];})[_0x13de('0x17')]('&');_0x41eb50[_0x13de('0x2d')]={'issuer':_0x3d095d[_0x13de('0x1a')]('oauth2/',''),'audience':_0x41eb50[_0x13de('0x23')],'state':_0x1db9b7,'nonce':_0x4a3c09};redis[_0x13de('0x2e')](_0x1db9b7,JSON['stringify'](_0x41eb50));return _0x17b11d;}function isValidIdToken(_0x37599d,_0x46432b){try{var _0x33bbce=jwt[_0x13de('0x2f')](_0x37599d,{'complete':!![]});var _0x4bea67=_0x33bbce['payload'];if(_0x4bea67['iss']!==_0x46432b[_0x13de('0x30')])return![];if(_0x4bea67[_0x13de('0x31')]!==_0x46432b[_0x13de('0x32')])return![];if(_0x4bea67['nonce']!==_0x46432b[_0x13de('0x29')])return![];if(moment()[_0x13de('0x33')](moment[_0x13de('0x34')](_0x4bea67['exp'])))return![];return!![];}catch(_0x4b4a23){throw _0x4b4a23;}}function refreshOauth2MicrosoftAccessToken(_0x5ed21d){return Promise[_0x13de('0x35')]()[_0x13de('0x36')](function(){if(_0x5ed21d[_0x13de('0x37')])return _0x5ed21d;return db[_0x13de('0x38')][_0x13de('0x39')]({'where':{'id':_0x5ed21d['id']},'raw':!![]});})['then'](function(_0x276087){var _0x2c864a={'grant_type':_0x13de('0x3a'),'refresh_token':_0x276087['data6'],'scope':getAccessTokenScope(_0x276087),'redirect_uri':_0x276087[_0x13de('0x3b')],'client_id':_0x276087[_0x13de('0x23')],'client_secret':encryptor['decryptString'](_0x276087['data3'])};var _0x3810fd={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x13de('0x1a')]('{TENANT_ID}',_0x276087['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2c864a,'json':!![]};return rp(_0x3810fd);})[_0x13de('0x36')](function(_0x4318d5){_0x5ed21d[_0x13de('0x3c')]=_0x4318d5[_0x13de('0x3d')];_0x5ed21d[_0x13de('0x3e')]=_0x4318d5['refresh_token'];return db[_0x13de('0x38')]['update']({'data5':_0x5ed21d[_0x13de('0x3c')],'data6':_0x5ed21d[_0x13de('0x3e')]},{'where':{'id':_0x5ed21d['id']}});})[_0x13de('0x36')](function(){return _0x5ed21d;})['catch'](function(_0x5e0319){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x5ed21d['id'],_0x5e0319);});}function getOauth2MicrosoftAccessToken(_0x25c5dc,_0x49508f){var _0x650e95={'grant_type':_0x13de('0x3f'),'code':_0x25c5dc,'scope':getAccessTokenScope(_0x49508f),'redirect_uri':_0x49508f['data4'],'client_id':_0x49508f[_0x13de('0x23')],'client_secret':encryptor[_0x13de('0x40')](_0x49508f['data3'])};var _0x210abd={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x13de('0x1a')](_0x13de('0x1b'),_0x49508f[_0x13de('0x41')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x650e95,'json':!![]};return rp(_0x210abd);}function startRefreshInterval(_0x4e33d6){var _0xfbf31=schedule[_0x13de('0x42')];if(_0xfbf31[_0x4e33d6['id']])clearInterval(_0xfbf31[_0x4e33d6['id']]);_0xfbf31[_0x4e33d6['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x13de('0x43')](this,{'id':_0x4e33d6['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x13de('0x42')]=_0xfbf31;}function startAllRefreshIntervals(){return db['CloudProvider'][_0x13de('0x44')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x13de('0x36')](function(_0x709e76){var _0xb1df98=_0x709e76[_0x13de('0x11')](function(_0x51e387){return refreshOauth2MicrosoftAccessToken(_0x51e387)[_0x13de('0x36')](function(_0x1a7f32){startRefreshInterval(_0x1a7f32);});});return Promise[_0x13de('0x45')](_0xb1df98);})[_0x13de('0x46')](function(_0x180824){var _0x18d740=_0x180824?util[_0x13de('0x47')](_0x180824,{'showHidden':![],'depth':null}):'';logger['error'](_0x13de('0x48'),_0x18d740);});}module[_0x13de('0x49')]={'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 dd452cb..1b7b8b7 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 _0xb19a=['CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x56801e,_0x1bf4bc){var _0x54e02d=function(_0x4a5a34){while(--_0x4a5a34){_0x56801e['push'](_0x56801e['shift']());}};_0x54e02d(++_0x1bf4bc);}(_0xb19a,0xd0));var _0xab19=function(_0x3612ca,_0x23946f){_0x3612ca=_0x3612ca-0x0;var _0x494fc5=_0xb19a[_0x3612ca];return _0x494fc5;};'use strict';var _=require(_0xab19('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab19('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab19('0x2'))['db'];var utils=require(_0xab19('0x3'));var logger=require(_0xab19('0x4'))(_0xab19('0x5'));var config=require(_0xab19('0x6'));var jayson=require(_0xab19('0x7'));var client=jayson[_0xab19('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x9d5c1d,_0x131291,_0x59d282){return new BPromise(function(_0x300038,_0x479d0b){return client[_0xab19('0x9')](_0x9d5c1d,_0x59d282)[_0xab19('0xa')](function(_0x2c6a67){logger[_0xab19('0xb')](_0xab19('0xc'),_0x131291,_0xab19('0xd'));logger[_0xab19('0xe')](_0xab19('0xf'),_0x131291,_0xab19('0xd'),JSON[_0xab19('0x10')](_0x2c6a67));if(_0x2c6a67[_0xab19('0x11')]){if(_0x2c6a67[_0xab19('0x11')]['code']===0x1f4){logger['error'](_0xab19('0xc'),_0x131291,_0x2c6a67['error'][_0xab19('0x12')]);return _0x479d0b(_0x2c6a67[_0xab19('0x11')][_0xab19('0x12')]);}logger[_0xab19('0x11')](_0xab19('0xc'),_0x131291,_0x2c6a67[_0xab19('0x11')][_0xab19('0x12')]);return _0x300038(_0x2c6a67['error'][_0xab19('0x12')]);}else{logger[_0xab19('0xb')]('CloudProvider,\x20%s,\x20%s',_0x131291,_0xab19('0xd'));_0x300038(_0x2c6a67[_0xab19('0x13')]['message']);}})['catch'](function(_0x2284b8){logger[_0xab19('0x11')](_0xab19('0xc'),_0x131291,_0x2284b8);_0x479d0b(_0x2284b8);});});} \ No newline at end of file +var _0xf3a8=['message','catch','util','moment','randomstring','../../config/utils','rpc','jayson/promise','client','http','request','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xf3a8,0xf2));var _0x8f3a=function(_0x7ce5c0,_0x448850){_0x7ce5c0=_0x7ce5c0-0x0;var _0x88b1f7=_0xf3a8[_0x7ce5c0];return _0x88b1f7;};'use strict';var _=require('lodash');var util=require(_0x8f3a('0x0'));var moment=require(_0x8f3a('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f3a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f3a('0x3'));var logger=require('../../config/logger')(_0x8f3a('0x4'));var config=require('../../config/environment');var jayson=require(_0x8f3a('0x5'));var client=jayson[_0x8f3a('0x6')][_0x8f3a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x32bb3a,_0xc50ed8,_0x2e290d){return new BPromise(function(_0x3dc1ea,_0xcfad11){return client[_0x8f3a('0x8')](_0x32bb3a,_0x2e290d)['then'](function(_0x2164ba){logger['info'](_0x8f3a('0x9'),_0xc50ed8,_0x8f3a('0xa'));logger[_0x8f3a('0xb')](_0x8f3a('0xc'),_0xc50ed8,_0x8f3a('0xa'),JSON['stringify'](_0x2164ba));if(_0x2164ba[_0x8f3a('0xd')]){if(_0x2164ba[_0x8f3a('0xd')]['code']===0x1f4){logger[_0x8f3a('0xd')]('CloudProvider,\x20%s,\x20%s',_0xc50ed8,_0x2164ba['error'][_0x8f3a('0xe')]);return _0xcfad11(_0x2164ba[_0x8f3a('0xd')]['message']);}logger[_0x8f3a('0xd')](_0x8f3a('0x9'),_0xc50ed8,_0x2164ba[_0x8f3a('0xd')]['message']);return _0x3dc1ea(_0x2164ba[_0x8f3a('0xd')][_0x8f3a('0xe')]);}else{logger['info'](_0x8f3a('0x9'),_0xc50ed8,_0x8f3a('0xa'));_0x3dc1ea(_0x2164ba['result'][_0x8f3a('0xe')]);}})[_0x8f3a('0xf')](function(_0x9bf803){logger[_0x8f3a('0xd')](_0x8f3a('0x9'),_0xc50ed8,_0x9bf803);_0xcfad11(_0x9bf803);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c0e2dee..a70dd4e 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(_0x4404ff,_0x13d7a9){var _0x5e7b19=function(_0x13847a){while(--_0x13847a){_0x4404ff['push'](_0x4404ff['shift']());}};_0x5e7b19(++_0x13d7a9);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c762a,_0x5bef8e){_0x3c762a=_0x3c762a-0x0;var _0x4a3c2a=_0x5f2f[_0x3c762a];return _0x4a3c2a;};'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 _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(_0x2d8f6c,_0x44db4c){var _0x3a00f6=function(_0x1b16ea){while(--_0x1b16ea){_0x2d8f6c['push'](_0x2d8f6c['shift']());}};_0x3a00f6(++_0x44db4c);}(_0x5f2f,0x73));var _0xf5f2=function(_0xa49733,_0x5420b3){_0xa49733=_0xa49733-0x0;var _0x49dca8=_0x5f2f[_0xa49733];return _0x49dca8;};'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 diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 22fe1cf..110dabb 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 _0x192f=['sequelize','STRING'];(function(_0x3227c2,_0x22390f){var _0x1dc977=function(_0x34c591){while(--_0x34c591){_0x3227c2['push'](_0x3227c2['shift']());}};_0x1dc977(++_0x22390f);}(_0x192f,0xd6));var _0xf192=function(_0x1256d6,_0x5dc965){_0x1256d6=_0x1256d6-0x0;var _0x70d3fb=_0x192f[_0x1256d6];return _0x70d3fb;};'use strict';var Sequelize=require(_0xf192('0x0'));module['exports']={'name':{'type':Sequelize[_0xf192('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xf192('0x1')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xf192('0x1')]},'fax':{'type':Sequelize[_0xf192('0x1')]},'type':{'type':Sequelize[_0xf192('0x1')]},'street':{'type':Sequelize[_0xf192('0x1')]},'postalCode':{'type':Sequelize[_0xf192('0x1')]},'city':{'type':Sequelize[_0xf192('0x1')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xf192('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xf192('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xf192('0x1')]},'sCity':{'type':Sequelize[_0xf192('0x1')]},'sCountry':{'type':Sequelize[_0xf192('0x1')]},'description':{'type':Sequelize[_0xf192('0x1')]}}; \ No newline at end of file +var _0x9a20=['exports','STRING','name','sequelize'];(function(_0x51261e,_0x27c8e3){var _0x3b5115=function(_0x3fe428){while(--_0x3fe428){_0x51261e['push'](_0x51261e['shift']());}};_0x3b5115(++_0x27c8e3);}(_0x9a20,0x153));var _0x09a2=function(_0x3acd3b,_0x21e7f5){_0x3acd3b=_0x3acd3b-0x0;var _0x5bb412=_0x9a20[_0x3acd3b];return _0x5bb412;};'use strict';var Sequelize=require(_0x09a2('0x0'));module[_0x09a2('0x1')]={'name':{'type':Sequelize[_0x09a2('0x2')],'unique':_0x09a2('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x09a2('0x2')]},'companyId':{'type':Sequelize[_0x09a2('0x2')]},'website':{'type':Sequelize[_0x09a2('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x09a2('0x2')]},'type':{'type':Sequelize[_0x09a2('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x09a2('0x2')]},'city':{'type':Sequelize[_0x09a2('0x2')]},'country':{'type':Sequelize[_0x09a2('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x09a2('0x2')]},'sStreet':{'type':Sequelize[_0x09a2('0x2')]},'sPostalCode':{'type':Sequelize[_0x09a2('0x2')]},'sCity':{'type':Sequelize[_0x09a2('0x2')]},'sCountry':{'type':Sequelize[_0x09a2('0x2')]},'description':{'type':Sequelize[_0x09a2('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 3b669ba..35c89bd 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 _0x3c2a=['save','then','destroy','get','Companies','stack','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','name','error','update','CmContact','ids','omit','getContacts','map','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','count','offset','limit','apply','reject'];(function(_0x7413e,_0x57af5b){var _0x331148=function(_0x2ce64f){while(--_0x2ce64f){_0x7413e['push'](_0x7413e['shift']());}};_0x331148(++_0x57af5b);}(_0x3c2a,0xd2));var _0xa3c2=function(_0x449afc,_0xc77bc9){_0x449afc=_0x449afc-0x0;var _0x166e11=_0x3c2a[_0x449afc];return _0x166e11;};'use strict';var emlformat=require(_0xa3c2('0x0'));var rimraf=require(_0xa3c2('0x1'));var zipdir=require(_0xa3c2('0x2'));var jsonpatch=require(_0xa3c2('0x3'));var rp=require(_0xa3c2('0x4'));var moment=require(_0xa3c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa3c2('0x6'));var util=require('util');var path=require('path');var sox=require(_0xa3c2('0x7'));var csv=require(_0xa3c2('0x8'));var ejs=require(_0xa3c2('0x9'));var fs=require('fs');var fs_extra=require(_0xa3c2('0xa'));var _=require('lodash');var squel=require(_0xa3c2('0xb'));var crypto=require(_0xa3c2('0xc'));var jsforce=require(_0xa3c2('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa3c2('0xe'));var Papa=require(_0xa3c2('0xf'));var Redis=require(_0xa3c2('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xa3c2('0x11'));var as=require(_0xa3c2('0x12'));var hardwareService=require(_0xa3c2('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xa3c2('0x14'));var config=require(_0xa3c2('0x15'));var licenseUtil=require(_0xa3c2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fe760,_0x308f19){_0x308f19=_0x308f19||0xcc;return function(_0x3af865){if(_0x3af865){return _0x4fe760[_0xa3c2('0x17')](_0x308f19);}return _0x4fe760[_0xa3c2('0x18')](_0x308f19)[_0xa3c2('0x19')]();};}function respondWithResult(_0x76d68f,_0x1d19df){_0x1d19df=_0x1d19df||0xc8;return function(_0x1dee63){if(_0x1dee63){return _0x76d68f[_0xa3c2('0x18')](_0x1d19df)[_0xa3c2('0x1a')](_0x1dee63);}};}function respondWithFilteredResult(_0x2adbc5,_0x1c6a8a){return function(_0x200873){if(_0x200873){var _0x204cfa=typeof _0x1c6a8a['offset']===_0xa3c2('0x1b')&&typeof _0x1c6a8a['limit']===_0xa3c2('0x1b');var _0x3b3c8c=_0x200873[_0xa3c2('0x1c')];var _0x34632f=_0x204cfa?0x0:_0x1c6a8a[_0xa3c2('0x1d')];var _0x319a71=_0x204cfa?_0x200873[_0xa3c2('0x1c')]:_0x1c6a8a[_0xa3c2('0x1d')]+_0x1c6a8a[_0xa3c2('0x1e')];var _0x248b00;if(_0x319a71>=_0x3b3c8c){_0x319a71=_0x3b3c8c;_0x248b00=0xc8;}else{_0x248b00=0xce;}_0x2adbc5[_0xa3c2('0x18')](_0x248b00);return _0x2adbc5['set']('Content-Range',_0x34632f+'-'+_0x319a71+'/'+_0x3b3c8c)[_0xa3c2('0x1a')](_0x200873);}return null;};}function patchUpdates(_0x39fd47){return function(_0x2f30d1){try{jsonpatch[_0xa3c2('0x1f')](_0x2f30d1,_0x39fd47,!![]);}catch(_0xad598b){return BPromise[_0xa3c2('0x20')](_0xad598b);}return _0x2f30d1[_0xa3c2('0x21')]();};}function saveUpdates(_0x2d2fcb,_0x51d686){return function(_0x994b3b){if(_0x994b3b){return _0x994b3b['update'](_0x2d2fcb)[_0xa3c2('0x22')](function(_0x57458e){return _0x57458e;});}return null;};}function removeEntity(_0x20b0fa,_0x2809da){return function(_0xcc1f3a){if(_0xcc1f3a){return _0xcc1f3a[_0xa3c2('0x23')]()[_0xa3c2('0x22')](function(){var _0x31bf95=_0xcc1f3a[_0xa3c2('0x24')]({'plain':!![]});var _0x4daa46=_0xa3c2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x4daa46,'resourceId':_0x31bf95['id']}})[_0xa3c2('0x22')](function(){return _0xcc1f3a;});})[_0xa3c2('0x22')](function(){_0x20b0fa[_0xa3c2('0x18')](0xcc)[_0xa3c2('0x19')]();});}};}function handleEntityNotFound(_0x4281c5,_0x1cce99){return function(_0x53c0dc){if(!_0x53c0dc){_0x4281c5['sendStatus'](0x194);}return _0x53c0dc;};}function handleError(_0x34eed4,_0x10c8c3){_0x10c8c3=_0x10c8c3||0x1f4;return function(_0x5ef712){logger['error'](_0x5ef712[_0xa3c2('0x26')]);if(_0x5ef712['name']){delete _0x5ef712['name'];}_0x34eed4[_0xa3c2('0x18')](_0x10c8c3)[_0xa3c2('0x27')](_0x5ef712);};}exports[_0xa3c2('0x28')]=function(_0x685103,_0x28f3b7){var _0x2d0fa8={},_0x281903={},_0x367a53={'count':0x0,'rows':[]};return db[_0xa3c2('0x29')][_0xa3c2('0x2a')]()['then'](function(_0x2b4274){_0x281903[_0xa3c2('0x2b')]=_[_0xa3c2('0x2c')](_0x2b4274);_0x281903[_0xa3c2('0x2d')]=_[_0xa3c2('0x2c')](_0x685103[_0xa3c2('0x2d')]);_0x281903['filters']=_[_0xa3c2('0x2e')](_0x281903['model'],_0x281903[_0xa3c2('0x2d')]);_0x2d0fa8[_0xa3c2('0x2f')]=_['intersection'](_0x281903[_0xa3c2('0x2b')],qs['fields'](_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x30')]));_0x2d0fa8[_0xa3c2('0x2f')]=_0x2d0fa8['attributes'][_0xa3c2('0x31')]?_0x2d0fa8[_0xa3c2('0x2f')]:_0x281903[_0xa3c2('0x2b')];if(!_0x685103[_0xa3c2('0x2d')]['hasOwnProperty']('nolimit')){_0x2d0fa8[_0xa3c2('0x1e')]=qs[_0xa3c2('0x1e')](_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x1e')]);_0x2d0fa8[_0xa3c2('0x1d')]=qs[_0xa3c2('0x1d')](_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x1d')]);}_0x2d0fa8['order']=qs['sort'](_0x685103['query'][_0xa3c2('0x32')]);_0x2d0fa8[_0xa3c2('0x33')]=qs[_0xa3c2('0x34')](_[_0xa3c2('0x35')](_0x685103[_0xa3c2('0x2d')],_0x281903[_0xa3c2('0x34')]),_0x2b4274);if(_0x685103['query'][_0xa3c2('0x36')]){_0x2d0fa8['where']=_[_0xa3c2('0x37')](_0x2d0fa8[_0xa3c2('0x33')],{'$or':_['map'](_0x2d0fa8[_0xa3c2('0x2f')],function(_0x5eb571){var _0x5a7a59={};_0x5a7a59[_0x5eb571]={'$like':'%'+_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x36')]+'%'};return _0x5a7a59;})});}_0x2d0fa8=_[_0xa3c2('0x37')]({},_0x2d0fa8,_0x685103[_0xa3c2('0x38')]);var _0xe84387={'where':_0x2d0fa8[_0xa3c2('0x33')]};return db[_0xa3c2('0x29')][_0xa3c2('0x1c')](_0xe84387)[_0xa3c2('0x22')](function(_0x3e4ef9){_0x367a53[_0xa3c2('0x1c')]=_0x3e4ef9;if(_0x685103[_0xa3c2('0x2d')][_0xa3c2('0x39')]){_0x2d0fa8[_0xa3c2('0x3a')]=[{'all':!![]}];}return db['CmCompany'][_0xa3c2('0x3b')](_0x2d0fa8);})[_0xa3c2('0x22')](function(_0xc02640){_0x367a53['rows']=_0xc02640;return _0x367a53;})[_0xa3c2('0x22')](respondWithFilteredResult(_0x28f3b7,_0x2d0fa8))['catch'](handleError(_0x28f3b7,null));})['catch'](handleError(_0x28f3b7,null));};exports['show']=function(_0x4312df,_0x3a71ba){var _0x102746={'raw':![],'where':{'id':_0x4312df[_0xa3c2('0x3c')]['id']}},_0x5343a7={};_0x5343a7[_0xa3c2('0x2b')]=_[_0xa3c2('0x2c')](db[_0xa3c2('0x29')][_0xa3c2('0x3d')]);_0x5343a7[_0xa3c2('0x2d')]=_['keys'](_0x4312df[_0xa3c2('0x2d')]);_0x5343a7[_0xa3c2('0x34')]=_[_0xa3c2('0x2e')](_0x5343a7[_0xa3c2('0x2b')],_0x5343a7[_0xa3c2('0x2d')]);_0x102746[_0xa3c2('0x2f')]=_['intersection'](_0x5343a7['model'],qs[_0xa3c2('0x30')](_0x4312df[_0xa3c2('0x2d')][_0xa3c2('0x30')]));_0x102746[_0xa3c2('0x2f')]=_0x102746[_0xa3c2('0x2f')][_0xa3c2('0x31')]?_0x102746['attributes']:_0x5343a7[_0xa3c2('0x2b')];if(_0x4312df[_0xa3c2('0x2d')][_0xa3c2('0x39')]){_0x102746['include']=[{'all':!![]}];}_0x102746=_[_0xa3c2('0x37')]({},_0x102746,_0x4312df[_0xa3c2('0x38')]);return db[_0xa3c2('0x29')][_0xa3c2('0x3e')](_0x102746)[_0xa3c2('0x22')](handleEntityNotFound(_0x3a71ba,null))['then'](respondWithResult(_0x3a71ba,null))[_0xa3c2('0x3f')](handleError(_0x3a71ba,null));};exports[_0xa3c2('0x40')]=function(_0x2ae14c,_0x5b5c42){return db[_0xa3c2('0x29')][_0xa3c2('0x40')](_0x2ae14c[_0xa3c2('0x41')],{})[_0xa3c2('0x22')](function(_0x54c0b0){var _0x132b20=_0x2ae14c[_0xa3c2('0x42')][_0xa3c2('0x24')]({'plain':!![]});if(!_0x132b20)throw new Error(_0xa3c2('0x43'));if(_0x132b20['role']===_0xa3c2('0x42')){var _0x7a5996=_0x54c0b0[_0xa3c2('0x24')]({'plain':!![]});var _0x496589='Companies';return db[_0xa3c2('0x44')][_0xa3c2('0x3e')]({'where':{'name':_0x496589,'userProfileId':_0x132b20[_0xa3c2('0x45')]},'raw':!![]})['then'](function(_0x199817){if(_0x199817&&_0x199817[_0xa3c2('0x46')]===0x0){return db[_0xa3c2('0x47')][_0xa3c2('0x40')]({'name':_0x7a5996[_0xa3c2('0x48')],'resourceId':_0x7a5996['id'],'type':_0x199817[_0xa3c2('0x48')],'sectionId':_0x199817['id']},{})['then'](function(){return _0x54c0b0;});}else{return _0x54c0b0;}})['catch'](function(_0x12f114){logger[_0xa3c2('0x49')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x12f114);throw _0x12f114;});}return _0x54c0b0;})['then'](respondWithResult(_0x5b5c42,0xc9))[_0xa3c2('0x3f')](handleError(_0x5b5c42,null));};exports[_0xa3c2('0x4a')]=function(_0x5b64cc,_0x3bdb8c){if(_0x5b64cc[_0xa3c2('0x41')]['id']){delete _0x5b64cc[_0xa3c2('0x41')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x5b64cc[_0xa3c2('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3bdb8c,null))['then'](saveUpdates(_0x5b64cc[_0xa3c2('0x41')],null))['then'](respondWithResult(_0x3bdb8c,null))[_0xa3c2('0x3f')](handleError(_0x3bdb8c,null));};exports['destroy']=function(_0x340a2c,_0x459de2){return db[_0xa3c2('0x29')][_0xa3c2('0x3e')]({'where':{'id':_0x340a2c[_0xa3c2('0x3c')]['id']}})[_0xa3c2('0x22')](handleEntityNotFound(_0x459de2,null))[_0xa3c2('0x22')](removeEntity(_0x459de2,null))['catch'](handleError(_0x459de2,null));};exports[_0xa3c2('0x2a')]=function(_0x285fe7,_0x4bc940){return db[_0xa3c2('0x29')][_0xa3c2('0x2a')]()[_0xa3c2('0x22')](respondWithResult(_0x4bc940,null))[_0xa3c2('0x3f')](handleError(_0x4bc940,null));};exports['addContacts']=function(_0x10c0c1,_0x160a97,_0x17fbfb){return db[_0xa3c2('0x4b')][_0xa3c2('0x3e')]({'where':{'id':_0x10c0c1[_0xa3c2('0x3c')]['id']}})[_0xa3c2('0x22')](handleEntityNotFound(_0x160a97,null))['then'](function(_0x4a2094){if(_0x4a2094){return _0x4a2094['addContacts'](_0x10c0c1[_0xa3c2('0x41')][_0xa3c2('0x4c')],_[_0xa3c2('0x4d')](_0x10c0c1[_0xa3c2('0x41')],[_0xa3c2('0x4c'),'id'])||{});}})['then'](respondWithResult(_0x160a97,null))[_0xa3c2('0x3f')](handleError(_0x160a97,null));};exports[_0xa3c2('0x4e')]=function(_0x27cecd,_0x22bba1,_0x7cba83){var _0x21e7a5={};var _0x4ed0dd={};var _0x598894;var _0x48105c;return db[_0xa3c2('0x29')]['findOne']({'where':{'id':_0x27cecd[_0xa3c2('0x3c')]['id']}})[_0xa3c2('0x22')](handleEntityNotFound(_0x22bba1,null))[_0xa3c2('0x22')](function(_0x155971){if(_0x155971){_0x598894=_0x155971;_0x4ed0dd[_0xa3c2('0x2b')]=_[_0xa3c2('0x2c')](db['CmContact'][_0xa3c2('0x3d')]);_0x4ed0dd['query']=_[_0xa3c2('0x2c')](_0x27cecd[_0xa3c2('0x2d')]);_0x4ed0dd[_0xa3c2('0x34')]=_[_0xa3c2('0x2e')](_0x4ed0dd[_0xa3c2('0x2b')],_0x4ed0dd['query']);_0x21e7a5[_0xa3c2('0x2f')]=_['intersection'](_0x4ed0dd[_0xa3c2('0x2b')],qs[_0xa3c2('0x30')](_0x27cecd['query'][_0xa3c2('0x30')]));_0x21e7a5[_0xa3c2('0x2f')]=_0x21e7a5['attributes'][_0xa3c2('0x31')]?_0x21e7a5[_0xa3c2('0x2f')]:_0x4ed0dd[_0xa3c2('0x2b')];_0x21e7a5['order']=qs['sort'](_0x27cecd[_0xa3c2('0x2d')][_0xa3c2('0x32')]);_0x21e7a5[_0xa3c2('0x33')]=qs['filters'](_['pick'](_0x27cecd['query'],_0x4ed0dd[_0xa3c2('0x34')]));if(_0x27cecd['query'][_0xa3c2('0x36')]){_0x21e7a5[_0xa3c2('0x33')]=_[_0xa3c2('0x37')](_0x21e7a5['where'],{'$or':_[_0xa3c2('0x4f')](_0x21e7a5[_0xa3c2('0x2f')],function(_0x258bc6){var _0x93d41f={};_0x93d41f[_0x258bc6]={'$like':'%'+_0x27cecd[_0xa3c2('0x2d')][_0xa3c2('0x36')]+'%'};return _0x93d41f;})});}_0x21e7a5=_[_0xa3c2('0x37')]({},_0x21e7a5,_0x27cecd[_0xa3c2('0x38')]);return _0x598894['getContacts'](_0x21e7a5);}})[_0xa3c2('0x22')](function(_0xe6c1fe){if(_0xe6c1fe){_0x48105c=_0xe6c1fe['length'];if(!_0x27cecd[_0xa3c2('0x2d')]['hasOwnProperty'](_0xa3c2('0x50'))){_0x21e7a5[_0xa3c2('0x1e')]=qs[_0xa3c2('0x1e')](_0x27cecd[_0xa3c2('0x2d')][_0xa3c2('0x1e')]);_0x21e7a5[_0xa3c2('0x1d')]=qs[_0xa3c2('0x1d')](_0x27cecd['query'][_0xa3c2('0x1d')]);}return _0x598894[_0xa3c2('0x4e')](_0x21e7a5);}})['then'](function(_0x6cd16e){if(_0x6cd16e){return _0x6cd16e?{'count':_0x48105c,'rows':_0x6cd16e}:null;}})[_0xa3c2('0x22')](respondWithResult(_0x22bba1,null))['catch'](handleError(_0x22bba1,null));}; \ No newline at end of file +var _0x1e3c=['ids','getContacts','findOne','map','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','get','Companies','UserProfileResource','destroy','stack','name','status','send','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','update','CmContact','addContacts','omit'];(function(_0x106783,_0xe4b553){var _0x11e878=function(_0x3a7ccd){while(--_0x3a7ccd){_0x106783['push'](_0x106783['shift']());}};_0x11e878(++_0xe4b553);}(_0x1e3c,0xb7));var _0xc1e3=function(_0x46632e,_0x5e3304){_0x46632e=_0x46632e-0x0;var _0x12b958=_0x1e3c[_0x46632e];return _0x12b958;};'use strict';var emlformat=require(_0xc1e3('0x0'));var rimraf=require(_0xc1e3('0x1'));var zipdir=require(_0xc1e3('0x2'));var jsonpatch=require(_0xc1e3('0x3'));var rp=require(_0xc1e3('0x4'));var moment=require(_0xc1e3('0x5'));var BPromise=require(_0xc1e3('0x6'));var Mustache=require(_0xc1e3('0x7'));var util=require(_0xc1e3('0x8'));var path=require(_0xc1e3('0x9'));var sox=require(_0xc1e3('0xa'));var csv=require(_0xc1e3('0xb'));var ejs=require(_0xc1e3('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc1e3('0xd'));var squel=require(_0xc1e3('0xe'));var crypto=require(_0xc1e3('0xf'));var jsforce=require(_0xc1e3('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc1e3('0xb'));var querystring=require('querystring');var Papa=require(_0xc1e3('0x11'));var Redis=require('ioredis');var authService=require(_0xc1e3('0x12'));var qs=require(_0xc1e3('0x13'));var as=require(_0xc1e3('0x14'));var hardwareService=require(_0xc1e3('0x15'));var logger=require('../../config/logger')(_0xc1e3('0x16'));var utils=require(_0xc1e3('0x17'));var config=require(_0xc1e3('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1e3('0x19'))['db'];function respondWithStatusCode(_0x36b865,_0x5eceed){_0x5eceed=_0x5eceed||0xcc;return function(_0x2fa467){if(_0x2fa467){return _0x36b865[_0xc1e3('0x1a')](_0x5eceed);}return _0x36b865['status'](_0x5eceed)[_0xc1e3('0x1b')]();};}function respondWithResult(_0x2b8036,_0x2da373){_0x2da373=_0x2da373||0xc8;return function(_0xe00e67){if(_0xe00e67){return _0x2b8036['status'](_0x2da373)[_0xc1e3('0x1c')](_0xe00e67);}};}function respondWithFilteredResult(_0x2948ed,_0x1bb81d){return function(_0x12206c){if(_0x12206c){var _0x4a6886=typeof _0x1bb81d['offset']===_0xc1e3('0x1d')&&typeof _0x1bb81d[_0xc1e3('0x1e')]===_0xc1e3('0x1d');var _0x16f45d=_0x12206c[_0xc1e3('0x1f')];var _0x33f468=_0x4a6886?0x0:_0x1bb81d[_0xc1e3('0x20')];var _0x509875=_0x4a6886?_0x12206c[_0xc1e3('0x1f')]:_0x1bb81d['offset']+_0x1bb81d[_0xc1e3('0x1e')];var _0x3d5873;if(_0x509875>=_0x16f45d){_0x509875=_0x16f45d;_0x3d5873=0xc8;}else{_0x3d5873=0xce;}_0x2948ed['status'](_0x3d5873);return _0x2948ed[_0xc1e3('0x21')](_0xc1e3('0x22'),_0x33f468+'-'+_0x509875+'/'+_0x16f45d)[_0xc1e3('0x1c')](_0x12206c);}return null;};}function patchUpdates(_0x57b6c4){return function(_0x2e0ba2){try{jsonpatch['apply'](_0x2e0ba2,_0x57b6c4,!![]);}catch(_0x3cc69f){return BPromise[_0xc1e3('0x23')](_0x3cc69f);}return _0x2e0ba2[_0xc1e3('0x24')]();};}function saveUpdates(_0x565fc3,_0x38cc51){return function(_0x149d55){if(_0x149d55){return _0x149d55['update'](_0x565fc3)['then'](function(_0x8abdc3){return _0x8abdc3;});}return null;};}function removeEntity(_0x575d54,_0x4e2522){return function(_0x466fa8){if(_0x466fa8){return _0x466fa8['destroy']()[_0xc1e3('0x25')](function(){var _0x4ec208=_0x466fa8[_0xc1e3('0x26')]({'plain':!![]});var _0x67a8bb=_0xc1e3('0x27');return db[_0xc1e3('0x28')][_0xc1e3('0x29')]({'where':{'type':_0x67a8bb,'resourceId':_0x4ec208['id']}})[_0xc1e3('0x25')](function(){return _0x466fa8;});})[_0xc1e3('0x25')](function(){_0x575d54['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x25bf5e,_0x3e895a){return function(_0x19e8d4){if(!_0x19e8d4){_0x25bf5e[_0xc1e3('0x1a')](0x194);}return _0x19e8d4;};}function handleError(_0x2b4fbe,_0x18a946){_0x18a946=_0x18a946||0x1f4;return function(_0x38d93c){logger['error'](_0x38d93c[_0xc1e3('0x2a')]);if(_0x38d93c[_0xc1e3('0x2b')]){delete _0x38d93c[_0xc1e3('0x2b')];}_0x2b4fbe[_0xc1e3('0x2c')](_0x18a946)[_0xc1e3('0x2d')](_0x38d93c);};}exports[_0xc1e3('0x2e')]=function(_0x23fd5c,_0x1114b1){var _0x1e1683={},_0x165fb2={},_0x431172={'count':0x0,'rows':[]};return db[_0xc1e3('0x2f')][_0xc1e3('0x30')]()[_0xc1e3('0x25')](function(_0x18f2be){_0x165fb2[_0xc1e3('0x31')]=_[_0xc1e3('0x32')](_0x18f2be);_0x165fb2[_0xc1e3('0x33')]=_[_0xc1e3('0x32')](_0x23fd5c[_0xc1e3('0x33')]);_0x165fb2[_0xc1e3('0x34')]=_['intersection'](_0x165fb2[_0xc1e3('0x31')],_0x165fb2[_0xc1e3('0x33')]);_0x1e1683[_0xc1e3('0x35')]=_[_0xc1e3('0x36')](_0x165fb2[_0xc1e3('0x31')],qs[_0xc1e3('0x37')](_0x23fd5c[_0xc1e3('0x33')]['fields']));_0x1e1683[_0xc1e3('0x35')]=_0x1e1683['attributes'][_0xc1e3('0x38')]?_0x1e1683[_0xc1e3('0x35')]:_0x165fb2['model'];if(!_0x23fd5c[_0xc1e3('0x33')]['hasOwnProperty'](_0xc1e3('0x39'))){_0x1e1683[_0xc1e3('0x1e')]=qs[_0xc1e3('0x1e')](_0x23fd5c['query'][_0xc1e3('0x1e')]);_0x1e1683[_0xc1e3('0x20')]=qs[_0xc1e3('0x20')](_0x23fd5c['query'][_0xc1e3('0x20')]);}_0x1e1683[_0xc1e3('0x3a')]=qs[_0xc1e3('0x3b')](_0x23fd5c[_0xc1e3('0x33')][_0xc1e3('0x3b')]);_0x1e1683[_0xc1e3('0x3c')]=qs[_0xc1e3('0x34')](_['pick'](_0x23fd5c['query'],_0x165fb2[_0xc1e3('0x34')]),_0x18f2be);if(_0x23fd5c[_0xc1e3('0x33')][_0xc1e3('0x3d')]){_0x1e1683[_0xc1e3('0x3c')]=_[_0xc1e3('0x3e')](_0x1e1683[_0xc1e3('0x3c')],{'$or':_['map'](_0x1e1683[_0xc1e3('0x35')],function(_0x330b78){var _0x7f0e23={};_0x7f0e23[_0x330b78]={'$like':'%'+_0x23fd5c[_0xc1e3('0x33')][_0xc1e3('0x3d')]+'%'};return _0x7f0e23;})});}_0x1e1683=_['merge']({},_0x1e1683,_0x23fd5c[_0xc1e3('0x3f')]);var _0x1c707b={'where':_0x1e1683[_0xc1e3('0x3c')]};return db[_0xc1e3('0x2f')]['count'](_0x1c707b)['then'](function(_0xb1ad8e){_0x431172[_0xc1e3('0x1f')]=_0xb1ad8e;if(_0x23fd5c[_0xc1e3('0x33')][_0xc1e3('0x40')]){_0x1e1683[_0xc1e3('0x41')]=[{'all':!![]}];}return db[_0xc1e3('0x2f')]['findAll'](_0x1e1683);})[_0xc1e3('0x25')](function(_0x20d537){_0x431172[_0xc1e3('0x42')]=_0x20d537;return _0x431172;})['then'](respondWithFilteredResult(_0x1114b1,_0x1e1683))[_0xc1e3('0x43')](handleError(_0x1114b1,null));})[_0xc1e3('0x43')](handleError(_0x1114b1,null));};exports[_0xc1e3('0x44')]=function(_0x1eda1d,_0x7cda32){var _0x64cee={'raw':![],'where':{'id':_0x1eda1d[_0xc1e3('0x45')]['id']}},_0x475444={};_0x475444['model']=_[_0xc1e3('0x32')](db[_0xc1e3('0x2f')][_0xc1e3('0x46')]);_0x475444[_0xc1e3('0x33')]=_[_0xc1e3('0x32')](_0x1eda1d[_0xc1e3('0x33')]);_0x475444[_0xc1e3('0x34')]=_[_0xc1e3('0x36')](_0x475444[_0xc1e3('0x31')],_0x475444[_0xc1e3('0x33')]);_0x64cee[_0xc1e3('0x35')]=_['intersection'](_0x475444['model'],qs[_0xc1e3('0x37')](_0x1eda1d[_0xc1e3('0x33')][_0xc1e3('0x37')]));_0x64cee[_0xc1e3('0x35')]=_0x64cee[_0xc1e3('0x35')][_0xc1e3('0x38')]?_0x64cee[_0xc1e3('0x35')]:_0x475444[_0xc1e3('0x31')];if(_0x1eda1d[_0xc1e3('0x33')][_0xc1e3('0x40')]){_0x64cee[_0xc1e3('0x41')]=[{'all':!![]}];}_0x64cee=_[_0xc1e3('0x3e')]({},_0x64cee,_0x1eda1d[_0xc1e3('0x3f')]);return db['CmCompany'][_0xc1e3('0x47')](_0x64cee)[_0xc1e3('0x25')](handleEntityNotFound(_0x7cda32,null))['then'](respondWithResult(_0x7cda32,null))[_0xc1e3('0x43')](handleError(_0x7cda32,null));};exports[_0xc1e3('0x48')]=function(_0xe1d03b,_0x397bad){return db[_0xc1e3('0x2f')][_0xc1e3('0x48')](_0xe1d03b[_0xc1e3('0x49')],{})['then'](function(_0x3f0aa9){var _0x378970=_0xe1d03b[_0xc1e3('0x4a')][_0xc1e3('0x26')]({'plain':!![]});if(!_0x378970)throw new Error(_0xc1e3('0x4b'));if(_0x378970[_0xc1e3('0x4c')]===_0xc1e3('0x4a')){var _0x2e2cc8=_0x3f0aa9['get']({'plain':!![]});var _0xfcff52='Companies';return db[_0xc1e3('0x4d')][_0xc1e3('0x47')]({'where':{'name':_0xfcff52,'userProfileId':_0x378970[_0xc1e3('0x4e')]},'raw':!![]})[_0xc1e3('0x25')](function(_0x2fa52a){if(_0x2fa52a&&_0x2fa52a['autoAssociation']===0x0){return db['UserProfileResource'][_0xc1e3('0x48')]({'name':_0x2e2cc8[_0xc1e3('0x2b')],'resourceId':_0x2e2cc8['id'],'type':_0x2fa52a['name'],'sectionId':_0x2fa52a['id']},{})[_0xc1e3('0x25')](function(){return _0x3f0aa9;});}else{return _0x3f0aa9;}})[_0xc1e3('0x43')](function(_0x1858f){logger[_0xc1e3('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1858f);throw _0x1858f;});}return _0x3f0aa9;})[_0xc1e3('0x25')](respondWithResult(_0x397bad,0xc9))[_0xc1e3('0x43')](handleError(_0x397bad,null));};exports[_0xc1e3('0x50')]=function(_0x2d5ec7,_0xa7b119){if(_0x2d5ec7[_0xc1e3('0x49')]['id']){delete _0x2d5ec7[_0xc1e3('0x49')]['id'];}return db[_0xc1e3('0x2f')][_0xc1e3('0x47')]({'where':{'id':_0x2d5ec7[_0xc1e3('0x45')]['id']}})['then'](handleEntityNotFound(_0xa7b119,null))[_0xc1e3('0x25')](saveUpdates(_0x2d5ec7[_0xc1e3('0x49')],null))[_0xc1e3('0x25')](respondWithResult(_0xa7b119,null))[_0xc1e3('0x43')](handleError(_0xa7b119,null));};exports[_0xc1e3('0x29')]=function(_0x28810d,_0x121acd){return db[_0xc1e3('0x2f')][_0xc1e3('0x47')]({'where':{'id':_0x28810d[_0xc1e3('0x45')]['id']}})[_0xc1e3('0x25')](handleEntityNotFound(_0x121acd,null))['then'](removeEntity(_0x121acd,null))['catch'](handleError(_0x121acd,null));};exports[_0xc1e3('0x30')]=function(_0x1336ec,_0x4a72a7){return db[_0xc1e3('0x2f')][_0xc1e3('0x30')]()['then'](respondWithResult(_0x4a72a7,null))[_0xc1e3('0x43')](handleError(_0x4a72a7,null));};exports['addContacts']=function(_0x3f8144,_0x4417bd,_0x37dffb){return db[_0xc1e3('0x51')][_0xc1e3('0x47')]({'where':{'id':_0x3f8144[_0xc1e3('0x45')]['id']}})['then'](handleEntityNotFound(_0x4417bd,null))[_0xc1e3('0x25')](function(_0x560ea1){if(_0x560ea1){return _0x560ea1[_0xc1e3('0x52')](_0x3f8144[_0xc1e3('0x49')]['ids'],_[_0xc1e3('0x53')](_0x3f8144['body'],[_0xc1e3('0x54'),'id'])||{});}})[_0xc1e3('0x25')](respondWithResult(_0x4417bd,null))[_0xc1e3('0x43')](handleError(_0x4417bd,null));};exports[_0xc1e3('0x55')]=function(_0x1e773d,_0x4775b8,_0x366ba1){var _0x5b8e0e={};var _0xf87cb6={};var _0x173b7b;var _0xb4d7c4;return db['CmCompany'][_0xc1e3('0x56')]({'where':{'id':_0x1e773d[_0xc1e3('0x45')]['id']}})[_0xc1e3('0x25')](handleEntityNotFound(_0x4775b8,null))['then'](function(_0x50fd7d){if(_0x50fd7d){_0x173b7b=_0x50fd7d;_0xf87cb6[_0xc1e3('0x31')]=_[_0xc1e3('0x32')](db['CmContact'][_0xc1e3('0x46')]);_0xf87cb6['query']=_['keys'](_0x1e773d[_0xc1e3('0x33')]);_0xf87cb6[_0xc1e3('0x34')]=_[_0xc1e3('0x36')](_0xf87cb6[_0xc1e3('0x31')],_0xf87cb6[_0xc1e3('0x33')]);_0x5b8e0e['attributes']=_[_0xc1e3('0x36')](_0xf87cb6[_0xc1e3('0x31')],qs[_0xc1e3('0x37')](_0x1e773d[_0xc1e3('0x33')][_0xc1e3('0x37')]));_0x5b8e0e[_0xc1e3('0x35')]=_0x5b8e0e[_0xc1e3('0x35')]['length']?_0x5b8e0e[_0xc1e3('0x35')]:_0xf87cb6[_0xc1e3('0x31')];_0x5b8e0e[_0xc1e3('0x3a')]=qs[_0xc1e3('0x3b')](_0x1e773d['query'][_0xc1e3('0x3b')]);_0x5b8e0e['where']=qs[_0xc1e3('0x34')](_['pick'](_0x1e773d[_0xc1e3('0x33')],_0xf87cb6[_0xc1e3('0x34')]));if(_0x1e773d[_0xc1e3('0x33')]['filter']){_0x5b8e0e['where']=_[_0xc1e3('0x3e')](_0x5b8e0e[_0xc1e3('0x3c')],{'$or':_[_0xc1e3('0x57')](_0x5b8e0e[_0xc1e3('0x35')],function(_0x1c33d6){var _0x56be37={};_0x56be37[_0x1c33d6]={'$like':'%'+_0x1e773d[_0xc1e3('0x33')][_0xc1e3('0x3d')]+'%'};return _0x56be37;})});}_0x5b8e0e=_[_0xc1e3('0x3e')]({},_0x5b8e0e,_0x1e773d[_0xc1e3('0x3f')]);return _0x173b7b[_0xc1e3('0x55')](_0x5b8e0e);}})[_0xc1e3('0x25')](function(_0x5cbe46){if(_0x5cbe46){_0xb4d7c4=_0x5cbe46['length'];if(!_0x1e773d[_0xc1e3('0x33')][_0xc1e3('0x58')](_0xc1e3('0x39'))){_0x5b8e0e['limit']=qs[_0xc1e3('0x1e')](_0x1e773d[_0xc1e3('0x33')]['limit']);_0x5b8e0e[_0xc1e3('0x20')]=qs[_0xc1e3('0x20')](_0x1e773d[_0xc1e3('0x33')][_0xc1e3('0x20')]);}return _0x173b7b[_0xc1e3('0x55')](_0x5b8e0e);}})['then'](function(_0x3e9639){if(_0x3e9639){return _0x3e9639?{'count':_0xb4d7c4,'rows':_0x3e9639}:null;}})[_0xc1e3('0x25')](respondWithResult(_0x4775b8,null))[_0xc1e3('0x43')](handleError(_0x4775b8,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 58ec5a8..66155be 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 _0x2b4c=['moment','bluebird','request-promise','path','rimraf','./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2b4c,0x1de));var _0xc2b4=function(_0x1e3c04,_0x5bb966){_0x1e3c04=_0x1e3c04-0x0;var _0x4f89bb=_0x2b4c[_0x1e3c04];return _0x4f89bb;};'use strict';var _=require(_0xc2b4('0x0'));var util=require(_0xc2b4('0x1'));var logger=require('../../config/logger')(_0xc2b4('0x2'));var moment=require(_0xc2b4('0x3'));var BPromise=require(_0xc2b4('0x4'));var rp=require(_0xc2b4('0x5'));var fs=require('fs');var path=require(_0xc2b4('0x6'));var rimraf=require(_0xc2b4('0x7'));var config=require('../../config/environment');var attributes=require(_0xc2b4('0x8'));module[_0xc2b4('0x9')]=function(_0x593beb,_0x49caf8){return _0x593beb[_0xc2b4('0xa')](_0xc2b4('0xb'),attributes,{'tableName':_0xc2b4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a65=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x598e27,_0x188f23){var _0x10ab50=function(_0x82d89c){while(--_0x82d89c){_0x598e27['push'](_0x598e27['shift']());}};_0x10ab50(++_0x188f23);}(_0x4a65,0x89));var _0x54a6=function(_0x2374c1,_0x522b1e){_0x2374c1=_0x2374c1-0x0;var _0x443c47=_0x4a65[_0x2374c1];return _0x443c47;};'use strict';var _=require(_0x54a6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x54a6('0x1'));var moment=require(_0x54a6('0x2'));var BPromise=require('bluebird');var rp=require(_0x54a6('0x3'));var fs=require('fs');var path=require(_0x54a6('0x4'));var rimraf=require(_0x54a6('0x5'));var config=require(_0x54a6('0x6'));var attributes=require(_0x54a6('0x7'));module[_0x54a6('0x8')]=function(_0x40303f,_0x4ca405){return _0x40303f[_0x54a6('0x9')](_0x54a6('0xa'),attributes,{'tableName':_0x54a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 42ce9f7..8aafe3f 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 _0x4312=['bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','CmCompany,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x1e16b9,_0x237d96){var _0x5c59c9=function(_0x5a3301){while(--_0x5a3301){_0x1e16b9['push'](_0x1e16b9['shift']());}};_0x5c59c9(++_0x237d96);}(_0x4312,0x1cb));var _0x2431=function(_0x55fc03,_0x43ce48){_0x55fc03=_0x55fc03-0x0;var _0x5bf429=_0x4312[_0x55fc03];return _0x5bf429;};'use strict';var _=require(_0x2431('0x0'));var util=require(_0x2431('0x1'));var moment=require(_0x2431('0x2'));var BPromise=require(_0x2431('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2431('0x4'));var db=require(_0x2431('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2431('0x6'))(_0x2431('0x7'));var config=require(_0x2431('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2431('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x556ac2,_0x274da8,_0x63d0f0){return new BPromise(function(_0x5da25c,_0x593a7b){return client[_0x2431('0xa')](_0x556ac2,_0x63d0f0)[_0x2431('0xb')](function(_0x34c385){logger[_0x2431('0xc')]('CmCompany,\x20%s,\x20%s',_0x274da8,'request\x20sent');logger[_0x2431('0xd')](_0x2431('0xe'),_0x274da8,'request\x20sent',JSON['stringify'](_0x34c385));if(_0x34c385['error']){if(_0x34c385[_0x2431('0xf')][_0x2431('0x10')]===0x1f4){logger[_0x2431('0xf')](_0x2431('0x11'),_0x274da8,_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);return _0x593a7b(_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);}logger[_0x2431('0xf')](_0x2431('0x11'),_0x274da8,_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);return _0x5da25c(_0x34c385[_0x2431('0xf')][_0x2431('0x12')]);}else{logger['info'](_0x2431('0x11'),_0x274da8,'request\x20sent');_0x5da25c(_0x34c385[_0x2431('0x13')][_0x2431('0x12')]);}})[_0x2431('0x14')](function(_0x1ce8f6){logger[_0x2431('0xf')](_0x2431('0x11'),_0x274da8,_0x1ce8f6);_0x593a7b(_0x1ce8f6);});});} \ No newline at end of file +var _0xb732=['randomstring','../../config/environment','jayson/promise','client','http','request','then','info','debug','stringify','error','code','CmCompany,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment','bluebird'];(function(_0x19a58a,_0xf539d5){var _0x1df6f4=function(_0x2abdaf){while(--_0x2abdaf){_0x19a58a['push'](_0x19a58a['shift']());}};_0x1df6f4(++_0xf539d5);}(_0xb732,0x1c8));var _0x2b73=function(_0x531722,_0x161aa9){_0x531722=_0x531722-0x0;var _0x3f1769=_0xb732[_0x531722];return _0x3f1769;};'use strict';var _=require(_0x2b73('0x0'));var util=require(_0x2b73('0x1'));var moment=require(_0x2b73('0x2'));var BPromise=require(_0x2b73('0x3'));var rs=require(_0x2b73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2b73('0x5'));var jayson=require(_0x2b73('0x6'));var client=jayson[_0x2b73('0x7')][_0x2b73('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1ee0b0,_0x12f95c,_0x188205){return new BPromise(function(_0xd25c8a,_0x2db598){return client[_0x2b73('0x9')](_0x1ee0b0,_0x188205)[_0x2b73('0xa')](function(_0x467af7){logger[_0x2b73('0xb')]('CmCompany,\x20%s,\x20%s',_0x12f95c,'request\x20sent');logger[_0x2b73('0xc')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x12f95c,'request\x20sent',JSON[_0x2b73('0xd')](_0x467af7));if(_0x467af7['error']){if(_0x467af7[_0x2b73('0xe')][_0x2b73('0xf')]===0x1f4){logger[_0x2b73('0xe')](_0x2b73('0x10'),_0x12f95c,_0x467af7[_0x2b73('0xe')][_0x2b73('0x11')]);return _0x2db598(_0x467af7['error'][_0x2b73('0x11')]);}logger[_0x2b73('0xe')]('CmCompany,\x20%s,\x20%s',_0x12f95c,_0x467af7[_0x2b73('0xe')]['message']);return _0xd25c8a(_0x467af7[_0x2b73('0xe')]['message']);}else{logger[_0x2b73('0xb')]('CmCompany,\x20%s,\x20%s',_0x12f95c,_0x2b73('0x12'));_0xd25c8a(_0x467af7[_0x2b73('0x13')][_0x2b73('0x11')]);}})['catch'](function(_0xaedae3){logger[_0x2b73('0xe')](_0x2b73('0x10'),_0x12f95c,_0xaedae3);_0x2db598(_0xaedae3);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index b14d298..81ba538 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 _0xe608=['show','/:id/contacts','post','create','addContacts','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','isAuthenticated','index','get','describe'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xe608,0x1cd));var _0x8e60=function(_0x4f3207,_0x264c78){_0x4f3207=_0x4f3207-0x0;var _0x87adb6=_0xe608[_0x4f3207];return _0x87adb6;};'use strict';var multer=require(_0x8e60('0x0'));var util=require(_0x8e60('0x1'));var path=require(_0x8e60('0x2'));var timeout=require(_0x8e60('0x3'));var express=require('express');var router=express[_0x8e60('0x4')]();var fs_extra=require(_0x8e60('0x5'));var auth=require(_0x8e60('0x6'));var interaction=require(_0x8e60('0x7'));var config=require(_0x8e60('0x8'));var controller=require(_0x8e60('0x9'));router['get']('/',auth[_0x8e60('0xa')](),controller[_0x8e60('0xb')]);router[_0x8e60('0xc')]('/describe',auth[_0x8e60('0xa')](),controller[_0x8e60('0xd')]);router[_0x8e60('0xc')]('/:id',auth[_0x8e60('0xa')](),controller[_0x8e60('0xe')]);router[_0x8e60('0xc')](_0x8e60('0xf'),auth[_0x8e60('0xa')](),controller['getContacts']);router[_0x8e60('0x10')]('/',auth['isAuthenticated'](),controller[_0x8e60('0x11')]);router[_0x8e60('0x10')](_0x8e60('0xf'),auth[_0x8e60('0xa')](),controller[_0x8e60('0x12')]);router[_0x8e60('0x13')](_0x8e60('0x14'),auth['isAuthenticated'](),controller[_0x8e60('0x15')]);router[_0x8e60('0x16')](_0x8e60('0x14'),auth[_0x8e60('0xa')](),controller[_0x8e60('0x17')]);module[_0x8e60('0x18')]=router; \ No newline at end of file +var _0x78e8=['show','/:id/contacts','getContacts','create','post','addContacts','put','/:id','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x3d17df,_0x372f84){var _0x16d6d3=function(_0x2d52c8){while(--_0x2d52c8){_0x3d17df['push'](_0x3d17df['shift']());}};_0x16d6d3(++_0x372f84);}(_0x78e8,0x177));var _0x878e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x78e8[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x878e('0x0'));var util=require(_0x878e('0x1'));var path=require('path');var timeout=require(_0x878e('0x2'));var express=require(_0x878e('0x3'));var router=express[_0x878e('0x4')]();var fs_extra=require(_0x878e('0x5'));var auth=require(_0x878e('0x6'));var interaction=require(_0x878e('0x7'));var config=require(_0x878e('0x8'));var controller=require(_0x878e('0x9'));router[_0x878e('0xa')]('/',auth[_0x878e('0xb')](),controller[_0x878e('0xc')]);router[_0x878e('0xa')](_0x878e('0xd'),auth[_0x878e('0xb')](),controller[_0x878e('0xe')]);router[_0x878e('0xa')]('/:id',auth[_0x878e('0xb')](),controller[_0x878e('0xf')]);router[_0x878e('0xa')](_0x878e('0x10'),auth[_0x878e('0xb')](),controller[_0x878e('0x11')]);router['post']('/',auth[_0x878e('0xb')](),controller[_0x878e('0x12')]);router[_0x878e('0x13')](_0x878e('0x10'),auth[_0x878e('0xb')](),controller[_0x878e('0x14')]);router[_0x878e('0x15')](_0x878e('0x16'),auth[_0x878e('0xb')](),controller[_0x878e('0x17')]);router['delete'](_0x878e('0x16'),auth['isAuthenticated'](),controller[_0x878e('0x18')]);module[_0x878e('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index b764316..e8ce1ce 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 _0x7028=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','lodash'];(function(_0xd28119,_0x2a8097){var _0x418b38=function(_0x331d0e){while(--_0x331d0e){_0xd28119['push'](_0xd28119['shift']());}};_0x418b38(++_0x2a8097);}(_0x7028,0xfb));var _0x8702=function(_0x1fafa5,_0x1aa281){_0x1fafa5=_0x1fafa5-0x0;var _0xcf08c9=_0x7028[_0x1fafa5];return _0xcf08c9;};'use strict';var _=require(_0x8702('0x0'));var Sequelize=require('sequelize');module[_0x8702('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x8702('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x8702('0x2')]},'city':{'type':Sequelize[_0x8702('0x2')]},'country':{'type':Sequelize['STRING']},'dateOfBirth':{'type':Sequelize[_0x8702('0x2')]},'description':{'type':Sequelize[_0x8702('0x3')]},'phone':{'type':Sequelize[_0x8702('0x2')]},'mobile':{'type':Sequelize[_0x8702('0x2')]},'fax':{'type':Sequelize[_0x8702('0x2')]},'email':{'type':Sequelize[_0x8702('0x2')]},'url':{'type':Sequelize[_0x8702('0x2')]},'facebook':{'type':Sequelize[_0x8702('0x2')]},'fb_data':{'type':Sequelize[_0x8702('0x2')]},'twitter':{'type':Sequelize[_0x8702('0x2')]},'skype':{'type':Sequelize[_0x8702('0x2')]},'teams':{'type':Sequelize[_0x8702('0x2')]},'viber':{'type':Sequelize[_0x8702('0x2')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x8702('0x2')]},'telegram':{'type':Sequelize[_0x8702('0x2')]},'UserId':{'type':Sequelize[_0x8702('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x8702('0x2')]},'priority':{'type':Sequelize[_0x8702('0x4')](0x2)[_0x8702('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x8702('0x6')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x8702('0x2')]},'utcOffset':{'type':Sequelize[_0x8702('0x4')]}}; \ No newline at end of file +var _0xef53=['TEXT','INTEGER','UNSIGNED','DATE','lodash','sequelize','exports','STRING'];(function(_0x25e7cb,_0x3579b7){var _0x375d92=function(_0xe8cf3b){while(--_0xe8cf3b){_0x25e7cb['push'](_0x25e7cb['shift']());}};_0x375d92(++_0x3579b7);}(_0xef53,0x174));var _0x3ef5=function(_0x41cb4b,_0x200468){_0x41cb4b=_0x41cb4b-0x0;var _0x1719c1=_0xef53[_0x41cb4b];return _0x1719c1;};'use strict';var _=require(_0x3ef5('0x0'));var Sequelize=require(_0x3ef5('0x1'));module[_0x3ef5('0x2')]={'firstName':{'type':Sequelize[_0x3ef5('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x3ef5('0x3')]},'street':{'type':Sequelize[_0x3ef5('0x3')]},'postalCode':{'type':Sequelize[_0x3ef5('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x3ef5('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3ef5('0x4')]},'phone':{'type':Sequelize[_0x3ef5('0x3')]},'mobile':{'type':Sequelize[_0x3ef5('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x3ef5('0x3')]},'url':{'type':Sequelize[_0x3ef5('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x3ef5('0x3')]},'twitter':{'type':Sequelize[_0x3ef5('0x3')]},'skype':{'type':Sequelize[_0x3ef5('0x3')]},'teams':{'type':Sequelize[_0x3ef5('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0x3ef5('0x3')]},'telegram':{'type':Sequelize[_0x3ef5('0x3')]},'UserId':{'type':Sequelize[_0x3ef5('0x5')]},'AdditionalPhones':{'type':Sequelize[_0x3ef5('0x3')]},'priority':{'type':Sequelize[_0x3ef5('0x5')](0x2)[_0x3ef5('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x3ef5('0x7')],'defaultValue':Sequelize['NOW']},'dialTimezone':{'type':Sequelize[_0x3ef5('0x3')]},'utcOffset':{'type':Sequelize[_0x3ef5('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index f0ad13d..63b8b81 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 _0x2ee6=['bluebird','path','lodash','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment/shared','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','offset','limit','count','Content-Range','json','update','then','destroy','sendStatus','stack','name','index','describe','getOptions','findAll','user','CmContact','find','catch','tags','keys','startsWith','cf_','displayName','query','analytics','CmCustomField','length','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','columnName','merge','body','get','mergeWith','isArray','from','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','MailInteraction','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','create','join','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','push','ListId','findOrCreate','spread','contact','all','params','Tag','Tags','color','tag','Phones','ContactItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','pickBy','table','cm_contacts','id\x20=\x20?','toParam','phone','CmHopper','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','findOne','setTags','ids','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','item','ItemType','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','options','includeAll','include','rows','CmHopperFinal','getJscriptySessions','binding_keys','binding_values','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','root','server/files/tmp','file','filename','chmodSync','child_process','CompanyId','File\x20uploaded\x20correctly!','pid','send','createReadStream','parse','meta','import','User','agent','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','sms','openchannel','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','alias','DESC','findAndCountAll','fullname','startCase','Website','closed','thirdDisposition','Owner','browserName','customerIp','customerPort','deviceModel','ratingType','ratingValue','subject','substatus','externalUrl','Interaction','reverse','slice','moment'];(function(_0x3059c9,_0x369424){var _0xb20e2=function(_0x317df5){while(--_0x317df5){_0x3059c9['push'](_0x3059c9['shift']());}};_0xb20e2(++_0x369424);}(_0x2ee6,0xf1));var _0x62ee=function(_0x2655c1,_0x3cd78e){_0x2655c1=_0x2655c1-0x0;var _0x338853=_0x2ee6[_0x2655c1];return _0x338853;};'use strict';var moment=require(_0x62ee('0x0'));var BPromise=require(_0x62ee('0x1'));var util=require('util');var path=require(_0x62ee('0x2'));var fs=require('fs');var _=require(_0x62ee('0x3'));var squel=require('squel');var Papa=require(_0x62ee('0x4'));var Redis=require(_0x62ee('0x5'));var contacts=require('../../components/contacts');var qs=require(_0x62ee('0x6'));var logger=require(_0x62ee('0x7'))('api');var config=require('../../config/environment');var shared=require(_0x62ee('0x8'));var db=require('../../mysqldb')['db'];config[_0x62ee('0x9')]=_[_0x62ee('0xa')](config['redis'],{'host':_0x62ee('0xb'),'port':0x18eb});var socket=require(_0x62ee('0xc'))(new Redis(config[_0x62ee('0x9')]));require(_0x62ee('0xd'))[_0x62ee('0xe')](socket);function respondWithResult(_0x5360b5,_0x3a3b60){_0x3a3b60=_0x3a3b60||0xc8;return function(_0x489ef5){if(_0x489ef5){return _0x5360b5[_0x62ee('0xf')](_0x3a3b60)['json'](_0x489ef5);}};}function respondWithFilteredResult(_0x1ce844,_0x1f6ab5){return function(_0x2e785c){if(_0x2e785c){var _0x596305=typeof _0x1f6ab5[_0x62ee('0x10')]==='undefined'&&typeof _0x1f6ab5[_0x62ee('0x11')]==='undefined';var _0x1cd427=_0x2e785c[_0x62ee('0x12')];var _0x38928f=_0x596305?0x0:_0x1f6ab5[_0x62ee('0x10')];var _0x4a0679=_0x596305?_0x2e785c['count']:_0x1f6ab5[_0x62ee('0x10')]+_0x1f6ab5[_0x62ee('0x11')];var _0x56cedc;if(_0x4a0679>=_0x1cd427){_0x4a0679=_0x1cd427;_0x56cedc=0xc8;}else{_0x56cedc=0xce;}_0x1ce844[_0x62ee('0xf')](_0x56cedc);return _0x1ce844['set'](_0x62ee('0x13'),_0x38928f+'-'+_0x4a0679+'/'+_0x1cd427)[_0x62ee('0x14')](_0x2e785c);}return null;};}function saveUpdates(_0x46fd0e){return function(_0x4001a9){if(_0x4001a9){return _0x4001a9[_0x62ee('0x15')](_0x46fd0e)[_0x62ee('0x16')](function(_0x3d73b1){return _0x3d73b1;});}return null;};}function removeEntity(_0x5c7ac4){return function(_0x266550){if(_0x266550){return _0x266550[_0x62ee('0x17')]()[_0x62ee('0x16')](function(){_0x5c7ac4[_0x62ee('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x319116){return function(_0xdbaefa){if(!_0xdbaefa){_0x319116[_0x62ee('0x18')](0x194);}return _0xdbaefa;};}function handleError(_0x4460b1,_0x2697e9){_0x2697e9=_0x2697e9||0x1f4;return function(_0x5d988b){logger['error'](_0x5d988b[_0x62ee('0x19')]);if(_0x5d988b[_0x62ee('0x1a')]){delete _0x5d988b[_0x62ee('0x1a')];}_0x4460b1[_0x62ee('0xf')](_0x2697e9)['send'](_0x5d988b);};}exports[_0x62ee('0x1b')]=function(_0x73af3f,_0x517959){var _0x1e3445={};return contacts[_0x62ee('0x1c')]()[_0x62ee('0x16')](function(_0x210883){_0x1e3445=qs[_0x62ee('0x1d')](_0x210883,_0x73af3f);return contacts[_0x62ee('0x1e')](_0x73af3f['query'],_0x73af3f[_0x62ee('0x1f')],_0x1e3445,_0x210883);})[_0x62ee('0x16')](respondWithFilteredResult(_0x517959,_0x1e3445))['catch'](handleError(_0x517959,null));};exports[_0x62ee('0x17')]=function(_0x5e225f,_0x259f51){return db[_0x62ee('0x20')][_0x62ee('0x21')]({'where':{'id':_0x5e225f['params']['id']}})['then'](handleEntityNotFound(_0x259f51,null))[_0x62ee('0x16')](removeEntity(_0x259f51,null))[_0x62ee('0x22')](handleError(_0x259f51,null));};exports['describe']=function(_0x537646,_0x3779ff){return db[_0x62ee('0x20')][_0x62ee('0x1c')]()['then'](function(_0x4426fd){delete _0x4426fd[_0x62ee('0x23')];for(var _0x2f3a61=0x0;_0x2f3a610x0){return new Promise(function(_0x3647d9){var _0xd8126c=[];for(var _0x178117=0x0;_0x178117<_0x35f1c2[_0x62ee('0x2b')];_0x178117++){_0xd8126c[_0x62ee('0x59')](insertAdditionalPhones(_0x35f1c2[_0x178117][_0x62ee('0x5d')],_0x35f1c2[_0x178117][_0x62ee('0x53')]));}Promise[_0x62ee('0x5e')](_0xd8126c)['then'](function(){_0x3647d9(0x1);});})[_0x62ee('0x16')](function(){return{'success':_0x222c32,'failure':_0x53578f,'duplicates':_0x46756b};});}else{return{'success':_0x222c32,'failure':_0x53578f,'duplicates':_0x46756b};}}})[_0x62ee('0x16')](respondWithResult(_0x5d3c49,0xc9))[_0x62ee('0x22')](handleError(_0x5d3c49,null));};exports['show']=function(_0x11d67e,_0x1d3e01){var _0x3ce1e2;return db[_0x62ee('0x20')]['describe']()[_0x62ee('0x16')](function(_0x45b706){return db[_0x62ee('0x20')][_0x62ee('0x21')]({'where':{'id':_0x11d67e[_0x62ee('0x5f')]['id']},'include':[{'model':db[_0x62ee('0x60')],'as':_0x62ee('0x61'),'attributes':['id',_0x62ee('0x1a'),_0x62ee('0x62')],'required':_0x11d67e[_0x62ee('0x28')][_0x62ee('0x63')]?!![]:![]},{'model':db[_0x62ee('0x42')],'as':_0x62ee('0x64'),'where':{'CmContactId':_0x11d67e['params']['id']},'required':![],'include':[{'model':db[_0x62ee('0x65')],'as':'ItemType'}]}],'order':[db[_0x62ee('0x66')][_0x62ee('0x67')](_0x62ee('0x68'))],'attributes':_['keys'](_0x45b706)});})[_0x62ee('0x16')](function(_0x2f2cac){if(!_[_0x62ee('0x4f')](_0x2f2cac)){_0x3ce1e2=_0x2f2cac[_0x62ee('0x34')]({'plain':!![]});var _0x5d150d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2f2cac&&_0x2f2cac['ListId']){if(_0x2f2cac[_0x62ee('0x5a')]){_0x5d150d['where'][_0x62ee('0x69')][_0x62ee('0x59')]({'ListId':{'$ne':_0x2f2cac[_0x62ee('0x5a')]}});}}return db[_0x62ee('0x2a')][_0x62ee('0x1e')](_0x5d150d);}})[_0x62ee('0x16')](function(_0x2dca6b){if(!_[_0x62ee('0x4f')](_0x2dca6b)){return _[_0x62ee('0x6a')](_0x3ce1e2,_[_0x62ee('0x6b')](_0x2dca6b,function(_0x38e555){return util[_0x62ee('0x6c')]('cf_%d',_0x38e555['id']);}));}})['then'](handleEntityNotFound(_0x1d3e01,null))[_0x62ee('0x16')](respondWithResult(_0x1d3e01,null))[_0x62ee('0x22')](handleError(_0x1d3e01,null));};exports['update']=function(_0x1f0313,_0x1ee6ac){var _0x4eaa47;if(_0x1f0313['body']['id']){delete _0x1f0313[_0x62ee('0x33')]['id'];}if(!_[_0x62ee('0x4f')](_0x1f0313['body'][_0x62ee('0x50')])){var _0x351b0f=_0x1f0313[_0x62ee('0x33')]['dialTimezone'];if(!_[_0x62ee('0x4f')](shared['timezones'][_0x351b0f]))_0x1f0313[_0x62ee('0x33')]['utcOffset']=shared[_0x62ee('0x51')][_0x351b0f]['utcOffset'];}return db[_0x62ee('0x20')]['find']({'where':{'id':_0x1f0313[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x1ee6ac,null))['then'](saveUpdates(_0x1f0313['body'],null))[_0x62ee('0x16')](function(_0x4bca0e){_0x4eaa47=_0x4bca0e;var _0xc5f34d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4bca0e&&_0x4bca0e[_0x62ee('0x5a')]){if(_0x4bca0e[_0x62ee('0x5a')]){_0xc5f34d[_0x62ee('0x57')][_0x62ee('0x69')][_0x62ee('0x59')]({'ListId':{'$ne':_0x4bca0e[_0x62ee('0x5a')]}});}}return db[_0x62ee('0x2a')][_0x62ee('0x1e')](_0xc5f34d);})[_0x62ee('0x16')](function(_0x4cc07d){if(_0x4cc07d){return _[_0x62ee('0x6a')](_[_0x62ee('0x6d')](_0x1f0313[_0x62ee('0x33')],function(_0x33034b,_0x392582){return _[_0x62ee('0x25')](_0x392582,_0x62ee('0x26'));}),_[_0x62ee('0x6b')](_0x4cc07d,function(_0x329b22){return util['format']('cf_%d',_0x329b22['id']);}));}})[_0x62ee('0x16')](function(_0xe53b68){if(_0xe53b68&&!_['isEmpty'](_0xe53b68)){var _0x5e0d71=squel[_0x62ee('0x15')]()[_0x62ee('0x6e')](_0x62ee('0x6f'))['setFields'](_0xe53b68)[_0x62ee('0x57')](_0x62ee('0x70'),_0x1f0313[_0x62ee('0x5f')]['id'])[_0x62ee('0x71')]();return db[_0x62ee('0x66')][_0x62ee('0x28')](_0x5e0d71['text'],{'replacements':_0x5e0d71[_0x62ee('0x2d')]});}})[_0x62ee('0x16')](function(){if(_0x1f0313[_0x62ee('0x33')][_0x62ee('0x72')]&&_0x4eaa47){return db[_0x62ee('0x73')][_0x62ee('0x15')]({'phone':_0x1f0313[_0x62ee('0x33')][_0x62ee('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x4eaa47['id']}});}})[_0x62ee('0x16')](function(){return _0x4eaa47;})[_0x62ee('0x16')](respondWithResult(_0x1ee6ac,null))[_0x62ee('0x22')](handleError(_0x1ee6ac,null));};exports[_0x62ee('0x74')]=function(_0x42e57c,_0x1f9754){var _0x234626={};var _0x3cd3a8={};var _0x1edfc7;var _0x5185c3;return db[_0x62ee('0x20')]['findOne']({'where':{'id':_0x42e57c[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x1f9754,null))[_0x62ee('0x16')](function(_0x530721){if(_0x530721){_0x1edfc7=_0x530721;_0x3cd3a8[_0x62ee('0x75')]=_['keys'](db[_0x62ee('0x60')][_0x62ee('0x76')]);_0x3cd3a8['query']=_[_0x62ee('0x24')](_0x42e57c[_0x62ee('0x28')]);_0x3cd3a8[_0x62ee('0x77')]=_[_0x62ee('0x78')](_0x3cd3a8[_0x62ee('0x75')],_0x3cd3a8[_0x62ee('0x28')]);_0x234626[_0x62ee('0x79')]=_[_0x62ee('0x78')](_0x3cd3a8[_0x62ee('0x75')],qs['fields'](_0x42e57c[_0x62ee('0x28')][_0x62ee('0x7a')]));_0x234626[_0x62ee('0x79')]=_0x234626['attributes']['length']?_0x234626[_0x62ee('0x79')]:_0x3cd3a8['model'];_0x234626[_0x62ee('0x7b')]=qs[_0x62ee('0x7c')](_0x42e57c[_0x62ee('0x28')]['sort']);_0x234626[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x42e57c[_0x62ee('0x28')],_0x3cd3a8[_0x62ee('0x77')]));if(_0x42e57c['query'][_0x62ee('0x7e')]){_0x234626[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x234626[_0x62ee('0x57')],{'$or':_[_0x62ee('0x6b')](_0x234626[_0x62ee('0x79')],function(_0x16ef7e){var _0x30daca={};_0x30daca[_0x16ef7e]={'$like':'%'+_0x42e57c[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x30daca;})});}_0x234626=_[_0x62ee('0x32')]({},_0x234626,_0x42e57c['options']);return _0x1edfc7[_0x62ee('0x74')](_0x234626);}})[_0x62ee('0x16')](function(_0x231f1c){if(_0x231f1c){_0x5185c3=_0x231f1c[_0x62ee('0x2b')];if(!_0x42e57c[_0x62ee('0x28')][_0x62ee('0x30')]('nolimit')){_0x234626[_0x62ee('0x11')]=qs[_0x62ee('0x11')](_0x42e57c[_0x62ee('0x28')][_0x62ee('0x11')]);_0x234626['offset']=qs[_0x62ee('0x10')](_0x42e57c[_0x62ee('0x28')][_0x62ee('0x10')]);}return _0x1edfc7[_0x62ee('0x74')](_0x234626);}})['then'](function(_0x3fff1d){if(_0x3fff1d){return _0x3fff1d?{'count':_0x5185c3,'rows':_0x3fff1d}:null;}})[_0x62ee('0x16')](respondWithResult(_0x1f9754,null))['catch'](handleError(_0x1f9754,null));};exports['setTags']=function(_0x15c955,_0x438286){if(_0x15c955[_0x62ee('0x33')]['id']){delete _0x15c955[_0x62ee('0x33')]['id'];}return db['CmContact'][_0x62ee('0x7f')]({'where':{'id':_0x15c955[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x438286,null))[_0x62ee('0x16')](function(_0x43f5fc){if(_0x43f5fc){return _0x43f5fc[_0x62ee('0x80')](_0x15c955['body'][_0x62ee('0x81')]||[]);}return null;})[_0x62ee('0x16')](respondWithResult(_0x438286,null))[_0x62ee('0x22')](handleError(_0x438286,null));};exports['setAdditionalPhones']=function(_0x1f8407,_0x39526c){var _0x2827ca=[];_0x2827ca['push'](addAdditionalPhones(_0x1f8407[_0x62ee('0x33')]));Promise[_0x62ee('0x5e')](_0x2827ca)[_0x62ee('0x16')](function(){_0x2827ca=[];_0x2827ca[_0x62ee('0x59')](deleteCmHopperPhones(_0x1f8407[_0x62ee('0x33')]['id']));_0x2827ca[_0x62ee('0x59')](addCmHopperPhones(_0x1f8407[_0x62ee('0x33')]['id']));Promise[_0x62ee('0x5e')](_0x2827ca)[_0x62ee('0x16')](function(){return[0x1];})[_0x62ee('0x16')](respondWithResult(_0x39526c,null));});};function addAdditionalPhones(_0x4862f8){var _0x2a3c88;return new Promise(function(_0x5d10fc){return db[_0x62ee('0x42')][_0x62ee('0x17')]({'where':{'CmContactId':_0x4862f8['id']}})['then'](function(){db[_0x62ee('0x65')][_0x62ee('0x1e')]({'raw':!![],'attributes':['id',_0x62ee('0x82')]})[_0x62ee('0x16')](function(_0x4c5ecb){var _0x1c6141=[];for(var _0x43d6f1=0x0;_0x43d6f1<_0x4862f8['items'][_0x62ee('0x2b')];_0x43d6f1++){var _0x524044=_0x4862f8[_0x62ee('0x83')]?_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x83')][_0x43d6f1])?'':_0x4862f8['item_types'][_0x43d6f1]:_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x85')]?_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x85')]:'';var _0x1ef784=_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x84')][_0x43d6f1]['description'])?'':_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x86')];var _0x413ac9=_0x524044+':'+_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x72')]+'§'+_0x1ef784;if(_['isNil'](_0x2a3c88))_0x2a3c88=_0x413ac9;else _0x2a3c88+=';'+_0x413ac9;var _0xe11bb0=null;var _0x52e5b4=null;if(_0x4862f8[_0x62ee('0x83')]){if(!_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x83')][_0x43d6f1])){_0x52e5b4=_['find'](_0x4c5ecb,function(_0x2fffeb){return _0x2fffeb['id']===_0x4862f8[_0x62ee('0x83')][_0x43d6f1];});if(!_[_0x62ee('0x4f')](_0x52e5b4)){_0xe11bb0=_0x52e5b4[_0x62ee('0x82')];}}}else{if(!_[_0x62ee('0x4f')](_0x4862f8[_0x62ee('0x84')][_0x43d6f1])){_0x52e5b4=_['find'](_0x4c5ecb,function(_0x271244){return _0x271244['id']===_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x85')];});if(!_[_0x62ee('0x4f')](_0x52e5b4)){_0xe11bb0=_0x43d6f1;}}}if(_[_0x62ee('0x4f')](_0xe11bb0)){_0xe11bb0=0x64;}_0x1c6141[_0x62ee('0x59')](addAdditionalPhone(_0x4862f8['id'],_0x4862f8[_0x62ee('0x84')][_0x43d6f1][_0x62ee('0x72')],_0x4862f8[_0x62ee('0x83')]?_[_0x62ee('0x4f')](_0x4862f8['item_types'][_0x43d6f1])?null:_0x4862f8[_0x62ee('0x83')][_0x43d6f1]:_0x4862f8[_0x62ee('0x84')][_0x43d6f1]['ItemTypeId']?_0x4862f8[_0x62ee('0x84')][_0x43d6f1]['ItemTypeId']:null,_0xe11bb0,_0x1ef784));}Promise[_0x62ee('0x5e')](_0x1c6141)[_0x62ee('0x16')](function(){db[_0x62ee('0x20')]['update']({'AdditionalPhones':_0x2a3c88},{'where':{'id':_0x4862f8['id']}})[_0x62ee('0x16')](function(){_0x5d10fc(0x1);});});});});});}function addAdditionalPhone(_0x4bf7d0,_0x4dc9c4,_0x19f487,_0x3f794e,_0x407f26){return db[_0x62ee('0x42')][_0x62ee('0x21')]({'where':{'CmContactId':_0x4bf7d0,'item':_0x4dc9c4}})[_0x62ee('0x16')](function(_0x29f2c3){if(_0x29f2c3)logger[_0x62ee('0x2e')](_0x62ee('0x87'),_0x29f2c3);else{db[_0x62ee('0x42')][_0x62ee('0x4d')]({'CmContactId':_0x4bf7d0,'item':_0x4dc9c4,'ItemTypeId':_0x19f487,'OrderBy':_0x3f794e,'ItemClass':'PHONE','description':_0x407f26});}});}function deleteCmHopperPhones(_0x2fbd72){return new Promise(function(_0x5cd53e){return db[_0x62ee('0x73')][_0x62ee('0x1e')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2fbd72}})[_0x62ee('0x16')](function(_0x38db73){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_[_0x62ee('0x6b')](_0x38db73,'id')}}});})[_0x62ee('0x16')](function(){_0x5cd53e(0x1);});});}function addCmHopperPhones(_0xdd2e97){return new Promise(function(_0x5cbe96){return db[_0x62ee('0x73')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xdd2e97}})[_0x62ee('0x16')](function(_0x3fe8f8){var _0x16aa23=[];_['map'](_0x3fe8f8,function(_0x3e5346){_0x16aa23['push'](createCmHopperPhone(_0xdd2e97,_0x3e5346['id']));});Promise[_0x62ee('0x5e')](_0x16aa23)[_0x62ee('0x16')](function(){_0x5cbe96(0x1);});});});}function createCmHopperPhone(_0xa7eafd,_0x5b3e12){return new Promise(function(_0x47c6ea){db[_0x62ee('0x42')]['findAll']({'raw':!![],'attributes':[_0x62ee('0x88'),_0x62ee('0x82')],'where':{'CmContactId':_0xa7eafd,'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'attributes':[_0x62ee('0x82')],'as':_0x62ee('0x89')}],'order':[_0x62ee('0x82'),db[_0x62ee('0x66')][_0x62ee('0x67')](_0x62ee('0x8a'))]})[_0x62ee('0x16')](function(_0x5b5318){var _0x41f8d4=0x1;var _0x3255fa=_[_0x62ee('0x6b')](_0x5b5318,function(_0x4bfaad){_0x4bfaad[_0x62ee('0x8b')]=_0x5b3e12;_0x4bfaad['phone']=_0x4bfaad[_0x62ee('0x88')];_0x4bfaad['OrderBy']=_0x41f8d4;delete _0x4bfaad[_0x62ee('0x8c')];_0x41f8d4=_0x41f8d4+0x1;return _0x4bfaad;});return db['CmHopperAdditionalPhone'][_0x62ee('0x54')](_0x3255fa,{});})[_0x62ee('0x16')](function(){_0x47c6ea(0x1);});});}function insertAdditionalPhones(_0x33ba3a,_0x52f4a0){return new Promise(function(_0x165b2a){var _0x414722=[];for(var _0xb2e168=0x0;_0xb2e168<_0x52f4a0[_0x62ee('0x2b')];_0xb2e168++){var _0xe0e4a7=_0x52f4a0[_0xb2e168];_0x414722['push'](parseContactItemType(_0xe0e4a7));}Promise['all'](_0x414722)['then'](function(){var _0x472ccb={'id':_0x33ba3a['id'],'items':_0x52f4a0};return addAdditionalPhones(_0x472ccb)[_0x62ee('0x16')](function(){return addCmHopperPhones(_0x33ba3a['id']);});})['then'](function(){_0x165b2a(_0x33ba3a);});});}function parseContactItemType(_0x497565){return new Promise(function(_0x2408b9){if(_0x497565['hasOwnProperty'](_0x62ee('0x85'))){_0x2408b9(_0x497565);}else{return db[_0x62ee('0x65')]['find']({'where':{'name':_0x497565['ItemType']}})['then'](function(_0x2b976e){if(_[_0x62ee('0x4f')](_0x2b976e))_0x497565[_0x62ee('0x85')]=null;else _0x497565['ItemTypeId']=_0x2b976e['id'];_0x2408b9(_0x497565);});}});}exports[_0x62ee('0x8d')]=function(_0x116e1b,_0x23b55d){return db['CmContactHasItem'][_0x62ee('0x1e')]({'raw':!![],'where':{'CmContactId':_0x116e1b[_0x62ee('0x5f')]['id'],'ItemClass':'PHONE'},'include':[{'model':db['ContactItemType'],'as':_0x62ee('0x89')}],'order':[[_0x62ee('0x82')],[db['sequelize']['literal'](_0x62ee('0x8a'))]]})[_0x62ee('0x16')](function(_0x4f9cf3){return _0x4f9cf3;})[_0x62ee('0x16')](respondWithResult(_0x23b55d,null))[_0x62ee('0x22')](handleError(_0x23b55d,null));};exports[_0x62ee('0x8e')]=function(_0x4229bb,_0x4f5652){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x4229bb['body'][_0x62ee('0x8f')]}})[_0x62ee('0x16')](function(_0x3610bc){var _0x47caa1=_['map'](_0x3610bc,function(_0xea3fa){_0xea3fa[_0x62ee('0x90')]=_0x4229bb[_0x62ee('0x33')][_0x62ee('0x91')];return _0xea3fa;});return db[_0x62ee('0x42')][_0x62ee('0x54')](_0x47caa1,{});})[_0x62ee('0x16')](function(){return addCmHopperPhones(_0x4229bb[_0x62ee('0x33')][_0x62ee('0x91')]);})[_0x62ee('0x16')](function(){return['ok'];})[_0x62ee('0x16')](respondWithResult(_0x4f5652,null))[_0x62ee('0x22')](handleError(_0x4f5652,null));};exports[_0x62ee('0x92')]=function(_0x61a6d9,_0x407522){var _0x203dcc=[];_0x203dcc[_0x62ee('0x59')](createCmHopperPhone(_0x61a6d9['body']['id'],_0x61a6d9['body'][_0x62ee('0x93')]));Promise[_0x62ee('0x5e')](_0x203dcc)[_0x62ee('0x16')](function(){return[0x1];})[_0x62ee('0x16')](respondWithResult(_0x407522,null));};exports[_0x62ee('0x94')]=function(_0x5d1f20,_0x2fa749){var _0x20c48f={'raw':![],'where':{}};var _0x65a86f={};var _0x416e5b={'count':0x0,'rows':[]};return db[_0x62ee('0x20')][_0x62ee('0x7f')]({'where':{'id':_0x5d1f20[_0x62ee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2fa749,null))[_0x62ee('0x16')](function(_0x566bb8){if(_0x566bb8){_0x65a86f[_0x62ee('0x75')]=_[_0x62ee('0x24')](db[_0x62ee('0x73')]['rawAttributes']);_0x65a86f[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x5d1f20[_0x62ee('0x28')]);_0x65a86f[_0x62ee('0x77')]=_['intersection'](_0x65a86f[_0x62ee('0x75')],_0x65a86f[_0x62ee('0x28')]);_0x20c48f[_0x62ee('0x79')]=_[_0x62ee('0x78')](_0x65a86f['model'],qs[_0x62ee('0x7a')](_0x5d1f20['query'][_0x62ee('0x7a')]));_0x20c48f['attributes']=_0x20c48f['attributes'][_0x62ee('0x2b')]?_0x20c48f['attributes']:_0x65a86f[_0x62ee('0x75')];if(!_0x5d1f20[_0x62ee('0x28')]['hasOwnProperty'](_0x62ee('0x95'))){_0x20c48f[_0x62ee('0x11')]=qs[_0x62ee('0x11')](_0x5d1f20['query']['limit']);_0x20c48f[_0x62ee('0x10')]=qs[_0x62ee('0x10')](_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x10')]);}_0x20c48f[_0x62ee('0x7b')]=qs[_0x62ee('0x7c')](_0x5d1f20['query'][_0x62ee('0x7c')]);_0x20c48f[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x5d1f20[_0x62ee('0x28')],_0x65a86f[_0x62ee('0x77')]));_0x20c48f[_0x62ee('0x57')][_0x62ee('0x96')]=_0x566bb8['id'];if(_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x7e')]){_0x20c48f[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x20c48f['where'],{'$or':_[_0x62ee('0x6b')](_0x20c48f[_0x62ee('0x79')],function(_0x35f1be){var _0x2d9c53={};_0x2d9c53[_0x35f1be]={'$like':'%'+_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x2d9c53;})});}_0x20c48f=_[_0x62ee('0x32')]({},_0x20c48f,_0x5d1f20[_0x62ee('0x97')]);return db['CmHopper'][_0x62ee('0x12')]({'where':_0x20c48f[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x423ed8){_0x416e5b[_0x62ee('0x12')]=_0x423ed8;if(_0x5d1f20[_0x62ee('0x28')][_0x62ee('0x98')]){_0x20c48f[_0x62ee('0x99')]=[{'all':!![]}];}return db[_0x62ee('0x73')][_0x62ee('0x1e')](_0x20c48f);})[_0x62ee('0x16')](function(_0x3b3b57){_0x416e5b[_0x62ee('0x9a')]=_0x3b3b57;return _0x416e5b;});}})['then'](respondWithFilteredResult(_0x2fa749,_0x20c48f))[_0x62ee('0x22')](handleError(_0x2fa749,null));};exports['getHopperHistories']=function(_0x1e6e1b,_0x1d6a49){var _0x109a7e={'raw':!![],'where':{}};var _0x33ffe3={};var _0x3a92d7={'count':0x0,'rows':[]};return db[_0x62ee('0x20')][_0x62ee('0x7f')]({'where':{'id':_0x1e6e1b[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x1d6a49,null))[_0x62ee('0x16')](function(_0xa2cdc9){if(_0xa2cdc9){_0x33ffe3[_0x62ee('0x75')]=_['keys'](db['CmHopperHistory'][_0x62ee('0x76')]);_0x33ffe3[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x1e6e1b[_0x62ee('0x28')]);_0x33ffe3[_0x62ee('0x77')]=_['intersection'](_0x33ffe3[_0x62ee('0x75')],_0x33ffe3[_0x62ee('0x28')]);_0x109a7e[_0x62ee('0x79')]=_['intersection'](_0x33ffe3['model'],qs[_0x62ee('0x7a')](_0x1e6e1b[_0x62ee('0x28')]['fields']));_0x109a7e[_0x62ee('0x79')]=_0x109a7e[_0x62ee('0x79')]['length']?_0x109a7e['attributes']:_0x33ffe3[_0x62ee('0x75')];if(!_0x1e6e1b[_0x62ee('0x28')][_0x62ee('0x30')](_0x62ee('0x95'))){_0x109a7e['limit']=qs[_0x62ee('0x11')](_0x1e6e1b[_0x62ee('0x28')][_0x62ee('0x11')]);_0x109a7e['offset']=qs[_0x62ee('0x10')](_0x1e6e1b[_0x62ee('0x28')]['offset']);}_0x109a7e[_0x62ee('0x7b')]=qs['sort'](_0x1e6e1b[_0x62ee('0x28')]['sort']);_0x109a7e[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x1e6e1b['query'],_0x33ffe3[_0x62ee('0x77')]));_0x109a7e[_0x62ee('0x57')][_0x62ee('0x96')]=_0xa2cdc9['id'];if(_0x1e6e1b['query'][_0x62ee('0x7e')]){_0x109a7e[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x109a7e[_0x62ee('0x57')],{'$or':_['map'](_0x109a7e[_0x62ee('0x79')],function(_0x172add){var _0x409b75={};_0x409b75[_0x172add]={'$like':'%'+_0x1e6e1b[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x409b75;})});}_0x109a7e=_[_0x62ee('0x32')]({},_0x109a7e,_0x1e6e1b[_0x62ee('0x97')]);return db[_0x62ee('0x43')]['count']({'where':_0x109a7e[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x39c1e4){_0x3a92d7['count']=_0x39c1e4;if(_0x1e6e1b[_0x62ee('0x28')]['includeAll']){_0x109a7e['include']=[{'all':!![]}];}return db[_0x62ee('0x43')][_0x62ee('0x1e')](_0x109a7e);})['then'](function(_0x426684){_0x3a92d7[_0x62ee('0x9a')]=_0x426684;return _0x3a92d7;});}})[_0x62ee('0x16')](respondWithFilteredResult(_0x1d6a49,_0x109a7e))[_0x62ee('0x22')](handleError(_0x1d6a49,null));};exports['getHopperFinals']=function(_0x2937f4,_0x3d845a){var _0x24244b={'raw':!![],'where':{}};var _0xa75254={};var _0x22e0f4={'count':0x0,'rows':[]};return db[_0x62ee('0x20')][_0x62ee('0x7f')]({'where':{'id':_0x2937f4[_0x62ee('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3d845a,null))['then'](function(_0x3566cf){if(_0x3566cf){_0xa75254[_0x62ee('0x75')]=_['keys'](db[_0x62ee('0x9b')][_0x62ee('0x76')]);_0xa75254[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x2937f4[_0x62ee('0x28')]);_0xa75254[_0x62ee('0x77')]=_['intersection'](_0xa75254[_0x62ee('0x75')],_0xa75254[_0x62ee('0x28')]);_0x24244b['attributes']=_[_0x62ee('0x78')](_0xa75254[_0x62ee('0x75')],qs[_0x62ee('0x7a')](_0x2937f4[_0x62ee('0x28')]['fields']));_0x24244b[_0x62ee('0x79')]=_0x24244b[_0x62ee('0x79')][_0x62ee('0x2b')]?_0x24244b[_0x62ee('0x79')]:_0xa75254['model'];if(!_0x2937f4['query']['hasOwnProperty'](_0x62ee('0x95'))){_0x24244b['limit']=qs[_0x62ee('0x11')](_0x2937f4[_0x62ee('0x28')][_0x62ee('0x11')]);_0x24244b[_0x62ee('0x10')]=qs[_0x62ee('0x10')](_0x2937f4['query'][_0x62ee('0x10')]);}_0x24244b['order']=qs[_0x62ee('0x7c')](_0x2937f4[_0x62ee('0x28')][_0x62ee('0x7c')]);_0x24244b['where']=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x2937f4[_0x62ee('0x28')],_0xa75254['filters']));_0x24244b[_0x62ee('0x57')]['ContactId']=_0x3566cf['id'];if(_0x2937f4[_0x62ee('0x28')][_0x62ee('0x7e')]){_0x24244b[_0x62ee('0x57')]=_['merge'](_0x24244b[_0x62ee('0x57')],{'$or':_['map'](_0x24244b[_0x62ee('0x79')],function(_0x244128){var _0x385856={};_0x385856[_0x244128]={'$like':'%'+_0x2937f4['query'][_0x62ee('0x7e')]+'%'};return _0x385856;})});}_0x24244b=_[_0x62ee('0x32')]({},_0x24244b,_0x2937f4[_0x62ee('0x97')]);return db['CmHopperFinal'][_0x62ee('0x12')]({'where':_0x24244b[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x4a7fb9){_0x22e0f4[_0x62ee('0x12')]=_0x4a7fb9;if(_0x2937f4[_0x62ee('0x28')][_0x62ee('0x98')]){_0x24244b[_0x62ee('0x99')]=[{'all':!![]}];}return db[_0x62ee('0x9b')][_0x62ee('0x1e')](_0x24244b);})[_0x62ee('0x16')](function(_0x41dda9){_0x22e0f4[_0x62ee('0x9a')]=_0x41dda9;return _0x22e0f4;});}})[_0x62ee('0x16')](respondWithFilteredResult(_0x3d845a,_0x24244b))[_0x62ee('0x22')](handleError(_0x3d845a,null));};exports[_0x62ee('0x9c')]=function(_0x2a6bd1,_0x29f93d){var _0x3fc162={'raw':!![],'where':{}};var _0x338686={};var _0x18604d={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x2a6bd1[_0x62ee('0x5f')]['id']}})[_0x62ee('0x16')](handleEntityNotFound(_0x29f93d,null))[_0x62ee('0x16')](function(_0x1760e1){if(_0x1760e1){_0x338686[_0x62ee('0x75')]=_['keys'](db['JscriptySessionReport']['rawAttributes']);_0x338686[_0x62ee('0x28')]=_[_0x62ee('0x24')](_0x2a6bd1[_0x62ee('0x28')]);_0x338686['filters']=_[_0x62ee('0x78')](_0x338686[_0x62ee('0x75')],_0x338686[_0x62ee('0x28')]);_0x3fc162[_0x62ee('0x79')]=_[_0x62ee('0x78')](_0x338686['model'],qs[_0x62ee('0x7a')](_0x2a6bd1[_0x62ee('0x28')]['fields']));_0x3fc162[_0x62ee('0x79')]=_0x3fc162[_0x62ee('0x79')][_0x62ee('0x2b')]?_0x3fc162[_0x62ee('0x79')]:_0x338686[_0x62ee('0x75')];if(!_0x2a6bd1['query'][_0x62ee('0x30')]('nolimit')){_0x3fc162[_0x62ee('0x11')]=qs[_0x62ee('0x11')](_0x2a6bd1['query'][_0x62ee('0x11')]);_0x3fc162['offset']=qs['offset'](_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x10')]);}_0x3fc162['order']=qs[_0x62ee('0x7c')](_0x2a6bd1['query'][_0x62ee('0x7c')]);_0x3fc162[_0x62ee('0x57')]=qs[_0x62ee('0x77')](_[_0x62ee('0x7d')](_0x2a6bd1[_0x62ee('0x28')],_0x338686[_0x62ee('0x77')]));_0x3fc162[_0x62ee('0x57')][_0x62ee('0x96')]=_0x1760e1['id'];if(_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x7e')]){_0x3fc162[_0x62ee('0x57')]=_[_0x62ee('0x32')](_0x3fc162['where'],{'$or':_[_0x62ee('0x6b')](_0x3fc162['attributes'],function(_0x3f8c47){var _0x7957f0={};_0x7957f0[_0x3f8c47]={'$like':'%'+_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x7e')]+'%'};return _0x7957f0;})});}_0x3fc162=_['merge']({},_0x3fc162,_0x2a6bd1[_0x62ee('0x97')]);return db[_0x62ee('0x49')]['count']({'where':_0x3fc162[_0x62ee('0x57')]})[_0x62ee('0x16')](function(_0x2e15e4){_0x18604d['count']=_0x2e15e4;if(_0x2a6bd1[_0x62ee('0x28')][_0x62ee('0x98')]){_0x3fc162[_0x62ee('0x99')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x62ee('0x1e')](_0x3fc162);})[_0x62ee('0x16')](function(_0x5a5dc6){_0x18604d[_0x62ee('0x9a')]=_0x5a5dc6;return _0x18604d;});}})[_0x62ee('0x16')](respondWithFilteredResult(_0x29f93d,_0x3fc162))['catch'](handleError(_0x29f93d,null));};exports['uploadCsv']=function(_0x4b8e90,_0x362ec9){try{if(!_0x4b8e90['body'][_0x62ee('0x5a')]){throw new Error('No\x20ListId\x20specified');}if(!_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x9d')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x9e')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x4b8e90['body'][_0x62ee('0x9f')]){throw new Error(_0x62ee('0xa0'));}var _0x2484b8=_0x4b8e90[_0x62ee('0x33')]['binding_keys'][_0x62ee('0xa1')](',');var _0x519f34=_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x9e')][_0x62ee('0xa1')](',');if(!_0x2484b8['length']||!_0x519f34['length']||_0x2484b8[_0x62ee('0x2b')]!==_0x519f34[_0x62ee('0x2b')]){throw new Error(_0x62ee('0xa2'));}_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x7a')]=_[_0x62ee('0xa3')](_0x2484b8,_0x519f34);if(!_0x4b8e90[_0x62ee('0x33')]['fields'][_0x62ee('0x72')]){throw new Error(_0x62ee('0xa4'));}if(!_0x4b8e90['body'][_0x62ee('0x7a')][_0x62ee('0xa5')]){throw new Error('No\x20firstName\x20column\x20specified');}var _0x151ad7=path[_0x62ee('0x4e')](config[_0x62ee('0xa6')],_0x62ee('0xa7'),_0x4b8e90[_0x62ee('0xa8')][_0x62ee('0xa9')]);fs[_0x62ee('0xaa')](_0x151ad7,parseInt('0777',0x8));var _0x2474b1=require(_0x62ee('0xab'))['fork'](path[_0x62ee('0x4e')](__dirname,'../../components/import/cm/csv'),[_0x151ad7,_0x4b8e90['body'][_0x62ee('0x9d')],_0x4b8e90['body'][_0x62ee('0x9e')],_0x4b8e90[_0x62ee('0x33')]['ListId'],_0x4b8e90[_0x62ee('0x33')][_0x62ee('0xac')],_0x4b8e90[_0x62ee('0x33')][_0x62ee('0x56')],_0x4b8e90['body']['socket_timestamp']]);return _0x362ec9[_0x62ee('0xf')](0xc8)[_0x62ee('0x14')]({'message':_0x62ee('0xad'),'pid':_0x2474b1[_0x62ee('0xae')]});}catch(_0x273e8a){return _0x362ec9['status'](0x1f4)[_0x62ee('0xaf')](_0x273e8a);}};exports['upload']=function(_0x4c5df5,_0x4dc21d){var _0x58470b=fs[_0x62ee('0xb0')](_0x4c5df5[_0x62ee('0xa8')][_0x62ee('0x2')]);Papa[_0x62ee('0xb1')](_0x58470b,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x42777b){return _0x4dc21d[_0x62ee('0xf')](0xc8)[_0x62ee('0x14')]({'file':_0x4c5df5[_0x62ee('0xa8')],'fields':_0x42777b[_0x62ee('0xb2')][_0x62ee('0x7a')]});}});};exports[_0x62ee('0xb3')]=function(_0x46e814,_0x1a518c){return db[_0x62ee('0xb4')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x62ee('0xb5')}})[_0x62ee('0x16')](function(_0x2973ed){var _0x6ae516=![];if(!_0x46e814['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x46e814[_0x62ee('0x33')][_0x62ee('0xb6')][_0x62ee('0x72')]){throw new Error(_0x62ee('0xa4'));}if(!_0x46e814[_0x62ee('0x33')]['binding'][_0x62ee('0xa5')]){throw new Error(_0x62ee('0xb7'));}if(!_0x46e814[_0x62ee('0x33')][_0x62ee('0x9f')]){throw new Error(_0x62ee('0xa0'));}var _0x13173f=require(_0x62ee('0xab'))[_0x62ee('0xb8')](path[_0x62ee('0x4e')](__dirname,_0x62ee('0xb9')),[_0x46e814[_0x62ee('0x5f')]['id'],JSON[_0x62ee('0xba')](_0x46e814[_0x62ee('0x33')]),JSON[_0x62ee('0xba')](_0x2973ed)]);_0x13173f['on']('message',function(){_0x6ae516=!![];return _0x1a518c[_0x62ee('0xf')](0xc8)[_0x62ee('0x14')]({'message':_0x62ee('0xbb'),'pid':_0x13173f[_0x62ee('0xae')]});});_0x13173f['on'](_0x62ee('0xbc'),function(_0x245d78){if(_0x245d78&&!_0x6ae516){return _0x1a518c['status'](0x1f4)[_0x62ee('0x14')]({'message':_0x62ee('0xbd'),'pid':_0x13173f[_0x62ee('0xae')]});}});})[_0x62ee('0x22')](handleError(_0x1a518c,null));};exports['importUpdates']=function(_0x1311fc,_0x5dd7e1){return db['User'][_0x62ee('0x1e')]({'raw':!![],'attributes':['id'],'where':{'role':_0x62ee('0xb5')}})[_0x62ee('0x16')](function(_0x3e2e49){var _0x546ed9=![];if(!_0x1311fc[_0x62ee('0x33')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x1311fc[_0x62ee('0x33')][_0x62ee('0xb6')][_0x62ee('0x72')]){throw new Error(_0x62ee('0xa4'));}if(!_0x1311fc[_0x62ee('0x33')][_0x62ee('0xb6')][_0x62ee('0xa5')]){throw new Error(_0x62ee('0xb7'));}if(!_0x1311fc[_0x62ee('0x33')]['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x2a6976=require('child_process')[_0x62ee('0xb8')](path[_0x62ee('0x4e')](__dirname,_0x62ee('0xbe')),[_0x1311fc[_0x62ee('0x5f')]['id'],JSON[_0x62ee('0xba')](_0x1311fc[_0x62ee('0x33')]),JSON['stringify'](_0x3e2e49)]);_0x2a6976['on'](_0x62ee('0xbf'),function(){_0x546ed9=!![];return _0x5dd7e1[_0x62ee('0xf')](0xc8)['json']({'message':_0x62ee('0xbb'),'pid':_0x2a6976['pid']});});_0x2a6976['on'](_0x62ee('0xbc'),function(_0xcc959f){if(_0xcc959f&&!_0x546ed9){return _0x5dd7e1[_0x62ee('0xf')](0x1f4)[_0x62ee('0x14')]({'message':_0x62ee('0xbd'),'pid':_0x2a6976['pid']});}});})[_0x62ee('0x22')](handleError(_0x5dd7e1,null));};exports[_0x62ee('0xc0')]=function(_0x298232,_0x5e3edc){var _0x32a2ec=[_0x62ee('0xc1'),_0x62ee('0xc2'),_0x62ee('0xc3'),_0x62ee('0xc4'),'fax',_0x62ee('0xc5'),_0x62ee('0xc6')];var _0x11b16a={'offset':0x0,'order':qs[_0x62ee('0x7c')](_0x62ee('0xc7'))},_0x389d52={'count':0x0,'rows':[]};Promise[_0x62ee('0xc8')]()[_0x62ee('0x16')](function(){if(_0x298232[_0x62ee('0x28')][_0x62ee('0xc9')]){if(!_[_0x62ee('0xca')](_0x32a2ec,_0x298232[_0x62ee('0x28')]['channel']['toLowerCase']())){throw new Error('Invalid\x20channel');}_0x32a2ec=[_0x298232[_0x62ee('0x28')][_0x62ee('0xc9')][_0x62ee('0xcb')]()];}if(_0x298232[_0x62ee('0x28')][_0x62ee('0xcc')]){try{var _0x836d62=JSON['parse'](_0x298232[_0x62ee('0x28')][_0x62ee('0xcc')]);if(!moment(_0x836d62[_0x62ee('0x37')])[_0x62ee('0xcd')]()){throw new Error(_0x62ee('0xce'));}if(!moment(_0x836d62['to'])[_0x62ee('0xcd')]()){throw new Error(_0x62ee('0xcf'));}}catch(_0x1cf0f6){throw new Error(_0x62ee('0xd0'));}}if(!_0x298232[_0x62ee('0x28')][_0x62ee('0x30')]('nolimit')){_0x11b16a[_0x62ee('0x11')]=qs['limit'](_0x298232[_0x62ee('0x28')][_0x62ee('0x11')]||0xa);_0x11b16a[_0x62ee('0x10')]=qs['offset'](_0x298232[_0x62ee('0x28')]['offset']);}var _0xb5d043=_0x32a2ec[_0x62ee('0x6b')](function(_0x16715d){if(_0x16715d===_0x62ee('0xc6')){var _0x29585d={'attributes':['id',_0x62ee('0xd1'),'type',_0x62ee('0xd2'),_0x62ee('0xd3'),'callerid',_0x62ee('0xd4'),_0x62ee('0xd5'),_0x62ee('0xd6'),_0x62ee('0xd7'),_0x62ee('0xd8'),_0x62ee('0xd9'),_0x62ee('0xda'),_0x62ee('0xdb'),_0x62ee('0xdc')],'where':{'ContactId':_0x298232[_0x62ee('0x5f')]['id']},'include':[{'model':db['User'],'as':'User','attributes':['id','name','fullname',_0x62ee('0xdd')]}],'order':[[_0x62ee('0xd8'),_0x62ee('0xde')]]};if(_0x298232[_0x62ee('0x28')][_0x62ee('0xcc')]){_0x29585d['where'][_0x62ee('0xd8')]={'$gte':_0x836d62[_0x62ee('0x37')],'$lte':_0x836d62['to']};}return db['VoiceCallReport'][_0x62ee('0xdf')](_0x29585d)[_0x62ee('0x16')](function(_0x400be4){_0x389d52[_0x62ee('0x12')]+=_0x400be4[_0x62ee('0x12')];return _[_0x62ee('0x6b')](_0x400be4['rows'],function(_0x52230e){var _0x3757ab=_0x52230e[_0x62ee('0x34')]({'plain':!![]});_0x3757ab[_0x62ee('0xc9')]=_0x16715d;if(_0x3757ab[_0x62ee('0xb4')]){_0x3757ab[_0x62ee('0xb4')]={'id':_0x3757ab['User']['id'],'name':_0x3757ab['User'][_0x62ee('0x1a')],'fullname':_0x3757ab['User'][_0x62ee('0xe0')],'alias':_0x3757ab[_0x62ee('0xb4')][_0x62ee('0xdd')]};}return _0x3757ab;});});}else{var _0x290d94=_[_0x62ee('0xe1')](_0x16715d)+(_0x16715d===_0x62ee('0xc2')?_0x62ee('0xe2'):'Account');var _0x2ee543={'attributes':['id',_0x62ee('0xe3'),'closedAt',_0x62ee('0xd8'),_0x62ee('0xd7'),'disposition','secondDisposition',_0x62ee('0xe4'),'UserId',_0x290d94+'Id'],'where':{'ContactId':_0x298232[_0x62ee('0x5f')]['id']},'include':[{'model':db[_0x290d94],'as':'Account','attributes':['id',_0x62ee('0x1a'),'key']},{'model':db[_0x62ee('0xb4')],'as':_0x62ee('0xe5'),'attributes':['id',_0x62ee('0x1a'),_0x62ee('0xe0')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x62ee('0x1a'),_0x62ee('0x62')],'through':{'attributes':[]}}],'order':[['createdAt',_0x62ee('0xde')]]};if(_0x298232['query'][_0x62ee('0xcc')]){_0x2ee543['where']['createdAt']={'$gte':_0x836d62[_0x62ee('0x37')],'$lte':_0x836d62['to']};}switch(_0x16715d){case _0x62ee('0xc2'):_0x2ee543[_0x62ee('0x79')][_0x62ee('0x59')](_0x62ee('0xe6'),_0x62ee('0xe7'),_0x62ee('0xe8'),_0x62ee('0xe9'),'osName','ratingMessage',_0x62ee('0xea'),_0x62ee('0xeb'),'referer');break;case _0x62ee('0xc1'):_0x2ee543[_0x62ee('0x79')][_0x62ee('0x59')](_0x62ee('0xec'),_0x62ee('0xed'));break;case'openchannel':_0x2ee543[_0x62ee('0x79')][_0x62ee('0x59')](_0x62ee('0xee'),'threadId');break;}return db[_[_0x62ee('0xe1')](_0x16715d)+_0x62ee('0xef')]['findAndCountAll'](_0x2ee543)[_0x62ee('0x16')](function(_0x1b7278){_0x389d52[_0x62ee('0x12')]+=_0x1b7278[_0x62ee('0x12')];return _[_0x62ee('0x6b')](_0x1b7278[_0x62ee('0x9a')],function(_0x20db6c){var _0x3d0e87=_0x20db6c[_0x62ee('0x34')]({'plain':!![]});_0x3d0e87['channel']=_0x16715d;if(_0x3d0e87[_0x62ee('0xe5')]){_0x3d0e87[_0x62ee('0xe5')]={'id':_0x3d0e87['Owner']['id'],'name':_0x3d0e87[_0x62ee('0xe5')][_0x62ee('0x1a')],'fullname':_0x3d0e87[_0x62ee('0xe5')][_0x62ee('0xe0')]};}return _0x3d0e87;});});}});return Promise[_0x62ee('0x5e')](_0xb5d043);})[_0x62ee('0x16')](function(_0x188f9b){return _(_0x188f9b)['flatten']()['sortBy'](_0x62ee('0xd8'))[_0x62ee('0xf0')]()['value']();})[_0x62ee('0x16')](function(_0x58e33f){_0x389d52[_0x62ee('0x9a')]=_0x11b16a[_0x62ee('0x11')]?_0x58e33f[_0x62ee('0xf1')](_0x11b16a[_0x62ee('0x10')],_0x11b16a[_0x62ee('0x10')]+_0x11b16a[_0x62ee('0x11')]):_0x58e33f;return _0x389d52;})[_0x62ee('0x16')](respondWithFilteredResult(_0x5e3edc,_0x11b16a))[_0x62ee('0x22')](handleError(_0x5e3edc,null));}; \ No newline at end of file +var _0x19c3=['additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','spread','all','Tag','Tags','tag','Phones','params','ItemType','sequelize','$and','omit','map','format','cf_%d','pickBy','startsWith','isEmpty','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes','filters','intersection','attributes','fields','order','pick','filter','options','setTags','ids','setAdditionalPhones','ContactItemType','OrderBy','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','CmContactId','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','nolimit','ContactId','includeAll','include','rows','getHopperHistories','sort','CmHopperFinal','getJscriptySessions','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','binding_keys','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','server/files/tmp','file','filename','0777','child_process','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','pid','upload','createReadStream','parse','meta','User','agent','No\x20ListId\x20specified','binding','No\x20firstName\x20column\x20specified','fork','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','importUpdates','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','openchannel','fax','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','starttime','duration','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','DESC','VoiceCallReport','findAndCountAll','startCase','Website','Account','closed','closedAt','note','disposition','secondDisposition','UserId','key','color','customerIp','customerPort','ratingType','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','Owner','sortBy','value','moment','path','squel','papaparse','ioredis','../../components/contacts','../../config/environment/shared','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','set','update','then','destroy','sendStatus','stack','name','send','index','getOptions','findAll','catch','CmContact','find','describe','tags','keys','length','cf_','columnName','displayName','query','analytics','CmCustomField','alias','custom','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','hasOwnProperty','merge','body','from','get','mergeWith','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','info','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','CmContactHasItem','CmHopperHistory','FaxQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappQueueReport','create','isArray','dialTimezone','isNil','timezones','utcOffset'];(function(_0x13945b,_0x289c94){var _0x1b1643=function(_0x18f4c3){while(--_0x18f4c3){_0x13945b['push'](_0x13945b['shift']());}};_0x1b1643(++_0x289c94);}(_0x19c3,0xa1));var _0x319c=function(_0x24bd49,_0x1fcffe){_0x24bd49=_0x24bd49-0x0;var _0x3b1ac0=_0x19c3[_0x24bd49];return _0x3b1ac0;};'use strict';var moment=require(_0x319c('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x319c('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0x319c('0x2'));var Papa=require(_0x319c('0x3'));var Redis=require(_0x319c('0x4'));var contacts=require(_0x319c('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require('../../config/environment');var shared=require(_0x319c('0x6'));var db=require(_0x319c('0x7'))['db'];config[_0x319c('0x8')]=_[_0x319c('0x9')](config[_0x319c('0x8')],{'host':_0x319c('0xa'),'port':0x18eb});var socket=require(_0x319c('0xb'))(new Redis(config[_0x319c('0x8')]));require('./cmContact.socket')['register'](socket);function respondWithResult(_0xd355a1,_0x221099){_0x221099=_0x221099||0xc8;return function(_0x964293){if(_0x964293){return _0xd355a1[_0x319c('0xc')](_0x221099)[_0x319c('0xd')](_0x964293);}};}function respondWithFilteredResult(_0x43fa5a,_0x2c1ff0){return function(_0x228bc6){if(_0x228bc6){var _0xca7f1c=typeof _0x2c1ff0[_0x319c('0xe')]===_0x319c('0xf')&&typeof _0x2c1ff0[_0x319c('0x10')]===_0x319c('0xf');var _0x45a23d=_0x228bc6['count'];var _0x50a416=_0xca7f1c?0x0:_0x2c1ff0[_0x319c('0xe')];var _0x3678e6=_0xca7f1c?_0x228bc6[_0x319c('0x11')]:_0x2c1ff0[_0x319c('0xe')]+_0x2c1ff0[_0x319c('0x10')];var _0x172842;if(_0x3678e6>=_0x45a23d){_0x3678e6=_0x45a23d;_0x172842=0xc8;}else{_0x172842=0xce;}_0x43fa5a[_0x319c('0xc')](_0x172842);return _0x43fa5a[_0x319c('0x12')]('Content-Range',_0x50a416+'-'+_0x3678e6+'/'+_0x45a23d)[_0x319c('0xd')](_0x228bc6);}return null;};}function saveUpdates(_0x2740b7){return function(_0x365283){if(_0x365283){return _0x365283[_0x319c('0x13')](_0x2740b7)[_0x319c('0x14')](function(_0x464673){return _0x464673;});}return null;};}function removeEntity(_0x1c2612){return function(_0x4b7dfd){if(_0x4b7dfd){return _0x4b7dfd[_0x319c('0x15')]()[_0x319c('0x14')](function(){_0x1c2612[_0x319c('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14423c){return function(_0x34743c){if(!_0x34743c){_0x14423c[_0x319c('0x16')](0x194);}return _0x34743c;};}function handleError(_0x506dff,_0x58fa32){_0x58fa32=_0x58fa32||0x1f4;return function(_0x5a2316){logger['error'](_0x5a2316[_0x319c('0x17')]);if(_0x5a2316[_0x319c('0x18')]){delete _0x5a2316[_0x319c('0x18')];}_0x506dff[_0x319c('0xc')](_0x58fa32)[_0x319c('0x19')](_0x5a2316);};}exports[_0x319c('0x1a')]=function(_0x1597cf,_0x9aea1e){var _0x4219e8={};return contacts['describe']()['then'](function(_0x4b7575){_0x4219e8=qs[_0x319c('0x1b')](_0x4b7575,_0x1597cf);return contacts[_0x319c('0x1c')](_0x1597cf['query'],_0x1597cf['user'],_0x4219e8,_0x4b7575);})[_0x319c('0x14')](respondWithFilteredResult(_0x9aea1e,_0x4219e8))[_0x319c('0x1d')](handleError(_0x9aea1e,null));};exports[_0x319c('0x15')]=function(_0xccb24e,_0x1e4707){return db[_0x319c('0x1e')][_0x319c('0x1f')]({'where':{'id':_0xccb24e['params']['id']}})[_0x319c('0x14')](handleEntityNotFound(_0x1e4707,null))[_0x319c('0x14')](removeEntity(_0x1e4707,null))[_0x319c('0x1d')](handleError(_0x1e4707,null));};exports[_0x319c('0x20')]=function(_0x32098a,_0x501f5f){return db[_0x319c('0x1e')][_0x319c('0x20')]()['then'](function(_0x286f39){delete _0x286f39[_0x319c('0x21')];for(var _0x530ef2=0x0;_0x530ef20x0){return new Promise(function(_0x2c7a8d){var _0x18a73b=[];for(var _0x272894=0x0;_0x272894<_0x5024fe['length'];_0x272894++){_0x18a73b['push'](insertAdditionalPhones(_0x5024fe[_0x272894]['contact'],_0x5024fe[_0x272894]['additionalPhones']));}Promise[_0x319c('0x5c')](_0x18a73b)[_0x319c('0x14')](function(){_0x2c7a8d(0x1);});})[_0x319c('0x14')](function(){return{'success':_0x11c5ae,'failure':_0x3e852f,'duplicates':_0x4c2a94};});}else{return{'success':_0x11c5ae,'failure':_0x3e852f,'duplicates':_0x4c2a94};}}})[_0x319c('0x14')](respondWithResult(_0x3dddc9,0xc9))[_0x319c('0x1d')](handleError(_0x3dddc9,null));};exports['show']=function(_0x474b38,_0x45fcde){var _0xaf2386;return db[_0x319c('0x1e')]['describe']()[_0x319c('0x14')](function(_0x47d27b){return db[_0x319c('0x1e')][_0x319c('0x1f')]({'where':{'id':_0x474b38['params']['id']},'include':[{'model':db[_0x319c('0x5d')],'as':_0x319c('0x5e'),'attributes':['id',_0x319c('0x18'),'color'],'required':_0x474b38[_0x319c('0x27')][_0x319c('0x5f')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x319c('0x60'),'where':{'CmContactId':_0x474b38[_0x319c('0x61')]['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0x319c('0x62')}]}],'order':[db[_0x319c('0x63')]['literal']('Phones.OrderBy')],'attributes':_[_0x319c('0x22')](_0x47d27b)});})['then'](function(_0x2555bd){if(!_[_0x319c('0x4f')](_0x2555bd)){_0xaf2386=_0x2555bd[_0x319c('0x33')]({'plain':!![]});var _0xe95c3={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2555bd&&_0x2555bd['ListId']){if(_0x2555bd['ListId']){_0xe95c3[_0x319c('0x58')][_0x319c('0x64')][_0x319c('0x57')]({'ListId':{'$ne':_0x2555bd[_0x319c('0x59')]}});}}return db[_0x319c('0x29')]['findAll'](_0xe95c3);}})[_0x319c('0x14')](function(_0x11d2b9){if(!_[_0x319c('0x4f')](_0x11d2b9)){return _[_0x319c('0x65')](_0xaf2386,_[_0x319c('0x66')](_0x11d2b9,function(_0x2fe3ec){return util[_0x319c('0x67')](_0x319c('0x68'),_0x2fe3ec['id']);}));}})[_0x319c('0x14')](handleEntityNotFound(_0x45fcde,null))[_0x319c('0x14')](respondWithResult(_0x45fcde,null))[_0x319c('0x1d')](handleError(_0x45fcde,null));};exports[_0x319c('0x13')]=function(_0x2e7100,_0x2d9336){var _0x1f8dd9;if(_0x2e7100[_0x319c('0x31')]['id']){delete _0x2e7100[_0x319c('0x31')]['id'];}if(!_[_0x319c('0x4f')](_0x2e7100[_0x319c('0x31')]['dialTimezone'])){var _0x239106=_0x2e7100[_0x319c('0x31')][_0x319c('0x4e')];if(!_[_0x319c('0x4f')](shared[_0x319c('0x50')][_0x239106]))_0x2e7100['body'][_0x319c('0x51')]=shared[_0x319c('0x50')][_0x239106]['utcOffset'];}return db['CmContact'][_0x319c('0x1f')]({'where':{'id':_0x2e7100[_0x319c('0x61')]['id']}})[_0x319c('0x14')](handleEntityNotFound(_0x2d9336,null))[_0x319c('0x14')](saveUpdates(_0x2e7100['body'],null))[_0x319c('0x14')](function(_0x2856aa){_0x1f8dd9=_0x2856aa;var _0x40e95a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2856aa&&_0x2856aa[_0x319c('0x59')]){if(_0x2856aa[_0x319c('0x59')]){_0x40e95a['where']['$and'][_0x319c('0x57')]({'ListId':{'$ne':_0x2856aa[_0x319c('0x59')]}});}}return db[_0x319c('0x29')][_0x319c('0x1c')](_0x40e95a);})['then'](function(_0x11ae23){if(_0x11ae23){return _['omit'](_[_0x319c('0x69')](_0x2e7100[_0x319c('0x31')],function(_0x413ffe,_0x5c2eb7){return _[_0x319c('0x6a')](_0x5c2eb7,_0x319c('0x24'));}),_[_0x319c('0x66')](_0x11ae23,function(_0x29e458){return util[_0x319c('0x67')]('cf_%d',_0x29e458['id']);}));}})[_0x319c('0x14')](function(_0x494021){if(_0x494021&&!_[_0x319c('0x6b')](_0x494021)){var _0x327358=squel[_0x319c('0x13')]()[_0x319c('0x6c')](_0x319c('0x6d'))[_0x319c('0x6e')](_0x494021)['where'](_0x319c('0x6f'),_0x2e7100[_0x319c('0x61')]['id'])[_0x319c('0x70')]();return db[_0x319c('0x63')][_0x319c('0x27')](_0x327358[_0x319c('0x71')],{'replacements':_0x327358['values']});}})[_0x319c('0x14')](function(){if(_0x2e7100['body'][_0x319c('0x72')]&&_0x1f8dd9){return db['CmHopper'][_0x319c('0x13')]({'phone':_0x2e7100[_0x319c('0x31')][_0x319c('0x72')],'OrderBy':0x0},{'where':{'ContactId':_0x1f8dd9['id']}});}})[_0x319c('0x14')](function(){return _0x1f8dd9;})[_0x319c('0x14')](respondWithResult(_0x2d9336,null))[_0x319c('0x1d')](handleError(_0x2d9336,null));};exports[_0x319c('0x73')]=function(_0x1f035b,_0x3ec0e9){var _0x22d868={};var _0x50e1f8={};var _0x2557a5;var _0x65c68e;return db['CmContact'][_0x319c('0x74')]({'where':{'id':_0x1f035b['params']['id']}})[_0x319c('0x14')](handleEntityNotFound(_0x3ec0e9,null))[_0x319c('0x14')](function(_0x1614d8){if(_0x1614d8){_0x2557a5=_0x1614d8;_0x50e1f8[_0x319c('0x75')]=_[_0x319c('0x22')](db[_0x319c('0x5d')][_0x319c('0x76')]);_0x50e1f8[_0x319c('0x27')]=_['keys'](_0x1f035b['query']);_0x50e1f8[_0x319c('0x77')]=_[_0x319c('0x78')](_0x50e1f8[_0x319c('0x75')],_0x50e1f8[_0x319c('0x27')]);_0x22d868[_0x319c('0x79')]=_[_0x319c('0x78')](_0x50e1f8[_0x319c('0x75')],qs[_0x319c('0x7a')](_0x1f035b[_0x319c('0x27')][_0x319c('0x7a')]));_0x22d868[_0x319c('0x79')]=_0x22d868[_0x319c('0x79')]['length']?_0x22d868[_0x319c('0x79')]:_0x50e1f8[_0x319c('0x75')];_0x22d868[_0x319c('0x7b')]=qs['sort'](_0x1f035b[_0x319c('0x27')]['sort']);_0x22d868['where']=qs[_0x319c('0x77')](_[_0x319c('0x7c')](_0x1f035b[_0x319c('0x27')],_0x50e1f8[_0x319c('0x77')]));if(_0x1f035b[_0x319c('0x27')][_0x319c('0x7d')]){_0x22d868['where']=_['merge'](_0x22d868[_0x319c('0x58')],{'$or':_['map'](_0x22d868['attributes'],function(_0x2dc16f){var _0x47e8d0={};_0x47e8d0[_0x2dc16f]={'$like':'%'+_0x1f035b[_0x319c('0x27')][_0x319c('0x7d')]+'%'};return _0x47e8d0;})});}_0x22d868=_['merge']({},_0x22d868,_0x1f035b[_0x319c('0x7e')]);return _0x2557a5[_0x319c('0x73')](_0x22d868);}})[_0x319c('0x14')](function(_0x2fa7ac){if(_0x2fa7ac){_0x65c68e=_0x2fa7ac['length'];if(!_0x1f035b[_0x319c('0x27')][_0x319c('0x2f')]('nolimit')){_0x22d868['limit']=qs[_0x319c('0x10')](_0x1f035b[_0x319c('0x27')][_0x319c('0x10')]);_0x22d868[_0x319c('0xe')]=qs['offset'](_0x1f035b[_0x319c('0x27')][_0x319c('0xe')]);}return _0x2557a5[_0x319c('0x73')](_0x22d868);}})[_0x319c('0x14')](function(_0x4b1dd4){if(_0x4b1dd4){return _0x4b1dd4?{'count':_0x65c68e,'rows':_0x4b1dd4}:null;}})['then'](respondWithResult(_0x3ec0e9,null))[_0x319c('0x1d')](handleError(_0x3ec0e9,null));};exports['setTags']=function(_0x43d208,_0x436310){if(_0x43d208[_0x319c('0x31')]['id']){delete _0x43d208[_0x319c('0x31')]['id'];}return db[_0x319c('0x1e')]['findOne']({'where':{'id':_0x43d208[_0x319c('0x61')]['id']}})[_0x319c('0x14')](handleEntityNotFound(_0x436310,null))[_0x319c('0x14')](function(_0x5cf084){if(_0x5cf084){return _0x5cf084[_0x319c('0x7f')](_0x43d208[_0x319c('0x31')][_0x319c('0x80')]||[]);}return null;})['then'](respondWithResult(_0x436310,null))[_0x319c('0x1d')](handleError(_0x436310,null));};exports[_0x319c('0x81')]=function(_0x3ea6e8,_0x50b6e6){var _0x5ce864=[];_0x5ce864[_0x319c('0x57')](addAdditionalPhones(_0x3ea6e8[_0x319c('0x31')]));Promise[_0x319c('0x5c')](_0x5ce864)['then'](function(){_0x5ce864=[];_0x5ce864[_0x319c('0x57')](deleteCmHopperPhones(_0x3ea6e8[_0x319c('0x31')]['id']));_0x5ce864[_0x319c('0x57')](addCmHopperPhones(_0x3ea6e8[_0x319c('0x31')]['id']));Promise[_0x319c('0x5c')](_0x5ce864)[_0x319c('0x14')](function(){return[0x1];})[_0x319c('0x14')](respondWithResult(_0x50b6e6,null));});};function addAdditionalPhones(_0x31e884){var _0x46b8f1;return new Promise(function(_0x5f2776){return db[_0x319c('0x44')][_0x319c('0x15')]({'where':{'CmContactId':_0x31e884['id']}})['then'](function(){db[_0x319c('0x82')][_0x319c('0x1c')]({'raw':!![],'attributes':['id',_0x319c('0x83')]})[_0x319c('0x14')](function(_0x1387d8){var _0x180206=[];for(var _0x439c03=0x0;_0x439c03<_0x31e884['items']['length'];_0x439c03++){var _0x55e8cc=_0x31e884[_0x319c('0x84')]?_[_0x319c('0x4f')](_0x31e884[_0x319c('0x84')][_0x439c03])?'':_0x31e884[_0x319c('0x84')][_0x439c03]:_0x31e884[_0x319c('0x85')][_0x439c03][_0x319c('0x86')]?_0x31e884[_0x319c('0x85')][_0x439c03][_0x319c('0x86')]:'';var _0x5a2068=_[_0x319c('0x4f')](_0x31e884['items'][_0x439c03][_0x319c('0x87')])?'':_0x31e884[_0x319c('0x85')][_0x439c03][_0x319c('0x87')];var _0xe13431=_0x55e8cc+':'+_0x31e884[_0x319c('0x85')][_0x439c03][_0x319c('0x72')]+'§'+_0x5a2068;if(_[_0x319c('0x4f')](_0x46b8f1))_0x46b8f1=_0xe13431;else _0x46b8f1+=';'+_0xe13431;var _0x58f418=null;var _0x21a3f=null;if(_0x31e884['item_types']){if(!_['isNil'](_0x31e884[_0x319c('0x84')][_0x439c03])){_0x21a3f=_['find'](_0x1387d8,function(_0x5aeafc){return _0x5aeafc['id']===_0x31e884['item_types'][_0x439c03];});if(!_[_0x319c('0x4f')](_0x21a3f)){_0x58f418=_0x21a3f['OrderBy'];}}}else{if(!_[_0x319c('0x4f')](_0x31e884[_0x319c('0x85')][_0x439c03])){_0x21a3f=_[_0x319c('0x1f')](_0x1387d8,function(_0x597e6a){return _0x597e6a['id']===_0x31e884[_0x319c('0x85')][_0x439c03][_0x319c('0x86')];});if(!_['isNil'](_0x21a3f)){_0x58f418=_0x439c03;}}}if(_[_0x319c('0x4f')](_0x58f418)){_0x58f418=0x64;}_0x180206[_0x319c('0x57')](addAdditionalPhone(_0x31e884['id'],_0x31e884[_0x319c('0x85')][_0x439c03]['phone'],_0x31e884[_0x319c('0x84')]?_[_0x319c('0x4f')](_0x31e884[_0x319c('0x84')][_0x439c03])?null:_0x31e884[_0x319c('0x84')][_0x439c03]:_0x31e884[_0x319c('0x85')][_0x439c03]['ItemTypeId']?_0x31e884['items'][_0x439c03][_0x319c('0x86')]:null,_0x58f418,_0x5a2068));}Promise[_0x319c('0x5c')](_0x180206)[_0x319c('0x14')](function(){db['CmContact'][_0x319c('0x13')]({'AdditionalPhones':_0x46b8f1},{'where':{'id':_0x31e884['id']}})[_0x319c('0x14')](function(){_0x5f2776(0x1);});});});});});}function addAdditionalPhone(_0x5508eb,_0x1f9892,_0x1682dc,_0xbd71fd,_0x5d0fbd){return db[_0x319c('0x44')]['find']({'where':{'CmContactId':_0x5508eb,'item':_0x1f9892}})[_0x319c('0x14')](function(_0x339f91){if(_0x339f91)logger['info'](_0x319c('0x88'),_0x339f91);else{db[_0x319c('0x44')][_0x319c('0x4c')]({'CmContactId':_0x5508eb,'item':_0x1f9892,'ItemTypeId':_0x1682dc,'OrderBy':_0xbd71fd,'ItemClass':_0x319c('0x89'),'description':_0x5d0fbd});}});}function deleteCmHopperPhones(_0x318ac0){return new Promise(function(_0x494cfa){return db[_0x319c('0x37')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x318ac0}})[_0x319c('0x14')](function(_0x2d1df4){db[_0x319c('0x8a')][_0x319c('0x15')]({'where':{'CmHopperId':{'$in':_[_0x319c('0x66')](_0x2d1df4,'id')}}});})['then'](function(){_0x494cfa(0x1);});});}function addCmHopperPhones(_0x46d982){return new Promise(function(_0x3c0d60){return db[_0x319c('0x37')][_0x319c('0x1c')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x46d982}})['then'](function(_0x2d705f){var _0x1478e6=[];_[_0x319c('0x66')](_0x2d705f,function(_0x2d7e2a){_0x1478e6['push'](createCmHopperPhone(_0x46d982,_0x2d7e2a['id']));});Promise[_0x319c('0x5c')](_0x1478e6)[_0x319c('0x14')](function(){_0x3c0d60(0x1);});});});}function createCmHopperPhone(_0x52b56a,_0x531208){return new Promise(function(_0x1727df){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':[_0x319c('0x8b'),_0x319c('0x83')],'where':{'CmContactId':_0x52b56a,'ItemClass':_0x319c('0x89')},'include':[{'model':db['ContactItemType'],'attributes':[_0x319c('0x83')],'as':_0x319c('0x62')}],'order':[_0x319c('0x83'),db[_0x319c('0x63')]['literal'](_0x319c('0x8c'))]})[_0x319c('0x14')](function(_0x5c2096){var _0x14e771=0x1;var _0x10e00f=_[_0x319c('0x66')](_0x5c2096,function(_0x2e358b){_0x2e358b[_0x319c('0x8d')]=_0x531208;_0x2e358b[_0x319c('0x72')]=_0x2e358b[_0x319c('0x8b')];_0x2e358b['OrderBy']=_0x14e771;delete _0x2e358b[_0x319c('0x8e')];_0x14e771=_0x14e771+0x1;return _0x2e358b;});return db[_0x319c('0x8a')][_0x319c('0x53')](_0x10e00f,{});})[_0x319c('0x14')](function(){_0x1727df(0x1);});});}function insertAdditionalPhones(_0x6b0777,_0x228e53){return new Promise(function(_0x5aaf73){var _0x6347c7=[];for(var _0x1655a0=0x0;_0x1655a0<_0x228e53['length'];_0x1655a0++){var _0x2f1468=_0x228e53[_0x1655a0];_0x6347c7['push'](parseContactItemType(_0x2f1468));}Promise[_0x319c('0x5c')](_0x6347c7)[_0x319c('0x14')](function(){var _0x4994bc={'id':_0x6b0777['id'],'items':_0x228e53};return addAdditionalPhones(_0x4994bc)[_0x319c('0x14')](function(){return addCmHopperPhones(_0x6b0777['id']);});})['then'](function(){_0x5aaf73(_0x6b0777);});});}function parseContactItemType(_0x50b314){return new Promise(function(_0x481bcd){if(_0x50b314[_0x319c('0x2f')](_0x319c('0x86'))){_0x481bcd(_0x50b314);}else{return db[_0x319c('0x82')][_0x319c('0x1f')]({'where':{'name':_0x50b314[_0x319c('0x62')]}})[_0x319c('0x14')](function(_0x105ee1){if(_[_0x319c('0x4f')](_0x105ee1))_0x50b314[_0x319c('0x86')]=null;else _0x50b314['ItemTypeId']=_0x105ee1['id'];_0x481bcd(_0x50b314);});}});}exports['getAdditionalPhones']=function(_0x253db,_0x2e932c){return db[_0x319c('0x44')]['findAll']({'raw':!![],'where':{'CmContactId':_0x253db[_0x319c('0x61')]['id'],'ItemClass':_0x319c('0x89')},'include':[{'model':db[_0x319c('0x82')],'as':_0x319c('0x62')}],'order':[['OrderBy'],[db['sequelize']['literal'](_0x319c('0x8c'))]]})[_0x319c('0x14')](function(_0x385f0a){return _0x385f0a;})[_0x319c('0x14')](respondWithResult(_0x2e932c,null))[_0x319c('0x1d')](handleError(_0x2e932c,null));};exports['duplicateAdditionalPhones']=function(_0x3ce706,_0x12a6e1){return db['CmContactHasItem'][_0x319c('0x1c')]({'raw':!![],'where':{'CmContactId':_0x3ce706[_0x319c('0x31')]['fromContactId']}})[_0x319c('0x14')](function(_0x33c7d3){var _0x4a3425=_[_0x319c('0x66')](_0x33c7d3,function(_0x5d9400){_0x5d9400[_0x319c('0x8f')]=_0x3ce706[_0x319c('0x31')][_0x319c('0x90')];return _0x5d9400;});return db[_0x319c('0x44')][_0x319c('0x53')](_0x4a3425,{});})[_0x319c('0x14')](function(){return addCmHopperPhones(_0x3ce706[_0x319c('0x31')][_0x319c('0x90')]);})[_0x319c('0x14')](function(){return['ok'];})['then'](respondWithResult(_0x12a6e1,null))[_0x319c('0x1d')](handleError(_0x12a6e1,null));};exports[_0x319c('0x91')]=function(_0x309ff6,_0x1bbdb5){var _0x980645=[];_0x980645['push'](createCmHopperPhone(_0x309ff6[_0x319c('0x31')]['id'],_0x309ff6[_0x319c('0x31')][_0x319c('0x92')]));Promise[_0x319c('0x5c')](_0x980645)[_0x319c('0x14')](function(){return[0x1];})[_0x319c('0x14')](respondWithResult(_0x1bbdb5,null));};exports[_0x319c('0x93')]=function(_0x1cf8c2,_0xebbdb0){var _0x5ec564={'raw':![],'where':{}};var _0x5cb11e={};var _0x5c143e={'count':0x0,'rows':[]};return db['CmContact'][_0x319c('0x74')]({'where':{'id':_0x1cf8c2[_0x319c('0x61')]['id']}})[_0x319c('0x14')](handleEntityNotFound(_0xebbdb0,null))[_0x319c('0x14')](function(_0x4e7e36){if(_0x4e7e36){_0x5cb11e[_0x319c('0x75')]=_[_0x319c('0x22')](db['CmHopper'][_0x319c('0x76')]);_0x5cb11e[_0x319c('0x27')]=_[_0x319c('0x22')](_0x1cf8c2[_0x319c('0x27')]);_0x5cb11e['filters']=_[_0x319c('0x78')](_0x5cb11e[_0x319c('0x75')],_0x5cb11e[_0x319c('0x27')]);_0x5ec564[_0x319c('0x79')]=_[_0x319c('0x78')](_0x5cb11e[_0x319c('0x75')],qs[_0x319c('0x7a')](_0x1cf8c2['query'][_0x319c('0x7a')]));_0x5ec564['attributes']=_0x5ec564['attributes'][_0x319c('0x23')]?_0x5ec564['attributes']:_0x5cb11e['model'];if(!_0x1cf8c2[_0x319c('0x27')][_0x319c('0x2f')](_0x319c('0x94'))){_0x5ec564[_0x319c('0x10')]=qs[_0x319c('0x10')](_0x1cf8c2[_0x319c('0x27')]['limit']);_0x5ec564[_0x319c('0xe')]=qs[_0x319c('0xe')](_0x1cf8c2[_0x319c('0x27')][_0x319c('0xe')]);}_0x5ec564[_0x319c('0x7b')]=qs['sort'](_0x1cf8c2[_0x319c('0x27')]['sort']);_0x5ec564[_0x319c('0x58')]=qs['filters'](_['pick'](_0x1cf8c2[_0x319c('0x27')],_0x5cb11e[_0x319c('0x77')]));_0x5ec564['where'][_0x319c('0x95')]=_0x4e7e36['id'];if(_0x1cf8c2[_0x319c('0x27')][_0x319c('0x7d')]){_0x5ec564[_0x319c('0x58')]=_['merge'](_0x5ec564[_0x319c('0x58')],{'$or':_[_0x319c('0x66')](_0x5ec564['attributes'],function(_0x535fee){var _0x157b5e={};_0x157b5e[_0x535fee]={'$like':'%'+_0x1cf8c2['query']['filter']+'%'};return _0x157b5e;})});}_0x5ec564=_[_0x319c('0x30')]({},_0x5ec564,_0x1cf8c2[_0x319c('0x7e')]);return db[_0x319c('0x37')][_0x319c('0x11')]({'where':_0x5ec564[_0x319c('0x58')]})[_0x319c('0x14')](function(_0x8e2db4){_0x5c143e[_0x319c('0x11')]=_0x8e2db4;if(_0x1cf8c2[_0x319c('0x27')][_0x319c('0x96')]){_0x5ec564[_0x319c('0x97')]=[{'all':!![]}];}return db['CmHopper'][_0x319c('0x1c')](_0x5ec564);})[_0x319c('0x14')](function(_0x8585a7){_0x5c143e[_0x319c('0x98')]=_0x8585a7;return _0x5c143e;});}})[_0x319c('0x14')](respondWithFilteredResult(_0xebbdb0,_0x5ec564))[_0x319c('0x1d')](handleError(_0xebbdb0,null));};exports[_0x319c('0x99')]=function(_0x26e5b2,_0x41e44a){var _0xaf6b09={'raw':!![],'where':{}};var _0x4be463={};var _0x430711={'count':0x0,'rows':[]};return db[_0x319c('0x1e')][_0x319c('0x74')]({'where':{'id':_0x26e5b2[_0x319c('0x61')]['id']}})[_0x319c('0x14')](handleEntityNotFound(_0x41e44a,null))['then'](function(_0x26e08e){if(_0x26e08e){_0x4be463[_0x319c('0x75')]=_[_0x319c('0x22')](db['CmHopperHistory']['rawAttributes']);_0x4be463['query']=_['keys'](_0x26e5b2['query']);_0x4be463['filters']=_[_0x319c('0x78')](_0x4be463[_0x319c('0x75')],_0x4be463[_0x319c('0x27')]);_0xaf6b09[_0x319c('0x79')]=_[_0x319c('0x78')](_0x4be463[_0x319c('0x75')],qs[_0x319c('0x7a')](_0x26e5b2[_0x319c('0x27')][_0x319c('0x7a')]));_0xaf6b09['attributes']=_0xaf6b09[_0x319c('0x79')]['length']?_0xaf6b09['attributes']:_0x4be463['model'];if(!_0x26e5b2['query'][_0x319c('0x2f')](_0x319c('0x94'))){_0xaf6b09[_0x319c('0x10')]=qs[_0x319c('0x10')](_0x26e5b2[_0x319c('0x27')][_0x319c('0x10')]);_0xaf6b09[_0x319c('0xe')]=qs[_0x319c('0xe')](_0x26e5b2[_0x319c('0x27')][_0x319c('0xe')]);}_0xaf6b09['order']=qs[_0x319c('0x9a')](_0x26e5b2[_0x319c('0x27')][_0x319c('0x9a')]);_0xaf6b09[_0x319c('0x58')]=qs[_0x319c('0x77')](_[_0x319c('0x7c')](_0x26e5b2[_0x319c('0x27')],_0x4be463[_0x319c('0x77')]));_0xaf6b09[_0x319c('0x58')][_0x319c('0x95')]=_0x26e08e['id'];if(_0x26e5b2[_0x319c('0x27')][_0x319c('0x7d')]){_0xaf6b09[_0x319c('0x58')]=_[_0x319c('0x30')](_0xaf6b09['where'],{'$or':_['map'](_0xaf6b09[_0x319c('0x79')],function(_0x41b356){var _0x9fbee={};_0x9fbee[_0x41b356]={'$like':'%'+_0x26e5b2[_0x319c('0x27')][_0x319c('0x7d')]+'%'};return _0x9fbee;})});}_0xaf6b09=_['merge']({},_0xaf6b09,_0x26e5b2[_0x319c('0x7e')]);return db[_0x319c('0x45')][_0x319c('0x11')]({'where':_0xaf6b09[_0x319c('0x58')]})['then'](function(_0x52cd67){_0x430711[_0x319c('0x11')]=_0x52cd67;if(_0x26e5b2[_0x319c('0x27')][_0x319c('0x96')]){_0xaf6b09['include']=[{'all':!![]}];}return db[_0x319c('0x45')][_0x319c('0x1c')](_0xaf6b09);})[_0x319c('0x14')](function(_0x10fe88){_0x430711[_0x319c('0x98')]=_0x10fe88;return _0x430711;});}})[_0x319c('0x14')](respondWithFilteredResult(_0x41e44a,_0xaf6b09))[_0x319c('0x1d')](handleError(_0x41e44a,null));};exports['getHopperFinals']=function(_0x37cb3a,_0x50b901){var _0x4c992e={'raw':!![],'where':{}};var _0x2fc2aa={};var _0x43ef71={'count':0x0,'rows':[]};return db[_0x319c('0x1e')][_0x319c('0x74')]({'where':{'id':_0x37cb3a[_0x319c('0x61')]['id']}})['then'](handleEntityNotFound(_0x50b901,null))[_0x319c('0x14')](function(_0x5d615b){if(_0x5d615b){_0x2fc2aa[_0x319c('0x75')]=_['keys'](db[_0x319c('0x9b')][_0x319c('0x76')]);_0x2fc2aa['query']=_[_0x319c('0x22')](_0x37cb3a[_0x319c('0x27')]);_0x2fc2aa[_0x319c('0x77')]=_[_0x319c('0x78')](_0x2fc2aa[_0x319c('0x75')],_0x2fc2aa[_0x319c('0x27')]);_0x4c992e['attributes']=_[_0x319c('0x78')](_0x2fc2aa['model'],qs[_0x319c('0x7a')](_0x37cb3a[_0x319c('0x27')][_0x319c('0x7a')]));_0x4c992e[_0x319c('0x79')]=_0x4c992e[_0x319c('0x79')][_0x319c('0x23')]?_0x4c992e[_0x319c('0x79')]:_0x2fc2aa[_0x319c('0x75')];if(!_0x37cb3a[_0x319c('0x27')][_0x319c('0x2f')]('nolimit')){_0x4c992e['limit']=qs['limit'](_0x37cb3a['query'][_0x319c('0x10')]);_0x4c992e[_0x319c('0xe')]=qs[_0x319c('0xe')](_0x37cb3a[_0x319c('0x27')]['offset']);}_0x4c992e['order']=qs[_0x319c('0x9a')](_0x37cb3a[_0x319c('0x27')][_0x319c('0x9a')]);_0x4c992e[_0x319c('0x58')]=qs['filters'](_[_0x319c('0x7c')](_0x37cb3a[_0x319c('0x27')],_0x2fc2aa[_0x319c('0x77')]));_0x4c992e['where'][_0x319c('0x95')]=_0x5d615b['id'];if(_0x37cb3a[_0x319c('0x27')][_0x319c('0x7d')]){_0x4c992e[_0x319c('0x58')]=_[_0x319c('0x30')](_0x4c992e['where'],{'$or':_[_0x319c('0x66')](_0x4c992e[_0x319c('0x79')],function(_0x432d66){var _0x53e587={};_0x53e587[_0x432d66]={'$like':'%'+_0x37cb3a['query']['filter']+'%'};return _0x53e587;})});}_0x4c992e=_[_0x319c('0x30')]({},_0x4c992e,_0x37cb3a['options']);return db[_0x319c('0x9b')][_0x319c('0x11')]({'where':_0x4c992e[_0x319c('0x58')]})['then'](function(_0xb306e0){_0x43ef71['count']=_0xb306e0;if(_0x37cb3a[_0x319c('0x27')]['includeAll']){_0x4c992e['include']=[{'all':!![]}];}return db[_0x319c('0x9b')][_0x319c('0x1c')](_0x4c992e);})[_0x319c('0x14')](function(_0x712e18){_0x43ef71[_0x319c('0x98')]=_0x712e18;return _0x43ef71;});}})[_0x319c('0x14')](respondWithFilteredResult(_0x50b901,_0x4c992e))[_0x319c('0x1d')](handleError(_0x50b901,null));};exports[_0x319c('0x9c')]=function(_0x399e07,_0x5628f5){var _0x4bcc10={'raw':!![],'where':{}};var _0x206374={};var _0x1b386a={'count':0x0,'rows':[]};return db[_0x319c('0x1e')][_0x319c('0x74')]({'where':{'id':_0x399e07[_0x319c('0x61')]['id']}})['then'](handleEntityNotFound(_0x5628f5,null))[_0x319c('0x14')](function(_0x399b8e){if(_0x399b8e){_0x206374[_0x319c('0x75')]=_[_0x319c('0x22')](db[_0x319c('0x49')]['rawAttributes']);_0x206374[_0x319c('0x27')]=_['keys'](_0x399e07[_0x319c('0x27')]);_0x206374[_0x319c('0x77')]=_[_0x319c('0x78')](_0x206374[_0x319c('0x75')],_0x206374[_0x319c('0x27')]);_0x4bcc10[_0x319c('0x79')]=_['intersection'](_0x206374[_0x319c('0x75')],qs[_0x319c('0x7a')](_0x399e07['query']['fields']));_0x4bcc10[_0x319c('0x79')]=_0x4bcc10[_0x319c('0x79')][_0x319c('0x23')]?_0x4bcc10['attributes']:_0x206374[_0x319c('0x75')];if(!_0x399e07[_0x319c('0x27')][_0x319c('0x2f')](_0x319c('0x94'))){_0x4bcc10[_0x319c('0x10')]=qs[_0x319c('0x10')](_0x399e07[_0x319c('0x27')][_0x319c('0x10')]);_0x4bcc10['offset']=qs[_0x319c('0xe')](_0x399e07[_0x319c('0x27')]['offset']);}_0x4bcc10[_0x319c('0x7b')]=qs[_0x319c('0x9a')](_0x399e07['query']['sort']);_0x4bcc10[_0x319c('0x58')]=qs['filters'](_[_0x319c('0x7c')](_0x399e07[_0x319c('0x27')],_0x206374[_0x319c('0x77')]));_0x4bcc10[_0x319c('0x58')][_0x319c('0x95')]=_0x399b8e['id'];if(_0x399e07['query'][_0x319c('0x7d')]){_0x4bcc10['where']=_[_0x319c('0x30')](_0x4bcc10['where'],{'$or':_['map'](_0x4bcc10[_0x319c('0x79')],function(_0x28eaa2){var _0x56ce02={};_0x56ce02[_0x28eaa2]={'$like':'%'+_0x399e07[_0x319c('0x27')][_0x319c('0x7d')]+'%'};return _0x56ce02;})});}_0x4bcc10=_[_0x319c('0x30')]({},_0x4bcc10,_0x399e07[_0x319c('0x7e')]);return db[_0x319c('0x49')][_0x319c('0x11')]({'where':_0x4bcc10[_0x319c('0x58')]})['then'](function(_0x349d36){_0x1b386a[_0x319c('0x11')]=_0x349d36;if(_0x399e07[_0x319c('0x27')][_0x319c('0x96')]){_0x4bcc10[_0x319c('0x97')]=[{'all':!![]}];}return db[_0x319c('0x49')][_0x319c('0x1c')](_0x4bcc10);})[_0x319c('0x14')](function(_0x3f8f23){_0x1b386a[_0x319c('0x98')]=_0x3f8f23;return _0x1b386a;});}})[_0x319c('0x14')](respondWithFilteredResult(_0x5628f5,_0x4bcc10))[_0x319c('0x1d')](handleError(_0x5628f5,null));};exports['uploadCsv']=function(_0x219fc4,_0x4be719){try{if(!_0x219fc4[_0x319c('0x31')]['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x219fc4[_0x319c('0x31')]['binding_keys']){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x219fc4['body']['binding_values']){throw new Error(_0x319c('0x9d'));}if(!_0x219fc4[_0x319c('0x31')]['socket_timestamp']){throw new Error(_0x319c('0x9e'));}var _0x168284=_0x219fc4['body'][_0x319c('0x9f')][_0x319c('0xa0')](',');var _0x20985d=_0x219fc4[_0x319c('0x31')][_0x319c('0xa1')]['split'](',');if(!_0x168284[_0x319c('0x23')]||!_0x20985d[_0x319c('0x23')]||_0x168284[_0x319c('0x23')]!==_0x20985d[_0x319c('0x23')]){throw new Error(_0x319c('0xa2'));}_0x219fc4[_0x319c('0x31')][_0x319c('0x7a')]=_[_0x319c('0xa3')](_0x168284,_0x20985d);if(!_0x219fc4['body'][_0x319c('0x7a')][_0x319c('0x72')]){throw new Error(_0x319c('0xa4'));}if(!_0x219fc4[_0x319c('0x31')][_0x319c('0x7a')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x44c283=path[_0x319c('0x35')](config['root'],_0x319c('0xa5'),_0x219fc4[_0x319c('0xa6')][_0x319c('0xa7')]);fs['chmodSync'](_0x44c283,parseInt(_0x319c('0xa8'),0x8));var _0x4777e4=require(_0x319c('0xa9'))['fork'](path['join'](__dirname,'../../components/import/cm/csv'),[_0x44c283,_0x219fc4[_0x319c('0x31')][_0x319c('0x9f')],_0x219fc4['body'][_0x319c('0xa1')],_0x219fc4[_0x319c('0x31')][_0x319c('0x59')],_0x219fc4[_0x319c('0x31')][_0x319c('0xaa')],_0x219fc4[_0x319c('0x31')][_0x319c('0x55')],_0x219fc4[_0x319c('0x31')][_0x319c('0xab')]]);return _0x4be719[_0x319c('0xc')](0xc8)['json']({'message':_0x319c('0xac'),'pid':_0x4777e4[_0x319c('0xad')]});}catch(_0x2f44a2){return _0x4be719[_0x319c('0xc')](0x1f4)['send'](_0x2f44a2);}};exports[_0x319c('0xae')]=function(_0x203b88,_0x1b81be){var _0x3a532c=fs[_0x319c('0xaf')](_0x203b88[_0x319c('0xa6')][_0x319c('0x1')]);Papa[_0x319c('0xb0')](_0x3a532c,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x46ce1d){return _0x1b81be[_0x319c('0xc')](0xc8)['json']({'file':_0x203b88['file'],'fields':_0x46ce1d[_0x319c('0xb1')]['fields']});}});};exports['import']=function(_0x58243c,_0x4beb93){return db[_0x319c('0xb2')][_0x319c('0x1c')]({'raw':!![],'attributes':['id'],'where':{'role':_0x319c('0xb3')}})[_0x319c('0x14')](function(_0x4a86ff){var _0x3f11d7=![];if(!_0x58243c[_0x319c('0x31')][_0x319c('0x59')]){throw new Error(_0x319c('0xb4'));}if(!_0x58243c[_0x319c('0x31')]['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x58243c[_0x319c('0x31')][_0x319c('0xb5')]['firstName']){throw new Error(_0x319c('0xb6'));}if(!_0x58243c[_0x319c('0x31')][_0x319c('0xab')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x432f21=require(_0x319c('0xa9'))[_0x319c('0xb7')](path[_0x319c('0x35')](__dirname,_0x319c('0xb8')),[_0x58243c['params']['id'],JSON[_0x319c('0xb9')](_0x58243c[_0x319c('0x31')]),JSON[_0x319c('0xb9')](_0x4a86ff)]);_0x432f21['on'](_0x319c('0xba'),function(){_0x3f11d7=!![];return _0x4beb93['status'](0xc8)[_0x319c('0xd')]({'message':_0x319c('0xbb'),'pid':_0x432f21['pid']});});_0x432f21['on']('exit',function(_0x53471f){if(_0x53471f&&!_0x3f11d7){return _0x4beb93[_0x319c('0xc')](0x1f4)[_0x319c('0xd')]({'message':'error\x20child\x20process','pid':_0x432f21[_0x319c('0xad')]});}});})[_0x319c('0x1d')](handleError(_0x4beb93,null));};exports[_0x319c('0xbc')]=function(_0x592ef2,_0x19f120){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x319c('0xb3')}})[_0x319c('0x14')](function(_0x1f3a4f){var _0x11eede=![];if(!_0x592ef2[_0x319c('0x31')][_0x319c('0x59')]){throw new Error(_0x319c('0xb4'));}if(!_0x592ef2[_0x319c('0x31')][_0x319c('0xb5')][_0x319c('0x72')]){throw new Error(_0x319c('0xa4'));}if(!_0x592ef2['body'][_0x319c('0xb5')]['firstName']){throw new Error(_0x319c('0xb6'));}if(!_0x592ef2['body'][_0x319c('0xab')]){throw new Error(_0x319c('0x9e'));}var _0x5ab33d=require(_0x319c('0xa9'))['fork'](path[_0x319c('0x35')](__dirname,_0x319c('0xbd')),[_0x592ef2[_0x319c('0x61')]['id'],JSON[_0x319c('0xb9')](_0x592ef2[_0x319c('0x31')]),JSON[_0x319c('0xb9')](_0x1f3a4f)]);_0x5ab33d['on'](_0x319c('0xba'),function(){_0x11eede=!![];return _0x19f120[_0x319c('0xc')](0xc8)[_0x319c('0xd')]({'message':_0x319c('0xbb'),'pid':_0x5ab33d[_0x319c('0xad')]});});_0x5ab33d['on'](_0x319c('0xbe'),function(_0x33dbe2){if(_0x33dbe2&&!_0x11eede){return _0x19f120[_0x319c('0xc')](0x1f4)[_0x319c('0xd')]({'message':'error\x20child\x20process','pid':_0x5ab33d['pid']});}});})[_0x319c('0x1d')](handleError(_0x19f120,null));};exports[_0x319c('0xbf')]=function(_0x3a45b6,_0x1d45fc){var _0x18a1cd=[_0x319c('0xc0'),_0x319c('0xc1'),'sms',_0x319c('0xc2'),_0x319c('0xc3'),'whatsapp',_0x319c('0xc4')];var _0x3704a2={'offset':0x0,'order':qs[_0x319c('0x9a')](_0x319c('0xc5'))},_0x2a5486={'count':0x0,'rows':[]};Promise[_0x319c('0xc6')]()[_0x319c('0x14')](function(){if(_0x3a45b6['query']['channel']){if(!_['includes'](_0x18a1cd,_0x3a45b6['query'][_0x319c('0xc7')][_0x319c('0xc8')]())){throw new Error(_0x319c('0xc9'));}_0x18a1cd=[_0x3a45b6[_0x319c('0x27')][_0x319c('0xc7')][_0x319c('0xc8')]()];}if(_0x3a45b6[_0x319c('0x27')]['range']){try{var _0x5c67c4=JSON[_0x319c('0xb0')](_0x3a45b6[_0x319c('0x27')][_0x319c('0xca')]);if(!moment(_0x5c67c4[_0x319c('0x32')])[_0x319c('0xcb')]()){throw new Error(_0x319c('0xcc'));}if(!moment(_0x5c67c4['to'])['isValid']()){throw new Error(_0x319c('0xcd'));}}catch(_0x15a413){throw new Error(_0x319c('0xce'));}}if(!_0x3a45b6[_0x319c('0x27')][_0x319c('0x2f')](_0x319c('0x94'))){_0x3704a2[_0x319c('0x10')]=qs['limit'](_0x3a45b6[_0x319c('0x27')]['limit']||0xa);_0x3704a2[_0x319c('0xe')]=qs[_0x319c('0xe')](_0x3a45b6[_0x319c('0x27')][_0x319c('0xe')]);}var _0x14fd7d=_0x18a1cd[_0x319c('0x66')](function(_0xe4c9f8){if(_0xe4c9f8==='voice'){var _0x5b878c={'attributes':['id',_0x319c('0xcf'),_0x319c('0x2c'),_0x319c('0xd0'),'destination','callerid',_0x319c('0xd1'),'endtime',_0x319c('0xd2'),'note',_0x319c('0xd3'),_0x319c('0xd4'),_0x319c('0xd5'),_0x319c('0xd6'),'UserId'],'where':{'ContactId':_0x3a45b6[_0x319c('0x61')]['id']},'include':[{'model':db[_0x319c('0xb2')],'as':'User','attributes':['id','name',_0x319c('0xd7'),_0x319c('0x2a')]}],'order':[[_0x319c('0xd3'),_0x319c('0xd8')]]};if(_0x3a45b6[_0x319c('0x27')][_0x319c('0xca')]){_0x5b878c['where'][_0x319c('0xd3')]={'$gte':_0x5c67c4[_0x319c('0x32')],'$lte':_0x5c67c4['to']};}return db[_0x319c('0xd9')][_0x319c('0xda')](_0x5b878c)[_0x319c('0x14')](function(_0x550206){_0x2a5486[_0x319c('0x11')]+=_0x550206['count'];return _['map'](_0x550206[_0x319c('0x98')],function(_0x56c8ea){var _0x581525=_0x56c8ea[_0x319c('0x33')]({'plain':!![]});_0x581525[_0x319c('0xc7')]=_0xe4c9f8;if(_0x581525['User']){_0x581525[_0x319c('0xb2')]={'id':_0x581525['User']['id'],'name':_0x581525[_0x319c('0xb2')]['name'],'fullname':_0x581525['User'][_0x319c('0xd7')],'alias':_0x581525['User'][_0x319c('0x2a')]};}return _0x581525;});});}else{var _0x2a1d35=_[_0x319c('0xdb')](_0xe4c9f8)+(_0xe4c9f8==='chat'?_0x319c('0xdc'):_0x319c('0xdd'));var _0x4c80f7={'attributes':['id',_0x319c('0xde'),_0x319c('0xdf'),_0x319c('0xd3'),_0x319c('0xe0'),_0x319c('0xe1'),_0x319c('0xe2'),'thirdDisposition',_0x319c('0xe3'),_0x2a1d35+'Id'],'where':{'ContactId':_0x3a45b6[_0x319c('0x61')]['id']},'include':[{'model':db[_0x2a1d35],'as':_0x319c('0xdd'),'attributes':['id',_0x319c('0x18'),_0x319c('0xe4')]},{'model':db['User'],'as':'Owner','attributes':['id',_0x319c('0x18'),_0x319c('0xd7')]},{'model':db[_0x319c('0x5d')],'as':'Tags','attributes':['id','name',_0x319c('0xe5')],'through':{'attributes':[]}}],'order':[['createdAt',_0x319c('0xd8')]]};if(_0x3a45b6[_0x319c('0x27')]['range']){_0x4c80f7[_0x319c('0x58')]['createdAt']={'$gte':_0x5c67c4['from'],'$lte':_0x5c67c4['to']};}switch(_0xe4c9f8){case _0x319c('0xc1'):_0x4c80f7[_0x319c('0x79')]['push']('browserName',_0x319c('0xe6'),_0x319c('0xe7'),'deviceModel','osName','ratingMessage',_0x319c('0xe8'),_0x319c('0xe9'),_0x319c('0xea'));break;case'mail':_0x4c80f7['attributes'][_0x319c('0x57')](_0x319c('0xeb'),_0x319c('0xec'));break;case _0x319c('0xc2'):_0x4c80f7[_0x319c('0x79')][_0x319c('0x57')](_0x319c('0xed'),_0x319c('0xee'));break;}return db[_[_0x319c('0xdb')](_0xe4c9f8)+_0x319c('0xef')]['findAndCountAll'](_0x4c80f7)['then'](function(_0x39a445){_0x2a5486[_0x319c('0x11')]+=_0x39a445[_0x319c('0x11')];return _[_0x319c('0x66')](_0x39a445[_0x319c('0x98')],function(_0x208528){var _0x91e410=_0x208528[_0x319c('0x33')]({'plain':!![]});_0x91e410[_0x319c('0xc7')]=_0xe4c9f8;if(_0x91e410['Owner']){_0x91e410[_0x319c('0xf0')]={'id':_0x91e410[_0x319c('0xf0')]['id'],'name':_0x91e410[_0x319c('0xf0')]['name'],'fullname':_0x91e410[_0x319c('0xf0')]['fullname']};}return _0x91e410;});});}});return Promise[_0x319c('0x5c')](_0x14fd7d);})[_0x319c('0x14')](function(_0x46c2d3){return _(_0x46c2d3)['flatten']()[_0x319c('0xf1')](_0x319c('0xd3'))['reverse']()[_0x319c('0xf2')]();})[_0x319c('0x14')](function(_0x5585f3){_0x2a5486['rows']=_0x3704a2[_0x319c('0x10')]?_0x5585f3['slice'](_0x3704a2['offset'],_0x3704a2[_0x319c('0xe')]+_0x3704a2[_0x319c('0x10')]):_0x5585f3;return _0x2a5486;})[_0x319c('0x14')](respondWithFilteredResult(_0x1d45fc,_0x3704a2))[_0x319c('0x1d')](handleError(_0x1d45fc,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 9207ff0..9895ea5 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 _0x5b47=['update','remove','emit','hasOwnProperty','events','../../mysqldb','save'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0x5b47,0x11c));var _0x75b4=function(_0x37fd7f,_0x2a4530){_0x37fd7f=_0x37fd7f-0x0;var _0x2021df=_0x5b47[_0x37fd7f];return _0x2021df;};'use strict';var EventEmitter=require(_0x75b4('0x0'));var CmContact=require(_0x75b4('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x75b4('0x2'),'afterUpdate':_0x75b4('0x3'),'afterDestroy':_0x75b4('0x4')};function emitEvent(_0x27f2f2){return function(_0x568b5e,_0x37a74f,_0x8eccdc){CmContactEvents[_0x75b4('0x5')](_0x27f2f2+':'+_0x568b5e['id'],_0x568b5e);CmContactEvents[_0x75b4('0x5')](_0x27f2f2,_0x568b5e);_0x8eccdc(null);};}for(var e in events){if(events[_0x75b4('0x6')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x1e9d=['save','update','remove','hook','exports','events','CmContact','setMaxListeners'];(function(_0x3c6d9a,_0x4f0758){var _0x28f45c=function(_0x1e2596){while(--_0x1e2596){_0x3c6d9a['push'](_0x3c6d9a['shift']());}};_0x28f45c(++_0x4f0758);}(_0x1e9d,0x1dd));var _0xd1e9=function(_0x2c88d7,_0x589107){_0x2c88d7=_0x2c88d7-0x0;var _0x4c14df=_0x1e9d[_0x2c88d7];return _0x4c14df;};'use strict';var EventEmitter=require(_0xd1e9('0x0'));var CmContact=require('../../mysqldb')['db'][_0xd1e9('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xd1e9('0x2')](0x0);var events={'afterCreate':_0xd1e9('0x3'),'afterUpdate':_0xd1e9('0x4'),'afterDestroy':_0xd1e9('0x5')};function emitEvent(_0x4cd7a9){return function(_0x37ee54,_0x59e160,_0x51f8ef){CmContactEvents['emit'](_0x4cd7a9+':'+_0x37ee54['id'],_0x37ee54);CmContactEvents['emit'](_0x4cd7a9,_0x37ee54);_0x51f8ef(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xd1e9('0x6')](e,emitEvent(event));}}module[_0xd1e9('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index e1253bb..7ba45c7 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 _0x847a=['[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','dialCheckDuplicateType','always','findAll','Lists','map','all','Campaign','CmList','outbound','BlackLists','CmHopperBlack','exports','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','push','info'];(function(_0x2e1657,_0x2692e4){var _0x3a4418=function(_0x3e7ebe){while(--_0x3e7ebe){_0x2e1657['push'](_0x2e1657['shift']());}};_0x3a4418(++_0x2692e4);}(_0x847a,0xcc));var _0xa847=function(_0x4f5de1,_0x4413de){_0x4f5de1=_0x4f5de1-0x0;var _0xf8ca59=_0x847a[_0x4f5de1];return _0xf8ca59;};'use strict';var _=require('lodash');var util=require(_0xa847('0x0'));var logger=require(_0xa847('0x1'))(_0xa847('0x2'));var moment=require('moment');var shared=require(_0xa847('0x3'));var attributes=require(_0xa847('0x4'));function getTimezoneCallbackAt(_0x3c69eb,_0x1d437e,_0x5ac6e3,_0xee4320){var _0x1ef305=_0xee4320?'Campaign':_0xa847('0x5');var _0x3ba978=_0x5ac6e3[_0xa847('0x6')]?_0x5ac6e3['scheduledat']:moment()[_0xa847('0x7')](_0xa847('0x8'));if(_[_0xa847('0x9')](_0x5ac6e3[_0xa847('0xa')])){return Promise[_0xa847('0xb')](_0x3ba978);}return _0x3c69eb[_0x1ef305][_0xa847('0xc')]({'where':{'id':_0x1d437e}})[_0xa847('0xd')](function(_0x46d1e3){if(_[_0xa847('0x9')](_0x46d1e3)||_['isNil'](_0x46d1e3[_0xa847('0xa')])){return Promise[_0xa847('0xb')](_0x3ba978);}var _0x327141=shared['timezones'];var _0x4ffdb4=_0x327141[_0x46d1e3[_0xa847('0xa')]];var _0x222bb9=_0x327141[_0x5ac6e3[_0xa847('0xa')]];if(_[_0xa847('0x9')](_0x4ffdb4)&&_[_0xa847('0x9')](_0x222bb9)){return Promise[_0xa847('0xb')](_0x3ba978);}var _0x5c3150=_0x4ffdb4[_0xa847('0xe')]-_0x222bb9[_0xa847('0xe')];var _0x3f5360=_0x5ac6e3[_0xa847('0x6')]?_0x5ac6e3[_0xa847('0x6')]:moment();_0x3ba978=moment(_0x3f5360)[_0xa847('0xf')](_0x5c3150,_0xa847('0x10'))[_0xa847('0x7')](_0xa847('0x8'));return Promise[_0xa847('0xb')](_0x3ba978);});}function getNewHopperPayload(_0x5e979c){return{'phone':_0x5e979c[_0xa847('0x11')],'ContactId':_0x5e979c['id'],'ListId':_0x5e979c[_0xa847('0x12')],'scheduledat':_0x5e979c[_0xa847('0x6')]?_0x5e979c['scheduledat']:moment()[_0xa847('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x5e979c[_0xa847('0x13')]?_0x5e979c[_0xa847('0x13')]:0x2,'callback':_0x5e979c[_0xa847('0x14')]?!![]:![],'callbackuniqueid':_0x5e979c[_0xa847('0x14')]?_0x5e979c[_0xa847('0x14')]:undefined,'callbackat':_0x5e979c[_0xa847('0x14')]?moment()['format'](_0xa847('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0x44ed0d,_0x562c9e,_0x47395e,_0x872ec9){var _0x1235ad={'phone':_0x47395e[_0xa847('0x11')]};var _0x1b42ba={'calleridnum':_0x47395e[_0xa847('0x11')]};if(_0x872ec9){Object['assign'](_0x1235ad,{'CampaignId':_0x562c9e['id']});Object[_0xa847('0x15')](_0x1b42ba,{'CampaignId':_0x562c9e['id']});}else{Object[_0xa847('0x15')](_0x1235ad,{'VoiceQueueId':_0x562c9e['id']});Object[_0xa847('0x15')](_0x1b42ba,{'VoiceQueueId':_0x562c9e['id']});}return _0x44ed0d[_0xa847('0x16')][_0xa847('0xc')]({'where':_0x1235ad})[_0xa847('0xd')](function(_0x3718ae){if(_0x3718ae){throw new Error(_0xa847('0x17')+_0x47395e[_0xa847('0x11')]+_0xa847('0x18')+_0x562c9e['id']);}return _0x44ed0d['CmHopperFinal']['findOne']({'where':_0x1b42ba});})[_0xa847('0xd')](function(_0x2b85da){if(_0x2b85da){throw new Error(_0xa847('0x19')+_0x47395e['phone']+_0xa847('0x18')+_0x562c9e['id']);}var _0xed3e90=getNewHopperPayload(_0x47395e);if(_0x872ec9){_0xed3e90[_0xa847('0x1a')]=_0x562c9e['id'];}else{_0xed3e90[_0xa847('0x1b')]=_0x562c9e['id'];}return _0x44ed0d['CmHopper']['create'](_0xed3e90);});}function handleOnlyIfOpenCheckDuplicate(_0x3c67c6,_0x260cd1,_0xa21f29,_0x409c15){var _0x456383={'phone':_0xa21f29['phone']};if(_0x409c15){Object['assign'](_0x456383,{'CampaignId':_0x260cd1['id']});}else{Object[_0xa847('0x15')](_0x456383,{'VoiceQueueId':_0x260cd1['id']});}return _0x3c67c6[_0xa847('0x16')]['findOne']({'where':_0x456383})['then'](function(_0x2a74e1){if(_0x2a74e1){throw new Error(_0xa847('0x1c')+_0xa21f29['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x260cd1['id']);}var _0x253f22=getNewHopperPayload(_0xa21f29);if(_0x409c15){_0x253f22['CampaignId']=_0x260cd1['id'];}else{_0x253f22[_0xa847('0x1b')]=_0x260cd1['id'];}return _0x3c67c6['CmHopper'][_0xa847('0x1d')](_0x253f22);});}function handleNeverCheckDuplicate(_0x312ce7,_0x2a755d,_0x58e4e8){var _0x1a69dd=getNewHopperPayload(_0x58e4e8);_0x1a69dd['VoiceQueueId']=_0x2a755d['id'];return _0x312ce7[_0xa847('0x16')]['create'](_0x1a69dd);}function handleCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd){return getTimezoneCallbackAt(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd)[_0xa847('0xd')](function(_0x598dc5){_0x42e7b3[_0xa847('0x6')]=_0x598dc5;switch(_0x4f5589[_0xa847('0x1e')]){case _0xa847('0x1f'):return handleAlwaysCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3,_0x2d2cbd);default:return handleNeverCheckDuplicate(_0x2c15ff,_0x4f5589,_0x42e7b3);}});}function createHopperForVoiceQueues(_0x155484,_0x6ee668){return _0x155484['VoiceQueue'][_0xa847('0x20')]({'where':{'type':'outbound'},'attributes':['id',_0xa847('0x1e'),'dialTimezone'],'include':[{'model':_0x155484['CmList'],'as':_0xa847('0x21'),'where':{'id':_0x6ee668[_0xa847('0x12')]}}],'raw':!![]})['then'](function(_0xc83ac3){var _0x5f36c2=_0xc83ac3[_0xa847('0x22')](function(_0x1aa9f8){return handleCheckDuplicate(_0x155484,_0x1aa9f8,_0x6ee668,![]);});return Promise[_0xa847('0x23')](_0x5f36c2);});}function createHopperForCampaigns(_0x541533,_0x297afe){return _0x541533[_0xa847('0x24')][_0xa847('0x20')]({'attributes':['id','dialCheckDuplicateType',_0xa847('0xa')],'include':[{'model':_0x541533[_0xa847('0x25')],'as':_0xa847('0x21'),'where':{'id':_0x297afe[_0xa847('0x12')]}}],'raw':!![]})[_0xa847('0xd')](function(_0xad066){var _0x7a36a2=_0xad066['map'](function(_0x3e6893){return handleCheckDuplicate(_0x541533,_0x3e6893,_0x297afe,!![]);});return Promise[_0xa847('0x23')](_0x7a36a2);});}function createHopperBlackForVoiceQueues(_0xf4ec8f,_0xf51700){return _0xf4ec8f[_0xa847('0x5')][_0xa847('0x20')]({'where':{'type':_0xa847('0x26')},'attributes':['id'],'include':[{'model':_0xf4ec8f[_0xa847('0x25')],'as':_0xa847('0x27'),'where':{'id':_0xf51700[_0xa847('0x12')]}}],'raw':!![]})[_0xa847('0xd')](function(_0x25d208){var _0x5d35c8=_0x25d208[_0xa847('0x22')](function(_0x1447da){return _0xf4ec8f['CmHopperBlack'][_0xa847('0x1d')]({'phone':_0xf51700[_0xa847('0x11')],'ContactId':_0xf51700['id'],'ListId':_0xf51700[_0xa847('0x12')],'VoiceQueueId':_0x1447da['id']});});return Promise[_0xa847('0x23')](_0x5d35c8);});}function createHopperBlackForCampaigns(_0x1a5ed2,_0x4d31bc){return _0x1a5ed2[_0xa847('0x24')]['findAll']({'attributes':['id'],'include':[{'model':_0x1a5ed2[_0xa847('0x25')],'as':_0xa847('0x27'),'where':{'id':_0x4d31bc['ListId']}}],'raw':!![]})[_0xa847('0xd')](function(_0x48586c){var _0x1b3eab=_0x48586c[_0xa847('0x22')](function(_0x10ff45){return _0x1a5ed2[_0xa847('0x28')][_0xa847('0x1d')]({'phone':_0x4d31bc[_0xa847('0x11')],'ContactId':_0x4d31bc['id'],'ListId':_0x4d31bc[_0xa847('0x12')],'CampaignId':_0x10ff45['id']});});return Promise['all'](_0x1b3eab);});}module[_0xa847('0x29')]=function(_0x9c197b){return _0x9c197b['define'](_0xa847('0x2a'),attributes,{'tableName':_0xa847('0x2b'),'paranoid':!![],'indexes':[{'name':_0xa847('0x11'),'fields':[_0xa847('0x11')]},{'name':_0xa847('0x2c'),'fields':[_0xa847('0x2d'),'lastName',_0xa847('0x11'),_0xa847('0x2e'),_0xa847('0x2f'),_0xa847('0x30')],'type':_0xa847('0x31')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xa847('0x32'),'hooks':{'afterCreate':function(_0xcdd7bc,_0x3497ba,_0x1372ce){var _0x1545a4=_0x9c197b[_0xa847('0x33')];var _0x33487f=_0xcdd7bc[_0xa847('0x34')]({'plain':!![]});if(!_0x33487f['ListId']){logger[_0xa847('0x35')](_0xa847('0x36')+_0x33487f['id']);return _0x1372ce();}if(!_0x33487f[_0xa847('0x11')]){return _0x1372ce();}return createHopperForVoiceQueues(_0x1545a4,_0x33487f)[_0xa847('0xd')](function(){return createHopperBlackForVoiceQueues(_0x1545a4,_0x33487f);})[_0xa847('0xd')](function(){return createHopperForCampaigns(_0x1545a4,_0x33487f);})[_0xa847('0xd')](function(){return createHopperBlackForCampaigns(_0x1545a4,_0x33487f);})[_0xa847('0xd')](function(){return _0x1372ce();})[_0xa847('0x37')](function(_0x11d0bf){logger[_0xa847('0x35')](_0xa847('0x38'),_0x11d0bf[_0xa847('0x39')]);_0x1372ce();});},'afterDestroy':function(_0x1dd8f2,_0x4bd265,_0x17751e){var _0x485568=_0x9c197b[_0xa847('0x33')];var _0x141288=_0x1dd8f2['get']({'plain':!![]});return _0x485568['CmHopper'][_0xa847('0x20')]({'raw':!![],'where':{'ListId':_0x141288['ListId'],'ContactId':_0x141288['id']}})[_0xa847('0xd')](function(_0x2784de){if(!_[_0xa847('0x3a')](_0x2784de)){var _0xb34822=[];for(var _0x4a75a5=0x0;_0x4a75a5<_0x2784de[_0xa847('0x3b')];_0x4a75a5+=0x1){var _0x31fcc9=_0x485568[_0xa847('0x16')][_0xa847('0x3c')]({'where':{'ListId':_0x2784de[_0x4a75a5][_0xa847('0x12')],'ContactId':_0x2784de[_0x4a75a5][_0xa847('0x3d')],'VoiceQueueId':_0x2784de[_0x4a75a5][_0xa847('0x1b')],'CampaignId':_0x2784de[_0x4a75a5][_0xa847('0x1a')]}});_0xb34822[_0xa847('0x3e')](_0x31fcc9);}return Promise[_0xa847('0x23')](_0xb34822);}})[_0xa847('0xd')](function(_0x2bf567){logger[_0xa847('0x3f')](_0xa847('0x40'),util[_0xa847('0x41')](_0x2bf567,{'showHidden':![],'depth':null}));_0x17751e();})['catch'](function(_0x585574){logger[_0xa847('0x35')](_0xa847('0x42'),util[_0xa847('0x41')](_0x585574,{'showHidden':![],'depth':null}));_0x17751e(_0x585574);});}}});}; \ No newline at end of file +var _0xe370=['CmHopperBlack','BlackLists','exports','define','CmContact','cm_contacts','fti_cm_contacts','mobile','fax','FULLTEXT','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message','models','isEmpty','length','destroy','push','[CmContact][afterDestroy][Succesfull]','inspect','lodash','util','../../config/logger','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','dialTimezone','resolve','findOne','isNil','timezones','utcOffset','add','phone','ListId','priority','callbackUniqueid','assign','CmHopper','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','then','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','VoiceQueueId','create','dialCheckDuplicateType','onlyIfOpen','findAll','outbound','CmList','Lists','map','all'];(function(_0x11f0e3,_0x5170bc){var _0x2892e8=function(_0x3292b2){while(--_0x3292b2){_0x11f0e3['push'](_0x11f0e3['shift']());}};_0x2892e8(++_0x5170bc);}(_0xe370,0x10a));var _0x0e37=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xe370[_0x4327fe];return _0x138651;};'use strict';var _=require(_0x0e37('0x0'));var util=require(_0x0e37('0x1'));var logger=require(_0x0e37('0x2'))('api');var moment=require(_0x0e37('0x3'));var shared=require(_0x0e37('0x4'));var attributes=require(_0x0e37('0x5'));function getTimezoneCallbackAt(_0x4bac0f,_0x43ce87,_0xc1a0f2,_0x965cd6){var _0x44df60=_0x965cd6?_0x0e37('0x6'):_0x0e37('0x7');var _0x3b5131=_0xc1a0f2[_0x0e37('0x8')]?_0xc1a0f2[_0x0e37('0x8')]:moment()[_0x0e37('0x9')](_0x0e37('0xa'));if(_['isNil'](_0xc1a0f2[_0x0e37('0xb')])){return Promise[_0x0e37('0xc')](_0x3b5131);}return _0x4bac0f[_0x44df60][_0x0e37('0xd')]({'where':{'id':_0x43ce87}})['then'](function(_0xadbf98){if(_[_0x0e37('0xe')](_0xadbf98)||_['isNil'](_0xadbf98[_0x0e37('0xb')])){return Promise['resolve'](_0x3b5131);}var _0x18273e=shared[_0x0e37('0xf')];var _0x420c1a=_0x18273e[_0xadbf98[_0x0e37('0xb')]];var _0x420817=_0x18273e[_0xc1a0f2['dialTimezone']];if(_[_0x0e37('0xe')](_0x420c1a)&&_[_0x0e37('0xe')](_0x420817)){return Promise[_0x0e37('0xc')](_0x3b5131);}var _0xccbb3b=_0x420c1a[_0x0e37('0x10')]-_0x420817[_0x0e37('0x10')];var _0x19058f=_0xc1a0f2[_0x0e37('0x8')]?_0xc1a0f2[_0x0e37('0x8')]:moment();_0x3b5131=moment(_0x19058f)[_0x0e37('0x11')](_0xccbb3b,'minutes')[_0x0e37('0x9')](_0x0e37('0xa'));return Promise[_0x0e37('0xc')](_0x3b5131);});}function getNewHopperPayload(_0xd3ff64){return{'phone':_0xd3ff64[_0x0e37('0x12')],'ContactId':_0xd3ff64['id'],'ListId':_0xd3ff64[_0x0e37('0x13')],'scheduledat':_0xd3ff64[_0x0e37('0x8')]?_0xd3ff64[_0x0e37('0x8')]:moment()['format'](_0x0e37('0xa')),'priority':_0xd3ff64[_0x0e37('0x14')]?_0xd3ff64[_0x0e37('0x14')]:0x2,'callback':_0xd3ff64[_0x0e37('0x15')]?!![]:![],'callbackuniqueid':_0xd3ff64['callbackUniqueid']?_0xd3ff64[_0x0e37('0x15')]:undefined,'callbackat':_0xd3ff64[_0x0e37('0x15')]?moment()[_0x0e37('0x9')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x1a91e9,_0x238e6c,_0x8d8b60,_0x570656){var _0x53907d={'phone':_0x8d8b60[_0x0e37('0x12')]};var _0x3e78a2={'calleridnum':_0x8d8b60['phone']};if(_0x570656){Object[_0x0e37('0x16')](_0x53907d,{'CampaignId':_0x238e6c['id']});Object[_0x0e37('0x16')](_0x3e78a2,{'CampaignId':_0x238e6c['id']});}else{Object[_0x0e37('0x16')](_0x53907d,{'VoiceQueueId':_0x238e6c['id']});Object[_0x0e37('0x16')](_0x3e78a2,{'VoiceQueueId':_0x238e6c['id']});}return _0x1a91e9[_0x0e37('0x17')][_0x0e37('0xd')]({'where':_0x53907d})['then'](function(_0x39400e){if(_0x39400e){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x8d8b60[_0x0e37('0x12')]+_0x0e37('0x18')+_0x238e6c['id']);}return _0x1a91e9[_0x0e37('0x19')][_0x0e37('0xd')]({'where':_0x3e78a2});})[_0x0e37('0x1a')](function(_0x24d5a5){if(_0x24d5a5){throw new Error(_0x0e37('0x1b')+_0x8d8b60['phone']+_0x0e37('0x18')+_0x238e6c['id']);}var _0x520eca=getNewHopperPayload(_0x8d8b60);if(_0x570656){_0x520eca[_0x0e37('0x1c')]=_0x238e6c['id'];}else{_0x520eca[_0x0e37('0x1d')]=_0x238e6c['id'];}return _0x1a91e9[_0x0e37('0x17')][_0x0e37('0x1e')](_0x520eca);});}function handleOnlyIfOpenCheckDuplicate(_0x48e766,_0x35d9b5,_0x1aacf3,_0x555d13){var _0xaabc6d={'phone':_0x1aacf3[_0x0e37('0x12')]};if(_0x555d13){Object[_0x0e37('0x16')](_0xaabc6d,{'CampaignId':_0x35d9b5['id']});}else{Object[_0x0e37('0x16')](_0xaabc6d,{'VoiceQueueId':_0x35d9b5['id']});}return _0x48e766[_0x0e37('0x17')][_0x0e37('0xd')]({'where':_0xaabc6d})[_0x0e37('0x1a')](function(_0x2919a7){if(_0x2919a7){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x1aacf3[_0x0e37('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x35d9b5['id']);}var _0x423342=getNewHopperPayload(_0x1aacf3);if(_0x555d13){_0x423342[_0x0e37('0x1c')]=_0x35d9b5['id'];}else{_0x423342[_0x0e37('0x1d')]=_0x35d9b5['id'];}return _0x48e766[_0x0e37('0x17')]['create'](_0x423342);});}function handleNeverCheckDuplicate(_0x569c4a,_0x2933e0,_0x436d78){var _0x47cc46=getNewHopperPayload(_0x436d78);_0x47cc46[_0x0e37('0x1d')]=_0x2933e0['id'];return _0x569c4a[_0x0e37('0x17')][_0x0e37('0x1e')](_0x47cc46);}function handleCheckDuplicate(_0x25c58d,_0x3376e3,_0x83877f,_0x1e4408){return getTimezoneCallbackAt(_0x25c58d,_0x3376e3,_0x83877f,_0x1e4408)[_0x0e37('0x1a')](function(_0x3ea8a3){_0x83877f[_0x0e37('0x8')]=_0x3ea8a3;switch(_0x3376e3[_0x0e37('0x1f')]){case'always':return handleAlwaysCheckDuplicate(_0x25c58d,_0x3376e3,_0x83877f,_0x1e4408);case _0x0e37('0x20'):return handleOnlyIfOpenCheckDuplicate(_0x25c58d,_0x3376e3,_0x83877f,_0x1e4408);default:return handleNeverCheckDuplicate(_0x25c58d,_0x3376e3,_0x83877f);}});}function createHopperForVoiceQueues(_0x431790,_0x48c091){return _0x431790[_0x0e37('0x7')][_0x0e37('0x21')]({'where':{'type':_0x0e37('0x22')},'attributes':['id',_0x0e37('0x1f'),_0x0e37('0xb')],'include':[{'model':_0x431790[_0x0e37('0x23')],'as':_0x0e37('0x24'),'where':{'id':_0x48c091[_0x0e37('0x13')]}}],'raw':!![]})[_0x0e37('0x1a')](function(_0x53b520){var _0x2f5ab8=_0x53b520[_0x0e37('0x25')](function(_0x40e16a){return handleCheckDuplicate(_0x431790,_0x40e16a,_0x48c091,![]);});return Promise[_0x0e37('0x26')](_0x2f5ab8);});}function createHopperForCampaigns(_0x43646f,_0x410bb7){return _0x43646f[_0x0e37('0x6')][_0x0e37('0x21')]({'attributes':['id',_0x0e37('0x1f'),'dialTimezone'],'include':[{'model':_0x43646f['CmList'],'as':'Lists','where':{'id':_0x410bb7['ListId']}}],'raw':!![]})['then'](function(_0x2b8071){var _0x27f5fe=_0x2b8071['map'](function(_0x426949){return handleCheckDuplicate(_0x43646f,_0x426949,_0x410bb7,!![]);});return Promise['all'](_0x27f5fe);});}function createHopperBlackForVoiceQueues(_0x52398e,_0x1d067a){return _0x52398e[_0x0e37('0x7')][_0x0e37('0x21')]({'where':{'type':_0x0e37('0x22')},'attributes':['id'],'include':[{'model':_0x52398e[_0x0e37('0x23')],'as':'BlackLists','where':{'id':_0x1d067a['ListId']}}],'raw':!![]})[_0x0e37('0x1a')](function(_0xc8afa8){var _0x384d72=_0xc8afa8[_0x0e37('0x25')](function(_0x33cba8){return _0x52398e[_0x0e37('0x27')][_0x0e37('0x1e')]({'phone':_0x1d067a[_0x0e37('0x12')],'ContactId':_0x1d067a['id'],'ListId':_0x1d067a['ListId'],'VoiceQueueId':_0x33cba8['id']});});return Promise[_0x0e37('0x26')](_0x384d72);});}function createHopperBlackForCampaigns(_0x467700,_0x3cbe15){return _0x467700['Campaign']['findAll']({'attributes':['id'],'include':[{'model':_0x467700[_0x0e37('0x23')],'as':_0x0e37('0x28'),'where':{'id':_0x3cbe15[_0x0e37('0x13')]}}],'raw':!![]})[_0x0e37('0x1a')](function(_0x3ddeea){var _0x556c22=_0x3ddeea['map'](function(_0x57b7f2){return _0x467700['CmHopperBlack']['create']({'phone':_0x3cbe15['phone'],'ContactId':_0x3cbe15['id'],'ListId':_0x3cbe15[_0x0e37('0x13')],'CampaignId':_0x57b7f2['id']});});return Promise[_0x0e37('0x26')](_0x556c22);});}module[_0x0e37('0x29')]=function(_0x11f89a){return _0x11f89a[_0x0e37('0x2a')](_0x0e37('0x2b'),attributes,{'tableName':_0x0e37('0x2c'),'paranoid':!![],'indexes':[{'name':_0x0e37('0x12'),'fields':['phone']},{'name':_0x0e37('0x2d'),'fields':['firstName','lastName','phone',_0x0e37('0x2e'),_0x0e37('0x2f'),'email'],'type':_0x0e37('0x30')}],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x3917b5,_0xb1a60c,_0x298fa3){var _0x237d7c=_0x11f89a['models'];var _0x1679ed=_0x3917b5[_0x0e37('0x31')]({'plain':!![]});if(!_0x1679ed[_0x0e37('0x13')]){logger[_0x0e37('0x32')](_0x0e37('0x33')+_0x1679ed['id']);return _0x298fa3();}if(!_0x1679ed[_0x0e37('0x12')]){return _0x298fa3();}return createHopperForVoiceQueues(_0x237d7c,_0x1679ed)[_0x0e37('0x1a')](function(){return createHopperBlackForVoiceQueues(_0x237d7c,_0x1679ed);})['then'](function(){return createHopperForCampaigns(_0x237d7c,_0x1679ed);})[_0x0e37('0x1a')](function(){return createHopperBlackForCampaigns(_0x237d7c,_0x1679ed);})['then'](function(){return _0x298fa3();})[_0x0e37('0x34')](function(_0x23af35){logger[_0x0e37('0x32')]('[cmContact][afterCreate]',_0x23af35[_0x0e37('0x35')]);_0x298fa3();});},'afterDestroy':function(_0x32062b,_0x42b573,_0x5f3298){var _0x15ea8e=_0x11f89a[_0x0e37('0x36')];var _0x46e71c=_0x32062b[_0x0e37('0x31')]({'plain':!![]});return _0x15ea8e[_0x0e37('0x17')]['findAll']({'raw':!![],'where':{'ListId':_0x46e71c[_0x0e37('0x13')],'ContactId':_0x46e71c['id']}})['then'](function(_0x1fb7ab){if(!_[_0x0e37('0x37')](_0x1fb7ab)){var _0x38c6b9=[];for(var _0x1d2e35=0x0;_0x1d2e35<_0x1fb7ab[_0x0e37('0x38')];_0x1d2e35+=0x1){var _0xb0dca=_0x15ea8e[_0x0e37('0x17')][_0x0e37('0x39')]({'where':{'ListId':_0x1fb7ab[_0x1d2e35][_0x0e37('0x13')],'ContactId':_0x1fb7ab[_0x1d2e35]['ContactId'],'VoiceQueueId':_0x1fb7ab[_0x1d2e35][_0x0e37('0x1d')],'CampaignId':_0x1fb7ab[_0x1d2e35][_0x0e37('0x1c')]}});_0x38c6b9[_0x0e37('0x3a')](_0xb0dca);}return Promise[_0x0e37('0x26')](_0x38c6b9);}})[_0x0e37('0x1a')](function(_0xc108ef){logger['info'](_0x0e37('0x3b'),util[_0x0e37('0x3c')](_0xc108ef,{'showHidden':![],'depth':null}));_0x5f3298();})[_0x0e37('0x34')](function(_0x440f51){logger[_0x0e37('0x32')]('[CmContact][afterDestroy][Error]',util[_0x0e37('0x3c')](_0x440f51,{'showHidden':![],'depth':null}));_0x5f3298(_0x440f51);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 182c40a..fae36d2 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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'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(_0x550ac4,_0x591f2a){var _0x27f9ea=function(_0x8dc73a){while(--_0x8dc73a){_0x550ac4['push'](_0x550ac4['shift']());}};_0x27f9ea(++_0x591f2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 3a6bc4f..f6e9a93 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 _0x279d=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x239501,_0x5180cd){var _0x346937=function(_0x111583){while(--_0x111583){_0x239501['push'](_0x239501['shift']());}};_0x346937(++_0x5180cd);}(_0x279d,0x1d8));var _0xd279=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0x279d[_0x1203f];return _0x365f0a;};'use strict';var Sequelize=require(_0xd279('0x0'));module[_0xd279('0x1')]={'CmContactId':{'type':Sequelize[_0xd279('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd279('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0xd279('0x4')},'OrderBy':{'type':Sequelize[_0xd279('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file +var _0xc252=['sequelize','exports','INTEGER','STRING','PHONE'];(function(_0xf73c09,_0x4e424e){var _0xa8923c=function(_0x4831c1){while(--_0x4831c1){_0xf73c09['push'](_0xf73c09['shift']());}};_0xa8923c(++_0x4e424e);}(_0xc252,0x118));var _0x2c25=function(_0x59198d,_0x4e7c76){_0x59198d=_0x59198d-0x0;var _0x19698f=_0xc252[_0x59198d];return _0x19698f;};'use strict';var Sequelize=require(_0x2c25('0x0'));module[_0x2c25('0x1')]={'CmContactId':{'type':Sequelize[_0x2c25('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2c25('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x2c25('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2c25('0x3')],'defaultValue':_0x2c25('0x4')},'OrderBy':{'type':Sequelize[_0x2c25('0x2')],'defaultValue':null},'description':{'type':Sequelize['STRING'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 9324a9d..0e7d45d 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 _0xf9a9=['VIRTUAL','filter','merge','options','CmContactHasItem','then','includeAll','findAll','catch','show','params','length','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','fast-json-patch','request-promise','moment','bluebird','util','sox','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/license/util','sendStatus','end','json','offset','undefined','limit','count','set','apply','save','update','get','CmContactHasItems','UserProfileResource','destroy','status','error','name','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x156fba,_0x12912a){var _0x58c9ea=function(_0x2231d8){while(--_0x2231d8){_0x156fba['push'](_0x156fba['shift']());}};_0x58c9ea(++_0x12912a);}(_0xf9a9,0x156));var _0x9f9a=function(_0x54d5d1,_0x4baeef){_0x54d5d1=_0x54d5d1-0x0;var _0x26e240=_0xf9a9[_0x54d5d1];return _0x26e240;};'use strict';var emlformat=require(_0x9f9a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9f9a('0x1'));var rp=require(_0x9f9a('0x2'));var moment=require(_0x9f9a('0x3'));var BPromise=require(_0x9f9a('0x4'));var Mustache=require('mustache');var util=require(_0x9f9a('0x5'));var path=require('path');var sox=require(_0x9f9a('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9f9a('0x7'));var _=require(_0x9f9a('0x8'));var squel=require(_0x9f9a('0x9'));var crypto=require(_0x9f9a('0xa'));var jsforce=require(_0x9f9a('0xb'));var deskjs=require(_0x9f9a('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9f9a('0xd'));var Papa=require(_0x9f9a('0xe'));var Redis=require(_0x9f9a('0xf'));var authService=require(_0x9f9a('0x10'));var qs=require(_0x9f9a('0x11'));var as=require(_0x9f9a('0x12'));var hardwareService=require(_0x9f9a('0x13'));var logger=require(_0x9f9a('0x14'))('api');var utils=require(_0x9f9a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9f9a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d9ce2,_0x26493f){_0x26493f=_0x26493f||0xcc;return function(_0x42b50f){if(_0x42b50f){return _0x1d9ce2[_0x9f9a('0x17')](_0x26493f);}return _0x1d9ce2['status'](_0x26493f)[_0x9f9a('0x18')]();};}function respondWithResult(_0x34fc96,_0x5454d){_0x5454d=_0x5454d||0xc8;return function(_0x19e82e){if(_0x19e82e){return _0x34fc96['status'](_0x5454d)[_0x9f9a('0x19')](_0x19e82e);}};}function respondWithFilteredResult(_0x502f87,_0x5df353){return function(_0x1143bb){if(_0x1143bb){var _0x32e6b=typeof _0x5df353[_0x9f9a('0x1a')]===_0x9f9a('0x1b')&&typeof _0x5df353[_0x9f9a('0x1c')]===_0x9f9a('0x1b');var _0x2381d8=_0x1143bb['count'];var _0x22c10f=_0x32e6b?0x0:_0x5df353['offset'];var _0x2d798e=_0x32e6b?_0x1143bb[_0x9f9a('0x1d')]:_0x5df353[_0x9f9a('0x1a')]+_0x5df353[_0x9f9a('0x1c')];var _0x41058e;if(_0x2d798e>=_0x2381d8){_0x2d798e=_0x2381d8;_0x41058e=0xc8;}else{_0x41058e=0xce;}_0x502f87['status'](_0x41058e);return _0x502f87[_0x9f9a('0x1e')]('Content-Range',_0x22c10f+'-'+_0x2d798e+'/'+_0x2381d8)[_0x9f9a('0x19')](_0x1143bb);}return null;};}function patchUpdates(_0x18d086){return function(_0x304dc8){try{jsonpatch[_0x9f9a('0x1f')](_0x304dc8,_0x18d086,!![]);}catch(_0x28a8d4){return BPromise['reject'](_0x28a8d4);}return _0x304dc8[_0x9f9a('0x20')]();};}function saveUpdates(_0x409940,_0x5c1f80){return function(_0x336438){if(_0x336438){return _0x336438[_0x9f9a('0x21')](_0x409940)['then'](function(_0x513011){return _0x513011;});}return null;};}function removeEntity(_0xcb2187,_0x4a0cf2){return function(_0x5071ac){if(_0x5071ac){return _0x5071ac['destroy']()['then'](function(){var _0x6fc2be=_0x5071ac[_0x9f9a('0x22')]({'plain':!![]});var _0x18db83=_0x9f9a('0x23');return db[_0x9f9a('0x24')][_0x9f9a('0x25')]({'where':{'type':_0x18db83,'resourceId':_0x6fc2be['id']}})['then'](function(){return _0x5071ac;});})['then'](function(){_0xcb2187[_0x9f9a('0x26')](0xcc)[_0x9f9a('0x18')]();});}};}function handleEntityNotFound(_0x31a820,_0x38aea8){return function(_0xc81bd2){if(!_0xc81bd2){_0x31a820[_0x9f9a('0x17')](0x194);}return _0xc81bd2;};}function handleError(_0x3fb11d,_0x11a6e3){_0x11a6e3=_0x11a6e3||0x1f4;return function(_0x8e8e2a){logger[_0x9f9a('0x27')](_0x8e8e2a['stack']);if(_0x8e8e2a[_0x9f9a('0x28')]){delete _0x8e8e2a[_0x9f9a('0x28')];}_0x3fb11d[_0x9f9a('0x26')](_0x11a6e3)['send'](_0x8e8e2a);};}exports[_0x9f9a('0x29')]=function(_0x40ce50,_0x3beaac){var _0x47bc5b={},_0x1311f4={},_0x42eba2={'count':0x0,'rows':[]};var _0x55e9d4=_[_0x9f9a('0x2a')](db['CmContactHasItem'][_0x9f9a('0x2b')],function(_0xc7292f){return{'name':_0xc7292f[_0x9f9a('0x2c')],'type':_0xc7292f[_0x9f9a('0x2d')]['key']};});_0x1311f4['model']=_[_0x9f9a('0x2a')](_0x55e9d4,_0x9f9a('0x28'));_0x1311f4[_0x9f9a('0x2e')]=_[_0x9f9a('0x2f')](_0x40ce50['query']);_0x1311f4[_0x9f9a('0x30')]=_[_0x9f9a('0x31')](_0x1311f4[_0x9f9a('0x32')],_0x1311f4[_0x9f9a('0x2e')]);_0x47bc5b[_0x9f9a('0x33')]=_['intersection'](_0x1311f4[_0x9f9a('0x32')],qs['fields'](_0x40ce50[_0x9f9a('0x2e')][_0x9f9a('0x34')]));_0x47bc5b[_0x9f9a('0x33')]=_0x47bc5b[_0x9f9a('0x33')]['length']?_0x47bc5b[_0x9f9a('0x33')]:_0x1311f4['model'];if(!_0x40ce50['query'][_0x9f9a('0x35')](_0x9f9a('0x36'))){_0x47bc5b[_0x9f9a('0x1c')]=qs[_0x9f9a('0x1c')](_0x40ce50[_0x9f9a('0x2e')]['limit']);_0x47bc5b[_0x9f9a('0x1a')]=qs[_0x9f9a('0x1a')](_0x40ce50[_0x9f9a('0x2e')]['offset']);}_0x47bc5b[_0x9f9a('0x37')]=qs[_0x9f9a('0x38')](_0x40ce50[_0x9f9a('0x2e')]['sort']);_0x47bc5b[_0x9f9a('0x39')]=qs['filters'](_['pick'](_0x40ce50['query'],_0x1311f4['filters']),_0x55e9d4);if(_0x40ce50['query']['filter']){_0x47bc5b[_0x9f9a('0x39')]=_['merge'](_0x47bc5b[_0x9f9a('0x39')],{'$or':_[_0x9f9a('0x2a')](_0x55e9d4,function(_0x54ba7a){if(_0x54ba7a[_0x9f9a('0x2d')]!==_0x9f9a('0x3a')){var _0x50212c={};_0x50212c[_0x54ba7a[_0x9f9a('0x28')]]={'$like':'%'+_0x40ce50[_0x9f9a('0x2e')][_0x9f9a('0x3b')]+'%'};return _0x50212c;}})});}_0x47bc5b=_[_0x9f9a('0x3c')]({},_0x47bc5b,_0x40ce50[_0x9f9a('0x3d')]);var _0x5c18fd={'where':_0x47bc5b[_0x9f9a('0x39')]};return db[_0x9f9a('0x3e')][_0x9f9a('0x1d')](_0x5c18fd)[_0x9f9a('0x3f')](function(_0x113f5c){_0x42eba2[_0x9f9a('0x1d')]=_0x113f5c;if(_0x40ce50['query'][_0x9f9a('0x40')]){_0x47bc5b['include']=[{'all':!![]}];}return db[_0x9f9a('0x3e')][_0x9f9a('0x41')](_0x47bc5b);})[_0x9f9a('0x3f')](function(_0x2acd96){_0x42eba2['rows']=_0x2acd96;return _0x42eba2;})[_0x9f9a('0x3f')](respondWithFilteredResult(_0x3beaac,_0x47bc5b))[_0x9f9a('0x42')](handleError(_0x3beaac,null));};exports[_0x9f9a('0x43')]=function(_0x4af47f,_0x34a848){var _0xb2bf69={'raw':!![],'where':{'id':_0x4af47f[_0x9f9a('0x44')]['id']}},_0x312879={};_0x312879[_0x9f9a('0x32')]=_[_0x9f9a('0x2f')](db[_0x9f9a('0x3e')]['rawAttributes']);_0x312879[_0x9f9a('0x2e')]=_[_0x9f9a('0x2f')](_0x4af47f[_0x9f9a('0x2e')]);_0x312879[_0x9f9a('0x30')]=_['intersection'](_0x312879[_0x9f9a('0x32')],_0x312879['query']);_0xb2bf69[_0x9f9a('0x33')]=_['intersection'](_0x312879[_0x9f9a('0x32')],qs[_0x9f9a('0x34')](_0x4af47f[_0x9f9a('0x2e')]['fields']));_0xb2bf69[_0x9f9a('0x33')]=_0xb2bf69[_0x9f9a('0x33')][_0x9f9a('0x45')]?_0xb2bf69[_0x9f9a('0x33')]:_0x312879[_0x9f9a('0x32')];if(_0x4af47f[_0x9f9a('0x2e')][_0x9f9a('0x40')]){_0xb2bf69[_0x9f9a('0x46')]=[{'all':!![]}];}_0xb2bf69=_[_0x9f9a('0x3c')]({},_0xb2bf69,_0x4af47f[_0x9f9a('0x3d')]);return db['CmContactHasItem']['find'](_0xb2bf69)[_0x9f9a('0x3f')](handleEntityNotFound(_0x34a848,null))['then'](respondWithResult(_0x34a848,null))['catch'](handleError(_0x34a848,null));};exports[_0x9f9a('0x47')]=function(_0x296898,_0x1ac901){return db[_0x9f9a('0x3e')][_0x9f9a('0x47')](_0x296898[_0x9f9a('0x48')],{})[_0x9f9a('0x3f')](function(_0x216150){var _0x5f3a22=_0x296898[_0x9f9a('0x49')]['get']({'plain':!![]});if(!_0x5f3a22)throw new Error(_0x9f9a('0x4a'));if(_0x5f3a22[_0x9f9a('0x4b')]===_0x9f9a('0x49')){var _0x5029e3=_0x216150['get']({'plain':!![]});var _0x463182=_0x9f9a('0x23');return db[_0x9f9a('0x4c')]['find']({'where':{'name':_0x463182,'userProfileId':_0x5f3a22[_0x9f9a('0x4d')]},'raw':!![]})[_0x9f9a('0x3f')](function(_0x528ccf){if(_0x528ccf&&_0x528ccf['autoAssociation']===0x0){return db['UserProfileResource'][_0x9f9a('0x47')]({'name':_0x5029e3[_0x9f9a('0x28')],'resourceId':_0x5029e3['id'],'type':_0x528ccf['name'],'sectionId':_0x528ccf['id']},{})[_0x9f9a('0x3f')](function(){return _0x216150;});}else{return _0x216150;}})[_0x9f9a('0x42')](function(_0x488186){logger['error'](_0x9f9a('0x4e'),_0x488186);throw _0x488186;});}return _0x216150;})['then'](respondWithResult(_0x1ac901,0xc9))['catch'](handleError(_0x1ac901,null));};exports[_0x9f9a('0x21')]=function(_0x31842c,_0x59d912){if(_0x31842c[_0x9f9a('0x48')]['id']){delete _0x31842c[_0x9f9a('0x48')]['id'];}return db[_0x9f9a('0x3e')][_0x9f9a('0x4f')]({'where':{'id':_0x31842c['params']['id']}})[_0x9f9a('0x3f')](handleEntityNotFound(_0x59d912,null))[_0x9f9a('0x3f')](saveUpdates(_0x31842c[_0x9f9a('0x48')],null))[_0x9f9a('0x3f')](respondWithResult(_0x59d912,null))[_0x9f9a('0x42')](handleError(_0x59d912,null));};exports[_0x9f9a('0x25')]=function(_0xfe2671,_0x4b9c0e){return db[_0x9f9a('0x3e')][_0x9f9a('0x4f')]({'where':{'id':_0xfe2671[_0x9f9a('0x44')]['id']}})[_0x9f9a('0x3f')](handleEntityNotFound(_0x4b9c0e,null))[_0x9f9a('0x3f')](removeEntity(_0x4b9c0e,null))[_0x9f9a('0x42')](handleError(_0x4b9c0e,null));}; \ No newline at end of file +var _0x2306=['rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','rimraf','zip-dir','request-promise','moment','bluebird','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','api','../../config/utils','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2306,0x10a));var _0x6230=function(_0x5d69d4,_0x25ea23){_0x5d69d4=_0x5d69d4-0x0;var _0x303d2a=_0x2306[_0x5d69d4];return _0x303d2a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6230('0x0'));var zipdir=require(_0x6230('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6230('0x2'));var moment=require(_0x6230('0x3'));var BPromise=require(_0x6230('0x4'));var Mustache=require('mustache');var util=require(_0x6230('0x5'));var path=require(_0x6230('0x6'));var sox=require(_0x6230('0x7'));var csv=require(_0x6230('0x8'));var ejs=require(_0x6230('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6230('0xa'));var squel=require(_0x6230('0xb'));var crypto=require('crypto');var jsforce=require(_0x6230('0xc'));var deskjs=require(_0x6230('0xd'));var toCsv=require(_0x6230('0x8'));var querystring=require(_0x6230('0xe'));var Papa=require(_0x6230('0xf'));var Redis=require(_0x6230('0x10'));var authService=require(_0x6230('0x11'));var qs=require(_0x6230('0x12'));var as=require(_0x6230('0x13'));var hardwareService=require(_0x6230('0x14'));var logger=require(_0x6230('0x15'))(_0x6230('0x16'));var utils=require(_0x6230('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3874b5,_0x505b0b){_0x505b0b=_0x505b0b||0xcc;return function(_0x3137b7){if(_0x3137b7){return _0x3874b5[_0x6230('0x18')](_0x505b0b);}return _0x3874b5['status'](_0x505b0b)[_0x6230('0x19')]();};}function respondWithResult(_0x20d073,_0x15bba7){_0x15bba7=_0x15bba7||0xc8;return function(_0x490f7b){if(_0x490f7b){return _0x20d073[_0x6230('0x1a')](_0x15bba7)[_0x6230('0x1b')](_0x490f7b);}};}function respondWithFilteredResult(_0x2e841b,_0x12cf82){return function(_0x2b5efa){if(_0x2b5efa){var _0x51576d=typeof _0x12cf82['offset']==='undefined'&&typeof _0x12cf82['limit']===_0x6230('0x1c');var _0x5be601=_0x2b5efa[_0x6230('0x1d')];var _0xa05d04=_0x51576d?0x0:_0x12cf82[_0x6230('0x1e')];var _0x3da236=_0x51576d?_0x2b5efa[_0x6230('0x1d')]:_0x12cf82[_0x6230('0x1e')]+_0x12cf82[_0x6230('0x1f')];var _0x55da30;if(_0x3da236>=_0x5be601){_0x3da236=_0x5be601;_0x55da30=0xc8;}else{_0x55da30=0xce;}_0x2e841b[_0x6230('0x1a')](_0x55da30);return _0x2e841b['set'](_0x6230('0x20'),_0xa05d04+'-'+_0x3da236+'/'+_0x5be601)[_0x6230('0x1b')](_0x2b5efa);}return null;};}function patchUpdates(_0x22fa4c){return function(_0x2a910c){try{jsonpatch[_0x6230('0x21')](_0x2a910c,_0x22fa4c,!![]);}catch(_0x45d38d){return BPromise['reject'](_0x45d38d);}return _0x2a910c[_0x6230('0x22')]();};}function saveUpdates(_0x307f62,_0x43d271){return function(_0x3e554d){if(_0x3e554d){return _0x3e554d[_0x6230('0x23')](_0x307f62)[_0x6230('0x24')](function(_0x54198d){return _0x54198d;});}return null;};}function removeEntity(_0x1e179b,_0x5dc7f6){return function(_0x561923){if(_0x561923){return _0x561923[_0x6230('0x25')]()[_0x6230('0x24')](function(){var _0x4196da=_0x561923[_0x6230('0x26')]({'plain':!![]});var _0x3237fc=_0x6230('0x27');return db[_0x6230('0x28')][_0x6230('0x25')]({'where':{'type':_0x3237fc,'resourceId':_0x4196da['id']}})['then'](function(){return _0x561923;});})[_0x6230('0x24')](function(){_0x1e179b[_0x6230('0x1a')](0xcc)[_0x6230('0x19')]();});}};}function handleEntityNotFound(_0x46aaa3,_0x2bdb83){return function(_0x33b41a){if(!_0x33b41a){_0x46aaa3['sendStatus'](0x194);}return _0x33b41a;};}function handleError(_0x39b5ae,_0x36765a){_0x36765a=_0x36765a||0x1f4;return function(_0x6255aa){logger[_0x6230('0x29')](_0x6255aa[_0x6230('0x2a')]);if(_0x6255aa[_0x6230('0x2b')]){delete _0x6255aa[_0x6230('0x2b')];}_0x39b5ae['status'](_0x36765a)[_0x6230('0x2c')](_0x6255aa);};}exports[_0x6230('0x2d')]=function(_0xe5dac9,_0xe8e1ed){var _0x58ae17={},_0x12d4db={},_0x4d3304={'count':0x0,'rows':[]};var _0x701c4=_[_0x6230('0x2e')](db[_0x6230('0x2f')][_0x6230('0x30')],function(_0x4d7eb2){return{'name':_0x4d7eb2['fieldName'],'type':_0x4d7eb2['type'][_0x6230('0x31')]};});_0x12d4db[_0x6230('0x32')]=_[_0x6230('0x2e')](_0x701c4,_0x6230('0x2b'));_0x12d4db[_0x6230('0x33')]=_[_0x6230('0x34')](_0xe5dac9[_0x6230('0x33')]);_0x12d4db[_0x6230('0x35')]=_['intersection'](_0x12d4db[_0x6230('0x32')],_0x12d4db['query']);_0x58ae17[_0x6230('0x36')]=_[_0x6230('0x37')](_0x12d4db[_0x6230('0x32')],qs[_0x6230('0x38')](_0xe5dac9['query'][_0x6230('0x38')]));_0x58ae17[_0x6230('0x36')]=_0x58ae17[_0x6230('0x36')][_0x6230('0x39')]?_0x58ae17[_0x6230('0x36')]:_0x12d4db[_0x6230('0x32')];if(!_0xe5dac9[_0x6230('0x33')][_0x6230('0x3a')](_0x6230('0x3b'))){_0x58ae17[_0x6230('0x1f')]=qs['limit'](_0xe5dac9[_0x6230('0x33')][_0x6230('0x1f')]);_0x58ae17[_0x6230('0x1e')]=qs[_0x6230('0x1e')](_0xe5dac9[_0x6230('0x33')][_0x6230('0x1e')]);}_0x58ae17[_0x6230('0x3c')]=qs['sort'](_0xe5dac9[_0x6230('0x33')][_0x6230('0x3d')]);_0x58ae17[_0x6230('0x3e')]=qs[_0x6230('0x35')](_['pick'](_0xe5dac9[_0x6230('0x33')],_0x12d4db['filters']),_0x701c4);if(_0xe5dac9[_0x6230('0x33')][_0x6230('0x3f')]){_0x58ae17[_0x6230('0x3e')]=_[_0x6230('0x40')](_0x58ae17['where'],{'$or':_[_0x6230('0x2e')](_0x701c4,function(_0x59ceac){if(_0x59ceac[_0x6230('0x41')]!==_0x6230('0x42')){var _0x251996={};_0x251996[_0x59ceac[_0x6230('0x2b')]]={'$like':'%'+_0xe5dac9[_0x6230('0x33')][_0x6230('0x3f')]+'%'};return _0x251996;}})});}_0x58ae17=_[_0x6230('0x40')]({},_0x58ae17,_0xe5dac9[_0x6230('0x43')]);var _0x5af7b3={'where':_0x58ae17[_0x6230('0x3e')]};return db[_0x6230('0x2f')][_0x6230('0x1d')](_0x5af7b3)[_0x6230('0x24')](function(_0x5d3639){_0x4d3304[_0x6230('0x1d')]=_0x5d3639;if(_0xe5dac9[_0x6230('0x33')]['includeAll']){_0x58ae17[_0x6230('0x44')]=[{'all':!![]}];}return db[_0x6230('0x2f')][_0x6230('0x45')](_0x58ae17);})['then'](function(_0x2bd0b7){_0x4d3304[_0x6230('0x46')]=_0x2bd0b7;return _0x4d3304;})['then'](respondWithFilteredResult(_0xe8e1ed,_0x58ae17))[_0x6230('0x47')](handleError(_0xe8e1ed,null));};exports[_0x6230('0x48')]=function(_0x382663,_0x32799d){var _0x495e23={'raw':!![],'where':{'id':_0x382663[_0x6230('0x49')]['id']}},_0x4ba566={};_0x4ba566[_0x6230('0x32')]=_['keys'](db['CmContactHasItem']['rawAttributes']);_0x4ba566['query']=_[_0x6230('0x34')](_0x382663['query']);_0x4ba566[_0x6230('0x35')]=_[_0x6230('0x37')](_0x4ba566['model'],_0x4ba566[_0x6230('0x33')]);_0x495e23[_0x6230('0x36')]=_[_0x6230('0x37')](_0x4ba566[_0x6230('0x32')],qs['fields'](_0x382663[_0x6230('0x33')]['fields']));_0x495e23[_0x6230('0x36')]=_0x495e23['attributes'][_0x6230('0x39')]?_0x495e23['attributes']:_0x4ba566['model'];if(_0x382663[_0x6230('0x33')][_0x6230('0x4a')]){_0x495e23[_0x6230('0x44')]=[{'all':!![]}];}_0x495e23=_[_0x6230('0x40')]({},_0x495e23,_0x382663[_0x6230('0x43')]);return db[_0x6230('0x2f')]['find'](_0x495e23)[_0x6230('0x24')](handleEntityNotFound(_0x32799d,null))[_0x6230('0x24')](respondWithResult(_0x32799d,null))[_0x6230('0x47')](handleError(_0x32799d,null));};exports['create']=function(_0x4755b8,_0x1ff80f){return db[_0x6230('0x2f')][_0x6230('0x4b')](_0x4755b8[_0x6230('0x4c')],{})[_0x6230('0x24')](function(_0x572e05){var _0x3aaf06=_0x4755b8[_0x6230('0x4d')][_0x6230('0x26')]({'plain':!![]});if(!_0x3aaf06)throw new Error(_0x6230('0x4e'));if(_0x3aaf06[_0x6230('0x4f')]==='user'){var _0x9cdfd3=_0x572e05[_0x6230('0x26')]({'plain':!![]});var _0x4fddeb=_0x6230('0x27');return db[_0x6230('0x50')]['find']({'where':{'name':_0x4fddeb,'userProfileId':_0x3aaf06[_0x6230('0x51')]},'raw':!![]})[_0x6230('0x24')](function(_0x27431b){if(_0x27431b&&_0x27431b['autoAssociation']===0x0){return db[_0x6230('0x28')]['create']({'name':_0x9cdfd3[_0x6230('0x2b')],'resourceId':_0x9cdfd3['id'],'type':_0x27431b[_0x6230('0x2b')],'sectionId':_0x27431b['id']},{})[_0x6230('0x24')](function(){return _0x572e05;});}else{return _0x572e05;}})[_0x6230('0x47')](function(_0x37a263){logger['error'](_0x6230('0x52'),_0x37a263);throw _0x37a263;});}return _0x572e05;})[_0x6230('0x24')](respondWithResult(_0x1ff80f,0xc9))[_0x6230('0x47')](handleError(_0x1ff80f,null));};exports[_0x6230('0x23')]=function(_0x16b7c0,_0x47998f){if(_0x16b7c0[_0x6230('0x4c')]['id']){delete _0x16b7c0[_0x6230('0x4c')]['id'];}return db[_0x6230('0x2f')][_0x6230('0x53')]({'where':{'id':_0x16b7c0['params']['id']}})[_0x6230('0x24')](handleEntityNotFound(_0x47998f,null))[_0x6230('0x24')](saveUpdates(_0x16b7c0[_0x6230('0x4c')],null))[_0x6230('0x24')](respondWithResult(_0x47998f,null))[_0x6230('0x47')](handleError(_0x47998f,null));};exports[_0x6230('0x25')]=function(_0x38a92c,_0x3bcfdf){return db['CmContactHasItem'][_0x6230('0x53')]({'where':{'id':_0x38a92c['params']['id']}})['then'](handleEntityNotFound(_0x3bcfdf,null))['then'](removeEntity(_0x3bcfdf,null))['catch'](handleError(_0x3bcfdf,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index eba2edf..1f19bc7 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 _0xeea4=['request-promise','path','rimraf','./cmContactHasItem.attributes','define','cm_contact_has_items','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xeb1bd9,_0x5a21e5){var _0x54967e=function(_0x3536ba){while(--_0x3536ba){_0xeb1bd9['push'](_0xeb1bd9['shift']());}};_0x54967e(++_0x5a21e5);}(_0xeea4,0x19e));var _0x4eea=function(_0x43a6e0,_0x1de407){_0x43a6e0=_0x43a6e0-0x0;var _0x4109f7=_0xeea4[_0x43a6e0];return _0x4109f7;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var logger=require(_0x4eea('0x2'))(_0x4eea('0x3'));var moment=require(_0x4eea('0x4'));var BPromise=require(_0x4eea('0x5'));var rp=require(_0x4eea('0x6'));var fs=require('fs');var path=require(_0x4eea('0x7'));var rimraf=require(_0x4eea('0x8'));var config=require('../../config/environment');var attributes=require(_0x4eea('0x9'));module['exports']=function(_0x2df4ae,_0x383566){return _0x2df4ae[_0x4eea('0xa')]('CmContactHasItem',attributes,{'tableName':_0x4eea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xca73=['rimraf','../../config/environment','./cmContactHasItem.attributes','cm_contact_has_items','lodash','util','api','moment','bluebird','path'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xca73,0xf4));var _0x3ca7=function(_0x1c1cd4,_0x59ec9f){_0x1c1cd4=_0x1c1cd4-0x0;var _0x4db26a=_0xca73[_0x1c1cd4];return _0x4db26a;};'use strict';var _=require(_0x3ca7('0x0'));var util=require(_0x3ca7('0x1'));var logger=require('../../config/logger')(_0x3ca7('0x2'));var moment=require(_0x3ca7('0x3'));var BPromise=require(_0x3ca7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ca7('0x5'));var rimraf=require(_0x3ca7('0x6'));var config=require(_0x3ca7('0x7'));var attributes=require(_0x3ca7('0x8'));module['exports']=function(_0x3f3bac,_0x3129e3){return _0x3f3bac['define']('CmContactHasItem',attributes,{'tableName':_0x3ca7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 1076681..fdc0b34 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 _0xd932=['client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x5b29a1,_0xb626b6){var _0x2dd190=function(_0x25dff2){while(--_0x25dff2){_0x5b29a1['push'](_0x5b29a1['shift']());}};_0x2dd190(++_0xb626b6);}(_0xd932,0x6a));var _0x2d93=function(_0x2f4d97,_0x296a32){_0x2f4d97=_0x2f4d97-0x0;var _0x2e33aa=_0xd932[_0x2f4d97];return _0x2e33aa;};'use strict';var _=require(_0x2d93('0x0'));var util=require(_0x2d93('0x1'));var moment=require(_0x2d93('0x2'));var BPromise=require(_0x2d93('0x3'));var rs=require(_0x2d93('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d93('0x5'));var logger=require('../../config/logger')(_0x2d93('0x6'));var config=require(_0x2d93('0x7'));var jayson=require(_0x2d93('0x8'));var client=jayson[_0x2d93('0x9')][_0x2d93('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2f2863,_0x5efc29,_0x5b7d00){return new BPromise(function(_0x238b0e,_0x36f272){return client[_0x2d93('0xb')](_0x2f2863,_0x5b7d00)[_0x2d93('0xc')](function(_0x27407a){logger[_0x2d93('0xd')](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));logger[_0x2d93('0x10')](_0x2d93('0x11'),_0x5efc29,_0x2d93('0xf'),JSON[_0x2d93('0x12')](_0x27407a));if(_0x27407a['error']){if(_0x27407a['error']['code']===0x1f4){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x27407a[_0x2d93('0x13')][_0x2d93('0x14')]);return _0x36f272(_0x27407a['error'][_0x2d93('0x14')]);}logger[_0x2d93('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x5efc29,_0x27407a[_0x2d93('0x13')]['message']);return _0x238b0e(_0x27407a['error'][_0x2d93('0x14')]);}else{logger['info'](_0x2d93('0xe'),_0x5efc29,_0x2d93('0xf'));_0x238b0e(_0x27407a[_0x2d93('0x15')]['message']);}})[_0x2d93('0x16')](function(_0x387772){logger[_0x2d93('0x13')](_0x2d93('0xe'),_0x5efc29,_0x387772);_0x36f272(_0x387772);});});} \ No newline at end of file +var _0x565f=['lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x565f,0x190));var _0xf565=function(_0x23e2c0,_0x152510){_0x23e2c0=_0x23e2c0-0x0;var _0x33d313=_0x565f[_0x23e2c0];return _0x33d313;};'use strict';var _=require(_0xf565('0x0'));var util=require(_0xf565('0x1'));var moment=require(_0xf565('0x2'));var BPromise=require(_0xf565('0x3'));var rs=require(_0xf565('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf565('0x5'));var logger=require('../../config/logger')(_0xf565('0x6'));var config=require(_0xf565('0x7'));var jayson=require(_0xf565('0x8'));var client=jayson[_0xf565('0x9')][_0xf565('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2386e7,_0x42ca64,_0x31525f){return new BPromise(function(_0x4aa087,_0x4629ee){return client[_0xf565('0xb')](_0x2386e7,_0x31525f)[_0xf565('0xc')](function(_0x43ca96){logger['info'](_0xf565('0xd'),_0x42ca64,_0xf565('0xe'));logger[_0xf565('0xf')](_0xf565('0x10'),_0x42ca64,'request\x20sent',JSON[_0xf565('0x11')](_0x43ca96));if(_0x43ca96[_0xf565('0x12')]){if(_0x43ca96['error']['code']===0x1f4){logger[_0xf565('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x42ca64,_0x43ca96[_0xf565('0x12')][_0xf565('0x13')]);return _0x4629ee(_0x43ca96[_0xf565('0x12')]['message']);}logger['error'](_0xf565('0xd'),_0x42ca64,_0x43ca96[_0xf565('0x12')][_0xf565('0x13')]);return _0x4aa087(_0x43ca96['error'][_0xf565('0x13')]);}else{logger['info'](_0xf565('0xd'),_0x42ca64,_0xf565('0xe'));_0x4aa087(_0x43ca96['result'][_0xf565('0x13')]);}})['catch'](function(_0x314f98){logger[_0xf565('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x42ca64,_0x314f98);_0x4629ee(_0x314f98);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7d7f8ca..de0f247 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 _0x9820=['delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x4c2537,_0x20afdf){var _0x94fb5c=function(_0x49e2f3){while(--_0x49e2f3){_0x4c2537['push'](_0x4c2537['shift']());}};_0x94fb5c(++_0x20afdf);}(_0x9820,0xb6));var _0x0982=function(_0xa42dd2,_0xb40a24){_0xa42dd2=_0xa42dd2-0x0;var _0x26c3f1=_0x9820[_0xa42dd2];return _0x26c3f1;};'use strict';var multer=require(_0x0982('0x0'));var util=require('util');var path=require(_0x0982('0x1'));var timeout=require(_0x0982('0x2'));var express=require(_0x0982('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0982('0x4'));var interaction=require(_0x0982('0x5'));var config=require(_0x0982('0x6'));var controller=require(_0x0982('0x7'));router[_0x0982('0x8')]('/',auth[_0x0982('0x9')](),controller[_0x0982('0xa')]);router[_0x0982('0x8')](_0x0982('0xb'),auth[_0x0982('0x9')](),controller[_0x0982('0xc')]);router[_0x0982('0xd')]('/',auth[_0x0982('0x9')](),controller['create']);router[_0x0982('0xe')](_0x0982('0xb'),auth[_0x0982('0x9')](),controller[_0x0982('0xf')]);router[_0x0982('0x10')](_0x0982('0xb'),auth[_0x0982('0x9')](),controller['destroy']);module[_0x0982('0x11')]=router; \ No newline at end of file +var _0x2ac2=['create','put','update','delete','exports','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post'];(function(_0x2de227,_0x258cf2){var _0x86822d=function(_0xafb11c){while(--_0xafb11c){_0x2de227['push'](_0x2de227['shift']());}};_0x86822d(++_0x258cf2);}(_0x2ac2,0x125));var _0x22ac=function(_0x2be7a1,_0xfe9dbe){_0x2be7a1=_0x2be7a1-0x0;var _0xcb56e1=_0x2ac2[_0x2be7a1];return _0xcb56e1;};'use strict';var multer=require('multer');var util=require(_0x22ac('0x0'));var path=require('path');var timeout=require(_0x22ac('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x22ac('0x2'));var interaction=require(_0x22ac('0x3'));var config=require(_0x22ac('0x4'));var controller=require('./cmContactHasItem.controller');router[_0x22ac('0x5')]('/',auth[_0x22ac('0x6')](),controller[_0x22ac('0x7')]);router[_0x22ac('0x5')](_0x22ac('0x8'),auth[_0x22ac('0x6')](),controller[_0x22ac('0x9')]);router[_0x22ac('0xa')]('/',auth['isAuthenticated'](),controller[_0x22ac('0xb')]);router[_0x22ac('0xc')](_0x22ac('0x8'),auth[_0x22ac('0x6')](),controller[_0x22ac('0xd')]);router[_0x22ac('0xe')](_0x22ac('0x8'),auth['isAuthenticated'](),controller['destroy']);module[_0x22ac('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7c45a79..483b37f 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 _0x9b18=['exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select','values','isArray','BOOLEAN','ENUM','voice','sequelize','lodash'];(function(_0x651aaf,_0x35f9a4){var _0x5efa91=function(_0x36fb6f){while(--_0x36fb6f){_0x651aaf['push'](_0x651aaf['shift']());}};_0x5efa91(++_0x35f9a4);}(_0x9b18,0x1a7));var _0x89b1=function(_0x26b5ff,_0x92009a){_0x26b5ff=_0x26b5ff-0x0;var _0x58603e=_0x9b18[_0x26b5ff];return _0x58603e;};'use strict';var Sequelize=require(_0x89b1('0x0'));var _=require(_0x89b1('0x1'));module[_0x89b1('0x2')]={'name':{'type':Sequelize[_0x89b1('0x3')],'get':function(_0x444e49){return this[_0x89b1('0x4')](_0x89b1('0x5'));}},'alias':{'type':Sequelize[_0x89b1('0x6')],'allowNull':![],'set':function(_0x28228d){this[_0x89b1('0x7')](_0x89b1('0x5'),_0x28228d?_0x28228d:this['getDataValue'](_0x89b1('0x8')));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize[_0x89b1('0x9')](_0x89b1('0xa')),'get':function(){if(this[_0x89b1('0x4')]('type')===_0x89b1('0xb')){return JSON['parse'](this[_0x89b1('0x4')](_0x89b1('0xc')));}else{return this[_0x89b1('0x4')]('values');}},'set':function(_0x24b66f){if(Array[_0x89b1('0xd')](_0x24b66f)){this['setDataValue'](_0x89b1('0xc'),JSON['stringify'](_0x24b66f));}else{this[_0x89b1('0x7')](_0x89b1('0xc'),_0x24b66f);}}},'required':{'type':Sequelize[_0x89b1('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x89b1('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x89b1('0xf')](_0x89b1('0x10'))}}; \ No newline at end of file +var _0x2821=['VIRTUAL','getDataValue','alias','name','STRING','TEXT','type','select','parse','values','isArray','setDataValue','BOOLEAN','ENUM','sequelize','lodash'];(function(_0xebc64a,_0x440ee2){var _0x5131e1=function(_0x2d3720){while(--_0x2d3720){_0xebc64a['push'](_0xebc64a['shift']());}};_0x5131e1(++_0x440ee2);}(_0x2821,0x19e));var _0x1282=function(_0x2a3f5b,_0x304c7e){_0x2a3f5b=_0x2a3f5b-0x0;var _0x47edaf=_0x2821[_0x2a3f5b];return _0x47edaf;};'use strict';var Sequelize=require(_0x1282('0x0'));var _=require(_0x1282('0x1'));module['exports']={'name':{'type':Sequelize[_0x1282('0x2')],'get':function(_0x469556){return this[_0x1282('0x3')](_0x1282('0x4'));}},'alias':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x3cb017){this['setDataValue']('alias',_0x3cb017?_0x3cb017:this[_0x1282('0x3')](_0x1282('0x5')));}},'type':{'type':Sequelize[_0x1282('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0x1282('0x7')]('long'),'get':function(){if(this[_0x1282('0x3')](_0x1282('0x8'))===_0x1282('0x9')){return JSON[_0x1282('0xa')](this[_0x1282('0x3')](_0x1282('0xb')));}else{return this[_0x1282('0x3')]('values');}},'set':function(_0x93ab02){if(Array[_0x1282('0xc')](_0x93ab02)){this[_0x1282('0xd')]('values',JSON['stringify'](_0x93ab02));}else{this[_0x1282('0xd')](_0x1282('0xb'),_0x93ab02);}}},'required':{'type':Sequelize[_0x1282('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1282('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1282('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8e69421..c5780ec 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 _0x3e2a=['show','find','body','params','destroy','create','sequelize','Sequelize','TEXT','text','number','switch','BOOLEAN','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','Content-Range','save','update','then','name','send','index','map','rawAttributes','fieldName','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','CmCustomField','findAll','rows','catch'];(function(_0x4699da,_0x50b098){var _0x5b745d=function(_0x14c792){while(--_0x14c792){_0x4699da['push'](_0x4699da['shift']());}};_0x5b745d(++_0x50b098);}(_0x3e2a,0x10c));var _0xa3e2=function(_0x438687,_0x16e2fe){_0x438687=_0x438687-0x0;var _0x2e3313=_0x3e2a[_0x438687];return _0x2e3313;};'use strict';var emlformat=require(_0xa3e2('0x0'));var rimraf=require(_0xa3e2('0x1'));var zipdir=require(_0xa3e2('0x2'));var jsonpatch=require(_0xa3e2('0x3'));var rp=require(_0xa3e2('0x4'));var moment=require(_0xa3e2('0x5'));var BPromise=require(_0xa3e2('0x6'));var Mustache=require(_0xa3e2('0x7'));var util=require(_0xa3e2('0x8'));var path=require('path');var sox=require(_0xa3e2('0x9'));var csv=require('to-csv');var ejs=require(_0xa3e2('0xa'));var fs=require('fs');var fs_extra=require(_0xa3e2('0xb'));var _=require(_0xa3e2('0xc'));var squel=require(_0xa3e2('0xd'));var crypto=require(_0xa3e2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xa3e2('0xf'));var toCsv=require(_0xa3e2('0x10'));var querystring=require('querystring');var Papa=require(_0xa3e2('0x11'));var Redis=require(_0xa3e2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa3e2('0x13'));var logger=require(_0xa3e2('0x14'))(_0xa3e2('0x15'));var utils=require('../../config/utils');var config=require(_0xa3e2('0x16'));var licenseUtil=require(_0xa3e2('0x17'));var db=require(_0xa3e2('0x18'))['db'];function respondWithStatusCode(_0x48627f,_0x3556e0){_0x3556e0=_0x3556e0||0xcc;return function(_0x3b6884){if(_0x3b6884){return _0x48627f['sendStatus'](_0x3556e0);}return _0x48627f[_0xa3e2('0x19')](_0x3556e0)[_0xa3e2('0x1a')]();};}function respondWithResult(_0x47aa71,_0x1f7ca2){_0x1f7ca2=_0x1f7ca2||0xc8;return function(_0x570cf2){if(_0x570cf2){return _0x47aa71['status'](_0x1f7ca2)[_0xa3e2('0x1b')](_0x570cf2);}};}function respondWithFilteredResult(_0x27e259,_0x3f2319){return function(_0x4d1c19){if(_0x4d1c19){var _0x2dd399=typeof _0x3f2319['offset']===_0xa3e2('0x1c')&&typeof _0x3f2319['limit']===_0xa3e2('0x1c');var _0xde7e29=_0x4d1c19[_0xa3e2('0x1d')];var _0x2486c1=_0x2dd399?0x0:_0x3f2319[_0xa3e2('0x1e')];var _0x3fb6d1=_0x2dd399?_0x4d1c19['count']:_0x3f2319[_0xa3e2('0x1e')]+_0x3f2319[_0xa3e2('0x1f')];var _0x7471c1;if(_0x3fb6d1>=_0xde7e29){_0x3fb6d1=_0xde7e29;_0x7471c1=0xc8;}else{_0x7471c1=0xce;}_0x27e259[_0xa3e2('0x19')](_0x7471c1);return _0x27e259[_0xa3e2('0x20')](_0xa3e2('0x21'),_0x2486c1+'-'+_0x3fb6d1+'/'+_0xde7e29)[_0xa3e2('0x1b')](_0x4d1c19);}return null;};}function patchUpdates(_0x1c697b){return function(_0x247003){try{jsonpatch['apply'](_0x247003,_0x1c697b,!![]);}catch(_0x3d8540){return BPromise['reject'](_0x3d8540);}return _0x247003[_0xa3e2('0x22')]();};}function saveUpdates(_0x36b93d,_0xbc7240){return function(_0x480b59){if(_0x480b59){return _0x480b59[_0xa3e2('0x23')](_0x36b93d)[_0xa3e2('0x24')](function(_0x5d63c4){return _0x5d63c4;});}return null;};}function removeEntity(_0x29559c,_0x416730){return function(_0x1c9411){if(_0x1c9411){return _0x1c9411['destroy']()['then'](function(){_0x29559c['status'](0xcc)[_0xa3e2('0x1a')]();});}};}function handleEntityNotFound(_0x32c1e7,_0x27c274){return function(_0x51c82b){if(!_0x51c82b){_0x32c1e7['sendStatus'](0x194);}return _0x51c82b;};}function handleError(_0x40348e,_0x3b06bb){_0x3b06bb=_0x3b06bb||0x1f4;return function(_0xd5af7b){logger['error'](_0xd5af7b['stack']);if(_0xd5af7b['name']){delete _0xd5af7b[_0xa3e2('0x25')];}_0x40348e[_0xa3e2('0x19')](_0x3b06bb)[_0xa3e2('0x26')](_0xd5af7b);};}exports[_0xa3e2('0x27')]=function(_0x4098a6,_0x217d0b){var _0xa260de={},_0x2d6d88={},_0x1535a8={'count':0x0,'rows':[]};var _0x46113e=_[_0xa3e2('0x28')](db['CmCustomField'][_0xa3e2('0x29')],function(_0x55a939){return{'name':_0x55a939[_0xa3e2('0x2a')],'type':_0x55a939[_0xa3e2('0x2b')]['key']};});_0x2d6d88[_0xa3e2('0x2c')]=_[_0xa3e2('0x2d')](_['map'](_0x46113e,_0xa3e2('0x25')),[_0xa3e2('0x25')]);_0x2d6d88[_0xa3e2('0x2e')]=_[_0xa3e2('0x2f')](_0x4098a6[_0xa3e2('0x2e')]);_0x2d6d88[_0xa3e2('0x30')]=_[_0xa3e2('0x31')](_0x2d6d88[_0xa3e2('0x2c')],_0x2d6d88['query']);_0xa260de[_0xa3e2('0x32')]=_[_0xa3e2('0x31')](_0x2d6d88[_0xa3e2('0x2c')],qs[_0xa3e2('0x33')](_0x4098a6[_0xa3e2('0x2e')]['fields']));_0xa260de['attributes']=_0xa260de[_0xa3e2('0x32')][_0xa3e2('0x34')]?_0xa260de[_0xa3e2('0x32')]:_0x2d6d88['model'];if(!_0x4098a6[_0xa3e2('0x2e')][_0xa3e2('0x35')](_0xa3e2('0x36'))){_0xa260de['limit']=qs[_0xa3e2('0x1f')](_0x4098a6['query']['limit']);_0xa260de[_0xa3e2('0x1e')]=qs['offset'](_0x4098a6['query'][_0xa3e2('0x1e')]);}_0xa260de[_0xa3e2('0x37')]=qs['sort'](_0x4098a6[_0xa3e2('0x2e')]['sort']);_0xa260de[_0xa3e2('0x38')]=qs[_0xa3e2('0x30')](_[_0xa3e2('0x39')](_0x4098a6[_0xa3e2('0x2e')],_0x2d6d88[_0xa3e2('0x30')]),_0x46113e);if(_0x4098a6[_0xa3e2('0x2e')][_0xa3e2('0x3a')]){_0xa260de[_0xa3e2('0x38')]=_[_0xa3e2('0x3b')](_0xa260de[_0xa3e2('0x38')],{'$or':_['map'](_0x46113e,function(_0x52ba4a){if(_0x52ba4a[_0xa3e2('0x2b')]!==_0xa3e2('0x3c')){var _0x4f2cd2={};_0x4f2cd2[_0x52ba4a['name']]={'$like':'%'+_0x4098a6[_0xa3e2('0x2e')][_0xa3e2('0x3a')]+'%'};return _0x4f2cd2;}})});}_0xa260de=_[_0xa3e2('0x3b')]({},_0xa260de,_0x4098a6[_0xa3e2('0x3d')]);var _0x35aae9={'where':_0xa260de[_0xa3e2('0x38')]};return db['CmCustomField'][_0xa3e2('0x1d')](_0x35aae9)[_0xa3e2('0x24')](function(_0x5137be){_0x1535a8[_0xa3e2('0x1d')]=_0x5137be;if(_0x4098a6['query'][_0xa3e2('0x3e')]){_0xa260de[_0xa3e2('0x3f')]=[{'all':!![]}];}return db[_0xa3e2('0x40')][_0xa3e2('0x41')](_0xa260de);})['then'](function(_0xfd0737){_0x1535a8[_0xa3e2('0x42')]=_0xfd0737;return _0x1535a8;})[_0xa3e2('0x24')](respondWithFilteredResult(_0x217d0b,_0xa260de))[_0xa3e2('0x43')](handleError(_0x217d0b,null));};exports[_0xa3e2('0x44')]=function(_0x4af843,_0x30ab6f){var _0x76cdb8={'raw':!![],'where':{'id':_0x4af843['params']['id']}},_0xdce978={};_0xdce978[_0xa3e2('0x2c')]=_[_0xa3e2('0x2f')](db[_0xa3e2('0x40')][_0xa3e2('0x29')]);_0xdce978[_0xa3e2('0x2e')]=_['keys'](_0x4af843[_0xa3e2('0x2e')]);_0xdce978[_0xa3e2('0x30')]=_[_0xa3e2('0x31')](_0xdce978['model'],_0xdce978['query']);_0x76cdb8[_0xa3e2('0x32')]=_[_0xa3e2('0x31')](_0xdce978['model'],qs[_0xa3e2('0x33')](_0x4af843[_0xa3e2('0x2e')][_0xa3e2('0x33')]));_0x76cdb8[_0xa3e2('0x32')]=_0x76cdb8[_0xa3e2('0x32')][_0xa3e2('0x34')]?_0x76cdb8[_0xa3e2('0x32')]:_0xdce978[_0xa3e2('0x2c')];if(_0x4af843[_0xa3e2('0x2e')][_0xa3e2('0x3e')]){_0x76cdb8[_0xa3e2('0x3f')]=[{'all':!![]}];}_0x76cdb8=_[_0xa3e2('0x3b')]({},_0x76cdb8,_0x4af843[_0xa3e2('0x3d')]);return db[_0xa3e2('0x40')][_0xa3e2('0x45')](_0x76cdb8)[_0xa3e2('0x24')](handleEntityNotFound(_0x30ab6f,null))['then'](respondWithResult(_0x30ab6f,null))['catch'](handleError(_0x30ab6f,null));};exports[_0xa3e2('0x23')]=function(_0x4da7b0,_0x21ce4c){if(_0x4da7b0[_0xa3e2('0x46')]['id']){delete _0x4da7b0['body']['id'];}return db[_0xa3e2('0x40')][_0xa3e2('0x45')]({'where':{'id':_0x4da7b0[_0xa3e2('0x47')]['id']}})['then'](handleEntityNotFound(_0x21ce4c,null))[_0xa3e2('0x24')](saveUpdates(_0x4da7b0['body'],null))[_0xa3e2('0x24')](respondWithResult(_0x21ce4c,null))[_0xa3e2('0x43')](handleError(_0x21ce4c,null));};exports[_0xa3e2('0x48')]=function(_0x58b347,_0x26c22e){return db[_0xa3e2('0x40')]['find']({'where':{'id':_0x58b347['params']['id']}})[_0xa3e2('0x24')](handleEntityNotFound(_0x26c22e,null))[_0xa3e2('0x24')](removeEntity(_0x26c22e,null))[_0xa3e2('0x43')](handleError(_0x26c22e,null));};exports[_0xa3e2('0x49')]=function(_0x18208f,_0x2407d5){var _0x4c4d7a;return db[_0xa3e2('0x4a')]['transaction'](function(_0x48aff7){return db['CmCustomField'][_0xa3e2('0x49')](_0x18208f[_0xa3e2('0x46')],{'transaction':_0x48aff7})[_0xa3e2('0x24')](function(_0x5bf3bb){_0x4c4d7a=_0x5bf3bb;var _0x452af1={'type':db[_0xa3e2('0x4b')][_0xa3e2('0x4c')],'transaction':_0x48aff7};switch(_0x18208f[_0xa3e2('0x46')][_0xa3e2('0x2b')]){case _0xa3e2('0x4d'):_0x452af1[_0xa3e2('0x2b')]=db[_0xa3e2('0x4b')][_0xa3e2('0x4c')];break;case _0xa3e2('0x4e'):_0x452af1[_0xa3e2('0x2b')]=db[_0xa3e2('0x4b')]['INTEGER'];break;case _0xa3e2('0x4f'):_0x452af1[_0xa3e2('0x2b')]=db[_0xa3e2('0x4b')][_0xa3e2('0x50')];_0x452af1['defaultValue']=![];break;default:}return db[_0xa3e2('0x4a')]['queryInterface']['addColumn'](_0xa3e2('0x51'),util[_0xa3e2('0x52')](_0xa3e2('0x53'),_0x4c4d7a['id']),_0x452af1);})[_0xa3e2('0x24')](function(){return _0x4c4d7a;});})[_0xa3e2('0x24')](respondWithResult(_0x2407d5,0xc9))['catch'](handleError(_0x2407d5,null));}; \ No newline at end of file +var _0x4aa8=['name','index','map','CmCustomField','rawAttributes','type','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','update','body','create','sequelize','transaction','Sequelize','text','TEXT','number','INTEGER','BOOLEAN','queryInterface','addColumn','cm_contacts','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','destroy','then','error','stack'];(function(_0xdd9a5f,_0x3ced93){var _0x3464b7=function(_0x35b534){while(--_0x35b534){_0xdd9a5f['push'](_0xdd9a5f['shift']());}};_0x3464b7(++_0x3ced93);}(_0x4aa8,0x88));var _0x84aa=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x4aa8[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x84aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84aa('0x1'));var jsonpatch=require(_0x84aa('0x2'));var rp=require(_0x84aa('0x3'));var moment=require(_0x84aa('0x4'));var BPromise=require(_0x84aa('0x5'));var Mustache=require(_0x84aa('0x6'));var util=require(_0x84aa('0x7'));var path=require(_0x84aa('0x8'));var sox=require(_0x84aa('0x9'));var csv=require('to-csv');var ejs=require(_0x84aa('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x84aa('0xb'));var crypto=require('crypto');var jsforce=require(_0x84aa('0xc'));var deskjs=require(_0x84aa('0xd'));var toCsv=require(_0x84aa('0xe'));var querystring=require(_0x84aa('0xf'));var Papa=require(_0x84aa('0x10'));var Redis=require(_0x84aa('0x11'));var authService=require(_0x84aa('0x12'));var qs=require(_0x84aa('0x13'));var as=require(_0x84aa('0x14'));var hardwareService=require(_0x84aa('0x15'));var logger=require(_0x84aa('0x16'))(_0x84aa('0x17'));var utils=require('../../config/utils');var config=require(_0x84aa('0x18'));var licenseUtil=require(_0x84aa('0x19'));var db=require(_0x84aa('0x1a'))['db'];function respondWithStatusCode(_0x3653bb,_0x437acf){_0x437acf=_0x437acf||0xcc;return function(_0x248248){if(_0x248248){return _0x3653bb[_0x84aa('0x1b')](_0x437acf);}return _0x3653bb[_0x84aa('0x1c')](_0x437acf)[_0x84aa('0x1d')]();};}function respondWithResult(_0x52faf0,_0x5b9089){_0x5b9089=_0x5b9089||0xc8;return function(_0x5db879){if(_0x5db879){return _0x52faf0[_0x84aa('0x1c')](_0x5b9089)[_0x84aa('0x1e')](_0x5db879);}};}function respondWithFilteredResult(_0x14b055,_0x1cde5c){return function(_0x5d454f){if(_0x5d454f){var _0x5eadaf=typeof _0x1cde5c[_0x84aa('0x1f')]===_0x84aa('0x20')&&typeof _0x1cde5c[_0x84aa('0x21')]===_0x84aa('0x20');var _0x41aab5=_0x5d454f['count'];var _0x3547a5=_0x5eadaf?0x0:_0x1cde5c[_0x84aa('0x1f')];var _0x8ebf5d=_0x5eadaf?_0x5d454f[_0x84aa('0x22')]:_0x1cde5c[_0x84aa('0x1f')]+_0x1cde5c[_0x84aa('0x21')];var _0x410ad1;if(_0x8ebf5d>=_0x41aab5){_0x8ebf5d=_0x41aab5;_0x410ad1=0xc8;}else{_0x410ad1=0xce;}_0x14b055[_0x84aa('0x1c')](_0x410ad1);return _0x14b055['set'](_0x84aa('0x23'),_0x3547a5+'-'+_0x8ebf5d+'/'+_0x41aab5)[_0x84aa('0x1e')](_0x5d454f);}return null;};}function patchUpdates(_0x155410){return function(_0x44b499){try{jsonpatch[_0x84aa('0x24')](_0x44b499,_0x155410,!![]);}catch(_0x5a46e6){return BPromise['reject'](_0x5a46e6);}return _0x44b499[_0x84aa('0x25')]();};}function saveUpdates(_0x24a432,_0x2c20d4){return function(_0x4ea18a){if(_0x4ea18a){return _0x4ea18a['update'](_0x24a432)['then'](function(_0x47a8e0){return _0x47a8e0;});}return null;};}function removeEntity(_0x4b191f,_0x3d389e){return function(_0x4e6df6){if(_0x4e6df6){return _0x4e6df6[_0x84aa('0x26')]()[_0x84aa('0x27')](function(){_0x4b191f[_0x84aa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e4487,_0x166e27){return function(_0x4d09d0){if(!_0x4d09d0){_0x1e4487[_0x84aa('0x1b')](0x194);}return _0x4d09d0;};}function handleError(_0x2034e0,_0x37fb35){_0x37fb35=_0x37fb35||0x1f4;return function(_0x59718d){logger[_0x84aa('0x28')](_0x59718d[_0x84aa('0x29')]);if(_0x59718d[_0x84aa('0x2a')]){delete _0x59718d[_0x84aa('0x2a')];}_0x2034e0[_0x84aa('0x1c')](_0x37fb35)['send'](_0x59718d);};}exports[_0x84aa('0x2b')]=function(_0x58c2c9,_0x2f1b61){var _0x21f25a={},_0x1cf07c={},_0x9c6572={'count':0x0,'rows':[]};var _0x525263=_[_0x84aa('0x2c')](db[_0x84aa('0x2d')][_0x84aa('0x2e')],function(_0x2c73f7){return{'name':_0x2c73f7['fieldName'],'type':_0x2c73f7[_0x84aa('0x2f')]['key']};});_0x1cf07c[_0x84aa('0x30')]=_[_0x84aa('0x31')](_[_0x84aa('0x2c')](_0x525263,_0x84aa('0x2a')),[_0x84aa('0x2a')]);_0x1cf07c[_0x84aa('0x32')]=_[_0x84aa('0x33')](_0x58c2c9['query']);_0x1cf07c[_0x84aa('0x34')]=_[_0x84aa('0x35')](_0x1cf07c[_0x84aa('0x30')],_0x1cf07c['query']);_0x21f25a[_0x84aa('0x36')]=_[_0x84aa('0x35')](_0x1cf07c[_0x84aa('0x30')],qs[_0x84aa('0x37')](_0x58c2c9['query'][_0x84aa('0x37')]));_0x21f25a[_0x84aa('0x36')]=_0x21f25a[_0x84aa('0x36')][_0x84aa('0x38')]?_0x21f25a[_0x84aa('0x36')]:_0x1cf07c[_0x84aa('0x30')];if(!_0x58c2c9['query'][_0x84aa('0x39')](_0x84aa('0x3a'))){_0x21f25a[_0x84aa('0x21')]=qs[_0x84aa('0x21')](_0x58c2c9[_0x84aa('0x32')][_0x84aa('0x21')]);_0x21f25a[_0x84aa('0x1f')]=qs[_0x84aa('0x1f')](_0x58c2c9[_0x84aa('0x32')]['offset']);}_0x21f25a[_0x84aa('0x3b')]=qs[_0x84aa('0x3c')](_0x58c2c9[_0x84aa('0x32')][_0x84aa('0x3c')]);_0x21f25a[_0x84aa('0x3d')]=qs[_0x84aa('0x34')](_[_0x84aa('0x3e')](_0x58c2c9[_0x84aa('0x32')],_0x1cf07c[_0x84aa('0x34')]),_0x525263);if(_0x58c2c9[_0x84aa('0x32')][_0x84aa('0x3f')]){_0x21f25a[_0x84aa('0x3d')]=_[_0x84aa('0x40')](_0x21f25a[_0x84aa('0x3d')],{'$or':_[_0x84aa('0x2c')](_0x525263,function(_0x1a8dcc){if(_0x1a8dcc[_0x84aa('0x2f')]!==_0x84aa('0x41')){var _0x22baf2={};_0x22baf2[_0x1a8dcc['name']]={'$like':'%'+_0x58c2c9[_0x84aa('0x32')][_0x84aa('0x3f')]+'%'};return _0x22baf2;}})});}_0x21f25a=_[_0x84aa('0x40')]({},_0x21f25a,_0x58c2c9[_0x84aa('0x42')]);var _0x447395={'where':_0x21f25a[_0x84aa('0x3d')]};return db[_0x84aa('0x2d')][_0x84aa('0x22')](_0x447395)[_0x84aa('0x27')](function(_0x762dfe){_0x9c6572[_0x84aa('0x22')]=_0x762dfe;if(_0x58c2c9[_0x84aa('0x32')][_0x84aa('0x43')]){_0x21f25a[_0x84aa('0x44')]=[{'all':!![]}];}return db[_0x84aa('0x2d')][_0x84aa('0x45')](_0x21f25a);})[_0x84aa('0x27')](function(_0xb11296){_0x9c6572[_0x84aa('0x46')]=_0xb11296;return _0x9c6572;})[_0x84aa('0x27')](respondWithFilteredResult(_0x2f1b61,_0x21f25a))[_0x84aa('0x47')](handleError(_0x2f1b61,null));};exports[_0x84aa('0x48')]=function(_0x4507de,_0x1ae2db){var _0x423e5a={'raw':!![],'where':{'id':_0x4507de[_0x84aa('0x49')]['id']}},_0x2e82b3={};_0x2e82b3[_0x84aa('0x30')]=_[_0x84aa('0x33')](db[_0x84aa('0x2d')][_0x84aa('0x2e')]);_0x2e82b3[_0x84aa('0x32')]=_[_0x84aa('0x33')](_0x4507de[_0x84aa('0x32')]);_0x2e82b3['filters']=_['intersection'](_0x2e82b3[_0x84aa('0x30')],_0x2e82b3[_0x84aa('0x32')]);_0x423e5a['attributes']=_[_0x84aa('0x35')](_0x2e82b3['model'],qs['fields'](_0x4507de[_0x84aa('0x32')][_0x84aa('0x37')]));_0x423e5a[_0x84aa('0x36')]=_0x423e5a[_0x84aa('0x36')]['length']?_0x423e5a[_0x84aa('0x36')]:_0x2e82b3['model'];if(_0x4507de['query'][_0x84aa('0x43')]){_0x423e5a['include']=[{'all':!![]}];}_0x423e5a=_[_0x84aa('0x40')]({},_0x423e5a,_0x4507de['options']);return db[_0x84aa('0x2d')][_0x84aa('0x4a')](_0x423e5a)[_0x84aa('0x27')](handleEntityNotFound(_0x1ae2db,null))[_0x84aa('0x27')](respondWithResult(_0x1ae2db,null))[_0x84aa('0x47')](handleError(_0x1ae2db,null));};exports[_0x84aa('0x4b')]=function(_0x110ca2,_0x1f3f5e){if(_0x110ca2['body']['id']){delete _0x110ca2[_0x84aa('0x4c')]['id'];}return db[_0x84aa('0x2d')][_0x84aa('0x4a')]({'where':{'id':_0x110ca2[_0x84aa('0x49')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x1f3f5e,null))[_0x84aa('0x27')](saveUpdates(_0x110ca2[_0x84aa('0x4c')],null))[_0x84aa('0x27')](respondWithResult(_0x1f3f5e,null))[_0x84aa('0x47')](handleError(_0x1f3f5e,null));};exports['destroy']=function(_0x4e00de,_0x623fa){return db[_0x84aa('0x2d')]['find']({'where':{'id':_0x4e00de[_0x84aa('0x49')]['id']}})[_0x84aa('0x27')](handleEntityNotFound(_0x623fa,null))[_0x84aa('0x27')](removeEntity(_0x623fa,null))[_0x84aa('0x47')](handleError(_0x623fa,null));};exports[_0x84aa('0x4d')]=function(_0xa9f7,_0x1621fc){var _0x116d89;return db[_0x84aa('0x4e')][_0x84aa('0x4f')](function(_0xc58a71){return db[_0x84aa('0x2d')][_0x84aa('0x4d')](_0xa9f7[_0x84aa('0x4c')],{'transaction':_0xc58a71})['then'](function(_0x35b212){_0x116d89=_0x35b212;var _0x214abb={'type':db[_0x84aa('0x50')]['TEXT'],'transaction':_0xc58a71};switch(_0xa9f7[_0x84aa('0x4c')][_0x84aa('0x2f')]){case _0x84aa('0x51'):_0x214abb['type']=db[_0x84aa('0x50')][_0x84aa('0x52')];break;case _0x84aa('0x53'):_0x214abb[_0x84aa('0x2f')]=db[_0x84aa('0x50')][_0x84aa('0x54')];break;case'switch':_0x214abb[_0x84aa('0x2f')]=db[_0x84aa('0x50')][_0x84aa('0x55')];_0x214abb['defaultValue']=![];break;default:}return db[_0x84aa('0x4e')][_0x84aa('0x56')][_0x84aa('0x57')](_0x84aa('0x58'),util['format']('cf_%d',_0x116d89['id']),_0x214abb);})[_0x84aa('0x27')](function(){return _0x116d89;});})[_0x84aa('0x27')](respondWithResult(_0x1621fc,0xc9))[_0x84aa('0x47')](handleError(_0x1621fc,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fa3a93e..4b9b69b 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 _0x82c0=['exports','define','CmCustomField','cm_custom_fields','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x24e6f8,_0x18325d){var _0x36708f=function(_0x57a05b){while(--_0x57a05b){_0x24e6f8['push'](_0x24e6f8['shift']());}};_0x36708f(++_0x18325d);}(_0x82c0,0x138));var _0x082c=function(_0x55a58c,_0x56ab1f){_0x55a58c=_0x55a58c-0x0;var _0x33c533=_0x82c0[_0x55a58c];return _0x33c533;};'use strict';var _=require(_0x082c('0x0'));var util=require('util');var logger=require(_0x082c('0x1'))(_0x082c('0x2'));var moment=require(_0x082c('0x3'));var BPromise=require(_0x082c('0x4'));var rp=require(_0x082c('0x5'));var fs=require('fs');var path=require(_0x082c('0x6'));var rimraf=require(_0x082c('0x7'));var config=require(_0x082c('0x8'));var attributes=require(_0x082c('0x9'));module[_0x082c('0xa')]=function(_0x5da2f,_0x5eb1ae){return _0x5da2f[_0x082c('0xb')](_0x082c('0xc'),attributes,{'tableName':_0x082c('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1451=['exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x4e22c0,_0x4fd8ae){var _0x51d70d=function(_0x3cf515){while(--_0x3cf515){_0x4e22c0['push'](_0x4e22c0['shift']());}};_0x51d70d(++_0x4fd8ae);}(_0x1451,0x6f));var _0x1145=function(_0x9b081c,_0x6968a9){_0x9b081c=_0x9b081c-0x0;var _0x5a5979=_0x1451[_0x9b081c];return _0x5a5979;};'use strict';var _=require(_0x1145('0x0'));var util=require('util');var logger=require(_0x1145('0x1'))(_0x1145('0x2'));var moment=require(_0x1145('0x3'));var BPromise=require(_0x1145('0x4'));var rp=require(_0x1145('0x5'));var fs=require('fs');var path=require(_0x1145('0x6'));var rimraf=require(_0x1145('0x7'));var config=require(_0x1145('0x8'));var attributes=require(_0x1145('0x9'));module[_0x1145('0xa')]=function(_0x1dedaf,_0x184b7e){return _0x1dedaf['define']('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 1c80c36..b8fb6c9 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 _0xf663=['stringify','code','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf663,0x16b));var _0x3f66=function(_0x53f1ee,_0x29cff6){_0x53f1ee=_0x53f1ee-0x0;var _0x3638da=_0xf663[_0x53f1ee];return _0x3638da;};'use strict';var _=require(_0x3f66('0x0'));var util=require('util');var moment=require(_0x3f66('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f66('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f66('0x3'));var logger=require(_0x3f66('0x4'))(_0x3f66('0x5'));var config=require(_0x3f66('0x6'));var jayson=require(_0x3f66('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc9bb,_0x4d677f,_0x31ee7e){return new BPromise(function(_0x2fa516,_0x246618){return client[_0x3f66('0x8')](_0x1fc9bb,_0x31ee7e)[_0x3f66('0x9')](function(_0x4e9b80){logger[_0x3f66('0xa')](_0x3f66('0xb'),_0x4d677f,_0x3f66('0xc'));logger[_0x3f66('0xd')](_0x3f66('0xe'),_0x4d677f,_0x3f66('0xc'),JSON[_0x3f66('0xf')](_0x4e9b80));if(_0x4e9b80['error']){if(_0x4e9b80['error'][_0x3f66('0x10')]===0x1f4){logger[_0x3f66('0x11')](_0x3f66('0xb'),_0x4d677f,_0x4e9b80['error'][_0x3f66('0x12')]);return _0x246618(_0x4e9b80[_0x3f66('0x11')]['message']);}logger[_0x3f66('0x11')](_0x3f66('0xb'),_0x4d677f,_0x4e9b80[_0x3f66('0x11')]['message']);return _0x2fa516(_0x4e9b80[_0x3f66('0x11')][_0x3f66('0x12')]);}else{logger[_0x3f66('0xa')]('CmCustomField,\x20%s,\x20%s',_0x4d677f,_0x3f66('0xc'));_0x2fa516(_0x4e9b80[_0x3f66('0x13')][_0x3f66('0x12')]);}})[_0x3f66('0x14')](function(_0x1a4bc2){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4d677f,_0x1a4bc2);_0x246618(_0x1a4bc2);});});} \ No newline at end of file +var _0x0576=['info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then'];(function(_0x20e046,_0x3c6e13){var _0xc47a01=function(_0x3d6541){while(--_0x3d6541){_0x20e046['push'](_0x20e046['shift']());}};_0xc47a01(++_0x3c6e13);}(_0x0576,0x107));var _0x6057=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0576[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x6057('0x0'));var util=require(_0x6057('0x1'));var moment=require(_0x6057('0x2'));var BPromise=require(_0x6057('0x3'));var rs=require(_0x6057('0x4'));var fs=require('fs');var Redis=require(_0x6057('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6057('0x6'));var logger=require(_0x6057('0x7'))(_0x6057('0x8'));var config=require('../../config/environment');var jayson=require(_0x6057('0x9'));var client=jayson[_0x6057('0xa')][_0x6057('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58aa94,_0x48f20e,_0x452e4f){return new BPromise(function(_0x19e6aa,_0x9b445f){return client['request'](_0x58aa94,_0x452e4f)[_0x6057('0xc')](function(_0x34442a){logger[_0x6057('0xd')](_0x6057('0xe'),_0x48f20e,_0x6057('0xf'));logger['debug'](_0x6057('0x10'),_0x48f20e,_0x6057('0xf'),JSON[_0x6057('0x11')](_0x34442a));if(_0x34442a[_0x6057('0x12')]){if(_0x34442a['error'][_0x6057('0x13')]===0x1f4){logger[_0x6057('0x12')](_0x6057('0xe'),_0x48f20e,_0x34442a[_0x6057('0x12')]['message']);return _0x9b445f(_0x34442a[_0x6057('0x12')][_0x6057('0x14')]);}logger[_0x6057('0x12')]('CmCustomField,\x20%s,\x20%s',_0x48f20e,_0x34442a[_0x6057('0x12')][_0x6057('0x14')]);return _0x19e6aa(_0x34442a[_0x6057('0x12')][_0x6057('0x14')]);}else{logger[_0x6057('0xd')](_0x6057('0xe'),_0x48f20e,'request\x20sent');_0x19e6aa(_0x34442a[_0x6057('0x15')]['message']);}})[_0x6057('0x16')](function(_0x336ee9){logger[_0x6057('0x12')](_0x6057('0xe'),_0x48f20e,_0x336ee9);_0x9b445f(_0x336ee9);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5b5d17e..347c49d 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 _0x8d0a=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','create','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4befdb,_0x4819ea){var _0x575441=function(_0x282b41){while(--_0x282b41){_0x4befdb['push'](_0x4befdb['shift']());}};_0x575441(++_0x4819ea);}(_0x8d0a,0x65));var _0xa8d0=function(_0x48f04e,_0x1fa8f2){_0x48f04e=_0x48f04e-0x0;var _0x4b0219=_0x8d0a[_0x48f04e];return _0x4b0219;};'use strict';var multer=require(_0xa8d0('0x0'));var util=require('util');var path=require(_0xa8d0('0x1'));var timeout=require(_0xa8d0('0x2'));var express=require(_0xa8d0('0x3'));var router=express[_0xa8d0('0x4')]();var fs_extra=require(_0xa8d0('0x5'));var auth=require(_0xa8d0('0x6'));var interaction=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var controller=require(_0xa8d0('0x9'));router['get']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xb')]);router[_0xa8d0('0xc')](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller['show']);router['post']('/',auth[_0xa8d0('0xa')](),controller[_0xa8d0('0xe')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xa8d0('0xf')]);router['delete'](_0xa8d0('0xd'),auth[_0xa8d0('0xa')](),controller[_0xa8d0('0x10')]);module[_0xa8d0('0x11')]=router; \ No newline at end of file +var _0xb957=['put','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','/:id','create'];(function(_0x42d0ed,_0x91a115){var _0x3f63f6=function(_0x2e961b){while(--_0x2e961b){_0x42d0ed['push'](_0x42d0ed['shift']());}};_0x3f63f6(++_0x91a115);}(_0xb957,0x6d));var _0x7b95=function(_0x31c11d,_0x5a6af8){_0x31c11d=_0x31c11d-0x0;var _0xdc9d44=_0xb957[_0x31c11d];return _0xdc9d44;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b95('0x0'));var timeout=require('connect-timeout');var express=require(_0x7b95('0x1'));var router=express[_0x7b95('0x2')]();var fs_extra=require(_0x7b95('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7b95('0x4'));var config=require(_0x7b95('0x5'));var controller=require(_0x7b95('0x6'));router[_0x7b95('0x7')]('/',auth[_0x7b95('0x8')](),controller['index']);router[_0x7b95('0x7')](_0x7b95('0x9'),auth[_0x7b95('0x8')](),controller['show']);router['post']('/',auth[_0x7b95('0x8')](),controller[_0x7b95('0xa')]);router[_0x7b95('0xb')](_0x7b95('0x9'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x7b95('0x9'),auth[_0x7b95('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 98cb88a..b6f9610 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 _0x6f1d=['contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0x32883a,_0x14cdb2){var _0x2d0f09=function(_0x35d201){while(--_0x35d201){_0x32883a['push'](_0x32883a['shift']());}};_0x2d0f09(++_0x14cdb2);}(_0x6f1d,0x1c3));var _0xd6f1=function(_0x9c7b0,_0x1ad85d){_0x9c7b0=_0x9c7b0-0x0;var _0x18c429=_0x6f1d[_0x9c7b0];return _0x18c429;};'use strict';var moment=require(_0xd6f1('0x0'));var Sequelize=require(_0xd6f1('0x1'));module[_0xd6f1('0x2')]={'phone':{'type':Sequelize[_0xd6f1('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xd6f1('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xd6f1('0x5')],'defaultValue':moment()['format'](_0xd6f1('0x6'))},'countbusyretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xd6f1('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd6f1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd6f1('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xd6f1('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xd6f1('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xd6f1('0x7')],'unique':_0xd6f1('0x9')},'ListId':{'type':Sequelize[_0xd6f1('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xd6f1('0x7')],'unique':_0xd6f1('0x9')},'CampaignId':{'type':Sequelize[_0xd6f1('0x7')]},'countnosuchnumberretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd6f1('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xd6f1('0x7')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xd6f1('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xd6f1('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x1e4b=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','STRING','moment','BOOLEAN','DATE'];(function(_0x18e562,_0x3852ca){var _0x42dfaf=function(_0x28f416){while(--_0x28f416){_0x18e562['push'](_0x18e562['shift']());}};_0x42dfaf(++_0x3852ca);}(_0x1e4b,0x1d1));var _0xb1e4=function(_0x85390a,_0x3e19ee){_0x85390a=_0x85390a-0x0;var _0x400991=_0x1e4b[_0x85390a];return _0x400991;};'use strict';var moment=require(_0xb1e4('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0xb1e4('0x1')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xb1e4('0x2')],'defaultValue':moment()[_0xb1e4('0x3')](_0xb1e4('0x4'))},'countbusyretry':{'type':Sequelize[_0xb1e4('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xb1e4('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xb1e4('0x1')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xb1e4('0x2')]},'priority':{'type':Sequelize[_0xb1e4('0x5')](0x2)[_0xb1e4('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xb1e4('0x1')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xb1e4('0x5')],'unique':_0xb1e4('0x7')},'ListId':{'type':Sequelize[_0xb1e4('0x5')],'unique':_0xb1e4('0x7')},'UserId':{'type':Sequelize[_0xb1e4('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xb1e4('0x5')],'unique':_0xb1e4('0x7')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize[_0xb1e4('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xb1e4('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xb1e4('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xb1e4('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xb1e4('0x8')]},'recallmeNotifiedDate':{'type':Sequelize[_0xb1e4('0x2')],'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 369356f..b51ce71 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 _0x2fed=['offset','undefined','count','limit','set','Content-Range','update','error','stack','name','send','map','CmHopper','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','concat','$and','$gte','$lt','$lte','$ne','$eq','$in','$notIn','$like','$notLike','$notILike','$overlap','$contains','$any','attributes','fields','length','nolimit','sort','pick','filter','where','merge','options','then','includeAll','include','rows','show','params','find','catch','create','body','describe','destroy','CampaignId','VoiceQueue','Campaign','VoiceQueueId','createdAt','state','statedesc','deleted','campaign','user','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','Company','CmList','List','Queue','LOCK','dialActive','getOpenContacts','preview','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json'];(function(_0x271eed,_0x16cb91){var _0x30cc89=function(_0x104324){while(--_0x104324){_0x271eed['push'](_0x271eed['shift']());}};_0x30cc89(++_0x16cb91);}(_0x2fed,0x7c));var _0xd2fe=function(_0x4ef044,_0x4490cc){_0x4ef044=_0x4ef044-0x0;var _0x509a04=_0x2fed[_0x4ef044];return _0x509a04;};'use strict';var moment=require(_0xd2fe('0x0'));var _=require(_0xd2fe('0x1'));var qs=require(_0xd2fe('0x2'));var logger=require(_0xd2fe('0x3'))(_0xd2fe('0x4'));var shared=require('../../config/environment');var db=require(_0xd2fe('0x5'))['db'];function respondWithResult(_0x20b497,_0x48707a){_0x48707a=_0x48707a||0xc8;return function(_0x58f3f8){if(_0x58f3f8){return _0x20b497[_0xd2fe('0x6')](_0x48707a)[_0xd2fe('0x7')](_0x58f3f8);}};}function respondWithFilteredResult(_0xd85f89,_0x5be4d3){return function(_0x2f7bf5){if(_0x2f7bf5){var _0x44e015=typeof _0x5be4d3[_0xd2fe('0x8')]===_0xd2fe('0x9')&&typeof _0x5be4d3['limit']===_0xd2fe('0x9');var _0x107546=_0x2f7bf5[_0xd2fe('0xa')];var _0x1943ab=_0x44e015?0x0:_0x5be4d3[_0xd2fe('0x8')];var _0x2a06a9=_0x44e015?_0x2f7bf5[_0xd2fe('0xa')]:_0x5be4d3[_0xd2fe('0x8')]+_0x5be4d3[_0xd2fe('0xb')];var _0x13c68f;if(_0x2a06a9>=_0x107546){_0x2a06a9=_0x107546;_0x13c68f=0xc8;}else{_0x13c68f=0xce;}_0xd85f89[_0xd2fe('0x6')](_0x13c68f);return _0xd85f89[_0xd2fe('0xc')](_0xd2fe('0xd'),_0x1943ab+'-'+_0x2a06a9+'/'+_0x107546)[_0xd2fe('0x7')](_0x2f7bf5);}return null;};}function saveUpdates(_0x72f7e0,_0x2431da){return function(_0x22e414){if(_0x22e414){return _0x22e414[_0xd2fe('0xe')](_0x72f7e0)['then'](function(_0x1c2401){return _0x1c2401;});}return null;};}function handleEntityNotFound(_0x30fad9,_0x2a9355){return function(_0x5607a3){if(!_0x5607a3){_0x30fad9['sendStatus'](0x194);}return _0x5607a3;};}function handleError(_0x4ab9d2,_0x203bea){_0x203bea=_0x203bea||0x1f4;return function(_0x54f4cc){logger[_0xd2fe('0xf')](_0x54f4cc[_0xd2fe('0x10')]);if(_0x54f4cc[_0xd2fe('0x11')]){delete _0x54f4cc[_0xd2fe('0x11')];}_0x4ab9d2[_0xd2fe('0x6')](_0x203bea)[_0xd2fe('0x12')](_0x54f4cc);};}exports['index']=function(_0x5486e2,_0xe958a0){var _0x40162f={},_0x57f517={},_0x3ca715={'count':0x0,'rows':[]};var _0x247e4c=_[_0xd2fe('0x13')](db[_0xd2fe('0x14')][_0xd2fe('0x15')],function(_0x38d5ab){return{'name':_0x38d5ab[_0xd2fe('0x16')],'type':_0x38d5ab[_0xd2fe('0x17')][_0xd2fe('0x18')]};});_0x57f517[_0xd2fe('0x19')]=_['map'](_0x247e4c,_0xd2fe('0x11'));_0x57f517['query']=_[_0xd2fe('0x1a')](_0x5486e2[_0xd2fe('0x1b')]);_0x57f517[_0xd2fe('0x1c')]=_[_0xd2fe('0x1d')](_0x57f517['model'],_0x57f517[_0xd2fe('0x1b')]);_0x57f517['filters']=_[_0xd2fe('0x1e')](_0x57f517[_0xd2fe('0x1c')],[_0xd2fe('0x1f'),'$or','$gt',_0xd2fe('0x20'),_0xd2fe('0x21'),_0xd2fe('0x22'),_0xd2fe('0x23'),_0xd2fe('0x24'),'$not','$between','$notBetween',_0xd2fe('0x25'),_0xd2fe('0x26'),_0xd2fe('0x27'),_0xd2fe('0x28'),'$iLike',_0xd2fe('0x29'),_0xd2fe('0x27'),_0xd2fe('0x2a'),_0xd2fe('0x2b'),'$contained',_0xd2fe('0x2c')]);_0x40162f[_0xd2fe('0x2d')]=_[_0xd2fe('0x1d')](_0x57f517['model'],qs[_0xd2fe('0x2e')](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x2e')]));_0x40162f[_0xd2fe('0x2d')]=_0x40162f['attributes'][_0xd2fe('0x2f')]?_0x40162f[_0xd2fe('0x2d')]:_0x57f517[_0xd2fe('0x19')];if(!_0x5486e2[_0xd2fe('0x1b')]['hasOwnProperty'](_0xd2fe('0x30'))){_0x40162f[_0xd2fe('0xb')]=qs[_0xd2fe('0xb')](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0xb')]);_0x40162f[_0xd2fe('0x8')]=qs['offset'](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x8')]);}_0x40162f['order']=qs[_0xd2fe('0x31')](_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x31')]);_0x40162f['where']=qs[_0xd2fe('0x1c')](_[_0xd2fe('0x32')](_0x5486e2['query'],_0x57f517[_0xd2fe('0x1c')]),_0x247e4c);if(_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x33')]){_0x40162f[_0xd2fe('0x34')]=_[_0xd2fe('0x35')](_0x40162f[_0xd2fe('0x34')],{'$or':_['map'](_0x247e4c,function(_0x4dd379){if(_0x4dd379[_0xd2fe('0x17')]!=='VIRTUAL'){var _0x50a2ff={};_0x50a2ff[_0x4dd379[_0xd2fe('0x11')]]={'$like':'%'+_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x33')]+'%'};return _0x50a2ff;}})});}_0x40162f=_[_0xd2fe('0x35')]({},_0x40162f,_0x5486e2[_0xd2fe('0x36')]);var _0x4e0b4d={'where':_0x40162f[_0xd2fe('0x34')]};return db['CmHopper']['count'](_0x4e0b4d)[_0xd2fe('0x37')](function(_0x325ef7){_0x3ca715[_0xd2fe('0xa')]=_0x325ef7;if(_0x5486e2[_0xd2fe('0x1b')][_0xd2fe('0x38')]){_0x40162f[_0xd2fe('0x39')]=[{'all':!![]}];}return db[_0xd2fe('0x14')]['findAll'](_0x40162f);})[_0xd2fe('0x37')](function(_0x135829){_0x3ca715[_0xd2fe('0x3a')]=_0x135829;return _0x3ca715;})['then'](respondWithFilteredResult(_0xe958a0,_0x40162f))['catch'](handleError(_0xe958a0,null));};exports[_0xd2fe('0x3b')]=function(_0x3b0c00,_0x11a6df){var _0x1151e7={'raw':!![],'where':{'id':_0x3b0c00[_0xd2fe('0x3c')]['id']}},_0x3c6267={};_0x3c6267[_0xd2fe('0x19')]=_['keys'](db[_0xd2fe('0x14')][_0xd2fe('0x15')]);_0x3c6267['query']=_[_0xd2fe('0x1a')](_0x3b0c00[_0xd2fe('0x1b')]);_0x3c6267[_0xd2fe('0x1c')]=_[_0xd2fe('0x1d')](_0x3c6267['model'],_0x3c6267[_0xd2fe('0x1b')]);_0x1151e7[_0xd2fe('0x2d')]=_[_0xd2fe('0x1d')](_0x3c6267[_0xd2fe('0x19')],qs['fields'](_0x3b0c00[_0xd2fe('0x1b')][_0xd2fe('0x2e')]));_0x1151e7[_0xd2fe('0x2d')]=_0x1151e7['attributes'][_0xd2fe('0x2f')]?_0x1151e7[_0xd2fe('0x2d')]:_0x3c6267[_0xd2fe('0x19')];if(_0x3b0c00['query'][_0xd2fe('0x38')]){_0x1151e7[_0xd2fe('0x39')]=[{'all':!![]}];}_0x1151e7=_['merge']({},_0x1151e7,_0x3b0c00['options']);return db['CmHopper'][_0xd2fe('0x3d')](_0x1151e7)[_0xd2fe('0x37')](handleEntityNotFound(_0x11a6df,null))['then'](respondWithResult(_0x11a6df,null))[_0xd2fe('0x3e')](handleError(_0x11a6df,null));};exports[_0xd2fe('0x3f')]=function(_0x17589d,_0x5e6f7d){return db[_0xd2fe('0x14')][_0xd2fe('0x3f')](_0x17589d[_0xd2fe('0x40')],{})[_0xd2fe('0x37')](respondWithResult(_0x5e6f7d,0xc9))[_0xd2fe('0x3e')](handleError(_0x5e6f7d,null));};exports[_0xd2fe('0xe')]=function(_0x36baa2,_0x4fe5cb){if(_0x36baa2[_0xd2fe('0x40')]['id']){delete _0x36baa2[_0xd2fe('0x40')]['id'];}return db[_0xd2fe('0x14')][_0xd2fe('0x3d')]({'where':{'id':_0x36baa2[_0xd2fe('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4fe5cb,null))['then'](saveUpdates(_0x36baa2[_0xd2fe('0x40')],null))[_0xd2fe('0x37')](respondWithResult(_0x4fe5cb,null))[_0xd2fe('0x3e')](handleError(_0x4fe5cb,null));};exports['describe']=function(_0x5c4956,_0xc09227){return db[_0xd2fe('0x14')][_0xd2fe('0x41')]()[_0xd2fe('0x37')](respondWithResult(_0xc09227,null))[_0xd2fe('0x3e')](handleError(_0xc09227,null));};exports[_0xd2fe('0x42')]=function(_0x377e88,_0x13ec7d){var _0x465490;var _0x4318f4=_0x377e88[_0xd2fe('0x3c')]['id'];return db['CmHopper'][_0xd2fe('0x3d')]({'where':{'id':_0x377e88[_0xd2fe('0x3c')]['id']}})[_0xd2fe('0x37')](handleEntityNotFound(_0x13ec7d,null))['then'](function(_0xcf824e){if(_0xcf824e){return _0xcf824e['destroy']()['then'](function(_0x2238be){return _0x2238be;});}})['then'](function(_0x3be739){_0x465490=_0x3be739;if(_0x3be739){if(_0x3be739['VoiceQueueId']||_0x3be739[_0xd2fe('0x43')]){return db[_0x3be739['VoiceQueueId']?_0xd2fe('0x44'):_0xd2fe('0x45')]['find']({'where':{'id':_0x3be739['VoiceQueueId']?_0x3be739[_0xd2fe('0x46')]:_0x3be739[_0xd2fe('0x43')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd2fe('0x37')](function(_0x363015){var _0xd4ce24={};if(_0x363015){_['merge'](_0xd4ce24,_['omit'](_0x465490['dataValues'],[_0xd2fe('0x47'),'updatedAt','id']));_0xd4ce24[_0xd2fe('0x48')]=0x15;_0xd4ce24[_0xd2fe('0x49')]=_0xd2fe('0x4a');_0xd4ce24[_0xd2fe('0x4b')]=_0x363015[_0xd2fe('0x11')];_0xd4ce24['membername']=_0x377e88[_0xd2fe('0x4c')][_0xd2fe('0x11')];_0xd4ce24['UserId']=_0x377e88[_0xd2fe('0x4c')]['id'];_0xd4ce24[_0xd2fe('0x4a')]=!![];_0xd4ce24['deletedat']=moment()[_0xd2fe('0x4d')](_0xd2fe('0x4e'));_0xd4ce24[_0xd2fe('0x4f')]=_0x465490[_0xd2fe('0x50')];_0xd4ce24['campaigntype']=_0x465490['VoiceQueueId']?_0xd2fe('0x51'):_0xd2fe('0x52');return db[_0xd2fe('0x53')]['find']({'where':{'id':_0xd4ce24[_0xd2fe('0x54')]},'attributes':['firstName',_0xd2fe('0x55')]})['then'](function(_0x4107de){if(!_['isNil'](_0x13ec7d)&&!_[_0xd2fe('0x56')](_0x4107de[_0xd2fe('0x57')])){_0xd4ce24[_0xd2fe('0x58')]=_0x4107de['firstName'];if(!_[_0xd2fe('0x56')](_0x4107de['lastName'])){_0xd4ce24[_0xd2fe('0x58')]+='\x20'+_0x4107de[_0xd2fe('0x55')];}}})[_0xd2fe('0x59')](function(){return db[_0xd2fe('0x5a')]['create'](_0xd4ce24);});}})[_0xd2fe('0x37')](function(_0x52e516){return db[_0xd2fe('0x5b')][_0xd2fe('0x42')]({'where':{'CmHopperId':_0x4318f4}});})[_0xd2fe('0x37')](function(){return _0x13ec7d[_0xd2fe('0x6')](0xcc)[_0xd2fe('0x5c')]();})[_0xd2fe('0x3e')](handleError(_0x13ec7d,null));};exports['getPreview']=function(_0x20783a,_0x1c6592){var _0x4c7325=[];return db['CmContact'][_0xd2fe('0x41')]()['then'](function(_0x22948f){_0x4c7325=_[_0xd2fe('0x1a')](_0x22948f);return _0x20783a[_0xd2fe('0x4c')][_0xd2fe('0x5d')]({'where':{'type':_0xd2fe('0x5e'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0xd2fe('0x5f'),'dialPreviewAutoRecallMe'],'raw':!![]});})['then'](function(_0x16d68a){if(_0x16d68a&&_0x16d68a[_0xd2fe('0x2f')]){return db['sequelize']['transaction'](function(_0x291d88){var _0x264d9d={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd2fe('0x4d')](_0xd2fe('0x4e'))},'VoiceQueueId':{'$in':_[_0xd2fe('0x13')](_0x16d68a,'id')},'$or':[{'UserId':null},{'UserId':_0x20783a[_0xd2fe('0x4c')]['id']}]};var _0x5e5d7c={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x16d68a)[_0xd2fe('0x33')]([_0xd2fe('0x60'),0x0])[_0xd2fe('0x13')]('id')[_0xd2fe('0x61')]()},'$or':[{'UserId':null},{'UserId':_0x20783a[_0xd2fe('0x4c')]['id']}]};var _0x184d39={'$or':[_0x264d9d,_0x5e5d7c]};var _0x10021b=[];if(_0x20783a[_0xd2fe('0x40')]['direction']&&_0x20783a['body'][_0xd2fe('0x62')]===_0xd2fe('0x63')){if(!_[_0xd2fe('0x64')](_0x20783a[_0xd2fe('0x40')][_0xd2fe('0x65')])){_0x184d39['id']={'$in':_0x20783a['body'][_0xd2fe('0x65')]};}_0x10021b=[[_0xd2fe('0x66'),_0xd2fe('0x67')],['scheduledAt',_0x16d68a[0x0][_0xd2fe('0x5f')]==='ASC'?_0xd2fe('0x68'):'ASC'],db[_0xd2fe('0x69')][_0xd2fe('0x6a')](_0xd2fe('0x6b')),['id',_0xd2fe('0x68')]];}else{if(!_[_0xd2fe('0x64')](_0x20783a[_0xd2fe('0x40')]['hopperIds'])){_0x184d39['id']={'$notIn':_0x20783a[_0xd2fe('0x40')][_0xd2fe('0x65')]};}_0x10021b=[[_0xd2fe('0x66'),'DESC'],[_0xd2fe('0x6c'),_0x16d68a[0x0]['dialOrderByScheduledAt']],db[_0xd2fe('0x69')]['literal'](_0xd2fe('0x6d')),['id',_0xd2fe('0x67')]];}return db[_0xd2fe('0x14')][_0xd2fe('0x6e')]({'attributes':['id',_0xd2fe('0x6f'),_0xd2fe('0x50'),_0xd2fe('0x70')],'where':_0x184d39,'order':_0x10021b,'transaction':_0x291d88,'lock':_0x291d88['LOCK'][_0xd2fe('0x71')],'include':[{'model':db[_0xd2fe('0x53')],'as':_0xd2fe('0x72'),'attributes':_0x4c7325,'include':[{'model':db[_0xd2fe('0x73')],'as':_0xd2fe('0x74'),'attributes':['id',_0xd2fe('0x11')]}]},{'model':db[_0xd2fe('0x75')],'as':_0xd2fe('0x76'),'attributes':['id','name']},{'model':db[_0xd2fe('0x44')],'as':_0xd2fe('0x77'),'attributes':['id','name','dialActive']}]})['then'](function(_0x19e1e0){if(_0x19e1e0){return _0x19e1e0[_0xd2fe('0xe')]({'UserId':_0x20783a[_0xd2fe('0x4c')]['id']},{'transaction':_0x291d88});}});});}})[_0xd2fe('0x37')](handleEntityNotFound(_0x1c6592,null))['then'](respondWithResult(_0x1c6592,null))[_0xd2fe('0x3e')](handleError(_0x1c6592,null));};exports['getPreviewRecall']=function(_0x5ca53c,_0x322cc2,_0x4f5e96){var _0x22a007=[];var _0x24a619=_0x5ca53c[_0xd2fe('0x3c')]['id'];var _0xe6d707=_0x5ca53c['user']['id'];return db[_0xd2fe('0x53')][_0xd2fe('0x41')]()[_0xd2fe('0x37')](function(_0x169ead){_0x22a007=_[_0xd2fe('0x1a')](_0x169ead);return db[_0xd2fe('0x69')]['transaction'](function(_0x4c910c){const _0x318dbf={'id':_0x24a619};return db[_0xd2fe('0x14')][_0xd2fe('0x6e')]({'attributes':['id',_0xd2fe('0x6f'),'recallme'],'where':_0x318dbf,'transaction':_0x4c910c,'lock':_0x4c910c[_0xd2fe('0x78')][_0xd2fe('0x71')],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_0x22a007,'include':[{'model':db[_0xd2fe('0x73')],'as':_0xd2fe('0x74'),'attributes':['id',_0xd2fe('0x11')]}]},{'model':db[_0xd2fe('0x75')],'as':_0xd2fe('0x76'),'attributes':['id',_0xd2fe('0x11')]},{'model':db[_0xd2fe('0x44')],'as':_0xd2fe('0x77'),'attributes':['id','name',_0xd2fe('0x79')]}]})[_0xd2fe('0x37')](function(_0x5dbaec){if(_0x5dbaec){return _0x5dbaec[_0xd2fe('0xe')]({'UserId':_0xe6d707},{'transaction':_0x4c910c});}});});})['then'](handleEntityNotFound(_0x322cc2,null))['then'](respondWithResult(_0x322cc2,null))['catch'](handleError(_0x322cc2,null));};exports[_0xd2fe('0x7a')]=function(_0x593310,_0x655d1){return _0x593310[_0xd2fe('0x4c')][_0xd2fe('0x5d')]({'where':{'type':_0xd2fe('0x5e'),'dialActive':!![],'dialMethod':_0xd2fe('0x7b')},'attributes':['id'],'raw':!![]})['then'](function(_0x3e2088){if(_0x3e2088&&_0x3e2088[_0xd2fe('0x2f')]){return db[_0xd2fe('0x14')][_0xd2fe('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd2fe('0x4d')](_0xd2fe('0x4e'))},'VoiceQueueId':{'$in':_[_0xd2fe('0x13')](_0x3e2088,'id')},'$or':[{'UserId':null},{'UserId':_0x593310['user']['id']}]}});}return 0x0;})[_0xd2fe('0x37')](function(_0x4ac020){if(!_[_0xd2fe('0x56')](_0x4ac020)&&_[_0xd2fe('0x7c')](_0x4ac020)){return _0x655d1[_0xd2fe('0x6')](0xc8)[_0xd2fe('0x7')]({'contacts':_0x4ac020});}else{logger['error'](_0xd2fe('0x7d'),_0xd2fe('0x7a'),0x194,_0xd2fe('0x7e'));_0x655d1[_0xd2fe('0x7f')](0x194);}})['catch'](handleError(_0x655d1,null));};exports[_0xd2fe('0x80')]=function(_0x872048,_0x159ba2){var _0x2c370f=shared[_0xd2fe('0x81')];var _0x275608=[];_[_0xd2fe('0x13')](_0x2c370f,function(_0x59153c){_0x275608['push']({'id':_0x59153c[_0xd2fe('0x11')],'name':_0x59153c[_0xd2fe('0x11')],'utcOffset':_0x59153c[_0xd2fe('0x82')]});});return _0x159ba2[_0xd2fe('0x6')](0xc8)[_0xd2fe('0x7')]({'tz':_0x275608});};exports[_0xd2fe('0x83')]=function(_0x36cbb0,_0x3d3d00){var _0x167922=shared[_0xd2fe('0x81')];var _0x35687b={};if(!_[_0xd2fe('0x56')](_0x167922[_0x36cbb0[_0xd2fe('0x40')]['id']]))_0x35687b=_0x167922[_0x36cbb0[_0xd2fe('0x40')]['id']];return _0x3d3d00[_0xd2fe('0x6')](0xc8)[_0xd2fe('0x7')](_0x35687b);}; \ No newline at end of file +var _0xcca7=['CmCompany','Company','List','Queue','dialActive','getPreviewRecall','transaction','LOCK','CmList','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','utcOffset','timezones','moment','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','sendStatus','error','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','keys','filters','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$iLike','$notILike','$overlap','$contains','$any','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','name','filter','then','includeAll','include','findAll','rows','show','params','options','catch','create','body','update','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','createdAt','updatedAt','campaign','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialPreviewAutoRecallMe','sequelize','value','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','literal','findOne','scheduledat','recallme','UPDATE','Contact'];(function(_0x46ee6b,_0x7f3e6c){var _0x97d54b=function(_0x27c5fb){while(--_0x27c5fb){_0x46ee6b['push'](_0x46ee6b['shift']());}};_0x97d54b(++_0x7f3e6c);}(_0xcca7,0x1aa));var _0x7cca=function(_0x34e447,_0x5305f8){_0x34e447=_0x34e447-0x0;var _0x230108=_0xcca7[_0x34e447];return _0x230108;};'use strict';var moment=require(_0x7cca('0x0'));var _=require(_0x7cca('0x1'));var qs=require(_0x7cca('0x2'));var logger=require(_0x7cca('0x3'))('api');var shared=require('../../config/environment');var db=require(_0x7cca('0x4'))['db'];function respondWithResult(_0x533b00,_0x3b86a4){_0x3b86a4=_0x3b86a4||0xc8;return function(_0x9523f7){if(_0x9523f7){return _0x533b00[_0x7cca('0x5')](_0x3b86a4)[_0x7cca('0x6')](_0x9523f7);}};}function respondWithFilteredResult(_0x1c6c95,_0xe70805){return function(_0x5aec51){if(_0x5aec51){var _0x508f29=typeof _0xe70805[_0x7cca('0x7')]===_0x7cca('0x8')&&typeof _0xe70805[_0x7cca('0x9')]===_0x7cca('0x8');var _0x18bac4=_0x5aec51[_0x7cca('0xa')];var _0x20ffa9=_0x508f29?0x0:_0xe70805[_0x7cca('0x7')];var _0x27323a=_0x508f29?_0x5aec51[_0x7cca('0xa')]:_0xe70805['offset']+_0xe70805[_0x7cca('0x9')];var _0x464911;if(_0x27323a>=_0x18bac4){_0x27323a=_0x18bac4;_0x464911=0xc8;}else{_0x464911=0xce;}_0x1c6c95[_0x7cca('0x5')](_0x464911);return _0x1c6c95[_0x7cca('0xb')](_0x7cca('0xc'),_0x20ffa9+'-'+_0x27323a+'/'+_0x18bac4)['json'](_0x5aec51);}return null;};}function saveUpdates(_0x2a14cc,_0x41e0a2){return function(_0x2854c7){if(_0x2854c7){return _0x2854c7['update'](_0x2a14cc)['then'](function(_0x8ea157){return _0x8ea157;});}return null;};}function handleEntityNotFound(_0x20c1b2,_0x27d671){return function(_0x847cce){if(!_0x847cce){_0x20c1b2[_0x7cca('0xd')](0x194);}return _0x847cce;};}function handleError(_0x3d3141,_0x45143d){_0x45143d=_0x45143d||0x1f4;return function(_0x5a357d){logger[_0x7cca('0xe')](_0x5a357d['stack']);if(_0x5a357d['name']){delete _0x5a357d['name'];}_0x3d3141[_0x7cca('0x5')](_0x45143d)[_0x7cca('0xf')](_0x5a357d);};}exports[_0x7cca('0x10')]=function(_0x33db6b,_0x44294b){var _0x5e7c42={},_0xb35e1d={},_0x4fba9e={'count':0x0,'rows':[]};var _0x5d47f8=_['map'](db[_0x7cca('0x11')][_0x7cca('0x12')],function(_0x2beb6c){return{'name':_0x2beb6c[_0x7cca('0x13')],'type':_0x2beb6c[_0x7cca('0x14')][_0x7cca('0x15')]};});_0xb35e1d[_0x7cca('0x16')]=_[_0x7cca('0x17')](_0x5d47f8,'name');_0xb35e1d[_0x7cca('0x18')]=_[_0x7cca('0x19')](_0x33db6b[_0x7cca('0x18')]);_0xb35e1d[_0x7cca('0x1a')]=_['intersection'](_0xb35e1d[_0x7cca('0x16')],_0xb35e1d[_0x7cca('0x18')]);_0xb35e1d[_0x7cca('0x1a')]=_[_0x7cca('0x1b')](_0xb35e1d[_0x7cca('0x1a')],[_0x7cca('0x1c'),_0x7cca('0x1d'),_0x7cca('0x1e'),'$gte',_0x7cca('0x1f'),_0x7cca('0x20'),_0x7cca('0x21'),_0x7cca('0x22'),_0x7cca('0x23'),_0x7cca('0x24'),_0x7cca('0x25'),_0x7cca('0x26'),'$notIn',_0x7cca('0x27'),'$notLike',_0x7cca('0x28'),_0x7cca('0x29'),'$like',_0x7cca('0x2a'),_0x7cca('0x2b'),'$contained',_0x7cca('0x2c')]);_0x5e7c42[_0x7cca('0x2d')]=_[_0x7cca('0x2e')](_0xb35e1d['model'],qs['fields'](_0x33db6b[_0x7cca('0x18')][_0x7cca('0x2f')]));_0x5e7c42[_0x7cca('0x2d')]=_0x5e7c42[_0x7cca('0x2d')][_0x7cca('0x30')]?_0x5e7c42[_0x7cca('0x2d')]:_0xb35e1d[_0x7cca('0x16')];if(!_0x33db6b['query']['hasOwnProperty'](_0x7cca('0x31'))){_0x5e7c42[_0x7cca('0x9')]=qs[_0x7cca('0x9')](_0x33db6b['query'][_0x7cca('0x9')]);_0x5e7c42['offset']=qs[_0x7cca('0x7')](_0x33db6b[_0x7cca('0x18')][_0x7cca('0x7')]);}_0x5e7c42[_0x7cca('0x32')]=qs['sort'](_0x33db6b[_0x7cca('0x18')][_0x7cca('0x33')]);_0x5e7c42[_0x7cca('0x34')]=qs['filters'](_['pick'](_0x33db6b['query'],_0xb35e1d[_0x7cca('0x1a')]),_0x5d47f8);if(_0x33db6b[_0x7cca('0x18')]['filter']){_0x5e7c42[_0x7cca('0x34')]=_[_0x7cca('0x35')](_0x5e7c42[_0x7cca('0x34')],{'$or':_[_0x7cca('0x17')](_0x5d47f8,function(_0xc10d78){if(_0xc10d78[_0x7cca('0x14')]!==_0x7cca('0x36')){var _0x56b9e0={};_0x56b9e0[_0xc10d78[_0x7cca('0x37')]]={'$like':'%'+_0x33db6b[_0x7cca('0x18')][_0x7cca('0x38')]+'%'};return _0x56b9e0;}})});}_0x5e7c42=_[_0x7cca('0x35')]({},_0x5e7c42,_0x33db6b['options']);var _0x213e4f={'where':_0x5e7c42[_0x7cca('0x34')]};return db[_0x7cca('0x11')]['count'](_0x213e4f)[_0x7cca('0x39')](function(_0x4bc7a7){_0x4fba9e[_0x7cca('0xa')]=_0x4bc7a7;if(_0x33db6b[_0x7cca('0x18')][_0x7cca('0x3a')]){_0x5e7c42[_0x7cca('0x3b')]=[{'all':!![]}];}return db[_0x7cca('0x11')][_0x7cca('0x3c')](_0x5e7c42);})[_0x7cca('0x39')](function(_0x3b5aa3){_0x4fba9e[_0x7cca('0x3d')]=_0x3b5aa3;return _0x4fba9e;})['then'](respondWithFilteredResult(_0x44294b,_0x5e7c42))['catch'](handleError(_0x44294b,null));};exports[_0x7cca('0x3e')]=function(_0x3365b6,_0x5cb715){var _0x48d87f={'raw':!![],'where':{'id':_0x3365b6[_0x7cca('0x3f')]['id']}},_0x3c6d1d={};_0x3c6d1d[_0x7cca('0x16')]=_[_0x7cca('0x19')](db[_0x7cca('0x11')]['rawAttributes']);_0x3c6d1d[_0x7cca('0x18')]=_['keys'](_0x3365b6['query']);_0x3c6d1d[_0x7cca('0x1a')]=_[_0x7cca('0x2e')](_0x3c6d1d['model'],_0x3c6d1d[_0x7cca('0x18')]);_0x48d87f['attributes']=_[_0x7cca('0x2e')](_0x3c6d1d[_0x7cca('0x16')],qs[_0x7cca('0x2f')](_0x3365b6['query'][_0x7cca('0x2f')]));_0x48d87f[_0x7cca('0x2d')]=_0x48d87f[_0x7cca('0x2d')][_0x7cca('0x30')]?_0x48d87f['attributes']:_0x3c6d1d[_0x7cca('0x16')];if(_0x3365b6[_0x7cca('0x18')][_0x7cca('0x3a')]){_0x48d87f[_0x7cca('0x3b')]=[{'all':!![]}];}_0x48d87f=_[_0x7cca('0x35')]({},_0x48d87f,_0x3365b6[_0x7cca('0x40')]);return db['CmHopper']['find'](_0x48d87f)['then'](handleEntityNotFound(_0x5cb715,null))['then'](respondWithResult(_0x5cb715,null))[_0x7cca('0x41')](handleError(_0x5cb715,null));};exports['create']=function(_0x51e564,_0x272828){return db[_0x7cca('0x11')][_0x7cca('0x42')](_0x51e564[_0x7cca('0x43')],{})[_0x7cca('0x39')](respondWithResult(_0x272828,0xc9))['catch'](handleError(_0x272828,null));};exports[_0x7cca('0x44')]=function(_0x345182,_0xba19aa){if(_0x345182[_0x7cca('0x43')]['id']){delete _0x345182[_0x7cca('0x43')]['id'];}return db[_0x7cca('0x11')][_0x7cca('0x45')]({'where':{'id':_0x345182[_0x7cca('0x3f')]['id']}})[_0x7cca('0x39')](handleEntityNotFound(_0xba19aa,null))[_0x7cca('0x39')](saveUpdates(_0x345182[_0x7cca('0x43')],null))['then'](respondWithResult(_0xba19aa,null))['catch'](handleError(_0xba19aa,null));};exports[_0x7cca('0x46')]=function(_0x5913eb,_0x40eb40){return db[_0x7cca('0x11')][_0x7cca('0x46')]()[_0x7cca('0x39')](respondWithResult(_0x40eb40,null))[_0x7cca('0x41')](handleError(_0x40eb40,null));};exports[_0x7cca('0x47')]=function(_0x184b56,_0xe0059e){var _0x1bb80b;var _0x3eb069=_0x184b56['params']['id'];return db[_0x7cca('0x11')][_0x7cca('0x45')]({'where':{'id':_0x184b56[_0x7cca('0x3f')]['id']}})[_0x7cca('0x39')](handleEntityNotFound(_0xe0059e,null))[_0x7cca('0x39')](function(_0x41b932){if(_0x41b932){return _0x41b932[_0x7cca('0x47')]()[_0x7cca('0x39')](function(_0x218114){return _0x218114;});}})[_0x7cca('0x39')](function(_0x3a0ce8){_0x1bb80b=_0x3a0ce8;if(_0x3a0ce8){if(_0x3a0ce8[_0x7cca('0x48')]||_0x3a0ce8[_0x7cca('0x49')]){return db[_0x3a0ce8[_0x7cca('0x48')]?_0x7cca('0x4a'):_0x7cca('0x4b')][_0x7cca('0x45')]({'where':{'id':_0x3a0ce8[_0x7cca('0x48')]?_0x3a0ce8[_0x7cca('0x48')]:_0x3a0ce8[_0x7cca('0x49')]},'attributes':['id',_0x7cca('0x37')],'raw':!![]});}}})[_0x7cca('0x39')](function(_0xc72da3){var _0x2a6f61={};if(_0xc72da3){_[_0x7cca('0x35')](_0x2a6f61,_[_0x7cca('0x4c')](_0x1bb80b['dataValues'],[_0x7cca('0x4d'),_0x7cca('0x4e'),'id']));_0x2a6f61['state']=0x15;_0x2a6f61['statedesc']='deleted';_0x2a6f61[_0x7cca('0x4f')]=_0xc72da3[_0x7cca('0x37')];_0x2a6f61['membername']=_0x184b56[_0x7cca('0x50')][_0x7cca('0x37')];_0x2a6f61['UserId']=_0x184b56[_0x7cca('0x50')]['id'];_0x2a6f61['deleted']=!![];_0x2a6f61[_0x7cca('0x51')]=moment()[_0x7cca('0x52')](_0x7cca('0x53'));_0x2a6f61[_0x7cca('0x54')]=_0x1bb80b[_0x7cca('0x55')];_0x2a6f61[_0x7cca('0x56')]=_0x1bb80b[_0x7cca('0x48')]?_0x7cca('0x57'):_0x7cca('0x58');return db[_0x7cca('0x59')][_0x7cca('0x45')]({'where':{'id':_0x2a6f61[_0x7cca('0x5a')]},'attributes':[_0x7cca('0x5b'),'lastName']})[_0x7cca('0x39')](function(_0x51e215){if(!_[_0x7cca('0x5c')](_0xe0059e)&&!_['isNil'](_0x51e215[_0x7cca('0x5b')])){_0x2a6f61[_0x7cca('0x5d')]=_0x51e215[_0x7cca('0x5b')];if(!_['isNil'](_0x51e215[_0x7cca('0x5e')])){_0x2a6f61[_0x7cca('0x5d')]+='\x20'+_0x51e215[_0x7cca('0x5e')];}}})[_0x7cca('0x5f')](function(){return db[_0x7cca('0x60')]['create'](_0x2a6f61);});}})['then'](function(_0x341d92){return db[_0x7cca('0x61')][_0x7cca('0x47')]({'where':{'CmHopperId':_0x3eb069}});})[_0x7cca('0x39')](function(){return _0xe0059e[_0x7cca('0x5')](0xcc)[_0x7cca('0x62')]();})[_0x7cca('0x41')](handleError(_0xe0059e,null));};exports[_0x7cca('0x63')]=function(_0x3327b1,_0x35eca7){var _0x2d5853=[];return db[_0x7cca('0x59')][_0x7cca('0x46')]()['then'](function(_0x23cfb5){_0x2d5853=_[_0x7cca('0x19')](_0x23cfb5);return _0x3327b1['user'][_0x7cca('0x64')]({'where':{'type':_0x7cca('0x65'),'dialActive':!![],'dialMethod':_0x7cca('0x66')},'attributes':['id','dialOrderByScheduledAt',_0x7cca('0x67')],'raw':!![]});})[_0x7cca('0x39')](function(_0x14efae){if(_0x14efae&&_0x14efae[_0x7cca('0x30')]){return db[_0x7cca('0x68')]['transaction'](function(_0x24901f){var _0x464484={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7cca('0x52')](_0x7cca('0x53'))},'VoiceQueueId':{'$in':_['map'](_0x14efae,'id')},'$or':[{'UserId':null},{'UserId':_0x3327b1[_0x7cca('0x50')]['id']}]};var _0x46e741={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x14efae)['filter']([_0x7cca('0x67'),0x0])['map']('id')[_0x7cca('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x3327b1['user']['id']}]};var _0x38d055={'$or':[_0x464484,_0x46e741]};var _0x3aa651=[];if(_0x3327b1[_0x7cca('0x43')][_0x7cca('0x6a')]&&_0x3327b1[_0x7cca('0x43')][_0x7cca('0x6a')]===_0x7cca('0x6b')){if(!_[_0x7cca('0x6c')](_0x3327b1[_0x7cca('0x43')][_0x7cca('0x6d')])){_0x38d055['id']={'$in':_0x3327b1[_0x7cca('0x43')][_0x7cca('0x6d')]};}_0x3aa651=[[_0x7cca('0x6e'),_0x7cca('0x6f')],['scheduledAt',_0x14efae[0x0][_0x7cca('0x70')]===_0x7cca('0x6f')?_0x7cca('0x71'):'ASC'],db[_0x7cca('0x68')]['literal'](_0x7cca('0x72')),['id',_0x7cca('0x71')]];}else{if(!_[_0x7cca('0x6c')](_0x3327b1[_0x7cca('0x43')][_0x7cca('0x6d')])){_0x38d055['id']={'$notIn':_0x3327b1[_0x7cca('0x43')][_0x7cca('0x6d')]};}_0x3aa651=[[_0x7cca('0x6e'),_0x7cca('0x71')],[_0x7cca('0x73'),_0x14efae[0x0][_0x7cca('0x70')]],db[_0x7cca('0x68')][_0x7cca('0x74')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x7cca('0x6f')]];}return db['CmHopper'][_0x7cca('0x75')]({'attributes':['id',_0x7cca('0x76'),_0x7cca('0x55'),_0x7cca('0x77')],'where':_0x38d055,'order':_0x3aa651,'transaction':_0x24901f,'lock':_0x24901f['LOCK'][_0x7cca('0x78')],'include':[{'model':db[_0x7cca('0x59')],'as':_0x7cca('0x79'),'attributes':_0x2d5853,'include':[{'model':db[_0x7cca('0x7a')],'as':_0x7cca('0x7b'),'attributes':['id',_0x7cca('0x37')]}]},{'model':db['CmList'],'as':_0x7cca('0x7c'),'attributes':['id',_0x7cca('0x37')]},{'model':db[_0x7cca('0x4a')],'as':_0x7cca('0x7d'),'attributes':['id',_0x7cca('0x37'),_0x7cca('0x7e')]}]})[_0x7cca('0x39')](function(_0x1bd752){if(_0x1bd752){return _0x1bd752[_0x7cca('0x44')]({'UserId':_0x3327b1['user']['id']},{'transaction':_0x24901f});}});});}})[_0x7cca('0x39')](handleEntityNotFound(_0x35eca7,null))[_0x7cca('0x39')](respondWithResult(_0x35eca7,null))['catch'](handleError(_0x35eca7,null));};exports[_0x7cca('0x7f')]=function(_0x5b4ca5,_0x569866,_0x24e643){var _0x313cd1=[];var _0x27e79c=_0x5b4ca5[_0x7cca('0x3f')]['id'];var _0x2af32b=_0x5b4ca5[_0x7cca('0x50')]['id'];return db[_0x7cca('0x59')][_0x7cca('0x46')]()[_0x7cca('0x39')](function(_0x5dd0f3){_0x313cd1=_[_0x7cca('0x19')](_0x5dd0f3);return db[_0x7cca('0x68')][_0x7cca('0x80')](function(_0x294484){const _0x37deae={'id':_0x27e79c};return db[_0x7cca('0x11')][_0x7cca('0x75')]({'attributes':['id',_0x7cca('0x76'),'recallme'],'where':_0x37deae,'transaction':_0x294484,'lock':_0x294484[_0x7cca('0x81')][_0x7cca('0x78')],'include':[{'model':db[_0x7cca('0x59')],'as':'Contact','attributes':_0x313cd1,'include':[{'model':db[_0x7cca('0x7a')],'as':_0x7cca('0x7b'),'attributes':['id',_0x7cca('0x37')]}]},{'model':db[_0x7cca('0x82')],'as':'List','attributes':['id',_0x7cca('0x37')]},{'model':db[_0x7cca('0x4a')],'as':_0x7cca('0x7d'),'attributes':['id',_0x7cca('0x37'),_0x7cca('0x7e')]}]})[_0x7cca('0x39')](function(_0x2f4c3a){if(_0x2f4c3a){return _0x2f4c3a['update']({'UserId':_0x2af32b},{'transaction':_0x294484});}});});})[_0x7cca('0x39')](handleEntityNotFound(_0x569866,null))[_0x7cca('0x39')](respondWithResult(_0x569866,null))[_0x7cca('0x41')](handleError(_0x569866,null));};exports[_0x7cca('0x83')]=function(_0x151a0d,_0x5afecc){return _0x151a0d[_0x7cca('0x50')][_0x7cca('0x64')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x7cca('0x66')},'attributes':['id'],'raw':!![]})[_0x7cca('0x39')](function(_0x5d23d5){if(_0x5d23d5&&_0x5d23d5[_0x7cca('0x30')]){return db[_0x7cca('0x11')][_0x7cca('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x7cca('0x52')](_0x7cca('0x53'))},'VoiceQueueId':{'$in':_[_0x7cca('0x17')](_0x5d23d5,'id')},'$or':[{'UserId':null},{'UserId':_0x151a0d[_0x7cca('0x50')]['id']}]}});}return 0x0;})[_0x7cca('0x39')](function(_0x961bfa){if(!_[_0x7cca('0x5c')](_0x961bfa)&&_[_0x7cca('0x84')](_0x961bfa)){return _0x5afecc[_0x7cca('0x5')](0xc8)['json']({'contacts':_0x961bfa});}else{logger[_0x7cca('0xe')](_0x7cca('0x85'),_0x7cca('0x83'),0x194,_0x7cca('0x86'));_0x5afecc[_0x7cca('0xd')](0x194);}})[_0x7cca('0x41')](handleError(_0x5afecc,null));};exports['getTimezones']=function(_0x12d6b3,_0x3ea186){var _0x330821=shared['timezones'];var _0x3863ac=[];_[_0x7cca('0x17')](_0x330821,function(_0x1a7f1c){_0x3863ac['push']({'id':_0x1a7f1c[_0x7cca('0x37')],'name':_0x1a7f1c['name'],'utcOffset':_0x1a7f1c[_0x7cca('0x87')]});});return _0x3ea186[_0x7cca('0x5')](0xc8)[_0x7cca('0x6')]({'tz':_0x3863ac});};exports['getTimezone']=function(_0x1502f7,_0x4a1eb7){var _0x519123=shared[_0x7cca('0x88')];var _0x3f696d={};if(!_['isNil'](_0x519123[_0x1502f7[_0x7cca('0x43')]['id']]))_0x3f696d=_0x519123[_0x1502f7[_0x7cca('0x43')]['id']];return _0x4a1eb7[_0x7cca('0x5')](0xc8)['json'](_0x3f696d);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 04d63fd..52dcbaa 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 _0xc1c6=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','exports','CmHopper','cm_hopper','scheduledat','phone','priority'];(function(_0x22b375,_0x4942de){var _0x197dfd=function(_0x190f7a){while(--_0x190f7a){_0x22b375['push'](_0x22b375['shift']());}};_0x197dfd(++_0x4942de);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x31ac31,_0x2944c1){_0x31ac31=_0x31ac31-0x0;var _0x387b08=_0xc1c6[_0x31ac31];return _0x387b08;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var logger=require(_0x6c1c('0x2'))('api');var moment=require(_0x6c1c('0x3'));var BPromise=require('bluebird');var rp=require(_0x6c1c('0x4'));var fs=require('fs');var path=require(_0x6c1c('0x5'));var rimraf=require(_0x6c1c('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopper.attributes');module[_0x6c1c('0x7')]=function(_0x524a6b,_0x50c1bb){return _0x524a6b['define'](_0x6c1c('0x8'),attributes,{'tableName':_0x6c1c('0x9'),'paranoid':![],'indexes':[{'name':_0x6c1c('0xa'),'fields':[_0x6c1c('0xa')]},{'name':'phone','fields':[_0x6c1c('0xb')]},{'name':_0x6c1c('0xc'),'fields':['priority']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x11af38,_0x1af0e3){var _0x281da6=function(_0x3ccdb3){while(--_0x3ccdb3){_0x11af38['push'](_0x11af38['shift']());}};_0x281da6(++_0x1af0e3);}(_0x5496,0x175));var _0x6549=function(_0xb2927c,_0x32fdc2){_0xb2927c=_0xb2927c-0x0;var _0x4dcdbf=_0x5496[_0xb2927c];return _0x4dcdbf;};'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')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 131b428..e8a2083 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 _0xdca3=['\x20,\x201,\x20null','GetContactRecallMe','keys','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','List','CmHopperHandlePreviewRecallNotifications','lodash','moment','bluebird','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','options','where','attributes','limit','include','map','model','info','debug','stringify','catch','error','message','ShowCmHopper','then','CreateCmHopper','create','body','raw','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','transaction','order','LOCK','UPDATE','Contact','User','Agent','name','voicePause','length','UserId','push','includes','all','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','sequelize','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','findAll','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x374ccf,_0xa945c4){var _0x443cde=function(_0x27ff10){while(--_0x27ff10){_0x374ccf['push'](_0x374ccf['shift']());}};_0x443cde(++_0xa945c4);}(_0xdca3,0x64));var _0x3dca=function(_0x134005,_0x6b531e){_0x134005=_0x134005-0x0;var _0x789512=_0xdca3[_0x134005];return _0x789512;};'use strict';var _=require(_0x3dca('0x0'));var util=require('util');var moment=require(_0x3dca('0x1'));var BPromise=require(_0x3dca('0x2'));var db=require(_0x3dca('0x3'))['db'];var logger=require(_0x3dca('0x4'))(_0x3dca('0x5'));exports[_0x3dca('0x6')]=function(_0x3af6cf){var _0x221ad8=this;return new Promise(function(_0x3887bd,_0x10c46f){return db[_0x3dca('0x7')]['findAll']({'raw':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf['options']['raw']===undefined?!![]:![]:!![],'where':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf['options'][_0x3dca('0x9')]||null:null,'attributes':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'limit':_0x3af6cf['options']?_0x3af6cf[_0x3dca('0x8')][_0x3dca('0xb')]||null:null,'include':_0x3af6cf[_0x3dca('0x8')]?_0x3af6cf[_0x3dca('0x8')][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x3af6cf['options'][_0x3dca('0xc')],function(_0x5d7f81){return{'model':db[_0x5d7f81['model']],'as':_0x5d7f81['as'],'attributes':_0x5d7f81[_0x3dca('0xa')],'include':_0x5d7f81[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x5d7f81[_0x3dca('0xc')],function(_0x2a3754){return{'model':db[_0x2a3754[_0x3dca('0xe')]],'as':_0x2a3754['as'],'attributes':_0x2a3754[_0x3dca('0xa')],'include':_0x2a3754[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x2a3754[_0x3dca('0xc')],function(_0x3d1154){return{'model':db[_0x3d1154[_0x3dca('0xe')]],'as':_0x3d1154['as'],'attributes':_0x3d1154[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4d2439){logger[_0x3dca('0xf')](_0x3dca('0x6'),_0x3af6cf);logger[_0x3dca('0x10')](_0x3dca('0x6'),_0x3af6cf,JSON[_0x3dca('0x11')](_0x4d2439));_0x3887bd(_0x4d2439);})[_0x3dca('0x12')](function(_0x47b1e9){logger[_0x3dca('0x13')](_0x3dca('0x6'),_0x47b1e9[_0x3dca('0x14')],_0x3af6cf);_0x10c46f(_0x221ad8[_0x3dca('0x13')](0x1f4,_0x47b1e9['message']));});});};exports[_0x3dca('0x15')]=function(_0x18b9ab){var _0x111d38=this;return new Promise(function(_0x5f0520,_0x501201){return db[_0x3dca('0x7')]['find']({'raw':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab[_0x3dca('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab['options'][_0x3dca('0x9')]||null:null,'attributes':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'include':_0x18b9ab[_0x3dca('0x8')]?_0x18b9ab['options'][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x18b9ab[_0x3dca('0x8')]['include'],function(_0x3c3021){return{'model':db[_0x3c3021[_0x3dca('0xe')]],'as':_0x3c3021['as'],'attributes':_0x3c3021['attributes'],'include':_0x3c3021[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x3c3021[_0x3dca('0xc')],function(_0x2580f6){return{'model':db[_0x2580f6[_0x3dca('0xe')]],'as':_0x2580f6['as'],'attributes':_0x2580f6[_0x3dca('0xa')],'include':_0x2580f6[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x2580f6[_0x3dca('0xc')],function(_0x10d1e8){return{'model':db[_0x10d1e8[_0x3dca('0xe')]],'as':_0x10d1e8['as'],'attributes':_0x10d1e8[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3dca('0x16')](function(_0x12560e){logger[_0x3dca('0xf')](_0x3dca('0x15'),_0x18b9ab);logger[_0x3dca('0x10')](_0x3dca('0x15'),_0x18b9ab,JSON[_0x3dca('0x11')](_0x12560e));_0x5f0520(_0x12560e);})['catch'](function(_0x2cddce){logger[_0x3dca('0x13')](_0x3dca('0x15'),_0x2cddce[_0x3dca('0x14')],_0x18b9ab);_0x501201(_0x111d38[_0x3dca('0x13')](0x1f4,_0x2cddce[_0x3dca('0x14')]));});});};exports[_0x3dca('0x17')]=function(_0x5cb047){var _0x57bbea=this;return new Promise(function(_0x59b102,_0xd0a73f){return db['CmHopper'][_0x3dca('0x18')](_0x5cb047[_0x3dca('0x19')],{'raw':_0x5cb047[_0x3dca('0x8')]?_0x5cb047[_0x3dca('0x8')][_0x3dca('0x1a')]===undefined?!![]:![]:!![]})[_0x3dca('0x16')](function(_0x25f732){logger[_0x3dca('0xf')](_0x3dca('0x17'),_0x5cb047);logger[_0x3dca('0x10')](_0x3dca('0x17'),_0x5cb047,JSON['stringify'](_0x25f732));_0x59b102(_0x25f732);})[_0x3dca('0x12')](function(_0x26357c){logger[_0x3dca('0x13')](_0x3dca('0x17'),_0x26357c['message'],_0x5cb047);_0xd0a73f(_0x57bbea[_0x3dca('0x13')](0x1f4,_0x26357c['message']));});});};exports[_0x3dca('0x1b')]=function(_0x114f2d){var _0xe0a218=this;return new Promise(function(_0x2c8d8d,_0x2d0bc7){return db[_0x3dca('0x7')][_0x3dca('0x1c')](_0x114f2d['body'],{'raw':_0x114f2d[_0x3dca('0x8')]?_0x114f2d[_0x3dca('0x8')][_0x3dca('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114f2d[_0x3dca('0x8')]?_0x114f2d[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x114f2d['options']?_0x114f2d[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'limit':_0x114f2d[_0x3dca('0x8')]?_0x114f2d[_0x3dca('0x8')][_0x3dca('0xb')]||null:null})[_0x3dca('0x16')](function(_0x58e555){logger[_0x3dca('0xf')](_0x3dca('0x1b'),_0x114f2d);logger[_0x3dca('0xf')](_0x3dca('0x1d'),JSON[_0x3dca('0x11')](_0x114f2d[_0x3dca('0x8')][_0x3dca('0x9')]),_0x114f2d[_0x3dca('0x19')][_0x3dca('0x1e')]);logger[_0x3dca('0x10')](_0x3dca('0x1b'),_0x114f2d,JSON[_0x3dca('0x11')](_0x58e555));_0x2c8d8d(_0x58e555);})[_0x3dca('0x12')](function(_0xe8998e){logger[_0x3dca('0x13')](_0x3dca('0x1b'),_0xe8998e[_0x3dca('0x14')],_0x114f2d);_0x2d0bc7(_0xe0a218['error'](0x1f4,_0xe8998e[_0x3dca('0x14')]));});});};exports[_0x3dca('0x1f')]=function(_0x4bab8a){var _0x184588=this;return new Promise(function(_0x390dfc,_0x38abf8){return db[_0x3dca('0x7')][_0x3dca('0x20')]({'where':_0x4bab8a[_0x3dca('0x8')]?_0x4bab8a[_0x3dca('0x8')][_0x3dca('0x9')]||null:null})[_0x3dca('0x16')](function(_0x195cc3){logger['info'](_0x3dca('0x1f'),_0x4bab8a);logger[_0x3dca('0x10')](_0x3dca('0x1f'),_0x4bab8a,JSON[_0x3dca('0x11')](_0x195cc3));_0x390dfc(_0x195cc3);})[_0x3dca('0x12')](function(_0x57b2e7){logger[_0x3dca('0x13')]('DestroyCmHopper',_0x57b2e7['message'],_0x4bab8a);_0x38abf8(_0x184588['error'](0x1f4,_0x57b2e7['message']));});});};exports[_0x3dca('0x21')]=function(_0x743b14){var _0x26b363=this;return new Promise(function(_0x2147b8,_0x4dd206){return db[_0x3dca('0x22')][_0x3dca('0x23')]()[_0x3dca('0x16')](function(_0xbadc17){return db['sequelize'][_0x3dca('0x24')](function(_0x20b356){return db[_0x3dca('0x7')]['findAll']({'where':_0x743b14[_0x3dca('0x8')]?_0x743b14[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x743b14[_0x3dca('0x8')]?_0x743b14[_0x3dca('0x8')][_0x3dca('0xa')]||null:null,'limit':_0x743b14[_0x3dca('0x8')]?_0x743b14['options']['limit']||null:null,'order':_0x743b14['options']?_0x743b14['options'][_0x3dca('0x25')]||null:null,'transaction':_0x20b356,'lock':_0x20b356[_0x3dca('0x26')][_0x3dca('0x27')],'include':[{'model':db[_0x3dca('0x22')],'as':_0x3dca('0x28'),'attributes':_['keys'](_0xbadc17)},{'model':db[_0x3dca('0x29')],'as':_0x3dca('0x2a'),'attributes':['id',_0x3dca('0x2b'),_0x3dca('0x2c')]}]})[_0x3dca('0x16')](function(_0x3fe52f){var _0x203afd=[];var _0x441579=[];for(var _0x35272c=0x0;_0x35272c<_0x3fe52f[_0x3dca('0x2d')];_0x35272c+=0x1){var _0x5779db=_0x3fe52f[_0x35272c][_0x3dca('0x2e')];if(_0x5779db===null){_0x203afd[_0x3dca('0x2f')](_0x3fe52f[_0x35272c][_0x3dca('0x1c')](_0x743b14[_0x3dca('0x19')],{'transaction':_0x20b356}));}else if(!_0x441579[_0x3dca('0x30')](_0x5779db)){_0x441579[_0x3dca('0x2f')](_0x5779db);_0x203afd[_0x3dca('0x2f')](_0x3fe52f[_0x35272c][_0x3dca('0x1c')](_0x743b14[_0x3dca('0x19')],{'transaction':_0x20b356}));}}return BPromise[_0x3dca('0x31')](_0x203afd);});})['then'](function(_0x1dae0c){logger[_0x3dca('0xf')](_0x3dca('0x21'),_0x743b14);if(_0x1dae0c[_0x3dca('0x2d')]>0x0){logger[_0x3dca('0xf')](_0x3dca('0x32'),_0x1dae0c[0x0]['dataValues']['id'],_0x1dae0c[0x0][_0x3dca('0x33')][_0x3dca('0x34')],_0x1dae0c[0x0]['dataValues'][_0x3dca('0x1e')]);}logger[_0x3dca('0x10')]('GetContactDialer',_0x743b14,JSON['stringify'](_0x1dae0c));_0x2147b8(_0x1dae0c);})['catch'](function(_0x14a355){logger[_0x3dca('0x13')](_0x3dca('0x21'),_0x14a355[_0x3dca('0x14')],_0x743b14);_0x4dd206(_0x26b363[_0x3dca('0x13')](0x1f4,_0x14a355[_0x3dca('0x14')]));});});});};exports[_0x3dca('0x35')]=function(_0x2330bf){var _0x567534=this;return new Promise(function(_0x266ef4,_0x321bef){return db[_0x3dca('0x36')][_0x3dca('0x24')](function(_0x246935){return db[_0x3dca('0x37')]['create'](_0x2330bf[_0x3dca('0x19')],{'raw':_0x2330bf[_0x3dca('0x8')]?_0x2330bf[_0x3dca('0x8')][_0x3dca('0x1a')]===undefined?!![]:![]:!![],'transaction':_0x246935})[_0x3dca('0x16')](function(){logger[_0x3dca('0xf')](_0x3dca('0x38'),JSON[_0x3dca('0x11')](_0x2330bf[_0x3dca('0x8')][_0x3dca('0x9')]),_0x2330bf[_0x3dca('0x8')][_0x3dca('0x9')][_0x3dca('0x1e')]);return db['CmHopper']['destroy']({'where':_0x2330bf['options']?_0x2330bf[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'transaction':_0x246935});});})[_0x3dca('0x16')](function(_0x40df15){logger[_0x3dca('0xf')](_0x3dca('0x35'),_0x2330bf);logger[_0x3dca('0x10')](_0x3dca('0x35'),_0x2330bf,JSON[_0x3dca('0x11')](_0x40df15));_0x266ef4(_0x40df15);})[_0x3dca('0x12')](function(_0x5ba3f8){logger[_0x3dca('0x13')](_0x3dca('0x35'),_0x5ba3f8[_0x3dca('0x14')],_0x2330bf);_0x321bef(_0x567534[_0x3dca('0x13')](0x1f4,_0x5ba3f8[_0x3dca('0x14')]));});});};exports[_0x3dca('0x39')]=function(_0x86b69e){var _0x45e010=this;return new Promise(function(_0x667031,_0xf14197){return db[_0x3dca('0x7')][_0x3dca('0x3a')]({'raw':_0x86b69e[_0x3dca('0x8')]?_0x86b69e[_0x3dca('0x8')]['raw']===undefined?!![]:![]:!![],'where':_0x86b69e[_0x3dca('0x8')]?_0x86b69e['options'][_0x3dca('0x9')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db[_0x3dca('0x36')]['fn']('IF',db['sequelize'][_0x3dca('0x3b')](_0x3dca('0x3c')+util[_0x3dca('0x3d')](_0x3dca('0x3e'),moment()['format'](_0x3dca('0x3f')))+_0x3dca('0x40')))),'contactsRescheduled']]})['then'](function(_0x543b09){logger[_0x3dca('0xf')](_0x3dca('0x39'),_0x86b69e);logger[_0x3dca('0x10')](_0x3dca('0x39'),_0x86b69e,JSON[_0x3dca('0x11')](_0x543b09));_0x667031(_0x543b09);})[_0x3dca('0x12')](function(_0x4b0747){logger[_0x3dca('0x13')](_0x3dca('0x39'),_0x4b0747['message'],_0x86b69e);_0xf14197(_0x45e010['error'](0x1f4,_0x4b0747[_0x3dca('0x14')]));});});};exports[_0x3dca('0x41')]=function(_0x719341){var _0x2bf178=this;return new Promise(function(_0x2a0730,_0x4571f7){return db[_0x3dca('0x22')][_0x3dca('0x23')]()[_0x3dca('0x16')](function(){return db[_0x3dca('0x36')][_0x3dca('0x24')](function(_0x2a5b45){return db[_0x3dca('0x7')][_0x3dca('0x3a')]({'where':_0x719341['options']?_0x719341[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x719341[_0x3dca('0x8')]?_0x719341['options'][_0x3dca('0xa')]||null:null,'limit':0x1,'order':_0x719341['options']?_0x719341[_0x3dca('0x8')][_0x3dca('0x25')]||null:null,'group':db[_0x3dca('0x7')][_0x3dca('0x2e')],'transaction':_0x2a5b45,'lock':_0x2a5b45[_0x3dca('0x26')]['UPDATE'],'include':_0x719341[_0x3dca('0x8')]?_0x719341[_0x3dca('0x8')][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x719341[_0x3dca('0x8')]['include'],function(_0xbfc8f7){return{'model':db[_0xbfc8f7['model']],'as':_0xbfc8f7['as'],'attributes':_0xbfc8f7[_0x3dca('0xa')],'include':_0xbfc8f7[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0xbfc8f7[_0x3dca('0xc')],function(_0x116c05){return{'model':db[_0x116c05[_0x3dca('0xe')]],'as':_0x116c05['as'],'attributes':_0x116c05[_0x3dca('0xa')],'include':_0x116c05['include']?_['map'](_0x116c05[_0x3dca('0xc')],function(_0x46904e){return{'model':db[_0x46904e[_0x3dca('0xe')]],'as':_0x46904e['as'],'attributes':_0x46904e[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})[_0x3dca('0x16')](function(_0x2875a0){var _0x5b37d8=[];for(var _0x49ced4=0x0;_0x49ced4<_0x2875a0[_0x3dca('0x2d')];_0x49ced4+=0x1){_0x5b37d8[_0x3dca('0x2f')](_0x2875a0[_0x49ced4][_0x3dca('0x1c')](_0x719341[_0x3dca('0x19')],{'transaction':_0x2a5b45}));}return BPromise[_0x3dca('0x31')](_0x5b37d8);});})[_0x3dca('0x16')](function(_0x5a8dc1){logger[_0x3dca('0xf')]('GetContactRecallMe',_0x719341);logger['debug'](_0x3dca('0x41'),_0x719341,JSON[_0x3dca('0x11')](_0x5a8dc1));_0x2a0730(_0x5a8dc1);})[_0x3dca('0x12')](function(_0x264877){logger[_0x3dca('0x13')](_0x3dca('0x41'),_0x264877[_0x3dca('0x14')],_0x719341);_0x4571f7(_0x2bf178['error'](0x1f4,_0x264877['message']));});});});};exports['GetCmHopperPreview']=function(_0x3dfae0){var _0x3dbbab=this;return new Promise(function(_0x28ed00,_0x41aa75){db[_0x3dca('0x22')][_0x3dca('0x23')]()[_0x3dca('0x16')](function(_0x2965c9){return db[_0x3dca('0x7')][_0x3dca('0x3a')]({'raw':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0['options'][_0x3dca('0x1a')]===undefined?!![]:![]:!![],'where':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0[_0x3dca('0x8')][_0x3dca('0x9')]||null:null,'attributes':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0['options'][_0x3dca('0xa')]||null:null,'limit':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0[_0x3dca('0x8')][_0x3dca('0xb')]||null:null,'include':_0x3dfae0[_0x3dca('0x8')]?_0x3dfae0['options'][_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x3dfae0[_0x3dca('0x8')][_0x3dca('0xc')],function(_0x4a35b2){return{'model':db[_0x4a35b2['model']],'as':_0x4a35b2['as'],'attributes':_0x4a35b2['as']==='Contact'?_[_0x3dca('0x42')](_0x2965c9):_0x4a35b2[_0x3dca('0xa')],'include':_0x4a35b2[_0x3dca('0xc')]?_['map'](_0x4a35b2[_0x3dca('0xc')],function(_0x19c4e7){return{'model':db[_0x19c4e7[_0x3dca('0xe')]],'as':_0x19c4e7['as'],'attributes':_0x19c4e7[_0x3dca('0xa')],'include':_0x19c4e7[_0x3dca('0xc')]?_[_0x3dca('0xd')](_0x19c4e7[_0x3dca('0xc')],function(_0x3b98bc){return{'model':db[_0x3b98bc[_0x3dca('0xe')]],'as':_0x3b98bc['as'],'attributes':_0x3b98bc[_0x3dca('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181fc3){logger[_0x3dca('0xf')](_0x3dca('0x6'),_0x3dfae0);logger[_0x3dca('0x10')](_0x3dca('0x6'),_0x3dfae0,JSON['stringify'](_0x181fc3));_0x28ed00(_0x181fc3);})[_0x3dca('0x12')](function(_0x9fe40c){logger[_0x3dca('0x13')](_0x3dca('0x6'),_0x9fe40c['message'],_0x3dfae0);_0x41aa75(_0x3dbbab[_0x3dca('0x13')](0x1f4,_0x9fe40c[_0x3dca('0x14')]));});});});};exports[_0x3dca('0x43')]=function(_0x139d4d){var _0x5d38e4=this;return new Promise(function(_0x26e354,_0x142a3d){return db[_0x3dca('0x22')][_0x3dca('0x44')]({'raw':!![],'where':{'phone':_0x139d4d['options']['where'][_0x3dca('0x45')]},'attributes':['id',_0x3dca('0x46')],'order':[['id',_0x3dca('0x47')]]})[_0x3dca('0x16')](function(_0x5a3adf){logger[_0x3dca('0xf')](_0x3dca('0x48'),_0x139d4d);logger['debug'](_0x3dca('0x48'),_0x139d4d,JSON[_0x3dca('0x11')](_0x5a3adf));_0x26e354(_0x5a3adf);})[_0x3dca('0x12')](function(_0xea9282){logger[_0x3dca('0x13')](_0x3dca('0x48'),_0xea9282[_0x3dca('0x14')],_0x139d4d);_0x142a3d(_0x5d38e4[_0x3dca('0x13')](0x1f4,_0xea9282['message']));});});};exports[_0x3dca('0x49')]=function(_0x510b21){var _0x506530=this;return new Promise(function(_0xee4c3,_0x51935d){return db[_0x3dca('0x36')]['transaction'](function(_0x3db6d0){var _0x560817=_0x510b21[_0x3dca('0x8')]&&_0x510b21[_0x3dca('0x8')][_0x3dca('0x9')]?_0x510b21[_0x3dca('0x8')][_0x3dca('0x9')]:{};return db[_0x3dca('0x7')][_0x3dca('0x1c')](_0x510b21[_0x3dca('0x19')],{'where':_0x560817,'transaction':_0x3db6d0})[_0x3dca('0x16')](function(_0x659e94){logger['info']('ResetActiveCalls',_0x510b21);logger[_0x3dca('0x10')](_0x3dca('0x49'),_0x510b21,JSON['stringify'](_0x659e94));_0xee4c3(_0x659e94);})['catch'](function(_0x18d6c1){logger[_0x3dca('0x13')](_0x3dca('0x49'),_0x18d6c1[_0x3dca('0x14')],_0x510b21);_0x51935d(_0x506530[_0x3dca('0x13')](0x1f4,_0x18d6c1[_0x3dca('0x14')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x50981e){var _0x2c7279=this;var _0x116ca9=_0x50981e[_0x3dca('0x19')][_0x3dca('0x9')][_0x3dca('0x4a')];var _0x23aad7=_0x50981e['body'][_0x3dca('0x9')][_0x3dca('0x4b')];var _0x357ab9=_0x50981e[_0x3dca('0x19')][_0x3dca('0x9')][_0x3dca('0x4c')];return new Promise(function(_0x128122,_0x4aaa50){return db['CmHopper'][_0x3dca('0x3a')]({'where':{'voiceQueueId':{'$in':_0x116ca9},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x3dca('0x36')][_0x3dca('0x3b')](_0x3dca('0x4d')+_0x23aad7+_0x3dca('0x4e')),'$gt':db[_0x3dca('0x36')][_0x3dca('0x3b')](_0x3dca('0x4f'))}},'UserId':{'$in':_0x357ab9}},'include':[{'model':db[_0x3dca('0x22')],'as':_0x3dca('0x28')},{'model':db[_0x3dca('0x29')],'as':_0x3dca('0x2a'),'attributes':['id',_0x3dca('0x2b'),'voicePause']},{'model':db['CmList'],'as':_0x3dca('0x50')}]})[_0x3dca('0x16')](function(_0x1d108){if(_0x1d108[_0x3dca('0x2d')]>0x0){return db[_0x3dca('0x36')]['transaction'](function(_0x2eff41){return db[_0x3dca('0x7')][_0x3dca('0x1c')]({'recallmeNotifiedDate':db[_0x3dca('0x36')][_0x3dca('0x3b')](_0x3dca('0x4f'))},{'where':{'id':{'$in':_[_0x3dca('0xd')](_0x1d108,'id')}},'transaction':_0x2eff41})['then'](function(){_0x128122(_0x1d108);})['catch'](function(_0xe4bace){logger[_0x3dca('0x13')](_0x3dca('0x51'),_0xe4bace[_0x3dca('0x14')],_0x50981e);_0x4aaa50(_0x2c7279['error'](0x1f4,_0xe4bace[_0x3dca('0x14')]));});})['catch'](function(_0x5d1361){logger['error'](_0x3dca('0x51'),_0x5d1361[_0x3dca('0x14')],_0x50981e);_0x4aaa50(_0x2c7279['error'](0x1f4,_0x5d1361[_0x3dca('0x14')]));});}else{_0x128122(_0x1d108);}});});}; \ No newline at end of file +var _0xf6ea=['\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','order','all','GetCmHopperPreview','Contact','GetContactByPhone','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','literal','NOW()\x20+\x20INTERVAL\x20','NOW()','name','CmList','List','lodash','util','bluebird','../../config/logger','rpc','CmHopper','findAll','options','where','attributes','limit','include','map','model','info','GetCmHopper','debug','stringify','ShowCmHopper','then','catch','message','CreateCmHopper','create','body','raw','error','UpdateCmHopper','update','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','LOCK','UPDATE','keys','User','voicePause','length','UserId','push','includes','dataValues','MoveContactManagedDialer','transaction','CmHopperFinal','COUNT','`scheduledat`\x20>=\x20','format'];(function(_0x762b7a,_0x15e398){var _0x2b3243=function(_0x414580){while(--_0x414580){_0x762b7a['push'](_0x762b7a['shift']());}};_0x2b3243(++_0x15e398);}(_0xf6ea,0x1e0));var _0xaf6e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xf6ea[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xaf6e('0x0'));var util=require(_0xaf6e('0x1'));var moment=require('moment');var BPromise=require(_0xaf6e('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0xaf6e('0x3'))(_0xaf6e('0x4'));exports['GetCmHopper']=function(_0x2c1b62){var _0x3a93d0=this;return new Promise(function(_0x195caf,_0x58ce4f){return db[_0xaf6e('0x5')][_0xaf6e('0x6')]({'raw':_0x2c1b62[_0xaf6e('0x7')]?_0x2c1b62[_0xaf6e('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x2c1b62[_0xaf6e('0x7')]?_0x2c1b62['options'][_0xaf6e('0x8')]||null:null,'attributes':_0x2c1b62[_0xaf6e('0x7')]?_0x2c1b62[_0xaf6e('0x7')][_0xaf6e('0x9')]||null:null,'limit':_0x2c1b62[_0xaf6e('0x7')]?_0x2c1b62['options'][_0xaf6e('0xa')]||null:null,'include':_0x2c1b62['options']?_0x2c1b62['options'][_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0x2c1b62[_0xaf6e('0x7')][_0xaf6e('0xb')],function(_0xa682bc){return{'model':db[_0xa682bc[_0xaf6e('0xd')]],'as':_0xa682bc['as'],'attributes':_0xa682bc['attributes'],'include':_0xa682bc['include']?_['map'](_0xa682bc['include'],function(_0x436a28){return{'model':db[_0x436a28[_0xaf6e('0xd')]],'as':_0x436a28['as'],'attributes':_0x436a28[_0xaf6e('0x9')],'include':_0x436a28[_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0x436a28['include'],function(_0x1b8264){return{'model':db[_0x1b8264[_0xaf6e('0xd')]],'as':_0x1b8264['as'],'attributes':_0x1b8264[_0xaf6e('0x9')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17a8e4){logger[_0xaf6e('0xe')](_0xaf6e('0xf'),_0x2c1b62);logger[_0xaf6e('0x10')](_0xaf6e('0xf'),_0x2c1b62,JSON[_0xaf6e('0x11')](_0x17a8e4));_0x195caf(_0x17a8e4);})['catch'](function(_0x515869){logger['error'](_0xaf6e('0xf'),_0x515869['message'],_0x2c1b62);_0x58ce4f(_0x3a93d0['error'](0x1f4,_0x515869['message']));});});};exports[_0xaf6e('0x12')]=function(_0x28ee02){var _0xc8f049=this;return new Promise(function(_0x1a242a,_0x1afed8){return db[_0xaf6e('0x5')]['find']({'raw':_0x28ee02['options']?_0x28ee02[_0xaf6e('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x28ee02[_0xaf6e('0x7')]?_0x28ee02[_0xaf6e('0x7')][_0xaf6e('0x8')]||null:null,'attributes':_0x28ee02[_0xaf6e('0x7')]?_0x28ee02[_0xaf6e('0x7')][_0xaf6e('0x9')]||null:null,'include':_0x28ee02[_0xaf6e('0x7')]?_0x28ee02['options'][_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0x28ee02['options'][_0xaf6e('0xb')],function(_0x3be224){return{'model':db[_0x3be224[_0xaf6e('0xd')]],'as':_0x3be224['as'],'attributes':_0x3be224[_0xaf6e('0x9')],'include':_0x3be224[_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0x3be224[_0xaf6e('0xb')],function(_0x4078ec){return{'model':db[_0x4078ec['model']],'as':_0x4078ec['as'],'attributes':_0x4078ec['attributes'],'include':_0x4078ec['include']?_[_0xaf6e('0xc')](_0x4078ec[_0xaf6e('0xb')],function(_0x3376ba){return{'model':db[_0x3376ba[_0xaf6e('0xd')]],'as':_0x3376ba['as'],'attributes':_0x3376ba[_0xaf6e('0x9')]};}):[]};}):[]};}):[]:[]})[_0xaf6e('0x13')](function(_0x20e330){logger[_0xaf6e('0xe')]('ShowCmHopper',_0x28ee02);logger[_0xaf6e('0x10')](_0xaf6e('0x12'),_0x28ee02,JSON['stringify'](_0x20e330));_0x1a242a(_0x20e330);})[_0xaf6e('0x14')](function(_0x45ad72){logger['error'](_0xaf6e('0x12'),_0x45ad72[_0xaf6e('0x15')],_0x28ee02);_0x1afed8(_0xc8f049['error'](0x1f4,_0x45ad72[_0xaf6e('0x15')]));});});};exports[_0xaf6e('0x16')]=function(_0x7b1a70){var _0x2a5401=this;return new Promise(function(_0x315675,_0x1f4e6c){return db[_0xaf6e('0x5')][_0xaf6e('0x17')](_0x7b1a70[_0xaf6e('0x18')],{'raw':_0x7b1a70[_0xaf6e('0x7')]?_0x7b1a70[_0xaf6e('0x7')][_0xaf6e('0x19')]===undefined?!![]:![]:!![]})[_0xaf6e('0x13')](function(_0x3e706a){logger[_0xaf6e('0xe')](_0xaf6e('0x16'),_0x7b1a70);logger['debug']('CreateCmHopper',_0x7b1a70,JSON[_0xaf6e('0x11')](_0x3e706a));_0x315675(_0x3e706a);})[_0xaf6e('0x14')](function(_0x229ea0){logger[_0xaf6e('0x1a')](_0xaf6e('0x16'),_0x229ea0[_0xaf6e('0x15')],_0x7b1a70);_0x1f4e6c(_0x2a5401[_0xaf6e('0x1a')](0x1f4,_0x229ea0['message']));});});};exports[_0xaf6e('0x1b')]=function(_0x21519b){var _0x226e48=this;return new Promise(function(_0x2fbdb7,_0x547dbb){return db[_0xaf6e('0x5')][_0xaf6e('0x1c')](_0x21519b[_0xaf6e('0x18')],{'raw':_0x21519b['options']?_0x21519b[_0xaf6e('0x7')][_0xaf6e('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21519b[_0xaf6e('0x7')]?_0x21519b[_0xaf6e('0x7')][_0xaf6e('0x8')]||null:null,'attributes':_0x21519b[_0xaf6e('0x7')]?_0x21519b[_0xaf6e('0x7')]['attributes']||null:null,'limit':_0x21519b[_0xaf6e('0x7')]?_0x21519b['options']['limit']||null:null})['then'](function(_0x206f0c){logger[_0xaf6e('0xe')](_0xaf6e('0x1b'),_0x21519b);logger['info']('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x21519b[_0xaf6e('0x7')]['where']),_0x21519b[_0xaf6e('0x18')][_0xaf6e('0x1d')]);logger[_0xaf6e('0x10')](_0xaf6e('0x1b'),_0x21519b,JSON[_0xaf6e('0x11')](_0x206f0c));_0x2fbdb7(_0x206f0c);})['catch'](function(_0x250535){logger[_0xaf6e('0x1a')]('UpdateCmHopper',_0x250535[_0xaf6e('0x15')],_0x21519b);_0x547dbb(_0x226e48[_0xaf6e('0x1a')](0x1f4,_0x250535['message']));});});};exports[_0xaf6e('0x1e')]=function(_0x4f8a08){var _0x1753b8=this;return new Promise(function(_0x218dfb,_0xa89de5){return db[_0xaf6e('0x5')][_0xaf6e('0x1f')]({'where':_0x4f8a08[_0xaf6e('0x7')]?_0x4f8a08[_0xaf6e('0x7')][_0xaf6e('0x8')]||null:null})[_0xaf6e('0x13')](function(_0x1adb0e){logger['info'](_0xaf6e('0x1e'),_0x4f8a08);logger[_0xaf6e('0x10')](_0xaf6e('0x1e'),_0x4f8a08,JSON[_0xaf6e('0x11')](_0x1adb0e));_0x218dfb(_0x1adb0e);})[_0xaf6e('0x14')](function(_0x5c362d){logger[_0xaf6e('0x1a')](_0xaf6e('0x1e'),_0x5c362d[_0xaf6e('0x15')],_0x4f8a08);_0xa89de5(_0x1753b8[_0xaf6e('0x1a')](0x1f4,_0x5c362d['message']));});});};exports[_0xaf6e('0x20')]=function(_0x3f693b){var _0x1b37a=this;return new Promise(function(_0x194109,_0x1c4422){return db[_0xaf6e('0x21')][_0xaf6e('0x22')]()['then'](function(_0x33397c){return db[_0xaf6e('0x23')]['transaction'](function(_0x51b437){return db['CmHopper'][_0xaf6e('0x6')]({'where':_0x3f693b[_0xaf6e('0x7')]?_0x3f693b[_0xaf6e('0x7')][_0xaf6e('0x8')]||null:null,'attributes':_0x3f693b[_0xaf6e('0x7')]?_0x3f693b['options']['attributes']||null:null,'limit':_0x3f693b[_0xaf6e('0x7')]?_0x3f693b[_0xaf6e('0x7')]['limit']||null:null,'order':_0x3f693b['options']?_0x3f693b[_0xaf6e('0x7')]['order']||null:null,'transaction':_0x51b437,'lock':_0x51b437[_0xaf6e('0x24')][_0xaf6e('0x25')],'include':[{'model':db[_0xaf6e('0x21')],'as':'Contact','attributes':_[_0xaf6e('0x26')](_0x33397c)},{'model':db[_0xaf6e('0x27')],'as':'Agent','attributes':['id','name',_0xaf6e('0x28')]}]})[_0xaf6e('0x13')](function(_0x1a2daf){var _0x3c8a66=[];var _0x347309=[];for(var _0x32700a=0x0;_0x32700a<_0x1a2daf[_0xaf6e('0x29')];_0x32700a+=0x1){var _0x514a4d=_0x1a2daf[_0x32700a][_0xaf6e('0x2a')];if(_0x514a4d===null){_0x3c8a66[_0xaf6e('0x2b')](_0x1a2daf[_0x32700a][_0xaf6e('0x1c')](_0x3f693b['body'],{'transaction':_0x51b437}));}else if(!_0x347309[_0xaf6e('0x2c')](_0x514a4d)){_0x347309[_0xaf6e('0x2b')](_0x514a4d);_0x3c8a66[_0xaf6e('0x2b')](_0x1a2daf[_0x32700a][_0xaf6e('0x1c')](_0x3f693b[_0xaf6e('0x18')],{'transaction':_0x51b437}));}}return BPromise['all'](_0x3c8a66);});})[_0xaf6e('0x13')](function(_0x24e18e){logger[_0xaf6e('0xe')]('GetContactDialer',_0x3f693b);if(_0x24e18e[_0xaf6e('0x29')]>0x0){logger[_0xaf6e('0xe')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x24e18e[0x0]['dataValues']['id'],_0x24e18e[0x0][_0xaf6e('0x2d')]['ContactId'],_0x24e18e[0x0]['dataValues']['active']);}logger['debug'](_0xaf6e('0x20'),_0x3f693b,JSON[_0xaf6e('0x11')](_0x24e18e));_0x194109(_0x24e18e);})['catch'](function(_0x2c38c7){logger['error'](_0xaf6e('0x20'),_0x2c38c7[_0xaf6e('0x15')],_0x3f693b);_0x1c4422(_0x1b37a[_0xaf6e('0x1a')](0x1f4,_0x2c38c7[_0xaf6e('0x15')]));});});});};exports[_0xaf6e('0x2e')]=function(_0x5c01b4){var _0x18cc31=this;return new Promise(function(_0x5a0945,_0x1e4def){return db[_0xaf6e('0x23')][_0xaf6e('0x2f')](function(_0x18c8d4){return db[_0xaf6e('0x30')][_0xaf6e('0x17')](_0x5c01b4['body'],{'raw':_0x5c01b4[_0xaf6e('0x7')]?_0x5c01b4[_0xaf6e('0x7')][_0xaf6e('0x19')]===undefined?!![]:![]:!![],'transaction':_0x18c8d4})[_0xaf6e('0x13')](function(){logger['info']('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x5c01b4[_0xaf6e('0x7')][_0xaf6e('0x8')]),_0x5c01b4['options']['where'][_0xaf6e('0x1d')]);return db['CmHopper']['destroy']({'where':_0x5c01b4['options']?_0x5c01b4['options'][_0xaf6e('0x8')]||null:null,'transaction':_0x18c8d4});});})[_0xaf6e('0x13')](function(_0x115a46){logger[_0xaf6e('0xe')]('MoveContactManagedDialer',_0x5c01b4);logger[_0xaf6e('0x10')](_0xaf6e('0x2e'),_0x5c01b4,JSON[_0xaf6e('0x11')](_0x115a46));_0x5a0945(_0x115a46);})['catch'](function(_0x4b7fbc){logger[_0xaf6e('0x1a')](_0xaf6e('0x2e'),_0x4b7fbc[_0xaf6e('0x15')],_0x5c01b4);_0x1e4def(_0x18cc31[_0xaf6e('0x1a')](0x1f4,_0x4b7fbc['message']));});});};exports['CountReScheduled']=function(_0x45f5e7){var _0xd23b2e=this;return new Promise(function(_0x5c26ea,_0x4bfc38){return db[_0xaf6e('0x5')][_0xaf6e('0x6')]({'raw':_0x45f5e7[_0xaf6e('0x7')]?_0x45f5e7[_0xaf6e('0x7')][_0xaf6e('0x19')]===undefined?!![]:![]:!![],'where':_0x45f5e7[_0xaf6e('0x7')]?_0x45f5e7[_0xaf6e('0x7')]['where']||null:null,'attributes':[[db['sequelize']['fn'](_0xaf6e('0x31'),db[_0xaf6e('0x23')]['fn']('IF',db[_0xaf6e('0x23')]['literal'](_0xaf6e('0x32')+util[_0xaf6e('0x33')](_0xaf6e('0x34'),moment()[_0xaf6e('0x33')](_0xaf6e('0x35')))+_0xaf6e('0x36')))),_0xaf6e('0x37')]]})[_0xaf6e('0x13')](function(_0x2b3402){logger[_0xaf6e('0xe')](_0xaf6e('0x38'),_0x45f5e7);logger['debug']('CountReScheduled',_0x45f5e7,JSON[_0xaf6e('0x11')](_0x2b3402));_0x5c26ea(_0x2b3402);})[_0xaf6e('0x14')](function(_0x563e9d){logger['error'](_0xaf6e('0x38'),_0x563e9d[_0xaf6e('0x15')],_0x45f5e7);_0x4bfc38(_0xd23b2e[_0xaf6e('0x1a')](0x1f4,_0x563e9d[_0xaf6e('0x15')]));});});};exports[_0xaf6e('0x39')]=function(_0xa98437){var _0x536599=this;return new Promise(function(_0x4dfec0,_0x362799){return db[_0xaf6e('0x21')][_0xaf6e('0x22')]()['then'](function(){return db[_0xaf6e('0x23')][_0xaf6e('0x2f')](function(_0x2b103d){return db[_0xaf6e('0x5')][_0xaf6e('0x6')]({'where':_0xa98437[_0xaf6e('0x7')]?_0xa98437['options'][_0xaf6e('0x8')]||null:null,'attributes':_0xa98437[_0xaf6e('0x7')]?_0xa98437[_0xaf6e('0x7')][_0xaf6e('0x9')]||null:null,'limit':0x1,'order':_0xa98437['options']?_0xa98437['options'][_0xaf6e('0x3a')]||null:null,'group':db[_0xaf6e('0x5')][_0xaf6e('0x2a')],'transaction':_0x2b103d,'lock':_0x2b103d[_0xaf6e('0x24')][_0xaf6e('0x25')],'include':_0xa98437[_0xaf6e('0x7')]?_0xa98437[_0xaf6e('0x7')][_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0xa98437[_0xaf6e('0x7')][_0xaf6e('0xb')],function(_0x29a0ec){return{'model':db[_0x29a0ec[_0xaf6e('0xd')]],'as':_0x29a0ec['as'],'attributes':_0x29a0ec[_0xaf6e('0x9')],'include':_0x29a0ec['include']?_[_0xaf6e('0xc')](_0x29a0ec['include'],function(_0x6686b0){return{'model':db[_0x6686b0['model']],'as':_0x6686b0['as'],'attributes':_0x6686b0[_0xaf6e('0x9')],'include':_0x6686b0['include']?_[_0xaf6e('0xc')](_0x6686b0[_0xaf6e('0xb')],function(_0x546f66){return{'model':db[_0x546f66['model']],'as':_0x546f66['as'],'attributes':_0x546f66[_0xaf6e('0x9')]};}):[]};}):[]};}):[]:[]})[_0xaf6e('0x13')](function(_0x3b5a67){var _0x1f1c00=[];for(var _0xc6aace=0x0;_0xc6aace<_0x3b5a67[_0xaf6e('0x29')];_0xc6aace+=0x1){_0x1f1c00[_0xaf6e('0x2b')](_0x3b5a67[_0xc6aace]['update'](_0xa98437[_0xaf6e('0x18')],{'transaction':_0x2b103d}));}return BPromise[_0xaf6e('0x3b')](_0x1f1c00);});})[_0xaf6e('0x13')](function(_0x3c0261){logger['info'](_0xaf6e('0x39'),_0xa98437);logger[_0xaf6e('0x10')](_0xaf6e('0x39'),_0xa98437,JSON['stringify'](_0x3c0261));_0x4dfec0(_0x3c0261);})[_0xaf6e('0x14')](function(_0x717c2b){logger[_0xaf6e('0x1a')](_0xaf6e('0x39'),_0x717c2b[_0xaf6e('0x15')],_0xa98437);_0x362799(_0x536599[_0xaf6e('0x1a')](0x1f4,_0x717c2b[_0xaf6e('0x15')]));});});});};exports[_0xaf6e('0x3c')]=function(_0x420316){var _0x46a9e5=this;return new Promise(function(_0x42c271,_0x42dfa3){db[_0xaf6e('0x21')][_0xaf6e('0x22')]()['then'](function(_0x698e88){return db[_0xaf6e('0x5')][_0xaf6e('0x6')]({'raw':_0x420316[_0xaf6e('0x7')]?_0x420316[_0xaf6e('0x7')][_0xaf6e('0x19')]===undefined?!![]:![]:!![],'where':_0x420316[_0xaf6e('0x7')]?_0x420316[_0xaf6e('0x7')][_0xaf6e('0x8')]||null:null,'attributes':_0x420316['options']?_0x420316[_0xaf6e('0x7')][_0xaf6e('0x9')]||null:null,'limit':_0x420316['options']?_0x420316[_0xaf6e('0x7')][_0xaf6e('0xa')]||null:null,'include':_0x420316[_0xaf6e('0x7')]?_0x420316[_0xaf6e('0x7')][_0xaf6e('0xb')]?_['map'](_0x420316[_0xaf6e('0x7')][_0xaf6e('0xb')],function(_0x2487d5){return{'model':db[_0x2487d5['model']],'as':_0x2487d5['as'],'attributes':_0x2487d5['as']===_0xaf6e('0x3d')?_[_0xaf6e('0x26')](_0x698e88):_0x2487d5[_0xaf6e('0x9')],'include':_0x2487d5[_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0x2487d5['include'],function(_0x3797f7){return{'model':db[_0x3797f7[_0xaf6e('0xd')]],'as':_0x3797f7['as'],'attributes':_0x3797f7[_0xaf6e('0x9')],'include':_0x3797f7[_0xaf6e('0xb')]?_[_0xaf6e('0xc')](_0x3797f7['include'],function(_0x1be8a2){return{'model':db[_0x1be8a2['model']],'as':_0x1be8a2['as'],'attributes':_0x1be8a2[_0xaf6e('0x9')]};}):[]};}):[]};}):[]:[]})[_0xaf6e('0x13')](function(_0x4d1b79){logger['info'](_0xaf6e('0xf'),_0x420316);logger[_0xaf6e('0x10')]('GetCmHopper',_0x420316,JSON[_0xaf6e('0x11')](_0x4d1b79));_0x42c271(_0x4d1b79);})[_0xaf6e('0x14')](function(_0x58ebe7){logger['error'](_0xaf6e('0xf'),_0x58ebe7[_0xaf6e('0x15')],_0x420316);_0x42dfa3(_0x46a9e5['error'](0x1f4,_0x58ebe7[_0xaf6e('0x15')]));});});});};exports[_0xaf6e('0x3e')]=function(_0x40fd1e){var _0x5a7ef8=this;return new Promise(function(_0x3c7e50,_0x1d6bf6){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x40fd1e[_0xaf6e('0x7')][_0xaf6e('0x8')][_0xaf6e('0x3f')]},'attributes':['id',_0xaf6e('0x40')],'order':[['id','DESC']]})[_0xaf6e('0x13')](function(_0x55d42a){logger['info'](_0xaf6e('0x41'),_0x40fd1e);logger[_0xaf6e('0x10')](_0xaf6e('0x41'),_0x40fd1e,JSON['stringify'](_0x55d42a));_0x3c7e50(_0x55d42a);})[_0xaf6e('0x14')](function(_0x25991c){logger[_0xaf6e('0x1a')](_0xaf6e('0x41'),_0x25991c[_0xaf6e('0x15')],_0x40fd1e);_0x1d6bf6(_0x5a7ef8[_0xaf6e('0x1a')](0x1f4,_0x25991c['message']));});});};exports['ResetActiveCalls']=function(_0x14ee85){var _0x30b976=this;return new Promise(function(_0x44e08b,_0x254f42){return db[_0xaf6e('0x23')]['transaction'](function(_0x5920a2){var _0x3e7e0a=_0x14ee85['options']&&_0x14ee85[_0xaf6e('0x7')][_0xaf6e('0x8')]?_0x14ee85[_0xaf6e('0x7')]['where']:{};return db[_0xaf6e('0x5')][_0xaf6e('0x1c')](_0x14ee85[_0xaf6e('0x18')],{'where':_0x3e7e0a,'transaction':_0x5920a2})['then'](function(_0x3edd9c){logger['info'](_0xaf6e('0x42'),_0x14ee85);logger[_0xaf6e('0x10')](_0xaf6e('0x42'),_0x14ee85,JSON['stringify'](_0x3edd9c));_0x44e08b(_0x3edd9c);})['catch'](function(_0x3e4fa2){logger[_0xaf6e('0x1a')](_0xaf6e('0x42'),_0x3e4fa2[_0xaf6e('0x15')],_0x14ee85);_0x254f42(_0x30b976[_0xaf6e('0x1a')](0x1f4,_0x3e4fa2[_0xaf6e('0x15')]));});});});};exports[_0xaf6e('0x43')]=function(_0x471a61){var _0x1efda=this;var _0x2b254b=_0x471a61[_0xaf6e('0x18')][_0xaf6e('0x8')][_0xaf6e('0x44')];var _0x24cad8=_0x471a61[_0xaf6e('0x18')][_0xaf6e('0x8')][_0xaf6e('0x45')];var _0x28998a=_0x471a61[_0xaf6e('0x18')]['where']['availableAgentsIds'];return new Promise(function(_0x3f3646,_0x134dbd){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0x2b254b},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xaf6e('0x46')](_0xaf6e('0x47')+_0x24cad8+'\x20MINUTE'),'$gt':db['sequelize'][_0xaf6e('0x46')](_0xaf6e('0x48'))}},'UserId':{'$in':_0x28998a}},'include':[{'model':db['CmContact'],'as':_0xaf6e('0x3d')},{'model':db[_0xaf6e('0x27')],'as':'Agent','attributes':['id',_0xaf6e('0x49'),_0xaf6e('0x28')]},{'model':db[_0xaf6e('0x4a')],'as':_0xaf6e('0x4b')}]})['then'](function(_0xfa67a6){if(_0xfa67a6[_0xaf6e('0x29')]>0x0){return db[_0xaf6e('0x23')]['transaction'](function(_0x4c6b2c){return db[_0xaf6e('0x5')]['update']({'recallmeNotifiedDate':db['sequelize'][_0xaf6e('0x46')](_0xaf6e('0x48'))},{'where':{'id':{'$in':_[_0xaf6e('0xc')](_0xfa67a6,'id')}},'transaction':_0x4c6b2c})[_0xaf6e('0x13')](function(){_0x3f3646(_0xfa67a6);})['catch'](function(_0x1d4310){logger[_0xaf6e('0x1a')](_0xaf6e('0x43'),_0x1d4310['message'],_0x471a61);_0x134dbd(_0x1efda[_0xaf6e('0x1a')](0x1f4,_0x1d4310['message']));});})['catch'](function(_0x5b0740){logger[_0xaf6e('0x1a')](_0xaf6e('0x43'),_0x5b0740[_0xaf6e('0x15')],_0x471a61);_0x134dbd(_0x1efda[_0xaf6e('0x1a')](0x1f4,_0x5b0740['message']));});}else{_0x3f3646(_0xfa67a6);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 8a3cb7c..e3af910 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 _0xc6bb=['/:id','show','/:id/previewrecall','getPreviewRecall','post','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','/opencontacts','getOpenContacts','/timezones'];(function(_0x1443eb,_0x203408){var _0x2b8810=function(_0x48bc4e){while(--_0x48bc4e){_0x1443eb['push'](_0x1443eb['shift']());}};_0x2b8810(++_0x203408);}(_0xc6bb,0x194));var _0xbc6b=function(_0x3d990d,_0xd2d650){_0x3d990d=_0x3d990d-0x0;var _0x1d2857=_0xc6bb[_0x3d990d];return _0x1d2857;};'use strict';var express=require(_0xbc6b('0x0'));var router=express[_0xbc6b('0x1')]();var auth=require(_0xbc6b('0x2'));var controller=require('./cmHopper.controller');router[_0xbc6b('0x3')]('/',auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x5')]);router[_0xbc6b('0x3')](_0xbc6b('0x6'),auth[_0xbc6b('0x4')](),controller['describe']);router[_0xbc6b('0x3')](_0xbc6b('0x7'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x8')]);router['get'](_0xbc6b('0x9'),auth[_0xbc6b('0x4')](),controller['getTimezones']);router[_0xbc6b('0x3')](_0xbc6b('0xa'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0xb')]);router[_0xbc6b('0x3')](_0xbc6b('0xc'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0xd')]);router[_0xbc6b('0xe')]('/',auth[_0xbc6b('0x4')](),controller['create']);router['post'](_0xbc6b('0xf'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x10')]);router['post']('/timezone',auth['isAuthenticated'](),controller[_0xbc6b('0x11')]);router[_0xbc6b('0x12')](_0xbc6b('0xa'),auth['isAuthenticated'](),controller[_0xbc6b('0x13')]);router[_0xbc6b('0x14')](_0xbc6b('0xa'),auth[_0xbc6b('0x4')](),controller[_0xbc6b('0x15')]);module[_0xbc6b('0x16')]=router; \ No newline at end of file +var _0xd8fa=['exports','isAuthenticated','index','get','describe','/opencontacts','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','getPreview','/timezone','getTimezone','put','update'];(function(_0x817d9b,_0x3c37e3){var _0x2752e1=function(_0x2b434e){while(--_0x2b434e){_0x817d9b['push'](_0x817d9b['shift']());}};_0x2752e1(++_0x3c37e3);}(_0xd8fa,0x144));var _0xad8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd8fa[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./cmHopper.controller');router['get']('/',auth[_0xad8f('0x0')](),controller[_0xad8f('0x1')]);router[_0xad8f('0x2')]('/describe',auth[_0xad8f('0x0')](),controller[_0xad8f('0x3')]);router[_0xad8f('0x2')](_0xad8f('0x4'),auth[_0xad8f('0x0')](),controller['getOpenContacts']);router[_0xad8f('0x2')]('/timezones',auth[_0xad8f('0x0')](),controller[_0xad8f('0x5')]);router['get'](_0xad8f('0x6'),auth['isAuthenticated'](),controller['show']);router[_0xad8f('0x2')](_0xad8f('0x7'),auth[_0xad8f('0x0')](),controller[_0xad8f('0x8')]);router[_0xad8f('0x9')]('/',auth[_0xad8f('0x0')](),controller[_0xad8f('0xa')]);router[_0xad8f('0x9')]('/preview',auth[_0xad8f('0x0')](),controller[_0xad8f('0xb')]);router[_0xad8f('0x9')](_0xad8f('0xc'),auth[_0xad8f('0x0')](),controller[_0xad8f('0xd')]);router[_0xad8f('0xe')](_0xad8f('0x6'),auth[_0xad8f('0x0')](),controller[_0xad8f('0xf')]);router['delete'](_0xad8f('0x6'),auth[_0xad8f('0x0')](),controller['destroy']);module[_0xad8f('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index f456085..c98ca05 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 _0x01f9=['YYYY-MM-DD\x20HH:mm:ss','moment','sequelize','exports','STRING','INTEGER','DATE','format'];(function(_0x177cfa,_0x463c2c){var _0x4ae48b=function(_0x438671){while(--_0x438671){_0x177cfa['push'](_0x177cfa['shift']());}};_0x4ae48b(++_0x463c2c);}(_0x01f9,0xa9));var _0x901f=function(_0x59328b,_0x3e1186){_0x59328b=_0x59328b-0x0;var _0x2593ea=_0x01f9[_0x59328b];return _0x2593ea;};'use strict';var moment=require(_0x901f('0x0'));var Sequelize=require(_0x901f('0x1'));module[_0x901f('0x2')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x901f('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x901f('0x5')],'defaultValue':moment()[_0x901f('0x6')](_0x901f('0x7'))},'countbusyretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x901f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7ae5=['exports','STRING','INTEGER','DATE','moment'];(function(_0x1c14ae,_0x25ecce){var _0x24c7cf=function(_0x167c24){while(--_0x167c24){_0x1c14ae['push'](_0x1c14ae['shift']());}};_0x24c7cf(++_0x25ecce);}(_0x7ae5,0x176));var _0x57ae=function(_0x2f2763,_0x4d9637){_0x2f2763=_0x2f2763-0x0;var _0x442362=_0x7ae5[_0x2f2763];return _0x442362;};'use strict';var moment=require(_0x57ae('0x0'));var Sequelize=require('sequelize');module[_0x57ae('0x1')]={'CmHopperId':{'type':Sequelize['INTEGER']},'phone':{'type':Sequelize[_0x57ae('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x57ae('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x57ae('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x57ae('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x57ae('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x57ae('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 dc814a0..805ede5 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 _0x4d0c=['../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','order','sort','filters','pick','filter','merge','where','includeAll','include','rows','catch','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmHopperAdditionalPhones','UserProfileSection','autoAssociation','UserProfileResource','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','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x4d0c,0x186));var _0xc4d0=function(_0x1ecd59,_0x5efc3e){_0x1ecd59=_0x1ecd59-0x0;var _0x53aedb=_0x4d0c[_0x1ecd59];return _0x53aedb;};'use strict';var emlformat=require(_0xc4d0('0x0'));var rimraf=require(_0xc4d0('0x1'));var zipdir=require(_0xc4d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4d0('0x3'));var moment=require(_0xc4d0('0x4'));var BPromise=require(_0xc4d0('0x5'));var Mustache=require(_0xc4d0('0x6'));var util=require(_0xc4d0('0x7'));var path=require(_0xc4d0('0x8'));var sox=require(_0xc4d0('0x9'));var csv=require(_0xc4d0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4d0('0xb'));var _=require(_0xc4d0('0xc'));var squel=require(_0xc4d0('0xd'));var crypto=require(_0xc4d0('0xe'));var jsforce=require(_0xc4d0('0xf'));var deskjs=require(_0xc4d0('0x10'));var toCsv=require(_0xc4d0('0xa'));var querystring=require(_0xc4d0('0x11'));var Papa=require(_0xc4d0('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc4d0('0x13'));var as=require(_0xc4d0('0x14'));var hardwareService=require(_0xc4d0('0x15'));var logger=require(_0xc4d0('0x16'))(_0xc4d0('0x17'));var utils=require(_0xc4d0('0x18'));var config=require(_0xc4d0('0x19'));var licenseUtil=require(_0xc4d0('0x1a'));var db=require(_0xc4d0('0x1b'))['db'];function respondWithStatusCode(_0x1b4504,_0x21aea7){_0x21aea7=_0x21aea7||0xcc;return function(_0x5487d6){if(_0x5487d6){return _0x1b4504['sendStatus'](_0x21aea7);}return _0x1b4504[_0xc4d0('0x1c')](_0x21aea7)[_0xc4d0('0x1d')]();};}function respondWithResult(_0xf827b9,_0x1ad024){_0x1ad024=_0x1ad024||0xc8;return function(_0x5e8c84){if(_0x5e8c84){return _0xf827b9[_0xc4d0('0x1c')](_0x1ad024)[_0xc4d0('0x1e')](_0x5e8c84);}};}function respondWithFilteredResult(_0x5e4851,_0x145f94){return function(_0x44bde8){if(_0x44bde8){var _0x196c67=typeof _0x145f94[_0xc4d0('0x1f')]==='undefined'&&typeof _0x145f94[_0xc4d0('0x20')]===_0xc4d0('0x21');var _0x3a4074=_0x44bde8[_0xc4d0('0x22')];var _0x2b03d0=_0x196c67?0x0:_0x145f94[_0xc4d0('0x1f')];var _0x1577b8=_0x196c67?_0x44bde8[_0xc4d0('0x22')]:_0x145f94[_0xc4d0('0x1f')]+_0x145f94['limit'];var _0x160c97;if(_0x1577b8>=_0x3a4074){_0x1577b8=_0x3a4074;_0x160c97=0xc8;}else{_0x160c97=0xce;}_0x5e4851[_0xc4d0('0x1c')](_0x160c97);return _0x5e4851[_0xc4d0('0x23')]('Content-Range',_0x2b03d0+'-'+_0x1577b8+'/'+_0x3a4074)['json'](_0x44bde8);}return null;};}function patchUpdates(_0x20e088){return function(_0x38e3f3){try{jsonpatch[_0xc4d0('0x24')](_0x38e3f3,_0x20e088,!![]);}catch(_0xb9da16){return BPromise[_0xc4d0('0x25')](_0xb9da16);}return _0x38e3f3[_0xc4d0('0x26')]();};}function saveUpdates(_0x3e59ca,_0x33222e){return function(_0x489178){if(_0x489178){return _0x489178[_0xc4d0('0x27')](_0x3e59ca)[_0xc4d0('0x28')](function(_0x370bd7){return _0x370bd7;});}return null;};}function removeEntity(_0x5cbef9,_0x32161a){return function(_0x31bc6a){if(_0x31bc6a){return _0x31bc6a[_0xc4d0('0x29')]()[_0xc4d0('0x28')](function(){var _0x3ebcd4=_0x31bc6a['get']({'plain':!![]});var _0x5ae7aa='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x5ae7aa,'resourceId':_0x3ebcd4['id']}})[_0xc4d0('0x28')](function(){return _0x31bc6a;});})[_0xc4d0('0x28')](function(){_0x5cbef9['status'](0xcc)[_0xc4d0('0x1d')]();});}};}function handleEntityNotFound(_0xcaee6b,_0x4dcc7a){return function(_0x2d0296){if(!_0x2d0296){_0xcaee6b['sendStatus'](0x194);}return _0x2d0296;};}function handleError(_0x147db6,_0x44ef6e){_0x44ef6e=_0x44ef6e||0x1f4;return function(_0xde1ee1){logger[_0xc4d0('0x2a')](_0xde1ee1[_0xc4d0('0x2b')]);if(_0xde1ee1[_0xc4d0('0x2c')]){delete _0xde1ee1[_0xc4d0('0x2c')];}_0x147db6['status'](_0x44ef6e)['send'](_0xde1ee1);};}exports[_0xc4d0('0x2d')]=function(_0x19617e,_0x392360){var _0x3c679e={},_0xb68b05={},_0x2881f2={'count':0x0,'rows':[]};var _0x1d4183=_[_0xc4d0('0x2e')](db[_0xc4d0('0x2f')][_0xc4d0('0x30')],function(_0x90bdde){return{'name':_0x90bdde[_0xc4d0('0x31')],'type':_0x90bdde[_0xc4d0('0x32')]['key']};});_0xb68b05[_0xc4d0('0x33')]=_[_0xc4d0('0x2e')](_0x1d4183,'name');_0xb68b05[_0xc4d0('0x34')]=_['keys'](_0x19617e['query']);_0xb68b05['filters']=_[_0xc4d0('0x35')](_0xb68b05[_0xc4d0('0x33')],_0xb68b05[_0xc4d0('0x34')]);_0x3c679e['attributes']=_[_0xc4d0('0x35')](_0xb68b05['model'],qs[_0xc4d0('0x36')](_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x36')]));_0x3c679e[_0xc4d0('0x37')]=_0x3c679e['attributes'][_0xc4d0('0x38')]?_0x3c679e['attributes']:_0xb68b05['model'];if(!_0x19617e[_0xc4d0('0x34')]['hasOwnProperty']('nolimit')){_0x3c679e['limit']=qs[_0xc4d0('0x20')](_0x19617e['query'][_0xc4d0('0x20')]);_0x3c679e['offset']=qs[_0xc4d0('0x1f')](_0x19617e['query'][_0xc4d0('0x1f')]);}_0x3c679e[_0xc4d0('0x39')]=qs['sort'](_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x3a')]);_0x3c679e['where']=qs[_0xc4d0('0x3b')](_[_0xc4d0('0x3c')](_0x19617e['query'],_0xb68b05[_0xc4d0('0x3b')]),_0x1d4183);if(_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x3d')]){_0x3c679e['where']=_[_0xc4d0('0x3e')](_0x3c679e[_0xc4d0('0x3f')],{'$or':_[_0xc4d0('0x2e')](_0x1d4183,function(_0x2e77c5){if(_0x2e77c5[_0xc4d0('0x32')]!=='VIRTUAL'){var _0x577183={};_0x577183[_0x2e77c5['name']]={'$like':'%'+_0x19617e['query']['filter']+'%'};return _0x577183;}})});}_0x3c679e=_[_0xc4d0('0x3e')]({},_0x3c679e,_0x19617e['options']);var _0x2dc6e9={'where':_0x3c679e[_0xc4d0('0x3f')]};return db['CmHopperAdditionalPhone']['count'](_0x2dc6e9)[_0xc4d0('0x28')](function(_0x370af9){_0x2881f2[_0xc4d0('0x22')]=_0x370af9;if(_0x19617e[_0xc4d0('0x34')][_0xc4d0('0x40')]){_0x3c679e[_0xc4d0('0x41')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone']['findAll'](_0x3c679e);})['then'](function(_0x4d75ea){_0x2881f2[_0xc4d0('0x42')]=_0x4d75ea;return _0x2881f2;})[_0xc4d0('0x28')](respondWithFilteredResult(_0x392360,_0x3c679e))[_0xc4d0('0x43')](handleError(_0x392360,null));};exports[_0xc4d0('0x44')]=function(_0x5a4bd5,_0x32fc42){var _0x149441={'raw':!![],'where':{'id':_0x5a4bd5[_0xc4d0('0x45')]['id']}},_0x978b64={};_0x978b64[_0xc4d0('0x33')]=_[_0xc4d0('0x46')](db[_0xc4d0('0x2f')][_0xc4d0('0x30')]);_0x978b64[_0xc4d0('0x34')]=_['keys'](_0x5a4bd5[_0xc4d0('0x34')]);_0x978b64[_0xc4d0('0x3b')]=_[_0xc4d0('0x35')](_0x978b64[_0xc4d0('0x33')],_0x978b64[_0xc4d0('0x34')]);_0x149441[_0xc4d0('0x37')]=_[_0xc4d0('0x35')](_0x978b64[_0xc4d0('0x33')],qs[_0xc4d0('0x36')](_0x5a4bd5[_0xc4d0('0x34')][_0xc4d0('0x36')]));_0x149441['attributes']=_0x149441[_0xc4d0('0x37')][_0xc4d0('0x38')]?_0x149441[_0xc4d0('0x37')]:_0x978b64[_0xc4d0('0x33')];if(_0x5a4bd5[_0xc4d0('0x34')][_0xc4d0('0x40')]){_0x149441['include']=[{'all':!![]}];}_0x149441=_[_0xc4d0('0x3e')]({},_0x149441,_0x5a4bd5[_0xc4d0('0x47')]);return db[_0xc4d0('0x2f')][_0xc4d0('0x48')](_0x149441)[_0xc4d0('0x28')](handleEntityNotFound(_0x32fc42,null))[_0xc4d0('0x28')](respondWithResult(_0x32fc42,null))[_0xc4d0('0x43')](handleError(_0x32fc42,null));};exports['create']=function(_0x1ec795,_0x5e4cd4){return db[_0xc4d0('0x2f')][_0xc4d0('0x49')](_0x1ec795[_0xc4d0('0x4a')],{})[_0xc4d0('0x28')](function(_0x3cb692){var _0x21c68b=_0x1ec795[_0xc4d0('0x4b')][_0xc4d0('0x4c')]({'plain':!![]});if(!_0x21c68b)throw new Error(_0xc4d0('0x4d'));if(_0x21c68b['role']==='user'){var _0x4a05d6=_0x3cb692[_0xc4d0('0x4c')]({'plain':!![]});var _0x261b9d=_0xc4d0('0x4e');return db[_0xc4d0('0x4f')]['find']({'where':{'name':_0x261b9d,'userProfileId':_0x21c68b['userProfileId']},'raw':!![]})[_0xc4d0('0x28')](function(_0x551720){if(_0x551720&&_0x551720[_0xc4d0('0x50')]===0x0){return db[_0xc4d0('0x51')]['create']({'name':_0x4a05d6[_0xc4d0('0x2c')],'resourceId':_0x4a05d6['id'],'type':_0x551720[_0xc4d0('0x2c')],'sectionId':_0x551720['id']},{})[_0xc4d0('0x28')](function(){return _0x3cb692;});}else{return _0x3cb692;}})[_0xc4d0('0x43')](function(_0x3bdf3e){logger[_0xc4d0('0x2a')](_0xc4d0('0x52'),_0x3bdf3e);throw _0x3bdf3e;});}return _0x3cb692;})[_0xc4d0('0x28')](respondWithResult(_0x5e4cd4,0xc9))[_0xc4d0('0x43')](handleError(_0x5e4cd4,null));};exports['update']=function(_0x2cb239,_0x2dde7f){if(_0x2cb239[_0xc4d0('0x4a')]['id']){delete _0x2cb239[_0xc4d0('0x4a')]['id'];}return db[_0xc4d0('0x2f')][_0xc4d0('0x48')]({'where':{'id':_0x2cb239['params']['id']}})[_0xc4d0('0x28')](handleEntityNotFound(_0x2dde7f,null))[_0xc4d0('0x28')](saveUpdates(_0x2cb239['body'],null))['then'](respondWithResult(_0x2dde7f,null))[_0xc4d0('0x43')](handleError(_0x2dde7f,null));};exports[_0xc4d0('0x29')]=function(_0x3eb1b5,_0x9391aa){return db[_0xc4d0('0x2f')][_0xc4d0('0x48')]({'where':{'id':_0x3eb1b5[_0xc4d0('0x45')]['id']}})['then'](handleEntityNotFound(_0x9391aa,null))[_0xc4d0('0x28')](removeEntity(_0x9391aa,null))[_0xc4d0('0x43')](handleError(_0x9391aa,null));}; \ No newline at end of file +var _0x2066=['name','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','count','limit','set','apply','save','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','end','error','stack'];(function(_0x32de36,_0x21581b){var _0x4f8ca4=function(_0x10d879){while(--_0x10d879){_0x32de36['push'](_0x32de36['shift']());}};_0x4f8ca4(++_0x21581b);}(_0x2066,0xd6));var _0x6206=function(_0x3e2e80,_0x138127){_0x3e2e80=_0x3e2e80-0x0;var _0x503ea4=_0x2066[_0x3e2e80];return _0x503ea4;};'use strict';var emlformat=require(_0x6206('0x0'));var rimraf=require(_0x6206('0x1'));var zipdir=require(_0x6206('0x2'));var jsonpatch=require(_0x6206('0x3'));var rp=require(_0x6206('0x4'));var moment=require(_0x6206('0x5'));var BPromise=require(_0x6206('0x6'));var Mustache=require('mustache');var util=require(_0x6206('0x7'));var path=require(_0x6206('0x8'));var sox=require(_0x6206('0x9'));var csv=require(_0x6206('0xa'));var ejs=require(_0x6206('0xb'));var fs=require('fs');var fs_extra=require(_0x6206('0xc'));var _=require(_0x6206('0xd'));var squel=require(_0x6206('0xe'));var crypto=require(_0x6206('0xf'));var jsforce=require(_0x6206('0x10'));var deskjs=require(_0x6206('0x11'));var toCsv=require('to-csv');var querystring=require(_0x6206('0x12'));var Papa=require(_0x6206('0x13'));var Redis=require(_0x6206('0x14'));var authService=require(_0x6206('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x6206('0x16'));var hardwareService=require(_0x6206('0x17'));var logger=require(_0x6206('0x18'))('api');var utils=require(_0x6206('0x19'));var config=require(_0x6206('0x1a'));var licenseUtil=require(_0x6206('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1fb669,_0x434838){_0x434838=_0x434838||0xcc;return function(_0x1d607b){if(_0x1d607b){return _0x1fb669[_0x6206('0x1c')](_0x434838);}return _0x1fb669[_0x6206('0x1d')](_0x434838)['end']();};}function respondWithResult(_0xe4d217,_0x544cb3){_0x544cb3=_0x544cb3||0xc8;return function(_0x39d94c){if(_0x39d94c){return _0xe4d217[_0x6206('0x1d')](_0x544cb3)[_0x6206('0x1e')](_0x39d94c);}};}function respondWithFilteredResult(_0x2b3cc1,_0x37f898){return function(_0x482f18){if(_0x482f18){var _0x5f2dbe=typeof _0x37f898[_0x6206('0x1f')]===_0x6206('0x20')&&typeof _0x37f898['limit']===_0x6206('0x20');var _0xb7b278=_0x482f18[_0x6206('0x21')];var _0x4a09c9=_0x5f2dbe?0x0:_0x37f898[_0x6206('0x1f')];var _0x351791=_0x5f2dbe?_0x482f18[_0x6206('0x21')]:_0x37f898[_0x6206('0x1f')]+_0x37f898[_0x6206('0x22')];var _0x47e783;if(_0x351791>=_0xb7b278){_0x351791=_0xb7b278;_0x47e783=0xc8;}else{_0x47e783=0xce;}_0x2b3cc1[_0x6206('0x1d')](_0x47e783);return _0x2b3cc1[_0x6206('0x23')]('Content-Range',_0x4a09c9+'-'+_0x351791+'/'+_0xb7b278)[_0x6206('0x1e')](_0x482f18);}return null;};}function patchUpdates(_0x5eddc5){return function(_0x38a39f){try{jsonpatch[_0x6206('0x24')](_0x38a39f,_0x5eddc5,!![]);}catch(_0x58952f){return BPromise['reject'](_0x58952f);}return _0x38a39f[_0x6206('0x25')]();};}function saveUpdates(_0x554aaf,_0xdcd8d4){return function(_0x462a82){if(_0x462a82){return _0x462a82[_0x6206('0x26')](_0x554aaf)[_0x6206('0x27')](function(_0x6b1144){return _0x6b1144;});}return null;};}function removeEntity(_0x14ae5e,_0x2c354b){return function(_0x3c0256){if(_0x3c0256){return _0x3c0256['destroy']()['then'](function(){var _0x222071=_0x3c0256[_0x6206('0x28')]({'plain':!![]});var _0x5d594e=_0x6206('0x29');return db[_0x6206('0x2a')][_0x6206('0x2b')]({'where':{'type':_0x5d594e,'resourceId':_0x222071['id']}})['then'](function(){return _0x3c0256;});})['then'](function(){_0x14ae5e[_0x6206('0x1d')](0xcc)[_0x6206('0x2c')]();});}};}function handleEntityNotFound(_0x25f46f,_0xf53b1f){return function(_0x5236f0){if(!_0x5236f0){_0x25f46f[_0x6206('0x1c')](0x194);}return _0x5236f0;};}function handleError(_0x39d355,_0x149784){_0x149784=_0x149784||0x1f4;return function(_0x461b55){logger[_0x6206('0x2d')](_0x461b55[_0x6206('0x2e')]);if(_0x461b55['name']){delete _0x461b55[_0x6206('0x2f')];}_0x39d355[_0x6206('0x1d')](_0x149784)['send'](_0x461b55);};}exports[_0x6206('0x30')]=function(_0x43c694,_0x2095f8){var _0x455236={},_0xaf3293={},_0x4df5bc={'count':0x0,'rows':[]};var _0x3080b0=_[_0x6206('0x31')](db[_0x6206('0x32')][_0x6206('0x33')],function(_0x527c55){return{'name':_0x527c55[_0x6206('0x34')],'type':_0x527c55[_0x6206('0x35')]['key']};});_0xaf3293[_0x6206('0x36')]=_[_0x6206('0x31')](_0x3080b0,'name');_0xaf3293[_0x6206('0x37')]=_[_0x6206('0x38')](_0x43c694['query']);_0xaf3293['filters']=_[_0x6206('0x39')](_0xaf3293[_0x6206('0x36')],_0xaf3293[_0x6206('0x37')]);_0x455236[_0x6206('0x3a')]=_['intersection'](_0xaf3293[_0x6206('0x36')],qs[_0x6206('0x3b')](_0x43c694['query'][_0x6206('0x3b')]));_0x455236['attributes']=_0x455236[_0x6206('0x3a')][_0x6206('0x3c')]?_0x455236[_0x6206('0x3a')]:_0xaf3293['model'];if(!_0x43c694['query'][_0x6206('0x3d')](_0x6206('0x3e'))){_0x455236['limit']=qs['limit'](_0x43c694[_0x6206('0x37')][_0x6206('0x22')]);_0x455236[_0x6206('0x1f')]=qs['offset'](_0x43c694['query'][_0x6206('0x1f')]);}_0x455236['order']=qs[_0x6206('0x3f')](_0x43c694['query'][_0x6206('0x3f')]);_0x455236[_0x6206('0x40')]=qs['filters'](_[_0x6206('0x41')](_0x43c694[_0x6206('0x37')],_0xaf3293[_0x6206('0x42')]),_0x3080b0);if(_0x43c694[_0x6206('0x37')]['filter']){_0x455236[_0x6206('0x40')]=_['merge'](_0x455236[_0x6206('0x40')],{'$or':_[_0x6206('0x31')](_0x3080b0,function(_0x5c875d){if(_0x5c875d[_0x6206('0x35')]!=='VIRTUAL'){var _0x3bc137={};_0x3bc137[_0x5c875d[_0x6206('0x2f')]]={'$like':'%'+_0x43c694[_0x6206('0x37')][_0x6206('0x43')]+'%'};return _0x3bc137;}})});}_0x455236=_[_0x6206('0x44')]({},_0x455236,_0x43c694[_0x6206('0x45')]);var _0x2caa20={'where':_0x455236[_0x6206('0x40')]};return db[_0x6206('0x32')][_0x6206('0x21')](_0x2caa20)[_0x6206('0x27')](function(_0x4b56ec){_0x4df5bc[_0x6206('0x21')]=_0x4b56ec;if(_0x43c694[_0x6206('0x37')]['includeAll']){_0x455236[_0x6206('0x46')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x6206('0x47')](_0x455236);})['then'](function(_0xeca57c){_0x4df5bc[_0x6206('0x48')]=_0xeca57c;return _0x4df5bc;})['then'](respondWithFilteredResult(_0x2095f8,_0x455236))['catch'](handleError(_0x2095f8,null));};exports[_0x6206('0x49')]=function(_0x1b99d2,_0x31b533){var _0x406398={'raw':!![],'where':{'id':_0x1b99d2[_0x6206('0x4a')]['id']}},_0x501f36={};_0x501f36[_0x6206('0x36')]=_[_0x6206('0x38')](db[_0x6206('0x32')]['rawAttributes']);_0x501f36[_0x6206('0x37')]=_[_0x6206('0x38')](_0x1b99d2[_0x6206('0x37')]);_0x501f36['filters']=_[_0x6206('0x39')](_0x501f36[_0x6206('0x36')],_0x501f36['query']);_0x406398['attributes']=_[_0x6206('0x39')](_0x501f36[_0x6206('0x36')],qs[_0x6206('0x3b')](_0x1b99d2['query'][_0x6206('0x3b')]));_0x406398[_0x6206('0x3a')]=_0x406398[_0x6206('0x3a')][_0x6206('0x3c')]?_0x406398[_0x6206('0x3a')]:_0x501f36[_0x6206('0x36')];if(_0x1b99d2[_0x6206('0x37')][_0x6206('0x4b')]){_0x406398[_0x6206('0x46')]=[{'all':!![]}];}_0x406398=_[_0x6206('0x44')]({},_0x406398,_0x1b99d2[_0x6206('0x45')]);return db[_0x6206('0x32')][_0x6206('0x4c')](_0x406398)[_0x6206('0x27')](handleEntityNotFound(_0x31b533,null))['then'](respondWithResult(_0x31b533,null))[_0x6206('0x4d')](handleError(_0x31b533,null));};exports[_0x6206('0x4e')]=function(_0x5d8347,_0x38707d){return db[_0x6206('0x32')][_0x6206('0x4e')](_0x5d8347[_0x6206('0x4f')],{})['then'](function(_0xa6da17){var _0x1d8487=_0x5d8347[_0x6206('0x50')][_0x6206('0x28')]({'plain':!![]});if(!_0x1d8487)throw new Error(_0x6206('0x51'));if(_0x1d8487[_0x6206('0x52')]===_0x6206('0x50')){var _0x13e5a4=_0xa6da17[_0x6206('0x28')]({'plain':!![]});var _0x38809d=_0x6206('0x29');return db[_0x6206('0x53')][_0x6206('0x4c')]({'where':{'name':_0x38809d,'userProfileId':_0x1d8487[_0x6206('0x54')]},'raw':!![]})['then'](function(_0x519d76){if(_0x519d76&&_0x519d76[_0x6206('0x55')]===0x0){return db['UserProfileResource'][_0x6206('0x4e')]({'name':_0x13e5a4[_0x6206('0x2f')],'resourceId':_0x13e5a4['id'],'type':_0x519d76[_0x6206('0x2f')],'sectionId':_0x519d76['id']},{})[_0x6206('0x27')](function(){return _0xa6da17;});}else{return _0xa6da17;}})[_0x6206('0x4d')](function(_0x4b2ca5){logger[_0x6206('0x2d')](_0x6206('0x56'),_0x4b2ca5);throw _0x4b2ca5;});}return _0xa6da17;})[_0x6206('0x27')](respondWithResult(_0x38707d,0xc9))[_0x6206('0x4d')](handleError(_0x38707d,null));};exports[_0x6206('0x26')]=function(_0x59343e,_0x518294){if(_0x59343e['body']['id']){delete _0x59343e[_0x6206('0x4f')]['id'];}return db[_0x6206('0x32')][_0x6206('0x4c')]({'where':{'id':_0x59343e[_0x6206('0x4a')]['id']}})[_0x6206('0x27')](handleEntityNotFound(_0x518294,null))[_0x6206('0x27')](saveUpdates(_0x59343e[_0x6206('0x4f')],null))['then'](respondWithResult(_0x518294,null))[_0x6206('0x4d')](handleError(_0x518294,null));};exports[_0x6206('0x2b')]=function(_0x287901,_0x1e69dc){return db[_0x6206('0x32')]['find']({'where':{'id':_0x287901[_0x6206('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1e69dc,null))[_0x6206('0x27')](removeEntity(_0x1e69dc,null))[_0x6206('0x4d')](handleError(_0x1e69dc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index ff7c6c9..6cf21c5 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 _0xed87=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed87,0xfa));var _0x7ed8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xed87[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7ed8('0x0'));var util=require(_0x7ed8('0x1'));var logger=require(_0x7ed8('0x2'))(_0x7ed8('0x3'));var moment=require(_0x7ed8('0x4'));var BPromise=require(_0x7ed8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7ed8('0x6'));var rimraf=require(_0x7ed8('0x7'));var config=require(_0x7ed8('0x8'));var attributes=require(_0x7ed8('0x9'));module[_0x7ed8('0xa')]=function(_0x5e5651,_0x48e9d0){return _0x5e5651[_0x7ed8('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0359=['define','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports'];(function(_0xff9cd9,_0x2b5290){var _0xb38ac4=function(_0x286e09){while(--_0x286e09){_0xff9cd9['push'](_0xff9cd9['shift']());}};_0xb38ac4(++_0x2b5290);}(_0x0359,0xf4));var _0x9035=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x0359[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0x9035('0x0'));var logger=require(_0x9035('0x1'))(_0x9035('0x2'));var moment=require(_0x9035('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9035('0x4'));var rimraf=require(_0x9035('0x5'));var config=require(_0x9035('0x6'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x9035('0x7')]=function(_0x21d2f7,_0x31f408){return _0x21d2f7[_0x9035('0x8')]('CmHopperAdditionalPhone',attributes,{'tableName':'cm_hopper_additional_phones','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 b3e1066..78c6ce1 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 _0xc216=['jayson/promise','client','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','entity','dialGlobalMaxRetry','countmachineretry','VerifyAdditionalPhones','SwapAdditionalPhones','OrderBy','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','transaction','update','IncrementPreviewCounters','field','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4a78dc,_0x2db037){var _0x1bf6a4=function(_0x4163b4){while(--_0x4163b4){_0x4a78dc['push'](_0x4a78dc['shift']());}};_0x1bf6a4(++_0x2db037);}(_0xc216,0x18e));var _0x6c21=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc216[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0x6c21('0x0'));var util=require(_0x6c21('0x1'));var moment=require(_0x6c21('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c21('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c21('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c21('0x5'))(_0x6c21('0x6'));var config=require(_0x6c21('0x7'));var jayson=require(_0x6c21('0x8'));var client=jayson[_0x6c21('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f90d8,_0x137f1b,_0x4e31a2){return new BPromise(function(_0x4a3c1e,_0x3f86d2){return client[_0x6c21('0xa')](_0x1f90d8,_0x4e31a2)[_0x6c21('0xb')](function(_0x12fc15){logger[_0x6c21('0xc')](_0x6c21('0xd'),_0x137f1b,_0x6c21('0xe'));logger[_0x6c21('0xf')](_0x6c21('0x10'),_0x137f1b,_0x6c21('0xe'),JSON[_0x6c21('0x11')](_0x12fc15));if(_0x12fc15[_0x6c21('0x12')]){if(_0x12fc15[_0x6c21('0x12')][_0x6c21('0x13')]===0x1f4){logger[_0x6c21('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x137f1b,_0x12fc15[_0x6c21('0x12')][_0x6c21('0x14')]);return _0x3f86d2(_0x12fc15['error'][_0x6c21('0x14')]);}logger[_0x6c21('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x137f1b,_0x12fc15[_0x6c21('0x12')]['message']);return _0x4a3c1e(_0x12fc15[_0x6c21('0x12')][_0x6c21('0x14')]);}else{logger[_0x6c21('0xc')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x137f1b,_0x6c21('0xe'));_0x4a3c1e(_0x12fc15[_0x6c21('0x15')]['message']);}})[_0x6c21('0x16')](function(_0x43ea40){logger[_0x6c21('0x12')](_0x6c21('0xd'),_0x137f1b,_0x43ea40);_0x3f86d2(_0x43ea40);});});}exports['VerifyAdditionalPhones']=function(_0x205789){var _0x57ae73=this;return new Promise(function(_0x293ede,_0x26f990){return db[_0x6c21('0x17')][_0x6c21('0x18')]({'raw':!![],'where':{'ContactId':_0x205789['body']['ContactId'],'ListId':_0x205789[_0x6c21('0x19')][_0x6c21('0x1a')],'VoiceQueueId':_0x205789[_0x6c21('0x19')][_0x6c21('0x1b')]===undefined?null:_0x205789['body'][_0x6c21('0x1b')],'CampaignId':_0x205789[_0x6c21('0x19')][_0x6c21('0x1c')]===undefined?null:_0x205789[_0x6c21('0x19')][_0x6c21('0x1c')]}})[_0x6c21('0xb')](function(_0x52a6d2){if(_0x52a6d2!=null){return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x52a6d2['id'],'OrderBy':{'$gt':_0x52a6d2['OrderBy']}},'order':[['OrderBy',_0x6c21('0x1e')]]})[_0x6c21('0xb')](function(_0x188244){var _0x51b113=0x0;if(_0x188244){if(_0x188244[_0x6c21('0x1f')]+_0x188244[_0x6c21('0x20')]+_0x188244[_0x6c21('0x21')]+_0x188244[_0x6c21('0x22')]+_0x188244[_0x6c21('0x23')]+_0x188244[_0x6c21('0x24')]+_0x188244['countmachineretry']+_0x188244[_0x6c21('0x25')]<_0x205789[_0x6c21('0x26')][_0x6c21('0x27')])_0x51b113=0x1;_0x293ede({'additional':_0x51b113});}else{return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x52a6d2['id']},'order':[['OrderBy','ASC']]})[_0x6c21('0xb')](function(_0xe9c575){var _0x12b0ac=0x0;if(_0xe9c575){if(_0xe9c575[_0x6c21('0x1f')]+_0xe9c575[_0x6c21('0x20')]+_0xe9c575['countnoanswerretry']+_0xe9c575[_0x6c21('0x22')]+_0xe9c575[_0x6c21('0x23')]+_0xe9c575[_0x6c21('0x24')]+_0xe9c575[_0x6c21('0x28')]+_0xe9c575[_0x6c21('0x25')]<_0x205789[_0x6c21('0x26')]['dialGlobalMaxRetry'])_0x12b0ac=0x1;_0x293ede({'additional':_0x12b0ac});}else{_0x293ede({'additional':0x0});}})[_0x6c21('0x16')](function(_0x4e5951){logger[_0x6c21('0x12')]('VerifyAdditionalPhones',_0x4e5951['message']);_0x26f990(_0x57ae73[_0x6c21('0x12')](0x1f4,_0x4e5951[_0x6c21('0x14')]));});}})[_0x6c21('0x16')](function(_0x2d3201){logger['error'](_0x6c21('0x29'),_0x2d3201[_0x6c21('0x14')]);_0x26f990(_0x57ae73['error'](0x1f4,_0x2d3201['message']));});}else _0x293ede({'additional':0x0});});});};exports[_0x6c21('0x2a')]=function(_0x3016d9){var _0x496cff=this;return new Promise(function(_0x107a17,_0x1f4e3d){return db[_0x6c21('0x17')][_0x6c21('0x18')]({'raw':!![],'where':{'ContactId':_0x3016d9[_0x6c21('0x19')]['ContactId'],'ListId':_0x3016d9['body'][_0x6c21('0x1a')],'VoiceQueueId':_0x3016d9['body'][_0x6c21('0x1b')]===undefined?null:_0x3016d9['body']['VoiceQueueId'],'CampaignId':_0x3016d9[_0x6c21('0x19')][_0x6c21('0x1c')]===undefined?null:_0x3016d9[_0x6c21('0x19')][_0x6c21('0x1c')]}})['then'](function(_0x187858){if(_0x187858!=null){return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x187858['id'],'OrderBy':{'$gte':_0x187858[_0x6c21('0x2b')]}},'order':[[_0x6c21('0x2b'),_0x6c21('0x1e')]]})['then'](function(_0x40e016){if(_0x40e016)return activateAdditionalPhone(_0x187858,_0x3016d9[_0x6c21('0x19')],_0x40e016,_0x3016d9[_0x6c21('0x2c')],_0x3016d9[_0x6c21('0x2d')])[_0x6c21('0xb')](function(_0x4ff340){_0x107a17(_0x4ff340);});else{return db[_0x6c21('0x1d')][_0x6c21('0x18')]({'raw':!![],'where':{'CmHopperId':_0x187858['id']},'order':[[_0x6c21('0x2b'),_0x6c21('0x1e')]]})[_0x6c21('0xb')](function(_0xcfd5ff){if(_0xcfd5ff)return activateAdditionalPhone(_0x187858,_0x3016d9['body'],_0xcfd5ff,_0x3016d9['duration'],_0x3016d9['waitTime'])[_0x6c21('0xb')](function(_0x46d7c3){_0x107a17(_0x46d7c3);});else{_0x107a17({'id':_0x187858['id'],'phone':''});}})[_0x6c21('0x16')](function(_0xeb5c13){logger[_0x6c21('0x12')]('VerifyAdditionalPhones',_0xeb5c13[_0x6c21('0x14')]);_0x1f4e3d(_0x496cff[_0x6c21('0x12')](0x1f4,_0xeb5c13['message']));});}})[_0x6c21('0x16')](function(_0x4629c4){logger['error'](_0x6c21('0x29'),_0x4629c4[_0x6c21('0x14')]);_0x1f4e3d(_0x496cff[_0x6c21('0x12')](0x1f4,_0x4629c4[_0x6c21('0x14')]));});}else _0x107a17(0x1);});});};function activateAdditionalPhone(_0x43f780,_0xcba253,_0x22c386,_0x2d18a9,_0x325029){return new Promise(function(_0x344697,_0x475544){var _0x27f875;if(_[_0x6c21('0x2e')](_0x22c386['scheduledat'])){_0x22c386[_0x6c21('0x2f')]=moment();}if(moment()>moment(_0x22c386[_0x6c21('0x2f')])){_0x27f875=moment()['add'](_0x325029||0x3,_0x6c21('0x30'));}else{if(_0x22c386[_0x6c21('0x2b')]==0x0){_0x27f875=moment(_0x22c386[_0x6c21('0x2f')]);}else{_0x27f875=moment()[_0x6c21('0x31')](_0x325029||0x3,_0x6c21('0x30'));}}if(_[_0x6c21('0x2e')](_0x27f875)){_0x27f875=moment()['add'](_0x325029||0x3,_0x6c21('0x30'));}var _0x576c58={'phone':_0x43f780[_0x6c21('0x32')],'active':0x0,'OrderBy':_[_0x6c21('0x2e')](_0x43f780['OrderBy'])?0x0:_0x43f780['OrderBy'],'scheduledat':moment()[_0x6c21('0x31')](_0x2d18a9||0x1,'minutes'),'countbusyretry':_0xcba253[_0x6c21('0x1f')],'countcongestionretry':_0xcba253[_0x6c21('0x20')],'countnoanswerretry':_0xcba253[_0x6c21('0x21')],'countnosuchnumberretry':_0xcba253[_0x6c21('0x22')],'countdropretry':_0xcba253[_0x6c21('0x23')],'countabandonedretry':_0xcba253['countabandonedretry'],'countmachineretry':_0xcba253['countmachineretry'],'countagentrejectretry':_0xcba253[_0x6c21('0x25')],'createdAt':_0xcba253[_0x6c21('0x33')],'updatedAt':_0xcba253['updatedAt']};var _0x2d03ed={'CmHopperId':_0x43f780['id'],'phone':_0x22c386['phone'],'active':0x0,'OrderBy':_['isNil'](_0x22c386[_0x6c21('0x2b')])?0x0:_0x22c386[_0x6c21('0x2b')],'scheduledat':_0x27f875,'countbusyretry':_0x22c386[_0x6c21('0x1f')],'countcongestionretry':_0x22c386[_0x6c21('0x20')],'countnoanswerretry':_0x22c386[_0x6c21('0x21')],'countnosuchnumberretry':_0x22c386['countnosuchnumberretry'],'countdropretry':_0x22c386[_0x6c21('0x23')],'countabandonedretry':_0x22c386['countabandonedretry'],'countmachineretry':_0x22c386[_0x6c21('0x28')],'countagentrejectretry':_0x22c386['countagentrejectretry'],'createdAt':_0x22c386[_0x6c21('0x33')],'updatedAt':_0x22c386[_0x6c21('0x34')]};return db[_0x6c21('0x35')][_0x6c21('0x36')](function(_0x5a0e9d){return db[_0x6c21('0x1d')][_0x6c21('0x37')](_0x576c58,{'where':{'id':_0x22c386['id']}},{'transaction':_0x5a0e9d})[_0x6c21('0xb')](function(){return db[_0x6c21('0x17')][_0x6c21('0x37')](_0x2d03ed,{'where':{'id':_0x43f780['id']}},{'transaction':_0x5a0e9d});});})[_0x6c21('0xb')](function(_0x4a6fe6){_0x344697({'id':_0x43f780['id'],'phone':_0x22c386['phone']});})[_0x6c21('0x16')](function(_0xfd7386){logger[_0x6c21('0x12')]('activateAdditionalPhone',_0xfd7386[_0x6c21('0x14')]);_0x475544({'error':_0xfd7386[_0x6c21('0x14')]});});});}exports[_0x6c21('0x38')]=function(_0x4fc445){var _0x3c864a=this;return new Promise(function(_0x59318c,_0x5628d3){return db['CmHopper'][_0x6c21('0x37')](_0x4fc445['body'][_0x6c21('0x39')],{'where':{'id':_0x4fc445[_0x6c21('0x19')]['id']}})['then'](function(_0x4f43e5){_0x59318c(_0x4f43e5);})['catch'](function(_0x82446b){logger[_0x6c21('0x12')]('IncrementPreviewCounters',_0x82446b[_0x6c21('0x14')]);_0x5628d3(_0x3c864a[_0x6c21('0x12')](0x1f4,_0x82446b[_0x6c21('0x14')]));});});}; \ No newline at end of file +var _0xedb2=['countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','catch','duration','waitTime','scheduledat','add','minutes','phone','isNil','createdAt','updatedAt','sequelize','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','result','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xedb2,0x1a7));var _0x2edb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xedb2[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0x2edb('0x0'));var util=require(_0x2edb('0x1'));var moment=require(_0x2edb('0x2'));var BPromise=require(_0x2edb('0x3'));var rs=require(_0x2edb('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2edb('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2edb('0x6'));var config=require(_0x2edb('0x7'));var jayson=require(_0x2edb('0x8'));var client=jayson[_0x2edb('0x9')][_0x2edb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43046c,_0x5dbf60,_0xe4d61a){return new BPromise(function(_0x33092d,_0x3f2aea){return client['request'](_0x43046c,_0xe4d61a)[_0x2edb('0xb')](function(_0x45a1ef){logger[_0x2edb('0xc')](_0x2edb('0xd'),_0x5dbf60,_0x2edb('0xe'));logger[_0x2edb('0xf')](_0x2edb('0x10'),_0x5dbf60,'request\x20sent',JSON['stringify'](_0x45a1ef));if(_0x45a1ef[_0x2edb('0x11')]){if(_0x45a1ef['error'][_0x2edb('0x12')]===0x1f4){logger[_0x2edb('0x11')](_0x2edb('0xd'),_0x5dbf60,_0x45a1ef[_0x2edb('0x11')][_0x2edb('0x13')]);return _0x3f2aea(_0x45a1ef[_0x2edb('0x11')]['message']);}logger['error'](_0x2edb('0xd'),_0x5dbf60,_0x45a1ef[_0x2edb('0x11')][_0x2edb('0x13')]);return _0x33092d(_0x45a1ef[_0x2edb('0x11')][_0x2edb('0x13')]);}else{logger['info'](_0x2edb('0xd'),_0x5dbf60,_0x2edb('0xe'));_0x33092d(_0x45a1ef[_0x2edb('0x14')]['message']);}})['catch'](function(_0x4e29d9){logger[_0x2edb('0x11')](_0x2edb('0xd'),_0x5dbf60,_0x4e29d9);_0x3f2aea(_0x4e29d9);});});}exports[_0x2edb('0x15')]=function(_0x3768f3){var _0x5d07a7=this;return new Promise(function(_0x7ff19e,_0x367a40){return db[_0x2edb('0x16')][_0x2edb('0x17')]({'raw':!![],'where':{'ContactId':_0x3768f3['body'][_0x2edb('0x18')],'ListId':_0x3768f3[_0x2edb('0x19')][_0x2edb('0x1a')],'VoiceQueueId':_0x3768f3[_0x2edb('0x19')][_0x2edb('0x1b')]===undefined?null:_0x3768f3[_0x2edb('0x19')][_0x2edb('0x1b')],'CampaignId':_0x3768f3[_0x2edb('0x19')][_0x2edb('0x1c')]===undefined?null:_0x3768f3['body'][_0x2edb('0x1c')]}})[_0x2edb('0xb')](function(_0x1408e8){if(_0x1408e8!=null){return db[_0x2edb('0x1d')][_0x2edb('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1408e8['id'],'OrderBy':{'$gt':_0x1408e8[_0x2edb('0x1e')]}},'order':[[_0x2edb('0x1e'),_0x2edb('0x1f')]]})['then'](function(_0x4c1cf3){var _0x571c9e=0x0;if(_0x4c1cf3){if(_0x4c1cf3[_0x2edb('0x20')]+_0x4c1cf3[_0x2edb('0x21')]+_0x4c1cf3[_0x2edb('0x22')]+_0x4c1cf3[_0x2edb('0x23')]+_0x4c1cf3[_0x2edb('0x24')]+_0x4c1cf3[_0x2edb('0x25')]+_0x4c1cf3[_0x2edb('0x26')]+_0x4c1cf3[_0x2edb('0x27')]<_0x3768f3[_0x2edb('0x28')][_0x2edb('0x29')])_0x571c9e=0x1;_0x7ff19e({'additional':_0x571c9e});}else{return db['CmHopperAdditionalPhone'][_0x2edb('0x17')]({'raw':!![],'where':{'CmHopperId':_0x1408e8['id']},'order':[[_0x2edb('0x1e'),_0x2edb('0x1f')]]})[_0x2edb('0xb')](function(_0x38a2bb){var _0x4946f5=0x0;if(_0x38a2bb){if(_0x38a2bb[_0x2edb('0x20')]+_0x38a2bb[_0x2edb('0x21')]+_0x38a2bb['countnoanswerretry']+_0x38a2bb[_0x2edb('0x23')]+_0x38a2bb[_0x2edb('0x24')]+_0x38a2bb[_0x2edb('0x25')]+_0x38a2bb[_0x2edb('0x26')]+_0x38a2bb[_0x2edb('0x27')]<_0x3768f3['entity'][_0x2edb('0x29')])_0x4946f5=0x1;_0x7ff19e({'additional':_0x4946f5});}else{_0x7ff19e({'additional':0x0});}})[_0x2edb('0x2a')](function(_0x165412){logger[_0x2edb('0x11')]('VerifyAdditionalPhones',_0x165412[_0x2edb('0x13')]);_0x367a40(_0x5d07a7[_0x2edb('0x11')](0x1f4,_0x165412['message']));});}})[_0x2edb('0x2a')](function(_0x317ca0){logger['error'](_0x2edb('0x15'),_0x317ca0[_0x2edb('0x13')]);_0x367a40(_0x5d07a7[_0x2edb('0x11')](0x1f4,_0x317ca0['message']));});}else _0x7ff19e({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x4f433d){var _0x28a746=this;return new Promise(function(_0x2f7984,_0x57c1e7){return db[_0x2edb('0x16')][_0x2edb('0x17')]({'raw':!![],'where':{'ContactId':_0x4f433d[_0x2edb('0x19')][_0x2edb('0x18')],'ListId':_0x4f433d['body'][_0x2edb('0x1a')],'VoiceQueueId':_0x4f433d['body']['VoiceQueueId']===undefined?null:_0x4f433d[_0x2edb('0x19')][_0x2edb('0x1b')],'CampaignId':_0x4f433d['body'][_0x2edb('0x1c')]===undefined?null:_0x4f433d[_0x2edb('0x19')][_0x2edb('0x1c')]}})[_0x2edb('0xb')](function(_0x24ad74){if(_0x24ad74!=null){return db[_0x2edb('0x1d')][_0x2edb('0x17')]({'raw':!![],'where':{'CmHopperId':_0x24ad74['id'],'OrderBy':{'$gte':_0x24ad74[_0x2edb('0x1e')]}},'order':[[_0x2edb('0x1e'),_0x2edb('0x1f')]]})[_0x2edb('0xb')](function(_0x174ec8){if(_0x174ec8)return activateAdditionalPhone(_0x24ad74,_0x4f433d[_0x2edb('0x19')],_0x174ec8,_0x4f433d[_0x2edb('0x2b')],_0x4f433d[_0x2edb('0x2c')])['then'](function(_0x41afbe){_0x2f7984(_0x41afbe);});else{return db[_0x2edb('0x1d')][_0x2edb('0x17')]({'raw':!![],'where':{'CmHopperId':_0x24ad74['id']},'order':[['OrderBy',_0x2edb('0x1f')]]})[_0x2edb('0xb')](function(_0x1618cb){if(_0x1618cb)return activateAdditionalPhone(_0x24ad74,_0x4f433d[_0x2edb('0x19')],_0x1618cb,_0x4f433d[_0x2edb('0x2b')],_0x4f433d[_0x2edb('0x2c')])['then'](function(_0x21cbc6){_0x2f7984(_0x21cbc6);});else{_0x2f7984({'id':_0x24ad74['id'],'phone':''});}})[_0x2edb('0x2a')](function(_0x26ef7c){logger['error']('VerifyAdditionalPhones',_0x26ef7c[_0x2edb('0x13')]);_0x57c1e7(_0x28a746['error'](0x1f4,_0x26ef7c['message']));});}})[_0x2edb('0x2a')](function(_0x8decd4){logger[_0x2edb('0x11')](_0x2edb('0x15'),_0x8decd4[_0x2edb('0x13')]);_0x57c1e7(_0x28a746[_0x2edb('0x11')](0x1f4,_0x8decd4['message']));});}else _0x2f7984(0x1);});});};function activateAdditionalPhone(_0x4532ad,_0x1ad6ef,_0x2dbd7f,_0x2638e0,_0x17f97d){return new Promise(function(_0x4ac573,_0x498f67){var _0xb27dd1;if(_['isNil'](_0x2dbd7f[_0x2edb('0x2d')])){_0x2dbd7f[_0x2edb('0x2d')]=moment();}if(moment()>moment(_0x2dbd7f[_0x2edb('0x2d')])){_0xb27dd1=moment()[_0x2edb('0x2e')](_0x17f97d||0x3,_0x2edb('0x2f'));}else{if(_0x2dbd7f[_0x2edb('0x1e')]==0x0){_0xb27dd1=moment(_0x2dbd7f[_0x2edb('0x2d')]);}else{_0xb27dd1=moment()[_0x2edb('0x2e')](_0x17f97d||0x3,_0x2edb('0x2f'));}}if(_['isNil'](_0xb27dd1)){_0xb27dd1=moment()[_0x2edb('0x2e')](_0x17f97d||0x3,_0x2edb('0x2f'));}var _0x5180c9={'phone':_0x4532ad[_0x2edb('0x30')],'active':0x0,'OrderBy':_[_0x2edb('0x31')](_0x4532ad['OrderBy'])?0x0:_0x4532ad[_0x2edb('0x1e')],'scheduledat':moment()['add'](_0x2638e0||0x1,_0x2edb('0x2f')),'countbusyretry':_0x1ad6ef['countbusyretry'],'countcongestionretry':_0x1ad6ef[_0x2edb('0x21')],'countnoanswerretry':_0x1ad6ef['countnoanswerretry'],'countnosuchnumberretry':_0x1ad6ef[_0x2edb('0x23')],'countdropretry':_0x1ad6ef['countdropretry'],'countabandonedretry':_0x1ad6ef[_0x2edb('0x25')],'countmachineretry':_0x1ad6ef[_0x2edb('0x26')],'countagentrejectretry':_0x1ad6ef[_0x2edb('0x27')],'createdAt':_0x1ad6ef[_0x2edb('0x32')],'updatedAt':_0x1ad6ef[_0x2edb('0x33')]};var _0x58969d={'CmHopperId':_0x4532ad['id'],'phone':_0x2dbd7f['phone'],'active':0x0,'OrderBy':_[_0x2edb('0x31')](_0x2dbd7f['OrderBy'])?0x0:_0x2dbd7f[_0x2edb('0x1e')],'scheduledat':_0xb27dd1,'countbusyretry':_0x2dbd7f['countbusyretry'],'countcongestionretry':_0x2dbd7f['countcongestionretry'],'countnoanswerretry':_0x2dbd7f[_0x2edb('0x22')],'countnosuchnumberretry':_0x2dbd7f[_0x2edb('0x23')],'countdropretry':_0x2dbd7f['countdropretry'],'countabandonedretry':_0x2dbd7f[_0x2edb('0x25')],'countmachineretry':_0x2dbd7f[_0x2edb('0x26')],'countagentrejectretry':_0x2dbd7f['countagentrejectretry'],'createdAt':_0x2dbd7f[_0x2edb('0x32')],'updatedAt':_0x2dbd7f[_0x2edb('0x33')]};return db[_0x2edb('0x34')]['transaction'](function(_0x38c54e){return db[_0x2edb('0x1d')][_0x2edb('0x35')](_0x5180c9,{'where':{'id':_0x2dbd7f['id']}},{'transaction':_0x38c54e})[_0x2edb('0xb')](function(){return db['CmHopper']['update'](_0x58969d,{'where':{'id':_0x4532ad['id']}},{'transaction':_0x38c54e});});})['then'](function(_0x57a8f1){_0x4ac573({'id':_0x4532ad['id'],'phone':_0x2dbd7f[_0x2edb('0x30')]});})[_0x2edb('0x2a')](function(_0x3f1732){logger[_0x2edb('0x11')](_0x2edb('0x36'),_0x3f1732[_0x2edb('0x13')]);_0x498f67({'error':_0x3f1732[_0x2edb('0x13')]});});});}exports['IncrementPreviewCounters']=function(_0xffd427){var _0x25e781=this;return new Promise(function(_0x35f160,_0x190283){return db[_0x2edb('0x16')][_0x2edb('0x35')](_0xffd427[_0x2edb('0x19')][_0x2edb('0x37')],{'where':{'id':_0xffd427[_0x2edb('0x19')]['id']}})[_0x2edb('0xb')](function(_0x30631b){_0x35f160(_0x30631b);})[_0x2edb('0x2a')](function(_0x205261){logger['error'](_0x2edb('0x38'),_0x205261[_0x2edb('0x13')]);_0x190283(_0x25e781[_0x2edb('0x11')](0x1f4,_0x205261[_0x2edb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 248ad5e..92de311 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 _0xb62e=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get','show','post','/:id','update','delete','destroy','exports','multer','util'];(function(_0x2766b6,_0xca339e){var _0x24bde8=function(_0x3dc9d8){while(--_0x3dc9d8){_0x2766b6['push'](_0x2766b6['shift']());}};_0x24bde8(++_0xca339e);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/:id',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xe')]('/',auth[_0xeb62('0xa')](),controller['create']);router['put'](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0x11')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);module[_0xeb62('0x13')]=router; \ No newline at end of file +var _0xe98f=['Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','get','index','/:id','isAuthenticated','show','create','update','delete','exports','multer','path','express'];(function(_0x20aae1,_0x51efd4){var _0x510601=function(_0x20895f){while(--_0x20895f){_0x20aae1['push'](_0x20aae1['shift']());}};_0x510601(++_0x51efd4);}(_0xe98f,0xde));var _0xfe98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe98f[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xfe98('0x0'));var util=require('util');var path=require(_0xfe98('0x1'));var timeout=require('connect-timeout');var express=require(_0xfe98('0x2'));var router=express[_0xfe98('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xfe98('0x4'));var config=require('../../config/environment');var controller=require(_0xfe98('0x5'));router[_0xfe98('0x6')]('/',auth['isAuthenticated'](),controller[_0xfe98('0x7')]);router['get'](_0xfe98('0x8'),auth[_0xfe98('0x9')](),controller[_0xfe98('0xa')]);router['post']('/',auth[_0xfe98('0x9')](),controller[_0xfe98('0xb')]);router['put'](_0xfe98('0x8'),auth[_0xfe98('0x9')](),controller[_0xfe98('0xc')]);router[_0xfe98('0xd')](_0xfe98('0x8'),auth[_0xfe98('0x9')](),controller['destroy']);module[_0xfe98('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 668b8c4..ceb1cc9 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 _0x1c9a=['STRING','INTEGER','contactListQueue','moment','sequelize'];(function(_0x3af5a5,_0x361da7){var _0x24cbc1=function(_0x399d67){while(--_0x399d67){_0x3af5a5['push'](_0x3af5a5['shift']());}};_0x24cbc1(++_0x361da7);}(_0x1c9a,0x1a7));var _0xa1c9=function(_0x21ae3f,_0x5d7234){_0x21ae3f=_0x21ae3f-0x0;var _0x447e03=_0x1c9a[_0x21ae3f];return _0x447e03;};'use strict';var moment=require(_0xa1c9('0x0'));var Sequelize=require(_0xa1c9('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa1c9('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xa1c9('0x3')],'unique':_0xa1c9('0x4')},'ListId':{'type':Sequelize[_0xa1c9('0x3')],'unique':_0xa1c9('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa1c9('0x4')}}; \ No newline at end of file +var _0xb9f9=['STRING','INTEGER','contactListQueue'];(function(_0x1c1be5,_0x459a7a){var _0x439421=function(_0x866179){while(--_0x866179){_0x1c1be5['push'](_0x1c1be5['shift']());}};_0x439421(++_0x459a7a);}(_0xb9f9,0x12c));var _0x9b9f=function(_0x5670cb,_0xe6e20d){_0x5670cb=_0x5670cb-0x0;var _0x11dc29=_0xb9f9[_0x5670cb];return _0x11dc29;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x9b9f('0x0')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x9b9f('0x1')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x9b9f('0x1')],'unique':_0x9b9f('0x2')},'VoiceQueueId':{'type':Sequelize[_0x9b9f('0x1')],'unique':_0x9b9f('0x2')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index beb36c2..9d29dc0 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 _0x4bb2=['Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','CmHopperBlack','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','update','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set'];(function(_0xbca081,_0x30dcfa){var _0x10f563=function(_0xf98062){while(--_0xf98062){_0xbca081['push'](_0xbca081['shift']());}};_0x10f563(++_0x30dcfa);}(_0x4bb2,0x11c));var _0x24bb=function(_0x4eaa52,_0x492a49){_0x4eaa52=_0x4eaa52-0x0;var _0x8b3438=_0x4bb2[_0x4eaa52];return _0x8b3438;};'use strict';var emlformat=require(_0x24bb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x24bb('0x1'));var jsonpatch=require(_0x24bb('0x2'));var rp=require(_0x24bb('0x3'));var moment=require('moment');var BPromise=require(_0x24bb('0x4'));var Mustache=require(_0x24bb('0x5'));var util=require('util');var path=require(_0x24bb('0x6'));var sox=require(_0x24bb('0x7'));var csv=require(_0x24bb('0x8'));var ejs=require(_0x24bb('0x9'));var fs=require('fs');var fs_extra=require(_0x24bb('0xa'));var _=require(_0x24bb('0xb'));var squel=require(_0x24bb('0xc'));var crypto=require(_0x24bb('0xd'));var jsforce=require(_0x24bb('0xe'));var deskjs=require(_0x24bb('0xf'));var toCsv=require(_0x24bb('0x8'));var querystring=require(_0x24bb('0x10'));var Papa=require(_0x24bb('0x11'));var Redis=require(_0x24bb('0x12'));var authService=require(_0x24bb('0x13'));var qs=require(_0x24bb('0x14'));var as=require(_0x24bb('0x15'));var hardwareService=require(_0x24bb('0x16'));var logger=require(_0x24bb('0x17'))(_0x24bb('0x18'));var utils=require(_0x24bb('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x24bb('0x1a'));var db=require(_0x24bb('0x1b'))['db'];function respondWithStatusCode(_0x24b7d1,_0xd1a04d){_0xd1a04d=_0xd1a04d||0xcc;return function(_0x4ab274){if(_0x4ab274){return _0x24b7d1[_0x24bb('0x1c')](_0xd1a04d);}return _0x24b7d1[_0x24bb('0x1d')](_0xd1a04d)['end']();};}function respondWithResult(_0x11b082,_0x51832b){_0x51832b=_0x51832b||0xc8;return function(_0x15f4e6){if(_0x15f4e6){return _0x11b082[_0x24bb('0x1d')](_0x51832b)[_0x24bb('0x1e')](_0x15f4e6);}};}function respondWithFilteredResult(_0x50b4d9,_0x37e14f){return function(_0x43e637){if(_0x43e637){var _0x50b058=typeof _0x37e14f['offset']===_0x24bb('0x1f')&&typeof _0x37e14f[_0x24bb('0x20')]==='undefined';var _0x29a24c=_0x43e637[_0x24bb('0x21')];var _0x5e07a3=_0x50b058?0x0:_0x37e14f[_0x24bb('0x22')];var _0x1a5eae=_0x50b058?_0x43e637[_0x24bb('0x21')]:_0x37e14f['offset']+_0x37e14f[_0x24bb('0x20')];var _0x348cac;if(_0x1a5eae>=_0x29a24c){_0x1a5eae=_0x29a24c;_0x348cac=0xc8;}else{_0x348cac=0xce;}_0x50b4d9[_0x24bb('0x1d')](_0x348cac);return _0x50b4d9[_0x24bb('0x23')](_0x24bb('0x24'),_0x5e07a3+'-'+_0x1a5eae+'/'+_0x29a24c)[_0x24bb('0x1e')](_0x43e637);}return null;};}function patchUpdates(_0x358076){return function(_0x2c94a2){try{jsonpatch[_0x24bb('0x25')](_0x2c94a2,_0x358076,!![]);}catch(_0x17ddf0){return BPromise[_0x24bb('0x26')](_0x17ddf0);}return _0x2c94a2[_0x24bb('0x27')]();};}function saveUpdates(_0xc14ec9,_0x1e6143){return function(_0x37ea33){if(_0x37ea33){return _0x37ea33['update'](_0xc14ec9)[_0x24bb('0x28')](function(_0x1db765){return _0x1db765;});}return null;};}function removeEntity(_0x5f38eb,_0x1bce9f){return function(_0x4ba330){if(_0x4ba330){return _0x4ba330[_0x24bb('0x29')]()[_0x24bb('0x28')](function(){_0x5f38eb[_0x24bb('0x1d')](0xcc)[_0x24bb('0x2a')]();});}};}function handleEntityNotFound(_0xfb4968,_0x426b7c){return function(_0x34f296){if(!_0x34f296){_0xfb4968[_0x24bb('0x1c')](0x194);}return _0x34f296;};}function handleError(_0x2d6819,_0x3c7809){_0x3c7809=_0x3c7809||0x1f4;return function(_0x28c62e){logger['error'](_0x28c62e[_0x24bb('0x2b')]);if(_0x28c62e[_0x24bb('0x2c')]){delete _0x28c62e['name'];}_0x2d6819[_0x24bb('0x1d')](_0x3c7809)[_0x24bb('0x2d')](_0x28c62e);};}exports[_0x24bb('0x2e')]=function(_0x8f54fc,_0x49ce71){var _0x1c0e52={},_0x3d59c3={},_0x3ba2cc={'count':0x0,'rows':[]};var _0x28a2ad=_['map'](db[_0x24bb('0x2f')]['rawAttributes'],function(_0x19b542){return{'name':_0x19b542[_0x24bb('0x30')],'type':_0x19b542[_0x24bb('0x31')]['key']};});_0x3d59c3['model']=_[_0x24bb('0x32')](_0x28a2ad,_0x24bb('0x2c'));_0x3d59c3[_0x24bb('0x33')]=_[_0x24bb('0x34')](_0x8f54fc[_0x24bb('0x33')]);_0x3d59c3[_0x24bb('0x35')]=_[_0x24bb('0x36')](_0x3d59c3[_0x24bb('0x37')],_0x3d59c3[_0x24bb('0x33')]);_0x1c0e52[_0x24bb('0x38')]=_[_0x24bb('0x36')](_0x3d59c3[_0x24bb('0x37')],qs['fields'](_0x8f54fc[_0x24bb('0x33')][_0x24bb('0x39')]));_0x1c0e52['attributes']=_0x1c0e52[_0x24bb('0x38')][_0x24bb('0x3a')]?_0x1c0e52[_0x24bb('0x38')]:_0x3d59c3[_0x24bb('0x37')];if(!_0x8f54fc[_0x24bb('0x33')]['hasOwnProperty'](_0x24bb('0x3b'))){_0x1c0e52[_0x24bb('0x20')]=qs['limit'](_0x8f54fc[_0x24bb('0x33')][_0x24bb('0x20')]);_0x1c0e52[_0x24bb('0x22')]=qs[_0x24bb('0x22')](_0x8f54fc['query'][_0x24bb('0x22')]);}_0x1c0e52[_0x24bb('0x3c')]=qs[_0x24bb('0x3d')](_0x8f54fc['query'][_0x24bb('0x3d')]);_0x1c0e52[_0x24bb('0x3e')]=qs[_0x24bb('0x35')](_[_0x24bb('0x3f')](_0x8f54fc[_0x24bb('0x33')],_0x3d59c3[_0x24bb('0x35')]),_0x28a2ad);if(_0x8f54fc[_0x24bb('0x33')]['filter']){_0x1c0e52['where']=_[_0x24bb('0x40')](_0x1c0e52[_0x24bb('0x3e')],{'$or':_['map'](_0x28a2ad,function(_0x30818a){if(_0x30818a['type']!==_0x24bb('0x41')){var _0x8935aa={};_0x8935aa[_0x30818a[_0x24bb('0x2c')]]={'$like':'%'+_0x8f54fc['query'][_0x24bb('0x42')]+'%'};return _0x8935aa;}})});}_0x1c0e52=_[_0x24bb('0x40')]({},_0x1c0e52,_0x8f54fc[_0x24bb('0x43')]);var _0x7e5805={'where':_0x1c0e52[_0x24bb('0x3e')]};return db[_0x24bb('0x2f')]['count'](_0x7e5805)[_0x24bb('0x28')](function(_0xa985e){_0x3ba2cc[_0x24bb('0x21')]=_0xa985e;if(_0x8f54fc['query'][_0x24bb('0x44')]){_0x1c0e52[_0x24bb('0x45')]=[{'all':!![]}];}return db[_0x24bb('0x2f')][_0x24bb('0x46')](_0x1c0e52);})['then'](function(_0x5980f5){_0x3ba2cc[_0x24bb('0x47')]=_0x5980f5;return _0x3ba2cc;})[_0x24bb('0x28')](respondWithFilteredResult(_0x49ce71,_0x1c0e52))[_0x24bb('0x48')](handleError(_0x49ce71,null));};exports[_0x24bb('0x49')]=function(_0x2f9536,_0x3fda01){var _0x38255c={'raw':!![],'where':{'id':_0x2f9536['params']['id']}},_0x3e88d7={};_0x3e88d7[_0x24bb('0x37')]=_[_0x24bb('0x34')](db[_0x24bb('0x2f')][_0x24bb('0x4a')]);_0x3e88d7[_0x24bb('0x33')]=_[_0x24bb('0x34')](_0x2f9536['query']);_0x3e88d7['filters']=_[_0x24bb('0x36')](_0x3e88d7[_0x24bb('0x37')],_0x3e88d7[_0x24bb('0x33')]);_0x38255c[_0x24bb('0x38')]=_[_0x24bb('0x36')](_0x3e88d7[_0x24bb('0x37')],qs[_0x24bb('0x39')](_0x2f9536[_0x24bb('0x33')][_0x24bb('0x39')]));_0x38255c[_0x24bb('0x38')]=_0x38255c[_0x24bb('0x38')][_0x24bb('0x3a')]?_0x38255c[_0x24bb('0x38')]:_0x3e88d7[_0x24bb('0x37')];if(_0x2f9536[_0x24bb('0x33')][_0x24bb('0x44')]){_0x38255c['include']=[{'all':!![]}];}_0x38255c=_['merge']({},_0x38255c,_0x2f9536[_0x24bb('0x43')]);return db['CmHopperBlack'][_0x24bb('0x4b')](_0x38255c)[_0x24bb('0x28')](handleEntityNotFound(_0x3fda01,null))[_0x24bb('0x28')](respondWithResult(_0x3fda01,null))['catch'](handleError(_0x3fda01,null));};exports[_0x24bb('0x4c')]=function(_0x1595ce,_0x5f31bc){if(_0x1595ce[_0x24bb('0x4d')]['id']){delete _0x1595ce[_0x24bb('0x4d')]['id'];}return db['CmHopperBlack']['find']({'where':{'id':_0x1595ce[_0x24bb('0x4e')]['id']}})['then'](handleEntityNotFound(_0x5f31bc,null))['then'](saveUpdates(_0x1595ce[_0x24bb('0x4d')],null))[_0x24bb('0x28')](respondWithResult(_0x5f31bc,null))[_0x24bb('0x48')](handleError(_0x5f31bc,null));};exports[_0x24bb('0x29')]=function(_0x416a13,_0x526707){return db[_0x24bb('0x2f')]['find']({'where':{'id':_0x416a13[_0x24bb('0x4e')]['id']}})[_0x24bb('0x28')](handleEntityNotFound(_0x526707,null))[_0x24bb('0x28')](removeEntity(_0x526707,null))[_0x24bb('0x48')](handleError(_0x526707,null));};exports[_0x24bb('0x4f')]=function(_0x48aa36,_0x33c900){return db[_0x24bb('0x2f')][_0x24bb('0x4f')]()[_0x24bb('0x28')](respondWithResult(_0x33c900,null))[_0x24bb('0x48')](handleError(_0x33c900,null));}; \ No newline at end of file +var _0xaf2c=['sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','order','sort','pick','filter','where','merge','VIRTUAL','CmHopperBlack','includeAll','include','findAll','rows','show','params','options','catch','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5db352,_0x2b5af4){var _0x3d6b64=function(_0x4de550){while(--_0x4de550){_0x5db352['push'](_0x5db352['shift']());}};_0x3d6b64(++_0x2b5af4);}(_0xaf2c,0x165));var _0xcaf2=function(_0x4628b3,_0x274a0b){_0x4628b3=_0x4628b3-0x0;var _0x3905f0=_0xaf2c[_0x4628b3];return _0x3905f0;};'use strict';var emlformat=require(_0xcaf2('0x0'));var rimraf=require(_0xcaf2('0x1'));var zipdir=require(_0xcaf2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf2('0x3'));var moment=require(_0xcaf2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcaf2('0x5'));var util=require('util');var path=require(_0xcaf2('0x6'));var sox=require(_0xcaf2('0x7'));var csv=require('to-csv');var ejs=require(_0xcaf2('0x8'));var fs=require('fs');var fs_extra=require(_0xcaf2('0x9'));var _=require('lodash');var squel=require(_0xcaf2('0xa'));var crypto=require(_0xcaf2('0xb'));var jsforce=require(_0xcaf2('0xc'));var deskjs=require(_0xcaf2('0xd'));var toCsv=require(_0xcaf2('0xe'));var querystring=require('querystring');var Papa=require(_0xcaf2('0xf'));var Redis=require(_0xcaf2('0x10'));var authService=require(_0xcaf2('0x11'));var qs=require(_0xcaf2('0x12'));var as=require(_0xcaf2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xcaf2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcaf2('0x15'));var db=require(_0xcaf2('0x16'))['db'];function respondWithStatusCode(_0x355f12,_0x1084de){_0x1084de=_0x1084de||0xcc;return function(_0x1d0d1e){if(_0x1d0d1e){return _0x355f12[_0xcaf2('0x17')](_0x1084de);}return _0x355f12[_0xcaf2('0x18')](_0x1084de)['end']();};}function respondWithResult(_0x2fc464,_0x4732cc){_0x4732cc=_0x4732cc||0xc8;return function(_0x574edc){if(_0x574edc){return _0x2fc464[_0xcaf2('0x18')](_0x4732cc)[_0xcaf2('0x19')](_0x574edc);}};}function respondWithFilteredResult(_0x58578a,_0x33c7f2){return function(_0x4d70b8){if(_0x4d70b8){var _0x416709=typeof _0x33c7f2['offset']===_0xcaf2('0x1a')&&typeof _0x33c7f2[_0xcaf2('0x1b')]===_0xcaf2('0x1a');var _0x4a8240=_0x4d70b8[_0xcaf2('0x1c')];var _0x139b2f=_0x416709?0x0:_0x33c7f2[_0xcaf2('0x1d')];var _0x1831ce=_0x416709?_0x4d70b8[_0xcaf2('0x1c')]:_0x33c7f2['offset']+_0x33c7f2[_0xcaf2('0x1b')];var _0x259796;if(_0x1831ce>=_0x4a8240){_0x1831ce=_0x4a8240;_0x259796=0xc8;}else{_0x259796=0xce;}_0x58578a[_0xcaf2('0x18')](_0x259796);return _0x58578a[_0xcaf2('0x1e')](_0xcaf2('0x1f'),_0x139b2f+'-'+_0x1831ce+'/'+_0x4a8240)[_0xcaf2('0x19')](_0x4d70b8);}return null;};}function patchUpdates(_0x2fdb37){return function(_0xd95987){try{jsonpatch[_0xcaf2('0x20')](_0xd95987,_0x2fdb37,!![]);}catch(_0x3d12a1){return BPromise[_0xcaf2('0x21')](_0x3d12a1);}return _0xd95987[_0xcaf2('0x22')]();};}function saveUpdates(_0x463f14,_0xe87a30){return function(_0x2c4365){if(_0x2c4365){return _0x2c4365[_0xcaf2('0x23')](_0x463f14)[_0xcaf2('0x24')](function(_0x55b004){return _0x55b004;});}return null;};}function removeEntity(_0x3fb944,_0x327a6e){return function(_0x8fd088){if(_0x8fd088){return _0x8fd088[_0xcaf2('0x25')]()[_0xcaf2('0x24')](function(){_0x3fb944[_0xcaf2('0x18')](0xcc)[_0xcaf2('0x26')]();});}};}function handleEntityNotFound(_0x28d88a,_0x51fdb9){return function(_0xe28895){if(!_0xe28895){_0x28d88a['sendStatus'](0x194);}return _0xe28895;};}function handleError(_0x506c3d,_0x528961){_0x528961=_0x528961||0x1f4;return function(_0xcd7476){logger[_0xcaf2('0x27')](_0xcd7476[_0xcaf2('0x28')]);if(_0xcd7476[_0xcaf2('0x29')]){delete _0xcd7476[_0xcaf2('0x29')];}_0x506c3d['status'](_0x528961)[_0xcaf2('0x2a')](_0xcd7476);};}exports[_0xcaf2('0x2b')]=function(_0x2e7812,_0xfad19){var _0x3a2014={},_0x52f8b0={},_0x16ddee={'count':0x0,'rows':[]};var _0x1334b8=_['map'](db['CmHopperBlack'][_0xcaf2('0x2c')],function(_0x4f27b5){return{'name':_0x4f27b5[_0xcaf2('0x2d')],'type':_0x4f27b5[_0xcaf2('0x2e')][_0xcaf2('0x2f')]};});_0x52f8b0[_0xcaf2('0x30')]=_[_0xcaf2('0x31')](_0x1334b8,'name');_0x52f8b0[_0xcaf2('0x32')]=_[_0xcaf2('0x33')](_0x2e7812[_0xcaf2('0x32')]);_0x52f8b0[_0xcaf2('0x34')]=_[_0xcaf2('0x35')](_0x52f8b0[_0xcaf2('0x30')],_0x52f8b0[_0xcaf2('0x32')]);_0x3a2014['attributes']=_[_0xcaf2('0x35')](_0x52f8b0[_0xcaf2('0x30')],qs[_0xcaf2('0x36')](_0x2e7812[_0xcaf2('0x32')][_0xcaf2('0x36')]));_0x3a2014[_0xcaf2('0x37')]=_0x3a2014[_0xcaf2('0x37')][_0xcaf2('0x38')]?_0x3a2014[_0xcaf2('0x37')]:_0x52f8b0['model'];if(!_0x2e7812[_0xcaf2('0x32')]['hasOwnProperty']('nolimit')){_0x3a2014['limit']=qs[_0xcaf2('0x1b')](_0x2e7812['query'][_0xcaf2('0x1b')]);_0x3a2014[_0xcaf2('0x1d')]=qs[_0xcaf2('0x1d')](_0x2e7812[_0xcaf2('0x32')][_0xcaf2('0x1d')]);}_0x3a2014[_0xcaf2('0x39')]=qs['sort'](_0x2e7812[_0xcaf2('0x32')][_0xcaf2('0x3a')]);_0x3a2014['where']=qs[_0xcaf2('0x34')](_[_0xcaf2('0x3b')](_0x2e7812[_0xcaf2('0x32')],_0x52f8b0[_0xcaf2('0x34')]),_0x1334b8);if(_0x2e7812[_0xcaf2('0x32')][_0xcaf2('0x3c')]){_0x3a2014[_0xcaf2('0x3d')]=_[_0xcaf2('0x3e')](_0x3a2014['where'],{'$or':_[_0xcaf2('0x31')](_0x1334b8,function(_0x5ab54c){if(_0x5ab54c[_0xcaf2('0x2e')]!==_0xcaf2('0x3f')){var _0x5655df={};_0x5655df[_0x5ab54c[_0xcaf2('0x29')]]={'$like':'%'+_0x2e7812[_0xcaf2('0x32')][_0xcaf2('0x3c')]+'%'};return _0x5655df;}})});}_0x3a2014=_[_0xcaf2('0x3e')]({},_0x3a2014,_0x2e7812['options']);var _0x313935={'where':_0x3a2014['where']};return db[_0xcaf2('0x40')]['count'](_0x313935)[_0xcaf2('0x24')](function(_0x18f08a){_0x16ddee[_0xcaf2('0x1c')]=_0x18f08a;if(_0x2e7812['query'][_0xcaf2('0x41')]){_0x3a2014[_0xcaf2('0x42')]=[{'all':!![]}];}return db[_0xcaf2('0x40')][_0xcaf2('0x43')](_0x3a2014);})[_0xcaf2('0x24')](function(_0x3e4667){_0x16ddee[_0xcaf2('0x44')]=_0x3e4667;return _0x16ddee;})[_0xcaf2('0x24')](respondWithFilteredResult(_0xfad19,_0x3a2014))['catch'](handleError(_0xfad19,null));};exports[_0xcaf2('0x45')]=function(_0x50f078,_0x3257a4){var _0x4dc098={'raw':!![],'where':{'id':_0x50f078[_0xcaf2('0x46')]['id']}},_0x293bc8={};_0x293bc8[_0xcaf2('0x30')]=_[_0xcaf2('0x33')](db[_0xcaf2('0x40')][_0xcaf2('0x2c')]);_0x293bc8[_0xcaf2('0x32')]=_['keys'](_0x50f078['query']);_0x293bc8[_0xcaf2('0x34')]=_[_0xcaf2('0x35')](_0x293bc8[_0xcaf2('0x30')],_0x293bc8[_0xcaf2('0x32')]);_0x4dc098[_0xcaf2('0x37')]=_[_0xcaf2('0x35')](_0x293bc8['model'],qs[_0xcaf2('0x36')](_0x50f078[_0xcaf2('0x32')][_0xcaf2('0x36')]));_0x4dc098[_0xcaf2('0x37')]=_0x4dc098[_0xcaf2('0x37')]['length']?_0x4dc098[_0xcaf2('0x37')]:_0x293bc8[_0xcaf2('0x30')];if(_0x50f078[_0xcaf2('0x32')][_0xcaf2('0x41')]){_0x4dc098[_0xcaf2('0x42')]=[{'all':!![]}];}_0x4dc098=_[_0xcaf2('0x3e')]({},_0x4dc098,_0x50f078[_0xcaf2('0x47')]);return db['CmHopperBlack']['find'](_0x4dc098)[_0xcaf2('0x24')](handleEntityNotFound(_0x3257a4,null))[_0xcaf2('0x24')](respondWithResult(_0x3257a4,null))[_0xcaf2('0x48')](handleError(_0x3257a4,null));};exports[_0xcaf2('0x23')]=function(_0x5943bd,_0x14be17){if(_0x5943bd[_0xcaf2('0x49')]['id']){delete _0x5943bd[_0xcaf2('0x49')]['id'];}return db[_0xcaf2('0x40')][_0xcaf2('0x4a')]({'where':{'id':_0x5943bd[_0xcaf2('0x46')]['id']}})[_0xcaf2('0x24')](handleEntityNotFound(_0x14be17,null))[_0xcaf2('0x24')](saveUpdates(_0x5943bd['body'],null))['then'](respondWithResult(_0x14be17,null))[_0xcaf2('0x48')](handleError(_0x14be17,null));};exports['destroy']=function(_0x5b2dd6,_0x190599){return db['CmHopperBlack'][_0xcaf2('0x4a')]({'where':{'id':_0x5b2dd6[_0xcaf2('0x46')]['id']}})['then'](handleEntityNotFound(_0x190599,null))['then'](removeEntity(_0x190599,null))['catch'](handleError(_0x190599,null));};exports[_0xcaf2('0x4b')]=function(_0x2b2a38,_0x217023){return db[_0xcaf2('0x40')][_0xcaf2('0x4b')]()[_0xcaf2('0x24')](respondWithResult(_0x217023,null))['catch'](handleError(_0x217023,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 846d6f7..bef504d 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 _0x926f=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','api','moment'];(function(_0x3792e6,_0x32bd91){var _0x441e44=function(_0x357478){while(--_0x357478){_0x3792e6['push'](_0x3792e6['shift']());}};_0x441e44(++_0x32bd91);}(_0x926f,0x168));var _0xf926=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x926f[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xf926('0x0'));var util=require(_0xf926('0x1'));var logger=require('../../config/logger')(_0xf926('0x2'));var moment=require(_0xf926('0x3'));var BPromise=require(_0xf926('0x4'));var rp=require(_0xf926('0x5'));var fs=require('fs');var path=require(_0xf926('0x6'));var rimraf=require(_0xf926('0x7'));var config=require(_0xf926('0x8'));var attributes=require(_0xf926('0x9'));module[_0xf926('0xa')]=function(_0x3f1500,_0x202adc){return _0x3f1500[_0xf926('0xb')]('CmHopperBlack',attributes,{'tableName':_0xf926('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xab02=['request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','../../config/logger','bluebird'];(function(_0x17afe4,_0x1b0bbd){var _0x3cdcf3=function(_0x171719){while(--_0x171719){_0x17afe4['push'](_0x17afe4['shift']());}};_0x3cdcf3(++_0x1b0bbd);}(_0xab02,0xf9));var _0x2ab0=function(_0x12fa21,_0x43c5b0){_0x12fa21=_0x12fa21-0x0;var _0x37a32d=_0xab02[_0x12fa21];return _0x37a32d;};'use strict';var _=require(_0x2ab0('0x0'));var util=require(_0x2ab0('0x1'));var logger=require(_0x2ab0('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2ab0('0x3'));var rp=require(_0x2ab0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ab0('0x5'));var config=require(_0x2ab0('0x6'));var attributes=require(_0x2ab0('0x7'));module[_0x2ab0('0x8')]=function(_0x471441,_0x81513e){return _0x471441[_0x2ab0('0x9')]('CmHopperBlack',attributes,{'tableName':_0x2ab0('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 705c1f4..d4e401d 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 _0x595e=['stringify','UpdateCmHopperBlack','update','body','raw','DestroyCmHopperBlack','lodash','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','GetCmHopperBlack','CmHopperBlack','options','where','attributes','limit','include','map','model'];(function(_0x4f3d05,_0x54bb67){var _0x2b8439=function(_0x24276c){while(--_0x24276c){_0x4f3d05['push'](_0x4f3d05['shift']());}};_0x2b8439(++_0x54bb67);}(_0x595e,0x192));var _0xe595=function(_0x2178c4,_0x3b38c0){_0x2178c4=_0x2178c4-0x0;var _0x3d9dd2=_0x595e[_0x2178c4];return _0x3d9dd2;};'use strict';var _=require(_0xe595('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe595('0x1'));var rs=require(_0xe595('0x2'));var fs=require('fs');var Redis=require(_0xe595('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xe595('0x4'));var jayson=require(_0xe595('0x5'));var client=jayson[_0xe595('0x6')][_0xe595('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c3136,_0x19dd59,_0x13f3e0){return new BPromise(function(_0x44ad59,_0x10ce89){return client[_0xe595('0x8')](_0x1c3136,_0x13f3e0)[_0xe595('0x9')](function(_0x204c55){logger[_0xe595('0xa')](_0xe595('0xb'),_0x19dd59,_0xe595('0xc'));logger[_0xe595('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x19dd59,'request\x20sent',JSON['stringify'](_0x204c55));if(_0x204c55['error']){if(_0x204c55[_0xe595('0xe')][_0xe595('0xf')]===0x1f4){logger[_0xe595('0xe')](_0xe595('0xb'),_0x19dd59,_0x204c55['error']['message']);return _0x10ce89(_0x204c55[_0xe595('0xe')][_0xe595('0x10')]);}logger[_0xe595('0xe')](_0xe595('0xb'),_0x19dd59,_0x204c55[_0xe595('0xe')][_0xe595('0x10')]);return _0x44ad59(_0x204c55['error'][_0xe595('0x10')]);}else{logger[_0xe595('0xa')]('CmHopperBlack,\x20%s,\x20%s',_0x19dd59,'request\x20sent');_0x44ad59(_0x204c55['result']['message']);}})[_0xe595('0x11')](function(_0x494751){logger[_0xe595('0xe')](_0xe595('0xb'),_0x19dd59,_0x494751);_0x10ce89(_0x494751);});});}exports[_0xe595('0x12')]=function(_0x1d63b7){var _0xc0c31c=this;return new Promise(function(_0x544d2b,_0x34790e){return db[_0xe595('0x13')]['findAll']({'raw':_0x1d63b7['options']?_0x1d63b7[_0xe595('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x1d63b7[_0xe595('0x14')]?_0x1d63b7[_0xe595('0x14')][_0xe595('0x15')]||null:null,'attributes':_0x1d63b7[_0xe595('0x14')]?_0x1d63b7[_0xe595('0x14')][_0xe595('0x16')]||null:null,'limit':_0x1d63b7['options']?_0x1d63b7[_0xe595('0x14')][_0xe595('0x17')]||null:null,'include':_0x1d63b7[_0xe595('0x14')]?_0x1d63b7['options'][_0xe595('0x18')]?_[_0xe595('0x19')](_0x1d63b7['options'][_0xe595('0x18')],function(_0x4562b5){return{'model':db[_0x4562b5[_0xe595('0x1a')]],'as':_0x4562b5['as'],'attributes':_0x4562b5[_0xe595('0x16')],'include':_0x4562b5[_0xe595('0x18')]?_[_0xe595('0x19')](_0x4562b5[_0xe595('0x18')],function(_0x16fddf){return{'model':db[_0x16fddf[_0xe595('0x1a')]],'as':_0x16fddf['as'],'attributes':_0x16fddf['attributes'],'include':_0x16fddf[_0xe595('0x18')]?_[_0xe595('0x19')](_0x16fddf[_0xe595('0x18')],function(_0x3bca4f){return{'model':db[_0x3bca4f[_0xe595('0x1a')]],'as':_0x3bca4f['as'],'attributes':_0x3bca4f[_0xe595('0x16')]};}):[]};}):[]};}):[]:[]})[_0xe595('0x9')](function(_0x23293a){logger[_0xe595('0xa')](_0xe595('0x12'),_0x1d63b7);logger['debug'](_0xe595('0x12'),_0x1d63b7,JSON[_0xe595('0x1b')](_0x23293a));_0x544d2b(_0x23293a);})[_0xe595('0x11')](function(_0x43bdfe){logger[_0xe595('0xe')](_0xe595('0x12'),_0x43bdfe[_0xe595('0x10')],_0x1d63b7);_0x34790e(_0xc0c31c[_0xe595('0xe')](0x1f4,_0x43bdfe[_0xe595('0x10')]));});});};exports[_0xe595('0x1c')]=function(_0x1eea9a){var _0x11550a=this;return new Promise(function(_0x4807ee,_0x40666e){return db[_0xe595('0x13')][_0xe595('0x1d')](_0x1eea9a[_0xe595('0x1e')],{'raw':_0x1eea9a[_0xe595('0x14')]?_0x1eea9a[_0xe595('0x14')][_0xe595('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eea9a['options']?_0x1eea9a[_0xe595('0x14')]['where']||null:null,'attributes':_0x1eea9a[_0xe595('0x14')]?_0x1eea9a[_0xe595('0x14')]['attributes']||null:null,'limit':_0x1eea9a['options']?_0x1eea9a[_0xe595('0x14')][_0xe595('0x17')]||null:null})[_0xe595('0x9')](function(_0x3e0b32){logger[_0xe595('0xa')]('UpdateCmHopperBlack',_0x1eea9a);logger['debug']('UpdateCmHopperBlack',_0x1eea9a,JSON['stringify'](_0x3e0b32));_0x4807ee(_0x3e0b32);})[_0xe595('0x11')](function(_0x469888){logger[_0xe595('0xe')](_0xe595('0x1c'),_0x469888[_0xe595('0x10')],_0x1eea9a);_0x40666e(_0x11550a[_0xe595('0xe')](0x1f4,_0x469888['message']));});});};exports[_0xe595('0x20')]=function(_0x51e26a){var _0x472f7d=this;return new Promise(function(_0x5c88f3,_0x278022){return db[_0xe595('0x13')]['destroy']({'where':_0x51e26a[_0xe595('0x14')]?_0x51e26a['options'][_0xe595('0x15')]||null:null})[_0xe595('0x9')](function(_0x38fbf3){logger[_0xe595('0xa')](_0xe595('0x20'),_0x51e26a);logger[_0xe595('0xd')](_0xe595('0x20'),_0x51e26a,JSON['stringify'](_0x38fbf3));_0x5c88f3(_0x38fbf3);})['catch'](function(_0x2b2e20){logger['error']('DestroyCmHopperBlack',_0x2b2e20[_0xe595('0x10')],_0x51e26a);_0x278022(_0x472f7d[_0xe595('0xe')](0x1f4,_0x2b2e20['message']));});});}; \ No newline at end of file +var _0xc8c3=['catch','findAll','options','raw','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','CmHopperBlack','update','body','info','DestroyCmHopperBlack','destroy','where','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x528385,_0x46c45c){var _0x44893c=function(_0x337c29){while(--_0x337c29){_0x528385['push'](_0x528385['shift']());}};_0x44893c(++_0x46c45c);}(_0xc8c3,0x141));var _0x3c8c=function(_0x5b64a1,_0x2ec810){_0x5b64a1=_0x5b64a1-0x0;var _0x4b6f55=_0xc8c3[_0x5b64a1];return _0x4b6f55;};'use strict';var _=require(_0x3c8c('0x0'));var util=require(_0x3c8c('0x1'));var moment=require(_0x3c8c('0x2'));var BPromise=require(_0x3c8c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c8c('0x4'))['db'];var utils=require(_0x3c8c('0x5'));var logger=require(_0x3c8c('0x6'))(_0x3c8c('0x7'));var config=require(_0x3c8c('0x8'));var jayson=require(_0x3c8c('0x9'));var client=jayson[_0x3c8c('0xa')][_0x3c8c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30dc98,_0x13fa57,_0x5a13de){return new BPromise(function(_0x49f30c,_0x357679){return client[_0x3c8c('0xc')](_0x30dc98,_0x5a13de)[_0x3c8c('0xd')](function(_0x2d6c3c){logger['info'](_0x3c8c('0xe'),_0x13fa57,_0x3c8c('0xf'));logger[_0x3c8c('0x10')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x13fa57,_0x3c8c('0xf'),JSON[_0x3c8c('0x11')](_0x2d6c3c));if(_0x2d6c3c['error']){if(_0x2d6c3c[_0x3c8c('0x12')]['code']===0x1f4){logger[_0x3c8c('0x12')](_0x3c8c('0xe'),_0x13fa57,_0x2d6c3c[_0x3c8c('0x12')][_0x3c8c('0x13')]);return _0x357679(_0x2d6c3c[_0x3c8c('0x12')]['message']);}logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x13fa57,_0x2d6c3c[_0x3c8c('0x12')][_0x3c8c('0x13')]);return _0x49f30c(_0x2d6c3c[_0x3c8c('0x12')]['message']);}else{logger['info'](_0x3c8c('0xe'),_0x13fa57,'request\x20sent');_0x49f30c(_0x2d6c3c[_0x3c8c('0x14')][_0x3c8c('0x13')]);}})[_0x3c8c('0x15')](function(_0x1b0218){logger['error'](_0x3c8c('0xe'),_0x13fa57,_0x1b0218);_0x357679(_0x1b0218);});});}exports['GetCmHopperBlack']=function(_0x1918b2){var _0x108f07=this;return new Promise(function(_0x519c17,_0x367fd3){return db['CmHopperBlack'][_0x3c8c('0x16')]({'raw':_0x1918b2[_0x3c8c('0x17')]?_0x1918b2[_0x3c8c('0x17')][_0x3c8c('0x18')]===undefined?!![]:![]:!![],'where':_0x1918b2[_0x3c8c('0x17')]?_0x1918b2[_0x3c8c('0x17')]['where']||null:null,'attributes':_0x1918b2[_0x3c8c('0x17')]?_0x1918b2['options'][_0x3c8c('0x19')]||null:null,'limit':_0x1918b2['options']?_0x1918b2[_0x3c8c('0x17')]['limit']||null:null,'include':_0x1918b2['options']?_0x1918b2[_0x3c8c('0x17')][_0x3c8c('0x1a')]?_[_0x3c8c('0x1b')](_0x1918b2[_0x3c8c('0x17')][_0x3c8c('0x1a')],function(_0x4ffca0){return{'model':db[_0x4ffca0[_0x3c8c('0x1c')]],'as':_0x4ffca0['as'],'attributes':_0x4ffca0[_0x3c8c('0x19')],'include':_0x4ffca0['include']?_[_0x3c8c('0x1b')](_0x4ffca0[_0x3c8c('0x1a')],function(_0x5b801c){return{'model':db[_0x5b801c[_0x3c8c('0x1c')]],'as':_0x5b801c['as'],'attributes':_0x5b801c[_0x3c8c('0x19')],'include':_0x5b801c[_0x3c8c('0x1a')]?_[_0x3c8c('0x1b')](_0x5b801c[_0x3c8c('0x1a')],function(_0x545853){return{'model':db[_0x545853['model']],'as':_0x545853['as'],'attributes':_0x545853[_0x3c8c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15ba48){logger['info'](_0x3c8c('0x1d'),_0x1918b2);logger[_0x3c8c('0x10')](_0x3c8c('0x1d'),_0x1918b2,JSON['stringify'](_0x15ba48));_0x519c17(_0x15ba48);})[_0x3c8c('0x15')](function(_0x152d28){logger['error']('GetCmHopperBlack',_0x152d28['message'],_0x1918b2);_0x367fd3(_0x108f07[_0x3c8c('0x12')](0x1f4,_0x152d28['message']));});});};exports[_0x3c8c('0x1e')]=function(_0x2dc3ec){var _0x3fe773=this;return new Promise(function(_0x5b94e0,_0x377589){return db[_0x3c8c('0x1f')][_0x3c8c('0x20')](_0x2dc3ec[_0x3c8c('0x21')],{'raw':_0x2dc3ec[_0x3c8c('0x17')]?_0x2dc3ec[_0x3c8c('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2dc3ec[_0x3c8c('0x17')]?_0x2dc3ec['options']['where']||null:null,'attributes':_0x2dc3ec[_0x3c8c('0x17')]?_0x2dc3ec['options'][_0x3c8c('0x19')]||null:null,'limit':_0x2dc3ec['options']?_0x2dc3ec[_0x3c8c('0x17')]['limit']||null:null})['then'](function(_0x1bb2f0){logger[_0x3c8c('0x22')](_0x3c8c('0x1e'),_0x2dc3ec);logger['debug']('UpdateCmHopperBlack',_0x2dc3ec,JSON[_0x3c8c('0x11')](_0x1bb2f0));_0x5b94e0(_0x1bb2f0);})['catch'](function(_0x40f3c6){logger[_0x3c8c('0x12')]('UpdateCmHopperBlack',_0x40f3c6['message'],_0x2dc3ec);_0x377589(_0x3fe773['error'](0x1f4,_0x40f3c6[_0x3c8c('0x13')]));});});};exports[_0x3c8c('0x23')]=function(_0x2914d7){var _0x4c23d5=this;return new Promise(function(_0x344a56,_0x32e0d8){return db['CmHopperBlack'][_0x3c8c('0x24')]({'where':_0x2914d7['options']?_0x2914d7[_0x3c8c('0x17')][_0x3c8c('0x25')]||null:null})[_0x3c8c('0xd')](function(_0x2b1dc3){logger[_0x3c8c('0x22')](_0x3c8c('0x23'),_0x2914d7);logger[_0x3c8c('0x10')](_0x3c8c('0x23'),_0x2914d7,JSON[_0x3c8c('0x11')](_0x2b1dc3));_0x344a56(_0x2b1dc3);})[_0x3c8c('0x15')](function(_0x10556d){logger['error'](_0x3c8c('0x23'),_0x10556d[_0x3c8c('0x13')],_0x2914d7);_0x32e0d8(_0x4c23d5[_0x3c8c('0x12')](0x1f4,_0x10556d['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b70cff5..6960a98 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 _0x6455=['index','/describe','/:id','show','put','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x223461,_0x2bca70){var _0x4dbe0a=function(_0x3c3cb6){while(--_0x3c3cb6){_0x223461['push'](_0x223461['shift']());}};_0x4dbe0a(++_0x2bca70);}(_0x6455,0x97));var _0x5645=function(_0x253341,_0x1f842a){_0x253341=_0x253341-0x0;var _0x19d069=_0x6455[_0x253341];return _0x19d069;};'use strict';var multer=require(_0x5645('0x0'));var util=require('util');var path=require(_0x5645('0x1'));var timeout=require(_0x5645('0x2'));var express=require(_0x5645('0x3'));var router=express[_0x5645('0x4')]();var fs_extra=require(_0x5645('0x5'));var auth=require(_0x5645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5645('0x7'));var controller=require(_0x5645('0x8'));router[_0x5645('0x9')]('/',auth[_0x5645('0xa')](),controller[_0x5645('0xb')]);router[_0x5645('0x9')](_0x5645('0xc'),auth[_0x5645('0xa')](),controller['describe']);router['get'](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0xe')]);router[_0x5645('0xf')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller['update']);router[_0x5645('0x10')](_0x5645('0xd'),auth[_0x5645('0xa')](),controller[_0x5645('0x11')]);module['exports']=router; \ No newline at end of file +var _0x1967=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x43ef4e,_0x2b60f2){var _0x203c99=function(_0x5c4789){while(--_0x5c4789){_0x43ef4e['push'](_0x43ef4e['shift']());}};_0x203c99(++_0x2b60f2);}(_0x1967,0x173));var _0x7196=function(_0x4902d6,_0x319690){_0x4902d6=_0x4902d6-0x0;var _0xe649fe=_0x1967[_0x4902d6];return _0xe649fe;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')](_0x7196('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x7196('0x12')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);module[_0x7196('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 8268701..8f093ba 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 _0x1c11=['exports','INTEGER','STRING','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x43316d,_0x5ebd8f){var _0x52d343=function(_0x231e52){while(--_0x231e52){_0x43316d['push'](_0x43316d['shift']());}};_0x52d343(++_0x5ebd8f);}(_0x1c11,0x6a));var _0x11c1=function(_0x507ed1,_0x14675c){_0x507ed1=_0x507ed1-0x0;var _0x2e26f1=_0x1c11[_0x507ed1];return _0x2e26f1;};'use strict';var Sequelize=require(_0x11c1('0x0'));var moment=require(_0x11c1('0x1'));module[_0x11c1('0x2')]={'state':{'type':Sequelize[_0x11c1('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x11c1('0x4')]},'scheduledat':{'type':Sequelize[_0x11c1('0x5')]},'countbusyretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x11c1('0x5')]},'responsetime':{'type':Sequelize[_0x11c1('0x5')]},'answertime':{'type':Sequelize[_0x11c1('0x5')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x11c1('0x5')]},'ringtime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x11c1('0x4')]},'campaign':{'type':Sequelize[_0x11c1('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x11c1('0x4')]},'reason':{'type':Sequelize[_0x11c1('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x11c1('0x4')]},'thirdDisposition':{'type':Sequelize[_0x11c1('0x4')]},'dispositionat':{'type':Sequelize[_0x11c1('0x5')],'set':function(_0x24d461){var _0x381f24=this[_0x11c1('0x6')]('endtime');if(_0x381f24&&_0x24d461){this[_0x11c1('0x7')](_0x11c1('0x8'),moment(_0x24d461)[_0x11c1('0x9')](moment(_0x381f24),_0x11c1('0xa')));}}},'amd':{'type':Sequelize[_0x11c1('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0x11c1('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x11c1('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x11c1('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x11c1('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x3723=['INTEGER','DATE','getDataValue','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment','STRING'];(function(_0x184750,_0x44af91){var _0x37a37c=function(_0x216af0){while(--_0x216af0){_0x184750['push'](_0x184750['shift']());}};_0x37a37c(++_0x44af91);}(_0x3723,0x81));var _0x3372=function(_0x1ae1cd,_0x383aa0){_0x1ae1cd=_0x1ae1cd-0x0;var _0x3260e6=_0x3723[_0x1ae1cd];return _0x3260e6;};'use strict';var Sequelize=require(_0x3372('0x0'));var moment=require(_0x3372('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x3372('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x3372('0x2')]},'originatecalleridname':{'type':Sequelize[_0x3372('0x2')]},'calleridnum':{'type':Sequelize[_0x3372('0x2')]},'calleridname':{'type':Sequelize[_0x3372('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x3372('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x3372('0x4')]},'ringtime':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x3372('0x2')]},'campaign':{'type':Sequelize[_0x3372('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x3372('0x2')]},'disposition':{'type':Sequelize[_0x3372('0x2')]},'secondDisposition':{'type':Sequelize[_0x3372('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3372('0x2')]},'dispositionat':{'type':Sequelize[_0x3372('0x4')],'set':function(_0x52682e){var _0x29f9bb=this[_0x3372('0x5')]('endtime');if(_0x29f9bb&&_0x52682e){this[_0x3372('0x6')](_0x3372('0x7'),moment(_0x52682e)[_0x3372('0x8')](moment(_0x29f9bb),_0x3372('0x9')));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0x3372('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x3372('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x3372('0x4')]},'callback':{'type':Sequelize[_0x3372('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x3372('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x3372('0x4')]},'deleted':{'type':Sequelize[_0x3372('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x3372('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x3372('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x3372('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 29c5448..95bbaba 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 _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x77d39c,_0x296249){var _0x1706ec=function(_0x5f0738){while(--_0x5f0738){_0x77d39c['push'](_0x77d39c['shift']());}};_0x1706ec(++_0x296249);}(_0x7096,0x10c));var _0x6709=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x7096[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file +var _0x430c=['field','phone','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','createdAt','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','from','checkContactHopper','CmHopper','findOne','eml-format','fast-json-patch','request-promise','moment','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','key','model','map','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','describe','update','uniqueid','body','find','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x208,\x201,\x20null','dropContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select'];(function(_0x1fcfc8,_0x5c155f){var _0x40cc63=function(_0x522e01){while(--_0x522e01){_0x1fcfc8['push'](_0x1fcfc8['shift']());}};_0x40cc63(++_0x5c155f);}(_0x430c,0x1a1));var _0xc430=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0x430c[_0x34b1b8];return _0x542dd8;};'use strict';var emlformat=require(_0xc430('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc430('0x1'));var rp=require(_0xc430('0x2'));var moment=require(_0xc430('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xc430('0x4'));var csv=require(_0xc430('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc430('0x6'));var _=require('lodash');var squel=require(_0xc430('0x7'));var crypto=require(_0xc430('0x8'));var jsforce=require(_0xc430('0x9'));var deskjs=require(_0xc430('0xa'));var toCsv=require(_0xc430('0x5'));var querystring=require(_0xc430('0xb'));var Papa=require(_0xc430('0xc'));var Redis=require(_0xc430('0xd'));var authService=require(_0xc430('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xc430('0xf'));var hardwareService=require(_0xc430('0x10'));var logger=require('../../config/logger')(_0xc430('0x11'));var utils=require('../../config/utils');var config=require(_0xc430('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xc430('0x13'))['db'];function respondWithStatusCode(_0x8aa2e6,_0xc5f92){_0xc5f92=_0xc5f92||0xcc;return function(_0x1fb8ce){if(_0x1fb8ce){return _0x8aa2e6[_0xc430('0x14')](_0xc5f92);}return _0x8aa2e6[_0xc430('0x15')](_0xc5f92)[_0xc430('0x16')]();};}function respondWithResult(_0x54d851,_0x4e9134){_0x4e9134=_0x4e9134||0xc8;return function(_0x3f359c){if(_0x3f359c){return _0x54d851[_0xc430('0x15')](_0x4e9134)[_0xc430('0x17')](_0x3f359c);}};}function respondWithFilteredResult(_0x2ef538,_0x31d3b7){return function(_0x55cc6c){if(_0x55cc6c){var _0x111598=typeof _0x31d3b7['offset']==='undefined'&&typeof _0x31d3b7[_0xc430('0x18')]===_0xc430('0x19');var _0x2327c5=_0x55cc6c['count'];var _0x5d3acc=_0x111598?0x0:_0x31d3b7[_0xc430('0x1a')];var _0x4c1937=_0x111598?_0x55cc6c[_0xc430('0x1b')]:_0x31d3b7['offset']+_0x31d3b7['limit'];var _0x2f3203;if(_0x4c1937>=_0x2327c5){_0x4c1937=_0x2327c5;_0x2f3203=0xc8;}else{_0x2f3203=0xce;}_0x2ef538['status'](_0x2f3203);return _0x2ef538[_0xc430('0x1c')](_0xc430('0x1d'),_0x5d3acc+'-'+_0x4c1937+'/'+_0x2327c5)[_0xc430('0x17')](_0x55cc6c);}return null;};}function patchUpdates(_0x1f90bb){return function(_0x2a1ea1){try{jsonpatch['apply'](_0x2a1ea1,_0x1f90bb,!![]);}catch(_0x388a2f){return BPromise['reject'](_0x388a2f);}return _0x2a1ea1['save']();};}function saveUpdates(_0x3b7c3d,_0x2ea352){return function(_0x3c7afa){if(_0x3c7afa){return _0x3c7afa['update'](_0x3b7c3d)[_0xc430('0x1e')](function(_0x57d26e){return _0x57d26e;});}return null;};}function removeEntity(_0x23425d,_0x22ebfb){return function(_0x4efecd){if(_0x4efecd){return _0x4efecd[_0xc430('0x1f')]()[_0xc430('0x1e')](function(){_0x23425d['status'](0xcc)[_0xc430('0x16')]();});}};}function handleEntityNotFound(_0x59c498,_0x3aa85e){return function(_0x4b5280){if(!_0x4b5280){_0x59c498[_0xc430('0x14')](0x194);}return _0x4b5280;};}function handleError(_0x21e28a,_0x50110b){_0x50110b=_0x50110b||0x1f4;return function(_0x33433f){logger[_0xc430('0x20')](_0x33433f[_0xc430('0x21')]);if(_0x33433f[_0xc430('0x22')]){delete _0x33433f[_0xc430('0x22')];}_0x21e28a['status'](_0x50110b)[_0xc430('0x23')](_0x33433f);};}exports[_0xc430('0x24')]=function(_0x1c1da9,_0x1591e3){var _0x542cba={},_0x1f8086={},_0x4cf56c={'count':0x0,'rows':[]};var _0x1d65ee=_['map'](db[_0xc430('0x25')][_0xc430('0x26')],function(_0xfc8767){return{'name':_0xfc8767[_0xc430('0x27')],'type':_0xfc8767['type'][_0xc430('0x28')]};});_0x1f8086[_0xc430('0x29')]=_[_0xc430('0x2a')](_0x1d65ee,_0xc430('0x22'));_0x1f8086['query']=_[_0xc430('0x2b')](_0x1c1da9[_0xc430('0x2c')]);_0x1f8086['filters']=_[_0xc430('0x2d')](_0x1f8086['model'],_0x1f8086['query']);_0x542cba[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x1f8086[_0xc430('0x29')],qs[_0xc430('0x2f')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x2f')]));_0x542cba[_0xc430('0x2e')]=_0x542cba[_0xc430('0x2e')]['length']?_0x542cba[_0xc430('0x2e')]:_0x1f8086['model'];if(!_0x1c1da9[_0xc430('0x2c')][_0xc430('0x30')](_0xc430('0x31'))){_0x542cba[_0xc430('0x18')]=qs['limit'](_0x1c1da9[_0xc430('0x2c')]['limit']);_0x542cba['offset']=qs[_0xc430('0x1a')](_0x1c1da9[_0xc430('0x2c')]['offset']);}_0x542cba[_0xc430('0x32')]=qs[_0xc430('0x33')](_0x1c1da9[_0xc430('0x2c')][_0xc430('0x33')]);_0x542cba[_0xc430('0x34')]=qs[_0xc430('0x35')](_[_0xc430('0x36')](_0x1c1da9[_0xc430('0x2c')],_0x1f8086[_0xc430('0x35')]),_0x1d65ee);if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x37')]){_0x542cba[_0xc430('0x34')]=_[_0xc430('0x38')](_0x542cba[_0xc430('0x34')],{'$or':_[_0xc430('0x2a')](_0x1d65ee,function(_0x537e4c){if(_0x537e4c[_0xc430('0x39')]!==_0xc430('0x3a')){var _0x24363b={};_0x24363b[_0x537e4c[_0xc430('0x22')]]={'$like':'%'+_0x1c1da9['query'][_0xc430('0x37')]+'%'};return _0x24363b;}})});}_0x542cba=_[_0xc430('0x38')]({},_0x542cba,_0x1c1da9[_0xc430('0x3b')]);var _0x45b3dc={'where':_0x542cba[_0xc430('0x34')]};return db[_0xc430('0x25')]['count'](_0x45b3dc)[_0xc430('0x1e')](function(_0x348f2f){_0x4cf56c[_0xc430('0x1b')]=_0x348f2f;if(_0x1c1da9[_0xc430('0x2c')][_0xc430('0x3c')]){_0x542cba[_0xc430('0x3d')]=[{'all':!![]}];}return db[_0xc430('0x25')][_0xc430('0x3e')](_0x542cba);})[_0xc430('0x1e')](function(_0x4174d2){_0x4cf56c[_0xc430('0x3f')]=_0x4174d2;return _0x4cf56c;})[_0xc430('0x1e')](respondWithFilteredResult(_0x1591e3,_0x542cba))[_0xc430('0x40')](handleError(_0x1591e3,null));};exports[_0xc430('0x41')]=function(_0x5a9c4b,_0x47edb0){var _0x4983e0={'raw':!![],'where':{'id':_0x5a9c4b[_0xc430('0x42')]['id']}},_0x262063={};_0x262063[_0xc430('0x29')]=_[_0xc430('0x2b')](db[_0xc430('0x25')][_0xc430('0x26')]);_0x262063[_0xc430('0x2c')]=_[_0xc430('0x2b')](_0x5a9c4b[_0xc430('0x2c')]);_0x262063[_0xc430('0x35')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],_0x262063[_0xc430('0x2c')]);_0x4983e0[_0xc430('0x2e')]=_[_0xc430('0x2d')](_0x262063[_0xc430('0x29')],qs['fields'](_0x5a9c4b[_0xc430('0x2c')][_0xc430('0x2f')]));_0x4983e0[_0xc430('0x2e')]=_0x4983e0[_0xc430('0x2e')][_0xc430('0x43')]?_0x4983e0[_0xc430('0x2e')]:_0x262063[_0xc430('0x29')];if(_0x5a9c4b[_0xc430('0x2c')]['includeAll']){_0x4983e0[_0xc430('0x3d')]=[{'all':!![]}];}_0x4983e0=_['merge']({},_0x4983e0,_0x5a9c4b[_0xc430('0x3b')]);return db[_0xc430('0x25')]['find'](_0x4983e0)['then'](handleEntityNotFound(_0x47edb0,null))[_0xc430('0x1e')](respondWithResult(_0x47edb0,null))['catch'](handleError(_0x47edb0,null));};exports['describe']=function(_0x10db27,_0x4eafae){return db[_0xc430('0x25')][_0xc430('0x44')]()[_0xc430('0x1e')](respondWithResult(_0x4eafae,null))['catch'](handleError(_0x4eafae,null));};exports[_0xc430('0x45')]=function(_0x2e7052,_0x19e563){if(_0x2e7052['body'][_0xc430('0x46')]){delete _0x2e7052[_0xc430('0x47')][_0xc430('0x46')];}return db[_0xc430('0x25')][_0xc430('0x48')]({'where':{'uniqueid':_0x2e7052[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19e563,null))['then'](saveUpdates(_0x2e7052[_0xc430('0x47')],null))[_0xc430('0x1e')](respondWithResult(_0x19e563,null))[_0xc430('0x40')](handleError(_0x19e563,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x23cb41,_0x4178d7,_0x2d064b){return db[_0xc430('0x25')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x23cb41[_0xc430('0x42')]['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x4e')))),_0xc430('0x4f')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x50')))),_0xc430('0x51')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0xc430('0x52')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x53')))),'dropContacts'],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x58')))),'answeringMachine']]})[_0xc430('0x1e')](handleEntityNotFound(_0x4178d7,null))[_0xc430('0x1e')](respondWithResult(_0x4178d7,null))[_0xc430('0x40')](handleError(_0x4178d7,null));};exports[_0xc430('0x59')]=function(_0x147062,_0x45eec6,_0x5d3393){return db[_0xc430('0x25')][_0xc430('0x3e')]({'raw':![],'where':{'CampaignId':_0x147062['params']['id']},'attributes':[[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4c')))),_0xc430('0x4d')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x4e')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db['sequelize']['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x205,\x201,\x20null'))),_0xc430('0x51')],[db['sequelize']['fn']('COUNT',db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')]['literal'](_0xc430('0x5a')))),'congestionContacts'],[db['sequelize']['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc430('0x5b')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x54')))),_0xc430('0x55')],[db[_0xc430('0x4a')]['fn'](_0xc430('0x49'),db[_0xc430('0x4a')]['fn']('IF',db[_0xc430('0x4a')][_0xc430('0x4b')](_0xc430('0x56')))),_0xc430('0x57')],[db[_0xc430('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xc430('0x4b')](_0xc430('0x58')))),_0xc430('0x5c')]]})['then'](handleEntityNotFound(_0x45eec6,null))['then'](respondWithResult(_0x45eec6,null))[_0xc430('0x40')](handleError(_0x45eec6,null));};exports[_0xc430('0x5d')]=function(_0x31ae3c,_0x19c080,_0x256290){return db[_0xc430('0x5e')][_0xc430('0x48')]({'where':{'id':_0x31ae3c[_0xc430('0x42')]['id']}})[_0xc430('0x1e')](handleEntityNotFound(_0x19c080,null))[_0xc430('0x1e')](function(_0x5ca0f2){var _0x6debfb;if(_0x5ca0f2){_0x6debfb=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery'](['phone',_0xc430('0x61'),_0xc430('0x62'),_0xc430('0x63'),_0xc430('0x64'),'createdAt',_0xc430('0x65')],squel[_0xc430('0x66')]()[_0xc430('0x67')]('ANY_VALUE(calleridnum)',_0xc430('0x68'))['field'](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),_0xc430('0x62'))['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x6c'),'VoiceQueueId')['field'](_0xc430('0x69'),'createdAt')['field'](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x6e'),_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())[_0xc430('0x34')]('state\x20=\x20?',_0x31ae3c[_0xc430('0x47')][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()['field'](_0xc430('0x68'))['from']('cm_hopper')[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id']['toString']()))[_0xc430('0x34')](_0xc430('0x71'),squel['select']()[_0xc430('0x67')](_0xc430('0x72'))['from'](_0xc430('0x6d'))[_0xc430('0x34')]('VoiceQueueId\x20=\x20?',_0x31ae3c[_0xc430('0x42')]['id'][_0xc430('0x6f')]())['where'](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x6debfb);}return[];})[_0xc430('0x1e')](respondWithResult(_0x19c080,null))[_0xc430('0x40')](handleError(_0x19c080,null));};exports[_0xc430('0x75')]=function(_0x19789f,_0x24b380,_0x4fe467){return db[_0xc430('0x76')][_0xc430('0x48')]({'where':{'id':_0x19789f[_0xc430('0x42')]['id']}})['then'](handleEntityNotFound(_0x24b380,null))['then'](function(_0x150a8a){var _0x4edead;if(_0x150a8a){_0x4edead=squel[_0xc430('0x5f')]()[_0xc430('0x60')]('cm_hopper')['fromQuery']([_0xc430('0x68'),_0xc430('0x61'),_0xc430('0x62'),'ListId',_0xc430('0x77'),'createdAt','updatedAt'],squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x78'),'phone')[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x61'))[_0xc430('0x67')](_0xc430('0x6a'),'ContactId')['field'](_0xc430('0x6b'),_0xc430('0x63'))[_0xc430('0x67')](_0xc430('0x79'),_0xc430('0x77'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x7a'))[_0xc430('0x67')](_0xc430('0x69'),_0xc430('0x65'))['from'](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())['where'](_0xc430('0x7c'),_0x19789f['body'][_0xc430('0x70')][_0xc430('0x6f')]())[_0xc430('0x34')](_0xc430('0x7d'))[_0xc430('0x34')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()['field']('phone')[_0xc430('0x7e')]('cm_hopper')['where'](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id'][_0xc430('0x6f')]()))[_0xc430('0x34')](_0xc430('0x71'),squel[_0xc430('0x66')]()[_0xc430('0x67')](_0xc430('0x72'))[_0xc430('0x7e')](_0xc430('0x6d'))[_0xc430('0x34')](_0xc430('0x7b'),_0x19789f[_0xc430('0x42')]['id']['toString']())[_0xc430('0x34')](_0xc430('0x73')))[_0xc430('0x74')](_0xc430('0x62')))[_0xc430('0x6f')]();return db[_0xc430('0x4a')][_0xc430('0x2c')](_0x4edead);}return[];})[_0xc430('0x1e')](respondWithResult(_0x24b380,null))['catch'](handleError(_0x24b380,null));};exports[_0xc430('0x7f')]=function(_0x6e48a3,_0x5be78a,_0x3bd6e1){return db[_0xc430('0x80')][_0xc430('0x81')]({'where':{'VoiceQueueId':_0x6e48a3[_0xc430('0x47')]['VoiceQueueId'],'CampaignId':_0x6e48a3[_0xc430('0x47')]['CampaignId'],'ContactId':_0x6e48a3['body'][_0xc430('0x62')]}})[_0xc430('0x1e')](handleEntityNotFound(_0x5be78a,null))[_0xc430('0x1e')](function(_0x207067){if(_0x207067){return _0x207067;}return null;})[_0xc430('0x1e')](respondWithResult(_0x5be78a,null))[_0xc430('0x40')](handleError(_0x5be78a,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index f8c7719..d4c90c9 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 _0xf54e=['exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','request-promise','path','rimraf','./cmHopperFinal.attributes'];(function(_0x3a5e83,_0x598916){var _0x3a3297=function(_0x558bb1){while(--_0x558bb1){_0x3a5e83['push'](_0x3a5e83['shift']());}};_0x3a3297(++_0x598916);}(_0xf54e,0x155));var _0xef54=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xf54e[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0xef54('0x0'));var util=require('util');var logger=require(_0xef54('0x1'))(_0xef54('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xef54('0x3'));var fs=require('fs');var path=require(_0xef54('0x4'));var rimraf=require(_0xef54('0x5'));var config=require('../../config/environment');var attributes=require(_0xef54('0x6'));module[_0xef54('0x7')]=function(_0x16cb9f,_0x3daae7){return _0x16cb9f['define'](_0xef54('0x8'),attributes,{'tableName':_0xef54('0x9'),'paranoid':![],'indexes':[{'name':_0xef54('0xa'),'fields':[_0xef54('0xa')]},{'name':_0xef54('0xb'),'fields':[_0xef54('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd3f7=['request-promise','path','rimraf','../../config/environment','./cmHopperFinal.attributes','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird'];(function(_0x217451,_0x4704c9){var _0x517118=function(_0x2f7956){while(--_0x2f7956){_0x217451['push'](_0x217451['shift']());}};_0x517118(++_0x4704c9);}(_0xd3f7,0x128));var _0x7d3f=function(_0x229128,_0x273558){_0x229128=_0x229128-0x0;var _0x1875b9=_0xd3f7[_0x229128];return _0x1875b9;};'use strict';var _=require(_0x7d3f('0x0'));var util=require('util');var logger=require(_0x7d3f('0x1'))(_0x7d3f('0x2'));var moment=require('moment');var BPromise=require(_0x7d3f('0x3'));var rp=require(_0x7d3f('0x4'));var fs=require('fs');var path=require(_0x7d3f('0x5'));var rimraf=require(_0x7d3f('0x6'));var config=require(_0x7d3f('0x7'));var attributes=require(_0x7d3f('0x8'));module['exports']=function(_0x4ec38a,_0x311bcb){return _0x4ec38a['define']('CmHopperFinal',attributes,{'tableName':_0x7d3f('0x9'),'paranoid':![],'indexes':[{'name':_0x7d3f('0xa'),'fields':[_0x7d3f('0xa')]},{'name':_0x7d3f('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 90bcb25..4f502ee 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x5b8631,_0x4f5ecd){var _0xb473b1=function(_0x83d2ad){while(--_0x83d2ad){_0x5b8631['push'](_0x5b8631['shift']());}};_0xb473b1(++_0x4f5ecd);}(_0x7a54,0x106));var _0x47a5=function(_0x52cf30,_0x546685){_0x52cf30=_0x52cf30-0x0;var _0x5d406d=_0x7a54[_0x52cf30];return _0x5d406d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _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(_0x555cf,_0x1bcc3f){var _0x10fff9=function(_0x3352a9){while(--_0x3352a9){_0x555cf['push'](_0x555cf['shift']());}};_0x10fff9(++_0x1bcc3f);}(_0xb10b,0x12a));var _0xbb10=function(_0x34df56,_0x52a58f){_0x34df56=_0x34df56-0x0;var _0x520f88=_0xb10b[_0x34df56];return _0x520f88;};'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 e58767f..512346d 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 _0xb511=['/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x3ee911,_0x279ed5){var _0x1dd99f=function(_0x34083e){while(--_0x34083e){_0x3ee911['push'](_0x3ee911['shift']());}};_0x1dd99f(++_0x279ed5);}(_0xb511,0x165));var _0x1b51=function(_0x2a13ed,_0xde27ff){_0x2a13ed=_0x2a13ed-0x0;var _0xddc517=_0xb511[_0x2a13ed];return _0xddc517;};'use strict';var multer=require(_0x1b51('0x0'));var util=require(_0x1b51('0x1'));var path=require(_0x1b51('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b51('0x3'));var router=express[_0x1b51('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1b51('0x5'));var interaction=require(_0x1b51('0x6'));var config=require(_0x1b51('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x1b51('0x8')]('/',auth[_0x1b51('0x9')](),controller['index']);router[_0x1b51('0x8')](_0x1b51('0xa'),auth['isAuthenticated'](),controller[_0x1b51('0xb')]);router[_0x1b51('0x8')](_0x1b51('0xc'),auth[_0x1b51('0x9')](),controller[_0x1b51('0xd')]);router[_0x1b51('0x8')](_0x1b51('0xe'),auth[_0x1b51('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x1b51('0x8')](_0x1b51('0xf'),auth[_0x1b51('0x9')](),controller[_0x1b51('0x10')]);router[_0x1b51('0x11')](_0x1b51('0x12'),auth['isAuthenticated'](),controller[_0x1b51('0x13')]);router[_0x1b51('0x11')](_0x1b51('0x14'),auth[_0x1b51('0x9')](),controller[_0x1b51('0x15')]);router[_0x1b51('0x11')](_0x1b51('0x16'),auth['isAuthenticated'](),controller[_0x1b51('0x17')]);router['put']('/:id',auth[_0x1b51('0x9')](),controller[_0x1b51('0x18')]);module['exports']=router; \ No newline at end of file +var _0x7a8a=['fs-extra','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','/:id','update','exports','multer','util','connect-timeout','express'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7a8a,0x173));var _0xa7a8=function(_0x32cbe2,_0x38388b){_0x32cbe2=_0x32cbe2-0x0;var _0x582cf0=_0x7a8a[_0x32cbe2];return _0x582cf0;};'use strict';var multer=require(_0xa7a8('0x0'));var util=require(_0xa7a8('0x1'));var path=require('path');var timeout=require(_0xa7a8('0x2'));var express=require(_0xa7a8('0x3'));var router=express['Router']();var fs_extra=require(_0xa7a8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa7a8('0x5'));var config=require(_0xa7a8('0x6'));var controller=require(_0xa7a8('0x7'));router[_0xa7a8('0x8')]('/',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0xa')]);router[_0xa7a8('0x8')](_0xa7a8('0xb'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0xc')]);router[_0xa7a8('0x8')]('/:id',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0xd')]);router['get'](_0xa7a8('0xe'),auth[_0xa7a8('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xa7a8('0x8')]('/campaign/countAttributes/:id',auth['isAuthenticated'](),controller[_0xa7a8('0xf')]);router[_0xa7a8('0x10')]('/voice/queue/moveContacts/:id',auth[_0xa7a8('0x9')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xa7a8('0x10')](_0xa7a8('0x11'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x12')]);router['post'](_0xa7a8('0x13'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x14')]);router[_0xa7a8('0x15')](_0xa7a8('0x16'),auth['isAuthenticated'](),controller[_0xa7a8('0x17')]);module[_0xa7a8('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 061d089..fb55678 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 _0x9e84=['INTEGER','STRING','DATE','BOOLEAN','sequelize','exports'];(function(_0x30310b,_0x327c8c){var _0xea7e20=function(_0x4afdb8){while(--_0x4afdb8){_0x30310b['push'](_0x30310b['shift']());}};_0xea7e20(++_0x327c8c);}(_0x9e84,0x196));var _0x49e8=function(_0x16e57d,_0x2cb7ba){_0x16e57d=_0x16e57d-0x0;var _0x40239c=_0x9e84[_0x16e57d];return _0x40239c;};'use strict';var Sequelize=require(_0x49e8('0x0'));module[_0x49e8('0x1')]={'state':{'type':Sequelize[_0x49e8('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x49e8('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x49e8('0x3')]},'calleridnum':{'type':Sequelize[_0x49e8('0x3')]},'calleridname':{'type':Sequelize[_0x49e8('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x49e8('0x4')]},'answertime':{'type':Sequelize[_0x49e8('0x4')]},'droptime':{'type':Sequelize[_0x49e8('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x49e8('0x3')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x49e8('0x3')]},'reason':{'type':Sequelize[_0x49e8('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize[_0x49e8('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x49e8('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x49e8('0x4')]},'recallme':{'type':Sequelize[_0x49e8('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x49e8('0x4')]},'edited':{'type':Sequelize[_0x49e8('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x49e8('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6d6f=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x54c42e,_0x19791b){var _0x2eb70d=function(_0x1b953a){while(--_0x1b953a){_0x54c42e['push'](_0x54c42e['shift']());}};_0x2eb70d(++_0x19791b);}(_0x6d6f,0xb6));var _0xf6d6=function(_0x1bb58c,_0x2c8a4d){_0x1bb58c=_0x1bb58c-0x0;var _0x277586=_0x6d6f[_0x1bb58c];return _0x277586;};'use strict';var Sequelize=require(_0xf6d6('0x0'));module[_0xf6d6('0x1')]={'state':{'type':Sequelize[_0xf6d6('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf6d6('0x3')]},'countbusyretry':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xf6d6('0x4')]},'originatecalleridname':{'type':Sequelize[_0xf6d6('0x4')]},'calleridnum':{'type':Sequelize[_0xf6d6('0x4')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf6d6('0x3')]},'answertime':{'type':Sequelize[_0xf6d6('0x3')]},'droptime':{'type':Sequelize[_0xf6d6('0x3')]},'endtime':{'type':Sequelize[_0xf6d6('0x3')]},'ringtime':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf6d6('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xf6d6('0x4')]},'membername':{'type':Sequelize[_0xf6d6('0x4')]},'reason':{'type':Sequelize[_0xf6d6('0x4')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xf6d6('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xf6d6('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf6d6('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xf6d6('0x3')]},'recallme':{'type':Sequelize[_0xf6d6('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xf6d6('0x3')]},'edited':{'type':Sequelize[_0xf6d6('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf6d6('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 2809385..aa253b4 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 _0xd60c=['name','map','CmHopperHistory','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','include','findAll','catch','show','params','create','body','describe','uniqueid','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack'];(function(_0x193d08,_0x6ecee0){var _0x1be95c=function(_0x354a7e){while(--_0x354a7e){_0x193d08['push'](_0x193d08['shift']());}};_0x1be95c(++_0x6ecee0);}(_0xd60c,0xb3));var _0xcd60=function(_0x1b67fb,_0x3af3b0){_0x1b67fb=_0x1b67fb-0x0;var _0x57c9df=_0xd60c[_0x1b67fb];return _0x57c9df;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd60('0x0'));var zipdir=require(_0xcd60('0x1'));var jsonpatch=require(_0xcd60('0x2'));var rp=require(_0xcd60('0x3'));var moment=require(_0xcd60('0x4'));var BPromise=require(_0xcd60('0x5'));var Mustache=require(_0xcd60('0x6'));var util=require(_0xcd60('0x7'));var path=require('path');var sox=require(_0xcd60('0x8'));var csv=require(_0xcd60('0x9'));var ejs=require(_0xcd60('0xa'));var fs=require('fs');var fs_extra=require(_0xcd60('0xb'));var _=require('lodash');var squel=require(_0xcd60('0xc'));var crypto=require(_0xcd60('0xd'));var jsforce=require(_0xcd60('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xcd60('0x9'));var querystring=require(_0xcd60('0xf'));var Papa=require(_0xcd60('0x10'));var Redis=require(_0xcd60('0x11'));var authService=require(_0xcd60('0x12'));var qs=require(_0xcd60('0x13'));var as=require(_0xcd60('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcd60('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xcd60('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x459ee9,_0x5775c2){_0x5775c2=_0x5775c2||0xcc;return function(_0x565576){if(_0x565576){return _0x459ee9[_0xcd60('0x17')](_0x5775c2);}return _0x459ee9['status'](_0x5775c2)[_0xcd60('0x18')]();};}function respondWithResult(_0x11133a,_0x8a48c1){_0x8a48c1=_0x8a48c1||0xc8;return function(_0x281c4c){if(_0x281c4c){return _0x11133a[_0xcd60('0x19')](_0x8a48c1)[_0xcd60('0x1a')](_0x281c4c);}};}function respondWithFilteredResult(_0x3fef3c,_0x12e274){return function(_0x2a4889){if(_0x2a4889){var _0x153caa=typeof _0x12e274[_0xcd60('0x1b')]===_0xcd60('0x1c')&&typeof _0x12e274['limit']===_0xcd60('0x1c');var _0x390eab=_0x2a4889[_0xcd60('0x1d')];var _0x2df0cb=_0x153caa?0x0:_0x12e274[_0xcd60('0x1b')];var _0x3399f7=_0x153caa?_0x2a4889[_0xcd60('0x1d')]:_0x12e274[_0xcd60('0x1b')]+_0x12e274[_0xcd60('0x1e')];var _0x1e468e;if(_0x3399f7>=_0x390eab){_0x3399f7=_0x390eab;_0x1e468e=0xc8;}else{_0x1e468e=0xce;}_0x3fef3c[_0xcd60('0x19')](_0x1e468e);return _0x3fef3c[_0xcd60('0x1f')](_0xcd60('0x20'),_0x2df0cb+'-'+_0x3399f7+'/'+_0x390eab)[_0xcd60('0x1a')](_0x2a4889);}return null;};}function patchUpdates(_0x2a4479){return function(_0x143bea){try{jsonpatch[_0xcd60('0x21')](_0x143bea,_0x2a4479,!![]);}catch(_0x4f3702){return BPromise['reject'](_0x4f3702);}return _0x143bea[_0xcd60('0x22')]();};}function saveUpdates(_0x561bd4,_0x3f2c7f){return function(_0x11bc3f){if(_0x11bc3f){return _0x11bc3f[_0xcd60('0x23')](_0x561bd4)[_0xcd60('0x24')](function(_0x2cab8c){return _0x2cab8c;});}return null;};}function removeEntity(_0x4ff95b,_0x4063bb){return function(_0x180fd9){if(_0x180fd9){return _0x180fd9[_0xcd60('0x25')]()[_0xcd60('0x24')](function(){_0x4ff95b[_0xcd60('0x19')](0xcc)[_0xcd60('0x18')]();});}};}function handleEntityNotFound(_0x375344,_0x2697fd){return function(_0x38875a){if(!_0x38875a){_0x375344['sendStatus'](0x194);}return _0x38875a;};}function handleError(_0x2af216,_0x368c1f){_0x368c1f=_0x368c1f||0x1f4;return function(_0x42c50d){logger[_0xcd60('0x26')](_0x42c50d[_0xcd60('0x27')]);if(_0x42c50d['name']){delete _0x42c50d[_0xcd60('0x28')];}_0x2af216[_0xcd60('0x19')](_0x368c1f)['send'](_0x42c50d);};}exports['index']=function(_0x591bbc,_0x219ece){var _0x4163f4={},_0x461edc={},_0x400ca9={'count':0x0,'rows':[]};var _0x1f910e=_[_0xcd60('0x29')](db[_0xcd60('0x2a')][_0xcd60('0x2b')],function(_0x565fa9){return{'name':_0x565fa9[_0xcd60('0x2c')],'type':_0x565fa9['type'][_0xcd60('0x2d')]};});_0x461edc[_0xcd60('0x2e')]=_[_0xcd60('0x29')](_0x1f910e,_0xcd60('0x28'));_0x461edc[_0xcd60('0x2f')]=_[_0xcd60('0x30')](_0x591bbc[_0xcd60('0x2f')]);_0x461edc[_0xcd60('0x31')]=_['intersection'](_0x461edc[_0xcd60('0x2e')],_0x461edc[_0xcd60('0x2f')]);_0x4163f4[_0xcd60('0x32')]=_[_0xcd60('0x33')](_0x461edc[_0xcd60('0x2e')],qs[_0xcd60('0x34')](_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x34')]));_0x4163f4[_0xcd60('0x32')]=_0x4163f4[_0xcd60('0x32')][_0xcd60('0x35')]?_0x4163f4[_0xcd60('0x32')]:_0x461edc['model'];if(!_0x591bbc['query'][_0xcd60('0x36')](_0xcd60('0x37'))){_0x4163f4[_0xcd60('0x1e')]=qs[_0xcd60('0x1e')](_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x1e')]);_0x4163f4[_0xcd60('0x1b')]=qs['offset'](_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x1b')]);}_0x4163f4['order']=qs[_0xcd60('0x38')](_0x591bbc[_0xcd60('0x2f')]['sort']);_0x4163f4['where']=qs[_0xcd60('0x31')](_[_0xcd60('0x39')](_0x591bbc[_0xcd60('0x2f')],_0x461edc[_0xcd60('0x31')]),_0x1f910e);if(_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x3a')]){_0x4163f4[_0xcd60('0x3b')]=_[_0xcd60('0x3c')](_0x4163f4[_0xcd60('0x3b')],{'$or':_[_0xcd60('0x29')](_0x1f910e,function(_0x43d6d9){if(_0x43d6d9['type']!=='VIRTUAL'){var _0x55b30e={};_0x55b30e[_0x43d6d9[_0xcd60('0x28')]]={'$like':'%'+_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x3a')]+'%'};return _0x55b30e;}})});}_0x4163f4=_[_0xcd60('0x3c')]({},_0x4163f4,_0x591bbc[_0xcd60('0x3d')]);var _0x45a78c={'where':_0x4163f4['where']};return db['CmHopperHistory']['count'](_0x45a78c)[_0xcd60('0x24')](function(_0x1e610c){_0x400ca9[_0xcd60('0x1d')]=_0x1e610c;if(_0x591bbc[_0xcd60('0x2f')][_0xcd60('0x3e')]){_0x4163f4[_0xcd60('0x3f')]=[{'all':!![]}];}return db[_0xcd60('0x2a')][_0xcd60('0x40')](_0x4163f4);})[_0xcd60('0x24')](function(_0xa728af){_0x400ca9['rows']=_0xa728af;return _0x400ca9;})[_0xcd60('0x24')](respondWithFilteredResult(_0x219ece,_0x4163f4))[_0xcd60('0x41')](handleError(_0x219ece,null));};exports[_0xcd60('0x42')]=function(_0x49af50,_0x49dc42){var _0x113346={'raw':!![],'where':{'id':_0x49af50[_0xcd60('0x43')]['id']}},_0x1850b6={};_0x1850b6['model']=_['keys'](db['CmHopperHistory'][_0xcd60('0x2b')]);_0x1850b6['query']=_[_0xcd60('0x30')](_0x49af50[_0xcd60('0x2f')]);_0x1850b6['filters']=_[_0xcd60('0x33')](_0x1850b6[_0xcd60('0x2e')],_0x1850b6[_0xcd60('0x2f')]);_0x113346['attributes']=_[_0xcd60('0x33')](_0x1850b6[_0xcd60('0x2e')],qs[_0xcd60('0x34')](_0x49af50[_0xcd60('0x2f')]['fields']));_0x113346['attributes']=_0x113346[_0xcd60('0x32')][_0xcd60('0x35')]?_0x113346[_0xcd60('0x32')]:_0x1850b6[_0xcd60('0x2e')];if(_0x49af50[_0xcd60('0x2f')][_0xcd60('0x3e')]){_0x113346[_0xcd60('0x3f')]=[{'all':!![]}];}_0x113346=_[_0xcd60('0x3c')]({},_0x113346,_0x49af50[_0xcd60('0x3d')]);return db[_0xcd60('0x2a')]['find'](_0x113346)['then'](handleEntityNotFound(_0x49dc42,null))['then'](respondWithResult(_0x49dc42,null))[_0xcd60('0x41')](handleError(_0x49dc42,null));};exports[_0xcd60('0x44')]=function(_0x12e9b5,_0x4888e4){return db[_0xcd60('0x2a')]['create'](_0x12e9b5[_0xcd60('0x45')],{})[_0xcd60('0x24')](respondWithResult(_0x4888e4,0xc9))[_0xcd60('0x41')](handleError(_0x4888e4,null));};exports[_0xcd60('0x46')]=function(_0x59d845,_0x5a665b){return db[_0xcd60('0x2a')][_0xcd60('0x46')]()[_0xcd60('0x24')](respondWithResult(_0x5a665b,null))[_0xcd60('0x41')](handleError(_0x5a665b,null));};exports[_0xcd60('0x23')]=function(_0x3bdd7d,_0xd14ed8){if(_0x3bdd7d[_0xcd60('0x45')][_0xcd60('0x47')]){delete _0x3bdd7d[_0xcd60('0x45')][_0xcd60('0x47')];}return db[_0xcd60('0x2a')][_0xcd60('0x48')]({'where':{'uniqueid':_0x3bdd7d[_0xcd60('0x43')]['id']}})[_0xcd60('0x24')](handleEntityNotFound(_0xd14ed8,null))[_0xcd60('0x24')](saveUpdates(_0x3bdd7d['body'],null))[_0xcd60('0x24')](respondWithResult(_0xd14ed8,null))['catch'](handleError(_0xd14ed8,null));}; \ No newline at end of file +var _0x164a=['create','body','describe','uniqueid','eml-format','rimraf','zip-dir','moment','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','CmHopperHistory','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find'];(function(_0x4d36a8,_0x1fd705){var _0x429eb5=function(_0x1d9398){while(--_0x1d9398){_0x4d36a8['push'](_0x4d36a8['shift']());}};_0x429eb5(++_0x1fd705);}(_0x164a,0x9a));var _0xa164=function(_0x2980de,_0x1426a4){_0x2980de=_0x2980de-0x0;var _0x81a4ca=_0x164a[_0x2980de];return _0x81a4ca;};'use strict';var emlformat=require(_0xa164('0x0'));var rimraf=require(_0xa164('0x1'));var zipdir=require(_0xa164('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa164('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa164('0x4'));var csv=require(_0xa164('0x5'));var ejs=require(_0xa164('0x6'));var fs=require('fs');var fs_extra=require(_0xa164('0x7'));var _=require(_0xa164('0x8'));var squel=require(_0xa164('0x9'));var crypto=require(_0xa164('0xa'));var jsforce=require(_0xa164('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xa164('0x5'));var querystring=require(_0xa164('0xc'));var Papa=require(_0xa164('0xd'));var Redis=require(_0xa164('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xa164('0xf'));var as=require(_0xa164('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa164('0x11'))(_0xa164('0x12'));var utils=require(_0xa164('0x13'));var config=require(_0xa164('0x14'));var licenseUtil=require(_0xa164('0x15'));var db=require(_0xa164('0x16'))['db'];function respondWithStatusCode(_0x2a8218,_0x4fb2d2){_0x4fb2d2=_0x4fb2d2||0xcc;return function(_0x1d45df){if(_0x1d45df){return _0x2a8218['sendStatus'](_0x4fb2d2);}return _0x2a8218['status'](_0x4fb2d2)['end']();};}function respondWithResult(_0x4ddbfb,_0x37fbe4){_0x37fbe4=_0x37fbe4||0xc8;return function(_0x3a98b3){if(_0x3a98b3){return _0x4ddbfb[_0xa164('0x17')](_0x37fbe4)[_0xa164('0x18')](_0x3a98b3);}};}function respondWithFilteredResult(_0x4e267c,_0x18e253){return function(_0x362739){if(_0x362739){var _0x33dd37=typeof _0x18e253[_0xa164('0x19')]===_0xa164('0x1a')&&typeof _0x18e253['limit']==='undefined';var _0x5c5cce=_0x362739['count'];var _0x303e23=_0x33dd37?0x0:_0x18e253[_0xa164('0x19')];var _0x1ac8b8=_0x33dd37?_0x362739[_0xa164('0x1b')]:_0x18e253['offset']+_0x18e253[_0xa164('0x1c')];var _0x25c5c9;if(_0x1ac8b8>=_0x5c5cce){_0x1ac8b8=_0x5c5cce;_0x25c5c9=0xc8;}else{_0x25c5c9=0xce;}_0x4e267c[_0xa164('0x17')](_0x25c5c9);return _0x4e267c[_0xa164('0x1d')](_0xa164('0x1e'),_0x303e23+'-'+_0x1ac8b8+'/'+_0x5c5cce)[_0xa164('0x18')](_0x362739);}return null;};}function patchUpdates(_0x119ebb){return function(_0x30ea81){try{jsonpatch['apply'](_0x30ea81,_0x119ebb,!![]);}catch(_0x23112c){return BPromise[_0xa164('0x1f')](_0x23112c);}return _0x30ea81[_0xa164('0x20')]();};}function saveUpdates(_0x58bfb9,_0x42be06){return function(_0x52152a){if(_0x52152a){return _0x52152a[_0xa164('0x21')](_0x58bfb9)[_0xa164('0x22')](function(_0x2c6f83){return _0x2c6f83;});}return null;};}function removeEntity(_0x2dcf31,_0x298743){return function(_0x2eeaf6){if(_0x2eeaf6){return _0x2eeaf6[_0xa164('0x23')]()['then'](function(){_0x2dcf31['status'](0xcc)[_0xa164('0x24')]();});}};}function handleEntityNotFound(_0x357fa7,_0x31c7b2){return function(_0x4d9b3b){if(!_0x4d9b3b){_0x357fa7['sendStatus'](0x194);}return _0x4d9b3b;};}function handleError(_0x157552,_0x29e330){_0x29e330=_0x29e330||0x1f4;return function(_0x4e9edc){logger[_0xa164('0x25')](_0x4e9edc[_0xa164('0x26')]);if(_0x4e9edc['name']){delete _0x4e9edc[_0xa164('0x27')];}_0x157552[_0xa164('0x17')](_0x29e330)[_0xa164('0x28')](_0x4e9edc);};}exports[_0xa164('0x29')]=function(_0xe13fa9,_0xd7ea01){var _0x5416d6={},_0xd14b28={},_0x43fd31={'count':0x0,'rows':[]};var _0x344920=_[_0xa164('0x2a')](db['CmHopperHistory']['rawAttributes'],function(_0x5666d3){return{'name':_0x5666d3[_0xa164('0x2b')],'type':_0x5666d3[_0xa164('0x2c')][_0xa164('0x2d')]};});_0xd14b28[_0xa164('0x2e')]=_['map'](_0x344920,_0xa164('0x27'));_0xd14b28[_0xa164('0x2f')]=_[_0xa164('0x30')](_0xe13fa9[_0xa164('0x2f')]);_0xd14b28[_0xa164('0x31')]=_['intersection'](_0xd14b28['model'],_0xd14b28[_0xa164('0x2f')]);_0x5416d6[_0xa164('0x32')]=_['intersection'](_0xd14b28[_0xa164('0x2e')],qs[_0xa164('0x33')](_0xe13fa9['query']['fields']));_0x5416d6['attributes']=_0x5416d6[_0xa164('0x32')][_0xa164('0x34')]?_0x5416d6[_0xa164('0x32')]:_0xd14b28['model'];if(!_0xe13fa9[_0xa164('0x2f')][_0xa164('0x35')](_0xa164('0x36'))){_0x5416d6[_0xa164('0x1c')]=qs['limit'](_0xe13fa9['query'][_0xa164('0x1c')]);_0x5416d6[_0xa164('0x19')]=qs[_0xa164('0x19')](_0xe13fa9[_0xa164('0x2f')][_0xa164('0x19')]);}_0x5416d6['order']=qs[_0xa164('0x37')](_0xe13fa9[_0xa164('0x2f')][_0xa164('0x37')]);_0x5416d6[_0xa164('0x38')]=qs[_0xa164('0x31')](_[_0xa164('0x39')](_0xe13fa9[_0xa164('0x2f')],_0xd14b28['filters']),_0x344920);if(_0xe13fa9['query']['filter']){_0x5416d6['where']=_['merge'](_0x5416d6[_0xa164('0x38')],{'$or':_[_0xa164('0x2a')](_0x344920,function(_0x196621){if(_0x196621['type']!=='VIRTUAL'){var _0x537da9={};_0x537da9[_0x196621[_0xa164('0x27')]]={'$like':'%'+_0xe13fa9[_0xa164('0x2f')]['filter']+'%'};return _0x537da9;}})});}_0x5416d6=_[_0xa164('0x3a')]({},_0x5416d6,_0xe13fa9[_0xa164('0x3b')]);var _0x2e5163={'where':_0x5416d6[_0xa164('0x38')]};return db[_0xa164('0x3c')][_0xa164('0x1b')](_0x2e5163)['then'](function(_0x528699){_0x43fd31['count']=_0x528699;if(_0xe13fa9[_0xa164('0x2f')][_0xa164('0x3d')]){_0x5416d6[_0xa164('0x3e')]=[{'all':!![]}];}return db[_0xa164('0x3c')][_0xa164('0x3f')](_0x5416d6);})['then'](function(_0x2a43d6){_0x43fd31[_0xa164('0x40')]=_0x2a43d6;return _0x43fd31;})[_0xa164('0x22')](respondWithFilteredResult(_0xd7ea01,_0x5416d6))[_0xa164('0x41')](handleError(_0xd7ea01,null));};exports[_0xa164('0x42')]=function(_0x584873,_0x29e07f){var _0x34eb34={'raw':!![],'where':{'id':_0x584873[_0xa164('0x43')]['id']}},_0x5f4921={};_0x5f4921[_0xa164('0x2e')]=_[_0xa164('0x30')](db['CmHopperHistory'][_0xa164('0x44')]);_0x5f4921['query']=_['keys'](_0x584873['query']);_0x5f4921['filters']=_[_0xa164('0x45')](_0x5f4921[_0xa164('0x2e')],_0x5f4921[_0xa164('0x2f')]);_0x34eb34[_0xa164('0x32')]=_[_0xa164('0x45')](_0x5f4921[_0xa164('0x2e')],qs[_0xa164('0x33')](_0x584873[_0xa164('0x2f')][_0xa164('0x33')]));_0x34eb34[_0xa164('0x32')]=_0x34eb34[_0xa164('0x32')][_0xa164('0x34')]?_0x34eb34[_0xa164('0x32')]:_0x5f4921[_0xa164('0x2e')];if(_0x584873[_0xa164('0x2f')][_0xa164('0x3d')]){_0x34eb34['include']=[{'all':!![]}];}_0x34eb34=_[_0xa164('0x3a')]({},_0x34eb34,_0x584873[_0xa164('0x3b')]);return db[_0xa164('0x3c')][_0xa164('0x46')](_0x34eb34)[_0xa164('0x22')](handleEntityNotFound(_0x29e07f,null))['then'](respondWithResult(_0x29e07f,null))[_0xa164('0x41')](handleError(_0x29e07f,null));};exports[_0xa164('0x47')]=function(_0x5cfba4,_0x197d41){return db[_0xa164('0x3c')][_0xa164('0x47')](_0x5cfba4[_0xa164('0x48')],{})['then'](respondWithResult(_0x197d41,0xc9))[_0xa164('0x41')](handleError(_0x197d41,null));};exports[_0xa164('0x49')]=function(_0x321b31,_0x82ebe4){return db['CmHopperHistory'][_0xa164('0x49')]()['then'](respondWithResult(_0x82ebe4,null))[_0xa164('0x41')](handleError(_0x82ebe4,null));};exports[_0xa164('0x21')]=function(_0x4b5d0b,_0x145691){if(_0x4b5d0b[_0xa164('0x48')][_0xa164('0x4a')]){delete _0x4b5d0b[_0xa164('0x48')][_0xa164('0x4a')];}return db[_0xa164('0x3c')][_0xa164('0x46')]({'where':{'uniqueid':_0x4b5d0b[_0xa164('0x43')]['id']}})['then'](handleEntityNotFound(_0x145691,null))['then'](saveUpdates(_0x4b5d0b[_0xa164('0x48')],null))[_0xa164('0x22')](respondWithResult(_0x145691,null))[_0xa164('0x41')](handleError(_0x145691,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 3d287fa..e5a236a 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 _0xf55c=['moment','bluebird','request-promise','path','rimraf','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','../../config/logger','api'];(function(_0x31ca96,_0x552a76){var _0x42ea4f=function(_0x2a9cec){while(--_0x2a9cec){_0x31ca96['push'](_0x31ca96['shift']());}};_0x42ea4f(++_0x552a76);}(_0xf55c,0x1e7));var _0xcf55=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xf55c[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0xcf55('0x0'));var util=require('util');var logger=require(_0xcf55('0x1'))(_0xcf55('0x2'));var moment=require(_0xcf55('0x3'));var BPromise=require(_0xcf55('0x4'));var rp=require(_0xcf55('0x5'));var fs=require('fs');var path=require(_0xcf55('0x6'));var rimraf=require(_0xcf55('0x7'));var config=require('../../config/environment');var attributes=require(_0xcf55('0x8'));module[_0xcf55('0x9')]=function(_0x14574c,_0x3a6de7){return _0x14574c['define'](_0xcf55('0xa'),attributes,{'tableName':_0xcf55('0xb'),'paranoid':![],'indexes':[{'name':_0xcf55('0xc'),'fields':[_0xcf55('0xc')]},{'name':'uniqueid','fields':[_0xcf55('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe062=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','endtime'];(function(_0x373f34,_0xda7d44){var _0x390528=function(_0x57c22e){while(--_0x57c22e){_0x373f34['push'](_0x373f34['shift']());}};_0x390528(++_0xda7d44);}(_0xe062,0x1b8));var _0x2e06=function(_0x4e7247,_0x15d41f){_0x4e7247=_0x4e7247-0x0;var _0x515d02=_0xe062[_0x4e7247];return _0x515d02;};'use strict';var _=require(_0x2e06('0x0'));var util=require(_0x2e06('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2e06('0x2'));var BPromise=require(_0x2e06('0x3'));var rp=require(_0x2e06('0x4'));var fs=require('fs');var path=require(_0x2e06('0x5'));var rimraf=require(_0x2e06('0x6'));var config=require(_0x2e06('0x7'));var attributes=require(_0x2e06('0x8'));module[_0x2e06('0x9')]=function(_0x7fc3ae,_0x480c91){return _0x7fc3ae['define']('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x2e06('0xa'),'fields':[_0x2e06('0xa')]},{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 955dae2..9684d6c 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 _0x6f7a=['outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','campaign','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','request\x20sent','result','catch','CmHopperHistory','body','options','raw','CreateCmHopperHistory','AvgHandleTime','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','findAll','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null'];(function(_0x36103e,_0x73f0c4){var _0x4a5e7c=function(_0x51608e){while(--_0x51608e){_0x36103e['push'](_0x36103e['shift']());}};_0x4a5e7c(++_0x73f0c4);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x399976,_0x3e841b){_0x399976=_0x399976-0x0;var _0x24c43c=_0x6f7a[_0x399976];return _0x24c43c;};'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')]('CmHopperHistory,\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);});});}exports['CreateCmHopperHistory']=function(_0x4a8827){var _0xba7755=this;return new Promise(function(_0x5298ba,_0x378967){return db[_0xa6f7('0x1a')]['create'](_0x4a8827[_0xa6f7('0x1b')],{'raw':_0x4a8827[_0xa6f7('0x1c')]?_0x4a8827[_0xa6f7('0x1c')][_0xa6f7('0x1d')]===undefined?!![]:![]:!![]})[_0xa6f7('0xe')](function(_0x1aa8dc){logger['info'](_0xa6f7('0x1e'),_0x4a8827);logger[_0xa6f7('0x10')]('CreateCmHopperHistory',_0x4a8827,JSON['stringify'](_0x1aa8dc));_0x5298ba(_0x1aa8dc);})['catch'](function(_0x1de6c9){logger[_0xa6f7('0x13')]('CreateCmHopperHistory',_0x1de6c9['message'],_0x4a8827);_0x378967(_0xba7755['error'](0x1f4,_0x1de6c9[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x1f')]=function(_0x28263e){var _0x5baaa9=this;return new Promise(function(_0x484874,_0x2f4907){return db['CmHopperHistory']['findAll']({'raw':_0x28263e[_0xa6f7('0x1c')]?_0x28263e['options'][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x28263e[_0xa6f7('0x1c')]?_0x28263e[_0xa6f7('0x1c')][_0xa6f7('0x20')]||null:null,'attributes':[[db[_0xa6f7('0x21')]['fn']('COUNT',db['sequelize'][_0xa6f7('0x22')]('id')),_0xa6f7('0x23')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),_0xa6f7('0x27')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x28')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x29'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0xa6f7('0x21')]['fn']('AVG',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x2a')))),_0xa6f7('0x2b')]]})[_0xa6f7('0xe')](function(_0x4d2d38){logger[_0xa6f7('0xf')](_0xa6f7('0x1f'),_0x28263e);logger[_0xa6f7('0x10')]('AvgHandleTime',_0x28263e,JSON[_0xa6f7('0x12')](_0x4d2d38));_0x484874(_0x4d2d38);})['catch'](function(_0x1170c4){logger[_0xa6f7('0x13')](_0xa6f7('0x1f'),_0x1170c4['message'],_0x28263e);_0x2f4907(_0x5baaa9[_0xa6f7('0x13')](0x1f4,_0x1170c4[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x2c')]=function(_0x37b833){var _0x14444c=this;return new Promise(function(_0x28490e,_0x4a28a7){return db[_0xa6f7('0x1a')][_0xa6f7('0x2d')]({'raw':_0x37b833[_0xa6f7('0x1c')]?_0x37b833[_0xa6f7('0x1c')][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x37b833[_0xa6f7('0x1c')]?_0x37b833[_0xa6f7('0x1c')][_0xa6f7('0x20')]||null:null,'attributes':[['campaign',_0xa6f7('0x2e')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x200,\x201,\x20null'))),_0xa6f7('0x2f')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x30')))),_0xa6f7('0x31')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x32')))),_0xa6f7('0x33')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x34')))),_0xa6f7('0x35')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xa6f7('0x36')],[db['sequelize']['fn']('COUNT',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x37')))),_0xa6f7('0x38')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')]('`state`\x20=\x2012,\x201,\x20null'))),_0xa6f7('0x39')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x3a')))),_0xa6f7('0x3b')],[db[_0xa6f7('0x21')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xa6f7('0x21')]['literal'](_0xa6f7('0x3c')))),'outboundOriginateFailureCallsDay'],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x3d')))),_0xa6f7('0x3e')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db['sequelize'][_0xa6f7('0x25')]('`state`\x20=\x2016,\x201,\x20null'))),_0xa6f7('0x3f')],[db['sequelize']['fn']('COUNT',db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x40')))),_0xa6f7('0x3e')],[db['sequelize']['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db['sequelize'][_0xa6f7('0x25')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0xa6f7('0x41')]],'group':[_0xa6f7('0x42')]})[_0xa6f7('0xe')](function(_0x55369a){logger[_0xa6f7('0xf')]('GetVoiceQueueHopperHistory',_0x37b833);logger[_0xa6f7('0x10')](_0xa6f7('0x2c'),_0x37b833,JSON[_0xa6f7('0x12')](_0x55369a));_0x28490e(_0x55369a);})[_0xa6f7('0x19')](function(_0xa6bff9){logger['error']('GetVoiceQueueHopperHistory',_0xa6bff9[_0xa6f7('0x16')],_0x37b833);_0x4a28a7(_0x14444c[_0xa6f7('0x13')](0x1f4,_0xa6bff9[_0xa6f7('0x16')]));});});};exports[_0xa6f7('0x43')]=function(_0x5931e9){var _0x9d901e=this;return new Promise(function(_0x2105dd,_0x14d841){return db[_0xa6f7('0x1a')][_0xa6f7('0x2d')]({'raw':_0x5931e9[_0xa6f7('0x1c')]?_0x5931e9['options'][_0xa6f7('0x1d')]===undefined?!![]:![]:!![],'where':_0x5931e9[_0xa6f7('0x1c')]?_0x5931e9[_0xa6f7('0x1c')]['where']||null:null,'attributes':[[_0xa6f7('0x42'),_0xa6f7('0x2e')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db['sequelize']['col']('id')),_0xa6f7('0x44')],[db[_0xa6f7('0x21')]['fn'](_0xa6f7('0x24'),db[_0xa6f7('0x21')]['fn']('IF',db[_0xa6f7('0x21')][_0xa6f7('0x25')](_0xa6f7('0x26')))),'ivrAnswerCallsDay']],'group':[_0xa6f7('0x42')]})[_0xa6f7('0xe')](function(_0x2f131c){logger[_0xa6f7('0xf')](_0xa6f7('0x43'),_0x5931e9);logger[_0xa6f7('0x10')](_0xa6f7('0x43'),_0x5931e9,JSON[_0xa6f7('0x12')](_0x2f131c));_0x2105dd(_0x2f131c);})[_0xa6f7('0x19')](function(_0x186956){logger[_0xa6f7('0x13')]('GetCampaignHopperHistory',_0x186956[_0xa6f7('0x16')],_0x5931e9);_0x14d841(_0x9d901e['error'](0x1f4,_0x186956[_0xa6f7('0x16')]));});});}; \ No newline at end of file +var _0x3c81=['debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','findAll','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x52b37a,_0x100dee){var _0x2c1790=function(_0x325b73){while(--_0x325b73){_0x52b37a['push'](_0x52b37a['shift']());}};_0x2c1790(++_0x100dee);}(_0x3c81,0x102));var _0x13c8=function(_0x42bec7,_0x1f9749){_0x42bec7=_0x42bec7-0x0;var _0x15e38a=_0x3c81[_0x42bec7];return _0x15e38a;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});}exports[_0x13c8('0x15')]=function(_0xce1ad2){var _0x28f07e=this;return new Promise(function(_0x346417,_0x251c38){return db[_0x13c8('0x16')][_0x13c8('0x17')](_0xce1ad2[_0x13c8('0x18')],{'raw':_0xce1ad2['options']?_0xce1ad2[_0x13c8('0x19')][_0x13c8('0x1a')]===undefined?!![]:![]:!![]})[_0x13c8('0xa')](function(_0x313ea3){logger['info'](_0x13c8('0x15'),_0xce1ad2);logger[_0x13c8('0xe')](_0x13c8('0x15'),_0xce1ad2,JSON[_0x13c8('0x10')](_0x313ea3));_0x346417(_0x313ea3);})[_0x13c8('0x1b')](function(_0x2fc123){logger['error'](_0x13c8('0x15'),_0x2fc123[_0x13c8('0x13')],_0xce1ad2);_0x251c38(_0x28f07e[_0x13c8('0x11')](0x1f4,_0x2fc123[_0x13c8('0x13')]));});});};exports['AvgHandleTime']=function(_0x1770e5){var _0x458217=this;return new Promise(function(_0x4e392f,_0x49b552){return db[_0x13c8('0x16')][_0x13c8('0x1c')]({'raw':_0x1770e5['options']?_0x1770e5['options'][_0x13c8('0x1a')]===undefined?!![]:![]:!![],'where':_0x1770e5[_0x13c8('0x19')]?_0x1770e5['options']['where']||null:null,'attributes':[[db[_0x13c8('0x1d')]['fn']('COUNT',db['sequelize'][_0x13c8('0x1e')]('id')),_0x13c8('0x1f')],[db[_0x13c8('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x21')))),_0x13c8('0x22')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize'][_0x13c8('0x20')](_0x13c8('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize'][_0x13c8('0x20')](_0x13c8('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x26'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x27')))),_0x13c8('0x28')],[db[_0x13c8('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x13c8('0x29')]]})['then'](function(_0x1fdf7d){logger['info'](_0x13c8('0x2a'),_0x1770e5);logger[_0x13c8('0xe')](_0x13c8('0x2a'),_0x1770e5,JSON[_0x13c8('0x10')](_0x1fdf7d));_0x4e392f(_0x1fdf7d);})[_0x13c8('0x1b')](function(_0x42a176){logger[_0x13c8('0x11')]('AvgHandleTime',_0x42a176[_0x13c8('0x13')],_0x1770e5);_0x49b552(_0x458217[_0x13c8('0x11')](0x1f4,_0x42a176['message']));});});};exports[_0x13c8('0x2b')]=function(_0x8ae2e5){var _0x2bfbf4=this;return new Promise(function(_0x479399,_0x4a6225){return db['CmHopperHistory'][_0x13c8('0x1c')]({'raw':_0x8ae2e5[_0x13c8('0x19')]?_0x8ae2e5[_0x13c8('0x19')][_0x13c8('0x1a')]===undefined?!![]:![]:!![],'where':_0x8ae2e5[_0x13c8('0x19')]?_0x8ae2e5[_0x13c8('0x19')][_0x13c8('0x2c')]||null:null,'attributes':[[_0x13c8('0x2d'),_0x13c8('0x2e')],[db['sequelize']['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x30')))),_0x13c8('0x31')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x21')))),_0x13c8('0x32')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x33')))),_0x13c8('0x34')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x35')))),'outboundCongestionCallsDay'],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x13c8('0x36')],[db['sequelize']['fn'](_0x13c8('0x23'),db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x37')))),_0x13c8('0x38')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x13c8('0x39')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')]['literal'](_0x13c8('0x3a')))),_0x13c8('0x3b')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize'][_0x13c8('0x20')](_0x13c8('0x3c')))),_0x13c8('0x3d')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x3e')))),_0x13c8('0x3f')],[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x40')))),_0x13c8('0x3d')],[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x13c8('0x2d')]})[_0x13c8('0xa')](function(_0x55d353){logger[_0x13c8('0xb')](_0x13c8('0x2b'),_0x8ae2e5);logger['debug'](_0x13c8('0x2b'),_0x8ae2e5,JSON['stringify'](_0x55d353));_0x479399(_0x55d353);})[_0x13c8('0x1b')](function(_0x1f67bd){logger[_0x13c8('0x11')]('GetVoiceQueueHopperHistory',_0x1f67bd[_0x13c8('0x13')],_0x8ae2e5);_0x4a6225(_0x2bfbf4[_0x13c8('0x11')](0x1f4,_0x1f67bd['message']));});});};exports[_0x13c8('0x41')]=function(_0x52b70a){var _0x95289e=this;return new Promise(function(_0x5eda4c,_0x1614f8){return db[_0x13c8('0x16')][_0x13c8('0x1c')]({'raw':_0x52b70a['options']?_0x52b70a[_0x13c8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x52b70a['options']?_0x52b70a['options']['where']||null:null,'attributes':[['campaign',_0x13c8('0x2e')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')][_0x13c8('0x1e')]('id')),_0x13c8('0x42')],[db[_0x13c8('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x21')))),_0x13c8('0x43')]],'group':[_0x13c8('0x2d')]})[_0x13c8('0xa')](function(_0x4678a0){logger[_0x13c8('0xb')]('GetCampaignHopperHistory',_0x52b70a);logger[_0x13c8('0xe')](_0x13c8('0x41'),_0x52b70a,JSON['stringify'](_0x4678a0));_0x5eda4c(_0x4678a0);})[_0x13c8('0x1b')](function(_0x2ebbcd){logger[_0x13c8('0x11')](_0x13c8('0x41'),_0x2ebbcd[_0x13c8('0x13')],_0x52b70a);_0x1614f8(_0x95289e[_0x13c8('0x11')](0x1f4,_0x2ebbcd[_0x13c8('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 923ff04..bb60695 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 _0x7151=['fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','exports','connect-timeout','express'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x7151,0x1ae));var _0x1715=function(_0x2d3206,_0x434cf5){_0x2d3206=_0x2d3206-0x0;var _0x18702d=_0x7151[_0x2d3206];return _0x18702d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1715('0x0'));var express=require(_0x1715('0x1'));var router=express['Router']();var fs_extra=require(_0x1715('0x2'));var auth=require(_0x1715('0x3'));var interaction=require(_0x1715('0x4'));var config=require('../../config/environment');var controller=require('./cmHopperHistory.controller');router['get']('/',auth[_0x1715('0x5')](),controller[_0x1715('0x6')]);router[_0x1715('0x7')](_0x1715('0x8'),auth['isAuthenticated'](),controller[_0x1715('0x9')]);router[_0x1715('0x7')](_0x1715('0xa'),auth[_0x1715('0x5')](),controller[_0x1715('0xb')]);router[_0x1715('0xc')]('/',auth[_0x1715('0x5')](),controller['create']);router[_0x1715('0xd')](_0x1715('0xa'),auth['isAuthenticated'](),controller[_0x1715('0xe')]);module[_0x1715('0xf')]=router; \ No newline at end of file +var _0xe14c=['post','create','put','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','show'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe14c,0x1e4));var _0xce14=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe14c[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xce14('0x0'));var util=require('util');var path=require(_0xce14('0x1'));var timeout=require(_0xce14('0x2'));var express=require('express');var router=express[_0xce14('0x3')]();var fs_extra=require(_0xce14('0x4'));var auth=require(_0xce14('0x5'));var interaction=require(_0xce14('0x6'));var config=require(_0xce14('0x7'));var controller=require(_0xce14('0x8'));router[_0xce14('0x9')]('/',auth[_0xce14('0xa')](),controller['index']);router[_0xce14('0x9')]('/describe',auth[_0xce14('0xa')](),controller['describe']);router[_0xce14('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xce14('0xb')]);router[_0xce14('0xc')]('/',auth[_0xce14('0xa')](),controller[_0xce14('0xd')]);router[_0xce14('0xe')]('/:id',auth[_0xce14('0xa')](),controller['update']);module[_0xce14('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 327b67e..cb97e52 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 _0x6737=['exports','STRING'];(function(_0x5d79d9,_0x4b4a43){var _0x1bf590=function(_0x147325){while(--_0x147325){_0x5d79d9['push'](_0x5d79d9['shift']());}};_0x1bf590(++_0x4b4a43);}(_0x6737,0xe2));var _0x7673=function(_0x4981d3,_0x952abb){_0x4981d3=_0x4981d3-0x0;var _0x433b80=_0x6737[_0x4981d3];return _0x433b80;};'use strict';var Sequelize=require('sequelize');module[_0x7673('0x0')]={'name':{'type':Sequelize[_0x7673('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7673('0x1')]},'dialPrefix':{'type':Sequelize[_0x7673('0x1')]}}; \ No newline at end of file +var _0x8664=['STRING','name','sequelize','exports'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8664,0x11a));var _0x4866=function(_0x7c52da,_0x221219){_0x7c52da=_0x7c52da-0x0;var _0x25173c=_0x8664[_0x7c52da];return _0x25173c;};'use strict';var Sequelize=require(_0x4866('0x0'));module[_0x4866('0x1')]={'name':{'type':Sequelize[_0x4866('0x2')],'unique':_0x4866('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4866('0x2')]},'dialPrefix':{'type':Sequelize[_0x4866('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index de5507d..32a5760 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 _0xc996=['rows','catch','show','params','keys','options','find','create','role','Lists','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','findOne','order','ListId','addContacts','CmContact','tags','join','push','each','omit','ids','success','dataValues','errors','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','ContactItemType','OrderBy','alias','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','select','item','CmContactId\x20=\x20c.id','description','ItemTypeId\x20=\x20?','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','transaction','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','isArray','userCmList:remove','getAgents','info','sequelize','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll'];(function(_0x37f229,_0x2417cc){var _0x4fe43a=function(_0x873d9f){while(--_0x873d9f){_0x37f229['push'](_0x37f229['shift']());}};_0x4fe43a(++_0x2417cc);}(_0xc996,0x105));var _0x6c99=function(_0x19aaa2,_0x4399b6){_0x19aaa2=_0x19aaa2-0x0;var _0x3f754e=_0xc996[_0x19aaa2];return _0x3f754e;};'use strict';var emlformat=require(_0x6c99('0x0'));var rimraf=require(_0x6c99('0x1'));var zipdir=require(_0x6c99('0x2'));var jsonpatch=require(_0x6c99('0x3'));var rp=require(_0x6c99('0x4'));var moment=require(_0x6c99('0x5'));var BPromise=require(_0x6c99('0x6'));var Mustache=require(_0x6c99('0x7'));var util=require('util');var path=require(_0x6c99('0x8'));var sox=require(_0x6c99('0x9'));var csv=require(_0x6c99('0xa'));var ejs=require(_0x6c99('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x6c99('0xc'));var crypto=require('crypto');var jsforce=require(_0x6c99('0xd'));var deskjs=require(_0x6c99('0xe'));var toCsv=require(_0x6c99('0xa'));var querystring=require(_0x6c99('0xf'));var Papa=require(_0x6c99('0x10'));var Redis=require(_0x6c99('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6c99('0x12'));var as=require(_0x6c99('0x13'));var hardwareService=require(_0x6c99('0x14'));var logger=require(_0x6c99('0x15'))(_0x6c99('0x16'));var utils=require(_0x6c99('0x17'));var config=require(_0x6c99('0x18'));var licenseUtil=require(_0x6c99('0x19'));var db=require(_0x6c99('0x1a'))['db'];var csv_results;config[_0x6c99('0x1b')]=_[_0x6c99('0x1c')](config[_0x6c99('0x1b')],{'host':_0x6c99('0x1d'),'port':0x18eb});var socket=require(_0x6c99('0x1e'))(new Redis(config[_0x6c99('0x1b')]));require(_0x6c99('0x1f'))['register'](socket);function respondWithStatusCode(_0x158636,_0x57c487){_0x57c487=_0x57c487||0xcc;return function(_0x12946d){if(_0x12946d){return _0x158636['sendStatus'](_0x57c487);}return _0x158636[_0x6c99('0x20')](_0x57c487)[_0x6c99('0x21')]();};}function respondWithResult(_0x23ac90,_0x3950a4){_0x3950a4=_0x3950a4||0xc8;return function(_0x27ee56){if(_0x27ee56){return _0x23ac90[_0x6c99('0x20')](_0x3950a4)[_0x6c99('0x22')](_0x27ee56);}};}function respondWithFilteredResult(_0x1c96e2,_0x4f619a){return function(_0x78fe3f){if(_0x78fe3f){var _0x391fe7=typeof _0x4f619a[_0x6c99('0x23')]===_0x6c99('0x24')&&typeof _0x4f619a[_0x6c99('0x25')]==='undefined';var _0x548ff9=_0x78fe3f[_0x6c99('0x26')];var _0x3dc419=_0x391fe7?0x0:_0x4f619a[_0x6c99('0x23')];var _0x59c3c3=_0x391fe7?_0x78fe3f[_0x6c99('0x26')]:_0x4f619a[_0x6c99('0x23')]+_0x4f619a[_0x6c99('0x25')];var _0x12f3f2;if(_0x59c3c3>=_0x548ff9){_0x59c3c3=_0x548ff9;_0x12f3f2=0xc8;}else{_0x12f3f2=0xce;}_0x1c96e2[_0x6c99('0x20')](_0x12f3f2);return _0x1c96e2[_0x6c99('0x27')](_0x6c99('0x28'),_0x3dc419+'-'+_0x59c3c3+'/'+_0x548ff9)[_0x6c99('0x22')](_0x78fe3f);}return null;};}function patchUpdates(_0x52b582){return function(_0x512b24){try{jsonpatch['apply'](_0x512b24,_0x52b582,!![]);}catch(_0x21f264){return BPromise[_0x6c99('0x29')](_0x21f264);}return _0x512b24[_0x6c99('0x2a')]();};}function saveUpdates(_0xbfaf1e,_0xd5703f){return function(_0x539903){if(_0x539903){return _0x539903[_0x6c99('0x2b')](_0xbfaf1e)[_0x6c99('0x2c')](function(_0x347bba){return _0x347bba;});}return null;};}function removeEntity(_0x4db814,_0x1ff2db){return function(_0x34e7ba){if(_0x34e7ba){return _0x34e7ba[_0x6c99('0x2d')]()[_0x6c99('0x2c')](function(){var _0x4152f8=_0x34e7ba[_0x6c99('0x2e')]({'plain':!![]});var _0x1f9d44='Lists';return db[_0x6c99('0x2f')][_0x6c99('0x2d')]({'where':{'type':_0x1f9d44,'resourceId':_0x4152f8['id']}})['then'](function(){return _0x34e7ba;});})['then'](function(){_0x4db814[_0x6c99('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fc67e,_0x482883){return function(_0x5dd92e){if(!_0x5dd92e){_0x2fc67e['sendStatus'](0x194);}return _0x5dd92e;};}function handleError(_0x268b1b,_0x24961c){_0x24961c=_0x24961c||0x1f4;return function(_0x53bfed){logger[_0x6c99('0x30')](_0x53bfed[_0x6c99('0x31')]);if(_0x53bfed['name']){delete _0x53bfed[_0x6c99('0x32')];}_0x268b1b[_0x6c99('0x20')](_0x24961c)[_0x6c99('0x33')](_0x53bfed);};}exports[_0x6c99('0x34')]=function(_0x39e021,_0x204669){var _0x3b4b5c={},_0x2ae2e8={},_0x28f593={'count':0x0,'rows':[]};var _0x2920b6=_['map'](db[_0x6c99('0x35')][_0x6c99('0x36')],function(_0x5103dd){return{'name':_0x5103dd[_0x6c99('0x37')],'type':_0x5103dd['type'][_0x6c99('0x38')]};});_0x2ae2e8['model']=_[_0x6c99('0x39')](_0x2920b6,_0x6c99('0x32'));_0x2ae2e8[_0x6c99('0x3a')]=_['keys'](_0x39e021['query']);_0x2ae2e8[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x2ae2e8[_0x6c99('0x3d')],_0x2ae2e8[_0x6c99('0x3a')]);_0x3b4b5c[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x2ae2e8[_0x6c99('0x3d')],qs[_0x6c99('0x3f')](_0x39e021[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x3b4b5c[_0x6c99('0x3e')]=_0x3b4b5c['attributes'][_0x6c99('0x40')]?_0x3b4b5c[_0x6c99('0x3e')]:_0x2ae2e8[_0x6c99('0x3d')];if(!_0x39e021['query'][_0x6c99('0x41')](_0x6c99('0x42'))){_0x3b4b5c['limit']=qs[_0x6c99('0x25')](_0x39e021[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x3b4b5c[_0x6c99('0x23')]=qs[_0x6c99('0x23')](_0x39e021['query'][_0x6c99('0x23')]);}_0x3b4b5c['order']=qs['sort'](_0x39e021[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x3b4b5c[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_[_0x6c99('0x45')](_0x39e021[_0x6c99('0x3a')],_0x2ae2e8['filters']),_0x2920b6);if(_0x39e021[_0x6c99('0x3a')][_0x6c99('0x46')]){_0x3b4b5c[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x3b4b5c['where'],{'$or':_[_0x6c99('0x39')](_0x2920b6,function(_0x44efa9){if(_0x44efa9[_0x6c99('0x48')]!==_0x6c99('0x49')){var _0x58939d={};_0x58939d[_0x44efa9[_0x6c99('0x32')]]={'$like':'%'+_0x39e021[_0x6c99('0x3a')]['filter']+'%'};return _0x58939d;}})});}_0x3b4b5c=_[_0x6c99('0x47')]({},_0x3b4b5c,_0x39e021['options']);var _0xd0cc8e={'where':_0x3b4b5c[_0x6c99('0x44')]};return db[_0x6c99('0x35')][_0x6c99('0x26')](_0xd0cc8e)[_0x6c99('0x2c')](function(_0x4cd04c){_0x28f593['count']=_0x4cd04c;if(_0x39e021[_0x6c99('0x3a')][_0x6c99('0x4a')]){_0x3b4b5c[_0x6c99('0x4b')]=[{'all':!![]}];}return db[_0x6c99('0x35')][_0x6c99('0x4c')](_0x3b4b5c);})['then'](function(_0x51ad1a){_0x28f593[_0x6c99('0x4d')]=_0x51ad1a;return _0x28f593;})[_0x6c99('0x2c')](respondWithFilteredResult(_0x204669,_0x3b4b5c))[_0x6c99('0x4e')](handleError(_0x204669,null));};exports[_0x6c99('0x4f')]=function(_0x1a164a,_0x296391){var _0x58ac56={'raw':![],'where':{'id':_0x1a164a[_0x6c99('0x50')]['id']}},_0x32b7e5={};_0x32b7e5['model']=_[_0x6c99('0x51')](db['CmList'][_0x6c99('0x36')]);_0x32b7e5['query']=_[_0x6c99('0x51')](_0x1a164a[_0x6c99('0x3a')]);_0x32b7e5[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x32b7e5[_0x6c99('0x3d')],_0x32b7e5[_0x6c99('0x3a')]);_0x58ac56[_0x6c99('0x3e')]=_['intersection'](_0x32b7e5['model'],qs[_0x6c99('0x3f')](_0x1a164a[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x58ac56[_0x6c99('0x3e')]=_0x58ac56[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x58ac56[_0x6c99('0x3e')]:_0x32b7e5[_0x6c99('0x3d')];if(_0x1a164a[_0x6c99('0x3a')][_0x6c99('0x4a')]){_0x58ac56[_0x6c99('0x4b')]=[{'all':!![]}];}_0x58ac56=_['merge']({},_0x58ac56,_0x1a164a[_0x6c99('0x52')]);return db[_0x6c99('0x35')][_0x6c99('0x53')](_0x58ac56)[_0x6c99('0x2c')](handleEntityNotFound(_0x296391,null))[_0x6c99('0x2c')](respondWithResult(_0x296391,null))[_0x6c99('0x4e')](handleError(_0x296391,null));};exports['create']=function(_0xd17221,_0x4bcc0f){return db[_0x6c99('0x35')][_0x6c99('0x54')](_0xd17221['body'],{})[_0x6c99('0x2c')](function(_0x441daa){var _0x51ea1b=_0xd17221['user'][_0x6c99('0x2e')]({'plain':!![]});if(!_0x51ea1b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x51ea1b[_0x6c99('0x55')]==='user'){var _0x30cc64=_0x441daa[_0x6c99('0x2e')]({'plain':!![]});var _0x1d2c89=_0x6c99('0x56');return db[_0x6c99('0x57')][_0x6c99('0x53')]({'where':{'name':_0x1d2c89,'userProfileId':_0x51ea1b[_0x6c99('0x58')]},'raw':!![]})[_0x6c99('0x2c')](function(_0x342172){if(_0x342172&&_0x342172[_0x6c99('0x59')]===0x0){return db[_0x6c99('0x2f')]['create']({'name':_0x30cc64[_0x6c99('0x32')],'resourceId':_0x30cc64['id'],'type':_0x342172['name'],'sectionId':_0x342172['id']},{})[_0x6c99('0x2c')](function(){return _0x441daa;});}else{return _0x441daa;}})[_0x6c99('0x4e')](function(_0x2a8567){logger[_0x6c99('0x30')](_0x6c99('0x5a'),_0x2a8567);throw _0x2a8567;});}return _0x441daa;})['then'](respondWithResult(_0x4bcc0f,0xc9))['catch'](handleError(_0x4bcc0f,null));};exports[_0x6c99('0x2b')]=function(_0x192cdb,_0x2569bd){if(_0x192cdb[_0x6c99('0x5b')]['id']){delete _0x192cdb['body']['id'];}return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x192cdb['params']['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x2569bd,null))['then'](saveUpdates(_0x192cdb['body'],null))[_0x6c99('0x2c')](respondWithResult(_0x2569bd,null))['catch'](handleError(_0x2569bd,null));};exports[_0x6c99('0x2d')]=function(_0x9f06bc,_0x1082dc){return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x9f06bc[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x1082dc,null))[_0x6c99('0x2c')](removeEntity(_0x1082dc,null))['catch'](handleError(_0x1082dc,null));};exports['describe']=function(_0xa10d6d,_0x2f8013){return db['CmList'][_0x6c99('0x5c')]()[_0x6c99('0x2c')](respondWithResult(_0x2f8013,null))[_0x6c99('0x4e')](handleError(_0x2f8013,null));};exports[_0x6c99('0x5d')]=function(_0x59bbb2,_0x2b579b,_0x25f15d){if(_0x59bbb2[_0x6c99('0x5b')]['id']){delete _0x59bbb2['body']['id'];}return db['CmList']['find']({'where':{'id':_0x59bbb2[_0x6c99('0x50')]['id']}})['then'](handleEntityNotFound(_0x2b579b,null))[_0x6c99('0x2c')](function(_0x43cb82){if(_0x43cb82){_0x59bbb2[_0x6c99('0x5b')]['ListId']=_0x43cb82['id'];return db[_0x6c99('0x5e')]['create'](_0x59bbb2['body']);}})[_0x6c99('0x2c')](respondWithResult(_0x2b579b,null))['catch'](handleError(_0x2b579b,null));};exports['getDispositions']=function(_0x34b6e6,_0x26866b,_0x582d3b){var _0x3004ac={'raw':![],'where':{}};var _0x1778a8={};var _0x5e2656={'count':0x0,'rows':[]};return db[_0x6c99('0x35')][_0x6c99('0x5f')]({'where':{'id':_0x34b6e6[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x26866b,null))[_0x6c99('0x2c')](function(_0x2d2bbd){if(_0x2d2bbd){_0x1778a8[_0x6c99('0x3d')]=_[_0x6c99('0x51')](db['Disposition'][_0x6c99('0x36')]);_0x1778a8[_0x6c99('0x3a')]=_['keys'](_0x34b6e6[_0x6c99('0x3a')]);_0x1778a8['filters']=_[_0x6c99('0x3c')](_0x1778a8[_0x6c99('0x3d')],_0x1778a8[_0x6c99('0x3a')]);_0x3004ac[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x1778a8[_0x6c99('0x3d')],qs[_0x6c99('0x3f')](_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x3004ac[_0x6c99('0x3e')]=_0x3004ac[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x3004ac[_0x6c99('0x3e')]:_0x1778a8[_0x6c99('0x3d')];if(!_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x41')]('nolimit')){_0x3004ac['limit']=qs[_0x6c99('0x25')](_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x3004ac[_0x6c99('0x23')]=qs['offset'](_0x34b6e6[_0x6c99('0x3a')]['offset']);}_0x3004ac[_0x6c99('0x60')]=qs['sort'](_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x3004ac[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_[_0x6c99('0x45')](_0x34b6e6[_0x6c99('0x3a')],_0x1778a8[_0x6c99('0x3b')]));_0x3004ac['where'][_0x6c99('0x61')]=_0x2d2bbd['id'];if(_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x46')]){_0x3004ac[_0x6c99('0x44')]=_['merge'](_0x3004ac[_0x6c99('0x44')],{'$or':_['map'](_0x3004ac[_0x6c99('0x3e')],function(_0x41797e){var _0x233a2b={};_0x233a2b[_0x41797e]={'$like':'%'+_0x34b6e6[_0x6c99('0x3a')][_0x6c99('0x46')]+'%'};return _0x233a2b;})});}_0x3004ac=_[_0x6c99('0x47')]({},_0x3004ac,_0x34b6e6[_0x6c99('0x52')]);return db['Disposition'][_0x6c99('0x26')]({'where':_0x3004ac[_0x6c99('0x44')]})['then'](function(_0x3a5906){_0x5e2656['count']=_0x3a5906;if(_0x34b6e6['query']['includeAll']){_0x3004ac[_0x6c99('0x4b')]=[{'all':!![]}];}return db[_0x6c99('0x5e')][_0x6c99('0x4c')](_0x3004ac);})['then'](function(_0x3a5894){_0x5e2656['rows']=_0x3a5894;return _0x5e2656;});}})[_0x6c99('0x2c')](respondWithFilteredResult(_0x26866b,_0x3004ac))[_0x6c99('0x4e')](handleError(_0x26866b,null));};exports['removeDispositions']=function(_0x5717fe,_0x2c2cae,_0x1736eb){return db['CmList'][_0x6c99('0x53')]({'where':{'id':_0x5717fe['params']['id']}})['then'](handleEntityNotFound(_0x2c2cae,null))['then'](function(_0x111fda){if(_0x111fda){return _0x111fda['removeDispositions'](_0x5717fe['query']['ids']);}})[_0x6c99('0x2c')](respondWithStatusCode(_0x2c2cae,null))['catch'](handleError(_0x2c2cae,null));};exports[_0x6c99('0x62')]=function(_0x24f4be,_0xd36774,_0x3ed533){return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x24f4be[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0xd36774,null))['then'](function(_0x431cb2){if(_0x431cb2){var _0x4587f7=[];var _0xd3dac8={'success':[],'errors':[]};return db[_0x6c99('0x63')]['describe']()[_0x6c99('0x2c')](function(_0x30bb73){if(_0x24f4be[_0x6c99('0x5b')]['tags']&&_['isArray'](_0x24f4be[_0x6c99('0x5b')][_0x6c99('0x64')])){if(_0x24f4be[_0x6c99('0x5b')]['tags'][_0x6c99('0x40')]){_0x24f4be[_0x6c99('0x5b')][_0x6c99('0x64')]=_0x24f4be['body'][_0x6c99('0x64')][_0x6c99('0x65')](';')+';';}else{_0x24f4be[_0x6c99('0x5b')][_0x6c99('0x64')]=null;}}else{_0x24f4be[_0x6c99('0x5b')]['tags']=null;}if(_0x24f4be['body']&&_['isArray'](_0x24f4be[_0x6c99('0x5b')])){for(var _0x315d14=0x0;_0x315d14<_0x24f4be[_0x6c99('0x5b')]['length'];_0x315d14+=0x1){_0x24f4be[_0x6c99('0x5b')][_0x315d14]['ListId']=_0x24f4be[_0x6c99('0x50')]['id'];_0x4587f7[_0x6c99('0x66')](_0x24f4be['body'][_0x315d14]);}return BPromise[_0x6c99('0x67')](_0x4587f7,function(_0x545dd7){return db['CmContact'][_0x6c99('0x54')](_[_0x6c99('0x68')](_0x545dd7,[_0x6c99('0x69'),'id'])||{},{'fields':_[_0x6c99('0x51')](_0x30bb73),'raw':!![]})[_0x6c99('0x2c')](function(_0x5f3002){_0xd3dac8[_0x6c99('0x6a')][_0x6c99('0x66')](_0x5f3002[_0x6c99('0x6b')]);})[_0x6c99('0x4e')](function(_0x5b5580){_0xd3dac8[_0x6c99('0x6c')]['push']({'data':_0x545dd7,'error':_0x5b5580['message']});});})[_0x6c99('0x2c')](function(_0x4fd7d3){return _0xd3dac8;})[_0x6c99('0x4e')](function(_0x5a527b){return _0x5a527b;});}else{_0xd36774['status'](0x190)['json']({'message':_0x6c99('0x6d')});}});}})['then'](respondWithResult(_0xd36774,null))['catch'](handleError(_0xd36774,null));};exports[_0x6c99('0x6e')]=function(_0x315af5,_0x9e288b,_0x3590a7){var _0x1712ed;return db[_0x6c99('0x35')]['find']({'where':{'id':_0x315af5[_0x6c99('0x50')]['id']},'include':[{'model':db[_0x6c99('0x6f')],'as':_0x6c99('0x70')}]})[_0x6c99('0x2c')](handleEntityNotFound(_0x9e288b,null))[_0x6c99('0x2c')](function(_0x2891a1){if(_0x2891a1){_0x1712ed=_0x2891a1;return db[_0x6c99('0x63')][_0x6c99('0x36')];}})['then'](function(_0x36e1d5){if(_0x36e1d5){var _0x312993={};var _0xd0b0a6={};_0xd0b0a6[_0x6c99('0x3d')]=_[_0x6c99('0x71')](_['keys'](_0x36e1d5),_['map'](_0x1712ed[_0x6c99('0x70')],function(_0x5b0786){return util[_0x6c99('0x72')](_0x6c99('0x73'),_0x5b0786['id']);}));_0xd0b0a6['query']=_[_0x6c99('0x51')](_0x315af5['query']);_0xd0b0a6['filters']=_[_0x6c99('0x3c')](_0xd0b0a6['model'],_0xd0b0a6['query']);_0x312993[_0x6c99('0x3e')]=_['intersection'](_0xd0b0a6['model'],qs[_0x6c99('0x3f')](_0x315af5[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x312993[_0x6c99('0x3e')]=_0x312993['attributes'][_0x6c99('0x40')]?_0x312993[_0x6c99('0x3e')]:_0xd0b0a6[_0x6c99('0x3d')];if(!_0x315af5[_0x6c99('0x3a')][_0x6c99('0x41')](_0x6c99('0x42'))){_0x312993['limit']=qs['limit'](_0x315af5[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x312993['offset']=qs[_0x6c99('0x23')](_0x315af5[_0x6c99('0x3a')]['offset']);}_0x312993[_0x6c99('0x60')]=qs[_0x6c99('0x43')](_0x315af5['query'][_0x6c99('0x43')]);_0x312993[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_['pick'](_0x315af5[_0x6c99('0x3a')],_0xd0b0a6['filters']));_0x312993['raw']=!![];if(_0x315af5[_0x6c99('0x3a')][_0x6c99('0x46')]){_0x312993[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x312993[_0x6c99('0x44')],{'$or':_['map'](_0x312993[_0x6c99('0x3e')],function(_0x27c995){var _0x36968d={};_0x36968d[_0x27c995]={'$like':'%'+_0x315af5[_0x6c99('0x3a')][_0x6c99('0x46')]+'%'};return _0x36968d;})});}_0x312993=_['merge']({},_0x312993,_0x315af5[_0x6c99('0x52')]);return _0x1712ed[_0x6c99('0x6e')](_0x312993);}})['then'](respondWithResult(_0x9e288b,null))[_0x6c99('0x4e')](handleError(_0x9e288b,null));};exports['getContactsCsv']=function(_0x10918b,_0x25deff,_0x467a15){var _0xbdd544;var _0x333bf7;var _0x3ed1b5;var _0x361108=_0x10918b['params']['id'];csv_results=[];return db[_0x6c99('0x74')]['findAll']({'attributes':['id',_0x6c99('0x32')],'raw':!![],'order':[_0x6c99('0x75')]})[_0x6c99('0x2c')](function(_0x168bc8){_0xbdd544=_0x168bc8;var _0x5b09e7=_[_0x6c99('0x51')](db[_0x6c99('0x63')][_0x6c99('0x36')]);return db[_0x6c99('0x6f')][_0x6c99('0x4c')]({'raw':!![],'attributes':['id',_0x6c99('0x76')]})[_0x6c99('0x2c')](function(_0x29033a){_0x333bf7=_0x29033a;var _0x345fbd=squel['select']()[_0x6c99('0x3f')](_0x5b09e7)[_0x6c99('0x77')](_0x6c99('0x78'),'c')[_0x6c99('0x44')]('c.ListId\x20=\x20?',_0x361108)['where'](_0x6c99('0x79'))[_0x6c99('0x7a')]();for(var _0x5b83b8=0x0;_0x5b83b8<_0x333bf7[_0x6c99('0x40')];_0x5b83b8++){_0x345fbd[_0x6c99('0x7b')](_0x6c99('0x7c')+_0x333bf7[_0x5b83b8]['id'],_0x6c99('0x7d')+_0x333bf7[_0x5b83b8][_0x6c99('0x76')]);}for(var _0x5b83b8=0x0;_0x5b83b8<_0xbdd544['length'];_0x5b83b8++){_0x345fbd[_0x6c99('0x7b')](squel[_0x6c99('0x7e')]()['field'](_0x6c99('0x7f'))[_0x6c99('0x77')]('cm_contact_has_items')[_0x6c99('0x44')]('ItemTypeId\x20=\x20?',_0xbdd544[_0x5b83b8]['id'])[_0x6c99('0x44')](_0x6c99('0x80')),'additionalPhone_'+_0xbdd544[_0x5b83b8][_0x6c99('0x32')]);_0x345fbd['field'](squel[_0x6c99('0x7e')]()['field'](_0x6c99('0x81'))['from']('cm_contact_has_items')[_0x6c99('0x44')](_0x6c99('0x82'),_0xbdd544[_0x5b83b8]['id'])['where']('CmContactId\x20=\x20c.id'),'description_additionalPhone_'+_0xbdd544[_0x5b83b8][_0x6c99('0x32')]);}var _0x342f0=[];_0x342f0[_0x6c99('0x66')](_0x345fbd[_0x6c99('0x83')]());BPromise[_0x6c99('0x67')](_0x342f0,handleQuery)['then'](function(_0x428701){handleQuery(_0x345fbd[_0x6c99('0x83')]());var _0xe38f4c=csv_results[0x0];if(!_['isEmpty'](_0xe38f4c)){var _0x3c8fb9=toCsv(_0xe38f4c);var _0x440d64=Date[_0x6c99('0x84')]();fs[_0x6c99('0x85')](util['format'](_0x6c99('0x86'),_0x361108,_0x440d64),_0x3c8fb9);_0x25deff[_0x6c99('0x87')](_0x6c99('0x88'),_0x6c99('0x89')+util[_0x6c99('0x72')](_0x6c99('0x8a'),_0x361108,_0x440d64));_0x25deff[_0x6c99('0x87')](_0x6c99('0x8b'),_0x6c99('0x8c'));return _0x25deff[_0x6c99('0x8d')](util[_0x6c99('0x72')](_0x6c99('0x86'),_0x361108,_0x440d64));}else{return _0x25deff[_0x6c99('0x8e')](0xcc);}});});});};exports['addCustomField']=function(_0x1cc69a,_0x369654,_0x51f810){var _0x36e1e0;delete _0x1cc69a['body']['id'];return db[_0x6c99('0x35')][_0x6c99('0x5f')]({'where':{'id':_0x1cc69a[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x369654,null))[_0x6c99('0x2c')](function(_0x32a2b7){if(_0x32a2b7){return db['sequelize'][_0x6c99('0x8f')](function(_0x74b63){return db[_0x6c99('0x6f')][_0x6c99('0x54')](_0x1cc69a['body'],{'transaction':_0x74b63})[_0x6c99('0x2c')](function(_0x18743c){_0x36e1e0=_0x18743c;return _0x32a2b7[_0x6c99('0x90')](_0x18743c,{'transaction':_0x74b63});})[_0x6c99('0x2c')](function(){var _0x199eef={'type':db[_0x6c99('0x91')][_0x6c99('0x92')],'transaction':_0x74b63};switch(_0x1cc69a['body'][_0x6c99('0x48')]){case _0x6c99('0x93'):_0x199eef[_0x6c99('0x48')]=db[_0x6c99('0x91')][_0x6c99('0x92')];break;case'number':_0x199eef[_0x6c99('0x48')]=db[_0x6c99('0x91')][_0x6c99('0x94')];break;case _0x6c99('0x95'):_0x199eef[_0x6c99('0x48')]=db[_0x6c99('0x91')][_0x6c99('0x96')];_0x199eef[_0x6c99('0x97')]=![];break;default:}return db['sequelize'][_0x6c99('0x98')][_0x6c99('0x99')]('cm_contacts',util[_0x6c99('0x72')](_0x6c99('0x9a'),_0x36e1e0['id']),_0x199eef);})['then'](function(){return _0x36e1e0;});});}})['then'](respondWithResult(_0x369654,null))['catch'](handleError(_0x369654,null));};exports[_0x6c99('0x9b')]=function(_0x2ed66c,_0x3ffe1b,_0x420767){var _0x222e0d={};var _0x532c92={};var _0x3f0d8f;var _0x349cbf;return db[_0x6c99('0x35')]['findOne']({'where':{'id':_0x2ed66c['params']['id']}})['then'](handleEntityNotFound(_0x3ffe1b,null))[_0x6c99('0x2c')](function(_0x5335e7){if(_0x5335e7){_0x3f0d8f=_0x5335e7;_0x532c92[_0x6c99('0x3d')]=_['keys'](db[_0x6c99('0x6f')][_0x6c99('0x36')]);_0x532c92[_0x6c99('0x3a')]=_['keys'](_0x2ed66c[_0x6c99('0x3a')]);_0x532c92[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x532c92[_0x6c99('0x3d')],_0x532c92[_0x6c99('0x3a')]);_0x222e0d[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x532c92[_0x6c99('0x3d')],qs[_0x6c99('0x3f')](_0x2ed66c[_0x6c99('0x3a')][_0x6c99('0x3f')]));_0x222e0d['attributes']=_0x222e0d[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x222e0d[_0x6c99('0x3e')]:_0x532c92[_0x6c99('0x3d')];_0x222e0d['order']=qs['sort'](_0x2ed66c[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x222e0d['where']=qs[_0x6c99('0x3b')](_[_0x6c99('0x45')](_0x2ed66c[_0x6c99('0x3a')],_0x532c92[_0x6c99('0x3b')]));_0x222e0d[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x222e0d[_0x6c99('0x44')],{'$or':[{'ListId':_0x5335e7['id']},{'ListId':null}]});if(_0x2ed66c['query'][_0x6c99('0x46')]){_0x222e0d[_0x6c99('0x44')]=_[_0x6c99('0x47')](_0x222e0d[_0x6c99('0x44')],{'$or':_['map'](_0x222e0d[_0x6c99('0x3e')],function(_0x12004c){var _0x3c41c7={};_0x3c41c7[_0x12004c]={'$like':'%'+_0x2ed66c[_0x6c99('0x3a')][_0x6c99('0x46')]+'%'};return _0x3c41c7;})});}_0x222e0d=_[_0x6c99('0x47')]({},_0x222e0d,_0x2ed66c['options']);return db['CmCustomField'][_0x6c99('0x9c')](_0x222e0d);}})['then'](respondWithResult(_0x3ffe1b,null))[_0x6c99('0x4e')](handleError(_0x3ffe1b,null));};exports[_0x6c99('0x9d')]=function(_0x116ab6,_0x2eb6a5){return db[_0x6c99('0x6f')][_0x6c99('0x9c')]({'where':{'ListId':null}})[_0x6c99('0x2c')](handleEntityNotFound(_0x2eb6a5,null))['then'](function(_0x9b3f9a){return _0x9b3f9a;})[_0x6c99('0x2c')](respondWithResult(_0x2eb6a5,null))[_0x6c99('0x4e')](handleError(_0x2eb6a5,null));};exports['addAgents']=function(_0x5a8085,_0x32641b,_0x217454){return db[_0x6c99('0x35')]['find']({'where':{'id':_0x5a8085[_0x6c99('0x50')]['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x32641b,null))['then'](function(_0x4ab4e7){if(_0x4ab4e7){return _0x4ab4e7[_0x6c99('0x9e')](_0x5a8085['body'][_0x6c99('0x69')],_['omit'](_0x5a8085['body'],[_0x6c99('0x69'),'id'])||{})[_0x6c99('0x9f')](function(_0x1668ec){for(var _0x32d0e8=0x0;_0x32d0e8<_0x5a8085['body']['ids']['length'];_0x32d0e8+=0x1){socket[_0x6c99('0xa0')](_0x6c99('0xa1'),{'UserId':Number(_0x5a8085[_0x6c99('0x5b')]['ids'][_0x32d0e8]),'CmListId':Number(_0x5a8085[_0x6c99('0x50')]['id'])});}return _0x1668ec;});}})[_0x6c99('0x2c')](respondWithResult(_0x32641b,null))[_0x6c99('0x4e')](handleError(_0x32641b,null));};exports[_0x6c99('0xa2')]=function(_0x39664a,_0x3e4d9f,_0x1f0091){return db[_0x6c99('0x35')][_0x6c99('0x53')]({'where':{'id':_0x39664a['params']['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x3e4d9f,null))[_0x6c99('0x2c')](function(_0x324fe8){if(_0x324fe8){return _0x324fe8[_0x6c99('0xa2')](_0x39664a[_0x6c99('0x3a')][_0x6c99('0x69')])['then'](function(){if(_[_0x6c99('0xa3')](_0x39664a['query'][_0x6c99('0x69')])){for(var _0x164835=0x0;_0x164835<_0x39664a[_0x6c99('0x3a')]['ids']['length'];_0x164835+=0x1){socket[_0x6c99('0xa0')](_0x6c99('0xa4'),{'UserId':Number(_0x39664a['query']['ids'][_0x164835]),'CmListId':Number(_0x39664a['params']['id'])});}}else{socket[_0x6c99('0xa0')]('userCmList:remove',{'UserId':Number(_0x39664a[_0x6c99('0x3a')][_0x6c99('0x69')]),'CmListId':Number(_0x39664a['params']['id'])});}});}})['then'](respondWithStatusCode(_0x3e4d9f,null))[_0x6c99('0x4e')](handleError(_0x3e4d9f,null));};exports['getAgents']=function(_0x4cfc33,_0x3d68c2,_0x295bcc){var _0x43f646={};var _0x3cbb82={};var _0x5f2e0b;var _0x4581ad;return db[_0x6c99('0x35')][_0x6c99('0x5f')]({'where':{'id':_0x4cfc33['params']['id']}})[_0x6c99('0x2c')](handleEntityNotFound(_0x3d68c2,null))[_0x6c99('0x2c')](function(_0x1c482c){if(_0x1c482c){_0x5f2e0b=_0x1c482c;_0x3cbb82[_0x6c99('0x3d')]=_['keys'](db['User']['rawAttributes']);_0x3cbb82[_0x6c99('0x3a')]=_['keys'](_0x4cfc33['query']);_0x3cbb82[_0x6c99('0x3b')]=_[_0x6c99('0x3c')](_0x3cbb82[_0x6c99('0x3d')],_0x3cbb82[_0x6c99('0x3a')]);_0x43f646[_0x6c99('0x3e')]=_[_0x6c99('0x3c')](_0x3cbb82['model'],qs[_0x6c99('0x3f')](_0x4cfc33['query']['fields']));_0x43f646[_0x6c99('0x3e')]=_0x43f646[_0x6c99('0x3e')][_0x6c99('0x40')]?_0x43f646[_0x6c99('0x3e')]:_0x3cbb82[_0x6c99('0x3d')];_0x43f646[_0x6c99('0x60')]=qs[_0x6c99('0x43')](_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x43')]);_0x43f646[_0x6c99('0x44')]=qs[_0x6c99('0x3b')](_['pick'](_0x4cfc33['query'],_0x3cbb82[_0x6c99('0x3b')]));if(_0x4cfc33[_0x6c99('0x3a')]['filter']){_0x43f646['where']=_[_0x6c99('0x47')](_0x43f646[_0x6c99('0x44')],{'$or':_[_0x6c99('0x39')](_0x43f646[_0x6c99('0x3e')],function(_0x320713){var _0x97a3fc={};_0x97a3fc[_0x320713]={'$like':'%'+_0x4cfc33[_0x6c99('0x3a')]['filter']+'%'};return _0x97a3fc;})});}_0x43f646=_['merge']({},_0x43f646,_0x4cfc33[_0x6c99('0x52')]);return _0x5f2e0b['getAgents'](_0x43f646);}})[_0x6c99('0x2c')](function(_0x5c88ea){if(_0x5c88ea){_0x4581ad=_0x5c88ea[_0x6c99('0x40')];if(!_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x41')](_0x6c99('0x42'))){_0x43f646['limit']=qs[_0x6c99('0x25')](_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x25')]);_0x43f646[_0x6c99('0x23')]=qs[_0x6c99('0x23')](_0x4cfc33[_0x6c99('0x3a')][_0x6c99('0x23')]);}return _0x5f2e0b[_0x6c99('0xa5')](_0x43f646);}})[_0x6c99('0x2c')](function(_0x54f226){if(_0x54f226){return _0x54f226?{'count':_0x4581ad,'rows':_0x54f226}:null;}})[_0x6c99('0x2c')](respondWithResult(_0x3d68c2,null))[_0x6c99('0x4e')](handleError(_0x3d68c2,null));};function handleQuery(_0x1c25e4){logger[_0x6c99('0xa6')](_0x1c25e4);return db[_0x6c99('0xa7')][_0x6c99('0x3a')](_0x1c25e4)[_0x6c99('0x9f')](function(_0x388753){csv_results['push'](_0x388753);})['catch'](function(_0x304a86){logger[_0x6c99('0x30')](_0x304a86[_0x6c99('0xa8')]);});} \ No newline at end of file +var _0xc675=['each','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','attachment;\x20filename=','list_%d_%s.csv','text/csv','findOne','sequelize','transaction','addCustomFields','Sequelize','text','TEXT','number','BOOLEAN','defaultValue','queryInterface','cf_%s','findAndCountAll','getGlobalCustomFields','addAgents','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','spread','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','include','rows','catch','show','params','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','getDispositions','Disposition','nolimit','sort','ListId','findAll','removeDispositions','ids','addContacts','CmContact','tags','isArray','push','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','ContactItemType','alias','select','from','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description'];(function(_0x32ed73,_0x46033e){var _0x147db9=function(_0x29498c){while(--_0x29498c){_0x32ed73['push'](_0x32ed73['shift']());}};_0x147db9(++_0x46033e);}(_0xc675,0x169));var _0x5c67=function(_0x386eeb,_0x432300){_0x386eeb=_0x386eeb-0x0;var _0x3ad6d1=_0xc675[_0x386eeb];return _0x3ad6d1;};'use strict';var emlformat=require(_0x5c67('0x0'));var rimraf=require(_0x5c67('0x1'));var zipdir=require(_0x5c67('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5c67('0x3'));var Mustache=require(_0x5c67('0x4'));var util=require(_0x5c67('0x5'));var path=require(_0x5c67('0x6'));var sox=require(_0x5c67('0x7'));var csv=require(_0x5c67('0x8'));var ejs=require(_0x5c67('0x9'));var fs=require('fs');var fs_extra=require(_0x5c67('0xa'));var _=require(_0x5c67('0xb'));var squel=require(_0x5c67('0xc'));var crypto=require(_0x5c67('0xd'));var jsforce=require(_0x5c67('0xe'));var deskjs=require(_0x5c67('0xf'));var toCsv=require('to-csv');var querystring=require(_0x5c67('0x10'));var Papa=require('papaparse');var Redis=require(_0x5c67('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5c67('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c67('0x13'));var logger=require('../../config/logger')(_0x5c67('0x14'));var utils=require('../../config/utils');var config=require(_0x5c67('0x15'));var licenseUtil=require(_0x5c67('0x16'));var db=require(_0x5c67('0x17'))['db'];var csv_results;config['redis']=_[_0x5c67('0x18')](config[_0x5c67('0x19')],{'host':_0x5c67('0x1a'),'port':0x18eb});var socket=require(_0x5c67('0x1b'))(new Redis(config['redis']));require(_0x5c67('0x1c'))['register'](socket);function respondWithStatusCode(_0x1a1b9a,_0xa5f85f){_0xa5f85f=_0xa5f85f||0xcc;return function(_0x561ff8){if(_0x561ff8){return _0x1a1b9a[_0x5c67('0x1d')](_0xa5f85f);}return _0x1a1b9a[_0x5c67('0x1e')](_0xa5f85f)[_0x5c67('0x1f')]();};}function respondWithResult(_0x5358bf,_0x3867d6){_0x3867d6=_0x3867d6||0xc8;return function(_0x8be517){if(_0x8be517){return _0x5358bf[_0x5c67('0x1e')](_0x3867d6)[_0x5c67('0x20')](_0x8be517);}};}function respondWithFilteredResult(_0x8a9b4e,_0x37fe63){return function(_0x5469db){if(_0x5469db){var _0x17e0eb=typeof _0x37fe63[_0x5c67('0x21')]===_0x5c67('0x22')&&typeof _0x37fe63['limit']===_0x5c67('0x22');var _0x37d59c=_0x5469db['count'];var _0x2c9223=_0x17e0eb?0x0:_0x37fe63[_0x5c67('0x21')];var _0x53d71a=_0x17e0eb?_0x5469db[_0x5c67('0x23')]:_0x37fe63[_0x5c67('0x21')]+_0x37fe63[_0x5c67('0x24')];var _0x5d75f5;if(_0x53d71a>=_0x37d59c){_0x53d71a=_0x37d59c;_0x5d75f5=0xc8;}else{_0x5d75f5=0xce;}_0x8a9b4e[_0x5c67('0x1e')](_0x5d75f5);return _0x8a9b4e[_0x5c67('0x25')](_0x5c67('0x26'),_0x2c9223+'-'+_0x53d71a+'/'+_0x37d59c)[_0x5c67('0x20')](_0x5469db);}return null;};}function patchUpdates(_0x5a1895){return function(_0x5bf115){try{jsonpatch['apply'](_0x5bf115,_0x5a1895,!![]);}catch(_0x1c5e10){return BPromise['reject'](_0x1c5e10);}return _0x5bf115['save']();};}function saveUpdates(_0x1886b3,_0x203f08){return function(_0x51e6c0){if(_0x51e6c0){return _0x51e6c0[_0x5c67('0x27')](_0x1886b3)[_0x5c67('0x28')](function(_0xe12068){return _0xe12068;});}return null;};}function removeEntity(_0x1eac0a,_0x24ff01){return function(_0x23ef7d){if(_0x23ef7d){return _0x23ef7d[_0x5c67('0x29')]()[_0x5c67('0x28')](function(){var _0x2a8ad2=_0x23ef7d[_0x5c67('0x2a')]({'plain':!![]});var _0x2c41fd=_0x5c67('0x2b');return db[_0x5c67('0x2c')][_0x5c67('0x29')]({'where':{'type':_0x2c41fd,'resourceId':_0x2a8ad2['id']}})[_0x5c67('0x28')](function(){return _0x23ef7d;});})[_0x5c67('0x28')](function(){_0x1eac0a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x86f568,_0x54f27e){return function(_0xa09132){if(!_0xa09132){_0x86f568[_0x5c67('0x1d')](0x194);}return _0xa09132;};}function handleError(_0x2aa87e,_0x5b823d){_0x5b823d=_0x5b823d||0x1f4;return function(_0x3b9ad7){logger[_0x5c67('0x2d')](_0x3b9ad7[_0x5c67('0x2e')]);if(_0x3b9ad7[_0x5c67('0x2f')]){delete _0x3b9ad7[_0x5c67('0x2f')];}_0x2aa87e[_0x5c67('0x1e')](_0x5b823d)[_0x5c67('0x30')](_0x3b9ad7);};}exports[_0x5c67('0x31')]=function(_0x437ff0,_0x52dc7d){var _0x2f7b44={},_0x4757d5={},_0x1ed305={'count':0x0,'rows':[]};var _0x50bc07=_[_0x5c67('0x32')](db[_0x5c67('0x33')][_0x5c67('0x34')],function(_0xab6a56){return{'name':_0xab6a56[_0x5c67('0x35')],'type':_0xab6a56[_0x5c67('0x36')][_0x5c67('0x37')]};});_0x4757d5[_0x5c67('0x38')]=_[_0x5c67('0x32')](_0x50bc07,'name');_0x4757d5[_0x5c67('0x39')]=_[_0x5c67('0x3a')](_0x437ff0[_0x5c67('0x39')]);_0x4757d5[_0x5c67('0x3b')]=_[_0x5c67('0x3c')](_0x4757d5[_0x5c67('0x38')],_0x4757d5[_0x5c67('0x39')]);_0x2f7b44['attributes']=_[_0x5c67('0x3c')](_0x4757d5[_0x5c67('0x38')],qs[_0x5c67('0x3d')](_0x437ff0['query'][_0x5c67('0x3d')]));_0x2f7b44[_0x5c67('0x3e')]=_0x2f7b44['attributes'][_0x5c67('0x3f')]?_0x2f7b44[_0x5c67('0x3e')]:_0x4757d5[_0x5c67('0x38')];if(!_0x437ff0['query'][_0x5c67('0x40')]('nolimit')){_0x2f7b44['limit']=qs[_0x5c67('0x24')](_0x437ff0[_0x5c67('0x39')][_0x5c67('0x24')]);_0x2f7b44[_0x5c67('0x21')]=qs[_0x5c67('0x21')](_0x437ff0[_0x5c67('0x39')]['offset']);}_0x2f7b44[_0x5c67('0x41')]=qs['sort'](_0x437ff0[_0x5c67('0x39')]['sort']);_0x2f7b44[_0x5c67('0x42')]=qs['filters'](_[_0x5c67('0x43')](_0x437ff0['query'],_0x4757d5['filters']),_0x50bc07);if(_0x437ff0[_0x5c67('0x39')][_0x5c67('0x44')]){_0x2f7b44[_0x5c67('0x42')]=_[_0x5c67('0x45')](_0x2f7b44[_0x5c67('0x42')],{'$or':_[_0x5c67('0x32')](_0x50bc07,function(_0x2bb821){if(_0x2bb821[_0x5c67('0x36')]!==_0x5c67('0x46')){var _0x5e5c38={};_0x5e5c38[_0x2bb821['name']]={'$like':'%'+_0x437ff0[_0x5c67('0x39')]['filter']+'%'};return _0x5e5c38;}})});}_0x2f7b44=_[_0x5c67('0x45')]({},_0x2f7b44,_0x437ff0['options']);var _0x3e8c71={'where':_0x2f7b44[_0x5c67('0x42')]};return db[_0x5c67('0x33')][_0x5c67('0x23')](_0x3e8c71)['then'](function(_0x5d55fb){_0x1ed305[_0x5c67('0x23')]=_0x5d55fb;if(_0x437ff0[_0x5c67('0x39')]['includeAll']){_0x2f7b44[_0x5c67('0x47')]=[{'all':!![]}];}return db[_0x5c67('0x33')]['findAll'](_0x2f7b44);})[_0x5c67('0x28')](function(_0x5a1b43){_0x1ed305[_0x5c67('0x48')]=_0x5a1b43;return _0x1ed305;})[_0x5c67('0x28')](respondWithFilteredResult(_0x52dc7d,_0x2f7b44))[_0x5c67('0x49')](handleError(_0x52dc7d,null));};exports[_0x5c67('0x4a')]=function(_0x3ce40d,_0x536d5d){var _0x259185={'raw':![],'where':{'id':_0x3ce40d[_0x5c67('0x4b')]['id']}},_0x264336={};_0x264336[_0x5c67('0x38')]=_[_0x5c67('0x3a')](db[_0x5c67('0x33')]['rawAttributes']);_0x264336[_0x5c67('0x39')]=_['keys'](_0x3ce40d['query']);_0x264336[_0x5c67('0x3b')]=_['intersection'](_0x264336['model'],_0x264336[_0x5c67('0x39')]);_0x259185[_0x5c67('0x3e')]=_[_0x5c67('0x3c')](_0x264336[_0x5c67('0x38')],qs['fields'](_0x3ce40d[_0x5c67('0x39')][_0x5c67('0x3d')]));_0x259185['attributes']=_0x259185['attributes'][_0x5c67('0x3f')]?_0x259185[_0x5c67('0x3e')]:_0x264336[_0x5c67('0x38')];if(_0x3ce40d[_0x5c67('0x39')][_0x5c67('0x4c')]){_0x259185['include']=[{'all':!![]}];}_0x259185=_[_0x5c67('0x45')]({},_0x259185,_0x3ce40d[_0x5c67('0x4d')]);return db['CmList'][_0x5c67('0x4e')](_0x259185)[_0x5c67('0x28')](handleEntityNotFound(_0x536d5d,null))[_0x5c67('0x28')](respondWithResult(_0x536d5d,null))[_0x5c67('0x49')](handleError(_0x536d5d,null));};exports[_0x5c67('0x4f')]=function(_0x3cd84c,_0x5f4a2c){return db[_0x5c67('0x33')]['create'](_0x3cd84c[_0x5c67('0x50')],{})['then'](function(_0x5f0734){var _0x13f730=_0x3cd84c['user'][_0x5c67('0x2a')]({'plain':!![]});if(!_0x13f730)throw new Error(_0x5c67('0x51'));if(_0x13f730[_0x5c67('0x52')]===_0x5c67('0x53')){var _0x4f359c=_0x5f0734['get']({'plain':!![]});var _0x2245ce=_0x5c67('0x2b');return db['UserProfileSection']['find']({'where':{'name':_0x2245ce,'userProfileId':_0x13f730[_0x5c67('0x54')]},'raw':!![]})[_0x5c67('0x28')](function(_0x481e92){if(_0x481e92&&_0x481e92[_0x5c67('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f359c[_0x5c67('0x2f')],'resourceId':_0x4f359c['id'],'type':_0x481e92[_0x5c67('0x2f')],'sectionId':_0x481e92['id']},{})[_0x5c67('0x28')](function(){return _0x5f0734;});}else{return _0x5f0734;}})[_0x5c67('0x49')](function(_0x2989e3){logger[_0x5c67('0x2d')](_0x5c67('0x56'),_0x2989e3);throw _0x2989e3;});}return _0x5f0734;})['then'](respondWithResult(_0x5f4a2c,0xc9))['catch'](handleError(_0x5f4a2c,null));};exports[_0x5c67('0x27')]=function(_0x2fca3f,_0x4e4a84){if(_0x2fca3f[_0x5c67('0x50')]['id']){delete _0x2fca3f['body']['id'];}return db[_0x5c67('0x33')]['find']({'where':{'id':_0x2fca3f['params']['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x4e4a84,null))[_0x5c67('0x28')](saveUpdates(_0x2fca3f['body'],null))[_0x5c67('0x28')](respondWithResult(_0x4e4a84,null))[_0x5c67('0x49')](handleError(_0x4e4a84,null));};exports[_0x5c67('0x29')]=function(_0x35ddba,_0x5198e1){return db[_0x5c67('0x33')]['find']({'where':{'id':_0x35ddba['params']['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x5198e1,null))[_0x5c67('0x28')](removeEntity(_0x5198e1,null))[_0x5c67('0x49')](handleError(_0x5198e1,null));};exports[_0x5c67('0x57')]=function(_0x150f42,_0x1cbe14){return db['CmList'][_0x5c67('0x57')]()[_0x5c67('0x28')](respondWithResult(_0x1cbe14,null))[_0x5c67('0x49')](handleError(_0x1cbe14,null));};exports[_0x5c67('0x58')]=function(_0x47fc63,_0x5c79b2,_0x3cc7a1){if(_0x47fc63[_0x5c67('0x50')]['id']){delete _0x47fc63[_0x5c67('0x50')]['id'];}return db[_0x5c67('0x33')][_0x5c67('0x4e')]({'where':{'id':_0x47fc63[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x5c79b2,null))['then'](function(_0x475f63){if(_0x475f63){_0x47fc63[_0x5c67('0x50')]['ListId']=_0x475f63['id'];return db['Disposition'][_0x5c67('0x4f')](_0x47fc63[_0x5c67('0x50')]);}})[_0x5c67('0x28')](respondWithResult(_0x5c79b2,null))['catch'](handleError(_0x5c79b2,null));};exports[_0x5c67('0x59')]=function(_0xa68b8f,_0x276dd6,_0x3f4ec6){var _0x7fa37c={'raw':![],'where':{}};var _0x5735cc={};var _0x378a14={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0xa68b8f[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x276dd6,null))[_0x5c67('0x28')](function(_0x3f7a2c){if(_0x3f7a2c){_0x5735cc[_0x5c67('0x38')]=_[_0x5c67('0x3a')](db[_0x5c67('0x5a')][_0x5c67('0x34')]);_0x5735cc[_0x5c67('0x39')]=_[_0x5c67('0x3a')](_0xa68b8f[_0x5c67('0x39')]);_0x5735cc['filters']=_[_0x5c67('0x3c')](_0x5735cc[_0x5c67('0x38')],_0x5735cc['query']);_0x7fa37c[_0x5c67('0x3e')]=_[_0x5c67('0x3c')](_0x5735cc[_0x5c67('0x38')],qs[_0x5c67('0x3d')](_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x3d')]));_0x7fa37c[_0x5c67('0x3e')]=_0x7fa37c[_0x5c67('0x3e')]['length']?_0x7fa37c[_0x5c67('0x3e')]:_0x5735cc[_0x5c67('0x38')];if(!_0xa68b8f['query']['hasOwnProperty'](_0x5c67('0x5b'))){_0x7fa37c[_0x5c67('0x24')]=qs[_0x5c67('0x24')](_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x24')]);_0x7fa37c[_0x5c67('0x21')]=qs[_0x5c67('0x21')](_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x21')]);}_0x7fa37c[_0x5c67('0x41')]=qs[_0x5c67('0x5c')](_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x5c')]);_0x7fa37c['where']=qs['filters'](_[_0x5c67('0x43')](_0xa68b8f[_0x5c67('0x39')],_0x5735cc[_0x5c67('0x3b')]));_0x7fa37c[_0x5c67('0x42')][_0x5c67('0x5d')]=_0x3f7a2c['id'];if(_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x44')]){_0x7fa37c[_0x5c67('0x42')]=_['merge'](_0x7fa37c['where'],{'$or':_[_0x5c67('0x32')](_0x7fa37c[_0x5c67('0x3e')],function(_0x17e466){var _0x543cc6={};_0x543cc6[_0x17e466]={'$like':'%'+_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x44')]+'%'};return _0x543cc6;})});}_0x7fa37c=_[_0x5c67('0x45')]({},_0x7fa37c,_0xa68b8f[_0x5c67('0x4d')]);return db[_0x5c67('0x5a')][_0x5c67('0x23')]({'where':_0x7fa37c[_0x5c67('0x42')]})['then'](function(_0x200665){_0x378a14[_0x5c67('0x23')]=_0x200665;if(_0xa68b8f[_0x5c67('0x39')][_0x5c67('0x4c')]){_0x7fa37c[_0x5c67('0x47')]=[{'all':!![]}];}return db['Disposition'][_0x5c67('0x5e')](_0x7fa37c);})['then'](function(_0x2fea4e){_0x378a14['rows']=_0x2fea4e;return _0x378a14;});}})['then'](respondWithFilteredResult(_0x276dd6,_0x7fa37c))[_0x5c67('0x49')](handleError(_0x276dd6,null));};exports['removeDispositions']=function(_0x422912,_0x5f3fe9,_0x273d5a){return db[_0x5c67('0x33')][_0x5c67('0x4e')]({'where':{'id':_0x422912[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x5f3fe9,null))[_0x5c67('0x28')](function(_0x3f5979){if(_0x3f5979){return _0x3f5979[_0x5c67('0x5f')](_0x422912['query'][_0x5c67('0x60')]);}})[_0x5c67('0x28')](respondWithStatusCode(_0x5f3fe9,null))['catch'](handleError(_0x5f3fe9,null));};exports[_0x5c67('0x61')]=function(_0x71cf73,_0x2f5c83,_0x1aba9d){return db[_0x5c67('0x33')]['find']({'where':{'id':_0x71cf73[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x2f5c83,null))['then'](function(_0x3fdc6f){if(_0x3fdc6f){var _0x46888c=[];var _0x27a70b={'success':[],'errors':[]};return db[_0x5c67('0x62')][_0x5c67('0x57')]()[_0x5c67('0x28')](function(_0x5b56f4){if(_0x71cf73[_0x5c67('0x50')][_0x5c67('0x63')]&&_['isArray'](_0x71cf73['body']['tags'])){if(_0x71cf73['body'][_0x5c67('0x63')][_0x5c67('0x3f')]){_0x71cf73['body'][_0x5c67('0x63')]=_0x71cf73[_0x5c67('0x50')][_0x5c67('0x63')]['join'](';')+';';}else{_0x71cf73[_0x5c67('0x50')][_0x5c67('0x63')]=null;}}else{_0x71cf73[_0x5c67('0x50')]['tags']=null;}if(_0x71cf73[_0x5c67('0x50')]&&_[_0x5c67('0x64')](_0x71cf73[_0x5c67('0x50')])){for(var _0x47803a=0x0;_0x47803a<_0x71cf73[_0x5c67('0x50')][_0x5c67('0x3f')];_0x47803a+=0x1){_0x71cf73[_0x5c67('0x50')][_0x47803a][_0x5c67('0x5d')]=_0x71cf73[_0x5c67('0x4b')]['id'];_0x46888c[_0x5c67('0x65')](_0x71cf73[_0x5c67('0x50')][_0x47803a]);}return BPromise['each'](_0x46888c,function(_0x27d0ec){return db[_0x5c67('0x62')][_0x5c67('0x4f')](_['omit'](_0x27d0ec,[_0x5c67('0x60'),'id'])||{},{'fields':_[_0x5c67('0x3a')](_0x5b56f4),'raw':!![]})[_0x5c67('0x28')](function(_0xa3ae90){_0x27a70b[_0x5c67('0x66')][_0x5c67('0x65')](_0xa3ae90[_0x5c67('0x67')]);})[_0x5c67('0x49')](function(_0x5e5db3){_0x27a70b[_0x5c67('0x68')][_0x5c67('0x65')]({'data':_0x27d0ec,'error':_0x5e5db3[_0x5c67('0x69')]});});})['then'](function(_0x4030d4){return _0x27a70b;})[_0x5c67('0x49')](function(_0x29d5a8){return _0x29d5a8;});}else{_0x2f5c83[_0x5c67('0x1e')](0x190)[_0x5c67('0x20')]({'message':_0x5c67('0x6a')});}});}})[_0x5c67('0x28')](respondWithResult(_0x2f5c83,null))['catch'](handleError(_0x2f5c83,null));};exports[_0x5c67('0x6b')]=function(_0x409240,_0x2a0d93,_0x4c4533){var _0x1b0f4b;return db[_0x5c67('0x33')]['find']({'where':{'id':_0x409240['params']['id']},'include':[{'model':db[_0x5c67('0x6c')],'as':_0x5c67('0x6d')}]})[_0x5c67('0x28')](handleEntityNotFound(_0x2a0d93,null))[_0x5c67('0x28')](function(_0x4aca79){if(_0x4aca79){_0x1b0f4b=_0x4aca79;return db[_0x5c67('0x62')]['rawAttributes'];}})['then'](function(_0x71eff7){if(_0x71eff7){var _0x29b862={};var _0x205264={};_0x205264[_0x5c67('0x38')]=_[_0x5c67('0x6e')](_[_0x5c67('0x3a')](_0x71eff7),_[_0x5c67('0x32')](_0x1b0f4b['CustomFields'],function(_0x29badf){return util[_0x5c67('0x6f')](_0x5c67('0x70'),_0x29badf['id']);}));_0x205264[_0x5c67('0x39')]=_['keys'](_0x409240[_0x5c67('0x39')]);_0x205264[_0x5c67('0x3b')]=_[_0x5c67('0x3c')](_0x205264['model'],_0x205264[_0x5c67('0x39')]);_0x29b862['attributes']=_[_0x5c67('0x3c')](_0x205264[_0x5c67('0x38')],qs[_0x5c67('0x3d')](_0x409240[_0x5c67('0x39')][_0x5c67('0x3d')]));_0x29b862[_0x5c67('0x3e')]=_0x29b862[_0x5c67('0x3e')][_0x5c67('0x3f')]?_0x29b862[_0x5c67('0x3e')]:_0x205264[_0x5c67('0x38')];if(!_0x409240[_0x5c67('0x39')][_0x5c67('0x40')]('nolimit')){_0x29b862['limit']=qs[_0x5c67('0x24')](_0x409240[_0x5c67('0x39')][_0x5c67('0x24')]);_0x29b862[_0x5c67('0x21')]=qs[_0x5c67('0x21')](_0x409240['query'][_0x5c67('0x21')]);}_0x29b862[_0x5c67('0x41')]=qs[_0x5c67('0x5c')](_0x409240[_0x5c67('0x39')][_0x5c67('0x5c')]);_0x29b862['where']=qs[_0x5c67('0x3b')](_[_0x5c67('0x43')](_0x409240[_0x5c67('0x39')],_0x205264[_0x5c67('0x3b')]));_0x29b862[_0x5c67('0x71')]=!![];if(_0x409240[_0x5c67('0x39')][_0x5c67('0x44')]){_0x29b862[_0x5c67('0x42')]=_[_0x5c67('0x45')](_0x29b862[_0x5c67('0x42')],{'$or':_[_0x5c67('0x32')](_0x29b862['attributes'],function(_0x3cec5b){var _0xd7298e={};_0xd7298e[_0x3cec5b]={'$like':'%'+_0x409240['query']['filter']+'%'};return _0xd7298e;})});}_0x29b862=_[_0x5c67('0x45')]({},_0x29b862,_0x409240[_0x5c67('0x4d')]);return _0x1b0f4b['getContacts'](_0x29b862);}})[_0x5c67('0x28')](respondWithResult(_0x2a0d93,null))[_0x5c67('0x49')](handleError(_0x2a0d93,null));};exports[_0x5c67('0x72')]=function(_0x3e6c78,_0x566b3b,_0x58183f){var _0x232210;var _0x5c9d18;var _0xf2ad59;var _0x1072e9=_0x3e6c78[_0x5c67('0x4b')]['id'];csv_results=[];return db[_0x5c67('0x73')][_0x5c67('0x5e')]({'attributes':['id','name'],'raw':!![],'order':['OrderBy']})['then'](function(_0x39bccf){_0x232210=_0x39bccf;var _0x46d815=_[_0x5c67('0x3a')](db[_0x5c67('0x62')][_0x5c67('0x34')]);return db[_0x5c67('0x6c')][_0x5c67('0x5e')]({'raw':!![],'attributes':['id',_0x5c67('0x74')]})[_0x5c67('0x28')](function(_0x26e4c5){_0x5c9d18=_0x26e4c5;var _0x1be977=squel[_0x5c67('0x75')]()['fields'](_0x46d815)[_0x5c67('0x76')](_0x5c67('0x77'),'c')['where'](_0x5c67('0x78'),_0x1072e9)[_0x5c67('0x42')](_0x5c67('0x79'))[_0x5c67('0x7a')]();for(var _0x545a96=0x0;_0x545a96<_0x5c9d18[_0x5c67('0x3f')];_0x545a96++){_0x1be977[_0x5c67('0x7b')](_0x5c67('0x7c')+_0x5c9d18[_0x545a96]['id'],_0x5c67('0x7d')+_0x5c9d18[_0x545a96][_0x5c67('0x74')]);}for(var _0x545a96=0x0;_0x545a96<_0x232210[_0x5c67('0x3f')];_0x545a96++){_0x1be977[_0x5c67('0x7b')](squel['select']()[_0x5c67('0x7b')](_0x5c67('0x7e'))['from'](_0x5c67('0x7f'))[_0x5c67('0x42')](_0x5c67('0x80'),_0x232210[_0x545a96]['id'])[_0x5c67('0x42')](_0x5c67('0x81')),'additionalPhone_'+_0x232210[_0x545a96][_0x5c67('0x2f')]);_0x1be977[_0x5c67('0x7b')](squel[_0x5c67('0x75')]()[_0x5c67('0x7b')](_0x5c67('0x82'))['from'](_0x5c67('0x7f'))[_0x5c67('0x42')](_0x5c67('0x80'),_0x232210[_0x545a96]['id'])[_0x5c67('0x42')](_0x5c67('0x81')),'description_additionalPhone_'+_0x232210[_0x545a96][_0x5c67('0x2f')]);}var _0x82681f=[];_0x82681f[_0x5c67('0x65')](_0x1be977['toString']());BPromise[_0x5c67('0x83')](_0x82681f,handleQuery)[_0x5c67('0x28')](function(_0x2cecbc){handleQuery(_0x1be977[_0x5c67('0x84')]());var _0x51ff97=csv_results[0x0];if(!_[_0x5c67('0x85')](_0x51ff97)){var _0x4faa2f=toCsv(_0x51ff97);var _0x1c8480=Date[_0x5c67('0x86')]();fs[_0x5c67('0x87')](util[_0x5c67('0x6f')](_0x5c67('0x88'),_0x1072e9,_0x1c8480),_0x4faa2f);_0x566b3b[_0x5c67('0x89')]('Content-disposition',_0x5c67('0x8a')+util[_0x5c67('0x6f')](_0x5c67('0x8b'),_0x1072e9,_0x1c8480));_0x566b3b[_0x5c67('0x89')]('Content-type',_0x5c67('0x8c'));return _0x566b3b['download'](util['format']('/tmp/list_%d_%s.csv',_0x1072e9,_0x1c8480));}else{return _0x566b3b[_0x5c67('0x1d')](0xcc);}});});});};exports['addCustomField']=function(_0x101376,_0x49707a,_0x338de6){var _0x2f0cff;delete _0x101376[_0x5c67('0x50')]['id'];return db[_0x5c67('0x33')][_0x5c67('0x8d')]({'where':{'id':_0x101376[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x49707a,null))[_0x5c67('0x28')](function(_0x13cabf){if(_0x13cabf){return db[_0x5c67('0x8e')][_0x5c67('0x8f')](function(_0x206757){return db['CmCustomField'][_0x5c67('0x4f')](_0x101376['body'],{'transaction':_0x206757})[_0x5c67('0x28')](function(_0x17c6fa){_0x2f0cff=_0x17c6fa;return _0x13cabf[_0x5c67('0x90')](_0x17c6fa,{'transaction':_0x206757});})[_0x5c67('0x28')](function(){var _0x570642={'type':db[_0x5c67('0x91')]['TEXT'],'transaction':_0x206757};switch(_0x101376[_0x5c67('0x50')][_0x5c67('0x36')]){case _0x5c67('0x92'):_0x570642[_0x5c67('0x36')]=db[_0x5c67('0x91')][_0x5c67('0x93')];break;case _0x5c67('0x94'):_0x570642[_0x5c67('0x36')]=db[_0x5c67('0x91')]['INTEGER'];break;case'switch':_0x570642[_0x5c67('0x36')]=db[_0x5c67('0x91')][_0x5c67('0x95')];_0x570642[_0x5c67('0x96')]=![];break;default:}return db[_0x5c67('0x8e')][_0x5c67('0x97')]['addColumn'](_0x5c67('0x77'),util['format'](_0x5c67('0x98'),_0x2f0cff['id']),_0x570642);})[_0x5c67('0x28')](function(){return _0x2f0cff;});});}})[_0x5c67('0x28')](respondWithResult(_0x49707a,null))[_0x5c67('0x49')](handleError(_0x49707a,null));};exports['getCustomFields']=function(_0x5e4fb6,_0x235d3b,_0x409885){var _0xe5dc11={};var _0x206fb7={};var _0x236c56;var _0x3c1f1b;return db[_0x5c67('0x33')][_0x5c67('0x8d')]({'where':{'id':_0x5e4fb6[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x235d3b,null))[_0x5c67('0x28')](function(_0x3cfc18){if(_0x3cfc18){_0x236c56=_0x3cfc18;_0x206fb7[_0x5c67('0x38')]=_[_0x5c67('0x3a')](db['CmCustomField'][_0x5c67('0x34')]);_0x206fb7[_0x5c67('0x39')]=_[_0x5c67('0x3a')](_0x5e4fb6[_0x5c67('0x39')]);_0x206fb7[_0x5c67('0x3b')]=_[_0x5c67('0x3c')](_0x206fb7[_0x5c67('0x38')],_0x206fb7[_0x5c67('0x39')]);_0xe5dc11[_0x5c67('0x3e')]=_['intersection'](_0x206fb7[_0x5c67('0x38')],qs[_0x5c67('0x3d')](_0x5e4fb6['query'][_0x5c67('0x3d')]));_0xe5dc11[_0x5c67('0x3e')]=_0xe5dc11[_0x5c67('0x3e')][_0x5c67('0x3f')]?_0xe5dc11[_0x5c67('0x3e')]:_0x206fb7['model'];_0xe5dc11[_0x5c67('0x41')]=qs[_0x5c67('0x5c')](_0x5e4fb6[_0x5c67('0x39')]['sort']);_0xe5dc11[_0x5c67('0x42')]=qs[_0x5c67('0x3b')](_['pick'](_0x5e4fb6[_0x5c67('0x39')],_0x206fb7[_0x5c67('0x3b')]));_0xe5dc11['where']=_[_0x5c67('0x45')](_0xe5dc11[_0x5c67('0x42')],{'$or':[{'ListId':_0x3cfc18['id']},{'ListId':null}]});if(_0x5e4fb6['query'][_0x5c67('0x44')]){_0xe5dc11[_0x5c67('0x42')]=_[_0x5c67('0x45')](_0xe5dc11[_0x5c67('0x42')],{'$or':_[_0x5c67('0x32')](_0xe5dc11[_0x5c67('0x3e')],function(_0x57451c){var _0x3c95e9={};_0x3c95e9[_0x57451c]={'$like':'%'+_0x5e4fb6[_0x5c67('0x39')][_0x5c67('0x44')]+'%'};return _0x3c95e9;})});}_0xe5dc11=_['merge']({},_0xe5dc11,_0x5e4fb6['options']);return db[_0x5c67('0x6c')][_0x5c67('0x99')](_0xe5dc11);}})[_0x5c67('0x28')](respondWithResult(_0x235d3b,null))[_0x5c67('0x49')](handleError(_0x235d3b,null));};exports[_0x5c67('0x9a')]=function(_0x5f526e,_0x5afaca){return db[_0x5c67('0x6c')][_0x5c67('0x99')]({'where':{'ListId':null}})[_0x5c67('0x28')](handleEntityNotFound(_0x5afaca,null))[_0x5c67('0x28')](function(_0x146d8f){return _0x146d8f;})[_0x5c67('0x28')](respondWithResult(_0x5afaca,null))[_0x5c67('0x49')](handleError(_0x5afaca,null));};exports[_0x5c67('0x9b')]=function(_0x479747,_0x138766,_0x56bc24){return db[_0x5c67('0x33')][_0x5c67('0x4e')]({'where':{'id':_0x479747[_0x5c67('0x4b')]['id']}})['then'](handleEntityNotFound(_0x138766,null))[_0x5c67('0x28')](function(_0x1642e2){if(_0x1642e2){return _0x1642e2[_0x5c67('0x9b')](_0x479747[_0x5c67('0x50')][_0x5c67('0x60')],_['omit'](_0x479747[_0x5c67('0x50')],['ids','id'])||{})['spread'](function(_0x5687f6){for(var _0x3d08ee=0x0;_0x3d08ee<_0x479747[_0x5c67('0x50')][_0x5c67('0x60')][_0x5c67('0x3f')];_0x3d08ee+=0x1){socket[_0x5c67('0x9c')](_0x5c67('0x9d'),{'UserId':Number(_0x479747['body'][_0x5c67('0x60')][_0x3d08ee]),'CmListId':Number(_0x479747[_0x5c67('0x4b')]['id'])});}return _0x5687f6;});}})[_0x5c67('0x28')](respondWithResult(_0x138766,null))[_0x5c67('0x49')](handleError(_0x138766,null));};exports[_0x5c67('0x9e')]=function(_0x20fc2a,_0x24ad68,_0x308dec){return db['CmList'][_0x5c67('0x4e')]({'where':{'id':_0x20fc2a['params']['id']}})['then'](handleEntityNotFound(_0x24ad68,null))[_0x5c67('0x28')](function(_0x16b7ac){if(_0x16b7ac){return _0x16b7ac[_0x5c67('0x9e')](_0x20fc2a[_0x5c67('0x39')][_0x5c67('0x60')])[_0x5c67('0x28')](function(){if(_[_0x5c67('0x64')](_0x20fc2a['query'][_0x5c67('0x60')])){for(var _0x2d4d01=0x0;_0x2d4d01<_0x20fc2a[_0x5c67('0x39')]['ids'][_0x5c67('0x3f')];_0x2d4d01+=0x1){socket[_0x5c67('0x9c')]('userCmList:remove',{'UserId':Number(_0x20fc2a['query']['ids'][_0x2d4d01]),'CmListId':Number(_0x20fc2a[_0x5c67('0x4b')]['id'])});}}else{socket[_0x5c67('0x9c')](_0x5c67('0x9f'),{'UserId':Number(_0x20fc2a[_0x5c67('0x39')][_0x5c67('0x60')]),'CmListId':Number(_0x20fc2a[_0x5c67('0x4b')]['id'])});}});}})[_0x5c67('0x28')](respondWithStatusCode(_0x24ad68,null))[_0x5c67('0x49')](handleError(_0x24ad68,null));};exports[_0x5c67('0xa0')]=function(_0xc4230b,_0x11fbed,_0x59b520){var _0x4f740b={};var _0x2fc492={};var _0x11ce4f;var _0x25ae00;return db[_0x5c67('0x33')][_0x5c67('0x8d')]({'where':{'id':_0xc4230b[_0x5c67('0x4b')]['id']}})[_0x5c67('0x28')](handleEntityNotFound(_0x11fbed,null))[_0x5c67('0x28')](function(_0x45e66d){if(_0x45e66d){_0x11ce4f=_0x45e66d;_0x2fc492[_0x5c67('0x38')]=_[_0x5c67('0x3a')](db[_0x5c67('0xa1')][_0x5c67('0x34')]);_0x2fc492[_0x5c67('0x39')]=_[_0x5c67('0x3a')](_0xc4230b['query']);_0x2fc492[_0x5c67('0x3b')]=_['intersection'](_0x2fc492[_0x5c67('0x38')],_0x2fc492[_0x5c67('0x39')]);_0x4f740b['attributes']=_['intersection'](_0x2fc492[_0x5c67('0x38')],qs[_0x5c67('0x3d')](_0xc4230b['query'][_0x5c67('0x3d')]));_0x4f740b['attributes']=_0x4f740b[_0x5c67('0x3e')][_0x5c67('0x3f')]?_0x4f740b['attributes']:_0x2fc492[_0x5c67('0x38')];_0x4f740b['order']=qs[_0x5c67('0x5c')](_0xc4230b[_0x5c67('0x39')][_0x5c67('0x5c')]);_0x4f740b['where']=qs[_0x5c67('0x3b')](_[_0x5c67('0x43')](_0xc4230b[_0x5c67('0x39')],_0x2fc492[_0x5c67('0x3b')]));if(_0xc4230b['query'][_0x5c67('0x44')]){_0x4f740b[_0x5c67('0x42')]=_[_0x5c67('0x45')](_0x4f740b[_0x5c67('0x42')],{'$or':_[_0x5c67('0x32')](_0x4f740b['attributes'],function(_0x19ec70){var _0x129b15={};_0x129b15[_0x19ec70]={'$like':'%'+_0xc4230b[_0x5c67('0x39')]['filter']+'%'};return _0x129b15;})});}_0x4f740b=_[_0x5c67('0x45')]({},_0x4f740b,_0xc4230b[_0x5c67('0x4d')]);return _0x11ce4f['getAgents'](_0x4f740b);}})[_0x5c67('0x28')](function(_0x1e06d8){if(_0x1e06d8){_0x25ae00=_0x1e06d8[_0x5c67('0x3f')];if(!_0xc4230b[_0x5c67('0x39')][_0x5c67('0x40')]('nolimit')){_0x4f740b[_0x5c67('0x24')]=qs[_0x5c67('0x24')](_0xc4230b[_0x5c67('0x39')]['limit']);_0x4f740b[_0x5c67('0x21')]=qs[_0x5c67('0x21')](_0xc4230b['query']['offset']);}return _0x11ce4f[_0x5c67('0xa0')](_0x4f740b);}})['then'](function(_0x2abeaa){if(_0x2abeaa){return _0x2abeaa?{'count':_0x25ae00,'rows':_0x2abeaa}:null;}})[_0x5c67('0x28')](respondWithResult(_0x11fbed,null))['catch'](handleError(_0x11fbed,null));};function handleQuery(_0x336e58){logger[_0x5c67('0xa2')](_0x336e58);return db[_0x5c67('0x8e')][_0x5c67('0x39')](_0x336e58)[_0x5c67('0xa3')](function(_0x20de34){csv_results[_0x5c67('0x65')](_0x20de34);})[_0x5c67('0x49')](function(_0x4a107f){logger[_0x5c67('0x2d')](_0x4a107f['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1b932bb..3542227 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 _0x7217=['emit','hasOwnProperty','hook','exports','events','CmList','setMaxListeners','save','update','remove'];(function(_0x17541e,_0x46df72){var _0x1c17eb=function(_0x5f1d1e){while(--_0x5f1d1e){_0x17541e['push'](_0x17541e['shift']());}};_0x1c17eb(++_0x46df72);}(_0x7217,0x19e));var _0x7721=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x7217[_0x34bf97];return _0x292719;};'use strict';var EventEmitter=require(_0x7721('0x0'));var CmList=require('../../mysqldb')['db'][_0x7721('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x7721('0x2')](0x0);var events={'afterCreate':_0x7721('0x3'),'afterUpdate':_0x7721('0x4'),'afterDestroy':_0x7721('0x5')};function emitEvent(_0x4d6446){return function(_0x5bf160,_0x472a96,_0xce17f9){CmListEvents[_0x7721('0x6')](_0x4d6446+':'+_0x5bf160['id'],_0x5bf160);CmListEvents[_0x7721('0x6')](_0x4d6446,_0x5bf160);_0xce17f9(null);};}for(var e in events){if(events[_0x7721('0x7')](e)){var event=events[e];CmList[_0x7721('0x8')](e,emitEvent(event));}}module[_0x7721('0x9')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x5cb97e,_0x132a39){var _0x1714b4=function(_0x384210){while(--_0x384210){_0x5cb97e['push'](_0x5cb97e['shift']());}};_0x1714b4(++_0x132a39);}(_0x55ca,0x126));var _0xa55c=function(_0xe23713,_0x419a1b){_0xe23713=_0xe23713-0x0;var _0x1ac7ce=_0x55ca[_0xe23713];return _0x1ac7ce;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 275c46b..e5ee0e9 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util','../../config/logger','moment','bluebird'];(function(_0x22183a,_0x1aad62){var _0x48ff64=function(_0x204a8b){while(--_0x204a8b){_0x22183a['push'](_0x22183a['shift']());}};_0x48ff64(++_0x1aad62);}(_0xe706,0xa3));var _0x6e70=function(_0x204d21,_0x5d3952){_0x204d21=_0x204d21-0x0;var _0x55df50=_0xe706[_0x204d21];return _0x55df50;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./cmList.attributes','exports','define','CmList','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x1b7b85,_0x4ff632){var _0x50c751=function(_0x1f9034){while(--_0x1f9034){_0x1b7b85['push'](_0x1b7b85['shift']());}};_0x50c751(++_0x4ff632);}(_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 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':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index 81a9a6a..609db59 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 _0x5d5c=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register'];(function(_0x447b23,_0x49c577){var _0x2f37c7=function(_0x19d049){while(--_0x19d049){_0x447b23['push'](_0x447b23['shift']());}};_0x2f37c7(++_0x49c577);}(_0x5d5c,0x1cf));var _0xc5d5=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0x5d5c[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0xc5d5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc5d5('0x1'));var rs=require(_0xc5d5('0x2'));var fs=require('fs');var Redis=require(_0xc5d5('0x3'));var db=require(_0xc5d5('0x4'))['db'];var utils=require(_0xc5d5('0x5'));var logger=require(_0xc5d5('0x6'))(_0xc5d5('0x7'));var config=require(_0xc5d5('0x8'));var jayson=require(_0xc5d5('0x9'));var client=jayson[_0xc5d5('0xa')][_0xc5d5('0xb')]({'port':0x232a});config[_0xc5d5('0xc')]=_[_0xc5d5('0xd')](config[_0xc5d5('0xc')],{'host':_0xc5d5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5d5('0xc')]));require(_0xc5d5('0xf'))[_0xc5d5('0x10')](socket);function respondWithRpcPromise(_0x107bde,_0x8805bf,_0x4023bf){return new BPromise(function(_0x104dfa,_0x17a04c){return client[_0xc5d5('0x11')](_0x107bde,_0x4023bf)[_0xc5d5('0x12')](function(_0x555af7){logger[_0xc5d5('0x13')](_0xc5d5('0x14'),_0x8805bf,_0xc5d5('0x15'));logger[_0xc5d5('0x16')](_0xc5d5('0x17'),_0x8805bf,'request\x20sent',JSON[_0xc5d5('0x18')](_0x555af7));if(_0x555af7['error']){if(_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1a')]===0x1f4){logger['error'](_0xc5d5('0x14'),_0x8805bf,_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1b')]);return _0x17a04c(_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1b')]);}logger['error'](_0xc5d5('0x14'),_0x8805bf,_0x555af7[_0xc5d5('0x19')]['message']);return _0x104dfa(_0x555af7[_0xc5d5('0x19')][_0xc5d5('0x1b')]);}else{logger['info'](_0xc5d5('0x14'),_0x8805bf,_0xc5d5('0x15'));_0x104dfa(_0x555af7[_0xc5d5('0x1c')][_0xc5d5('0x1b')]);}})[_0xc5d5('0x1d')](function(_0xc34858){logger[_0xc5d5('0x19')](_0xc5d5('0x14'),_0x8805bf,_0xc34858);_0x17a04c(_0xc34858);});});} \ No newline at end of file +var _0xed0f=['debug','CmList,\x20%s,\x20%s,\x20%s','error','CmList,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request','info','request\x20sent'];(function(_0x2dff9a,_0x5595d5){var _0x45a913=function(_0x199315){while(--_0x199315){_0x2dff9a['push'](_0x2dff9a['shift']());}};_0x45a913(++_0x5595d5);}(_0xed0f,0x1e3));var _0xfed0=function(_0x3f04d7,_0x5cd24e){_0x3f04d7=_0x3f04d7-0x0;var _0x2ffc9b=_0xed0f[_0x3f04d7];return _0x2ffc9b;};'use strict';var _=require('lodash');var util=require(_0xfed0('0x0'));var moment=require(_0xfed0('0x1'));var BPromise=require(_0xfed0('0x2'));var rs=require(_0xfed0('0x3'));var fs=require('fs');var Redis=require(_0xfed0('0x4'));var db=require(_0xfed0('0x5'))['db'];var utils=require(_0xfed0('0x6'));var logger=require(_0xfed0('0x7'))(_0xfed0('0x8'));var config=require(_0xfed0('0x9'));var jayson=require(_0xfed0('0xa'));var client=jayson[_0xfed0('0xb')][_0xfed0('0xc')]({'port':0x232a});config[_0xfed0('0xd')]=_[_0xfed0('0xe')](config[_0xfed0('0xd')],{'host':_0xfed0('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfed0('0xd')]));require(_0xfed0('0x10'))[_0xfed0('0x11')](socket);function respondWithRpcPromise(_0xb1108,_0x5eb87b,_0x4b90a4){return new BPromise(function(_0x4c4c42,_0x36d10d){return client[_0xfed0('0x12')](_0xb1108,_0x4b90a4)['then'](function(_0x318466){logger[_0xfed0('0x13')]('CmList,\x20%s,\x20%s',_0x5eb87b,_0xfed0('0x14'));logger[_0xfed0('0x15')](_0xfed0('0x16'),_0x5eb87b,_0xfed0('0x14'),JSON['stringify'](_0x318466));if(_0x318466['error']){if(_0x318466[_0xfed0('0x17')]['code']===0x1f4){logger[_0xfed0('0x17')](_0xfed0('0x18'),_0x5eb87b,_0x318466[_0xfed0('0x17')]['message']);return _0x36d10d(_0x318466[_0xfed0('0x17')][_0xfed0('0x19')]);}logger[_0xfed0('0x17')]('CmList,\x20%s,\x20%s',_0x5eb87b,_0x318466['error'][_0xfed0('0x19')]);return _0x4c4c42(_0x318466['error'][_0xfed0('0x19')]);}else{logger[_0xfed0('0x13')](_0xfed0('0x18'),_0x5eb87b,_0xfed0('0x14'));_0x4c4c42(_0x318466[_0xfed0('0x1a')][_0xfed0('0x19')]);}})[_0xfed0('0x1b')](function(_0x28f469){logger['error']('CmList,\x20%s,\x20%s',_0x5eb87b,_0x28f469);_0x36d10d(_0x28f469);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index bad5a88..47b40ce 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 _0x36cb=['remove','update','emit','register','./cmList.events','save'];(function(_0x1d3c84,_0x27447d){var _0x211702=function(_0x39d180){while(--_0x39d180){_0x1d3c84['push'](_0x1d3c84['shift']());}};_0x211702(++_0x27447d);}(_0x36cb,0x70));var _0xb36c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x36cb[_0x42cae2];return _0x5f256f;};'use strict';var CmListEvents=require(_0xb36c('0x0'));var events=[_0xb36c('0x1'),_0xb36c('0x2'),_0xb36c('0x3')];function createListener(_0x4a70b7,_0x337e40){return function(_0x1fa7db){_0x337e40[_0xb36c('0x4')](_0x4a70b7,_0x1fa7db);};}function removeListener(_0x2952ad,_0x270611){return function(){CmListEvents['removeListener'](_0x2952ad,_0x270611);};}exports[_0xb36c('0x5')]=function(_0x1cc3bd){for(var _0xe83503=0x0,_0x268077=events['length'];_0xe83503<_0x268077;_0xe83503++){var _0x644fec=events[_0xe83503];var _0x275ba8=createListener('cmList:'+_0x644fec,_0x1cc3bd);CmListEvents['on'](_0x644fec,_0x275ba8);}}; \ No newline at end of file +var _0xa3a0=['register','cmList:','save','remove','update','emit'];(function(_0x29d0ee,_0x1c6124){var _0x40f2df=function(_0xd71bb5){while(--_0xd71bb5){_0x29d0ee['push'](_0x29d0ee['shift']());}};_0x40f2df(++_0x1c6124);}(_0xa3a0,0x6e));var _0x0a3a=function(_0x1327d6,_0x28c03f){_0x1327d6=_0x1327d6-0x0;var _0x25c52f=_0xa3a0[_0x1327d6];return _0x25c52f;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0x0a3a('0x0'),_0x0a3a('0x1'),_0x0a3a('0x2')];function createListener(_0x2b3e58,_0xdb459d){return function(_0x3a8309){_0xdb459d[_0x0a3a('0x3')](_0x2b3e58,_0x3a8309);};}function removeListener(_0x12b5b0,_0x3160f2){return function(){CmListEvents['removeListener'](_0x12b5b0,_0x3160f2);};}exports[_0x0a3a('0x4')]=function(_0x36e473){for(var _0x1e5c75=0x0,_0x5bcf98=events['length'];_0x1e5c75<_0x5bcf98;_0x1e5c75++){var _0xe30283=events[_0x1e5c75];var _0x50ab17=createListener(_0x0a3a('0x5')+_0xe30283,_0x36e473);CmListEvents['on'](_0xe30283,_0x50ab17);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 280bab1..abb6307 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 _0xb7df=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post','addContacts','addCustomField','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0xb7df,0xf6));var _0xfb7d=function(_0x3a7501,_0x537066){_0x3a7501=_0x3a7501-0x0;var _0x3205a4=_0xb7df[_0x3a7501];return _0x3205a4;};'use strict';var multer=require(_0xfb7d('0x0'));var util=require(_0xfb7d('0x1'));var path=require(_0xfb7d('0x2'));var timeout=require(_0xfb7d('0x3'));var express=require(_0xfb7d('0x4'));var router=express[_0xfb7d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfb7d('0x6'));var interaction=require(_0xfb7d('0x7'));var config=require(_0xfb7d('0x8'));var controller=require(_0xfb7d('0x9'));router[_0xfb7d('0xa')]('/',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0xc')]);router[_0xfb7d('0xa')](_0xfb7d('0xd'),auth[_0xfb7d('0xb')](),controller['describe']);router['get'](_0xfb7d('0xe'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0xf')]);router[_0xfb7d('0xa')]('/:id',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x10')]);router[_0xfb7d('0xa')](_0xfb7d('0x11'),auth['isAuthenticated'](),controller[_0xfb7d('0x12')]);router[_0xfb7d('0xa')](_0xfb7d('0x13'),auth['isAuthenticated'](),controller[_0xfb7d('0x14')]);router[_0xfb7d('0xa')](_0xfb7d('0x15'),auth[_0xfb7d('0xb')](),controller['getContactsCsv']);router[_0xfb7d('0xa')](_0xfb7d('0x16'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x17')]);router[_0xfb7d('0xa')](_0xfb7d('0x18'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x19')]);router['post']('/',auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x1a')]);router[_0xfb7d('0x1b')](_0xfb7d('0x11'),auth[_0xfb7d('0xb')](),controller['addDisposition']);router[_0xfb7d('0x1b')](_0xfb7d('0x13'),auth['isAuthenticated'](),controller[_0xfb7d('0x1c')]);router['post'](_0xfb7d('0x16'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x1d')]);router[_0xfb7d('0x1b')](_0xfb7d('0x18'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xfb7d('0x1e'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x1f')]);router[_0xfb7d('0x20')](_0xfb7d('0x1e'),auth[_0xfb7d('0xb')](),controller['destroy']);router[_0xfb7d('0x20')](_0xfb7d('0x11'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x21')]);router['delete'](_0xfb7d('0x18'),auth[_0xfb7d('0xb')](),controller[_0xfb7d('0x22')]);module[_0xfb7d('0x23')]=router; \ No newline at end of file +var _0x89b5=['removeDispositions','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','addDisposition','addAgents','update','destroy','delete'];(function(_0x463bfb,_0x48389a){var _0x3e9770=function(_0x9e41e1){while(--_0x9e41e1){_0x463bfb['push'](_0x463bfb['shift']());}};_0x3e9770(++_0x48389a);}(_0x89b5,0x16d));var _0x589b=function(_0x15c6a2,_0x35479d){_0x15c6a2=_0x15c6a2-0x0;var _0x56ba13=_0x89b5[_0x15c6a2];return _0x56ba13;};'use strict';var multer=require('multer');var util=require(_0x589b('0x0'));var path=require(_0x589b('0x1'));var timeout=require(_0x589b('0x2'));var express=require(_0x589b('0x3'));var router=express['Router']();var fs_extra=require(_0x589b('0x4'));var auth=require(_0x589b('0x5'));var interaction=require(_0x589b('0x6'));var config=require(_0x589b('0x7'));var controller=require(_0x589b('0x8'));router[_0x589b('0x9')]('/',auth[_0x589b('0xa')](),controller[_0x589b('0xb')]);router[_0x589b('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x589b('0xc')]);router['get'](_0x589b('0xd'),auth[_0x589b('0xa')](),controller[_0x589b('0xe')]);router['get'](_0x589b('0xf'),auth[_0x589b('0xa')](),controller[_0x589b('0x10')]);router['get'](_0x589b('0x11'),auth['isAuthenticated'](),controller[_0x589b('0x12')]);router[_0x589b('0x9')](_0x589b('0x13'),auth[_0x589b('0xa')](),controller[_0x589b('0x14')]);router[_0x589b('0x9')]('/:id/contacts/csv',auth[_0x589b('0xa')](),controller['getContactsCsv']);router[_0x589b('0x9')](_0x589b('0x15'),auth['isAuthenticated'](),controller[_0x589b('0x16')]);router[_0x589b('0x9')](_0x589b('0x17'),auth[_0x589b('0xa')](),controller[_0x589b('0x18')]);router[_0x589b('0x19')]('/',auth[_0x589b('0xa')](),controller['create']);router[_0x589b('0x19')]('/:id/dispositions',auth[_0x589b('0xa')](),controller[_0x589b('0x1a')]);router[_0x589b('0x19')](_0x589b('0x13'),auth[_0x589b('0xa')](),controller['addContacts']);router[_0x589b('0x19')]('/:id/fields',auth[_0x589b('0xa')](),controller['addCustomField']);router[_0x589b('0x19')](_0x589b('0x17'),auth['isAuthenticated'](),controller[_0x589b('0x1b')]);router['put']('/:id',auth[_0x589b('0xa')](),controller[_0x589b('0x1c')]);router['delete'](_0x589b('0xf'),auth[_0x589b('0xa')](),controller[_0x589b('0x1d')]);router[_0x589b('0x1e')](_0x589b('0x11'),auth['isAuthenticated'](),controller[_0x589b('0x1f')]);router[_0x589b('0x1e')](_0x589b('0x17'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x589b('0x20')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 19b5b19..0b762d5 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 _0xddbc=['getDataValue','field','STRING','sequelize','exports','VIRTUAL'];(function(_0x104e21,_0x2ea86f){var _0x605b37=function(_0x580fce){while(--_0x580fce){_0x104e21['push'](_0x104e21['shift']());}};_0x605b37(++_0x2ea86f);}(_0xddbc,0xbd));var _0xcddb=function(_0xecaf71,_0x3905af){_0xecaf71=_0xecaf71-0x0;var _0x25b220=_0xddbc[_0xecaf71];return _0x25b220;};'use strict';var Sequelize=require(_0xcddb('0x0'));module[_0xcddb('0x1')]={'name':{'type':Sequelize[_0xcddb('0x2')],'get':function(_0x52f533){return this[_0xcddb('0x3')](_0xcddb('0x4'));}},'field':{'type':Sequelize[_0xcddb('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0xcddb('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0xcddb('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0x586f=['exports','getDataValue','field','STRING'];(function(_0x44723b,_0x59c5f5){var _0x1588b2=function(_0x2d9d6b){while(--_0x2d9d6b){_0x44723b['push'](_0x44723b['shift']());}};_0x1588b2(++_0x59c5f5);}(_0x586f,0x198));var _0xf586=function(_0x3616bb,_0x86fe00){_0x3616bb=_0x3616bb-0x0;var _0x1c0994=_0x586f[_0x3616bb];return _0x1c0994;};'use strict';var Sequelize=require('sequelize');module[_0xf586('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5dc217){return this[_0xf586('0x1')](_0xf586('0x2'));}},'field':{'type':Sequelize[_0xf586('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xf586('0x3')],'allowNull':![]},'value':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a956627..ee07124 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x1b1237,_0x4a8e35){var _0x1d96bc=function(_0x5c4442){while(--_0x5c4442){_0x1b1237['push'](_0x1b1237['shift']());}};_0x1d96bc(++_0x4a8e35);}(_0x7a54,0x106));var _0x47a5=function(_0x1f6afc,_0x201fac){_0x1f6afc=_0x1f6afc-0x0;var _0x58c863=_0x7a54[_0x1f6afc];return _0x58c863;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0x5c6c88,_0x295dc3){var _0x446f11=function(_0x48c003){while(--_0x48c003){_0x5c6c88['push'](_0x5c6c88['shift']());}};_0x446f11(++_0x295dc3);}(_0x7a54,0x106));var _0x47a5=function(_0x22d4f7,_0x58e48b){_0x22d4f7=_0x22d4f7-0x0;var _0x5a7584=_0x7a54[_0x22d4f7];return _0x5a7584;};'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 bc8ba87..f74ac71 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 _0x85b7=['request-promise','path','rimraf','../../config/environment','./condition.attributes','lodash','util','bluebird'];(function(_0x1d350c,_0x5c71a3){var _0x309b19=function(_0x2158f2){while(--_0x2158f2){_0x1d350c['push'](_0x1d350c['shift']());}};_0x309b19(++_0x5c71a3);}(_0x85b7,0x195));var _0x785b=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x85b7[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x785b('0x0'));var util=require(_0x785b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x785b('0x2'));var rp=require(_0x785b('0x3'));var fs=require('fs');var path=require(_0x785b('0x4'));var rimraf=require(_0x785b('0x5'));var config=require(_0x785b('0x6'));var attributes=require(_0x785b('0x7'));module['exports']=function(_0x2a9844,_0xfef705){return _0x2a9844['define']('Condition',attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0264=['bluebird','request-promise','path','rimraf','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment'];(function(_0xd41dfd,_0x372b7b){var _0x420ac3=function(_0x56f6cc){while(--_0x56f6cc){_0xd41dfd['push'](_0xd41dfd['shift']());}};_0x420ac3(++_0x372b7b);}(_0x0264,0x1d7));var _0x4026=function(_0x5bbda4,_0x5d2892){_0x5bbda4=_0x5bbda4-0x0;var _0x980a85=_0x0264[_0x5bbda4];return _0x980a85;};'use strict';var _=require(_0x4026('0x0'));var util=require(_0x4026('0x1'));var logger=require(_0x4026('0x2'))(_0x4026('0x3'));var moment=require(_0x4026('0x4'));var BPromise=require(_0x4026('0x5'));var rp=require(_0x4026('0x6'));var fs=require('fs');var path=require(_0x4026('0x7'));var rimraf=require(_0x4026('0x8'));var config=require(_0x4026('0x9'));var attributes=require(_0x4026('0xa'));module[_0x4026('0xb')]=function(_0x5e2413,_0x54c95c){return _0x5e2413['define'](_0x4026('0xc'),attributes,{'tableName':_0x4026('0xd'),'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 b2aad15..00da2c5 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 _0x18f5=['then','info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x1ce6d7,_0x59daef){var _0x23006e=function(_0x1a6997){while(--_0x1a6997){_0x1ce6d7['push'](_0x1ce6d7['shift']());}};_0x23006e(++_0x59daef);}(_0x18f5,0x14c));var _0x518f=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x18f5[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x518f('0x0'));var util=require(_0x518f('0x1'));var moment=require('moment');var BPromise=require(_0x518f('0x2'));var rs=require(_0x518f('0x3'));var fs=require('fs');var Redis=require(_0x518f('0x4'));var db=require(_0x518f('0x5'))['db'];var utils=require(_0x518f('0x6'));var logger=require(_0x518f('0x7'))(_0x518f('0x8'));var config=require(_0x518f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x518f('0xa')][_0x518f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x10146b,_0x30c2d1,_0x4d9fef){return new BPromise(function(_0x555724,_0x36cac0){return client[_0x518f('0xc')](_0x10146b,_0x4d9fef)[_0x518f('0xd')](function(_0x4825b9){logger[_0x518f('0xe')](_0x518f('0xf'),_0x30c2d1,'request\x20sent');logger[_0x518f('0x10')](_0x518f('0x11'),_0x30c2d1,_0x518f('0x12'),JSON['stringify'](_0x4825b9));if(_0x4825b9[_0x518f('0x13')]){if(_0x4825b9[_0x518f('0x13')][_0x518f('0x14')]===0x1f4){logger[_0x518f('0x13')](_0x518f('0xf'),_0x30c2d1,_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);return _0x36cac0(_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);}logger[_0x518f('0x13')](_0x518f('0xf'),_0x30c2d1,_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);return _0x555724(_0x4825b9[_0x518f('0x13')][_0x518f('0x15')]);}else{logger[_0x518f('0xe')](_0x518f('0xf'),_0x30c2d1,_0x518f('0x12'));_0x555724(_0x4825b9[_0x518f('0x16')][_0x518f('0x15')]);}})['catch'](function(_0x5ceb72){logger['error'](_0x518f('0xf'),_0x30c2d1,_0x5ceb72);_0x36cac0(_0x5ceb72);});});} \ No newline at end of file +var _0x63ba=['../../config/logger','rpc','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x63ba,0x1d9));var _0xa63b=function(_0x3edfb0,_0x412aa1){_0x3edfb0=_0x3edfb0-0x0;var _0x41cf8e=_0x63ba[_0x3edfb0];return _0x41cf8e;};'use strict';var _=require(_0xa63b('0x0'));var util=require(_0xa63b('0x1'));var moment=require(_0xa63b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa63b('0x3'));var fs=require('fs');var Redis=require(_0xa63b('0x4'));var db=require(_0xa63b('0x5'))['db'];var utils=require(_0xa63b('0x6'));var logger=require(_0xa63b('0x7'))(_0xa63b('0x8'));var config=require('../../config/environment');var jayson=require(_0xa63b('0x9'));var client=jayson[_0xa63b('0xa')][_0xa63b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4c18ae,_0x3b56cf,_0x4b2f88){return new BPromise(function(_0x29dc10,_0x2de453){return client[_0xa63b('0xc')](_0x4c18ae,_0x4b2f88)[_0xa63b('0xd')](function(_0x1a834a){logger[_0xa63b('0xe')](_0xa63b('0xf'),_0x3b56cf,_0xa63b('0x10'));logger[_0xa63b('0x11')](_0xa63b('0x12'),_0x3b56cf,_0xa63b('0x10'),JSON[_0xa63b('0x13')](_0x1a834a));if(_0x1a834a[_0xa63b('0x14')]){if(_0x1a834a[_0xa63b('0x14')][_0xa63b('0x15')]===0x1f4){logger[_0xa63b('0x14')](_0xa63b('0xf'),_0x3b56cf,_0x1a834a[_0xa63b('0x14')][_0xa63b('0x16')]);return _0x2de453(_0x1a834a[_0xa63b('0x14')][_0xa63b('0x16')]);}logger[_0xa63b('0x14')](_0xa63b('0xf'),_0x3b56cf,_0x1a834a[_0xa63b('0x14')][_0xa63b('0x16')]);return _0x29dc10(_0x1a834a[_0xa63b('0x14')][_0xa63b('0x16')]);}else{logger['info'](_0xa63b('0xf'),_0x3b56cf,'request\x20sent');_0x29dc10(_0x1a834a['result'][_0xa63b('0x16')]);}})[_0xa63b('0x17')](function(_0x3879aa){logger[_0xa63b('0x14')](_0xa63b('0xf'),_0x3b56cf,_0x3879aa);_0x2de453(_0x3879aa);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index bdc15d9..4be7fbd 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 _0xd97d=['/:id','multer','util','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete'];(function(_0x4a61ad,_0x4b1e21){var _0x2a060b=function(_0x587882){while(--_0x587882){_0x4a61ad['push'](_0x4a61ad['shift']());}};_0x2a060b(++_0x4b1e21);}(_0xd97d,0x1b9));var _0xdd97=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xd97d[_0x279d37];return _0x530173;};'use strict';var multer=require(_0xdd97('0x0'));var util=require(_0xdd97('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd97('0x2'));var interaction=require(_0xdd97('0x3'));var config=require(_0xdd97('0x4'));var controller=require(_0xdd97('0x5'));router[_0xdd97('0x6')]('/:id',auth[_0xdd97('0x7')](),controller[_0xdd97('0x8')]);router[_0xdd97('0x9')](_0xdd97('0xa'),auth[_0xdd97('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5253=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put','isAuthenticated','update','delete','/:id','destroy','exports','multer','util','path','express'];(function(_0x1311d8,_0x1f592c){var _0x4ad599=function(_0x30a9ca){while(--_0x30a9ca){_0x1311d8['push'](_0x1311d8['shift']());}};_0x4ad599(++_0x1f592c);}(_0x5253,0xfb));var _0x3525=function(_0xc4611b,_0x39e07e){_0xc4611b=_0xc4611b-0x0;var _0x5514a4=_0x5253[_0xc4611b];return _0x5514a4;};'use strict';var multer=require(_0x3525('0x0'));var util=require(_0x3525('0x1'));var path=require(_0x3525('0x2'));var timeout=require('connect-timeout');var express=require(_0x3525('0x3'));var router=express[_0x3525('0x4')]();var fs_extra=require(_0x3525('0x5'));var auth=require(_0x3525('0x6'));var interaction=require(_0x3525('0x7'));var config=require(_0x3525('0x8'));var controller=require(_0x3525('0x9'));router[_0x3525('0xa')]('/:id',auth[_0x3525('0xb')](),controller[_0x3525('0xc')]);router[_0x3525('0xd')](_0x3525('0xe'),auth[_0x3525('0xb')](),controller[_0x3525('0xf')]);module[_0x3525('0x10')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 87f9aee..1f50bcb 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 _0xa064=['STRING','name','sequelize','exports'];(function(_0x31ab90,_0x145a96){var _0x2d6123=function(_0x2bf73f){while(--_0x2bf73f){_0x31ab90['push'](_0x31ab90['shift']());}};_0x2d6123(++_0x145a96);}(_0xa064,0x19a));var _0x4a06=function(_0xf1402a,_0x187f5c){_0xf1402a=_0xf1402a-0x0;var _0x4f7ead=_0xa064[_0xf1402a];return _0x4f7ead;};'use strict';var Sequelize=require(_0x4a06('0x0'));module[_0x4a06('0x1')]={'name':{'type':Sequelize[_0x4a06('0x2')],'allowNull':![],'unique':_0x4a06('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x2220=['exports','name','INTEGER','STRING','sequelize'];(function(_0x58999b,_0xea4695){var _0x5efc3a=function(_0x98de31){while(--_0x98de31){_0x58999b['push'](_0x58999b['shift']());}};_0x5efc3a(++_0xea4695);}(_0x2220,0xa4));var _0x0222=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x2220[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x0222('0x0'));module[_0x0222('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0222('0x2')},'OrderBy':{'type':Sequelize[_0x0222('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0222('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index c79b54e..4cb7775 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 _0xd7d1=['autoAssociation','UserProfileResource','create','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','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x2e3108,_0x9d5811){var _0x88d17=function(_0x4cdae6){while(--_0x4cdae6){_0x2e3108['push'](_0x2e3108['shift']());}};_0x88d17(++_0x9d5811);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x34e25a,_0x31464c){_0x34e25a=_0x34e25a-0x0;var _0x1f7eec=_0xd7d1[_0x34e25a];return _0x1f7eec;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file +var _0x0424=['rows','catch','params','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get','ContactItemTypes','UserProfileResource','destroy','error','stack','name','send','map','ContactItemType','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include'];(function(_0x376158,_0xa7664e){var _0x73b423=function(_0x31cc2b){while(--_0x31cc2b){_0x376158['push'](_0x376158['shift']());}};_0x73b423(++_0xa7664e);}(_0x0424,0x159));var _0x4042=function(_0x2f2cb6,_0x5f5576){_0x2f2cb6=_0x2f2cb6-0x0;var _0x33c4a7=_0x0424[_0x2f2cb6];return _0x33c4a7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4042('0x0'));var jsonpatch=require(_0x4042('0x1'));var rp=require(_0x4042('0x2'));var moment=require(_0x4042('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4042('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4042('0x5'));var csv=require(_0x4042('0x6'));var ejs=require(_0x4042('0x7'));var fs=require('fs');var fs_extra=require(_0x4042('0x8'));var _=require(_0x4042('0x9'));var squel=require(_0x4042('0xa'));var crypto=require(_0x4042('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x4042('0x6'));var querystring=require(_0x4042('0xc'));var Papa=require(_0x4042('0xd'));var Redis=require('ioredis');var authService=require(_0x4042('0xe'));var qs=require(_0x4042('0xf'));var as=require(_0x4042('0x10'));var hardwareService=require(_0x4042('0x11'));var logger=require(_0x4042('0x12'))(_0x4042('0x13'));var utils=require(_0x4042('0x14'));var config=require(_0x4042('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x4042('0x16'))['db'];function respondWithStatusCode(_0x357838,_0x59a068){_0x59a068=_0x59a068||0xcc;return function(_0x25fd0a){if(_0x25fd0a){return _0x357838[_0x4042('0x17')](_0x59a068);}return _0x357838[_0x4042('0x18')](_0x59a068)[_0x4042('0x19')]();};}function respondWithResult(_0x35f82a,_0x1ff3ca){_0x1ff3ca=_0x1ff3ca||0xc8;return function(_0xc115bd){if(_0xc115bd){return _0x35f82a['status'](_0x1ff3ca)[_0x4042('0x1a')](_0xc115bd);}};}function respondWithFilteredResult(_0x291e5c,_0x50206f){return function(_0x28087d){if(_0x28087d){var _0x3f99f8=typeof _0x50206f[_0x4042('0x1b')]===_0x4042('0x1c')&&typeof _0x50206f[_0x4042('0x1d')]===_0x4042('0x1c');var _0x62cb76=_0x28087d[_0x4042('0x1e')];var _0x466077=_0x3f99f8?0x0:_0x50206f['offset'];var _0xe5c1ec=_0x3f99f8?_0x28087d['count']:_0x50206f[_0x4042('0x1b')]+_0x50206f['limit'];var _0xca9ca6;if(_0xe5c1ec>=_0x62cb76){_0xe5c1ec=_0x62cb76;_0xca9ca6=0xc8;}else{_0xca9ca6=0xce;}_0x291e5c[_0x4042('0x18')](_0xca9ca6);return _0x291e5c[_0x4042('0x1f')](_0x4042('0x20'),_0x466077+'-'+_0xe5c1ec+'/'+_0x62cb76)['json'](_0x28087d);}return null;};}function patchUpdates(_0xb72021){return function(_0x4561e3){try{jsonpatch[_0x4042('0x21')](_0x4561e3,_0xb72021,!![]);}catch(_0xd1ddb){return BPromise['reject'](_0xd1ddb);}return _0x4561e3[_0x4042('0x22')]();};}function saveUpdates(_0xf0e0c6,_0xd6fe6c){return function(_0x83ce71){if(_0x83ce71){return _0x83ce71[_0x4042('0x23')](_0xf0e0c6)['then'](function(_0x1f9d4a){return _0x1f9d4a;});}return null;};}function removeEntity(_0x6d12a5,_0x519f2c){return function(_0x1daee8){if(_0x1daee8){return _0x1daee8['destroy']()[_0x4042('0x24')](function(){var _0x2c5fcf=_0x1daee8[_0x4042('0x25')]({'plain':!![]});var _0x5d5c6d=_0x4042('0x26');return db[_0x4042('0x27')][_0x4042('0x28')]({'where':{'type':_0x5d5c6d,'resourceId':_0x2c5fcf['id']}})[_0x4042('0x24')](function(){return _0x1daee8;});})[_0x4042('0x24')](function(){_0x6d12a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8d48,_0x1acdf2){return function(_0x26542c){if(!_0x26542c){_0x1d8d48[_0x4042('0x17')](0x194);}return _0x26542c;};}function handleError(_0x332fe3,_0x473a0d){_0x473a0d=_0x473a0d||0x1f4;return function(_0x5eb84b){logger[_0x4042('0x29')](_0x5eb84b[_0x4042('0x2a')]);if(_0x5eb84b['name']){delete _0x5eb84b[_0x4042('0x2b')];}_0x332fe3[_0x4042('0x18')](_0x473a0d)[_0x4042('0x2c')](_0x5eb84b);};}exports['index']=function(_0x56d49a,_0x3d1f48){var _0x43bd1c={},_0x59773f={},_0x3e9304={'count':0x0,'rows':[]};var _0xc42d70=_[_0x4042('0x2d')](db[_0x4042('0x2e')][_0x4042('0x2f')],function(_0x349c74){return{'name':_0x349c74[_0x4042('0x30')],'type':_0x349c74[_0x4042('0x31')][_0x4042('0x32')]};});_0x59773f['model']=_[_0x4042('0x2d')](_0xc42d70,_0x4042('0x2b'));_0x59773f['query']=_[_0x4042('0x33')](_0x56d49a[_0x4042('0x34')]);_0x59773f['filters']=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],_0x59773f[_0x4042('0x34')]);_0x43bd1c[_0x4042('0x37')]=_[_0x4042('0x35')](_0x59773f[_0x4042('0x36')],qs[_0x4042('0x38')](_0x56d49a[_0x4042('0x34')][_0x4042('0x38')]));_0x43bd1c[_0x4042('0x37')]=_0x43bd1c[_0x4042('0x37')][_0x4042('0x39')]?_0x43bd1c[_0x4042('0x37')]:_0x59773f[_0x4042('0x36')];if(!_0x56d49a[_0x4042('0x34')][_0x4042('0x3a')](_0x4042('0x3b'))){_0x43bd1c[_0x4042('0x1d')]=qs[_0x4042('0x1d')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1d')]);_0x43bd1c['offset']=qs[_0x4042('0x1b')](_0x56d49a[_0x4042('0x34')][_0x4042('0x1b')]);}_0x43bd1c[_0x4042('0x3c')]=qs['sort'](_0x56d49a[_0x4042('0x34')][_0x4042('0x3d')]);_0x43bd1c[_0x4042('0x3e')]=qs[_0x4042('0x3f')](_[_0x4042('0x40')](_0x56d49a[_0x4042('0x34')],_0x59773f[_0x4042('0x3f')]),_0xc42d70);if(_0x56d49a[_0x4042('0x34')][_0x4042('0x41')]){_0x43bd1c[_0x4042('0x3e')]=_['merge'](_0x43bd1c[_0x4042('0x3e')],{'$or':_[_0x4042('0x2d')](_0xc42d70,function(_0x2f07d8){if(_0x2f07d8[_0x4042('0x31')]!==_0x4042('0x42')){var _0x112e88={};_0x112e88[_0x2f07d8[_0x4042('0x2b')]]={'$like':'%'+_0x56d49a[_0x4042('0x34')]['filter']+'%'};return _0x112e88;}})});}_0x43bd1c=_['merge']({},_0x43bd1c,_0x56d49a[_0x4042('0x43')]);var _0x16468f={'where':_0x43bd1c[_0x4042('0x3e')]};return db[_0x4042('0x2e')][_0x4042('0x1e')](_0x16468f)[_0x4042('0x24')](function(_0xdfb5cb){_0x3e9304[_0x4042('0x1e')]=_0xdfb5cb;if(_0x56d49a[_0x4042('0x34')][_0x4042('0x44')]){_0x43bd1c[_0x4042('0x45')]=[{'all':!![]}];}return db[_0x4042('0x2e')]['findAll'](_0x43bd1c);})['then'](function(_0x929884){_0x3e9304[_0x4042('0x46')]=_0x929884;return _0x3e9304;})['then'](respondWithFilteredResult(_0x3d1f48,_0x43bd1c))[_0x4042('0x47')](handleError(_0x3d1f48,null));};exports['show']=function(_0x25c516,_0x411354){var _0x32ba6f={'raw':!![],'where':{'id':_0x25c516[_0x4042('0x48')]['id']}},_0x4ece0d={};_0x4ece0d[_0x4042('0x36')]=_['keys'](db[_0x4042('0x2e')][_0x4042('0x2f')]);_0x4ece0d[_0x4042('0x34')]=_[_0x4042('0x33')](_0x25c516[_0x4042('0x34')]);_0x4ece0d['filters']=_['intersection'](_0x4ece0d['model'],_0x4ece0d[_0x4042('0x34')]);_0x32ba6f[_0x4042('0x37')]=_['intersection'](_0x4ece0d['model'],qs['fields'](_0x25c516[_0x4042('0x34')]['fields']));_0x32ba6f['attributes']=_0x32ba6f[_0x4042('0x37')][_0x4042('0x39')]?_0x32ba6f[_0x4042('0x37')]:_0x4ece0d[_0x4042('0x36')];if(_0x25c516[_0x4042('0x34')][_0x4042('0x44')]){_0x32ba6f[_0x4042('0x45')]=[{'all':!![]}];}_0x32ba6f=_[_0x4042('0x49')]({},_0x32ba6f,_0x25c516[_0x4042('0x43')]);return db['ContactItemType']['find'](_0x32ba6f)['then'](handleEntityNotFound(_0x411354,null))['then'](respondWithResult(_0x411354,null))[_0x4042('0x47')](handleError(_0x411354,null));};exports[_0x4042('0x4a')]=function(_0xd898ea,_0x250434){return db[_0x4042('0x2e')][_0x4042('0x4a')](_0xd898ea[_0x4042('0x4b')],{})[_0x4042('0x24')](function(_0x4a14bd){var _0x24071a=_0xd898ea[_0x4042('0x4c')][_0x4042('0x25')]({'plain':!![]});if(!_0x24071a)throw new Error(_0x4042('0x4d'));if(_0x24071a[_0x4042('0x4e')]===_0x4042('0x4c')){var _0xf5f38a=_0x4a14bd['get']({'plain':!![]});var _0x5ed001='ContactItemTypes';return db[_0x4042('0x4f')][_0x4042('0x50')]({'where':{'name':_0x5ed001,'userProfileId':_0x24071a['userProfileId']},'raw':!![]})[_0x4042('0x24')](function(_0xa5323d){if(_0xa5323d&&_0xa5323d['autoAssociation']===0x0){return db['UserProfileResource'][_0x4042('0x4a')]({'name':_0xf5f38a[_0x4042('0x2b')],'resourceId':_0xf5f38a['id'],'type':_0xa5323d[_0x4042('0x2b')],'sectionId':_0xa5323d['id']},{})[_0x4042('0x24')](function(){return _0x4a14bd;});}else{return _0x4a14bd;}})[_0x4042('0x47')](function(_0x478645){logger[_0x4042('0x29')](_0x4042('0x51'),_0x478645);throw _0x478645;});}return _0x4a14bd;})[_0x4042('0x24')](respondWithResult(_0x250434,0xc9))[_0x4042('0x47')](handleError(_0x250434,null));};exports[_0x4042('0x23')]=function(_0xfdd409,_0x3876ce){if(_0xfdd409['body']['id']){delete _0xfdd409['body']['id'];}return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0xfdd409[_0x4042('0x48')]['id']}})['then'](handleEntityNotFound(_0x3876ce,null))[_0x4042('0x24')](saveUpdates(_0xfdd409['body'],null))[_0x4042('0x24')](respondWithResult(_0x3876ce,null))['catch'](handleError(_0x3876ce,null));};exports[_0x4042('0x28')]=function(_0x1cba67,_0x22b633){return db[_0x4042('0x2e')][_0x4042('0x50')]({'where':{'id':_0x1cba67[_0x4042('0x48')]['id']}})[_0x4042('0x24')](handleEntityNotFound(_0x22b633,null))[_0x4042('0x24')](db[_0x4042('0x52')]['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x1cba67[_0x4042('0x48')]['id']}}))[_0x4042('0x24')](removeEntity(_0x22b633,null))[_0x4042('0x47')](handleError(_0x22b633,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1b4dad9..d64b08f 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 _0x89c4=['path','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x33051b,_0x4a2656){var _0x347b4c=function(_0x46c108){while(--_0x46c108){_0x33051b['push'](_0x33051b['shift']());}};_0x347b4c(++_0x4a2656);}(_0x89c4,0x1aa));var _0x489c=function(_0x5085ca,_0x227aef){_0x5085ca=_0x5085ca-0x0;var _0x246084=_0x89c4[_0x5085ca];return _0x246084;};'use strict';var _=require(_0x489c('0x0'));var util=require(_0x489c('0x1'));var logger=require(_0x489c('0x2'))(_0x489c('0x3'));var moment=require('moment');var BPromise=require(_0x489c('0x4'));var rp=require(_0x489c('0x5'));var fs=require('fs');var path=require(_0x489c('0x6'));var rimraf=require(_0x489c('0x7'));var config=require(_0x489c('0x8'));var attributes=require(_0x489c('0x9'));module['exports']=function(_0xd706af,_0x1873cf){return _0xd706af['define'](_0x489c('0xa'),attributes,{'tableName':_0x489c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['request-promise','rimraf','../../config/environment','./contactItemType.attributes','exports','ContactItemType','tools_contact_item_types','util','../../config/logger','bluebird'];(function(_0x3efc05,_0x2034d4){var _0x5428a1=function(_0x20ed9e){while(--_0x20ed9e){_0x3efc05['push'](_0x3efc05['shift']());}};_0x5428a1(++_0x2034d4);}(_0x0adf,0xb1));var _0xf0ad=function(_0x2161f0,_0xd5d2f0){_0x2161f0=_0x2161f0-0x0;var _0x19cc30=_0x0adf[_0x2161f0];return _0x19cc30;};'use strict';var _=require('lodash');var util=require(_0xf0ad('0x0'));var logger=require(_0xf0ad('0x1'))('api');var moment=require('moment');var BPromise=require(_0xf0ad('0x2'));var rp=require(_0xf0ad('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf0ad('0x4'));var config=require(_0xf0ad('0x5'));var attributes=require(_0xf0ad('0x6'));module[_0xf0ad('0x7')]=function(_0x4d5966,_0x857488){return _0x4d5966['define'](_0xf0ad('0x8'),attributes,{'tableName':_0xf0ad('0x9'),'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 484726d..cb4b603 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 _0x2d72=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','ContactItemType,\x20%s,\x20%s','debug','ContactItemType,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5c1b30,_0x40e70a){var _0x3eb46d=function(_0xfa32f){while(--_0xfa32f){_0x5c1b30['push'](_0x5c1b30['shift']());}};_0x3eb46d(++_0x40e70a);}(_0x2d72,0x119));var _0x22d7=function(_0xc587f5,_0x20721e){_0xc587f5=_0xc587f5-0x0;var _0x374b1e=_0x2d72[_0xc587f5];return _0x374b1e;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22d7('0x5'))['db'];var utils=require(_0x22d7('0x6'));var logger=require(_0x22d7('0x7'))(_0x22d7('0x8'));var config=require(_0x22d7('0x9'));var jayson=require(_0x22d7('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x34739c,_0x323350,_0x2098ec){return new BPromise(function(_0x2fb8c1,_0x43e733){return client[_0x22d7('0xb')](_0x34739c,_0x2098ec)['then'](function(_0x54c69e){logger[_0x22d7('0xc')](_0x22d7('0xd'),_0x323350,'request\x20sent');logger[_0x22d7('0xe')](_0x22d7('0xf'),_0x323350,_0x22d7('0x10'),JSON[_0x22d7('0x11')](_0x54c69e));if(_0x54c69e['error']){if(_0x54c69e[_0x22d7('0x12')][_0x22d7('0x13')]===0x1f4){logger[_0x22d7('0x12')](_0x22d7('0xd'),_0x323350,_0x54c69e[_0x22d7('0x12')][_0x22d7('0x14')]);return _0x43e733(_0x54c69e[_0x22d7('0x12')][_0x22d7('0x14')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x323350,_0x54c69e[_0x22d7('0x12')]['message']);return _0x2fb8c1(_0x54c69e[_0x22d7('0x12')][_0x22d7('0x14')]);}else{logger[_0x22d7('0xc')](_0x22d7('0xd'),_0x323350,_0x22d7('0x10'));_0x2fb8c1(_0x54c69e['result'][_0x22d7('0x14')]);}})[_0x22d7('0x15')](function(_0xe90890){logger[_0x22d7('0x12')]('ContactItemType,\x20%s,\x20%s',_0x323350,_0xe90890);_0x43e733(_0xe90890);});});} \ No newline at end of file +var _0xed60=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xed60,0x81));var _0x0ed6=function(_0x4a48dd,_0x54e0ef){_0x4a48dd=_0x4a48dd-0x0;var _0x138b0c=_0xed60[_0x4a48dd];return _0x138b0c;};'use strict';var _=require(_0x0ed6('0x0'));var util=require(_0x0ed6('0x1'));var moment=require('moment');var BPromise=require(_0x0ed6('0x2'));var rs=require(_0x0ed6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ed6('0x4'))['db'];var utils=require(_0x0ed6('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0ed6('0x6'));var jayson=require(_0x0ed6('0x7'));var client=jayson[_0x0ed6('0x8')][_0x0ed6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b2b81,_0x381200,_0x35f04c){return new BPromise(function(_0x4e635a,_0x1af544){return client[_0x0ed6('0xa')](_0x4b2b81,_0x35f04c)[_0x0ed6('0xb')](function(_0xa83c84){logger['info'](_0x0ed6('0xc'),_0x381200,_0x0ed6('0xd'));logger[_0x0ed6('0xe')](_0x0ed6('0xf'),_0x381200,_0x0ed6('0xd'),JSON['stringify'](_0xa83c84));if(_0xa83c84['error']){if(_0xa83c84[_0x0ed6('0x10')][_0x0ed6('0x11')]===0x1f4){logger[_0x0ed6('0x10')]('ContactItemType,\x20%s,\x20%s',_0x381200,_0xa83c84[_0x0ed6('0x10')]['message']);return _0x1af544(_0xa83c84['error']['message']);}logger[_0x0ed6('0x10')](_0x0ed6('0xc'),_0x381200,_0xa83c84[_0x0ed6('0x10')][_0x0ed6('0x12')]);return _0x4e635a(_0xa83c84['error'][_0x0ed6('0x12')]);}else{logger[_0x0ed6('0x13')](_0x0ed6('0xc'),_0x381200,_0x0ed6('0xd'));_0x4e635a(_0xa83c84[_0x0ed6('0x14')][_0x0ed6('0x12')]);}})[_0x0ed6('0x15')](function(_0x5e2f4d){logger[_0x0ed6('0x10')]('ContactItemType,\x20%s,\x20%s',_0x381200,_0x5e2f4d);_0x1af544(_0x5e2f4d);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 6ad43ea..11a8ba4 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 _0x8551=['index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller'];(function(_0x3dd2de,_0x224bd1){var _0x85ee26=function(_0x3b55b5){while(--_0x3b55b5){_0x3dd2de['push'](_0x3dd2de['shift']());}};_0x85ee26(++_0x224bd1);}(_0x8551,0x84));var _0x1855=function(_0x17f145,_0x3422bb){_0x17f145=_0x17f145-0x0;var _0x2d5420=_0x8551[_0x17f145];return _0x2d5420;};'use strict';var multer=require(_0x1855('0x0'));var util=require(_0x1855('0x1'));var path=require(_0x1855('0x2'));var timeout=require('connect-timeout');var express=require(_0x1855('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x1855('0x4'));var interaction=require(_0x1855('0x5'));var config=require(_0x1855('0x6'));var controller=require(_0x1855('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x1855('0x8')]);router[_0x1855('0x9')](_0x1855('0xa'),auth[_0x1855('0xb')](),controller[_0x1855('0xc')]);router[_0x1855('0xd')]('/',auth['isAuthenticated'](),controller[_0x1855('0xe')]);router[_0x1855('0xf')](_0x1855('0xa'),auth[_0x1855('0xb')](),controller[_0x1855('0x10')]);router[_0x1855('0x11')]('/:id',auth[_0x1855('0xb')](),controller[_0x1855('0x12')]);module[_0x1855('0x13')]=router; \ No newline at end of file +var _0x5b73=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','post','create','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b73,0x1a5));var _0x35b7=function(_0x4fda88,_0x1a4d19){_0x4fda88=_0x4fda88-0x0;var _0xe37511=_0x5b73[_0x4fda88];return _0xe37511;};'use strict';var multer=require(_0x35b7('0x0'));var util=require(_0x35b7('0x1'));var path=require(_0x35b7('0x2'));var timeout=require('connect-timeout');var express=require(_0x35b7('0x3'));var router=express[_0x35b7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x35b7('0x5'));var interaction=require(_0x35b7('0x6'));var config=require(_0x35b7('0x7'));var controller=require('./contactItemType.controller');router[_0x35b7('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35b7('0x8')](_0x35b7('0x9'),auth[_0x35b7('0xa')](),controller[_0x35b7('0xb')]);router[_0x35b7('0xc')]('/',auth[_0x35b7('0xa')](),controller[_0x35b7('0xd')]);router[_0x35b7('0xe')](_0x35b7('0x9'),auth[_0x35b7('0xa')](),controller[_0x35b7('0xf')]);router[_0x35b7('0x10')](_0x35b7('0x9'),auth[_0x35b7('0xa')](),controller[_0x35b7('0x11')]);module[_0x35b7('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 26ce194..ce368cc 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['STRING','sequelize'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'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 0180d06..b792c6f 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 _0xb940=['getItems','findOne','filters','hasOwnProperty','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','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','localhost','socket.io-emitter','redis','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','query','keys','attributes','intersection','model','fields','order','sort','where','pick','filter','merge','options','includeAll','include','Dashboard','findAll','catch','show','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','updatedAt','autoAssociation','find','type','iframe','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem'];(function(_0x4bcda0,_0x1bdbfd){var _0x278fbf=function(_0x38ca76){while(--_0x38ca76){_0x4bcda0['push'](_0x4bcda0['shift']());}};_0x278fbf(++_0x1bdbfd);}(_0xb940,0x10f));var _0x0b94=function(_0x54dcad,_0x554f46){_0x54dcad=_0x54dcad-0x0;var _0x537c56=_0xb940[_0x54dcad];return _0x537c56;};'use strict';var emlformat=require(_0x0b94('0x0'));var rimraf=require(_0x0b94('0x1'));var zipdir=require(_0x0b94('0x2'));var jsonpatch=require(_0x0b94('0x3'));var rp=require(_0x0b94('0x4'));var moment=require('moment');var BPromise=require(_0x0b94('0x5'));var Mustache=require(_0x0b94('0x6'));var util=require(_0x0b94('0x7'));var path=require(_0x0b94('0x8'));var sox=require(_0x0b94('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b94('0xa'));var squel=require(_0x0b94('0xb'));var crypto=require(_0x0b94('0xc'));var jsforce=require(_0x0b94('0xd'));var deskjs=require(_0x0b94('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0b94('0xf'));var Papa=require(_0x0b94('0x10'));var Redis=require(_0x0b94('0x11'));var authService=require(_0x0b94('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0b94('0x13'));var hardwareService=require(_0x0b94('0x14'));var logger=require(_0x0b94('0x15'))(_0x0b94('0x16'));var utils=require(_0x0b94('0x17'));var config=require(_0x0b94('0x18'));var licenseUtil=require(_0x0b94('0x19'));var db=require(_0x0b94('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x0b94('0x1b'),'port':0x18eb});var socket=require(_0x0b94('0x1c'))(new Redis(config[_0x0b94('0x1d')]));require('./dashboard.socket')['register'](socket);function respondWithStatusCode(_0x3e5b7f,_0x4a674f){_0x4a674f=_0x4a674f||0xcc;return function(_0x2cd9ce){if(_0x2cd9ce){return _0x3e5b7f[_0x0b94('0x1e')](_0x4a674f);}return _0x3e5b7f[_0x0b94('0x1f')](_0x4a674f)[_0x0b94('0x20')]();};}function respondWithResult(_0x56bddf,_0xcf2bb6){_0xcf2bb6=_0xcf2bb6||0xc8;return function(_0x5909c1){if(_0x5909c1){return _0x56bddf['status'](_0xcf2bb6)[_0x0b94('0x21')](_0x5909c1);}};}function respondWithFilteredResult(_0x1e1b34,_0x4ca050){return function(_0x497b3f){if(_0x497b3f){var _0x56543e=typeof _0x4ca050['offset']==='undefined'&&typeof _0x4ca050[_0x0b94('0x22')]===_0x0b94('0x23');var _0x3219d6=_0x497b3f[_0x0b94('0x24')];var _0x56375e=_0x56543e?0x0:_0x4ca050['offset'];var _0x46131b=_0x56543e?_0x497b3f[_0x0b94('0x24')]:_0x4ca050[_0x0b94('0x25')]+_0x4ca050[_0x0b94('0x22')];var _0x4e5714;if(_0x46131b>=_0x3219d6){_0x46131b=_0x3219d6;_0x4e5714=0xc8;}else{_0x4e5714=0xce;}_0x1e1b34['status'](_0x4e5714);return _0x1e1b34[_0x0b94('0x26')](_0x0b94('0x27'),_0x56375e+'-'+_0x46131b+'/'+_0x3219d6)[_0x0b94('0x21')](_0x497b3f);}return null;};}function patchUpdates(_0x2ab370){return function(_0x22ccab){try{jsonpatch[_0x0b94('0x28')](_0x22ccab,_0x2ab370,!![]);}catch(_0x51807e){return BPromise[_0x0b94('0x29')](_0x51807e);}return _0x22ccab[_0x0b94('0x2a')]();};}function saveUpdates(_0x4776ee,_0x4504cb){return function(_0x3b41fb){if(_0x3b41fb){return _0x3b41fb[_0x0b94('0x2b')](_0x4776ee)[_0x0b94('0x2c')](function(_0x45bf4c){return _0x45bf4c;});}return null;};}function removeEntity(_0x4be68f,_0x438138){return function(_0x672d47){if(_0x672d47){return _0x672d47[_0x0b94('0x2d')]()[_0x0b94('0x2c')](function(){var _0x4e381f=_0x672d47[_0x0b94('0x2e')]({'plain':!![]});var _0xcea9f7=_0x0b94('0x2f');return db[_0x0b94('0x30')][_0x0b94('0x2d')]({'where':{'type':_0xcea9f7,'resourceId':_0x4e381f['id']}})[_0x0b94('0x2c')](function(){return _0x672d47;});})[_0x0b94('0x2c')](function(){_0x4be68f[_0x0b94('0x1f')](0xcc)[_0x0b94('0x20')]();});}};}function handleEntityNotFound(_0x57768c,_0xb8dcdf){return function(_0x3f51af){if(!_0x3f51af){_0x57768c['sendStatus'](0x194);}return _0x3f51af;};}function handleError(_0x48047d,_0x80c160){_0x80c160=_0x80c160||0x1f4;return function(_0x48b949){logger[_0x0b94('0x31')](_0x48b949[_0x0b94('0x32')]);if(_0x48b949[_0x0b94('0x33')]){delete _0x48b949['name'];}_0x48047d[_0x0b94('0x1f')](_0x80c160)[_0x0b94('0x34')](_0x48b949);};}exports[_0x0b94('0x35')]=function(_0x23d07f,_0x2e961a){var _0x58889f={},_0x202a9c={},_0x9fb9f4={'count':0x0,'rows':[]};var _0x4f618a=_[_0x0b94('0x36')](db['Dashboard'][_0x0b94('0x37')],function(_0xd448fb){return{'name':_0xd448fb[_0x0b94('0x38')],'type':_0xd448fb['type'][_0x0b94('0x39')]};});_0x202a9c['model']=_[_0x0b94('0x36')](_0x4f618a,_0x0b94('0x33'));_0x202a9c[_0x0b94('0x3a')]=_[_0x0b94('0x3b')](_0x23d07f[_0x0b94('0x3a')]);_0x202a9c['filters']=_['intersection'](_0x202a9c['model'],_0x202a9c['query']);_0x58889f[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x202a9c[_0x0b94('0x3e')],qs[_0x0b94('0x3f')](_0x23d07f['query']['fields']));_0x58889f[_0x0b94('0x3c')]=_0x58889f['attributes']['length']?_0x58889f['attributes']:_0x202a9c['model'];if(!_0x23d07f[_0x0b94('0x3a')]['hasOwnProperty']('nolimit')){_0x58889f[_0x0b94('0x22')]=qs[_0x0b94('0x22')](_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x22')]);_0x58889f['offset']=qs[_0x0b94('0x25')](_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x25')]);}_0x58889f[_0x0b94('0x40')]=qs['sort'](_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x41')]);_0x58889f[_0x0b94('0x42')]=qs['filters'](_[_0x0b94('0x43')](_0x23d07f['query'],_0x202a9c['filters']),_0x4f618a);if(_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x44')]){_0x58889f['where']=_[_0x0b94('0x45')](_0x58889f[_0x0b94('0x42')],{'$or':_[_0x0b94('0x36')](_0x4f618a,function(_0x51d38e){if(_0x51d38e['type']!=='VIRTUAL'){var _0x55cb9b={};_0x55cb9b[_0x51d38e[_0x0b94('0x33')]]={'$like':'%'+_0x23d07f[_0x0b94('0x3a')]['filter']+'%'};return _0x55cb9b;}})});}_0x58889f=_['merge']({},_0x58889f,_0x23d07f[_0x0b94('0x46')]);var _0x4725d3={'where':_0x58889f[_0x0b94('0x42')]};return db['Dashboard'][_0x0b94('0x24')](_0x4725d3)[_0x0b94('0x2c')](function(_0x2c3fe5){_0x9fb9f4['count']=_0x2c3fe5;if(_0x23d07f[_0x0b94('0x3a')][_0x0b94('0x47')]){_0x58889f[_0x0b94('0x48')]=[{'all':!![]}];}return db[_0x0b94('0x49')][_0x0b94('0x4a')](_0x58889f);})[_0x0b94('0x2c')](function(_0x3230e2){_0x9fb9f4['rows']=_0x3230e2;return _0x9fb9f4;})[_0x0b94('0x2c')](respondWithFilteredResult(_0x2e961a,_0x58889f))[_0x0b94('0x4b')](handleError(_0x2e961a,null));};exports[_0x0b94('0x4c')]=function(_0x35ae38,_0x108458){var _0xddb158={'raw':![],'where':{'id':_0x35ae38['params']['id']}},_0x3dad11={};_0x3dad11['model']=_[_0x0b94('0x3b')](db[_0x0b94('0x49')]['rawAttributes']);_0x3dad11[_0x0b94('0x3a')]=_['keys'](_0x35ae38['query']);_0x3dad11['filters']=_[_0x0b94('0x3d')](_0x3dad11['model'],_0x3dad11[_0x0b94('0x3a')]);_0xddb158[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x3dad11[_0x0b94('0x3e')],qs[_0x0b94('0x3f')](_0x35ae38[_0x0b94('0x3a')][_0x0b94('0x3f')]));_0xddb158[_0x0b94('0x3c')]=_0xddb158[_0x0b94('0x3c')][_0x0b94('0x4d')]?_0xddb158[_0x0b94('0x3c')]:_0x3dad11['model'];if(_0x35ae38['query'][_0x0b94('0x47')]){_0xddb158[_0x0b94('0x48')]=[{'all':!![]}];}_0xddb158=_['merge']({},_0xddb158,_0x35ae38[_0x0b94('0x46')]);return db[_0x0b94('0x49')]['find'](_0xddb158)[_0x0b94('0x2c')](handleEntityNotFound(_0x108458,null))[_0x0b94('0x2c')](respondWithResult(_0x108458,null))['catch'](handleError(_0x108458,null));};exports['create']=function(_0x4ed179,_0x40e840){return db[_0x0b94('0x49')][_0x0b94('0x4e')](_0x4ed179[_0x0b94('0x4f')],{})[_0x0b94('0x2c')](function(_0x2524d5){var _0x538250=_0x4ed179[_0x0b94('0x50')]['get']({'plain':!![]});if(!_0x538250)throw new Error(_0x0b94('0x51'));if(_0x538250[_0x0b94('0x52')]==='user'){var _0x54cb3e=_0x2524d5[_0x0b94('0x2e')]({'plain':!![]});var _0x1c0024=_0x0b94('0x2f');return db[_0x0b94('0x53')]['find']({'where':{'name':_0x1c0024,'userProfileId':_0x538250[_0x0b94('0x54')]},'raw':!![]})['then'](function(_0x410d0c){if(_0x410d0c&&_0x410d0c['autoAssociation']===0x0){return db['UserProfileResource'][_0x0b94('0x4e')]({'name':_0x54cb3e[_0x0b94('0x33')],'resourceId':_0x54cb3e['id'],'type':_0x410d0c[_0x0b94('0x33')],'sectionId':_0x410d0c['id']},{})['then'](function(){return _0x2524d5;});}else{return _0x2524d5;}})[_0x0b94('0x4b')](function(_0x3a66ab){logger[_0x0b94('0x31')](_0x0b94('0x55'),_0x3a66ab);throw _0x3a66ab;});}return _0x2524d5;})[_0x0b94('0x2c')](respondWithResult(_0x40e840,0xc9))[_0x0b94('0x4b')](handleError(_0x40e840,null));};exports['clone']=function(_0x4ca45d,_0x636296){var _0x54853f={'where':{'id':_0x4ca45d[_0x0b94('0x56')]['id']}},_0x186e14={};_0x186e14[_0x0b94('0x3e')]=_[_0x0b94('0x3b')](db[_0x0b94('0x49')][_0x0b94('0x37')]);_0x54853f[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x186e14['model'],qs[_0x0b94('0x3f')](_0x4ca45d['query'][_0x0b94('0x3f')]));_0x54853f['attributes']=_0x54853f[_0x0b94('0x3c')][_0x0b94('0x4d')]?_0x54853f[_0x0b94('0x3c')]:_0x186e14[_0x0b94('0x3e')];if(_0x4ca45d[_0x0b94('0x3a')][_0x0b94('0x47')]){_0x54853f[_0x0b94('0x48')]=[{'all':!![]}];}_0x54853f=_[_0x0b94('0x45')]({},_0x54853f,_0x4ca45d['options']);return db[_0x0b94('0x49')]['find'](_0x54853f)[_0x0b94('0x2c')](handleEntityNotFound(_0x636296,null))[_0x0b94('0x2c')](function(_0x14ccd3){if(_0x14ccd3){var _0x455613=_0x14ccd3[_0x0b94('0x2e')]({'plain':!![]});_0x455613=qs[_0x0b94('0x57')](_0x455613,['id','createdAt',_0x0b94('0x58')]);_0x4ca45d['body']=_[_0x0b94('0x57')](_0x4ca45d[_0x0b94('0x4f')],['id','createdAt',_0x0b94('0x58')]);return db[_0x0b94('0x49')][_0x0b94('0x4e')](_[_0x0b94('0x45')](_0x455613,_0x4ca45d[_0x0b94('0x4f')]),{'include':_0x4ca45d[_0x0b94('0x3a')][_0x0b94('0x47')]?[{'all':!![]}]:undefined})[_0x0b94('0x2c')](function(_0x920255){var _0x58b71f=_0x4ca45d[_0x0b94('0x50')]['get']({'plain':!![]});if(!_0x58b71f)throw new Error(_0x0b94('0x51'));if(_0x58b71f['role']===_0x0b94('0x50')){var _0x15264d=_0x920255['get']({'plain':!![]});var _0xd933b5='CustomDashboards';return db[_0x0b94('0x53')]['find']({'where':{'name':_0xd933b5,'userProfileId':_0x58b71f['userProfileId']},'raw':!![]})[_0x0b94('0x2c')](function(_0x2ed383){if(_0x2ed383&&_0x2ed383[_0x0b94('0x59')]===0x0){return db['UserProfileResource'][_0x0b94('0x4e')]({'name':_0x15264d[_0x0b94('0x33')],'resourceId':_0x15264d['id'],'type':_0x2ed383[_0x0b94('0x33')],'sectionId':_0x2ed383['id']},{})[_0x0b94('0x2c')](function(){return _0x920255;});}else{return _0x920255;}})[_0x0b94('0x4b')](function(_0x26a564){logger[_0x0b94('0x31')](_0x0b94('0x55'),_0x26a564);throw _0x26a564;});}return _0x920255;});}})[_0x0b94('0x2c')](respondWithResult(_0x636296,0xc9))['catch'](handleError(_0x636296,null));};exports['update']=function(_0x448cba,_0x282cbb){if(_0x448cba[_0x0b94('0x4f')]['id']){delete _0x448cba[_0x0b94('0x4f')]['id'];}return db[_0x0b94('0x49')][_0x0b94('0x5a')]({'where':{'id':_0x448cba[_0x0b94('0x56')]['id']}})[_0x0b94('0x2c')](handleEntityNotFound(_0x282cbb,null))[_0x0b94('0x2c')](saveUpdates(_0x448cba[_0x0b94('0x4f')],null))[_0x0b94('0x2c')](respondWithResult(_0x282cbb,null))['catch'](handleError(_0x282cbb,null));};exports['destroy']=function(_0x228330,_0x309226){return db[_0x0b94('0x49')][_0x0b94('0x5a')]({'where':{'id':_0x228330[_0x0b94('0x56')]['id']}})[_0x0b94('0x2c')](handleEntityNotFound(_0x309226,null))[_0x0b94('0x2c')](removeEntity(_0x309226,null))['catch'](handleError(_0x309226,null));};function widgetAttributes(_0x27a9da){try{switch(_0x27a9da[_0x0b94('0x5b')]){case _0x0b94('0x5c'):return[{'name':_0x0b94('0x5d'),'value':_0x27a9da['attrUrl']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x0]?_0x27a9da['attrs'][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x60')}];case'custom':return[{'name':'attrPath','value':_0x27a9da[_0x0b94('0x61')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||''}];case'clock':return[{'name':_0x0b94('0x62'),'value':_0x27a9da[_0x0b94('0x62')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x63')},{'name':_0x0b94('0x64'),'value':_0x27a9da[_0x0b94('0x64')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x1]?_0x27a9da[_0x0b94('0x5e')][0x1]['value']:undefined)||_0x0b94('0x65')},{'name':_0x0b94('0x66'),'value':_0x27a9da[_0x0b94('0x66')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x2]?_0x27a9da[_0x0b94('0x5e')][0x2][_0x0b94('0x5f')]:undefined)||0xc}];case _0x0b94('0x67'):return[{'name':_0x0b94('0x68'),'value':_0x27a9da[_0x0b94('0x68')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x69')},{'name':_0x0b94('0x6a'),'value':_0x27a9da['attrVoiceQueues']||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x1]?_0x27a9da[_0x0b94('0x5e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x27a9da['attrFontSize']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x2]?_0x27a9da[_0x0b94('0x5e')][0x2][_0x0b94('0x5f')]:undefined)||0x14},{'name':'attrChannel','value':_0x27a9da[_0x0b94('0x6b')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x3]?_0x27a9da[_0x0b94('0x5e')][0x3]['value']:undefined)||_0x0b94('0x6c')},{'name':'attrEmailAccounts','value':_0x27a9da[_0x0b94('0x6d')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x4]?_0x27a9da[_0x0b94('0x5e')][0x4][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x6e'),'value':_0x27a9da[_0x0b94('0x6e')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x5]?_0x27a9da[_0x0b94('0x5e')][0x5][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x6f'),'value':_0x27a9da[_0x0b94('0x6f')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x6]?_0x27a9da[_0x0b94('0x5e')][0x6]['value']:undefined)||''},{'name':_0x0b94('0x70'),'value':_0x27a9da[_0x0b94('0x70')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x7]?_0x27a9da[_0x0b94('0x5e')][0x7][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x71'),'value':_0x27a9da[_0x0b94('0x71')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x8]?_0x27a9da[_0x0b94('0x5e')][0x8][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x72'),'value':_0x27a9da[_0x0b94('0x72')]||(_0x27a9da['attrs']&&_0x27a9da['attrs'][0x9]?_0x27a9da[_0x0b94('0x5e')][0x9][_0x0b94('0x5f')]:undefined)||''}];case _0x0b94('0x73'):case _0x0b94('0x74'):return[{'name':_0x0b94('0x75'),'value':_0x27a9da[_0x0b94('0x75')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0][_0x0b94('0x5f')]:undefined)||_0x0b94('0x69')},{'name':_0x0b94('0x76'),'value':_0x27a9da[_0x0b94('0x76')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x1]?_0x27a9da['attrs'][0x1]['value']:undefined)||null},{'name':_0x0b94('0x77'),'value':_0x27a9da[_0x0b94('0x77')]||(_0x27a9da['attrs']&&_0x27a9da['attrs'][0x2]?_0x27a9da[_0x0b94('0x5e')][0x2][_0x0b94('0x5f')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x27a9da[_0x0b94('0x6a')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x3]?_0x27a9da[_0x0b94('0x5e')][0x3][_0x0b94('0x5f')]:undefined)||[]},{'name':_0x0b94('0x6b'),'value':_0x27a9da[_0x0b94('0x6b')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x4]?_0x27a9da[_0x0b94('0x5e')][0x4][_0x0b94('0x5f')]:undefined)||_0x0b94('0x6c')},{'name':_0x0b94('0x6d'),'value':_0x27a9da[_0x0b94('0x6d')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x5]?_0x27a9da['attrs'][0x5][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x6e'),'value':_0x27a9da['attrFaxAccounts']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x6]?_0x27a9da[_0x0b94('0x5e')][0x6][_0x0b94('0x5f')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x27a9da[_0x0b94('0x6f')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x7]?_0x27a9da['attrs'][0x7]['value']:undefined)||''},{'name':_0x0b94('0x70'),'value':_0x27a9da[_0x0b94('0x70')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x8]?_0x27a9da['attrs'][0x8][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x71'),'value':_0x27a9da[_0x0b94('0x71')]||(_0x27a9da['attrs']&&_0x27a9da[_0x0b94('0x5e')][0x9]?_0x27a9da['attrs'][0x9][_0x0b94('0x5f')]:undefined)||''},{'name':_0x0b94('0x72'),'value':_0x27a9da[_0x0b94('0x72')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0xa]?_0x27a9da[_0x0b94('0x5e')][0xa][_0x0b94('0x5f')]:undefined)||''}];case _0x0b94('0x78'):return[{'name':_0x0b94('0x79'),'type':_0x27a9da[_0x0b94('0x7a')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da['attrs'][0x0]?_0x27a9da[_0x0b94('0x5e')][0x0]['type']:undefined)||null,'value':_0x27a9da[_0x0b94('0x79')]||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x0]?_0x27a9da['attrs'][0x0]['value']:undefined)||null},{'name':_0x0b94('0x7b'),'value':_0x27a9da['attrRefresh']||(_0x27a9da[_0x0b94('0x5e')]&&_0x27a9da[_0x0b94('0x5e')][0x1]?_0x27a9da[_0x0b94('0x5e')][0x1][_0x0b94('0x5f')]:undefined)||0x0}];default:return[];}}catch(_0x1eed78){logger[_0x0b94('0x31')](_0x0b94('0x7c'),JSON[_0x0b94('0x7d')](_0x1eed78));return[];}}exports[_0x0b94('0x7e')]=function(_0x20b34e,_0x5f2a7b,_0x1bce98){if(_0x20b34e['body']['id']){delete _0x20b34e[_0x0b94('0x4f')]['id'];}return db[_0x0b94('0x49')][_0x0b94('0x5a')]({'where':{'id':_0x20b34e[_0x0b94('0x56')]['id']}})[_0x0b94('0x2c')](handleEntityNotFound(_0x5f2a7b,null))['then'](function(_0x25b6ac){if(_0x25b6ac){_0x20b34e[_0x0b94('0x4f')]['DashboardId']=_0x25b6ac['id'];_0x20b34e[_0x0b94('0x4f')][_0x0b94('0x5e')]=widgetAttributes(_0x20b34e[_0x0b94('0x4f')]);return db[_0x0b94('0x7f')][_0x0b94('0x4e')](_0x20b34e['body']);}})[_0x0b94('0x2c')](respondWithResult(_0x5f2a7b,null))[_0x0b94('0x4b')](handleError(_0x5f2a7b,null));};exports[_0x0b94('0x80')]=function(_0x513fc5,_0x46effb,_0x43d499){var _0x1cd791={};var _0x1733ea={};var _0x17cc97;var _0x9fc75e;return db[_0x0b94('0x49')][_0x0b94('0x81')]({'where':{'id':_0x513fc5[_0x0b94('0x56')]['id']}})['then'](handleEntityNotFound(_0x46effb,null))[_0x0b94('0x2c')](function(_0xa84e9){if(_0xa84e9){_0x17cc97=_0xa84e9;_0x1733ea[_0x0b94('0x3e')]=_['keys'](db['DashboardItem'][_0x0b94('0x37')]);_0x1733ea[_0x0b94('0x3a')]=_[_0x0b94('0x3b')](_0x513fc5['query']);_0x1733ea[_0x0b94('0x82')]=_['intersection'](_0x1733ea[_0x0b94('0x3e')],_0x1733ea[_0x0b94('0x3a')]);_0x1cd791[_0x0b94('0x3c')]=_[_0x0b94('0x3d')](_0x1733ea[_0x0b94('0x3e')],qs[_0x0b94('0x3f')](_0x513fc5['query'][_0x0b94('0x3f')]));_0x1cd791[_0x0b94('0x3c')]=_0x1cd791[_0x0b94('0x3c')][_0x0b94('0x4d')]?_0x1cd791['attributes']:_0x1733ea[_0x0b94('0x3e')];_0x1cd791[_0x0b94('0x40')]=qs[_0x0b94('0x41')](_0x513fc5['query'][_0x0b94('0x41')]);_0x1cd791[_0x0b94('0x42')]=qs['filters'](_['pick'](_0x513fc5[_0x0b94('0x3a')],_0x1733ea['filters']));if(_0x513fc5[_0x0b94('0x3a')]['filter']){_0x1cd791['where']=_[_0x0b94('0x45')](_0x1cd791[_0x0b94('0x42')],{'$or':_[_0x0b94('0x36')](_0x1cd791[_0x0b94('0x3c')],function(_0x5ba96c){var _0x3295fa={};_0x3295fa[_0x5ba96c]={'$like':'%'+_0x513fc5[_0x0b94('0x3a')]['filter']+'%'};return _0x3295fa;})});}_0x1cd791=_['merge']({},_0x1cd791,_0x513fc5[_0x0b94('0x46')]);return _0x17cc97[_0x0b94('0x80')](_0x1cd791);}})['then'](function(_0x52b87e){if(_0x52b87e){_0x9fc75e=_0x52b87e[_0x0b94('0x4d')];if(!_0x513fc5[_0x0b94('0x3a')][_0x0b94('0x83')](_0x0b94('0x84'))){_0x1cd791[_0x0b94('0x22')]=qs[_0x0b94('0x22')](_0x513fc5['query'][_0x0b94('0x22')]);_0x1cd791[_0x0b94('0x25')]=qs['offset'](_0x513fc5[_0x0b94('0x3a')][_0x0b94('0x25')]);}return _0x17cc97['getItems'](_0x1cd791);}})[_0x0b94('0x2c')](function(_0x4a3a4f){if(_0x4a3a4f){return _0x4a3a4f?{'count':_0x9fc75e,'rows':_0x4a3a4f}:null;}})[_0x0b94('0x2c')](respondWithResult(_0x46effb,null))['catch'](handleError(_0x46effb,null));}; \ No newline at end of file +var _0xfb74=['attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','DashboardItem','getItems','nolimit','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','end','json','undefined','limit','count','status','set','apply','reject','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','attributes','hasOwnProperty','offset','order','sort','where','pick','filter','merge','findAll','rows','catch','params','keys','intersection','fields','length','includeAll','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','options','omit','createdAt','updatedAt','body','UserProfileSection','userProfileId','update','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues'];(function(_0x20832e,_0x545081){var _0xba4ef7=function(_0x43318a){while(--_0x43318a){_0x20832e['push'](_0x20832e['shift']());}};_0xba4ef7(++_0x545081);}(_0xfb74,0x94));var _0x4fb7=function(_0x38af48,_0x400460){_0x38af48=_0x38af48-0x0;var _0x445384=_0xfb74[_0x38af48];return _0x445384;};'use strict';var emlformat=require(_0x4fb7('0x0'));var rimraf=require(_0x4fb7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4fb7('0x2'));var rp=require('request-promise');var moment=require(_0x4fb7('0x3'));var BPromise=require(_0x4fb7('0x4'));var Mustache=require('mustache');var util=require(_0x4fb7('0x5'));var path=require(_0x4fb7('0x6'));var sox=require('sox');var csv=require(_0x4fb7('0x7'));var ejs=require(_0x4fb7('0x8'));var fs=require('fs');var fs_extra=require(_0x4fb7('0x9'));var _=require(_0x4fb7('0xa'));var squel=require(_0x4fb7('0xb'));var crypto=require(_0x4fb7('0xc'));var jsforce=require(_0x4fb7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4fb7('0x7'));var querystring=require('querystring');var Papa=require(_0x4fb7('0xe'));var Redis=require(_0x4fb7('0xf'));var authService=require(_0x4fb7('0x10'));var qs=require(_0x4fb7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4fb7('0x12'));var logger=require('../../config/logger')(_0x4fb7('0x13'));var utils=require(_0x4fb7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4fb7('0x15'));var db=require(_0x4fb7('0x16'))['db'];config['redis']=_[_0x4fb7('0x17')](config[_0x4fb7('0x18')],{'host':_0x4fb7('0x19'),'port':0x18eb});var socket=require(_0x4fb7('0x1a'))(new Redis(config[_0x4fb7('0x18')]));require(_0x4fb7('0x1b'))[_0x4fb7('0x1c')](socket);function respondWithStatusCode(_0x274667,_0x19663e){_0x19663e=_0x19663e||0xcc;return function(_0x253705){if(_0x253705){return _0x274667['sendStatus'](_0x19663e);}return _0x274667['status'](_0x19663e)[_0x4fb7('0x1d')]();};}function respondWithResult(_0x9f670c,_0x476f07){_0x476f07=_0x476f07||0xc8;return function(_0x5e95b3){if(_0x5e95b3){return _0x9f670c['status'](_0x476f07)[_0x4fb7('0x1e')](_0x5e95b3);}};}function respondWithFilteredResult(_0x205f3e,_0x3b202c){return function(_0x2c2dda){if(_0x2c2dda){var _0x3faf6f=typeof _0x3b202c['offset']===_0x4fb7('0x1f')&&typeof _0x3b202c[_0x4fb7('0x20')]===_0x4fb7('0x1f');var _0x323cdd=_0x2c2dda['count'];var _0x505085=_0x3faf6f?0x0:_0x3b202c['offset'];var _0x5c48dc=_0x3faf6f?_0x2c2dda[_0x4fb7('0x21')]:_0x3b202c['offset']+_0x3b202c['limit'];var _0x14faa3;if(_0x5c48dc>=_0x323cdd){_0x5c48dc=_0x323cdd;_0x14faa3=0xc8;}else{_0x14faa3=0xce;}_0x205f3e[_0x4fb7('0x22')](_0x14faa3);return _0x205f3e[_0x4fb7('0x23')]('Content-Range',_0x505085+'-'+_0x5c48dc+'/'+_0x323cdd)[_0x4fb7('0x1e')](_0x2c2dda);}return null;};}function patchUpdates(_0x455001){return function(_0xd319ce){try{jsonpatch[_0x4fb7('0x24')](_0xd319ce,_0x455001,!![]);}catch(_0x4daae3){return BPromise[_0x4fb7('0x25')](_0x4daae3);}return _0xd319ce['save']();};}function saveUpdates(_0x228965,_0x4380e2){return function(_0x4ecfd8){if(_0x4ecfd8){return _0x4ecfd8['update'](_0x228965)[_0x4fb7('0x26')](function(_0x37ccab){return _0x37ccab;});}return null;};}function removeEntity(_0x1e4c8f,_0x4c78b6){return function(_0xeb03ef){if(_0xeb03ef){return _0xeb03ef[_0x4fb7('0x27')]()[_0x4fb7('0x26')](function(){var _0x46db50=_0xeb03ef[_0x4fb7('0x28')]({'plain':!![]});var _0xa8378f=_0x4fb7('0x29');return db[_0x4fb7('0x2a')]['destroy']({'where':{'type':_0xa8378f,'resourceId':_0x46db50['id']}})[_0x4fb7('0x26')](function(){return _0xeb03ef;});})[_0x4fb7('0x26')](function(){_0x1e4c8f[_0x4fb7('0x22')](0xcc)[_0x4fb7('0x1d')]();});}};}function handleEntityNotFound(_0x43cdf2,_0x351907){return function(_0x2cddbe){if(!_0x2cddbe){_0x43cdf2['sendStatus'](0x194);}return _0x2cddbe;};}function handleError(_0x3e3fe0,_0x13dbe7){_0x13dbe7=_0x13dbe7||0x1f4;return function(_0x5e5d0d){logger[_0x4fb7('0x2b')](_0x5e5d0d[_0x4fb7('0x2c')]);if(_0x5e5d0d[_0x4fb7('0x2d')]){delete _0x5e5d0d[_0x4fb7('0x2d')];}_0x3e3fe0[_0x4fb7('0x22')](_0x13dbe7)[_0x4fb7('0x2e')](_0x5e5d0d);};}exports[_0x4fb7('0x2f')]=function(_0x45ebce,_0x589a59){var _0x532a07={},_0xcb3e49={},_0x5d20c2={'count':0x0,'rows':[]};var _0x385ac9=_[_0x4fb7('0x30')](db[_0x4fb7('0x31')][_0x4fb7('0x32')],function(_0x5e7a26){return{'name':_0x5e7a26[_0x4fb7('0x33')],'type':_0x5e7a26[_0x4fb7('0x34')][_0x4fb7('0x35')]};});_0xcb3e49[_0x4fb7('0x36')]=_['map'](_0x385ac9,_0x4fb7('0x2d'));_0xcb3e49[_0x4fb7('0x37')]=_['keys'](_0x45ebce[_0x4fb7('0x37')]);_0xcb3e49[_0x4fb7('0x38')]=_['intersection'](_0xcb3e49[_0x4fb7('0x36')],_0xcb3e49['query']);_0x532a07['attributes']=_['intersection'](_0xcb3e49[_0x4fb7('0x36')],qs['fields'](_0x45ebce[_0x4fb7('0x37')]['fields']));_0x532a07[_0x4fb7('0x39')]=_0x532a07[_0x4fb7('0x39')]['length']?_0x532a07['attributes']:_0xcb3e49[_0x4fb7('0x36')];if(!_0x45ebce[_0x4fb7('0x37')][_0x4fb7('0x3a')]('nolimit')){_0x532a07[_0x4fb7('0x20')]=qs[_0x4fb7('0x20')](_0x45ebce[_0x4fb7('0x37')][_0x4fb7('0x20')]);_0x532a07['offset']=qs[_0x4fb7('0x3b')](_0x45ebce[_0x4fb7('0x37')]['offset']);}_0x532a07[_0x4fb7('0x3c')]=qs[_0x4fb7('0x3d')](_0x45ebce[_0x4fb7('0x37')]['sort']);_0x532a07[_0x4fb7('0x3e')]=qs[_0x4fb7('0x38')](_[_0x4fb7('0x3f')](_0x45ebce[_0x4fb7('0x37')],_0xcb3e49[_0x4fb7('0x38')]),_0x385ac9);if(_0x45ebce[_0x4fb7('0x37')]['filter']){_0x532a07[_0x4fb7('0x3e')]=_['merge'](_0x532a07[_0x4fb7('0x3e')],{'$or':_[_0x4fb7('0x30')](_0x385ac9,function(_0x50e02a){if(_0x50e02a[_0x4fb7('0x34')]!=='VIRTUAL'){var _0x2f178e={};_0x2f178e[_0x50e02a[_0x4fb7('0x2d')]]={'$like':'%'+_0x45ebce[_0x4fb7('0x37')][_0x4fb7('0x40')]+'%'};return _0x2f178e;}})});}_0x532a07=_[_0x4fb7('0x41')]({},_0x532a07,_0x45ebce['options']);var _0xc54930={'where':_0x532a07[_0x4fb7('0x3e')]};return db['Dashboard'][_0x4fb7('0x21')](_0xc54930)['then'](function(_0xa5c5e8){_0x5d20c2['count']=_0xa5c5e8;if(_0x45ebce[_0x4fb7('0x37')]['includeAll']){_0x532a07['include']=[{'all':!![]}];}return db[_0x4fb7('0x31')][_0x4fb7('0x42')](_0x532a07);})['then'](function(_0x16db16){_0x5d20c2[_0x4fb7('0x43')]=_0x16db16;return _0x5d20c2;})[_0x4fb7('0x26')](respondWithFilteredResult(_0x589a59,_0x532a07))[_0x4fb7('0x44')](handleError(_0x589a59,null));};exports['show']=function(_0x25042b,_0x1a9e93){var _0x43978f={'raw':![],'where':{'id':_0x25042b[_0x4fb7('0x45')]['id']}},_0x29dcc6={};_0x29dcc6['model']=_[_0x4fb7('0x46')](db[_0x4fb7('0x31')][_0x4fb7('0x32')]);_0x29dcc6[_0x4fb7('0x37')]=_[_0x4fb7('0x46')](_0x25042b[_0x4fb7('0x37')]);_0x29dcc6[_0x4fb7('0x38')]=_[_0x4fb7('0x47')](_0x29dcc6[_0x4fb7('0x36')],_0x29dcc6[_0x4fb7('0x37')]);_0x43978f[_0x4fb7('0x39')]=_[_0x4fb7('0x47')](_0x29dcc6[_0x4fb7('0x36')],qs[_0x4fb7('0x48')](_0x25042b[_0x4fb7('0x37')][_0x4fb7('0x48')]));_0x43978f[_0x4fb7('0x39')]=_0x43978f['attributes'][_0x4fb7('0x49')]?_0x43978f[_0x4fb7('0x39')]:_0x29dcc6[_0x4fb7('0x36')];if(_0x25042b[_0x4fb7('0x37')][_0x4fb7('0x4a')]){_0x43978f[_0x4fb7('0x4b')]=[{'all':!![]}];}_0x43978f=_['merge']({},_0x43978f,_0x25042b['options']);return db['Dashboard'][_0x4fb7('0x4c')](_0x43978f)[_0x4fb7('0x26')](handleEntityNotFound(_0x1a9e93,null))[_0x4fb7('0x26')](respondWithResult(_0x1a9e93,null))[_0x4fb7('0x44')](handleError(_0x1a9e93,null));};exports[_0x4fb7('0x4d')]=function(_0x488dd2,_0xeef90c){return db['Dashboard']['create'](_0x488dd2['body'],{})[_0x4fb7('0x26')](function(_0x85ca74){var _0x23605b=_0x488dd2['user'][_0x4fb7('0x28')]({'plain':!![]});if(!_0x23605b)throw new Error(_0x4fb7('0x4e'));if(_0x23605b[_0x4fb7('0x4f')]===_0x4fb7('0x50')){var _0x3b5d28=_0x85ca74[_0x4fb7('0x28')]({'plain':!![]});var _0x39d98c=_0x4fb7('0x29');return db['UserProfileSection'][_0x4fb7('0x4c')]({'where':{'name':_0x39d98c,'userProfileId':_0x23605b['userProfileId']},'raw':!![]})['then'](function(_0x231da9){if(_0x231da9&&_0x231da9[_0x4fb7('0x51')]===0x0){return db['UserProfileResource'][_0x4fb7('0x4d')]({'name':_0x3b5d28[_0x4fb7('0x2d')],'resourceId':_0x3b5d28['id'],'type':_0x231da9[_0x4fb7('0x2d')],'sectionId':_0x231da9['id']},{})['then'](function(){return _0x85ca74;});}else{return _0x85ca74;}})[_0x4fb7('0x44')](function(_0x26bbb8){logger[_0x4fb7('0x2b')](_0x4fb7('0x52'),_0x26bbb8);throw _0x26bbb8;});}return _0x85ca74;})[_0x4fb7('0x26')](respondWithResult(_0xeef90c,0xc9))[_0x4fb7('0x44')](handleError(_0xeef90c,null));};exports[_0x4fb7('0x53')]=function(_0x2ee3c2,_0x285527){var _0x5b423f={'where':{'id':_0x2ee3c2['params']['id']}},_0x5e3cb5={};_0x5e3cb5[_0x4fb7('0x36')]=_[_0x4fb7('0x46')](db[_0x4fb7('0x31')]['rawAttributes']);_0x5b423f[_0x4fb7('0x39')]=_['intersection'](_0x5e3cb5[_0x4fb7('0x36')],qs[_0x4fb7('0x48')](_0x2ee3c2[_0x4fb7('0x37')][_0x4fb7('0x48')]));_0x5b423f[_0x4fb7('0x39')]=_0x5b423f[_0x4fb7('0x39')][_0x4fb7('0x49')]?_0x5b423f[_0x4fb7('0x39')]:_0x5e3cb5['model'];if(_0x2ee3c2[_0x4fb7('0x37')][_0x4fb7('0x4a')]){_0x5b423f[_0x4fb7('0x4b')]=[{'all':!![]}];}_0x5b423f=_[_0x4fb7('0x41')]({},_0x5b423f,_0x2ee3c2[_0x4fb7('0x54')]);return db[_0x4fb7('0x31')]['find'](_0x5b423f)[_0x4fb7('0x26')](handleEntityNotFound(_0x285527,null))[_0x4fb7('0x26')](function(_0x52ae61){if(_0x52ae61){var _0x52f5ff=_0x52ae61[_0x4fb7('0x28')]({'plain':!![]});_0x52f5ff=qs[_0x4fb7('0x55')](_0x52f5ff,['id',_0x4fb7('0x56'),_0x4fb7('0x57')]);_0x2ee3c2[_0x4fb7('0x58')]=_[_0x4fb7('0x55')](_0x2ee3c2[_0x4fb7('0x58')],['id',_0x4fb7('0x56'),'updatedAt']);return db[_0x4fb7('0x31')][_0x4fb7('0x4d')](_[_0x4fb7('0x41')](_0x52f5ff,_0x2ee3c2[_0x4fb7('0x58')]),{'include':_0x2ee3c2[_0x4fb7('0x37')][_0x4fb7('0x4a')]?[{'all':!![]}]:undefined})[_0x4fb7('0x26')](function(_0x42d010){var _0x598a8e=_0x2ee3c2[_0x4fb7('0x50')][_0x4fb7('0x28')]({'plain':!![]});if(!_0x598a8e)throw new Error(_0x4fb7('0x4e'));if(_0x598a8e[_0x4fb7('0x4f')]===_0x4fb7('0x50')){var _0x53cb54=_0x42d010[_0x4fb7('0x28')]({'plain':!![]});var _0x12e77b='CustomDashboards';return db[_0x4fb7('0x59')][_0x4fb7('0x4c')]({'where':{'name':_0x12e77b,'userProfileId':_0x598a8e[_0x4fb7('0x5a')]},'raw':!![]})[_0x4fb7('0x26')](function(_0x46f776){if(_0x46f776&&_0x46f776[_0x4fb7('0x51')]===0x0){return db[_0x4fb7('0x2a')][_0x4fb7('0x4d')]({'name':_0x53cb54[_0x4fb7('0x2d')],'resourceId':_0x53cb54['id'],'type':_0x46f776[_0x4fb7('0x2d')],'sectionId':_0x46f776['id']},{})['then'](function(){return _0x42d010;});}else{return _0x42d010;}})['catch'](function(_0x422e6f){logger[_0x4fb7('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x422e6f);throw _0x422e6f;});}return _0x42d010;});}})[_0x4fb7('0x26')](respondWithResult(_0x285527,0xc9))[_0x4fb7('0x44')](handleError(_0x285527,null));};exports[_0x4fb7('0x5b')]=function(_0x3e0e4e,_0x581f7a){if(_0x3e0e4e['body']['id']){delete _0x3e0e4e[_0x4fb7('0x58')]['id'];}return db[_0x4fb7('0x31')][_0x4fb7('0x4c')]({'where':{'id':_0x3e0e4e['params']['id']}})[_0x4fb7('0x26')](handleEntityNotFound(_0x581f7a,null))[_0x4fb7('0x26')](saveUpdates(_0x3e0e4e['body'],null))['then'](respondWithResult(_0x581f7a,null))[_0x4fb7('0x44')](handleError(_0x581f7a,null));};exports['destroy']=function(_0x4586e9,_0x22a808){return db['Dashboard']['find']({'where':{'id':_0x4586e9[_0x4fb7('0x45')]['id']}})[_0x4fb7('0x26')](handleEntityNotFound(_0x22a808,null))['then'](removeEntity(_0x22a808,null))['catch'](handleError(_0x22a808,null));};function widgetAttributes(_0x1997f4){try{switch(_0x1997f4[_0x4fb7('0x34')]){case _0x4fb7('0x5c'):return[{'name':_0x4fb7('0x5d'),'value':_0x1997f4['attrUrl']||(_0x1997f4['attrs']&&_0x1997f4[_0x4fb7('0x5e')][0x0]?_0x1997f4[_0x4fb7('0x5e')][0x0]['value']:undefined)||_0x4fb7('0x5f')}];case'custom':return[{'name':_0x4fb7('0x60'),'value':_0x1997f4[_0x4fb7('0x60')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x0]?_0x1997f4['attrs'][0x0][_0x4fb7('0x61')]:undefined)||''}];case _0x4fb7('0x62'):return[{'name':_0x4fb7('0x63'),'value':_0x1997f4[_0x4fb7('0x63')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x0]?_0x1997f4[_0x4fb7('0x5e')][0x0][_0x4fb7('0x61')]:undefined)||'HH:mm:ss'},{'name':_0x4fb7('0x64'),'value':_0x1997f4['attrTimezone']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x1]?_0x1997f4['attrs'][0x1][_0x4fb7('0x61')]:undefined)||_0x4fb7('0x65')},{'name':_0x4fb7('0x66'),'value':_0x1997f4['attrFontSize']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x2]?_0x1997f4[_0x4fb7('0x5e')][0x2][_0x4fb7('0x61')]:undefined)||0xc}];case'counter':return[{'name':_0x4fb7('0x67'),'value':_0x1997f4[_0x4fb7('0x67')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x0]?_0x1997f4[_0x4fb7('0x5e')][0x0][_0x4fb7('0x61')]:undefined)||_0x4fb7('0x68')},{'name':_0x4fb7('0x69'),'value':_0x1997f4[_0x4fb7('0x69')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x1]?_0x1997f4[_0x4fb7('0x5e')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1997f4['attrFontSize']||(_0x1997f4['attrs']&&_0x1997f4['attrs'][0x2]?_0x1997f4['attrs'][0x2][_0x4fb7('0x61')]:undefined)||0x14},{'name':_0x4fb7('0x6a'),'value':_0x1997f4[_0x4fb7('0x6a')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x3]?_0x1997f4[_0x4fb7('0x5e')][0x3][_0x4fb7('0x61')]:undefined)||_0x4fb7('0x6b')},{'name':_0x4fb7('0x6c'),'value':_0x1997f4['attrEmailAccounts']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x4]?_0x1997f4[_0x4fb7('0x5e')][0x4]['value']:undefined)||''},{'name':_0x4fb7('0x6d'),'value':_0x1997f4[_0x4fb7('0x6d')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x5]?_0x1997f4['attrs'][0x5][_0x4fb7('0x61')]:undefined)||''},{'name':_0x4fb7('0x6e'),'value':_0x1997f4[_0x4fb7('0x6e')]||(_0x1997f4['attrs']&&_0x1997f4[_0x4fb7('0x5e')][0x6]?_0x1997f4['attrs'][0x6][_0x4fb7('0x61')]:undefined)||''},{'name':_0x4fb7('0x6f'),'value':_0x1997f4['attrOpenchannelAccounts']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x7]?_0x1997f4['attrs'][0x7]['value']:undefined)||''},{'name':_0x4fb7('0x70'),'value':_0x1997f4[_0x4fb7('0x70')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x8]?_0x1997f4[_0x4fb7('0x5e')][0x8][_0x4fb7('0x61')]:undefined)||''},{'name':_0x4fb7('0x71'),'value':_0x1997f4[_0x4fb7('0x71')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x9]?_0x1997f4[_0x4fb7('0x5e')][0x9][_0x4fb7('0x61')]:undefined)||''}];case'multibar-chart':case _0x4fb7('0x72'):return[{'name':_0x4fb7('0x73'),'value':_0x1997f4[_0x4fb7('0x73')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x0]?_0x1997f4[_0x4fb7('0x5e')][0x0][_0x4fb7('0x61')]:undefined)||_0x4fb7('0x68')},{'name':'attrSerie2','value':_0x1997f4[_0x4fb7('0x74')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x1]?_0x1997f4[_0x4fb7('0x5e')][0x1][_0x4fb7('0x61')]:undefined)||null},{'name':_0x4fb7('0x75'),'value':_0x1997f4[_0x4fb7('0x75')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x2]?_0x1997f4[_0x4fb7('0x5e')][0x2][_0x4fb7('0x61')]:undefined)||null},{'name':_0x4fb7('0x69'),'value':_0x1997f4[_0x4fb7('0x69')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x3]?_0x1997f4[_0x4fb7('0x5e')][0x3][_0x4fb7('0x61')]:undefined)||[]},{'name':_0x4fb7('0x6a'),'value':_0x1997f4[_0x4fb7('0x6a')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x4]?_0x1997f4[_0x4fb7('0x5e')][0x4]['value']:undefined)||'voice'},{'name':_0x4fb7('0x6c'),'value':_0x1997f4[_0x4fb7('0x6c')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x5]?_0x1997f4[_0x4fb7('0x5e')][0x5][_0x4fb7('0x61')]:undefined)||''},{'name':_0x4fb7('0x6d'),'value':_0x1997f4['attrFaxAccounts']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4[_0x4fb7('0x5e')][0x6]?_0x1997f4[_0x4fb7('0x5e')][0x6][_0x4fb7('0x61')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1997f4[_0x4fb7('0x6e')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x7]?_0x1997f4['attrs'][0x7][_0x4fb7('0x61')]:undefined)||''},{'name':_0x4fb7('0x6f'),'value':_0x1997f4['attrOpenchannelAccounts']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x8]?_0x1997f4['attrs'][0x8]['value']:undefined)||''},{'name':_0x4fb7('0x70'),'value':_0x1997f4['attrWhatsappAccounts']||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x9]?_0x1997f4[_0x4fb7('0x5e')][0x9]['value']:undefined)||''},{'name':_0x4fb7('0x71'),'value':_0x1997f4[_0x4fb7('0x71')]||(_0x1997f4['attrs']&&_0x1997f4['attrs'][0xa]?_0x1997f4['attrs'][0xa][_0x4fb7('0x61')]:undefined)||''}];case'web-report':return[{'name':_0x4fb7('0x76'),'type':_0x1997f4[_0x4fb7('0x77')]||(_0x1997f4['attrs']&&_0x1997f4[_0x4fb7('0x5e')][0x0]?_0x1997f4[_0x4fb7('0x5e')][0x0]['type']:undefined)||null,'value':_0x1997f4[_0x4fb7('0x76')]||(_0x1997f4['attrs']&&_0x1997f4['attrs'][0x0]?_0x1997f4[_0x4fb7('0x5e')][0x0][_0x4fb7('0x61')]:undefined)||null},{'name':_0x4fb7('0x78'),'value':_0x1997f4[_0x4fb7('0x78')]||(_0x1997f4[_0x4fb7('0x5e')]&&_0x1997f4['attrs'][0x1]?_0x1997f4[_0x4fb7('0x5e')][0x1][_0x4fb7('0x61')]:undefined)||0x0}];default:return[];}}catch(_0x31e9a0){logger[_0x4fb7('0x2b')]('widgetAttributes:\x20%s',JSON[_0x4fb7('0x79')](_0x31e9a0));return[];}}exports[_0x4fb7('0x7a')]=function(_0x3fac50,_0x75f1dc,_0x3ddaff){if(_0x3fac50[_0x4fb7('0x58')]['id']){delete _0x3fac50[_0x4fb7('0x58')]['id'];}return db['Dashboard'][_0x4fb7('0x4c')]({'where':{'id':_0x3fac50[_0x4fb7('0x45')]['id']}})['then'](handleEntityNotFound(_0x75f1dc,null))[_0x4fb7('0x26')](function(_0x1e76d9){if(_0x1e76d9){_0x3fac50[_0x4fb7('0x58')][_0x4fb7('0x7b')]=_0x1e76d9['id'];_0x3fac50[_0x4fb7('0x58')]['attrs']=widgetAttributes(_0x3fac50['body']);return db[_0x4fb7('0x7c')]['create'](_0x3fac50['body']);}})['then'](respondWithResult(_0x75f1dc,null))[_0x4fb7('0x44')](handleError(_0x75f1dc,null));};exports[_0x4fb7('0x7d')]=function(_0x584220,_0xd9d490,_0x29aab2){var _0x45ef07={};var _0x366169={};var _0x469515;var _0xa08c1;return db['Dashboard']['findOne']({'where':{'id':_0x584220['params']['id']}})[_0x4fb7('0x26')](handleEntityNotFound(_0xd9d490,null))[_0x4fb7('0x26')](function(_0xebee1d){if(_0xebee1d){_0x469515=_0xebee1d;_0x366169[_0x4fb7('0x36')]=_[_0x4fb7('0x46')](db[_0x4fb7('0x7c')][_0x4fb7('0x32')]);_0x366169['query']=_[_0x4fb7('0x46')](_0x584220[_0x4fb7('0x37')]);_0x366169[_0x4fb7('0x38')]=_[_0x4fb7('0x47')](_0x366169[_0x4fb7('0x36')],_0x366169[_0x4fb7('0x37')]);_0x45ef07[_0x4fb7('0x39')]=_['intersection'](_0x366169[_0x4fb7('0x36')],qs[_0x4fb7('0x48')](_0x584220[_0x4fb7('0x37')][_0x4fb7('0x48')]));_0x45ef07[_0x4fb7('0x39')]=_0x45ef07[_0x4fb7('0x39')][_0x4fb7('0x49')]?_0x45ef07[_0x4fb7('0x39')]:_0x366169[_0x4fb7('0x36')];_0x45ef07[_0x4fb7('0x3c')]=qs[_0x4fb7('0x3d')](_0x584220[_0x4fb7('0x37')]['sort']);_0x45ef07[_0x4fb7('0x3e')]=qs['filters'](_[_0x4fb7('0x3f')](_0x584220['query'],_0x366169['filters']));if(_0x584220[_0x4fb7('0x37')][_0x4fb7('0x40')]){_0x45ef07[_0x4fb7('0x3e')]=_[_0x4fb7('0x41')](_0x45ef07[_0x4fb7('0x3e')],{'$or':_[_0x4fb7('0x30')](_0x45ef07[_0x4fb7('0x39')],function(_0x23b29a){var _0x183421={};_0x183421[_0x23b29a]={'$like':'%'+_0x584220['query'][_0x4fb7('0x40')]+'%'};return _0x183421;})});}_0x45ef07=_[_0x4fb7('0x41')]({},_0x45ef07,_0x584220[_0x4fb7('0x54')]);return _0x469515[_0x4fb7('0x7d')](_0x45ef07);}})['then'](function(_0x5c2ea0){if(_0x5c2ea0){_0xa08c1=_0x5c2ea0['length'];if(!_0x584220[_0x4fb7('0x37')][_0x4fb7('0x3a')](_0x4fb7('0x7e'))){_0x45ef07[_0x4fb7('0x20')]=qs['limit'](_0x584220['query'][_0x4fb7('0x20')]);_0x45ef07[_0x4fb7('0x3b')]=qs['offset'](_0x584220[_0x4fb7('0x37')]['offset']);}return _0x469515[_0x4fb7('0x7d')](_0x45ef07);}})[_0x4fb7('0x26')](function(_0x1df488){if(_0x1df488){return _0x1df488?{'count':_0xa08c1,'rows':_0x1df488}:null;}})['then'](respondWithResult(_0xd9d490,null))['catch'](handleError(_0xd9d490,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index c16f50f..bec519e 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 _0x9ff9=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0x301e03,_0xfd3ffb){var _0x3b776e=function(_0x5375d0){while(--_0x5375d0){_0x301e03['push'](_0x301e03['shift']());}};_0x3b776e(++_0xfd3ffb);}(_0x9ff9,0x1c3));var _0x99ff=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0x9ff9[_0x481bf7];return _0x461787;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x99ff('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x99ff('0x1')](0x0);var events={'afterCreate':_0x99ff('0x2'),'afterUpdate':'update','afterDestroy':_0x99ff('0x3')};function emitEvent(_0x3a1b21){return function(_0x24dd77,_0x3aa823,_0x56f748){DashboardEvents[_0x99ff('0x4')](_0x3a1b21+':'+_0x24dd77['id'],_0x24dd77);DashboardEvents[_0x99ff('0x4')](_0x3a1b21,_0x24dd77);_0x56f748(null);};}for(var e in events){if(events[_0x99ff('0x5')](e)){var event=events[e];Dashboard[_0x99ff('0x6')](e,emitEvent(event));}}module[_0x99ff('0x7')]=DashboardEvents; \ No newline at end of file +var _0x3912=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0x3912,0xa9));var _0x2391=function(_0x2a3b02,_0x494f0c){_0x2a3b02=_0x2a3b02-0x0;var _0x20e71e=_0x3912[_0x2a3b02];return _0x20e71e;};'use strict';var EventEmitter=require(_0x2391('0x0'));var Dashboard=require(_0x2391('0x1'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2391('0x2')](0x0);var events={'afterCreate':_0x2391('0x3'),'afterUpdate':_0x2391('0x4'),'afterDestroy':_0x2391('0x5')};function emitEvent(_0x3d9a69){return function(_0x447341,_0x22e7fd,_0x45aea9){DashboardEvents[_0x2391('0x6')](_0x3d9a69+':'+_0x447341['id'],_0x447341);DashboardEvents[_0x2391('0x6')](_0x3d9a69,_0x447341);_0x45aea9(null);};}for(var e in events){if(events[_0x2391('0x7')](e)){var event=events[e];Dashboard[_0x2391('0x8')](e,emitEvent(event));}}module[_0x2391('0x9')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index b465654..a06983b 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 _0xa72e=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util'];(function(_0x2e25b6,_0x32ed94){var _0x1a99c3=function(_0x2c4281){while(--_0x2c4281){_0x2e25b6['push'](_0x2e25b6['shift']());}};_0x1a99c3(++_0x32ed94);}(_0xa72e,0x150));var _0xea72=function(_0x5374c9,_0x5239e8){_0x5374c9=_0x5374c9-0x0;var _0x1f4e5e=_0xa72e[_0x5374c9];return _0x1f4e5e;};'use strict';var _=require(_0xea72('0x0'));var util=require(_0xea72('0x1'));var logger=require(_0xea72('0x2'))(_0xea72('0x3'));var moment=require(_0xea72('0x4'));var BPromise=require(_0xea72('0x5'));var rp=require(_0xea72('0x6'));var fs=require('fs');var path=require(_0xea72('0x7'));var rimraf=require(_0xea72('0x8'));var config=require(_0xea72('0x9'));var attributes=require(_0xea72('0xa'));module['exports']=function(_0x3512e6,_0x3d5399){return _0x3512e6['define'](_0xea72('0xb'),attributes,{'tableName':_0xea72('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fac=['exports','define','Dashboard','dashboards','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x4cac10,_0x437290){var _0x1a1765=function(_0x3b25e3){while(--_0x3b25e3){_0x4cac10['push'](_0x4cac10['shift']());}};_0x1a1765(++_0x437290);}(_0x8fac,0x70));var _0xc8fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8fac[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xc8fa('0x0'));var util=require('util');var logger=require(_0xc8fa('0x1'))(_0xc8fa('0x2'));var moment=require(_0xc8fa('0x3'));var BPromise=require(_0xc8fa('0x4'));var rp=require(_0xc8fa('0x5'));var fs=require('fs');var path=require(_0xc8fa('0x6'));var rimraf=require('rimraf');var config=require(_0xc8fa('0x7'));var attributes=require('./dashboard.attributes');module[_0xc8fa('0x8')]=function(_0x2163cd,_0x3e8af2){return _0x2163cd[_0xc8fa('0x9')](_0xc8fa('0xa'),attributes,{'tableName':_0xc8fa('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 9932312..7b57a0e 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 _0xf0c0=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','../../mysqldb'];(function(_0x25b24a,_0x1c0163){var _0x224e68=function(_0x1fc9d2){while(--_0x1fc9d2){_0x25b24a['push'](_0x25b24a['shift']());}};_0x224e68(++_0x1c0163);}(_0xf0c0,0x15a));var _0x0f0c=function(_0xe99738,_0x2bf43f){_0xe99738=_0xe99738-0x0;var _0x131cc4=_0xf0c0[_0xe99738];return _0x131cc4;};'use strict';var _=require('lodash');var util=require(_0x0f0c('0x0'));var moment=require(_0x0f0c('0x1'));var BPromise=require('bluebird');var rs=require(_0x0f0c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f0c('0x3'))['db'];var utils=require(_0x0f0c('0x4'));var logger=require('../../config/logger')(_0x0f0c('0x5'));var config=require(_0x0f0c('0x6'));var jayson=require(_0x0f0c('0x7'));var client=jayson[_0x0f0c('0x8')][_0x0f0c('0x9')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x0f0c('0xa'),'port':0x18eb});var socket=require(_0x0f0c('0xb'))(new Redis(config[_0x0f0c('0xc')]));require(_0x0f0c('0xd'))[_0x0f0c('0xe')](socket);function respondWithRpcPromise(_0x3bf33d,_0x389a60,_0x3f4126){return new BPromise(function(_0x1a8074,_0x32f424){return client[_0x0f0c('0xf')](_0x3bf33d,_0x3f4126)['then'](function(_0x4b12c4){logger[_0x0f0c('0x10')](_0x0f0c('0x11'),_0x389a60,_0x0f0c('0x12'));logger[_0x0f0c('0x13')](_0x0f0c('0x14'),_0x389a60,_0x0f0c('0x12'),JSON['stringify'](_0x4b12c4));if(_0x4b12c4['error']){if(_0x4b12c4[_0x0f0c('0x15')][_0x0f0c('0x16')]===0x1f4){logger['error'](_0x0f0c('0x11'),_0x389a60,_0x4b12c4[_0x0f0c('0x15')][_0x0f0c('0x17')]);return _0x32f424(_0x4b12c4[_0x0f0c('0x15')]['message']);}logger[_0x0f0c('0x15')](_0x0f0c('0x11'),_0x389a60,_0x4b12c4[_0x0f0c('0x15')][_0x0f0c('0x17')]);return _0x1a8074(_0x4b12c4['error'][_0x0f0c('0x17')]);}else{logger['info'](_0x0f0c('0x11'),_0x389a60,_0x0f0c('0x12'));_0x1a8074(_0x4b12c4['result'][_0x0f0c('0x17')]);}})[_0x0f0c('0x18')](function(_0xd3be0c){logger[_0x0f0c('0x15')](_0x0f0c('0x11'),_0x389a60,_0xd3be0c);_0x32f424(_0xd3be0c);});});} \ No newline at end of file +var _0x2f14=['ioredis','../../config/utils','../../config/logger','rpc','client','redis','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','message','catch','lodash','util','bluebird','randomstring'];(function(_0x4d769d,_0x1e5814){var _0x2b23a0=function(_0x428446){while(--_0x428446){_0x4d769d['push'](_0x4d769d['shift']());}};_0x2b23a0(++_0x1e5814);}(_0x2f14,0x1b4));var _0x42f1=function(_0x5da2cc,_0xc58a7c){_0x5da2cc=_0x5da2cc-0x0;var _0x215166=_0x2f14[_0x5da2cc];return _0x215166;};'use strict';var _=require(_0x42f1('0x0'));var util=require(_0x42f1('0x1'));var moment=require('moment');var BPromise=require(_0x42f1('0x2'));var rs=require(_0x42f1('0x3'));var fs=require('fs');var Redis=require(_0x42f1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x42f1('0x5'));var logger=require(_0x42f1('0x6'))(_0x42f1('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x42f1('0x8')]['http']({'port':0x232a});config[_0x42f1('0x9')]=_['defaults'](config[_0x42f1('0x9')],{'host':_0x42f1('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x42f1('0x9')]));require(_0x42f1('0xb'))[_0x42f1('0xc')](socket);function respondWithRpcPromise(_0x207da9,_0x38c425,_0x127bcc){return new BPromise(function(_0x5501a3,_0x1387bd){return client[_0x42f1('0xd')](_0x207da9,_0x127bcc)[_0x42f1('0xe')](function(_0x1e7327){logger[_0x42f1('0xf')](_0x42f1('0x10'),_0x38c425,_0x42f1('0x11'));logger[_0x42f1('0x12')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x38c425,_0x42f1('0x11'),JSON['stringify'](_0x1e7327));if(_0x1e7327[_0x42f1('0x13')]){if(_0x1e7327[_0x42f1('0x13')]['code']===0x1f4){logger[_0x42f1('0x13')](_0x42f1('0x10'),_0x38c425,_0x1e7327[_0x42f1('0x13')]['message']);return _0x1387bd(_0x1e7327[_0x42f1('0x13')]['message']);}logger[_0x42f1('0x13')]('Dashboard,\x20%s,\x20%s',_0x38c425,_0x1e7327['error']['message']);return _0x5501a3(_0x1e7327['error'][_0x42f1('0x14')]);}else{logger[_0x42f1('0xf')]('Dashboard,\x20%s,\x20%s',_0x38c425,_0x42f1('0x11'));_0x5501a3(_0x1e7327['result']['message']);}})[_0x42f1('0x15')](function(_0x35b798){logger[_0x42f1('0x13')]('Dashboard,\x20%s,\x20%s',_0x38c425,_0x35b798);_0x1387bd(_0x35b798);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index a9cdd7e..49cc766 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 _0xe513=['removeListener','register','length','save','remove','update','emit'];(function(_0x44d9cc,_0x3d912c){var _0x15b090=function(_0xf25ca3){while(--_0xf25ca3){_0x44d9cc['push'](_0x44d9cc['shift']());}};_0x15b090(++_0x3d912c);}(_0xe513,0xf8));var _0x3e51=function(_0x4d46f2,_0x26e045){_0x4d46f2=_0x4d46f2-0x0;var _0x228d1f=_0xe513[_0x4d46f2];return _0x228d1f;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x3e51('0x0'),_0x3e51('0x1'),_0x3e51('0x2')];function createListener(_0x57f5d5,_0x36e032){return function(_0x19d860){_0x36e032[_0x3e51('0x3')](_0x57f5d5,_0x19d860);};}function removeListener(_0x5a3469,_0xda2020){return function(){DashboardEvents[_0x3e51('0x4')](_0x5a3469,_0xda2020);};}exports[_0x3e51('0x5')]=function(_0x1ab2a2){for(var _0x11779d=0x0,_0x550183=events[_0x3e51('0x6')];_0x11779d<_0x550183;_0x11779d++){var _0x3b85d0=events[_0x11779d];var _0x14d83e=createListener('dashboard:'+_0x3b85d0,_0x1ab2a2);DashboardEvents['on'](_0x3b85d0,_0x14d83e);}}; \ No newline at end of file +var _0x2e3d=['update','emit','removeListener','register','./dashboard.events','remove'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x2e3d,0x1de));var _0xd2e3=function(_0x13465f,_0x3866e8){_0x13465f=_0x13465f-0x0;var _0x314fcb=_0x2e3d[_0x13465f];return _0x314fcb;};'use strict';var DashboardEvents=require(_0xd2e3('0x0'));var events=['save',_0xd2e3('0x1'),_0xd2e3('0x2')];function createListener(_0x55bbcb,_0x2b3112){return function(_0x3376d3){_0x2b3112[_0xd2e3('0x3')](_0x55bbcb,_0x3376d3);};}function removeListener(_0x3161ac,_0x1a326f){return function(){DashboardEvents[_0xd2e3('0x4')](_0x3161ac,_0x1a326f);};}exports[_0xd2e3('0x5')]=function(_0x4b3d3f){for(var _0x2e0691=0x0,_0x5ab491=events['length'];_0x2e0691<_0x5ab491;_0x2e0691++){var _0xd36d98=events[_0x2e0691];var _0x53e9df=createListener('dashboard:'+_0xd36d98,_0x4b3d3f);DashboardEvents['on'](_0xd36d98,_0x53e9df);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index fa9c3f5..52d4140 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 _0xfe87=['isAuthenticated','index','get','/:id','getItems','post','create','/:id/clone','clone','/:id/items','update','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./dashboard.controller'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0xfe87,0x162));var _0x7fe8=function(_0xf295e9,_0x4657c0){_0xf295e9=_0xf295e9-0x0;var _0x562421=_0xfe87[_0xf295e9];return _0x562421;};'use strict';var multer=require('multer');var util=require(_0x7fe8('0x0'));var path=require('path');var timeout=require(_0x7fe8('0x1'));var express=require(_0x7fe8('0x2'));var router=express[_0x7fe8('0x3')]();var fs_extra=require(_0x7fe8('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7fe8('0x5'));var controller=require(_0x7fe8('0x6'));router['get']('/',auth[_0x7fe8('0x7')](),controller[_0x7fe8('0x8')]);router[_0x7fe8('0x9')](_0x7fe8('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x7fe8('0x9')]('/:id/items',auth[_0x7fe8('0x7')](),controller[_0x7fe8('0xb')]);router[_0x7fe8('0xc')]('/',auth[_0x7fe8('0x7')](),controller[_0x7fe8('0xd')]);router['post'](_0x7fe8('0xe'),auth['isAuthenticated'](),controller[_0x7fe8('0xf')]);router[_0x7fe8('0xc')](_0x7fe8('0x10'),auth[_0x7fe8('0x7')](),controller['addItem']);router['put'](_0x7fe8('0xa'),auth[_0x7fe8('0x7')](),controller[_0x7fe8('0x11')]);router['delete'](_0x7fe8('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x7fe8('0x12')]=router; \ No newline at end of file +var _0xb205=['/:id/items','isAuthenticated','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../config/environment','get','index','/:id','show'];(function(_0x4e4d6c,_0x3a593a){var _0x386185=function(_0x5eee15){while(--_0x5eee15){_0x4e4d6c['push'](_0x4e4d6c['shift']());}};_0x386185(++_0x3a593a);}(_0xb205,0x199));var _0x5b20=function(_0x39663b,_0x30c0d3){_0x39663b=_0x39663b-0x0;var _0x562fef=_0xb205[_0x39663b];return _0x562fef;};'use strict';var multer=require('multer');var util=require(_0x5b20('0x0'));var path=require('path');var timeout=require(_0x5b20('0x1'));var express=require('express');var router=express[_0x5b20('0x2')]();var fs_extra=require(_0x5b20('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5b20('0x4'));var controller=require('./dashboard.controller');router[_0x5b20('0x5')]('/',auth['isAuthenticated'](),controller[_0x5b20('0x6')]);router[_0x5b20('0x5')](_0x5b20('0x7'),auth['isAuthenticated'](),controller[_0x5b20('0x8')]);router['get'](_0x5b20('0x9'),auth[_0x5b20('0xa')](),controller[_0x5b20('0xb')]);router[_0x5b20('0xc')]('/',auth['isAuthenticated'](),controller[_0x5b20('0xd')]);router['post'](_0x5b20('0xe'),auth[_0x5b20('0xa')](),controller[_0x5b20('0xf')]);router[_0x5b20('0xc')](_0x5b20('0x9'),auth[_0x5b20('0xa')](),controller[_0x5b20('0x10')]);router[_0x5b20('0x11')]('/:id',auth[_0x5b20('0xa')](),controller[_0x5b20('0x12')]);router[_0x5b20('0x13')](_0x5b20('0x7'),auth[_0x5b20('0xa')](),controller[_0x5b20('0x14')]);module[_0x5b20('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e9c9354..bed15ad 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 _0xeda8=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','#ffffff','sequelize','squel','exports','STRING'];(function(_0x3438cf,_0x73b174){var _0x278698=function(_0xbba932){while(--_0xbba932){_0x3438cf['push'](_0x3438cf['shift']());}};_0x278698(++_0x73b174);}(_0xeda8,0x104));var _0x8eda=function(_0x4c09ff,_0x23a3cc){_0x4c09ff=_0x4c09ff-0x0;var _0x4cf397=_0xeda8[_0x4c09ff];return _0x4cf397;};'use strict';var Sequelize=require(_0x8eda('0x0'));var squel=require(_0x8eda('0x1'));var _=require('lodash');module[_0x8eda('0x2')]={'title':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x8eda('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x8eda('0x4')](_0x8eda('0x5')),'get':function(){try{return JSON[_0x8eda('0x6')](this[_0x8eda('0x7')](_0x8eda('0x8')));}catch(_0x22dee9){return[];}},'set':function(_0x1f3556){try{this[_0x8eda('0x9')](_0x8eda('0x8'),JSON['stringify'](_0x1f3556));}catch(_0x28b721){this[_0x8eda('0x9')](_0x8eda('0x8'),JSON[_0x8eda('0xa')]([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':_0x8eda('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x8eda('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x8eda('0x3')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file +var _0xf61e=['TEXT','long','parse','getDataValue','attrs','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x5ece27,_0x405d9b){var _0x5207e5=function(_0x2c63d8){while(--_0x2c63d8){_0x5ece27['push'](_0x5ece27['shift']());}};_0x5207e5(++_0x405d9b);}(_0xf61e,0x191));var _0xef61=function(_0x3f20a1,_0x87e0b6){_0x3f20a1=_0x3f20a1-0x0;var _0x57e197=_0xf61e[_0x3f20a1];return _0x57e197;};'use strict';var Sequelize=require(_0xef61('0x0'));var squel=require(_0xef61('0x1'));var _=require(_0xef61('0x2'));module[_0xef61('0x3')]={'title':{'type':Sequelize[_0xef61('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xef61('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xef61('0x5')](_0xef61('0x6')),'get':function(){try{return JSON[_0xef61('0x7')](this[_0xef61('0x8')](_0xef61('0x9')));}catch(_0x45a18d){return[];}},'set':function(_0x5b00b2){try{this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify'](_0x5b00b2));}catch(_0x2242a7){this[_0xef61('0xa')](_0xef61('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xef61('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xef61('0xb')]},'col':{'type':Sequelize[_0xef61('0xb')]},'background':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xef61('0x4')],'allowNull':![],'defaultValue':_0xef61('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xef61('0x4')]},'titleFontSize':{'type':Sequelize[_0xef61('0xb')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 5ea4bcc..ca52bc2 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 _0x71ad=['name','show','params','keys','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','include','merge','options','DashboardItem','find','catch','attrUrl','attrs','value','https://','attrPath','attrHourFormat','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','update','eml-format','rimraf','fast-json-patch','moment','bluebird','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','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','./dashboardItem.socket','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack'];(function(_0x3ab7ed,_0x57a3a7){var _0x3ba976=function(_0x1e2bc5){while(--_0x1e2bc5){_0x3ab7ed['push'](_0x3ab7ed['shift']());}};_0x3ba976(++_0x57a3a7);}(_0x71ad,0xee));var _0xd71a=function(_0x55419b,_0x2e5656){_0x55419b=_0x55419b-0x0;var _0x29b5ac=_0x71ad[_0x55419b];return _0x29b5ac;};'use strict';var emlformat=require(_0xd71a('0x0'));var rimraf=require(_0xd71a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd71a('0x2'));var rp=require('request-promise');var moment=require(_0xd71a('0x3'));var BPromise=require(_0xd71a('0x4'));var Mustache=require('mustache');var util=require(_0xd71a('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xd71a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd71a('0x7'));var _=require(_0xd71a('0x8'));var squel=require(_0xd71a('0x9'));var crypto=require(_0xd71a('0xa'));var jsforce=require(_0xd71a('0xb'));var deskjs=require(_0xd71a('0xc'));var toCsv=require(_0xd71a('0x6'));var querystring=require('querystring');var Papa=require(_0xd71a('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd71a('0xe'));var as=require(_0xd71a('0xf'));var hardwareService=require(_0xd71a('0x10'));var logger=require(_0xd71a('0x11'))(_0xd71a('0x12'));var utils=require(_0xd71a('0x13'));var config=require(_0xd71a('0x14'));var licenseUtil=require(_0xd71a('0x15'));var db=require(_0xd71a('0x16'))['db'];config[_0xd71a('0x17')]=_['defaults'](config[_0xd71a('0x17')],{'host':_0xd71a('0x18'),'port':0x18eb});var socket=require(_0xd71a('0x19'))(new Redis(config[_0xd71a('0x17')]));require(_0xd71a('0x1a'))[_0xd71a('0x1b')](socket);function respondWithStatusCode(_0x10c0de,_0x188886){_0x188886=_0x188886||0xcc;return function(_0x388203){if(_0x388203){return _0x10c0de[_0xd71a('0x1c')](_0x188886);}return _0x10c0de[_0xd71a('0x1d')](_0x188886)[_0xd71a('0x1e')]();};}function respondWithResult(_0x2c54c5,_0x4256da){_0x4256da=_0x4256da||0xc8;return function(_0xd16472){if(_0xd16472){return _0x2c54c5['status'](_0x4256da)[_0xd71a('0x1f')](_0xd16472);}};}function respondWithFilteredResult(_0x21334d,_0x6abf4f){return function(_0x5389fd){if(_0x5389fd){var _0x50cceb=typeof _0x6abf4f['offset']===_0xd71a('0x20')&&typeof _0x6abf4f[_0xd71a('0x21')]===_0xd71a('0x20');var _0x25bb9b=_0x5389fd[_0xd71a('0x22')];var _0x31a58d=_0x50cceb?0x0:_0x6abf4f['offset'];var _0x408c0d=_0x50cceb?_0x5389fd[_0xd71a('0x22')]:_0x6abf4f['offset']+_0x6abf4f['limit'];var _0xc16934;if(_0x408c0d>=_0x25bb9b){_0x408c0d=_0x25bb9b;_0xc16934=0xc8;}else{_0xc16934=0xce;}_0x21334d[_0xd71a('0x1d')](_0xc16934);return _0x21334d[_0xd71a('0x23')](_0xd71a('0x24'),_0x31a58d+'-'+_0x408c0d+'/'+_0x25bb9b)['json'](_0x5389fd);}return null;};}function patchUpdates(_0x1732f0){return function(_0x3afdb5){try{jsonpatch[_0xd71a('0x25')](_0x3afdb5,_0x1732f0,!![]);}catch(_0x3be820){return BPromise[_0xd71a('0x26')](_0x3be820);}return _0x3afdb5[_0xd71a('0x27')]();};}function saveUpdates(_0x4528e8,_0x3aedde){return function(_0x46dc82){if(_0x46dc82){return _0x46dc82['update'](_0x4528e8)[_0xd71a('0x28')](function(_0x525ce9){return _0x525ce9;});}return null;};}function removeEntity(_0x339d6f,_0x589954){return function(_0x59e8fe){if(_0x59e8fe){return _0x59e8fe[_0xd71a('0x29')]()['then'](function(){_0x339d6f[_0xd71a('0x1d')](0xcc)[_0xd71a('0x1e')]();});}};}function handleEntityNotFound(_0x402735,_0x2e44a2){return function(_0x174209){if(!_0x174209){_0x402735[_0xd71a('0x1c')](0x194);}return _0x174209;};}function handleError(_0x57c38b,_0x4606de){_0x4606de=_0x4606de||0x1f4;return function(_0x33f503){logger[_0xd71a('0x2a')](_0x33f503[_0xd71a('0x2b')]);if(_0x33f503[_0xd71a('0x2c')]){delete _0x33f503[_0xd71a('0x2c')];}_0x57c38b[_0xd71a('0x1d')](_0x4606de)['send'](_0x33f503);};}exports[_0xd71a('0x2d')]=function(_0x5de362,_0x472c44){var _0x4c5054={'raw':![],'where':{'id':_0x5de362[_0xd71a('0x2e')]['id']}},_0x93a1fe={};_0x93a1fe['model']=_[_0xd71a('0x2f')](db['DashboardItem'][_0xd71a('0x30')]);_0x93a1fe['query']=_['keys'](_0x5de362[_0xd71a('0x31')]);_0x93a1fe['filters']=_[_0xd71a('0x32')](_0x93a1fe[_0xd71a('0x33')],_0x93a1fe[_0xd71a('0x31')]);_0x4c5054['attributes']=_['intersection'](_0x93a1fe[_0xd71a('0x33')],qs[_0xd71a('0x34')](_0x5de362['query'][_0xd71a('0x34')]));_0x4c5054[_0xd71a('0x35')]=_0x4c5054[_0xd71a('0x35')][_0xd71a('0x36')]?_0x4c5054[_0xd71a('0x35')]:_0x93a1fe[_0xd71a('0x33')];if(_0x5de362[_0xd71a('0x31')][_0xd71a('0x37')]){_0x4c5054[_0xd71a('0x38')]=[{'all':!![]}];}_0x4c5054=_[_0xd71a('0x39')]({},_0x4c5054,_0x5de362[_0xd71a('0x3a')]);return db[_0xd71a('0x3b')][_0xd71a('0x3c')](_0x4c5054)[_0xd71a('0x28')](handleEntityNotFound(_0x472c44,null))['then'](respondWithResult(_0x472c44,null))[_0xd71a('0x3d')](handleError(_0x472c44,null));};exports['destroy']=function(_0x6c55a,_0x2fd90b){return db['DashboardItem'][_0xd71a('0x3c')]({'where':{'id':_0x6c55a[_0xd71a('0x2e')]['id']}})[_0xd71a('0x28')](handleEntityNotFound(_0x2fd90b,null))['then'](removeEntity(_0x2fd90b,null))[_0xd71a('0x3d')](handleError(_0x2fd90b,null));};function widgetAttributes(_0x3b5dee){try{switch(_0x3b5dee['type']){case'iframe':return[{'name':_0xd71a('0x3e'),'value':_0x3b5dee[_0xd71a('0x3e')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x41')}];case'custom':return[{'name':_0xd71a('0x42'),'value':_0x3b5dee[_0xd71a('0x42')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xd71a('0x43'),'value':_0x3b5dee[_0xd71a('0x43')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x44')},{'name':'attrTimezone','value':_0x3b5dee['attrTimezone']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1]['value']:undefined)||_0xd71a('0x45')},{'name':_0xd71a('0x46'),'value':_0x3b5dee[_0xd71a('0x46')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x2]?_0x3b5dee['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0xd71a('0x47'),'value':_0x3b5dee[_0xd71a('0x47')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x48')},{'name':_0xd71a('0x49'),'value':_0x3b5dee['attrVoiceQueues']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1][_0xd71a('0x40')]:undefined)||[]},{'name':_0xd71a('0x46'),'value':_0x3b5dee[_0xd71a('0x46')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x2]?_0x3b5dee[_0xd71a('0x3f')][0x2][_0xd71a('0x40')]:undefined)||0x14},{'name':_0xd71a('0x4a'),'value':_0x3b5dee[_0xd71a('0x4a')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x3]?_0x3b5dee[_0xd71a('0x3f')][0x3]['value']:undefined)||_0xd71a('0x4b')},{'name':_0xd71a('0x4c'),'value':_0x3b5dee['attrEmailAccounts']||(_0x3b5dee['attrs']&&_0x3b5dee['attrs'][0x4]?_0x3b5dee[_0xd71a('0x3f')][0x4]['value']:undefined)||''},{'name':_0xd71a('0x4d'),'value':_0x3b5dee[_0xd71a('0x4d')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x5]?_0x3b5dee[_0xd71a('0x3f')][0x5][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4e'),'value':_0x3b5dee[_0xd71a('0x4e')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x6]?_0x3b5dee['attrs'][0x6][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4f'),'value':_0x3b5dee['attrOpenchannelAccounts']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x7]?_0x3b5dee['attrs'][0x7]['value']:undefined)||''},{'name':_0xd71a('0x50'),'value':_0x3b5dee[_0xd71a('0x50')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x8]?_0x3b5dee['attrs'][0x8][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x51'),'value':_0x3b5dee['attrChatWebsites']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x9]?_0x3b5dee[_0xd71a('0x3f')][0x9][_0xd71a('0x40')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':'attrSerie1','value':_0x3b5dee[_0xd71a('0x52')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0][_0xd71a('0x40')]:undefined)||_0xd71a('0x48')},{'name':_0xd71a('0x53'),'value':_0x3b5dee['attrSerie2']||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1][_0xd71a('0x40')]:undefined)||null},{'name':_0xd71a('0x54'),'value':_0x3b5dee[_0xd71a('0x54')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x2]?_0x3b5dee[_0xd71a('0x3f')][0x2][_0xd71a('0x40')]:undefined)||null},{'name':_0xd71a('0x49'),'value':_0x3b5dee[_0xd71a('0x49')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x3]?_0x3b5dee[_0xd71a('0x3f')][0x3]['value']:undefined)||[]},{'name':_0xd71a('0x4a'),'value':_0x3b5dee[_0xd71a('0x4a')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x4]?_0x3b5dee[_0xd71a('0x3f')][0x4][_0xd71a('0x40')]:undefined)||_0xd71a('0x4b')},{'name':'attrEmailAccounts','value':_0x3b5dee[_0xd71a('0x4c')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x5]?_0x3b5dee[_0xd71a('0x3f')][0x5][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4d'),'value':_0x3b5dee[_0xd71a('0x4d')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x6]?_0x3b5dee[_0xd71a('0x3f')][0x6]['value']:undefined)||''},{'name':_0xd71a('0x4e'),'value':_0x3b5dee[_0xd71a('0x4e')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x7]?_0x3b5dee[_0xd71a('0x3f')][0x7][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x4f'),'value':_0x3b5dee[_0xd71a('0x4f')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x8]?_0x3b5dee[_0xd71a('0x3f')][0x8][_0xd71a('0x40')]:undefined)||''},{'name':_0xd71a('0x50'),'value':_0x3b5dee[_0xd71a('0x50')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x9]?_0x3b5dee[_0xd71a('0x3f')][0x9]['value']:undefined)||''},{'name':_0xd71a('0x51'),'value':_0x3b5dee[_0xd71a('0x51')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0xa]?_0x3b5dee[_0xd71a('0x3f')][0xa]['value']:undefined)||''}];case _0xd71a('0x55'):return[{'name':_0xd71a('0x56'),'type':_0x3b5dee[_0xd71a('0x57')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0]['type']:undefined)||null,'value':_0x3b5dee[_0xd71a('0x56')]||(_0x3b5dee['attrs']&&_0x3b5dee[_0xd71a('0x3f')][0x0]?_0x3b5dee[_0xd71a('0x3f')][0x0]['value']:undefined)||null},{'name':'attrRefresh','value':_0x3b5dee[_0xd71a('0x58')]||(_0x3b5dee[_0xd71a('0x3f')]&&_0x3b5dee['attrs'][0x1]?_0x3b5dee[_0xd71a('0x3f')][0x1][_0xd71a('0x40')]:undefined)||0x0}];default:return[];}}catch(_0x3109a8){logger['error'](_0xd71a('0x59'),JSON[_0xd71a('0x5a')](_0x3109a8));return[];}}exports[_0xd71a('0x5b')]=function(_0x3cdd5d,_0x510f62){if(_0x3cdd5d[_0xd71a('0x5c')]){_0x3cdd5d[_0xd71a('0x5c')][_0xd71a('0x3f')]=widgetAttributes(_0x3cdd5d[_0xd71a('0x5c')]);}return db[_0xd71a('0x3b')][_0xd71a('0x5b')](_0x3cdd5d[_0xd71a('0x5c')],{})[_0xd71a('0x28')](respondWithResult(_0x510f62,0xc9))[_0xd71a('0x3d')](handleError(_0x510f62,null));};exports[_0xd71a('0x5d')]=function(_0x38449a,_0x5194ca){if(_0x38449a['body']['id']){delete _0x38449a[_0xd71a('0x5c')]['id'];}_0x38449a[_0xd71a('0x5c')][_0xd71a('0x3f')]=widgetAttributes(_0x38449a[_0xd71a('0x5c')]);return db[_0xd71a('0x3b')][_0xd71a('0x3c')]({'where':{'id':_0x38449a['params']['id']}})['then'](handleEntityNotFound(_0x5194ca,null))['then'](saveUpdates(_0x38449a[_0xd71a('0x5c')],null))[_0xd71a('0x28')](respondWithResult(_0x5194ca,null))[_0xd71a('0x3d')](handleError(_0x5194ca,null));}; \ No newline at end of file +var _0xbd0a=['stack','name','send','show','model','keys','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','total','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrSmsAccounts','web-report','attrRefresh','stringify','create','body','DashboardItem','find','params','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./dashboardItem.socket','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','error'];(function(_0x5ebb4d,_0x3180ec){var _0x7e1980=function(_0x1ec1dd){while(--_0x1ec1dd){_0x5ebb4d['push'](_0x5ebb4d['shift']());}};_0x7e1980(++_0x3180ec);}(_0xbd0a,0x1b9));var _0xabd0=function(_0xd818c8,_0x2fb8c8){_0xd818c8=_0xd818c8-0x0;var _0x5ed974=_0xbd0a[_0xd818c8];return _0x5ed974;};'use strict';var emlformat=require(_0xabd0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xabd0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xabd0('0x2'));var Mustache=require(_0xabd0('0x3'));var util=require(_0xabd0('0x4'));var path=require(_0xabd0('0x5'));var sox=require(_0xabd0('0x6'));var csv=require(_0xabd0('0x7'));var ejs=require(_0xabd0('0x8'));var fs=require('fs');var fs_extra=require(_0xabd0('0x9'));var _=require(_0xabd0('0xa'));var squel=require('squel');var crypto=require(_0xabd0('0xb'));var jsforce=require(_0xabd0('0xc'));var deskjs=require(_0xabd0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabd0('0xe'));var Papa=require('papaparse');var Redis=require(_0xabd0('0xf'));var authService=require(_0xabd0('0x10'));var qs=require(_0xabd0('0x11'));var as=require(_0xabd0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabd0('0x13'))('api');var utils=require(_0xabd0('0x14'));var config=require(_0xabd0('0x15'));var licenseUtil=require(_0xabd0('0x16'));var db=require(_0xabd0('0x17'))['db'];config[_0xabd0('0x18')]=_[_0xabd0('0x19')](config['redis'],{'host':_0xabd0('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xabd0('0x18')]));require(_0xabd0('0x1b'))['register'](socket);function respondWithStatusCode(_0x56ba31,_0x4ca156){_0x4ca156=_0x4ca156||0xcc;return function(_0x53acfc){if(_0x53acfc){return _0x56ba31[_0xabd0('0x1c')](_0x4ca156);}return _0x56ba31[_0xabd0('0x1d')](_0x4ca156)[_0xabd0('0x1e')]();};}function respondWithResult(_0xdb7a40,_0x169611){_0x169611=_0x169611||0xc8;return function(_0x28ddcf){if(_0x28ddcf){return _0xdb7a40[_0xabd0('0x1d')](_0x169611)[_0xabd0('0x1f')](_0x28ddcf);}};}function respondWithFilteredResult(_0x2d17b1,_0x543461){return function(_0x3a0ace){if(_0x3a0ace){var _0x5de1df=typeof _0x543461['offset']===_0xabd0('0x20')&&typeof _0x543461[_0xabd0('0x21')]===_0xabd0('0x20');var _0x23f955=_0x3a0ace['count'];var _0x862492=_0x5de1df?0x0:_0x543461[_0xabd0('0x22')];var _0x4eed20=_0x5de1df?_0x3a0ace['count']:_0x543461[_0xabd0('0x22')]+_0x543461[_0xabd0('0x21')];var _0x4d9416;if(_0x4eed20>=_0x23f955){_0x4eed20=_0x23f955;_0x4d9416=0xc8;}else{_0x4d9416=0xce;}_0x2d17b1[_0xabd0('0x1d')](_0x4d9416);return _0x2d17b1[_0xabd0('0x23')](_0xabd0('0x24'),_0x862492+'-'+_0x4eed20+'/'+_0x23f955)[_0xabd0('0x1f')](_0x3a0ace);}return null;};}function patchUpdates(_0x4c9f3a){return function(_0x1b1079){try{jsonpatch[_0xabd0('0x25')](_0x1b1079,_0x4c9f3a,!![]);}catch(_0x3376bc){return BPromise[_0xabd0('0x26')](_0x3376bc);}return _0x1b1079[_0xabd0('0x27')]();};}function saveUpdates(_0xf6dbad,_0x48c4a1){return function(_0x16f7be){if(_0x16f7be){return _0x16f7be[_0xabd0('0x28')](_0xf6dbad)[_0xabd0('0x29')](function(_0x52c8be){return _0x52c8be;});}return null;};}function removeEntity(_0x369dd0,_0x2699c4){return function(_0x30739e){if(_0x30739e){return _0x30739e[_0xabd0('0x2a')]()[_0xabd0('0x29')](function(){_0x369dd0[_0xabd0('0x1d')](0xcc)[_0xabd0('0x1e')]();});}};}function handleEntityNotFound(_0x3a10d6,_0x392b05){return function(_0x38c553){if(!_0x38c553){_0x3a10d6[_0xabd0('0x1c')](0x194);}return _0x38c553;};}function handleError(_0x2fcbe8,_0x465749){_0x465749=_0x465749||0x1f4;return function(_0x3246de){logger[_0xabd0('0x2b')](_0x3246de[_0xabd0('0x2c')]);if(_0x3246de['name']){delete _0x3246de[_0xabd0('0x2d')];}_0x2fcbe8[_0xabd0('0x1d')](_0x465749)[_0xabd0('0x2e')](_0x3246de);};}exports[_0xabd0('0x2f')]=function(_0x58f687,_0x1ef94b){var _0x30c608={'raw':![],'where':{'id':_0x58f687['params']['id']}},_0x20ff0a={};_0x20ff0a[_0xabd0('0x30')]=_[_0xabd0('0x31')](db['DashboardItem'][_0xabd0('0x32')]);_0x20ff0a['query']=_[_0xabd0('0x31')](_0x58f687[_0xabd0('0x33')]);_0x20ff0a[_0xabd0('0x34')]=_[_0xabd0('0x35')](_0x20ff0a[_0xabd0('0x30')],_0x20ff0a[_0xabd0('0x33')]);_0x30c608['attributes']=_[_0xabd0('0x35')](_0x20ff0a[_0xabd0('0x30')],qs[_0xabd0('0x36')](_0x58f687[_0xabd0('0x33')][_0xabd0('0x36')]));_0x30c608[_0xabd0('0x37')]=_0x30c608[_0xabd0('0x37')][_0xabd0('0x38')]?_0x30c608[_0xabd0('0x37')]:_0x20ff0a[_0xabd0('0x30')];if(_0x58f687[_0xabd0('0x33')][_0xabd0('0x39')]){_0x30c608[_0xabd0('0x3a')]=[{'all':!![]}];}_0x30c608=_[_0xabd0('0x3b')]({},_0x30c608,_0x58f687[_0xabd0('0x3c')]);return db['DashboardItem']['find'](_0x30c608)['then'](handleEntityNotFound(_0x1ef94b,null))[_0xabd0('0x29')](respondWithResult(_0x1ef94b,null))[_0xabd0('0x3d')](handleError(_0x1ef94b,null));};exports[_0xabd0('0x2a')]=function(_0x3a99ee,_0x2a7a18){return db['DashboardItem']['find']({'where':{'id':_0x3a99ee['params']['id']}})[_0xabd0('0x29')](handleEntityNotFound(_0x2a7a18,null))['then'](removeEntity(_0x2a7a18,null))[_0xabd0('0x3d')](handleError(_0x2a7a18,null));};function widgetAttributes(_0x2acff1){try{switch(_0x2acff1[_0xabd0('0x3e')]){case _0xabd0('0x3f'):return[{'name':_0xabd0('0x40'),'value':_0x2acff1[_0xabd0('0x40')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1['attrs'][0x0][_0xabd0('0x42')]:undefined)||'https://'}];case'custom':return[{'name':_0xabd0('0x43'),'value':_0x2acff1[_0xabd0('0x43')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0]['value']:undefined)||''}];case _0xabd0('0x44'):return[{'name':_0xabd0('0x45'),'value':_0x2acff1[_0xabd0('0x45')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||_0xabd0('0x46')},{'name':_0xabd0('0x47'),'value':_0x2acff1[_0xabd0('0x47')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1[_0xabd0('0x41')][0x1][_0xabd0('0x42')]:undefined)||_0xabd0('0x48')},{'name':_0xabd0('0x49'),'value':_0x2acff1[_0xabd0('0x49')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x2]?_0x2acff1[_0xabd0('0x41')][0x2][_0xabd0('0x42')]:undefined)||0xc}];case _0xabd0('0x4a'):return[{'name':'attrMetric','value':_0x2acff1['attrMetric']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||_0xabd0('0x4b')},{'name':'attrVoiceQueues','value':_0x2acff1['attrVoiceQueues']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1[_0xabd0('0x41')][0x1][_0xabd0('0x42')]:undefined)||[]},{'name':_0xabd0('0x49'),'value':_0x2acff1['attrFontSize']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x2]?_0x2acff1[_0xabd0('0x41')][0x2]['value']:undefined)||0x14},{'name':_0xabd0('0x4c'),'value':_0x2acff1[_0xabd0('0x4c')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x3]?_0x2acff1['attrs'][0x3][_0xabd0('0x42')]:undefined)||_0xabd0('0x4d')},{'name':_0xabd0('0x4e'),'value':_0x2acff1[_0xabd0('0x4e')]||(_0x2acff1['attrs']&&_0x2acff1[_0xabd0('0x41')][0x4]?_0x2acff1[_0xabd0('0x41')][0x4][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x4f'),'value':_0x2acff1[_0xabd0('0x4f')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x5]?_0x2acff1['attrs'][0x5][_0xabd0('0x42')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x2acff1['attrSmsAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x6]?_0x2acff1[_0xabd0('0x41')][0x6][_0xabd0('0x42')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x2acff1[_0xabd0('0x50')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x7]?_0x2acff1[_0xabd0('0x41')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x2acff1[_0xabd0('0x51')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x8]?_0x2acff1[_0xabd0('0x41')][0x8][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x52'),'value':_0x2acff1[_0xabd0('0x52')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x9]?_0x2acff1['attrs'][0x9][_0xabd0('0x42')]:undefined)||''}];case _0xabd0('0x53'):case'pie-chart':return[{'name':_0xabd0('0x54'),'value':_0x2acff1[_0xabd0('0x54')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||'total'},{'name':_0xabd0('0x55'),'value':_0x2acff1[_0xabd0('0x55')]||(_0x2acff1['attrs']&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1[_0xabd0('0x41')][0x1]['value']:undefined)||null},{'name':_0xabd0('0x56'),'value':_0x2acff1[_0xabd0('0x56')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x2]?_0x2acff1[_0xabd0('0x41')][0x2][_0xabd0('0x42')]:undefined)||null},{'name':'attrVoiceQueues','value':_0x2acff1[_0xabd0('0x57')]||(_0x2acff1['attrs']&&_0x2acff1[_0xabd0('0x41')][0x3]?_0x2acff1[_0xabd0('0x41')][0x3][_0xabd0('0x42')]:undefined)||[]},{'name':_0xabd0('0x4c'),'value':_0x2acff1[_0xabd0('0x4c')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x4]?_0x2acff1[_0xabd0('0x41')][0x4][_0xabd0('0x42')]:undefined)||_0xabd0('0x4d')},{'name':_0xabd0('0x4e'),'value':_0x2acff1['attrEmailAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x5]?_0x2acff1['attrs'][0x5][_0xabd0('0x42')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x2acff1[_0xabd0('0x4f')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x6]?_0x2acff1[_0xabd0('0x41')][0x6][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x58'),'value':_0x2acff1['attrSmsAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x7]?_0x2acff1['attrs'][0x7][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x50'),'value':_0x2acff1[_0xabd0('0x50')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x8]?_0x2acff1[_0xabd0('0x41')][0x8]['value']:undefined)||''},{'name':_0xabd0('0x51'),'value':_0x2acff1['attrWhatsappAccounts']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x9]?_0x2acff1[_0xabd0('0x41')][0x9][_0xabd0('0x42')]:undefined)||''},{'name':_0xabd0('0x52'),'value':_0x2acff1['attrChatWebsites']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0xa]?_0x2acff1['attrs'][0xa]['value']:undefined)||''}];case _0xabd0('0x59'):return[{'name':'attrReport','type':_0x2acff1['reportType']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x3e')]:undefined)||null,'value':_0x2acff1['attrReport']||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1['attrs'][0x0]?_0x2acff1[_0xabd0('0x41')][0x0][_0xabd0('0x42')]:undefined)||null},{'name':_0xabd0('0x5a'),'value':_0x2acff1[_0xabd0('0x5a')]||(_0x2acff1[_0xabd0('0x41')]&&_0x2acff1[_0xabd0('0x41')][0x1]?_0x2acff1['attrs'][0x1][_0xabd0('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x2a29e0){logger[_0xabd0('0x2b')]('widgetAttributes:\x20%s',JSON[_0xabd0('0x5b')](_0x2a29e0));return[];}}exports[_0xabd0('0x5c')]=function(_0x3f688d,_0x4c5c75){if(_0x3f688d[_0xabd0('0x5d')]){_0x3f688d[_0xabd0('0x5d')]['attrs']=widgetAttributes(_0x3f688d['body']);}return db[_0xabd0('0x5e')][_0xabd0('0x5c')](_0x3f688d[_0xabd0('0x5d')],{})['then'](respondWithResult(_0x4c5c75,0xc9))['catch'](handleError(_0x4c5c75,null));};exports[_0xabd0('0x28')]=function(_0x4c6ca1,_0x33992d){if(_0x4c6ca1[_0xabd0('0x5d')]['id']){delete _0x4c6ca1[_0xabd0('0x5d')]['id'];}_0x4c6ca1[_0xabd0('0x5d')][_0xabd0('0x41')]=widgetAttributes(_0x4c6ca1[_0xabd0('0x5d')]);return db[_0xabd0('0x5e')][_0xabd0('0x5f')]({'where':{'id':_0x4c6ca1[_0xabd0('0x60')]['id']}})[_0xabd0('0x29')](handleEntityNotFound(_0x33992d,null))['then'](saveUpdates(_0x4c6ca1[_0xabd0('0x5d')],null))[_0xabd0('0x29')](respondWithResult(_0x33992d,null))[_0xabd0('0x3d')](handleError(_0x33992d,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d0127bc..275adcf 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 _0x624d=['remove','emit','exports','DashboardItem','setMaxListeners'];(function(_0xc3aa24,_0x48eeb5){var _0x20f67b=function(_0x286be5){while(--_0x286be5){_0xc3aa24['push'](_0xc3aa24['shift']());}};_0x20f67b(++_0x48eeb5);}(_0x624d,0xbc));var _0xd624=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x624d[_0x138f59];return _0x3d114d;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0xd624('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd624('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xd624('0x2')};function emitEvent(_0x5b2cce){return function(_0x1be98e,_0x25e2a8,_0x5eba22){DashboardItemEvents[_0xd624('0x3')](_0x5b2cce+':'+_0x1be98e['id'],_0x1be98e);DashboardItemEvents[_0xd624('0x3')](_0x5b2cce,_0x1be98e);_0x5eba22(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xd624('0x4')]=DashboardItemEvents; \ No newline at end of file +var _0x489e=['hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x51a8bf,_0x533e6d){var _0x3ab934=function(_0x1535ad){while(--_0x1535ad){_0x51a8bf['push'](_0x51a8bf['shift']());}};_0x3ab934(++_0x533e6d);}(_0x489e,0x184));var _0xe489=function(_0x4e2284,_0x2da490){_0x4e2284=_0x4e2284-0x0;var _0x3a98dc=_0x489e[_0x4e2284];return _0x3a98dc;};'use strict';var EventEmitter=require(_0xe489('0x0'));var DashboardItem=require(_0xe489('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xe489('0x2')](0x0);var events={'afterCreate':_0xe489('0x3'),'afterUpdate':_0xe489('0x4'),'afterDestroy':_0xe489('0x5')};function emitEvent(_0x51c4d5){return function(_0x5eaa59,_0x5c4109,_0x50cded){DashboardItemEvents[_0xe489('0x6')](_0x51c4d5+':'+_0x5eaa59['id'],_0x5eaa59);DashboardItemEvents[_0xe489('0x6')](_0x51c4d5,_0x5eaa59);_0x50cded(null);};}for(var e in events){if(events[_0xe489('0x7')](e)){var event=events[e];DashboardItem[_0xe489('0x8')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 704dbbe..92df45b 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 _0x4b76=['dashboard_items','lodash','util','../../config/logger','moment','bluebird','request-promise','./dashboardItem.attributes','DashboardItem'];(function(_0x2f88e9,_0x414b34){var _0x268e4e=function(_0x379921){while(--_0x379921){_0x2f88e9['push'](_0x2f88e9['shift']());}};_0x268e4e(++_0x414b34);}(_0x4b76,0x1cc));var _0x64b7=function(_0x3ae130,_0x1822a7){_0x3ae130=_0x3ae130-0x0;var _0x3f79aa=_0x4b76[_0x3ae130];return _0x3f79aa;};'use strict';var _=require(_0x64b7('0x0'));var util=require(_0x64b7('0x1'));var logger=require(_0x64b7('0x2'))('api');var moment=require(_0x64b7('0x3'));var BPromise=require(_0x64b7('0x4'));var rp=require(_0x64b7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x64b7('0x6'));module['exports']=function(_0x2509b2,_0x338e79){return _0x2509b2['define'](_0x64b7('0x7'),attributes,{'tableName':_0x64b7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ab2=['DashboardItem','dashboard_items','../../config/logger','moment','bluebird','rimraf','./dashboardItem.attributes','define'];(function(_0x39e32f,_0x2dcc5b){var _0x84146f=function(_0x4f7da4){while(--_0x4f7da4){_0x39e32f['push'](_0x39e32f['shift']());}};_0x84146f(++_0x2dcc5b);}(_0x0ab2,0x92));var _0x20ab=function(_0x30b7ea,_0x55f5a4){_0x30b7ea=_0x30b7ea-0x0;var _0x52c740=_0x0ab2[_0x30b7ea];return _0x52c740;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20ab('0x0'))('api');var moment=require(_0x20ab('0x1'));var BPromise=require(_0x20ab('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x20ab('0x3'));var config=require('../../config/environment');var attributes=require(_0x20ab('0x4'));module['exports']=function(_0x44fdb2,_0x259548){return _0x44fdb2[_0x20ab('0x5')](_0x20ab('0x6'),attributes,{'tableName':_0x20ab('0x7'),'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 d8ecebb..01c2596 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 _0xc83e=['localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0xc83e,0x17b));var _0xec83=function(_0x39d711,_0xe11eb7){_0x39d711=_0x39d711-0x0;var _0xee1d0c=_0xc83e[_0x39d711];return _0xee1d0c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xec83('0x0'));var BPromise=require('bluebird');var rs=require(_0xec83('0x1'));var fs=require('fs');var Redis=require(_0xec83('0x2'));var db=require(_0xec83('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xec83('0x4'))(_0xec83('0x5'));var config=require(_0xec83('0x6'));var jayson=require(_0xec83('0x7'));var client=jayson['client'][_0xec83('0x8')]({'port':0x232a});config[_0xec83('0x9')]=_[_0xec83('0xa')](config[_0xec83('0x9')],{'host':_0xec83('0xb'),'port':0x18eb});var socket=require(_0xec83('0xc'))(new Redis(config['redis']));require(_0xec83('0xd'))[_0xec83('0xe')](socket);function respondWithRpcPromise(_0x47d47b,_0x2c238f,_0x4a93af){return new BPromise(function(_0xed956,_0x4fe904){return client[_0xec83('0xf')](_0x47d47b,_0x4a93af)[_0xec83('0x10')](function(_0x2e9d41){logger[_0xec83('0x11')](_0xec83('0x12'),_0x2c238f,_0xec83('0x13'));logger[_0xec83('0x14')](_0xec83('0x15'),_0x2c238f,_0xec83('0x13'),JSON[_0xec83('0x16')](_0x2e9d41));if(_0x2e9d41[_0xec83('0x17')]){if(_0x2e9d41[_0xec83('0x17')]['code']===0x1f4){logger[_0xec83('0x17')]('DashboardItem,\x20%s,\x20%s',_0x2c238f,_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);return _0x4fe904(_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);}logger['error'](_0xec83('0x12'),_0x2c238f,_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);return _0xed956(_0x2e9d41[_0xec83('0x17')][_0xec83('0x18')]);}else{logger[_0xec83('0x11')](_0xec83('0x12'),_0x2c238f,_0xec83('0x13'));_0xed956(_0x2e9d41['result']['message']);}})[_0xec83('0x19')](function(_0x5be35d){logger[_0xec83('0x17')](_0xec83('0x12'),_0x2c238f,_0x5be35d);_0x4fe904(_0x5be35d);});});} \ No newline at end of file +var _0xaf78=['register','request','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','redis','defaults','localhost'];(function(_0x325d4f,_0x32fe0f){var _0x5c32a9=function(_0x45850a){while(--_0x45850a){_0x325d4f['push'](_0x325d4f['shift']());}};_0x5c32a9(++_0x32fe0f);}(_0xaf78,0x96));var _0x8af7=function(_0x51e6a2,_0x3652ae){_0x51e6a2=_0x51e6a2-0x0;var _0xaf39a2=_0xaf78[_0x51e6a2];return _0xaf39a2;};'use strict';var _=require(_0x8af7('0x0'));var util=require('util');var moment=require(_0x8af7('0x1'));var BPromise=require('bluebird');var rs=require(_0x8af7('0x2'));var fs=require('fs');var Redis=require(_0x8af7('0x3'));var db=require(_0x8af7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8af7('0x5'))(_0x8af7('0x6'));var config=require('../../config/environment');var jayson=require(_0x8af7('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x8af7('0x8')]=_[_0x8af7('0x9')](config['redis'],{'host':_0x8af7('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8af7('0x8')]));require('./dashboardItem.socket')[_0x8af7('0xb')](socket);function respondWithRpcPromise(_0x558389,_0x20eae1,_0x1e4362){return new BPromise(function(_0x158e01,_0x68f82b){return client[_0x8af7('0xc')](_0x558389,_0x1e4362)['then'](function(_0x50e01b){logger['info'](_0x8af7('0xd'),_0x20eae1,'request\x20sent');logger[_0x8af7('0xe')](_0x8af7('0xf'),_0x20eae1,_0x8af7('0x10'),JSON[_0x8af7('0x11')](_0x50e01b));if(_0x50e01b['error']){if(_0x50e01b[_0x8af7('0x12')][_0x8af7('0x13')]===0x1f4){logger[_0x8af7('0x12')](_0x8af7('0xd'),_0x20eae1,_0x50e01b[_0x8af7('0x12')]['message']);return _0x68f82b(_0x50e01b[_0x8af7('0x12')][_0x8af7('0x14')]);}logger[_0x8af7('0x12')]('DashboardItem,\x20%s,\x20%s',_0x20eae1,_0x50e01b[_0x8af7('0x12')]['message']);return _0x158e01(_0x50e01b[_0x8af7('0x12')][_0x8af7('0x14')]);}else{logger[_0x8af7('0x15')]('DashboardItem,\x20%s,\x20%s',_0x20eae1,_0x8af7('0x10'));_0x158e01(_0x50e01b[_0x8af7('0x16')][_0x8af7('0x14')]);}})['catch'](function(_0x165427){logger[_0x8af7('0x12')](_0x8af7('0xd'),_0x20eae1,_0x165427);_0x68f82b(_0x165427);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index d536533..da32064 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 _0x4db6=['remove','update','emit','removeListener','register','dashboardItem:','./dashboardItem.events'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x4db6,0x6f));var _0x64db=function(_0x5272b2,_0x59f060){_0x5272b2=_0x5272b2-0x0;var _0x2ca6c5=_0x4db6[_0x5272b2];return _0x2ca6c5;};'use strict';var DashboardItemEvents=require(_0x64db('0x0'));var events=['save',_0x64db('0x1'),_0x64db('0x2')];function createListener(_0x2a63a1,_0x5657b3){return function(_0x268cf6){_0x5657b3[_0x64db('0x3')](_0x2a63a1,_0x268cf6);};}function removeListener(_0x512997,_0x246f0d){return function(){DashboardItemEvents[_0x64db('0x4')](_0x512997,_0x246f0d);};}exports[_0x64db('0x5')]=function(_0x4acf36){for(var _0x1075d9=0x0,_0x59ce2a=events['length'];_0x1075d9<_0x59ce2a;_0x1075d9++){var _0x4e1ef1=events[_0x1075d9];var _0x2e37f3=createListener(_0x64db('0x6')+_0x4e1ef1,_0x4acf36);DashboardItemEvents['on'](_0x4e1ef1,_0x2e37f3);}}; \ No newline at end of file +var _0x28e9=['length','./dashboardItem.events','update','removeListener','register'];(function(_0x200bef,_0x5d83dd){var _0x6dc84e=function(_0x215b1c){while(--_0x215b1c){_0x200bef['push'](_0x200bef['shift']());}};_0x6dc84e(++_0x5d83dd);}(_0x28e9,0xfb));var _0x928e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x28e9[_0x4565bf];return _0x5610ba;};'use strict';var DashboardItemEvents=require(_0x928e('0x0'));var events=['save','remove',_0x928e('0x1')];function createListener(_0x9685cc,_0x1d2567){return function(_0x2a972f){_0x1d2567['emit'](_0x9685cc,_0x2a972f);};}function removeListener(_0x1d10dd,_0x40a99d){return function(){DashboardItemEvents[_0x928e('0x2')](_0x1d10dd,_0x40a99d);};}exports[_0x928e('0x3')]=function(_0x2f3b7e){for(var _0x58653c=0x0,_0x3ec56a=events[_0x928e('0x4')];_0x58653c<_0x3ec56a;_0x58653c++){var _0x2b53e2=events[_0x58653c];var _0x4512ee=createListener('dashboardItem:'+_0x2b53e2,_0x2f3b7e);DashboardItemEvents['on'](_0x2b53e2,_0x4512ee);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 333533b..c18e098 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 _0xf16a=['destroy','util','path','express','Router','fs-extra','../../components/interaction/service','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete'];(function(_0x42b623,_0x3e4823){var _0x55a3dd=function(_0xf11159){while(--_0xf11159){_0x42b623['push'](_0x42b623['shift']());}};_0x55a3dd(++_0x3e4823);}(_0xf16a,0xcd));var _0xaf16=function(_0x474bc0,_0x26989c){_0x474bc0=_0x474bc0-0x0;var _0x4b24cf=_0xf16a[_0x474bc0];return _0x4b24cf;};'use strict';var multer=require('multer');var util=require(_0xaf16('0x0'));var path=require(_0xaf16('0x1'));var timeout=require('connect-timeout');var express=require(_0xaf16('0x2'));var router=express[_0xaf16('0x3')]();var fs_extra=require(_0xaf16('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaf16('0x5'));var config=require('../../config/environment');var controller=require(_0xaf16('0x6'));router[_0xaf16('0x7')](_0xaf16('0x8'),auth[_0xaf16('0x9')](),controller[_0xaf16('0xa')]);router[_0xaf16('0xb')]('/',auth[_0xaf16('0x9')](),controller[_0xaf16('0xc')]);router[_0xaf16('0xd')](_0xaf16('0x8'),auth[_0xaf16('0x9')](),controller[_0xaf16('0xe')]);router[_0xaf16('0xf')]('/:id',auth[_0xaf16('0x9')](),controller[_0xaf16('0x10')]);module['exports']=router; \ No newline at end of file +var _0x919c=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x13bff9,_0x5b4d53){var _0x5e5189=function(_0x2bdea8){while(--_0x2bdea8){_0x13bff9['push'](_0x13bff9['shift']());}};_0x5e5189(++_0x5b4d53);}(_0x919c,0x152));var _0xc919=function(_0x153b4a,_0x4a0c7c){_0x153b4a=_0x153b4a-0x0;var _0x256ca1=_0x919c[_0x153b4a];return _0x256ca1;};'use strict';var multer=require(_0xc919('0x0'));var util=require(_0xc919('0x1'));var path=require('path');var timeout=require(_0xc919('0x2'));var express=require(_0xc919('0x3'));var router=express['Router']();var fs_extra=require(_0xc919('0x4'));var auth=require(_0xc919('0x5'));var interaction=require(_0xc919('0x6'));var config=require(_0xc919('0x7'));var controller=require(_0xc919('0x8'));router[_0xc919('0x9')]('/:id',auth[_0xc919('0xa')](),controller[_0xc919('0xb')]);router[_0xc919('0xc')]('/',auth[_0xc919('0xa')](),controller[_0xc919('0xd')]);router[_0xc919('0xe')](_0xc919('0xf'),auth['isAuthenticated'](),controller[_0xc919('0x10')]);router['delete'](_0xc919('0xf'),auth[_0xc919('0xa')](),controller[_0xc919('0x11')]);module[_0xc919('0x12')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 937c15c..64478f7 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 _0xc71e=['STRING','ENUM','first','second','third','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc71e,0x13d));var _0xec71=function(_0x2b3179,_0x2ac04c){_0x2b3179=_0x2b3179-0x0;var _0x1e40ee=_0xc71e[_0x2b3179];return _0x1e40ee;};'use strict';var Sequelize=require('sequelize');module[_0xec71('0x0')]={'name':{'type':Sequelize[_0xec71('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xec71('0x2')](_0xec71('0x3'),_0xec71('0x4'),_0xec71('0x5')),'allowNull':![],'defaultValue':_0xec71('0x3')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9baa=['second','third','first','exports','STRING','ENUM'];(function(_0x2f7575,_0xbb0a63){var _0x9e028e=function(_0x596caf){while(--_0x596caf){_0x2f7575['push'](_0x2f7575['shift']());}};_0x9e028e(++_0xbb0a63);}(_0x9baa,0xa5));var _0xa9ba=function(_0x174ac2,_0xa91d82){_0x174ac2=_0x174ac2-0x0;var _0x28ca76=_0x9baa[_0x174ac2];return _0x28ca76;};'use strict';var Sequelize=require('sequelize');module[_0xa9ba('0x0')]={'name':{'type':Sequelize[_0xa9ba('0x1')],'allowNull':![]},'level':{'type':Sequelize[_0xa9ba('0x2')]('first',_0xa9ba('0x3'),_0xa9ba('0x4')),'allowNull':![],'defaultValue':_0xa9ba('0x5')},'description':{'type':Sequelize[_0xa9ba('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 5b6615e..ac1cd41 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 _0x37a7=['model','keys','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','params','intersection','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key'];(function(_0x1eda20,_0x1149f4){var _0x31b953=function(_0x25f0d8){while(--_0x25f0d8){_0x1eda20['push'](_0x1eda20['shift']());}};_0x31b953(++_0x1149f4);}(_0x37a7,0x6f));var _0x737a=function(_0x179822,_0x2f4122){_0x179822=_0x179822-0x0;var _0x319cad=_0x37a7[_0x179822];return _0x319cad;};'use strict';var emlformat=require(_0x737a('0x0'));var rimraf=require(_0x737a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x737a('0x2'));var BPromise=require(_0x737a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x737a('0x4'));var csv=require(_0x737a('0x5'));var ejs=require(_0x737a('0x6'));var fs=require('fs');var fs_extra=require(_0x737a('0x7'));var _=require(_0x737a('0x8'));var squel=require('squel');var crypto=require(_0x737a('0x9'));var jsforce=require(_0x737a('0xa'));var deskjs=require(_0x737a('0xb'));var toCsv=require(_0x737a('0x5'));var querystring=require('querystring');var Papa=require(_0x737a('0xc'));var Redis=require(_0x737a('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x737a('0xe'));var as=require(_0x737a('0xf'));var hardwareService=require(_0x737a('0x10'));var logger=require(_0x737a('0x11'))(_0x737a('0x12'));var utils=require(_0x737a('0x13'));var config=require(_0x737a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x737a('0x15'))['db'];function respondWithStatusCode(_0x22cc58,_0x2c4e57){_0x2c4e57=_0x2c4e57||0xcc;return function(_0x202575){if(_0x202575){return _0x22cc58[_0x737a('0x16')](_0x2c4e57);}return _0x22cc58[_0x737a('0x17')](_0x2c4e57)[_0x737a('0x18')]();};}function respondWithResult(_0x216a1d,_0x59b844){_0x59b844=_0x59b844||0xc8;return function(_0x449a00){if(_0x449a00){return _0x216a1d[_0x737a('0x17')](_0x59b844)['json'](_0x449a00);}};}function respondWithFilteredResult(_0x597c9d,_0xbf359e){return function(_0x37fc59){if(_0x37fc59){var _0x64901f=typeof _0xbf359e[_0x737a('0x19')]===_0x737a('0x1a')&&typeof _0xbf359e[_0x737a('0x1b')]==='undefined';var _0x369f2f=_0x37fc59['count'];var _0x30344f=_0x64901f?0x0:_0xbf359e[_0x737a('0x19')];var _0x58fb1f=_0x64901f?_0x37fc59[_0x737a('0x1c')]:_0xbf359e['offset']+_0xbf359e['limit'];var _0x3bf493;if(_0x58fb1f>=_0x369f2f){_0x58fb1f=_0x369f2f;_0x3bf493=0xc8;}else{_0x3bf493=0xce;}_0x597c9d[_0x737a('0x17')](_0x3bf493);return _0x597c9d['set'](_0x737a('0x1d'),_0x30344f+'-'+_0x58fb1f+'/'+_0x369f2f)[_0x737a('0x1e')](_0x37fc59);}return null;};}function patchUpdates(_0x8d8378){return function(_0x5d8e46){try{jsonpatch[_0x737a('0x1f')](_0x5d8e46,_0x8d8378,!![]);}catch(_0x4ac430){return BPromise[_0x737a('0x20')](_0x4ac430);}return _0x5d8e46['save']();};}function saveUpdates(_0x28a36e,_0x21d412){return function(_0x1e801d){if(_0x1e801d){return _0x1e801d[_0x737a('0x21')](_0x28a36e)[_0x737a('0x22')](function(_0xd334c0){return _0xd334c0;});}return null;};}function removeEntity(_0x1979e9,_0x379439){return function(_0x4deb7c){if(_0x4deb7c){return _0x4deb7c['destroy']()[_0x737a('0x22')](function(){var _0x54a7ec=_0x4deb7c[_0x737a('0x23')]({'plain':!![]});var _0x55c901=_0x737a('0x24');return db[_0x737a('0x25')][_0x737a('0x26')]({'where':{'type':_0x55c901,'resourceId':_0x54a7ec['id']}})[_0x737a('0x22')](function(){return _0x4deb7c;});})[_0x737a('0x22')](function(){_0x1979e9['status'](0xcc)[_0x737a('0x18')]();});}};}function handleEntityNotFound(_0xff0afc,_0x437b9a){return function(_0xb9d3fd){if(!_0xb9d3fd){_0xff0afc[_0x737a('0x16')](0x194);}return _0xb9d3fd;};}function handleError(_0x39873b,_0x32189a){_0x32189a=_0x32189a||0x1f4;return function(_0x5a3590){logger[_0x737a('0x27')](_0x5a3590[_0x737a('0x28')]);if(_0x5a3590[_0x737a('0x29')]){delete _0x5a3590[_0x737a('0x29')];}_0x39873b[_0x737a('0x17')](_0x32189a)['send'](_0x5a3590);};}exports[_0x737a('0x2a')]=function(_0x3dd65d,_0x4115c5){var _0x42df4f={},_0x50b09f={},_0x2b5d86={'count':0x0,'rows':[]};var _0x3d3157=_[_0x737a('0x2b')](db[_0x737a('0x2c')][_0x737a('0x2d')],function(_0x430776){return{'name':_0x430776[_0x737a('0x2e')],'type':_0x430776[_0x737a('0x2f')][_0x737a('0x30')]};});_0x50b09f[_0x737a('0x31')]=_['map'](_0x3d3157,'name');_0x50b09f['query']=_[_0x737a('0x32')](_0x3dd65d['query']);_0x50b09f['filters']=_['intersection'](_0x50b09f['model'],_0x50b09f['query']);_0x42df4f[_0x737a('0x33')]=_['intersection'](_0x50b09f['model'],qs[_0x737a('0x34')](_0x3dd65d[_0x737a('0x35')][_0x737a('0x34')]));_0x42df4f[_0x737a('0x33')]=_0x42df4f[_0x737a('0x33')][_0x737a('0x36')]?_0x42df4f[_0x737a('0x33')]:_0x50b09f[_0x737a('0x31')];if(!_0x3dd65d[_0x737a('0x35')][_0x737a('0x37')](_0x737a('0x38'))){_0x42df4f[_0x737a('0x1b')]=qs[_0x737a('0x1b')](_0x3dd65d[_0x737a('0x35')][_0x737a('0x1b')]);_0x42df4f[_0x737a('0x19')]=qs['offset'](_0x3dd65d[_0x737a('0x35')][_0x737a('0x19')]);}_0x42df4f[_0x737a('0x39')]=qs[_0x737a('0x3a')](_0x3dd65d[_0x737a('0x35')]['sort']);_0x42df4f[_0x737a('0x3b')]=qs[_0x737a('0x3c')](_[_0x737a('0x3d')](_0x3dd65d['query'],_0x50b09f['filters']),_0x3d3157);if(_0x3dd65d[_0x737a('0x35')][_0x737a('0x3e')]){_0x42df4f['where']=_[_0x737a('0x3f')](_0x42df4f[_0x737a('0x3b')],{'$or':_[_0x737a('0x2b')](_0x3d3157,function(_0x1439cc){if(_0x1439cc[_0x737a('0x2f')]!=='VIRTUAL'){var _0x2309fc={};_0x2309fc[_0x1439cc[_0x737a('0x29')]]={'$like':'%'+_0x3dd65d[_0x737a('0x35')][_0x737a('0x3e')]+'%'};return _0x2309fc;}})});}_0x42df4f=_['merge']({},_0x42df4f,_0x3dd65d[_0x737a('0x40')]);var _0x20cea7={'where':_0x42df4f[_0x737a('0x3b')]};return db['Disposition']['count'](_0x20cea7)[_0x737a('0x22')](function(_0x43a939){_0x2b5d86[_0x737a('0x1c')]=_0x43a939;if(_0x3dd65d[_0x737a('0x35')]['includeAll']){_0x42df4f[_0x737a('0x41')]=[{'all':!![]}];}return db[_0x737a('0x2c')][_0x737a('0x42')](_0x42df4f);})[_0x737a('0x22')](function(_0xca416f){_0x2b5d86[_0x737a('0x43')]=_0xca416f;return _0x2b5d86;})['then'](respondWithFilteredResult(_0x4115c5,_0x42df4f))[_0x737a('0x44')](handleError(_0x4115c5,null));};exports['show']=function(_0x4fcd83,_0x89535){var _0x3e4a7b={'raw':!![],'where':{'id':_0x4fcd83[_0x737a('0x45')]['id']}},_0x1c9815={};_0x1c9815['model']=_['keys'](db[_0x737a('0x2c')][_0x737a('0x2d')]);_0x1c9815[_0x737a('0x35')]=_['keys'](_0x4fcd83[_0x737a('0x35')]);_0x1c9815[_0x737a('0x3c')]=_[_0x737a('0x46')](_0x1c9815[_0x737a('0x31')],_0x1c9815[_0x737a('0x35')]);_0x3e4a7b[_0x737a('0x33')]=_[_0x737a('0x46')](_0x1c9815[_0x737a('0x31')],qs[_0x737a('0x34')](_0x4fcd83[_0x737a('0x35')][_0x737a('0x34')]));_0x3e4a7b[_0x737a('0x33')]=_0x3e4a7b[_0x737a('0x33')][_0x737a('0x36')]?_0x3e4a7b[_0x737a('0x33')]:_0x1c9815[_0x737a('0x31')];if(_0x4fcd83[_0x737a('0x35')][_0x737a('0x47')]){_0x3e4a7b['include']=[{'all':!![]}];}_0x3e4a7b=_[_0x737a('0x3f')]({},_0x3e4a7b,_0x4fcd83[_0x737a('0x40')]);return db[_0x737a('0x2c')][_0x737a('0x48')](_0x3e4a7b)['then'](handleEntityNotFound(_0x89535,null))[_0x737a('0x22')](respondWithResult(_0x89535,null))[_0x737a('0x44')](handleError(_0x89535,null));};exports[_0x737a('0x49')]=function(_0xd91856,_0x3f9b66){return db[_0x737a('0x2c')][_0x737a('0x49')](_0xd91856[_0x737a('0x4a')],{})['then'](function(_0x51229c){var _0x3be1ab=_0xd91856[_0x737a('0x4b')][_0x737a('0x23')]({'plain':!![]});if(!_0x3be1ab)throw new Error(_0x737a('0x4c'));if(_0x3be1ab['role']===_0x737a('0x4b')){var _0x13d85d=_0x51229c[_0x737a('0x23')]({'plain':!![]});var _0x4056df=_0x737a('0x24');return db[_0x737a('0x4d')]['find']({'where':{'name':_0x4056df,'userProfileId':_0x3be1ab[_0x737a('0x4e')]},'raw':!![]})['then'](function(_0x72afc6){if(_0x72afc6&&_0x72afc6[_0x737a('0x4f')]===0x0){return db[_0x737a('0x25')][_0x737a('0x49')]({'name':_0x13d85d[_0x737a('0x29')],'resourceId':_0x13d85d['id'],'type':_0x72afc6['name'],'sectionId':_0x72afc6['id']},{})[_0x737a('0x22')](function(){return _0x51229c;});}else{return _0x51229c;}})[_0x737a('0x44')](function(_0x4d53c0){logger[_0x737a('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d53c0);throw _0x4d53c0;});}return _0x51229c;})['then'](respondWithResult(_0x3f9b66,0xc9))[_0x737a('0x44')](handleError(_0x3f9b66,null));};exports[_0x737a('0x21')]=function(_0x243699,_0x228029){if(_0x243699['body']['id']){delete _0x243699[_0x737a('0x4a')]['id'];}return db['Disposition'][_0x737a('0x48')]({'where':{'id':_0x243699[_0x737a('0x45')]['id']}})[_0x737a('0x22')](handleEntityNotFound(_0x228029,null))['then'](saveUpdates(_0x243699[_0x737a('0x4a')],null))[_0x737a('0x22')](respondWithResult(_0x228029,null))[_0x737a('0x44')](handleError(_0x228029,null));};exports[_0x737a('0x26')]=function(_0x565ed6,_0x2b0e59){return db['Disposition'][_0x737a('0x48')]({'where':{'id':_0x565ed6[_0x737a('0x45')]['id']}})[_0x737a('0x22')](handleEntityNotFound(_0x2b0e59,null))['then'](removeEntity(_0x2b0e59,null))[_0x737a('0x44')](handleError(_0x2b0e59,null));}; \ No newline at end of file +var _0xc57c=['fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Dispositions','UserProfileResource','destroy','error','stack','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','eml-format','request-promise','mustache','path','sox','to-csv','ejs'];(function(_0x3dff76,_0x4ba3a9){var _0x4c00bf=function(_0x4de168){while(--_0x4de168){_0x3dff76['push'](_0x3dff76['shift']());}};_0x4c00bf(++_0x4ba3a9);}(_0xc57c,0x149));var _0xcc57=function(_0x50efa5,_0xed4a8a){_0x50efa5=_0x50efa5-0x0;var _0x5f477f=_0xc57c[_0x50efa5];return _0x5f477f;};'use strict';var emlformat=require(_0xcc57('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xcc57('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcc57('0x2'));var util=require('util');var path=require(_0xcc57('0x3'));var sox=require(_0xcc57('0x4'));var csv=require(_0xcc57('0x5'));var ejs=require(_0xcc57('0x6'));var fs=require('fs');var fs_extra=require(_0xcc57('0x7'));var _=require(_0xcc57('0x8'));var squel=require(_0xcc57('0x9'));var crypto=require('crypto');var jsforce=require(_0xcc57('0xa'));var deskjs=require(_0xcc57('0xb'));var toCsv=require(_0xcc57('0x5'));var querystring=require(_0xcc57('0xc'));var Papa=require(_0xcc57('0xd'));var Redis=require(_0xcc57('0xe'));var authService=require(_0xcc57('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcc57('0x10'))(_0xcc57('0x11'));var utils=require(_0xcc57('0x12'));var config=require(_0xcc57('0x13'));var licenseUtil=require(_0xcc57('0x14'));var db=require(_0xcc57('0x15'))['db'];function respondWithStatusCode(_0x1efb2f,_0x1d257a){_0x1d257a=_0x1d257a||0xcc;return function(_0x25fb16){if(_0x25fb16){return _0x1efb2f[_0xcc57('0x16')](_0x1d257a);}return _0x1efb2f[_0xcc57('0x17')](_0x1d257a)[_0xcc57('0x18')]();};}function respondWithResult(_0x23ee17,_0x5bdec9){_0x5bdec9=_0x5bdec9||0xc8;return function(_0x57a851){if(_0x57a851){return _0x23ee17['status'](_0x5bdec9)[_0xcc57('0x19')](_0x57a851);}};}function respondWithFilteredResult(_0x1c3969,_0xd5b2ff){return function(_0x2b6801){if(_0x2b6801){var _0x1628e3=typeof _0xd5b2ff['offset']===_0xcc57('0x1a')&&typeof _0xd5b2ff[_0xcc57('0x1b')]==='undefined';var _0x2947ab=_0x2b6801['count'];var _0x43d454=_0x1628e3?0x0:_0xd5b2ff['offset'];var _0xa7156c=_0x1628e3?_0x2b6801[_0xcc57('0x1c')]:_0xd5b2ff[_0xcc57('0x1d')]+_0xd5b2ff['limit'];var _0x4fb4a9;if(_0xa7156c>=_0x2947ab){_0xa7156c=_0x2947ab;_0x4fb4a9=0xc8;}else{_0x4fb4a9=0xce;}_0x1c3969['status'](_0x4fb4a9);return _0x1c3969[_0xcc57('0x1e')](_0xcc57('0x1f'),_0x43d454+'-'+_0xa7156c+'/'+_0x2947ab)[_0xcc57('0x19')](_0x2b6801);}return null;};}function patchUpdates(_0x453c0c){return function(_0x3c5ebb){try{jsonpatch[_0xcc57('0x20')](_0x3c5ebb,_0x453c0c,!![]);}catch(_0x67b8c5){return BPromise[_0xcc57('0x21')](_0x67b8c5);}return _0x3c5ebb[_0xcc57('0x22')]();};}function saveUpdates(_0x2ef19d,_0x101134){return function(_0x302f5e){if(_0x302f5e){return _0x302f5e[_0xcc57('0x23')](_0x2ef19d)[_0xcc57('0x24')](function(_0xc7c487){return _0xc7c487;});}return null;};}function removeEntity(_0x5d8550,_0x2b8c15){return function(_0x10b67b){if(_0x10b67b){return _0x10b67b['destroy']()['then'](function(){var _0x492581=_0x10b67b[_0xcc57('0x25')]({'plain':!![]});var _0x5cd6a2=_0xcc57('0x26');return db[_0xcc57('0x27')][_0xcc57('0x28')]({'where':{'type':_0x5cd6a2,'resourceId':_0x492581['id']}})['then'](function(){return _0x10b67b;});})[_0xcc57('0x24')](function(){_0x5d8550[_0xcc57('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d3541,_0xa71b5d){return function(_0x438852){if(!_0x438852){_0x1d3541[_0xcc57('0x16')](0x194);}return _0x438852;};}function handleError(_0x5e5dad,_0x241f6b){_0x241f6b=_0x241f6b||0x1f4;return function(_0x4e3b38){logger[_0xcc57('0x29')](_0x4e3b38[_0xcc57('0x2a')]);if(_0x4e3b38['name']){delete _0x4e3b38[_0xcc57('0x2b')];}_0x5e5dad['status'](_0x241f6b)[_0xcc57('0x2c')](_0x4e3b38);};}exports[_0xcc57('0x2d')]=function(_0x20db2a,_0x3d116d){var _0x33d647={},_0x135786={},_0x518bc1={'count':0x0,'rows':[]};var _0x47088c=_[_0xcc57('0x2e')](db[_0xcc57('0x2f')][_0xcc57('0x30')],function(_0x5773c4){return{'name':_0x5773c4[_0xcc57('0x31')],'type':_0x5773c4[_0xcc57('0x32')][_0xcc57('0x33')]};});_0x135786[_0xcc57('0x34')]=_[_0xcc57('0x2e')](_0x47088c,_0xcc57('0x2b'));_0x135786[_0xcc57('0x35')]=_[_0xcc57('0x36')](_0x20db2a[_0xcc57('0x35')]);_0x135786['filters']=_[_0xcc57('0x37')](_0x135786['model'],_0x135786['query']);_0x33d647[_0xcc57('0x38')]=_['intersection'](_0x135786[_0xcc57('0x34')],qs[_0xcc57('0x39')](_0x20db2a[_0xcc57('0x35')][_0xcc57('0x39')]));_0x33d647[_0xcc57('0x38')]=_0x33d647[_0xcc57('0x38')][_0xcc57('0x3a')]?_0x33d647['attributes']:_0x135786[_0xcc57('0x34')];if(!_0x20db2a[_0xcc57('0x35')][_0xcc57('0x3b')](_0xcc57('0x3c'))){_0x33d647['limit']=qs['limit'](_0x20db2a['query'][_0xcc57('0x1b')]);_0x33d647[_0xcc57('0x1d')]=qs[_0xcc57('0x1d')](_0x20db2a[_0xcc57('0x35')][_0xcc57('0x1d')]);}_0x33d647[_0xcc57('0x3d')]=qs[_0xcc57('0x3e')](_0x20db2a[_0xcc57('0x35')][_0xcc57('0x3e')]);_0x33d647[_0xcc57('0x3f')]=qs[_0xcc57('0x40')](_['pick'](_0x20db2a[_0xcc57('0x35')],_0x135786[_0xcc57('0x40')]),_0x47088c);if(_0x20db2a[_0xcc57('0x35')][_0xcc57('0x41')]){_0x33d647[_0xcc57('0x3f')]=_[_0xcc57('0x42')](_0x33d647[_0xcc57('0x3f')],{'$or':_['map'](_0x47088c,function(_0x1f4f3a){if(_0x1f4f3a[_0xcc57('0x32')]!==_0xcc57('0x43')){var _0x4c9f49={};_0x4c9f49[_0x1f4f3a[_0xcc57('0x2b')]]={'$like':'%'+_0x20db2a[_0xcc57('0x35')][_0xcc57('0x41')]+'%'};return _0x4c9f49;}})});}_0x33d647=_['merge']({},_0x33d647,_0x20db2a[_0xcc57('0x44')]);var _0x852b9f={'where':_0x33d647[_0xcc57('0x3f')]};return db[_0xcc57('0x2f')][_0xcc57('0x1c')](_0x852b9f)[_0xcc57('0x24')](function(_0x12ce9f){_0x518bc1[_0xcc57('0x1c')]=_0x12ce9f;if(_0x20db2a[_0xcc57('0x35')][_0xcc57('0x45')]){_0x33d647['include']=[{'all':!![]}];}return db[_0xcc57('0x2f')][_0xcc57('0x46')](_0x33d647);})[_0xcc57('0x24')](function(_0x468656){_0x518bc1['rows']=_0x468656;return _0x518bc1;})[_0xcc57('0x24')](respondWithFilteredResult(_0x3d116d,_0x33d647))[_0xcc57('0x47')](handleError(_0x3d116d,null));};exports[_0xcc57('0x48')]=function(_0xd53281,_0x2d40cd){var _0x11f3b5={'raw':!![],'where':{'id':_0xd53281[_0xcc57('0x49')]['id']}},_0x364071={};_0x364071[_0xcc57('0x34')]=_[_0xcc57('0x36')](db['Disposition'][_0xcc57('0x30')]);_0x364071[_0xcc57('0x35')]=_['keys'](_0xd53281['query']);_0x364071[_0xcc57('0x40')]=_[_0xcc57('0x37')](_0x364071[_0xcc57('0x34')],_0x364071[_0xcc57('0x35')]);_0x11f3b5['attributes']=_[_0xcc57('0x37')](_0x364071[_0xcc57('0x34')],qs['fields'](_0xd53281[_0xcc57('0x35')][_0xcc57('0x39')]));_0x11f3b5[_0xcc57('0x38')]=_0x11f3b5[_0xcc57('0x38')]['length']?_0x11f3b5[_0xcc57('0x38')]:_0x364071['model'];if(_0xd53281['query']['includeAll']){_0x11f3b5[_0xcc57('0x4a')]=[{'all':!![]}];}_0x11f3b5=_[_0xcc57('0x42')]({},_0x11f3b5,_0xd53281[_0xcc57('0x44')]);return db[_0xcc57('0x2f')][_0xcc57('0x4b')](_0x11f3b5)[_0xcc57('0x24')](handleEntityNotFound(_0x2d40cd,null))[_0xcc57('0x24')](respondWithResult(_0x2d40cd,null))[_0xcc57('0x47')](handleError(_0x2d40cd,null));};exports['create']=function(_0xca20a,_0x557e5f){return db[_0xcc57('0x2f')][_0xcc57('0x4c')](_0xca20a['body'],{})[_0xcc57('0x24')](function(_0x4f8231){var _0xae9b01=_0xca20a[_0xcc57('0x4d')]['get']({'plain':!![]});if(!_0xae9b01)throw new Error(_0xcc57('0x4e'));if(_0xae9b01[_0xcc57('0x4f')]===_0xcc57('0x4d')){var _0x3bdb7a=_0x4f8231[_0xcc57('0x25')]({'plain':!![]});var _0x1aa62a=_0xcc57('0x26');return db[_0xcc57('0x50')][_0xcc57('0x4b')]({'where':{'name':_0x1aa62a,'userProfileId':_0xae9b01[_0xcc57('0x51')]},'raw':!![]})['then'](function(_0x262894){if(_0x262894&&_0x262894[_0xcc57('0x52')]===0x0){return db[_0xcc57('0x27')][_0xcc57('0x4c')]({'name':_0x3bdb7a['name'],'resourceId':_0x3bdb7a['id'],'type':_0x262894[_0xcc57('0x2b')],'sectionId':_0x262894['id']},{})['then'](function(){return _0x4f8231;});}else{return _0x4f8231;}})['catch'](function(_0x15b1d0){logger[_0xcc57('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15b1d0);throw _0x15b1d0;});}return _0x4f8231;})['then'](respondWithResult(_0x557e5f,0xc9))[_0xcc57('0x47')](handleError(_0x557e5f,null));};exports[_0xcc57('0x23')]=function(_0x5667d8,_0x6b9000){if(_0x5667d8[_0xcc57('0x53')]['id']){delete _0x5667d8[_0xcc57('0x53')]['id'];}return db[_0xcc57('0x2f')]['find']({'where':{'id':_0x5667d8[_0xcc57('0x49')]['id']}})['then'](handleEntityNotFound(_0x6b9000,null))[_0xcc57('0x24')](saveUpdates(_0x5667d8[_0xcc57('0x53')],null))[_0xcc57('0x24')](respondWithResult(_0x6b9000,null))[_0xcc57('0x47')](handleError(_0x6b9000,null));};exports[_0xcc57('0x28')]=function(_0x55bc85,_0x5d59f1){return db['Disposition']['find']({'where':{'id':_0x55bc85[_0xcc57('0x49')]['id']}})[_0xcc57('0x24')](handleEntityNotFound(_0x5d59f1,null))[_0xcc57('0x24')](removeEntity(_0x5d59f1,null))[_0xcc57('0x47')](handleError(_0x5d59f1,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 4a4155c..7d1c2c5 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 _0x0856=['OpenchannelAccountId','name_whatsapp','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./disposition.attributes','exports','define','tools_dispositions','name','ListId','ChatWebsiteId','MailAccountId','SmsAccountId','name_fax','FaxAccountId','name_openchannel'];(function(_0x1047c0,_0x49ba21){var _0x135d76=function(_0xc24635){while(--_0xc24635){_0x1047c0['push'](_0x1047c0['shift']());}};_0x135d76(++_0x49ba21);}(_0x0856,0x1a6));var _0x6085=function(_0x249db2,_0x29185b){_0x249db2=_0x249db2-0x0;var _0x18be94=_0x0856[_0x249db2];return _0x18be94;};'use strict';var _=require(_0x6085('0x0'));var util=require('util');var logger=require(_0x6085('0x1'))(_0x6085('0x2'));var moment=require(_0x6085('0x3'));var BPromise=require('bluebird');var rp=require(_0x6085('0x4'));var fs=require('fs');var path=require(_0x6085('0x5'));var rimraf=require('rimraf');var config=require(_0x6085('0x6'));var attributes=require(_0x6085('0x7'));module[_0x6085('0x8')]=function(_0x9a7a71,_0x5361d6){return _0x9a7a71[_0x6085('0x9')]('Disposition',attributes,{'tableName':_0x6085('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x6085('0xb'),_0x6085('0xc')]},{'unique':!![],'name':'name_chat','fields':['name',_0x6085('0xd')]},{'unique':!![],'name':'name_mail','fields':['name',_0x6085('0xe')]},{'unique':!![],'name':'name_sms','fields':['name',_0x6085('0xf')]},{'unique':!![],'name':_0x6085('0x10'),'fields':[_0x6085('0xb'),_0x6085('0x11')]},{'unique':!![],'name':_0x6085('0x12'),'fields':[_0x6085('0xb'),_0x6085('0x13')]},{'unique':!![],'name':_0x6085('0x14'),'fields':[_0x6085('0xb'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2a33=['ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','name_fax','name_whatsapp','WhatsappAccountId','lodash','moment','bluebird','../../config/environment','./disposition.attributes','Disposition','tools_dispositions','name'];(function(_0x32cf96,_0x7502d5){var _0x125cc1=function(_0x376987){while(--_0x376987){_0x32cf96['push'](_0x32cf96['shift']());}};_0x125cc1(++_0x7502d5);}(_0x2a33,0x1e5));var _0x32a3=function(_0x7a7d69,_0x3178f5){_0x7a7d69=_0x7a7d69-0x0;var _0x3b0fcc=_0x2a33[_0x7a7d69];return _0x3b0fcc;};'use strict';var _=require(_0x32a3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x32a3('0x1'));var BPromise=require(_0x32a3('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x32a3('0x3'));var attributes=require(_0x32a3('0x4'));module['exports']=function(_0x43b7ce,_0x199164){return _0x43b7ce['define'](_0x32a3('0x5'),attributes,{'tableName':_0x32a3('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x32a3('0x7'),_0x32a3('0x8')]},{'unique':!![],'name':_0x32a3('0x9'),'fields':[_0x32a3('0x7'),_0x32a3('0xa')]},{'unique':!![],'name':_0x32a3('0xb'),'fields':[_0x32a3('0x7'),_0x32a3('0xc')]},{'unique':!![],'name':_0x32a3('0xd'),'fields':[_0x32a3('0x7'),'SmsAccountId']},{'unique':!![],'name':_0x32a3('0xe'),'fields':[_0x32a3('0x7'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x32a3('0x7'),'OpenchannelAccountId']},{'unique':!![],'name':_0x32a3('0xf'),'fields':[_0x32a3('0x7'),_0x32a3('0x10')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 318953b..3fff1e8 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(_0x1c3834,_0x4eeab1){var _0x4cd7c7=function(_0x3b36fe){while(--_0x3b36fe){_0x1c3834['push'](_0x1c3834['shift']());}};_0x4cd7c7(++_0x4eeab1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x56af45,_0x3f4589){var _0x5125f9=function(_0x4f13f6){while(--_0x4f13f6){_0x56af45['push'](_0x56af45['shift']());}};_0x5125f9(++_0x3f4589);}(_0xa9e0,0x123));var _0x0a9e=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'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 0ce0d1d..97a0135 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 _0x274b=['post','create','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show'];(function(_0x449339,_0x4c6fdc){var _0x41bf1f=function(_0x100ba9){while(--_0x100ba9){_0x449339['push'](_0x449339['shift']());}};_0x41bf1f(++_0x4c6fdc);}(_0x274b,0x102));var _0xb274=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x274b[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0xb274('0x0'));var util=require(_0xb274('0x1'));var path=require(_0xb274('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb274('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb274('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb274('0x5'));var controller=require(_0xb274('0x6'));router[_0xb274('0x7')]('/',auth[_0xb274('0x8')](),controller[_0xb274('0x9')]);router[_0xb274('0x7')](_0xb274('0xa'),auth[_0xb274('0x8')](),controller[_0xb274('0xb')]);router[_0xb274('0xc')]('/',auth[_0xb274('0x8')](),controller[_0xb274('0xd')]);router[_0xb274('0xe')](_0xb274('0xa'),auth[_0xb274('0x8')](),controller[_0xb274('0xf')]);router[_0xb274('0x10')](_0xb274('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xb274('0x11')]=router; \ No newline at end of file +var _0xe2da=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2da,0x114));var _0xae2d=function(_0x3b3d39,_0x55444d){_0x3b3d39=_0x3b3d39-0x0;var _0x512a54=_0xe2da[_0x3b3d39];return _0x512a54;};'use strict';var multer=require(_0xae2d('0x0'));var util=require(_0xae2d('0x1'));var path=require('path');var timeout=require(_0xae2d('0x2'));var express=require(_0xae2d('0x3'));var router=express[_0xae2d('0x4')]();var fs_extra=require(_0xae2d('0x5'));var auth=require(_0xae2d('0x6'));var interaction=require(_0xae2d('0x7'));var config=require(_0xae2d('0x8'));var controller=require('./disposition.controller');router[_0xae2d('0x9')]('/',auth[_0xae2d('0xa')](),controller[_0xae2d('0xb')]);router['get'](_0xae2d('0xc'),auth[_0xae2d('0xa')](),controller[_0xae2d('0xd')]);router['post']('/',auth[_0xae2d('0xa')](),controller[_0xae2d('0xe')]);router[_0xae2d('0xf')](_0xae2d('0xc'),auth[_0xae2d('0xa')](),controller[_0xae2d('0x10')]);router[_0xae2d('0x11')](_0xae2d('0xc'),auth['isAuthenticated'](),controller[_0xae2d('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index c426bad..0224767 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 _0x11e5=['9600','12000','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','STRING','yes','2400','4800','7200','14400','ENUM'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0x11e5,0x8b));var _0x511e=function(_0x3bb5b4,_0x128455){_0x3bb5b4=_0x3bb5b4-0x0;var _0x586c60=_0x11e5[_0x3bb5b4];return _0x586c60;};'use strict';var Sequelize=require(_0x511e('0x0'));module['exports']={'name':{'type':Sequelize[_0x511e('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x511e('0x1')]},'ecm':{'type':Sequelize['ENUM'](_0x511e('0x2'),'no'),'defaultValue':_0x511e('0x2')},'headerinfo':{'type':Sequelize[_0x511e('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x511e('0x1')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM'](_0x511e('0x3'),_0x511e('0x4'),_0x511e('0x5'),'9600','12000',_0x511e('0x6')),'defaultValue':_0x511e('0x4')},'maxrate':{'type':Sequelize[_0x511e('0x7')](_0x511e('0x3'),_0x511e('0x4'),_0x511e('0x5'),_0x511e('0x8'),_0x511e('0x9'),_0x511e('0x6')),'defaultValue':_0x511e('0x6')},'modem':{'type':Sequelize[_0x511e('0x1')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x511e('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x511e('0x7')](_0x511e('0xa'),_0x511e('0xb'),_0x511e('0xc'),_0x511e('0xd')),'defaultValue':_0x511e('0xa')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x511e('0xe')],'defaultValue':function(){return _0x511e('0xf');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x511e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x511e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x511e('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x511e('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x511e('0x10')],'defaultValue':![],'comment':_0x511e('0x13'),'set':function(_0x577616){if(!_0x577616)this[_0x511e('0x14')]('mandatoryDispositionPauseId',null);this[_0x511e('0x14')]('mandatoryDisposition',_0x577616);}}}; \ No newline at end of file +var _0x8b8e=['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','mandatoryDispositionPauseId','setDataValue','sequelize','STRING','ENUM','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','v17,v27,v29','INTEGER'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x8b8e,0x108));var _0xe8b8=function(_0x2e9a72,_0x4c0f87){_0x2e9a72=_0x2e9a72-0x0;var _0x1f0b98=_0x8b8e[_0x2e9a72];return _0x1f0b98;};'use strict';var Sequelize=require(_0xe8b8('0x0'));module['exports']={'name':{'type':Sequelize[_0xe8b8('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0xe8b8('0x2')]('yes','no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0xe8b8('0x1')],'defaultValue':_0xe8b8('0x3')},'localstationid':{'type':Sequelize[_0xe8b8('0x1')],'unique':_0xe8b8('0x4')},'minrate':{'type':Sequelize[_0xe8b8('0x2')](_0xe8b8('0x5'),_0xe8b8('0x6'),_0xe8b8('0x7'),_0xe8b8('0x8'),_0xe8b8('0x9'),'14400'),'defaultValue':_0xe8b8('0x6')},'maxrate':{'type':Sequelize['ENUM'](_0xe8b8('0x5'),'4800','7200',_0xe8b8('0x8'),_0xe8b8('0x9'),'14400'),'defaultValue':'14400'},'modem':{'type':Sequelize[_0xe8b8('0x1')],'defaultValue':_0xe8b8('0xa')},'gateway':{'type':Sequelize[_0xe8b8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xe8b8('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xe8b8('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xe8b8('0x2')](_0xe8b8('0xc'),_0xe8b8('0xd'),_0xe8b8('0xe'),_0xe8b8('0xf')),'defaultValue':_0xe8b8('0xc')},'key':{'type':Sequelize[_0xe8b8('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe8b8('0x10')],'defaultValue':function(){return _0xe8b8('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe8b8('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe8b8('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xe8b8('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe8b8('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe8b8('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe8b8('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe8b8('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0xe8b8('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xe8b8('0x12')],'defaultValue':![],'comment':_0xe8b8('0x14'),'set':function(_0x3a1329){if(!_0x3a1329)this['setDataValue'](_0xe8b8('0x15'),null);this[_0xe8b8('0x16')]('mandatoryDisposition',_0x3a1329);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bb338cc..1e14832 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 _0xc6df=['client','http','request','then','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','undefined','limit','offset','count','set','apply','reject','save','update','destroy','get','FaxAccounts','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','Pause','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','FaxAccountId','Disposition','findOne','nolimit','findAll','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','transaction','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','context','from-voip-provider','exten','localstationid','app','system','description','appdata','push','Answer','CDR(type)=inbound-fax','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','updateAccountApplications','tech','updatedAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','DESC','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','spread','out','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','jayson/promise'];(function(_0x3d891a,_0x14aa28){var _0x2bcf32=function(_0x51e25d){while(--_0x51e25d){_0x3d891a['push'](_0x3d891a['shift']());}};_0x2bcf32(++_0x14aa28);}(_0xc6df,0xac));var _0xfc6d=function(_0x4ffe7d,_0x386818){_0x4ffe7d=_0x4ffe7d-0x0;var _0x365ef9=_0xc6df[_0x4ffe7d];return _0x365ef9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc6d('0x0'));var zipdir=require(_0xfc6d('0x1'));var jsonpatch=require(_0xfc6d('0x2'));var rp=require(_0xfc6d('0x3'));var moment=require(_0xfc6d('0x4'));var BPromise=require(_0xfc6d('0x5'));var Mustache=require(_0xfc6d('0x6'));var util=require(_0xfc6d('0x7'));var path=require(_0xfc6d('0x8'));var sox=require(_0xfc6d('0x9'));var csv=require(_0xfc6d('0xa'));var ejs=require(_0xfc6d('0xb'));var fs=require('fs');var fs_extra=require(_0xfc6d('0xc'));var _=require(_0xfc6d('0xd'));var squel=require(_0xfc6d('0xe'));var crypto=require(_0xfc6d('0xf'));var jsforce=require(_0xfc6d('0x10'));var deskjs=require(_0xfc6d('0x11'));var toCsv=require('to-csv');var querystring=require(_0xfc6d('0x12'));var Papa=require('papaparse');var Redis=require(_0xfc6d('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xfc6d('0x14'));var as=require(_0xfc6d('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xfc6d('0x16'));var licenseUtil=require(_0xfc6d('0x17'));var db=require('../../mysqldb')['db'];config[_0xfc6d('0x18')]=_[_0xfc6d('0x19')](config[_0xfc6d('0x18')],{'host':_0xfc6d('0x1a'),'port':0x18eb});var socket=require(_0xfc6d('0x1b'))(new Redis(config[_0xfc6d('0x18')]));require('./faxAccount.socket')[_0xfc6d('0x1c')](socket);var jayson=require(_0xfc6d('0x1d'));var client=jayson[_0xfc6d('0x1e')][_0xfc6d('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xfc6d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3628b1,_0x46c14b,_0x212f6e,_0x1c5828){return new BPromise(function(_0x3a7e49,_0x4508c5){var _0x38f71f=_0x1c5828||client;return _0x38f71f[_0xfc6d('0x20')](_0x3628b1,_0x212f6e)[_0xfc6d('0x21')](function(_0x2144e7){logger['info'](_0xfc6d('0x22'),_0x46c14b,_0xfc6d('0x23'));logger[_0xfc6d('0x24')](_0xfc6d('0x25'),_0x46c14b,'request\x20sent',JSON[_0xfc6d('0x26')](_0x2144e7));if(_0x2144e7[_0xfc6d('0x27')]){if(_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x28')]===0x1f4){logger[_0xfc6d('0x27')](_0xfc6d('0x22'),_0x46c14b,_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);return _0x4508c5(_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);}logger[_0xfc6d('0x27')](_0xfc6d('0x22'),_0x46c14b,_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);return _0x3a7e49(_0x2144e7[_0xfc6d('0x27')][_0xfc6d('0x29')]);}else{logger[_0xfc6d('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x46c14b,_0xfc6d('0x23'));_0x3a7e49(_0x2144e7[_0xfc6d('0x2b')][_0xfc6d('0x29')]);}})['catch'](function(_0x3d7feb){logger[_0xfc6d('0x27')](_0xfc6d('0x22'),_0x46c14b,_0x3d7feb);_0x4508c5(_0x3d7feb);});});}function respondWithStatusCode(_0x27c10e,_0x126d93){_0x126d93=_0x126d93||0xcc;return function(_0x237050){if(_0x237050){return _0x27c10e[_0xfc6d('0x2c')](_0x126d93);}return _0x27c10e[_0xfc6d('0x2d')](_0x126d93)[_0xfc6d('0x2e')]();};}function respondWithResult(_0x2caf1d,_0x599ef8){_0x599ef8=_0x599ef8||0xc8;return function(_0x2f0240){if(_0x2f0240){return _0x2caf1d['status'](_0x599ef8)[_0xfc6d('0x2f')](_0x2f0240);}};}function respondWithFilteredResult(_0x1b4c37,_0x28d0e6){return function(_0x2b47f3){if(_0x2b47f3){var _0x5ee70a=typeof _0x28d0e6['offset']===_0xfc6d('0x30')&&typeof _0x28d0e6[_0xfc6d('0x31')]===_0xfc6d('0x30');var _0x4c1ca5=_0x2b47f3['count'];var _0x40efa4=_0x5ee70a?0x0:_0x28d0e6[_0xfc6d('0x32')];var _0x134bee=_0x5ee70a?_0x2b47f3[_0xfc6d('0x33')]:_0x28d0e6[_0xfc6d('0x32')]+_0x28d0e6[_0xfc6d('0x31')];var _0x541e55;if(_0x134bee>=_0x4c1ca5){_0x134bee=_0x4c1ca5;_0x541e55=0xc8;}else{_0x541e55=0xce;}_0x1b4c37[_0xfc6d('0x2d')](_0x541e55);return _0x1b4c37[_0xfc6d('0x34')]('Content-Range',_0x40efa4+'-'+_0x134bee+'/'+_0x4c1ca5)[_0xfc6d('0x2f')](_0x2b47f3);}return null;};}function patchUpdates(_0xfcc062){return function(_0x4ed3ec){try{jsonpatch[_0xfc6d('0x35')](_0x4ed3ec,_0xfcc062,!![]);}catch(_0x391d07){return BPromise[_0xfc6d('0x36')](_0x391d07);}return _0x4ed3ec[_0xfc6d('0x37')]();};}function saveUpdates(_0x1a975c,_0x4e4d0f){return function(_0x2ffec5){if(_0x2ffec5){return _0x2ffec5[_0xfc6d('0x38')](_0x1a975c)[_0xfc6d('0x21')](function(_0x19c9fa){return _0x19c9fa;});}return null;};}function removeEntity(_0x1e7227,_0x44a46a){return function(_0x27fa6f){if(_0x27fa6f){return _0x27fa6f[_0xfc6d('0x39')]()[_0xfc6d('0x21')](function(){var _0x5094c8=_0x27fa6f[_0xfc6d('0x3a')]({'plain':!![]});var _0x337510=_0xfc6d('0x3b');return db['UserProfileResource'][_0xfc6d('0x39')]({'where':{'type':_0x337510,'resourceId':_0x5094c8['id']}})[_0xfc6d('0x21')](function(){return _0x27fa6f;});})[_0xfc6d('0x21')](function(){_0x1e7227['status'](0xcc)[_0xfc6d('0x2e')]();});}};}function handleEntityNotFound(_0x7a19a1,_0x492f80){return function(_0x5dc5cb){if(!_0x5dc5cb){_0x7a19a1[_0xfc6d('0x2c')](0x194);}return _0x5dc5cb;};}function handleError(_0x2342f2,_0x21171a){_0x21171a=_0x21171a||0x1f4;return function(_0x8e119c){logger[_0xfc6d('0x27')](_0x8e119c[_0xfc6d('0x3c')]);if(_0x8e119c[_0xfc6d('0x3d')]){delete _0x8e119c['name'];}_0x2342f2[_0xfc6d('0x2d')](_0x21171a)[_0xfc6d('0x3e')](_0x8e119c);};}exports[_0xfc6d('0x3f')]=function(_0x50cf6b,_0x1f8186){var _0x58ecc2={'include':[{'model':db['Pause'],'as':_0xfc6d('0x40')}]},_0x160e1a={},_0x2f38a6={'count':0x0,'rows':[]};var _0x1b7292=_[_0xfc6d('0x41')](db[_0xfc6d('0x42')]['rawAttributes'],function(_0x409ea2){return{'name':_0x409ea2['fieldName'],'type':_0x409ea2[_0xfc6d('0x43')][_0xfc6d('0x44')]};});_0x160e1a['model']=_[_0xfc6d('0x41')](_0x1b7292,'name');_0x160e1a[_0xfc6d('0x45')]=_['keys'](_0x50cf6b[_0xfc6d('0x45')]);_0x160e1a[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x160e1a[_0xfc6d('0x48')],_0x160e1a[_0xfc6d('0x45')]);_0x58ecc2[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x160e1a[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x58ecc2[_0xfc6d('0x49')]=_0x58ecc2[_0xfc6d('0x49')]['length']?_0x58ecc2[_0xfc6d('0x49')]:_0x160e1a[_0xfc6d('0x48')];if(!_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x4b')]('nolimit')){_0x58ecc2['limit']=qs[_0xfc6d('0x31')](_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x31')]);_0x58ecc2[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x50cf6b[_0xfc6d('0x45')]['offset']);}_0x58ecc2[_0xfc6d('0x4c')]=qs[_0xfc6d('0x4d')](_0x50cf6b['query']['sort']);_0x58ecc2[_0xfc6d('0x4e')]=qs['filters'](_[_0xfc6d('0x4f')](_0x50cf6b['query'],_0x160e1a[_0xfc6d('0x46')]),_0x1b7292);if(_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x58ecc2[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x58ecc2[_0xfc6d('0x4e')],{'$or':_[_0xfc6d('0x41')](_0x1b7292,function(_0x2ef746){if(_0x2ef746[_0xfc6d('0x43')]!=='VIRTUAL'){var _0x52ed70={};_0x52ed70[_0x2ef746['name']]={'$like':'%'+_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x52ed70;}})});}_0x58ecc2=_['merge']({},_0x58ecc2,_0x50cf6b[_0xfc6d('0x52')]);var _0x444493={'where':_0x58ecc2[_0xfc6d('0x4e')]};return db['FaxAccount']['count'](_0x444493)[_0xfc6d('0x21')](function(_0x2e6eb3){_0x2f38a6[_0xfc6d('0x33')]=_0x2e6eb3;if(_0x50cf6b[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x58ecc2[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0x42')]['findAll'](_0x58ecc2);})[_0xfc6d('0x21')](function(_0x12bd6c){_0x2f38a6[_0xfc6d('0x55')]=_0x12bd6c;return _0x2f38a6;})[_0xfc6d('0x21')](respondWithFilteredResult(_0x1f8186,_0x58ecc2))[_0xfc6d('0x56')](handleError(_0x1f8186,null));};exports[_0xfc6d('0x57')]=function(_0x484e2c,_0x502f9b){var _0x2ca6cd={'raw':![],'where':{'id':_0x484e2c['params']['id']},'include':[{'model':db[_0xfc6d('0x58')],'as':_0xfc6d('0x40')}]},_0x171c1c={};_0x171c1c[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x42')][_0xfc6d('0x5a')]);_0x171c1c[_0xfc6d('0x45')]=_['keys'](_0x484e2c[_0xfc6d('0x45')]);_0x171c1c[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x171c1c['model'],_0x171c1c[_0xfc6d('0x45')]);_0x2ca6cd['attributes']=_[_0xfc6d('0x47')](_0x171c1c[_0xfc6d('0x48')],qs['fields'](_0x484e2c[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x2ca6cd['attributes']=_0x2ca6cd['attributes'][_0xfc6d('0x5b')]?_0x2ca6cd[_0xfc6d('0x49')]:_0x171c1c[_0xfc6d('0x48')];if(_0x484e2c[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x2ca6cd['include']=[{'all':!![]}];}_0x2ca6cd=_[_0xfc6d('0x51')]({},_0x2ca6cd,_0x484e2c[_0xfc6d('0x52')]);return db[_0xfc6d('0x42')][_0xfc6d('0x5c')](_0x2ca6cd)[_0xfc6d('0x21')](handleEntityNotFound(_0x502f9b,null))[_0xfc6d('0x21')](respondWithResult(_0x502f9b,null))['catch'](handleError(_0x502f9b,null));};exports['create']=function(_0x1361c9,_0x3583af){return db[_0xfc6d('0x42')][_0xfc6d('0x5d')](_0x1361c9[_0xfc6d('0x5e')],{})[_0xfc6d('0x21')](function(_0x5df870){var _0x5aa159=_0x1361c9[_0xfc6d('0x5f')][_0xfc6d('0x3a')]({'plain':!![]});if(!_0x5aa159)throw new Error(_0xfc6d('0x60'));if(_0x5aa159[_0xfc6d('0x61')]===_0xfc6d('0x5f')){var _0xbb4264=_0x5df870[_0xfc6d('0x3a')]({'plain':!![]});var _0x1d4ff9='FaxAccounts';return db[_0xfc6d('0x62')][_0xfc6d('0x5c')]({'where':{'name':_0x1d4ff9,'userProfileId':_0x5aa159[_0xfc6d('0x63')]},'raw':!![]})['then'](function(_0x3642e8){if(_0x3642e8&&_0x3642e8[_0xfc6d('0x64')]===0x0){return db['UserProfileResource'][_0xfc6d('0x5d')]({'name':_0xbb4264[_0xfc6d('0x3d')],'resourceId':_0xbb4264['id'],'type':_0x3642e8[_0xfc6d('0x3d')],'sectionId':_0x3642e8['id']},{})[_0xfc6d('0x21')](function(){return _0x5df870;});}else{return _0x5df870;}})[_0xfc6d('0x56')](function(_0x25431b){logger['error'](_0xfc6d('0x65'),_0x25431b);throw _0x25431b;});}return _0x5df870;})['then'](respondWithResult(_0x3583af,0xc9))[_0xfc6d('0x56')](handleError(_0x3583af,null));};exports[_0xfc6d('0x38')]=function(_0x1a0534,_0x381a1){if(_0x1a0534[_0xfc6d('0x5e')]['id']){delete _0x1a0534[_0xfc6d('0x5e')]['id'];}return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x1a0534['params']['id']},'include':[{'model':db[_0xfc6d('0x58')],'as':_0xfc6d('0x40')}]})[_0xfc6d('0x21')](handleEntityNotFound(_0x381a1,null))[_0xfc6d('0x21')](saveUpdates(_0x1a0534[_0xfc6d('0x5e')],null))[_0xfc6d('0x21')](respondWithResult(_0x381a1,null))['catch'](handleError(_0x381a1,null));};exports[_0xfc6d('0x39')]=function(_0x425c69,_0x208cce){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x425c69[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x208cce,null))[_0xfc6d('0x21')](removeEntity(_0x208cce,null))[_0xfc6d('0x56')](handleError(_0x208cce,null));};exports[_0xfc6d('0x67')]=function(_0x32367e,_0x5d7591){return db[_0xfc6d('0x42')][_0xfc6d('0x67')]()[_0xfc6d('0x21')](respondWithResult(_0x5d7591,null))['catch'](handleError(_0x5d7591,null));};exports[_0xfc6d('0x68')]=function(_0x471cad,_0x29081a,_0x457342){if(_0x471cad['body']['id']){delete _0x471cad[_0xfc6d('0x5e')]['id'];}return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x471cad[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x29081a,null))[_0xfc6d('0x21')](function(_0x4cce2f){if(_0x4cce2f){_0x471cad[_0xfc6d('0x5e')][_0xfc6d('0x69')]=_0x4cce2f['id'];return db[_0xfc6d('0x6a')][_0xfc6d('0x5d')](_0x471cad[_0xfc6d('0x5e')]);}})[_0xfc6d('0x21')](respondWithResult(_0x29081a,null))[_0xfc6d('0x56')](handleError(_0x29081a,null));};exports['getDispositions']=function(_0xdea8a0,_0x185031,_0x29e855){var _0x2e976d={'raw':![],'where':{}};var _0x3825c8={};var _0x176272={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0xdea8a0[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x185031,null))[_0xfc6d('0x21')](function(_0x773dd7){if(_0x773dd7){_0x3825c8[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x6a')][_0xfc6d('0x5a')]);_0x3825c8[_0xfc6d('0x45')]=_['keys'](_0xdea8a0['query']);_0x3825c8[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x3825c8[_0xfc6d('0x48')],_0x3825c8[_0xfc6d('0x45')]);_0x2e976d['attributes']=_[_0xfc6d('0x47')](_0x3825c8[_0xfc6d('0x48')],qs['fields'](_0xdea8a0['query'][_0xfc6d('0x4a')]));_0x2e976d[_0xfc6d('0x49')]=_0x2e976d[_0xfc6d('0x49')][_0xfc6d('0x5b')]?_0x2e976d[_0xfc6d('0x49')]:_0x3825c8[_0xfc6d('0x48')];if(!_0xdea8a0[_0xfc6d('0x45')]['hasOwnProperty'](_0xfc6d('0x6c'))){_0x2e976d[_0xfc6d('0x31')]=qs['limit'](_0xdea8a0['query'][_0xfc6d('0x31')]);_0x2e976d[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x32')]);}_0x2e976d['order']=qs['sort'](_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x2e976d[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_[_0xfc6d('0x4f')](_0xdea8a0[_0xfc6d('0x45')],_0x3825c8['filters']));_0x2e976d[_0xfc6d('0x4e')]['FaxAccountId']=_0x773dd7['id'];if(_0xdea8a0[_0xfc6d('0x45')]['filter']){_0x2e976d[_0xfc6d('0x4e')]=_['merge'](_0x2e976d[_0xfc6d('0x4e')],{'$or':_['map'](_0x2e976d[_0xfc6d('0x49')],function(_0x2bb96a){var _0x4376a6={};_0x4376a6[_0x2bb96a]={'$like':'%'+_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x4376a6;})});}_0x2e976d=_['merge']({},_0x2e976d,_0xdea8a0[_0xfc6d('0x52')]);return db[_0xfc6d('0x6a')][_0xfc6d('0x33')]({'where':_0x2e976d['where']})[_0xfc6d('0x21')](function(_0xbdf1c2){_0x176272[_0xfc6d('0x33')]=_0xbdf1c2;if(_0xdea8a0[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x2e976d[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0x6a')][_0xfc6d('0x6d')](_0x2e976d);})[_0xfc6d('0x21')](function(_0x88b704){_0x176272['rows']=_0x88b704;return _0x176272;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x185031,_0x2e976d))['catch'](handleError(_0x185031,null));};exports[_0xfc6d('0x6e')]=function(_0xdd3699,_0x3bfc41,_0x17f86d){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0xdd3699[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x3bfc41,null))[_0xfc6d('0x21')](function(_0x2544b9){if(_0x2544b9){return _0x2544b9[_0xfc6d('0x6e')](_0xdd3699['query'][_0xfc6d('0x6f')]);}})[_0xfc6d('0x21')](respondWithStatusCode(_0x3bfc41,null))[_0xfc6d('0x56')](handleError(_0x3bfc41,null));};exports['addAnswer']=function(_0x51f8ce,_0x334529,_0x456e43){if(_0x51f8ce[_0xfc6d('0x5e')]['id']){delete _0x51f8ce[_0xfc6d('0x5e')]['id'];}return db[_0xfc6d('0x42')]['find']({'where':{'id':_0x51f8ce[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x334529,null))[_0xfc6d('0x21')](function(_0x56d95c){if(_0x56d95c){_0x51f8ce[_0xfc6d('0x5e')][_0xfc6d('0x69')]=_0x56d95c['id'];return db['CannedAnswer'][_0xfc6d('0x5d')](_0x51f8ce[_0xfc6d('0x5e')]);}})['then'](respondWithResult(_0x334529,null))[_0xfc6d('0x56')](handleError(_0x334529,null));};exports[_0xfc6d('0x70')]=function(_0x6c99ed,_0x144b3a,_0x4c232d){var _0x539728={'raw':![],'where':{}};var _0x226bc0={};var _0x1b6dce={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')]['findOne']({'where':{'id':_0x6c99ed[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x144b3a,null))['then'](function(_0x3be5c4){if(_0x3be5c4){_0x226bc0[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x71')]['rawAttributes']);_0x226bc0[_0xfc6d('0x45')]=_[_0xfc6d('0x59')](_0x6c99ed[_0xfc6d('0x45')]);_0x226bc0['filters']=_[_0xfc6d('0x47')](_0x226bc0[_0xfc6d('0x48')],_0x226bc0[_0xfc6d('0x45')]);_0x539728[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x226bc0['model'],qs['fields'](_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x539728[_0xfc6d('0x49')]=_0x539728[_0xfc6d('0x49')]['length']?_0x539728[_0xfc6d('0x49')]:_0x226bc0[_0xfc6d('0x48')];if(!_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0x539728[_0xfc6d('0x31')]=qs['limit'](_0x6c99ed['query']['limit']);_0x539728[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x32')]);}_0x539728['order']=qs[_0xfc6d('0x4d')](_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x539728[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_['pick'](_0x6c99ed[_0xfc6d('0x45')],_0x226bc0[_0xfc6d('0x46')]));_0x539728[_0xfc6d('0x4e')][_0xfc6d('0x69')]=_0x3be5c4['id'];if(_0x6c99ed[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x539728[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x539728['where'],{'$or':_[_0xfc6d('0x41')](_0x539728['attributes'],function(_0x2adef2){var _0x2a6779={};_0x2a6779[_0x2adef2]={'$like':'%'+_0x6c99ed['query']['filter']+'%'};return _0x2a6779;})});}_0x539728=_[_0xfc6d('0x51')]({},_0x539728,_0x6c99ed[_0xfc6d('0x52')]);return db[_0xfc6d('0x71')][_0xfc6d('0x33')]({'where':_0x539728[_0xfc6d('0x4e')]})['then'](function(_0x1b0a2f){_0x1b6dce['count']=_0x1b0a2f;if(_0x6c99ed['query'][_0xfc6d('0x53')]){_0x539728[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0x71')]['findAll'](_0x539728);})[_0xfc6d('0x21')](function(_0x528509){_0x1b6dce[_0xfc6d('0x55')]=_0x528509;return _0x1b6dce;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x144b3a,_0x539728))[_0xfc6d('0x56')](handleError(_0x144b3a,null));};exports[_0xfc6d('0x72')]=function(_0x1395ea,_0x463e6e,_0x5d5e84){return db[_0xfc6d('0x42')]['find']({'where':{'id':_0x1395ea[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x463e6e,null))[_0xfc6d('0x21')](function(_0x2e0e3f){if(_0x2e0e3f){return _0x2e0e3f[_0xfc6d('0x72')](_0x1395ea[_0xfc6d('0x45')][_0xfc6d('0x6f')]);}})[_0xfc6d('0x21')](respondWithStatusCode(_0x463e6e,null))[_0xfc6d('0x56')](handleError(_0x463e6e,null));};exports[_0xfc6d('0x73')]=function(_0x1225b6,_0x1fdf2a,_0x214f0a){return db[_0xfc6d('0x74')][_0xfc6d('0x5c')]({'where':{'id':_0x1225b6[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x1fdf2a,null))['then'](function(_0x615bf){if(_0x615bf){return _0x615bf[_0xfc6d('0x73')](_0x1225b6[_0xfc6d('0x5e')][_0xfc6d('0x6f')],_[_0xfc6d('0x75')](_0x1225b6[_0xfc6d('0x5e')],[_0xfc6d('0x6f'),'id'])||{});}})['then'](respondWithResult(_0x1fdf2a,null))[_0xfc6d('0x56')](handleError(_0x1fdf2a,null));};exports[_0xfc6d('0x76')]=function(_0x6941aa,_0x24c9b3,_0x19c335){var _0x1d959d={'raw':![],'where':{}};var _0x2264e6={};var _0x26340f={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0x6941aa[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x24c9b3,null))[_0xfc6d('0x21')](function(_0x2fe4c9){if(_0x2fe4c9){_0x2264e6[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db['FaxInteraction'][_0xfc6d('0x5a')]);_0x2264e6[_0xfc6d('0x45')]=_['keys'](_0x6941aa[_0xfc6d('0x45')]);_0x2264e6[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x2264e6[_0xfc6d('0x48')],_0x2264e6['query']);_0x1d959d[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x2264e6[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x1d959d[_0xfc6d('0x49')]=_0x1d959d[_0xfc6d('0x49')][_0xfc6d('0x5b')]?_0x1d959d[_0xfc6d('0x49')]:_0x2264e6['model'];if(!_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x4b')]('nolimit')){_0x1d959d[_0xfc6d('0x31')]=qs[_0xfc6d('0x31')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x31')]);_0x1d959d['offset']=qs[_0xfc6d('0x32')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x32')]);}_0x1d959d[_0xfc6d('0x4c')]=qs[_0xfc6d('0x4d')](_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x1d959d[_0xfc6d('0x4e')]=qs['filters'](_[_0xfc6d('0x4f')](_0x6941aa[_0xfc6d('0x45')],_0x2264e6[_0xfc6d('0x46')]));_0x1d959d[_0xfc6d('0x4e')][_0xfc6d('0x69')]=_0x2fe4c9['id'];if(_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x1d959d[_0xfc6d('0x4e')]=_['merge'](_0x1d959d[_0xfc6d('0x4e')],{'$or':_['map'](_0x1d959d['attributes'],function(_0x4e94cf){var _0x1874d8={};_0x1874d8[_0x4e94cf]={'$like':'%'+_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x1874d8;})});}_0x1d959d=_[_0xfc6d('0x51')]({},_0x1d959d,_0x6941aa['options']);return db[_0xfc6d('0x74')][_0xfc6d('0x33')]({'where':_0x1d959d[_0xfc6d('0x4e')]})[_0xfc6d('0x21')](function(_0x1aa5ec){_0x26340f[_0xfc6d('0x33')]=_0x1aa5ec;if(_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x1d959d['include']=[{'model':db[_0xfc6d('0x77')],'as':_0xfc6d('0x78'),'required':![]},{'model':db[_0xfc6d('0x79')],'as':_0xfc6d('0x7a'),'attributes':[_0xfc6d('0x3d'),_0xfc6d('0x7b'),'internal'],'required':![]},{'model':db[_0xfc6d('0x7c')],'as':_0xfc6d('0x7d'),'attributes':['id','name',_0xfc6d('0x7e')],'where':_0x6941aa[_0xfc6d('0x45')]['tag']?{'id':_0x6941aa[_0xfc6d('0x45')][_0xfc6d('0x7f')]}:undefined,'required':_0x6941aa[_0xfc6d('0x45')]['tag']?!![]:![]}];}return db['FaxInteraction'][_0xfc6d('0x6d')](_0x1d959d);})[_0xfc6d('0x21')](function(_0x4a387b){_0x26340f[_0xfc6d('0x55')]=_0x4a387b;return _0x26340f;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x24c9b3,_0x1d959d))[_0xfc6d('0x56')](handleError(_0x24c9b3,null));};exports['addApplications']=function(_0x25b149,_0x1d32d1){var _0x5346b3=_0x25b149[_0xfc6d('0x66')]['id'];var _0x3e2268=_0x25b149[_0xfc6d('0x5e')];var _0x36d013=0xc8;var _0x18b5f5=null;return db['sequelize'][_0xfc6d('0x80')]({'isolationLevel':db[_0xfc6d('0x81')][_0xfc6d('0x82')]['ISOLATION_LEVELS'][_0xfc6d('0x83')]},function(_0x49814e){return db[_0xfc6d('0x42')]['findOne']({'where':{'id':_0x5346b3},'transaction':_0x49814e})[_0xfc6d('0x21')](function(_0x39d093){if(_0x39d093){return db[_0xfc6d('0x84')][_0xfc6d('0x39')]({'where':{'FaxAccountId':_0x5346b3},'transaction':_0x49814e})['then'](function(){var _0x113a88=_['map'](_0x3e2268,function(_0x2bf969){_0x2bf969[_0xfc6d('0x69')]=_0x5346b3;return _0x2bf969;});return db['FaxApplication'][_0xfc6d('0x85')](_0x113a88,{'transaction':_0x49814e});});}else{_0x36d013=0x194;_0x18b5f5=[];}});})[_0xfc6d('0x21')](function(){if(_0x36d013!==0x194){return db[_0xfc6d('0x84')][_0xfc6d('0x86')]({'where':{'FaxAccountId':_0x5346b3},'order':_0xfc6d('0x87')})['then'](function(_0x58f826){_0x18b5f5=_0x58f826;});}})[_0xfc6d('0x56')](function(_0x4bf00d){_0x36d013=0x1f4;logger[_0xfc6d('0x27')](_0x4bf00d[_0xfc6d('0x3c')]);if(_0x4bf00d[_0xfc6d('0x3d')]){delete _0x4bf00d[_0xfc6d('0x3d')];}_0x18b5f5=_0x4bf00d;})[_0xfc6d('0x88')](function(){if(_0x18b5f5===null){_0x1d32d1[_0xfc6d('0x2c')](_0x36d013);}else{if(_0x36d013===0x1f4){_0x1d32d1[_0xfc6d('0x2d')](_0x36d013)['send'](_0x18b5f5);}else{_0x1d32d1[_0xfc6d('0x2d')](_0x36d013)[_0xfc6d('0x2f')](_0x18b5f5);}}});};exports[_0xfc6d('0x89')]=function(_0x4150eb,_0x2b329f,_0x2ddd4b){var _0x52928f={};var _0x9535f7={};var _0x50a9ab;var _0x503a9f;return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0x4150eb[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x2b329f,null))[_0xfc6d('0x21')](function(_0xca5663){if(_0xca5663){_0x50a9ab=_0xca5663;_0x9535f7[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x84')][_0xfc6d('0x5a')]);_0x9535f7['query']=_[_0xfc6d('0x59')](_0x4150eb[_0xfc6d('0x45')]);_0x9535f7['filters']=_[_0xfc6d('0x47')](_0x9535f7['model'],_0x9535f7[_0xfc6d('0x45')]);_0x52928f[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x9535f7[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0x52928f[_0xfc6d('0x49')]=_0x52928f[_0xfc6d('0x49')]['length']?_0x52928f[_0xfc6d('0x49')]:_0x9535f7[_0xfc6d('0x48')];_0x52928f[_0xfc6d('0x4c')]=qs['sort'](_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x4d')]);_0x52928f[_0xfc6d('0x4e')]=qs['filters'](_[_0xfc6d('0x4f')](_0x4150eb[_0xfc6d('0x45')],_0x9535f7[_0xfc6d('0x46')]));if(_0x4150eb[_0xfc6d('0x45')]['filter']){_0x52928f[_0xfc6d('0x4e')]=_['merge'](_0x52928f['where'],{'$or':_[_0xfc6d('0x41')](_0x52928f[_0xfc6d('0x49')],function(_0x2d9f2b){var _0x10fb06={};_0x10fb06[_0x2d9f2b]={'$like':'%'+_0x4150eb[_0xfc6d('0x45')]['filter']+'%'};return _0x10fb06;})});}_0x52928f=_['merge']({},_0x52928f,_0x4150eb[_0xfc6d('0x52')]);return _0x50a9ab[_0xfc6d('0x89')](_0x52928f);}})['then'](function(_0x4f48fb){if(_0x4f48fb){_0x503a9f=_0x4f48fb[_0xfc6d('0x5b')];if(!_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0x52928f[_0xfc6d('0x31')]=qs[_0xfc6d('0x31')](_0x4150eb[_0xfc6d('0x45')][_0xfc6d('0x31')]);_0x52928f[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x4150eb['query']['offset']);}return _0x50a9ab[_0xfc6d('0x89')](_0x52928f);}})[_0xfc6d('0x21')](function(_0x347d97){if(_0x347d97){return _0x347d97?{'count':_0x503a9f,'rows':_0x347d97}:null;}})[_0xfc6d('0x21')](respondWithResult(_0x2b329f,null))[_0xfc6d('0x56')](handleError(_0x2b329f,null));};function Extension(_0x58396c,_0x560d3a,_0x4957c5,_0x4656b5){this[_0xfc6d('0x8a')]=_0xfc6d('0x8b');this[_0xfc6d('0x8c')]=_0x58396c[_0xfc6d('0x8d')];this[_0xfc6d('0x8e')]=_0x4656b5;this[_0xfc6d('0x43')]=_0xfc6d('0x8f');this[_0xfc6d('0x90')]='Fax\x20Extension';this[_0xfc6d('0x69')]=_0x58396c['id'];this[_0xfc6d('0x87')]=_0x560d3a;this[_0xfc6d('0x91')]=_0x4957c5;}function createExtensionsReciveFax(_0x1a3a81){var _0x324181=0x1;var _0x3ac8c1=[];_0x3ac8c1[_0xfc6d('0x92')](new Extension(_0x1a3a81,_0x324181,'',_0xfc6d('0x93')));_0x324181+=0x1;_0x3ac8c1['push'](new Extension(_0x1a3a81,_0x324181,_0xfc6d('0x94'),'Set'));_0x324181+=0x1;for(var _0x554407 in _0x1a3a81){if(_0x1a3a81['hasOwnProperty'](_0x554407)&&(_0x554407==='ecm'||_0x554407===_0xfc6d('0x8d')||_0x554407===_0xfc6d('0x95')||_0x554407===_0xfc6d('0x96')||_0x554407===_0xfc6d('0x97')||_0x554407===_0xfc6d('0x98')||_0x554407===_0xfc6d('0x99')||_0x554407===_0xfc6d('0x9a')||_0x554407===_0xfc6d('0x9b'))){_0x3ac8c1['push'](new Extension(_0x1a3a81,_0x324181,_0xfc6d('0x9c')+_0x554407+')='+_0x1a3a81[_0x554407],_0xfc6d('0x9d')));_0x324181+=0x1;}}_0x3ac8c1[_0xfc6d('0x92')](new Extension(_0x1a3a81,_0x324181,'6',_0xfc6d('0x9e')));_0x324181+=0x1;_0x3ac8c1[_0xfc6d('0x92')](new Extension(_0x1a3a81,_0x324181,_0xfc6d('0x9f'),_0xfc6d('0xa0')));_0x324181=0x0;return _0x3ac8c1;}exports[_0xfc6d('0xa1')]=function(_0x4913ca,_0x540515,_0x408f79){var _0x4a0b1d;return db[_0xfc6d('0x81')]['transaction'](function(_0x4ab6ef){return db[_0xfc6d('0x42')][_0xfc6d('0x5d')](_0x4913ca[_0xfc6d('0x5e')],{'transaction':_0x4ab6ef})[_0xfc6d('0x21')](function(_0x4439a3){_0x4a0b1d=_0x4439a3[_0xfc6d('0x3a')]({'plain':!![]});return db[_0xfc6d('0xa2')]['bulkCreate'](createExtensionsReciveFax(_0x4a0b1d),{'transaction':_0x4ab6ef});});})['then'](function(){return _0x4a0b1d;})[_0xfc6d('0x21')](respondWithResult(_0x540515,null))[_0xfc6d('0x56')](handleError(_0x540515,null));};exports[_0xfc6d('0xa3')]=function(_0x43c389,_0x431da0,_0x2dbed2){var _0x4ea65d;return db[_0xfc6d('0x81')]['transaction'](function(_0x39d3ea){return db[_0xfc6d('0x42')][_0xfc6d('0x38')](_0x43c389['body'],{'where':{'id':_0x43c389['body']['id']},'transaction':_0x39d3ea})[_0xfc6d('0x21')](function(_0x54809b){return db[_0xfc6d('0xa2')][_0xfc6d('0x39')]({'where':{'FaxAccountId':_0x43c389[_0xfc6d('0x5e')]['id']},'transaction':_0x39d3ea})['then'](function(_0x181acd){return db[_0xfc6d('0xa2')][_0xfc6d('0x85')](createExtensionsReciveFax(_[_0xfc6d('0x75')](_0x43c389[_0xfc6d('0x5e')],[_0xfc6d('0xa4'),_0xfc6d('0x44'),'createdAt',_0xfc6d('0xa5'),'TrunkId',_0xfc6d('0xa6')])),{'transaction':_0x39d3ea});});});})['then'](function(){return db[_0xfc6d('0x42')]['findById'](_0x43c389[_0xfc6d('0x5e')]['id']);})[_0xfc6d('0x21')](respondWithResult(_0x431da0,null))[_0xfc6d('0x56')](handleError(_0x431da0,null));};exports[_0xfc6d('0xa7')]=function(_0xc0c311,_0x5264e5,_0x1c06a1){var _0x59246c={'raw':!![],'where':{}};var _0x46655c={};var _0x18a040={'count':0x0,'rows':[]};return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0xc0c311[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x5264e5,null))[_0xfc6d('0x21')](function(_0x4f6220){if(_0x4f6220){_0x46655c[_0xfc6d('0x48')]=_['keys'](db[_0xfc6d('0xa8')][_0xfc6d('0x5a')]);_0x46655c['query']=_[_0xfc6d('0x59')](_0xc0c311['query']);_0x46655c[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0x46655c[_0xfc6d('0x48')],_0x46655c[_0xfc6d('0x45')]);_0x59246c[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0x46655c[_0xfc6d('0x48')],qs[_0xfc6d('0x4a')](_0xc0c311['query'][_0xfc6d('0x4a')]));_0x59246c[_0xfc6d('0x49')]=_0x59246c['attributes']['length']?_0x59246c[_0xfc6d('0x49')]:_0x46655c[_0xfc6d('0x48')];if(!_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0x59246c['limit']=qs[_0xfc6d('0x31')](_0xc0c311['query'][_0xfc6d('0x31')]);_0x59246c['offset']=qs[_0xfc6d('0x32')](_0xc0c311['query'][_0xfc6d('0x32')]);}_0x59246c[_0xfc6d('0x4c')]=qs[_0xfc6d('0x4d')](_0xc0c311['query'][_0xfc6d('0x4d')]);_0x59246c[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_[_0xfc6d('0x4f')](_0xc0c311[_0xfc6d('0x45')],_0x46655c[_0xfc6d('0x46')]));_0x59246c[_0xfc6d('0x4e')][_0xfc6d('0x69')]=_0x4f6220['id'];if(_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x50')]){_0x59246c[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x59246c[_0xfc6d('0x4e')],{'$or':_[_0xfc6d('0x41')](_0x59246c[_0xfc6d('0x49')],function(_0x1e9521){var _0x12f97e={};_0x12f97e[_0x1e9521]={'$like':'%'+_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x12f97e;})});}if(_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0xa9')]){var _0x5bbc1f=_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0xa9')][_0xfc6d('0xaa')](',');var _0x3448d3={};_0x3448d3[_0x5bbc1f[0x0]]={'$gte':moment(_0x5bbc1f[0x1])[_0xfc6d('0xab')](_0xfc6d('0xac'))};_0x59246c[_0xfc6d('0x4e')]=_[_0xfc6d('0x51')](_0x59246c['where'],_0x3448d3);}_0x59246c=_[_0xfc6d('0x51')]({},_0x59246c,_0xc0c311[_0xfc6d('0x52')]);return db['FaxMessage']['count']({'where':_0x59246c[_0xfc6d('0x4e')]})[_0xfc6d('0x21')](function(_0x11bdca){_0x18a040[_0xfc6d('0x33')]=_0x11bdca;if(_0xc0c311[_0xfc6d('0x45')][_0xfc6d('0x53')]){_0x59246c[_0xfc6d('0x54')]=[{'all':!![]}];}return db[_0xfc6d('0xa8')][_0xfc6d('0x6d')](_0x59246c);})[_0xfc6d('0x21')](function(_0x122e08){_0x18a040[_0xfc6d('0x55')]=_0x122e08;return _0x18a040;});}})[_0xfc6d('0x21')](respondWithFilteredResult(_0x5264e5,_0x59246c))[_0xfc6d('0x56')](handleError(_0x5264e5,null));};exports[_0xfc6d('0x3e')]=function(_0x49d8c0,_0x1e6fe1,_0x4cf4df){var _0x1aeb77,_0x849835={},_0x3aa15b;if(_0x49d8c0[_0xfc6d('0x5e')]['to']){_0x3aa15b=_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x49d8c0[_0xfc6d('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0xfc6d('0xad'),'include':[{'model':db[_0xfc6d('0x77')],'as':_0xfc6d('0xae'),'where':{'fax':_0x3aa15b},'limit':0x1,'order':[[_0xfc6d('0xa5'),_0xfc6d('0xaf')]]}]}]})[_0xfc6d('0x21')](handleEntityNotFound(_0x1e6fe1,null))['then'](function(_0x2572b5){_0x1aeb77=_0x2572b5;if(_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')]&&_0x49d8c0['body'][_0xfc6d('0xb0')][_0xfc6d('0x5b')]){for(var _0x11c320=0x0;_0x11c320<_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')]['length'];_0x11c320+=0x1){_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][_0x11c320]={'filename':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][_0x11c320][_0xfc6d('0x3d')],'id':_0x49d8c0[_0xfc6d('0x5e')]['attachments'][_0x11c320]['id'],'path':path['join'](config[_0xfc6d('0xb1')],_0xfc6d('0xb2'),_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][_0x11c320][_0xfc6d('0xb3')])};}}return respondWithRpcPromise('CheckAfterSend',_0xfc6d('0xb4'),{'FaxAccountId':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x66')]['id'])?undefined:_0x49d8c0[_0xfc6d('0x66')]['id'],'path':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['path'])?undefined:_0x49d8c0['body'][_0xfc6d('0xb0')][0x0][_0xfc6d('0x8')],'fax':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0])?undefined:_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0]},client9002);})[_0xfc6d('0x21')](function(){if(_0x1aeb77){if(_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb6')])){_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb6')]=util[_0xfc6d('0xab')](_0xfc6d('0xb7'),_0x1aeb77[_0xfc6d('0x3d')],_0x1aeb77[_0xfc6d('0xb8')]);}if(_0x1aeb77['List']){if(_0x1aeb77[_0xfc6d('0xad')][_0xfc6d('0xae')][_0xfc6d('0x5b')]){return _0x1aeb77[_0xfc6d('0xad')]['Contacts'][0x0];}else{return db[_0xfc6d('0x77')][_0xfc6d('0x5d')](_[_0xfc6d('0x19')](_0x49d8c0['body'],{'firstName':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'phone':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'fax':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'ListId':_0x1aeb77[_0xfc6d('0xa6')]}));}}else{throw new Error(_0xfc6d('0xb9'));}}else{throw new Error(_0xfc6d('0xba'));}})['then'](function(_0x21ee97){if(_0x21ee97){return db[_0xfc6d('0x74')][_0xfc6d('0x5c')]({'where':{'ContactId':_0x21ee97['id'],'closed':![],'FaxAccountId':_0x1aeb77['id']}})[_0xfc6d('0x21')](function(_0x378446){if(_0x378446){return[_0x378446,![]];}return db[_0xfc6d('0x74')][_0xfc6d('0x5d')]({'UserId':_0x49d8c0['user']['id'],'ContactId':_0x21ee97['id'],'FaxAccountId':_0x1aeb77['id'],'fax':_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xfc6d('0x51')](_0x49d8c0[_0xfc6d('0x5e')],{'read':![],'body':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0][_0xfc6d('0xbb')],'FaxAccountId':_0x1aeb77['id'],'UserId':_0x49d8c0[_0xfc6d('0x5f')]['id'],'ContactId':_0x21ee97['id'],'AttachmentId':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['id']})]},{'include':[{'model':db[_0xfc6d('0xa8')],'as':'Messages'}]})[_0xfc6d('0x21')](function(_0x182f77){return[_0x182f77,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xfc6d('0xbc')](function(_0x3b3f58,_0x262b17){if(_0x262b17){return _0x3b3f58;}return db[_0xfc6d('0xa8')][_0xfc6d('0x5d')]({'direction':_0xfc6d('0xbd'),'read':![],'body':_0x49d8c0['body'][_0xfc6d('0xb0')][0x0][_0xfc6d('0xbb')],'FaxAccountId':_0x1aeb77['id'],'FaxInteractionId':_0x3b3f58['id'],'UserId':_0x49d8c0[_0xfc6d('0x5f')]['id'],'ContactId':_0x3b3f58[_0xfc6d('0xbe')],'AttachmentId':_0x49d8c0['body']['attachments'][0x0]['id']})[_0xfc6d('0x21')](function(_0x5b415c){_0x3b3f58[_0xfc6d('0xbf')][_0xfc6d('0xc0')]=[];_0x3b3f58['dataValues'][_0xfc6d('0xc0')][_0xfc6d('0x92')](_0x5b415c['dataValues']);return _0x3b3f58;});})[_0xfc6d('0x21')](function(_0x17be8d){respondWithRpcPromise(_0xfc6d('0xc1'),_0xfc6d('0xc1'),{'FaxAccountId':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x66')]['id'])?undefined:_0x49d8c0[_0xfc6d('0x66')]['id'],'path':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['path'])?undefined:_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0][_0xfc6d('0x8')],'fax':_[_0xfc6d('0xb5')](_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0])?undefined:_0x49d8c0[_0xfc6d('0x5e')]['to'][0x0],'AttachmentId':_0x49d8c0[_0xfc6d('0x5e')][_0xfc6d('0xb0')][0x0]['id']},client9002)[_0xfc6d('0x21')](function(_0x49a7a0){logger['info'](_0xfc6d('0xc2'),_0x49a7a0);})['catch'](function(_0x543e53){logger[_0xfc6d('0x2a')](_0xfc6d('0xc2'),_0x543e53);});return _0x17be8d;})[_0xfc6d('0x21')](respondWithResult(_0x1e6fe1,null))[_0xfc6d('0x56')](handleError(_0x1e6fe1,null));};exports[_0xfc6d('0xc3')]=function(_0x1afe03,_0x151d2e,_0x9e3913){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x1afe03['params']['id']}})['then'](handleEntityNotFound(_0x151d2e,null))[_0xfc6d('0x21')](function(_0x5c46c9){if(_0x5c46c9){return _0x5c46c9[_0xfc6d('0xc3')](_0x1afe03[_0xfc6d('0x5e')][_0xfc6d('0x6f')],_['omit'](_0x1afe03['body'],[_0xfc6d('0x6f'),'id'])||{})['spread'](function(_0x29f5a1){for(var _0x4e27d5=0x0;_0x4e27d5<_0x1afe03[_0xfc6d('0x5e')][_0xfc6d('0x6f')][_0xfc6d('0x5b')];_0x4e27d5+=0x1){socket[_0xfc6d('0xc4')](_0xfc6d('0xc5'),{'UserId':Number(_0x1afe03[_0xfc6d('0x5e')]['ids'][_0x4e27d5]),'FaxAccountId':Number(_0x1afe03['params']['id'])});}return _0x29f5a1;});}})[_0xfc6d('0x21')](respondWithResult(_0x151d2e,null))[_0xfc6d('0x56')](handleError(_0x151d2e,null));};exports[_0xfc6d('0xc6')]=function(_0x3ba6ab,_0x25451e,_0x2e7162){return db[_0xfc6d('0x42')][_0xfc6d('0x5c')]({'where':{'id':_0x3ba6ab[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x25451e,null))[_0xfc6d('0x21')](function(_0x46438a){if(_0x46438a){return _0x46438a['removeAgents'](_0x3ba6ab[_0xfc6d('0x45')]['ids'])[_0xfc6d('0x21')](function(){if(_[_0xfc6d('0xc7')](_0x3ba6ab[_0xfc6d('0x45')]['ids'])){for(var _0x209f9a=0x0;_0x209f9a<_0x3ba6ab[_0xfc6d('0x45')][_0xfc6d('0x6f')][_0xfc6d('0x5b')];_0x209f9a+=0x1){socket['emit'](_0xfc6d('0xc8'),{'UserId':Number(_0x3ba6ab[_0xfc6d('0x45')][_0xfc6d('0x6f')][_0x209f9a]),'FaxAccountId':Number(_0x3ba6ab['params']['id'])});}}else{socket[_0xfc6d('0xc4')]('userFaxAccount:remove',{'UserId':Number(_0x3ba6ab[_0xfc6d('0x45')]['ids']),'FaxAccountId':Number(_0x3ba6ab[_0xfc6d('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x25451e,null))[_0xfc6d('0x56')](handleError(_0x25451e,null));};exports[_0xfc6d('0xc9')]=function(_0x4c4eb3,_0x264a2c,_0x2552a7){var _0xcb6912={};var _0xdf79f0={};var _0x4cc8ab;var _0xdccaa6;return db[_0xfc6d('0x42')][_0xfc6d('0x6b')]({'where':{'id':_0x4c4eb3[_0xfc6d('0x66')]['id']}})[_0xfc6d('0x21')](handleEntityNotFound(_0x264a2c,null))[_0xfc6d('0x21')](function(_0x262c80){if(_0x262c80){_0x4cc8ab=_0x262c80;_0xdf79f0[_0xfc6d('0x48')]=_[_0xfc6d('0x59')](db[_0xfc6d('0x79')][_0xfc6d('0x5a')]);_0xdf79f0[_0xfc6d('0x45')]=_['keys'](_0x4c4eb3['query']);_0xdf79f0[_0xfc6d('0x46')]=_[_0xfc6d('0x47')](_0xdf79f0[_0xfc6d('0x48')],_0xdf79f0[_0xfc6d('0x45')]);_0xcb6912[_0xfc6d('0x49')]=_[_0xfc6d('0x47')](_0xdf79f0['model'],qs[_0xfc6d('0x4a')](_0x4c4eb3[_0xfc6d('0x45')][_0xfc6d('0x4a')]));_0xcb6912['attributes']=_0xcb6912[_0xfc6d('0x49')][_0xfc6d('0x5b')]?_0xcb6912[_0xfc6d('0x49')]:_0xdf79f0['model'];_0xcb6912['order']=qs[_0xfc6d('0x4d')](_0x4c4eb3['query'][_0xfc6d('0x4d')]);_0xcb6912[_0xfc6d('0x4e')]=qs[_0xfc6d('0x46')](_[_0xfc6d('0x4f')](_0x4c4eb3[_0xfc6d('0x45')],_0xdf79f0[_0xfc6d('0x46')]));if(_0x4c4eb3[_0xfc6d('0x45')]['filter']){_0xcb6912['where']=_[_0xfc6d('0x51')](_0xcb6912[_0xfc6d('0x4e')],{'$or':_['map'](_0xcb6912['attributes'],function(_0xdc4b53){var _0x3b2229={};_0x3b2229[_0xdc4b53]={'$like':'%'+_0x4c4eb3[_0xfc6d('0x45')][_0xfc6d('0x50')]+'%'};return _0x3b2229;})});}_0xcb6912=_[_0xfc6d('0x51')]({},_0xcb6912,_0x4c4eb3[_0xfc6d('0x52')]);return _0x4cc8ab[_0xfc6d('0xc9')](_0xcb6912);}})[_0xfc6d('0x21')](function(_0x43feb1){if(_0x43feb1){_0xdccaa6=_0x43feb1[_0xfc6d('0x5b')];if(!_0x4c4eb3[_0xfc6d('0x45')][_0xfc6d('0x4b')](_0xfc6d('0x6c'))){_0xcb6912[_0xfc6d('0x31')]=qs['limit'](_0x4c4eb3[_0xfc6d('0x45')]['limit']);_0xcb6912[_0xfc6d('0x32')]=qs[_0xfc6d('0x32')](_0x4c4eb3['query'][_0xfc6d('0x32')]);}return _0x4cc8ab[_0xfc6d('0xc9')](_0xcb6912);}})['then'](function(_0x30ee65){if(_0x30ee65){return _0x30ee65?{'count':_0xdccaa6,'rows':_0x30ee65}:null;}})[_0xfc6d('0x21')](respondWithResult(_0x264a2c,null))['catch'](handleError(_0x264a2c,null));}; \ No newline at end of file +var _0x8373=['findOne','Disposition','order','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','FaxInteraction','addInteraction','omit','getInteractions','options','CmContact','Contact','User','Owner','Tags','color','tag','addApplications','sequelize','Transaction','READ_COMMITTED','FaxApplication','bulkCreate','priority','stack','getApplications','context','localstationid','app','system','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','push','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','addAccountApplications','transaction','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','List','Contacts','attachments','join','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Contact\x20not\x20found','out','dataValues','Messages','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','userFaxAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./faxAccount.socket','jayson/promise','http','client','then','info','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','FaxAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','FaxAccount','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','length','include','create','body','user','get','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','FaxAccountId','getDispositions'];(function(_0x21ff4b,_0x29486f){var _0x224941=function(_0x348784){while(--_0x348784){_0x21ff4b['push'](_0x21ff4b['shift']());}};_0x224941(++_0x29486f);}(_0x8373,0x1d9));var _0x3837=function(_0x37ec20,_0x1c3752){_0x37ec20=_0x37ec20-0x0;var _0x5b2b4e=_0x8373[_0x37ec20];return _0x5b2b4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3837('0x0'));var zipdir=require(_0x3837('0x1'));var jsonpatch=require(_0x3837('0x2'));var rp=require(_0x3837('0x3'));var moment=require(_0x3837('0x4'));var BPromise=require(_0x3837('0x5'));var Mustache=require(_0x3837('0x6'));var util=require(_0x3837('0x7'));var path=require(_0x3837('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3837('0x9'));var fs=require('fs');var fs_extra=require(_0x3837('0xa'));var _=require(_0x3837('0xb'));var squel=require(_0x3837('0xc'));var crypto=require(_0x3837('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3837('0xe'));var querystring=require(_0x3837('0xf'));var Papa=require(_0x3837('0x10'));var Redis=require(_0x3837('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x3837('0x12'));var as=require(_0x3837('0x13'));var hardwareService=require(_0x3837('0x14'));var logger=require(_0x3837('0x15'))('api');var utils=require(_0x3837('0x16'));var config=require(_0x3837('0x17'));var licenseUtil=require(_0x3837('0x18'));var db=require(_0x3837('0x19'))['db'];config['redis']=_[_0x3837('0x1a')](config['redis'],{'host':_0x3837('0x1b'),'port':0x18eb});var socket=require(_0x3837('0x1c'))(new Redis(config['redis']));require(_0x3837('0x1d'))['register'](socket);var jayson=require(_0x3837('0x1e'));var client=jayson['client'][_0x3837('0x1f')]({'port':0x232c});var client9002=jayson[_0x3837('0x20')][_0x3837('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x3b7407,_0x48790b,_0x5693be,_0x4988e3){return new BPromise(function(_0x349aa8,_0x44f07e){var _0x4ac104=_0x4988e3||client;return _0x4ac104['request'](_0x3b7407,_0x5693be)[_0x3837('0x21')](function(_0x358a58){logger[_0x3837('0x22')]('FaxAccount,\x20%s,\x20%s',_0x48790b,_0x3837('0x23'));logger[_0x3837('0x24')](_0x3837('0x25'),_0x48790b,_0x3837('0x23'),JSON[_0x3837('0x26')](_0x358a58));if(_0x358a58[_0x3837('0x27')]){if(_0x358a58[_0x3837('0x27')][_0x3837('0x28')]===0x1f4){logger['error'](_0x3837('0x29'),_0x48790b,_0x358a58[_0x3837('0x27')]['message']);return _0x44f07e(_0x358a58[_0x3837('0x27')][_0x3837('0x2a')]);}logger[_0x3837('0x27')](_0x3837('0x29'),_0x48790b,_0x358a58['error'][_0x3837('0x2a')]);return _0x349aa8(_0x358a58['error']['message']);}else{logger[_0x3837('0x22')](_0x3837('0x29'),_0x48790b,_0x3837('0x23'));_0x349aa8(_0x358a58[_0x3837('0x2b')][_0x3837('0x2a')]);}})[_0x3837('0x2c')](function(_0x563937){logger[_0x3837('0x27')](_0x3837('0x29'),_0x48790b,_0x563937);_0x44f07e(_0x563937);});});}function respondWithStatusCode(_0x461926,_0x51fd09){_0x51fd09=_0x51fd09||0xcc;return function(_0x4ee839){if(_0x4ee839){return _0x461926[_0x3837('0x2d')](_0x51fd09);}return _0x461926[_0x3837('0x2e')](_0x51fd09)[_0x3837('0x2f')]();};}function respondWithResult(_0x20239e,_0x3afd81){_0x3afd81=_0x3afd81||0xc8;return function(_0xa991db){if(_0xa991db){return _0x20239e['status'](_0x3afd81)[_0x3837('0x30')](_0xa991db);}};}function respondWithFilteredResult(_0x1f23e1,_0x453016){return function(_0x38c522){if(_0x38c522){var _0x45bb50=typeof _0x453016[_0x3837('0x31')]===_0x3837('0x32')&&typeof _0x453016[_0x3837('0x33')]===_0x3837('0x32');var _0x42d89f=_0x38c522[_0x3837('0x34')];var _0x49efcc=_0x45bb50?0x0:_0x453016[_0x3837('0x31')];var _0x2b90a0=_0x45bb50?_0x38c522['count']:_0x453016[_0x3837('0x31')]+_0x453016[_0x3837('0x33')];var _0x511b84;if(_0x2b90a0>=_0x42d89f){_0x2b90a0=_0x42d89f;_0x511b84=0xc8;}else{_0x511b84=0xce;}_0x1f23e1[_0x3837('0x2e')](_0x511b84);return _0x1f23e1[_0x3837('0x35')](_0x3837('0x36'),_0x49efcc+'-'+_0x2b90a0+'/'+_0x42d89f)[_0x3837('0x30')](_0x38c522);}return null;};}function patchUpdates(_0x24f5e0){return function(_0x5628ff){try{jsonpatch[_0x3837('0x37')](_0x5628ff,_0x24f5e0,!![]);}catch(_0x216392){return BPromise['reject'](_0x216392);}return _0x5628ff['save']();};}function saveUpdates(_0x338c9b,_0x486a9f){return function(_0xb9f5c1){if(_0xb9f5c1){return _0xb9f5c1[_0x3837('0x38')](_0x338c9b)[_0x3837('0x21')](function(_0x4de111){return _0x4de111;});}return null;};}function removeEntity(_0x1cd718,_0x188151){return function(_0x5249ad){if(_0x5249ad){return _0x5249ad[_0x3837('0x39')]()[_0x3837('0x21')](function(){var _0x5c00e0=_0x5249ad['get']({'plain':!![]});var _0x5d519e=_0x3837('0x3a');return db[_0x3837('0x3b')][_0x3837('0x39')]({'where':{'type':_0x5d519e,'resourceId':_0x5c00e0['id']}})[_0x3837('0x21')](function(){return _0x5249ad;});})[_0x3837('0x21')](function(){_0x1cd718['status'](0xcc)[_0x3837('0x2f')]();});}};}function handleEntityNotFound(_0x6b0010,_0x1b2cd1){return function(_0x1e8f4e){if(!_0x1e8f4e){_0x6b0010[_0x3837('0x2d')](0x194);}return _0x1e8f4e;};}function handleError(_0x288d52,_0xe55bc1){_0xe55bc1=_0xe55bc1||0x1f4;return function(_0x327fd0){logger[_0x3837('0x27')](_0x327fd0['stack']);if(_0x327fd0[_0x3837('0x3c')]){delete _0x327fd0[_0x3837('0x3c')];}_0x288d52['status'](_0xe55bc1)[_0x3837('0x3d')](_0x327fd0);};}exports[_0x3837('0x3e')]=function(_0x43db15,_0x4eee7a){var _0xa6b5fe={'include':[{'model':db['Pause'],'as':_0x3837('0x3f')}]},_0x4c5fa0={},_0xc9bb2a={'count':0x0,'rows':[]};var _0x2a864c=_['map'](db[_0x3837('0x40')][_0x3837('0x41')],function(_0x520894){return{'name':_0x520894[_0x3837('0x42')],'type':_0x520894['type'][_0x3837('0x43')]};});_0x4c5fa0[_0x3837('0x44')]=_[_0x3837('0x45')](_0x2a864c,'name');_0x4c5fa0['query']=_[_0x3837('0x46')](_0x43db15[_0x3837('0x47')]);_0x4c5fa0[_0x3837('0x48')]=_['intersection'](_0x4c5fa0[_0x3837('0x44')],_0x4c5fa0[_0x3837('0x47')]);_0xa6b5fe[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x4c5fa0[_0x3837('0x44')],qs['fields'](_0x43db15[_0x3837('0x47')][_0x3837('0x4b')]));_0xa6b5fe[_0x3837('0x49')]=_0xa6b5fe['attributes']['length']?_0xa6b5fe[_0x3837('0x49')]:_0x4c5fa0[_0x3837('0x44')];if(!_0x43db15[_0x3837('0x47')][_0x3837('0x4c')](_0x3837('0x4d'))){_0xa6b5fe[_0x3837('0x33')]=qs[_0x3837('0x33')](_0x43db15['query'][_0x3837('0x33')]);_0xa6b5fe[_0x3837('0x31')]=qs[_0x3837('0x31')](_0x43db15['query']['offset']);}_0xa6b5fe['order']=qs['sort'](_0x43db15[_0x3837('0x47')][_0x3837('0x4e')]);_0xa6b5fe[_0x3837('0x4f')]=qs[_0x3837('0x48')](_[_0x3837('0x50')](_0x43db15[_0x3837('0x47')],_0x4c5fa0[_0x3837('0x48')]),_0x2a864c);if(_0x43db15[_0x3837('0x47')][_0x3837('0x51')]){_0xa6b5fe[_0x3837('0x4f')]=_['merge'](_0xa6b5fe[_0x3837('0x4f')],{'$or':_[_0x3837('0x45')](_0x2a864c,function(_0x59861a){if(_0x59861a['type']!==_0x3837('0x52')){var _0x1d9d09={};_0x1d9d09[_0x59861a[_0x3837('0x3c')]]={'$like':'%'+_0x43db15['query']['filter']+'%'};return _0x1d9d09;}})});}_0xa6b5fe=_[_0x3837('0x53')]({},_0xa6b5fe,_0x43db15['options']);var _0x356c9d={'where':_0xa6b5fe[_0x3837('0x4f')]};return db['FaxAccount'][_0x3837('0x34')](_0x356c9d)[_0x3837('0x21')](function(_0x10119c){_0xc9bb2a['count']=_0x10119c;if(_0x43db15['query'][_0x3837('0x54')]){_0xa6b5fe['include']=[{'all':!![]}];}return db[_0x3837('0x40')][_0x3837('0x55')](_0xa6b5fe);})['then'](function(_0x355d50){_0xc9bb2a[_0x3837('0x56')]=_0x355d50;return _0xc9bb2a;})[_0x3837('0x21')](respondWithFilteredResult(_0x4eee7a,_0xa6b5fe))[_0x3837('0x2c')](handleError(_0x4eee7a,null));};exports[_0x3837('0x57')]=function(_0x413149,_0x884c15){var _0x277504={'raw':![],'where':{'id':_0x413149[_0x3837('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x31f2c9={};_0x31f2c9['model']=_[_0x3837('0x46')](db[_0x3837('0x40')]['rawAttributes']);_0x31f2c9[_0x3837('0x47')]=_[_0x3837('0x46')](_0x413149[_0x3837('0x47')]);_0x31f2c9['filters']=_[_0x3837('0x4a')](_0x31f2c9[_0x3837('0x44')],_0x31f2c9[_0x3837('0x47')]);_0x277504['attributes']=_[_0x3837('0x4a')](_0x31f2c9['model'],qs['fields'](_0x413149[_0x3837('0x47')]['fields']));_0x277504[_0x3837('0x49')]=_0x277504[_0x3837('0x49')][_0x3837('0x59')]?_0x277504[_0x3837('0x49')]:_0x31f2c9[_0x3837('0x44')];if(_0x413149[_0x3837('0x47')]['includeAll']){_0x277504[_0x3837('0x5a')]=[{'all':!![]}];}_0x277504=_['merge']({},_0x277504,_0x413149['options']);return db[_0x3837('0x40')]['find'](_0x277504)[_0x3837('0x21')](handleEntityNotFound(_0x884c15,null))[_0x3837('0x21')](respondWithResult(_0x884c15,null))[_0x3837('0x2c')](handleError(_0x884c15,null));};exports[_0x3837('0x5b')]=function(_0x2c0bf5,_0x3cca75){return db['FaxAccount']['create'](_0x2c0bf5[_0x3837('0x5c')],{})[_0x3837('0x21')](function(_0xe51f2a){var _0x5b8c2d=_0x2c0bf5[_0x3837('0x5d')][_0x3837('0x5e')]({'plain':!![]});if(!_0x5b8c2d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b8c2d['role']==='user'){var _0x356298=_0xe51f2a[_0x3837('0x5e')]({'plain':!![]});var _0x52d097=_0x3837('0x3a');return db['UserProfileSection'][_0x3837('0x5f')]({'where':{'name':_0x52d097,'userProfileId':_0x5b8c2d[_0x3837('0x60')]},'raw':!![]})[_0x3837('0x21')](function(_0x2b4d2e){if(_0x2b4d2e&&_0x2b4d2e[_0x3837('0x61')]===0x0){return db['UserProfileResource'][_0x3837('0x5b')]({'name':_0x356298['name'],'resourceId':_0x356298['id'],'type':_0x2b4d2e[_0x3837('0x3c')],'sectionId':_0x2b4d2e['id']},{})[_0x3837('0x21')](function(){return _0xe51f2a;});}else{return _0xe51f2a;}})[_0x3837('0x2c')](function(_0x2e22e8){logger[_0x3837('0x27')](_0x3837('0x62'),_0x2e22e8);throw _0x2e22e8;});}return _0xe51f2a;})[_0x3837('0x21')](respondWithResult(_0x3cca75,0xc9))[_0x3837('0x2c')](handleError(_0x3cca75,null));};exports[_0x3837('0x38')]=function(_0xf95e64,_0x3aa3df){if(_0xf95e64[_0x3837('0x5c')]['id']){delete _0xf95e64[_0x3837('0x5c')]['id'];}return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0xf95e64['params']['id']},'include':[{'model':db[_0x3837('0x63')],'as':'mandatoryDispositionPause'}]})[_0x3837('0x21')](handleEntityNotFound(_0x3aa3df,null))['then'](saveUpdates(_0xf95e64[_0x3837('0x5c')],null))[_0x3837('0x21')](respondWithResult(_0x3aa3df,null))['catch'](handleError(_0x3aa3df,null));};exports[_0x3837('0x39')]=function(_0x5d6dd6,_0x361703){return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0x5d6dd6[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x361703,null))[_0x3837('0x21')](removeEntity(_0x361703,null))[_0x3837('0x2c')](handleError(_0x361703,null));};exports[_0x3837('0x64')]=function(_0x5f059b,_0x5a8cc5){return db[_0x3837('0x40')][_0x3837('0x64')]()[_0x3837('0x21')](respondWithResult(_0x5a8cc5,null))['catch'](handleError(_0x5a8cc5,null));};exports['addDisposition']=function(_0x50d040,_0x6a94b6,_0x26dfbe){if(_0x50d040['body']['id']){delete _0x50d040[_0x3837('0x5c')]['id'];}return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0x50d040[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x6a94b6,null))['then'](function(_0x897208){if(_0x897208){_0x50d040[_0x3837('0x5c')][_0x3837('0x65')]=_0x897208['id'];return db['Disposition'][_0x3837('0x5b')](_0x50d040[_0x3837('0x5c')]);}})[_0x3837('0x21')](respondWithResult(_0x6a94b6,null))[_0x3837('0x2c')](handleError(_0x6a94b6,null));};exports[_0x3837('0x66')]=function(_0x104261,_0x1a67f0,_0x158a29){var _0x24c58c={'raw':![],'where':{}};var _0x345c85={};var _0x20f536={'count':0x0,'rows':[]};return db[_0x3837('0x40')][_0x3837('0x67')]({'where':{'id':_0x104261[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x1a67f0,null))[_0x3837('0x21')](function(_0x21768e){if(_0x21768e){_0x345c85['model']=_[_0x3837('0x46')](db[_0x3837('0x68')][_0x3837('0x41')]);_0x345c85['query']=_[_0x3837('0x46')](_0x104261['query']);_0x345c85['filters']=_[_0x3837('0x4a')](_0x345c85['model'],_0x345c85[_0x3837('0x47')]);_0x24c58c[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x345c85[_0x3837('0x44')],qs[_0x3837('0x4b')](_0x104261[_0x3837('0x47')]['fields']));_0x24c58c[_0x3837('0x49')]=_0x24c58c['attributes']['length']?_0x24c58c['attributes']:_0x345c85[_0x3837('0x44')];if(!_0x104261['query']['hasOwnProperty'](_0x3837('0x4d'))){_0x24c58c[_0x3837('0x33')]=qs[_0x3837('0x33')](_0x104261['query'][_0x3837('0x33')]);_0x24c58c[_0x3837('0x31')]=qs['offset'](_0x104261['query'][_0x3837('0x31')]);}_0x24c58c[_0x3837('0x69')]=qs[_0x3837('0x4e')](_0x104261[_0x3837('0x47')][_0x3837('0x4e')]);_0x24c58c[_0x3837('0x4f')]=qs[_0x3837('0x48')](_[_0x3837('0x50')](_0x104261[_0x3837('0x47')],_0x345c85[_0x3837('0x48')]));_0x24c58c[_0x3837('0x4f')]['FaxAccountId']=_0x21768e['id'];if(_0x104261[_0x3837('0x47')]['filter']){_0x24c58c[_0x3837('0x4f')]=_['merge'](_0x24c58c[_0x3837('0x4f')],{'$or':_['map'](_0x24c58c[_0x3837('0x49')],function(_0x319118){var _0x474b5a={};_0x474b5a[_0x319118]={'$like':'%'+_0x104261[_0x3837('0x47')][_0x3837('0x51')]+'%'};return _0x474b5a;})});}_0x24c58c=_['merge']({},_0x24c58c,_0x104261['options']);return db['Disposition'][_0x3837('0x34')]({'where':_0x24c58c[_0x3837('0x4f')]})[_0x3837('0x21')](function(_0x13d9f8){_0x20f536[_0x3837('0x34')]=_0x13d9f8;if(_0x104261['query'][_0x3837('0x54')]){_0x24c58c[_0x3837('0x5a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x24c58c);})[_0x3837('0x21')](function(_0x2964f2){_0x20f536[_0x3837('0x56')]=_0x2964f2;return _0x20f536;});}})[_0x3837('0x21')](respondWithFilteredResult(_0x1a67f0,_0x24c58c))['catch'](handleError(_0x1a67f0,null));};exports[_0x3837('0x6a')]=function(_0x47bf52,_0x255647,_0x39084c){return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0x47bf52[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x255647,null))[_0x3837('0x21')](function(_0x27f9a1){if(_0x27f9a1){return _0x27f9a1[_0x3837('0x6a')](_0x47bf52[_0x3837('0x47')][_0x3837('0x6b')]);}})[_0x3837('0x21')](respondWithStatusCode(_0x255647,null))[_0x3837('0x2c')](handleError(_0x255647,null));};exports[_0x3837('0x6c')]=function(_0x414696,_0x23c7fa,_0xa9096f){if(_0x414696[_0x3837('0x5c')]['id']){delete _0x414696[_0x3837('0x5c')]['id'];}return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0x414696[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x23c7fa,null))['then'](function(_0x1f8bef){if(_0x1f8bef){_0x414696[_0x3837('0x5c')][_0x3837('0x65')]=_0x1f8bef['id'];return db['CannedAnswer']['create'](_0x414696[_0x3837('0x5c')]);}})[_0x3837('0x21')](respondWithResult(_0x23c7fa,null))['catch'](handleError(_0x23c7fa,null));};exports[_0x3837('0x6d')]=function(_0x43ef18,_0x318c3a,_0x1d1785){var _0x59bbef={'raw':![],'where':{}};var _0x3c94ac={};var _0x375bee={'count':0x0,'rows':[]};return db[_0x3837('0x40')]['findOne']({'where':{'id':_0x43ef18['params']['id']}})['then'](handleEntityNotFound(_0x318c3a,null))['then'](function(_0x20bd28){if(_0x20bd28){_0x3c94ac[_0x3837('0x44')]=_[_0x3837('0x46')](db[_0x3837('0x6e')][_0x3837('0x41')]);_0x3c94ac['query']=_[_0x3837('0x46')](_0x43ef18['query']);_0x3c94ac[_0x3837('0x48')]=_[_0x3837('0x4a')](_0x3c94ac[_0x3837('0x44')],_0x3c94ac[_0x3837('0x47')]);_0x59bbef[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x3c94ac['model'],qs['fields'](_0x43ef18[_0x3837('0x47')][_0x3837('0x4b')]));_0x59bbef[_0x3837('0x49')]=_0x59bbef[_0x3837('0x49')][_0x3837('0x59')]?_0x59bbef['attributes']:_0x3c94ac[_0x3837('0x44')];if(!_0x43ef18[_0x3837('0x47')]['hasOwnProperty'](_0x3837('0x4d'))){_0x59bbef[_0x3837('0x33')]=qs[_0x3837('0x33')](_0x43ef18[_0x3837('0x47')][_0x3837('0x33')]);_0x59bbef[_0x3837('0x31')]=qs['offset'](_0x43ef18[_0x3837('0x47')][_0x3837('0x31')]);}_0x59bbef['order']=qs[_0x3837('0x4e')](_0x43ef18['query'][_0x3837('0x4e')]);_0x59bbef[_0x3837('0x4f')]=qs['filters'](_[_0x3837('0x50')](_0x43ef18['query'],_0x3c94ac[_0x3837('0x48')]));_0x59bbef[_0x3837('0x4f')]['FaxAccountId']=_0x20bd28['id'];if(_0x43ef18[_0x3837('0x47')]['filter']){_0x59bbef[_0x3837('0x4f')]=_[_0x3837('0x53')](_0x59bbef[_0x3837('0x4f')],{'$or':_[_0x3837('0x45')](_0x59bbef[_0x3837('0x49')],function(_0x1746c6){var _0x10e4dd={};_0x10e4dd[_0x1746c6]={'$like':'%'+_0x43ef18[_0x3837('0x47')][_0x3837('0x51')]+'%'};return _0x10e4dd;})});}_0x59bbef=_[_0x3837('0x53')]({},_0x59bbef,_0x43ef18['options']);return db['CannedAnswer'][_0x3837('0x34')]({'where':_0x59bbef[_0x3837('0x4f')]})[_0x3837('0x21')](function(_0x3d7332){_0x375bee[_0x3837('0x34')]=_0x3d7332;if(_0x43ef18['query'][_0x3837('0x54')]){_0x59bbef['include']=[{'all':!![]}];}return db[_0x3837('0x6e')][_0x3837('0x55')](_0x59bbef);})[_0x3837('0x21')](function(_0x236613){_0x375bee[_0x3837('0x56')]=_0x236613;return _0x375bee;});}})[_0x3837('0x21')](respondWithFilteredResult(_0x318c3a,_0x59bbef))[_0x3837('0x2c')](handleError(_0x318c3a,null));};exports[_0x3837('0x6f')]=function(_0x47527b,_0x3ef100,_0x2e951e){return db['FaxAccount']['find']({'where':{'id':_0x47527b[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x3ef100,null))['then'](function(_0xa81ea2){if(_0xa81ea2){return _0xa81ea2[_0x3837('0x6f')](_0x47527b[_0x3837('0x47')][_0x3837('0x6b')]);}})[_0x3837('0x21')](respondWithStatusCode(_0x3ef100,null))['catch'](handleError(_0x3ef100,null));};exports['addInteraction']=function(_0x31a8dd,_0x413eb4,_0x3a90cc){return db[_0x3837('0x70')][_0x3837('0x5f')]({'where':{'id':_0x31a8dd['params']['id']}})['then'](handleEntityNotFound(_0x413eb4,null))['then'](function(_0x2192bf){if(_0x2192bf){return _0x2192bf[_0x3837('0x71')](_0x31a8dd[_0x3837('0x5c')][_0x3837('0x6b')],_[_0x3837('0x72')](_0x31a8dd[_0x3837('0x5c')],[_0x3837('0x6b'),'id'])||{});}})[_0x3837('0x21')](respondWithResult(_0x413eb4,null))[_0x3837('0x2c')](handleError(_0x413eb4,null));};exports[_0x3837('0x73')]=function(_0x300557,_0x526822,_0x4b09b5){var _0x2cb434={'raw':![],'where':{}};var _0x5abbe9={};var _0x321b24={'count':0x0,'rows':[]};return db[_0x3837('0x40')]['findOne']({'where':{'id':_0x300557[_0x3837('0x58')]['id']}})['then'](handleEntityNotFound(_0x526822,null))['then'](function(_0x58ea46){if(_0x58ea46){_0x5abbe9['model']=_[_0x3837('0x46')](db['FaxInteraction'][_0x3837('0x41')]);_0x5abbe9[_0x3837('0x47')]=_[_0x3837('0x46')](_0x300557[_0x3837('0x47')]);_0x5abbe9[_0x3837('0x48')]=_[_0x3837('0x4a')](_0x5abbe9[_0x3837('0x44')],_0x5abbe9[_0x3837('0x47')]);_0x2cb434[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x5abbe9[_0x3837('0x44')],qs[_0x3837('0x4b')](_0x300557[_0x3837('0x47')][_0x3837('0x4b')]));_0x2cb434[_0x3837('0x49')]=_0x2cb434[_0x3837('0x49')][_0x3837('0x59')]?_0x2cb434[_0x3837('0x49')]:_0x5abbe9[_0x3837('0x44')];if(!_0x300557['query'][_0x3837('0x4c')](_0x3837('0x4d'))){_0x2cb434[_0x3837('0x33')]=qs[_0x3837('0x33')](_0x300557[_0x3837('0x47')][_0x3837('0x33')]);_0x2cb434[_0x3837('0x31')]=qs[_0x3837('0x31')](_0x300557[_0x3837('0x47')]['offset']);}_0x2cb434[_0x3837('0x69')]=qs[_0x3837('0x4e')](_0x300557[_0x3837('0x47')][_0x3837('0x4e')]);_0x2cb434[_0x3837('0x4f')]=qs[_0x3837('0x48')](_[_0x3837('0x50')](_0x300557['query'],_0x5abbe9[_0x3837('0x48')]));_0x2cb434['where'][_0x3837('0x65')]=_0x58ea46['id'];if(_0x300557[_0x3837('0x47')][_0x3837('0x51')]){_0x2cb434[_0x3837('0x4f')]=_['merge'](_0x2cb434['where'],{'$or':_[_0x3837('0x45')](_0x2cb434[_0x3837('0x49')],function(_0x507624){var _0x56943b={};_0x56943b[_0x507624]={'$like':'%'+_0x300557[_0x3837('0x47')]['filter']+'%'};return _0x56943b;})});}_0x2cb434=_[_0x3837('0x53')]({},_0x2cb434,_0x300557[_0x3837('0x74')]);return db[_0x3837('0x70')]['count']({'where':_0x2cb434['where']})[_0x3837('0x21')](function(_0x1a5097){_0x321b24[_0x3837('0x34')]=_0x1a5097;if(_0x300557[_0x3837('0x47')]['includeAll']){_0x2cb434[_0x3837('0x5a')]=[{'model':db[_0x3837('0x75')],'as':_0x3837('0x76'),'required':![]},{'model':db[_0x3837('0x77')],'as':_0x3837('0x78'),'attributes':[_0x3837('0x3c'),'fullname','internal'],'required':![]},{'model':db['Tag'],'as':_0x3837('0x79'),'attributes':['id',_0x3837('0x3c'),_0x3837('0x7a')],'where':_0x300557[_0x3837('0x47')][_0x3837('0x7b')]?{'id':_0x300557[_0x3837('0x47')][_0x3837('0x7b')]}:undefined,'required':_0x300557['query'][_0x3837('0x7b')]?!![]:![]}];}return db[_0x3837('0x70')][_0x3837('0x55')](_0x2cb434);})['then'](function(_0x358ba1){_0x321b24[_0x3837('0x56')]=_0x358ba1;return _0x321b24;});}})[_0x3837('0x21')](respondWithFilteredResult(_0x526822,_0x2cb434))[_0x3837('0x2c')](handleError(_0x526822,null));};exports[_0x3837('0x7c')]=function(_0x475f4b,_0x5f42b9){var _0x59df0c=_0x475f4b[_0x3837('0x58')]['id'];var _0x1b806e=_0x475f4b[_0x3837('0x5c')];var _0x261af4=0xc8;var _0x1d98ed=null;return db[_0x3837('0x7d')]['transaction']({'isolationLevel':db['sequelize'][_0x3837('0x7e')]['ISOLATION_LEVELS'][_0x3837('0x7f')]},function(_0x46e73b){return db[_0x3837('0x40')][_0x3837('0x67')]({'where':{'id':_0x59df0c},'transaction':_0x46e73b})[_0x3837('0x21')](function(_0x1e07e5){if(_0x1e07e5){return db[_0x3837('0x80')][_0x3837('0x39')]({'where':{'FaxAccountId':_0x59df0c},'transaction':_0x46e73b})[_0x3837('0x21')](function(){var _0x525db6=_['map'](_0x1b806e,function(_0x34fb69){_0x34fb69[_0x3837('0x65')]=_0x59df0c;return _0x34fb69;});return db[_0x3837('0x80')][_0x3837('0x81')](_0x525db6,{'transaction':_0x46e73b});});}else{_0x261af4=0x194;_0x1d98ed=[];}});})['then'](function(){if(_0x261af4!==0x194){return db[_0x3837('0x80')]['findAndCountAll']({'where':{'FaxAccountId':_0x59df0c},'order':_0x3837('0x82')})[_0x3837('0x21')](function(_0x4c6e31){_0x1d98ed=_0x4c6e31;});}})[_0x3837('0x2c')](function(_0x3c29e0){_0x261af4=0x1f4;logger[_0x3837('0x27')](_0x3c29e0[_0x3837('0x83')]);if(_0x3c29e0[_0x3837('0x3c')]){delete _0x3c29e0['name'];}_0x1d98ed=_0x3c29e0;})['finally'](function(){if(_0x1d98ed===null){_0x5f42b9[_0x3837('0x2d')](_0x261af4);}else{if(_0x261af4===0x1f4){_0x5f42b9[_0x3837('0x2e')](_0x261af4)[_0x3837('0x3d')](_0x1d98ed);}else{_0x5f42b9[_0x3837('0x2e')](_0x261af4)[_0x3837('0x30')](_0x1d98ed);}}});};exports['getApplications']=function(_0x5ac2a0,_0x389ea7,_0x2d9170){var _0xb8ff95={};var _0x49078a={};var _0x19f83b;var _0x37ecc9;return db[_0x3837('0x40')]['findOne']({'where':{'id':_0x5ac2a0[_0x3837('0x58')]['id']}})['then'](handleEntityNotFound(_0x389ea7,null))['then'](function(_0x3ce33b){if(_0x3ce33b){_0x19f83b=_0x3ce33b;_0x49078a['model']=_[_0x3837('0x46')](db[_0x3837('0x80')][_0x3837('0x41')]);_0x49078a[_0x3837('0x47')]=_['keys'](_0x5ac2a0[_0x3837('0x47')]);_0x49078a[_0x3837('0x48')]=_[_0x3837('0x4a')](_0x49078a['model'],_0x49078a[_0x3837('0x47')]);_0xb8ff95[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x49078a['model'],qs[_0x3837('0x4b')](_0x5ac2a0[_0x3837('0x47')][_0x3837('0x4b')]));_0xb8ff95['attributes']=_0xb8ff95['attributes']['length']?_0xb8ff95[_0x3837('0x49')]:_0x49078a['model'];_0xb8ff95['order']=qs[_0x3837('0x4e')](_0x5ac2a0[_0x3837('0x47')][_0x3837('0x4e')]);_0xb8ff95['where']=qs[_0x3837('0x48')](_['pick'](_0x5ac2a0['query'],_0x49078a[_0x3837('0x48')]));if(_0x5ac2a0['query'][_0x3837('0x51')]){_0xb8ff95[_0x3837('0x4f')]=_[_0x3837('0x53')](_0xb8ff95[_0x3837('0x4f')],{'$or':_['map'](_0xb8ff95[_0x3837('0x49')],function(_0x2b4c5c){var _0x58710c={};_0x58710c[_0x2b4c5c]={'$like':'%'+_0x5ac2a0['query'][_0x3837('0x51')]+'%'};return _0x58710c;})});}_0xb8ff95=_[_0x3837('0x53')]({},_0xb8ff95,_0x5ac2a0['options']);return _0x19f83b['getApplications'](_0xb8ff95);}})[_0x3837('0x21')](function(_0x167520){if(_0x167520){_0x37ecc9=_0x167520[_0x3837('0x59')];if(!_0x5ac2a0[_0x3837('0x47')][_0x3837('0x4c')](_0x3837('0x4d'))){_0xb8ff95[_0x3837('0x33')]=qs['limit'](_0x5ac2a0[_0x3837('0x47')][_0x3837('0x33')]);_0xb8ff95[_0x3837('0x31')]=qs[_0x3837('0x31')](_0x5ac2a0[_0x3837('0x47')][_0x3837('0x31')]);}return _0x19f83b[_0x3837('0x84')](_0xb8ff95);}})['then'](function(_0x57c1bd){if(_0x57c1bd){return _0x57c1bd?{'count':_0x37ecc9,'rows':_0x57c1bd}:null;}})[_0x3837('0x21')](respondWithResult(_0x389ea7,null))[_0x3837('0x2c')](handleError(_0x389ea7,null));};function Extension(_0x580407,_0xad616e,_0x5f1673,_0x2798c8){this[_0x3837('0x85')]='from-voip-provider';this['exten']=_0x580407[_0x3837('0x86')];this[_0x3837('0x87')]=_0x2798c8;this['type']=_0x3837('0x88');this[_0x3837('0x89')]=_0x3837('0x8a');this[_0x3837('0x65')]=_0x580407['id'];this[_0x3837('0x82')]=_0xad616e;this[_0x3837('0x8b')]=_0x5f1673;}function createExtensionsReciveFax(_0x4d35c6){var _0x53f7a1=0x1;var _0x41506f=[];_0x41506f['push'](new Extension(_0x4d35c6,_0x53f7a1,'',_0x3837('0x8c')));_0x53f7a1+=0x1;_0x41506f['push'](new Extension(_0x4d35c6,_0x53f7a1,_0x3837('0x8d'),_0x3837('0x8e')));_0x53f7a1+=0x1;for(var _0x35fec0 in _0x4d35c6){if(_0x4d35c6[_0x3837('0x4c')](_0x35fec0)&&(_0x35fec0===_0x3837('0x8f')||_0x35fec0===_0x3837('0x86')||_0x35fec0===_0x3837('0x90')||_0x35fec0===_0x3837('0x91')||_0x35fec0===_0x3837('0x92')||_0x35fec0===_0x3837('0x93')||_0x35fec0===_0x3837('0x94')||_0x35fec0==='modem'||_0x35fec0==='t38timeout')){_0x41506f[_0x3837('0x95')](new Extension(_0x4d35c6,_0x53f7a1,_0x3837('0x96')+_0x35fec0+')='+_0x4d35c6[_0x35fec0],_0x3837('0x8e')));_0x53f7a1+=0x1;}}_0x41506f['push'](new Extension(_0x4d35c6,_0x53f7a1,'6',_0x3837('0x97')));_0x53f7a1+=0x1;_0x41506f[_0x3837('0x95')](new Extension(_0x4d35c6,_0x53f7a1,_0x3837('0x98'),'ReceiveFax'));_0x53f7a1=0x0;return _0x41506f;}exports[_0x3837('0x99')]=function(_0x334cde,_0x1e5cf0,_0x2372c4){var _0x2ab252;return db[_0x3837('0x7d')][_0x3837('0x9a')](function(_0x47fa1f){return db[_0x3837('0x40')][_0x3837('0x5b')](_0x334cde[_0x3837('0x5c')],{'transaction':_0x47fa1f})[_0x3837('0x21')](function(_0x23bf3e){_0x2ab252=_0x23bf3e[_0x3837('0x5e')]({'plain':!![]});return db['VoiceExtension'][_0x3837('0x81')](createExtensionsReciveFax(_0x2ab252),{'transaction':_0x47fa1f});});})[_0x3837('0x21')](function(){return _0x2ab252;})[_0x3837('0x21')](respondWithResult(_0x1e5cf0,null))['catch'](handleError(_0x1e5cf0,null));};exports['updateAccountApplications']=function(_0x2f5a17,_0x2da38b,_0x549d8b){var _0x412c62;return db[_0x3837('0x7d')]['transaction'](function(_0x567a45){return db[_0x3837('0x40')][_0x3837('0x38')](_0x2f5a17[_0x3837('0x5c')],{'where':{'id':_0x2f5a17[_0x3837('0x5c')]['id']},'transaction':_0x567a45})[_0x3837('0x21')](function(_0x120522){return db[_0x3837('0x9b')][_0x3837('0x39')]({'where':{'FaxAccountId':_0x2f5a17[_0x3837('0x5c')]['id']},'transaction':_0x567a45})[_0x3837('0x21')](function(_0x185d05){return db['VoiceExtension'][_0x3837('0x81')](createExtensionsReciveFax(_['omit'](_0x2f5a17['body'],[_0x3837('0x9c'),_0x3837('0x43'),_0x3837('0x9d'),_0x3837('0x9e'),_0x3837('0x9f'),_0x3837('0xa0')])),{'transaction':_0x567a45});});});})['then'](function(){return db[_0x3837('0x40')][_0x3837('0xa1')](_0x2f5a17[_0x3837('0x5c')]['id']);})['then'](respondWithResult(_0x2da38b,null))[_0x3837('0x2c')](handleError(_0x2da38b,null));};exports[_0x3837('0xa2')]=function(_0x54066,_0x1cd79b,_0x18c163){var _0xd49074={'raw':!![],'where':{}};var _0x27dd6e={};var _0x578e80={'count':0x0,'rows':[]};return db[_0x3837('0x40')][_0x3837('0x67')]({'where':{'id':_0x54066[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0x1cd79b,null))[_0x3837('0x21')](function(_0x2052f5){if(_0x2052f5){_0x27dd6e['model']=_[_0x3837('0x46')](db[_0x3837('0xa3')][_0x3837('0x41')]);_0x27dd6e['query']=_['keys'](_0x54066[_0x3837('0x47')]);_0x27dd6e[_0x3837('0x48')]=_['intersection'](_0x27dd6e[_0x3837('0x44')],_0x27dd6e[_0x3837('0x47')]);_0xd49074[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x27dd6e['model'],qs[_0x3837('0x4b')](_0x54066[_0x3837('0x47')][_0x3837('0x4b')]));_0xd49074[_0x3837('0x49')]=_0xd49074[_0x3837('0x49')]['length']?_0xd49074[_0x3837('0x49')]:_0x27dd6e[_0x3837('0x44')];if(!_0x54066[_0x3837('0x47')][_0x3837('0x4c')](_0x3837('0x4d'))){_0xd49074[_0x3837('0x33')]=qs[_0x3837('0x33')](_0x54066[_0x3837('0x47')][_0x3837('0x33')]);_0xd49074[_0x3837('0x31')]=qs[_0x3837('0x31')](_0x54066[_0x3837('0x47')][_0x3837('0x31')]);}_0xd49074['order']=qs[_0x3837('0x4e')](_0x54066[_0x3837('0x47')]['sort']);_0xd49074[_0x3837('0x4f')]=qs[_0x3837('0x48')](_[_0x3837('0x50')](_0x54066[_0x3837('0x47')],_0x27dd6e[_0x3837('0x48')]));_0xd49074[_0x3837('0x4f')]['FaxAccountId']=_0x2052f5['id'];if(_0x54066[_0x3837('0x47')][_0x3837('0x51')]){_0xd49074['where']=_[_0x3837('0x53')](_0xd49074[_0x3837('0x4f')],{'$or':_['map'](_0xd49074[_0x3837('0x49')],function(_0x55dd9d){var _0x1ac717={};_0x1ac717[_0x55dd9d]={'$like':'%'+_0x54066['query'][_0x3837('0x51')]+'%'};return _0x1ac717;})});}if(_0x54066[_0x3837('0x47')]['$gte']){var _0x4dd858=_0x54066[_0x3837('0x47')][_0x3837('0xa4')][_0x3837('0xa5')](',');var _0xc60031={};_0xc60031[_0x4dd858[0x0]]={'$gte':moment(_0x4dd858[0x1])[_0x3837('0xa6')](_0x3837('0xa7'))};_0xd49074[_0x3837('0x4f')]=_[_0x3837('0x53')](_0xd49074[_0x3837('0x4f')],_0xc60031);}_0xd49074=_[_0x3837('0x53')]({},_0xd49074,_0x54066[_0x3837('0x74')]);return db[_0x3837('0xa3')][_0x3837('0x34')]({'where':_0xd49074[_0x3837('0x4f')]})['then'](function(_0x2e1210){_0x578e80[_0x3837('0x34')]=_0x2e1210;if(_0x54066['query'][_0x3837('0x54')]){_0xd49074[_0x3837('0x5a')]=[{'all':!![]}];}return db[_0x3837('0xa3')][_0x3837('0x55')](_0xd49074);})['then'](function(_0x5d37dc){_0x578e80[_0x3837('0x56')]=_0x5d37dc;return _0x578e80;});}})[_0x3837('0x21')](respondWithFilteredResult(_0x1cd79b,_0xd49074))[_0x3837('0x2c')](handleError(_0x1cd79b,null));};exports[_0x3837('0x3d')]=function(_0x4ef605,_0x39ebd1,_0x3a3c4b){var _0x3e8e4b,_0x427848={},_0x3181b4;if(_0x4ef605[_0x3837('0x5c')]['to']){_0x3181b4=_0x4ef605[_0x3837('0x5c')]['to'][0x0];}return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0x4ef605[_0x3837('0x58')]['id']},'include':[{'model':db['CmList'],'as':_0x3837('0xa8'),'include':[{'model':db[_0x3837('0x75')],'as':_0x3837('0xa9'),'where':{'fax':_0x3181b4},'limit':0x1,'order':[[_0x3837('0x9e'),'DESC']]}]}]})[_0x3837('0x21')](handleEntityNotFound(_0x39ebd1,null))['then'](function(_0x2c3df0){_0x3e8e4b=_0x2c3df0;if(_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')]&&_0x4ef605['body'][_0x3837('0xaa')][_0x3837('0x59')]){for(var _0x174f13=0x0;_0x174f13<_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][_0x3837('0x59')];_0x174f13+=0x1){_0x4ef605['body'][_0x3837('0xaa')][_0x174f13]={'filename':_0x4ef605['body'][_0x3837('0xaa')][_0x174f13][_0x3837('0x3c')],'id':_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][_0x174f13]['id'],'path':path[_0x3837('0xab')](config['root'],'server/files/attachments',_0x4ef605['body'][_0x3837('0xaa')][_0x174f13][_0x3837('0xac')])};}}return respondWithRpcPromise(_0x3837('0xad'),_0x3837('0xad'),{'FaxAccountId':_[_0x3837('0xae')](_0x4ef605[_0x3837('0x58')]['id'])?undefined:_0x4ef605['params']['id'],'path':_[_0x3837('0xae')](_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][0x0][_0x3837('0x8')])?undefined:_0x4ef605[_0x3837('0x5c')]['attachments'][0x0]['path'],'fax':_[_0x3837('0xae')](_0x4ef605[_0x3837('0x5c')]['to'][0x0])?undefined:_0x4ef605[_0x3837('0x5c')]['to'][0x0]},client9002);})['then'](function(){if(_0x3e8e4b){if(_[_0x3837('0xae')](_0x4ef605['body'][_0x3837('0xaf')])){_0x4ef605[_0x3837('0x5c')][_0x3837('0xaf')]=util[_0x3837('0xa6')](_0x3837('0xb0'),_0x3e8e4b[_0x3837('0x3c')],_0x3e8e4b[_0x3837('0xb1')]);}if(_0x3e8e4b[_0x3837('0xa8')]){if(_0x3e8e4b[_0x3837('0xa8')]['Contacts'][_0x3837('0x59')]){return _0x3e8e4b[_0x3837('0xa8')][_0x3837('0xa9')][0x0];}else{return db['CmContact'][_0x3837('0x5b')](_[_0x3837('0x1a')](_0x4ef605[_0x3837('0x5c')],{'firstName':_0x4ef605['body']['to'][0x0],'phone':_0x4ef605[_0x3837('0x5c')]['to'][0x0],'fax':_0x4ef605[_0x3837('0x5c')]['to'][0x0],'ListId':_0x3e8e4b[_0x3837('0xa0')]}));}}else{throw new Error(_0x3837('0xb2'));}}else{throw new Error(_0x3837('0xb3'));}})[_0x3837('0x21')](function(_0x816f2b){if(_0x816f2b){return db['FaxInteraction'][_0x3837('0x5f')]({'where':{'ContactId':_0x816f2b['id'],'closed':![],'FaxAccountId':_0x3e8e4b['id']}})['then'](function(_0x259cb1){if(_0x259cb1){return[_0x259cb1,![]];}return db['FaxInteraction'][_0x3837('0x5b')]({'UserId':_0x4ef605[_0x3837('0x5d')]['id'],'ContactId':_0x816f2b['id'],'FaxAccountId':_0x3e8e4b['id'],'fax':_0x4ef605[_0x3837('0x5c')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x3837('0x53')](_0x4ef605['body'],{'read':![],'body':_0x4ef605[_0x3837('0x5c')]['attachments'][0x0][_0x3837('0xb4')],'FaxAccountId':_0x3e8e4b['id'],'UserId':_0x4ef605[_0x3837('0x5d')]['id'],'ContactId':_0x816f2b['id'],'AttachmentId':_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][0x0]['id']})]},{'include':[{'model':db[_0x3837('0xa3')],'as':'Messages'}]})[_0x3837('0x21')](function(_0x441c84){return[_0x441c84,!![]];});});}else{throw new Error(_0x3837('0xb5'));}})['spread'](function(_0x31c020,_0x1b424e){if(_0x1b424e){return _0x31c020;}return db[_0x3837('0xa3')][_0x3837('0x5b')]({'direction':_0x3837('0xb6'),'read':![],'body':_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][0x0][_0x3837('0xb4')],'FaxAccountId':_0x3e8e4b['id'],'FaxInteractionId':_0x31c020['id'],'UserId':_0x4ef605[_0x3837('0x5d')]['id'],'ContactId':_0x31c020['ContactId'],'AttachmentId':_0x4ef605[_0x3837('0x5c')]['attachments'][0x0]['id']})[_0x3837('0x21')](function(_0x36573d){_0x31c020[_0x3837('0xb7')][_0x3837('0xb8')]=[];_0x31c020[_0x3837('0xb7')][_0x3837('0xb8')][_0x3837('0x95')](_0x36573d[_0x3837('0xb7')]);return _0x31c020;});})[_0x3837('0x21')](function(_0x4e91a3){respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x4ef605[_0x3837('0x58')]['id'])?undefined:_0x4ef605[_0x3837('0x58')]['id'],'path':_[_0x3837('0xae')](_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][0x0]['path'])?undefined:_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][0x0][_0x3837('0x8')],'fax':_[_0x3837('0xae')](_0x4ef605['body']['to'][0x0])?undefined:_0x4ef605[_0x3837('0x5c')]['to'][0x0],'AttachmentId':_0x4ef605[_0x3837('0x5c')][_0x3837('0xaa')][0x0]['id']},client9002)['then'](function(_0x2fea92){logger[_0x3837('0x22')](_0x3837('0xb9'),_0x2fea92);})[_0x3837('0x2c')](function(_0x26ed2e){logger[_0x3837('0x22')](_0x3837('0xb9'),_0x26ed2e);});return _0x4e91a3;})[_0x3837('0x21')](respondWithResult(_0x39ebd1,null))['catch'](handleError(_0x39ebd1,null));};exports[_0x3837('0xba')]=function(_0x285dea,_0xb9ab21,_0x40c196){return db['FaxAccount'][_0x3837('0x5f')]({'where':{'id':_0x285dea[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0xb9ab21,null))[_0x3837('0x21')](function(_0x2ffae5){if(_0x2ffae5){return _0x2ffae5['addAgents'](_0x285dea[_0x3837('0x5c')][_0x3837('0x6b')],_[_0x3837('0x72')](_0x285dea[_0x3837('0x5c')],[_0x3837('0x6b'),'id'])||{})[_0x3837('0xbb')](function(_0x274dfa){for(var _0x19898b=0x0;_0x19898b<_0x285dea[_0x3837('0x5c')][_0x3837('0x6b')][_0x3837('0x59')];_0x19898b+=0x1){socket[_0x3837('0xbc')]('userFaxAccount:save',{'UserId':Number(_0x285dea[_0x3837('0x5c')]['ids'][_0x19898b]),'FaxAccountId':Number(_0x285dea[_0x3837('0x58')]['id'])});}return _0x274dfa;});}})['then'](respondWithResult(_0xb9ab21,null))[_0x3837('0x2c')](handleError(_0xb9ab21,null));};exports[_0x3837('0xbd')]=function(_0x44d10a,_0xec5c1d,_0x244677){return db[_0x3837('0x40')][_0x3837('0x5f')]({'where':{'id':_0x44d10a[_0x3837('0x58')]['id']}})[_0x3837('0x21')](handleEntityNotFound(_0xec5c1d,null))[_0x3837('0x21')](function(_0x5f22fa){if(_0x5f22fa){return _0x5f22fa[_0x3837('0xbd')](_0x44d10a[_0x3837('0x47')][_0x3837('0x6b')])[_0x3837('0x21')](function(){if(_['isArray'](_0x44d10a[_0x3837('0x47')][_0x3837('0x6b')])){for(var _0x2c9c97=0x0;_0x2c9c97<_0x44d10a[_0x3837('0x47')][_0x3837('0x6b')][_0x3837('0x59')];_0x2c9c97+=0x1){socket[_0x3837('0xbc')](_0x3837('0xbe'),{'UserId':Number(_0x44d10a[_0x3837('0x47')]['ids'][_0x2c9c97]),'FaxAccountId':Number(_0x44d10a['params']['id'])});}}else{socket[_0x3837('0xbc')](_0x3837('0xbe'),{'UserId':Number(_0x44d10a['query'][_0x3837('0x6b')]),'FaxAccountId':Number(_0x44d10a['params']['id'])});}});}})['then'](respondWithStatusCode(_0xec5c1d,null))[_0x3837('0x2c')](handleError(_0xec5c1d,null));};exports[_0x3837('0xbf')]=function(_0x3220f2,_0x2fe253,_0x187278){var _0x293bc9={};var _0x21eadd={};var _0x3db2cc;var _0x134c46;return db[_0x3837('0x40')][_0x3837('0x67')]({'where':{'id':_0x3220f2[_0x3837('0x58')]['id']}})['then'](handleEntityNotFound(_0x2fe253,null))[_0x3837('0x21')](function(_0x14d884){if(_0x14d884){_0x3db2cc=_0x14d884;_0x21eadd['model']=_[_0x3837('0x46')](db[_0x3837('0x77')][_0x3837('0x41')]);_0x21eadd[_0x3837('0x47')]=_[_0x3837('0x46')](_0x3220f2[_0x3837('0x47')]);_0x21eadd[_0x3837('0x48')]=_[_0x3837('0x4a')](_0x21eadd[_0x3837('0x44')],_0x21eadd[_0x3837('0x47')]);_0x293bc9[_0x3837('0x49')]=_[_0x3837('0x4a')](_0x21eadd[_0x3837('0x44')],qs[_0x3837('0x4b')](_0x3220f2['query'][_0x3837('0x4b')]));_0x293bc9[_0x3837('0x49')]=_0x293bc9[_0x3837('0x49')][_0x3837('0x59')]?_0x293bc9['attributes']:_0x21eadd[_0x3837('0x44')];_0x293bc9[_0x3837('0x69')]=qs[_0x3837('0x4e')](_0x3220f2[_0x3837('0x47')][_0x3837('0x4e')]);_0x293bc9['where']=qs['filters'](_[_0x3837('0x50')](_0x3220f2[_0x3837('0x47')],_0x21eadd['filters']));if(_0x3220f2[_0x3837('0x47')]['filter']){_0x293bc9[_0x3837('0x4f')]=_['merge'](_0x293bc9[_0x3837('0x4f')],{'$or':_['map'](_0x293bc9[_0x3837('0x49')],function(_0x23232f){var _0x2c4f37={};_0x2c4f37[_0x23232f]={'$like':'%'+_0x3220f2[_0x3837('0x47')][_0x3837('0x51')]+'%'};return _0x2c4f37;})});}_0x293bc9=_[_0x3837('0x53')]({},_0x293bc9,_0x3220f2[_0x3837('0x74')]);return _0x3db2cc['getAgents'](_0x293bc9);}})[_0x3837('0x21')](function(_0x3c2e81){if(_0x3c2e81){_0x134c46=_0x3c2e81[_0x3837('0x59')];if(!_0x3220f2[_0x3837('0x47')][_0x3837('0x4c')]('nolimit')){_0x293bc9['limit']=qs[_0x3837('0x33')](_0x3220f2['query'][_0x3837('0x33')]);_0x293bc9[_0x3837('0x31')]=qs[_0x3837('0x31')](_0x3220f2[_0x3837('0x47')]['offset']);}return _0x3db2cc[_0x3837('0xbf')](_0x293bc9);}})[_0x3837('0x21')](function(_0x186035){if(_0x186035){return _0x186035?{'count':_0x134c46,'rows':_0x186035}:null;}})[_0x3837('0x21')](respondWithResult(_0x2fe253,null))[_0x3837('0x2c')](handleError(_0x2fe253,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 1f20b64..c33acb1 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 _0xae60=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxAccount','setMaxListeners','remove','emit'];(function(_0x467cb0,_0x303070){var _0x2153f7=function(_0x51775a){while(--_0x51775a){_0x467cb0['push'](_0x467cb0['shift']());}};_0x2153f7(++_0x303070);}(_0xae60,0x18f));var _0x0ae6=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xae60[_0x26f702];return _0x11417d;};'use strict';var EventEmitter=require(_0x0ae6('0x0'));var FaxAccount=require(_0x0ae6('0x1'))['db'][_0x0ae6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x0ae6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0ae6('0x4')};function emitEvent(_0x3c7e5e){return function(_0x215e86,_0x52d10e,_0x56d9ce){FaxAccountEvents['emit'](_0x3c7e5e+':'+_0x215e86['id'],_0x215e86);FaxAccountEvents[_0x0ae6('0x5')](_0x3c7e5e,_0x215e86);_0x56d9ce(null);};}for(var e in events){if(events[_0x0ae6('0x6')](e)){var event=events[e];FaxAccount[_0x0ae6('0x7')](e,emitEvent(event));}}module[_0x0ae6('0x8')]=FaxAccountEvents; \ No newline at end of file +var _0x333e=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x333e,0x113));var _0xe333=function(_0x4f464a,_0x3d48ca){_0x4f464a=_0x4f464a-0x0;var _0x453930=_0x333e[_0x4f464a];return _0x453930;};'use strict';var EventEmitter=require(_0xe333('0x0'));var FaxAccount=require(_0xe333('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe333('0x2'),'afterUpdate':_0xe333('0x3'),'afterDestroy':_0xe333('0x4')};function emitEvent(_0x4017ae){return function(_0x27bff7,_0x5a339d,_0xd60c6c){FaxAccountEvents[_0xe333('0x5')](_0x4017ae+':'+_0x27bff7['id'],_0x27bff7);FaxAccountEvents[_0xe333('0x5')](_0x4017ae,_0x27bff7);_0xd60c6c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xe333('0x6')](e,emitEvent(event));}}module[_0xe333('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index ec7b70c..a8ea40f 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 _0x884e=['lodash','util','../../config/logger','api','moment','request-promise','path','exports','FaxAccount'];(function(_0x2e38b9,_0x367528){var _0x53fb4d=function(_0x19a656){while(--_0x19a656){_0x2e38b9['push'](_0x2e38b9['shift']());}};_0x53fb4d(++_0x367528);}(_0x884e,0xfc));var _0xe884=function(_0x2b9a73,_0x57885f){_0x2b9a73=_0x2b9a73-0x0;var _0x20f360=_0x884e[_0x2b9a73];return _0x20f360;};'use strict';var _=require(_0xe884('0x0'));var util=require(_0xe884('0x1'));var logger=require(_0xe884('0x2'))(_0xe884('0x3'));var moment=require(_0xe884('0x4'));var BPromise=require('bluebird');var rp=require(_0xe884('0x5'));var fs=require('fs');var path=require(_0xe884('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0xe884('0x7')]=function(_0x10be02,_0x3c2e17){return _0x10be02['define'](_0xe884('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe037=['FaxAccount','fax_accounts','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','exports','define'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe037,0xf4));var _0x7e03=function(_0x31cc0e,_0x24ba4c){_0x31cc0e=_0x31cc0e-0x0;var _0x144862=_0xe037[_0x31cc0e];return _0x144862;};'use strict';var _=require(_0x7e03('0x0'));var util=require(_0x7e03('0x1'));var logger=require(_0x7e03('0x2'))('api');var moment=require(_0x7e03('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e03('0x4'));var rimraf=require(_0x7e03('0x5'));var config=require(_0x7e03('0x6'));var attributes=require('./faxAccount.attributes');module[_0x7e03('0x7')]=function(_0x193781,_0x423b38){return _0x193781[_0x7e03('0x8')](_0x7e03('0x9'),attributes,{'tableName':_0x7e03('0xa'),'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 1bebee7..872fa46 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 _0xca6c=['CmList','List','Contacts','DESC','FaxApplication','Applications','applications','list','orderBy','priority','contact','create','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','ContactId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','./faxAccount.socket','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetFaxAccount','FaxAccount','findAll','options','where','attributes','limit','map','include','model','then','stringify','NotifyFaxAccount','body','fax','CmContact','describe','no\x20available\x20attributes','keys','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','find','account'];(function(_0x2c7f1e,_0x11ca53){var _0x5027fa=function(_0x5d9753){while(--_0x5d9753){_0x2c7f1e['push'](_0x2c7f1e['shift']());}};_0x5027fa(++_0x11ca53);}(_0xca6c,0x126));var _0xcca6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xca6c[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xcca6('0x0'));var util=require(_0xcca6('0x1'));var moment=require('moment');var BPromise=require(_0xcca6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcca6('0x3'));var db=require(_0xcca6('0x4'))['db'];var utils=require(_0xcca6('0x5'));var logger=require(_0xcca6('0x6'))(_0xcca6('0x7'));var config=require(_0xcca6('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcca6('0x9')]({'port':0x232c});config[_0xcca6('0xa')]=_[_0xcca6('0xb')](config[_0xcca6('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcca6('0xa')]));require(_0xcca6('0xc'))['register'](socket);function respondWithRpcPromise(_0x5b92f8,_0xe59d3f,_0x28a5eb){return new BPromise(function(_0x526506,_0x4ee231){return client[_0xcca6('0xd')](_0x5b92f8,_0x28a5eb)['then'](function(_0x11d6a8){logger[_0xcca6('0xe')](_0xcca6('0xf'),_0xe59d3f,_0xcca6('0x10'));logger[_0xcca6('0x11')](_0xcca6('0x12'),_0xe59d3f,_0xcca6('0x10'),JSON['stringify'](_0x11d6a8));if(_0x11d6a8[_0xcca6('0x13')]){if(_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x14')]===0x1f4){logger[_0xcca6('0x13')](_0xcca6('0xf'),_0xe59d3f,_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);return _0x4ee231(_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);}logger['error'](_0xcca6('0xf'),_0xe59d3f,_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);return _0x526506(_0x11d6a8[_0xcca6('0x13')][_0xcca6('0x15')]);}else{logger['info'](_0xcca6('0xf'),_0xe59d3f,_0xcca6('0x10'));_0x526506(_0x11d6a8['result'][_0xcca6('0x15')]);}})['catch'](function(_0xcf8f9a){logger[_0xcca6('0x13')]('FaxAccount,\x20%s,\x20%s',_0xe59d3f,_0xcf8f9a);_0x4ee231(_0xcf8f9a);});});}exports[_0xcca6('0x16')]=function(_0x285491){var _0x5ade3e=this;return new Promise(function(_0x45e483,_0x181a99){return db[_0xcca6('0x17')][_0xcca6('0x18')]({'raw':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')][_0xcca6('0x1a')]||null:null,'attributes':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')][_0xcca6('0x1b')]||null:null,'limit':_0x285491[_0xcca6('0x19')]?_0x285491[_0xcca6('0x19')][_0xcca6('0x1c')]||null:null,'include':_0x285491[_0xcca6('0x19')]?_0x285491['options']['include']?_[_0xcca6('0x1d')](_0x285491[_0xcca6('0x19')][_0xcca6('0x1e')],function(_0xbaa277){return{'model':db[_0xbaa277[_0xcca6('0x1f')]],'as':_0xbaa277['as'],'attributes':_0xbaa277[_0xcca6('0x1b')],'include':_0xbaa277['include']?_[_0xcca6('0x1d')](_0xbaa277['include'],function(_0x47672e){return{'model':db[_0x47672e[_0xcca6('0x1f')]],'as':_0x47672e['as'],'attributes':_0x47672e[_0xcca6('0x1b')],'include':_0x47672e[_0xcca6('0x1e')]?_[_0xcca6('0x1d')](_0x47672e[_0xcca6('0x1e')],function(_0x149fc3){return{'model':db[_0x149fc3[_0xcca6('0x1f')]],'as':_0x149fc3['as'],'attributes':_0x149fc3['attributes']};}):[]};}):[]};}):[]:[]})[_0xcca6('0x20')](function(_0x4bcd74){logger[_0xcca6('0xe')](_0xcca6('0x16'),_0x285491);logger[_0xcca6('0x11')](_0xcca6('0x16'),_0x285491,JSON[_0xcca6('0x21')](_0x4bcd74));_0x45e483(_0x4bcd74);})['catch'](function(_0x185404){logger[_0xcca6('0x13')](_0xcca6('0x16'),_0x185404['message'],_0x285491);_0x181a99(_0x5ade3e[_0xcca6('0x13')](0x1f4,_0x185404[_0xcca6('0x15')]));});});};exports[_0xcca6('0x22')]=function(_0xd2a990,_0x1cc795,_0x28e361){var _0x352831=this;return new Promise(function(_0x3d9033,_0x19b4b9){var _0x16309c={'body':_0xd2a990[_0xcca6('0x23')],'channel':_0xcca6('0x24')};var _0x1d1bff=[];var _0x591d6b=[];var _0xdebc6d={};return db[_0xcca6('0x25')][_0xcca6('0x26')]()[_0xcca6('0x20')](function(_0x590371){if(!_0x590371){throw new db['Sequelize']['ValidationError'](_0xcca6('0x27'));}_0x1d1bff=_['difference'](_[_0xcca6('0x28')](_0x590371),[_0xcca6('0x29'),_0xcca6('0x2a')]);_0x591d6b=_['difference'](_[_0xcca6('0x28')](_0x590371),[_0xcca6('0x29'),_0xcca6('0x2a'),_0xcca6('0x2b'),'ListId']);if(_0xd2a990['body']['id']){delete _0xd2a990[_0xcca6('0x23')]['id'];}if(_[_0xcca6('0x2c')](_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')])){throw new db[(_0xcca6('0x2e'))][(_0xcca6('0x2f'))](_0xcca6('0x30'));}if(_['isNil'](_0xd2a990[_0xcca6('0x23')][_0xcca6('0x23')])||_0xd2a990[_0xcca6('0x23')]['body']===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0xd2a990[_0xcca6('0x23')][_0xcca6('0x31')])){throw new db['Sequelize']['ValidationError'](_0xcca6('0x32')+_0x591d6b);}if(!_[_0xcca6('0x33')](_0x591d6b,_0xd2a990[_0xcca6('0x23')][_0xcca6('0x31')])){throw new db[(_0xcca6('0x2e'))][(_0xcca6('0x2f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x591d6b);}_0xdebc6d[_0xd2a990[_0xcca6('0x23')]['mapKey']]=_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')];})['then'](function(){return db[_0xcca6('0x17')][_0xcca6('0x34')]({'where':{'id':_0xd2a990[_0xcca6('0x35')]['id']},'include':[{'model':db[_0xcca6('0x36')],'as':_0xcca6('0x37'),'include':[{'model':db[_0xcca6('0x25')],'as':_0xcca6('0x38'),'where':_0xdebc6d,'limit':0x1,'order':[[_0xcca6('0x2a'),_0xcca6('0x39')]]}]},{'model':db[_0xcca6('0x3a')],'as':_0xcca6('0x3b')}]});})['then'](function(_0x515901){if(_0x515901&&_0x515901[_0xcca6('0x37')]){var _0x364318=_0x515901['get']({'plain':!![]});_0x16309c['account']=_0x364318;_0x16309c[_0xcca6('0x3c')]=_0x364318['Applications'];_0x16309c[_0xcca6('0x3d')]=_0x364318[_0xcca6('0x37')];_0x16309c[_0xcca6('0x3c')]=_[_0xcca6('0x3e')](_0x16309c['applications'],[_0xcca6('0x3f')],['asc']);if(_0x16309c[_0xcca6('0x35')][_0xcca6('0x3b')]){delete _0x16309c[_0xcca6('0x35')][_0xcca6('0x3b')];}if(_0x16309c['account'][_0xcca6('0x37')]&&_0x16309c[_0xcca6('0x35')]['List'][_0xcca6('0x38')]['length']){return _0x16309c[_0xcca6('0x35')]['List'][_0xcca6('0x38')][0x0];}var _0x5aa046=_['defaults'](_0xd2a990[_0xcca6('0x23')],{'firstName':_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')],'ListId':_0x364318['ListId']});_0x5aa046[_0xd2a990['body'][_0xcca6('0x31')]]=_0xd2a990[_0xcca6('0x23')][_0xcca6('0x2d')];return db['CmContact']['create'](_0x5aa046,{'fields':_0x1d1bff,'raw':!![]});}})[_0xcca6('0x20')](function(_0x7423ac){_0x16309c[_0xcca6('0x40')]=_0x7423ac;if(_0x7423ac){var _0x791aca={'ContactId':_0x7423ac['id'],'FaxAccountId':_0xd2a990[_0xcca6('0x35')]['id'],'fax':_0x7423ac[_0xcca6('0x24')]};return db['FaxInteraction'][_0xcca6('0x34')]({'where':{'ContactId':_0x7423ac['id'],'closed':![],'FaxAccountId':_0xd2a990['account']['id']}})[_0xcca6('0x20')](function(_0x523361){if(_0x523361){return[_0x523361,![]];}return db['FaxInteraction'][_0xcca6('0x41')](_0x791aca)[_0xcca6('0x20')](function(_0x21464e){return[_0x21464e,!![]];});});}else{throw new Error(_0xcca6('0x42'));}})[_0xcca6('0x43')](function(_0xae5b06,_0x3a976c){var _0x1c4a8f=_0xae5b06[_0xcca6('0x44')]({'plain':!![]});if(_0x3a976c){if(_0x16309c[_0xcca6('0x35')][_0xcca6('0x45')]){_0x16309c[_0xcca6('0x3c')]['push']({'id':0x0,'priority':_0x16309c[_0xcca6('0x3c')]['length']+0x1,'app':_0xcca6('0x46'),'appdata':_0xcca6('0x47'),'interval':_0xcca6('0x48')});}_0x1c4a8f['created']=!![];}else{_0x1c4a8f[_0xcca6('0x49')]=![];}_0x16309c[_0xcca6('0x4a')]=_0x1c4a8f;return db['FaxMessage'][_0xcca6('0x41')]({'body':_0xd2a990[_0xcca6('0x23')][_0xcca6('0x23')],'FaxAccountId':_0xd2a990[_0xcca6('0x35')]['id'],'FaxInteractionId':_0xae5b06['id'],'direction':'in','ContactId':_0xae5b06[_0xcca6('0x4b')],'AttachmentId':_0xd2a990[_0xcca6('0x23')]['AttachmentId']});})['then'](function(_0x15a85b){_0x16309c['message']=_0x15a85b;if(!_0x16309c[_0xcca6('0x4a')][_0xcca6('0x4c')])return;return db[_0xcca6('0x4d')]['find']({'attributes':['id',_0xcca6('0x4e')],'where':{'id':_0x16309c[_0xcca6('0x4a')][_0xcca6('0x4c')]}});})[_0xcca6('0x20')](function(_0x26c7cd){if(_0x26c7cd){_0x16309c[_0xcca6('0x3c')][_0xcca6('0x4f')]({'id':0x0,'priority':0x0,'app':_0xcca6('0x50'),'appdata':_0x26c7cd['name']+','+(_0x16309c[_0xcca6('0x35')][_0xcca6('0x51')]||0xa),'interval':_0xcca6('0x48')});}if(!_0x16309c[_0xcca6('0x4a')]['queueId'])return;return db['FaxQueue']['find']({'attributes':['id',_0xcca6('0x4e')],'where':{'id':_0x16309c['interaction'][_0xcca6('0x52')]}});})[_0xcca6('0x20')](function(_0x2e6da8){if(_0x2e6da8){_0x16309c[_0xcca6('0x3c')]['unshift']({'id':0x0,'priority':0x1,'app':_0xcca6('0x53'),'appdata':_0x2e6da8['name']+','+(_0x16309c['account'][_0xcca6('0x54')]||0x12c),'interval':_0xcca6('0x48')});}return respondWithRpcPromise(_0xcca6('0x55'),'startRouting',_0x16309c);})[_0xcca6('0x20')](function(_0x58c40f){_0x3d9033(_0x58c40f);})[_0xcca6('0x56')](function(_0x106d33){_0x19b4b9(_0x352831[_0xcca6('0x13')](0x1f4,_0x106d33['message']));});});}; \ No newline at end of file +var _0xdd85=['List','FaxApplication','Applications','priority','asc','Contacts','length','ListId','create','FaxInteraction','spread','get','autoclose','applications','push','close','*,*,*,*','created','interaction','FaxMessage','AttachmentId','User','name','UserId','unshift','agent','waitForTheAssignedAgent','queueId','FaxQueue','waitForTheAssignedQueue','startRouting','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','register','request','then','info','request\x20sent','debug','code','error','FaxAccount,\x20%s,\x20%s','message','result','catch','FaxAccount','options','where','attributes','include','model','map','GetFaxAccount','stringify','NotifyFaxAccount','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','find','account','CmList'];(function(_0x39684d,_0x1169eb){var _0x335b0a=function(_0x475fb6){while(--_0x475fb6){_0x39684d['push'](_0x39684d['shift']());}};_0x335b0a(++_0x1169eb);}(_0xdd85,0x124));var _0x5dd8=function(_0x4c3ffc,_0xed9c52){_0x4c3ffc=_0x4c3ffc-0x0;var _0x3e5a36=_0xdd85[_0x4c3ffc];return _0x3e5a36;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5dd8('0x0'));var BPromise=require(_0x5dd8('0x1'));var rs=require(_0x5dd8('0x2'));var fs=require('fs');var Redis=require(_0x5dd8('0x3'));var db=require(_0x5dd8('0x4'))['db'];var utils=require(_0x5dd8('0x5'));var logger=require('../../config/logger')(_0x5dd8('0x6'));var config=require(_0x5dd8('0x7'));var jayson=require(_0x5dd8('0x8'));var client=jayson[_0x5dd8('0x9')]['http']({'port':0x232c});config['redis']=_[_0x5dd8('0xa')](config['redis'],{'host':_0x5dd8('0xb'),'port':0x18eb});var socket=require(_0x5dd8('0xc'))(new Redis(config[_0x5dd8('0xd')]));require(_0x5dd8('0xe'))[_0x5dd8('0xf')](socket);function respondWithRpcPromise(_0x2cb9c1,_0x594b32,_0x506ff3){return new BPromise(function(_0x298725,_0x3e297e){return client[_0x5dd8('0x10')](_0x2cb9c1,_0x506ff3)[_0x5dd8('0x11')](function(_0x358d95){logger[_0x5dd8('0x12')]('FaxAccount,\x20%s,\x20%s',_0x594b32,_0x5dd8('0x13'));logger[_0x5dd8('0x14')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x594b32,_0x5dd8('0x13'),JSON['stringify'](_0x358d95));if(_0x358d95['error']){if(_0x358d95['error'][_0x5dd8('0x15')]===0x1f4){logger[_0x5dd8('0x16')]('FaxAccount,\x20%s,\x20%s',_0x594b32,_0x358d95['error']['message']);return _0x3e297e(_0x358d95['error']['message']);}logger['error'](_0x5dd8('0x17'),_0x594b32,_0x358d95[_0x5dd8('0x16')][_0x5dd8('0x18')]);return _0x298725(_0x358d95['error'][_0x5dd8('0x18')]);}else{logger['info'](_0x5dd8('0x17'),_0x594b32,_0x5dd8('0x13'));_0x298725(_0x358d95[_0x5dd8('0x19')][_0x5dd8('0x18')]);}})[_0x5dd8('0x1a')](function(_0x2aa417){logger['error']('FaxAccount,\x20%s,\x20%s',_0x594b32,_0x2aa417);_0x3e297e(_0x2aa417);});});}exports['GetFaxAccount']=function(_0x4104b2){var _0x27a641=this;return new Promise(function(_0x5826a6,_0x5ac7d2){return db[_0x5dd8('0x1b')]['findAll']({'raw':_0x4104b2[_0x5dd8('0x1c')]?_0x4104b2['options']['raw']===undefined?!![]:![]:!![],'where':_0x4104b2[_0x5dd8('0x1c')]?_0x4104b2[_0x5dd8('0x1c')][_0x5dd8('0x1d')]||null:null,'attributes':_0x4104b2[_0x5dd8('0x1c')]?_0x4104b2[_0x5dd8('0x1c')][_0x5dd8('0x1e')]||null:null,'limit':_0x4104b2[_0x5dd8('0x1c')]?_0x4104b2[_0x5dd8('0x1c')]['limit']||null:null,'include':_0x4104b2[_0x5dd8('0x1c')]?_0x4104b2['options'][_0x5dd8('0x1f')]?_['map'](_0x4104b2['options'][_0x5dd8('0x1f')],function(_0x3a6e16){return{'model':db[_0x3a6e16[_0x5dd8('0x20')]],'as':_0x3a6e16['as'],'attributes':_0x3a6e16[_0x5dd8('0x1e')],'include':_0x3a6e16['include']?_[_0x5dd8('0x21')](_0x3a6e16[_0x5dd8('0x1f')],function(_0x4319ec){return{'model':db[_0x4319ec[_0x5dd8('0x20')]],'as':_0x4319ec['as'],'attributes':_0x4319ec[_0x5dd8('0x1e')],'include':_0x4319ec[_0x5dd8('0x1f')]?_[_0x5dd8('0x21')](_0x4319ec[_0x5dd8('0x1f')],function(_0x1cc381){return{'model':db[_0x1cc381[_0x5dd8('0x20')]],'as':_0x1cc381['as'],'attributes':_0x1cc381['attributes']};}):[]};}):[]};}):[]:[]})[_0x5dd8('0x11')](function(_0x24aba3){logger[_0x5dd8('0x12')](_0x5dd8('0x22'),_0x4104b2);logger[_0x5dd8('0x14')](_0x5dd8('0x22'),_0x4104b2,JSON[_0x5dd8('0x23')](_0x24aba3));_0x5826a6(_0x24aba3);})[_0x5dd8('0x1a')](function(_0x57dc76){logger[_0x5dd8('0x16')](_0x5dd8('0x22'),_0x57dc76[_0x5dd8('0x18')],_0x4104b2);_0x5ac7d2(_0x27a641['error'](0x1f4,_0x57dc76[_0x5dd8('0x18')]));});});};exports[_0x5dd8('0x24')]=function(_0x35cedb,_0x24f15c,_0x572775){var _0x3ea964=this;return new Promise(function(_0x5702d8,_0x2a4144){var _0xe1025={'body':_0x35cedb[_0x5dd8('0x25')],'channel':_0x5dd8('0x26')};var _0x3cf5bb=[];var _0x4afbce=[];var _0x541c33={};return db[_0x5dd8('0x27')][_0x5dd8('0x28')]()[_0x5dd8('0x11')](function(_0x1a3d37){if(!_0x1a3d37){throw new db[(_0x5dd8('0x29'))][(_0x5dd8('0x2a'))](_0x5dd8('0x2b'));}_0x3cf5bb=_[_0x5dd8('0x2c')](_[_0x5dd8('0x2d')](_0x1a3d37),[_0x5dd8('0x2e'),_0x5dd8('0x2f')]);_0x4afbce=_[_0x5dd8('0x2c')](_[_0x5dd8('0x2d')](_0x1a3d37),[_0x5dd8('0x2e'),_0x5dd8('0x2f'),'CompanyId','ListId']);if(_0x35cedb[_0x5dd8('0x25')]['id']){delete _0x35cedb[_0x5dd8('0x25')]['id'];}if(_[_0x5dd8('0x30')](_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x31')])){throw new db[(_0x5dd8('0x29'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x5dd8('0x30')](_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x25')])||_0x35cedb['body'][_0x5dd8('0x25')]===''){throw new db[(_0x5dd8('0x29'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5dd8('0x30')](_0x35cedb[_0x5dd8('0x25')]['mapKey'])){throw new db['Sequelize'][(_0x5dd8('0x2a'))](_0x5dd8('0x32')+_0x4afbce);}if(!_[_0x5dd8('0x33')](_0x4afbce,_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x34')])){throw new db['Sequelize'][(_0x5dd8('0x2a'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4afbce);}_0x541c33[_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x34')]]=_0x35cedb['body'][_0x5dd8('0x31')];})['then'](function(){return db[_0x5dd8('0x1b')][_0x5dd8('0x35')]({'where':{'id':_0x35cedb[_0x5dd8('0x36')]['id']},'include':[{'model':db[_0x5dd8('0x37')],'as':_0x5dd8('0x38'),'include':[{'model':db[_0x5dd8('0x27')],'as':'Contacts','where':_0x541c33,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x5dd8('0x39')],'as':_0x5dd8('0x3a')}]});})[_0x5dd8('0x11')](function(_0x2fa8c6){if(_0x2fa8c6&&_0x2fa8c6['List']){var _0x5e1f77=_0x2fa8c6['get']({'plain':!![]});_0xe1025['account']=_0x5e1f77;_0xe1025['applications']=_0x5e1f77[_0x5dd8('0x3a')];_0xe1025['list']=_0x5e1f77[_0x5dd8('0x38')];_0xe1025['applications']=_['orderBy'](_0xe1025['applications'],[_0x5dd8('0x3b')],[_0x5dd8('0x3c')]);if(_0xe1025[_0x5dd8('0x36')][_0x5dd8('0x3a')]){delete _0xe1025[_0x5dd8('0x36')][_0x5dd8('0x3a')];}if(_0xe1025[_0x5dd8('0x36')][_0x5dd8('0x38')]&&_0xe1025[_0x5dd8('0x36')][_0x5dd8('0x38')][_0x5dd8('0x3d')][_0x5dd8('0x3e')]){return _0xe1025[_0x5dd8('0x36')]['List'][_0x5dd8('0x3d')][0x0];}var _0x468df2=_[_0x5dd8('0xa')](_0x35cedb['body'],{'firstName':_0x35cedb[_0x5dd8('0x25')]['from'],'ListId':_0x5e1f77[_0x5dd8('0x3f')]});_0x468df2[_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x34')]]=_0x35cedb['body'][_0x5dd8('0x31')];return db['CmContact'][_0x5dd8('0x40')](_0x468df2,{'fields':_0x3cf5bb,'raw':!![]});}})[_0x5dd8('0x11')](function(_0x4dde3d){_0xe1025['contact']=_0x4dde3d;if(_0x4dde3d){var _0x2446e7={'ContactId':_0x4dde3d['id'],'FaxAccountId':_0x35cedb[_0x5dd8('0x36')]['id'],'fax':_0x4dde3d[_0x5dd8('0x26')]};return db[_0x5dd8('0x41')][_0x5dd8('0x35')]({'where':{'ContactId':_0x4dde3d['id'],'closed':![],'FaxAccountId':_0x35cedb[_0x5dd8('0x36')]['id']}})[_0x5dd8('0x11')](function(_0x382a4c){if(_0x382a4c){return[_0x382a4c,![]];}return db[_0x5dd8('0x41')][_0x5dd8('0x40')](_0x2446e7)[_0x5dd8('0x11')](function(_0xb16a9b){return[_0xb16a9b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0x5dd8('0x42')](function(_0x4a58a0,_0x309dc3){var _0x17e73e=_0x4a58a0[_0x5dd8('0x43')]({'plain':!![]});if(_0x309dc3){if(_0xe1025['account'][_0x5dd8('0x44')]){_0xe1025[_0x5dd8('0x45')][_0x5dd8('0x46')]({'id':0x0,'priority':_0xe1025[_0x5dd8('0x45')][_0x5dd8('0x3e')]+0x1,'app':_0x5dd8('0x47'),'appdata':'unmanaged','interval':_0x5dd8('0x48')});}_0x17e73e[_0x5dd8('0x49')]=!![];}else{_0x17e73e[_0x5dd8('0x49')]=![];}_0xe1025[_0x5dd8('0x4a')]=_0x17e73e;return db[_0x5dd8('0x4b')][_0x5dd8('0x40')]({'body':_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x25')],'FaxAccountId':_0x35cedb[_0x5dd8('0x36')]['id'],'FaxInteractionId':_0x4a58a0['id'],'direction':'in','ContactId':_0x4a58a0['ContactId'],'AttachmentId':_0x35cedb[_0x5dd8('0x25')][_0x5dd8('0x4c')]});})['then'](function(_0x5d2d6e){_0xe1025[_0x5dd8('0x18')]=_0x5d2d6e;if(!_0xe1025['interaction']['UserId'])return;return db[_0x5dd8('0x4d')][_0x5dd8('0x35')]({'attributes':['id',_0x5dd8('0x4e')],'where':{'id':_0xe1025['interaction'][_0x5dd8('0x4f')]}});})[_0x5dd8('0x11')](function(_0x107afa){if(_0x107afa){_0xe1025[_0x5dd8('0x45')][_0x5dd8('0x50')]({'id':0x0,'priority':0x0,'app':_0x5dd8('0x51'),'appdata':_0x107afa[_0x5dd8('0x4e')]+','+(_0xe1025[_0x5dd8('0x36')][_0x5dd8('0x52')]||0xa),'interval':_0x5dd8('0x48')});}if(!_0xe1025[_0x5dd8('0x4a')][_0x5dd8('0x53')])return;return db[_0x5dd8('0x54')][_0x5dd8('0x35')]({'attributes':['id',_0x5dd8('0x4e')],'where':{'id':_0xe1025[_0x5dd8('0x4a')][_0x5dd8('0x53')]}});})['then'](function(_0x2e0198){if(_0x2e0198){_0xe1025['applications'][_0x5dd8('0x50')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2e0198[_0x5dd8('0x4e')]+','+(_0xe1025[_0x5dd8('0x36')][_0x5dd8('0x55')]||0x12c),'interval':_0x5dd8('0x48')});}return respondWithRpcPromise('Start',_0x5dd8('0x56'),_0xe1025);})['then'](function(_0x276ec1){_0x5702d8(_0x276ec1);})[_0x5dd8('0x1a')](function(_0x73e000){_0x2a4144(_0x3ea964[_0x5dd8('0x16')](0x1f4,_0x73e000['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 8a6d520..c217b30 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 _0xc986=['save','remove','update','emit','removeListener','register','faxAccount:','./faxAccount.events'];(function(_0x4a88f1,_0x253162){var _0x422677=function(_0x22c5fa){while(--_0x22c5fa){_0x4a88f1['push'](_0x4a88f1['shift']());}};_0x422677(++_0x253162);}(_0xc986,0x6f));var _0x6c98=function(_0x2d4a07,_0x2e1f4d){_0x2d4a07=_0x2d4a07-0x0;var _0x43f637=_0xc986[_0x2d4a07];return _0x43f637;};'use strict';var FaxAccountEvents=require(_0x6c98('0x0'));var events=[_0x6c98('0x1'),_0x6c98('0x2'),_0x6c98('0x3')];function createListener(_0x2ecbcf,_0x12a707){return function(_0x4b162f){_0x12a707[_0x6c98('0x4')](_0x2ecbcf,_0x4b162f);};}function removeListener(_0x2df507,_0x54d832){return function(){FaxAccountEvents[_0x6c98('0x5')](_0x2df507,_0x54d832);};}exports[_0x6c98('0x6')]=function(_0x29ad28){for(var _0x55ef4a=0x0,_0x4197aa=events['length'];_0x55ef4a<_0x4197aa;_0x55ef4a++){var _0xc04aa7=events[_0x55ef4a];var _0x452af7=createListener(_0x6c98('0x7')+_0xc04aa7,_0x29ad28);FaxAccountEvents['on'](_0xc04aa7,_0x452af7);}}; \ No newline at end of file +var _0xbd24=['faxAccount:','update','emit','register','length'];(function(_0x32f2a7,_0x471230){var _0x88fac4=function(_0x1c2c80){while(--_0x1c2c80){_0x32f2a7['push'](_0x32f2a7['shift']());}};_0x88fac4(++_0x471230);}(_0xbd24,0x182));var _0x4bd2=function(_0x1b29b2,_0x3b6b11){_0x1b29b2=_0x1b29b2-0x0;var _0x560b68=_0xbd24[_0x1b29b2];return _0x560b68;};'use strict';var FaxAccountEvents=require('./faxAccount.events');var events=['save','remove',_0x4bd2('0x0')];function createListener(_0x27014c,_0x23481c){return function(_0xc86f42){_0x23481c[_0x4bd2('0x1')](_0x27014c,_0xc86f42);};}function removeListener(_0x98001,_0xfa6f49){return function(){FaxAccountEvents['removeListener'](_0x98001,_0xfa6f49);};}exports[_0x4bd2('0x2')]=function(_0x26e55b){for(var _0x53a249=0x0,_0x46e1f5=events[_0x4bd2('0x3')];_0x53a249<_0x46e1f5;_0x53a249++){var _0x45d9fa=events[_0x53a249];var _0x1fd895=createListener(_0x4bd2('0x4')+_0x45d9fa,_0x26e55b);FaxAccountEvents['on'](_0x45d9fa,_0x1fd895);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 8d4afb3..ce42044 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 _0x54d2=['Router','../../components/auth/service','get','isAuthenticated','index','/:id','show','getDispositions','/:id/canned_answers','getInteractions','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','/:id/interactions','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','/:id/users','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','path','connect-timeout','express'];(function(_0x242390,_0x5c4166){var _0x2c9a46=function(_0x39d6ca){while(--_0x39d6ca){_0x242390['push'](_0x242390['shift']());}};_0x2c9a46(++_0x5c4166);}(_0x54d2,0x16f));var _0x254d=function(_0x465555,_0x135159){_0x465555=_0x465555-0x0;var _0x3eaf27=_0x54d2[_0x465555];return _0x3eaf27;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x254d('0x0'));var timeout=require(_0x254d('0x1'));var express=require(_0x254d('0x2'));var router=express[_0x254d('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x254d('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0x254d('0x5')]('/',auth[_0x254d('0x6')](),controller[_0x254d('0x7')]);router[_0x254d('0x5')]('/describe',auth[_0x254d('0x6')](),controller['describe']);router['get'](_0x254d('0x8'),auth[_0x254d('0x6')](),controller[_0x254d('0x9')]);router[_0x254d('0x5')]('/:id/dispositions',auth[_0x254d('0x6')](),controller[_0x254d('0xa')]);router[_0x254d('0x5')](_0x254d('0xb'),auth[_0x254d('0x6')](),controller['getAnswers']);router[_0x254d('0x5')]('/:id/interactions',auth[_0x254d('0x6')](),controller[_0x254d('0xc')]);router[_0x254d('0x5')]('/:id/applications',auth[_0x254d('0x6')](),controller['getApplications']);router[_0x254d('0x5')](_0x254d('0xd'),auth['isAuthenticated'](),controller[_0x254d('0xe')]);router['get']('/:id/users',auth[_0x254d('0x6')](),controller[_0x254d('0xf')]);router[_0x254d('0x10')]('/',auth[_0x254d('0x6')](),controller[_0x254d('0x11')]);router[_0x254d('0x10')](_0x254d('0x12'),auth['isAuthenticated'](),controller[_0x254d('0x13')]);router[_0x254d('0x10')](_0x254d('0xb'),auth[_0x254d('0x6')](),controller[_0x254d('0x14')]);router[_0x254d('0x10')](_0x254d('0x15'),auth[_0x254d('0x6')](),controller[_0x254d('0x16')]);router[_0x254d('0x10')]('/:id/applications',auth[_0x254d('0x6')](),controller[_0x254d('0x17')]);router[_0x254d('0x10')](_0x254d('0x18'),auth[_0x254d('0x6')](),controller[_0x254d('0x19')]);router[_0x254d('0x10')](_0x254d('0x1a'),auth[_0x254d('0x6')](),controller[_0x254d('0x1b')]);router[_0x254d('0x10')](_0x254d('0x1c'),auth[_0x254d('0x6')](),controller['send']);router[_0x254d('0x10')](_0x254d('0x1d'),auth[_0x254d('0x6')](),controller['addAgents']);router[_0x254d('0x1e')](_0x254d('0x8'),auth[_0x254d('0x6')](),controller['update']);router[_0x254d('0x1f')](_0x254d('0x8'),auth['isAuthenticated'](),controller[_0x254d('0x20')]);router['delete'](_0x254d('0x12'),auth[_0x254d('0x6')](),controller[_0x254d('0x21')]);router[_0x254d('0x1f')]('/:id/canned_answers',auth[_0x254d('0x6')](),controller[_0x254d('0x22')]);router['delete'](_0x254d('0x1d'),auth[_0x254d('0x6')](),controller[_0x254d('0x23')]);module[_0x254d('0x24')]=router; \ No newline at end of file +var _0xaaf9=['addDisposition','addAnswer','/:id/applications','addApplications','/addaccountapplications','addAccountApplications','/:id/send','send','/:id/users','addAgents','destroy','delete','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getApplications','/:id/messages','getMessages','getAgents','post','create'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xaaf9,0x1a9));var _0x9aaf=function(_0x2cf0d7,_0x33ec9d){_0x2cf0d7=_0x2cf0d7-0x0;var _0x400183=_0xaaf9[_0x2cf0d7];return _0x400183;};'use strict';var multer=require(_0x9aaf('0x0'));var util=require(_0x9aaf('0x1'));var path=require(_0x9aaf('0x2'));var timeout=require(_0x9aaf('0x3'));var express=require(_0x9aaf('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9aaf('0x5'));var interaction=require(_0x9aaf('0x6'));var config=require(_0x9aaf('0x7'));var controller=require(_0x9aaf('0x8'));router[_0x9aaf('0x9')]('/',auth[_0x9aaf('0xa')](),controller[_0x9aaf('0xb')]);router[_0x9aaf('0x9')](_0x9aaf('0xc'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0xd')]);router[_0x9aaf('0x9')](_0x9aaf('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x9aaf('0x9')](_0x9aaf('0xf'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x10')]);router[_0x9aaf('0x9')](_0x9aaf('0x11'),auth['isAuthenticated'](),controller[_0x9aaf('0x12')]);router[_0x9aaf('0x9')](_0x9aaf('0x13'),auth[_0x9aaf('0xa')](),controller['getInteractions']);router[_0x9aaf('0x9')]('/:id/applications',auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x14')]);router['get'](_0x9aaf('0x15'),auth['isAuthenticated'](),controller[_0x9aaf('0x16')]);router[_0x9aaf('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x9aaf('0x17')]);router[_0x9aaf('0x18')]('/',auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x19')]);router[_0x9aaf('0x18')](_0x9aaf('0xf'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x1a')]);router['post'](_0x9aaf('0x11'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x1b')]);router[_0x9aaf('0x18')](_0x9aaf('0x13'),auth[_0x9aaf('0xa')](),controller['addInteraction']);router[_0x9aaf('0x18')](_0x9aaf('0x1c'),auth['isAuthenticated'](),controller[_0x9aaf('0x1d')]);router[_0x9aaf('0x18')](_0x9aaf('0x1e'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x1f')]);router[_0x9aaf('0x18')]('/updateaccountapplications',auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x9aaf('0x18')](_0x9aaf('0x20'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x21')]);router['post'](_0x9aaf('0x22'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x23')]);router['put'](_0x9aaf('0xe'),auth[_0x9aaf('0xa')](),controller['update']);router['delete'](_0x9aaf('0xe'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x24')]);router[_0x9aaf('0x25')](_0x9aaf('0xf'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x26')]);router[_0x9aaf('0x25')](_0x9aaf('0x11'),auth[_0x9aaf('0xa')](),controller[_0x9aaf('0x27')]);router[_0x9aaf('0x25')](_0x9aaf('0x22'),auth[_0x9aaf('0xa')](),controller['removeAgents']);module[_0x9aaf('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index c140500..b5800a9 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 _0xa457=['TEXT','exports','INTEGER','STRING','noop'];(function(_0x570ef2,_0x5c0e34){var _0x4b6fb3=function(_0x5dde9f){while(--_0x5dde9f){_0x570ef2['push'](_0x570ef2['shift']());}};_0x4b6fb3(++_0x5c0e34);}(_0xa457,0x1eb));var _0x7a45=function(_0x27539d,_0x10b197){_0x27539d=_0x27539d-0x0;var _0x38e34e=_0xa457[_0x27539d];return _0x38e34e;};'use strict';var Sequelize=require('sequelize');module[_0x7a45('0x0')]={'priority':{'type':Sequelize[_0x7a45('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x7a45('0x2')],'allowNull':![],'defaultValue':_0x7a45('0x3')},'appdata':{'type':Sequelize[_0x7a45('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7a45('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8a55=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x24a3eb,_0x38304b){var _0x11559e=function(_0x4bac2d){while(--_0x4bac2d){_0x24a3eb['push'](_0x24a3eb['shift']());}};_0x11559e(++_0x38304b);}(_0x8a55,0xf5));var _0x58a5=function(_0x5cc04d,_0x4fd2c4){_0x5cc04d=_0x5cc04d-0x0;var _0x329848=_0x8a55[_0x5cc04d];return _0x329848;};'use strict';var Sequelize=require(_0x58a5('0x0'));module['exports']={'priority':{'type':Sequelize[_0x58a5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x58a5('0x2')],'allowNull':![],'defaultValue':_0x58a5('0x3')},'appdata':{'type':Sequelize[_0x58a5('0x4')]()},'description':{'type':Sequelize[_0x58a5('0x2')]},'interval':{'type':Sequelize[_0x58a5('0x2')],'defaultValue':_0x58a5('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 20c257e..7c76371 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 _0x8749=['map','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','type','key','model'];(function(_0x1c0781,_0x4a19f1){var _0x1f577e=function(_0x396577){while(--_0x396577){_0x1c0781['push'](_0x1c0781['shift']());}};_0x1f577e(++_0x4a19f1);}(_0x8749,0xb0));var _0x9874=function(_0x27c1ab,_0x3734be){_0x27c1ab=_0x27c1ab-0x0;var _0x5087a3=_0x8749[_0x27c1ab];return _0x5087a3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9874('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9874('0x1'));var Mustache=require(_0x9874('0x2'));var util=require(_0x9874('0x3'));var path=require(_0x9874('0x4'));var sox=require(_0x9874('0x5'));var csv=require(_0x9874('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9874('0x7'));var _=require('lodash');var squel=require(_0x9874('0x8'));var crypto=require(_0x9874('0x9'));var jsforce=require(_0x9874('0xa'));var deskjs=require(_0x9874('0xb'));var toCsv=require(_0x9874('0x6'));var querystring=require(_0x9874('0xc'));var Papa=require(_0x9874('0xd'));var Redis=require(_0x9874('0xe'));var authService=require(_0x9874('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9874('0x10'));var hardwareService=require(_0x9874('0x11'));var logger=require(_0x9874('0x12'))(_0x9874('0x13'));var utils=require(_0x9874('0x14'));var config=require(_0x9874('0x15'));var licenseUtil=require(_0x9874('0x16'));var db=require(_0x9874('0x17'))['db'];function respondWithStatusCode(_0x4b14a2,_0x15f44a){_0x15f44a=_0x15f44a||0xcc;return function(_0x29d102){if(_0x29d102){return _0x4b14a2[_0x9874('0x18')](_0x15f44a);}return _0x4b14a2[_0x9874('0x19')](_0x15f44a)['end']();};}function respondWithResult(_0xb0a0fa,_0x22eecc){_0x22eecc=_0x22eecc||0xc8;return function(_0x1f4b32){if(_0x1f4b32){return _0xb0a0fa[_0x9874('0x19')](_0x22eecc)[_0x9874('0x1a')](_0x1f4b32);}};}function respondWithFilteredResult(_0x4b9fbf,_0x1c5c84){return function(_0x29bff2){if(_0x29bff2){var _0x43f361=typeof _0x1c5c84[_0x9874('0x1b')]==='undefined'&&typeof _0x1c5c84[_0x9874('0x1c')]===_0x9874('0x1d');var _0x3e211b=_0x29bff2['count'];var _0x442ce1=_0x43f361?0x0:_0x1c5c84['offset'];var _0x3ffa30=_0x43f361?_0x29bff2[_0x9874('0x1e')]:_0x1c5c84['offset']+_0x1c5c84[_0x9874('0x1c')];var _0x4a92b1;if(_0x3ffa30>=_0x3e211b){_0x3ffa30=_0x3e211b;_0x4a92b1=0xc8;}else{_0x4a92b1=0xce;}_0x4b9fbf['status'](_0x4a92b1);return _0x4b9fbf[_0x9874('0x1f')](_0x9874('0x20'),_0x442ce1+'-'+_0x3ffa30+'/'+_0x3e211b)[_0x9874('0x1a')](_0x29bff2);}return null;};}function patchUpdates(_0x4fa9e5){return function(_0x3a1f2c){try{jsonpatch[_0x9874('0x21')](_0x3a1f2c,_0x4fa9e5,!![]);}catch(_0x10343c){return BPromise[_0x9874('0x22')](_0x10343c);}return _0x3a1f2c[_0x9874('0x23')]();};}function saveUpdates(_0x374681,_0x45c855){return function(_0x1e6901){if(_0x1e6901){return _0x1e6901[_0x9874('0x24')](_0x374681)[_0x9874('0x25')](function(_0x5d3a1a){return _0x5d3a1a;});}return null;};}function removeEntity(_0x21d641,_0x10801c){return function(_0x36f441){if(_0x36f441){return _0x36f441[_0x9874('0x26')]()['then'](function(){_0x21d641[_0x9874('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a7238,_0x40a79c){return function(_0x4e7087){if(!_0x4e7087){_0x3a7238[_0x9874('0x18')](0x194);}return _0x4e7087;};}function handleError(_0x3dfac3,_0x192714){_0x192714=_0x192714||0x1f4;return function(_0x29c408){logger[_0x9874('0x27')](_0x29c408[_0x9874('0x28')]);if(_0x29c408[_0x9874('0x29')]){delete _0x29c408['name'];}_0x3dfac3[_0x9874('0x19')](_0x192714)[_0x9874('0x2a')](_0x29c408);};}exports[_0x9874('0x2b')]=function(_0x33dba6,_0xe2f2d4){var _0x5a2525={},_0x690763={},_0x3e3d3f={'count':0x0,'rows':[]};var _0x1fe9b0=_['map'](db[_0x9874('0x2c')][_0x9874('0x2d')],function(_0x1493e5){return{'name':_0x1493e5['fieldName'],'type':_0x1493e5[_0x9874('0x2e')][_0x9874('0x2f')]};});_0x690763[_0x9874('0x30')]=_[_0x9874('0x31')](_0x1fe9b0,'name');_0x690763['query']=_[_0x9874('0x32')](_0x33dba6['query']);_0x690763['filters']=_[_0x9874('0x33')](_0x690763['model'],_0x690763['query']);_0x5a2525[_0x9874('0x34')]=_['intersection'](_0x690763[_0x9874('0x30')],qs[_0x9874('0x35')](_0x33dba6['query'][_0x9874('0x35')]));_0x5a2525[_0x9874('0x34')]=_0x5a2525[_0x9874('0x34')][_0x9874('0x36')]?_0x5a2525[_0x9874('0x34')]:_0x690763[_0x9874('0x30')];if(!_0x33dba6[_0x9874('0x37')][_0x9874('0x38')](_0x9874('0x39'))){_0x5a2525[_0x9874('0x1c')]=qs[_0x9874('0x1c')](_0x33dba6[_0x9874('0x37')][_0x9874('0x1c')]);_0x5a2525[_0x9874('0x1b')]=qs[_0x9874('0x1b')](_0x33dba6[_0x9874('0x37')][_0x9874('0x1b')]);}_0x5a2525['order']=qs[_0x9874('0x3a')](_0x33dba6[_0x9874('0x37')][_0x9874('0x3a')]);_0x5a2525[_0x9874('0x3b')]=qs[_0x9874('0x3c')](_[_0x9874('0x3d')](_0x33dba6[_0x9874('0x37')],_0x690763[_0x9874('0x3c')]),_0x1fe9b0);if(_0x33dba6[_0x9874('0x37')]['filter']){_0x5a2525[_0x9874('0x3b')]=_[_0x9874('0x3e')](_0x5a2525['where'],{'$or':_[_0x9874('0x31')](_0x1fe9b0,function(_0x177f4f){if(_0x177f4f[_0x9874('0x2e')]!==_0x9874('0x3f')){var _0x3c9741={};_0x3c9741[_0x177f4f['name']]={'$like':'%'+_0x33dba6[_0x9874('0x37')]['filter']+'%'};return _0x3c9741;}})});}_0x5a2525=_[_0x9874('0x3e')]({},_0x5a2525,_0x33dba6[_0x9874('0x40')]);var _0x5a293b={'where':_0x5a2525[_0x9874('0x3b')]};return db[_0x9874('0x2c')][_0x9874('0x1e')](_0x5a293b)[_0x9874('0x25')](function(_0x3d420d){_0x3e3d3f[_0x9874('0x1e')]=_0x3d420d;if(_0x33dba6[_0x9874('0x37')][_0x9874('0x41')]){_0x5a2525[_0x9874('0x42')]=[{'all':!![]}];}return db[_0x9874('0x2c')][_0x9874('0x43')](_0x5a2525);})[_0x9874('0x25')](function(_0x41745e){_0x3e3d3f[_0x9874('0x44')]=_0x41745e;return _0x3e3d3f;})[_0x9874('0x25')](respondWithFilteredResult(_0xe2f2d4,_0x5a2525))['catch'](handleError(_0xe2f2d4,null));};exports[_0x9874('0x45')]=function(_0x4b974b,_0x424991){var _0x2c0df7={'raw':!![],'where':{'id':_0x4b974b['params']['id']}},_0x190de9={};_0x190de9[_0x9874('0x30')]=_['keys'](db[_0x9874('0x2c')][_0x9874('0x2d')]);_0x190de9[_0x9874('0x37')]=_[_0x9874('0x32')](_0x4b974b[_0x9874('0x37')]);_0x190de9[_0x9874('0x3c')]=_['intersection'](_0x190de9[_0x9874('0x30')],_0x190de9[_0x9874('0x37')]);_0x2c0df7['attributes']=_['intersection'](_0x190de9[_0x9874('0x30')],qs[_0x9874('0x35')](_0x4b974b[_0x9874('0x37')][_0x9874('0x35')]));_0x2c0df7[_0x9874('0x34')]=_0x2c0df7['attributes'][_0x9874('0x36')]?_0x2c0df7[_0x9874('0x34')]:_0x190de9['model'];if(_0x4b974b[_0x9874('0x37')][_0x9874('0x41')]){_0x2c0df7[_0x9874('0x42')]=[{'all':!![]}];}_0x2c0df7=_['merge']({},_0x2c0df7,_0x4b974b[_0x9874('0x40')]);return db[_0x9874('0x2c')][_0x9874('0x46')](_0x2c0df7)[_0x9874('0x25')](handleEntityNotFound(_0x424991,null))['then'](respondWithResult(_0x424991,null))[_0x9874('0x47')](handleError(_0x424991,null));};exports[_0x9874('0x48')]=function(_0x3219d9,_0x21b6fc){return db['FaxApplication'][_0x9874('0x48')](_0x3219d9['body'],{})[_0x9874('0x25')](respondWithResult(_0x21b6fc,0xc9))[_0x9874('0x47')](handleError(_0x21b6fc,null));};exports[_0x9874('0x24')]=function(_0x2fa515,_0x6363ed){if(_0x2fa515[_0x9874('0x49')]['id']){delete _0x2fa515[_0x9874('0x49')]['id'];}return db['FaxApplication']['find']({'where':{'id':_0x2fa515['params']['id']}})[_0x9874('0x25')](handleEntityNotFound(_0x6363ed,null))[_0x9874('0x25')](saveUpdates(_0x2fa515[_0x9874('0x49')],null))['then'](respondWithResult(_0x6363ed,null))['catch'](handleError(_0x6363ed,null));};exports['destroy']=function(_0x5b90f3,_0x4b8c35){return db[_0x9874('0x2c')][_0x9874('0x46')]({'where':{'id':_0x5b90f3[_0x9874('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4b8c35,null))[_0x9874('0x25')](removeEntity(_0x4b8c35,null))[_0x9874('0x47')](handleError(_0x4b8c35,null));}; \ No newline at end of file +var _0x3b1a=['sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','error','name','send','index','map','FaxApplication','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x3b1a,0xbc));var _0xa3b1=function(_0x2cd8a4,_0x51fb40){_0x2cd8a4=_0x2cd8a4-0x0;var _0x375630=_0x3b1a[_0x2cd8a4];return _0x375630;};'use strict';var emlformat=require(_0xa3b1('0x0'));var rimraf=require(_0xa3b1('0x1'));var zipdir=require(_0xa3b1('0x2'));var jsonpatch=require(_0xa3b1('0x3'));var rp=require(_0xa3b1('0x4'));var moment=require('moment');var BPromise=require(_0xa3b1('0x5'));var Mustache=require(_0xa3b1('0x6'));var util=require(_0xa3b1('0x7'));var path=require('path');var sox=require(_0xa3b1('0x8'));var csv=require(_0xa3b1('0x9'));var ejs=require(_0xa3b1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa3b1('0xb'));var squel=require(_0xa3b1('0xc'));var crypto=require(_0xa3b1('0xd'));var jsforce=require(_0xa3b1('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa3b1('0x9'));var querystring=require(_0xa3b1('0xf'));var Papa=require(_0xa3b1('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa3b1('0x11'));var as=require(_0xa3b1('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xa3b1('0x13'));var utils=require(_0xa3b1('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xa3b1('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x841b02,_0x3d92bb){_0x3d92bb=_0x3d92bb||0xcc;return function(_0x27533c){if(_0x27533c){return _0x841b02[_0xa3b1('0x16')](_0x3d92bb);}return _0x841b02[_0xa3b1('0x17')](_0x3d92bb)[_0xa3b1('0x18')]();};}function respondWithResult(_0x22d1c6,_0x44c833){_0x44c833=_0x44c833||0xc8;return function(_0x5b867f){if(_0x5b867f){return _0x22d1c6[_0xa3b1('0x17')](_0x44c833)[_0xa3b1('0x19')](_0x5b867f);}};}function respondWithFilteredResult(_0x1ac50a,_0x53aaef){return function(_0x4585ca){if(_0x4585ca){var _0xdd7ff3=typeof _0x53aaef[_0xa3b1('0x1a')]==='undefined'&&typeof _0x53aaef[_0xa3b1('0x1b')]===_0xa3b1('0x1c');var _0x372804=_0x4585ca['count'];var _0x557a53=_0xdd7ff3?0x0:_0x53aaef[_0xa3b1('0x1a')];var _0x38d835=_0xdd7ff3?_0x4585ca[_0xa3b1('0x1d')]:_0x53aaef['offset']+_0x53aaef[_0xa3b1('0x1b')];var _0x21b71b;if(_0x38d835>=_0x372804){_0x38d835=_0x372804;_0x21b71b=0xc8;}else{_0x21b71b=0xce;}_0x1ac50a[_0xa3b1('0x17')](_0x21b71b);return _0x1ac50a[_0xa3b1('0x1e')](_0xa3b1('0x1f'),_0x557a53+'-'+_0x38d835+'/'+_0x372804)[_0xa3b1('0x19')](_0x4585ca);}return null;};}function patchUpdates(_0x2da02b){return function(_0x321390){try{jsonpatch['apply'](_0x321390,_0x2da02b,!![]);}catch(_0x1e22c3){return BPromise['reject'](_0x1e22c3);}return _0x321390[_0xa3b1('0x20')]();};}function saveUpdates(_0x5d6edd,_0x43d435){return function(_0x2dfef0){if(_0x2dfef0){return _0x2dfef0[_0xa3b1('0x21')](_0x5d6edd)[_0xa3b1('0x22')](function(_0x27eebf){return _0x27eebf;});}return null;};}function removeEntity(_0x15fc20,_0x59c213){return function(_0x217b4c){if(_0x217b4c){return _0x217b4c['destroy']()[_0xa3b1('0x22')](function(){_0x15fc20[_0xa3b1('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26ede0,_0x5cd76c){return function(_0x408a22){if(!_0x408a22){_0x26ede0[_0xa3b1('0x16')](0x194);}return _0x408a22;};}function handleError(_0x52a8eb,_0x509e25){_0x509e25=_0x509e25||0x1f4;return function(_0x44605f){logger[_0xa3b1('0x23')](_0x44605f['stack']);if(_0x44605f[_0xa3b1('0x24')]){delete _0x44605f[_0xa3b1('0x24')];}_0x52a8eb[_0xa3b1('0x17')](_0x509e25)[_0xa3b1('0x25')](_0x44605f);};}exports[_0xa3b1('0x26')]=function(_0x1b4c35,_0x5c2bca){var _0x220724={},_0x13be78={},_0x38ecd7={'count':0x0,'rows':[]};var _0x55a372=_[_0xa3b1('0x27')](db[_0xa3b1('0x28')][_0xa3b1('0x29')],function(_0x566ec5){return{'name':_0x566ec5[_0xa3b1('0x2a')],'type':_0x566ec5[_0xa3b1('0x2b')]['key']};});_0x13be78['model']=_['map'](_0x55a372,_0xa3b1('0x24'));_0x13be78[_0xa3b1('0x2c')]=_[_0xa3b1('0x2d')](_0x1b4c35[_0xa3b1('0x2c')]);_0x13be78[_0xa3b1('0x2e')]=_['intersection'](_0x13be78[_0xa3b1('0x2f')],_0x13be78[_0xa3b1('0x2c')]);_0x220724[_0xa3b1('0x30')]=_[_0xa3b1('0x31')](_0x13be78[_0xa3b1('0x2f')],qs['fields'](_0x1b4c35[_0xa3b1('0x2c')][_0xa3b1('0x32')]));_0x220724[_0xa3b1('0x30')]=_0x220724[_0xa3b1('0x30')][_0xa3b1('0x33')]?_0x220724[_0xa3b1('0x30')]:_0x13be78[_0xa3b1('0x2f')];if(!_0x1b4c35['query']['hasOwnProperty'](_0xa3b1('0x34'))){_0x220724[_0xa3b1('0x1b')]=qs[_0xa3b1('0x1b')](_0x1b4c35[_0xa3b1('0x2c')][_0xa3b1('0x1b')]);_0x220724[_0xa3b1('0x1a')]=qs[_0xa3b1('0x1a')](_0x1b4c35[_0xa3b1('0x2c')][_0xa3b1('0x1a')]);}_0x220724[_0xa3b1('0x35')]=qs['sort'](_0x1b4c35[_0xa3b1('0x2c')]['sort']);_0x220724[_0xa3b1('0x36')]=qs[_0xa3b1('0x2e')](_[_0xa3b1('0x37')](_0x1b4c35[_0xa3b1('0x2c')],_0x13be78['filters']),_0x55a372);if(_0x1b4c35[_0xa3b1('0x2c')][_0xa3b1('0x38')]){_0x220724[_0xa3b1('0x36')]=_[_0xa3b1('0x39')](_0x220724['where'],{'$or':_[_0xa3b1('0x27')](_0x55a372,function(_0x2cee90){if(_0x2cee90[_0xa3b1('0x2b')]!==_0xa3b1('0x3a')){var _0x5a6dcd={};_0x5a6dcd[_0x2cee90[_0xa3b1('0x24')]]={'$like':'%'+_0x1b4c35[_0xa3b1('0x2c')][_0xa3b1('0x38')]+'%'};return _0x5a6dcd;}})});}_0x220724=_[_0xa3b1('0x39')]({},_0x220724,_0x1b4c35['options']);var _0xe47eb0={'where':_0x220724[_0xa3b1('0x36')]};return db['FaxApplication'][_0xa3b1('0x1d')](_0xe47eb0)[_0xa3b1('0x22')](function(_0xc04a42){_0x38ecd7[_0xa3b1('0x1d')]=_0xc04a42;if(_0x1b4c35['query'][_0xa3b1('0x3b')]){_0x220724['include']=[{'all':!![]}];}return db[_0xa3b1('0x28')]['findAll'](_0x220724);})[_0xa3b1('0x22')](function(_0x18cf02){_0x38ecd7[_0xa3b1('0x3c')]=_0x18cf02;return _0x38ecd7;})[_0xa3b1('0x22')](respondWithFilteredResult(_0x5c2bca,_0x220724))[_0xa3b1('0x3d')](handleError(_0x5c2bca,null));};exports[_0xa3b1('0x3e')]=function(_0x5b711d,_0x1d62bf){var _0x2e3dc8={'raw':!![],'where':{'id':_0x5b711d[_0xa3b1('0x3f')]['id']}},_0x4c4bbf={};_0x4c4bbf['model']=_['keys'](db[_0xa3b1('0x28')][_0xa3b1('0x29')]);_0x4c4bbf[_0xa3b1('0x2c')]=_['keys'](_0x5b711d[_0xa3b1('0x2c')]);_0x4c4bbf[_0xa3b1('0x2e')]=_[_0xa3b1('0x31')](_0x4c4bbf[_0xa3b1('0x2f')],_0x4c4bbf[_0xa3b1('0x2c')]);_0x2e3dc8[_0xa3b1('0x30')]=_[_0xa3b1('0x31')](_0x4c4bbf[_0xa3b1('0x2f')],qs[_0xa3b1('0x32')](_0x5b711d[_0xa3b1('0x2c')]['fields']));_0x2e3dc8[_0xa3b1('0x30')]=_0x2e3dc8['attributes'][_0xa3b1('0x33')]?_0x2e3dc8[_0xa3b1('0x30')]:_0x4c4bbf[_0xa3b1('0x2f')];if(_0x5b711d[_0xa3b1('0x2c')][_0xa3b1('0x3b')]){_0x2e3dc8[_0xa3b1('0x40')]=[{'all':!![]}];}_0x2e3dc8=_['merge']({},_0x2e3dc8,_0x5b711d[_0xa3b1('0x41')]);return db[_0xa3b1('0x28')][_0xa3b1('0x42')](_0x2e3dc8)[_0xa3b1('0x22')](handleEntityNotFound(_0x1d62bf,null))[_0xa3b1('0x22')](respondWithResult(_0x1d62bf,null))[_0xa3b1('0x3d')](handleError(_0x1d62bf,null));};exports[_0xa3b1('0x43')]=function(_0x321157,_0xd399bd){return db[_0xa3b1('0x28')][_0xa3b1('0x43')](_0x321157[_0xa3b1('0x44')],{})['then'](respondWithResult(_0xd399bd,0xc9))[_0xa3b1('0x3d')](handleError(_0xd399bd,null));};exports[_0xa3b1('0x21')]=function(_0x2e7499,_0x5ed600){if(_0x2e7499['body']['id']){delete _0x2e7499['body']['id'];}return db['FaxApplication'][_0xa3b1('0x42')]({'where':{'id':_0x2e7499['params']['id']}})[_0xa3b1('0x22')](handleEntityNotFound(_0x5ed600,null))['then'](saveUpdates(_0x2e7499[_0xa3b1('0x44')],null))[_0xa3b1('0x22')](respondWithResult(_0x5ed600,null))['catch'](handleError(_0x5ed600,null));};exports[_0xa3b1('0x45')]=function(_0x16093d,_0x3b2471){return db[_0xa3b1('0x28')][_0xa3b1('0x42')]({'where':{'id':_0x16093d[_0xa3b1('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3b2471,null))['then'](removeEntity(_0x3b2471,null))['catch'](handleError(_0x3b2471,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index a52ee52..19789b9 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 _0x8552=['moment','path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x12f010,_0x532524){var _0x59572d=function(_0x9c49b6){while(--_0x9c49b6){_0x12f010['push'](_0x12f010['shift']());}};_0x59572d(++_0x532524);}(_0x8552,0x141));var _0x2855=function(_0x5e3891,_0x3614b8){_0x5e3891=_0x5e3891-0x0;var _0x5673f1=_0x8552[_0x5e3891];return _0x5673f1;};'use strict';var _=require(_0x2855('0x0'));var util=require(_0x2855('0x1'));var logger=require(_0x2855('0x2'))(_0x2855('0x3'));var moment=require(_0x2855('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2855('0x5'));var rimraf=require(_0x2855('0x6'));var config=require(_0x2855('0x7'));var attributes=require(_0x2855('0x8'));module[_0x2855('0x9')]=function(_0x34ee75,_0x5a0fdd){return _0x34ee75[_0x2855('0xa')](_0x2855('0xb'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2855('0xc')});}; \ No newline at end of file +var _0x2756=['bluebird','path','rimraf','./faxApplication.attributes','exports','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api'];(function(_0x1d38be,_0x523611){var _0x3ddec2=function(_0x5ee7d4){while(--_0x5ee7d4){_0x1d38be['push'](_0x1d38be['shift']());}};_0x3ddec2(++_0x523611);}(_0x2756,0x1dd));var _0x6275=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x2756[_0x1ab0e6];return _0x248815;};'use strict';var _=require(_0x6275('0x0'));var util=require('util');var logger=require(_0x6275('0x1'))(_0x6275('0x2'));var moment=require('moment');var BPromise=require(_0x6275('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6275('0x4'));var rimraf=require(_0x6275('0x5'));var config=require('../../config/environment');var attributes=require(_0x6275('0x6'));module[_0x6275('0x7')]=function(_0x26778c,_0x20500e){return _0x26778c['define']('FaxApplication',attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6275('0x8'),'collate':_0x6275('0x9')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 34fd8fa..80ffaf8 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 _0xb089=['result','catch','update','body','options','where','attributes','limit','UpdateFaxApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message'];(function(_0x128d68,_0x555a32){var _0x24ad4d=function(_0x101a3a){while(--_0x101a3a){_0x128d68['push'](_0x128d68['shift']());}};_0x24ad4d(++_0x555a32);}(_0xb089,0x174));var _0x9b08=function(_0x239129,_0xc26811){_0x239129=_0x239129-0x0;var _0x11fda2=_0xb089[_0x239129];return _0x11fda2;};'use strict';var _=require(_0x9b08('0x0'));var util=require(_0x9b08('0x1'));var moment=require(_0x9b08('0x2'));var BPromise=require(_0x9b08('0x3'));var rs=require(_0x9b08('0x4'));var fs=require('fs');var Redis=require(_0x9b08('0x5'));var db=require(_0x9b08('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b08('0x7'))(_0x9b08('0x8'));var config=require(_0x9b08('0x9'));var jayson=require(_0x9b08('0xa'));var client=jayson[_0x9b08('0xb')][_0x9b08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa71f7b,_0x45fd6c,_0x90941c){return new BPromise(function(_0x2c41e8,_0x5a7bc1){return client[_0x9b08('0xd')](_0xa71f7b,_0x90941c)[_0x9b08('0xe')](function(_0x1fd81e){logger[_0x9b08('0xf')]('FaxApplication,\x20%s,\x20%s',_0x45fd6c,_0x9b08('0x10'));logger[_0x9b08('0x11')](_0x9b08('0x12'),_0x45fd6c,_0x9b08('0x10'),JSON[_0x9b08('0x13')](_0x1fd81e));if(_0x1fd81e[_0x9b08('0x14')]){if(_0x1fd81e['error'][_0x9b08('0x15')]===0x1f4){logger['error'](_0x9b08('0x16'),_0x45fd6c,_0x1fd81e['error'][_0x9b08('0x17')]);return _0x5a7bc1(_0x1fd81e[_0x9b08('0x14')][_0x9b08('0x17')]);}logger['error'](_0x9b08('0x16'),_0x45fd6c,_0x1fd81e[_0x9b08('0x14')][_0x9b08('0x17')]);return _0x2c41e8(_0x1fd81e[_0x9b08('0x14')][_0x9b08('0x17')]);}else{logger[_0x9b08('0xf')]('FaxApplication,\x20%s,\x20%s',_0x45fd6c,_0x9b08('0x10'));_0x2c41e8(_0x1fd81e[_0x9b08('0x18')]['message']);}})[_0x9b08('0x19')](function(_0x20127a){logger[_0x9b08('0x14')](_0x9b08('0x16'),_0x45fd6c,_0x20127a);_0x5a7bc1(_0x20127a);});});}exports['UpdateFaxApplication']=function(_0x19d0c8){var _0x1a8542=this;return new Promise(function(_0x4c68f5,_0xee78d1){return db['FaxApplication'][_0x9b08('0x1a')](_0x19d0c8[_0x9b08('0x1b')],{'raw':_0x19d0c8['options']?_0x19d0c8[_0x9b08('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19d0c8['options']?_0x19d0c8[_0x9b08('0x1c')][_0x9b08('0x1d')]||null:null,'attributes':_0x19d0c8[_0x9b08('0x1c')]?_0x19d0c8[_0x9b08('0x1c')][_0x9b08('0x1e')]||null:null,'limit':_0x19d0c8[_0x9b08('0x1c')]?_0x19d0c8[_0x9b08('0x1c')][_0x9b08('0x1f')]||null:null})[_0x9b08('0xe')](function(_0x593505){logger[_0x9b08('0xf')](_0x9b08('0x20'),_0x19d0c8);logger[_0x9b08('0x11')]('UpdateFaxApplication',_0x19d0c8,JSON[_0x9b08('0x13')](_0x593505));_0x4c68f5(_0x593505);})[_0x9b08('0x19')](function(_0x5a0d4b){logger[_0x9b08('0x14')](_0x9b08('0x20'),_0x5a0d4b[_0x9b08('0x17')],_0x19d0c8);_0xee78d1(_0x1a8542[_0x9b08('0x14')](0x1f4,_0x5a0d4b[_0x9b08('0x17')]));});});}; \ No newline at end of file +var _0xecd9=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','attributes','limit','lodash'];(function(_0x129e00,_0x4ae627){var _0x4de6f7=function(_0xcce4bf){while(--_0xcce4bf){_0x129e00['push'](_0x129e00['shift']());}};_0x4de6f7(++_0x4ae627);}(_0xecd9,0x13f));var _0x9ecd=function(_0x45a937,_0x55fe4d){_0x45a937=_0x45a937-0x0;var _0x64808b=_0xecd9[_0x45a937];return _0x64808b;};'use strict';var _=require(_0x9ecd('0x0'));var util=require(_0x9ecd('0x1'));var moment=require(_0x9ecd('0x2'));var BPromise=require(_0x9ecd('0x3'));var rs=require(_0x9ecd('0x4'));var fs=require('fs');var Redis=require(_0x9ecd('0x5'));var db=require(_0x9ecd('0x6'))['db'];var utils=require(_0x9ecd('0x7'));var logger=require('../../config/logger')(_0x9ecd('0x8'));var config=require(_0x9ecd('0x9'));var jayson=require(_0x9ecd('0xa'));var client=jayson[_0x9ecd('0xb')][_0x9ecd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5f0051,_0x887b47,_0xa24e58){return new BPromise(function(_0x387020,_0x3a2d40){return client[_0x9ecd('0xd')](_0x5f0051,_0xa24e58)[_0x9ecd('0xe')](function(_0x1e3084){logger[_0x9ecd('0xf')](_0x9ecd('0x10'),_0x887b47,_0x9ecd('0x11'));logger[_0x9ecd('0x12')](_0x9ecd('0x13'),_0x887b47,'request\x20sent',JSON['stringify'](_0x1e3084));if(_0x1e3084[_0x9ecd('0x14')]){if(_0x1e3084['error'][_0x9ecd('0x15')]===0x1f4){logger[_0x9ecd('0x14')](_0x9ecd('0x10'),_0x887b47,_0x1e3084[_0x9ecd('0x14')]['message']);return _0x3a2d40(_0x1e3084[_0x9ecd('0x14')][_0x9ecd('0x16')]);}logger[_0x9ecd('0x14')](_0x9ecd('0x10'),_0x887b47,_0x1e3084['error'][_0x9ecd('0x16')]);return _0x387020(_0x1e3084[_0x9ecd('0x14')][_0x9ecd('0x16')]);}else{logger['info'](_0x9ecd('0x10'),_0x887b47,_0x9ecd('0x11'));_0x387020(_0x1e3084[_0x9ecd('0x17')][_0x9ecd('0x16')]);}})[_0x9ecd('0x18')](function(_0x483fd3){logger[_0x9ecd('0x14')](_0x9ecd('0x10'),_0x887b47,_0x483fd3);_0x3a2d40(_0x483fd3);});});}exports[_0x9ecd('0x19')]=function(_0x1e8c92){var _0x222c48=this;return new Promise(function(_0x2d2220,_0x1c36e8){return db[_0x9ecd('0x1a')][_0x9ecd('0x1b')](_0x1e8c92[_0x9ecd('0x1c')],{'raw':_0x1e8c92[_0x9ecd('0x1d')]?_0x1e8c92[_0x9ecd('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e8c92[_0x9ecd('0x1d')]?_0x1e8c92[_0x9ecd('0x1d')]['where']||null:null,'attributes':_0x1e8c92[_0x9ecd('0x1d')]?_0x1e8c92[_0x9ecd('0x1d')][_0x9ecd('0x1e')]||null:null,'limit':_0x1e8c92['options']?_0x1e8c92[_0x9ecd('0x1d')][_0x9ecd('0x1f')]||null:null})[_0x9ecd('0xe')](function(_0x275a94){logger[_0x9ecd('0xf')](_0x9ecd('0x19'),_0x1e8c92);logger[_0x9ecd('0x12')](_0x9ecd('0x19'),_0x1e8c92,JSON['stringify'](_0x275a94));_0x2d2220(_0x275a94);})[_0x9ecd('0x18')](function(_0x1bb6d3){logger['error'](_0x9ecd('0x19'),_0x1bb6d3[_0x9ecd('0x16')],_0x1e8c92);_0x1c36e8(_0x222c48[_0x9ecd('0x14')](0x1f4,_0x1bb6d3[_0x9ecd('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 0c0d5bd..a9ceea6 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 _0x3266=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3266,0x6a));var _0x6326=function(_0x2ae2ad,_0xac5b0c){_0x2ae2ad=_0x2ae2ad-0x0;var _0x26dbd7=_0x3266[_0x2ae2ad];return _0x26dbd7;};'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')]('/:id',auth[_0x6326('0xa')](),controller['show']);router[_0x6326('0xd')]('/',auth[_0x6326('0xa')](),controller[_0x6326('0xe')]);router[_0x6326('0xf')](_0x6326('0x10'),auth['isAuthenticated'](),controller[_0x6326('0x11')]);router[_0x6326('0x12')](_0x6326('0x10'),auth[_0x6326('0xa')](),controller[_0x6326('0x13')]);module[_0x6326('0x14')]=router; \ No newline at end of file +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(_0x2ef7e8,_0x318c53){var _0x315d51=function(_0x55354c){while(--_0x55354c){_0x2ef7e8['push'](_0x2ef7e8['shift']());}};_0x315d51(++_0x318c53);}(_0x6324,0x142));var _0x4632=function(_0x3439ea,_0x1d81d4){_0x3439ea=_0x3439ea-0x0;var _0x1a55f3=_0x6324[_0x3439ea];return _0x1a55f3;};'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 diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 5a128b5..cd7c328 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 _0x627e=['out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING','ENUM'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x627e,0x14a));var _0xe627=function(_0x13b0ba,_0x1aeb85){_0x13b0ba=_0x13b0ba-0x0;var _0x5a29f1=_0x627e[_0x13b0ba];return _0x5a29f1;};'use strict';var Sequelize=require(_0xe627('0x0'));module[_0xe627('0x1')]={'closed':{'type':Sequelize[_0xe627('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe627('0x3')]},'disposition':{'type':Sequelize[_0xe627('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe627('0x4')]},'note':{'type':Sequelize[_0xe627('0x4')]},'read1stAt':{'type':Sequelize[_0xe627('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe627('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xe627('0x5')]('in',_0xe627('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xe627('0x7')]}}; \ No newline at end of file +var _0xf61e=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x545323,_0x1f4469){var _0x5af307=function(_0xb03b5d){while(--_0xb03b5d){_0x545323['push'](_0x545323['shift']());}};_0x5af307(++_0x1f4469);}(_0xf61e,0x191));var _0xef61=function(_0x2817ea,_0x41348c){_0x2817ea=_0x2817ea-0x0;var _0x262748=_0xf61e[_0x2817ea];return _0x262748;};'use strict';var Sequelize=require(_0xef61('0x0'));module[_0xef61('0x1')]={'closed':{'type':Sequelize[_0xef61('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xef61('0x3')]},'disposition':{'type':Sequelize[_0xef61('0x4')]},'secondDisposition':{'type':Sequelize[_0xef61('0x4')]},'thirdDisposition':{'type':Sequelize[_0xef61('0x4')]},'note':{'type':Sequelize[_0xef61('0x4')]},'read1stAt':{'type':Sequelize[_0xef61('0x3')]},'fax':{'type':Sequelize[_0xef61('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xef61('0x5')]('in',_0xef61('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xef61('0x5')]('in',_0xef61('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 37bb2e6..1fecfea 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 _0xf72c=['where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','findAll','color','emit','faxInteractionTags:save','removeTags','join','root','server','files','transcript-%d-%s.zip','Attachment','createdAt','Messages','get','mkdirSync','length','basename','pipe','download','log','err','unlinkSync','rimraf','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','then','end','error','stack','name','send','index','FaxInteraction','rawAttributes','type','key','getOptions','catch','params','keys','query','filters','model','attributes','intersection','fields','includeAll','merge','options','find','create','body','update','destroy','describe','FaxMessage','addMessage','ids','omit','getMessages','hasOwnProperty','sort'];(function(_0x3c1864,_0x4829c0){var _0x5c7b3a=function(_0x4a41fe){while(--_0x4a41fe){_0x3c1864['push'](_0x3c1864['shift']());}};_0x5c7b3a(++_0x4829c0);}(_0xf72c,0xde));var _0xcf72=function(_0x341be2,_0x95b5a6){_0x341be2=_0x341be2-0x0;var _0x48a954=_0xf72c[_0x341be2];return _0x48a954;};'use strict';var rimraf=require(_0xcf72('0x0'));var zipdir=require('zip-dir');var moment=require(_0xcf72('0x1'));var BPromise=require(_0xcf72('0x2'));var util=require(_0xcf72('0x3'));var path=require(_0xcf72('0x4'));var fs=require('fs');var _=require(_0xcf72('0x5'));var Redis=require(_0xcf72('0x6'));var interaction=require(_0xcf72('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xcf72('0x8'))(_0xcf72('0x9'));var config=require(_0xcf72('0xa'));var db=require(_0xcf72('0xb'))['db'];config[_0xcf72('0xc')]=_[_0xcf72('0xd')](config[_0xcf72('0xc')],{'host':_0xcf72('0xe'),'port':0x18eb});var socket=require(_0xcf72('0xf'))(new Redis(config[_0xcf72('0xc')]));require(_0xcf72('0x10'))['register'](socket);function respondWithStatusCode(_0x510942,_0x1f829a){_0x1f829a=_0x1f829a||0xcc;return function(_0x4cfbb0){if(_0x4cfbb0){return _0x510942[_0xcf72('0x11')](_0x1f829a);}return _0x510942[_0xcf72('0x12')](_0x1f829a)['end']();};}function respondWithResult(_0x27053a,_0x4a575a){_0x4a575a=_0x4a575a||0xc8;return function(_0xb93e2){if(_0xb93e2){return _0x27053a[_0xcf72('0x12')](_0x4a575a)[_0xcf72('0x13')](_0xb93e2);}};}function respondWithFilteredResult(_0x18fd48,_0x39f23f){return function(_0x147823){if(_0x147823){var _0x359620=typeof _0x39f23f[_0xcf72('0x14')]===_0xcf72('0x15')&&typeof _0x39f23f[_0xcf72('0x16')]==='undefined';var _0x4516aa=_0x147823[_0xcf72('0x17')];var _0x1696bf=_0x359620?0x0:_0x39f23f[_0xcf72('0x14')];var _0x4c5bb3=_0x359620?_0x147823[_0xcf72('0x17')]:_0x39f23f['offset']+_0x39f23f[_0xcf72('0x16')];var _0xa45a03;if(_0x4c5bb3>=_0x4516aa){_0x4c5bb3=_0x4516aa;_0xa45a03=0xc8;}else{_0xa45a03=0xce;}_0x18fd48[_0xcf72('0x12')](_0xa45a03);return _0x18fd48[_0xcf72('0x18')](_0xcf72('0x19'),_0x1696bf+'-'+_0x4c5bb3+'/'+_0x4516aa)[_0xcf72('0x13')](_0x147823);}return null;};}function saveUpdates(_0x139d94){return function(_0x48d43e){if(_0x48d43e){return _0x48d43e['update'](_0x139d94)[_0xcf72('0x1a')](function(_0x47231d){return _0x47231d;});}return null;};}function removeEntity(_0x356c79){return function(_0x12c8bb){if(_0x12c8bb){return _0x12c8bb['destroy']()[_0xcf72('0x1a')](function(){_0x356c79[_0xcf72('0x12')](0xcc)[_0xcf72('0x1b')]();});}};}function handleEntityNotFound(_0x38f142){return function(_0x177386){if(!_0x177386){_0x38f142[_0xcf72('0x11')](0x194);}return _0x177386;};}function handleError(_0x5074bf,_0x1f7ad3){_0x1f7ad3=_0x1f7ad3||0x1f4;return function(_0xc5bce){logger[_0xcf72('0x1c')](_0xc5bce[_0xcf72('0x1d')]);if(_0xc5bce[_0xcf72('0x1e')]){delete _0xc5bce[_0xcf72('0x1e')];}_0x5074bf[_0xcf72('0x12')](_0x1f7ad3)[_0xcf72('0x1f')](_0xc5bce);};}exports[_0xcf72('0x20')]=function(_0x4ce72d,_0x2745ec){var _0x18313d={};var _0x5e73c1=_['map'](db[_0xcf72('0x21')][_0xcf72('0x22')],function(_0x1d380c){return{'name':_0x1d380c['fieldName'],'type':_0x1d380c[_0xcf72('0x23')][_0xcf72('0x24')]};});_0x18313d=qs[_0xcf72('0x25')](_0x5e73c1,_0x4ce72d);return interaction['findAll']('fax',_0x4ce72d['query'],_0x4ce72d['user'],_0x18313d,_0x5e73c1)[_0xcf72('0x1a')](respondWithFilteredResult(_0x2745ec,_0x18313d))[_0xcf72('0x26')](handleError(_0x2745ec,null));};exports['show']=function(_0x404d68,_0x44d4ee){var _0x4c683c={'raw':![],'where':{'id':_0x404d68[_0xcf72('0x27')]['id']}},_0x594d3b={};_0x594d3b['model']=_[_0xcf72('0x28')](db[_0xcf72('0x21')][_0xcf72('0x22')]);_0x594d3b[_0xcf72('0x29')]=_[_0xcf72('0x28')](_0x404d68[_0xcf72('0x29')]);_0x594d3b[_0xcf72('0x2a')]=_['intersection'](_0x594d3b[_0xcf72('0x2b')],_0x594d3b[_0xcf72('0x29')]);_0x4c683c[_0xcf72('0x2c')]=_[_0xcf72('0x2d')](_0x594d3b[_0xcf72('0x2b')],qs[_0xcf72('0x2e')](_0x404d68[_0xcf72('0x29')][_0xcf72('0x2e')]));_0x4c683c[_0xcf72('0x2c')]=_0x4c683c[_0xcf72('0x2c')]['length']?_0x4c683c['attributes']:_0x594d3b[_0xcf72('0x2b')];if(_0x404d68[_0xcf72('0x29')][_0xcf72('0x2f')]){_0x4c683c['include']=[{'all':!![]}];}_0x4c683c=_[_0xcf72('0x30')]({},_0x4c683c,_0x404d68[_0xcf72('0x31')]);return db[_0xcf72('0x21')][_0xcf72('0x32')](_0x4c683c)[_0xcf72('0x1a')](handleEntityNotFound(_0x44d4ee,null))[_0xcf72('0x1a')](respondWithResult(_0x44d4ee,null))['catch'](handleError(_0x44d4ee,null));};exports[_0xcf72('0x33')]=function(_0x2ed447,_0x123631){return db[_0xcf72('0x21')][_0xcf72('0x33')](_0x2ed447[_0xcf72('0x34')],{})[_0xcf72('0x1a')](respondWithResult(_0x123631,0xc9))[_0xcf72('0x26')](handleError(_0x123631,null));};exports[_0xcf72('0x35')]=function(_0x5aa1f6,_0x4cc93e){if(_0x5aa1f6['body']['id']){delete _0x5aa1f6[_0xcf72('0x34')]['id'];}return db[_0xcf72('0x21')][_0xcf72('0x32')]({'where':{'id':_0x5aa1f6[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x4cc93e,null))[_0xcf72('0x1a')](saveUpdates(_0x5aa1f6['body'],null))[_0xcf72('0x1a')](respondWithResult(_0x4cc93e,null))[_0xcf72('0x26')](handleError(_0x4cc93e,null));};exports[_0xcf72('0x36')]=function(_0x25616c,_0x3bba81){return db[_0xcf72('0x21')][_0xcf72('0x32')]({'where':{'id':_0x25616c['params']['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x3bba81,null))[_0xcf72('0x1a')](removeEntity(_0x3bba81,null))['catch'](handleError(_0x3bba81,null));};exports[_0xcf72('0x37')]=function(_0x538abe,_0x20bc84){return db['FaxInteraction']['describe']()[_0xcf72('0x1a')](respondWithResult(_0x20bc84,null))[_0xcf72('0x26')](handleError(_0x20bc84,null));};exports['addMessage']=function(_0x57e899,_0x2534e1){return db[_0xcf72('0x38')][_0xcf72('0x32')]({'where':{'id':_0x57e899[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x2534e1,null))[_0xcf72('0x1a')](function(_0x1034bb){if(_0x1034bb){return _0x1034bb[_0xcf72('0x39')](_0x57e899[_0xcf72('0x34')][_0xcf72('0x3a')],_[_0xcf72('0x3b')](_0x57e899['body'],['ids','id'])||{});}})[_0xcf72('0x1a')](respondWithResult(_0x2534e1,null))[_0xcf72('0x26')](handleError(_0x2534e1,null));};exports[_0xcf72('0x3c')]=function(_0x297b42,_0x2e3d7d){var _0x2c6f67={'raw':![],'where':{}};var _0x1276e9={};var _0x5acea5={'count':0x0,'rows':[]};return db[_0xcf72('0x21')]['findOne']({'where':{'id':_0x297b42[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x2e3d7d,null))[_0xcf72('0x1a')](function(_0x25b96d){if(_0x25b96d){_0x1276e9[_0xcf72('0x2b')]=_[_0xcf72('0x28')](db[_0xcf72('0x38')][_0xcf72('0x22')]);_0x1276e9[_0xcf72('0x29')]=_['keys'](_0x297b42[_0xcf72('0x29')]);_0x1276e9[_0xcf72('0x2a')]=_['intersection'](_0x1276e9['model'],_0x1276e9[_0xcf72('0x29')]);_0x2c6f67[_0xcf72('0x2c')]=_['intersection'](_0x1276e9[_0xcf72('0x2b')],qs['fields'](_0x297b42['query'][_0xcf72('0x2e')]));_0x2c6f67[_0xcf72('0x2c')]=_0x2c6f67['attributes']['length']?_0x2c6f67[_0xcf72('0x2c')]:_0x1276e9[_0xcf72('0x2b')];if(!_0x297b42[_0xcf72('0x29')][_0xcf72('0x3d')]('nolimit')){_0x2c6f67[_0xcf72('0x16')]=qs['limit'](_0x297b42[_0xcf72('0x29')][_0xcf72('0x16')]);_0x2c6f67['offset']=qs[_0xcf72('0x14')](_0x297b42[_0xcf72('0x29')]['offset']);}_0x2c6f67['order']=qs[_0xcf72('0x3e')](_0x297b42['query'][_0xcf72('0x3e')]);_0x2c6f67[_0xcf72('0x3f')]=qs['filters'](_['pick'](_0x297b42['query'],_0x1276e9[_0xcf72('0x2a')]));_0x2c6f67['where']['FaxInteractionId']=_0x25b96d['id'];if(_0x297b42[_0xcf72('0x29')][_0xcf72('0x40')]){_0x2c6f67[_0xcf72('0x3f')]=_[_0xcf72('0x30')](_0x2c6f67[_0xcf72('0x3f')],{'$or':_[_0xcf72('0x41')](_0x2c6f67[_0xcf72('0x2c')],function(_0x2ffd6b){var _0x3739aa={};_0x3739aa[_0x2ffd6b]={'$like':'%'+_0x297b42[_0xcf72('0x29')][_0xcf72('0x40')]+'%'};return _0x3739aa;})});}if(_0x297b42['query']['$gte']){var _0x14c029=_0x297b42[_0xcf72('0x29')][_0xcf72('0x42')][_0xcf72('0x43')](',');var _0x34af60={};_0x34af60[_0x14c029[0x0]]={'$gte':moment(_0x14c029[0x1])[_0xcf72('0x44')](_0xcf72('0x45'))};_0x2c6f67[_0xcf72('0x3f')]=_[_0xcf72('0x30')](_0x2c6f67[_0xcf72('0x3f')],_0x34af60);}_0x2c6f67=_['merge']({},_0x2c6f67,_0x297b42[_0xcf72('0x31')]);return db[_0xcf72('0x38')][_0xcf72('0x17')]({'where':_0x2c6f67[_0xcf72('0x3f')]})[_0xcf72('0x1a')](function(_0x3f45c2){_0x5acea5[_0xcf72('0x17')]=_0x3f45c2;if(_0x297b42[_0xcf72('0x29')]['includeAll']){_0x2c6f67['include']=[{'all':!![]}];}return db[_0xcf72('0x38')]['findAll'](_0x2c6f67);})[_0xcf72('0x1a')](function(_0x4976af){_0x5acea5[_0xcf72('0x46')]=_0x4976af;return _0x5acea5;});}})[_0xcf72('0x1a')](respondWithFilteredResult(_0x2e3d7d,_0x2c6f67))[_0xcf72('0x26')](handleError(_0x2e3d7d,null));};exports[_0xcf72('0x47')]=function(_0x4b8557,_0x5873e6){return db['FaxInteraction'][_0xcf72('0x32')]({'where':{'id':_0x4b8557[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x5873e6,null))[_0xcf72('0x1a')](function(_0x3495ff){if(_0x3495ff){return _0x3495ff[_0xcf72('0x48')](_0x4b8557[_0xcf72('0x34')][_0xcf72('0x3a')],_['omit'](_0x4b8557[_0xcf72('0x34')],[_0xcf72('0x3a'),'id'])||{})['spread'](function(){return db['Tag'][_0xcf72('0x49')]({'attributes':['id','name',_0xcf72('0x4a')],'where':{'id':_0x4b8557['body'][_0xcf72('0x3a')]}});})[_0xcf72('0x1a')](function(_0x41ccf1){socket[_0xcf72('0x4b')](_0xcf72('0x4c'),{'id':Number(_0x4b8557[_0xcf72('0x27')]['id']),'tags':_0x41ccf1||[]});return{'id':Number(_0x4b8557['params']['id']),'tags':_0x41ccf1||[]};});}})[_0xcf72('0x1a')](respondWithResult(_0x5873e6,null))['catch'](handleError(_0x5873e6,null));};exports[_0xcf72('0x4d')]=function(_0x51d1e9,_0x96a891){return db[_0xcf72('0x21')][_0xcf72('0x32')]({'where':{'id':_0x51d1e9[_0xcf72('0x27')]['id']}})[_0xcf72('0x1a')](handleEntityNotFound(_0x96a891,null))[_0xcf72('0x1a')](function(_0x379de3){if(_0x379de3){return _0x379de3['removeTags'](_0x51d1e9[_0xcf72('0x29')][_0xcf72('0x3a')]);}})['then'](respondWithStatusCode(_0x96a891,null))[_0xcf72('0x26')](handleError(_0x96a891,null));};exports['download']=function(_0x265b7f,_0x23a044){var _0x4b42af=moment()['unix']()['toString']();var _0x49fb7f=path[_0xcf72('0x4e')](config[_0xcf72('0x4f')],_0xcf72('0x50'),'files','tmp');var _0x23cd53=path['join'](config[_0xcf72('0x4f')],_0xcf72('0x50'),_0xcf72('0x51'),'attachments');var _0x223196=path[_0xcf72('0x4e')](_0x49fb7f,_0x4b42af);var _0x380480=util[_0xcf72('0x44')](_0xcf72('0x52'),_0x265b7f[_0xcf72('0x27')]['id'],_0x4b42af);var _0x105380=path[_0xcf72('0x4e')](_0x49fb7f,_0x380480);var _0x1fd651=[];_0x1fd651['push']({'model':db[_0xcf72('0x53')],'as':_0xcf72('0x53'),'raw':!![]});var _0x391443=[{'model':db[_0xcf72('0x38')],'as':'Messages','attributes':['id',_0xcf72('0x34'),_0xcf72('0x54')],'include':_0x1fd651}];return db['FaxInteraction'][_0xcf72('0x32')]({'where':{'id':_0x265b7f[_0xcf72('0x27')]['id']},'include':_0x391443})[_0xcf72('0x1a')](handleEntityNotFound(_0x23a044,null))['then'](function(_0x13543c){if(_0x13543c&&_0x13543c[_0xcf72('0x55')]){var _0x532461=_0x13543c[_0xcf72('0x56')]({'plain':!![]});fs[_0xcf72('0x57')](_0x223196);for(var _0x4da941=0x0;_0x4da941<_0x532461[_0xcf72('0x55')][_0xcf72('0x58')];_0x4da941++){var _0x4009f9=_0x532461[_0xcf72('0x55')][_0x4da941][_0xcf72('0x53')];if(_0x4009f9){var _0x2e8c5c=path[_0xcf72('0x4e')](_0x23cd53,_0x4009f9[_0xcf72('0x59')]);if(fs['existsSync'](_0x2e8c5c)){fs['createReadStream'](_0x2e8c5c)[_0xcf72('0x5a')](fs['createWriteStream'](path['join'](_0x223196,_0x4009f9['basename'])));}}}return BPromise['resolve']()[_0xcf72('0x1a')](function(){return new BPromise(function(_0x31000a,_0x4827cb){zipdir(_0x223196,{'saveTo':_0x105380},function(_0x56ad5b,_0x43060b){if(_0x56ad5b)return _0x4827cb(_0x56ad5b);return _0x31000a(_0x43060b);});})[_0xcf72('0x1a')](function(){return new BPromise(function(_0x359c1a,_0x5966fc){rimraf(_0x223196,function(_0x5c0679){if(_0x5c0679)_0x5966fc(_0x5c0679);return _0x359c1a();});});})[_0xcf72('0x1a')](function(){return _0x23a044[_0xcf72('0x5b')](_0x105380,_0x380480,function(_0x1f0ad1){if(_0x1f0ad1){console[_0xcf72('0x5c')](_0xcf72('0x5d'),_0x1f0ad1);}else{fs[_0xcf72('0x5e')](_0x105380);}});});});}else{return _0x23a044['sendStatus'](0xc8);}})[_0xcf72('0x26')](handleError(_0x23a044,null));}; \ No newline at end of file +var _0xb5cc=['FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','download','unix','toString','root','join','server','files','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','pipe','createWriteStream','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','destroy','error','name','send','index','map','fieldName','type','getOptions','findAll','query','then','catch','show','params','keys','FaxInteraction','rawAttributes','model','attributes','fields','length','includeAll','include','merge','options','create','body','find','addMessage','FaxMessage','ids','omit','filters','intersection','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x2c5340,_0x5c86e5){var _0x3c505e=function(_0x1089d9){while(--_0x1089d9){_0x2c5340['push'](_0x2c5340['shift']());}};_0x3c505e(++_0x5c86e5);}(_0xb5cc,0x150));var _0xcb5c=function(_0xcb493a,_0x5bb691){_0xcb493a=_0xcb493a-0x0;var _0x2a0fbf=_0xb5cc[_0xcb493a];return _0x2a0fbf;};'use strict';var rimraf=require(_0xcb5c('0x0'));var zipdir=require(_0xcb5c('0x1'));var moment=require(_0xcb5c('0x2'));var BPromise=require(_0xcb5c('0x3'));var util=require(_0xcb5c('0x4'));var path=require(_0xcb5c('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xcb5c('0x6'));var interaction=require(_0xcb5c('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xcb5c('0x8'))(_0xcb5c('0x9'));var config=require(_0xcb5c('0xa'));var db=require(_0xcb5c('0xb'))['db'];config[_0xcb5c('0xc')]=_[_0xcb5c('0xd')](config['redis'],{'host':_0xcb5c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcb5c('0xc')]));require(_0xcb5c('0xf'))[_0xcb5c('0x10')](socket);function respondWithStatusCode(_0x5d9526,_0x480c82){_0x480c82=_0x480c82||0xcc;return function(_0x1a8593){if(_0x1a8593){return _0x5d9526[_0xcb5c('0x11')](_0x480c82);}return _0x5d9526[_0xcb5c('0x12')](_0x480c82)[_0xcb5c('0x13')]();};}function respondWithResult(_0x523ebe,_0x268c03){_0x268c03=_0x268c03||0xc8;return function(_0x579430){if(_0x579430){return _0x523ebe[_0xcb5c('0x12')](_0x268c03)[_0xcb5c('0x14')](_0x579430);}};}function respondWithFilteredResult(_0x42ca62,_0x386306){return function(_0x6ddad3){if(_0x6ddad3){var _0x371fcf=typeof _0x386306[_0xcb5c('0x15')]===_0xcb5c('0x16')&&typeof _0x386306['limit']===_0xcb5c('0x16');var _0x1878d3=_0x6ddad3['count'];var _0x23aea7=_0x371fcf?0x0:_0x386306[_0xcb5c('0x15')];var _0x345ad0=_0x371fcf?_0x6ddad3[_0xcb5c('0x17')]:_0x386306['offset']+_0x386306[_0xcb5c('0x18')];var _0xd6642;if(_0x345ad0>=_0x1878d3){_0x345ad0=_0x1878d3;_0xd6642=0xc8;}else{_0xd6642=0xce;}_0x42ca62['status'](_0xd6642);return _0x42ca62['set'](_0xcb5c('0x19'),_0x23aea7+'-'+_0x345ad0+'/'+_0x1878d3)['json'](_0x6ddad3);}return null;};}function saveUpdates(_0x2c870e){return function(_0x5437bc){if(_0x5437bc){return _0x5437bc[_0xcb5c('0x1a')](_0x2c870e)['then'](function(_0x47fa48){return _0x47fa48;});}return null;};}function removeEntity(_0x55d0c8){return function(_0x2fcd71){if(_0x2fcd71){return _0x2fcd71[_0xcb5c('0x1b')]()['then'](function(){_0x55d0c8[_0xcb5c('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dff2e){return function(_0x574183){if(!_0x574183){_0x1dff2e[_0xcb5c('0x11')](0x194);}return _0x574183;};}function handleError(_0x366565,_0xf091d1){_0xf091d1=_0xf091d1||0x1f4;return function(_0x4ee1f0){logger[_0xcb5c('0x1c')](_0x4ee1f0['stack']);if(_0x4ee1f0[_0xcb5c('0x1d')]){delete _0x4ee1f0[_0xcb5c('0x1d')];}_0x366565[_0xcb5c('0x12')](_0xf091d1)[_0xcb5c('0x1e')](_0x4ee1f0);};}exports[_0xcb5c('0x1f')]=function(_0x46fc02,_0x54cb87){var _0x1d29fb={};var _0x76aea6=_[_0xcb5c('0x20')](db['FaxInteraction']['rawAttributes'],function(_0x1dd494){return{'name':_0x1dd494[_0xcb5c('0x21')],'type':_0x1dd494[_0xcb5c('0x22')]['key']};});_0x1d29fb=qs[_0xcb5c('0x23')](_0x76aea6,_0x46fc02);return interaction[_0xcb5c('0x24')]('fax',_0x46fc02[_0xcb5c('0x25')],_0x46fc02['user'],_0x1d29fb,_0x76aea6)[_0xcb5c('0x26')](respondWithFilteredResult(_0x54cb87,_0x1d29fb))[_0xcb5c('0x27')](handleError(_0x54cb87,null));};exports[_0xcb5c('0x28')]=function(_0xda496b,_0x2bcd3a){var _0x447fce={'raw':![],'where':{'id':_0xda496b[_0xcb5c('0x29')]['id']}},_0xe67a15={};_0xe67a15['model']=_[_0xcb5c('0x2a')](db[_0xcb5c('0x2b')][_0xcb5c('0x2c')]);_0xe67a15[_0xcb5c('0x25')]=_[_0xcb5c('0x2a')](_0xda496b[_0xcb5c('0x25')]);_0xe67a15['filters']=_['intersection'](_0xe67a15[_0xcb5c('0x2d')],_0xe67a15[_0xcb5c('0x25')]);_0x447fce[_0xcb5c('0x2e')]=_['intersection'](_0xe67a15[_0xcb5c('0x2d')],qs[_0xcb5c('0x2f')](_0xda496b['query'][_0xcb5c('0x2f')]));_0x447fce[_0xcb5c('0x2e')]=_0x447fce[_0xcb5c('0x2e')][_0xcb5c('0x30')]?_0x447fce[_0xcb5c('0x2e')]:_0xe67a15[_0xcb5c('0x2d')];if(_0xda496b['query'][_0xcb5c('0x31')]){_0x447fce[_0xcb5c('0x32')]=[{'all':!![]}];}_0x447fce=_[_0xcb5c('0x33')]({},_0x447fce,_0xda496b[_0xcb5c('0x34')]);return db[_0xcb5c('0x2b')]['find'](_0x447fce)[_0xcb5c('0x26')](handleEntityNotFound(_0x2bcd3a,null))[_0xcb5c('0x26')](respondWithResult(_0x2bcd3a,null))[_0xcb5c('0x27')](handleError(_0x2bcd3a,null));};exports[_0xcb5c('0x35')]=function(_0x2fc82d,_0x3b47fb){return db['FaxInteraction'][_0xcb5c('0x35')](_0x2fc82d['body'],{})[_0xcb5c('0x26')](respondWithResult(_0x3b47fb,0xc9))[_0xcb5c('0x27')](handleError(_0x3b47fb,null));};exports['update']=function(_0x269ff9,_0x4aa122){if(_0x269ff9[_0xcb5c('0x36')]['id']){delete _0x269ff9[_0xcb5c('0x36')]['id'];}return db[_0xcb5c('0x2b')][_0xcb5c('0x37')]({'where':{'id':_0x269ff9[_0xcb5c('0x29')]['id']}})[_0xcb5c('0x26')](handleEntityNotFound(_0x4aa122,null))[_0xcb5c('0x26')](saveUpdates(_0x269ff9[_0xcb5c('0x36')],null))['then'](respondWithResult(_0x4aa122,null))[_0xcb5c('0x27')](handleError(_0x4aa122,null));};exports[_0xcb5c('0x1b')]=function(_0x512b36,_0x5d559e){return db[_0xcb5c('0x2b')]['find']({'where':{'id':_0x512b36['params']['id']}})[_0xcb5c('0x26')](handleEntityNotFound(_0x5d559e,null))[_0xcb5c('0x26')](removeEntity(_0x5d559e,null))[_0xcb5c('0x27')](handleError(_0x5d559e,null));};exports['describe']=function(_0x416a01,_0x35f418){return db[_0xcb5c('0x2b')]['describe']()[_0xcb5c('0x26')](respondWithResult(_0x35f418,null))[_0xcb5c('0x27')](handleError(_0x35f418,null));};exports[_0xcb5c('0x38')]=function(_0x179f22,_0x116b34){return db[_0xcb5c('0x39')][_0xcb5c('0x37')]({'where':{'id':_0x179f22['params']['id']}})[_0xcb5c('0x26')](handleEntityNotFound(_0x116b34,null))[_0xcb5c('0x26')](function(_0x1ab752){if(_0x1ab752){return _0x1ab752['addMessage'](_0x179f22['body'][_0xcb5c('0x3a')],_[_0xcb5c('0x3b')](_0x179f22[_0xcb5c('0x36')],[_0xcb5c('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x116b34,null))[_0xcb5c('0x27')](handleError(_0x116b34,null));};exports['getMessages']=function(_0xf1abd3,_0x409422){var _0x29f1a8={'raw':![],'where':{}};var _0x3883b5={};var _0x3b93d5={'count':0x0,'rows':[]};return db['FaxInteraction']['findOne']({'where':{'id':_0xf1abd3['params']['id']}})[_0xcb5c('0x26')](handleEntityNotFound(_0x409422,null))['then'](function(_0x3a350a){if(_0x3a350a){_0x3883b5['model']=_['keys'](db[_0xcb5c('0x39')][_0xcb5c('0x2c')]);_0x3883b5['query']=_['keys'](_0xf1abd3['query']);_0x3883b5[_0xcb5c('0x3c')]=_[_0xcb5c('0x3d')](_0x3883b5[_0xcb5c('0x2d')],_0x3883b5[_0xcb5c('0x25')]);_0x29f1a8[_0xcb5c('0x2e')]=_['intersection'](_0x3883b5[_0xcb5c('0x2d')],qs[_0xcb5c('0x2f')](_0xf1abd3[_0xcb5c('0x25')][_0xcb5c('0x2f')]));_0x29f1a8[_0xcb5c('0x2e')]=_0x29f1a8['attributes']['length']?_0x29f1a8[_0xcb5c('0x2e')]:_0x3883b5[_0xcb5c('0x2d')];if(!_0xf1abd3['query'][_0xcb5c('0x3e')](_0xcb5c('0x3f'))){_0x29f1a8['limit']=qs[_0xcb5c('0x18')](_0xf1abd3[_0xcb5c('0x25')][_0xcb5c('0x18')]);_0x29f1a8[_0xcb5c('0x15')]=qs[_0xcb5c('0x15')](_0xf1abd3[_0xcb5c('0x25')]['offset']);}_0x29f1a8[_0xcb5c('0x40')]=qs[_0xcb5c('0x41')](_0xf1abd3[_0xcb5c('0x25')][_0xcb5c('0x41')]);_0x29f1a8[_0xcb5c('0x42')]=qs[_0xcb5c('0x3c')](_[_0xcb5c('0x43')](_0xf1abd3[_0xcb5c('0x25')],_0x3883b5[_0xcb5c('0x3c')]));_0x29f1a8[_0xcb5c('0x42')][_0xcb5c('0x44')]=_0x3a350a['id'];if(_0xf1abd3['query'][_0xcb5c('0x45')]){_0x29f1a8[_0xcb5c('0x42')]=_[_0xcb5c('0x33')](_0x29f1a8['where'],{'$or':_[_0xcb5c('0x20')](_0x29f1a8[_0xcb5c('0x2e')],function(_0x4d6bdf){var _0x1587c8={};_0x1587c8[_0x4d6bdf]={'$like':'%'+_0xf1abd3[_0xcb5c('0x25')]['filter']+'%'};return _0x1587c8;})});}if(_0xf1abd3[_0xcb5c('0x25')]['$gte']){var _0x12d2a7=_0xf1abd3['query'][_0xcb5c('0x46')][_0xcb5c('0x47')](',');var _0x164067={};_0x164067[_0x12d2a7[0x0]]={'$gte':moment(_0x12d2a7[0x1])['format'](_0xcb5c('0x48'))};_0x29f1a8['where']=_[_0xcb5c('0x33')](_0x29f1a8[_0xcb5c('0x42')],_0x164067);}_0x29f1a8=_[_0xcb5c('0x33')]({},_0x29f1a8,_0xf1abd3[_0xcb5c('0x34')]);return db[_0xcb5c('0x39')][_0xcb5c('0x17')]({'where':_0x29f1a8[_0xcb5c('0x42')]})[_0xcb5c('0x26')](function(_0x77a120){_0x3b93d5[_0xcb5c('0x17')]=_0x77a120;if(_0xf1abd3[_0xcb5c('0x25')][_0xcb5c('0x31')]){_0x29f1a8[_0xcb5c('0x32')]=[{'all':!![]}];}return db['FaxMessage'][_0xcb5c('0x24')](_0x29f1a8);})[_0xcb5c('0x26')](function(_0x285a9f){_0x3b93d5[_0xcb5c('0x49')]=_0x285a9f;return _0x3b93d5;});}})[_0xcb5c('0x26')](respondWithFilteredResult(_0x409422,_0x29f1a8))[_0xcb5c('0x27')](handleError(_0x409422,null));};exports[_0xcb5c('0x4a')]=function(_0x565c5d,_0x553ad3){return db[_0xcb5c('0x2b')][_0xcb5c('0x37')]({'where':{'id':_0x565c5d['params']['id']}})[_0xcb5c('0x26')](handleEntityNotFound(_0x553ad3,null))[_0xcb5c('0x26')](function(_0x300a85){if(_0x300a85){return _0x300a85['setTags'](_0x565c5d['body'][_0xcb5c('0x3a')],_[_0xcb5c('0x3b')](_0x565c5d[_0xcb5c('0x36')],['ids','id'])||{})[_0xcb5c('0x4b')](function(){return db[_0xcb5c('0x4c')]['findAll']({'attributes':['id','name',_0xcb5c('0x4d')],'where':{'id':_0x565c5d[_0xcb5c('0x36')][_0xcb5c('0x3a')]}});})[_0xcb5c('0x26')](function(_0x1550e0){socket[_0xcb5c('0x4e')](_0xcb5c('0x4f'),{'id':Number(_0x565c5d[_0xcb5c('0x29')]['id']),'tags':_0x1550e0||[]});return{'id':Number(_0x565c5d['params']['id']),'tags':_0x1550e0||[]};});}})[_0xcb5c('0x26')](respondWithResult(_0x553ad3,null))[_0xcb5c('0x27')](handleError(_0x553ad3,null));};exports[_0xcb5c('0x50')]=function(_0x1539a3,_0x458798){return db[_0xcb5c('0x2b')][_0xcb5c('0x37')]({'where':{'id':_0x1539a3[_0xcb5c('0x29')]['id']}})[_0xcb5c('0x26')](handleEntityNotFound(_0x458798,null))[_0xcb5c('0x26')](function(_0x58fd09){if(_0x58fd09){return _0x58fd09[_0xcb5c('0x50')](_0x1539a3['query'][_0xcb5c('0x3a')]);}})[_0xcb5c('0x26')](respondWithStatusCode(_0x458798,null))['catch'](handleError(_0x458798,null));};exports[_0xcb5c('0x51')]=function(_0x32f70e,_0x13fc7c){var _0x22bf25=moment()[_0xcb5c('0x52')]()[_0xcb5c('0x53')]();var _0x3b8340=path['join'](config[_0xcb5c('0x54')],'server','files','tmp');var _0x138554=path[_0xcb5c('0x55')](config['root'],_0xcb5c('0x56'),_0xcb5c('0x57'),_0xcb5c('0x58'));var _0x3784ac=path[_0xcb5c('0x55')](_0x3b8340,_0x22bf25);var _0x172868=util[_0xcb5c('0x59')](_0xcb5c('0x5a'),_0x32f70e[_0xcb5c('0x29')]['id'],_0x22bf25);var _0x581d73=path[_0xcb5c('0x55')](_0x3b8340,_0x172868);var _0x39631b=[];_0x39631b[_0xcb5c('0x5b')]({'model':db[_0xcb5c('0x5c')],'as':_0xcb5c('0x5c'),'raw':!![]});var _0x58d6a3=[{'model':db[_0xcb5c('0x39')],'as':_0xcb5c('0x5d'),'attributes':['id','body',_0xcb5c('0x5e')],'include':_0x39631b}];return db['FaxInteraction']['find']({'where':{'id':_0x32f70e['params']['id']},'include':_0x58d6a3})[_0xcb5c('0x26')](handleEntityNotFound(_0x13fc7c,null))['then'](function(_0x3a304a){if(_0x3a304a&&_0x3a304a[_0xcb5c('0x5d')]){var _0x5da61a=_0x3a304a['get']({'plain':!![]});fs[_0xcb5c('0x5f')](_0x3784ac);for(var _0x13df33=0x0;_0x13df33<_0x5da61a[_0xcb5c('0x5d')][_0xcb5c('0x30')];_0x13df33++){var _0x38cf30=_0x5da61a[_0xcb5c('0x5d')][_0x13df33]['Attachment'];if(_0x38cf30){var _0x4a0214=path[_0xcb5c('0x55')](_0x138554,_0x38cf30[_0xcb5c('0x60')]);if(fs[_0xcb5c('0x61')](_0x4a0214)){fs['createReadStream'](_0x4a0214)[_0xcb5c('0x62')](fs[_0xcb5c('0x63')](path[_0xcb5c('0x55')](_0x3784ac,_0x38cf30[_0xcb5c('0x60')])));}}}return BPromise['resolve']()[_0xcb5c('0x26')](function(){return new BPromise(function(_0x178a90,_0x110d22){zipdir(_0x3784ac,{'saveTo':_0x581d73},function(_0x279ea0,_0x550106){if(_0x279ea0)return _0x110d22(_0x279ea0);return _0x178a90(_0x550106);});})['then'](function(){return new BPromise(function(_0x2a564b,_0x4e8e96){rimraf(_0x3784ac,function(_0x54ef5){if(_0x54ef5)_0x4e8e96(_0x54ef5);return _0x2a564b();});});})[_0xcb5c('0x26')](function(){return _0x13fc7c[_0xcb5c('0x51')](_0x581d73,_0x172868,function(_0x12a239){if(_0x12a239){console['log']('err',_0x12a239);}else{fs[_0xcb5c('0x64')](_0x581d73);}});});});}else{return _0x13fc7c[_0xcb5c('0x11')](0xc8);}})[_0xcb5c('0x27')](handleError(_0x13fc7c,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index ad6b3d0..873fe86 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 _0xa2ea=['setDataValue','findAll','then','unreadMessages','length','emit','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove','getUsers'];(function(_0x2eec08,_0x4085b9){var _0x2769d9=function(_0x7bb2cb){while(--_0x7bb2cb){_0x2eec08['push'](_0x2eec08['shift']());}};_0x2769d9(++_0x4085b9);}(_0xa2ea,0x158));var _0xaa2e=function(_0xe779,_0x1a1b29){_0xe779=_0xe779-0x0;var _0x5201de=_0xa2ea[_0xe779];return _0x5201de;};'use strict';var EventEmitter=require(_0xaa2e('0x0'));var FaxInteraction=require(_0xaa2e('0x1'))['db'][_0xaa2e('0x2')];var FaxMessage=require(_0xaa2e('0x1'))['db'][_0xaa2e('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0xaa2e('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa2e('0x5'),'afterDestroy':_0xaa2e('0x6')};function emitEvent(_0x5177cd){return function(_0x4f652c,_0x2fc170,_0x2ea8ae){_0x4f652c[_0xaa2e('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x53b2ce){_0x4f652c[_0xaa2e('0x8')]('Users',_0x53b2ce['map'](function(_0x5c0bf9){return{'id':_0x5c0bf9['id']};}));return FaxMessage[_0xaa2e('0x9')]({'where':{'FaxInteractionId':_0x4f652c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa2e('0xa')](function(_0x5e81f6){_0x4f652c[_0xaa2e('0x8')](_0xaa2e('0xb'),_0x5e81f6[_0xaa2e('0xc')]);FaxInteractionEvents[_0xaa2e('0xd')](_0x5177cd+':'+_0x4f652c['id'],_0x4f652c);FaxInteractionEvents[_0xaa2e('0xd')](_0x5177cd,_0x4f652c);_0x2ea8ae(null);})['catch'](_0x2ea8ae(null));};}for(var e in events){if(events[_0xaa2e('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0xaa2e('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x3944=['save','update','map','findAll','then','setDataValue','unreadMessages','catch','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage'];(function(_0x4eab79,_0x441f27){var _0x2805f3=function(_0x49ef40){while(--_0x49ef40){_0x4eab79['push'](_0x4eab79['shift']());}};_0x2805f3(++_0x441f27);}(_0x3944,0x164));var _0x4394=function(_0x1e900c,_0x461c86){_0x1e900c=_0x1e900c-0x0;var _0x102cfc=_0x3944[_0x1e900c];return _0x102cfc;};'use strict';var EventEmitter=require(_0x4394('0x0'));var FaxInteraction=require(_0x4394('0x1'))['db'][_0x4394('0x2')];var FaxMessage=require(_0x4394('0x1'))['db'][_0x4394('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4394('0x4'),'afterUpdate':_0x4394('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3c4df7){return function(_0xb813e4,_0x2a14b4,_0x3e3030){_0xb813e4['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x27664c){_0xb813e4['setDataValue']('Users',_0x27664c[_0x4394('0x6')](function(_0x18faa7){return{'id':_0x18faa7['id']};}));return FaxMessage[_0x4394('0x7')]({'where':{'FaxInteractionId':_0xb813e4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4394('0x8')](function(_0x4455be){_0xb813e4[_0x4394('0x9')](_0x4394('0xa'),_0x4455be['length']);FaxInteractionEvents['emit'](_0x3c4df7+':'+_0xb813e4['id'],_0xb813e4);FaxInteractionEvents['emit'](_0x3c4df7,_0xb813e4);_0x3e3030(null);})[_0x4394('0xb')](_0x3e3030(null));};}for(var e in events){if(events[_0x4394('0xc')](e)){var event=events[e];FaxInteraction[_0x4394('0xd')](e,emitEvent(event));}}module[_0x4394('0xe')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8633595..77de28d 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 _0x00c2=['format','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closed','closedAt'];(function(_0x580971,_0x10984d){var _0x16d873=function(_0x594084){while(--_0x594084){_0x580971['push'](_0x580971['shift']());}};_0x16d873(++_0x10984d);}(_0x00c2,0x6a));var _0x200c=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x00c2[_0x432682];return _0x463d05;};'use strict';var _=require(_0x200c('0x0'));var util=require(_0x200c('0x1'));var logger=require('../../config/logger')(_0x200c('0x2'));var moment=require('moment');var BPromise=require(_0x200c('0x3'));var rp=require(_0x200c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x200c('0x5'));var config=require(_0x200c('0x6'));var attributes=require(_0x200c('0x7'));module[_0x200c('0x8')]=function(_0xeda4ec,_0x89bb23){return _0xeda4ec[_0x200c('0x9')](_0x200c('0xa'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1bfd6b,_0x11c95d,_0x56fecb){if(_0x1bfd6b[_0x200c('0xb')](_0x200c('0xc'))){_0x1bfd6b[_0x200c('0xd')]=moment()[_0x200c('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x56fecb(null,_0x1bfd6b);}}});}; \ No newline at end of file +var _0xa017=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','closed','closedAt','format'];(function(_0x3af989,_0x4ec040){var _0x41ee22=function(_0x491063){while(--_0x491063){_0x3af989['push'](_0x3af989['shift']());}};_0x41ee22(++_0x4ec040);}(_0xa017,0x1f1));var _0x7a01=function(_0x5b9412,_0x2d4fea){_0x5b9412=_0x5b9412-0x0;var _0x263491=_0xa017[_0x5b9412];return _0x263491;};'use strict';var _=require(_0x7a01('0x0'));var util=require(_0x7a01('0x1'));var logger=require(_0x7a01('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7a01('0x3'));var rp=require(_0x7a01('0x4'));var fs=require('fs');var path=require(_0x7a01('0x5'));var rimraf=require(_0x7a01('0x6'));var config=require(_0x7a01('0x7'));var attributes=require(_0x7a01('0x8'));module[_0x7a01('0x9')]=function(_0x5e3c22,_0x4ce14c){return _0x5e3c22[_0x7a01('0xa')](_0x7a01('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x501506,_0x5eb7eb,_0x37010a){if(_0x501506['changed'](_0x7a01('0xc'))){_0x501506[_0x7a01('0xd')]=moment()[_0x7a01('0xe')](_0x7a01('0xf'));}_0x37010a(null,_0x501506);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 49e3dee..0e9e3b9 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 _0x4ec4=['register','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','addTags','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x4ec4,0x1aa));var _0x44ec=function(_0x32fe5b,_0x464e33){_0x32fe5b=_0x32fe5b-0x0;var _0x2440e5=_0x4ec4[_0x32fe5b];return _0x2440e5;};'use strict';var _=require(_0x44ec('0x0'));var util=require(_0x44ec('0x1'));var moment=require('moment');var BPromise=require(_0x44ec('0x2'));var rs=require(_0x44ec('0x3'));var fs=require('fs');var Redis=require(_0x44ec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x44ec('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x44ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x44ec('0x7')][_0x44ec('0x8')]({'port':0x232a});config[_0x44ec('0x9')]=_[_0x44ec('0xa')](config[_0x44ec('0x9')],{'host':_0x44ec('0xb'),'port':0x18eb});var socket=require(_0x44ec('0xc'))(new Redis(config[_0x44ec('0x9')]));require(_0x44ec('0xd'))[_0x44ec('0xe')](socket);function respondWithRpcPromise(_0x1496ac,_0x5be5a2,_0x3a3e11){return new BPromise(function(_0x28a1ea,_0x1b231f){return client['request'](_0x1496ac,_0x3a3e11)[_0x44ec('0xf')](function(_0x5d782f){logger[_0x44ec('0x10')]('FaxInteraction,\x20%s,\x20%s',_0x5be5a2,_0x44ec('0x11'));logger[_0x44ec('0x12')](_0x44ec('0x13'),_0x5be5a2,'request\x20sent',JSON[_0x44ec('0x14')](_0x5d782f));if(_0x5d782f[_0x44ec('0x15')]){if(_0x5d782f[_0x44ec('0x15')][_0x44ec('0x16')]===0x1f4){logger[_0x44ec('0x15')](_0x44ec('0x17'),_0x5be5a2,_0x5d782f['error'][_0x44ec('0x18')]);return _0x1b231f(_0x5d782f[_0x44ec('0x15')][_0x44ec('0x18')]);}logger['error'](_0x44ec('0x17'),_0x5be5a2,_0x5d782f[_0x44ec('0x15')][_0x44ec('0x18')]);return _0x28a1ea(_0x5d782f[_0x44ec('0x15')][_0x44ec('0x18')]);}else{logger[_0x44ec('0x10')](_0x44ec('0x17'),_0x5be5a2,_0x44ec('0x11'));_0x28a1ea(_0x5d782f[_0x44ec('0x19')]['message']);}})['catch'](function(_0x40d5b6){logger[_0x44ec('0x15')](_0x44ec('0x17'),_0x5be5a2,_0x40d5b6);_0x1b231f(_0x40d5b6);});});}exports[_0x44ec('0x1a')]=function(_0x3f8938){var _0x504cd1=this;return new Promise(function(_0x4816fd,_0x54d822){return db[_0x44ec('0x1b')]['update'](_0x3f8938['body'],{'raw':_0x3f8938['options']?_0x3f8938[_0x44ec('0x1c')][_0x44ec('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f8938[_0x44ec('0x1c')]?_0x3f8938['options'][_0x44ec('0x1e')]||null:null,'attributes':_0x3f8938[_0x44ec('0x1c')]?_0x3f8938[_0x44ec('0x1c')][_0x44ec('0x1f')]||null:null,'limit':_0x3f8938[_0x44ec('0x1c')]?_0x3f8938[_0x44ec('0x1c')][_0x44ec('0x20')]||null:null})[_0x44ec('0xf')](function(_0x2c99d3){logger[_0x44ec('0x10')](_0x44ec('0x1a'),_0x3f8938);logger['debug']('UpdateFaxInteraction',_0x3f8938,JSON[_0x44ec('0x14')](_0x2c99d3));_0x4816fd(_0x2c99d3);})[_0x44ec('0x21')](function(_0x46f0d9){logger[_0x44ec('0x15')](_0x44ec('0x1a'),_0x46f0d9[_0x44ec('0x18')],_0x3f8938);_0x54d822(_0x504cd1[_0x44ec('0x15')](0x1f4,_0x46f0d9['message']));});});};exports[_0x44ec('0x22')]=function(_0x137ae5){return new Promise(function(_0x126d3b,_0x24c0d1){return db[_0x44ec('0x1b')]['find']({'where':_0x137ae5[_0x44ec('0x1c')]?_0x137ae5[_0x44ec('0x1c')][_0x44ec('0x1e')]||null:null})[_0x44ec('0xf')](function(_0x15b39f){if(_0x15b39f){return _0x15b39f[_0x44ec('0x23')](_0x137ae5[_0x44ec('0x24')][_0x44ec('0x25')],_['omit'](_0x137ae5[_0x44ec('0x24')],[_0x44ec('0x25'),'id'])||{});}})[_0x44ec('0x26')](function(_0x594c28){logger[_0x44ec('0x10')]('AddTags',_0x137ae5);logger['debug']('AddTags',_0x137ae5,JSON[_0x44ec('0x14')](_0x594c28));_0x126d3b(_0x594c28);})[_0x44ec('0x21')](function(_0x145495){logger[_0x44ec('0x15')](_0x44ec('0x27'),_0x145495[_0x44ec('0x18')],_0x137ae5);_0x24c0d1(_this[_0x44ec('0x15')](0x1f4,_0x145495['message']));});});}; \ No newline at end of file +var _0xcec6=['defaults','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','info','AddTagsToFaxInteraction','find','addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5c45a4,_0x20ba1a){var _0x195a28=function(_0x2ba570){while(--_0x2ba570){_0x5c45a4['push'](_0x5c45a4['shift']());}};_0x195a28(++_0x20ba1a);}(_0xcec6,0x197));var _0x6cec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcec6[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6cec('0x0'));var util=require(_0x6cec('0x1'));var moment=require(_0x6cec('0x2'));var BPromise=require(_0x6cec('0x3'));var rs=require(_0x6cec('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6cec('0x5'));var logger=require(_0x6cec('0x6'))(_0x6cec('0x7'));var config=require(_0x6cec('0x8'));var jayson=require(_0x6cec('0x9'));var client=jayson[_0x6cec('0xa')][_0x6cec('0xb')]({'port':0x232a});config[_0x6cec('0xc')]=_[_0x6cec('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6cec('0xe'))[_0x6cec('0xf')](socket);function respondWithRpcPromise(_0x591930,_0x126ced,_0x185fc2){return new BPromise(function(_0x1d1922,_0x3aed76){return client[_0x6cec('0x10')](_0x591930,_0x185fc2)[_0x6cec('0x11')](function(_0x27bdab){logger['info'](_0x6cec('0x12'),_0x126ced,_0x6cec('0x13'));logger[_0x6cec('0x14')](_0x6cec('0x15'),_0x126ced,'request\x20sent',JSON[_0x6cec('0x16')](_0x27bdab));if(_0x27bdab[_0x6cec('0x17')]){if(_0x27bdab['error'][_0x6cec('0x18')]===0x1f4){logger[_0x6cec('0x17')]('FaxInteraction,\x20%s,\x20%s',_0x126ced,_0x27bdab[_0x6cec('0x17')][_0x6cec('0x19')]);return _0x3aed76(_0x27bdab[_0x6cec('0x17')][_0x6cec('0x19')]);}logger[_0x6cec('0x17')](_0x6cec('0x12'),_0x126ced,_0x27bdab[_0x6cec('0x17')][_0x6cec('0x19')]);return _0x1d1922(_0x27bdab['error'][_0x6cec('0x19')]);}else{logger['info'](_0x6cec('0x12'),_0x126ced,'request\x20sent');_0x1d1922(_0x27bdab[_0x6cec('0x1a')][_0x6cec('0x19')]);}})[_0x6cec('0x1b')](function(_0x99408c){logger[_0x6cec('0x17')](_0x6cec('0x12'),_0x126ced,_0x99408c);_0x3aed76(_0x99408c);});});}exports[_0x6cec('0x1c')]=function(_0x43e694){var _0x1daea4=this;return new Promise(function(_0x403116,_0x3f0c14){return db[_0x6cec('0x1d')][_0x6cec('0x1e')](_0x43e694[_0x6cec('0x1f')],{'raw':_0x43e694['options']?_0x43e694[_0x6cec('0x20')][_0x6cec('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43e694[_0x6cec('0x20')]?_0x43e694[_0x6cec('0x20')][_0x6cec('0x22')]||null:null,'attributes':_0x43e694[_0x6cec('0x20')]?_0x43e694['options'][_0x6cec('0x23')]||null:null,'limit':_0x43e694['options']?_0x43e694[_0x6cec('0x20')]['limit']||null:null})[_0x6cec('0x11')](function(_0xe8d68d){logger[_0x6cec('0x24')](_0x6cec('0x1c'),_0x43e694);logger[_0x6cec('0x14')](_0x6cec('0x1c'),_0x43e694,JSON['stringify'](_0xe8d68d));_0x403116(_0xe8d68d);})['catch'](function(_0x170d1d){logger[_0x6cec('0x17')](_0x6cec('0x1c'),_0x170d1d['message'],_0x43e694);_0x3f0c14(_0x1daea4[_0x6cec('0x17')](0x1f4,_0x170d1d[_0x6cec('0x19')]));});});};exports[_0x6cec('0x25')]=function(_0x5b83a8){return new Promise(function(_0x37af27,_0x443b27){return db['FaxInteraction'][_0x6cec('0x26')]({'where':_0x5b83a8[_0x6cec('0x20')]?_0x5b83a8[_0x6cec('0x20')][_0x6cec('0x22')]||null:null})[_0x6cec('0x11')](function(_0x18c5e7){if(_0x18c5e7){return _0x18c5e7[_0x6cec('0x27')](_0x5b83a8[_0x6cec('0x1f')][_0x6cec('0x28')],_['omit'](_0x5b83a8[_0x6cec('0x1f')],[_0x6cec('0x28'),'id'])||{});}})['spread'](function(_0x419baa){logger[_0x6cec('0x24')]('AddTags',_0x5b83a8);logger[_0x6cec('0x14')](_0x6cec('0x29'),_0x5b83a8,JSON[_0x6cec('0x16')](_0x419baa));_0x37af27(_0x419baa);})[_0x6cec('0x1b')](function(_0x1067e9){logger[_0x6cec('0x17')]('AddTags',_0x1067e9['message'],_0x5b83a8);_0x443b27(_this[_0x6cec('0x17')](0x1f4,_0x1067e9[_0x6cec('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 9ed57b4..2e7591d 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 _0x2220=['remove','update','emit','removeListener','register','length','save'];(function(_0x195e4a,_0x2e769a){var _0x650a3a=function(_0x24197e){while(--_0x24197e){_0x195e4a['push'](_0x195e4a['shift']());}};_0x650a3a(++_0x2e769a);}(_0x2220,0xa0));var _0x0222=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x2220[_0x4b2863];return _0x567d67;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x0222('0x0'),_0x0222('0x1'),_0x0222('0x2')];function createListener(_0x3b91d6,_0x4f131c){return function(_0x2fecd0){_0x4f131c[_0x0222('0x3')](_0x3b91d6,_0x2fecd0);};}function removeListener(_0x2a4bdc,_0x34192d){return function(){FaxInteractionEvents[_0x0222('0x4')](_0x2a4bdc,_0x34192d);};}exports[_0x0222('0x5')]=function(_0x51e694){for(var _0x3b3e45=0x0,_0x46d8c8=events[_0x0222('0x6')];_0x3b3e45<_0x46d8c8;_0x3b3e45++){var _0x45faa9=events[_0x3b3e45];var _0x5187f8=createListener('faxInteraction:'+_0x45faa9,_0x51e694);FaxInteractionEvents['on'](_0x45faa9,_0x5187f8);}}; \ No newline at end of file +var _0xd667=['update','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x266ebe,_0x397c3d){var _0x254caa=function(_0x2f4246){while(--_0x2f4246){_0x266ebe['push'](_0x266ebe['shift']());}};_0x254caa(++_0x397c3d);}(_0xd667,0x12b));var _0x7d66=function(_0x3e90b8,_0x25fcf0){_0x3e90b8=_0x3e90b8-0x0;var _0x41142c=_0xd667[_0x3e90b8];return _0x41142c;};'use strict';var FaxInteractionEvents=require(_0x7d66('0x0'));var events=['save','remove',_0x7d66('0x1')];function createListener(_0x2e4572,_0x5a7dce){return function(_0x89ffc4){_0x5a7dce['emit'](_0x2e4572,_0x89ffc4);};}function removeListener(_0x59947b,_0x4f52e0){return function(){FaxInteractionEvents['removeListener'](_0x59947b,_0x4f52e0);};}exports[_0x7d66('0x2')]=function(_0x1a21d6){for(var _0x3096c6=0x0,_0x2991eb=events[_0x7d66('0x3')];_0x3096c6<_0x2991eb;_0x3096c6++){var _0x50ab3c=events[_0x3096c6];var _0x334810=createListener(_0x7d66('0x4')+_0x50ab3c,_0x1a21d6);FaxInteractionEvents['on'](_0x50ab3c,_0x334810);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 985fed3..951e801 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 _0x5272=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe','/:id','show','getMessages','download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','faxinteraction:destroy','destroy','removeTags','exports','util','path'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x5272,0xde));var _0x2527=function(_0x19ba9f,_0x52f705){_0x19ba9f=_0x19ba9f-0x0;var _0x3e930d=_0x5272[_0x19ba9f];return _0x3e930d;};'use strict';var multer=require('multer');var util=require(_0x2527('0x0'));var path=require(_0x2527('0x1'));var timeout=require(_0x2527('0x2'));var express=require(_0x2527('0x3'));var router=express[_0x2527('0x4')]();var fs_extra=require(_0x2527('0x5'));var auth=require(_0x2527('0x6'));var interaction=require(_0x2527('0x7'));var config=require(_0x2527('0x8'));var controller=require(_0x2527('0x9'));router[_0x2527('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x2527('0xb')](),controller[_0x2527('0xc')]);router[_0x2527('0xa')](_0x2527('0xd'),auth['isAuthenticated'](),controller[_0x2527('0xe')]);router[_0x2527('0xa')]('/:id/messages',auth['isAuthenticated'](),controller[_0x2527('0xf')]);router[_0x2527('0xa')]('/:id/download',auth[_0x2527('0xb')](),controller[_0x2527('0x10')]);router[_0x2527('0x11')]('/',auth['isAuthenticated'](),controller[_0x2527('0x12')]);router['post']('/:id/messages',auth[_0x2527('0xb')](),controller[_0x2527('0x13')]);router[_0x2527('0x11')](_0x2527('0x14'),auth[_0x2527('0xb')](),interaction[_0x2527('0x15')](_0x2527('0x16'),_0x2527('0x17')),controller[_0x2527('0x18')]);router[_0x2527('0x19')](_0x2527('0xd'),auth[_0x2527('0xb')](),interaction['tracked'](_0x2527('0x16'),_0x2527('0x1a')),controller[_0x2527('0x1b')]);router['delete'](_0x2527('0xd'),auth['isAuthenticated'](),interaction['tracked'](_0x2527('0x16'),_0x2527('0x1c')),controller[_0x2527('0x1d')]);router['delete']('/:id/tags',auth[_0x2527('0xb')](),controller[_0x2527('0x1e')]);module[_0x2527('0x1f')]=router; \ No newline at end of file +var _0x4c6c=['destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','/:id/messages','post','/:id/tags','fax','addTags','put','faxinteraction:update','update','delete','tracked','faxinteraction:destroy'];(function(_0x12da6c,_0x23ee55){var _0x3ef7b3=function(_0xeec4fb){while(--_0xeec4fb){_0x12da6c['push'](_0x12da6c['shift']());}};_0x3ef7b3(++_0x23ee55);}(_0x4c6c,0xb7));var _0xc4c6=function(_0x1f88f0,_0x3f30aa){_0x1f88f0=_0x1f88f0-0x0;var _0x30eb89=_0x4c6c[_0x1f88f0];return _0x30eb89;};'use strict';var multer=require(_0xc4c6('0x0'));var util=require(_0xc4c6('0x1'));var path=require(_0xc4c6('0x2'));var timeout=require(_0xc4c6('0x3'));var express=require(_0xc4c6('0x4'));var router=express[_0xc4c6('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xc4c6('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc4c6('0x7'));var controller=require('./faxInteraction.controller');router[_0xc4c6('0x8')]('/',auth[_0xc4c6('0x9')](),controller['index']);router[_0xc4c6('0x8')]('/describe',auth[_0xc4c6('0x9')](),controller[_0xc4c6('0xa')]);router[_0xc4c6('0x8')](_0xc4c6('0xb'),auth['isAuthenticated'](),controller[_0xc4c6('0xc')]);router['get']('/:id/messages',auth[_0xc4c6('0x9')](),controller[_0xc4c6('0xd')]);router['get'](_0xc4c6('0xe'),auth['isAuthenticated'](),controller[_0xc4c6('0xf')]);router['post']('/',auth[_0xc4c6('0x9')](),controller['create']);router['post'](_0xc4c6('0x10'),auth[_0xc4c6('0x9')](),controller['addMessage']);router[_0xc4c6('0x11')](_0xc4c6('0x12'),auth[_0xc4c6('0x9')](),interaction['tracked'](_0xc4c6('0x13'),'faxinteraction:addtags'),controller[_0xc4c6('0x14')]);router[_0xc4c6('0x15')](_0xc4c6('0xb'),auth[_0xc4c6('0x9')](),interaction['tracked'](_0xc4c6('0x13'),_0xc4c6('0x16')),controller[_0xc4c6('0x17')]);router[_0xc4c6('0x18')](_0xc4c6('0xb'),auth['isAuthenticated'](),interaction[_0xc4c6('0x19')](_0xc4c6('0x13'),_0xc4c6('0x1a')),controller[_0xc4c6('0x1b')]);router['delete']('/:id/tags',auth[_0xc4c6('0x9')](),controller[_0xc4c6('0x1c')]);module[_0xc4c6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 5c3ebfd..edd90a3 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 _0xe3ee=['out','DATE','TEXT','medium'];(function(_0xbda4c7,_0x4e3cf9){var _0x1660e9=function(_0x12dd26){while(--_0x12dd26){_0xbda4c7['push'](_0xbda4c7['shift']());}};_0x1660e9(++_0x4e3cf9);}(_0xe3ee,0x116));var _0xee3e=function(_0x3c091a,_0x27c569){_0x3c091a=_0x3c091a-0x0;var _0x192387=_0xe3ee[_0x3c091a];return _0x192387;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xee3e('0x0')](_0xee3e('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xee3e('0x2')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0xee3e('0x3')]}}; \ No newline at end of file +var _0xc997=['DATE','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc997,0x1ac));var _0x7c99=function(_0x2d3465,_0x59886e){_0x2d3465=_0x2d3465-0x0;var _0x434d60=_0xc997[_0x2d3465];return _0x434d60;};'use strict';var Sequelize=require('sequelize');module[_0x7c99('0x0')]={'body':{'type':Sequelize[_0x7c99('0x1')](_0x7c99('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7c99('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7c99('0x4')]('in','out'),'defaultValue':_0x7c99('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x7c99('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0x7c99('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 5067c6b..f76cd5f 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 _0xbfda=['files','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','end','status','json','offset','undefined','count','limit','apply','reject','destroy','sendStatus','stack','name','send','index','map','FaxMessage','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','filters','pick','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','rawAttributes','include','options','find','update','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE: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','QueryTypes','contact','User','agent','fullname','email','internal','interface','motionChannel','channel','event','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT','SIP/%s','EventManager','rejectmessage','create','CmContact','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','server'];(function(_0x58a4fe,_0x11d439){var _0x697de2=function(_0xe38c14){while(--_0xe38c14){_0x58a4fe['push'](_0x58a4fe['shift']());}};_0x697de2(++_0x11d439);}(_0xbfda,0x1ab));var _0xabfd=function(_0x397bfb,_0x589665){_0x397bfb=_0x397bfb-0x0;var _0x16c9b9=_0xbfda[_0x397bfb];return _0x16c9b9;};'use strict';var emlformat=require(_0xabfd('0x0'));var rimraf=require(_0xabfd('0x1'));var zipdir=require(_0xabfd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabfd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xabfd('0x4'));var util=require(_0xabfd('0x5'));var path=require(_0xabfd('0x6'));var sox=require('sox');var csv=require(_0xabfd('0x7'));var ejs=require(_0xabfd('0x8'));var fs=require('fs');var fs_extra=require(_0xabfd('0x9'));var _=require(_0xabfd('0xa'));var squel=require(_0xabfd('0xb'));var crypto=require('crypto');var jsforce=require(_0xabfd('0xc'));var deskjs=require(_0xabfd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xabfd('0xe'));var Redis=require(_0xabfd('0xf'));var authService=require(_0xabfd('0x10'));var qs=require(_0xabfd('0x11'));var as=require(_0xabfd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xabfd('0x13'));var config=require(_0xabfd('0x14'));var licenseUtil=require(_0xabfd('0x15'));var db=require(_0xabfd('0x16'))['db'];config[_0xabfd('0x17')]=_[_0xabfd('0x18')](config[_0xabfd('0x17')],{'host':_0xabfd('0x19'),'port':0x18eb});var socket=require(_0xabfd('0x1a'))(new Redis(config[_0xabfd('0x17')]));require('./faxMessage.socket')[_0xabfd('0x1b')](socket);var jayson=require(_0xabfd('0x1c'));var client=jayson[_0xabfd('0x1d')][_0xabfd('0x1e')]({'port':0x232c});var client9002=jayson[_0xabfd('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41316e,_0x4add9f,_0x224193,_0x20ba7f){return new BPromise(function(_0x2cf85e,_0x494352){var _0x2081c1=_0x20ba7f||client;return _0x2081c1[_0xabfd('0x1f')](_0x41316e,_0x224193)[_0xabfd('0x20')](function(_0x1ffa37){logger[_0xabfd('0x21')](_0xabfd('0x22'),_0x4add9f,_0xabfd('0x23'));logger[_0xabfd('0x24')](_0xabfd('0x25'),_0x4add9f,_0xabfd('0x23'),JSON[_0xabfd('0x26')](_0x1ffa37));if(_0x1ffa37[_0xabfd('0x27')]){if(_0x1ffa37['error'][_0xabfd('0x28')]===0x1f4){logger[_0xabfd('0x27')](_0xabfd('0x22'),_0x4add9f,_0x1ffa37['error']['message']);return _0x494352(_0x1ffa37[_0xabfd('0x27')][_0xabfd('0x29')]);}logger[_0xabfd('0x27')]('FaxMessage,\x20%s,\x20%s',_0x4add9f,_0x1ffa37[_0xabfd('0x27')][_0xabfd('0x29')]);return _0x2cf85e(_0x1ffa37[_0xabfd('0x27')][_0xabfd('0x29')]);}else{logger[_0xabfd('0x21')](_0xabfd('0x22'),_0x4add9f,_0xabfd('0x23'));_0x2cf85e(_0x1ffa37[_0xabfd('0x2a')][_0xabfd('0x29')]);}})[_0xabfd('0x2b')](function(_0x4fdbaa){logger[_0xabfd('0x27')](_0xabfd('0x22'),_0x4add9f,_0x4fdbaa);_0x494352(_0x4fdbaa);});});}function respondWithStatusCode(_0x1f5571,_0x5e7edf){_0x5e7edf=_0x5e7edf||0xcc;return function(_0x2ae5d1){if(_0x2ae5d1){return _0x1f5571['sendStatus'](_0x5e7edf);}return _0x1f5571['status'](_0x5e7edf)[_0xabfd('0x2c')]();};}function respondWithResult(_0x1339bd,_0x232f97){_0x232f97=_0x232f97||0xc8;return function(_0x5da0dd){if(_0x5da0dd){return _0x1339bd[_0xabfd('0x2d')](_0x232f97)[_0xabfd('0x2e')](_0x5da0dd);}};}function respondWithFilteredResult(_0xaf3b46,_0x29fc74){return function(_0x1b3f56){if(_0x1b3f56){var _0x247e54=typeof _0x29fc74[_0xabfd('0x2f')]===_0xabfd('0x30')&&typeof _0x29fc74['limit']==='undefined';var _0x18995c=_0x1b3f56[_0xabfd('0x31')];var _0x3f2eaa=_0x247e54?0x0:_0x29fc74[_0xabfd('0x2f')];var _0x3f88d4=_0x247e54?_0x1b3f56[_0xabfd('0x31')]:_0x29fc74[_0xabfd('0x2f')]+_0x29fc74[_0xabfd('0x32')];var _0x1c5f3f;if(_0x3f88d4>=_0x18995c){_0x3f88d4=_0x18995c;_0x1c5f3f=0xc8;}else{_0x1c5f3f=0xce;}_0xaf3b46[_0xabfd('0x2d')](_0x1c5f3f);return _0xaf3b46['set']('Content-Range',_0x3f2eaa+'-'+_0x3f88d4+'/'+_0x18995c)[_0xabfd('0x2e')](_0x1b3f56);}return null;};}function patchUpdates(_0x37e9db){return function(_0x1b96e7){try{jsonpatch[_0xabfd('0x33')](_0x1b96e7,_0x37e9db,!![]);}catch(_0x35c784){return BPromise[_0xabfd('0x34')](_0x35c784);}return _0x1b96e7['save']();};}function saveUpdates(_0x1fba6d,_0x2402af){return function(_0x5e1277){if(_0x5e1277){return _0x5e1277['update'](_0x1fba6d)[_0xabfd('0x20')](function(_0x11c7a0){return _0x11c7a0;});}return null;};}function removeEntity(_0x1bef3b,_0x371302){return function(_0x44a127){if(_0x44a127){return _0x44a127[_0xabfd('0x35')]()[_0xabfd('0x20')](function(){_0x1bef3b[_0xabfd('0x2d')](0xcc)[_0xabfd('0x2c')]();});}};}function handleEntityNotFound(_0x43e2cf,_0x16c1d0){return function(_0x229fde){if(!_0x229fde){_0x43e2cf[_0xabfd('0x36')](0x194);}return _0x229fde;};}function handleError(_0x71df86,_0x106475){_0x106475=_0x106475||0x1f4;return function(_0x415aa7){logger[_0xabfd('0x27')](_0x415aa7[_0xabfd('0x37')]);if(_0x415aa7[_0xabfd('0x38')]){delete _0x415aa7[_0xabfd('0x38')];}_0x71df86[_0xabfd('0x2d')](_0x106475)[_0xabfd('0x39')](_0x415aa7);};}exports[_0xabfd('0x3a')]=function(_0x5acc14,_0x51bb2c){var _0x3b3860={},_0x137ce6={},_0x21af5a={'count':0x0,'rows':[]};var _0x26c746=_[_0xabfd('0x3b')](db[_0xabfd('0x3c')]['rawAttributes'],function(_0x36679b){return{'name':_0x36679b[_0xabfd('0x3d')],'type':_0x36679b[_0xabfd('0x3e')][_0xabfd('0x3f')]};});_0x137ce6[_0xabfd('0x40')]=_[_0xabfd('0x3b')](_0x26c746,_0xabfd('0x38'));_0x137ce6[_0xabfd('0x41')]=_[_0xabfd('0x42')](_0x5acc14['query']);_0x137ce6['filters']=_[_0xabfd('0x43')](_0x137ce6[_0xabfd('0x40')],_0x137ce6[_0xabfd('0x41')]);_0x3b3860[_0xabfd('0x44')]=_[_0xabfd('0x43')](_0x137ce6[_0xabfd('0x40')],qs['fields'](_0x5acc14[_0xabfd('0x41')][_0xabfd('0x45')]));_0x3b3860[_0xabfd('0x44')]=_0x3b3860[_0xabfd('0x44')]['length']?_0x3b3860[_0xabfd('0x44')]:_0x137ce6[_0xabfd('0x40')];if(!_0x5acc14[_0xabfd('0x41')][_0xabfd('0x46')](_0xabfd('0x47'))){_0x3b3860[_0xabfd('0x32')]=qs[_0xabfd('0x32')](_0x5acc14[_0xabfd('0x41')][_0xabfd('0x32')]);_0x3b3860[_0xabfd('0x2f')]=qs[_0xabfd('0x2f')](_0x5acc14[_0xabfd('0x41')][_0xabfd('0x2f')]);}_0x3b3860['order']=qs['sort'](_0x5acc14[_0xabfd('0x41')]['sort']);_0x3b3860['where']=qs[_0xabfd('0x48')](_[_0xabfd('0x49')](_0x5acc14[_0xabfd('0x41')],_0x137ce6[_0xabfd('0x48')]),_0x26c746);if(_0x5acc14[_0xabfd('0x41')][_0xabfd('0x4a')]){_0x3b3860[_0xabfd('0x4b')]=_[_0xabfd('0x4c')](_0x3b3860[_0xabfd('0x4b')],{'$or':_['map'](_0x26c746,function(_0x9a071e){if(_0x9a071e[_0xabfd('0x3e')]!==_0xabfd('0x4d')){var _0x2d22c5={};_0x2d22c5[_0x9a071e['name']]={'$like':'%'+_0x5acc14[_0xabfd('0x41')][_0xabfd('0x4a')]+'%'};return _0x2d22c5;}})});}_0x3b3860=_[_0xabfd('0x4c')]({},_0x3b3860,_0x5acc14['options']);var _0x55be66={'where':_0x3b3860['where']};return db[_0xabfd('0x3c')]['count'](_0x55be66)[_0xabfd('0x20')](function(_0x1afee6){_0x21af5a['count']=_0x1afee6;if(_0x5acc14[_0xabfd('0x41')][_0xabfd('0x4e')]){_0x3b3860['include']=[{'all':!![]}];}return db['FaxMessage'][_0xabfd('0x4f')](_0x3b3860);})[_0xabfd('0x20')](function(_0x1a774d){_0x21af5a[_0xabfd('0x50')]=_0x1a774d;return _0x21af5a;})[_0xabfd('0x20')](respondWithFilteredResult(_0x51bb2c,_0x3b3860))[_0xabfd('0x2b')](handleError(_0x51bb2c,null));};exports[_0xabfd('0x51')]=function(_0x26958c,_0xe07366){var _0x34fa94={'raw':!![],'where':{'id':_0x26958c['params']['id']}},_0x3d23e7={};_0x3d23e7[_0xabfd('0x40')]=_[_0xabfd('0x42')](db[_0xabfd('0x3c')][_0xabfd('0x52')]);_0x3d23e7[_0xabfd('0x41')]=_[_0xabfd('0x42')](_0x26958c[_0xabfd('0x41')]);_0x3d23e7[_0xabfd('0x48')]=_[_0xabfd('0x43')](_0x3d23e7['model'],_0x3d23e7[_0xabfd('0x41')]);_0x34fa94[_0xabfd('0x44')]=_[_0xabfd('0x43')](_0x3d23e7[_0xabfd('0x40')],qs['fields'](_0x26958c[_0xabfd('0x41')][_0xabfd('0x45')]));_0x34fa94['attributes']=_0x34fa94[_0xabfd('0x44')]['length']?_0x34fa94['attributes']:_0x3d23e7[_0xabfd('0x40')];if(_0x26958c[_0xabfd('0x41')]['includeAll']){_0x34fa94[_0xabfd('0x53')]=[{'all':!![]}];}_0x34fa94=_[_0xabfd('0x4c')]({},_0x34fa94,_0x26958c[_0xabfd('0x54')]);return db[_0xabfd('0x3c')][_0xabfd('0x55')](_0x34fa94)['then'](handleEntityNotFound(_0xe07366,null))[_0xabfd('0x20')](respondWithResult(_0xe07366,null))[_0xabfd('0x2b')](handleError(_0xe07366,null));};exports[_0xabfd('0x56')]=function(_0x52e84b,_0x1ff536){if(_0x52e84b[_0xabfd('0x57')]['id']){delete _0x52e84b[_0xabfd('0x57')]['id'];}return db['FaxMessage'][_0xabfd('0x55')]({'where':{'id':_0x52e84b['params']['id']}})[_0xabfd('0x20')](handleEntityNotFound(_0x1ff536,null))[_0xabfd('0x20')](saveUpdates(_0x52e84b['body'],null))[_0xabfd('0x20')](respondWithResult(_0x1ff536,null))['catch'](handleError(_0x1ff536,null));};exports[_0xabfd('0x35')]=function(_0x5e7ea5,_0x24f011){return db['FaxMessage']['find']({'where':{'id':_0x5e7ea5[_0xabfd('0x58')]['id']}})['then'](handleEntityNotFound(_0x24f011,null))[_0xabfd('0x20')](removeEntity(_0x24f011,null))['catch'](handleError(_0x24f011,null));};exports[_0xabfd('0x59')]=function(_0x484f60,_0x34489c){return db[_0xabfd('0x3c')][_0xabfd('0x59')]()[_0xabfd('0x20')](respondWithResult(_0x34489c,null))['catch'](handleError(_0x34489c,null));};var interaction_log=require(_0xabfd('0x5a'))(_0xabfd('0x5b'));exports[_0xabfd('0x5c')]=function(_0x518062,_0x402a27,_0xb3c51){var _0x54ffaf={'agent':{},'channel':_0xabfd('0x5d')};if(_0x518062[_0xabfd('0x57')]['id']){delete _0x518062[_0xabfd('0x57')]['id'];}_0x518062['body'][_0xabfd('0x5e')]=!![];_0x518062[_0xabfd('0x57')]['readAt']=moment()[_0xabfd('0x5f')](_0xabfd('0x60'));_0x518062[_0xabfd('0x57')]['UserId']=_0x518062[_0xabfd('0x57')][_0xabfd('0x61')]||_0x518062[_0xabfd('0x62')]['id'];_0x54ffaf['agent']['id']=_0x518062[_0xabfd('0x57')]['UserId'];return db[_0xabfd('0x3c')][_0xabfd('0x55')]({'where':{'id':_0x518062['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x402a27,null))[_0xabfd('0x20')](saveUpdates(_0x518062['body'],null))[_0xabfd('0x20')](function(_0x5c84a0){if(_0x5c84a0){_0x54ffaf['message']=_0x5c84a0[_0xabfd('0x63')]({'plain':!![]});return db[_0xabfd('0x64')]['find']({'where':{'id':_0x5c84a0[_0xabfd('0x65')]}});}return null;})[_0xabfd('0x20')](handleEntityNotFound(_0x402a27,null))[_0xabfd('0x20')](function(_0x2fe850){if(_0x2fe850){return _0x2fe850[_0xabfd('0x56')]({'UserId':_0x518062['body']['UserId'],'read1stAt':_['isNil'](_0x2fe850['read1stAt'])?moment()['format'](_0xabfd('0x60')):undefined});}return null;})['then'](function(_0x549c50){if(_0x549c50){_0x54ffaf[_0xabfd('0x66')]=_0x549c50[_0xabfd('0x63')]({'plain':!![]});interaction_log[_0xabfd('0x21')](_0xabfd('0x67'),_0x518062[_0xabfd('0x62')]['id'],_0x518062[_0xabfd('0x62')]['name'],_0x518062['user']['role'],_0x54ffaf[_0xabfd('0x66')]['id'],_0x518062['body']?JSON[_0xabfd('0x26')](_0x518062['body']):_0xabfd('0x68'));return respondWithRpcPromise(_0xabfd('0x69'),_0xabfd('0x6a'),_0x54ffaf);}return null;})[_0xabfd('0x20')](function(_0x2d081c){var _0x4e9353=_0xabfd('0x6b')+_0x2d081c[_0xabfd('0x29')][_0xabfd('0x6c')];return db[_0xabfd('0x6d')]['query'](_0x4e9353,{'type':db['Sequelize'][_0xabfd('0x6e')]['SELECT'],'raw':!![]})[_0xabfd('0x20')](function(_0x4d4b5a){return _0x4d4b5a;});})[_0xabfd('0x20')](function(_0x35398f){if(_0x35398f){_0x54ffaf[_0xabfd('0x29')][_0xabfd('0x6f')]=_0x35398f[0x0];if(!_0x518062[_0xabfd('0x57')][_0xabfd('0x61')])return;return db[_0xabfd('0x70')][_0xabfd('0x55')]({'where':{'id':_0x518062[_0xabfd('0x57')][_0xabfd('0x61')],'role':_0xabfd('0x71')},'attributes':['id','name',_0xabfd('0x72'),_0xabfd('0x73'),_0xabfd('0x74')],'raw':!![]});}return null;})[_0xabfd('0x20')](function(_0x1273b2){if(!_0x1273b2)return null;_0x54ffaf['message'][_0xabfd('0x71')]=_0x1273b2;return _0x54ffaf;})[_0xabfd('0x20')](function(_0x14bb4d){if(_0x14bb4d){if(_0x518062[_0xabfd('0x57')]['manual']){_0x54ffaf['message'][_0xabfd('0x75')]=util['format']('SIP/%s',_0x518062[_0xabfd('0x62')][_0xabfd('0x38')]);_0x54ffaf[_0xabfd('0x29')]['channel']=_0x54ffaf['channel'];_0x54ffaf[_0xabfd('0x29')][_0xabfd('0x76')]=_0x54ffaf[_0xabfd('0x77')];_0x54ffaf[_0xabfd('0x29')][_0xabfd('0x78')]=_0xabfd('0x5c');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x54ffaf[_0xabfd('0x29')]},client9002)[_0xabfd('0x20')](function(){return _0x54ffaf;});}return _0x54ffaf;}return null;})[_0xabfd('0x20')](respondWithResult(_0x402a27,null))[_0xabfd('0x2b')](handleError(_0x402a27,null));};var interaction_log=require(_0xabfd('0x5a'))(_0xabfd('0x5b'));exports[_0xabfd('0x34')]=function(_0x43e850,_0xac46e5,_0x1b0a58){var _0x6e4410={'agent':{},'channel':_0xabfd('0x5d')};if(_0x43e850[_0xabfd('0x57')]['id']){delete _0x43e850['body']['id'];}_0x43e850[_0xabfd('0x57')]['UserId']=_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')]||_0x43e850[_0xabfd('0x62')]['id'];_0x6e4410[_0xabfd('0x71')]['id']=_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')];return db['FaxMessage'][_0xabfd('0x55')]({'where':{'id':_0x43e850[_0xabfd('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xac46e5,null))[_0xabfd('0x20')](function(_0x5a5d6b){if(_0x5a5d6b){_0x6e4410[_0xabfd('0x29')]=_0x5a5d6b['get']({'plain':!![]});return db[_0xabfd('0x64')][_0xabfd('0x55')]({'where':{'id':_0x5a5d6b[_0xabfd('0x65')]}});}return null;})['then'](handleEntityNotFound(_0xac46e5,null))[_0xabfd('0x20')](function(_0x11d6c9){if(_0x11d6c9){_0x6e4410['interaction']=_0x11d6c9['get']({'plain':!![]});interaction_log['info'](_0xabfd('0x79'),_0x43e850[_0xabfd('0x62')]['id'],_0x43e850[_0xabfd('0x62')][_0xabfd('0x38')],_0x43e850['user']['role'],_0x6e4410['interaction']['id'],_0x43e850[_0xabfd('0x57')]?JSON[_0xabfd('0x26')](_0x43e850[_0xabfd('0x57')]):_0xabfd('0x68'));return respondWithRpcPromise(_0xabfd('0x7a'),_0xabfd('0x7b'),_0x6e4410);}return null;})[_0xabfd('0x20')](function(_0x369612){var _0x7241d7=_0xabfd('0x6b')+_0x369612[_0xabfd('0x29')][_0xabfd('0x6c')];return db[_0xabfd('0x6d')]['query'](_0x7241d7,{'type':db['Sequelize'][_0xabfd('0x6e')][_0xabfd('0x7c')],'raw':!![]})['then'](function(_0x419f98){return _0x419f98;});})[_0xabfd('0x20')](function(_0x13f5f4){if(_0x13f5f4){_0x6e4410[_0xabfd('0x29')][_0xabfd('0x6f')]=_0x13f5f4[0x0];if(!_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')])return;return db[_0xabfd('0x70')][_0xabfd('0x55')]({'where':{'id':_0x43e850[_0xabfd('0x57')][_0xabfd('0x61')],'role':_0xabfd('0x71')},'attributes':['id',_0xabfd('0x38'),_0xabfd('0x72'),_0xabfd('0x73'),_0xabfd('0x74')],'raw':!![]});}return null;})['then'](function(_0x217201){if(!_0x217201)return null;_0x6e4410[_0xabfd('0x29')]['agent']=_0x217201;return _0x6e4410;})[_0xabfd('0x20')](function(_0x52b6bb){if(_0x52b6bb){_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x75')]=util[_0xabfd('0x5f')](_0xabfd('0x7d'),_0x43e850[_0xabfd('0x62')]['name']);_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x77')]=_0x6e4410[_0xabfd('0x77')];_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x76')]=_0x6e4410[_0xabfd('0x77')];_0x52b6bb[_0xabfd('0x29')][_0xabfd('0x78')]='reject';respondWithRpcPromise(_0xabfd('0x7e'),_0xabfd('0x7e'),{'event':_0xabfd('0x7f'),'message':_0x52b6bb['message']},client9002);return _0x6e4410;}return null;})['then'](respondWithResult(_0xac46e5,null))[_0xabfd('0x2b')](handleError(_0xac46e5,null));};exports[_0xabfd('0x80')]=function(_0x472475,_0x2772e3){var _0x49d2bd;return db['FaxMessage']['create'](_0x472475[_0xabfd('0x57')],{})[_0xabfd('0x20')](function(_0x27c843){_0x49d2bd=_0x27c843;return db[_0xabfd('0x81')][_0xabfd('0x82')]({'where':{'id':_0x49d2bd[_0xabfd('0x6c')]}});})[_0xabfd('0x20')](function(_0x27039a){if(_[_0xabfd('0x83')](_0x27039a)){return;}else{_0x49d2bd[_0xabfd('0x5d')]=_0x27039a[_0xabfd('0x5d')];return db[_0xabfd('0x84')][_0xabfd('0x82')]({'where':{'id':_0x49d2bd['AttachmentId']}});}})['then'](function(_0x3c251e){return respondWithRpcPromise(_0xabfd('0x85'),_0xabfd('0x85'),{'FaxAccountId':_[_0xabfd('0x83')](_0x472475['body'])?undefined:_0x472475[_0xabfd('0x57')][_0xabfd('0x86')],'path':_[_0xabfd('0x83')](_0x3c251e)?undefined:util[_0xabfd('0x5f')](_0xabfd('0x87'),_0x3c251e[_0xabfd('0x88')]),'fax':_[_0xabfd('0x83')](_0x49d2bd['fax'])?undefined:_0x49d2bd[_0xabfd('0x5d')],'AttachmentId':_0x49d2bd[_0xabfd('0x89')]},client9002);})['then'](respondWithResult(_0x2772e3,0xc9))['catch'](handleError(_0x2772e3,null));};exports[_0xabfd('0x8a')]=function(_0x523da9,_0x2997b5){var _0x47537b=path[_0xabfd('0x8b')](config['root'],_0xabfd('0x8c'),_0xabfd('0x8d'),'attachments');return db[_0xabfd('0x3c')]['find']({'where':{'id':_0x523da9[_0xabfd('0x58')]['id']},'include':[{'model':db[_0xabfd('0x84')],'as':_0xabfd('0x84')}]})[_0xabfd('0x20')](handleEntityNotFound(_0x2997b5,null))[_0xabfd('0x20')](function(_0x4346fa){if(_0x4346fa){return _0x2997b5['download'](path[_0xabfd('0x8b')](_0x47537b,_0x4346fa[_0xabfd('0x84')][_0xabfd('0x88')]));}})[_0xabfd('0x2b')](handleError(_0x2997b5,null));}; \ No newline at end of file +var _0x8389=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','http','client','then','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','index','FaxMessage','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','body','describe','fax-interactions','accept','fax','read','readAt','format','UserId','user','agent','get','FaxInteraction','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','email','manual','interface','SIP/%s','channel','EventManager','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','internal','motionChannel','event','rejectmessage','create','CmContact','findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','basename','download','root','server','files','attachments','join','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x8389,0x117));var _0x9838=function(_0x593a93,_0x47f34e){_0x593a93=_0x593a93-0x0;var _0x1df6f5=_0x8389[_0x593a93];return _0x1df6f5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9838('0x0'));var zipdir=require(_0x9838('0x1'));var jsonpatch=require(_0x9838('0x2'));var rp=require('request-promise');var moment=require(_0x9838('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9838('0x4'));var util=require(_0x9838('0x5'));var path=require(_0x9838('0x6'));var sox=require('sox');var csv=require(_0x9838('0x7'));var ejs=require(_0x9838('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9838('0x9'));var squel=require(_0x9838('0xa'));var crypto=require(_0x9838('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9838('0xc'));var toCsv=require(_0x9838('0x7'));var querystring=require(_0x9838('0xd'));var Papa=require(_0x9838('0xe'));var Redis=require(_0x9838('0xf'));var authService=require(_0x9838('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x9838('0x11'));var hardwareService=require(_0x9838('0x12'));var logger=require(_0x9838('0x13'))('api');var utils=require(_0x9838('0x14'));var config=require(_0x9838('0x15'));var licenseUtil=require(_0x9838('0x16'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9838('0x17')](config[_0x9838('0x18')],{'host':_0x9838('0x19'),'port':0x18eb});var socket=require(_0x9838('0x1a'))(new Redis(config['redis']));require(_0x9838('0x1b'))[_0x9838('0x1c')](socket);var jayson=require(_0x9838('0x1d'));var client=jayson['client'][_0x9838('0x1e')]({'port':0x232c});var client9002=jayson[_0x9838('0x1f')][_0x9838('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x1f3d1f,_0x53b0a1,_0x5d1296,_0x43478a){return new BPromise(function(_0x290fb8,_0x3e68b3){var _0x6910ff=_0x43478a||client;return _0x6910ff['request'](_0x1f3d1f,_0x5d1296)[_0x9838('0x20')](function(_0x39859c){logger['info'](_0x9838('0x21'),_0x53b0a1,'request\x20sent');logger[_0x9838('0x22')](_0x9838('0x23'),_0x53b0a1,_0x9838('0x24'),JSON[_0x9838('0x25')](_0x39859c));if(_0x39859c[_0x9838('0x26')]){if(_0x39859c[_0x9838('0x26')][_0x9838('0x27')]===0x1f4){logger[_0x9838('0x26')]('FaxMessage,\x20%s,\x20%s',_0x53b0a1,_0x39859c[_0x9838('0x26')][_0x9838('0x28')]);return _0x3e68b3(_0x39859c[_0x9838('0x26')][_0x9838('0x28')]);}logger[_0x9838('0x26')]('FaxMessage,\x20%s,\x20%s',_0x53b0a1,_0x39859c[_0x9838('0x26')][_0x9838('0x28')]);return _0x290fb8(_0x39859c[_0x9838('0x26')][_0x9838('0x28')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x53b0a1,'request\x20sent');_0x290fb8(_0x39859c[_0x9838('0x29')]['message']);}})[_0x9838('0x2a')](function(_0x17df2b){logger[_0x9838('0x26')](_0x9838('0x21'),_0x53b0a1,_0x17df2b);_0x3e68b3(_0x17df2b);});});}function respondWithStatusCode(_0x4964cb,_0xf47196){_0xf47196=_0xf47196||0xcc;return function(_0x51db91){if(_0x51db91){return _0x4964cb[_0x9838('0x2b')](_0xf47196);}return _0x4964cb[_0x9838('0x2c')](_0xf47196)[_0x9838('0x2d')]();};}function respondWithResult(_0x56d196,_0x11ff63){_0x11ff63=_0x11ff63||0xc8;return function(_0x3001b8){if(_0x3001b8){return _0x56d196[_0x9838('0x2c')](_0x11ff63)['json'](_0x3001b8);}};}function respondWithFilteredResult(_0x1bacdb,_0x331550){return function(_0x3c4cdc){if(_0x3c4cdc){var _0x1343fe=typeof _0x331550['offset']===_0x9838('0x2e')&&typeof _0x331550[_0x9838('0x2f')]==='undefined';var _0x293d88=_0x3c4cdc['count'];var _0x4975c2=_0x1343fe?0x0:_0x331550[_0x9838('0x30')];var _0x4282a7=_0x1343fe?_0x3c4cdc['count']:_0x331550[_0x9838('0x30')]+_0x331550[_0x9838('0x2f')];var _0x59f8c4;if(_0x4282a7>=_0x293d88){_0x4282a7=_0x293d88;_0x59f8c4=0xc8;}else{_0x59f8c4=0xce;}_0x1bacdb['status'](_0x59f8c4);return _0x1bacdb[_0x9838('0x31')](_0x9838('0x32'),_0x4975c2+'-'+_0x4282a7+'/'+_0x293d88)[_0x9838('0x33')](_0x3c4cdc);}return null;};}function patchUpdates(_0x403339){return function(_0xdcb54f){try{jsonpatch[_0x9838('0x34')](_0xdcb54f,_0x403339,!![]);}catch(_0xc7bbbe){return BPromise[_0x9838('0x35')](_0xc7bbbe);}return _0xdcb54f[_0x9838('0x36')]();};}function saveUpdates(_0x20aca7,_0x2fbc36){return function(_0x1c5617){if(_0x1c5617){return _0x1c5617[_0x9838('0x37')](_0x20aca7)[_0x9838('0x20')](function(_0x5c9da3){return _0x5c9da3;});}return null;};}function removeEntity(_0xe1ba40,_0x7e91f8){return function(_0x1a174c){if(_0x1a174c){return _0x1a174c[_0x9838('0x38')]()[_0x9838('0x20')](function(){_0xe1ba40[_0x9838('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x58e773,_0x491e7f){return function(_0x242e71){if(!_0x242e71){_0x58e773[_0x9838('0x2b')](0x194);}return _0x242e71;};}function handleError(_0x55fd04,_0x4c4b24){_0x4c4b24=_0x4c4b24||0x1f4;return function(_0x4c8c36){logger[_0x9838('0x26')](_0x4c8c36[_0x9838('0x39')]);if(_0x4c8c36['name']){delete _0x4c8c36[_0x9838('0x3a')];}_0x55fd04[_0x9838('0x2c')](_0x4c4b24)[_0x9838('0x3b')](_0x4c8c36);};}exports[_0x9838('0x3c')]=function(_0x1bc61d,_0x2ecb27){var _0x539647={},_0x50ddc4={},_0x190093={'count':0x0,'rows':[]};var _0x26f901=_['map'](db[_0x9838('0x3d')]['rawAttributes'],function(_0x1cc509){return{'name':_0x1cc509[_0x9838('0x3e')],'type':_0x1cc509['type'][_0x9838('0x3f')]};});_0x50ddc4[_0x9838('0x40')]=_[_0x9838('0x41')](_0x26f901,_0x9838('0x3a'));_0x50ddc4[_0x9838('0x42')]=_['keys'](_0x1bc61d[_0x9838('0x42')]);_0x50ddc4['filters']=_[_0x9838('0x43')](_0x50ddc4[_0x9838('0x40')],_0x50ddc4['query']);_0x539647['attributes']=_[_0x9838('0x43')](_0x50ddc4['model'],qs[_0x9838('0x44')](_0x1bc61d[_0x9838('0x42')][_0x9838('0x44')]));_0x539647[_0x9838('0x45')]=_0x539647['attributes'][_0x9838('0x46')]?_0x539647[_0x9838('0x45')]:_0x50ddc4['model'];if(!_0x1bc61d[_0x9838('0x42')][_0x9838('0x47')](_0x9838('0x48'))){_0x539647['limit']=qs['limit'](_0x1bc61d[_0x9838('0x42')][_0x9838('0x2f')]);_0x539647[_0x9838('0x30')]=qs[_0x9838('0x30')](_0x1bc61d[_0x9838('0x42')][_0x9838('0x30')]);}_0x539647[_0x9838('0x49')]=qs[_0x9838('0x4a')](_0x1bc61d['query']['sort']);_0x539647[_0x9838('0x4b')]=qs[_0x9838('0x4c')](_[_0x9838('0x4d')](_0x1bc61d['query'],_0x50ddc4[_0x9838('0x4c')]),_0x26f901);if(_0x1bc61d[_0x9838('0x42')]['filter']){_0x539647[_0x9838('0x4b')]=_[_0x9838('0x4e')](_0x539647[_0x9838('0x4b')],{'$or':_[_0x9838('0x41')](_0x26f901,function(_0x5722a0){if(_0x5722a0[_0x9838('0x4f')]!==_0x9838('0x50')){var _0x53757c={};_0x53757c[_0x5722a0[_0x9838('0x3a')]]={'$like':'%'+_0x1bc61d[_0x9838('0x42')]['filter']+'%'};return _0x53757c;}})});}_0x539647=_[_0x9838('0x4e')]({},_0x539647,_0x1bc61d[_0x9838('0x51')]);var _0x1140e1={'where':_0x539647['where']};return db['FaxMessage'][_0x9838('0x52')](_0x1140e1)[_0x9838('0x20')](function(_0x168a33){_0x190093[_0x9838('0x52')]=_0x168a33;if(_0x1bc61d[_0x9838('0x42')][_0x9838('0x53')]){_0x539647[_0x9838('0x54')]=[{'all':!![]}];}return db[_0x9838('0x3d')][_0x9838('0x55')](_0x539647);})['then'](function(_0x432f86){_0x190093[_0x9838('0x56')]=_0x432f86;return _0x190093;})[_0x9838('0x20')](respondWithFilteredResult(_0x2ecb27,_0x539647))[_0x9838('0x2a')](handleError(_0x2ecb27,null));};exports[_0x9838('0x57')]=function(_0x4f0262,_0x9745b1){var _0x2886f4={'raw':!![],'where':{'id':_0x4f0262[_0x9838('0x58')]['id']}},_0x3dbc6f={};_0x3dbc6f[_0x9838('0x40')]=_[_0x9838('0x59')](db[_0x9838('0x3d')][_0x9838('0x5a')]);_0x3dbc6f[_0x9838('0x42')]=_[_0x9838('0x59')](_0x4f0262[_0x9838('0x42')]);_0x3dbc6f[_0x9838('0x4c')]=_[_0x9838('0x43')](_0x3dbc6f['model'],_0x3dbc6f[_0x9838('0x42')]);_0x2886f4['attributes']=_[_0x9838('0x43')](_0x3dbc6f[_0x9838('0x40')],qs[_0x9838('0x44')](_0x4f0262[_0x9838('0x42')]['fields']));_0x2886f4[_0x9838('0x45')]=_0x2886f4[_0x9838('0x45')][_0x9838('0x46')]?_0x2886f4['attributes']:_0x3dbc6f[_0x9838('0x40')];if(_0x4f0262[_0x9838('0x42')][_0x9838('0x53')]){_0x2886f4[_0x9838('0x54')]=[{'all':!![]}];}_0x2886f4=_[_0x9838('0x4e')]({},_0x2886f4,_0x4f0262['options']);return db['FaxMessage'][_0x9838('0x5b')](_0x2886f4)[_0x9838('0x20')](handleEntityNotFound(_0x9745b1,null))['then'](respondWithResult(_0x9745b1,null))['catch'](handleError(_0x9745b1,null));};exports[_0x9838('0x37')]=function(_0x343812,_0x471ac9){if(_0x343812[_0x9838('0x5c')]['id']){delete _0x343812[_0x9838('0x5c')]['id'];}return db[_0x9838('0x3d')][_0x9838('0x5b')]({'where':{'id':_0x343812[_0x9838('0x58')]['id']}})[_0x9838('0x20')](handleEntityNotFound(_0x471ac9,null))['then'](saveUpdates(_0x343812['body'],null))[_0x9838('0x20')](respondWithResult(_0x471ac9,null))['catch'](handleError(_0x471ac9,null));};exports['destroy']=function(_0x4c6d60,_0x11f96c){return db[_0x9838('0x3d')]['find']({'where':{'id':_0x4c6d60['params']['id']}})[_0x9838('0x20')](handleEntityNotFound(_0x11f96c,null))[_0x9838('0x20')](removeEntity(_0x11f96c,null))['catch'](handleError(_0x11f96c,null));};exports[_0x9838('0x5d')]=function(_0x52b734,_0x299b38){return db[_0x9838('0x3d')][_0x9838('0x5d')]()[_0x9838('0x20')](respondWithResult(_0x299b38,null))['catch'](handleError(_0x299b38,null));};var interaction_log=require('../../config/logger')(_0x9838('0x5e'));exports[_0x9838('0x5f')]=function(_0x7a3a8,_0x44617c,_0x339602){var _0x187382={'agent':{},'channel':_0x9838('0x60')};if(_0x7a3a8['body']['id']){delete _0x7a3a8[_0x9838('0x5c')]['id'];}_0x7a3a8[_0x9838('0x5c')][_0x9838('0x61')]=!![];_0x7a3a8[_0x9838('0x5c')][_0x9838('0x62')]=moment()[_0x9838('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x7a3a8[_0x9838('0x5c')][_0x9838('0x64')]=_0x7a3a8[_0x9838('0x5c')][_0x9838('0x64')]||_0x7a3a8[_0x9838('0x65')]['id'];_0x187382[_0x9838('0x66')]['id']=_0x7a3a8[_0x9838('0x5c')]['UserId'];return db[_0x9838('0x3d')][_0x9838('0x5b')]({'where':{'id':_0x7a3a8[_0x9838('0x58')]['id'],'UserId':null}})[_0x9838('0x20')](handleEntityNotFound(_0x44617c,null))[_0x9838('0x20')](saveUpdates(_0x7a3a8['body'],null))['then'](function(_0x55ee7c){if(_0x55ee7c){_0x187382[_0x9838('0x28')]=_0x55ee7c[_0x9838('0x67')]({'plain':!![]});return db[_0x9838('0x68')][_0x9838('0x5b')]({'where':{'id':_0x55ee7c['FaxInteractionId']}});}return null;})[_0x9838('0x20')](handleEntityNotFound(_0x44617c,null))[_0x9838('0x20')](function(_0x5357c7){if(_0x5357c7){return _0x5357c7[_0x9838('0x37')]({'UserId':_0x7a3a8[_0x9838('0x5c')]['UserId'],'read1stAt':_['isNil'](_0x5357c7[_0x9838('0x69')])?moment()[_0x9838('0x63')](_0x9838('0x6a')):undefined});}return null;})['then'](function(_0x2dd42e){if(_0x2dd42e){_0x187382[_0x9838('0x6b')]=_0x2dd42e[_0x9838('0x67')]({'plain':!![]});interaction_log['info'](_0x9838('0x6c'),_0x7a3a8[_0x9838('0x65')]['id'],_0x7a3a8[_0x9838('0x65')][_0x9838('0x3a')],_0x7a3a8[_0x9838('0x65')][_0x9838('0x6d')],_0x187382['interaction']['id'],_0x7a3a8[_0x9838('0x5c')]?JSON['stringify'](_0x7a3a8[_0x9838('0x5c')]):_0x9838('0x6e'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x187382);}return null;})[_0x9838('0x20')](function(_0x575a29){var _0x12549f=_0x9838('0x6f')+_0x575a29[_0x9838('0x28')][_0x9838('0x70')];return db['sequelize'][_0x9838('0x42')](_0x12549f,{'type':db[_0x9838('0x71')][_0x9838('0x72')]['SELECT'],'raw':!![]})['then'](function(_0x327b3d){return _0x327b3d;});})[_0x9838('0x20')](function(_0x1b9a9c){if(_0x1b9a9c){_0x187382['message'][_0x9838('0x73')]=_0x1b9a9c[0x0];if(!_0x7a3a8[_0x9838('0x5c')]['UserId'])return;return db[_0x9838('0x74')][_0x9838('0x5b')]({'where':{'id':_0x7a3a8[_0x9838('0x5c')][_0x9838('0x64')],'role':_0x9838('0x66')},'attributes':['id',_0x9838('0x3a'),'fullname',_0x9838('0x75'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2401df){if(!_0x2401df)return null;_0x187382[_0x9838('0x28')]['agent']=_0x2401df;return _0x187382;})['then'](function(_0x1aedae){if(_0x1aedae){if(_0x7a3a8[_0x9838('0x5c')][_0x9838('0x76')]){_0x187382[_0x9838('0x28')][_0x9838('0x77')]=util[_0x9838('0x63')](_0x9838('0x78'),_0x7a3a8['user'][_0x9838('0x3a')]);_0x187382[_0x9838('0x28')][_0x9838('0x79')]=_0x187382[_0x9838('0x79')];_0x187382[_0x9838('0x28')]['motionChannel']=_0x187382[_0x9838('0x79')];_0x187382[_0x9838('0x28')]['event']=_0x9838('0x5f');return respondWithRpcPromise('EventManager',_0x9838('0x7a'),{'event':'acceptmessage','message':_0x187382[_0x9838('0x28')]},client9002)[_0x9838('0x20')](function(){return _0x187382;});}return _0x187382;}return null;})[_0x9838('0x20')](respondWithResult(_0x44617c,null))['catch'](handleError(_0x44617c,null));};var interaction_log=require(_0x9838('0x13'))(_0x9838('0x5e'));exports[_0x9838('0x35')]=function(_0x21f01a,_0x331dd5,_0x2288ae){var _0x56ceba={'agent':{},'channel':'fax'};if(_0x21f01a[_0x9838('0x5c')]['id']){delete _0x21f01a['body']['id'];}_0x21f01a[_0x9838('0x5c')]['UserId']=_0x21f01a[_0x9838('0x5c')]['UserId']||_0x21f01a[_0x9838('0x65')]['id'];_0x56ceba[_0x9838('0x66')]['id']=_0x21f01a['body'][_0x9838('0x64')];return db[_0x9838('0x3d')][_0x9838('0x5b')]({'where':{'id':_0x21f01a[_0x9838('0x58')]['id'],'UserId':null}})[_0x9838('0x20')](handleEntityNotFound(_0x331dd5,null))['then'](function(_0x29826c){if(_0x29826c){_0x56ceba['message']=_0x29826c['get']({'plain':!![]});return db['FaxInteraction'][_0x9838('0x5b')]({'where':{'id':_0x29826c[_0x9838('0x7b')]}});}return null;})['then'](handleEntityNotFound(_0x331dd5,null))[_0x9838('0x20')](function(_0x26e209){if(_0x26e209){_0x56ceba[_0x9838('0x6b')]=_0x26e209[_0x9838('0x67')]({'plain':!![]});interaction_log['info'](_0x9838('0x7c'),_0x21f01a[_0x9838('0x65')]['id'],_0x21f01a[_0x9838('0x65')][_0x9838('0x3a')],_0x21f01a[_0x9838('0x65')][_0x9838('0x6d')],_0x56ceba[_0x9838('0x6b')]['id'],_0x21f01a[_0x9838('0x5c')]?JSON[_0x9838('0x25')](_0x21f01a['body']):_0x9838('0x6e'));return respondWithRpcPromise(_0x9838('0x7d'),_0x9838('0x7e'),_0x56ceba);}return null;})[_0x9838('0x20')](function(_0x352932){var _0x4f239d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x352932[_0x9838('0x28')][_0x9838('0x70')];return db[_0x9838('0x7f')][_0x9838('0x42')](_0x4f239d,{'type':db[_0x9838('0x71')]['QueryTypes']['SELECT'],'raw':!![]})[_0x9838('0x20')](function(_0xc174e5){return _0xc174e5;});})[_0x9838('0x20')](function(_0x157122){if(_0x157122){_0x56ceba[_0x9838('0x28')][_0x9838('0x73')]=_0x157122[0x0];if(!_0x21f01a[_0x9838('0x5c')]['UserId'])return;return db[_0x9838('0x74')]['find']({'where':{'id':_0x21f01a['body'][_0x9838('0x64')],'role':_0x9838('0x66')},'attributes':['id','name','fullname',_0x9838('0x75'),_0x9838('0x80')],'raw':!![]});}return null;})[_0x9838('0x20')](function(_0x27def4){if(!_0x27def4)return null;_0x56ceba[_0x9838('0x28')][_0x9838('0x66')]=_0x27def4;return _0x56ceba;})[_0x9838('0x20')](function(_0xb59d35){if(_0xb59d35){_0xb59d35['message']['interface']=util[_0x9838('0x63')](_0x9838('0x78'),_0x21f01a[_0x9838('0x65')][_0x9838('0x3a')]);_0xb59d35[_0x9838('0x28')][_0x9838('0x79')]=_0x56ceba['channel'];_0xb59d35['message'][_0x9838('0x81')]=_0x56ceba[_0x9838('0x79')];_0xb59d35[_0x9838('0x28')][_0x9838('0x82')]=_0x9838('0x35');respondWithRpcPromise('EventManager',_0x9838('0x7a'),{'event':_0x9838('0x83'),'message':_0xb59d35[_0x9838('0x28')]},client9002);return _0x56ceba;}return null;})[_0x9838('0x20')](respondWithResult(_0x331dd5,null))[_0x9838('0x2a')](handleError(_0x331dd5,null));};exports[_0x9838('0x84')]=function(_0x4e597f,_0x155f8c){var _0x11fb8b;return db['FaxMessage']['create'](_0x4e597f[_0x9838('0x5c')],{})[_0x9838('0x20')](function(_0x3e5746){_0x11fb8b=_0x3e5746;return db[_0x9838('0x85')][_0x9838('0x86')]({'where':{'id':_0x11fb8b[_0x9838('0x70')]}});})[_0x9838('0x20')](function(_0x436bd7){if(_[_0x9838('0x87')](_0x436bd7)){return;}else{_0x11fb8b['fax']=_0x436bd7[_0x9838('0x60')];return db[_0x9838('0x88')]['findOne']({'where':{'id':_0x11fb8b[_0x9838('0x89')]}});}})[_0x9838('0x20')](function(_0x58ed00){return respondWithRpcPromise(_0x9838('0x8a'),_0x9838('0x8a'),{'FaxAccountId':_[_0x9838('0x87')](_0x4e597f[_0x9838('0x5c')])?undefined:_0x4e597f[_0x9838('0x5c')][_0x9838('0x8b')],'path':_[_0x9838('0x87')](_0x58ed00)?undefined:util[_0x9838('0x63')]('/var/opt/motion2/server/files/attachments/%s',_0x58ed00[_0x9838('0x8c')]),'fax':_[_0x9838('0x87')](_0x11fb8b[_0x9838('0x60')])?undefined:_0x11fb8b[_0x9838('0x60')],'AttachmentId':_0x11fb8b[_0x9838('0x89')]},client9002);})['then'](respondWithResult(_0x155f8c,0xc9))[_0x9838('0x2a')](handleError(_0x155f8c,null));};exports[_0x9838('0x8d')]=function(_0x291525,_0x1afcc1){var _0x571ba4=path['join'](config[_0x9838('0x8e')],_0x9838('0x8f'),_0x9838('0x90'),_0x9838('0x91'));return db[_0x9838('0x3d')][_0x9838('0x5b')]({'where':{'id':_0x291525['params']['id']},'include':[{'model':db[_0x9838('0x88')],'as':_0x9838('0x88')}]})[_0x9838('0x20')](handleEntityNotFound(_0x1afcc1,null))[_0x9838('0x20')](function(_0x580b72){if(_0x580b72){return _0x1afcc1['download'](path[_0x9838('0x92')](_0x571ba4,_0x580b72[_0x9838('0x88')][_0x9838('0x8c')]));}})['catch'](handleError(_0x1afcc1,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 05c9e57..95f2223 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 _0x5fdc=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5fdc,0x127));var _0xc5fd=function(_0x3a268e,_0x45ca06){_0x3a268e=_0x3a268e-0x0;var _0x2835c8=_0x5fdc[_0x3a268e];return _0x2835c8;};'use strict';var EventEmitter=require(_0xc5fd('0x0'));var FaxMessage=require(_0xc5fd('0x1'))['db'][_0xc5fd('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xc5fd('0x3')](0x0);var events={'afterCreate':_0xc5fd('0x4'),'afterUpdate':_0xc5fd('0x5'),'afterDestroy':_0xc5fd('0x6')};function emitEvent(_0x4d015c){return function(_0xfdf928,_0x1b6205,_0xca27a0){FaxMessageEvents[_0xc5fd('0x7')](_0x4d015c+':'+_0xfdf928['id'],_0xfdf928);FaxMessageEvents[_0xc5fd('0x7')](_0x4d015c,_0xfdf928);_0xca27a0(null);};}for(var e in events){if(events[_0xc5fd('0x8')](e)){var event=events[e];FaxMessage[_0xc5fd('0x9')](e,emitEvent(event));}}module['exports']=FaxMessageEvents; \ No newline at end of file +var _0x74af=['FaxMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x74af,0x178));var _0xf74a=function(_0x45ccd3,_0x5e61e8){_0x45ccd3=_0x45ccd3-0x0;var _0x433d48=_0x74af[_0x45ccd3];return _0x433d48;};'use strict';var EventEmitter=require(_0xf74a('0x0'));var FaxMessage=require(_0xf74a('0x1'))['db'][_0xf74a('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf74a('0x3')](0x0);var events={'afterCreate':_0xf74a('0x4'),'afterUpdate':_0xf74a('0x5'),'afterDestroy':'remove'};function emitEvent(_0x21fcb){return function(_0x321dc5,_0x349c77,_0x282618){FaxMessageEvents[_0xf74a('0x6')](_0x21fcb+':'+_0x321dc5['id'],_0x321dc5);FaxMessageEvents[_0xf74a('0x6')](_0x21fcb,_0x321dc5);_0x282618(null);};}for(var e in events){if(events[_0xf74a('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0xf74a('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 8736aaf..6ddd1cb 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 _0xeb40=['FaxInteractionId','then','update','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','findOne'];(function(_0x53b5a0,_0x17c9a8){var _0x300f8c=function(_0x69a548){while(--_0x69a548){_0x53b5a0['push'](_0x53b5a0['shift']());}};_0x300f8c(++_0x17c9a8);}(_0xeb40,0x87));var _0x0eb4=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xeb40[_0x2faddb];return _0x273c05;};'use strict';var _=require(_0x0eb4('0x0'));var util=require(_0x0eb4('0x1'));var logger=require(_0x0eb4('0x2'))(_0x0eb4('0x3'));var moment=require(_0x0eb4('0x4'));var BPromise=require(_0x0eb4('0x5'));var rp=require(_0x0eb4('0x6'));var fs=require('fs');var path=require(_0x0eb4('0x7'));var rimraf=require(_0x0eb4('0x8'));var config=require(_0x0eb4('0x9'));var attributes=require(_0x0eb4('0xa'));module[_0x0eb4('0xb')]=function(_0xfe5bd4,_0x4d6eb7){return _0xfe5bd4['define']('FaxMessage',attributes,{'tableName':_0x0eb4('0xc'),'paranoid':![],'indexes':[{'name':_0x0eb4('0xd'),'fields':['body'],'type':_0x0eb4('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x18804d,_0x2b1a84,_0x191ac2){var _0x3ecc5e=_0xfe5bd4['models'];var _0x22982a=_0x18804d[_0x0eb4('0xf')]({'plain':!![]});if(_0x22982a[_0x0eb4('0x10')][_0x0eb4('0x11')]()==='in'||_0x22982a[_0x0eb4('0x10')][_0x0eb4('0x11')]()===_0x0eb4('0x12')&&!_0x22982a['secret']&&!_[_0x0eb4('0x13')](_0x22982a['UserId'])){_0x3ecc5e['FaxInteraction'][_0x0eb4('0x14')]({'where':{'id':_0x22982a[_0x0eb4('0x15')]}})[_0x0eb4('0x16')](function(_0x33c82f){if(_0x33c82f){_0x33c82f[_0x0eb4('0x17')]({'lastMsgAt':_0x22982a['createdAt'],'lastMsgDirection':_0x22982a[_0x0eb4('0x10')]['toLowerCase']()});}})['catch'](function(_0x5b0642){console[_0x0eb4('0x18')](_0x5b0642);});}_0x191ac2();}},'charset':_0x0eb4('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d95=['api','moment','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','toLowerCase','catch','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x570789,_0x442a48){var _0x597e55=function(_0x9b081e){while(--_0x9b081e){_0x570789['push'](_0x570789['shift']());}};_0x597e55(++_0x442a48);}(_0x8d95,0x1b1));var _0x58d9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8d95[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x58d9('0x0'));var logger=require(_0x58d9('0x1'))(_0x58d9('0x2'));var moment=require(_0x58d9('0x3'));var BPromise=require('bluebird');var rp=require(_0x58d9('0x4'));var fs=require('fs');var path=require(_0x58d9('0x5'));var rimraf=require(_0x58d9('0x6'));var config=require(_0x58d9('0x7'));var attributes=require(_0x58d9('0x8'));module['exports']=function(_0x3cf348,_0x52d14b){return _0x3cf348[_0x58d9('0x9')](_0x58d9('0xa'),attributes,{'tableName':_0x58d9('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x58d9('0xc')],'type':_0x58d9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x410ac4,_0x24a74f,_0x561ff0){var _0x106c03=_0x3cf348[_0x58d9('0xe')];var _0x3246c2=_0x410ac4[_0x58d9('0xf')]({'plain':!![]});if(_0x3246c2[_0x58d9('0x10')]['toLowerCase']()==='in'||_0x3246c2[_0x58d9('0x10')]['toLowerCase']()==='out'&&!_0x3246c2[_0x58d9('0x11')]&&!_[_0x58d9('0x12')](_0x3246c2[_0x58d9('0x13')])){_0x106c03[_0x58d9('0x14')][_0x58d9('0x15')]({'where':{'id':_0x3246c2[_0x58d9('0x16')]}})[_0x58d9('0x17')](function(_0x40759f){if(_0x40759f){_0x40759f['update']({'lastMsgAt':_0x3246c2[_0x58d9('0x18')],'lastMsgDirection':_0x3246c2[_0x58d9('0x10')][_0x58d9('0x19')]()});}})[_0x58d9('0x1a')](function(_0x3fa710){console['error'](_0x3fa710);});}_0x561ff0();}},'charset':_0x58d9('0x1b'),'collate':_0x58d9('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 236a5d9..7aacf88 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 _0x0e85=['catch','FaxMessage','create','body','options','raw','info','CreateFaxMessage','UpdateFaxMessage','update','where','attributes','limit','lodash','util','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','request','then','request\x20sent','debug','stringify','error','code','FaxMessage,\x20%s,\x20%s','message','result'];(function(_0x4bb052,_0x1eff82){var _0x818cc=function(_0x2b4430){while(--_0x2b4430){_0x4bb052['push'](_0x4bb052['shift']());}};_0x818cc(++_0x1eff82);}(_0x0e85,0x7c));var _0x50e8=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x0e85[_0x45b034];return _0x509cb0;};'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});config['redis']=_[_0x50e8('0x9')](config[_0x50e8('0xa')],{'host':_0x50e8('0xb'),'port':0x18eb});var socket=require(_0x50e8('0xc'))(new Redis(config[_0x50e8('0xa')]));require(_0x50e8('0xd'))['register'](socket);function respondWithRpcPromise(_0x11717c,_0x228ed1,_0x19d1bc){return new BPromise(function(_0x2d4750,_0x154b9e){return client[_0x50e8('0xe')](_0x11717c,_0x19d1bc)[_0x50e8('0xf')](function(_0x3d25ea){logger['info']('FaxMessage,\x20%s,\x20%s',_0x228ed1,_0x50e8('0x10'));logger[_0x50e8('0x11')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x228ed1,'request\x20sent',JSON[_0x50e8('0x12')](_0x3d25ea));if(_0x3d25ea[_0x50e8('0x13')]){if(_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x14')]===0x1f4){logger['error'](_0x50e8('0x15'),_0x228ed1,_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);return _0x154b9e(_0x3d25ea['error']['message']);}logger[_0x50e8('0x13')](_0x50e8('0x15'),_0x228ed1,_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);return _0x2d4750(_0x3d25ea[_0x50e8('0x13')][_0x50e8('0x16')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x228ed1,_0x50e8('0x10'));_0x2d4750(_0x3d25ea[_0x50e8('0x17')][_0x50e8('0x16')]);}})[_0x50e8('0x18')](function(_0x5dae4e){logger[_0x50e8('0x13')](_0x50e8('0x15'),_0x228ed1,_0x5dae4e);_0x154b9e(_0x5dae4e);});});}exports['CreateFaxMessage']=function(_0x415596){var _0x55997c=this;return new Promise(function(_0x4d2318,_0xe04a5c){return db[_0x50e8('0x19')][_0x50e8('0x1a')](_0x415596[_0x50e8('0x1b')],{'raw':_0x415596['options']?_0x415596[_0x50e8('0x1c')][_0x50e8('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x31d23c){logger[_0x50e8('0x1e')]('CreateFaxMessage',_0x415596);logger[_0x50e8('0x11')](_0x50e8('0x1f'),_0x415596,JSON['stringify'](_0x31d23c));_0x4d2318(_0x31d23c);})['catch'](function(_0x59582d){logger[_0x50e8('0x13')](_0x50e8('0x1f'),_0x59582d[_0x50e8('0x16')],_0x415596);_0xe04a5c(_0x55997c[_0x50e8('0x13')](0x1f4,_0x59582d[_0x50e8('0x16')]));});});};exports[_0x50e8('0x20')]=function(_0x53d848){var _0x3a6442=this;return new Promise(function(_0x396611,_0x4b3a09){return db[_0x50e8('0x19')][_0x50e8('0x21')](_0x53d848[_0x50e8('0x1b')],{'raw':_0x53d848[_0x50e8('0x1c')]?_0x53d848['options'][_0x50e8('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53d848['options']?_0x53d848[_0x50e8('0x1c')][_0x50e8('0x22')]||null:null,'attributes':_0x53d848[_0x50e8('0x1c')]?_0x53d848['options'][_0x50e8('0x23')]||null:null,'limit':_0x53d848[_0x50e8('0x1c')]?_0x53d848[_0x50e8('0x1c')][_0x50e8('0x24')]||null:null})[_0x50e8('0xf')](function(_0x18aa31){logger[_0x50e8('0x1e')]('UpdateFaxMessage',_0x53d848);logger[_0x50e8('0x11')](_0x50e8('0x20'),_0x53d848,JSON['stringify'](_0x18aa31));_0x396611(_0x18aa31);})['catch'](function(_0x329b9c){logger[_0x50e8('0x13')](_0x50e8('0x20'),_0x329b9c['message'],_0x53d848);_0x4b3a09(_0x3a6442['error'](0x1f4,_0x329b9c[_0x50e8('0x16')]));});});}; \ No newline at end of file +var _0xac31=['attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','update','where'];(function(_0x30d6ff,_0xea4f61){var _0x37ec14=function(_0x694996){while(--_0x694996){_0x30d6ff['push'](_0x30d6ff['shift']());}};_0x37ec14(++_0xea4f61);}(_0xac31,0xca));var _0x1ac3=function(_0x27a669,_0x50ad98){_0x27a669=_0x27a669-0x0;var _0x1e5ce4=_0xac31[_0x27a669];return _0x1e5ce4;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});config[_0x1ac3('0xb')]=_[_0x1ac3('0xc')](config[_0x1ac3('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1ac3('0xd'))(new Redis(config['redis']));require(_0x1ac3('0xe'))[_0x1ac3('0xf')](socket);function respondWithRpcPromise(_0x344674,_0x53500b,_0xa26c88){return new BPromise(function(_0x1e2642,_0x3e835b){return client[_0x1ac3('0x10')](_0x344674,_0xa26c88)[_0x1ac3('0x11')](function(_0x422d19){logger['info'](_0x1ac3('0x12'),_0x53500b,_0x1ac3('0x13'));logger[_0x1ac3('0x14')](_0x1ac3('0x15'),_0x53500b,'request\x20sent',JSON[_0x1ac3('0x16')](_0x422d19));if(_0x422d19[_0x1ac3('0x17')]){if(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x18')]===0x1f4){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x422d19[_0x1ac3('0x17')]['message']);return _0x3e835b(_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);}logger[_0x1ac3('0x17')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x422d19[_0x1ac3('0x17')][_0x1ac3('0x19')]);return _0x1e2642(_0x422d19[_0x1ac3('0x17')]['message']);}else{logger[_0x1ac3('0x1a')]('FaxMessage,\x20%s,\x20%s',_0x53500b,_0x1ac3('0x13'));_0x1e2642(_0x422d19[_0x1ac3('0x1b')][_0x1ac3('0x19')]);}})[_0x1ac3('0x1c')](function(_0x18b985){logger['error'](_0x1ac3('0x12'),_0x53500b,_0x18b985);_0x3e835b(_0x18b985);});});}exports[_0x1ac3('0x1d')]=function(_0x296abf){var _0x257f60=this;return new Promise(function(_0x5f1918,_0x48d18a){return db[_0x1ac3('0x1e')][_0x1ac3('0x1f')](_0x296abf[_0x1ac3('0x20')],{'raw':_0x296abf[_0x1ac3('0x21')]?_0x296abf[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![]})[_0x1ac3('0x11')](function(_0x10912a){logger[_0x1ac3('0x1a')]('CreateFaxMessage',_0x296abf);logger[_0x1ac3('0x14')](_0x1ac3('0x1d'),_0x296abf,JSON['stringify'](_0x10912a));_0x5f1918(_0x10912a);})[_0x1ac3('0x1c')](function(_0x10f30c){logger['error'](_0x1ac3('0x1d'),_0x10f30c[_0x1ac3('0x19')],_0x296abf);_0x48d18a(_0x257f60[_0x1ac3('0x17')](0x1f4,_0x10f30c[_0x1ac3('0x19')]));});});};exports[_0x1ac3('0x23')]=function(_0x565a0f){var _0x5a2ab2=this;return new Promise(function(_0x503a64,_0x528807){return db['FaxMessage'][_0x1ac3('0x24')](_0x565a0f['body'],{'raw':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f['options'][_0x1ac3('0x25')]||null:null,'attributes':_0x565a0f['options']?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x26')]||null:null,'limit':_0x565a0f[_0x1ac3('0x21')]?_0x565a0f[_0x1ac3('0x21')][_0x1ac3('0x27')]||null:null})[_0x1ac3('0x11')](function(_0x9c17c2){logger['info'](_0x1ac3('0x23'),_0x565a0f);logger[_0x1ac3('0x14')](_0x1ac3('0x23'),_0x565a0f,JSON[_0x1ac3('0x16')](_0x9c17c2));_0x503a64(_0x9c17c2);})['catch'](function(_0x3591a9){logger[_0x1ac3('0x17')](_0x1ac3('0x23'),_0x3591a9[_0x1ac3('0x19')],_0x565a0f);_0x528807(_0x5a2ab2[_0x1ac3('0x17')](0x1f4,_0x3591a9['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index e8a5bba..e58c8a8 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 _0x8f48=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x362162,_0x189524){var _0x30a7d2=function(_0x374169){while(--_0x374169){_0x362162['push'](_0x362162['shift']());}};_0x30a7d2(++_0x189524);}(_0x8f48,0xd2));var _0x88f4=function(_0x1d5400,_0x567e3c){_0x1d5400=_0x1d5400-0x0;var _0x21d9fe=_0x8f48[_0x1d5400];return _0x21d9fe;};'use strict';var FaxMessageEvents=require(_0x88f4('0x0'));var events=[_0x88f4('0x1'),_0x88f4('0x2'),_0x88f4('0x3')];function createListener(_0x509de6,_0x457306){return function(_0x2ff936){_0x457306[_0x88f4('0x4')](_0x509de6,_0x2ff936);};}function removeListener(_0x38f223,_0x2325b9){return function(){FaxMessageEvents[_0x88f4('0x5')](_0x38f223,_0x2325b9);};}exports[_0x88f4('0x6')]=function(_0x399f37){for(var _0x44fd6e=0x0,_0x2c9d23=events[_0x88f4('0x7')];_0x44fd6e<_0x2c9d23;_0x44fd6e++){var _0x138827=events[_0x44fd6e];var _0x37a915=createListener(_0x88f4('0x8')+_0x138827,_0x399f37);FaxMessageEvents['on'](_0x138827,_0x37a915);}}; \ No newline at end of file +var _0xd3c2=['removeListener','length','faxMessage:','./faxMessage.events','save','update','emit'];(function(_0x1eff80,_0x43b3f2){var _0x590b5c=function(_0x1146ae){while(--_0x1146ae){_0x1eff80['push'](_0x1eff80['shift']());}};_0x590b5c(++_0x43b3f2);}(_0xd3c2,0x1a0));var _0x2d3c=function(_0x3d46a1,_0x41beba){_0x3d46a1=_0x3d46a1-0x0;var _0x3b81a3=_0xd3c2[_0x3d46a1];return _0x3b81a3;};'use strict';var FaxMessageEvents=require(_0x2d3c('0x0'));var events=[_0x2d3c('0x1'),'remove',_0x2d3c('0x2')];function createListener(_0x19598c,_0x2b0c10){return function(_0x19f6b6){_0x2b0c10[_0x2d3c('0x3')](_0x19598c,_0x19f6b6);};}function removeListener(_0x5bbace,_0x3e32c5){return function(){FaxMessageEvents[_0x2d3c('0x4')](_0x5bbace,_0x3e32c5);};}exports['register']=function(_0x370e6a){for(var _0xabc5e6=0x0,_0x3c114b=events[_0x2d3c('0x5')];_0xabc5e6<_0x3c114b;_0xabc5e6++){var _0x4ef4f2=events[_0xabc5e6];var _0x4869c9=createListener(_0x2d3c('0x6')+_0x4ef4f2,_0x370e6a);FaxMessageEvents['on'](_0x4ef4f2,_0x4869c9);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 29cc1a7..97fda36 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 _0x1be1=['create','put','update','/:id/accept','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','describe','/:id','/:id/download','download','post','tracked','faxmessage:create'];(function(_0x506d2f,_0x5ab76e){var _0x101255=function(_0x1596b1){while(--_0x1596b1){_0x506d2f['push'](_0x506d2f['shift']());}};_0x101255(++_0x5ab76e);}(_0x1be1,0x192));var _0x11be=function(_0x5e33da,_0x2bfcc5){_0x5e33da=_0x5e33da-0x0;var _0x2aedb8=_0x1be1[_0x5e33da];return _0x2aedb8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x11be('0x0'));var timeout=require(_0x11be('0x1'));var express=require('express');var router=express[_0x11be('0x2')]();var fs_extra=require(_0x11be('0x3'));var auth=require(_0x11be('0x4'));var interaction=require(_0x11be('0x5'));var config=require('../../config/environment');var controller=require(_0x11be('0x6'));router[_0x11be('0x7')]('/',auth[_0x11be('0x8')](),controller['index']);router[_0x11be('0x7')]('/describe',auth[_0x11be('0x8')](),controller[_0x11be('0x9')]);router[_0x11be('0x7')](_0x11be('0xa'),auth[_0x11be('0x8')](),controller['show']);router[_0x11be('0x7')](_0x11be('0xb'),auth['isAuthenticated'](),controller[_0x11be('0xc')]);router[_0x11be('0xd')]('/',auth[_0x11be('0x8')](),interaction[_0x11be('0xe')]('fax',_0x11be('0xf')),controller[_0x11be('0x10')]);router[_0x11be('0x11')]('/:id',auth[_0x11be('0x8')](),controller[_0x11be('0x12')]);router['put'](_0x11be('0x13'),auth['isAuthenticated'](),controller['accept']);router['put']('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x11be('0xa'),auth['isAuthenticated'](),controller[_0x11be('0x14')]);module[_0x11be('0x15')]=router; \ No newline at end of file +var _0xbdb7=['accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','index','get','describe','show','/:id/download','isAuthenticated','download','post','tracked','put','/:id','update'];(function(_0x31cb10,_0x280746){var _0x249a85=function(_0x2e6fd0){while(--_0x2e6fd0){_0x31cb10['push'](_0x31cb10['shift']());}};_0x249a85(++_0x280746);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x2f023d,_0x29dfe5){_0x2f023d=_0x2f023d-0x0;var _0x4ef240=_0xbdb7[_0x2f023d];return _0x4ef240;};'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')]('/describe',auth['isAuthenticated'](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7bdb('0xd')]);router[_0x7bdb('0xb')](_0x7bdb('0xe'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x10')]);router[_0x7bdb('0x11')]('/',auth[_0x7bdb('0xf')](),interaction[_0x7bdb('0x12')]('fax','faxmessage:create'),controller['create']);router[_0x7bdb('0x13')](_0x7bdb('0x14'),auth['isAuthenticated'](),controller[_0x7bdb('0x15')]);router['put']('/:id/accept',auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x7bdb('0x17')]);router[_0x7bdb('0x18')](_0x7bdb('0x14'),auth[_0x7bdb('0xf')](),controller[_0x7bdb('0x19')]);module[_0x7bdb('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 53fc21c..e93ef1a 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 _0xc06a=['ENUM','rrmemory','sequelize','exports','name','INTEGER'];(function(_0x4cd0bf,_0x54f608){var _0x24af58=function(_0x2f1773){while(--_0x2f1773){_0x4cd0bf['push'](_0x4cd0bf['shift']());}};_0x24af58(++_0x54f608);}(_0xc06a,0x1be));var _0xac06=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc06a[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0xac06('0x0'));module[_0xac06('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xac06('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xac06('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xac06('0x4')](_0xac06('0x5'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xac06('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x06a7=['INTEGER','ENUM','roundrobin','sequelize','exports','STRING'];(function(_0x1a3f77,_0x91b7cd){var _0x230d89=function(_0x2c4837){while(--_0x2c4837){_0x1a3f77['push'](_0x1a3f77['shift']());}};_0x230d89(++_0x91b7cd);}(_0x06a7,0x18f));var _0x706a=function(_0x3d9167,_0x2439d3){_0x3d9167=_0x3d9167-0x0;var _0x3c85be=_0x06a7[_0x3d9167];return _0x3c85be;};'use strict';var Sequelize=require(_0x706a('0x0'));module[_0x706a('0x1')]={'name':{'type':Sequelize[_0x706a('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x706a('0x2')]},'timeout':{'type':Sequelize[_0x706a('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x706a('0x4')]('rrmemory','beepall',_0x706a('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x706a('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index b959ce6..c5d6e0a 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 _0xfdbd=['../../config/environment','redis','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','FaxQueues','stack','name','send','index','map','FaxQueue','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','rawAttributes','keys','filters','intersection','fields','attributes','length','includeAll','merge','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','order','sort','FaxQueueId','filter','User','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','hasOwnProperty','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','sequelize','transaction','findOrCreate','userFaxQueue:save','removeTeams','select','tq.TeamId','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','emit','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x4e09b4,_0x2d97da){var _0x458bd6=function(_0x464438){while(--_0x464438){_0x4e09b4['push'](_0x4e09b4['shift']());}};_0x458bd6(++_0x2d97da);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0xfdbd[_0x5d04ee];return _0x4a666a;};'use strict';var BPromise=require(_0xdfdb('0x0'));var util=require(_0xdfdb('0x1'));var _=require(_0xdfdb('0x2'));var squel=require(_0xdfdb('0x3'));var Redis=require(_0xdfdb('0x4'));var qs=require(_0xdfdb('0x5'));var logger=require(_0xdfdb('0x6'))(_0xdfdb('0x7'));var config=require(_0xdfdb('0x8'));var db=require('../../mysqldb')['db'];config[_0xdfdb('0x9')]=_['defaults'](config[_0xdfdb('0x9')],{'host':_0xdfdb('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xdfdb('0xb')](socket);function respondWithStatusCode(_0xf72a24,_0x47c629){_0x47c629=_0x47c629||0xcc;return function(_0x11d845){if(_0x11d845){return _0xf72a24[_0xdfdb('0xc')](_0x47c629);}return _0xf72a24[_0xdfdb('0xd')](_0x47c629)[_0xdfdb('0xe')]();};}function respondWithResult(_0x3a44a9,_0x1ace28){_0x1ace28=_0x1ace28||0xc8;return function(_0x2bb8d4){if(_0x2bb8d4){return _0x3a44a9['status'](_0x1ace28)[_0xdfdb('0xf')](_0x2bb8d4);}};}function respondWithFilteredResult(_0x1972db,_0x527c05){return function(_0x293714){if(_0x293714){var _0x33a706=typeof _0x527c05[_0xdfdb('0x10')]===_0xdfdb('0x11')&&typeof _0x527c05[_0xdfdb('0x12')]===_0xdfdb('0x11');var _0xf5d903=_0x293714[_0xdfdb('0x13')];var _0x51162f=_0x33a706?0x0:_0x527c05['offset'];var _0x2c44dc=_0x33a706?_0x293714['count']:_0x527c05[_0xdfdb('0x10')]+_0x527c05[_0xdfdb('0x12')];var _0x11a56a;if(_0x2c44dc>=_0xf5d903){_0x2c44dc=_0xf5d903;_0x11a56a=0xc8;}else{_0x11a56a=0xce;}_0x1972db[_0xdfdb('0xd')](_0x11a56a);return _0x1972db[_0xdfdb('0x14')](_0xdfdb('0x15'),_0x51162f+'-'+_0x2c44dc+'/'+_0xf5d903)['json'](_0x293714);}return null;};}function saveUpdates(_0x4fd3d5){return function(_0x2a0295){if(_0x2a0295){return _0x2a0295[_0xdfdb('0x16')](_0x4fd3d5)[_0xdfdb('0x17')](function(_0x55ab5a){return _0x55ab5a;});}return null;};}function removeEntity(_0x3eb100){return function(_0xb677b1){if(_0xb677b1){return _0xb677b1[_0xdfdb('0x18')]()[_0xdfdb('0x17')](function(){var _0x306a33=_0xb677b1[_0xdfdb('0x19')]({'plain':!![]});var _0x693a2c=_0xdfdb('0x1a');return db['UserProfileResource'][_0xdfdb('0x18')]({'where':{'type':_0x693a2c,'resourceId':_0x306a33['id']}})[_0xdfdb('0x17')](function(){return _0xb677b1;});})[_0xdfdb('0x17')](function(){_0x3eb100['status'](0xcc)[_0xdfdb('0xe')]();});}};}function handleEntityNotFound(_0x397f7c){return function(_0x2c7dd1){if(!_0x2c7dd1){_0x397f7c['sendStatus'](0x194);}return _0x2c7dd1;};}function handleError(_0x280e53,_0x789bd2){_0x789bd2=_0x789bd2||0x1f4;return function(_0x334cdd){logger['error'](_0x334cdd[_0xdfdb('0x1b')]);if(_0x334cdd['name']){delete _0x334cdd[_0xdfdb('0x1c')];}_0x280e53[_0xdfdb('0xd')](_0x789bd2)[_0xdfdb('0x1d')](_0x334cdd);};}exports[_0xdfdb('0x1e')]=function(_0x4f69cf,_0x4c253e){var _0x4363d8={};var _0x956843={'count':0x0,'rows':[]};var _0x400663=_[_0xdfdb('0x1f')](db[_0xdfdb('0x20')]['rawAttributes'],function(_0xec4d22){return{'name':_0xec4d22[_0xdfdb('0x21')],'type':_0xec4d22[_0xdfdb('0x22')]['key']};});_0x4363d8=qs[_0xdfdb('0x23')](_0x400663,_0x4f69cf);var _0x5df454={'where':_0x4363d8[_0xdfdb('0x24')]};return db[_0xdfdb('0x20')][_0xdfdb('0x13')](_0x5df454)['then'](function(_0x5bc174){_0x956843[_0xdfdb('0x13')]=_0x5bc174;_0x4363d8[_0xdfdb('0x25')]=qs[_0xdfdb('0x25')](_0x4f69cf[_0xdfdb('0x26')]);return db[_0xdfdb('0x20')][_0xdfdb('0x27')](_0x4363d8);})['then'](function(_0xf396d5){_0x956843[_0xdfdb('0x28')]=_0xf396d5;return _0x956843;})[_0xdfdb('0x17')](respondWithFilteredResult(_0x4c253e,_0x4363d8))[_0xdfdb('0x29')](handleError(_0x4c253e,null));};exports[_0xdfdb('0x2a')]=function(_0x157de8,_0x2dbdf9){var _0x1ce036={'raw':!![],'where':{'id':_0x157de8[_0xdfdb('0x2b')]['id']}},_0x68398d={};_0x68398d[_0xdfdb('0x2c')]=_['keys'](db['FaxQueue'][_0xdfdb('0x2d')]);_0x68398d['query']=_[_0xdfdb('0x2e')](_0x157de8[_0xdfdb('0x26')]);_0x68398d[_0xdfdb('0x2f')]=_[_0xdfdb('0x30')](_0x68398d['model'],_0x68398d[_0xdfdb('0x26')]);_0x1ce036['attributes']=_[_0xdfdb('0x30')](_0x68398d[_0xdfdb('0x2c')],qs[_0xdfdb('0x31')](_0x157de8[_0xdfdb('0x26')][_0xdfdb('0x31')]));_0x1ce036[_0xdfdb('0x32')]=_0x1ce036['attributes'][_0xdfdb('0x33')]?_0x1ce036[_0xdfdb('0x32')]:_0x68398d['model'];if(_0x157de8[_0xdfdb('0x26')][_0xdfdb('0x34')]){_0x1ce036[_0xdfdb('0x25')]=[{'all':!![]}];}_0x1ce036=_[_0xdfdb('0x35')]({},_0x1ce036,_0x157de8[_0xdfdb('0x36')]);return db[_0xdfdb('0x20')][_0xdfdb('0x37')](_0x1ce036)[_0xdfdb('0x17')](handleEntityNotFound(_0x2dbdf9,null))[_0xdfdb('0x17')](respondWithResult(_0x2dbdf9,null))[_0xdfdb('0x29')](handleError(_0x2dbdf9,null));};exports[_0xdfdb('0x38')]=function(_0x5530d8,_0x2defcc){return db[_0xdfdb('0x20')][_0xdfdb('0x38')](_0x5530d8[_0xdfdb('0x39')],{})[_0xdfdb('0x17')](function(_0x3e234e){var _0x3ec73a=_0x5530d8[_0xdfdb('0x3a')]['get']({'plain':!![]});if(!_0x3ec73a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ec73a[_0xdfdb('0x3b')]===_0xdfdb('0x3a')){var _0x16e100=_0x3e234e[_0xdfdb('0x19')]({'plain':!![]});var _0x349739=_0xdfdb('0x1a');return db[_0xdfdb('0x3c')][_0xdfdb('0x37')]({'where':{'name':_0x349739,'userProfileId':_0x3ec73a[_0xdfdb('0x3d')]},'raw':!![]})['then'](function(_0x175f57){if(_0x175f57&&_0x175f57[_0xdfdb('0x3e')]===0x0){return db[_0xdfdb('0x3f')][_0xdfdb('0x38')]({'name':_0x16e100[_0xdfdb('0x1c')],'resourceId':_0x16e100['id'],'type':_0x175f57['name'],'sectionId':_0x175f57['id']},{})[_0xdfdb('0x17')](function(){return _0x3e234e;});}else{return _0x3e234e;}})[_0xdfdb('0x29')](function(_0x3e9f88){logger[_0xdfdb('0x40')](_0xdfdb('0x41'),_0x3e9f88);throw _0x3e9f88;});}return _0x3e234e;})['then'](respondWithResult(_0x2defcc,0xc9))[_0xdfdb('0x29')](handleError(_0x2defcc,null));};exports[_0xdfdb('0x16')]=function(_0xf0482a,_0x5b4381){if(_0xf0482a[_0xdfdb('0x39')]['id']){delete _0xf0482a['body']['id'];}return db[_0xdfdb('0x20')]['find']({'where':{'id':_0xf0482a[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x5b4381,null))['then'](saveUpdates(_0xf0482a[_0xdfdb('0x39')],null))['then'](respondWithResult(_0x5b4381,null))[_0xdfdb('0x29')](handleError(_0x5b4381,null));};exports[_0xdfdb('0x18')]=function(_0x246ce2,_0x2566f8){return db[_0xdfdb('0x20')]['find']({'where':{'id':_0x246ce2['params']['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x2566f8,null))[_0xdfdb('0x17')](removeEntity(_0x2566f8,null))['catch'](handleError(_0x2566f8,null));};exports[_0xdfdb('0x42')]=function(_0x59d0c3,_0xa7be4b){return db[_0xdfdb('0x20')][_0xdfdb('0x42')]()[_0xdfdb('0x17')](respondWithResult(_0xa7be4b,null))[_0xdfdb('0x29')](handleError(_0xa7be4b,null));};exports[_0xdfdb('0x43')]=function(_0x41701c,_0x11ce58){var _0x2ac36e={'raw':!![],'where':{}},_0xd101bf={},_0x24f88a;return db[_0xdfdb('0x20')][_0xdfdb('0x44')]({'where':{'id':_0x41701c[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x11ce58,null))[_0xdfdb('0x17')](function(_0x5ae070){if(_0x5ae070){_0x24f88a=_0x5ae070['get']({'plain':!![]});_0xd101bf[_0xdfdb('0x2c')]=_[_0xdfdb('0x2e')](db[_0xdfdb('0x45')]['rawAttributes']);_0xd101bf[_0xdfdb('0x26')]=_[_0xdfdb('0x2e')](_0x41701c[_0xdfdb('0x26')]);_0xd101bf[_0xdfdb('0x2f')]=_['intersection'](_0xd101bf[_0xdfdb('0x2c')],_0xd101bf[_0xdfdb('0x26')]);_0x2ac36e['attributes']=_[_0xdfdb('0x30')](_0xd101bf[_0xdfdb('0x2c')],qs[_0xdfdb('0x31')](_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x31')]));_0x2ac36e[_0xdfdb('0x32')]=_0x2ac36e[_0xdfdb('0x32')][_0xdfdb('0x33')]?_0x2ac36e[_0xdfdb('0x32')]:_0xd101bf['model'];if(!_0x41701c[_0xdfdb('0x26')]['hasOwnProperty'](_0xdfdb('0x46'))){_0x2ac36e[_0xdfdb('0x12')]=qs[_0xdfdb('0x12')](_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x12')]);_0x2ac36e[_0xdfdb('0x10')]=qs[_0xdfdb('0x10')](_0x41701c['query'][_0xdfdb('0x10')]);}_0x2ac36e[_0xdfdb('0x47')]=qs[_0xdfdb('0x48')](_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x48')]);_0x2ac36e['where']=qs[_0xdfdb('0x2f')](_['pick'](_0x41701c[_0xdfdb('0x26')],_0xd101bf[_0xdfdb('0x2f')]));_0x2ac36e[_0xdfdb('0x24')][_0xdfdb('0x49')]=_0x5ae070['id'];if(_0x41701c[_0xdfdb('0x26')]['filter']){_0x2ac36e[_0xdfdb('0x24')]=_[_0xdfdb('0x35')](_0x2ac36e['where'],{'$or':_[_0xdfdb('0x1f')](_0x2ac36e[_0xdfdb('0x32')],function(_0x1102f4){var _0x47b8b7={};_0x47b8b7[_0x1102f4]={'$like':'%'+_0x41701c[_0xdfdb('0x26')][_0xdfdb('0x4a')]+'%'};return _0x47b8b7;})});}_0x2ac36e=_[_0xdfdb('0x35')]({},_0x2ac36e,_0x41701c[_0xdfdb('0x36')]);return db[_0xdfdb('0x45')][_0xdfdb('0x27')](_0x2ac36e);}})['then'](function(_0x54f778){if(_0x54f778){return db[_0xdfdb('0x4b')]['findAndCountAll']({'where':{'id':_['map'](_0x54f778,'UserId'),'role':_0xdfdb('0x4c')},'attributes':['id',_0xdfdb('0x1c'),_0xdfdb('0x4d'),_0xdfdb('0x4e'),_0xdfdb('0x4f')]});}})[_0xdfdb('0x17')](function(_0xa1d520){if(_0xa1d520){return{'count':_0xa1d520[_0xdfdb('0x13')],'rows':_[_0xdfdb('0x1f')](_0xa1d520['rows'],function(_0x50f938){return{'membername':_0x50f938[_0xdfdb('0x1c')],'UserId':_0x50f938['id'],'queue_name':_0x24f88a['name'],'FaxQueueId':_0x24f88a['id'],'interface':util[_0xdfdb('0x50')](_0xdfdb('0x51'),_0xdfdb('0x52'),_0x50f938['name']),'penalty':0x0,'paused':_0x50f938[_0xdfdb('0x4d')],'createdAt':_0x50f938[_0xdfdb('0x4f')],'updatedAt':_0x50f938[_0xdfdb('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xdfdb('0x17')](respondWithFilteredResult(_0x11ce58,_0x2ac36e))[_0xdfdb('0x29')](handleError(_0x11ce58,null));};exports[_0xdfdb('0x53')]=function(_0x7e6cd1,_0xc4d29c){var _0x54e145={};var _0x934be6={};var _0x22e816;var _0x5279c6;return db[_0xdfdb('0x20')][_0xdfdb('0x44')]({'where':{'id':_0x7e6cd1[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0xc4d29c,null))['then'](function(_0x4a7690){if(_0x4a7690){_0x22e816=_0x4a7690;_0x934be6[_0xdfdb('0x2c')]=_[_0xdfdb('0x2e')](db['Team'][_0xdfdb('0x2d')]);_0x934be6[_0xdfdb('0x26')]=_[_0xdfdb('0x2e')](_0x7e6cd1['query']);_0x934be6['filters']=_[_0xdfdb('0x30')](_0x934be6[_0xdfdb('0x2c')],_0x934be6['query']);_0x54e145['attributes']=_[_0xdfdb('0x30')](_0x934be6['model'],qs['fields'](_0x7e6cd1[_0xdfdb('0x26')]['fields']));_0x54e145[_0xdfdb('0x32')]=_0x54e145[_0xdfdb('0x32')]['length']?_0x54e145['attributes']:_0x934be6[_0xdfdb('0x2c')];_0x54e145[_0xdfdb('0x47')]=qs['sort'](_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x48')]);_0x54e145[_0xdfdb('0x24')]=qs[_0xdfdb('0x2f')](_[_0xdfdb('0x54')](_0x7e6cd1['query'],_0x934be6['filters']));if(_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x4a')]){_0x54e145[_0xdfdb('0x24')]=_[_0xdfdb('0x35')](_0x54e145[_0xdfdb('0x24')],{'$or':_[_0xdfdb('0x1f')](_0x54e145['attributes'],function(_0xd226af){var _0x3c3228={};_0x3c3228[_0xd226af]={'$like':'%'+_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x4a')]+'%'};return _0x3c3228;})});}_0x54e145=_[_0xdfdb('0x35')]({},_0x54e145,_0x7e6cd1[_0xdfdb('0x36')]);return _0x22e816[_0xdfdb('0x53')](_0x54e145);}})[_0xdfdb('0x17')](function(_0x38fa9c){if(_0x38fa9c){_0x5279c6=_0x38fa9c[_0xdfdb('0x33')];if(!_0x7e6cd1['query'][_0xdfdb('0x55')](_0xdfdb('0x46'))){_0x54e145[_0xdfdb('0x12')]=qs[_0xdfdb('0x12')](_0x7e6cd1[_0xdfdb('0x26')]['limit']);_0x54e145[_0xdfdb('0x10')]=qs[_0xdfdb('0x10')](_0x7e6cd1[_0xdfdb('0x26')][_0xdfdb('0x10')]);}return _0x22e816['getTeams'](_0x54e145);}})[_0xdfdb('0x17')](function(_0x47040b){if(_0x47040b){return _0x47040b?{'count':_0x5279c6,'rows':_0x47040b}:null;}})[_0xdfdb('0x17')](respondWithResult(_0xc4d29c,null))[_0xdfdb('0x29')](handleError(_0xc4d29c,null));};exports[_0xdfdb('0x56')]=function(_0x79f282,_0x4149f1){var _0x4497f0=_0x79f282[_0xdfdb('0x39')][_0xdfdb('0x57')];return db[_0xdfdb('0x58')]['findAll']({'where':{'id':_0x4497f0},'attributes':['id'],'include':[{'model':db[_0xdfdb('0x4b')],'as':_0xdfdb('0x59'),'attributes':['id','name',_0xdfdb('0x5a'),_0xdfdb('0x5b'),_0xdfdb('0x5c')],'raw':!![]}]})['then'](function(_0x56140e){if(_0x56140e){var _0x4c4d3a=_[_0xdfdb('0x5d')](_0x56140e,function(_0x465565){var _0x1c7964=_0x465565[_0xdfdb('0x19')]({'plain':!![]});return _0x1c7964[_0xdfdb('0x59')];});return db[_0xdfdb('0x20')][_0xdfdb('0x37')]({'where':{'id':_0x79f282['params']['id']}})[_0xdfdb('0x17')](function(_0xcda070){return db[_0xdfdb('0x5e')][_0xdfdb('0x5f')](function(_0x5b6e35){return _0xcda070[_0xdfdb('0x56')](_0x4497f0,{'transaction':_0x5b6e35})[_0xdfdb('0x17')](function(){return BPromise['each'](_0x4c4d3a,function(_0x2ced3d){return db[_0xdfdb('0x45')][_0xdfdb('0x60')]({'where':{'UserId':_0x2ced3d['id'],'FaxQueueId':_0x79f282[_0xdfdb('0x2b')]['id']},'transaction':_0x5b6e35});});})[_0xdfdb('0x17')](function(){_0x4c4d3a['forEach'](function(_0x3a652e){socket['emit'](_0xdfdb('0x61'),{'UserId':_0x3a652e['id'],'FaxQueueId':_0xcda070['id']});});});});});}})[_0xdfdb('0x17')](respondWithStatusCode(_0x4149f1,null))[_0xdfdb('0x29')](handleError(_0x4149f1,null));};exports[_0xdfdb('0x62')]=function(_0x110097,_0x542ab8){return db[_0xdfdb('0x58')][_0xdfdb('0x27')]({'where':{'id':_0x110097['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xdfdb('0x4b')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x542ab8,null))[_0xdfdb('0x17')](function(_0x36d46e){var _0x17e4d2=_[_0xdfdb('0x1f')](_0x36d46e,'id');var _0x2f03f2=[];var _0x4669c2=[];var _0x317549=squel[_0xdfdb('0x63')]();_0x317549['field'](_0xdfdb('0x64'))['from'](_0xdfdb('0x65'),'tq')[_0xdfdb('0x66')](_0xdfdb('0x67'),'ut',_0xdfdb('0x68'))[_0xdfdb('0x24')]('FaxQueueId\x20=\x20?',_0x110097[_0xdfdb('0x2b')]['id']);for(var _0x64639f=0x0;_0x64639f<_0x36d46e[_0xdfdb('0x33')];_0x64639f+=0x1){let _0x1b6445=_0x36d46e[_0x64639f];for(var _0x36241c=0x0;_0x36241c<_0x1b6445['Agents']['length'];_0x36241c+=0x1){let _0x231f20=_0x1b6445[_0xdfdb('0x59')][_0x36241c];var _0x5dd0b4=_0x317549[_0xdfdb('0x69')]();_0x5dd0b4['where'](_0xdfdb('0x6a'),_0x231f20['id']);_0x4669c2[_0xdfdb('0x6b')](db[_0xdfdb('0x5e')]['query'](_0x5dd0b4[_0xdfdb('0x6c')](),{'type':db['sequelize']['QueryTypes'][_0xdfdb('0x6d')]})['then'](function(_0x30d00e){if(_0x30d00e[_0xdfdb('0x33')]===0x1){return _0x231f20['id'];}else{var _0x162eeb=_[_0xdfdb('0x6e')](_[_0xdfdb('0x1f')](_0x30d00e,_0xdfdb('0x6f')),function(_0x305cf2){return _[_0xdfdb('0x70')](_0x17e4d2,_0x305cf2);});if(_0x162eeb){return _0x231f20['id'];}}}));}}return BPromise[_0xdfdb('0x71')](_0x4669c2)[_0xdfdb('0x17')](function(_0x5ed460){_0x2f03f2=_(_0x2f03f2)['union'](_0x5ed460)[_0xdfdb('0x72')]()['value']();return db['FaxQueue']['find']({'where':{'id':_0x110097['params']['id']}})[_0xdfdb('0x17')](function(_0x2caabb){return db[_0xdfdb('0x5e')][_0xdfdb('0x5f')](function(_0x3bda27){return _0x2caabb[_0xdfdb('0x62')](_0x110097[_0xdfdb('0x26')][_0xdfdb('0x57')],{'transaction':_0x3bda27})[_0xdfdb('0x17')](function(){if(!_[_0xdfdb('0x73')](_0x2f03f2)){return _0x2caabb[_0xdfdb('0x74')](_0x2f03f2,{'transaction':_0x3bda27});}})[_0xdfdb('0x17')](function(){_0x2f03f2[_0xdfdb('0x75')](function(_0x561ced){socket['emit'](_0xdfdb('0x76'),{'UserId':_0x561ced,'FaxQueueId':_0x2caabb['id']});});});});});});})[_0xdfdb('0x17')](respondWithStatusCode(_0x542ab8,null))[_0xdfdb('0x29')](handleError(_0x542ab8,null));};exports[_0xdfdb('0x77')]=function(_0x44d944,_0x18505c){return db[_0xdfdb('0x20')][_0xdfdb('0x37')]({'where':{'id':_0x44d944[_0xdfdb('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18505c,null))[_0xdfdb('0x17')](function(_0x3a2d02){if(_0x3a2d02){return _0x3a2d02[_0xdfdb('0x77')](_0x44d944[_0xdfdb('0x39')][_0xdfdb('0x57')],_[_0xdfdb('0x78')](_0x44d944['body'],[_0xdfdb('0x57'),'id'])||{})[_0xdfdb('0x79')](function(_0x379122){for(var _0x3c09ec=0x0;_0x3c09ec<_0x44d944[_0xdfdb('0x39')][_0xdfdb('0x57')]['length'];_0x3c09ec+=0x1){socket[_0xdfdb('0x7a')](_0xdfdb('0x61'),{'UserId':Number(_0x44d944[_0xdfdb('0x39')]['ids'][_0x3c09ec]),'FaxQueueId':Number(_0x44d944['params']['id'])});}return _0x379122;});}})[_0xdfdb('0x17')](respondWithResult(_0x18505c,null))['catch'](handleError(_0x18505c,null));};exports['removeAgents']=function(_0x276efc,_0x27c72c){return db['FaxQueue']['find']({'where':{'id':_0x276efc[_0xdfdb('0x2b')]['id']}})[_0xdfdb('0x17')](handleEntityNotFound(_0x27c72c,null))[_0xdfdb('0x17')](function(_0x1bc293){if(_0x1bc293){return _0x1bc293[_0xdfdb('0x74')](_0x276efc['query']['ids'])[_0xdfdb('0x17')](function(){if(_['isArray'](_0x276efc[_0xdfdb('0x26')][_0xdfdb('0x57')])){for(var _0x3c9465=0x0;_0x3c9465<_0x276efc['query'][_0xdfdb('0x57')][_0xdfdb('0x33')];_0x3c9465+=0x1){socket[_0xdfdb('0x7a')](_0xdfdb('0x76'),{'UserId':Number(_0x276efc['query'][_0xdfdb('0x57')][_0x3c9465]),'FaxQueueId':Number(_0x276efc[_0xdfdb('0x2b')]['id'])});}}else{socket[_0xdfdb('0x7a')](_0xdfdb('0x76'),{'UserId':Number(_0x276efc['query'][_0xdfdb('0x57')]),'FaxQueueId':Number(_0x276efc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x27c72c,null))['catch'](handleError(_0x27c72c,null));};exports['getAgents']=function(_0x56d3e6,_0x171624){var _0xe8ac6c={};var _0x266246={};var _0x17445a;var _0x3a3f23;return db[_0xdfdb('0x20')][_0xdfdb('0x44')]({'where':{'id':_0x56d3e6[_0xdfdb('0x2b')]['id']}})['then'](handleEntityNotFound(_0x171624,null))[_0xdfdb('0x17')](function(_0x502e43){if(_0x502e43){_0x17445a=_0x502e43;_0x266246[_0xdfdb('0x2c')]=_[_0xdfdb('0x2e')](db['User'][_0xdfdb('0x2d')]);_0x266246[_0xdfdb('0x26')]=_['keys'](_0x56d3e6[_0xdfdb('0x26')]);_0x266246[_0xdfdb('0x2f')]=_[_0xdfdb('0x30')](_0x266246[_0xdfdb('0x2c')],_0x266246['query']);_0xe8ac6c[_0xdfdb('0x32')]=_[_0xdfdb('0x30')](_0x266246[_0xdfdb('0x2c')],qs[_0xdfdb('0x31')](_0x56d3e6[_0xdfdb('0x26')]['fields']));_0xe8ac6c['attributes']=_0xe8ac6c[_0xdfdb('0x32')][_0xdfdb('0x33')]?_0xe8ac6c['attributes']:_0x266246[_0xdfdb('0x2c')];_0xe8ac6c['order']=qs[_0xdfdb('0x48')](_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x48')]);_0xe8ac6c[_0xdfdb('0x24')]=qs[_0xdfdb('0x2f')](_['pick'](_0x56d3e6[_0xdfdb('0x26')],_0x266246[_0xdfdb('0x2f')]));if(_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x4a')]){_0xe8ac6c[_0xdfdb('0x24')]=_[_0xdfdb('0x35')](_0xe8ac6c[_0xdfdb('0x24')],{'$or':_[_0xdfdb('0x1f')](_0xe8ac6c[_0xdfdb('0x32')],function(_0x41e162){var _0x2ee99b={};_0x2ee99b[_0x41e162]={'$like':'%'+_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x4a')]+'%'};return _0x2ee99b;})});}_0xe8ac6c=_['merge']({},_0xe8ac6c,_0x56d3e6[_0xdfdb('0x36')]);return _0x17445a[_0xdfdb('0x7b')](_0xe8ac6c);}})['then'](function(_0x5a2d56){if(_0x5a2d56){_0x3a3f23=_0x5a2d56[_0xdfdb('0x33')];if(!_0x56d3e6[_0xdfdb('0x26')][_0xdfdb('0x55')]('nolimit')){_0xe8ac6c[_0xdfdb('0x12')]=qs[_0xdfdb('0x12')](_0x56d3e6['query'][_0xdfdb('0x12')]);_0xe8ac6c[_0xdfdb('0x10')]=qs[_0xdfdb('0x10')](_0x56d3e6['query'][_0xdfdb('0x10')]);}return _0x17445a[_0xdfdb('0x7b')](_0xe8ac6c);}})[_0xdfdb('0x17')](function(_0x1bd0d0){if(_0x1bd0d0){return _0x1bd0d0?{'count':_0x3a3f23,'rows':_0x1bd0d0}:null;}})[_0xdfdb('0x17')](respondWithResult(_0x171624,null))[_0xdfdb('0x29')](handleError(_0x171624,null));}; \ No newline at end of file +var _0xcf98=['FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userFaxQueue:remove','getAgents','nolimit','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','status','json','offset','count','limit','set','Content-Range','update','then','destroy','get','FaxQueues','stack','send','FaxQueue','rawAttributes','fieldName','type','where','include','findAll','rows','catch','params','model','keys','query','filters','intersection','attributes','fields','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','name','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','order','sort','pick','FaxQueueId','filter','merge','findAndCountAll','agent','updatedAt','createdAt','map','format','SIP','getTeams','addTeams','ids','Team','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userFaxQueue:save','removeTeams','select','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x49d426,_0x14423c){var _0x1e7840=function(_0xe67669){while(--_0xe67669){_0x49d426['push'](_0x49d426['shift']());}};_0x1e7840(++_0x14423c);}(_0xcf98,0x8d));var _0x8cf9=function(_0x26eb9b,_0xad6017){_0x26eb9b=_0x26eb9b-0x0;var _0x3c3dc5=_0xcf98[_0x26eb9b];return _0x3c3dc5;};'use strict';var BPromise=require('bluebird');var util=require(_0x8cf9('0x0'));var _=require(_0x8cf9('0x1'));var squel=require(_0x8cf9('0x2'));var Redis=require(_0x8cf9('0x3'));var qs=require(_0x8cf9('0x4'));var logger=require('../../config/logger')('api');var config=require(_0x8cf9('0x5'));var db=require(_0x8cf9('0x6'))['db'];config[_0x8cf9('0x7')]=_[_0x8cf9('0x8')](config[_0x8cf9('0x7')],{'host':_0x8cf9('0x9'),'port':0x18eb});var socket=require(_0x8cf9('0xa'))(new Redis(config[_0x8cf9('0x7')]));require(_0x8cf9('0xb'))[_0x8cf9('0xc')](socket);function respondWithStatusCode(_0x7d48dc,_0x5947d3){_0x5947d3=_0x5947d3||0xcc;return function(_0x2c9b72){if(_0x2c9b72){return _0x7d48dc[_0x8cf9('0xd')](_0x5947d3);}return _0x7d48dc['status'](_0x5947d3)[_0x8cf9('0xe')]();};}function respondWithResult(_0x5b9daa,_0x23eb35){_0x23eb35=_0x23eb35||0xc8;return function(_0x432742){if(_0x432742){return _0x5b9daa[_0x8cf9('0xf')](_0x23eb35)[_0x8cf9('0x10')](_0x432742);}};}function respondWithFilteredResult(_0x236fbd,_0x42253a){return function(_0x206b9e){if(_0x206b9e){var _0x598c3e=typeof _0x42253a[_0x8cf9('0x11')]==='undefined'&&typeof _0x42253a['limit']==='undefined';var _0x37b112=_0x206b9e['count'];var _0x5c3482=_0x598c3e?0x0:_0x42253a[_0x8cf9('0x11')];var _0x133b59=_0x598c3e?_0x206b9e[_0x8cf9('0x12')]:_0x42253a['offset']+_0x42253a[_0x8cf9('0x13')];var _0x42d10a;if(_0x133b59>=_0x37b112){_0x133b59=_0x37b112;_0x42d10a=0xc8;}else{_0x42d10a=0xce;}_0x236fbd['status'](_0x42d10a);return _0x236fbd[_0x8cf9('0x14')](_0x8cf9('0x15'),_0x5c3482+'-'+_0x133b59+'/'+_0x37b112)[_0x8cf9('0x10')](_0x206b9e);}return null;};}function saveUpdates(_0x46a573){return function(_0xbba7f9){if(_0xbba7f9){return _0xbba7f9[_0x8cf9('0x16')](_0x46a573)[_0x8cf9('0x17')](function(_0x21efd3){return _0x21efd3;});}return null;};}function removeEntity(_0x309866){return function(_0x3a13b7){if(_0x3a13b7){return _0x3a13b7[_0x8cf9('0x18')]()[_0x8cf9('0x17')](function(){var _0x3c4641=_0x3a13b7[_0x8cf9('0x19')]({'plain':!![]});var _0xe0cda=_0x8cf9('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0xe0cda,'resourceId':_0x3c4641['id']}})[_0x8cf9('0x17')](function(){return _0x3a13b7;});})['then'](function(){_0x309866[_0x8cf9('0xf')](0xcc)[_0x8cf9('0xe')]();});}};}function handleEntityNotFound(_0x24df86){return function(_0x275a0e){if(!_0x275a0e){_0x24df86[_0x8cf9('0xd')](0x194);}return _0x275a0e;};}function handleError(_0xe7f8b4,_0x207f32){_0x207f32=_0x207f32||0x1f4;return function(_0x57553f){logger['error'](_0x57553f[_0x8cf9('0x1b')]);if(_0x57553f['name']){delete _0x57553f['name'];}_0xe7f8b4[_0x8cf9('0xf')](_0x207f32)[_0x8cf9('0x1c')](_0x57553f);};}exports['index']=function(_0x284c2d,_0x57aa3a){var _0x4d07fa={};var _0x1f3d2c={'count':0x0,'rows':[]};var _0x122295=_['map'](db[_0x8cf9('0x1d')][_0x8cf9('0x1e')],function(_0x170414){return{'name':_0x170414[_0x8cf9('0x1f')],'type':_0x170414[_0x8cf9('0x20')]['key']};});_0x4d07fa=qs['getOptions'](_0x122295,_0x284c2d);var _0x2aaff0={'where':_0x4d07fa[_0x8cf9('0x21')]};return db[_0x8cf9('0x1d')][_0x8cf9('0x12')](_0x2aaff0)[_0x8cf9('0x17')](function(_0x3b1784){_0x1f3d2c[_0x8cf9('0x12')]=_0x3b1784;_0x4d07fa[_0x8cf9('0x22')]=qs[_0x8cf9('0x22')](_0x284c2d['query']);return db['FaxQueue'][_0x8cf9('0x23')](_0x4d07fa);})['then'](function(_0x2716c8){_0x1f3d2c[_0x8cf9('0x24')]=_0x2716c8;return _0x1f3d2c;})[_0x8cf9('0x17')](respondWithFilteredResult(_0x57aa3a,_0x4d07fa))[_0x8cf9('0x25')](handleError(_0x57aa3a,null));};exports['show']=function(_0x211629,_0x3b313a){var _0x2db180={'raw':!![],'where':{'id':_0x211629[_0x8cf9('0x26')]['id']}},_0xd4f300={};_0xd4f300[_0x8cf9('0x27')]=_[_0x8cf9('0x28')](db['FaxQueue']['rawAttributes']);_0xd4f300[_0x8cf9('0x29')]=_[_0x8cf9('0x28')](_0x211629[_0x8cf9('0x29')]);_0xd4f300[_0x8cf9('0x2a')]=_[_0x8cf9('0x2b')](_0xd4f300[_0x8cf9('0x27')],_0xd4f300['query']);_0x2db180[_0x8cf9('0x2c')]=_[_0x8cf9('0x2b')](_0xd4f300[_0x8cf9('0x27')],qs[_0x8cf9('0x2d')](_0x211629[_0x8cf9('0x29')][_0x8cf9('0x2d')]));_0x2db180[_0x8cf9('0x2c')]=_0x2db180[_0x8cf9('0x2c')]['length']?_0x2db180[_0x8cf9('0x2c')]:_0xd4f300[_0x8cf9('0x27')];if(_0x211629[_0x8cf9('0x29')]['includeAll']){_0x2db180[_0x8cf9('0x22')]=[{'all':!![]}];}_0x2db180=_['merge']({},_0x2db180,_0x211629[_0x8cf9('0x2e')]);return db['FaxQueue'][_0x8cf9('0x2f')](_0x2db180)['then'](handleEntityNotFound(_0x3b313a,null))[_0x8cf9('0x17')](respondWithResult(_0x3b313a,null))['catch'](handleError(_0x3b313a,null));};exports[_0x8cf9('0x30')]=function(_0x5c1fcc,_0x4f318c){return db[_0x8cf9('0x1d')]['create'](_0x5c1fcc[_0x8cf9('0x31')],{})['then'](function(_0x8ecc6){var _0x4f50ff=_0x5c1fcc[_0x8cf9('0x32')][_0x8cf9('0x19')]({'plain':!![]});if(!_0x4f50ff)throw new Error(_0x8cf9('0x33'));if(_0x4f50ff[_0x8cf9('0x34')]===_0x8cf9('0x32')){var _0x19db48=_0x8ecc6[_0x8cf9('0x19')]({'plain':!![]});var _0x1f4c52=_0x8cf9('0x1a');return db[_0x8cf9('0x35')][_0x8cf9('0x2f')]({'where':{'name':_0x1f4c52,'userProfileId':_0x4f50ff[_0x8cf9('0x36')]},'raw':!![]})[_0x8cf9('0x17')](function(_0x21c15f){if(_0x21c15f&&_0x21c15f['autoAssociation']===0x0){return db[_0x8cf9('0x37')][_0x8cf9('0x30')]({'name':_0x19db48[_0x8cf9('0x38')],'resourceId':_0x19db48['id'],'type':_0x21c15f[_0x8cf9('0x38')],'sectionId':_0x21c15f['id']},{})[_0x8cf9('0x17')](function(){return _0x8ecc6;});}else{return _0x8ecc6;}})[_0x8cf9('0x25')](function(_0x2ed713){logger['error'](_0x8cf9('0x39'),_0x2ed713);throw _0x2ed713;});}return _0x8ecc6;})[_0x8cf9('0x17')](respondWithResult(_0x4f318c,0xc9))[_0x8cf9('0x25')](handleError(_0x4f318c,null));};exports[_0x8cf9('0x16')]=function(_0x5785dd,_0x11686e){if(_0x5785dd[_0x8cf9('0x31')]['id']){delete _0x5785dd[_0x8cf9('0x31')]['id'];}return db[_0x8cf9('0x1d')][_0x8cf9('0x2f')]({'where':{'id':_0x5785dd[_0x8cf9('0x26')]['id']}})[_0x8cf9('0x17')](handleEntityNotFound(_0x11686e,null))['then'](saveUpdates(_0x5785dd[_0x8cf9('0x31')],null))[_0x8cf9('0x17')](respondWithResult(_0x11686e,null))[_0x8cf9('0x25')](handleError(_0x11686e,null));};exports[_0x8cf9('0x18')]=function(_0x5707fc,_0x5175ba){return db[_0x8cf9('0x1d')][_0x8cf9('0x2f')]({'where':{'id':_0x5707fc['params']['id']}})[_0x8cf9('0x17')](handleEntityNotFound(_0x5175ba,null))[_0x8cf9('0x17')](removeEntity(_0x5175ba,null))[_0x8cf9('0x25')](handleError(_0x5175ba,null));};exports[_0x8cf9('0x3a')]=function(_0x45cd20,_0x40fd0e){return db['FaxQueue'][_0x8cf9('0x3a')]()[_0x8cf9('0x17')](respondWithResult(_0x40fd0e,null))['catch'](handleError(_0x40fd0e,null));};exports[_0x8cf9('0x3b')]=function(_0x626fd1,_0x3f6d2a){var _0x543172={'raw':!![],'where':{}},_0x42755e={},_0x3a118d;return db['FaxQueue'][_0x8cf9('0x3c')]({'where':{'id':_0x626fd1['params']['id']}})['then'](handleEntityNotFound(_0x3f6d2a,null))[_0x8cf9('0x17')](function(_0x2af1ed){if(_0x2af1ed){_0x3a118d=_0x2af1ed[_0x8cf9('0x19')]({'plain':!![]});_0x42755e[_0x8cf9('0x27')]=_[_0x8cf9('0x28')](db[_0x8cf9('0x3d')][_0x8cf9('0x1e')]);_0x42755e['query']=_[_0x8cf9('0x28')](_0x626fd1[_0x8cf9('0x29')]);_0x42755e[_0x8cf9('0x2a')]=_[_0x8cf9('0x2b')](_0x42755e['model'],_0x42755e[_0x8cf9('0x29')]);_0x543172[_0x8cf9('0x2c')]=_[_0x8cf9('0x2b')](_0x42755e['model'],qs['fields'](_0x626fd1['query'][_0x8cf9('0x2d')]));_0x543172[_0x8cf9('0x2c')]=_0x543172['attributes'][_0x8cf9('0x3e')]?_0x543172[_0x8cf9('0x2c')]:_0x42755e[_0x8cf9('0x27')];if(!_0x626fd1[_0x8cf9('0x29')][_0x8cf9('0x3f')]('nolimit')){_0x543172[_0x8cf9('0x13')]=qs[_0x8cf9('0x13')](_0x626fd1[_0x8cf9('0x29')][_0x8cf9('0x13')]);_0x543172[_0x8cf9('0x11')]=qs[_0x8cf9('0x11')](_0x626fd1[_0x8cf9('0x29')]['offset']);}_0x543172[_0x8cf9('0x40')]=qs[_0x8cf9('0x41')](_0x626fd1[_0x8cf9('0x29')][_0x8cf9('0x41')]);_0x543172[_0x8cf9('0x21')]=qs[_0x8cf9('0x2a')](_[_0x8cf9('0x42')](_0x626fd1[_0x8cf9('0x29')],_0x42755e[_0x8cf9('0x2a')]));_0x543172[_0x8cf9('0x21')][_0x8cf9('0x43')]=_0x2af1ed['id'];if(_0x626fd1[_0x8cf9('0x29')][_0x8cf9('0x44')]){_0x543172['where']=_[_0x8cf9('0x45')](_0x543172[_0x8cf9('0x21')],{'$or':_['map'](_0x543172[_0x8cf9('0x2c')],function(_0x357f08){var _0x367450={};_0x367450[_0x357f08]={'$like':'%'+_0x626fd1[_0x8cf9('0x29')][_0x8cf9('0x44')]+'%'};return _0x367450;})});}_0x543172=_[_0x8cf9('0x45')]({},_0x543172,_0x626fd1[_0x8cf9('0x2e')]);return db[_0x8cf9('0x3d')][_0x8cf9('0x23')](_0x543172);}})[_0x8cf9('0x17')](function(_0x1caf19){if(_0x1caf19){return db['User'][_0x8cf9('0x46')]({'where':{'id':_['map'](_0x1caf19,'UserId'),'role':_0x8cf9('0x47')},'attributes':['id',_0x8cf9('0x38'),'faxPause',_0x8cf9('0x48'),_0x8cf9('0x49')]});}})['then'](function(_0x1c38b0){if(_0x1c38b0){return{'count':_0x1c38b0[_0x8cf9('0x12')],'rows':_[_0x8cf9('0x4a')](_0x1c38b0[_0x8cf9('0x24')],function(_0x3f9245){return{'membername':_0x3f9245[_0x8cf9('0x38')],'UserId':_0x3f9245['id'],'queue_name':_0x3a118d['name'],'FaxQueueId':_0x3a118d['id'],'interface':util[_0x8cf9('0x4b')]('%s/%s',_0x8cf9('0x4c'),_0x3f9245['name']),'penalty':0x0,'paused':_0x3f9245['faxPause'],'createdAt':_0x3f9245[_0x8cf9('0x49')],'updatedAt':_0x3f9245['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x8cf9('0x17')](respondWithFilteredResult(_0x3f6d2a,_0x543172))['catch'](handleError(_0x3f6d2a,null));};exports[_0x8cf9('0x4d')]=function(_0xde1219,_0x507240){var _0x200165={};var _0x41b8c3={};var _0x4a7f75;var _0x5e270b;return db[_0x8cf9('0x1d')][_0x8cf9('0x3c')]({'where':{'id':_0xde1219['params']['id']}})[_0x8cf9('0x17')](handleEntityNotFound(_0x507240,null))[_0x8cf9('0x17')](function(_0x486eb3){if(_0x486eb3){_0x4a7f75=_0x486eb3;_0x41b8c3[_0x8cf9('0x27')]=_[_0x8cf9('0x28')](db['Team']['rawAttributes']);_0x41b8c3[_0x8cf9('0x29')]=_[_0x8cf9('0x28')](_0xde1219[_0x8cf9('0x29')]);_0x41b8c3[_0x8cf9('0x2a')]=_['intersection'](_0x41b8c3[_0x8cf9('0x27')],_0x41b8c3[_0x8cf9('0x29')]);_0x200165[_0x8cf9('0x2c')]=_['intersection'](_0x41b8c3['model'],qs[_0x8cf9('0x2d')](_0xde1219['query'][_0x8cf9('0x2d')]));_0x200165[_0x8cf9('0x2c')]=_0x200165[_0x8cf9('0x2c')][_0x8cf9('0x3e')]?_0x200165['attributes']:_0x41b8c3['model'];_0x200165[_0x8cf9('0x40')]=qs[_0x8cf9('0x41')](_0xde1219['query']['sort']);_0x200165[_0x8cf9('0x21')]=qs[_0x8cf9('0x2a')](_[_0x8cf9('0x42')](_0xde1219[_0x8cf9('0x29')],_0x41b8c3[_0x8cf9('0x2a')]));if(_0xde1219[_0x8cf9('0x29')][_0x8cf9('0x44')]){_0x200165['where']=_['merge'](_0x200165['where'],{'$or':_[_0x8cf9('0x4a')](_0x200165['attributes'],function(_0x4caa94){var _0x4b085e={};_0x4b085e[_0x4caa94]={'$like':'%'+_0xde1219['query'][_0x8cf9('0x44')]+'%'};return _0x4b085e;})});}_0x200165=_[_0x8cf9('0x45')]({},_0x200165,_0xde1219[_0x8cf9('0x2e')]);return _0x4a7f75[_0x8cf9('0x4d')](_0x200165);}})['then'](function(_0x9ba4b){if(_0x9ba4b){_0x5e270b=_0x9ba4b['length'];if(!_0xde1219['query'][_0x8cf9('0x3f')]('nolimit')){_0x200165[_0x8cf9('0x13')]=qs[_0x8cf9('0x13')](_0xde1219[_0x8cf9('0x29')]['limit']);_0x200165[_0x8cf9('0x11')]=qs['offset'](_0xde1219[_0x8cf9('0x29')][_0x8cf9('0x11')]);}return _0x4a7f75[_0x8cf9('0x4d')](_0x200165);}})[_0x8cf9('0x17')](function(_0x13481a){if(_0x13481a){return _0x13481a?{'count':_0x5e270b,'rows':_0x13481a}:null;}})[_0x8cf9('0x17')](respondWithResult(_0x507240,null))[_0x8cf9('0x25')](handleError(_0x507240,null));};exports[_0x8cf9('0x4e')]=function(_0xa14eb5,_0x5ea176){var _0x2dd54e=_0xa14eb5['body'][_0x8cf9('0x4f')];return db[_0x8cf9('0x50')][_0x8cf9('0x23')]({'where':{'id':_0x2dd54e},'attributes':['id'],'include':[{'model':db[_0x8cf9('0x51')],'as':_0x8cf9('0x52'),'attributes':['id',_0x8cf9('0x38'),_0x8cf9('0x53'),_0x8cf9('0x54'),_0x8cf9('0x55')],'raw':!![]}]})[_0x8cf9('0x17')](function(_0x27bffd){if(_0x27bffd){var _0x37d937=_[_0x8cf9('0x56')](_0x27bffd,function(_0x5bff07){var _0x60f410=_0x5bff07[_0x8cf9('0x19')]({'plain':!![]});return _0x60f410[_0x8cf9('0x52')];});return db[_0x8cf9('0x1d')][_0x8cf9('0x2f')]({'where':{'id':_0xa14eb5[_0x8cf9('0x26')]['id']}})[_0x8cf9('0x17')](function(_0x4917cc){return db[_0x8cf9('0x57')][_0x8cf9('0x58')](function(_0x34d45c){return _0x4917cc['addTeams'](_0x2dd54e,{'transaction':_0x34d45c})['then'](function(){return BPromise[_0x8cf9('0x59')](_0x37d937,function(_0x21ac8f){return db[_0x8cf9('0x3d')][_0x8cf9('0x5a')]({'where':{'UserId':_0x21ac8f['id'],'FaxQueueId':_0xa14eb5[_0x8cf9('0x26')]['id']},'transaction':_0x34d45c});});})[_0x8cf9('0x17')](function(){_0x37d937['forEach'](function(_0x526101){socket[_0x8cf9('0x5b')](_0x8cf9('0x5c'),{'UserId':_0x526101['id'],'FaxQueueId':_0x4917cc['id']});});});});});}})[_0x8cf9('0x17')](respondWithStatusCode(_0x5ea176,null))['catch'](handleError(_0x5ea176,null));};exports[_0x8cf9('0x5d')]=function(_0x433f67,_0x6578c9){return db[_0x8cf9('0x50')][_0x8cf9('0x23')]({'where':{'id':_0x433f67[_0x8cf9('0x29')][_0x8cf9('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x8cf9('0x51')],'as':_0x8cf9('0x52'),'attributes':['id'],'raw':!![]}]})[_0x8cf9('0x17')](handleEntityNotFound(_0x6578c9,null))[_0x8cf9('0x17')](function(_0x890bb5){var _0x2329ea=_['map'](_0x890bb5,'id');var _0x234e21=[];var _0x3c238f=[];var _0xa28cda=squel[_0x8cf9('0x5e')]();_0xa28cda['field'](_0x8cf9('0x5f'))[_0x8cf9('0x60')](_0x8cf9('0x61'),'tq')[_0x8cf9('0x62')](_0x8cf9('0x63'),'ut',_0x8cf9('0x64'))[_0x8cf9('0x21')](_0x8cf9('0x65'),_0x433f67[_0x8cf9('0x26')]['id']);for(var _0x2beb38=0x0;_0x2beb38<_0x890bb5[_0x8cf9('0x3e')];_0x2beb38+=0x1){let _0xc9f104=_0x890bb5[_0x2beb38];for(var _0x1a5e2c=0x0;_0x1a5e2c<_0xc9f104[_0x8cf9('0x52')]['length'];_0x1a5e2c+=0x1){let _0x3b8af5=_0xc9f104[_0x8cf9('0x52')][_0x1a5e2c];var _0x37b5e8=_0xa28cda['clone']();_0x37b5e8[_0x8cf9('0x21')](_0x8cf9('0x66'),_0x3b8af5['id']);_0x3c238f[_0x8cf9('0x67')](db['sequelize'][_0x8cf9('0x29')](_0x37b5e8['toString'](),{'type':db[_0x8cf9('0x57')][_0x8cf9('0x68')][_0x8cf9('0x69')]})[_0x8cf9('0x17')](function(_0x5f5b78){if(_0x5f5b78[_0x8cf9('0x3e')]===0x1){return _0x3b8af5['id'];}else{var _0x125c75=_[_0x8cf9('0x6a')](_['map'](_0x5f5b78,_0x8cf9('0x6b')),function(_0x207d3f){return _[_0x8cf9('0x6c')](_0x2329ea,_0x207d3f);});if(_0x125c75){return _0x3b8af5['id'];}}}));}}return BPromise[_0x8cf9('0x6d')](_0x3c238f)['then'](function(_0x24b1c2){_0x234e21=_(_0x234e21)['union'](_0x24b1c2)[_0x8cf9('0x6e')]()[_0x8cf9('0x6f')]();return db[_0x8cf9('0x1d')][_0x8cf9('0x2f')]({'where':{'id':_0x433f67['params']['id']}})[_0x8cf9('0x17')](function(_0x3f3ab1){return db[_0x8cf9('0x57')]['transaction'](function(_0x300388){return _0x3f3ab1[_0x8cf9('0x5d')](_0x433f67[_0x8cf9('0x29')][_0x8cf9('0x4f')],{'transaction':_0x300388})[_0x8cf9('0x17')](function(){if(!_[_0x8cf9('0x70')](_0x234e21)){return _0x3f3ab1[_0x8cf9('0x71')](_0x234e21,{'transaction':_0x300388});}})[_0x8cf9('0x17')](function(){_0x234e21[_0x8cf9('0x72')](function(_0x37212e){socket[_0x8cf9('0x5b')]('userFaxQueue:remove',{'UserId':_0x37212e,'FaxQueueId':_0x3f3ab1['id']});});});});});});})[_0x8cf9('0x17')](respondWithStatusCode(_0x6578c9,null))['catch'](handleError(_0x6578c9,null));};exports['addAgents']=function(_0x3ad6ba,_0x3f3a61){return db['FaxQueue'][_0x8cf9('0x2f')]({'where':{'id':_0x3ad6ba[_0x8cf9('0x26')]['id']}})[_0x8cf9('0x17')](handleEntityNotFound(_0x3f3a61,null))[_0x8cf9('0x17')](function(_0x4fdce2){if(_0x4fdce2){return _0x4fdce2[_0x8cf9('0x73')](_0x3ad6ba[_0x8cf9('0x31')][_0x8cf9('0x4f')],_[_0x8cf9('0x74')](_0x3ad6ba[_0x8cf9('0x31')],[_0x8cf9('0x4f'),'id'])||{})[_0x8cf9('0x75')](function(_0x26257b){for(var _0x4e1efa=0x0;_0x4e1efa<_0x3ad6ba[_0x8cf9('0x31')][_0x8cf9('0x4f')]['length'];_0x4e1efa+=0x1){socket[_0x8cf9('0x5b')](_0x8cf9('0x5c'),{'UserId':Number(_0x3ad6ba[_0x8cf9('0x31')][_0x8cf9('0x4f')][_0x4e1efa]),'FaxQueueId':Number(_0x3ad6ba[_0x8cf9('0x26')]['id'])});}return _0x26257b;});}})[_0x8cf9('0x17')](respondWithResult(_0x3f3a61,null))[_0x8cf9('0x25')](handleError(_0x3f3a61,null));};exports[_0x8cf9('0x71')]=function(_0x8b933f,_0x1dc1b7){return db[_0x8cf9('0x1d')][_0x8cf9('0x2f')]({'where':{'id':_0x8b933f[_0x8cf9('0x26')]['id']}})[_0x8cf9('0x17')](handleEntityNotFound(_0x1dc1b7,null))['then'](function(_0x259c9f){if(_0x259c9f){return _0x259c9f[_0x8cf9('0x71')](_0x8b933f[_0x8cf9('0x29')][_0x8cf9('0x4f')])['then'](function(){if(_['isArray'](_0x8b933f[_0x8cf9('0x29')]['ids'])){for(var _0x279ccb=0x0;_0x279ccb<_0x8b933f[_0x8cf9('0x29')][_0x8cf9('0x4f')][_0x8cf9('0x3e')];_0x279ccb+=0x1){socket[_0x8cf9('0x5b')](_0x8cf9('0x76'),{'UserId':Number(_0x8b933f['query']['ids'][_0x279ccb]),'FaxQueueId':Number(_0x8b933f[_0x8cf9('0x26')]['id'])});}}else{socket['emit'](_0x8cf9('0x76'),{'UserId':Number(_0x8b933f[_0x8cf9('0x29')][_0x8cf9('0x4f')]),'FaxQueueId':Number(_0x8b933f[_0x8cf9('0x26')]['id'])});}});}})['then'](respondWithStatusCode(_0x1dc1b7,null))[_0x8cf9('0x25')](handleError(_0x1dc1b7,null));};exports[_0x8cf9('0x77')]=function(_0x398487,_0x4d9d56){var _0x59a834={};var _0x3aa6fa={};var _0x569b12;var _0x1fd86a;return db[_0x8cf9('0x1d')][_0x8cf9('0x3c')]({'where':{'id':_0x398487['params']['id']}})[_0x8cf9('0x17')](handleEntityNotFound(_0x4d9d56,null))[_0x8cf9('0x17')](function(_0x17244a){if(_0x17244a){_0x569b12=_0x17244a;_0x3aa6fa[_0x8cf9('0x27')]=_[_0x8cf9('0x28')](db[_0x8cf9('0x51')][_0x8cf9('0x1e')]);_0x3aa6fa[_0x8cf9('0x29')]=_['keys'](_0x398487[_0x8cf9('0x29')]);_0x3aa6fa[_0x8cf9('0x2a')]=_[_0x8cf9('0x2b')](_0x3aa6fa['model'],_0x3aa6fa[_0x8cf9('0x29')]);_0x59a834[_0x8cf9('0x2c')]=_[_0x8cf9('0x2b')](_0x3aa6fa[_0x8cf9('0x27')],qs[_0x8cf9('0x2d')](_0x398487[_0x8cf9('0x29')][_0x8cf9('0x2d')]));_0x59a834['attributes']=_0x59a834[_0x8cf9('0x2c')][_0x8cf9('0x3e')]?_0x59a834['attributes']:_0x3aa6fa[_0x8cf9('0x27')];_0x59a834['order']=qs['sort'](_0x398487[_0x8cf9('0x29')][_0x8cf9('0x41')]);_0x59a834['where']=qs['filters'](_[_0x8cf9('0x42')](_0x398487[_0x8cf9('0x29')],_0x3aa6fa['filters']));if(_0x398487[_0x8cf9('0x29')][_0x8cf9('0x44')]){_0x59a834['where']=_[_0x8cf9('0x45')](_0x59a834[_0x8cf9('0x21')],{'$or':_[_0x8cf9('0x4a')](_0x59a834['attributes'],function(_0x113e7a){var _0x573ae7={};_0x573ae7[_0x113e7a]={'$like':'%'+_0x398487[_0x8cf9('0x29')][_0x8cf9('0x44')]+'%'};return _0x573ae7;})});}_0x59a834=_[_0x8cf9('0x45')]({},_0x59a834,_0x398487[_0x8cf9('0x2e')]);return _0x569b12['getAgents'](_0x59a834);}})[_0x8cf9('0x17')](function(_0x2d5220){if(_0x2d5220){_0x1fd86a=_0x2d5220[_0x8cf9('0x3e')];if(!_0x398487[_0x8cf9('0x29')][_0x8cf9('0x3f')](_0x8cf9('0x78'))){_0x59a834[_0x8cf9('0x13')]=qs[_0x8cf9('0x13')](_0x398487[_0x8cf9('0x29')][_0x8cf9('0x13')]);_0x59a834[_0x8cf9('0x11')]=qs['offset'](_0x398487[_0x8cf9('0x29')][_0x8cf9('0x11')]);}return _0x569b12['getAgents'](_0x59a834);}})['then'](function(_0x28cc81){if(_0x28cc81){return _0x28cc81?{'count':_0x1fd86a,'rows':_0x28cc81}:null;}})[_0x8cf9('0x17')](respondWithResult(_0x4d9d56,null))[_0x8cf9('0x25')](handleError(_0x4d9d56,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 4e3a2a3..7d3da66 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 _0xf22c=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners'];(function(_0x123280,_0x19a19f){var _0x387b58=function(_0xdbd693){while(--_0xdbd693){_0x123280['push'](_0x123280['shift']());}};_0x387b58(++_0x19a19f);}(_0xf22c,0x1e5));var _0xcf22=function(_0x48f261,_0x1ca37a){_0x48f261=_0x48f261-0x0;var _0x3fea51=_0xf22c[_0x48f261];return _0x3fea51;};'use strict';var EventEmitter=require(_0xcf22('0x0'));var FaxQueue=require(_0xcf22('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xcf22('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcf22('0x3'),'afterDestroy':_0xcf22('0x4')};function emitEvent(_0x50dd84){return function(_0x4a59ce,_0x5337ae,_0x16aab8){FaxQueueEvents[_0xcf22('0x5')](_0x50dd84+':'+_0x4a59ce['id'],_0x4a59ce);FaxQueueEvents['emit'](_0x50dd84,_0x4a59ce);_0x16aab8(null);};}for(var e in events){if(events[_0xcf22('0x6')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xcf22('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0xa048=['setMaxListeners','save','update','emit','hasOwnProperty','events','FaxQueue'];(function(_0x7ab4c0,_0x566e2a){var _0x2cc9de=function(_0x58f5f9){while(--_0x58f5f9){_0x7ab4c0['push'](_0x7ab4c0['shift']());}};_0x2cc9de(++_0x566e2a);}(_0xa048,0x1d3));var _0x8a04=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xa048[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x8a04('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0x8a04('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8a04('0x2')](0x0);var events={'afterCreate':_0x8a04('0x3'),'afterUpdate':_0x8a04('0x4'),'afterDestroy':'remove'};function emitEvent(_0xcde9cc){return function(_0x45bbe1,_0x3f5d73,_0xe94994){FaxQueueEvents[_0x8a04('0x5')](_0xcde9cc+':'+_0x45bbe1['id'],_0x45bbe1);FaxQueueEvents[_0x8a04('0x5')](_0xcde9cc,_0x45bbe1);_0xe94994(null);};}for(var e in events){if(events[_0x8a04('0x6')](e)){var event=events[e];FaxQueue['hook'](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 47a8c88..3662efd 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 _0x07f7=['bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','FaxQueue','fax_queues','lodash','util','../../config/logger','api','moment'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x07f7,0x181));var _0x707f=function(_0x3b632f,_0x453380){_0x3b632f=_0x3b632f-0x0;var _0x10e788=_0x07f7[_0x3b632f];return _0x10e788;};'use strict';var _=require(_0x707f('0x0'));var util=require(_0x707f('0x1'));var logger=require(_0x707f('0x2'))(_0x707f('0x3'));var moment=require(_0x707f('0x4'));var BPromise=require(_0x707f('0x5'));var rp=require(_0x707f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x707f('0x7'));var config=require(_0x707f('0x8'));var attributes=require(_0x707f('0x9'));module[_0x707f('0xa')]=function(_0x6c8150,_0x110195){return _0x6c8150['define'](_0x707f('0xb'),attributes,{'tableName':_0x707f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01ba=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x257499,_0x285b75){var _0x289120=function(_0x4bc404){while(--_0x4bc404){_0x257499['push'](_0x257499['shift']());}};_0x289120(++_0x285b75);}(_0x01ba,0x170));var _0xa01b=function(_0x43a6cd,_0x1abe8f){_0x43a6cd=_0x43a6cd-0x0;var _0x1395b2=_0x01ba[_0x43a6cd];return _0x1395b2;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa01b('0x0'));var moment=require(_0xa01b('0x1'));var BPromise=require(_0xa01b('0x2'));var rp=require(_0xa01b('0x3'));var fs=require('fs');var path=require(_0xa01b('0x4'));var rimraf=require(_0xa01b('0x5'));var config=require('../../config/environment');var attributes=require(_0xa01b('0x6'));module[_0xa01b('0x7')]=function(_0x361e09,_0x2968d2){return _0x361e09[_0xa01b('0x8')](_0xa01b('0x9'),attributes,{'tableName':_0xa01b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index 210163b..ec315fe 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 _0xb0fb=['error','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','limit','include','attributes','map','model','debug','find','where','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5e4759,_0x1f8793){var _0x1aefe3=function(_0x1be07e){while(--_0x1be07e){_0x5e4759['push'](_0x5e4759['shift']());}};_0x1aefe3(++_0x1f8793);}(_0xb0fb,0x149));var _0xbb0f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xb0fb[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xbb0f('0x0'));var util=require(_0xbb0f('0x1'));var moment=require(_0xbb0f('0x2'));var BPromise=require(_0xbb0f('0x3'));var rs=require(_0xbb0f('0x4'));var fs=require('fs');var Redis=require(_0xbb0f('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb0f('0x6'));var logger=require(_0xbb0f('0x7'))('rpc');var config=require(_0xbb0f('0x8'));var jayson=require(_0xbb0f('0x9'));var client=jayson[_0xbb0f('0xa')][_0xbb0f('0xb')]({'port':0x232a});config[_0xbb0f('0xc')]=_['defaults'](config[_0xbb0f('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb0f('0xd'))(new Redis(config[_0xbb0f('0xc')]));require('./faxQueue.socket')[_0xbb0f('0xe')](socket);function respondWithRpcPromise(_0xbecdc,_0x4b9dce,_0x351839){return new BPromise(function(_0x10d1ef,_0x98a1c0){return client[_0xbb0f('0xf')](_0xbecdc,_0x351839)[_0xbb0f('0x10')](function(_0x50591d){logger[_0xbb0f('0x11')](_0xbb0f('0x12'),_0x4b9dce,_0xbb0f('0x13'));logger['debug'](_0xbb0f('0x14'),_0x4b9dce,_0xbb0f('0x13'),JSON[_0xbb0f('0x15')](_0x50591d));if(_0x50591d[_0xbb0f('0x16')]){if(_0x50591d['error']['code']===0x1f4){logger[_0xbb0f('0x16')]('FaxQueue,\x20%s,\x20%s',_0x4b9dce,_0x50591d[_0xbb0f('0x16')][_0xbb0f('0x17')]);return _0x98a1c0(_0x50591d[_0xbb0f('0x16')]['message']);}logger[_0xbb0f('0x16')](_0xbb0f('0x12'),_0x4b9dce,_0x50591d[_0xbb0f('0x16')][_0xbb0f('0x17')]);return _0x10d1ef(_0x50591d[_0xbb0f('0x16')][_0xbb0f('0x17')]);}else{logger[_0xbb0f('0x11')](_0xbb0f('0x12'),_0x4b9dce,'request\x20sent');_0x10d1ef(_0x50591d['result'][_0xbb0f('0x17')]);}})[_0xbb0f('0x18')](function(_0x1571ec){logger['error'](_0xbb0f('0x12'),_0x4b9dce,_0x1571ec);_0x98a1c0(_0x1571ec);});});}exports[_0xbb0f('0x19')]=function(_0x4480f3){var _0x5e6672=this;return new Promise(function(_0x88bad3,_0x48e885){return db[_0xbb0f('0x1a')][_0xbb0f('0x1b')]({'raw':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')][_0xbb0f('0x1d')]===undefined?!![]:![]:!![],'where':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')]['where']||null:null,'attributes':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')]['attributes']||null:null,'limit':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3[_0xbb0f('0x1c')][_0xbb0f('0x1e')]||null:null,'include':_0x4480f3[_0xbb0f('0x1c')]?_0x4480f3['options'][_0xbb0f('0x1f')]?_['map'](_0x4480f3[_0xbb0f('0x1c')][_0xbb0f('0x1f')],function(_0x4e2cc9){return{'model':db[_0x4e2cc9['model']],'as':_0x4e2cc9['as'],'attributes':_0x4e2cc9[_0xbb0f('0x20')],'include':_0x4e2cc9['include']?_[_0xbb0f('0x21')](_0x4e2cc9[_0xbb0f('0x1f')],function(_0x33bd92){return{'model':db[_0x33bd92[_0xbb0f('0x22')]],'as':_0x33bd92['as'],'attributes':_0x33bd92[_0xbb0f('0x20')],'include':_0x33bd92[_0xbb0f('0x1f')]?_[_0xbb0f('0x21')](_0x33bd92['include'],function(_0x2ea852){return{'model':db[_0x2ea852[_0xbb0f('0x22')]],'as':_0x2ea852['as'],'attributes':_0x2ea852[_0xbb0f('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbb0f('0x10')](function(_0x797634){logger[_0xbb0f('0x11')](_0xbb0f('0x19'),_0x4480f3);logger[_0xbb0f('0x23')]('GetFaxQueue',_0x4480f3,JSON['stringify'](_0x797634));_0x88bad3(_0x797634);})[_0xbb0f('0x18')](function(_0x1fdd7f){logger[_0xbb0f('0x16')](_0xbb0f('0x19'),_0x1fdd7f[_0xbb0f('0x17')],_0x4480f3);_0x48e885(_0x5e6672['error'](0x1f4,_0x1fdd7f[_0xbb0f('0x17')]));});});};exports['ShowFaxQueue']=function(_0x5baab1){var _0x7d3bb=this;return new Promise(function(_0x310aa6,_0x1543ac){return db[_0xbb0f('0x1a')][_0xbb0f('0x24')]({'raw':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1[_0xbb0f('0x1c')][_0xbb0f('0x1d')]===undefined?!![]:![]:!![],'where':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1['options'][_0xbb0f('0x25')]||null:null,'attributes':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1[_0xbb0f('0x1c')][_0xbb0f('0x20')]||null:null,'include':_0x5baab1[_0xbb0f('0x1c')]?_0x5baab1[_0xbb0f('0x1c')][_0xbb0f('0x1f')]?_[_0xbb0f('0x21')](_0x5baab1[_0xbb0f('0x1c')]['include'],function(_0x22cb21){return{'model':db[_0x22cb21[_0xbb0f('0x22')]],'as':_0x22cb21['as'],'attributes':_0x22cb21[_0xbb0f('0x20')],'include':_0x22cb21[_0xbb0f('0x1f')]?_[_0xbb0f('0x21')](_0x22cb21[_0xbb0f('0x1f')],function(_0x5cee6a){return{'model':db[_0x5cee6a[_0xbb0f('0x22')]],'as':_0x5cee6a['as'],'attributes':_0x5cee6a[_0xbb0f('0x20')],'include':_0x5cee6a[_0xbb0f('0x1f')]?_['map'](_0x5cee6a['include'],function(_0x3669df){return{'model':db[_0x3669df[_0xbb0f('0x22')]],'as':_0x3669df['as'],'attributes':_0x3669df[_0xbb0f('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a8afa){logger[_0xbb0f('0x11')](_0xbb0f('0x26'),_0x5baab1);logger[_0xbb0f('0x23')]('ShowFaxQueue',_0x5baab1,JSON[_0xbb0f('0x15')](_0x3a8afa));_0x310aa6(_0x3a8afa);})[_0xbb0f('0x18')](function(_0x57f0d1){logger[_0xbb0f('0x16')](_0xbb0f('0x26'),_0x57f0d1['message'],_0x5baab1);_0x1543ac(_0x7d3bb[_0xbb0f('0x16')](0x1f4,_0x57f0d1['message']));});});}; \ No newline at end of file +var _0x0dc8=['ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetFaxQueue','FaxQueue','findAll','options','where','attributes','include','map','model','then','ShowFaxQueue','find','raw','util','bluebird'];(function(_0x43044e,_0x5725d6){var _0x1c6b54=function(_0x5d1a1b){while(--_0x5d1a1b){_0x43044e['push'](_0x43044e['shift']());}};_0x1c6b54(++_0x5725d6);}(_0x0dc8,0x14b));var _0x80dc=function(_0x2deac4,_0xc27a2b){_0x2deac4=_0x2deac4-0x0;var _0x1c0bda=_0x0dc8[_0x2deac4];return _0x1c0bda;};'use strict';var _=require('lodash');var util=require(_0x80dc('0x0'));var moment=require('moment');var BPromise=require(_0x80dc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x80dc('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x80dc('0x3'));var logger=require('../../config/logger')(_0x80dc('0x4'));var config=require(_0x80dc('0x5'));var jayson=require(_0x80dc('0x6'));var client=jayson['client'][_0x80dc('0x7')]({'port':0x232a});config[_0x80dc('0x8')]=_[_0x80dc('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x80dc('0xa'))(new Redis(config[_0x80dc('0x8')]));require(_0x80dc('0xb'))[_0x80dc('0xc')](socket);function respondWithRpcPromise(_0x3b247c,_0x314259,_0x398c36){return new BPromise(function(_0x2e5001,_0x2dee18){return client[_0x80dc('0xd')](_0x3b247c,_0x398c36)['then'](function(_0x569d3a){logger[_0x80dc('0xe')](_0x80dc('0xf'),_0x314259,'request\x20sent');logger[_0x80dc('0x10')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x314259,_0x80dc('0x11'),JSON[_0x80dc('0x12')](_0x569d3a));if(_0x569d3a[_0x80dc('0x13')]){if(_0x569d3a[_0x80dc('0x13')][_0x80dc('0x14')]===0x1f4){logger['error']('FaxQueue,\x20%s,\x20%s',_0x314259,_0x569d3a[_0x80dc('0x13')][_0x80dc('0x15')]);return _0x2dee18(_0x569d3a['error']['message']);}logger['error'](_0x80dc('0xf'),_0x314259,_0x569d3a['error'][_0x80dc('0x15')]);return _0x2e5001(_0x569d3a['error'][_0x80dc('0x15')]);}else{logger[_0x80dc('0xe')](_0x80dc('0xf'),_0x314259,_0x80dc('0x11'));_0x2e5001(_0x569d3a[_0x80dc('0x16')]['message']);}})[_0x80dc('0x17')](function(_0x3ab64b){logger[_0x80dc('0x13')]('FaxQueue,\x20%s,\x20%s',_0x314259,_0x3ab64b);_0x2dee18(_0x3ab64b);});});}exports[_0x80dc('0x18')]=function(_0x267e86){var _0x252e69=this;return new Promise(function(_0x28f5b5,_0x1486f6){return db[_0x80dc('0x19')][_0x80dc('0x1a')]({'raw':_0x267e86['options']?_0x267e86[_0x80dc('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x267e86[_0x80dc('0x1b')]?_0x267e86['options'][_0x80dc('0x1c')]||null:null,'attributes':_0x267e86['options']?_0x267e86[_0x80dc('0x1b')][_0x80dc('0x1d')]||null:null,'limit':_0x267e86['options']?_0x267e86[_0x80dc('0x1b')]['limit']||null:null,'include':_0x267e86[_0x80dc('0x1b')]?_0x267e86[_0x80dc('0x1b')][_0x80dc('0x1e')]?_[_0x80dc('0x1f')](_0x267e86[_0x80dc('0x1b')][_0x80dc('0x1e')],function(_0xa8c5d7){return{'model':db[_0xa8c5d7['model']],'as':_0xa8c5d7['as'],'attributes':_0xa8c5d7[_0x80dc('0x1d')],'include':_0xa8c5d7[_0x80dc('0x1e')]?_[_0x80dc('0x1f')](_0xa8c5d7[_0x80dc('0x1e')],function(_0x2f48a8){return{'model':db[_0x2f48a8[_0x80dc('0x20')]],'as':_0x2f48a8['as'],'attributes':_0x2f48a8[_0x80dc('0x1d')],'include':_0x2f48a8[_0x80dc('0x1e')]?_['map'](_0x2f48a8['include'],function(_0x2a42df){return{'model':db[_0x2a42df['model']],'as':_0x2a42df['as'],'attributes':_0x2a42df[_0x80dc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80dc('0x21')](function(_0x2c944a){logger[_0x80dc('0xe')](_0x80dc('0x18'),_0x267e86);logger['debug'](_0x80dc('0x18'),_0x267e86,JSON[_0x80dc('0x12')](_0x2c944a));_0x28f5b5(_0x2c944a);})[_0x80dc('0x17')](function(_0x256094){logger[_0x80dc('0x13')](_0x80dc('0x18'),_0x256094['message'],_0x267e86);_0x1486f6(_0x252e69['error'](0x1f4,_0x256094['message']));});});};exports[_0x80dc('0x22')]=function(_0x252687){var _0x460891=this;return new Promise(function(_0x3c2139,_0x42f2dc){return db[_0x80dc('0x19')][_0x80dc('0x23')]({'raw':_0x252687[_0x80dc('0x1b')]?_0x252687[_0x80dc('0x1b')][_0x80dc('0x24')]===undefined?!![]:![]:!![],'where':_0x252687['options']?_0x252687[_0x80dc('0x1b')]['where']||null:null,'attributes':_0x252687[_0x80dc('0x1b')]?_0x252687[_0x80dc('0x1b')][_0x80dc('0x1d')]||null:null,'include':_0x252687[_0x80dc('0x1b')]?_0x252687[_0x80dc('0x1b')]['include']?_[_0x80dc('0x1f')](_0x252687[_0x80dc('0x1b')]['include'],function(_0x266c73){return{'model':db[_0x266c73[_0x80dc('0x20')]],'as':_0x266c73['as'],'attributes':_0x266c73[_0x80dc('0x1d')],'include':_0x266c73[_0x80dc('0x1e')]?_['map'](_0x266c73[_0x80dc('0x1e')],function(_0x4df438){return{'model':db[_0x4df438[_0x80dc('0x20')]],'as':_0x4df438['as'],'attributes':_0x4df438['attributes'],'include':_0x4df438['include']?_[_0x80dc('0x1f')](_0x4df438[_0x80dc('0x1e')],function(_0x5919b5){return{'model':db[_0x5919b5[_0x80dc('0x20')]],'as':_0x5919b5['as'],'attributes':_0x5919b5[_0x80dc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x80dc('0x21')](function(_0x524d5a){logger[_0x80dc('0xe')](_0x80dc('0x22'),_0x252687);logger[_0x80dc('0x10')]('ShowFaxQueue',_0x252687,JSON['stringify'](_0x524d5a));_0x3c2139(_0x524d5a);})[_0x80dc('0x17')](function(_0x34bcad){logger[_0x80dc('0x13')]('ShowFaxQueue',_0x34bcad['message'],_0x252687);_0x42f2dc(_0x460891['error'](0x1f4,_0x34bcad[_0x80dc('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index f30d271..ceeaab0 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 _0x0f37=['length','faxQueue:','save','update','emit','removeListener','register'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0f37,0x191));var _0x70f3=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x0f37[_0x513254];return _0x384c92;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x70f3('0x0'),'remove',_0x70f3('0x1')];function createListener(_0x2efdab,_0x2f1b6a){return function(_0xe0402c){_0x2f1b6a[_0x70f3('0x2')](_0x2efdab,_0xe0402c);};}function removeListener(_0x1ae3d3,_0x37cc2d){return function(){FaxQueueEvents[_0x70f3('0x3')](_0x1ae3d3,_0x37cc2d);};}exports[_0x70f3('0x4')]=function(_0x3c5925){for(var _0x58a8df=0x0,_0x31ae64=events[_0x70f3('0x5')];_0x58a8df<_0x31ae64;_0x58a8df++){var _0x513385=events[_0x58a8df];var _0x4fe47e=createListener(_0x70f3('0x6')+_0x513385,_0x3c5925);FaxQueueEvents['on'](_0x513385,_0x4fe47e);}}; \ No newline at end of file +var _0x4020=['remove','update','removeListener','register','length','faxQueue:','save'];(function(_0x184653,_0xb7ea24){var _0x50683f=function(_0x508ab9){while(--_0x508ab9){_0x184653['push'](_0x184653['shift']());}};_0x50683f(++_0xb7ea24);}(_0x4020,0x1f0));var _0x0402=function(_0x5d0a8c,_0x28dbbe){_0x5d0a8c=_0x5d0a8c-0x0;var _0x36978f=_0x4020[_0x5d0a8c];return _0x36978f;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=[_0x0402('0x0'),_0x0402('0x1'),_0x0402('0x2')];function createListener(_0x1b1fcf,_0x55791){return function(_0x40746c){_0x55791['emit'](_0x1b1fcf,_0x40746c);};}function removeListener(_0xdd3df7,_0x8a8b74){return function(){FaxQueueEvents[_0x0402('0x3')](_0xdd3df7,_0x8a8b74);};}exports[_0x0402('0x4')]=function(_0x57c15c){for(var _0x3b7ae6=0x0,_0x48f4d2=events[_0x0402('0x5')];_0x3b7ae6<_0x48f4d2;_0x3b7ae6++){var _0x2328cf=events[_0x3b7ae6];var _0x3286f6=createListener(_0x0402('0x6')+_0x2328cf,_0x57c15c);FaxQueueEvents['on'](_0x2328cf,_0x3286f6);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 9e0e80a..8f31a2d 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 _0x687b=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','create','post','addTeams','addAgents','put','/:id','update','delete','destroy','exports'];(function(_0x560e64,_0x3b0905){var _0x5a9701=function(_0x2d438b){while(--_0x2d438b){_0x560e64['push'](_0x560e64['shift']());}};_0x5a9701(++_0x3b0905);}(_0x687b,0x14a));var _0xb687=function(_0x28111f,_0x254934){_0x28111f=_0x28111f-0x0;var _0x5203e6=_0x687b[_0x28111f];return _0x5203e6;};'use strict';var multer=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var path=require(_0xb687('0x2'));var timeout=require(_0xb687('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xb687('0x4'));var auth=require(_0xb687('0x5'));var interaction=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var controller=require(_0xb687('0x8'));router[_0xb687('0x9')]('/',auth[_0xb687('0xa')](),controller[_0xb687('0xb')]);router[_0xb687('0x9')](_0xb687('0xc'),auth['isAuthenticated'](),controller[_0xb687('0xd')]);router[_0xb687('0x9')]('/:id',auth[_0xb687('0xa')](),controller[_0xb687('0xe')]);router[_0xb687('0x9')](_0xb687('0xf'),auth[_0xb687('0xa')](),controller[_0xb687('0x10')]);router[_0xb687('0x9')](_0xb687('0x11'),auth[_0xb687('0xa')](),controller['getTeams']);router[_0xb687('0x9')](_0xb687('0x12'),auth[_0xb687('0xa')](),controller[_0xb687('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb687('0x14')]);router[_0xb687('0x15')]('/:id/teams',auth[_0xb687('0xa')](),controller[_0xb687('0x16')]);router[_0xb687('0x15')](_0xb687('0x12'),auth[_0xb687('0xa')](),controller[_0xb687('0x17')]);router[_0xb687('0x18')](_0xb687('0x19'),auth[_0xb687('0xa')](),controller[_0xb687('0x1a')]);router[_0xb687('0x1b')](_0xb687('0x19'),auth['isAuthenticated'](),controller[_0xb687('0x1c')]);router[_0xb687('0x1b')](_0xb687('0x11'),auth['isAuthenticated'](),controller['removeTeams']);router[_0xb687('0x1b')](_0xb687('0x12'),auth[_0xb687('0xa')](),controller['removeAgents']);module[_0xb687('0x1d')]=router; \ No newline at end of file +var _0xfb11=['Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','/describe','describe','get','/:id','show','/:id/members','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','multer','path','connect-timeout'];(function(_0x5befc4,_0x1d6fd6){var _0xfb087c=function(_0x1cf292){while(--_0x1cf292){_0x5befc4['push'](_0x5befc4['shift']());}};_0xfb087c(++_0x1d6fd6);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xfb11[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x1fb1('0x0'));var util=require('util');var path=require(_0x1fb1('0x1'));var timeout=require(_0x1fb1('0x2'));var express=require('express');var router=express[_0x1fb1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1fb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1fb1('0x5'));var controller=require(_0x1fb1('0x6'));router['get']('/',auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x8')]);router['get'](_0x1fb1('0x9'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xa')]);router[_0x1fb1('0xb')](_0x1fb1('0xc'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0xd')]);router[_0x1fb1('0xb')](_0x1fb1('0xe'),auth[_0x1fb1('0x7')](),controller['getMembers']);router[_0x1fb1('0xb')]('/:id/teams',auth[_0x1fb1('0x7')](),controller['getTeams']);router[_0x1fb1('0xb')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x10')]);router[_0x1fb1('0x11')]('/',auth[_0x1fb1('0x7')](),controller['create']);router[_0x1fb1('0x11')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x13')]);router[_0x1fb1('0x11')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x14')]);router[_0x1fb1('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1fb1('0x16')]);router[_0x1fb1('0x17')](_0x1fb1('0xc'),auth['isAuthenticated'](),controller[_0x1fb1('0x18')]);router[_0x1fb1('0x17')](_0x1fb1('0x12'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x19')]);router[_0x1fb1('0x17')](_0x1fb1('0xf'),auth[_0x1fb1('0x7')](),controller[_0x1fb1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 446fde0..5fd17fb 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 _0x61d8=['exports','STRING','DATE','moment','sequelize'];(function(_0x5aa39e,_0x4c04da){var _0x2d9180=function(_0x4e5654){while(--_0x4e5654){_0x5aa39e['push'](_0x5aa39e['shift']());}};_0x2d9180(++_0x4c04da);}(_0x61d8,0x12f));var _0x861d=function(_0x14b251,_0x2d28f6){_0x14b251=_0x14b251-0x0;var _0x2a7a48=_0x61d8[_0x14b251];return _0x2a7a48;};'use strict';var moment=require(_0x861d('0x0'));var Sequelize=require(_0x861d('0x1'));module[_0x861d('0x2')]={'uniqueid':{'type':Sequelize[_0x861d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x861d('0x3')]},'joinAt':{'type':Sequelize[_0x861d('0x4')]},'leaveAt':{'type':Sequelize[_0x861d('0x4')]},'acceptAt':{'type':Sequelize[_0x861d('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x861d('0x3')]}}; \ No newline at end of file +var _0x9a44=['STRING','DATE','moment','sequelize','exports'];(function(_0x387f80,_0x141029){var _0x3bec51=function(_0x419704){while(--_0x419704){_0x387f80['push'](_0x387f80['shift']());}};_0x3bec51(++_0x141029);}(_0x9a44,0x156));var _0x49a4=function(_0x13de59,_0x5ca915){_0x13de59=_0x13de59-0x0;var _0x4695dc=_0x9a44[_0x13de59];return _0x4695dc;};'use strict';var moment=require(_0x49a4('0x0'));var Sequelize=require(_0x49a4('0x1'));module[_0x49a4('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x49a4('0x3')]},'joinAt':{'type':Sequelize[_0x49a4('0x4')]},'leaveAt':{'type':Sequelize[_0x49a4('0x4')]},'acceptAt':{'type':Sequelize[_0x49a4('0x4')]},'exitAt':{'type':Sequelize[_0x49a4('0x4')]},'reason':{'type':Sequelize[_0x49a4('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 67defcf..1d17b85 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 _0x0aaf=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','query'];(function(_0x436de0,_0x4c04f0){var _0x2be7d4=function(_0x548a0c){while(--_0x548a0c){_0x436de0['push'](_0x436de0['shift']());}};_0x2be7d4(++_0x4c04f0);}(_0x0aaf,0x1c8));var _0xf0aa=function(_0x596284,_0x1cd02b){_0x596284=_0x596284-0x0;var _0x5313c6=_0x0aaf[_0x596284];return _0x5313c6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xf0aa('0x0'));var jsonpatch=require(_0xf0aa('0x1'));var rp=require(_0xf0aa('0x2'));var moment=require(_0xf0aa('0x3'));var BPromise=require(_0xf0aa('0x4'));var Mustache=require('mustache');var util=require(_0xf0aa('0x5'));var path=require(_0xf0aa('0x6'));var sox=require('sox');var csv=require(_0xf0aa('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0aa('0x8'));var _=require('lodash');var squel=require(_0xf0aa('0x9'));var crypto=require(_0xf0aa('0xa'));var jsforce=require(_0xf0aa('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf0aa('0x7'));var querystring=require(_0xf0aa('0xc'));var Papa=require('papaparse');var Redis=require(_0xf0aa('0xd'));var authService=require(_0xf0aa('0xe'));var qs=require(_0xf0aa('0xf'));var as=require(_0xf0aa('0x10'));var hardwareService=require(_0xf0aa('0x11'));var logger=require(_0xf0aa('0x12'))(_0xf0aa('0x13'));var utils=require(_0xf0aa('0x14'));var config=require(_0xf0aa('0x15'));var licenseUtil=require(_0xf0aa('0x16'));var db=require(_0xf0aa('0x17'))['db'];function respondWithStatusCode(_0x40b5be,_0x47961e){_0x47961e=_0x47961e||0xcc;return function(_0x4f8622){if(_0x4f8622){return _0x40b5be[_0xf0aa('0x18')](_0x47961e);}return _0x40b5be[_0xf0aa('0x19')](_0x47961e)['end']();};}function respondWithResult(_0x4dc456,_0x37a6ac){_0x37a6ac=_0x37a6ac||0xc8;return function(_0x51bb2c){if(_0x51bb2c){return _0x4dc456[_0xf0aa('0x19')](_0x37a6ac)['json'](_0x51bb2c);}};}function respondWithFilteredResult(_0x22bb2e,_0x4b6219){return function(_0x3fb1fe){if(_0x3fb1fe){var _0x114c96=typeof _0x4b6219[_0xf0aa('0x1a')]===_0xf0aa('0x1b')&&typeof _0x4b6219[_0xf0aa('0x1c')]===_0xf0aa('0x1b');var _0x34e6f7=_0x3fb1fe[_0xf0aa('0x1d')];var _0x4e3fe6=_0x114c96?0x0:_0x4b6219[_0xf0aa('0x1a')];var _0x30f055=_0x114c96?_0x3fb1fe['count']:_0x4b6219[_0xf0aa('0x1a')]+_0x4b6219[_0xf0aa('0x1c')];var _0x35f407;if(_0x30f055>=_0x34e6f7){_0x30f055=_0x34e6f7;_0x35f407=0xc8;}else{_0x35f407=0xce;}_0x22bb2e[_0xf0aa('0x19')](_0x35f407);return _0x22bb2e[_0xf0aa('0x1e')](_0xf0aa('0x1f'),_0x4e3fe6+'-'+_0x30f055+'/'+_0x34e6f7)['json'](_0x3fb1fe);}return null;};}function patchUpdates(_0x112980){return function(_0x227cba){try{jsonpatch[_0xf0aa('0x20')](_0x227cba,_0x112980,!![]);}catch(_0x388893){return BPromise[_0xf0aa('0x21')](_0x388893);}return _0x227cba[_0xf0aa('0x22')]();};}function saveUpdates(_0x49e9fc,_0x5e2470){return function(_0x4c6f86){if(_0x4c6f86){return _0x4c6f86[_0xf0aa('0x23')](_0x49e9fc)['then'](function(_0xc4e56c){return _0xc4e56c;});}return null;};}function removeEntity(_0x245e0c,_0x40cbbb){return function(_0x2983ee){if(_0x2983ee){return _0x2983ee[_0xf0aa('0x24')]()[_0xf0aa('0x25')](function(){_0x245e0c[_0xf0aa('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x169a07,_0x3c21fc){return function(_0x44a7bf){if(!_0x44a7bf){_0x169a07[_0xf0aa('0x18')](0x194);}return _0x44a7bf;};}function handleError(_0x74188d,_0x1dc140){_0x1dc140=_0x1dc140||0x1f4;return function(_0x17b7f6){logger[_0xf0aa('0x26')](_0x17b7f6['stack']);if(_0x17b7f6['name']){delete _0x17b7f6[_0xf0aa('0x27')];}_0x74188d['status'](_0x1dc140)[_0xf0aa('0x28')](_0x17b7f6);};}exports['index']=function(_0x403ac2,_0x381179){var _0x4d2c9b={},_0x56b555={},_0x3b99ea={'count':0x0,'rows':[]};var _0x132950=_[_0xf0aa('0x29')](db[_0xf0aa('0x2a')][_0xf0aa('0x2b')],function(_0x3f51cd){return{'name':_0x3f51cd[_0xf0aa('0x2c')],'type':_0x3f51cd[_0xf0aa('0x2d')]['key']};});_0x56b555[_0xf0aa('0x2e')]=_[_0xf0aa('0x29')](_0x132950,'name');_0x56b555['query']=_['keys'](_0x403ac2[_0xf0aa('0x2f')]);_0x56b555[_0xf0aa('0x30')]=_['intersection'](_0x56b555[_0xf0aa('0x2e')],_0x56b555['query']);_0x4d2c9b['attributes']=_[_0xf0aa('0x31')](_0x56b555[_0xf0aa('0x2e')],qs['fields'](_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x32')]));_0x4d2c9b['attributes']=_0x4d2c9b[_0xf0aa('0x33')][_0xf0aa('0x34')]?_0x4d2c9b[_0xf0aa('0x33')]:_0x56b555[_0xf0aa('0x2e')];if(!_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x35')](_0xf0aa('0x36'))){_0x4d2c9b['limit']=qs[_0xf0aa('0x1c')](_0x403ac2['query'][_0xf0aa('0x1c')]);_0x4d2c9b[_0xf0aa('0x1a')]=qs[_0xf0aa('0x1a')](_0x403ac2[_0xf0aa('0x2f')]['offset']);}_0x4d2c9b[_0xf0aa('0x37')]=qs['sort'](_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x38')]);_0x4d2c9b[_0xf0aa('0x39')]=qs[_0xf0aa('0x30')](_[_0xf0aa('0x3a')](_0x403ac2[_0xf0aa('0x2f')],_0x56b555[_0xf0aa('0x30')]),_0x132950);if(_0x403ac2['query'][_0xf0aa('0x3b')]){_0x4d2c9b[_0xf0aa('0x39')]=_[_0xf0aa('0x3c')](_0x4d2c9b[_0xf0aa('0x39')],{'$or':_['map'](_0x132950,function(_0x5e11ac){if(_0x5e11ac[_0xf0aa('0x2d')]!==_0xf0aa('0x3d')){var _0x493ed1={};_0x493ed1[_0x5e11ac[_0xf0aa('0x27')]]={'$like':'%'+_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x3b')]+'%'};return _0x493ed1;}})});}_0x4d2c9b=_[_0xf0aa('0x3c')]({},_0x4d2c9b,_0x403ac2[_0xf0aa('0x3e')]);var _0x410163={'where':_0x4d2c9b[_0xf0aa('0x39')]};return db[_0xf0aa('0x2a')][_0xf0aa('0x1d')](_0x410163)[_0xf0aa('0x25')](function(_0x26d923){_0x3b99ea[_0xf0aa('0x1d')]=_0x26d923;if(_0x403ac2[_0xf0aa('0x2f')][_0xf0aa('0x3f')]){_0x4d2c9b['include']=[{'all':!![]}];}return db[_0xf0aa('0x2a')]['findAll'](_0x4d2c9b);})['then'](function(_0x2d239d){_0x3b99ea[_0xf0aa('0x40')]=_0x2d239d;return _0x3b99ea;})['then'](respondWithFilteredResult(_0x381179,_0x4d2c9b))[_0xf0aa('0x41')](handleError(_0x381179,null));};exports['show']=function(_0x22d3a6,_0x451eca){var _0x48046c={'raw':!![],'where':{'id':_0x22d3a6[_0xf0aa('0x42')]['id']}},_0x8579d1={};_0x8579d1['model']=_[_0xf0aa('0x43')](db[_0xf0aa('0x2a')][_0xf0aa('0x2b')]);_0x8579d1[_0xf0aa('0x2f')]=_[_0xf0aa('0x43')](_0x22d3a6[_0xf0aa('0x2f')]);_0x8579d1['filters']=_[_0xf0aa('0x31')](_0x8579d1['model'],_0x8579d1[_0xf0aa('0x2f')]);_0x48046c[_0xf0aa('0x33')]=_['intersection'](_0x8579d1[_0xf0aa('0x2e')],qs[_0xf0aa('0x32')](_0x22d3a6[_0xf0aa('0x2f')][_0xf0aa('0x32')]));_0x48046c[_0xf0aa('0x33')]=_0x48046c[_0xf0aa('0x33')][_0xf0aa('0x34')]?_0x48046c['attributes']:_0x8579d1[_0xf0aa('0x2e')];if(_0x22d3a6[_0xf0aa('0x2f')][_0xf0aa('0x3f')]){_0x48046c['include']=[{'all':!![]}];}_0x48046c=_[_0xf0aa('0x3c')]({},_0x48046c,_0x22d3a6[_0xf0aa('0x3e')]);return db['FaxQueueReport'][_0xf0aa('0x44')](_0x48046c)[_0xf0aa('0x25')](handleEntityNotFound(_0x451eca,null))['then'](respondWithResult(_0x451eca,null))[_0xf0aa('0x41')](handleError(_0x451eca,null));};exports[_0xf0aa('0x45')]=function(_0x13f29e,_0xf6dc5b){return db[_0xf0aa('0x2a')][_0xf0aa('0x45')](_0x13f29e[_0xf0aa('0x46')],{})['then'](respondWithResult(_0xf6dc5b,0xc9))[_0xf0aa('0x41')](handleError(_0xf6dc5b,null));};exports[_0xf0aa('0x23')]=function(_0x3a0811,_0x193c12){if(_0x3a0811[_0xf0aa('0x46')]['id']){delete _0x3a0811[_0xf0aa('0x46')]['id'];}return db[_0xf0aa('0x2a')][_0xf0aa('0x44')]({'where':{'id':_0x3a0811[_0xf0aa('0x42')]['id']}})[_0xf0aa('0x25')](handleEntityNotFound(_0x193c12,null))['then'](saveUpdates(_0x3a0811[_0xf0aa('0x46')],null))[_0xf0aa('0x25')](respondWithResult(_0x193c12,null))[_0xf0aa('0x41')](handleError(_0x193c12,null));};exports[_0xf0aa('0x24')]=function(_0x3bf4fb,_0x508df5){return db[_0xf0aa('0x2a')][_0xf0aa('0x44')]({'where':{'id':_0x3bf4fb['params']['id']}})[_0xf0aa('0x25')](handleEntityNotFound(_0x508df5,null))[_0xf0aa('0x25')](removeEntity(_0x508df5,null))[_0xf0aa('0x41')](handleError(_0x508df5,null));};exports[_0xf0aa('0x47')]=function(_0x4c82bc,_0x5cd52b){return db[_0xf0aa('0x2a')][_0xf0aa('0x47')]()[_0xf0aa('0x25')](respondWithResult(_0x5cd52b,null))[_0xf0aa('0x41')](handleError(_0x5cd52b,null));}; \ No newline at end of file +var _0xb63f=['hasOwnProperty','order','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length'];(function(_0x4dee05,_0x229e1d){var _0x527162=function(_0x4ccc0e){while(--_0x4ccc0e){_0x4dee05['push'](_0x4dee05['shift']());}};_0x527162(++_0x229e1d);}(_0xb63f,0xa3));var _0xfb63=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0xb63f[_0x2730da];return _0xfe9991;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfb63('0x0'));var jsonpatch=require(_0xfb63('0x1'));var rp=require(_0xfb63('0x2'));var moment=require(_0xfb63('0x3'));var BPromise=require(_0xfb63('0x4'));var Mustache=require(_0xfb63('0x5'));var util=require(_0xfb63('0x6'));var path=require(_0xfb63('0x7'));var sox=require(_0xfb63('0x8'));var csv=require('to-csv');var ejs=require(_0xfb63('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfb63('0xa'));var squel=require(_0xfb63('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb63('0xc'));var querystring=require(_0xfb63('0xd'));var Papa=require(_0xfb63('0xe'));var Redis=require('ioredis');var authService=require(_0xfb63('0xf'));var qs=require(_0xfb63('0x10'));var as=require(_0xfb63('0x11'));var hardwareService=require(_0xfb63('0x12'));var logger=require(_0xfb63('0x13'))(_0xfb63('0x14'));var utils=require(_0xfb63('0x15'));var config=require(_0xfb63('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xee69d,_0x233ec3){_0x233ec3=_0x233ec3||0xcc;return function(_0xa2f034){if(_0xa2f034){return _0xee69d['sendStatus'](_0x233ec3);}return _0xee69d[_0xfb63('0x17')](_0x233ec3)[_0xfb63('0x18')]();};}function respondWithResult(_0x48a22c,_0x4575b6){_0x4575b6=_0x4575b6||0xc8;return function(_0x377d1e){if(_0x377d1e){return _0x48a22c[_0xfb63('0x17')](_0x4575b6)[_0xfb63('0x19')](_0x377d1e);}};}function respondWithFilteredResult(_0x51e7ef,_0x44619e){return function(_0x48e2c0){if(_0x48e2c0){var _0x19f196=typeof _0x44619e[_0xfb63('0x1a')]===_0xfb63('0x1b')&&typeof _0x44619e[_0xfb63('0x1c')]===_0xfb63('0x1b');var _0x49081d=_0x48e2c0[_0xfb63('0x1d')];var _0x5dfd32=_0x19f196?0x0:_0x44619e[_0xfb63('0x1a')];var _0x4f7508=_0x19f196?_0x48e2c0[_0xfb63('0x1d')]:_0x44619e[_0xfb63('0x1a')]+_0x44619e[_0xfb63('0x1c')];var _0x452f1e;if(_0x4f7508>=_0x49081d){_0x4f7508=_0x49081d;_0x452f1e=0xc8;}else{_0x452f1e=0xce;}_0x51e7ef['status'](_0x452f1e);return _0x51e7ef[_0xfb63('0x1e')]('Content-Range',_0x5dfd32+'-'+_0x4f7508+'/'+_0x49081d)[_0xfb63('0x19')](_0x48e2c0);}return null;};}function patchUpdates(_0x3ef0cf){return function(_0x564052){try{jsonpatch[_0xfb63('0x1f')](_0x564052,_0x3ef0cf,!![]);}catch(_0x23c4fb){return BPromise['reject'](_0x23c4fb);}return _0x564052[_0xfb63('0x20')]();};}function saveUpdates(_0x43bf68,_0x267953){return function(_0x34e22c){if(_0x34e22c){return _0x34e22c[_0xfb63('0x21')](_0x43bf68)[_0xfb63('0x22')](function(_0x17f81e){return _0x17f81e;});}return null;};}function removeEntity(_0x1bbedc,_0x43c245){return function(_0xa7612f){if(_0xa7612f){return _0xa7612f[_0xfb63('0x23')]()[_0xfb63('0x22')](function(){_0x1bbedc[_0xfb63('0x17')](0xcc)[_0xfb63('0x18')]();});}};}function handleEntityNotFound(_0x26036d,_0x19ea95){return function(_0x1b8f0a){if(!_0x1b8f0a){_0x26036d[_0xfb63('0x24')](0x194);}return _0x1b8f0a;};}function handleError(_0x49482f,_0x2bbe9a){_0x2bbe9a=_0x2bbe9a||0x1f4;return function(_0x4c80c1){logger['error'](_0x4c80c1[_0xfb63('0x25')]);if(_0x4c80c1[_0xfb63('0x26')]){delete _0x4c80c1[_0xfb63('0x26')];}_0x49482f[_0xfb63('0x17')](_0x2bbe9a)[_0xfb63('0x27')](_0x4c80c1);};}exports[_0xfb63('0x28')]=function(_0x594962,_0x45e231){var _0x2a008e={},_0x441dd7={},_0x188501={'count':0x0,'rows':[]};var _0x3c910b=_[_0xfb63('0x29')](db[_0xfb63('0x2a')][_0xfb63('0x2b')],function(_0x293909){return{'name':_0x293909[_0xfb63('0x2c')],'type':_0x293909[_0xfb63('0x2d')]['key']};});_0x441dd7[_0xfb63('0x2e')]=_['map'](_0x3c910b,_0xfb63('0x26'));_0x441dd7[_0xfb63('0x2f')]=_[_0xfb63('0x30')](_0x594962['query']);_0x441dd7['filters']=_[_0xfb63('0x31')](_0x441dd7['model'],_0x441dd7['query']);_0x2a008e[_0xfb63('0x32')]=_['intersection'](_0x441dd7[_0xfb63('0x2e')],qs[_0xfb63('0x33')](_0x594962[_0xfb63('0x2f')][_0xfb63('0x33')]));_0x2a008e[_0xfb63('0x32')]=_0x2a008e[_0xfb63('0x32')][_0xfb63('0x34')]?_0x2a008e[_0xfb63('0x32')]:_0x441dd7['model'];if(!_0x594962['query'][_0xfb63('0x35')]('nolimit')){_0x2a008e[_0xfb63('0x1c')]=qs[_0xfb63('0x1c')](_0x594962[_0xfb63('0x2f')][_0xfb63('0x1c')]);_0x2a008e[_0xfb63('0x1a')]=qs['offset'](_0x594962['query'][_0xfb63('0x1a')]);}_0x2a008e[_0xfb63('0x36')]=qs['sort'](_0x594962['query']['sort']);_0x2a008e[_0xfb63('0x37')]=qs[_0xfb63('0x38')](_[_0xfb63('0x39')](_0x594962['query'],_0x441dd7[_0xfb63('0x38')]),_0x3c910b);if(_0x594962[_0xfb63('0x2f')][_0xfb63('0x3a')]){_0x2a008e[_0xfb63('0x37')]=_[_0xfb63('0x3b')](_0x2a008e[_0xfb63('0x37')],{'$or':_[_0xfb63('0x29')](_0x3c910b,function(_0x579ca5){if(_0x579ca5['type']!==_0xfb63('0x3c')){var _0x4fb080={};_0x4fb080[_0x579ca5[_0xfb63('0x26')]]={'$like':'%'+_0x594962[_0xfb63('0x2f')][_0xfb63('0x3a')]+'%'};return _0x4fb080;}})});}_0x2a008e=_[_0xfb63('0x3b')]({},_0x2a008e,_0x594962[_0xfb63('0x3d')]);var _0x38ecc3={'where':_0x2a008e[_0xfb63('0x37')]};return db[_0xfb63('0x2a')][_0xfb63('0x1d')](_0x38ecc3)[_0xfb63('0x22')](function(_0x3d745a){_0x188501[_0xfb63('0x1d')]=_0x3d745a;if(_0x594962[_0xfb63('0x2f')][_0xfb63('0x3e')]){_0x2a008e[_0xfb63('0x3f')]=[{'all':!![]}];}return db[_0xfb63('0x2a')][_0xfb63('0x40')](_0x2a008e);})[_0xfb63('0x22')](function(_0x3f0d52){_0x188501[_0xfb63('0x41')]=_0x3f0d52;return _0x188501;})[_0xfb63('0x22')](respondWithFilteredResult(_0x45e231,_0x2a008e))['catch'](handleError(_0x45e231,null));};exports['show']=function(_0x29786a,_0x54346d){var _0x3bdc62={'raw':!![],'where':{'id':_0x29786a[_0xfb63('0x42')]['id']}},_0x1fc68b={};_0x1fc68b[_0xfb63('0x2e')]=_[_0xfb63('0x30')](db[_0xfb63('0x2a')][_0xfb63('0x2b')]);_0x1fc68b[_0xfb63('0x2f')]=_[_0xfb63('0x30')](_0x29786a[_0xfb63('0x2f')]);_0x1fc68b[_0xfb63('0x38')]=_[_0xfb63('0x31')](_0x1fc68b['model'],_0x1fc68b[_0xfb63('0x2f')]);_0x3bdc62[_0xfb63('0x32')]=_[_0xfb63('0x31')](_0x1fc68b[_0xfb63('0x2e')],qs[_0xfb63('0x33')](_0x29786a[_0xfb63('0x2f')][_0xfb63('0x33')]));_0x3bdc62[_0xfb63('0x32')]=_0x3bdc62[_0xfb63('0x32')]['length']?_0x3bdc62[_0xfb63('0x32')]:_0x1fc68b[_0xfb63('0x2e')];if(_0x29786a[_0xfb63('0x2f')][_0xfb63('0x3e')]){_0x3bdc62[_0xfb63('0x3f')]=[{'all':!![]}];}_0x3bdc62=_[_0xfb63('0x3b')]({},_0x3bdc62,_0x29786a['options']);return db[_0xfb63('0x2a')][_0xfb63('0x43')](_0x3bdc62)[_0xfb63('0x22')](handleEntityNotFound(_0x54346d,null))[_0xfb63('0x22')](respondWithResult(_0x54346d,null))[_0xfb63('0x44')](handleError(_0x54346d,null));};exports[_0xfb63('0x45')]=function(_0x2cf398,_0x13030c){return db[_0xfb63('0x2a')]['create'](_0x2cf398[_0xfb63('0x46')],{})[_0xfb63('0x22')](respondWithResult(_0x13030c,0xc9))[_0xfb63('0x44')](handleError(_0x13030c,null));};exports[_0xfb63('0x21')]=function(_0x27a179,_0x1f0478){if(_0x27a179[_0xfb63('0x46')]['id']){delete _0x27a179[_0xfb63('0x46')]['id'];}return db[_0xfb63('0x2a')]['find']({'where':{'id':_0x27a179[_0xfb63('0x42')]['id']}})[_0xfb63('0x22')](handleEntityNotFound(_0x1f0478,null))[_0xfb63('0x22')](saveUpdates(_0x27a179[_0xfb63('0x46')],null))[_0xfb63('0x22')](respondWithResult(_0x1f0478,null))[_0xfb63('0x44')](handleError(_0x1f0478,null));};exports['destroy']=function(_0x39d921,_0x24aa62){return db['FaxQueueReport'][_0xfb63('0x43')]({'where':{'id':_0x39d921[_0xfb63('0x42')]['id']}})[_0xfb63('0x22')](handleEntityNotFound(_0x24aa62,null))[_0xfb63('0x22')](removeEntity(_0x24aa62,null))[_0xfb63('0x44')](handleError(_0x24aa62,null));};exports[_0xfb63('0x47')]=function(_0xf95110,_0x43c1a8){return db[_0xfb63('0x2a')][_0xfb63('0x47')]()[_0xfb63('0x22')](respondWithResult(_0x43c1a8,null))['catch'](handleError(_0x43c1a8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index b4d1d10..e8c0d43 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x203362,_0x397599){var _0x14d3b4=function(_0x4fc4b4){while(--_0x4fc4b4){_0x203362['push'](_0x203362['shift']());}};_0x14d3b4(++_0x397599);}(_0xf494,0x1c6));var _0x4f49=function(_0x2d26cd,_0x4a44e1){_0x2d26cd=_0x2d26cd-0x0;var _0x2a03f3=_0xf494[_0x2d26cd];return _0x2a03f3;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x46f203,_0x546dba){var _0x1930d8=function(_0x276551){while(--_0x276551){_0x46f203['push'](_0x46f203['shift']());}};_0x1930d8(++_0x546dba);}(_0xf494,0x1c6));var _0x4f49=function(_0x184e4a,_0x300787){_0x184e4a=_0x184e4a-0x0;var _0x243cfe=_0xf494[_0x184e4a];return _0x243cfe;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 15ba535..0e5c813 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 _0x4656=['info','stringify','update','body','where','attributes','then','UpdateFaxQueueReport','util','bluebird','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw'];(function(_0x3d44c5,_0x22daa4){var _0x1778cf=function(_0x504bf7){while(--_0x504bf7){_0x3d44c5['push'](_0x3d44c5['shift']());}};_0x1778cf(++_0x22daa4);}(_0x4656,0x1ba));var _0x6465=function(_0x2a7b8e,_0x50ffce){_0x2a7b8e=_0x2a7b8e-0x0;var _0x29b5c8=_0x4656[_0x2a7b8e];return _0x29b5c8;};'use strict';var _=require('lodash');var util=require(_0x6465('0x0'));var moment=require('moment');var BPromise=require(_0x6465('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6465('0x2'));var logger=require('../../config/logger')(_0x6465('0x3'));var config=require(_0x6465('0x4'));var jayson=require(_0x6465('0x5'));var client=jayson[_0x6465('0x6')][_0x6465('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x472863,_0x4b723a,_0x454c40){return new BPromise(function(_0x75133b,_0x5e6a9c){return client[_0x6465('0x8')](_0x472863,_0x454c40)['then'](function(_0x3ca769){logger['info'](_0x6465('0x9'),_0x4b723a,_0x6465('0xa'));logger[_0x6465('0xb')](_0x6465('0xc'),_0x4b723a,_0x6465('0xa'),JSON['stringify'](_0x3ca769));if(_0x3ca769['error']){if(_0x3ca769[_0x6465('0xd')][_0x6465('0xe')]===0x1f4){logger[_0x6465('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x4b723a,_0x3ca769['error'][_0x6465('0xf')]);return _0x5e6a9c(_0x3ca769['error']['message']);}logger[_0x6465('0xd')]('FaxQueueReport,\x20%s,\x20%s',_0x4b723a,_0x3ca769[_0x6465('0xd')][_0x6465('0xf')]);return _0x75133b(_0x3ca769[_0x6465('0xd')][_0x6465('0xf')]);}else{logger['info'](_0x6465('0x9'),_0x4b723a,_0x6465('0xa'));_0x75133b(_0x3ca769[_0x6465('0x10')][_0x6465('0xf')]);}})[_0x6465('0x11')](function(_0x25f58f){logger[_0x6465('0xd')](_0x6465('0x9'),_0x4b723a,_0x25f58f);_0x5e6a9c(_0x25f58f);});});}exports[_0x6465('0x12')]=function(_0x3484f9){var _0x118ac7=this;return new Promise(function(_0x1fc43d,_0x369c67){return db[_0x6465('0x13')][_0x6465('0x14')](_0x3484f9['body'],{'raw':_0x3484f9[_0x6465('0x15')]?_0x3484f9[_0x6465('0x15')][_0x6465('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x519117){logger[_0x6465('0x17')](_0x6465('0x12'),_0x3484f9);logger[_0x6465('0xb')](_0x6465('0x12'),_0x3484f9,JSON[_0x6465('0x18')](_0x519117));_0x1fc43d(_0x519117);})['catch'](function(_0x4ae05d){logger[_0x6465('0xd')](_0x6465('0x12'),_0x4ae05d['message'],_0x3484f9);_0x369c67(_0x118ac7[_0x6465('0xd')](0x1f4,_0x4ae05d[_0x6465('0xf')]));});});};exports['UpdateFaxQueueReport']=function(_0x4bcd78){var _0x1cb357=this;return new Promise(function(_0x770846,_0x545671){return db[_0x6465('0x13')][_0x6465('0x19')](_0x4bcd78[_0x6465('0x1a')],{'raw':_0x4bcd78[_0x6465('0x15')]?_0x4bcd78[_0x6465('0x15')][_0x6465('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bcd78['options']?_0x4bcd78['options'][_0x6465('0x1b')]||null:null,'attributes':_0x4bcd78['options']?_0x4bcd78[_0x6465('0x15')][_0x6465('0x1c')]||null:null,'limit':_0x4bcd78[_0x6465('0x15')]?_0x4bcd78[_0x6465('0x15')]['limit']||null:null})[_0x6465('0x1d')](function(_0x56847e){logger['info'](_0x6465('0x1e'),_0x4bcd78);logger[_0x6465('0xb')](_0x6465('0x1e'),_0x4bcd78,JSON[_0x6465('0x18')](_0x56847e));_0x770846(_0x56847e);})[_0x6465('0x11')](function(_0x1cece0){logger[_0x6465('0xd')](_0x6465('0x1e'),_0x1cece0[_0x6465('0xf')],_0x4bcd78);_0x545671(_0x1cb357[_0x6465('0xd')](0x1f4,_0x1cece0[_0x6465('0xf')]));});});}; \ No newline at end of file +var _0xbb6f=['message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','debug','UpdateFaxQueueReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x9caef7,_0x853269){var _0x1d3cb2=function(_0xcd84be){while(--_0xcd84be){_0x9caef7['push'](_0x9caef7['shift']());}};_0x1d3cb2(++_0x853269);}(_0xbb6f,0x18c));var _0xfbb6=function(_0x581f6f,_0x4e72e4){_0x581f6f=_0x581f6f-0x0;var _0x19eb1e=_0xbb6f[_0x581f6f];return _0x19eb1e;};'use strict';var _=require('lodash');var util=require(_0xfbb6('0x0'));var moment=require(_0xfbb6('0x1'));var BPromise=require(_0xfbb6('0x2'));var rs=require(_0xfbb6('0x3'));var fs=require('fs');var Redis=require(_0xfbb6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbb6('0x5'));var logger=require(_0xfbb6('0x6'))(_0xfbb6('0x7'));var config=require(_0xfbb6('0x8'));var jayson=require(_0xfbb6('0x9'));var client=jayson[_0xfbb6('0xa')][_0xfbb6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x227bc8,_0x2b354a,_0x3ea049){return new BPromise(function(_0x1b2b36,_0x40b9e9){return client[_0xfbb6('0xc')](_0x227bc8,_0x3ea049)['then'](function(_0x72a61e){logger[_0xfbb6('0xd')](_0xfbb6('0xe'),_0x2b354a,'request\x20sent');logger['debug'](_0xfbb6('0xf'),_0x2b354a,_0xfbb6('0x10'),JSON[_0xfbb6('0x11')](_0x72a61e));if(_0x72a61e['error']){if(_0x72a61e[_0xfbb6('0x12')][_0xfbb6('0x13')]===0x1f4){logger[_0xfbb6('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x2b354a,_0x72a61e['error'][_0xfbb6('0x14')]);return _0x40b9e9(_0x72a61e[_0xfbb6('0x12')][_0xfbb6('0x14')]);}logger[_0xfbb6('0x12')](_0xfbb6('0xe'),_0x2b354a,_0x72a61e['error']['message']);return _0x1b2b36(_0x72a61e[_0xfbb6('0x12')][_0xfbb6('0x14')]);}else{logger[_0xfbb6('0xd')](_0xfbb6('0xe'),_0x2b354a,_0xfbb6('0x10'));_0x1b2b36(_0x72a61e[_0xfbb6('0x15')]['message']);}})[_0xfbb6('0x16')](function(_0x484fe6){logger[_0xfbb6('0x12')](_0xfbb6('0xe'),_0x2b354a,_0x484fe6);_0x40b9e9(_0x484fe6);});});}exports[_0xfbb6('0x17')]=function(_0x4277ed){var _0x1408a0=this;return new Promise(function(_0xd27164,_0x3446c4){return db[_0xfbb6('0x18')][_0xfbb6('0x19')](_0x4277ed[_0xfbb6('0x1a')],{'raw':_0x4277ed[_0xfbb6('0x1b')]?_0x4277ed[_0xfbb6('0x1b')][_0xfbb6('0x1c')]===undefined?!![]:![]:!![]})[_0xfbb6('0x1d')](function(_0x4e777c){logger[_0xfbb6('0xd')](_0xfbb6('0x17'),_0x4277ed);logger[_0xfbb6('0x1e')](_0xfbb6('0x17'),_0x4277ed,JSON[_0xfbb6('0x11')](_0x4e777c));_0xd27164(_0x4e777c);})[_0xfbb6('0x16')](function(_0x54954e){logger[_0xfbb6('0x12')](_0xfbb6('0x17'),_0x54954e['message'],_0x4277ed);_0x3446c4(_0x1408a0[_0xfbb6('0x12')](0x1f4,_0x54954e[_0xfbb6('0x14')]));});});};exports[_0xfbb6('0x1f')]=function(_0x1c5e70){var _0x1a3a2d=this;return new Promise(function(_0x2cdc95,_0x58b01e){return db['FaxQueueReport']['update'](_0x1c5e70[_0xfbb6('0x1a')],{'raw':_0x1c5e70[_0xfbb6('0x1b')]?_0x1c5e70[_0xfbb6('0x1b')][_0xfbb6('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c5e70[_0xfbb6('0x1b')]?_0x1c5e70[_0xfbb6('0x1b')]['where']||null:null,'attributes':_0x1c5e70['options']?_0x1c5e70[_0xfbb6('0x1b')]['attributes']||null:null,'limit':_0x1c5e70[_0xfbb6('0x1b')]?_0x1c5e70[_0xfbb6('0x1b')]['limit']||null:null})[_0xfbb6('0x1d')](function(_0x45efcd){logger[_0xfbb6('0xd')](_0xfbb6('0x1f'),_0x1c5e70);logger[_0xfbb6('0x1e')](_0xfbb6('0x1f'),_0x1c5e70,JSON[_0xfbb6('0x11')](_0x45efcd));_0x2cdc95(_0x45efcd);})['catch'](function(_0x597433){logger[_0xfbb6('0x12')](_0xfbb6('0x1f'),_0x597433[_0xfbb6('0x14')],_0x1c5e70);_0x58b01e(_0x1a3a2d[_0xfbb6('0x12')](0x1f4,_0x597433['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index c00037b..81dedfd 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 _0x5234=['Router','../../config/environment','get','index','describe','/:id','isAuthenticated','post','create','delete','destroy','multer','util','path','connect-timeout'];(function(_0x340045,_0x3be566){var _0x4814cd=function(_0x1bf02d){while(--_0x1bf02d){_0x340045['push'](_0x340045['shift']());}};_0x4814cd(++_0x3be566);}(_0x5234,0xce));var _0x4523=function(_0x4d3083,_0x4ab36e){_0x4d3083=_0x4d3083-0x0;var _0x204dc4=_0x5234[_0x4d3083];return _0x204dc4;};'use strict';var multer=require(_0x4523('0x0'));var util=require(_0x4523('0x1'));var path=require(_0x4523('0x2'));var timeout=require(_0x4523('0x3'));var express=require('express');var router=express[_0x4523('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4523('0x5'));var controller=require('./faxQueueReport.controller');router[_0x4523('0x6')]('/',auth['isAuthenticated'](),controller[_0x4523('0x7')]);router[_0x4523('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x4523('0x8')]);router[_0x4523('0x6')](_0x4523('0x9'),auth[_0x4523('0xa')](),controller['show']);router[_0x4523('0xb')]('/',auth['isAuthenticated'](),controller[_0x4523('0xc')]);router['put'](_0x4523('0x9'),auth[_0x4523('0xa')](),controller['update']);router[_0x4523('0xd')](_0x4523('0x9'),auth['isAuthenticated'](),controller[_0x4523('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5ef3=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','put','destroy','multer','util','path','connect-timeout'];(function(_0x22dac7,_0x45d32a){var _0x3e6cfa=function(_0x4c2e9d){while(--_0x4c2e9d){_0x22dac7['push'](_0x22dac7['shift']());}};_0x3e6cfa(++_0x45d32a);}(_0x5ef3,0xf3));var _0x35ef=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x5ef3[_0x19b3f9];return _0x18c3f6;};'use strict';var multer=require(_0x35ef('0x0'));var util=require(_0x35ef('0x1'));var path=require(_0x35ef('0x2'));var timeout=require(_0x35ef('0x3'));var express=require(_0x35ef('0x4'));var router=express['Router']();var fs_extra=require(_0x35ef('0x5'));var auth=require(_0x35ef('0x6'));var interaction=require(_0x35ef('0x7'));var config=require(_0x35ef('0x8'));var controller=require(_0x35ef('0x9'));router[_0x35ef('0xa')]('/',auth[_0x35ef('0xb')](),controller[_0x35ef('0xc')]);router[_0x35ef('0xa')]('/describe',auth[_0x35ef('0xb')](),controller[_0x35ef('0xd')]);router[_0x35ef('0xa')](_0x35ef('0xe'),auth['isAuthenticated'](),controller[_0x35ef('0xf')]);router[_0x35ef('0x10')]('/',auth[_0x35ef('0xb')](),controller['create']);router[_0x35ef('0x11')](_0x35ef('0xe'),auth[_0x35ef('0xb')](),controller['update']);router['delete'](_0x35ef('0xe'),auth[_0x35ef('0xb')](),controller[_0x35ef('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 7613a1c..24ca07a 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x3e49fe,_0x552dba){var _0x150873=function(_0x88c188){while(--_0x88c188){_0x3e49fe['push'](_0x3e49fe['shift']());}};_0x150873(++_0x552dba);}(_0x9c44,0x178));var _0x49c4=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x9c44[_0x2e4aa2];return _0x5e6092;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0xb43b,0x1b2));var _0xbb43=function(_0x32bea2,_0x4b2296){_0x32bea2=_0x32bea2-0x0;var _0xabc06e=_0xb43b[_0x32bea2];return _0xabc06e;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index b2aa749..26e849a 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 _0x2cf6=['where','pick','filter','VIRTUAL','merge','options','findAll','rows','catch','show','params','keys','include','find','create','body','update','describe','rimraf','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','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort'];(function(_0x9b1a81,_0x4e9dfc){var _0x76b7e5=function(_0xc4ebac){while(--_0xc4ebac){_0x9b1a81['push'](_0x9b1a81['shift']());}};_0x76b7e5(++_0x4e9dfc);}(_0x2cf6,0x1a2));var _0x62cf=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x2cf6[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x62cf('0x0'));var zipdir=require(_0x62cf('0x1'));var jsonpatch=require(_0x62cf('0x2'));var rp=require(_0x62cf('0x3'));var moment=require(_0x62cf('0x4'));var BPromise=require(_0x62cf('0x5'));var Mustache=require(_0x62cf('0x6'));var util=require(_0x62cf('0x7'));var path=require(_0x62cf('0x8'));var sox=require(_0x62cf('0x9'));var csv=require(_0x62cf('0xa'));var ejs=require(_0x62cf('0xb'));var fs=require('fs');var fs_extra=require(_0x62cf('0xc'));var _=require(_0x62cf('0xd'));var squel=require(_0x62cf('0xe'));var crypto=require('crypto');var jsforce=require(_0x62cf('0xf'));var deskjs=require(_0x62cf('0x10'));var toCsv=require(_0x62cf('0xa'));var querystring=require(_0x62cf('0x11'));var Papa=require(_0x62cf('0x12'));var Redis=require(_0x62cf('0x13'));var authService=require(_0x62cf('0x14'));var qs=require(_0x62cf('0x15'));var as=require(_0x62cf('0x16'));var hardwareService=require(_0x62cf('0x17'));var logger=require(_0x62cf('0x18'))(_0x62cf('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x62cf('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x36b03a,_0x403037){_0x403037=_0x403037||0xcc;return function(_0x5a60f8){if(_0x5a60f8){return _0x36b03a[_0x62cf('0x1b')](_0x403037);}return _0x36b03a[_0x62cf('0x1c')](_0x403037)[_0x62cf('0x1d')]();};}function respondWithResult(_0x1e17c2,_0x3ccaee){_0x3ccaee=_0x3ccaee||0xc8;return function(_0x23b371){if(_0x23b371){return _0x1e17c2[_0x62cf('0x1c')](_0x3ccaee)[_0x62cf('0x1e')](_0x23b371);}};}function respondWithFilteredResult(_0x1e3215,_0x53473f){return function(_0xe9aaae){if(_0xe9aaae){var _0x317ad0=typeof _0x53473f[_0x62cf('0x1f')]===_0x62cf('0x20')&&typeof _0x53473f[_0x62cf('0x21')]===_0x62cf('0x20');var _0x32cf10=_0xe9aaae[_0x62cf('0x22')];var _0x407925=_0x317ad0?0x0:_0x53473f[_0x62cf('0x1f')];var _0x4819d6=_0x317ad0?_0xe9aaae[_0x62cf('0x22')]:_0x53473f[_0x62cf('0x1f')]+_0x53473f[_0x62cf('0x21')];var _0x24b7c2;if(_0x4819d6>=_0x32cf10){_0x4819d6=_0x32cf10;_0x24b7c2=0xc8;}else{_0x24b7c2=0xce;}_0x1e3215['status'](_0x24b7c2);return _0x1e3215[_0x62cf('0x23')](_0x62cf('0x24'),_0x407925+'-'+_0x4819d6+'/'+_0x32cf10)[_0x62cf('0x1e')](_0xe9aaae);}return null;};}function patchUpdates(_0x56a478){return function(_0x22f112){try{jsonpatch[_0x62cf('0x25')](_0x22f112,_0x56a478,!![]);}catch(_0x170960){return BPromise[_0x62cf('0x26')](_0x170960);}return _0x22f112[_0x62cf('0x27')]();};}function saveUpdates(_0x5bb168,_0x2217e9){return function(_0x323e6b){if(_0x323e6b){return _0x323e6b['update'](_0x5bb168)['then'](function(_0x8492d0){return _0x8492d0;});}return null;};}function removeEntity(_0x3693c5,_0x2622e5){return function(_0x142fdb){if(_0x142fdb){return _0x142fdb[_0x62cf('0x28')]()[_0x62cf('0x29')](function(){_0x3693c5[_0x62cf('0x1c')](0xcc)[_0x62cf('0x1d')]();});}};}function handleEntityNotFound(_0x5ec458,_0x8865b7){return function(_0x360d1c){if(!_0x360d1c){_0x5ec458[_0x62cf('0x1b')](0x194);}return _0x360d1c;};}function handleError(_0x274015,_0xc1054d){_0xc1054d=_0xc1054d||0x1f4;return function(_0x3e4c8c){logger[_0x62cf('0x2a')](_0x3e4c8c['stack']);if(_0x3e4c8c['name']){delete _0x3e4c8c[_0x62cf('0x2b')];}_0x274015['status'](_0xc1054d)[_0x62cf('0x2c')](_0x3e4c8c);};}exports[_0x62cf('0x2d')]=function(_0x3a7394,_0x3a80cf){var _0x28f98e={},_0x53fa6e={},_0x3c61e5={'count':0x0,'rows':[]};var _0x5a970c=_[_0x62cf('0x2e')](db[_0x62cf('0x2f')][_0x62cf('0x30')],function(_0x537355){return{'name':_0x537355[_0x62cf('0x31')],'type':_0x537355[_0x62cf('0x32')][_0x62cf('0x33')]};});_0x53fa6e[_0x62cf('0x34')]=_[_0x62cf('0x2e')](_0x5a970c,_0x62cf('0x2b'));_0x53fa6e[_0x62cf('0x35')]=_['keys'](_0x3a7394[_0x62cf('0x35')]);_0x53fa6e[_0x62cf('0x36')]=_[_0x62cf('0x37')](_0x53fa6e[_0x62cf('0x34')],_0x53fa6e['query']);_0x28f98e['attributes']=_['intersection'](_0x53fa6e[_0x62cf('0x34')],qs[_0x62cf('0x38')](_0x3a7394[_0x62cf('0x35')][_0x62cf('0x38')]));_0x28f98e[_0x62cf('0x39')]=_0x28f98e['attributes'][_0x62cf('0x3a')]?_0x28f98e['attributes']:_0x53fa6e[_0x62cf('0x34')];if(!_0x3a7394['query'][_0x62cf('0x3b')](_0x62cf('0x3c'))){_0x28f98e['limit']=qs[_0x62cf('0x21')](_0x3a7394['query'][_0x62cf('0x21')]);_0x28f98e['offset']=qs['offset'](_0x3a7394['query'][_0x62cf('0x1f')]);}_0x28f98e['order']=qs[_0x62cf('0x3d')](_0x3a7394['query'][_0x62cf('0x3d')]);_0x28f98e[_0x62cf('0x3e')]=qs[_0x62cf('0x36')](_[_0x62cf('0x3f')](_0x3a7394[_0x62cf('0x35')],_0x53fa6e['filters']),_0x5a970c);if(_0x3a7394[_0x62cf('0x35')][_0x62cf('0x40')]){_0x28f98e[_0x62cf('0x3e')]=_['merge'](_0x28f98e['where'],{'$or':_[_0x62cf('0x2e')](_0x5a970c,function(_0x30c763){if(_0x30c763[_0x62cf('0x32')]!==_0x62cf('0x41')){var _0x1b7d3e={};_0x1b7d3e[_0x30c763['name']]={'$like':'%'+_0x3a7394['query'][_0x62cf('0x40')]+'%'};return _0x1b7d3e;}})});}_0x28f98e=_[_0x62cf('0x42')]({},_0x28f98e,_0x3a7394[_0x62cf('0x43')]);var _0x5e315b={'where':_0x28f98e[_0x62cf('0x3e')]};return db[_0x62cf('0x2f')][_0x62cf('0x22')](_0x5e315b)['then'](function(_0x2316e8){_0x3c61e5[_0x62cf('0x22')]=_0x2316e8;if(_0x3a7394[_0x62cf('0x35')]['includeAll']){_0x28f98e['include']=[{'all':!![]}];}return db[_0x62cf('0x2f')][_0x62cf('0x44')](_0x28f98e);})[_0x62cf('0x29')](function(_0x5ce12e){_0x3c61e5[_0x62cf('0x45')]=_0x5ce12e;return _0x3c61e5;})[_0x62cf('0x29')](respondWithFilteredResult(_0x3a80cf,_0x28f98e))[_0x62cf('0x46')](handleError(_0x3a80cf,null));};exports[_0x62cf('0x47')]=function(_0x10575d,_0x406b1f){var _0x14f9de={'raw':!![],'where':{'id':_0x10575d[_0x62cf('0x48')]['id']}},_0x1ed8d3={};_0x1ed8d3[_0x62cf('0x34')]=_[_0x62cf('0x49')](db[_0x62cf('0x2f')][_0x62cf('0x30')]);_0x1ed8d3[_0x62cf('0x35')]=_[_0x62cf('0x49')](_0x10575d[_0x62cf('0x35')]);_0x1ed8d3[_0x62cf('0x36')]=_['intersection'](_0x1ed8d3[_0x62cf('0x34')],_0x1ed8d3[_0x62cf('0x35')]);_0x14f9de['attributes']=_[_0x62cf('0x37')](_0x1ed8d3[_0x62cf('0x34')],qs[_0x62cf('0x38')](_0x10575d['query'][_0x62cf('0x38')]));_0x14f9de['attributes']=_0x14f9de[_0x62cf('0x39')]['length']?_0x14f9de[_0x62cf('0x39')]:_0x1ed8d3[_0x62cf('0x34')];if(_0x10575d[_0x62cf('0x35')]['includeAll']){_0x14f9de[_0x62cf('0x4a')]=[{'all':!![]}];}_0x14f9de=_['merge']({},_0x14f9de,_0x10575d[_0x62cf('0x43')]);return db[_0x62cf('0x2f')][_0x62cf('0x4b')](_0x14f9de)[_0x62cf('0x29')](handleEntityNotFound(_0x406b1f,null))[_0x62cf('0x29')](respondWithResult(_0x406b1f,null))[_0x62cf('0x46')](handleError(_0x406b1f,null));};exports[_0x62cf('0x4c')]=function(_0x42e678,_0x262d23){return db[_0x62cf('0x2f')][_0x62cf('0x4c')](_0x42e678[_0x62cf('0x4d')],{})[_0x62cf('0x29')](respondWithResult(_0x262d23,0xc9))[_0x62cf('0x46')](handleError(_0x262d23,null));};exports[_0x62cf('0x4e')]=function(_0x134599,_0x5d84c1){if(_0x134599[_0x62cf('0x4d')]['id']){delete _0x134599[_0x62cf('0x4d')]['id'];}return db[_0x62cf('0x2f')][_0x62cf('0x4b')]({'where':{'id':_0x134599[_0x62cf('0x48')]['id']}})[_0x62cf('0x29')](handleEntityNotFound(_0x5d84c1,null))[_0x62cf('0x29')](saveUpdates(_0x134599[_0x62cf('0x4d')],null))['then'](respondWithResult(_0x5d84c1,null))[_0x62cf('0x46')](handleError(_0x5d84c1,null));};exports[_0x62cf('0x28')]=function(_0x4bbe05,_0x34231b){return db[_0x62cf('0x2f')]['find']({'where':{'id':_0x4bbe05[_0x62cf('0x48')]['id']}})[_0x62cf('0x29')](handleEntityNotFound(_0x34231b,null))[_0x62cf('0x29')](removeEntity(_0x34231b,null))[_0x62cf('0x46')](handleError(_0x34231b,null));};exports[_0x62cf('0x4f')]=function(_0x397cd2,_0x3ade8d){return db[_0x62cf('0x2f')][_0x62cf('0x4f')]()['then'](respondWithResult(_0x3ade8d,null))[_0x62cf('0x46')](handleError(_0x3ade8d,null));}; \ No newline at end of file +var _0xa897=['set','reject','save','update','destroy','then','end','error','name','send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x1ee62e,_0x159bb2){var _0x27c6c8=function(_0x31a5d4){while(--_0x31a5d4){_0x1ee62e['push'](_0x1ee62e['shift']());}};_0x27c6c8(++_0x159bb2);}(_0xa897,0x7b));var _0x7a89=function(_0x112054,_0x30dc9a){_0x112054=_0x112054-0x0;var _0x267be5=_0xa897[_0x112054];return _0x267be5;};'use strict';var emlformat=require(_0x7a89('0x0'));var rimraf=require(_0x7a89('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a89('0x2'));var rp=require(_0x7a89('0x3'));var moment=require(_0x7a89('0x4'));var BPromise=require(_0x7a89('0x5'));var Mustache=require(_0x7a89('0x6'));var util=require(_0x7a89('0x7'));var path=require(_0x7a89('0x8'));var sox=require('sox');var csv=require(_0x7a89('0x9'));var ejs=require(_0x7a89('0xa'));var fs=require('fs');var fs_extra=require(_0x7a89('0xb'));var _=require(_0x7a89('0xc'));var squel=require(_0x7a89('0xd'));var crypto=require(_0x7a89('0xe'));var jsforce=require(_0x7a89('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7a89('0x10'));var Papa=require('papaparse');var Redis=require(_0x7a89('0x11'));var authService=require(_0x7a89('0x12'));var qs=require(_0x7a89('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a89('0x14'));var logger=require(_0x7a89('0x15'))(_0x7a89('0x16'));var utils=require(_0x7a89('0x17'));var config=require(_0x7a89('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a89('0x19'))['db'];function respondWithStatusCode(_0x207288,_0x286a75){_0x286a75=_0x286a75||0xcc;return function(_0x1e35f7){if(_0x1e35f7){return _0x207288[_0x7a89('0x1a')](_0x286a75);}return _0x207288[_0x7a89('0x1b')](_0x286a75)['end']();};}function respondWithResult(_0x48661d,_0x47e695){_0x47e695=_0x47e695||0xc8;return function(_0x121d15){if(_0x121d15){return _0x48661d[_0x7a89('0x1b')](_0x47e695)[_0x7a89('0x1c')](_0x121d15);}};}function respondWithFilteredResult(_0x37f4af,_0x329c4c){return function(_0x26a5a1){if(_0x26a5a1){var _0x56a7f5=typeof _0x329c4c[_0x7a89('0x1d')]===_0x7a89('0x1e')&&typeof _0x329c4c[_0x7a89('0x1f')]===_0x7a89('0x1e');var _0x153c29=_0x26a5a1['count'];var _0x378d4a=_0x56a7f5?0x0:_0x329c4c[_0x7a89('0x1d')];var _0xd83de8=_0x56a7f5?_0x26a5a1[_0x7a89('0x20')]:_0x329c4c[_0x7a89('0x1d')]+_0x329c4c[_0x7a89('0x1f')];var _0x342fd7;if(_0xd83de8>=_0x153c29){_0xd83de8=_0x153c29;_0x342fd7=0xc8;}else{_0x342fd7=0xce;}_0x37f4af['status'](_0x342fd7);return _0x37f4af[_0x7a89('0x21')]('Content-Range',_0x378d4a+'-'+_0xd83de8+'/'+_0x153c29)[_0x7a89('0x1c')](_0x26a5a1);}return null;};}function patchUpdates(_0x4e3418){return function(_0x3c502e){try{jsonpatch['apply'](_0x3c502e,_0x4e3418,!![]);}catch(_0x163768){return BPromise[_0x7a89('0x22')](_0x163768);}return _0x3c502e[_0x7a89('0x23')]();};}function saveUpdates(_0x5eb5fa,_0x2f855d){return function(_0x28435c){if(_0x28435c){return _0x28435c[_0x7a89('0x24')](_0x5eb5fa)['then'](function(_0x3bc90d){return _0x3bc90d;});}return null;};}function removeEntity(_0x107f3b,_0x527a0d){return function(_0x30dcd0){if(_0x30dcd0){return _0x30dcd0[_0x7a89('0x25')]()[_0x7a89('0x26')](function(){_0x107f3b[_0x7a89('0x1b')](0xcc)[_0x7a89('0x27')]();});}};}function handleEntityNotFound(_0x5bc523,_0x1493ec){return function(_0x11f37a){if(!_0x11f37a){_0x5bc523[_0x7a89('0x1a')](0x194);}return _0x11f37a;};}function handleError(_0x34c87d,_0x1d87cd){_0x1d87cd=_0x1d87cd||0x1f4;return function(_0x1f1645){logger[_0x7a89('0x28')](_0x1f1645['stack']);if(_0x1f1645['name']){delete _0x1f1645[_0x7a89('0x29')];}_0x34c87d['status'](_0x1d87cd)[_0x7a89('0x2a')](_0x1f1645);};}exports[_0x7a89('0x2b')]=function(_0x3d7163,_0x368123){var _0x989998={},_0x5ef04e={},_0x16510e={'count':0x0,'rows':[]};var _0x4d009c=_[_0x7a89('0x2c')](db[_0x7a89('0x2d')][_0x7a89('0x2e')],function(_0x216028){return{'name':_0x216028[_0x7a89('0x2f')],'type':_0x216028[_0x7a89('0x30')][_0x7a89('0x31')]};});_0x5ef04e[_0x7a89('0x32')]=_['map'](_0x4d009c,'name');_0x5ef04e[_0x7a89('0x33')]=_[_0x7a89('0x34')](_0x3d7163[_0x7a89('0x33')]);_0x5ef04e[_0x7a89('0x35')]=_[_0x7a89('0x36')](_0x5ef04e[_0x7a89('0x32')],_0x5ef04e[_0x7a89('0x33')]);_0x989998[_0x7a89('0x37')]=_['intersection'](_0x5ef04e[_0x7a89('0x32')],qs[_0x7a89('0x38')](_0x3d7163[_0x7a89('0x33')][_0x7a89('0x38')]));_0x989998[_0x7a89('0x37')]=_0x989998['attributes'][_0x7a89('0x39')]?_0x989998[_0x7a89('0x37')]:_0x5ef04e[_0x7a89('0x32')];if(!_0x3d7163[_0x7a89('0x33')][_0x7a89('0x3a')](_0x7a89('0x3b'))){_0x989998[_0x7a89('0x1f')]=qs[_0x7a89('0x1f')](_0x3d7163['query'][_0x7a89('0x1f')]);_0x989998['offset']=qs[_0x7a89('0x1d')](_0x3d7163[_0x7a89('0x33')][_0x7a89('0x1d')]);}_0x989998[_0x7a89('0x3c')]=qs[_0x7a89('0x3d')](_0x3d7163[_0x7a89('0x33')]['sort']);_0x989998[_0x7a89('0x3e')]=qs['filters'](_[_0x7a89('0x3f')](_0x3d7163['query'],_0x5ef04e[_0x7a89('0x35')]),_0x4d009c);if(_0x3d7163[_0x7a89('0x33')][_0x7a89('0x40')]){_0x989998[_0x7a89('0x3e')]=_[_0x7a89('0x41')](_0x989998[_0x7a89('0x3e')],{'$or':_['map'](_0x4d009c,function(_0x42009c){if(_0x42009c['type']!==_0x7a89('0x42')){var _0x269e0a={};_0x269e0a[_0x42009c[_0x7a89('0x29')]]={'$like':'%'+_0x3d7163[_0x7a89('0x33')][_0x7a89('0x40')]+'%'};return _0x269e0a;}})});}_0x989998=_[_0x7a89('0x41')]({},_0x989998,_0x3d7163[_0x7a89('0x43')]);var _0x2a819f={'where':_0x989998['where']};return db[_0x7a89('0x2d')]['count'](_0x2a819f)[_0x7a89('0x26')](function(_0x2f9e47){_0x16510e[_0x7a89('0x20')]=_0x2f9e47;if(_0x3d7163[_0x7a89('0x33')]['includeAll']){_0x989998['include']=[{'all':!![]}];}return db[_0x7a89('0x2d')][_0x7a89('0x44')](_0x989998);})[_0x7a89('0x26')](function(_0x560ad7){_0x16510e[_0x7a89('0x45')]=_0x560ad7;return _0x16510e;})[_0x7a89('0x26')](respondWithFilteredResult(_0x368123,_0x989998))[_0x7a89('0x46')](handleError(_0x368123,null));};exports[_0x7a89('0x47')]=function(_0x1b2796,_0x4b603b){var _0x3c3677={'raw':!![],'where':{'id':_0x1b2796['params']['id']}},_0x20b9e0={};_0x20b9e0[_0x7a89('0x32')]=_['keys'](db[_0x7a89('0x2d')]['rawAttributes']);_0x20b9e0['query']=_[_0x7a89('0x34')](_0x1b2796['query']);_0x20b9e0[_0x7a89('0x35')]=_['intersection'](_0x20b9e0[_0x7a89('0x32')],_0x20b9e0[_0x7a89('0x33')]);_0x3c3677[_0x7a89('0x37')]=_['intersection'](_0x20b9e0[_0x7a89('0x32')],qs[_0x7a89('0x38')](_0x1b2796[_0x7a89('0x33')][_0x7a89('0x38')]));_0x3c3677[_0x7a89('0x37')]=_0x3c3677[_0x7a89('0x37')][_0x7a89('0x39')]?_0x3c3677[_0x7a89('0x37')]:_0x20b9e0[_0x7a89('0x32')];if(_0x1b2796['query'][_0x7a89('0x48')]){_0x3c3677['include']=[{'all':!![]}];}_0x3c3677=_[_0x7a89('0x41')]({},_0x3c3677,_0x1b2796[_0x7a89('0x43')]);return db[_0x7a89('0x2d')][_0x7a89('0x49')](_0x3c3677)['then'](handleEntityNotFound(_0x4b603b,null))[_0x7a89('0x26')](respondWithResult(_0x4b603b,null))[_0x7a89('0x46')](handleError(_0x4b603b,null));};exports[_0x7a89('0x4a')]=function(_0x4221e4,_0x429779){return db[_0x7a89('0x2d')][_0x7a89('0x4a')](_0x4221e4['body'],{})[_0x7a89('0x26')](respondWithResult(_0x429779,0xc9))[_0x7a89('0x46')](handleError(_0x429779,null));};exports['update']=function(_0x18e6e5,_0xdd1090){if(_0x18e6e5[_0x7a89('0x4b')]['id']){delete _0x18e6e5[_0x7a89('0x4b')]['id'];}return db['FaxTransferReport'][_0x7a89('0x49')]({'where':{'id':_0x18e6e5[_0x7a89('0x4c')]['id']}})[_0x7a89('0x26')](handleEntityNotFound(_0xdd1090,null))[_0x7a89('0x26')](saveUpdates(_0x18e6e5['body'],null))[_0x7a89('0x26')](respondWithResult(_0xdd1090,null))[_0x7a89('0x46')](handleError(_0xdd1090,null));};exports[_0x7a89('0x25')]=function(_0x37ac9f,_0xc75746){return db[_0x7a89('0x2d')][_0x7a89('0x49')]({'where':{'id':_0x37ac9f[_0x7a89('0x4c')]['id']}})[_0x7a89('0x26')](handleEntityNotFound(_0xc75746,null))[_0x7a89('0x26')](removeEntity(_0xc75746,null))['catch'](handleError(_0xc75746,null));};exports[_0x7a89('0x4d')]=function(_0x10c189,_0x20ada6){return db[_0x7a89('0x2d')]['describe']()[_0x7a89('0x26')](respondWithResult(_0x20ada6,null))[_0x7a89('0x46')](handleError(_0x20ada6,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2195eab..722182e 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 _0x3e82=['request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x36c7ba,_0x58b215){var _0x1a9b22=function(_0x5d8ecc){while(--_0x5d8ecc){_0x36c7ba['push'](_0x36c7ba['shift']());}};_0x1a9b22(++_0x58b215);}(_0x3e82,0x18a));var _0x23e8=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x3e82[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x23e8('0x0'));var util=require(_0x23e8('0x1'));var logger=require(_0x23e8('0x2'))(_0x23e8('0x3'));var moment=require(_0x23e8('0x4'));var BPromise=require(_0x23e8('0x5'));var rp=require(_0x23e8('0x6'));var fs=require('fs');var path=require(_0x23e8('0x7'));var rimraf=require(_0x23e8('0x8'));var config=require(_0x23e8('0x9'));var attributes=require(_0x23e8('0xa'));module[_0x23e8('0xb')]=function(_0x2da65f,_0x5742ac){return _0x2da65f[_0x23e8('0xc')](_0x23e8('0xd'),attributes,{'tableName':_0x23e8('0xe'),'paranoid':![],'indexes':[{'name':_0x23e8('0xf'),'fields':[_0x23e8('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc3=['bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','util','api'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x1cc3,0x11b));var _0x31cc=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1cc3[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x31cc('0x0'));var util=require(_0x31cc('0x1'));var logger=require('../../config/logger')(_0x31cc('0x2'));var moment=require('moment');var BPromise=require(_0x31cc('0x3'));var rp=require(_0x31cc('0x4'));var fs=require('fs');var path=require(_0x31cc('0x5'));var rimraf=require('rimraf');var config=require(_0x31cc('0x6'));var attributes=require(_0x31cc('0x7'));module[_0x31cc('0x8')]=function(_0x541da0,_0xc7ae44){return _0x541da0[_0x31cc('0x9')](_0x31cc('0xa'),attributes,{'tableName':_0x31cc('0xb'),'paranoid':![],'indexes':[{'name':_0x31cc('0xc'),'fields':[_0x31cc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 5380691..e79e1c3 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 _0x2a6b=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x2a6b,0x83));var _0xb2a6=function(_0x4e80e8,_0x1e6ee6){_0x4e80e8=_0x4e80e8-0x0;var _0x2b5b45=_0x2a6b[_0x4e80e8];return _0x2b5b45;};'use strict';var _=require('lodash');var util=require(_0xb2a6('0x0'));var moment=require(_0xb2a6('0x1'));var BPromise=require(_0xb2a6('0x2'));var rs=require(_0xb2a6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb2a6('0x4'))['db'];var utils=require(_0xb2a6('0x5'));var logger=require(_0xb2a6('0x6'))(_0xb2a6('0x7'));var config=require(_0xb2a6('0x8'));var jayson=require(_0xb2a6('0x9'));var client=jayson[_0xb2a6('0xa')][_0xb2a6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d67d8,_0x218e48,_0x32af93){return new BPromise(function(_0x18ad75,_0x3c5c04){return client[_0xb2a6('0xc')](_0x4d67d8,_0x32af93)[_0xb2a6('0xd')](function(_0x3fede8){logger[_0xb2a6('0xe')](_0xb2a6('0xf'),_0x218e48,_0xb2a6('0x10'));logger[_0xb2a6('0x11')](_0xb2a6('0x12'),_0x218e48,_0xb2a6('0x10'),JSON['stringify'](_0x3fede8));if(_0x3fede8['error']){if(_0x3fede8[_0xb2a6('0x13')]['code']===0x1f4){logger[_0xb2a6('0x13')](_0xb2a6('0xf'),_0x218e48,_0x3fede8[_0xb2a6('0x13')][_0xb2a6('0x14')]);return _0x3c5c04(_0x3fede8[_0xb2a6('0x13')]['message']);}logger[_0xb2a6('0x13')](_0xb2a6('0xf'),_0x218e48,_0x3fede8[_0xb2a6('0x13')][_0xb2a6('0x14')]);return _0x18ad75(_0x3fede8['error'][_0xb2a6('0x14')]);}else{logger[_0xb2a6('0xe')](_0xb2a6('0xf'),_0x218e48,_0xb2a6('0x10'));_0x18ad75(_0x3fede8[_0xb2a6('0x15')][_0xb2a6('0x14')]);}})[_0xb2a6('0x16')](function(_0x1fed5f){logger['error'](_0xb2a6('0xf'),_0x218e48,_0x1fed5f);_0x3c5c04(_0x1fed5f);});});} \ No newline at end of file +var _0xce6e=['info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xce6e,0x1c2));var _0xece6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xce6e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xece6('0x0'));var util=require(_0xece6('0x1'));var moment=require(_0xece6('0x2'));var BPromise=require(_0xece6('0x3'));var rs=require(_0xece6('0x4'));var fs=require('fs');var Redis=require(_0xece6('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xece6('0x6'))(_0xece6('0x7'));var config=require('../../config/environment');var jayson=require(_0xece6('0x8'));var client=jayson[_0xece6('0x9')][_0xece6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x292374,_0x1b2e7a,_0x514211){return new BPromise(function(_0x5b19a4,_0x5818c2){return client[_0xece6('0xb')](_0x292374,_0x514211)['then'](function(_0x34c66e){logger[_0xece6('0xc')](_0xece6('0xd'),_0x1b2e7a,_0xece6('0xe'));logger[_0xece6('0xf')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x1b2e7a,_0xece6('0xe'),JSON[_0xece6('0x10')](_0x34c66e));if(_0x34c66e[_0xece6('0x11')]){if(_0x34c66e[_0xece6('0x11')][_0xece6('0x12')]===0x1f4){logger[_0xece6('0x11')](_0xece6('0xd'),_0x1b2e7a,_0x34c66e[_0xece6('0x11')][_0xece6('0x13')]);return _0x5818c2(_0x34c66e[_0xece6('0x11')][_0xece6('0x13')]);}logger[_0xece6('0x11')](_0xece6('0xd'),_0x1b2e7a,_0x34c66e[_0xece6('0x11')][_0xece6('0x13')]);return _0x5b19a4(_0x34c66e[_0xece6('0x11')]['message']);}else{logger[_0xece6('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x1b2e7a,_0xece6('0xe'));_0x5b19a4(_0x34c66e[_0xece6('0x14')][_0xece6('0x13')]);}})['catch'](function(_0x322674){logger[_0xece6('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x1b2e7a,_0x322674);_0x5818c2(_0x322674);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 81c5de6..e548e8f 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 _0xad10=['isAuthenticated','index','get','/describe','/:id','create','put','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller'];(function(_0x1f244d,_0x19e830){var _0x16003a=function(_0x1ee3f3){while(--_0x1ee3f3){_0x1f244d['push'](_0x1f244d['shift']());}};_0x16003a(++_0x19e830);}(_0xad10,0x75));var _0x0ad1=function(_0x353c9c,_0x1e8bce){_0x353c9c=_0x353c9c-0x0;var _0x503654=_0xad10[_0x353c9c];return _0x503654;};'use strict';var multer=require(_0x0ad1('0x0'));var util=require('util');var path=require(_0x0ad1('0x1'));var timeout=require(_0x0ad1('0x2'));var express=require(_0x0ad1('0x3'));var router=express[_0x0ad1('0x4')]();var fs_extra=require(_0x0ad1('0x5'));var auth=require(_0x0ad1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0ad1('0x7'));var controller=require(_0x0ad1('0x8'));router['get']('/',auth[_0x0ad1('0x9')](),controller[_0x0ad1('0xa')]);router[_0x0ad1('0xb')](_0x0ad1('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0ad1('0xb')](_0x0ad1('0xd'),auth[_0x0ad1('0x9')](),controller['show']);router['post']('/',auth[_0x0ad1('0x9')](),controller[_0x0ad1('0xe')]);router[_0x0ad1('0xf')](_0x0ad1('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0ad1('0xd'),auth[_0x0ad1('0x9')](),controller[_0x0ad1('0x10')]);module[_0x0ad1('0x11')]=router; \ No newline at end of file +var _0xf1ae=['create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','/describe','get','post'];(function(_0x63a3c4,_0x1bef2e){var _0x7fa2b0=function(_0x1131d9){while(--_0x1131d9){_0x63a3c4['push'](_0x63a3c4['shift']());}};_0x7fa2b0(++_0x1bef2e);}(_0xf1ae,0x73));var _0xef1a=function(_0x415472,_0x247455){_0x415472=_0x415472-0x0;var _0x45510c=_0xf1ae[_0x415472];return _0x45510c;};'use strict';var multer=require(_0xef1a('0x0'));var util=require(_0xef1a('0x1'));var path=require(_0xef1a('0x2'));var timeout=require(_0xef1a('0x3'));var express=require('express');var router=express[_0xef1a('0x4')]();var fs_extra=require(_0xef1a('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xef1a('0x6'));var controller=require('./faxTransferReport.controller');router['get']('/',auth[_0xef1a('0x7')](),controller['index']);router['get'](_0xef1a('0x8'),auth[_0xef1a('0x7')](),controller['describe']);router[_0xef1a('0x9')]('/:id',auth[_0xef1a('0x7')](),controller['show']);router[_0xef1a('0xa')]('/',auth[_0xef1a('0x7')](),controller[_0xef1a('0xb')]);router[_0xef1a('0xc')](_0xef1a('0xd'),auth[_0xef1a('0x7')](),controller[_0xef1a('0xe')]);router[_0xef1a('0xf')]('/:id',auth[_0xef1a('0x7')](),controller[_0xef1a('0x10')]);module[_0xef1a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 879a4d5..9403e11 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 _0x33fd=['../../components/interaction/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x36f243,_0x188505){var _0x426436=function(_0x1c8622){while(--_0x1c8622){_0x36f243['push'](_0x36f243['shift']());}};_0x426436(++_0x188505);}(_0x33fd,0xb7));var _0xd33f=function(_0x22ac70,_0x2f460f){_0x22ac70=_0x22ac70-0x0;var _0x280358=_0x33fd[_0x22ac70];return _0x280358;};'use strict';var multer=require(_0xd33f('0x0'));var util=require(_0xd33f('0x1'));var path=require(_0xd33f('0x2'));var timeout=require(_0xd33f('0x3'));var express=require(_0xd33f('0x4'));var router=express[_0xd33f('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd33f('0x6'));var config=require(_0xd33f('0x7'));var controller=require(_0xd33f('0x8'));router[_0xd33f('0x9')]('/',auth[_0xd33f('0xa')](),controller['index']);router[_0xd33f('0x9')](_0xd33f('0xb'),auth[_0xd33f('0xa')](),controller[_0xd33f('0xc')]);router[_0xd33f('0x9')](_0xd33f('0xd'),auth['isAuthenticated'](),controller[_0xd33f('0xe')]);router[_0xd33f('0x9')](_0xd33f('0xf'),auth['isAuthenticated'](),controller[_0xd33f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xd33f('0x11')]('/:id/configurations',auth[_0xd33f('0xa')](),controller[_0xd33f('0x12')]);router['put'](_0xd33f('0xb'),auth[_0xd33f('0xa')](),controller['update']);router[_0xd33f('0x13')](_0xd33f('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd33f('0x14')]=router; \ No newline at end of file +var _0x9b54=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskAccount.controller','isAuthenticated','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration'];(function(_0x2772e4,_0x148482){var _0x5cc2c0=function(_0x557a7f){while(--_0x557a7f){_0x2772e4['push'](_0x2772e4['shift']());}};_0x5cc2c0(++_0x148482);}(_0x9b54,0xb4));var _0x49b5=function(_0x455b03,_0x331322){_0x455b03=_0x455b03-0x0;var _0x59344d=_0x9b54[_0x455b03];return _0x59344d;};'use strict';var multer=require(_0x49b5('0x0'));var util=require('util');var path=require(_0x49b5('0x1'));var timeout=require(_0x49b5('0x2'));var express=require(_0x49b5('0x3'));var router=express[_0x49b5('0x4')]();var fs_extra=require(_0x49b5('0x5'));var auth=require(_0x49b5('0x6'));var interaction=require(_0x49b5('0x7'));var config=require('../../config/environment');var controller=require(_0x49b5('0x8'));router['get']('/',auth[_0x49b5('0x9')](),controller['index']);router[_0x49b5('0xa')](_0x49b5('0xb'),auth['isAuthenticated'](),controller[_0x49b5('0xc')]);router[_0x49b5('0xa')](_0x49b5('0xd'),auth[_0x49b5('0x9')](),controller[_0x49b5('0xe')]);router[_0x49b5('0xa')](_0x49b5('0xf'),auth[_0x49b5('0x9')](),controller[_0x49b5('0x10')]);router[_0x49b5('0x11')]('/',auth[_0x49b5('0x9')](),controller[_0x49b5('0x12')]);router[_0x49b5('0x11')]('/:id/configurations',auth[_0x49b5('0x9')](),controller[_0x49b5('0x13')]);router[_0x49b5('0x14')]('/:id',auth[_0x49b5('0x9')](),controller[_0x49b5('0x15')]);router[_0x49b5('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x49b5('0x17')]);module[_0x49b5('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 5f04d81..beac76a 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 _0x5cfe=['newTab','exports','STRING','ENUM','basic','integrationTab'];(function(_0x2108d1,_0x58f8d9){var _0x171cff=function(_0x2e45ed){while(--_0x2e45ed){_0x2108d1['push'](_0x2108d1['shift']());}};_0x171cff(++_0x58f8d9);}(_0x5cfe,0x10f));var _0xe5cf=function(_0x208bf0,_0x24abcc){_0x208bf0=_0x208bf0-0x0;var _0x4e554e=_0x5cfe[_0x208bf0];return _0x4e554e;};'use strict';var Sequelize=require('sequelize');module[_0xe5cf('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe5cf('0x1')]},'username':{'type':Sequelize[_0xe5cf('0x1')]},'remoteUri':{'type':Sequelize[_0xe5cf('0x1')]},'authType':{'type':Sequelize[_0xe5cf('0x2')](_0xe5cf('0x3')),'defaultValue':_0xe5cf('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xe5cf('0x1')]},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe5cf('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe5cf('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe5cf('0x2')](_0xe5cf('0x4'),_0xe5cf('0x5')),'defaultValue':_0xe5cf('0x4')}}; \ No newline at end of file +var _0x484b=['STRING','ENUM','basic','integrationTab','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x484b,0x9f));var _0xb484=function(_0x38f9c7,_0x245fa2){_0x38f9c7=_0x38f9c7-0x0;var _0x5e2638=_0x484b[_0x38f9c7];return _0x5e2638;};'use strict';var Sequelize=require(_0xb484('0x0'));module['exports']={'name':{'type':Sequelize[_0xb484('0x1')]},'description':{'type':Sequelize[_0xb484('0x1')]},'username':{'type':Sequelize[_0xb484('0x1')]},'remoteUri':{'type':Sequelize[_0xb484('0x1')]},'authType':{'type':Sequelize[_0xb484('0x2')]('basic'),'defaultValue':_0xb484('0x3')},'password':{'type':Sequelize[_0xb484('0x1')]},'consumerKey':{'type':Sequelize[_0xb484('0x1')]},'consumerSecret':{'type':Sequelize[_0xb484('0x1')]},'token':{'type':Sequelize[_0xb484('0x1')]},'tokenSecret':{'type':Sequelize[_0xb484('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb484('0x2')](_0xb484('0x4'),'newTab'),'defaultValue':_0xb484('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index dabebcb..006e07e 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 _0x5bcc=['zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','end','stack','send','map','DeskAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','name','options','includeAll','include','findAll','params','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','length','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','DeskField','getFields','username','password','consumerKey','token','tokenSecret','remoteUri','slice','substring','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x5bcc,0x15d));var _0xc5bc=function(_0x57ea8d,_0x2429e4){_0x57ea8d=_0x57ea8d-0x0;var _0xf40aef=_0x5bcc[_0x57ea8d];return _0xf40aef;};'use strict';var emlformat=require(_0xc5bc('0x0'));var rimraf=require(_0xc5bc('0x1'));var zipdir=require(_0xc5bc('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc5bc('0x3'));var BPromise=require(_0xc5bc('0x4'));var Mustache=require('mustache');var util=require(_0xc5bc('0x5'));var path=require(_0xc5bc('0x6'));var sox=require(_0xc5bc('0x7'));var csv=require(_0xc5bc('0x8'));var ejs=require(_0xc5bc('0x9'));var fs=require('fs');var fs_extra=require(_0xc5bc('0xa'));var _=require('lodash');var squel=require(_0xc5bc('0xb'));var crypto=require(_0xc5bc('0xc'));var jsforce=require(_0xc5bc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc5bc('0x8'));var querystring=require(_0xc5bc('0xe'));var Papa=require(_0xc5bc('0xf'));var Redis=require(_0xc5bc('0x10'));var authService=require(_0xc5bc('0x11'));var qs=require(_0xc5bc('0x12'));var as=require(_0xc5bc('0x13'));var hardwareService=require(_0xc5bc('0x14'));var logger=require(_0xc5bc('0x15'))(_0xc5bc('0x16'));var utils=require('../../config/utils');var config=require(_0xc5bc('0x17'));var licenseUtil=require(_0xc5bc('0x18'));var db=require(_0xc5bc('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xa21fc,_0xc526f0){_0xc526f0=_0xc526f0||0xcc;return function(_0x581515){if(_0x581515){return _0xa21fc[_0xc5bc('0x1a')](_0xc526f0);}return _0xa21fc[_0xc5bc('0x1b')](_0xc526f0)['end']();};}function respondWithResult(_0x2ca2f7,_0x599187){_0x599187=_0x599187||0xc8;return function(_0x1ff09f){if(_0x1ff09f){return _0x2ca2f7[_0xc5bc('0x1b')](_0x599187)[_0xc5bc('0x1c')](_0x1ff09f);}};}function respondWithFilteredResult(_0x451dc8,_0x1d7a4e){return function(_0x12329d){if(_0x12329d){var _0x56ebf2=typeof _0x1d7a4e[_0xc5bc('0x1d')]===_0xc5bc('0x1e')&&typeof _0x1d7a4e[_0xc5bc('0x1f')]==='undefined';var _0x4b2dc3=_0x12329d[_0xc5bc('0x20')];var _0x5ed2ac=_0x56ebf2?0x0:_0x1d7a4e[_0xc5bc('0x1d')];var _0x23103=_0x56ebf2?_0x12329d['count']:_0x1d7a4e[_0xc5bc('0x1d')]+_0x1d7a4e['limit'];var _0x2232a8;if(_0x23103>=_0x4b2dc3){_0x23103=_0x4b2dc3;_0x2232a8=0xc8;}else{_0x2232a8=0xce;}_0x451dc8['status'](_0x2232a8);return _0x451dc8[_0xc5bc('0x21')]('Content-Range',_0x5ed2ac+'-'+_0x23103+'/'+_0x4b2dc3)[_0xc5bc('0x1c')](_0x12329d);}return null;};}function patchUpdates(_0x4b9ec2){return function(_0x4edef7){try{jsonpatch[_0xc5bc('0x22')](_0x4edef7,_0x4b9ec2,!![]);}catch(_0x3ea6b4){return BPromise[_0xc5bc('0x23')](_0x3ea6b4);}return _0x4edef7[_0xc5bc('0x24')]();};}function saveUpdates(_0x52999b,_0x5a1f8f){return function(_0x2c1806){if(_0x2c1806){return _0x2c1806[_0xc5bc('0x25')](_0x52999b)['then'](function(_0x5f3361){return _0x5f3361;});}return null;};}function removeEntity(_0x10a60d,_0x207ce0){return function(_0x395a4b){if(_0x395a4b){return _0x395a4b[_0xc5bc('0x26')]()[_0xc5bc('0x27')](function(){_0x10a60d[_0xc5bc('0x1b')](0xcc)[_0xc5bc('0x28')]();});}};}function handleEntityNotFound(_0x30fec5,_0x2ef083){return function(_0x175258){if(!_0x175258){_0x30fec5[_0xc5bc('0x1a')](0x194);}return _0x175258;};}function handleError(_0x379b02,_0x3935a4){_0x3935a4=_0x3935a4||0x1f4;return function(_0x4c3334){logger['error'](_0x4c3334[_0xc5bc('0x29')]);if(_0x4c3334['name']){delete _0x4c3334['name'];}_0x379b02[_0xc5bc('0x1b')](_0x3935a4)[_0xc5bc('0x2a')](_0x4c3334);};}exports['index']=function(_0x442e81,_0x4bee04){var _0x27907e={},_0x4a15a0={},_0x4f13c4={'count':0x0,'rows':[]};var _0x5cb728=_[_0xc5bc('0x2b')](db[_0xc5bc('0x2c')][_0xc5bc('0x2d')],function(_0x35cfa1){return{'name':_0x35cfa1[_0xc5bc('0x2e')],'type':_0x35cfa1[_0xc5bc('0x2f')][_0xc5bc('0x30')]};});_0x4a15a0['model']=_[_0xc5bc('0x2b')](_0x5cb728,'name');_0x4a15a0[_0xc5bc('0x31')]=_[_0xc5bc('0x32')](_0x442e81[_0xc5bc('0x31')]);_0x4a15a0[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x4a15a0[_0xc5bc('0x35')],_0x4a15a0[_0xc5bc('0x31')]);_0x27907e['attributes']=_[_0xc5bc('0x34')](_0x4a15a0['model'],qs['fields'](_0x442e81['query'][_0xc5bc('0x36')]));_0x27907e[_0xc5bc('0x37')]=_0x27907e[_0xc5bc('0x37')]['length']?_0x27907e[_0xc5bc('0x37')]:_0x4a15a0[_0xc5bc('0x35')];if(!_0x442e81[_0xc5bc('0x31')][_0xc5bc('0x38')](_0xc5bc('0x39'))){_0x27907e[_0xc5bc('0x1f')]=qs[_0xc5bc('0x1f')](_0x442e81['query'][_0xc5bc('0x1f')]);_0x27907e['offset']=qs['offset'](_0x442e81[_0xc5bc('0x31')]['offset']);}_0x27907e[_0xc5bc('0x3a')]=qs[_0xc5bc('0x3b')](_0x442e81['query'][_0xc5bc('0x3b')]);_0x27907e[_0xc5bc('0x3c')]=qs['filters'](_[_0xc5bc('0x3d')](_0x442e81[_0xc5bc('0x31')],_0x4a15a0['filters']),_0x5cb728);if(_0x442e81[_0xc5bc('0x31')]['filter']){_0x27907e['where']=_[_0xc5bc('0x3e')](_0x27907e[_0xc5bc('0x3c')],{'$or':_[_0xc5bc('0x2b')](_0x5cb728,function(_0x579039){if(_0x579039[_0xc5bc('0x2f')]!==_0xc5bc('0x3f')){var _0x12f69c={};_0x12f69c[_0x579039[_0xc5bc('0x40')]]={'$like':'%'+_0x442e81[_0xc5bc('0x31')]['filter']+'%'};return _0x12f69c;}})});}_0x27907e=_['merge']({},_0x27907e,_0x442e81[_0xc5bc('0x41')]);var _0x4bb5cb={'where':_0x27907e[_0xc5bc('0x3c')]};return db[_0xc5bc('0x2c')][_0xc5bc('0x20')](_0x4bb5cb)[_0xc5bc('0x27')](function(_0x2b276a){_0x4f13c4[_0xc5bc('0x20')]=_0x2b276a;if(_0x442e81[_0xc5bc('0x31')][_0xc5bc('0x42')]){_0x27907e[_0xc5bc('0x43')]=[{'all':!![]}];}return db[_0xc5bc('0x2c')][_0xc5bc('0x44')](_0x27907e);})[_0xc5bc('0x27')](function(_0x3f0277){_0x4f13c4['rows']=_0x3f0277;return _0x4f13c4;})[_0xc5bc('0x27')](respondWithFilteredResult(_0x4bee04,_0x27907e))['catch'](handleError(_0x4bee04,null));};exports['show']=function(_0x1f4f8d,_0xecb0cd){var _0x22821c={'raw':![],'where':{'id':_0x1f4f8d[_0xc5bc('0x45')]['id']}},_0x1448a7={};_0x1448a7[_0xc5bc('0x35')]=_[_0xc5bc('0x32')](db['DeskAccount']['rawAttributes']);_0x1448a7['query']=_[_0xc5bc('0x32')](_0x1f4f8d['query']);_0x1448a7[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x1448a7[_0xc5bc('0x35')],_0x1448a7[_0xc5bc('0x31')]);_0x22821c[_0xc5bc('0x37')]=_[_0xc5bc('0x34')](_0x1448a7[_0xc5bc('0x35')],qs['fields'](_0x1f4f8d[_0xc5bc('0x31')][_0xc5bc('0x36')]));_0x22821c['attributes']=_0x22821c[_0xc5bc('0x37')]['length']?_0x22821c[_0xc5bc('0x37')]:_0x1448a7[_0xc5bc('0x35')];if(_0x1f4f8d[_0xc5bc('0x31')][_0xc5bc('0x42')]){_0x22821c[_0xc5bc('0x43')]=[{'all':!![]}];}_0x22821c=_['merge']({},_0x22821c,_0x1f4f8d[_0xc5bc('0x41')]);return db[_0xc5bc('0x2c')][_0xc5bc('0x46')](_0x22821c)[_0xc5bc('0x27')](handleEntityNotFound(_0xecb0cd,null))['then'](respondWithResult(_0xecb0cd,null))[_0xc5bc('0x47')](handleError(_0xecb0cd,null));};exports[_0xc5bc('0x48')]=function(_0x1aa4e2,_0x14a2d9){return db[_0xc5bc('0x2c')][_0xc5bc('0x48')](_0x1aa4e2['body'],{})[_0xc5bc('0x27')](respondWithResult(_0x14a2d9,0xc9))[_0xc5bc('0x47')](handleError(_0x14a2d9,null));};exports['update']=function(_0x2e44c8,_0x4ee612){if(_0x2e44c8[_0xc5bc('0x49')]['id']){delete _0x2e44c8[_0xc5bc('0x49')]['id'];}return db['DeskAccount'][_0xc5bc('0x46')]({'where':{'id':_0x2e44c8[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x4ee612,null))[_0xc5bc('0x27')](saveUpdates(_0x2e44c8[_0xc5bc('0x49')],null))[_0xc5bc('0x27')](respondWithResult(_0x4ee612,null))[_0xc5bc('0x47')](handleError(_0x4ee612,null));};exports['destroy']=function(_0x31bf66,_0x29a9f9){return db[_0xc5bc('0x2c')][_0xc5bc('0x46')]({'where':{'id':_0x31bf66[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x29a9f9,null))[_0xc5bc('0x27')](removeEntity(_0x29a9f9,null))['catch'](handleError(_0x29a9f9,null));};exports[_0xc5bc('0x4a')]=function(_0x27eabf,_0x36362d,_0x914f3e){var _0x202c45={};var _0x4f198a={};var _0x18bbea;var _0x48d356;return db['DeskAccount'][_0xc5bc('0x4b')]({'where':{'id':_0x27eabf[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x36362d,null))[_0xc5bc('0x27')](function(_0x4cab9d){if(_0x4cab9d){_0x18bbea=_0x4cab9d;_0x4f198a[_0xc5bc('0x35')]=_['keys'](db[_0xc5bc('0x4c')][_0xc5bc('0x2d')]);_0x4f198a[_0xc5bc('0x31')]=_[_0xc5bc('0x32')](_0x27eabf['query']);_0x4f198a[_0xc5bc('0x33')]=_[_0xc5bc('0x34')](_0x4f198a[_0xc5bc('0x35')],_0x4f198a[_0xc5bc('0x31')]);_0x202c45['attributes']=_[_0xc5bc('0x34')](_0x4f198a[_0xc5bc('0x35')],qs[_0xc5bc('0x36')](_0x27eabf[_0xc5bc('0x31')][_0xc5bc('0x36')]));_0x202c45[_0xc5bc('0x37')]=_0x202c45['attributes'][_0xc5bc('0x4d')]?_0x202c45[_0xc5bc('0x37')]:_0x4f198a[_0xc5bc('0x35')];_0x202c45[_0xc5bc('0x3a')]=qs[_0xc5bc('0x3b')](_0x27eabf['query'][_0xc5bc('0x3b')]);_0x202c45[_0xc5bc('0x3c')]=qs[_0xc5bc('0x33')](_[_0xc5bc('0x3d')](_0x27eabf[_0xc5bc('0x31')],_0x4f198a['filters']));if(_0x27eabf[_0xc5bc('0x31')]['filter']){_0x202c45[_0xc5bc('0x3c')]=_['merge'](_0x202c45[_0xc5bc('0x3c')],{'$or':_[_0xc5bc('0x2b')](_0x202c45[_0xc5bc('0x37')],function(_0x1e9f6e){var _0x1eb424={};_0x1eb424[_0x1e9f6e]={'$like':'%'+_0x27eabf[_0xc5bc('0x31')]['filter']+'%'};return _0x1eb424;})});}_0x202c45=_[_0xc5bc('0x3e')]({},_0x202c45,_0x27eabf['options']);return _0x18bbea['getConfigurations'](_0x202c45);}})[_0xc5bc('0x27')](function(_0x1727f4){if(_0x1727f4){_0x48d356=_0x1727f4[_0xc5bc('0x4d')];if(!_0x27eabf[_0xc5bc('0x31')][_0xc5bc('0x38')]('nolimit')){_0x202c45[_0xc5bc('0x1f')]=qs[_0xc5bc('0x1f')](_0x27eabf[_0xc5bc('0x31')][_0xc5bc('0x1f')]);_0x202c45[_0xc5bc('0x1d')]=qs[_0xc5bc('0x1d')](_0x27eabf[_0xc5bc('0x31')]['offset']);}return _0x18bbea['getConfigurations'](_0x202c45);}})[_0xc5bc('0x27')](function(_0x4aaeb9){if(_0x4aaeb9){return _0x4aaeb9?{'count':_0x48d356,'rows':_0x4aaeb9}:null;}})[_0xc5bc('0x27')](respondWithResult(_0x36362d,null))['catch'](handleError(_0x36362d,null));};exports[_0xc5bc('0x4e')]=function(_0x1b5717,_0x580d7a,_0x47dcac){if(_0x1b5717[_0xc5bc('0x49')]['id']){delete _0x1b5717[_0xc5bc('0x49')]['id'];}return db[_0xc5bc('0x2c')]['findOne']({'where':{'id':_0x1b5717[_0xc5bc('0x45')]['id']}})[_0xc5bc('0x27')](handleEntityNotFound(_0x580d7a,null))[_0xc5bc('0x27')](function(_0x9947b0){if(_0x9947b0){_0x1b5717['body'][_0xc5bc('0x4f')]=_0x9947b0['id'];_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x50')]=integrations['getSubjects'](_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x51')],_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x2f')]);_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x52')]=integrations[_0xc5bc('0x53')](_0x1b5717[_0xc5bc('0x49')]['channel'],_0x1b5717[_0xc5bc('0x49')][_0xc5bc('0x2f')]);return db[_0xc5bc('0x4c')]['create'](_0x1b5717[_0xc5bc('0x49')],{'include':[{'model':db[_0xc5bc('0x54')],'as':_0xc5bc('0x50')},{'model':db[_0xc5bc('0x54')],'as':'Descriptions'}]});}return null;})[_0xc5bc('0x27')](respondWithResult(_0x580d7a,null))[_0xc5bc('0x47')](handleError(_0x580d7a,null));};exports[_0xc5bc('0x55')]=function(_0x273cfb,_0xc92112,_0x2276dc){var _0x32c560=[{'name':'priority','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 _0x24cf1e='';return db['DeskAccount'][_0xc5bc('0x4b')]({'where':{'id':_0x273cfb[_0xc5bc('0x45')]['id']},'attributes':['id','remoteUri','authType',_0xc5bc('0x56'),_0xc5bc('0x57'),_0xc5bc('0x58'),'consumerSecret',_0xc5bc('0x59'),_0xc5bc('0x5a')]})[_0xc5bc('0x27')](handleEntityNotFound(_0xc92112,null))[_0xc5bc('0x27')](function(_0x3323d9){if(_0x3323d9){_0x24cf1e=_0x3323d9[_0xc5bc('0x5b')];var _0x121bea=_0x24cf1e[_0xc5bc('0x5c')](-0x1);if(_0x121bea==='/'){_0x24cf1e=_0x24cf1e[_0xc5bc('0x5d')](0x0,_0x24cf1e['lastIndexOf'](_0x121bea));}var _0x27d88d={'method':_0xc5bc('0x5e'),'uri':util[_0xc5bc('0x5f')](_0xc5bc('0x60'),_0x24cf1e),'headers':{'Content-Type':_0xc5bc('0x61'),'Accept':'application/json'},'json':!![]};if(_0x3323d9[_0xc5bc('0x62')]===_0xc5bc('0x63')){_0x27d88d[_0xc5bc('0x64')][_0xc5bc('0x65')]=util[_0xc5bc('0x5f')](_0xc5bc('0x66'),new Buffer(util[_0xc5bc('0x5f')](_0xc5bc('0x67'),_0x3323d9[_0xc5bc('0x56')],_0x3323d9[_0xc5bc('0x57')]))[_0xc5bc('0x68')](_0xc5bc('0x69')));}return rp(_0x27d88d)[_0xc5bc('0x27')](function(_0x3b3ded){return _0x32c560[_0xc5bc('0x6a')](_[_0xc5bc('0x2b')](_0x3b3ded[_0xc5bc('0x6b')][_0xc5bc('0x6c')],function(_0x538db2){return{'id':_0x538db2['name'],'name':_0x538db2[_0xc5bc('0x40')],'type':_0x538db2['type'],'active':_0x538db2[_0xc5bc('0x6d')],'label':_0x538db2[_0xc5bc('0x6e')],'custom':!![]};}));});}})[_0xc5bc('0x27')](function(_0x53024c){return{'count':_0x53024c[_0xc5bc('0x4d')],'rows':_0x53024c};})[_0xc5bc('0x27')](respondWithResult(_0xc92112,null))[_0xc5bc('0x47')](function(_0x4f22f5){var _0x59d9cd=_0x273cfb['query'][_0xc5bc('0x6f')]?0x1f4:_0x4f22f5[_0xc5bc('0x70')]||0x1f4;logger[_0xc5bc('0x71')](_0xc5bc('0x72'),_0xc5bc('0x55'),_0x59d9cd,JSON[_0xc5bc('0x73')](_0x4f22f5));delete _0x4f22f5[_0xc5bc('0x40')];if(_0x59d9cd===0x191){_0x59d9cd=0x190;}_0xc92112[_0xc5bc('0x1b')](_0x59d9cd)[_0xc5bc('0x2a')](_0x273cfb['query'][_0xc5bc('0x6f')]?{'message':_0xc5bc('0x74'),'statusCode':_0x4f22f5[_0xc5bc('0x70')]}:_0x4f22f5);});}; \ No newline at end of file +var _0x1905=['label','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','show','params','catch','create','body','find','destroy','findOne','DeskConfiguration','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','tokenSecret','slice','lastIndexOf','GET','format','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','entries','active'];(function(_0x5bacf1,_0x5bae9a){var _0x4b65d3=function(_0x3cd685){while(--_0x3cd685){_0x5bacf1['push'](_0x5bacf1['shift']());}};_0x4b65d3(++_0x5bae9a);}(_0x1905,0x15b));var _0x5190=function(_0xb45f78,_0x540e3a){_0xb45f78=_0xb45f78-0x0;var _0x1676fc=_0x1905[_0xb45f78];return _0x1676fc;};'use strict';var emlformat=require(_0x5190('0x0'));var rimraf=require(_0x5190('0x1'));var zipdir=require(_0x5190('0x2'));var jsonpatch=require(_0x5190('0x3'));var rp=require(_0x5190('0x4'));var moment=require('moment');var BPromise=require(_0x5190('0x5'));var Mustache=require(_0x5190('0x6'));var util=require(_0x5190('0x7'));var path=require(_0x5190('0x8'));var sox=require(_0x5190('0x9'));var csv=require(_0x5190('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5190('0xb'));var _=require(_0x5190('0xc'));var squel=require(_0x5190('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5190('0xe'));var toCsv=require(_0x5190('0xa'));var querystring=require(_0x5190('0xf'));var Papa=require(_0x5190('0x10'));var Redis=require(_0x5190('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5190('0x12'));var hardwareService=require(_0x5190('0x13'));var logger=require(_0x5190('0x14'))('api');var utils=require(_0x5190('0x15'));var config=require(_0x5190('0x16'));var licenseUtil=require(_0x5190('0x17'));var db=require(_0x5190('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x40f986,_0x55c00c){_0x55c00c=_0x55c00c||0xcc;return function(_0x54441f){if(_0x54441f){return _0x40f986[_0x5190('0x19')](_0x55c00c);}return _0x40f986[_0x5190('0x1a')](_0x55c00c)[_0x5190('0x1b')]();};}function respondWithResult(_0x16550d,_0x1a18bb){_0x1a18bb=_0x1a18bb||0xc8;return function(_0x379184){if(_0x379184){return _0x16550d[_0x5190('0x1a')](_0x1a18bb)[_0x5190('0x1c')](_0x379184);}};}function respondWithFilteredResult(_0x27c487,_0x11334f){return function(_0x59d513){if(_0x59d513){var _0x90d5=typeof _0x11334f[_0x5190('0x1d')]===_0x5190('0x1e')&&typeof _0x11334f[_0x5190('0x1f')]===_0x5190('0x1e');var _0x117c35=_0x59d513[_0x5190('0x20')];var _0x3ac72a=_0x90d5?0x0:_0x11334f[_0x5190('0x1d')];var _0x142303=_0x90d5?_0x59d513[_0x5190('0x20')]:_0x11334f[_0x5190('0x1d')]+_0x11334f[_0x5190('0x1f')];var _0x5f4dca;if(_0x142303>=_0x117c35){_0x142303=_0x117c35;_0x5f4dca=0xc8;}else{_0x5f4dca=0xce;}_0x27c487['status'](_0x5f4dca);return _0x27c487[_0x5190('0x21')](_0x5190('0x22'),_0x3ac72a+'-'+_0x142303+'/'+_0x117c35)[_0x5190('0x1c')](_0x59d513);}return null;};}function patchUpdates(_0xded5e2){return function(_0x52986e){try{jsonpatch[_0x5190('0x23')](_0x52986e,_0xded5e2,!![]);}catch(_0xabaaa4){return BPromise[_0x5190('0x24')](_0xabaaa4);}return _0x52986e[_0x5190('0x25')]();};}function saveUpdates(_0x43f1ee,_0x429cc5){return function(_0x3e1ef2){if(_0x3e1ef2){return _0x3e1ef2[_0x5190('0x26')](_0x43f1ee)['then'](function(_0x22a598){return _0x22a598;});}return null;};}function removeEntity(_0x35af12,_0x429345){return function(_0x25c9cf){if(_0x25c9cf){return _0x25c9cf['destroy']()[_0x5190('0x27')](function(){_0x35af12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5df97f,_0x27adac){return function(_0x22b194){if(!_0x22b194){_0x5df97f[_0x5190('0x19')](0x194);}return _0x22b194;};}function handleError(_0x4f31e8,_0x3f853d){_0x3f853d=_0x3f853d||0x1f4;return function(_0x229120){logger['error'](_0x229120[_0x5190('0x28')]);if(_0x229120[_0x5190('0x29')]){delete _0x229120[_0x5190('0x29')];}_0x4f31e8['status'](_0x3f853d)[_0x5190('0x2a')](_0x229120);};}exports[_0x5190('0x2b')]=function(_0x4037b2,_0x5136f4){var _0x47d581={},_0xe07c2e={},_0x34bd6a={'count':0x0,'rows':[]};var _0x5db6c2=_[_0x5190('0x2c')](db[_0x5190('0x2d')][_0x5190('0x2e')],function(_0x17726f){return{'name':_0x17726f[_0x5190('0x2f')],'type':_0x17726f['type'][_0x5190('0x30')]};});_0xe07c2e[_0x5190('0x31')]=_['map'](_0x5db6c2,'name');_0xe07c2e['query']=_[_0x5190('0x32')](_0x4037b2[_0x5190('0x33')]);_0xe07c2e[_0x5190('0x34')]=_[_0x5190('0x35')](_0xe07c2e[_0x5190('0x31')],_0xe07c2e['query']);_0x47d581[_0x5190('0x36')]=_['intersection'](_0xe07c2e[_0x5190('0x31')],qs['fields'](_0x4037b2[_0x5190('0x33')][_0x5190('0x37')]));_0x47d581[_0x5190('0x36')]=_0x47d581[_0x5190('0x36')][_0x5190('0x38')]?_0x47d581['attributes']:_0xe07c2e[_0x5190('0x31')];if(!_0x4037b2[_0x5190('0x33')][_0x5190('0x39')](_0x5190('0x3a'))){_0x47d581[_0x5190('0x1f')]=qs['limit'](_0x4037b2[_0x5190('0x33')]['limit']);_0x47d581['offset']=qs[_0x5190('0x1d')](_0x4037b2[_0x5190('0x33')][_0x5190('0x1d')]);}_0x47d581['order']=qs[_0x5190('0x3b')](_0x4037b2[_0x5190('0x33')][_0x5190('0x3b')]);_0x47d581[_0x5190('0x3c')]=qs[_0x5190('0x34')](_[_0x5190('0x3d')](_0x4037b2[_0x5190('0x33')],_0xe07c2e[_0x5190('0x34')]),_0x5db6c2);if(_0x4037b2[_0x5190('0x33')][_0x5190('0x3e')]){_0x47d581[_0x5190('0x3c')]=_[_0x5190('0x3f')](_0x47d581[_0x5190('0x3c')],{'$or':_[_0x5190('0x2c')](_0x5db6c2,function(_0x5ad565){if(_0x5ad565[_0x5190('0x40')]!=='VIRTUAL'){var _0x357226={};_0x357226[_0x5ad565[_0x5190('0x29')]]={'$like':'%'+_0x4037b2[_0x5190('0x33')]['filter']+'%'};return _0x357226;}})});}_0x47d581=_[_0x5190('0x3f')]({},_0x47d581,_0x4037b2[_0x5190('0x41')]);var _0x532e9b={'where':_0x47d581[_0x5190('0x3c')]};return db[_0x5190('0x2d')][_0x5190('0x20')](_0x532e9b)[_0x5190('0x27')](function(_0x590f9f){_0x34bd6a['count']=_0x590f9f;if(_0x4037b2['query'][_0x5190('0x42')]){_0x47d581[_0x5190('0x43')]=[{'all':!![]}];}return db[_0x5190('0x2d')][_0x5190('0x44')](_0x47d581);})[_0x5190('0x27')](function(_0x45dd40){_0x34bd6a[_0x5190('0x45')]=_0x45dd40;return _0x34bd6a;})[_0x5190('0x27')](respondWithFilteredResult(_0x5136f4,_0x47d581))['catch'](handleError(_0x5136f4,null));};exports[_0x5190('0x46')]=function(_0x1bb166,_0x2f9244){var _0x1c3c54={'raw':![],'where':{'id':_0x1bb166[_0x5190('0x47')]['id']}},_0x21e3f0={};_0x21e3f0[_0x5190('0x31')]=_[_0x5190('0x32')](db[_0x5190('0x2d')][_0x5190('0x2e')]);_0x21e3f0[_0x5190('0x33')]=_['keys'](_0x1bb166[_0x5190('0x33')]);_0x21e3f0[_0x5190('0x34')]=_['intersection'](_0x21e3f0[_0x5190('0x31')],_0x21e3f0['query']);_0x1c3c54[_0x5190('0x36')]=_[_0x5190('0x35')](_0x21e3f0[_0x5190('0x31')],qs[_0x5190('0x37')](_0x1bb166[_0x5190('0x33')][_0x5190('0x37')]));_0x1c3c54[_0x5190('0x36')]=_0x1c3c54['attributes'][_0x5190('0x38')]?_0x1c3c54[_0x5190('0x36')]:_0x21e3f0['model'];if(_0x1bb166[_0x5190('0x33')][_0x5190('0x42')]){_0x1c3c54['include']=[{'all':!![]}];}_0x1c3c54=_['merge']({},_0x1c3c54,_0x1bb166['options']);return db[_0x5190('0x2d')]['find'](_0x1c3c54)[_0x5190('0x27')](handleEntityNotFound(_0x2f9244,null))[_0x5190('0x27')](respondWithResult(_0x2f9244,null))[_0x5190('0x48')](handleError(_0x2f9244,null));};exports[_0x5190('0x49')]=function(_0x5b1647,_0x205d32){return db[_0x5190('0x2d')][_0x5190('0x49')](_0x5b1647[_0x5190('0x4a')],{})[_0x5190('0x27')](respondWithResult(_0x205d32,0xc9))[_0x5190('0x48')](handleError(_0x205d32,null));};exports[_0x5190('0x26')]=function(_0x1fc13e,_0x44b96d){if(_0x1fc13e['body']['id']){delete _0x1fc13e[_0x5190('0x4a')]['id'];}return db[_0x5190('0x2d')][_0x5190('0x4b')]({'where':{'id':_0x1fc13e[_0x5190('0x47')]['id']}})[_0x5190('0x27')](handleEntityNotFound(_0x44b96d,null))[_0x5190('0x27')](saveUpdates(_0x1fc13e['body'],null))['then'](respondWithResult(_0x44b96d,null))[_0x5190('0x48')](handleError(_0x44b96d,null));};exports[_0x5190('0x4c')]=function(_0x421b31,_0x228402){return db[_0x5190('0x2d')][_0x5190('0x4b')]({'where':{'id':_0x421b31[_0x5190('0x47')]['id']}})[_0x5190('0x27')](handleEntityNotFound(_0x228402,null))[_0x5190('0x27')](removeEntity(_0x228402,null))['catch'](handleError(_0x228402,null));};exports['getConfigurations']=function(_0x4f7a2e,_0x5dde34,_0x4172ca){var _0x2fdc68={};var _0x10019e={};var _0x19462d;var _0xcd43b6;return db[_0x5190('0x2d')][_0x5190('0x4d')]({'where':{'id':_0x4f7a2e[_0x5190('0x47')]['id']}})[_0x5190('0x27')](handleEntityNotFound(_0x5dde34,null))[_0x5190('0x27')](function(_0x339d0d){if(_0x339d0d){_0x19462d=_0x339d0d;_0x10019e[_0x5190('0x31')]=_['keys'](db[_0x5190('0x4e')][_0x5190('0x2e')]);_0x10019e[_0x5190('0x33')]=_[_0x5190('0x32')](_0x4f7a2e[_0x5190('0x33')]);_0x10019e['filters']=_[_0x5190('0x35')](_0x10019e[_0x5190('0x31')],_0x10019e[_0x5190('0x33')]);_0x2fdc68[_0x5190('0x36')]=_[_0x5190('0x35')](_0x10019e[_0x5190('0x31')],qs[_0x5190('0x37')](_0x4f7a2e['query'][_0x5190('0x37')]));_0x2fdc68[_0x5190('0x36')]=_0x2fdc68['attributes'][_0x5190('0x38')]?_0x2fdc68[_0x5190('0x36')]:_0x10019e['model'];_0x2fdc68['order']=qs['sort'](_0x4f7a2e[_0x5190('0x33')][_0x5190('0x3b')]);_0x2fdc68[_0x5190('0x3c')]=qs[_0x5190('0x34')](_['pick'](_0x4f7a2e[_0x5190('0x33')],_0x10019e[_0x5190('0x34')]));if(_0x4f7a2e[_0x5190('0x33')][_0x5190('0x3e')]){_0x2fdc68[_0x5190('0x3c')]=_['merge'](_0x2fdc68[_0x5190('0x3c')],{'$or':_[_0x5190('0x2c')](_0x2fdc68['attributes'],function(_0x245666){var _0x4b9625={};_0x4b9625[_0x245666]={'$like':'%'+_0x4f7a2e['query'][_0x5190('0x3e')]+'%'};return _0x4b9625;})});}_0x2fdc68=_[_0x5190('0x3f')]({},_0x2fdc68,_0x4f7a2e['options']);return _0x19462d[_0x5190('0x4f')](_0x2fdc68);}})[_0x5190('0x27')](function(_0x43210c){if(_0x43210c){_0xcd43b6=_0x43210c[_0x5190('0x38')];if(!_0x4f7a2e[_0x5190('0x33')]['hasOwnProperty'](_0x5190('0x3a'))){_0x2fdc68[_0x5190('0x1f')]=qs[_0x5190('0x1f')](_0x4f7a2e[_0x5190('0x33')][_0x5190('0x1f')]);_0x2fdc68[_0x5190('0x1d')]=qs[_0x5190('0x1d')](_0x4f7a2e[_0x5190('0x33')][_0x5190('0x1d')]);}return _0x19462d['getConfigurations'](_0x2fdc68);}})['then'](function(_0x476010){if(_0x476010){return _0x476010?{'count':_0xcd43b6,'rows':_0x476010}:null;}})['then'](respondWithResult(_0x5dde34,null))[_0x5190('0x48')](handleError(_0x5dde34,null));};exports[_0x5190('0x50')]=function(_0x2dc2db,_0x4ed83c,_0x391bc6){if(_0x2dc2db[_0x5190('0x4a')]['id']){delete _0x2dc2db[_0x5190('0x4a')]['id'];}return db[_0x5190('0x2d')][_0x5190('0x4d')]({'where':{'id':_0x2dc2db[_0x5190('0x47')]['id']}})[_0x5190('0x27')](handleEntityNotFound(_0x4ed83c,null))[_0x5190('0x27')](function(_0x477364){if(_0x477364){_0x2dc2db[_0x5190('0x4a')][_0x5190('0x51')]=_0x477364['id'];_0x2dc2db[_0x5190('0x4a')][_0x5190('0x52')]=integrations[_0x5190('0x53')](_0x2dc2db[_0x5190('0x4a')][_0x5190('0x54')],_0x2dc2db[_0x5190('0x4a')][_0x5190('0x40')]);_0x2dc2db[_0x5190('0x4a')][_0x5190('0x55')]=integrations[_0x5190('0x56')](_0x2dc2db['body'][_0x5190('0x54')],_0x2dc2db[_0x5190('0x4a')][_0x5190('0x40')]);return db[_0x5190('0x4e')][_0x5190('0x49')](_0x2dc2db[_0x5190('0x4a')],{'include':[{'model':db[_0x5190('0x57')],'as':_0x5190('0x52')},{'model':db[_0x5190('0x57')],'as':_0x5190('0x55')}]});}return null;})[_0x5190('0x27')](respondWithResult(_0x4ed83c,null))[_0x5190('0x48')](handleError(_0x4ed83c,null));};exports[_0x5190('0x58')]=function(_0x2c442f,_0x112edf,_0x1463b6){var _0x454ea6=[{'name':_0x5190('0x59'),'label':_0x5190('0x59'),'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 _0x4a4a20='';return db[_0x5190('0x2d')][_0x5190('0x4d')]({'where':{'id':_0x2c442f['params']['id']},'attributes':['id',_0x5190('0x5a'),_0x5190('0x5b'),_0x5190('0x5c'),_0x5190('0x5d'),_0x5190('0x5e'),'consumerSecret','token',_0x5190('0x5f')]})[_0x5190('0x27')](handleEntityNotFound(_0x112edf,null))[_0x5190('0x27')](function(_0xa1d0b9){if(_0xa1d0b9){_0x4a4a20=_0xa1d0b9['remoteUri'];var _0x52c316=_0x4a4a20[_0x5190('0x60')](-0x1);if(_0x52c316==='/'){_0x4a4a20=_0x4a4a20['substring'](0x0,_0x4a4a20[_0x5190('0x61')](_0x52c316));}var _0x221b8f={'method':_0x5190('0x62'),'uri':util[_0x5190('0x63')]('%s/custom_fields',_0x4a4a20),'headers':{'Content-Type':_0x5190('0x64'),'Accept':_0x5190('0x64')},'json':!![]};if(_0xa1d0b9['authType']===_0x5190('0x65')){_0x221b8f[_0x5190('0x66')][_0x5190('0x67')]=util[_0x5190('0x63')](_0x5190('0x68'),new Buffer(util[_0x5190('0x63')](_0x5190('0x69'),_0xa1d0b9['username'],_0xa1d0b9['password']))[_0x5190('0x6a')]('base64'));}return rp(_0x221b8f)[_0x5190('0x27')](function(_0x2be8b6){return _0x454ea6['concat'](_[_0x5190('0x2c')](_0x2be8b6['_embedded'][_0x5190('0x6b')],function(_0x2de2e8){return{'id':_0x2de2e8[_0x5190('0x29')],'name':_0x2de2e8[_0x5190('0x29')],'type':_0x2de2e8[_0x5190('0x40')],'active':_0x2de2e8[_0x5190('0x6c')],'label':_0x2de2e8[_0x5190('0x6d')],'custom':!![]};}));});}})['then'](function(_0x4f7296){return{'count':_0x4f7296[_0x5190('0x38')],'rows':_0x4f7296};})[_0x5190('0x27')](respondWithResult(_0x112edf,null))[_0x5190('0x48')](function(_0x3ddc14){var _0xac2f3e=_0x2c442f['query'][_0x5190('0x6e')]?0x1f4:_0x3ddc14[_0x5190('0x6f')]||0x1f4;logger[_0x5190('0x70')](_0x5190('0x71'),_0x5190('0x58'),_0xac2f3e,JSON['stringify'](_0x3ddc14));delete _0x3ddc14[_0x5190('0x29')];if(_0xac2f3e===0x191){_0xac2f3e=0x190;}_0x112edf[_0x5190('0x1a')](_0xac2f3e)[_0x5190('0x2a')](_0x2c442f[_0x5190('0x33')][_0x5190('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x3ddc14[_0x5190('0x6f')]}:_0x3ddc14);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 6a9695d..6dedb19 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 _0x0c01=['../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','api','moment','bluebird','path','rimraf','./intDeskAccount.attributes'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x0c01,0x161));var _0x10c0=function(_0x1d8613,_0x4cabf0){_0x1d8613=_0x1d8613-0x0;var _0x33feea=_0x0c01[_0x1d8613];return _0x33feea;};'use strict';var _=require(_0x10c0('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x10c0('0x1'));var moment=require(_0x10c0('0x2'));var BPromise=require(_0x10c0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x10c0('0x4'));var rimraf=require(_0x10c0('0x5'));var config=require('../../config/environment');var attributes=require(_0x10c0('0x6'));var integrations=require(_0x10c0('0x7'));module[_0x10c0('0x8')]=function(_0x3c5674,_0x482618){return _0x3c5674[_0x10c0('0x9')](_0x10c0('0xa'),attributes,{'tableName':_0x10c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4c6=['../../config/logger','api','moment','bluebird','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','DeskAccount','int_desk_accounts','lodash','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xd4c6,0x98));var _0x6d4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4c6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d4c('0x0'));var util=require(_0x6d4c('0x1'));var logger=require(_0x6d4c('0x2'))(_0x6d4c('0x3'));var moment=require(_0x6d4c('0x4'));var BPromise=require(_0x6d4c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6d4c('0x6'));var attributes=require(_0x6d4c('0x7'));var integrations=require(_0x6d4c('0x8'));module['exports']=function(_0x5a6770,_0x43392a){return _0x5a6770['define'](_0x6d4c('0x9'),attributes,{'tableName':_0x6d4c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 6a5eee5..ce6a14b 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 _0xc97a=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','limit','include','map','model','then','ShowDeskAccount','raw','stringify','lodash','moment','bluebird','randomstring','ioredis'];(function(_0xdd82b4,_0x5cd8b8){var _0x549bb2=function(_0x426fd9){while(--_0x426fd9){_0xdd82b4['push'](_0xdd82b4['shift']());}};_0x549bb2(++_0x5cd8b8);}(_0xc97a,0x87));var _0xac97=function(_0x2f4760,_0x262c58){_0x2f4760=_0x2f4760-0x0;var _0x42cf89=_0xc97a[_0x2f4760];return _0x42cf89;};'use strict';var _=require(_0xac97('0x0'));var util=require('util');var moment=require(_0xac97('0x1'));var BPromise=require(_0xac97('0x2'));var rs=require(_0xac97('0x3'));var fs=require('fs');var Redis=require(_0xac97('0x4'));var db=require(_0xac97('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xac97('0x6'))(_0xac97('0x7'));var config=require(_0xac97('0x8'));var jayson=require(_0xac97('0x9'));var client=jayson[_0xac97('0xa')][_0xac97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xdc2c67,_0x344941,_0x1f5baa){return new BPromise(function(_0xa69a3b,_0x388c34){return client['request'](_0xdc2c67,_0x1f5baa)['then'](function(_0x25ac45){logger[_0xac97('0xc')]('DeskAccount,\x20%s,\x20%s',_0x344941,_0xac97('0xd'));logger[_0xac97('0xe')](_0xac97('0xf'),_0x344941,'request\x20sent',JSON['stringify'](_0x25ac45));if(_0x25ac45[_0xac97('0x10')]){if(_0x25ac45[_0xac97('0x10')][_0xac97('0x11')]===0x1f4){logger[_0xac97('0x10')](_0xac97('0x12'),_0x344941,_0x25ac45[_0xac97('0x10')]['message']);return _0x388c34(_0x25ac45[_0xac97('0x10')][_0xac97('0x13')]);}logger[_0xac97('0x10')](_0xac97('0x12'),_0x344941,_0x25ac45[_0xac97('0x10')][_0xac97('0x13')]);return _0xa69a3b(_0x25ac45[_0xac97('0x10')][_0xac97('0x13')]);}else{logger[_0xac97('0xc')]('DeskAccount,\x20%s,\x20%s',_0x344941,_0xac97('0xd'));_0xa69a3b(_0x25ac45['result'][_0xac97('0x13')]);}})[_0xac97('0x14')](function(_0x31b3d8){logger[_0xac97('0x10')](_0xac97('0x12'),_0x344941,_0x31b3d8);_0x388c34(_0x31b3d8);});});}exports[_0xac97('0x15')]=function(_0x3630e3){var _0x4dee5a=this;return new Promise(function(_0x6256c6,_0x2cb8ce){return db[_0xac97('0x16')][_0xac97('0x17')]({'raw':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')][_0xac97('0x19')]||null:null,'attributes':_0x3630e3['options']?_0x3630e3['options'][_0xac97('0x1a')]||null:null,'limit':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')][_0xac97('0x1b')]||null:null,'include':_0x3630e3[_0xac97('0x18')]?_0x3630e3[_0xac97('0x18')][_0xac97('0x1c')]?_[_0xac97('0x1d')](_0x3630e3[_0xac97('0x18')][_0xac97('0x1c')],function(_0x306ac6){return{'model':db[_0x306ac6[_0xac97('0x1e')]],'as':_0x306ac6['as'],'attributes':_0x306ac6[_0xac97('0x1a')],'include':_0x306ac6[_0xac97('0x1c')]?_[_0xac97('0x1d')](_0x306ac6[_0xac97('0x1c')],function(_0x626e19){return{'model':db[_0x626e19['model']],'as':_0x626e19['as'],'attributes':_0x626e19[_0xac97('0x1a')],'include':_0x626e19['include']?_['map'](_0x626e19[_0xac97('0x1c')],function(_0x2698ae){return{'model':db[_0x2698ae[_0xac97('0x1e')]],'as':_0x2698ae['as'],'attributes':_0x2698ae['attributes']};}):[]};}):[]};}):[]:[]})[_0xac97('0x1f')](function(_0x3ed914){logger[_0xac97('0xc')](_0xac97('0x15'),_0x3630e3);logger[_0xac97('0xe')]('GetDeskAccount',_0x3630e3,JSON['stringify'](_0x3ed914));_0x6256c6(_0x3ed914);})[_0xac97('0x14')](function(_0x1c5194){logger['error'](_0xac97('0x15'),_0x1c5194[_0xac97('0x13')],_0x3630e3);_0x2cb8ce(_0x4dee5a[_0xac97('0x10')](0x1f4,_0x1c5194[_0xac97('0x13')]));});});};exports[_0xac97('0x20')]=function(_0xc66ada){var _0x6ac7a=this;return new Promise(function(_0x3aab47,_0x57c94c){return db[_0xac97('0x16')]['find']({'raw':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')][_0xac97('0x21')]===undefined?!![]:![]:!![],'where':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')][_0xac97('0x19')]||null:null,'attributes':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')]['attributes']||null:null,'include':_0xc66ada[_0xac97('0x18')]?_0xc66ada[_0xac97('0x18')][_0xac97('0x1c')]?_[_0xac97('0x1d')](_0xc66ada[_0xac97('0x18')][_0xac97('0x1c')],function(_0x41d058){return{'model':db[_0x41d058[_0xac97('0x1e')]],'as':_0x41d058['as'],'attributes':_0x41d058['attributes'],'include':_0x41d058[_0xac97('0x1c')]?_['map'](_0x41d058[_0xac97('0x1c')],function(_0x52e325){return{'model':db[_0x52e325[_0xac97('0x1e')]],'as':_0x52e325['as'],'attributes':_0x52e325['attributes'],'include':_0x52e325[_0xac97('0x1c')]?_[_0xac97('0x1d')](_0x52e325[_0xac97('0x1c')],function(_0x3e25d7){return{'model':db[_0x3e25d7[_0xac97('0x1e')]],'as':_0x3e25d7['as'],'attributes':_0x3e25d7[_0xac97('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xac97('0x1f')](function(_0x552d3a){logger[_0xac97('0xc')]('ShowDeskAccount',_0xc66ada);logger['debug']('ShowDeskAccount',_0xc66ada,JSON[_0xac97('0x22')](_0x552d3a));_0x3aab47(_0x552d3a);})['catch'](function(_0x13d89d){logger[_0xac97('0x10')](_0xac97('0x20'),_0x13d89d[_0xac97('0x13')],_0xc66ada);_0x57c94c(_0x6ac7a['error'](0x1f4,_0x13d89d[_0xac97('0x13')]));});});}; \ No newline at end of file +var _0x8efa=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowDeskAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x49fdf9,_0x1860de){var _0x33c00d=function(_0x245da6){while(--_0x245da6){_0x49fdf9['push'](_0x49fdf9['shift']());}};_0x33c00d(++_0x1860de);}(_0x8efa,0x147));var _0xa8ef=function(_0x151546,_0x496f28){_0x151546=_0x151546-0x0;var _0x31a811=_0x8efa[_0x151546];return _0x31a811;};'use strict';var _=require(_0xa8ef('0x0'));var util=require(_0xa8ef('0x1'));var moment=require(_0xa8ef('0x2'));var BPromise=require(_0xa8ef('0x3'));var rs=require(_0xa8ef('0x4'));var fs=require('fs');var Redis=require(_0xa8ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8ef('0x6'));var logger=require(_0xa8ef('0x7'))(_0xa8ef('0x8'));var config=require(_0xa8ef('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa8ef('0xa')][_0xa8ef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x214a3b,_0x1f998d,_0x5b61f6){return new BPromise(function(_0xf00657,_0x156be0){return client[_0xa8ef('0xc')](_0x214a3b,_0x5b61f6)[_0xa8ef('0xd')](function(_0x15a67e){logger[_0xa8ef('0xe')](_0xa8ef('0xf'),_0x1f998d,_0xa8ef('0x10'));logger[_0xa8ef('0x11')](_0xa8ef('0x12'),_0x1f998d,_0xa8ef('0x10'),JSON[_0xa8ef('0x13')](_0x15a67e));if(_0x15a67e[_0xa8ef('0x14')]){if(_0x15a67e['error']['code']===0x1f4){logger[_0xa8ef('0x14')]('DeskAccount,\x20%s,\x20%s',_0x1f998d,_0x15a67e['error'][_0xa8ef('0x15')]);return _0x156be0(_0x15a67e[_0xa8ef('0x14')][_0xa8ef('0x15')]);}logger['error'](_0xa8ef('0xf'),_0x1f998d,_0x15a67e[_0xa8ef('0x14')][_0xa8ef('0x15')]);return _0xf00657(_0x15a67e[_0xa8ef('0x14')][_0xa8ef('0x15')]);}else{logger[_0xa8ef('0xe')](_0xa8ef('0xf'),_0x1f998d,_0xa8ef('0x10'));_0xf00657(_0x15a67e[_0xa8ef('0x16')][_0xa8ef('0x15')]);}})['catch'](function(_0x38ad46){logger[_0xa8ef('0x14')](_0xa8ef('0xf'),_0x1f998d,_0x38ad46);_0x156be0(_0x38ad46);});});}exports[_0xa8ef('0x17')]=function(_0x4c8684){var _0x1df5a2=this;return new Promise(function(_0x53a4c0,_0x3c7049){return db[_0xa8ef('0x18')][_0xa8ef('0x19')]({'raw':_0x4c8684[_0xa8ef('0x1a')]?_0x4c8684[_0xa8ef('0x1a')][_0xa8ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x4c8684[_0xa8ef('0x1a')]?_0x4c8684['options'][_0xa8ef('0x1c')]||null:null,'attributes':_0x4c8684[_0xa8ef('0x1a')]?_0x4c8684[_0xa8ef('0x1a')][_0xa8ef('0x1d')]||null:null,'limit':_0x4c8684[_0xa8ef('0x1a')]?_0x4c8684[_0xa8ef('0x1a')][_0xa8ef('0x1e')]||null:null,'include':_0x4c8684['options']?_0x4c8684['options']['include']?_['map'](_0x4c8684[_0xa8ef('0x1a')][_0xa8ef('0x1f')],function(_0x1fa8b0){return{'model':db[_0x1fa8b0[_0xa8ef('0x20')]],'as':_0x1fa8b0['as'],'attributes':_0x1fa8b0[_0xa8ef('0x1d')],'include':_0x1fa8b0[_0xa8ef('0x1f')]?_[_0xa8ef('0x21')](_0x1fa8b0[_0xa8ef('0x1f')],function(_0x196384){return{'model':db[_0x196384[_0xa8ef('0x20')]],'as':_0x196384['as'],'attributes':_0x196384[_0xa8ef('0x1d')],'include':_0x196384[_0xa8ef('0x1f')]?_[_0xa8ef('0x21')](_0x196384[_0xa8ef('0x1f')],function(_0x5d6aa9){return{'model':db[_0x5d6aa9['model']],'as':_0x5d6aa9['as'],'attributes':_0x5d6aa9[_0xa8ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa8ef('0xd')](function(_0x1175ff){logger[_0xa8ef('0xe')](_0xa8ef('0x17'),_0x4c8684);logger[_0xa8ef('0x11')](_0xa8ef('0x17'),_0x4c8684,JSON[_0xa8ef('0x13')](_0x1175ff));_0x53a4c0(_0x1175ff);})['catch'](function(_0xec4bb9){logger[_0xa8ef('0x14')](_0xa8ef('0x17'),_0xec4bb9[_0xa8ef('0x15')],_0x4c8684);_0x3c7049(_0x1df5a2['error'](0x1f4,_0xec4bb9[_0xa8ef('0x15')]));});});};exports['ShowDeskAccount']=function(_0x5effb4){var _0x3a979e=this;return new Promise(function(_0x5b076f,_0x36af3d){return db[_0xa8ef('0x18')][_0xa8ef('0x22')]({'raw':_0x5effb4['options']?_0x5effb4['options'][_0xa8ef('0x1b')]===undefined?!![]:![]:!![],'where':_0x5effb4[_0xa8ef('0x1a')]?_0x5effb4[_0xa8ef('0x1a')][_0xa8ef('0x1c')]||null:null,'attributes':_0x5effb4[_0xa8ef('0x1a')]?_0x5effb4[_0xa8ef('0x1a')][_0xa8ef('0x1d')]||null:null,'include':_0x5effb4[_0xa8ef('0x1a')]?_0x5effb4[_0xa8ef('0x1a')][_0xa8ef('0x1f')]?_[_0xa8ef('0x21')](_0x5effb4['options']['include'],function(_0x241dd4){return{'model':db[_0x241dd4[_0xa8ef('0x20')]],'as':_0x241dd4['as'],'attributes':_0x241dd4[_0xa8ef('0x1d')],'include':_0x241dd4['include']?_[_0xa8ef('0x21')](_0x241dd4[_0xa8ef('0x1f')],function(_0x60a1e){return{'model':db[_0x60a1e[_0xa8ef('0x20')]],'as':_0x60a1e['as'],'attributes':_0x60a1e['attributes'],'include':_0x60a1e['include']?_['map'](_0x60a1e[_0xa8ef('0x1f')],function(_0xe36e6f){return{'model':db[_0xe36e6f[_0xa8ef('0x20')]],'as':_0xe36e6f['as'],'attributes':_0xe36e6f[_0xa8ef('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xa8ef('0xd')](function(_0x316e17){logger[_0xa8ef('0xe')](_0xa8ef('0x23'),_0x5effb4);logger[_0xa8ef('0x11')](_0xa8ef('0x23'),_0x5effb4,JSON[_0xa8ef('0x13')](_0x316e17));_0x5b076f(_0x316e17);})[_0xa8ef('0x24')](function(_0x4171b4){logger[_0xa8ef('0x14')](_0xa8ef('0x23'),_0x4171b4['message'],_0x5effb4);_0x36af3d(_0x3a979e[_0xa8ef('0x14')](0x1f4,_0x4171b4[_0xa8ef('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 441d808..371617d 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 _0x9957=['/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields'];(function(_0x4223c9,_0x298ff1){var _0x5df12e=function(_0x1e001b){while(--_0x1e001b){_0x4223c9['push'](_0x4223c9['shift']());}};_0x5df12e(++_0x298ff1);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/fields',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/descriptions',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x17')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller['destroy']);module[_0x7995('0x1a')]=router; \ No newline at end of file +var _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x21f7ee,_0x5c38f0){var _0x12079a=function(_0x4463a5){while(--_0x4463a5){_0x21f7ee['push'](_0x21f7ee['shift']());}};_0x12079a(++_0x5c38f0);}(_0x3e74,0x175));var _0x43e7=function(_0x579200,_0x155fe8){_0x579200=_0x579200-0x0;var _0x14eafc=_0x3e74[_0x579200];return _0x14eafc;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 20ab7ff..30fef2a 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 _0x4b4b=['sequelize','exports','STRING'];(function(_0x54b662,_0x1738b6){var _0x1b74da=function(_0x2b67f2){while(--_0x2b67f2){_0x54b662['push'](_0x54b662['shift']());}};_0x1b74da(++_0x1738b6);}(_0x4b4b,0xdb));var _0xb4b4=function(_0x56634a,_0x33948d){_0x56634a=_0x56634a-0x0;var _0x236619=_0x4b4b[_0x56634a];return _0x236619;};'use strict';var Sequelize=require(_0xb4b4('0x0'));module[_0xb4b4('0x1')]={'name':{'type':Sequelize[_0xb4b4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8f73=['STRING','sequelize','exports'];(function(_0x218de4,_0x18bff7){var _0x1bb54d=function(_0x257cc0){while(--_0x257cc0){_0x218de4['push'](_0x218de4['shift']());}};_0x1bb54d(++_0x18bff7);}(_0x8f73,0xfa));var _0x38f7=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x8f73[_0x2dea24];return _0x309d58;};'use strict';var Sequelize=require(_0x38f7('0x0'));module[_0x38f7('0x1')]={'name':{'type':Sequelize[_0x38f7('0x2')]},'description':{'type':Sequelize[_0x38f7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index a28b47f..b83af2f 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 _0xa562=['Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','include','options','find','create','body','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set'];(function(_0x2b6e32,_0x44356e){var _0x59959f=function(_0x1d96e4){while(--_0x1d96e4){_0x2b6e32['push'](_0x2b6e32['shift']());}};_0x59959f(++_0x44356e);}(_0xa562,0x8a));var _0x2a56=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0xa562[_0x4fe19c];return _0x952ac7;};'use strict';var emlformat=require(_0x2a56('0x0'));var rimraf=require(_0x2a56('0x1'));var zipdir=require(_0x2a56('0x2'));var jsonpatch=require(_0x2a56('0x3'));var rp=require(_0x2a56('0x4'));var moment=require(_0x2a56('0x5'));var BPromise=require(_0x2a56('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2a56('0x7'));var csv=require(_0x2a56('0x8'));var ejs=require(_0x2a56('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2a56('0xa'));var crypto=require('crypto');var jsforce=require(_0x2a56('0xb'));var deskjs=require(_0x2a56('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2a56('0xd'));var Redis=require(_0x2a56('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2a56('0xf'));var as=require(_0x2a56('0x10'));var hardwareService=require(_0x2a56('0x11'));var logger=require(_0x2a56('0x12'))(_0x2a56('0x13'));var utils=require(_0x2a56('0x14'));var config=require(_0x2a56('0x15'));var licenseUtil=require(_0x2a56('0x16'));var db=require(_0x2a56('0x17'))['db'];function respondWithStatusCode(_0x35091c,_0x551823){_0x551823=_0x551823||0xcc;return function(_0xacce95){if(_0xacce95){return _0x35091c[_0x2a56('0x18')](_0x551823);}return _0x35091c[_0x2a56('0x19')](_0x551823)[_0x2a56('0x1a')]();};}function respondWithResult(_0x13c88e,_0x52c061){_0x52c061=_0x52c061||0xc8;return function(_0x144881){if(_0x144881){return _0x13c88e[_0x2a56('0x19')](_0x52c061)['json'](_0x144881);}};}function respondWithFilteredResult(_0x50ce80,_0x166ca3){return function(_0x313908){if(_0x313908){var _0x51b1fc=typeof _0x166ca3[_0x2a56('0x1b')]===_0x2a56('0x1c')&&typeof _0x166ca3[_0x2a56('0x1d')]==='undefined';var _0x54c36b=_0x313908[_0x2a56('0x1e')];var _0x38ea42=_0x51b1fc?0x0:_0x166ca3['offset'];var _0x3df5f2=_0x51b1fc?_0x313908[_0x2a56('0x1e')]:_0x166ca3[_0x2a56('0x1b')]+_0x166ca3[_0x2a56('0x1d')];var _0x1e9bf8;if(_0x3df5f2>=_0x54c36b){_0x3df5f2=_0x54c36b;_0x1e9bf8=0xc8;}else{_0x1e9bf8=0xce;}_0x50ce80[_0x2a56('0x19')](_0x1e9bf8);return _0x50ce80[_0x2a56('0x1f')](_0x2a56('0x20'),_0x38ea42+'-'+_0x3df5f2+'/'+_0x54c36b)[_0x2a56('0x21')](_0x313908);}return null;};}function patchUpdates(_0x295e6b){return function(_0x47cd09){try{jsonpatch[_0x2a56('0x22')](_0x47cd09,_0x295e6b,!![]);}catch(_0x1c51c6){return BPromise['reject'](_0x1c51c6);}return _0x47cd09[_0x2a56('0x23')]();};}function saveUpdates(_0x351afd,_0x561845){return function(_0x1ed9bc){if(_0x1ed9bc){return _0x1ed9bc[_0x2a56('0x24')](_0x351afd)[_0x2a56('0x25')](function(_0x1e024f){return _0x1e024f;});}return null;};}function removeEntity(_0x56ae2d,_0x2f8ce7){return function(_0x4949b4){if(_0x4949b4){return _0x4949b4[_0x2a56('0x26')]()[_0x2a56('0x25')](function(){_0x56ae2d[_0x2a56('0x19')](0xcc)[_0x2a56('0x1a')]();});}};}function handleEntityNotFound(_0x2d1828,_0x584da2){return function(_0x4d254b){if(!_0x4d254b){_0x2d1828[_0x2a56('0x18')](0x194);}return _0x4d254b;};}function handleError(_0x1bdbdb,_0x164b1c){_0x164b1c=_0x164b1c||0x1f4;return function(_0x2be2b3){logger[_0x2a56('0x27')](_0x2be2b3[_0x2a56('0x28')]);if(_0x2be2b3[_0x2a56('0x29')]){delete _0x2be2b3[_0x2a56('0x29')];}_0x1bdbdb[_0x2a56('0x19')](_0x164b1c)[_0x2a56('0x2a')](_0x2be2b3);};}exports[_0x2a56('0x2b')]=function(_0x14b953,_0x9cf0a4){var _0x190a68={},_0x331cc9={},_0x5f288d={'count':0x0,'rows':[]};var _0x3f0ebc=_[_0x2a56('0x2c')](db[_0x2a56('0x2d')][_0x2a56('0x2e')],function(_0x406fab){return{'name':_0x406fab[_0x2a56('0x2f')],'type':_0x406fab[_0x2a56('0x30')][_0x2a56('0x31')]};});_0x331cc9[_0x2a56('0x32')]=_[_0x2a56('0x2c')](_0x3f0ebc,_0x2a56('0x29'));_0x331cc9[_0x2a56('0x33')]=_[_0x2a56('0x34')](_0x14b953[_0x2a56('0x33')]);_0x331cc9[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x331cc9[_0x2a56('0x32')],_0x331cc9[_0x2a56('0x33')]);_0x190a68[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x331cc9[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x14b953[_0x2a56('0x33')][_0x2a56('0x38')]));_0x190a68['attributes']=_0x190a68[_0x2a56('0x37')][_0x2a56('0x39')]?_0x190a68[_0x2a56('0x37')]:_0x331cc9[_0x2a56('0x32')];if(!_0x14b953['query'][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x190a68[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x14b953[_0x2a56('0x33')]['limit']);_0x190a68['offset']=qs[_0x2a56('0x1b')](_0x14b953[_0x2a56('0x33')][_0x2a56('0x1b')]);}_0x190a68[_0x2a56('0x3c')]=qs[_0x2a56('0x3d')](_0x14b953[_0x2a56('0x33')][_0x2a56('0x3d')]);_0x190a68[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_[_0x2a56('0x3f')](_0x14b953[_0x2a56('0x33')],_0x331cc9['filters']),_0x3f0ebc);if(_0x14b953[_0x2a56('0x33')][_0x2a56('0x40')]){_0x190a68[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x190a68[_0x2a56('0x3e')],{'$or':_[_0x2a56('0x2c')](_0x3f0ebc,function(_0x43c865){if(_0x43c865[_0x2a56('0x30')]!==_0x2a56('0x42')){var _0x2163a0={};_0x2163a0[_0x43c865[_0x2a56('0x29')]]={'$like':'%'+_0x14b953[_0x2a56('0x33')]['filter']+'%'};return _0x2163a0;}})});}_0x190a68=_[_0x2a56('0x41')]({},_0x190a68,_0x14b953['options']);var _0x3d5b0f={'where':_0x190a68[_0x2a56('0x3e')]};return db[_0x2a56('0x2d')][_0x2a56('0x1e')](_0x3d5b0f)[_0x2a56('0x25')](function(_0x98b412){_0x5f288d[_0x2a56('0x1e')]=_0x98b412;if(_0x14b953[_0x2a56('0x33')][_0x2a56('0x43')]){_0x190a68['include']=[{'all':!![]}];}return db[_0x2a56('0x2d')]['findAll'](_0x190a68);})['then'](function(_0x11686b){_0x5f288d[_0x2a56('0x44')]=_0x11686b;return _0x5f288d;})[_0x2a56('0x25')](respondWithFilteredResult(_0x9cf0a4,_0x190a68))[_0x2a56('0x45')](handleError(_0x9cf0a4,null));};exports[_0x2a56('0x46')]=function(_0x3daa38,_0x40253d){var _0x15e67f={'raw':![],'where':{'id':_0x3daa38[_0x2a56('0x47')]['id']}},_0x52266e={};_0x52266e[_0x2a56('0x32')]=_[_0x2a56('0x34')](db[_0x2a56('0x2d')][_0x2a56('0x2e')]);_0x52266e[_0x2a56('0x33')]=_['keys'](_0x3daa38[_0x2a56('0x33')]);_0x52266e['filters']=_['intersection'](_0x52266e[_0x2a56('0x32')],_0x52266e[_0x2a56('0x33')]);_0x15e67f[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x52266e[_0x2a56('0x32')],qs['fields'](_0x3daa38[_0x2a56('0x33')][_0x2a56('0x38')]));_0x15e67f[_0x2a56('0x37')]=_0x15e67f['attributes']['length']?_0x15e67f[_0x2a56('0x37')]:_0x52266e['model'];if(_0x3daa38[_0x2a56('0x33')][_0x2a56('0x43')]){_0x15e67f[_0x2a56('0x48')]=[{'all':!![]}];}_0x15e67f=_[_0x2a56('0x41')]({},_0x15e67f,_0x3daa38[_0x2a56('0x49')]);return db[_0x2a56('0x2d')][_0x2a56('0x4a')](_0x15e67f)[_0x2a56('0x25')](handleEntityNotFound(_0x40253d,null))['then'](respondWithResult(_0x40253d,null))[_0x2a56('0x45')](handleError(_0x40253d,null));};exports[_0x2a56('0x4b')]=function(_0x2fd683,_0x5a0c10){return db[_0x2a56('0x2d')][_0x2a56('0x4b')](_0x2fd683[_0x2a56('0x4c')],{})['then'](respondWithResult(_0x5a0c10,0xc9))[_0x2a56('0x45')](handleError(_0x5a0c10,null));};exports[_0x2a56('0x24')]=function(_0x200b35,_0x4403d3){if(_0x200b35[_0x2a56('0x4c')]['id']){delete _0x200b35[_0x2a56('0x4c')]['id'];}return db['DeskConfiguration'][_0x2a56('0x4a')]({'where':{'id':_0x200b35['params']['id']}})['then'](handleEntityNotFound(_0x4403d3,null))[_0x2a56('0x25')](saveUpdates(_0x200b35['body'],null))[_0x2a56('0x25')](respondWithResult(_0x4403d3,null))[_0x2a56('0x45')](handleError(_0x4403d3,null));};exports[_0x2a56('0x26')]=function(_0x3b22e5,_0xb6b07d){return db[_0x2a56('0x2d')][_0x2a56('0x4a')]({'where':{'id':_0x3b22e5['params']['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0xb6b07d,null))[_0x2a56('0x25')](removeEntity(_0xb6b07d,null))[_0x2a56('0x45')](handleError(_0xb6b07d,null));};exports[_0x2a56('0x4d')]=function(_0x2ae523,_0xa706cc,_0x4f18bd){var _0x576c35={};var _0x3031dc={};var _0x160a25;var _0x281a6a;return db[_0x2a56('0x2d')][_0x2a56('0x4e')]({'where':{'id':_0x2ae523['params']['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0xa706cc,null))[_0x2a56('0x25')](function(_0x6b9bd8){if(_0x6b9bd8){_0x160a25=_0x6b9bd8;_0x3031dc[_0x2a56('0x32')]=_[_0x2a56('0x34')](db[_0x2a56('0x4f')][_0x2a56('0x2e')]);_0x3031dc['query']=_[_0x2a56('0x34')](_0x2ae523[_0x2a56('0x33')]);_0x3031dc[_0x2a56('0x35')]=_['intersection'](_0x3031dc['model'],_0x3031dc['query']);_0x576c35[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x3031dc[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x2ae523[_0x2a56('0x33')][_0x2a56('0x38')]));_0x576c35[_0x2a56('0x37')]=_0x576c35[_0x2a56('0x37')][_0x2a56('0x39')]?_0x576c35[_0x2a56('0x37')]:_0x3031dc[_0x2a56('0x32')];_0x576c35[_0x2a56('0x3c')]=qs['sort'](_0x2ae523['query'][_0x2a56('0x3d')]);_0x576c35[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_['pick'](_0x2ae523[_0x2a56('0x33')],_0x3031dc[_0x2a56('0x35')]));if(_0x2ae523[_0x2a56('0x33')][_0x2a56('0x40')]){_0x576c35[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x576c35['where'],{'$or':_[_0x2a56('0x2c')](_0x576c35[_0x2a56('0x37')],function(_0x3ce56d){var _0x4a9c7d={};_0x4a9c7d[_0x3ce56d]={'$like':'%'+_0x2ae523['query'][_0x2a56('0x40')]+'%'};return _0x4a9c7d;})});}_0x576c35=_['merge']({},_0x576c35,_0x2ae523[_0x2a56('0x49')]);return _0x160a25[_0x2a56('0x4d')](_0x576c35);}})[_0x2a56('0x25')](function(_0x172e6d){if(_0x172e6d){_0x281a6a=_0x172e6d['length'];if(!_0x2ae523[_0x2a56('0x33')][_0x2a56('0x3a')]('nolimit')){_0x576c35[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x2ae523['query']['limit']);_0x576c35[_0x2a56('0x1b')]=qs['offset'](_0x2ae523[_0x2a56('0x33')][_0x2a56('0x1b')]);}return _0x160a25[_0x2a56('0x4d')](_0x576c35);}})[_0x2a56('0x25')](function(_0x5ca60f){if(_0x5ca60f){return _0x5ca60f?{'count':_0x281a6a,'rows':_0x5ca60f}:null;}})[_0x2a56('0x25')](respondWithResult(_0xa706cc,null))[_0x2a56('0x45')](handleError(_0xa706cc,null));};exports[_0x2a56('0x50')]=function(_0x258bcf,_0xc8f000,_0x23b2c2){var _0x2b01d0={};var _0x33be63={};var _0x4bf2cf;var _0x4d724b;return db['DeskConfiguration']['findOne']({'where':{'id':_0x258bcf['params']['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0xc8f000,null))['then'](function(_0x5d19dc){if(_0x5d19dc){_0x4bf2cf=_0x5d19dc;_0x33be63[_0x2a56('0x32')]=_[_0x2a56('0x34')](db[_0x2a56('0x4f')][_0x2a56('0x2e')]);_0x33be63[_0x2a56('0x33')]=_[_0x2a56('0x34')](_0x258bcf[_0x2a56('0x33')]);_0x33be63[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x33be63[_0x2a56('0x32')],_0x33be63[_0x2a56('0x33')]);_0x2b01d0[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x33be63[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x38')]));_0x2b01d0[_0x2a56('0x37')]=_0x2b01d0[_0x2a56('0x37')][_0x2a56('0x39')]?_0x2b01d0[_0x2a56('0x37')]:_0x33be63[_0x2a56('0x32')];_0x2b01d0['order']=qs['sort'](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x3d')]);_0x2b01d0[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_[_0x2a56('0x3f')](_0x258bcf['query'],_0x33be63[_0x2a56('0x35')]));if(_0x258bcf[_0x2a56('0x33')][_0x2a56('0x40')]){_0x2b01d0['where']=_[_0x2a56('0x41')](_0x2b01d0[_0x2a56('0x3e')],{'$or':_[_0x2a56('0x2c')](_0x2b01d0[_0x2a56('0x37')],function(_0x5007ca){var _0x249cf5={};_0x249cf5[_0x5007ca]={'$like':'%'+_0x258bcf[_0x2a56('0x33')]['filter']+'%'};return _0x249cf5;})});}_0x2b01d0=_['merge']({},_0x2b01d0,_0x258bcf['options']);return _0x4bf2cf[_0x2a56('0x50')](_0x2b01d0);}})['then'](function(_0x47bb8e){if(_0x47bb8e){_0x4d724b=_0x47bb8e[_0x2a56('0x39')];if(!_0x258bcf['query'][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x2b01d0[_0x2a56('0x1d')]=qs['limit'](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x1d')]);_0x2b01d0[_0x2a56('0x1b')]=qs[_0x2a56('0x1b')](_0x258bcf[_0x2a56('0x33')][_0x2a56('0x1b')]);}return _0x4bf2cf[_0x2a56('0x50')](_0x2b01d0);}})[_0x2a56('0x25')](function(_0x5a6c8e){if(_0x5a6c8e){return _0x5a6c8e?{'count':_0x4d724b,'rows':_0x5a6c8e}:null;}})[_0x2a56('0x25')](respondWithResult(_0xc8f000,null))[_0x2a56('0x45')](handleError(_0xc8f000,null));};exports[_0x2a56('0x51')]=function(_0x252180,_0x25d9b5,_0x365ae1){var _0x222df6={};var _0x223589={};var _0x43b685;var _0x38cd62;return db[_0x2a56('0x2d')][_0x2a56('0x4e')]({'where':{'id':_0x252180[_0x2a56('0x47')]['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0x25d9b5,null))[_0x2a56('0x25')](function(_0x35e745){if(_0x35e745){_0x43b685=_0x35e745;_0x223589['model']=_[_0x2a56('0x34')](db[_0x2a56('0x4f')][_0x2a56('0x2e')]);_0x223589[_0x2a56('0x33')]=_['keys'](_0x252180[_0x2a56('0x33')]);_0x223589[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x223589['model'],_0x223589[_0x2a56('0x33')]);_0x222df6[_0x2a56('0x37')]=_[_0x2a56('0x36')](_0x223589[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x252180['query'][_0x2a56('0x38')]));_0x222df6[_0x2a56('0x37')]=_0x222df6['attributes']['length']?_0x222df6[_0x2a56('0x37')]:_0x223589['model'];_0x222df6[_0x2a56('0x3c')]=qs[_0x2a56('0x3d')](_0x252180[_0x2a56('0x33')][_0x2a56('0x3d')]);_0x222df6[_0x2a56('0x3e')]=qs[_0x2a56('0x35')](_['pick'](_0x252180[_0x2a56('0x33')],_0x223589[_0x2a56('0x35')]));if(_0x252180[_0x2a56('0x33')]['filter']){_0x222df6[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x222df6[_0x2a56('0x3e')],{'$or':_['map'](_0x222df6[_0x2a56('0x37')],function(_0x46c37a){var _0x3cac6e={};_0x3cac6e[_0x46c37a]={'$like':'%'+_0x252180[_0x2a56('0x33')]['filter']+'%'};return _0x3cac6e;})});}_0x222df6=_['merge']({},_0x222df6,_0x252180[_0x2a56('0x49')]);return _0x43b685[_0x2a56('0x51')](_0x222df6);}})[_0x2a56('0x25')](function(_0x31ae41){if(_0x31ae41){_0x38cd62=_0x31ae41['length'];if(!_0x252180[_0x2a56('0x33')][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x222df6[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x252180[_0x2a56('0x33')][_0x2a56('0x1d')]);_0x222df6[_0x2a56('0x1b')]=qs[_0x2a56('0x1b')](_0x252180[_0x2a56('0x33')]['offset']);}return _0x43b685[_0x2a56('0x51')](_0x222df6);}})[_0x2a56('0x25')](function(_0x284b4c){if(_0x284b4c){return _0x284b4c?{'count':_0x38cd62,'rows':_0x284b4c}:null;}})[_0x2a56('0x25')](respondWithResult(_0x25d9b5,null))[_0x2a56('0x45')](handleError(_0x25d9b5,null));};exports[_0x2a56('0x52')]=function(_0x449256,_0x5bad66,_0x54ccd2){var _0x729122={};var _0x38bdd6={};var _0x48ec0d;var _0x9a952e;return db[_0x2a56('0x2d')][_0x2a56('0x4e')]({'where':{'id':_0x449256[_0x2a56('0x47')]['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0x5bad66,null))['then'](function(_0x2e1689){if(_0x2e1689){_0x48ec0d=_0x2e1689;_0x38bdd6[_0x2a56('0x32')]=_['keys'](db[_0x2a56('0x53')][_0x2a56('0x2e')]);_0x38bdd6['query']=_['keys'](_0x449256['query']);_0x38bdd6[_0x2a56('0x35')]=_[_0x2a56('0x36')](_0x38bdd6['model'],_0x38bdd6[_0x2a56('0x33')]);_0x729122['attributes']=_[_0x2a56('0x36')](_0x38bdd6[_0x2a56('0x32')],qs[_0x2a56('0x38')](_0x449256[_0x2a56('0x33')][_0x2a56('0x38')]));_0x729122[_0x2a56('0x37')]=_0x729122[_0x2a56('0x37')][_0x2a56('0x39')]?_0x729122[_0x2a56('0x37')]:_0x38bdd6['model'];_0x729122['order']=qs[_0x2a56('0x3d')](_0x449256['query'][_0x2a56('0x3d')]);_0x729122['where']=qs[_0x2a56('0x35')](_[_0x2a56('0x3f')](_0x449256['query'],_0x38bdd6[_0x2a56('0x35')]));if(_0x449256[_0x2a56('0x33')]['filter']){_0x729122[_0x2a56('0x3e')]=_[_0x2a56('0x41')](_0x729122[_0x2a56('0x3e')],{'$or':_[_0x2a56('0x2c')](_0x729122['attributes'],function(_0x17939a){var _0x2a6f05={};_0x2a6f05[_0x17939a]={'$like':'%'+_0x449256[_0x2a56('0x33')][_0x2a56('0x40')]+'%'};return _0x2a6f05;})});}_0x729122=_['merge']({},_0x729122,_0x449256[_0x2a56('0x49')]);return _0x48ec0d[_0x2a56('0x52')](_0x729122);}})['then'](function(_0x59fd78){if(_0x59fd78){_0x9a952e=_0x59fd78[_0x2a56('0x39')];if(!_0x449256[_0x2a56('0x33')][_0x2a56('0x3a')](_0x2a56('0x3b'))){_0x729122[_0x2a56('0x1d')]=qs[_0x2a56('0x1d')](_0x449256['query']['limit']);_0x729122[_0x2a56('0x1b')]=qs[_0x2a56('0x1b')](_0x449256[_0x2a56('0x33')]['offset']);}return _0x48ec0d[_0x2a56('0x52')](_0x729122);}})[_0x2a56('0x25')](function(_0x3af5d3){if(_0x3af5d3){return _0x3af5d3?{'count':_0x9a952e,'rows':_0x3af5d3}:null;}})[_0x2a56('0x25')](respondWithResult(_0x5bad66,null))[_0x2a56('0x45')](handleError(_0x5bad66,null));};exports[_0x2a56('0x54')]=function(_0xed9911,_0x3fd87e,_0x5140bd){if(_0xed9911[_0x2a56('0x4c')]['id']){delete _0xed9911['body']['id'];}return db[_0x2a56('0x2d')]['findOne']({'where':{'id':_0xed9911[_0x2a56('0x47')]['id']}})[_0x2a56('0x25')](handleEntityNotFound(_0x3fd87e,null))[_0x2a56('0x25')](function(_0x3fc81a){if(_0x3fc81a){return _0x3fc81a['setTags'](_0xed9911[_0x2a56('0x4c')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3fd87e,null))[_0x2a56('0x45')](handleError(_0x3fd87e,null));}; \ No newline at end of file +var _0xc8ec=['filter','where','merge','VIRTUAL','options','findAll','catch','show','params','create','body','find','getFields','findOne','DeskField','rawAttributes','order','pick','getSubjects','getDescriptions','Tag','getTags','setTags','ids','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','update','then','destroy','index','DeskConfiguration','fieldName','type','key','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xc8ec,0x158));var _0xcc8e=function(_0x1993ea,_0x229c4a){_0x1993ea=_0x1993ea-0x0;var _0x4518c6=_0xc8ec[_0x1993ea];return _0x4518c6;};'use strict';var emlformat=require(_0xcc8e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcc8e('0x1'));var rp=require(_0xcc8e('0x2'));var moment=require(_0xcc8e('0x3'));var BPromise=require(_0xcc8e('0x4'));var Mustache=require(_0xcc8e('0x5'));var util=require(_0xcc8e('0x6'));var path=require(_0xcc8e('0x7'));var sox=require(_0xcc8e('0x8'));var csv=require(_0xcc8e('0x9'));var ejs=require(_0xcc8e('0xa'));var fs=require('fs');var fs_extra=require(_0xcc8e('0xb'));var _=require('lodash');var squel=require(_0xcc8e('0xc'));var crypto=require('crypto');var jsforce=require(_0xcc8e('0xd'));var deskjs=require(_0xcc8e('0xe'));var toCsv=require(_0xcc8e('0x9'));var querystring=require(_0xcc8e('0xf'));var Papa=require('papaparse');var Redis=require(_0xcc8e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xcc8e('0x11'));var as=require(_0xcc8e('0x12'));var hardwareService=require(_0xcc8e('0x13'));var logger=require(_0xcc8e('0x14'))('api');var utils=require(_0xcc8e('0x15'));var config=require(_0xcc8e('0x16'));var licenseUtil=require(_0xcc8e('0x17'));var db=require(_0xcc8e('0x18'))['db'];function respondWithStatusCode(_0x9440ab,_0x144d37){_0x144d37=_0x144d37||0xcc;return function(_0x5038fb){if(_0x5038fb){return _0x9440ab['sendStatus'](_0x144d37);}return _0x9440ab[_0xcc8e('0x19')](_0x144d37)[_0xcc8e('0x1a')]();};}function respondWithResult(_0x1295ea,_0x3191b5){_0x3191b5=_0x3191b5||0xc8;return function(_0x24ef9e){if(_0x24ef9e){return _0x1295ea[_0xcc8e('0x19')](_0x3191b5)['json'](_0x24ef9e);}};}function respondWithFilteredResult(_0x4c7e5b,_0x5c2758){return function(_0x2af3ff){if(_0x2af3ff){var _0x95d575=typeof _0x5c2758['offset']===_0xcc8e('0x1b')&&typeof _0x5c2758[_0xcc8e('0x1c')]===_0xcc8e('0x1b');var _0x2eab87=_0x2af3ff['count'];var _0x37332c=_0x95d575?0x0:_0x5c2758[_0xcc8e('0x1d')];var _0x4fa933=_0x95d575?_0x2af3ff[_0xcc8e('0x1e')]:_0x5c2758[_0xcc8e('0x1d')]+_0x5c2758[_0xcc8e('0x1c')];var _0x2ee516;if(_0x4fa933>=_0x2eab87){_0x4fa933=_0x2eab87;_0x2ee516=0xc8;}else{_0x2ee516=0xce;}_0x4c7e5b['status'](_0x2ee516);return _0x4c7e5b['set'](_0xcc8e('0x1f'),_0x37332c+'-'+_0x4fa933+'/'+_0x2eab87)[_0xcc8e('0x20')](_0x2af3ff);}return null;};}function patchUpdates(_0x2f4919){return function(_0x132705){try{jsonpatch[_0xcc8e('0x21')](_0x132705,_0x2f4919,!![]);}catch(_0x1c0951){return BPromise[_0xcc8e('0x22')](_0x1c0951);}return _0x132705['save']();};}function saveUpdates(_0x5385f4,_0x4baa07){return function(_0x5e3392){if(_0x5e3392){return _0x5e3392[_0xcc8e('0x23')](_0x5385f4)[_0xcc8e('0x24')](function(_0x15f3ec){return _0x15f3ec;});}return null;};}function removeEntity(_0x16dc87,_0x1ed986){return function(_0x1bb769){if(_0x1bb769){return _0x1bb769[_0xcc8e('0x25')]()[_0xcc8e('0x24')](function(){_0x16dc87[_0xcc8e('0x19')](0xcc)[_0xcc8e('0x1a')]();});}};}function handleEntityNotFound(_0x125292,_0x3eca5f){return function(_0x4baa56){if(!_0x4baa56){_0x125292['sendStatus'](0x194);}return _0x4baa56;};}function handleError(_0xd655e2,_0x88c95f){_0x88c95f=_0x88c95f||0x1f4;return function(_0xaac965){logger['error'](_0xaac965['stack']);if(_0xaac965['name']){delete _0xaac965['name'];}_0xd655e2[_0xcc8e('0x19')](_0x88c95f)['send'](_0xaac965);};}exports[_0xcc8e('0x26')]=function(_0x589942,_0x115239){var _0x108daa={},_0x143645={},_0x421f5e={'count':0x0,'rows':[]};var _0x519e0e=_['map'](db[_0xcc8e('0x27')]['rawAttributes'],function(_0x55ffc0){return{'name':_0x55ffc0[_0xcc8e('0x28')],'type':_0x55ffc0[_0xcc8e('0x29')][_0xcc8e('0x2a')]};});_0x143645[_0xcc8e('0x2b')]=_[_0xcc8e('0x2c')](_0x519e0e,_0xcc8e('0x2d'));_0x143645[_0xcc8e('0x2e')]=_[_0xcc8e('0x2f')](_0x589942[_0xcc8e('0x2e')]);_0x143645[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x143645[_0xcc8e('0x2b')],_0x143645[_0xcc8e('0x2e')]);_0x108daa[_0xcc8e('0x32')]=_['intersection'](_0x143645['model'],qs['fields'](_0x589942['query'][_0xcc8e('0x33')]));_0x108daa['attributes']=_0x108daa[_0xcc8e('0x32')][_0xcc8e('0x34')]?_0x108daa[_0xcc8e('0x32')]:_0x143645['model'];if(!_0x589942['query'][_0xcc8e('0x35')](_0xcc8e('0x36'))){_0x108daa[_0xcc8e('0x1c')]=qs['limit'](_0x589942['query']['limit']);_0x108daa[_0xcc8e('0x1d')]=qs['offset'](_0x589942['query'][_0xcc8e('0x1d')]);}_0x108daa['order']=qs[_0xcc8e('0x37')](_0x589942[_0xcc8e('0x2e')][_0xcc8e('0x37')]);_0x108daa['where']=qs['filters'](_['pick'](_0x589942[_0xcc8e('0x2e')],_0x143645[_0xcc8e('0x30')]),_0x519e0e);if(_0x589942[_0xcc8e('0x2e')][_0xcc8e('0x38')]){_0x108daa[_0xcc8e('0x39')]=_[_0xcc8e('0x3a')](_0x108daa[_0xcc8e('0x39')],{'$or':_[_0xcc8e('0x2c')](_0x519e0e,function(_0x63fcbe){if(_0x63fcbe[_0xcc8e('0x29')]!==_0xcc8e('0x3b')){var _0x3f5456={};_0x3f5456[_0x63fcbe[_0xcc8e('0x2d')]]={'$like':'%'+_0x589942[_0xcc8e('0x2e')][_0xcc8e('0x38')]+'%'};return _0x3f5456;}})});}_0x108daa=_[_0xcc8e('0x3a')]({},_0x108daa,_0x589942[_0xcc8e('0x3c')]);var _0x42560e={'where':_0x108daa[_0xcc8e('0x39')]};return db[_0xcc8e('0x27')][_0xcc8e('0x1e')](_0x42560e)[_0xcc8e('0x24')](function(_0x56c469){_0x421f5e[_0xcc8e('0x1e')]=_0x56c469;if(_0x589942[_0xcc8e('0x2e')]['includeAll']){_0x108daa['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0xcc8e('0x3d')](_0x108daa);})[_0xcc8e('0x24')](function(_0x37de91){_0x421f5e['rows']=_0x37de91;return _0x421f5e;})[_0xcc8e('0x24')](respondWithFilteredResult(_0x115239,_0x108daa))[_0xcc8e('0x3e')](handleError(_0x115239,null));};exports[_0xcc8e('0x3f')]=function(_0x4ce032,_0x19c61d){var _0x565004={'raw':![],'where':{'id':_0x4ce032[_0xcc8e('0x40')]['id']}},_0x3b2431={};_0x3b2431['model']=_[_0xcc8e('0x2f')](db[_0xcc8e('0x27')]['rawAttributes']);_0x3b2431[_0xcc8e('0x2e')]=_['keys'](_0x4ce032[_0xcc8e('0x2e')]);_0x3b2431[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x3b2431[_0xcc8e('0x2b')],_0x3b2431[_0xcc8e('0x2e')]);_0x565004[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x3b2431[_0xcc8e('0x2b')],qs[_0xcc8e('0x33')](_0x4ce032[_0xcc8e('0x2e')][_0xcc8e('0x33')]));_0x565004['attributes']=_0x565004[_0xcc8e('0x32')][_0xcc8e('0x34')]?_0x565004[_0xcc8e('0x32')]:_0x3b2431[_0xcc8e('0x2b')];if(_0x4ce032[_0xcc8e('0x2e')]['includeAll']){_0x565004['include']=[{'all':!![]}];}_0x565004=_[_0xcc8e('0x3a')]({},_0x565004,_0x4ce032['options']);return db[_0xcc8e('0x27')]['find'](_0x565004)[_0xcc8e('0x24')](handleEntityNotFound(_0x19c61d,null))['then'](respondWithResult(_0x19c61d,null))[_0xcc8e('0x3e')](handleError(_0x19c61d,null));};exports[_0xcc8e('0x41')]=function(_0x31346d,_0x1f7840){return db['DeskConfiguration'][_0xcc8e('0x41')](_0x31346d['body'],{})[_0xcc8e('0x24')](respondWithResult(_0x1f7840,0xc9))[_0xcc8e('0x3e')](handleError(_0x1f7840,null));};exports[_0xcc8e('0x23')]=function(_0xfaa918,_0x27fc8d){if(_0xfaa918[_0xcc8e('0x42')]['id']){delete _0xfaa918[_0xcc8e('0x42')]['id'];}return db[_0xcc8e('0x27')]['find']({'where':{'id':_0xfaa918[_0xcc8e('0x40')]['id']}})[_0xcc8e('0x24')](handleEntityNotFound(_0x27fc8d,null))['then'](saveUpdates(_0xfaa918[_0xcc8e('0x42')],null))[_0xcc8e('0x24')](respondWithResult(_0x27fc8d,null))[_0xcc8e('0x3e')](handleError(_0x27fc8d,null));};exports[_0xcc8e('0x25')]=function(_0xc681dc,_0x49b8f6){return db['DeskConfiguration'][_0xcc8e('0x43')]({'where':{'id':_0xc681dc[_0xcc8e('0x40')]['id']}})[_0xcc8e('0x24')](handleEntityNotFound(_0x49b8f6,null))[_0xcc8e('0x24')](removeEntity(_0x49b8f6,null))[_0xcc8e('0x3e')](handleError(_0x49b8f6,null));};exports[_0xcc8e('0x44')]=function(_0x1f102a,_0x230728,_0x28ce3f){var _0x5dab55={};var _0x26153b={};var _0x4fcfd1;var _0x489757;return db[_0xcc8e('0x27')][_0xcc8e('0x45')]({'where':{'id':_0x1f102a['params']['id']}})[_0xcc8e('0x24')](handleEntityNotFound(_0x230728,null))[_0xcc8e('0x24')](function(_0x457203){if(_0x457203){_0x4fcfd1=_0x457203;_0x26153b[_0xcc8e('0x2b')]=_[_0xcc8e('0x2f')](db[_0xcc8e('0x46')][_0xcc8e('0x47')]);_0x26153b[_0xcc8e('0x2e')]=_['keys'](_0x1f102a['query']);_0x26153b[_0xcc8e('0x30')]=_['intersection'](_0x26153b['model'],_0x26153b['query']);_0x5dab55[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x26153b[_0xcc8e('0x2b')],qs[_0xcc8e('0x33')](_0x1f102a[_0xcc8e('0x2e')]['fields']));_0x5dab55[_0xcc8e('0x32')]=_0x5dab55[_0xcc8e('0x32')][_0xcc8e('0x34')]?_0x5dab55[_0xcc8e('0x32')]:_0x26153b[_0xcc8e('0x2b')];_0x5dab55[_0xcc8e('0x48')]=qs['sort'](_0x1f102a[_0xcc8e('0x2e')][_0xcc8e('0x37')]);_0x5dab55[_0xcc8e('0x39')]=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x1f102a[_0xcc8e('0x2e')],_0x26153b[_0xcc8e('0x30')]));if(_0x1f102a['query'][_0xcc8e('0x38')]){_0x5dab55[_0xcc8e('0x39')]=_[_0xcc8e('0x3a')](_0x5dab55['where'],{'$or':_[_0xcc8e('0x2c')](_0x5dab55[_0xcc8e('0x32')],function(_0x3413f0){var _0x480c7d={};_0x480c7d[_0x3413f0]={'$like':'%'+_0x1f102a[_0xcc8e('0x2e')][_0xcc8e('0x38')]+'%'};return _0x480c7d;})});}_0x5dab55=_[_0xcc8e('0x3a')]({},_0x5dab55,_0x1f102a[_0xcc8e('0x3c')]);return _0x4fcfd1[_0xcc8e('0x44')](_0x5dab55);}})['then'](function(_0xb2aba7){if(_0xb2aba7){_0x489757=_0xb2aba7[_0xcc8e('0x34')];if(!_0x1f102a['query'][_0xcc8e('0x35')](_0xcc8e('0x36'))){_0x5dab55['limit']=qs[_0xcc8e('0x1c')](_0x1f102a['query']['limit']);_0x5dab55['offset']=qs['offset'](_0x1f102a['query'][_0xcc8e('0x1d')]);}return _0x4fcfd1[_0xcc8e('0x44')](_0x5dab55);}})[_0xcc8e('0x24')](function(_0x402c65){if(_0x402c65){return _0x402c65?{'count':_0x489757,'rows':_0x402c65}:null;}})[_0xcc8e('0x24')](respondWithResult(_0x230728,null))[_0xcc8e('0x3e')](handleError(_0x230728,null));};exports[_0xcc8e('0x4a')]=function(_0x25d2a9,_0x3395fe,_0x2baab2){var _0x3b48b7={};var _0x36625b={};var _0x315bac;var _0x457fc7;return db[_0xcc8e('0x27')][_0xcc8e('0x45')]({'where':{'id':_0x25d2a9[_0xcc8e('0x40')]['id']}})[_0xcc8e('0x24')](handleEntityNotFound(_0x3395fe,null))[_0xcc8e('0x24')](function(_0x36fc8e){if(_0x36fc8e){_0x315bac=_0x36fc8e;_0x36625b[_0xcc8e('0x2b')]=_[_0xcc8e('0x2f')](db[_0xcc8e('0x46')][_0xcc8e('0x47')]);_0x36625b[_0xcc8e('0x2e')]=_[_0xcc8e('0x2f')](_0x25d2a9['query']);_0x36625b['filters']=_['intersection'](_0x36625b[_0xcc8e('0x2b')],_0x36625b[_0xcc8e('0x2e')]);_0x3b48b7[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x36625b[_0xcc8e('0x2b')],qs[_0xcc8e('0x33')](_0x25d2a9[_0xcc8e('0x2e')][_0xcc8e('0x33')]));_0x3b48b7[_0xcc8e('0x32')]=_0x3b48b7['attributes'][_0xcc8e('0x34')]?_0x3b48b7[_0xcc8e('0x32')]:_0x36625b['model'];_0x3b48b7[_0xcc8e('0x48')]=qs[_0xcc8e('0x37')](_0x25d2a9['query'][_0xcc8e('0x37')]);_0x3b48b7['where']=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x25d2a9['query'],_0x36625b[_0xcc8e('0x30')]));if(_0x25d2a9[_0xcc8e('0x2e')]['filter']){_0x3b48b7['where']=_[_0xcc8e('0x3a')](_0x3b48b7['where'],{'$or':_[_0xcc8e('0x2c')](_0x3b48b7[_0xcc8e('0x32')],function(_0x473d15){var _0x2d1850={};_0x2d1850[_0x473d15]={'$like':'%'+_0x25d2a9['query'][_0xcc8e('0x38')]+'%'};return _0x2d1850;})});}_0x3b48b7=_[_0xcc8e('0x3a')]({},_0x3b48b7,_0x25d2a9['options']);return _0x315bac[_0xcc8e('0x4a')](_0x3b48b7);}})['then'](function(_0x1ef0ea){if(_0x1ef0ea){_0x457fc7=_0x1ef0ea[_0xcc8e('0x34')];if(!_0x25d2a9[_0xcc8e('0x2e')][_0xcc8e('0x35')](_0xcc8e('0x36'))){_0x3b48b7[_0xcc8e('0x1c')]=qs['limit'](_0x25d2a9[_0xcc8e('0x2e')][_0xcc8e('0x1c')]);_0x3b48b7[_0xcc8e('0x1d')]=qs[_0xcc8e('0x1d')](_0x25d2a9['query'][_0xcc8e('0x1d')]);}return _0x315bac['getSubjects'](_0x3b48b7);}})['then'](function(_0x595647){if(_0x595647){return _0x595647?{'count':_0x457fc7,'rows':_0x595647}:null;}})[_0xcc8e('0x24')](respondWithResult(_0x3395fe,null))['catch'](handleError(_0x3395fe,null));};exports[_0xcc8e('0x4b')]=function(_0x2cd000,_0x2b4d22,_0x277a05){var _0x318bd1={};var _0x26d77d={};var _0x517c9d;var _0xef3538;return db[_0xcc8e('0x27')]['findOne']({'where':{'id':_0x2cd000[_0xcc8e('0x40')]['id']}})[_0xcc8e('0x24')](handleEntityNotFound(_0x2b4d22,null))['then'](function(_0x5476c5){if(_0x5476c5){_0x517c9d=_0x5476c5;_0x26d77d[_0xcc8e('0x2b')]=_[_0xcc8e('0x2f')](db[_0xcc8e('0x46')][_0xcc8e('0x47')]);_0x26d77d[_0xcc8e('0x2e')]=_['keys'](_0x2cd000[_0xcc8e('0x2e')]);_0x26d77d[_0xcc8e('0x30')]=_[_0xcc8e('0x31')](_0x26d77d[_0xcc8e('0x2b')],_0x26d77d[_0xcc8e('0x2e')]);_0x318bd1[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x26d77d[_0xcc8e('0x2b')],qs['fields'](_0x2cd000[_0xcc8e('0x2e')]['fields']));_0x318bd1[_0xcc8e('0x32')]=_0x318bd1['attributes'][_0xcc8e('0x34')]?_0x318bd1['attributes']:_0x26d77d[_0xcc8e('0x2b')];_0x318bd1[_0xcc8e('0x48')]=qs['sort'](_0x2cd000[_0xcc8e('0x2e')][_0xcc8e('0x37')]);_0x318bd1['where']=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x2cd000[_0xcc8e('0x2e')],_0x26d77d[_0xcc8e('0x30')]));if(_0x2cd000[_0xcc8e('0x2e')][_0xcc8e('0x38')]){_0x318bd1[_0xcc8e('0x39')]=_[_0xcc8e('0x3a')](_0x318bd1['where'],{'$or':_['map'](_0x318bd1[_0xcc8e('0x32')],function(_0x193314){var _0x478b1e={};_0x478b1e[_0x193314]={'$like':'%'+_0x2cd000[_0xcc8e('0x2e')][_0xcc8e('0x38')]+'%'};return _0x478b1e;})});}_0x318bd1=_[_0xcc8e('0x3a')]({},_0x318bd1,_0x2cd000[_0xcc8e('0x3c')]);return _0x517c9d[_0xcc8e('0x4b')](_0x318bd1);}})['then'](function(_0x4ee73c){if(_0x4ee73c){_0xef3538=_0x4ee73c[_0xcc8e('0x34')];if(!_0x2cd000['query'][_0xcc8e('0x35')]('nolimit')){_0x318bd1[_0xcc8e('0x1c')]=qs[_0xcc8e('0x1c')](_0x2cd000[_0xcc8e('0x2e')][_0xcc8e('0x1c')]);_0x318bd1[_0xcc8e('0x1d')]=qs[_0xcc8e('0x1d')](_0x2cd000[_0xcc8e('0x2e')][_0xcc8e('0x1d')]);}return _0x517c9d[_0xcc8e('0x4b')](_0x318bd1);}})[_0xcc8e('0x24')](function(_0x251a0b){if(_0x251a0b){return _0x251a0b?{'count':_0xef3538,'rows':_0x251a0b}:null;}})[_0xcc8e('0x24')](respondWithResult(_0x2b4d22,null))[_0xcc8e('0x3e')](handleError(_0x2b4d22,null));};exports['getTags']=function(_0x49b459,_0x5b8da1,_0x4ec242){var _0xf455e7={};var _0x507d51={};var _0x213726;var _0x172861;return db[_0xcc8e('0x27')][_0xcc8e('0x45')]({'where':{'id':_0x49b459[_0xcc8e('0x40')]['id']}})[_0xcc8e('0x24')](handleEntityNotFound(_0x5b8da1,null))[_0xcc8e('0x24')](function(_0x599e9b){if(_0x599e9b){_0x213726=_0x599e9b;_0x507d51[_0xcc8e('0x2b')]=_[_0xcc8e('0x2f')](db[_0xcc8e('0x4c')][_0xcc8e('0x47')]);_0x507d51[_0xcc8e('0x2e')]=_[_0xcc8e('0x2f')](_0x49b459[_0xcc8e('0x2e')]);_0x507d51['filters']=_[_0xcc8e('0x31')](_0x507d51[_0xcc8e('0x2b')],_0x507d51['query']);_0xf455e7[_0xcc8e('0x32')]=_[_0xcc8e('0x31')](_0x507d51[_0xcc8e('0x2b')],qs[_0xcc8e('0x33')](_0x49b459[_0xcc8e('0x2e')][_0xcc8e('0x33')]));_0xf455e7[_0xcc8e('0x32')]=_0xf455e7[_0xcc8e('0x32')]['length']?_0xf455e7[_0xcc8e('0x32')]:_0x507d51[_0xcc8e('0x2b')];_0xf455e7[_0xcc8e('0x48')]=qs[_0xcc8e('0x37')](_0x49b459[_0xcc8e('0x2e')][_0xcc8e('0x37')]);_0xf455e7[_0xcc8e('0x39')]=qs[_0xcc8e('0x30')](_[_0xcc8e('0x49')](_0x49b459['query'],_0x507d51['filters']));if(_0x49b459[_0xcc8e('0x2e')][_0xcc8e('0x38')]){_0xf455e7[_0xcc8e('0x39')]=_['merge'](_0xf455e7[_0xcc8e('0x39')],{'$or':_[_0xcc8e('0x2c')](_0xf455e7[_0xcc8e('0x32')],function(_0x4ec766){var _0x7e9f1f={};_0x7e9f1f[_0x4ec766]={'$like':'%'+_0x49b459[_0xcc8e('0x2e')][_0xcc8e('0x38')]+'%'};return _0x7e9f1f;})});}_0xf455e7=_[_0xcc8e('0x3a')]({},_0xf455e7,_0x49b459[_0xcc8e('0x3c')]);return _0x213726[_0xcc8e('0x4d')](_0xf455e7);}})[_0xcc8e('0x24')](function(_0x315791){if(_0x315791){_0x172861=_0x315791[_0xcc8e('0x34')];if(!_0x49b459[_0xcc8e('0x2e')][_0xcc8e('0x35')](_0xcc8e('0x36'))){_0xf455e7['limit']=qs[_0xcc8e('0x1c')](_0x49b459['query']['limit']);_0xf455e7['offset']=qs[_0xcc8e('0x1d')](_0x49b459[_0xcc8e('0x2e')][_0xcc8e('0x1d')]);}return _0x213726[_0xcc8e('0x4d')](_0xf455e7);}})[_0xcc8e('0x24')](function(_0x1bb7b4){if(_0x1bb7b4){return _0x1bb7b4?{'count':_0x172861,'rows':_0x1bb7b4}:null;}})[_0xcc8e('0x24')](respondWithResult(_0x5b8da1,null))[_0xcc8e('0x3e')](handleError(_0x5b8da1,null));};exports['setTags']=function(_0x155178,_0x15c6a4,_0x2b9cb8){if(_0x155178[_0xcc8e('0x42')]['id']){delete _0x155178[_0xcc8e('0x42')]['id'];}return db[_0xcc8e('0x27')][_0xcc8e('0x45')]({'where':{'id':_0x155178['params']['id']}})['then'](handleEntityNotFound(_0x15c6a4,null))['then'](function(_0x39f53e){if(_0x39f53e){return _0x39f53e[_0xcc8e('0x4e')](_0x155178[_0xcc8e('0x42')][_0xcc8e('0x4f')]||[]);}return null;})[_0xcc8e('0x24')](respondWithResult(_0x15c6a4,null))[_0xcc8e('0x3e')](handleError(_0x15c6a4,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 49926ce..dd892f7 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 _0xc7cf=['./intDeskConfiguration.attributes','define','DeskConfiguration','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x7740d,_0x552612){var _0x185bad=function(_0x4bdfaa){while(--_0x4bdfaa){_0x7740d['push'](_0x7740d['shift']());}};_0x185bad(++_0x552612);}(_0xc7cf,0x148));var _0xfc7c=function(_0x148879,_0x5b4c11){_0x148879=_0x148879-0x0;var _0x4f7027=_0xc7cf[_0x148879];return _0x4f7027;};'use strict';var _=require(_0xfc7c('0x0'));var util=require(_0xfc7c('0x1'));var logger=require(_0xfc7c('0x2'))(_0xfc7c('0x3'));var moment=require(_0xfc7c('0x4'));var BPromise=require(_0xfc7c('0x5'));var rp=require(_0xfc7c('0x6'));var fs=require('fs');var path=require(_0xfc7c('0x7'));var rimraf=require(_0xfc7c('0x8'));var config=require(_0xfc7c('0x9'));var attributes=require(_0xfc7c('0xa'));module['exports']=function(_0x1a64c8,_0x57d121){return _0x1a64c8[_0xfc7c('0xb')](_0xfc7c('0xc'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb734=['DeskConfiguration','lodash','../../config/logger','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports'];(function(_0x48b5e0,_0xb3826){var _0x4287ea=function(_0x14519e){while(--_0x14519e){_0x48b5e0['push'](_0x48b5e0['shift']());}};_0x4287ea(++_0xb3826);}(_0xb734,0xe2));var _0x4b73=function(_0x2601b4,_0x315e78){_0x2601b4=_0x2601b4-0x0;var _0x3e3661=_0xb734[_0x2601b4];return _0x3e3661;};'use strict';var _=require(_0x4b73('0x0'));var util=require('util');var logger=require(_0x4b73('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4b73('0x2'));var rp=require(_0x4b73('0x3'));var fs=require('fs');var path=require(_0x4b73('0x4'));var rimraf=require(_0x4b73('0x5'));var config=require('../../config/environment');var attributes=require(_0x4b73('0x6'));module[_0x4b73('0x7')]=function(_0x1d84d1,_0x11914b){return _0x1d84d1['define'](_0x4b73('0x8'),attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index e4a021a..57dba2d 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 _0xa866=['jayson/promise','client','request','then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x491a74,_0x47acde){var _0xfc2d2e=function(_0x290257){while(--_0x290257){_0x491a74['push'](_0x491a74['shift']());}};_0xfc2d2e(++_0x47acde);}(_0xa866,0x6a));var _0x6a86=function(_0x3f167d,_0x4eb6b0){_0x3f167d=_0x3f167d-0x0;var _0x57981f=_0xa866[_0x3f167d];return _0x57981f;};'use strict';var _=require(_0x6a86('0x0'));var util=require(_0x6a86('0x1'));var moment=require(_0x6a86('0x2'));var BPromise=require(_0x6a86('0x3'));var rs=require(_0x6a86('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a86('0x5'))['db'];var utils=require(_0x6a86('0x6'));var logger=require(_0x6a86('0x7'))('rpc');var config=require(_0x6a86('0x8'));var jayson=require(_0x6a86('0x9'));var client=jayson[_0x6a86('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x183997,_0x288910,_0x3ed589){return new BPromise(function(_0x1330e1,_0x37e3ee){return client[_0x6a86('0xb')](_0x183997,_0x3ed589)[_0x6a86('0xc')](function(_0x4a83c9){logger[_0x6a86('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x288910,_0x6a86('0xe'));logger[_0x6a86('0xf')](_0x6a86('0x10'),_0x288910,'request\x20sent',JSON[_0x6a86('0x11')](_0x4a83c9));if(_0x4a83c9[_0x6a86('0x12')]){if(_0x4a83c9['error']['code']===0x1f4){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);return _0x37e3ee(_0x4a83c9[_0x6a86('0x12')][_0x6a86('0x14')]);}logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x4a83c9['error'][_0x6a86('0x14')]);return _0x1330e1(_0x4a83c9[_0x6a86('0x12')]['message']);}else{logger[_0x6a86('0xd')](_0x6a86('0x13'),_0x288910,_0x6a86('0xe'));_0x1330e1(_0x4a83c9[_0x6a86('0x15')][_0x6a86('0x14')]);}})[_0x6a86('0x16')](function(_0x500b59){logger[_0x6a86('0x12')](_0x6a86('0x13'),_0x288910,_0x500b59);_0x37e3ee(_0x500b59);});});} \ No newline at end of file +var _0x86dc=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','bluebird'];(function(_0x44afa4,_0x5be27b){var _0xcad289=function(_0x206272){while(--_0x206272){_0x44afa4['push'](_0x44afa4['shift']());}};_0xcad289(++_0x5be27b);}(_0x86dc,0x13e));var _0xc86d=function(_0x20fb49,_0x1bfe0d){_0x20fb49=_0x20fb49-0x0;var _0x27c1fa=_0x86dc[_0x20fb49];return _0x27c1fa;};'use strict';var _=require(_0xc86d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xc86d('0x1'));var rs=require(_0xc86d('0x2'));var fs=require('fs');var Redis=require(_0xc86d('0x3'));var db=require(_0xc86d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc86d('0x5'))('rpc');var config=require(_0xc86d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc86d('0x7')][_0xc86d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21114c,_0x56ac0e,_0x17a2b6){return new BPromise(function(_0x59c9a9,_0x20ae2c){return client[_0xc86d('0x9')](_0x21114c,_0x17a2b6)['then'](function(_0x5078d8){logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');logger[_0xc86d('0xc')](_0xc86d('0xd'),_0x56ac0e,_0xc86d('0xe'),JSON[_0xc86d('0xf')](_0x5078d8));if(_0x5078d8[_0xc86d('0x10')]){if(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x11')]===0x1f4){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x20ae2c(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);return _0x59c9a9(_0x5078d8[_0xc86d('0x10')][_0xc86d('0x12')]);}else{logger[_0xc86d('0xa')](_0xc86d('0xb'),_0x56ac0e,'request\x20sent');_0x59c9a9(_0x5078d8['result']['message']);}})[_0xc86d('0x13')](function(_0x376a90){logger[_0xc86d('0x10')](_0xc86d('0xb'),_0x56ac0e,_0x376a90);_0x20ae2c(_0x376a90);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index e30543b..03fa667 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 _0x1505=['../../config/environment','get','isAuthenticated','/:id','show','create','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x37a6a9,_0x54c390){var _0x32fbe9=function(_0x278244){while(--_0x278244){_0x37a6a9['push'](_0x37a6a9['shift']());}};_0x32fbe9(++_0x54c390);}(_0x1505,0x1cb));var _0x5150=function(_0x18e603,_0x4da640){_0x18e603=_0x18e603-0x0;var _0x2574cc=_0x1505[_0x18e603];return _0x2574cc;};'use strict';var multer=require(_0x5150('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5150('0x1'));var express=require('express');var router=express[_0x5150('0x2')]();var fs_extra=require(_0x5150('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5150('0x4'));var config=require(_0x5150('0x5'));var controller=require('./intDeskField.controller');router[_0x5150('0x6')]('/',auth[_0x5150('0x7')](),controller['index']);router[_0x5150('0x6')](_0x5150('0x8'),auth[_0x5150('0x7')](),controller[_0x5150('0x9')]);router['post']('/',auth[_0x5150('0x7')](),controller[_0x5150('0xa')]);router[_0x5150('0xb')](_0x5150('0x8'),auth[_0x5150('0x7')](),controller[_0x5150('0xc')]);router[_0x5150('0xd')](_0x5150('0x8'),auth[_0x5150('0x7')](),controller[_0x5150('0xe')]);module[_0x5150('0xf')]=router; \ No newline at end of file +var _0xfed0=['express','Router','fs-extra','../../components/interaction/service','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xfed0,0xeb));var _0x0fed=function(_0x5581d8,_0x42a8c6){_0x5581d8=_0x5581d8-0x0;var _0x390f68=_0xfed0[_0x5581d8];return _0x390f68;};'use strict';var multer=require(_0x0fed('0x0'));var util=require(_0x0fed('0x1'));var path=require('path');var timeout=require(_0x0fed('0x2'));var express=require(_0x0fed('0x3'));var router=express[_0x0fed('0x4')]();var fs_extra=require(_0x0fed('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0fed('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth[_0x0fed('0x7')](),controller['index']);router[_0x0fed('0x8')](_0x0fed('0x9'),auth['isAuthenticated'](),controller[_0x0fed('0xa')]);router[_0x0fed('0xb')]('/',auth[_0x0fed('0x7')](),controller['create']);router[_0x0fed('0xc')](_0x0fed('0x9'),auth['isAuthenticated'](),controller[_0x0fed('0xd')]);router[_0x0fed('0xe')](_0x0fed('0x9'),auth['isAuthenticated'](),controller[_0x0fed('0xf')]);module[_0x0fed('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 021d4fc..cba8c25 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 _0x76ec=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','exports'];(function(_0x1a234f,_0x1d2ff1){var _0x49f492=function(_0x290909){while(--_0x290909){_0x1a234f['push'](_0x1a234f['shift']());}};_0x49f492(++_0x1d2ff1);}(_0x76ec,0x9f));var _0xc76e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x76ec[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0xc76e('0x0')]={'type':{'type':Sequelize[_0xc76e('0x1')](_0xc76e('0x2'),_0xc76e('0x3'),_0xc76e('0x4'),_0xc76e('0x5'),_0xc76e('0x6')),'defaultValue':_0xc76e('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xc76e('0x7')]},'keyType':{'type':Sequelize[_0xc76e('0x1')](_0xc76e('0x2'),_0xc76e('0x3'),_0xc76e('0x4'))},'keyContent':{'type':Sequelize[_0xc76e('0x7')]},'idField':{'type':Sequelize[_0xc76e('0x7')]},'nameField':{'type':Sequelize[_0xc76e('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc76e('0x7')]}}; \ No newline at end of file +var _0x04f1=['customVariable','BOOLEAN','sequelize','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x484580,_0x1971ef){var _0x444aef=function(_0x5565f6){while(--_0x5565f6){_0x484580['push'](_0x484580['shift']());}};_0x444aef(++_0x1971ef);}(_0x04f1,0x119));var _0x104f=function(_0x360739,_0x2ec1b2){_0x360739=_0x360739-0x0;var _0x3e23a1=_0x04f1[_0x360739];return _0x3e23a1;};'use strict';var Sequelize=require(_0x104f('0x0'));module['exports']={'type':{'type':Sequelize[_0x104f('0x1')](_0x104f('0x2'),_0x104f('0x3'),'customVariable',_0x104f('0x4'),_0x104f('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x104f('0x6')]},'key':{'type':Sequelize[_0x104f('0x6')]},'keyType':{'type':Sequelize[_0x104f('0x1')](_0x104f('0x2'),_0x104f('0x3'),_0x104f('0x7'))},'keyContent':{'type':Sequelize[_0x104f('0x6')]},'idField':{'type':Sequelize[_0x104f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x104f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x104f('0x6')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index bc8b688..6ea40dd 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 _0xd1f1=['send','index','DeskField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','fields','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','apply','save','update','then','destroy','end','error','stack','name'];(function(_0x4e007d,_0x5a0b85){var _0x270c4f=function(_0x338a08){while(--_0x338a08){_0x4e007d['push'](_0x4e007d['shift']());}};_0x270c4f(++_0x5a0b85);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x3dac2c,_0x2ad312){_0x3dac2c=_0x3dac2c-0x0;var _0x23f73a=_0xd1f1[_0x3dac2c];return _0x23f73a;};'use strict';var emlformat=require(_0x1d1f('0x0'));var rimraf=require(_0x1d1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1d1f('0x2'));var rp=require(_0x1d1f('0x3'));var moment=require(_0x1d1f('0x4'));var BPromise=require(_0x1d1f('0x5'));var Mustache=require(_0x1d1f('0x6'));var util=require(_0x1d1f('0x7'));var path=require(_0x1d1f('0x8'));var sox=require('sox');var csv=require(_0x1d1f('0x9'));var ejs=require(_0x1d1f('0xa'));var fs=require('fs');var fs_extra=require(_0x1d1f('0xb'));var _=require(_0x1d1f('0xc'));var squel=require(_0x1d1f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1d1f('0x9'));var querystring=require(_0x1d1f('0xe'));var Papa=require(_0x1d1f('0xf'));var Redis=require(_0x1d1f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1d1f('0x11'));var as=require(_0x1d1f('0x12'));var hardwareService=require(_0x1d1f('0x13'));var logger=require(_0x1d1f('0x14'))(_0x1d1f('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1d1f('0x16'));var db=require(_0x1d1f('0x17'))['db'];function respondWithStatusCode(_0x5582d4,_0x33e3b1){_0x33e3b1=_0x33e3b1||0xcc;return function(_0x2f3c0f){if(_0x2f3c0f){return _0x5582d4[_0x1d1f('0x18')](_0x33e3b1);}return _0x5582d4[_0x1d1f('0x19')](_0x33e3b1)['end']();};}function respondWithResult(_0x2e0629,_0xa62267){_0xa62267=_0xa62267||0xc8;return function(_0x3db906){if(_0x3db906){return _0x2e0629[_0x1d1f('0x19')](_0xa62267)[_0x1d1f('0x1a')](_0x3db906);}};}function respondWithFilteredResult(_0x152f33,_0x147371){return function(_0x56cec9){if(_0x56cec9){var _0x3f66c7=typeof _0x147371[_0x1d1f('0x1b')]===_0x1d1f('0x1c')&&typeof _0x147371[_0x1d1f('0x1d')]===_0x1d1f('0x1c');var _0x3a9c75=_0x56cec9['count'];var _0x53ff5f=_0x3f66c7?0x0:_0x147371['offset'];var _0x2a5507=_0x3f66c7?_0x56cec9['count']:_0x147371[_0x1d1f('0x1b')]+_0x147371['limit'];var _0x4938d6;if(_0x2a5507>=_0x3a9c75){_0x2a5507=_0x3a9c75;_0x4938d6=0xc8;}else{_0x4938d6=0xce;}_0x152f33['status'](_0x4938d6);return _0x152f33[_0x1d1f('0x1e')]('Content-Range',_0x53ff5f+'-'+_0x2a5507+'/'+_0x3a9c75)[_0x1d1f('0x1a')](_0x56cec9);}return null;};}function patchUpdates(_0xe6b89a){return function(_0xe121be){try{jsonpatch[_0x1d1f('0x1f')](_0xe121be,_0xe6b89a,!![]);}catch(_0x507ee0){return BPromise['reject'](_0x507ee0);}return _0xe121be[_0x1d1f('0x20')]();};}function saveUpdates(_0x491c1b,_0x360051){return function(_0x2c2518){if(_0x2c2518){return _0x2c2518[_0x1d1f('0x21')](_0x491c1b)[_0x1d1f('0x22')](function(_0x23189b){return _0x23189b;});}return null;};}function removeEntity(_0x1e4650,_0x4d406c){return function(_0x3fe260){if(_0x3fe260){return _0x3fe260[_0x1d1f('0x23')]()['then'](function(){_0x1e4650[_0x1d1f('0x19')](0xcc)[_0x1d1f('0x24')]();});}};}function handleEntityNotFound(_0x2aabc7,_0x585ec7){return function(_0x2aebd3){if(!_0x2aebd3){_0x2aabc7[_0x1d1f('0x18')](0x194);}return _0x2aebd3;};}function handleError(_0x318bc9,_0x4f3bbf){_0x4f3bbf=_0x4f3bbf||0x1f4;return function(_0x238db7){logger[_0x1d1f('0x25')](_0x238db7[_0x1d1f('0x26')]);if(_0x238db7['name']){delete _0x238db7[_0x1d1f('0x27')];}_0x318bc9[_0x1d1f('0x19')](_0x4f3bbf)[_0x1d1f('0x28')](_0x238db7);};}exports[_0x1d1f('0x29')]=function(_0x23e61e,_0x57f817){var _0x4989de={},_0x2cc444={},_0x26b533={'count':0x0,'rows':[]};var _0x9f6459=_['map'](db[_0x1d1f('0x2a')][_0x1d1f('0x2b')],function(_0x52474b){return{'name':_0x52474b[_0x1d1f('0x2c')],'type':_0x52474b[_0x1d1f('0x2d')]['key']};});_0x2cc444[_0x1d1f('0x2e')]=_[_0x1d1f('0x2f')](_0x9f6459,_0x1d1f('0x27'));_0x2cc444[_0x1d1f('0x30')]=_[_0x1d1f('0x31')](_0x23e61e[_0x1d1f('0x30')]);_0x2cc444[_0x1d1f('0x32')]=_[_0x1d1f('0x33')](_0x2cc444[_0x1d1f('0x2e')],_0x2cc444['query']);_0x4989de[_0x1d1f('0x34')]=_['intersection'](_0x2cc444[_0x1d1f('0x2e')],qs['fields'](_0x23e61e['query']['fields']));_0x4989de[_0x1d1f('0x34')]=_0x4989de[_0x1d1f('0x34')][_0x1d1f('0x35')]?_0x4989de[_0x1d1f('0x34')]:_0x2cc444[_0x1d1f('0x2e')];if(!_0x23e61e['query'][_0x1d1f('0x36')](_0x1d1f('0x37'))){_0x4989de[_0x1d1f('0x1d')]=qs[_0x1d1f('0x1d')](_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x1d')]);_0x4989de[_0x1d1f('0x1b')]=qs[_0x1d1f('0x1b')](_0x23e61e[_0x1d1f('0x30')]['offset']);}_0x4989de[_0x1d1f('0x38')]=qs[_0x1d1f('0x39')](_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x39')]);_0x4989de['where']=qs[_0x1d1f('0x32')](_[_0x1d1f('0x3a')](_0x23e61e[_0x1d1f('0x30')],_0x2cc444[_0x1d1f('0x32')]),_0x9f6459);if(_0x23e61e[_0x1d1f('0x30')]['filter']){_0x4989de['where']=_[_0x1d1f('0x3b')](_0x4989de[_0x1d1f('0x3c')],{'$or':_[_0x1d1f('0x2f')](_0x9f6459,function(_0x27ddb3){if(_0x27ddb3[_0x1d1f('0x2d')]!==_0x1d1f('0x3d')){var _0x28ff35={};_0x28ff35[_0x27ddb3[_0x1d1f('0x27')]]={'$like':'%'+_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x3e')]+'%'};return _0x28ff35;}})});}_0x4989de=_[_0x1d1f('0x3b')]({},_0x4989de,_0x23e61e[_0x1d1f('0x3f')]);var _0x444958={'where':_0x4989de[_0x1d1f('0x3c')]};return db['DeskField'][_0x1d1f('0x40')](_0x444958)[_0x1d1f('0x22')](function(_0x131e0b){_0x26b533[_0x1d1f('0x40')]=_0x131e0b;if(_0x23e61e[_0x1d1f('0x30')][_0x1d1f('0x41')]){_0x4989de[_0x1d1f('0x42')]=[{'all':!![]}];}return db[_0x1d1f('0x2a')][_0x1d1f('0x43')](_0x4989de);})[_0x1d1f('0x22')](function(_0x12d933){_0x26b533[_0x1d1f('0x44')]=_0x12d933;return _0x26b533;})[_0x1d1f('0x22')](respondWithFilteredResult(_0x57f817,_0x4989de))[_0x1d1f('0x45')](handleError(_0x57f817,null));};exports[_0x1d1f('0x46')]=function(_0x13a887,_0x28885b){var _0x24bbc6={'raw':!![],'where':{'id':_0x13a887['params']['id']}},_0x911278={};_0x911278[_0x1d1f('0x2e')]=_[_0x1d1f('0x31')](db['DeskField'][_0x1d1f('0x2b')]);_0x911278[_0x1d1f('0x30')]=_[_0x1d1f('0x31')](_0x13a887['query']);_0x911278[_0x1d1f('0x32')]=_['intersection'](_0x911278[_0x1d1f('0x2e')],_0x911278[_0x1d1f('0x30')]);_0x24bbc6[_0x1d1f('0x34')]=_[_0x1d1f('0x33')](_0x911278[_0x1d1f('0x2e')],qs[_0x1d1f('0x47')](_0x13a887[_0x1d1f('0x30')]['fields']));_0x24bbc6[_0x1d1f('0x34')]=_0x24bbc6[_0x1d1f('0x34')][_0x1d1f('0x35')]?_0x24bbc6[_0x1d1f('0x34')]:_0x911278[_0x1d1f('0x2e')];if(_0x13a887[_0x1d1f('0x30')]['includeAll']){_0x24bbc6[_0x1d1f('0x42')]=[{'all':!![]}];}_0x24bbc6=_[_0x1d1f('0x3b')]({},_0x24bbc6,_0x13a887[_0x1d1f('0x3f')]);return db['DeskField'][_0x1d1f('0x48')](_0x24bbc6)[_0x1d1f('0x22')](handleEntityNotFound(_0x28885b,null))[_0x1d1f('0x22')](respondWithResult(_0x28885b,null))[_0x1d1f('0x45')](handleError(_0x28885b,null));};exports[_0x1d1f('0x49')]=function(_0x2d7fc5,_0x3eec9b){return db[_0x1d1f('0x2a')][_0x1d1f('0x49')](_0x2d7fc5[_0x1d1f('0x4a')],{})['then'](respondWithResult(_0x3eec9b,0xc9))[_0x1d1f('0x45')](handleError(_0x3eec9b,null));};exports[_0x1d1f('0x21')]=function(_0x5f0afa,_0x21624d){if(_0x5f0afa[_0x1d1f('0x4a')]['id']){delete _0x5f0afa[_0x1d1f('0x4a')]['id'];}return db[_0x1d1f('0x2a')][_0x1d1f('0x48')]({'where':{'id':_0x5f0afa[_0x1d1f('0x4b')]['id']}})[_0x1d1f('0x22')](handleEntityNotFound(_0x21624d,null))[_0x1d1f('0x22')](saveUpdates(_0x5f0afa['body'],null))[_0x1d1f('0x22')](respondWithResult(_0x21624d,null))[_0x1d1f('0x45')](handleError(_0x21624d,null));};exports[_0x1d1f('0x23')]=function(_0x5d2276,_0x49e092){return db[_0x1d1f('0x2a')]['find']({'where':{'id':_0x5d2276['params']['id']}})[_0x1d1f('0x22')](handleEntityNotFound(_0x49e092,null))[_0x1d1f('0x22')](removeEntity(_0x49e092,null))['catch'](handleError(_0x49e092,null));}; \ No newline at end of file +var _0xd8a7=['sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','DeskField','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','intersection','include','create','body','update','find','eml-format','request-promise','moment','bluebird','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x5163c8,_0x46e3a4){_0x5163c8=_0x5163c8-0x0;var _0x4ef049=_0xd8a7[_0x5163c8];return _0x4ef049;};'use strict';var emlformat=require(_0x7d8a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7d8a('0x1'));var moment=require(_0x7d8a('0x2'));var BPromise=require(_0x7d8a('0x3'));var Mustache=require('mustache');var util=require(_0x7d8a('0x4'));var path=require('path');var sox=require(_0x7d8a('0x5'));var csv=require('to-csv');var ejs=require(_0x7d8a('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d8a('0x7'));var squel=require(_0x7d8a('0x8'));var crypto=require(_0x7d8a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x7d8a('0xa'));var toCsv=require(_0x7d8a('0xb'));var querystring=require(_0x7d8a('0xc'));var Papa=require(_0x7d8a('0xd'));var Redis=require(_0x7d8a('0xe'));var authService=require(_0x7d8a('0xf'));var qs=require(_0x7d8a('0x10'));var as=require(_0x7d8a('0x11'));var hardwareService=require(_0x7d8a('0x12'));var logger=require(_0x7d8a('0x13'))(_0x7d8a('0x14'));var utils=require(_0x7d8a('0x15'));var config=require(_0x7d8a('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d8a('0x17'))['db'];function respondWithStatusCode(_0xd57f7d,_0x400bd6){_0x400bd6=_0x400bd6||0xcc;return function(_0x1ca39e){if(_0x1ca39e){return _0xd57f7d[_0x7d8a('0x18')](_0x400bd6);}return _0xd57f7d['status'](_0x400bd6)[_0x7d8a('0x19')]();};}function respondWithResult(_0x5a9b2c,_0x14caed){_0x14caed=_0x14caed||0xc8;return function(_0x506c6c){if(_0x506c6c){return _0x5a9b2c[_0x7d8a('0x1a')](_0x14caed)['json'](_0x506c6c);}};}function respondWithFilteredResult(_0x290d0a,_0x164c6c){return function(_0x52ec93){if(_0x52ec93){var _0x12516d=typeof _0x164c6c[_0x7d8a('0x1b')]===_0x7d8a('0x1c')&&typeof _0x164c6c[_0x7d8a('0x1d')]==='undefined';var _0x39fec5=_0x52ec93[_0x7d8a('0x1e')];var _0x5916ed=_0x12516d?0x0:_0x164c6c[_0x7d8a('0x1b')];var _0xcc3354=_0x12516d?_0x52ec93['count']:_0x164c6c[_0x7d8a('0x1b')]+_0x164c6c[_0x7d8a('0x1d')];var _0x4202e1;if(_0xcc3354>=_0x39fec5){_0xcc3354=_0x39fec5;_0x4202e1=0xc8;}else{_0x4202e1=0xce;}_0x290d0a[_0x7d8a('0x1a')](_0x4202e1);return _0x290d0a[_0x7d8a('0x1f')](_0x7d8a('0x20'),_0x5916ed+'-'+_0xcc3354+'/'+_0x39fec5)[_0x7d8a('0x21')](_0x52ec93);}return null;};}function patchUpdates(_0x18c8d1){return function(_0x428aa8){try{jsonpatch[_0x7d8a('0x22')](_0x428aa8,_0x18c8d1,!![]);}catch(_0x33c69f){return BPromise[_0x7d8a('0x23')](_0x33c69f);}return _0x428aa8[_0x7d8a('0x24')]();};}function saveUpdates(_0x4cc9ec,_0x478375){return function(_0x4acdfc){if(_0x4acdfc){return _0x4acdfc['update'](_0x4cc9ec)[_0x7d8a('0x25')](function(_0x1481b2){return _0x1481b2;});}return null;};}function removeEntity(_0xfaf23f,_0x9b324d){return function(_0x51c12d){if(_0x51c12d){return _0x51c12d[_0x7d8a('0x26')]()['then'](function(){_0xfaf23f[_0x7d8a('0x1a')](0xcc)[_0x7d8a('0x19')]();});}};}function handleEntityNotFound(_0x5b57a1,_0x124016){return function(_0x4c6b4f){if(!_0x4c6b4f){_0x5b57a1['sendStatus'](0x194);}return _0x4c6b4f;};}function handleError(_0x2f6720,_0x5c7aef){_0x5c7aef=_0x5c7aef||0x1f4;return function(_0x260eb3){logger[_0x7d8a('0x27')](_0x260eb3[_0x7d8a('0x28')]);if(_0x260eb3[_0x7d8a('0x29')]){delete _0x260eb3['name'];}_0x2f6720[_0x7d8a('0x1a')](_0x5c7aef)[_0x7d8a('0x2a')](_0x260eb3);};}exports[_0x7d8a('0x2b')]=function(_0x124fab,_0x2031c7){var _0x3b7bd8={},_0x370ee6={},_0x4837fd={'count':0x0,'rows':[]};var _0x112e99=_['map'](db[_0x7d8a('0x2c')][_0x7d8a('0x2d')],function(_0x174ec8){return{'name':_0x174ec8[_0x7d8a('0x2e')],'type':_0x174ec8['type'][_0x7d8a('0x2f')]};});_0x370ee6[_0x7d8a('0x30')]=_['map'](_0x112e99,'name');_0x370ee6[_0x7d8a('0x31')]=_[_0x7d8a('0x32')](_0x124fab[_0x7d8a('0x31')]);_0x370ee6[_0x7d8a('0x33')]=_['intersection'](_0x370ee6[_0x7d8a('0x30')],_0x370ee6[_0x7d8a('0x31')]);_0x3b7bd8[_0x7d8a('0x34')]=_['intersection'](_0x370ee6[_0x7d8a('0x30')],qs[_0x7d8a('0x35')](_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x35')]));_0x3b7bd8[_0x7d8a('0x34')]=_0x3b7bd8['attributes'][_0x7d8a('0x36')]?_0x3b7bd8[_0x7d8a('0x34')]:_0x370ee6[_0x7d8a('0x30')];if(!_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x37')](_0x7d8a('0x38'))){_0x3b7bd8[_0x7d8a('0x1d')]=qs[_0x7d8a('0x1d')](_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x1d')]);_0x3b7bd8[_0x7d8a('0x1b')]=qs[_0x7d8a('0x1b')](_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x1b')]);}_0x3b7bd8[_0x7d8a('0x39')]=qs[_0x7d8a('0x3a')](_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x3a')]);_0x3b7bd8[_0x7d8a('0x3b')]=qs[_0x7d8a('0x33')](_[_0x7d8a('0x3c')](_0x124fab[_0x7d8a('0x31')],_0x370ee6[_0x7d8a('0x33')]),_0x112e99);if(_0x124fab['query']['filter']){_0x3b7bd8[_0x7d8a('0x3b')]=_[_0x7d8a('0x3d')](_0x3b7bd8[_0x7d8a('0x3b')],{'$or':_['map'](_0x112e99,function(_0x383620){if(_0x383620['type']!=='VIRTUAL'){var _0x4ad09d={};_0x4ad09d[_0x383620[_0x7d8a('0x29')]]={'$like':'%'+_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x3e')]+'%'};return _0x4ad09d;}})});}_0x3b7bd8=_[_0x7d8a('0x3d')]({},_0x3b7bd8,_0x124fab[_0x7d8a('0x3f')]);var _0x231a0b={'where':_0x3b7bd8['where']};return db['DeskField']['count'](_0x231a0b)[_0x7d8a('0x25')](function(_0x477d09){_0x4837fd[_0x7d8a('0x1e')]=_0x477d09;if(_0x124fab[_0x7d8a('0x31')][_0x7d8a('0x40')]){_0x3b7bd8['include']=[{'all':!![]}];}return db['DeskField'][_0x7d8a('0x41')](_0x3b7bd8);})[_0x7d8a('0x25')](function(_0x2f62db){_0x4837fd[_0x7d8a('0x42')]=_0x2f62db;return _0x4837fd;})[_0x7d8a('0x25')](respondWithFilteredResult(_0x2031c7,_0x3b7bd8))[_0x7d8a('0x43')](handleError(_0x2031c7,null));};exports[_0x7d8a('0x44')]=function(_0x4cd337,_0x3a509b){var _0x251a14={'raw':!![],'where':{'id':_0x4cd337[_0x7d8a('0x45')]['id']}},_0x1f872f={};_0x1f872f[_0x7d8a('0x30')]=_[_0x7d8a('0x32')](db['DeskField']['rawAttributes']);_0x1f872f[_0x7d8a('0x31')]=_[_0x7d8a('0x32')](_0x4cd337[_0x7d8a('0x31')]);_0x1f872f[_0x7d8a('0x33')]=_[_0x7d8a('0x46')](_0x1f872f[_0x7d8a('0x30')],_0x1f872f[_0x7d8a('0x31')]);_0x251a14[_0x7d8a('0x34')]=_[_0x7d8a('0x46')](_0x1f872f[_0x7d8a('0x30')],qs[_0x7d8a('0x35')](_0x4cd337[_0x7d8a('0x31')]['fields']));_0x251a14[_0x7d8a('0x34')]=_0x251a14[_0x7d8a('0x34')][_0x7d8a('0x36')]?_0x251a14[_0x7d8a('0x34')]:_0x1f872f[_0x7d8a('0x30')];if(_0x4cd337[_0x7d8a('0x31')]['includeAll']){_0x251a14[_0x7d8a('0x47')]=[{'all':!![]}];}_0x251a14=_[_0x7d8a('0x3d')]({},_0x251a14,_0x4cd337['options']);return db['DeskField']['find'](_0x251a14)[_0x7d8a('0x25')](handleEntityNotFound(_0x3a509b,null))[_0x7d8a('0x25')](respondWithResult(_0x3a509b,null))['catch'](handleError(_0x3a509b,null));};exports[_0x7d8a('0x48')]=function(_0x52d54f,_0x52fb5b){return db[_0x7d8a('0x2c')][_0x7d8a('0x48')](_0x52d54f[_0x7d8a('0x49')],{})['then'](respondWithResult(_0x52fb5b,0xc9))[_0x7d8a('0x43')](handleError(_0x52fb5b,null));};exports[_0x7d8a('0x4a')]=function(_0x54374b,_0x5615cb){if(_0x54374b[_0x7d8a('0x49')]['id']){delete _0x54374b[_0x7d8a('0x49')]['id'];}return db[_0x7d8a('0x2c')][_0x7d8a('0x4b')]({'where':{'id':_0x54374b[_0x7d8a('0x45')]['id']}})[_0x7d8a('0x25')](handleEntityNotFound(_0x5615cb,null))['then'](saveUpdates(_0x54374b[_0x7d8a('0x49')],null))[_0x7d8a('0x25')](respondWithResult(_0x5615cb,null))['catch'](handleError(_0x5615cb,null));};exports[_0x7d8a('0x26')]=function(_0xe18e3f,_0x3cac01){return db[_0x7d8a('0x2c')][_0x7d8a('0x4b')]({'where':{'id':_0xe18e3f['params']['id']}})[_0x7d8a('0x25')](handleEntityNotFound(_0x3cac01,null))['then'](removeEntity(_0x3cac01,null))['catch'](handleError(_0x3cac01,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index e0b46ef..f3ebdef 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 _0x2e78=['bluebird','path','rimraf','./intDeskField.attributes','exports','define','DeskField','desk_unique_index','idField','FieldId','lodash','../../config/logger'];(function(_0x550e42,_0x31537b){var _0x33cce0=function(_0x251f25){while(--_0x251f25){_0x550e42['push'](_0x550e42['shift']());}};_0x33cce0(++_0x31537b);}(_0x2e78,0x76));var _0x82e7=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2e78[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x82e7('0x0'));var util=require('util');var logger=require(_0x82e7('0x1'))('api');var moment=require('moment');var BPromise=require(_0x82e7('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x82e7('0x3'));var rimraf=require(_0x82e7('0x4'));var config=require('../../config/environment');var attributes=require(_0x82e7('0x5'));module[_0x82e7('0x6')]=function(_0x520c7c,_0x52c0ae){return _0x520c7c[_0x82e7('0x7')](_0x82e7('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0x82e7('0x9'),'fields':[_0x82e7('0xa'),_0x82e7('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ba2=['int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField'];(function(_0xd14d15,_0x3b92d4){var _0x42961f=function(_0x7512ed){while(--_0x7512ed){_0xd14d15['push'](_0xd14d15['shift']());}};_0x42961f(++_0x3b92d4);}(_0x7ba2,0x121));var _0x27ba=function(_0x51a6af,_0x219d20){_0x51a6af=_0x51a6af-0x0;var _0x190e2c=_0x7ba2[_0x51a6af];return _0x190e2c;};'use strict';var _=require('lodash');var util=require(_0x27ba('0x0'));var logger=require(_0x27ba('0x1'))(_0x27ba('0x2'));var moment=require('moment');var BPromise=require(_0x27ba('0x3'));var rp=require(_0x27ba('0x4'));var fs=require('fs');var path=require(_0x27ba('0x5'));var rimraf=require(_0x27ba('0x6'));var config=require(_0x27ba('0x7'));var attributes=require(_0x27ba('0x8'));module['exports']=function(_0x2abfb1,_0x3f0764){return _0x2abfb1[_0x27ba('0x9')](_0x27ba('0xa'),attributes,{'tableName':_0x27ba('0xb'),'paranoid':![],'indexes':[{'name':_0x27ba('0xc'),'fields':[_0x27ba('0xd'),_0x27ba('0xe')],'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 7ca59c2..d3c9390 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 _0x1330=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x1330,0x68));var _0x0133=function(_0x28c939,_0x110e29){_0x28c939=_0x28c939-0x0;var _0x527fe9=_0x1330[_0x28c939];return _0x527fe9;};'use strict';var _=require(_0x0133('0x0'));var util=require(_0x0133('0x1'));var moment=require(_0x0133('0x2'));var BPromise=require('bluebird');var rs=require(_0x0133('0x3'));var fs=require('fs');var Redis=require(_0x0133('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0133('0x5'));var logger=require(_0x0133('0x6'))(_0x0133('0x7'));var config=require(_0x0133('0x8'));var jayson=require(_0x0133('0x9'));var client=jayson[_0x0133('0xa')][_0x0133('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38d396,_0x31b69f,_0x4ee29b){return new BPromise(function(_0x5043f6,_0x5dc149){return client[_0x0133('0xc')](_0x38d396,_0x4ee29b)[_0x0133('0xd')](function(_0x1ab9b1){logger['info'](_0x0133('0xe'),_0x31b69f,_0x0133('0xf'));logger[_0x0133('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x31b69f,_0x0133('0xf'),JSON[_0x0133('0x11')](_0x1ab9b1));if(_0x1ab9b1[_0x0133('0x12')]){if(_0x1ab9b1[_0x0133('0x12')]['code']===0x1f4){logger['error'](_0x0133('0xe'),_0x31b69f,_0x1ab9b1[_0x0133('0x12')][_0x0133('0x13')]);return _0x5dc149(_0x1ab9b1[_0x0133('0x12')]['message']);}logger[_0x0133('0x12')](_0x0133('0xe'),_0x31b69f,_0x1ab9b1['error'][_0x0133('0x13')]);return _0x5043f6(_0x1ab9b1[_0x0133('0x12')]['message']);}else{logger['info']('DeskField,\x20%s,\x20%s',_0x31b69f,_0x0133('0xf'));_0x5043f6(_0x1ab9b1['result']['message']);}})[_0x0133('0x14')](function(_0x28ade9){logger[_0x0133('0x12')](_0x0133('0xe'),_0x31b69f,_0x28ade9);_0x5dc149(_0x28ade9);});});} \ No newline at end of file +var _0xddd0=['http','then','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5a8f3a,_0x443e79){var _0x8380bb=function(_0x16f71d){while(--_0x16f71d){_0x5a8f3a['push'](_0x5a8f3a['shift']());}};_0x8380bb(++_0x443e79);}(_0xddd0,0x1c3));var _0x0ddd=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xddd0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0ddd('0x0'));var util=require(_0x0ddd('0x1'));var moment=require(_0x0ddd('0x2'));var BPromise=require(_0x0ddd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ddd('0x4'));var db=require(_0x0ddd('0x5'))['db'];var utils=require(_0x0ddd('0x6'));var logger=require(_0x0ddd('0x7'))(_0x0ddd('0x8'));var config=require(_0x0ddd('0x9'));var jayson=require(_0x0ddd('0xa'));var client=jayson['client'][_0x0ddd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x591861,_0xc7b17b,_0x2af472){return new BPromise(function(_0x38107d,_0x2e6495){return client['request'](_0x591861,_0x2af472)[_0x0ddd('0xc')](function(_0xa130d4){logger['info'](_0x0ddd('0xd'),_0xc7b17b,'request\x20sent');logger['debug'](_0x0ddd('0xe'),_0xc7b17b,_0x0ddd('0xf'),JSON[_0x0ddd('0x10')](_0xa130d4));if(_0xa130d4[_0x0ddd('0x11')]){if(_0xa130d4[_0x0ddd('0x11')][_0x0ddd('0x12')]===0x1f4){logger[_0x0ddd('0x11')](_0x0ddd('0xd'),_0xc7b17b,_0xa130d4[_0x0ddd('0x11')][_0x0ddd('0x13')]);return _0x2e6495(_0xa130d4[_0x0ddd('0x11')][_0x0ddd('0x13')]);}logger[_0x0ddd('0x11')](_0x0ddd('0xd'),_0xc7b17b,_0xa130d4[_0x0ddd('0x11')]['message']);return _0x38107d(_0xa130d4['error'][_0x0ddd('0x13')]);}else{logger['info'](_0x0ddd('0xd'),_0xc7b17b,_0x0ddd('0xf'));_0x38107d(_0xa130d4[_0x0ddd('0x14')][_0x0ddd('0x13')]);}})[_0x0ddd('0x15')](function(_0x243c9c){logger[_0x0ddd('0x11')]('DeskField,\x20%s,\x20%s',_0xc7b17b,_0x243c9c);_0x2e6495(_0x243c9c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 09547b3..62c7531 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 _0x0b1e=['getFields','post','addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations'];(function(_0x3791ad,_0x1ca192){var _0xcd195=function(_0x248891){while(--_0x248891){_0x3791ad['push'](_0x3791ad['shift']());}};_0xcd195(++_0x1ca192);}(_0x0b1e,0x11b));var _0xe0b1=function(_0x3cb3ca,_0x44d697){_0x3cb3ca=_0x3cb3ca-0x0;var _0x214366=_0x0b1e[_0x3cb3ca];return _0x214366;};'use strict';var multer=require(_0xe0b1('0x0'));var util=require(_0xe0b1('0x1'));var path=require(_0xe0b1('0x2'));var timeout=require(_0xe0b1('0x3'));var express=require(_0xe0b1('0x4'));var router=express[_0xe0b1('0x5')]();var fs_extra=require(_0xe0b1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe0b1('0x7'));var config=require(_0xe0b1('0x8'));var controller=require(_0xe0b1('0x9'));router[_0xe0b1('0xa')]('/',auth[_0xe0b1('0xb')](),controller['index']);router['get'](_0xe0b1('0xc'),auth['isAuthenticated'](),controller[_0xe0b1('0xd')]);router[_0xe0b1('0xa')](_0xe0b1('0xe'),auth['isAuthenticated'](),controller[_0xe0b1('0xf')]);router['get']('/:id/fields',auth[_0xe0b1('0xb')](),controller[_0xe0b1('0x10')]);router[_0xe0b1('0x11')]('/',auth[_0xe0b1('0xb')](),controller['create']);router[_0xe0b1('0x11')](_0xe0b1('0xe'),auth[_0xe0b1('0xb')](),controller[_0xe0b1('0x12')]);router[_0xe0b1('0x13')](_0xe0b1('0xc'),auth[_0xe0b1('0xb')](),controller['update']);router[_0xe0b1('0x14')](_0xe0b1('0xc'),auth[_0xe0b1('0xb')](),controller[_0xe0b1('0x15')]);module[_0xe0b1('0x16')]=router; \ No newline at end of file +var _0xf997=['./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4199b5,_0xb8148b){var _0x538ced=function(_0x2d2820){while(--_0x2d2820){_0x4199b5['push'](_0x4199b5['shift']());}};_0x538ced(++_0xb8148b);}(_0xf997,0x1cb));var _0x7f99=function(_0x4228fc,_0x4fd549){_0x4228fc=_0x4228fc-0x0;var _0x3ce92f=_0xf997[_0x4228fc];return _0x3ce92f;};'use strict';var multer=require(_0x7f99('0x0'));var util=require(_0x7f99('0x1'));var path=require(_0x7f99('0x2'));var timeout=require(_0x7f99('0x3'));var express=require(_0x7f99('0x4'));var router=express['Router']();var fs_extra=require(_0x7f99('0x5'));var auth=require(_0x7f99('0x6'));var interaction=require(_0x7f99('0x7'));var config=require(_0x7f99('0x8'));var controller=require(_0x7f99('0x9'));router[_0x7f99('0xa')]('/',auth[_0x7f99('0xb')](),controller[_0x7f99('0xc')]);router[_0x7f99('0xa')](_0x7f99('0xd'),auth[_0x7f99('0xb')](),controller[_0x7f99('0xe')]);router[_0x7f99('0xa')](_0x7f99('0xf'),auth['isAuthenticated'](),controller[_0x7f99('0x10')]);router[_0x7f99('0xa')](_0x7f99('0x11'),auth[_0x7f99('0xb')](),controller[_0x7f99('0x12')]);router[_0x7f99('0x13')]('/',auth[_0x7f99('0xb')](),controller[_0x7f99('0x14')]);router['post'](_0x7f99('0xf'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x7f99('0x15')](_0x7f99('0xd'),auth[_0x7f99('0xb')](),controller[_0x7f99('0x16')]);router[_0x7f99('0x17')](_0x7f99('0xd'),auth[_0x7f99('0xb')](),controller[_0x7f99('0x18')]);module[_0x7f99('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 974dcbb..d9b6d8c 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 _0x302c=['sequelize','exports','STRING'];(function(_0xafb3a3,_0x5a6d91){var _0x30a7c1=function(_0x56828d){while(--_0x56828d){_0xafb3a3['push'](_0xafb3a3['shift']());}};_0x30a7c1(++_0x5a6d91);}(_0x302c,0x15c));var _0xc302=function(_0x4ab425,_0x52d94f){_0x4ab425=_0x4ab425-0x0;var _0x471404=_0x302c[_0x4ab425];return _0x471404;};'use strict';var Sequelize=require(_0xc302('0x0'));module[_0xc302('0x1')]={'name':{'type':Sequelize[_0xc302('0x2')]},'username':{'type':Sequelize[_0xc302('0x2')]},'password':{'type':Sequelize[_0xc302('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc302('0x2')]},'clientSecret':{'type':Sequelize[_0xc302('0x2')]},'serverUrl':{'type':Sequelize[_0xc302('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x81d4=['STRING','BOOLEAN','exports'];(function(_0x5194c8,_0x54bfa5){var _0x727b96=function(_0x1c72b4){while(--_0x1c72b4){_0x5194c8['push'](_0x5194c8['shift']());}};_0x727b96(++_0x54bfa5);}(_0x81d4,0x197));var _0x481d=function(_0x502337,_0x7e8883){_0x502337=_0x502337-0x0;var _0x329544=_0x81d4[_0x502337];return _0x329544;};'use strict';var Sequelize=require('sequelize');module[_0x481d('0x0')]={'name':{'type':Sequelize[_0x481d('0x1')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x481d('0x1')]},'remoteUri':{'type':Sequelize[_0x481d('0x1')]},'tenantId':{'type':Sequelize[_0x481d('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x481d('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x481d('0x1')]},'modernAuthentication':{'type':Sequelize[_0x481d('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 1b903ae..e22b191 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 _0xc102=['../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','json','offset','undefined','count','set','then','destroy','end','sendStatus','error','name','send','index','Dynamics365Account','fieldName','model','map','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','keys','rawAttributes','fields','find','create','body','update','params','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','Dynamics365Field','Descriptions','slice','substring','lastIndexOf','format','getFields','ticketType','incident','Incident','PhoneCall','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','billedserviceunits','contactidname','contactidyominame','createdbyexternalpartyname','createdbyexternalpartyyominame','createdon','createdonbehalfbyname','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','statecode','statuscode','subjectidname','ticketnumber','concat','username','password','remoteUri','tenantId','clientSecret','CloudProvider','data7','modernAuthentication','data5','POST','https://login.microsoftonline.com/','clientId','access_token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','MetadataId',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','stack','test','Wrong\x20credentials','statusCode','EntityDefinitions(',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','request-promise','util','lodash'];(function(_0x114a58,_0x48050){var _0x2c09c9=function(_0xf2348f){while(--_0xf2348f){_0x114a58['push'](_0x114a58['shift']());}};_0x2c09c9(++_0x48050);}(_0xc102,0xb8));var _0x2c10=function(_0x4194a9,_0x5f1599){_0x4194a9=_0x4194a9-0x0;var _0x5b9b5c=_0xc102[_0x4194a9];return _0x5b9b5c;};'use strict';var rp=require(_0x2c10('0x0'));var util=require(_0x2c10('0x1'));var _=require(_0x2c10('0x2'));var qs=require(_0x2c10('0x3'));var logger=require(_0x2c10('0x4'))(_0x2c10('0x5'));var db=require(_0x2c10('0x6'))['db'];var integrations=require(_0x2c10('0x7'));function respondWithResult(_0x44161e,_0x180092){_0x180092=_0x180092||0xc8;return function(_0x178f61){if(_0x178f61){return _0x44161e[_0x2c10('0x8')](_0x180092)[_0x2c10('0x9')](_0x178f61);}};}function respondWithFilteredResult(_0x1fe1d4,_0x43b9cb){return function(_0x2b9e60){if(_0x2b9e60){var _0x743064=typeof _0x43b9cb[_0x2c10('0xa')]===_0x2c10('0xb')&&typeof _0x43b9cb['limit']===_0x2c10('0xb');var _0x24b124=_0x2b9e60[_0x2c10('0xc')];var _0x5ba5d6=_0x743064?0x0:_0x43b9cb[_0x2c10('0xa')];var _0x3fd1eb=_0x743064?_0x2b9e60[_0x2c10('0xc')]:_0x43b9cb[_0x2c10('0xa')]+_0x43b9cb['limit'];var _0x1b4d18;if(_0x3fd1eb>=_0x24b124){_0x3fd1eb=_0x24b124;_0x1b4d18=0xc8;}else{_0x1b4d18=0xce;}_0x1fe1d4['status'](_0x1b4d18);return _0x1fe1d4[_0x2c10('0xd')]('Content-Range',_0x5ba5d6+'-'+_0x3fd1eb+'/'+_0x24b124)[_0x2c10('0x9')](_0x2b9e60);}return null;};}function saveUpdates(_0x56aa3c){return function(_0x2bfc07){if(_0x2bfc07){return _0x2bfc07['update'](_0x56aa3c)[_0x2c10('0xe')](function(_0x3a8531){return _0x3a8531;});}return null;};}function removeEntity(_0x1de18a){return function(_0xbb8da7){if(_0xbb8da7){return _0xbb8da7[_0x2c10('0xf')]()[_0x2c10('0xe')](function(){_0x1de18a[_0x2c10('0x8')](0xcc)[_0x2c10('0x10')]();});}};}function handleEntityNotFound(_0x360961){return function(_0x224c9c){if(!_0x224c9c){_0x360961[_0x2c10('0x11')](0x194);}return _0x224c9c;};}function handleError(_0x21e155,_0x4a5ce5){_0x4a5ce5=_0x4a5ce5||0x1f4;return function(_0xebe12e){logger[_0x2c10('0x12')](_0xebe12e['stack']);if(_0xebe12e['name']){delete _0xebe12e[_0x2c10('0x13')];}_0x21e155[_0x2c10('0x8')](_0x4a5ce5)[_0x2c10('0x14')](_0xebe12e);};}exports[_0x2c10('0x15')]=function(_0x16f3b2,_0x320d94){var _0x24220d={},_0x3008c4={},_0x5d2f85={'count':0x0,'rows':[]};var _0x340951=_['map'](db[_0x2c10('0x16')]['rawAttributes'],function(_0x50e19e){return{'name':_0x50e19e[_0x2c10('0x17')],'type':_0x50e19e['type']['key']};});_0x3008c4[_0x2c10('0x18')]=_[_0x2c10('0x19')](_0x340951,_0x2c10('0x13'));_0x3008c4[_0x2c10('0x1a')]=_['keys'](_0x16f3b2[_0x2c10('0x1a')]);_0x3008c4[_0x2c10('0x1b')]=_[_0x2c10('0x1c')](_0x3008c4[_0x2c10('0x18')],_0x3008c4[_0x2c10('0x1a')]);_0x24220d[_0x2c10('0x1d')]=_[_0x2c10('0x1c')](_0x3008c4['model'],qs['fields'](_0x16f3b2[_0x2c10('0x1a')]['fields']));_0x24220d[_0x2c10('0x1d')]=_0x24220d[_0x2c10('0x1d')][_0x2c10('0x1e')]?_0x24220d['attributes']:_0x3008c4[_0x2c10('0x18')];if(!_0x16f3b2['query'][_0x2c10('0x1f')](_0x2c10('0x20'))){_0x24220d[_0x2c10('0x21')]=qs[_0x2c10('0x21')](_0x16f3b2['query'][_0x2c10('0x21')]);_0x24220d['offset']=qs['offset'](_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0xa')]);}_0x24220d[_0x2c10('0x22')]=qs[_0x2c10('0x23')](_0x16f3b2[_0x2c10('0x1a')]['sort']);_0x24220d[_0x2c10('0x24')]=qs[_0x2c10('0x1b')](_[_0x2c10('0x25')](_0x16f3b2[_0x2c10('0x1a')],_0x3008c4[_0x2c10('0x1b')]),_0x340951);if(_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0x26')]){_0x24220d[_0x2c10('0x24')]=_[_0x2c10('0x27')](_0x24220d[_0x2c10('0x24')],{'$or':_['map'](_0x340951,function(_0x13e7ad){if(_0x13e7ad[_0x2c10('0x28')]!==_0x2c10('0x29')){var _0x313659={};_0x313659[_0x13e7ad[_0x2c10('0x13')]]={'$like':'%'+_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0x26')]+'%'};return _0x313659;}})});}_0x24220d=_[_0x2c10('0x27')]({},_0x24220d,_0x16f3b2[_0x2c10('0x2a')]);var _0x904e61={'where':_0x24220d['where']};return db[_0x2c10('0x16')]['count'](_0x904e61)[_0x2c10('0xe')](function(_0x567a84){_0x5d2f85[_0x2c10('0xc')]=_0x567a84;if(_0x16f3b2[_0x2c10('0x1a')][_0x2c10('0x2b')]){_0x24220d[_0x2c10('0x2c')]=[{'all':!![]}];}return db[_0x2c10('0x16')][_0x2c10('0x2d')](_0x24220d);})['then'](function(_0x19ea1f){_0x5d2f85['rows']=_0x19ea1f;return _0x5d2f85;})[_0x2c10('0xe')](respondWithFilteredResult(_0x320d94,_0x24220d))[_0x2c10('0x2e')](handleError(_0x320d94,null));};exports['show']=function(_0x5c325c,_0x315a5b){var _0x2b9bcf={'raw':![],'where':{'id':_0x5c325c['params']['id']}},_0x30f8ef={};_0x30f8ef['model']=_[_0x2c10('0x2f')](db['Dynamics365Account'][_0x2c10('0x30')]);_0x30f8ef[_0x2c10('0x1a')]=_[_0x2c10('0x2f')](_0x5c325c[_0x2c10('0x1a')]);_0x30f8ef[_0x2c10('0x1b')]=_['intersection'](_0x30f8ef[_0x2c10('0x18')],_0x30f8ef[_0x2c10('0x1a')]);_0x2b9bcf[_0x2c10('0x1d')]=_[_0x2c10('0x1c')](_0x30f8ef['model'],qs[_0x2c10('0x31')](_0x5c325c[_0x2c10('0x1a')][_0x2c10('0x31')]));_0x2b9bcf[_0x2c10('0x1d')]=_0x2b9bcf[_0x2c10('0x1d')]['length']?_0x2b9bcf[_0x2c10('0x1d')]:_0x30f8ef[_0x2c10('0x18')];if(_0x5c325c[_0x2c10('0x1a')][_0x2c10('0x2b')]){_0x2b9bcf['include']=[{'all':!![]}];}_0x2b9bcf=_[_0x2c10('0x27')]({},_0x2b9bcf,_0x5c325c[_0x2c10('0x2a')]);return db[_0x2c10('0x16')][_0x2c10('0x32')](_0x2b9bcf)[_0x2c10('0xe')](handleEntityNotFound(_0x315a5b,null))[_0x2c10('0xe')](respondWithResult(_0x315a5b,null))['catch'](handleError(_0x315a5b,null));};exports['create']=function(_0x38916d,_0x5bcc09){return db[_0x2c10('0x16')][_0x2c10('0x33')](_0x38916d[_0x2c10('0x34')],{})['then'](respondWithResult(_0x5bcc09,0xc9))['catch'](handleError(_0x5bcc09,null));};exports[_0x2c10('0x35')]=function(_0x2162ab,_0x5e317b){if(_0x2162ab[_0x2c10('0x34')]['id']){delete _0x2162ab[_0x2c10('0x34')]['id'];}return db[_0x2c10('0x16')]['find']({'where':{'id':_0x2162ab['params']['id']}})[_0x2c10('0xe')](handleEntityNotFound(_0x5e317b,null))[_0x2c10('0xe')](saveUpdates(_0x2162ab['body'],null))[_0x2c10('0xe')](respondWithResult(_0x5e317b,null))['catch'](handleError(_0x5e317b,null));};exports[_0x2c10('0xf')]=function(_0x5b9fc3,_0xab09d2){return db[_0x2c10('0x16')][_0x2c10('0x32')]({'where':{'id':_0x5b9fc3[_0x2c10('0x36')]['id']}})[_0x2c10('0xe')](handleEntityNotFound(_0xab09d2,null))[_0x2c10('0xe')](removeEntity(_0xab09d2,null))[_0x2c10('0x2e')](handleError(_0xab09d2,null));};exports[_0x2c10('0x37')]=function(_0x5c8eef,_0x2d4c35){var _0x14e354={};var _0x1cccc1={};var _0x28b9b2;var _0x2714ad;return db['Dynamics365Account']['findOne']({'where':{'id':_0x5c8eef[_0x2c10('0x36')]['id']}})[_0x2c10('0xe')](handleEntityNotFound(_0x2d4c35,null))[_0x2c10('0xe')](function(_0x469b87){if(_0x469b87){_0x28b9b2=_0x469b87;_0x1cccc1[_0x2c10('0x18')]=_[_0x2c10('0x2f')](db['Dynamics365Configuration'][_0x2c10('0x30')]);_0x1cccc1[_0x2c10('0x1a')]=_[_0x2c10('0x2f')](_0x5c8eef['query']);_0x1cccc1[_0x2c10('0x1b')]=_[_0x2c10('0x1c')](_0x1cccc1[_0x2c10('0x18')],_0x1cccc1[_0x2c10('0x1a')]);_0x14e354[_0x2c10('0x1d')]=_[_0x2c10('0x1c')](_0x1cccc1['model'],qs[_0x2c10('0x31')](_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0x31')]));_0x14e354['attributes']=_0x14e354[_0x2c10('0x1d')][_0x2c10('0x1e')]?_0x14e354[_0x2c10('0x1d')]:_0x1cccc1['model'];_0x14e354[_0x2c10('0x22')]=qs[_0x2c10('0x23')](_0x5c8eef['query'][_0x2c10('0x23')]);_0x14e354[_0x2c10('0x24')]=qs[_0x2c10('0x1b')](_[_0x2c10('0x25')](_0x5c8eef[_0x2c10('0x1a')],_0x1cccc1[_0x2c10('0x1b')]));if(_0x5c8eef[_0x2c10('0x1a')]['filter']){_0x14e354['where']=_[_0x2c10('0x27')](_0x14e354[_0x2c10('0x24')],{'$or':_[_0x2c10('0x19')](_0x14e354['attributes'],function(_0xcc1620){var _0xd5e7b2={};_0xd5e7b2[_0xcc1620]={'$like':'%'+_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0x26')]+'%'};return _0xd5e7b2;})});}_0x14e354=_[_0x2c10('0x27')]({},_0x14e354,_0x5c8eef[_0x2c10('0x2a')]);return _0x28b9b2['getConfigurations'](_0x14e354);}})['then'](function(_0x35a850){if(_0x35a850){_0x2714ad=_0x35a850[_0x2c10('0x1e')];if(!_0x5c8eef['query'][_0x2c10('0x1f')](_0x2c10('0x20'))){_0x14e354['limit']=qs[_0x2c10('0x21')](_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0x21')]);_0x14e354[_0x2c10('0xa')]=qs[_0x2c10('0xa')](_0x5c8eef[_0x2c10('0x1a')][_0x2c10('0xa')]);}return _0x28b9b2[_0x2c10('0x37')](_0x14e354);}})['then'](function(_0x422222){if(_0x422222){return _0x422222?{'count':_0x2714ad,'rows':_0x422222}:null;}})[_0x2c10('0xe')](respondWithResult(_0x2d4c35,null))[_0x2c10('0x2e')](handleError(_0x2d4c35,null));};exports[_0x2c10('0x38')]=function(_0xe7b3b3,_0x3e500f){if(_0xe7b3b3[_0x2c10('0x34')]['id']){delete _0xe7b3b3['body']['id'];}return db[_0x2c10('0x16')][_0x2c10('0x39')]({'where':{'id':_0xe7b3b3[_0x2c10('0x36')]['id']}})['then'](handleEntityNotFound(_0x3e500f,null))[_0x2c10('0xe')](function(_0x7941ac){if(_0x7941ac){_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x3a')]=_0x7941ac['id'];_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x3b')]=integrations[_0x2c10('0x3c')](_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x3d')],_0xe7b3b3[_0x2c10('0x34')][_0x2c10('0x28')]);_0xe7b3b3['body']['Descriptions']=integrations[_0x2c10('0x3e')](_0xe7b3b3[_0x2c10('0x34')]['channel'],_0xe7b3b3[_0x2c10('0x34')]['type']);return db['Dynamics365Configuration'][_0x2c10('0x33')](_0xe7b3b3[_0x2c10('0x34')],{'include':[{'model':db[_0x2c10('0x3f')],'as':_0x2c10('0x3b')},{'model':db[_0x2c10('0x3f')],'as':_0x2c10('0x40')}]});}return null;})[_0x2c10('0xe')](respondWithResult(_0x3e500f,null))[_0x2c10('0x2e')](handleError(_0x3e500f,null));};function sanitizeRemoteUri(_0x3b3a94){var _0xa8560f=_0x3b3a94[_0x2c10('0x41')](-0x1);if(_0xa8560f==='/')return _0x3b3a94[_0x2c10('0x42')](0x0,_0x3b3a94[_0x2c10('0x43')](_0xa8560f));return _0x3b3a94;}function getWebApiUrl(_0x2514fd){return util[_0x2c10('0x44')]('%s/api/data/v9.0/',_0x2514fd);}exports[_0x2c10('0x45')]=function(_0xd367a3,_0x3dc383){var _0x3b98a9=_0xd367a3[_0x2c10('0x1a')][_0x2c10('0x46')];var _0x41f56a=_0x3b98a9===_0x2c10('0x47')?_0x2c10('0x48'):_0x2c10('0x49');var _0x448648='';var _0x1da198='';var _0x1f357e='';var _0x45667f='';var _0x1a32db='';var _0x3c362f='';var _0x2dd6bd='';var _0x54a101='';var _0x392568=['title','description',_0x2c10('0x4a'),_0x2c10('0x4b'),'caseorigincode',_0x2c10('0x4c'),_0x2c10('0x4d'),_0x2c10('0x4e'),_0x2c10('0x4f'),'phonecall_activity_parties'];var _0xf01766=[_0x2c10('0x50'),_0x2c10('0x51'),'actualserviceunits',_0x2c10('0x52'),_0x2c10('0x53'),_0x2c10('0x54'),'contractdetailidname','contractidname',_0x2c10('0x55'),_0x2c10('0x56'),'createdbyname','createdbyyominame',_0x2c10('0x57'),_0x2c10('0x58'),'createdonbehalfbyyominame',_0x2c10('0x59'),_0x2c10('0x5a'),_0x2c10('0x5b'),_0x2c10('0x5c'),_0x2c10('0x5d'),_0x2c10('0x5e'),_0x2c10('0x5f'),_0x2c10('0x60'),_0x2c10('0x61'),_0x2c10('0x62'),_0x2c10('0x63'),_0x2c10('0x64'),_0x2c10('0x65'),_0x2c10('0x66'),'lastonholdtime',_0x2c10('0x67'),_0x2c10('0x68'),_0x2c10('0x69'),_0x2c10('0x6a'),_0x2c10('0x6b'),_0x2c10('0x6c'),_0x2c10('0x6d'),_0x2c10('0x6e'),'msdyn_incidenttypename',_0x2c10('0x6f'),'numberofchildincidents',_0x2c10('0x70'),_0x2c10('0x71'),_0x2c10('0x72'),_0x2c10('0x73'),_0x2c10('0x74'),_0x2c10('0x75'),_0x2c10('0x76'),'primarycontactidyominame','prioritycodename',_0x2c10('0x77'),_0x2c10('0x78'),_0x2c10('0x79'),_0x2c10('0x7a'),_0x2c10('0x7b'),_0x2c10('0x7c'),_0x2c10('0x7d'),_0x2c10('0x7e'),'slainvokedidname','slaname','socialprofileidname',_0x2c10('0x7f'),_0x2c10('0x80'),_0x2c10('0x81'),_0x2c10('0x82'),'timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber'];var _0x3c8de9=_0x392568[_0x2c10('0x83')](_0xf01766);return db[_0x2c10('0x16')][_0x2c10('0x39')]({'where':{'id':_0xd367a3[_0x2c10('0x36')]['id']},'attributes':['id',_0x2c10('0x84'),_0x2c10('0x85'),_0x2c10('0x86'),_0x2c10('0x87'),'clientId',_0x2c10('0x88'),'modernAuthentication'],'include':[{'model':db[_0x2c10('0x89')],'as':_0x2c10('0x89'),'attributes':['id','data5',_0x2c10('0x8a')]}]})[_0x2c10('0xe')](handleEntityNotFound(_0x3dc383,null))[_0x2c10('0xe')](function(_0x8bfb9){if(_0x8bfb9){if(_0x8bfb9[_0x2c10('0x8b')]){_0x8bfb9['access_token']=_0x8bfb9[_0x2c10('0x89')][_0x2c10('0x8c')];_0x54a101=sanitizeRemoteUri(_0x8bfb9[_0x2c10('0x89')][_0x2c10('0x8a')]);_0x2dd6bd=getWebApiUrl(_0x54a101);return _0x8bfb9;}_0x54a101=sanitizeRemoteUri(_0x8bfb9[_0x2c10('0x86')]);_0x2dd6bd=getWebApiUrl(_0x54a101);var _0x44e2be={'method':_0x2c10('0x8d'),'uri':_0x2c10('0x8e')+_0x8bfb9[_0x2c10('0x87')]+'/oauth2/token','form':{'client_id':_0x8bfb9[_0x2c10('0x8f')],'resource':_0x54a101,'username':_0x8bfb9[_0x2c10('0x84')],'password':_0x8bfb9[_0x2c10('0x85')],'grant_type':'password','client_secret':_0x8bfb9['clientSecret']},'json':!![]};return rp(_0x44e2be);}})[_0x2c10('0xe')](function(_0x3e4e4d){_0x3c362f=_0x3e4e4d[_0x2c10('0x90')];var _0x15079a={'method':_0x2c10('0x91'),'uri':encodeURI(_0x2dd6bd+_0x2c10('0x92')+_0x41f56a+'\x27'),'headers':{'Authorization':_0x2c10('0x93')+_0x3c362f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x15079a);})[_0x2c10('0xe')](function(_0x12e9fa){var _0x2d595a=_0x12e9fa['value'][0x0];var _0x34c329=_0x2d595a[_0x2c10('0x94')];var _0x5d1320={'method':'GET','uri':_0x2dd6bd+'EntityDefinitions('+_0x34c329+_0x2c10('0x95'),'headers':{'Authorization':_0x2c10('0x93')+_0x3c362f,'If-None-Match':null,'OData-Version':_0x2c10('0x96')},'json':!![]};return rp(_0x5d1320);})['then'](function(_0x63d866){_0x448648=_0x63d866;_0x1da198=_0x448648[_0x2c10('0x97')];_0x1da198=_[_0x2c10('0x98')](_0x1da198,function(_0x1d8bce){return!_0x3c8de9[_0x2c10('0x99')](_0x1d8bce[_0x2c10('0x9a')]);});var _0x1f3082=[];var _0xe1bca3=[];_0x1da198[_0x2c10('0x9b')](function(_0x29087e){if(_0x29087e[_0x2c10('0x9c')]){var _0x37ed4e=_0x29087e[_0x2c10('0x9c')][_0x2c10('0x42')](_0x29087e[_0x2c10('0x9c')][_0x2c10('0x43')]('.')+0x1);if(_0x37ed4e==='PicklistAttributeMetadata'){_0x1f3082[_0x2c10('0x9d')](getSelectList(_0x2dd6bd,_0x3b98a9,_0xe1bca3,_0x448648[_0x2c10('0x94')],_0x29087e[_0x2c10('0x94')],_0x3c362f));}}});return Promise[_0x2c10('0x9e')](_0x1f3082);})[_0x2c10('0xe')](function(_0x3a6b2c){_0x1f357e=_0x3a6b2c[0x0];var _0x5a5eab=[];var _0x46fbde=[];_0x1da198[_0x2c10('0x9b')](function(_0x4800fd){if(!_[_0x2c10('0x9f')](_0x4800fd[_0x2c10('0x9c')])){var _0xf17a90=_0x4800fd[_0x2c10('0x9c')][_0x2c10('0x42')](_0x4800fd['@odata.type'][_0x2c10('0x43')]('.')+0x1);if(_0xf17a90===_0x2c10('0xa0')){_0x5a5eab[_0x2c10('0x9d')](getBooleanList(_0x2dd6bd,_0x3b98a9,_0x46fbde,_0x448648[_0x2c10('0x94')],_0x4800fd[_0x2c10('0x94')],_0x3c362f));}}});return Promise[_0x2c10('0x9e')](_0x5a5eab);})[_0x2c10('0xe')](function(_0x23463b){_0x45667f=_0x23463b[0x0];var _0x4e9193=[];var _0x4906b3=[];_0x1da198[_0x2c10('0x9b')](function(_0x48183f){if(_0x48183f['@odata.type']){var _0x2ddf03=_0x48183f[_0x2c10('0x9c')][_0x2c10('0x42')](_0x48183f['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2ddf03===_0x2c10('0xa1')||_0x2ddf03===_0x2c10('0xa2')||_0x2ddf03===_0x2c10('0xa3')||_0x2ddf03===_0x2c10('0xa4')||_0x2ddf03===_0x2c10('0xa5')||_0x2ddf03===_0x2c10('0xa6')||_0x2ddf03===_0x2c10('0xa7')||_0x2ddf03===_0x2c10('0xa8')||_0x2ddf03==='StateAttributeMetadata'||_0x2ddf03===_0x2c10('0xa9')){_0x4e9193[_0x2c10('0x9d')](getInputList(_0x2dd6bd,_0x3b98a9,_0x2ddf03,_0x4906b3,_0x448648[_0x2c10('0x94')],_0x48183f[_0x2c10('0x94')],_0x3c362f));}}});return Promise[_0x2c10('0x9e')](_0x4e9193);})[_0x2c10('0xe')](function(_0x45cb90){_0x1a32db=_0x45cb90[0x0];var _0x1de71e=_0x1f357e[_0x2c10('0x83')](_0x45667f)['concat'](_0x1a32db);var _0xda56f8={'count':_0x1de71e[_0x2c10('0x1e')],'rows':_0x1de71e};return _0xda56f8;})[_0x2c10('0xe')](respondWithResult(_0x3dc383,null))['catch'](function(_0x17cb38){var _0x8690e7=_0xd367a3['query']['test']?0x1f4:_0x17cb38['statusCode']||0x1f4;logger['error'](_0x17cb38[_0x2c10('0xaa')]);delete _0x17cb38[_0x2c10('0x13')];if(_0x8690e7===0x191){_0x8690e7=0x190;}_0x3dc383['status'](_0x8690e7)[_0x2c10('0x14')](_0xd367a3[_0x2c10('0x1a')][_0x2c10('0xab')]?{'message':_0x2c10('0xac'),'statusCode':_0x17cb38[_0x2c10('0xad')]}:_0x17cb38);});};function getSelectList(_0xa4b6f9,_0x3251fe,_0x46ddf3,_0xbff0e9,_0x179e95,_0x79be92){var _0x27722b={'method':_0x2c10('0x91'),'uri':_0xa4b6f9+_0x2c10('0xae')+_0xbff0e9+_0x2c10('0xaf')+_0x179e95+_0x2c10('0xb0')+_0x2c10('0xb1'),'headers':{'Authorization':_0x2c10('0x93')+_0x79be92,'If-None-Match':null,'OData-Version':_0x2c10('0x96')},'json':!![]};return rp(_0x27722b)[_0x2c10('0xe')](function(_0x2058ff){var _0x28581b=[];var _0x5e8796=_0x2058ff[_0x2c10('0xb2')]['Options'];_0x5e8796[_0x2c10('0x9b')](function(_0x56302f){_0x28581b[_0x2c10('0x9d')]({'name':_0x56302f[_0x2c10('0xb3')][_0x2c10('0xb4')][_0x2c10('0xb3')],'value':String(_0x56302f[_0x2c10('0xb5')])});});var _0x5ac676={'id':_0x3251fe+'_'+_0x2058ff[_0x2c10('0x9a')],'name':_0x2058ff[_0x2c10('0xb6')][_0x2c10('0xb4')][_0x2c10('0xb3')],'custom':![],'options':_0x28581b};_0x46ddf3[_0x2c10('0x9d')](_0x5ac676);return _0x46ddf3;});}function getBooleanList(_0x99185,_0x464347,_0x113ef2,_0x3774da,_0x39379a,_0x43afff){var _0x2335e8={'method':'GET','uri':_0x99185+_0x2c10('0xae')+_0x3774da+_0x2c10('0xaf')+_0x39379a+_0x2c10('0xb7'),'headers':{'Authorization':_0x2c10('0x93')+_0x43afff,'If-None-Match':null,'OData-Version':_0x2c10('0x96')},'json':!![]};return rp(_0x2335e8)['then'](function(_0x19006b){var _0xf523a9=[];_0xf523a9[_0x2c10('0x9d')]({'name':_0x19006b[_0x2c10('0xb2')][_0x2c10('0xb8')][_0x2c10('0xb3')][_0x2c10('0xb4')]['Label'],'value':_0x2c10('0xb9')},{'name':_0x19006b[_0x2c10('0xb2')][_0x2c10('0xba')][_0x2c10('0xb3')][_0x2c10('0xb4')][_0x2c10('0xb3')],'value':'false'});var _0x2de8ed={'id':_0x464347+'_'+_0x19006b[_0x2c10('0x9a')],'name':_0x19006b[_0x2c10('0xb6')][_0x2c10('0xb4')]['Label'],'custom':![],'options':_0xf523a9};_0x113ef2['push'](_0x2de8ed);return _0x113ef2;});}function getInputList(_0x54cf51,_0x15c1c3,_0x51b9fa,_0x47e99c,_0x1aef97,_0x465894,_0xcf874d){var _0x744020={'method':_0x2c10('0x91'),'uri':_0x54cf51+'EntityDefinitions('+_0x1aef97+')/Attributes('+_0x465894+')/Microsoft.Dynamics.CRM.'+_0x51b9fa+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0xcf874d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x744020)['then'](function(_0x3e6c2b){var _0x3f281e={'id':_0x15c1c3+'_'+_0x3e6c2b['LogicalName'],'name':_0x3e6c2b[_0x2c10('0xb6')][_0x2c10('0xb4')]?_0x3e6c2b[_0x2c10('0xb6')][_0x2c10('0xb4')][_0x2c10('0xb3')]:_0x3e6c2b['LogicalName'],'custom':![],'options':[]};_0x47e99c[_0x2c10('0x9d')](_0x3f281e);return _0x47e99c;});} \ No newline at end of file +var _0x0825=['ticketType','incident','Incident','PhoneCall','title','description','customerid','subject','phonenumber','regardingobjectid','directioncode','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','parentcaseidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','tenantId','/oauth2/token','username','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(','Attributes','remove','forEach','@odata.type','PicklistAttributeMetadata','push','all','BooleanAttributeMetadata','substring','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','test','statusCode','error','stack','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','LogicalName','DisplayName','GET',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','util','../../config/logger','api','../../components/integrations/configuration','status','json','offset','undefined','limit','count','set','Content-Range','update','then','end','sendStatus','name','index','map','Dynamics365Account','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','keys','fields','include','create','body','params','find','getConfigurations','findOne','Dynamics365Configuration','rawAttributes','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','lastIndexOf','getFields'];(function(_0x31aa4b,_0x468550){var _0x49f208=function(_0x53468e){while(--_0x53468e){_0x31aa4b['push'](_0x31aa4b['shift']());}};_0x49f208(++_0x468550);}(_0x0825,0x1e4));var _0x5082=function(_0x20228c,_0x32a2d3){_0x20228c=_0x20228c-0x0;var _0x3569d9=_0x0825[_0x20228c];return _0x3569d9;};'use strict';var rp=require(_0x5082('0x0'));var util=require(_0x5082('0x1'));var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x5082('0x2'))(_0x5082('0x3'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5082('0x4'));function respondWithResult(_0x3bcfa4,_0x1caa92){_0x1caa92=_0x1caa92||0xc8;return function(_0x236f91){if(_0x236f91){return _0x3bcfa4[_0x5082('0x5')](_0x1caa92)[_0x5082('0x6')](_0x236f91);}};}function respondWithFilteredResult(_0x5a119b,_0x4f9333){return function(_0x56d90d){if(_0x56d90d){var _0x58bf06=typeof _0x4f9333[_0x5082('0x7')]===_0x5082('0x8')&&typeof _0x4f9333[_0x5082('0x9')]===_0x5082('0x8');var _0x5914c7=_0x56d90d[_0x5082('0xa')];var _0x12ec1c=_0x58bf06?0x0:_0x4f9333[_0x5082('0x7')];var _0x35e6c2=_0x58bf06?_0x56d90d[_0x5082('0xa')]:_0x4f9333[_0x5082('0x7')]+_0x4f9333[_0x5082('0x9')];var _0x458276;if(_0x35e6c2>=_0x5914c7){_0x35e6c2=_0x5914c7;_0x458276=0xc8;}else{_0x458276=0xce;}_0x5a119b[_0x5082('0x5')](_0x458276);return _0x5a119b[_0x5082('0xb')](_0x5082('0xc'),_0x12ec1c+'-'+_0x35e6c2+'/'+_0x5914c7)[_0x5082('0x6')](_0x56d90d);}return null;};}function saveUpdates(_0x204608){return function(_0x3504b6){if(_0x3504b6){return _0x3504b6[_0x5082('0xd')](_0x204608)['then'](function(_0x108128){return _0x108128;});}return null;};}function removeEntity(_0x3f994c){return function(_0x1c8770){if(_0x1c8770){return _0x1c8770['destroy']()[_0x5082('0xe')](function(){_0x3f994c[_0x5082('0x5')](0xcc)[_0x5082('0xf')]();});}};}function handleEntityNotFound(_0xc90fd1){return function(_0x19f070){if(!_0x19f070){_0xc90fd1[_0x5082('0x10')](0x194);}return _0x19f070;};}function handleError(_0x306c6c,_0x464963){_0x464963=_0x464963||0x1f4;return function(_0x571cd0){logger['error'](_0x571cd0['stack']);if(_0x571cd0[_0x5082('0x11')]){delete _0x571cd0[_0x5082('0x11')];}_0x306c6c[_0x5082('0x5')](_0x464963)['send'](_0x571cd0);};}exports[_0x5082('0x12')]=function(_0x267096,_0x1563e9){var _0x5b7a3d={},_0x42961f={},_0x25707c={'count':0x0,'rows':[]};var _0x59f438=_[_0x5082('0x13')](db[_0x5082('0x14')]['rawAttributes'],function(_0x47be0a){return{'name':_0x47be0a['fieldName'],'type':_0x47be0a[_0x5082('0x15')]['key']};});_0x42961f[_0x5082('0x16')]=_[_0x5082('0x13')](_0x59f438,_0x5082('0x11'));_0x42961f['query']=_['keys'](_0x267096[_0x5082('0x17')]);_0x42961f[_0x5082('0x18')]=_[_0x5082('0x19')](_0x42961f['model'],_0x42961f[_0x5082('0x17')]);_0x5b7a3d[_0x5082('0x1a')]=_['intersection'](_0x42961f['model'],qs['fields'](_0x267096['query']['fields']));_0x5b7a3d['attributes']=_0x5b7a3d['attributes'][_0x5082('0x1b')]?_0x5b7a3d[_0x5082('0x1a')]:_0x42961f[_0x5082('0x16')];if(!_0x267096[_0x5082('0x17')][_0x5082('0x1c')](_0x5082('0x1d'))){_0x5b7a3d['limit']=qs[_0x5082('0x9')](_0x267096[_0x5082('0x17')]['limit']);_0x5b7a3d[_0x5082('0x7')]=qs[_0x5082('0x7')](_0x267096[_0x5082('0x17')][_0x5082('0x7')]);}_0x5b7a3d[_0x5082('0x1e')]=qs[_0x5082('0x1f')](_0x267096[_0x5082('0x17')]['sort']);_0x5b7a3d[_0x5082('0x20')]=qs[_0x5082('0x18')](_[_0x5082('0x21')](_0x267096[_0x5082('0x17')],_0x42961f[_0x5082('0x18')]),_0x59f438);if(_0x267096[_0x5082('0x17')][_0x5082('0x22')]){_0x5b7a3d['where']=_[_0x5082('0x23')](_0x5b7a3d['where'],{'$or':_[_0x5082('0x13')](_0x59f438,function(_0x51c332){if(_0x51c332[_0x5082('0x15')]!=='VIRTUAL'){var _0x1c8a20={};_0x1c8a20[_0x51c332['name']]={'$like':'%'+_0x267096[_0x5082('0x17')][_0x5082('0x22')]+'%'};return _0x1c8a20;}})});}_0x5b7a3d=_[_0x5082('0x23')]({},_0x5b7a3d,_0x267096[_0x5082('0x24')]);var _0x51638d={'where':_0x5b7a3d[_0x5082('0x20')]};return db[_0x5082('0x14')][_0x5082('0xa')](_0x51638d)[_0x5082('0xe')](function(_0x48898b){_0x25707c[_0x5082('0xa')]=_0x48898b;if(_0x267096[_0x5082('0x17')][_0x5082('0x25')]){_0x5b7a3d['include']=[{'all':!![]}];}return db[_0x5082('0x14')][_0x5082('0x26')](_0x5b7a3d);})[_0x5082('0xe')](function(_0x10420d){_0x25707c[_0x5082('0x27')]=_0x10420d;return _0x25707c;})[_0x5082('0xe')](respondWithFilteredResult(_0x1563e9,_0x5b7a3d))[_0x5082('0x28')](handleError(_0x1563e9,null));};exports[_0x5082('0x29')]=function(_0x110a6b,_0x51d3fd){var _0x1efb17={'raw':![],'where':{'id':_0x110a6b['params']['id']}},_0x54e339={};_0x54e339[_0x5082('0x16')]=_[_0x5082('0x2a')](db['Dynamics365Account']['rawAttributes']);_0x54e339[_0x5082('0x17')]=_[_0x5082('0x2a')](_0x110a6b[_0x5082('0x17')]);_0x54e339[_0x5082('0x18')]=_['intersection'](_0x54e339[_0x5082('0x16')],_0x54e339[_0x5082('0x17')]);_0x1efb17[_0x5082('0x1a')]=_[_0x5082('0x19')](_0x54e339['model'],qs['fields'](_0x110a6b[_0x5082('0x17')][_0x5082('0x2b')]));_0x1efb17[_0x5082('0x1a')]=_0x1efb17[_0x5082('0x1a')]['length']?_0x1efb17['attributes']:_0x54e339[_0x5082('0x16')];if(_0x110a6b[_0x5082('0x17')][_0x5082('0x25')]){_0x1efb17[_0x5082('0x2c')]=[{'all':!![]}];}_0x1efb17=_[_0x5082('0x23')]({},_0x1efb17,_0x110a6b[_0x5082('0x24')]);return db[_0x5082('0x14')]['find'](_0x1efb17)['then'](handleEntityNotFound(_0x51d3fd,null))['then'](respondWithResult(_0x51d3fd,null))['catch'](handleError(_0x51d3fd,null));};exports['create']=function(_0x1193ec,_0xf4246b){return db[_0x5082('0x14')][_0x5082('0x2d')](_0x1193ec['body'],{})['then'](respondWithResult(_0xf4246b,0xc9))['catch'](handleError(_0xf4246b,null));};exports['update']=function(_0x29ca4e,_0x1f0e1d){if(_0x29ca4e['body']['id']){delete _0x29ca4e[_0x5082('0x2e')]['id'];}return db[_0x5082('0x14')]['find']({'where':{'id':_0x29ca4e[_0x5082('0x2f')]['id']}})[_0x5082('0xe')](handleEntityNotFound(_0x1f0e1d,null))[_0x5082('0xe')](saveUpdates(_0x29ca4e[_0x5082('0x2e')],null))[_0x5082('0xe')](respondWithResult(_0x1f0e1d,null))[_0x5082('0x28')](handleError(_0x1f0e1d,null));};exports['destroy']=function(_0x13d0a6,_0x4cc177){return db[_0x5082('0x14')][_0x5082('0x30')]({'where':{'id':_0x13d0a6[_0x5082('0x2f')]['id']}})[_0x5082('0xe')](handleEntityNotFound(_0x4cc177,null))[_0x5082('0xe')](removeEntity(_0x4cc177,null))[_0x5082('0x28')](handleError(_0x4cc177,null));};exports[_0x5082('0x31')]=function(_0x1f07b0,_0x365913){var _0x541040={};var _0x5c2bf7={};var _0x395f8f;var _0x4b9f4c;return db[_0x5082('0x14')][_0x5082('0x32')]({'where':{'id':_0x1f07b0[_0x5082('0x2f')]['id']}})[_0x5082('0xe')](handleEntityNotFound(_0x365913,null))[_0x5082('0xe')](function(_0x3336a4){if(_0x3336a4){_0x395f8f=_0x3336a4;_0x5c2bf7[_0x5082('0x16')]=_['keys'](db[_0x5082('0x33')][_0x5082('0x34')]);_0x5c2bf7[_0x5082('0x17')]=_[_0x5082('0x2a')](_0x1f07b0[_0x5082('0x17')]);_0x5c2bf7[_0x5082('0x18')]=_[_0x5082('0x19')](_0x5c2bf7[_0x5082('0x16')],_0x5c2bf7[_0x5082('0x17')]);_0x541040[_0x5082('0x1a')]=_[_0x5082('0x19')](_0x5c2bf7[_0x5082('0x16')],qs[_0x5082('0x2b')](_0x1f07b0[_0x5082('0x17')][_0x5082('0x2b')]));_0x541040[_0x5082('0x1a')]=_0x541040['attributes']['length']?_0x541040[_0x5082('0x1a')]:_0x5c2bf7[_0x5082('0x16')];_0x541040[_0x5082('0x1e')]=qs[_0x5082('0x1f')](_0x1f07b0['query'][_0x5082('0x1f')]);_0x541040['where']=qs[_0x5082('0x18')](_[_0x5082('0x21')](_0x1f07b0[_0x5082('0x17')],_0x5c2bf7[_0x5082('0x18')]));if(_0x1f07b0[_0x5082('0x17')]['filter']){_0x541040[_0x5082('0x20')]=_[_0x5082('0x23')](_0x541040[_0x5082('0x20')],{'$or':_[_0x5082('0x13')](_0x541040[_0x5082('0x1a')],function(_0x46f136){var _0x3ac71c={};_0x3ac71c[_0x46f136]={'$like':'%'+_0x1f07b0[_0x5082('0x17')][_0x5082('0x22')]+'%'};return _0x3ac71c;})});}_0x541040=_[_0x5082('0x23')]({},_0x541040,_0x1f07b0[_0x5082('0x24')]);return _0x395f8f['getConfigurations'](_0x541040);}})['then'](function(_0x35abc2){if(_0x35abc2){_0x4b9f4c=_0x35abc2[_0x5082('0x1b')];if(!_0x1f07b0[_0x5082('0x17')][_0x5082('0x1c')](_0x5082('0x1d'))){_0x541040['limit']=qs[_0x5082('0x9')](_0x1f07b0[_0x5082('0x17')][_0x5082('0x9')]);_0x541040[_0x5082('0x7')]=qs[_0x5082('0x7')](_0x1f07b0[_0x5082('0x17')][_0x5082('0x7')]);}return _0x395f8f[_0x5082('0x31')](_0x541040);}})[_0x5082('0xe')](function(_0x1a7e28){if(_0x1a7e28){return _0x1a7e28?{'count':_0x4b9f4c,'rows':_0x1a7e28}:null;}})['then'](respondWithResult(_0x365913,null))[_0x5082('0x28')](handleError(_0x365913,null));};exports[_0x5082('0x35')]=function(_0x3b904f,_0x55266c){if(_0x3b904f[_0x5082('0x2e')]['id']){delete _0x3b904f[_0x5082('0x2e')]['id'];}return db[_0x5082('0x14')][_0x5082('0x32')]({'where':{'id':_0x3b904f[_0x5082('0x2f')]['id']}})[_0x5082('0xe')](handleEntityNotFound(_0x55266c,null))[_0x5082('0xe')](function(_0x393f50){if(_0x393f50){_0x3b904f[_0x5082('0x2e')][_0x5082('0x36')]=_0x393f50['id'];_0x3b904f[_0x5082('0x2e')]['Subjects']=integrations[_0x5082('0x37')](_0x3b904f['body'][_0x5082('0x38')],_0x3b904f[_0x5082('0x2e')][_0x5082('0x15')]);_0x3b904f[_0x5082('0x2e')][_0x5082('0x39')]=integrations[_0x5082('0x3a')](_0x3b904f[_0x5082('0x2e')][_0x5082('0x38')],_0x3b904f[_0x5082('0x2e')][_0x5082('0x15')]);return db[_0x5082('0x33')][_0x5082('0x2d')](_0x3b904f[_0x5082('0x2e')],{'include':[{'model':db[_0x5082('0x3b')],'as':'Subjects'},{'model':db[_0x5082('0x3b')],'as':_0x5082('0x39')}]});}return null;})[_0x5082('0xe')](respondWithResult(_0x55266c,null))[_0x5082('0x28')](handleError(_0x55266c,null));};function sanitizeRemoteUri(_0x2315b9){var _0x6e04c4=_0x2315b9['slice'](-0x1);if(_0x6e04c4==='/')return _0x2315b9['substring'](0x0,_0x2315b9[_0x5082('0x3c')](_0x6e04c4));return _0x2315b9;}function getWebApiUrl(_0x118d00){return util['format']('%s/api/data/v9.0/',_0x118d00);}exports[_0x5082('0x3d')]=function(_0x50f01b,_0x4d67c8){var _0x42f938=_0x50f01b[_0x5082('0x17')][_0x5082('0x3e')];var _0x31cbf7=_0x42f938===_0x5082('0x3f')?_0x5082('0x40'):_0x5082('0x41');var _0x272727='';var _0xd3d28c='';var _0x34a96c='';var _0xa90bf5='';var _0x59634a='';var _0x11f075='';var _0x42afaf='';var _0xc6418e='';var _0x367ecb=[_0x5082('0x42'),_0x5082('0x43'),_0x5082('0x44'),'ownerid','caseorigincode',_0x5082('0x45'),_0x5082('0x46'),_0x5082('0x47'),_0x5082('0x48'),'phonecall_activity_parties'];var _0x20261d=['accountidname',_0x5082('0x49'),_0x5082('0x4a'),_0x5082('0x4b'),_0x5082('0x4c'),_0x5082('0x4d'),_0x5082('0x4e'),_0x5082('0x4f'),_0x5082('0x50'),_0x5082('0x51'),_0x5082('0x52'),_0x5082('0x53'),_0x5082('0x54'),_0x5082('0x55'),_0x5082('0x56'),_0x5082('0x57'),'customeridtype',_0x5082('0x58'),'emailaddress',_0x5082('0x59'),_0x5082('0x5a'),'entityimage_url',_0x5082('0x5b'),_0x5082('0x5c'),_0x5082('0x5d'),_0x5082('0x5e'),_0x5082('0x5f'),_0x5082('0x60'),'kbarticleidname',_0x5082('0x61'),_0x5082('0x62'),_0x5082('0x63'),_0x5082('0x64'),_0x5082('0x65'),'modifiedbyyominame',_0x5082('0x66'),_0x5082('0x67'),'modifiedonbehalfbyyominame','msdyn_incidenttypename',_0x5082('0x68'),_0x5082('0x69'),'onholdtime',_0x5082('0x6a'),_0x5082('0x6b'),_0x5082('0x6c'),'owneridyominame',_0x5082('0x6d'),'primarycontactidname','primarycontactidyominame','prioritycodename','productidname',_0x5082('0x6e'),_0x5082('0x6f'),_0x5082('0x70'),'responseby','responsiblecontactidname',_0x5082('0x71'),'sentimentvalue',_0x5082('0x72'),_0x5082('0x73'),_0x5082('0x74'),_0x5082('0x75'),'statuscode',_0x5082('0x76'),_0x5082('0x77'),_0x5082('0x78'),_0x5082('0x79'),_0x5082('0x7a'),_0x5082('0x7b'),_0x5082('0x7c')];var _0x2e22fe=_0x367ecb[_0x5082('0x7d')](_0x20261d);return db['Dynamics365Account'][_0x5082('0x32')]({'where':{'id':_0x50f01b['params']['id']},'attributes':['id','username',_0x5082('0x7e'),_0x5082('0x7f'),'tenantId',_0x5082('0x80'),_0x5082('0x81'),_0x5082('0x82')],'include':[{'model':db['CloudProvider'],'as':_0x5082('0x83'),'attributes':['id',_0x5082('0x84'),_0x5082('0x85')]}]})[_0x5082('0xe')](handleEntityNotFound(_0x4d67c8,null))[_0x5082('0xe')](function(_0x4dfb1c){if(_0x4dfb1c){if(_0x4dfb1c[_0x5082('0x82')]){_0x4dfb1c[_0x5082('0x86')]=_0x4dfb1c[_0x5082('0x83')][_0x5082('0x84')];_0xc6418e=sanitizeRemoteUri(_0x4dfb1c[_0x5082('0x83')][_0x5082('0x85')]);_0x42afaf=getWebApiUrl(_0xc6418e);return _0x4dfb1c;}_0xc6418e=sanitizeRemoteUri(_0x4dfb1c[_0x5082('0x7f')]);_0x42afaf=getWebApiUrl(_0xc6418e);var _0x41182c={'method':'POST','uri':'https://login.microsoftonline.com/'+_0x4dfb1c[_0x5082('0x87')]+_0x5082('0x88'),'form':{'client_id':_0x4dfb1c[_0x5082('0x80')],'resource':_0xc6418e,'username':_0x4dfb1c[_0x5082('0x89')],'password':_0x4dfb1c['password'],'grant_type':_0x5082('0x7e'),'client_secret':_0x4dfb1c[_0x5082('0x81')]},'json':!![]};return rp(_0x41182c);}})[_0x5082('0xe')](function(_0x4c6121){_0x11f075=_0x4c6121[_0x5082('0x86')];var _0x539315={'method':'GET','uri':encodeURI(_0x42afaf+_0x5082('0x8a')+_0x31cbf7+'\x27'),'headers':{'Authorization':_0x5082('0x8b')+_0x11f075,'If-None-Match':null,'OData-Version':_0x5082('0x8c')},'json':!![]};return rp(_0x539315);})[_0x5082('0xe')](function(_0x3af089){var _0x1454b0=_0x3af089['value'][0x0];var _0xbed56c=_0x1454b0[_0x5082('0x8d')];var _0x49e7a6={'method':'GET','uri':_0x42afaf+_0x5082('0x8e')+_0xbed56c+')?$select=LogicalName&$expand=Attributes($select=LogicalName)','headers':{'Authorization':'Bearer\x20'+_0x11f075,'If-None-Match':null,'OData-Version':_0x5082('0x8c')},'json':!![]};return rp(_0x49e7a6);})[_0x5082('0xe')](function(_0x4d698b){_0x272727=_0x4d698b;_0xd3d28c=_0x272727[_0x5082('0x8f')];_0xd3d28c=_[_0x5082('0x90')](_0xd3d28c,function(_0x155dd2){return!_0x2e22fe['includes'](_0x155dd2['LogicalName']);});var _0x3e3f9a=[];var _0x158735=[];_0xd3d28c[_0x5082('0x91')](function(_0x4a4329){if(_0x4a4329[_0x5082('0x92')]){var _0x149fd7=_0x4a4329[_0x5082('0x92')]['substring'](_0x4a4329[_0x5082('0x92')][_0x5082('0x3c')]('.')+0x1);if(_0x149fd7===_0x5082('0x93')){_0x3e3f9a[_0x5082('0x94')](getSelectList(_0x42afaf,_0x42f938,_0x158735,_0x272727['MetadataId'],_0x4a4329[_0x5082('0x8d')],_0x11f075));}}});return Promise[_0x5082('0x95')](_0x3e3f9a);})[_0x5082('0xe')](function(_0x19dd6d){_0x34a96c=_0x19dd6d[0x0];var _0x344b09=[];var _0x15dcfc=[];_0xd3d28c[_0x5082('0x91')](function(_0x37b8a5){if(!_['isNil'](_0x37b8a5[_0x5082('0x92')])){var _0x3dbba0=_0x37b8a5[_0x5082('0x92')]['substring'](_0x37b8a5[_0x5082('0x92')][_0x5082('0x3c')]('.')+0x1);if(_0x3dbba0===_0x5082('0x96')){_0x344b09['push'](getBooleanList(_0x42afaf,_0x42f938,_0x15dcfc,_0x272727[_0x5082('0x8d')],_0x37b8a5['MetadataId'],_0x11f075));}}});return Promise[_0x5082('0x95')](_0x344b09);})[_0x5082('0xe')](function(_0x45891a){_0xa90bf5=_0x45891a[0x0];var _0x225b6d=[];var _0x2d88ce=[];_0xd3d28c['forEach'](function(_0x3014c7){if(_0x3014c7[_0x5082('0x92')]){var _0x1e2699=_0x3014c7[_0x5082('0x92')][_0x5082('0x97')](_0x3014c7['@odata.type'][_0x5082('0x3c')]('.')+0x1);if(_0x1e2699===_0x5082('0x98')||_0x1e2699===_0x5082('0x99')||_0x1e2699===_0x5082('0x9a')||_0x1e2699===_0x5082('0x9b')||_0x1e2699===_0x5082('0x9c')||_0x1e2699==='DateTimeAttributeMetadata'||_0x1e2699===_0x5082('0x9d')||_0x1e2699===_0x5082('0x9e')||_0x1e2699==='StateAttributeMetadata'||_0x1e2699===_0x5082('0x9f')){_0x225b6d[_0x5082('0x94')](getInputList(_0x42afaf,_0x42f938,_0x1e2699,_0x2d88ce,_0x272727[_0x5082('0x8d')],_0x3014c7['MetadataId'],_0x11f075));}}});return Promise[_0x5082('0x95')](_0x225b6d);})['then'](function(_0x41bc38){_0x59634a=_0x41bc38[0x0];var _0x21ed54=_0x34a96c['concat'](_0xa90bf5)[_0x5082('0x7d')](_0x59634a);var _0xe05772={'count':_0x21ed54[_0x5082('0x1b')],'rows':_0x21ed54};return _0xe05772;})['then'](respondWithResult(_0x4d67c8,null))[_0x5082('0x28')](function(_0x30ead1){var _0x4abe9d=_0x50f01b[_0x5082('0x17')][_0x5082('0xa0')]?0x1f4:_0x30ead1[_0x5082('0xa1')]||0x1f4;logger[_0x5082('0xa2')](_0x30ead1[_0x5082('0xa3')]);delete _0x30ead1[_0x5082('0x11')];if(_0x4abe9d===0x191){_0x4abe9d=0x190;}_0x4d67c8[_0x5082('0x5')](_0x4abe9d)[_0x5082('0xa4')](_0x50f01b['query']['test']?{'message':_0x5082('0xa5'),'statusCode':_0x30ead1[_0x5082('0xa1')]}:_0x30ead1);});};function getSelectList(_0x5045c5,_0x272ed3,_0xb5dcae,_0xe38408,_0x4a3940,_0x1d18c8){var _0x3ca7c6={'method':'GET','uri':_0x5045c5+'EntityDefinitions('+_0xe38408+_0x5082('0xa6')+_0x4a3940+_0x5082('0xa7')+_0x5082('0xa8'),'headers':{'Authorization':_0x5082('0x8b')+_0x1d18c8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ca7c6)['then'](function(_0x461e95){var _0x37ac80=[];var _0x12422c=_0x461e95[_0x5082('0xa9')][_0x5082('0xaa')];_0x12422c['forEach'](function(_0xa2b029){_0x37ac80['push']({'name':_0xa2b029[_0x5082('0xab')][_0x5082('0xac')]['Label'],'value':String(_0xa2b029['Value'])});});var _0x8573f6={'id':_0x272ed3+'_'+_0x461e95[_0x5082('0xad')],'name':_0x461e95[_0x5082('0xae')]['UserLocalizedLabel'][_0x5082('0xab')],'custom':![],'options':_0x37ac80};_0xb5dcae['push'](_0x8573f6);return _0xb5dcae;});}function getBooleanList(_0x502d15,_0x545299,_0x4b5cc8,_0x183b6e,_0x2f147c,_0x27dc58){var _0xbec4d3={'method':_0x5082('0xaf'),'uri':_0x502d15+_0x5082('0x8e')+_0x183b6e+_0x5082('0xa6')+_0x2f147c+_0x5082('0xb0'),'headers':{'Authorization':_0x5082('0x8b')+_0x27dc58,'If-None-Match':null,'OData-Version':_0x5082('0x8c')},'json':!![]};return rp(_0xbec4d3)[_0x5082('0xe')](function(_0x3fec21){var _0xd418f1=[];_0xd418f1['push']({'name':_0x3fec21[_0x5082('0xa9')]['TrueOption'][_0x5082('0xab')][_0x5082('0xac')][_0x5082('0xab')],'value':_0x5082('0xb1')},{'name':_0x3fec21[_0x5082('0xa9')][_0x5082('0xb2')][_0x5082('0xab')]['UserLocalizedLabel'][_0x5082('0xab')],'value':_0x5082('0xb3')});var _0xa21c36={'id':_0x545299+'_'+_0x3fec21['LogicalName'],'name':_0x3fec21[_0x5082('0xae')][_0x5082('0xac')][_0x5082('0xab')],'custom':![],'options':_0xd418f1};_0x4b5cc8[_0x5082('0x94')](_0xa21c36);return _0x4b5cc8;});}function getInputList(_0x23c200,_0x28296,_0x326ad4,_0x5bfcb6,_0x27e51b,_0x380ac0,_0x5c344d){var _0x58c388={'method':'GET','uri':_0x23c200+_0x5082('0x8e')+_0x27e51b+_0x5082('0xa6')+_0x380ac0+_0x5082('0xb4')+_0x326ad4+_0x5082('0xb5'),'headers':{'Authorization':_0x5082('0x8b')+_0x5c344d,'If-None-Match':null,'OData-Version':_0x5082('0x8c')},'json':!![]};return rp(_0x58c388)[_0x5082('0xe')](function(_0x218de2){var _0xd918b8={'id':_0x28296+'_'+_0x218de2[_0x5082('0xad')],'name':_0x218de2[_0x5082('0xae')]['UserLocalizedLabel']?_0x218de2[_0x5082('0xae')][_0x5082('0xac')]['Label']:_0x218de2[_0x5082('0xad')],'custom':![],'options':[]};_0x5bfcb6['push'](_0xd918b8);return _0x5bfcb6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index eac1a80..efb1ffd 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x1a97d6,_0x126868){var _0x4c4ff0=function(_0x54a475){while(--_0x54a475){_0x1a97d6['push'](_0x1a97d6['shift']());}};_0x4c4ff0(++_0x126868);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));var integrations=require(_0x0a9e('0x8'));module['exports']=function(_0x219af0,_0x441e3a){return _0x219af0[_0x0a9e('0x9')]('Dynamics365Account',attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x38bdf5,_0x264e8b){var _0x23e20e=function(_0x5a3823){while(--_0x5a3823){_0x38bdf5['push'](_0x38bdf5['shift']());}};_0x23e20e(++_0x264e8b);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 12783f5..23c0a2f 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 _0x357e=['../../config/logger','rpc','jayson/promise','client','http','request','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','info','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x2a0377,_0x429843){var _0x42304f=function(_0x372d3e){while(--_0x372d3e){_0x2a0377['push'](_0x2a0377['shift']());}};_0x42304f(++_0x429843);}(_0x357e,0x1c2));var _0xe357=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x357e[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0xe357('0x0'));var util=require('util');var moment=require(_0xe357('0x1'));var BPromise=require(_0xe357('0x2'));var rs=require(_0xe357('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe357('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe357('0x5'))(_0xe357('0x6'));var config=require('../../config/environment');var jayson=require(_0xe357('0x7'));var client=jayson[_0xe357('0x8')][_0xe357('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d61fc,_0x143654,_0x2dc298){return new BPromise(function(_0x41f2a2,_0x31b8d2){return client[_0xe357('0xa')](_0x3d61fc,_0x2dc298)['then'](function(_0x33394a){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x143654,_0xe357('0xb'));logger[_0xe357('0xc')](_0xe357('0xd'),_0x143654,'request\x20sent',JSON[_0xe357('0xe')](_0x33394a));if(_0x33394a[_0xe357('0xf')]){if(_0x33394a['error']['code']===0x1f4){logger[_0xe357('0xf')](_0xe357('0x10'),_0x143654,_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);return _0x31b8d2(_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);}logger[_0xe357('0xf')]('Dynamics365Account,\x20%s,\x20%s',_0x143654,_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);return _0x41f2a2(_0x33394a[_0xe357('0xf')][_0xe357('0x11')]);}else{logger[_0xe357('0x12')](_0xe357('0x10'),_0x143654,_0xe357('0xb'));_0x41f2a2(_0x33394a[_0xe357('0x13')][_0xe357('0x11')]);}})[_0xe357('0x14')](function(_0x25bd30){logger[_0xe357('0xf')](_0xe357('0x10'),_0x143654,_0x25bd30);_0x31b8d2(_0x25bd30);});});}exports[_0xe357('0x15')]=function(_0xe05fbf){var _0x4938c2=this;return new Promise(function(_0x3f400f,_0x543bef){return db['Dynamics365Account'][_0xe357('0x16')]({'raw':_0xe05fbf[_0xe357('0x17')]?_0xe05fbf['options'][_0xe357('0x18')]===undefined?!![]:![]:!![],'where':_0xe05fbf['options']?_0xe05fbf['options'][_0xe357('0x19')]||null:null,'attributes':_0xe05fbf['options']?_0xe05fbf[_0xe357('0x17')][_0xe357('0x1a')]||null:null,'limit':_0xe05fbf[_0xe357('0x17')]?_0xe05fbf[_0xe357('0x17')][_0xe357('0x1b')]||null:null,'include':_0xe05fbf[_0xe357('0x17')]?_0xe05fbf['options'][_0xe357('0x1c')]?_['map'](_0xe05fbf[_0xe357('0x17')][_0xe357('0x1c')],function(_0x175b4b){return{'model':db[_0x175b4b[_0xe357('0x1d')]],'as':_0x175b4b['as'],'attributes':_0x175b4b[_0xe357('0x1a')],'include':_0x175b4b[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0x175b4b[_0xe357('0x1c')],function(_0xad10f6){return{'model':db[_0xad10f6['model']],'as':_0xad10f6['as'],'attributes':_0xad10f6[_0xe357('0x1a')],'include':_0xad10f6[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0xad10f6[_0xe357('0x1c')],function(_0x5b5feb){return{'model':db[_0x5b5feb[_0xe357('0x1d')]],'as':_0x5b5feb['as'],'attributes':_0x5b5feb[_0xe357('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe357('0x1f')](function(_0x5d2352){logger[_0xe357('0x12')](_0xe357('0x15'),_0xe05fbf);logger['debug'](_0xe357('0x15'),_0xe05fbf,JSON[_0xe357('0xe')](_0x5d2352));_0x3f400f(_0x5d2352);})[_0xe357('0x14')](function(_0x1f09d4){logger[_0xe357('0xf')](_0xe357('0x15'),_0x1f09d4['message'],_0xe05fbf);_0x543bef(_0x4938c2[_0xe357('0xf')](0x1f4,_0x1f09d4['message']));});});};exports[_0xe357('0x20')]=function(_0xfe00c){var _0x3d7035=this;return new Promise(function(_0x2c7710,_0x194fa0){return db[_0xe357('0x21')][_0xe357('0x22')]({'raw':_0xfe00c['options']?_0xfe00c[_0xe357('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xfe00c['options']?_0xfe00c[_0xe357('0x17')][_0xe357('0x19')]||null:null,'attributes':_0xfe00c[_0xe357('0x17')]?_0xfe00c[_0xe357('0x17')]['attributes']||null:null,'include':_0xfe00c[_0xe357('0x17')]?_0xfe00c['options'][_0xe357('0x1c')]?_[_0xe357('0x1e')](_0xfe00c[_0xe357('0x17')][_0xe357('0x1c')],function(_0x50d5f6){return{'model':db[_0x50d5f6[_0xe357('0x1d')]],'as':_0x50d5f6['as'],'attributes':_0x50d5f6['attributes'],'include':_0x50d5f6[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0x50d5f6[_0xe357('0x1c')],function(_0x1b4896){return{'model':db[_0x1b4896[_0xe357('0x1d')]],'as':_0x1b4896['as'],'attributes':_0x1b4896['attributes'],'include':_0x1b4896[_0xe357('0x1c')]?_[_0xe357('0x1e')](_0x1b4896['include'],function(_0x59c63){return{'model':db[_0x59c63['model']],'as':_0x59c63['as'],'attributes':_0x59c63['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d2a11){logger[_0xe357('0x12')](_0xe357('0x20'),_0xfe00c);logger['debug'](_0xe357('0x20'),_0xfe00c,JSON['stringify'](_0x2d2a11));_0x2c7710(_0x2d2a11);})[_0xe357('0x14')](function(_0x2fa133){logger[_0xe357('0xf')](_0xe357('0x20'),_0x2fa133[_0xe357('0x11')],_0xfe00c);_0x194fa0(_0x3d7035['error'](0x1f4,_0x2fa133['message']));});});}; \ No newline at end of file +var _0x89ad=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','GetDynamics365Account','findAll','options','raw','where','attributes','map','include','model','ShowDynamics365Account','Dynamics365Account','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x522ea3,_0x2384bd){var _0x4eb4cb=function(_0x5dc61a){while(--_0x5dc61a){_0x522ea3['push'](_0x522ea3['shift']());}};_0x4eb4cb(++_0x2384bd);}(_0x89ad,0x1c8));var _0xd89a=function(_0xe81b77,_0x2cc22c){_0xe81b77=_0xe81b77-0x0;var _0x3c139f=_0x89ad[_0xe81b77];return _0x3c139f;};'use strict';var _=require(_0xd89a('0x0'));var util=require(_0xd89a('0x1'));var moment=require('moment');var BPromise=require(_0xd89a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd89a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd89a('0x4'));var logger=require(_0xd89a('0x5'))(_0xd89a('0x6'));var config=require(_0xd89a('0x7'));var jayson=require(_0xd89a('0x8'));var client=jayson['client'][_0xd89a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x276d1c,_0x516170,_0x15f6ec){return new BPromise(function(_0x34a2d2,_0x312410){return client[_0xd89a('0xa')](_0x276d1c,_0x15f6ec)[_0xd89a('0xb')](function(_0x29b9bc){logger[_0xd89a('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x516170,_0xd89a('0xd'));logger[_0xd89a('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x516170,_0xd89a('0xd'),JSON[_0xd89a('0xf')](_0x29b9bc));if(_0x29b9bc[_0xd89a('0x10')]){if(_0x29b9bc[_0xd89a('0x10')][_0xd89a('0x11')]===0x1f4){logger[_0xd89a('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x516170,_0x29b9bc[_0xd89a('0x10')][_0xd89a('0x12')]);return _0x312410(_0x29b9bc[_0xd89a('0x10')][_0xd89a('0x12')]);}logger[_0xd89a('0x10')](_0xd89a('0x13'),_0x516170,_0x29b9bc[_0xd89a('0x10')][_0xd89a('0x12')]);return _0x34a2d2(_0x29b9bc[_0xd89a('0x10')][_0xd89a('0x12')]);}else{logger['info'](_0xd89a('0x13'),_0x516170,_0xd89a('0xd'));_0x34a2d2(_0x29b9bc[_0xd89a('0x14')][_0xd89a('0x12')]);}})[_0xd89a('0x15')](function(_0x567483){logger[_0xd89a('0x10')](_0xd89a('0x13'),_0x516170,_0x567483);_0x312410(_0x567483);});});}exports[_0xd89a('0x16')]=function(_0x3a56e4){var _0x1682a7=this;return new Promise(function(_0x413b21,_0x120d7e){return db['Dynamics365Account'][_0xd89a('0x17')]({'raw':_0x3a56e4[_0xd89a('0x18')]?_0x3a56e4[_0xd89a('0x18')][_0xd89a('0x19')]===undefined?!![]:![]:!![],'where':_0x3a56e4[_0xd89a('0x18')]?_0x3a56e4[_0xd89a('0x18')][_0xd89a('0x1a')]||null:null,'attributes':_0x3a56e4[_0xd89a('0x18')]?_0x3a56e4[_0xd89a('0x18')][_0xd89a('0x1b')]||null:null,'limit':_0x3a56e4[_0xd89a('0x18')]?_0x3a56e4[_0xd89a('0x18')]['limit']||null:null,'include':_0x3a56e4['options']?_0x3a56e4[_0xd89a('0x18')]['include']?_[_0xd89a('0x1c')](_0x3a56e4[_0xd89a('0x18')][_0xd89a('0x1d')],function(_0x285df1){return{'model':db[_0x285df1[_0xd89a('0x1e')]],'as':_0x285df1['as'],'attributes':_0x285df1[_0xd89a('0x1b')],'include':_0x285df1[_0xd89a('0x1d')]?_[_0xd89a('0x1c')](_0x285df1[_0xd89a('0x1d')],function(_0x4f153f){return{'model':db[_0x4f153f[_0xd89a('0x1e')]],'as':_0x4f153f['as'],'attributes':_0x4f153f[_0xd89a('0x1b')],'include':_0x4f153f[_0xd89a('0x1d')]?_[_0xd89a('0x1c')](_0x4f153f['include'],function(_0x532f0b){return{'model':db[_0x532f0b[_0xd89a('0x1e')]],'as':_0x532f0b['as'],'attributes':_0x532f0b[_0xd89a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd89a('0xb')](function(_0x59d963){logger[_0xd89a('0xc')](_0xd89a('0x16'),_0x3a56e4);logger['debug'](_0xd89a('0x16'),_0x3a56e4,JSON[_0xd89a('0xf')](_0x59d963));_0x413b21(_0x59d963);})[_0xd89a('0x15')](function(_0x4c6cfa){logger[_0xd89a('0x10')](_0xd89a('0x16'),_0x4c6cfa[_0xd89a('0x12')],_0x3a56e4);_0x120d7e(_0x1682a7['error'](0x1f4,_0x4c6cfa[_0xd89a('0x12')]));});});};exports[_0xd89a('0x1f')]=function(_0x1078b3){var _0x183224=this;return new Promise(function(_0x45b1ab,_0x2009cd){return db[_0xd89a('0x20')]['find']({'raw':_0x1078b3[_0xd89a('0x18')]?_0x1078b3[_0xd89a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1078b3['options']?_0x1078b3['options']['where']||null:null,'attributes':_0x1078b3[_0xd89a('0x18')]?_0x1078b3[_0xd89a('0x18')][_0xd89a('0x1b')]||null:null,'include':_0x1078b3[_0xd89a('0x18')]?_0x1078b3[_0xd89a('0x18')][_0xd89a('0x1d')]?_['map'](_0x1078b3[_0xd89a('0x18')][_0xd89a('0x1d')],function(_0xd8b095){return{'model':db[_0xd8b095[_0xd89a('0x1e')]],'as':_0xd8b095['as'],'attributes':_0xd8b095['attributes'],'include':_0xd8b095[_0xd89a('0x1d')]?_[_0xd89a('0x1c')](_0xd8b095['include'],function(_0x19d182){return{'model':db[_0x19d182[_0xd89a('0x1e')]],'as':_0x19d182['as'],'attributes':_0x19d182['attributes'],'include':_0x19d182[_0xd89a('0x1d')]?_['map'](_0x19d182['include'],function(_0x1b27f0){return{'model':db[_0x1b27f0[_0xd89a('0x1e')]],'as':_0x1b27f0['as'],'attributes':_0x1b27f0[_0xd89a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xd89a('0xb')](function(_0x17cba2){logger[_0xd89a('0xc')]('ShowDynamics365Account',_0x1078b3);logger['debug'](_0xd89a('0x1f'),_0x1078b3,JSON[_0xd89a('0xf')](_0x17cba2));_0x45b1ab(_0x17cba2);})[_0xd89a('0x15')](function(_0x57aabb){logger[_0xd89a('0x10')]('ShowDynamics365Account',_0x57aabb[_0xd89a('0x12')],_0x1078b3);_0x2009cd(_0x183224[_0xd89a('0x10')](0x1f4,_0x57aabb[_0xd89a('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index fa586a6..98eef50 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 _0x5044=['show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','/:id','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','isAuthenticated'];(function(_0x5a04b2,_0x519606){var _0x42421b=function(_0x2368c6){while(--_0x2368c6){_0x5a04b2['push'](_0x5a04b2['shift']());}};_0x42421b(++_0x519606);}(_0x5044,0x1ef));var _0x4504=function(_0x7fff5e,_0x240271){_0x7fff5e=_0x7fff5e-0x0;var _0x57f9ce=_0x5044[_0x7fff5e];return _0x57f9ce;};'use strict';var multer=require('multer');var util=require(_0x4504('0x0'));var path=require('path');var timeout=require(_0x4504('0x1'));var express=require(_0x4504('0x2'));var router=express[_0x4504('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4504('0x4'));var interaction=require(_0x4504('0x5'));var config=require(_0x4504('0x6'));var controller=require(_0x4504('0x7'));router[_0x4504('0x8')]('/',auth['isAuthenticated'](),controller[_0x4504('0x9')]);router[_0x4504('0x8')]('/:id',auth[_0x4504('0xa')](),controller[_0x4504('0xb')]);router[_0x4504('0x8')](_0x4504('0xc'),auth[_0x4504('0xa')](),controller[_0x4504('0xd')]);router['get'](_0x4504('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x4504('0x8')](_0x4504('0xf'),auth['isAuthenticated'](),controller[_0x4504('0x10')]);router[_0x4504('0x11')]('/',auth['isAuthenticated'](),controller[_0x4504('0x12')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x4504('0x13'),auth['isAuthenticated'](),controller[_0x4504('0x14')]);module[_0x4504('0x15')]=router; \ No newline at end of file +var _0xaa5a=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xaa5a,0x1d3));var _0xaaa5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa5a[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xaaa5('0x0'));var util=require(_0xaaa5('0x1'));var path=require('path');var timeout=require(_0xaaa5('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xaaa5('0x3'));var auth=require(_0xaaa5('0x4'));var interaction=require(_0xaaa5('0x5'));var config=require(_0xaaa5('0x6'));var controller=require(_0xaaa5('0x7'));router[_0xaaa5('0x8')]('/',auth[_0xaaa5('0x9')](),controller[_0xaaa5('0xa')]);router[_0xaaa5('0x8')](_0xaaa5('0xb'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0xc')]);router[_0xaaa5('0x8')](_0xaaa5('0xd'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0xe')]);router[_0xaaa5('0x8')](_0xaaa5('0xf'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0x10')]);router[_0xaaa5('0x8')](_0xaaa5('0x11'),auth[_0xaaa5('0x9')](),controller[_0xaaa5('0x12')]);router[_0xaaa5('0x13')]('/',auth[_0xaaa5('0x9')](),controller[_0xaaa5('0x14')]);router[_0xaaa5('0x15')]('/:id',auth[_0xaaa5('0x9')](),controller['update']);router['delete']('/:id',auth[_0xaaa5('0x9')](),controller[_0xaaa5('0x16')]);module[_0xaaa5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 9e8bb47..99b2402 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 _0x7dd9=['phonecall','contact','BOOLEAN','sequelize','STRING','ENUM','incident'];(function(_0x447f6a,_0x5b8a2f){var _0x36bd14=function(_0x3a05f9){while(--_0x3a05f9){_0x447f6a['push'](_0x447f6a['shift']());}};_0x36bd14(++_0x5b8a2f);}(_0x7dd9,0x161));var _0x97dd=function(_0x18be5b,_0x4b04be){_0x18be5b=_0x18be5b-0x0;var _0x3b649c=_0x7dd9[_0x18be5b];return _0x3b649c;};'use strict';var Sequelize=require(_0x97dd('0x0'));module['exports']={'name':{'type':Sequelize[_0x97dd('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x97dd('0x2')](_0x97dd('0x3'),_0x97dd('0x4')),'defaultValue':_0x97dd('0x3')},'moduleCreate':{'type':Sequelize[_0x97dd('0x2')](_0x97dd('0x5'),'nothing'),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x97dd('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x97dd('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x05cc=['incident','ENUM','contact','nothing','BOOLEAN','sequelize','STRING','phonecall'];(function(_0x527cbf,_0x2d1d5f){var _0x235c3c=function(_0x3e95db){while(--_0x3e95db){_0x527cbf['push'](_0x527cbf['shift']());}};_0x235c3c(++_0x2d1d5f);}(_0x05cc,0x15d));var _0xc05c=function(_0x3999ac,_0x2b4c2c){_0x3999ac=_0x3999ac-0x0;var _0x13f04b=_0x05cc[_0x3999ac];return _0x13f04b;};'use strict';var Sequelize=require(_0xc05c('0x0'));module['exports']={'name':{'type':Sequelize[_0xc05c('0x1')]},'description':{'type':Sequelize[_0xc05c('0x1')]},'ticketType':{'type':Sequelize['ENUM']('incident',_0xc05c('0x2')),'defaultValue':_0xc05c('0x3')},'moduleCreate':{'type':Sequelize[_0xc05c('0x4')](_0xc05c('0x5'),_0xc05c('0x6')),'defaultValue':_0xc05c('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xc05c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xc05c('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index a1d0800..8f1c0ba 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 _0x87c8=['VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','catch','show','params','keys','find','create','body','getFields','length','getSubjects','findOne','Dynamics365Field','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge'];(function(_0x1a7518,_0x5bf115){var _0x1a273c=function(_0x40d9da){while(--_0x40d9da){_0x1a7518['push'](_0x1a7518['shift']());}};_0x1a273c(++_0x5bf115);}(_0x87c8,0x1ad));var _0x887c=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x87c8[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x887c('0x0'));var rimraf=require(_0x887c('0x1'));var zipdir=require(_0x887c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x887c('0x3'));var moment=require(_0x887c('0x4'));var BPromise=require(_0x887c('0x5'));var Mustache=require(_0x887c('0x6'));var util=require(_0x887c('0x7'));var path=require(_0x887c('0x8'));var sox=require(_0x887c('0x9'));var csv=require('to-csv');var ejs=require(_0x887c('0xa'));var fs=require('fs');var fs_extra=require(_0x887c('0xb'));var _=require(_0x887c('0xc'));var squel=require(_0x887c('0xd'));var crypto=require(_0x887c('0xe'));var jsforce=require(_0x887c('0xf'));var deskjs=require(_0x887c('0x10'));var toCsv=require(_0x887c('0x11'));var querystring=require(_0x887c('0x12'));var Papa=require(_0x887c('0x13'));var Redis=require(_0x887c('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x887c('0x15'));var hardwareService=require(_0x887c('0x16'));var logger=require('../../config/logger')(_0x887c('0x17'));var utils=require(_0x887c('0x18'));var config=require(_0x887c('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe8b20,_0x18fac0){_0x18fac0=_0x18fac0||0xcc;return function(_0x1673d2){if(_0x1673d2){return _0xe8b20[_0x887c('0x1a')](_0x18fac0);}return _0xe8b20['status'](_0x18fac0)[_0x887c('0x1b')]();};}function respondWithResult(_0x3709fa,_0x305721){_0x305721=_0x305721||0xc8;return function(_0x34d453){if(_0x34d453){return _0x3709fa[_0x887c('0x1c')](_0x305721)[_0x887c('0x1d')](_0x34d453);}};}function respondWithFilteredResult(_0x21a55c,_0x5a9842){return function(_0x1c0fe4){if(_0x1c0fe4){var _0x515227=typeof _0x5a9842[_0x887c('0x1e')]===_0x887c('0x1f')&&typeof _0x5a9842['limit']===_0x887c('0x1f');var _0x49c4d4=_0x1c0fe4['count'];var _0x4d0a16=_0x515227?0x0:_0x5a9842['offset'];var _0x3bf038=_0x515227?_0x1c0fe4[_0x887c('0x20')]:_0x5a9842[_0x887c('0x1e')]+_0x5a9842[_0x887c('0x21')];var _0x31b4b9;if(_0x3bf038>=_0x49c4d4){_0x3bf038=_0x49c4d4;_0x31b4b9=0xc8;}else{_0x31b4b9=0xce;}_0x21a55c[_0x887c('0x1c')](_0x31b4b9);return _0x21a55c[_0x887c('0x22')](_0x887c('0x23'),_0x4d0a16+'-'+_0x3bf038+'/'+_0x49c4d4)[_0x887c('0x1d')](_0x1c0fe4);}return null;};}function patchUpdates(_0x558e99){return function(_0x319537){try{jsonpatch[_0x887c('0x24')](_0x319537,_0x558e99,!![]);}catch(_0x105ce4){return BPromise[_0x887c('0x25')](_0x105ce4);}return _0x319537[_0x887c('0x26')]();};}function saveUpdates(_0xa97683,_0x4880e8){return function(_0x2f02aa){if(_0x2f02aa){return _0x2f02aa['update'](_0xa97683)[_0x887c('0x27')](function(_0x271d21){return _0x271d21;});}return null;};}function removeEntity(_0x34ccba,_0xbbf7e3){return function(_0x221dc8){if(_0x221dc8){return _0x221dc8[_0x887c('0x28')]()[_0x887c('0x27')](function(){_0x34ccba[_0x887c('0x1c')](0xcc)[_0x887c('0x1b')]();});}};}function handleEntityNotFound(_0x427607,_0x44309d){return function(_0x5799bb){if(!_0x5799bb){_0x427607['sendStatus'](0x194);}return _0x5799bb;};}function handleError(_0x2970b1,_0xc6254b){_0xc6254b=_0xc6254b||0x1f4;return function(_0x58e6e2){logger[_0x887c('0x29')](_0x58e6e2['stack']);if(_0x58e6e2['name']){delete _0x58e6e2[_0x887c('0x2a')];}_0x2970b1[_0x887c('0x1c')](_0xc6254b)[_0x887c('0x2b')](_0x58e6e2);};}exports[_0x887c('0x2c')]=function(_0x238155,_0x1ee397){var _0x1e8e21={},_0x964465={},_0x4e6b57={'count':0x0,'rows':[]};var _0x5da19f=_[_0x887c('0x2d')](db['Dynamics365Configuration'][_0x887c('0x2e')],function(_0x5c5bd9){return{'name':_0x5c5bd9['fieldName'],'type':_0x5c5bd9[_0x887c('0x2f')][_0x887c('0x30')]};});_0x964465[_0x887c('0x31')]=_[_0x887c('0x2d')](_0x5da19f,_0x887c('0x2a'));_0x964465[_0x887c('0x32')]=_['keys'](_0x238155[_0x887c('0x32')]);_0x964465['filters']=_[_0x887c('0x33')](_0x964465[_0x887c('0x31')],_0x964465['query']);_0x1e8e21[_0x887c('0x34')]=_[_0x887c('0x33')](_0x964465[_0x887c('0x31')],qs[_0x887c('0x35')](_0x238155[_0x887c('0x32')][_0x887c('0x35')]));_0x1e8e21[_0x887c('0x34')]=_0x1e8e21['attributes']['length']?_0x1e8e21['attributes']:_0x964465[_0x887c('0x31')];if(!_0x238155[_0x887c('0x32')][_0x887c('0x36')](_0x887c('0x37'))){_0x1e8e21['limit']=qs[_0x887c('0x21')](_0x238155[_0x887c('0x32')][_0x887c('0x21')]);_0x1e8e21[_0x887c('0x1e')]=qs[_0x887c('0x1e')](_0x238155[_0x887c('0x32')][_0x887c('0x1e')]);}_0x1e8e21[_0x887c('0x38')]=qs[_0x887c('0x39')](_0x238155[_0x887c('0x32')][_0x887c('0x39')]);_0x1e8e21[_0x887c('0x3a')]=qs['filters'](_[_0x887c('0x3b')](_0x238155[_0x887c('0x32')],_0x964465[_0x887c('0x3c')]),_0x5da19f);if(_0x238155['query'][_0x887c('0x3d')]){_0x1e8e21['where']=_[_0x887c('0x3e')](_0x1e8e21[_0x887c('0x3a')],{'$or':_[_0x887c('0x2d')](_0x5da19f,function(_0x98c8be){if(_0x98c8be['type']!==_0x887c('0x3f')){var _0x1bd0e8={};_0x1bd0e8[_0x98c8be[_0x887c('0x2a')]]={'$like':'%'+_0x238155[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x1bd0e8;}})});}_0x1e8e21=_[_0x887c('0x3e')]({},_0x1e8e21,_0x238155[_0x887c('0x40')]);var _0x5c0e20={'where':_0x1e8e21['where']};return db[_0x887c('0x41')][_0x887c('0x20')](_0x5c0e20)[_0x887c('0x27')](function(_0x9d7efc){_0x4e6b57[_0x887c('0x20')]=_0x9d7efc;if(_0x238155[_0x887c('0x32')][_0x887c('0x42')]){_0x1e8e21[_0x887c('0x43')]=[{'all':!![]}];}return db[_0x887c('0x41')][_0x887c('0x44')](_0x1e8e21);})['then'](function(_0x5e5456){_0x4e6b57['rows']=_0x5e5456;return _0x4e6b57;})[_0x887c('0x27')](respondWithFilteredResult(_0x1ee397,_0x1e8e21))[_0x887c('0x45')](handleError(_0x1ee397,null));};exports[_0x887c('0x46')]=function(_0x518e71,_0x500ac1){var _0x3e443d={'raw':![],'where':{'id':_0x518e71[_0x887c('0x47')]['id']}},_0x34444c={};_0x34444c[_0x887c('0x31')]=_[_0x887c('0x48')](db[_0x887c('0x41')]['rawAttributes']);_0x34444c[_0x887c('0x32')]=_[_0x887c('0x48')](_0x518e71[_0x887c('0x32')]);_0x34444c[_0x887c('0x3c')]=_[_0x887c('0x33')](_0x34444c[_0x887c('0x31')],_0x34444c[_0x887c('0x32')]);_0x3e443d['attributes']=_[_0x887c('0x33')](_0x34444c[_0x887c('0x31')],qs[_0x887c('0x35')](_0x518e71[_0x887c('0x32')][_0x887c('0x35')]));_0x3e443d[_0x887c('0x34')]=_0x3e443d[_0x887c('0x34')]['length']?_0x3e443d['attributes']:_0x34444c[_0x887c('0x31')];if(_0x518e71[_0x887c('0x32')][_0x887c('0x42')]){_0x3e443d[_0x887c('0x43')]=[{'all':!![]}];}_0x3e443d=_[_0x887c('0x3e')]({},_0x3e443d,_0x518e71['options']);return db[_0x887c('0x41')][_0x887c('0x49')](_0x3e443d)[_0x887c('0x27')](handleEntityNotFound(_0x500ac1,null))[_0x887c('0x27')](respondWithResult(_0x500ac1,null))['catch'](handleError(_0x500ac1,null));};exports[_0x887c('0x4a')]=function(_0x2cc097,_0x43696c){return db[_0x887c('0x41')][_0x887c('0x4a')](_0x2cc097[_0x887c('0x4b')],{})[_0x887c('0x27')](respondWithResult(_0x43696c,0xc9))['catch'](handleError(_0x43696c,null));};exports['update']=function(_0x1515c3,_0x29a9a9){if(_0x1515c3[_0x887c('0x4b')]['id']){delete _0x1515c3[_0x887c('0x4b')]['id'];}return db['Dynamics365Configuration'][_0x887c('0x49')]({'where':{'id':_0x1515c3[_0x887c('0x47')]['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x29a9a9,null))[_0x887c('0x27')](saveUpdates(_0x1515c3['body'],null))[_0x887c('0x27')](respondWithResult(_0x29a9a9,null))[_0x887c('0x45')](handleError(_0x29a9a9,null));};exports['destroy']=function(_0x380eef,_0x5e236f){return db[_0x887c('0x41')]['find']({'where':{'id':_0x380eef[_0x887c('0x47')]['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x5e236f,null))[_0x887c('0x27')](removeEntity(_0x5e236f,null))[_0x887c('0x45')](handleError(_0x5e236f,null));};exports[_0x887c('0x4c')]=function(_0x3acb65,_0x5b2c25,_0x49bfca){var _0x65fe06={};var _0x3c9f65={};var _0xc671ba;var _0x16ce7b;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x3acb65[_0x887c('0x47')]['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x5b2c25,null))[_0x887c('0x27')](function(_0x596024){if(_0x596024){_0xc671ba=_0x596024;_0x3c9f65[_0x887c('0x31')]=_[_0x887c('0x48')](db['Dynamics365Field'][_0x887c('0x2e')]);_0x3c9f65[_0x887c('0x32')]=_['keys'](_0x3acb65[_0x887c('0x32')]);_0x3c9f65[_0x887c('0x3c')]=_['intersection'](_0x3c9f65[_0x887c('0x31')],_0x3c9f65['query']);_0x65fe06[_0x887c('0x34')]=_[_0x887c('0x33')](_0x3c9f65['model'],qs[_0x887c('0x35')](_0x3acb65[_0x887c('0x32')]['fields']));_0x65fe06[_0x887c('0x34')]=_0x65fe06['attributes'][_0x887c('0x4d')]?_0x65fe06[_0x887c('0x34')]:_0x3c9f65['model'];_0x65fe06[_0x887c('0x38')]=qs['sort'](_0x3acb65['query']['sort']);_0x65fe06[_0x887c('0x3a')]=qs['filters'](_['pick'](_0x3acb65[_0x887c('0x32')],_0x3c9f65[_0x887c('0x3c')]));if(_0x3acb65['query'][_0x887c('0x3d')]){_0x65fe06['where']=_[_0x887c('0x3e')](_0x65fe06[_0x887c('0x3a')],{'$or':_[_0x887c('0x2d')](_0x65fe06[_0x887c('0x34')],function(_0x1a21eb){var _0x140e4a={};_0x140e4a[_0x1a21eb]={'$like':'%'+_0x3acb65[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x140e4a;})});}_0x65fe06=_[_0x887c('0x3e')]({},_0x65fe06,_0x3acb65[_0x887c('0x40')]);return _0xc671ba['getFields'](_0x65fe06);}})[_0x887c('0x27')](function(_0x3dff71){if(_0x3dff71){_0x16ce7b=_0x3dff71[_0x887c('0x4d')];if(!_0x3acb65[_0x887c('0x32')][_0x887c('0x36')]('nolimit')){_0x65fe06[_0x887c('0x21')]=qs[_0x887c('0x21')](_0x3acb65[_0x887c('0x32')][_0x887c('0x21')]);_0x65fe06['offset']=qs[_0x887c('0x1e')](_0x3acb65[_0x887c('0x32')][_0x887c('0x1e')]);}return _0xc671ba[_0x887c('0x4c')](_0x65fe06);}})[_0x887c('0x27')](function(_0x1f67f6){if(_0x1f67f6){return _0x1f67f6?{'count':_0x16ce7b,'rows':_0x1f67f6}:null;}})[_0x887c('0x27')](respondWithResult(_0x5b2c25,null))[_0x887c('0x45')](handleError(_0x5b2c25,null));};exports[_0x887c('0x4e')]=function(_0x471737,_0x1195e2,_0x81ac60){var _0x3cbe94={};var _0x5f4b1a={};var _0x57297e;var _0x78fffa;return db['Dynamics365Configuration'][_0x887c('0x4f')]({'where':{'id':_0x471737[_0x887c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1195e2,null))[_0x887c('0x27')](function(_0x2da8a9){if(_0x2da8a9){_0x57297e=_0x2da8a9;_0x5f4b1a['model']=_[_0x887c('0x48')](db[_0x887c('0x50')]['rawAttributes']);_0x5f4b1a['query']=_[_0x887c('0x48')](_0x471737[_0x887c('0x32')]);_0x5f4b1a['filters']=_[_0x887c('0x33')](_0x5f4b1a[_0x887c('0x31')],_0x5f4b1a[_0x887c('0x32')]);_0x3cbe94[_0x887c('0x34')]=_[_0x887c('0x33')](_0x5f4b1a['model'],qs[_0x887c('0x35')](_0x471737[_0x887c('0x32')][_0x887c('0x35')]));_0x3cbe94['attributes']=_0x3cbe94['attributes'][_0x887c('0x4d')]?_0x3cbe94['attributes']:_0x5f4b1a[_0x887c('0x31')];_0x3cbe94[_0x887c('0x38')]=qs['sort'](_0x471737['query']['sort']);_0x3cbe94[_0x887c('0x3a')]=qs['filters'](_[_0x887c('0x3b')](_0x471737[_0x887c('0x32')],_0x5f4b1a[_0x887c('0x3c')]));if(_0x471737[_0x887c('0x32')][_0x887c('0x3d')]){_0x3cbe94['where']=_[_0x887c('0x3e')](_0x3cbe94[_0x887c('0x3a')],{'$or':_[_0x887c('0x2d')](_0x3cbe94[_0x887c('0x34')],function(_0xc78637){var _0x5d6132={};_0x5d6132[_0xc78637]={'$like':'%'+_0x471737[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x5d6132;})});}_0x3cbe94=_['merge']({},_0x3cbe94,_0x471737[_0x887c('0x40')]);return _0x57297e[_0x887c('0x4e')](_0x3cbe94);}})[_0x887c('0x27')](function(_0xd25e91){if(_0xd25e91){_0x78fffa=_0xd25e91[_0x887c('0x4d')];if(!_0x471737[_0x887c('0x32')][_0x887c('0x36')](_0x887c('0x37'))){_0x3cbe94[_0x887c('0x21')]=qs[_0x887c('0x21')](_0x471737[_0x887c('0x32')][_0x887c('0x21')]);_0x3cbe94[_0x887c('0x1e')]=qs[_0x887c('0x1e')](_0x471737['query'][_0x887c('0x1e')]);}return _0x57297e['getSubjects'](_0x3cbe94);}})[_0x887c('0x27')](function(_0x3349cb){if(_0x3349cb){return _0x3349cb?{'count':_0x78fffa,'rows':_0x3349cb}:null;}})[_0x887c('0x27')](respondWithResult(_0x1195e2,null))[_0x887c('0x45')](handleError(_0x1195e2,null));};exports[_0x887c('0x51')]=function(_0x51ae15,_0x20b4ab,_0x25685f){var _0xdc2d86={};var _0x5e0f16={};var _0x3d34d9;var _0x2754b0;return db[_0x887c('0x41')][_0x887c('0x4f')]({'where':{'id':_0x51ae15['params']['id']}})[_0x887c('0x27')](handleEntityNotFound(_0x20b4ab,null))[_0x887c('0x27')](function(_0x54855d){if(_0x54855d){_0x3d34d9=_0x54855d;_0x5e0f16[_0x887c('0x31')]=_[_0x887c('0x48')](db['Dynamics365Field'][_0x887c('0x2e')]);_0x5e0f16[_0x887c('0x32')]=_[_0x887c('0x48')](_0x51ae15[_0x887c('0x32')]);_0x5e0f16[_0x887c('0x3c')]=_[_0x887c('0x33')](_0x5e0f16[_0x887c('0x31')],_0x5e0f16['query']);_0xdc2d86[_0x887c('0x34')]=_[_0x887c('0x33')](_0x5e0f16[_0x887c('0x31')],qs['fields'](_0x51ae15[_0x887c('0x32')][_0x887c('0x35')]));_0xdc2d86[_0x887c('0x34')]=_0xdc2d86[_0x887c('0x34')]['length']?_0xdc2d86[_0x887c('0x34')]:_0x5e0f16[_0x887c('0x31')];_0xdc2d86[_0x887c('0x38')]=qs[_0x887c('0x39')](_0x51ae15[_0x887c('0x32')]['sort']);_0xdc2d86[_0x887c('0x3a')]=qs[_0x887c('0x3c')](_[_0x887c('0x3b')](_0x51ae15[_0x887c('0x32')],_0x5e0f16[_0x887c('0x3c')]));if(_0x51ae15[_0x887c('0x32')][_0x887c('0x3d')]){_0xdc2d86[_0x887c('0x3a')]=_['merge'](_0xdc2d86['where'],{'$or':_[_0x887c('0x2d')](_0xdc2d86['attributes'],function(_0x849b7b){var _0x1c33e2={};_0x1c33e2[_0x849b7b]={'$like':'%'+_0x51ae15[_0x887c('0x32')][_0x887c('0x3d')]+'%'};return _0x1c33e2;})});}_0xdc2d86=_[_0x887c('0x3e')]({},_0xdc2d86,_0x51ae15[_0x887c('0x40')]);return _0x3d34d9['getDescriptions'](_0xdc2d86);}})[_0x887c('0x27')](function(_0x3aec61){if(_0x3aec61){_0x2754b0=_0x3aec61[_0x887c('0x4d')];if(!_0x51ae15[_0x887c('0x32')][_0x887c('0x36')](_0x887c('0x37'))){_0xdc2d86[_0x887c('0x21')]=qs[_0x887c('0x21')](_0x51ae15[_0x887c('0x32')]['limit']);_0xdc2d86['offset']=qs[_0x887c('0x1e')](_0x51ae15[_0x887c('0x32')][_0x887c('0x1e')]);}return _0x3d34d9[_0x887c('0x51')](_0xdc2d86);}})[_0x887c('0x27')](function(_0x31035f){if(_0x31035f){return _0x31035f?{'count':_0x2754b0,'rows':_0x31035f}:null;}})[_0x887c('0x27')](respondWithResult(_0x20b4ab,null))[_0x887c('0x45')](handleError(_0x20b4ab,null));}; \ No newline at end of file +var _0xd91f=['name','send','index','map','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','Dynamics365Configuration','then','includeAll','include','rows','catch','params','rawAttributes','find','create','body','getFields','Dynamics365Field','intersection','pick','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','end','error'];(function(_0x40750d,_0x593094){var _0x42d026=function(_0x1168bb){while(--_0x1168bb){_0x40750d['push'](_0x40750d['shift']());}};_0x42d026(++_0x593094);}(_0xd91f,0xd3));var _0xfd91=function(_0x34e752,_0x32e2a2){_0x34e752=_0x34e752-0x0;var _0x7c6347=_0xd91f[_0x34e752];return _0x7c6347;};'use strict';var emlformat=require(_0xfd91('0x0'));var rimraf=require(_0xfd91('0x1'));var zipdir=require(_0xfd91('0x2'));var jsonpatch=require(_0xfd91('0x3'));var rp=require('request-promise');var moment=require(_0xfd91('0x4'));var BPromise=require(_0xfd91('0x5'));var Mustache=require(_0xfd91('0x6'));var util=require(_0xfd91('0x7'));var path=require(_0xfd91('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfd91('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd91('0xa'));var squel=require(_0xfd91('0xb'));var crypto=require(_0xfd91('0xc'));var jsforce=require(_0xfd91('0xd'));var deskjs=require(_0xfd91('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfd91('0xf'));var Papa=require(_0xfd91('0x10'));var Redis=require(_0xfd91('0x11'));var authService=require(_0xfd91('0x12'));var qs=require(_0xfd91('0x13'));var as=require(_0xfd91('0x14'));var hardwareService=require(_0xfd91('0x15'));var logger=require(_0xfd91('0x16'))(_0xfd91('0x17'));var utils=require(_0xfd91('0x18'));var config=require(_0xfd91('0x19'));var licenseUtil=require(_0xfd91('0x1a'));var db=require(_0xfd91('0x1b'))['db'];function respondWithStatusCode(_0xa20064,_0x311953){_0x311953=_0x311953||0xcc;return function(_0x1292a0){if(_0x1292a0){return _0xa20064[_0xfd91('0x1c')](_0x311953);}return _0xa20064[_0xfd91('0x1d')](_0x311953)['end']();};}function respondWithResult(_0x107d19,_0x20c57d){_0x20c57d=_0x20c57d||0xc8;return function(_0x2d30ba){if(_0x2d30ba){return _0x107d19[_0xfd91('0x1d')](_0x20c57d)[_0xfd91('0x1e')](_0x2d30ba);}};}function respondWithFilteredResult(_0x26ea48,_0x4c0f0e){return function(_0xc5027b){if(_0xc5027b){var _0x140358=typeof _0x4c0f0e['offset']==='undefined'&&typeof _0x4c0f0e[_0xfd91('0x1f')]===_0xfd91('0x20');var _0x383436=_0xc5027b[_0xfd91('0x21')];var _0x4fb883=_0x140358?0x0:_0x4c0f0e[_0xfd91('0x22')];var _0x3898c5=_0x140358?_0xc5027b['count']:_0x4c0f0e[_0xfd91('0x22')]+_0x4c0f0e[_0xfd91('0x1f')];var _0x3d8ae7;if(_0x3898c5>=_0x383436){_0x3898c5=_0x383436;_0x3d8ae7=0xc8;}else{_0x3d8ae7=0xce;}_0x26ea48['status'](_0x3d8ae7);return _0x26ea48[_0xfd91('0x23')](_0xfd91('0x24'),_0x4fb883+'-'+_0x3898c5+'/'+_0x383436)[_0xfd91('0x1e')](_0xc5027b);}return null;};}function patchUpdates(_0x2f966e){return function(_0x5f223c){try{jsonpatch[_0xfd91('0x25')](_0x5f223c,_0x2f966e,!![]);}catch(_0xfc37c3){return BPromise[_0xfd91('0x26')](_0xfc37c3);}return _0x5f223c[_0xfd91('0x27')]();};}function saveUpdates(_0x369c3c,_0x36a3db){return function(_0x33dccb){if(_0x33dccb){return _0x33dccb[_0xfd91('0x28')](_0x369c3c)['then'](function(_0x2968a3){return _0x2968a3;});}return null;};}function removeEntity(_0x4c7fbc,_0x2bdbb5){return function(_0x266406){if(_0x266406){return _0x266406[_0xfd91('0x29')]()['then'](function(){_0x4c7fbc[_0xfd91('0x1d')](0xcc)[_0xfd91('0x2a')]();});}};}function handleEntityNotFound(_0x308755,_0x557294){return function(_0x1efc71){if(!_0x1efc71){_0x308755[_0xfd91('0x1c')](0x194);}return _0x1efc71;};}function handleError(_0x5f6aea,_0x539cba){_0x539cba=_0x539cba||0x1f4;return function(_0x2b00ec){logger[_0xfd91('0x2b')](_0x2b00ec['stack']);if(_0x2b00ec[_0xfd91('0x2c')]){delete _0x2b00ec['name'];}_0x5f6aea[_0xfd91('0x1d')](_0x539cba)[_0xfd91('0x2d')](_0x2b00ec);};}exports[_0xfd91('0x2e')]=function(_0x41bbd6,_0x6bacf3){var _0x166a3d={},_0xb6f3b4={},_0x2f3138={'count':0x0,'rows':[]};var _0x528094=_[_0xfd91('0x2f')](db['Dynamics365Configuration']['rawAttributes'],function(_0x1e2fdb){return{'name':_0x1e2fdb[_0xfd91('0x30')],'type':_0x1e2fdb[_0xfd91('0x31')][_0xfd91('0x32')]};});_0xb6f3b4[_0xfd91('0x33')]=_[_0xfd91('0x2f')](_0x528094,_0xfd91('0x2c'));_0xb6f3b4[_0xfd91('0x34')]=_[_0xfd91('0x35')](_0x41bbd6[_0xfd91('0x34')]);_0xb6f3b4[_0xfd91('0x36')]=_['intersection'](_0xb6f3b4['model'],_0xb6f3b4[_0xfd91('0x34')]);_0x166a3d[_0xfd91('0x37')]=_['intersection'](_0xb6f3b4[_0xfd91('0x33')],qs[_0xfd91('0x38')](_0x41bbd6[_0xfd91('0x34')][_0xfd91('0x38')]));_0x166a3d[_0xfd91('0x37')]=_0x166a3d[_0xfd91('0x37')][_0xfd91('0x39')]?_0x166a3d[_0xfd91('0x37')]:_0xb6f3b4[_0xfd91('0x33')];if(!_0x41bbd6[_0xfd91('0x34')][_0xfd91('0x3a')]('nolimit')){_0x166a3d[_0xfd91('0x1f')]=qs[_0xfd91('0x1f')](_0x41bbd6[_0xfd91('0x34')][_0xfd91('0x1f')]);_0x166a3d[_0xfd91('0x22')]=qs['offset'](_0x41bbd6[_0xfd91('0x34')]['offset']);}_0x166a3d[_0xfd91('0x3b')]=qs[_0xfd91('0x3c')](_0x41bbd6[_0xfd91('0x34')][_0xfd91('0x3c')]);_0x166a3d['where']=qs[_0xfd91('0x36')](_['pick'](_0x41bbd6[_0xfd91('0x34')],_0xb6f3b4[_0xfd91('0x36')]),_0x528094);if(_0x41bbd6[_0xfd91('0x34')][_0xfd91('0x3d')]){_0x166a3d[_0xfd91('0x3e')]=_['merge'](_0x166a3d[_0xfd91('0x3e')],{'$or':_[_0xfd91('0x2f')](_0x528094,function(_0x217b74){if(_0x217b74[_0xfd91('0x31')]!==_0xfd91('0x3f')){var _0x332a21={};_0x332a21[_0x217b74['name']]={'$like':'%'+_0x41bbd6['query'][_0xfd91('0x3d')]+'%'};return _0x332a21;}})});}_0x166a3d=_[_0xfd91('0x40')]({},_0x166a3d,_0x41bbd6[_0xfd91('0x41')]);var _0x426084={'where':_0x166a3d[_0xfd91('0x3e')]};return db[_0xfd91('0x42')][_0xfd91('0x21')](_0x426084)[_0xfd91('0x43')](function(_0x2f79e1){_0x2f3138[_0xfd91('0x21')]=_0x2f79e1;if(_0x41bbd6['query'][_0xfd91('0x44')]){_0x166a3d[_0xfd91('0x45')]=[{'all':!![]}];}return db[_0xfd91('0x42')]['findAll'](_0x166a3d);})['then'](function(_0x53f1f5){_0x2f3138[_0xfd91('0x46')]=_0x53f1f5;return _0x2f3138;})['then'](respondWithFilteredResult(_0x6bacf3,_0x166a3d))[_0xfd91('0x47')](handleError(_0x6bacf3,null));};exports['show']=function(_0xa3b330,_0x4c2f90){var _0x5d13e0={'raw':![],'where':{'id':_0xa3b330[_0xfd91('0x48')]['id']}},_0x29960d={};_0x29960d[_0xfd91('0x33')]=_[_0xfd91('0x35')](db[_0xfd91('0x42')][_0xfd91('0x49')]);_0x29960d[_0xfd91('0x34')]=_[_0xfd91('0x35')](_0xa3b330[_0xfd91('0x34')]);_0x29960d[_0xfd91('0x36')]=_['intersection'](_0x29960d[_0xfd91('0x33')],_0x29960d[_0xfd91('0x34')]);_0x5d13e0['attributes']=_['intersection'](_0x29960d[_0xfd91('0x33')],qs['fields'](_0xa3b330[_0xfd91('0x34')][_0xfd91('0x38')]));_0x5d13e0[_0xfd91('0x37')]=_0x5d13e0['attributes'][_0xfd91('0x39')]?_0x5d13e0[_0xfd91('0x37')]:_0x29960d[_0xfd91('0x33')];if(_0xa3b330[_0xfd91('0x34')]['includeAll']){_0x5d13e0[_0xfd91('0x45')]=[{'all':!![]}];}_0x5d13e0=_['merge']({},_0x5d13e0,_0xa3b330[_0xfd91('0x41')]);return db['Dynamics365Configuration'][_0xfd91('0x4a')](_0x5d13e0)['then'](handleEntityNotFound(_0x4c2f90,null))[_0xfd91('0x43')](respondWithResult(_0x4c2f90,null))[_0xfd91('0x47')](handleError(_0x4c2f90,null));};exports[_0xfd91('0x4b')]=function(_0x50032c,_0x20c567){return db['Dynamics365Configuration'][_0xfd91('0x4b')](_0x50032c[_0xfd91('0x4c')],{})[_0xfd91('0x43')](respondWithResult(_0x20c567,0xc9))[_0xfd91('0x47')](handleError(_0x20c567,null));};exports[_0xfd91('0x28')]=function(_0x57ca58,_0x5f4b85){if(_0x57ca58[_0xfd91('0x4c')]['id']){delete _0x57ca58[_0xfd91('0x4c')]['id'];}return db[_0xfd91('0x42')][_0xfd91('0x4a')]({'where':{'id':_0x57ca58[_0xfd91('0x48')]['id']}})[_0xfd91('0x43')](handleEntityNotFound(_0x5f4b85,null))[_0xfd91('0x43')](saveUpdates(_0x57ca58[_0xfd91('0x4c')],null))[_0xfd91('0x43')](respondWithResult(_0x5f4b85,null))['catch'](handleError(_0x5f4b85,null));};exports[_0xfd91('0x29')]=function(_0x4a70a0,_0x28aec5){return db[_0xfd91('0x42')][_0xfd91('0x4a')]({'where':{'id':_0x4a70a0[_0xfd91('0x48')]['id']}})[_0xfd91('0x43')](handleEntityNotFound(_0x28aec5,null))[_0xfd91('0x43')](removeEntity(_0x28aec5,null))[_0xfd91('0x47')](handleError(_0x28aec5,null));};exports[_0xfd91('0x4d')]=function(_0x11dc3b,_0x5dd443,_0x2793ae){var _0x2efa41={};var _0x2f6b33={};var _0x460ae3;var _0x2c4b5d;return db[_0xfd91('0x42')]['findOne']({'where':{'id':_0x11dc3b[_0xfd91('0x48')]['id']}})[_0xfd91('0x43')](handleEntityNotFound(_0x5dd443,null))[_0xfd91('0x43')](function(_0x22c336){if(_0x22c336){_0x460ae3=_0x22c336;_0x2f6b33[_0xfd91('0x33')]=_[_0xfd91('0x35')](db[_0xfd91('0x4e')][_0xfd91('0x49')]);_0x2f6b33[_0xfd91('0x34')]=_[_0xfd91('0x35')](_0x11dc3b[_0xfd91('0x34')]);_0x2f6b33['filters']=_[_0xfd91('0x4f')](_0x2f6b33[_0xfd91('0x33')],_0x2f6b33[_0xfd91('0x34')]);_0x2efa41[_0xfd91('0x37')]=_[_0xfd91('0x4f')](_0x2f6b33[_0xfd91('0x33')],qs[_0xfd91('0x38')](_0x11dc3b['query'][_0xfd91('0x38')]));_0x2efa41[_0xfd91('0x37')]=_0x2efa41[_0xfd91('0x37')][_0xfd91('0x39')]?_0x2efa41['attributes']:_0x2f6b33[_0xfd91('0x33')];_0x2efa41[_0xfd91('0x3b')]=qs[_0xfd91('0x3c')](_0x11dc3b[_0xfd91('0x34')][_0xfd91('0x3c')]);_0x2efa41[_0xfd91('0x3e')]=qs[_0xfd91('0x36')](_[_0xfd91('0x50')](_0x11dc3b[_0xfd91('0x34')],_0x2f6b33[_0xfd91('0x36')]));if(_0x11dc3b[_0xfd91('0x34')][_0xfd91('0x3d')]){_0x2efa41[_0xfd91('0x3e')]=_[_0xfd91('0x40')](_0x2efa41[_0xfd91('0x3e')],{'$or':_['map'](_0x2efa41['attributes'],function(_0x52ff73){var _0x4d9f41={};_0x4d9f41[_0x52ff73]={'$like':'%'+_0x11dc3b[_0xfd91('0x34')][_0xfd91('0x3d')]+'%'};return _0x4d9f41;})});}_0x2efa41=_[_0xfd91('0x40')]({},_0x2efa41,_0x11dc3b['options']);return _0x460ae3[_0xfd91('0x4d')](_0x2efa41);}})[_0xfd91('0x43')](function(_0x1b3347){if(_0x1b3347){_0x2c4b5d=_0x1b3347['length'];if(!_0x11dc3b[_0xfd91('0x34')][_0xfd91('0x3a')](_0xfd91('0x51'))){_0x2efa41[_0xfd91('0x1f')]=qs[_0xfd91('0x1f')](_0x11dc3b[_0xfd91('0x34')][_0xfd91('0x1f')]);_0x2efa41[_0xfd91('0x22')]=qs[_0xfd91('0x22')](_0x11dc3b[_0xfd91('0x34')]['offset']);}return _0x460ae3[_0xfd91('0x4d')](_0x2efa41);}})[_0xfd91('0x43')](function(_0x21ca12){if(_0x21ca12){return _0x21ca12?{'count':_0x2c4b5d,'rows':_0x21ca12}:null;}})[_0xfd91('0x43')](respondWithResult(_0x5dd443,null))[_0xfd91('0x47')](handleError(_0x5dd443,null));};exports[_0xfd91('0x52')]=function(_0x4f1047,_0x3f39c6,_0x2009ca){var _0x14fd39={};var _0x4646db={};var _0xa35068;var _0x31d50f;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x4f1047[_0xfd91('0x48')]['id']}})['then'](handleEntityNotFound(_0x3f39c6,null))[_0xfd91('0x43')](function(_0x4e7d1e){if(_0x4e7d1e){_0xa35068=_0x4e7d1e;_0x4646db[_0xfd91('0x33')]=_[_0xfd91('0x35')](db[_0xfd91('0x4e')][_0xfd91('0x49')]);_0x4646db[_0xfd91('0x34')]=_[_0xfd91('0x35')](_0x4f1047[_0xfd91('0x34')]);_0x4646db[_0xfd91('0x36')]=_[_0xfd91('0x4f')](_0x4646db[_0xfd91('0x33')],_0x4646db[_0xfd91('0x34')]);_0x14fd39[_0xfd91('0x37')]=_[_0xfd91('0x4f')](_0x4646db[_0xfd91('0x33')],qs['fields'](_0x4f1047['query'][_0xfd91('0x38')]));_0x14fd39[_0xfd91('0x37')]=_0x14fd39['attributes'][_0xfd91('0x39')]?_0x14fd39['attributes']:_0x4646db[_0xfd91('0x33')];_0x14fd39['order']=qs[_0xfd91('0x3c')](_0x4f1047[_0xfd91('0x34')][_0xfd91('0x3c')]);_0x14fd39['where']=qs[_0xfd91('0x36')](_[_0xfd91('0x50')](_0x4f1047['query'],_0x4646db['filters']));if(_0x4f1047['query'][_0xfd91('0x3d')]){_0x14fd39[_0xfd91('0x3e')]=_['merge'](_0x14fd39[_0xfd91('0x3e')],{'$or':_[_0xfd91('0x2f')](_0x14fd39[_0xfd91('0x37')],function(_0x352e2d){var _0x38e384={};_0x38e384[_0x352e2d]={'$like':'%'+_0x4f1047[_0xfd91('0x34')][_0xfd91('0x3d')]+'%'};return _0x38e384;})});}_0x14fd39=_[_0xfd91('0x40')]({},_0x14fd39,_0x4f1047[_0xfd91('0x41')]);return _0xa35068[_0xfd91('0x52')](_0x14fd39);}})[_0xfd91('0x43')](function(_0x36b4c8){if(_0x36b4c8){_0x31d50f=_0x36b4c8['length'];if(!_0x4f1047[_0xfd91('0x34')][_0xfd91('0x3a')](_0xfd91('0x51'))){_0x14fd39[_0xfd91('0x1f')]=qs['limit'](_0x4f1047[_0xfd91('0x34')][_0xfd91('0x1f')]);_0x14fd39['offset']=qs[_0xfd91('0x22')](_0x4f1047[_0xfd91('0x34')]['offset']);}return _0xa35068[_0xfd91('0x52')](_0x14fd39);}})['then'](function(_0xa99ca5){if(_0xa99ca5){return _0xa99ca5?{'count':_0x31d50f,'rows':_0xa99ca5}:null;}})[_0xfd91('0x43')](respondWithResult(_0x3f39c6,null))['catch'](handleError(_0x3f39c6,null));};exports['getDescriptions']=function(_0x5e1c65,_0x52419d,_0x2fc57d){var _0x29d241={};var _0x13e7b0={};var _0x273cf8;var _0x332c18;return db[_0xfd91('0x42')][_0xfd91('0x53')]({'where':{'id':_0x5e1c65['params']['id']}})[_0xfd91('0x43')](handleEntityNotFound(_0x52419d,null))[_0xfd91('0x43')](function(_0x2d6cd5){if(_0x2d6cd5){_0x273cf8=_0x2d6cd5;_0x13e7b0[_0xfd91('0x33')]=_[_0xfd91('0x35')](db[_0xfd91('0x4e')]['rawAttributes']);_0x13e7b0[_0xfd91('0x34')]=_[_0xfd91('0x35')](_0x5e1c65[_0xfd91('0x34')]);_0x13e7b0[_0xfd91('0x36')]=_[_0xfd91('0x4f')](_0x13e7b0[_0xfd91('0x33')],_0x13e7b0[_0xfd91('0x34')]);_0x29d241[_0xfd91('0x37')]=_['intersection'](_0x13e7b0[_0xfd91('0x33')],qs[_0xfd91('0x38')](_0x5e1c65[_0xfd91('0x34')]['fields']));_0x29d241[_0xfd91('0x37')]=_0x29d241[_0xfd91('0x37')][_0xfd91('0x39')]?_0x29d241[_0xfd91('0x37')]:_0x13e7b0[_0xfd91('0x33')];_0x29d241[_0xfd91('0x3b')]=qs[_0xfd91('0x3c')](_0x5e1c65[_0xfd91('0x34')]['sort']);_0x29d241['where']=qs[_0xfd91('0x36')](_[_0xfd91('0x50')](_0x5e1c65[_0xfd91('0x34')],_0x13e7b0[_0xfd91('0x36')]));if(_0x5e1c65['query']['filter']){_0x29d241[_0xfd91('0x3e')]=_[_0xfd91('0x40')](_0x29d241[_0xfd91('0x3e')],{'$or':_[_0xfd91('0x2f')](_0x29d241[_0xfd91('0x37')],function(_0x27f106){var _0x5bc199={};_0x5bc199[_0x27f106]={'$like':'%'+_0x5e1c65['query']['filter']+'%'};return _0x5bc199;})});}_0x29d241=_[_0xfd91('0x40')]({},_0x29d241,_0x5e1c65[_0xfd91('0x41')]);return _0x273cf8[_0xfd91('0x54')](_0x29d241);}})[_0xfd91('0x43')](function(_0x44cb60){if(_0x44cb60){_0x332c18=_0x44cb60[_0xfd91('0x39')];if(!_0x5e1c65[_0xfd91('0x34')][_0xfd91('0x3a')]('nolimit')){_0x29d241[_0xfd91('0x1f')]=qs[_0xfd91('0x1f')](_0x5e1c65[_0xfd91('0x34')][_0xfd91('0x1f')]);_0x29d241[_0xfd91('0x22')]=qs[_0xfd91('0x22')](_0x5e1c65[_0xfd91('0x34')][_0xfd91('0x22')]);}return _0x273cf8[_0xfd91('0x54')](_0x29d241);}})[_0xfd91('0x43')](function(_0x123e64){if(_0x123e64){return _0x123e64?{'count':_0x332c18,'rows':_0x123e64}:null;}})['then'](respondWithResult(_0x52419d,null))['catch'](handleError(_0x52419d,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index a5632e4..9fdffe7 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 _0x4b84=['moment','path','rimraf','../../config/environment','Dynamics365Configuration','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4b84,0x1cc));var _0x44b8=function(_0x19ac6e,_0x435862){_0x19ac6e=_0x19ac6e-0x0;var _0x1cdcf3=_0x4b84[_0x19ac6e];return _0x1cdcf3;};'use strict';var _=require(_0x44b8('0x0'));var util=require(_0x44b8('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x44b8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x44b8('0x3'));var rimraf=require(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var attributes=require('./intDynamics365Configuration.attributes');module['exports']=function(_0x55f25d,_0x996a8b){return _0x55f25d['define'](_0x44b8('0x6'),attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbec5=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','lodash','util','api','moment','bluebird'];(function(_0xd3d9a3,_0x53bc9f){var _0xf7b6bf=function(_0x13a8f0){while(--_0x13a8f0){_0xd3d9a3['push'](_0xd3d9a3['shift']());}};_0xf7b6bf(++_0x53bc9f);}(_0xbec5,0xe5));var _0x5bec=function(_0x309d93,_0x157662){_0x309d93=_0x309d93-0x0;var _0x2dd61d=_0xbec5[_0x309d93];return _0x2dd61d;};'use strict';var _=require(_0x5bec('0x0'));var util=require(_0x5bec('0x1'));var logger=require('../../config/logger')(_0x5bec('0x2'));var moment=require(_0x5bec('0x3'));var BPromise=require(_0x5bec('0x4'));var rp=require(_0x5bec('0x5'));var fs=require('fs');var path=require(_0x5bec('0x6'));var rimraf=require('rimraf');var config=require(_0x5bec('0x7'));var attributes=require(_0x5bec('0x8'));module[_0x5bec('0x9')]=function(_0x4aaac6,_0x3ed67a){return _0x4aaac6[_0x5bec('0xa')](_0x5bec('0xb'),attributes,{'tableName':_0x5bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 64219f2..4cbd8bb 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 _0xdf94=['Dynamics365Configuration,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf94,0xdf));var _0x4df9=function(_0x33843c,_0x1e6442){_0x33843c=_0x33843c-0x0;var _0x4f0122=_0xdf94[_0x33843c];return _0x4f0122;};'use strict';var _=require(_0x4df9('0x0'));var util=require(_0x4df9('0x1'));var moment=require(_0x4df9('0x2'));var BPromise=require('bluebird');var rs=require(_0x4df9('0x3'));var fs=require('fs');var Redis=require(_0x4df9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4df9('0x5'));var logger=require(_0x4df9('0x6'))(_0x4df9('0x7'));var config=require(_0x4df9('0x8'));var jayson=require(_0x4df9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2131bc,_0x5e652d,_0x5be610){return new BPromise(function(_0x1b9f5f,_0x1b8ce0){return client[_0x4df9('0xa')](_0x2131bc,_0x5be610)[_0x4df9('0xb')](function(_0x924bb6){logger['info']('Dynamics365Configuration,\x20%s,\x20%s',_0x5e652d,_0x4df9('0xc'));logger[_0x4df9('0xd')](_0x4df9('0xe'),_0x5e652d,_0x4df9('0xc'),JSON[_0x4df9('0xf')](_0x924bb6));if(_0x924bb6['error']){if(_0x924bb6['error'][_0x4df9('0x10')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x5e652d,_0x924bb6[_0x4df9('0x11')]['message']);return _0x1b8ce0(_0x924bb6[_0x4df9('0x11')][_0x4df9('0x12')]);}logger['error'](_0x4df9('0x13'),_0x5e652d,_0x924bb6['error'][_0x4df9('0x12')]);return _0x1b9f5f(_0x924bb6['error'][_0x4df9('0x12')]);}else{logger['info'](_0x4df9('0x13'),_0x5e652d,_0x4df9('0xc'));_0x1b9f5f(_0x924bb6[_0x4df9('0x14')][_0x4df9('0x12')]);}})[_0x4df9('0x15')](function(_0x1a3e4f){logger[_0x4df9('0x11')](_0x4df9('0x13'),_0x5e652d,_0x1a3e4f);_0x1b8ce0(_0x1a3e4f);});});} \ No newline at end of file +var _0xcc3a=['../../config/utils','../../config/logger','rpc','client','http','request','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xcc3a,0x10c));var _0xacc3=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xcc3a[_0x1064bc];return _0x5edc45;};'use strict';var _=require(_0xacc3('0x0'));var util=require(_0xacc3('0x1'));var moment=require(_0xacc3('0x2'));var BPromise=require('bluebird');var rs=require(_0xacc3('0x3'));var fs=require('fs');var Redis=require(_0xacc3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xacc3('0x5'));var logger=require(_0xacc3('0x6'))(_0xacc3('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xacc3('0x8')][_0xacc3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x239f70,_0x489bb3,_0x2fe453){return new BPromise(function(_0xbc4268,_0x4a9025){return client[_0xacc3('0xa')](_0x239f70,_0x2fe453)['then'](function(_0x541d39){logger[_0xacc3('0xb')](_0xacc3('0xc'),_0x489bb3,_0xacc3('0xd'));logger[_0xacc3('0xe')](_0xacc3('0xf'),_0x489bb3,_0xacc3('0xd'),JSON['stringify'](_0x541d39));if(_0x541d39[_0xacc3('0x10')]){if(_0x541d39['error'][_0xacc3('0x11')]===0x1f4){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x489bb3,_0x541d39[_0xacc3('0x10')][_0xacc3('0x12')]);return _0x4a9025(_0x541d39['error'][_0xacc3('0x12')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x489bb3,_0x541d39['error'][_0xacc3('0x12')]);return _0xbc4268(_0x541d39[_0xacc3('0x10')][_0xacc3('0x12')]);}else{logger[_0xacc3('0xb')](_0xacc3('0xc'),_0x489bb3,_0xacc3('0xd'));_0xbc4268(_0x541d39[_0xacc3('0x13')]['message']);}})[_0xacc3('0x14')](function(_0x344d4f){logger['error'](_0xacc3('0xc'),_0x489bb3,_0x344d4f);_0x4a9025(_0x344d4f);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 5906a91..f246934 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 _0xa44d=['../../config/environment','isAuthenticated','get','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xa44d,0x181));var _0xda44=function(_0x5a1cc9,_0x28f54d){_0x5a1cc9=_0x5a1cc9-0x0;var _0x471761=_0xa44d[_0x5a1cc9];return _0x471761;};'use strict';var multer=require(_0xda44('0x0'));var util=require(_0xda44('0x1'));var path=require('path');var timeout=require(_0xda44('0x2'));var express=require(_0xda44('0x3'));var router=express[_0xda44('0x4')]();var fs_extra=require(_0xda44('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda44('0x6'));var controller=require('./intDynamics365Field.controller');router['get']('/',auth[_0xda44('0x7')](),controller['index']);router[_0xda44('0x8')](_0xda44('0x9'),auth[_0xda44('0x7')](),controller[_0xda44('0xa')]);router[_0xda44('0xb')]('/',auth['isAuthenticated'](),controller[_0xda44('0xc')]);router[_0xda44('0xd')](_0xda44('0x9'),auth[_0xda44('0x7')](),controller[_0xda44('0xe')]);router['delete']('/:id',auth[_0xda44('0x7')](),controller[_0xda44('0xf')]);module[_0xda44('0x10')]=router; \ No newline at end of file +var _0x8b34=['put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create'];(function(_0x618644,_0x24242b){var _0x401623=function(_0x58dcce){while(--_0x58dcce){_0x618644['push'](_0x618644['shift']());}};_0x401623(++_0x24242b);}(_0x8b34,0x84));var _0x48b3=function(_0x5dbbcf,_0x559036){_0x5dbbcf=_0x5dbbcf-0x0;var _0x2f2506=_0x8b34[_0x5dbbcf];return _0x2f2506;};'use strict';var multer=require(_0x48b3('0x0'));var util=require(_0x48b3('0x1'));var path=require('path');var timeout=require(_0x48b3('0x2'));var express=require(_0x48b3('0x3'));var router=express[_0x48b3('0x4')]();var fs_extra=require(_0x48b3('0x5'));var auth=require(_0x48b3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x48b3('0x7'));var controller=require(_0x48b3('0x8'));router[_0x48b3('0x9')]('/',auth[_0x48b3('0xa')](),controller[_0x48b3('0xb')]);router['get']('/:id',auth[_0x48b3('0xa')](),controller[_0x48b3('0xc')]);router[_0x48b3('0xd')]('/',auth['isAuthenticated'](),controller[_0x48b3('0xe')]);router[_0x48b3('0xf')](_0x48b3('0x10'),auth[_0x48b3('0xa')](),controller[_0x48b3('0x11')]);router[_0x48b3('0x12')](_0x48b3('0x10'),auth[_0x48b3('0xa')](),controller[_0x48b3('0x13')]);module[_0x48b3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index b86888d..ec4778e 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 _0x6ab2=['picklist','STRING','ENUM','variable','BOOLEAN','sequelize','exports','string','customVariable','keyValue'];(function(_0x55bb29,_0x591975){var _0x5f4e03=function(_0x11ddbb){while(--_0x11ddbb){_0x55bb29['push'](_0x55bb29['shift']());}};_0x5f4e03(++_0x591975);}(_0x6ab2,0xe1));var _0x26ab=function(_0x26636a,_0x4c92bc){_0x26636a=_0x26636a-0x0;var _0x439a94=_0x6ab2[_0x26636a];return _0x439a94;};'use strict';var Sequelize=require(_0x26ab('0x0'));module[_0x26ab('0x1')]={'type':{'type':Sequelize['ENUM'](_0x26ab('0x2'),'variable',_0x26ab('0x3'),_0x26ab('0x4'),_0x26ab('0x5')),'defaultValue':_0x26ab('0x2')},'content':{'type':Sequelize[_0x26ab('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x26ab('0x7')](_0x26ab('0x2'),_0x26ab('0x8'),_0x26ab('0x3'))},'keyContent':{'type':Sequelize[_0x26ab('0x6')]},'idField':{'type':Sequelize[_0x26ab('0x6')]},'nameField':{'type':Sequelize[_0x26ab('0x6')]},'customField':{'type':Sequelize[_0x26ab('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x26ab('0x6')]}}; \ No newline at end of file +var _0x92f7=['variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3bfd0f,_0x2be446){var _0x108eb4=function(_0x436f8e){while(--_0x436f8e){_0x3bfd0f['push'](_0x3bfd0f['shift']());}};_0x108eb4(++_0x2be446);}(_0x92f7,0xc5));var _0x792f=function(_0x49f368,_0xf070e2){_0x49f368=_0x49f368-0x0;var _0x3923f3=_0x92f7[_0x49f368];return _0x3923f3;};'use strict';var Sequelize=require(_0x792f('0x0'));module[_0x792f('0x1')]={'type':{'type':Sequelize[_0x792f('0x2')]('string',_0x792f('0x3'),_0x792f('0x4'),_0x792f('0x5'),_0x792f('0x6')),'defaultValue':_0x792f('0x7')},'content':{'type':Sequelize[_0x792f('0x8')]},'key':{'type':Sequelize[_0x792f('0x8')]},'keyType':{'type':Sequelize[_0x792f('0x2')]('string',_0x792f('0x3'),_0x792f('0x4'))},'keyContent':{'type':Sequelize[_0x792f('0x8')]},'idField':{'type':Sequelize[_0x792f('0x8')]},'nameField':{'type':Sequelize[_0x792f('0x8')]},'customField':{'type':Sequelize[_0x792f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x792f('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index ca94e49..116953a 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 _0x8cc7=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','destroy','then','end','error','stack','send','Dynamics365Field','type','key','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','map','VIRTUAL','merge','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','update','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x8cc7,0xc7));var _0x78cc=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x8cc7[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x78cc('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x78cc('0x1'));var moment=require('moment');var BPromise=require(_0x78cc('0x2'));var Mustache=require(_0x78cc('0x3'));var util=require(_0x78cc('0x4'));var path=require(_0x78cc('0x5'));var sox=require(_0x78cc('0x6'));var csv=require('to-csv');var ejs=require(_0x78cc('0x7'));var fs=require('fs');var fs_extra=require(_0x78cc('0x8'));var _=require(_0x78cc('0x9'));var squel=require(_0x78cc('0xa'));var crypto=require('crypto');var jsforce=require(_0x78cc('0xb'));var deskjs=require(_0x78cc('0xc'));var toCsv=require('to-csv');var querystring=require(_0x78cc('0xd'));var Papa=require(_0x78cc('0xe'));var Redis=require('ioredis');var authService=require(_0x78cc('0xf'));var qs=require(_0x78cc('0x10'));var as=require(_0x78cc('0x11'));var hardwareService=require(_0x78cc('0x12'));var logger=require(_0x78cc('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x78cc('0x14'));var db=require(_0x78cc('0x15'))['db'];function respondWithStatusCode(_0x533839,_0x58e281){_0x58e281=_0x58e281||0xcc;return function(_0x99d533){if(_0x99d533){return _0x533839[_0x78cc('0x16')](_0x58e281);}return _0x533839[_0x78cc('0x17')](_0x58e281)['end']();};}function respondWithResult(_0x187d42,_0x41eadb){_0x41eadb=_0x41eadb||0xc8;return function(_0x921c){if(_0x921c){return _0x187d42[_0x78cc('0x17')](_0x41eadb)['json'](_0x921c);}};}function respondWithFilteredResult(_0x4f2ad6,_0x1bc52e){return function(_0x436d8c){if(_0x436d8c){var _0x73d072=typeof _0x1bc52e[_0x78cc('0x18')]===_0x78cc('0x19')&&typeof _0x1bc52e[_0x78cc('0x1a')]===_0x78cc('0x19');var _0xa159b1=_0x436d8c['count'];var _0x3bea44=_0x73d072?0x0:_0x1bc52e[_0x78cc('0x18')];var _0x405096=_0x73d072?_0x436d8c[_0x78cc('0x1b')]:_0x1bc52e[_0x78cc('0x18')]+_0x1bc52e[_0x78cc('0x1a')];var _0x1d9f78;if(_0x405096>=_0xa159b1){_0x405096=_0xa159b1;_0x1d9f78=0xc8;}else{_0x1d9f78=0xce;}_0x4f2ad6['status'](_0x1d9f78);return _0x4f2ad6[_0x78cc('0x1c')](_0x78cc('0x1d'),_0x3bea44+'-'+_0x405096+'/'+_0xa159b1)[_0x78cc('0x1e')](_0x436d8c);}return null;};}function patchUpdates(_0x53cd18){return function(_0x18caae){try{jsonpatch['apply'](_0x18caae,_0x53cd18,!![]);}catch(_0x138875){return BPromise[_0x78cc('0x1f')](_0x138875);}return _0x18caae[_0x78cc('0x20')]();};}function saveUpdates(_0x2e77a6,_0x22042a){return function(_0x316e8b){if(_0x316e8b){return _0x316e8b['update'](_0x2e77a6)['then'](function(_0x298e2d){return _0x298e2d;});}return null;};}function removeEntity(_0x105f99,_0x2be36d){return function(_0x4d889d){if(_0x4d889d){return _0x4d889d[_0x78cc('0x21')]()[_0x78cc('0x22')](function(){_0x105f99['status'](0xcc)[_0x78cc('0x23')]();});}};}function handleEntityNotFound(_0xd8075e,_0x4739e5){return function(_0x4f68be){if(!_0x4f68be){_0xd8075e['sendStatus'](0x194);}return _0x4f68be;};}function handleError(_0x4d8345,_0x26515b){_0x26515b=_0x26515b||0x1f4;return function(_0x3433bc){logger[_0x78cc('0x24')](_0x3433bc[_0x78cc('0x25')]);if(_0x3433bc['name']){delete _0x3433bc['name'];}_0x4d8345[_0x78cc('0x17')](_0x26515b)[_0x78cc('0x26')](_0x3433bc);};}exports['index']=function(_0x4435d9,_0x1cb05c){var _0x1972ef={},_0x45c2e9={},_0x52c813={'count':0x0,'rows':[]};var _0x183766=_['map'](db[_0x78cc('0x27')]['rawAttributes'],function(_0xe44e60){return{'name':_0xe44e60['fieldName'],'type':_0xe44e60[_0x78cc('0x28')][_0x78cc('0x29')]};});_0x45c2e9[_0x78cc('0x2a')]=_['map'](_0x183766,_0x78cc('0x2b'));_0x45c2e9[_0x78cc('0x2c')]=_[_0x78cc('0x2d')](_0x4435d9[_0x78cc('0x2c')]);_0x45c2e9[_0x78cc('0x2e')]=_[_0x78cc('0x2f')](_0x45c2e9[_0x78cc('0x2a')],_0x45c2e9[_0x78cc('0x2c')]);_0x1972ef[_0x78cc('0x30')]=_[_0x78cc('0x2f')](_0x45c2e9['model'],qs[_0x78cc('0x31')](_0x4435d9['query'][_0x78cc('0x31')]));_0x1972ef[_0x78cc('0x30')]=_0x1972ef[_0x78cc('0x30')][_0x78cc('0x32')]?_0x1972ef[_0x78cc('0x30')]:_0x45c2e9['model'];if(!_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x33')]('nolimit')){_0x1972ef[_0x78cc('0x1a')]=qs[_0x78cc('0x1a')](_0x4435d9['query'][_0x78cc('0x1a')]);_0x1972ef['offset']=qs['offset'](_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x18')]);}_0x1972ef['order']=qs[_0x78cc('0x34')](_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x34')]);_0x1972ef[_0x78cc('0x35')]=qs['filters'](_[_0x78cc('0x36')](_0x4435d9['query'],_0x45c2e9['filters']),_0x183766);if(_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x37')]){_0x1972ef[_0x78cc('0x35')]=_['merge'](_0x1972ef[_0x78cc('0x35')],{'$or':_[_0x78cc('0x38')](_0x183766,function(_0x1fec84){if(_0x1fec84['type']!==_0x78cc('0x39')){var _0x322d1a={};_0x322d1a[_0x1fec84[_0x78cc('0x2b')]]={'$like':'%'+_0x4435d9[_0x78cc('0x2c')][_0x78cc('0x37')]+'%'};return _0x322d1a;}})});}_0x1972ef=_[_0x78cc('0x3a')]({},_0x1972ef,_0x4435d9['options']);var _0x58dc12={'where':_0x1972ef[_0x78cc('0x35')]};return db[_0x78cc('0x27')]['count'](_0x58dc12)['then'](function(_0xf80743){_0x52c813['count']=_0xf80743;if(_0x4435d9[_0x78cc('0x2c')]['includeAll']){_0x1972ef[_0x78cc('0x3b')]=[{'all':!![]}];}return db[_0x78cc('0x27')][_0x78cc('0x3c')](_0x1972ef);})[_0x78cc('0x22')](function(_0x196369){_0x52c813[_0x78cc('0x3d')]=_0x196369;return _0x52c813;})[_0x78cc('0x22')](respondWithFilteredResult(_0x1cb05c,_0x1972ef))[_0x78cc('0x3e')](handleError(_0x1cb05c,null));};exports[_0x78cc('0x3f')]=function(_0x2786d5,_0x4dd639){var _0x230dd4={'raw':!![],'where':{'id':_0x2786d5[_0x78cc('0x40')]['id']}},_0x1226cd={};_0x1226cd[_0x78cc('0x2a')]=_['keys'](db[_0x78cc('0x27')]['rawAttributes']);_0x1226cd['query']=_[_0x78cc('0x2d')](_0x2786d5[_0x78cc('0x2c')]);_0x1226cd[_0x78cc('0x2e')]=_['intersection'](_0x1226cd[_0x78cc('0x2a')],_0x1226cd[_0x78cc('0x2c')]);_0x230dd4[_0x78cc('0x30')]=_[_0x78cc('0x2f')](_0x1226cd[_0x78cc('0x2a')],qs[_0x78cc('0x31')](_0x2786d5['query'][_0x78cc('0x31')]));_0x230dd4[_0x78cc('0x30')]=_0x230dd4[_0x78cc('0x30')][_0x78cc('0x32')]?_0x230dd4[_0x78cc('0x30')]:_0x1226cd[_0x78cc('0x2a')];if(_0x2786d5[_0x78cc('0x2c')][_0x78cc('0x41')]){_0x230dd4[_0x78cc('0x3b')]=[{'all':!![]}];}_0x230dd4=_[_0x78cc('0x3a')]({},_0x230dd4,_0x2786d5[_0x78cc('0x42')]);return db[_0x78cc('0x27')][_0x78cc('0x43')](_0x230dd4)[_0x78cc('0x22')](handleEntityNotFound(_0x4dd639,null))['then'](respondWithResult(_0x4dd639,null))['catch'](handleError(_0x4dd639,null));};exports[_0x78cc('0x44')]=function(_0x502dda,_0x2f58e4){return db[_0x78cc('0x27')]['create'](_0x502dda[_0x78cc('0x45')],{})[_0x78cc('0x22')](respondWithResult(_0x2f58e4,0xc9))['catch'](handleError(_0x2f58e4,null));};exports[_0x78cc('0x46')]=function(_0xc5c94d,_0x57b1e8){if(_0xc5c94d['body']['id']){delete _0xc5c94d[_0x78cc('0x45')]['id'];}return db[_0x78cc('0x27')][_0x78cc('0x43')]({'where':{'id':_0xc5c94d[_0x78cc('0x40')]['id']}})[_0x78cc('0x22')](handleEntityNotFound(_0x57b1e8,null))[_0x78cc('0x22')](saveUpdates(_0xc5c94d[_0x78cc('0x45')],null))[_0x78cc('0x22')](respondWithResult(_0x57b1e8,null))['catch'](handleError(_0x57b1e8,null));};exports['destroy']=function(_0x5779d5,_0x29344e){return db[_0x78cc('0x27')]['find']({'where':{'id':_0x5779d5[_0x78cc('0x40')]['id']}})[_0x78cc('0x22')](handleEntityNotFound(_0x29344e,null))['then'](removeEntity(_0x29344e,null))['catch'](handleError(_0x29344e,null));}; \ No newline at end of file +var _0xd418=['then','destroy','error','stack','name','index','Dynamics365Field','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','merge','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../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','set','Content-Range','apply','update'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xd418,0x14c));var _0x8d41=function(_0x58af47,_0x258d82){_0x58af47=_0x58af47-0x0;var _0x4e2470=_0xd418[_0x58af47];return _0x4e2470;};'use strict';var emlformat=require(_0x8d41('0x0'));var rimraf=require(_0x8d41('0x1'));var zipdir=require(_0x8d41('0x2'));var jsonpatch=require(_0x8d41('0x3'));var rp=require(_0x8d41('0x4'));var moment=require('moment');var BPromise=require(_0x8d41('0x5'));var Mustache=require(_0x8d41('0x6'));var util=require(_0x8d41('0x7'));var path=require(_0x8d41('0x8'));var sox=require('sox');var csv=require(_0x8d41('0x9'));var ejs=require(_0x8d41('0xa'));var fs=require('fs');var fs_extra=require(_0x8d41('0xb'));var _=require(_0x8d41('0xc'));var squel=require(_0x8d41('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8d41('0xe'));var toCsv=require(_0x8d41('0x9'));var querystring=require(_0x8d41('0xf'));var Papa=require(_0x8d41('0x10'));var Redis=require(_0x8d41('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8d41('0x12'));var as=require(_0x8d41('0x13'));var hardwareService=require(_0x8d41('0x14'));var logger=require(_0x8d41('0x15'))(_0x8d41('0x16'));var utils=require(_0x8d41('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8d41('0x18'));var db=require(_0x8d41('0x19'))['db'];function respondWithStatusCode(_0x3bce94,_0x34a85d){_0x34a85d=_0x34a85d||0xcc;return function(_0x66d43f){if(_0x66d43f){return _0x3bce94[_0x8d41('0x1a')](_0x34a85d);}return _0x3bce94[_0x8d41('0x1b')](_0x34a85d)[_0x8d41('0x1c')]();};}function respondWithResult(_0x8ff176,_0x4d93ab){_0x4d93ab=_0x4d93ab||0xc8;return function(_0x48e5da){if(_0x48e5da){return _0x8ff176[_0x8d41('0x1b')](_0x4d93ab)[_0x8d41('0x1d')](_0x48e5da);}};}function respondWithFilteredResult(_0x49db6f,_0x482272){return function(_0x5011d0){if(_0x5011d0){var _0x3db217=typeof _0x482272['offset']===_0x8d41('0x1e')&&typeof _0x482272[_0x8d41('0x1f')]===_0x8d41('0x1e');var _0x6b3e9=_0x5011d0[_0x8d41('0x20')];var _0x504137=_0x3db217?0x0:_0x482272[_0x8d41('0x21')];var _0x3dfd9a=_0x3db217?_0x5011d0[_0x8d41('0x20')]:_0x482272['offset']+_0x482272[_0x8d41('0x1f')];var _0xea536a;if(_0x3dfd9a>=_0x6b3e9){_0x3dfd9a=_0x6b3e9;_0xea536a=0xc8;}else{_0xea536a=0xce;}_0x49db6f[_0x8d41('0x1b')](_0xea536a);return _0x49db6f[_0x8d41('0x22')](_0x8d41('0x23'),_0x504137+'-'+_0x3dfd9a+'/'+_0x6b3e9)[_0x8d41('0x1d')](_0x5011d0);}return null;};}function patchUpdates(_0x48e1ff){return function(_0x2e4249){try{jsonpatch[_0x8d41('0x24')](_0x2e4249,_0x48e1ff,!![]);}catch(_0x3a1b82){return BPromise['reject'](_0x3a1b82);}return _0x2e4249['save']();};}function saveUpdates(_0x2eda20,_0x28e4ca){return function(_0x84a423){if(_0x84a423){return _0x84a423[_0x8d41('0x25')](_0x2eda20)[_0x8d41('0x26')](function(_0x2202ff){return _0x2202ff;});}return null;};}function removeEntity(_0x1172b0,_0x3e092b){return function(_0x464890){if(_0x464890){return _0x464890[_0x8d41('0x27')]()['then'](function(){_0x1172b0[_0x8d41('0x1b')](0xcc)[_0x8d41('0x1c')]();});}};}function handleEntityNotFound(_0x5f8e25,_0x44c191){return function(_0x53ae2f){if(!_0x53ae2f){_0x5f8e25[_0x8d41('0x1a')](0x194);}return _0x53ae2f;};}function handleError(_0x24b5df,_0x141e68){_0x141e68=_0x141e68||0x1f4;return function(_0x104885){logger[_0x8d41('0x28')](_0x104885[_0x8d41('0x29')]);if(_0x104885[_0x8d41('0x2a')]){delete _0x104885['name'];}_0x24b5df[_0x8d41('0x1b')](_0x141e68)['send'](_0x104885);};}exports[_0x8d41('0x2b')]=function(_0x49d435,_0x5f3ef6){var _0x2a0133={},_0x1ec6e5={},_0x220f41={'count':0x0,'rows':[]};var _0xffaf19=_['map'](db[_0x8d41('0x2c')][_0x8d41('0x2d')],function(_0x5f4ce1){return{'name':_0x5f4ce1[_0x8d41('0x2e')],'type':_0x5f4ce1['type'][_0x8d41('0x2f')]};});_0x1ec6e5[_0x8d41('0x30')]=_[_0x8d41('0x31')](_0xffaf19,'name');_0x1ec6e5[_0x8d41('0x32')]=_[_0x8d41('0x33')](_0x49d435['query']);_0x1ec6e5[_0x8d41('0x34')]=_[_0x8d41('0x35')](_0x1ec6e5[_0x8d41('0x30')],_0x1ec6e5[_0x8d41('0x32')]);_0x2a0133[_0x8d41('0x36')]=_[_0x8d41('0x35')](_0x1ec6e5[_0x8d41('0x30')],qs['fields'](_0x49d435['query'][_0x8d41('0x37')]));_0x2a0133[_0x8d41('0x36')]=_0x2a0133[_0x8d41('0x36')][_0x8d41('0x38')]?_0x2a0133[_0x8d41('0x36')]:_0x1ec6e5[_0x8d41('0x30')];if(!_0x49d435['query'][_0x8d41('0x39')](_0x8d41('0x3a'))){_0x2a0133['limit']=qs[_0x8d41('0x1f')](_0x49d435[_0x8d41('0x32')][_0x8d41('0x1f')]);_0x2a0133['offset']=qs['offset'](_0x49d435[_0x8d41('0x32')]['offset']);}_0x2a0133['order']=qs['sort'](_0x49d435[_0x8d41('0x32')]['sort']);_0x2a0133[_0x8d41('0x3b')]=qs['filters'](_[_0x8d41('0x3c')](_0x49d435[_0x8d41('0x32')],_0x1ec6e5['filters']),_0xffaf19);if(_0x49d435[_0x8d41('0x32')]['filter']){_0x2a0133['where']=_['merge'](_0x2a0133[_0x8d41('0x3b')],{'$or':_[_0x8d41('0x31')](_0xffaf19,function(_0x50633d){if(_0x50633d['type']!==_0x8d41('0x3d')){var _0x556717={};_0x556717[_0x50633d[_0x8d41('0x2a')]]={'$like':'%'+_0x49d435[_0x8d41('0x32')][_0x8d41('0x3e')]+'%'};return _0x556717;}})});}_0x2a0133=_['merge']({},_0x2a0133,_0x49d435[_0x8d41('0x3f')]);var _0x4e542d={'where':_0x2a0133['where']};return db[_0x8d41('0x2c')]['count'](_0x4e542d)['then'](function(_0x5e64f7){_0x220f41['count']=_0x5e64f7;if(_0x49d435[_0x8d41('0x32')][_0x8d41('0x40')]){_0x2a0133['include']=[{'all':!![]}];}return db['Dynamics365Field'][_0x8d41('0x41')](_0x2a0133);})['then'](function(_0x133090){_0x220f41[_0x8d41('0x42')]=_0x133090;return _0x220f41;})[_0x8d41('0x26')](respondWithFilteredResult(_0x5f3ef6,_0x2a0133))[_0x8d41('0x43')](handleError(_0x5f3ef6,null));};exports[_0x8d41('0x44')]=function(_0x69f18,_0x55fe47){var _0x441497={'raw':!![],'where':{'id':_0x69f18[_0x8d41('0x45')]['id']}},_0x401fcd={};_0x401fcd[_0x8d41('0x30')]=_[_0x8d41('0x33')](db[_0x8d41('0x2c')][_0x8d41('0x2d')]);_0x401fcd[_0x8d41('0x32')]=_['keys'](_0x69f18[_0x8d41('0x32')]);_0x401fcd[_0x8d41('0x34')]=_[_0x8d41('0x35')](_0x401fcd['model'],_0x401fcd[_0x8d41('0x32')]);_0x441497['attributes']=_[_0x8d41('0x35')](_0x401fcd[_0x8d41('0x30')],qs[_0x8d41('0x37')](_0x69f18[_0x8d41('0x32')][_0x8d41('0x37')]));_0x441497[_0x8d41('0x36')]=_0x441497[_0x8d41('0x36')][_0x8d41('0x38')]?_0x441497[_0x8d41('0x36')]:_0x401fcd['model'];if(_0x69f18[_0x8d41('0x32')][_0x8d41('0x40')]){_0x441497['include']=[{'all':!![]}];}_0x441497=_[_0x8d41('0x46')]({},_0x441497,_0x69f18['options']);return db[_0x8d41('0x2c')]['find'](_0x441497)['then'](handleEntityNotFound(_0x55fe47,null))[_0x8d41('0x26')](respondWithResult(_0x55fe47,null))[_0x8d41('0x43')](handleError(_0x55fe47,null));};exports[_0x8d41('0x47')]=function(_0x69e053,_0x465340){return db[_0x8d41('0x2c')][_0x8d41('0x47')](_0x69e053[_0x8d41('0x48')],{})[_0x8d41('0x26')](respondWithResult(_0x465340,0xc9))[_0x8d41('0x43')](handleError(_0x465340,null));};exports[_0x8d41('0x25')]=function(_0x4eef5d,_0x1f4312){if(_0x4eef5d['body']['id']){delete _0x4eef5d[_0x8d41('0x48')]['id'];}return db[_0x8d41('0x2c')][_0x8d41('0x49')]({'where':{'id':_0x4eef5d[_0x8d41('0x45')]['id']}})[_0x8d41('0x26')](handleEntityNotFound(_0x1f4312,null))[_0x8d41('0x26')](saveUpdates(_0x4eef5d[_0x8d41('0x48')],null))[_0x8d41('0x26')](respondWithResult(_0x1f4312,null))[_0x8d41('0x43')](handleError(_0x1f4312,null));};exports['destroy']=function(_0x264412,_0x251719){return db[_0x8d41('0x2c')][_0x8d41('0x49')]({'where':{'id':_0x264412[_0x8d41('0x45')]['id']}})[_0x8d41('0x26')](handleEntityNotFound(_0x251719,null))['then'](removeEntity(_0x251719,null))[_0x8d41('0x43')](handleError(_0x251719,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 6ba309b..232dec8 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 _0xe23f=['FieldId','util','api','moment','bluebird','request-promise','./intDynamics365Field.attributes','exports','define','Dynamics365Field','dynamics365_unique_index','idField'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe23f,0x1b1));var _0xfe23=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe23f[_0x53ccf2];return _0x5a2964;};'use strict';var _=require('lodash');var util=require(_0xfe23('0x0'));var logger=require('../../config/logger')(_0xfe23('0x1'));var moment=require(_0xfe23('0x2'));var BPromise=require(_0xfe23('0x3'));var rp=require(_0xfe23('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfe23('0x5'));module[_0xfe23('0x6')]=function(_0x2feeb4,_0x296d33){return _0x2feeb4[_0xfe23('0x7')](_0xfe23('0x8'),attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0xfe23('0x9'),'fields':[_0xfe23('0xa'),_0xfe23('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe31e=['path','rimraf','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x788aa6,_0x4a8911){var _0x4fe814=function(_0x3120c5){while(--_0x3120c5){_0x788aa6['push'](_0x788aa6['shift']());}};_0x4fe814(++_0x4a8911);}(_0xe31e,0xa0));var _0xee31=function(_0x30b4d2,_0x4f3353){_0x30b4d2=_0x30b4d2-0x0;var _0x20928f=_0xe31e[_0x30b4d2];return _0x20928f;};'use strict';var _=require(_0xee31('0x0'));var util=require('util');var logger=require(_0xee31('0x1'))(_0xee31('0x2'));var moment=require(_0xee31('0x3'));var BPromise=require(_0xee31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee31('0x5'));var rimraf=require(_0xee31('0x6'));var config=require(_0xee31('0x7'));var attributes=require('./intDynamics365Field.attributes');module[_0xee31('0x8')]=function(_0x1fc8d0,_0x2079bb){return _0x1fc8d0[_0xee31('0x9')](_0xee31('0xa'),attributes,{'tableName':_0xee31('0xb'),'paranoid':![],'indexes':[{'name':_0xee31('0xc'),'fields':[_0xee31('0xd'),_0xee31('0xe')],'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 d2bb1fc..575c61e 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 _0x9da3=['request','then','info','Dynamics365Field,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x5676fc,_0x1507e4){var _0x13999b=function(_0x11395a){while(--_0x11395a){_0x5676fc['push'](_0x5676fc['shift']());}};_0x13999b(++_0x1507e4);}(_0x9da3,0x8f));var _0x39da=function(_0xd0b60,_0xcacdaa){_0xd0b60=_0xd0b60-0x0;var _0x14851a=_0x9da3[_0xd0b60];return _0x14851a;};'use strict';var _=require(_0x39da('0x0'));var util=require('util');var moment=require(_0x39da('0x1'));var BPromise=require(_0x39da('0x2'));var rs=require(_0x39da('0x3'));var fs=require('fs');var Redis=require(_0x39da('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x39da('0x5'));var logger=require(_0x39da('0x6'))('rpc');var config=require(_0x39da('0x7'));var jayson=require(_0x39da('0x8'));var client=jayson[_0x39da('0x9')][_0x39da('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21727b,_0x12fd43,_0xa8199){return new BPromise(function(_0x34fd76,_0x1174d4){return client[_0x39da('0xb')](_0x21727b,_0xa8199)[_0x39da('0xc')](function(_0xeadccc){logger[_0x39da('0xd')](_0x39da('0xe'),_0x12fd43,'request\x20sent');logger[_0x39da('0xf')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x12fd43,_0x39da('0x10'),JSON[_0x39da('0x11')](_0xeadccc));if(_0xeadccc[_0x39da('0x12')]){if(_0xeadccc['error'][_0x39da('0x13')]===0x1f4){logger['error'](_0x39da('0xe'),_0x12fd43,_0xeadccc[_0x39da('0x12')][_0x39da('0x14')]);return _0x1174d4(_0xeadccc[_0x39da('0x12')]['message']);}logger[_0x39da('0x12')](_0x39da('0xe'),_0x12fd43,_0xeadccc[_0x39da('0x12')][_0x39da('0x14')]);return _0x34fd76(_0xeadccc[_0x39da('0x12')][_0x39da('0x14')]);}else{logger[_0x39da('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0x12fd43,'request\x20sent');_0x34fd76(_0xeadccc['result'][_0x39da('0x14')]);}})[_0x39da('0x15')](function(_0x302757){logger[_0x39da('0x12')](_0x39da('0xe'),_0x12fd43,_0x302757);_0x1174d4(_0x302757);});});} \ No newline at end of file +var _0xb940=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x238cf7,_0x51dd7f){var _0xafebe0=function(_0x13ce5e){while(--_0x13ce5e){_0x238cf7['push'](_0x238cf7['shift']());}};_0xafebe0(++_0x51dd7f);}(_0xb940,0x1f4));var _0x0b94=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0xb940[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0x0b94('0x0'));var util=require(_0x0b94('0x1'));var moment=require(_0x0b94('0x2'));var BPromise=require(_0x0b94('0x3'));var rs=require(_0x0b94('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0b94('0x5'))['db'];var utils=require(_0x0b94('0x6'));var logger=require(_0x0b94('0x7'))(_0x0b94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0b94('0x9')][_0x0b94('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x84dfc9,_0x2faca3,_0x3158cb){return new BPromise(function(_0x506480,_0xff0476){return client['request'](_0x84dfc9,_0x3158cb)[_0x0b94('0xb')](function(_0x1a80b3){logger[_0x0b94('0xc')](_0x0b94('0xd'),_0x2faca3,'request\x20sent');logger['debug'](_0x0b94('0xe'),_0x2faca3,_0x0b94('0xf'),JSON[_0x0b94('0x10')](_0x1a80b3));if(_0x1a80b3['error']){if(_0x1a80b3[_0x0b94('0x11')][_0x0b94('0x12')]===0x1f4){logger[_0x0b94('0x11')](_0x0b94('0xd'),_0x2faca3,_0x1a80b3[_0x0b94('0x11')][_0x0b94('0x13')]);return _0xff0476(_0x1a80b3['error']['message']);}logger[_0x0b94('0x11')](_0x0b94('0xd'),_0x2faca3,_0x1a80b3['error'][_0x0b94('0x13')]);return _0x506480(_0x1a80b3[_0x0b94('0x11')][_0x0b94('0x13')]);}else{logger['info'](_0x0b94('0xd'),_0x2faca3,_0x0b94('0xf'));_0x506480(_0x1a80b3['result'][_0x0b94('0x13')]);}})[_0x0b94('0x14')](function(_0x5f0dc8){logger[_0x0b94('0x11')](_0x0b94('0xd'),_0x2faca3,_0x5f0dc8);_0xff0476(_0x5f0dc8);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f548ed4..c553621 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 _0xa8e7=['post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x2cd52b,_0x55326f){var _0x126e79=function(_0x315f7d){while(--_0x315f7d){_0x2cd52b['push'](_0x2cd52b['shift']());}};_0x126e79(++_0x55326f);}(_0xa8e7,0x1ac));var _0x7a8e=function(_0xd344ef,_0x132b5f){_0xd344ef=_0xd344ef-0x0;var _0x50a171=_0xa8e7[_0xd344ef];return _0x50a171;};'use strict';var multer=require(_0x7a8e('0x0'));var util=require(_0x7a8e('0x1'));var path=require(_0x7a8e('0x2'));var timeout=require(_0x7a8e('0x3'));var express=require(_0x7a8e('0x4'));var router=express[_0x7a8e('0x5')]();var fs_extra=require(_0x7a8e('0x6'));var auth=require(_0x7a8e('0x7'));var interaction=require(_0x7a8e('0x8'));var config=require(_0x7a8e('0x9'));var controller=require(_0x7a8e('0xa'));router[_0x7a8e('0xb')]('/',auth[_0x7a8e('0xc')](),controller[_0x7a8e('0xd')]);router[_0x7a8e('0xb')](_0x7a8e('0xe'),auth[_0x7a8e('0xc')](),controller[_0x7a8e('0xf')]);router[_0x7a8e('0xb')](_0x7a8e('0x10'),auth['isAuthenticated'](),controller[_0x7a8e('0x11')]);router['get'](_0x7a8e('0x12'),auth['isAuthenticated'](),controller[_0x7a8e('0x13')]);router[_0x7a8e('0x14')]('/',auth[_0x7a8e('0xc')](),controller[_0x7a8e('0x15')]);router['post'](_0x7a8e('0x10'),auth[_0x7a8e('0xc')](),controller[_0x7a8e('0x16')]);router[_0x7a8e('0x17')](_0x7a8e('0xe'),auth[_0x7a8e('0xc')](),controller[_0x7a8e('0x18')]);router[_0x7a8e('0x19')](_0x7a8e('0xe'),auth['isAuthenticated'](),controller[_0x7a8e('0x1a')]);module[_0x7a8e('0x1b')]=router; \ No newline at end of file +var _0x1e3c=['getFields','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0x1e3c,0x80));var _0xc1e3=function(_0x5e1cae,_0x44c44a){_0x5e1cae=_0x5e1cae-0x0;var _0x270d1f=_0x1e3c[_0x5e1cae];return _0x270d1f;};'use strict';var multer=require('multer');var util=require(_0xc1e3('0x0'));var path=require('path');var timeout=require(_0xc1e3('0x1'));var express=require(_0xc1e3('0x2'));var router=express[_0xc1e3('0x3')]();var fs_extra=require(_0xc1e3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc1e3('0x5'));var config=require(_0xc1e3('0x6'));var controller=require(_0xc1e3('0x7'));router[_0xc1e3('0x8')]('/',auth[_0xc1e3('0x9')](),controller[_0xc1e3('0xa')]);router[_0xc1e3('0x8')](_0xc1e3('0xb'),auth[_0xc1e3('0x9')](),controller[_0xc1e3('0xc')]);router[_0xc1e3('0x8')](_0xc1e3('0xd'),auth[_0xc1e3('0x9')](),controller[_0xc1e3('0xe')]);router[_0xc1e3('0x8')](_0xc1e3('0xf'),auth['isAuthenticated'](),controller[_0xc1e3('0x10')]);router[_0xc1e3('0x11')]('/',auth[_0xc1e3('0x9')](),controller[_0xc1e3('0x12')]);router[_0xc1e3('0x11')](_0xc1e3('0xd'),auth[_0xc1e3('0x9')](),controller['addConfiguration']);router[_0xc1e3('0x13')](_0xc1e3('0xb'),auth[_0xc1e3('0x9')](),controller[_0xc1e3('0x14')]);router[_0xc1e3('0x15')](_0xc1e3('0xb'),auth[_0xc1e3('0x9')](),controller[_0xc1e3('0x16')]);module[_0xc1e3('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index e158b77..bbd29e2 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 _0x1a85=['STRING','remoteUri'];(function(_0x12aa2d,_0x352204){var _0x45a2e3=function(_0x3234bd){while(--_0x3234bd){_0x12aa2d['push'](_0x12aa2d['shift']());}};_0x45a2e3(++_0x352204);}(_0x1a85,0x178));var _0x51a8=function(_0x28b301,_0x1dd9f9){_0x28b301=_0x28b301-0x0;var _0x4febe0=_0x1a85[_0x28b301];return _0x4febe0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x51a8('0x0')]},'description':{'type':Sequelize[_0x51a8('0x0')]},'username':{'type':Sequelize[_0x51a8('0x0')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x51a8('0x0')],'unique':_0x51a8('0x1')},'serverUrl':{'type':Sequelize[_0x51a8('0x0')],'allowNull':![]}}; \ No newline at end of file +var _0x3266=['remoteUri','sequelize','exports','STRING','username'];(function(_0x103466,_0x190bb5){var _0x416ba8=function(_0x4854c9){while(--_0x4854c9){_0x103466['push'](_0x103466['shift']());}};_0x416ba8(++_0x190bb5);}(_0x3266,0x6a));var _0x6326=function(_0x58547b,_0x4b89c2){_0x58547b=_0x58547b-0x0;var _0x1d3fd2=_0x3266[_0x58547b];return _0x1d3fd2;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'name':{'type':Sequelize[_0x6326('0x2')]},'description':{'type':Sequelize[_0x6326('0x2')]},'username':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x3')},'apiKey':{'type':Sequelize[_0x6326('0x2')]},'remoteUri':{'type':Sequelize[_0x6326('0x2')],'unique':_0x6326('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 4cbed59..4e9383e 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 _0x0f88=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','save','update','destroy','end','stack','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','filter','merge','VIRTUAL','options','then','findAll','rows','params','keys','rawAttributes','includeAll','include','find','catch','create','body','getConfigurations','order','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','GET','format','%s/%s','Basic\x20%s','toString','base64','requester','subject','agent','description','source','group','company','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0xfcd7c9,_0x4621fa){var _0x14a2d1=function(_0x47215c){while(--_0x47215c){_0xfcd7c9['push'](_0xfcd7c9['shift']());}};_0x14a2d1(++_0x4621fa);}(_0x0f88,0x1d9));var _0x80f8=function(_0x331b85,_0x5f3e6e){_0x331b85=_0x331b85-0x0;var _0x1b97b2=_0x0f88[_0x331b85];return _0x1b97b2;};'use strict';var emlformat=require(_0x80f8('0x0'));var rimraf=require(_0x80f8('0x1'));var zipdir=require(_0x80f8('0x2'));var jsonpatch=require(_0x80f8('0x3'));var rp=require(_0x80f8('0x4'));var moment=require(_0x80f8('0x5'));var BPromise=require(_0x80f8('0x6'));var Mustache=require(_0x80f8('0x7'));var util=require('util');var path=require(_0x80f8('0x8'));var sox=require('sox');var csv=require(_0x80f8('0x9'));var ejs=require(_0x80f8('0xa'));var fs=require('fs');var fs_extra=require(_0x80f8('0xb'));var _=require(_0x80f8('0xc'));var squel=require(_0x80f8('0xd'));var crypto=require(_0x80f8('0xe'));var jsforce=require(_0x80f8('0xf'));var deskjs=require(_0x80f8('0x10'));var toCsv=require(_0x80f8('0x9'));var querystring=require(_0x80f8('0x11'));var Papa=require(_0x80f8('0x12'));var Redis=require(_0x80f8('0x13'));var authService=require(_0x80f8('0x14'));var qs=require(_0x80f8('0x15'));var as=require(_0x80f8('0x16'));var hardwareService=require(_0x80f8('0x17'));var logger=require(_0x80f8('0x18'))(_0x80f8('0x19'));var utils=require(_0x80f8('0x1a'));var config=require(_0x80f8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x80f8('0x1c'))['db'];var integrations=require(_0x80f8('0x1d'));function respondWithStatusCode(_0x35538b,_0x5e6020){_0x5e6020=_0x5e6020||0xcc;return function(_0x280db2){if(_0x280db2){return _0x35538b[_0x80f8('0x1e')](_0x5e6020);}return _0x35538b[_0x80f8('0x1f')](_0x5e6020)['end']();};}function respondWithResult(_0x4887d3,_0x4f8755){_0x4f8755=_0x4f8755||0xc8;return function(_0x5e29bf){if(_0x5e29bf){return _0x4887d3[_0x80f8('0x1f')](_0x4f8755)['json'](_0x5e29bf);}};}function respondWithFilteredResult(_0x2c9b94,_0x25c36b){return function(_0x381355){if(_0x381355){var _0x3817be=typeof _0x25c36b[_0x80f8('0x20')]===_0x80f8('0x21')&&typeof _0x25c36b[_0x80f8('0x22')]===_0x80f8('0x21');var _0x375f42=_0x381355[_0x80f8('0x23')];var _0x581196=_0x3817be?0x0:_0x25c36b[_0x80f8('0x20')];var _0x981e13=_0x3817be?_0x381355[_0x80f8('0x23')]:_0x25c36b[_0x80f8('0x20')]+_0x25c36b[_0x80f8('0x22')];var _0x538e77;if(_0x981e13>=_0x375f42){_0x981e13=_0x375f42;_0x538e77=0xc8;}else{_0x538e77=0xce;}_0x2c9b94[_0x80f8('0x1f')](_0x538e77);return _0x2c9b94[_0x80f8('0x24')]('Content-Range',_0x581196+'-'+_0x981e13+'/'+_0x375f42)[_0x80f8('0x25')](_0x381355);}return null;};}function patchUpdates(_0x3d23b5){return function(_0x50d3b9){try{jsonpatch[_0x80f8('0x26')](_0x50d3b9,_0x3d23b5,!![]);}catch(_0x29c71c){return BPromise[_0x80f8('0x27')](_0x29c71c);}return _0x50d3b9[_0x80f8('0x28')]();};}function saveUpdates(_0x214dc7,_0x1a4988){return function(_0x168009){if(_0x168009){return _0x168009[_0x80f8('0x29')](_0x214dc7)['then'](function(_0x26c62a){return _0x26c62a;});}return null;};}function removeEntity(_0x530350,_0x192ae5){return function(_0x5336ad){if(_0x5336ad){return _0x5336ad[_0x80f8('0x2a')]()['then'](function(){_0x530350[_0x80f8('0x1f')](0xcc)[_0x80f8('0x2b')]();});}};}function handleEntityNotFound(_0x5e3f76,_0x57fad1){return function(_0x53be8e){if(!_0x53be8e){_0x5e3f76[_0x80f8('0x1e')](0x194);}return _0x53be8e;};}function handleError(_0x3032bb,_0x4ae1a6){_0x4ae1a6=_0x4ae1a6||0x1f4;return function(_0x40ed3e){logger['error'](_0x40ed3e[_0x80f8('0x2c')]);if(_0x40ed3e['name']){delete _0x40ed3e[_0x80f8('0x2d')];}_0x3032bb['status'](_0x4ae1a6)[_0x80f8('0x2e')](_0x40ed3e);};}exports[_0x80f8('0x2f')]=function(_0x109ea3,_0x46d379){var _0x42e871={},_0x14fcce={},_0x436d24={'count':0x0,'rows':[]};var _0x1bd039=_[_0x80f8('0x30')](db[_0x80f8('0x31')]['rawAttributes'],function(_0x545f3c){return{'name':_0x545f3c[_0x80f8('0x32')],'type':_0x545f3c[_0x80f8('0x33')][_0x80f8('0x34')]};});_0x14fcce[_0x80f8('0x35')]=_['map'](_0x1bd039,_0x80f8('0x2d'));_0x14fcce[_0x80f8('0x36')]=_['keys'](_0x109ea3[_0x80f8('0x36')]);_0x14fcce['filters']=_[_0x80f8('0x37')](_0x14fcce['model'],_0x14fcce[_0x80f8('0x36')]);_0x42e871[_0x80f8('0x38')]=_['intersection'](_0x14fcce['model'],qs[_0x80f8('0x39')](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x39')]));_0x42e871[_0x80f8('0x38')]=_0x42e871[_0x80f8('0x38')][_0x80f8('0x3a')]?_0x42e871[_0x80f8('0x38')]:_0x14fcce['model'];if(!_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x42e871[_0x80f8('0x22')]=qs['limit'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x22')]);_0x42e871[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x109ea3['query'][_0x80f8('0x20')]);}_0x42e871['order']=qs['sort'](_0x109ea3[_0x80f8('0x36')][_0x80f8('0x3d')]);_0x42e871[_0x80f8('0x3e')]=qs[_0x80f8('0x3f')](_['pick'](_0x109ea3[_0x80f8('0x36')],_0x14fcce[_0x80f8('0x3f')]),_0x1bd039);if(_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]){_0x42e871[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x42e871[_0x80f8('0x3e')],{'$or':_[_0x80f8('0x30')](_0x1bd039,function(_0x173c61){if(_0x173c61[_0x80f8('0x33')]!==_0x80f8('0x42')){var _0x592de={};_0x592de[_0x173c61[_0x80f8('0x2d')]]={'$like':'%'+_0x109ea3[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x592de;}})});}_0x42e871=_[_0x80f8('0x41')]({},_0x42e871,_0x109ea3[_0x80f8('0x43')]);var _0x3940f1={'where':_0x42e871[_0x80f8('0x3e')]};return db['FreshdeskAccount'][_0x80f8('0x23')](_0x3940f1)[_0x80f8('0x44')](function(_0x4365a4){_0x436d24['count']=_0x4365a4;if(_0x109ea3['query']['includeAll']){_0x42e871['include']=[{'all':!![]}];}return db[_0x80f8('0x31')][_0x80f8('0x45')](_0x42e871);})[_0x80f8('0x44')](function(_0x1a9eb9){_0x436d24[_0x80f8('0x46')]=_0x1a9eb9;return _0x436d24;})[_0x80f8('0x44')](respondWithFilteredResult(_0x46d379,_0x42e871))['catch'](handleError(_0x46d379,null));};exports['show']=function(_0x3c6b03,_0x38a9c2){var _0x75feef={'raw':![],'where':{'id':_0x3c6b03[_0x80f8('0x47')]['id']}},_0x5ae1d={};_0x5ae1d['model']=_[_0x80f8('0x48')](db[_0x80f8('0x31')][_0x80f8('0x49')]);_0x5ae1d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3c6b03[_0x80f8('0x36')]);_0x5ae1d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],_0x5ae1d[_0x80f8('0x36')]);_0x75feef[_0x80f8('0x38')]=_[_0x80f8('0x37')](_0x5ae1d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3c6b03[_0x80f8('0x36')][_0x80f8('0x39')]));_0x75feef[_0x80f8('0x38')]=_0x75feef['attributes'][_0x80f8('0x3a')]?_0x75feef[_0x80f8('0x38')]:_0x5ae1d['model'];if(_0x3c6b03['query'][_0x80f8('0x4a')]){_0x75feef[_0x80f8('0x4b')]=[{'all':!![]}];}_0x75feef=_[_0x80f8('0x41')]({},_0x75feef,_0x3c6b03[_0x80f8('0x43')]);return db['FreshdeskAccount'][_0x80f8('0x4c')](_0x75feef)[_0x80f8('0x44')](handleEntityNotFound(_0x38a9c2,null))['then'](respondWithResult(_0x38a9c2,null))[_0x80f8('0x4d')](handleError(_0x38a9c2,null));};exports[_0x80f8('0x4e')]=function(_0x5be18f,_0x181487){return db[_0x80f8('0x31')]['create'](_0x5be18f[_0x80f8('0x4f')],{})['then'](respondWithResult(_0x181487,0xc9))[_0x80f8('0x4d')](handleError(_0x181487,null));};exports['update']=function(_0x3d73ac,_0xf2eb0){if(_0x3d73ac[_0x80f8('0x4f')]['id']){delete _0x3d73ac[_0x80f8('0x4f')]['id'];}return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x3d73ac[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xf2eb0,null))['then'](saveUpdates(_0x3d73ac[_0x80f8('0x4f')],null))['then'](respondWithResult(_0xf2eb0,null))[_0x80f8('0x4d')](handleError(_0xf2eb0,null));};exports[_0x80f8('0x2a')]=function(_0x46135b,_0x2ba4c2){return db[_0x80f8('0x31')][_0x80f8('0x4c')]({'where':{'id':_0x46135b[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0x2ba4c2,null))[_0x80f8('0x44')](removeEntity(_0x2ba4c2,null))[_0x80f8('0x4d')](handleError(_0x2ba4c2,null));};exports[_0x80f8('0x50')]=function(_0x3aa28f,_0xb1204c,_0x133229){var _0x5848ca={};var _0x177e8d={};var _0x8c589f;var _0x87bb6a;return db[_0x80f8('0x31')]['findOne']({'where':{'id':_0x3aa28f[_0x80f8('0x47')]['id']}})['then'](handleEntityNotFound(_0xb1204c,null))[_0x80f8('0x44')](function(_0x3b886b){if(_0x3b886b){_0x8c589f=_0x3b886b;_0x177e8d[_0x80f8('0x35')]=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x177e8d[_0x80f8('0x36')]=_[_0x80f8('0x48')](_0x3aa28f[_0x80f8('0x36')]);_0x177e8d[_0x80f8('0x3f')]=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],_0x177e8d[_0x80f8('0x36')]);_0x5848ca['attributes']=_[_0x80f8('0x37')](_0x177e8d[_0x80f8('0x35')],qs[_0x80f8('0x39')](_0x3aa28f[_0x80f8('0x36')]['fields']));_0x5848ca[_0x80f8('0x38')]=_0x5848ca['attributes'][_0x80f8('0x3a')]?_0x5848ca[_0x80f8('0x38')]:_0x177e8d['model'];_0x5848ca[_0x80f8('0x51')]=qs[_0x80f8('0x3d')](_0x3aa28f[_0x80f8('0x36')]['sort']);_0x5848ca[_0x80f8('0x3e')]=qs['filters'](_[_0x80f8('0x52')](_0x3aa28f[_0x80f8('0x36')],_0x177e8d['filters']));if(_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]){_0x5848ca[_0x80f8('0x3e')]=_[_0x80f8('0x41')](_0x5848ca['where'],{'$or':_[_0x80f8('0x30')](_0x5848ca[_0x80f8('0x38')],function(_0x1735ea){var _0x40e717={};_0x40e717[_0x1735ea]={'$like':'%'+_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x40')]+'%'};return _0x40e717;})});}_0x5848ca=_[_0x80f8('0x41')]({},_0x5848ca,_0x3aa28f[_0x80f8('0x43')]);return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})[_0x80f8('0x44')](function(_0x2a580){if(_0x2a580){_0x87bb6a=_0x2a580[_0x80f8('0x3a')];if(!_0x3aa28f['query'][_0x80f8('0x3b')](_0x80f8('0x3c'))){_0x5848ca[_0x80f8('0x22')]=qs[_0x80f8('0x22')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x22')]);_0x5848ca[_0x80f8('0x20')]=qs[_0x80f8('0x20')](_0x3aa28f[_0x80f8('0x36')][_0x80f8('0x20')]);}return _0x8c589f[_0x80f8('0x50')](_0x5848ca);}})['then'](function(_0x522587){if(_0x522587){return _0x522587?{'count':_0x87bb6a,'rows':_0x522587}:null;}})['then'](respondWithResult(_0xb1204c,null))[_0x80f8('0x4d')](handleError(_0xb1204c,null));};exports[_0x80f8('0x53')]=function(_0x52e5e6,_0xebf443,_0x49100e){if(_0x52e5e6[_0x80f8('0x4f')]['id']){delete _0x52e5e6[_0x80f8('0x4f')]['id'];}return db['FreshdeskAccount'][_0x80f8('0x54')]({'where':{'id':_0x52e5e6[_0x80f8('0x47')]['id']}})[_0x80f8('0x44')](handleEntityNotFound(_0xebf443,null))[_0x80f8('0x44')](function(_0x138e34){if(_0x138e34){_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x55')]=_0x138e34['id'];_0x52e5e6['body'][_0x80f8('0x56')]=integrations[_0x80f8('0x57')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);_0x52e5e6[_0x80f8('0x4f')]['Descriptions']=integrations[_0x80f8('0x59')](_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x58')],_0x52e5e6[_0x80f8('0x4f')][_0x80f8('0x33')]);return db['FreshdeskConfiguration'][_0x80f8('0x4e')](_0x52e5e6[_0x80f8('0x4f')],{'include':[{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x56')},{'model':db[_0x80f8('0x5a')],'as':_0x80f8('0x5b')}]});}return null;})[_0x80f8('0x44')](respondWithResult(_0xebf443,null))[_0x80f8('0x4d')](handleError(_0xebf443,null));};exports[_0x80f8('0x5c')]=function(_0x4e6839,_0x100470,_0x1bfa2b){var _0x186d8c='';return db[_0x80f8('0x31')][_0x80f8('0x54')]({'where':{'id':_0x4e6839[_0x80f8('0x47')]['id']},'attributes':['id',_0x80f8('0x5d'),_0x80f8('0x5e')]})['then'](handleEntityNotFound(_0x100470,null))['then'](function(_0x22b786){if(_0x22b786){_0x186d8c=_0x22b786['remoteUri'];var _0xd4ba91=_0x186d8c[_0x80f8('0x5f')](-0x1);if(_0xd4ba91==='/'){_0x186d8c=_0x186d8c[_0x80f8('0x60')](0x0,_0x186d8c['lastIndexOf'](_0xd4ba91));}return rp({'method':_0x80f8('0x61'),'uri':util[_0x80f8('0x62')](_0x80f8('0x63'),_0x186d8c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x80f8('0x62')](_0x80f8('0x64'),new Buffer(util['format']('%s:X',_0x22b786[_0x80f8('0x5e')]))[_0x80f8('0x65')](_0x80f8('0x66')))},'json':!![]});}})['then'](function(_0x59edbd){if(_0x59edbd){var _0x307a57=[_0x80f8('0x67'),_0x80f8('0x68'),_0x80f8('0x69'),_0x80f8('0x6a'),'status','priority','group',_0x80f8('0x6b'),'ticket_type',_0x80f8('0x6c'),_0x80f8('0x6d')];_['remove'](_0x59edbd,function(_0x1621b5){return _0x307a57[_0x80f8('0x6e')](_0x1621b5[_0x80f8('0x2d')])||!_0x1621b5[_0x80f8('0x6f')]&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x70')&&_0x1621b5[_0x80f8('0x33')]!==_0x80f8('0x71');});return{'count':_0x59edbd[_0x80f8('0x3a')],'rows':_[_0x80f8('0x30')](_0x59edbd,function(_0x554b5c){return{'id':_0x554b5c[_0x80f8('0x2d')],'name':_0x554b5c[_0x80f8('0x72')],'custom':!_0x554b5c[_0x80f8('0x6f')],'options':_0x554b5c[_0x80f8('0x73')]?_[_0x80f8('0x30')](_0x554b5c[_0x80f8('0x73')],function(_0x28d1d0){return{'name':_[_0x80f8('0x74')](_0x28d1d0),'value':_0x28d1d0};}):[]};})};}})[_0x80f8('0x44')](respondWithResult(_0x100470,null))['catch'](function(_0x2fdfe0){var _0x25af09=_0x4e6839[_0x80f8('0x36')][_0x80f8('0x75')]?0x1f4:_0x2fdfe0[_0x80f8('0x76')]||0x1f4;logger[_0x80f8('0x77')](_0x80f8('0x78'),_0x80f8('0x5c'),_0x25af09,JSON[_0x80f8('0x79')](_0x2fdfe0));delete _0x2fdfe0[_0x80f8('0x2d')];if(_0x25af09===0x191){_0x25af09=0x190;}_0x100470[_0x80f8('0x1f')](_0x25af09)[_0x80f8('0x2e')](_0x4e6839['query'][_0x80f8('0x75')]?{'message':_0x80f8('0x7a'),'statusCode':_0x2fdfe0[_0x80f8('0x76')]}:_0x2fdfe0);});}; \ No newline at end of file +var _0x24b3=['path','to-csv','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','save','update','then','error','stack','name','send','index','FreshdeskAccount','rawAttributes','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','options','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','destroy','getConfigurations','findOne','FreshdeskConfiguration','filter','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','apiKey','remoteUri','slice','GET','format','%s/%s','Basic\x20%s','%s:X','toString','base64','subject','agent','description','priority','group','ticket_type','company','remove','default','custom_text','label','choices','capitalize','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','eml-format','rimraf','zip-dir','request-promise','util'];(function(_0x5de484,_0x224cbb){var _0x4542cd=function(_0x8564e7){while(--_0x8564e7){_0x5de484['push'](_0x5de484['shift']());}};_0x4542cd(++_0x224cbb);}(_0x24b3,0xd3));var _0x324b=function(_0x2eb186,_0x116c1f){_0x2eb186=_0x2eb186-0x0;var _0xc3235b=_0x24b3[_0x2eb186];return _0xc3235b;};'use strict';var emlformat=require(_0x324b('0x0'));var rimraf=require(_0x324b('0x1'));var zipdir=require(_0x324b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x324b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x324b('0x4'));var path=require(_0x324b('0x5'));var sox=require('sox');var csv=require(_0x324b('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x324b('0x7'));var crypto=require(_0x324b('0x8'));var jsforce=require(_0x324b('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x324b('0xa'));var Redis=require('ioredis');var authService=require(_0x324b('0xb'));var qs=require(_0x324b('0xc'));var as=require(_0x324b('0xd'));var hardwareService=require(_0x324b('0xe'));var logger=require(_0x324b('0xf'))(_0x324b('0x10'));var utils=require(_0x324b('0x11'));var config=require(_0x324b('0x12'));var licenseUtil=require(_0x324b('0x13'));var db=require(_0x324b('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2a2330,_0x27653d){_0x27653d=_0x27653d||0xcc;return function(_0x1d84c0){if(_0x1d84c0){return _0x2a2330[_0x324b('0x15')](_0x27653d);}return _0x2a2330[_0x324b('0x16')](_0x27653d)[_0x324b('0x17')]();};}function respondWithResult(_0x9746e5,_0x9ebae8){_0x9ebae8=_0x9ebae8||0xc8;return function(_0x4652c7){if(_0x4652c7){return _0x9746e5[_0x324b('0x16')](_0x9ebae8)['json'](_0x4652c7);}};}function respondWithFilteredResult(_0x1c5366,_0x4fd4cc){return function(_0x2d65ae){if(_0x2d65ae){var _0x30e7c4=typeof _0x4fd4cc['offset']===_0x324b('0x18')&&typeof _0x4fd4cc[_0x324b('0x19')]===_0x324b('0x18');var _0x1f797c=_0x2d65ae[_0x324b('0x1a')];var _0x2def86=_0x30e7c4?0x0:_0x4fd4cc[_0x324b('0x1b')];var _0x30fab4=_0x30e7c4?_0x2d65ae[_0x324b('0x1a')]:_0x4fd4cc[_0x324b('0x1b')]+_0x4fd4cc[_0x324b('0x19')];var _0x94358e;if(_0x30fab4>=_0x1f797c){_0x30fab4=_0x1f797c;_0x94358e=0xc8;}else{_0x94358e=0xce;}_0x1c5366[_0x324b('0x16')](_0x94358e);return _0x1c5366['set']('Content-Range',_0x2def86+'-'+_0x30fab4+'/'+_0x1f797c)[_0x324b('0x1c')](_0x2d65ae);}return null;};}function patchUpdates(_0x55f14e){return function(_0xb34f7){try{jsonpatch['apply'](_0xb34f7,_0x55f14e,!![]);}catch(_0x1fb9ed){return BPromise['reject'](_0x1fb9ed);}return _0xb34f7[_0x324b('0x1d')]();};}function saveUpdates(_0x397cd3,_0x30091d){return function(_0x534392){if(_0x534392){return _0x534392[_0x324b('0x1e')](_0x397cd3)[_0x324b('0x1f')](function(_0x2eca97){return _0x2eca97;});}return null;};}function removeEntity(_0x5e27cd,_0x4ad982){return function(_0x1427df){if(_0x1427df){return _0x1427df['destroy']()[_0x324b('0x1f')](function(){_0x5e27cd[_0x324b('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44798,_0x51c3ad){return function(_0x38996d){if(!_0x38996d){_0x44798[_0x324b('0x15')](0x194);}return _0x38996d;};}function handleError(_0x2617a8,_0x1bf932){_0x1bf932=_0x1bf932||0x1f4;return function(_0xe564d1){logger[_0x324b('0x20')](_0xe564d1[_0x324b('0x21')]);if(_0xe564d1['name']){delete _0xe564d1[_0x324b('0x22')];}_0x2617a8[_0x324b('0x16')](_0x1bf932)[_0x324b('0x23')](_0xe564d1);};}exports[_0x324b('0x24')]=function(_0x4f550e,_0x3da0bc){var _0x10fb26={},_0x4cc6b4={},_0x33d541={'count':0x0,'rows':[]};var _0x573dc1=_['map'](db[_0x324b('0x25')][_0x324b('0x26')],function(_0x1b3dad){return{'name':_0x1b3dad[_0x324b('0x27')],'type':_0x1b3dad['type'][_0x324b('0x28')]};});_0x4cc6b4[_0x324b('0x29')]=_[_0x324b('0x2a')](_0x573dc1,_0x324b('0x22'));_0x4cc6b4[_0x324b('0x2b')]=_[_0x324b('0x2c')](_0x4f550e[_0x324b('0x2b')]);_0x4cc6b4[_0x324b('0x2d')]=_['intersection'](_0x4cc6b4[_0x324b('0x29')],_0x4cc6b4['query']);_0x10fb26[_0x324b('0x2e')]=_[_0x324b('0x2f')](_0x4cc6b4[_0x324b('0x29')],qs[_0x324b('0x30')](_0x4f550e[_0x324b('0x2b')][_0x324b('0x30')]));_0x10fb26['attributes']=_0x10fb26['attributes'][_0x324b('0x31')]?_0x10fb26[_0x324b('0x2e')]:_0x4cc6b4[_0x324b('0x29')];if(!_0x4f550e[_0x324b('0x2b')][_0x324b('0x32')](_0x324b('0x33'))){_0x10fb26['limit']=qs[_0x324b('0x19')](_0x4f550e[_0x324b('0x2b')][_0x324b('0x19')]);_0x10fb26[_0x324b('0x1b')]=qs[_0x324b('0x1b')](_0x4f550e[_0x324b('0x2b')][_0x324b('0x1b')]);}_0x10fb26[_0x324b('0x34')]=qs[_0x324b('0x35')](_0x4f550e[_0x324b('0x2b')][_0x324b('0x35')]);_0x10fb26[_0x324b('0x36')]=qs['filters'](_[_0x324b('0x37')](_0x4f550e['query'],_0x4cc6b4[_0x324b('0x2d')]),_0x573dc1);if(_0x4f550e[_0x324b('0x2b')]['filter']){_0x10fb26[_0x324b('0x36')]=_['merge'](_0x10fb26[_0x324b('0x36')],{'$or':_['map'](_0x573dc1,function(_0x45d503){if(_0x45d503[_0x324b('0x38')]!=='VIRTUAL'){var _0x2216d2={};_0x2216d2[_0x45d503[_0x324b('0x22')]]={'$like':'%'+_0x4f550e['query']['filter']+'%'};return _0x2216d2;}})});}_0x10fb26=_['merge']({},_0x10fb26,_0x4f550e[_0x324b('0x39')]);var _0x5d41de={'where':_0x10fb26[_0x324b('0x36')]};return db[_0x324b('0x25')][_0x324b('0x1a')](_0x5d41de)[_0x324b('0x1f')](function(_0x21e395){_0x33d541['count']=_0x21e395;if(_0x4f550e[_0x324b('0x2b')][_0x324b('0x3a')]){_0x10fb26[_0x324b('0x3b')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x324b('0x3c')](_0x10fb26);})[_0x324b('0x1f')](function(_0x1caf9b){_0x33d541[_0x324b('0x3d')]=_0x1caf9b;return _0x33d541;})[_0x324b('0x1f')](respondWithFilteredResult(_0x3da0bc,_0x10fb26))[_0x324b('0x3e')](handleError(_0x3da0bc,null));};exports[_0x324b('0x3f')]=function(_0x468b70,_0x512ef3){var _0x43ed44={'raw':![],'where':{'id':_0x468b70['params']['id']}},_0x3bccb2={};_0x3bccb2[_0x324b('0x29')]=_[_0x324b('0x2c')](db['FreshdeskAccount'][_0x324b('0x26')]);_0x3bccb2['query']=_[_0x324b('0x2c')](_0x468b70[_0x324b('0x2b')]);_0x3bccb2[_0x324b('0x2d')]=_[_0x324b('0x2f')](_0x3bccb2[_0x324b('0x29')],_0x3bccb2[_0x324b('0x2b')]);_0x43ed44[_0x324b('0x2e')]=_[_0x324b('0x2f')](_0x3bccb2['model'],qs[_0x324b('0x30')](_0x468b70['query'][_0x324b('0x30')]));_0x43ed44['attributes']=_0x43ed44[_0x324b('0x2e')][_0x324b('0x31')]?_0x43ed44['attributes']:_0x3bccb2[_0x324b('0x29')];if(_0x468b70['query']['includeAll']){_0x43ed44[_0x324b('0x3b')]=[{'all':!![]}];}_0x43ed44=_[_0x324b('0x40')]({},_0x43ed44,_0x468b70[_0x324b('0x39')]);return db[_0x324b('0x25')][_0x324b('0x41')](_0x43ed44)[_0x324b('0x1f')](handleEntityNotFound(_0x512ef3,null))[_0x324b('0x1f')](respondWithResult(_0x512ef3,null))[_0x324b('0x3e')](handleError(_0x512ef3,null));};exports[_0x324b('0x42')]=function(_0x453f79,_0x2f1fd5){return db[_0x324b('0x25')][_0x324b('0x42')](_0x453f79['body'],{})[_0x324b('0x1f')](respondWithResult(_0x2f1fd5,0xc9))['catch'](handleError(_0x2f1fd5,null));};exports[_0x324b('0x1e')]=function(_0xc0db5c,_0x5556f5){if(_0xc0db5c[_0x324b('0x43')]['id']){delete _0xc0db5c['body']['id'];}return db['FreshdeskAccount']['find']({'where':{'id':_0xc0db5c[_0x324b('0x44')]['id']}})[_0x324b('0x1f')](handleEntityNotFound(_0x5556f5,null))['then'](saveUpdates(_0xc0db5c[_0x324b('0x43')],null))[_0x324b('0x1f')](respondWithResult(_0x5556f5,null))[_0x324b('0x3e')](handleError(_0x5556f5,null));};exports[_0x324b('0x45')]=function(_0x17023b,_0xd13ce6){return db[_0x324b('0x25')][_0x324b('0x41')]({'where':{'id':_0x17023b[_0x324b('0x44')]['id']}})[_0x324b('0x1f')](handleEntityNotFound(_0xd13ce6,null))['then'](removeEntity(_0xd13ce6,null))[_0x324b('0x3e')](handleError(_0xd13ce6,null));};exports[_0x324b('0x46')]=function(_0x28126b,_0x1b6b74,_0xe344b7){var _0x527927={};var _0x5e9b5e={};var _0x1cc732;var _0x3d1a38;return db[_0x324b('0x25')][_0x324b('0x47')]({'where':{'id':_0x28126b[_0x324b('0x44')]['id']}})['then'](handleEntityNotFound(_0x1b6b74,null))[_0x324b('0x1f')](function(_0x2eacba){if(_0x2eacba){_0x1cc732=_0x2eacba;_0x5e9b5e[_0x324b('0x29')]=_[_0x324b('0x2c')](db[_0x324b('0x48')]['rawAttributes']);_0x5e9b5e[_0x324b('0x2b')]=_[_0x324b('0x2c')](_0x28126b[_0x324b('0x2b')]);_0x5e9b5e['filters']=_[_0x324b('0x2f')](_0x5e9b5e[_0x324b('0x29')],_0x5e9b5e['query']);_0x527927['attributes']=_['intersection'](_0x5e9b5e[_0x324b('0x29')],qs[_0x324b('0x30')](_0x28126b[_0x324b('0x2b')][_0x324b('0x30')]));_0x527927['attributes']=_0x527927['attributes']['length']?_0x527927[_0x324b('0x2e')]:_0x5e9b5e[_0x324b('0x29')];_0x527927['order']=qs[_0x324b('0x35')](_0x28126b['query']['sort']);_0x527927[_0x324b('0x36')]=qs[_0x324b('0x2d')](_['pick'](_0x28126b[_0x324b('0x2b')],_0x5e9b5e['filters']));if(_0x28126b['query']['filter']){_0x527927[_0x324b('0x36')]=_[_0x324b('0x40')](_0x527927[_0x324b('0x36')],{'$or':_[_0x324b('0x2a')](_0x527927[_0x324b('0x2e')],function(_0x2704eb){var _0x4f1946={};_0x4f1946[_0x2704eb]={'$like':'%'+_0x28126b['query'][_0x324b('0x49')]+'%'};return _0x4f1946;})});}_0x527927=_[_0x324b('0x40')]({},_0x527927,_0x28126b[_0x324b('0x39')]);return _0x1cc732['getConfigurations'](_0x527927);}})['then'](function(_0x47d558){if(_0x47d558){_0x3d1a38=_0x47d558[_0x324b('0x31')];if(!_0x28126b[_0x324b('0x2b')][_0x324b('0x32')]('nolimit')){_0x527927[_0x324b('0x19')]=qs[_0x324b('0x19')](_0x28126b[_0x324b('0x2b')][_0x324b('0x19')]);_0x527927['offset']=qs['offset'](_0x28126b[_0x324b('0x2b')]['offset']);}return _0x1cc732[_0x324b('0x46')](_0x527927);}})[_0x324b('0x1f')](function(_0x17f973){if(_0x17f973){return _0x17f973?{'count':_0x3d1a38,'rows':_0x17f973}:null;}})[_0x324b('0x1f')](respondWithResult(_0x1b6b74,null))[_0x324b('0x3e')](handleError(_0x1b6b74,null));};exports[_0x324b('0x4a')]=function(_0x4dda68,_0x7a8595,_0x4be4fe){if(_0x4dda68['body']['id']){delete _0x4dda68[_0x324b('0x43')]['id'];}return db[_0x324b('0x25')]['findOne']({'where':{'id':_0x4dda68[_0x324b('0x44')]['id']}})[_0x324b('0x1f')](handleEntityNotFound(_0x7a8595,null))[_0x324b('0x1f')](function(_0x138edc){if(_0x138edc){_0x4dda68[_0x324b('0x43')][_0x324b('0x4b')]=_0x138edc['id'];_0x4dda68['body'][_0x324b('0x4c')]=integrations[_0x324b('0x4d')](_0x4dda68[_0x324b('0x43')][_0x324b('0x4e')],_0x4dda68[_0x324b('0x43')][_0x324b('0x38')]);_0x4dda68['body'][_0x324b('0x4f')]=integrations[_0x324b('0x50')](_0x4dda68[_0x324b('0x43')][_0x324b('0x4e')],_0x4dda68[_0x324b('0x43')][_0x324b('0x38')]);return db[_0x324b('0x48')][_0x324b('0x42')](_0x4dda68[_0x324b('0x43')],{'include':[{'model':db[_0x324b('0x51')],'as':_0x324b('0x4c')},{'model':db[_0x324b('0x51')],'as':_0x324b('0x4f')}]});}return null;})[_0x324b('0x1f')](respondWithResult(_0x7a8595,null))[_0x324b('0x3e')](handleError(_0x7a8595,null));};exports['getFields']=function(_0x13f12a,_0x43e64a,_0x4d5c1b){var _0x577d5c='';return db['FreshdeskAccount'][_0x324b('0x47')]({'where':{'id':_0x13f12a['params']['id']},'attributes':['id','remoteUri',_0x324b('0x52')]})[_0x324b('0x1f')](handleEntityNotFound(_0x43e64a,null))[_0x324b('0x1f')](function(_0x292e49){if(_0x292e49){_0x577d5c=_0x292e49[_0x324b('0x53')];var _0xc09a6b=_0x577d5c[_0x324b('0x54')](-0x1);if(_0xc09a6b==='/'){_0x577d5c=_0x577d5c['substring'](0x0,_0x577d5c['lastIndexOf'](_0xc09a6b));}return rp({'method':_0x324b('0x55'),'uri':util[_0x324b('0x56')](_0x324b('0x57'),_0x577d5c,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0x324b('0x56')](_0x324b('0x58'),new Buffer(util[_0x324b('0x56')](_0x324b('0x59'),_0x292e49[_0x324b('0x52')]))[_0x324b('0x5a')](_0x324b('0x5b')))},'json':!![]});}})[_0x324b('0x1f')](function(_0x37a77e){if(_0x37a77e){var _0x1c569d=['requester',_0x324b('0x5c'),_0x324b('0x5d'),_0x324b('0x5e'),_0x324b('0x16'),_0x324b('0x5f'),_0x324b('0x60'),'source',_0x324b('0x61'),'group',_0x324b('0x62')];_[_0x324b('0x63')](_0x37a77e,function(_0x181bd0){return _0x1c569d['includes'](_0x181bd0[_0x324b('0x22')])||!_0x181bd0[_0x324b('0x64')]&&_0x181bd0['type']!==_0x324b('0x65')&&_0x181bd0[_0x324b('0x38')]!=='custom_dropdown';});return{'count':_0x37a77e[_0x324b('0x31')],'rows':_[_0x324b('0x2a')](_0x37a77e,function(_0x28cf07){return{'id':_0x28cf07[_0x324b('0x22')],'name':_0x28cf07[_0x324b('0x66')],'custom':!_0x28cf07['default'],'options':_0x28cf07[_0x324b('0x67')]?_['map'](_0x28cf07[_0x324b('0x67')],function(_0x54ff8f){return{'name':_[_0x324b('0x68')](_0x54ff8f),'value':_0x54ff8f};}):[]};})};}})[_0x324b('0x1f')](respondWithResult(_0x43e64a,null))[_0x324b('0x3e')](function(_0x217c2c){var _0x160c53=_0x13f12a[_0x324b('0x2b')]['test']?0x1f4:_0x217c2c['statusCode']||0x1f4;logger[_0x324b('0x20')](_0x324b('0x69'),_0x324b('0x6a'),_0x160c53,JSON['stringify'](_0x217c2c));delete _0x217c2c[_0x324b('0x22')];if(_0x160c53===0x191){_0x160c53=0x190;}_0x43e64a[_0x324b('0x16')](_0x160c53)[_0x324b('0x23')](_0x13f12a[_0x324b('0x2b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x217c2c[_0x324b('0x6b')]}:_0x217c2c);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 1a4ddc0..59210ad 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 _0xf9cb=['FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x5776f0,_0x55bd02){var _0x4b1416=function(_0x2d20f8){while(--_0x2d20f8){_0x5776f0['push'](_0x5776f0['shift']());}};_0x4b1416(++_0x55bd02);}(_0xf9cb,0x11a));var _0xbf9c=function(_0x4a0e68,_0x45c08c){_0x4a0e68=_0x4a0e68-0x0;var _0x4fb274=_0xf9cb[_0x4a0e68];return _0x4fb274;};'use strict';var _=require(_0xbf9c('0x0'));var util=require('util');var logger=require(_0xbf9c('0x1'))(_0xbf9c('0x2'));var moment=require('moment');var BPromise=require(_0xbf9c('0x3'));var rp=require(_0xbf9c('0x4'));var fs=require('fs');var path=require(_0xbf9c('0x5'));var rimraf=require(_0xbf9c('0x6'));var config=require(_0xbf9c('0x7'));var attributes=require(_0xbf9c('0x8'));var integrations=require(_0xbf9c('0x9'));module[_0xbf9c('0xa')]=function(_0x221c5c,_0x215aa5){return _0x221c5c[_0xbf9c('0xb')](_0xbf9c('0xc'),attributes,{'tableName':_0xbf9c('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7e9=['FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7e9,0x199));var _0x9d7e=function(_0x23f87c,_0xd173e0){_0x23f87c=_0x23f87c-0x0;var _0x2ba5a4=_0xd7e9[_0x23f87c];return _0x2ba5a4;};'use strict';var _=require(_0x9d7e('0x0'));var util=require('util');var logger=require(_0x9d7e('0x1'))('api');var moment=require(_0x9d7e('0x2'));var BPromise=require(_0x9d7e('0x3'));var rp=require(_0x9d7e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d7e('0x5'));var config=require(_0x9d7e('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x9d7e('0x7'));module['exports']=function(_0x5e3b1d,_0x2ae578){return _0x5e3b1d[_0x9d7e('0x8')](_0x9d7e('0x9'),attributes,{'tableName':_0x9d7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 2a415d6..1b4469d 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 _0xb30b=['../../config/environment','jayson/promise','client','http','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowFreshdeskAccount','FreshdeskAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3f39ab,_0x16c981){var _0x170952=function(_0x45e049){while(--_0x45e049){_0x3f39ab['push'](_0x3f39ab['shift']());}};_0x170952(++_0x16c981);}(_0xb30b,0xf4));var _0xbb30=function(_0x301101,_0x2162b2){_0x301101=_0x301101-0x0;var _0x3890d4=_0xb30b[_0x301101];return _0x3890d4;};'use strict';var _=require('lodash');var util=require(_0xbb30('0x0'));var moment=require(_0xbb30('0x1'));var BPromise=require(_0xbb30('0x2'));var rs=require(_0xbb30('0x3'));var fs=require('fs');var Redis=require(_0xbb30('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb30('0x5'));var logger=require(_0xbb30('0x6'))(_0xbb30('0x7'));var config=require(_0xbb30('0x8'));var jayson=require(_0xbb30('0x9'));var client=jayson[_0xbb30('0xa')][_0xbb30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1437c6,_0x2c454a,_0x1edf46){return new BPromise(function(_0x2c1077,_0x151129){return client['request'](_0x1437c6,_0x1edf46)[_0xbb30('0xc')](function(_0x238ea9){logger[_0xbb30('0xd')](_0xbb30('0xe'),_0x2c454a,_0xbb30('0xf'));logger[_0xbb30('0x10')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x2c454a,'request\x20sent',JSON[_0xbb30('0x11')](_0x238ea9));if(_0x238ea9['error']){if(_0x238ea9['error'][_0xbb30('0x12')]===0x1f4){logger['error'](_0xbb30('0xe'),_0x2c454a,_0x238ea9[_0xbb30('0x13')][_0xbb30('0x14')]);return _0x151129(_0x238ea9[_0xbb30('0x13')][_0xbb30('0x14')]);}logger[_0xbb30('0x13')](_0xbb30('0xe'),_0x2c454a,_0x238ea9['error'][_0xbb30('0x14')]);return _0x2c1077(_0x238ea9[_0xbb30('0x13')]['message']);}else{logger[_0xbb30('0xd')](_0xbb30('0xe'),_0x2c454a,_0xbb30('0xf'));_0x2c1077(_0x238ea9[_0xbb30('0x15')]['message']);}})[_0xbb30('0x16')](function(_0x1e6258){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2c454a,_0x1e6258);_0x151129(_0x1e6258);});});}exports[_0xbb30('0x17')]=function(_0x39922e){var _0x8ab462=this;return new Promise(function(_0x9395f9,_0x12fb24){return db['FreshdeskAccount'][_0xbb30('0x18')]({'raw':_0x39922e[_0xbb30('0x19')]?_0x39922e[_0xbb30('0x19')][_0xbb30('0x1a')]===undefined?!![]:![]:!![],'where':_0x39922e[_0xbb30('0x19')]?_0x39922e[_0xbb30('0x19')]['where']||null:null,'attributes':_0x39922e[_0xbb30('0x19')]?_0x39922e['options'][_0xbb30('0x1b')]||null:null,'limit':_0x39922e[_0xbb30('0x19')]?_0x39922e['options'][_0xbb30('0x1c')]||null:null,'include':_0x39922e[_0xbb30('0x19')]?_0x39922e['options'][_0xbb30('0x1d')]?_['map'](_0x39922e[_0xbb30('0x19')][_0xbb30('0x1d')],function(_0x489416){return{'model':db[_0x489416[_0xbb30('0x1e')]],'as':_0x489416['as'],'attributes':_0x489416['attributes'],'include':_0x489416[_0xbb30('0x1d')]?_['map'](_0x489416[_0xbb30('0x1d')],function(_0x249827){return{'model':db[_0x249827[_0xbb30('0x1e')]],'as':_0x249827['as'],'attributes':_0x249827['attributes'],'include':_0x249827['include']?_[_0xbb30('0x1f')](_0x249827['include'],function(_0x3ba38e){return{'model':db[_0x3ba38e[_0xbb30('0x1e')]],'as':_0x3ba38e['as'],'attributes':_0x3ba38e[_0xbb30('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb30('0xc')](function(_0x2c8aa2){logger[_0xbb30('0xd')](_0xbb30('0x17'),_0x39922e);logger[_0xbb30('0x10')](_0xbb30('0x17'),_0x39922e,JSON[_0xbb30('0x11')](_0x2c8aa2));_0x9395f9(_0x2c8aa2);})['catch'](function(_0x2f3a6a){logger[_0xbb30('0x13')](_0xbb30('0x17'),_0x2f3a6a[_0xbb30('0x14')],_0x39922e);_0x12fb24(_0x8ab462[_0xbb30('0x13')](0x1f4,_0x2f3a6a[_0xbb30('0x14')]));});});};exports[_0xbb30('0x20')]=function(_0x2691fa){var _0x2eb5d8=this;return new Promise(function(_0x232937,_0x33606e){return db[_0xbb30('0x21')][_0xbb30('0x22')]({'raw':_0x2691fa[_0xbb30('0x19')]?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1a')]===undefined?!![]:![]:!![],'where':_0x2691fa[_0xbb30('0x19')]?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x23')]||null:null,'attributes':_0x2691fa['options']?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1b')]||null:null,'include':_0x2691fa[_0xbb30('0x19')]?_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1d')]?_[_0xbb30('0x1f')](_0x2691fa[_0xbb30('0x19')][_0xbb30('0x1d')],function(_0x572e42){return{'model':db[_0x572e42[_0xbb30('0x1e')]],'as':_0x572e42['as'],'attributes':_0x572e42[_0xbb30('0x1b')],'include':_0x572e42[_0xbb30('0x1d')]?_[_0xbb30('0x1f')](_0x572e42[_0xbb30('0x1d')],function(_0x3ccd22){return{'model':db[_0x3ccd22['model']],'as':_0x3ccd22['as'],'attributes':_0x3ccd22[_0xbb30('0x1b')],'include':_0x3ccd22['include']?_['map'](_0x3ccd22[_0xbb30('0x1d')],function(_0x2f26cb){return{'model':db[_0x2f26cb['model']],'as':_0x2f26cb['as'],'attributes':_0x2f26cb[_0xbb30('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb30('0xc')](function(_0x26901c){logger[_0xbb30('0xd')](_0xbb30('0x20'),_0x2691fa);logger[_0xbb30('0x10')](_0xbb30('0x20'),_0x2691fa,JSON[_0xbb30('0x11')](_0x26901c));_0x232937(_0x26901c);})[_0xbb30('0x16')](function(_0x3b8045){logger[_0xbb30('0x13')](_0xbb30('0x20'),_0x3b8045[_0xbb30('0x14')],_0x2691fa);_0x33606e(_0x2eb5d8[_0xbb30('0x13')](0x1f4,_0x3b8045[_0xbb30('0x14')]));});});}; \ No newline at end of file +var _0x45a8=['raw','where','attributes','limit','include','map','model','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetFreshdeskAccount','findAll','options'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x45a8,0x9f));var _0x845a=function(_0x5b4385,_0x1c73f1){_0x5b4385=_0x5b4385-0x0;var _0x3aefd4=_0x45a8[_0x5b4385];return _0x3aefd4;};'use strict';var _=require(_0x845a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x845a('0x1'));var rs=require(_0x845a('0x2'));var fs=require('fs');var Redis=require(_0x845a('0x3'));var db=require(_0x845a('0x4'))['db'];var utils=require(_0x845a('0x5'));var logger=require(_0x845a('0x6'))(_0x845a('0x7'));var config=require(_0x845a('0x8'));var jayson=require(_0x845a('0x9'));var client=jayson['client'][_0x845a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39a43a,_0x4ae332,_0x517298){return new BPromise(function(_0x3e1c2a,_0x2e7adf){return client[_0x845a('0xb')](_0x39a43a,_0x517298)[_0x845a('0xc')](function(_0x4b631d){logger[_0x845a('0xd')](_0x845a('0xe'),_0x4ae332,_0x845a('0xf'));logger[_0x845a('0x10')](_0x845a('0x11'),_0x4ae332,'request\x20sent',JSON['stringify'](_0x4b631d));if(_0x4b631d[_0x845a('0x12')]){if(_0x4b631d[_0x845a('0x12')][_0x845a('0x13')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4ae332,_0x4b631d['error'][_0x845a('0x14')]);return _0x2e7adf(_0x4b631d[_0x845a('0x12')][_0x845a('0x14')]);}logger[_0x845a('0x12')](_0x845a('0xe'),_0x4ae332,_0x4b631d[_0x845a('0x12')]['message']);return _0x3e1c2a(_0x4b631d[_0x845a('0x12')][_0x845a('0x14')]);}else{logger[_0x845a('0xd')](_0x845a('0xe'),_0x4ae332,_0x845a('0xf'));_0x3e1c2a(_0x4b631d[_0x845a('0x15')][_0x845a('0x14')]);}})[_0x845a('0x16')](function(_0x263b81){logger[_0x845a('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x4ae332,_0x263b81);_0x2e7adf(_0x263b81);});});}exports[_0x845a('0x17')]=function(_0x4850c1){var _0x2dc2da=this;return new Promise(function(_0x2958cd,_0x564ae7){return db['FreshdeskAccount'][_0x845a('0x18')]({'raw':_0x4850c1[_0x845a('0x19')]?_0x4850c1['options'][_0x845a('0x1a')]===undefined?!![]:![]:!![],'where':_0x4850c1[_0x845a('0x19')]?_0x4850c1['options'][_0x845a('0x1b')]||null:null,'attributes':_0x4850c1[_0x845a('0x19')]?_0x4850c1[_0x845a('0x19')][_0x845a('0x1c')]||null:null,'limit':_0x4850c1[_0x845a('0x19')]?_0x4850c1['options'][_0x845a('0x1d')]||null:null,'include':_0x4850c1[_0x845a('0x19')]?_0x4850c1[_0x845a('0x19')][_0x845a('0x1e')]?_[_0x845a('0x1f')](_0x4850c1[_0x845a('0x19')][_0x845a('0x1e')],function(_0x50dad7){return{'model':db[_0x50dad7[_0x845a('0x20')]],'as':_0x50dad7['as'],'attributes':_0x50dad7['attributes'],'include':_0x50dad7['include']?_[_0x845a('0x1f')](_0x50dad7[_0x845a('0x1e')],function(_0x526fd7){return{'model':db[_0x526fd7['model']],'as':_0x526fd7['as'],'attributes':_0x526fd7[_0x845a('0x1c')],'include':_0x526fd7['include']?_[_0x845a('0x1f')](_0x526fd7['include'],function(_0x33cbd7){return{'model':db[_0x33cbd7[_0x845a('0x20')]],'as':_0x33cbd7['as'],'attributes':_0x33cbd7[_0x845a('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x907f42){logger[_0x845a('0xd')](_0x845a('0x17'),_0x4850c1);logger[_0x845a('0x10')](_0x845a('0x17'),_0x4850c1,JSON[_0x845a('0x21')](_0x907f42));_0x2958cd(_0x907f42);})[_0x845a('0x16')](function(_0x15d801){logger[_0x845a('0x12')](_0x845a('0x17'),_0x15d801[_0x845a('0x14')],_0x4850c1);_0x564ae7(_0x2dc2da['error'](0x1f4,_0x15d801[_0x845a('0x14')]));});});};exports[_0x845a('0x22')]=function(_0x1cb865){var _0x3ae8fb=this;return new Promise(function(_0x312d91,_0x56ed58){return db[_0x845a('0x23')][_0x845a('0x24')]({'raw':_0x1cb865[_0x845a('0x19')]?_0x1cb865['options'][_0x845a('0x1a')]===undefined?!![]:![]:!![],'where':_0x1cb865[_0x845a('0x19')]?_0x1cb865[_0x845a('0x19')][_0x845a('0x1b')]||null:null,'attributes':_0x1cb865['options']?_0x1cb865[_0x845a('0x19')][_0x845a('0x1c')]||null:null,'include':_0x1cb865['options']?_0x1cb865[_0x845a('0x19')][_0x845a('0x1e')]?_[_0x845a('0x1f')](_0x1cb865[_0x845a('0x19')][_0x845a('0x1e')],function(_0x48d140){return{'model':db[_0x48d140['model']],'as':_0x48d140['as'],'attributes':_0x48d140['attributes'],'include':_0x48d140['include']?_[_0x845a('0x1f')](_0x48d140[_0x845a('0x1e')],function(_0x4e42c9){return{'model':db[_0x4e42c9['model']],'as':_0x4e42c9['as'],'attributes':_0x4e42c9[_0x845a('0x1c')],'include':_0x4e42c9[_0x845a('0x1e')]?_['map'](_0x4e42c9[_0x845a('0x1e')],function(_0x13c0fe){return{'model':db[_0x13c0fe[_0x845a('0x20')]],'as':_0x13c0fe['as'],'attributes':_0x13c0fe[_0x845a('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x845a('0xc')](function(_0x4927b7){logger['info'](_0x845a('0x22'),_0x1cb865);logger['debug']('ShowFreshdeskAccount',_0x1cb865,JSON[_0x845a('0x21')](_0x4927b7));_0x312d91(_0x4927b7);})[_0x845a('0x16')](function(_0x3bbdc1){logger[_0x845a('0x12')](_0x845a('0x22'),_0x3bbdc1[_0x845a('0x14')],_0x1cb865);_0x56ed58(_0x3ae8fb[_0x845a('0x12')](0x1f4,_0x3bbdc1[_0x845a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 7ed0bd6..482bad5 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 _0x84d7=['put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags'];(function(_0x1aa4f4,_0xfd4a9f){var _0x3724dd=function(_0x3c84fd){while(--_0x3c84fd){_0x1aa4f4['push'](_0x1aa4f4['shift']());}};_0x3724dd(++_0xfd4a9f);}(_0x84d7,0xcf));var _0x784d=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x84d7[_0x1ae5ab];return _0x1ce001;};'use strict';var multer=require(_0x784d('0x0'));var util=require(_0x784d('0x1'));var path=require(_0x784d('0x2'));var timeout=require('connect-timeout');var express=require(_0x784d('0x3'));var router=express[_0x784d('0x4')]();var fs_extra=require(_0x784d('0x5'));var auth=require(_0x784d('0x6'));var interaction=require(_0x784d('0x7'));var config=require(_0x784d('0x8'));var controller=require(_0x784d('0x9'));router[_0x784d('0xa')]('/',auth[_0x784d('0xb')](),controller[_0x784d('0xc')]);router[_0x784d('0xa')](_0x784d('0xd'),auth[_0x784d('0xb')](),controller[_0x784d('0xe')]);router['get'](_0x784d('0xf'),auth[_0x784d('0xb')](),controller[_0x784d('0x10')]);router[_0x784d('0xa')](_0x784d('0x11'),auth[_0x784d('0xb')](),controller[_0x784d('0x12')]);router[_0x784d('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x784d('0x13')]);router[_0x784d('0xa')](_0x784d('0x14'),auth[_0x784d('0xb')](),controller[_0x784d('0x15')]);router[_0x784d('0x16')]('/',auth[_0x784d('0xb')](),controller[_0x784d('0x17')]);router[_0x784d('0x16')]('/:id/tags',auth[_0x784d('0xb')](),controller[_0x784d('0x18')]);router[_0x784d('0x19')](_0x784d('0xd'),auth[_0x784d('0xb')](),controller['update']);router[_0x784d('0x1a')](_0x784d('0xd'),auth[_0x784d('0xb')](),controller[_0x784d('0x1b')]);module[_0x784d('0x1c')]=router; \ No newline at end of file +var _0xe068=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','getFields','/:id/subjects'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xe068,0x133));var _0x8e06=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe068[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x8e06('0x0'));var util=require(_0x8e06('0x1'));var path=require(_0x8e06('0x2'));var timeout=require(_0x8e06('0x3'));var express=require(_0x8e06('0x4'));var router=express[_0x8e06('0x5')]();var fs_extra=require(_0x8e06('0x6'));var auth=require(_0x8e06('0x7'));var interaction=require(_0x8e06('0x8'));var config=require(_0x8e06('0x9'));var controller=require(_0x8e06('0xa'));router[_0x8e06('0xb')]('/',auth[_0x8e06('0xc')](),controller['index']);router['get'](_0x8e06('0xd'),auth['isAuthenticated'](),controller[_0x8e06('0xe')]);router['get']('/:id/fields',auth[_0x8e06('0xc')](),controller[_0x8e06('0xf')]);router[_0x8e06('0xb')](_0x8e06('0x10'),auth[_0x8e06('0xc')](),controller[_0x8e06('0x11')]);router[_0x8e06('0xb')](_0x8e06('0x12'),auth['isAuthenticated'](),controller[_0x8e06('0x13')]);router[_0x8e06('0xb')]('/:id/tags',auth['isAuthenticated'](),controller[_0x8e06('0x14')]);router[_0x8e06('0x15')]('/',auth[_0x8e06('0xc')](),controller[_0x8e06('0x16')]);router[_0x8e06('0x15')]('/:id/tags',auth[_0x8e06('0xc')](),controller[_0x8e06('0x17')]);router['put'](_0x8e06('0xd'),auth['isAuthenticated'](),controller[_0x8e06('0x18')]);router[_0x8e06('0x19')]('/:id',auth[_0x8e06('0xc')](),controller['destroy']);module[_0x8e06('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a74ff58..121b7f7 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 _0x132d=['STRING','exports'];(function(_0x7a354a,_0x5ad3c2){var _0x13e6cb=function(_0x12e07e){while(--_0x12e07e){_0x7a354a['push'](_0x7a354a['shift']());}};_0x13e6cb(++_0x5ad3c2);}(_0x132d,0x1d7));var _0xd132=function(_0x57841a,_0x3bf283){_0x57841a=_0x57841a-0x0;var _0x588bab=_0x132d[_0x57841a];return _0x588bab;};'use strict';var Sequelize=require('sequelize');module[_0xd132('0x0')]={'name':{'type':Sequelize[_0xd132('0x1')]},'description':{'type':Sequelize[_0xd132('0x1')]}}; \ No newline at end of file +var _0x9bdd=['sequelize','STRING'];(function(_0x56d35a,_0x1e91f6){var _0x264f7f=function(_0x3aff3f){while(--_0x3aff3f){_0x56d35a['push'](_0x56d35a['shift']());}};_0x264f7f(++_0x1e91f6);}(_0x9bdd,0x1e2));var _0xd9bd=function(_0x1f3552,_0x54e2e5){_0x1f3552=_0x1f3552-0x0;var _0x3dc5e4=_0x9bdd[_0x1f3552];return _0x3dc5e4;};'use strict';var Sequelize=require(_0xd9bd('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd9bd('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index d5b2947..1bb5ea3 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 _0xa355=['sort','filter','where','merge','type','VIRTUAL','includeAll','findAll','catch','show','params','keys','include','options','find','create','body','getFields','pick','length','hasOwnProperty','getSubjects','findOne','FreshdeskField','order','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','key','query','filters','intersection','attributes','fields','model','nolimit'];(function(_0x116e69,_0x217415){var _0x4b27b6=function(_0xec1fde){while(--_0xec1fde){_0x116e69['push'](_0x116e69['shift']());}};_0x4b27b6(++_0x217415);}(_0xa355,0x16a));var _0x5a35=function(_0x3a7257,_0x4fc699){_0x3a7257=_0x3a7257-0x0;var _0x1e9df6=_0xa355[_0x3a7257];return _0x1e9df6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5a35('0x0'));var zipdir=require(_0x5a35('0x1'));var jsonpatch=require(_0x5a35('0x2'));var rp=require('request-promise');var moment=require(_0x5a35('0x3'));var BPromise=require(_0x5a35('0x4'));var Mustache=require(_0x5a35('0x5'));var util=require(_0x5a35('0x6'));var path=require(_0x5a35('0x7'));var sox=require(_0x5a35('0x8'));var csv=require(_0x5a35('0x9'));var ejs=require(_0x5a35('0xa'));var fs=require('fs');var fs_extra=require(_0x5a35('0xb'));var _=require('lodash');var squel=require(_0x5a35('0xc'));var crypto=require(_0x5a35('0xd'));var jsforce=require(_0x5a35('0xe'));var deskjs=require(_0x5a35('0xf'));var toCsv=require(_0x5a35('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5a35('0x10'));var as=require(_0x5a35('0x11'));var hardwareService=require(_0x5a35('0x12'));var logger=require(_0x5a35('0x13'))(_0x5a35('0x14'));var utils=require(_0x5a35('0x15'));var config=require(_0x5a35('0x16'));var licenseUtil=require(_0x5a35('0x17'));var db=require(_0x5a35('0x18'))['db'];function respondWithStatusCode(_0x47158c,_0x5b74bd){_0x5b74bd=_0x5b74bd||0xcc;return function(_0x5b729b){if(_0x5b729b){return _0x47158c[_0x5a35('0x19')](_0x5b74bd);}return _0x47158c[_0x5a35('0x1a')](_0x5b74bd)[_0x5a35('0x1b')]();};}function respondWithResult(_0x2353db,_0x303a6f){_0x303a6f=_0x303a6f||0xc8;return function(_0x1a5b5a){if(_0x1a5b5a){return _0x2353db[_0x5a35('0x1a')](_0x303a6f)['json'](_0x1a5b5a);}};}function respondWithFilteredResult(_0xfd24d8,_0x45d5ca){return function(_0x5ead98){if(_0x5ead98){var _0x55fe62=typeof _0x45d5ca[_0x5a35('0x1c')]==='undefined'&&typeof _0x45d5ca[_0x5a35('0x1d')]===_0x5a35('0x1e');var _0x3aca20=_0x5ead98[_0x5a35('0x1f')];var _0x39317c=_0x55fe62?0x0:_0x45d5ca[_0x5a35('0x1c')];var _0x32c7cf=_0x55fe62?_0x5ead98[_0x5a35('0x1f')]:_0x45d5ca[_0x5a35('0x1c')]+_0x45d5ca[_0x5a35('0x1d')];var _0x42db0b;if(_0x32c7cf>=_0x3aca20){_0x32c7cf=_0x3aca20;_0x42db0b=0xc8;}else{_0x42db0b=0xce;}_0xfd24d8[_0x5a35('0x1a')](_0x42db0b);return _0xfd24d8['set']('Content-Range',_0x39317c+'-'+_0x32c7cf+'/'+_0x3aca20)['json'](_0x5ead98);}return null;};}function patchUpdates(_0x522587){return function(_0x2d84b6){try{jsonpatch[_0x5a35('0x20')](_0x2d84b6,_0x522587,!![]);}catch(_0x36b756){return BPromise['reject'](_0x36b756);}return _0x2d84b6[_0x5a35('0x21')]();};}function saveUpdates(_0x11f6ba,_0x2e7fa8){return function(_0x52f2ea){if(_0x52f2ea){return _0x52f2ea[_0x5a35('0x22')](_0x11f6ba)[_0x5a35('0x23')](function(_0x22466e){return _0x22466e;});}return null;};}function removeEntity(_0x37de30,_0x8ef730){return function(_0x198c95){if(_0x198c95){return _0x198c95[_0x5a35('0x24')]()[_0x5a35('0x23')](function(){_0x37de30[_0x5a35('0x1a')](0xcc)[_0x5a35('0x1b')]();});}};}function handleEntityNotFound(_0x2c3655,_0x48d656){return function(_0x2191bb){if(!_0x2191bb){_0x2c3655[_0x5a35('0x19')](0x194);}return _0x2191bb;};}function handleError(_0xb39012,_0xfb8042){_0xfb8042=_0xfb8042||0x1f4;return function(_0x49018c){logger[_0x5a35('0x25')](_0x49018c[_0x5a35('0x26')]);if(_0x49018c[_0x5a35('0x27')]){delete _0x49018c[_0x5a35('0x27')];}_0xb39012[_0x5a35('0x1a')](_0xfb8042)['send'](_0x49018c);};}exports[_0x5a35('0x28')]=function(_0x25a7bd,_0xef8799){var _0x14bf10={},_0x14549a={},_0x5e229b={'count':0x0,'rows':[]};var _0x5218f0=_[_0x5a35('0x29')](db[_0x5a35('0x2a')][_0x5a35('0x2b')],function(_0xf8729b){return{'name':_0xf8729b[_0x5a35('0x2c')],'type':_0xf8729b['type'][_0x5a35('0x2d')]};});_0x14549a['model']=_[_0x5a35('0x29')](_0x5218f0,'name');_0x14549a[_0x5a35('0x2e')]=_['keys'](_0x25a7bd[_0x5a35('0x2e')]);_0x14549a[_0x5a35('0x2f')]=_[_0x5a35('0x30')](_0x14549a['model'],_0x14549a[_0x5a35('0x2e')]);_0x14bf10[_0x5a35('0x31')]=_[_0x5a35('0x30')](_0x14549a['model'],qs[_0x5a35('0x32')](_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x14bf10[_0x5a35('0x31')]=_0x14bf10[_0x5a35('0x31')]['length']?_0x14bf10[_0x5a35('0x31')]:_0x14549a[_0x5a35('0x33')];if(!_0x25a7bd[_0x5a35('0x2e')]['hasOwnProperty'](_0x5a35('0x34'))){_0x14bf10['limit']=qs['limit'](_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x1d')]);_0x14bf10['offset']=qs[_0x5a35('0x1c')](_0x25a7bd[_0x5a35('0x2e')]['offset']);}_0x14bf10['order']=qs[_0x5a35('0x35')](_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x35')]);_0x14bf10['where']=qs[_0x5a35('0x2f')](_['pick'](_0x25a7bd[_0x5a35('0x2e')],_0x14549a[_0x5a35('0x2f')]),_0x5218f0);if(_0x25a7bd[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x14bf10[_0x5a35('0x37')]=_[_0x5a35('0x38')](_0x14bf10[_0x5a35('0x37')],{'$or':_['map'](_0x5218f0,function(_0x349c42){if(_0x349c42[_0x5a35('0x39')]!==_0x5a35('0x3a')){var _0x16cd01={};_0x16cd01[_0x349c42['name']]={'$like':'%'+_0x25a7bd['query']['filter']+'%'};return _0x16cd01;}})});}_0x14bf10=_[_0x5a35('0x38')]({},_0x14bf10,_0x25a7bd['options']);var _0x39a10a={'where':_0x14bf10[_0x5a35('0x37')]};return db[_0x5a35('0x2a')][_0x5a35('0x1f')](_0x39a10a)['then'](function(_0x540900){_0x5e229b[_0x5a35('0x1f')]=_0x540900;if(_0x25a7bd['query'][_0x5a35('0x3b')]){_0x14bf10['include']=[{'all':!![]}];}return db[_0x5a35('0x2a')][_0x5a35('0x3c')](_0x14bf10);})['then'](function(_0x9bd25b){_0x5e229b['rows']=_0x9bd25b;return _0x5e229b;})[_0x5a35('0x23')](respondWithFilteredResult(_0xef8799,_0x14bf10))[_0x5a35('0x3d')](handleError(_0xef8799,null));};exports[_0x5a35('0x3e')]=function(_0xcf9ee8,_0x4efbb3){var _0x691283={'raw':![],'where':{'id':_0xcf9ee8[_0x5a35('0x3f')]['id']}},_0x1e77a3={};_0x1e77a3[_0x5a35('0x33')]=_[_0x5a35('0x40')](db[_0x5a35('0x2a')][_0x5a35('0x2b')]);_0x1e77a3[_0x5a35('0x2e')]=_['keys'](_0xcf9ee8['query']);_0x1e77a3[_0x5a35('0x2f')]=_[_0x5a35('0x30')](_0x1e77a3[_0x5a35('0x33')],_0x1e77a3[_0x5a35('0x2e')]);_0x691283['attributes']=_[_0x5a35('0x30')](_0x1e77a3[_0x5a35('0x33')],qs[_0x5a35('0x32')](_0xcf9ee8[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x691283['attributes']=_0x691283['attributes']['length']?_0x691283[_0x5a35('0x31')]:_0x1e77a3[_0x5a35('0x33')];if(_0xcf9ee8[_0x5a35('0x2e')][_0x5a35('0x3b')]){_0x691283[_0x5a35('0x41')]=[{'all':!![]}];}_0x691283=_['merge']({},_0x691283,_0xcf9ee8[_0x5a35('0x42')]);return db[_0x5a35('0x2a')][_0x5a35('0x43')](_0x691283)['then'](handleEntityNotFound(_0x4efbb3,null))[_0x5a35('0x23')](respondWithResult(_0x4efbb3,null))[_0x5a35('0x3d')](handleError(_0x4efbb3,null));};exports[_0x5a35('0x44')]=function(_0x3b43c3,_0x21ea0f){return db[_0x5a35('0x2a')]['create'](_0x3b43c3['body'],{})[_0x5a35('0x23')](respondWithResult(_0x21ea0f,0xc9))[_0x5a35('0x3d')](handleError(_0x21ea0f,null));};exports[_0x5a35('0x22')]=function(_0x29d4bc,_0x1de2e8){if(_0x29d4bc['body']['id']){delete _0x29d4bc['body']['id'];}return db[_0x5a35('0x2a')]['find']({'where':{'id':_0x29d4bc[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x1de2e8,null))[_0x5a35('0x23')](saveUpdates(_0x29d4bc[_0x5a35('0x45')],null))['then'](respondWithResult(_0x1de2e8,null))[_0x5a35('0x3d')](handleError(_0x1de2e8,null));};exports[_0x5a35('0x24')]=function(_0x13beaa,_0x2c50f3){return db['FreshdeskConfiguration'][_0x5a35('0x43')]({'where':{'id':_0x13beaa[_0x5a35('0x3f')]['id']}})['then'](handleEntityNotFound(_0x2c50f3,null))['then'](removeEntity(_0x2c50f3,null))[_0x5a35('0x3d')](handleError(_0x2c50f3,null));};exports[_0x5a35('0x46')]=function(_0x5af6f8,_0x4287e9,_0x510de0){var _0x56738d={};var _0x4b5d7b={};var _0x5c4a56;var _0x13c4b2;return db[_0x5a35('0x2a')]['findOne']({'where':{'id':_0x5af6f8[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x4287e9,null))['then'](function(_0x4d14f7){if(_0x4d14f7){_0x5c4a56=_0x4d14f7;_0x4b5d7b['model']=_[_0x5a35('0x40')](db['FreshdeskField'][_0x5a35('0x2b')]);_0x4b5d7b[_0x5a35('0x2e')]=_[_0x5a35('0x40')](_0x5af6f8[_0x5a35('0x2e')]);_0x4b5d7b[_0x5a35('0x2f')]=_[_0x5a35('0x30')](_0x4b5d7b[_0x5a35('0x33')],_0x4b5d7b[_0x5a35('0x2e')]);_0x56738d[_0x5a35('0x31')]=_[_0x5a35('0x30')](_0x4b5d7b[_0x5a35('0x33')],qs[_0x5a35('0x32')](_0x5af6f8['query'][_0x5a35('0x32')]));_0x56738d[_0x5a35('0x31')]=_0x56738d[_0x5a35('0x31')]['length']?_0x56738d['attributes']:_0x4b5d7b[_0x5a35('0x33')];_0x56738d['order']=qs[_0x5a35('0x35')](_0x5af6f8['query'][_0x5a35('0x35')]);_0x56738d['where']=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0x5af6f8[_0x5a35('0x2e')],_0x4b5d7b['filters']));if(_0x5af6f8[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x56738d[_0x5a35('0x37')]=_[_0x5a35('0x38')](_0x56738d[_0x5a35('0x37')],{'$or':_['map'](_0x56738d[_0x5a35('0x31')],function(_0xc43ae2){var _0x3707d4={};_0x3707d4[_0xc43ae2]={'$like':'%'+_0x5af6f8['query'][_0x5a35('0x36')]+'%'};return _0x3707d4;})});}_0x56738d=_[_0x5a35('0x38')]({},_0x56738d,_0x5af6f8[_0x5a35('0x42')]);return _0x5c4a56[_0x5a35('0x46')](_0x56738d);}})['then'](function(_0x5b5267){if(_0x5b5267){_0x13c4b2=_0x5b5267[_0x5a35('0x48')];if(!_0x5af6f8['query'][_0x5a35('0x49')](_0x5a35('0x34'))){_0x56738d['limit']=qs[_0x5a35('0x1d')](_0x5af6f8[_0x5a35('0x2e')][_0x5a35('0x1d')]);_0x56738d[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0x5af6f8[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x5c4a56['getFields'](_0x56738d);}})[_0x5a35('0x23')](function(_0x10ee13){if(_0x10ee13){return _0x10ee13?{'count':_0x13c4b2,'rows':_0x10ee13}:null;}})['then'](respondWithResult(_0x4287e9,null))['catch'](handleError(_0x4287e9,null));};exports[_0x5a35('0x4a')]=function(_0xb22f40,_0x5288d2,_0x509b93){var _0x212f9d={};var _0x10d728={};var _0x22634f;var _0x558fc8;return db[_0x5a35('0x2a')][_0x5a35('0x4b')]({'where':{'id':_0xb22f40[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x5288d2,null))['then'](function(_0x187b49){if(_0x187b49){_0x22634f=_0x187b49;_0x10d728[_0x5a35('0x33')]=_[_0x5a35('0x40')](db[_0x5a35('0x4c')][_0x5a35('0x2b')]);_0x10d728[_0x5a35('0x2e')]=_['keys'](_0xb22f40['query']);_0x10d728['filters']=_[_0x5a35('0x30')](_0x10d728[_0x5a35('0x33')],_0x10d728['query']);_0x212f9d[_0x5a35('0x31')]=_[_0x5a35('0x30')](_0x10d728['model'],qs[_0x5a35('0x32')](_0xb22f40[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x212f9d[_0x5a35('0x31')]=_0x212f9d[_0x5a35('0x31')][_0x5a35('0x48')]?_0x212f9d['attributes']:_0x10d728[_0x5a35('0x33')];_0x212f9d[_0x5a35('0x4d')]=qs[_0x5a35('0x35')](_0xb22f40[_0x5a35('0x2e')][_0x5a35('0x35')]);_0x212f9d['where']=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0xb22f40[_0x5a35('0x2e')],_0x10d728[_0x5a35('0x2f')]));if(_0xb22f40['query'][_0x5a35('0x36')]){_0x212f9d[_0x5a35('0x37')]=_['merge'](_0x212f9d[_0x5a35('0x37')],{'$or':_[_0x5a35('0x29')](_0x212f9d['attributes'],function(_0x2140eb){var _0xbb90d0={};_0xbb90d0[_0x2140eb]={'$like':'%'+_0xb22f40[_0x5a35('0x2e')]['filter']+'%'};return _0xbb90d0;})});}_0x212f9d=_['merge']({},_0x212f9d,_0xb22f40['options']);return _0x22634f[_0x5a35('0x4a')](_0x212f9d);}})[_0x5a35('0x23')](function(_0x4857b9){if(_0x4857b9){_0x558fc8=_0x4857b9[_0x5a35('0x48')];if(!_0xb22f40[_0x5a35('0x2e')]['hasOwnProperty'](_0x5a35('0x34'))){_0x212f9d[_0x5a35('0x1d')]=qs[_0x5a35('0x1d')](_0xb22f40[_0x5a35('0x2e')]['limit']);_0x212f9d[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0xb22f40[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x22634f[_0x5a35('0x4a')](_0x212f9d);}})['then'](function(_0xdf7dc4){if(_0xdf7dc4){return _0xdf7dc4?{'count':_0x558fc8,'rows':_0xdf7dc4}:null;}})[_0x5a35('0x23')](respondWithResult(_0x5288d2,null))[_0x5a35('0x3d')](handleError(_0x5288d2,null));};exports[_0x5a35('0x4e')]=function(_0x33024e,_0x73ba59,_0xe71e43){var _0x35ec50={};var _0x138ee7={};var _0x447774;var _0x11ab54;return db[_0x5a35('0x2a')]['findOne']({'where':{'id':_0x33024e[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x73ba59,null))[_0x5a35('0x23')](function(_0x2d9d25){if(_0x2d9d25){_0x447774=_0x2d9d25;_0x138ee7[_0x5a35('0x33')]=_[_0x5a35('0x40')](db[_0x5a35('0x4c')][_0x5a35('0x2b')]);_0x138ee7['query']=_[_0x5a35('0x40')](_0x33024e[_0x5a35('0x2e')]);_0x138ee7[_0x5a35('0x2f')]=_['intersection'](_0x138ee7[_0x5a35('0x33')],_0x138ee7['query']);_0x35ec50[_0x5a35('0x31')]=_['intersection'](_0x138ee7[_0x5a35('0x33')],qs['fields'](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x35ec50[_0x5a35('0x31')]=_0x35ec50[_0x5a35('0x31')][_0x5a35('0x48')]?_0x35ec50[_0x5a35('0x31')]:_0x138ee7[_0x5a35('0x33')];_0x35ec50[_0x5a35('0x4d')]=qs[_0x5a35('0x35')](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x35')]);_0x35ec50[_0x5a35('0x37')]=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0x33024e[_0x5a35('0x2e')],_0x138ee7[_0x5a35('0x2f')]));if(_0x33024e[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x35ec50[_0x5a35('0x37')]=_['merge'](_0x35ec50[_0x5a35('0x37')],{'$or':_['map'](_0x35ec50[_0x5a35('0x31')],function(_0x572018){var _0x220345={};_0x220345[_0x572018]={'$like':'%'+_0x33024e[_0x5a35('0x2e')][_0x5a35('0x36')]+'%'};return _0x220345;})});}_0x35ec50=_[_0x5a35('0x38')]({},_0x35ec50,_0x33024e['options']);return _0x447774[_0x5a35('0x4e')](_0x35ec50);}})[_0x5a35('0x23')](function(_0xad7477){if(_0xad7477){_0x11ab54=_0xad7477['length'];if(!_0x33024e[_0x5a35('0x2e')]['hasOwnProperty']('nolimit')){_0x35ec50['limit']=qs[_0x5a35('0x1d')](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x1d')]);_0x35ec50[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0x33024e[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x447774[_0x5a35('0x4e')](_0x35ec50);}})[_0x5a35('0x23')](function(_0x115fef){if(_0x115fef){return _0x115fef?{'count':_0x11ab54,'rows':_0x115fef}:null;}})[_0x5a35('0x23')](respondWithResult(_0x73ba59,null))[_0x5a35('0x3d')](handleError(_0x73ba59,null));};exports[_0x5a35('0x4f')]=function(_0x1f4bb9,_0x43c5f4,_0x4fc5c2){var _0x5c04c9={};var _0x4c52df={};var _0x185824;var _0x56dbbf;return db['FreshdeskConfiguration'][_0x5a35('0x4b')]({'where':{'id':_0x1f4bb9[_0x5a35('0x3f')]['id']}})['then'](handleEntityNotFound(_0x43c5f4,null))['then'](function(_0x23e7d9){if(_0x23e7d9){_0x185824=_0x23e7d9;_0x4c52df[_0x5a35('0x33')]=_['keys'](db[_0x5a35('0x50')][_0x5a35('0x2b')]);_0x4c52df[_0x5a35('0x2e')]=_['keys'](_0x1f4bb9[_0x5a35('0x2e')]);_0x4c52df['filters']=_[_0x5a35('0x30')](_0x4c52df[_0x5a35('0x33')],_0x4c52df['query']);_0x5c04c9['attributes']=_[_0x5a35('0x30')](_0x4c52df['model'],qs[_0x5a35('0x32')](_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x32')]));_0x5c04c9['attributes']=_0x5c04c9['attributes'][_0x5a35('0x48')]?_0x5c04c9[_0x5a35('0x31')]:_0x4c52df[_0x5a35('0x33')];_0x5c04c9[_0x5a35('0x4d')]=qs[_0x5a35('0x35')](_0x1f4bb9['query'][_0x5a35('0x35')]);_0x5c04c9[_0x5a35('0x37')]=qs[_0x5a35('0x2f')](_[_0x5a35('0x47')](_0x1f4bb9['query'],_0x4c52df[_0x5a35('0x2f')]));if(_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x36')]){_0x5c04c9['where']=_[_0x5a35('0x38')](_0x5c04c9[_0x5a35('0x37')],{'$or':_['map'](_0x5c04c9[_0x5a35('0x31')],function(_0x15f544){var _0x303833={};_0x303833[_0x15f544]={'$like':'%'+_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x36')]+'%'};return _0x303833;})});}_0x5c04c9=_[_0x5a35('0x38')]({},_0x5c04c9,_0x1f4bb9['options']);return _0x185824[_0x5a35('0x4f')](_0x5c04c9);}})[_0x5a35('0x23')](function(_0x1fad55){if(_0x1fad55){_0x56dbbf=_0x1fad55['length'];if(!_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x49')](_0x5a35('0x34'))){_0x5c04c9['limit']=qs[_0x5a35('0x1d')](_0x1f4bb9['query'][_0x5a35('0x1d')]);_0x5c04c9[_0x5a35('0x1c')]=qs[_0x5a35('0x1c')](_0x1f4bb9[_0x5a35('0x2e')][_0x5a35('0x1c')]);}return _0x185824[_0x5a35('0x4f')](_0x5c04c9);}})[_0x5a35('0x23')](function(_0x962a10){if(_0x962a10){return _0x962a10?{'count':_0x56dbbf,'rows':_0x962a10}:null;}})['then'](respondWithResult(_0x43c5f4,null))[_0x5a35('0x3d')](handleError(_0x43c5f4,null));};exports[_0x5a35('0x51')]=function(_0x43044a,_0x54a970,_0xe24bb6){if(_0x43044a['body']['id']){delete _0x43044a[_0x5a35('0x45')]['id'];}return db[_0x5a35('0x2a')][_0x5a35('0x4b')]({'where':{'id':_0x43044a[_0x5a35('0x3f')]['id']}})[_0x5a35('0x23')](handleEntityNotFound(_0x54a970,null))[_0x5a35('0x23')](function(_0x3157db){if(_0x3157db){return _0x3157db[_0x5a35('0x51')](_0x43044a[_0x5a35('0x45')][_0x5a35('0x52')]||[]);}return null;})[_0x5a35('0x23')](respondWithResult(_0x54a970,null))['catch'](handleError(_0x54a970,null));}; \ No newline at end of file +var _0xba9a=['request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','FreshdeskConfiguration','includeAll','include','rows','catch','show','fields','options','create','body','update','find','params','FreshdeskField','getSubjects','findOne','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','fast-json-patch'];(function(_0x227d13,_0x605fba){var _0x39a6af=function(_0x5afd28){while(--_0x5afd28){_0x227d13['push'](_0x227d13['shift']());}};_0x39a6af(++_0x605fba);}(_0xba9a,0xa5));var _0xaba9=function(_0x366bf8,_0x44ed87){_0x366bf8=_0x366bf8-0x0;var _0x3bb18e=_0xba9a[_0x366bf8];return _0x3bb18e;};'use strict';var emlformat=require(_0xaba9('0x0'));var rimraf=require(_0xaba9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaba9('0x2'));var rp=require(_0xaba9('0x3'));var moment=require(_0xaba9('0x4'));var BPromise=require(_0xaba9('0x5'));var Mustache=require('mustache');var util=require(_0xaba9('0x6'));var path=require(_0xaba9('0x7'));var sox=require(_0xaba9('0x8'));var csv=require('to-csv');var ejs=require(_0xaba9('0x9'));var fs=require('fs');var fs_extra=require(_0xaba9('0xa'));var _=require(_0xaba9('0xb'));var squel=require(_0xaba9('0xc'));var crypto=require(_0xaba9('0xd'));var jsforce=require(_0xaba9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaba9('0xf'));var Papa=require(_0xaba9('0x10'));var Redis=require(_0xaba9('0x11'));var authService=require(_0xaba9('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xaba9('0x13'));var hardwareService=require(_0xaba9('0x14'));var logger=require(_0xaba9('0x15'))('api');var utils=require(_0xaba9('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xaba9('0x17'));var db=require(_0xaba9('0x18'))['db'];function respondWithStatusCode(_0x22816f,_0x408d1e){_0x408d1e=_0x408d1e||0xcc;return function(_0x355b9e){if(_0x355b9e){return _0x22816f['sendStatus'](_0x408d1e);}return _0x22816f[_0xaba9('0x19')](_0x408d1e)[_0xaba9('0x1a')]();};}function respondWithResult(_0x2d7718,_0x313818){_0x313818=_0x313818||0xc8;return function(_0x308c7c){if(_0x308c7c){return _0x2d7718[_0xaba9('0x19')](_0x313818)[_0xaba9('0x1b')](_0x308c7c);}};}function respondWithFilteredResult(_0x3c8e13,_0xa5a530){return function(_0x2006da){if(_0x2006da){var _0x5b6c45=typeof _0xa5a530[_0xaba9('0x1c')]===_0xaba9('0x1d')&&typeof _0xa5a530[_0xaba9('0x1e')]===_0xaba9('0x1d');var _0x4823dd=_0x2006da[_0xaba9('0x1f')];var _0x55bd3f=_0x5b6c45?0x0:_0xa5a530['offset'];var _0x3362c1=_0x5b6c45?_0x2006da[_0xaba9('0x1f')]:_0xa5a530[_0xaba9('0x1c')]+_0xa5a530['limit'];var _0x2f0419;if(_0x3362c1>=_0x4823dd){_0x3362c1=_0x4823dd;_0x2f0419=0xc8;}else{_0x2f0419=0xce;}_0x3c8e13['status'](_0x2f0419);return _0x3c8e13[_0xaba9('0x20')](_0xaba9('0x21'),_0x55bd3f+'-'+_0x3362c1+'/'+_0x4823dd)[_0xaba9('0x1b')](_0x2006da);}return null;};}function patchUpdates(_0x1f22e6){return function(_0x187fa8){try{jsonpatch[_0xaba9('0x22')](_0x187fa8,_0x1f22e6,!![]);}catch(_0x2bd123){return BPromise[_0xaba9('0x23')](_0x2bd123);}return _0x187fa8['save']();};}function saveUpdates(_0x464f29,_0x33e82a){return function(_0x4a063d){if(_0x4a063d){return _0x4a063d['update'](_0x464f29)['then'](function(_0xe3535b){return _0xe3535b;});}return null;};}function removeEntity(_0x54a3a0,_0xe41e39){return function(_0x2f72b2){if(_0x2f72b2){return _0x2f72b2[_0xaba9('0x24')]()[_0xaba9('0x25')](function(){_0x54a3a0[_0xaba9('0x19')](0xcc)[_0xaba9('0x1a')]();});}};}function handleEntityNotFound(_0x1f7dbb,_0x379606){return function(_0x4d2c38){if(!_0x4d2c38){_0x1f7dbb[_0xaba9('0x26')](0x194);}return _0x4d2c38;};}function handleError(_0x3fc486,_0xc20722){_0xc20722=_0xc20722||0x1f4;return function(_0x1748d2){logger[_0xaba9('0x27')](_0x1748d2[_0xaba9('0x28')]);if(_0x1748d2[_0xaba9('0x29')]){delete _0x1748d2[_0xaba9('0x29')];}_0x3fc486['status'](_0xc20722)[_0xaba9('0x2a')](_0x1748d2);};}exports[_0xaba9('0x2b')]=function(_0xd181fd,_0x510d41){var _0x196c55={},_0x4b4092={},_0x213382={'count':0x0,'rows':[]};var _0x6e7ae7=_[_0xaba9('0x2c')](db['FreshdeskConfiguration'][_0xaba9('0x2d')],function(_0x355a2a){return{'name':_0x355a2a['fieldName'],'type':_0x355a2a[_0xaba9('0x2e')][_0xaba9('0x2f')]};});_0x4b4092[_0xaba9('0x30')]=_[_0xaba9('0x2c')](_0x6e7ae7,'name');_0x4b4092[_0xaba9('0x31')]=_[_0xaba9('0x32')](_0xd181fd[_0xaba9('0x31')]);_0x4b4092[_0xaba9('0x33')]=_['intersection'](_0x4b4092['model'],_0x4b4092[_0xaba9('0x31')]);_0x196c55[_0xaba9('0x34')]=_[_0xaba9('0x35')](_0x4b4092[_0xaba9('0x30')],qs['fields'](_0xd181fd[_0xaba9('0x31')]['fields']));_0x196c55[_0xaba9('0x34')]=_0x196c55['attributes'][_0xaba9('0x36')]?_0x196c55['attributes']:_0x4b4092[_0xaba9('0x30')];if(!_0xd181fd[_0xaba9('0x31')][_0xaba9('0x37')](_0xaba9('0x38'))){_0x196c55[_0xaba9('0x1e')]=qs[_0xaba9('0x1e')](_0xd181fd['query']['limit']);_0x196c55['offset']=qs[_0xaba9('0x1c')](_0xd181fd[_0xaba9('0x31')]['offset']);}_0x196c55[_0xaba9('0x39')]=qs['sort'](_0xd181fd[_0xaba9('0x31')][_0xaba9('0x3a')]);_0x196c55[_0xaba9('0x3b')]=qs[_0xaba9('0x33')](_[_0xaba9('0x3c')](_0xd181fd[_0xaba9('0x31')],_0x4b4092[_0xaba9('0x33')]),_0x6e7ae7);if(_0xd181fd[_0xaba9('0x31')][_0xaba9('0x3d')]){_0x196c55[_0xaba9('0x3b')]=_[_0xaba9('0x3e')](_0x196c55[_0xaba9('0x3b')],{'$or':_[_0xaba9('0x2c')](_0x6e7ae7,function(_0x49d0b0){if(_0x49d0b0['type']!=='VIRTUAL'){var _0x319ab4={};_0x319ab4[_0x49d0b0[_0xaba9('0x29')]]={'$like':'%'+_0xd181fd[_0xaba9('0x31')]['filter']+'%'};return _0x319ab4;}})});}_0x196c55=_['merge']({},_0x196c55,_0xd181fd['options']);var _0x1de5ac={'where':_0x196c55[_0xaba9('0x3b')]};return db[_0xaba9('0x3f')][_0xaba9('0x1f')](_0x1de5ac)['then'](function(_0xe11d85){_0x213382[_0xaba9('0x1f')]=_0xe11d85;if(_0xd181fd[_0xaba9('0x31')][_0xaba9('0x40')]){_0x196c55[_0xaba9('0x41')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x196c55);})[_0xaba9('0x25')](function(_0x27188d){_0x213382[_0xaba9('0x42')]=_0x27188d;return _0x213382;})['then'](respondWithFilteredResult(_0x510d41,_0x196c55))[_0xaba9('0x43')](handleError(_0x510d41,null));};exports[_0xaba9('0x44')]=function(_0x4688e2,_0x2a53de){var _0x46b5cd={'raw':![],'where':{'id':_0x4688e2['params']['id']}},_0x214806={};_0x214806['model']=_[_0xaba9('0x32')](db[_0xaba9('0x3f')][_0xaba9('0x2d')]);_0x214806[_0xaba9('0x31')]=_['keys'](_0x4688e2[_0xaba9('0x31')]);_0x214806[_0xaba9('0x33')]=_[_0xaba9('0x35')](_0x214806['model'],_0x214806[_0xaba9('0x31')]);_0x46b5cd['attributes']=_[_0xaba9('0x35')](_0x214806[_0xaba9('0x30')],qs['fields'](_0x4688e2['query'][_0xaba9('0x45')]));_0x46b5cd['attributes']=_0x46b5cd[_0xaba9('0x34')][_0xaba9('0x36')]?_0x46b5cd[_0xaba9('0x34')]:_0x214806['model'];if(_0x4688e2[_0xaba9('0x31')][_0xaba9('0x40')]){_0x46b5cd[_0xaba9('0x41')]=[{'all':!![]}];}_0x46b5cd=_[_0xaba9('0x3e')]({},_0x46b5cd,_0x4688e2[_0xaba9('0x46')]);return db['FreshdeskConfiguration']['find'](_0x46b5cd)[_0xaba9('0x25')](handleEntityNotFound(_0x2a53de,null))['then'](respondWithResult(_0x2a53de,null))[_0xaba9('0x43')](handleError(_0x2a53de,null));};exports[_0xaba9('0x47')]=function(_0x2dbc9d,_0x124046){return db[_0xaba9('0x3f')][_0xaba9('0x47')](_0x2dbc9d[_0xaba9('0x48')],{})[_0xaba9('0x25')](respondWithResult(_0x124046,0xc9))['catch'](handleError(_0x124046,null));};exports[_0xaba9('0x49')]=function(_0xa335cb,_0x3a8da4){if(_0xa335cb[_0xaba9('0x48')]['id']){delete _0xa335cb[_0xaba9('0x48')]['id'];}return db[_0xaba9('0x3f')][_0xaba9('0x4a')]({'where':{'id':_0xa335cb['params']['id']}})[_0xaba9('0x25')](handleEntityNotFound(_0x3a8da4,null))[_0xaba9('0x25')](saveUpdates(_0xa335cb[_0xaba9('0x48')],null))[_0xaba9('0x25')](respondWithResult(_0x3a8da4,null))['catch'](handleError(_0x3a8da4,null));};exports[_0xaba9('0x24')]=function(_0x4eb0a7,_0x568659){return db[_0xaba9('0x3f')][_0xaba9('0x4a')]({'where':{'id':_0x4eb0a7[_0xaba9('0x4b')]['id']}})[_0xaba9('0x25')](handleEntityNotFound(_0x568659,null))[_0xaba9('0x25')](removeEntity(_0x568659,null))[_0xaba9('0x43')](handleError(_0x568659,null));};exports['getFields']=function(_0xe505b4,_0x5f4fbd,_0x35d330){var _0x1d18a0={};var _0x9986a0={};var _0x26611a;var _0x27749e;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0xe505b4[_0xaba9('0x4b')]['id']}})[_0xaba9('0x25')](handleEntityNotFound(_0x5f4fbd,null))[_0xaba9('0x25')](function(_0x2956c6){if(_0x2956c6){_0x26611a=_0x2956c6;_0x9986a0[_0xaba9('0x30')]=_[_0xaba9('0x32')](db[_0xaba9('0x4c')][_0xaba9('0x2d')]);_0x9986a0['query']=_[_0xaba9('0x32')](_0xe505b4[_0xaba9('0x31')]);_0x9986a0[_0xaba9('0x33')]=_['intersection'](_0x9986a0['model'],_0x9986a0[_0xaba9('0x31')]);_0x1d18a0[_0xaba9('0x34')]=_[_0xaba9('0x35')](_0x9986a0[_0xaba9('0x30')],qs[_0xaba9('0x45')](_0xe505b4[_0xaba9('0x31')][_0xaba9('0x45')]));_0x1d18a0[_0xaba9('0x34')]=_0x1d18a0[_0xaba9('0x34')]['length']?_0x1d18a0[_0xaba9('0x34')]:_0x9986a0['model'];_0x1d18a0[_0xaba9('0x39')]=qs['sort'](_0xe505b4[_0xaba9('0x31')][_0xaba9('0x3a')]);_0x1d18a0['where']=qs[_0xaba9('0x33')](_[_0xaba9('0x3c')](_0xe505b4['query'],_0x9986a0[_0xaba9('0x33')]));if(_0xe505b4[_0xaba9('0x31')][_0xaba9('0x3d')]){_0x1d18a0['where']=_[_0xaba9('0x3e')](_0x1d18a0[_0xaba9('0x3b')],{'$or':_['map'](_0x1d18a0[_0xaba9('0x34')],function(_0x29d605){var _0x5d702b={};_0x5d702b[_0x29d605]={'$like':'%'+_0xe505b4[_0xaba9('0x31')]['filter']+'%'};return _0x5d702b;})});}_0x1d18a0=_['merge']({},_0x1d18a0,_0xe505b4[_0xaba9('0x46')]);return _0x26611a['getFields'](_0x1d18a0);}})[_0xaba9('0x25')](function(_0x737f53){if(_0x737f53){_0x27749e=_0x737f53[_0xaba9('0x36')];if(!_0xe505b4[_0xaba9('0x31')][_0xaba9('0x37')](_0xaba9('0x38'))){_0x1d18a0[_0xaba9('0x1e')]=qs[_0xaba9('0x1e')](_0xe505b4[_0xaba9('0x31')][_0xaba9('0x1e')]);_0x1d18a0[_0xaba9('0x1c')]=qs[_0xaba9('0x1c')](_0xe505b4[_0xaba9('0x31')][_0xaba9('0x1c')]);}return _0x26611a['getFields'](_0x1d18a0);}})[_0xaba9('0x25')](function(_0x769d60){if(_0x769d60){return _0x769d60?{'count':_0x27749e,'rows':_0x769d60}:null;}})['then'](respondWithResult(_0x5f4fbd,null))[_0xaba9('0x43')](handleError(_0x5f4fbd,null));};exports[_0xaba9('0x4d')]=function(_0x1009df,_0x443df0,_0x2806bc){var _0x5c0881={};var _0x2af58c={};var _0xb71a37;var _0x23a2fa;return db['FreshdeskConfiguration'][_0xaba9('0x4e')]({'where':{'id':_0x1009df[_0xaba9('0x4b')]['id']}})['then'](handleEntityNotFound(_0x443df0,null))[_0xaba9('0x25')](function(_0x2848d8){if(_0x2848d8){_0xb71a37=_0x2848d8;_0x2af58c[_0xaba9('0x30')]=_[_0xaba9('0x32')](db['FreshdeskField'][_0xaba9('0x2d')]);_0x2af58c[_0xaba9('0x31')]=_['keys'](_0x1009df[_0xaba9('0x31')]);_0x2af58c['filters']=_[_0xaba9('0x35')](_0x2af58c[_0xaba9('0x30')],_0x2af58c[_0xaba9('0x31')]);_0x5c0881['attributes']=_[_0xaba9('0x35')](_0x2af58c[_0xaba9('0x30')],qs[_0xaba9('0x45')](_0x1009df['query'][_0xaba9('0x45')]));_0x5c0881[_0xaba9('0x34')]=_0x5c0881[_0xaba9('0x34')][_0xaba9('0x36')]?_0x5c0881[_0xaba9('0x34')]:_0x2af58c[_0xaba9('0x30')];_0x5c0881[_0xaba9('0x39')]=qs[_0xaba9('0x3a')](_0x1009df[_0xaba9('0x31')][_0xaba9('0x3a')]);_0x5c0881[_0xaba9('0x3b')]=qs[_0xaba9('0x33')](_['pick'](_0x1009df[_0xaba9('0x31')],_0x2af58c[_0xaba9('0x33')]));if(_0x1009df[_0xaba9('0x31')][_0xaba9('0x3d')]){_0x5c0881['where']=_[_0xaba9('0x3e')](_0x5c0881[_0xaba9('0x3b')],{'$or':_[_0xaba9('0x2c')](_0x5c0881[_0xaba9('0x34')],function(_0x240445){var _0x501998={};_0x501998[_0x240445]={'$like':'%'+_0x1009df[_0xaba9('0x31')][_0xaba9('0x3d')]+'%'};return _0x501998;})});}_0x5c0881=_[_0xaba9('0x3e')]({},_0x5c0881,_0x1009df[_0xaba9('0x46')]);return _0xb71a37[_0xaba9('0x4d')](_0x5c0881);}})['then'](function(_0x37cc26){if(_0x37cc26){_0x23a2fa=_0x37cc26[_0xaba9('0x36')];if(!_0x1009df[_0xaba9('0x31')][_0xaba9('0x37')](_0xaba9('0x38'))){_0x5c0881[_0xaba9('0x1e')]=qs[_0xaba9('0x1e')](_0x1009df[_0xaba9('0x31')][_0xaba9('0x1e')]);_0x5c0881[_0xaba9('0x1c')]=qs[_0xaba9('0x1c')](_0x1009df['query'][_0xaba9('0x1c')]);}return _0xb71a37[_0xaba9('0x4d')](_0x5c0881);}})[_0xaba9('0x25')](function(_0x43ab75){if(_0x43ab75){return _0x43ab75?{'count':_0x23a2fa,'rows':_0x43ab75}:null;}})['then'](respondWithResult(_0x443df0,null))['catch'](handleError(_0x443df0,null));};exports[_0xaba9('0x4f')]=function(_0x4bbf4d,_0x55fd34,_0x53ad26){var _0x2054eb={};var _0x21872f={};var _0x1d8692;var _0x53a41d;return db[_0xaba9('0x3f')]['findOne']({'where':{'id':_0x4bbf4d['params']['id']}})['then'](handleEntityNotFound(_0x55fd34,null))[_0xaba9('0x25')](function(_0x1c2b87){if(_0x1c2b87){_0x1d8692=_0x1c2b87;_0x21872f[_0xaba9('0x30')]=_[_0xaba9('0x32')](db[_0xaba9('0x4c')][_0xaba9('0x2d')]);_0x21872f[_0xaba9('0x31')]=_[_0xaba9('0x32')](_0x4bbf4d[_0xaba9('0x31')]);_0x21872f[_0xaba9('0x33')]=_[_0xaba9('0x35')](_0x21872f[_0xaba9('0x30')],_0x21872f['query']);_0x2054eb[_0xaba9('0x34')]=_[_0xaba9('0x35')](_0x21872f['model'],qs['fields'](_0x4bbf4d[_0xaba9('0x31')][_0xaba9('0x45')]));_0x2054eb[_0xaba9('0x34')]=_0x2054eb[_0xaba9('0x34')]['length']?_0x2054eb[_0xaba9('0x34')]:_0x21872f[_0xaba9('0x30')];_0x2054eb[_0xaba9('0x39')]=qs[_0xaba9('0x3a')](_0x4bbf4d[_0xaba9('0x31')]['sort']);_0x2054eb['where']=qs[_0xaba9('0x33')](_[_0xaba9('0x3c')](_0x4bbf4d[_0xaba9('0x31')],_0x21872f[_0xaba9('0x33')]));if(_0x4bbf4d['query'][_0xaba9('0x3d')]){_0x2054eb['where']=_['merge'](_0x2054eb[_0xaba9('0x3b')],{'$or':_[_0xaba9('0x2c')](_0x2054eb[_0xaba9('0x34')],function(_0x99a2bf){var _0x2af4ba={};_0x2af4ba[_0x99a2bf]={'$like':'%'+_0x4bbf4d[_0xaba9('0x31')][_0xaba9('0x3d')]+'%'};return _0x2af4ba;})});}_0x2054eb=_['merge']({},_0x2054eb,_0x4bbf4d[_0xaba9('0x46')]);return _0x1d8692[_0xaba9('0x4f')](_0x2054eb);}})[_0xaba9('0x25')](function(_0x2e9782){if(_0x2e9782){_0x53a41d=_0x2e9782[_0xaba9('0x36')];if(!_0x4bbf4d['query']['hasOwnProperty'](_0xaba9('0x38'))){_0x2054eb['limit']=qs['limit'](_0x4bbf4d[_0xaba9('0x31')][_0xaba9('0x1e')]);_0x2054eb[_0xaba9('0x1c')]=qs[_0xaba9('0x1c')](_0x4bbf4d['query'][_0xaba9('0x1c')]);}return _0x1d8692['getDescriptions'](_0x2054eb);}})[_0xaba9('0x25')](function(_0x493a3c){if(_0x493a3c){return _0x493a3c?{'count':_0x53a41d,'rows':_0x493a3c}:null;}})['then'](respondWithResult(_0x55fd34,null))[_0xaba9('0x43')](handleError(_0x55fd34,null));};exports['getTags']=function(_0x1cd45b,_0x5695cc,_0x3fcf9c){var _0x9801bd={};var _0x9deff5={};var _0x469aa5;var _0x2e448b;return db[_0xaba9('0x3f')][_0xaba9('0x4e')]({'where':{'id':_0x1cd45b[_0xaba9('0x4b')]['id']}})[_0xaba9('0x25')](handleEntityNotFound(_0x5695cc,null))[_0xaba9('0x25')](function(_0x4cc2ef){if(_0x4cc2ef){_0x469aa5=_0x4cc2ef;_0x9deff5['model']=_[_0xaba9('0x32')](db[_0xaba9('0x50')][_0xaba9('0x2d')]);_0x9deff5[_0xaba9('0x31')]=_['keys'](_0x1cd45b['query']);_0x9deff5[_0xaba9('0x33')]=_[_0xaba9('0x35')](_0x9deff5['model'],_0x9deff5[_0xaba9('0x31')]);_0x9801bd['attributes']=_[_0xaba9('0x35')](_0x9deff5[_0xaba9('0x30')],qs[_0xaba9('0x45')](_0x1cd45b[_0xaba9('0x31')][_0xaba9('0x45')]));_0x9801bd['attributes']=_0x9801bd[_0xaba9('0x34')][_0xaba9('0x36')]?_0x9801bd[_0xaba9('0x34')]:_0x9deff5[_0xaba9('0x30')];_0x9801bd['order']=qs[_0xaba9('0x3a')](_0x1cd45b['query'][_0xaba9('0x3a')]);_0x9801bd[_0xaba9('0x3b')]=qs['filters'](_[_0xaba9('0x3c')](_0x1cd45b[_0xaba9('0x31')],_0x9deff5[_0xaba9('0x33')]));if(_0x1cd45b[_0xaba9('0x31')]['filter']){_0x9801bd[_0xaba9('0x3b')]=_[_0xaba9('0x3e')](_0x9801bd['where'],{'$or':_[_0xaba9('0x2c')](_0x9801bd[_0xaba9('0x34')],function(_0x3c29a5){var _0x1391ac={};_0x1391ac[_0x3c29a5]={'$like':'%'+_0x1cd45b[_0xaba9('0x31')][_0xaba9('0x3d')]+'%'};return _0x1391ac;})});}_0x9801bd=_['merge']({},_0x9801bd,_0x1cd45b[_0xaba9('0x46')]);return _0x469aa5['getTags'](_0x9801bd);}})[_0xaba9('0x25')](function(_0x1d5aa9){if(_0x1d5aa9){_0x2e448b=_0x1d5aa9[_0xaba9('0x36')];if(!_0x1cd45b[_0xaba9('0x31')][_0xaba9('0x37')](_0xaba9('0x38'))){_0x9801bd[_0xaba9('0x1e')]=qs[_0xaba9('0x1e')](_0x1cd45b[_0xaba9('0x31')]['limit']);_0x9801bd['offset']=qs[_0xaba9('0x1c')](_0x1cd45b[_0xaba9('0x31')][_0xaba9('0x1c')]);}return _0x469aa5[_0xaba9('0x51')](_0x9801bd);}})['then'](function(_0x56c489){if(_0x56c489){return _0x56c489?{'count':_0x2e448b,'rows':_0x56c489}:null;}})['then'](respondWithResult(_0x5695cc,null))[_0xaba9('0x43')](handleError(_0x5695cc,null));};exports[_0xaba9('0x52')]=function(_0x15cdaf,_0x80bb89,_0x5838cc){if(_0x15cdaf[_0xaba9('0x48')]['id']){delete _0x15cdaf[_0xaba9('0x48')]['id'];}return db[_0xaba9('0x3f')]['findOne']({'where':{'id':_0x15cdaf['params']['id']}})[_0xaba9('0x25')](handleEntityNotFound(_0x80bb89,null))[_0xaba9('0x25')](function(_0x56da0b){if(_0x56da0b){return _0x56da0b['setTags'](_0x15cdaf[_0xaba9('0x48')][_0xaba9('0x53')]||[]);}return null;})[_0xaba9('0x25')](respondWithResult(_0x80bb89,null))['catch'](handleError(_0x80bb89,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 0941181..f33ef30 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 _0x4e7d=['int_freshdesk_configurations','util','../../config/logger','moment','bluebird','path','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration'];(function(_0x1e4a8e,_0x18022b){var _0x5408f9=function(_0x4ef2ed){while(--_0x4ef2ed){_0x1e4a8e['push'](_0x1e4a8e['shift']());}};_0x5408f9(++_0x18022b);}(_0x4e7d,0x169));var _0xd4e7=function(_0xc0e98c,_0x4f0469){_0xc0e98c=_0xc0e98c-0x0;var _0x3b2a58=_0x4e7d[_0xc0e98c];return _0x3b2a58;};'use strict';var _=require('lodash');var util=require(_0xd4e7('0x0'));var logger=require(_0xd4e7('0x1'))('api');var moment=require(_0xd4e7('0x2'));var BPromise=require(_0xd4e7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd4e7('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd4e7('0x5'));module[_0xd4e7('0x6')]=function(_0x418790,_0xca86ee){return _0x418790[_0xd4e7('0x7')](_0xd4e7('0x8'),attributes,{'tableName':_0xd4e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50d1=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./intFreshdeskConfiguration.attributes'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x50d1,0x123));var _0x150d=function(_0x5a76ea,_0x547cb9){_0x5a76ea=_0x5a76ea-0x0;var _0x42b09a=_0x50d1[_0x5a76ea];return _0x42b09a;};'use strict';var _=require(_0x150d('0x0'));var util=require(_0x150d('0x1'));var logger=require(_0x150d('0x2'))(_0x150d('0x3'));var moment=require(_0x150d('0x4'));var BPromise=require('bluebird');var rp=require(_0x150d('0x5'));var fs=require('fs');var path=require(_0x150d('0x6'));var rimraf=require('rimraf');var config=require(_0x150d('0x7'));var attributes=require(_0x150d('0x8'));module['exports']=function(_0x359e4f,_0x3027ca){return _0x359e4f[_0x150d('0x9')](_0x150d('0xa'),attributes,{'tableName':_0x150d('0xb'),'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 4597ce0..44d885c 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 _0x905f=['stringify','error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','debug','request\x20sent'];(function(_0x378a41,_0x42e1de){var _0x38b9b9=function(_0x37d9a7){while(--_0x37d9a7){_0x378a41['push'](_0x378a41['shift']());}};_0x38b9b9(++_0x42e1de);}(_0x905f,0x1d5));var _0xf905=function(_0x39954a,_0x601a95){_0x39954a=_0x39954a-0x0;var _0x134f26=_0x905f[_0x39954a];return _0x134f26;};'use strict';var _=require(_0xf905('0x0'));var util=require(_0xf905('0x1'));var moment=require(_0xf905('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf905('0x3'))['db'];var utils=require(_0xf905('0x4'));var logger=require(_0xf905('0x5'))(_0xf905('0x6'));var config=require(_0xf905('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf905('0x8')][_0xf905('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1982e7,_0x4b2476,_0x55afb1){return new BPromise(function(_0x20b792,_0x2b268d){return client[_0xf905('0xa')](_0x1982e7,_0x55afb1)[_0xf905('0xb')](function(_0x518286){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4b2476,'request\x20sent');logger[_0xf905('0xc')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4b2476,_0xf905('0xd'),JSON[_0xf905('0xe')](_0x518286));if(_0x518286[_0xf905('0xf')]){if(_0x518286[_0xf905('0xf')][_0xf905('0x10')]===0x1f4){logger[_0xf905('0xf')](_0xf905('0x11'),_0x4b2476,_0x518286[_0xf905('0xf')]['message']);return _0x2b268d(_0x518286[_0xf905('0xf')][_0xf905('0x12')]);}logger[_0xf905('0xf')](_0xf905('0x11'),_0x4b2476,_0x518286[_0xf905('0xf')][_0xf905('0x12')]);return _0x20b792(_0x518286[_0xf905('0xf')][_0xf905('0x12')]);}else{logger[_0xf905('0x13')](_0xf905('0x11'),_0x4b2476,'request\x20sent');_0x20b792(_0x518286['result'][_0xf905('0x12')]);}})[_0xf905('0x14')](function(_0x367533){logger[_0xf905('0xf')](_0xf905('0x11'),_0x4b2476,_0x367533);_0x2b268d(_0x367533);});});} \ No newline at end of file +var _0x6713=['error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5f50b5,_0xa8db83){var _0x54c383=function(_0x381334){while(--_0x381334){_0x5f50b5['push'](_0x5f50b5['shift']());}};_0x54c383(++_0xa8db83);}(_0x6713,0x17a));var _0x3671=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0x6713[_0x56f7e2];return _0x36240b;};'use strict';var _=require(_0x3671('0x0'));var util=require(_0x3671('0x1'));var moment=require(_0x3671('0x2'));var BPromise=require(_0x3671('0x3'));var rs=require(_0x3671('0x4'));var fs=require('fs');var Redis=require(_0x3671('0x5'));var db=require(_0x3671('0x6'))['db'];var utils=require(_0x3671('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3671('0x8'));var jayson=require(_0x3671('0x9'));var client=jayson[_0x3671('0xa')][_0x3671('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x187ca1,_0x39da7e,_0x2ef59d){return new BPromise(function(_0x47648d,_0x2d16f3){return client[_0x3671('0xc')](_0x187ca1,_0x2ef59d)['then'](function(_0x489ca3){logger[_0x3671('0xd')](_0x3671('0xe'),_0x39da7e,_0x3671('0xf'));logger[_0x3671('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x39da7e,_0x3671('0xf'),JSON[_0x3671('0x11')](_0x489ca3));if(_0x489ca3['error']){if(_0x489ca3[_0x3671('0x12')][_0x3671('0x13')]===0x1f4){logger[_0x3671('0x12')](_0x3671('0xe'),_0x39da7e,_0x489ca3[_0x3671('0x12')][_0x3671('0x14')]);return _0x2d16f3(_0x489ca3[_0x3671('0x12')]['message']);}logger['error'](_0x3671('0xe'),_0x39da7e,_0x489ca3[_0x3671('0x12')][_0x3671('0x14')]);return _0x47648d(_0x489ca3[_0x3671('0x12')][_0x3671('0x14')]);}else{logger[_0x3671('0xd')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x39da7e,_0x3671('0xf'));_0x47648d(_0x489ca3['result'][_0x3671('0x14')]);}})[_0x3671('0x15')](function(_0x4e1ff6){logger['error'](_0x3671('0xe'),_0x39da7e,_0x4e1ff6);_0x2d16f3(_0x4e1ff6);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6c0e751..59f3216 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 _0xf8ff=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','put','delete','exports'];(function(_0x1fcf31,_0x395e33){var _0x1cb7c1=function(_0x27024f){while(--_0x27024f){_0x1fcf31['push'](_0x1fcf31['shift']());}};_0x1cb7c1(++_0x395e33);}(_0xf8ff,0xaa));var _0xff8f=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0xf8ff[_0x21c6b8];return _0x39d474;};'use strict';var multer=require(_0xff8f('0x0'));var util=require(_0xff8f('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xff8f('0x2')]();var fs_extra=require(_0xff8f('0x3'));var auth=require(_0xff8f('0x4'));var interaction=require(_0xff8f('0x5'));var config=require(_0xff8f('0x6'));var controller=require(_0xff8f('0x7'));router[_0xff8f('0x8')]('/',auth[_0xff8f('0x9')](),controller[_0xff8f('0xa')]);router[_0xff8f('0x8')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller[_0xff8f('0xc')]);router[_0xff8f('0xd')]('/',auth[_0xff8f('0x9')](),controller['create']);router[_0xff8f('0xe')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller['update']);router[_0xff8f('0xf')](_0xff8f('0xb'),auth[_0xff8f('0x9')](),controller['destroy']);module[_0xff8f('0x10')]=router; \ No newline at end of file +var _0x3a12=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskField.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express'];(function(_0x4d8376,_0x50c85a){var _0x16ba60=function(_0x20212a){while(--_0x20212a){_0x4d8376['push'](_0x4d8376['shift']());}};_0x16ba60(++_0x50c85a);}(_0x3a12,0x1b4));var _0x23a1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a12[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x23a1('0x0'));var util=require(_0x23a1('0x1'));var path=require(_0x23a1('0x2'));var timeout=require(_0x23a1('0x3'));var express=require(_0x23a1('0x4'));var router=express[_0x23a1('0x5')]();var fs_extra=require(_0x23a1('0x6'));var auth=require(_0x23a1('0x7'));var interaction=require(_0x23a1('0x8'));var config=require('../../config/environment');var controller=require(_0x23a1('0x9'));router[_0x23a1('0xa')]('/',auth['isAuthenticated'](),controller[_0x23a1('0xb')]);router[_0x23a1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x23a1('0xc')]);router[_0x23a1('0xd')]('/',auth[_0x23a1('0xe')](),controller[_0x23a1('0xf')]);router[_0x23a1('0x10')](_0x23a1('0x11'),auth[_0x23a1('0xe')](),controller[_0x23a1('0x12')]);router[_0x23a1('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x23a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 7a57855..cb831af 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 _0x89fb=['STRING','BOOLEAN','exports','ENUM','string','variable','keyValue','picklist'];(function(_0x2d5c59,_0xd07c56){var _0x46b44c=function(_0x1344ca){while(--_0x1344ca){_0x2d5c59['push'](_0x2d5c59['shift']());}};_0x46b44c(++_0xd07c56);}(_0x89fb,0xd2));var _0xb89f=function(_0x297df7,_0x206419){_0x297df7=_0x297df7-0x0;var _0x51f345=_0x89fb[_0x297df7];return _0x51f345;};'use strict';var Sequelize=require('sequelize');module[_0xb89f('0x0')]={'type':{'type':Sequelize[_0xb89f('0x1')](_0xb89f('0x2'),_0xb89f('0x3'),'customVariable',_0xb89f('0x4'),_0xb89f('0x5')),'defaultValue':_0xb89f('0x2')},'content':{'type':Sequelize[_0xb89f('0x6')]},'key':{'type':Sequelize[_0xb89f('0x6')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xb89f('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xb89f('0x6')]},'customField':{'type':Sequelize[_0xb89f('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb89f('0x6')]}}; \ No newline at end of file +var _0xa99a=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x112c48,_0x215a05){var _0x59ea36=function(_0x4ac3c9){while(--_0x4ac3c9){_0x112c48['push'](_0x112c48['shift']());}};_0x59ea36(++_0x215a05);}(_0xa99a,0x1b6));var _0xaa99=function(_0x510174,_0x4b9af1){_0x510174=_0x510174-0x0;var _0x590e3e=_0xa99a[_0x510174];return _0x590e3e;};'use strict';var Sequelize=require(_0xaa99('0x0'));module[_0xaa99('0x1')]={'type':{'type':Sequelize[_0xaa99('0x2')](_0xaa99('0x3'),_0xaa99('0x4'),_0xaa99('0x5'),_0xaa99('0x6'),_0xaa99('0x7')),'defaultValue':_0xaa99('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaa99('0x2')](_0xaa99('0x3'),_0xaa99('0x4'),_0xaa99('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xaa99('0x8')]},'customField':{'type':Sequelize[_0xaa99('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaa99('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index dbd5d6f..381a551 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 _0x2e54=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','jsforce','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','offset','undefined','limit','count','set','apply','reject','save','then','error','name','send','index','map','FreshdeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where'];(function(_0x20eacd,_0x2394e2){var _0x57942a=function(_0xd86eda){while(--_0xd86eda){_0x20eacd['push'](_0x20eacd['shift']());}};_0x57942a(++_0x2394e2);}(_0x2e54,0x1dd));var _0x42e5=function(_0x3a8e4f,_0x39ce71){_0x3a8e4f=_0x3a8e4f-0x0;var _0x3543a8=_0x2e54[_0x3a8e4f];return _0x3543a8;};'use strict';var emlformat=require(_0x42e5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x42e5('0x1'));var rp=require(_0x42e5('0x2'));var moment=require(_0x42e5('0x3'));var BPromise=require(_0x42e5('0x4'));var Mustache=require(_0x42e5('0x5'));var util=require(_0x42e5('0x6'));var path=require(_0x42e5('0x7'));var sox=require('sox');var csv=require(_0x42e5('0x8'));var ejs=require(_0x42e5('0x9'));var fs=require('fs');var fs_extra=require(_0x42e5('0xa'));var _=require('lodash');var squel=require(_0x42e5('0xb'));var crypto=require('crypto');var jsforce=require(_0x42e5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x42e5('0x8'));var querystring=require(_0x42e5('0xd'));var Papa=require(_0x42e5('0xe'));var Redis=require(_0x42e5('0xf'));var authService=require(_0x42e5('0x10'));var qs=require(_0x42e5('0x11'));var as=require(_0x42e5('0x12'));var hardwareService=require(_0x42e5('0x13'));var logger=require(_0x42e5('0x14'))('api');var utils=require(_0x42e5('0x15'));var config=require(_0x42e5('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x42e5('0x17'))['db'];function respondWithStatusCode(_0x12385d,_0x4530ba){_0x4530ba=_0x4530ba||0xcc;return function(_0x41598d){if(_0x41598d){return _0x12385d[_0x42e5('0x18')](_0x4530ba);}return _0x12385d[_0x42e5('0x19')](_0x4530ba)[_0x42e5('0x1a')]();};}function respondWithResult(_0x96fae2,_0x447648){_0x447648=_0x447648||0xc8;return function(_0x23957f){if(_0x23957f){return _0x96fae2['status'](_0x447648)[_0x42e5('0x1b')](_0x23957f);}};}function respondWithFilteredResult(_0x1d8e52,_0x4034bd){return function(_0x388300){if(_0x388300){var _0x2f4999=typeof _0x4034bd[_0x42e5('0x1c')]===_0x42e5('0x1d')&&typeof _0x4034bd[_0x42e5('0x1e')]===_0x42e5('0x1d');var _0x3c7b79=_0x388300[_0x42e5('0x1f')];var _0x38282d=_0x2f4999?0x0:_0x4034bd[_0x42e5('0x1c')];var _0x23fe09=_0x2f4999?_0x388300['count']:_0x4034bd[_0x42e5('0x1c')]+_0x4034bd['limit'];var _0x5f4428;if(_0x23fe09>=_0x3c7b79){_0x23fe09=_0x3c7b79;_0x5f4428=0xc8;}else{_0x5f4428=0xce;}_0x1d8e52[_0x42e5('0x19')](_0x5f4428);return _0x1d8e52[_0x42e5('0x20')]('Content-Range',_0x38282d+'-'+_0x23fe09+'/'+_0x3c7b79)[_0x42e5('0x1b')](_0x388300);}return null;};}function patchUpdates(_0x39a3e2){return function(_0x1c2169){try{jsonpatch[_0x42e5('0x21')](_0x1c2169,_0x39a3e2,!![]);}catch(_0x1150f4){return BPromise[_0x42e5('0x22')](_0x1150f4);}return _0x1c2169[_0x42e5('0x23')]();};}function saveUpdates(_0x58eee5,_0x4da508){return function(_0x283d44){if(_0x283d44){return _0x283d44['update'](_0x58eee5)[_0x42e5('0x24')](function(_0x2e9574){return _0x2e9574;});}return null;};}function removeEntity(_0x37d10e,_0x49490f){return function(_0x32380f){if(_0x32380f){return _0x32380f['destroy']()[_0x42e5('0x24')](function(){_0x37d10e[_0x42e5('0x19')](0xcc)[_0x42e5('0x1a')]();});}};}function handleEntityNotFound(_0x275c80,_0x4638bc){return function(_0x4f52b2){if(!_0x4f52b2){_0x275c80['sendStatus'](0x194);}return _0x4f52b2;};}function handleError(_0x3115e4,_0x534a26){_0x534a26=_0x534a26||0x1f4;return function(_0x56f812){logger[_0x42e5('0x25')](_0x56f812['stack']);if(_0x56f812[_0x42e5('0x26')]){delete _0x56f812[_0x42e5('0x26')];}_0x3115e4[_0x42e5('0x19')](_0x534a26)[_0x42e5('0x27')](_0x56f812);};}exports[_0x42e5('0x28')]=function(_0x2f1edc,_0x59a46b){var _0x3e2ea5={},_0x201d9e={},_0x39f763={'count':0x0,'rows':[]};var _0x2c53d4=_[_0x42e5('0x29')](db[_0x42e5('0x2a')][_0x42e5('0x2b')],function(_0x282cbf){return{'name':_0x282cbf[_0x42e5('0x2c')],'type':_0x282cbf[_0x42e5('0x2d')][_0x42e5('0x2e')]};});_0x201d9e[_0x42e5('0x2f')]=_[_0x42e5('0x29')](_0x2c53d4,'name');_0x201d9e[_0x42e5('0x30')]=_[_0x42e5('0x31')](_0x2f1edc[_0x42e5('0x30')]);_0x201d9e[_0x42e5('0x32')]=_['intersection'](_0x201d9e['model'],_0x201d9e[_0x42e5('0x30')]);_0x3e2ea5['attributes']=_[_0x42e5('0x33')](_0x201d9e['model'],qs[_0x42e5('0x34')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x34')]));_0x3e2ea5['attributes']=_0x3e2ea5[_0x42e5('0x35')][_0x42e5('0x36')]?_0x3e2ea5['attributes']:_0x201d9e[_0x42e5('0x2f')];if(!_0x2f1edc['query'][_0x42e5('0x37')](_0x42e5('0x38'))){_0x3e2ea5[_0x42e5('0x1e')]=qs[_0x42e5('0x1e')](_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x1e')]);_0x3e2ea5[_0x42e5('0x1c')]=qs['offset'](_0x2f1edc['query'][_0x42e5('0x1c')]);}_0x3e2ea5[_0x42e5('0x39')]=qs[_0x42e5('0x3a')](_0x2f1edc['query']['sort']);_0x3e2ea5['where']=qs['filters'](_[_0x42e5('0x3b')](_0x2f1edc[_0x42e5('0x30')],_0x201d9e[_0x42e5('0x32')]),_0x2c53d4);if(_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]){_0x3e2ea5[_0x42e5('0x3d')]=_[_0x42e5('0x3e')](_0x3e2ea5[_0x42e5('0x3d')],{'$or':_['map'](_0x2c53d4,function(_0x260413){if(_0x260413['type']!==_0x42e5('0x3f')){var _0x343363={};_0x343363[_0x260413[_0x42e5('0x26')]]={'$like':'%'+_0x2f1edc[_0x42e5('0x30')][_0x42e5('0x3c')]+'%'};return _0x343363;}})});}_0x3e2ea5=_[_0x42e5('0x3e')]({},_0x3e2ea5,_0x2f1edc[_0x42e5('0x40')]);var _0x5ab9b8={'where':_0x3e2ea5[_0x42e5('0x3d')]};return db[_0x42e5('0x2a')]['count'](_0x5ab9b8)[_0x42e5('0x24')](function(_0x5e8f96){_0x39f763['count']=_0x5e8f96;if(_0x2f1edc['query'][_0x42e5('0x41')]){_0x3e2ea5[_0x42e5('0x42')]=[{'all':!![]}];}return db[_0x42e5('0x2a')][_0x42e5('0x43')](_0x3e2ea5);})[_0x42e5('0x24')](function(_0x77aa22){_0x39f763[_0x42e5('0x44')]=_0x77aa22;return _0x39f763;})['then'](respondWithFilteredResult(_0x59a46b,_0x3e2ea5))[_0x42e5('0x45')](handleError(_0x59a46b,null));};exports[_0x42e5('0x46')]=function(_0x5bec97,_0x398b73){var _0x1c697a={'raw':!![],'where':{'id':_0x5bec97[_0x42e5('0x47')]['id']}},_0x5db771={};_0x5db771[_0x42e5('0x2f')]=_[_0x42e5('0x31')](db[_0x42e5('0x2a')][_0x42e5('0x2b')]);_0x5db771['query']=_[_0x42e5('0x31')](_0x5bec97[_0x42e5('0x30')]);_0x5db771[_0x42e5('0x32')]=_[_0x42e5('0x33')](_0x5db771['model'],_0x5db771[_0x42e5('0x30')]);_0x1c697a[_0x42e5('0x35')]=_[_0x42e5('0x33')](_0x5db771[_0x42e5('0x2f')],qs[_0x42e5('0x34')](_0x5bec97[_0x42e5('0x30')][_0x42e5('0x34')]));_0x1c697a[_0x42e5('0x35')]=_0x1c697a['attributes'][_0x42e5('0x36')]?_0x1c697a['attributes']:_0x5db771['model'];if(_0x5bec97[_0x42e5('0x30')][_0x42e5('0x41')]){_0x1c697a[_0x42e5('0x42')]=[{'all':!![]}];}_0x1c697a=_[_0x42e5('0x3e')]({},_0x1c697a,_0x5bec97[_0x42e5('0x40')]);return db[_0x42e5('0x2a')][_0x42e5('0x48')](_0x1c697a)['then'](handleEntityNotFound(_0x398b73,null))[_0x42e5('0x24')](respondWithResult(_0x398b73,null))[_0x42e5('0x45')](handleError(_0x398b73,null));};exports[_0x42e5('0x49')]=function(_0x21a047,_0x1086b2){return db[_0x42e5('0x2a')][_0x42e5('0x49')](_0x21a047[_0x42e5('0x4a')],{})['then'](respondWithResult(_0x1086b2,0xc9))[_0x42e5('0x45')](handleError(_0x1086b2,null));};exports[_0x42e5('0x4b')]=function(_0x3616f4,_0x48757e){if(_0x3616f4[_0x42e5('0x4a')]['id']){delete _0x3616f4[_0x42e5('0x4a')]['id'];}return db[_0x42e5('0x2a')][_0x42e5('0x48')]({'where':{'id':_0x3616f4[_0x42e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x48757e,null))[_0x42e5('0x24')](saveUpdates(_0x3616f4['body'],null))[_0x42e5('0x24')](respondWithResult(_0x48757e,null))[_0x42e5('0x45')](handleError(_0x48757e,null));};exports[_0x42e5('0x4c')]=function(_0x48b63b,_0x50f59c){return db['FreshdeskField'][_0x42e5('0x48')]({'where':{'id':_0x48b63b[_0x42e5('0x47')]['id']}})[_0x42e5('0x24')](handleEntityNotFound(_0x50f59c,null))[_0x42e5('0x24')](removeEntity(_0x50f59c,null))['catch'](handleError(_0x50f59c,null));}; \ No newline at end of file +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(_0x4bfd95,_0x1c3b3b){var _0x1484cd=function(_0x2c622b){while(--_0x2c622b){_0x4bfd95['push'](_0x4bfd95['shift']());}};_0x1484cd(++_0x1c3b3b);}(_0xde2c,0x7f));var _0xcde2=function(_0xc0d9bc,_0x2bd6be){_0xc0d9bc=_0xc0d9bc-0x0;var _0x32ff73=_0xde2c[_0xc0d9bc];return _0x32ff73;};'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 diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 1330042..4dbadf5 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 _0x92f0=['./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','FieldId','util','../../config/logger','moment','bluebird','rimraf','../../config/environment'];(function(_0x4fdd82,_0x5c8540){var _0x416dbd=function(_0xcf534){while(--_0xcf534){_0x4fdd82['push'](_0x4fdd82['shift']());}};_0x416dbd(++_0x5c8540);}(_0x92f0,0x10d));var _0x092f=function(_0x49c653,_0x390195){_0x49c653=_0x49c653-0x0;var _0x31e169=_0x92f0[_0x49c653];return _0x31e169;};'use strict';var _=require('lodash');var util=require(_0x092f('0x0'));var logger=require(_0x092f('0x1'))('api');var moment=require(_0x092f('0x2'));var BPromise=require(_0x092f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x092f('0x4'));var config=require(_0x092f('0x5'));var attributes=require(_0x092f('0x6'));module[_0x092f('0x7')]=function(_0x2996b0,_0x2b6dcb){return _0x2996b0['define'](_0x092f('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x092f('0x9'),'fields':['idField',_0x092f('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31c2=['path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','FreshdeskField','freshdesk_unique_index','idField','FieldId','lodash','api','moment','request-promise'];(function(_0x3a4d72,_0x55acd6){var _0x4c7866=function(_0x56e4f0){while(--_0x56e4f0){_0x3a4d72['push'](_0x3a4d72['shift']());}};_0x4c7866(++_0x55acd6);}(_0x31c2,0x98));var _0x231c=function(_0x16732e,_0xaae6d8){_0x16732e=_0x16732e-0x0;var _0x4a0745=_0x31c2[_0x16732e];return _0x4a0745;};'use strict';var _=require(_0x231c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x231c('0x1'));var moment=require(_0x231c('0x2'));var BPromise=require('bluebird');var rp=require(_0x231c('0x3'));var fs=require('fs');var path=require(_0x231c('0x4'));var rimraf=require(_0x231c('0x5'));var config=require(_0x231c('0x6'));var attributes=require(_0x231c('0x7'));module[_0x231c('0x8')]=function(_0x21b4df,_0x4442b9){return _0x21b4df['define'](_0x231c('0x9'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x231c('0xa'),'fields':[_0x231c('0xb'),_0x231c('0xc')],'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 6d76e0e..62f0c8c 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 _0x2f79=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x50503f,_0x5cec75){var _0x44264b=function(_0x210e97){while(--_0x210e97){_0x50503f['push'](_0x50503f['shift']());}};_0x44264b(++_0x5cec75);}(_0x2f79,0x103));var _0x92f7=function(_0x5c2311,_0x24ae77){_0x5c2311=_0x5c2311-0x0;var _0x2f0ab2=_0x2f79[_0x5c2311];return _0x2f0ab2;};'use strict';var _=require(_0x92f7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x92f7('0x1'));var rs=require(_0x92f7('0x2'));var fs=require('fs');var Redis=require(_0x92f7('0x3'));var db=require(_0x92f7('0x4'))['db'];var utils=require(_0x92f7('0x5'));var logger=require(_0x92f7('0x6'))(_0x92f7('0x7'));var config=require('../../config/environment');var jayson=require(_0x92f7('0x8'));var client=jayson['client'][_0x92f7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7ff9fb,_0x112f71,_0x5241c1){return new BPromise(function(_0x3b853c,_0x5f2a48){return client[_0x92f7('0xa')](_0x7ff9fb,_0x5241c1)[_0x92f7('0xb')](function(_0x2b2e1b){logger['info'](_0x92f7('0xc'),_0x112f71,_0x92f7('0xd'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x112f71,'request\x20sent',JSON[_0x92f7('0xe')](_0x2b2e1b));if(_0x2b2e1b['error']){if(_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x10')]===0x1f4){logger[_0x92f7('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x112f71,_0x2b2e1b[_0x92f7('0xf')]['message']);return _0x5f2a48(_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x11')]);}logger[_0x92f7('0xf')](_0x92f7('0xc'),_0x112f71,_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x11')]);return _0x3b853c(_0x2b2e1b[_0x92f7('0xf')][_0x92f7('0x11')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x112f71,_0x92f7('0xd'));_0x3b853c(_0x2b2e1b[_0x92f7('0x12')]['message']);}})[_0x92f7('0x13')](function(_0x2eb096){logger[_0x92f7('0xf')](_0x92f7('0xc'),_0x112f71,_0x2eb096);_0x5f2a48(_0x2eb096);});});} \ No newline at end of file +var _0xfe8f=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a3e77,_0x3ca300){var _0x54a676=function(_0x13f12a){while(--_0x13f12a){_0x2a3e77['push'](_0x2a3e77['shift']());}};_0x54a676(++_0x3ca300);}(_0xfe8f,0x100));var _0xffe8=function(_0x2cd206,_0x544b70){_0x2cd206=_0x2cd206-0x0;var _0x135f9b=_0xfe8f[_0x2cd206];return _0x135f9b;};'use strict';var _=require(_0xffe8('0x0'));var util=require(_0xffe8('0x1'));var moment=require('moment');var BPromise=require(_0xffe8('0x2'));var rs=require(_0xffe8('0x3'));var fs=require('fs');var Redis=require(_0xffe8('0x4'));var db=require(_0xffe8('0x5'))['db'];var utils=require(_0xffe8('0x6'));var logger=require(_0xffe8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xffe8('0x8'));var client=jayson[_0xffe8('0x9')][_0xffe8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f25fe,_0x2511e2,_0x4be338){return new BPromise(function(_0x576930,_0x1e6f43){return client[_0xffe8('0xb')](_0x1f25fe,_0x4be338)['then'](function(_0x110ae6){logger[_0xffe8('0xc')](_0xffe8('0xd'),_0x2511e2,_0xffe8('0xe'));logger[_0xffe8('0xf')](_0xffe8('0x10'),_0x2511e2,_0xffe8('0xe'),JSON[_0xffe8('0x11')](_0x110ae6));if(_0x110ae6[_0xffe8('0x12')]){if(_0x110ae6[_0xffe8('0x12')][_0xffe8('0x13')]===0x1f4){logger[_0xffe8('0x12')](_0xffe8('0xd'),_0x2511e2,_0x110ae6[_0xffe8('0x12')]['message']);return _0x1e6f43(_0x110ae6[_0xffe8('0x12')][_0xffe8('0x14')]);}logger[_0xffe8('0x12')](_0xffe8('0xd'),_0x2511e2,_0x110ae6['error']['message']);return _0x576930(_0x110ae6[_0xffe8('0x12')]['message']);}else{logger[_0xffe8('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x2511e2,_0xffe8('0xe'));_0x576930(_0x110ae6[_0xffe8('0x15')][_0xffe8('0x14')]);}})[_0xffe8('0x16')](function(_0x6c5c7d){logger[_0xffe8('0x12')](_0xffe8('0xd'),_0x2511e2,_0x6c5c7d);_0x1e6f43(_0x6c5c7d);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index f4adfdf..50722b7 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 _0x0fd9=['../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x4d2157,_0x201cf1){var _0x172f80=function(_0x587167){while(--_0x587167){_0x4d2157['push'](_0x4d2157['shift']());}};_0x172f80(++_0x201cf1);}(_0x0fd9,0xa3));var _0x90fd=function(_0x30bd4d,_0x50eb60){_0x30bd4d=_0x30bd4d-0x0;var _0x306915=_0x0fd9[_0x30bd4d];return _0x306915;};'use strict';var multer=require('multer');var util=require(_0x90fd('0x0'));var path=require(_0x90fd('0x1'));var timeout=require(_0x90fd('0x2'));var express=require(_0x90fd('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x90fd('0x4'));var interaction=require(_0x90fd('0x5'));var config=require(_0x90fd('0x6'));var controller=require(_0x90fd('0x7'));router[_0x90fd('0x8')]('/',auth[_0x90fd('0x9')](),controller['index']);router['get'](_0x90fd('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x90fd('0x8')](_0x90fd('0xb'),auth['isAuthenticated'](),controller[_0x90fd('0xc')]);router[_0x90fd('0x8')](_0x90fd('0xd'),auth[_0x90fd('0x9')](),controller[_0x90fd('0xe')]);router[_0x90fd('0xf')]('/',auth[_0x90fd('0x9')](),controller[_0x90fd('0x10')]);router[_0x90fd('0xf')]('/:id/configurations',auth[_0x90fd('0x9')](),controller[_0x90fd('0x11')]);router['put'](_0x90fd('0xa'),auth[_0x90fd('0x9')](),controller[_0x90fd('0x12')]);router['delete'](_0x90fd('0xa'),auth['isAuthenticated'](),controller[_0x90fd('0x13')]);module[_0x90fd('0x14')]=router; \ No newline at end of file +var _0x2e54=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','update','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x5bcdd1,_0x30334e){var _0x44e9e0=function(_0x334285){while(--_0x334285){_0x5bcdd1['push'](_0x5bcdd1['shift']());}};_0x44e9e0(++_0x30334e);}(_0x2e54,0x1dd));var _0x42e5=function(_0x24cb7e,_0x50e025){_0x24cb7e=_0x24cb7e-0x0;var _0x540399=_0x2e54[_0x24cb7e];return _0x540399;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./intFreshsalesAccount.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),controller['create']);router[_0x42e5('0x11')](_0x42e5('0xd'),auth['isAuthenticated'](),controller[_0x42e5('0x12')]);router[_0x42e5('0x13')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x14')]);router[_0x42e5('0x15')](_0x42e5('0xb'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x16')]);module[_0x42e5('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index d73149b..acb5594 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 _0xfef3=['sequelize','STRING','username','remoteUri'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xfef3,0x118));var _0x3fef=function(_0x376f18,_0x58c69c){_0x376f18=_0x376f18-0x0;var _0x4cc104=_0xfef3[_0x376f18];return _0x4cc104;};'use strict';var Sequelize=require(_0x3fef('0x0'));module['exports']={'name':{'type':Sequelize[_0x3fef('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3fef('0x1')],'unique':_0x3fef('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x360c92,_0x5ed443){var _0x429495=function(_0x11feaf){while(--_0x11feaf){_0x360c92['push'](_0x360c92['shift']());}};_0x429495(++_0x5ed443);}(_0x32b6,0x1d1));var _0x632b=function(_0x5f0a98,_0x595c7d){_0x5f0a98=_0x5f0a98-0x0;var _0x4b07fe=_0x32b6[_0x5f0a98];return _0x4b07fe;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 80e76a4..99bd72b 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 _0xd29e=['getFields,\x20%s,\x20%s,\x20%s','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','include','options','find','create','update','body','params','FreshsalesConfiguration','rawAttributes','order','getConfigurations','addConfiguration','AccountId','channel','Descriptions','getDescriptions','FreshsalesField','getFields','findOne','username','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','Token\x20token=','users','email','statusCode'];(function(_0x331617,_0x522e81){var _0x22e0fc=function(_0x34790a){while(--_0x34790a){_0x331617['push'](_0x331617['shift']());}};_0x22e0fc(++_0x522e81);}(_0xd29e,0x130));var _0xed29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd29e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xed29('0x0'));var rimraf=require(_0xed29('0x1'));var zipdir=require(_0xed29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xed29('0x3'));var moment=require('moment');var BPromise=require(_0xed29('0x4'));var Mustache=require(_0xed29('0x5'));var util=require(_0xed29('0x6'));var path=require(_0xed29('0x7'));var sox=require(_0xed29('0x8'));var csv=require(_0xed29('0x9'));var ejs=require(_0xed29('0xa'));var fs=require('fs');var fs_extra=require(_0xed29('0xb'));var _=require(_0xed29('0xc'));var squel=require(_0xed29('0xd'));var crypto=require(_0xed29('0xe'));var jsforce=require(_0xed29('0xf'));var deskjs=require(_0xed29('0x10'));var toCsv=require(_0xed29('0x9'));var querystring=require('querystring');var Papa=require(_0xed29('0x11'));var Redis=require('ioredis');var authService=require(_0xed29('0x12'));var qs=require(_0xed29('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xed29('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xed29('0x15'));function respondWithStatusCode(_0x3fa9f7,_0x362342){_0x362342=_0x362342||0xcc;return function(_0x4120c2){if(_0x4120c2){return _0x3fa9f7[_0xed29('0x16')](_0x362342);}return _0x3fa9f7[_0xed29('0x17')](_0x362342)[_0xed29('0x18')]();};}function respondWithResult(_0x26fc26,_0x291b66){_0x291b66=_0x291b66||0xc8;return function(_0xd50c5d){if(_0xd50c5d){return _0x26fc26[_0xed29('0x17')](_0x291b66)['json'](_0xd50c5d);}};}function respondWithFilteredResult(_0x49b15e,_0x416013){return function(_0xa4b70d){if(_0xa4b70d){var _0x2c5e7f=typeof _0x416013[_0xed29('0x19')]===_0xed29('0x1a')&&typeof _0x416013[_0xed29('0x1b')]===_0xed29('0x1a');var _0x48ed18=_0xa4b70d['count'];var _0x7d2d7d=_0x2c5e7f?0x0:_0x416013[_0xed29('0x19')];var _0x8d5978=_0x2c5e7f?_0xa4b70d[_0xed29('0x1c')]:_0x416013[_0xed29('0x19')]+_0x416013[_0xed29('0x1b')];var _0x2b24c4;if(_0x8d5978>=_0x48ed18){_0x8d5978=_0x48ed18;_0x2b24c4=0xc8;}else{_0x2b24c4=0xce;}_0x49b15e[_0xed29('0x17')](_0x2b24c4);return _0x49b15e[_0xed29('0x1d')]('Content-Range',_0x7d2d7d+'-'+_0x8d5978+'/'+_0x48ed18)[_0xed29('0x1e')](_0xa4b70d);}return null;};}function patchUpdates(_0x20ece4){return function(_0x21817d){try{jsonpatch['apply'](_0x21817d,_0x20ece4,!![]);}catch(_0x875b98){return BPromise[_0xed29('0x1f')](_0x875b98);}return _0x21817d[_0xed29('0x20')]();};}function saveUpdates(_0x2a4fc2,_0x5d3c19){return function(_0x32e7cb){if(_0x32e7cb){return _0x32e7cb['update'](_0x2a4fc2)['then'](function(_0x55d840){return _0x55d840;});}return null;};}function removeEntity(_0x40a94a,_0xccefeb){return function(_0x550ef6){if(_0x550ef6){return _0x550ef6[_0xed29('0x21')]()[_0xed29('0x22')](function(){_0x40a94a[_0xed29('0x17')](0xcc)[_0xed29('0x18')]();});}};}function handleEntityNotFound(_0x3a5700,_0x2aec40){return function(_0x5a28cb){if(!_0x5a28cb){_0x3a5700['sendStatus'](0x194);}return _0x5a28cb;};}function handleError(_0x12ad27,_0x386b6d){_0x386b6d=_0x386b6d||0x1f4;return function(_0x216d33){logger[_0xed29('0x23')](_0x216d33[_0xed29('0x24')]);if(_0x216d33['name']){delete _0x216d33[_0xed29('0x25')];}_0x12ad27[_0xed29('0x17')](_0x386b6d)[_0xed29('0x26')](_0x216d33);};}exports[_0xed29('0x27')]=function(_0x1cbe7c,_0x2358df){var _0x1e1ac2={},_0x2a2f48={},_0x243a64={'count':0x0,'rows':[]};var _0xdfa0bd=_[_0xed29('0x28')](db[_0xed29('0x29')]['rawAttributes'],function(_0x4043b0){return{'name':_0x4043b0[_0xed29('0x2a')],'type':_0x4043b0[_0xed29('0x2b')]['key']};});_0x2a2f48[_0xed29('0x2c')]=_[_0xed29('0x28')](_0xdfa0bd,_0xed29('0x25'));_0x2a2f48[_0xed29('0x2d')]=_[_0xed29('0x2e')](_0x1cbe7c['query']);_0x2a2f48[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x2a2f48[_0xed29('0x2c')],_0x2a2f48[_0xed29('0x2d')]);_0x1e1ac2[_0xed29('0x31')]=_['intersection'](_0x2a2f48[_0xed29('0x2c')],qs[_0xed29('0x32')](_0x1cbe7c['query'][_0xed29('0x32')]));_0x1e1ac2[_0xed29('0x31')]=_0x1e1ac2[_0xed29('0x31')][_0xed29('0x33')]?_0x1e1ac2[_0xed29('0x31')]:_0x2a2f48[_0xed29('0x2c')];if(!_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x34')](_0xed29('0x35'))){_0x1e1ac2[_0xed29('0x1b')]=qs[_0xed29('0x1b')](_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x1b')]);_0x1e1ac2['offset']=qs['offset'](_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x19')]);}_0x1e1ac2['order']=qs[_0xed29('0x36')](_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x36')]);_0x1e1ac2[_0xed29('0x37')]=qs[_0xed29('0x2f')](_[_0xed29('0x38')](_0x1cbe7c[_0xed29('0x2d')],_0x2a2f48[_0xed29('0x2f')]),_0xdfa0bd);if(_0x1cbe7c[_0xed29('0x2d')]['filter']){_0x1e1ac2[_0xed29('0x37')]=_[_0xed29('0x39')](_0x1e1ac2[_0xed29('0x37')],{'$or':_[_0xed29('0x28')](_0xdfa0bd,function(_0x56ef1d){if(_0x56ef1d[_0xed29('0x2b')]!==_0xed29('0x3a')){var _0x135ad4={};_0x135ad4[_0x56ef1d[_0xed29('0x25')]]={'$like':'%'+_0x1cbe7c['query'][_0xed29('0x3b')]+'%'};return _0x135ad4;}})});}_0x1e1ac2=_[_0xed29('0x39')]({},_0x1e1ac2,_0x1cbe7c['options']);var _0x5471a0={'where':_0x1e1ac2[_0xed29('0x37')]};return db[_0xed29('0x29')][_0xed29('0x1c')](_0x5471a0)[_0xed29('0x22')](function(_0x583d2c){_0x243a64[_0xed29('0x1c')]=_0x583d2c;if(_0x1cbe7c[_0xed29('0x2d')][_0xed29('0x3c')]){_0x1e1ac2['include']=[{'all':!![]}];}return db[_0xed29('0x29')][_0xed29('0x3d')](_0x1e1ac2);})[_0xed29('0x22')](function(_0x3b7607){_0x243a64[_0xed29('0x3e')]=_0x3b7607;return _0x243a64;})['then'](respondWithFilteredResult(_0x2358df,_0x1e1ac2))[_0xed29('0x3f')](handleError(_0x2358df,null));};exports[_0xed29('0x40')]=function(_0x3b8902,_0x1ef77c){var _0xc42571={'raw':![],'where':{'id':_0x3b8902['params']['id']}},_0x4bc07e={};_0x4bc07e[_0xed29('0x2c')]=_[_0xed29('0x2e')](db['FreshsalesAccount']['rawAttributes']);_0x4bc07e['query']=_[_0xed29('0x2e')](_0x3b8902[_0xed29('0x2d')]);_0x4bc07e[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x4bc07e[_0xed29('0x2c')],_0x4bc07e[_0xed29('0x2d')]);_0xc42571['attributes']=_[_0xed29('0x30')](_0x4bc07e[_0xed29('0x2c')],qs['fields'](_0x3b8902['query'][_0xed29('0x32')]));_0xc42571[_0xed29('0x31')]=_0xc42571[_0xed29('0x31')][_0xed29('0x33')]?_0xc42571[_0xed29('0x31')]:_0x4bc07e[_0xed29('0x2c')];if(_0x3b8902['query'][_0xed29('0x3c')]){_0xc42571[_0xed29('0x41')]=[{'all':!![]}];}_0xc42571=_['merge']({},_0xc42571,_0x3b8902[_0xed29('0x42')]);return db[_0xed29('0x29')][_0xed29('0x43')](_0xc42571)[_0xed29('0x22')](handleEntityNotFound(_0x1ef77c,null))[_0xed29('0x22')](respondWithResult(_0x1ef77c,null))['catch'](handleError(_0x1ef77c,null));};exports[_0xed29('0x44')]=function(_0xe6a2ec,_0x272dac){return db['FreshsalesAccount'][_0xed29('0x44')](_0xe6a2ec['body'],{})['then'](respondWithResult(_0x272dac,0xc9))[_0xed29('0x3f')](handleError(_0x272dac,null));};exports[_0xed29('0x45')]=function(_0x5dca49,_0x1a7680){if(_0x5dca49[_0xed29('0x46')]['id']){delete _0x5dca49[_0xed29('0x46')]['id'];}return db[_0xed29('0x29')][_0xed29('0x43')]({'where':{'id':_0x5dca49[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x1a7680,null))[_0xed29('0x22')](saveUpdates(_0x5dca49['body'],null))[_0xed29('0x22')](respondWithResult(_0x1a7680,null))['catch'](handleError(_0x1a7680,null));};exports[_0xed29('0x21')]=function(_0x4e2873,_0x4f03d3){return db['FreshsalesAccount'][_0xed29('0x43')]({'where':{'id':_0x4e2873[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x4f03d3,null))['then'](removeEntity(_0x4f03d3,null))['catch'](handleError(_0x4f03d3,null));};exports['getConfigurations']=function(_0x2a7e7d,_0x30a52d,_0x5a3965){var _0x36148e={};var _0x4546de={};var _0x472e01;var _0x1b0c6b;return db[_0xed29('0x29')]['findOne']({'where':{'id':_0x2a7e7d[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x30a52d,null))[_0xed29('0x22')](function(_0x52b3ef){if(_0x52b3ef){_0x472e01=_0x52b3ef;_0x4546de['model']=_['keys'](db[_0xed29('0x48')][_0xed29('0x49')]);_0x4546de[_0xed29('0x2d')]=_[_0xed29('0x2e')](_0x2a7e7d['query']);_0x4546de[_0xed29('0x2f')]=_[_0xed29('0x30')](_0x4546de[_0xed29('0x2c')],_0x4546de['query']);_0x36148e[_0xed29('0x31')]=_['intersection'](_0x4546de[_0xed29('0x2c')],qs['fields'](_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x32')]));_0x36148e[_0xed29('0x31')]=_0x36148e[_0xed29('0x31')][_0xed29('0x33')]?_0x36148e[_0xed29('0x31')]:_0x4546de[_0xed29('0x2c')];_0x36148e[_0xed29('0x4a')]=qs[_0xed29('0x36')](_0x2a7e7d['query'][_0xed29('0x36')]);_0x36148e[_0xed29('0x37')]=qs['filters'](_['pick'](_0x2a7e7d[_0xed29('0x2d')],_0x4546de[_0xed29('0x2f')]));if(_0x2a7e7d['query'][_0xed29('0x3b')]){_0x36148e[_0xed29('0x37')]=_['merge'](_0x36148e[_0xed29('0x37')],{'$or':_['map'](_0x36148e[_0xed29('0x31')],function(_0x287434){var _0x130fcb={};_0x130fcb[_0x287434]={'$like':'%'+_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x3b')]+'%'};return _0x130fcb;})});}_0x36148e=_[_0xed29('0x39')]({},_0x36148e,_0x2a7e7d[_0xed29('0x42')]);return _0x472e01[_0xed29('0x4b')](_0x36148e);}})[_0xed29('0x22')](function(_0xb2f9ab){if(_0xb2f9ab){_0x1b0c6b=_0xb2f9ab[_0xed29('0x33')];if(!_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x34')](_0xed29('0x35'))){_0x36148e[_0xed29('0x1b')]=qs[_0xed29('0x1b')](_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x1b')]);_0x36148e[_0xed29('0x19')]=qs[_0xed29('0x19')](_0x2a7e7d[_0xed29('0x2d')][_0xed29('0x19')]);}return _0x472e01[_0xed29('0x4b')](_0x36148e);}})['then'](function(_0x3d8e9b){if(_0x3d8e9b){return _0x3d8e9b?{'count':_0x1b0c6b,'rows':_0x3d8e9b}:null;}})[_0xed29('0x22')](respondWithResult(_0x30a52d,null))[_0xed29('0x3f')](handleError(_0x30a52d,null));};exports[_0xed29('0x4c')]=function(_0x5d88e7,_0x40fb5c,_0x2d5a46){if(_0x5d88e7[_0xed29('0x46')]['id']){delete _0x5d88e7[_0xed29('0x46')]['id'];}return db[_0xed29('0x29')]['findOne']({'where':{'id':_0x5d88e7[_0xed29('0x47')]['id']}})[_0xed29('0x22')](handleEntityNotFound(_0x40fb5c,null))[_0xed29('0x22')](function(_0x50c225){if(_0x50c225){_0x5d88e7[_0xed29('0x46')][_0xed29('0x4d')]=_0x50c225['id'];_0x5d88e7[_0xed29('0x46')]['Subjects']=integrations['getSubjects'](_0x5d88e7[_0xed29('0x46')][_0xed29('0x4e')],_0x5d88e7[_0xed29('0x46')][_0xed29('0x2b')]);_0x5d88e7['body'][_0xed29('0x4f')]=integrations[_0xed29('0x50')](_0x5d88e7[_0xed29('0x46')][_0xed29('0x4e')],_0x5d88e7[_0xed29('0x46')][_0xed29('0x2b')]);return db[_0xed29('0x48')][_0xed29('0x44')](_0x5d88e7[_0xed29('0x46')],{'include':[{'model':db[_0xed29('0x51')],'as':'Subjects'},{'model':db[_0xed29('0x51')],'as':_0xed29('0x4f')}]});}return null;})['then'](respondWithResult(_0x40fb5c,null))[_0xed29('0x3f')](handleError(_0x40fb5c,null));};exports[_0xed29('0x52')]=function(_0x19302f,_0x7e920c,_0x2e0ac6){var _0x5610c7='';var _0x5d3432='';return db[_0xed29('0x29')][_0xed29('0x53')]({'where':{'id':_0x19302f[_0xed29('0x47')]['id']},'attributes':['id',_0xed29('0x54'),_0xed29('0x55'),_0xed29('0x56')]})[_0xed29('0x22')](handleEntityNotFound(_0x7e920c,null))[_0xed29('0x22')](function(_0x36aa96){if(_0x36aa96){_0x5d3432=_0x36aa96[_0xed29('0x54')];_0x5610c7=_0x36aa96[_0xed29('0x55')];var _0x14bba6=_0x36aa96['remoteUri'][_0xed29('0x57')](-0x1);if(_0x14bba6==='/'){_0x5610c7=_0x5610c7[_0xed29('0x58')](0x0,_0x5610c7[_0xed29('0x59')](_0x14bba6));}return rp({'method':_0xed29('0x5a'),'uri':util[_0xed29('0x5b')]('%s%s',_0x5610c7,'/api/selector/owners'),'headers':{'Authorization':_0xed29('0x5c')+_0x36aa96[_0xed29('0x56')]},'json':!![]});}})['then'](function(_0x248a6d){if(_0x248a6d){var _0xc2aaaf=_0x248a6d[_0xed29('0x5d')];var _0x4aa134=![];var _0x57cb54=null;for(_0x57cb54=0x0;_0x57cb54<_0xc2aaaf[_0xed29('0x33')];_0x57cb54++){if(_0xc2aaaf[_0x57cb54][_0xed29('0x5e')]===_0x5d3432){_0x4aa134=!![];}}if(_0x4aa134){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})['then'](respondWithResult(_0x7e920c,null))['catch'](function(_0xf00059){var _0x1b17e4=_0x19302f[_0xed29('0x2d')]['test']?0x1f4:_0xf00059[_0xed29('0x5f')]||0x1f4;logger['error'](_0xed29('0x60'),_0xed29('0x52'),_0x1b17e4,JSON[_0xed29('0x61')](_0xf00059));delete _0xf00059[_0xed29('0x25')];if(_0x1b17e4===0x191){_0x1b17e4=0x190;}_0x7e920c[_0xed29('0x17')](_0x1b17e4)[_0xed29('0x26')](_0x19302f[_0xed29('0x2d')][_0xed29('0x62')]?{'message':_0xed29('0x63'),'statusCode':_0xf00059[_0xed29('0x5f')]}:_0xf00059);});}; \ No newline at end of file +var _0x4361=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','includeAll','create','body','find','params','destroy','findOne','FreshsalesConfiguration','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','username','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../components/integrations/configuration','sendStatus','json','offset','limit','count','status','set','apply','reject','update','then','end','error','stack','name','send','FreshsalesAccount','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0x4361,0x1b5));var _0x1436=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x4361[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x1436('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1436('0x1'));var jsonpatch=require(_0x1436('0x2'));var rp=require('request-promise');var moment=require(_0x1436('0x3'));var BPromise=require(_0x1436('0x4'));var Mustache=require('mustache');var util=require(_0x1436('0x5'));var path=require(_0x1436('0x6'));var sox=require(_0x1436('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1436('0x8'));var _=require('lodash');var squel=require(_0x1436('0x9'));var crypto=require('crypto');var jsforce=require(_0x1436('0xa'));var deskjs=require(_0x1436('0xb'));var toCsv=require(_0x1436('0xc'));var querystring=require(_0x1436('0xd'));var Papa=require('papaparse');var Redis=require(_0x1436('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x1436('0xf'));var as=require(_0x1436('0x10'));var hardwareService=require(_0x1436('0x11'));var logger=require(_0x1436('0x12'))(_0x1436('0x13'));var utils=require('../../config/utils');var config=require(_0x1436('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1436('0x15'));function respondWithStatusCode(_0x528340,_0x175fdd){_0x175fdd=_0x175fdd||0xcc;return function(_0x2678d0){if(_0x2678d0){return _0x528340[_0x1436('0x16')](_0x175fdd);}return _0x528340['status'](_0x175fdd)['end']();};}function respondWithResult(_0x36aa91,_0x566f01){_0x566f01=_0x566f01||0xc8;return function(_0x4f353e){if(_0x4f353e){return _0x36aa91['status'](_0x566f01)[_0x1436('0x17')](_0x4f353e);}};}function respondWithFilteredResult(_0x2c9c74,_0x2e65d8){return function(_0x13df20){if(_0x13df20){var _0x3a55c6=typeof _0x2e65d8[_0x1436('0x18')]==='undefined'&&typeof _0x2e65d8[_0x1436('0x19')]==='undefined';var _0x239629=_0x13df20['count'];var _0x174517=_0x3a55c6?0x0:_0x2e65d8[_0x1436('0x18')];var _0x2bb5e8=_0x3a55c6?_0x13df20[_0x1436('0x1a')]:_0x2e65d8[_0x1436('0x18')]+_0x2e65d8[_0x1436('0x19')];var _0xd860d5;if(_0x2bb5e8>=_0x239629){_0x2bb5e8=_0x239629;_0xd860d5=0xc8;}else{_0xd860d5=0xce;}_0x2c9c74[_0x1436('0x1b')](_0xd860d5);return _0x2c9c74[_0x1436('0x1c')]('Content-Range',_0x174517+'-'+_0x2bb5e8+'/'+_0x239629)[_0x1436('0x17')](_0x13df20);}return null;};}function patchUpdates(_0xde13cd){return function(_0x1bce4b){try{jsonpatch[_0x1436('0x1d')](_0x1bce4b,_0xde13cd,!![]);}catch(_0x1302c7){return BPromise[_0x1436('0x1e')](_0x1302c7);}return _0x1bce4b['save']();};}function saveUpdates(_0xfee1e,_0x2bc6be){return function(_0x2a46d4){if(_0x2a46d4){return _0x2a46d4[_0x1436('0x1f')](_0xfee1e)[_0x1436('0x20')](function(_0x42d8ad){return _0x42d8ad;});}return null;};}function removeEntity(_0x53445c,_0x51f59a){return function(_0x1b52e7){if(_0x1b52e7){return _0x1b52e7['destroy']()[_0x1436('0x20')](function(){_0x53445c[_0x1436('0x1b')](0xcc)[_0x1436('0x21')]();});}};}function handleEntityNotFound(_0x291819,_0x5a4b29){return function(_0xf0e104){if(!_0xf0e104){_0x291819[_0x1436('0x16')](0x194);}return _0xf0e104;};}function handleError(_0x16946e,_0x28b173){_0x28b173=_0x28b173||0x1f4;return function(_0x3a5b6f){logger[_0x1436('0x22')](_0x3a5b6f[_0x1436('0x23')]);if(_0x3a5b6f[_0x1436('0x24')]){delete _0x3a5b6f[_0x1436('0x24')];}_0x16946e[_0x1436('0x1b')](_0x28b173)[_0x1436('0x25')](_0x3a5b6f);};}exports['index']=function(_0x5003ca,_0xf5a2d2){var _0x254ce3={},_0x3214f6={},_0x25a495={'count':0x0,'rows':[]};var _0x2ed8a8=_['map'](db[_0x1436('0x26')][_0x1436('0x27')],function(_0x56b0ed){return{'name':_0x56b0ed[_0x1436('0x28')],'type':_0x56b0ed[_0x1436('0x29')][_0x1436('0x2a')]};});_0x3214f6[_0x1436('0x2b')]=_[_0x1436('0x2c')](_0x2ed8a8,_0x1436('0x24'));_0x3214f6[_0x1436('0x2d')]=_[_0x1436('0x2e')](_0x5003ca[_0x1436('0x2d')]);_0x3214f6[_0x1436('0x2f')]=_[_0x1436('0x30')](_0x3214f6[_0x1436('0x2b')],_0x3214f6[_0x1436('0x2d')]);_0x254ce3[_0x1436('0x31')]=_[_0x1436('0x30')](_0x3214f6[_0x1436('0x2b')],qs[_0x1436('0x32')](_0x5003ca[_0x1436('0x2d')][_0x1436('0x32')]));_0x254ce3[_0x1436('0x31')]=_0x254ce3['attributes'][_0x1436('0x33')]?_0x254ce3['attributes']:_0x3214f6[_0x1436('0x2b')];if(!_0x5003ca[_0x1436('0x2d')][_0x1436('0x34')](_0x1436('0x35'))){_0x254ce3[_0x1436('0x19')]=qs[_0x1436('0x19')](_0x5003ca[_0x1436('0x2d')]['limit']);_0x254ce3['offset']=qs[_0x1436('0x18')](_0x5003ca[_0x1436('0x2d')][_0x1436('0x18')]);}_0x254ce3[_0x1436('0x36')]=qs[_0x1436('0x37')](_0x5003ca['query'][_0x1436('0x37')]);_0x254ce3[_0x1436('0x38')]=qs[_0x1436('0x2f')](_[_0x1436('0x39')](_0x5003ca[_0x1436('0x2d')],_0x3214f6[_0x1436('0x2f')]),_0x2ed8a8);if(_0x5003ca[_0x1436('0x2d')][_0x1436('0x3a')]){_0x254ce3['where']=_[_0x1436('0x3b')](_0x254ce3[_0x1436('0x38')],{'$or':_[_0x1436('0x2c')](_0x2ed8a8,function(_0x4ce6e2){if(_0x4ce6e2['type']!==_0x1436('0x3c')){var _0x43174d={};_0x43174d[_0x4ce6e2[_0x1436('0x24')]]={'$like':'%'+_0x5003ca['query']['filter']+'%'};return _0x43174d;}})});}_0x254ce3=_[_0x1436('0x3b')]({},_0x254ce3,_0x5003ca[_0x1436('0x3d')]);var _0xad5471={'where':_0x254ce3['where']};return db['FreshsalesAccount']['count'](_0xad5471)[_0x1436('0x20')](function(_0x22c3ca){_0x25a495[_0x1436('0x1a')]=_0x22c3ca;if(_0x5003ca[_0x1436('0x2d')]['includeAll']){_0x254ce3['include']=[{'all':!![]}];}return db[_0x1436('0x26')][_0x1436('0x3e')](_0x254ce3);})[_0x1436('0x20')](function(_0x49dee3){_0x25a495[_0x1436('0x3f')]=_0x49dee3;return _0x25a495;})[_0x1436('0x20')](respondWithFilteredResult(_0xf5a2d2,_0x254ce3))[_0x1436('0x40')](handleError(_0xf5a2d2,null));};exports[_0x1436('0x41')]=function(_0x2f443b,_0x86e7a2){var _0x49a86f={'raw':![],'where':{'id':_0x2f443b['params']['id']}},_0x3c97f7={};_0x3c97f7['model']=_[_0x1436('0x2e')](db['FreshsalesAccount'][_0x1436('0x27')]);_0x3c97f7[_0x1436('0x2d')]=_['keys'](_0x2f443b['query']);_0x3c97f7[_0x1436('0x2f')]=_['intersection'](_0x3c97f7[_0x1436('0x2b')],_0x3c97f7['query']);_0x49a86f['attributes']=_[_0x1436('0x30')](_0x3c97f7['model'],qs[_0x1436('0x32')](_0x2f443b[_0x1436('0x2d')][_0x1436('0x32')]));_0x49a86f[_0x1436('0x31')]=_0x49a86f[_0x1436('0x31')][_0x1436('0x33')]?_0x49a86f[_0x1436('0x31')]:_0x3c97f7[_0x1436('0x2b')];if(_0x2f443b['query'][_0x1436('0x42')]){_0x49a86f['include']=[{'all':!![]}];}_0x49a86f=_[_0x1436('0x3b')]({},_0x49a86f,_0x2f443b[_0x1436('0x3d')]);return db[_0x1436('0x26')]['find'](_0x49a86f)[_0x1436('0x20')](handleEntityNotFound(_0x86e7a2,null))['then'](respondWithResult(_0x86e7a2,null))[_0x1436('0x40')](handleError(_0x86e7a2,null));};exports[_0x1436('0x43')]=function(_0x1864de,_0x511ef9){return db[_0x1436('0x26')]['create'](_0x1864de[_0x1436('0x44')],{})['then'](respondWithResult(_0x511ef9,0xc9))[_0x1436('0x40')](handleError(_0x511ef9,null));};exports['update']=function(_0x4ef214,_0x442d46){if(_0x4ef214[_0x1436('0x44')]['id']){delete _0x4ef214['body']['id'];}return db[_0x1436('0x26')][_0x1436('0x45')]({'where':{'id':_0x4ef214[_0x1436('0x46')]['id']}})[_0x1436('0x20')](handleEntityNotFound(_0x442d46,null))[_0x1436('0x20')](saveUpdates(_0x4ef214['body'],null))[_0x1436('0x20')](respondWithResult(_0x442d46,null))[_0x1436('0x40')](handleError(_0x442d46,null));};exports[_0x1436('0x47')]=function(_0x4dc46c,_0xb9ca88){return db[_0x1436('0x26')][_0x1436('0x45')]({'where':{'id':_0x4dc46c[_0x1436('0x46')]['id']}})[_0x1436('0x20')](handleEntityNotFound(_0xb9ca88,null))[_0x1436('0x20')](removeEntity(_0xb9ca88,null))[_0x1436('0x40')](handleError(_0xb9ca88,null));};exports['getConfigurations']=function(_0xbfcd08,_0x2a38c5,_0x12eeec){var _0x446e33={};var _0x25a9a9={};var _0x7e5cb3;var _0x323dbe;return db[_0x1436('0x26')][_0x1436('0x48')]({'where':{'id':_0xbfcd08[_0x1436('0x46')]['id']}})[_0x1436('0x20')](handleEntityNotFound(_0x2a38c5,null))['then'](function(_0x29b761){if(_0x29b761){_0x7e5cb3=_0x29b761;_0x25a9a9[_0x1436('0x2b')]=_[_0x1436('0x2e')](db[_0x1436('0x49')][_0x1436('0x27')]);_0x25a9a9['query']=_['keys'](_0xbfcd08[_0x1436('0x2d')]);_0x25a9a9['filters']=_[_0x1436('0x30')](_0x25a9a9[_0x1436('0x2b')],_0x25a9a9[_0x1436('0x2d')]);_0x446e33[_0x1436('0x31')]=_['intersection'](_0x25a9a9[_0x1436('0x2b')],qs[_0x1436('0x32')](_0xbfcd08[_0x1436('0x2d')][_0x1436('0x32')]));_0x446e33[_0x1436('0x31')]=_0x446e33[_0x1436('0x31')]['length']?_0x446e33['attributes']:_0x25a9a9[_0x1436('0x2b')];_0x446e33[_0x1436('0x36')]=qs[_0x1436('0x37')](_0xbfcd08['query'][_0x1436('0x37')]);_0x446e33[_0x1436('0x38')]=qs[_0x1436('0x2f')](_[_0x1436('0x39')](_0xbfcd08[_0x1436('0x2d')],_0x25a9a9[_0x1436('0x2f')]));if(_0xbfcd08[_0x1436('0x2d')][_0x1436('0x3a')]){_0x446e33[_0x1436('0x38')]=_['merge'](_0x446e33[_0x1436('0x38')],{'$or':_[_0x1436('0x2c')](_0x446e33['attributes'],function(_0x1a1811){var _0x49225a={};_0x49225a[_0x1a1811]={'$like':'%'+_0xbfcd08['query'][_0x1436('0x3a')]+'%'};return _0x49225a;})});}_0x446e33=_[_0x1436('0x3b')]({},_0x446e33,_0xbfcd08['options']);return _0x7e5cb3[_0x1436('0x4a')](_0x446e33);}})['then'](function(_0x5135b3){if(_0x5135b3){_0x323dbe=_0x5135b3[_0x1436('0x33')];if(!_0xbfcd08[_0x1436('0x2d')][_0x1436('0x34')](_0x1436('0x35'))){_0x446e33[_0x1436('0x19')]=qs['limit'](_0xbfcd08[_0x1436('0x2d')][_0x1436('0x19')]);_0x446e33[_0x1436('0x18')]=qs[_0x1436('0x18')](_0xbfcd08['query'][_0x1436('0x18')]);}return _0x7e5cb3[_0x1436('0x4a')](_0x446e33);}})[_0x1436('0x20')](function(_0x235d00){if(_0x235d00){return _0x235d00?{'count':_0x323dbe,'rows':_0x235d00}:null;}})[_0x1436('0x20')](respondWithResult(_0x2a38c5,null))['catch'](handleError(_0x2a38c5,null));};exports['addConfiguration']=function(_0xf6459d,_0x4fd4ca,_0x499a24){if(_0xf6459d[_0x1436('0x44')]['id']){delete _0xf6459d[_0x1436('0x44')]['id'];}return db[_0x1436('0x26')]['findOne']({'where':{'id':_0xf6459d[_0x1436('0x46')]['id']}})[_0x1436('0x20')](handleEntityNotFound(_0x4fd4ca,null))[_0x1436('0x20')](function(_0x1a995e){if(_0x1a995e){_0xf6459d[_0x1436('0x44')][_0x1436('0x4b')]=_0x1a995e['id'];_0xf6459d[_0x1436('0x44')][_0x1436('0x4c')]=integrations[_0x1436('0x4d')](_0xf6459d[_0x1436('0x44')]['channel'],_0xf6459d[_0x1436('0x44')]['type']);_0xf6459d['body'][_0x1436('0x4e')]=integrations[_0x1436('0x4f')](_0xf6459d[_0x1436('0x44')][_0x1436('0x50')],_0xf6459d[_0x1436('0x44')][_0x1436('0x29')]);return db[_0x1436('0x49')]['create'](_0xf6459d[_0x1436('0x44')],{'include':[{'model':db['FreshsalesField'],'as':_0x1436('0x4c')},{'model':db['FreshsalesField'],'as':_0x1436('0x4e')}]});}return null;})[_0x1436('0x20')](respondWithResult(_0x4fd4ca,null))[_0x1436('0x40')](handleError(_0x4fd4ca,null));};exports['getFields']=function(_0x4a49c4,_0xd67dc2,_0x282215){var _0x531449='';var _0x1d1c51='';return db[_0x1436('0x26')][_0x1436('0x48')]({'where':{'id':_0x4a49c4['params']['id']},'attributes':['id',_0x1436('0x51'),'remoteUri','apiKey']})[_0x1436('0x20')](handleEntityNotFound(_0xd67dc2,null))[_0x1436('0x20')](function(_0x298db5){if(_0x298db5){_0x1d1c51=_0x298db5[_0x1436('0x51')];_0x531449=_0x298db5[_0x1436('0x52')];var _0xc21840=_0x298db5[_0x1436('0x52')][_0x1436('0x53')](-0x1);if(_0xc21840==='/'){_0x531449=_0x531449[_0x1436('0x54')](0x0,_0x531449[_0x1436('0x55')](_0xc21840));}return rp({'method':_0x1436('0x56'),'uri':util[_0x1436('0x57')](_0x1436('0x58'),_0x531449,'/api/selector/owners'),'headers':{'Authorization':'Token\x20token='+_0x298db5[_0x1436('0x59')]},'json':!![]});}})['then'](function(_0x49b12a){if(_0x49b12a){var _0x44c267=_0x49b12a[_0x1436('0x5a')];var _0x1440cb=![];var _0x5d71d2=null;for(_0x5d71d2=0x0;_0x5d71d2<_0x44c267[_0x1436('0x33')];_0x5d71d2++){if(_0x44c267[_0x5d71d2][_0x1436('0x5b')]===_0x1d1c51){_0x1440cb=!![];}}if(_0x1440cb){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x1436('0x5c')});}}})[_0x1436('0x20')](respondWithResult(_0xd67dc2,null))[_0x1436('0x40')](function(_0x11f3dd){var _0x511eb7=_0x4a49c4[_0x1436('0x2d')][_0x1436('0x5d')]?0x1f4:_0x11f3dd[_0x1436('0x5e')]||0x1f4;logger[_0x1436('0x22')](_0x1436('0x5f'),'getFields',_0x511eb7,JSON[_0x1436('0x60')](_0x11f3dd));delete _0x11f3dd[_0x1436('0x24')];if(_0x511eb7===0x191){_0x511eb7=0x190;}_0xd67dc2[_0x1436('0x1b')](_0x511eb7)[_0x1436('0x25')](_0x4a49c4[_0x1436('0x2d')]['test']?{'message':_0x1436('0x61'),'statusCode':_0x11f3dd[_0x1436('0x5e')]}:_0x11f3dd);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index a779cc7..c8067df 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 _0x01d9=['bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api'];(function(_0x45ef1c,_0x32686b){var _0x270719=function(_0x257bec){while(--_0x257bec){_0x45ef1c['push'](_0x45ef1c['shift']());}};_0x270719(++_0x32686b);}(_0x01d9,0x6c));var _0x901d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x01d9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));var integrations=require(_0x901d('0xa'));module['exports']=function(_0x1e5d7d,_0x6c9ac8){return _0x1e5d7d[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0424=['./intFreshsalesAccount.attributes','../../components/integrations/configuration','exports','define','FreshsalesAccount','../../config/logger','api','moment','bluebird','path'];(function(_0x5809a4,_0x1e835e){var _0x2b838e=function(_0x3daae4){while(--_0x3daae4){_0x5809a4['push'](_0x5809a4['shift']());}};_0x2b838e(++_0x1e835e);}(_0x0424,0x159));var _0x4042=function(_0x15b380,_0x1a3c5f){_0x15b380=_0x15b380-0x0;var _0x232c5c=_0x0424[_0x15b380];return _0x232c5c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4042('0x0'))(_0x4042('0x1'));var moment=require(_0x4042('0x2'));var BPromise=require(_0x4042('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4042('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4042('0x5'));var integrations=require(_0x4042('0x6'));module[_0x4042('0x7')]=function(_0xc0fba0,_0x3abaf1){return _0xc0fba0[_0x4042('0x8')](_0x4042('0x9'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index c925781..b413223 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 _0x5f66=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetFreshsalesAccount','findAll','options','attributes','limit','include','model','map','ShowFreshsalesAccount','FreshsalesAccount','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x26870d,_0x34c5e2){var _0x3fc281=function(_0x376df3){while(--_0x376df3){_0x26870d['push'](_0x26870d['shift']());}};_0x3fc281(++_0x34c5e2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('FreshsalesAccount,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['FreshsalesAccount'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowFreshsalesAccount',_0x144e55);logger[_0x65f6('0xd')]('ShowFreshsalesAccount',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowFreshsalesAccount',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file +var _0x1a85=['info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','limit','include','model','map','attributes','then','ShowFreshsalesAccount','find','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','http'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0x1a85,0x178));var _0x51a8=function(_0x28e2cd,_0x153b42){_0x28e2cd=_0x28e2cd-0x0;var _0x11fd46=_0x1a85[_0x28e2cd];return _0x11fd46;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x51a8('0x0'));var BPromise=require(_0x51a8('0x1'));var rs=require(_0x51a8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x51a8('0x3'));var logger=require(_0x51a8('0x4'))(_0x51a8('0x5'));var config=require('../../config/environment');var jayson=require(_0x51a8('0x6'));var client=jayson['client'][_0x51a8('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5cf430,_0x331117,_0x16a21e){return new BPromise(function(_0x4f3919,_0x228c64){return client['request'](_0x5cf430,_0x16a21e)['then'](function(_0x39e06a){logger[_0x51a8('0x8')](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));logger[_0x51a8('0xb')](_0x51a8('0xc'),_0x331117,_0x51a8('0xa'),JSON[_0x51a8('0xd')](_0x39e06a));if(_0x39e06a[_0x51a8('0xe')]){if(_0x39e06a[_0x51a8('0xe')][_0x51a8('0xf')]===0x1f4){logger[_0x51a8('0xe')](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x228c64(_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);}logger['error'](_0x51a8('0x9'),_0x331117,_0x39e06a[_0x51a8('0xe')][_0x51a8('0x10')]);return _0x4f3919(_0x39e06a['error'][_0x51a8('0x10')]);}else{logger['info'](_0x51a8('0x9'),_0x331117,_0x51a8('0xa'));_0x4f3919(_0x39e06a[_0x51a8('0x11')][_0x51a8('0x10')]);}})[_0x51a8('0x12')](function(_0x3e0603){logger[_0x51a8('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});}exports[_0x51a8('0x13')]=function(_0x45a433){var _0xd52230=this;return new Promise(function(_0x23539e,_0x3bc1a2){return db[_0x51a8('0x14')]['findAll']({'raw':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x16')]===undefined?!![]:![]:!![],'where':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x17')]||null:null,'attributes':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')]['attributes']||null:null,'limit':_0x45a433[_0x51a8('0x15')]?_0x45a433['options'][_0x51a8('0x18')]||null:null,'include':_0x45a433[_0x51a8('0x15')]?_0x45a433[_0x51a8('0x15')][_0x51a8('0x19')]?_['map'](_0x45a433[_0x51a8('0x15')]['include'],function(_0x47f063){return{'model':db[_0x47f063[_0x51a8('0x1a')]],'as':_0x47f063['as'],'attributes':_0x47f063['attributes'],'include':_0x47f063[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x47f063[_0x51a8('0x19')],function(_0x18e2f3){return{'model':db[_0x18e2f3[_0x51a8('0x1a')]],'as':_0x18e2f3['as'],'attributes':_0x18e2f3[_0x51a8('0x1c')],'include':_0x18e2f3[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x18e2f3['include'],function(_0x273ce2){return{'model':db[_0x273ce2[_0x51a8('0x1a')]],'as':_0x273ce2['as'],'attributes':_0x273ce2[_0x51a8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x1c150d){logger[_0x51a8('0x8')](_0x51a8('0x13'),_0x45a433);logger[_0x51a8('0xb')](_0x51a8('0x13'),_0x45a433,JSON[_0x51a8('0xd')](_0x1c150d));_0x23539e(_0x1c150d);})[_0x51a8('0x12')](function(_0x347a02){logger['error'](_0x51a8('0x13'),_0x347a02['message'],_0x45a433);_0x3bc1a2(_0xd52230[_0x51a8('0xe')](0x1f4,_0x347a02[_0x51a8('0x10')]));});});};exports[_0x51a8('0x1e')]=function(_0x41df56){var _0x2136b4=this;return new Promise(function(_0x4ea271,_0x10c19b){return db['FreshsalesAccount'][_0x51a8('0x1f')]({'raw':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x17')]||null:null,'attributes':_0x41df56[_0x51a8('0x15')]?_0x41df56[_0x51a8('0x15')][_0x51a8('0x1c')]||null:null,'include':_0x41df56[_0x51a8('0x15')]?_0x41df56['options'][_0x51a8('0x19')]?_['map'](_0x41df56[_0x51a8('0x15')][_0x51a8('0x19')],function(_0x41561a){return{'model':db[_0x41561a['model']],'as':_0x41561a['as'],'attributes':_0x41561a[_0x51a8('0x1c')],'include':_0x41561a[_0x51a8('0x19')]?_[_0x51a8('0x1b')](_0x41561a[_0x51a8('0x19')],function(_0x41c020){return{'model':db[_0x41c020['model']],'as':_0x41c020['as'],'attributes':_0x41c020['attributes'],'include':_0x41c020['include']?_[_0x51a8('0x1b')](_0x41c020[_0x51a8('0x19')],function(_0x4ec1db){return{'model':db[_0x4ec1db[_0x51a8('0x1a')]],'as':_0x4ec1db['as'],'attributes':_0x4ec1db['attributes']};}):[]};}):[]};}):[]:[]})[_0x51a8('0x1d')](function(_0x38aa25){logger[_0x51a8('0x8')](_0x51a8('0x1e'),_0x41df56);logger[_0x51a8('0xb')](_0x51a8('0x1e'),_0x41df56,JSON['stringify'](_0x38aa25));_0x4ea271(_0x38aa25);})['catch'](function(_0x377b4c){logger['error']('ShowFreshsalesAccount',_0x377b4c['message'],_0x41df56);_0x10c19b(_0x2136b4[_0x51a8('0xe')](0x1f4,_0x377b4c[_0x51a8('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 7e6152c..6e3a43a 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 _0xcd8d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','getSubjects','getDescriptions','/:id/fields','getFields','create','put','/:id','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcd8d,0x6d));var _0xdcd8=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xcd8d[_0x4154a6];return _0x3b2786;};'use strict';var multer=require(_0xdcd8('0x0'));var util=require('util');var path=require(_0xdcd8('0x1'));var timeout=require('connect-timeout');var express=require(_0xdcd8('0x2'));var router=express[_0xdcd8('0x3')]();var fs_extra=require(_0xdcd8('0x4'));var auth=require(_0xdcd8('0x5'));var interaction=require(_0xdcd8('0x6'));var config=require(_0xdcd8('0x7'));var controller=require('./intFreshsalesConfiguration.controller');router[_0xdcd8('0x8')]('/',auth[_0xdcd8('0x9')](),controller[_0xdcd8('0xa')]);router[_0xdcd8('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xdcd8('0xb')]);router[_0xdcd8('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xdcd8('0xc')]);router[_0xdcd8('0x8')]('/:id/descriptions',auth[_0xdcd8('0x9')](),controller[_0xdcd8('0xd')]);router['get'](_0xdcd8('0xe'),auth[_0xdcd8('0x9')](),controller[_0xdcd8('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdcd8('0x10')]);router[_0xdcd8('0x11')](_0xdcd8('0x12'),auth[_0xdcd8('0x9')](),controller['update']);router[_0xdcd8('0x13')](_0xdcd8('0x12'),auth[_0xdcd8('0x9')](),controller[_0xdcd8('0x14')]);module[_0xdcd8('0x15')]=router; \ No newline at end of file +var _0x4a05=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/subjects','getFields','create','put','update','delete'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4a05,0x1a4));var _0x54a0=function(_0x4498ba,_0xe67e5d){_0x4498ba=_0x4498ba-0x0;var _0x161740=_0x4a05[_0x4498ba];return _0x161740;};'use strict';var multer=require(_0x54a0('0x0'));var util=require(_0x54a0('0x1'));var path=require(_0x54a0('0x2'));var timeout=require(_0x54a0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x54a0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x54a0('0x5'));var config=require(_0x54a0('0x6'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x54a0('0x7')]('/',auth[_0x54a0('0x8')](),controller[_0x54a0('0x9')]);router[_0x54a0('0x7')](_0x54a0('0xa'),auth[_0x54a0('0x8')](),controller['show']);router[_0x54a0('0x7')](_0x54a0('0xb'),auth[_0x54a0('0x8')](),controller['getSubjects']);router[_0x54a0('0x7')]('/:id/descriptions',auth[_0x54a0('0x8')](),controller['getDescriptions']);router[_0x54a0('0x7')]('/:id/fields',auth[_0x54a0('0x8')](),controller[_0x54a0('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x54a0('0xd')]);router[_0x54a0('0xe')](_0x54a0('0xa'),auth[_0x54a0('0x8')](),controller[_0x54a0('0xf')]);router[_0x54a0('0x10')]('/:id',auth[_0x54a0('0x8')](),controller[_0x54a0('0x11')]);module[_0x54a0('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index b283e03..805192a 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 _0x4320=['exports','STRING','sequelize'];(function(_0x815fac,_0x3a4fd7){var _0x2cabb2=function(_0x456bc6){while(--_0x456bc6){_0x815fac['push'](_0x815fac['shift']());}};_0x2cabb2(++_0x3a4fd7);}(_0x4320,0x194));var _0x0432=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x4320[_0x422905];return _0x33dc6c;};'use strict';var Sequelize=require(_0x0432('0x0'));module[_0x0432('0x1')]={'name':{'type':Sequelize[_0x0432('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6847=['STRING','exports'];(function(_0x295a41,_0x3cd317){var _0x27aba1=function(_0x4c95fe){while(--_0x4c95fe){_0x295a41['push'](_0x295a41['shift']());}};_0x27aba1(++_0x3cd317);}(_0x6847,0x171));var _0x7684=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0x6847[_0x324012];return _0x435cf2;};'use strict';var Sequelize=require('sequelize');module[_0x7684('0x0')]={'name':{'type':Sequelize[_0x7684('0x1')]},'description':{'type':Sequelize[_0x7684('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index c395e1b..3d96295 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 _0xe946=['index','map','FreshsalesConfiguration','rawAttributes','type','key','query','keys','intersection','model','fields','attributes','nolimit','order','sort','filters','pick','merge','where','VIRTUAL','filter','includeAll','include','rows','catch','params','length','options','find','create','body','getSubjects','findOne','FreshsalesField','hasOwnProperty','getDescriptions','getFields','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','update','then','destroy','stack','name'];(function(_0x33acb5,_0x1205f6){var _0x4e6e87=function(_0x23d615){while(--_0x23d615){_0x33acb5['push'](_0x33acb5['shift']());}};_0x4e6e87(++_0x1205f6);}(_0xe946,0x18d));var _0x6e94=function(_0x501add,_0x32692a){_0x501add=_0x501add-0x0;var _0x33cfae=_0xe946[_0x501add];return _0x33cfae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6e94('0x0'));var zipdir=require(_0x6e94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e94('0x2'));var moment=require(_0x6e94('0x3'));var BPromise=require(_0x6e94('0x4'));var Mustache=require(_0x6e94('0x5'));var util=require('util');var path=require(_0x6e94('0x6'));var sox=require('sox');var csv=require(_0x6e94('0x7'));var ejs=require(_0x6e94('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6e94('0x9'));var squel=require(_0x6e94('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6e94('0xb'));var Papa=require(_0x6e94('0xc'));var Redis=require(_0x6e94('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6e94('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6e94('0xf'))('api');var utils=require(_0x6e94('0x10'));var config=require(_0x6e94('0x11'));var licenseUtil=require(_0x6e94('0x12'));var db=require(_0x6e94('0x13'))['db'];function respondWithStatusCode(_0x16d4c5,_0x1286a6){_0x1286a6=_0x1286a6||0xcc;return function(_0x198225){if(_0x198225){return _0x16d4c5[_0x6e94('0x14')](_0x1286a6);}return _0x16d4c5[_0x6e94('0x15')](_0x1286a6)[_0x6e94('0x16')]();};}function respondWithResult(_0x3a8bc5,_0x2155cc){_0x2155cc=_0x2155cc||0xc8;return function(_0x3f4318){if(_0x3f4318){return _0x3a8bc5[_0x6e94('0x15')](_0x2155cc)[_0x6e94('0x17')](_0x3f4318);}};}function respondWithFilteredResult(_0x4e993c,_0x1862f2){return function(_0x2b7973){if(_0x2b7973){var _0x3ee6e0=typeof _0x1862f2['offset']==='undefined'&&typeof _0x1862f2['limit']==='undefined';var _0x2eea2b=_0x2b7973['count'];var _0x5d79fc=_0x3ee6e0?0x0:_0x1862f2[_0x6e94('0x18')];var _0x43b65c=_0x3ee6e0?_0x2b7973[_0x6e94('0x19')]:_0x1862f2[_0x6e94('0x18')]+_0x1862f2[_0x6e94('0x1a')];var _0x326922;if(_0x43b65c>=_0x2eea2b){_0x43b65c=_0x2eea2b;_0x326922=0xc8;}else{_0x326922=0xce;}_0x4e993c[_0x6e94('0x15')](_0x326922);return _0x4e993c[_0x6e94('0x1b')](_0x6e94('0x1c'),_0x5d79fc+'-'+_0x43b65c+'/'+_0x2eea2b)[_0x6e94('0x17')](_0x2b7973);}return null;};}function patchUpdates(_0x2e3f94){return function(_0x3ab1b5){try{jsonpatch[_0x6e94('0x1d')](_0x3ab1b5,_0x2e3f94,!![]);}catch(_0x1c7dfe){return BPromise['reject'](_0x1c7dfe);}return _0x3ab1b5['save']();};}function saveUpdates(_0x3530e9,_0x5be11a){return function(_0x3cc0a0){if(_0x3cc0a0){return _0x3cc0a0[_0x6e94('0x1e')](_0x3530e9)[_0x6e94('0x1f')](function(_0x2a4dbe){return _0x2a4dbe;});}return null;};}function removeEntity(_0x2a399b,_0x406786){return function(_0x218a5d){if(_0x218a5d){return _0x218a5d[_0x6e94('0x20')]()[_0x6e94('0x1f')](function(){_0x2a399b[_0x6e94('0x15')](0xcc)[_0x6e94('0x16')]();});}};}function handleEntityNotFound(_0x8bb2c7,_0x4ff2e7){return function(_0x2f882f){if(!_0x2f882f){_0x8bb2c7[_0x6e94('0x14')](0x194);}return _0x2f882f;};}function handleError(_0xd29526,_0x16f9ee){_0x16f9ee=_0x16f9ee||0x1f4;return function(_0x122cf8){logger['error'](_0x122cf8[_0x6e94('0x21')]);if(_0x122cf8[_0x6e94('0x22')]){delete _0x122cf8[_0x6e94('0x22')];}_0xd29526[_0x6e94('0x15')](_0x16f9ee)['send'](_0x122cf8);};}exports[_0x6e94('0x23')]=function(_0x27e6da,_0x38b12d){var _0x1cbde5={},_0x1e6776={},_0x3cac79={'count':0x0,'rows':[]};var _0x416cc5=_[_0x6e94('0x24')](db[_0x6e94('0x25')][_0x6e94('0x26')],function(_0x2c4d42){return{'name':_0x2c4d42['fieldName'],'type':_0x2c4d42[_0x6e94('0x27')][_0x6e94('0x28')]};});_0x1e6776['model']=_[_0x6e94('0x24')](_0x416cc5,'name');_0x1e6776[_0x6e94('0x29')]=_[_0x6e94('0x2a')](_0x27e6da[_0x6e94('0x29')]);_0x1e6776['filters']=_[_0x6e94('0x2b')](_0x1e6776[_0x6e94('0x2c')],_0x1e6776['query']);_0x1cbde5['attributes']=_[_0x6e94('0x2b')](_0x1e6776[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x2d')]));_0x1cbde5[_0x6e94('0x2e')]=_0x1cbde5[_0x6e94('0x2e')]['length']?_0x1cbde5[_0x6e94('0x2e')]:_0x1e6776[_0x6e94('0x2c')];if(!_0x27e6da['query']['hasOwnProperty'](_0x6e94('0x2f'))){_0x1cbde5[_0x6e94('0x1a')]=qs[_0x6e94('0x1a')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x1a')]);_0x1cbde5[_0x6e94('0x18')]=qs[_0x6e94('0x18')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x18')]);}_0x1cbde5[_0x6e94('0x30')]=qs[_0x6e94('0x31')](_0x27e6da[_0x6e94('0x29')][_0x6e94('0x31')]);_0x1cbde5['where']=qs[_0x6e94('0x32')](_[_0x6e94('0x33')](_0x27e6da[_0x6e94('0x29')],_0x1e6776[_0x6e94('0x32')]),_0x416cc5);if(_0x27e6da['query']['filter']){_0x1cbde5['where']=_[_0x6e94('0x34')](_0x1cbde5[_0x6e94('0x35')],{'$or':_[_0x6e94('0x24')](_0x416cc5,function(_0x54c288){if(_0x54c288[_0x6e94('0x27')]!==_0x6e94('0x36')){var _0x3b1934={};_0x3b1934[_0x54c288[_0x6e94('0x22')]]={'$like':'%'+_0x27e6da['query'][_0x6e94('0x37')]+'%'};return _0x3b1934;}})});}_0x1cbde5=_['merge']({},_0x1cbde5,_0x27e6da['options']);var _0x3d4167={'where':_0x1cbde5[_0x6e94('0x35')]};return db[_0x6e94('0x25')][_0x6e94('0x19')](_0x3d4167)[_0x6e94('0x1f')](function(_0x4602ba){_0x3cac79[_0x6e94('0x19')]=_0x4602ba;if(_0x27e6da[_0x6e94('0x29')][_0x6e94('0x38')]){_0x1cbde5[_0x6e94('0x39')]=[{'all':!![]}];}return db[_0x6e94('0x25')]['findAll'](_0x1cbde5);})['then'](function(_0x1c1160){_0x3cac79[_0x6e94('0x3a')]=_0x1c1160;return _0x3cac79;})[_0x6e94('0x1f')](respondWithFilteredResult(_0x38b12d,_0x1cbde5))[_0x6e94('0x3b')](handleError(_0x38b12d,null));};exports['show']=function(_0x4aea00,_0x42070e){var _0x4ac7cd={'raw':![],'where':{'id':_0x4aea00[_0x6e94('0x3c')]['id']}},_0x31c717={};_0x31c717[_0x6e94('0x2c')]=_[_0x6e94('0x2a')](db[_0x6e94('0x25')][_0x6e94('0x26')]);_0x31c717['query']=_[_0x6e94('0x2a')](_0x4aea00[_0x6e94('0x29')]);_0x31c717['filters']=_['intersection'](_0x31c717['model'],_0x31c717['query']);_0x4ac7cd[_0x6e94('0x2e')]=_[_0x6e94('0x2b')](_0x31c717[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x4aea00[_0x6e94('0x29')]['fields']));_0x4ac7cd['attributes']=_0x4ac7cd['attributes'][_0x6e94('0x3d')]?_0x4ac7cd['attributes']:_0x31c717[_0x6e94('0x2c')];if(_0x4aea00[_0x6e94('0x29')]['includeAll']){_0x4ac7cd['include']=[{'all':!![]}];}_0x4ac7cd=_[_0x6e94('0x34')]({},_0x4ac7cd,_0x4aea00[_0x6e94('0x3e')]);return db[_0x6e94('0x25')][_0x6e94('0x3f')](_0x4ac7cd)['then'](handleEntityNotFound(_0x42070e,null))['then'](respondWithResult(_0x42070e,null))[_0x6e94('0x3b')](handleError(_0x42070e,null));};exports[_0x6e94('0x40')]=function(_0x1a1006,_0xcd7cab){return db[_0x6e94('0x25')][_0x6e94('0x40')](_0x1a1006[_0x6e94('0x41')],{})[_0x6e94('0x1f')](respondWithResult(_0xcd7cab,0xc9))['catch'](handleError(_0xcd7cab,null));};exports[_0x6e94('0x1e')]=function(_0x3258b5,_0x23234e){if(_0x3258b5[_0x6e94('0x41')]['id']){delete _0x3258b5['body']['id'];}return db[_0x6e94('0x25')][_0x6e94('0x3f')]({'where':{'id':_0x3258b5[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x23234e,null))['then'](saveUpdates(_0x3258b5[_0x6e94('0x41')],null))['then'](respondWithResult(_0x23234e,null))[_0x6e94('0x3b')](handleError(_0x23234e,null));};exports[_0x6e94('0x20')]=function(_0x2a2a7a,_0x5eef56){return db[_0x6e94('0x25')][_0x6e94('0x3f')]({'where':{'id':_0x2a2a7a[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x5eef56,null))[_0x6e94('0x1f')](removeEntity(_0x5eef56,null))[_0x6e94('0x3b')](handleError(_0x5eef56,null));};exports[_0x6e94('0x42')]=function(_0x235938,_0x2717e2,_0xdb0689){var _0x22326e={};var _0x5497d6={};var _0x5b105d;var _0x30de8e;return db[_0x6e94('0x25')][_0x6e94('0x43')]({'where':{'id':_0x235938[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x2717e2,null))[_0x6e94('0x1f')](function(_0x512cc6){if(_0x512cc6){_0x5b105d=_0x512cc6;_0x5497d6[_0x6e94('0x2c')]=_[_0x6e94('0x2a')](db[_0x6e94('0x44')][_0x6e94('0x26')]);_0x5497d6[_0x6e94('0x29')]=_[_0x6e94('0x2a')](_0x235938[_0x6e94('0x29')]);_0x5497d6[_0x6e94('0x32')]=_[_0x6e94('0x2b')](_0x5497d6['model'],_0x5497d6[_0x6e94('0x29')]);_0x22326e['attributes']=_[_0x6e94('0x2b')](_0x5497d6[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x235938[_0x6e94('0x29')]['fields']));_0x22326e[_0x6e94('0x2e')]=_0x22326e[_0x6e94('0x2e')]['length']?_0x22326e[_0x6e94('0x2e')]:_0x5497d6[_0x6e94('0x2c')];_0x22326e[_0x6e94('0x30')]=qs['sort'](_0x235938[_0x6e94('0x29')]['sort']);_0x22326e[_0x6e94('0x35')]=qs[_0x6e94('0x32')](_[_0x6e94('0x33')](_0x235938[_0x6e94('0x29')],_0x5497d6[_0x6e94('0x32')]));if(_0x235938[_0x6e94('0x29')][_0x6e94('0x37')]){_0x22326e[_0x6e94('0x35')]=_[_0x6e94('0x34')](_0x22326e[_0x6e94('0x35')],{'$or':_[_0x6e94('0x24')](_0x22326e[_0x6e94('0x2e')],function(_0x365cf3){var _0x165ca9={};_0x165ca9[_0x365cf3]={'$like':'%'+_0x235938[_0x6e94('0x29')]['filter']+'%'};return _0x165ca9;})});}_0x22326e=_[_0x6e94('0x34')]({},_0x22326e,_0x235938[_0x6e94('0x3e')]);return _0x5b105d[_0x6e94('0x42')](_0x22326e);}})[_0x6e94('0x1f')](function(_0x41e5c4){if(_0x41e5c4){_0x30de8e=_0x41e5c4[_0x6e94('0x3d')];if(!_0x235938[_0x6e94('0x29')][_0x6e94('0x45')](_0x6e94('0x2f'))){_0x22326e[_0x6e94('0x1a')]=qs[_0x6e94('0x1a')](_0x235938['query'][_0x6e94('0x1a')]);_0x22326e[_0x6e94('0x18')]=qs['offset'](_0x235938[_0x6e94('0x29')][_0x6e94('0x18')]);}return _0x5b105d[_0x6e94('0x42')](_0x22326e);}})['then'](function(_0x7f3d3b){if(_0x7f3d3b){return _0x7f3d3b?{'count':_0x30de8e,'rows':_0x7f3d3b}:null;}})[_0x6e94('0x1f')](respondWithResult(_0x2717e2,null))[_0x6e94('0x3b')](handleError(_0x2717e2,null));};exports[_0x6e94('0x46')]=function(_0xff7b48,_0x54320e,_0x482ca4){var _0x2f9e55={};var _0x4ae684={};var _0x5f4319;var _0x2ef526;return db[_0x6e94('0x25')]['findOne']({'where':{'id':_0xff7b48[_0x6e94('0x3c')]['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x54320e,null))[_0x6e94('0x1f')](function(_0x55d1ce){if(_0x55d1ce){_0x5f4319=_0x55d1ce;_0x4ae684[_0x6e94('0x2c')]=_[_0x6e94('0x2a')](db[_0x6e94('0x44')][_0x6e94('0x26')]);_0x4ae684['query']=_['keys'](_0xff7b48[_0x6e94('0x29')]);_0x4ae684[_0x6e94('0x32')]=_[_0x6e94('0x2b')](_0x4ae684[_0x6e94('0x2c')],_0x4ae684['query']);_0x2f9e55[_0x6e94('0x2e')]=_[_0x6e94('0x2b')](_0x4ae684[_0x6e94('0x2c')],qs['fields'](_0xff7b48['query'][_0x6e94('0x2d')]));_0x2f9e55[_0x6e94('0x2e')]=_0x2f9e55[_0x6e94('0x2e')]['length']?_0x2f9e55[_0x6e94('0x2e')]:_0x4ae684['model'];_0x2f9e55['order']=qs[_0x6e94('0x31')](_0xff7b48[_0x6e94('0x29')]['sort']);_0x2f9e55[_0x6e94('0x35')]=qs[_0x6e94('0x32')](_[_0x6e94('0x33')](_0xff7b48[_0x6e94('0x29')],_0x4ae684[_0x6e94('0x32')]));if(_0xff7b48[_0x6e94('0x29')][_0x6e94('0x37')]){_0x2f9e55[_0x6e94('0x35')]=_[_0x6e94('0x34')](_0x2f9e55['where'],{'$or':_['map'](_0x2f9e55[_0x6e94('0x2e')],function(_0x53c4a1){var _0x658205={};_0x658205[_0x53c4a1]={'$like':'%'+_0xff7b48['query']['filter']+'%'};return _0x658205;})});}_0x2f9e55=_[_0x6e94('0x34')]({},_0x2f9e55,_0xff7b48[_0x6e94('0x3e')]);return _0x5f4319[_0x6e94('0x46')](_0x2f9e55);}})['then'](function(_0x5614a6){if(_0x5614a6){_0x2ef526=_0x5614a6[_0x6e94('0x3d')];if(!_0xff7b48['query'][_0x6e94('0x45')](_0x6e94('0x2f'))){_0x2f9e55[_0x6e94('0x1a')]=qs['limit'](_0xff7b48[_0x6e94('0x29')][_0x6e94('0x1a')]);_0x2f9e55[_0x6e94('0x18')]=qs[_0x6e94('0x18')](_0xff7b48[_0x6e94('0x29')][_0x6e94('0x18')]);}return _0x5f4319['getDescriptions'](_0x2f9e55);}})['then'](function(_0x2d5abc){if(_0x2d5abc){return _0x2d5abc?{'count':_0x2ef526,'rows':_0x2d5abc}:null;}})[_0x6e94('0x1f')](respondWithResult(_0x54320e,null))[_0x6e94('0x3b')](handleError(_0x54320e,null));};exports['getFields']=function(_0x44ada8,_0x5e296c,_0x3ea332){var _0x58c2f0={};var _0x7104ce={};var _0x3659b8;var _0x3df065;return db[_0x6e94('0x25')]['findOne']({'where':{'id':_0x44ada8['params']['id']}})[_0x6e94('0x1f')](handleEntityNotFound(_0x5e296c,null))[_0x6e94('0x1f')](function(_0x565f48){if(_0x565f48){_0x3659b8=_0x565f48;_0x7104ce['model']=_[_0x6e94('0x2a')](db[_0x6e94('0x44')][_0x6e94('0x26')]);_0x7104ce[_0x6e94('0x29')]=_['keys'](_0x44ada8[_0x6e94('0x29')]);_0x7104ce[_0x6e94('0x32')]=_[_0x6e94('0x2b')](_0x7104ce[_0x6e94('0x2c')],_0x7104ce[_0x6e94('0x29')]);_0x58c2f0[_0x6e94('0x2e')]=_[_0x6e94('0x2b')](_0x7104ce[_0x6e94('0x2c')],qs[_0x6e94('0x2d')](_0x44ada8[_0x6e94('0x29')][_0x6e94('0x2d')]));_0x58c2f0[_0x6e94('0x2e')]=_0x58c2f0[_0x6e94('0x2e')][_0x6e94('0x3d')]?_0x58c2f0['attributes']:_0x7104ce[_0x6e94('0x2c')];_0x58c2f0[_0x6e94('0x30')]=qs[_0x6e94('0x31')](_0x44ada8[_0x6e94('0x29')][_0x6e94('0x31')]);_0x58c2f0[_0x6e94('0x35')]=qs[_0x6e94('0x32')](_['pick'](_0x44ada8[_0x6e94('0x29')],_0x7104ce[_0x6e94('0x32')]));if(_0x44ada8[_0x6e94('0x29')][_0x6e94('0x37')]){_0x58c2f0[_0x6e94('0x35')]=_['merge'](_0x58c2f0[_0x6e94('0x35')],{'$or':_[_0x6e94('0x24')](_0x58c2f0[_0x6e94('0x2e')],function(_0xfb5b7c){var _0xe8e555={};_0xe8e555[_0xfb5b7c]={'$like':'%'+_0x44ada8[_0x6e94('0x29')]['filter']+'%'};return _0xe8e555;})});}_0x58c2f0=_[_0x6e94('0x34')]({},_0x58c2f0,_0x44ada8[_0x6e94('0x3e')]);return _0x3659b8[_0x6e94('0x47')](_0x58c2f0);}})[_0x6e94('0x1f')](function(_0x47ef1c){if(_0x47ef1c){_0x3df065=_0x47ef1c[_0x6e94('0x3d')];if(!_0x44ada8[_0x6e94('0x29')]['hasOwnProperty'](_0x6e94('0x2f'))){_0x58c2f0[_0x6e94('0x1a')]=qs['limit'](_0x44ada8['query'][_0x6e94('0x1a')]);_0x58c2f0[_0x6e94('0x18')]=qs[_0x6e94('0x18')](_0x44ada8[_0x6e94('0x29')][_0x6e94('0x18')]);}return _0x3659b8['getFields'](_0x58c2f0);}})[_0x6e94('0x1f')](function(_0x402a57){if(_0x402a57){return _0x402a57?{'count':_0x3df065,'rows':_0x402a57}:null;}})[_0x6e94('0x1f')](respondWithResult(_0x5e296c,null))[_0x6e94('0x3b')](handleError(_0x5e296c,null));}; \ No newline at end of file +var _0x5012=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','FreshsalesConfiguration','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','show','rawAttributes','includeAll','find','create','body','getSubjects','FreshsalesField','hasOwnProperty','getDescriptions','findOne','getFields'];(function(_0x2374c9,_0x58d294){var _0x26aed0=function(_0x355b15){while(--_0x355b15){_0x2374c9['push'](_0x2374c9['shift']());}};_0x26aed0(++_0x58d294);}(_0x5012,0x1ec));var _0x2501=function(_0x417baa,_0x3923d0){_0x417baa=_0x417baa-0x0;var _0x42724f=_0x5012[_0x417baa];return _0x42724f;};'use strict';var emlformat=require(_0x2501('0x0'));var rimraf=require(_0x2501('0x1'));var zipdir=require(_0x2501('0x2'));var jsonpatch=require(_0x2501('0x3'));var rp=require(_0x2501('0x4'));var moment=require(_0x2501('0x5'));var BPromise=require(_0x2501('0x6'));var Mustache=require(_0x2501('0x7'));var util=require(_0x2501('0x8'));var path=require(_0x2501('0x9'));var sox=require(_0x2501('0xa'));var csv=require(_0x2501('0xb'));var ejs=require(_0x2501('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2501('0xd'));var crypto=require(_0x2501('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x2501('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2501('0x10'));var Papa=require(_0x2501('0x11'));var Redis=require(_0x2501('0x12'));var authService=require(_0x2501('0x13'));var qs=require(_0x2501('0x14'));var as=require(_0x2501('0x15'));var hardwareService=require(_0x2501('0x16'));var logger=require(_0x2501('0x17'))('api');var utils=require(_0x2501('0x18'));var config=require(_0x2501('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2501('0x1a'))['db'];function respondWithStatusCode(_0x147a13,_0x173fcd){_0x173fcd=_0x173fcd||0xcc;return function(_0x335a6c){if(_0x335a6c){return _0x147a13['sendStatus'](_0x173fcd);}return _0x147a13[_0x2501('0x1b')](_0x173fcd)[_0x2501('0x1c')]();};}function respondWithResult(_0x1f8b07,_0x1f1d91){_0x1f1d91=_0x1f1d91||0xc8;return function(_0x241966){if(_0x241966){return _0x1f8b07['status'](_0x1f1d91)[_0x2501('0x1d')](_0x241966);}};}function respondWithFilteredResult(_0x82e877,_0x174c92){return function(_0x1a3779){if(_0x1a3779){var _0x44a0f9=typeof _0x174c92[_0x2501('0x1e')]===_0x2501('0x1f')&&typeof _0x174c92[_0x2501('0x20')]===_0x2501('0x1f');var _0x325be9=_0x1a3779['count'];var _0xdbdfa6=_0x44a0f9?0x0:_0x174c92[_0x2501('0x1e')];var _0x2c42f6=_0x44a0f9?_0x1a3779[_0x2501('0x21')]:_0x174c92['offset']+_0x174c92[_0x2501('0x20')];var _0x3c0420;if(_0x2c42f6>=_0x325be9){_0x2c42f6=_0x325be9;_0x3c0420=0xc8;}else{_0x3c0420=0xce;}_0x82e877['status'](_0x3c0420);return _0x82e877[_0x2501('0x22')]('Content-Range',_0xdbdfa6+'-'+_0x2c42f6+'/'+_0x325be9)['json'](_0x1a3779);}return null;};}function patchUpdates(_0x389f10){return function(_0x5a663f){try{jsonpatch[_0x2501('0x23')](_0x5a663f,_0x389f10,!![]);}catch(_0x48bb0f){return BPromise[_0x2501('0x24')](_0x48bb0f);}return _0x5a663f[_0x2501('0x25')]();};}function saveUpdates(_0x5e3f07,_0x393744){return function(_0x9d79f2){if(_0x9d79f2){return _0x9d79f2[_0x2501('0x26')](_0x5e3f07)[_0x2501('0x27')](function(_0x1058ad){return _0x1058ad;});}return null;};}function removeEntity(_0x4d0f49,_0x232b77){return function(_0xa85412){if(_0xa85412){return _0xa85412[_0x2501('0x28')]()[_0x2501('0x27')](function(){_0x4d0f49[_0x2501('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fe060,_0x33701e){return function(_0x3ccbed){if(!_0x3ccbed){_0x3fe060[_0x2501('0x29')](0x194);}return _0x3ccbed;};}function handleError(_0x307188,_0x1c364e){_0x1c364e=_0x1c364e||0x1f4;return function(_0x374cef){logger[_0x2501('0x2a')](_0x374cef[_0x2501('0x2b')]);if(_0x374cef[_0x2501('0x2c')]){delete _0x374cef[_0x2501('0x2c')];}_0x307188[_0x2501('0x1b')](_0x1c364e)[_0x2501('0x2d')](_0x374cef);};}exports['index']=function(_0x5c6bd4,_0x8e7786){var _0x3eafc4={},_0x2d533f={},_0x4a9c9c={'count':0x0,'rows':[]};var _0x6a6e4=_[_0x2501('0x2e')](db[_0x2501('0x2f')]['rawAttributes'],function(_0x38cce9){return{'name':_0x38cce9[_0x2501('0x30')],'type':_0x38cce9[_0x2501('0x31')]['key']};});_0x2d533f['model']=_['map'](_0x6a6e4,'name');_0x2d533f['query']=_[_0x2501('0x32')](_0x5c6bd4[_0x2501('0x33')]);_0x2d533f['filters']=_[_0x2501('0x34')](_0x2d533f[_0x2501('0x35')],_0x2d533f['query']);_0x3eafc4[_0x2501('0x36')]=_['intersection'](_0x2d533f[_0x2501('0x35')],qs['fields'](_0x5c6bd4['query'][_0x2501('0x37')]));_0x3eafc4[_0x2501('0x36')]=_0x3eafc4[_0x2501('0x36')][_0x2501('0x38')]?_0x3eafc4['attributes']:_0x2d533f[_0x2501('0x35')];if(!_0x5c6bd4['query']['hasOwnProperty'](_0x2501('0x39'))){_0x3eafc4[_0x2501('0x20')]=qs[_0x2501('0x20')](_0x5c6bd4['query'][_0x2501('0x20')]);_0x3eafc4[_0x2501('0x1e')]=qs[_0x2501('0x1e')](_0x5c6bd4['query'][_0x2501('0x1e')]);}_0x3eafc4[_0x2501('0x3a')]=qs[_0x2501('0x3b')](_0x5c6bd4[_0x2501('0x33')][_0x2501('0x3b')]);_0x3eafc4[_0x2501('0x3c')]=qs[_0x2501('0x3d')](_[_0x2501('0x3e')](_0x5c6bd4[_0x2501('0x33')],_0x2d533f[_0x2501('0x3d')]),_0x6a6e4);if(_0x5c6bd4[_0x2501('0x33')][_0x2501('0x3f')]){_0x3eafc4['where']=_[_0x2501('0x40')](_0x3eafc4['where'],{'$or':_[_0x2501('0x2e')](_0x6a6e4,function(_0x2bdada){if(_0x2bdada[_0x2501('0x31')]!==_0x2501('0x41')){var _0xaa098a={};_0xaa098a[_0x2bdada[_0x2501('0x2c')]]={'$like':'%'+_0x5c6bd4[_0x2501('0x33')]['filter']+'%'};return _0xaa098a;}})});}_0x3eafc4=_[_0x2501('0x40')]({},_0x3eafc4,_0x5c6bd4[_0x2501('0x42')]);var _0x2a6de9={'where':_0x3eafc4[_0x2501('0x3c')]};return db[_0x2501('0x2f')][_0x2501('0x21')](_0x2a6de9)[_0x2501('0x27')](function(_0x344d0c){_0x4a9c9c[_0x2501('0x21')]=_0x344d0c;if(_0x5c6bd4['query']['includeAll']){_0x3eafc4[_0x2501('0x43')]=[{'all':!![]}];}return db[_0x2501('0x2f')][_0x2501('0x44')](_0x3eafc4);})['then'](function(_0x4b126a){_0x4a9c9c['rows']=_0x4b126a;return _0x4a9c9c;})[_0x2501('0x27')](respondWithFilteredResult(_0x8e7786,_0x3eafc4))[_0x2501('0x45')](handleError(_0x8e7786,null));};exports[_0x2501('0x46')]=function(_0x29b3df,_0x5bf96b){var _0x281328={'raw':![],'where':{'id':_0x29b3df['params']['id']}},_0x4b76b1={};_0x4b76b1['model']=_[_0x2501('0x32')](db[_0x2501('0x2f')][_0x2501('0x47')]);_0x4b76b1[_0x2501('0x33')]=_[_0x2501('0x32')](_0x29b3df[_0x2501('0x33')]);_0x4b76b1[_0x2501('0x3d')]=_['intersection'](_0x4b76b1['model'],_0x4b76b1[_0x2501('0x33')]);_0x281328[_0x2501('0x36')]=_[_0x2501('0x34')](_0x4b76b1['model'],qs[_0x2501('0x37')](_0x29b3df[_0x2501('0x33')]['fields']));_0x281328[_0x2501('0x36')]=_0x281328[_0x2501('0x36')][_0x2501('0x38')]?_0x281328[_0x2501('0x36')]:_0x4b76b1[_0x2501('0x35')];if(_0x29b3df['query'][_0x2501('0x48')]){_0x281328[_0x2501('0x43')]=[{'all':!![]}];}_0x281328=_[_0x2501('0x40')]({},_0x281328,_0x29b3df[_0x2501('0x42')]);return db[_0x2501('0x2f')][_0x2501('0x49')](_0x281328)[_0x2501('0x27')](handleEntityNotFound(_0x5bf96b,null))[_0x2501('0x27')](respondWithResult(_0x5bf96b,null))[_0x2501('0x45')](handleError(_0x5bf96b,null));};exports[_0x2501('0x4a')]=function(_0x3f7dc3,_0x58772c){return db[_0x2501('0x2f')][_0x2501('0x4a')](_0x3f7dc3[_0x2501('0x4b')],{})[_0x2501('0x27')](respondWithResult(_0x58772c,0xc9))[_0x2501('0x45')](handleError(_0x58772c,null));};exports[_0x2501('0x26')]=function(_0x249b10,_0x580603){if(_0x249b10[_0x2501('0x4b')]['id']){delete _0x249b10[_0x2501('0x4b')]['id'];}return db[_0x2501('0x2f')][_0x2501('0x49')]({'where':{'id':_0x249b10['params']['id']}})['then'](handleEntityNotFound(_0x580603,null))[_0x2501('0x27')](saveUpdates(_0x249b10['body'],null))[_0x2501('0x27')](respondWithResult(_0x580603,null))[_0x2501('0x45')](handleError(_0x580603,null));};exports['destroy']=function(_0x269643,_0x4a65e2){return db['FreshsalesConfiguration'][_0x2501('0x49')]({'where':{'id':_0x269643['params']['id']}})[_0x2501('0x27')](handleEntityNotFound(_0x4a65e2,null))[_0x2501('0x27')](removeEntity(_0x4a65e2,null))['catch'](handleError(_0x4a65e2,null));};exports[_0x2501('0x4c')]=function(_0x45e6c4,_0x589d51,_0x51093a){var _0xc61fd={};var _0x376215={};var _0x55e8ec;var _0x20a3af;return db[_0x2501('0x2f')]['findOne']({'where':{'id':_0x45e6c4['params']['id']}})[_0x2501('0x27')](handleEntityNotFound(_0x589d51,null))[_0x2501('0x27')](function(_0x563d80){if(_0x563d80){_0x55e8ec=_0x563d80;_0x376215['model']=_[_0x2501('0x32')](db[_0x2501('0x4d')][_0x2501('0x47')]);_0x376215[_0x2501('0x33')]=_[_0x2501('0x32')](_0x45e6c4[_0x2501('0x33')]);_0x376215['filters']=_[_0x2501('0x34')](_0x376215[_0x2501('0x35')],_0x376215[_0x2501('0x33')]);_0xc61fd[_0x2501('0x36')]=_[_0x2501('0x34')](_0x376215[_0x2501('0x35')],qs[_0x2501('0x37')](_0x45e6c4[_0x2501('0x33')][_0x2501('0x37')]));_0xc61fd['attributes']=_0xc61fd['attributes'][_0x2501('0x38')]?_0xc61fd['attributes']:_0x376215[_0x2501('0x35')];_0xc61fd[_0x2501('0x3a')]=qs['sort'](_0x45e6c4[_0x2501('0x33')][_0x2501('0x3b')]);_0xc61fd[_0x2501('0x3c')]=qs['filters'](_[_0x2501('0x3e')](_0x45e6c4[_0x2501('0x33')],_0x376215[_0x2501('0x3d')]));if(_0x45e6c4[_0x2501('0x33')]['filter']){_0xc61fd[_0x2501('0x3c')]=_[_0x2501('0x40')](_0xc61fd['where'],{'$or':_[_0x2501('0x2e')](_0xc61fd[_0x2501('0x36')],function(_0xb7a1bf){var _0x13aad1={};_0x13aad1[_0xb7a1bf]={'$like':'%'+_0x45e6c4[_0x2501('0x33')][_0x2501('0x3f')]+'%'};return _0x13aad1;})});}_0xc61fd=_[_0x2501('0x40')]({},_0xc61fd,_0x45e6c4[_0x2501('0x42')]);return _0x55e8ec[_0x2501('0x4c')](_0xc61fd);}})['then'](function(_0x40119c){if(_0x40119c){_0x20a3af=_0x40119c[_0x2501('0x38')];if(!_0x45e6c4[_0x2501('0x33')][_0x2501('0x4e')]('nolimit')){_0xc61fd[_0x2501('0x20')]=qs['limit'](_0x45e6c4[_0x2501('0x33')]['limit']);_0xc61fd['offset']=qs[_0x2501('0x1e')](_0x45e6c4['query'][_0x2501('0x1e')]);}return _0x55e8ec['getSubjects'](_0xc61fd);}})[_0x2501('0x27')](function(_0xacc064){if(_0xacc064){return _0xacc064?{'count':_0x20a3af,'rows':_0xacc064}:null;}})['then'](respondWithResult(_0x589d51,null))[_0x2501('0x45')](handleError(_0x589d51,null));};exports[_0x2501('0x4f')]=function(_0x367dbc,_0x3c2ab9,_0x50a9eb){var _0x32df94={};var _0x55d672={};var _0x58f02c;var _0x8484ce;return db[_0x2501('0x2f')][_0x2501('0x50')]({'where':{'id':_0x367dbc['params']['id']}})[_0x2501('0x27')](handleEntityNotFound(_0x3c2ab9,null))[_0x2501('0x27')](function(_0x451c54){if(_0x451c54){_0x58f02c=_0x451c54;_0x55d672['model']=_[_0x2501('0x32')](db['FreshsalesField']['rawAttributes']);_0x55d672[_0x2501('0x33')]=_['keys'](_0x367dbc['query']);_0x55d672[_0x2501('0x3d')]=_['intersection'](_0x55d672[_0x2501('0x35')],_0x55d672[_0x2501('0x33')]);_0x32df94['attributes']=_[_0x2501('0x34')](_0x55d672[_0x2501('0x35')],qs['fields'](_0x367dbc[_0x2501('0x33')][_0x2501('0x37')]));_0x32df94['attributes']=_0x32df94[_0x2501('0x36')][_0x2501('0x38')]?_0x32df94[_0x2501('0x36')]:_0x55d672[_0x2501('0x35')];_0x32df94[_0x2501('0x3a')]=qs[_0x2501('0x3b')](_0x367dbc[_0x2501('0x33')]['sort']);_0x32df94[_0x2501('0x3c')]=qs['filters'](_[_0x2501('0x3e')](_0x367dbc[_0x2501('0x33')],_0x55d672[_0x2501('0x3d')]));if(_0x367dbc[_0x2501('0x33')][_0x2501('0x3f')]){_0x32df94[_0x2501('0x3c')]=_[_0x2501('0x40')](_0x32df94[_0x2501('0x3c')],{'$or':_[_0x2501('0x2e')](_0x32df94['attributes'],function(_0x4584f5){var _0x555add={};_0x555add[_0x4584f5]={'$like':'%'+_0x367dbc['query'][_0x2501('0x3f')]+'%'};return _0x555add;})});}_0x32df94=_[_0x2501('0x40')]({},_0x32df94,_0x367dbc[_0x2501('0x42')]);return _0x58f02c[_0x2501('0x4f')](_0x32df94);}})['then'](function(_0x4a6ed2){if(_0x4a6ed2){_0x8484ce=_0x4a6ed2['length'];if(!_0x367dbc['query'][_0x2501('0x4e')](_0x2501('0x39'))){_0x32df94[_0x2501('0x20')]=qs[_0x2501('0x20')](_0x367dbc[_0x2501('0x33')][_0x2501('0x20')]);_0x32df94[_0x2501('0x1e')]=qs[_0x2501('0x1e')](_0x367dbc[_0x2501('0x33')][_0x2501('0x1e')]);}return _0x58f02c['getDescriptions'](_0x32df94);}})[_0x2501('0x27')](function(_0x496cbb){if(_0x496cbb){return _0x496cbb?{'count':_0x8484ce,'rows':_0x496cbb}:null;}})[_0x2501('0x27')](respondWithResult(_0x3c2ab9,null))['catch'](handleError(_0x3c2ab9,null));};exports[_0x2501('0x51')]=function(_0x31a30d,_0x412c99,_0x479406){var _0x349347={};var _0x5a9a1a={};var _0x535ab5;var _0x10c4c6;return db[_0x2501('0x2f')][_0x2501('0x50')]({'where':{'id':_0x31a30d['params']['id']}})[_0x2501('0x27')](handleEntityNotFound(_0x412c99,null))[_0x2501('0x27')](function(_0x17e7d8){if(_0x17e7d8){_0x535ab5=_0x17e7d8;_0x5a9a1a[_0x2501('0x35')]=_[_0x2501('0x32')](db[_0x2501('0x4d')][_0x2501('0x47')]);_0x5a9a1a['query']=_[_0x2501('0x32')](_0x31a30d['query']);_0x5a9a1a[_0x2501('0x3d')]=_[_0x2501('0x34')](_0x5a9a1a[_0x2501('0x35')],_0x5a9a1a[_0x2501('0x33')]);_0x349347[_0x2501('0x36')]=_['intersection'](_0x5a9a1a[_0x2501('0x35')],qs['fields'](_0x31a30d[_0x2501('0x33')][_0x2501('0x37')]));_0x349347[_0x2501('0x36')]=_0x349347[_0x2501('0x36')][_0x2501('0x38')]?_0x349347['attributes']:_0x5a9a1a['model'];_0x349347['order']=qs['sort'](_0x31a30d['query']['sort']);_0x349347[_0x2501('0x3c')]=qs[_0x2501('0x3d')](_[_0x2501('0x3e')](_0x31a30d['query'],_0x5a9a1a[_0x2501('0x3d')]));if(_0x31a30d['query'][_0x2501('0x3f')]){_0x349347['where']=_[_0x2501('0x40')](_0x349347['where'],{'$or':_[_0x2501('0x2e')](_0x349347['attributes'],function(_0x29e833){var _0x455307={};_0x455307[_0x29e833]={'$like':'%'+_0x31a30d[_0x2501('0x33')][_0x2501('0x3f')]+'%'};return _0x455307;})});}_0x349347=_[_0x2501('0x40')]({},_0x349347,_0x31a30d['options']);return _0x535ab5[_0x2501('0x51')](_0x349347);}})[_0x2501('0x27')](function(_0x140097){if(_0x140097){_0x10c4c6=_0x140097['length'];if(!_0x31a30d[_0x2501('0x33')][_0x2501('0x4e')]('nolimit')){_0x349347[_0x2501('0x20')]=qs[_0x2501('0x20')](_0x31a30d[_0x2501('0x33')][_0x2501('0x20')]);_0x349347['offset']=qs[_0x2501('0x1e')](_0x31a30d[_0x2501('0x33')][_0x2501('0x1e')]);}return _0x535ab5['getFields'](_0x349347);}})[_0x2501('0x27')](function(_0x28bc41){if(_0x28bc41){return _0x28bc41?{'count':_0x10c4c6,'rows':_0x28bc41}:null;}})[_0x2501('0x27')](respondWithResult(_0x412c99,null))[_0x2501('0x45')](handleError(_0x412c99,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 5c6a1e4..135e3d4 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 _0x4590=['int_freshsales_configurations','util','../../config/logger','moment','request-promise','../../config/environment','define','FreshsalesConfiguration'];(function(_0x36a469,_0x59d84c){var _0x3347fc=function(_0x3860e7){while(--_0x3860e7){_0x36a469['push'](_0x36a469['shift']());}};_0x3347fc(++_0x59d84c);}(_0x4590,0x1e9));var _0x0459=function(_0x480e55,_0x4162a1){_0x480e55=_0x480e55-0x0;var _0x10cc3e=_0x4590[_0x480e55];return _0x10cc3e;};'use strict';var _=require('lodash');var util=require(_0x0459('0x0'));var logger=require(_0x0459('0x1'))('api');var moment=require(_0x0459('0x2'));var BPromise=require('bluebird');var rp=require(_0x0459('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0459('0x4'));var attributes=require('./intFreshsalesConfiguration.attributes');module['exports']=function(_0x3242ca,_0xdbc37d){return _0x3242ca[_0x0459('0x5')](_0x0459('0x6'),attributes,{'tableName':_0x0459('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf27=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration'];(function(_0x100e15,_0x5c1a4c){var _0x21f1e2=function(_0x16f013){while(--_0x16f013){_0x100e15['push'](_0x100e15['shift']());}};_0x21f1e2(++_0x5c1a4c);}(_0xaf27,0x120));var _0x7af2=function(_0x329905,_0x13c144){_0x329905=_0x329905-0x0;var _0x3aa42=_0xaf27[_0x329905];return _0x3aa42;};'use strict';var _=require('lodash');var util=require(_0x7af2('0x0'));var logger=require(_0x7af2('0x1'))(_0x7af2('0x2'));var moment=require('moment');var BPromise=require(_0x7af2('0x3'));var rp=require(_0x7af2('0x4'));var fs=require('fs');var path=require(_0x7af2('0x5'));var rimraf=require(_0x7af2('0x6'));var config=require(_0x7af2('0x7'));var attributes=require(_0x7af2('0x8'));module[_0x7af2('0x9')]=function(_0xcdc3f2,_0x2a8e10){return _0xcdc3f2[_0x7af2('0xa')](_0x7af2('0xb'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 63cec95..247b3fa 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 _0x4f9b=['request\x20sent','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x4f9b,0x177));var _0xb4f9=function(_0x4f8e71,_0x38be16){_0x4f8e71=_0x4f8e71-0x0;var _0x6ae113=_0x4f9b[_0x4f8e71];return _0x6ae113;};'use strict';var _=require(_0xb4f9('0x0'));var util=require(_0xb4f9('0x1'));var moment=require(_0xb4f9('0x2'));var BPromise=require(_0xb4f9('0x3'));var rs=require(_0xb4f9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb4f9('0x5'));var logger=require('../../config/logger')(_0xb4f9('0x6'));var config=require(_0xb4f9('0x7'));var jayson=require(_0xb4f9('0x8'));var client=jayson[_0xb4f9('0x9')][_0xb4f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2225e1,_0x34c6a8,_0x3c9d4f){return new BPromise(function(_0x65627d,_0x57a16b){return client[_0xb4f9('0xb')](_0x2225e1,_0x3c9d4f)['then'](function(_0x19b0a5){logger[_0xb4f9('0xc')](_0xb4f9('0xd'),_0x34c6a8,'request\x20sent');logger[_0xb4f9('0xe')](_0xb4f9('0xf'),_0x34c6a8,_0xb4f9('0x10'),JSON[_0xb4f9('0x11')](_0x19b0a5));if(_0x19b0a5['error']){if(_0x19b0a5['error'][_0xb4f9('0x12')]===0x1f4){logger[_0xb4f9('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x34c6a8,_0x19b0a5[_0xb4f9('0x13')]['message']);return _0x57a16b(_0x19b0a5[_0xb4f9('0x13')][_0xb4f9('0x14')]);}logger['error'](_0xb4f9('0xd'),_0x34c6a8,_0x19b0a5[_0xb4f9('0x13')][_0xb4f9('0x14')]);return _0x65627d(_0x19b0a5[_0xb4f9('0x13')][_0xb4f9('0x14')]);}else{logger[_0xb4f9('0xc')](_0xb4f9('0xd'),_0x34c6a8,'request\x20sent');_0x65627d(_0x19b0a5[_0xb4f9('0x15')][_0xb4f9('0x14')]);}})[_0xb4f9('0x16')](function(_0x2b4a54){logger[_0xb4f9('0x13')](_0xb4f9('0xd'),_0x34c6a8,_0x2b4a54);_0x57a16b(_0x2b4a54);});});} \ No newline at end of file +var _0x88b1=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util'];(function(_0x2f76ef,_0x3c0de3){var _0x3e4405=function(_0x13620e){while(--_0x13620e){_0x2f76ef['push'](_0x2f76ef['shift']());}};_0x3e4405(++_0x3c0de3);}(_0x88b1,0x132));var _0x188b=function(_0x51ef62,_0x590979){_0x51ef62=_0x51ef62-0x0;var _0x36220e=_0x88b1[_0x51ef62];return _0x36220e;};'use strict';var _=require(_0x188b('0x0'));var util=require(_0x188b('0x1'));var moment=require(_0x188b('0x2'));var BPromise=require(_0x188b('0x3'));var rs=require(_0x188b('0x4'));var fs=require('fs');var Redis=require(_0x188b('0x5'));var db=require(_0x188b('0x6'))['db'];var utils=require(_0x188b('0x7'));var logger=require(_0x188b('0x8'))(_0x188b('0x9'));var config=require(_0x188b('0xa'));var jayson=require(_0x188b('0xb'));var client=jayson['client'][_0x188b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3b22f5,_0x462c7d,_0x1368b4){return new BPromise(function(_0x2d7891,_0x291b27){return client[_0x188b('0xd')](_0x3b22f5,_0x1368b4)[_0x188b('0xe')](function(_0x51d340){logger['info'](_0x188b('0xf'),_0x462c7d,_0x188b('0x10'));logger['debug'](_0x188b('0x11'),_0x462c7d,_0x188b('0x10'),JSON['stringify'](_0x51d340));if(_0x51d340['error']){if(_0x51d340['error'][_0x188b('0x12')]===0x1f4){logger[_0x188b('0x13')](_0x188b('0xf'),_0x462c7d,_0x51d340[_0x188b('0x13')][_0x188b('0x14')]);return _0x291b27(_0x51d340[_0x188b('0x13')][_0x188b('0x14')]);}logger[_0x188b('0x13')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x462c7d,_0x51d340[_0x188b('0x13')][_0x188b('0x14')]);return _0x2d7891(_0x51d340['error'][_0x188b('0x14')]);}else{logger['info'](_0x188b('0xf'),_0x462c7d,_0x188b('0x10'));_0x2d7891(_0x51d340[_0x188b('0x15')][_0x188b('0x14')]);}})['catch'](function(_0x25ff19){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x462c7d,_0x25ff19);_0x291b27(_0x25ff19);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 16008fe..56d5f35 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 _0x8cfd=['post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x8cfd,0xe4));var _0xd8cf=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x8cfd[_0x29d915];return _0x160f86;};'use strict';var multer=require(_0xd8cf('0x0'));var util=require(_0xd8cf('0x1'));var path=require(_0xd8cf('0x2'));var timeout=require(_0xd8cf('0x3'));var express=require(_0xd8cf('0x4'));var router=express[_0xd8cf('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd8cf('0x6'));var interaction=require(_0xd8cf('0x7'));var config=require(_0xd8cf('0x8'));var controller=require(_0xd8cf('0x9'));router[_0xd8cf('0xa')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xc')]);router['get']('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xd')]);router[_0xd8cf('0xe')]('/',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0xf')]);router[_0xd8cf('0x10')]('/:id',auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x11')]);router[_0xd8cf('0x12')](_0xd8cf('0x13'),auth[_0xd8cf('0xb')](),controller[_0xd8cf('0x14')]);module[_0xd8cf('0x15')]=router; \ No newline at end of file +var _0x0c02=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','post','create','put','/:id','exports','util','path','express','Router'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x20c0('0x0'));var path=require(_0x20c0('0x1'));var timeout=require('connect-timeout');var express=require(_0x20c0('0x2'));var router=express[_0x20c0('0x3')]();var fs_extra=require(_0x20c0('0x4'));var auth=require(_0x20c0('0x5'));var interaction=require(_0x20c0('0x6'));var config=require(_0x20c0('0x7'));var controller=require(_0x20c0('0x8'));router[_0x20c0('0x9')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x20c0('0xc')]('/',auth[_0x20c0('0xa')](),controller[_0x20c0('0xd')]);router[_0x20c0('0xe')](_0x20c0('0xf'),auth[_0x20c0('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x20c0('0x10')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 47cf9e3..91789a3 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 _0x5602=['variable','customVariable','keyValue','string','STRING','ENUM','sequelize','exports'];(function(_0x5d60ae,_0x53fa46){var _0x3cbb30=function(_0x162208){while(--_0x162208){_0x5d60ae['push'](_0x5d60ae['shift']());}};_0x3cbb30(++_0x53fa46);}(_0x5602,0x1ce));var _0x2560=function(_0x48bae0,_0x562dc2){_0x48bae0=_0x48bae0-0x0;var _0x10f582=_0x5602[_0x48bae0];return _0x10f582;};'use strict';var Sequelize=require(_0x2560('0x0'));module[_0x2560('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x2560('0x2'),_0x2560('0x3'),_0x2560('0x4'),'picklist'),'defaultValue':_0x2560('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2560('0x6')]},'keyType':{'type':Sequelize[_0x2560('0x7')](_0x2560('0x5'),_0x2560('0x2'),_0x2560('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x2560('0x6')]},'nameField':{'type':Sequelize[_0x2560('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xad1a=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x51f5c8,_0x2aa90d){var _0x30789e=function(_0x3c5640){while(--_0x3c5640){_0x51f5c8['push'](_0x51f5c8['shift']());}};_0x30789e(++_0x2aa90d);}(_0xad1a,0x178));var _0xaad1=function(_0xea9974,_0x20977f){_0xea9974=_0xea9974-0x0;var _0x168433=_0xad1a[_0xea9974];return _0x168433;};'use strict';var Sequelize=require('sequelize');module[_0xaad1('0x0')]={'type':{'type':Sequelize[_0xaad1('0x1')](_0xaad1('0x2'),_0xaad1('0x3'),_0xaad1('0x4'),_0xaad1('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xaad1('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xaad1('0x1')](_0xaad1('0x2'),_0xaad1('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xaad1('0x6')]},'nameField':{'type':Sequelize[_0xaad1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xaad1('0x6')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index cf9f7db..fd8862e 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 _0x42e0=['create','body','find','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','error','stack','name','send','index','FreshsalesField','rawAttributes','fieldName','type','key','map','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys'];(function(_0x44216d,_0x4938a7){var _0xeca523=function(_0x11faf1){while(--_0x11faf1){_0x44216d['push'](_0x44216d['shift']());}};_0xeca523(++_0x4938a7);}(_0x42e0,0x140));var _0x042e=function(_0x24184e,_0x1ed3c8){_0x24184e=_0x24184e-0x0;var _0x558030=_0x42e0[_0x24184e];return _0x558030;};'use strict';var emlformat=require(_0x042e('0x0'));var rimraf=require(_0x042e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x042e('0x2'));var rp=require(_0x042e('0x3'));var moment=require(_0x042e('0x4'));var BPromise=require(_0x042e('0x5'));var Mustache=require(_0x042e('0x6'));var util=require(_0x042e('0x7'));var path=require(_0x042e('0x8'));var sox=require(_0x042e('0x9'));var csv=require(_0x042e('0xa'));var ejs=require(_0x042e('0xb'));var fs=require('fs');var fs_extra=require(_0x042e('0xc'));var _=require(_0x042e('0xd'));var squel=require(_0x042e('0xe'));var crypto=require(_0x042e('0xf'));var jsforce=require(_0x042e('0x10'));var deskjs=require(_0x042e('0x11'));var toCsv=require(_0x042e('0xa'));var querystring=require(_0x042e('0x12'));var Papa=require('papaparse');var Redis=require(_0x042e('0x13'));var authService=require(_0x042e('0x14'));var qs=require(_0x042e('0x15'));var as=require(_0x042e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x042e('0x17'))(_0x042e('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x042e('0x19'));var db=require(_0x042e('0x1a'))['db'];function respondWithStatusCode(_0x4c4686,_0x1fe1a9){_0x1fe1a9=_0x1fe1a9||0xcc;return function(_0x4744db){if(_0x4744db){return _0x4c4686[_0x042e('0x1b')](_0x1fe1a9);}return _0x4c4686['status'](_0x1fe1a9)[_0x042e('0x1c')]();};}function respondWithResult(_0xa32e4f,_0x1807e5){_0x1807e5=_0x1807e5||0xc8;return function(_0x491bec){if(_0x491bec){return _0xa32e4f[_0x042e('0x1d')](_0x1807e5)[_0x042e('0x1e')](_0x491bec);}};}function respondWithFilteredResult(_0x27ea89,_0x4c6808){return function(_0x25c982){if(_0x25c982){var _0x1a1844=typeof _0x4c6808[_0x042e('0x1f')]===_0x042e('0x20')&&typeof _0x4c6808[_0x042e('0x21')]===_0x042e('0x20');var _0x3d7050=_0x25c982['count'];var _0xa6ec0b=_0x1a1844?0x0:_0x4c6808[_0x042e('0x1f')];var _0xe95466=_0x1a1844?_0x25c982[_0x042e('0x22')]:_0x4c6808[_0x042e('0x1f')]+_0x4c6808[_0x042e('0x21')];var _0x125276;if(_0xe95466>=_0x3d7050){_0xe95466=_0x3d7050;_0x125276=0xc8;}else{_0x125276=0xce;}_0x27ea89[_0x042e('0x1d')](_0x125276);return _0x27ea89['set'](_0x042e('0x23'),_0xa6ec0b+'-'+_0xe95466+'/'+_0x3d7050)[_0x042e('0x1e')](_0x25c982);}return null;};}function patchUpdates(_0x19c7cd){return function(_0x39ee61){try{jsonpatch[_0x042e('0x24')](_0x39ee61,_0x19c7cd,!![]);}catch(_0x50a130){return BPromise['reject'](_0x50a130);}return _0x39ee61[_0x042e('0x25')]();};}function saveUpdates(_0x2b25a9,_0x467dcf){return function(_0x40d26e){if(_0x40d26e){return _0x40d26e[_0x042e('0x26')](_0x2b25a9)[_0x042e('0x27')](function(_0x36cd3a){return _0x36cd3a;});}return null;};}function removeEntity(_0xdb6c04,_0x10e98c){return function(_0xe37c4d){if(_0xe37c4d){return _0xe37c4d['destroy']()[_0x042e('0x27')](function(){_0xdb6c04[_0x042e('0x1d')](0xcc)[_0x042e('0x1c')]();});}};}function handleEntityNotFound(_0x4833ab,_0x512c5b){return function(_0xd08c7a){if(!_0xd08c7a){_0x4833ab[_0x042e('0x1b')](0x194);}return _0xd08c7a;};}function handleError(_0xb43687,_0x5422bd){_0x5422bd=_0x5422bd||0x1f4;return function(_0x759ae7){logger[_0x042e('0x28')](_0x759ae7[_0x042e('0x29')]);if(_0x759ae7[_0x042e('0x2a')]){delete _0x759ae7['name'];}_0xb43687[_0x042e('0x1d')](_0x5422bd)[_0x042e('0x2b')](_0x759ae7);};}exports[_0x042e('0x2c')]=function(_0x1c43de,_0x27aca9){var _0x132b3d={},_0x1675b3={},_0xac0e5b={'count':0x0,'rows':[]};var _0x13e5c=_['map'](db[_0x042e('0x2d')][_0x042e('0x2e')],function(_0x3fc9ec){return{'name':_0x3fc9ec[_0x042e('0x2f')],'type':_0x3fc9ec[_0x042e('0x30')][_0x042e('0x31')]};});_0x1675b3['model']=_[_0x042e('0x32')](_0x13e5c,_0x042e('0x2a'));_0x1675b3['query']=_['keys'](_0x1c43de['query']);_0x1675b3['filters']=_[_0x042e('0x33')](_0x1675b3['model'],_0x1675b3[_0x042e('0x34')]);_0x132b3d[_0x042e('0x35')]=_['intersection'](_0x1675b3[_0x042e('0x36')],qs[_0x042e('0x37')](_0x1c43de[_0x042e('0x34')]['fields']));_0x132b3d[_0x042e('0x35')]=_0x132b3d[_0x042e('0x35')][_0x042e('0x38')]?_0x132b3d['attributes']:_0x1675b3[_0x042e('0x36')];if(!_0x1c43de[_0x042e('0x34')][_0x042e('0x39')](_0x042e('0x3a'))){_0x132b3d[_0x042e('0x21')]=qs[_0x042e('0x21')](_0x1c43de[_0x042e('0x34')][_0x042e('0x21')]);_0x132b3d[_0x042e('0x1f')]=qs['offset'](_0x1c43de[_0x042e('0x34')]['offset']);}_0x132b3d[_0x042e('0x3b')]=qs[_0x042e('0x3c')](_0x1c43de[_0x042e('0x34')][_0x042e('0x3c')]);_0x132b3d['where']=qs[_0x042e('0x3d')](_[_0x042e('0x3e')](_0x1c43de['query'],_0x1675b3[_0x042e('0x3d')]),_0x13e5c);if(_0x1c43de['query'][_0x042e('0x3f')]){_0x132b3d['where']=_[_0x042e('0x40')](_0x132b3d[_0x042e('0x41')],{'$or':_['map'](_0x13e5c,function(_0x1db73a){if(_0x1db73a[_0x042e('0x30')]!==_0x042e('0x42')){var _0x1f034d={};_0x1f034d[_0x1db73a[_0x042e('0x2a')]]={'$like':'%'+_0x1c43de[_0x042e('0x34')][_0x042e('0x3f')]+'%'};return _0x1f034d;}})});}_0x132b3d=_[_0x042e('0x40')]({},_0x132b3d,_0x1c43de[_0x042e('0x43')]);var _0x939735={'where':_0x132b3d[_0x042e('0x41')]};return db[_0x042e('0x2d')][_0x042e('0x22')](_0x939735)['then'](function(_0x34b316){_0xac0e5b[_0x042e('0x22')]=_0x34b316;if(_0x1c43de[_0x042e('0x34')][_0x042e('0x44')]){_0x132b3d[_0x042e('0x45')]=[{'all':!![]}];}return db['FreshsalesField'][_0x042e('0x46')](_0x132b3d);})[_0x042e('0x27')](function(_0x1ba1d3){_0xac0e5b[_0x042e('0x47')]=_0x1ba1d3;return _0xac0e5b;})[_0x042e('0x27')](respondWithFilteredResult(_0x27aca9,_0x132b3d))[_0x042e('0x48')](handleError(_0x27aca9,null));};exports['show']=function(_0x4279fc,_0x384ad3){var _0x4bac20={'raw':!![],'where':{'id':_0x4279fc[_0x042e('0x49')]['id']}},_0x39c107={};_0x39c107[_0x042e('0x36')]=_[_0x042e('0x4a')](db[_0x042e('0x2d')][_0x042e('0x2e')]);_0x39c107[_0x042e('0x34')]=_[_0x042e('0x4a')](_0x4279fc[_0x042e('0x34')]);_0x39c107[_0x042e('0x3d')]=_['intersection'](_0x39c107[_0x042e('0x36')],_0x39c107['query']);_0x4bac20[_0x042e('0x35')]=_['intersection'](_0x39c107[_0x042e('0x36')],qs['fields'](_0x4279fc['query'][_0x042e('0x37')]));_0x4bac20[_0x042e('0x35')]=_0x4bac20[_0x042e('0x35')][_0x042e('0x38')]?_0x4bac20[_0x042e('0x35')]:_0x39c107[_0x042e('0x36')];if(_0x4279fc[_0x042e('0x34')][_0x042e('0x44')]){_0x4bac20[_0x042e('0x45')]=[{'all':!![]}];}_0x4bac20=_[_0x042e('0x40')]({},_0x4bac20,_0x4279fc[_0x042e('0x43')]);return db[_0x042e('0x2d')]['find'](_0x4bac20)['then'](handleEntityNotFound(_0x384ad3,null))[_0x042e('0x27')](respondWithResult(_0x384ad3,null))[_0x042e('0x48')](handleError(_0x384ad3,null));};exports[_0x042e('0x4b')]=function(_0x5997b6,_0x2722f9){return db['FreshsalesField'][_0x042e('0x4b')](_0x5997b6[_0x042e('0x4c')],{})[_0x042e('0x27')](respondWithResult(_0x2722f9,0xc9))['catch'](handleError(_0x2722f9,null));};exports[_0x042e('0x26')]=function(_0x2db8f8,_0x3c7501){if(_0x2db8f8[_0x042e('0x4c')]['id']){delete _0x2db8f8['body']['id'];}return db[_0x042e('0x2d')][_0x042e('0x4d')]({'where':{'id':_0x2db8f8[_0x042e('0x49')]['id']}})[_0x042e('0x27')](handleEntityNotFound(_0x3c7501,null))[_0x042e('0x27')](saveUpdates(_0x2db8f8[_0x042e('0x4c')],null))[_0x042e('0x27')](respondWithResult(_0x3c7501,null))[_0x042e('0x48')](handleError(_0x3c7501,null));};exports[_0x042e('0x4e')]=function(_0x54b8e7,_0x53d418){return db['FreshsalesField'][_0x042e('0x4d')]({'where':{'id':_0x54b8e7[_0x042e('0x49')]['id']}})['then'](handleEntityNotFound(_0x53d418,null))['then'](removeEntity(_0x53d418,null))[_0x042e('0x48')](handleError(_0x53d418,null));}; \ No newline at end of file +var _0x6b08=['find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','set','save','update','then','destroy','error','name','map','FreshsalesField','rawAttributes','key','query','keys','filters','model','intersection','fields','attributes','length','limit','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x3157b5,_0x3a1dba){var _0x1a8769=function(_0xe57ba9){while(--_0xe57ba9){_0x3157b5['push'](_0x3157b5['shift']());}};_0x1a8769(++_0x3a1dba);}(_0x6b08,0x13e));var _0x86b0=function(_0x3b68f9,_0x2f14aa){_0x3b68f9=_0x3b68f9-0x0;var _0x28c80e=_0x6b08[_0x3b68f9];return _0x28c80e;};'use strict';var emlformat=require(_0x86b0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x86b0('0x1'));var jsonpatch=require(_0x86b0('0x2'));var rp=require(_0x86b0('0x3'));var moment=require(_0x86b0('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x86b0('0x5'));var path=require(_0x86b0('0x6'));var sox=require(_0x86b0('0x7'));var csv=require(_0x86b0('0x8'));var ejs=require(_0x86b0('0x9'));var fs=require('fs');var fs_extra=require(_0x86b0('0xa'));var _=require(_0x86b0('0xb'));var squel=require(_0x86b0('0xc'));var crypto=require(_0x86b0('0xd'));var jsforce=require(_0x86b0('0xe'));var deskjs=require(_0x86b0('0xf'));var toCsv=require(_0x86b0('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x86b0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x86b0('0x11'));var logger=require('../../config/logger')(_0x86b0('0x12'));var utils=require(_0x86b0('0x13'));var config=require(_0x86b0('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37dbcc,_0x5239e4){_0x5239e4=_0x5239e4||0xcc;return function(_0x281779){if(_0x281779){return _0x37dbcc[_0x86b0('0x15')](_0x5239e4);}return _0x37dbcc[_0x86b0('0x16')](_0x5239e4)[_0x86b0('0x17')]();};}function respondWithResult(_0x7877d6,_0x5a1ea8){_0x5a1ea8=_0x5a1ea8||0xc8;return function(_0x174986){if(_0x174986){return _0x7877d6[_0x86b0('0x16')](_0x5a1ea8)[_0x86b0('0x18')](_0x174986);}};}function respondWithFilteredResult(_0x5d2ab2,_0x39b16c){return function(_0x30fbd9){if(_0x30fbd9){var _0x168532=typeof _0x39b16c[_0x86b0('0x19')]==='undefined'&&typeof _0x39b16c['limit']===_0x86b0('0x1a');var _0xba1004=_0x30fbd9[_0x86b0('0x1b')];var _0x14c5d3=_0x168532?0x0:_0x39b16c[_0x86b0('0x19')];var _0x23b72f=_0x168532?_0x30fbd9[_0x86b0('0x1b')]:_0x39b16c['offset']+_0x39b16c['limit'];var _0x455b75;if(_0x23b72f>=_0xba1004){_0x23b72f=_0xba1004;_0x455b75=0xc8;}else{_0x455b75=0xce;}_0x5d2ab2['status'](_0x455b75);return _0x5d2ab2[_0x86b0('0x1c')]('Content-Range',_0x14c5d3+'-'+_0x23b72f+'/'+_0xba1004)['json'](_0x30fbd9);}return null;};}function patchUpdates(_0x32687a){return function(_0xf03341){try{jsonpatch['apply'](_0xf03341,_0x32687a,!![]);}catch(_0x2c2373){return BPromise['reject'](_0x2c2373);}return _0xf03341[_0x86b0('0x1d')]();};}function saveUpdates(_0x412024,_0x87976f){return function(_0x26c869){if(_0x26c869){return _0x26c869[_0x86b0('0x1e')](_0x412024)[_0x86b0('0x1f')](function(_0x2867c1){return _0x2867c1;});}return null;};}function removeEntity(_0x468d46,_0x62173){return function(_0x3a0b04){if(_0x3a0b04){return _0x3a0b04[_0x86b0('0x20')]()[_0x86b0('0x1f')](function(){_0x468d46[_0x86b0('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x203758,_0x3b5ccf){return function(_0x6f052e){if(!_0x6f052e){_0x203758[_0x86b0('0x15')](0x194);}return _0x6f052e;};}function handleError(_0x32b172,_0x46846d){_0x46846d=_0x46846d||0x1f4;return function(_0xdf6410){logger[_0x86b0('0x21')](_0xdf6410['stack']);if(_0xdf6410[_0x86b0('0x22')]){delete _0xdf6410[_0x86b0('0x22')];}_0x32b172[_0x86b0('0x16')](_0x46846d)['send'](_0xdf6410);};}exports['index']=function(_0x208822,_0x323f2d){var _0x1121d3={},_0x20e873={},_0x1bb115={'count':0x0,'rows':[]};var _0x1b3c2e=_[_0x86b0('0x23')](db[_0x86b0('0x24')][_0x86b0('0x25')],function(_0x4b8b6f){return{'name':_0x4b8b6f['fieldName'],'type':_0x4b8b6f['type'][_0x86b0('0x26')]};});_0x20e873['model']=_[_0x86b0('0x23')](_0x1b3c2e,_0x86b0('0x22'));_0x20e873[_0x86b0('0x27')]=_[_0x86b0('0x28')](_0x208822['query']);_0x20e873[_0x86b0('0x29')]=_['intersection'](_0x20e873[_0x86b0('0x2a')],_0x20e873['query']);_0x1121d3['attributes']=_[_0x86b0('0x2b')](_0x20e873[_0x86b0('0x2a')],qs[_0x86b0('0x2c')](_0x208822[_0x86b0('0x27')]['fields']));_0x1121d3['attributes']=_0x1121d3[_0x86b0('0x2d')][_0x86b0('0x2e')]?_0x1121d3[_0x86b0('0x2d')]:_0x20e873[_0x86b0('0x2a')];if(!_0x208822[_0x86b0('0x27')]['hasOwnProperty']('nolimit')){_0x1121d3['limit']=qs[_0x86b0('0x2f')](_0x208822[_0x86b0('0x27')][_0x86b0('0x2f')]);_0x1121d3['offset']=qs[_0x86b0('0x19')](_0x208822['query']['offset']);}_0x1121d3['order']=qs['sort'](_0x208822['query']['sort']);_0x1121d3['where']=qs[_0x86b0('0x29')](_['pick'](_0x208822[_0x86b0('0x27')],_0x20e873[_0x86b0('0x29')]),_0x1b3c2e);if(_0x208822[_0x86b0('0x27')]['filter']){_0x1121d3[_0x86b0('0x30')]=_[_0x86b0('0x31')](_0x1121d3[_0x86b0('0x30')],{'$or':_[_0x86b0('0x23')](_0x1b3c2e,function(_0xf8f42e){if(_0xf8f42e[_0x86b0('0x32')]!==_0x86b0('0x33')){var _0x3e2434={};_0x3e2434[_0xf8f42e['name']]={'$like':'%'+_0x208822['query']['filter']+'%'};return _0x3e2434;}})});}_0x1121d3=_[_0x86b0('0x31')]({},_0x1121d3,_0x208822[_0x86b0('0x34')]);var _0x585418={'where':_0x1121d3[_0x86b0('0x30')]};return db['FreshsalesField'][_0x86b0('0x1b')](_0x585418)[_0x86b0('0x1f')](function(_0x2cd92b){_0x1bb115[_0x86b0('0x1b')]=_0x2cd92b;if(_0x208822['query'][_0x86b0('0x35')]){_0x1121d3[_0x86b0('0x36')]=[{'all':!![]}];}return db[_0x86b0('0x24')][_0x86b0('0x37')](_0x1121d3);})[_0x86b0('0x1f')](function(_0x5d883e){_0x1bb115[_0x86b0('0x38')]=_0x5d883e;return _0x1bb115;})[_0x86b0('0x1f')](respondWithFilteredResult(_0x323f2d,_0x1121d3))[_0x86b0('0x39')](handleError(_0x323f2d,null));};exports[_0x86b0('0x3a')]=function(_0x162c96,_0x34c794){var _0x4d1a8a={'raw':!![],'where':{'id':_0x162c96[_0x86b0('0x3b')]['id']}},_0x152e7b={};_0x152e7b[_0x86b0('0x2a')]=_[_0x86b0('0x28')](db[_0x86b0('0x24')][_0x86b0('0x25')]);_0x152e7b['query']=_[_0x86b0('0x28')](_0x162c96[_0x86b0('0x27')]);_0x152e7b[_0x86b0('0x29')]=_['intersection'](_0x152e7b[_0x86b0('0x2a')],_0x152e7b[_0x86b0('0x27')]);_0x4d1a8a[_0x86b0('0x2d')]=_[_0x86b0('0x2b')](_0x152e7b['model'],qs[_0x86b0('0x2c')](_0x162c96['query'][_0x86b0('0x2c')]));_0x4d1a8a[_0x86b0('0x2d')]=_0x4d1a8a[_0x86b0('0x2d')][_0x86b0('0x2e')]?_0x4d1a8a[_0x86b0('0x2d')]:_0x152e7b[_0x86b0('0x2a')];if(_0x162c96[_0x86b0('0x27')][_0x86b0('0x35')]){_0x4d1a8a[_0x86b0('0x36')]=[{'all':!![]}];}_0x4d1a8a=_[_0x86b0('0x31')]({},_0x4d1a8a,_0x162c96[_0x86b0('0x34')]);return db[_0x86b0('0x24')][_0x86b0('0x3c')](_0x4d1a8a)[_0x86b0('0x1f')](handleEntityNotFound(_0x34c794,null))[_0x86b0('0x1f')](respondWithResult(_0x34c794,null))[_0x86b0('0x39')](handleError(_0x34c794,null));};exports[_0x86b0('0x3d')]=function(_0x23dc5d,_0xc694ca){return db[_0x86b0('0x24')][_0x86b0('0x3d')](_0x23dc5d[_0x86b0('0x3e')],{})[_0x86b0('0x1f')](respondWithResult(_0xc694ca,0xc9))[_0x86b0('0x39')](handleError(_0xc694ca,null));};exports[_0x86b0('0x1e')]=function(_0xb25cbe,_0x126948){if(_0xb25cbe[_0x86b0('0x3e')]['id']){delete _0xb25cbe[_0x86b0('0x3e')]['id'];}return db[_0x86b0('0x24')][_0x86b0('0x3c')]({'where':{'id':_0xb25cbe[_0x86b0('0x3b')]['id']}})[_0x86b0('0x1f')](handleEntityNotFound(_0x126948,null))[_0x86b0('0x1f')](saveUpdates(_0xb25cbe[_0x86b0('0x3e')],null))[_0x86b0('0x1f')](respondWithResult(_0x126948,null))[_0x86b0('0x39')](handleError(_0x126948,null));};exports['destroy']=function(_0x15b97d,_0x178574){return db[_0x86b0('0x24')][_0x86b0('0x3c')]({'where':{'id':_0x15b97d[_0x86b0('0x3b')]['id']}})[_0x86b0('0x1f')](handleEntityNotFound(_0x178574,null))[_0x86b0('0x1f')](removeEntity(_0x178574,null))['catch'](handleError(_0x178574,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 0cbf605..60c3f14 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 _0x58cc=['idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','FreshsalesField','int_freshsales_fields'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0x58cc,0x7a));var _0xc58c=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x58cc[_0x173d7e];return _0x2220d6;};'use strict';var _=require(_0xc58c('0x0'));var util=require(_0xc58c('0x1'));var logger=require(_0xc58c('0x2'))(_0xc58c('0x3'));var moment=require(_0xc58c('0x4'));var BPromise=require(_0xc58c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc58c('0x6'));var rimraf=require(_0xc58c('0x7'));var config=require(_0xc58c('0x8'));var attributes=require(_0xc58c('0x9'));module[_0xc58c('0xa')]=function(_0x3a0b8b,_0x513202){return _0x3a0b8b['define'](_0xc58c('0xb'),attributes,{'tableName':_0xc58c('0xc'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0xc58c('0xd'),_0xc58c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ed7=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','idField','util','../../config/logger','api','request-promise','path'];(function(_0x3a7abc,_0x5dba4f){var _0x2b732f=function(_0x21c604){while(--_0x21c604){_0x3a7abc['push'](_0x3a7abc['shift']());}};_0x2b732f(++_0x5dba4f);}(_0x8ed7,0x8b));var _0x78ed=function(_0x104506,_0x1677de){_0x104506=_0x104506-0x0;var _0xe969fe=_0x8ed7[_0x104506];return _0xe969fe;};'use strict';var _=require('lodash');var util=require(_0x78ed('0x0'));var logger=require(_0x78ed('0x1'))(_0x78ed('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x78ed('0x3'));var fs=require('fs');var path=require(_0x78ed('0x4'));var rimraf=require(_0x78ed('0x5'));var config=require(_0x78ed('0x6'));var attributes=require(_0x78ed('0x7'));module[_0x78ed('0x8')]=function(_0x3d8efa,_0x42094f){return _0x3d8efa[_0x78ed('0x9')]('FreshsalesField',attributes,{'tableName':_0x78ed('0xa'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x78ed('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index 9efdfaa..9b240ae 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 _0x31f0=['../../config/environment','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5a3f3a,_0x3ae10e){var _0x5a6216=function(_0x1303cd){while(--_0x1303cd){_0x5a3f3a['push'](_0x5a3f3a['shift']());}};_0x5a6216(++_0x3ae10e);}(_0x31f0,0xb7));var _0x031f=function(_0x3cb05f,_0x3af69d){_0x3cb05f=_0x3cb05f-0x0;var _0x382190=_0x31f0[_0x3cb05f];return _0x382190;};'use strict';var _=require(_0x031f('0x0'));var util=require('util');var moment=require(_0x031f('0x1'));var BPromise=require('bluebird');var rs=require(_0x031f('0x2'));var fs=require('fs');var Redis=require(_0x031f('0x3'));var db=require(_0x031f('0x4'))['db'];var utils=require(_0x031f('0x5'));var logger=require('../../config/logger')(_0x031f('0x6'));var config=require(_0x031f('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3dc98e,_0x487e65,_0x365f59){return new BPromise(function(_0x4300b4,_0x2569b6){return client[_0x031f('0x8')](_0x3dc98e,_0x365f59)['then'](function(_0x2e5624){logger[_0x031f('0x9')](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));logger[_0x031f('0xc')](_0x031f('0xd'),_0x487e65,_0x031f('0xb'),JSON[_0x031f('0xe')](_0x2e5624));if(_0x2e5624['error']){if(_0x2e5624[_0x031f('0xf')][_0x031f('0x10')]===0x1f4){logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x2569b6(_0x2e5624[_0x031f('0xf')]['message']);}logger[_0x031f('0xf')](_0x031f('0xa'),_0x487e65,_0x2e5624[_0x031f('0xf')][_0x031f('0x11')]);return _0x4300b4(_0x2e5624[_0x031f('0xf')]['message']);}else{logger['info'](_0x031f('0xa'),_0x487e65,_0x031f('0xb'));_0x4300b4(_0x2e5624[_0x031f('0x12')][_0x031f('0x11')]);}})['catch'](function(_0x1dc4a7){logger[_0x031f('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x487e65,_0x1dc4a7);_0x2569b6(_0x1dc4a7);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x4975,0x86));var _0x5497=function(_0x975f56,_0x59ee6c){_0x975f56=_0x975f56-0x0;var _0x4a608d=_0x4975[_0x975f56];return _0x4a608d;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 5fc1df8..e2217e6 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(_0x15be7b,_0x2afa15){var _0x1d6519=function(_0xf46d3){while(--_0xf46d3){_0x15be7b['push'](_0x15be7b['shift']());}};_0x1d6519(++_0x2afa15);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'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(_0x714257,_0xa6f1bc){var _0x185a4c=function(_0x51798a){while(--_0x51798a){_0x714257['push'](_0x714257['shift']());}};_0x185a4c(++_0xa6f1bc);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'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 169e6a4..4356477 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 _0x5fdc=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5fdc,0x127));var _0xc5fd=function(_0x655ef5,_0x5cc7de){_0x655ef5=_0x655ef5-0x0;var _0x3f1797=_0x5fdc[_0x655ef5];return _0x3f1797;};'use strict';var Sequelize=require(_0xc5fd('0x0'));module[_0xc5fd('0x1')]={'name':{'type':Sequelize[_0xc5fd('0x2')]},'description':{'type':Sequelize[_0xc5fd('0x2')]},'username':{'type':Sequelize[_0xc5fd('0x2')],'unique':_0xc5fd('0x3')},'remoteUri':{'type':Sequelize[_0xc5fd('0x2')]},'password':{'type':Sequelize[_0xc5fd('0x2')]},'clientId':{'type':Sequelize[_0xc5fd('0x2')]},'clientSecret':{'type':Sequelize[_0xc5fd('0x2')]},'securityToken':{'type':Sequelize[_0xc5fd('0x2')]},'serverUrl':{'type':Sequelize[_0xc5fd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xc5fd('0x4')](_0xc5fd('0x5'),_0xc5fd('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x7374=['ENUM','integrationTab','newTab','sequelize','exports','STRING'];(function(_0x936f1f,_0x2eaf2f){var _0xb36ff7=function(_0x4877ac){while(--_0x4877ac){_0x936f1f['push'](_0x936f1f['shift']());}};_0xb36ff7(++_0x2eaf2f);}(_0x7374,0x1b9));var _0x4737=function(_0x509734,_0xd63791){_0x509734=_0x509734-0x0;var _0x47b8e4=_0x7374[_0x509734];return _0x47b8e4;};'use strict';var Sequelize=require(_0x4737('0x0'));module[_0x4737('0x1')]={'name':{'type':Sequelize[_0x4737('0x2')]},'description':{'type':Sequelize[_0x4737('0x2')]},'username':{'type':Sequelize[_0x4737('0x2')],'unique':'username'},'remoteUri':{'type':Sequelize[_0x4737('0x2')]},'password':{'type':Sequelize[_0x4737('0x2')]},'clientId':{'type':Sequelize[_0x4737('0x2')]},'clientSecret':{'type':Sequelize[_0x4737('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4737('0x3')](_0x4737('0x4'),_0x4737('0x5')),'defaultValue':_0x4737('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index e47596f..5d84196 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 _0x4ea2=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','status','json','offset','limit','count','set','apply','reject','save','update','destroy','then','end','error','name','send','index','map','SalesforceAccount','rawAttributes','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','SalesforceField','getFields','Task','remoteUri','username','password','securityToken','substring','lastIndexOf','Connection','clientId','clientSecret','isNil','ticketType','sobject','describe','OwnerId','IsReminderSet','IsRecurrence','Subject','string','int','boolean','email','textarea','phone','remove','custom','picklistValues','label','value','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs'];(function(_0x5a9138,_0x49cf49){var _0x20b4fd=function(_0xc36e22){while(--_0xc36e22){_0x5a9138['push'](_0x5a9138['shift']());}};_0x20b4fd(++_0x49cf49);}(_0x4ea2,0x15a));var _0x24ea=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x4ea2[_0x946518];return _0x909b69;};'use strict';var emlformat=require(_0x24ea('0x0'));var rimraf=require(_0x24ea('0x1'));var zipdir=require(_0x24ea('0x2'));var jsonpatch=require(_0x24ea('0x3'));var rp=require(_0x24ea('0x4'));var moment=require(_0x24ea('0x5'));var BPromise=require(_0x24ea('0x6'));var Mustache=require(_0x24ea('0x7'));var util=require(_0x24ea('0x8'));var path=require(_0x24ea('0x9'));var sox=require('sox');var csv=require(_0x24ea('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x24ea('0xb'));var _=require(_0x24ea('0xc'));var squel=require(_0x24ea('0xd'));var crypto=require(_0x24ea('0xe'));var jsforce=require(_0x24ea('0xf'));var deskjs=require(_0x24ea('0x10'));var toCsv=require(_0x24ea('0xa'));var querystring=require(_0x24ea('0x11'));var Papa=require(_0x24ea('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x24ea('0x13'));var as=require(_0x24ea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x24ea('0x15'))(_0x24ea('0x16'));var utils=require('../../config/utils');var config=require(_0x24ea('0x17'));var licenseUtil=require(_0x24ea('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4b3680,_0x2f96af){_0x2f96af=_0x2f96af||0xcc;return function(_0x2a9085){if(_0x2a9085){return _0x4b3680['sendStatus'](_0x2f96af);}return _0x4b3680[_0x24ea('0x19')](_0x2f96af)['end']();};}function respondWithResult(_0x12ac32,_0x12f7fe){_0x12f7fe=_0x12f7fe||0xc8;return function(_0x38260f){if(_0x38260f){return _0x12ac32['status'](_0x12f7fe)[_0x24ea('0x1a')](_0x38260f);}};}function respondWithFilteredResult(_0x5779bc,_0x17f339){return function(_0x2f3032){if(_0x2f3032){var _0x258dbe=typeof _0x17f339[_0x24ea('0x1b')]==='undefined'&&typeof _0x17f339[_0x24ea('0x1c')]==='undefined';var _0x824dd2=_0x2f3032['count'];var _0x1d26cf=_0x258dbe?0x0:_0x17f339[_0x24ea('0x1b')];var _0x4d55d8=_0x258dbe?_0x2f3032[_0x24ea('0x1d')]:_0x17f339[_0x24ea('0x1b')]+_0x17f339[_0x24ea('0x1c')];var _0x45e68f;if(_0x4d55d8>=_0x824dd2){_0x4d55d8=_0x824dd2;_0x45e68f=0xc8;}else{_0x45e68f=0xce;}_0x5779bc[_0x24ea('0x19')](_0x45e68f);return _0x5779bc[_0x24ea('0x1e')]('Content-Range',_0x1d26cf+'-'+_0x4d55d8+'/'+_0x824dd2)[_0x24ea('0x1a')](_0x2f3032);}return null;};}function patchUpdates(_0x432db1){return function(_0x3796cb){try{jsonpatch[_0x24ea('0x1f')](_0x3796cb,_0x432db1,!![]);}catch(_0x2db3b6){return BPromise[_0x24ea('0x20')](_0x2db3b6);}return _0x3796cb[_0x24ea('0x21')]();};}function saveUpdates(_0x275727,_0x34d0bd){return function(_0x2a622c){if(_0x2a622c){return _0x2a622c[_0x24ea('0x22')](_0x275727)['then'](function(_0x2f1ad1){return _0x2f1ad1;});}return null;};}function removeEntity(_0x11cbf8,_0x3ee9ef){return function(_0x5efdd1){if(_0x5efdd1){return _0x5efdd1[_0x24ea('0x23')]()[_0x24ea('0x24')](function(){_0x11cbf8['status'](0xcc)[_0x24ea('0x25')]();});}};}function handleEntityNotFound(_0x570f3b,_0x3b3884){return function(_0x4eb04d){if(!_0x4eb04d){_0x570f3b['sendStatus'](0x194);}return _0x4eb04d;};}function handleError(_0x55a9b4,_0x5b6719){_0x5b6719=_0x5b6719||0x1f4;return function(_0x55db1a){logger[_0x24ea('0x26')](_0x55db1a['stack']);if(_0x55db1a['name']){delete _0x55db1a[_0x24ea('0x27')];}_0x55a9b4[_0x24ea('0x19')](_0x5b6719)[_0x24ea('0x28')](_0x55db1a);};}exports[_0x24ea('0x29')]=function(_0x1cc979,_0x52dc2d){var _0x45acc4={},_0x235c91={},_0x3efd9e={'count':0x0,'rows':[]};var _0x4a5085=_[_0x24ea('0x2a')](db[_0x24ea('0x2b')][_0x24ea('0x2c')],function(_0x5670b2){return{'name':_0x5670b2['fieldName'],'type':_0x5670b2[_0x24ea('0x2d')]['key']};});_0x235c91['model']=_[_0x24ea('0x2a')](_0x4a5085,_0x24ea('0x27'));_0x235c91['query']=_[_0x24ea('0x2e')](_0x1cc979[_0x24ea('0x2f')]);_0x235c91[_0x24ea('0x30')]=_[_0x24ea('0x31')](_0x235c91[_0x24ea('0x32')],_0x235c91[_0x24ea('0x2f')]);_0x45acc4[_0x24ea('0x33')]=_[_0x24ea('0x31')](_0x235c91[_0x24ea('0x32')],qs[_0x24ea('0x34')](_0x1cc979['query']['fields']));_0x45acc4[_0x24ea('0x33')]=_0x45acc4[_0x24ea('0x33')][_0x24ea('0x35')]?_0x45acc4[_0x24ea('0x33')]:_0x235c91[_0x24ea('0x32')];if(!_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x36')](_0x24ea('0x37'))){_0x45acc4['limit']=qs[_0x24ea('0x1c')](_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x1c')]);_0x45acc4[_0x24ea('0x1b')]=qs[_0x24ea('0x1b')](_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x1b')]);}_0x45acc4[_0x24ea('0x38')]=qs[_0x24ea('0x39')](_0x1cc979[_0x24ea('0x2f')]['sort']);_0x45acc4[_0x24ea('0x3a')]=qs[_0x24ea('0x30')](_[_0x24ea('0x3b')](_0x1cc979[_0x24ea('0x2f')],_0x235c91[_0x24ea('0x30')]),_0x4a5085);if(_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x3c')]){_0x45acc4[_0x24ea('0x3a')]=_[_0x24ea('0x3d')](_0x45acc4[_0x24ea('0x3a')],{'$or':_[_0x24ea('0x2a')](_0x4a5085,function(_0x19783d){if(_0x19783d[_0x24ea('0x2d')]!==_0x24ea('0x3e')){var _0x4b94e8={};_0x4b94e8[_0x19783d['name']]={'$like':'%'+_0x1cc979[_0x24ea('0x2f')][_0x24ea('0x3c')]+'%'};return _0x4b94e8;}})});}_0x45acc4=_[_0x24ea('0x3d')]({},_0x45acc4,_0x1cc979[_0x24ea('0x3f')]);var _0x14e1e8={'where':_0x45acc4[_0x24ea('0x3a')]};return db[_0x24ea('0x2b')]['count'](_0x14e1e8)[_0x24ea('0x24')](function(_0x40c92f){_0x3efd9e[_0x24ea('0x1d')]=_0x40c92f;if(_0x1cc979['query'][_0x24ea('0x40')]){_0x45acc4[_0x24ea('0x41')]=[{'all':!![]}];}return db[_0x24ea('0x2b')][_0x24ea('0x42')](_0x45acc4);})[_0x24ea('0x24')](function(_0x6a7fa5){_0x3efd9e[_0x24ea('0x43')]=_0x6a7fa5;return _0x3efd9e;})[_0x24ea('0x24')](respondWithFilteredResult(_0x52dc2d,_0x45acc4))[_0x24ea('0x44')](handleError(_0x52dc2d,null));};exports[_0x24ea('0x45')]=function(_0x2d5b46,_0x3ec4d1){var _0x4abe98={'raw':![],'where':{'id':_0x2d5b46[_0x24ea('0x46')]['id']}},_0x203c0a={};_0x203c0a[_0x24ea('0x32')]=_[_0x24ea('0x2e')](db[_0x24ea('0x2b')][_0x24ea('0x2c')]);_0x203c0a[_0x24ea('0x2f')]=_[_0x24ea('0x2e')](_0x2d5b46[_0x24ea('0x2f')]);_0x203c0a[_0x24ea('0x30')]=_[_0x24ea('0x31')](_0x203c0a[_0x24ea('0x32')],_0x203c0a[_0x24ea('0x2f')]);_0x4abe98[_0x24ea('0x33')]=_[_0x24ea('0x31')](_0x203c0a[_0x24ea('0x32')],qs[_0x24ea('0x34')](_0x2d5b46[_0x24ea('0x2f')][_0x24ea('0x34')]));_0x4abe98['attributes']=_0x4abe98['attributes'][_0x24ea('0x35')]?_0x4abe98['attributes']:_0x203c0a[_0x24ea('0x32')];if(_0x2d5b46[_0x24ea('0x2f')]['includeAll']){_0x4abe98[_0x24ea('0x41')]=[{'all':!![]}];}_0x4abe98=_[_0x24ea('0x3d')]({},_0x4abe98,_0x2d5b46[_0x24ea('0x3f')]);return db['SalesforceAccount'][_0x24ea('0x47')](_0x4abe98)[_0x24ea('0x24')](handleEntityNotFound(_0x3ec4d1,null))[_0x24ea('0x24')](respondWithResult(_0x3ec4d1,null))['catch'](handleError(_0x3ec4d1,null));};exports[_0x24ea('0x48')]=function(_0x50d7a6,_0x20c372){return db[_0x24ea('0x2b')][_0x24ea('0x48')](_0x50d7a6[_0x24ea('0x49')],{})['then'](respondWithResult(_0x20c372,0xc9))[_0x24ea('0x44')](handleError(_0x20c372,null));};exports['update']=function(_0x11dfd1,_0x195e08){if(_0x11dfd1[_0x24ea('0x49')]['id']){delete _0x11dfd1[_0x24ea('0x49')]['id'];}return db[_0x24ea('0x2b')][_0x24ea('0x47')]({'where':{'id':_0x11dfd1[_0x24ea('0x46')]['id']}})[_0x24ea('0x24')](handleEntityNotFound(_0x195e08,null))[_0x24ea('0x24')](saveUpdates(_0x11dfd1[_0x24ea('0x49')],null))[_0x24ea('0x24')](respondWithResult(_0x195e08,null))[_0x24ea('0x44')](handleError(_0x195e08,null));};exports['destroy']=function(_0x43cfcc,_0x43ea27){return db[_0x24ea('0x2b')]['find']({'where':{'id':_0x43cfcc['params']['id']}})['then'](handleEntityNotFound(_0x43ea27,null))['then'](removeEntity(_0x43ea27,null))[_0x24ea('0x44')](handleError(_0x43ea27,null));};exports[_0x24ea('0x4a')]=function(_0x4e4b98,_0x4f144a,_0x796b65){var _0x1589f9={};var _0x2e125a={};var _0x39977f;var _0x1c48ef;return db[_0x24ea('0x2b')][_0x24ea('0x4b')]({'where':{'id':_0x4e4b98[_0x24ea('0x46')]['id']}})['then'](handleEntityNotFound(_0x4f144a,null))['then'](function(_0x4c1260){if(_0x4c1260){_0x39977f=_0x4c1260;_0x2e125a[_0x24ea('0x32')]=_['keys'](db[_0x24ea('0x4c')][_0x24ea('0x2c')]);_0x2e125a[_0x24ea('0x2f')]=_[_0x24ea('0x2e')](_0x4e4b98[_0x24ea('0x2f')]);_0x2e125a['filters']=_[_0x24ea('0x31')](_0x2e125a[_0x24ea('0x32')],_0x2e125a[_0x24ea('0x2f')]);_0x1589f9[_0x24ea('0x33')]=_[_0x24ea('0x31')](_0x2e125a[_0x24ea('0x32')],qs[_0x24ea('0x34')](_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x34')]));_0x1589f9[_0x24ea('0x33')]=_0x1589f9[_0x24ea('0x33')][_0x24ea('0x35')]?_0x1589f9[_0x24ea('0x33')]:_0x2e125a[_0x24ea('0x32')];_0x1589f9['order']=qs[_0x24ea('0x39')](_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x39')]);_0x1589f9['where']=qs[_0x24ea('0x30')](_[_0x24ea('0x3b')](_0x4e4b98['query'],_0x2e125a[_0x24ea('0x30')]));if(_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x3c')]){_0x1589f9['where']=_[_0x24ea('0x3d')](_0x1589f9[_0x24ea('0x3a')],{'$or':_['map'](_0x1589f9[_0x24ea('0x33')],function(_0x1b362a){var _0x31a701={};_0x31a701[_0x1b362a]={'$like':'%'+_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x3c')]+'%'};return _0x31a701;})});}_0x1589f9=_[_0x24ea('0x3d')]({},_0x1589f9,_0x4e4b98[_0x24ea('0x3f')]);return _0x39977f[_0x24ea('0x4a')](_0x1589f9);}})['then'](function(_0x19cf82){if(_0x19cf82){_0x1c48ef=_0x19cf82['length'];if(!_0x4e4b98['query'][_0x24ea('0x36')](_0x24ea('0x37'))){_0x1589f9[_0x24ea('0x1c')]=qs[_0x24ea('0x1c')](_0x4e4b98[_0x24ea('0x2f')][_0x24ea('0x1c')]);_0x1589f9['offset']=qs[_0x24ea('0x1b')](_0x4e4b98['query'][_0x24ea('0x1b')]);}return _0x39977f['getConfigurations'](_0x1589f9);}})[_0x24ea('0x24')](function(_0x543a63){if(_0x543a63){return _0x543a63?{'count':_0x1c48ef,'rows':_0x543a63}:null;}})[_0x24ea('0x24')](respondWithResult(_0x4f144a,null))[_0x24ea('0x44')](handleError(_0x4f144a,null));};exports[_0x24ea('0x4d')]=function(_0x436250,_0x296d92,_0x3eacd5){if(_0x436250['body']['id']){delete _0x436250['body']['id'];}return db[_0x24ea('0x2b')][_0x24ea('0x4b')]({'where':{'id':_0x436250[_0x24ea('0x46')]['id']}})[_0x24ea('0x24')](handleEntityNotFound(_0x296d92,null))[_0x24ea('0x24')](function(_0x1e34c8){if(_0x1e34c8){_0x436250[_0x24ea('0x49')][_0x24ea('0x4e')]=_0x1e34c8['id'];_0x436250[_0x24ea('0x49')][_0x24ea('0x4f')]=integrations['getSubjects'](_0x436250[_0x24ea('0x49')][_0x24ea('0x50')],_0x436250[_0x24ea('0x49')][_0x24ea('0x2d')]);_0x436250[_0x24ea('0x49')][_0x24ea('0x51')]=integrations[_0x24ea('0x52')](_0x436250[_0x24ea('0x49')][_0x24ea('0x50')],_0x436250[_0x24ea('0x49')][_0x24ea('0x2d')]);return db[_0x24ea('0x4c')][_0x24ea('0x48')](_0x436250[_0x24ea('0x49')],{'include':[{'model':db[_0x24ea('0x53')],'as':'Subjects'},{'model':db[_0x24ea('0x53')],'as':'Descriptions'}]});}return null;})[_0x24ea('0x24')](respondWithResult(_0x296d92,null))[_0x24ea('0x44')](handleError(_0x296d92,null));};exports[_0x24ea('0x54')]=function(_0x3699fc,_0x50d39e,_0xd4f466){var _0x4391cc;var _0x1cda23='';var _0x10684e=_0x24ea('0x55');return db[_0x24ea('0x2b')][_0x24ea('0x4b')]({'where':{'id':_0x3699fc[_0x24ea('0x46')]['id']},'attributes':['id',_0x24ea('0x56'),'clientId','clientSecret',_0x24ea('0x57'),_0x24ea('0x58'),_0x24ea('0x59')]})[_0x24ea('0x24')](handleEntityNotFound(_0x50d39e,null))[_0x24ea('0x24')](function(_0x4b49bd){if(_0x4b49bd){_0x1cda23=_0x4b49bd[_0x24ea('0x56')];var _0x420c93=_0x1cda23['slice'](-0x1);if(_0x420c93==='/'){_0x1cda23=_0x1cda23[_0x24ea('0x5a')](0x0,_0x1cda23[_0x24ea('0x5b')](_0x420c93));}_0x4391cc=new jsforce[(_0x24ea('0x5c'))]({'oauth2':{'loginUrl':_0x1cda23,'clientId':_0x4b49bd[_0x24ea('0x5d')],'clientSecret':_0x4b49bd[_0x24ea('0x5e')]}});return _0x4391cc['login'](_0x4b49bd[_0x24ea('0x57')],_0x4b49bd[_0x24ea('0x58')]['concat'](_0x4b49bd[_0x24ea('0x59')]));}})[_0x24ea('0x24')](function(_0x188d6e){if(_0x188d6e){if(!_[_0x24ea('0x5f')](_0x3699fc[_0x24ea('0x2f')][_0x24ea('0x60')])){_0x10684e=_0x3699fc[_0x24ea('0x2f')]['ticketType'];}return _0x4391cc[_0x24ea('0x61')](_0x10684e)[_0x24ea('0x62')]();}})['then'](function(_0x273788){var _0x476cd1=[_0x24ea('0x63'),'ActivityDate',_0x24ea('0x64'),_0x24ea('0x65'),_0x24ea('0x66'),'Description'];var _0xff50=[_0x24ea('0x67'),_0x24ea('0x68'),'picklist',_0x24ea('0x69'),_0x24ea('0x6a'),_0x24ea('0x6b'),_0x24ea('0x6c')];if(_0x273788){_[_0x24ea('0x6d')](_0x273788[_0x24ea('0x34')],function(_0x37e825){return _0x476cd1['includes'](_0x37e825[_0x24ea('0x27')])||!_0xff50['includes'](_0x37e825[_0x24ea('0x2d')]);});return{'count':_0x273788[_0x24ea('0x34')][_0x24ea('0x35')],'rows':_['map'](_0x273788[_0x24ea('0x34')],function(_0x2c1756){return{'id':_0x2c1756[_0x24ea('0x27')],'name':_0x2c1756['label'],'custom':_0x2c1756[_0x24ea('0x6e')],'options':_0x2c1756[_0x24ea('0x6f')]['length']>0x0?_[_0x24ea('0x2a')](_0x2c1756[_0x24ea('0x6f')],function(_0x4efccf){return{'name':_0x4efccf[_0x24ea('0x70')],'value':_0x4efccf[_0x24ea('0x71')]};}):_0x2c1756[_0x24ea('0x2d')]==_0x24ea('0x69')?[{'name':'True','value':_0x24ea('0x72')},{'name':_0x24ea('0x73'),'value':_0x24ea('0x74')}]:[]};})};}})[_0x24ea('0x24')](respondWithResult(_0x50d39e,null))[_0x24ea('0x44')](function(_0x5a84d2){var _0x1550ca=_0x3699fc['query'][_0x24ea('0x75')]?0x1f4:_0x5a84d2[_0x24ea('0x76')]||0x1f4;logger[_0x24ea('0x26')](_0x24ea('0x77'),_0x24ea('0x54'),_0x1550ca,JSON[_0x24ea('0x78')](_0x5a84d2));delete _0x5a84d2[_0x24ea('0x27')];if(_0x1550ca===0x191){_0x1550ca=0x190;}_0x50d39e[_0x24ea('0x19')](_0x1550ca)[_0x24ea('0x28')](_0x3699fc['query'][_0x24ea('0x75')]?{'message':_0x24ea('0x79'),'statusCode':_0x5a84d2[_0x24ea('0x76')]}:_0x5a84d2);});}; \ No newline at end of file +var _0x4770=['ActivityDate','IsRecurrence','string','int','boolean','email','textarea','remove','includes','picklistValues','label','value','True','true','false','statusCode','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','SalesforceAccount','includeAll','include','rows','catch','show','length','find','create','body','params','getConfigurations','findOne','SalesforceConfiguration','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','SalesforceField','Descriptions','getFields','Task','clientId','clientSecret','username','password','securityToken','remoteUri','lastIndexOf','Connection','login','concat','ticketType','sobject','OwnerId'];(function(_0x3a657e,_0x44ec98){var _0x4441c6=function(_0x9653cd){while(--_0x9653cd){_0x3a657e['push'](_0x3a657e['shift']());}};_0x4441c6(++_0x44ec98);}(_0x4770,0xf2));var _0x0477=function(_0x1493e3,_0x427b92){_0x1493e3=_0x1493e3-0x0;var _0x2994ff=_0x4770[_0x1493e3];return _0x2994ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0477('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0477('0x1'));var rp=require(_0x0477('0x2'));var moment=require('moment');var BPromise=require(_0x0477('0x3'));var Mustache=require('mustache');var util=require(_0x0477('0x4'));var path=require(_0x0477('0x5'));var sox=require(_0x0477('0x6'));var csv=require(_0x0477('0x7'));var ejs=require(_0x0477('0x8'));var fs=require('fs');var fs_extra=require(_0x0477('0x9'));var _=require(_0x0477('0xa'));var squel=require('squel');var crypto=require(_0x0477('0xb'));var jsforce=require(_0x0477('0xc'));var deskjs=require(_0x0477('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0477('0xe'));var Redis=require(_0x0477('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0477('0x10'));var as=require(_0x0477('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0477('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0477('0x13'))['db'];var integrations=require(_0x0477('0x14'));function respondWithStatusCode(_0x44373e,_0x44bce4){_0x44bce4=_0x44bce4||0xcc;return function(_0x4c3ae2){if(_0x4c3ae2){return _0x44373e['sendStatus'](_0x44bce4);}return _0x44373e[_0x0477('0x15')](_0x44bce4)[_0x0477('0x16')]();};}function respondWithResult(_0x3cbdf3,_0x23b1bb){_0x23b1bb=_0x23b1bb||0xc8;return function(_0x152b20){if(_0x152b20){return _0x3cbdf3['status'](_0x23b1bb)[_0x0477('0x17')](_0x152b20);}};}function respondWithFilteredResult(_0x5bcff9,_0x1839a4){return function(_0x12b3bf){if(_0x12b3bf){var _0x27ac03=typeof _0x1839a4[_0x0477('0x18')]===_0x0477('0x19')&&typeof _0x1839a4[_0x0477('0x1a')]===_0x0477('0x19');var _0xa0ddd6=_0x12b3bf['count'];var _0x9d4927=_0x27ac03?0x0:_0x1839a4[_0x0477('0x18')];var _0x38adec=_0x27ac03?_0x12b3bf[_0x0477('0x1b')]:_0x1839a4['offset']+_0x1839a4[_0x0477('0x1a')];var _0x2950c8;if(_0x38adec>=_0xa0ddd6){_0x38adec=_0xa0ddd6;_0x2950c8=0xc8;}else{_0x2950c8=0xce;}_0x5bcff9[_0x0477('0x15')](_0x2950c8);return _0x5bcff9[_0x0477('0x1c')](_0x0477('0x1d'),_0x9d4927+'-'+_0x38adec+'/'+_0xa0ddd6)[_0x0477('0x17')](_0x12b3bf);}return null;};}function patchUpdates(_0x493de9){return function(_0x3391fa){try{jsonpatch[_0x0477('0x1e')](_0x3391fa,_0x493de9,!![]);}catch(_0x401425){return BPromise['reject'](_0x401425);}return _0x3391fa[_0x0477('0x1f')]();};}function saveUpdates(_0xe86c2c,_0x42e3cc){return function(_0x9b5774){if(_0x9b5774){return _0x9b5774[_0x0477('0x20')](_0xe86c2c)[_0x0477('0x21')](function(_0x4d9411){return _0x4d9411;});}return null;};}function removeEntity(_0xf3ba64,_0x381d9c){return function(_0x3838b4){if(_0x3838b4){return _0x3838b4[_0x0477('0x22')]()[_0x0477('0x21')](function(){_0xf3ba64[_0x0477('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d2d83,_0x4593c0){return function(_0x4dcfe9){if(!_0x4dcfe9){_0x2d2d83['sendStatus'](0x194);}return _0x4dcfe9;};}function handleError(_0xb83251,_0x57e889){_0x57e889=_0x57e889||0x1f4;return function(_0x1dd66c){logger['error'](_0x1dd66c[_0x0477('0x23')]);if(_0x1dd66c[_0x0477('0x24')]){delete _0x1dd66c['name'];}_0xb83251['status'](_0x57e889)[_0x0477('0x25')](_0x1dd66c);};}exports[_0x0477('0x26')]=function(_0x5d42d4,_0x8d6ca0){var _0x14fdc5={},_0x30632b={},_0x3164f5={'count':0x0,'rows':[]};var _0x19956e=_[_0x0477('0x27')](db['SalesforceAccount'][_0x0477('0x28')],function(_0x1f08fe){return{'name':_0x1f08fe['fieldName'],'type':_0x1f08fe[_0x0477('0x29')]['key']};});_0x30632b[_0x0477('0x2a')]=_[_0x0477('0x27')](_0x19956e,_0x0477('0x24'));_0x30632b[_0x0477('0x2b')]=_[_0x0477('0x2c')](_0x5d42d4[_0x0477('0x2b')]);_0x30632b[_0x0477('0x2d')]=_[_0x0477('0x2e')](_0x30632b[_0x0477('0x2a')],_0x30632b[_0x0477('0x2b')]);_0x14fdc5[_0x0477('0x2f')]=_['intersection'](_0x30632b[_0x0477('0x2a')],qs[_0x0477('0x30')](_0x5d42d4['query'][_0x0477('0x30')]));_0x14fdc5[_0x0477('0x2f')]=_0x14fdc5[_0x0477('0x2f')]['length']?_0x14fdc5[_0x0477('0x2f')]:_0x30632b[_0x0477('0x2a')];if(!_0x5d42d4[_0x0477('0x2b')][_0x0477('0x31')]('nolimit')){_0x14fdc5[_0x0477('0x1a')]=qs['limit'](_0x5d42d4[_0x0477('0x2b')][_0x0477('0x1a')]);_0x14fdc5['offset']=qs[_0x0477('0x18')](_0x5d42d4['query'][_0x0477('0x18')]);}_0x14fdc5['order']=qs[_0x0477('0x32')](_0x5d42d4[_0x0477('0x2b')][_0x0477('0x32')]);_0x14fdc5['where']=qs['filters'](_[_0x0477('0x33')](_0x5d42d4[_0x0477('0x2b')],_0x30632b[_0x0477('0x2d')]),_0x19956e);if(_0x5d42d4[_0x0477('0x2b')][_0x0477('0x34')]){_0x14fdc5[_0x0477('0x35')]=_[_0x0477('0x36')](_0x14fdc5[_0x0477('0x35')],{'$or':_[_0x0477('0x27')](_0x19956e,function(_0x84ea1c){if(_0x84ea1c[_0x0477('0x29')]!=='VIRTUAL'){var _0x318058={};_0x318058[_0x84ea1c[_0x0477('0x24')]]={'$like':'%'+_0x5d42d4[_0x0477('0x2b')][_0x0477('0x34')]+'%'};return _0x318058;}})});}_0x14fdc5=_[_0x0477('0x36')]({},_0x14fdc5,_0x5d42d4[_0x0477('0x37')]);var _0xa320a4={'where':_0x14fdc5[_0x0477('0x35')]};return db[_0x0477('0x38')][_0x0477('0x1b')](_0xa320a4)['then'](function(_0x1b72fe){_0x3164f5[_0x0477('0x1b')]=_0x1b72fe;if(_0x5d42d4[_0x0477('0x2b')][_0x0477('0x39')]){_0x14fdc5[_0x0477('0x3a')]=[{'all':!![]}];}return db[_0x0477('0x38')]['findAll'](_0x14fdc5);})['then'](function(_0x15a155){_0x3164f5[_0x0477('0x3b')]=_0x15a155;return _0x3164f5;})[_0x0477('0x21')](respondWithFilteredResult(_0x8d6ca0,_0x14fdc5))[_0x0477('0x3c')](handleError(_0x8d6ca0,null));};exports[_0x0477('0x3d')]=function(_0xb1785d,_0x1eeaf6){var _0x2e7acf={'raw':![],'where':{'id':_0xb1785d['params']['id']}},_0x2fa6ed={};_0x2fa6ed[_0x0477('0x2a')]=_['keys'](db['SalesforceAccount'][_0x0477('0x28')]);_0x2fa6ed[_0x0477('0x2b')]=_[_0x0477('0x2c')](_0xb1785d[_0x0477('0x2b')]);_0x2fa6ed[_0x0477('0x2d')]=_[_0x0477('0x2e')](_0x2fa6ed[_0x0477('0x2a')],_0x2fa6ed[_0x0477('0x2b')]);_0x2e7acf[_0x0477('0x2f')]=_[_0x0477('0x2e')](_0x2fa6ed[_0x0477('0x2a')],qs[_0x0477('0x30')](_0xb1785d['query'][_0x0477('0x30')]));_0x2e7acf['attributes']=_0x2e7acf[_0x0477('0x2f')][_0x0477('0x3e')]?_0x2e7acf[_0x0477('0x2f')]:_0x2fa6ed[_0x0477('0x2a')];if(_0xb1785d[_0x0477('0x2b')][_0x0477('0x39')]){_0x2e7acf[_0x0477('0x3a')]=[{'all':!![]}];}_0x2e7acf=_[_0x0477('0x36')]({},_0x2e7acf,_0xb1785d[_0x0477('0x37')]);return db[_0x0477('0x38')][_0x0477('0x3f')](_0x2e7acf)[_0x0477('0x21')](handleEntityNotFound(_0x1eeaf6,null))[_0x0477('0x21')](respondWithResult(_0x1eeaf6,null))['catch'](handleError(_0x1eeaf6,null));};exports[_0x0477('0x40')]=function(_0x4e731f,_0x55169f){return db[_0x0477('0x38')][_0x0477('0x40')](_0x4e731f['body'],{})[_0x0477('0x21')](respondWithResult(_0x55169f,0xc9))[_0x0477('0x3c')](handleError(_0x55169f,null));};exports[_0x0477('0x20')]=function(_0xb59edf,_0x52d0dd){if(_0xb59edf[_0x0477('0x41')]['id']){delete _0xb59edf[_0x0477('0x41')]['id'];}return db[_0x0477('0x38')][_0x0477('0x3f')]({'where':{'id':_0xb59edf['params']['id']}})['then'](handleEntityNotFound(_0x52d0dd,null))[_0x0477('0x21')](saveUpdates(_0xb59edf['body'],null))['then'](respondWithResult(_0x52d0dd,null))[_0x0477('0x3c')](handleError(_0x52d0dd,null));};exports['destroy']=function(_0x380bc7,_0x409630){return db[_0x0477('0x38')][_0x0477('0x3f')]({'where':{'id':_0x380bc7[_0x0477('0x42')]['id']}})[_0x0477('0x21')](handleEntityNotFound(_0x409630,null))[_0x0477('0x21')](removeEntity(_0x409630,null))[_0x0477('0x3c')](handleError(_0x409630,null));};exports[_0x0477('0x43')]=function(_0x1d3065,_0x3baff2,_0x1104bc){var _0x4b9ef0={};var _0x5c0227={};var _0x2ab26b;var _0x4d1dd2;return db[_0x0477('0x38')][_0x0477('0x44')]({'where':{'id':_0x1d3065[_0x0477('0x42')]['id']}})['then'](handleEntityNotFound(_0x3baff2,null))[_0x0477('0x21')](function(_0x6bea75){if(_0x6bea75){_0x2ab26b=_0x6bea75;_0x5c0227['model']=_[_0x0477('0x2c')](db[_0x0477('0x45')]['rawAttributes']);_0x5c0227[_0x0477('0x2b')]=_[_0x0477('0x2c')](_0x1d3065[_0x0477('0x2b')]);_0x5c0227[_0x0477('0x2d')]=_['intersection'](_0x5c0227['model'],_0x5c0227['query']);_0x4b9ef0['attributes']=_[_0x0477('0x2e')](_0x5c0227['model'],qs[_0x0477('0x30')](_0x1d3065[_0x0477('0x2b')][_0x0477('0x30')]));_0x4b9ef0[_0x0477('0x2f')]=_0x4b9ef0[_0x0477('0x2f')][_0x0477('0x3e')]?_0x4b9ef0[_0x0477('0x2f')]:_0x5c0227['model'];_0x4b9ef0[_0x0477('0x46')]=qs['sort'](_0x1d3065[_0x0477('0x2b')][_0x0477('0x32')]);_0x4b9ef0['where']=qs['filters'](_[_0x0477('0x33')](_0x1d3065[_0x0477('0x2b')],_0x5c0227[_0x0477('0x2d')]));if(_0x1d3065['query'][_0x0477('0x34')]){_0x4b9ef0[_0x0477('0x35')]=_[_0x0477('0x36')](_0x4b9ef0[_0x0477('0x35')],{'$or':_['map'](_0x4b9ef0['attributes'],function(_0x49f077){var _0x120cf5={};_0x120cf5[_0x49f077]={'$like':'%'+_0x1d3065[_0x0477('0x2b')]['filter']+'%'};return _0x120cf5;})});}_0x4b9ef0=_['merge']({},_0x4b9ef0,_0x1d3065[_0x0477('0x37')]);return _0x2ab26b[_0x0477('0x43')](_0x4b9ef0);}})['then'](function(_0x1b1b3a){if(_0x1b1b3a){_0x4d1dd2=_0x1b1b3a['length'];if(!_0x1d3065[_0x0477('0x2b')][_0x0477('0x31')](_0x0477('0x47'))){_0x4b9ef0[_0x0477('0x1a')]=qs[_0x0477('0x1a')](_0x1d3065[_0x0477('0x2b')][_0x0477('0x1a')]);_0x4b9ef0['offset']=qs[_0x0477('0x18')](_0x1d3065['query']['offset']);}return _0x2ab26b[_0x0477('0x43')](_0x4b9ef0);}})[_0x0477('0x21')](function(_0x1c76f5){if(_0x1c76f5){return _0x1c76f5?{'count':_0x4d1dd2,'rows':_0x1c76f5}:null;}})[_0x0477('0x21')](respondWithResult(_0x3baff2,null))[_0x0477('0x3c')](handleError(_0x3baff2,null));};exports[_0x0477('0x48')]=function(_0x4a2876,_0x171e73,_0x4824de){if(_0x4a2876[_0x0477('0x41')]['id']){delete _0x4a2876[_0x0477('0x41')]['id'];}return db['SalesforceAccount'][_0x0477('0x44')]({'where':{'id':_0x4a2876['params']['id']}})['then'](handleEntityNotFound(_0x171e73,null))[_0x0477('0x21')](function(_0x4e4873){if(_0x4e4873){_0x4a2876[_0x0477('0x41')][_0x0477('0x49')]=_0x4e4873['id'];_0x4a2876[_0x0477('0x41')][_0x0477('0x4a')]=integrations[_0x0477('0x4b')](_0x4a2876[_0x0477('0x41')][_0x0477('0x4c')],_0x4a2876[_0x0477('0x41')]['type']);_0x4a2876[_0x0477('0x41')]['Descriptions']=integrations['getDescriptions'](_0x4a2876[_0x0477('0x41')][_0x0477('0x4c')],_0x4a2876[_0x0477('0x41')][_0x0477('0x29')]);return db['SalesforceConfiguration'][_0x0477('0x40')](_0x4a2876[_0x0477('0x41')],{'include':[{'model':db[_0x0477('0x4d')],'as':_0x0477('0x4a')},{'model':db[_0x0477('0x4d')],'as':_0x0477('0x4e')}]});}return null;})['then'](respondWithResult(_0x171e73,null))[_0x0477('0x3c')](handleError(_0x171e73,null));};exports[_0x0477('0x4f')]=function(_0x47e9e3,_0x982779,_0x5e50bf){var _0x2e8378;var _0x3c484f='';var _0x430d8f=_0x0477('0x50');return db['SalesforceAccount'][_0x0477('0x44')]({'where':{'id':_0x47e9e3['params']['id']},'attributes':['id','remoteUri',_0x0477('0x51'),_0x0477('0x52'),_0x0477('0x53'),_0x0477('0x54'),_0x0477('0x55')]})[_0x0477('0x21')](handleEntityNotFound(_0x982779,null))[_0x0477('0x21')](function(_0x220e8a){if(_0x220e8a){_0x3c484f=_0x220e8a[_0x0477('0x56')];var _0x18c850=_0x3c484f['slice'](-0x1);if(_0x18c850==='/'){_0x3c484f=_0x3c484f['substring'](0x0,_0x3c484f[_0x0477('0x57')](_0x18c850));}_0x2e8378=new jsforce[(_0x0477('0x58'))]({'oauth2':{'loginUrl':_0x3c484f,'clientId':_0x220e8a[_0x0477('0x51')],'clientSecret':_0x220e8a[_0x0477('0x52')]}});return _0x2e8378[_0x0477('0x59')](_0x220e8a[_0x0477('0x53')],_0x220e8a[_0x0477('0x54')][_0x0477('0x5a')](_0x220e8a[_0x0477('0x55')]));}})[_0x0477('0x21')](function(_0x47f4c5){if(_0x47f4c5){if(!_['isNil'](_0x47e9e3[_0x0477('0x2b')][_0x0477('0x5b')])){_0x430d8f=_0x47e9e3[_0x0477('0x2b')][_0x0477('0x5b')];}return _0x2e8378[_0x0477('0x5c')](_0x430d8f)['describe']();}})[_0x0477('0x21')](function(_0x5ae338){var _0x401666=[_0x0477('0x5d'),_0x0477('0x5e'),'IsReminderSet',_0x0477('0x5f'),'Subject','Description'];var _0x48184d=[_0x0477('0x60'),_0x0477('0x61'),'picklist',_0x0477('0x62'),_0x0477('0x63'),_0x0477('0x64'),'phone'];if(_0x5ae338){_[_0x0477('0x65')](_0x5ae338[_0x0477('0x30')],function(_0x195cd2){return _0x401666[_0x0477('0x66')](_0x195cd2['name'])||!_0x48184d[_0x0477('0x66')](_0x195cd2[_0x0477('0x29')]);});return{'count':_0x5ae338[_0x0477('0x30')][_0x0477('0x3e')],'rows':_['map'](_0x5ae338['fields'],function(_0x26237f){return{'id':_0x26237f[_0x0477('0x24')],'name':_0x26237f['label'],'custom':_0x26237f['custom'],'options':_0x26237f['picklistValues'][_0x0477('0x3e')]>0x0?_[_0x0477('0x27')](_0x26237f[_0x0477('0x67')],function(_0x4f6177){return{'name':_0x4f6177[_0x0477('0x68')],'value':_0x4f6177[_0x0477('0x69')]};}):_0x26237f['type']==_0x0477('0x62')?[{'name':_0x0477('0x6a'),'value':_0x0477('0x6b')},{'name':'False','value':_0x0477('0x6c')}]:[]};})};}})[_0x0477('0x21')](respondWithResult(_0x982779,null))[_0x0477('0x3c')](function(_0x4202aa){var _0x11b277=_0x47e9e3[_0x0477('0x2b')]['test']?0x1f4:_0x4202aa[_0x0477('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x0477('0x4f'),_0x11b277,JSON[_0x0477('0x6e')](_0x4202aa));delete _0x4202aa[_0x0477('0x24')];if(_0x11b277===0x191){_0x11b277=0x190;}_0x982779['status'](_0x11b277)['send'](_0x47e9e3[_0x0477('0x2b')]['test']?{'message':_0x0477('0x6f'),'statusCode':_0x4202aa[_0x0477('0x6d')]}:_0x4202aa);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 5b97a37..5745931 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 _0x6055=['../../config/logger','api','moment','bluebird','path','rimraf','../../components/integrations/configuration','define','SalesforceAccount','lodash','util'];(function(_0xfc42ee,_0x4f05c3){var _0x98b245=function(_0x2cb744){while(--_0x2cb744){_0xfc42ee['push'](_0xfc42ee['shift']());}};_0x98b245(++_0x4f05c3);}(_0x6055,0x15e));var _0x5605=function(_0x147f83,_0x1ae7de){_0x147f83=_0x147f83-0x0;var _0x543f5b=_0x6055[_0x147f83];return _0x543f5b;};'use strict';var _=require(_0x5605('0x0'));var util=require(_0x5605('0x1'));var logger=require(_0x5605('0x2'))(_0x5605('0x3'));var moment=require(_0x5605('0x4'));var BPromise=require(_0x5605('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5605('0x6'));var rimraf=require(_0x5605('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x5605('0x8'));module['exports']=function(_0x5c64fe,_0x40a85e){return _0x5c64fe[_0x5605('0x9')](_0x5605('0xa'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1000=['bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','../../config/logger','api','moment'];(function(_0x308508,_0x681b66){var _0x42a5bd=function(_0x45ffbd){while(--_0x45ffbd){_0x308508['push'](_0x308508['shift']());}};_0x42a5bd(++_0x681b66);}(_0x1000,0x75));var _0x0100=function(_0x5c0918,_0xcc8df){_0x5c0918=_0x5c0918-0x0;var _0x1abf07=_0x1000[_0x5c0918];return _0x1abf07;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0100('0x0'))(_0x0100('0x1'));var moment=require(_0x0100('0x2'));var BPromise=require(_0x0100('0x3'));var rp=require(_0x0100('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0100('0x5'));var config=require(_0x0100('0x6'));var attributes=require(_0x0100('0x7'));var integrations=require(_0x0100('0x8'));module['exports']=function(_0x306714,_0x48308f){return _0x306714[_0x0100('0x9')](_0x0100('0xa'),attributes,{'tableName':_0x0100('0xb'),'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 2c087df..644b05e 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 _0x0c73=['ioredis','rpc','jayson/promise','client','then','info','SalesforceAccount,\x20%s,\x20%s','SalesforceAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','raw','where','attributes','limit','include','model','map','debug','ShowSalesforceAccount','find','lodash','util','moment','bluebird','randomstring'];(function(_0x478b8d,_0x4f84c1){var _0x48f84e=function(_0x42f7c8){while(--_0x42f7c8){_0x478b8d['push'](_0x478b8d['shift']());}};_0x48f84e(++_0x4f84c1);}(_0x0c73,0x7f));var _0x30c7=function(_0x219390,_0x1f7d52){_0x219390=_0x219390-0x0;var _0x40f56c=_0x0c73[_0x219390];return _0x40f56c;};'use strict';var _=require(_0x30c7('0x0'));var util=require(_0x30c7('0x1'));var moment=require(_0x30c7('0x2'));var BPromise=require(_0x30c7('0x3'));var rs=require(_0x30c7('0x4'));var fs=require('fs');var Redis=require(_0x30c7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x30c7('0x6'));var config=require('../../config/environment');var jayson=require(_0x30c7('0x7'));var client=jayson[_0x30c7('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25273c,_0x107af2,_0x28a77b){return new BPromise(function(_0x1840ed,_0x169456){return client['request'](_0x25273c,_0x28a77b)[_0x30c7('0x9')](function(_0x209b72){logger[_0x30c7('0xa')](_0x30c7('0xb'),_0x107af2,'request\x20sent');logger['debug'](_0x30c7('0xc'),_0x107af2,_0x30c7('0xd'),JSON[_0x30c7('0xe')](_0x209b72));if(_0x209b72['error']){if(_0x209b72[_0x30c7('0xf')][_0x30c7('0x10')]===0x1f4){logger[_0x30c7('0xf')](_0x30c7('0xb'),_0x107af2,_0x209b72[_0x30c7('0xf')][_0x30c7('0x11')]);return _0x169456(_0x209b72[_0x30c7('0xf')]['message']);}logger[_0x30c7('0xf')](_0x30c7('0xb'),_0x107af2,_0x209b72[_0x30c7('0xf')][_0x30c7('0x11')]);return _0x1840ed(_0x209b72['error'][_0x30c7('0x11')]);}else{logger[_0x30c7('0xa')](_0x30c7('0xb'),_0x107af2,_0x30c7('0xd'));_0x1840ed(_0x209b72[_0x30c7('0x12')][_0x30c7('0x11')]);}})[_0x30c7('0x13')](function(_0x1d5ce7){logger[_0x30c7('0xf')](_0x30c7('0xb'),_0x107af2,_0x1d5ce7);_0x169456(_0x1d5ce7);});});}exports[_0x30c7('0x14')]=function(_0x1d4daf){var _0x5e16f1=this;return new Promise(function(_0x42ad16,_0x1fbdd4){return db[_0x30c7('0x15')]['findAll']({'raw':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x17')]===undefined?!![]:![]:!![],'where':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x18')]||null:null,'attributes':_0x1d4daf['options']?_0x1d4daf['options'][_0x30c7('0x19')]||null:null,'limit':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x1a')]||null:null,'include':_0x1d4daf[_0x30c7('0x16')]?_0x1d4daf[_0x30c7('0x16')][_0x30c7('0x1b')]?_['map'](_0x1d4daf['options'][_0x30c7('0x1b')],function(_0x1df898){return{'model':db[_0x1df898[_0x30c7('0x1c')]],'as':_0x1df898['as'],'attributes':_0x1df898['attributes'],'include':_0x1df898[_0x30c7('0x1b')]?_[_0x30c7('0x1d')](_0x1df898[_0x30c7('0x1b')],function(_0x40339e){return{'model':db[_0x40339e['model']],'as':_0x40339e['as'],'attributes':_0x40339e[_0x30c7('0x19')],'include':_0x40339e[_0x30c7('0x1b')]?_[_0x30c7('0x1d')](_0x40339e[_0x30c7('0x1b')],function(_0x3e8a35){return{'model':db[_0x3e8a35['model']],'as':_0x3e8a35['as'],'attributes':_0x3e8a35[_0x30c7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x30c7('0x9')](function(_0x591a93){logger[_0x30c7('0xa')]('GetSalesforceAccount',_0x1d4daf);logger[_0x30c7('0x1e')](_0x30c7('0x14'),_0x1d4daf,JSON[_0x30c7('0xe')](_0x591a93));_0x42ad16(_0x591a93);})[_0x30c7('0x13')](function(_0x155dd1){logger[_0x30c7('0xf')](_0x30c7('0x14'),_0x155dd1[_0x30c7('0x11')],_0x1d4daf);_0x1fbdd4(_0x5e16f1[_0x30c7('0xf')](0x1f4,_0x155dd1[_0x30c7('0x11')]));});});};exports[_0x30c7('0x1f')]=function(_0x313226){var _0x449fa0=this;return new Promise(function(_0x233938,_0x13b1f3){return db[_0x30c7('0x15')][_0x30c7('0x20')]({'raw':_0x313226['options']?_0x313226[_0x30c7('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x313226[_0x30c7('0x16')]?_0x313226['options']['where']||null:null,'attributes':_0x313226[_0x30c7('0x16')]?_0x313226['options'][_0x30c7('0x19')]||null:null,'include':_0x313226[_0x30c7('0x16')]?_0x313226[_0x30c7('0x16')][_0x30c7('0x1b')]?_['map'](_0x313226['options'][_0x30c7('0x1b')],function(_0x200854){return{'model':db[_0x200854[_0x30c7('0x1c')]],'as':_0x200854['as'],'attributes':_0x200854[_0x30c7('0x19')],'include':_0x200854['include']?_[_0x30c7('0x1d')](_0x200854['include'],function(_0x14632e){return{'model':db[_0x14632e[_0x30c7('0x1c')]],'as':_0x14632e['as'],'attributes':_0x14632e[_0x30c7('0x19')],'include':_0x14632e[_0x30c7('0x1b')]?_[_0x30c7('0x1d')](_0x14632e[_0x30c7('0x1b')],function(_0x207acf){return{'model':db[_0x207acf['model']],'as':_0x207acf['as'],'attributes':_0x207acf[_0x30c7('0x19')]};}):[]};}):[]};}):[]:[]})[_0x30c7('0x9')](function(_0x14f6b4){logger[_0x30c7('0xa')](_0x30c7('0x1f'),_0x313226);logger[_0x30c7('0x1e')](_0x30c7('0x1f'),_0x313226,JSON[_0x30c7('0xe')](_0x14f6b4));_0x233938(_0x14f6b4);})[_0x30c7('0x13')](function(_0x5ea9bb){logger[_0x30c7('0xf')](_0x30c7('0x1f'),_0x5ea9bb[_0x30c7('0x11')],_0x313226);_0x13b1f3(_0x449fa0[_0x30c7('0xf')](0x1f4,_0x5ea9bb['message']));});});}; \ No newline at end of file +var _0x3c95=['SalesforceAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowSalesforceAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount'];(function(_0x47d720,_0x2a651a){var _0x3974b3=function(_0x5e0442){while(--_0x5e0442){_0x47d720['push'](_0x47d720['shift']());}};_0x3974b3(++_0x2a651a);}(_0x3c95,0x1d3));var _0x53c9=function(_0x593c38,_0x5bb03f){_0x593c38=_0x593c38-0x0;var _0x1f071a=_0x3c95[_0x593c38];return _0x1f071a;};'use strict';var _=require(_0x53c9('0x0'));var util=require(_0x53c9('0x1'));var moment=require(_0x53c9('0x2'));var BPromise=require('bluebird');var rs=require(_0x53c9('0x3'));var fs=require('fs');var Redis=require(_0x53c9('0x4'));var db=require(_0x53c9('0x5'))['db'];var utils=require(_0x53c9('0x6'));var logger=require('../../config/logger')(_0x53c9('0x7'));var config=require(_0x53c9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x53c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e395b,_0x1490ce,_0x20f23a){return new BPromise(function(_0x275ab1,_0x52b3e5){return client[_0x53c9('0xa')](_0x2e395b,_0x20f23a)['then'](function(_0x20ca9d){logger[_0x53c9('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x1490ce,_0x53c9('0xc'));logger[_0x53c9('0xd')](_0x53c9('0xe'),_0x1490ce,'request\x20sent',JSON[_0x53c9('0xf')](_0x20ca9d));if(_0x20ca9d[_0x53c9('0x10')]){if(_0x20ca9d[_0x53c9('0x10')][_0x53c9('0x11')]===0x1f4){logger[_0x53c9('0x10')](_0x53c9('0x12'),_0x1490ce,_0x20ca9d['error'][_0x53c9('0x13')]);return _0x52b3e5(_0x20ca9d[_0x53c9('0x10')]['message']);}logger['error'](_0x53c9('0x12'),_0x1490ce,_0x20ca9d[_0x53c9('0x10')][_0x53c9('0x13')]);return _0x275ab1(_0x20ca9d[_0x53c9('0x10')][_0x53c9('0x13')]);}else{logger[_0x53c9('0xb')](_0x53c9('0x12'),_0x1490ce,_0x53c9('0xc'));_0x275ab1(_0x20ca9d[_0x53c9('0x14')][_0x53c9('0x13')]);}})[_0x53c9('0x15')](function(_0x155bad){logger[_0x53c9('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x1490ce,_0x155bad);_0x52b3e5(_0x155bad);});});}exports[_0x53c9('0x16')]=function(_0x2f9b4e){var _0x2712e2=this;return new Promise(function(_0x4b617b,_0x5e1297){return db[_0x53c9('0x17')][_0x53c9('0x18')]({'raw':_0x2f9b4e[_0x53c9('0x19')]?_0x2f9b4e[_0x53c9('0x19')][_0x53c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x2f9b4e[_0x53c9('0x19')]?_0x2f9b4e[_0x53c9('0x19')][_0x53c9('0x1b')]||null:null,'attributes':_0x2f9b4e[_0x53c9('0x19')]?_0x2f9b4e[_0x53c9('0x19')][_0x53c9('0x1c')]||null:null,'limit':_0x2f9b4e[_0x53c9('0x19')]?_0x2f9b4e[_0x53c9('0x19')][_0x53c9('0x1d')]||null:null,'include':_0x2f9b4e['options']?_0x2f9b4e[_0x53c9('0x19')][_0x53c9('0x1e')]?_['map'](_0x2f9b4e[_0x53c9('0x19')][_0x53c9('0x1e')],function(_0x1869fb){return{'model':db[_0x1869fb[_0x53c9('0x1f')]],'as':_0x1869fb['as'],'attributes':_0x1869fb[_0x53c9('0x1c')],'include':_0x1869fb['include']?_[_0x53c9('0x20')](_0x1869fb[_0x53c9('0x1e')],function(_0x14dd44){return{'model':db[_0x14dd44[_0x53c9('0x1f')]],'as':_0x14dd44['as'],'attributes':_0x14dd44[_0x53c9('0x1c')],'include':_0x14dd44[_0x53c9('0x1e')]?_[_0x53c9('0x20')](_0x14dd44[_0x53c9('0x1e')],function(_0x69898b){return{'model':db[_0x69898b[_0x53c9('0x1f')]],'as':_0x69898b['as'],'attributes':_0x69898b[_0x53c9('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x53c9('0x21')](function(_0x166e84){logger['info']('GetSalesforceAccount',_0x2f9b4e);logger[_0x53c9('0xd')](_0x53c9('0x16'),_0x2f9b4e,JSON[_0x53c9('0xf')](_0x166e84));_0x4b617b(_0x166e84);})[_0x53c9('0x15')](function(_0x34fa39){logger['error'](_0x53c9('0x16'),_0x34fa39[_0x53c9('0x13')],_0x2f9b4e);_0x5e1297(_0x2712e2[_0x53c9('0x10')](0x1f4,_0x34fa39['message']));});});};exports[_0x53c9('0x22')]=function(_0x512eb6){var _0x1ad35a=this;return new Promise(function(_0x5cdb57,_0x120847){return db[_0x53c9('0x17')]['find']({'raw':_0x512eb6[_0x53c9('0x19')]?_0x512eb6[_0x53c9('0x19')][_0x53c9('0x1a')]===undefined?!![]:![]:!![],'where':_0x512eb6[_0x53c9('0x19')]?_0x512eb6[_0x53c9('0x19')][_0x53c9('0x1b')]||null:null,'attributes':_0x512eb6['options']?_0x512eb6[_0x53c9('0x19')][_0x53c9('0x1c')]||null:null,'include':_0x512eb6[_0x53c9('0x19')]?_0x512eb6[_0x53c9('0x19')][_0x53c9('0x1e')]?_[_0x53c9('0x20')](_0x512eb6[_0x53c9('0x19')][_0x53c9('0x1e')],function(_0x508710){return{'model':db[_0x508710[_0x53c9('0x1f')]],'as':_0x508710['as'],'attributes':_0x508710['attributes'],'include':_0x508710['include']?_[_0x53c9('0x20')](_0x508710[_0x53c9('0x1e')],function(_0xd37901){return{'model':db[_0xd37901[_0x53c9('0x1f')]],'as':_0xd37901['as'],'attributes':_0xd37901['attributes'],'include':_0xd37901[_0x53c9('0x1e')]?_[_0x53c9('0x20')](_0xd37901[_0x53c9('0x1e')],function(_0x38e1b1){return{'model':db[_0x38e1b1['model']],'as':_0x38e1b1['as'],'attributes':_0x38e1b1['attributes']};}):[]};}):[]};}):[]:[]})[_0x53c9('0x21')](function(_0x429354){logger[_0x53c9('0xb')]('ShowSalesforceAccount',_0x512eb6);logger[_0x53c9('0xd')](_0x53c9('0x22'),_0x512eb6,JSON[_0x53c9('0xf')](_0x429354));_0x5cdb57(_0x429354);})[_0x53c9('0x15')](function(_0x2b08fc){logger['error'](_0x53c9('0x22'),_0x2b08fc['message'],_0x512eb6);_0x120847(_0x1ad35a[_0x53c9('0x10')](0x1f4,_0x2b08fc[_0x53c9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index d4a7129..f1597cf 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 _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x478ced,_0x157857){var _0x2e8a20=function(_0xfd00a6){while(--_0xfd00a6){_0x478ced['push'](_0x478ced['shift']());}};_0x2e8a20(++_0x157857);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file +var _0x7a54=['getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceConfiguration.controller','get','index','/:id','isAuthenticated','/:id/subjects'];(function(_0x1710b6,_0x3a64e7){var _0x10592f=function(_0x457b93){while(--_0x457b93){_0x1710b6['push'](_0x1710b6['shift']());}};_0x10592f(++_0x3a64e7);}(_0x7a54,0x106));var _0x47a5=function(_0x32ba52,_0x58c7a5){_0x32ba52=_0x32ba52-0x0;var _0x8b893d=_0x7a54[_0x32ba52];return _0x8b893d;};'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/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/descriptions',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x12')](_0x47a5('0xb'),auth['isAuthenticated'](),controller[_0x47a5('0x13')]);router[_0x47a5('0x14')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x15')]);module[_0x47a5('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index cb530a4..22847bc 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 _0xbd45=['ENUM','contact_lead','contact','lead','account','nothing','sequelize','exports','STRING','Task','Case'];(function(_0x261a2e,_0x4eb9fd){var _0x5347d2=function(_0x11e001){while(--_0x11e001){_0x261a2e['push'](_0x261a2e['shift']());}};_0x5347d2(++_0x4eb9fd);}(_0xbd45,0x166));var _0x5bd4=function(_0x53bd57,_0x55cfd9){_0x53bd57=_0x53bd57-0x0;var _0x282a68=_0xbd45[_0x53bd57];return _0x282a68;};'use strict';var Sequelize=require(_0x5bd4('0x0'));module[_0x5bd4('0x1')]={'name':{'type':Sequelize[_0x5bd4('0x2')]},'description':{'type':Sequelize[_0x5bd4('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0x5bd4('0x3'),_0x5bd4('0x4')),'defaultValue':_0x5bd4('0x3')},'moduleSearch':{'type':Sequelize[_0x5bd4('0x5')](_0x5bd4('0x6'),_0x5bd4('0x7'),_0x5bd4('0x8'),'account_contact_lead',_0x5bd4('0x9')),'defaultValue':_0x5bd4('0x6')},'moduleCreate':{'type':Sequelize[_0x5bd4('0x5')](_0x5bd4('0xa'),_0x5bd4('0x7'),'lead',_0x5bd4('0x9')),'defaultValue':_0x5bd4('0x8')},'leadId':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x5bd4('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x5bd4('0x2')]}}; \ No newline at end of file +var _0xb03d=['Task','contact_lead','contact','lead','nothing','account','sequelize','exports','STRING','ENUM','Case'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xb03d,0x1b3));var _0xdb03=function(_0x12590c,_0x1c40ec){_0x12590c=_0x12590c-0x0;var _0x58b520=_0xb03d[_0x12590c];return _0x58b520;};'use strict';var Sequelize=require(_0xdb03('0x0'));module[_0xdb03('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xdb03('0x2')]},'ticketType':{'type':Sequelize[_0xdb03('0x3')]('Task',_0xdb03('0x4')),'defaultValue':_0xdb03('0x5')},'moduleSearch':{'type':Sequelize[_0xdb03('0x3')](_0xdb03('0x6'),_0xdb03('0x7'),_0xdb03('0x8'),'account_contact_lead','account'),'defaultValue':_0xdb03('0x6')},'moduleCreate':{'type':Sequelize[_0xdb03('0x3')](_0xdb03('0x9'),_0xdb03('0x7'),_0xdb03('0x8'),_0xdb03('0xa')),'defaultValue':_0xdb03('0x8')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xdb03('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xdb03('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 20d5444..fa05ec3 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 _0x048f=['offset','undefined','limit','count','set','apply','then','destroy','stack','name','send','index','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','getFields','SalesforceField','pick','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json'];(function(_0x4dcf0c,_0x35e342){var _0x5396bb=function(_0x5062da){while(--_0x5062da){_0x4dcf0c['push'](_0x4dcf0c['shift']());}};_0x5396bb(++_0x35e342);}(_0x048f,0xcd));var _0xf048=function(_0x5d6bd6,_0x1eb18a){_0x5d6bd6=_0x5d6bd6-0x0;var _0x3b8649=_0x048f[_0x5d6bd6];return _0x3b8649;};'use strict';var emlformat=require(_0xf048('0x0'));var rimraf=require(_0xf048('0x1'));var zipdir=require(_0xf048('0x2'));var jsonpatch=require(_0xf048('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf048('0x4'));var Mustache=require(_0xf048('0x5'));var util=require(_0xf048('0x6'));var path=require(_0xf048('0x7'));var sox=require(_0xf048('0x8'));var csv=require(_0xf048('0x9'));var ejs=require(_0xf048('0xa'));var fs=require('fs');var fs_extra=require(_0xf048('0xb'));var _=require(_0xf048('0xc'));var squel=require(_0xf048('0xd'));var crypto=require(_0xf048('0xe'));var jsforce=require(_0xf048('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf048('0x9'));var querystring=require('querystring');var Papa=require(_0xf048('0x10'));var Redis=require(_0xf048('0x11'));var authService=require(_0xf048('0x12'));var qs=require(_0xf048('0x13'));var as=require(_0xf048('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf048('0x15'));var utils=require(_0xf048('0x16'));var config=require(_0xf048('0x17'));var licenseUtil=require(_0xf048('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c3742,_0x521475){_0x521475=_0x521475||0xcc;return function(_0x269c5a){if(_0x269c5a){return _0x2c3742[_0xf048('0x19')](_0x521475);}return _0x2c3742[_0xf048('0x1a')](_0x521475)[_0xf048('0x1b')]();};}function respondWithResult(_0x202932,_0x4d6849){_0x4d6849=_0x4d6849||0xc8;return function(_0x5a6a1b){if(_0x5a6a1b){return _0x202932['status'](_0x4d6849)[_0xf048('0x1c')](_0x5a6a1b);}};}function respondWithFilteredResult(_0x3a2994,_0x53f2a5){return function(_0x2f9af9){if(_0x2f9af9){var _0x38137e=typeof _0x53f2a5[_0xf048('0x1d')]===_0xf048('0x1e')&&typeof _0x53f2a5[_0xf048('0x1f')]===_0xf048('0x1e');var _0x414875=_0x2f9af9['count'];var _0x42609b=_0x38137e?0x0:_0x53f2a5[_0xf048('0x1d')];var _0x284899=_0x38137e?_0x2f9af9[_0xf048('0x20')]:_0x53f2a5['offset']+_0x53f2a5[_0xf048('0x1f')];var _0x265c82;if(_0x284899>=_0x414875){_0x284899=_0x414875;_0x265c82=0xc8;}else{_0x265c82=0xce;}_0x3a2994[_0xf048('0x1a')](_0x265c82);return _0x3a2994[_0xf048('0x21')]('Content-Range',_0x42609b+'-'+_0x284899+'/'+_0x414875)['json'](_0x2f9af9);}return null;};}function patchUpdates(_0x1c6fdf){return function(_0x37b659){try{jsonpatch[_0xf048('0x22')](_0x37b659,_0x1c6fdf,!![]);}catch(_0x342166){return BPromise['reject'](_0x342166);}return _0x37b659['save']();};}function saveUpdates(_0x337f96,_0x374930){return function(_0x1955a7){if(_0x1955a7){return _0x1955a7['update'](_0x337f96)[_0xf048('0x23')](function(_0x59fbc0){return _0x59fbc0;});}return null;};}function removeEntity(_0xa86146,_0x4e2630){return function(_0xf34e63){if(_0xf34e63){return _0xf34e63[_0xf048('0x24')]()[_0xf048('0x23')](function(){_0xa86146[_0xf048('0x1a')](0xcc)[_0xf048('0x1b')]();});}};}function handleEntityNotFound(_0x57152f,_0xa90a3d){return function(_0x5dc012){if(!_0x5dc012){_0x57152f[_0xf048('0x19')](0x194);}return _0x5dc012;};}function handleError(_0x486163,_0x352d92){_0x352d92=_0x352d92||0x1f4;return function(_0xcae83c){logger['error'](_0xcae83c[_0xf048('0x25')]);if(_0xcae83c[_0xf048('0x26')]){delete _0xcae83c[_0xf048('0x26')];}_0x486163[_0xf048('0x1a')](_0x352d92)[_0xf048('0x27')](_0xcae83c);};}exports[_0xf048('0x28')]=function(_0x378c57,_0x5e6064){var _0x59d4b5={},_0x24d5f3={},_0x1477ee={'count':0x0,'rows':[]};var _0x1f1bd6=_['map'](db[_0xf048('0x29')][_0xf048('0x2a')],function(_0x5e7c82){return{'name':_0x5e7c82[_0xf048('0x2b')],'type':_0x5e7c82[_0xf048('0x2c')][_0xf048('0x2d')]};});_0x24d5f3[_0xf048('0x2e')]=_['map'](_0x1f1bd6,'name');_0x24d5f3[_0xf048('0x2f')]=_['keys'](_0x378c57['query']);_0x24d5f3[_0xf048('0x30')]=_[_0xf048('0x31')](_0x24d5f3[_0xf048('0x2e')],_0x24d5f3[_0xf048('0x2f')]);_0x59d4b5[_0xf048('0x32')]=_[_0xf048('0x31')](_0x24d5f3['model'],qs[_0xf048('0x33')](_0x378c57[_0xf048('0x2f')][_0xf048('0x33')]));_0x59d4b5[_0xf048('0x32')]=_0x59d4b5[_0xf048('0x32')][_0xf048('0x34')]?_0x59d4b5[_0xf048('0x32')]:_0x24d5f3[_0xf048('0x2e')];if(!_0x378c57[_0xf048('0x2f')][_0xf048('0x35')](_0xf048('0x36'))){_0x59d4b5[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x378c57[_0xf048('0x2f')][_0xf048('0x1f')]);_0x59d4b5[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x378c57[_0xf048('0x2f')]['offset']);}_0x59d4b5[_0xf048('0x37')]=qs[_0xf048('0x38')](_0x378c57['query'][_0xf048('0x38')]);_0x59d4b5[_0xf048('0x39')]=qs[_0xf048('0x30')](_['pick'](_0x378c57[_0xf048('0x2f')],_0x24d5f3[_0xf048('0x30')]),_0x1f1bd6);if(_0x378c57[_0xf048('0x2f')][_0xf048('0x3a')]){_0x59d4b5[_0xf048('0x39')]=_[_0xf048('0x3b')](_0x59d4b5[_0xf048('0x39')],{'$or':_[_0xf048('0x3c')](_0x1f1bd6,function(_0x13eb94){if(_0x13eb94[_0xf048('0x2c')]!==_0xf048('0x3d')){var _0x5b20f8={};_0x5b20f8[_0x13eb94['name']]={'$like':'%'+_0x378c57[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x5b20f8;}})});}_0x59d4b5=_[_0xf048('0x3b')]({},_0x59d4b5,_0x378c57[_0xf048('0x3e')]);var _0x6361e4={'where':_0x59d4b5[_0xf048('0x39')]};return db[_0xf048('0x29')]['count'](_0x6361e4)[_0xf048('0x23')](function(_0xfe2fc6){_0x1477ee[_0xf048('0x20')]=_0xfe2fc6;if(_0x378c57['query'][_0xf048('0x3f')]){_0x59d4b5['include']=[{'all':!![]}];}return db[_0xf048('0x29')][_0xf048('0x40')](_0x59d4b5);})[_0xf048('0x23')](function(_0x1b797d){_0x1477ee[_0xf048('0x41')]=_0x1b797d;return _0x1477ee;})[_0xf048('0x23')](respondWithFilteredResult(_0x5e6064,_0x59d4b5))[_0xf048('0x42')](handleError(_0x5e6064,null));};exports['show']=function(_0x3aa5c1,_0x825b88){var _0x31bca7={'raw':![],'where':{'id':_0x3aa5c1[_0xf048('0x43')]['id']}},_0x45afcc={};_0x45afcc[_0xf048('0x2e')]=_[_0xf048('0x44')](db[_0xf048('0x29')][_0xf048('0x2a')]);_0x45afcc[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x3aa5c1[_0xf048('0x2f')]);_0x45afcc[_0xf048('0x30')]=_[_0xf048('0x31')](_0x45afcc[_0xf048('0x2e')],_0x45afcc[_0xf048('0x2f')]);_0x31bca7['attributes']=_['intersection'](_0x45afcc[_0xf048('0x2e')],qs['fields'](_0x3aa5c1['query']['fields']));_0x31bca7[_0xf048('0x32')]=_0x31bca7[_0xf048('0x32')][_0xf048('0x34')]?_0x31bca7[_0xf048('0x32')]:_0x45afcc[_0xf048('0x2e')];if(_0x3aa5c1[_0xf048('0x2f')][_0xf048('0x3f')]){_0x31bca7[_0xf048('0x45')]=[{'all':!![]}];}_0x31bca7=_[_0xf048('0x3b')]({},_0x31bca7,_0x3aa5c1['options']);return db[_0xf048('0x29')][_0xf048('0x46')](_0x31bca7)[_0xf048('0x23')](handleEntityNotFound(_0x825b88,null))[_0xf048('0x23')](respondWithResult(_0x825b88,null))['catch'](handleError(_0x825b88,null));};exports[_0xf048('0x47')]=function(_0x4da748,_0x871462){return db[_0xf048('0x29')][_0xf048('0x47')](_0x4da748[_0xf048('0x48')],{})[_0xf048('0x23')](respondWithResult(_0x871462,0xc9))[_0xf048('0x42')](handleError(_0x871462,null));};exports['update']=function(_0x1eb104,_0x12bb63){if(_0x1eb104[_0xf048('0x48')]['id']){delete _0x1eb104[_0xf048('0x48')]['id'];}return db[_0xf048('0x29')][_0xf048('0x46')]({'where':{'id':_0x1eb104['params']['id']}})[_0xf048('0x23')](handleEntityNotFound(_0x12bb63,null))[_0xf048('0x23')](saveUpdates(_0x1eb104[_0xf048('0x48')],null))[_0xf048('0x23')](respondWithResult(_0x12bb63,null))[_0xf048('0x42')](handleError(_0x12bb63,null));};exports[_0xf048('0x24')]=function(_0x5fdfb9,_0x2d2b3d){return db[_0xf048('0x29')]['find']({'where':{'id':_0x5fdfb9[_0xf048('0x43')]['id']}})['then'](handleEntityNotFound(_0x2d2b3d,null))['then'](removeEntity(_0x2d2b3d,null))[_0xf048('0x42')](handleError(_0x2d2b3d,null));};exports[_0xf048('0x49')]=function(_0x23d86c,_0x255cf4,_0x3406aa){var _0x383603={};var _0x17b10d={};var _0x281d2c;var _0x3de586;return db[_0xf048('0x29')]['findOne']({'where':{'id':_0x23d86c[_0xf048('0x43')]['id']}})['then'](handleEntityNotFound(_0x255cf4,null))['then'](function(_0x867430){if(_0x867430){_0x281d2c=_0x867430;_0x17b10d[_0xf048('0x2e')]=_[_0xf048('0x44')](db[_0xf048('0x4a')][_0xf048('0x2a')]);_0x17b10d[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x23d86c[_0xf048('0x2f')]);_0x17b10d[_0xf048('0x30')]=_[_0xf048('0x31')](_0x17b10d['model'],_0x17b10d[_0xf048('0x2f')]);_0x383603[_0xf048('0x32')]=_[_0xf048('0x31')](_0x17b10d[_0xf048('0x2e')],qs[_0xf048('0x33')](_0x23d86c[_0xf048('0x2f')][_0xf048('0x33')]));_0x383603[_0xf048('0x32')]=_0x383603[_0xf048('0x32')][_0xf048('0x34')]?_0x383603[_0xf048('0x32')]:_0x17b10d[_0xf048('0x2e')];_0x383603['order']=qs[_0xf048('0x38')](_0x23d86c[_0xf048('0x2f')]['sort']);_0x383603[_0xf048('0x39')]=qs['filters'](_[_0xf048('0x4b')](_0x23d86c['query'],_0x17b10d[_0xf048('0x30')]));if(_0x23d86c['query']['filter']){_0x383603['where']=_['merge'](_0x383603[_0xf048('0x39')],{'$or':_[_0xf048('0x3c')](_0x383603[_0xf048('0x32')],function(_0xdafd3d){var _0x5717de={};_0x5717de[_0xdafd3d]={'$like':'%'+_0x23d86c[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x5717de;})});}_0x383603=_[_0xf048('0x3b')]({},_0x383603,_0x23d86c[_0xf048('0x3e')]);return _0x281d2c['getFields'](_0x383603);}})['then'](function(_0x1be0d5){if(_0x1be0d5){_0x3de586=_0x1be0d5['length'];if(!_0x23d86c[_0xf048('0x2f')][_0xf048('0x35')](_0xf048('0x36'))){_0x383603[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x23d86c[_0xf048('0x2f')][_0xf048('0x1f')]);_0x383603[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x23d86c[_0xf048('0x2f')][_0xf048('0x1d')]);}return _0x281d2c[_0xf048('0x49')](_0x383603);}})[_0xf048('0x23')](function(_0x317930){if(_0x317930){return _0x317930?{'count':_0x3de586,'rows':_0x317930}:null;}})[_0xf048('0x23')](respondWithResult(_0x255cf4,null))[_0xf048('0x42')](handleError(_0x255cf4,null));};exports[_0xf048('0x4c')]=function(_0x153c48,_0x433f2c,_0x4e7ab1){var _0x383fea={};var _0x2b3862={};var _0x10e6c7;var _0x486af2;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x153c48['params']['id']}})['then'](handleEntityNotFound(_0x433f2c,null))[_0xf048('0x23')](function(_0x88a7fb){if(_0x88a7fb){_0x10e6c7=_0x88a7fb;_0x2b3862[_0xf048('0x2e')]=_[_0xf048('0x44')](db[_0xf048('0x4a')][_0xf048('0x2a')]);_0x2b3862[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x153c48[_0xf048('0x2f')]);_0x2b3862[_0xf048('0x30')]=_[_0xf048('0x31')](_0x2b3862[_0xf048('0x2e')],_0x2b3862['query']);_0x383fea['attributes']=_[_0xf048('0x31')](_0x2b3862[_0xf048('0x2e')],qs[_0xf048('0x33')](_0x153c48[_0xf048('0x2f')][_0xf048('0x33')]));_0x383fea['attributes']=_0x383fea[_0xf048('0x32')]['length']?_0x383fea[_0xf048('0x32')]:_0x2b3862[_0xf048('0x2e')];_0x383fea[_0xf048('0x37')]=qs[_0xf048('0x38')](_0x153c48[_0xf048('0x2f')]['sort']);_0x383fea[_0xf048('0x39')]=qs['filters'](_[_0xf048('0x4b')](_0x153c48[_0xf048('0x2f')],_0x2b3862[_0xf048('0x30')]));if(_0x153c48[_0xf048('0x2f')][_0xf048('0x3a')]){_0x383fea[_0xf048('0x39')]=_['merge'](_0x383fea['where'],{'$or':_['map'](_0x383fea[_0xf048('0x32')],function(_0x3f3d87){var _0x24dc80={};_0x24dc80[_0x3f3d87]={'$like':'%'+_0x153c48[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x24dc80;})});}_0x383fea=_['merge']({},_0x383fea,_0x153c48['options']);return _0x10e6c7['getSubjects'](_0x383fea);}})[_0xf048('0x23')](function(_0x561b5d){if(_0x561b5d){_0x486af2=_0x561b5d[_0xf048('0x34')];if(!_0x153c48[_0xf048('0x2f')][_0xf048('0x35')]('nolimit')){_0x383fea[_0xf048('0x1f')]=qs['limit'](_0x153c48[_0xf048('0x2f')][_0xf048('0x1f')]);_0x383fea[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x153c48[_0xf048('0x2f')]['offset']);}return _0x10e6c7[_0xf048('0x4c')](_0x383fea);}})[_0xf048('0x23')](function(_0x220419){if(_0x220419){return _0x220419?{'count':_0x486af2,'rows':_0x220419}:null;}})[_0xf048('0x23')](respondWithResult(_0x433f2c,null))[_0xf048('0x42')](handleError(_0x433f2c,null));};exports[_0xf048('0x4d')]=function(_0x37792f,_0x2d609a,_0x5b37dc){var _0x3fb469={};var _0x1a8f94={};var _0x4c3b2e;var _0x1af3fd;return db[_0xf048('0x29')]['findOne']({'where':{'id':_0x37792f[_0xf048('0x43')]['id']}})[_0xf048('0x23')](handleEntityNotFound(_0x2d609a,null))[_0xf048('0x23')](function(_0x21269a){if(_0x21269a){_0x4c3b2e=_0x21269a;_0x1a8f94[_0xf048('0x2e')]=_['keys'](db['SalesforceField'][_0xf048('0x2a')]);_0x1a8f94[_0xf048('0x2f')]=_[_0xf048('0x44')](_0x37792f[_0xf048('0x2f')]);_0x1a8f94[_0xf048('0x30')]=_[_0xf048('0x31')](_0x1a8f94[_0xf048('0x2e')],_0x1a8f94[_0xf048('0x2f')]);_0x3fb469[_0xf048('0x32')]=_['intersection'](_0x1a8f94[_0xf048('0x2e')],qs[_0xf048('0x33')](_0x37792f[_0xf048('0x2f')]['fields']));_0x3fb469['attributes']=_0x3fb469[_0xf048('0x32')]['length']?_0x3fb469[_0xf048('0x32')]:_0x1a8f94[_0xf048('0x2e')];_0x3fb469[_0xf048('0x37')]=qs[_0xf048('0x38')](_0x37792f[_0xf048('0x2f')][_0xf048('0x38')]);_0x3fb469[_0xf048('0x39')]=qs[_0xf048('0x30')](_[_0xf048('0x4b')](_0x37792f[_0xf048('0x2f')],_0x1a8f94[_0xf048('0x30')]));if(_0x37792f[_0xf048('0x2f')][_0xf048('0x3a')]){_0x3fb469[_0xf048('0x39')]=_[_0xf048('0x3b')](_0x3fb469[_0xf048('0x39')],{'$or':_['map'](_0x3fb469[_0xf048('0x32')],function(_0x144e4d){var _0x1305e4={};_0x1305e4[_0x144e4d]={'$like':'%'+_0x37792f[_0xf048('0x2f')][_0xf048('0x3a')]+'%'};return _0x1305e4;})});}_0x3fb469=_['merge']({},_0x3fb469,_0x37792f[_0xf048('0x3e')]);return _0x4c3b2e[_0xf048('0x4d')](_0x3fb469);}})[_0xf048('0x23')](function(_0x3340bd){if(_0x3340bd){_0x1af3fd=_0x3340bd[_0xf048('0x34')];if(!_0x37792f[_0xf048('0x2f')][_0xf048('0x35')](_0xf048('0x36'))){_0x3fb469[_0xf048('0x1f')]=qs[_0xf048('0x1f')](_0x37792f['query'][_0xf048('0x1f')]);_0x3fb469[_0xf048('0x1d')]=qs[_0xf048('0x1d')](_0x37792f['query']['offset']);}return _0x4c3b2e[_0xf048('0x4d')](_0x3fb469);}})[_0xf048('0x23')](function(_0x5e3a4e){if(_0x5e3a4e){return _0x5e3a4e?{'count':_0x1af3fd,'rows':_0x5e3a4e}:null;}})[_0xf048('0x23')](respondWithResult(_0x2d609a,null))[_0xf048('0x42')](handleError(_0x2d609a,null));}; \ No newline at end of file +var _0x110f=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','then','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','order','sort','filters','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','attributes','length','create','body','find','params','getFields','SalesforceField','hasOwnProperty','nolimit','getSubjects','findOne','options','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x110f,0x188));var _0xf110=function(_0x181daf,_0x1bc4dc){_0x181daf=_0x181daf-0x0;var _0x1fe2cb=_0x110f[_0x181daf];return _0x1fe2cb;};'use strict';var emlformat=require(_0xf110('0x0'));var rimraf=require(_0xf110('0x1'));var zipdir=require(_0xf110('0x2'));var jsonpatch=require(_0xf110('0x3'));var rp=require(_0xf110('0x4'));var moment=require(_0xf110('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf110('0x6'));var util=require(_0xf110('0x7'));var path=require(_0xf110('0x8'));var sox=require(_0xf110('0x9'));var csv=require(_0xf110('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf110('0xb'));var _=require(_0xf110('0xc'));var squel=require(_0xf110('0xd'));var crypto=require(_0xf110('0xe'));var jsforce=require(_0xf110('0xf'));var deskjs=require(_0xf110('0x10'));var toCsv=require(_0xf110('0xa'));var querystring=require('querystring');var Papa=require(_0xf110('0x11'));var Redis=require('ioredis');var authService=require(_0xf110('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf110('0x13'));var hardwareService=require(_0xf110('0x14'));var logger=require(_0xf110('0x15'))(_0xf110('0x16'));var utils=require('../../config/utils');var config=require(_0xf110('0x17'));var licenseUtil=require(_0xf110('0x18'));var db=require(_0xf110('0x19'))['db'];function respondWithStatusCode(_0x50a294,_0x22e68e){_0x22e68e=_0x22e68e||0xcc;return function(_0xecbf8f){if(_0xecbf8f){return _0x50a294[_0xf110('0x1a')](_0x22e68e);}return _0x50a294[_0xf110('0x1b')](_0x22e68e)['end']();};}function respondWithResult(_0x1bd271,_0x4ccf73){_0x4ccf73=_0x4ccf73||0xc8;return function(_0x1b2e12){if(_0x1b2e12){return _0x1bd271[_0xf110('0x1b')](_0x4ccf73)['json'](_0x1b2e12);}};}function respondWithFilteredResult(_0x4837b0,_0x44bf59){return function(_0xda9282){if(_0xda9282){var _0x2df4d9=typeof _0x44bf59['offset']===_0xf110('0x1c')&&typeof _0x44bf59['limit']===_0xf110('0x1c');var _0x4e8edd=_0xda9282['count'];var _0x2c26ed=_0x2df4d9?0x0:_0x44bf59['offset'];var _0x327499=_0x2df4d9?_0xda9282[_0xf110('0x1d')]:_0x44bf59[_0xf110('0x1e')]+_0x44bf59[_0xf110('0x1f')];var _0xa05907;if(_0x327499>=_0x4e8edd){_0x327499=_0x4e8edd;_0xa05907=0xc8;}else{_0xa05907=0xce;}_0x4837b0[_0xf110('0x1b')](_0xa05907);return _0x4837b0[_0xf110('0x20')](_0xf110('0x21'),_0x2c26ed+'-'+_0x327499+'/'+_0x4e8edd)[_0xf110('0x22')](_0xda9282);}return null;};}function patchUpdates(_0x3ff6af){return function(_0x48ea20){try{jsonpatch[_0xf110('0x23')](_0x48ea20,_0x3ff6af,!![]);}catch(_0x3f053d){return BPromise[_0xf110('0x24')](_0x3f053d);}return _0x48ea20[_0xf110('0x25')]();};}function saveUpdates(_0xa80624,_0x24e828){return function(_0x6045c0){if(_0x6045c0){return _0x6045c0['update'](_0xa80624)['then'](function(_0x3b49e8){return _0x3b49e8;});}return null;};}function removeEntity(_0x38129f,_0x46ad62){return function(_0x5617cf){if(_0x5617cf){return _0x5617cf[_0xf110('0x26')]()[_0xf110('0x27')](function(){_0x38129f[_0xf110('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e9f73,_0x505b1b){return function(_0x43f98d){if(!_0x43f98d){_0x1e9f73[_0xf110('0x1a')](0x194);}return _0x43f98d;};}function handleError(_0x2b5fe1,_0x2a230c){_0x2a230c=_0x2a230c||0x1f4;return function(_0x46424b){logger[_0xf110('0x28')](_0x46424b['stack']);if(_0x46424b['name']){delete _0x46424b[_0xf110('0x29')];}_0x2b5fe1[_0xf110('0x1b')](_0x2a230c)[_0xf110('0x2a')](_0x46424b);};}exports[_0xf110('0x2b')]=function(_0x25c72b,_0x308af8){var _0x3c624f={},_0x4ea476={},_0x2a220c={'count':0x0,'rows':[]};var _0x416f47=_[_0xf110('0x2c')](db[_0xf110('0x2d')][_0xf110('0x2e')],function(_0x4bf824){return{'name':_0x4bf824[_0xf110('0x2f')],'type':_0x4bf824[_0xf110('0x30')][_0xf110('0x31')]};});_0x4ea476[_0xf110('0x32')]=_[_0xf110('0x2c')](_0x416f47,'name');_0x4ea476['query']=_[_0xf110('0x33')](_0x25c72b[_0xf110('0x34')]);_0x4ea476['filters']=_[_0xf110('0x35')](_0x4ea476[_0xf110('0x32')],_0x4ea476[_0xf110('0x34')]);_0x3c624f['attributes']=_[_0xf110('0x35')](_0x4ea476[_0xf110('0x32')],qs[_0xf110('0x36')](_0x25c72b['query'][_0xf110('0x36')]));_0x3c624f['attributes']=_0x3c624f['attributes']['length']?_0x3c624f['attributes']:_0x4ea476[_0xf110('0x32')];if(!_0x25c72b[_0xf110('0x34')]['hasOwnProperty']('nolimit')){_0x3c624f[_0xf110('0x1f')]=qs[_0xf110('0x1f')](_0x25c72b['query'][_0xf110('0x1f')]);_0x3c624f[_0xf110('0x1e')]=qs[_0xf110('0x1e')](_0x25c72b[_0xf110('0x34')]['offset']);}_0x3c624f[_0xf110('0x37')]=qs[_0xf110('0x38')](_0x25c72b['query']['sort']);_0x3c624f['where']=qs[_0xf110('0x39')](_[_0xf110('0x3a')](_0x25c72b['query'],_0x4ea476[_0xf110('0x39')]),_0x416f47);if(_0x25c72b['query'][_0xf110('0x3b')]){_0x3c624f[_0xf110('0x3c')]=_[_0xf110('0x3d')](_0x3c624f[_0xf110('0x3c')],{'$or':_['map'](_0x416f47,function(_0x46db45){if(_0x46db45[_0xf110('0x30')]!==_0xf110('0x3e')){var _0x2d6e29={};_0x2d6e29[_0x46db45[_0xf110('0x29')]]={'$like':'%'+_0x25c72b[_0xf110('0x34')]['filter']+'%'};return _0x2d6e29;}})});}_0x3c624f=_[_0xf110('0x3d')]({},_0x3c624f,_0x25c72b['options']);var _0x5148c2={'where':_0x3c624f[_0xf110('0x3c')]};return db['SalesforceConfiguration'][_0xf110('0x1d')](_0x5148c2)[_0xf110('0x27')](function(_0x314c87){_0x2a220c[_0xf110('0x1d')]=_0x314c87;if(_0x25c72b['query'][_0xf110('0x3f')]){_0x3c624f[_0xf110('0x40')]=[{'all':!![]}];}return db[_0xf110('0x2d')][_0xf110('0x41')](_0x3c624f);})[_0xf110('0x27')](function(_0x402208){_0x2a220c['rows']=_0x402208;return _0x2a220c;})[_0xf110('0x27')](respondWithFilteredResult(_0x308af8,_0x3c624f))[_0xf110('0x42')](handleError(_0x308af8,null));};exports[_0xf110('0x43')]=function(_0x577115,_0x50d798){var _0x3e81cf={'raw':![],'where':{'id':_0x577115['params']['id']}},_0x35a2f8={};_0x35a2f8[_0xf110('0x32')]=_['keys'](db[_0xf110('0x2d')][_0xf110('0x2e')]);_0x35a2f8[_0xf110('0x34')]=_['keys'](_0x577115['query']);_0x35a2f8[_0xf110('0x39')]=_[_0xf110('0x35')](_0x35a2f8['model'],_0x35a2f8[_0xf110('0x34')]);_0x3e81cf[_0xf110('0x44')]=_[_0xf110('0x35')](_0x35a2f8[_0xf110('0x32')],qs[_0xf110('0x36')](_0x577115['query'][_0xf110('0x36')]));_0x3e81cf['attributes']=_0x3e81cf[_0xf110('0x44')][_0xf110('0x45')]?_0x3e81cf['attributes']:_0x35a2f8[_0xf110('0x32')];if(_0x577115[_0xf110('0x34')]['includeAll']){_0x3e81cf[_0xf110('0x40')]=[{'all':!![]}];}_0x3e81cf=_[_0xf110('0x3d')]({},_0x3e81cf,_0x577115['options']);return db[_0xf110('0x2d')]['find'](_0x3e81cf)[_0xf110('0x27')](handleEntityNotFound(_0x50d798,null))[_0xf110('0x27')](respondWithResult(_0x50d798,null))[_0xf110('0x42')](handleError(_0x50d798,null));};exports[_0xf110('0x46')]=function(_0x3a3f58,_0x6ab843){return db[_0xf110('0x2d')][_0xf110('0x46')](_0x3a3f58[_0xf110('0x47')],{})[_0xf110('0x27')](respondWithResult(_0x6ab843,0xc9))[_0xf110('0x42')](handleError(_0x6ab843,null));};exports['update']=function(_0x3f756d,_0x31a5ee){if(_0x3f756d['body']['id']){delete _0x3f756d[_0xf110('0x47')]['id'];}return db[_0xf110('0x2d')][_0xf110('0x48')]({'where':{'id':_0x3f756d[_0xf110('0x49')]['id']}})['then'](handleEntityNotFound(_0x31a5ee,null))[_0xf110('0x27')](saveUpdates(_0x3f756d[_0xf110('0x47')],null))[_0xf110('0x27')](respondWithResult(_0x31a5ee,null))[_0xf110('0x42')](handleError(_0x31a5ee,null));};exports[_0xf110('0x26')]=function(_0x5d2768,_0x18b120){return db['SalesforceConfiguration'][_0xf110('0x48')]({'where':{'id':_0x5d2768['params']['id']}})[_0xf110('0x27')](handleEntityNotFound(_0x18b120,null))[_0xf110('0x27')](removeEntity(_0x18b120,null))[_0xf110('0x42')](handleError(_0x18b120,null));};exports[_0xf110('0x4a')]=function(_0x300d34,_0x287f95,_0x728b56){var _0x376b4a={};var _0x19d5d7={};var _0x236119;var _0x3adcde;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x300d34['params']['id']}})['then'](handleEntityNotFound(_0x287f95,null))['then'](function(_0x4d7208){if(_0x4d7208){_0x236119=_0x4d7208;_0x19d5d7[_0xf110('0x32')]=_[_0xf110('0x33')](db[_0xf110('0x4b')][_0xf110('0x2e')]);_0x19d5d7[_0xf110('0x34')]=_[_0xf110('0x33')](_0x300d34[_0xf110('0x34')]);_0x19d5d7[_0xf110('0x39')]=_[_0xf110('0x35')](_0x19d5d7[_0xf110('0x32')],_0x19d5d7[_0xf110('0x34')]);_0x376b4a[_0xf110('0x44')]=_[_0xf110('0x35')](_0x19d5d7['model'],qs[_0xf110('0x36')](_0x300d34['query'][_0xf110('0x36')]));_0x376b4a[_0xf110('0x44')]=_0x376b4a[_0xf110('0x44')][_0xf110('0x45')]?_0x376b4a[_0xf110('0x44')]:_0x19d5d7[_0xf110('0x32')];_0x376b4a['order']=qs[_0xf110('0x38')](_0x300d34['query']['sort']);_0x376b4a[_0xf110('0x3c')]=qs[_0xf110('0x39')](_[_0xf110('0x3a')](_0x300d34[_0xf110('0x34')],_0x19d5d7[_0xf110('0x39')]));if(_0x300d34[_0xf110('0x34')]['filter']){_0x376b4a[_0xf110('0x3c')]=_['merge'](_0x376b4a[_0xf110('0x3c')],{'$or':_[_0xf110('0x2c')](_0x376b4a[_0xf110('0x44')],function(_0x59b056){var _0x21f17e={};_0x21f17e[_0x59b056]={'$like':'%'+_0x300d34['query'][_0xf110('0x3b')]+'%'};return _0x21f17e;})});}_0x376b4a=_['merge']({},_0x376b4a,_0x300d34['options']);return _0x236119[_0xf110('0x4a')](_0x376b4a);}})[_0xf110('0x27')](function(_0x39a65b){if(_0x39a65b){_0x3adcde=_0x39a65b[_0xf110('0x45')];if(!_0x300d34['query'][_0xf110('0x4c')](_0xf110('0x4d'))){_0x376b4a[_0xf110('0x1f')]=qs[_0xf110('0x1f')](_0x300d34[_0xf110('0x34')][_0xf110('0x1f')]);_0x376b4a['offset']=qs[_0xf110('0x1e')](_0x300d34[_0xf110('0x34')][_0xf110('0x1e')]);}return _0x236119[_0xf110('0x4a')](_0x376b4a);}})['then'](function(_0x3cc4d8){if(_0x3cc4d8){return _0x3cc4d8?{'count':_0x3adcde,'rows':_0x3cc4d8}:null;}})[_0xf110('0x27')](respondWithResult(_0x287f95,null))[_0xf110('0x42')](handleError(_0x287f95,null));};exports[_0xf110('0x4e')]=function(_0x1a3384,_0x4186e0,_0x4a526d){var _0x4c1bc0={};var _0x2a5b5e={};var _0x50eaa1;var _0x46db81;return db[_0xf110('0x2d')][_0xf110('0x4f')]({'where':{'id':_0x1a3384[_0xf110('0x49')]['id']}})[_0xf110('0x27')](handleEntityNotFound(_0x4186e0,null))[_0xf110('0x27')](function(_0x210fba){if(_0x210fba){_0x50eaa1=_0x210fba;_0x2a5b5e['model']=_['keys'](db['SalesforceField']['rawAttributes']);_0x2a5b5e[_0xf110('0x34')]=_['keys'](_0x1a3384[_0xf110('0x34')]);_0x2a5b5e[_0xf110('0x39')]=_[_0xf110('0x35')](_0x2a5b5e[_0xf110('0x32')],_0x2a5b5e[_0xf110('0x34')]);_0x4c1bc0[_0xf110('0x44')]=_['intersection'](_0x2a5b5e[_0xf110('0x32')],qs['fields'](_0x1a3384[_0xf110('0x34')][_0xf110('0x36')]));_0x4c1bc0['attributes']=_0x4c1bc0['attributes'][_0xf110('0x45')]?_0x4c1bc0['attributes']:_0x2a5b5e[_0xf110('0x32')];_0x4c1bc0[_0xf110('0x37')]=qs['sort'](_0x1a3384[_0xf110('0x34')][_0xf110('0x38')]);_0x4c1bc0[_0xf110('0x3c')]=qs[_0xf110('0x39')](_['pick'](_0x1a3384[_0xf110('0x34')],_0x2a5b5e[_0xf110('0x39')]));if(_0x1a3384[_0xf110('0x34')][_0xf110('0x3b')]){_0x4c1bc0['where']=_[_0xf110('0x3d')](_0x4c1bc0[_0xf110('0x3c')],{'$or':_[_0xf110('0x2c')](_0x4c1bc0['attributes'],function(_0x94bfce){var _0x551c86={};_0x551c86[_0x94bfce]={'$like':'%'+_0x1a3384['query'][_0xf110('0x3b')]+'%'};return _0x551c86;})});}_0x4c1bc0=_[_0xf110('0x3d')]({},_0x4c1bc0,_0x1a3384[_0xf110('0x50')]);return _0x50eaa1[_0xf110('0x4e')](_0x4c1bc0);}})['then'](function(_0x5b6032){if(_0x5b6032){_0x46db81=_0x5b6032[_0xf110('0x45')];if(!_0x1a3384['query'][_0xf110('0x4c')](_0xf110('0x4d'))){_0x4c1bc0['limit']=qs['limit'](_0x1a3384[_0xf110('0x34')][_0xf110('0x1f')]);_0x4c1bc0[_0xf110('0x1e')]=qs[_0xf110('0x1e')](_0x1a3384[_0xf110('0x34')][_0xf110('0x1e')]);}return _0x50eaa1['getSubjects'](_0x4c1bc0);}})[_0xf110('0x27')](function(_0x3aa783){if(_0x3aa783){return _0x3aa783?{'count':_0x46db81,'rows':_0x3aa783}:null;}})[_0xf110('0x27')](respondWithResult(_0x4186e0,null))[_0xf110('0x42')](handleError(_0x4186e0,null));};exports['getDescriptions']=function(_0x307c9f,_0x13324e,_0x212939){var _0x2dd96e={};var _0x12207d={};var _0x2db57e;var _0x22fe3;return db[_0xf110('0x2d')][_0xf110('0x4f')]({'where':{'id':_0x307c9f[_0xf110('0x49')]['id']}})['then'](handleEntityNotFound(_0x13324e,null))[_0xf110('0x27')](function(_0x417b9e){if(_0x417b9e){_0x2db57e=_0x417b9e;_0x12207d[_0xf110('0x32')]=_['keys'](db[_0xf110('0x4b')][_0xf110('0x2e')]);_0x12207d[_0xf110('0x34')]=_[_0xf110('0x33')](_0x307c9f['query']);_0x12207d[_0xf110('0x39')]=_[_0xf110('0x35')](_0x12207d[_0xf110('0x32')],_0x12207d[_0xf110('0x34')]);_0x2dd96e['attributes']=_['intersection'](_0x12207d[_0xf110('0x32')],qs[_0xf110('0x36')](_0x307c9f[_0xf110('0x34')][_0xf110('0x36')]));_0x2dd96e['attributes']=_0x2dd96e[_0xf110('0x44')]['length']?_0x2dd96e[_0xf110('0x44')]:_0x12207d['model'];_0x2dd96e[_0xf110('0x37')]=qs[_0xf110('0x38')](_0x307c9f['query'][_0xf110('0x38')]);_0x2dd96e[_0xf110('0x3c')]=qs[_0xf110('0x39')](_[_0xf110('0x3a')](_0x307c9f[_0xf110('0x34')],_0x12207d['filters']));if(_0x307c9f['query'][_0xf110('0x3b')]){_0x2dd96e['where']=_[_0xf110('0x3d')](_0x2dd96e[_0xf110('0x3c')],{'$or':_[_0xf110('0x2c')](_0x2dd96e['attributes'],function(_0x4800a5){var _0x128aed={};_0x128aed[_0x4800a5]={'$like':'%'+_0x307c9f[_0xf110('0x34')][_0xf110('0x3b')]+'%'};return _0x128aed;})});}_0x2dd96e=_[_0xf110('0x3d')]({},_0x2dd96e,_0x307c9f['options']);return _0x2db57e[_0xf110('0x51')](_0x2dd96e);}})['then'](function(_0x5dbb76){if(_0x5dbb76){_0x22fe3=_0x5dbb76[_0xf110('0x45')];if(!_0x307c9f['query'][_0xf110('0x4c')](_0xf110('0x4d'))){_0x2dd96e[_0xf110('0x1f')]=qs[_0xf110('0x1f')](_0x307c9f[_0xf110('0x34')][_0xf110('0x1f')]);_0x2dd96e['offset']=qs[_0xf110('0x1e')](_0x307c9f[_0xf110('0x34')][_0xf110('0x1e')]);}return _0x2db57e[_0xf110('0x51')](_0x2dd96e);}})[_0xf110('0x27')](function(_0xc3744d){if(_0xc3744d){return _0xc3744d?{'count':_0x22fe3,'rows':_0xc3744d}:null;}})[_0xf110('0x27')](respondWithResult(_0x13324e,null))[_0xf110('0x42')](handleError(_0x13324e,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 2a918e1..c6fa125 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 _0x266c=['request-promise','rimraf','../../config/environment','exports','define','SalesforceConfiguration','lodash','../../config/logger','moment','bluebird'];(function(_0x3a63da,_0x324e74){var _0xfbaf0c=function(_0x4c85c4){while(--_0x4c85c4){_0x3a63da['push'](_0x3a63da['shift']());}};_0xfbaf0c(++_0x324e74);}(_0x266c,0x178));var _0xc266=function(_0x8d2ba,_0xe5c613){_0x8d2ba=_0x8d2ba-0x0;var _0x2f5f34=_0x266c[_0x8d2ba];return _0x2f5f34;};'use strict';var _=require(_0xc266('0x0'));var util=require('util');var logger=require(_0xc266('0x1'))('api');var moment=require(_0xc266('0x2'));var BPromise=require(_0xc266('0x3'));var rp=require(_0xc266('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc266('0x5'));var config=require(_0xc266('0x6'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0xc266('0x7')]=function(_0x46a8c7,_0x4fceaf){return _0x46a8c7[_0xc266('0x8')](_0xc266('0x9'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5658=['bluebird','path','rimraf','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','api','moment'];(function(_0x386235,_0x57f692){var _0xe763e4=function(_0x364d76){while(--_0x364d76){_0x386235['push'](_0x386235['shift']());}};_0xe763e4(++_0x57f692);}(_0x5658,0xc3));var _0x8565=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x5658[_0x40a045];return _0x1a687c;};'use strict';var _=require('lodash');var util=require(_0x8565('0x0'));var logger=require('../../config/logger')(_0x8565('0x1'));var moment=require(_0x8565('0x2'));var BPromise=require(_0x8565('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8565('0x4'));var rimraf=require(_0x8565('0x5'));var config=require('../../config/environment');var attributes=require(_0x8565('0x6'));module[_0x8565('0x7')]=function(_0x41a085,_0x2197bb){return _0x41a085[_0x8565('0x8')](_0x8565('0x9'),attributes,{'tableName':_0x8565('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index e5cfcff..0157ea6 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 _0x5fa9=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x3da647,_0xa1a501){var _0x2e91a2=function(_0x34a811){while(--_0x34a811){_0x3da647['push'](_0x3da647['shift']());}};_0x2e91a2(++_0xa1a501);}(_0x5fa9,0x1f3));var _0x95fa=function(_0x30066f,_0x5891c9){_0x30066f=_0x30066f-0x0;var _0x1ad673=_0x5fa9[_0x30066f];return _0x1ad673;};'use strict';var _=require(_0x95fa('0x0'));var util=require(_0x95fa('0x1'));var moment=require(_0x95fa('0x2'));var BPromise=require(_0x95fa('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95fa('0x4'));var db=require(_0x95fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95fa('0x6'))(_0x95fa('0x7'));var config=require(_0x95fa('0x8'));var jayson=require(_0x95fa('0x9'));var client=jayson['client'][_0x95fa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x7d09c5,_0x11feda,_0x166ffa){return new BPromise(function(_0x303189,_0x47afbf){return client[_0x95fa('0xb')](_0x7d09c5,_0x166ffa)[_0x95fa('0xc')](function(_0x2c5b9d){logger[_0x95fa('0xd')](_0x95fa('0xe'),_0x11feda,_0x95fa('0xf'));logger[_0x95fa('0x10')](_0x95fa('0x11'),_0x11feda,_0x95fa('0xf'),JSON[_0x95fa('0x12')](_0x2c5b9d));if(_0x2c5b9d['error']){if(_0x2c5b9d['error'][_0x95fa('0x13')]===0x1f4){logger['error'](_0x95fa('0xe'),_0x11feda,_0x2c5b9d[_0x95fa('0x14')][_0x95fa('0x15')]);return _0x47afbf(_0x2c5b9d[_0x95fa('0x14')]['message']);}logger['error'](_0x95fa('0xe'),_0x11feda,_0x2c5b9d[_0x95fa('0x14')]['message']);return _0x303189(_0x2c5b9d[_0x95fa('0x14')][_0x95fa('0x15')]);}else{logger[_0x95fa('0xd')](_0x95fa('0xe'),_0x11feda,'request\x20sent');_0x303189(_0x2c5b9d[_0x95fa('0x16')]['message']);}})[_0x95fa('0x17')](function(_0x806d86){logger[_0x95fa('0x14')](_0x95fa('0xe'),_0x11feda,_0x806d86);_0x47afbf(_0x806d86);});});} \ No newline at end of file +var _0x358a=['then','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x358a,0x95));var _0xa358=function(_0x3ad6c4,_0x529088){_0x3ad6c4=_0x3ad6c4-0x0;var _0x31b55f=_0x358a[_0x3ad6c4];return _0x31b55f;};'use strict';var _=require(_0xa358('0x0'));var util=require(_0xa358('0x1'));var moment=require(_0xa358('0x2'));var BPromise=require(_0xa358('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa358('0x4'));var db=require(_0xa358('0x5'))['db'];var utils=require(_0xa358('0x6'));var logger=require(_0xa358('0x7'))(_0xa358('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa358('0x9')][_0xa358('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e83e,_0x1bb35a,_0x59fa8d){return new BPromise(function(_0x5d6f8e,_0x4e5e83){return client[_0xa358('0xb')](_0x19e83e,_0x59fa8d)[_0xa358('0xc')](function(_0x2b4f1e){logger['info'](_0xa358('0xd'),_0x1bb35a,'request\x20sent');logger['debug'](_0xa358('0xe'),_0x1bb35a,_0xa358('0xf'),JSON[_0xa358('0x10')](_0x2b4f1e));if(_0x2b4f1e[_0xa358('0x11')]){if(_0x2b4f1e['error'][_0xa358('0x12')]===0x1f4){logger[_0xa358('0x11')](_0xa358('0xd'),_0x1bb35a,_0x2b4f1e[_0xa358('0x11')][_0xa358('0x13')]);return _0x4e5e83(_0x2b4f1e[_0xa358('0x11')][_0xa358('0x13')]);}logger['error'](_0xa358('0xd'),_0x1bb35a,_0x2b4f1e['error'][_0xa358('0x13')]);return _0x5d6f8e(_0x2b4f1e['error'][_0xa358('0x13')]);}else{logger[_0xa358('0x14')](_0xa358('0xd'),_0x1bb35a,_0xa358('0xf'));_0x5d6f8e(_0x2b4f1e[_0xa358('0x15')][_0xa358('0x13')]);}})[_0xa358('0x16')](function(_0x4446cd){logger[_0xa358('0x11')](_0xa358('0xd'),_0x1bb35a,_0x4446cd);_0x4e5e83(_0x4446cd);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index ef5c33a..d1526e0 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 _0x1e8a=['/:id','isAuthenticated','show','post','create','put','update','delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceField.controller','get'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x1e8a,0x75));var _0xa1e8=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x1e8a[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0xa1e8('0x0'));var path=require(_0xa1e8('0x1'));var timeout=require(_0xa1e8('0x2'));var express=require('express');var router=express[_0xa1e8('0x3')]();var fs_extra=require(_0xa1e8('0x4'));var auth=require(_0xa1e8('0x5'));var interaction=require(_0xa1e8('0x6'));var config=require('../../config/environment');var controller=require(_0xa1e8('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa1e8('0x8')](_0xa1e8('0x9'),auth[_0xa1e8('0xa')](),controller[_0xa1e8('0xb')]);router[_0xa1e8('0xc')]('/',auth[_0xa1e8('0xa')](),controller[_0xa1e8('0xd')]);router[_0xa1e8('0xe')](_0xa1e8('0x9'),auth[_0xa1e8('0xa')](),controller[_0xa1e8('0xf')]);router[_0xa1e8('0x10')]('/:id',auth[_0xa1e8('0xa')](),controller[_0xa1e8('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb082=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb082,0x112));var _0x2b08=function(_0x21a589,_0x287a99){_0x21a589=_0x21a589-0x0;var _0x5b3a68=_0xb082[_0x21a589];return _0x5b3a68;};'use strict';var multer=require(_0x2b08('0x0'));var util=require(_0x2b08('0x1'));var path=require('path');var timeout=require(_0x2b08('0x2'));var express=require(_0x2b08('0x3'));var router=express[_0x2b08('0x4')]();var fs_extra=require(_0x2b08('0x5'));var auth=require(_0x2b08('0x6'));var interaction=require(_0x2b08('0x7'));var config=require(_0x2b08('0x8'));var controller=require(_0x2b08('0x9'));router[_0x2b08('0xa')]('/',auth[_0x2b08('0xb')](),controller[_0x2b08('0xc')]);router[_0x2b08('0xa')](_0x2b08('0xd'),auth[_0x2b08('0xb')](),controller[_0x2b08('0xe')]);router['post']('/',auth[_0x2b08('0xb')](),controller[_0x2b08('0xf')]);router[_0x2b08('0x10')](_0x2b08('0xd'),auth['isAuthenticated'](),controller[_0x2b08('0x11')]);router[_0x2b08('0x12')](_0x2b08('0xd'),auth[_0x2b08('0xb')](),controller[_0x2b08('0x13')]);module[_0x2b08('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index b9df1a0..e60aca2 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 _0x4e91=['variable','sequelize','customVariable','picklist','STRING','string'];(function(_0x5c6272,_0xd82df5){var _0x19c236=function(_0x332352){while(--_0x332352){_0x5c6272['push'](_0x5c6272['shift']());}};_0x19c236(++_0xd82df5);}(_0x4e91,0x157));var _0x14e9=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x4e91[_0x4b7b69];return _0x173b4c;};'use strict';var Sequelize=require(_0x14e9('0x0'));module['exports']={'type':{'type':Sequelize['ENUM']('string','variable',_0x14e9('0x1'),'keyValue',_0x14e9('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x14e9('0x3')]},'key':{'type':Sequelize[_0x14e9('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x14e9('0x4'),_0x14e9('0x5'),_0x14e9('0x1'))},'keyContent':{'type':Sequelize[_0x14e9('0x3')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x14e9('0x3')]}}; \ No newline at end of file +var _0x828a=['variable','customVariable','picklist','STRING','sequelize','exports','ENUM','string'];(function(_0x5ea9dd,_0x48db12){var _0xf08e7d=function(_0x185de3){while(--_0x185de3){_0x5ea9dd['push'](_0x5ea9dd['shift']());}};_0xf08e7d(++_0x48db12);}(_0x828a,0x1c4));var _0xa828=function(_0x198a60,_0x33fca7){_0x198a60=_0x198a60-0x0;var _0x45dfa8=_0x828a[_0x198a60];return _0x45dfa8;};'use strict';var Sequelize=require(_0xa828('0x0'));module[_0xa828('0x1')]={'type':{'type':Sequelize[_0xa828('0x2')](_0xa828('0x3'),_0xa828('0x4'),_0xa828('0x5'),'keyValue',_0xa828('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa828('0x7')]},'keyType':{'type':Sequelize[_0xa828('0x2')](_0xa828('0x3'),_0xa828('0x4'),_0xa828('0x5'))},'keyContent':{'type':Sequelize[_0xa828('0x7')]},'idField':{'type':Sequelize[_0xa828('0x7')]},'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 203ffe1..7c111e0 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 _0x5558=['api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SalesforceField','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','order','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','body','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x905c3e,_0x568bac){var _0x435b47=function(_0x13ca3c){while(--_0x13ca3c){_0x905c3e['push'](_0x905c3e['shift']());}};_0x435b47(++_0x568bac);}(_0x5558,0x7e));var _0x8555=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x5558[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8555('0x0'));var jsonpatch=require(_0x8555('0x1'));var rp=require('request-promise');var moment=require(_0x8555('0x2'));var BPromise=require(_0x8555('0x3'));var Mustache=require('mustache');var util=require(_0x8555('0x4'));var path=require('path');var sox=require(_0x8555('0x5'));var csv=require(_0x8555('0x6'));var ejs=require(_0x8555('0x7'));var fs=require('fs');var fs_extra=require(_0x8555('0x8'));var _=require(_0x8555('0x9'));var squel=require(_0x8555('0xa'));var crypto=require('crypto');var jsforce=require(_0x8555('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8555('0x6'));var querystring=require(_0x8555('0xc'));var Papa=require(_0x8555('0xd'));var Redis=require(_0x8555('0xe'));var authService=require(_0x8555('0xf'));var qs=require(_0x8555('0x10'));var as=require(_0x8555('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8555('0x12'));var utils=require('../../config/utils');var config=require(_0x8555('0x13'));var licenseUtil=require(_0x8555('0x14'));var db=require(_0x8555('0x15'))['db'];function respondWithStatusCode(_0x5a2089,_0x54b30d){_0x54b30d=_0x54b30d||0xcc;return function(_0x186d54){if(_0x186d54){return _0x5a2089['sendStatus'](_0x54b30d);}return _0x5a2089[_0x8555('0x16')](_0x54b30d)[_0x8555('0x17')]();};}function respondWithResult(_0x568b7a,_0x4d0067){_0x4d0067=_0x4d0067||0xc8;return function(_0x38b428){if(_0x38b428){return _0x568b7a['status'](_0x4d0067)['json'](_0x38b428);}};}function respondWithFilteredResult(_0x160325,_0x2d7a39){return function(_0x49e330){if(_0x49e330){var _0x355622=typeof _0x2d7a39[_0x8555('0x18')]===_0x8555('0x19')&&typeof _0x2d7a39[_0x8555('0x1a')]===_0x8555('0x19');var _0x24cf3f=_0x49e330[_0x8555('0x1b')];var _0x24b9f1=_0x355622?0x0:_0x2d7a39['offset'];var _0x6a34e=_0x355622?_0x49e330[_0x8555('0x1b')]:_0x2d7a39[_0x8555('0x18')]+_0x2d7a39[_0x8555('0x1a')];var _0x5097b6;if(_0x6a34e>=_0x24cf3f){_0x6a34e=_0x24cf3f;_0x5097b6=0xc8;}else{_0x5097b6=0xce;}_0x160325[_0x8555('0x16')](_0x5097b6);return _0x160325[_0x8555('0x1c')](_0x8555('0x1d'),_0x24b9f1+'-'+_0x6a34e+'/'+_0x24cf3f)[_0x8555('0x1e')](_0x49e330);}return null;};}function patchUpdates(_0x11ea9f){return function(_0xce3518){try{jsonpatch[_0x8555('0x1f')](_0xce3518,_0x11ea9f,!![]);}catch(_0x3e132a){return BPromise[_0x8555('0x20')](_0x3e132a);}return _0xce3518[_0x8555('0x21')]();};}function saveUpdates(_0x4fb394,_0x3a2ca2){return function(_0x17ac4d){if(_0x17ac4d){return _0x17ac4d[_0x8555('0x22')](_0x4fb394)[_0x8555('0x23')](function(_0x5cf6e9){return _0x5cf6e9;});}return null;};}function removeEntity(_0x36daa1,_0x4bdfee){return function(_0x3d8a63){if(_0x3d8a63){return _0x3d8a63[_0x8555('0x24')]()[_0x8555('0x23')](function(){_0x36daa1[_0x8555('0x16')](0xcc)[_0x8555('0x17')]();});}};}function handleEntityNotFound(_0x543327,_0x5b2283){return function(_0x255e83){if(!_0x255e83){_0x543327[_0x8555('0x25')](0x194);}return _0x255e83;};}function handleError(_0x113812,_0x3a8916){_0x3a8916=_0x3a8916||0x1f4;return function(_0x830f66){logger[_0x8555('0x26')](_0x830f66[_0x8555('0x27')]);if(_0x830f66[_0x8555('0x28')]){delete _0x830f66[_0x8555('0x28')];}_0x113812[_0x8555('0x16')](_0x3a8916)[_0x8555('0x29')](_0x830f66);};}exports[_0x8555('0x2a')]=function(_0x10454d,_0x4e19ca){var _0x305d85={},_0x9e1914={},_0x21320d={'count':0x0,'rows':[]};var _0x114990=_[_0x8555('0x2b')](db[_0x8555('0x2c')][_0x8555('0x2d')],function(_0x21e719){return{'name':_0x21e719['fieldName'],'type':_0x21e719[_0x8555('0x2e')][_0x8555('0x2f')]};});_0x9e1914['model']=_[_0x8555('0x2b')](_0x114990,_0x8555('0x28'));_0x9e1914[_0x8555('0x30')]=_[_0x8555('0x31')](_0x10454d['query']);_0x9e1914[_0x8555('0x32')]=_[_0x8555('0x33')](_0x9e1914[_0x8555('0x34')],_0x9e1914[_0x8555('0x30')]);_0x305d85['attributes']=_['intersection'](_0x9e1914[_0x8555('0x34')],qs[_0x8555('0x35')](_0x10454d[_0x8555('0x30')][_0x8555('0x35')]));_0x305d85[_0x8555('0x36')]=_0x305d85[_0x8555('0x36')][_0x8555('0x37')]?_0x305d85[_0x8555('0x36')]:_0x9e1914['model'];if(!_0x10454d['query']['hasOwnProperty']('nolimit')){_0x305d85[_0x8555('0x1a')]=qs[_0x8555('0x1a')](_0x10454d[_0x8555('0x30')][_0x8555('0x1a')]);_0x305d85[_0x8555('0x18')]=qs[_0x8555('0x18')](_0x10454d[_0x8555('0x30')][_0x8555('0x18')]);}_0x305d85[_0x8555('0x38')]=qs['sort'](_0x10454d[_0x8555('0x30')]['sort']);_0x305d85[_0x8555('0x39')]=qs['filters'](_[_0x8555('0x3a')](_0x10454d[_0x8555('0x30')],_0x9e1914[_0x8555('0x32')]),_0x114990);if(_0x10454d['query'][_0x8555('0x3b')]){_0x305d85['where']=_[_0x8555('0x3c')](_0x305d85[_0x8555('0x39')],{'$or':_[_0x8555('0x2b')](_0x114990,function(_0x335a26){if(_0x335a26[_0x8555('0x2e')]!==_0x8555('0x3d')){var _0xd520de={};_0xd520de[_0x335a26['name']]={'$like':'%'+_0x10454d[_0x8555('0x30')][_0x8555('0x3b')]+'%'};return _0xd520de;}})});}_0x305d85=_[_0x8555('0x3c')]({},_0x305d85,_0x10454d['options']);var _0x2fbfa5={'where':_0x305d85[_0x8555('0x39')]};return db['SalesforceField'][_0x8555('0x1b')](_0x2fbfa5)[_0x8555('0x23')](function(_0x2b71b5){_0x21320d[_0x8555('0x1b')]=_0x2b71b5;if(_0x10454d[_0x8555('0x30')][_0x8555('0x3e')]){_0x305d85[_0x8555('0x3f')]=[{'all':!![]}];}return db['SalesforceField'][_0x8555('0x40')](_0x305d85);})[_0x8555('0x23')](function(_0x30a1c7){_0x21320d[_0x8555('0x41')]=_0x30a1c7;return _0x21320d;})[_0x8555('0x23')](respondWithFilteredResult(_0x4e19ca,_0x305d85))[_0x8555('0x42')](handleError(_0x4e19ca,null));};exports[_0x8555('0x43')]=function(_0x51e46d,_0x44c014){var _0x58feff={'raw':!![],'where':{'id':_0x51e46d[_0x8555('0x44')]['id']}},_0xfff3a9={};_0xfff3a9[_0x8555('0x34')]=_[_0x8555('0x31')](db[_0x8555('0x2c')][_0x8555('0x2d')]);_0xfff3a9[_0x8555('0x30')]=_[_0x8555('0x31')](_0x51e46d[_0x8555('0x30')]);_0xfff3a9['filters']=_[_0x8555('0x33')](_0xfff3a9[_0x8555('0x34')],_0xfff3a9['query']);_0x58feff[_0x8555('0x36')]=_[_0x8555('0x33')](_0xfff3a9[_0x8555('0x34')],qs[_0x8555('0x35')](_0x51e46d[_0x8555('0x30')][_0x8555('0x35')]));_0x58feff[_0x8555('0x36')]=_0x58feff['attributes'][_0x8555('0x37')]?_0x58feff[_0x8555('0x36')]:_0xfff3a9[_0x8555('0x34')];if(_0x51e46d[_0x8555('0x30')][_0x8555('0x3e')]){_0x58feff[_0x8555('0x3f')]=[{'all':!![]}];}_0x58feff=_[_0x8555('0x3c')]({},_0x58feff,_0x51e46d[_0x8555('0x45')]);return db['SalesforceField'][_0x8555('0x46')](_0x58feff)[_0x8555('0x23')](handleEntityNotFound(_0x44c014,null))[_0x8555('0x23')](respondWithResult(_0x44c014,null))[_0x8555('0x42')](handleError(_0x44c014,null));};exports['create']=function(_0x112987,_0x465800){return db[_0x8555('0x2c')]['create'](_0x112987['body'],{})[_0x8555('0x23')](respondWithResult(_0x465800,0xc9))[_0x8555('0x42')](handleError(_0x465800,null));};exports['update']=function(_0x246c95,_0x4a40c6){if(_0x246c95['body']['id']){delete _0x246c95[_0x8555('0x47')]['id'];}return db[_0x8555('0x2c')][_0x8555('0x46')]({'where':{'id':_0x246c95['params']['id']}})['then'](handleEntityNotFound(_0x4a40c6,null))[_0x8555('0x23')](saveUpdates(_0x246c95[_0x8555('0x47')],null))['then'](respondWithResult(_0x4a40c6,null))[_0x8555('0x42')](handleError(_0x4a40c6,null));};exports[_0x8555('0x24')]=function(_0xd9e296,_0x2907b9){return db[_0x8555('0x2c')][_0x8555('0x46')]({'where':{'id':_0xd9e296[_0x8555('0x44')]['id']}})[_0x8555('0x23')](handleEntityNotFound(_0x2907b9,null))['then'](removeEntity(_0x2907b9,null))[_0x8555('0x42')](handleError(_0x2907b9,null));}; \ No newline at end of file +var _0x8b76=['json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','SalesforceField','rawAttributes','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','end','offset','limit','undefined','count','status','set','Content-Range'];(function(_0x3c7d53,_0x2826d0){var _0x2c8387=function(_0x21f0e8){while(--_0x21f0e8){_0x3c7d53['push'](_0x3c7d53['shift']());}};_0x2c8387(++_0x2826d0);}(_0x8b76,0x104));var _0x68b7=function(_0x2648d6,_0x3f62a8){_0x2648d6=_0x2648d6-0x0;var _0x3e2222=_0x8b76[_0x2648d6];return _0x3e2222;};'use strict';var emlformat=require(_0x68b7('0x0'));var rimraf=require(_0x68b7('0x1'));var zipdir=require(_0x68b7('0x2'));var jsonpatch=require(_0x68b7('0x3'));var rp=require(_0x68b7('0x4'));var moment=require('moment');var BPromise=require(_0x68b7('0x5'));var Mustache=require('mustache');var util=require(_0x68b7('0x6'));var path=require(_0x68b7('0x7'));var sox=require(_0x68b7('0x8'));var csv=require(_0x68b7('0x9'));var ejs=require(_0x68b7('0xa'));var fs=require('fs');var fs_extra=require(_0x68b7('0xb'));var _=require(_0x68b7('0xc'));var squel=require(_0x68b7('0xd'));var crypto=require(_0x68b7('0xe'));var jsforce=require(_0x68b7('0xf'));var deskjs=require(_0x68b7('0x10'));var toCsv=require('to-csv');var querystring=require(_0x68b7('0x11'));var Papa=require('papaparse');var Redis=require(_0x68b7('0x12'));var authService=require(_0x68b7('0x13'));var qs=require(_0x68b7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68b7('0x15'));var logger=require('../../config/logger')(_0x68b7('0x16'));var utils=require('../../config/utils');var config=require(_0x68b7('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1867af,_0x2c74b5){_0x2c74b5=_0x2c74b5||0xcc;return function(_0x14a463){if(_0x14a463){return _0x1867af['sendStatus'](_0x2c74b5);}return _0x1867af['status'](_0x2c74b5)[_0x68b7('0x18')]();};}function respondWithResult(_0x23f1af,_0xf6920a){_0xf6920a=_0xf6920a||0xc8;return function(_0x47162c){if(_0x47162c){return _0x23f1af['status'](_0xf6920a)['json'](_0x47162c);}};}function respondWithFilteredResult(_0x11ccb4,_0x1c35f9){return function(_0x1e2ff8){if(_0x1e2ff8){var _0x2dfa30=typeof _0x1c35f9[_0x68b7('0x19')]==='undefined'&&typeof _0x1c35f9[_0x68b7('0x1a')]===_0x68b7('0x1b');var _0x21e144=_0x1e2ff8[_0x68b7('0x1c')];var _0x23755d=_0x2dfa30?0x0:_0x1c35f9['offset'];var _0x2dad13=_0x2dfa30?_0x1e2ff8[_0x68b7('0x1c')]:_0x1c35f9[_0x68b7('0x19')]+_0x1c35f9['limit'];var _0x491425;if(_0x2dad13>=_0x21e144){_0x2dad13=_0x21e144;_0x491425=0xc8;}else{_0x491425=0xce;}_0x11ccb4[_0x68b7('0x1d')](_0x491425);return _0x11ccb4[_0x68b7('0x1e')](_0x68b7('0x1f'),_0x23755d+'-'+_0x2dad13+'/'+_0x21e144)[_0x68b7('0x20')](_0x1e2ff8);}return null;};}function patchUpdates(_0x310485){return function(_0x619714){try{jsonpatch[_0x68b7('0x21')](_0x619714,_0x310485,!![]);}catch(_0x306486){return BPromise[_0x68b7('0x22')](_0x306486);}return _0x619714[_0x68b7('0x23')]();};}function saveUpdates(_0x48b00e,_0x42fb11){return function(_0x31b2a4){if(_0x31b2a4){return _0x31b2a4[_0x68b7('0x24')](_0x48b00e)['then'](function(_0x154f64){return _0x154f64;});}return null;};}function removeEntity(_0x1e033a,_0x22758b){return function(_0x482f47){if(_0x482f47){return _0x482f47[_0x68b7('0x25')]()[_0x68b7('0x26')](function(){_0x1e033a[_0x68b7('0x1d')](0xcc)[_0x68b7('0x18')]();});}};}function handleEntityNotFound(_0x2b1560,_0x3041eb){return function(_0x598d5c){if(!_0x598d5c){_0x2b1560[_0x68b7('0x27')](0x194);}return _0x598d5c;};}function handleError(_0x1178f3,_0x1ced8c){_0x1ced8c=_0x1ced8c||0x1f4;return function(_0x13d690){logger[_0x68b7('0x28')](_0x13d690['stack']);if(_0x13d690[_0x68b7('0x29')]){delete _0x13d690[_0x68b7('0x29')];}_0x1178f3[_0x68b7('0x1d')](_0x1ced8c)[_0x68b7('0x2a')](_0x13d690);};}exports[_0x68b7('0x2b')]=function(_0x15c502,_0x4d0646){var _0x40d7d0={},_0x529f16={},_0x43636c={'count':0x0,'rows':[]};var _0x4fbeed=_[_0x68b7('0x2c')](db[_0x68b7('0x2d')][_0x68b7('0x2e')],function(_0x1127ab){return{'name':_0x1127ab['fieldName'],'type':_0x1127ab[_0x68b7('0x2f')]['key']};});_0x529f16[_0x68b7('0x30')]=_['map'](_0x4fbeed,_0x68b7('0x29'));_0x529f16[_0x68b7('0x31')]=_['keys'](_0x15c502[_0x68b7('0x31')]);_0x529f16['filters']=_[_0x68b7('0x32')](_0x529f16[_0x68b7('0x30')],_0x529f16[_0x68b7('0x31')]);_0x40d7d0[_0x68b7('0x33')]=_['intersection'](_0x529f16[_0x68b7('0x30')],qs[_0x68b7('0x34')](_0x15c502[_0x68b7('0x31')][_0x68b7('0x34')]));_0x40d7d0[_0x68b7('0x33')]=_0x40d7d0[_0x68b7('0x33')][_0x68b7('0x35')]?_0x40d7d0[_0x68b7('0x33')]:_0x529f16[_0x68b7('0x30')];if(!_0x15c502[_0x68b7('0x31')][_0x68b7('0x36')](_0x68b7('0x37'))){_0x40d7d0[_0x68b7('0x1a')]=qs[_0x68b7('0x1a')](_0x15c502[_0x68b7('0x31')][_0x68b7('0x1a')]);_0x40d7d0[_0x68b7('0x19')]=qs[_0x68b7('0x19')](_0x15c502[_0x68b7('0x31')][_0x68b7('0x19')]);}_0x40d7d0[_0x68b7('0x38')]=qs[_0x68b7('0x39')](_0x15c502[_0x68b7('0x31')][_0x68b7('0x39')]);_0x40d7d0[_0x68b7('0x3a')]=qs[_0x68b7('0x3b')](_['pick'](_0x15c502[_0x68b7('0x31')],_0x529f16[_0x68b7('0x3b')]),_0x4fbeed);if(_0x15c502[_0x68b7('0x31')][_0x68b7('0x3c')]){_0x40d7d0[_0x68b7('0x3a')]=_[_0x68b7('0x3d')](_0x40d7d0[_0x68b7('0x3a')],{'$or':_['map'](_0x4fbeed,function(_0x3bb263){if(_0x3bb263[_0x68b7('0x2f')]!=='VIRTUAL'){var _0x18db6d={};_0x18db6d[_0x3bb263['name']]={'$like':'%'+_0x15c502[_0x68b7('0x31')][_0x68b7('0x3c')]+'%'};return _0x18db6d;}})});}_0x40d7d0=_[_0x68b7('0x3d')]({},_0x40d7d0,_0x15c502[_0x68b7('0x3e')]);var _0x594eed={'where':_0x40d7d0[_0x68b7('0x3a')]};return db[_0x68b7('0x2d')][_0x68b7('0x1c')](_0x594eed)[_0x68b7('0x26')](function(_0x123e95){_0x43636c[_0x68b7('0x1c')]=_0x123e95;if(_0x15c502[_0x68b7('0x31')][_0x68b7('0x3f')]){_0x40d7d0[_0x68b7('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x68b7('0x41')](_0x40d7d0);})[_0x68b7('0x26')](function(_0x4f78f8){_0x43636c[_0x68b7('0x42')]=_0x4f78f8;return _0x43636c;})[_0x68b7('0x26')](respondWithFilteredResult(_0x4d0646,_0x40d7d0))[_0x68b7('0x43')](handleError(_0x4d0646,null));};exports['show']=function(_0x3c8ec7,_0xf6e803){var _0x16abdd={'raw':!![],'where':{'id':_0x3c8ec7[_0x68b7('0x44')]['id']}},_0x3ed76c={};_0x3ed76c['model']=_[_0x68b7('0x45')](db[_0x68b7('0x2d')][_0x68b7('0x2e')]);_0x3ed76c[_0x68b7('0x31')]=_[_0x68b7('0x45')](_0x3c8ec7[_0x68b7('0x31')]);_0x3ed76c['filters']=_['intersection'](_0x3ed76c[_0x68b7('0x30')],_0x3ed76c[_0x68b7('0x31')]);_0x16abdd[_0x68b7('0x33')]=_[_0x68b7('0x32')](_0x3ed76c[_0x68b7('0x30')],qs['fields'](_0x3c8ec7[_0x68b7('0x31')][_0x68b7('0x34')]));_0x16abdd[_0x68b7('0x33')]=_0x16abdd['attributes'][_0x68b7('0x35')]?_0x16abdd[_0x68b7('0x33')]:_0x3ed76c[_0x68b7('0x30')];if(_0x3c8ec7[_0x68b7('0x31')][_0x68b7('0x3f')]){_0x16abdd[_0x68b7('0x40')]=[{'all':!![]}];}_0x16abdd=_[_0x68b7('0x3d')]({},_0x16abdd,_0x3c8ec7[_0x68b7('0x3e')]);return db[_0x68b7('0x2d')][_0x68b7('0x46')](_0x16abdd)['then'](handleEntityNotFound(_0xf6e803,null))[_0x68b7('0x26')](respondWithResult(_0xf6e803,null))[_0x68b7('0x43')](handleError(_0xf6e803,null));};exports[_0x68b7('0x47')]=function(_0x38d76c,_0x224812){return db[_0x68b7('0x2d')][_0x68b7('0x47')](_0x38d76c[_0x68b7('0x48')],{})[_0x68b7('0x26')](respondWithResult(_0x224812,0xc9))[_0x68b7('0x43')](handleError(_0x224812,null));};exports['update']=function(_0x7fddb3,_0x7e885){if(_0x7fddb3[_0x68b7('0x48')]['id']){delete _0x7fddb3[_0x68b7('0x48')]['id'];}return db[_0x68b7('0x2d')][_0x68b7('0x46')]({'where':{'id':_0x7fddb3[_0x68b7('0x44')]['id']}})['then'](handleEntityNotFound(_0x7e885,null))['then'](saveUpdates(_0x7fddb3[_0x68b7('0x48')],null))[_0x68b7('0x26')](respondWithResult(_0x7e885,null))['catch'](handleError(_0x7e885,null));};exports[_0x68b7('0x25')]=function(_0x52134e,_0x590dce){return db[_0x68b7('0x2d')][_0x68b7('0x46')]({'where':{'id':_0x52134e[_0x68b7('0x44')]['id']}})[_0x68b7('0x26')](handleEntityNotFound(_0x590dce,null))[_0x68b7('0x26')](removeEntity(_0x590dce,null))[_0x68b7('0x43')](handleError(_0x590dce,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index a4d3168..f3a4525 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 _0x3dcc=['request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','api','moment','bluebird'];(function(_0x49ec46,_0x5053f9){var _0x537d69=function(_0x1707fe){while(--_0x1707fe){_0x49ec46['push'](_0x49ec46['shift']());}};_0x537d69(++_0x5053f9);}(_0x3dcc,0x64));var _0xc3dc=function(_0x56e32e,_0x9eb2f6){_0x56e32e=_0x56e32e-0x0;var _0x2a757b=_0x3dcc[_0x56e32e];return _0x2a757b;};'use strict';var _=require(_0xc3dc('0x0'));var util=require(_0xc3dc('0x1'));var logger=require('../../config/logger')(_0xc3dc('0x2'));var moment=require(_0xc3dc('0x3'));var BPromise=require(_0xc3dc('0x4'));var rp=require(_0xc3dc('0x5'));var fs=require('fs');var path=require(_0xc3dc('0x6'));var rimraf=require(_0xc3dc('0x7'));var config=require(_0xc3dc('0x8'));var attributes=require('./intSalesforceField.attributes');module[_0xc3dc('0x9')]=function(_0x64bdaa,_0x57bd5d){return _0x64bdaa[_0xc3dc('0xa')](_0xc3dc('0xb'),attributes,{'tableName':_0xc3dc('0xc'),'paranoid':![],'indexes':[{'name':_0xc3dc('0xd'),'fields':[_0xc3dc('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe8f1=['moment','bluebird','request-promise','path','rimraf','exports','define','SalesforceField','idField','FieldId','lodash','util','../../config/logger'];(function(_0x85fe14,_0x3f4086){var _0x46f0cc=function(_0x2a9a91){while(--_0x2a9a91){_0x85fe14['push'](_0x85fe14['shift']());}};_0x46f0cc(++_0x3f4086);}(_0xe8f1,0x128));var _0x1e8f=function(_0x1c4a44,_0x15abd4){_0x1c4a44=_0x1c4a44-0x0;var _0x2009f5=_0xe8f1[_0x1c4a44];return _0x2009f5;};'use strict';var _=require(_0x1e8f('0x0'));var util=require(_0x1e8f('0x1'));var logger=require(_0x1e8f('0x2'))('api');var moment=require(_0x1e8f('0x3'));var BPromise=require(_0x1e8f('0x4'));var rp=require(_0x1e8f('0x5'));var fs=require('fs');var path=require(_0x1e8f('0x6'));var rimraf=require(_0x1e8f('0x7'));var config=require('../../config/environment');var attributes=require('./intSalesforceField.attributes');module[_0x1e8f('0x8')]=function(_0x3fb756,_0x111eff){return _0x3fb756[_0x1e8f('0x9')](_0x1e8f('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x1e8f('0xb'),_0x1e8f('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 2f71475..343ff5a 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 _0x8c5f=['../../config/environment','request','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x253c71,_0x41784c){var _0x305a6c=function(_0x389d7e){while(--_0x389d7e){_0x253c71['push'](_0x253c71['shift']());}};_0x305a6c(++_0x41784c);}(_0x8c5f,0x7f));var _0xf8c5=function(_0x3e33b3,_0x3ff7c4){_0x3e33b3=_0x3e33b3-0x0;var _0x122c13=_0x8c5f[_0x3e33b3];return _0x122c13;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf8c5('0x0'));var BPromise=require(_0xf8c5('0x1'));var rs=require(_0xf8c5('0x2'));var fs=require('fs');var Redis=require(_0xf8c5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf8c5('0x4'))(_0xf8c5('0x5'));var config=require(_0xf8c5('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x179640,_0xe7380c,_0x353609){return new BPromise(function(_0x5b7b6c,_0x2550e1){return client[_0xf8c5('0x7')](_0x179640,_0x353609)['then'](function(_0xf0f315){logger['info']('SalesforceField,\x20%s,\x20%s',_0xe7380c,_0xf8c5('0x8'));logger[_0xf8c5('0x9')](_0xf8c5('0xa'),_0xe7380c,_0xf8c5('0x8'),JSON[_0xf8c5('0xb')](_0xf0f315));if(_0xf0f315[_0xf8c5('0xc')]){if(_0xf0f315[_0xf8c5('0xc')][_0xf8c5('0xd')]===0x1f4){logger[_0xf8c5('0xc')](_0xf8c5('0xe'),_0xe7380c,_0xf0f315[_0xf8c5('0xc')]['message']);return _0x2550e1(_0xf0f315['error']['message']);}logger[_0xf8c5('0xc')](_0xf8c5('0xe'),_0xe7380c,_0xf0f315['error']['message']);return _0x5b7b6c(_0xf0f315['error'][_0xf8c5('0xf')]);}else{logger[_0xf8c5('0x10')](_0xf8c5('0xe'),_0xe7380c,'request\x20sent');_0x5b7b6c(_0xf0f315[_0xf8c5('0x11')][_0xf8c5('0xf')]);}})[_0xf8c5('0x12')](function(_0x573958){logger[_0xf8c5('0xc')](_0xf8c5('0xe'),_0xe7380c,_0x573958);_0x2550e1(_0x573958);});});} \ No newline at end of file +var _0xbf2c=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','error','SalesforceField,\x20%s,\x20%s','message','request\x20sent','catch','util','moment'];(function(_0x31e8aa,_0x4cfff8){var _0x59587a=function(_0x3a256f){while(--_0x3a256f){_0x31e8aa['push'](_0x31e8aa['shift']());}};_0x59587a(++_0x4cfff8);}(_0xbf2c,0x75));var _0xcbf2=function(_0x55107e,_0x210c83){_0x55107e=_0x55107e-0x0;var _0x118ef9=_0xbf2c[_0x55107e];return _0x118ef9;};'use strict';var _=require('lodash');var util=require(_0xcbf2('0x0'));var moment=require(_0xcbf2('0x1'));var BPromise=require('bluebird');var rs=require(_0xcbf2('0x2'));var fs=require('fs');var Redis=require(_0xcbf2('0x3'));var db=require(_0xcbf2('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbf2('0x5'))('rpc');var config=require(_0xcbf2('0x6'));var jayson=require(_0xcbf2('0x7'));var client=jayson[_0xcbf2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xdb05c2,_0x1500ec,_0x5e40c4){return new BPromise(function(_0x4b1b95,_0x2aea8f){return client[_0xcbf2('0x9')](_0xdb05c2,_0x5e40c4)['then'](function(_0x6695fb){logger[_0xcbf2('0xa')]('SalesforceField,\x20%s,\x20%s',_0x1500ec,'request\x20sent');logger[_0xcbf2('0xb')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x1500ec,'request\x20sent',JSON['stringify'](_0x6695fb));if(_0x6695fb[_0xcbf2('0xc')]){if(_0x6695fb['error']['code']===0x1f4){logger[_0xcbf2('0xc')](_0xcbf2('0xd'),_0x1500ec,_0x6695fb[_0xcbf2('0xc')][_0xcbf2('0xe')]);return _0x2aea8f(_0x6695fb[_0xcbf2('0xc')][_0xcbf2('0xe')]);}logger['error'](_0xcbf2('0xd'),_0x1500ec,_0x6695fb[_0xcbf2('0xc')][_0xcbf2('0xe')]);return _0x4b1b95(_0x6695fb['error']['message']);}else{logger[_0xcbf2('0xa')](_0xcbf2('0xd'),_0x1500ec,_0xcbf2('0xf'));_0x4b1b95(_0x6695fb['result'][_0xcbf2('0xe')]);}})[_0xcbf2('0x10')](function(_0x6575be){logger[_0xcbf2('0xc')](_0xcbf2('0xd'),_0x1500ec,_0x6575be);_0x2aea8f(_0x6575be);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 30dd4f1..7d1d21e 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 _0x7ebf=['index','/:id','show','getConfigurations','/:id/fields','post','/:id/configurations','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x7ebf,0x1da));var _0xf7eb=function(_0x93813a,_0x42999a){_0x93813a=_0x93813a-0x0;var _0x201d7b=_0x7ebf[_0x93813a];return _0x201d7b;};'use strict';var multer=require(_0xf7eb('0x0'));var util=require(_0xf7eb('0x1'));var path=require('path');var timeout=require(_0xf7eb('0x2'));var express=require(_0xf7eb('0x3'));var router=express[_0xf7eb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf7eb('0x5'));var interaction=require(_0xf7eb('0x6'));var config=require('../../config/environment');var controller=require('./intServicenowAccount.controller');router[_0xf7eb('0x7')]('/',auth[_0xf7eb('0x8')](),controller[_0xf7eb('0x9')]);router[_0xf7eb('0x7')](_0xf7eb('0xa'),auth[_0xf7eb('0x8')](),controller[_0xf7eb('0xb')]);router[_0xf7eb('0x7')]('/:id/configurations',auth[_0xf7eb('0x8')](),controller[_0xf7eb('0xc')]);router['get'](_0xf7eb('0xd'),auth[_0xf7eb('0x8')](),controller['getFields']);router[_0xf7eb('0xe')]('/',auth[_0xf7eb('0x8')](),controller['create']);router[_0xf7eb('0xe')](_0xf7eb('0xf'),auth[_0xf7eb('0x8')](),controller['addConfiguration']);router[_0xf7eb('0x10')](_0xf7eb('0xa'),auth[_0xf7eb('0x8')](),controller[_0xf7eb('0x11')]);router[_0xf7eb('0x12')](_0xf7eb('0xa'),auth['isAuthenticated'](),controller[_0xf7eb('0x13')]);module[_0xf7eb('0x14')]=router; \ No newline at end of file +var _0xbe9a=['update','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put'];(function(_0x159c2f,_0xd39d20){var _0x591f68=function(_0x161ba6){while(--_0x161ba6){_0x159c2f['push'](_0x159c2f['shift']());}};_0x591f68(++_0xd39d20);}(_0xbe9a,0x1a4));var _0xabe9=function(_0x1d029e,_0x312098){_0x1d029e=_0x1d029e-0x0;var _0x582436=_0xbe9a[_0x1d029e];return _0x582436;};'use strict';var multer=require(_0xabe9('0x0'));var util=require('util');var path=require(_0xabe9('0x1'));var timeout=require(_0xabe9('0x2'));var express=require(_0xabe9('0x3'));var router=express['Router']();var fs_extra=require(_0xabe9('0x4'));var auth=require(_0xabe9('0x5'));var interaction=require(_0xabe9('0x6'));var config=require(_0xabe9('0x7'));var controller=require('./intServicenowAccount.controller');router[_0xabe9('0x8')]('/',auth[_0xabe9('0x9')](),controller[_0xabe9('0xa')]);router[_0xabe9('0x8')](_0xabe9('0xb'),auth[_0xabe9('0x9')](),controller[_0xabe9('0xc')]);router[_0xabe9('0x8')](_0xabe9('0xd'),auth['isAuthenticated'](),controller[_0xabe9('0xe')]);router[_0xabe9('0x8')](_0xabe9('0xf'),auth[_0xabe9('0x9')](),controller[_0xabe9('0x10')]);router[_0xabe9('0x11')]('/',auth[_0xabe9('0x9')](),controller['create']);router[_0xabe9('0x11')](_0xabe9('0xd'),auth['isAuthenticated'](),controller[_0xabe9('0x12')]);router[_0xabe9('0x13')](_0xabe9('0xb'),auth[_0xabe9('0x9')](),controller[_0xabe9('0x14')]);router['delete'](_0xabe9('0xb'),auth[_0xabe9('0x9')](),controller[_0xabe9('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 1590ec1..9a5ba8f 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 _0x146c=['STRING','remoteUri','exports'];(function(_0x3afe18,_0x26922c){var _0x19ed1f=function(_0x1c0660){while(--_0x1c0660){_0x3afe18['push'](_0x3afe18['shift']());}};_0x19ed1f(++_0x26922c);}(_0x146c,0xd7));var _0xc146=function(_0x4e07a1,_0x1e41c4){_0x4e07a1=_0x4e07a1-0x0;var _0x3c3d8b=_0x146c[_0x4e07a1];return _0x3c3d8b;};'use strict';var Sequelize=require('sequelize');module[_0xc146('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc146('0x1')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc146('0x1')]},'remoteUri':{'type':Sequelize[_0xc146('0x1')],'unique':_0xc146('0x2')},'serverUrl':{'type':Sequelize[_0xc146('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc538=['remoteUri','sequelize','STRING','username'];(function(_0x55be7d,_0x1f4bdc){var _0x3c2b12=function(_0x57993d){while(--_0x57993d){_0x55be7d['push'](_0x55be7d['shift']());}};_0x3c2b12(++_0x1f4bdc);}(_0xc538,0x185));var _0x8c53=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xc538[_0x5c3c0b];return _0x52ecd2;};'use strict';var Sequelize=require(_0x8c53('0x0'));module['exports']={'name':{'type':Sequelize[_0x8c53('0x1')]},'description':{'type':Sequelize[_0x8c53('0x1')]},'username':{'type':Sequelize[_0x8c53('0x1')],'unique':_0x8c53('0x2')},'password':{'type':Sequelize[_0x8c53('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x8c53('0x1')],'unique':_0x8c53('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b3bae64..9b1c486 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 _0x2fca=['../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','name','ServicenowAccount','fieldName','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','rawAttributes','find','create','body','findOne','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowConfiguration','ServicenowField','Descriptions','getFields','made_sla','hold_reason','knowledge','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','order','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','caller_id','approval_set','subcategory','work_notes','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','notify','sys_class_name','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','assigned_to','comments','sla_due','approval','comments_and_work_notes','due_date','sys_tags','escalation','upon_approval','correlation_id','username','password','remoteUri','slice','lastIndexOf','%s/api/now/doc/table/schema/','incident?sysparm_display_value=all','result','remove','includes','internalType','label','push','all','assign','log','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','true','False','false','GET','forEach','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment'];(function(_0x30d05d,_0x3cceb9){var _0xddaf4b=function(_0x5a6f8f){while(--_0x5a6f8f){_0x30d05d['push'](_0x30d05d['shift']());}};_0xddaf4b(++_0x3cceb9);}(_0x2fca,0x155));var _0xa2fc=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2fca[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0xa2fc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa2fc('0x1'));var jsonpatch=require(_0xa2fc('0x2'));var rp=require(_0xa2fc('0x3'));var moment=require(_0xa2fc('0x4'));var BPromise=require(_0xa2fc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa2fc('0x6'));var sox=require(_0xa2fc('0x7'));var csv=require(_0xa2fc('0x8'));var ejs=require(_0xa2fc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa2fc('0xa'));var squel=require('squel');var crypto=require(_0xa2fc('0xb'));var jsforce=require(_0xa2fc('0xc'));var deskjs=require(_0xa2fc('0xd'));var toCsv=require(_0xa2fc('0x8'));var querystring=require(_0xa2fc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa2fc('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa2fc('0x10'))('api');var utils=require(_0xa2fc('0x11'));var config=require(_0xa2fc('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xa2fc('0x13'))['db'];var integrations=require(_0xa2fc('0x14'));function respondWithStatusCode(_0x193145,_0x2324d1){_0x2324d1=_0x2324d1||0xcc;return function(_0x4f90cf){if(_0x4f90cf){return _0x193145[_0xa2fc('0x15')](_0x2324d1);}return _0x193145[_0xa2fc('0x16')](_0x2324d1)[_0xa2fc('0x17')]();};}function respondWithResult(_0x1fa102,_0xea4bd4){_0xea4bd4=_0xea4bd4||0xc8;return function(_0x3b4ea3){if(_0x3b4ea3){return _0x1fa102[_0xa2fc('0x16')](_0xea4bd4)[_0xa2fc('0x18')](_0x3b4ea3);}};}function respondWithFilteredResult(_0x188a30,_0xd439b9){return function(_0x33eaab){if(_0x33eaab){var _0x5dd33=typeof _0xd439b9[_0xa2fc('0x19')]===_0xa2fc('0x1a')&&typeof _0xd439b9['limit']===_0xa2fc('0x1a');var _0x371888=_0x33eaab[_0xa2fc('0x1b')];var _0x2d38da=_0x5dd33?0x0:_0xd439b9[_0xa2fc('0x19')];var _0x318f61=_0x5dd33?_0x33eaab[_0xa2fc('0x1b')]:_0xd439b9[_0xa2fc('0x19')]+_0xd439b9[_0xa2fc('0x1c')];var _0x49c95a;if(_0x318f61>=_0x371888){_0x318f61=_0x371888;_0x49c95a=0xc8;}else{_0x49c95a=0xce;}_0x188a30[_0xa2fc('0x16')](_0x49c95a);return _0x188a30[_0xa2fc('0x1d')](_0xa2fc('0x1e'),_0x2d38da+'-'+_0x318f61+'/'+_0x371888)[_0xa2fc('0x18')](_0x33eaab);}return null;};}function patchUpdates(_0x57987e){return function(_0x339756){try{jsonpatch[_0xa2fc('0x1f')](_0x339756,_0x57987e,!![]);}catch(_0x2f1662){return BPromise[_0xa2fc('0x20')](_0x2f1662);}return _0x339756[_0xa2fc('0x21')]();};}function saveUpdates(_0x24f609,_0x5e274f){return function(_0x4b2f85){if(_0x4b2f85){return _0x4b2f85[_0xa2fc('0x22')](_0x24f609)['then'](function(_0x429098){return _0x429098;});}return null;};}function removeEntity(_0x57dee8,_0x5f0929){return function(_0xe7daf9){if(_0xe7daf9){return _0xe7daf9[_0xa2fc('0x23')]()[_0xa2fc('0x24')](function(){_0x57dee8[_0xa2fc('0x16')](0xcc)[_0xa2fc('0x17')]();});}};}function handleEntityNotFound(_0x1af330,_0x1ab707){return function(_0x36538f){if(!_0x36538f){_0x1af330[_0xa2fc('0x15')](0x194);}return _0x36538f;};}function handleError(_0x80b43,_0x2cb45a){_0x2cb45a=_0x2cb45a||0x1f4;return function(_0xa0666d){logger[_0xa2fc('0x25')](_0xa0666d['stack']);if(_0xa0666d['name']){delete _0xa0666d[_0xa2fc('0x26')];}_0x80b43[_0xa2fc('0x16')](_0x2cb45a)['send'](_0xa0666d);};}exports['index']=function(_0x2ba3a4,_0x26887d){var _0x381164={},_0x1b4939={},_0x57e8e1={'count':0x0,'rows':[]};var _0x256ff3=_['map'](db[_0xa2fc('0x27')]['rawAttributes'],function(_0x94433f){return{'name':_0x94433f[_0xa2fc('0x28')],'type':_0x94433f[_0xa2fc('0x29')][_0xa2fc('0x2a')]};});_0x1b4939[_0xa2fc('0x2b')]=_[_0xa2fc('0x2c')](_0x256ff3,_0xa2fc('0x26'));_0x1b4939['query']=_['keys'](_0x2ba3a4[_0xa2fc('0x2d')]);_0x1b4939[_0xa2fc('0x2e')]=_[_0xa2fc('0x2f')](_0x1b4939[_0xa2fc('0x2b')],_0x1b4939[_0xa2fc('0x2d')]);_0x381164['attributes']=_['intersection'](_0x1b4939[_0xa2fc('0x2b')],qs[_0xa2fc('0x30')](_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x30')]));_0x381164['attributes']=_0x381164[_0xa2fc('0x31')][_0xa2fc('0x32')]?_0x381164[_0xa2fc('0x31')]:_0x1b4939['model'];if(!_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x33')]('nolimit')){_0x381164[_0xa2fc('0x1c')]=qs[_0xa2fc('0x1c')](_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x1c')]);_0x381164[_0xa2fc('0x19')]=qs[_0xa2fc('0x19')](_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x19')]);}_0x381164['order']=qs[_0xa2fc('0x34')](_0x2ba3a4['query']['sort']);_0x381164[_0xa2fc('0x35')]=qs['filters'](_[_0xa2fc('0x36')](_0x2ba3a4['query'],_0x1b4939[_0xa2fc('0x2e')]),_0x256ff3);if(_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x37')]){_0x381164['where']=_[_0xa2fc('0x38')](_0x381164['where'],{'$or':_[_0xa2fc('0x2c')](_0x256ff3,function(_0xb248e){if(_0xb248e[_0xa2fc('0x29')]!=='VIRTUAL'){var _0x4ee6d7={};_0x4ee6d7[_0xb248e['name']]={'$like':'%'+_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x37')]+'%'};return _0x4ee6d7;}})});}_0x381164=_[_0xa2fc('0x38')]({},_0x381164,_0x2ba3a4[_0xa2fc('0x39')]);var _0x9a97ee={'where':_0x381164['where']};return db['ServicenowAccount'][_0xa2fc('0x1b')](_0x9a97ee)[_0xa2fc('0x24')](function(_0x36cf62){_0x57e8e1['count']=_0x36cf62;if(_0x2ba3a4[_0xa2fc('0x2d')][_0xa2fc('0x3a')]){_0x381164[_0xa2fc('0x3b')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xa2fc('0x3c')](_0x381164);})[_0xa2fc('0x24')](function(_0x40458b){_0x57e8e1['rows']=_0x40458b;return _0x57e8e1;})[_0xa2fc('0x24')](respondWithFilteredResult(_0x26887d,_0x381164))[_0xa2fc('0x3d')](handleError(_0x26887d,null));};exports[_0xa2fc('0x3e')]=function(_0x23ed13,_0x5d4ae4){var _0x4160ea={'raw':![],'where':{'id':_0x23ed13[_0xa2fc('0x3f')]['id']}},_0x14fc50={};_0x14fc50[_0xa2fc('0x2b')]=_[_0xa2fc('0x40')](db['ServicenowAccount'][_0xa2fc('0x41')]);_0x14fc50['query']=_[_0xa2fc('0x40')](_0x23ed13[_0xa2fc('0x2d')]);_0x14fc50[_0xa2fc('0x2e')]=_[_0xa2fc('0x2f')](_0x14fc50[_0xa2fc('0x2b')],_0x14fc50[_0xa2fc('0x2d')]);_0x4160ea[_0xa2fc('0x31')]=_[_0xa2fc('0x2f')](_0x14fc50[_0xa2fc('0x2b')],qs['fields'](_0x23ed13['query']['fields']));_0x4160ea[_0xa2fc('0x31')]=_0x4160ea[_0xa2fc('0x31')]['length']?_0x4160ea[_0xa2fc('0x31')]:_0x14fc50['model'];if(_0x23ed13['query'][_0xa2fc('0x3a')]){_0x4160ea[_0xa2fc('0x3b')]=[{'all':!![]}];}_0x4160ea=_[_0xa2fc('0x38')]({},_0x4160ea,_0x23ed13[_0xa2fc('0x39')]);return db[_0xa2fc('0x27')][_0xa2fc('0x42')](_0x4160ea)[_0xa2fc('0x24')](handleEntityNotFound(_0x5d4ae4,null))[_0xa2fc('0x24')](respondWithResult(_0x5d4ae4,null))['catch'](handleError(_0x5d4ae4,null));};exports[_0xa2fc('0x43')]=function(_0x3bbd0b,_0x424cb8){return db['ServicenowAccount'][_0xa2fc('0x43')](_0x3bbd0b['body'],{})[_0xa2fc('0x24')](respondWithResult(_0x424cb8,0xc9))[_0xa2fc('0x3d')](handleError(_0x424cb8,null));};exports[_0xa2fc('0x22')]=function(_0x29fe3b,_0x166337){if(_0x29fe3b['body']['id']){delete _0x29fe3b[_0xa2fc('0x44')]['id'];}return db[_0xa2fc('0x27')][_0xa2fc('0x42')]({'where':{'id':_0x29fe3b[_0xa2fc('0x3f')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x166337,null))['then'](saveUpdates(_0x29fe3b[_0xa2fc('0x44')],null))[_0xa2fc('0x24')](respondWithResult(_0x166337,null))[_0xa2fc('0x3d')](handleError(_0x166337,null));};exports[_0xa2fc('0x23')]=function(_0x389ad9,_0x341263){return db[_0xa2fc('0x27')][_0xa2fc('0x42')]({'where':{'id':_0x389ad9['params']['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x341263,null))[_0xa2fc('0x24')](removeEntity(_0x341263,null))[_0xa2fc('0x3d')](handleError(_0x341263,null));};exports['getConfigurations']=function(_0x5d59e2,_0x445ed9,_0x23a288){var _0x393ab8={};var _0xe5bc72={};var _0x4d687e;var _0x486036;return db[_0xa2fc('0x27')][_0xa2fc('0x45')]({'where':{'id':_0x5d59e2[_0xa2fc('0x3f')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x445ed9,null))[_0xa2fc('0x24')](function(_0x467cc6){if(_0x467cc6){_0x4d687e=_0x467cc6;_0xe5bc72['model']=_[_0xa2fc('0x40')](db['ServicenowConfiguration'][_0xa2fc('0x41')]);_0xe5bc72['query']=_['keys'](_0x5d59e2[_0xa2fc('0x2d')]);_0xe5bc72['filters']=_[_0xa2fc('0x2f')](_0xe5bc72[_0xa2fc('0x2b')],_0xe5bc72['query']);_0x393ab8['attributes']=_[_0xa2fc('0x2f')](_0xe5bc72[_0xa2fc('0x2b')],qs[_0xa2fc('0x30')](_0x5d59e2['query'][_0xa2fc('0x30')]));_0x393ab8[_0xa2fc('0x31')]=_0x393ab8['attributes'][_0xa2fc('0x32')]?_0x393ab8[_0xa2fc('0x31')]:_0xe5bc72[_0xa2fc('0x2b')];_0x393ab8['order']=qs[_0xa2fc('0x34')](_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x34')]);_0x393ab8[_0xa2fc('0x35')]=qs[_0xa2fc('0x2e')](_[_0xa2fc('0x36')](_0x5d59e2[_0xa2fc('0x2d')],_0xe5bc72['filters']));if(_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x37')]){_0x393ab8['where']=_['merge'](_0x393ab8[_0xa2fc('0x35')],{'$or':_[_0xa2fc('0x2c')](_0x393ab8['attributes'],function(_0x9ffbd3){var _0x501f48={};_0x501f48[_0x9ffbd3]={'$like':'%'+_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x37')]+'%'};return _0x501f48;})});}_0x393ab8=_[_0xa2fc('0x38')]({},_0x393ab8,_0x5d59e2[_0xa2fc('0x39')]);return _0x4d687e[_0xa2fc('0x46')](_0x393ab8);}})[_0xa2fc('0x24')](function(_0x50809){if(_0x50809){_0x486036=_0x50809[_0xa2fc('0x32')];if(!_0x5d59e2[_0xa2fc('0x2d')][_0xa2fc('0x33')]('nolimit')){_0x393ab8[_0xa2fc('0x1c')]=qs['limit'](_0x5d59e2['query']['limit']);_0x393ab8[_0xa2fc('0x19')]=qs[_0xa2fc('0x19')](_0x5d59e2[_0xa2fc('0x2d')]['offset']);}return _0x4d687e['getConfigurations'](_0x393ab8);}})[_0xa2fc('0x24')](function(_0x5210d6){if(_0x5210d6){return _0x5210d6?{'count':_0x486036,'rows':_0x5210d6}:null;}})[_0xa2fc('0x24')](respondWithResult(_0x445ed9,null))[_0xa2fc('0x3d')](handleError(_0x445ed9,null));};exports[_0xa2fc('0x47')]=function(_0x473394,_0x5ca1c6,_0x3f8826){if(_0x473394[_0xa2fc('0x44')]['id']){delete _0x473394['body']['id'];}return db[_0xa2fc('0x27')][_0xa2fc('0x45')]({'where':{'id':_0x473394[_0xa2fc('0x3f')]['id']}})[_0xa2fc('0x24')](handleEntityNotFound(_0x5ca1c6,null))[_0xa2fc('0x24')](function(_0x4be6fb){if(_0x4be6fb){_0x473394[_0xa2fc('0x44')][_0xa2fc('0x48')]=_0x4be6fb['id'];_0x473394['body'][_0xa2fc('0x49')]=integrations[_0xa2fc('0x4a')](_0x473394[_0xa2fc('0x44')][_0xa2fc('0x4b')],_0x473394[_0xa2fc('0x44')]['type']);_0x473394['body']['Descriptions']=integrations[_0xa2fc('0x4c')](_0x473394[_0xa2fc('0x44')][_0xa2fc('0x4b')],_0x473394[_0xa2fc('0x44')][_0xa2fc('0x29')]);return db[_0xa2fc('0x4d')]['create'](_0x473394[_0xa2fc('0x44')],{'include':[{'model':db[_0xa2fc('0x4e')],'as':_0xa2fc('0x49')},{'model':db[_0xa2fc('0x4e')],'as':_0xa2fc('0x4f')}]});}return null;})[_0xa2fc('0x24')](respondWithResult(_0x5ca1c6,null))[_0xa2fc('0x3d')](handleError(_0x5ca1c6,null));};exports[_0xa2fc('0x50')]=function(_0x4b5b63,_0x9d1979,_0x1040a6){var _0xacb54b=[_0xa2fc('0x51'),_0xa2fc('0x52'),_0xa2fc('0x53'),'subcategory','close_code','notify',_0xa2fc('0x54'),_0xa2fc('0x55'),_0xa2fc('0x56')];var _0x364d2d=[_0xa2fc('0x57'),_0xa2fc('0x51'),_0xa2fc('0x58'),_0xa2fc('0x59'),_0xa2fc('0x5a'),_0xa2fc('0x5b'),'child_incidents',_0xa2fc('0x52'),_0xa2fc('0x5c'),'number',_0xa2fc('0x5d'),'sys_updated_by',_0xa2fc('0x5e'),_0xa2fc('0x5f'),_0xa2fc('0x60'),_0xa2fc('0x61'),_0xa2fc('0x62'),_0xa2fc('0x63'),_0xa2fc('0x53'),_0xa2fc('0x64'),'calendar_stc',_0xa2fc('0x65'),_0xa2fc('0x66'),_0xa2fc('0x67'),_0xa2fc('0x68'),_0xa2fc('0x69'),'work_notes_list',_0xa2fc('0x6a'),_0xa2fc('0x6b'),_0xa2fc('0x6c'),_0xa2fc('0x6d'),_0xa2fc('0x6e'),_0xa2fc('0x6f'),_0xa2fc('0x70'),_0xa2fc('0x71'),_0xa2fc('0x72'),'work_end','reopened_time','resolved_at',_0xa2fc('0x73'),_0xa2fc('0x74'),_0xa2fc('0x75'),_0xa2fc('0x76'),'short_description',_0xa2fc('0x77'),_0xa2fc('0x78'),_0xa2fc('0x79'),_0xa2fc('0x7a'),_0xa2fc('0x7b'),_0xa2fc('0x7c'),_0xa2fc('0x7d'),_0xa2fc('0x7e'),_0xa2fc('0x7f'),_0xa2fc('0x80'),_0xa2fc('0x81'),'close_notes',_0xa2fc('0x82'),_0xa2fc('0x83'),_0xa2fc('0x84'),_0xa2fc('0x85'),_0xa2fc('0x86'),_0xa2fc('0x87'),_0xa2fc('0x54'),_0xa2fc('0x88'),_0xa2fc('0x89'),_0xa2fc('0x8a'),_0xa2fc('0x8b'),'activity_due',_0xa2fc('0x8c'),_0xa2fc('0x55'),_0xa2fc('0x8d'),_0xa2fc('0x8e'),_0xa2fc('0x8f'),_0xa2fc('0x90'),_0xa2fc('0x91'),'sys_mod_count','reopen_count',_0xa2fc('0x92'),_0xa2fc('0x93'),_0xa2fc('0x94'),_0xa2fc('0x95'),'location',_0xa2fc('0x56')];var _0x1fc279='';var _0x391400='';var _0x53222f=[];var _0x4f3c1f='';var _0x34d808='';var _0x1fc969=[];var _0x41c4f0='';var _0xf0121d='';var _0x49bd61={};var _0x136406='';return db[_0xa2fc('0x27')]['findOne']({'where':{'id':_0x4b5b63[_0xa2fc('0x3f')]['id']},'attributes':['id',_0xa2fc('0x96'),_0xa2fc('0x97'),'email',_0xa2fc('0x98'),'serverUrl']})[_0xa2fc('0x24')](handleEntityNotFound(_0x9d1979,null))[_0xa2fc('0x24')](function(_0x33e8b9){if(_0x33e8b9){_0x136406=_0x33e8b9[_0xa2fc('0x98')];var _0x4b2538=_0x136406[_0xa2fc('0x99')](-0x1);if(_0x4b2538==='/'){_0x136406=_0x136406['substring'](0x0,_0x136406[_0xa2fc('0x9a')](_0x4b2538));}_0xf0121d=util['format'](_0xa2fc('0x9b'),_0x136406);_0x41c4f0=util['format']('%s/api/now/table/',_0x136406);_0x49bd61={'user':_0x33e8b9[_0xa2fc('0x96')],'pass':_0x33e8b9['password']};var _0x3c358e={'method':'GET','uri':_0xf0121d+_0xa2fc('0x9c'),'auth':_0x49bd61,'json':!![]};return rp(_0x3c358e);}})[_0xa2fc('0x24')](function(_0x2f8f9d){if(_0x2f8f9d[_0xa2fc('0x9d')][_0xa2fc('0x32')]>0x0){_0x1fc279=_0x2f8f9d[_0xa2fc('0x9d')];}console['log']('incident\x20table\x20objects',_0x1fc279);_0x1fc969=[];_0x391400=Object['assign']([],_0x1fc279);_[_0xa2fc('0x9e')](_0x391400,function(_0x1195fb){return!_0xacb54b[_0xa2fc('0x9f')](_0x1195fb[_0xa2fc('0x26')]);});_0x391400['forEach'](function(_0x1b7129){var _0x56c3d6=createFieldObject(_0x41c4f0,_0x49bd61,_0x1b7129[_0xa2fc('0xa0')],_0x1b7129[_0xa2fc('0x26')],_0x1b7129[_0xa2fc('0xa1')],![]);_0x1fc969[_0xa2fc('0xa2')](_0x56c3d6);});return Promise[_0xa2fc('0xa3')](_0x1fc969);})['then'](function(_0x8a407a){_0x53222f=_0x8a407a;_0x4f3c1f=Object[_0xa2fc('0xa4')]([],_0x1fc279);console[_0xa2fc('0xa5')]('TCL:\x20_object',_0x1fc279);_['remove'](_0x4f3c1f,function(_0x16b040){return _0x364d2d[_0xa2fc('0x9f')](_0x16b040['name']);});console[_0xa2fc('0xa5')](_0xa2fc('0xa6'),_0x4f3c1f);_0x1fc969=[];_0x4f3c1f['forEach'](function(_0x484fad){var _0x3f999a=createFieldObject(_0x41c4f0,_0x49bd61,_0x484fad[_0xa2fc('0xa0')],_0x484fad[_0xa2fc('0x26')],_0x484fad['label'],!![]);_0x1fc969[_0xa2fc('0xa2')](_0x3f999a);});return Promise[_0xa2fc('0xa3')](_0x1fc969);})[_0xa2fc('0x24')](function(_0x1e65af){_0x34d808=_0x1e65af;var _0x3a5d1a=_0x53222f[_0xa2fc('0xa7')](_0x34d808);return{'count':_0x3a5d1a['length'],'rows':_0x3a5d1a};})[_0xa2fc('0x24')](respondWithResult(_0x9d1979,null))[_0xa2fc('0x3d')](function(_0x611049){console['log'](_0xa2fc('0xa8')+_0x611049);var _0x138f3e=_0x4b5b63[_0xa2fc('0x2d')][_0xa2fc('0xa9')]?0x1f4:_0x611049[_0xa2fc('0xaa')]||0x1f4;logger[_0xa2fc('0x25')](_0x611049['stack']);delete _0x611049[_0xa2fc('0x26')];if(_0x138f3e===0x191){_0x138f3e=0x190;}_0x9d1979[_0xa2fc('0x16')](_0x138f3e)['send'](_0x4b5b63[_0xa2fc('0x2d')]['test']?{'message':_0xa2fc('0xab'),'statusCode':_0x611049[_0xa2fc('0xaa')]}:_0x611049);});};function createFieldObject(_0x12d744,_0xdebcb1,_0x287980,_0x1df161,_0x12ed70,_0xb38b1f){return new Promise(function(_0xeade6,_0x263310){var _0x4ccbc6={'id':_0x1df161,'name':_0x12ed70,'custom':_0xb38b1f};if(_0x287980===_0xa2fc('0xac')){_0x4ccbc6[_0xa2fc('0x39')]=[{'name':'True','value':_0xa2fc('0xad')},{'name':_0xa2fc('0xae'),'value':_0xa2fc('0xaf')}];_0xeade6(_0x4ccbc6);}else{var _0x9f0796={'method':_0xa2fc('0xb0'),'uri':_0x12d744+'sys_choice?sysparm_query=name=incident^element='+_0x1df161,'auth':_0xdebcb1,'json':!![]};return rp(_0x9f0796)[_0xa2fc('0x24')](function(_0x4ff005){var _0x56f111=[];if(_0x4ff005[_0xa2fc('0x9d')][_0xa2fc('0x32')]>0x0){_0x4ff005[_0xa2fc('0x9d')][_0xa2fc('0xb1')](function(_0x2f7bb3){if(_0x2f7bb3[_0xa2fc('0xb2')]===_0xa2fc('0xaf')){var _0x57baaf={'name':_0x2f7bb3[_0xa2fc('0xa1')],'value':_0x2f7bb3[_0xa2fc('0xb3')]};_0x56f111[_0xa2fc('0xa2')](_0x57baaf);}});}_0x4ccbc6[_0xa2fc('0x39')]=_0x56f111;if(_0x4ccbc6[_0xa2fc('0x39')][_0xa2fc('0x32')]>0x0){_0xeade6(_0x4ccbc6);}else{if(_0xb38b1f==![]){_0xeade6();}else{_0xeade6(_0x4ccbc6);}}});}});} \ No newline at end of file +var _0xc02b=['sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ServicenowAccount','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','nolimit','order','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','keys','find','create','body','catch','getConfigurations','findOne','sort','pick','addConfiguration','getSubjects','Descriptions','channel','ServicenowConfiguration','ServicenowField','Subjects','made_sla','hold_reason','knowledge','subcategory','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','sys_created_on','sys_domain','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','rfc','time_worked','opened_at','business_duration','group_list','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','close_code','delivery_task','work_start','assignment_group','business_stc','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','activity_due','assigned_to'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xc02b,0x1a6));var _0xbc02=function(_0x4b3d13,_0x1993d5){_0x4b3d13=_0x4b3d13-0x0;var _0xf64dd8=_0xc02b[_0x4b3d13];return _0xf64dd8;};'use strict';var emlformat=require(_0xbc02('0x0'));var rimraf=require(_0xbc02('0x1'));var zipdir=require(_0xbc02('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbc02('0x3'));var moment=require(_0xbc02('0x4'));var BPromise=require(_0xbc02('0x5'));var Mustache=require('mustache');var util=require(_0xbc02('0x6'));var path=require(_0xbc02('0x7'));var sox=require(_0xbc02('0x8'));var csv=require('to-csv');var ejs=require(_0xbc02('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xbc02('0xa'));var jsforce=require(_0xbc02('0xb'));var deskjs=require(_0xbc02('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbc02('0xd'));var Papa=require(_0xbc02('0xe'));var Redis=require(_0xbc02('0xf'));var authService=require(_0xbc02('0x10'));var qs=require(_0xbc02('0x11'));var as=require(_0xbc02('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc02('0x13'))('api');var utils=require(_0xbc02('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xbc02('0x15'))['db'];var integrations=require(_0xbc02('0x16'));function respondWithStatusCode(_0x27cfbb,_0x2eb632){_0x2eb632=_0x2eb632||0xcc;return function(_0x35c9da){if(_0x35c9da){return _0x27cfbb[_0xbc02('0x17')](_0x2eb632);}return _0x27cfbb['status'](_0x2eb632)[_0xbc02('0x18')]();};}function respondWithResult(_0x125f68,_0x5a8ad6){_0x5a8ad6=_0x5a8ad6||0xc8;return function(_0x5ace5e){if(_0x5ace5e){return _0x125f68[_0xbc02('0x19')](_0x5a8ad6)[_0xbc02('0x1a')](_0x5ace5e);}};}function respondWithFilteredResult(_0xa4297f,_0x5d15fa){return function(_0x1aa452){if(_0x1aa452){var _0x392e35=typeof _0x5d15fa[_0xbc02('0x1b')]===_0xbc02('0x1c')&&typeof _0x5d15fa[_0xbc02('0x1d')]==='undefined';var _0x4499a7=_0x1aa452['count'];var _0xf01e76=_0x392e35?0x0:_0x5d15fa[_0xbc02('0x1b')];var _0x4f0150=_0x392e35?_0x1aa452['count']:_0x5d15fa['offset']+_0x5d15fa[_0xbc02('0x1d')];var _0x312e3b;if(_0x4f0150>=_0x4499a7){_0x4f0150=_0x4499a7;_0x312e3b=0xc8;}else{_0x312e3b=0xce;}_0xa4297f['status'](_0x312e3b);return _0xa4297f[_0xbc02('0x1e')](_0xbc02('0x1f'),_0xf01e76+'-'+_0x4f0150+'/'+_0x4499a7)[_0xbc02('0x1a')](_0x1aa452);}return null;};}function patchUpdates(_0x1c6ecf){return function(_0x2a4f37){try{jsonpatch['apply'](_0x2a4f37,_0x1c6ecf,!![]);}catch(_0xbd443c){return BPromise[_0xbc02('0x20')](_0xbd443c);}return _0x2a4f37[_0xbc02('0x21')]();};}function saveUpdates(_0x2be929,_0x5ac749){return function(_0x4dbb5b){if(_0x4dbb5b){return _0x4dbb5b[_0xbc02('0x22')](_0x2be929)[_0xbc02('0x23')](function(_0x5c07e1){return _0x5c07e1;});}return null;};}function removeEntity(_0xd969c4,_0x4f37d){return function(_0x2d980d){if(_0x2d980d){return _0x2d980d[_0xbc02('0x24')]()[_0xbc02('0x23')](function(){_0xd969c4['status'](0xcc)[_0xbc02('0x18')]();});}};}function handleEntityNotFound(_0x43e37e,_0x542d9c){return function(_0x5919f7){if(!_0x5919f7){_0x43e37e[_0xbc02('0x17')](0x194);}return _0x5919f7;};}function handleError(_0xbcc62,_0x331149){_0x331149=_0x331149||0x1f4;return function(_0x3ba541){logger[_0xbc02('0x25')](_0x3ba541[_0xbc02('0x26')]);if(_0x3ba541[_0xbc02('0x27')]){delete _0x3ba541[_0xbc02('0x27')];}_0xbcc62['status'](_0x331149)[_0xbc02('0x28')](_0x3ba541);};}exports[_0xbc02('0x29')]=function(_0x3f68c5,_0x5b4b9f){var _0x131ede={},_0x598b37={},_0xd799ae={'count':0x0,'rows':[]};var _0x9c5076=_['map'](db[_0xbc02('0x2a')][_0xbc02('0x2b')],function(_0x17ad87){return{'name':_0x17ad87[_0xbc02('0x2c')],'type':_0x17ad87['type'][_0xbc02('0x2d')]};});_0x598b37[_0xbc02('0x2e')]=_[_0xbc02('0x2f')](_0x9c5076,_0xbc02('0x27'));_0x598b37['query']=_['keys'](_0x3f68c5[_0xbc02('0x30')]);_0x598b37[_0xbc02('0x31')]=_['intersection'](_0x598b37[_0xbc02('0x2e')],_0x598b37[_0xbc02('0x30')]);_0x131ede[_0xbc02('0x32')]=_[_0xbc02('0x33')](_0x598b37[_0xbc02('0x2e')],qs[_0xbc02('0x34')](_0x3f68c5['query'][_0xbc02('0x34')]));_0x131ede['attributes']=_0x131ede[_0xbc02('0x32')][_0xbc02('0x35')]?_0x131ede['attributes']:_0x598b37[_0xbc02('0x2e')];if(!_0x3f68c5[_0xbc02('0x30')]['hasOwnProperty'](_0xbc02('0x36'))){_0x131ede['limit']=qs[_0xbc02('0x1d')](_0x3f68c5['query']['limit']);_0x131ede[_0xbc02('0x1b')]=qs['offset'](_0x3f68c5[_0xbc02('0x30')][_0xbc02('0x1b')]);}_0x131ede[_0xbc02('0x37')]=qs['sort'](_0x3f68c5[_0xbc02('0x30')]['sort']);_0x131ede[_0xbc02('0x38')]=qs[_0xbc02('0x31')](_['pick'](_0x3f68c5[_0xbc02('0x30')],_0x598b37[_0xbc02('0x31')]),_0x9c5076);if(_0x3f68c5[_0xbc02('0x30')][_0xbc02('0x39')]){_0x131ede[_0xbc02('0x38')]=_[_0xbc02('0x3a')](_0x131ede[_0xbc02('0x38')],{'$or':_[_0xbc02('0x2f')](_0x9c5076,function(_0x2f9b55){if(_0x2f9b55[_0xbc02('0x3b')]!==_0xbc02('0x3c')){var _0x3d96d7={};_0x3d96d7[_0x2f9b55[_0xbc02('0x27')]]={'$like':'%'+_0x3f68c5[_0xbc02('0x30')][_0xbc02('0x39')]+'%'};return _0x3d96d7;}})});}_0x131ede=_['merge']({},_0x131ede,_0x3f68c5[_0xbc02('0x3d')]);var _0x1e6ec3={'where':_0x131ede[_0xbc02('0x38')]};return db['ServicenowAccount']['count'](_0x1e6ec3)[_0xbc02('0x23')](function(_0xa8e9e4){_0xd799ae[_0xbc02('0x3e')]=_0xa8e9e4;if(_0x3f68c5['query'][_0xbc02('0x3f')]){_0x131ede[_0xbc02('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xbc02('0x41')](_0x131ede);})['then'](function(_0x129a0d){_0xd799ae[_0xbc02('0x42')]=_0x129a0d;return _0xd799ae;})[_0xbc02('0x23')](respondWithFilteredResult(_0x5b4b9f,_0x131ede))['catch'](handleError(_0x5b4b9f,null));};exports[_0xbc02('0x43')]=function(_0x223742,_0x14bd43){var _0x3ae7b4={'raw':![],'where':{'id':_0x223742[_0xbc02('0x44')]['id']}},_0x17b3e5={};_0x17b3e5['model']=_['keys'](db[_0xbc02('0x2a')][_0xbc02('0x2b')]);_0x17b3e5[_0xbc02('0x30')]=_[_0xbc02('0x45')](_0x223742[_0xbc02('0x30')]);_0x17b3e5['filters']=_['intersection'](_0x17b3e5[_0xbc02('0x2e')],_0x17b3e5['query']);_0x3ae7b4[_0xbc02('0x32')]=_[_0xbc02('0x33')](_0x17b3e5[_0xbc02('0x2e')],qs[_0xbc02('0x34')](_0x223742[_0xbc02('0x30')][_0xbc02('0x34')]));_0x3ae7b4['attributes']=_0x3ae7b4[_0xbc02('0x32')][_0xbc02('0x35')]?_0x3ae7b4[_0xbc02('0x32')]:_0x17b3e5[_0xbc02('0x2e')];if(_0x223742[_0xbc02('0x30')]['includeAll']){_0x3ae7b4[_0xbc02('0x40')]=[{'all':!![]}];}_0x3ae7b4=_[_0xbc02('0x3a')]({},_0x3ae7b4,_0x223742['options']);return db['ServicenowAccount'][_0xbc02('0x46')](_0x3ae7b4)['then'](handleEntityNotFound(_0x14bd43,null))[_0xbc02('0x23')](respondWithResult(_0x14bd43,null))['catch'](handleError(_0x14bd43,null));};exports[_0xbc02('0x47')]=function(_0x1a873d,_0x284a95){return db['ServicenowAccount']['create'](_0x1a873d[_0xbc02('0x48')],{})['then'](respondWithResult(_0x284a95,0xc9))[_0xbc02('0x49')](handleError(_0x284a95,null));};exports[_0xbc02('0x22')]=function(_0xa33c63,_0x167970){if(_0xa33c63[_0xbc02('0x48')]['id']){delete _0xa33c63[_0xbc02('0x48')]['id'];}return db[_0xbc02('0x2a')][_0xbc02('0x46')]({'where':{'id':_0xa33c63['params']['id']}})[_0xbc02('0x23')](handleEntityNotFound(_0x167970,null))['then'](saveUpdates(_0xa33c63[_0xbc02('0x48')],null))['then'](respondWithResult(_0x167970,null))[_0xbc02('0x49')](handleError(_0x167970,null));};exports[_0xbc02('0x24')]=function(_0x22b73b,_0x56169f){return db[_0xbc02('0x2a')][_0xbc02('0x46')]({'where':{'id':_0x22b73b['params']['id']}})[_0xbc02('0x23')](handleEntityNotFound(_0x56169f,null))['then'](removeEntity(_0x56169f,null))['catch'](handleError(_0x56169f,null));};exports[_0xbc02('0x4a')]=function(_0x329b16,_0x149ac6,_0x2c54da){var _0x5aa977={};var _0x459c75={};var _0x26c758;var _0x45f20f;return db['ServicenowAccount'][_0xbc02('0x4b')]({'where':{'id':_0x329b16['params']['id']}})[_0xbc02('0x23')](handleEntityNotFound(_0x149ac6,null))['then'](function(_0x340c4f){if(_0x340c4f){_0x26c758=_0x340c4f;_0x459c75['model']=_[_0xbc02('0x45')](db['ServicenowConfiguration'][_0xbc02('0x2b')]);_0x459c75[_0xbc02('0x30')]=_[_0xbc02('0x45')](_0x329b16['query']);_0x459c75[_0xbc02('0x31')]=_[_0xbc02('0x33')](_0x459c75[_0xbc02('0x2e')],_0x459c75[_0xbc02('0x30')]);_0x5aa977[_0xbc02('0x32')]=_[_0xbc02('0x33')](_0x459c75[_0xbc02('0x2e')],qs[_0xbc02('0x34')](_0x329b16[_0xbc02('0x30')][_0xbc02('0x34')]));_0x5aa977['attributes']=_0x5aa977[_0xbc02('0x32')][_0xbc02('0x35')]?_0x5aa977[_0xbc02('0x32')]:_0x459c75[_0xbc02('0x2e')];_0x5aa977[_0xbc02('0x37')]=qs[_0xbc02('0x4c')](_0x329b16[_0xbc02('0x30')]['sort']);_0x5aa977[_0xbc02('0x38')]=qs['filters'](_[_0xbc02('0x4d')](_0x329b16[_0xbc02('0x30')],_0x459c75[_0xbc02('0x31')]));if(_0x329b16['query']['filter']){_0x5aa977[_0xbc02('0x38')]=_[_0xbc02('0x3a')](_0x5aa977[_0xbc02('0x38')],{'$or':_[_0xbc02('0x2f')](_0x5aa977[_0xbc02('0x32')],function(_0x74def7){var _0x51a721={};_0x51a721[_0x74def7]={'$like':'%'+_0x329b16[_0xbc02('0x30')]['filter']+'%'};return _0x51a721;})});}_0x5aa977=_[_0xbc02('0x3a')]({},_0x5aa977,_0x329b16[_0xbc02('0x3d')]);return _0x26c758['getConfigurations'](_0x5aa977);}})[_0xbc02('0x23')](function(_0x3278f9){if(_0x3278f9){_0x45f20f=_0x3278f9[_0xbc02('0x35')];if(!_0x329b16[_0xbc02('0x30')]['hasOwnProperty']('nolimit')){_0x5aa977['limit']=qs[_0xbc02('0x1d')](_0x329b16['query'][_0xbc02('0x1d')]);_0x5aa977['offset']=qs[_0xbc02('0x1b')](_0x329b16[_0xbc02('0x30')][_0xbc02('0x1b')]);}return _0x26c758[_0xbc02('0x4a')](_0x5aa977);}})['then'](function(_0x3dd2e3){if(_0x3dd2e3){return _0x3dd2e3?{'count':_0x45f20f,'rows':_0x3dd2e3}:null;}})[_0xbc02('0x23')](respondWithResult(_0x149ac6,null))[_0xbc02('0x49')](handleError(_0x149ac6,null));};exports[_0xbc02('0x4e')]=function(_0x2dc816,_0xe714e7,_0x163b5a){if(_0x2dc816[_0xbc02('0x48')]['id']){delete _0x2dc816[_0xbc02('0x48')]['id'];}return db[_0xbc02('0x2a')][_0xbc02('0x4b')]({'where':{'id':_0x2dc816[_0xbc02('0x44')]['id']}})[_0xbc02('0x23')](handleEntityNotFound(_0xe714e7,null))[_0xbc02('0x23')](function(_0x2278a0){if(_0x2278a0){_0x2dc816[_0xbc02('0x48')]['AccountId']=_0x2278a0['id'];_0x2dc816[_0xbc02('0x48')]['Subjects']=integrations[_0xbc02('0x4f')](_0x2dc816[_0xbc02('0x48')]['channel'],_0x2dc816[_0xbc02('0x48')][_0xbc02('0x3b')]);_0x2dc816[_0xbc02('0x48')][_0xbc02('0x50')]=integrations['getDescriptions'](_0x2dc816['body'][_0xbc02('0x51')],_0x2dc816[_0xbc02('0x48')][_0xbc02('0x3b')]);return db[_0xbc02('0x52')][_0xbc02('0x47')](_0x2dc816[_0xbc02('0x48')],{'include':[{'model':db[_0xbc02('0x53')],'as':_0xbc02('0x54')},{'model':db['ServicenowField'],'as':_0xbc02('0x50')}]});}return null;})[_0xbc02('0x23')](respondWithResult(_0xe714e7,null))[_0xbc02('0x49')](handleError(_0xe714e7,null));};exports['getFields']=function(_0x231b33,_0x55841e,_0x306dd0){var _0x205b83=[_0xbc02('0x55'),_0xbc02('0x56'),_0xbc02('0x57'),_0xbc02('0x58'),'close_code','notify',_0xbc02('0x59'),_0xbc02('0x5a'),_0xbc02('0x5b')];var _0x681491=[_0xbc02('0x5c'),'made_sla',_0xbc02('0x5d'),_0xbc02('0x5e'),_0xbc02('0x5f'),_0xbc02('0x60'),_0xbc02('0x61'),'hold_reason',_0xbc02('0x62'),_0xbc02('0x63'),_0xbc02('0x64'),_0xbc02('0x65'),_0xbc02('0x66'),'user_input',_0xbc02('0x67'),_0xbc02('0x68'),'state',_0xbc02('0x69'),'knowledge',_0xbc02('0x37'),_0xbc02('0x6a'),_0xbc02('0x6b'),_0xbc02('0x6c'),_0xbc02('0x6d'),'impact',_0xbc02('0x6e'),_0xbc02('0x6f'),'business_service','priority','sys_domain_path',_0xbc02('0x70'),_0xbc02('0x71'),'expected_start',_0xbc02('0x72'),_0xbc02('0x73'),_0xbc02('0x74'),'work_end',_0xbc02('0x75'),_0xbc02('0x76'),_0xbc02('0x77'),_0xbc02('0x78'),_0xbc02('0x58'),_0xbc02('0x79'),_0xbc02('0x7a'),_0xbc02('0x7b'),'correlation_display',_0xbc02('0x7c'),_0xbc02('0x7d'),_0xbc02('0x7e'),_0xbc02('0x7f'),'additional_assignee_list',_0xbc02('0x80'),_0xbc02('0x81'),_0xbc02('0x82'),_0xbc02('0x83'),_0xbc02('0x84'),_0xbc02('0x85'),_0xbc02('0x86'),_0xbc02('0x87'),_0xbc02('0x88'),_0xbc02('0x89'),_0xbc02('0x8a'),_0xbc02('0x59'),_0xbc02('0x8b'),'problem_id','company','reassignment_count',_0xbc02('0x8c'),_0xbc02('0x8d'),_0xbc02('0x5a'),'comments',_0xbc02('0x8e'),_0xbc02('0x8f'),_0xbc02('0x90'),_0xbc02('0x91'),_0xbc02('0x92'),_0xbc02('0x93'),_0xbc02('0x94'),_0xbc02('0x95'),_0xbc02('0x96'),_0xbc02('0x97'),_0xbc02('0x98'),_0xbc02('0x5b')];var _0x208405='';var _0x8d0525='';var _0x5e1bf9=[];var _0x380ef2='';var _0x24d066='';var _0x56340b=[];var _0x1c24d6='';var _0x31f103='';var _0x274d00={};var _0x42afdd='';return db['ServicenowAccount'][_0xbc02('0x4b')]({'where':{'id':_0x231b33[_0xbc02('0x44')]['id']},'attributes':['id',_0xbc02('0x99'),_0xbc02('0x9a'),_0xbc02('0x9b'),_0xbc02('0x9c'),_0xbc02('0x9d')]})[_0xbc02('0x23')](handleEntityNotFound(_0x55841e,null))[_0xbc02('0x23')](function(_0x18e4b4){if(_0x18e4b4){_0x42afdd=_0x18e4b4[_0xbc02('0x9c')];var _0x575933=_0x42afdd[_0xbc02('0x9e')](-0x1);if(_0x575933==='/'){_0x42afdd=_0x42afdd[_0xbc02('0x9f')](0x0,_0x42afdd[_0xbc02('0xa0')](_0x575933));}_0x31f103=util[_0xbc02('0xa1')]('%s/api/now/doc/table/schema/',_0x42afdd);_0x1c24d6=util[_0xbc02('0xa1')](_0xbc02('0xa2'),_0x42afdd);_0x274d00={'user':_0x18e4b4[_0xbc02('0x99')],'pass':_0x18e4b4['password']};var _0x119eba={'method':_0xbc02('0xa3'),'uri':_0x31f103+_0xbc02('0xa4'),'auth':_0x274d00,'json':!![]};return rp(_0x119eba);}})[_0xbc02('0x23')](function(_0x26dd81){if(_0x26dd81[_0xbc02('0xa5')][_0xbc02('0x35')]>0x0){_0x208405=_0x26dd81['result'];}console[_0xbc02('0xa6')](_0xbc02('0xa7'),_0x208405);_0x56340b=[];_0x8d0525=Object[_0xbc02('0xa8')]([],_0x208405);_[_0xbc02('0xa9')](_0x8d0525,function(_0x5d8a4c){return!_0x205b83[_0xbc02('0xaa')](_0x5d8a4c[_0xbc02('0x27')]);});_0x8d0525[_0xbc02('0xab')](function(_0x18c076){var _0x44d9eb=createFieldObject(_0x1c24d6,_0x274d00,_0x18c076[_0xbc02('0xac')],_0x18c076['name'],_0x18c076[_0xbc02('0xad')],![]);_0x56340b[_0xbc02('0xae')](_0x44d9eb);});return Promise['all'](_0x56340b);})['then'](function(_0x505965){_0x5e1bf9=_0x505965;_0x380ef2=Object['assign']([],_0x208405);console[_0xbc02('0xa6')](_0xbc02('0xaf'),_0x208405);_['remove'](_0x380ef2,function(_0x29e24d){return _0x681491[_0xbc02('0xaa')](_0x29e24d[_0xbc02('0x27')]);});console['log'](_0xbc02('0xb0'),_0x380ef2);_0x56340b=[];_0x380ef2[_0xbc02('0xab')](function(_0x27512b){var _0xcce8ca=createFieldObject(_0x1c24d6,_0x274d00,_0x27512b[_0xbc02('0xac')],_0x27512b[_0xbc02('0x27')],_0x27512b[_0xbc02('0xad')],!![]);_0x56340b[_0xbc02('0xae')](_0xcce8ca);});return Promise['all'](_0x56340b);})[_0xbc02('0x23')](function(_0x62eb56){_0x24d066=_0x62eb56;var _0x20e772=_0x5e1bf9[_0xbc02('0xb1')](_0x24d066);return{'count':_0x20e772[_0xbc02('0x35')],'rows':_0x20e772};})['then'](respondWithResult(_0x55841e,null))['catch'](function(_0x29bee3){console['log'](_0xbc02('0xb2')+_0x29bee3);var _0x406bd9=_0x231b33['query'][_0xbc02('0xb3')]?0x1f4:_0x29bee3[_0xbc02('0xb4')]||0x1f4;logger[_0xbc02('0x25')](_0x29bee3['stack']);delete _0x29bee3[_0xbc02('0x27')];if(_0x406bd9===0x191){_0x406bd9=0x190;}_0x55841e[_0xbc02('0x19')](_0x406bd9)[_0xbc02('0x28')](_0x231b33[_0xbc02('0x30')][_0xbc02('0xb3')]?{'message':'Wrong\x20credentials','statusCode':_0x29bee3[_0xbc02('0xb4')]}:_0x29bee3);});};function createFieldObject(_0x35da62,_0x3166d4,_0x1e4fc4,_0x57df94,_0x4fddd3,_0x5d5810){return new Promise(function(_0x4ab37a,_0x15e870){var _0x3fc97b={'id':_0x57df94,'name':_0x4fddd3,'custom':_0x5d5810};if(_0x1e4fc4===_0xbc02('0xb5')){_0x3fc97b[_0xbc02('0x3d')]=[{'name':_0xbc02('0xb6'),'value':_0xbc02('0xb7')},{'name':_0xbc02('0xb8'),'value':_0xbc02('0xb9')}];_0x4ab37a(_0x3fc97b);}else{var _0x11bbea={'method':_0xbc02('0xa3'),'uri':_0x35da62+_0xbc02('0xba')+_0x57df94,'auth':_0x3166d4,'json':!![]};return rp(_0x11bbea)[_0xbc02('0x23')](function(_0x4d84f3){var _0x299f9f=[];if(_0x4d84f3[_0xbc02('0xa5')][_0xbc02('0x35')]>0x0){_0x4d84f3[_0xbc02('0xa5')][_0xbc02('0xab')](function(_0x315e34){if(_0x315e34['inactive']===_0xbc02('0xb9')){var _0x1cfc19={'name':_0x315e34[_0xbc02('0xad')],'value':_0x315e34[_0xbc02('0xbb')]};_0x299f9f[_0xbc02('0xae')](_0x1cfc19);}});}_0x3fc97b[_0xbc02('0x3d')]=_0x299f9f;if(_0x3fc97b['options'][_0xbc02('0x35')]>0x0){_0x4ab37a(_0x3fc97b);}else{if(_0x5d5810==![]){_0x4ab37a();}else{_0x4ab37a(_0x3fc97b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 12c8ad6..248f743 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 _0xeff8=['rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','int_servicenow_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x3a9d2b,_0x4a754d){var _0x50dff9=function(_0x300429){while(--_0x300429){_0x3a9d2b['push'](_0x3a9d2b['shift']());}};_0x50dff9(++_0x4a754d);}(_0xeff8,0x186));var _0x8eff=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xeff8[_0x1fc122];return _0xa2cb13;};'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 +var _0xe14b=['bluebird','path','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','ServicenowAccount','lodash','util','moment'];(function(_0x4e9df3,_0x2a1693){var _0x4023ec=function(_0x269ee1){while(--_0x269ee1){_0x4e9df3['push'](_0x4e9df3['shift']());}};_0x4023ec(++_0x2a1693);}(_0xe14b,0x93));var _0xbe14=function(_0x3b7a5d,_0x2ab93a){_0x3b7a5d=_0x3b7a5d-0x0;var _0x18c3f0=_0xe14b[_0x3b7a5d];return _0x18c3f0;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));var integrations=require(_0xbe14('0x6'));module[_0xbe14('0x7')]=function(_0x1ff100,_0x1d9ade){return _0x1ff100[_0xbe14('0x8')](_0xbe14('0x9'),attributes,{'tableName':'int_servicenow_accounts','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 1dba5d6..6c30f87 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 _0xd63f=['ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','limit','map','include','attributes','model','ShowServicenowAccount','then','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xd63f,0x1e3));var _0xfd63=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd63f[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xfd63('0x0'));var util=require(_0xfd63('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xfd63('0x2'));var fs=require('fs');var Redis=require(_0xfd63('0x3'));var db=require(_0xfd63('0x4'))['db'];var utils=require(_0xfd63('0x5'));var logger=require(_0xfd63('0x6'))(_0xfd63('0x7'));var config=require(_0xfd63('0x8'));var jayson=require(_0xfd63('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15cf6f,_0x45f437,_0x5ca50e){return new BPromise(function(_0x3b0799,_0x3a6692){return client[_0xfd63('0xa')](_0x15cf6f,_0x5ca50e)['then'](function(_0x43dd7f){logger[_0xfd63('0xb')](_0xfd63('0xc'),_0x45f437,_0xfd63('0xd'));logger[_0xfd63('0xe')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x45f437,_0xfd63('0xd'),JSON[_0xfd63('0xf')](_0x43dd7f));if(_0x43dd7f[_0xfd63('0x10')]){if(_0x43dd7f[_0xfd63('0x10')][_0xfd63('0x11')]===0x1f4){logger[_0xfd63('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x45f437,_0x43dd7f[_0xfd63('0x10')][_0xfd63('0x12')]);return _0x3a6692(_0x43dd7f['error'][_0xfd63('0x12')]);}logger[_0xfd63('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x45f437,_0x43dd7f[_0xfd63('0x10')][_0xfd63('0x12')]);return _0x3b0799(_0x43dd7f[_0xfd63('0x10')]['message']);}else{logger[_0xfd63('0xb')](_0xfd63('0xc'),_0x45f437,_0xfd63('0xd'));_0x3b0799(_0x43dd7f['result'][_0xfd63('0x12')]);}})[_0xfd63('0x13')](function(_0x5043e8){logger[_0xfd63('0x10')](_0xfd63('0xc'),_0x45f437,_0x5043e8);_0x3a6692(_0x5043e8);});});}exports[_0xfd63('0x14')]=function(_0x48d788){var _0x235548=this;return new Promise(function(_0x239307,_0x5f1d5b){return db[_0xfd63('0x15')][_0xfd63('0x16')]({'raw':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')][_0xfd63('0x18')]===undefined?!![]:![]:!![],'where':_0x48d788['options']?_0x48d788['options'][_0xfd63('0x19')]||null:null,'attributes':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')]['attributes']||null:null,'limit':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')][_0xfd63('0x1a')]||null:null,'include':_0x48d788[_0xfd63('0x17')]?_0x48d788[_0xfd63('0x17')]['include']?_[_0xfd63('0x1b')](_0x48d788[_0xfd63('0x17')][_0xfd63('0x1c')],function(_0x312ce9){return{'model':db[_0x312ce9['model']],'as':_0x312ce9['as'],'attributes':_0x312ce9[_0xfd63('0x1d')],'include':_0x312ce9['include']?_[_0xfd63('0x1b')](_0x312ce9[_0xfd63('0x1c')],function(_0x400b89){return{'model':db[_0x400b89[_0xfd63('0x1e')]],'as':_0x400b89['as'],'attributes':_0x400b89[_0xfd63('0x1d')],'include':_0x400b89[_0xfd63('0x1c')]?_[_0xfd63('0x1b')](_0x400b89[_0xfd63('0x1c')],function(_0x6119b6){return{'model':db[_0x6119b6[_0xfd63('0x1e')]],'as':_0x6119b6['as'],'attributes':_0x6119b6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x3e4658){logger[_0xfd63('0xb')]('GetServicenowAccount',_0x48d788);logger[_0xfd63('0xe')](_0xfd63('0x14'),_0x48d788,JSON[_0xfd63('0xf')](_0x3e4658));_0x239307(_0x3e4658);})[_0xfd63('0x13')](function(_0xdef6c9){logger['error']('GetServicenowAccount',_0xdef6c9[_0xfd63('0x12')],_0x48d788);_0x5f1d5b(_0x235548[_0xfd63('0x10')](0x1f4,_0xdef6c9[_0xfd63('0x12')]));});});};exports[_0xfd63('0x1f')]=function(_0xb7f778){var _0x171dd4=this;return new Promise(function(_0x93d492,_0x5db1ea){return db[_0xfd63('0x15')]['find']({'raw':_0xb7f778['options']?_0xb7f778[_0xfd63('0x17')][_0xfd63('0x18')]===undefined?!![]:![]:!![],'where':_0xb7f778['options']?_0xb7f778[_0xfd63('0x17')]['where']||null:null,'attributes':_0xb7f778[_0xfd63('0x17')]?_0xb7f778[_0xfd63('0x17')][_0xfd63('0x1d')]||null:null,'include':_0xb7f778['options']?_0xb7f778[_0xfd63('0x17')][_0xfd63('0x1c')]?_['map'](_0xb7f778['options'][_0xfd63('0x1c')],function(_0x31acc1){return{'model':db[_0x31acc1['model']],'as':_0x31acc1['as'],'attributes':_0x31acc1[_0xfd63('0x1d')],'include':_0x31acc1[_0xfd63('0x1c')]?_[_0xfd63('0x1b')](_0x31acc1[_0xfd63('0x1c')],function(_0x458231){return{'model':db[_0x458231[_0xfd63('0x1e')]],'as':_0x458231['as'],'attributes':_0x458231['attributes'],'include':_0x458231[_0xfd63('0x1c')]?_[_0xfd63('0x1b')](_0x458231[_0xfd63('0x1c')],function(_0x40c389){return{'model':db[_0x40c389[_0xfd63('0x1e')]],'as':_0x40c389['as'],'attributes':_0x40c389[_0xfd63('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfd63('0x20')](function(_0x531fb1){logger[_0xfd63('0xb')](_0xfd63('0x1f'),_0xb7f778);logger['debug'](_0xfd63('0x1f'),_0xb7f778,JSON[_0xfd63('0xf')](_0x531fb1));_0x93d492(_0x531fb1);})[_0xfd63('0x13')](function(_0x154bcd){logger['error'](_0xfd63('0x1f'),_0x154bcd['message'],_0xb7f778);_0x5db1ea(_0x171dd4[_0xfd63('0x10')](0x1f4,_0x154bcd['message']));});});}; \ No newline at end of file +var _0x0d6f=['stringify','error','message','result','catch','findAll','options','where','attributes','include','map','model','GetServicenowAccount','ShowServicenowAccount','ServicenowAccount','find','raw','lodash','util','moment','bluebird','ioredis','../../config/utils','jayson/promise','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0xa679d8,_0x30b120){var _0x13f223=function(_0x174128){while(--_0x174128){_0xa679d8['push'](_0xa679d8['shift']());}};_0x13f223(++_0x30b120);}(_0x0d6f,0xb1));var _0xf0d6=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x0d6f[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xf0d6('0x0'));var util=require(_0xf0d6('0x1'));var moment=require(_0xf0d6('0x2'));var BPromise=require(_0xf0d6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0d6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf0d6('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf0d6('0x6'));var client=jayson['client'][_0xf0d6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x41c304,_0x4fe61e,_0x46f44d){return new BPromise(function(_0xb38e5c,_0x140ba5){return client[_0xf0d6('0x8')](_0x41c304,_0x46f44d)[_0xf0d6('0x9')](function(_0x44358a){logger[_0xf0d6('0xa')](_0xf0d6('0xb'),_0x4fe61e,_0xf0d6('0xc'));logger[_0xf0d6('0xd')](_0xf0d6('0xe'),_0x4fe61e,_0xf0d6('0xc'),JSON[_0xf0d6('0xf')](_0x44358a));if(_0x44358a[_0xf0d6('0x10')]){if(_0x44358a[_0xf0d6('0x10')]['code']===0x1f4){logger[_0xf0d6('0x10')](_0xf0d6('0xb'),_0x4fe61e,_0x44358a['error'][_0xf0d6('0x11')]);return _0x140ba5(_0x44358a[_0xf0d6('0x10')][_0xf0d6('0x11')]);}logger[_0xf0d6('0x10')](_0xf0d6('0xb'),_0x4fe61e,_0x44358a[_0xf0d6('0x10')]['message']);return _0xb38e5c(_0x44358a[_0xf0d6('0x10')]['message']);}else{logger['info'](_0xf0d6('0xb'),_0x4fe61e,_0xf0d6('0xc'));_0xb38e5c(_0x44358a[_0xf0d6('0x12')][_0xf0d6('0x11')]);}})[_0xf0d6('0x13')](function(_0x4980c8){logger[_0xf0d6('0x10')](_0xf0d6('0xb'),_0x4fe61e,_0x4980c8);_0x140ba5(_0x4980c8);});});}exports['GetServicenowAccount']=function(_0x1d4385){var _0x1e1e58=this;return new Promise(function(_0x3ef298,_0x3a5522){return db['ServicenowAccount'][_0xf0d6('0x14')]({'raw':_0x1d4385[_0xf0d6('0x15')]?_0x1d4385[_0xf0d6('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x1d4385[_0xf0d6('0x15')]?_0x1d4385['options'][_0xf0d6('0x16')]||null:null,'attributes':_0x1d4385[_0xf0d6('0x15')]?_0x1d4385[_0xf0d6('0x15')][_0xf0d6('0x17')]||null:null,'limit':_0x1d4385[_0xf0d6('0x15')]?_0x1d4385[_0xf0d6('0x15')]['limit']||null:null,'include':_0x1d4385[_0xf0d6('0x15')]?_0x1d4385[_0xf0d6('0x15')][_0xf0d6('0x18')]?_[_0xf0d6('0x19')](_0x1d4385[_0xf0d6('0x15')]['include'],function(_0x1d175a){return{'model':db[_0x1d175a['model']],'as':_0x1d175a['as'],'attributes':_0x1d175a['attributes'],'include':_0x1d175a[_0xf0d6('0x18')]?_['map'](_0x1d175a['include'],function(_0x3dcb19){return{'model':db[_0x3dcb19[_0xf0d6('0x1a')]],'as':_0x3dcb19['as'],'attributes':_0x3dcb19[_0xf0d6('0x17')],'include':_0x3dcb19[_0xf0d6('0x18')]?_['map'](_0x3dcb19['include'],function(_0x2a4e2a){return{'model':db[_0x2a4e2a[_0xf0d6('0x1a')]],'as':_0x2a4e2a['as'],'attributes':_0x2a4e2a[_0xf0d6('0x17')]};}):[]};}):[]};}):[]:[]})[_0xf0d6('0x9')](function(_0x18a437){logger[_0xf0d6('0xa')](_0xf0d6('0x1b'),_0x1d4385);logger['debug']('GetServicenowAccount',_0x1d4385,JSON[_0xf0d6('0xf')](_0x18a437));_0x3ef298(_0x18a437);})[_0xf0d6('0x13')](function(_0x19aa0a){logger[_0xf0d6('0x10')](_0xf0d6('0x1b'),_0x19aa0a[_0xf0d6('0x11')],_0x1d4385);_0x3a5522(_0x1e1e58[_0xf0d6('0x10')](0x1f4,_0x19aa0a[_0xf0d6('0x11')]));});});};exports[_0xf0d6('0x1c')]=function(_0x4f4955){var _0x42a962=this;return new Promise(function(_0x21b42e,_0x814a54){return db[_0xf0d6('0x1d')][_0xf0d6('0x1e')]({'raw':_0x4f4955[_0xf0d6('0x15')]?_0x4f4955[_0xf0d6('0x15')][_0xf0d6('0x1f')]===undefined?!![]:![]:!![],'where':_0x4f4955[_0xf0d6('0x15')]?_0x4f4955[_0xf0d6('0x15')][_0xf0d6('0x16')]||null:null,'attributes':_0x4f4955[_0xf0d6('0x15')]?_0x4f4955[_0xf0d6('0x15')][_0xf0d6('0x17')]||null:null,'include':_0x4f4955[_0xf0d6('0x15')]?_0x4f4955[_0xf0d6('0x15')][_0xf0d6('0x18')]?_[_0xf0d6('0x19')](_0x4f4955['options'][_0xf0d6('0x18')],function(_0x5ca75a){return{'model':db[_0x5ca75a[_0xf0d6('0x1a')]],'as':_0x5ca75a['as'],'attributes':_0x5ca75a[_0xf0d6('0x17')],'include':_0x5ca75a[_0xf0d6('0x18')]?_[_0xf0d6('0x19')](_0x5ca75a['include'],function(_0x215f82){return{'model':db[_0x215f82[_0xf0d6('0x1a')]],'as':_0x215f82['as'],'attributes':_0x215f82[_0xf0d6('0x17')],'include':_0x215f82[_0xf0d6('0x18')]?_[_0xf0d6('0x19')](_0x215f82[_0xf0d6('0x18')],function(_0x59802a){return{'model':db[_0x59802a[_0xf0d6('0x1a')]],'as':_0x59802a['as'],'attributes':_0x59802a['attributes']};}):[]};}):[]};}):[]:[]})[_0xf0d6('0x9')](function(_0x29fa09){logger[_0xf0d6('0xa')](_0xf0d6('0x1c'),_0x4f4955);logger['debug'](_0xf0d6('0x1c'),_0x4f4955,JSON['stringify'](_0x29fa09));_0x21b42e(_0x29fa09);})[_0xf0d6('0x13')](function(_0x1bedbb){logger[_0xf0d6('0x10')]('ShowServicenowAccount',_0x1bedbb[_0xf0d6('0x11')],_0x4f4955);_0x814a54(_0x42a962[_0xf0d6('0x10')](0x1f4,_0x1bedbb[_0xf0d6('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 6f67d7e..881ad2f 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 _0xc6a5=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','get'];(function(_0x3569e7,_0x2efc4c){var _0x3bdcf8=function(_0x544c54){while(--_0x544c54){_0x3569e7['push'](_0x3569e7['shift']());}};_0x3bdcf8(++_0x2efc4c);}(_0xc6a5,0x12c));var _0x5c6a=function(_0x3f53eb,_0x2a86d2){_0x3f53eb=_0x3f53eb-0x0;var _0x40486a=_0xc6a5[_0x3f53eb];return _0x40486a;};'use strict';var multer=require(_0x5c6a('0x0'));var util=require(_0x5c6a('0x1'));var path=require(_0x5c6a('0x2'));var timeout=require(_0x5c6a('0x3'));var express=require(_0x5c6a('0x4'));var router=express[_0x5c6a('0x5')]();var fs_extra=require(_0x5c6a('0x6'));var auth=require(_0x5c6a('0x7'));var interaction=require(_0x5c6a('0x8'));var config=require(_0x5c6a('0x9'));var controller=require(_0x5c6a('0xa'));router[_0x5c6a('0xb')]('/',auth[_0x5c6a('0xc')](),controller[_0x5c6a('0xd')]);router[_0x5c6a('0xb')](_0x5c6a('0xe'),auth['isAuthenticated'](),controller[_0x5c6a('0xf')]);router['get'](_0x5c6a('0x10'),auth[_0x5c6a('0xc')](),controller[_0x5c6a('0x11')]);router['get'](_0x5c6a('0x12'),auth['isAuthenticated'](),controller[_0x5c6a('0x13')]);router[_0x5c6a('0xb')](_0x5c6a('0x14'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5c6a('0x15')]('/',auth[_0x5c6a('0xc')](),controller[_0x5c6a('0x16')]);router['put'](_0x5c6a('0xe'),auth[_0x5c6a('0xc')](),controller[_0x5c6a('0x17')]);router[_0x5c6a('0x18')]('/:id',auth[_0x5c6a('0xc')](),controller['destroy']);module[_0x5c6a('0x19')]=router; \ No newline at end of file +var _0x2772=['./intServicenowConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','create','put','/:id','update','destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x269cf0,_0x459610){var _0x24f9ca=function(_0x3cd5de){while(--_0x3cd5de){_0x269cf0['push'](_0x269cf0['shift']());}};_0x24f9ca(++_0x459610);}(_0x2772,0xf6));var _0x2277=function(_0x529a18,_0x58d1b8){_0x529a18=_0x529a18-0x0;var _0x4bbbdc=_0x2772[_0x529a18];return _0x4bbbdc;};'use strict';var multer=require('multer');var util=require(_0x2277('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2277('0x1'));var router=express[_0x2277('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2277('0x3'));var interaction=require(_0x2277('0x4'));var config=require(_0x2277('0x5'));var controller=require(_0x2277('0x6'));router[_0x2277('0x7')]('/',auth[_0x2277('0x8')](),controller[_0x2277('0x9')]);router[_0x2277('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x2277('0xa')]);router[_0x2277('0x7')](_0x2277('0xb'),auth[_0x2277('0x8')](),controller['getFields']);router[_0x2277('0x7')](_0x2277('0xc'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x2277('0x7')](_0x2277('0xd'),auth[_0x2277('0x8')](),controller[_0x2277('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2277('0xf')]);router[_0x2277('0x10')](_0x2277('0x11'),auth[_0x2277('0x8')](),controller[_0x2277('0x12')]);router['delete'](_0x2277('0x11'),auth[_0x2277('0x8')](),controller[_0x2277('0x13')]);module[_0x2277('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index dcff6c6..150e19f 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 _0x51f0=['exports','STRING','sequelize'];(function(_0x260fb9,_0x2bc9da){var _0x5326af=function(_0x3f00ae){while(--_0x3f00ae){_0x260fb9['push'](_0x260fb9['shift']());}};_0x5326af(++_0x2bc9da);}(_0x51f0,0x1d0));var _0x051f=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x51f0[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0x051f('0x0'));module[_0x051f('0x1')]={'name':{'type':Sequelize[_0x051f('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3932=['sequelize','exports','STRING'];(function(_0x3c94d7,_0x1f09b3){var _0x24823c=function(_0xe30aa1){while(--_0xe30aa1){_0x3c94d7['push'](_0x3c94d7['shift']());}};_0x24823c(++_0x1f09b3);}(_0x3932,0x81));var _0x2393=function(_0x5dd248,_0x479ce8){_0x5dd248=_0x5dd248-0x0;var _0x2ca9c4=_0x3932[_0x5dd248];return _0x2ca9c4;};'use strict';var Sequelize=require(_0x2393('0x0'));module[_0x2393('0x1')]={'name':{'type':Sequelize[_0x2393('0x2')]},'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 f99984e..9401275 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 _0xf4b4=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','catch','show','params','find','create','body','update','getFields','findOne','ServicenowField','order','options','getSubjects','getDescriptions','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x2cc744,_0x2da12c){var _0x5a1f8e=function(_0x5b0315){while(--_0x5b0315){_0x2cc744['push'](_0x2cc744['shift']());}};_0x5a1f8e(++_0x2da12c);}(_0xf4b4,0x11f));var _0x4f4b=function(_0x3b06f1,_0x2c2f9a){_0x3b06f1=_0x3b06f1-0x0;var _0x1ab7fd=_0xf4b4[_0x3b06f1];return _0x1ab7fd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4b('0x0'));var rp=require(_0x4f4b('0x1'));var moment=require(_0x4f4b('0x2'));var BPromise=require(_0x4f4b('0x3'));var Mustache=require('mustache');var util=require(_0x4f4b('0x4'));var path=require(_0x4f4b('0x5'));var sox=require(_0x4f4b('0x6'));var csv=require(_0x4f4b('0x7'));var ejs=require(_0x4f4b('0x8'));var fs=require('fs');var fs_extra=require(_0x4f4b('0x9'));var _=require(_0x4f4b('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4f4b('0xb'));var deskjs=require(_0x4f4b('0xc'));var toCsv=require(_0x4f4b('0x7'));var querystring=require('querystring');var Papa=require(_0x4f4b('0xd'));var Redis=require(_0x4f4b('0xe'));var authService=require(_0x4f4b('0xf'));var qs=require(_0x4f4b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f4b('0x11'));var logger=require(_0x4f4b('0x12'))(_0x4f4b('0x13'));var utils=require('../../config/utils');var config=require(_0x4f4b('0x14'));var licenseUtil=require(_0x4f4b('0x15'));var db=require(_0x4f4b('0x16'))['db'];function respondWithStatusCode(_0x11139f,_0x18c63a){_0x18c63a=_0x18c63a||0xcc;return function(_0x35c304){if(_0x35c304){return _0x11139f[_0x4f4b('0x17')](_0x18c63a);}return _0x11139f[_0x4f4b('0x18')](_0x18c63a)[_0x4f4b('0x19')]();};}function respondWithResult(_0x54f296,_0x400d38){_0x400d38=_0x400d38||0xc8;return function(_0x55e8f6){if(_0x55e8f6){return _0x54f296[_0x4f4b('0x18')](_0x400d38)[_0x4f4b('0x1a')](_0x55e8f6);}};}function respondWithFilteredResult(_0x2d5f9c,_0x29e2ce){return function(_0x51d4dd){if(_0x51d4dd){var _0x58e327=typeof _0x29e2ce[_0x4f4b('0x1b')]==='undefined'&&typeof _0x29e2ce[_0x4f4b('0x1c')]==='undefined';var _0x2b08fe=_0x51d4dd[_0x4f4b('0x1d')];var _0x4f8ebb=_0x58e327?0x0:_0x29e2ce[_0x4f4b('0x1b')];var _0xfa64b6=_0x58e327?_0x51d4dd['count']:_0x29e2ce[_0x4f4b('0x1b')]+_0x29e2ce[_0x4f4b('0x1c')];var _0x25caf6;if(_0xfa64b6>=_0x2b08fe){_0xfa64b6=_0x2b08fe;_0x25caf6=0xc8;}else{_0x25caf6=0xce;}_0x2d5f9c[_0x4f4b('0x18')](_0x25caf6);return _0x2d5f9c[_0x4f4b('0x1e')](_0x4f4b('0x1f'),_0x4f8ebb+'-'+_0xfa64b6+'/'+_0x2b08fe)[_0x4f4b('0x1a')](_0x51d4dd);}return null;};}function patchUpdates(_0x3dfa3a){return function(_0x40a842){try{jsonpatch[_0x4f4b('0x20')](_0x40a842,_0x3dfa3a,!![]);}catch(_0x4c7568){return BPromise[_0x4f4b('0x21')](_0x4c7568);}return _0x40a842[_0x4f4b('0x22')]();};}function saveUpdates(_0x43c8f3,_0x590f95){return function(_0x5280a8){if(_0x5280a8){return _0x5280a8['update'](_0x43c8f3)[_0x4f4b('0x23')](function(_0x1f4d07){return _0x1f4d07;});}return null;};}function removeEntity(_0x19cd3c,_0x4b2a6d){return function(_0x3972ef){if(_0x3972ef){return _0x3972ef[_0x4f4b('0x24')]()[_0x4f4b('0x23')](function(){_0x19cd3c['status'](0xcc)[_0x4f4b('0x19')]();});}};}function handleEntityNotFound(_0x74ad5e,_0x4644d0){return function(_0x4b2f22){if(!_0x4b2f22){_0x74ad5e[_0x4f4b('0x17')](0x194);}return _0x4b2f22;};}function handleError(_0x2d3de2,_0x3b309e){_0x3b309e=_0x3b309e||0x1f4;return function(_0x3eb6b4){logger[_0x4f4b('0x25')](_0x3eb6b4[_0x4f4b('0x26')]);if(_0x3eb6b4['name']){delete _0x3eb6b4[_0x4f4b('0x27')];}_0x2d3de2[_0x4f4b('0x18')](_0x3b309e)[_0x4f4b('0x28')](_0x3eb6b4);};}exports['index']=function(_0x43b452,_0x28c00e){var _0xdbadde={},_0x18181b={},_0x22031e={'count':0x0,'rows':[]};var _0x2ac948=_[_0x4f4b('0x29')](db[_0x4f4b('0x2a')][_0x4f4b('0x2b')],function(_0x243669){return{'name':_0x243669['fieldName'],'type':_0x243669[_0x4f4b('0x2c')]['key']};});_0x18181b[_0x4f4b('0x2d')]=_['map'](_0x2ac948,_0x4f4b('0x27'));_0x18181b[_0x4f4b('0x2e')]=_[_0x4f4b('0x2f')](_0x43b452[_0x4f4b('0x2e')]);_0x18181b[_0x4f4b('0x30')]=_[_0x4f4b('0x31')](_0x18181b[_0x4f4b('0x2d')],_0x18181b[_0x4f4b('0x2e')]);_0xdbadde[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x18181b['model'],qs[_0x4f4b('0x33')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x33')]));_0xdbadde[_0x4f4b('0x32')]=_0xdbadde[_0x4f4b('0x32')][_0x4f4b('0x34')]?_0xdbadde[_0x4f4b('0x32')]:_0x18181b['model'];if(!_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0xdbadde[_0x4f4b('0x1c')]=qs[_0x4f4b('0x1c')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x1c')]);_0xdbadde[_0x4f4b('0x1b')]=qs[_0x4f4b('0x1b')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x1b')]);}_0xdbadde['order']=qs[_0x4f4b('0x37')](_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0xdbadde[_0x4f4b('0x38')]=qs['filters'](_[_0x4f4b('0x39')](_0x43b452[_0x4f4b('0x2e')],_0x18181b[_0x4f4b('0x30')]),_0x2ac948);if(_0x43b452['query'][_0x4f4b('0x3a')]){_0xdbadde[_0x4f4b('0x38')]=_['merge'](_0xdbadde[_0x4f4b('0x38')],{'$or':_[_0x4f4b('0x29')](_0x2ac948,function(_0x52b23e){if(_0x52b23e[_0x4f4b('0x2c')]!==_0x4f4b('0x3b')){var _0x55d42b={};_0x55d42b[_0x52b23e['name']]={'$like':'%'+_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x3a')]+'%'};return _0x55d42b;}})});}_0xdbadde=_[_0x4f4b('0x3c')]({},_0xdbadde,_0x43b452['options']);var _0x53af07={'where':_0xdbadde['where']};return db[_0x4f4b('0x2a')][_0x4f4b('0x1d')](_0x53af07)[_0x4f4b('0x23')](function(_0xdda957){_0x22031e[_0x4f4b('0x1d')]=_0xdda957;if(_0x43b452[_0x4f4b('0x2e')][_0x4f4b('0x3d')]){_0xdbadde[_0x4f4b('0x3e')]=[{'all':!![]}];}return db[_0x4f4b('0x2a')]['findAll'](_0xdbadde);})[_0x4f4b('0x23')](function(_0x15724c){_0x22031e['rows']=_0x15724c;return _0x22031e;})[_0x4f4b('0x23')](respondWithFilteredResult(_0x28c00e,_0xdbadde))[_0x4f4b('0x3f')](handleError(_0x28c00e,null));};exports[_0x4f4b('0x40')]=function(_0x5e45c9,_0x4a5b73){var _0xf82cc3={'raw':![],'where':{'id':_0x5e45c9[_0x4f4b('0x41')]['id']}},_0x5bb9c0={};_0x5bb9c0[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x2a')][_0x4f4b('0x2b')]);_0x5bb9c0['query']=_['keys'](_0x5e45c9[_0x4f4b('0x2e')]);_0x5bb9c0[_0x4f4b('0x30')]=_['intersection'](_0x5bb9c0[_0x4f4b('0x2d')],_0x5bb9c0[_0x4f4b('0x2e')]);_0xf82cc3[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x5bb9c0['model'],qs[_0x4f4b('0x33')](_0x5e45c9[_0x4f4b('0x2e')][_0x4f4b('0x33')]));_0xf82cc3[_0x4f4b('0x32')]=_0xf82cc3['attributes']['length']?_0xf82cc3[_0x4f4b('0x32')]:_0x5bb9c0[_0x4f4b('0x2d')];if(_0x5e45c9[_0x4f4b('0x2e')][_0x4f4b('0x3d')]){_0xf82cc3['include']=[{'all':!![]}];}_0xf82cc3=_[_0x4f4b('0x3c')]({},_0xf82cc3,_0x5e45c9['options']);return db['ServicenowConfiguration'][_0x4f4b('0x42')](_0xf82cc3)[_0x4f4b('0x23')](handleEntityNotFound(_0x4a5b73,null))[_0x4f4b('0x23')](respondWithResult(_0x4a5b73,null))[_0x4f4b('0x3f')](handleError(_0x4a5b73,null));};exports[_0x4f4b('0x43')]=function(_0x49e30c,_0x3e00a0){return db[_0x4f4b('0x2a')][_0x4f4b('0x43')](_0x49e30c[_0x4f4b('0x44')],{})[_0x4f4b('0x23')](respondWithResult(_0x3e00a0,0xc9))[_0x4f4b('0x3f')](handleError(_0x3e00a0,null));};exports[_0x4f4b('0x45')]=function(_0x5f26bc,_0x1ff115){if(_0x5f26bc[_0x4f4b('0x44')]['id']){delete _0x5f26bc['body']['id'];}return db[_0x4f4b('0x2a')][_0x4f4b('0x42')]({'where':{'id':_0x5f26bc[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x1ff115,null))[_0x4f4b('0x23')](saveUpdates(_0x5f26bc[_0x4f4b('0x44')],null))[_0x4f4b('0x23')](respondWithResult(_0x1ff115,null))['catch'](handleError(_0x1ff115,null));};exports[_0x4f4b('0x24')]=function(_0xebb011,_0x3818ba){return db[_0x4f4b('0x2a')][_0x4f4b('0x42')]({'where':{'id':_0xebb011[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x3818ba,null))[_0x4f4b('0x23')](removeEntity(_0x3818ba,null))[_0x4f4b('0x3f')](handleError(_0x3818ba,null));};exports[_0x4f4b('0x46')]=function(_0x9e9122,_0x31fd8f,_0xf2520f){var _0x199646={};var _0xe4de43={};var _0x2a945d;var _0x22c15a;return db['ServicenowConfiguration'][_0x4f4b('0x47')]({'where':{'id':_0x9e9122[_0x4f4b('0x41')]['id']}})['then'](handleEntityNotFound(_0x31fd8f,null))[_0x4f4b('0x23')](function(_0x3fa7a3){if(_0x3fa7a3){_0x2a945d=_0x3fa7a3;_0xe4de43[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x48')][_0x4f4b('0x2b')]);_0xe4de43['query']=_[_0x4f4b('0x2f')](_0x9e9122[_0x4f4b('0x2e')]);_0xe4de43['filters']=_['intersection'](_0xe4de43[_0x4f4b('0x2d')],_0xe4de43['query']);_0x199646[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0xe4de43[_0x4f4b('0x2d')],qs[_0x4f4b('0x33')](_0x9e9122['query'][_0x4f4b('0x33')]));_0x199646[_0x4f4b('0x32')]=_0x199646[_0x4f4b('0x32')]['length']?_0x199646[_0x4f4b('0x32')]:_0xe4de43[_0x4f4b('0x2d')];_0x199646[_0x4f4b('0x49')]=qs['sort'](_0x9e9122[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0x199646['where']=qs[_0x4f4b('0x30')](_[_0x4f4b('0x39')](_0x9e9122[_0x4f4b('0x2e')],_0xe4de43[_0x4f4b('0x30')]));if(_0x9e9122['query'][_0x4f4b('0x3a')]){_0x199646[_0x4f4b('0x38')]=_[_0x4f4b('0x3c')](_0x199646['where'],{'$or':_[_0x4f4b('0x29')](_0x199646['attributes'],function(_0x4c337c){var _0x1e3895={};_0x1e3895[_0x4c337c]={'$like':'%'+_0x9e9122[_0x4f4b('0x2e')]['filter']+'%'};return _0x1e3895;})});}_0x199646=_[_0x4f4b('0x3c')]({},_0x199646,_0x9e9122[_0x4f4b('0x4a')]);return _0x2a945d['getFields'](_0x199646);}})['then'](function(_0x4ad61b){if(_0x4ad61b){_0x22c15a=_0x4ad61b[_0x4f4b('0x34')];if(!_0x9e9122[_0x4f4b('0x2e')][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0x199646['limit']=qs[_0x4f4b('0x1c')](_0x9e9122['query'][_0x4f4b('0x1c')]);_0x199646[_0x4f4b('0x1b')]=qs[_0x4f4b('0x1b')](_0x9e9122[_0x4f4b('0x2e')][_0x4f4b('0x1b')]);}return _0x2a945d[_0x4f4b('0x46')](_0x199646);}})[_0x4f4b('0x23')](function(_0x53e84b){if(_0x53e84b){return _0x53e84b?{'count':_0x22c15a,'rows':_0x53e84b}:null;}})[_0x4f4b('0x23')](respondWithResult(_0x31fd8f,null))['catch'](handleError(_0x31fd8f,null));};exports[_0x4f4b('0x4b')]=function(_0x412a8a,_0x41133f,_0x2fc21c){var _0x1d4d42={};var _0x13eb18={};var _0x463f0c;var _0xb499df;return db[_0x4f4b('0x2a')][_0x4f4b('0x47')]({'where':{'id':_0x412a8a[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x41133f,null))[_0x4f4b('0x23')](function(_0xe988a5){if(_0xe988a5){_0x463f0c=_0xe988a5;_0x13eb18[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x48')]['rawAttributes']);_0x13eb18[_0x4f4b('0x2e')]=_[_0x4f4b('0x2f')](_0x412a8a[_0x4f4b('0x2e')]);_0x13eb18[_0x4f4b('0x30')]=_[_0x4f4b('0x31')](_0x13eb18[_0x4f4b('0x2d')],_0x13eb18[_0x4f4b('0x2e')]);_0x1d4d42[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x13eb18[_0x4f4b('0x2d')],qs['fields'](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x33')]));_0x1d4d42[_0x4f4b('0x32')]=_0x1d4d42[_0x4f4b('0x32')][_0x4f4b('0x34')]?_0x1d4d42[_0x4f4b('0x32')]:_0x13eb18[_0x4f4b('0x2d')];_0x1d4d42['order']=qs['sort'](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0x1d4d42[_0x4f4b('0x38')]=qs[_0x4f4b('0x30')](_[_0x4f4b('0x39')](_0x412a8a[_0x4f4b('0x2e')],_0x13eb18['filters']));if(_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x3a')]){_0x1d4d42[_0x4f4b('0x38')]=_[_0x4f4b('0x3c')](_0x1d4d42['where'],{'$or':_[_0x4f4b('0x29')](_0x1d4d42[_0x4f4b('0x32')],function(_0x260993){var _0x40fb09={};_0x40fb09[_0x260993]={'$like':'%'+_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x3a')]+'%'};return _0x40fb09;})});}_0x1d4d42=_[_0x4f4b('0x3c')]({},_0x1d4d42,_0x412a8a['options']);return _0x463f0c[_0x4f4b('0x4b')](_0x1d4d42);}})[_0x4f4b('0x23')](function(_0x50d0de){if(_0x50d0de){_0xb499df=_0x50d0de[_0x4f4b('0x34')];if(!_0x412a8a[_0x4f4b('0x2e')]['hasOwnProperty'](_0x4f4b('0x36'))){_0x1d4d42['limit']=qs['limit'](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x1c')]);_0x1d4d42[_0x4f4b('0x1b')]=qs[_0x4f4b('0x1b')](_0x412a8a[_0x4f4b('0x2e')][_0x4f4b('0x1b')]);}return _0x463f0c[_0x4f4b('0x4b')](_0x1d4d42);}})[_0x4f4b('0x23')](function(_0x1e4547){if(_0x1e4547){return _0x1e4547?{'count':_0xb499df,'rows':_0x1e4547}:null;}})[_0x4f4b('0x23')](respondWithResult(_0x41133f,null))[_0x4f4b('0x3f')](handleError(_0x41133f,null));};exports[_0x4f4b('0x4c')]=function(_0x262860,_0x325dd6,_0xb58462){var _0x4c7995={};var _0x53abcd={};var _0xa21969;var _0xa900d8;return db[_0x4f4b('0x2a')][_0x4f4b('0x47')]({'where':{'id':_0x262860[_0x4f4b('0x41')]['id']}})[_0x4f4b('0x23')](handleEntityNotFound(_0x325dd6,null))[_0x4f4b('0x23')](function(_0x3c118a){if(_0x3c118a){_0xa21969=_0x3c118a;_0x53abcd[_0x4f4b('0x2d')]=_[_0x4f4b('0x2f')](db[_0x4f4b('0x48')][_0x4f4b('0x2b')]);_0x53abcd[_0x4f4b('0x2e')]=_[_0x4f4b('0x2f')](_0x262860['query']);_0x53abcd[_0x4f4b('0x30')]=_[_0x4f4b('0x31')](_0x53abcd[_0x4f4b('0x2d')],_0x53abcd['query']);_0x4c7995[_0x4f4b('0x32')]=_[_0x4f4b('0x31')](_0x53abcd[_0x4f4b('0x2d')],qs[_0x4f4b('0x33')](_0x262860['query']['fields']));_0x4c7995[_0x4f4b('0x32')]=_0x4c7995[_0x4f4b('0x32')]['length']?_0x4c7995[_0x4f4b('0x32')]:_0x53abcd[_0x4f4b('0x2d')];_0x4c7995[_0x4f4b('0x49')]=qs[_0x4f4b('0x37')](_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x37')]);_0x4c7995[_0x4f4b('0x38')]=qs[_0x4f4b('0x30')](_[_0x4f4b('0x39')](_0x262860[_0x4f4b('0x2e')],_0x53abcd[_0x4f4b('0x30')]));if(_0x262860['query'][_0x4f4b('0x3a')]){_0x4c7995[_0x4f4b('0x38')]=_['merge'](_0x4c7995[_0x4f4b('0x38')],{'$or':_['map'](_0x4c7995[_0x4f4b('0x32')],function(_0x26bb2f){var _0x12449e={};_0x12449e[_0x26bb2f]={'$like':'%'+_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x3a')]+'%'};return _0x12449e;})});}_0x4c7995=_[_0x4f4b('0x3c')]({},_0x4c7995,_0x262860[_0x4f4b('0x4a')]);return _0xa21969[_0x4f4b('0x4c')](_0x4c7995);}})[_0x4f4b('0x23')](function(_0x24bc29){if(_0x24bc29){_0xa900d8=_0x24bc29[_0x4f4b('0x34')];if(!_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x35')](_0x4f4b('0x36'))){_0x4c7995[_0x4f4b('0x1c')]=qs['limit'](_0x262860[_0x4f4b('0x2e')][_0x4f4b('0x1c')]);_0x4c7995['offset']=qs['offset'](_0x262860['query']['offset']);}return _0xa21969[_0x4f4b('0x4c')](_0x4c7995);}})[_0x4f4b('0x23')](function(_0x128536){if(_0x128536){return _0x128536?{'count':_0xa900d8,'rows':_0x128536}:null;}})['then'](respondWithResult(_0x325dd6,null))[_0x4f4b('0x3f')](handleError(_0x325dd6,null));}; \ No newline at end of file +var _0x03a6=['fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','reject','save','update','then','destroy','sendStatus','stack','name','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','findOne','options','getFields','hasOwnProperty','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs'];(function(_0x170941,_0x38d105){var _0x50e48d=function(_0x1eb49a){while(--_0x1eb49a){_0x170941['push'](_0x170941['shift']());}};_0x50e48d(++_0x38d105);}(_0x03a6,0xf1));var _0x603a=function(_0x425a8d,_0x51395a){_0x425a8d=_0x425a8d-0x0;var _0x2520af=_0x03a6[_0x425a8d];return _0x2520af;};'use strict';var emlformat=require(_0x603a('0x0'));var rimraf=require(_0x603a('0x1'));var zipdir=require(_0x603a('0x2'));var jsonpatch=require(_0x603a('0x3'));var rp=require(_0x603a('0x4'));var moment=require(_0x603a('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x603a('0x6'));var util=require(_0x603a('0x7'));var path=require(_0x603a('0x8'));var sox=require(_0x603a('0x9'));var csv=require('to-csv');var ejs=require(_0x603a('0xa'));var fs=require('fs');var fs_extra=require(_0x603a('0xb'));var _=require(_0x603a('0xc'));var squel=require(_0x603a('0xd'));var crypto=require(_0x603a('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x603a('0xf'));var toCsv=require(_0x603a('0x10'));var querystring=require(_0x603a('0x11'));var Papa=require(_0x603a('0x12'));var Redis=require(_0x603a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x603a('0x14'));var as=require(_0x603a('0x15'));var hardwareService=require(_0x603a('0x16'));var logger=require(_0x603a('0x17'))(_0x603a('0x18'));var utils=require(_0x603a('0x19'));var config=require(_0x603a('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x603a('0x1b'))['db'];function respondWithStatusCode(_0x5936f0,_0x1674d8){_0x1674d8=_0x1674d8||0xcc;return function(_0x53ded7){if(_0x53ded7){return _0x5936f0['sendStatus'](_0x1674d8);}return _0x5936f0[_0x603a('0x1c')](_0x1674d8)[_0x603a('0x1d')]();};}function respondWithResult(_0xc6e9e8,_0xb309f2){_0xb309f2=_0xb309f2||0xc8;return function(_0x1edc65){if(_0x1edc65){return _0xc6e9e8[_0x603a('0x1c')](_0xb309f2)['json'](_0x1edc65);}};}function respondWithFilteredResult(_0x2ad3b0,_0x35823d){return function(_0x25b707){if(_0x25b707){var _0x1e2395=typeof _0x35823d[_0x603a('0x1e')]===_0x603a('0x1f')&&typeof _0x35823d[_0x603a('0x20')]===_0x603a('0x1f');var _0x27c0d7=_0x25b707[_0x603a('0x21')];var _0x3c0a6f=_0x1e2395?0x0:_0x35823d[_0x603a('0x1e')];var _0x466496=_0x1e2395?_0x25b707[_0x603a('0x21')]:_0x35823d[_0x603a('0x1e')]+_0x35823d[_0x603a('0x20')];var _0x10f692;if(_0x466496>=_0x27c0d7){_0x466496=_0x27c0d7;_0x10f692=0xc8;}else{_0x10f692=0xce;}_0x2ad3b0[_0x603a('0x1c')](_0x10f692);return _0x2ad3b0['set']('Content-Range',_0x3c0a6f+'-'+_0x466496+'/'+_0x27c0d7)[_0x603a('0x22')](_0x25b707);}return null;};}function patchUpdates(_0x5580f4){return function(_0x15f06e){try{jsonpatch[_0x603a('0x23')](_0x15f06e,_0x5580f4,!![]);}catch(_0x3f0150){return BPromise[_0x603a('0x24')](_0x3f0150);}return _0x15f06e[_0x603a('0x25')]();};}function saveUpdates(_0x3f0400,_0x3d2fb2){return function(_0x439f14){if(_0x439f14){return _0x439f14[_0x603a('0x26')](_0x3f0400)[_0x603a('0x27')](function(_0x136108){return _0x136108;});}return null;};}function removeEntity(_0x3ec49d,_0x123b33){return function(_0xa182b4){if(_0xa182b4){return _0xa182b4[_0x603a('0x28')]()[_0x603a('0x27')](function(){_0x3ec49d[_0x603a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2deff4,_0x2aac77){return function(_0x7cf483){if(!_0x7cf483){_0x2deff4[_0x603a('0x29')](0x194);}return _0x7cf483;};}function handleError(_0x1f7d13,_0x264e48){_0x264e48=_0x264e48||0x1f4;return function(_0x5364dc){logger['error'](_0x5364dc[_0x603a('0x2a')]);if(_0x5364dc[_0x603a('0x2b')]){delete _0x5364dc[_0x603a('0x2b')];}_0x1f7d13[_0x603a('0x1c')](_0x264e48)['send'](_0x5364dc);};}exports[_0x603a('0x2c')]=function(_0x3db2e6,_0x573b54){var _0x25a03c={},_0x48d738={},_0x2d285b={'count':0x0,'rows':[]};var _0x5a39f3=_['map'](db[_0x603a('0x2d')][_0x603a('0x2e')],function(_0x3d2ec8){return{'name':_0x3d2ec8[_0x603a('0x2f')],'type':_0x3d2ec8[_0x603a('0x30')][_0x603a('0x31')]};});_0x48d738['model']=_[_0x603a('0x32')](_0x5a39f3,_0x603a('0x2b'));_0x48d738['query']=_[_0x603a('0x33')](_0x3db2e6[_0x603a('0x34')]);_0x48d738[_0x603a('0x35')]=_[_0x603a('0x36')](_0x48d738[_0x603a('0x37')],_0x48d738['query']);_0x25a03c[_0x603a('0x38')]=_[_0x603a('0x36')](_0x48d738['model'],qs[_0x603a('0x39')](_0x3db2e6[_0x603a('0x34')][_0x603a('0x39')]));_0x25a03c[_0x603a('0x38')]=_0x25a03c[_0x603a('0x38')]['length']?_0x25a03c[_0x603a('0x38')]:_0x48d738[_0x603a('0x37')];if(!_0x3db2e6[_0x603a('0x34')]['hasOwnProperty'](_0x603a('0x3a'))){_0x25a03c[_0x603a('0x20')]=qs[_0x603a('0x20')](_0x3db2e6[_0x603a('0x34')][_0x603a('0x20')]);_0x25a03c[_0x603a('0x1e')]=qs[_0x603a('0x1e')](_0x3db2e6[_0x603a('0x34')][_0x603a('0x1e')]);}_0x25a03c[_0x603a('0x3b')]=qs[_0x603a('0x3c')](_0x3db2e6[_0x603a('0x34')][_0x603a('0x3c')]);_0x25a03c['where']=qs['filters'](_[_0x603a('0x3d')](_0x3db2e6['query'],_0x48d738[_0x603a('0x35')]),_0x5a39f3);if(_0x3db2e6[_0x603a('0x34')][_0x603a('0x3e')]){_0x25a03c[_0x603a('0x3f')]=_['merge'](_0x25a03c[_0x603a('0x3f')],{'$or':_['map'](_0x5a39f3,function(_0x80db6a){if(_0x80db6a[_0x603a('0x30')]!==_0x603a('0x40')){var _0x998ac9={};_0x998ac9[_0x80db6a['name']]={'$like':'%'+_0x3db2e6[_0x603a('0x34')][_0x603a('0x3e')]+'%'};return _0x998ac9;}})});}_0x25a03c=_[_0x603a('0x41')]({},_0x25a03c,_0x3db2e6['options']);var _0x3c0d6d={'where':_0x25a03c[_0x603a('0x3f')]};return db['ServicenowConfiguration']['count'](_0x3c0d6d)[_0x603a('0x27')](function(_0x2de95e){_0x2d285b['count']=_0x2de95e;if(_0x3db2e6[_0x603a('0x34')][_0x603a('0x42')]){_0x25a03c[_0x603a('0x43')]=[{'all':!![]}];}return db[_0x603a('0x2d')][_0x603a('0x44')](_0x25a03c);})['then'](function(_0x4c156f){_0x2d285b[_0x603a('0x45')]=_0x4c156f;return _0x2d285b;})[_0x603a('0x27')](respondWithFilteredResult(_0x573b54,_0x25a03c))['catch'](handleError(_0x573b54,null));};exports[_0x603a('0x46')]=function(_0x4e34a8,_0x433544){var _0x2c3442={'raw':![],'where':{'id':_0x4e34a8[_0x603a('0x47')]['id']}},_0x4a0250={};_0x4a0250[_0x603a('0x37')]=_[_0x603a('0x33')](db[_0x603a('0x2d')][_0x603a('0x2e')]);_0x4a0250['query']=_[_0x603a('0x33')](_0x4e34a8[_0x603a('0x34')]);_0x4a0250[_0x603a('0x35')]=_[_0x603a('0x36')](_0x4a0250['model'],_0x4a0250['query']);_0x2c3442[_0x603a('0x38')]=_['intersection'](_0x4a0250[_0x603a('0x37')],qs[_0x603a('0x39')](_0x4e34a8['query'][_0x603a('0x39')]));_0x2c3442[_0x603a('0x38')]=_0x2c3442[_0x603a('0x38')][_0x603a('0x48')]?_0x2c3442['attributes']:_0x4a0250[_0x603a('0x37')];if(_0x4e34a8[_0x603a('0x34')][_0x603a('0x42')]){_0x2c3442[_0x603a('0x43')]=[{'all':!![]}];}_0x2c3442=_['merge']({},_0x2c3442,_0x4e34a8['options']);return db[_0x603a('0x2d')][_0x603a('0x49')](_0x2c3442)[_0x603a('0x27')](handleEntityNotFound(_0x433544,null))['then'](respondWithResult(_0x433544,null))[_0x603a('0x4a')](handleError(_0x433544,null));};exports[_0x603a('0x4b')]=function(_0xeb9ad0,_0x322ebd){return db[_0x603a('0x2d')][_0x603a('0x4b')](_0xeb9ad0[_0x603a('0x4c')],{})[_0x603a('0x27')](respondWithResult(_0x322ebd,0xc9))[_0x603a('0x4a')](handleError(_0x322ebd,null));};exports['update']=function(_0x35b636,_0x12f64a){if(_0x35b636[_0x603a('0x4c')]['id']){delete _0x35b636[_0x603a('0x4c')]['id'];}return db[_0x603a('0x2d')][_0x603a('0x49')]({'where':{'id':_0x35b636[_0x603a('0x47')]['id']}})[_0x603a('0x27')](handleEntityNotFound(_0x12f64a,null))[_0x603a('0x27')](saveUpdates(_0x35b636['body'],null))[_0x603a('0x27')](respondWithResult(_0x12f64a,null))[_0x603a('0x4a')](handleError(_0x12f64a,null));};exports[_0x603a('0x28')]=function(_0x4dd4b6,_0x12e146){return db['ServicenowConfiguration'][_0x603a('0x49')]({'where':{'id':_0x4dd4b6[_0x603a('0x47')]['id']}})[_0x603a('0x27')](handleEntityNotFound(_0x12e146,null))['then'](removeEntity(_0x12e146,null))['catch'](handleError(_0x12e146,null));};exports['getFields']=function(_0x2f5779,_0x3485af,_0x54e7f9){var _0xff8b82={};var _0x5d310a={};var _0x57d04f;var _0x478ecd;return db[_0x603a('0x2d')][_0x603a('0x4d')]({'where':{'id':_0x2f5779[_0x603a('0x47')]['id']}})['then'](handleEntityNotFound(_0x3485af,null))['then'](function(_0x1e9c1c){if(_0x1e9c1c){_0x57d04f=_0x1e9c1c;_0x5d310a[_0x603a('0x37')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x5d310a[_0x603a('0x34')]=_['keys'](_0x2f5779['query']);_0x5d310a[_0x603a('0x35')]=_[_0x603a('0x36')](_0x5d310a[_0x603a('0x37')],_0x5d310a['query']);_0xff8b82[_0x603a('0x38')]=_['intersection'](_0x5d310a['model'],qs['fields'](_0x2f5779[_0x603a('0x34')][_0x603a('0x39')]));_0xff8b82[_0x603a('0x38')]=_0xff8b82[_0x603a('0x38')][_0x603a('0x48')]?_0xff8b82[_0x603a('0x38')]:_0x5d310a['model'];_0xff8b82['order']=qs[_0x603a('0x3c')](_0x2f5779[_0x603a('0x34')][_0x603a('0x3c')]);_0xff8b82[_0x603a('0x3f')]=qs[_0x603a('0x35')](_[_0x603a('0x3d')](_0x2f5779[_0x603a('0x34')],_0x5d310a[_0x603a('0x35')]));if(_0x2f5779[_0x603a('0x34')][_0x603a('0x3e')]){_0xff8b82['where']=_['merge'](_0xff8b82[_0x603a('0x3f')],{'$or':_[_0x603a('0x32')](_0xff8b82[_0x603a('0x38')],function(_0x5e9721){var _0x4dd62c={};_0x4dd62c[_0x5e9721]={'$like':'%'+_0x2f5779[_0x603a('0x34')][_0x603a('0x3e')]+'%'};return _0x4dd62c;})});}_0xff8b82=_['merge']({},_0xff8b82,_0x2f5779[_0x603a('0x4e')]);return _0x57d04f[_0x603a('0x4f')](_0xff8b82);}})['then'](function(_0x4ef76b){if(_0x4ef76b){_0x478ecd=_0x4ef76b[_0x603a('0x48')];if(!_0x2f5779['query'][_0x603a('0x50')](_0x603a('0x3a'))){_0xff8b82[_0x603a('0x20')]=qs['limit'](_0x2f5779['query']['limit']);_0xff8b82['offset']=qs[_0x603a('0x1e')](_0x2f5779[_0x603a('0x34')][_0x603a('0x1e')]);}return _0x57d04f[_0x603a('0x4f')](_0xff8b82);}})[_0x603a('0x27')](function(_0x409f4d){if(_0x409f4d){return _0x409f4d?{'count':_0x478ecd,'rows':_0x409f4d}:null;}})[_0x603a('0x27')](respondWithResult(_0x3485af,null))['catch'](handleError(_0x3485af,null));};exports['getSubjects']=function(_0x3b5044,_0x16ec64,_0x5d1b19){var _0x463594={};var _0x5500ff={};var _0x6427dc;var _0x27b666;return db[_0x603a('0x2d')][_0x603a('0x4d')]({'where':{'id':_0x3b5044[_0x603a('0x47')]['id']}})['then'](handleEntityNotFound(_0x16ec64,null))[_0x603a('0x27')](function(_0x48481e){if(_0x48481e){_0x6427dc=_0x48481e;_0x5500ff[_0x603a('0x37')]=_[_0x603a('0x33')](db[_0x603a('0x51')]['rawAttributes']);_0x5500ff[_0x603a('0x34')]=_[_0x603a('0x33')](_0x3b5044[_0x603a('0x34')]);_0x5500ff['filters']=_[_0x603a('0x36')](_0x5500ff[_0x603a('0x37')],_0x5500ff[_0x603a('0x34')]);_0x463594[_0x603a('0x38')]=_[_0x603a('0x36')](_0x5500ff[_0x603a('0x37')],qs['fields'](_0x3b5044['query']['fields']));_0x463594[_0x603a('0x38')]=_0x463594[_0x603a('0x38')]['length']?_0x463594[_0x603a('0x38')]:_0x5500ff[_0x603a('0x37')];_0x463594[_0x603a('0x3b')]=qs[_0x603a('0x3c')](_0x3b5044[_0x603a('0x34')][_0x603a('0x3c')]);_0x463594[_0x603a('0x3f')]=qs[_0x603a('0x35')](_['pick'](_0x3b5044[_0x603a('0x34')],_0x5500ff[_0x603a('0x35')]));if(_0x3b5044[_0x603a('0x34')][_0x603a('0x3e')]){_0x463594[_0x603a('0x3f')]=_['merge'](_0x463594[_0x603a('0x3f')],{'$or':_['map'](_0x463594['attributes'],function(_0x3de75f){var _0x89ee49={};_0x89ee49[_0x3de75f]={'$like':'%'+_0x3b5044['query'][_0x603a('0x3e')]+'%'};return _0x89ee49;})});}_0x463594=_[_0x603a('0x41')]({},_0x463594,_0x3b5044['options']);return _0x6427dc[_0x603a('0x52')](_0x463594);}})['then'](function(_0x6f082){if(_0x6f082){_0x27b666=_0x6f082['length'];if(!_0x3b5044[_0x603a('0x34')][_0x603a('0x50')](_0x603a('0x3a'))){_0x463594[_0x603a('0x20')]=qs[_0x603a('0x20')](_0x3b5044['query']['limit']);_0x463594['offset']=qs[_0x603a('0x1e')](_0x3b5044[_0x603a('0x34')][_0x603a('0x1e')]);}return _0x6427dc[_0x603a('0x52')](_0x463594);}})['then'](function(_0x50b65f){if(_0x50b65f){return _0x50b65f?{'count':_0x27b666,'rows':_0x50b65f}:null;}})['then'](respondWithResult(_0x16ec64,null))[_0x603a('0x4a')](handleError(_0x16ec64,null));};exports[_0x603a('0x53')]=function(_0x2402c0,_0xa1803,_0x477dab){var _0x32662c={};var _0x2c4559={};var _0x2a110f;var _0x35f0b4;return db['ServicenowConfiguration'][_0x603a('0x4d')]({'where':{'id':_0x2402c0[_0x603a('0x47')]['id']}})['then'](handleEntityNotFound(_0xa1803,null))[_0x603a('0x27')](function(_0x4d3500){if(_0x4d3500){_0x2a110f=_0x4d3500;_0x2c4559['model']=_['keys'](db[_0x603a('0x51')][_0x603a('0x2e')]);_0x2c4559[_0x603a('0x34')]=_[_0x603a('0x33')](_0x2402c0[_0x603a('0x34')]);_0x2c4559[_0x603a('0x35')]=_[_0x603a('0x36')](_0x2c4559[_0x603a('0x37')],_0x2c4559[_0x603a('0x34')]);_0x32662c['attributes']=_['intersection'](_0x2c4559[_0x603a('0x37')],qs['fields'](_0x2402c0[_0x603a('0x34')]['fields']));_0x32662c[_0x603a('0x38')]=_0x32662c[_0x603a('0x38')][_0x603a('0x48')]?_0x32662c[_0x603a('0x38')]:_0x2c4559[_0x603a('0x37')];_0x32662c['order']=qs[_0x603a('0x3c')](_0x2402c0[_0x603a('0x34')][_0x603a('0x3c')]);_0x32662c[_0x603a('0x3f')]=qs[_0x603a('0x35')](_['pick'](_0x2402c0[_0x603a('0x34')],_0x2c4559[_0x603a('0x35')]));if(_0x2402c0[_0x603a('0x34')][_0x603a('0x3e')]){_0x32662c[_0x603a('0x3f')]=_[_0x603a('0x41')](_0x32662c[_0x603a('0x3f')],{'$or':_['map'](_0x32662c['attributes'],function(_0x548321){var _0x795c8={};_0x795c8[_0x548321]={'$like':'%'+_0x2402c0[_0x603a('0x34')][_0x603a('0x3e')]+'%'};return _0x795c8;})});}_0x32662c=_[_0x603a('0x41')]({},_0x32662c,_0x2402c0[_0x603a('0x4e')]);return _0x2a110f[_0x603a('0x53')](_0x32662c);}})[_0x603a('0x27')](function(_0x5e3d16){if(_0x5e3d16){_0x35f0b4=_0x5e3d16[_0x603a('0x48')];if(!_0x2402c0[_0x603a('0x34')][_0x603a('0x50')]('nolimit')){_0x32662c[_0x603a('0x20')]=qs['limit'](_0x2402c0[_0x603a('0x34')][_0x603a('0x20')]);_0x32662c[_0x603a('0x1e')]=qs[_0x603a('0x1e')](_0x2402c0[_0x603a('0x34')][_0x603a('0x1e')]);}return _0x2a110f[_0x603a('0x53')](_0x32662c);}})[_0x603a('0x27')](function(_0x5312f7){if(_0x5312f7){return _0x5312f7?{'count':_0x35f0b4,'rows':_0x5312f7}:null;}})['then'](respondWithResult(_0xa1803,null))[_0x603a('0x4a')](handleError(_0xa1803,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 41031de..ebec844 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 _0x02f7=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ServicenowConfiguration','int_servicenow_configurations','lodash'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x02f7,0x1d3));var _0x702f=function(_0x2faeae,_0x2f7aa4){_0x2faeae=_0x2faeae-0x0;var _0xf0b909=_0x02f7[_0x2faeae];return _0xf0b909;};'use strict';var _=require(_0x702f('0x0'));var util=require(_0x702f('0x1'));var logger=require(_0x702f('0x2'))('api');var moment=require(_0x702f('0x3'));var BPromise=require(_0x702f('0x4'));var rp=require(_0x702f('0x5'));var fs=require('fs');var path=require(_0x702f('0x6'));var rimraf=require(_0x702f('0x7'));var config=require(_0x702f('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module['exports']=function(_0x449ba1,_0x4ff1d2){return _0x449ba1[_0x702f('0x9')](_0x702f('0xa'),attributes,{'tableName':_0x702f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbbdd=['int_servicenow_configurations','util','api','moment','rimraf','exports','define'];(function(_0xeae633,_0x3cae41){var _0x4851c4=function(_0x34820f){while(--_0x34820f){_0xeae633['push'](_0xeae633['shift']());}};_0x4851c4(++_0x3cae41);}(_0xbbdd,0x1ba));var _0xdbbd=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0xbbdd[_0x403c20];return _0x2b271a;};'use strict';var _=require('lodash');var util=require(_0xdbbd('0x0'));var logger=require('../../config/logger')(_0xdbbd('0x1'));var moment=require(_0xdbbd('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdbbd('0x3'));var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xdbbd('0x4')]=function(_0x103977,_0x3e81aa){return _0x103977[_0xdbbd('0x5')]('ServicenowConfiguration',attributes,{'tableName':_0xdbbd('0x6'),'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 13d7115..20f9de5 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 _0x29e8=['rpc','../../config/environment','http','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x13ff98,_0x40a5d8){var _0x595e08=function(_0x53569f){while(--_0x53569f){_0x13ff98['push'](_0x13ff98['shift']());}};_0x595e08(++_0x40a5d8);}(_0x29e8,0x116));var _0x829e=function(_0x270db7,_0x8ddb01){_0x270db7=_0x270db7-0x0;var _0x59e0d7=_0x29e8[_0x270db7];return _0x59e0d7;};'use strict';var _=require(_0x829e('0x0'));var util=require(_0x829e('0x1'));var moment=require(_0x829e('0x2'));var BPromise=require(_0x829e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x829e('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x829e('0x5'));var logger=require(_0x829e('0x6'))(_0x829e('0x7'));var config=require(_0x829e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x829e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x509ddb,_0x4a2a28,_0x2764f7){return new BPromise(function(_0x4b565a,_0x348843){return client['request'](_0x509ddb,_0x2764f7)['then'](function(_0x23a71c){logger[_0x829e('0xa')](_0x829e('0xb'),_0x4a2a28,_0x829e('0xc'));logger[_0x829e('0xd')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4a2a28,_0x829e('0xc'),JSON[_0x829e('0xe')](_0x23a71c));if(_0x23a71c[_0x829e('0xf')]){if(_0x23a71c[_0x829e('0xf')]['code']===0x1f4){logger[_0x829e('0xf')](_0x829e('0xb'),_0x4a2a28,_0x23a71c[_0x829e('0xf')]['message']);return _0x348843(_0x23a71c[_0x829e('0xf')][_0x829e('0x10')]);}logger[_0x829e('0xf')](_0x829e('0xb'),_0x4a2a28,_0x23a71c[_0x829e('0xf')][_0x829e('0x10')]);return _0x4b565a(_0x23a71c['error'][_0x829e('0x10')]);}else{logger[_0x829e('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4a2a28,'request\x20sent');_0x4b565a(_0x23a71c[_0x829e('0x11')][_0x829e('0x10')]);}})[_0x829e('0x12')](function(_0x525850){logger['error'](_0x829e('0xb'),_0x4a2a28,_0x525850);_0x348843(_0x525850);});});} \ No newline at end of file +var _0xa99c=['ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x4362fc,_0xe53876){var _0x3f2df5=function(_0x1d80cc){while(--_0x1d80cc){_0x4362fc['push'](_0x4362fc['shift']());}};_0x3f2df5(++_0xe53876);}(_0xa99c,0x15a));var _0xca99=function(_0x598419,_0x521a50){_0x598419=_0x598419-0x0;var _0x19c03c=_0xa99c[_0x598419];return _0x19c03c;};'use strict';var _=require(_0xca99('0x0'));var util=require(_0xca99('0x1'));var moment=require('moment');var BPromise=require(_0xca99('0x2'));var rs=require(_0xca99('0x3'));var fs=require('fs');var Redis=require(_0xca99('0x4'));var db=require(_0xca99('0x5'))['db'];var utils=require(_0xca99('0x6'));var logger=require('../../config/logger')(_0xca99('0x7'));var config=require(_0xca99('0x8'));var jayson=require(_0xca99('0x9'));var client=jayson['client'][_0xca99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x878af0,_0x33b578,_0xfc87e1){return new BPromise(function(_0x3d79d8,_0x9208ea){return client['request'](_0x878af0,_0xfc87e1)[_0xca99('0xb')](function(_0x4c045d){logger[_0xca99('0xc')](_0xca99('0xd'),_0x33b578,'request\x20sent');logger['debug'](_0xca99('0xe'),_0x33b578,'request\x20sent',JSON['stringify'](_0x4c045d));if(_0x4c045d[_0xca99('0xf')]){if(_0x4c045d[_0xca99('0xf')][_0xca99('0x10')]===0x1f4){logger[_0xca99('0xf')](_0xca99('0xd'),_0x33b578,_0x4c045d[_0xca99('0xf')][_0xca99('0x11')]);return _0x9208ea(_0x4c045d[_0xca99('0xf')][_0xca99('0x11')]);}logger[_0xca99('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33b578,_0x4c045d[_0xca99('0xf')]['message']);return _0x3d79d8(_0x4c045d[_0xca99('0xf')][_0xca99('0x11')]);}else{logger[_0xca99('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x33b578,_0xca99('0x12'));_0x3d79d8(_0x4c045d['result'][_0xca99('0x11')]);}})[_0xca99('0x13')](function(_0x35b718){logger['error'](_0xca99('0xd'),_0x33b578,_0x35b718);_0x9208ea(_0x35b718);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 4c0a403..7b38c7d 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 _0xdd9c=['destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','post','create','delete'];(function(_0x1f8116,_0xcacfa3){var _0xe4d430=function(_0x4fe182){while(--_0x4fe182){_0x1f8116['push'](_0x1f8116['shift']());}};_0xe4d430(++_0xcacfa3);}(_0xdd9c,0xbc));var _0xcdd9=function(_0x5b4108,_0x29f3c3){_0x5b4108=_0x5b4108-0x0;var _0x11d6f6=_0xdd9c[_0x5b4108];return _0x11d6f6;};'use strict';var multer=require(_0xcdd9('0x0'));var util=require(_0xcdd9('0x1'));var path=require(_0xcdd9('0x2'));var timeout=require(_0xcdd9('0x3'));var express=require(_0xcdd9('0x4'));var router=express[_0xcdd9('0x5')]();var fs_extra=require(_0xcdd9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xcdd9('0x7'));var config=require(_0xcdd9('0x8'));var controller=require('./intServicenowField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xcdd9('0x9')]);router[_0xcdd9('0xa')](_0xcdd9('0xb'),auth[_0xcdd9('0xc')](),controller['show']);router[_0xcdd9('0xd')]('/',auth[_0xcdd9('0xc')](),controller[_0xcdd9('0xe')]);router['put'](_0xcdd9('0xb'),auth['isAuthenticated'](),controller['update']);router[_0xcdd9('0xf')](_0xcdd9('0xb'),auth[_0xcdd9('0xc')](),controller[_0xcdd9('0x10')]);module['exports']=router; \ No newline at end of file +var _0xe5c4=['isAuthenticated','show','post','/:id','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get'];(function(_0x88fe67,_0x3f5cac){var _0x4cb5fa=function(_0x4f9c04){while(--_0x4f9c04){_0x88fe67['push'](_0x88fe67['shift']());}};_0x4cb5fa(++_0x3f5cac);}(_0xe5c4,0x150));var _0x4e5c=function(_0x17cef2,_0x293108){_0x17cef2=_0x17cef2-0x0;var _0x8dd071=_0xe5c4[_0x17cef2];return _0x8dd071;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4e5c('0x0'));var timeout=require(_0x4e5c('0x1'));var express=require(_0x4e5c('0x2'));var router=express[_0x4e5c('0x3')]();var fs_extra=require(_0x4e5c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4e5c('0x5'));var config=require(_0x4e5c('0x6'));var controller=require(_0x4e5c('0x7'));router[_0x4e5c('0x8')]('/',auth[_0x4e5c('0x9')](),controller['index']);router[_0x4e5c('0x8')]('/:id',auth[_0x4e5c('0x9')](),controller[_0x4e5c('0xa')]);router[_0x4e5c('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x4e5c('0xc'),auth[_0x4e5c('0x9')](),controller[_0x4e5c('0xd')]);router['delete']('/:id',auth[_0x4e5c('0x9')](),controller['destroy']);module[_0x4e5c('0xe')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 747bdd9..4599217 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 _0x8800=['ENUM','string','variable','keyValue','picklist','customVariable','STRING','BOOLEAN','sequelize','exports'];(function(_0x34e24e,_0x1cea00){var _0x38bd75=function(_0x359beb){while(--_0x359beb){_0x34e24e['push'](_0x34e24e['shift']());}};_0x38bd75(++_0x1cea00);}(_0x8800,0x13e));var _0x0880=function(_0x1f4ac6,_0xeb1599){_0x1f4ac6=_0x1f4ac6-0x0;var _0x29cf8a=_0x8800[_0x1f4ac6];return _0x29cf8a;};'use strict';var Sequelize=require(_0x0880('0x0'));module[_0x0880('0x1')]={'type':{'type':Sequelize[_0x0880('0x2')](_0x0880('0x3'),_0x0880('0x4'),'customVariable',_0x0880('0x5'),_0x0880('0x6')),'defaultValue':_0x0880('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0880('0x2')](_0x0880('0x3'),_0x0880('0x4'),_0x0880('0x7'))},'keyContent':{'type':Sequelize[_0x0880('0x8')]},'idField':{'type':Sequelize[_0x0880('0x8')]},'nameField':{'type':Sequelize[_0x0880('0x8')]},'customField':{'type':Sequelize[_0x0880('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0880('0x8')]}}; \ No newline at end of file +var _0x1d1e=['keyValue','picklist','STRING','ENUM','customVariable','BOOLEAN','sequelize','string','variable'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1d1e,0x8d));var _0xe1d1=function(_0x5b6ffe,_0x280e9a){_0x5b6ffe=_0x5b6ffe-0x0;var _0x5f2d56=_0x1d1e[_0x5b6ffe];return _0x5f2d56;};'use strict';var Sequelize=require(_0xe1d1('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xe1d1('0x1'),_0xe1d1('0x2'),'customVariable',_0xe1d1('0x3'),_0xe1d1('0x4')),'defaultValue':_0xe1d1('0x1')},'content':{'type':Sequelize[_0xe1d1('0x5')]},'key':{'type':Sequelize[_0xe1d1('0x5')]},'keyType':{'type':Sequelize[_0xe1d1('0x6')]('string','variable',_0xe1d1('0x7'))},'keyContent':{'type':Sequelize[_0xe1d1('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xe1d1('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 6b24c10..ae462b5 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 _0xa763=['filters','pick','filter','where','VIRTUAL','options','include','findAll','catch','show','keys','includeAll','merge','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../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','count','limit','set','Content-Range','apply','save','then','destroy','error','name','send','index','map','ServicenowField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0xa763,0x17d));var _0x3a76=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0xa763[_0x377a6e];return _0x37f751;};'use strict';var emlformat=require(_0x3a76('0x0'));var rimraf=require(_0x3a76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3a76('0x2'));var rp=require(_0x3a76('0x3'));var moment=require(_0x3a76('0x4'));var BPromise=require(_0x3a76('0x5'));var Mustache=require(_0x3a76('0x6'));var util=require(_0x3a76('0x7'));var path=require('path');var sox=require(_0x3a76('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3a76('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3a76('0xa'));var jsforce=require(_0x3a76('0xb'));var deskjs=require(_0x3a76('0xc'));var toCsv=require(_0x3a76('0xd'));var querystring=require(_0x3a76('0xe'));var Papa=require(_0x3a76('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3a76('0x10'));var as=require(_0x3a76('0x11'));var hardwareService=require(_0x3a76('0x12'));var logger=require(_0x3a76('0x13'))(_0x3a76('0x14'));var utils=require(_0x3a76('0x15'));var config=require(_0x3a76('0x16'));var licenseUtil=require(_0x3a76('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdf9cd0,_0x468bb1){_0x468bb1=_0x468bb1||0xcc;return function(_0x3407f8){if(_0x3407f8){return _0xdf9cd0[_0x3a76('0x18')](_0x468bb1);}return _0xdf9cd0['status'](_0x468bb1)[_0x3a76('0x19')]();};}function respondWithResult(_0x2929e3,_0x1a2591){_0x1a2591=_0x1a2591||0xc8;return function(_0x567fc0){if(_0x567fc0){return _0x2929e3[_0x3a76('0x1a')](_0x1a2591)[_0x3a76('0x1b')](_0x567fc0);}};}function respondWithFilteredResult(_0x11dbfb,_0x32c8ba){return function(_0x351a9a){if(_0x351a9a){var _0x549f16=typeof _0x32c8ba[_0x3a76('0x1c')]===_0x3a76('0x1d')&&typeof _0x32c8ba['limit']===_0x3a76('0x1d');var _0x4b6653=_0x351a9a[_0x3a76('0x1e')];var _0x1b6501=_0x549f16?0x0:_0x32c8ba[_0x3a76('0x1c')];var _0x415371=_0x549f16?_0x351a9a[_0x3a76('0x1e')]:_0x32c8ba['offset']+_0x32c8ba[_0x3a76('0x1f')];var _0x2a9825;if(_0x415371>=_0x4b6653){_0x415371=_0x4b6653;_0x2a9825=0xc8;}else{_0x2a9825=0xce;}_0x11dbfb[_0x3a76('0x1a')](_0x2a9825);return _0x11dbfb[_0x3a76('0x20')](_0x3a76('0x21'),_0x1b6501+'-'+_0x415371+'/'+_0x4b6653)[_0x3a76('0x1b')](_0x351a9a);}return null;};}function patchUpdates(_0x294ed4){return function(_0x34ba3f){try{jsonpatch[_0x3a76('0x22')](_0x34ba3f,_0x294ed4,!![]);}catch(_0x25a5cc){return BPromise['reject'](_0x25a5cc);}return _0x34ba3f[_0x3a76('0x23')]();};}function saveUpdates(_0x2bb861,_0xc748bd){return function(_0x5ca849){if(_0x5ca849){return _0x5ca849['update'](_0x2bb861)[_0x3a76('0x24')](function(_0x3234b9){return _0x3234b9;});}return null;};}function removeEntity(_0x53bbbd,_0x4d8838){return function(_0x1ca014){if(_0x1ca014){return _0x1ca014[_0x3a76('0x25')]()[_0x3a76('0x24')](function(){_0x53bbbd[_0x3a76('0x1a')](0xcc)[_0x3a76('0x19')]();});}};}function handleEntityNotFound(_0x1c9ea4,_0x27692e){return function(_0x3041fd){if(!_0x3041fd){_0x1c9ea4[_0x3a76('0x18')](0x194);}return _0x3041fd;};}function handleError(_0x1d95cf,_0x75bc6c){_0x75bc6c=_0x75bc6c||0x1f4;return function(_0x2e3dd5){logger[_0x3a76('0x26')](_0x2e3dd5['stack']);if(_0x2e3dd5['name']){delete _0x2e3dd5[_0x3a76('0x27')];}_0x1d95cf['status'](_0x75bc6c)[_0x3a76('0x28')](_0x2e3dd5);};}exports[_0x3a76('0x29')]=function(_0x2874c7,_0x509e56){var _0x53de86={},_0x4d8858={},_0x4be787={'count':0x0,'rows':[]};var _0x1f8726=_[_0x3a76('0x2a')](db[_0x3a76('0x2b')][_0x3a76('0x2c')],function(_0x2491e7){return{'name':_0x2491e7[_0x3a76('0x2d')],'type':_0x2491e7[_0x3a76('0x2e')][_0x3a76('0x2f')]};});_0x4d8858[_0x3a76('0x30')]=_[_0x3a76('0x2a')](_0x1f8726,'name');_0x4d8858[_0x3a76('0x31')]=_['keys'](_0x2874c7[_0x3a76('0x31')]);_0x4d8858['filters']=_[_0x3a76('0x32')](_0x4d8858[_0x3a76('0x30')],_0x4d8858[_0x3a76('0x31')]);_0x53de86[_0x3a76('0x33')]=_[_0x3a76('0x32')](_0x4d8858[_0x3a76('0x30')],qs[_0x3a76('0x34')](_0x2874c7[_0x3a76('0x31')]['fields']));_0x53de86['attributes']=_0x53de86[_0x3a76('0x33')][_0x3a76('0x35')]?_0x53de86[_0x3a76('0x33')]:_0x4d8858[_0x3a76('0x30')];if(!_0x2874c7[_0x3a76('0x31')][_0x3a76('0x36')](_0x3a76('0x37'))){_0x53de86[_0x3a76('0x1f')]=qs[_0x3a76('0x1f')](_0x2874c7['query'][_0x3a76('0x1f')]);_0x53de86[_0x3a76('0x1c')]=qs[_0x3a76('0x1c')](_0x2874c7[_0x3a76('0x31')]['offset']);}_0x53de86['order']=qs['sort'](_0x2874c7[_0x3a76('0x31')][_0x3a76('0x38')]);_0x53de86['where']=qs[_0x3a76('0x39')](_[_0x3a76('0x3a')](_0x2874c7[_0x3a76('0x31')],_0x4d8858[_0x3a76('0x39')]),_0x1f8726);if(_0x2874c7[_0x3a76('0x31')][_0x3a76('0x3b')]){_0x53de86[_0x3a76('0x3c')]=_['merge'](_0x53de86[_0x3a76('0x3c')],{'$or':_[_0x3a76('0x2a')](_0x1f8726,function(_0x2c1b9a){if(_0x2c1b9a[_0x3a76('0x2e')]!==_0x3a76('0x3d')){var _0x9e077={};_0x9e077[_0x2c1b9a[_0x3a76('0x27')]]={'$like':'%'+_0x2874c7[_0x3a76('0x31')][_0x3a76('0x3b')]+'%'};return _0x9e077;}})});}_0x53de86=_['merge']({},_0x53de86,_0x2874c7[_0x3a76('0x3e')]);var _0x206a00={'where':_0x53de86[_0x3a76('0x3c')]};return db['ServicenowField']['count'](_0x206a00)[_0x3a76('0x24')](function(_0x520627){_0x4be787['count']=_0x520627;if(_0x2874c7[_0x3a76('0x31')]['includeAll']){_0x53de86[_0x3a76('0x3f')]=[{'all':!![]}];}return db[_0x3a76('0x2b')][_0x3a76('0x40')](_0x53de86);})[_0x3a76('0x24')](function(_0x5c4450){_0x4be787['rows']=_0x5c4450;return _0x4be787;})[_0x3a76('0x24')](respondWithFilteredResult(_0x509e56,_0x53de86))[_0x3a76('0x41')](handleError(_0x509e56,null));};exports[_0x3a76('0x42')]=function(_0x328233,_0xc9c56){var _0x21f4b2={'raw':!![],'where':{'id':_0x328233['params']['id']}},_0x3d5f89={};_0x3d5f89[_0x3a76('0x30')]=_['keys'](db[_0x3a76('0x2b')][_0x3a76('0x2c')]);_0x3d5f89[_0x3a76('0x31')]=_[_0x3a76('0x43')](_0x328233['query']);_0x3d5f89[_0x3a76('0x39')]=_[_0x3a76('0x32')](_0x3d5f89[_0x3a76('0x30')],_0x3d5f89[_0x3a76('0x31')]);_0x21f4b2[_0x3a76('0x33')]=_['intersection'](_0x3d5f89[_0x3a76('0x30')],qs[_0x3a76('0x34')](_0x328233[_0x3a76('0x31')][_0x3a76('0x34')]));_0x21f4b2[_0x3a76('0x33')]=_0x21f4b2[_0x3a76('0x33')][_0x3a76('0x35')]?_0x21f4b2['attributes']:_0x3d5f89[_0x3a76('0x30')];if(_0x328233[_0x3a76('0x31')][_0x3a76('0x44')]){_0x21f4b2['include']=[{'all':!![]}];}_0x21f4b2=_[_0x3a76('0x45')]({},_0x21f4b2,_0x328233['options']);return db[_0x3a76('0x2b')][_0x3a76('0x46')](_0x21f4b2)[_0x3a76('0x24')](handleEntityNotFound(_0xc9c56,null))[_0x3a76('0x24')](respondWithResult(_0xc9c56,null))[_0x3a76('0x41')](handleError(_0xc9c56,null));};exports[_0x3a76('0x47')]=function(_0x574ed8,_0x1c7001){return db[_0x3a76('0x2b')][_0x3a76('0x47')](_0x574ed8[_0x3a76('0x48')],{})[_0x3a76('0x24')](respondWithResult(_0x1c7001,0xc9))[_0x3a76('0x41')](handleError(_0x1c7001,null));};exports['update']=function(_0x3a44a9,_0xe814e3){if(_0x3a44a9[_0x3a76('0x48')]['id']){delete _0x3a44a9['body']['id'];}return db[_0x3a76('0x2b')]['find']({'where':{'id':_0x3a44a9['params']['id']}})[_0x3a76('0x24')](handleEntityNotFound(_0xe814e3,null))[_0x3a76('0x24')](saveUpdates(_0x3a44a9[_0x3a76('0x48')],null))[_0x3a76('0x24')](respondWithResult(_0xe814e3,null))['catch'](handleError(_0xe814e3,null));};exports[_0x3a76('0x25')]=function(_0x3473b4,_0x4dd865){return db[_0x3a76('0x2b')]['find']({'where':{'id':_0x3473b4['params']['id']}})['then'](handleEntityNotFound(_0x4dd865,null))[_0x3a76('0x24')](removeEntity(_0x4dd865,null))[_0x3a76('0x41')](handleError(_0x4dd865,null));}; \ No newline at end of file +var _0x7347=['include','findAll','rows','catch','params','find','create','body','eml-format','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','map','options','ServicenowField','includeAll'];(function(_0x14370e,_0x66bd88){var _0x5ef927=function(_0x2e1e9a){while(--_0x2e1e9a){_0x14370e['push'](_0x14370e['shift']());}};_0x5ef927(++_0x66bd88);}(_0x7347,0xe9));var _0x7734=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x7347[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require(_0x7734('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7734('0x1'));var moment=require(_0x7734('0x2'));var BPromise=require(_0x7734('0x3'));var Mustache=require(_0x7734('0x4'));var util=require(_0x7734('0x5'));var path=require(_0x7734('0x6'));var sox=require(_0x7734('0x7'));var csv=require('to-csv');var ejs=require(_0x7734('0x8'));var fs=require('fs');var fs_extra=require(_0x7734('0x9'));var _=require(_0x7734('0xa'));var squel=require(_0x7734('0xb'));var crypto=require(_0x7734('0xc'));var jsforce=require(_0x7734('0xd'));var deskjs=require(_0x7734('0xe'));var toCsv=require(_0x7734('0xf'));var querystring=require(_0x7734('0x10'));var Papa=require(_0x7734('0x11'));var Redis=require('ioredis');var authService=require(_0x7734('0x12'));var qs=require(_0x7734('0x13'));var as=require(_0x7734('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7734('0x15'))(_0x7734('0x16'));var utils=require(_0x7734('0x17'));var config=require(_0x7734('0x18'));var licenseUtil=require(_0x7734('0x19'));var db=require(_0x7734('0x1a'))['db'];function respondWithStatusCode(_0x3754ed,_0x58008c){_0x58008c=_0x58008c||0xcc;return function(_0x987d36){if(_0x987d36){return _0x3754ed[_0x7734('0x1b')](_0x58008c);}return _0x3754ed[_0x7734('0x1c')](_0x58008c)[_0x7734('0x1d')]();};}function respondWithResult(_0x306830,_0x56c4f4){_0x56c4f4=_0x56c4f4||0xc8;return function(_0x2563ce){if(_0x2563ce){return _0x306830[_0x7734('0x1c')](_0x56c4f4)[_0x7734('0x1e')](_0x2563ce);}};}function respondWithFilteredResult(_0x514b1e,_0xd33d3d){return function(_0x39e7cd){if(_0x39e7cd){var _0x300177=typeof _0xd33d3d[_0x7734('0x1f')]===_0x7734('0x20')&&typeof _0xd33d3d['limit']===_0x7734('0x20');var _0x5c721d=_0x39e7cd[_0x7734('0x21')];var _0x5188e5=_0x300177?0x0:_0xd33d3d[_0x7734('0x1f')];var _0x2e00a7=_0x300177?_0x39e7cd['count']:_0xd33d3d[_0x7734('0x1f')]+_0xd33d3d[_0x7734('0x22')];var _0x41cf79;if(_0x2e00a7>=_0x5c721d){_0x2e00a7=_0x5c721d;_0x41cf79=0xc8;}else{_0x41cf79=0xce;}_0x514b1e[_0x7734('0x1c')](_0x41cf79);return _0x514b1e[_0x7734('0x23')](_0x7734('0x24'),_0x5188e5+'-'+_0x2e00a7+'/'+_0x5c721d)[_0x7734('0x1e')](_0x39e7cd);}return null;};}function patchUpdates(_0xa50ac2){return function(_0x5fd510){try{jsonpatch[_0x7734('0x25')](_0x5fd510,_0xa50ac2,!![]);}catch(_0x27f906){return BPromise[_0x7734('0x26')](_0x27f906);}return _0x5fd510['save']();};}function saveUpdates(_0x3fb4f1,_0x16d123){return function(_0x27c8b7){if(_0x27c8b7){return _0x27c8b7[_0x7734('0x27')](_0x3fb4f1)[_0x7734('0x28')](function(_0x54b138){return _0x54b138;});}return null;};}function removeEntity(_0x702c56,_0x4440dd){return function(_0x2c8436){if(_0x2c8436){return _0x2c8436[_0x7734('0x29')]()['then'](function(){_0x702c56['status'](0xcc)[_0x7734('0x1d')]();});}};}function handleEntityNotFound(_0x12bafe,_0x3acac3){return function(_0x85ede3){if(!_0x85ede3){_0x12bafe[_0x7734('0x1b')](0x194);}return _0x85ede3;};}function handleError(_0x507374,_0x480308){_0x480308=_0x480308||0x1f4;return function(_0x597682){logger[_0x7734('0x2a')](_0x597682[_0x7734('0x2b')]);if(_0x597682['name']){delete _0x597682[_0x7734('0x2c')];}_0x507374[_0x7734('0x1c')](_0x480308)[_0x7734('0x2d')](_0x597682);};}exports[_0x7734('0x2e')]=function(_0x472652,_0x258914){var _0x2bc467={},_0x1b5236={},_0x1c1ced={'count':0x0,'rows':[]};var _0x3de82a=_['map'](db['ServicenowField'][_0x7734('0x2f')],function(_0x24e892){return{'name':_0x24e892['fieldName'],'type':_0x24e892[_0x7734('0x30')]['key']};});_0x1b5236[_0x7734('0x31')]=_['map'](_0x3de82a,'name');_0x1b5236['query']=_[_0x7734('0x32')](_0x472652[_0x7734('0x33')]);_0x1b5236[_0x7734('0x34')]=_[_0x7734('0x35')](_0x1b5236[_0x7734('0x31')],_0x1b5236[_0x7734('0x33')]);_0x2bc467[_0x7734('0x36')]=_[_0x7734('0x35')](_0x1b5236[_0x7734('0x31')],qs[_0x7734('0x37')](_0x472652[_0x7734('0x33')][_0x7734('0x37')]));_0x2bc467[_0x7734('0x36')]=_0x2bc467['attributes'][_0x7734('0x38')]?_0x2bc467[_0x7734('0x36')]:_0x1b5236[_0x7734('0x31')];if(!_0x472652[_0x7734('0x33')]['hasOwnProperty'](_0x7734('0x39'))){_0x2bc467[_0x7734('0x22')]=qs[_0x7734('0x22')](_0x472652[_0x7734('0x33')][_0x7734('0x22')]);_0x2bc467[_0x7734('0x1f')]=qs[_0x7734('0x1f')](_0x472652[_0x7734('0x33')]['offset']);}_0x2bc467['order']=qs[_0x7734('0x3a')](_0x472652['query']['sort']);_0x2bc467[_0x7734('0x3b')]=qs[_0x7734('0x34')](_[_0x7734('0x3c')](_0x472652[_0x7734('0x33')],_0x1b5236[_0x7734('0x34')]),_0x3de82a);if(_0x472652[_0x7734('0x33')][_0x7734('0x3d')]){_0x2bc467[_0x7734('0x3b')]=_[_0x7734('0x3e')](_0x2bc467[_0x7734('0x3b')],{'$or':_[_0x7734('0x3f')](_0x3de82a,function(_0xc46e33){if(_0xc46e33[_0x7734('0x30')]!=='VIRTUAL'){var _0x116377={};_0x116377[_0xc46e33[_0x7734('0x2c')]]={'$like':'%'+_0x472652['query'][_0x7734('0x3d')]+'%'};return _0x116377;}})});}_0x2bc467=_['merge']({},_0x2bc467,_0x472652[_0x7734('0x40')]);var _0x57c5b9={'where':_0x2bc467[_0x7734('0x3b')]};return db[_0x7734('0x41')][_0x7734('0x21')](_0x57c5b9)['then'](function(_0xf1de62){_0x1c1ced[_0x7734('0x21')]=_0xf1de62;if(_0x472652[_0x7734('0x33')][_0x7734('0x42')]){_0x2bc467[_0x7734('0x43')]=[{'all':!![]}];}return db[_0x7734('0x41')][_0x7734('0x44')](_0x2bc467);})['then'](function(_0x51ed46){_0x1c1ced[_0x7734('0x45')]=_0x51ed46;return _0x1c1ced;})[_0x7734('0x28')](respondWithFilteredResult(_0x258914,_0x2bc467))[_0x7734('0x46')](handleError(_0x258914,null));};exports['show']=function(_0x1bc0f0,_0x281b56){var _0xd6995f={'raw':!![],'where':{'id':_0x1bc0f0[_0x7734('0x47')]['id']}},_0x420049={};_0x420049[_0x7734('0x31')]=_[_0x7734('0x32')](db[_0x7734('0x41')][_0x7734('0x2f')]);_0x420049[_0x7734('0x33')]=_[_0x7734('0x32')](_0x1bc0f0[_0x7734('0x33')]);_0x420049[_0x7734('0x34')]=_[_0x7734('0x35')](_0x420049[_0x7734('0x31')],_0x420049[_0x7734('0x33')]);_0xd6995f[_0x7734('0x36')]=_[_0x7734('0x35')](_0x420049[_0x7734('0x31')],qs[_0x7734('0x37')](_0x1bc0f0['query'][_0x7734('0x37')]));_0xd6995f[_0x7734('0x36')]=_0xd6995f[_0x7734('0x36')][_0x7734('0x38')]?_0xd6995f[_0x7734('0x36')]:_0x420049['model'];if(_0x1bc0f0['query'][_0x7734('0x42')]){_0xd6995f[_0x7734('0x43')]=[{'all':!![]}];}_0xd6995f=_[_0x7734('0x3e')]({},_0xd6995f,_0x1bc0f0[_0x7734('0x40')]);return db[_0x7734('0x41')][_0x7734('0x48')](_0xd6995f)[_0x7734('0x28')](handleEntityNotFound(_0x281b56,null))[_0x7734('0x28')](respondWithResult(_0x281b56,null))[_0x7734('0x46')](handleError(_0x281b56,null));};exports[_0x7734('0x49')]=function(_0x1eaec9,_0x426142){return db[_0x7734('0x41')][_0x7734('0x49')](_0x1eaec9[_0x7734('0x4a')],{})[_0x7734('0x28')](respondWithResult(_0x426142,0xc9))[_0x7734('0x46')](handleError(_0x426142,null));};exports[_0x7734('0x27')]=function(_0x510b27,_0x6d8846){if(_0x510b27[_0x7734('0x4a')]['id']){delete _0x510b27[_0x7734('0x4a')]['id'];}return db['ServicenowField'][_0x7734('0x48')]({'where':{'id':_0x510b27[_0x7734('0x47')]['id']}})[_0x7734('0x28')](handleEntityNotFound(_0x6d8846,null))[_0x7734('0x28')](saveUpdates(_0x510b27[_0x7734('0x4a')],null))[_0x7734('0x28')](respondWithResult(_0x6d8846,null))['catch'](handleError(_0x6d8846,null));};exports[_0x7734('0x29')]=function(_0x177778,_0x39a640){return db[_0x7734('0x41')]['find']({'where':{'id':_0x177778[_0x7734('0x47')]['id']}})['then'](handleEntityNotFound(_0x39a640,null))[_0x7734('0x28')](removeEntity(_0x39a640,null))['catch'](handleError(_0x39a640,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 923718e..d7dba47 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 _0xb74f=['../../config/environment','define','ServicenowField','int_servicenow_fields','FieldId','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x1c1bc3,_0x17c354){var _0x1983d6=function(_0x107863){while(--_0x107863){_0x1c1bc3['push'](_0x1c1bc3['shift']());}};_0x1983d6(++_0x17c354);}(_0xb74f,0x14f));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfb74('0x0'))(_0xfb74('0x1'));var moment=require(_0xfb74('0x2'));var BPromise=require(_0xfb74('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb74('0x4'));var rimraf=require(_0xfb74('0x5'));var config=require(_0xfb74('0x6'));var attributes=require('./intServicenowField.attributes');module['exports']=function(_0x2d8623,_0x7252d3){return _0x2d8623[_0xfb74('0x7')](_0xfb74('0x8'),attributes,{'tableName':_0xfb74('0x9'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':['idField',_0xfb74('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2d1c=['rimraf','./intServicenowField.attributes','ServicenowField','idField','lodash','../../config/logger','api','request-promise','path'];(function(_0x79b250,_0xd43294){var _0x40b58f=function(_0x4f146e){while(--_0x4f146e){_0x79b250['push'](_0x79b250['shift']());}};_0x40b58f(++_0xd43294);}(_0x2d1c,0x17e));var _0xc2d1=function(_0x44179c,_0x1f4a8c){_0x44179c=_0x44179c-0x0;var _0x4fe2fe=_0x2d1c[_0x44179c];return _0x4fe2fe;};'use strict';var _=require(_0xc2d1('0x0'));var util=require('util');var logger=require(_0xc2d1('0x1'))(_0xc2d1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc2d1('0x3'));var fs=require('fs');var path=require(_0xc2d1('0x4'));var rimraf=require(_0xc2d1('0x5'));var config=require('../../config/environment');var attributes=require(_0xc2d1('0x6'));module['exports']=function(_0x2d5f5a,_0x3c2afb){return _0x2d5f5a['define'](_0xc2d1('0x7'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0xc2d1('0x8'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index c256526..b53347c 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 _0xf4eb=['ServicenowField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x26ee83,_0x587e8d){var _0x3159a3=function(_0x38f13b){while(--_0x38f13b){_0x26ee83['push'](_0x26ee83['shift']());}};_0x3159a3(++_0x587e8d);}(_0xf4eb,0xec));var _0xbf4e=function(_0x1b50dc,_0x13b441){_0x1b50dc=_0x1b50dc-0x0;var _0x1e0561=_0xf4eb[_0x1b50dc];return _0x1e0561;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('ServicenowField,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('ServicenowField,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ 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(_0x57d370,_0x3ed0f6){var _0x550fd2=function(_0x59634f){while(--_0x59634f){_0x57d370['push'](_0x57d370['shift']());}};_0x550fd2(++_0x3ed0f6);}(_0xaa88,0x137));var _0x8aa8=function(_0xdbb6cb,_0x3b8fda){_0xdbb6cb=_0xdbb6cb-0x0;var _0x476b50=_0xaa88[_0xdbb6cb];return _0x476b50;};'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 2eb98c0..2f3c321 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x52bd69,_0x19a336){var _0x16fec7=function(_0x3c7a4e){while(--_0x3c7a4e){_0x52bd69['push'](_0x52bd69['shift']());}};_0x16fec7(++_0x19a336);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x499860,_0x11c55f){var _0x29370a=function(_0x36392e){while(--_0x36392e){_0x499860['push'](_0x499860['shift']());}};_0x29370a(++_0x11c55f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index db16113..96f4681 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(_0x5baa49,_0x3c9233){var _0x394735=function(_0x400988){while(--_0x400988){_0x5baa49['push'](_0x5baa49['shift']());}};_0x394735(++_0x3c9233);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x867f29,_0x5d4a74){var _0x577d91=function(_0x20d387){while(--_0x20d387){_0x867f29['push'](_0x867f29['shift']());}};_0x577d91(++_0x5d4a74);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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 213ed43..25050a2 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 _0xada9=['papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','options','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','description','date_start','duration_hours','duration_minutes','parent_id','parent_name','direction','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','values','module_fields','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','querystring'];(function(_0x1b864a,_0x5ee497){var _0x3e8b04=function(_0x28be8e){while(--_0x28be8e){_0x1b864a['push'](_0x1b864a['shift']());}};_0x3e8b04(++_0x5ee497);}(_0xada9,0x70));var _0x9ada=function(_0x5dfeb6,_0xf17364){_0x5dfeb6=_0x5dfeb6-0x0;var _0x1c9371=_0xada9[_0x5dfeb6];return _0x1c9371;};'use strict';var emlformat=require(_0x9ada('0x0'));var rimraf=require(_0x9ada('0x1'));var zipdir=require(_0x9ada('0x2'));var jsonpatch=require(_0x9ada('0x3'));var rp=require(_0x9ada('0x4'));var moment=require(_0x9ada('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9ada('0x6'));var sox=require(_0x9ada('0x7'));var csv=require('to-csv');var ejs=require(_0x9ada('0x8'));var fs=require('fs');var fs_extra=require(_0x9ada('0x9'));var _=require(_0x9ada('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9ada('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9ada('0xc'));var querystring=require(_0x9ada('0xd'));var Papa=require(_0x9ada('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9ada('0xf'));var hardwareService=require(_0x9ada('0x10'));var logger=require(_0x9ada('0x11'))(_0x9ada('0x12'));var utils=require(_0x9ada('0x13'));var config=require(_0x9ada('0x14'));var licenseUtil=require(_0x9ada('0x15'));var db=require(_0x9ada('0x16'))['db'];var integrations=require(_0x9ada('0x17'));function respondWithStatusCode(_0x3d1b13,_0x54d36c){_0x54d36c=_0x54d36c||0xcc;return function(_0x7314c2){if(_0x7314c2){return _0x3d1b13[_0x9ada('0x18')](_0x54d36c);}return _0x3d1b13[_0x9ada('0x19')](_0x54d36c)[_0x9ada('0x1a')]();};}function respondWithResult(_0x2378a5,_0x17f075){_0x17f075=_0x17f075||0xc8;return function(_0x3b192f){if(_0x3b192f){return _0x2378a5['status'](_0x17f075)[_0x9ada('0x1b')](_0x3b192f);}};}function respondWithFilteredResult(_0x4b44fd,_0x3909f6){return function(_0x23fef7){if(_0x23fef7){var _0x587fbb=typeof _0x3909f6[_0x9ada('0x1c')]===_0x9ada('0x1d')&&typeof _0x3909f6[_0x9ada('0x1e')]===_0x9ada('0x1d');var _0x58a9f5=_0x23fef7[_0x9ada('0x1f')];var _0x2ad4af=_0x587fbb?0x0:_0x3909f6[_0x9ada('0x1c')];var _0x1a2d0d=_0x587fbb?_0x23fef7[_0x9ada('0x1f')]:_0x3909f6[_0x9ada('0x1c')]+_0x3909f6[_0x9ada('0x1e')];var _0x3d85cd;if(_0x1a2d0d>=_0x58a9f5){_0x1a2d0d=_0x58a9f5;_0x3d85cd=0xc8;}else{_0x3d85cd=0xce;}_0x4b44fd[_0x9ada('0x19')](_0x3d85cd);return _0x4b44fd[_0x9ada('0x20')](_0x9ada('0x21'),_0x2ad4af+'-'+_0x1a2d0d+'/'+_0x58a9f5)[_0x9ada('0x1b')](_0x23fef7);}return null;};}function patchUpdates(_0x58cc0c){return function(_0x3b4a35){try{jsonpatch[_0x9ada('0x22')](_0x3b4a35,_0x58cc0c,!![]);}catch(_0x29f21e){return BPromise[_0x9ada('0x23')](_0x29f21e);}return _0x3b4a35[_0x9ada('0x24')]();};}function saveUpdates(_0x5c28a6,_0x2dae46){return function(_0x420297){if(_0x420297){return _0x420297[_0x9ada('0x25')](_0x5c28a6)['then'](function(_0xce512f){return _0xce512f;});}return null;};}function removeEntity(_0x10f82e,_0x11cc28){return function(_0x41eb43){if(_0x41eb43){return _0x41eb43[_0x9ada('0x26')]()['then'](function(){_0x10f82e['status'](0xcc)[_0x9ada('0x1a')]();});}};}function handleEntityNotFound(_0x5a78dc,_0x39b499){return function(_0x426a54){if(!_0x426a54){_0x5a78dc['sendStatus'](0x194);}return _0x426a54;};}function handleError(_0x5722ff,_0x4303b2){_0x4303b2=_0x4303b2||0x1f4;return function(_0x3f79fd){logger[_0x9ada('0x27')](_0x3f79fd[_0x9ada('0x28')]);if(_0x3f79fd[_0x9ada('0x29')]){delete _0x3f79fd[_0x9ada('0x29')];}_0x5722ff[_0x9ada('0x19')](_0x4303b2)[_0x9ada('0x2a')](_0x3f79fd);};}exports[_0x9ada('0x2b')]=function(_0x42b817,_0xa6e4b1){var _0xecfa53={},_0x1fdf00={},_0x50f12a={'count':0x0,'rows':[]};var _0x395c75=_[_0x9ada('0x2c')](db[_0x9ada('0x2d')][_0x9ada('0x2e')],function(_0x52f8af){return{'name':_0x52f8af[_0x9ada('0x2f')],'type':_0x52f8af[_0x9ada('0x30')][_0x9ada('0x31')]};});_0x1fdf00[_0x9ada('0x32')]=_[_0x9ada('0x2c')](_0x395c75,'name');_0x1fdf00['query']=_[_0x9ada('0x33')](_0x42b817[_0x9ada('0x34')]);_0x1fdf00[_0x9ada('0x35')]=_[_0x9ada('0x36')](_0x1fdf00[_0x9ada('0x32')],_0x1fdf00[_0x9ada('0x34')]);_0xecfa53[_0x9ada('0x37')]=_[_0x9ada('0x36')](_0x1fdf00['model'],qs['fields'](_0x42b817[_0x9ada('0x34')][_0x9ada('0x38')]));_0xecfa53['attributes']=_0xecfa53[_0x9ada('0x37')][_0x9ada('0x39')]?_0xecfa53[_0x9ada('0x37')]:_0x1fdf00[_0x9ada('0x32')];if(!_0x42b817['query'][_0x9ada('0x3a')](_0x9ada('0x3b'))){_0xecfa53[_0x9ada('0x1e')]=qs[_0x9ada('0x1e')](_0x42b817[_0x9ada('0x34')][_0x9ada('0x1e')]);_0xecfa53['offset']=qs[_0x9ada('0x1c')](_0x42b817[_0x9ada('0x34')]['offset']);}_0xecfa53[_0x9ada('0x3c')]=qs[_0x9ada('0x3d')](_0x42b817[_0x9ada('0x34')]['sort']);_0xecfa53[_0x9ada('0x3e')]=qs['filters'](_[_0x9ada('0x3f')](_0x42b817[_0x9ada('0x34')],_0x1fdf00['filters']),_0x395c75);if(_0x42b817['query']['filter']){_0xecfa53[_0x9ada('0x3e')]=_[_0x9ada('0x40')](_0xecfa53[_0x9ada('0x3e')],{'$or':_['map'](_0x395c75,function(_0x2acd58){if(_0x2acd58[_0x9ada('0x30')]!==_0x9ada('0x41')){var _0xd45199={};_0xd45199[_0x2acd58['name']]={'$like':'%'+_0x42b817[_0x9ada('0x34')][_0x9ada('0x42')]+'%'};return _0xd45199;}})});}_0xecfa53=_['merge']({},_0xecfa53,_0x42b817['options']);var _0x34f720={'where':_0xecfa53['where']};return db[_0x9ada('0x2d')][_0x9ada('0x1f')](_0x34f720)[_0x9ada('0x43')](function(_0x53b43c){_0x50f12a[_0x9ada('0x1f')]=_0x53b43c;if(_0x42b817[_0x9ada('0x34')][_0x9ada('0x44')]){_0xecfa53[_0x9ada('0x45')]=[{'all':!![]}];}return db[_0x9ada('0x2d')][_0x9ada('0x46')](_0xecfa53);})[_0x9ada('0x43')](function(_0x2ab630){_0x50f12a[_0x9ada('0x47')]=_0x2ab630;return _0x50f12a;})['then'](respondWithFilteredResult(_0xa6e4b1,_0xecfa53))[_0x9ada('0x48')](handleError(_0xa6e4b1,null));};exports[_0x9ada('0x49')]=function(_0x2492a3,_0x238b48){var _0x472944={'raw':![],'where':{'id':_0x2492a3['params']['id']}},_0x4180cc={};_0x4180cc[_0x9ada('0x32')]=_['keys'](db['SugarcrmAccount'][_0x9ada('0x2e')]);_0x4180cc[_0x9ada('0x34')]=_[_0x9ada('0x33')](_0x2492a3[_0x9ada('0x34')]);_0x4180cc['filters']=_[_0x9ada('0x36')](_0x4180cc[_0x9ada('0x32')],_0x4180cc['query']);_0x472944[_0x9ada('0x37')]=_[_0x9ada('0x36')](_0x4180cc['model'],qs['fields'](_0x2492a3[_0x9ada('0x34')]['fields']));_0x472944['attributes']=_0x472944[_0x9ada('0x37')]['length']?_0x472944['attributes']:_0x4180cc[_0x9ada('0x32')];if(_0x2492a3[_0x9ada('0x34')]['includeAll']){_0x472944[_0x9ada('0x45')]=[{'all':!![]}];}_0x472944=_[_0x9ada('0x40')]({},_0x472944,_0x2492a3['options']);return db['SugarcrmAccount'][_0x9ada('0x4a')](_0x472944)['then'](handleEntityNotFound(_0x238b48,null))['then'](respondWithResult(_0x238b48,null))[_0x9ada('0x48')](handleError(_0x238b48,null));};exports[_0x9ada('0x4b')]=function(_0x37320a,_0x4690ce){return db[_0x9ada('0x2d')][_0x9ada('0x4b')](_0x37320a[_0x9ada('0x4c')],{})[_0x9ada('0x43')](respondWithResult(_0x4690ce,0xc9))[_0x9ada('0x48')](handleError(_0x4690ce,null));};exports[_0x9ada('0x25')]=function(_0x2328cc,_0x5d2c0f){if(_0x2328cc[_0x9ada('0x4c')]['id']){delete _0x2328cc[_0x9ada('0x4c')]['id'];}return db['SugarcrmAccount'][_0x9ada('0x4a')]({'where':{'id':_0x2328cc[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x5d2c0f,null))[_0x9ada('0x43')](saveUpdates(_0x2328cc['body'],null))[_0x9ada('0x43')](respondWithResult(_0x5d2c0f,null))[_0x9ada('0x48')](handleError(_0x5d2c0f,null));};exports[_0x9ada('0x26')]=function(_0x257e34,_0x243387){return db[_0x9ada('0x2d')]['find']({'where':{'id':_0x257e34[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x243387,null))[_0x9ada('0x43')](removeEntity(_0x243387,null))['catch'](handleError(_0x243387,null));};exports[_0x9ada('0x4e')]=function(_0x26bafc,_0x50865a,_0x3c91c0){var _0x3d2fa9={};var _0x42b38d={};var _0x716701;var _0x434c2c;return db['SugarcrmAccount'][_0x9ada('0x4f')]({'where':{'id':_0x26bafc[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x50865a,null))[_0x9ada('0x43')](function(_0x28be55){if(_0x28be55){_0x716701=_0x28be55;_0x42b38d[_0x9ada('0x32')]=_[_0x9ada('0x33')](db[_0x9ada('0x50')][_0x9ada('0x2e')]);_0x42b38d[_0x9ada('0x34')]=_['keys'](_0x26bafc[_0x9ada('0x34')]);_0x42b38d['filters']=_[_0x9ada('0x36')](_0x42b38d['model'],_0x42b38d[_0x9ada('0x34')]);_0x3d2fa9[_0x9ada('0x37')]=_[_0x9ada('0x36')](_0x42b38d[_0x9ada('0x32')],qs[_0x9ada('0x38')](_0x26bafc[_0x9ada('0x34')][_0x9ada('0x38')]));_0x3d2fa9[_0x9ada('0x37')]=_0x3d2fa9['attributes'][_0x9ada('0x39')]?_0x3d2fa9[_0x9ada('0x37')]:_0x42b38d[_0x9ada('0x32')];_0x3d2fa9[_0x9ada('0x3c')]=qs[_0x9ada('0x3d')](_0x26bafc[_0x9ada('0x34')][_0x9ada('0x3d')]);_0x3d2fa9[_0x9ada('0x3e')]=qs[_0x9ada('0x35')](_['pick'](_0x26bafc[_0x9ada('0x34')],_0x42b38d['filters']));if(_0x26bafc[_0x9ada('0x34')][_0x9ada('0x42')]){_0x3d2fa9[_0x9ada('0x3e')]=_['merge'](_0x3d2fa9[_0x9ada('0x3e')],{'$or':_[_0x9ada('0x2c')](_0x3d2fa9[_0x9ada('0x37')],function(_0x2a0e27){var _0x5aa74a={};_0x5aa74a[_0x2a0e27]={'$like':'%'+_0x26bafc['query'][_0x9ada('0x42')]+'%'};return _0x5aa74a;})});}_0x3d2fa9=_[_0x9ada('0x40')]({},_0x3d2fa9,_0x26bafc[_0x9ada('0x51')]);return _0x716701[_0x9ada('0x4e')](_0x3d2fa9);}})[_0x9ada('0x43')](function(_0x518e3b){if(_0x518e3b){_0x434c2c=_0x518e3b[_0x9ada('0x39')];if(!_0x26bafc['query'][_0x9ada('0x3a')](_0x9ada('0x3b'))){_0x3d2fa9[_0x9ada('0x1e')]=qs[_0x9ada('0x1e')](_0x26bafc[_0x9ada('0x34')][_0x9ada('0x1e')]);_0x3d2fa9[_0x9ada('0x1c')]=qs[_0x9ada('0x1c')](_0x26bafc['query'][_0x9ada('0x1c')]);}return _0x716701['getConfigurations'](_0x3d2fa9);}})[_0x9ada('0x43')](function(_0x68426f){if(_0x68426f){return _0x68426f?{'count':_0x434c2c,'rows':_0x68426f}:null;}})[_0x9ada('0x43')](respondWithResult(_0x50865a,null))[_0x9ada('0x48')](handleError(_0x50865a,null));};exports[_0x9ada('0x52')]=function(_0x53baee,_0x4ee068,_0x4fd076){if(_0x53baee[_0x9ada('0x4c')]['id']){delete _0x53baee[_0x9ada('0x4c')]['id'];}return db['SugarcrmAccount'][_0x9ada('0x4f')]({'where':{'id':_0x53baee[_0x9ada('0x4d')]['id']}})[_0x9ada('0x43')](handleEntityNotFound(_0x4ee068,null))[_0x9ada('0x43')](function(_0x28b014){if(_0x28b014){_0x53baee[_0x9ada('0x4c')][_0x9ada('0x53')]=_0x28b014['id'];_0x53baee[_0x9ada('0x4c')]['Subjects']=integrations[_0x9ada('0x54')](_0x53baee[_0x9ada('0x4c')][_0x9ada('0x55')],_0x53baee[_0x9ada('0x4c')]['type']);_0x53baee[_0x9ada('0x4c')][_0x9ada('0x56')]=integrations[_0x9ada('0x57')](_0x53baee[_0x9ada('0x4c')]['channel'],_0x53baee[_0x9ada('0x4c')][_0x9ada('0x30')]);return db['SugarcrmConfiguration'][_0x9ada('0x4b')](_0x53baee[_0x9ada('0x4c')],{'include':[{'model':db[_0x9ada('0x58')],'as':_0x9ada('0x59')},{'model':db[_0x9ada('0x58')],'as':_0x9ada('0x56')}]});}return null;})['then'](respondWithResult(_0x4ee068,null))[_0x9ada('0x48')](handleError(_0x4ee068,null));};exports[_0x9ada('0x5a')]=function(_0x378802,_0x4b7096,_0x1ffaf5){var _0xf6eca9='';var _0x146c0e=['id',_0x9ada('0x29'),_0x9ada('0x5b'),'created_by',_0x9ada('0x5c'),_0x9ada('0x5d'),_0x9ada('0x5e'),_0x9ada('0x5f'),_0x9ada('0x60'),'parent_type',_0x9ada('0x61'),_0x9ada('0x62')];return db[_0x9ada('0x2d')][_0x9ada('0x4f')]({'where':{'id':_0x378802[_0x9ada('0x4d')]['id']},'attributes':['id','username',_0x9ada('0x63'),_0x9ada('0x64')]})[_0x9ada('0x43')](handleEntityNotFound(_0x4b7096,null))['then'](function(_0x55cb0f){if(_0x55cb0f){_0xf6eca9=_0x55cb0f[_0x9ada('0x64')];var _0x1a5c7b=_0xf6eca9[_0x9ada('0x65')](-0x1);if(_0x1a5c7b==='/'){_0xf6eca9=_0xf6eca9[_0x9ada('0x66')](0x0,_0xf6eca9[_0x9ada('0x67')](_0x1a5c7b));}return rp({'method':_0x9ada('0x68'),'uri':util[_0x9ada('0x69')](_0x9ada('0x6a'),_0xf6eca9,_0x9ada('0x6b')),'json':!![],'form':{'method':_0x9ada('0x6c'),'input_type':_0x9ada('0x6d'),'response_type':_0x9ada('0x6d'),'rest_data':JSON[_0x9ada('0x6e')]({'user_auth':{'user_name':_0x55cb0f[_0x9ada('0x6f')],'password':_0x55cb0f[_0x9ada('0x63')],'encryption':_0x9ada('0x70')},'application':_0x9ada('0x71')})}});}})[_0x9ada('0x43')](function(_0x522597){if(_0x522597&&_0x522597['name']!==_0x9ada('0x72')&&_0x522597[_0x9ada('0x29')]!==_0x9ada('0x73')){return rp({'method':'POST','uri':util[_0x9ada('0x69')](_0x9ada('0x6a'),_0xf6eca9,_0x9ada('0x6b')),'json':!![],'form':{'method':_0x9ada('0x74'),'input_type':_0x9ada('0x6d'),'response_type':_0x9ada('0x6d'),'rest_data':JSON[_0x9ada('0x6e')]({'session':_0x522597['id'],'module_name':'Calls'})}})[_0x9ada('0x43')](function(_0x42f125){if(_0x42f125){var _0x1ce456=_[_0x9ada('0x75')](_0x42f125[_0x9ada('0x76')]);_['remove'](_0x1ce456,function(_0x4ffe18){return _0x146c0e[_0x9ada('0x77')](_0x4ffe18[_0x9ada('0x29')]);});return{'count':_0x1ce456[_0x9ada('0x39')],'rows':_[_0x9ada('0x2c')](_0x1ce456,function(_0x18646a){return{'id':_0x18646a['name'],'name':_0x18646a[_0x9ada('0x78')],'custom':_['endsWith'](_0x18646a[_0x9ada('0x29')],'_c')?!![]:![],'options':_0x18646a[_0x9ada('0x51')]?_[_0x9ada('0x2c')](_[_0x9ada('0x75')](_0x18646a[_0x9ada('0x51')]),function(_0x960d6f){return{'name':_0x960d6f[_0x9ada('0x79')],'value':_0x960d6f[_0x9ada('0x29')]};}):[]};})};}})[_0x9ada('0x43')](respondWithResult(_0x4b7096,null))[_0x9ada('0x48')](function(_0x364625){var _0x22f76b=_0x378802['query'][_0x9ada('0x7a')]?0x1f4:_0x364625[_0x9ada('0x7b')]||0x1f4;logger[_0x9ada('0x27')](_0x9ada('0x7c'),'getFields',_0x22f76b,JSON[_0x9ada('0x6e')](_0x364625));delete _0x364625[_0x9ada('0x29')];if(_0x22f76b===0x191){_0x22f76b=0x190;}_0x4b7096['status'](_0x22f76b)[_0x9ada('0x2a')](_0x378802[_0x9ada('0x34')][_0x9ada('0x7a')]?{'message':'Wrong\x20credentials','statusCode':_0x364625[_0x9ada('0x7b')]}:_0x364625);});}else{var _0x2f1650=0x1f4;_0x4b7096[_0x9ada('0x19')](_0x2f1650)[_0x9ada('0x2a')]({'message':_0x9ada('0x7d'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xc3e4=['JSON','stringify','PLAIN','Invalid\x20Login','Password\x20Expired','format','%s%s','values','module_fields','remove','includes','label','endsWith','value','test','statusCode','getFields','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','undefined','count','offset','limit','Content-Range','apply','save','update','destroy','stack','send','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','map','VIRTUAL','then','includeAll','include','catch','show','SugarcrmAccount','options','find','create','body','params','getConfigurations','findOne','SugarcrmConfiguration','AccountId','Subjects','channel','Descriptions','SugarcrmField','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','password','remoteUri','lastIndexOf','POST','/service/v4_1/rest.php','login'];(function(_0x18be13,_0x12f269){var _0x17317b=function(_0x449d31){while(--_0x449d31){_0x18be13['push'](_0x18be13['shift']());}};_0x17317b(++_0x12f269);}(_0xc3e4,0x174));var _0x4c3e=function(_0x342082,_0x33b74a){_0x342082=_0x342082-0x0;var _0x9aed95=_0xc3e4[_0x342082];return _0x9aed95;};'use strict';var emlformat=require(_0x4c3e('0x0'));var rimraf=require(_0x4c3e('0x1'));var zipdir=require(_0x4c3e('0x2'));var jsonpatch=require(_0x4c3e('0x3'));var rp=require('request-promise');var moment=require(_0x4c3e('0x4'));var BPromise=require(_0x4c3e('0x5'));var Mustache=require('mustache');var util=require(_0x4c3e('0x6'));var path=require(_0x4c3e('0x7'));var sox=require(_0x4c3e('0x8'));var csv=require('to-csv');var ejs=require(_0x4c3e('0x9'));var fs=require('fs');var fs_extra=require(_0x4c3e('0xa'));var _=require(_0x4c3e('0xb'));var squel=require(_0x4c3e('0xc'));var crypto=require(_0x4c3e('0xd'));var jsforce=require(_0x4c3e('0xe'));var deskjs=require(_0x4c3e('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4c3e('0x10'));var Papa=require(_0x4c3e('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4c3e('0x12'));var as=require(_0x4c3e('0x13'));var hardwareService=require(_0x4c3e('0x14'));var logger=require(_0x4c3e('0x15'))(_0x4c3e('0x16'));var utils=require(_0x4c3e('0x17'));var config=require(_0x4c3e('0x18'));var licenseUtil=require(_0x4c3e('0x19'));var db=require('../../mysqldb')['db'];var integrations=require(_0x4c3e('0x1a'));function respondWithStatusCode(_0x20ae97,_0x3b55a2){_0x3b55a2=_0x3b55a2||0xcc;return function(_0x562807){if(_0x562807){return _0x20ae97[_0x4c3e('0x1b')](_0x3b55a2);}return _0x20ae97['status'](_0x3b55a2)[_0x4c3e('0x1c')]();};}function respondWithResult(_0x89841b,_0x39cc94){_0x39cc94=_0x39cc94||0xc8;return function(_0x1c5b37){if(_0x1c5b37){return _0x89841b[_0x4c3e('0x1d')](_0x39cc94)[_0x4c3e('0x1e')](_0x1c5b37);}};}function respondWithFilteredResult(_0x59c88c,_0x41ce30){return function(_0x3063bd){if(_0x3063bd){var _0x4c3f82=typeof _0x41ce30['offset']==='undefined'&&typeof _0x41ce30['limit']===_0x4c3e('0x1f');var _0x23db73=_0x3063bd[_0x4c3e('0x20')];var _0x3a730e=_0x4c3f82?0x0:_0x41ce30[_0x4c3e('0x21')];var _0x173d46=_0x4c3f82?_0x3063bd[_0x4c3e('0x20')]:_0x41ce30[_0x4c3e('0x21')]+_0x41ce30[_0x4c3e('0x22')];var _0x255099;if(_0x173d46>=_0x23db73){_0x173d46=_0x23db73;_0x255099=0xc8;}else{_0x255099=0xce;}_0x59c88c[_0x4c3e('0x1d')](_0x255099);return _0x59c88c['set'](_0x4c3e('0x23'),_0x3a730e+'-'+_0x173d46+'/'+_0x23db73)[_0x4c3e('0x1e')](_0x3063bd);}return null;};}function patchUpdates(_0x28f9b1){return function(_0x28f1a9){try{jsonpatch[_0x4c3e('0x24')](_0x28f1a9,_0x28f9b1,!![]);}catch(_0x401983){return BPromise['reject'](_0x401983);}return _0x28f1a9[_0x4c3e('0x25')]();};}function saveUpdates(_0x3e59a2,_0x2ecc47){return function(_0x146bce){if(_0x146bce){return _0x146bce[_0x4c3e('0x26')](_0x3e59a2)['then'](function(_0x19bced){return _0x19bced;});}return null;};}function removeEntity(_0x9e1ff8,_0x1617c4){return function(_0x1d8741){if(_0x1d8741){return _0x1d8741[_0x4c3e('0x27')]()['then'](function(){_0x9e1ff8['status'](0xcc)[_0x4c3e('0x1c')]();});}};}function handleEntityNotFound(_0x31ceae,_0x59ff6f){return function(_0x4f69c3){if(!_0x4f69c3){_0x31ceae[_0x4c3e('0x1b')](0x194);}return _0x4f69c3;};}function handleError(_0x4e7253,_0x5dd1fd){_0x5dd1fd=_0x5dd1fd||0x1f4;return function(_0x5c2bb2){logger['error'](_0x5c2bb2[_0x4c3e('0x28')]);if(_0x5c2bb2['name']){delete _0x5c2bb2['name'];}_0x4e7253['status'](_0x5dd1fd)[_0x4c3e('0x29')](_0x5c2bb2);};}exports['index']=function(_0x1bb082,_0x58f015){var _0x2dcb17={},_0x309b75={},_0x74d85a={'count':0x0,'rows':[]};var _0x4b823c=_['map'](db['SugarcrmAccount'][_0x4c3e('0x2a')],function(_0x10ae38){return{'name':_0x10ae38[_0x4c3e('0x2b')],'type':_0x10ae38[_0x4c3e('0x2c')]['key']};});_0x309b75[_0x4c3e('0x2d')]=_['map'](_0x4b823c,_0x4c3e('0x2e'));_0x309b75[_0x4c3e('0x2f')]=_[_0x4c3e('0x30')](_0x1bb082[_0x4c3e('0x2f')]);_0x309b75[_0x4c3e('0x31')]=_[_0x4c3e('0x32')](_0x309b75['model'],_0x309b75[_0x4c3e('0x2f')]);_0x2dcb17[_0x4c3e('0x33')]=_['intersection'](_0x309b75[_0x4c3e('0x2d')],qs[_0x4c3e('0x34')](_0x1bb082[_0x4c3e('0x2f')]['fields']));_0x2dcb17[_0x4c3e('0x33')]=_0x2dcb17['attributes'][_0x4c3e('0x35')]?_0x2dcb17[_0x4c3e('0x33')]:_0x309b75['model'];if(!_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x36')](_0x4c3e('0x37'))){_0x2dcb17[_0x4c3e('0x22')]=qs['limit'](_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x22')]);_0x2dcb17[_0x4c3e('0x21')]=qs[_0x4c3e('0x21')](_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x21')]);}_0x2dcb17[_0x4c3e('0x38')]=qs['sort'](_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x39')]);_0x2dcb17['where']=qs[_0x4c3e('0x31')](_[_0x4c3e('0x3a')](_0x1bb082[_0x4c3e('0x2f')],_0x309b75[_0x4c3e('0x31')]),_0x4b823c);if(_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x3b')]){_0x2dcb17['where']=_[_0x4c3e('0x3c')](_0x2dcb17[_0x4c3e('0x3d')],{'$or':_[_0x4c3e('0x3e')](_0x4b823c,function(_0x92a514){if(_0x92a514['type']!==_0x4c3e('0x3f')){var _0x29299d={};_0x29299d[_0x92a514[_0x4c3e('0x2e')]]={'$like':'%'+_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x3b')]+'%'};return _0x29299d;}})});}_0x2dcb17=_[_0x4c3e('0x3c')]({},_0x2dcb17,_0x1bb082['options']);var _0xb399b3={'where':_0x2dcb17[_0x4c3e('0x3d')]};return db['SugarcrmAccount'][_0x4c3e('0x20')](_0xb399b3)[_0x4c3e('0x40')](function(_0x464c8b){_0x74d85a[_0x4c3e('0x20')]=_0x464c8b;if(_0x1bb082[_0x4c3e('0x2f')][_0x4c3e('0x41')]){_0x2dcb17[_0x4c3e('0x42')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x2dcb17);})[_0x4c3e('0x40')](function(_0x453148){_0x74d85a['rows']=_0x453148;return _0x74d85a;})[_0x4c3e('0x40')](respondWithFilteredResult(_0x58f015,_0x2dcb17))[_0x4c3e('0x43')](handleError(_0x58f015,null));};exports[_0x4c3e('0x44')]=function(_0x4389ed,_0x385a0c){var _0x1db27e={'raw':![],'where':{'id':_0x4389ed['params']['id']}},_0x540562={};_0x540562[_0x4c3e('0x2d')]=_['keys'](db[_0x4c3e('0x45')][_0x4c3e('0x2a')]);_0x540562[_0x4c3e('0x2f')]=_[_0x4c3e('0x30')](_0x4389ed[_0x4c3e('0x2f')]);_0x540562[_0x4c3e('0x31')]=_[_0x4c3e('0x32')](_0x540562[_0x4c3e('0x2d')],_0x540562[_0x4c3e('0x2f')]);_0x1db27e['attributes']=_['intersection'](_0x540562[_0x4c3e('0x2d')],qs[_0x4c3e('0x34')](_0x4389ed['query'][_0x4c3e('0x34')]));_0x1db27e[_0x4c3e('0x33')]=_0x1db27e[_0x4c3e('0x33')][_0x4c3e('0x35')]?_0x1db27e['attributes']:_0x540562[_0x4c3e('0x2d')];if(_0x4389ed[_0x4c3e('0x2f')]['includeAll']){_0x1db27e[_0x4c3e('0x42')]=[{'all':!![]}];}_0x1db27e=_['merge']({},_0x1db27e,_0x4389ed[_0x4c3e('0x46')]);return db[_0x4c3e('0x45')][_0x4c3e('0x47')](_0x1db27e)[_0x4c3e('0x40')](handleEntityNotFound(_0x385a0c,null))['then'](respondWithResult(_0x385a0c,null))[_0x4c3e('0x43')](handleError(_0x385a0c,null));};exports[_0x4c3e('0x48')]=function(_0x44379a,_0x46a995){return db[_0x4c3e('0x45')][_0x4c3e('0x48')](_0x44379a['body'],{})[_0x4c3e('0x40')](respondWithResult(_0x46a995,0xc9))[_0x4c3e('0x43')](handleError(_0x46a995,null));};exports[_0x4c3e('0x26')]=function(_0x411adb,_0x252b88){if(_0x411adb['body']['id']){delete _0x411adb[_0x4c3e('0x49')]['id'];}return db[_0x4c3e('0x45')][_0x4c3e('0x47')]({'where':{'id':_0x411adb['params']['id']}})[_0x4c3e('0x40')](handleEntityNotFound(_0x252b88,null))[_0x4c3e('0x40')](saveUpdates(_0x411adb[_0x4c3e('0x49')],null))[_0x4c3e('0x40')](respondWithResult(_0x252b88,null))[_0x4c3e('0x43')](handleError(_0x252b88,null));};exports[_0x4c3e('0x27')]=function(_0x40f5ef,_0xc074ac){return db[_0x4c3e('0x45')][_0x4c3e('0x47')]({'where':{'id':_0x40f5ef[_0x4c3e('0x4a')]['id']}})[_0x4c3e('0x40')](handleEntityNotFound(_0xc074ac,null))[_0x4c3e('0x40')](removeEntity(_0xc074ac,null))[_0x4c3e('0x43')](handleError(_0xc074ac,null));};exports[_0x4c3e('0x4b')]=function(_0x19da8e,_0x5946e9,_0xafd571){var _0xa06ed6={};var _0x18338f={};var _0x2902bb;var _0x14bf74;return db[_0x4c3e('0x45')][_0x4c3e('0x4c')]({'where':{'id':_0x19da8e[_0x4c3e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5946e9,null))[_0x4c3e('0x40')](function(_0x298475){if(_0x298475){_0x2902bb=_0x298475;_0x18338f[_0x4c3e('0x2d')]=_[_0x4c3e('0x30')](db[_0x4c3e('0x4d')]['rawAttributes']);_0x18338f['query']=_[_0x4c3e('0x30')](_0x19da8e[_0x4c3e('0x2f')]);_0x18338f['filters']=_['intersection'](_0x18338f[_0x4c3e('0x2d')],_0x18338f[_0x4c3e('0x2f')]);_0xa06ed6[_0x4c3e('0x33')]=_[_0x4c3e('0x32')](_0x18338f[_0x4c3e('0x2d')],qs[_0x4c3e('0x34')](_0x19da8e[_0x4c3e('0x2f')]['fields']));_0xa06ed6['attributes']=_0xa06ed6[_0x4c3e('0x33')][_0x4c3e('0x35')]?_0xa06ed6[_0x4c3e('0x33')]:_0x18338f[_0x4c3e('0x2d')];_0xa06ed6['order']=qs[_0x4c3e('0x39')](_0x19da8e['query'][_0x4c3e('0x39')]);_0xa06ed6[_0x4c3e('0x3d')]=qs[_0x4c3e('0x31')](_['pick'](_0x19da8e[_0x4c3e('0x2f')],_0x18338f[_0x4c3e('0x31')]));if(_0x19da8e[_0x4c3e('0x2f')][_0x4c3e('0x3b')]){_0xa06ed6['where']=_[_0x4c3e('0x3c')](_0xa06ed6[_0x4c3e('0x3d')],{'$or':_[_0x4c3e('0x3e')](_0xa06ed6[_0x4c3e('0x33')],function(_0x3bda38){var _0x1b6a2b={};_0x1b6a2b[_0x3bda38]={'$like':'%'+_0x19da8e[_0x4c3e('0x2f')][_0x4c3e('0x3b')]+'%'};return _0x1b6a2b;})});}_0xa06ed6=_['merge']({},_0xa06ed6,_0x19da8e[_0x4c3e('0x46')]);return _0x2902bb[_0x4c3e('0x4b')](_0xa06ed6);}})[_0x4c3e('0x40')](function(_0x2c71ce){if(_0x2c71ce){_0x14bf74=_0x2c71ce[_0x4c3e('0x35')];if(!_0x19da8e[_0x4c3e('0x2f')]['hasOwnProperty'](_0x4c3e('0x37'))){_0xa06ed6[_0x4c3e('0x22')]=qs['limit'](_0x19da8e[_0x4c3e('0x2f')]['limit']);_0xa06ed6['offset']=qs[_0x4c3e('0x21')](_0x19da8e['query'][_0x4c3e('0x21')]);}return _0x2902bb['getConfigurations'](_0xa06ed6);}})[_0x4c3e('0x40')](function(_0x299b55){if(_0x299b55){return _0x299b55?{'count':_0x14bf74,'rows':_0x299b55}:null;}})[_0x4c3e('0x40')](respondWithResult(_0x5946e9,null))[_0x4c3e('0x43')](handleError(_0x5946e9,null));};exports['addConfiguration']=function(_0x5012cf,_0x2280a0,_0x13bec5){if(_0x5012cf['body']['id']){delete _0x5012cf[_0x4c3e('0x49')]['id'];}return db['SugarcrmAccount']['findOne']({'where':{'id':_0x5012cf[_0x4c3e('0x4a')]['id']}})[_0x4c3e('0x40')](handleEntityNotFound(_0x2280a0,null))['then'](function(_0x2545e0){if(_0x2545e0){_0x5012cf[_0x4c3e('0x49')][_0x4c3e('0x4e')]=_0x2545e0['id'];_0x5012cf[_0x4c3e('0x49')][_0x4c3e('0x4f')]=integrations['getSubjects'](_0x5012cf[_0x4c3e('0x49')][_0x4c3e('0x50')],_0x5012cf['body'][_0x4c3e('0x2c')]);_0x5012cf[_0x4c3e('0x49')][_0x4c3e('0x51')]=integrations['getDescriptions'](_0x5012cf[_0x4c3e('0x49')][_0x4c3e('0x50')],_0x5012cf[_0x4c3e('0x49')][_0x4c3e('0x2c')]);return db[_0x4c3e('0x4d')][_0x4c3e('0x48')](_0x5012cf[_0x4c3e('0x49')],{'include':[{'model':db['SugarcrmField'],'as':_0x4c3e('0x4f')},{'model':db[_0x4c3e('0x52')],'as':_0x4c3e('0x51')}]});}return null;})[_0x4c3e('0x40')](respondWithResult(_0x2280a0,null))['catch'](handleError(_0x2280a0,null));};exports['getFields']=function(_0x48b816,_0x44cadb,_0xd5131){var _0x5c0691='';var _0x590e49=['id',_0x4c3e('0x2e'),_0x4c3e('0x53'),_0x4c3e('0x54'),_0x4c3e('0x55'),_0x4c3e('0x56'),_0x4c3e('0x57'),_0x4c3e('0x58'),_0x4c3e('0x59'),_0x4c3e('0x5a'),_0x4c3e('0x5b'),_0x4c3e('0x5c')];return db[_0x4c3e('0x45')]['findOne']({'where':{'id':_0x48b816[_0x4c3e('0x4a')]['id']},'attributes':['id',_0x4c3e('0x5d'),_0x4c3e('0x5e'),_0x4c3e('0x5f')]})[_0x4c3e('0x40')](handleEntityNotFound(_0x44cadb,null))[_0x4c3e('0x40')](function(_0x2640b2){if(_0x2640b2){_0x5c0691=_0x2640b2[_0x4c3e('0x5f')];var _0xd984b4=_0x5c0691['slice'](-0x1);if(_0xd984b4==='/'){_0x5c0691=_0x5c0691['substring'](0x0,_0x5c0691[_0x4c3e('0x60')](_0xd984b4));}return rp({'method':_0x4c3e('0x61'),'uri':util['format']('%s%s',_0x5c0691,_0x4c3e('0x62')),'json':!![],'form':{'method':_0x4c3e('0x63'),'input_type':_0x4c3e('0x64'),'response_type':_0x4c3e('0x64'),'rest_data':JSON[_0x4c3e('0x65')]({'user_auth':{'user_name':_0x2640b2[_0x4c3e('0x5d')],'password':_0x2640b2['password'],'encryption':_0x4c3e('0x66')},'application':'xCALLY\x20Motion\x20Integration'})}});}})['then'](function(_0x4c5d46){if(_0x4c5d46&&_0x4c5d46[_0x4c3e('0x2e')]!==_0x4c3e('0x67')&&_0x4c5d46[_0x4c3e('0x2e')]!==_0x4c3e('0x68')){return rp({'method':_0x4c3e('0x61'),'uri':util[_0x4c3e('0x69')](_0x4c3e('0x6a'),_0x5c0691,_0x4c3e('0x62')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':_0x4c3e('0x64'),'rest_data':JSON[_0x4c3e('0x65')]({'session':_0x4c5d46['id'],'module_name':'Calls'})}})['then'](function(_0x140eec){if(_0x140eec){var _0x8e7801=_[_0x4c3e('0x6b')](_0x140eec[_0x4c3e('0x6c')]);_[_0x4c3e('0x6d')](_0x8e7801,function(_0x21b5ee){return _0x590e49[_0x4c3e('0x6e')](_0x21b5ee[_0x4c3e('0x2e')]);});return{'count':_0x8e7801[_0x4c3e('0x35')],'rows':_[_0x4c3e('0x3e')](_0x8e7801,function(_0x3822b2){return{'id':_0x3822b2[_0x4c3e('0x2e')],'name':_0x3822b2[_0x4c3e('0x6f')],'custom':_[_0x4c3e('0x70')](_0x3822b2[_0x4c3e('0x2e')],'_c')?!![]:![],'options':_0x3822b2[_0x4c3e('0x46')]?_[_0x4c3e('0x3e')](_[_0x4c3e('0x6b')](_0x3822b2[_0x4c3e('0x46')]),function(_0x579643){return{'name':_0x579643[_0x4c3e('0x71')],'value':_0x579643['name']};}):[]};})};}})[_0x4c3e('0x40')](respondWithResult(_0x44cadb,null))['catch'](function(_0x4fec3d){var _0x40cd43=_0x48b816['query'][_0x4c3e('0x72')]?0x1f4:_0x4fec3d[_0x4c3e('0x73')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x4c3e('0x74'),_0x40cd43,JSON[_0x4c3e('0x65')](_0x4fec3d));delete _0x4fec3d[_0x4c3e('0x2e')];if(_0x40cd43===0x191){_0x40cd43=0x190;}_0x44cadb[_0x4c3e('0x1d')](_0x40cd43)[_0x4c3e('0x29')](_0x48b816[_0x4c3e('0x2f')][_0x4c3e('0x72')]?{'message':_0x4c3e('0x75'),'statusCode':_0x4fec3d['statusCode']}:_0x4fec3d);});}else{var _0x5a6076=0x1f4;_0x44cadb[_0x4c3e('0x1d')](_0x5a6076)[_0x4c3e('0x29')]({'message':'Wrong\x20credentials','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 57b59b3..8a5cbb0 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 _0x0b6b=['../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','int_sugarcrm_accounts','lodash','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1f0d60,_0x58a2c2){var _0x148a20=function(_0x96e0a3){while(--_0x96e0a3){_0x1f0d60['push'](_0x1f0d60['shift']());}};_0x148a20(++_0x58a2c2);}(_0x0b6b,0x125));var _0xb0b6=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x0b6b[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require(_0xb0b6('0x0'));var util=require('util');var logger=require(_0xb0b6('0x1'))(_0xb0b6('0x2'));var moment=require(_0xb0b6('0x3'));var BPromise=require('bluebird');var rp=require(_0xb0b6('0x4'));var fs=require('fs');var path=require(_0xb0b6('0x5'));var rimraf=require(_0xb0b6('0x6'));var config=require(_0xb0b6('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xb0b6('0x8'));module[_0xb0b6('0x9')]=function(_0x1477ff,_0x2b4782){return _0x1477ff['define'](_0xb0b6('0xa'),attributes,{'tableName':_0xb0b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf316=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','int_sugarcrm_accounts','util'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf316,0xd7));var _0x6f31=function(_0x584119,_0x416705){_0x584119=_0x584119-0x0;var _0x298c43=_0xf316[_0x584119];return _0x298c43;};'use strict';var _=require('lodash');var util=require(_0x6f31('0x0'));var logger=require(_0x6f31('0x1'))(_0x6f31('0x2'));var moment=require(_0x6f31('0x3'));var BPromise=require(_0x6f31('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f31('0x5'));var rimraf=require(_0x6f31('0x6'));var config=require(_0x6f31('0x7'));var attributes=require(_0x6f31('0x8'));var integrations=require(_0x6f31('0x9'));module[_0x6f31('0xa')]=function(_0x3a26d4,_0x1f7fd4){return _0x3a26d4['define']('SugarcrmAccount',attributes,{'tableName':_0x6f31('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 7793ce8..df911c2 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 _0xa0f7=['client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','options','raw','where','attributes','limit','map','include','model','GetSugarcrmAccount','ShowSugarcrmAccount','SugarcrmAccount','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x935fc8,_0x2e6376){var _0x2bd2e4=function(_0x35a00f){while(--_0x35a00f){_0x935fc8['push'](_0x935fc8['shift']());}};_0x2bd2e4(++_0x2e6376);}(_0xa0f7,0x69));var _0x7a0f=function(_0x19f177,_0x31f453){_0x19f177=_0x19f177-0x0;var _0x579289=_0xa0f7[_0x19f177];return _0x579289;};'use strict';var _=require(_0x7a0f('0x0'));var util=require(_0x7a0f('0x1'));var moment=require(_0x7a0f('0x2'));var BPromise=require(_0x7a0f('0x3'));var rs=require(_0x7a0f('0x4'));var fs=require('fs');var Redis=require(_0x7a0f('0x5'));var db=require(_0x7a0f('0x6'))['db'];var utils=require(_0x7a0f('0x7'));var logger=require(_0x7a0f('0x8'))(_0x7a0f('0x9'));var config=require(_0x7a0f('0xa'));var jayson=require(_0x7a0f('0xb'));var client=jayson[_0x7a0f('0xc')][_0x7a0f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3fc35f,_0x23521c,_0x2deeef){return new BPromise(function(_0x16c553,_0x53e3ec){return client[_0x7a0f('0xe')](_0x3fc35f,_0x2deeef)[_0x7a0f('0xf')](function(_0x6d78a7){logger[_0x7a0f('0x10')](_0x7a0f('0x11'),_0x23521c,_0x7a0f('0x12'));logger[_0x7a0f('0x13')](_0x7a0f('0x14'),_0x23521c,_0x7a0f('0x12'),JSON['stringify'](_0x6d78a7));if(_0x6d78a7['error']){if(_0x6d78a7[_0x7a0f('0x15')][_0x7a0f('0x16')]===0x1f4){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0x23521c,_0x6d78a7[_0x7a0f('0x15')][_0x7a0f('0x17')]);return _0x53e3ec(_0x6d78a7[_0x7a0f('0x15')]['message']);}logger[_0x7a0f('0x15')](_0x7a0f('0x11'),_0x23521c,_0x6d78a7['error']['message']);return _0x16c553(_0x6d78a7[_0x7a0f('0x15')]['message']);}else{logger[_0x7a0f('0x10')](_0x7a0f('0x11'),_0x23521c,_0x7a0f('0x12'));_0x16c553(_0x6d78a7[_0x7a0f('0x18')][_0x7a0f('0x17')]);}})[_0x7a0f('0x19')](function(_0x3bd0a0){logger[_0x7a0f('0x15')]('SugarcrmAccount,\x20%s,\x20%s',_0x23521c,_0x3bd0a0);_0x53e3ec(_0x3bd0a0);});});}exports['GetSugarcrmAccount']=function(_0x479a30){var _0x3a835b=this;return new Promise(function(_0x322513,_0x1517e6){return db['SugarcrmAccount']['findAll']({'raw':_0x479a30['options']?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1b')]===undefined?!![]:![]:!![],'where':_0x479a30[_0x7a0f('0x1a')]?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1c')]||null:null,'attributes':_0x479a30[_0x7a0f('0x1a')]?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1d')]||null:null,'limit':_0x479a30['options']?_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x1e')]||null:null,'include':_0x479a30[_0x7a0f('0x1a')]?_0x479a30[_0x7a0f('0x1a')]['include']?_[_0x7a0f('0x1f')](_0x479a30[_0x7a0f('0x1a')][_0x7a0f('0x20')],function(_0x43b1b0){return{'model':db[_0x43b1b0[_0x7a0f('0x21')]],'as':_0x43b1b0['as'],'attributes':_0x43b1b0['attributes'],'include':_0x43b1b0[_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x43b1b0[_0x7a0f('0x20')],function(_0x1f6175){return{'model':db[_0x1f6175[_0x7a0f('0x21')]],'as':_0x1f6175['as'],'attributes':_0x1f6175['attributes'],'include':_0x1f6175['include']?_[_0x7a0f('0x1f')](_0x1f6175[_0x7a0f('0x20')],function(_0x30920a){return{'model':db[_0x30920a[_0x7a0f('0x21')]],'as':_0x30920a['as'],'attributes':_0x30920a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a0f('0xf')](function(_0x4a4d09){logger[_0x7a0f('0x10')](_0x7a0f('0x22'),_0x479a30);logger[_0x7a0f('0x13')](_0x7a0f('0x22'),_0x479a30,JSON['stringify'](_0x4a4d09));_0x322513(_0x4a4d09);})[_0x7a0f('0x19')](function(_0xd4f308){logger[_0x7a0f('0x15')](_0x7a0f('0x22'),_0xd4f308['message'],_0x479a30);_0x1517e6(_0x3a835b['error'](0x1f4,_0xd4f308[_0x7a0f('0x17')]));});});};exports[_0x7a0f('0x23')]=function(_0x5e0b72){var _0x53d1e8=this;return new Promise(function(_0x357c15,_0x207d94){return db[_0x7a0f('0x24')][_0x7a0f('0x25')]({'raw':_0x5e0b72[_0x7a0f('0x1a')]?_0x5e0b72['options'][_0x7a0f('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e0b72[_0x7a0f('0x1a')]?_0x5e0b72[_0x7a0f('0x1a')][_0x7a0f('0x1c')]||null:null,'attributes':_0x5e0b72[_0x7a0f('0x1a')]?_0x5e0b72['options']['attributes']||null:null,'include':_0x5e0b72['options']?_0x5e0b72['options'][_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x5e0b72[_0x7a0f('0x1a')][_0x7a0f('0x20')],function(_0x167150){return{'model':db[_0x167150[_0x7a0f('0x21')]],'as':_0x167150['as'],'attributes':_0x167150[_0x7a0f('0x1d')],'include':_0x167150[_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x167150['include'],function(_0x1a4f6d){return{'model':db[_0x1a4f6d[_0x7a0f('0x21')]],'as':_0x1a4f6d['as'],'attributes':_0x1a4f6d[_0x7a0f('0x1d')],'include':_0x1a4f6d[_0x7a0f('0x20')]?_[_0x7a0f('0x1f')](_0x1a4f6d['include'],function(_0x53800f){return{'model':db[_0x53800f['model']],'as':_0x53800f['as'],'attributes':_0x53800f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7a0f('0xf')](function(_0x221fd3){logger[_0x7a0f('0x10')](_0x7a0f('0x23'),_0x5e0b72);logger[_0x7a0f('0x13')]('ShowSugarcrmAccount',_0x5e0b72,JSON[_0x7a0f('0x26')](_0x221fd3));_0x357c15(_0x221fd3);})[_0x7a0f('0x19')](function(_0x5a36fa){logger[_0x7a0f('0x15')]('ShowSugarcrmAccount',_0x5a36fa[_0x7a0f('0x17')],_0x5e0b72);_0x207d94(_0x53d1e8[_0x7a0f('0x15')](0x1f4,_0x5a36fa[_0x7a0f('0x17')]));});});}; \ No newline at end of file +var _0x51ea=['model','attributes','stringify','catch','ShowSugarcrmAccount','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','SugarcrmAccount,\x20%s,\x20%s','message','result','GetSugarcrmAccount','SugarcrmAccount','options','raw','include','map'];(function(_0x1d87fc,_0x1e5321){var _0x492b56=function(_0x4c6b16){while(--_0x4c6b16){_0x1d87fc['push'](_0x1d87fc['shift']());}};_0x492b56(++_0x1e5321);}(_0x51ea,0x11f));var _0xa51e=function(_0x261d18,_0x13490f){_0x261d18=_0x261d18-0x0;var _0x3e7208=_0x51ea[_0x261d18];return _0x3e7208;};'use strict';var _=require('lodash');var util=require(_0xa51e('0x0'));var moment=require(_0xa51e('0x1'));var BPromise=require(_0xa51e('0x2'));var rs=require(_0xa51e('0x3'));var fs=require('fs');var Redis=require(_0xa51e('0x4'));var db=require(_0xa51e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa51e('0x6'))(_0xa51e('0x7'));var config=require(_0xa51e('0x8'));var jayson=require(_0xa51e('0x9'));var client=jayson[_0xa51e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18bb53,_0x26901a,_0x4efec6){return new BPromise(function(_0x36a92b,_0x531198){return client[_0xa51e('0xb')](_0x18bb53,_0x4efec6)[_0xa51e('0xc')](function(_0x34aac5){logger[_0xa51e('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x26901a,_0xa51e('0xe'));logger[_0xa51e('0xf')](_0xa51e('0x10'),_0x26901a,_0xa51e('0xe'),JSON['stringify'](_0x34aac5));if(_0x34aac5[_0xa51e('0x11')]){if(_0x34aac5[_0xa51e('0x11')][_0xa51e('0x12')]===0x1f4){logger[_0xa51e('0x11')](_0xa51e('0x13'),_0x26901a,_0x34aac5[_0xa51e('0x11')][_0xa51e('0x14')]);return _0x531198(_0x34aac5[_0xa51e('0x11')]['message']);}logger[_0xa51e('0x11')](_0xa51e('0x13'),_0x26901a,_0x34aac5['error'][_0xa51e('0x14')]);return _0x36a92b(_0x34aac5[_0xa51e('0x11')][_0xa51e('0x14')]);}else{logger['info'](_0xa51e('0x13'),_0x26901a,_0xa51e('0xe'));_0x36a92b(_0x34aac5[_0xa51e('0x15')]['message']);}})['catch'](function(_0x260895){logger[_0xa51e('0x11')](_0xa51e('0x13'),_0x26901a,_0x260895);_0x531198(_0x260895);});});}exports[_0xa51e('0x16')]=function(_0x28493b){var _0x37c61e=this;return new Promise(function(_0x2adadc,_0x282b51){return db[_0xa51e('0x17')]['findAll']({'raw':_0x28493b[_0xa51e('0x18')]?_0x28493b[_0xa51e('0x18')][_0xa51e('0x19')]===undefined?!![]:![]:!![],'where':_0x28493b[_0xa51e('0x18')]?_0x28493b['options']['where']||null:null,'attributes':_0x28493b[_0xa51e('0x18')]?_0x28493b[_0xa51e('0x18')]['attributes']||null:null,'limit':_0x28493b['options']?_0x28493b[_0xa51e('0x18')]['limit']||null:null,'include':_0x28493b[_0xa51e('0x18')]?_0x28493b[_0xa51e('0x18')][_0xa51e('0x1a')]?_[_0xa51e('0x1b')](_0x28493b[_0xa51e('0x18')]['include'],function(_0x4f18f4){return{'model':db[_0x4f18f4[_0xa51e('0x1c')]],'as':_0x4f18f4['as'],'attributes':_0x4f18f4[_0xa51e('0x1d')],'include':_0x4f18f4[_0xa51e('0x1a')]?_['map'](_0x4f18f4[_0xa51e('0x1a')],function(_0x546b7e){return{'model':db[_0x546b7e[_0xa51e('0x1c')]],'as':_0x546b7e['as'],'attributes':_0x546b7e[_0xa51e('0x1d')],'include':_0x546b7e[_0xa51e('0x1a')]?_['map'](_0x546b7e[_0xa51e('0x1a')],function(_0x22030e){return{'model':db[_0x22030e['model']],'as':_0x22030e['as'],'attributes':_0x22030e[_0xa51e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ee6aa){logger[_0xa51e('0xd')](_0xa51e('0x16'),_0x28493b);logger['debug'](_0xa51e('0x16'),_0x28493b,JSON[_0xa51e('0x1e')](_0x3ee6aa));_0x2adadc(_0x3ee6aa);})[_0xa51e('0x1f')](function(_0x5d6ea3){logger[_0xa51e('0x11')](_0xa51e('0x16'),_0x5d6ea3[_0xa51e('0x14')],_0x28493b);_0x282b51(_0x37c61e[_0xa51e('0x11')](0x1f4,_0x5d6ea3[_0xa51e('0x14')]));});});};exports[_0xa51e('0x20')]=function(_0x219d6d){var _0x54f789=this;return new Promise(function(_0x2b8a67,_0x3eaaa7){return db[_0xa51e('0x17')][_0xa51e('0x21')]({'raw':_0x219d6d[_0xa51e('0x18')]?_0x219d6d['options']['raw']===undefined?!![]:![]:!![],'where':_0x219d6d[_0xa51e('0x18')]?_0x219d6d['options'][_0xa51e('0x22')]||null:null,'attributes':_0x219d6d[_0xa51e('0x18')]?_0x219d6d['options'][_0xa51e('0x1d')]||null:null,'include':_0x219d6d[_0xa51e('0x18')]?_0x219d6d['options']['include']?_[_0xa51e('0x1b')](_0x219d6d[_0xa51e('0x18')][_0xa51e('0x1a')],function(_0x34e5a0){return{'model':db[_0x34e5a0[_0xa51e('0x1c')]],'as':_0x34e5a0['as'],'attributes':_0x34e5a0[_0xa51e('0x1d')],'include':_0x34e5a0[_0xa51e('0x1a')]?_[_0xa51e('0x1b')](_0x34e5a0['include'],function(_0x1f7d0b){return{'model':db[_0x1f7d0b[_0xa51e('0x1c')]],'as':_0x1f7d0b['as'],'attributes':_0x1f7d0b[_0xa51e('0x1d')],'include':_0x1f7d0b['include']?_[_0xa51e('0x1b')](_0x1f7d0b[_0xa51e('0x1a')],function(_0x430d86){return{'model':db[_0x430d86[_0xa51e('0x1c')]],'as':_0x430d86['as'],'attributes':_0x430d86['attributes']};}):[]};}):[]};}):[]:[]})[_0xa51e('0xc')](function(_0x5279f1){logger['info'](_0xa51e('0x20'),_0x219d6d);logger[_0xa51e('0xf')](_0xa51e('0x20'),_0x219d6d,JSON['stringify'](_0x5279f1));_0x2b8a67(_0x5279f1);})[_0xa51e('0x1f')](function(_0x83171){logger[_0xa51e('0x11')]('ShowSugarcrmAccount',_0x83171[_0xa51e('0x14')],_0x219d6d);_0x3eaaa7(_0x54f789[_0xa51e('0x11')](0x1f4,_0x83171[_0xa51e('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index d556836..3def4f9 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 _0x6bc6=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports'];(function(_0x52dfb6,_0xd5f97){var _0x45d9e9=function(_0x35ff42){while(--_0x35ff42){_0x52dfb6['push'](_0x52dfb6['shift']());}};_0x45d9e9(++_0xd5f97);}(_0x6bc6,0x1b0));var _0x66bc=function(_0x7185f7,_0x37065){_0x7185f7=_0x7185f7-0x0;var _0x182e45=_0x6bc6[_0x7185f7];return _0x182e45;};'use strict';var multer=require('multer');var util=require(_0x66bc('0x0'));var path=require(_0x66bc('0x1'));var timeout=require(_0x66bc('0x2'));var express=require(_0x66bc('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x66bc('0x4'));var interaction=require(_0x66bc('0x5'));var config=require(_0x66bc('0x6'));var controller=require('./intSugarcrmConfiguration.controller');router[_0x66bc('0x7')]('/',auth[_0x66bc('0x8')](),controller[_0x66bc('0x9')]);router['get'](_0x66bc('0xa'),auth[_0x66bc('0x8')](),controller['show']);router[_0x66bc('0x7')](_0x66bc('0xb'),auth[_0x66bc('0x8')](),controller[_0x66bc('0xc')]);router[_0x66bc('0x7')](_0x66bc('0xd'),auth[_0x66bc('0x8')](),controller[_0x66bc('0xe')]);router['get'](_0x66bc('0xf'),auth[_0x66bc('0x8')](),controller[_0x66bc('0x10')]);router[_0x66bc('0x11')]('/',auth[_0x66bc('0x8')](),controller[_0x66bc('0x12')]);router[_0x66bc('0x13')](_0x66bc('0xa'),auth[_0x66bc('0x8')](),controller[_0x66bc('0x14')]);router[_0x66bc('0x15')]('/:id',auth[_0x66bc('0x8')](),controller[_0x66bc('0x16')]);module[_0x66bc('0x17')]=router; \ No newline at end of file +var _0x692a=['util','path','connect-timeout','fs-extra','./intSugarcrmConfiguration.controller','get','index','show','/:id/fields','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','update','delete','/:id','exports'];(function(_0x5e2888,_0x4655bb){var _0x7a6bd=function(_0x516e97){while(--_0x516e97){_0x5e2888['push'](_0x5e2888['shift']());}};_0x7a6bd(++_0x4655bb);}(_0x692a,0x1cc));var _0xa692=function(_0x3ee126,_0x55bfc4){_0x3ee126=_0x3ee126-0x0;var _0x3e9ad1=_0x692a[_0x3ee126];return _0x3e9ad1;};'use strict';var multer=require('multer');var util=require(_0xa692('0x0'));var path=require(_0xa692('0x1'));var timeout=require(_0xa692('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa692('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa692('0x4'));router[_0xa692('0x5')]('/',auth['isAuthenticated'](),controller[_0xa692('0x6')]);router[_0xa692('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xa692('0x7')]);router[_0xa692('0x5')](_0xa692('0x8'),auth['isAuthenticated'](),controller[_0xa692('0x9')]);router[_0xa692('0x5')]('/:id/subjects',auth[_0xa692('0xa')](),controller[_0xa692('0xb')]);router[_0xa692('0x5')](_0xa692('0xc'),auth[_0xa692('0xa')](),controller[_0xa692('0xd')]);router[_0xa692('0xe')]('/',auth[_0xa692('0xa')](),controller[_0xa692('0xf')]);router['put']('/:id',auth[_0xa692('0xa')](),controller[_0xa692('0x10')]);router[_0xa692('0x11')](_0xa692('0x12'),auth[_0xa692('0xa')](),controller['destroy']);module[_0xa692('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 0ec9e51..717dde1 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 _0x2d78=['exports','STRING','sequelize'];(function(_0x3bad64,_0x42849c){var _0x5826fc=function(_0x1aed69){while(--_0x1aed69){_0x3bad64['push'](_0x3bad64['shift']());}};_0x5826fc(++_0x42849c);}(_0x2d78,0xd1));var _0x82d7=function(_0x3dee92,_0x55e1eb){_0x3dee92=_0x3dee92-0x0;var _0x44d36e=_0x2d78[_0x3dee92];return _0x44d36e;};'use strict';var Sequelize=require(_0x82d7('0x0'));module[_0x82d7('0x1')]={'name':{'type':Sequelize[_0x82d7('0x2')]},'description':{'type':Sequelize[_0x82d7('0x2')]}}; \ No newline at end of file +var _0x4093=['STRING','sequelize','exports'];(function(_0x4a0254,_0x297198){var _0x375711=function(_0x545077){while(--_0x545077){_0x4a0254['push'](_0x4a0254['shift']());}};_0x375711(++_0x297198);}(_0x4093,0x184));var _0x3409=function(_0x586d28,_0x2a8ce3){_0x586d28=_0x586d28-0x0;var _0x73246b=_0x4093[_0x586d28];return _0x73246b;};'use strict';var Sequelize=require(_0x3409('0x0'));module[_0x3409('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3409('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 78bbea9..501f058 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 _0x6580=['getFields','findOne','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','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/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','SugarcrmConfiguration','includeAll','include','findAll','show','params','keys','options','find','catch','create','update','body','destroy'];(function(_0x5372e6,_0x2eea2d){var _0x56a815=function(_0x1c27d8){while(--_0x1c27d8){_0x5372e6['push'](_0x5372e6['shift']());}};_0x56a815(++_0x2eea2d);}(_0x6580,0x1a9));var _0x0658=function(_0x59cf32,_0x2b2956){_0x59cf32=_0x59cf32-0x0;var _0x163db4=_0x6580[_0x59cf32];return _0x163db4;};'use strict';var emlformat=require(_0x0658('0x0'));var rimraf=require(_0x0658('0x1'));var zipdir=require(_0x0658('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0658('0x3'));var moment=require(_0x0658('0x4'));var BPromise=require(_0x0658('0x5'));var Mustache=require(_0x0658('0x6'));var util=require(_0x0658('0x7'));var path=require(_0x0658('0x8'));var sox=require('sox');var csv=require(_0x0658('0x9'));var ejs=require(_0x0658('0xa'));var fs=require('fs');var fs_extra=require(_0x0658('0xb'));var _=require('lodash');var squel=require(_0x0658('0xc'));var crypto=require(_0x0658('0xd'));var jsforce=require(_0x0658('0xe'));var deskjs=require(_0x0658('0xf'));var toCsv=require(_0x0658('0x9'));var querystring=require(_0x0658('0x10'));var Papa=require(_0x0658('0x11'));var Redis=require('ioredis');var authService=require(_0x0658('0x12'));var qs=require(_0x0658('0x13'));var as=require(_0x0658('0x14'));var hardwareService=require(_0x0658('0x15'));var logger=require(_0x0658('0x16'))(_0x0658('0x17'));var utils=require(_0x0658('0x18'));var config=require(_0x0658('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a5e9f,_0x5951a9){_0x5951a9=_0x5951a9||0xcc;return function(_0x23fff1){if(_0x23fff1){return _0x3a5e9f[_0x0658('0x1a')](_0x5951a9);}return _0x3a5e9f[_0x0658('0x1b')](_0x5951a9)[_0x0658('0x1c')]();};}function respondWithResult(_0x22345c,_0x31d9f0){_0x31d9f0=_0x31d9f0||0xc8;return function(_0x102b02){if(_0x102b02){return _0x22345c[_0x0658('0x1b')](_0x31d9f0)[_0x0658('0x1d')](_0x102b02);}};}function respondWithFilteredResult(_0x2413d8,_0x1b4ee8){return function(_0xf35f10){if(_0xf35f10){var _0x20d3d3=typeof _0x1b4ee8[_0x0658('0x1e')]===_0x0658('0x1f')&&typeof _0x1b4ee8['limit']===_0x0658('0x1f');var _0x3972ed=_0xf35f10[_0x0658('0x20')];var _0x398807=_0x20d3d3?0x0:_0x1b4ee8[_0x0658('0x1e')];var _0x43b0cb=_0x20d3d3?_0xf35f10[_0x0658('0x20')]:_0x1b4ee8[_0x0658('0x1e')]+_0x1b4ee8[_0x0658('0x21')];var _0x4abc72;if(_0x43b0cb>=_0x3972ed){_0x43b0cb=_0x3972ed;_0x4abc72=0xc8;}else{_0x4abc72=0xce;}_0x2413d8[_0x0658('0x1b')](_0x4abc72);return _0x2413d8[_0x0658('0x22')](_0x0658('0x23'),_0x398807+'-'+_0x43b0cb+'/'+_0x3972ed)[_0x0658('0x1d')](_0xf35f10);}return null;};}function patchUpdates(_0x2bb0b4){return function(_0x4be16a){try{jsonpatch[_0x0658('0x24')](_0x4be16a,_0x2bb0b4,!![]);}catch(_0x259375){return BPromise['reject'](_0x259375);}return _0x4be16a[_0x0658('0x25')]();};}function saveUpdates(_0x49e9f0,_0x398430){return function(_0x3f0c87){if(_0x3f0c87){return _0x3f0c87['update'](_0x49e9f0)[_0x0658('0x26')](function(_0x1be9ef){return _0x1be9ef;});}return null;};}function removeEntity(_0x5b0b8b,_0x44c9e7){return function(_0x51e3c9){if(_0x51e3c9){return _0x51e3c9['destroy']()[_0x0658('0x26')](function(){_0x5b0b8b[_0x0658('0x1b')](0xcc)[_0x0658('0x1c')]();});}};}function handleEntityNotFound(_0x3e375a,_0x23dc57){return function(_0x1e011e){if(!_0x1e011e){_0x3e375a[_0x0658('0x1a')](0x194);}return _0x1e011e;};}function handleError(_0x412076,_0x222e65){_0x222e65=_0x222e65||0x1f4;return function(_0xc7cc4d){logger[_0x0658('0x27')](_0xc7cc4d[_0x0658('0x28')]);if(_0xc7cc4d[_0x0658('0x29')]){delete _0xc7cc4d[_0x0658('0x29')];}_0x412076['status'](_0x222e65)[_0x0658('0x2a')](_0xc7cc4d);};}exports[_0x0658('0x2b')]=function(_0x1c4995,_0x472b58){var _0x228ff9={},_0x5158a4={},_0x107b2b={'count':0x0,'rows':[]};var _0x1fd05e=_['map'](db['SugarcrmConfiguration'][_0x0658('0x2c')],function(_0xe6e296){return{'name':_0xe6e296[_0x0658('0x2d')],'type':_0xe6e296[_0x0658('0x2e')][_0x0658('0x2f')]};});_0x5158a4[_0x0658('0x30')]=_[_0x0658('0x31')](_0x1fd05e,_0x0658('0x29'));_0x5158a4[_0x0658('0x32')]=_['keys'](_0x1c4995['query']);_0x5158a4[_0x0658('0x33')]=_['intersection'](_0x5158a4[_0x0658('0x30')],_0x5158a4[_0x0658('0x32')]);_0x228ff9[_0x0658('0x34')]=_[_0x0658('0x35')](_0x5158a4[_0x0658('0x30')],qs[_0x0658('0x36')](_0x1c4995[_0x0658('0x32')][_0x0658('0x36')]));_0x228ff9['attributes']=_0x228ff9[_0x0658('0x34')][_0x0658('0x37')]?_0x228ff9[_0x0658('0x34')]:_0x5158a4['model'];if(!_0x1c4995[_0x0658('0x32')][_0x0658('0x38')](_0x0658('0x39'))){_0x228ff9[_0x0658('0x21')]=qs[_0x0658('0x21')](_0x1c4995[_0x0658('0x32')][_0x0658('0x21')]);_0x228ff9[_0x0658('0x1e')]=qs[_0x0658('0x1e')](_0x1c4995[_0x0658('0x32')]['offset']);}_0x228ff9[_0x0658('0x3a')]=qs[_0x0658('0x3b')](_0x1c4995[_0x0658('0x32')][_0x0658('0x3b')]);_0x228ff9['where']=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x1c4995[_0x0658('0x32')],_0x5158a4[_0x0658('0x33')]),_0x1fd05e);if(_0x1c4995[_0x0658('0x32')][_0x0658('0x3d')]){_0x228ff9[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x228ff9[_0x0658('0x3e')],{'$or':_[_0x0658('0x31')](_0x1fd05e,function(_0x754d88){if(_0x754d88['type']!==_0x0658('0x40')){var _0x20268b={};_0x20268b[_0x754d88[_0x0658('0x29')]]={'$like':'%'+_0x1c4995[_0x0658('0x32')]['filter']+'%'};return _0x20268b;}})});}_0x228ff9=_['merge']({},_0x228ff9,_0x1c4995['options']);var _0x5e30d4={'where':_0x228ff9['where']};return db[_0x0658('0x41')][_0x0658('0x20')](_0x5e30d4)[_0x0658('0x26')](function(_0x49f3e5){_0x107b2b['count']=_0x49f3e5;if(_0x1c4995[_0x0658('0x32')][_0x0658('0x42')]){_0x228ff9[_0x0658('0x43')]=[{'all':!![]}];}return db[_0x0658('0x41')][_0x0658('0x44')](_0x228ff9);})[_0x0658('0x26')](function(_0x4851a0){_0x107b2b['rows']=_0x4851a0;return _0x107b2b;})[_0x0658('0x26')](respondWithFilteredResult(_0x472b58,_0x228ff9))['catch'](handleError(_0x472b58,null));};exports[_0x0658('0x45')]=function(_0x37aaf8,_0x11bf19){var _0x153fdf={'raw':![],'where':{'id':_0x37aaf8[_0x0658('0x46')]['id']}},_0x1efb6f={};_0x1efb6f[_0x0658('0x30')]=_[_0x0658('0x47')](db['SugarcrmConfiguration'][_0x0658('0x2c')]);_0x1efb6f[_0x0658('0x32')]=_['keys'](_0x37aaf8[_0x0658('0x32')]);_0x1efb6f['filters']=_['intersection'](_0x1efb6f[_0x0658('0x30')],_0x1efb6f[_0x0658('0x32')]);_0x153fdf['attributes']=_[_0x0658('0x35')](_0x1efb6f[_0x0658('0x30')],qs[_0x0658('0x36')](_0x37aaf8[_0x0658('0x32')][_0x0658('0x36')]));_0x153fdf[_0x0658('0x34')]=_0x153fdf['attributes'][_0x0658('0x37')]?_0x153fdf[_0x0658('0x34')]:_0x1efb6f[_0x0658('0x30')];if(_0x37aaf8[_0x0658('0x32')][_0x0658('0x42')]){_0x153fdf[_0x0658('0x43')]=[{'all':!![]}];}_0x153fdf=_[_0x0658('0x3f')]({},_0x153fdf,_0x37aaf8[_0x0658('0x48')]);return db[_0x0658('0x41')][_0x0658('0x49')](_0x153fdf)['then'](handleEntityNotFound(_0x11bf19,null))[_0x0658('0x26')](respondWithResult(_0x11bf19,null))[_0x0658('0x4a')](handleError(_0x11bf19,null));};exports[_0x0658('0x4b')]=function(_0x36a7cc,_0x3f914b){return db[_0x0658('0x41')][_0x0658('0x4b')](_0x36a7cc['body'],{})['then'](respondWithResult(_0x3f914b,0xc9))[_0x0658('0x4a')](handleError(_0x3f914b,null));};exports[_0x0658('0x4c')]=function(_0x15181c,_0x23d62c){if(_0x15181c[_0x0658('0x4d')]['id']){delete _0x15181c[_0x0658('0x4d')]['id'];}return db[_0x0658('0x41')][_0x0658('0x49')]({'where':{'id':_0x15181c[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x23d62c,null))['then'](saveUpdates(_0x15181c[_0x0658('0x4d')],null))[_0x0658('0x26')](respondWithResult(_0x23d62c,null))[_0x0658('0x4a')](handleError(_0x23d62c,null));};exports[_0x0658('0x4e')]=function(_0x2125f9,_0x4783bc){return db[_0x0658('0x41')]['find']({'where':{'id':_0x2125f9[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x4783bc,null))[_0x0658('0x26')](removeEntity(_0x4783bc,null))[_0x0658('0x4a')](handleError(_0x4783bc,null));};exports[_0x0658('0x4f')]=function(_0x400947,_0x274b68,_0x32e158){var _0x2c1dca={};var _0x44863d={};var _0x2f6223;var _0x3ef448;return db['SugarcrmConfiguration'][_0x0658('0x50')]({'where':{'id':_0x400947[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x274b68,null))['then'](function(_0x4ecd4f){if(_0x4ecd4f){_0x2f6223=_0x4ecd4f;_0x44863d[_0x0658('0x30')]=_[_0x0658('0x47')](db[_0x0658('0x51')][_0x0658('0x2c')]);_0x44863d[_0x0658('0x32')]=_[_0x0658('0x47')](_0x400947['query']);_0x44863d[_0x0658('0x33')]=_[_0x0658('0x35')](_0x44863d[_0x0658('0x30')],_0x44863d[_0x0658('0x32')]);_0x2c1dca[_0x0658('0x34')]=_['intersection'](_0x44863d[_0x0658('0x30')],qs[_0x0658('0x36')](_0x400947[_0x0658('0x32')][_0x0658('0x36')]));_0x2c1dca['attributes']=_0x2c1dca[_0x0658('0x34')]['length']?_0x2c1dca[_0x0658('0x34')]:_0x44863d[_0x0658('0x30')];_0x2c1dca[_0x0658('0x3a')]=qs[_0x0658('0x3b')](_0x400947[_0x0658('0x32')][_0x0658('0x3b')]);_0x2c1dca['where']=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x400947[_0x0658('0x32')],_0x44863d['filters']));if(_0x400947[_0x0658('0x32')][_0x0658('0x3d')]){_0x2c1dca[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x2c1dca[_0x0658('0x3e')],{'$or':_[_0x0658('0x31')](_0x2c1dca[_0x0658('0x34')],function(_0x29523a){var _0x3fc269={};_0x3fc269[_0x29523a]={'$like':'%'+_0x400947[_0x0658('0x32')][_0x0658('0x3d')]+'%'};return _0x3fc269;})});}_0x2c1dca=_[_0x0658('0x3f')]({},_0x2c1dca,_0x400947[_0x0658('0x48')]);return _0x2f6223[_0x0658('0x4f')](_0x2c1dca);}})['then'](function(_0x573e78){if(_0x573e78){_0x3ef448=_0x573e78[_0x0658('0x37')];if(!_0x400947[_0x0658('0x32')][_0x0658('0x38')]('nolimit')){_0x2c1dca[_0x0658('0x21')]=qs[_0x0658('0x21')](_0x400947[_0x0658('0x32')][_0x0658('0x21')]);_0x2c1dca[_0x0658('0x1e')]=qs[_0x0658('0x1e')](_0x400947['query']['offset']);}return _0x2f6223[_0x0658('0x4f')](_0x2c1dca);}})['then'](function(_0x36a116){if(_0x36a116){return _0x36a116?{'count':_0x3ef448,'rows':_0x36a116}:null;}})[_0x0658('0x26')](respondWithResult(_0x274b68,null))[_0x0658('0x4a')](handleError(_0x274b68,null));};exports[_0x0658('0x52')]=function(_0x329055,_0x1278d5,_0x26e3e4){var _0x1509d1={};var _0x21f958={};var _0x4a1e75;var _0x290130;return db[_0x0658('0x41')][_0x0658('0x50')]({'where':{'id':_0x329055['params']['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x1278d5,null))['then'](function(_0x5be106){if(_0x5be106){_0x4a1e75=_0x5be106;_0x21f958[_0x0658('0x30')]=_[_0x0658('0x47')](db[_0x0658('0x51')]['rawAttributes']);_0x21f958['query']=_[_0x0658('0x47')](_0x329055[_0x0658('0x32')]);_0x21f958[_0x0658('0x33')]=_[_0x0658('0x35')](_0x21f958[_0x0658('0x30')],_0x21f958[_0x0658('0x32')]);_0x1509d1[_0x0658('0x34')]=_[_0x0658('0x35')](_0x21f958['model'],qs[_0x0658('0x36')](_0x329055[_0x0658('0x32')]['fields']));_0x1509d1['attributes']=_0x1509d1['attributes'][_0x0658('0x37')]?_0x1509d1[_0x0658('0x34')]:_0x21f958[_0x0658('0x30')];_0x1509d1['order']=qs[_0x0658('0x3b')](_0x329055['query'][_0x0658('0x3b')]);_0x1509d1[_0x0658('0x3e')]=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x329055[_0x0658('0x32')],_0x21f958['filters']));if(_0x329055['query'][_0x0658('0x3d')]){_0x1509d1[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x1509d1[_0x0658('0x3e')],{'$or':_[_0x0658('0x31')](_0x1509d1[_0x0658('0x34')],function(_0x2eeb7f){var _0x496e00={};_0x496e00[_0x2eeb7f]={'$like':'%'+_0x329055['query'][_0x0658('0x3d')]+'%'};return _0x496e00;})});}_0x1509d1=_[_0x0658('0x3f')]({},_0x1509d1,_0x329055[_0x0658('0x48')]);return _0x4a1e75[_0x0658('0x52')](_0x1509d1);}})[_0x0658('0x26')](function(_0x414f68){if(_0x414f68){_0x290130=_0x414f68[_0x0658('0x37')];if(!_0x329055[_0x0658('0x32')][_0x0658('0x38')](_0x0658('0x39'))){_0x1509d1['limit']=qs[_0x0658('0x21')](_0x329055[_0x0658('0x32')]['limit']);_0x1509d1['offset']=qs[_0x0658('0x1e')](_0x329055[_0x0658('0x32')][_0x0658('0x1e')]);}return _0x4a1e75[_0x0658('0x52')](_0x1509d1);}})[_0x0658('0x26')](function(_0x5bf03e){if(_0x5bf03e){return _0x5bf03e?{'count':_0x290130,'rows':_0x5bf03e}:null;}})[_0x0658('0x26')](respondWithResult(_0x1278d5,null))[_0x0658('0x4a')](handleError(_0x1278d5,null));};exports[_0x0658('0x53')]=function(_0x32defe,_0x43ad4d,_0x763b5c){var _0x1a4ad5={};var _0x17dbc3={};var _0x1f18ca;var _0x2a20de;return db['SugarcrmConfiguration'][_0x0658('0x50')]({'where':{'id':_0x32defe[_0x0658('0x46')]['id']}})[_0x0658('0x26')](handleEntityNotFound(_0x43ad4d,null))[_0x0658('0x26')](function(_0x450663){if(_0x450663){_0x1f18ca=_0x450663;_0x17dbc3['model']=_[_0x0658('0x47')](db[_0x0658('0x51')][_0x0658('0x2c')]);_0x17dbc3[_0x0658('0x32')]=_[_0x0658('0x47')](_0x32defe[_0x0658('0x32')]);_0x17dbc3[_0x0658('0x33')]=_['intersection'](_0x17dbc3[_0x0658('0x30')],_0x17dbc3['query']);_0x1a4ad5[_0x0658('0x34')]=_[_0x0658('0x35')](_0x17dbc3[_0x0658('0x30')],qs[_0x0658('0x36')](_0x32defe[_0x0658('0x32')]['fields']));_0x1a4ad5[_0x0658('0x34')]=_0x1a4ad5[_0x0658('0x34')]['length']?_0x1a4ad5[_0x0658('0x34')]:_0x17dbc3[_0x0658('0x30')];_0x1a4ad5[_0x0658('0x3a')]=qs[_0x0658('0x3b')](_0x32defe[_0x0658('0x32')][_0x0658('0x3b')]);_0x1a4ad5[_0x0658('0x3e')]=qs[_0x0658('0x33')](_[_0x0658('0x3c')](_0x32defe['query'],_0x17dbc3['filters']));if(_0x32defe[_0x0658('0x32')][_0x0658('0x3d')]){_0x1a4ad5[_0x0658('0x3e')]=_[_0x0658('0x3f')](_0x1a4ad5['where'],{'$or':_[_0x0658('0x31')](_0x1a4ad5[_0x0658('0x34')],function(_0x41805d){var _0x2a2003={};_0x2a2003[_0x41805d]={'$like':'%'+_0x32defe[_0x0658('0x32')][_0x0658('0x3d')]+'%'};return _0x2a2003;})});}_0x1a4ad5=_['merge']({},_0x1a4ad5,_0x32defe[_0x0658('0x48')]);return _0x1f18ca[_0x0658('0x53')](_0x1a4ad5);}})['then'](function(_0x198d0c){if(_0x198d0c){_0x2a20de=_0x198d0c[_0x0658('0x37')];if(!_0x32defe[_0x0658('0x32')][_0x0658('0x38')](_0x0658('0x39'))){_0x1a4ad5[_0x0658('0x21')]=qs[_0x0658('0x21')](_0x32defe[_0x0658('0x32')][_0x0658('0x21')]);_0x1a4ad5[_0x0658('0x1e')]=qs['offset'](_0x32defe['query']['offset']);}return _0x1f18ca[_0x0658('0x53')](_0x1a4ad5);}})[_0x0658('0x26')](function(_0x447ed2){if(_0x447ed2){return _0x447ed2?{'count':_0x2a20de,'rows':_0x447ed2}:null;}})['then'](respondWithResult(_0x43ad4d,null))[_0x0658('0x4a')](handleError(_0x43ad4d,null));}; \ No newline at end of file +var _0xef38=['keys','intersection','attributes','length','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','count','then','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','find','create','body','getFields','SugarcrmField','order','sort','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','destroy','stack','name','send','index','SugarcrmConfiguration','fieldName','type','model','map','query'];(function(_0x49a78d,_0x583818){var _0x3cccc7=function(_0xccfd5a){while(--_0xccfd5a){_0x49a78d['push'](_0x49a78d['shift']());}};_0x3cccc7(++_0x583818);}(_0xef38,0x111));var _0x8ef3=function(_0x5d5552,_0x381616){_0x5d5552=_0x5d5552-0x0;var _0x1e2ef7=_0xef38[_0x5d5552];return _0x1e2ef7;};'use strict';var emlformat=require(_0x8ef3('0x0'));var rimraf=require(_0x8ef3('0x1'));var zipdir=require(_0x8ef3('0x2'));var jsonpatch=require(_0x8ef3('0x3'));var rp=require('request-promise');var moment=require(_0x8ef3('0x4'));var BPromise=require(_0x8ef3('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ef3('0x6'));var sox=require(_0x8ef3('0x7'));var csv=require('to-csv');var ejs=require(_0x8ef3('0x8'));var fs=require('fs');var fs_extra=require(_0x8ef3('0x9'));var _=require(_0x8ef3('0xa'));var squel=require(_0x8ef3('0xb'));var crypto=require(_0x8ef3('0xc'));var jsforce=require(_0x8ef3('0xd'));var deskjs=require(_0x8ef3('0xe'));var toCsv=require(_0x8ef3('0xf'));var querystring=require(_0x8ef3('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8ef3('0x11'));var qs=require(_0x8ef3('0x12'));var as=require(_0x8ef3('0x13'));var hardwareService=require(_0x8ef3('0x14'));var logger=require(_0x8ef3('0x15'))(_0x8ef3('0x16'));var utils=require(_0x8ef3('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e1e5a,_0x469589){_0x469589=_0x469589||0xcc;return function(_0x3ea546){if(_0x3ea546){return _0x5e1e5a[_0x8ef3('0x18')](_0x469589);}return _0x5e1e5a[_0x8ef3('0x19')](_0x469589)[_0x8ef3('0x1a')]();};}function respondWithResult(_0x44a7b6,_0x5a0750){_0x5a0750=_0x5a0750||0xc8;return function(_0x452137){if(_0x452137){return _0x44a7b6['status'](_0x5a0750)[_0x8ef3('0x1b')](_0x452137);}};}function respondWithFilteredResult(_0x4b94fd,_0x5de47e){return function(_0x2dfabc){if(_0x2dfabc){var _0x4f4f1e=typeof _0x5de47e[_0x8ef3('0x1c')]==='undefined'&&typeof _0x5de47e[_0x8ef3('0x1d')]===_0x8ef3('0x1e');var _0x3e07c4=_0x2dfabc['count'];var _0x5c4960=_0x4f4f1e?0x0:_0x5de47e[_0x8ef3('0x1c')];var _0x18fd2f=_0x4f4f1e?_0x2dfabc['count']:_0x5de47e[_0x8ef3('0x1c')]+_0x5de47e[_0x8ef3('0x1d')];var _0x106d02;if(_0x18fd2f>=_0x3e07c4){_0x18fd2f=_0x3e07c4;_0x106d02=0xc8;}else{_0x106d02=0xce;}_0x4b94fd[_0x8ef3('0x19')](_0x106d02);return _0x4b94fd[_0x8ef3('0x1f')]('Content-Range',_0x5c4960+'-'+_0x18fd2f+'/'+_0x3e07c4)[_0x8ef3('0x1b')](_0x2dfabc);}return null;};}function patchUpdates(_0x360f83){return function(_0x5791b9){try{jsonpatch[_0x8ef3('0x20')](_0x5791b9,_0x360f83,!![]);}catch(_0x334c32){return BPromise[_0x8ef3('0x21')](_0x334c32);}return _0x5791b9[_0x8ef3('0x22')]();};}function saveUpdates(_0x16dfc6,_0x23d7fe){return function(_0x1aa172){if(_0x1aa172){return _0x1aa172[_0x8ef3('0x23')](_0x16dfc6)['then'](function(_0x3bcb3e){return _0x3bcb3e;});}return null;};}function removeEntity(_0xfc701e,_0x542a6f){return function(_0x2ef29d){if(_0x2ef29d){return _0x2ef29d[_0x8ef3('0x24')]()['then'](function(){_0xfc701e[_0x8ef3('0x19')](0xcc)[_0x8ef3('0x1a')]();});}};}function handleEntityNotFound(_0x3de419,_0x100e07){return function(_0x5707d0){if(!_0x5707d0){_0x3de419[_0x8ef3('0x18')](0x194);}return _0x5707d0;};}function handleError(_0x1a1b1e,_0x3f42d3){_0x3f42d3=_0x3f42d3||0x1f4;return function(_0x13a153){logger['error'](_0x13a153[_0x8ef3('0x25')]);if(_0x13a153['name']){delete _0x13a153[_0x8ef3('0x26')];}_0x1a1b1e[_0x8ef3('0x19')](_0x3f42d3)[_0x8ef3('0x27')](_0x13a153);};}exports[_0x8ef3('0x28')]=function(_0x2eed2,_0x38fcc7){var _0x301ebe={},_0x59ad16={},_0x16d430={'count':0x0,'rows':[]};var _0x58233c=_['map'](db[_0x8ef3('0x29')]['rawAttributes'],function(_0x2ae5f2){return{'name':_0x2ae5f2[_0x8ef3('0x2a')],'type':_0x2ae5f2[_0x8ef3('0x2b')]['key']};});_0x59ad16[_0x8ef3('0x2c')]=_[_0x8ef3('0x2d')](_0x58233c,_0x8ef3('0x26'));_0x59ad16[_0x8ef3('0x2e')]=_[_0x8ef3('0x2f')](_0x2eed2[_0x8ef3('0x2e')]);_0x59ad16['filters']=_[_0x8ef3('0x30')](_0x59ad16['model'],_0x59ad16['query']);_0x301ebe[_0x8ef3('0x31')]=_['intersection'](_0x59ad16[_0x8ef3('0x2c')],qs['fields'](_0x2eed2[_0x8ef3('0x2e')]['fields']));_0x301ebe[_0x8ef3('0x31')]=_0x301ebe[_0x8ef3('0x31')][_0x8ef3('0x32')]?_0x301ebe['attributes']:_0x59ad16[_0x8ef3('0x2c')];if(!_0x2eed2[_0x8ef3('0x2e')][_0x8ef3('0x33')](_0x8ef3('0x34'))){_0x301ebe[_0x8ef3('0x1d')]=qs[_0x8ef3('0x1d')](_0x2eed2[_0x8ef3('0x2e')][_0x8ef3('0x1d')]);_0x301ebe['offset']=qs[_0x8ef3('0x1c')](_0x2eed2[_0x8ef3('0x2e')]['offset']);}_0x301ebe['order']=qs['sort'](_0x2eed2[_0x8ef3('0x2e')]['sort']);_0x301ebe[_0x8ef3('0x35')]=qs[_0x8ef3('0x36')](_['pick'](_0x2eed2[_0x8ef3('0x2e')],_0x59ad16[_0x8ef3('0x36')]),_0x58233c);if(_0x2eed2[_0x8ef3('0x2e')][_0x8ef3('0x37')]){_0x301ebe['where']=_[_0x8ef3('0x38')](_0x301ebe[_0x8ef3('0x35')],{'$or':_[_0x8ef3('0x2d')](_0x58233c,function(_0x5527cf){if(_0x5527cf[_0x8ef3('0x2b')]!==_0x8ef3('0x39')){var _0x32b79f={};_0x32b79f[_0x5527cf['name']]={'$like':'%'+_0x2eed2[_0x8ef3('0x2e')]['filter']+'%'};return _0x32b79f;}})});}_0x301ebe=_[_0x8ef3('0x38')]({},_0x301ebe,_0x2eed2['options']);var _0x5c5b9b={'where':_0x301ebe['where']};return db['SugarcrmConfiguration'][_0x8ef3('0x3a')](_0x5c5b9b)[_0x8ef3('0x3b')](function(_0x4e2977){_0x16d430[_0x8ef3('0x3a')]=_0x4e2977;if(_0x2eed2[_0x8ef3('0x2e')][_0x8ef3('0x3c')]){_0x301ebe[_0x8ef3('0x3d')]=[{'all':!![]}];}return db[_0x8ef3('0x29')][_0x8ef3('0x3e')](_0x301ebe);})[_0x8ef3('0x3b')](function(_0x4292e3){_0x16d430['rows']=_0x4292e3;return _0x16d430;})[_0x8ef3('0x3b')](respondWithFilteredResult(_0x38fcc7,_0x301ebe))[_0x8ef3('0x3f')](handleError(_0x38fcc7,null));};exports[_0x8ef3('0x40')]=function(_0x9a0c9a,_0x31b246){var _0x202f35={'raw':![],'where':{'id':_0x9a0c9a[_0x8ef3('0x41')]['id']}},_0x88f102={};_0x88f102[_0x8ef3('0x2c')]=_['keys'](db[_0x8ef3('0x29')][_0x8ef3('0x42')]);_0x88f102[_0x8ef3('0x2e')]=_['keys'](_0x9a0c9a[_0x8ef3('0x2e')]);_0x88f102['filters']=_[_0x8ef3('0x30')](_0x88f102[_0x8ef3('0x2c')],_0x88f102[_0x8ef3('0x2e')]);_0x202f35['attributes']=_[_0x8ef3('0x30')](_0x88f102[_0x8ef3('0x2c')],qs['fields'](_0x9a0c9a['query'][_0x8ef3('0x43')]));_0x202f35[_0x8ef3('0x31')]=_0x202f35[_0x8ef3('0x31')][_0x8ef3('0x32')]?_0x202f35[_0x8ef3('0x31')]:_0x88f102[_0x8ef3('0x2c')];if(_0x9a0c9a[_0x8ef3('0x2e')]['includeAll']){_0x202f35[_0x8ef3('0x3d')]=[{'all':!![]}];}_0x202f35=_[_0x8ef3('0x38')]({},_0x202f35,_0x9a0c9a[_0x8ef3('0x44')]);return db[_0x8ef3('0x29')][_0x8ef3('0x45')](_0x202f35)[_0x8ef3('0x3b')](handleEntityNotFound(_0x31b246,null))['then'](respondWithResult(_0x31b246,null))[_0x8ef3('0x3f')](handleError(_0x31b246,null));};exports[_0x8ef3('0x46')]=function(_0x5eb97e,_0x2339be){return db[_0x8ef3('0x29')][_0x8ef3('0x46')](_0x5eb97e[_0x8ef3('0x47')],{})[_0x8ef3('0x3b')](respondWithResult(_0x2339be,0xc9))['catch'](handleError(_0x2339be,null));};exports['update']=function(_0x23f308,_0x2bbb2b){if(_0x23f308[_0x8ef3('0x47')]['id']){delete _0x23f308['body']['id'];}return db[_0x8ef3('0x29')][_0x8ef3('0x45')]({'where':{'id':_0x23f308['params']['id']}})[_0x8ef3('0x3b')](handleEntityNotFound(_0x2bbb2b,null))[_0x8ef3('0x3b')](saveUpdates(_0x23f308['body'],null))[_0x8ef3('0x3b')](respondWithResult(_0x2bbb2b,null))[_0x8ef3('0x3f')](handleError(_0x2bbb2b,null));};exports[_0x8ef3('0x24')]=function(_0x42712c,_0x53563c){return db[_0x8ef3('0x29')][_0x8ef3('0x45')]({'where':{'id':_0x42712c['params']['id']}})['then'](handleEntityNotFound(_0x53563c,null))[_0x8ef3('0x3b')](removeEntity(_0x53563c,null))[_0x8ef3('0x3f')](handleError(_0x53563c,null));};exports[_0x8ef3('0x48')]=function(_0x3e3931,_0x48ff7a,_0x20b2eb){var _0x509764={};var _0x422601={};var _0x38b6d6;var _0x269407;return db[_0x8ef3('0x29')]['findOne']({'where':{'id':_0x3e3931[_0x8ef3('0x41')]['id']}})['then'](handleEntityNotFound(_0x48ff7a,null))[_0x8ef3('0x3b')](function(_0x5daf87){if(_0x5daf87){_0x38b6d6=_0x5daf87;_0x422601[_0x8ef3('0x2c')]=_[_0x8ef3('0x2f')](db[_0x8ef3('0x49')]['rawAttributes']);_0x422601[_0x8ef3('0x2e')]=_['keys'](_0x3e3931[_0x8ef3('0x2e')]);_0x422601['filters']=_[_0x8ef3('0x30')](_0x422601['model'],_0x422601[_0x8ef3('0x2e')]);_0x509764[_0x8ef3('0x31')]=_['intersection'](_0x422601['model'],qs[_0x8ef3('0x43')](_0x3e3931['query'][_0x8ef3('0x43')]));_0x509764[_0x8ef3('0x31')]=_0x509764['attributes'][_0x8ef3('0x32')]?_0x509764[_0x8ef3('0x31')]:_0x422601[_0x8ef3('0x2c')];_0x509764[_0x8ef3('0x4a')]=qs[_0x8ef3('0x4b')](_0x3e3931[_0x8ef3('0x2e')][_0x8ef3('0x4b')]);_0x509764[_0x8ef3('0x35')]=qs[_0x8ef3('0x36')](_[_0x8ef3('0x4c')](_0x3e3931[_0x8ef3('0x2e')],_0x422601[_0x8ef3('0x36')]));if(_0x3e3931[_0x8ef3('0x2e')]['filter']){_0x509764[_0x8ef3('0x35')]=_[_0x8ef3('0x38')](_0x509764[_0x8ef3('0x35')],{'$or':_['map'](_0x509764[_0x8ef3('0x31')],function(_0x11eb05){var _0x14be80={};_0x14be80[_0x11eb05]={'$like':'%'+_0x3e3931['query']['filter']+'%'};return _0x14be80;})});}_0x509764=_[_0x8ef3('0x38')]({},_0x509764,_0x3e3931[_0x8ef3('0x44')]);return _0x38b6d6[_0x8ef3('0x48')](_0x509764);}})[_0x8ef3('0x3b')](function(_0x32f4b4){if(_0x32f4b4){_0x269407=_0x32f4b4[_0x8ef3('0x32')];if(!_0x3e3931[_0x8ef3('0x2e')][_0x8ef3('0x33')](_0x8ef3('0x34'))){_0x509764[_0x8ef3('0x1d')]=qs['limit'](_0x3e3931[_0x8ef3('0x2e')][_0x8ef3('0x1d')]);_0x509764[_0x8ef3('0x1c')]=qs[_0x8ef3('0x1c')](_0x3e3931[_0x8ef3('0x2e')][_0x8ef3('0x1c')]);}return _0x38b6d6[_0x8ef3('0x48')](_0x509764);}})[_0x8ef3('0x3b')](function(_0x2f7969){if(_0x2f7969){return _0x2f7969?{'count':_0x269407,'rows':_0x2f7969}:null;}})[_0x8ef3('0x3b')](respondWithResult(_0x48ff7a,null))['catch'](handleError(_0x48ff7a,null));};exports[_0x8ef3('0x4d')]=function(_0x28e1b2,_0x15814a,_0x2b7b62){var _0x40cade={};var _0x193826={};var _0x5de2d5;var _0x1a96df;return db[_0x8ef3('0x29')][_0x8ef3('0x4e')]({'where':{'id':_0x28e1b2[_0x8ef3('0x41')]['id']}})[_0x8ef3('0x3b')](handleEntityNotFound(_0x15814a,null))[_0x8ef3('0x3b')](function(_0x40474c){if(_0x40474c){_0x5de2d5=_0x40474c;_0x193826[_0x8ef3('0x2c')]=_[_0x8ef3('0x2f')](db[_0x8ef3('0x49')][_0x8ef3('0x42')]);_0x193826[_0x8ef3('0x2e')]=_['keys'](_0x28e1b2['query']);_0x193826[_0x8ef3('0x36')]=_['intersection'](_0x193826[_0x8ef3('0x2c')],_0x193826[_0x8ef3('0x2e')]);_0x40cade[_0x8ef3('0x31')]=_[_0x8ef3('0x30')](_0x193826[_0x8ef3('0x2c')],qs[_0x8ef3('0x43')](_0x28e1b2[_0x8ef3('0x2e')][_0x8ef3('0x43')]));_0x40cade[_0x8ef3('0x31')]=_0x40cade[_0x8ef3('0x31')][_0x8ef3('0x32')]?_0x40cade[_0x8ef3('0x31')]:_0x193826[_0x8ef3('0x2c')];_0x40cade[_0x8ef3('0x4a')]=qs[_0x8ef3('0x4b')](_0x28e1b2[_0x8ef3('0x2e')][_0x8ef3('0x4b')]);_0x40cade[_0x8ef3('0x35')]=qs[_0x8ef3('0x36')](_[_0x8ef3('0x4c')](_0x28e1b2['query'],_0x193826['filters']));if(_0x28e1b2[_0x8ef3('0x2e')]['filter']){_0x40cade[_0x8ef3('0x35')]=_[_0x8ef3('0x38')](_0x40cade[_0x8ef3('0x35')],{'$or':_[_0x8ef3('0x2d')](_0x40cade[_0x8ef3('0x31')],function(_0x9290ce){var _0x466a43={};_0x466a43[_0x9290ce]={'$like':'%'+_0x28e1b2[_0x8ef3('0x2e')][_0x8ef3('0x37')]+'%'};return _0x466a43;})});}_0x40cade=_['merge']({},_0x40cade,_0x28e1b2[_0x8ef3('0x44')]);return _0x5de2d5[_0x8ef3('0x4d')](_0x40cade);}})[_0x8ef3('0x3b')](function(_0xe91fef){if(_0xe91fef){_0x1a96df=_0xe91fef[_0x8ef3('0x32')];if(!_0x28e1b2[_0x8ef3('0x2e')]['hasOwnProperty']('nolimit')){_0x40cade[_0x8ef3('0x1d')]=qs['limit'](_0x28e1b2[_0x8ef3('0x2e')][_0x8ef3('0x1d')]);_0x40cade[_0x8ef3('0x1c')]=qs['offset'](_0x28e1b2[_0x8ef3('0x2e')][_0x8ef3('0x1c')]);}return _0x5de2d5[_0x8ef3('0x4d')](_0x40cade);}})['then'](function(_0x7bd7b8){if(_0x7bd7b8){return _0x7bd7b8?{'count':_0x1a96df,'rows':_0x7bd7b8}:null;}})[_0x8ef3('0x3b')](respondWithResult(_0x15814a,null))[_0x8ef3('0x3f')](handleError(_0x15814a,null));};exports[_0x8ef3('0x4f')]=function(_0x18aeb1,_0x85e3b2,_0x320bc2){var _0xd3ce66={};var _0xd160ae={};var _0x32bbcf;var _0x15672a;return db[_0x8ef3('0x29')][_0x8ef3('0x4e')]({'where':{'id':_0x18aeb1[_0x8ef3('0x41')]['id']}})['then'](handleEntityNotFound(_0x85e3b2,null))[_0x8ef3('0x3b')](function(_0x43eedf){if(_0x43eedf){_0x32bbcf=_0x43eedf;_0xd160ae[_0x8ef3('0x2c')]=_[_0x8ef3('0x2f')](db[_0x8ef3('0x49')][_0x8ef3('0x42')]);_0xd160ae[_0x8ef3('0x2e')]=_['keys'](_0x18aeb1['query']);_0xd160ae[_0x8ef3('0x36')]=_['intersection'](_0xd160ae[_0x8ef3('0x2c')],_0xd160ae[_0x8ef3('0x2e')]);_0xd3ce66['attributes']=_[_0x8ef3('0x30')](_0xd160ae[_0x8ef3('0x2c')],qs[_0x8ef3('0x43')](_0x18aeb1[_0x8ef3('0x2e')]['fields']));_0xd3ce66[_0x8ef3('0x31')]=_0xd3ce66[_0x8ef3('0x31')][_0x8ef3('0x32')]?_0xd3ce66[_0x8ef3('0x31')]:_0xd160ae[_0x8ef3('0x2c')];_0xd3ce66[_0x8ef3('0x4a')]=qs[_0x8ef3('0x4b')](_0x18aeb1['query'][_0x8ef3('0x4b')]);_0xd3ce66[_0x8ef3('0x35')]=qs['filters'](_[_0x8ef3('0x4c')](_0x18aeb1[_0x8ef3('0x2e')],_0xd160ae['filters']));if(_0x18aeb1[_0x8ef3('0x2e')]['filter']){_0xd3ce66['where']=_[_0x8ef3('0x38')](_0xd3ce66['where'],{'$or':_['map'](_0xd3ce66[_0x8ef3('0x31')],function(_0x5d20b7){var _0xd13b33={};_0xd13b33[_0x5d20b7]={'$like':'%'+_0x18aeb1['query'][_0x8ef3('0x37')]+'%'};return _0xd13b33;})});}_0xd3ce66=_['merge']({},_0xd3ce66,_0x18aeb1['options']);return _0x32bbcf[_0x8ef3('0x4f')](_0xd3ce66);}})[_0x8ef3('0x3b')](function(_0x41007d){if(_0x41007d){_0x15672a=_0x41007d['length'];if(!_0x18aeb1[_0x8ef3('0x2e')][_0x8ef3('0x33')]('nolimit')){_0xd3ce66[_0x8ef3('0x1d')]=qs[_0x8ef3('0x1d')](_0x18aeb1['query'][_0x8ef3('0x1d')]);_0xd3ce66[_0x8ef3('0x1c')]=qs['offset'](_0x18aeb1[_0x8ef3('0x2e')]['offset']);}return _0x32bbcf['getDescriptions'](_0xd3ce66);}})[_0x8ef3('0x3b')](function(_0x22bec2){if(_0x22bec2){return _0x22bec2?{'count':_0x15672a,'rows':_0x22bec2}:null;}})['then'](respondWithResult(_0x85e3b2,null))[_0x8ef3('0x3f')](handleError(_0x85e3b2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 798db87..aaeff88 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 _0x2113=['api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','util','../../config/logger'];(function(_0x5ab91c,_0x4d5085){var _0x4c1724=function(_0x2ebd4b){while(--_0x2ebd4b){_0x5ab91c['push'](_0x5ab91c['shift']());}};_0x4c1724(++_0x4d5085);}(_0x2113,0x166));var _0x3211=function(_0x4adb24,_0x1d8d9b){_0x4adb24=_0x4adb24-0x0;var _0x3dbaa3=_0x2113[_0x4adb24];return _0x3dbaa3;};'use strict';var _=require('lodash');var util=require(_0x3211('0x0'));var logger=require(_0x3211('0x1'))(_0x3211('0x2'));var moment=require(_0x3211('0x3'));var BPromise=require(_0x3211('0x4'));var rp=require(_0x3211('0x5'));var fs=require('fs');var path=require(_0x3211('0x6'));var rimraf=require('rimraf');var config=require(_0x3211('0x7'));var attributes=require(_0x3211('0x8'));module[_0x3211('0x9')]=function(_0x21d0c2,_0x241e75){return _0x21d0c2[_0x3211('0xa')](_0x3211('0xb'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccb3=['util','../../config/logger','api','bluebird','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','lodash'];(function(_0x3e3d07,_0x55edbe){var _0x5db814=function(_0x3d36b6){while(--_0x3d36b6){_0x3e3d07['push'](_0x3e3d07['shift']());}};_0x5db814(++_0x55edbe);}(_0xccb3,0xa4));var _0x3ccb=function(_0x190ff6,_0x515cfd){_0x190ff6=_0x190ff6-0x0;var _0x5356d2=_0xccb3[_0x190ff6];return _0x5356d2;};'use strict';var _=require(_0x3ccb('0x0'));var util=require(_0x3ccb('0x1'));var logger=require(_0x3ccb('0x2'))(_0x3ccb('0x3'));var moment=require('moment');var BPromise=require(_0x3ccb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ccb('0x5'));var rimraf=require('rimraf');var config=require(_0x3ccb('0x6'));var attributes=require(_0x3ccb('0x7'));module[_0x3ccb('0x8')]=function(_0x3863df,_0x2ba586){return _0x3863df[_0x3ccb('0x9')](_0x3ccb('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index bf85c21..992697b 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 _0x8423=['debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','request\x20sent'];(function(_0x22b53d,_0x38b652){var _0x593dee=function(_0x5cc69a){while(--_0x5cc69a){_0x22b53d['push'](_0x22b53d['shift']());}};_0x593dee(++_0x38b652);}(_0x8423,0x1ab));var _0x3842=function(_0x48c46a,_0xfe126d){_0x48c46a=_0x48c46a-0x0;var _0x465257=_0x8423[_0x48c46a];return _0x465257;};'use strict';var _=require(_0x3842('0x0'));var util=require(_0x3842('0x1'));var moment=require('moment');var BPromise=require(_0x3842('0x2'));var rs=require(_0x3842('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3842('0x4'))['db'];var utils=require(_0x3842('0x5'));var logger=require(_0x3842('0x6'))(_0x3842('0x7'));var config=require(_0x3842('0x8'));var jayson=require(_0x3842('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1ef861,_0x5a2c6e,_0x3c8051){return new BPromise(function(_0x3dfe82,_0x4f6d98){return client[_0x3842('0xa')](_0x1ef861,_0x3c8051)['then'](function(_0x225530){logger[_0x3842('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x5a2c6e,_0x3842('0xc'));logger[_0x3842('0xd')](_0x3842('0xe'),_0x5a2c6e,'request\x20sent',JSON[_0x3842('0xf')](_0x225530));if(_0x225530[_0x3842('0x10')]){if(_0x225530[_0x3842('0x10')][_0x3842('0x11')]===0x1f4){logger[_0x3842('0x10')](_0x3842('0x12'),_0x5a2c6e,_0x225530['error'][_0x3842('0x13')]);return _0x4f6d98(_0x225530[_0x3842('0x10')][_0x3842('0x13')]);}logger[_0x3842('0x10')](_0x3842('0x12'),_0x5a2c6e,_0x225530[_0x3842('0x10')][_0x3842('0x13')]);return _0x3dfe82(_0x225530[_0x3842('0x10')][_0x3842('0x13')]);}else{logger['info'](_0x3842('0x12'),_0x5a2c6e,_0x3842('0xc'));_0x3dfe82(_0x225530[_0x3842('0x14')][_0x3842('0x13')]);}})[_0x3842('0x15')](function(_0x1270e4){logger['error'](_0x3842('0x12'),_0x5a2c6e,_0x1270e4);_0x4f6d98(_0x1270e4);});});} \ No newline at end of file +var _0x518d=['request\x20sent','debug','SugarcrmConfiguration,\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','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s'];(function(_0x598e4d,_0xcc3632){var _0x131e18=function(_0x423a03){while(--_0x423a03){_0x598e4d['push'](_0x598e4d['shift']());}};_0x131e18(++_0xcc3632);}(_0x518d,0x1a0));var _0xd518=function(_0x35126e,_0x4a218b){_0x35126e=_0x35126e-0x0;var _0x2e4852=_0x518d[_0x35126e];return _0x2e4852;};'use strict';var _=require(_0xd518('0x0'));var util=require(_0xd518('0x1'));var moment=require(_0xd518('0x2'));var BPromise=require('bluebird');var rs=require(_0xd518('0x3'));var fs=require('fs');var Redis=require(_0xd518('0x4'));var db=require(_0xd518('0x5'))['db'];var utils=require(_0xd518('0x6'));var logger=require(_0xd518('0x7'))(_0xd518('0x8'));var config=require(_0xd518('0x9'));var jayson=require(_0xd518('0xa'));var client=jayson[_0xd518('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x92ce3d,_0x39c8ef,_0x3a48d1){return new BPromise(function(_0xcece1d,_0x53aabd){return client[_0xd518('0xc')](_0x92ce3d,_0x3a48d1)[_0xd518('0xd')](function(_0x212493){logger[_0xd518('0xe')](_0xd518('0xf'),_0x39c8ef,_0xd518('0x10'));logger[_0xd518('0x11')](_0xd518('0x12'),_0x39c8ef,'request\x20sent',JSON['stringify'](_0x212493));if(_0x212493[_0xd518('0x13')]){if(_0x212493['error'][_0xd518('0x14')]===0x1f4){logger['error'](_0xd518('0xf'),_0x39c8ef,_0x212493['error']['message']);return _0x53aabd(_0x212493[_0xd518('0x13')][_0xd518('0x15')]);}logger[_0xd518('0x13')](_0xd518('0xf'),_0x39c8ef,_0x212493[_0xd518('0x13')][_0xd518('0x15')]);return _0xcece1d(_0x212493[_0xd518('0x13')][_0xd518('0x15')]);}else{logger[_0xd518('0xe')](_0xd518('0xf'),_0x39c8ef,_0xd518('0x10'));_0xcece1d(_0x212493[_0xd518('0x16')][_0xd518('0x15')]);}})[_0xd518('0x17')](function(_0x420f95){logger['error'](_0xd518('0xf'),_0x39c8ef,_0x420f95);_0x53aabd(_0x420f95);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index aa8bc30..411f631 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 _0x76c6=['show','post','put','update','multer','path','express','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id'];(function(_0x602739,_0x12fc9d){var _0x584ef7=function(_0x223ea5){while(--_0x223ea5){_0x602739['push'](_0x602739['shift']());}};_0x584ef7(++_0x12fc9d);}(_0x76c6,0x1d5));var _0x676c=function(_0x238671,_0x34aea0){_0x238671=_0x238671-0x0;var _0x474844=_0x76c6[_0x238671];return _0x474844;};'use strict';var multer=require(_0x676c('0x0'));var util=require('util');var path=require(_0x676c('0x1'));var timeout=require('connect-timeout');var express=require(_0x676c('0x2'));var router=express[_0x676c('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x676c('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x676c('0x5'));var controller=require(_0x676c('0x6'));router[_0x676c('0x7')]('/',auth[_0x676c('0x8')](),controller[_0x676c('0x9')]);router[_0x676c('0x7')](_0x676c('0xa'),auth[_0x676c('0x8')](),controller[_0x676c('0xb')]);router[_0x676c('0xc')]('/',auth[_0x676c('0x8')](),controller['create']);router[_0x676c('0xd')](_0x676c('0xa'),auth[_0x676c('0x8')](),controller[_0x676c('0xe')]);router['delete'](_0x676c('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5de7=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','create','put','update'];(function(_0x467476,_0x2f0b20){var _0x26eb18=function(_0x5eb061){while(--_0x5eb061){_0x467476['push'](_0x467476['shift']());}};_0x26eb18(++_0x2f0b20);}(_0x5de7,0x134));var _0x75de=function(_0x3c56ac,_0xf36c6f){_0x3c56ac=_0x3c56ac-0x0;var _0x1059bb=_0x5de7[_0x3c56ac];return _0x1059bb;};'use strict';var multer=require(_0x75de('0x0'));var util=require(_0x75de('0x1'));var path=require(_0x75de('0x2'));var timeout=require(_0x75de('0x3'));var express=require('express');var router=express[_0x75de('0x4')]();var fs_extra=require(_0x75de('0x5'));var auth=require(_0x75de('0x6'));var interaction=require(_0x75de('0x7'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x75de('0x8')]('/',auth[_0x75de('0x9')](),controller[_0x75de('0xa')]);router[_0x75de('0x8')](_0x75de('0xb'),auth['isAuthenticated'](),controller[_0x75de('0xc')]);router['post']('/',auth[_0x75de('0x9')](),controller[_0x75de('0xd')]);router[_0x75de('0xe')](_0x75de('0xb'),auth[_0x75de('0x9')](),controller[_0x75de('0xf')]);router['delete']('/:id',auth[_0x75de('0x9')](),controller[_0x75de('0x10')]);module[_0x75de('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 5d12cb5..8fab546 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 _0x69db=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist'];(function(_0xc2e46e,_0x3b979c){var _0x1a355d=function(_0x2cd000){while(--_0x2cd000){_0xc2e46e['push'](_0xc2e46e['shift']());}};_0x1a355d(++_0x3b979c);}(_0x69db,0x110));var _0xb69d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x69db[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb69d('0x0'));module[_0xb69d('0x1')]={'type':{'type':Sequelize[_0xb69d('0x2')](_0xb69d('0x3'),_0xb69d('0x4'),'customVariable',_0xb69d('0x5'),_0xb69d('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb69d('0x7')]},'key':{'type':Sequelize[_0xb69d('0x7')]},'keyType':{'type':Sequelize[_0xb69d('0x2')](_0xb69d('0x3'),_0xb69d('0x4'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb69d('0x7')]},'nameField':{'type':Sequelize[_0xb69d('0x7')]},'customField':{'type':Sequelize[_0xb69d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbf9f=['ENUM','string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','exports'];(function(_0x47fa93,_0x5e1861){var _0x4f617c=function(_0x4e1f76){while(--_0x4e1f76){_0x47fa93['push'](_0x47fa93['shift']());}};_0x4f617c(++_0x5e1861);}(_0xbf9f,0xbb));var _0xfbf9=function(_0x29d3b9,_0x56e092){_0x29d3b9=_0x29d3b9-0x0;var _0x317f91=_0xbf9f[_0x29d3b9];return _0x317f91;};'use strict';var Sequelize=require(_0xfbf9('0x0'));module[_0xfbf9('0x1')]={'type':{'type':Sequelize[_0xfbf9('0x2')](_0xfbf9('0x3'),'variable',_0xfbf9('0x4'),_0xfbf9('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xfbf9('0x6')]},'keyType':{'type':Sequelize[_0xfbf9('0x2')](_0xfbf9('0x3'),_0xfbf9('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xfbf9('0x6')]},'idField':{'type':Sequelize[_0xfbf9('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xfbf9('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 183d91a..46ea68a 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 _0x3f56=['then','stack','name','index','SugarcrmField','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','update'];(function(_0x2a0e80,_0x379250){var _0x5a3500=function(_0x59248f){while(--_0x59248f){_0x2a0e80['push'](_0x2a0e80['shift']());}};_0x5a3500(++_0x379250);}(_0x3f56,0xb0));var _0x63f5=function(_0xc296f2,_0x18d9e3){_0xc296f2=_0xc296f2-0x0;var _0x58336b=_0x3f56[_0xc296f2];return _0x58336b;};'use strict';var emlformat=require(_0x63f5('0x0'));var rimraf=require(_0x63f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x63f5('0x2'));var rp=require(_0x63f5('0x3'));var moment=require('moment');var BPromise=require(_0x63f5('0x4'));var Mustache=require(_0x63f5('0x5'));var util=require(_0x63f5('0x6'));var path=require(_0x63f5('0x7'));var sox=require(_0x63f5('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x63f5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x63f5('0xa'));var deskjs=require(_0x63f5('0xb'));var toCsv=require(_0x63f5('0xc'));var querystring=require(_0x63f5('0xd'));var Papa=require('papaparse');var Redis=require(_0x63f5('0xe'));var authService=require(_0x63f5('0xf'));var qs=require(_0x63f5('0x10'));var as=require(_0x63f5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x63f5('0x12'));var utils=require(_0x63f5('0x13'));var config=require(_0x63f5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x63f5('0x15'))['db'];function respondWithStatusCode(_0x3d0b0a,_0x593805){_0x593805=_0x593805||0xcc;return function(_0x13d179){if(_0x13d179){return _0x3d0b0a[_0x63f5('0x16')](_0x593805);}return _0x3d0b0a['status'](_0x593805)[_0x63f5('0x17')]();};}function respondWithResult(_0x155e2e,_0x13f2b0){_0x13f2b0=_0x13f2b0||0xc8;return function(_0x569787){if(_0x569787){return _0x155e2e[_0x63f5('0x18')](_0x13f2b0)['json'](_0x569787);}};}function respondWithFilteredResult(_0x192429,_0x4802de){return function(_0x26e3c5){if(_0x26e3c5){var _0x8fa3b3=typeof _0x4802de[_0x63f5('0x19')]===_0x63f5('0x1a')&&typeof _0x4802de[_0x63f5('0x1b')]===_0x63f5('0x1a');var _0x26bc41=_0x26e3c5[_0x63f5('0x1c')];var _0x3c557e=_0x8fa3b3?0x0:_0x4802de[_0x63f5('0x19')];var _0x14de36=_0x8fa3b3?_0x26e3c5[_0x63f5('0x1c')]:_0x4802de['offset']+_0x4802de[_0x63f5('0x1b')];var _0x573a65;if(_0x14de36>=_0x26bc41){_0x14de36=_0x26bc41;_0x573a65=0xc8;}else{_0x573a65=0xce;}_0x192429[_0x63f5('0x18')](_0x573a65);return _0x192429[_0x63f5('0x1d')]('Content-Range',_0x3c557e+'-'+_0x14de36+'/'+_0x26bc41)[_0x63f5('0x1e')](_0x26e3c5);}return null;};}function patchUpdates(_0x16614f){return function(_0x25efa2){try{jsonpatch[_0x63f5('0x1f')](_0x25efa2,_0x16614f,!![]);}catch(_0xe81f27){return BPromise[_0x63f5('0x20')](_0xe81f27);}return _0x25efa2['save']();};}function saveUpdates(_0xdfa2c2,_0x2430b1){return function(_0x2c17c5){if(_0x2c17c5){return _0x2c17c5[_0x63f5('0x21')](_0xdfa2c2)['then'](function(_0x1983dd){return _0x1983dd;});}return null;};}function removeEntity(_0x24b5d3,_0x4521d4){return function(_0x5b1339){if(_0x5b1339){return _0x5b1339['destroy']()[_0x63f5('0x22')](function(){_0x24b5d3[_0x63f5('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c0c2c,_0x1baaf5){return function(_0x59c1e9){if(!_0x59c1e9){_0x2c0c2c[_0x63f5('0x16')](0x194);}return _0x59c1e9;};}function handleError(_0x592b81,_0x40382c){_0x40382c=_0x40382c||0x1f4;return function(_0x2b90bb){logger['error'](_0x2b90bb[_0x63f5('0x23')]);if(_0x2b90bb[_0x63f5('0x24')]){delete _0x2b90bb[_0x63f5('0x24')];}_0x592b81['status'](_0x40382c)['send'](_0x2b90bb);};}exports[_0x63f5('0x25')]=function(_0x34924b,_0x2b9323){var _0x29d126={},_0x3db3c9={},_0x5f3c36={'count':0x0,'rows':[]};var _0x562604=_['map'](db[_0x63f5('0x26')][_0x63f5('0x27')],function(_0x3b12a1){return{'name':_0x3b12a1[_0x63f5('0x28')],'type':_0x3b12a1[_0x63f5('0x29')]['key']};});_0x3db3c9[_0x63f5('0x2a')]=_[_0x63f5('0x2b')](_0x562604,_0x63f5('0x24'));_0x3db3c9[_0x63f5('0x2c')]=_[_0x63f5('0x2d')](_0x34924b[_0x63f5('0x2c')]);_0x3db3c9[_0x63f5('0x2e')]=_[_0x63f5('0x2f')](_0x3db3c9[_0x63f5('0x2a')],_0x3db3c9[_0x63f5('0x2c')]);_0x29d126[_0x63f5('0x30')]=_[_0x63f5('0x2f')](_0x3db3c9[_0x63f5('0x2a')],qs[_0x63f5('0x31')](_0x34924b[_0x63f5('0x2c')][_0x63f5('0x31')]));_0x29d126['attributes']=_0x29d126[_0x63f5('0x30')][_0x63f5('0x32')]?_0x29d126['attributes']:_0x3db3c9[_0x63f5('0x2a')];if(!_0x34924b[_0x63f5('0x2c')][_0x63f5('0x33')]('nolimit')){_0x29d126[_0x63f5('0x1b')]=qs['limit'](_0x34924b[_0x63f5('0x2c')]['limit']);_0x29d126['offset']=qs[_0x63f5('0x19')](_0x34924b['query'][_0x63f5('0x19')]);}_0x29d126[_0x63f5('0x34')]=qs[_0x63f5('0x35')](_0x34924b[_0x63f5('0x2c')][_0x63f5('0x35')]);_0x29d126[_0x63f5('0x36')]=qs['filters'](_[_0x63f5('0x37')](_0x34924b['query'],_0x3db3c9[_0x63f5('0x2e')]),_0x562604);if(_0x34924b[_0x63f5('0x2c')]['filter']){_0x29d126[_0x63f5('0x36')]=_[_0x63f5('0x38')](_0x29d126['where'],{'$or':_[_0x63f5('0x2b')](_0x562604,function(_0x496086){if(_0x496086[_0x63f5('0x29')]!==_0x63f5('0x39')){var _0x18c90d={};_0x18c90d[_0x496086[_0x63f5('0x24')]]={'$like':'%'+_0x34924b['query'][_0x63f5('0x3a')]+'%'};return _0x18c90d;}})});}_0x29d126=_[_0x63f5('0x38')]({},_0x29d126,_0x34924b[_0x63f5('0x3b')]);var _0x2eb339={'where':_0x29d126[_0x63f5('0x36')]};return db['SugarcrmField'][_0x63f5('0x1c')](_0x2eb339)[_0x63f5('0x22')](function(_0x507099){_0x5f3c36[_0x63f5('0x1c')]=_0x507099;if(_0x34924b[_0x63f5('0x2c')][_0x63f5('0x3c')]){_0x29d126[_0x63f5('0x3d')]=[{'all':!![]}];}return db[_0x63f5('0x26')]['findAll'](_0x29d126);})[_0x63f5('0x22')](function(_0x2ae478){_0x5f3c36[_0x63f5('0x3e')]=_0x2ae478;return _0x5f3c36;})['then'](respondWithFilteredResult(_0x2b9323,_0x29d126))[_0x63f5('0x3f')](handleError(_0x2b9323,null));};exports[_0x63f5('0x40')]=function(_0x40d784,_0x48c67c){var _0x3a6498={'raw':!![],'where':{'id':_0x40d784[_0x63f5('0x41')]['id']}},_0x1e15f3={};_0x1e15f3[_0x63f5('0x2a')]=_[_0x63f5('0x2d')](db[_0x63f5('0x26')][_0x63f5('0x27')]);_0x1e15f3[_0x63f5('0x2c')]=_[_0x63f5('0x2d')](_0x40d784['query']);_0x1e15f3[_0x63f5('0x2e')]=_[_0x63f5('0x2f')](_0x1e15f3[_0x63f5('0x2a')],_0x1e15f3[_0x63f5('0x2c')]);_0x3a6498[_0x63f5('0x30')]=_[_0x63f5('0x2f')](_0x1e15f3[_0x63f5('0x2a')],qs[_0x63f5('0x31')](_0x40d784[_0x63f5('0x2c')][_0x63f5('0x31')]));_0x3a6498['attributes']=_0x3a6498['attributes']['length']?_0x3a6498[_0x63f5('0x30')]:_0x1e15f3['model'];if(_0x40d784['query'][_0x63f5('0x3c')]){_0x3a6498[_0x63f5('0x3d')]=[{'all':!![]}];}_0x3a6498=_[_0x63f5('0x38')]({},_0x3a6498,_0x40d784[_0x63f5('0x3b')]);return db[_0x63f5('0x26')][_0x63f5('0x42')](_0x3a6498)['then'](handleEntityNotFound(_0x48c67c,null))['then'](respondWithResult(_0x48c67c,null))[_0x63f5('0x3f')](handleError(_0x48c67c,null));};exports[_0x63f5('0x43')]=function(_0x4e2df5,_0x310b99){return db[_0x63f5('0x26')][_0x63f5('0x43')](_0x4e2df5[_0x63f5('0x44')],{})[_0x63f5('0x22')](respondWithResult(_0x310b99,0xc9))['catch'](handleError(_0x310b99,null));};exports[_0x63f5('0x21')]=function(_0x2a18de,_0x70f663){if(_0x2a18de[_0x63f5('0x44')]['id']){delete _0x2a18de[_0x63f5('0x44')]['id'];}return db[_0x63f5('0x26')][_0x63f5('0x42')]({'where':{'id':_0x2a18de['params']['id']}})[_0x63f5('0x22')](handleEntityNotFound(_0x70f663,null))[_0x63f5('0x22')](saveUpdates(_0x2a18de['body'],null))[_0x63f5('0x22')](respondWithResult(_0x70f663,null))[_0x63f5('0x3f')](handleError(_0x70f663,null));};exports[_0x63f5('0x45')]=function(_0x1be538,_0x4fe350){return db[_0x63f5('0x26')]['find']({'where':{'id':_0x1be538['params']['id']}})[_0x63f5('0x22')](handleEntityNotFound(_0x4fe350,null))[_0x63f5('0x22')](removeEntity(_0x4fe350,null))['catch'](handleError(_0x4fe350,null));}; \ No newline at end of file +var _0xd6e4=['merge','VIRTUAL','SugarcrmField','includeAll','include','findAll','then','rows','catch','show','options','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','offset','order','sort','pick','filter','where'];(function(_0x536a73,_0x58f046){var _0x9ff48=function(_0x480c2e){while(--_0x480c2e){_0x536a73['push'](_0x536a73['shift']());}};_0x9ff48(++_0x58f046);}(_0xd6e4,0x13f));var _0x4d6e=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xd6e4[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x4d6e('0x0'));var rimraf=require(_0x4d6e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d6e('0x2'));var rp=require(_0x4d6e('0x3'));var moment=require(_0x4d6e('0x4'));var BPromise=require(_0x4d6e('0x5'));var Mustache=require(_0x4d6e('0x6'));var util=require(_0x4d6e('0x7'));var path=require(_0x4d6e('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d6e('0x9'));var _=require(_0x4d6e('0xa'));var squel=require('squel');var crypto=require(_0x4d6e('0xb'));var jsforce=require(_0x4d6e('0xc'));var deskjs=require(_0x4d6e('0xd'));var toCsv=require(_0x4d6e('0xe'));var querystring=require(_0x4d6e('0xf'));var Papa=require(_0x4d6e('0x10'));var Redis=require(_0x4d6e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4d6e('0x12'));var hardwareService=require(_0x4d6e('0x13'));var logger=require(_0x4d6e('0x14'))(_0x4d6e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4d6e('0x16'))['db'];function respondWithStatusCode(_0x5e4cdb,_0x475f41){_0x475f41=_0x475f41||0xcc;return function(_0x4a1250){if(_0x4a1250){return _0x5e4cdb[_0x4d6e('0x17')](_0x475f41);}return _0x5e4cdb[_0x4d6e('0x18')](_0x475f41)[_0x4d6e('0x19')]();};}function respondWithResult(_0x4b62d2,_0x202ee1){_0x202ee1=_0x202ee1||0xc8;return function(_0x226a92){if(_0x226a92){return _0x4b62d2['status'](_0x202ee1)[_0x4d6e('0x1a')](_0x226a92);}};}function respondWithFilteredResult(_0x459495,_0x329387){return function(_0x4f1855){if(_0x4f1855){var _0x2940df=typeof _0x329387['offset']===_0x4d6e('0x1b')&&typeof _0x329387[_0x4d6e('0x1c')]===_0x4d6e('0x1b');var _0x421577=_0x4f1855[_0x4d6e('0x1d')];var _0x499591=_0x2940df?0x0:_0x329387['offset'];var _0x11d2b4=_0x2940df?_0x4f1855[_0x4d6e('0x1d')]:_0x329387['offset']+_0x329387['limit'];var _0x180c39;if(_0x11d2b4>=_0x421577){_0x11d2b4=_0x421577;_0x180c39=0xc8;}else{_0x180c39=0xce;}_0x459495[_0x4d6e('0x18')](_0x180c39);return _0x459495[_0x4d6e('0x1e')](_0x4d6e('0x1f'),_0x499591+'-'+_0x11d2b4+'/'+_0x421577)[_0x4d6e('0x1a')](_0x4f1855);}return null;};}function patchUpdates(_0x40f3f4){return function(_0x4b845f){try{jsonpatch[_0x4d6e('0x20')](_0x4b845f,_0x40f3f4,!![]);}catch(_0x3a6a43){return BPromise[_0x4d6e('0x21')](_0x3a6a43);}return _0x4b845f[_0x4d6e('0x22')]();};}function saveUpdates(_0x36933d,_0x5bb969){return function(_0x426719){if(_0x426719){return _0x426719[_0x4d6e('0x23')](_0x36933d)['then'](function(_0x10533c){return _0x10533c;});}return null;};}function removeEntity(_0x5cc51e,_0x5c5c90){return function(_0x1108bf){if(_0x1108bf){return _0x1108bf[_0x4d6e('0x24')]()['then'](function(){_0x5cc51e[_0x4d6e('0x18')](0xcc)[_0x4d6e('0x19')]();});}};}function handleEntityNotFound(_0x16a700,_0xb74ac9){return function(_0x1c91bb){if(!_0x1c91bb){_0x16a700[_0x4d6e('0x17')](0x194);}return _0x1c91bb;};}function handleError(_0x3cefb5,_0x5c7387){_0x5c7387=_0x5c7387||0x1f4;return function(_0x462acf){logger[_0x4d6e('0x25')](_0x462acf[_0x4d6e('0x26')]);if(_0x462acf[_0x4d6e('0x27')]){delete _0x462acf[_0x4d6e('0x27')];}_0x3cefb5['status'](_0x5c7387)[_0x4d6e('0x28')](_0x462acf);};}exports['index']=function(_0x501956,_0x2179f4){var _0x36d8ff={},_0x3bac18={},_0x24ec1c={'count':0x0,'rows':[]};var _0x14029c=_[_0x4d6e('0x29')](db['SugarcrmField'][_0x4d6e('0x2a')],function(_0x529f17){return{'name':_0x529f17[_0x4d6e('0x2b')],'type':_0x529f17[_0x4d6e('0x2c')][_0x4d6e('0x2d')]};});_0x3bac18['model']=_[_0x4d6e('0x29')](_0x14029c,_0x4d6e('0x27'));_0x3bac18[_0x4d6e('0x2e')]=_[_0x4d6e('0x2f')](_0x501956[_0x4d6e('0x2e')]);_0x3bac18[_0x4d6e('0x30')]=_[_0x4d6e('0x31')](_0x3bac18[_0x4d6e('0x32')],_0x3bac18[_0x4d6e('0x2e')]);_0x36d8ff[_0x4d6e('0x33')]=_[_0x4d6e('0x31')](_0x3bac18['model'],qs[_0x4d6e('0x34')](_0x501956[_0x4d6e('0x2e')][_0x4d6e('0x34')]));_0x36d8ff[_0x4d6e('0x33')]=_0x36d8ff['attributes'][_0x4d6e('0x35')]?_0x36d8ff[_0x4d6e('0x33')]:_0x3bac18[_0x4d6e('0x32')];if(!_0x501956[_0x4d6e('0x2e')]['hasOwnProperty'](_0x4d6e('0x36'))){_0x36d8ff[_0x4d6e('0x1c')]=qs[_0x4d6e('0x1c')](_0x501956['query'][_0x4d6e('0x1c')]);_0x36d8ff[_0x4d6e('0x37')]=qs[_0x4d6e('0x37')](_0x501956['query']['offset']);}_0x36d8ff[_0x4d6e('0x38')]=qs[_0x4d6e('0x39')](_0x501956['query']['sort']);_0x36d8ff['where']=qs['filters'](_[_0x4d6e('0x3a')](_0x501956['query'],_0x3bac18[_0x4d6e('0x30')]),_0x14029c);if(_0x501956[_0x4d6e('0x2e')][_0x4d6e('0x3b')]){_0x36d8ff[_0x4d6e('0x3c')]=_[_0x4d6e('0x3d')](_0x36d8ff['where'],{'$or':_[_0x4d6e('0x29')](_0x14029c,function(_0xbd9c67){if(_0xbd9c67[_0x4d6e('0x2c')]!==_0x4d6e('0x3e')){var _0x3bd72d={};_0x3bd72d[_0xbd9c67['name']]={'$like':'%'+_0x501956[_0x4d6e('0x2e')]['filter']+'%'};return _0x3bd72d;}})});}_0x36d8ff=_['merge']({},_0x36d8ff,_0x501956['options']);var _0x23629e={'where':_0x36d8ff[_0x4d6e('0x3c')]};return db[_0x4d6e('0x3f')][_0x4d6e('0x1d')](_0x23629e)['then'](function(_0x868d3e){_0x24ec1c[_0x4d6e('0x1d')]=_0x868d3e;if(_0x501956[_0x4d6e('0x2e')][_0x4d6e('0x40')]){_0x36d8ff[_0x4d6e('0x41')]=[{'all':!![]}];}return db[_0x4d6e('0x3f')][_0x4d6e('0x42')](_0x36d8ff);})[_0x4d6e('0x43')](function(_0x1c11fa){_0x24ec1c[_0x4d6e('0x44')]=_0x1c11fa;return _0x24ec1c;})['then'](respondWithFilteredResult(_0x2179f4,_0x36d8ff))[_0x4d6e('0x45')](handleError(_0x2179f4,null));};exports[_0x4d6e('0x46')]=function(_0x329162,_0x3876b3){var _0x4d439f={'raw':!![],'where':{'id':_0x329162['params']['id']}},_0x30228f={};_0x30228f['model']=_[_0x4d6e('0x2f')](db[_0x4d6e('0x3f')][_0x4d6e('0x2a')]);_0x30228f[_0x4d6e('0x2e')]=_[_0x4d6e('0x2f')](_0x329162[_0x4d6e('0x2e')]);_0x30228f[_0x4d6e('0x30')]=_['intersection'](_0x30228f[_0x4d6e('0x32')],_0x30228f[_0x4d6e('0x2e')]);_0x4d439f[_0x4d6e('0x33')]=_[_0x4d6e('0x31')](_0x30228f[_0x4d6e('0x32')],qs[_0x4d6e('0x34')](_0x329162['query']['fields']));_0x4d439f[_0x4d6e('0x33')]=_0x4d439f[_0x4d6e('0x33')]['length']?_0x4d439f['attributes']:_0x30228f[_0x4d6e('0x32')];if(_0x329162[_0x4d6e('0x2e')][_0x4d6e('0x40')]){_0x4d439f[_0x4d6e('0x41')]=[{'all':!![]}];}_0x4d439f=_['merge']({},_0x4d439f,_0x329162[_0x4d6e('0x47')]);return db[_0x4d6e('0x3f')][_0x4d6e('0x48')](_0x4d439f)['then'](handleEntityNotFound(_0x3876b3,null))[_0x4d6e('0x43')](respondWithResult(_0x3876b3,null))[_0x4d6e('0x45')](handleError(_0x3876b3,null));};exports[_0x4d6e('0x49')]=function(_0x519046,_0x192952){return db['SugarcrmField'][_0x4d6e('0x49')](_0x519046['body'],{})['then'](respondWithResult(_0x192952,0xc9))['catch'](handleError(_0x192952,null));};exports[_0x4d6e('0x23')]=function(_0x170939,_0x372265){if(_0x170939[_0x4d6e('0x4a')]['id']){delete _0x170939[_0x4d6e('0x4a')]['id'];}return db[_0x4d6e('0x3f')]['find']({'where':{'id':_0x170939['params']['id']}})[_0x4d6e('0x43')](handleEntityNotFound(_0x372265,null))[_0x4d6e('0x43')](saveUpdates(_0x170939[_0x4d6e('0x4a')],null))[_0x4d6e('0x43')](respondWithResult(_0x372265,null))[_0x4d6e('0x45')](handleError(_0x372265,null));};exports['destroy']=function(_0x57604a,_0xa1e32a){return db['SugarcrmField'][_0x4d6e('0x48')]({'where':{'id':_0x57604a[_0x4d6e('0x4b')]['id']}})['then'](handleEntityNotFound(_0xa1e32a,null))['then'](removeEntity(_0xa1e32a,null))[_0x4d6e('0x45')](handleError(_0xa1e32a,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index c375057..6910038 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 _0xac8e=['idField','../../config/logger','api','moment','path','rimraf','../../config/environment','./intSugarcrmField.attributes','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index'];(function(_0x2cda4e,_0x4f97c1){var _0x4731e2=function(_0x1749d3){while(--_0x1749d3){_0x2cda4e['push'](_0x2cda4e['shift']());}};_0x4731e2(++_0x4f97c1);}(_0xac8e,0x12a));var _0xeac8=function(_0x126fe0,_0x121325){_0x126fe0=_0x126fe0-0x0;var _0x53a1f6=_0xac8e[_0x126fe0];return _0x53a1f6;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xeac8('0x0'))(_0xeac8('0x1'));var moment=require(_0xeac8('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xeac8('0x3'));var rimraf=require(_0xeac8('0x4'));var config=require(_0xeac8('0x5'));var attributes=require(_0xeac8('0x6'));module['exports']=function(_0x49dba9,_0x2eb32e){return _0x49dba9['define'](_0xeac8('0x7'),attributes,{'tableName':_0xeac8('0x8'),'paranoid':![],'indexes':[{'name':_0xeac8('0x9'),'fields':[_0xeac8('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x05fc=['lodash','../../config/logger','moment','bluebird','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField','FieldId'];(function(_0x10d7d5,_0x5eb54c){var _0x50216d=function(_0x475860){while(--_0x475860){_0x10d7d5['push'](_0x10d7d5['shift']());}};_0x50216d(++_0x5eb54c);}(_0x05fc,0x1c8));var _0xc05f=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x05fc[_0x42f009];return _0x22a1e0;};'use strict';var _=require(_0xc05f('0x0'));var util=require('util');var logger=require(_0xc05f('0x1'))('api');var moment=require(_0xc05f('0x2'));var BPromise=require(_0xc05f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc05f('0x4'));var config=require(_0xc05f('0x5'));var attributes=require(_0xc05f('0x6'));module[_0xc05f('0x7')]=function(_0x1f62a9,_0x4920ec){return _0x1f62a9['define'](_0xc05f('0x8'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xc05f('0x9'),'fields':[_0xc05f('0xa'),_0xc05f('0xb')],'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 2305bc3..cd9565f 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 _0x2a3e=['http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x765c93,_0x3a755b){var _0x36debc=function(_0x4bbfe7){while(--_0x4bbfe7){_0x765c93['push'](_0x765c93['shift']());}};_0x36debc(++_0x3a755b);}(_0x2a3e,0x109));var _0xe2a3=function(_0x88bfa3,_0x95f7c7){_0x88bfa3=_0x88bfa3-0x0;var _0xed5ee6=_0x2a3e[_0x88bfa3];return _0xed5ee6;};'use strict';var _=require(_0xe2a3('0x0'));var util=require(_0xe2a3('0x1'));var moment=require('moment');var BPromise=require(_0xe2a3('0x2'));var rs=require(_0xe2a3('0x3'));var fs=require('fs');var Redis=require(_0xe2a3('0x4'));var db=require(_0xe2a3('0x5'))['db'];var utils=require(_0xe2a3('0x6'));var logger=require(_0xe2a3('0x7'))(_0xe2a3('0x8'));var config=require('../../config/environment');var jayson=require(_0xe2a3('0x9'));var client=jayson[_0xe2a3('0xa')][_0xe2a3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb8e563,_0x14c85a,_0x23cec3){return new BPromise(function(_0x5542f3,_0x557989){return client['request'](_0xb8e563,_0x23cec3)[_0xe2a3('0xc')](function(_0x4a275e){logger[_0xe2a3('0xd')](_0xe2a3('0xe'),_0x14c85a,'request\x20sent');logger[_0xe2a3('0xf')](_0xe2a3('0x10'),_0x14c85a,_0xe2a3('0x11'),JSON[_0xe2a3('0x12')](_0x4a275e));if(_0x4a275e[_0xe2a3('0x13')]){if(_0x4a275e[_0xe2a3('0x13')][_0xe2a3('0x14')]===0x1f4){logger[_0xe2a3('0x13')](_0xe2a3('0xe'),_0x14c85a,_0x4a275e[_0xe2a3('0x13')]['message']);return _0x557989(_0x4a275e[_0xe2a3('0x13')]['message']);}logger[_0xe2a3('0x13')](_0xe2a3('0xe'),_0x14c85a,_0x4a275e[_0xe2a3('0x13')][_0xe2a3('0x15')]);return _0x5542f3(_0x4a275e[_0xe2a3('0x13')]['message']);}else{logger[_0xe2a3('0xd')](_0xe2a3('0xe'),_0x14c85a,_0xe2a3('0x11'));_0x5542f3(_0x4a275e[_0xe2a3('0x16')][_0xe2a3('0x15')]);}})['catch'](function(_0x2f8fb3){logger[_0xe2a3('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x14c85a,_0x2f8fb3);_0x557989(_0x2f8fb3);});});} \ No newline at end of file +var _0x3eca=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0x3eca,0x9b));var _0xa3ec=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x3eca[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0xa3ec('0x0'));var util=require(_0xa3ec('0x1'));var moment=require(_0xa3ec('0x2'));var BPromise=require(_0xa3ec('0x3'));var rs=require(_0xa3ec('0x4'));var fs=require('fs');var Redis=require(_0xa3ec('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa3ec('0x6'));var logger=require(_0xa3ec('0x7'))(_0xa3ec('0x8'));var config=require(_0xa3ec('0x9'));var jayson=require(_0xa3ec('0xa'));var client=jayson[_0xa3ec('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59b1cb,_0x497b6d,_0x194aa7){return new BPromise(function(_0x42fa2e,_0x183b5f){return client[_0xa3ec('0xc')](_0x59b1cb,_0x194aa7)[_0xa3ec('0xd')](function(_0x1d809c){logger['info'](_0xa3ec('0xe'),_0x497b6d,'request\x20sent');logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x497b6d,_0xa3ec('0xf'),JSON[_0xa3ec('0x10')](_0x1d809c));if(_0x1d809c[_0xa3ec('0x11')]){if(_0x1d809c['error'][_0xa3ec('0x12')]===0x1f4){logger[_0xa3ec('0x11')](_0xa3ec('0xe'),_0x497b6d,_0x1d809c[_0xa3ec('0x11')]['message']);return _0x183b5f(_0x1d809c['error']['message']);}logger['error'](_0xa3ec('0xe'),_0x497b6d,_0x1d809c['error'][_0xa3ec('0x13')]);return _0x42fa2e(_0x1d809c['error'][_0xa3ec('0x13')]);}else{logger[_0xa3ec('0x14')](_0xa3ec('0xe'),_0x497b6d,_0xa3ec('0xf'));_0x42fa2e(_0x1d809c['result'][_0xa3ec('0x13')]);}})[_0xa3ec('0x15')](function(_0x1fd94e){logger['error'](_0xa3ec('0xe'),_0x497b6d,_0x1fd94e);_0x183b5f(_0x1fd94e);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0b58a3d..0b378d7 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 _0x34e5=['fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4a3dce,_0x384a2b){var _0xf7f90c=function(_0x562d87){while(--_0x562d87){_0x4a3dce['push'](_0x4a3dce['shift']());}};_0xf7f90c(++_0x384a2b);}(_0x34e5,0x172));var _0x534e=function(_0x4ffe2e,_0x580ae9){_0x4ffe2e=_0x4ffe2e-0x0;var _0x70fec9=_0x34e5[_0x4ffe2e];return _0x70fec9;};'use strict';var multer=require('multer');var util=require(_0x534e('0x0'));var path=require('path');var timeout=require(_0x534e('0x1'));var express=require(_0x534e('0x2'));var router=express[_0x534e('0x3')]();var fs_extra=require(_0x534e('0x4'));var auth=require(_0x534e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x534e('0x6'));var controller=require(_0x534e('0x7'));router[_0x534e('0x8')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xa')]);router[_0x534e('0x8')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0xc')]);router[_0x534e('0x8')](_0x534e('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0x534e('0x8')]('/:id/fields',auth[_0x534e('0x9')](),controller['getFields']);router[_0x534e('0xe')]('/',auth[_0x534e('0x9')](),controller[_0x534e('0xf')]);router['post'](_0x534e('0xd'),auth[_0x534e('0x9')](),controller[_0x534e('0x10')]);router[_0x534e('0x11')](_0x534e('0xb'),auth['isAuthenticated'](),controller[_0x534e('0x12')]);router[_0x534e('0x13')](_0x534e('0xb'),auth[_0x534e('0x9')](),controller[_0x534e('0x14')]);module[_0x534e('0x15')]=router; \ No newline at end of file +var _0xba33=['./intVtigerAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4b9750,_0x538cbf){var _0x4470b0=function(_0x204609){while(--_0x204609){_0x4b9750['push'](_0x4b9750['shift']());}};_0x4470b0(++_0x538cbf);}(_0xba33,0xf1));var _0x3ba3=function(_0x489948,_0x162c2c){_0x489948=_0x489948-0x0;var _0x212dfb=_0xba33[_0x489948];return _0x212dfb;};'use strict';var multer=require(_0x3ba3('0x0'));var util=require(_0x3ba3('0x1'));var path=require(_0x3ba3('0x2'));var timeout=require(_0x3ba3('0x3'));var express=require('express');var router=express[_0x3ba3('0x4')]();var fs_extra=require(_0x3ba3('0x5'));var auth=require(_0x3ba3('0x6'));var interaction=require(_0x3ba3('0x7'));var config=require(_0x3ba3('0x8'));var controller=require(_0x3ba3('0x9'));router[_0x3ba3('0xa')]('/',auth[_0x3ba3('0xb')](),controller[_0x3ba3('0xc')]);router[_0x3ba3('0xa')](_0x3ba3('0xd'),auth['isAuthenticated'](),controller[_0x3ba3('0xe')]);router[_0x3ba3('0xa')](_0x3ba3('0xf'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x10')]);router['get'](_0x3ba3('0x11'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3ba3('0x13')](_0x3ba3('0xf'),auth[_0x3ba3('0xb')](),controller['addConfiguration']);router[_0x3ba3('0x14')](_0x3ba3('0xd'),auth['isAuthenticated'](),controller[_0x3ba3('0x15')]);router[_0x3ba3('0x16')](_0x3ba3('0xd'),auth[_0x3ba3('0xb')](),controller[_0x3ba3('0x17')]);module[_0x3ba3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 1daa0f0..ce33cf8 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 _0xba95=['sequelize','exports','STRING','HelpDesk'];(function(_0x2379bd,_0x98d1d3){var _0x51bbf1=function(_0x349f48){while(--_0x349f48){_0x2379bd['push'](_0x2379bd['shift']());}};_0x51bbf1(++_0x98d1d3);}(_0xba95,0x1d0));var _0x5ba9=function(_0x25514a,_0x3fb44d){_0x25514a=_0x25514a-0x0;var _0x510193=_0xba95[_0x25514a];return _0x510193;};'use strict';var Sequelize=require(_0x5ba9('0x0'));module[_0x5ba9('0x1')]={'name':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x5ba9('0x2')]},'username':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![],'defaultValue':_0x5ba9('0x3')},'remoteUri':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x5ba9('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xee71=['STRING','HelpDesk','sequelize','exports'];(function(_0x398a02,_0x107c33){var _0x145d41=function(_0x31ab45){while(--_0x31ab45){_0x398a02['push'](_0x398a02['shift']());}};_0x145d41(++_0x107c33);}(_0xee71,0xb2));var _0x1ee7=function(_0x401afa,_0x2120c7){_0x401afa=_0x401afa-0x0;var _0x446804=_0xee71[_0x401afa];return _0x446804;};'use strict';var Sequelize=require(_0x1ee7('0x0'));module[_0x1ee7('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1ee7('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x1ee7('0x2')],'allowNull':![],'defaultValue':_0x1ee7('0x3')},'remoteUri':{'type':Sequelize[_0x1ee7('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x1ee7('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x1ee7('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 5e90866..2bb57a5 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 _0xf9bc=['query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','rows','catch','show','params','include','options','find','create','body','getConfigurations','VtigerConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','VtigerField','Descriptions','md5','findOne','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','GET','success','POST','login','result','token','describe','sessionName','reference','owner','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','log','vTiger\x20error:\x20','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','eml-format','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','VtigerAccount','rawAttributes','fieldName','type','key','map'];(function(_0x396907,_0x5ef522){var _0x2a98ea=function(_0x937eab){while(--_0x937eab){_0x396907['push'](_0x396907['shift']());}};_0x2a98ea(++_0x5ef522);}(_0xf9bc,0xbe));var _0xcf9b=function(_0x2b62e7,_0x5ae3b0){_0x2b62e7=_0x2b62e7-0x0;var _0x186a41=_0xf9bc[_0x2b62e7];return _0x186a41;};'use strict';var emlformat=require(_0xcf9b('0x0'));var rimraf=require(_0xcf9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcf9b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcf9b('0x3'));var Mustache=require(_0xcf9b('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcf9b('0x5'));var csv=require(_0xcf9b('0x6'));var ejs=require(_0xcf9b('0x7'));var fs=require('fs');var fs_extra=require(_0xcf9b('0x8'));var _=require(_0xcf9b('0x9'));var squel=require(_0xcf9b('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xcf9b('0xb'));var toCsv=require(_0xcf9b('0x6'));var querystring=require('querystring');var Papa=require(_0xcf9b('0xc'));var Redis=require(_0xcf9b('0xd'));var authService=require(_0xcf9b('0xe'));var qs=require(_0xcf9b('0xf'));var as=require(_0xcf9b('0x10'));var hardwareService=require(_0xcf9b('0x11'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf9b('0x12'))['db'];var integrations=require(_0xcf9b('0x13'));function respondWithStatusCode(_0x1f4463,_0x1050e2){_0x1050e2=_0x1050e2||0xcc;return function(_0x37e474){if(_0x37e474){return _0x1f4463[_0xcf9b('0x14')](_0x1050e2);}return _0x1f4463[_0xcf9b('0x15')](_0x1050e2)[_0xcf9b('0x16')]();};}function respondWithResult(_0x242c78,_0x5744cb){_0x5744cb=_0x5744cb||0xc8;return function(_0x1aa758){if(_0x1aa758){return _0x242c78[_0xcf9b('0x15')](_0x5744cb)['json'](_0x1aa758);}};}function respondWithFilteredResult(_0x22c974,_0x2c0cf1){return function(_0x1a1fab){if(_0x1a1fab){var _0x516639=typeof _0x2c0cf1[_0xcf9b('0x17')]===_0xcf9b('0x18')&&typeof _0x2c0cf1[_0xcf9b('0x19')]===_0xcf9b('0x18');var _0x316547=_0x1a1fab['count'];var _0x5885ac=_0x516639?0x0:_0x2c0cf1['offset'];var _0x1c987a=_0x516639?_0x1a1fab['count']:_0x2c0cf1['offset']+_0x2c0cf1[_0xcf9b('0x19')];var _0x17c1b0;if(_0x1c987a>=_0x316547){_0x1c987a=_0x316547;_0x17c1b0=0xc8;}else{_0x17c1b0=0xce;}_0x22c974[_0xcf9b('0x15')](_0x17c1b0);return _0x22c974[_0xcf9b('0x1a')](_0xcf9b('0x1b'),_0x5885ac+'-'+_0x1c987a+'/'+_0x316547)[_0xcf9b('0x1c')](_0x1a1fab);}return null;};}function patchUpdates(_0x1e1f9c){return function(_0x319cc4){try{jsonpatch[_0xcf9b('0x1d')](_0x319cc4,_0x1e1f9c,!![]);}catch(_0x19ca39){return BPromise[_0xcf9b('0x1e')](_0x19ca39);}return _0x319cc4[_0xcf9b('0x1f')]();};}function saveUpdates(_0x52f52c,_0x37eb40){return function(_0x17ea7b){if(_0x17ea7b){return _0x17ea7b[_0xcf9b('0x20')](_0x52f52c)[_0xcf9b('0x21')](function(_0x308e3c){return _0x308e3c;});}return null;};}function removeEntity(_0xe6cd04,_0x549b7d){return function(_0x337c29){if(_0x337c29){return _0x337c29[_0xcf9b('0x22')]()[_0xcf9b('0x21')](function(){_0xe6cd04[_0xcf9b('0x15')](0xcc)[_0xcf9b('0x16')]();});}};}function handleEntityNotFound(_0x595616,_0x130529){return function(_0x2f4f6b){if(!_0x2f4f6b){_0x595616['sendStatus'](0x194);}return _0x2f4f6b;};}function handleError(_0x31cddf,_0x31afe9){_0x31afe9=_0x31afe9||0x1f4;return function(_0x37e61b){logger[_0xcf9b('0x23')](_0x37e61b[_0xcf9b('0x24')]);if(_0x37e61b[_0xcf9b('0x25')]){delete _0x37e61b[_0xcf9b('0x25')];}_0x31cddf['status'](_0x31afe9)[_0xcf9b('0x26')](_0x37e61b);};}exports[_0xcf9b('0x27')]=function(_0x389163,_0x2d49cf){var _0x36d5e8={},_0x1124e0={},_0x28d683={'count':0x0,'rows':[]};var _0x21bd4c=_['map'](db[_0xcf9b('0x28')][_0xcf9b('0x29')],function(_0x2fea9c){return{'name':_0x2fea9c[_0xcf9b('0x2a')],'type':_0x2fea9c[_0xcf9b('0x2b')][_0xcf9b('0x2c')]};});_0x1124e0['model']=_[_0xcf9b('0x2d')](_0x21bd4c,_0xcf9b('0x25'));_0x1124e0[_0xcf9b('0x2e')]=_[_0xcf9b('0x2f')](_0x389163[_0xcf9b('0x2e')]);_0x1124e0[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0x1124e0[_0xcf9b('0x32')],_0x1124e0[_0xcf9b('0x2e')]);_0x36d5e8[_0xcf9b('0x33')]=_[_0xcf9b('0x31')](_0x1124e0[_0xcf9b('0x32')],qs['fields'](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x34')]));_0x36d5e8[_0xcf9b('0x33')]=_0x36d5e8[_0xcf9b('0x33')][_0xcf9b('0x35')]?_0x36d5e8[_0xcf9b('0x33')]:_0x1124e0[_0xcf9b('0x32')];if(!_0x389163['query'][_0xcf9b('0x36')](_0xcf9b('0x37'))){_0x36d5e8['limit']=qs[_0xcf9b('0x19')](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x19')]);_0x36d5e8[_0xcf9b('0x17')]=qs[_0xcf9b('0x17')](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x17')]);}_0x36d5e8[_0xcf9b('0x38')]=qs['sort'](_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x39')]);_0x36d5e8[_0xcf9b('0x3a')]=qs[_0xcf9b('0x30')](_[_0xcf9b('0x3b')](_0x389163['query'],_0x1124e0[_0xcf9b('0x30')]),_0x21bd4c);if(_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x3c')]){_0x36d5e8['where']=_[_0xcf9b('0x3d')](_0x36d5e8[_0xcf9b('0x3a')],{'$or':_['map'](_0x21bd4c,function(_0x4ee2c4){if(_0x4ee2c4[_0xcf9b('0x2b')]!==_0xcf9b('0x3e')){var _0x7b39e8={};_0x7b39e8[_0x4ee2c4['name']]={'$like':'%'+_0x389163['query'][_0xcf9b('0x3c')]+'%'};return _0x7b39e8;}})});}_0x36d5e8=_[_0xcf9b('0x3d')]({},_0x36d5e8,_0x389163['options']);var _0x585096={'where':_0x36d5e8[_0xcf9b('0x3a')]};return db[_0xcf9b('0x28')][_0xcf9b('0x3f')](_0x585096)[_0xcf9b('0x21')](function(_0x2dcd6e){_0x28d683[_0xcf9b('0x3f')]=_0x2dcd6e;if(_0x389163[_0xcf9b('0x2e')][_0xcf9b('0x40')]){_0x36d5e8['include']=[{'all':!![]}];}return db[_0xcf9b('0x28')]['findAll'](_0x36d5e8);})[_0xcf9b('0x21')](function(_0x225da6){_0x28d683[_0xcf9b('0x41')]=_0x225da6;return _0x28d683;})['then'](respondWithFilteredResult(_0x2d49cf,_0x36d5e8))[_0xcf9b('0x42')](handleError(_0x2d49cf,null));};exports[_0xcf9b('0x43')]=function(_0x391276,_0x26394e){var _0xfd5cb3={'raw':![],'where':{'id':_0x391276[_0xcf9b('0x44')]['id']}},_0xd22eda={};_0xd22eda['model']=_[_0xcf9b('0x2f')](db[_0xcf9b('0x28')][_0xcf9b('0x29')]);_0xd22eda[_0xcf9b('0x2e')]=_['keys'](_0x391276[_0xcf9b('0x2e')]);_0xd22eda[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0xd22eda[_0xcf9b('0x32')],_0xd22eda['query']);_0xfd5cb3['attributes']=_[_0xcf9b('0x31')](_0xd22eda[_0xcf9b('0x32')],qs[_0xcf9b('0x34')](_0x391276[_0xcf9b('0x2e')][_0xcf9b('0x34')]));_0xfd5cb3[_0xcf9b('0x33')]=_0xfd5cb3[_0xcf9b('0x33')]['length']?_0xfd5cb3['attributes']:_0xd22eda[_0xcf9b('0x32')];if(_0x391276[_0xcf9b('0x2e')][_0xcf9b('0x40')]){_0xfd5cb3[_0xcf9b('0x45')]=[{'all':!![]}];}_0xfd5cb3=_[_0xcf9b('0x3d')]({},_0xfd5cb3,_0x391276[_0xcf9b('0x46')]);return db[_0xcf9b('0x28')][_0xcf9b('0x47')](_0xfd5cb3)[_0xcf9b('0x21')](handleEntityNotFound(_0x26394e,null))[_0xcf9b('0x21')](respondWithResult(_0x26394e,null))[_0xcf9b('0x42')](handleError(_0x26394e,null));};exports[_0xcf9b('0x48')]=function(_0x4a46d9,_0x19a703){return db[_0xcf9b('0x28')][_0xcf9b('0x48')](_0x4a46d9['body'],{})[_0xcf9b('0x21')](respondWithResult(_0x19a703,0xc9))[_0xcf9b('0x42')](handleError(_0x19a703,null));};exports[_0xcf9b('0x20')]=function(_0x305eca,_0x5f3541){if(_0x305eca[_0xcf9b('0x49')]['id']){delete _0x305eca[_0xcf9b('0x49')]['id'];}return db[_0xcf9b('0x28')]['find']({'where':{'id':_0x305eca[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x5f3541,null))[_0xcf9b('0x21')](saveUpdates(_0x305eca['body'],null))[_0xcf9b('0x21')](respondWithResult(_0x5f3541,null))['catch'](handleError(_0x5f3541,null));};exports[_0xcf9b('0x22')]=function(_0x4895f1,_0x1055a8){return db[_0xcf9b('0x28')][_0xcf9b('0x47')]({'where':{'id':_0x4895f1[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x1055a8,null))[_0xcf9b('0x21')](removeEntity(_0x1055a8,null))[_0xcf9b('0x42')](handleError(_0x1055a8,null));};exports[_0xcf9b('0x4a')]=function(_0x42fc9b,_0x21f700,_0x32b707){var _0x2f0e75={};var _0x30c83e={};var _0x5f5df8;var _0x4cf92b;return db[_0xcf9b('0x28')]['findOne']({'where':{'id':_0x42fc9b[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x21f700,null))[_0xcf9b('0x21')](function(_0x1b2f8a){if(_0x1b2f8a){_0x5f5df8=_0x1b2f8a;_0x30c83e['model']=_[_0xcf9b('0x2f')](db[_0xcf9b('0x4b')]['rawAttributes']);_0x30c83e[_0xcf9b('0x2e')]=_[_0xcf9b('0x2f')](_0x42fc9b[_0xcf9b('0x2e')]);_0x30c83e[_0xcf9b('0x30')]=_[_0xcf9b('0x31')](_0x30c83e['model'],_0x30c83e[_0xcf9b('0x2e')]);_0x2f0e75['attributes']=_[_0xcf9b('0x31')](_0x30c83e[_0xcf9b('0x32')],qs['fields'](_0x42fc9b[_0xcf9b('0x2e')]['fields']));_0x2f0e75[_0xcf9b('0x33')]=_0x2f0e75[_0xcf9b('0x33')][_0xcf9b('0x35')]?_0x2f0e75[_0xcf9b('0x33')]:_0x30c83e['model'];_0x2f0e75[_0xcf9b('0x38')]=qs[_0xcf9b('0x39')](_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x39')]);_0x2f0e75['where']=qs[_0xcf9b('0x30')](_[_0xcf9b('0x3b')](_0x42fc9b[_0xcf9b('0x2e')],_0x30c83e['filters']));if(_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x3c')]){_0x2f0e75[_0xcf9b('0x3a')]=_['merge'](_0x2f0e75[_0xcf9b('0x3a')],{'$or':_[_0xcf9b('0x2d')](_0x2f0e75[_0xcf9b('0x33')],function(_0x11d5df){var _0x49363e={};_0x49363e[_0x11d5df]={'$like':'%'+_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x3c')]+'%'};return _0x49363e;})});}_0x2f0e75=_[_0xcf9b('0x3d')]({},_0x2f0e75,_0x42fc9b[_0xcf9b('0x46')]);return _0x5f5df8[_0xcf9b('0x4a')](_0x2f0e75);}})[_0xcf9b('0x21')](function(_0x16649f){if(_0x16649f){_0x4cf92b=_0x16649f[_0xcf9b('0x35')];if(!_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x36')](_0xcf9b('0x37'))){_0x2f0e75[_0xcf9b('0x19')]=qs[_0xcf9b('0x19')](_0x42fc9b[_0xcf9b('0x2e')][_0xcf9b('0x19')]);_0x2f0e75[_0xcf9b('0x17')]=qs['offset'](_0x42fc9b[_0xcf9b('0x2e')]['offset']);}return _0x5f5df8[_0xcf9b('0x4a')](_0x2f0e75);}})['then'](function(_0x514fc6){if(_0x514fc6){return _0x514fc6?{'count':_0x4cf92b,'rows':_0x514fc6}:null;}})[_0xcf9b('0x21')](respondWithResult(_0x21f700,null))[_0xcf9b('0x42')](handleError(_0x21f700,null));};exports[_0xcf9b('0x4c')]=function(_0x3be360,_0x2baf6a,_0x572c59){if(_0x3be360[_0xcf9b('0x49')]['id']){delete _0x3be360[_0xcf9b('0x49')]['id'];}return db[_0xcf9b('0x28')]['findOne']({'where':{'id':_0x3be360[_0xcf9b('0x44')]['id']}})[_0xcf9b('0x21')](handleEntityNotFound(_0x2baf6a,null))[_0xcf9b('0x21')](function(_0x181356){if(_0x181356){_0x3be360['body'][_0xcf9b('0x4d')]=_0x181356['id'];_0x3be360[_0xcf9b('0x49')][_0xcf9b('0x4e')]=integrations[_0xcf9b('0x4f')](_0x3be360[_0xcf9b('0x49')]['channel'],_0x3be360[_0xcf9b('0x49')]['type']);_0x3be360['body']['Descriptions']=integrations['getDescriptions'](_0x3be360['body'][_0xcf9b('0x50')],_0x3be360[_0xcf9b('0x49')][_0xcf9b('0x2b')]);return db[_0xcf9b('0x4b')][_0xcf9b('0x48')](_0x3be360[_0xcf9b('0x49')],{'include':[{'model':db[_0xcf9b('0x51')],'as':_0xcf9b('0x4e')},{'model':db[_0xcf9b('0x51')],'as':_0xcf9b('0x52')}]});}return null;})[_0xcf9b('0x21')](respondWithResult(_0x2baf6a,null))['catch'](handleError(_0x2baf6a,null));};var md5=require(_0xcf9b('0x53'));exports['getFields']=function(_0x275af1,_0x3bbd38,_0x593499){var _0x25e4f3=null;var _0x191e35=null;var _0x3846e7=null;var _0x26e32f=null;var _0x5eec07='';return db['VtigerAccount'][_0xcf9b('0x54')]({'where':{'id':_0x275af1[_0xcf9b('0x44')]['id']},'attributes':['id',_0xcf9b('0x25'),_0xcf9b('0x55'),_0xcf9b('0x56'),_0xcf9b('0x57'),_0xcf9b('0x58'),_0xcf9b('0x59'),_0xcf9b('0x5a')]})[_0xcf9b('0x21')](handleEntityNotFound(_0x3bbd38,null))[_0xcf9b('0x21')](function(_0x25083c){if(_0x25083c){_0x25e4f3=_0x25083c[_0xcf9b('0x55')];_0x191e35=_0x25083c['accessKey'];_0x3846e7=_0x25083c[_0xcf9b('0x57')];_0x5eec07=_0x25083c[_0xcf9b('0x58')];var _0x232fee=_0x5eec07[_0xcf9b('0x5b')](-0x1);if(_0x232fee==='/'){_0x5eec07=_0x5eec07[_0xcf9b('0x5c')](0x0,_0x5eec07['lastIndexOf'](_0x232fee));}_0x26e32f=util['format']('%s/webservice.php',_0x5eec07);var _0x553d0f={'method':_0xcf9b('0x5d'),'uri':_0x26e32f,'qs':{'operation':'getchallenge','username':_0x25083c['username']},'json':!![]};return rp(_0x553d0f);}})['then'](function(_0x2708a7){if(_0x2708a7[_0xcf9b('0x5e')]){var _0x25d2b4={'method':_0xcf9b('0x5f'),'uri':_0x26e32f,'form':{'operation':_0xcf9b('0x60'),'username':_0x25e4f3,'accessKey':md5(_0x2708a7[_0xcf9b('0x61')][_0xcf9b('0x62')]+_0x191e35)},'json':!![]};return rp(_0x25d2b4);}})[_0xcf9b('0x21')](function(_0x28e2f9){if(_0x28e2f9[_0xcf9b('0x5e')]){var _0xdf39a0={'method':_0xcf9b('0x5d'),'uri':_0x26e32f,'qs':{'operation':_0xcf9b('0x63'),'username':_0x25e4f3,'sessionName':_0x28e2f9[_0xcf9b('0x61')][_0xcf9b('0x64')],'elementType':_0x3846e7},'json':!![]};return rp(_0xdf39a0);}})['then'](function(_0x3b43a5){if(_0x3b43a5[_0xcf9b('0x5e')]){var _0x27efe5=['autogenerated',_0xcf9b('0x65'),_0xcf9b('0x66')];_[_0xcf9b('0x67')](_0x3b43a5[_0xcf9b('0x61')][_0xcf9b('0x34')],function(_0x59fbaf){return _0x27efe5['includes'](_0x59fbaf[_0xcf9b('0x2b')][_0xcf9b('0x25')]);});_[_0xcf9b('0x67')](_0x3b43a5[_0xcf9b('0x61')]['fields'],function(_0x343b3c){return _0x343b3c[_0xcf9b('0x68')]===_0xcf9b('0x69');});return{'count':_0x3b43a5[_0xcf9b('0x61')][_0xcf9b('0x34')]['length'],'rows':_[_0xcf9b('0x2d')](_0x3b43a5['result']['fields'],function(_0x4790aa){return{'id':_0x4790aa[_0xcf9b('0x25')],'name':_0x4790aa[_0xcf9b('0x6a')],'custom':_[_0xcf9b('0x6b')](_0x4790aa[_0xcf9b('0x25')],_0xcf9b('0x6c'))?!![]:![],'options':_0x4790aa[_0xcf9b('0x2b')][_0xcf9b('0x25')]===_0xcf9b('0x6d')&&_0x4790aa[_0xcf9b('0x2b')]['picklistValues'][_0xcf9b('0x35')]>0x0?_['map'](_0x4790aa[_0xcf9b('0x2b')][_0xcf9b('0x6e')],function(_0x38cb27){return{'name':_0x38cb27['label'],'value':_0x38cb27['value']};}):[]};})};}})['then'](respondWithResult(_0x3bbd38,null))[_0xcf9b('0x42')](function(_0xf13261){console[_0xcf9b('0x6f')](_0xcf9b('0x70')+_0xf13261);var _0x4b0fe3=_0x275af1[_0xcf9b('0x2e')][_0xcf9b('0x71')]?0x1f4:_0xf13261['statusCode']||0x1f4;logger[_0xcf9b('0x23')](_0xcf9b('0x72'),_0xcf9b('0x73'),_0x4b0fe3,JSON[_0xcf9b('0x74')](_0xf13261));delete _0xf13261[_0xcf9b('0x25')];if(_0x4b0fe3===0x191){_0x4b0fe3=0x190;}_0x3bbd38['status'](_0x4b0fe3)[_0xcf9b('0x26')](_0x275af1[_0xcf9b('0x2e')][_0xcf9b('0x71')]?{'message':'Wrong\x20credentials','statusCode':_0xf13261[_0xcf9b('0x75')]}:_0xf13261);});}; \ No newline at end of file +var _0x3be6=['update','find','findOne','VtigerConfiguration','rawAttributes','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','result','token','success','describe','sessionName','autogenerated','reference','owner','remove','editable','false','cf_','picklist','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','count','limit','status','set','Content-Range','reject','save','then','destroy','name','send','index','map','VtigerAccount','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','merge','create','body','catch'];(function(_0x4c7c0d,_0x42df7b){var _0x15ea60=function(_0xe67974){while(--_0xe67974){_0x4c7c0d['push'](_0x4c7c0d['shift']());}};_0x15ea60(++_0x42df7b);}(_0x3be6,0x198));var _0x63be=function(_0x290df5,_0x2cc0cb){_0x290df5=_0x290df5-0x0;var _0x27c215=_0x3be6[_0x290df5];return _0x27c215;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x63be('0x0'));var zipdir=require(_0x63be('0x1'));var jsonpatch=require(_0x63be('0x2'));var rp=require(_0x63be('0x3'));var moment=require(_0x63be('0x4'));var BPromise=require(_0x63be('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x63be('0x6'));var sox=require(_0x63be('0x7'));var csv=require('to-csv');var ejs=require(_0x63be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x63be('0x9'));var squel=require(_0x63be('0xa'));var crypto=require(_0x63be('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x63be('0xc'));var querystring=require(_0x63be('0xd'));var Papa=require(_0x63be('0xe'));var Redis=require(_0x63be('0xf'));var authService=require(_0x63be('0x10'));var qs=require(_0x63be('0x11'));var as=require(_0x63be('0x12'));var hardwareService=require(_0x63be('0x13'));var logger=require(_0x63be('0x14'))('api');var utils=require(_0x63be('0x15'));var config=require(_0x63be('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x63be('0x17'))['db'];var integrations=require(_0x63be('0x18'));function respondWithStatusCode(_0x310cda,_0x35745d){_0x35745d=_0x35745d||0xcc;return function(_0x221f2a){if(_0x221f2a){return _0x310cda[_0x63be('0x19')](_0x35745d);}return _0x310cda['status'](_0x35745d)[_0x63be('0x1a')]();};}function respondWithResult(_0x5c7b1d,_0x46f38e){_0x46f38e=_0x46f38e||0xc8;return function(_0x3df8ba){if(_0x3df8ba){return _0x5c7b1d['status'](_0x46f38e)[_0x63be('0x1b')](_0x3df8ba);}};}function respondWithFilteredResult(_0xa0a8be,_0x3968f7){return function(_0x192355){if(_0x192355){var _0x1e7d77=typeof _0x3968f7[_0x63be('0x1c')]==='undefined'&&typeof _0x3968f7['limit']==='undefined';var _0x41019f=_0x192355['count'];var _0x1d5b60=_0x1e7d77?0x0:_0x3968f7[_0x63be('0x1c')];var _0x23e06f=_0x1e7d77?_0x192355[_0x63be('0x1d')]:_0x3968f7[_0x63be('0x1c')]+_0x3968f7[_0x63be('0x1e')];var _0x121e37;if(_0x23e06f>=_0x41019f){_0x23e06f=_0x41019f;_0x121e37=0xc8;}else{_0x121e37=0xce;}_0xa0a8be[_0x63be('0x1f')](_0x121e37);return _0xa0a8be[_0x63be('0x20')](_0x63be('0x21'),_0x1d5b60+'-'+_0x23e06f+'/'+_0x41019f)[_0x63be('0x1b')](_0x192355);}return null;};}function patchUpdates(_0x202822){return function(_0x480028){try{jsonpatch['apply'](_0x480028,_0x202822,!![]);}catch(_0x1f92f1){return BPromise[_0x63be('0x22')](_0x1f92f1);}return _0x480028[_0x63be('0x23')]();};}function saveUpdates(_0x11f980,_0x46e9b9){return function(_0x4571a3){if(_0x4571a3){return _0x4571a3['update'](_0x11f980)[_0x63be('0x24')](function(_0x1ffdb5){return _0x1ffdb5;});}return null;};}function removeEntity(_0x5110f9,_0x2cde2c){return function(_0x14d88f){if(_0x14d88f){return _0x14d88f[_0x63be('0x25')]()[_0x63be('0x24')](function(){_0x5110f9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x105a2c,_0x45cbd4){return function(_0x5f436c){if(!_0x5f436c){_0x105a2c['sendStatus'](0x194);}return _0x5f436c;};}function handleError(_0xb4ace4,_0xf256f){_0xf256f=_0xf256f||0x1f4;return function(_0x20986a){logger['error'](_0x20986a['stack']);if(_0x20986a[_0x63be('0x26')]){delete _0x20986a[_0x63be('0x26')];}_0xb4ace4['status'](_0xf256f)[_0x63be('0x27')](_0x20986a);};}exports[_0x63be('0x28')]=function(_0x18298c,_0x5bbe18){var _0x5c3ffa={},_0x577962={},_0x5f0116={'count':0x0,'rows':[]};var _0x103308=_[_0x63be('0x29')](db[_0x63be('0x2a')]['rawAttributes'],function(_0x5b8551){return{'name':_0x5b8551['fieldName'],'type':_0x5b8551[_0x63be('0x2b')][_0x63be('0x2c')]};});_0x577962['model']=_[_0x63be('0x29')](_0x103308,_0x63be('0x26'));_0x577962[_0x63be('0x2d')]=_[_0x63be('0x2e')](_0x18298c[_0x63be('0x2d')]);_0x577962[_0x63be('0x2f')]=_['intersection'](_0x577962[_0x63be('0x30')],_0x577962[_0x63be('0x2d')]);_0x5c3ffa[_0x63be('0x31')]=_[_0x63be('0x32')](_0x577962['model'],qs[_0x63be('0x33')](_0x18298c[_0x63be('0x2d')][_0x63be('0x33')]));_0x5c3ffa[_0x63be('0x31')]=_0x5c3ffa['attributes'][_0x63be('0x34')]?_0x5c3ffa[_0x63be('0x31')]:_0x577962[_0x63be('0x30')];if(!_0x18298c[_0x63be('0x2d')][_0x63be('0x35')](_0x63be('0x36'))){_0x5c3ffa['limit']=qs[_0x63be('0x1e')](_0x18298c[_0x63be('0x2d')][_0x63be('0x1e')]);_0x5c3ffa[_0x63be('0x1c')]=qs[_0x63be('0x1c')](_0x18298c[_0x63be('0x2d')][_0x63be('0x1c')]);}_0x5c3ffa[_0x63be('0x37')]=qs[_0x63be('0x38')](_0x18298c['query']['sort']);_0x5c3ffa[_0x63be('0x39')]=qs['filters'](_[_0x63be('0x3a')](_0x18298c[_0x63be('0x2d')],_0x577962['filters']),_0x103308);if(_0x18298c[_0x63be('0x2d')]['filter']){_0x5c3ffa[_0x63be('0x39')]=_['merge'](_0x5c3ffa[_0x63be('0x39')],{'$or':_['map'](_0x103308,function(_0x1b08bd){if(_0x1b08bd[_0x63be('0x2b')]!==_0x63be('0x3b')){var _0x595349={};_0x595349[_0x1b08bd[_0x63be('0x26')]]={'$like':'%'+_0x18298c[_0x63be('0x2d')][_0x63be('0x3c')]+'%'};return _0x595349;}})});}_0x5c3ffa=_['merge']({},_0x5c3ffa,_0x18298c[_0x63be('0x3d')]);var _0x4f1b83={'where':_0x5c3ffa[_0x63be('0x39')]};return db[_0x63be('0x2a')][_0x63be('0x1d')](_0x4f1b83)[_0x63be('0x24')](function(_0x4ef915){_0x5f0116[_0x63be('0x1d')]=_0x4ef915;if(_0x18298c[_0x63be('0x2d')][_0x63be('0x3e')]){_0x5c3ffa[_0x63be('0x3f')]=[{'all':!![]}];}return db['VtigerAccount'][_0x63be('0x40')](_0x5c3ffa);})[_0x63be('0x24')](function(_0x1f8f02){_0x5f0116[_0x63be('0x41')]=_0x1f8f02;return _0x5f0116;})[_0x63be('0x24')](respondWithFilteredResult(_0x5bbe18,_0x5c3ffa))['catch'](handleError(_0x5bbe18,null));};exports[_0x63be('0x42')]=function(_0x3f93c3,_0x168d38){var _0x3bcebc={'raw':![],'where':{'id':_0x3f93c3[_0x63be('0x43')]['id']}},_0x8fa689={};_0x8fa689[_0x63be('0x30')]=_['keys'](db[_0x63be('0x2a')]['rawAttributes']);_0x8fa689[_0x63be('0x2d')]=_[_0x63be('0x2e')](_0x3f93c3[_0x63be('0x2d')]);_0x8fa689['filters']=_[_0x63be('0x32')](_0x8fa689[_0x63be('0x30')],_0x8fa689['query']);_0x3bcebc['attributes']=_[_0x63be('0x32')](_0x8fa689[_0x63be('0x30')],qs[_0x63be('0x33')](_0x3f93c3[_0x63be('0x2d')][_0x63be('0x33')]));_0x3bcebc['attributes']=_0x3bcebc[_0x63be('0x31')][_0x63be('0x34')]?_0x3bcebc[_0x63be('0x31')]:_0x8fa689[_0x63be('0x30')];if(_0x3f93c3['query'][_0x63be('0x3e')]){_0x3bcebc[_0x63be('0x3f')]=[{'all':!![]}];}_0x3bcebc=_[_0x63be('0x44')]({},_0x3bcebc,_0x3f93c3[_0x63be('0x3d')]);return db[_0x63be('0x2a')]['find'](_0x3bcebc)[_0x63be('0x24')](handleEntityNotFound(_0x168d38,null))['then'](respondWithResult(_0x168d38,null))['catch'](handleError(_0x168d38,null));};exports[_0x63be('0x45')]=function(_0x8f35b3,_0x4c6758){return db[_0x63be('0x2a')][_0x63be('0x45')](_0x8f35b3[_0x63be('0x46')],{})[_0x63be('0x24')](respondWithResult(_0x4c6758,0xc9))[_0x63be('0x47')](handleError(_0x4c6758,null));};exports[_0x63be('0x48')]=function(_0x1bceb2,_0x1b67c3){if(_0x1bceb2[_0x63be('0x46')]['id']){delete _0x1bceb2['body']['id'];}return db[_0x63be('0x2a')][_0x63be('0x49')]({'where':{'id':_0x1bceb2[_0x63be('0x43')]['id']}})[_0x63be('0x24')](handleEntityNotFound(_0x1b67c3,null))[_0x63be('0x24')](saveUpdates(_0x1bceb2['body'],null))[_0x63be('0x24')](respondWithResult(_0x1b67c3,null))['catch'](handleError(_0x1b67c3,null));};exports[_0x63be('0x25')]=function(_0x53b8e2,_0x334dcc){return db[_0x63be('0x2a')][_0x63be('0x49')]({'where':{'id':_0x53b8e2[_0x63be('0x43')]['id']}})[_0x63be('0x24')](handleEntityNotFound(_0x334dcc,null))[_0x63be('0x24')](removeEntity(_0x334dcc,null))[_0x63be('0x47')](handleError(_0x334dcc,null));};exports['getConfigurations']=function(_0x54e7d9,_0x3b15cd,_0x9608dc){var _0x306c1b={};var _0x133462={};var _0x599ca1;var _0x883db;return db[_0x63be('0x2a')][_0x63be('0x4a')]({'where':{'id':_0x54e7d9['params']['id']}})[_0x63be('0x24')](handleEntityNotFound(_0x3b15cd,null))[_0x63be('0x24')](function(_0x568bfe){if(_0x568bfe){_0x599ca1=_0x568bfe;_0x133462[_0x63be('0x30')]=_[_0x63be('0x2e')](db[_0x63be('0x4b')][_0x63be('0x4c')]);_0x133462[_0x63be('0x2d')]=_[_0x63be('0x2e')](_0x54e7d9[_0x63be('0x2d')]);_0x133462['filters']=_[_0x63be('0x32')](_0x133462[_0x63be('0x30')],_0x133462[_0x63be('0x2d')]);_0x306c1b['attributes']=_[_0x63be('0x32')](_0x133462['model'],qs['fields'](_0x54e7d9[_0x63be('0x2d')]['fields']));_0x306c1b['attributes']=_0x306c1b['attributes'][_0x63be('0x34')]?_0x306c1b[_0x63be('0x31')]:_0x133462[_0x63be('0x30')];_0x306c1b['order']=qs[_0x63be('0x38')](_0x54e7d9[_0x63be('0x2d')][_0x63be('0x38')]);_0x306c1b[_0x63be('0x39')]=qs[_0x63be('0x2f')](_[_0x63be('0x3a')](_0x54e7d9['query'],_0x133462[_0x63be('0x2f')]));if(_0x54e7d9[_0x63be('0x2d')][_0x63be('0x3c')]){_0x306c1b[_0x63be('0x39')]=_[_0x63be('0x44')](_0x306c1b[_0x63be('0x39')],{'$or':_['map'](_0x306c1b[_0x63be('0x31')],function(_0x343bf4){var _0xf68bef={};_0xf68bef[_0x343bf4]={'$like':'%'+_0x54e7d9[_0x63be('0x2d')]['filter']+'%'};return _0xf68bef;})});}_0x306c1b=_[_0x63be('0x44')]({},_0x306c1b,_0x54e7d9['options']);return _0x599ca1[_0x63be('0x4d')](_0x306c1b);}})[_0x63be('0x24')](function(_0x11ea2a){if(_0x11ea2a){_0x883db=_0x11ea2a[_0x63be('0x34')];if(!_0x54e7d9[_0x63be('0x2d')][_0x63be('0x35')]('nolimit')){_0x306c1b['limit']=qs['limit'](_0x54e7d9[_0x63be('0x2d')]['limit']);_0x306c1b[_0x63be('0x1c')]=qs[_0x63be('0x1c')](_0x54e7d9['query'][_0x63be('0x1c')]);}return _0x599ca1[_0x63be('0x4d')](_0x306c1b);}})[_0x63be('0x24')](function(_0x3d68b9){if(_0x3d68b9){return _0x3d68b9?{'count':_0x883db,'rows':_0x3d68b9}:null;}})['then'](respondWithResult(_0x3b15cd,null))[_0x63be('0x47')](handleError(_0x3b15cd,null));};exports['addConfiguration']=function(_0x36d125,_0x5dfd09,_0x485c47){if(_0x36d125[_0x63be('0x46')]['id']){delete _0x36d125[_0x63be('0x46')]['id'];}return db[_0x63be('0x2a')][_0x63be('0x4a')]({'where':{'id':_0x36d125[_0x63be('0x43')]['id']}})[_0x63be('0x24')](handleEntityNotFound(_0x5dfd09,null))[_0x63be('0x24')](function(_0x3f0abc){if(_0x3f0abc){_0x36d125[_0x63be('0x46')][_0x63be('0x4e')]=_0x3f0abc['id'];_0x36d125[_0x63be('0x46')][_0x63be('0x4f')]=integrations[_0x63be('0x50')](_0x36d125[_0x63be('0x46')][_0x63be('0x51')],_0x36d125[_0x63be('0x46')][_0x63be('0x2b')]);_0x36d125[_0x63be('0x46')][_0x63be('0x52')]=integrations[_0x63be('0x53')](_0x36d125[_0x63be('0x46')]['channel'],_0x36d125[_0x63be('0x46')][_0x63be('0x2b')]);return db[_0x63be('0x4b')][_0x63be('0x45')](_0x36d125[_0x63be('0x46')],{'include':[{'model':db['VtigerField'],'as':_0x63be('0x4f')},{'model':db[_0x63be('0x54')],'as':_0x63be('0x52')}]});}return null;})[_0x63be('0x24')](respondWithResult(_0x5dfd09,null))[_0x63be('0x47')](handleError(_0x5dfd09,null));};var md5=require('md5');exports['getFields']=function(_0xf27c00,_0x8df456,_0x3d292a){var _0x49ecc8=null;var _0x294ff5=null;var _0x523165=null;var _0x38016a=null;var _0x1f6f96='';return db['VtigerAccount'][_0x63be('0x4a')]({'where':{'id':_0xf27c00[_0x63be('0x43')]['id']},'attributes':['id','name','username',_0x63be('0x55'),_0x63be('0x56'),_0x63be('0x57'),_0x63be('0x58'),_0x63be('0x59')]})[_0x63be('0x24')](handleEntityNotFound(_0x8df456,null))['then'](function(_0x15a2fb){if(_0x15a2fb){_0x49ecc8=_0x15a2fb[_0x63be('0x5a')];_0x294ff5=_0x15a2fb[_0x63be('0x59')];_0x523165=_0x15a2fb['moduleName'];_0x1f6f96=_0x15a2fb[_0x63be('0x57')];var _0xfde354=_0x1f6f96[_0x63be('0x5b')](-0x1);if(_0xfde354==='/'){_0x1f6f96=_0x1f6f96['substring'](0x0,_0x1f6f96[_0x63be('0x5c')](_0xfde354));}_0x38016a=util[_0x63be('0x5d')](_0x63be('0x5e'),_0x1f6f96);var _0x4fc36a={'method':_0x63be('0x5f'),'uri':_0x38016a,'qs':{'operation':_0x63be('0x60'),'username':_0x15a2fb[_0x63be('0x5a')]},'json':!![]};return rp(_0x4fc36a);}})['then'](function(_0x187220){if(_0x187220['success']){var _0x198503={'method':_0x63be('0x61'),'uri':_0x38016a,'form':{'operation':'login','username':_0x49ecc8,'accessKey':md5(_0x187220[_0x63be('0x62')][_0x63be('0x63')]+_0x294ff5)},'json':!![]};return rp(_0x198503);}})[_0x63be('0x24')](function(_0x132d2c){if(_0x132d2c[_0x63be('0x64')]){var _0x1819da={'method':_0x63be('0x5f'),'uri':_0x38016a,'qs':{'operation':_0x63be('0x65'),'username':_0x49ecc8,'sessionName':_0x132d2c[_0x63be('0x62')][_0x63be('0x66')],'elementType':_0x523165},'json':!![]};return rp(_0x1819da);}})[_0x63be('0x24')](function(_0xee318f){if(_0xee318f[_0x63be('0x64')]){var _0xa9f17d=[_0x63be('0x67'),_0x63be('0x68'),_0x63be('0x69')];_['remove'](_0xee318f['result'][_0x63be('0x33')],function(_0x4d2bb4){return _0xa9f17d['includes'](_0x4d2bb4[_0x63be('0x2b')][_0x63be('0x26')]);});_[_0x63be('0x6a')](_0xee318f[_0x63be('0x62')][_0x63be('0x33')],function(_0x5f1f2d){return _0x5f1f2d[_0x63be('0x6b')]===_0x63be('0x6c');});return{'count':_0xee318f['result']['fields'][_0x63be('0x34')],'rows':_[_0x63be('0x29')](_0xee318f[_0x63be('0x62')]['fields'],function(_0x1875e4){return{'id':_0x1875e4[_0x63be('0x26')],'name':_0x1875e4['label'],'custom':_['startsWith'](_0x1875e4[_0x63be('0x26')],_0x63be('0x6d'))?!![]:![],'options':_0x1875e4[_0x63be('0x2b')][_0x63be('0x26')]===_0x63be('0x6e')&&_0x1875e4[_0x63be('0x2b')]['picklistValues'][_0x63be('0x34')]>0x0?_[_0x63be('0x29')](_0x1875e4[_0x63be('0x2b')]['picklistValues'],function(_0x1898f4){return{'name':_0x1898f4['label'],'value':_0x1898f4[_0x63be('0x6f')]};}):[]};})};}})[_0x63be('0x24')](respondWithResult(_0x8df456,null))[_0x63be('0x47')](function(_0x2d46c7){console[_0x63be('0x70')](_0x63be('0x71')+_0x2d46c7);var _0x17a05f=_0xf27c00[_0x63be('0x2d')][_0x63be('0x72')]?0x1f4:_0x2d46c7[_0x63be('0x73')]||0x1f4;logger[_0x63be('0x74')](_0x63be('0x75'),_0x63be('0x76'),_0x17a05f,JSON[_0x63be('0x77')](_0x2d46c7));delete _0x2d46c7[_0x63be('0x26')];if(_0x17a05f===0x191){_0x17a05f=0x190;}_0x8df456[_0x63be('0x1f')](_0x17a05f)[_0x63be('0x27')](_0xf27c00['query'][_0x63be('0x72')]?{'message':'Wrong\x20credentials','statusCode':_0x2d46c7[_0x63be('0x73')]}:_0x2d46c7);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 69e0f3d..e889733 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 _0x5316=['api','moment','bluebird','request-promise','path','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','util','../../config/logger'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x5316,0x1bf));var _0x6531=function(_0x272ea6,_0x3f0673){_0x272ea6=_0x272ea6-0x0;var _0x43ef03=_0x5316[_0x272ea6];return _0x43ef03;};'use strict';var _=require(_0x6531('0x0'));var util=require(_0x6531('0x1'));var logger=require(_0x6531('0x2'))(_0x6531('0x3'));var moment=require(_0x6531('0x4'));var BPromise=require(_0x6531('0x5'));var rp=require(_0x6531('0x6'));var fs=require('fs');var path=require(_0x6531('0x7'));var rimraf=require('rimraf');var config=require(_0x6531('0x8'));var attributes=require(_0x6531('0x9'));var integrations=require(_0x6531('0xa'));module[_0x6531('0xb')]=function(_0x319587,_0x7b9752){return _0x319587[_0x6531('0xc')](_0x6531('0xd'),attributes,{'tableName':_0x6531('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x654f=['int_vtiger_accounts','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','VtigerAccount'];(function(_0x3aa5f1,_0x5c5395){var _0xf47281=function(_0x55308f){while(--_0x55308f){_0x3aa5f1['push'](_0x3aa5f1['shift']());}};_0xf47281(++_0x5c5395);}(_0x654f,0x16d));var _0xf654=function(_0x4b2a99,_0x2d90f0){_0x4b2a99=_0x4b2a99-0x0;var _0x269a83=_0x654f[_0x4b2a99];return _0x269a83;};'use strict';var _=require('lodash');var util=require(_0xf654('0x0'));var logger=require(_0xf654('0x1'))(_0xf654('0x2'));var moment=require(_0xf654('0x3'));var BPromise=require(_0xf654('0x4'));var rp=require(_0xf654('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf654('0x6'));var config=require(_0xf654('0x7'));var attributes=require('./intVtigerAccount.attributes');var integrations=require(_0xf654('0x8'));module[_0xf654('0x9')]=function(_0x1c8e00,_0x192141){return _0x1c8e00[_0xf654('0xa')](_0xf654('0xb'),attributes,{'tableName':_0xf654('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index cee04a2..865258e 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 _0x5423=['options','raw','where','limit','include','attributes','map','model','then','ShowVtigerAccount','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll'];(function(_0x56fd2e,_0x23ee14){var _0x2d68fe=function(_0x22d300){while(--_0x22d300){_0x56fd2e['push'](_0x56fd2e['shift']());}};_0x2d68fe(++_0x23ee14);}(_0x5423,0xe3));var _0x3542=function(_0xd2286c,_0x304f9d){_0xd2286c=_0xd2286c-0x0;var _0x2519e0=_0x5423[_0xd2286c];return _0x2519e0;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var moment=require('moment');var BPromise=require(_0x3542('0x2'));var rs=require(_0x3542('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3542('0x4'))['db'];var utils=require(_0x3542('0x5'));var logger=require(_0x3542('0x6'))(_0x3542('0x7'));var config=require('../../config/environment');var jayson=require(_0x3542('0x8'));var client=jayson[_0x3542('0x9')][_0x3542('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x29c3fa,_0x2e1a62,_0x55413c){return new BPromise(function(_0x4cdc86,_0xbc51ab){return client[_0x3542('0xb')](_0x29c3fa,_0x55413c)['then'](function(_0x681195){logger[_0x3542('0xc')]('VtigerAccount,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'));logger[_0x3542('0xe')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x2e1a62,_0x3542('0xd'),JSON[_0x3542('0xf')](_0x681195));if(_0x681195[_0x3542('0x10')]){if(_0x681195[_0x3542('0x10')][_0x3542('0x11')]===0x1f4){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195[_0x3542('0x10')][_0x3542('0x13')]);return _0xbc51ab(_0x681195[_0x3542('0x10')][_0x3542('0x13')]);}logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x681195['error'][_0x3542('0x13')]);return _0x4cdc86(_0x681195['error'][_0x3542('0x13')]);}else{logger[_0x3542('0xc')](_0x3542('0x12'),_0x2e1a62,'request\x20sent');_0x4cdc86(_0x681195[_0x3542('0x14')][_0x3542('0x13')]);}})[_0x3542('0x15')](function(_0x5726af){logger[_0x3542('0x10')](_0x3542('0x12'),_0x2e1a62,_0x5726af);_0xbc51ab(_0x5726af);});});}exports[_0x3542('0x16')]=function(_0x3d5199){var _0x493d95=this;return new Promise(function(_0x32df3f,_0x53d4aa){return db[_0x3542('0x17')][_0x3542('0x18')]({'raw':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d5199[_0x3542('0x19')]?_0x3d5199[_0x3542('0x19')][_0x3542('0x1b')]||null:null,'attributes':_0x3d5199['options']?_0x3d5199['options']['attributes']||null:null,'limit':_0x3d5199[_0x3542('0x19')]?_0x3d5199['options'][_0x3542('0x1c')]||null:null,'include':_0x3d5199['options']?_0x3d5199[_0x3542('0x19')]['include']?_['map'](_0x3d5199[_0x3542('0x19')][_0x3542('0x1d')],function(_0x5ae097){return{'model':db[_0x5ae097['model']],'as':_0x5ae097['as'],'attributes':_0x5ae097[_0x3542('0x1e')],'include':_0x5ae097['include']?_[_0x3542('0x1f')](_0x5ae097[_0x3542('0x1d')],function(_0x1e0723){return{'model':db[_0x1e0723[_0x3542('0x20')]],'as':_0x1e0723['as'],'attributes':_0x1e0723[_0x3542('0x1e')],'include':_0x1e0723[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x1e0723[_0x3542('0x1d')],function(_0x18dc6c){return{'model':db[_0x18dc6c[_0x3542('0x20')]],'as':_0x18dc6c['as'],'attributes':_0x18dc6c[_0x3542('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x220021){logger[_0x3542('0xc')](_0x3542('0x16'),_0x3d5199);logger[_0x3542('0xe')](_0x3542('0x16'),_0x3d5199,JSON[_0x3542('0xf')](_0x220021));_0x32df3f(_0x220021);})[_0x3542('0x15')](function(_0x5590a2){logger[_0x3542('0x10')](_0x3542('0x16'),_0x5590a2[_0x3542('0x13')],_0x3d5199);_0x53d4aa(_0x493d95['error'](0x1f4,_0x5590a2[_0x3542('0x13')]));});});};exports[_0x3542('0x22')]=function(_0x2e883a){var _0x30b5e8=this;return new Promise(function(_0x5c882f,_0x5a274b){return db[_0x3542('0x17')][_0x3542('0x23')]({'raw':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')][_0x3542('0x1a')]===undefined?!![]:![]:!![],'where':_0x2e883a[_0x3542('0x19')]?_0x2e883a[_0x3542('0x19')]['where']||null:null,'attributes':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['attributes']||null:null,'include':_0x2e883a['options']?_0x2e883a[_0x3542('0x19')]['include']?_['map'](_0x2e883a[_0x3542('0x19')][_0x3542('0x1d')],function(_0x1bf178){return{'model':db[_0x1bf178['model']],'as':_0x1bf178['as'],'attributes':_0x1bf178[_0x3542('0x1e')],'include':_0x1bf178['include']?_[_0x3542('0x1f')](_0x1bf178[_0x3542('0x1d')],function(_0x561fd0){return{'model':db[_0x561fd0[_0x3542('0x20')]],'as':_0x561fd0['as'],'attributes':_0x561fd0['attributes'],'include':_0x561fd0[_0x3542('0x1d')]?_[_0x3542('0x1f')](_0x561fd0[_0x3542('0x1d')],function(_0x4cfb8f){return{'model':db[_0x4cfb8f[_0x3542('0x20')]],'as':_0x4cfb8f['as'],'attributes':_0x4cfb8f['attributes']};}):[]};}):[]};}):[]:[]})[_0x3542('0x21')](function(_0x1fe5c6){logger[_0x3542('0xc')](_0x3542('0x22'),_0x2e883a);logger[_0x3542('0xe')](_0x3542('0x22'),_0x2e883a,JSON[_0x3542('0xf')](_0x1fe5c6));_0x5c882f(_0x1fe5c6);})[_0x3542('0x15')](function(_0x110aa8){logger[_0x3542('0x10')](_0x3542('0x22'),_0x110aa8[_0x3542('0x13')],_0x2e883a);_0x5a274b(_0x30b5e8[_0x3542('0x10')](0x1f4,_0x110aa8['message']));});});}; \ No newline at end of file +var _0x41bb=['../../config/environment','jayson/promise','client','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','GetVtigerAccount','findAll','options','raw','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','where','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43dac0,_0x54689f){var _0x174d0b=function(_0x20e314){while(--_0x20e314){_0x43dac0['push'](_0x43dac0['shift']());}};_0x174d0b(++_0x54689f);}(_0x41bb,0xc5));var _0xb41b=function(_0x512aa7,_0x2be0d9){_0x512aa7=_0x512aa7-0x0;var _0x952539=_0x41bb[_0x512aa7];return _0x952539;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var moment=require('moment');var BPromise=require(_0xb41b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb41b('0x3'));var db=require(_0xb41b('0x4'))['db'];var utils=require(_0xb41b('0x5'));var logger=require(_0xb41b('0x6'))('rpc');var config=require(_0xb41b('0x7'));var jayson=require(_0xb41b('0x8'));var client=jayson[_0xb41b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5455ce,_0x497242,_0x2704f0){return new BPromise(function(_0x29c30d,_0x53722a){return client[_0xb41b('0xa')](_0x5455ce,_0x2704f0)[_0xb41b('0xb')](function(_0x11b8b2){logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));logger[_0xb41b('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x497242,_0xb41b('0xe'),JSON['stringify'](_0x11b8b2));if(_0x11b8b2[_0xb41b('0x10')]){if(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x11')]===0x1f4){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error'][_0xb41b('0x12')]);return _0x53722a(_0x11b8b2[_0xb41b('0x10')][_0xb41b('0x12')]);}logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0x11b8b2['error']['message']);return _0x29c30d(_0x11b8b2['error'][_0xb41b('0x12')]);}else{logger[_0xb41b('0xc')](_0xb41b('0xd'),_0x497242,_0xb41b('0xe'));_0x29c30d(_0x11b8b2[_0xb41b('0x13')]['message']);}})[_0xb41b('0x14')](function(_0xd0b6b5){logger[_0xb41b('0x10')](_0xb41b('0xd'),_0x497242,_0xd0b6b5);_0x53722a(_0xd0b6b5);});});}exports[_0xb41b('0x15')]=function(_0x47154d){var _0x198783=this;return new Promise(function(_0x5df8c2,_0x4b3580){return db['VtigerAccount'][_0xb41b('0x16')]({'raw':_0x47154d['options']?_0x47154d[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x47154d[_0xb41b('0x17')]?_0x47154d['options']['where']||null:null,'attributes':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'limit':_0x47154d[_0xb41b('0x17')]?_0x47154d[_0xb41b('0x17')][_0xb41b('0x1a')]||null:null,'include':_0x47154d['options']?_0x47154d['options'][_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x47154d[_0xb41b('0x17')]['include'],function(_0x14e9c8){return{'model':db[_0x14e9c8[_0xb41b('0x1d')]],'as':_0x14e9c8['as'],'attributes':_0x14e9c8['attributes'],'include':_0x14e9c8[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x14e9c8['include'],function(_0xed3c7e){return{'model':db[_0xed3c7e['model']],'as':_0xed3c7e['as'],'attributes':_0xed3c7e[_0xb41b('0x19')],'include':_0xed3c7e[_0xb41b('0x1b')]?_['map'](_0xed3c7e[_0xb41b('0x1b')],function(_0x4265b8){return{'model':db[_0x4265b8['model']],'as':_0x4265b8['as'],'attributes':_0x4265b8['attributes']};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x46aecf){logger[_0xb41b('0xc')](_0xb41b('0x15'),_0x47154d);logger[_0xb41b('0xf')](_0xb41b('0x15'),_0x47154d,JSON[_0xb41b('0x1e')](_0x46aecf));_0x5df8c2(_0x46aecf);})['catch'](function(_0x26ef96){logger[_0xb41b('0x10')]('GetVtigerAccount',_0x26ef96[_0xb41b('0x12')],_0x47154d);_0x4b3580(_0x198783['error'](0x1f4,_0x26ef96[_0xb41b('0x12')]));});});};exports[_0xb41b('0x1f')]=function(_0x597a35){var _0x23a6ed=this;return new Promise(function(_0x4a95e7,_0x29da9f){return db[_0xb41b('0x20')]['find']({'raw':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x18')]===undefined?!![]:![]:!![],'where':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x21')]||null:null,'attributes':_0x597a35[_0xb41b('0x17')]?_0x597a35[_0xb41b('0x17')][_0xb41b('0x19')]||null:null,'include':_0x597a35[_0xb41b('0x17')]?_0x597a35['options'][_0xb41b('0x1b')]?_['map'](_0x597a35['options'][_0xb41b('0x1b')],function(_0x192ceb){return{'model':db[_0x192ceb[_0xb41b('0x1d')]],'as':_0x192ceb['as'],'attributes':_0x192ceb[_0xb41b('0x19')],'include':_0x192ceb[_0xb41b('0x1b')]?_[_0xb41b('0x1c')](_0x192ceb[_0xb41b('0x1b')],function(_0x197197){return{'model':db[_0x197197[_0xb41b('0x1d')]],'as':_0x197197['as'],'attributes':_0x197197[_0xb41b('0x19')],'include':_0x197197[_0xb41b('0x1b')]?_['map'](_0x197197[_0xb41b('0x1b')],function(_0x27990d){return{'model':db[_0x27990d[_0xb41b('0x1d')]],'as':_0x27990d['as'],'attributes':_0x27990d[_0xb41b('0x19')]};}):[]};}):[]};}):[]:[]})[_0xb41b('0xb')](function(_0x10b3f6){logger['info']('ShowVtigerAccount',_0x597a35);logger[_0xb41b('0xf')](_0xb41b('0x1f'),_0x597a35,JSON['stringify'](_0x10b3f6));_0x4a95e7(_0x10b3f6);})[_0xb41b('0x14')](function(_0x47363e){logger[_0xb41b('0x10')](_0xb41b('0x1f'),_0x47363e[_0xb41b('0x12')],_0x597a35);_0x29da9f(_0x23a6ed['error'](0x1f4,_0x47363e[_0xb41b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 86fbb49..443cf71 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 _0x7e2f=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','delete','/:id','destroy','exports','path','Router','fs-extra'];(function(_0x5f2af0,_0x279979){var _0x12bff=function(_0x279ddb){while(--_0x279ddb){_0x5f2af0['push'](_0x5f2af0['shift']());}};_0x12bff(++_0x279979);}(_0x7e2f,0x15d));var _0xf7e2=function(_0x30d9bf,_0x359bb6){_0x30d9bf=_0x30d9bf-0x0;var _0x2be61e=_0x7e2f[_0x30d9bf];return _0x2be61e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf7e2('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xf7e2('0x1')]();var fs_extra=require(_0xf7e2('0x2'));var auth=require(_0xf7e2('0x3'));var interaction=require(_0xf7e2('0x4'));var config=require(_0xf7e2('0x5'));var controller=require('./intVtigerConfiguration.controller');router[_0xf7e2('0x6')]('/',auth[_0xf7e2('0x7')](),controller[_0xf7e2('0x8')]);router[_0xf7e2('0x6')]('/:id',auth[_0xf7e2('0x7')](),controller[_0xf7e2('0x9')]);router[_0xf7e2('0x6')](_0xf7e2('0xa'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0xb')]);router[_0xf7e2('0x6')](_0xf7e2('0xc'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0xd')]);router[_0xf7e2('0x6')](_0xf7e2('0xe'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0xf')]);router[_0xf7e2('0x10')]('/',auth['isAuthenticated'](),controller[_0xf7e2('0x11')]);router['put']('/:id',auth[_0xf7e2('0x7')](),controller['update']);router[_0xf7e2('0x12')](_0xf7e2('0x13'),auth[_0xf7e2('0x7')](),controller[_0xf7e2('0x14')]);module[_0xf7e2('0x15')]=router; \ No newline at end of file +var _0x690d=['getFields','getSubjects','/:id/descriptions','getDescriptions','update','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','isAuthenticated','index','/:id','show','get','/:id/fields'];(function(_0x18576e,_0x207cbf){var _0x47ae29=function(_0x3a93c0){while(--_0x3a93c0){_0x18576e['push'](_0x18576e['shift']());}};_0x47ae29(++_0x207cbf);}(_0x690d,0x1bd));var _0xd690=function(_0x547210,_0x19a707){_0x547210=_0x547210-0x0;var _0x30182b=_0x690d[_0x547210];return _0x30182b;};'use strict';var multer=require('multer');var util=require(_0xd690('0x0'));var path=require(_0xd690('0x1'));var timeout=require(_0xd690('0x2'));var express=require(_0xd690('0x3'));var router=express[_0xd690('0x4')]();var fs_extra=require(_0xd690('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd690('0x6'));var config=require(_0xd690('0x7'));var controller=require(_0xd690('0x8'));router['get']('/',auth[_0xd690('0x9')](),controller[_0xd690('0xa')]);router['get'](_0xd690('0xb'),auth['isAuthenticated'](),controller[_0xd690('0xc')]);router[_0xd690('0xd')](_0xd690('0xe'),auth[_0xd690('0x9')](),controller[_0xd690('0xf')]);router[_0xd690('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xd690('0x10')]);router[_0xd690('0xd')](_0xd690('0x11'),auth[_0xd690('0x9')](),controller[_0xd690('0x12')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xd690('0xb'),auth[_0xd690('0x9')](),controller[_0xd690('0x13')]);router['delete'](_0xd690('0xb'),auth[_0xd690('0x9')](),controller['destroy']);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 158c685..505ee3e 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 _0x554b=['STRING','sequelize','exports'];(function(_0x582a0a,_0x3e9d8b){var _0x420349=function(_0x53b05f){while(--_0x53b05f){_0x582a0a['push'](_0x582a0a['shift']());}};_0x420349(++_0x3e9d8b);}(_0x554b,0x16f));var _0xb554=function(_0x3fba9f,_0x3b7b9b){_0x3fba9f=_0x3fba9f-0x0;var _0x192cf1=_0x554b[_0x3fba9f];return _0x192cf1;};'use strict';var Sequelize=require(_0xb554('0x0'));module[_0xb554('0x1')]={'name':{'type':Sequelize[_0xb554('0x2')]},'description':{'type':Sequelize[_0xb554('0x2')]}}; \ No newline at end of file +var _0x0fdb=['STRING','sequelize','exports'];(function(_0x56ef7f,_0x2f54e6){var _0x2974ce=function(_0x2410b0){while(--_0x2410b0){_0x56ef7f['push'](_0x56ef7f['shift']());}};_0x2974ce(++_0x2f54e6);}(_0x0fdb,0xe8));var _0xb0fd=function(_0x15ba60,_0x384469){_0x15ba60=_0x15ba60-0x0;var _0x1cec65=_0x0fdb[_0x15ba60];return _0x1cec65;};'use strict';var Sequelize=require(_0xb0fd('0x0'));module[_0xb0fd('0x1')]={'name':{'type':Sequelize[_0xb0fd('0x2')]},'description':{'type':Sequelize[_0xb0fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 5bfabed..f1442fe 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 _0x6cbf=['end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','error','stack','send','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','update','params','destroy','findOne','VtigerField','getFields','getSubjects','getDescriptions','eml-format','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x3365bd,_0x417902){var _0x47665c=function(_0x9a6eb2){while(--_0x9a6eb2){_0x3365bd['push'](_0x3365bd['shift']());}};_0x47665c(++_0x417902);}(_0x6cbf,0x122));var _0xf6cb=function(_0x5d34d4,_0x3dd95a){_0x5d34d4=_0x5d34d4-0x0;var _0x1e4ad4=_0x6cbf[_0x5d34d4];return _0x1e4ad4;};'use strict';var emlformat=require(_0xf6cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf6cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf6cb('0x2'));var BPromise=require(_0xf6cb('0x3'));var Mustache=require('mustache');var util=require(_0xf6cb('0x4'));var path=require(_0xf6cb('0x5'));var sox=require(_0xf6cb('0x6'));var csv=require('to-csv');var ejs=require(_0xf6cb('0x7'));var fs=require('fs');var fs_extra=require(_0xf6cb('0x8'));var _=require(_0xf6cb('0x9'));var squel=require('squel');var crypto=require(_0xf6cb('0xa'));var jsforce=require(_0xf6cb('0xb'));var deskjs=require(_0xf6cb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf6cb('0xd'));var authService=require(_0xf6cb('0xe'));var qs=require(_0xf6cb('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf6cb('0x10'))(_0xf6cb('0x11'));var utils=require(_0xf6cb('0x12'));var config=require(_0xf6cb('0x13'));var licenseUtil=require(_0xf6cb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa3b0d7,_0x8a8f58){_0x8a8f58=_0x8a8f58||0xcc;return function(_0x13790f){if(_0x13790f){return _0xa3b0d7[_0xf6cb('0x15')](_0x8a8f58);}return _0xa3b0d7['status'](_0x8a8f58)[_0xf6cb('0x16')]();};}function respondWithResult(_0x40bbc0,_0x2dfca7){_0x2dfca7=_0x2dfca7||0xc8;return function(_0x148227){if(_0x148227){return _0x40bbc0[_0xf6cb('0x17')](_0x2dfca7)[_0xf6cb('0x18')](_0x148227);}};}function respondWithFilteredResult(_0x230f09,_0x43f461){return function(_0x5e9bdc){if(_0x5e9bdc){var _0x106258=typeof _0x43f461['offset']===_0xf6cb('0x19')&&typeof _0x43f461[_0xf6cb('0x1a')]===_0xf6cb('0x19');var _0x2013b2=_0x5e9bdc['count'];var _0x52980d=_0x106258?0x0:_0x43f461['offset'];var _0x145da2=_0x106258?_0x5e9bdc[_0xf6cb('0x1b')]:_0x43f461[_0xf6cb('0x1c')]+_0x43f461['limit'];var _0x481c99;if(_0x145da2>=_0x2013b2){_0x145da2=_0x2013b2;_0x481c99=0xc8;}else{_0x481c99=0xce;}_0x230f09[_0xf6cb('0x17')](_0x481c99);return _0x230f09['set'](_0xf6cb('0x1d'),_0x52980d+'-'+_0x145da2+'/'+_0x2013b2)['json'](_0x5e9bdc);}return null;};}function patchUpdates(_0x22e715){return function(_0x12e8b7){try{jsonpatch[_0xf6cb('0x1e')](_0x12e8b7,_0x22e715,!![]);}catch(_0x14eb58){return BPromise[_0xf6cb('0x1f')](_0x14eb58);}return _0x12e8b7['save']();};}function saveUpdates(_0x20b593,_0x2dc1e3){return function(_0x1b569e){if(_0x1b569e){return _0x1b569e['update'](_0x20b593)['then'](function(_0x43f1f7){return _0x43f1f7;});}return null;};}function removeEntity(_0x5f0d71,_0x5a3a54){return function(_0x51692f){if(_0x51692f){return _0x51692f['destroy']()[_0xf6cb('0x20')](function(){_0x5f0d71[_0xf6cb('0x17')](0xcc)[_0xf6cb('0x16')]();});}};}function handleEntityNotFound(_0x407e28,_0x2b40f6){return function(_0xda91cc){if(!_0xda91cc){_0x407e28[_0xf6cb('0x15')](0x194);}return _0xda91cc;};}function handleError(_0x17e689,_0x409bdd){_0x409bdd=_0x409bdd||0x1f4;return function(_0x2f5be6){logger[_0xf6cb('0x21')](_0x2f5be6[_0xf6cb('0x22')]);if(_0x2f5be6['name']){delete _0x2f5be6['name'];}_0x17e689[_0xf6cb('0x17')](_0x409bdd)[_0xf6cb('0x23')](_0x2f5be6);};}exports[_0xf6cb('0x24')]=function(_0x2e30e6,_0x3da272){var _0x425ff9={},_0x2ed4a8={},_0x26e822={'count':0x0,'rows':[]};var _0x104dc7=_['map'](db[_0xf6cb('0x25')][_0xf6cb('0x26')],function(_0x362945){return{'name':_0x362945[_0xf6cb('0x27')],'type':_0x362945[_0xf6cb('0x28')][_0xf6cb('0x29')]};});_0x2ed4a8[_0xf6cb('0x2a')]=_[_0xf6cb('0x2b')](_0x104dc7,_0xf6cb('0x2c'));_0x2ed4a8['query']=_[_0xf6cb('0x2d')](_0x2e30e6[_0xf6cb('0x2e')]);_0x2ed4a8[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x2ed4a8[_0xf6cb('0x2a')],_0x2ed4a8[_0xf6cb('0x2e')]);_0x425ff9[_0xf6cb('0x31')]=_['intersection'](_0x2ed4a8[_0xf6cb('0x2a')],qs[_0xf6cb('0x32')](_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x425ff9['attributes']=_0x425ff9[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x425ff9[_0xf6cb('0x31')]:_0x2ed4a8[_0xf6cb('0x2a')];if(!_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x34')](_0xf6cb('0x35'))){_0x425ff9[_0xf6cb('0x1a')]=qs['limit'](_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x1a')]);_0x425ff9['offset']=qs[_0xf6cb('0x1c')](_0x2e30e6['query'][_0xf6cb('0x1c')]);}_0x425ff9[_0xf6cb('0x36')]=qs['sort'](_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x37')]);_0x425ff9[_0xf6cb('0x38')]=qs['filters'](_[_0xf6cb('0x39')](_0x2e30e6[_0xf6cb('0x2e')],_0x2ed4a8['filters']),_0x104dc7);if(_0x2e30e6[_0xf6cb('0x2e')][_0xf6cb('0x3a')]){_0x425ff9[_0xf6cb('0x38')]=_[_0xf6cb('0x3b')](_0x425ff9[_0xf6cb('0x38')],{'$or':_[_0xf6cb('0x2b')](_0x104dc7,function(_0x555290){if(_0x555290[_0xf6cb('0x28')]!==_0xf6cb('0x3c')){var _0x2fe25f={};_0x2fe25f[_0x555290[_0xf6cb('0x2c')]]={'$like':'%'+_0x2e30e6['query'][_0xf6cb('0x3a')]+'%'};return _0x2fe25f;}})});}_0x425ff9=_['merge']({},_0x425ff9,_0x2e30e6['options']);var _0x4f5cbc={'where':_0x425ff9[_0xf6cb('0x38')]};return db[_0xf6cb('0x25')][_0xf6cb('0x1b')](_0x4f5cbc)[_0xf6cb('0x20')](function(_0x5b9c3c){_0x26e822[_0xf6cb('0x1b')]=_0x5b9c3c;if(_0x2e30e6['query'][_0xf6cb('0x3d')]){_0x425ff9[_0xf6cb('0x3e')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0xf6cb('0x3f')](_0x425ff9);})[_0xf6cb('0x20')](function(_0x364e12){_0x26e822['rows']=_0x364e12;return _0x26e822;})[_0xf6cb('0x20')](respondWithFilteredResult(_0x3da272,_0x425ff9))[_0xf6cb('0x40')](handleError(_0x3da272,null));};exports[_0xf6cb('0x41')]=function(_0x382a5a,_0x3f85a0){var _0x1639fa={'raw':![],'where':{'id':_0x382a5a['params']['id']}},_0x13c5de={};_0x13c5de[_0xf6cb('0x2a')]=_[_0xf6cb('0x2d')](db[_0xf6cb('0x25')][_0xf6cb('0x26')]);_0x13c5de[_0xf6cb('0x2e')]=_[_0xf6cb('0x2d')](_0x382a5a['query']);_0x13c5de[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x13c5de[_0xf6cb('0x2a')],_0x13c5de[_0xf6cb('0x2e')]);_0x1639fa[_0xf6cb('0x31')]=_['intersection'](_0x13c5de['model'],qs[_0xf6cb('0x32')](_0x382a5a[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x1639fa[_0xf6cb('0x31')]=_0x1639fa[_0xf6cb('0x31')]['length']?_0x1639fa[_0xf6cb('0x31')]:_0x13c5de[_0xf6cb('0x2a')];if(_0x382a5a[_0xf6cb('0x2e')]['includeAll']){_0x1639fa['include']=[{'all':!![]}];}_0x1639fa=_['merge']({},_0x1639fa,_0x382a5a[_0xf6cb('0x42')]);return db['VtigerConfiguration'][_0xf6cb('0x43')](_0x1639fa)[_0xf6cb('0x20')](handleEntityNotFound(_0x3f85a0,null))['then'](respondWithResult(_0x3f85a0,null))[_0xf6cb('0x40')](handleError(_0x3f85a0,null));};exports[_0xf6cb('0x44')]=function(_0x591303,_0x360ffa){return db[_0xf6cb('0x25')][_0xf6cb('0x44')](_0x591303[_0xf6cb('0x45')],{})[_0xf6cb('0x20')](respondWithResult(_0x360ffa,0xc9))[_0xf6cb('0x40')](handleError(_0x360ffa,null));};exports[_0xf6cb('0x46')]=function(_0x5347d3,_0x5a5f09){if(_0x5347d3[_0xf6cb('0x45')]['id']){delete _0x5347d3[_0xf6cb('0x45')]['id'];}return db[_0xf6cb('0x25')][_0xf6cb('0x43')]({'where':{'id':_0x5347d3[_0xf6cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x5a5f09,null))[_0xf6cb('0x20')](saveUpdates(_0x5347d3[_0xf6cb('0x45')],null))[_0xf6cb('0x20')](respondWithResult(_0x5a5f09,null))[_0xf6cb('0x40')](handleError(_0x5a5f09,null));};exports[_0xf6cb('0x48')]=function(_0x47db41,_0x36aa55){return db[_0xf6cb('0x25')]['find']({'where':{'id':_0x47db41['params']['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x36aa55,null))['then'](removeEntity(_0x36aa55,null))[_0xf6cb('0x40')](handleError(_0x36aa55,null));};exports['getFields']=function(_0x4b9502,_0x530e9d,_0x35b7ce){var _0x1d334f={};var _0x1aaac3={};var _0x1a9012;var _0x2629da;return db[_0xf6cb('0x25')][_0xf6cb('0x49')]({'where':{'id':_0x4b9502[_0xf6cb('0x47')]['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x530e9d,null))[_0xf6cb('0x20')](function(_0x2fa270){if(_0x2fa270){_0x1a9012=_0x2fa270;_0x1aaac3[_0xf6cb('0x2a')]=_[_0xf6cb('0x2d')](db[_0xf6cb('0x4a')][_0xf6cb('0x26')]);_0x1aaac3['query']=_[_0xf6cb('0x2d')](_0x4b9502[_0xf6cb('0x2e')]);_0x1aaac3[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x1aaac3[_0xf6cb('0x2a')],_0x1aaac3[_0xf6cb('0x2e')]);_0x1d334f[_0xf6cb('0x31')]=_[_0xf6cb('0x30')](_0x1aaac3[_0xf6cb('0x2a')],qs['fields'](_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x1d334f[_0xf6cb('0x31')]=_0x1d334f[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x1d334f['attributes']:_0x1aaac3[_0xf6cb('0x2a')];_0x1d334f['order']=qs['sort'](_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x37')]);_0x1d334f[_0xf6cb('0x38')]=qs[_0xf6cb('0x2f')](_[_0xf6cb('0x39')](_0x4b9502[_0xf6cb('0x2e')],_0x1aaac3[_0xf6cb('0x2f')]));if(_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x3a')]){_0x1d334f[_0xf6cb('0x38')]=_[_0xf6cb('0x3b')](_0x1d334f[_0xf6cb('0x38')],{'$or':_[_0xf6cb('0x2b')](_0x1d334f[_0xf6cb('0x31')],function(_0x418ebe){var _0x3264b1={};_0x3264b1[_0x418ebe]={'$like':'%'+_0x4b9502[_0xf6cb('0x2e')][_0xf6cb('0x3a')]+'%'};return _0x3264b1;})});}_0x1d334f=_['merge']({},_0x1d334f,_0x4b9502[_0xf6cb('0x42')]);return _0x1a9012[_0xf6cb('0x4b')](_0x1d334f);}})[_0xf6cb('0x20')](function(_0x6904f6){if(_0x6904f6){_0x2629da=_0x6904f6[_0xf6cb('0x33')];if(!_0x4b9502['query']['hasOwnProperty']('nolimit')){_0x1d334f[_0xf6cb('0x1a')]=qs[_0xf6cb('0x1a')](_0x4b9502['query']['limit']);_0x1d334f[_0xf6cb('0x1c')]=qs[_0xf6cb('0x1c')](_0x4b9502[_0xf6cb('0x2e')]['offset']);}return _0x1a9012[_0xf6cb('0x4b')](_0x1d334f);}})['then'](function(_0x55f178){if(_0x55f178){return _0x55f178?{'count':_0x2629da,'rows':_0x55f178}:null;}})[_0xf6cb('0x20')](respondWithResult(_0x530e9d,null))[_0xf6cb('0x40')](handleError(_0x530e9d,null));};exports[_0xf6cb('0x4c')]=function(_0x111364,_0x420b24,_0xabe88d){var _0x2c95fa={};var _0x262976={};var _0x2105de;var _0x1959b1;return db[_0xf6cb('0x25')][_0xf6cb('0x49')]({'where':{'id':_0x111364[_0xf6cb('0x47')]['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x420b24,null))[_0xf6cb('0x20')](function(_0xe9c16){if(_0xe9c16){_0x2105de=_0xe9c16;_0x262976['model']=_['keys'](db[_0xf6cb('0x4a')][_0xf6cb('0x26')]);_0x262976['query']=_[_0xf6cb('0x2d')](_0x111364['query']);_0x262976[_0xf6cb('0x2f')]=_[_0xf6cb('0x30')](_0x262976[_0xf6cb('0x2a')],_0x262976[_0xf6cb('0x2e')]);_0x2c95fa[_0xf6cb('0x31')]=_['intersection'](_0x262976[_0xf6cb('0x2a')],qs[_0xf6cb('0x32')](_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x2c95fa[_0xf6cb('0x31')]=_0x2c95fa[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x2c95fa['attributes']:_0x262976['model'];_0x2c95fa[_0xf6cb('0x36')]=qs[_0xf6cb('0x37')](_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x37')]);_0x2c95fa[_0xf6cb('0x38')]=qs['filters'](_[_0xf6cb('0x39')](_0x111364['query'],_0x262976[_0xf6cb('0x2f')]));if(_0x111364[_0xf6cb('0x2e')]['filter']){_0x2c95fa['where']=_[_0xf6cb('0x3b')](_0x2c95fa[_0xf6cb('0x38')],{'$or':_['map'](_0x2c95fa[_0xf6cb('0x31')],function(_0x40d09e){var _0x325548={};_0x325548[_0x40d09e]={'$like':'%'+_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x3a')]+'%'};return _0x325548;})});}_0x2c95fa=_[_0xf6cb('0x3b')]({},_0x2c95fa,_0x111364['options']);return _0x2105de[_0xf6cb('0x4c')](_0x2c95fa);}})[_0xf6cb('0x20')](function(_0x5e7f77){if(_0x5e7f77){_0x1959b1=_0x5e7f77[_0xf6cb('0x33')];if(!_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x34')](_0xf6cb('0x35'))){_0x2c95fa[_0xf6cb('0x1a')]=qs[_0xf6cb('0x1a')](_0x111364[_0xf6cb('0x2e')][_0xf6cb('0x1a')]);_0x2c95fa['offset']=qs[_0xf6cb('0x1c')](_0x111364['query']['offset']);}return _0x2105de['getSubjects'](_0x2c95fa);}})[_0xf6cb('0x20')](function(_0x888ea2){if(_0x888ea2){return _0x888ea2?{'count':_0x1959b1,'rows':_0x888ea2}:null;}})['then'](respondWithResult(_0x420b24,null))[_0xf6cb('0x40')](handleError(_0x420b24,null));};exports[_0xf6cb('0x4d')]=function(_0x5768c9,_0x5b9d93,_0x257d20){var _0x4aee40={};var _0x5b6d53={};var _0x1ee32b;var _0x345abe;return db[_0xf6cb('0x25')][_0xf6cb('0x49')]({'where':{'id':_0x5768c9[_0xf6cb('0x47')]['id']}})[_0xf6cb('0x20')](handleEntityNotFound(_0x5b9d93,null))[_0xf6cb('0x20')](function(_0x1f5546){if(_0x1f5546){_0x1ee32b=_0x1f5546;_0x5b6d53[_0xf6cb('0x2a')]=_['keys'](db[_0xf6cb('0x4a')]['rawAttributes']);_0x5b6d53[_0xf6cb('0x2e')]=_[_0xf6cb('0x2d')](_0x5768c9[_0xf6cb('0x2e')]);_0x5b6d53[_0xf6cb('0x2f')]=_['intersection'](_0x5b6d53[_0xf6cb('0x2a')],_0x5b6d53['query']);_0x4aee40[_0xf6cb('0x31')]=_['intersection'](_0x5b6d53[_0xf6cb('0x2a')],qs['fields'](_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x32')]));_0x4aee40[_0xf6cb('0x31')]=_0x4aee40[_0xf6cb('0x31')][_0xf6cb('0x33')]?_0x4aee40[_0xf6cb('0x31')]:_0x5b6d53[_0xf6cb('0x2a')];_0x4aee40[_0xf6cb('0x36')]=qs[_0xf6cb('0x37')](_0x5768c9['query']['sort']);_0x4aee40[_0xf6cb('0x38')]=qs[_0xf6cb('0x2f')](_[_0xf6cb('0x39')](_0x5768c9['query'],_0x5b6d53[_0xf6cb('0x2f')]));if(_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x3a')]){_0x4aee40[_0xf6cb('0x38')]=_[_0xf6cb('0x3b')](_0x4aee40[_0xf6cb('0x38')],{'$or':_[_0xf6cb('0x2b')](_0x4aee40[_0xf6cb('0x31')],function(_0x454f74){var _0x31f6fa={};_0x31f6fa[_0x454f74]={'$like':'%'+_0x5768c9[_0xf6cb('0x2e')]['filter']+'%'};return _0x31f6fa;})});}_0x4aee40=_[_0xf6cb('0x3b')]({},_0x4aee40,_0x5768c9[_0xf6cb('0x42')]);return _0x1ee32b[_0xf6cb('0x4d')](_0x4aee40);}})[_0xf6cb('0x20')](function(_0x4b3411){if(_0x4b3411){_0x345abe=_0x4b3411['length'];if(!_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x34')](_0xf6cb('0x35'))){_0x4aee40['limit']=qs[_0xf6cb('0x1a')](_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x1a')]);_0x4aee40[_0xf6cb('0x1c')]=qs[_0xf6cb('0x1c')](_0x5768c9[_0xf6cb('0x2e')][_0xf6cb('0x1c')]);}return _0x1ee32b['getDescriptions'](_0x4aee40);}})['then'](function(_0xd2e29){if(_0xd2e29){return _0xd2e29?{'count':_0x345abe,'rows':_0xd2e29}:null;}})[_0xf6cb('0x20')](respondWithResult(_0x5b9d93,null))[_0xf6cb('0x40')](handleError(_0x5b9d93,null));}; \ No newline at end of file +var _0xab09=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','VtigerField','length','getFields','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','VtigerConfiguration','type','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','where','filters'];(function(_0x5edf93,_0x5b4456){var _0x19e594=function(_0x1fc812){while(--_0x1fc812){_0x5edf93['push'](_0x5edf93['shift']());}};_0x19e594(++_0x5b4456);}(_0xab09,0x6a));var _0x9ab0=function(_0x5bb3a0,_0x3fd23a){_0x5bb3a0=_0x5bb3a0-0x0;var _0x1469dd=_0xab09[_0x5bb3a0];return _0x1469dd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9ab0('0x0'));var zipdir=require(_0x9ab0('0x1'));var jsonpatch=require(_0x9ab0('0x2'));var rp=require(_0x9ab0('0x3'));var moment=require(_0x9ab0('0x4'));var BPromise=require(_0x9ab0('0x5'));var Mustache=require(_0x9ab0('0x6'));var util=require(_0x9ab0('0x7'));var path=require(_0x9ab0('0x8'));var sox=require(_0x9ab0('0x9'));var csv=require(_0x9ab0('0xa'));var ejs=require(_0x9ab0('0xb'));var fs=require('fs');var fs_extra=require(_0x9ab0('0xc'));var _=require(_0x9ab0('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9ab0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9ab0('0xf'));var Papa=require(_0x9ab0('0x10'));var Redis=require(_0x9ab0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9ab0('0x12'));var as=require(_0x9ab0('0x13'));var hardwareService=require(_0x9ab0('0x14'));var logger=require(_0x9ab0('0x15'))(_0x9ab0('0x16'));var utils=require('../../config/utils');var config=require(_0x9ab0('0x17'));var licenseUtil=require(_0x9ab0('0x18'));var db=require(_0x9ab0('0x19'))['db'];function respondWithStatusCode(_0x14181f,_0x296f98){_0x296f98=_0x296f98||0xcc;return function(_0x2d6756){if(_0x2d6756){return _0x14181f['sendStatus'](_0x296f98);}return _0x14181f[_0x9ab0('0x1a')](_0x296f98)[_0x9ab0('0x1b')]();};}function respondWithResult(_0xb3d368,_0x3a5dfd){_0x3a5dfd=_0x3a5dfd||0xc8;return function(_0x5e9b92){if(_0x5e9b92){return _0xb3d368[_0x9ab0('0x1a')](_0x3a5dfd)['json'](_0x5e9b92);}};}function respondWithFilteredResult(_0x16e51c,_0x4dcf82){return function(_0xdfc9a9){if(_0xdfc9a9){var _0x4ad5f9=typeof _0x4dcf82[_0x9ab0('0x1c')]===_0x9ab0('0x1d')&&typeof _0x4dcf82[_0x9ab0('0x1e')]===_0x9ab0('0x1d');var _0x4eb4fe=_0xdfc9a9[_0x9ab0('0x1f')];var _0x42e166=_0x4ad5f9?0x0:_0x4dcf82[_0x9ab0('0x1c')];var _0x548e03=_0x4ad5f9?_0xdfc9a9['count']:_0x4dcf82['offset']+_0x4dcf82['limit'];var _0x2b0c56;if(_0x548e03>=_0x4eb4fe){_0x548e03=_0x4eb4fe;_0x2b0c56=0xc8;}else{_0x2b0c56=0xce;}_0x16e51c[_0x9ab0('0x1a')](_0x2b0c56);return _0x16e51c[_0x9ab0('0x20')]('Content-Range',_0x42e166+'-'+_0x548e03+'/'+_0x4eb4fe)[_0x9ab0('0x21')](_0xdfc9a9);}return null;};}function patchUpdates(_0x26c399){return function(_0xd54b7){try{jsonpatch[_0x9ab0('0x22')](_0xd54b7,_0x26c399,!![]);}catch(_0xc3688f){return BPromise[_0x9ab0('0x23')](_0xc3688f);}return _0xd54b7[_0x9ab0('0x24')]();};}function saveUpdates(_0x1bbbb7,_0x4cdc72){return function(_0x2ba512){if(_0x2ba512){return _0x2ba512[_0x9ab0('0x25')](_0x1bbbb7)[_0x9ab0('0x26')](function(_0x50cf72){return _0x50cf72;});}return null;};}function removeEntity(_0x172011,_0x4c5a5f){return function(_0x46b44e){if(_0x46b44e){return _0x46b44e[_0x9ab0('0x27')]()[_0x9ab0('0x26')](function(){_0x172011['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46746d,_0x6ea1f1){return function(_0x332db1){if(!_0x332db1){_0x46746d[_0x9ab0('0x28')](0x194);}return _0x332db1;};}function handleError(_0x514afa,_0x2ab6e9){_0x2ab6e9=_0x2ab6e9||0x1f4;return function(_0x212b6a){logger[_0x9ab0('0x29')](_0x212b6a[_0x9ab0('0x2a')]);if(_0x212b6a[_0x9ab0('0x2b')]){delete _0x212b6a[_0x9ab0('0x2b')];}_0x514afa[_0x9ab0('0x1a')](_0x2ab6e9)[_0x9ab0('0x2c')](_0x212b6a);};}exports[_0x9ab0('0x2d')]=function(_0x367b31,_0x5c2561){var _0x3c3274={},_0x3606bd={},_0x3709ea={'count':0x0,'rows':[]};var _0x2c3bcf=_[_0x9ab0('0x2e')](db[_0x9ab0('0x2f')]['rawAttributes'],function(_0x341928){return{'name':_0x341928['fieldName'],'type':_0x341928[_0x9ab0('0x30')]['key']};});_0x3606bd[_0x9ab0('0x31')]=_[_0x9ab0('0x2e')](_0x2c3bcf,_0x9ab0('0x2b'));_0x3606bd[_0x9ab0('0x32')]=_[_0x9ab0('0x33')](_0x367b31[_0x9ab0('0x32')]);_0x3606bd['filters']=_[_0x9ab0('0x34')](_0x3606bd[_0x9ab0('0x31')],_0x3606bd[_0x9ab0('0x32')]);_0x3c3274[_0x9ab0('0x35')]=_[_0x9ab0('0x34')](_0x3606bd[_0x9ab0('0x31')],qs[_0x9ab0('0x36')](_0x367b31['query'][_0x9ab0('0x36')]));_0x3c3274[_0x9ab0('0x35')]=_0x3c3274[_0x9ab0('0x35')]['length']?_0x3c3274[_0x9ab0('0x35')]:_0x3606bd[_0x9ab0('0x31')];if(!_0x367b31[_0x9ab0('0x32')][_0x9ab0('0x37')]('nolimit')){_0x3c3274[_0x9ab0('0x1e')]=qs[_0x9ab0('0x1e')](_0x367b31[_0x9ab0('0x32')][_0x9ab0('0x1e')]);_0x3c3274['offset']=qs[_0x9ab0('0x1c')](_0x367b31[_0x9ab0('0x32')][_0x9ab0('0x1c')]);}_0x3c3274[_0x9ab0('0x38')]=qs[_0x9ab0('0x39')](_0x367b31[_0x9ab0('0x32')][_0x9ab0('0x39')]);_0x3c3274[_0x9ab0('0x3a')]=qs[_0x9ab0('0x3b')](_[_0x9ab0('0x3c')](_0x367b31['query'],_0x3606bd[_0x9ab0('0x3b')]),_0x2c3bcf);if(_0x367b31[_0x9ab0('0x32')][_0x9ab0('0x3d')]){_0x3c3274['where']=_[_0x9ab0('0x3e')](_0x3c3274['where'],{'$or':_[_0x9ab0('0x2e')](_0x2c3bcf,function(_0xe256cb){if(_0xe256cb['type']!==_0x9ab0('0x3f')){var _0x315273={};_0x315273[_0xe256cb[_0x9ab0('0x2b')]]={'$like':'%'+_0x367b31['query']['filter']+'%'};return _0x315273;}})});}_0x3c3274=_[_0x9ab0('0x3e')]({},_0x3c3274,_0x367b31[_0x9ab0('0x40')]);var _0x4abdd0={'where':_0x3c3274[_0x9ab0('0x3a')]};return db[_0x9ab0('0x2f')][_0x9ab0('0x1f')](_0x4abdd0)[_0x9ab0('0x26')](function(_0x58b4b9){_0x3709ea[_0x9ab0('0x1f')]=_0x58b4b9;if(_0x367b31[_0x9ab0('0x32')][_0x9ab0('0x41')]){_0x3c3274[_0x9ab0('0x42')]=[{'all':!![]}];}return db[_0x9ab0('0x2f')][_0x9ab0('0x43')](_0x3c3274);})[_0x9ab0('0x26')](function(_0x1bc2c0){_0x3709ea[_0x9ab0('0x44')]=_0x1bc2c0;return _0x3709ea;})[_0x9ab0('0x26')](respondWithFilteredResult(_0x5c2561,_0x3c3274))[_0x9ab0('0x45')](handleError(_0x5c2561,null));};exports[_0x9ab0('0x46')]=function(_0x258a2c,_0x41cc63){var _0x1c9ed9={'raw':![],'where':{'id':_0x258a2c[_0x9ab0('0x47')]['id']}},_0x5ec09e={};_0x5ec09e['model']=_[_0x9ab0('0x33')](db[_0x9ab0('0x2f')][_0x9ab0('0x48')]);_0x5ec09e[_0x9ab0('0x32')]=_['keys'](_0x258a2c[_0x9ab0('0x32')]);_0x5ec09e[_0x9ab0('0x3b')]=_[_0x9ab0('0x34')](_0x5ec09e[_0x9ab0('0x31')],_0x5ec09e[_0x9ab0('0x32')]);_0x1c9ed9[_0x9ab0('0x35')]=_[_0x9ab0('0x34')](_0x5ec09e[_0x9ab0('0x31')],qs[_0x9ab0('0x36')](_0x258a2c['query'][_0x9ab0('0x36')]));_0x1c9ed9['attributes']=_0x1c9ed9['attributes']['length']?_0x1c9ed9[_0x9ab0('0x35')]:_0x5ec09e[_0x9ab0('0x31')];if(_0x258a2c['query'][_0x9ab0('0x41')]){_0x1c9ed9[_0x9ab0('0x42')]=[{'all':!![]}];}_0x1c9ed9=_[_0x9ab0('0x3e')]({},_0x1c9ed9,_0x258a2c[_0x9ab0('0x40')]);return db[_0x9ab0('0x2f')][_0x9ab0('0x49')](_0x1c9ed9)[_0x9ab0('0x26')](handleEntityNotFound(_0x41cc63,null))[_0x9ab0('0x26')](respondWithResult(_0x41cc63,null))['catch'](handleError(_0x41cc63,null));};exports['create']=function(_0x3084fd,_0x4db354){return db[_0x9ab0('0x2f')][_0x9ab0('0x4a')](_0x3084fd[_0x9ab0('0x4b')],{})[_0x9ab0('0x26')](respondWithResult(_0x4db354,0xc9))[_0x9ab0('0x45')](handleError(_0x4db354,null));};exports[_0x9ab0('0x25')]=function(_0x58dd68,_0x25d9c1){if(_0x58dd68[_0x9ab0('0x4b')]['id']){delete _0x58dd68['body']['id'];}return db[_0x9ab0('0x2f')][_0x9ab0('0x49')]({'where':{'id':_0x58dd68[_0x9ab0('0x47')]['id']}})['then'](handleEntityNotFound(_0x25d9c1,null))['then'](saveUpdates(_0x58dd68[_0x9ab0('0x4b')],null))[_0x9ab0('0x26')](respondWithResult(_0x25d9c1,null))[_0x9ab0('0x45')](handleError(_0x25d9c1,null));};exports[_0x9ab0('0x27')]=function(_0x5a6697,_0x1f5526){return db['VtigerConfiguration']['find']({'where':{'id':_0x5a6697[_0x9ab0('0x47')]['id']}})[_0x9ab0('0x26')](handleEntityNotFound(_0x1f5526,null))['then'](removeEntity(_0x1f5526,null))[_0x9ab0('0x45')](handleError(_0x1f5526,null));};exports['getFields']=function(_0x42340a,_0x1798a6,_0x5f0db0){var _0x4f5ee0={};var _0x289711={};var _0x587f39;var _0xc2caf1;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x42340a[_0x9ab0('0x47')]['id']}})[_0x9ab0('0x26')](handleEntityNotFound(_0x1798a6,null))[_0x9ab0('0x26')](function(_0x3d5b6a){if(_0x3d5b6a){_0x587f39=_0x3d5b6a;_0x289711[_0x9ab0('0x31')]=_[_0x9ab0('0x33')](db[_0x9ab0('0x4c')][_0x9ab0('0x48')]);_0x289711[_0x9ab0('0x32')]=_[_0x9ab0('0x33')](_0x42340a['query']);_0x289711[_0x9ab0('0x3b')]=_['intersection'](_0x289711[_0x9ab0('0x31')],_0x289711['query']);_0x4f5ee0[_0x9ab0('0x35')]=_[_0x9ab0('0x34')](_0x289711['model'],qs[_0x9ab0('0x36')](_0x42340a[_0x9ab0('0x32')]['fields']));_0x4f5ee0[_0x9ab0('0x35')]=_0x4f5ee0[_0x9ab0('0x35')][_0x9ab0('0x4d')]?_0x4f5ee0[_0x9ab0('0x35')]:_0x289711[_0x9ab0('0x31')];_0x4f5ee0[_0x9ab0('0x38')]=qs['sort'](_0x42340a[_0x9ab0('0x32')]['sort']);_0x4f5ee0[_0x9ab0('0x3a')]=qs[_0x9ab0('0x3b')](_['pick'](_0x42340a['query'],_0x289711[_0x9ab0('0x3b')]));if(_0x42340a['query'][_0x9ab0('0x3d')]){_0x4f5ee0['where']=_[_0x9ab0('0x3e')](_0x4f5ee0['where'],{'$or':_[_0x9ab0('0x2e')](_0x4f5ee0[_0x9ab0('0x35')],function(_0x383161){var _0x10a0a4={};_0x10a0a4[_0x383161]={'$like':'%'+_0x42340a[_0x9ab0('0x32')][_0x9ab0('0x3d')]+'%'};return _0x10a0a4;})});}_0x4f5ee0=_[_0x9ab0('0x3e')]({},_0x4f5ee0,_0x42340a[_0x9ab0('0x40')]);return _0x587f39[_0x9ab0('0x4e')](_0x4f5ee0);}})['then'](function(_0x89595f){if(_0x89595f){_0xc2caf1=_0x89595f[_0x9ab0('0x4d')];if(!_0x42340a['query'][_0x9ab0('0x37')](_0x9ab0('0x4f'))){_0x4f5ee0[_0x9ab0('0x1e')]=qs['limit'](_0x42340a[_0x9ab0('0x32')][_0x9ab0('0x1e')]);_0x4f5ee0[_0x9ab0('0x1c')]=qs[_0x9ab0('0x1c')](_0x42340a[_0x9ab0('0x32')][_0x9ab0('0x1c')]);}return _0x587f39[_0x9ab0('0x4e')](_0x4f5ee0);}})[_0x9ab0('0x26')](function(_0x53bd1c){if(_0x53bd1c){return _0x53bd1c?{'count':_0xc2caf1,'rows':_0x53bd1c}:null;}})['then'](respondWithResult(_0x1798a6,null))[_0x9ab0('0x45')](handleError(_0x1798a6,null));};exports[_0x9ab0('0x50')]=function(_0x3f5ce1,_0x51855b,_0x4a95af){var _0x3fea5f={};var _0x3c3204={};var _0x3cfdbd;var _0x5e8226;return db[_0x9ab0('0x2f')][_0x9ab0('0x51')]({'where':{'id':_0x3f5ce1['params']['id']}})['then'](handleEntityNotFound(_0x51855b,null))[_0x9ab0('0x26')](function(_0x362dfe){if(_0x362dfe){_0x3cfdbd=_0x362dfe;_0x3c3204[_0x9ab0('0x31')]=_[_0x9ab0('0x33')](db[_0x9ab0('0x4c')][_0x9ab0('0x48')]);_0x3c3204[_0x9ab0('0x32')]=_[_0x9ab0('0x33')](_0x3f5ce1[_0x9ab0('0x32')]);_0x3c3204[_0x9ab0('0x3b')]=_['intersection'](_0x3c3204[_0x9ab0('0x31')],_0x3c3204[_0x9ab0('0x32')]);_0x3fea5f['attributes']=_['intersection'](_0x3c3204['model'],qs[_0x9ab0('0x36')](_0x3f5ce1['query'][_0x9ab0('0x36')]));_0x3fea5f[_0x9ab0('0x35')]=_0x3fea5f[_0x9ab0('0x35')][_0x9ab0('0x4d')]?_0x3fea5f[_0x9ab0('0x35')]:_0x3c3204[_0x9ab0('0x31')];_0x3fea5f[_0x9ab0('0x38')]=qs[_0x9ab0('0x39')](_0x3f5ce1['query'][_0x9ab0('0x39')]);_0x3fea5f[_0x9ab0('0x3a')]=qs[_0x9ab0('0x3b')](_[_0x9ab0('0x3c')](_0x3f5ce1[_0x9ab0('0x32')],_0x3c3204[_0x9ab0('0x3b')]));if(_0x3f5ce1[_0x9ab0('0x32')][_0x9ab0('0x3d')]){_0x3fea5f[_0x9ab0('0x3a')]=_[_0x9ab0('0x3e')](_0x3fea5f['where'],{'$or':_[_0x9ab0('0x2e')](_0x3fea5f['attributes'],function(_0x20b22e){var _0x16eabd={};_0x16eabd[_0x20b22e]={'$like':'%'+_0x3f5ce1[_0x9ab0('0x32')]['filter']+'%'};return _0x16eabd;})});}_0x3fea5f=_[_0x9ab0('0x3e')]({},_0x3fea5f,_0x3f5ce1['options']);return _0x3cfdbd[_0x9ab0('0x50')](_0x3fea5f);}})[_0x9ab0('0x26')](function(_0x1becdc){if(_0x1becdc){_0x5e8226=_0x1becdc[_0x9ab0('0x4d')];if(!_0x3f5ce1['query'][_0x9ab0('0x37')](_0x9ab0('0x4f'))){_0x3fea5f[_0x9ab0('0x1e')]=qs[_0x9ab0('0x1e')](_0x3f5ce1[_0x9ab0('0x32')][_0x9ab0('0x1e')]);_0x3fea5f[_0x9ab0('0x1c')]=qs['offset'](_0x3f5ce1[_0x9ab0('0x32')][_0x9ab0('0x1c')]);}return _0x3cfdbd[_0x9ab0('0x50')](_0x3fea5f);}})[_0x9ab0('0x26')](function(_0x1c4c95){if(_0x1c4c95){return _0x1c4c95?{'count':_0x5e8226,'rows':_0x1c4c95}:null;}})[_0x9ab0('0x26')](respondWithResult(_0x51855b,null))[_0x9ab0('0x45')](handleError(_0x51855b,null));};exports['getDescriptions']=function(_0x321f29,_0x580901,_0x443c5c){var _0x52656d={};var _0x4f2473={};var _0x555a2f;var _0x12cbc3;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x321f29['params']['id']}})['then'](handleEntityNotFound(_0x580901,null))['then'](function(_0x2f29c8){if(_0x2f29c8){_0x555a2f=_0x2f29c8;_0x4f2473['model']=_[_0x9ab0('0x33')](db[_0x9ab0('0x4c')]['rawAttributes']);_0x4f2473[_0x9ab0('0x32')]=_[_0x9ab0('0x33')](_0x321f29[_0x9ab0('0x32')]);_0x4f2473[_0x9ab0('0x3b')]=_[_0x9ab0('0x34')](_0x4f2473[_0x9ab0('0x31')],_0x4f2473['query']);_0x52656d[_0x9ab0('0x35')]=_[_0x9ab0('0x34')](_0x4f2473[_0x9ab0('0x31')],qs[_0x9ab0('0x36')](_0x321f29[_0x9ab0('0x32')][_0x9ab0('0x36')]));_0x52656d[_0x9ab0('0x35')]=_0x52656d[_0x9ab0('0x35')][_0x9ab0('0x4d')]?_0x52656d['attributes']:_0x4f2473[_0x9ab0('0x31')];_0x52656d[_0x9ab0('0x38')]=qs[_0x9ab0('0x39')](_0x321f29[_0x9ab0('0x32')][_0x9ab0('0x39')]);_0x52656d[_0x9ab0('0x3a')]=qs[_0x9ab0('0x3b')](_[_0x9ab0('0x3c')](_0x321f29[_0x9ab0('0x32')],_0x4f2473[_0x9ab0('0x3b')]));if(_0x321f29[_0x9ab0('0x32')]['filter']){_0x52656d['where']=_[_0x9ab0('0x3e')](_0x52656d['where'],{'$or':_['map'](_0x52656d[_0x9ab0('0x35')],function(_0x45150c){var _0x45762f={};_0x45762f[_0x45150c]={'$like':'%'+_0x321f29[_0x9ab0('0x32')][_0x9ab0('0x3d')]+'%'};return _0x45762f;})});}_0x52656d=_[_0x9ab0('0x3e')]({},_0x52656d,_0x321f29[_0x9ab0('0x40')]);return _0x555a2f[_0x9ab0('0x52')](_0x52656d);}})[_0x9ab0('0x26')](function(_0x4c7d49){if(_0x4c7d49){_0x12cbc3=_0x4c7d49[_0x9ab0('0x4d')];if(!_0x321f29['query'][_0x9ab0('0x37')](_0x9ab0('0x4f'))){_0x52656d[_0x9ab0('0x1e')]=qs[_0x9ab0('0x1e')](_0x321f29['query']['limit']);_0x52656d[_0x9ab0('0x1c')]=qs[_0x9ab0('0x1c')](_0x321f29[_0x9ab0('0x32')][_0x9ab0('0x1c')]);}return _0x555a2f['getDescriptions'](_0x52656d);}})[_0x9ab0('0x26')](function(_0x211e99){if(_0x211e99){return _0x211e99?{'count':_0x12cbc3,'rows':_0x211e99}:null;}})[_0x9ab0('0x26')](respondWithResult(_0x580901,null))[_0x9ab0('0x45')](handleError(_0x580901,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 9862610..487a77a 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 _0x0d7c=['moment','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','../../config/logger','api'];(function(_0x1b4eee,_0x3f3d2a){var _0x2be98=function(_0x396c76){while(--_0x396c76){_0x1b4eee['push'](_0x1b4eee['shift']());}};_0x2be98(++_0x3f3d2a);}(_0x0d7c,0x106));var _0xc0d7=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0x0d7c[_0x20a558];return _0x53d3f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc0d7('0x0'))(_0xc0d7('0x1'));var moment=require(_0xc0d7('0x2'));var BPromise=require('bluebird');var rp=require(_0xc0d7('0x3'));var fs=require('fs');var path=require(_0xc0d7('0x4'));var rimraf=require(_0xc0d7('0x5'));var config=require(_0xc0d7('0x6'));var attributes=require(_0xc0d7('0x7'));module['exports']=function(_0x485159,_0x3e54c2){return _0x485159[_0xc0d7('0x8')](_0xc0d7('0x9'),attributes,{'tableName':_0xc0d7('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9654=['int_vtiger_configurations','lodash','moment','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration'];(function(_0x40f5c9,_0x565be2){var _0x57a880=function(_0x4100d9){while(--_0x4100d9){_0x40f5c9['push'](_0x40f5c9['shift']());}};_0x57a880(++_0x565be2);}(_0x9654,0x155));var _0x4965=function(_0x259d17,_0x220710){_0x259d17=_0x259d17-0x0;var _0x407535=_0x9654[_0x259d17];return _0x407535;};'use strict';var _=require(_0x4965('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4965('0x1'));var BPromise=require('bluebird');var rp=require(_0x4965('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4965('0x3'));var config=require(_0x4965('0x4'));var attributes=require(_0x4965('0x5'));module[_0x4965('0x6')]=function(_0x5b61bc,_0x124072){return _0x5b61bc[_0x4965('0x7')](_0x4965('0x8'),attributes,{'tableName':_0x4965('0x9'),'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 65f5928..1956300 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 _0xe718=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','moment'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0xe718,0xa5));var _0x8e71=function(_0x4f35f4,_0x51a8c3){_0x4f35f4=_0x4f35f4-0x0;var _0x2e9a70=_0xe718[_0x4f35f4];return _0x2e9a70;};'use strict';var _=require(_0x8e71('0x0'));var util=require(_0x8e71('0x1'));var moment=require(_0x8e71('0x2'));var BPromise=require(_0x8e71('0x3'));var rs=require(_0x8e71('0x4'));var fs=require('fs');var Redis=require(_0x8e71('0x5'));var db=require(_0x8e71('0x6'))['db'];var utils=require(_0x8e71('0x7'));var logger=require(_0x8e71('0x8'))(_0x8e71('0x9'));var config=require(_0x8e71('0xa'));var jayson=require(_0x8e71('0xb'));var client=jayson['client'][_0x8e71('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9395da,_0x3e5817,_0x34694b){return new BPromise(function(_0x5c61ae,_0x1cb26c){return client['request'](_0x9395da,_0x34694b)[_0x8e71('0xd')](function(_0x3ad187){logger['info'](_0x8e71('0xe'),_0x3e5817,'request\x20sent');logger[_0x8e71('0xf')](_0x8e71('0x10'),_0x3e5817,_0x8e71('0x11'),JSON[_0x8e71('0x12')](_0x3ad187));if(_0x3ad187['error']){if(_0x3ad187[_0x8e71('0x13')]['code']===0x1f4){logger[_0x8e71('0x13')](_0x8e71('0xe'),_0x3e5817,_0x3ad187[_0x8e71('0x13')]['message']);return _0x1cb26c(_0x3ad187['error'][_0x8e71('0x14')]);}logger[_0x8e71('0x13')]('VtigerConfiguration,\x20%s,\x20%s',_0x3e5817,_0x3ad187[_0x8e71('0x13')][_0x8e71('0x14')]);return _0x5c61ae(_0x3ad187[_0x8e71('0x13')]['message']);}else{logger[_0x8e71('0x15')](_0x8e71('0xe'),_0x3e5817,_0x8e71('0x11'));_0x5c61ae(_0x3ad187[_0x8e71('0x16')]['message']);}})[_0x8e71('0x17')](function(_0x2cbc6b){logger[_0x8e71('0x13')](_0x8e71('0xe'),_0x3e5817,_0x2cbc6b);_0x1cb26c(_0x2cbc6b);});});} \ No newline at end of file +var _0xb938=['http','request','then','info','debug','request\x20sent','stringify','error','code','message','VtigerConfiguration,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2aa505,_0x5a634b){var _0x4894ad=function(_0x15d0eb){while(--_0x15d0eb){_0x2aa505['push'](_0x2aa505['shift']());}};_0x4894ad(++_0x5a634b);}(_0xb938,0xc0));var _0x8b93=function(_0x5b8416,_0x234aa4){_0x5b8416=_0x5b8416-0x0;var _0x1a7e98=_0xb938[_0x5b8416];return _0x1a7e98;};'use strict';var _=require(_0x8b93('0x0'));var util=require(_0x8b93('0x1'));var moment=require(_0x8b93('0x2'));var BPromise=require('bluebird');var rs=require(_0x8b93('0x3'));var fs=require('fs');var Redis=require(_0x8b93('0x4'));var db=require(_0x8b93('0x5'))['db'];var utils=require(_0x8b93('0x6'));var logger=require(_0x8b93('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8b93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x512517,_0xc0bb39,_0x1bb33a){return new BPromise(function(_0x13dc4c,_0x434d2f){return client[_0x8b93('0x9')](_0x512517,_0x1bb33a)[_0x8b93('0xa')](function(_0x32f822){logger[_0x8b93('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0xc0bb39,'request\x20sent');logger[_0x8b93('0xc')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0xc0bb39,_0x8b93('0xd'),JSON[_0x8b93('0xe')](_0x32f822));if(_0x32f822[_0x8b93('0xf')]){if(_0x32f822[_0x8b93('0xf')][_0x8b93('0x10')]===0x1f4){logger[_0x8b93('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0xc0bb39,_0x32f822[_0x8b93('0xf')][_0x8b93('0x11')]);return _0x434d2f(_0x32f822[_0x8b93('0xf')][_0x8b93('0x11')]);}logger[_0x8b93('0xf')](_0x8b93('0x12'),_0xc0bb39,_0x32f822[_0x8b93('0xf')][_0x8b93('0x11')]);return _0x13dc4c(_0x32f822['error'][_0x8b93('0x11')]);}else{logger[_0x8b93('0xb')]('VtigerConfiguration,\x20%s,\x20%s',_0xc0bb39,_0x8b93('0xd'));_0x13dc4c(_0x32f822['result'][_0x8b93('0x11')]);}})[_0x8b93('0x13')](function(_0x304c32){logger[_0x8b93('0xf')]('VtigerConfiguration,\x20%s,\x20%s',_0xc0bb39,_0x304c32);_0x434d2f(_0x304c32);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 584ef21..eafe11a 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 _0x123f=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id'];(function(_0x35aa37,_0x48d3df){var _0x3a1f43=function(_0x35355b){while(--_0x35355b){_0x35aa37['push'](_0x35aa37['shift']());}};_0x3a1f43(++_0x48d3df);}(_0x123f,0x148));var _0xf123=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x123f[_0x4e9d3c];return _0x2d0825;};'use strict';var multer=require(_0xf123('0x0'));var util=require(_0xf123('0x1'));var path=require(_0xf123('0x2'));var timeout=require(_0xf123('0x3'));var express=require(_0xf123('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf123('0x5'));var interaction=require(_0xf123('0x6'));var config=require(_0xf123('0x7'));var controller=require('./intVtigerField.controller');router[_0xf123('0x8')]('/',auth[_0xf123('0x9')](),controller[_0xf123('0xa')]);router[_0xf123('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0xf123('0xb')]);router[_0xf123('0xc')](_0xf123('0xd'),auth['isAuthenticated'](),controller[_0xf123('0xe')]);router[_0xf123('0xf')](_0xf123('0xd'),auth[_0xf123('0x9')](),controller[_0xf123('0x10')]);module[_0xf123('0x11')]=router; \ No newline at end of file +var _0x7cdc=['isAuthenticated','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','get','show'];(function(_0x409a24,_0x19011b){var _0x32a839=function(_0x588f2f){while(--_0x588f2f){_0x409a24['push'](_0x409a24['shift']());}};_0x32a839(++_0x19011b);}(_0x7cdc,0x165));var _0xc7cd=function(_0x2cad39,_0x23e129){_0x2cad39=_0x2cad39-0x0;var _0x2f6afd=_0x7cdc[_0x2cad39];return _0x2f6afd;};'use strict';var multer=require(_0xc7cd('0x0'));var util=require('util');var path=require(_0xc7cd('0x1'));var timeout=require(_0xc7cd('0x2'));var express=require('express');var router=express[_0xc7cd('0x3')]();var fs_extra=require(_0xc7cd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerField.controller');router[_0xc7cd('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0xc7cd('0x6')]);router['post']('/',auth[_0xc7cd('0x7')](),controller[_0xc7cd('0x8')]);router[_0xc7cd('0x9')](_0xc7cd('0xa'),auth[_0xc7cd('0x7')](),controller[_0xc7cd('0xb')]);router['delete'](_0xc7cd('0xa'),auth[_0xc7cd('0x7')](),controller[_0xc7cd('0xc')]);module[_0xc7cd('0xd')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a888769..63d4bb8 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 _0x9d7b=['STRING','variable','customVariable','BOOLEAN','ENUM','string','keyValue','picklist'];(function(_0x510c60,_0x50247e){var _0x49c4aa=function(_0x3149c7){while(--_0x3149c7){_0x510c60['push'](_0x510c60['shift']());}};_0x49c4aa(++_0x50247e);}(_0x9d7b,0xa4));var _0xb9d7=function(_0x10a8d6,_0x1b7b86){_0x10a8d6=_0x10a8d6-0x0;var _0x54f037=_0x9d7b[_0x10a8d6];return _0x54f037;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb9d7('0x0')](_0xb9d7('0x1'),'variable','customVariable',_0xb9d7('0x2'),_0xb9d7('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xb9d7('0x4')]},'key':{'type':Sequelize[_0xb9d7('0x4')]},'keyType':{'type':Sequelize[_0xb9d7('0x0')](_0xb9d7('0x1'),_0xb9d7('0x5'),_0xb9d7('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb9d7('0x4')]},'nameField':{'type':Sequelize[_0xb9d7('0x4')]},'customField':{'type':Sequelize[_0xb9d7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb9d7('0x4')]}}; \ No newline at end of file +var _0xb7b1=['picklist','string','STRING','ENUM','BOOLEAN','sequelize','exports','variable','customVariable'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb7b1,0xb9));var _0x1b7b=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xb7b1[_0x11c573];return _0x6b72de;};'use strict';var Sequelize=require(_0x1b7b('0x0'));module[_0x1b7b('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x1b7b('0x2'),_0x1b7b('0x3'),'keyValue',_0x1b7b('0x4')),'defaultValue':_0x1b7b('0x5')},'content':{'type':Sequelize[_0x1b7b('0x6')]},'key':{'type':Sequelize[_0x1b7b('0x6')]},'keyType':{'type':Sequelize[_0x1b7b('0x7')](_0x1b7b('0x5'),'variable',_0x1b7b('0x3'))},'keyContent':{'type':Sequelize[_0x1b7b('0x6')]},'idField':{'type':Sequelize[_0x1b7b('0x6')]},'nameField':{'type':Sequelize[_0x1b7b('0x6')]},'customField':{'type':Sequelize[_0x1b7b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1b7b('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 8cb9845..49ca0df 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 _0x50dc=['count','limit','Content-Range','save','update','then','sendStatus','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','filter','merge','VIRTUAL','options','includeAll','findAll','params','find','create','body','catch','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','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','status','end','json','offset','undefined'];(function(_0x5d2421,_0xe829ac){var _0x28f318=function(_0x3332fd){while(--_0x3332fd){_0x5d2421['push'](_0x5d2421['shift']());}};_0x28f318(++_0xe829ac);}(_0x50dc,0xb4));var _0xc50d=function(_0x1bb8be,_0x7fc1ac){_0x1bb8be=_0x1bb8be-0x0;var _0x2549d5=_0x50dc[_0x1bb8be];return _0x2549d5;};'use strict';var emlformat=require(_0xc50d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc50d('0x1'));var jsonpatch=require(_0xc50d('0x2'));var rp=require(_0xc50d('0x3'));var moment=require(_0xc50d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc50d('0x5'));var util=require('util');var path=require(_0xc50d('0x6'));var sox=require(_0xc50d('0x7'));var csv=require(_0xc50d('0x8'));var ejs=require(_0xc50d('0x9'));var fs=require('fs');var fs_extra=require(_0xc50d('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc50d('0xb'));var deskjs=require(_0xc50d('0xc'));var toCsv=require(_0xc50d('0x8'));var querystring=require(_0xc50d('0xd'));var Papa=require(_0xc50d('0xe'));var Redis=require(_0xc50d('0xf'));var authService=require(_0xc50d('0x10'));var qs=require(_0xc50d('0x11'));var as=require(_0xc50d('0x12'));var hardwareService=require(_0xc50d('0x13'));var logger=require(_0xc50d('0x14'))(_0xc50d('0x15'));var utils=require(_0xc50d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc50d('0x17'));var db=require(_0xc50d('0x18'))['db'];function respondWithStatusCode(_0x43cb9f,_0x2b2864){_0x2b2864=_0x2b2864||0xcc;return function(_0x578273){if(_0x578273){return _0x43cb9f['sendStatus'](_0x2b2864);}return _0x43cb9f[_0xc50d('0x19')](_0x2b2864)[_0xc50d('0x1a')]();};}function respondWithResult(_0x887464,_0x431d98){_0x431d98=_0x431d98||0xc8;return function(_0x1c2c27){if(_0x1c2c27){return _0x887464[_0xc50d('0x19')](_0x431d98)[_0xc50d('0x1b')](_0x1c2c27);}};}function respondWithFilteredResult(_0xaa8801,_0x522cc6){return function(_0x531f39){if(_0x531f39){var _0x3f6b60=typeof _0x522cc6[_0xc50d('0x1c')]===_0xc50d('0x1d')&&typeof _0x522cc6['limit']===_0xc50d('0x1d');var _0x113866=_0x531f39[_0xc50d('0x1e')];var _0x7d5da6=_0x3f6b60?0x0:_0x522cc6[_0xc50d('0x1c')];var _0xcc9688=_0x3f6b60?_0x531f39[_0xc50d('0x1e')]:_0x522cc6[_0xc50d('0x1c')]+_0x522cc6[_0xc50d('0x1f')];var _0x3eeaeb;if(_0xcc9688>=_0x113866){_0xcc9688=_0x113866;_0x3eeaeb=0xc8;}else{_0x3eeaeb=0xce;}_0xaa8801[_0xc50d('0x19')](_0x3eeaeb);return _0xaa8801['set'](_0xc50d('0x20'),_0x7d5da6+'-'+_0xcc9688+'/'+_0x113866)[_0xc50d('0x1b')](_0x531f39);}return null;};}function patchUpdates(_0x304c42){return function(_0x48bedb){try{jsonpatch['apply'](_0x48bedb,_0x304c42,!![]);}catch(_0x1bfdba){return BPromise['reject'](_0x1bfdba);}return _0x48bedb[_0xc50d('0x21')]();};}function saveUpdates(_0x2b4044,_0x25a9d6){return function(_0x21c709){if(_0x21c709){return _0x21c709[_0xc50d('0x22')](_0x2b4044)['then'](function(_0x3b1fee){return _0x3b1fee;});}return null;};}function removeEntity(_0x218f09,_0x3193da){return function(_0x4eb6e9){if(_0x4eb6e9){return _0x4eb6e9['destroy']()[_0xc50d('0x23')](function(){_0x218f09[_0xc50d('0x19')](0xcc)[_0xc50d('0x1a')]();});}};}function handleEntityNotFound(_0x5c3aaa,_0x594df1){return function(_0x1e712d){if(!_0x1e712d){_0x5c3aaa[_0xc50d('0x24')](0x194);}return _0x1e712d;};}function handleError(_0x421e8e,_0x6d5d5b){_0x6d5d5b=_0x6d5d5b||0x1f4;return function(_0x275ade){logger[_0xc50d('0x25')](_0x275ade[_0xc50d('0x26')]);if(_0x275ade[_0xc50d('0x27')]){delete _0x275ade[_0xc50d('0x27')];}_0x421e8e['status'](_0x6d5d5b)[_0xc50d('0x28')](_0x275ade);};}exports[_0xc50d('0x29')]=function(_0x42e005,_0x59e513){var _0x4046ea={},_0x170fcc={},_0x4ac403={'count':0x0,'rows':[]};var _0x5ec965=_[_0xc50d('0x2a')](db[_0xc50d('0x2b')][_0xc50d('0x2c')],function(_0x5b2b4b){return{'name':_0x5b2b4b[_0xc50d('0x2d')],'type':_0x5b2b4b[_0xc50d('0x2e')][_0xc50d('0x2f')]};});_0x170fcc[_0xc50d('0x30')]=_[_0xc50d('0x2a')](_0x5ec965,'name');_0x170fcc[_0xc50d('0x31')]=_[_0xc50d('0x32')](_0x42e005[_0xc50d('0x31')]);_0x170fcc['filters']=_[_0xc50d('0x33')](_0x170fcc[_0xc50d('0x30')],_0x170fcc[_0xc50d('0x31')]);_0x4046ea[_0xc50d('0x34')]=_[_0xc50d('0x33')](_0x170fcc['model'],qs[_0xc50d('0x35')](_0x42e005[_0xc50d('0x31')][_0xc50d('0x35')]));_0x4046ea[_0xc50d('0x34')]=_0x4046ea[_0xc50d('0x34')][_0xc50d('0x36')]?_0x4046ea[_0xc50d('0x34')]:_0x170fcc[_0xc50d('0x30')];if(!_0x42e005[_0xc50d('0x31')][_0xc50d('0x37')](_0xc50d('0x38'))){_0x4046ea[_0xc50d('0x1f')]=qs[_0xc50d('0x1f')](_0x42e005[_0xc50d('0x31')][_0xc50d('0x1f')]);_0x4046ea[_0xc50d('0x1c')]=qs['offset'](_0x42e005['query']['offset']);}_0x4046ea['order']=qs['sort'](_0x42e005[_0xc50d('0x31')]['sort']);_0x4046ea[_0xc50d('0x39')]=qs[_0xc50d('0x3a')](_['pick'](_0x42e005['query'],_0x170fcc[_0xc50d('0x3a')]),_0x5ec965);if(_0x42e005[_0xc50d('0x31')][_0xc50d('0x3b')]){_0x4046ea[_0xc50d('0x39')]=_[_0xc50d('0x3c')](_0x4046ea[_0xc50d('0x39')],{'$or':_[_0xc50d('0x2a')](_0x5ec965,function(_0x517878){if(_0x517878[_0xc50d('0x2e')]!==_0xc50d('0x3d')){var _0x538985={};_0x538985[_0x517878[_0xc50d('0x27')]]={'$like':'%'+_0x42e005[_0xc50d('0x31')]['filter']+'%'};return _0x538985;}})});}_0x4046ea=_[_0xc50d('0x3c')]({},_0x4046ea,_0x42e005[_0xc50d('0x3e')]);var _0x4118f5={'where':_0x4046ea[_0xc50d('0x39')]};return db[_0xc50d('0x2b')][_0xc50d('0x1e')](_0x4118f5)[_0xc50d('0x23')](function(_0x1fe97a){_0x4ac403[_0xc50d('0x1e')]=_0x1fe97a;if(_0x42e005['query'][_0xc50d('0x3f')]){_0x4046ea['include']=[{'all':!![]}];}return db[_0xc50d('0x2b')][_0xc50d('0x40')](_0x4046ea);})[_0xc50d('0x23')](function(_0x4bcbfa){_0x4ac403['rows']=_0x4bcbfa;return _0x4ac403;})['then'](respondWithFilteredResult(_0x59e513,_0x4046ea))['catch'](handleError(_0x59e513,null));};exports['show']=function(_0xd440d5,_0x41fad0){var _0x46fac3={'raw':!![],'where':{'id':_0xd440d5[_0xc50d('0x41')]['id']}},_0x3c4a59={};_0x3c4a59[_0xc50d('0x30')]=_[_0xc50d('0x32')](db[_0xc50d('0x2b')]['rawAttributes']);_0x3c4a59[_0xc50d('0x31')]=_['keys'](_0xd440d5[_0xc50d('0x31')]);_0x3c4a59['filters']=_[_0xc50d('0x33')](_0x3c4a59[_0xc50d('0x30')],_0x3c4a59['query']);_0x46fac3[_0xc50d('0x34')]=_[_0xc50d('0x33')](_0x3c4a59[_0xc50d('0x30')],qs[_0xc50d('0x35')](_0xd440d5[_0xc50d('0x31')]['fields']));_0x46fac3[_0xc50d('0x34')]=_0x46fac3['attributes'][_0xc50d('0x36')]?_0x46fac3[_0xc50d('0x34')]:_0x3c4a59[_0xc50d('0x30')];if(_0xd440d5[_0xc50d('0x31')]['includeAll']){_0x46fac3['include']=[{'all':!![]}];}_0x46fac3=_[_0xc50d('0x3c')]({},_0x46fac3,_0xd440d5['options']);return db['VtigerField'][_0xc50d('0x42')](_0x46fac3)[_0xc50d('0x23')](handleEntityNotFound(_0x41fad0,null))[_0xc50d('0x23')](respondWithResult(_0x41fad0,null))['catch'](handleError(_0x41fad0,null));};exports['create']=function(_0x449191,_0x5ee96f){return db[_0xc50d('0x2b')][_0xc50d('0x43')](_0x449191[_0xc50d('0x44')],{})[_0xc50d('0x23')](respondWithResult(_0x5ee96f,0xc9))['catch'](handleError(_0x5ee96f,null));};exports[_0xc50d('0x22')]=function(_0x5b4d37,_0x4c3e13){if(_0x5b4d37['body']['id']){delete _0x5b4d37[_0xc50d('0x44')]['id'];}return db[_0xc50d('0x2b')][_0xc50d('0x42')]({'where':{'id':_0x5b4d37[_0xc50d('0x41')]['id']}})[_0xc50d('0x23')](handleEntityNotFound(_0x4c3e13,null))[_0xc50d('0x23')](saveUpdates(_0x5b4d37[_0xc50d('0x44')],null))[_0xc50d('0x23')](respondWithResult(_0x4c3e13,null))[_0xc50d('0x45')](handleError(_0x4c3e13,null));};exports['destroy']=function(_0x53891c,_0x3cdd6e){return db['VtigerField']['find']({'where':{'id':_0x53891c[_0xc50d('0x41')]['id']}})[_0xc50d('0x23')](handleEntityNotFound(_0x3cdd6e,null))[_0xc50d('0x23')](removeEntity(_0x3cdd6e,null))[_0xc50d('0x45')](handleError(_0x3cdd6e,null));}; \ No newline at end of file +var _0x5be1=['body','eml-format','rimraf','zip-dir','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','then','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','filter','merge','where','VIRTUAL','options','includeAll','rows','catch','show','params','length','include','create'];(function(_0x28f1de,_0x355054){var _0x5b5dad=function(_0x399b72){while(--_0x399b72){_0x28f1de['push'](_0x28f1de['shift']());}};_0x5b5dad(++_0x355054);}(_0x5be1,0xd6));var _0x15be=function(_0x2e4a0f,_0x3a9bb6){_0x2e4a0f=_0x2e4a0f-0x0;var _0x25a3cd=_0x5be1[_0x2e4a0f];return _0x25a3cd;};'use strict';var emlformat=require(_0x15be('0x0'));var rimraf=require(_0x15be('0x1'));var zipdir=require(_0x15be('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x15be('0x3'));var util=require(_0x15be('0x4'));var path=require(_0x15be('0x5'));var sox=require(_0x15be('0x6'));var csv=require('to-csv');var ejs=require(_0x15be('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x15be('0x8'));var squel=require('squel');var crypto=require(_0x15be('0x9'));var jsforce=require(_0x15be('0xa'));var deskjs=require(_0x15be('0xb'));var toCsv=require('to-csv');var querystring=require(_0x15be('0xc'));var Papa=require(_0x15be('0xd'));var Redis=require(_0x15be('0xe'));var authService=require(_0x15be('0xf'));var qs=require(_0x15be('0x10'));var as=require(_0x15be('0x11'));var hardwareService=require(_0x15be('0x12'));var logger=require(_0x15be('0x13'))('api');var utils=require(_0x15be('0x14'));var config=require(_0x15be('0x15'));var licenseUtil=require(_0x15be('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x310a91,_0x230d06){_0x230d06=_0x230d06||0xcc;return function(_0x288f3d){if(_0x288f3d){return _0x310a91['sendStatus'](_0x230d06);}return _0x310a91[_0x15be('0x17')](_0x230d06)[_0x15be('0x18')]();};}function respondWithResult(_0x4cadab,_0x561e38){_0x561e38=_0x561e38||0xc8;return function(_0x161278){if(_0x161278){return _0x4cadab['status'](_0x561e38)[_0x15be('0x19')](_0x161278);}};}function respondWithFilteredResult(_0xafa563,_0x5a5f85){return function(_0x17067c){if(_0x17067c){var _0x4dd970=typeof _0x5a5f85[_0x15be('0x1a')]==='undefined'&&typeof _0x5a5f85[_0x15be('0x1b')]===_0x15be('0x1c');var _0x1647b7=_0x17067c['count'];var _0x5437ea=_0x4dd970?0x0:_0x5a5f85[_0x15be('0x1a')];var _0x3ac155=_0x4dd970?_0x17067c[_0x15be('0x1d')]:_0x5a5f85[_0x15be('0x1a')]+_0x5a5f85[_0x15be('0x1b')];var _0x5509cd;if(_0x3ac155>=_0x1647b7){_0x3ac155=_0x1647b7;_0x5509cd=0xc8;}else{_0x5509cd=0xce;}_0xafa563[_0x15be('0x17')](_0x5509cd);return _0xafa563[_0x15be('0x1e')](_0x15be('0x1f'),_0x5437ea+'-'+_0x3ac155+'/'+_0x1647b7)[_0x15be('0x19')](_0x17067c);}return null;};}function patchUpdates(_0x40e5a3){return function(_0x703da4){try{jsonpatch[_0x15be('0x20')](_0x703da4,_0x40e5a3,!![]);}catch(_0x29bac6){return BPromise['reject'](_0x29bac6);}return _0x703da4[_0x15be('0x21')]();};}function saveUpdates(_0x58dfda,_0x5e58c9){return function(_0x35263a){if(_0x35263a){return _0x35263a[_0x15be('0x22')](_0x58dfda)['then'](function(_0x173b60){return _0x173b60;});}return null;};}function removeEntity(_0xa3a5a5,_0x4d921d){return function(_0x1693f0){if(_0x1693f0){return _0x1693f0[_0x15be('0x23')]()[_0x15be('0x24')](function(){_0xa3a5a5[_0x15be('0x17')](0xcc)[_0x15be('0x18')]();});}};}function handleEntityNotFound(_0x1ae0f1,_0x31e5bd){return function(_0xa60ae8){if(!_0xa60ae8){_0x1ae0f1['sendStatus'](0x194);}return _0xa60ae8;};}function handleError(_0x5bf6d6,_0x5e9aee){_0x5e9aee=_0x5e9aee||0x1f4;return function(_0xcf4ee9){logger['error'](_0xcf4ee9[_0x15be('0x25')]);if(_0xcf4ee9[_0x15be('0x26')]){delete _0xcf4ee9[_0x15be('0x26')];}_0x5bf6d6[_0x15be('0x17')](_0x5e9aee)[_0x15be('0x27')](_0xcf4ee9);};}exports[_0x15be('0x28')]=function(_0x417e38,_0x2e1618){var _0x3c0f7d={},_0x2f8629={},_0x408d1b={'count':0x0,'rows':[]};var _0x2e79d1=_[_0x15be('0x29')](db[_0x15be('0x2a')][_0x15be('0x2b')],function(_0x378851){return{'name':_0x378851[_0x15be('0x2c')],'type':_0x378851[_0x15be('0x2d')][_0x15be('0x2e')]};});_0x2f8629[_0x15be('0x2f')]=_[_0x15be('0x29')](_0x2e79d1,_0x15be('0x26'));_0x2f8629['query']=_[_0x15be('0x30')](_0x417e38[_0x15be('0x31')]);_0x2f8629[_0x15be('0x32')]=_[_0x15be('0x33')](_0x2f8629['model'],_0x2f8629[_0x15be('0x31')]);_0x3c0f7d[_0x15be('0x34')]=_[_0x15be('0x33')](_0x2f8629[_0x15be('0x2f')],qs[_0x15be('0x35')](_0x417e38[_0x15be('0x31')][_0x15be('0x35')]));_0x3c0f7d[_0x15be('0x34')]=_0x3c0f7d[_0x15be('0x34')]['length']?_0x3c0f7d[_0x15be('0x34')]:_0x2f8629[_0x15be('0x2f')];if(!_0x417e38[_0x15be('0x31')]['hasOwnProperty'](_0x15be('0x36'))){_0x3c0f7d['limit']=qs['limit'](_0x417e38[_0x15be('0x31')][_0x15be('0x1b')]);_0x3c0f7d[_0x15be('0x1a')]=qs[_0x15be('0x1a')](_0x417e38[_0x15be('0x31')][_0x15be('0x1a')]);}_0x3c0f7d[_0x15be('0x37')]=qs[_0x15be('0x38')](_0x417e38['query']['sort']);_0x3c0f7d['where']=qs[_0x15be('0x32')](_['pick'](_0x417e38[_0x15be('0x31')],_0x2f8629['filters']),_0x2e79d1);if(_0x417e38[_0x15be('0x31')][_0x15be('0x39')]){_0x3c0f7d['where']=_[_0x15be('0x3a')](_0x3c0f7d[_0x15be('0x3b')],{'$or':_[_0x15be('0x29')](_0x2e79d1,function(_0x275015){if(_0x275015[_0x15be('0x2d')]!==_0x15be('0x3c')){var _0x1bfbe5={};_0x1bfbe5[_0x275015['name']]={'$like':'%'+_0x417e38[_0x15be('0x31')][_0x15be('0x39')]+'%'};return _0x1bfbe5;}})});}_0x3c0f7d=_[_0x15be('0x3a')]({},_0x3c0f7d,_0x417e38[_0x15be('0x3d')]);var _0x57940c={'where':_0x3c0f7d[_0x15be('0x3b')]};return db[_0x15be('0x2a')]['count'](_0x57940c)[_0x15be('0x24')](function(_0x20d134){_0x408d1b[_0x15be('0x1d')]=_0x20d134;if(_0x417e38[_0x15be('0x31')][_0x15be('0x3e')]){_0x3c0f7d['include']=[{'all':!![]}];}return db[_0x15be('0x2a')]['findAll'](_0x3c0f7d);})[_0x15be('0x24')](function(_0x2b3968){_0x408d1b[_0x15be('0x3f')]=_0x2b3968;return _0x408d1b;})['then'](respondWithFilteredResult(_0x2e1618,_0x3c0f7d))[_0x15be('0x40')](handleError(_0x2e1618,null));};exports[_0x15be('0x41')]=function(_0x5b277e,_0xc1d54a){var _0x5b2151={'raw':!![],'where':{'id':_0x5b277e[_0x15be('0x42')]['id']}},_0x32566c={};_0x32566c['model']=_['keys'](db[_0x15be('0x2a')][_0x15be('0x2b')]);_0x32566c['query']=_[_0x15be('0x30')](_0x5b277e['query']);_0x32566c[_0x15be('0x32')]=_[_0x15be('0x33')](_0x32566c[_0x15be('0x2f')],_0x32566c['query']);_0x5b2151['attributes']=_['intersection'](_0x32566c[_0x15be('0x2f')],qs[_0x15be('0x35')](_0x5b277e[_0x15be('0x31')][_0x15be('0x35')]));_0x5b2151[_0x15be('0x34')]=_0x5b2151['attributes'][_0x15be('0x43')]?_0x5b2151[_0x15be('0x34')]:_0x32566c[_0x15be('0x2f')];if(_0x5b277e['query'][_0x15be('0x3e')]){_0x5b2151[_0x15be('0x44')]=[{'all':!![]}];}_0x5b2151=_[_0x15be('0x3a')]({},_0x5b2151,_0x5b277e[_0x15be('0x3d')]);return db[_0x15be('0x2a')]['find'](_0x5b2151)['then'](handleEntityNotFound(_0xc1d54a,null))[_0x15be('0x24')](respondWithResult(_0xc1d54a,null))[_0x15be('0x40')](handleError(_0xc1d54a,null));};exports['create']=function(_0x4b22d9,_0x5b7894){return db[_0x15be('0x2a')][_0x15be('0x45')](_0x4b22d9[_0x15be('0x46')],{})[_0x15be('0x24')](respondWithResult(_0x5b7894,0xc9))[_0x15be('0x40')](handleError(_0x5b7894,null));};exports[_0x15be('0x22')]=function(_0x1f10a1,_0x416d0e){if(_0x1f10a1[_0x15be('0x46')]['id']){delete _0x1f10a1[_0x15be('0x46')]['id'];}return db[_0x15be('0x2a')]['find']({'where':{'id':_0x1f10a1[_0x15be('0x42')]['id']}})['then'](handleEntityNotFound(_0x416d0e,null))[_0x15be('0x24')](saveUpdates(_0x1f10a1[_0x15be('0x46')],null))[_0x15be('0x24')](respondWithResult(_0x416d0e,null))['catch'](handleError(_0x416d0e,null));};exports[_0x15be('0x23')]=function(_0x71287f,_0x444d8f){return db[_0x15be('0x2a')]['find']({'where':{'id':_0x71287f[_0x15be('0x42')]['id']}})['then'](handleEntityNotFound(_0x444d8f,null))[_0x15be('0x24')](removeEntity(_0x444d8f,null))[_0x15be('0x40')](handleError(_0x444d8f,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 8a707d8..32233af 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 _0x31f0=['../../config/environment','exports','define','idField','FieldId','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2de0a7,_0x38d3e7){var _0x429437=function(_0x23c148){while(--_0x23c148){_0x2de0a7['push'](_0x2de0a7['shift']());}};_0x429437(++_0x38d3e7);}(_0x31f0,0x185));var _0x031f=function(_0x14f44e,_0x4541a2){_0x14f44e=_0x14f44e-0x0;var _0x157d6d=_0x31f0[_0x14f44e];return _0x157d6d;};'use strict';var _=require('lodash');var util=require(_0x031f('0x0'));var logger=require(_0x031f('0x1'))(_0x031f('0x2'));var moment=require('moment');var BPromise=require(_0x031f('0x3'));var rp=require(_0x031f('0x4'));var fs=require('fs');var path=require(_0x031f('0x5'));var rimraf=require(_0x031f('0x6'));var config=require(_0x031f('0x7'));var attributes=require('./intVtigerField.attributes');module[_0x031f('0x8')]=function(_0x2fba84,_0x575aa6){return _0x2fba84[_0x031f('0x9')]('VtigerField',attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x031f('0xa'),_0x031f('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2214=['exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x5aeb34,_0x547760){var _0x162c00=function(_0x5313a1){while(--_0x5313a1){_0x5aeb34['push'](_0x5aeb34['shift']());}};_0x162c00(++_0x547760);}(_0x2214,0x7f));var _0x4221=function(_0x474086,_0x16cc5a){_0x474086=_0x474086-0x0;var _0x3c4231=_0x2214[_0x474086];return _0x3c4231;};'use strict';var _=require(_0x4221('0x0'));var util=require(_0x4221('0x1'));var logger=require(_0x4221('0x2'))('api');var moment=require(_0x4221('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4221('0x4'));var rimraf=require(_0x4221('0x5'));var config=require(_0x4221('0x6'));var attributes=require(_0x4221('0x7'));module[_0x4221('0x8')]=function(_0x3bc557,_0x5c6bb8){return _0x3bc557[_0x4221('0x9')](_0x4221('0xa'),attributes,{'tableName':_0x4221('0xb'),'paranoid':![],'indexes':[{'name':_0x4221('0xc'),'fields':[_0x4221('0xd'),_0x4221('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.rpc.js b/server/api/intVtigerField/intVtigerField.rpc.js index a9ec3ae..df7d772 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 _0x2768=['then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','request'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x2768,0x13f));var _0x8276=function(_0x12b485,_0x529e20){_0x12b485=_0x12b485-0x0;var _0x2efbcf=_0x2768[_0x12b485];return _0x2efbcf;};'use strict';var _=require(_0x8276('0x0'));var util=require(_0x8276('0x1'));var moment=require(_0x8276('0x2'));var BPromise=require(_0x8276('0x3'));var rs=require(_0x8276('0x4'));var fs=require('fs');var Redis=require(_0x8276('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8276('0x6'))('rpc');var config=require(_0x8276('0x7'));var jayson=require(_0x8276('0x8'));var client=jayson[_0x8276('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1248d0,_0x221f35,_0x4ec3b4){return new BPromise(function(_0x52a6ef,_0x464dd3){return client[_0x8276('0xa')](_0x1248d0,_0x4ec3b4)[_0x8276('0xb')](function(_0x20809e){logger[_0x8276('0xc')](_0x8276('0xd'),_0x221f35,_0x8276('0xe'));logger[_0x8276('0xf')](_0x8276('0x10'),_0x221f35,'request\x20sent',JSON[_0x8276('0x11')](_0x20809e));if(_0x20809e['error']){if(_0x20809e['error'][_0x8276('0x12')]===0x1f4){logger[_0x8276('0x13')]('VtigerField,\x20%s,\x20%s',_0x221f35,_0x20809e[_0x8276('0x13')]['message']);return _0x464dd3(_0x20809e[_0x8276('0x13')][_0x8276('0x14')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x221f35,_0x20809e[_0x8276('0x13')][_0x8276('0x14')]);return _0x52a6ef(_0x20809e['error']['message']);}else{logger[_0x8276('0xc')](_0x8276('0xd'),_0x221f35,_0x8276('0xe'));_0x52a6ef(_0x20809e[_0x8276('0x15')][_0x8276('0x14')]);}})['catch'](function(_0x3ca634){logger[_0x8276('0x13')](_0x8276('0xd'),_0x221f35,_0x3ca634);_0x464dd3(_0x3ca634);});});} \ No newline at end of file +var _0x36b1=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerField,\x20%s,\x20%s','message','result'];(function(_0x2fc93a,_0x2d480d){var _0x10a760=function(_0x4fef26){while(--_0x4fef26){_0x2fc93a['push'](_0x2fc93a['shift']());}};_0x10a760(++_0x2d480d);}(_0x36b1,0x65));var _0x136b=function(_0x5b5d2f,_0x19a4e3){_0x5b5d2f=_0x5b5d2f-0x0;var _0x4af246=_0x36b1[_0x5b5d2f];return _0x4af246;};'use strict';var _=require('lodash');var util=require(_0x136b('0x0'));var moment=require(_0x136b('0x1'));var BPromise=require(_0x136b('0x2'));var rs=require(_0x136b('0x3'));var fs=require('fs');var Redis=require(_0x136b('0x4'));var db=require(_0x136b('0x5'))['db'];var utils=require(_0x136b('0x6'));var logger=require(_0x136b('0x7'))(_0x136b('0x8'));var config=require(_0x136b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x136b('0xa')][_0x136b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a3811,_0x585894,_0x5ecd3d){return new BPromise(function(_0x183a4d,_0x154168){return client[_0x136b('0xc')](_0x4a3811,_0x5ecd3d)[_0x136b('0xd')](function(_0x3b3759){logger[_0x136b('0xe')]('VtigerField,\x20%s,\x20%s',_0x585894,_0x136b('0xf'));logger[_0x136b('0x10')](_0x136b('0x11'),_0x585894,_0x136b('0xf'),JSON[_0x136b('0x12')](_0x3b3759));if(_0x3b3759['error']){if(_0x3b3759[_0x136b('0x13')][_0x136b('0x14')]===0x1f4){logger[_0x136b('0x13')](_0x136b('0x15'),_0x585894,_0x3b3759[_0x136b('0x13')]['message']);return _0x154168(_0x3b3759['error'][_0x136b('0x16')]);}logger['error'](_0x136b('0x15'),_0x585894,_0x3b3759[_0x136b('0x13')][_0x136b('0x16')]);return _0x183a4d(_0x3b3759['error'][_0x136b('0x16')]);}else{logger[_0x136b('0xe')](_0x136b('0x15'),_0x585894,_0x136b('0xf'));_0x183a4d(_0x3b3759[_0x136b('0x17')][_0x136b('0x16')]);}})[_0x136b('0x18')](function(_0x11d54a){logger['error'](_0x136b('0x15'),_0x585894,_0x11d54a);_0x154168(_0x11d54a);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 313ca36..c591ea6 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 _0xbbcd=['index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x493985,_0xabbee5){var _0x532b94=function(_0x150fbc){while(--_0x150fbc){_0x493985['push'](_0x493985['shift']());}};_0x532b94(++_0xabbee5);}(_0xbbcd,0xa1));var _0xdbbc=function(_0x26c0e0,_0xfe057c){_0x26c0e0=_0x26c0e0-0x0;var _0x4ac795=_0xbbcd[_0x26c0e0];return _0x4ac795;};'use strict';var multer=require(_0xdbbc('0x0'));var util=require(_0xdbbc('0x1'));var path=require(_0xdbbc('0x2'));var timeout=require(_0xdbbc('0x3'));var express=require(_0xdbbc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdbbc('0x5'));var interaction=require(_0xdbbc('0x6'));var config=require('../../config/environment');var controller=require(_0xdbbc('0x7'));router[_0xdbbc('0x8')]('/',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0xa')]);router[_0xdbbc('0x8')](_0xdbbc('0xb'),auth[_0xdbbc('0x9')](),controller['show']);router['get'](_0xdbbc('0xc'),auth[_0xdbbc('0x9')](),controller[_0xdbbc('0xd')]);router[_0xdbbc('0x8')]('/:id/fields',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0xe')]);router[_0xdbbc('0xf')]('/',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0x10')]);router['post']('/:id/configurations',auth[_0xdbbc('0x9')](),controller[_0xdbbc('0x11')]);router[_0xdbbc('0x12')](_0xdbbc('0xb'),auth[_0xdbbc('0x9')](),controller['update']);router['delete'](_0xdbbc('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8450=['post','create','/:id/configurations','addConfiguration','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x158cc8,_0x2132c9){var _0xff1e81=function(_0x59bfdd){while(--_0x59bfdd){_0x158cc8['push'](_0x158cc8['shift']());}};_0xff1e81(++_0x2132c9);}(_0x8450,0x137));var _0x0845=function(_0x362601,_0x39f0d1){_0x362601=_0x362601-0x0;var _0x248002=_0x8450[_0x362601];return _0x248002;};'use strict';var multer=require(_0x0845('0x0'));var util=require(_0x0845('0x1'));var path=require(_0x0845('0x2'));var timeout=require(_0x0845('0x3'));var express=require(_0x0845('0x4'));var router=express[_0x0845('0x5')]();var fs_extra=require(_0x0845('0x6'));var auth=require(_0x0845('0x7'));var interaction=require(_0x0845('0x8'));var config=require(_0x0845('0x9'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x0845('0xa')](),controller['index']);router[_0x0845('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0845('0xb')]('/:id/configurations',auth[_0x0845('0xa')](),controller['getConfigurations']);router['get']('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router[_0x0845('0xc')]('/',auth[_0x0845('0xa')](),controller[_0x0845('0xd')]);router[_0x0845('0xc')](_0x0845('0xe'),auth[_0x0845('0xa')](),controller[_0x0845('0xf')]);router['put'](_0x0845('0x10'),auth[_0x0845('0xa')](),controller['update']);router[_0x0845('0x11')](_0x0845('0x10'),auth['isAuthenticated'](),controller[_0x0845('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 56c4cfd..24336da 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 _0x524e=['STRING','username','remoteUri','ENUM','password','newTab','integrationTab'];(function(_0x59f9b5,_0x3e7bbc){var _0x38a78f=function(_0x104a27){while(--_0x104a27){_0x59f9b5['push'](_0x59f9b5['shift']());}};_0x38a78f(++_0x3e7bbc);}(_0x524e,0x15e));var _0xe524=function(_0x147327,_0x61607b){_0x147327=_0x147327-0x0;var _0x5b7720=_0x524e[_0x147327];return _0x5b7720;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'password':{'type':Sequelize[_0xe524('0x0')]},'token':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'authType':{'type':Sequelize[_0xe524('0x3')](_0xe524('0x4'),'token'),'defaultValue':_0xe524('0x4')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0xe524('0x3')]('integrationTab',_0xe524('0x5')),'defaultValue':_0xe524('0x6')}}; \ No newline at end of file +var _0xbff5=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','password','token'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xbff5,0x1bc));var _0x5bff=function(_0xa0cc2f,_0x41bfe1){_0xa0cc2f=_0xa0cc2f-0x0;var _0x2fd86c=_0xbff5[_0xa0cc2f];return _0x2fd86c;};'use strict';var Sequelize=require(_0x5bff('0x0'));module[_0x5bff('0x1')]={'name':{'type':Sequelize[_0x5bff('0x2')]},'description':{'type':Sequelize[_0x5bff('0x2')]},'username':{'type':Sequelize[_0x5bff('0x2')],'unique':_0x5bff('0x3')},'password':{'type':Sequelize[_0x5bff('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x5bff('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x5bff('0x4'),_0x5bff('0x5')),'defaultValue':_0x5bff('0x4')},'serverUrl':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x5bff('0x6')](_0x5bff('0x7'),_0x5bff('0x8')),'defaultValue':_0x5bff('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 0d99d69..b6fb094 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 _0xe511=['getConfigurations','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','ZendeskConfiguration','create','getFields','username','password','authType','remoteUri','substring','format','ticket_fields','headers','Basic\x20%s','%s:%s','toString','token','%s/token:%s','base64','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','includes','position','system_field_options','custom_field_options','send','test','statusCode','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','stack','index','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','ZendeskAccount','includeAll','include','findAll','catch','show','params','rawAttributes','fields','options','body','find','nolimit'];(function(_0x42a2e8,_0x1bbcbb){var _0x2769c4=function(_0x369ca4){while(--_0x369ca4){_0x42a2e8['push'](_0x42a2e8['shift']());}};_0x2769c4(++_0x1bbcbb);}(_0xe511,0x16f));var _0x1e51=function(_0x5261a8,_0x482ee4){_0x5261a8=_0x5261a8-0x0;var _0x48c7de=_0xe511[_0x5261a8];return _0x48c7de;};'use strict';var emlformat=require(_0x1e51('0x0'));var rimraf=require(_0x1e51('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1e51('0x2'));var rp=require('request-promise');var moment=require(_0x1e51('0x3'));var BPromise=require(_0x1e51('0x4'));var Mustache=require('mustache');var util=require(_0x1e51('0x5'));var path=require(_0x1e51('0x6'));var sox=require(_0x1e51('0x7'));var csv=require(_0x1e51('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e51('0x9'));var _=require(_0x1e51('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e51('0xb'));var deskjs=require(_0x1e51('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1e51('0xd'));var Redis=require(_0x1e51('0xe'));var authService=require(_0x1e51('0xf'));var qs=require(_0x1e51('0x10'));var as=require(_0x1e51('0x11'));var hardwareService=require(_0x1e51('0x12'));var logger=require('../../config/logger')(_0x1e51('0x13'));var utils=require(_0x1e51('0x14'));var config=require(_0x1e51('0x15'));var licenseUtil=require(_0x1e51('0x16'));var db=require(_0x1e51('0x17'))['db'];var integrations=require(_0x1e51('0x18'));function respondWithStatusCode(_0x5544eb,_0x408a77){_0x408a77=_0x408a77||0xcc;return function(_0x102f01){if(_0x102f01){return _0x5544eb[_0x1e51('0x19')](_0x408a77);}return _0x5544eb[_0x1e51('0x1a')](_0x408a77)[_0x1e51('0x1b')]();};}function respondWithResult(_0x32945d,_0x441c70){_0x441c70=_0x441c70||0xc8;return function(_0x467e77){if(_0x467e77){return _0x32945d[_0x1e51('0x1a')](_0x441c70)[_0x1e51('0x1c')](_0x467e77);}};}function respondWithFilteredResult(_0x5a5c07,_0x3b01b7){return function(_0x24db4f){if(_0x24db4f){var _0x4526b4=typeof _0x3b01b7['offset']===_0x1e51('0x1d')&&typeof _0x3b01b7['limit']==='undefined';var _0x1f6f4e=_0x24db4f[_0x1e51('0x1e')];var _0x40ae4c=_0x4526b4?0x0:_0x3b01b7[_0x1e51('0x1f')];var _0x4d1aae=_0x4526b4?_0x24db4f[_0x1e51('0x1e')]:_0x3b01b7['offset']+_0x3b01b7[_0x1e51('0x20')];var _0x4a9272;if(_0x4d1aae>=_0x1f6f4e){_0x4d1aae=_0x1f6f4e;_0x4a9272=0xc8;}else{_0x4a9272=0xce;}_0x5a5c07[_0x1e51('0x1a')](_0x4a9272);return _0x5a5c07[_0x1e51('0x21')](_0x1e51('0x22'),_0x40ae4c+'-'+_0x4d1aae+'/'+_0x1f6f4e)[_0x1e51('0x1c')](_0x24db4f);}return null;};}function patchUpdates(_0x506f40){return function(_0x5223c3){try{jsonpatch['apply'](_0x5223c3,_0x506f40,!![]);}catch(_0x548c32){return BPromise[_0x1e51('0x23')](_0x548c32);}return _0x5223c3['save']();};}function saveUpdates(_0x3f7340,_0x28aacb){return function(_0x415154){if(_0x415154){return _0x415154[_0x1e51('0x24')](_0x3f7340)[_0x1e51('0x25')](function(_0xf9298){return _0xf9298;});}return null;};}function removeEntity(_0x270adf,_0x461d3d){return function(_0x4bcdd3){if(_0x4bcdd3){return _0x4bcdd3['destroy']()[_0x1e51('0x25')](function(){_0x270adf[_0x1e51('0x1a')](0xcc)[_0x1e51('0x1b')]();});}};}function handleEntityNotFound(_0x1386db,_0x505d79){return function(_0x54d031){if(!_0x54d031){_0x1386db['sendStatus'](0x194);}return _0x54d031;};}function handleError(_0x1eb83f,_0x2a1561){_0x2a1561=_0x2a1561||0x1f4;return function(_0x433c2d){logger['error'](_0x433c2d[_0x1e51('0x26')]);if(_0x433c2d['name']){delete _0x433c2d['name'];}_0x1eb83f[_0x1e51('0x1a')](_0x2a1561)['send'](_0x433c2d);};}exports[_0x1e51('0x27')]=function(_0x1eb79f,_0x56722f){var _0x3e6ef2={},_0x10ee23={},_0x71c7af={'count':0x0,'rows':[]};var _0x6862d1=_['map'](db['ZendeskAccount']['rawAttributes'],function(_0x20eb9b){return{'name':_0x20eb9b[_0x1e51('0x28')],'type':_0x20eb9b[_0x1e51('0x29')][_0x1e51('0x2a')]};});_0x10ee23[_0x1e51('0x2b')]=_[_0x1e51('0x2c')](_0x6862d1,_0x1e51('0x2d'));_0x10ee23[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x1eb79f[_0x1e51('0x2e')]);_0x10ee23[_0x1e51('0x30')]=_['intersection'](_0x10ee23[_0x1e51('0x2b')],_0x10ee23[_0x1e51('0x2e')]);_0x3e6ef2[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x10ee23[_0x1e51('0x2b')],qs['fields'](_0x1eb79f[_0x1e51('0x2e')]['fields']));_0x3e6ef2[_0x1e51('0x31')]=_0x3e6ef2[_0x1e51('0x31')][_0x1e51('0x33')]?_0x3e6ef2['attributes']:_0x10ee23[_0x1e51('0x2b')];if(!_0x1eb79f['query'][_0x1e51('0x34')]('nolimit')){_0x3e6ef2['limit']=qs[_0x1e51('0x20')](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x3e6ef2['offset']=qs[_0x1e51('0x1f')](_0x1eb79f['query'][_0x1e51('0x1f')]);}_0x3e6ef2[_0x1e51('0x35')]=qs['sort'](_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x3e6ef2[_0x1e51('0x37')]=qs[_0x1e51('0x30')](_[_0x1e51('0x38')](_0x1eb79f[_0x1e51('0x2e')],_0x10ee23['filters']),_0x6862d1);if(_0x1eb79f['query'][_0x1e51('0x39')]){_0x3e6ef2['where']=_[_0x1e51('0x3a')](_0x3e6ef2[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x6862d1,function(_0xcfa1d8){if(_0xcfa1d8[_0x1e51('0x29')]!==_0x1e51('0x3b')){var _0x845a62={};_0x845a62[_0xcfa1d8[_0x1e51('0x2d')]]={'$like':'%'+_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x845a62;}})});}_0x3e6ef2=_[_0x1e51('0x3a')]({},_0x3e6ef2,_0x1eb79f['options']);var _0x29a689={'where':_0x3e6ef2['where']};return db[_0x1e51('0x3c')][_0x1e51('0x1e')](_0x29a689)[_0x1e51('0x25')](function(_0x471386){_0x71c7af[_0x1e51('0x1e')]=_0x471386;if(_0x1eb79f[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x3e6ef2[_0x1e51('0x3e')]=[{'all':!![]}];}return db[_0x1e51('0x3c')][_0x1e51('0x3f')](_0x3e6ef2);})[_0x1e51('0x25')](function(_0x5b4b3f){_0x71c7af['rows']=_0x5b4b3f;return _0x71c7af;})[_0x1e51('0x25')](respondWithFilteredResult(_0x56722f,_0x3e6ef2))[_0x1e51('0x40')](handleError(_0x56722f,null));};exports[_0x1e51('0x41')]=function(_0x4650e4,_0x1ef3d3){var _0x1a9e0d={'raw':![],'where':{'id':_0x4650e4[_0x1e51('0x42')]['id']}},_0x25592c={};_0x25592c['model']=_[_0x1e51('0x2f')](db[_0x1e51('0x3c')][_0x1e51('0x43')]);_0x25592c[_0x1e51('0x2e')]=_[_0x1e51('0x2f')](_0x4650e4[_0x1e51('0x2e')]);_0x25592c[_0x1e51('0x30')]=_['intersection'](_0x25592c[_0x1e51('0x2b')],_0x25592c[_0x1e51('0x2e')]);_0x1a9e0d['attributes']=_[_0x1e51('0x32')](_0x25592c[_0x1e51('0x2b')],qs[_0x1e51('0x44')](_0x4650e4['query'][_0x1e51('0x44')]));_0x1a9e0d[_0x1e51('0x31')]=_0x1a9e0d[_0x1e51('0x31')][_0x1e51('0x33')]?_0x1a9e0d[_0x1e51('0x31')]:_0x25592c[_0x1e51('0x2b')];if(_0x4650e4[_0x1e51('0x2e')][_0x1e51('0x3d')]){_0x1a9e0d[_0x1e51('0x3e')]=[{'all':!![]}];}_0x1a9e0d=_['merge']({},_0x1a9e0d,_0x4650e4[_0x1e51('0x45')]);return db[_0x1e51('0x3c')]['find'](_0x1a9e0d)[_0x1e51('0x25')](handleEntityNotFound(_0x1ef3d3,null))[_0x1e51('0x25')](respondWithResult(_0x1ef3d3,null))[_0x1e51('0x40')](handleError(_0x1ef3d3,null));};exports['create']=function(_0x44468a,_0x4634de){return db[_0x1e51('0x3c')]['create'](_0x44468a[_0x1e51('0x46')],{})['then'](respondWithResult(_0x4634de,0xc9))['catch'](handleError(_0x4634de,null));};exports['update']=function(_0x169e6c,_0x2e79ca){if(_0x169e6c['body']['id']){delete _0x169e6c['body']['id'];}return db[_0x1e51('0x3c')][_0x1e51('0x47')]({'where':{'id':_0x169e6c[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x2e79ca,null))[_0x1e51('0x25')](saveUpdates(_0x169e6c[_0x1e51('0x46')],null))['then'](respondWithResult(_0x2e79ca,null))[_0x1e51('0x40')](handleError(_0x2e79ca,null));};exports['destroy']=function(_0xf6bd35,_0x43589a){return db['ZendeskAccount']['find']({'where':{'id':_0xf6bd35['params']['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x43589a,null))[_0x1e51('0x25')](removeEntity(_0x43589a,null))[_0x1e51('0x40')](handleError(_0x43589a,null));};exports['getConfigurations']=function(_0x2fdee1,_0x1fe669,_0x4226da){var _0x2100d4={};var _0x1ccb55={};var _0x12584c;var _0x32fe1f;return db[_0x1e51('0x3c')]['findOne']({'where':{'id':_0x2fdee1[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x1fe669,null))[_0x1e51('0x25')](function(_0x213edb){if(_0x213edb){_0x12584c=_0x213edb;_0x1ccb55[_0x1e51('0x2b')]=_[_0x1e51('0x2f')](db['ZendeskConfiguration'][_0x1e51('0x43')]);_0x1ccb55['query']=_['keys'](_0x2fdee1['query']);_0x1ccb55[_0x1e51('0x30')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],_0x1ccb55['query']);_0x2100d4[_0x1e51('0x31')]=_[_0x1e51('0x32')](_0x1ccb55[_0x1e51('0x2b')],qs['fields'](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x44')]));_0x2100d4[_0x1e51('0x31')]=_0x2100d4['attributes'][_0x1e51('0x33')]?_0x2100d4[_0x1e51('0x31')]:_0x1ccb55[_0x1e51('0x2b')];_0x2100d4[_0x1e51('0x35')]=qs[_0x1e51('0x36')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x36')]);_0x2100d4[_0x1e51('0x37')]=qs['filters'](_[_0x1e51('0x38')](_0x2fdee1[_0x1e51('0x2e')],_0x1ccb55['filters']));if(_0x2fdee1['query']['filter']){_0x2100d4[_0x1e51('0x37')]=_[_0x1e51('0x3a')](_0x2100d4[_0x1e51('0x37')],{'$or':_[_0x1e51('0x2c')](_0x2100d4[_0x1e51('0x31')],function(_0x3c322c){var _0x45b649={};_0x45b649[_0x3c322c]={'$like':'%'+_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x39')]+'%'};return _0x45b649;})});}_0x2100d4=_['merge']({},_0x2100d4,_0x2fdee1['options']);return _0x12584c['getConfigurations'](_0x2100d4);}})[_0x1e51('0x25')](function(_0x4048a4){if(_0x4048a4){_0x32fe1f=_0x4048a4['length'];if(!_0x2fdee1['query'][_0x1e51('0x34')](_0x1e51('0x48'))){_0x2100d4['limit']=qs[_0x1e51('0x20')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x20')]);_0x2100d4[_0x1e51('0x1f')]=qs[_0x1e51('0x1f')](_0x2fdee1[_0x1e51('0x2e')][_0x1e51('0x1f')]);}return _0x12584c[_0x1e51('0x49')](_0x2100d4);}})[_0x1e51('0x25')](function(_0x32863f){if(_0x32863f){return _0x32863f?{'count':_0x32fe1f,'rows':_0x32863f}:null;}})['then'](respondWithResult(_0x1fe669,null))[_0x1e51('0x40')](handleError(_0x1fe669,null));};exports[_0x1e51('0x4a')]=function(_0x3657a2,_0x402bbd,_0xc720e2){if(_0x3657a2[_0x1e51('0x46')]['id']){delete _0x3657a2['body']['id'];}return db['ZendeskAccount'][_0x1e51('0x4b')]({'where':{'id':_0x3657a2[_0x1e51('0x42')]['id']}})[_0x1e51('0x25')](handleEntityNotFound(_0x402bbd,null))[_0x1e51('0x25')](function(_0x52a439){if(_0x52a439){_0x3657a2['body']['AccountId']=_0x52a439['id'];_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4c')]=integrations[_0x1e51('0x4d')](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2['body'][_0x1e51('0x29')]);_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4f')]=integrations['getDescriptions'](_0x3657a2[_0x1e51('0x46')][_0x1e51('0x4e')],_0x3657a2[_0x1e51('0x46')]['type']);return db[_0x1e51('0x50')][_0x1e51('0x51')](_0x3657a2['body'],{'include':[{'model':db['ZendeskField'],'as':_0x1e51('0x4c')},{'model':db['ZendeskField'],'as':_0x1e51('0x4f')}]});}return null;})['then'](respondWithResult(_0x402bbd,null))[_0x1e51('0x40')](handleError(_0x402bbd,null));};exports[_0x1e51('0x52')]=function(_0x35f12e,_0x457e4a,_0x5142ed){var _0x37f3e6='';return db['ZendeskAccount']['findOne']({'where':{'id':_0x35f12e[_0x1e51('0x42')]['id']},'attributes':['id',_0x1e51('0x53'),_0x1e51('0x54'),'token',_0x1e51('0x55'),_0x1e51('0x56')]})[_0x1e51('0x25')](handleEntityNotFound(_0x457e4a,null))[_0x1e51('0x25')](function(_0x5b76ae){if(_0x5b76ae){_0x37f3e6=_0x5b76ae[_0x1e51('0x56')];var _0x5ef17b=_0x37f3e6['slice'](-0x1);if(_0x5ef17b==='/'){_0x37f3e6=_0x37f3e6[_0x1e51('0x57')](0x0,_0x37f3e6['lastIndexOf'](_0x5ef17b));}var _0x35ece9={'method':'GET','uri':util[_0x1e51('0x58')]('%s/%s',_0x37f3e6,_0x1e51('0x59')),'json':!![]};switch(_0x5b76ae[_0x1e51('0x55')]){case'password':_0x35ece9[_0x1e51('0x5a')]={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5c'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x54')]))[_0x1e51('0x5d')]('base64'))};break;case _0x1e51('0x5e'):_0x35ece9['headers']={'Authorization':util['format'](_0x1e51('0x5b'),new Buffer(util[_0x1e51('0x58')](_0x1e51('0x5f'),_0x5b76ae[_0x1e51('0x53')],_0x5b76ae[_0x1e51('0x5e')]))[_0x1e51('0x5d')](_0x1e51('0x60')))};break;default:throw new db['Sequelize'][(_0x1e51('0x61'))](_0x1e51('0x62'));}return rp(_0x35ece9);}})[_0x1e51('0x25')](function(_0x4c6920){if(_0x4c6920){var _0x4da887=[_0x1e51('0x63'),_0x1e51('0x64'),'group',_0x1e51('0x65')];_[_0x1e51('0x66')](_0x4c6920['ticket_fields'],function(_0x5eb939){return _0x4da887[_0x1e51('0x67')](_0x5eb939[_0x1e51('0x29')]);});return{'count':_0x4c6920[_0x1e51('0x59')][_0x1e51('0x33')],'rows':_[_0x1e51('0x2c')](_0x4c6920[_0x1e51('0x59')],function(_0x3718d9){return{'id':_0x3718d9['id'],'name':_0x3718d9['position']>0x7?_0x3718d9['title']:_0x3718d9[_0x1e51('0x29')],'custom':_0x3718d9[_0x1e51('0x68')]>0x7?!![]:![],'options':_0x3718d9['system_field_options']?_0x3718d9[_0x1e51('0x69')]:_0x3718d9[_0x1e51('0x6a')]?_0x3718d9['custom_field_options']:[]};})};}})[_0x1e51('0x25')](respondWithResult(_0x457e4a,null))['catch'](function(_0x34b98f){var _0x561812=_0x35f12e['query']['test']?0x1f4:_0x34b98f['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x1e51('0x52'),_0x561812,JSON['stringify'](_0x34b98f));delete _0x34b98f[_0x1e51('0x2d')];if(_0x561812===0x191){_0x561812=0x190;}_0x457e4a['status'](_0x561812)[_0x1e51('0x6b')](_0x35f12e[_0x1e51('0x2e')][_0x1e51('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x34b98f[_0x1e51('0x6d')]}:_0x34b98f);});}; \ No newline at end of file +var _0xea28=['stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','params','length','find','catch','create','body','getConfigurations','ZendeskConfiguration','order','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','username','password','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','authType','%s:%s','token','Basic\x20%s','%s/token:%s','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','remove','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error'];(function(_0x32711b,_0x2bf0f6){var _0x3c0760=function(_0x2e13c4){while(--_0x2e13c4){_0x32711b['push'](_0x32711b['shift']());}};_0x3c0760(++_0x2bf0f6);}(_0xea28,0x13a));var _0x8ea2=function(_0x317736,_0x69a3f7){_0x317736=_0x317736-0x0;var _0x327497=_0xea28[_0x317736];return _0x327497;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];var integrations=require(_0x8ea2('0x1b'));function respondWithStatusCode(_0x10aead,_0xe47c0e){_0xe47c0e=_0xe47c0e||0xcc;return function(_0x5e662e){if(_0x5e662e){return _0x10aead[_0x8ea2('0x1c')](_0xe47c0e);}return _0x10aead['status'](_0xe47c0e)['end']();};}function respondWithResult(_0x772bad,_0x4726a7){_0x4726a7=_0x4726a7||0xc8;return function(_0x416bae){if(_0x416bae){return _0x772bad[_0x8ea2('0x1d')](_0x4726a7)[_0x8ea2('0x1e')](_0x416bae);}};}function respondWithFilteredResult(_0xbb9bd1,_0x3cff96){return function(_0x11f5e8){if(_0x11f5e8){var _0x474873=typeof _0x3cff96[_0x8ea2('0x1f')]===_0x8ea2('0x20')&&typeof _0x3cff96[_0x8ea2('0x21')]===_0x8ea2('0x20');var _0xaa8abf=_0x11f5e8[_0x8ea2('0x22')];var _0x174ef2=_0x474873?0x0:_0x3cff96[_0x8ea2('0x1f')];var _0x2a0329=_0x474873?_0x11f5e8[_0x8ea2('0x22')]:_0x3cff96[_0x8ea2('0x1f')]+_0x3cff96[_0x8ea2('0x21')];var _0x287597;if(_0x2a0329>=_0xaa8abf){_0x2a0329=_0xaa8abf;_0x287597=0xc8;}else{_0x287597=0xce;}_0xbb9bd1['status'](_0x287597);return _0xbb9bd1['set'](_0x8ea2('0x23'),_0x174ef2+'-'+_0x2a0329+'/'+_0xaa8abf)[_0x8ea2('0x1e')](_0x11f5e8);}return null;};}function patchUpdates(_0x29151a){return function(_0x5ebc04){try{jsonpatch[_0x8ea2('0x24')](_0x5ebc04,_0x29151a,!![]);}catch(_0x218bd0){return BPromise['reject'](_0x218bd0);}return _0x5ebc04[_0x8ea2('0x25')]();};}function saveUpdates(_0x283f00,_0x37229a){return function(_0x9f9548){if(_0x9f9548){return _0x9f9548[_0x8ea2('0x26')](_0x283f00)[_0x8ea2('0x27')](function(_0x199417){return _0x199417;});}return null;};}function removeEntity(_0x1e4cc9,_0x18ec34){return function(_0x4d5030){if(_0x4d5030){return _0x4d5030[_0x8ea2('0x28')]()['then'](function(){_0x1e4cc9[_0x8ea2('0x1d')](0xcc)[_0x8ea2('0x29')]();});}};}function handleEntityNotFound(_0x29b38f,_0x4e2106){return function(_0x53ed43){if(!_0x53ed43){_0x29b38f[_0x8ea2('0x1c')](0x194);}return _0x53ed43;};}function handleError(_0x4dc7bf,_0x200a49){_0x200a49=_0x200a49||0x1f4;return function(_0x4e786d){logger[_0x8ea2('0x2a')](_0x4e786d[_0x8ea2('0x2b')]);if(_0x4e786d[_0x8ea2('0x2c')]){delete _0x4e786d[_0x8ea2('0x2c')];}_0x4dc7bf['status'](_0x200a49)['send'](_0x4e786d);};}exports[_0x8ea2('0x2d')]=function(_0x4da5b3,_0x4a9875){var _0x287078={},_0x24f187={},_0x41f482={'count':0x0,'rows':[]};var _0x307c74=_[_0x8ea2('0x2e')](db[_0x8ea2('0x2f')][_0x8ea2('0x30')],function(_0x19e868){return{'name':_0x19e868[_0x8ea2('0x31')],'type':_0x19e868['type']['key']};});_0x24f187[_0x8ea2('0x32')]=_[_0x8ea2('0x2e')](_0x307c74,'name');_0x24f187['query']=_[_0x8ea2('0x33')](_0x4da5b3['query']);_0x24f187[_0x8ea2('0x34')]=_[_0x8ea2('0x35')](_0x24f187['model'],_0x24f187[_0x8ea2('0x36')]);_0x287078[_0x8ea2('0x37')]=_[_0x8ea2('0x35')](_0x24f187['model'],qs['fields'](_0x4da5b3['query'][_0x8ea2('0x38')]));_0x287078[_0x8ea2('0x37')]=_0x287078[_0x8ea2('0x37')]['length']?_0x287078[_0x8ea2('0x37')]:_0x24f187[_0x8ea2('0x32')];if(!_0x4da5b3[_0x8ea2('0x36')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x287078[_0x8ea2('0x21')]=qs[_0x8ea2('0x21')](_0x4da5b3[_0x8ea2('0x36')]['limit']);_0x287078[_0x8ea2('0x1f')]=qs[_0x8ea2('0x1f')](_0x4da5b3[_0x8ea2('0x36')][_0x8ea2('0x1f')]);}_0x287078['order']=qs[_0x8ea2('0x3b')](_0x4da5b3['query'][_0x8ea2('0x3b')]);_0x287078[_0x8ea2('0x3c')]=qs[_0x8ea2('0x34')](_[_0x8ea2('0x3d')](_0x4da5b3['query'],_0x24f187[_0x8ea2('0x34')]),_0x307c74);if(_0x4da5b3['query']['filter']){_0x287078[_0x8ea2('0x3c')]=_['merge'](_0x287078[_0x8ea2('0x3c')],{'$or':_[_0x8ea2('0x2e')](_0x307c74,function(_0x1c229d){if(_0x1c229d[_0x8ea2('0x3e')]!==_0x8ea2('0x3f')){var _0x4ae536={};_0x4ae536[_0x1c229d[_0x8ea2('0x2c')]]={'$like':'%'+_0x4da5b3['query'][_0x8ea2('0x40')]+'%'};return _0x4ae536;}})});}_0x287078=_[_0x8ea2('0x41')]({},_0x287078,_0x4da5b3[_0x8ea2('0x42')]);var _0x3995ff={'where':_0x287078['where']};return db[_0x8ea2('0x2f')]['count'](_0x3995ff)[_0x8ea2('0x27')](function(_0x5ba351){_0x41f482[_0x8ea2('0x22')]=_0x5ba351;if(_0x4da5b3[_0x8ea2('0x36')][_0x8ea2('0x43')]){_0x287078[_0x8ea2('0x44')]=[{'all':!![]}];}return db[_0x8ea2('0x2f')][_0x8ea2('0x45')](_0x287078);})[_0x8ea2('0x27')](function(_0x478d5c){_0x41f482['rows']=_0x478d5c;return _0x41f482;})[_0x8ea2('0x27')](respondWithFilteredResult(_0x4a9875,_0x287078))['catch'](handleError(_0x4a9875,null));};exports['show']=function(_0x59e2fa,_0x3cbc09){var _0x5d9ba0={'raw':![],'where':{'id':_0x59e2fa[_0x8ea2('0x46')]['id']}},_0x40a532={};_0x40a532[_0x8ea2('0x32')]=_[_0x8ea2('0x33')](db[_0x8ea2('0x2f')][_0x8ea2('0x30')]);_0x40a532[_0x8ea2('0x36')]=_[_0x8ea2('0x33')](_0x59e2fa['query']);_0x40a532[_0x8ea2('0x34')]=_[_0x8ea2('0x35')](_0x40a532[_0x8ea2('0x32')],_0x40a532['query']);_0x5d9ba0[_0x8ea2('0x37')]=_[_0x8ea2('0x35')](_0x40a532[_0x8ea2('0x32')],qs[_0x8ea2('0x38')](_0x59e2fa[_0x8ea2('0x36')]['fields']));_0x5d9ba0[_0x8ea2('0x37')]=_0x5d9ba0[_0x8ea2('0x37')][_0x8ea2('0x47')]?_0x5d9ba0['attributes']:_0x40a532[_0x8ea2('0x32')];if(_0x59e2fa[_0x8ea2('0x36')][_0x8ea2('0x43')]){_0x5d9ba0[_0x8ea2('0x44')]=[{'all':!![]}];}_0x5d9ba0=_[_0x8ea2('0x41')]({},_0x5d9ba0,_0x59e2fa[_0x8ea2('0x42')]);return db[_0x8ea2('0x2f')][_0x8ea2('0x48')](_0x5d9ba0)[_0x8ea2('0x27')](handleEntityNotFound(_0x3cbc09,null))[_0x8ea2('0x27')](respondWithResult(_0x3cbc09,null))[_0x8ea2('0x49')](handleError(_0x3cbc09,null));};exports[_0x8ea2('0x4a')]=function(_0x220970,_0x12e81f){return db['ZendeskAccount'][_0x8ea2('0x4a')](_0x220970[_0x8ea2('0x4b')],{})[_0x8ea2('0x27')](respondWithResult(_0x12e81f,0xc9))[_0x8ea2('0x49')](handleError(_0x12e81f,null));};exports[_0x8ea2('0x26')]=function(_0x1daa25,_0x11b3ef){if(_0x1daa25[_0x8ea2('0x4b')]['id']){delete _0x1daa25['body']['id'];}return db[_0x8ea2('0x2f')][_0x8ea2('0x48')]({'where':{'id':_0x1daa25[_0x8ea2('0x46')]['id']}})['then'](handleEntityNotFound(_0x11b3ef,null))['then'](saveUpdates(_0x1daa25[_0x8ea2('0x4b')],null))[_0x8ea2('0x27')](respondWithResult(_0x11b3ef,null))[_0x8ea2('0x49')](handleError(_0x11b3ef,null));};exports['destroy']=function(_0x3d86f3,_0x315b5d){return db[_0x8ea2('0x2f')][_0x8ea2('0x48')]({'where':{'id':_0x3d86f3[_0x8ea2('0x46')]['id']}})['then'](handleEntityNotFound(_0x315b5d,null))['then'](removeEntity(_0x315b5d,null))[_0x8ea2('0x49')](handleError(_0x315b5d,null));};exports[_0x8ea2('0x4c')]=function(_0x1b8c4b,_0x5e4268,_0x18cbe9){var _0x100e29={};var _0x442dce={};var _0x54c9d7;var _0x5c6524;return db['ZendeskAccount']['findOne']({'where':{'id':_0x1b8c4b['params']['id']}})[_0x8ea2('0x27')](handleEntityNotFound(_0x5e4268,null))[_0x8ea2('0x27')](function(_0x5f56f8){if(_0x5f56f8){_0x54c9d7=_0x5f56f8;_0x442dce['model']=_[_0x8ea2('0x33')](db[_0x8ea2('0x4d')][_0x8ea2('0x30')]);_0x442dce['query']=_[_0x8ea2('0x33')](_0x1b8c4b[_0x8ea2('0x36')]);_0x442dce['filters']=_[_0x8ea2('0x35')](_0x442dce[_0x8ea2('0x32')],_0x442dce[_0x8ea2('0x36')]);_0x100e29[_0x8ea2('0x37')]=_[_0x8ea2('0x35')](_0x442dce['model'],qs['fields'](_0x1b8c4b['query'][_0x8ea2('0x38')]));_0x100e29[_0x8ea2('0x37')]=_0x100e29[_0x8ea2('0x37')][_0x8ea2('0x47')]?_0x100e29[_0x8ea2('0x37')]:_0x442dce[_0x8ea2('0x32')];_0x100e29[_0x8ea2('0x4e')]=qs['sort'](_0x1b8c4b['query']['sort']);_0x100e29[_0x8ea2('0x3c')]=qs[_0x8ea2('0x34')](_[_0x8ea2('0x3d')](_0x1b8c4b[_0x8ea2('0x36')],_0x442dce['filters']));if(_0x1b8c4b[_0x8ea2('0x36')][_0x8ea2('0x40')]){_0x100e29['where']=_[_0x8ea2('0x41')](_0x100e29[_0x8ea2('0x3c')],{'$or':_[_0x8ea2('0x2e')](_0x100e29[_0x8ea2('0x37')],function(_0x3de1a2){var _0x48c1de={};_0x48c1de[_0x3de1a2]={'$like':'%'+_0x1b8c4b['query']['filter']+'%'};return _0x48c1de;})});}_0x100e29=_[_0x8ea2('0x41')]({},_0x100e29,_0x1b8c4b[_0x8ea2('0x42')]);return _0x54c9d7[_0x8ea2('0x4c')](_0x100e29);}})[_0x8ea2('0x27')](function(_0x3c44ef){if(_0x3c44ef){_0x5c6524=_0x3c44ef['length'];if(!_0x1b8c4b[_0x8ea2('0x36')][_0x8ea2('0x39')](_0x8ea2('0x3a'))){_0x100e29[_0x8ea2('0x21')]=qs['limit'](_0x1b8c4b[_0x8ea2('0x36')]['limit']);_0x100e29[_0x8ea2('0x1f')]=qs['offset'](_0x1b8c4b[_0x8ea2('0x36')][_0x8ea2('0x1f')]);}return _0x54c9d7['getConfigurations'](_0x100e29);}})['then'](function(_0x1d0326){if(_0x1d0326){return _0x1d0326?{'count':_0x5c6524,'rows':_0x1d0326}:null;}})['then'](respondWithResult(_0x5e4268,null))[_0x8ea2('0x49')](handleError(_0x5e4268,null));};exports[_0x8ea2('0x4f')]=function(_0x1c5489,_0x23185e,_0x4dab8f){if(_0x1c5489[_0x8ea2('0x4b')]['id']){delete _0x1c5489[_0x8ea2('0x4b')]['id'];}return db[_0x8ea2('0x2f')][_0x8ea2('0x50')]({'where':{'id':_0x1c5489[_0x8ea2('0x46')]['id']}})[_0x8ea2('0x27')](handleEntityNotFound(_0x23185e,null))[_0x8ea2('0x27')](function(_0x3a78c9){if(_0x3a78c9){_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x51')]=_0x3a78c9['id'];_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x52')]=integrations['getSubjects'](_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x53')],_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x3e')]);_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x54')]=integrations[_0x8ea2('0x55')](_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x53')],_0x1c5489[_0x8ea2('0x4b')][_0x8ea2('0x3e')]);return db[_0x8ea2('0x4d')]['create'](_0x1c5489[_0x8ea2('0x4b')],{'include':[{'model':db[_0x8ea2('0x56')],'as':_0x8ea2('0x52')},{'model':db[_0x8ea2('0x56')],'as':_0x8ea2('0x54')}]});}return null;})['then'](respondWithResult(_0x23185e,null))['catch'](handleError(_0x23185e,null));};exports['getFields']=function(_0x17f2f2,_0xe8b3ed,_0x380066){var _0x31bda0='';return db[_0x8ea2('0x2f')][_0x8ea2('0x50')]({'where':{'id':_0x17f2f2['params']['id']},'attributes':['id',_0x8ea2('0x57'),_0x8ea2('0x58'),'token','authType',_0x8ea2('0x59')]})[_0x8ea2('0x27')](handleEntityNotFound(_0xe8b3ed,null))[_0x8ea2('0x27')](function(_0x289e74){if(_0x289e74){_0x31bda0=_0x289e74[_0x8ea2('0x59')];var _0x32a8f2=_0x31bda0[_0x8ea2('0x5a')](-0x1);if(_0x32a8f2==='/'){_0x31bda0=_0x31bda0['substring'](0x0,_0x31bda0[_0x8ea2('0x5b')](_0x32a8f2));}var _0x3fa2c8={'method':_0x8ea2('0x5c'),'uri':util[_0x8ea2('0x5d')]('%s/%s',_0x31bda0,_0x8ea2('0x5e')),'json':!![]};switch(_0x289e74[_0x8ea2('0x5f')]){case _0x8ea2('0x58'):_0x3fa2c8['headers']={'Authorization':util[_0x8ea2('0x5d')]('Basic\x20%s',new Buffer(util['format'](_0x8ea2('0x60'),_0x289e74[_0x8ea2('0x57')],_0x289e74['password']))['toString']('base64'))};break;case _0x8ea2('0x61'):_0x3fa2c8['headers']={'Authorization':util['format'](_0x8ea2('0x62'),new Buffer(util[_0x8ea2('0x5d')](_0x8ea2('0x63'),_0x289e74[_0x8ea2('0x57')],_0x289e74[_0x8ea2('0x61')]))[_0x8ea2('0x64')](_0x8ea2('0x65')))};break;default:throw new db[(_0x8ea2('0x66'))][(_0x8ea2('0x67'))](_0x8ea2('0x68'));}return rp(_0x3fa2c8);}})[_0x8ea2('0x27')](function(_0x15eab7){if(_0x15eab7){var _0x1961a9=[_0x8ea2('0x69'),'description',_0x8ea2('0x6a'),_0x8ea2('0x6b')];_[_0x8ea2('0x6c')](_0x15eab7['ticket_fields'],function(_0x1807bb){return _0x1961a9['includes'](_0x1807bb[_0x8ea2('0x3e')]);});return{'count':_0x15eab7['ticket_fields'][_0x8ea2('0x47')],'rows':_['map'](_0x15eab7[_0x8ea2('0x5e')],function(_0x165052){return{'id':_0x165052['id'],'name':_0x165052['position']>0x7?_0x165052[_0x8ea2('0x6d')]:_0x165052['type'],'custom':_0x165052[_0x8ea2('0x6e')]>0x7?!![]:![],'options':_0x165052[_0x8ea2('0x6f')]?_0x165052[_0x8ea2('0x6f')]:_0x165052[_0x8ea2('0x70')]?_0x165052[_0x8ea2('0x70')]:[]};})};}})['then'](respondWithResult(_0xe8b3ed,null))['catch'](function(_0x39d0d7){var _0x4b7e5e=_0x17f2f2[_0x8ea2('0x36')][_0x8ea2('0x71')]?0x1f4:_0x39d0d7[_0x8ea2('0x72')]||0x1f4;logger[_0x8ea2('0x2a')](_0x8ea2('0x73'),_0x8ea2('0x74'),_0x4b7e5e,JSON['stringify'](_0x39d0d7));delete _0x39d0d7['name'];if(_0x4b7e5e===0x191){_0x4b7e5e=0x190;}_0xe8b3ed['status'](_0x4b7e5e)[_0x8ea2('0x75')](_0x17f2f2['query'][_0x8ea2('0x71')]?{'message':_0x8ea2('0x76'),'statusCode':_0x39d0d7[_0x8ea2('0x72')]}:_0x39d0d7);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 8b6ab5e..b835a52 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 _0x3dd5=['define','ZendeskAccount','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3dd5,0x9c));var _0x53dd=function(_0xf5b2bc,_0x129b92){_0xf5b2bc=_0xf5b2bc-0x0;var _0x120dd3=_0x3dd5[_0xf5b2bc];return _0x120dd3;};'use strict';var _=require(_0x53dd('0x0'));var util=require(_0x53dd('0x1'));var logger=require(_0x53dd('0x2'))('api');var moment=require('moment');var BPromise=require(_0x53dd('0x3'));var rp=require(_0x53dd('0x4'));var fs=require('fs');var path=require(_0x53dd('0x5'));var rimraf=require('rimraf');var config=require(_0x53dd('0x6'));var attributes=require(_0x53dd('0x7'));var integrations=require(_0x53dd('0x8'));module['exports']=function(_0x4413c1,_0x130e37){return _0x4413c1[_0x53dd('0x9')](_0x53dd('0xa'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9341=['../../components/integrations/configuration','define','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','path','./intZendeskAccount.attributes'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x9341,0x161));var _0x1934=function(_0x5c35af,_0x3ef387){_0x5c35af=_0x5c35af-0x0;var _0x811f1=_0x9341[_0x5c35af];return _0x811f1;};'use strict';var _=require(_0x1934('0x0'));var util=require('util');var logger=require(_0x1934('0x1'))(_0x1934('0x2'));var moment=require(_0x1934('0x3'));var BPromise=require(_0x1934('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1934('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1934('0x6'));var integrations=require(_0x1934('0x7'));module['exports']=function(_0x30f8b3,_0xbfdc8e){return _0x30f8b3[_0x1934('0x8')]('ZendeskAccount',attributes,{'tableName':_0x1934('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 551b603..af32576 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 _0xbd1f=['ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','map','model','find','where','ShowZendeskAccount','debug','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1012c0,_0x533c37){var _0x402b4a=function(_0x47d60f){while(--_0x47d60f){_0x1012c0['push'](_0x1012c0['shift']());}};_0x402b4a(++_0x533c37);}(_0xbd1f,0x145));var _0xfbd1=function(_0x1b08d4,_0x8a710c){_0x1b08d4=_0x1b08d4-0x0;var _0x9aef3e=_0xbd1f[_0x1b08d4];return _0x9aef3e;};'use strict';var _=require(_0xfbd1('0x0'));var util=require(_0xfbd1('0x1'));var moment=require(_0xfbd1('0x2'));var BPromise=require(_0xfbd1('0x3'));var rs=require(_0xfbd1('0x4'));var fs=require('fs');var Redis=require(_0xfbd1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xfbd1('0x6'));var logger=require(_0xfbd1('0x7'))(_0xfbd1('0x8'));var config=require(_0xfbd1('0x9'));var jayson=require(_0xfbd1('0xa'));var client=jayson[_0xfbd1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25cc49,_0x229497,_0x2b6396){return new BPromise(function(_0x1274bd,_0x15b2e2){return client[_0xfbd1('0xc')](_0x25cc49,_0x2b6396)[_0xfbd1('0xd')](function(_0x127c27){logger[_0xfbd1('0xe')](_0xfbd1('0xf'),_0x229497,_0xfbd1('0x10'));logger['debug'](_0xfbd1('0x11'),_0x229497,'request\x20sent',JSON[_0xfbd1('0x12')](_0x127c27));if(_0x127c27['error']){if(_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x14')]===0x1f4){logger['error'](_0xfbd1('0xf'),_0x229497,_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x15')]);return _0x15b2e2(_0x127c27['error']['message']);}logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x229497,_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x15')]);return _0x1274bd(_0x127c27[_0xfbd1('0x13')][_0xfbd1('0x15')]);}else{logger[_0xfbd1('0xe')](_0xfbd1('0xf'),_0x229497,_0xfbd1('0x10'));_0x1274bd(_0x127c27[_0xfbd1('0x16')][_0xfbd1('0x15')]);}})['catch'](function(_0x449209){logger[_0xfbd1('0x13')](_0xfbd1('0xf'),_0x229497,_0x449209);_0x15b2e2(_0x449209);});});}exports[_0xfbd1('0x17')]=function(_0x5da882){var _0x4e0df0=this;return new Promise(function(_0x543c5b,_0x5c8f65){return db[_0xfbd1('0x18')][_0xfbd1('0x19')]({'raw':_0x5da882[_0xfbd1('0x1a')]?_0x5da882[_0xfbd1('0x1a')][_0xfbd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x5da882[_0xfbd1('0x1a')]?_0x5da882[_0xfbd1('0x1a')]['where']||null:null,'attributes':_0x5da882[_0xfbd1('0x1a')]?_0x5da882['options'][_0xfbd1('0x1c')]||null:null,'limit':_0x5da882['options']?_0x5da882['options'][_0xfbd1('0x1d')]||null:null,'include':_0x5da882['options']?_0x5da882['options'][_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x5da882[_0xfbd1('0x1a')][_0xfbd1('0x1e')],function(_0x54782a){return{'model':db[_0x54782a[_0xfbd1('0x20')]],'as':_0x54782a['as'],'attributes':_0x54782a['attributes'],'include':_0x54782a[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x54782a['include'],function(_0x138efe){return{'model':db[_0x138efe[_0xfbd1('0x20')]],'as':_0x138efe['as'],'attributes':_0x138efe[_0xfbd1('0x1c')],'include':_0x138efe[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x138efe[_0xfbd1('0x1e')],function(_0xb1242b){return{'model':db[_0xb1242b[_0xfbd1('0x20')]],'as':_0xb1242b['as'],'attributes':_0xb1242b['attributes']};}):[]};}):[]};}):[]:[]})[_0xfbd1('0xd')](function(_0x42f0ba){logger[_0xfbd1('0xe')](_0xfbd1('0x17'),_0x5da882);logger['debug'](_0xfbd1('0x17'),_0x5da882,JSON['stringify'](_0x42f0ba));_0x543c5b(_0x42f0ba);})['catch'](function(_0x2610f2){logger[_0xfbd1('0x13')](_0xfbd1('0x17'),_0x2610f2[_0xfbd1('0x15')],_0x5da882);_0x5c8f65(_0x4e0df0[_0xfbd1('0x13')](0x1f4,_0x2610f2[_0xfbd1('0x15')]));});});};exports['ShowZendeskAccount']=function(_0x4986af){var _0x55a037=this;return new Promise(function(_0x39effe,_0x3b1003){return db[_0xfbd1('0x18')][_0xfbd1('0x21')]({'raw':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x1b')]===undefined?!![]:![]:!![],'where':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x22')]||null:null,'attributes':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x1c')]||null:null,'include':_0x4986af[_0xfbd1('0x1a')]?_0x4986af[_0xfbd1('0x1a')]['include']?_[_0xfbd1('0x1f')](_0x4986af[_0xfbd1('0x1a')][_0xfbd1('0x1e')],function(_0x34386d){return{'model':db[_0x34386d['model']],'as':_0x34386d['as'],'attributes':_0x34386d['attributes'],'include':_0x34386d[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x34386d['include'],function(_0x8f6cf4){return{'model':db[_0x8f6cf4[_0xfbd1('0x20')]],'as':_0x8f6cf4['as'],'attributes':_0x8f6cf4[_0xfbd1('0x1c')],'include':_0x8f6cf4[_0xfbd1('0x1e')]?_[_0xfbd1('0x1f')](_0x8f6cf4[_0xfbd1('0x1e')],function(_0x13f113){return{'model':db[_0x13f113[_0xfbd1('0x20')]],'as':_0x13f113['as'],'attributes':_0x13f113[_0xfbd1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfbd1('0xd')](function(_0x2c175f){logger[_0xfbd1('0xe')](_0xfbd1('0x23'),_0x4986af);logger[_0xfbd1('0x24')](_0xfbd1('0x23'),_0x4986af,JSON[_0xfbd1('0x12')](_0x2c175f));_0x39effe(_0x2c175f);})[_0xfbd1('0x25')](function(_0x10c6ad){logger[_0xfbd1('0x13')](_0xfbd1('0x23'),_0x10c6ad['message'],_0x4986af);_0x3b1003(_0x55a037[_0xfbd1('0x13')](0x1f4,_0x10c6ad[_0xfbd1('0x15')]));});});}; \ No newline at end of file +var _0x8343=['find','ShowZendeskAccount','debug','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','map','model','include'];(function(_0xbf2cb4,_0x184020){var _0x4f68a1=function(_0x1cf0a2){while(--_0x1cf0a2){_0xbf2cb4['push'](_0xbf2cb4['shift']());}};_0x4f68a1(++_0x184020);}(_0x8343,0xa9));var _0x3834=function(_0x168ec1,_0x4992ff){_0x168ec1=_0x168ec1-0x0;var _0x14d4fe=_0x8343[_0x168ec1];return _0x14d4fe;};'use strict';var _=require(_0x3834('0x0'));var util=require(_0x3834('0x1'));var moment=require(_0x3834('0x2'));var BPromise=require('bluebird');var rs=require(_0x3834('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3834('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x3834('0x5'));var jayson=require(_0x3834('0x6'));var client=jayson[_0x3834('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x236509,_0x1c0b23,_0x469e80){return new BPromise(function(_0x994230,_0x520a4f){return client['request'](_0x236509,_0x469e80)[_0x3834('0x8')](function(_0x2faafa){logger[_0x3834('0x9')](_0x3834('0xa'),_0x1c0b23,_0x3834('0xb'));logger['debug'](_0x3834('0xc'),_0x1c0b23,'request\x20sent',JSON['stringify'](_0x2faafa));if(_0x2faafa['error']){if(_0x2faafa[_0x3834('0xd')][_0x3834('0xe')]===0x1f4){logger[_0x3834('0xd')](_0x3834('0xa'),_0x1c0b23,_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);return _0x520a4f(_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);}logger[_0x3834('0xd')](_0x3834('0xa'),_0x1c0b23,_0x2faafa[_0x3834('0xd')][_0x3834('0xf')]);return _0x994230(_0x2faafa['error'][_0x3834('0xf')]);}else{logger[_0x3834('0x9')](_0x3834('0xa'),_0x1c0b23,_0x3834('0xb'));_0x994230(_0x2faafa[_0x3834('0x10')][_0x3834('0xf')]);}})[_0x3834('0x11')](function(_0x3871c3){logger[_0x3834('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x1c0b23,_0x3871c3);_0x520a4f(_0x3871c3);});});}exports[_0x3834('0x12')]=function(_0x82ab35){var _0x225f2c=this;return new Promise(function(_0x46fd33,_0x590549){return db[_0x3834('0x13')][_0x3834('0x14')]({'raw':_0x82ab35[_0x3834('0x15')]?_0x82ab35[_0x3834('0x15')][_0x3834('0x16')]===undefined?!![]:![]:!![],'where':_0x82ab35[_0x3834('0x15')]?_0x82ab35[_0x3834('0x15')][_0x3834('0x17')]||null:null,'attributes':_0x82ab35[_0x3834('0x15')]?_0x82ab35[_0x3834('0x15')][_0x3834('0x18')]||null:null,'limit':_0x82ab35['options']?_0x82ab35[_0x3834('0x15')][_0x3834('0x19')]||null:null,'include':_0x82ab35[_0x3834('0x15')]?_0x82ab35[_0x3834('0x15')]['include']?_[_0x3834('0x1a')](_0x82ab35[_0x3834('0x15')]['include'],function(_0x5b33b5){return{'model':db[_0x5b33b5[_0x3834('0x1b')]],'as':_0x5b33b5['as'],'attributes':_0x5b33b5[_0x3834('0x18')],'include':_0x5b33b5[_0x3834('0x1c')]?_['map'](_0x5b33b5[_0x3834('0x1c')],function(_0x49f763){return{'model':db[_0x49f763[_0x3834('0x1b')]],'as':_0x49f763['as'],'attributes':_0x49f763[_0x3834('0x18')],'include':_0x49f763[_0x3834('0x1c')]?_['map'](_0x49f763[_0x3834('0x1c')],function(_0x38c59d){return{'model':db[_0x38c59d['model']],'as':_0x38c59d['as'],'attributes':_0x38c59d[_0x3834('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3834('0x8')](function(_0x1ff1ed){logger[_0x3834('0x9')](_0x3834('0x12'),_0x82ab35);logger['debug'](_0x3834('0x12'),_0x82ab35,JSON['stringify'](_0x1ff1ed));_0x46fd33(_0x1ff1ed);})[_0x3834('0x11')](function(_0x1f36fb){logger['error'](_0x3834('0x12'),_0x1f36fb[_0x3834('0xf')],_0x82ab35);_0x590549(_0x225f2c[_0x3834('0xd')](0x1f4,_0x1f36fb[_0x3834('0xf')]));});});};exports['ShowZendeskAccount']=function(_0x40289e){var _0x338057=this;return new Promise(function(_0x40fc1a,_0x12065e){return db['ZendeskAccount'][_0x3834('0x1d')]({'raw':_0x40289e[_0x3834('0x15')]?_0x40289e[_0x3834('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x40289e[_0x3834('0x15')]?_0x40289e['options'][_0x3834('0x17')]||null:null,'attributes':_0x40289e[_0x3834('0x15')]?_0x40289e[_0x3834('0x15')][_0x3834('0x18')]||null:null,'include':_0x40289e[_0x3834('0x15')]?_0x40289e[_0x3834('0x15')]['include']?_['map'](_0x40289e[_0x3834('0x15')][_0x3834('0x1c')],function(_0x479f45){return{'model':db[_0x479f45[_0x3834('0x1b')]],'as':_0x479f45['as'],'attributes':_0x479f45['attributes'],'include':_0x479f45[_0x3834('0x1c')]?_[_0x3834('0x1a')](_0x479f45['include'],function(_0x159459){return{'model':db[_0x159459[_0x3834('0x1b')]],'as':_0x159459['as'],'attributes':_0x159459['attributes'],'include':_0x159459[_0x3834('0x1c')]?_[_0x3834('0x1a')](_0x159459[_0x3834('0x1c')],function(_0x123bf9){return{'model':db[_0x123bf9['model']],'as':_0x123bf9['as'],'attributes':_0x123bf9[_0x3834('0x18')]};}):[]};}):[]};}):[]:[]})[_0x3834('0x8')](function(_0xa4ee24){logger['info'](_0x3834('0x1e'),_0x40289e);logger[_0x3834('0x1f')]('ShowZendeskAccount',_0x40289e,JSON[_0x3834('0x20')](_0xa4ee24));_0x40fc1a(_0xa4ee24);})[_0x3834('0x11')](function(_0x50f62a){logger['error']('ShowZendeskAccount',_0x50f62a[_0x3834('0xf')],_0x40289e);_0x12065e(_0x338057[_0x3834('0xd')](0x1f4,_0x50f62a[_0x3834('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index bf34d81..7a2480e 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 _0xac4a=['../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','get','show','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x4420da,_0x4c65fc){var _0x51f9c3=function(_0x48d702){while(--_0x48d702){_0x4420da['push'](_0x4420da['shift']());}};_0x51f9c3(++_0x4c65fc);}(_0xac4a,0x13f));var _0xaac4=function(_0x1c2398,_0x2aaad8){_0x1c2398=_0x1c2398-0x0;var _0x3883f8=_0xac4a[_0x1c2398];return _0x3883f8;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['get']('/:id/fields',auth[_0xaac4('0x9')](),controller['getFields']);router[_0xaac4('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router[_0xaac4('0xa')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xe')]);router['get']('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);router[_0xaac4('0x10')]('/',auth['isAuthenticated'](),controller[_0xaac4('0x11')]);router[_0xaac4('0x10')]('/:id/tags',auth[_0xaac4('0x9')](),controller[_0xaac4('0x12')]);router[_0xaac4('0x13')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x15')]);router[_0xaac4('0x16')](_0xaac4('0x14'),auth[_0xaac4('0x9')](),controller[_0xaac4('0x17')]);module[_0xaac4('0x18')]=router; \ No newline at end of file +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(_0x156dba,_0x4e513e){var _0xa401c=function(_0x2fcb8c){while(--_0x2fcb8c){_0x156dba['push'](_0x156dba['shift']());}};_0xa401c(++_0x4e513e);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x5e8d3a,_0x2ac363){_0x5e8d3a=_0x5e8d3a-0x0;var _0x3a0dbb=_0xbdb7[_0x5e8d3a];return _0x3a0dbb;};'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 diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 927b3ad..973807f 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 _0x7db7=['STRING','sequelize','exports'];(function(_0x1876dc,_0x362351){var _0x26ee8c=function(_0x523507){while(--_0x523507){_0x1876dc['push'](_0x1876dc['shift']());}};_0x26ee8c(++_0x362351);}(_0x7db7,0x6d));var _0x77db=function(_0x17d00a,_0x4f3752){_0x17d00a=_0x17d00a-0x0;var _0x42ffd0=_0x7db7[_0x17d00a];return _0x42ffd0;};'use strict';var Sequelize=require(_0x77db('0x0'));module[_0x77db('0x1')]={'name':{'type':Sequelize[_0x77db('0x2')]},'description':{'type':Sequelize[_0x77db('0x2')]}}; \ No newline at end of file +var _0x63e0=['STRING','exports'];(function(_0x48f4c5,_0x56e4c3){var _0x40ab65=function(_0x27426b){while(--_0x27426b){_0x48f4c5['push'](_0x48f4c5['shift']());}};_0x40ab65(++_0x56e4c3);}(_0x63e0,0xdf));var _0x063e=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x63e0[_0xef8146];return _0x5a6cb0;};'use strict';var Sequelize=require('sequelize');module[_0x063e('0x0')]={'name':{'type':Sequelize[_0x063e('0x1')]},'description':{'type':Sequelize[_0x063e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 54425b6..f1da974 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 _0x6491=['findAll','rows','catch','show','params','options','find','create','body','findOne','ZendeskField','getFields','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','rimraf','zip-dir','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include'];(function(_0x54991c,_0x46081c){var _0x4627f0=function(_0x2519e1){while(--_0x2519e1){_0x54991c['push'](_0x54991c['shift']());}};_0x4627f0(++_0x46081c);}(_0x6491,0x10c));var _0x1649=function(_0x3f18dc,_0x34b11a){_0x3f18dc=_0x3f18dc-0x0;var _0x229829=_0x6491[_0x3f18dc];return _0x229829;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1649('0x0'));var zipdir=require(_0x1649('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1649('0x2'));var BPromise=require(_0x1649('0x3'));var Mustache=require(_0x1649('0x4'));var util=require('util');var path=require(_0x1649('0x5'));var sox=require('sox');var csv=require(_0x1649('0x6'));var ejs=require(_0x1649('0x7'));var fs=require('fs');var fs_extra=require(_0x1649('0x8'));var _=require(_0x1649('0x9'));var squel=require('squel');var crypto=require(_0x1649('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x1649('0xb'));var toCsv=require(_0x1649('0x6'));var querystring=require('querystring');var Papa=require(_0x1649('0xc'));var Redis=require(_0x1649('0xd'));var authService=require(_0x1649('0xe'));var qs=require(_0x1649('0xf'));var as=require(_0x1649('0x10'));var hardwareService=require(_0x1649('0x11'));var logger=require('../../config/logger')(_0x1649('0x12'));var utils=require(_0x1649('0x13'));var config=require(_0x1649('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1649('0x15'))['db'];function respondWithStatusCode(_0x22e3a6,_0x1c1b80){_0x1c1b80=_0x1c1b80||0xcc;return function(_0x1dc6de){if(_0x1dc6de){return _0x22e3a6[_0x1649('0x16')](_0x1c1b80);}return _0x22e3a6[_0x1649('0x17')](_0x1c1b80)['end']();};}function respondWithResult(_0xc7afbf,_0x299e1b){_0x299e1b=_0x299e1b||0xc8;return function(_0x3df220){if(_0x3df220){return _0xc7afbf['status'](_0x299e1b)['json'](_0x3df220);}};}function respondWithFilteredResult(_0x245f4d,_0x36263e){return function(_0x55fd3d){if(_0x55fd3d){var _0x12439b=typeof _0x36263e['offset']===_0x1649('0x18')&&typeof _0x36263e[_0x1649('0x19')]===_0x1649('0x18');var _0x2c33c0=_0x55fd3d[_0x1649('0x1a')];var _0x51054d=_0x12439b?0x0:_0x36263e[_0x1649('0x1b')];var _0x44ae44=_0x12439b?_0x55fd3d['count']:_0x36263e['offset']+_0x36263e[_0x1649('0x19')];var _0x233fd6;if(_0x44ae44>=_0x2c33c0){_0x44ae44=_0x2c33c0;_0x233fd6=0xc8;}else{_0x233fd6=0xce;}_0x245f4d[_0x1649('0x17')](_0x233fd6);return _0x245f4d['set'](_0x1649('0x1c'),_0x51054d+'-'+_0x44ae44+'/'+_0x2c33c0)[_0x1649('0x1d')](_0x55fd3d);}return null;};}function patchUpdates(_0x5a5e30){return function(_0x4e7834){try{jsonpatch[_0x1649('0x1e')](_0x4e7834,_0x5a5e30,!![]);}catch(_0x4f3944){return BPromise[_0x1649('0x1f')](_0x4f3944);}return _0x4e7834[_0x1649('0x20')]();};}function saveUpdates(_0x1e2ec9,_0xd620cc){return function(_0x10fe19){if(_0x10fe19){return _0x10fe19[_0x1649('0x21')](_0x1e2ec9)['then'](function(_0x226527){return _0x226527;});}return null;};}function removeEntity(_0x2ab4c1,_0x1fcbf9){return function(_0x287976){if(_0x287976){return _0x287976[_0x1649('0x22')]()[_0x1649('0x23')](function(){_0x2ab4c1[_0x1649('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe96813,_0x4a7d9c){return function(_0x4b678a){if(!_0x4b678a){_0xe96813['sendStatus'](0x194);}return _0x4b678a;};}function handleError(_0x17ceab,_0x4f41fa){_0x4f41fa=_0x4f41fa||0x1f4;return function(_0x333ca2){logger[_0x1649('0x24')](_0x333ca2[_0x1649('0x25')]);if(_0x333ca2[_0x1649('0x26')]){delete _0x333ca2['name'];}_0x17ceab[_0x1649('0x17')](_0x4f41fa)[_0x1649('0x27')](_0x333ca2);};}exports['index']=function(_0xe89380,_0x40dbb8){var _0x1d654a={},_0xdb5f96={},_0x174fce={'count':0x0,'rows':[]};var _0x54b2af=_['map'](db[_0x1649('0x28')][_0x1649('0x29')],function(_0x3bc125){return{'name':_0x3bc125[_0x1649('0x2a')],'type':_0x3bc125[_0x1649('0x2b')][_0x1649('0x2c')]};});_0xdb5f96[_0x1649('0x2d')]=_[_0x1649('0x2e')](_0x54b2af,_0x1649('0x26'));_0xdb5f96[_0x1649('0x2f')]=_[_0x1649('0x30')](_0xe89380[_0x1649('0x2f')]);_0xdb5f96[_0x1649('0x31')]=_[_0x1649('0x32')](_0xdb5f96[_0x1649('0x2d')],_0xdb5f96['query']);_0x1d654a[_0x1649('0x33')]=_[_0x1649('0x32')](_0xdb5f96['model'],qs['fields'](_0xe89380[_0x1649('0x2f')][_0x1649('0x34')]));_0x1d654a[_0x1649('0x33')]=_0x1d654a['attributes'][_0x1649('0x35')]?_0x1d654a[_0x1649('0x33')]:_0xdb5f96[_0x1649('0x2d')];if(!_0xe89380[_0x1649('0x2f')]['hasOwnProperty'](_0x1649('0x36'))){_0x1d654a[_0x1649('0x19')]=qs[_0x1649('0x19')](_0xe89380[_0x1649('0x2f')][_0x1649('0x19')]);_0x1d654a[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0xe89380[_0x1649('0x2f')][_0x1649('0x1b')]);}_0x1d654a[_0x1649('0x37')]=qs[_0x1649('0x38')](_0xe89380[_0x1649('0x2f')][_0x1649('0x38')]);_0x1d654a[_0x1649('0x39')]=qs[_0x1649('0x31')](_[_0x1649('0x3a')](_0xe89380['query'],_0xdb5f96[_0x1649('0x31')]),_0x54b2af);if(_0xe89380['query']['filter']){_0x1d654a[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x1d654a[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x54b2af,function(_0x37e8dc){if(_0x37e8dc[_0x1649('0x2b')]!==_0x1649('0x3c')){var _0x42cfb9={};_0x42cfb9[_0x37e8dc['name']]={'$like':'%'+_0xe89380['query'][_0x1649('0x3d')]+'%'};return _0x42cfb9;}})});}_0x1d654a=_[_0x1649('0x3b')]({},_0x1d654a,_0xe89380['options']);var _0x3bf3ac={'where':_0x1d654a[_0x1649('0x39')]};return db[_0x1649('0x28')][_0x1649('0x1a')](_0x3bf3ac)[_0x1649('0x23')](function(_0x29ae28){_0x174fce['count']=_0x29ae28;if(_0xe89380[_0x1649('0x2f')][_0x1649('0x3e')]){_0x1d654a[_0x1649('0x3f')]=[{'all':!![]}];}return db[_0x1649('0x28')][_0x1649('0x40')](_0x1d654a);})[_0x1649('0x23')](function(_0xdd24c9){_0x174fce[_0x1649('0x41')]=_0xdd24c9;return _0x174fce;})['then'](respondWithFilteredResult(_0x40dbb8,_0x1d654a))[_0x1649('0x42')](handleError(_0x40dbb8,null));};exports[_0x1649('0x43')]=function(_0x52d902,_0x47f987){var _0x25d542={'raw':![],'where':{'id':_0x52d902[_0x1649('0x44')]['id']}},_0x119bbb={};_0x119bbb[_0x1649('0x2d')]=_[_0x1649('0x30')](db[_0x1649('0x28')][_0x1649('0x29')]);_0x119bbb[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x52d902['query']);_0x119bbb[_0x1649('0x31')]=_[_0x1649('0x32')](_0x119bbb[_0x1649('0x2d')],_0x119bbb['query']);_0x25d542[_0x1649('0x33')]=_['intersection'](_0x119bbb[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x52d902[_0x1649('0x2f')][_0x1649('0x34')]));_0x25d542[_0x1649('0x33')]=_0x25d542[_0x1649('0x33')][_0x1649('0x35')]?_0x25d542[_0x1649('0x33')]:_0x119bbb['model'];if(_0x52d902['query'][_0x1649('0x3e')]){_0x25d542[_0x1649('0x3f')]=[{'all':!![]}];}_0x25d542=_[_0x1649('0x3b')]({},_0x25d542,_0x52d902[_0x1649('0x45')]);return db['ZendeskConfiguration'][_0x1649('0x46')](_0x25d542)[_0x1649('0x23')](handleEntityNotFound(_0x47f987,null))[_0x1649('0x23')](respondWithResult(_0x47f987,null))[_0x1649('0x42')](handleError(_0x47f987,null));};exports[_0x1649('0x47')]=function(_0x59aab4,_0x37e0b9){return db[_0x1649('0x28')][_0x1649('0x47')](_0x59aab4[_0x1649('0x48')],{})[_0x1649('0x23')](respondWithResult(_0x37e0b9,0xc9))[_0x1649('0x42')](handleError(_0x37e0b9,null));};exports[_0x1649('0x21')]=function(_0x4f675e,_0x9037a0){if(_0x4f675e[_0x1649('0x48')]['id']){delete _0x4f675e[_0x1649('0x48')]['id'];}return db[_0x1649('0x28')][_0x1649('0x46')]({'where':{'id':_0x4f675e[_0x1649('0x44')]['id']}})['then'](handleEntityNotFound(_0x9037a0,null))[_0x1649('0x23')](saveUpdates(_0x4f675e['body'],null))['then'](respondWithResult(_0x9037a0,null))[_0x1649('0x42')](handleError(_0x9037a0,null));};exports['destroy']=function(_0x394083,_0x1cdcda){return db[_0x1649('0x28')][_0x1649('0x46')]({'where':{'id':_0x394083[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x1cdcda,null))[_0x1649('0x23')](removeEntity(_0x1cdcda,null))[_0x1649('0x42')](handleError(_0x1cdcda,null));};exports['getFields']=function(_0x67a8a2,_0x591daa,_0x54af34){var _0x34c9a9={};var _0x2db366={};var _0x529ef1;var _0x5751da;return db[_0x1649('0x28')][_0x1649('0x49')]({'where':{'id':_0x67a8a2['params']['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x591daa,null))[_0x1649('0x23')](function(_0x202585){if(_0x202585){_0x529ef1=_0x202585;_0x2db366['model']=_[_0x1649('0x30')](db[_0x1649('0x4a')]['rawAttributes']);_0x2db366[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x67a8a2[_0x1649('0x2f')]);_0x2db366[_0x1649('0x31')]=_['intersection'](_0x2db366[_0x1649('0x2d')],_0x2db366[_0x1649('0x2f')]);_0x34c9a9[_0x1649('0x33')]=_['intersection'](_0x2db366[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x67a8a2[_0x1649('0x2f')][_0x1649('0x34')]));_0x34c9a9[_0x1649('0x33')]=_0x34c9a9[_0x1649('0x33')][_0x1649('0x35')]?_0x34c9a9[_0x1649('0x33')]:_0x2db366[_0x1649('0x2d')];_0x34c9a9['order']=qs[_0x1649('0x38')](_0x67a8a2[_0x1649('0x2f')][_0x1649('0x38')]);_0x34c9a9[_0x1649('0x39')]=qs[_0x1649('0x31')](_['pick'](_0x67a8a2[_0x1649('0x2f')],_0x2db366[_0x1649('0x31')]));if(_0x67a8a2['query']['filter']){_0x34c9a9[_0x1649('0x39')]=_['merge'](_0x34c9a9[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x34c9a9['attributes'],function(_0x4f47a4){var _0x44c1e7={};_0x44c1e7[_0x4f47a4]={'$like':'%'+_0x67a8a2[_0x1649('0x2f')][_0x1649('0x3d')]+'%'};return _0x44c1e7;})});}_0x34c9a9=_[_0x1649('0x3b')]({},_0x34c9a9,_0x67a8a2[_0x1649('0x45')]);return _0x529ef1[_0x1649('0x4b')](_0x34c9a9);}})[_0x1649('0x23')](function(_0x4693ab){if(_0x4693ab){_0x5751da=_0x4693ab[_0x1649('0x35')];if(!_0x67a8a2[_0x1649('0x2f')][_0x1649('0x4c')](_0x1649('0x36'))){_0x34c9a9[_0x1649('0x19')]=qs[_0x1649('0x19')](_0x67a8a2[_0x1649('0x2f')][_0x1649('0x19')]);_0x34c9a9[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0x67a8a2[_0x1649('0x2f')]['offset']);}return _0x529ef1['getFields'](_0x34c9a9);}})[_0x1649('0x23')](function(_0x5c02e7){if(_0x5c02e7){return _0x5c02e7?{'count':_0x5751da,'rows':_0x5c02e7}:null;}})[_0x1649('0x23')](respondWithResult(_0x591daa,null))[_0x1649('0x42')](handleError(_0x591daa,null));};exports[_0x1649('0x4d')]=function(_0x442b15,_0x226f97,_0x4b7ae5){var _0x1df009={};var _0x518c41={};var _0x20e7fd;var _0x26902c;return db['ZendeskConfiguration'][_0x1649('0x49')]({'where':{'id':_0x442b15[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x226f97,null))['then'](function(_0x461f1b){if(_0x461f1b){_0x20e7fd=_0x461f1b;_0x518c41[_0x1649('0x2d')]=_[_0x1649('0x30')](db[_0x1649('0x4a')][_0x1649('0x29')]);_0x518c41[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x442b15['query']);_0x518c41['filters']=_[_0x1649('0x32')](_0x518c41['model'],_0x518c41[_0x1649('0x2f')]);_0x1df009[_0x1649('0x33')]=_['intersection'](_0x518c41[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x442b15['query']['fields']));_0x1df009[_0x1649('0x33')]=_0x1df009['attributes'][_0x1649('0x35')]?_0x1df009[_0x1649('0x33')]:_0x518c41['model'];_0x1df009['order']=qs['sort'](_0x442b15[_0x1649('0x2f')][_0x1649('0x38')]);_0x1df009[_0x1649('0x39')]=qs[_0x1649('0x31')](_['pick'](_0x442b15['query'],_0x518c41[_0x1649('0x31')]));if(_0x442b15[_0x1649('0x2f')][_0x1649('0x3d')]){_0x1df009[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x1df009[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x1df009[_0x1649('0x33')],function(_0x514978){var _0x1bc5c0={};_0x1bc5c0[_0x514978]={'$like':'%'+_0x442b15['query'][_0x1649('0x3d')]+'%'};return _0x1bc5c0;})});}_0x1df009=_['merge']({},_0x1df009,_0x442b15[_0x1649('0x45')]);return _0x20e7fd[_0x1649('0x4d')](_0x1df009);}})[_0x1649('0x23')](function(_0x5a92ce){if(_0x5a92ce){_0x26902c=_0x5a92ce[_0x1649('0x35')];if(!_0x442b15[_0x1649('0x2f')][_0x1649('0x4c')]('nolimit')){_0x1df009['limit']=qs[_0x1649('0x19')](_0x442b15[_0x1649('0x2f')]['limit']);_0x1df009[_0x1649('0x1b')]=qs['offset'](_0x442b15[_0x1649('0x2f')][_0x1649('0x1b')]);}return _0x20e7fd[_0x1649('0x4d')](_0x1df009);}})[_0x1649('0x23')](function(_0x3a7272){if(_0x3a7272){return _0x3a7272?{'count':_0x26902c,'rows':_0x3a7272}:null;}})['then'](respondWithResult(_0x226f97,null))[_0x1649('0x42')](handleError(_0x226f97,null));};exports[_0x1649('0x4e')]=function(_0x44aa4b,_0x168962,_0x20d156){var _0x12fda4={};var _0x2b7d65={};var _0x32ac89;var _0x1a0b25;return db[_0x1649('0x28')][_0x1649('0x49')]({'where':{'id':_0x44aa4b[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x168962,null))[_0x1649('0x23')](function(_0xb745b9){if(_0xb745b9){_0x32ac89=_0xb745b9;_0x2b7d65[_0x1649('0x2d')]=_[_0x1649('0x30')](db[_0x1649('0x4a')][_0x1649('0x29')]);_0x2b7d65[_0x1649('0x2f')]=_[_0x1649('0x30')](_0x44aa4b[_0x1649('0x2f')]);_0x2b7d65['filters']=_[_0x1649('0x32')](_0x2b7d65[_0x1649('0x2d')],_0x2b7d65[_0x1649('0x2f')]);_0x12fda4[_0x1649('0x33')]=_[_0x1649('0x32')](_0x2b7d65[_0x1649('0x2d')],qs['fields'](_0x44aa4b[_0x1649('0x2f')][_0x1649('0x34')]));_0x12fda4['attributes']=_0x12fda4[_0x1649('0x33')][_0x1649('0x35')]?_0x12fda4[_0x1649('0x33')]:_0x2b7d65[_0x1649('0x2d')];_0x12fda4[_0x1649('0x37')]=qs[_0x1649('0x38')](_0x44aa4b[_0x1649('0x2f')]['sort']);_0x12fda4[_0x1649('0x39')]=qs[_0x1649('0x31')](_[_0x1649('0x3a')](_0x44aa4b[_0x1649('0x2f')],_0x2b7d65[_0x1649('0x31')]));if(_0x44aa4b[_0x1649('0x2f')][_0x1649('0x3d')]){_0x12fda4[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x12fda4[_0x1649('0x39')],{'$or':_[_0x1649('0x2e')](_0x12fda4[_0x1649('0x33')],function(_0x22ac3f){var _0x204906={};_0x204906[_0x22ac3f]={'$like':'%'+_0x44aa4b['query'][_0x1649('0x3d')]+'%'};return _0x204906;})});}_0x12fda4=_[_0x1649('0x3b')]({},_0x12fda4,_0x44aa4b[_0x1649('0x45')]);return _0x32ac89[_0x1649('0x4e')](_0x12fda4);}})[_0x1649('0x23')](function(_0x162ce6){if(_0x162ce6){_0x1a0b25=_0x162ce6[_0x1649('0x35')];if(!_0x44aa4b[_0x1649('0x2f')][_0x1649('0x4c')](_0x1649('0x36'))){_0x12fda4[_0x1649('0x19')]=qs['limit'](_0x44aa4b[_0x1649('0x2f')]['limit']);_0x12fda4[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0x44aa4b[_0x1649('0x2f')][_0x1649('0x1b')]);}return _0x32ac89['getDescriptions'](_0x12fda4);}})['then'](function(_0x34a721){if(_0x34a721){return _0x34a721?{'count':_0x1a0b25,'rows':_0x34a721}:null;}})['then'](respondWithResult(_0x168962,null))[_0x1649('0x42')](handleError(_0x168962,null));};exports[_0x1649('0x4f')]=function(_0x4576e9,_0x359230,_0x388543){var _0x444493={};var _0x36bdac={};var _0x182f25;var _0x355600;return db['ZendeskConfiguration'][_0x1649('0x49')]({'where':{'id':_0x4576e9['params']['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x359230,null))['then'](function(_0x5a11cb){if(_0x5a11cb){_0x182f25=_0x5a11cb;_0x36bdac['model']=_[_0x1649('0x30')](db[_0x1649('0x50')]['rawAttributes']);_0x36bdac[_0x1649('0x2f')]=_['keys'](_0x4576e9[_0x1649('0x2f')]);_0x36bdac[_0x1649('0x31')]=_[_0x1649('0x32')](_0x36bdac[_0x1649('0x2d')],_0x36bdac['query']);_0x444493[_0x1649('0x33')]=_[_0x1649('0x32')](_0x36bdac[_0x1649('0x2d')],qs[_0x1649('0x34')](_0x4576e9['query'][_0x1649('0x34')]));_0x444493[_0x1649('0x33')]=_0x444493[_0x1649('0x33')][_0x1649('0x35')]?_0x444493[_0x1649('0x33')]:_0x36bdac[_0x1649('0x2d')];_0x444493[_0x1649('0x37')]=qs[_0x1649('0x38')](_0x4576e9['query'][_0x1649('0x38')]);_0x444493[_0x1649('0x39')]=qs['filters'](_[_0x1649('0x3a')](_0x4576e9[_0x1649('0x2f')],_0x36bdac[_0x1649('0x31')]));if(_0x4576e9[_0x1649('0x2f')][_0x1649('0x3d')]){_0x444493[_0x1649('0x39')]=_[_0x1649('0x3b')](_0x444493['where'],{'$or':_[_0x1649('0x2e')](_0x444493[_0x1649('0x33')],function(_0x4d6015){var _0x3eac0a={};_0x3eac0a[_0x4d6015]={'$like':'%'+_0x4576e9[_0x1649('0x2f')][_0x1649('0x3d')]+'%'};return _0x3eac0a;})});}_0x444493=_[_0x1649('0x3b')]({},_0x444493,_0x4576e9[_0x1649('0x45')]);return _0x182f25[_0x1649('0x4f')](_0x444493);}})[_0x1649('0x23')](function(_0x230384){if(_0x230384){_0x355600=_0x230384[_0x1649('0x35')];if(!_0x4576e9[_0x1649('0x2f')][_0x1649('0x4c')](_0x1649('0x36'))){_0x444493['limit']=qs[_0x1649('0x19')](_0x4576e9['query']['limit']);_0x444493[_0x1649('0x1b')]=qs[_0x1649('0x1b')](_0x4576e9[_0x1649('0x2f')][_0x1649('0x1b')]);}return _0x182f25[_0x1649('0x4f')](_0x444493);}})[_0x1649('0x23')](function(_0x235a0a){if(_0x235a0a){return _0x235a0a?{'count':_0x355600,'rows':_0x235a0a}:null;}})['then'](respondWithResult(_0x359230,null))[_0x1649('0x42')](handleError(_0x359230,null));};exports[_0x1649('0x51')]=function(_0x7cb169,_0x155d7c,_0x3d269d){if(_0x7cb169[_0x1649('0x48')]['id']){delete _0x7cb169[_0x1649('0x48')]['id'];}return db[_0x1649('0x28')]['findOne']({'where':{'id':_0x7cb169[_0x1649('0x44')]['id']}})[_0x1649('0x23')](handleEntityNotFound(_0x155d7c,null))[_0x1649('0x23')](function(_0x103b97){if(_0x103b97){return _0x103b97['setTags'](_0x7cb169['body'][_0x1649('0x52')]||[]);}return null;})[_0x1649('0x23')](respondWithResult(_0x155d7c,null))[_0x1649('0x42')](handleError(_0x155d7c,null));}; \ No newline at end of file +var _0x26a7=['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','status','end','json','undefined','count','offset','set','reject','save','update','then','destroy','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','length','include','find','create','body','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto'];(function(_0x26fbf7,_0x29d9dd){var _0x2c6b4f=function(_0x43c378){while(--_0x43c378){_0x26fbf7['push'](_0x26fbf7['shift']());}};_0x2c6b4f(++_0x29d9dd);}(_0x26a7,0x1e6));var _0x726a=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x26a7[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x726a('0x0'));var zipdir=require(_0x726a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x726a('0x2'));var moment=require(_0x726a('0x3'));var BPromise=require(_0x726a('0x4'));var Mustache=require(_0x726a('0x5'));var util=require(_0x726a('0x6'));var path=require(_0x726a('0x7'));var sox=require(_0x726a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x726a('0x9'));var squel=require(_0x726a('0xa'));var crypto=require(_0x726a('0xb'));var jsforce=require(_0x726a('0xc'));var deskjs=require(_0x726a('0xd'));var toCsv=require(_0x726a('0xe'));var querystring=require('querystring');var Papa=require(_0x726a('0xf'));var Redis=require(_0x726a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x726a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x726a('0x12'));var logger=require(_0x726a('0x13'))(_0x726a('0x14'));var utils=require(_0x726a('0x15'));var config=require(_0x726a('0x16'));var licenseUtil=require(_0x726a('0x17'));var db=require(_0x726a('0x18'))['db'];function respondWithStatusCode(_0x5dbf97,_0x3ba7df){_0x3ba7df=_0x3ba7df||0xcc;return function(_0x145900){if(_0x145900){return _0x5dbf97[_0x726a('0x19')](_0x3ba7df);}return _0x5dbf97[_0x726a('0x1a')](_0x3ba7df)[_0x726a('0x1b')]();};}function respondWithResult(_0x18d256,_0x12b030){_0x12b030=_0x12b030||0xc8;return function(_0x44460e){if(_0x44460e){return _0x18d256['status'](_0x12b030)[_0x726a('0x1c')](_0x44460e);}};}function respondWithFilteredResult(_0x291cc5,_0x3cafee){return function(_0xb8ab6e){if(_0xb8ab6e){var _0x4ed79e=typeof _0x3cafee['offset']==='undefined'&&typeof _0x3cafee['limit']===_0x726a('0x1d');var _0x21a5f3=_0xb8ab6e[_0x726a('0x1e')];var _0x458da6=_0x4ed79e?0x0:_0x3cafee[_0x726a('0x1f')];var _0xddac66=_0x4ed79e?_0xb8ab6e[_0x726a('0x1e')]:_0x3cafee[_0x726a('0x1f')]+_0x3cafee['limit'];var _0x36d09a;if(_0xddac66>=_0x21a5f3){_0xddac66=_0x21a5f3;_0x36d09a=0xc8;}else{_0x36d09a=0xce;}_0x291cc5[_0x726a('0x1a')](_0x36d09a);return _0x291cc5[_0x726a('0x20')]('Content-Range',_0x458da6+'-'+_0xddac66+'/'+_0x21a5f3)['json'](_0xb8ab6e);}return null;};}function patchUpdates(_0x31af9c){return function(_0x5b41fc){try{jsonpatch['apply'](_0x5b41fc,_0x31af9c,!![]);}catch(_0x2b8354){return BPromise[_0x726a('0x21')](_0x2b8354);}return _0x5b41fc[_0x726a('0x22')]();};}function saveUpdates(_0x3ea06b,_0x40b9fc){return function(_0x1985c9){if(_0x1985c9){return _0x1985c9[_0x726a('0x23')](_0x3ea06b)[_0x726a('0x24')](function(_0x1b47d9){return _0x1b47d9;});}return null;};}function removeEntity(_0x26b13c,_0x96a03b){return function(_0x2ae8d3){if(_0x2ae8d3){return _0x2ae8d3[_0x726a('0x25')]()['then'](function(){_0x26b13c[_0x726a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2274ab,_0x123346){return function(_0x3f081e){if(!_0x3f081e){_0x2274ab['sendStatus'](0x194);}return _0x3f081e;};}function handleError(_0x478eeb,_0x381ba9){_0x381ba9=_0x381ba9||0x1f4;return function(_0x2ae593){logger['error'](_0x2ae593['stack']);if(_0x2ae593['name']){delete _0x2ae593[_0x726a('0x26')];}_0x478eeb[_0x726a('0x1a')](_0x381ba9)[_0x726a('0x27')](_0x2ae593);};}exports[_0x726a('0x28')]=function(_0x56f88a,_0x4ab861){var _0x20bd26={},_0x337b73={},_0x80d252={'count':0x0,'rows':[]};var _0x27865d=_[_0x726a('0x29')](db[_0x726a('0x2a')][_0x726a('0x2b')],function(_0x5c240d){return{'name':_0x5c240d[_0x726a('0x2c')],'type':_0x5c240d[_0x726a('0x2d')][_0x726a('0x2e')]};});_0x337b73[_0x726a('0x2f')]=_[_0x726a('0x29')](_0x27865d,'name');_0x337b73[_0x726a('0x30')]=_[_0x726a('0x31')](_0x56f88a['query']);_0x337b73[_0x726a('0x32')]=_[_0x726a('0x33')](_0x337b73['model'],_0x337b73['query']);_0x20bd26[_0x726a('0x34')]=_[_0x726a('0x33')](_0x337b73[_0x726a('0x2f')],qs[_0x726a('0x35')](_0x56f88a[_0x726a('0x30')][_0x726a('0x35')]));_0x20bd26['attributes']=_0x20bd26[_0x726a('0x34')]['length']?_0x20bd26[_0x726a('0x34')]:_0x337b73[_0x726a('0x2f')];if(!_0x56f88a['query'][_0x726a('0x36')](_0x726a('0x37'))){_0x20bd26['limit']=qs[_0x726a('0x38')](_0x56f88a[_0x726a('0x30')][_0x726a('0x38')]);_0x20bd26[_0x726a('0x1f')]=qs[_0x726a('0x1f')](_0x56f88a[_0x726a('0x30')][_0x726a('0x1f')]);}_0x20bd26[_0x726a('0x39')]=qs[_0x726a('0x3a')](_0x56f88a[_0x726a('0x30')][_0x726a('0x3a')]);_0x20bd26[_0x726a('0x3b')]=qs[_0x726a('0x32')](_['pick'](_0x56f88a[_0x726a('0x30')],_0x337b73['filters']),_0x27865d);if(_0x56f88a[_0x726a('0x30')][_0x726a('0x3c')]){_0x20bd26[_0x726a('0x3b')]=_['merge'](_0x20bd26[_0x726a('0x3b')],{'$or':_[_0x726a('0x29')](_0x27865d,function(_0x144edc){if(_0x144edc[_0x726a('0x2d')]!==_0x726a('0x3d')){var _0x1f304f={};_0x1f304f[_0x144edc[_0x726a('0x26')]]={'$like':'%'+_0x56f88a['query'][_0x726a('0x3c')]+'%'};return _0x1f304f;}})});}_0x20bd26=_[_0x726a('0x3e')]({},_0x20bd26,_0x56f88a[_0x726a('0x3f')]);var _0x75a2d4={'where':_0x20bd26[_0x726a('0x3b')]};return db[_0x726a('0x2a')][_0x726a('0x1e')](_0x75a2d4)[_0x726a('0x24')](function(_0xb976b0){_0x80d252['count']=_0xb976b0;if(_0x56f88a['query'][_0x726a('0x40')]){_0x20bd26['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0x726a('0x41')](_0x20bd26);})[_0x726a('0x24')](function(_0x23032b){_0x80d252[_0x726a('0x42')]=_0x23032b;return _0x80d252;})[_0x726a('0x24')](respondWithFilteredResult(_0x4ab861,_0x20bd26))[_0x726a('0x43')](handleError(_0x4ab861,null));};exports['show']=function(_0x20485b,_0x1b1271){var _0x2156ef={'raw':![],'where':{'id':_0x20485b[_0x726a('0x44')]['id']}},_0x29c895={};_0x29c895[_0x726a('0x2f')]=_[_0x726a('0x31')](db['ZendeskConfiguration'][_0x726a('0x2b')]);_0x29c895[_0x726a('0x30')]=_[_0x726a('0x31')](_0x20485b[_0x726a('0x30')]);_0x29c895[_0x726a('0x32')]=_['intersection'](_0x29c895[_0x726a('0x2f')],_0x29c895[_0x726a('0x30')]);_0x2156ef[_0x726a('0x34')]=_[_0x726a('0x33')](_0x29c895['model'],qs[_0x726a('0x35')](_0x20485b[_0x726a('0x30')][_0x726a('0x35')]));_0x2156ef[_0x726a('0x34')]=_0x2156ef['attributes'][_0x726a('0x45')]?_0x2156ef[_0x726a('0x34')]:_0x29c895[_0x726a('0x2f')];if(_0x20485b[_0x726a('0x30')]['includeAll']){_0x2156ef[_0x726a('0x46')]=[{'all':!![]}];}_0x2156ef=_[_0x726a('0x3e')]({},_0x2156ef,_0x20485b[_0x726a('0x3f')]);return db[_0x726a('0x2a')][_0x726a('0x47')](_0x2156ef)[_0x726a('0x24')](handleEntityNotFound(_0x1b1271,null))[_0x726a('0x24')](respondWithResult(_0x1b1271,null))[_0x726a('0x43')](handleError(_0x1b1271,null));};exports[_0x726a('0x48')]=function(_0x4b8de7,_0x4f5bf5){return db[_0x726a('0x2a')][_0x726a('0x48')](_0x4b8de7[_0x726a('0x49')],{})[_0x726a('0x24')](respondWithResult(_0x4f5bf5,0xc9))['catch'](handleError(_0x4f5bf5,null));};exports[_0x726a('0x23')]=function(_0x3a98f5,_0xdae379){if(_0x3a98f5['body']['id']){delete _0x3a98f5[_0x726a('0x49')]['id'];}return db['ZendeskConfiguration'][_0x726a('0x47')]({'where':{'id':_0x3a98f5[_0x726a('0x44')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0xdae379,null))[_0x726a('0x24')](saveUpdates(_0x3a98f5['body'],null))[_0x726a('0x24')](respondWithResult(_0xdae379,null))[_0x726a('0x43')](handleError(_0xdae379,null));};exports[_0x726a('0x25')]=function(_0x1fdd08,_0x321b9f){return db[_0x726a('0x2a')]['find']({'where':{'id':_0x1fdd08[_0x726a('0x44')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x321b9f,null))[_0x726a('0x24')](removeEntity(_0x321b9f,null))[_0x726a('0x43')](handleError(_0x321b9f,null));};exports[_0x726a('0x4a')]=function(_0x166c59,_0x149e46,_0x5967be){var _0xa7e52={};var _0x3ebc8e={};var _0x4cbad0;var _0x28bcbe;return db[_0x726a('0x2a')][_0x726a('0x4b')]({'where':{'id':_0x166c59[_0x726a('0x44')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x149e46,null))[_0x726a('0x24')](function(_0x20f8ac){if(_0x20f8ac){_0x4cbad0=_0x20f8ac;_0x3ebc8e[_0x726a('0x2f')]=_[_0x726a('0x31')](db[_0x726a('0x4c')]['rawAttributes']);_0x3ebc8e[_0x726a('0x30')]=_[_0x726a('0x31')](_0x166c59[_0x726a('0x30')]);_0x3ebc8e[_0x726a('0x32')]=_[_0x726a('0x33')](_0x3ebc8e[_0x726a('0x2f')],_0x3ebc8e['query']);_0xa7e52['attributes']=_[_0x726a('0x33')](_0x3ebc8e[_0x726a('0x2f')],qs[_0x726a('0x35')](_0x166c59['query']['fields']));_0xa7e52['attributes']=_0xa7e52[_0x726a('0x34')][_0x726a('0x45')]?_0xa7e52[_0x726a('0x34')]:_0x3ebc8e[_0x726a('0x2f')];_0xa7e52[_0x726a('0x39')]=qs[_0x726a('0x3a')](_0x166c59[_0x726a('0x30')][_0x726a('0x3a')]);_0xa7e52[_0x726a('0x3b')]=qs[_0x726a('0x32')](_[_0x726a('0x4d')](_0x166c59['query'],_0x3ebc8e[_0x726a('0x32')]));if(_0x166c59[_0x726a('0x30')]['filter']){_0xa7e52[_0x726a('0x3b')]=_[_0x726a('0x3e')](_0xa7e52[_0x726a('0x3b')],{'$or':_[_0x726a('0x29')](_0xa7e52[_0x726a('0x34')],function(_0x4c05a2){var _0x559338={};_0x559338[_0x4c05a2]={'$like':'%'+_0x166c59['query']['filter']+'%'};return _0x559338;})});}_0xa7e52=_[_0x726a('0x3e')]({},_0xa7e52,_0x166c59[_0x726a('0x3f')]);return _0x4cbad0[_0x726a('0x4a')](_0xa7e52);}})[_0x726a('0x24')](function(_0x208c49){if(_0x208c49){_0x28bcbe=_0x208c49['length'];if(!_0x166c59[_0x726a('0x30')]['hasOwnProperty']('nolimit')){_0xa7e52[_0x726a('0x38')]=qs[_0x726a('0x38')](_0x166c59[_0x726a('0x30')][_0x726a('0x38')]);_0xa7e52[_0x726a('0x1f')]=qs[_0x726a('0x1f')](_0x166c59[_0x726a('0x30')][_0x726a('0x1f')]);}return _0x4cbad0[_0x726a('0x4a')](_0xa7e52);}})[_0x726a('0x24')](function(_0x6218be){if(_0x6218be){return _0x6218be?{'count':_0x28bcbe,'rows':_0x6218be}:null;}})[_0x726a('0x24')](respondWithResult(_0x149e46,null))[_0x726a('0x43')](handleError(_0x149e46,null));};exports[_0x726a('0x4e')]=function(_0x578a6e,_0x4a0c60,_0x3075eb){var _0x10fb48={};var _0x48ffe2={};var _0x1d840a;var _0xed0e05;return db[_0x726a('0x2a')]['findOne']({'where':{'id':_0x578a6e['params']['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x4a0c60,null))[_0x726a('0x24')](function(_0x43092a){if(_0x43092a){_0x1d840a=_0x43092a;_0x48ffe2[_0x726a('0x2f')]=_['keys'](db[_0x726a('0x4c')][_0x726a('0x2b')]);_0x48ffe2['query']=_['keys'](_0x578a6e[_0x726a('0x30')]);_0x48ffe2[_0x726a('0x32')]=_[_0x726a('0x33')](_0x48ffe2[_0x726a('0x2f')],_0x48ffe2['query']);_0x10fb48[_0x726a('0x34')]=_[_0x726a('0x33')](_0x48ffe2[_0x726a('0x2f')],qs[_0x726a('0x35')](_0x578a6e['query'][_0x726a('0x35')]));_0x10fb48[_0x726a('0x34')]=_0x10fb48[_0x726a('0x34')][_0x726a('0x45')]?_0x10fb48[_0x726a('0x34')]:_0x48ffe2[_0x726a('0x2f')];_0x10fb48[_0x726a('0x39')]=qs['sort'](_0x578a6e[_0x726a('0x30')][_0x726a('0x3a')]);_0x10fb48[_0x726a('0x3b')]=qs[_0x726a('0x32')](_[_0x726a('0x4d')](_0x578a6e[_0x726a('0x30')],_0x48ffe2[_0x726a('0x32')]));if(_0x578a6e[_0x726a('0x30')][_0x726a('0x3c')]){_0x10fb48[_0x726a('0x3b')]=_[_0x726a('0x3e')](_0x10fb48['where'],{'$or':_[_0x726a('0x29')](_0x10fb48[_0x726a('0x34')],function(_0x53ad2c){var _0x319954={};_0x319954[_0x53ad2c]={'$like':'%'+_0x578a6e['query']['filter']+'%'};return _0x319954;})});}_0x10fb48=_[_0x726a('0x3e')]({},_0x10fb48,_0x578a6e[_0x726a('0x3f')]);return _0x1d840a[_0x726a('0x4e')](_0x10fb48);}})[_0x726a('0x24')](function(_0xb878ef){if(_0xb878ef){_0xed0e05=_0xb878ef[_0x726a('0x45')];if(!_0x578a6e[_0x726a('0x30')][_0x726a('0x36')](_0x726a('0x37'))){_0x10fb48['limit']=qs['limit'](_0x578a6e[_0x726a('0x30')]['limit']);_0x10fb48[_0x726a('0x1f')]=qs[_0x726a('0x1f')](_0x578a6e[_0x726a('0x30')][_0x726a('0x1f')]);}return _0x1d840a[_0x726a('0x4e')](_0x10fb48);}})[_0x726a('0x24')](function(_0x300de0){if(_0x300de0){return _0x300de0?{'count':_0xed0e05,'rows':_0x300de0}:null;}})[_0x726a('0x24')](respondWithResult(_0x4a0c60,null))['catch'](handleError(_0x4a0c60,null));};exports[_0x726a('0x4f')]=function(_0x57032a,_0xec0259,_0x55b63b){var _0x262c3e={};var _0x1bfadd={};var _0x5a46f0;var _0xaae5ad;return db['ZendeskConfiguration'][_0x726a('0x4b')]({'where':{'id':_0x57032a[_0x726a('0x44')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0xec0259,null))[_0x726a('0x24')](function(_0x23ce4f){if(_0x23ce4f){_0x5a46f0=_0x23ce4f;_0x1bfadd[_0x726a('0x2f')]=_[_0x726a('0x31')](db[_0x726a('0x4c')]['rawAttributes']);_0x1bfadd[_0x726a('0x30')]=_[_0x726a('0x31')](_0x57032a['query']);_0x1bfadd[_0x726a('0x32')]=_['intersection'](_0x1bfadd[_0x726a('0x2f')],_0x1bfadd[_0x726a('0x30')]);_0x262c3e[_0x726a('0x34')]=_['intersection'](_0x1bfadd[_0x726a('0x2f')],qs[_0x726a('0x35')](_0x57032a[_0x726a('0x30')]['fields']));_0x262c3e[_0x726a('0x34')]=_0x262c3e['attributes']['length']?_0x262c3e['attributes']:_0x1bfadd[_0x726a('0x2f')];_0x262c3e[_0x726a('0x39')]=qs['sort'](_0x57032a[_0x726a('0x30')][_0x726a('0x3a')]);_0x262c3e[_0x726a('0x3b')]=qs[_0x726a('0x32')](_[_0x726a('0x4d')](_0x57032a[_0x726a('0x30')],_0x1bfadd[_0x726a('0x32')]));if(_0x57032a[_0x726a('0x30')][_0x726a('0x3c')]){_0x262c3e[_0x726a('0x3b')]=_[_0x726a('0x3e')](_0x262c3e[_0x726a('0x3b')],{'$or':_[_0x726a('0x29')](_0x262c3e[_0x726a('0x34')],function(_0x33950c){var _0x488877={};_0x488877[_0x33950c]={'$like':'%'+_0x57032a[_0x726a('0x30')][_0x726a('0x3c')]+'%'};return _0x488877;})});}_0x262c3e=_[_0x726a('0x3e')]({},_0x262c3e,_0x57032a['options']);return _0x5a46f0[_0x726a('0x4f')](_0x262c3e);}})[_0x726a('0x24')](function(_0x5dfafc){if(_0x5dfafc){_0xaae5ad=_0x5dfafc[_0x726a('0x45')];if(!_0x57032a[_0x726a('0x30')][_0x726a('0x36')]('nolimit')){_0x262c3e[_0x726a('0x38')]=qs['limit'](_0x57032a[_0x726a('0x30')][_0x726a('0x38')]);_0x262c3e['offset']=qs[_0x726a('0x1f')](_0x57032a['query'][_0x726a('0x1f')]);}return _0x5a46f0[_0x726a('0x4f')](_0x262c3e);}})[_0x726a('0x24')](function(_0x4bda08){if(_0x4bda08){return _0x4bda08?{'count':_0xaae5ad,'rows':_0x4bda08}:null;}})['then'](respondWithResult(_0xec0259,null))[_0x726a('0x43')](handleError(_0xec0259,null));};exports['getTags']=function(_0x3843be,_0x3cd71d,_0x3afae0){var _0x421061={};var _0x5ebf17={};var _0x4400d3;var _0x606cce;return db[_0x726a('0x2a')][_0x726a('0x4b')]({'where':{'id':_0x3843be[_0x726a('0x44')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x3cd71d,null))[_0x726a('0x24')](function(_0x59f3d3){if(_0x59f3d3){_0x4400d3=_0x59f3d3;_0x5ebf17[_0x726a('0x2f')]=_['keys'](db['Tag'][_0x726a('0x2b')]);_0x5ebf17['query']=_[_0x726a('0x31')](_0x3843be[_0x726a('0x30')]);_0x5ebf17[_0x726a('0x32')]=_[_0x726a('0x33')](_0x5ebf17[_0x726a('0x2f')],_0x5ebf17['query']);_0x421061[_0x726a('0x34')]=_[_0x726a('0x33')](_0x5ebf17[_0x726a('0x2f')],qs[_0x726a('0x35')](_0x3843be[_0x726a('0x30')][_0x726a('0x35')]));_0x421061[_0x726a('0x34')]=_0x421061[_0x726a('0x34')]['length']?_0x421061[_0x726a('0x34')]:_0x5ebf17[_0x726a('0x2f')];_0x421061['order']=qs[_0x726a('0x3a')](_0x3843be[_0x726a('0x30')][_0x726a('0x3a')]);_0x421061[_0x726a('0x3b')]=qs['filters'](_['pick'](_0x3843be[_0x726a('0x30')],_0x5ebf17[_0x726a('0x32')]));if(_0x3843be[_0x726a('0x30')][_0x726a('0x3c')]){_0x421061[_0x726a('0x3b')]=_[_0x726a('0x3e')](_0x421061['where'],{'$or':_[_0x726a('0x29')](_0x421061[_0x726a('0x34')],function(_0x47cc2b){var _0x5987b8={};_0x5987b8[_0x47cc2b]={'$like':'%'+_0x3843be[_0x726a('0x30')][_0x726a('0x3c')]+'%'};return _0x5987b8;})});}_0x421061=_[_0x726a('0x3e')]({},_0x421061,_0x3843be[_0x726a('0x3f')]);return _0x4400d3[_0x726a('0x50')](_0x421061);}})[_0x726a('0x24')](function(_0x3d2849){if(_0x3d2849){_0x606cce=_0x3d2849[_0x726a('0x45')];if(!_0x3843be['query'][_0x726a('0x36')]('nolimit')){_0x421061[_0x726a('0x38')]=qs[_0x726a('0x38')](_0x3843be[_0x726a('0x30')]['limit']);_0x421061[_0x726a('0x1f')]=qs[_0x726a('0x1f')](_0x3843be[_0x726a('0x30')][_0x726a('0x1f')]);}return _0x4400d3[_0x726a('0x50')](_0x421061);}})[_0x726a('0x24')](function(_0x33fb69){if(_0x33fb69){return _0x33fb69?{'count':_0x606cce,'rows':_0x33fb69}:null;}})[_0x726a('0x24')](respondWithResult(_0x3cd71d,null))[_0x726a('0x43')](handleError(_0x3cd71d,null));};exports[_0x726a('0x51')]=function(_0x3e6ea7,_0x4a2ad3,_0x153bde){if(_0x3e6ea7[_0x726a('0x49')]['id']){delete _0x3e6ea7[_0x726a('0x49')]['id'];}return db[_0x726a('0x2a')][_0x726a('0x4b')]({'where':{'id':_0x3e6ea7[_0x726a('0x44')]['id']}})[_0x726a('0x24')](handleEntityNotFound(_0x4a2ad3,null))[_0x726a('0x24')](function(_0x59993b){if(_0x59993b){return _0x59993b[_0x726a('0x51')](_0x3e6ea7[_0x726a('0x49')][_0x726a('0x52')]||[]);}return null;})[_0x726a('0x24')](respondWithResult(_0x4a2ad3,null))['catch'](handleError(_0x4a2ad3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 4a3c8b4..a6cff7e 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 _0x5423=['request-promise','path','rimraf','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api','moment'];(function(_0x3f35e7,_0x56129c){var _0x325142=function(_0x344ca4){while(--_0x344ca4){_0x3f35e7['push'](_0x3f35e7['shift']());}};_0x325142(++_0x56129c);}(_0x5423,0xe3));var _0x3542=function(_0x3ae689,_0x566fb9){_0x3ae689=_0x3ae689-0x0;var _0x591bf5=_0x5423[_0x3ae689];return _0x591bf5;};'use strict';var _=require(_0x3542('0x0'));var util=require(_0x3542('0x1'));var logger=require('../../config/logger')(_0x3542('0x2'));var moment=require(_0x3542('0x3'));var BPromise=require('bluebird');var rp=require(_0x3542('0x4'));var fs=require('fs');var path=require(_0x3542('0x5'));var rimraf=require(_0x3542('0x6'));var config=require(_0x3542('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x3542('0x8')]=function(_0x2d2ae9,_0x15ee3b){return _0x2d2ae9[_0x3542('0x9')](_0x3542('0xa'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80ed=['api','moment','request-promise','path','rimraf','../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','../../config/logger'];(function(_0x3fadbd,_0x45e879){var _0x266ecd=function(_0x29f159){while(--_0x29f159){_0x3fadbd['push'](_0x3fadbd['shift']());}};_0x266ecd(++_0x45e879);}(_0x80ed,0x11c));var _0xd80e=function(_0x5cadea,_0x4c9dab){_0x5cadea=_0x5cadea-0x0;var _0x12b05c=_0x80ed[_0x5cadea];return _0x12b05c;};'use strict';var _=require(_0xd80e('0x0'));var util=require('util');var logger=require(_0xd80e('0x1'))(_0xd80e('0x2'));var moment=require(_0xd80e('0x3'));var BPromise=require('bluebird');var rp=require(_0xd80e('0x4'));var fs=require('fs');var path=require(_0xd80e('0x5'));var rimraf=require(_0xd80e('0x6'));var config=require(_0xd80e('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xd80e('0x8')]=function(_0x2b4742,_0x252fec){return _0x2b4742['define'](_0xd80e('0x9'),attributes,{'tableName':_0xd80e('0xa'),'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 b28b505..5bec653 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 _0x5e8c=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a7ba7,_0x131274){var _0x5619d6=function(_0x4f4623){while(--_0x4f4623){_0x1a7ba7['push'](_0x1a7ba7['shift']());}};_0x5619d6(++_0x131274);}(_0x5e8c,0x8e));var _0xc5e8=function(_0x3aeb7a,_0x2a92a4){_0x3aeb7a=_0x3aeb7a-0x0;var _0x2d79c4=_0x5e8c[_0x3aeb7a];return _0x2d79c4;};'use strict';var _=require(_0xc5e8('0x0'));var util=require(_0xc5e8('0x1'));var moment=require(_0xc5e8('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5e8('0x3'));var fs=require('fs');var Redis=require(_0xc5e8('0x4'));var db=require(_0xc5e8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5e8('0x6'))(_0xc5e8('0x7'));var config=require(_0xc5e8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc5e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33ca51,_0x43c0e1,_0x410a70){return new BPromise(function(_0x533526,_0x435762){return client[_0xc5e8('0xa')](_0x33ca51,_0x410a70)[_0xc5e8('0xb')](function(_0xefc8b1){logger['info'](_0xc5e8('0xc'),_0x43c0e1,_0xc5e8('0xd'));logger[_0xc5e8('0xe')](_0xc5e8('0xf'),_0x43c0e1,_0xc5e8('0xd'),JSON[_0xc5e8('0x10')](_0xefc8b1));if(_0xefc8b1[_0xc5e8('0x11')]){if(_0xefc8b1[_0xc5e8('0x11')]['code']===0x1f4){logger[_0xc5e8('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43c0e1,_0xefc8b1[_0xc5e8('0x11')][_0xc5e8('0x12')]);return _0x435762(_0xefc8b1[_0xc5e8('0x11')][_0xc5e8('0x12')]);}logger[_0xc5e8('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x43c0e1,_0xefc8b1[_0xc5e8('0x11')]['message']);return _0x533526(_0xefc8b1[_0xc5e8('0x11')][_0xc5e8('0x12')]);}else{logger['info'](_0xc5e8('0xc'),_0x43c0e1,_0xc5e8('0xd'));_0x533526(_0xefc8b1[_0xc5e8('0x13')][_0xc5e8('0x12')]);}})['catch'](function(_0x3a73b2){logger[_0xc5e8('0x11')](_0xc5e8('0xc'),_0x43c0e1,_0x3a73b2);_0x435762(_0x3a73b2);});});} \ No newline at end of file +var _0x33cf=['stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x209304,_0x565c7d){var _0x4bde84=function(_0xf085f7){while(--_0xf085f7){_0x209304['push'](_0x209304['shift']());}};_0x4bde84(++_0x565c7d);}(_0x33cf,0x102));var _0xf33c=function(_0x2f6629,_0x1b013c){_0x2f6629=_0x2f6629-0x0;var _0x317739=_0x33cf[_0x2f6629];return _0x317739;};'use strict';var _=require('lodash');var util=require(_0xf33c('0x0'));var moment=require(_0xf33c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf33c('0x2'));var fs=require('fs');var Redis=require(_0xf33c('0x3'));var db=require(_0xf33c('0x4'))['db'];var utils=require(_0xf33c('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf33c('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xf33c('0x7')][_0xf33c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5716a6,_0x4f0827,_0x5e5d88){return new BPromise(function(_0xbd5d71,_0x4d58b0){return client[_0xf33c('0x9')](_0x5716a6,_0x5e5d88)[_0xf33c('0xa')](function(_0x289e66){logger[_0xf33c('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0x4f0827,_0xf33c('0xc'));logger[_0xf33c('0xd')](_0xf33c('0xe'),_0x4f0827,_0xf33c('0xc'),JSON[_0xf33c('0xf')](_0x289e66));if(_0x289e66[_0xf33c('0x10')]){if(_0x289e66[_0xf33c('0x10')][_0xf33c('0x11')]===0x1f4){logger[_0xf33c('0x10')](_0xf33c('0x12'),_0x4f0827,_0x289e66[_0xf33c('0x10')]['message']);return _0x4d58b0(_0x289e66[_0xf33c('0x10')]['message']);}logger['error'](_0xf33c('0x12'),_0x4f0827,_0x289e66[_0xf33c('0x10')][_0xf33c('0x13')]);return _0xbd5d71(_0x289e66[_0xf33c('0x10')][_0xf33c('0x13')]);}else{logger['info'](_0xf33c('0x12'),_0x4f0827,_0xf33c('0xc'));_0xbd5d71(_0x289e66[_0xf33c('0x14')][_0xf33c('0x13')]);}})['catch'](function(_0x3dbb3d){logger['error'](_0xf33c('0x12'),_0x4f0827,_0x3dbb3d);_0x4d58b0(_0x3dbb3d);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 761e74c..483c9de 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 _0xcc94=['create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x4c3964,_0x186c38){var _0x21530b=function(_0x415d12){while(--_0x415d12){_0x4c3964['push'](_0x4c3964['shift']());}};_0x21530b(++_0x186c38);}(_0xcc94,0x64));var _0x4cc9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcc94[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x4cc9('0x0'));var path=require(_0x4cc9('0x1'));var timeout=require(_0x4cc9('0x2'));var express=require(_0x4cc9('0x3'));var router=express[_0x4cc9('0x4')]();var fs_extra=require(_0x4cc9('0x5'));var auth=require(_0x4cc9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4cc9('0x7'));var controller=require('./intZendeskField.controller');router[_0x4cc9('0x8')]('/',auth['isAuthenticated'](),controller[_0x4cc9('0x9')]);router[_0x4cc9('0x8')](_0x4cc9('0xa'),auth[_0x4cc9('0xb')](),controller[_0x4cc9('0xc')]);router[_0x4cc9('0xd')]('/',auth[_0x4cc9('0xb')](),controller[_0x4cc9('0xe')]);router[_0x4cc9('0xf')](_0x4cc9('0xa'),auth[_0x4cc9('0xb')](),controller[_0x4cc9('0x10')]);router['delete'](_0x4cc9('0xa'),auth[_0x4cc9('0xb')](),controller[_0x4cc9('0x11')]);module[_0x4cc9('0x12')]=router; \ No newline at end of file +var _0x5273=['../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5273,0x1ac));var _0x3527=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5273[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x3527('0x0'));var util=require(_0x3527('0x1'));var path=require(_0x3527('0x2'));var timeout=require(_0x3527('0x3'));var express=require(_0x3527('0x4'));var router=express[_0x3527('0x5')]();var fs_extra=require(_0x3527('0x6'));var auth=require(_0x3527('0x7'));var interaction=require(_0x3527('0x8'));var config=require(_0x3527('0x9'));var controller=require(_0x3527('0xa'));router[_0x3527('0xb')]('/',auth[_0x3527('0xc')](),controller[_0x3527('0xd')]);router[_0x3527('0xb')](_0x3527('0xe'),auth[_0x3527('0xc')](),controller[_0x3527('0xf')]);router[_0x3527('0x10')]('/',auth[_0x3527('0xc')](),controller[_0x3527('0x11')]);router[_0x3527('0x12')](_0x3527('0xe'),auth[_0x3527('0xc')](),controller[_0x3527('0x13')]);router[_0x3527('0x14')](_0x3527('0xe'),auth[_0x3527('0xc')](),controller[_0x3527('0x15')]);module[_0x3527('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 8b20bd4..90195fd 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 _0xcf76=['keyValue','picklist','STRING','variable','BOOLEAN','ENUM','string','customVariable'];(function(_0x39f6b4,_0x3702da){var _0x3d90c0=function(_0x77b335){while(--_0x77b335){_0x39f6b4['push'](_0x39f6b4['shift']());}};_0x3d90c0(++_0x3702da);}(_0xcf76,0xed));var _0x6cf7=function(_0x31e7b5,_0x531855){_0x31e7b5=_0x31e7b5-0x0;var _0x2d1651=_0xcf76[_0x31e7b5];return _0x2d1651;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6cf7('0x0')](_0x6cf7('0x1'),'variable',_0x6cf7('0x2'),_0x6cf7('0x3'),_0x6cf7('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6cf7('0x5')]},'key':{'type':Sequelize[_0x6cf7('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x6cf7('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x6cf7('0x5')]},'idField':{'type':Sequelize[_0x6cf7('0x5')]},'nameField':{'type':Sequelize[_0x6cf7('0x5')]},'customField':{'type':Sequelize[_0x6cf7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6a7e=['picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x1edd71,_0x53eaa2){var _0x1745cd=function(_0x4de278){while(--_0x4de278){_0x1edd71['push'](_0x1edd71['shift']());}};_0x1745cd(++_0x53eaa2);}(_0x6a7e,0xd1));var _0xe6a7=function(_0xe2def9,_0x268e8e){_0xe2def9=_0xe2def9-0x0;var _0x51a195=_0x6a7e[_0xe2def9];return _0x51a195;};'use strict';var Sequelize=require(_0xe6a7('0x0'));module[_0xe6a7('0x1')]={'type':{'type':Sequelize[_0xe6a7('0x2')](_0xe6a7('0x3'),_0xe6a7('0x4'),_0xe6a7('0x5'),_0xe6a7('0x6'),_0xe6a7('0x7')),'defaultValue':_0xe6a7('0x3')},'content':{'type':Sequelize[_0xe6a7('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe6a7('0x2')](_0xe6a7('0x3'),'variable',_0xe6a7('0x5'))},'keyContent':{'type':Sequelize[_0xe6a7('0x8')]},'idField':{'type':Sequelize[_0xe6a7('0x8')]},'nameField':{'type':Sequelize[_0xe6a7('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe6a7('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index bb4adaf..0c38be2 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 _0x4867=['map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','show','params','length','include','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index'];(function(_0x1d2727,_0x7dadd8){var _0x531212=function(_0x2d15aa){while(--_0x2d15aa){_0x1d2727['push'](_0x1d2727['shift']());}};_0x531212(++_0x7dadd8);}(_0x4867,0xc1));var _0x7486=function(_0x639fd7,_0x2d4036){_0x639fd7=_0x639fd7-0x0;var _0x5b5c1a=_0x4867[_0x639fd7];return _0x5b5c1a;};'use strict';var emlformat=require(_0x7486('0x0'));var rimraf=require(_0x7486('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7486('0x2'));var rp=require(_0x7486('0x3'));var moment=require(_0x7486('0x4'));var BPromise=require(_0x7486('0x5'));var Mustache=require('mustache');var util=require(_0x7486('0x6'));var path=require(_0x7486('0x7'));var sox=require(_0x7486('0x8'));var csv=require(_0x7486('0x9'));var ejs=require(_0x7486('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7486('0xb'));var squel=require(_0x7486('0xc'));var crypto=require('crypto');var jsforce=require(_0x7486('0xd'));var deskjs=require(_0x7486('0xe'));var toCsv=require('to-csv');var querystring=require(_0x7486('0xf'));var Papa=require(_0x7486('0x10'));var Redis=require(_0x7486('0x11'));var authService=require(_0x7486('0x12'));var qs=require(_0x7486('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7486('0x14'));var logger=require(_0x7486('0x15'))(_0x7486('0x16'));var utils=require(_0x7486('0x17'));var config=require(_0x7486('0x18'));var licenseUtil=require(_0x7486('0x19'));var db=require(_0x7486('0x1a'))['db'];function respondWithStatusCode(_0xbf10e2,_0x413936){_0x413936=_0x413936||0xcc;return function(_0x46c8d4){if(_0x46c8d4){return _0xbf10e2['sendStatus'](_0x413936);}return _0xbf10e2[_0x7486('0x1b')](_0x413936)[_0x7486('0x1c')]();};}function respondWithResult(_0x4c42e4,_0x681c66){_0x681c66=_0x681c66||0xc8;return function(_0x500510){if(_0x500510){return _0x4c42e4[_0x7486('0x1b')](_0x681c66)[_0x7486('0x1d')](_0x500510);}};}function respondWithFilteredResult(_0x4f1bd8,_0x7f439){return function(_0x21618c){if(_0x21618c){var _0x2075b3=typeof _0x7f439['offset']===_0x7486('0x1e')&&typeof _0x7f439[_0x7486('0x1f')]===_0x7486('0x1e');var _0x492487=_0x21618c[_0x7486('0x20')];var _0x4453ff=_0x2075b3?0x0:_0x7f439['offset'];var _0x5693f1=_0x2075b3?_0x21618c[_0x7486('0x20')]:_0x7f439[_0x7486('0x21')]+_0x7f439[_0x7486('0x1f')];var _0x1635ee;if(_0x5693f1>=_0x492487){_0x5693f1=_0x492487;_0x1635ee=0xc8;}else{_0x1635ee=0xce;}_0x4f1bd8[_0x7486('0x1b')](_0x1635ee);return _0x4f1bd8[_0x7486('0x22')](_0x7486('0x23'),_0x4453ff+'-'+_0x5693f1+'/'+_0x492487)[_0x7486('0x1d')](_0x21618c);}return null;};}function patchUpdates(_0x12d33a){return function(_0x56300c){try{jsonpatch[_0x7486('0x24')](_0x56300c,_0x12d33a,!![]);}catch(_0x1ac971){return BPromise[_0x7486('0x25')](_0x1ac971);}return _0x56300c[_0x7486('0x26')]();};}function saveUpdates(_0x1787ae,_0x4a24e6){return function(_0x3e66be){if(_0x3e66be){return _0x3e66be[_0x7486('0x27')](_0x1787ae)[_0x7486('0x28')](function(_0x511afc){return _0x511afc;});}return null;};}function removeEntity(_0x13cc27,_0x31ab17){return function(_0x374358){if(_0x374358){return _0x374358[_0x7486('0x29')]()[_0x7486('0x28')](function(){_0x13cc27[_0x7486('0x1b')](0xcc)[_0x7486('0x1c')]();});}};}function handleEntityNotFound(_0x5580af,_0x4f1d9f){return function(_0x138f1a){if(!_0x138f1a){_0x5580af[_0x7486('0x2a')](0x194);}return _0x138f1a;};}function handleError(_0x203806,_0x52cd9d){_0x52cd9d=_0x52cd9d||0x1f4;return function(_0x21b77a){logger[_0x7486('0x2b')](_0x21b77a[_0x7486('0x2c')]);if(_0x21b77a['name']){delete _0x21b77a[_0x7486('0x2d')];}_0x203806[_0x7486('0x1b')](_0x52cd9d)['send'](_0x21b77a);};}exports[_0x7486('0x2e')]=function(_0x408f37,_0x4fe6e9){var _0x826729={},_0x6d7a97={},_0x49b72c={'count':0x0,'rows':[]};var _0x420566=_[_0x7486('0x2f')](db[_0x7486('0x30')][_0x7486('0x31')],function(_0x407bc7){return{'name':_0x407bc7[_0x7486('0x32')],'type':_0x407bc7[_0x7486('0x33')][_0x7486('0x34')]};});_0x6d7a97[_0x7486('0x35')]=_[_0x7486('0x2f')](_0x420566,_0x7486('0x2d'));_0x6d7a97[_0x7486('0x36')]=_[_0x7486('0x37')](_0x408f37[_0x7486('0x36')]);_0x6d7a97['filters']=_['intersection'](_0x6d7a97['model'],_0x6d7a97[_0x7486('0x36')]);_0x826729[_0x7486('0x38')]=_[_0x7486('0x39')](_0x6d7a97[_0x7486('0x35')],qs[_0x7486('0x3a')](_0x408f37[_0x7486('0x36')][_0x7486('0x3a')]));_0x826729[_0x7486('0x38')]=_0x826729['attributes']['length']?_0x826729[_0x7486('0x38')]:_0x6d7a97[_0x7486('0x35')];if(!_0x408f37['query'][_0x7486('0x3b')](_0x7486('0x3c'))){_0x826729[_0x7486('0x1f')]=qs['limit'](_0x408f37[_0x7486('0x36')][_0x7486('0x1f')]);_0x826729[_0x7486('0x21')]=qs[_0x7486('0x21')](_0x408f37[_0x7486('0x36')][_0x7486('0x21')]);}_0x826729[_0x7486('0x3d')]=qs[_0x7486('0x3e')](_0x408f37[_0x7486('0x36')]['sort']);_0x826729['where']=qs[_0x7486('0x3f')](_[_0x7486('0x40')](_0x408f37[_0x7486('0x36')],_0x6d7a97['filters']),_0x420566);if(_0x408f37['query'][_0x7486('0x41')]){_0x826729[_0x7486('0x42')]=_[_0x7486('0x43')](_0x826729[_0x7486('0x42')],{'$or':_[_0x7486('0x2f')](_0x420566,function(_0x385b4c){if(_0x385b4c[_0x7486('0x33')]!==_0x7486('0x44')){var _0x2d88b0={};_0x2d88b0[_0x385b4c[_0x7486('0x2d')]]={'$like':'%'+_0x408f37[_0x7486('0x36')][_0x7486('0x41')]+'%'};return _0x2d88b0;}})});}_0x826729=_['merge']({},_0x826729,_0x408f37[_0x7486('0x45')]);var _0x4dd134={'where':_0x826729[_0x7486('0x42')]};return db['ZendeskField'][_0x7486('0x20')](_0x4dd134)[_0x7486('0x28')](function(_0x51c950){_0x49b72c[_0x7486('0x20')]=_0x51c950;if(_0x408f37[_0x7486('0x36')][_0x7486('0x46')]){_0x826729['include']=[{'all':!![]}];}return db[_0x7486('0x30')][_0x7486('0x47')](_0x826729);})[_0x7486('0x28')](function(_0x12c239){_0x49b72c['rows']=_0x12c239;return _0x49b72c;})[_0x7486('0x28')](respondWithFilteredResult(_0x4fe6e9,_0x826729))['catch'](handleError(_0x4fe6e9,null));};exports[_0x7486('0x48')]=function(_0x20ea23,_0xc1a595){var _0x30bb7c={'raw':!![],'where':{'id':_0x20ea23[_0x7486('0x49')]['id']}},_0x13cec4={};_0x13cec4[_0x7486('0x35')]=_[_0x7486('0x37')](db[_0x7486('0x30')]['rawAttributes']);_0x13cec4[_0x7486('0x36')]=_[_0x7486('0x37')](_0x20ea23[_0x7486('0x36')]);_0x13cec4[_0x7486('0x3f')]=_['intersection'](_0x13cec4[_0x7486('0x35')],_0x13cec4[_0x7486('0x36')]);_0x30bb7c[_0x7486('0x38')]=_[_0x7486('0x39')](_0x13cec4[_0x7486('0x35')],qs[_0x7486('0x3a')](_0x20ea23['query'][_0x7486('0x3a')]));_0x30bb7c['attributes']=_0x30bb7c[_0x7486('0x38')][_0x7486('0x4a')]?_0x30bb7c[_0x7486('0x38')]:_0x13cec4['model'];if(_0x20ea23['query'][_0x7486('0x46')]){_0x30bb7c[_0x7486('0x4b')]=[{'all':!![]}];}_0x30bb7c=_[_0x7486('0x43')]({},_0x30bb7c,_0x20ea23[_0x7486('0x45')]);return db[_0x7486('0x30')][_0x7486('0x4c')](_0x30bb7c)[_0x7486('0x28')](handleEntityNotFound(_0xc1a595,null))[_0x7486('0x28')](respondWithResult(_0xc1a595,null))[_0x7486('0x4d')](handleError(_0xc1a595,null));};exports[_0x7486('0x4e')]=function(_0xde5ad3,_0xe567ee){return db[_0x7486('0x30')][_0x7486('0x4e')](_0xde5ad3[_0x7486('0x4f')],{})[_0x7486('0x28')](respondWithResult(_0xe567ee,0xc9))['catch'](handleError(_0xe567ee,null));};exports[_0x7486('0x27')]=function(_0x2ce12f,_0xfe952c){if(_0x2ce12f[_0x7486('0x4f')]['id']){delete _0x2ce12f[_0x7486('0x4f')]['id'];}return db[_0x7486('0x30')][_0x7486('0x4c')]({'where':{'id':_0x2ce12f[_0x7486('0x49')]['id']}})[_0x7486('0x28')](handleEntityNotFound(_0xfe952c,null))['then'](saveUpdates(_0x2ce12f[_0x7486('0x4f')],null))[_0x7486('0x28')](respondWithResult(_0xfe952c,null))[_0x7486('0x4d')](handleError(_0xfe952c,null));};exports[_0x7486('0x29')]=function(_0x3352f7,_0xef1fd7){return db[_0x7486('0x30')][_0x7486('0x4c')]({'where':{'id':_0x3352f7['params']['id']}})[_0x7486('0x28')](handleEntityNotFound(_0xef1fd7,null))[_0x7486('0x28')](removeEntity(_0xef1fd7,null))[_0x7486('0x4d')](handleError(_0xef1fd7,null));}; \ No newline at end of file +var _0xc834=['map','ZendeskField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','rows','catch','show','options','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','reject','save','then','destroy','stack','name','send','index'];(function(_0x5cf94d,_0x3e9b52){var _0x3242a6=function(_0x22e8b8){while(--_0x22e8b8){_0x5cf94d['push'](_0x5cf94d['shift']());}};_0x3242a6(++_0x3e9b52);}(_0xc834,0x1de));var _0x4c83=function(_0x5cc440,_0x467419){_0x5cc440=_0x5cc440-0x0;var _0x55f8c4=_0xc834[_0x5cc440];return _0x55f8c4;};'use strict';var emlformat=require(_0x4c83('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4c83('0x1'));var jsonpatch=require(_0x4c83('0x2'));var rp=require(_0x4c83('0x3'));var moment=require('moment');var BPromise=require(_0x4c83('0x4'));var Mustache=require('mustache');var util=require(_0x4c83('0x5'));var path=require(_0x4c83('0x6'));var sox=require(_0x4c83('0x7'));var csv=require(_0x4c83('0x8'));var ejs=require(_0x4c83('0x9'));var fs=require('fs');var fs_extra=require(_0x4c83('0xa'));var _=require(_0x4c83('0xb'));var squel=require(_0x4c83('0xc'));var crypto=require(_0x4c83('0xd'));var jsforce=require(_0x4c83('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4c83('0x8'));var querystring=require(_0x4c83('0xf'));var Papa=require('papaparse');var Redis=require(_0x4c83('0x10'));var authService=require(_0x4c83('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4c83('0x12'));var hardwareService=require(_0x4c83('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x4c83('0x14'));var config=require(_0x4c83('0x15'));var licenseUtil=require(_0x4c83('0x16'));var db=require(_0x4c83('0x17'))['db'];function respondWithStatusCode(_0x25b1e0,_0x1fdc2a){_0x1fdc2a=_0x1fdc2a||0xcc;return function(_0x126015){if(_0x126015){return _0x25b1e0[_0x4c83('0x18')](_0x1fdc2a);}return _0x25b1e0[_0x4c83('0x19')](_0x1fdc2a)[_0x4c83('0x1a')]();};}function respondWithResult(_0x2097f8,_0x43dbe){_0x43dbe=_0x43dbe||0xc8;return function(_0x47642f){if(_0x47642f){return _0x2097f8[_0x4c83('0x19')](_0x43dbe)[_0x4c83('0x1b')](_0x47642f);}};}function respondWithFilteredResult(_0x3673a8,_0xa3f12c){return function(_0x3a4214){if(_0x3a4214){var _0x5c91e2=typeof _0xa3f12c[_0x4c83('0x1c')]===_0x4c83('0x1d')&&typeof _0xa3f12c[_0x4c83('0x1e')]==='undefined';var _0x26f7c2=_0x3a4214[_0x4c83('0x1f')];var _0x4e4de5=_0x5c91e2?0x0:_0xa3f12c[_0x4c83('0x1c')];var _0xf177bd=_0x5c91e2?_0x3a4214[_0x4c83('0x1f')]:_0xa3f12c[_0x4c83('0x1c')]+_0xa3f12c['limit'];var _0x3b83b2;if(_0xf177bd>=_0x26f7c2){_0xf177bd=_0x26f7c2;_0x3b83b2=0xc8;}else{_0x3b83b2=0xce;}_0x3673a8[_0x4c83('0x19')](_0x3b83b2);return _0x3673a8['set']('Content-Range',_0x4e4de5+'-'+_0xf177bd+'/'+_0x26f7c2)['json'](_0x3a4214);}return null;};}function patchUpdates(_0x163393){return function(_0x40bdcf){try{jsonpatch['apply'](_0x40bdcf,_0x163393,!![]);}catch(_0x5e4ad6){return BPromise[_0x4c83('0x20')](_0x5e4ad6);}return _0x40bdcf[_0x4c83('0x21')]();};}function saveUpdates(_0x228e56,_0x5546f9){return function(_0x5105c4){if(_0x5105c4){return _0x5105c4['update'](_0x228e56)[_0x4c83('0x22')](function(_0x25dbfd){return _0x25dbfd;});}return null;};}function removeEntity(_0x6cef40,_0x1f3664){return function(_0x442ce4){if(_0x442ce4){return _0x442ce4[_0x4c83('0x23')]()[_0x4c83('0x22')](function(){_0x6cef40[_0x4c83('0x19')](0xcc)[_0x4c83('0x1a')]();});}};}function handleEntityNotFound(_0x5a71a1,_0x5a96d2){return function(_0x2e4249){if(!_0x2e4249){_0x5a71a1[_0x4c83('0x18')](0x194);}return _0x2e4249;};}function handleError(_0x45bd6c,_0x3df924){_0x3df924=_0x3df924||0x1f4;return function(_0x341bd5){logger['error'](_0x341bd5[_0x4c83('0x24')]);if(_0x341bd5[_0x4c83('0x25')]){delete _0x341bd5[_0x4c83('0x25')];}_0x45bd6c['status'](_0x3df924)[_0x4c83('0x26')](_0x341bd5);};}exports[_0x4c83('0x27')]=function(_0x1ab56a,_0x1660d5){var _0x22c8e2={},_0x481349={},_0x334466={'count':0x0,'rows':[]};var _0x4fb819=_[_0x4c83('0x28')](db[_0x4c83('0x29')][_0x4c83('0x2a')],function(_0xea2300){return{'name':_0xea2300[_0x4c83('0x2b')],'type':_0xea2300[_0x4c83('0x2c')][_0x4c83('0x2d')]};});_0x481349['model']=_[_0x4c83('0x28')](_0x4fb819,_0x4c83('0x25'));_0x481349[_0x4c83('0x2e')]=_[_0x4c83('0x2f')](_0x1ab56a[_0x4c83('0x2e')]);_0x481349[_0x4c83('0x30')]=_[_0x4c83('0x31')](_0x481349[_0x4c83('0x32')],_0x481349[_0x4c83('0x2e')]);_0x22c8e2[_0x4c83('0x33')]=_[_0x4c83('0x31')](_0x481349[_0x4c83('0x32')],qs[_0x4c83('0x34')](_0x1ab56a[_0x4c83('0x2e')]['fields']));_0x22c8e2['attributes']=_0x22c8e2[_0x4c83('0x33')][_0x4c83('0x35')]?_0x22c8e2[_0x4c83('0x33')]:_0x481349[_0x4c83('0x32')];if(!_0x1ab56a[_0x4c83('0x2e')][_0x4c83('0x36')](_0x4c83('0x37'))){_0x22c8e2[_0x4c83('0x1e')]=qs[_0x4c83('0x1e')](_0x1ab56a['query']['limit']);_0x22c8e2[_0x4c83('0x1c')]=qs[_0x4c83('0x1c')](_0x1ab56a['query']['offset']);}_0x22c8e2[_0x4c83('0x38')]=qs[_0x4c83('0x39')](_0x1ab56a['query']['sort']);_0x22c8e2[_0x4c83('0x3a')]=qs[_0x4c83('0x30')](_[_0x4c83('0x3b')](_0x1ab56a['query'],_0x481349[_0x4c83('0x30')]),_0x4fb819);if(_0x1ab56a[_0x4c83('0x2e')]['filter']){_0x22c8e2[_0x4c83('0x3a')]=_['merge'](_0x22c8e2['where'],{'$or':_[_0x4c83('0x28')](_0x4fb819,function(_0x1e3cd4){if(_0x1e3cd4[_0x4c83('0x2c')]!==_0x4c83('0x3c')){var _0x1e0000={};_0x1e0000[_0x1e3cd4[_0x4c83('0x25')]]={'$like':'%'+_0x1ab56a[_0x4c83('0x2e')][_0x4c83('0x3d')]+'%'};return _0x1e0000;}})});}_0x22c8e2=_[_0x4c83('0x3e')]({},_0x22c8e2,_0x1ab56a['options']);var _0x1eca7d={'where':_0x22c8e2[_0x4c83('0x3a')]};return db['ZendeskField'][_0x4c83('0x1f')](_0x1eca7d)['then'](function(_0x3da3aa){_0x334466[_0x4c83('0x1f')]=_0x3da3aa;if(_0x1ab56a['query'][_0x4c83('0x3f')]){_0x22c8e2[_0x4c83('0x40')]=[{'all':!![]}];}return db[_0x4c83('0x29')]['findAll'](_0x22c8e2);})['then'](function(_0x415ae0){_0x334466[_0x4c83('0x41')]=_0x415ae0;return _0x334466;})[_0x4c83('0x22')](respondWithFilteredResult(_0x1660d5,_0x22c8e2))[_0x4c83('0x42')](handleError(_0x1660d5,null));};exports[_0x4c83('0x43')]=function(_0x4763c5,_0x398324){var _0x448f00={'raw':!![],'where':{'id':_0x4763c5['params']['id']}},_0x201a97={};_0x201a97['model']=_[_0x4c83('0x2f')](db[_0x4c83('0x29')][_0x4c83('0x2a')]);_0x201a97[_0x4c83('0x2e')]=_[_0x4c83('0x2f')](_0x4763c5[_0x4c83('0x2e')]);_0x201a97[_0x4c83('0x30')]=_[_0x4c83('0x31')](_0x201a97[_0x4c83('0x32')],_0x201a97['query']);_0x448f00[_0x4c83('0x33')]=_[_0x4c83('0x31')](_0x201a97['model'],qs['fields'](_0x4763c5['query'][_0x4c83('0x34')]));_0x448f00['attributes']=_0x448f00[_0x4c83('0x33')]['length']?_0x448f00['attributes']:_0x201a97[_0x4c83('0x32')];if(_0x4763c5[_0x4c83('0x2e')]['includeAll']){_0x448f00['include']=[{'all':!![]}];}_0x448f00=_[_0x4c83('0x3e')]({},_0x448f00,_0x4763c5[_0x4c83('0x44')]);return db['ZendeskField'][_0x4c83('0x45')](_0x448f00)[_0x4c83('0x22')](handleEntityNotFound(_0x398324,null))[_0x4c83('0x22')](respondWithResult(_0x398324,null))['catch'](handleError(_0x398324,null));};exports[_0x4c83('0x46')]=function(_0x5cb165,_0x210793){return db[_0x4c83('0x29')][_0x4c83('0x46')](_0x5cb165[_0x4c83('0x47')],{})[_0x4c83('0x22')](respondWithResult(_0x210793,0xc9))[_0x4c83('0x42')](handleError(_0x210793,null));};exports[_0x4c83('0x48')]=function(_0x2929df,_0x4b30ce){if(_0x2929df['body']['id']){delete _0x2929df[_0x4c83('0x47')]['id'];}return db[_0x4c83('0x29')][_0x4c83('0x45')]({'where':{'id':_0x2929df[_0x4c83('0x49')]['id']}})[_0x4c83('0x22')](handleEntityNotFound(_0x4b30ce,null))[_0x4c83('0x22')](saveUpdates(_0x2929df[_0x4c83('0x47')],null))[_0x4c83('0x22')](respondWithResult(_0x4b30ce,null))[_0x4c83('0x42')](handleError(_0x4b30ce,null));};exports[_0x4c83('0x23')]=function(_0x17e820,_0x5d78fb){return db['ZendeskField']['find']({'where':{'id':_0x17e820['params']['id']}})[_0x4c83('0x22')](handleEntityNotFound(_0x5d78fb,null))[_0x4c83('0x22')](removeEntity(_0x5d78fb,null))[_0x4c83('0x42')](handleError(_0x5d78fb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index cffb6d5..887bd68 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 _0x898b=['exports','int_zendesk_fields','idField','FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xf1226a,_0x29a250){var _0x1b8fe7=function(_0x7178a5){while(--_0x7178a5){_0xf1226a['push'](_0xf1226a['shift']());}};_0x1b8fe7(++_0x29a250);}(_0x898b,0x12f));var _0xb898=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x898b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb898('0x0'));var util=require(_0xb898('0x1'));var logger=require('../../config/logger')(_0xb898('0x2'));var moment=require(_0xb898('0x3'));var BPromise=require(_0xb898('0x4'));var rp=require(_0xb898('0x5'));var fs=require('fs');var path=require(_0xb898('0x6'));var rimraf=require(_0xb898('0x7'));var config=require(_0xb898('0x8'));var attributes=require('./intZendeskField.attributes');module[_0xb898('0x9')]=function(_0x3b0e0c,_0x88bfb2){return _0x3b0e0c['define']('ZendeskField',attributes,{'tableName':_0xb898('0xa'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb898('0xb'),_0xb898('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd9c2=['rimraf','./intZendeskField.attributes','exports','int_zendesk_fields','idField','FieldId','../../config/logger','api','moment','request-promise','path'];(function(_0x519b9f,_0x47f37b){var _0x49d80c=function(_0x5f04b6){while(--_0x5f04b6){_0x519b9f['push'](_0x519b9f['shift']());}};_0x49d80c(++_0x47f37b);}(_0xd9c2,0x13a));var _0x2d9c=function(_0x495123,_0x2bf158){_0x495123=_0x495123-0x0;var _0x39e1ee=_0xd9c2[_0x495123];return _0x39e1ee;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2d9c('0x0'))(_0x2d9c('0x1'));var moment=require(_0x2d9c('0x2'));var BPromise=require('bluebird');var rp=require(_0x2d9c('0x3'));var fs=require('fs');var path=require(_0x2d9c('0x4'));var rimraf=require(_0x2d9c('0x5'));var config=require('../../config/environment');var attributes=require(_0x2d9c('0x6'));module[_0x2d9c('0x7')]=function(_0x197143,_0x3c1cc4){return _0x197143['define']('ZendeskField',attributes,{'tableName':_0x2d9c('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x2d9c('0x9'),_0x2d9c('0xa')],'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 a7fdf30..ae10dbf 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 _0x747b=['debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x747b,0x105));var _0xb747=function(_0x4d5f37,_0x431410){_0x4d5f37=_0x4d5f37-0x0;var _0x5ef460=_0x747b[_0x4d5f37];return _0x5ef460;};'use strict';var _=require(_0xb747('0x0'));var util=require('util');var moment=require(_0xb747('0x1'));var BPromise=require(_0xb747('0x2'));var rs=require(_0xb747('0x3'));var fs=require('fs');var Redis=require(_0xb747('0x4'));var db=require(_0xb747('0x5'))['db'];var utils=require(_0xb747('0x6'));var logger=require(_0xb747('0x7'))(_0xb747('0x8'));var config=require(_0xb747('0x9'));var jayson=require(_0xb747('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x676ec1,_0x3cddca,_0x53a4e5){return new BPromise(function(_0x52d0b3,_0xb72b15){return client['request'](_0x676ec1,_0x53a4e5)[_0xb747('0xb')](function(_0x551c3c){logger[_0xb747('0xc')](_0xb747('0xd'),_0x3cddca,_0xb747('0xe'));logger[_0xb747('0xf')](_0xb747('0x10'),_0x3cddca,_0xb747('0xe'),JSON[_0xb747('0x11')](_0x551c3c));if(_0x551c3c['error']){if(_0x551c3c['error'][_0xb747('0x12')]===0x1f4){logger['error'](_0xb747('0xd'),_0x3cddca,_0x551c3c[_0xb747('0x13')][_0xb747('0x14')]);return _0xb72b15(_0x551c3c[_0xb747('0x13')]['message']);}logger['error'](_0xb747('0xd'),_0x3cddca,_0x551c3c[_0xb747('0x13')][_0xb747('0x14')]);return _0x52d0b3(_0x551c3c[_0xb747('0x13')]['message']);}else{logger[_0xb747('0xc')](_0xb747('0xd'),_0x3cddca,_0xb747('0xe'));_0x52d0b3(_0x551c3c[_0xb747('0x15')]['message']);}})[_0xb747('0x16')](function(_0x5229a9){logger[_0xb747('0x13')](_0xb747('0xd'),_0x3cddca,_0x5229a9);_0xb72b15(_0x5229a9);});});} \ No newline at end of file +var _0x4ec9=['info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','request','then'];(function(_0x327e4a,_0x1f8163){var _0x43fe89=function(_0x27a01a){while(--_0x27a01a){_0x327e4a['push'](_0x327e4a['shift']());}};_0x43fe89(++_0x1f8163);}(_0x4ec9,0x184));var _0x94ec=function(_0x5b1042,_0x21f757){_0x5b1042=_0x5b1042-0x0;var _0x28485d=_0x4ec9[_0x5b1042];return _0x28485d;};'use strict';var _=require(_0x94ec('0x0'));var util=require(_0x94ec('0x1'));var moment=require('moment');var BPromise=require(_0x94ec('0x2'));var rs=require(_0x94ec('0x3'));var fs=require('fs');var Redis=require(_0x94ec('0x4'));var db=require(_0x94ec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x94ec('0x6'))('rpc');var config=require(_0x94ec('0x7'));var jayson=require(_0x94ec('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x149d85,_0x5b1c46,_0x1da9d5){return new BPromise(function(_0xcc0de4,_0x4bbcf9){return client[_0x94ec('0x9')](_0x149d85,_0x1da9d5)[_0x94ec('0xa')](function(_0x1772ed){logger[_0x94ec('0xb')](_0x94ec('0xc'),_0x5b1c46,'request\x20sent');logger[_0x94ec('0xd')](_0x94ec('0xe'),_0x5b1c46,_0x94ec('0xf'),JSON[_0x94ec('0x10')](_0x1772ed));if(_0x1772ed['error']){if(_0x1772ed[_0x94ec('0x11')]['code']===0x1f4){logger[_0x94ec('0x11')](_0x94ec('0xc'),_0x5b1c46,_0x1772ed[_0x94ec('0x11')][_0x94ec('0x12')]);return _0x4bbcf9(_0x1772ed[_0x94ec('0x11')]['message']);}logger[_0x94ec('0x11')](_0x94ec('0xc'),_0x5b1c46,_0x1772ed[_0x94ec('0x11')][_0x94ec('0x12')]);return _0xcc0de4(_0x1772ed[_0x94ec('0x11')][_0x94ec('0x12')]);}else{logger[_0x94ec('0xb')](_0x94ec('0xc'),_0x5b1c46,_0x94ec('0xf'));_0xcc0de4(_0x1772ed[_0x94ec('0x13')]['message']);}})[_0x94ec('0x14')](function(_0x1869d7){logger[_0x94ec('0x11')](_0x94ec('0xc'),_0x5b1c46,_0x1869d7);_0x4bbcf9(_0x1869d7);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 4123483..3178ee2 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 _0x5d4e=['get','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intZohoAccount.controller','isAuthenticated','index','show'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x5d4e,0xda));var _0xe5d4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x5d4e[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xe5d4('0x0'));var util=require(_0xe5d4('0x1'));var path=require(_0xe5d4('0x2'));var timeout=require(_0xe5d4('0x3'));var express=require(_0xe5d4('0x4'));var router=express[_0xe5d4('0x5')]();var fs_extra=require(_0xe5d4('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe5d4('0x7'));var controller=require(_0xe5d4('0x8'));router['get']('/',auth[_0xe5d4('0x9')](),controller[_0xe5d4('0xa')]);router['get']('/:id',auth[_0xe5d4('0x9')](),controller[_0xe5d4('0xb')]);router[_0xe5d4('0xc')](_0xe5d4('0xd'),auth[_0xe5d4('0x9')](),controller['getConfigurations']);router[_0xe5d4('0xc')](_0xe5d4('0xe'),auth['isAuthenticated'](),controller[_0xe5d4('0xf')]);router['post']('/',auth[_0xe5d4('0x9')](),controller[_0xe5d4('0x10')]);router[_0xe5d4('0x11')](_0xe5d4('0xd'),auth[_0xe5d4('0x9')](),controller[_0xe5d4('0x12')]);router[_0xe5d4('0x13')](_0xe5d4('0x14'),auth[_0xe5d4('0x9')](),controller[_0xe5d4('0x15')]);router[_0xe5d4('0x16')](_0xe5d4('0x14'),auth[_0xe5d4('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa6e9=['post','create','addConfiguration','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x722d30,_0x1633a3){var _0x22b826=function(_0x2fc0e0){while(--_0x2fc0e0){_0x722d30['push'](_0x722d30['shift']());}};_0x22b826(++_0x1633a3);}(_0xa6e9,0x1e2));var _0x9a6e=function(_0x5865ed,_0x468423){_0x5865ed=_0x5865ed-0x0;var _0x32d453=_0xa6e9[_0x5865ed];return _0x32d453;};'use strict';var multer=require(_0x9a6e('0x0'));var util=require(_0x9a6e('0x1'));var path=require(_0x9a6e('0x2'));var timeout=require(_0x9a6e('0x3'));var express=require(_0x9a6e('0x4'));var router=express[_0x9a6e('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x9a6e('0x6'));var interaction=require(_0x9a6e('0x7'));var config=require(_0x9a6e('0x8'));var controller=require(_0x9a6e('0x9'));router[_0x9a6e('0xa')]('/',auth[_0x9a6e('0xb')](),controller['index']);router[_0x9a6e('0xa')](_0x9a6e('0xc'),auth['isAuthenticated'](),controller[_0x9a6e('0xd')]);router[_0x9a6e('0xa')](_0x9a6e('0xe'),auth['isAuthenticated'](),controller[_0x9a6e('0xf')]);router[_0x9a6e('0xa')](_0x9a6e('0x10'),auth[_0x9a6e('0xb')](),controller[_0x9a6e('0x11')]);router[_0x9a6e('0x12')]('/',auth[_0x9a6e('0xb')](),controller[_0x9a6e('0x13')]);router[_0x9a6e('0x12')]('/:id/configurations',auth[_0x9a6e('0xb')](),controller[_0x9a6e('0x14')]);router[_0x9a6e('0x15')](_0x9a6e('0xc'),auth[_0x9a6e('0xb')](),controller[_0x9a6e('0x16')]);router['delete'](_0x9a6e('0xc'),auth[_0x9a6e('0xb')](),controller[_0x9a6e('0x17')]);module[_0x9a6e('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 75008d8..6abd870 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 _0xedd9=['exports','STRING'];(function(_0x5da1a1,_0x2c5179){var _0x5c5cb3=function(_0x48b798){while(--_0x48b798){_0x5da1a1['push'](_0x5da1a1['shift']());}};_0x5c5cb3(++_0x2c5179);}(_0xedd9,0xfc));var _0x9edd=function(_0xec3cab,_0x3d89a1){_0xec3cab=_0xec3cab-0x0;var _0x2e4e51=_0xedd9[_0xec3cab];return _0x2e4e51;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'name':{'type':Sequelize[_0x9edd('0x1')]},'description':{'type':Sequelize[_0x9edd('0x1')]},'host':{'type':Sequelize[_0x9edd('0x1')]},'zone':{'type':Sequelize[_0x9edd('0x1')]},'clientId':{'type':Sequelize[_0x9edd('0x1')]},'clientSecret':{'type':Sequelize[_0x9edd('0x1')]},'serverUrl':{'type':Sequelize[_0x9edd('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x9edd('0x1')]}}; \ No newline at end of file +var _0x99e9=['exports','STRING'];(function(_0x9c1f82,_0x5dd39e){var _0x5522ec=function(_0x8694ae){while(--_0x8694ae){_0x9c1f82['push'](_0x9c1f82['shift']());}};_0x5522ec(++_0x5dd39e);}(_0x99e9,0xb4));var _0x999e=function(_0x2c3a8f,_0x374e56){_0x2c3a8f=_0x2c3a8f-0x0;var _0x189412=_0x99e9[_0x2c3a8f];return _0x189412;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'name':{'type':Sequelize[_0x999e('0x1')]},'description':{'type':Sequelize[_0x999e('0x1')]},'host':{'type':Sequelize[_0x999e('0x1')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x999e('0x1')]},'clientSecret':{'type':Sequelize[_0x999e('0x1')]},'serverUrl':{'type':Sequelize[_0x999e('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x999e('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 7e4c87a..2b9ee25 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 _0x4782=['https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Description','WhoId','Call_Duration','Call_Type','remove','push','display_label','custom_field','data_type','pick_list_values','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','sendStatus','error','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','update','getConfigurations','findOne','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','ZohoConfiguration','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','serverUrl','host','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format'];(function(_0xd0ec46,_0x33e078){var _0x3e5126=function(_0x3672fd){while(--_0x3672fd){_0xd0ec46['push'](_0xd0ec46['shift']());}};_0x3e5126(++_0x33e078);}(_0x4782,0x10d));var _0x2478=function(_0x140920,_0x5464db){_0x140920=_0x140920-0x0;var _0x436ed0=_0x4782[_0x140920];return _0x436ed0;};'use strict';var emlformat=require(_0x2478('0x0'));var rimraf=require(_0x2478('0x1'));var zipdir=require(_0x2478('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2478('0x3'));var moment=require(_0x2478('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x2478('0x5'));var sox=require(_0x2478('0x6'));var csv=require(_0x2478('0x7'));var ejs=require(_0x2478('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2478('0x9'));var squel=require(_0x2478('0xa'));var crypto=require(_0x2478('0xb'));var jsforce=require(_0x2478('0xc'));var deskjs=require(_0x2478('0xd'));var toCsv=require(_0x2478('0x7'));var querystring=require(_0x2478('0xe'));var Papa=require(_0x2478('0xf'));var Redis=require(_0x2478('0x10'));var authService=require(_0x2478('0x11'));var qs=require(_0x2478('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2478('0x13'));var logger=require(_0x2478('0x14'))('api');var utils=require(_0x2478('0x15'));var config=require(_0x2478('0x16'));var licenseUtil=require(_0x2478('0x17'));var db=require(_0x2478('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x762541,_0x498ddf){_0x498ddf=_0x498ddf||0xcc;return function(_0x54da7d){if(_0x54da7d){return _0x762541['sendStatus'](_0x498ddf);}return _0x762541[_0x2478('0x19')](_0x498ddf)[_0x2478('0x1a')]();};}function respondWithResult(_0x4aec89,_0x59da65){_0x59da65=_0x59da65||0xc8;return function(_0x1a881a){if(_0x1a881a){return _0x4aec89[_0x2478('0x19')](_0x59da65)[_0x2478('0x1b')](_0x1a881a);}};}function respondWithFilteredResult(_0x3fbc5c,_0x5a2be1){return function(_0x5669b7){if(_0x5669b7){var _0x5aa27e=typeof _0x5a2be1['offset']===_0x2478('0x1c')&&typeof _0x5a2be1[_0x2478('0x1d')]===_0x2478('0x1c');var _0x483c69=_0x5669b7[_0x2478('0x1e')];var _0x3ff2f3=_0x5aa27e?0x0:_0x5a2be1['offset'];var _0x5bae2f=_0x5aa27e?_0x5669b7['count']:_0x5a2be1[_0x2478('0x1f')]+_0x5a2be1[_0x2478('0x1d')];var _0x492327;if(_0x5bae2f>=_0x483c69){_0x5bae2f=_0x483c69;_0x492327=0xc8;}else{_0x492327=0xce;}_0x3fbc5c[_0x2478('0x19')](_0x492327);return _0x3fbc5c[_0x2478('0x20')](_0x2478('0x21'),_0x3ff2f3+'-'+_0x5bae2f+'/'+_0x483c69)[_0x2478('0x1b')](_0x5669b7);}return null;};}function patchUpdates(_0xf79740){return function(_0x234c77){try{jsonpatch['apply'](_0x234c77,_0xf79740,!![]);}catch(_0x363259){return BPromise[_0x2478('0x22')](_0x363259);}return _0x234c77[_0x2478('0x23')]();};}function saveUpdates(_0x452998,_0x12e63d){return function(_0xee5579){if(_0xee5579){return _0xee5579['update'](_0x452998)[_0x2478('0x24')](function(_0x56b24){return _0x56b24;});}return null;};}function removeEntity(_0xe9f94a,_0x3da1a4){return function(_0x125d40){if(_0x125d40){return _0x125d40[_0x2478('0x25')]()[_0x2478('0x24')](function(){_0xe9f94a[_0x2478('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d8db0,_0x21a5f9){return function(_0x4fb40a){if(!_0x4fb40a){_0x4d8db0[_0x2478('0x26')](0x194);}return _0x4fb40a;};}function handleError(_0x52a506,_0x5f3180){_0x5f3180=_0x5f3180||0x1f4;return function(_0x239a0b){logger[_0x2478('0x27')](_0x239a0b[_0x2478('0x28')]);if(_0x239a0b[_0x2478('0x29')]){delete _0x239a0b[_0x2478('0x29')];}_0x52a506[_0x2478('0x19')](_0x5f3180)[_0x2478('0x2a')](_0x239a0b);};}exports[_0x2478('0x2b')]=function(_0x108055,_0x5cb4c6){var _0xfcf1e0={},_0x489e9a={},_0x39b8dd={'count':0x0,'rows':[]};var _0x4dc8eb=_[_0x2478('0x2c')](db[_0x2478('0x2d')][_0x2478('0x2e')],function(_0x323e82){return{'name':_0x323e82[_0x2478('0x2f')],'type':_0x323e82[_0x2478('0x30')]['key']};});_0x489e9a[_0x2478('0x31')]=_[_0x2478('0x2c')](_0x4dc8eb,_0x2478('0x29'));_0x489e9a[_0x2478('0x32')]=_[_0x2478('0x33')](_0x108055[_0x2478('0x32')]);_0x489e9a['filters']=_[_0x2478('0x34')](_0x489e9a['model'],_0x489e9a[_0x2478('0x32')]);_0xfcf1e0[_0x2478('0x35')]=_[_0x2478('0x34')](_0x489e9a['model'],qs[_0x2478('0x36')](_0x108055[_0x2478('0x32')][_0x2478('0x36')]));_0xfcf1e0[_0x2478('0x35')]=_0xfcf1e0[_0x2478('0x35')][_0x2478('0x37')]?_0xfcf1e0[_0x2478('0x35')]:_0x489e9a[_0x2478('0x31')];if(!_0x108055['query']['hasOwnProperty'](_0x2478('0x38'))){_0xfcf1e0['limit']=qs['limit'](_0x108055[_0x2478('0x32')][_0x2478('0x1d')]);_0xfcf1e0['offset']=qs[_0x2478('0x1f')](_0x108055[_0x2478('0x32')]['offset']);}_0xfcf1e0['order']=qs[_0x2478('0x39')](_0x108055[_0x2478('0x32')]['sort']);_0xfcf1e0[_0x2478('0x3a')]=qs[_0x2478('0x3b')](_['pick'](_0x108055['query'],_0x489e9a[_0x2478('0x3b')]),_0x4dc8eb);if(_0x108055[_0x2478('0x32')][_0x2478('0x3c')]){_0xfcf1e0['where']=_[_0x2478('0x3d')](_0xfcf1e0[_0x2478('0x3a')],{'$or':_[_0x2478('0x2c')](_0x4dc8eb,function(_0x4f48ec){if(_0x4f48ec[_0x2478('0x30')]!==_0x2478('0x3e')){var _0x81e6eb={};_0x81e6eb[_0x4f48ec[_0x2478('0x29')]]={'$like':'%'+_0x108055[_0x2478('0x32')][_0x2478('0x3c')]+'%'};return _0x81e6eb;}})});}_0xfcf1e0=_['merge']({},_0xfcf1e0,_0x108055['options']);var _0x34e02e={'where':_0xfcf1e0[_0x2478('0x3a')]};return db[_0x2478('0x2d')][_0x2478('0x1e')](_0x34e02e)[_0x2478('0x24')](function(_0x510687){_0x39b8dd['count']=_0x510687;if(_0x108055[_0x2478('0x32')]['includeAll']){_0xfcf1e0[_0x2478('0x3f')]=[{'all':!![]}];}return db[_0x2478('0x2d')][_0x2478('0x40')](_0xfcf1e0);})['then'](function(_0x410956){_0x39b8dd['rows']=_0x410956;return _0x39b8dd;})['then'](respondWithFilteredResult(_0x5cb4c6,_0xfcf1e0))[_0x2478('0x41')](handleError(_0x5cb4c6,null));};exports[_0x2478('0x42')]=function(_0x157c43,_0x366370){var _0x3a63ce={'raw':![],'where':{'id':_0x157c43[_0x2478('0x43')]['id']}},_0x35a266={};_0x35a266[_0x2478('0x31')]=_[_0x2478('0x33')](db[_0x2478('0x2d')][_0x2478('0x2e')]);_0x35a266['query']=_[_0x2478('0x33')](_0x157c43[_0x2478('0x32')]);_0x35a266[_0x2478('0x3b')]=_[_0x2478('0x34')](_0x35a266[_0x2478('0x31')],_0x35a266['query']);_0x3a63ce[_0x2478('0x35')]=_[_0x2478('0x34')](_0x35a266[_0x2478('0x31')],qs[_0x2478('0x36')](_0x157c43[_0x2478('0x32')][_0x2478('0x36')]));_0x3a63ce[_0x2478('0x35')]=_0x3a63ce['attributes'][_0x2478('0x37')]?_0x3a63ce[_0x2478('0x35')]:_0x35a266[_0x2478('0x31')];if(_0x157c43['query'][_0x2478('0x44')]){_0x3a63ce[_0x2478('0x3f')]=[{'all':!![]}];}_0x3a63ce=_[_0x2478('0x3d')]({},_0x3a63ce,_0x157c43[_0x2478('0x45')]);return db[_0x2478('0x2d')][_0x2478('0x46')](_0x3a63ce)[_0x2478('0x24')](handleEntityNotFound(_0x366370,null))[_0x2478('0x24')](respondWithResult(_0x366370,null))[_0x2478('0x41')](handleError(_0x366370,null));};exports['create']=function(_0x1cf228,_0x5f334b){return db['ZohoAccount'][_0x2478('0x47')](_0x1cf228[_0x2478('0x48')],{})[_0x2478('0x24')](respondWithResult(_0x5f334b,0xc9))[_0x2478('0x41')](handleError(_0x5f334b,null));};exports[_0x2478('0x49')]=function(_0xc82cd6,_0x1f1231){if(_0xc82cd6[_0x2478('0x48')]['id']){delete _0xc82cd6[_0x2478('0x48')]['id'];}return db['ZohoAccount'][_0x2478('0x46')]({'where':{'id':_0xc82cd6[_0x2478('0x43')]['id']}})['then'](handleEntityNotFound(_0x1f1231,null))['then'](saveUpdates(_0xc82cd6[_0x2478('0x48')],null))[_0x2478('0x24')](respondWithResult(_0x1f1231,null))[_0x2478('0x41')](handleError(_0x1f1231,null));};exports[_0x2478('0x25')]=function(_0x2149cb,_0x2c46bb){return db[_0x2478('0x2d')][_0x2478('0x46')]({'where':{'id':_0x2149cb[_0x2478('0x43')]['id']}})[_0x2478('0x24')](handleEntityNotFound(_0x2c46bb,null))[_0x2478('0x24')](removeEntity(_0x2c46bb,null))['catch'](handleError(_0x2c46bb,null));};exports[_0x2478('0x4a')]=function(_0x1b054c,_0x1afd9c,_0x3d81d7){var _0x2f57eb={};var _0x5c06c8={};var _0x14e7c6;var _0x19ea0c;return db[_0x2478('0x2d')][_0x2478('0x4b')]({'where':{'id':_0x1b054c[_0x2478('0x43')]['id']}})['then'](handleEntityNotFound(_0x1afd9c,null))['then'](function(_0x5d44e0){if(_0x5d44e0){_0x14e7c6=_0x5d44e0;_0x5c06c8[_0x2478('0x31')]=_[_0x2478('0x33')](db['ZohoConfiguration'][_0x2478('0x2e')]);_0x5c06c8[_0x2478('0x32')]=_[_0x2478('0x33')](_0x1b054c['query']);_0x5c06c8['filters']=_[_0x2478('0x34')](_0x5c06c8[_0x2478('0x31')],_0x5c06c8[_0x2478('0x32')]);_0x2f57eb[_0x2478('0x35')]=_['intersection'](_0x5c06c8[_0x2478('0x31')],qs['fields'](_0x1b054c[_0x2478('0x32')]['fields']));_0x2f57eb[_0x2478('0x35')]=_0x2f57eb[_0x2478('0x35')][_0x2478('0x37')]?_0x2f57eb['attributes']:_0x5c06c8[_0x2478('0x31')];_0x2f57eb['order']=qs['sort'](_0x1b054c[_0x2478('0x32')]['sort']);_0x2f57eb[_0x2478('0x3a')]=qs[_0x2478('0x3b')](_[_0x2478('0x4c')](_0x1b054c[_0x2478('0x32')],_0x5c06c8[_0x2478('0x3b')]));if(_0x1b054c['query']['filter']){_0x2f57eb[_0x2478('0x3a')]=_['merge'](_0x2f57eb[_0x2478('0x3a')],{'$or':_['map'](_0x2f57eb['attributes'],function(_0x4ab341){var _0x5bf7c4={};_0x5bf7c4[_0x4ab341]={'$like':'%'+_0x1b054c['query']['filter']+'%'};return _0x5bf7c4;})});}_0x2f57eb=_['merge']({},_0x2f57eb,_0x1b054c[_0x2478('0x45')]);return _0x14e7c6[_0x2478('0x4a')](_0x2f57eb);}})['then'](function(_0x4b5132){if(_0x4b5132){_0x19ea0c=_0x4b5132['length'];if(!_0x1b054c[_0x2478('0x32')]['hasOwnProperty']('nolimit')){_0x2f57eb['limit']=qs['limit'](_0x1b054c[_0x2478('0x32')]['limit']);_0x2f57eb[_0x2478('0x1f')]=qs[_0x2478('0x1f')](_0x1b054c[_0x2478('0x32')][_0x2478('0x1f')]);}return _0x14e7c6[_0x2478('0x4a')](_0x2f57eb);}})[_0x2478('0x24')](function(_0x38c65e){if(_0x38c65e){return _0x38c65e?{'count':_0x19ea0c,'rows':_0x38c65e}:null;}})[_0x2478('0x24')](respondWithResult(_0x1afd9c,null))[_0x2478('0x41')](handleError(_0x1afd9c,null));};exports[_0x2478('0x4d')]=function(_0xabd615,_0x35c293,_0x2e6323){if(_0xabd615[_0x2478('0x48')]['id']){delete _0xabd615[_0x2478('0x48')]['id'];}return db[_0x2478('0x2d')][_0x2478('0x4b')]({'where':{'id':_0xabd615[_0x2478('0x43')]['id']}})['then'](handleEntityNotFound(_0x35c293,null))[_0x2478('0x24')](function(_0x36099d){if(_0x36099d){_0xabd615['body'][_0x2478('0x4e')]=_0x36099d['id'];_0xabd615[_0x2478('0x48')][_0x2478('0x4f')]=integrations[_0x2478('0x50')](_0xabd615[_0x2478('0x48')][_0x2478('0x51')],_0xabd615[_0x2478('0x48')]['type']);_0xabd615['body'][_0x2478('0x52')]=integrations['getDescriptions'](_0xabd615[_0x2478('0x48')][_0x2478('0x51')],_0xabd615['body']['type']);return db[_0x2478('0x53')][_0x2478('0x47')](_0xabd615[_0x2478('0x48')],{'include':[{'model':db[_0x2478('0x54')],'as':_0x2478('0x4f')},{'model':db[_0x2478('0x54')],'as':'Descriptions'}]});}return null;})[_0x2478('0x24')](respondWithResult(_0x35c293,null))['catch'](handleError(_0x35c293,null));};function getAccessToken(_0x298500){return new Promise(function(_0x36799e,_0x148b8e){var _0x38a9f7;switch(_0x298500[_0x2478('0x55')]){case'US':_0x38a9f7=_0x2478('0x56');break;case'AU':_0x38a9f7=_0x2478('0x57');break;case'EU':_0x38a9f7=_0x2478('0x58');break;case'IN':_0x38a9f7='https://accounts.zoho.in';break;case'CN':_0x38a9f7=_0x2478('0x59');break;default:_0x38a9f7=_0x2478('0x58');break;}var _0xf168ab={'method':_0x2478('0x5a'),'uri':_0x38a9f7+_0x2478('0x5b'),'qs':{'refresh_token':_0x298500[_0x2478('0x5c')],'client_id':_0x298500[_0x2478('0x5d')],'client_secret':_0x298500[_0x2478('0x5e')],'grant_type':_0x2478('0x5f')},'json':!![]};return rp(_0xf168ab)[_0x2478('0x24')](function(_0x2b12ab){if(_0x2b12ab[_0x2478('0x60')]){_0x36799e(_0x2b12ab[_0x2478('0x60')]);}else{_0x148b8e('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x2478('0x41')](function(_0x23302a){_0x148b8e(_0x23302a);});});}exports['getFields']=function(_0x1fda86,_0x5c0032,_0x4d0922){var _0x32147d,_0x229344,_0x5e402e,_0x465f46,_0x1b6bae;return db[_0x2478('0x2d')][_0x2478('0x4b')]({'where':{'id':_0x1fda86['params']['id']},'attributes':['id','host',_0x2478('0x55'),_0x2478('0x5d'),_0x2478('0x5e'),_0x2478('0x61'),'code','refreshToken']})[_0x2478('0x24')](handleEntityNotFound(_0x5c0032,null))['then'](function(_0x3d0e4e){_0x1b6bae=_0x3d0e4e;_0x32147d=_0x1b6bae[_0x2478('0x62')];_0x229344=_0x32147d===_0x2478('0x63')?'eu':_0x2478('0x64');_0x5e402e=_0x1b6bae[_0x2478('0x61')];var _0x298f39=_0x5e402e[_0x2478('0x65')](-0x1);if(_0x298f39==='/'||_0x298f39==='\x5c'||_0x298f39===':'){_0x5e402e=_0x5e402e[_0x2478('0x66')](0x0,_0x5e402e['lastIndexOf'](_0x298f39));}if(!_0x1b6bae[_0x2478('0x5c')]){throw new Error(_0x2478('0x67'));}return getAccessToken(_0x1b6bae);})[_0x2478('0x24')](function(_0x35520b){if(_0x35520b){return rp({'method':_0x2478('0x68'),'uri':util[_0x2478('0x69')](_0x2478('0x6a'),_0x229344),'qs':{'module':_0x2478('0x6b')},'headers':{'Authorization':_0x2478('0x6c')+_0x35520b},'json':!![]});}})['then'](function(_0x248782){if(_0x248782){if(_0x248782[_0x2478('0x6d')]&&_0x248782[_0x2478('0x6d')][_0x2478('0x27')]){throw new Error(_0x248782['response']['error'][_0x2478('0x6e')]);}var _0x4403b9=[];var _0x12444a=[];var _0x25bd04=['Owner','Subject',_0x2478('0x6f'),_0x2478('0x70'),_0x2478('0x71'),'Call_Result','Call_Start_Time',_0x2478('0x72')];_0x12444a=_[_0x2478('0x73')](_0x248782[_0x2478('0x36')],function(_0x4d75f8){return _0x25bd04['includes'](_0x4d75f8['api_name']);});for(var _0x3c5fd6=0x0;_0x3c5fd6<_0x12444a[_0x2478('0x37')];_0x3c5fd6++){if(_0x12444a[_0x3c5fd6]['system_mandatory']===![]){_0x4403b9[_0x2478('0x74')]({'id':_0x12444a[_0x3c5fd6]['id'],'name':_0x12444a[_0x3c5fd6][_0x2478('0x75')],'custom':_0x12444a[_0x3c5fd6][_0x2478('0x76')],'options':_0x12444a[_0x3c5fd6][_0x2478('0x77')]==='picklist'&&_0x12444a[_0x3c5fd6][_0x2478('0x78')][_0x2478('0x37')]>-0x1?_['map'](_0x12444a[_0x3c5fd6][_0x2478('0x78')],function(_0x25d47a){return{'name':_0x25d47a,'value':_0x25d47a};}):[]});}}return{'count':_0x4403b9[_0x2478('0x37')],'rows':_0x4403b9};}else{return{'count':0x0,'rows':[]};}})[_0x2478('0x24')](respondWithResult(_0x5c0032,null))[_0x2478('0x41')](function(_0xafc38f){var _0x31429b=_0x1fda86[_0x2478('0x32')][_0x2478('0x79')]?0x1f4:_0xafc38f[_0x2478('0x7a')]||0x1f4;logger[_0x2478('0x27')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x31429b,JSON[_0x2478('0x7b')](_0xafc38f));delete _0xafc38f[_0x2478('0x29')];if(_0x31429b===0x191){_0x31429b=0x190;}_0x5c0032[_0x2478('0x19')](_0x31429b)[_0x2478('0x2a')](_0x1fda86[_0x2478('0x32')][_0x2478('0x79')]?{'message':_0x2478('0x7c'),'statusCode':_0xafc38f[_0x2478('0x7a')]}:_0xafc38f);});}; \ No newline at end of file +var _0x3626=['code','host','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Calls','response','Owner','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','push','display_label','data_type','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','json','offset','undefined','count','status','set','Content-Range','apply','reject','save','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','nolimit','limit','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','include','ZohoAccount','findAll','show','find','catch','create','body','update','params','destroy','getConfigurations','length','order','hasOwnProperty','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','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','serverUrl'];(function(_0xde1697,_0x2f3a49){var _0x3502d0=function(_0x168811){while(--_0x168811){_0xde1697['push'](_0xde1697['shift']());}};_0x3502d0(++_0x2f3a49);}(_0x3626,0x190));var _0x6362=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x3626[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0x6362('0x0'));var rimraf=require(_0x6362('0x1'));var zipdir=require(_0x6362('0x2'));var jsonpatch=require(_0x6362('0x3'));var rp=require('request-promise');var moment=require(_0x6362('0x4'));var BPromise=require(_0x6362('0x5'));var Mustache=require(_0x6362('0x6'));var util=require('util');var path=require(_0x6362('0x7'));var sox=require(_0x6362('0x8'));var csv=require('to-csv');var ejs=require(_0x6362('0x9'));var fs=require('fs');var fs_extra=require(_0x6362('0xa'));var _=require(_0x6362('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6362('0xc'));var toCsv=require(_0x6362('0xd'));var querystring=require(_0x6362('0xe'));var Papa=require(_0x6362('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6362('0x10'));var as=require(_0x6362('0x11'));var hardwareService=require(_0x6362('0x12'));var logger=require(_0x6362('0x13'))(_0x6362('0x14'));var utils=require(_0x6362('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6362('0x16'));var db=require(_0x6362('0x17'))['db'];var integrations=require(_0x6362('0x18'));function respondWithStatusCode(_0x417792,_0x1b91df){_0x1b91df=_0x1b91df||0xcc;return function(_0x5ccd58){if(_0x5ccd58){return _0x417792[_0x6362('0x19')](_0x1b91df);}return _0x417792['status'](_0x1b91df)['end']();};}function respondWithResult(_0x104a9a,_0x2dcdd5){_0x2dcdd5=_0x2dcdd5||0xc8;return function(_0x4a8f78){if(_0x4a8f78){return _0x104a9a['status'](_0x2dcdd5)[_0x6362('0x1a')](_0x4a8f78);}};}function respondWithFilteredResult(_0x444abb,_0x591926){return function(_0x38ed98){if(_0x38ed98){var _0x196fc3=typeof _0x591926[_0x6362('0x1b')]==='undefined'&&typeof _0x591926['limit']===_0x6362('0x1c');var _0x325ed6=_0x38ed98[_0x6362('0x1d')];var _0xa78b10=_0x196fc3?0x0:_0x591926[_0x6362('0x1b')];var _0x28b88d=_0x196fc3?_0x38ed98[_0x6362('0x1d')]:_0x591926['offset']+_0x591926['limit'];var _0x33416a;if(_0x28b88d>=_0x325ed6){_0x28b88d=_0x325ed6;_0x33416a=0xc8;}else{_0x33416a=0xce;}_0x444abb[_0x6362('0x1e')](_0x33416a);return _0x444abb[_0x6362('0x1f')](_0x6362('0x20'),_0xa78b10+'-'+_0x28b88d+'/'+_0x325ed6)[_0x6362('0x1a')](_0x38ed98);}return null;};}function patchUpdates(_0x25f275){return function(_0x4eb45a){try{jsonpatch[_0x6362('0x21')](_0x4eb45a,_0x25f275,!![]);}catch(_0x348bb8){return BPromise[_0x6362('0x22')](_0x348bb8);}return _0x4eb45a[_0x6362('0x23')]();};}function saveUpdates(_0x37ea6c,_0x5dea7b){return function(_0x1723b7){if(_0x1723b7){return _0x1723b7['update'](_0x37ea6c)[_0x6362('0x24')](function(_0x125ee7){return _0x125ee7;});}return null;};}function removeEntity(_0x1886d7,_0x1973a7){return function(_0x4e36fd){if(_0x4e36fd){return _0x4e36fd['destroy']()['then'](function(){_0x1886d7[_0x6362('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d92dc,_0x142e6a){return function(_0x139e4e){if(!_0x139e4e){_0x5d92dc[_0x6362('0x19')](0x194);}return _0x139e4e;};}function handleError(_0x316ca2,_0x1ce688){_0x1ce688=_0x1ce688||0x1f4;return function(_0xf90c68){logger[_0x6362('0x25')](_0xf90c68[_0x6362('0x26')]);if(_0xf90c68[_0x6362('0x27')]){delete _0xf90c68[_0x6362('0x27')];}_0x316ca2[_0x6362('0x1e')](_0x1ce688)[_0x6362('0x28')](_0xf90c68);};}exports['index']=function(_0x55c7ba,_0x22369a){var _0x21a242={},_0x426238={},_0x7e0355={'count':0x0,'rows':[]};var _0x1d9132=_[_0x6362('0x29')](db['ZohoAccount'][_0x6362('0x2a')],function(_0x323d3f){return{'name':_0x323d3f[_0x6362('0x2b')],'type':_0x323d3f[_0x6362('0x2c')]['key']};});_0x426238[_0x6362('0x2d')]=_['map'](_0x1d9132,_0x6362('0x27'));_0x426238[_0x6362('0x2e')]=_[_0x6362('0x2f')](_0x55c7ba[_0x6362('0x2e')]);_0x426238['filters']=_[_0x6362('0x30')](_0x426238[_0x6362('0x2d')],_0x426238[_0x6362('0x2e')]);_0x21a242[_0x6362('0x31')]=_['intersection'](_0x426238[_0x6362('0x2d')],qs[_0x6362('0x32')](_0x55c7ba['query']['fields']));_0x21a242[_0x6362('0x31')]=_0x21a242['attributes']['length']?_0x21a242[_0x6362('0x31')]:_0x426238[_0x6362('0x2d')];if(!_0x55c7ba['query']['hasOwnProperty'](_0x6362('0x33'))){_0x21a242['limit']=qs[_0x6362('0x34')](_0x55c7ba[_0x6362('0x2e')][_0x6362('0x34')]);_0x21a242['offset']=qs[_0x6362('0x1b')](_0x55c7ba['query'][_0x6362('0x1b')]);}_0x21a242['order']=qs['sort'](_0x55c7ba[_0x6362('0x2e')][_0x6362('0x35')]);_0x21a242[_0x6362('0x36')]=qs['filters'](_[_0x6362('0x37')](_0x55c7ba['query'],_0x426238[_0x6362('0x38')]),_0x1d9132);if(_0x55c7ba[_0x6362('0x2e')]['filter']){_0x21a242[_0x6362('0x36')]=_[_0x6362('0x39')](_0x21a242['where'],{'$or':_['map'](_0x1d9132,function(_0x523890){if(_0x523890[_0x6362('0x2c')]!==_0x6362('0x3a')){var _0x4d469b={};_0x4d469b[_0x523890[_0x6362('0x27')]]={'$like':'%'+_0x55c7ba[_0x6362('0x2e')][_0x6362('0x3b')]+'%'};return _0x4d469b;}})});}_0x21a242=_[_0x6362('0x39')]({},_0x21a242,_0x55c7ba[_0x6362('0x3c')]);var _0x1413f2={'where':_0x21a242['where']};return db['ZohoAccount']['count'](_0x1413f2)[_0x6362('0x24')](function(_0x57faba){_0x7e0355[_0x6362('0x1d')]=_0x57faba;if(_0x55c7ba[_0x6362('0x2e')][_0x6362('0x3d')]){_0x21a242[_0x6362('0x3e')]=[{'all':!![]}];}return db[_0x6362('0x3f')][_0x6362('0x40')](_0x21a242);})['then'](function(_0x4df9ad){_0x7e0355['rows']=_0x4df9ad;return _0x7e0355;})[_0x6362('0x24')](respondWithFilteredResult(_0x22369a,_0x21a242))['catch'](handleError(_0x22369a,null));};exports[_0x6362('0x41')]=function(_0x211775,_0x4e7718){var _0x2d42d1={'raw':![],'where':{'id':_0x211775['params']['id']}},_0x468330={};_0x468330[_0x6362('0x2d')]=_['keys'](db['ZohoAccount'][_0x6362('0x2a')]);_0x468330['query']=_[_0x6362('0x2f')](_0x211775[_0x6362('0x2e')]);_0x468330[_0x6362('0x38')]=_['intersection'](_0x468330[_0x6362('0x2d')],_0x468330[_0x6362('0x2e')]);_0x2d42d1['attributes']=_[_0x6362('0x30')](_0x468330[_0x6362('0x2d')],qs[_0x6362('0x32')](_0x211775['query'][_0x6362('0x32')]));_0x2d42d1['attributes']=_0x2d42d1[_0x6362('0x31')]['length']?_0x2d42d1['attributes']:_0x468330['model'];if(_0x211775['query'][_0x6362('0x3d')]){_0x2d42d1[_0x6362('0x3e')]=[{'all':!![]}];}_0x2d42d1=_[_0x6362('0x39')]({},_0x2d42d1,_0x211775['options']);return db[_0x6362('0x3f')][_0x6362('0x42')](_0x2d42d1)[_0x6362('0x24')](handleEntityNotFound(_0x4e7718,null))[_0x6362('0x24')](respondWithResult(_0x4e7718,null))[_0x6362('0x43')](handleError(_0x4e7718,null));};exports[_0x6362('0x44')]=function(_0x4c78b9,_0x1b4f5d){return db[_0x6362('0x3f')][_0x6362('0x44')](_0x4c78b9[_0x6362('0x45')],{})['then'](respondWithResult(_0x1b4f5d,0xc9))[_0x6362('0x43')](handleError(_0x1b4f5d,null));};exports[_0x6362('0x46')]=function(_0x47d23c,_0x33e9b2){if(_0x47d23c['body']['id']){delete _0x47d23c['body']['id'];}return db[_0x6362('0x3f')][_0x6362('0x42')]({'where':{'id':_0x47d23c[_0x6362('0x47')]['id']}})[_0x6362('0x24')](handleEntityNotFound(_0x33e9b2,null))[_0x6362('0x24')](saveUpdates(_0x47d23c[_0x6362('0x45')],null))['then'](respondWithResult(_0x33e9b2,null))[_0x6362('0x43')](handleError(_0x33e9b2,null));};exports[_0x6362('0x48')]=function(_0x463cc8,_0x310c5f){return db[_0x6362('0x3f')]['find']({'where':{'id':_0x463cc8[_0x6362('0x47')]['id']}})['then'](handleEntityNotFound(_0x310c5f,null))['then'](removeEntity(_0x310c5f,null))[_0x6362('0x43')](handleError(_0x310c5f,null));};exports[_0x6362('0x49')]=function(_0x374da4,_0x55031b,_0x3e3180){var _0xf90bbf={};var _0x54304a={};var _0x3b0aec;var _0x5a8500;return db[_0x6362('0x3f')]['findOne']({'where':{'id':_0x374da4['params']['id']}})[_0x6362('0x24')](handleEntityNotFound(_0x55031b,null))[_0x6362('0x24')](function(_0xfa6ae9){if(_0xfa6ae9){_0x3b0aec=_0xfa6ae9;_0x54304a[_0x6362('0x2d')]=_['keys'](db['ZohoConfiguration'][_0x6362('0x2a')]);_0x54304a['query']=_[_0x6362('0x2f')](_0x374da4[_0x6362('0x2e')]);_0x54304a[_0x6362('0x38')]=_[_0x6362('0x30')](_0x54304a[_0x6362('0x2d')],_0x54304a[_0x6362('0x2e')]);_0xf90bbf[_0x6362('0x31')]=_[_0x6362('0x30')](_0x54304a[_0x6362('0x2d')],qs[_0x6362('0x32')](_0x374da4[_0x6362('0x2e')]['fields']));_0xf90bbf[_0x6362('0x31')]=_0xf90bbf[_0x6362('0x31')][_0x6362('0x4a')]?_0xf90bbf[_0x6362('0x31')]:_0x54304a['model'];_0xf90bbf[_0x6362('0x4b')]=qs['sort'](_0x374da4[_0x6362('0x2e')]['sort']);_0xf90bbf['where']=qs[_0x6362('0x38')](_[_0x6362('0x37')](_0x374da4['query'],_0x54304a['filters']));if(_0x374da4[_0x6362('0x2e')][_0x6362('0x3b')]){_0xf90bbf['where']=_[_0x6362('0x39')](_0xf90bbf[_0x6362('0x36')],{'$or':_[_0x6362('0x29')](_0xf90bbf[_0x6362('0x31')],function(_0x3c2d9f){var _0x5c5856={};_0x5c5856[_0x3c2d9f]={'$like':'%'+_0x374da4['query']['filter']+'%'};return _0x5c5856;})});}_0xf90bbf=_[_0x6362('0x39')]({},_0xf90bbf,_0x374da4['options']);return _0x3b0aec['getConfigurations'](_0xf90bbf);}})[_0x6362('0x24')](function(_0x11d77e){if(_0x11d77e){_0x5a8500=_0x11d77e[_0x6362('0x4a')];if(!_0x374da4[_0x6362('0x2e')][_0x6362('0x4c')](_0x6362('0x33'))){_0xf90bbf[_0x6362('0x34')]=qs[_0x6362('0x34')](_0x374da4['query'][_0x6362('0x34')]);_0xf90bbf[_0x6362('0x1b')]=qs[_0x6362('0x1b')](_0x374da4[_0x6362('0x2e')][_0x6362('0x1b')]);}return _0x3b0aec[_0x6362('0x49')](_0xf90bbf);}})[_0x6362('0x24')](function(_0x292464){if(_0x292464){return _0x292464?{'count':_0x5a8500,'rows':_0x292464}:null;}})['then'](respondWithResult(_0x55031b,null))[_0x6362('0x43')](handleError(_0x55031b,null));};exports[_0x6362('0x4d')]=function(_0x5e31b6,_0x446cec,_0x440f37){if(_0x5e31b6[_0x6362('0x45')]['id']){delete _0x5e31b6['body']['id'];}return db[_0x6362('0x3f')][_0x6362('0x4e')]({'where':{'id':_0x5e31b6[_0x6362('0x47')]['id']}})[_0x6362('0x24')](handleEntityNotFound(_0x446cec,null))[_0x6362('0x24')](function(_0x4dd44d){if(_0x4dd44d){_0x5e31b6[_0x6362('0x45')][_0x6362('0x4f')]=_0x4dd44d['id'];_0x5e31b6['body'][_0x6362('0x50')]=integrations['getSubjects'](_0x5e31b6[_0x6362('0x45')][_0x6362('0x51')],_0x5e31b6[_0x6362('0x45')][_0x6362('0x2c')]);_0x5e31b6[_0x6362('0x45')][_0x6362('0x52')]=integrations[_0x6362('0x53')](_0x5e31b6['body'][_0x6362('0x51')],_0x5e31b6[_0x6362('0x45')][_0x6362('0x2c')]);return db['ZohoConfiguration'][_0x6362('0x44')](_0x5e31b6[_0x6362('0x45')],{'include':[{'model':db['ZohoField'],'as':_0x6362('0x50')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})[_0x6362('0x24')](respondWithResult(_0x446cec,null))['catch'](handleError(_0x446cec,null));};function getAccessToken(_0x2005f6){return new Promise(function(_0x1ce892,_0x1733bf){var _0x3e89d1;switch(_0x2005f6[_0x6362('0x54')]){case'US':_0x3e89d1=_0x6362('0x55');break;case'AU':_0x3e89d1=_0x6362('0x56');break;case'EU':_0x3e89d1=_0x6362('0x57');break;case'IN':_0x3e89d1=_0x6362('0x58');break;case'CN':_0x3e89d1=_0x6362('0x59');break;default:_0x3e89d1=_0x6362('0x57');break;}var _0x58d55c={'method':_0x6362('0x5a'),'uri':_0x3e89d1+_0x6362('0x5b'),'qs':{'refresh_token':_0x2005f6[_0x6362('0x5c')],'client_id':_0x2005f6[_0x6362('0x5d')],'client_secret':_0x2005f6[_0x6362('0x5e')],'grant_type':_0x6362('0x5f')},'json':!![]};return rp(_0x58d55c)[_0x6362('0x24')](function(_0x497e12){if(_0x497e12[_0x6362('0x60')]){_0x1ce892(_0x497e12['access_token']);}else{_0x1733bf(_0x6362('0x61'));}})[_0x6362('0x43')](function(_0x3979ef){_0x1733bf(_0x3979ef);});});}exports[_0x6362('0x62')]=function(_0x582dff,_0x4a9e82,_0x1546e8){var _0x5adcca,_0x322b79,_0x51a34f,_0x98d314,_0x599e92;return db['ZohoAccount'][_0x6362('0x4e')]({'where':{'id':_0x582dff['params']['id']},'attributes':['id','host',_0x6362('0x54'),'clientId','clientSecret',_0x6362('0x63'),_0x6362('0x64'),_0x6362('0x5c')]})['then'](handleEntityNotFound(_0x4a9e82,null))['then'](function(_0x34d4b3){_0x599e92=_0x34d4b3;_0x5adcca=_0x599e92[_0x6362('0x65')];_0x322b79=_0x5adcca===_0x6362('0x66')?'eu':_0x6362('0x67');_0x51a34f=_0x599e92[_0x6362('0x63')];var _0x28626d=_0x51a34f[_0x6362('0x68')](-0x1);if(_0x28626d==='/'||_0x28626d==='\x5c'||_0x28626d===':'){_0x51a34f=_0x51a34f[_0x6362('0x69')](0x0,_0x51a34f[_0x6362('0x6a')](_0x28626d));}if(!_0x599e92[_0x6362('0x5c')]){throw new Error(_0x6362('0x6b'));}return getAccessToken(_0x599e92);})['then'](function(_0x266a6a){if(_0x266a6a){return rp({'method':'GET','uri':util[_0x6362('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x322b79),'qs':{'module':_0x6362('0x6d')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x266a6a},'json':!![]});}})[_0x6362('0x24')](function(_0x48c77a){if(_0x48c77a){if(_0x48c77a[_0x6362('0x6e')]&&_0x48c77a[_0x6362('0x6e')]['error']){throw new Error(_0x48c77a[_0x6362('0x6e')][_0x6362('0x25')]['message']);}var _0x31b17f=[];var _0x18c180=[];var _0x37cf4f=[_0x6362('0x6f'),'Subject','Description',_0x6362('0x70'),'Call_Duration',_0x6362('0x71'),_0x6362('0x72'),_0x6362('0x73')];_0x18c180=_['remove'](_0x48c77a[_0x6362('0x32')],function(_0xab49ba){return _0x37cf4f[_0x6362('0x74')](_0xab49ba['api_name']);});for(var _0x50acf0=0x0;_0x50acf0<_0x18c180[_0x6362('0x4a')];_0x50acf0++){if(_0x18c180[_0x50acf0]['system_mandatory']===![]){_0x31b17f[_0x6362('0x75')]({'id':_0x18c180[_0x50acf0]['id'],'name':_0x18c180[_0x50acf0][_0x6362('0x76')],'custom':_0x18c180[_0x50acf0]['custom_field'],'options':_0x18c180[_0x50acf0][_0x6362('0x77')]==='picklist'&&_0x18c180[_0x50acf0]['pick_list_values'][_0x6362('0x4a')]>-0x1?_[_0x6362('0x29')](_0x18c180[_0x50acf0]['pick_list_values'],function(_0x40abff){return{'name':_0x40abff,'value':_0x40abff};}):[]});}}return{'count':_0x31b17f[_0x6362('0x4a')],'rows':_0x31b17f};}else{return{'count':0x0,'rows':[]};}})[_0x6362('0x24')](respondWithResult(_0x4a9e82,null))['catch'](function(_0xa314c6){var _0x388b95=_0x582dff['query'][_0x6362('0x78')]?0x1f4:_0xa314c6[_0x6362('0x79')]||0x1f4;logger[_0x6362('0x25')](_0x6362('0x7a'),_0x6362('0x62'),_0x388b95,JSON[_0x6362('0x7b')](_0xa314c6));delete _0xa314c6['name'];if(_0x388b95===0x191){_0x388b95=0x190;}_0x4a9e82[_0x6362('0x1e')](_0x388b95)[_0x6362('0x28')](_0x582dff['query']['test']?{'message':_0x6362('0x7c'),'statusCode':_0xa314c6[_0x6362('0x79')]}:_0xa314c6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index b961164..531698a 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 _0x6b1b=['serverUrl','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','authorization_code','clientId','application/x-www-form-urlencoded','parse','refresh_token','refreshToken','info','name','error','format','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','host','https://accounts.zoho.eu','POST','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','catch','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','zone','changed','clientSecret','code'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0x6b1b,0x1e7));var _0xb6b1=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x6b1b[_0x34bf97];return _0x292719;};'use strict';var _=require('lodash');var util=require(_0xb6b1('0x0'));var logger=require(_0xb6b1('0x1'))(_0xb6b1('0x2'));var moment=require('moment');var BPromise=require(_0xb6b1('0x3'));var rp=require(_0xb6b1('0x4'));var fs=require('fs');var path=require(_0xb6b1('0x5'));var rimraf=require(_0xb6b1('0x6'));var config=require(_0xb6b1('0x7'));var attributes=require(_0xb6b1('0x8'));var integrations=require(_0xb6b1('0x9'));module[_0xb6b1('0xa')]=function(_0x1ff716,_0x13334e){return _0x1ff716[_0xb6b1('0xb')]('ZohoAccount',attributes,{'tableName':_0xb6b1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52aa76,_0x4da7d3,_0x463b1d){if(_0x52aa76['changed'](_0xb6b1('0xd'))||_0x52aa76['changed']('serverUrl')||_0x52aa76['changed']('clientId')||_0x52aa76[_0xb6b1('0xe')](_0xb6b1('0xf'))||_0x52aa76['changed'](_0xb6b1('0x10'))||_0x52aa76['changed']('host')){var _0x406dce,_0x2e5256;_0x406dce=_0x52aa76[_0xb6b1('0x11')];var _0x327eee=_0x406dce[_0xb6b1('0x12')](-0x1);if(_0x327eee==='/'||_0x327eee==='\x5c'||_0x327eee===':'){_0x406dce=_0x406dce[_0xb6b1('0x13')](0x0,_0x406dce[_0xb6b1('0x14')](_0x327eee));}switch(_0x52aa76[_0xb6b1('0xd')]){case'US':_0x2e5256=_0xb6b1('0x15');break;case'AU':_0x2e5256=_0xb6b1('0x16');break;case'IN':_0x2e5256=_0xb6b1('0x17');break;case'CN':_0x2e5256=_0xb6b1('0x18');break;default:_0x2e5256='https://accounts.zoho.eu';break;}var _0x57572a={'method':'POST','uri':_0x2e5256+'/oauth/v2/token','form':{'grant_type':_0xb6b1('0x19'),'client_id':_0x52aa76[_0xb6b1('0x1a')],'client_secret':_0x52aa76[_0xb6b1('0xf')],'redirect_uri':_0x52aa76[_0xb6b1('0x11')],'code':_0x52aa76[_0xb6b1('0x10')]},'headers':{'Content-Type':_0xb6b1('0x1b')}};return rp(_0x57572a)['then'](function(_0x581e28){var _0x1bdf63=JSON[_0xb6b1('0x1c')](_0x581e28);if(_0x1bdf63[_0xb6b1('0x1d')]){_0x52aa76[_0xb6b1('0x1e')]=_0x1bdf63[_0xb6b1('0x1d')];logger[_0xb6b1('0x1f')](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52aa76[_0xb6b1('0x20')],_0x52aa76['id']));}else{logger[_0xb6b1('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52aa76[_0xb6b1('0x20')],_0x52aa76['id']),util['inspect'](_0x1bdf63,{'showHidden':![],'depth':null}));}return _0x463b1d(null,_0x4da7d3);})['catch'](function(_0x232157){logger[_0xb6b1('0x21')](util[_0xb6b1('0x22')](_0xb6b1('0x23'),_0x52aa76[_0xb6b1('0x20')],_0x52aa76['id']),util[_0xb6b1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x463b1d(_0x232157);});}else{return _0x463b1d(null,_0x4da7d3);}},'beforeUpdate':function(_0x1eb1b2,_0x3b1ff7,_0x472585){if(_0x1eb1b2[_0xb6b1('0xe')]('zone')||_0x1eb1b2[_0xb6b1('0xe')]('serverUrl')||_0x1eb1b2[_0xb6b1('0xe')]('clientId')||_0x1eb1b2[_0xb6b1('0xe')]('clientSecret')||_0x1eb1b2[_0xb6b1('0xe')](_0xb6b1('0x10'))||_0x1eb1b2[_0xb6b1('0xe')](_0xb6b1('0x25'))){var _0x13e841,_0x188627;_0x13e841=_0x1eb1b2[_0xb6b1('0x11')];var _0xd3c6da=_0x13e841[_0xb6b1('0x12')](-0x1);if(_0xd3c6da==='/'||_0xd3c6da==='\x5c'||_0xd3c6da===':'){_0x13e841=_0x13e841['substring'](0x0,_0x13e841[_0xb6b1('0x14')](_0xd3c6da));}switch(_0x1eb1b2['zone']){case'US':_0x188627=_0xb6b1('0x15');break;case'AU':_0x188627=_0xb6b1('0x16');break;case'IN':_0x188627=_0xb6b1('0x17');break;case'CN':_0x188627=_0xb6b1('0x18');break;default:_0x188627=_0xb6b1('0x26');break;}var _0x12f369={'method':_0xb6b1('0x27'),'uri':_0x188627+'/oauth/v2/token','form':{'grant_type':_0xb6b1('0x19'),'client_id':_0x1eb1b2[_0xb6b1('0x1a')],'client_secret':_0x1eb1b2[_0xb6b1('0xf')],'redirect_uri':_0x1eb1b2['serverUrl'],'code':_0x1eb1b2[_0xb6b1('0x10')]},'headers':{'Content-Type':_0xb6b1('0x1b')}};return rp(_0x12f369)['then'](function(_0x3efb1d){var _0x3e3642=JSON[_0xb6b1('0x1c')](_0x3efb1d);if(_0x3e3642[_0xb6b1('0x1d')]){_0x1eb1b2[_0xb6b1('0x1e')]=_0x3e3642[_0xb6b1('0x1d')];logger['info'](util[_0xb6b1('0x22')](_0xb6b1('0x28'),_0x1eb1b2['name'],_0x1eb1b2['id']));}else{logger[_0xb6b1('0x21')](util['format'](_0xb6b1('0x23'),_0x1eb1b2[_0xb6b1('0x20')],_0x1eb1b2['id']),util[_0xb6b1('0x24')](_0x3e3642,{'showHidden':![],'depth':null}));}return _0x472585(null,_0x3b1ff7);})[_0xb6b1('0x29')](function(_0x127481){logger[_0xb6b1('0x21')](util['format'](_0xb6b1('0x23'),_0x1eb1b2[_0xb6b1('0x20')],_0x1eb1b2['id']),util[_0xb6b1('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x472585(_0x127481);});}else{return _0x472585(null,_0x3b1ff7);}}}});}; \ No newline at end of file +var _0xa4d5=['info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','slice','lastIndexOf','POST','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','lodash','util','../../config/logger','api','moment','bluebird','request-promise','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','substring','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','authorization_code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token'];(function(_0x55d3b9,_0x140bc6){var _0x1dbb28=function(_0x24fed6){while(--_0x24fed6){_0x55d3b9['push'](_0x55d3b9['shift']());}};_0x1dbb28(++_0x140bc6);}(_0xa4d5,0xd8));var _0x5a4d=function(_0x2b8fbd,_0x49624a){_0x2b8fbd=_0x2b8fbd-0x0;var _0x6f2b8d=_0xa4d5[_0x2b8fbd];return _0x6f2b8d;};'use strict';var _=require(_0x5a4d('0x0'));var util=require(_0x5a4d('0x1'));var logger=require(_0x5a4d('0x2'))(_0x5a4d('0x3'));var moment=require(_0x5a4d('0x4'));var BPromise=require(_0x5a4d('0x5'));var rp=require(_0x5a4d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x5a4d('0x7')]=function(_0x1a6235,_0x47822f){return _0x1a6235[_0x5a4d('0x8')]('ZohoAccount',attributes,{'tableName':_0x5a4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x567596,_0x4d4997,_0x1cd007){if(_0x567596[_0x5a4d('0xa')](_0x5a4d('0xb'))||_0x567596[_0x5a4d('0xa')](_0x5a4d('0xc'))||_0x567596[_0x5a4d('0xa')](_0x5a4d('0xd'))||_0x567596['changed'](_0x5a4d('0xe'))||_0x567596[_0x5a4d('0xa')](_0x5a4d('0xf'))||_0x567596[_0x5a4d('0xa')](_0x5a4d('0x10'))){var _0x1099c8,_0x1622ac;_0x1099c8=_0x567596[_0x5a4d('0xc')];var _0x4d469e=_0x1099c8['slice'](-0x1);if(_0x4d469e==='/'||_0x4d469e==='\x5c'||_0x4d469e===':'){_0x1099c8=_0x1099c8[_0x5a4d('0x11')](0x0,_0x1099c8['lastIndexOf'](_0x4d469e));}switch(_0x567596[_0x5a4d('0xb')]){case'US':_0x1622ac=_0x5a4d('0x12');break;case'AU':_0x1622ac=_0x5a4d('0x13');break;case'IN':_0x1622ac=_0x5a4d('0x14');break;case'CN':_0x1622ac=_0x5a4d('0x15');break;default:_0x1622ac=_0x5a4d('0x16');break;}var _0x322e12={'method':'POST','uri':_0x1622ac+_0x5a4d('0x17'),'form':{'grant_type':_0x5a4d('0x18'),'client_id':_0x567596['clientId'],'client_secret':_0x567596[_0x5a4d('0xe')],'redirect_uri':_0x567596['serverUrl'],'code':_0x567596['code']},'headers':{'Content-Type':_0x5a4d('0x19')}};return rp(_0x322e12)[_0x5a4d('0x1a')](function(_0x2cc859){var _0x528217=JSON[_0x5a4d('0x1b')](_0x2cc859);if(_0x528217['refresh_token']){_0x567596[_0x5a4d('0x1c')]=_0x528217[_0x5a4d('0x1d')];logger[_0x5a4d('0x1e')](util[_0x5a4d('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x567596[_0x5a4d('0x20')],_0x567596['id']));}else{logger[_0x5a4d('0x21')](util[_0x5a4d('0x1f')](_0x5a4d('0x22'),_0x567596['name'],_0x567596['id']),util['inspect'](_0x528217,{'showHidden':![],'depth':null}));}return _0x1cd007(null,_0x4d4997);})[_0x5a4d('0x23')](function(_0x553868){logger[_0x5a4d('0x21')](util[_0x5a4d('0x1f')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x567596['name'],_0x567596['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1cd007(_0x553868);});}else{return _0x1cd007(null,_0x4d4997);}},'beforeUpdate':function(_0x51cdf9,_0x360705,_0x571341){if(_0x51cdf9['changed'](_0x5a4d('0xb'))||_0x51cdf9['changed']('serverUrl')||_0x51cdf9[_0x5a4d('0xa')]('clientId')||_0x51cdf9[_0x5a4d('0xa')]('clientSecret')||_0x51cdf9[_0x5a4d('0xa')](_0x5a4d('0xf'))||_0x51cdf9[_0x5a4d('0xa')](_0x5a4d('0x10'))){var _0x4222be,_0x4736c3;_0x4222be=_0x51cdf9[_0x5a4d('0xc')];var _0x12fa70=_0x4222be[_0x5a4d('0x24')](-0x1);if(_0x12fa70==='/'||_0x12fa70==='\x5c'||_0x12fa70===':'){_0x4222be=_0x4222be[_0x5a4d('0x11')](0x0,_0x4222be[_0x5a4d('0x25')](_0x12fa70));}switch(_0x51cdf9[_0x5a4d('0xb')]){case'US':_0x4736c3=_0x5a4d('0x12');break;case'AU':_0x4736c3=_0x5a4d('0x13');break;case'IN':_0x4736c3='https://accounts.zoho.in';break;case'CN':_0x4736c3=_0x5a4d('0x15');break;default:_0x4736c3=_0x5a4d('0x16');break;}var _0x4241e3={'method':_0x5a4d('0x26'),'uri':_0x4736c3+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x51cdf9['clientId'],'client_secret':_0x51cdf9[_0x5a4d('0xe')],'redirect_uri':_0x51cdf9[_0x5a4d('0xc')],'code':_0x51cdf9['code']},'headers':{'Content-Type':_0x5a4d('0x19')}};return rp(_0x4241e3)[_0x5a4d('0x1a')](function(_0x2c19f9){var _0x492ced=JSON[_0x5a4d('0x1b')](_0x2c19f9);if(_0x492ced[_0x5a4d('0x1d')]){_0x51cdf9[_0x5a4d('0x1c')]=_0x492ced[_0x5a4d('0x1d')];logger['info'](util[_0x5a4d('0x1f')](_0x5a4d('0x27'),_0x51cdf9[_0x5a4d('0x20')],_0x51cdf9['id']));}else{logger['error'](util[_0x5a4d('0x1f')](_0x5a4d('0x22'),_0x51cdf9[_0x5a4d('0x20')],_0x51cdf9['id']),util[_0x5a4d('0x28')](_0x492ced,{'showHidden':![],'depth':null}));}return _0x571341(null,_0x360705);})[_0x5a4d('0x23')](function(_0x43613f){logger[_0x5a4d('0x21')](util[_0x5a4d('0x1f')](_0x5a4d('0x22'),_0x51cdf9[_0x5a4d('0x20')],_0x51cdf9['id']),util[_0x5a4d('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x571341(_0x43613f);});}else{return _0x571341(null,_0x360705);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index f839284..1dc3843 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 _0xab95=['jayson/promise','client','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','map','include','model','then','stringify','ShowZohoAccount','find','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xab95,0x1d5));var _0x5ab9=function(_0xf2d050,_0x2b714d){_0xf2d050=_0xf2d050-0x0;var _0x3a8795=_0xab95[_0xf2d050];return _0x3a8795;};'use strict';var _=require(_0x5ab9('0x0'));var util=require(_0x5ab9('0x1'));var moment=require(_0x5ab9('0x2'));var BPromise=require('bluebird');var rs=require(_0x5ab9('0x3'));var fs=require('fs');var Redis=require(_0x5ab9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5ab9('0x5'))(_0x5ab9('0x6'));var config=require('../../config/environment');var jayson=require(_0x5ab9('0x7'));var client=jayson[_0x5ab9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d1ddd,_0x2c4545,_0x49ab04){return new BPromise(function(_0x2fa286,_0x44bd27){return client[_0x5ab9('0x9')](_0x5d1ddd,_0x49ab04)['then'](function(_0x54ea1c){logger[_0x5ab9('0xa')](_0x5ab9('0xb'),_0x2c4545,_0x5ab9('0xc'));logger[_0x5ab9('0xd')](_0x5ab9('0xe'),_0x2c4545,'request\x20sent',JSON['stringify'](_0x54ea1c));if(_0x54ea1c[_0x5ab9('0xf')]){if(_0x54ea1c[_0x5ab9('0xf')]['code']===0x1f4){logger[_0x5ab9('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2c4545,_0x54ea1c[_0x5ab9('0xf')][_0x5ab9('0x10')]);return _0x44bd27(_0x54ea1c[_0x5ab9('0xf')][_0x5ab9('0x10')]);}logger[_0x5ab9('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x2c4545,_0x54ea1c[_0x5ab9('0xf')][_0x5ab9('0x10')]);return _0x2fa286(_0x54ea1c[_0x5ab9('0xf')]['message']);}else{logger[_0x5ab9('0xa')]('ZohoAccount,\x20%s,\x20%s',_0x2c4545,'request\x20sent');_0x2fa286(_0x54ea1c[_0x5ab9('0x11')][_0x5ab9('0x10')]);}})[_0x5ab9('0x12')](function(_0x3eda14){logger[_0x5ab9('0xf')](_0x5ab9('0xb'),_0x2c4545,_0x3eda14);_0x44bd27(_0x3eda14);});});}exports[_0x5ab9('0x13')]=function(_0x49970d){var _0x123145=this;return new Promise(function(_0x274383,_0x5865ea){return db[_0x5ab9('0x14')][_0x5ab9('0x15')]({'raw':_0x49970d['options']?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x17')]===undefined?!![]:![]:!![],'where':_0x49970d[_0x5ab9('0x16')]?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x18')]||null:null,'attributes':_0x49970d[_0x5ab9('0x16')]?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x19')]||null:null,'limit':_0x49970d[_0x5ab9('0x16')]?_0x49970d[_0x5ab9('0x16')][_0x5ab9('0x1a')]||null:null,'include':_0x49970d[_0x5ab9('0x16')]?_0x49970d['options']['include']?_[_0x5ab9('0x1b')](_0x49970d['options'][_0x5ab9('0x1c')],function(_0xdecd3d){return{'model':db[_0xdecd3d[_0x5ab9('0x1d')]],'as':_0xdecd3d['as'],'attributes':_0xdecd3d[_0x5ab9('0x19')],'include':_0xdecd3d[_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0xdecd3d[_0x5ab9('0x1c')],function(_0x170f2d){return{'model':db[_0x170f2d[_0x5ab9('0x1d')]],'as':_0x170f2d['as'],'attributes':_0x170f2d[_0x5ab9('0x19')],'include':_0x170f2d['include']?_['map'](_0x170f2d[_0x5ab9('0x1c')],function(_0x120c92){return{'model':db[_0x120c92[_0x5ab9('0x1d')]],'as':_0x120c92['as'],'attributes':_0x120c92[_0x5ab9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5ab9('0x1e')](function(_0x3a293f){logger['info'](_0x5ab9('0x13'),_0x49970d);logger[_0x5ab9('0xd')](_0x5ab9('0x13'),_0x49970d,JSON[_0x5ab9('0x1f')](_0x3a293f));_0x274383(_0x3a293f);})[_0x5ab9('0x12')](function(_0x4fccdf){logger[_0x5ab9('0xf')](_0x5ab9('0x13'),_0x4fccdf[_0x5ab9('0x10')],_0x49970d);_0x5865ea(_0x123145[_0x5ab9('0xf')](0x1f4,_0x4fccdf[_0x5ab9('0x10')]));});});};exports[_0x5ab9('0x20')]=function(_0x3da00d){var _0x5da406=this;return new Promise(function(_0x5528b3,_0x2f02e1){return db[_0x5ab9('0x14')][_0x5ab9('0x21')]({'raw':_0x3da00d[_0x5ab9('0x16')]?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x17')]===undefined?!![]:![]:!![],'where':_0x3da00d[_0x5ab9('0x16')]?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x18')]||null:null,'attributes':_0x3da00d['options']?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x19')]||null:null,'include':_0x3da00d[_0x5ab9('0x16')]?_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0x3da00d[_0x5ab9('0x16')][_0x5ab9('0x1c')],function(_0x490d2f){return{'model':db[_0x490d2f[_0x5ab9('0x1d')]],'as':_0x490d2f['as'],'attributes':_0x490d2f[_0x5ab9('0x19')],'include':_0x490d2f[_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0x490d2f[_0x5ab9('0x1c')],function(_0x51808){return{'model':db[_0x51808[_0x5ab9('0x1d')]],'as':_0x51808['as'],'attributes':_0x51808[_0x5ab9('0x19')],'include':_0x51808[_0x5ab9('0x1c')]?_[_0x5ab9('0x1b')](_0x51808[_0x5ab9('0x1c')],function(_0x501c26){return{'model':db[_0x501c26[_0x5ab9('0x1d')]],'as':_0x501c26['as'],'attributes':_0x501c26[_0x5ab9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x5ab9('0x1e')](function(_0x51b892){logger[_0x5ab9('0xa')](_0x5ab9('0x20'),_0x3da00d);logger[_0x5ab9('0xd')](_0x5ab9('0x20'),_0x3da00d,JSON[_0x5ab9('0x1f')](_0x51b892));_0x5528b3(_0x51b892);})[_0x5ab9('0x12')](function(_0x89a0){logger[_0x5ab9('0xf')]('ShowZohoAccount',_0x89a0[_0x5ab9('0x10')],_0x3da00d);_0x2f02e1(_0x5da406[_0x5ab9('0xf')](0x1f4,_0x89a0[_0x5ab9('0x10')]));});});}; \ No newline at end of file +var _0x8b0e=['attributes','include','map','model','stringify','ShowZohoAccount','ZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZohoAccount','options','raw','where'];(function(_0xbf36a8,_0x2c73cc){var _0x25f718=function(_0x2d80a3){while(--_0x2d80a3){_0xbf36a8['push'](_0xbf36a8['shift']());}};_0x25f718(++_0x2c73cc);}(_0x8b0e,0x166));var _0xe8b0=function(_0x3d7811,_0x59daeb){_0x3d7811=_0x3d7811-0x0;var _0x927cfa=_0x8b0e[_0x3d7811];return _0x927cfa;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});}exports[_0xe8b0('0x17')]=function(_0x1345b3){var _0x27da42=this;return new Promise(function(_0x34f3b2,_0x17af0c){return db['ZohoAccount']['findAll']({'raw':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x19')]===undefined?!![]:![]:!![],'where':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x1a')]||null:null,'attributes':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x1b')]||null:null,'limit':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')]['limit']||null:null,'include':_0x1345b3[_0xe8b0('0x18')]?_0x1345b3[_0xe8b0('0x18')][_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x1345b3['options'][_0xe8b0('0x1c')],function(_0x292f81){return{'model':db[_0x292f81['model']],'as':_0x292f81['as'],'attributes':_0x292f81[_0xe8b0('0x1b')],'include':_0x292f81[_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x292f81[_0xe8b0('0x1c')],function(_0x58c536){return{'model':db[_0x58c536[_0xe8b0('0x1e')]],'as':_0x58c536['as'],'attributes':_0x58c536[_0xe8b0('0x1b')],'include':_0x58c536[_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x58c536[_0xe8b0('0x1c')],function(_0x2ba170){return{'model':db[_0x2ba170[_0xe8b0('0x1e')]],'as':_0x2ba170['as'],'attributes':_0x2ba170[_0xe8b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8b0('0xd')](function(_0x168430){logger[_0xe8b0('0xe')]('GetZohoAccount',_0x1345b3);logger['debug'](_0xe8b0('0x17'),_0x1345b3,JSON[_0xe8b0('0x1f')](_0x168430));_0x34f3b2(_0x168430);})[_0xe8b0('0x16')](function(_0x3d80d7){logger[_0xe8b0('0x13')]('GetZohoAccount',_0x3d80d7[_0xe8b0('0x15')],_0x1345b3);_0x17af0c(_0x27da42['error'](0x1f4,_0x3d80d7[_0xe8b0('0x15')]));});});};exports[_0xe8b0('0x20')]=function(_0x3bee1b){var _0x180f65=this;return new Promise(function(_0x573275,_0x3b0c2d){return db[_0xe8b0('0x21')][_0xe8b0('0x22')]({'raw':_0x3bee1b[_0xe8b0('0x18')]?_0x3bee1b[_0xe8b0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x3bee1b[_0xe8b0('0x18')]?_0x3bee1b['options'][_0xe8b0('0x1a')]||null:null,'attributes':_0x3bee1b[_0xe8b0('0x18')]?_0x3bee1b[_0xe8b0('0x18')][_0xe8b0('0x1b')]||null:null,'include':_0x3bee1b['options']?_0x3bee1b[_0xe8b0('0x18')][_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x3bee1b[_0xe8b0('0x18')][_0xe8b0('0x1c')],function(_0x42dc7e){return{'model':db[_0x42dc7e[_0xe8b0('0x1e')]],'as':_0x42dc7e['as'],'attributes':_0x42dc7e[_0xe8b0('0x1b')],'include':_0x42dc7e[_0xe8b0('0x1c')]?_[_0xe8b0('0x1d')](_0x42dc7e[_0xe8b0('0x1c')],function(_0xd6da13){return{'model':db[_0xd6da13[_0xe8b0('0x1e')]],'as':_0xd6da13['as'],'attributes':_0xd6da13[_0xe8b0('0x1b')],'include':_0xd6da13[_0xe8b0('0x1c')]?_['map'](_0xd6da13[_0xe8b0('0x1c')],function(_0x2b3c7c){return{'model':db[_0x2b3c7c['model']],'as':_0x2b3c7c['as'],'attributes':_0x2b3c7c[_0xe8b0('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe8b0('0xd')](function(_0x17b733){logger[_0xe8b0('0xe')]('ShowZohoAccount',_0x3bee1b);logger['debug'](_0xe8b0('0x20'),_0x3bee1b,JSON['stringify'](_0x17b733));_0x573275(_0x17b733);})[_0xe8b0('0x16')](function(_0x296510){logger['error'](_0xe8b0('0x20'),_0x296510[_0xe8b0('0x15')],_0x3bee1b);_0x3b0c2d(_0x180f65['error'](0x1f4,_0x296510['message']));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 36ecc49..56fe9ea 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 _0x159e=['update','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','create','put','/:id'];(function(_0x161583,_0x14f575){var _0x23b2bc=function(_0x50bcda){while(--_0x50bcda){_0x161583['push'](_0x161583['shift']());}};_0x23b2bc(++_0x14f575);}(_0x159e,0x138));var _0xe159=function(_0x1ff215,_0x906e09){_0x1ff215=_0x1ff215-0x0;var _0x32a6a4=_0x159e[_0x1ff215];return _0x32a6a4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe159('0x0'));var timeout=require(_0xe159('0x1'));var express=require(_0xe159('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe159('0x3'));var config=require(_0xe159('0x4'));var controller=require(_0xe159('0x5'));router[_0xe159('0x6')]('/',auth[_0xe159('0x7')](),controller[_0xe159('0x8')]);router[_0xe159('0x6')]('/:id',auth[_0xe159('0x7')](),controller[_0xe159('0x9')]);router[_0xe159('0x6')](_0xe159('0xa'),auth[_0xe159('0x7')](),controller[_0xe159('0xb')]);router[_0xe159('0x6')](_0xe159('0xc'),auth['isAuthenticated'](),controller[_0xe159('0xd')]);router[_0xe159('0x6')](_0xe159('0xe'),auth[_0xe159('0x7')](),controller['getDescriptions']);router['post']('/',auth[_0xe159('0x7')](),controller[_0xe159('0xf')]);router[_0xe159('0x10')](_0xe159('0x11'),auth['isAuthenticated'](),controller[_0xe159('0x12')]);router[_0xe159('0x13')]('/:id',auth[_0xe159('0x7')](),controller[_0xe159('0x14')]);module[_0xe159('0x15')]=router; \ No newline at end of file +var _0xff05=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xff05,0x1a6));var _0x5ff0=function(_0x34e3e4,_0x55b5b1){_0x34e3e4=_0x34e3e4-0x0;var _0x408086=_0xff05[_0x34e3e4];return _0x408086;};'use strict';var multer=require(_0x5ff0('0x0'));var util=require(_0x5ff0('0x1'));var path=require(_0x5ff0('0x2'));var timeout=require(_0x5ff0('0x3'));var express=require(_0x5ff0('0x4'));var router=express[_0x5ff0('0x5')]();var fs_extra=require(_0x5ff0('0x6'));var auth=require(_0x5ff0('0x7'));var interaction=require(_0x5ff0('0x8'));var config=require('../../config/environment');var controller=require(_0x5ff0('0x9'));router['get']('/',auth[_0x5ff0('0xa')](),controller[_0x5ff0('0xb')]);router[_0x5ff0('0xc')](_0x5ff0('0xd'),auth['isAuthenticated'](),controller[_0x5ff0('0xe')]);router[_0x5ff0('0xc')](_0x5ff0('0xf'),auth['isAuthenticated'](),controller[_0x5ff0('0x10')]);router[_0x5ff0('0xc')](_0x5ff0('0x11'),auth[_0x5ff0('0xa')](),controller[_0x5ff0('0x12')]);router[_0x5ff0('0xc')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5ff0('0x13')]);router['post']('/',auth[_0x5ff0('0xa')](),controller[_0x5ff0('0x14')]);router[_0x5ff0('0x15')]('/:id',auth[_0x5ff0('0xa')](),controller[_0x5ff0('0x16')]);router[_0x5ff0('0x17')](_0x5ff0('0xd'),auth[_0x5ff0('0xa')](),controller[_0x5ff0('0x18')]);module[_0x5ff0('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index f7eadd3..7da8423 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 _0xac0a=['contact','nothing','lead','contact_lead','STRING','ENUM'];(function(_0x2a625f,_0x30f4d2){var _0xafe0e2=function(_0x14c283){while(--_0x14c283){_0x2a625f['push'](_0x2a625f['shift']());}};_0xafe0e2(++_0x30f4d2);}(_0xac0a,0x11e));var _0xaac0=function(_0x11f1fd,_0xce95a8){_0x11f1fd=_0x11f1fd-0x0;var _0x2d1215=_0xac0a[_0x11f1fd];return _0x2d1215;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaac0('0x0')]},'moduleCreate':{'type':Sequelize[_0xaac0('0x1')]('lead',_0xaac0('0x2'),_0xaac0('0x3')),'defaultValue':_0xaac0('0x4')},'moduleSearch':{'type':Sequelize[_0xaac0('0x1')](_0xaac0('0x5'),_0xaac0('0x2'),_0xaac0('0x4')),'defaultValue':_0xaac0('0x5')},'description':{'type':Sequelize[_0xaac0('0x0')]}}; \ No newline at end of file +var _0x8c04=['exports','STRING','ENUM','nothing','contact_lead','contact','lead','sequelize'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x8c04,0x1a7));var _0x48c0=function(_0x22e003,_0x544b4e){_0x22e003=_0x22e003-0x0;var _0x58178e=_0x8c04[_0x22e003];return _0x58178e;};'use strict';var Sequelize=require(_0x48c0('0x0'));module[_0x48c0('0x1')]={'name':{'type':Sequelize[_0x48c0('0x2')]},'moduleCreate':{'type':Sequelize[_0x48c0('0x3')]('lead','contact',_0x48c0('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x48c0('0x3')](_0x48c0('0x5'),_0x48c0('0x6'),_0x48c0('0x7')),'defaultValue':_0x48c0('0x5')},'description':{'type':Sequelize[_0x48c0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 66f3595..e1c1b44 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 _0xab32=['length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','update','find','order','options','getFields','getSubjects','findOne','ZohoField','getDescriptions','rimraf','zip-dir','request-promise','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','map','ZohoConfiguration','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields'];(function(_0x73cf84,_0x57f9c4){var _0x5d9fa0=function(_0x19c302){while(--_0x19c302){_0x73cf84['push'](_0x73cf84['shift']());}};_0x5d9fa0(++_0x57f9c4);}(_0xab32,0xbb));var _0x2ab3=function(_0x337748,_0x402b05){_0x337748=_0x337748-0x0;var _0x3bb03f=_0xab32[_0x337748];return _0x3bb03f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2ab3('0x0'));var zipdir=require(_0x2ab3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2ab3('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2ab3('0x3'));var util=require('util');var path=require(_0x2ab3('0x4'));var sox=require(_0x2ab3('0x5'));var csv=require('to-csv');var ejs=require(_0x2ab3('0x6'));var fs=require('fs');var fs_extra=require(_0x2ab3('0x7'));var _=require(_0x2ab3('0x8'));var squel=require('squel');var crypto=require(_0x2ab3('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x2ab3('0xa'));var toCsv=require(_0x2ab3('0xb'));var querystring=require(_0x2ab3('0xc'));var Papa=require(_0x2ab3('0xd'));var Redis=require('ioredis');var authService=require(_0x2ab3('0xe'));var qs=require(_0x2ab3('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ab3('0x10'));var logger=require(_0x2ab3('0x11'))(_0x2ab3('0x12'));var utils=require(_0x2ab3('0x13'));var config=require(_0x2ab3('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2ab3('0x15'))['db'];function respondWithStatusCode(_0x455085,_0x5b4027){_0x5b4027=_0x5b4027||0xcc;return function(_0x4346d3){if(_0x4346d3){return _0x455085[_0x2ab3('0x16')](_0x5b4027);}return _0x455085[_0x2ab3('0x17')](_0x5b4027)['end']();};}function respondWithResult(_0x160c3d,_0x39af03){_0x39af03=_0x39af03||0xc8;return function(_0x11c6ee){if(_0x11c6ee){return _0x160c3d[_0x2ab3('0x17')](_0x39af03)[_0x2ab3('0x18')](_0x11c6ee);}};}function respondWithFilteredResult(_0x3372a2,_0x42971e){return function(_0x589f03){if(_0x589f03){var _0x5562c1=typeof _0x42971e['offset']===_0x2ab3('0x19')&&typeof _0x42971e['limit']===_0x2ab3('0x19');var _0x1eaaf6=_0x589f03['count'];var _0x5926f2=_0x5562c1?0x0:_0x42971e[_0x2ab3('0x1a')];var _0x273c15=_0x5562c1?_0x589f03[_0x2ab3('0x1b')]:_0x42971e[_0x2ab3('0x1a')]+_0x42971e[_0x2ab3('0x1c')];var _0x4fb0f8;if(_0x273c15>=_0x1eaaf6){_0x273c15=_0x1eaaf6;_0x4fb0f8=0xc8;}else{_0x4fb0f8=0xce;}_0x3372a2[_0x2ab3('0x17')](_0x4fb0f8);return _0x3372a2[_0x2ab3('0x1d')](_0x2ab3('0x1e'),_0x5926f2+'-'+_0x273c15+'/'+_0x1eaaf6)[_0x2ab3('0x18')](_0x589f03);}return null;};}function patchUpdates(_0x35ff93){return function(_0x1f7794){try{jsonpatch[_0x2ab3('0x1f')](_0x1f7794,_0x35ff93,!![]);}catch(_0x31aea9){return BPromise['reject'](_0x31aea9);}return _0x1f7794[_0x2ab3('0x20')]();};}function saveUpdates(_0x406441,_0x5b594c){return function(_0xbcebba){if(_0xbcebba){return _0xbcebba['update'](_0x406441)[_0x2ab3('0x21')](function(_0x38126b){return _0x38126b;});}return null;};}function removeEntity(_0x14fe94,_0x450105){return function(_0x3501e1){if(_0x3501e1){return _0x3501e1[_0x2ab3('0x22')]()[_0x2ab3('0x21')](function(){_0x14fe94[_0x2ab3('0x17')](0xcc)[_0x2ab3('0x23')]();});}};}function handleEntityNotFound(_0x1a61ea,_0x1418a6){return function(_0x504445){if(!_0x504445){_0x1a61ea[_0x2ab3('0x16')](0x194);}return _0x504445;};}function handleError(_0x424b36,_0x3bdb71){_0x3bdb71=_0x3bdb71||0x1f4;return function(_0xaa1634){logger[_0x2ab3('0x24')](_0xaa1634[_0x2ab3('0x25')]);if(_0xaa1634[_0x2ab3('0x26')]){delete _0xaa1634[_0x2ab3('0x26')];}_0x424b36[_0x2ab3('0x17')](_0x3bdb71)[_0x2ab3('0x27')](_0xaa1634);};}exports[_0x2ab3('0x28')]=function(_0x5d5118,_0x31a58a){var _0x5cd5a1={},_0x97580c={},_0x128b02={'count':0x0,'rows':[]};var _0x7d3746=_[_0x2ab3('0x29')](db[_0x2ab3('0x2a')]['rawAttributes'],function(_0x2d78d7){return{'name':_0x2d78d7[_0x2ab3('0x2b')],'type':_0x2d78d7[_0x2ab3('0x2c')][_0x2ab3('0x2d')]};});_0x97580c['model']=_[_0x2ab3('0x29')](_0x7d3746,_0x2ab3('0x26'));_0x97580c[_0x2ab3('0x2e')]=_[_0x2ab3('0x2f')](_0x5d5118[_0x2ab3('0x2e')]);_0x97580c[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x97580c[_0x2ab3('0x32')],_0x97580c[_0x2ab3('0x2e')]);_0x5cd5a1[_0x2ab3('0x33')]=_[_0x2ab3('0x31')](_0x97580c['model'],qs[_0x2ab3('0x34')](_0x5d5118['query'][_0x2ab3('0x34')]));_0x5cd5a1[_0x2ab3('0x33')]=_0x5cd5a1[_0x2ab3('0x33')][_0x2ab3('0x35')]?_0x5cd5a1[_0x2ab3('0x33')]:_0x97580c[_0x2ab3('0x32')];if(!_0x5d5118[_0x2ab3('0x2e')][_0x2ab3('0x36')](_0x2ab3('0x37'))){_0x5cd5a1[_0x2ab3('0x1c')]=qs[_0x2ab3('0x1c')](_0x5d5118['query'][_0x2ab3('0x1c')]);_0x5cd5a1[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0x5d5118['query'][_0x2ab3('0x1a')]);}_0x5cd5a1['order']=qs[_0x2ab3('0x38')](_0x5d5118[_0x2ab3('0x2e')][_0x2ab3('0x38')]);_0x5cd5a1[_0x2ab3('0x39')]=qs['filters'](_[_0x2ab3('0x3a')](_0x5d5118[_0x2ab3('0x2e')],_0x97580c[_0x2ab3('0x30')]),_0x7d3746);if(_0x5d5118[_0x2ab3('0x2e')][_0x2ab3('0x3b')]){_0x5cd5a1[_0x2ab3('0x39')]=_[_0x2ab3('0x3c')](_0x5cd5a1[_0x2ab3('0x39')],{'$or':_[_0x2ab3('0x29')](_0x7d3746,function(_0x10b10c){if(_0x10b10c[_0x2ab3('0x2c')]!=='VIRTUAL'){var _0x98152={};_0x98152[_0x10b10c[_0x2ab3('0x26')]]={'$like':'%'+_0x5d5118['query'][_0x2ab3('0x3b')]+'%'};return _0x98152;}})});}_0x5cd5a1=_['merge']({},_0x5cd5a1,_0x5d5118['options']);var _0x20c375={'where':_0x5cd5a1[_0x2ab3('0x39')]};return db[_0x2ab3('0x2a')]['count'](_0x20c375)[_0x2ab3('0x21')](function(_0x516119){_0x128b02[_0x2ab3('0x1b')]=_0x516119;if(_0x5d5118['query'][_0x2ab3('0x3d')]){_0x5cd5a1[_0x2ab3('0x3e')]=[{'all':!![]}];}return db[_0x2ab3('0x2a')][_0x2ab3('0x3f')](_0x5cd5a1);})[_0x2ab3('0x21')](function(_0x2d0b23){_0x128b02[_0x2ab3('0x40')]=_0x2d0b23;return _0x128b02;})[_0x2ab3('0x21')](respondWithFilteredResult(_0x31a58a,_0x5cd5a1))[_0x2ab3('0x41')](handleError(_0x31a58a,null));};exports[_0x2ab3('0x42')]=function(_0x5e1d91,_0x3140a0){var _0x3a640a={'raw':![],'where':{'id':_0x5e1d91[_0x2ab3('0x43')]['id']}},_0x5ceef5={};_0x5ceef5[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db['ZohoConfiguration'][_0x2ab3('0x44')]);_0x5ceef5[_0x2ab3('0x2e')]=_[_0x2ab3('0x2f')](_0x5e1d91[_0x2ab3('0x2e')]);_0x5ceef5[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x5ceef5[_0x2ab3('0x32')],_0x5ceef5['query']);_0x3a640a[_0x2ab3('0x33')]=_[_0x2ab3('0x31')](_0x5ceef5[_0x2ab3('0x32')],qs[_0x2ab3('0x34')](_0x5e1d91[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x3a640a['attributes']=_0x3a640a[_0x2ab3('0x33')]['length']?_0x3a640a[_0x2ab3('0x33')]:_0x5ceef5['model'];if(_0x5e1d91[_0x2ab3('0x2e')][_0x2ab3('0x3d')]){_0x3a640a['include']=[{'all':!![]}];}_0x3a640a=_[_0x2ab3('0x3c')]({},_0x3a640a,_0x5e1d91['options']);return db[_0x2ab3('0x2a')]['find'](_0x3a640a)[_0x2ab3('0x21')](handleEntityNotFound(_0x3140a0,null))['then'](respondWithResult(_0x3140a0,null))[_0x2ab3('0x41')](handleError(_0x3140a0,null));};exports['create']=function(_0xae07e,_0x495e54){return db['ZohoConfiguration'][_0x2ab3('0x45')](_0xae07e[_0x2ab3('0x46')],{})[_0x2ab3('0x21')](respondWithResult(_0x495e54,0xc9))[_0x2ab3('0x41')](handleError(_0x495e54,null));};exports[_0x2ab3('0x47')]=function(_0x267cac,_0x1569a1){if(_0x267cac[_0x2ab3('0x46')]['id']){delete _0x267cac['body']['id'];}return db[_0x2ab3('0x2a')][_0x2ab3('0x48')]({'where':{'id':_0x267cac['params']['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x1569a1,null))['then'](saveUpdates(_0x267cac[_0x2ab3('0x46')],null))[_0x2ab3('0x21')](respondWithResult(_0x1569a1,null))[_0x2ab3('0x41')](handleError(_0x1569a1,null));};exports[_0x2ab3('0x22')]=function(_0x25aa4d,_0x33ab19){return db[_0x2ab3('0x2a')][_0x2ab3('0x48')]({'where':{'id':_0x25aa4d[_0x2ab3('0x43')]['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x33ab19,null))[_0x2ab3('0x21')](removeEntity(_0x33ab19,null))[_0x2ab3('0x41')](handleError(_0x33ab19,null));};exports['getFields']=function(_0x44747a,_0x24168a,_0x3c0c76){var _0x2da6c1={};var _0x30a9ed={};var _0x1b87a8;var _0x4a8146;return db[_0x2ab3('0x2a')]['findOne']({'where':{'id':_0x44747a['params']['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x24168a,null))['then'](function(_0x4bb4b6){if(_0x4bb4b6){_0x1b87a8=_0x4bb4b6;_0x30a9ed[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db['ZohoField'][_0x2ab3('0x44')]);_0x30a9ed['query']=_[_0x2ab3('0x2f')](_0x44747a['query']);_0x30a9ed[_0x2ab3('0x30')]=_['intersection'](_0x30a9ed[_0x2ab3('0x32')],_0x30a9ed[_0x2ab3('0x2e')]);_0x2da6c1['attributes']=_['intersection'](_0x30a9ed['model'],qs['fields'](_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x2da6c1[_0x2ab3('0x33')]=_0x2da6c1[_0x2ab3('0x33')][_0x2ab3('0x35')]?_0x2da6c1['attributes']:_0x30a9ed[_0x2ab3('0x32')];_0x2da6c1[_0x2ab3('0x49')]=qs['sort'](_0x44747a[_0x2ab3('0x2e')]['sort']);_0x2da6c1[_0x2ab3('0x39')]=qs[_0x2ab3('0x30')](_[_0x2ab3('0x3a')](_0x44747a[_0x2ab3('0x2e')],_0x30a9ed[_0x2ab3('0x30')]));if(_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x3b')]){_0x2da6c1[_0x2ab3('0x39')]=_[_0x2ab3('0x3c')](_0x2da6c1[_0x2ab3('0x39')],{'$or':_['map'](_0x2da6c1['attributes'],function(_0x1f3927){var _0x41c15c={};_0x41c15c[_0x1f3927]={'$like':'%'+_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x3b')]+'%'};return _0x41c15c;})});}_0x2da6c1=_[_0x2ab3('0x3c')]({},_0x2da6c1,_0x44747a[_0x2ab3('0x4a')]);return _0x1b87a8[_0x2ab3('0x4b')](_0x2da6c1);}})[_0x2ab3('0x21')](function(_0x6cf817){if(_0x6cf817){_0x4a8146=_0x6cf817[_0x2ab3('0x35')];if(!_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x36')](_0x2ab3('0x37'))){_0x2da6c1['limit']=qs[_0x2ab3('0x1c')](_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x1c')]);_0x2da6c1[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0x44747a[_0x2ab3('0x2e')][_0x2ab3('0x1a')]);}return _0x1b87a8[_0x2ab3('0x4b')](_0x2da6c1);}})[_0x2ab3('0x21')](function(_0xa8ae63){if(_0xa8ae63){return _0xa8ae63?{'count':_0x4a8146,'rows':_0xa8ae63}:null;}})[_0x2ab3('0x21')](respondWithResult(_0x24168a,null))[_0x2ab3('0x41')](handleError(_0x24168a,null));};exports[_0x2ab3('0x4c')]=function(_0x10edb3,_0x216763,_0x338de3){var _0x29ae70={};var _0x202b83={};var _0x1c7739;var _0x2ac3d6;return db[_0x2ab3('0x2a')][_0x2ab3('0x4d')]({'where':{'id':_0x10edb3[_0x2ab3('0x43')]['id']}})['then'](handleEntityNotFound(_0x216763,null))[_0x2ab3('0x21')](function(_0x49c810){if(_0x49c810){_0x1c7739=_0x49c810;_0x202b83[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db[_0x2ab3('0x4e')][_0x2ab3('0x44')]);_0x202b83[_0x2ab3('0x2e')]=_[_0x2ab3('0x2f')](_0x10edb3[_0x2ab3('0x2e')]);_0x202b83[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x202b83[_0x2ab3('0x32')],_0x202b83['query']);_0x29ae70['attributes']=_[_0x2ab3('0x31')](_0x202b83[_0x2ab3('0x32')],qs[_0x2ab3('0x34')](_0x10edb3[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x29ae70[_0x2ab3('0x33')]=_0x29ae70[_0x2ab3('0x33')]['length']?_0x29ae70[_0x2ab3('0x33')]:_0x202b83[_0x2ab3('0x32')];_0x29ae70[_0x2ab3('0x49')]=qs[_0x2ab3('0x38')](_0x10edb3['query'][_0x2ab3('0x38')]);_0x29ae70[_0x2ab3('0x39')]=qs[_0x2ab3('0x30')](_['pick'](_0x10edb3[_0x2ab3('0x2e')],_0x202b83[_0x2ab3('0x30')]));if(_0x10edb3['query'][_0x2ab3('0x3b')]){_0x29ae70['where']=_[_0x2ab3('0x3c')](_0x29ae70[_0x2ab3('0x39')],{'$or':_[_0x2ab3('0x29')](_0x29ae70[_0x2ab3('0x33')],function(_0x36cea8){var _0x424c11={};_0x424c11[_0x36cea8]={'$like':'%'+_0x10edb3[_0x2ab3('0x2e')]['filter']+'%'};return _0x424c11;})});}_0x29ae70=_[_0x2ab3('0x3c')]({},_0x29ae70,_0x10edb3[_0x2ab3('0x4a')]);return _0x1c7739[_0x2ab3('0x4c')](_0x29ae70);}})[_0x2ab3('0x21')](function(_0x33ef99){if(_0x33ef99){_0x2ac3d6=_0x33ef99[_0x2ab3('0x35')];if(!_0x10edb3[_0x2ab3('0x2e')]['hasOwnProperty']('nolimit')){_0x29ae70[_0x2ab3('0x1c')]=qs[_0x2ab3('0x1c')](_0x10edb3[_0x2ab3('0x2e')][_0x2ab3('0x1c')]);_0x29ae70[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0x10edb3[_0x2ab3('0x2e')][_0x2ab3('0x1a')]);}return _0x1c7739['getSubjects'](_0x29ae70);}})[_0x2ab3('0x21')](function(_0x588eef){if(_0x588eef){return _0x588eef?{'count':_0x2ac3d6,'rows':_0x588eef}:null;}})[_0x2ab3('0x21')](respondWithResult(_0x216763,null))[_0x2ab3('0x41')](handleError(_0x216763,null));};exports[_0x2ab3('0x4f')]=function(_0xb7e927,_0x261d09,_0x5a2837){var _0x44d102={};var _0x364ea6={};var _0xe5ed75;var _0x3679ac;return db['ZohoConfiguration'][_0x2ab3('0x4d')]({'where':{'id':_0xb7e927[_0x2ab3('0x43')]['id']}})[_0x2ab3('0x21')](handleEntityNotFound(_0x261d09,null))[_0x2ab3('0x21')](function(_0x1a315b){if(_0x1a315b){_0xe5ed75=_0x1a315b;_0x364ea6[_0x2ab3('0x32')]=_[_0x2ab3('0x2f')](db['ZohoField'][_0x2ab3('0x44')]);_0x364ea6['query']=_[_0x2ab3('0x2f')](_0xb7e927['query']);_0x364ea6[_0x2ab3('0x30')]=_[_0x2ab3('0x31')](_0x364ea6['model'],_0x364ea6[_0x2ab3('0x2e')]);_0x44d102[_0x2ab3('0x33')]=_['intersection'](_0x364ea6[_0x2ab3('0x32')],qs[_0x2ab3('0x34')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x34')]));_0x44d102[_0x2ab3('0x33')]=_0x44d102[_0x2ab3('0x33')][_0x2ab3('0x35')]?_0x44d102[_0x2ab3('0x33')]:_0x364ea6[_0x2ab3('0x32')];_0x44d102['order']=qs[_0x2ab3('0x38')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x38')]);_0x44d102['where']=qs[_0x2ab3('0x30')](_['pick'](_0xb7e927['query'],_0x364ea6[_0x2ab3('0x30')]));if(_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x3b')]){_0x44d102[_0x2ab3('0x39')]=_[_0x2ab3('0x3c')](_0x44d102[_0x2ab3('0x39')],{'$or':_['map'](_0x44d102[_0x2ab3('0x33')],function(_0x1ede84){var _0x4c29a9={};_0x4c29a9[_0x1ede84]={'$like':'%'+_0xb7e927['query']['filter']+'%'};return _0x4c29a9;})});}_0x44d102=_['merge']({},_0x44d102,_0xb7e927['options']);return _0xe5ed75[_0x2ab3('0x4f')](_0x44d102);}})[_0x2ab3('0x21')](function(_0x53c4c4){if(_0x53c4c4){_0x3679ac=_0x53c4c4[_0x2ab3('0x35')];if(!_0xb7e927['query'][_0x2ab3('0x36')]('nolimit')){_0x44d102['limit']=qs[_0x2ab3('0x1c')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x1c')]);_0x44d102[_0x2ab3('0x1a')]=qs[_0x2ab3('0x1a')](_0xb7e927[_0x2ab3('0x2e')][_0x2ab3('0x1a')]);}return _0xe5ed75['getDescriptions'](_0x44d102);}})['then'](function(_0x1e9918){if(_0x1e9918){return _0x1e9918?{'count':_0x3679ac,'rows':_0x1e9918}:null;}})[_0x2ab3('0x21')](respondWithResult(_0x261d09,null))[_0x2ab3('0x41')](handleError(_0x261d09,null));}; \ No newline at end of file +var _0xe3cb=['update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','find','create','body','params','getFields','findOne','getSubjects','ZohoField','getDescriptions','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','to-csv','lodash','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','Content-Range','apply','save'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3cb,0x75));var _0xbe3c=function(_0x19d77d,_0x5cfacc){_0x19d77d=_0x19d77d-0x0;var _0x23f8d8=_0xe3cb[_0x19d77d];return _0x23f8d8;};'use strict';var emlformat=require(_0xbe3c('0x0'));var rimraf=require(_0xbe3c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe3c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbe3c('0x3'));var Mustache=require(_0xbe3c('0x4'));var util=require(_0xbe3c('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xbe3c('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbe3c('0x7'));var squel=require('squel');var crypto=require(_0xbe3c('0x8'));var jsforce=require(_0xbe3c('0x9'));var deskjs=require('desk.js');var toCsv=require(_0xbe3c('0x6'));var querystring=require('querystring');var Papa=require(_0xbe3c('0xa'));var Redis=require(_0xbe3c('0xb'));var authService=require('../../components/auth/service');var qs=require(_0xbe3c('0xc'));var as=require(_0xbe3c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbe3c('0xe'))(_0xbe3c('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbe3c('0x10'));var db=require(_0xbe3c('0x11'))['db'];function respondWithStatusCode(_0xcedea2,_0x5cdd15){_0x5cdd15=_0x5cdd15||0xcc;return function(_0x5ebc4f){if(_0x5ebc4f){return _0xcedea2['sendStatus'](_0x5cdd15);}return _0xcedea2[_0xbe3c('0x12')](_0x5cdd15)[_0xbe3c('0x13')]();};}function respondWithResult(_0x4dbee5,_0x15e7a9){_0x15e7a9=_0x15e7a9||0xc8;return function(_0x465536){if(_0x465536){return _0x4dbee5[_0xbe3c('0x12')](_0x15e7a9)[_0xbe3c('0x14')](_0x465536);}};}function respondWithFilteredResult(_0x2983c2,_0x362050){return function(_0x2cac7b){if(_0x2cac7b){var _0x454ddf=typeof _0x362050[_0xbe3c('0x15')]==='undefined'&&typeof _0x362050['limit']===_0xbe3c('0x16');var _0x2bab8d=_0x2cac7b[_0xbe3c('0x17')];var _0x10cccd=_0x454ddf?0x0:_0x362050[_0xbe3c('0x15')];var _0x54570=_0x454ddf?_0x2cac7b[_0xbe3c('0x17')]:_0x362050[_0xbe3c('0x15')]+_0x362050['limit'];var _0x4db69c;if(_0x54570>=_0x2bab8d){_0x54570=_0x2bab8d;_0x4db69c=0xc8;}else{_0x4db69c=0xce;}_0x2983c2['status'](_0x4db69c);return _0x2983c2['set'](_0xbe3c('0x18'),_0x10cccd+'-'+_0x54570+'/'+_0x2bab8d)[_0xbe3c('0x14')](_0x2cac7b);}return null;};}function patchUpdates(_0x4d4344){return function(_0x457f02){try{jsonpatch[_0xbe3c('0x19')](_0x457f02,_0x4d4344,!![]);}catch(_0x527397){return BPromise['reject'](_0x527397);}return _0x457f02[_0xbe3c('0x1a')]();};}function saveUpdates(_0x852b3d,_0x1c5c6c){return function(_0x32bea6){if(_0x32bea6){return _0x32bea6[_0xbe3c('0x1b')](_0x852b3d)[_0xbe3c('0x1c')](function(_0x42b55d){return _0x42b55d;});}return null;};}function removeEntity(_0x18fb95,_0x66153a){return function(_0x257d98){if(_0x257d98){return _0x257d98[_0xbe3c('0x1d')]()[_0xbe3c('0x1c')](function(){_0x18fb95['status'](0xcc)[_0xbe3c('0x13')]();});}};}function handleEntityNotFound(_0x448d72,_0x2068a6){return function(_0x31f840){if(!_0x31f840){_0x448d72['sendStatus'](0x194);}return _0x31f840;};}function handleError(_0x44de01,_0x2ca50b){_0x2ca50b=_0x2ca50b||0x1f4;return function(_0x4c65cb){logger[_0xbe3c('0x1e')](_0x4c65cb[_0xbe3c('0x1f')]);if(_0x4c65cb[_0xbe3c('0x20')]){delete _0x4c65cb['name'];}_0x44de01['status'](_0x2ca50b)[_0xbe3c('0x21')](_0x4c65cb);};}exports[_0xbe3c('0x22')]=function(_0x59b3ad,_0x5a8dae){var _0x5244a9={},_0x5142d4={},_0x269d94={'count':0x0,'rows':[]};var _0x40cb6c=_[_0xbe3c('0x23')](db[_0xbe3c('0x24')][_0xbe3c('0x25')],function(_0xee583b){return{'name':_0xee583b[_0xbe3c('0x26')],'type':_0xee583b[_0xbe3c('0x27')]['key']};});_0x5142d4['model']=_[_0xbe3c('0x23')](_0x40cb6c,_0xbe3c('0x20'));_0x5142d4[_0xbe3c('0x28')]=_[_0xbe3c('0x29')](_0x59b3ad[_0xbe3c('0x28')]);_0x5142d4[_0xbe3c('0x2a')]=_[_0xbe3c('0x2b')](_0x5142d4[_0xbe3c('0x2c')],_0x5142d4[_0xbe3c('0x28')]);_0x5244a9['attributes']=_[_0xbe3c('0x2b')](_0x5142d4[_0xbe3c('0x2c')],qs[_0xbe3c('0x2d')](_0x59b3ad['query'][_0xbe3c('0x2d')]));_0x5244a9['attributes']=_0x5244a9[_0xbe3c('0x2e')][_0xbe3c('0x2f')]?_0x5244a9[_0xbe3c('0x2e')]:_0x5142d4[_0xbe3c('0x2c')];if(!_0x59b3ad[_0xbe3c('0x28')][_0xbe3c('0x30')](_0xbe3c('0x31'))){_0x5244a9[_0xbe3c('0x32')]=qs[_0xbe3c('0x32')](_0x59b3ad['query']['limit']);_0x5244a9[_0xbe3c('0x15')]=qs[_0xbe3c('0x15')](_0x59b3ad[_0xbe3c('0x28')]['offset']);}_0x5244a9[_0xbe3c('0x33')]=qs[_0xbe3c('0x34')](_0x59b3ad[_0xbe3c('0x28')][_0xbe3c('0x34')]);_0x5244a9[_0xbe3c('0x35')]=qs[_0xbe3c('0x2a')](_[_0xbe3c('0x36')](_0x59b3ad[_0xbe3c('0x28')],_0x5142d4['filters']),_0x40cb6c);if(_0x59b3ad['query'][_0xbe3c('0x37')]){_0x5244a9[_0xbe3c('0x35')]=_[_0xbe3c('0x38')](_0x5244a9[_0xbe3c('0x35')],{'$or':_[_0xbe3c('0x23')](_0x40cb6c,function(_0x50d12a){if(_0x50d12a[_0xbe3c('0x27')]!=='VIRTUAL'){var _0x30e577={};_0x30e577[_0x50d12a[_0xbe3c('0x20')]]={'$like':'%'+_0x59b3ad['query']['filter']+'%'};return _0x30e577;}})});}_0x5244a9=_[_0xbe3c('0x38')]({},_0x5244a9,_0x59b3ad[_0xbe3c('0x39')]);var _0x5a6898={'where':_0x5244a9['where']};return db[_0xbe3c('0x24')][_0xbe3c('0x17')](_0x5a6898)[_0xbe3c('0x1c')](function(_0x12fe4e){_0x269d94[_0xbe3c('0x17')]=_0x12fe4e;if(_0x59b3ad[_0xbe3c('0x28')][_0xbe3c('0x3a')]){_0x5244a9[_0xbe3c('0x3b')]=[{'all':!![]}];}return db['ZohoConfiguration']['findAll'](_0x5244a9);})['then'](function(_0x44b79e){_0x269d94[_0xbe3c('0x3c')]=_0x44b79e;return _0x269d94;})[_0xbe3c('0x1c')](respondWithFilteredResult(_0x5a8dae,_0x5244a9))[_0xbe3c('0x3d')](handleError(_0x5a8dae,null));};exports[_0xbe3c('0x3e')]=function(_0x5cac37,_0x5526b5){var _0x828ff3={'raw':![],'where':{'id':_0x5cac37['params']['id']}},_0x10ef00={};_0x10ef00[_0xbe3c('0x2c')]=_[_0xbe3c('0x29')](db[_0xbe3c('0x24')][_0xbe3c('0x25')]);_0x10ef00[_0xbe3c('0x28')]=_[_0xbe3c('0x29')](_0x5cac37['query']);_0x10ef00[_0xbe3c('0x2a')]=_[_0xbe3c('0x2b')](_0x10ef00['model'],_0x10ef00[_0xbe3c('0x28')]);_0x828ff3[_0xbe3c('0x2e')]=_[_0xbe3c('0x2b')](_0x10ef00[_0xbe3c('0x2c')],qs[_0xbe3c('0x2d')](_0x5cac37[_0xbe3c('0x28')]['fields']));_0x828ff3[_0xbe3c('0x2e')]=_0x828ff3['attributes'][_0xbe3c('0x2f')]?_0x828ff3[_0xbe3c('0x2e')]:_0x10ef00[_0xbe3c('0x2c')];if(_0x5cac37[_0xbe3c('0x28')][_0xbe3c('0x3a')]){_0x828ff3[_0xbe3c('0x3b')]=[{'all':!![]}];}_0x828ff3=_[_0xbe3c('0x38')]({},_0x828ff3,_0x5cac37[_0xbe3c('0x39')]);return db['ZohoConfiguration'][_0xbe3c('0x3f')](_0x828ff3)['then'](handleEntityNotFound(_0x5526b5,null))[_0xbe3c('0x1c')](respondWithResult(_0x5526b5,null))[_0xbe3c('0x3d')](handleError(_0x5526b5,null));};exports['create']=function(_0x1ab002,_0x43cc7e){return db[_0xbe3c('0x24')][_0xbe3c('0x40')](_0x1ab002[_0xbe3c('0x41')],{})[_0xbe3c('0x1c')](respondWithResult(_0x43cc7e,0xc9))['catch'](handleError(_0x43cc7e,null));};exports['update']=function(_0x2bb5eb,_0x402486){if(_0x2bb5eb[_0xbe3c('0x41')]['id']){delete _0x2bb5eb[_0xbe3c('0x41')]['id'];}return db['ZohoConfiguration'][_0xbe3c('0x3f')]({'where':{'id':_0x2bb5eb['params']['id']}})[_0xbe3c('0x1c')](handleEntityNotFound(_0x402486,null))[_0xbe3c('0x1c')](saveUpdates(_0x2bb5eb[_0xbe3c('0x41')],null))[_0xbe3c('0x1c')](respondWithResult(_0x402486,null))['catch'](handleError(_0x402486,null));};exports['destroy']=function(_0x25bc2e,_0x31c0b0){return db[_0xbe3c('0x24')][_0xbe3c('0x3f')]({'where':{'id':_0x25bc2e[_0xbe3c('0x42')]['id']}})[_0xbe3c('0x1c')](handleEntityNotFound(_0x31c0b0,null))[_0xbe3c('0x1c')](removeEntity(_0x31c0b0,null))[_0xbe3c('0x3d')](handleError(_0x31c0b0,null));};exports[_0xbe3c('0x43')]=function(_0xef340c,_0x46b23b,_0x24c321){var _0x4e0d5c={};var _0x2dc780={};var _0x1b631b;var _0x3c4f02;return db[_0xbe3c('0x24')][_0xbe3c('0x44')]({'where':{'id':_0xef340c[_0xbe3c('0x42')]['id']}})[_0xbe3c('0x1c')](handleEntityNotFound(_0x46b23b,null))[_0xbe3c('0x1c')](function(_0x1ae3bd){if(_0x1ae3bd){_0x1b631b=_0x1ae3bd;_0x2dc780[_0xbe3c('0x2c')]=_[_0xbe3c('0x29')](db['ZohoField'][_0xbe3c('0x25')]);_0x2dc780[_0xbe3c('0x28')]=_['keys'](_0xef340c[_0xbe3c('0x28')]);_0x2dc780[_0xbe3c('0x2a')]=_[_0xbe3c('0x2b')](_0x2dc780[_0xbe3c('0x2c')],_0x2dc780[_0xbe3c('0x28')]);_0x4e0d5c['attributes']=_[_0xbe3c('0x2b')](_0x2dc780[_0xbe3c('0x2c')],qs[_0xbe3c('0x2d')](_0xef340c[_0xbe3c('0x28')][_0xbe3c('0x2d')]));_0x4e0d5c['attributes']=_0x4e0d5c[_0xbe3c('0x2e')]['length']?_0x4e0d5c[_0xbe3c('0x2e')]:_0x2dc780[_0xbe3c('0x2c')];_0x4e0d5c[_0xbe3c('0x33')]=qs[_0xbe3c('0x34')](_0xef340c[_0xbe3c('0x28')]['sort']);_0x4e0d5c[_0xbe3c('0x35')]=qs[_0xbe3c('0x2a')](_[_0xbe3c('0x36')](_0xef340c[_0xbe3c('0x28')],_0x2dc780[_0xbe3c('0x2a')]));if(_0xef340c[_0xbe3c('0x28')][_0xbe3c('0x37')]){_0x4e0d5c[_0xbe3c('0x35')]=_['merge'](_0x4e0d5c[_0xbe3c('0x35')],{'$or':_[_0xbe3c('0x23')](_0x4e0d5c[_0xbe3c('0x2e')],function(_0x3dab00){var _0x1d3a82={};_0x1d3a82[_0x3dab00]={'$like':'%'+_0xef340c[_0xbe3c('0x28')]['filter']+'%'};return _0x1d3a82;})});}_0x4e0d5c=_[_0xbe3c('0x38')]({},_0x4e0d5c,_0xef340c[_0xbe3c('0x39')]);return _0x1b631b[_0xbe3c('0x43')](_0x4e0d5c);}})['then'](function(_0x4ddace){if(_0x4ddace){_0x3c4f02=_0x4ddace[_0xbe3c('0x2f')];if(!_0xef340c['query'][_0xbe3c('0x30')](_0xbe3c('0x31'))){_0x4e0d5c['limit']=qs['limit'](_0xef340c[_0xbe3c('0x28')]['limit']);_0x4e0d5c[_0xbe3c('0x15')]=qs[_0xbe3c('0x15')](_0xef340c[_0xbe3c('0x28')][_0xbe3c('0x15')]);}return _0x1b631b[_0xbe3c('0x43')](_0x4e0d5c);}})[_0xbe3c('0x1c')](function(_0x355703){if(_0x355703){return _0x355703?{'count':_0x3c4f02,'rows':_0x355703}:null;}})[_0xbe3c('0x1c')](respondWithResult(_0x46b23b,null))['catch'](handleError(_0x46b23b,null));};exports[_0xbe3c('0x45')]=function(_0x50eab3,_0x36c665,_0x1ec786){var _0x3f0717={};var _0x3f5f33={};var _0x29a2a3;var _0x247df1;return db[_0xbe3c('0x24')][_0xbe3c('0x44')]({'where':{'id':_0x50eab3[_0xbe3c('0x42')]['id']}})[_0xbe3c('0x1c')](handleEntityNotFound(_0x36c665,null))[_0xbe3c('0x1c')](function(_0x2627ae){if(_0x2627ae){_0x29a2a3=_0x2627ae;_0x3f5f33['model']=_[_0xbe3c('0x29')](db[_0xbe3c('0x46')][_0xbe3c('0x25')]);_0x3f5f33[_0xbe3c('0x28')]=_[_0xbe3c('0x29')](_0x50eab3[_0xbe3c('0x28')]);_0x3f5f33['filters']=_[_0xbe3c('0x2b')](_0x3f5f33[_0xbe3c('0x2c')],_0x3f5f33[_0xbe3c('0x28')]);_0x3f0717[_0xbe3c('0x2e')]=_[_0xbe3c('0x2b')](_0x3f5f33[_0xbe3c('0x2c')],qs[_0xbe3c('0x2d')](_0x50eab3['query'][_0xbe3c('0x2d')]));_0x3f0717[_0xbe3c('0x2e')]=_0x3f0717[_0xbe3c('0x2e')][_0xbe3c('0x2f')]?_0x3f0717[_0xbe3c('0x2e')]:_0x3f5f33[_0xbe3c('0x2c')];_0x3f0717[_0xbe3c('0x33')]=qs[_0xbe3c('0x34')](_0x50eab3[_0xbe3c('0x28')]['sort']);_0x3f0717[_0xbe3c('0x35')]=qs[_0xbe3c('0x2a')](_[_0xbe3c('0x36')](_0x50eab3[_0xbe3c('0x28')],_0x3f5f33[_0xbe3c('0x2a')]));if(_0x50eab3[_0xbe3c('0x28')][_0xbe3c('0x37')]){_0x3f0717['where']=_['merge'](_0x3f0717[_0xbe3c('0x35')],{'$or':_[_0xbe3c('0x23')](_0x3f0717[_0xbe3c('0x2e')],function(_0x41c2b8){var _0x3be10f={};_0x3be10f[_0x41c2b8]={'$like':'%'+_0x50eab3[_0xbe3c('0x28')]['filter']+'%'};return _0x3be10f;})});}_0x3f0717=_['merge']({},_0x3f0717,_0x50eab3['options']);return _0x29a2a3['getSubjects'](_0x3f0717);}})[_0xbe3c('0x1c')](function(_0x525cec){if(_0x525cec){_0x247df1=_0x525cec[_0xbe3c('0x2f')];if(!_0x50eab3['query']['hasOwnProperty'](_0xbe3c('0x31'))){_0x3f0717[_0xbe3c('0x32')]=qs['limit'](_0x50eab3[_0xbe3c('0x28')][_0xbe3c('0x32')]);_0x3f0717['offset']=qs[_0xbe3c('0x15')](_0x50eab3[_0xbe3c('0x28')][_0xbe3c('0x15')]);}return _0x29a2a3['getSubjects'](_0x3f0717);}})[_0xbe3c('0x1c')](function(_0x4e4132){if(_0x4e4132){return _0x4e4132?{'count':_0x247df1,'rows':_0x4e4132}:null;}})[_0xbe3c('0x1c')](respondWithResult(_0x36c665,null))[_0xbe3c('0x3d')](handleError(_0x36c665,null));};exports[_0xbe3c('0x47')]=function(_0x40fe5f,_0x5c6b3f,_0x58db4d){var _0x5af9fd={};var _0x5d3954={};var _0xa057f4;var _0x27536b;return db[_0xbe3c('0x24')][_0xbe3c('0x44')]({'where':{'id':_0x40fe5f['params']['id']}})[_0xbe3c('0x1c')](handleEntityNotFound(_0x5c6b3f,null))[_0xbe3c('0x1c')](function(_0x5b0a70){if(_0x5b0a70){_0xa057f4=_0x5b0a70;_0x5d3954[_0xbe3c('0x2c')]=_[_0xbe3c('0x29')](db['ZohoField'][_0xbe3c('0x25')]);_0x5d3954[_0xbe3c('0x28')]=_['keys'](_0x40fe5f[_0xbe3c('0x28')]);_0x5d3954['filters']=_[_0xbe3c('0x2b')](_0x5d3954[_0xbe3c('0x2c')],_0x5d3954[_0xbe3c('0x28')]);_0x5af9fd[_0xbe3c('0x2e')]=_[_0xbe3c('0x2b')](_0x5d3954[_0xbe3c('0x2c')],qs['fields'](_0x40fe5f[_0xbe3c('0x28')][_0xbe3c('0x2d')]));_0x5af9fd[_0xbe3c('0x2e')]=_0x5af9fd[_0xbe3c('0x2e')][_0xbe3c('0x2f')]?_0x5af9fd[_0xbe3c('0x2e')]:_0x5d3954[_0xbe3c('0x2c')];_0x5af9fd[_0xbe3c('0x33')]=qs[_0xbe3c('0x34')](_0x40fe5f[_0xbe3c('0x28')][_0xbe3c('0x34')]);_0x5af9fd[_0xbe3c('0x35')]=qs[_0xbe3c('0x2a')](_[_0xbe3c('0x36')](_0x40fe5f[_0xbe3c('0x28')],_0x5d3954['filters']));if(_0x40fe5f['query']['filter']){_0x5af9fd[_0xbe3c('0x35')]=_['merge'](_0x5af9fd[_0xbe3c('0x35')],{'$or':_[_0xbe3c('0x23')](_0x5af9fd[_0xbe3c('0x2e')],function(_0x13538d){var _0x39196d={};_0x39196d[_0x13538d]={'$like':'%'+_0x40fe5f[_0xbe3c('0x28')]['filter']+'%'};return _0x39196d;})});}_0x5af9fd=_[_0xbe3c('0x38')]({},_0x5af9fd,_0x40fe5f[_0xbe3c('0x39')]);return _0xa057f4[_0xbe3c('0x47')](_0x5af9fd);}})[_0xbe3c('0x1c')](function(_0x58f547){if(_0x58f547){_0x27536b=_0x58f547[_0xbe3c('0x2f')];if(!_0x40fe5f[_0xbe3c('0x28')]['hasOwnProperty'](_0xbe3c('0x31'))){_0x5af9fd[_0xbe3c('0x32')]=qs['limit'](_0x40fe5f[_0xbe3c('0x28')][_0xbe3c('0x32')]);_0x5af9fd[_0xbe3c('0x15')]=qs[_0xbe3c('0x15')](_0x40fe5f[_0xbe3c('0x28')][_0xbe3c('0x15')]);}return _0xa057f4[_0xbe3c('0x47')](_0x5af9fd);}})[_0xbe3c('0x1c')](function(_0x4031a6){if(_0x4031a6){return _0x4031a6?{'count':_0x27536b,'rows':_0x4031a6}:null;}})[_0xbe3c('0x1c')](respondWithResult(_0x5c6b3f,null))['catch'](handleError(_0x5c6b3f,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2f88ec6..f21495d 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 _0x2dc4=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','ZohoConfiguration','lodash','util','../../config/logger','api'];(function(_0x33203d,_0x20b154){var _0x2e69f4=function(_0x2ba3e6){while(--_0x2ba3e6){_0x33203d['push'](_0x33203d['shift']());}};_0x2e69f4(++_0x20b154);}(_0x2dc4,0x1ac));var _0x42dc=function(_0x4edcd3,_0x59bcaa){_0x4edcd3=_0x4edcd3-0x0;var _0x3c38dd=_0x2dc4[_0x4edcd3];return _0x3c38dd;};'use strict';var _=require(_0x42dc('0x0'));var util=require(_0x42dc('0x1'));var logger=require(_0x42dc('0x2'))(_0x42dc('0x3'));var moment=require(_0x42dc('0x4'));var BPromise=require(_0x42dc('0x5'));var rp=require(_0x42dc('0x6'));var fs=require('fs');var path=require(_0x42dc('0x7'));var rimraf=require(_0x42dc('0x8'));var config=require(_0x42dc('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0x42dc('0xa')]=function(_0x1b6c17,_0x5a5357){return _0x1b6c17['define'](_0x42dc('0xb'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf3ab=['../../config/logger','api','moment','request-promise','path','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','util'];(function(_0x2401fc,_0xbc7845){var _0x23bb42=function(_0x45a8e9){while(--_0x45a8e9){_0x2401fc['push'](_0x2401fc['shift']());}};_0x23bb42(++_0xbc7845);}(_0xf3ab,0x1a1));var _0xbf3a=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xf3ab[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0xbf3a('0x0'));var logger=require(_0xbf3a('0x1'))(_0xbf3a('0x2'));var moment=require(_0xbf3a('0x3'));var BPromise=require('bluebird');var rp=require(_0xbf3a('0x4'));var fs=require('fs');var path=require(_0xbf3a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbf3a('0x6'));module[_0xbf3a('0x7')]=function(_0x501178,_0x43f771){return _0x501178[_0xbf3a('0x8')](_0xbf3a('0x9'),attributes,{'tableName':_0xbf3a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index c1908ec..0e25eec 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 _0x699c=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5b8ed9,_0x2c86ad){var _0x15a0a5=function(_0x128cfb){while(--_0x128cfb){_0x5b8ed9['push'](_0x5b8ed9['shift']());}};_0x15a0a5(++_0x2c86ad);}(_0x699c,0xc1));var _0xc699=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x699c[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xc699('0x0'));var moment=require(_0xc699('0x1'));var BPromise=require(_0xc699('0x2'));var rs=require(_0xc699('0x3'));var fs=require('fs');var Redis=require(_0xc699('0x4'));var db=require(_0xc699('0x5'))['db'];var utils=require(_0xc699('0x6'));var logger=require(_0xc699('0x7'))(_0xc699('0x8'));var config=require(_0xc699('0x9'));var jayson=require(_0xc699('0xa'));var client=jayson[_0xc699('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2eec1c,_0xaf2f34,_0x3ff4ac){return new BPromise(function(_0x1569f3,_0x47252f){return client[_0xc699('0xc')](_0x2eec1c,_0x3ff4ac)[_0xc699('0xd')](function(_0x5aea95){logger[_0xc699('0xe')](_0xc699('0xf'),_0xaf2f34,_0xc699('0x10'));logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0xaf2f34,_0xc699('0x10'),JSON[_0xc699('0x11')](_0x5aea95));if(_0x5aea95[_0xc699('0x12')]){if(_0x5aea95['error'][_0xc699('0x13')]===0x1f4){logger[_0xc699('0x12')](_0xc699('0xf'),_0xaf2f34,_0x5aea95['error'][_0xc699('0x14')]);return _0x47252f(_0x5aea95[_0xc699('0x12')][_0xc699('0x14')]);}logger[_0xc699('0x12')](_0xc699('0xf'),_0xaf2f34,_0x5aea95['error'][_0xc699('0x14')]);return _0x1569f3(_0x5aea95[_0xc699('0x12')][_0xc699('0x14')]);}else{logger[_0xc699('0xe')](_0xc699('0xf'),_0xaf2f34,_0xc699('0x10'));_0x1569f3(_0x5aea95['result']['message']);}})[_0xc699('0x15')](function(_0x5bc03f){logger['error'](_0xc699('0xf'),_0xaf2f34,_0x5bc03f);_0x47252f(_0x5bc03f);});});} \ No newline at end of file +var _0xe1ab=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2ba52e,_0x30f462){var _0x5165c0=function(_0x26db06){while(--_0x26db06){_0x2ba52e['push'](_0x2ba52e['shift']());}};_0x5165c0(++_0x30f462);}(_0xe1ab,0x79));var _0xbe1a=function(_0x2ff4bd,_0x4780a6){_0x2ff4bd=_0x2ff4bd-0x0;var _0x28edc6=_0xe1ab[_0x2ff4bd];return _0x28edc6;};'use strict';var _=require(_0xbe1a('0x0'));var util=require(_0xbe1a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbe1a('0x2'));var fs=require('fs');var Redis=require(_0xbe1a('0x3'));var db=require(_0xbe1a('0x4'))['db'];var utils=require(_0xbe1a('0x5'));var logger=require(_0xbe1a('0x6'))(_0xbe1a('0x7'));var config=require('../../config/environment');var jayson=require(_0xbe1a('0x8'));var client=jayson[_0xbe1a('0x9')][_0xbe1a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x394258,_0x53e27b,_0x44b375){return new BPromise(function(_0x2e115c,_0x592f74){return client[_0xbe1a('0xb')](_0x394258,_0x44b375)[_0xbe1a('0xc')](function(_0x4adf39){logger[_0xbe1a('0xd')](_0xbe1a('0xe'),_0x53e27b,_0xbe1a('0xf'));logger[_0xbe1a('0x10')](_0xbe1a('0x11'),_0x53e27b,_0xbe1a('0xf'),JSON[_0xbe1a('0x12')](_0x4adf39));if(_0x4adf39[_0xbe1a('0x13')]){if(_0x4adf39[_0xbe1a('0x13')][_0xbe1a('0x14')]===0x1f4){logger[_0xbe1a('0x13')](_0xbe1a('0xe'),_0x53e27b,_0x4adf39[_0xbe1a('0x13')][_0xbe1a('0x15')]);return _0x592f74(_0x4adf39['error'][_0xbe1a('0x15')]);}logger[_0xbe1a('0x13')](_0xbe1a('0xe'),_0x53e27b,_0x4adf39[_0xbe1a('0x13')]['message']);return _0x2e115c(_0x4adf39[_0xbe1a('0x13')]['message']);}else{logger['info'](_0xbe1a('0xe'),_0x53e27b,_0xbe1a('0xf'));_0x2e115c(_0x4adf39[_0xbe1a('0x16')]['message']);}})[_0xbe1a('0x17')](function(_0x22c41f){logger[_0xbe1a('0x13')](_0xbe1a('0xe'),_0x53e27b,_0x22c41f);_0x592f74(_0x22c41f);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 24c852b..4898582 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 _0x305c=['post','create','put','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show'];(function(_0x517aba,_0x4814e5){var _0x246abe=function(_0x36b7a9){while(--_0x36b7a9){_0x517aba['push'](_0x517aba['shift']());}};_0x246abe(++_0x4814e5);}(_0x305c,0x15b));var _0xc305=function(_0x4aa2ec,_0x3d552a){_0x4aa2ec=_0x4aa2ec-0x0;var _0x534708=_0x305c[_0x4aa2ec];return _0x534708;};'use strict';var multer=require('multer');var util=require(_0xc305('0x0'));var path=require(_0xc305('0x1'));var timeout=require(_0xc305('0x2'));var express=require(_0xc305('0x3'));var router=express[_0xc305('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc305('0x5'));var interaction=require(_0xc305('0x6'));var config=require(_0xc305('0x7'));var controller=require(_0xc305('0x8'));router[_0xc305('0x9')]('/',auth[_0xc305('0xa')](),controller[_0xc305('0xb')]);router[_0xc305('0x9')]('/:id',auth[_0xc305('0xa')](),controller[_0xc305('0xc')]);router[_0xc305('0xd')]('/',auth[_0xc305('0xa')](),controller[_0xc305('0xe')]);router[_0xc305('0xf')](_0xc305('0x10'),auth[_0xc305('0xa')](),controller[_0xc305('0x11')]);router['delete'](_0xc305('0x10'),auth['isAuthenticated'](),controller[_0xc305('0x12')]);module[_0xc305('0x13')]=router; \ No newline at end of file +var _0x3c8b=['isAuthenticated','index','/:id','post','delete','destroy','exports','multer','express','../../components/auth/service','../../config/environment','./intZohoField.controller','get'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x3c8b,0xa3));var _0xb3c8=function(_0x349ad0,_0x3150de){_0x349ad0=_0x349ad0-0x0;var _0x5afb44=_0x3c8b[_0x349ad0];return _0x5afb44;};'use strict';var multer=require(_0xb3c8('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb3c8('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb3c8('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xb3c8('0x3'));var controller=require(_0xb3c8('0x4'));router[_0xb3c8('0x5')]('/',auth[_0xb3c8('0x6')](),controller[_0xb3c8('0x7')]);router['get'](_0xb3c8('0x8'),auth[_0xb3c8('0x6')](),controller['show']);router[_0xb3c8('0x9')]('/',auth[_0xb3c8('0x6')](),controller['create']);router['put'](_0xb3c8('0x8'),auth[_0xb3c8('0x6')](),controller['update']);router[_0xb3c8('0xa')](_0xb3c8('0x8'),auth[_0xb3c8('0x6')](),controller[_0xb3c8('0xb')]);module[_0xb3c8('0xc')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index c18fef3..54226b3 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 _0x75fe=['picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x383cc2,_0x395986){var _0x432d6a=function(_0x3852aa){while(--_0x3852aa){_0x383cc2['push'](_0x383cc2['shift']());}};_0x432d6a(++_0x395986);}(_0x75fe,0x7c));var _0xe75f=function(_0x390523,_0x1abdd7){_0x390523=_0x390523-0x0;var _0xc49092=_0x75fe[_0x390523];return _0xc49092;};'use strict';var Sequelize=require(_0xe75f('0x0'));module[_0xe75f('0x1')]={'type':{'type':Sequelize[_0xe75f('0x2')]('string',_0xe75f('0x3'),_0xe75f('0x4'),_0xe75f('0x5'),_0xe75f('0x6')),'defaultValue':_0xe75f('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xe75f('0x2')](_0xe75f('0x7'),_0xe75f('0x3'),_0xe75f('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xe75f('0x8')]},'nameField':{'type':Sequelize[_0xe75f('0x8')]},'customField':{'type':Sequelize[_0xe75f('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5075=['sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3addef,_0x37deb2){var _0x3a2b8e=function(_0x21fa4d){while(--_0x21fa4d){_0x3addef['push'](_0x3addef['shift']());}};_0x3a2b8e(++_0x37deb2);}(_0x5075,0xdc));var _0x5507=function(_0xea9e1c,_0x577088){_0xea9e1c=_0xea9e1c-0x0;var _0x3bdb61=_0x5075[_0xea9e1c];return _0x3bdb61;};'use strict';var Sequelize=require(_0x5507('0x0'));module[_0x5507('0x1')]={'type':{'type':Sequelize[_0x5507('0x2')](_0x5507('0x3'),'variable',_0x5507('0x4'),_0x5507('0x5'),_0x5507('0x6')),'defaultValue':_0x5507('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x5507('0x7')]},'keyType':{'type':Sequelize[_0x5507('0x2')](_0x5507('0x3'),_0x5507('0x8'),_0x5507('0x4'))},'keyContent':{'type':Sequelize[_0x5507('0x7')]},'idField':{'type':Sequelize[_0x5507('0x7')]},'nameField':{'type':Sequelize[_0x5507('0x7')]},'customField':{'type':Sequelize[_0x5507('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5507('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index a55a1c8..d97345b 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 _0x93cc=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','ZohoField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','rows','catch','show','includeAll','find','create','body','params','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x5ad075,_0x169bc2){var _0x1114bd=function(_0x4e3d0d){while(--_0x4e3d0d){_0x5ad075['push'](_0x5ad075['shift']());}};_0x1114bd(++_0x169bc2);}(_0x93cc,0xc7));var _0xc93c=function(_0x4871d7,_0x104a54){_0x4871d7=_0x4871d7-0x0;var _0x25faf0=_0x93cc[_0x4871d7];return _0x25faf0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc93c('0x0'));var rp=require(_0xc93c('0x1'));var moment=require(_0xc93c('0x2'));var BPromise=require(_0xc93c('0x3'));var Mustache=require(_0xc93c('0x4'));var util=require(_0xc93c('0x5'));var path=require('path');var sox=require(_0xc93c('0x6'));var csv=require(_0xc93c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc93c('0x8'));var _=require('lodash');var squel=require(_0xc93c('0x9'));var crypto=require(_0xc93c('0xa'));var jsforce=require(_0xc93c('0xb'));var deskjs=require(_0xc93c('0xc'));var toCsv=require(_0xc93c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc93c('0xd'));var authService=require(_0xc93c('0xe'));var qs=require(_0xc93c('0xf'));var as=require(_0xc93c('0x10'));var hardwareService=require(_0xc93c('0x11'));var logger=require(_0xc93c('0x12'))(_0xc93c('0x13'));var utils=require(_0xc93c('0x14'));var config=require(_0xc93c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc93c('0x16'))['db'];function respondWithStatusCode(_0x17243b,_0x23b16d){_0x23b16d=_0x23b16d||0xcc;return function(_0x5b2439){if(_0x5b2439){return _0x17243b[_0xc93c('0x17')](_0x23b16d);}return _0x17243b['status'](_0x23b16d)[_0xc93c('0x18')]();};}function respondWithResult(_0x10c37b,_0x1079fc){_0x1079fc=_0x1079fc||0xc8;return function(_0x5a5eaf){if(_0x5a5eaf){return _0x10c37b[_0xc93c('0x19')](_0x1079fc)[_0xc93c('0x1a')](_0x5a5eaf);}};}function respondWithFilteredResult(_0x4f83cb,_0x39480c){return function(_0x38da87){if(_0x38da87){var _0x803ad0=typeof _0x39480c[_0xc93c('0x1b')]===_0xc93c('0x1c')&&typeof _0x39480c['limit']===_0xc93c('0x1c');var _0x14e453=_0x38da87[_0xc93c('0x1d')];var _0x1992ce=_0x803ad0?0x0:_0x39480c[_0xc93c('0x1b')];var _0x465170=_0x803ad0?_0x38da87[_0xc93c('0x1d')]:_0x39480c[_0xc93c('0x1b')]+_0x39480c[_0xc93c('0x1e')];var _0x233760;if(_0x465170>=_0x14e453){_0x465170=_0x14e453;_0x233760=0xc8;}else{_0x233760=0xce;}_0x4f83cb[_0xc93c('0x19')](_0x233760);return _0x4f83cb[_0xc93c('0x1f')](_0xc93c('0x20'),_0x1992ce+'-'+_0x465170+'/'+_0x14e453)[_0xc93c('0x1a')](_0x38da87);}return null;};}function patchUpdates(_0x2d6772){return function(_0x4f6bd9){try{jsonpatch[_0xc93c('0x21')](_0x4f6bd9,_0x2d6772,!![]);}catch(_0x5c2da0){return BPromise[_0xc93c('0x22')](_0x5c2da0);}return _0x4f6bd9[_0xc93c('0x23')]();};}function saveUpdates(_0x138724,_0x1cc7e8){return function(_0x5c1437){if(_0x5c1437){return _0x5c1437[_0xc93c('0x24')](_0x138724)[_0xc93c('0x25')](function(_0x1d58df){return _0x1d58df;});}return null;};}function removeEntity(_0x380d9e,_0x29231b){return function(_0x7c487d){if(_0x7c487d){return _0x7c487d[_0xc93c('0x26')]()[_0xc93c('0x25')](function(){_0x380d9e[_0xc93c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x354823,_0xc04485){return function(_0x16db66){if(!_0x16db66){_0x354823[_0xc93c('0x17')](0x194);}return _0x16db66;};}function handleError(_0x338fab,_0x2cb8fc){_0x2cb8fc=_0x2cb8fc||0x1f4;return function(_0x9efb6a){logger[_0xc93c('0x27')](_0x9efb6a[_0xc93c('0x28')]);if(_0x9efb6a[_0xc93c('0x29')]){delete _0x9efb6a[_0xc93c('0x29')];}_0x338fab[_0xc93c('0x19')](_0x2cb8fc)['send'](_0x9efb6a);};}exports['index']=function(_0x5671c8,_0x4d9af0){var _0x550269={},_0x535c42={},_0x299890={'count':0x0,'rows':[]};var _0x112f82=_[_0xc93c('0x2a')](db[_0xc93c('0x2b')][_0xc93c('0x2c')],function(_0x13d8eb){return{'name':_0x13d8eb[_0xc93c('0x2d')],'type':_0x13d8eb['type'][_0xc93c('0x2e')]};});_0x535c42[_0xc93c('0x2f')]=_[_0xc93c('0x2a')](_0x112f82,'name');_0x535c42[_0xc93c('0x30')]=_[_0xc93c('0x31')](_0x5671c8[_0xc93c('0x30')]);_0x535c42[_0xc93c('0x32')]=_[_0xc93c('0x33')](_0x535c42['model'],_0x535c42[_0xc93c('0x30')]);_0x550269['attributes']=_[_0xc93c('0x33')](_0x535c42[_0xc93c('0x2f')],qs[_0xc93c('0x34')](_0x5671c8[_0xc93c('0x30')]['fields']));_0x550269[_0xc93c('0x35')]=_0x550269[_0xc93c('0x35')][_0xc93c('0x36')]?_0x550269['attributes']:_0x535c42[_0xc93c('0x2f')];if(!_0x5671c8[_0xc93c('0x30')][_0xc93c('0x37')]('nolimit')){_0x550269[_0xc93c('0x1e')]=qs[_0xc93c('0x1e')](_0x5671c8['query']['limit']);_0x550269[_0xc93c('0x1b')]=qs['offset'](_0x5671c8[_0xc93c('0x30')][_0xc93c('0x1b')]);}_0x550269[_0xc93c('0x38')]=qs[_0xc93c('0x39')](_0x5671c8[_0xc93c('0x30')][_0xc93c('0x39')]);_0x550269[_0xc93c('0x3a')]=qs[_0xc93c('0x32')](_[_0xc93c('0x3b')](_0x5671c8[_0xc93c('0x30')],_0x535c42[_0xc93c('0x32')]),_0x112f82);if(_0x5671c8[_0xc93c('0x30')][_0xc93c('0x3c')]){_0x550269['where']=_[_0xc93c('0x3d')](_0x550269['where'],{'$or':_[_0xc93c('0x2a')](_0x112f82,function(_0x1ec3bf){if(_0x1ec3bf[_0xc93c('0x3e')]!==_0xc93c('0x3f')){var _0x8b59ca={};_0x8b59ca[_0x1ec3bf['name']]={'$like':'%'+_0x5671c8['query']['filter']+'%'};return _0x8b59ca;}})});}_0x550269=_[_0xc93c('0x3d')]({},_0x550269,_0x5671c8[_0xc93c('0x40')]);var _0x3f3fa2={'where':_0x550269[_0xc93c('0x3a')]};return db['ZohoField'][_0xc93c('0x1d')](_0x3f3fa2)[_0xc93c('0x25')](function(_0x5bdcd6){_0x299890[_0xc93c('0x1d')]=_0x5bdcd6;if(_0x5671c8['query']['includeAll']){_0x550269['include']=[{'all':!![]}];}return db[_0xc93c('0x2b')]['findAll'](_0x550269);})['then'](function(_0x58038d){_0x299890[_0xc93c('0x41')]=_0x58038d;return _0x299890;})[_0xc93c('0x25')](respondWithFilteredResult(_0x4d9af0,_0x550269))[_0xc93c('0x42')](handleError(_0x4d9af0,null));};exports[_0xc93c('0x43')]=function(_0x12d016,_0x3c4dd7){var _0x3ff83a={'raw':!![],'where':{'id':_0x12d016['params']['id']}},_0x202649={};_0x202649['model']=_[_0xc93c('0x31')](db[_0xc93c('0x2b')][_0xc93c('0x2c')]);_0x202649[_0xc93c('0x30')]=_[_0xc93c('0x31')](_0x12d016['query']);_0x202649[_0xc93c('0x32')]=_[_0xc93c('0x33')](_0x202649['model'],_0x202649[_0xc93c('0x30')]);_0x3ff83a['attributes']=_[_0xc93c('0x33')](_0x202649[_0xc93c('0x2f')],qs[_0xc93c('0x34')](_0x12d016[_0xc93c('0x30')]['fields']));_0x3ff83a[_0xc93c('0x35')]=_0x3ff83a[_0xc93c('0x35')][_0xc93c('0x36')]?_0x3ff83a[_0xc93c('0x35')]:_0x202649[_0xc93c('0x2f')];if(_0x12d016[_0xc93c('0x30')][_0xc93c('0x44')]){_0x3ff83a['include']=[{'all':!![]}];}_0x3ff83a=_[_0xc93c('0x3d')]({},_0x3ff83a,_0x12d016['options']);return db['ZohoField'][_0xc93c('0x45')](_0x3ff83a)[_0xc93c('0x25')](handleEntityNotFound(_0x3c4dd7,null))[_0xc93c('0x25')](respondWithResult(_0x3c4dd7,null))['catch'](handleError(_0x3c4dd7,null));};exports['create']=function(_0x25bd2a,_0x507cd8){return db['ZohoField'][_0xc93c('0x46')](_0x25bd2a[_0xc93c('0x47')],{})[_0xc93c('0x25')](respondWithResult(_0x507cd8,0xc9))[_0xc93c('0x42')](handleError(_0x507cd8,null));};exports[_0xc93c('0x24')]=function(_0x16aff0,_0x23638b){if(_0x16aff0['body']['id']){delete _0x16aff0[_0xc93c('0x47')]['id'];}return db[_0xc93c('0x2b')][_0xc93c('0x45')]({'where':{'id':_0x16aff0[_0xc93c('0x48')]['id']}})['then'](handleEntityNotFound(_0x23638b,null))[_0xc93c('0x25')](saveUpdates(_0x16aff0[_0xc93c('0x47')],null))[_0xc93c('0x25')](respondWithResult(_0x23638b,null))[_0xc93c('0x42')](handleError(_0x23638b,null));};exports[_0xc93c('0x26')]=function(_0x27a20d,_0x8ce294){return db[_0xc93c('0x2b')][_0xc93c('0x45')]({'where':{'id':_0x27a20d[_0xc93c('0x48')]['id']}})[_0xc93c('0x25')](handleEntityNotFound(_0x8ce294,null))[_0xc93c('0x25')](removeEntity(_0x8ce294,null))[_0xc93c('0x42')](handleError(_0x8ce294,null));}; \ No newline at end of file +var _0xc9d7=['limit','count','offset','set','Content-Range','apply','update','then','stack','name','index','map','ZohoField','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','filter','merge','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x59dd83,_0x573f1b){var _0x5dd0de=function(_0x1c805d){while(--_0x1c805d){_0x59dd83['push'](_0x59dd83['shift']());}};_0x5dd0de(++_0x573f1b);}(_0xc9d7,0x149));var _0x7c9d=function(_0x2e3107,_0x25f970){_0x2e3107=_0x2e3107-0x0;var _0x833d69=_0xc9d7[_0x2e3107];return _0x833d69;};'use strict';var emlformat=require(_0x7c9d('0x0'));var rimraf=require(_0x7c9d('0x1'));var zipdir=require(_0x7c9d('0x2'));var jsonpatch=require(_0x7c9d('0x3'));var rp=require(_0x7c9d('0x4'));var moment=require(_0x7c9d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x7c9d('0x6'));var util=require(_0x7c9d('0x7'));var path=require(_0x7c9d('0x8'));var sox=require(_0x7c9d('0x9'));var csv=require(_0x7c9d('0xa'));var ejs=require(_0x7c9d('0xb'));var fs=require('fs');var fs_extra=require(_0x7c9d('0xc'));var _=require(_0x7c9d('0xd'));var squel=require('squel');var crypto=require(_0x7c9d('0xe'));var jsforce=require(_0x7c9d('0xf'));var deskjs=require(_0x7c9d('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7c9d('0x11'));var Redis=require(_0x7c9d('0x12'));var authService=require(_0x7c9d('0x13'));var qs=require(_0x7c9d('0x14'));var as=require(_0x7c9d('0x15'));var hardwareService=require(_0x7c9d('0x16'));var logger=require(_0x7c9d('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x7c9d('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c9d('0x19'))['db'];function respondWithStatusCode(_0x2bdd8a,_0x12711b){_0x12711b=_0x12711b||0xcc;return function(_0x3eee04){if(_0x3eee04){return _0x2bdd8a[_0x7c9d('0x1a')](_0x12711b);}return _0x2bdd8a[_0x7c9d('0x1b')](_0x12711b)[_0x7c9d('0x1c')]();};}function respondWithResult(_0x40b5a0,_0x1650a0){_0x1650a0=_0x1650a0||0xc8;return function(_0x3f4575){if(_0x3f4575){return _0x40b5a0['status'](_0x1650a0)[_0x7c9d('0x1d')](_0x3f4575);}};}function respondWithFilteredResult(_0x3a9d4f,_0x47b317){return function(_0x2e54b3){if(_0x2e54b3){var _0x5890d0=typeof _0x47b317['offset']===_0x7c9d('0x1e')&&typeof _0x47b317[_0x7c9d('0x1f')]===_0x7c9d('0x1e');var _0x27b810=_0x2e54b3[_0x7c9d('0x20')];var _0x15a71b=_0x5890d0?0x0:_0x47b317[_0x7c9d('0x21')];var _0x5eedeb=_0x5890d0?_0x2e54b3[_0x7c9d('0x20')]:_0x47b317['offset']+_0x47b317[_0x7c9d('0x1f')];var _0x3aecc4;if(_0x5eedeb>=_0x27b810){_0x5eedeb=_0x27b810;_0x3aecc4=0xc8;}else{_0x3aecc4=0xce;}_0x3a9d4f[_0x7c9d('0x1b')](_0x3aecc4);return _0x3a9d4f[_0x7c9d('0x22')](_0x7c9d('0x23'),_0x15a71b+'-'+_0x5eedeb+'/'+_0x27b810)[_0x7c9d('0x1d')](_0x2e54b3);}return null;};}function patchUpdates(_0x5033e9){return function(_0x5b03f8){try{jsonpatch[_0x7c9d('0x24')](_0x5b03f8,_0x5033e9,!![]);}catch(_0xa70fd8){return BPromise['reject'](_0xa70fd8);}return _0x5b03f8['save']();};}function saveUpdates(_0x6b838c,_0x2f67ad){return function(_0x27e628){if(_0x27e628){return _0x27e628[_0x7c9d('0x25')](_0x6b838c)[_0x7c9d('0x26')](function(_0x1bcf0a){return _0x1bcf0a;});}return null;};}function removeEntity(_0x1930bc,_0x25dae0){return function(_0x34b9f8){if(_0x34b9f8){return _0x34b9f8['destroy']()[_0x7c9d('0x26')](function(){_0x1930bc[_0x7c9d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x422436,_0x585d77){return function(_0x33cf65){if(!_0x33cf65){_0x422436[_0x7c9d('0x1a')](0x194);}return _0x33cf65;};}function handleError(_0x2e465d,_0x3b92a4){_0x3b92a4=_0x3b92a4||0x1f4;return function(_0x4bf9d4){logger['error'](_0x4bf9d4[_0x7c9d('0x27')]);if(_0x4bf9d4[_0x7c9d('0x28')]){delete _0x4bf9d4[_0x7c9d('0x28')];}_0x2e465d[_0x7c9d('0x1b')](_0x3b92a4)['send'](_0x4bf9d4);};}exports[_0x7c9d('0x29')]=function(_0xd182fd,_0x3be5ab){var _0x39c59d={},_0xa59df4={},_0x4dd61f={'count':0x0,'rows':[]};var _0x271f94=_[_0x7c9d('0x2a')](db[_0x7c9d('0x2b')][_0x7c9d('0x2c')],function(_0x5c2342){return{'name':_0x5c2342['fieldName'],'type':_0x5c2342[_0x7c9d('0x2d')][_0x7c9d('0x2e')]};});_0xa59df4['model']=_[_0x7c9d('0x2a')](_0x271f94,_0x7c9d('0x28'));_0xa59df4[_0x7c9d('0x2f')]=_[_0x7c9d('0x30')](_0xd182fd[_0x7c9d('0x2f')]);_0xa59df4[_0x7c9d('0x31')]=_[_0x7c9d('0x32')](_0xa59df4[_0x7c9d('0x33')],_0xa59df4[_0x7c9d('0x2f')]);_0x39c59d[_0x7c9d('0x34')]=_['intersection'](_0xa59df4[_0x7c9d('0x33')],qs[_0x7c9d('0x35')](_0xd182fd['query'][_0x7c9d('0x35')]));_0x39c59d['attributes']=_0x39c59d['attributes'][_0x7c9d('0x36')]?_0x39c59d[_0x7c9d('0x34')]:_0xa59df4[_0x7c9d('0x33')];if(!_0xd182fd[_0x7c9d('0x2f')][_0x7c9d('0x37')]('nolimit')){_0x39c59d[_0x7c9d('0x1f')]=qs['limit'](_0xd182fd[_0x7c9d('0x2f')][_0x7c9d('0x1f')]);_0x39c59d[_0x7c9d('0x21')]=qs[_0x7c9d('0x21')](_0xd182fd[_0x7c9d('0x2f')]['offset']);}_0x39c59d['order']=qs[_0x7c9d('0x38')](_0xd182fd['query'][_0x7c9d('0x38')]);_0x39c59d['where']=qs[_0x7c9d('0x31')](_['pick'](_0xd182fd[_0x7c9d('0x2f')],_0xa59df4[_0x7c9d('0x31')]),_0x271f94);if(_0xd182fd[_0x7c9d('0x2f')][_0x7c9d('0x39')]){_0x39c59d['where']=_[_0x7c9d('0x3a')](_0x39c59d[_0x7c9d('0x3b')],{'$or':_[_0x7c9d('0x2a')](_0x271f94,function(_0x2b15b3){if(_0x2b15b3[_0x7c9d('0x2d')]!==_0x7c9d('0x3c')){var _0xe40305={};_0xe40305[_0x2b15b3[_0x7c9d('0x28')]]={'$like':'%'+_0xd182fd[_0x7c9d('0x2f')]['filter']+'%'};return _0xe40305;}})});}_0x39c59d=_[_0x7c9d('0x3a')]({},_0x39c59d,_0xd182fd[_0x7c9d('0x3d')]);var _0x2e42d2={'where':_0x39c59d['where']};return db[_0x7c9d('0x2b')][_0x7c9d('0x20')](_0x2e42d2)[_0x7c9d('0x26')](function(_0x4daa5e){_0x4dd61f['count']=_0x4daa5e;if(_0xd182fd['query'][_0x7c9d('0x3e')]){_0x39c59d[_0x7c9d('0x3f')]=[{'all':!![]}];}return db['ZohoField'][_0x7c9d('0x40')](_0x39c59d);})[_0x7c9d('0x26')](function(_0x270f7c){_0x4dd61f[_0x7c9d('0x41')]=_0x270f7c;return _0x4dd61f;})[_0x7c9d('0x26')](respondWithFilteredResult(_0x3be5ab,_0x39c59d))[_0x7c9d('0x42')](handleError(_0x3be5ab,null));};exports['show']=function(_0x518d3e,_0x5b8bff){var _0x39a5c8={'raw':!![],'where':{'id':_0x518d3e[_0x7c9d('0x43')]['id']}},_0x3fa8de={};_0x3fa8de[_0x7c9d('0x33')]=_['keys'](db[_0x7c9d('0x2b')][_0x7c9d('0x2c')]);_0x3fa8de[_0x7c9d('0x2f')]=_['keys'](_0x518d3e['query']);_0x3fa8de[_0x7c9d('0x31')]=_[_0x7c9d('0x32')](_0x3fa8de['model'],_0x3fa8de['query']);_0x39a5c8[_0x7c9d('0x34')]=_[_0x7c9d('0x32')](_0x3fa8de['model'],qs[_0x7c9d('0x35')](_0x518d3e[_0x7c9d('0x2f')]['fields']));_0x39a5c8['attributes']=_0x39a5c8['attributes'][_0x7c9d('0x36')]?_0x39a5c8[_0x7c9d('0x34')]:_0x3fa8de[_0x7c9d('0x33')];if(_0x518d3e['query'][_0x7c9d('0x3e')]){_0x39a5c8[_0x7c9d('0x3f')]=[{'all':!![]}];}_0x39a5c8=_[_0x7c9d('0x3a')]({},_0x39a5c8,_0x518d3e['options']);return db[_0x7c9d('0x2b')][_0x7c9d('0x44')](_0x39a5c8)['then'](handleEntityNotFound(_0x5b8bff,null))[_0x7c9d('0x26')](respondWithResult(_0x5b8bff,null))['catch'](handleError(_0x5b8bff,null));};exports[_0x7c9d('0x45')]=function(_0x2e9409,_0x18fd9d){return db[_0x7c9d('0x2b')][_0x7c9d('0x45')](_0x2e9409['body'],{})[_0x7c9d('0x26')](respondWithResult(_0x18fd9d,0xc9))[_0x7c9d('0x42')](handleError(_0x18fd9d,null));};exports[_0x7c9d('0x25')]=function(_0x57e628,_0x57717d){if(_0x57e628[_0x7c9d('0x46')]['id']){delete _0x57e628['body']['id'];}return db[_0x7c9d('0x2b')][_0x7c9d('0x44')]({'where':{'id':_0x57e628[_0x7c9d('0x43')]['id']}})[_0x7c9d('0x26')](handleEntityNotFound(_0x57717d,null))[_0x7c9d('0x26')](saveUpdates(_0x57e628['body'],null))['then'](respondWithResult(_0x57717d,null))['catch'](handleError(_0x57717d,null));};exports[_0x7c9d('0x47')]=function(_0x42450d,_0x2af384){return db[_0x7c9d('0x2b')][_0x7c9d('0x44')]({'where':{'id':_0x42450d[_0x7c9d('0x43')]['id']}})[_0x7c9d('0x26')](handleEntityNotFound(_0x2af384,null))[_0x7c9d('0x26')](removeEntity(_0x2af384,null))[_0x7c9d('0x42')](handleError(_0x2af384,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index f5e9207..f643ac9 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 _0x1967=['bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','define','ZohoField','int_zoho_fields','zoho_unique_index','FieldId','util','../../config/logger','api','moment'];(function(_0x590c2f,_0x423f9b){var _0x299c93=function(_0x850e09){while(--_0x850e09){_0x590c2f['push'](_0x590c2f['shift']());}};_0x299c93(++_0x423f9b);}(_0x1967,0x173));var _0x7196=function(_0x1b9cc2,_0x1f3c7e){_0x1b9cc2=_0x1b9cc2-0x0;var _0x1bcb02=_0x1967[_0x1b9cc2];return _0x1bcb02;};'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':['idField',_0x7196('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['int_zoho_fields','idField','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./intZohoField.attributes','exports','ZohoField'];(function(_0x88e141,_0x58a0fc){var _0x1e75d6=function(_0xd21bfa){while(--_0xd21bfa){_0x88e141['push'](_0x88e141['shift']());}};_0x1e75d6(++_0x58a0fc);}(_0x7a54,0x106));var _0x47a5=function(_0x13567b,_0x1c7b26){_0x13567b=_0x13567b-0x0;var _0x276460=_0x7a54[_0x13567b];return _0x276460;};'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':'zoho_unique_index','fields':[_0x47a5('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 8d62d8b..52263f3 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 _0x05cc=['jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1adb22,_0x260530){var _0x2ebffc=function(_0x590a80){while(--_0x590a80){_0x1adb22['push'](_0x1adb22['shift']());}};_0x2ebffc(++_0x260530);}(_0x05cc,0x1ed));var _0xc05c=function(_0x23b9f8,_0x39b479){_0x23b9f8=_0x23b9f8-0x0;var _0x323ea5=_0x05cc[_0x23b9f8];return _0x323ea5;};'use strict';var _=require(_0xc05c('0x0'));var util=require(_0xc05c('0x1'));var moment=require(_0xc05c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc05c('0x3'))['db'];var utils=require(_0xc05c('0x4'));var logger=require(_0xc05c('0x5'))('rpc');var config=require(_0xc05c('0x6'));var jayson=require(_0xc05c('0x7'));var client=jayson[_0xc05c('0x8')][_0xc05c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x910b61,_0x1dc262,_0x88a958){return new BPromise(function(_0x32e573,_0x31c309){return client['request'](_0x910b61,_0x88a958)['then'](function(_0x4b9b7b){logger[_0xc05c('0xa')](_0xc05c('0xb'),_0x1dc262,_0xc05c('0xc'));logger[_0xc05c('0xd')](_0xc05c('0xe'),_0x1dc262,_0xc05c('0xc'),JSON[_0xc05c('0xf')](_0x4b9b7b));if(_0x4b9b7b['error']){if(_0x4b9b7b[_0xc05c('0x10')]['code']===0x1f4){logger[_0xc05c('0x10')](_0xc05c('0xb'),_0x1dc262,_0x4b9b7b['error']['message']);return _0x31c309(_0x4b9b7b[_0xc05c('0x10')][_0xc05c('0x11')]);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1dc262,_0x4b9b7b['error'][_0xc05c('0x11')]);return _0x32e573(_0x4b9b7b[_0xc05c('0x10')][_0xc05c('0x11')]);}else{logger[_0xc05c('0xa')](_0xc05c('0xb'),_0x1dc262,_0xc05c('0xc'));_0x32e573(_0x4b9b7b[_0xc05c('0x12')]['message']);}})[_0xc05c('0x13')](function(_0x1d80bb){logger[_0xc05c('0x10')](_0xc05c('0xb'),_0x1dc262,_0x1d80bb);_0x31c309(_0x1d80bb);});});} \ No newline at end of file +var _0x3e17=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment'];(function(_0x146376,_0x45ee99){var _0x59b945=function(_0x146cee){while(--_0x146cee){_0x146376['push'](_0x146376['shift']());}};_0x59b945(++_0x45ee99);}(_0x3e17,0x98));var _0x73e1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3e17[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x73e1('0x0'));var moment=require(_0x73e1('0x1'));var BPromise=require(_0x73e1('0x2'));var rs=require(_0x73e1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73e1('0x4'))['db'];var utils=require(_0x73e1('0x5'));var logger=require(_0x73e1('0x6'))(_0x73e1('0x7'));var config=require(_0x73e1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x73e1('0x9')][_0x73e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x383e49,_0x31fb49,_0x5bc982){return new BPromise(function(_0x2f0cbf,_0x2fa7bf){return client[_0x73e1('0xb')](_0x383e49,_0x5bc982)[_0x73e1('0xc')](function(_0x592bc5){logger[_0x73e1('0xd')](_0x73e1('0xe'),_0x31fb49,_0x73e1('0xf'));logger[_0x73e1('0x10')](_0x73e1('0x11'),_0x31fb49,_0x73e1('0xf'),JSON[_0x73e1('0x12')](_0x592bc5));if(_0x592bc5[_0x73e1('0x13')]){if(_0x592bc5['error']['code']===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x31fb49,_0x592bc5[_0x73e1('0x13')][_0x73e1('0x14')]);return _0x2fa7bf(_0x592bc5[_0x73e1('0x13')][_0x73e1('0x14')]);}logger[_0x73e1('0x13')](_0x73e1('0xe'),_0x31fb49,_0x592bc5['error'][_0x73e1('0x14')]);return _0x2f0cbf(_0x592bc5[_0x73e1('0x13')]['message']);}else{logger[_0x73e1('0xd')](_0x73e1('0xe'),_0x31fb49,_0x73e1('0xf'));_0x2f0cbf(_0x592bc5['result'][_0x73e1('0x14')]);}})[_0x73e1('0x15')](function(_0x3706f7){logger[_0x73e1('0x13')]('ZohoField,\x20%s,\x20%s',_0x31fb49,_0x3706f7);_0x2fa7bf(_0x3706f7);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 2bf0fa7..805fc66 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x11d59d,_0x428b23){var _0xb7d17a=function(_0x6a1e1d){while(--_0x6a1e1d){_0x11d59d['push'](_0x11d59d['shift']());}};_0xb7d17a(++_0x428b23);}(_0x70e0,0x17b));var _0x070e=function(_0x459013,_0x4b08bc){_0x459013=_0x459013-0x0;var _0x3889e4=_0x70e0[_0x459013];return _0x3889e4;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x2e50d4,_0x5c7b26){var _0x3a6c2b=function(_0x253008){while(--_0x253008){_0x2e50d4['push'](_0x2e50d4['shift']());}};_0x3a6c2b(++_0x5c7b26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3a8dc1,_0x2f03b8){_0x3a8dc1=_0x3a8dc1-0x0;var _0x4b3595=_0xcb91[_0x3a8dc1];return _0x4b3595;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 369887a..4d7a640 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 _0xfabf=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER'];(function(_0x102c5f,_0x1cfd18){var _0x478d4a=function(_0x399fe8){while(--_0x399fe8){_0x102c5f['push'](_0x102c5f['shift']());}};_0x478d4a(++_0x1cfd18);}(_0xfabf,0x11a));var _0xffab=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xfabf[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xffab('0x0'));module[_0xffab('0x1')]={'name':{'type':Sequelize[_0xffab('0x2')],'allowNull':![],'unique':_0xffab('0x3')},'version':{'type':Sequelize[_0xffab('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xffab('0x2')],'defaultValue':_0xffab('0x4')},'filename':{'type':Sequelize[_0xffab('0x2')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xffab('0x2')]},'size':{'type':Sequelize[_0xffab('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0xffab('0x2')]},'logo':{'type':Sequelize[_0xffab('0x2')]},'state':{'type':Sequelize[_0xffab('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xffab('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0x18ad=['app.js','BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version'];(function(_0x5ab50b,_0x219981){var _0xe4c813=function(_0x3c33b8){while(--_0x3c33b8){_0x5ab50b['push'](_0x5ab50b['shift']());}};_0xe4c813(++_0x219981);}(_0x18ad,0x1bc));var _0xd18a=function(_0x4849f6,_0x104836){_0x4849f6=_0x4849f6-0x0;var _0x1a3dcd=_0x18ad[_0x4849f6];return _0x1a3dcd;};'use strict';var Sequelize=require(_0xd18a('0x0'));module[_0xd18a('0x1')]={'name':{'type':Sequelize[_0xd18a('0x2')],'allowNull':![],'unique':_0xd18a('0x3')},'version':{'type':Sequelize[_0xd18a('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0xd18a('0x4')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize[_0xd18a('0x2')]},'type':{'type':Sequelize[_0xd18a('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0xd18a('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd18a('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xd18a('0x2')],'unique':_0xd18a('0x6')},'description':{'type':Sequelize[_0xd18a('0x2')]},'title':{'type':Sequelize[_0xd18a('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 39c780c..48fe5ac 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 _0xe2fe=['include','catch','show','find','body','params','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','api','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','name','send','index','map','Integration','rawAttributes','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xee2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xee2f('0x1'));var rp=require('request-promise');var moment=require(_0xee2f('0x2'));var BPromise=require(_0xee2f('0x3'));var Mustache=require(_0xee2f('0x4'));var util=require(_0xee2f('0x5'));var path=require(_0xee2f('0x6'));var sox=require('sox');var csv=require(_0xee2f('0x7'));var ejs=require(_0xee2f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xee2f('0x9'));var squel=require(_0xee2f('0xa'));var crypto=require('crypto');var jsforce=require(_0xee2f('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xee2f('0x7'));var querystring=require(_0xee2f('0xc'));var Papa=require('papaparse');var Redis=require(_0xee2f('0xd'));var authService=require(_0xee2f('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee2f('0xf'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xee2f('0x10'))['db'];function respondWithStatusCode(_0x346dbc,_0xa13e7b){_0xa13e7b=_0xa13e7b||0xcc;return function(_0x100449){if(_0x100449){return _0x346dbc[_0xee2f('0x11')](_0xa13e7b);}return _0x346dbc[_0xee2f('0x12')](_0xa13e7b)['end']();};}function respondWithResult(_0x3861e6,_0x531c3a){_0x531c3a=_0x531c3a||0xc8;return function(_0x36db10){if(_0x36db10){return _0x3861e6[_0xee2f('0x12')](_0x531c3a)['json'](_0x36db10);}};}function respondWithFilteredResult(_0x445ba8,_0x145241){return function(_0x28b614){if(_0x28b614){var _0x1bbf7d=typeof _0x145241[_0xee2f('0x13')]==='undefined'&&typeof _0x145241[_0xee2f('0x14')]==='undefined';var _0x17d288=_0x28b614[_0xee2f('0x15')];var _0x502eb6=_0x1bbf7d?0x0:_0x145241['offset'];var _0x40b5bc=_0x1bbf7d?_0x28b614['count']:_0x145241[_0xee2f('0x13')]+_0x145241[_0xee2f('0x14')];var _0x28549d;if(_0x40b5bc>=_0x17d288){_0x40b5bc=_0x17d288;_0x28549d=0xc8;}else{_0x28549d=0xce;}_0x445ba8['status'](_0x28549d);return _0x445ba8[_0xee2f('0x16')](_0xee2f('0x17'),_0x502eb6+'-'+_0x40b5bc+'/'+_0x17d288)[_0xee2f('0x18')](_0x28b614);}return null;};}function patchUpdates(_0x21fdf4){return function(_0x3d892d){try{jsonpatch['apply'](_0x3d892d,_0x21fdf4,!![]);}catch(_0x5e73ad){return BPromise[_0xee2f('0x19')](_0x5e73ad);}return _0x3d892d[_0xee2f('0x1a')]();};}function saveUpdates(_0x1ea808,_0x203b2f){return function(_0x472e3b){if(_0x472e3b){return _0x472e3b[_0xee2f('0x1b')](_0x1ea808)[_0xee2f('0x1c')](function(_0x4d68d3){return _0x4d68d3;});}return null;};}function removeEntity(_0x250399,_0x2c47c5){return function(_0x15ceda){if(_0x15ceda){return _0x15ceda[_0xee2f('0x1d')]()[_0xee2f('0x1c')](function(){_0x250399[_0xee2f('0x12')](0xcc)[_0xee2f('0x1e')]();});}};}function handleEntityNotFound(_0x13013f,_0x382174){return function(_0x1e394f){if(!_0x1e394f){_0x13013f[_0xee2f('0x11')](0x194);}return _0x1e394f;};}function handleError(_0x168adc,_0x1c8454){_0x1c8454=_0x1c8454||0x1f4;return function(_0x45c4a0){logger['error'](_0x45c4a0['stack']);if(_0x45c4a0['name']){delete _0x45c4a0[_0xee2f('0x1f')];}_0x168adc[_0xee2f('0x12')](_0x1c8454)[_0xee2f('0x20')](_0x45c4a0);};}exports[_0xee2f('0x21')]=function(_0x892a4e,_0x3737fd){var _0x4d8398={},_0x3d3806={},_0x52e1fa={'count':0x0,'rows':[]};var _0x235697=_[_0xee2f('0x22')](db[_0xee2f('0x23')][_0xee2f('0x24')],function(_0x3ddbe3){return{'name':_0x3ddbe3['fieldName'],'type':_0x3ddbe3[_0xee2f('0x25')][_0xee2f('0x26')]};});_0x3d3806['model']=_['map'](_0x235697,_0xee2f('0x1f'));_0x3d3806['query']=_[_0xee2f('0x27')](_0x892a4e[_0xee2f('0x28')]);_0x3d3806['filters']=_[_0xee2f('0x29')](_0x3d3806['model'],_0x3d3806['query']);_0x4d8398['attributes']=_[_0xee2f('0x29')](_0x3d3806[_0xee2f('0x2a')],qs['fields'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x2b')]));_0x4d8398[_0xee2f('0x2c')]=_0x4d8398[_0xee2f('0x2c')][_0xee2f('0x2d')]?_0x4d8398['attributes']:_0x3d3806[_0xee2f('0x2a')];if(!_0x892a4e['query'][_0xee2f('0x2e')](_0xee2f('0x2f'))){_0x4d8398[_0xee2f('0x14')]=qs['limit'](_0x892a4e[_0xee2f('0x28')]['limit']);_0x4d8398[_0xee2f('0x13')]=qs['offset'](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x13')]);}_0x4d8398[_0xee2f('0x30')]=qs[_0xee2f('0x31')](_0x892a4e[_0xee2f('0x28')][_0xee2f('0x31')]);_0x4d8398[_0xee2f('0x32')]=qs[_0xee2f('0x33')](_[_0xee2f('0x34')](_0x892a4e[_0xee2f('0x28')],_0x3d3806[_0xee2f('0x33')]),_0x235697);if(_0x892a4e['query'][_0xee2f('0x35')]){_0x4d8398['where']=_[_0xee2f('0x36')](_0x4d8398[_0xee2f('0x32')],{'$or':_[_0xee2f('0x22')](_0x235697,function(_0x2cbb89){if(_0x2cbb89[_0xee2f('0x25')]!==_0xee2f('0x37')){var _0x694950={};_0x694950[_0x2cbb89[_0xee2f('0x1f')]]={'$like':'%'+_0x892a4e['query']['filter']+'%'};return _0x694950;}})});}_0x4d8398=_['merge']({},_0x4d8398,_0x892a4e[_0xee2f('0x38')]);var _0x5483ae={'where':_0x4d8398[_0xee2f('0x32')]};return db['Integration']['count'](_0x5483ae)['then'](function(_0x58e361){_0x52e1fa[_0xee2f('0x15')]=_0x58e361;if(_0x892a4e[_0xee2f('0x28')][_0xee2f('0x39')]){_0x4d8398[_0xee2f('0x3a')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x4d8398);})[_0xee2f('0x1c')](function(_0x5e12b7){_0x52e1fa['rows']=_0x5e12b7;return _0x52e1fa;})[_0xee2f('0x1c')](respondWithFilteredResult(_0x3737fd,_0x4d8398))[_0xee2f('0x3b')](handleError(_0x3737fd,null));};exports[_0xee2f('0x3c')]=function(_0x54130b,_0x3bc173){var _0x27c447={'raw':![],'where':{'id':_0x54130b['params']['id']}},_0x19bd4d={};_0x19bd4d['model']=_[_0xee2f('0x27')](db[_0xee2f('0x23')][_0xee2f('0x24')]);_0x19bd4d[_0xee2f('0x28')]=_['keys'](_0x54130b[_0xee2f('0x28')]);_0x19bd4d[_0xee2f('0x33')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],_0x19bd4d[_0xee2f('0x28')]);_0x27c447[_0xee2f('0x2c')]=_[_0xee2f('0x29')](_0x19bd4d[_0xee2f('0x2a')],qs[_0xee2f('0x2b')](_0x54130b[_0xee2f('0x28')]['fields']));_0x27c447['attributes']=_0x27c447['attributes']['length']?_0x27c447[_0xee2f('0x2c')]:_0x19bd4d[_0xee2f('0x2a')];if(_0x54130b[_0xee2f('0x28')][_0xee2f('0x39')]){_0x27c447[_0xee2f('0x3a')]=[{'all':!![]}];}_0x27c447=_['merge']({},_0x27c447,_0x54130b[_0xee2f('0x38')]);return db[_0xee2f('0x23')][_0xee2f('0x3d')](_0x27c447)[_0xee2f('0x1c')](handleEntityNotFound(_0x3bc173,null))['then'](respondWithResult(_0x3bc173,null))['catch'](handleError(_0x3bc173,null));};exports['create']=function(_0x1609f0,_0x54cc44){return db['Integration']['create'](_0x1609f0['body'],{})[_0xee2f('0x1c')](respondWithResult(_0x54cc44,0xc9))[_0xee2f('0x3b')](handleError(_0x54cc44,null));};exports[_0xee2f('0x1b')]=function(_0x584383,_0x22506e){if(_0x584383['body']['id']){delete _0x584383[_0xee2f('0x3e')]['id'];}return db[_0xee2f('0x23')][_0xee2f('0x3d')]({'where':{'id':_0x584383[_0xee2f('0x3f')]['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x22506e,null))['then'](saveUpdates(_0x584383['body'],null))[_0xee2f('0x1c')](respondWithResult(_0x22506e,null))['catch'](handleError(_0x22506e,null));};exports[_0xee2f('0x1d')]=function(_0x282e89,_0x1928f8){return db[_0xee2f('0x23')]['find']({'where':{'id':_0x282e89['params']['id']}})[_0xee2f('0x1c')](handleEntityNotFound(_0x1928f8,null))[_0xee2f('0x1c')](removeEntity(_0x1928f8,null))[_0xee2f('0x3b')](handleError(_0x1928f8,null));}; \ No newline at end of file +var _0x47c5=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','Integration'];(function(_0x5732eb,_0x4578a2){var _0x340cdf=function(_0x313765){while(--_0x313765){_0x5732eb['push'](_0x5732eb['shift']());}};_0x340cdf(++_0x4578a2);}(_0x47c5,0x165));var _0x547c=function(_0x12254f,_0x100cfe){_0x12254f=_0x12254f-0x0;var _0x3a4fa2=_0x47c5[_0x12254f];return _0x3a4fa2;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['Integration'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['Integration']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['Integration'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['Integration'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index a1de98a..b742997 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 _0xf4ec=['path','rimraf','../../config/environment','./integration.attributes','define','Integration','integrations','lodash','moment','bluebird','request-promise'];(function(_0x151b55,_0x3a5852){var _0x1cbc4e=function(_0x141e96){while(--_0x141e96){_0x151b55['push'](_0x151b55['shift']());}};_0x1cbc4e(++_0x3a5852);}(_0xf4ec,0x96));var _0xcf4e=function(_0xd16553,_0x2c400f){_0xd16553=_0xd16553-0x0;var _0x35fdd4=_0xf4ec[_0xd16553];return _0x35fdd4;};'use strict';var _=require(_0xcf4e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xcf4e('0x1'));var BPromise=require(_0xcf4e('0x2'));var rp=require(_0xcf4e('0x3'));var fs=require('fs');var path=require(_0xcf4e('0x4'));var rimraf=require(_0xcf4e('0x5'));var config=require(_0xcf4e('0x6'));var attributes=require(_0xcf4e('0x7'));module['exports']=function(_0x1cdfb2,_0x90447c){return _0x1cdfb2[_0xcf4e('0x8')](_0xcf4e('0x9'),attributes,{'tableName':_0xcf4e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x478d=['lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','Integration','integrations'];(function(_0x79fc3a,_0x2caeca){var _0x580cb8=function(_0x18def0){while(--_0x18def0){_0x79fc3a['push'](_0x79fc3a['shift']());}};_0x580cb8(++_0x2caeca);}(_0x478d,0x84));var _0xd478=function(_0xc4ca21,_0x1b0b4e){_0xc4ca21=_0xc4ca21-0x0;var _0x4f7fe1=_0x478d[_0xc4ca21];return _0x4f7fe1;};'use strict';var _=require(_0xd478('0x0'));var util=require(_0xd478('0x1'));var logger=require(_0xd478('0x2'))(_0xd478('0x3'));var moment=require('moment');var BPromise=require(_0xd478('0x4'));var rp=require(_0xd478('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd478('0x6'));var attributes=require('./integration.attributes');module[_0xd478('0x7')]=function(_0x2910d0,_0x3db653){return _0x2910d0[_0xd478('0x8')](_0xd478('0x9'),attributes,{'tableName':_0xd478('0xa'),'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 918c126..81cf28b 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 _0x9f0e=['../../config/environment','jayson/promise','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x1828ee,_0x5db35c){var _0x26b4b8=function(_0x2b9065){while(--_0x2b9065){_0x1828ee['push'](_0x1828ee['shift']());}};_0x26b4b8(++_0x5db35c);}(_0x9f0e,0x116));var _0xe9f0=function(_0x1c581d,_0x2cbe7a){_0x1c581d=_0x1c581d-0x0;var _0x4dc2a0=_0x9f0e[_0x1c581d];return _0x4dc2a0;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var moment=require(_0xe9f0('0x2'));var BPromise=require(_0xe9f0('0x3'));var rs=require(_0xe9f0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe9f0('0x5'));var logger=require(_0xe9f0('0x6'))(_0xe9f0('0x7'));var config=require(_0xe9f0('0x8'));var jayson=require(_0xe9f0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a17b3,_0x167198,_0xe64a79){return new BPromise(function(_0x4be6a6,_0xf4a256){return client[_0xe9f0('0xa')](_0x3a17b3,_0xe64a79)[_0xe9f0('0xb')](function(_0x3386a8){logger[_0xe9f0('0xc')](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));logger[_0xe9f0('0xf')](_0xe9f0('0x10'),_0x167198,'request\x20sent',JSON[_0xe9f0('0x11')](_0x3386a8));if(_0x3386a8[_0xe9f0('0x12')]){if(_0x3386a8[_0xe9f0('0x12')]['code']===0x1f4){logger[_0xe9f0('0x12')]('Integration,\x20%s,\x20%s',_0x167198,_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);return _0xf4a256(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}logger['error'](_0xe9f0('0xd'),_0x167198,_0x3386a8['error'][_0xe9f0('0x13')]);return _0x4be6a6(_0x3386a8[_0xe9f0('0x12')][_0xe9f0('0x13')]);}else{logger['info'](_0xe9f0('0xd'),_0x167198,_0xe9f0('0xe'));_0x4be6a6(_0x3386a8[_0xe9f0('0x14')]['message']);}})[_0xe9f0('0x15')](function(_0x1e16e0){logger[_0xe9f0('0x12')](_0xe9f0('0xd'),_0x167198,_0x1e16e0);_0xf4a256(_0x1e16e0);});});} \ No newline at end of file +var _0x6d38=['request','then','Integration,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x5acdd4,_0x57a215){var _0x8095ff=function(_0x3ddc69){while(--_0x3ddc69){_0x5acdd4['push'](_0x5acdd4['shift']());}};_0x8095ff(++_0x57a215);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var _=require('lodash');var util=require(_0x86d3('0x0'));var moment=require(_0x86d3('0x1'));var BPromise=require(_0x86d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86d3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d3('0x4'))(_0x86d3('0x5'));var config=require(_0x86d3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x86d3('0x7')][_0x86d3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x33d4aa,_0x2eaa15,_0x47e654){return new BPromise(function(_0x552b07,_0x2aea31){return client[_0x86d3('0x9')](_0x33d4aa,_0x47e654)[_0x86d3('0xa')](function(_0x499640){logger['info'](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2eaa15,_0x86d3('0xc'),JSON[_0x86d3('0xd')](_0x499640));if(_0x499640['error']){if(_0x499640[_0x86d3('0xe')]['code']===0x1f4){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);return _0x2aea31(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x499640['error'][_0x86d3('0xf')]);return _0x552b07(_0x499640[_0x86d3('0xe')][_0x86d3('0xf')]);}else{logger[_0x86d3('0x10')](_0x86d3('0xb'),_0x2eaa15,_0x86d3('0xc'));_0x552b07(_0x499640[_0x86d3('0x11')][_0x86d3('0xf')]);}})['catch'](function(_0x2d5ba9){logger[_0x86d3('0xe')](_0x86d3('0xb'),_0x2eaa15,_0x2d5ba9);_0x2aea31(_0x2d5ba9);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 5c97a4b..3b8cd5d 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 _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x522527,_0xef83ce){var _0x1308a7=function(_0x279dbc){while(--_0x279dbc){_0x522527['push'](_0x522527['shift']());}};_0x1308a7(++_0xef83ce);}(_0xef0f,0x168));var _0xfef0=function(_0x2dae9f,_0x4fe0a7){_0x2dae9f=_0x2dae9f-0x0;var _0xf1501c=_0xef0f[_0x2dae9f];return _0xf1501c;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1a85=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','path','connect-timeout','express','../../components/auth/service'];(function(_0x23165a,_0x19d021){var _0x40c6c4=function(_0x57e397){while(--_0x57e397){_0x23165a['push'](_0x23165a['shift']());}};_0x40c6c4(++_0x19d021);}(_0x1a85,0x178));var _0x51a8=function(_0x5a2d6e,_0x3d3a47){_0x5a2d6e=_0x5a2d6e-0x0;var _0x30ff59=_0x1a85[_0x5a2d6e];return _0x30ff59;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x51a8('0x0'));var timeout=require(_0x51a8('0x1'));var express=require(_0x51a8('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x51a8('0x3'));var interaction=require(_0x51a8('0x4'));var config=require(_0x51a8('0x5'));var controller=require('./integrationReport.controller');router[_0x51a8('0x6')]('/',auth['isAuthenticated'](),controller[_0x51a8('0x7')]);router['get'](_0x51a8('0x8'),auth[_0x51a8('0x9')](),controller['describe']);router[_0x51a8('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x51a8('0xa')]);router[_0x51a8('0xb')]('/',auth[_0x51a8('0x9')](),controller[_0x51a8('0xc')]);router[_0x51a8('0xd')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0xf')]);router[_0x51a8('0x10')](_0x51a8('0xe'),auth[_0x51a8('0x9')](),controller[_0x51a8('0x11')]);module[_0x51a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 910d8d7..5914d74 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 _0x9bb3=['BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE'];(function(_0x354d04,_0x2b4aa3){var _0x51eb0b=function(_0x92623){while(--_0x92623){_0x354d04['push'](_0x354d04['shift']());}};_0x51eb0b(++_0x2b4aa3);}(_0x9bb3,0xdf));var _0x39bb=function(_0x1e7922,_0x25b332){_0x1e7922=_0x1e7922-0x0;var _0x2f179d=_0x9bb3[_0x1e7922];return _0x2f179d;};'use strict';var Sequelize=require(_0x39bb('0x0'));module[_0x39bb('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x39bb('0x2')]},'exitStatus':{'type':Sequelize[_0x39bb('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x39bb('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x39bb('0x2')]},'calleridnum':{'type':Sequelize[_0x39bb('0x2')]},'calleridname':{'type':Sequelize[_0x39bb('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x39bb('0x2')]},'agentcalledAt':{'type':Sequelize[_0x39bb('0x4')]},'agentconnectAt':{'type':Sequelize[_0x39bb('0x4')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x39bb('0x4')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x39bb('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x39bb('0x4')]},'agentdump':{'type':Sequelize[_0x39bb('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x39bb('0x4')]},'lastevent':{'type':Sequelize[_0x39bb('0x2')]},'channel':{'type':Sequelize[_0x39bb('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x39bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x39bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x39bb('0x2')]},'language':{'type':Sequelize[_0x39bb('0x2')]},'accountcode':{'type':Sequelize[_0x39bb('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x39bb('0x2')]},'priority':{'type':Sequelize[_0x39bb('0x2')]},'destchannel':{'type':Sequelize[_0x39bb('0x2')]},'destchannelstate':{'type':Sequelize[_0x39bb('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x39bb('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x39bb('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x39bb('0x2')]},'destlanguage':{'type':Sequelize[_0x39bb('0x2')]},'destaccountcode':{'type':Sequelize[_0x39bb('0x2')]},'destcontext':{'type':Sequelize[_0x39bb('0x2')]},'destexten':{'type':Sequelize[_0x39bb('0x2')]},'destpriority':{'type':Sequelize[_0x39bb('0x2')]},'destuniqueid':{'type':Sequelize[_0x39bb('0x2')]},'messageId':{'type':Sequelize[_0x39bb('0x2')]},'inReplyTo':{'type':Sequelize[_0x39bb('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x39bb('0x2')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x39bb('0x6')]},'html':{'type':Sequelize[_0x39bb('0x6')]},'text':{'type':Sequelize[_0x39bb('0x6')]},'status':{'type':Sequelize[_0x39bb('0x7')](_0x39bb('0x8'),_0x39bb('0x9'),_0x39bb('0xa'),_0x39bb('0xb'))},'url':{'type':Sequelize[_0x39bb('0x2')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x39bb('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5654=['TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x5a4b42,_0x2b9c18){var _0x5e81d6=function(_0x595077){while(--_0x595077){_0x5a4b42['push'](_0x5a4b42['shift']());}};_0x5e81d6(++_0x2b9c18);}(_0x5654,0xa2));var _0x4565=function(_0x4424e7,_0x1e0c40){_0x4424e7=_0x4424e7-0x0;var _0x3da5ba=_0x5654[_0x4424e7];return _0x3da5ba;};'use strict';var Sequelize=require(_0x4565('0x0'));module[_0x4565('0x1')]={'integration':{'type':Sequelize[_0x4565('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0x4565('0x2')]},'ticketId':{'type':Sequelize[_0x4565('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4565('0x2')]},'calleridnum':{'type':Sequelize[_0x4565('0x2')]},'calleridname':{'type':Sequelize[_0x4565('0x2')]},'queue':{'type':Sequelize[_0x4565('0x2')]},'interface':{'type':Sequelize[_0x4565('0x2')]},'membername':{'type':Sequelize[_0x4565('0x2')]},'agentcalledAt':{'type':Sequelize[_0x4565('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4565('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x4565('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4565('0x3')]},'talktime':{'type':Sequelize[_0x4565('0x5')]},'agentacw':{'type':Sequelize[_0x4565('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x4565('0x5')]},'reason':{'type':Sequelize[_0x4565('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4565('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x4565('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize['DATE']},'lastevent':{'type':Sequelize[_0x4565('0x2')]},'channel':{'type':Sequelize[_0x4565('0x2')]},'channelstate':{'type':Sequelize[_0x4565('0x5')]},'channelstatedesc':{'type':Sequelize[_0x4565('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4565('0x2')]},'connectedlinename':{'type':Sequelize[_0x4565('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4565('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x4565('0x2')]},'priority':{'type':Sequelize[_0x4565('0x2')]},'destchannel':{'type':Sequelize[_0x4565('0x2')]},'destchannelstate':{'type':Sequelize[_0x4565('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x4565('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4565('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4565('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4565('0x2')]},'destlanguage':{'type':Sequelize[_0x4565('0x2')]},'destaccountcode':{'type':Sequelize[_0x4565('0x2')]},'destcontext':{'type':Sequelize[_0x4565('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x4565('0x2')]},'destuniqueid':{'type':Sequelize[_0x4565('0x2')]},'messageId':{'type':Sequelize[_0x4565('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x4565('0x2')]},'to':{'type':Sequelize[_0x4565('0x2')]},'cc':{'type':Sequelize[_0x4565('0x2')]},'attachment':{'type':Sequelize[_0x4565('0x6')]},'html':{'type':Sequelize[_0x4565('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x4565('0x7')](_0x4565('0x8'),_0x4565('0x9'),_0x4565('0xa'),_0x4565('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4565('0x2')]},'appdata':{'type':Sequelize[_0x4565('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 be67d2a..e81e88b 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 _0xe892=['json','offset','undefined','count','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','keys','filters','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status'];(function(_0x1f147b,_0x4c2999){var _0x2090d7=function(_0x52d4e4){while(--_0x52d4e4){_0x1f147b['push'](_0x1f147b['shift']());}};_0x2090d7(++_0x4c2999);}(_0xe892,0x7b));var _0x2e89=function(_0x5137c3,_0x417b56){_0x5137c3=_0x5137c3-0x0;var _0x2ce8c9=_0xe892[_0x5137c3];return _0x2ce8c9;};'use strict';var emlformat=require(_0x2e89('0x0'));var rimraf=require(_0x2e89('0x1'));var zipdir=require(_0x2e89('0x2'));var jsonpatch=require(_0x2e89('0x3'));var rp=require(_0x2e89('0x4'));var moment=require(_0x2e89('0x5'));var BPromise=require(_0x2e89('0x6'));var Mustache=require('mustache');var util=require(_0x2e89('0x7'));var path=require(_0x2e89('0x8'));var sox=require(_0x2e89('0x9'));var csv=require('to-csv');var ejs=require(_0x2e89('0xa'));var fs=require('fs');var fs_extra=require(_0x2e89('0xb'));var _=require(_0x2e89('0xc'));var squel=require(_0x2e89('0xd'));var crypto=require(_0x2e89('0xe'));var jsforce=require(_0x2e89('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2e89('0x10'));var querystring=require(_0x2e89('0x11'));var Papa=require(_0x2e89('0x12'));var Redis=require(_0x2e89('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x2e89('0x14'));var hardwareService=require(_0x2e89('0x15'));var logger=require(_0x2e89('0x16'))(_0x2e89('0x17'));var utils=require(_0x2e89('0x18'));var config=require(_0x2e89('0x19'));var licenseUtil=require(_0x2e89('0x1a'));var db=require(_0x2e89('0x1b'))['db'];function respondWithStatusCode(_0x14a594,_0x398cb7){_0x398cb7=_0x398cb7||0xcc;return function(_0x1ff3d2){if(_0x1ff3d2){return _0x14a594['sendStatus'](_0x398cb7);}return _0x14a594[_0x2e89('0x1c')](_0x398cb7)['end']();};}function respondWithResult(_0x1a5190,_0x11cba2){_0x11cba2=_0x11cba2||0xc8;return function(_0x355b44){if(_0x355b44){return _0x1a5190[_0x2e89('0x1c')](_0x11cba2)[_0x2e89('0x1d')](_0x355b44);}};}function respondWithFilteredResult(_0x203974,_0x56e645){return function(_0x172299){if(_0x172299){var _0x1a1615=typeof _0x56e645[_0x2e89('0x1e')]==='undefined'&&typeof _0x56e645['limit']===_0x2e89('0x1f');var _0xb2289f=_0x172299[_0x2e89('0x20')];var _0x4dbd80=_0x1a1615?0x0:_0x56e645['offset'];var _0x4818d7=_0x1a1615?_0x172299['count']:_0x56e645[_0x2e89('0x1e')]+_0x56e645['limit'];var _0x27c97c;if(_0x4818d7>=_0xb2289f){_0x4818d7=_0xb2289f;_0x27c97c=0xc8;}else{_0x27c97c=0xce;}_0x203974[_0x2e89('0x1c')](_0x27c97c);return _0x203974['set'](_0x2e89('0x21'),_0x4dbd80+'-'+_0x4818d7+'/'+_0xb2289f)['json'](_0x172299);}return null;};}function patchUpdates(_0x337627){return function(_0x34c0e0){try{jsonpatch['apply'](_0x34c0e0,_0x337627,!![]);}catch(_0x54dcfd){return BPromise[_0x2e89('0x22')](_0x54dcfd);}return _0x34c0e0['save']();};}function saveUpdates(_0x351948,_0x19d181){return function(_0x31ff87){if(_0x31ff87){return _0x31ff87[_0x2e89('0x23')](_0x351948)[_0x2e89('0x24')](function(_0x506fb8){return _0x506fb8;});}return null;};}function removeEntity(_0x2a399e,_0x21c985){return function(_0x2cb71c){if(_0x2cb71c){return _0x2cb71c[_0x2e89('0x25')]()[_0x2e89('0x24')](function(){_0x2a399e[_0x2e89('0x1c')](0xcc)[_0x2e89('0x26')]();});}};}function handleEntityNotFound(_0x52a3fa,_0x338079){return function(_0x3520a6){if(!_0x3520a6){_0x52a3fa['sendStatus'](0x194);}return _0x3520a6;};}function handleError(_0x3d85ad,_0x350189){_0x350189=_0x350189||0x1f4;return function(_0x214b4e){logger[_0x2e89('0x27')](_0x214b4e[_0x2e89('0x28')]);if(_0x214b4e[_0x2e89('0x29')]){delete _0x214b4e[_0x2e89('0x29')];}_0x3d85ad[_0x2e89('0x1c')](_0x350189)[_0x2e89('0x2a')](_0x214b4e);};}exports[_0x2e89('0x2b')]=function(_0x375a84,_0x3344ff){var _0xdf05a7={},_0x26a341={},_0x24ba8f={'count':0x0,'rows':[]};var _0x564f83=_[_0x2e89('0x2c')](db[_0x2e89('0x2d')][_0x2e89('0x2e')],function(_0x53ecbd){return{'name':_0x53ecbd[_0x2e89('0x2f')],'type':_0x53ecbd[_0x2e89('0x30')]['key']};});_0x26a341[_0x2e89('0x31')]=_['map'](_0x564f83,_0x2e89('0x29'));_0x26a341[_0x2e89('0x32')]=_['keys'](_0x375a84[_0x2e89('0x32')]);_0x26a341['filters']=_[_0x2e89('0x33')](_0x26a341[_0x2e89('0x31')],_0x26a341[_0x2e89('0x32')]);_0xdf05a7[_0x2e89('0x34')]=_[_0x2e89('0x33')](_0x26a341[_0x2e89('0x31')],qs[_0x2e89('0x35')](_0x375a84['query'][_0x2e89('0x35')]));_0xdf05a7['attributes']=_0xdf05a7['attributes'][_0x2e89('0x36')]?_0xdf05a7[_0x2e89('0x34')]:_0x26a341['model'];if(!_0x375a84[_0x2e89('0x32')]['hasOwnProperty'](_0x2e89('0x37'))){_0xdf05a7['limit']=qs[_0x2e89('0x38')](_0x375a84['query'][_0x2e89('0x38')]);_0xdf05a7[_0x2e89('0x1e')]=qs['offset'](_0x375a84[_0x2e89('0x32')][_0x2e89('0x1e')]);}_0xdf05a7[_0x2e89('0x39')]=qs[_0x2e89('0x3a')](_0x375a84[_0x2e89('0x32')][_0x2e89('0x3a')]);_0xdf05a7[_0x2e89('0x3b')]=qs['filters'](_[_0x2e89('0x3c')](_0x375a84[_0x2e89('0x32')],_0x26a341['filters']),_0x564f83);if(_0x375a84[_0x2e89('0x32')][_0x2e89('0x3d')]){_0xdf05a7[_0x2e89('0x3b')]=_[_0x2e89('0x3e')](_0xdf05a7['where'],{'$or':_[_0x2e89('0x2c')](_0x564f83,function(_0xfc4a5c){if(_0xfc4a5c[_0x2e89('0x30')]!=='VIRTUAL'){var _0x1fe2ab={};_0x1fe2ab[_0xfc4a5c[_0x2e89('0x29')]]={'$like':'%'+_0x375a84[_0x2e89('0x32')][_0x2e89('0x3d')]+'%'};return _0x1fe2ab;}})});}_0xdf05a7=_[_0x2e89('0x3e')]({},_0xdf05a7,_0x375a84['options']);var _0xd21759={'where':_0xdf05a7[_0x2e89('0x3b')]};return db[_0x2e89('0x2d')][_0x2e89('0x20')](_0xd21759)[_0x2e89('0x24')](function(_0x24c8b4){_0x24ba8f[_0x2e89('0x20')]=_0x24c8b4;if(_0x375a84[_0x2e89('0x32')][_0x2e89('0x3f')]){_0xdf05a7[_0x2e89('0x40')]=[{'all':!![]}];}return db[_0x2e89('0x2d')][_0x2e89('0x41')](_0xdf05a7);})[_0x2e89('0x24')](function(_0x4ed788){_0x24ba8f[_0x2e89('0x42')]=_0x4ed788;return _0x24ba8f;})[_0x2e89('0x24')](respondWithFilteredResult(_0x3344ff,_0xdf05a7))[_0x2e89('0x43')](handleError(_0x3344ff,null));};exports[_0x2e89('0x44')]=function(_0xe7b084,_0x4c93aa){var _0x40e248={'raw':![],'where':{'id':_0xe7b084['params']['id']}},_0x46a5cf={};_0x46a5cf[_0x2e89('0x31')]=_[_0x2e89('0x45')](db[_0x2e89('0x2d')][_0x2e89('0x2e')]);_0x46a5cf[_0x2e89('0x32')]=_[_0x2e89('0x45')](_0xe7b084['query']);_0x46a5cf[_0x2e89('0x46')]=_[_0x2e89('0x33')](_0x46a5cf[_0x2e89('0x31')],_0x46a5cf[_0x2e89('0x32')]);_0x40e248[_0x2e89('0x34')]=_['intersection'](_0x46a5cf[_0x2e89('0x31')],qs[_0x2e89('0x35')](_0xe7b084[_0x2e89('0x32')][_0x2e89('0x35')]));_0x40e248['attributes']=_0x40e248['attributes'][_0x2e89('0x36')]?_0x40e248[_0x2e89('0x34')]:_0x46a5cf['model'];if(_0xe7b084['query'][_0x2e89('0x3f')]){_0x40e248[_0x2e89('0x40')]=[{'all':!![]}];}_0x40e248=_[_0x2e89('0x3e')]({},_0x40e248,_0xe7b084['options']);return db['IntegrationReport'][_0x2e89('0x47')](_0x40e248)[_0x2e89('0x24')](handleEntityNotFound(_0x4c93aa,null))[_0x2e89('0x24')](respondWithResult(_0x4c93aa,null))[_0x2e89('0x43')](handleError(_0x4c93aa,null));};exports[_0x2e89('0x48')]=function(_0x42315d,_0x32cc6d){return db[_0x2e89('0x2d')][_0x2e89('0x48')](_0x42315d[_0x2e89('0x49')],{})[_0x2e89('0x24')](respondWithResult(_0x32cc6d,0xc9))[_0x2e89('0x43')](handleError(_0x32cc6d,null));};exports['update']=function(_0x3445d5,_0x5da081){if(_0x3445d5[_0x2e89('0x49')]['id']){delete _0x3445d5['body']['id'];}return db[_0x2e89('0x2d')][_0x2e89('0x47')]({'where':{'id':_0x3445d5[_0x2e89('0x4a')]['id']}})[_0x2e89('0x24')](handleEntityNotFound(_0x5da081,null))[_0x2e89('0x24')](saveUpdates(_0x3445d5[_0x2e89('0x49')],null))[_0x2e89('0x24')](respondWithResult(_0x5da081,null))[_0x2e89('0x43')](handleError(_0x5da081,null));};exports[_0x2e89('0x25')]=function(_0xc4b10a,_0x1731a2){return db['IntegrationReport'][_0x2e89('0x47')]({'where':{'id':_0xc4b10a['params']['id']}})[_0x2e89('0x24')](handleEntityNotFound(_0x1731a2,null))[_0x2e89('0x24')](removeEntity(_0x1731a2,null))[_0x2e89('0x43')](handleError(_0x1731a2,null));};exports[_0x2e89('0x4b')]=function(_0x46694d,_0x3eb376){return db[_0x2e89('0x2d')]['describe']()['then'](respondWithResult(_0x3eb376,null))[_0x2e89('0x43')](handleError(_0x3eb376,null));}; \ No newline at end of file +var _0x9638=['status','end','json','offset','undefined','limit','count','set','apply','reject','destroy','then','error','stack','name','send','index','IntegrationReport','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','filters','pick','filter','merge','options','where','includeAll','findAll','rows','catch','params','length','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus'];(function(_0x451d04,_0x999e7d){var _0x32c6fe=function(_0x2be910){while(--_0x2be910){_0x451d04['push'](_0x451d04['shift']());}};_0x32c6fe(++_0x999e7d);}(_0x9638,0x19d));var _0x8963=function(_0x43ee7e,_0x78e09b){_0x43ee7e=_0x43ee7e-0x0;var _0x22d326=_0x9638[_0x43ee7e];return _0x22d326;};'use strict';var emlformat=require(_0x8963('0x0'));var rimraf=require(_0x8963('0x1'));var zipdir=require(_0x8963('0x2'));var jsonpatch=require(_0x8963('0x3'));var rp=require(_0x8963('0x4'));var moment=require(_0x8963('0x5'));var BPromise=require(_0x8963('0x6'));var Mustache=require(_0x8963('0x7'));var util=require('util');var path=require(_0x8963('0x8'));var sox=require(_0x8963('0x9'));var csv=require(_0x8963('0xa'));var ejs=require(_0x8963('0xb'));var fs=require('fs');var fs_extra=require(_0x8963('0xc'));var _=require(_0x8963('0xd'));var squel=require(_0x8963('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8963('0xf'));var toCsv=require(_0x8963('0xa'));var querystring=require(_0x8963('0x10'));var Papa=require(_0x8963('0x11'));var Redis=require(_0x8963('0x12'));var authService=require(_0x8963('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8963('0x14'));var hardwareService=require(_0x8963('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8963('0x16'));var config=require(_0x8963('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x174827,_0x4aef53){_0x4aef53=_0x4aef53||0xcc;return function(_0x2943af){if(_0x2943af){return _0x174827[_0x8963('0x18')](_0x4aef53);}return _0x174827[_0x8963('0x19')](_0x4aef53)[_0x8963('0x1a')]();};}function respondWithResult(_0x30f46f,_0x50ca24){_0x50ca24=_0x50ca24||0xc8;return function(_0x560059){if(_0x560059){return _0x30f46f['status'](_0x50ca24)[_0x8963('0x1b')](_0x560059);}};}function respondWithFilteredResult(_0x202046,_0x24ad1f){return function(_0x29c107){if(_0x29c107){var _0x3c8942=typeof _0x24ad1f[_0x8963('0x1c')]===_0x8963('0x1d')&&typeof _0x24ad1f[_0x8963('0x1e')]===_0x8963('0x1d');var _0x3d9f9f=_0x29c107[_0x8963('0x1f')];var _0x17a105=_0x3c8942?0x0:_0x24ad1f[_0x8963('0x1c')];var _0x1981e5=_0x3c8942?_0x29c107[_0x8963('0x1f')]:_0x24ad1f[_0x8963('0x1c')]+_0x24ad1f[_0x8963('0x1e')];var _0x51abb5;if(_0x1981e5>=_0x3d9f9f){_0x1981e5=_0x3d9f9f;_0x51abb5=0xc8;}else{_0x51abb5=0xce;}_0x202046[_0x8963('0x19')](_0x51abb5);return _0x202046[_0x8963('0x20')]('Content-Range',_0x17a105+'-'+_0x1981e5+'/'+_0x3d9f9f)[_0x8963('0x1b')](_0x29c107);}return null;};}function patchUpdates(_0x47e359){return function(_0x5a2fff){try{jsonpatch[_0x8963('0x21')](_0x5a2fff,_0x47e359,!![]);}catch(_0x1206d3){return BPromise[_0x8963('0x22')](_0x1206d3);}return _0x5a2fff['save']();};}function saveUpdates(_0x16e91c,_0x33561f){return function(_0x463a5a){if(_0x463a5a){return _0x463a5a['update'](_0x16e91c)['then'](function(_0x24edc9){return _0x24edc9;});}return null;};}function removeEntity(_0x2cee2a,_0x5e2ff3){return function(_0x1c5910){if(_0x1c5910){return _0x1c5910[_0x8963('0x23')]()[_0x8963('0x24')](function(){_0x2cee2a[_0x8963('0x19')](0xcc)[_0x8963('0x1a')]();});}};}function handleEntityNotFound(_0x53f3ae,_0x12b73e){return function(_0xc7653e){if(!_0xc7653e){_0x53f3ae['sendStatus'](0x194);}return _0xc7653e;};}function handleError(_0x5c64c4,_0x5bb8ec){_0x5bb8ec=_0x5bb8ec||0x1f4;return function(_0x1dc488){logger[_0x8963('0x25')](_0x1dc488[_0x8963('0x26')]);if(_0x1dc488[_0x8963('0x27')]){delete _0x1dc488[_0x8963('0x27')];}_0x5c64c4[_0x8963('0x19')](_0x5bb8ec)[_0x8963('0x28')](_0x1dc488);};}exports[_0x8963('0x29')]=function(_0x480bcc,_0x475cca){var _0x4cbdad={},_0x385da7={},_0x4edb81={'count':0x0,'rows':[]};var _0x49c83e=_['map'](db[_0x8963('0x2a')][_0x8963('0x2b')],function(_0xed2036){return{'name':_0xed2036[_0x8963('0x2c')],'type':_0xed2036['type'][_0x8963('0x2d')]};});_0x385da7[_0x8963('0x2e')]=_[_0x8963('0x2f')](_0x49c83e,'name');_0x385da7[_0x8963('0x30')]=_[_0x8963('0x31')](_0x480bcc[_0x8963('0x30')]);_0x385da7['filters']=_['intersection'](_0x385da7[_0x8963('0x2e')],_0x385da7['query']);_0x4cbdad[_0x8963('0x32')]=_[_0x8963('0x33')](_0x385da7['model'],qs[_0x8963('0x34')](_0x480bcc[_0x8963('0x30')]['fields']));_0x4cbdad[_0x8963('0x32')]=_0x4cbdad[_0x8963('0x32')]['length']?_0x4cbdad['attributes']:_0x385da7[_0x8963('0x2e')];if(!_0x480bcc['query'][_0x8963('0x35')]('nolimit')){_0x4cbdad['limit']=qs[_0x8963('0x1e')](_0x480bcc['query'][_0x8963('0x1e')]);_0x4cbdad['offset']=qs[_0x8963('0x1c')](_0x480bcc['query'][_0x8963('0x1c')]);}_0x4cbdad[_0x8963('0x36')]=qs[_0x8963('0x37')](_0x480bcc[_0x8963('0x30')][_0x8963('0x37')]);_0x4cbdad['where']=qs[_0x8963('0x38')](_[_0x8963('0x39')](_0x480bcc[_0x8963('0x30')],_0x385da7[_0x8963('0x38')]),_0x49c83e);if(_0x480bcc[_0x8963('0x30')][_0x8963('0x3a')]){_0x4cbdad['where']=_[_0x8963('0x3b')](_0x4cbdad['where'],{'$or':_[_0x8963('0x2f')](_0x49c83e,function(_0x299e26){if(_0x299e26['type']!=='VIRTUAL'){var _0x2bc01c={};_0x2bc01c[_0x299e26[_0x8963('0x27')]]={'$like':'%'+_0x480bcc['query']['filter']+'%'};return _0x2bc01c;}})});}_0x4cbdad=_['merge']({},_0x4cbdad,_0x480bcc[_0x8963('0x3c')]);var _0x3dd2c4={'where':_0x4cbdad[_0x8963('0x3d')]};return db[_0x8963('0x2a')]['count'](_0x3dd2c4)['then'](function(_0x34d9f1){_0x4edb81['count']=_0x34d9f1;if(_0x480bcc[_0x8963('0x30')][_0x8963('0x3e')]){_0x4cbdad['include']=[{'all':!![]}];}return db['IntegrationReport'][_0x8963('0x3f')](_0x4cbdad);})['then'](function(_0x3a6f1c){_0x4edb81[_0x8963('0x40')]=_0x3a6f1c;return _0x4edb81;})[_0x8963('0x24')](respondWithFilteredResult(_0x475cca,_0x4cbdad))[_0x8963('0x41')](handleError(_0x475cca,null));};exports['show']=function(_0x1d1722,_0x5406a8){var _0x47ac67={'raw':![],'where':{'id':_0x1d1722[_0x8963('0x42')]['id']}},_0x592e82={};_0x592e82[_0x8963('0x2e')]=_[_0x8963('0x31')](db[_0x8963('0x2a')][_0x8963('0x2b')]);_0x592e82[_0x8963('0x30')]=_['keys'](_0x1d1722[_0x8963('0x30')]);_0x592e82[_0x8963('0x38')]=_[_0x8963('0x33')](_0x592e82[_0x8963('0x2e')],_0x592e82[_0x8963('0x30')]);_0x47ac67[_0x8963('0x32')]=_[_0x8963('0x33')](_0x592e82[_0x8963('0x2e')],qs[_0x8963('0x34')](_0x1d1722[_0x8963('0x30')][_0x8963('0x34')]));_0x47ac67['attributes']=_0x47ac67[_0x8963('0x32')][_0x8963('0x43')]?_0x47ac67[_0x8963('0x32')]:_0x592e82[_0x8963('0x2e')];if(_0x1d1722['query'][_0x8963('0x3e')]){_0x47ac67[_0x8963('0x44')]=[{'all':!![]}];}_0x47ac67=_[_0x8963('0x3b')]({},_0x47ac67,_0x1d1722[_0x8963('0x3c')]);return db[_0x8963('0x2a')][_0x8963('0x45')](_0x47ac67)[_0x8963('0x24')](handleEntityNotFound(_0x5406a8,null))[_0x8963('0x24')](respondWithResult(_0x5406a8,null))[_0x8963('0x41')](handleError(_0x5406a8,null));};exports[_0x8963('0x46')]=function(_0x4a2faf,_0x48096d){return db['IntegrationReport'][_0x8963('0x46')](_0x4a2faf[_0x8963('0x47')],{})['then'](respondWithResult(_0x48096d,0xc9))['catch'](handleError(_0x48096d,null));};exports['update']=function(_0x3cbb36,_0xf3b178){if(_0x3cbb36[_0x8963('0x47')]['id']){delete _0x3cbb36[_0x8963('0x47')]['id'];}return db[_0x8963('0x2a')][_0x8963('0x45')]({'where':{'id':_0x3cbb36['params']['id']}})['then'](handleEntityNotFound(_0xf3b178,null))[_0x8963('0x24')](saveUpdates(_0x3cbb36['body'],null))['then'](respondWithResult(_0xf3b178,null))[_0x8963('0x41')](handleError(_0xf3b178,null));};exports['destroy']=function(_0x4d6d26,_0x4c4655){return db[_0x8963('0x2a')][_0x8963('0x45')]({'where':{'id':_0x4d6d26[_0x8963('0x42')]['id']}})[_0x8963('0x24')](handleEntityNotFound(_0x4c4655,null))[_0x8963('0x24')](removeEntity(_0x4c4655,null))[_0x8963('0x41')](handleError(_0x4c4655,null));};exports[_0x8963('0x48')]=function(_0xd4d9d4,_0x39ec64){return db[_0x8963('0x2a')]['describe']()[_0x8963('0x24')](respondWithResult(_0x39ec64,null))['catch'](handleError(_0x39ec64,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 96ad0f1..ab5fe43 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 _0xff34=['rimraf','../../config/environment','exports','define','IntegrationReport','report_integration','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xf35672,_0x3833af){var _0x26afcf=function(_0x17132a){while(--_0x17132a){_0xf35672['push'](_0xf35672['shift']());}};_0x26afcf(++_0x3833af);}(_0xff34,0x16e));var _0x4ff3=function(_0x3d4488,_0x1b2b82){_0x3d4488=_0x3d4488-0x0;var _0x4a0548=_0xff34[_0x3d4488];return _0x4a0548;};'use strict';var _=require('lodash');var util=require(_0x4ff3('0x0'));var logger=require(_0x4ff3('0x1'))(_0x4ff3('0x2'));var moment=require(_0x4ff3('0x3'));var BPromise=require(_0x4ff3('0x4'));var rp=require(_0x4ff3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4ff3('0x6'));var config=require(_0x4ff3('0x7'));var attributes=require('./integrationReport.attributes');module[_0x4ff3('0x8')]=function(_0x73a534,_0x417589){return _0x73a534[_0x4ff3('0x9')](_0x4ff3('0xa'),attributes,{'tableName':_0x4ff3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64b1=['util','../../config/logger','api','moment','request-promise','rimraf','./integrationReport.attributes','define','IntegrationReport','lodash'];(function(_0x268552,_0x125f6d){var _0x4738f6=function(_0x250cb7){while(--_0x250cb7){_0x268552['push'](_0x268552['shift']());}};_0x4738f6(++_0x125f6d);}(_0x64b1,0x6d));var _0x164b=function(_0x3c1f1d,_0x40f9be){_0x3c1f1d=_0x3c1f1d-0x0;var _0x4403b9=_0x64b1[_0x3c1f1d];return _0x4403b9;};'use strict';var _=require(_0x164b('0x0'));var util=require(_0x164b('0x1'));var logger=require(_0x164b('0x2'))(_0x164b('0x3'));var moment=require(_0x164b('0x4'));var BPromise=require('bluebird');var rp=require(_0x164b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x164b('0x6'));var config=require('../../config/environment');var attributes=require(_0x164b('0x7'));module['exports']=function(_0x7a4ff4,_0x43ca4d){return _0x7a4ff4[_0x164b('0x8')](_0x164b('0x9'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.rpc.js b/server/api/integrationReport/integrationReport.rpc.js index 6cc0300..07a452d 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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2ffe26,_0x599a50){var _0x111551=function(_0x4799f0){while(--_0x4799f0){_0x2ffe26['push'](_0x2ffe26['shift']());}};_0x111551(++_0x599a50);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ 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(_0x5ceddd,_0x46d60d){var _0x488ff8=function(_0x500905){while(--_0x500905){_0x5ceddd['push'](_0x5ceddd['shift']());}};_0x488ff8(++_0x46d60d);}(_0x4819,0xcd));var _0x9481=function(_0x57306c,_0xdeff85){_0x57306c=_0x57306c-0x0;var _0x413cfb=_0x4819[_0x57306c];return _0x413cfb;};'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 64737ed..a3c1dec 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 _0xcd0d=['get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./interval.controller'];(function(_0x41816c,_0xfa953e){var _0x20c319=function(_0x5d22c9){while(--_0x5d22c9){_0x41816c['push'](_0x41816c['shift']());}};_0x20c319(++_0xfa953e);}(_0xcd0d,0x10a));var _0xdcd0=function(_0x57eebd,_0x561057){_0x57eebd=_0x57eebd-0x0;var _0x343a79=_0xcd0d[_0x57eebd];return _0x343a79;};'use strict';var multer=require(_0xdcd0('0x0'));var util=require(_0xdcd0('0x1'));var path=require(_0xdcd0('0x2'));var timeout=require(_0xdcd0('0x3'));var express=require(_0xdcd0('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdcd0('0x5'));var config=require('../../config/environment');var controller=require(_0xdcd0('0x6'));router[_0xdcd0('0x7')]('/',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0x9')]);router[_0xdcd0('0x7')](_0xdcd0('0xa'),auth['isAuthenticated'](),controller['show']);router['get'](_0xdcd0('0xb'),auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xc')]);router['post']('/',auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xd')]);router[_0xdcd0('0xe')](_0xdcd0('0xb'),auth[_0xdcd0('0x8')](),controller[_0xdcd0('0xf')]);router[_0xdcd0('0xe')](_0xdcd0('0x10'),auth['isAuthenticated'](),controller[_0xdcd0('0x11')]);router[_0xdcd0('0x12')](_0xdcd0('0xa'),auth[_0xdcd0('0x8')](),controller['update']);router[_0xdcd0('0x13')]('/:id',auth[_0xdcd0('0x8')](),controller['destroy']);module[_0xdcd0('0x14')]=router; \ No newline at end of file +var _0x8cce=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','put','update','destroy','multer','util','express','Router'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x8cce,0xee));var _0xe8cc=function(_0x36ecaa,_0x8da93d){_0x36ecaa=_0x36ecaa-0x0;var _0x4f9d07=_0x8cce[_0x36ecaa];return _0x4f9d07;};'use strict';var multer=require(_0xe8cc('0x0'));var util=require(_0xe8cc('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe8cc('0x2'));var router=express[_0xe8cc('0x3')]();var fs_extra=require(_0xe8cc('0x4'));var auth=require(_0xe8cc('0x5'));var interaction=require(_0xe8cc('0x6'));var config=require(_0xe8cc('0x7'));var controller=require(_0xe8cc('0x8'));router[_0xe8cc('0x9')]('/',auth[_0xe8cc('0xa')](),controller[_0xe8cc('0xb')]);router[_0xe8cc('0x9')](_0xe8cc('0xc'),auth[_0xe8cc('0xa')](),controller[_0xe8cc('0xd')]);router['get']('/:id/sub_intervals',auth[_0xe8cc('0xa')](),controller[_0xe8cc('0xe')]);router[_0xe8cc('0xf')]('/',auth['isAuthenticated'](),controller[_0xe8cc('0x10')]);router[_0xe8cc('0xf')]('/:id/sub_intervals',auth[_0xe8cc('0xa')](),controller[_0xe8cc('0x11')]);router[_0xe8cc('0xf')](_0xe8cc('0x12'),auth[_0xe8cc('0xa')](),controller['addIntervals']);router[_0xe8cc('0x13')](_0xe8cc('0xc'),auth['isAuthenticated'](),controller[_0xe8cc('0x14')]);router['delete'](_0xe8cc('0xc'),auth[_0xe8cc('0xa')](),controller[_0xe8cc('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 0469af3..7ea9fef 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 _0xf095=['STRING','sequelize','exports'];(function(_0x1e3ab7,_0x488c5e){var _0x52be95=function(_0x294fac){while(--_0x294fac){_0x1e3ab7['push'](_0x1e3ab7['shift']());}};_0x52be95(++_0x488c5e);}(_0xf095,0x148));var _0x5f09=function(_0x2b0875,_0x21ff12){_0x2b0875=_0x2b0875-0x0;var _0xedb8d7=_0xf095[_0x2b0875];return _0xedb8d7;};'use strict';var Sequelize=require(_0x5f09('0x0'));module[_0x5f09('0x1')]={'name':{'type':Sequelize[_0x5f09('0x2')]},'description':{'type':Sequelize[_0x5f09('0x2')]},'interval':{'type':Sequelize[_0x5f09('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0xbfe4=['STRING','sequelize','exports'];(function(_0x359c61,_0x175e82){var _0x5cbafc=function(_0x27c401){while(--_0x27c401){_0x359c61['push'](_0x359c61['shift']());}};_0x5cbafc(++_0x175e82);}(_0xbfe4,0xdf));var _0x4bfe=function(_0x12383c,_0xb3df1a){_0x12383c=_0x12383c-0x0;var _0x5f1bbd=_0xbfe4[_0x12383c];return _0x5f1bbd;};'use strict';var Sequelize=require(_0x4bfe('0x0'));module[_0x4bfe('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x4bfe('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 7b586be..a3d6f64 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 _0xd39b=['apply','save','update','then','destroy','UserProfileResource','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','get','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','findOne','nolimit','addIntervals','transaction','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','end','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xd39b,0x8a));var _0xbd39=function(_0x230076,_0x4ec21f){_0x230076=_0x230076-0x0;var _0x46ff80=_0xd39b[_0x230076];return _0x46ff80;};'use strict';var emlformat=require(_0xbd39('0x0'));var rimraf=require(_0xbd39('0x1'));var zipdir=require(_0xbd39('0x2'));var jsonpatch=require(_0xbd39('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbd39('0x4'));var Mustache=require(_0xbd39('0x5'));var util=require(_0xbd39('0x6'));var path=require('path');var sox=require(_0xbd39('0x7'));var csv=require(_0xbd39('0x8'));var ejs=require(_0xbd39('0x9'));var fs=require('fs');var fs_extra=require(_0xbd39('0xa'));var _=require('lodash');var squel=require(_0xbd39('0xb'));var crypto=require(_0xbd39('0xc'));var jsforce=require(_0xbd39('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbd39('0x8'));var querystring=require(_0xbd39('0xe'));var Papa=require('papaparse');var Redis=require(_0xbd39('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbd39('0x10'));var as=require(_0xbd39('0x11'));var hardwareService=require(_0xbd39('0x12'));var logger=require('../../config/logger')(_0xbd39('0x13'));var utils=require(_0xbd39('0x14'));var config=require(_0xbd39('0x15'));var licenseUtil=require(_0xbd39('0x16'));var db=require(_0xbd39('0x17'))['db'];var extensions=require(_0xbd39('0x18'));function respondWithStatusCode(_0x11bcb3,_0xa60a2d){_0xa60a2d=_0xa60a2d||0xcc;return function(_0x328b20){if(_0x328b20){return _0x11bcb3['sendStatus'](_0xa60a2d);}return _0x11bcb3[_0xbd39('0x19')](_0xa60a2d)[_0xbd39('0x1a')]();};}function respondWithResult(_0x380e73,_0xface5d){_0xface5d=_0xface5d||0xc8;return function(_0x1fcafa){if(_0x1fcafa){return _0x380e73[_0xbd39('0x19')](_0xface5d)[_0xbd39('0x1b')](_0x1fcafa);}};}function respondWithFilteredResult(_0x3ce9e0,_0x1c11cd){return function(_0x91d834){if(_0x91d834){var _0x1518fb=typeof _0x1c11cd['offset']===_0xbd39('0x1c')&&typeof _0x1c11cd[_0xbd39('0x1d')]==='undefined';var _0x3a644b=_0x91d834[_0xbd39('0x1e')];var _0x4d9d32=_0x1518fb?0x0:_0x1c11cd[_0xbd39('0x1f')];var _0x12f5fc=_0x1518fb?_0x91d834[_0xbd39('0x1e')]:_0x1c11cd[_0xbd39('0x1f')]+_0x1c11cd[_0xbd39('0x1d')];var _0x48d608;if(_0x12f5fc>=_0x3a644b){_0x12f5fc=_0x3a644b;_0x48d608=0xc8;}else{_0x48d608=0xce;}_0x3ce9e0[_0xbd39('0x19')](_0x48d608);return _0x3ce9e0[_0xbd39('0x20')](_0xbd39('0x21'),_0x4d9d32+'-'+_0x12f5fc+'/'+_0x3a644b)[_0xbd39('0x1b')](_0x91d834);}return null;};}function patchUpdates(_0x39a6f3){return function(_0x3ddd90){try{jsonpatch[_0xbd39('0x22')](_0x3ddd90,_0x39a6f3,!![]);}catch(_0x2275a3){return BPromise['reject'](_0x2275a3);}return _0x3ddd90[_0xbd39('0x23')]();};}function saveUpdates(_0x53a181,_0x13b506){return function(_0x393954){if(_0x393954){return _0x393954[_0xbd39('0x24')](_0x53a181)[_0xbd39('0x25')](function(_0x4f493e){return _0x4f493e;});}return null;};}function removeEntity(_0x128df3,_0x1d32b4){return function(_0x238026){if(_0x238026){return _0x238026[_0xbd39('0x26')]()[_0xbd39('0x25')](function(){var _0x32607f=_0x238026['get']({'plain':!![]});var _0x1de180='Intervals';return db[_0xbd39('0x27')][_0xbd39('0x26')]({'where':{'type':_0x1de180,'resourceId':_0x32607f['id']}})[_0xbd39('0x25')](function(){return _0x238026;});})['then'](function(){_0x128df3['status'](0xcc)[_0xbd39('0x1a')]();});}};}function handleEntityNotFound(_0x1a4252,_0x285cf4){return function(_0xe0b71e){if(!_0xe0b71e){_0x1a4252['sendStatus'](0x194);}return _0xe0b71e;};}function handleError(_0x4c9a10,_0x40724d){_0x40724d=_0x40724d||0x1f4;return function(_0x4ecd8a){logger[_0xbd39('0x28')](_0x4ecd8a[_0xbd39('0x29')]);if(_0x4ecd8a[_0xbd39('0x2a')]){delete _0x4ecd8a[_0xbd39('0x2a')];}_0x4c9a10[_0xbd39('0x19')](_0x40724d)[_0xbd39('0x2b')](_0x4ecd8a);};}exports[_0xbd39('0x2c')]=function(_0x3a4323,_0x234f7c){var _0xb2a644={},_0x45782d={},_0x331782={'count':0x0,'rows':[]};var _0x3ff7d7=_[_0xbd39('0x2d')](db[_0xbd39('0x2e')][_0xbd39('0x2f')],function(_0x24089f){return{'name':_0x24089f[_0xbd39('0x30')],'type':_0x24089f[_0xbd39('0x31')]['key']};});_0x45782d['model']=_[_0xbd39('0x2d')](_0x3ff7d7,_0xbd39('0x2a'));_0x45782d[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x3a4323[_0xbd39('0x32')]);_0x45782d[_0xbd39('0x34')]=_[_0xbd39('0x35')](_0x45782d['model'],_0x45782d[_0xbd39('0x32')]);_0xb2a644[_0xbd39('0x36')]=_[_0xbd39('0x35')](_0x45782d[_0xbd39('0x37')],qs['fields'](_0x3a4323[_0xbd39('0x32')][_0xbd39('0x38')]));_0xb2a644[_0xbd39('0x36')]=_0xb2a644[_0xbd39('0x36')][_0xbd39('0x39')]?_0xb2a644['attributes']:_0x45782d[_0xbd39('0x37')];if(!_0x3a4323[_0xbd39('0x32')][_0xbd39('0x3a')]('nolimit')){_0xb2a644[_0xbd39('0x1d')]=qs[_0xbd39('0x1d')](_0x3a4323[_0xbd39('0x32')][_0xbd39('0x1d')]);_0xb2a644[_0xbd39('0x1f')]=qs['offset'](_0x3a4323[_0xbd39('0x32')]['offset']);}_0xb2a644[_0xbd39('0x3b')]=qs[_0xbd39('0x3c')](_0x3a4323[_0xbd39('0x32')][_0xbd39('0x3c')]);_0xb2a644[_0xbd39('0x3d')]=qs['filters'](_[_0xbd39('0x3e')](_0x3a4323['query'],_0x45782d['filters']),_0x3ff7d7);if(_0x3a4323['query'][_0xbd39('0x3f')]){_0xb2a644[_0xbd39('0x3d')]=_[_0xbd39('0x40')](_0xb2a644['where'],{'$or':_[_0xbd39('0x2d')](_0x3ff7d7,function(_0x1d5afd){if(_0x1d5afd[_0xbd39('0x31')]!==_0xbd39('0x41')){var _0xd14915={};_0xd14915[_0x1d5afd[_0xbd39('0x2a')]]={'$like':'%'+_0x3a4323['query'][_0xbd39('0x3f')]+'%'};return _0xd14915;}})});}_0xb2a644=_[_0xbd39('0x40')]({},_0xb2a644,_0x3a4323[_0xbd39('0x42')]);var _0x462840={'where':_0xb2a644[_0xbd39('0x3d')]};return db[_0xbd39('0x2e')][_0xbd39('0x1e')](_0x462840)[_0xbd39('0x25')](function(_0x5b7b1b){_0x331782[_0xbd39('0x1e')]=_0x5b7b1b;if(_0x3a4323[_0xbd39('0x32')][_0xbd39('0x43')]){_0xb2a644[_0xbd39('0x44')]=[{'all':!![]}];}return db['Interval']['findAll'](_0xb2a644);})[_0xbd39('0x25')](function(_0x2e79a2){_0x331782[_0xbd39('0x45')]=_0x2e79a2;return _0x331782;})[_0xbd39('0x25')](respondWithFilteredResult(_0x234f7c,_0xb2a644))[_0xbd39('0x46')](handleError(_0x234f7c,null));};exports[_0xbd39('0x47')]=function(_0x29005e,_0x49e271){var _0x31958b={'raw':!![],'where':{'id':_0x29005e[_0xbd39('0x48')]['id']}},_0x1bc044={};_0x1bc044[_0xbd39('0x37')]=_[_0xbd39('0x33')](db[_0xbd39('0x2e')][_0xbd39('0x2f')]);_0x1bc044[_0xbd39('0x32')]=_[_0xbd39('0x33')](_0x29005e[_0xbd39('0x32')]);_0x1bc044['filters']=_[_0xbd39('0x35')](_0x1bc044['model'],_0x1bc044[_0xbd39('0x32')]);_0x31958b[_0xbd39('0x36')]=_[_0xbd39('0x35')](_0x1bc044['model'],qs[_0xbd39('0x38')](_0x29005e['query'][_0xbd39('0x38')]));_0x31958b[_0xbd39('0x36')]=_0x31958b[_0xbd39('0x36')][_0xbd39('0x39')]?_0x31958b[_0xbd39('0x36')]:_0x1bc044[_0xbd39('0x37')];if(_0x29005e[_0xbd39('0x32')][_0xbd39('0x43')]){_0x31958b[_0xbd39('0x44')]=[{'all':!![]}];}_0x31958b=_['merge']({},_0x31958b,_0x29005e['options']);return db[_0xbd39('0x2e')][_0xbd39('0x49')](_0x31958b)[_0xbd39('0x25')](handleEntityNotFound(_0x49e271,null))[_0xbd39('0x25')](respondWithResult(_0x49e271,null))[_0xbd39('0x46')](handleError(_0x49e271,null));};exports[_0xbd39('0x4a')]=function(_0x310e21,_0x56180c){return db[_0xbd39('0x2e')][_0xbd39('0x4a')](_0x310e21[_0xbd39('0x4b')],{})[_0xbd39('0x25')](function(_0x11fac7){var _0x346266=_0x310e21[_0xbd39('0x4c')][_0xbd39('0x4d')]({'plain':!![]});if(!_0x346266)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x346266['role']===_0xbd39('0x4c')){var _0x4df143=_0x11fac7['get']({'plain':!![]});var _0x21ec2f='Intervals';return db['UserProfileSection'][_0xbd39('0x49')]({'where':{'name':_0x21ec2f,'userProfileId':_0x346266['userProfileId']},'raw':!![]})[_0xbd39('0x25')](function(_0x1e9be2){if(_0x1e9be2&&_0x1e9be2['autoAssociation']===0x0){return db[_0xbd39('0x27')][_0xbd39('0x4a')]({'name':_0x4df143[_0xbd39('0x2a')],'resourceId':_0x4df143['id'],'type':_0x1e9be2[_0xbd39('0x2a')],'sectionId':_0x1e9be2['id']},{})[_0xbd39('0x25')](function(){return _0x11fac7;});}else{return _0x11fac7;}})['catch'](function(_0x19053f){logger['error'](_0xbd39('0x4e'),_0x19053f);throw _0x19053f;});}return _0x11fac7;})[_0xbd39('0x25')](respondWithResult(_0x56180c,0xc9))['catch'](handleError(_0x56180c,null));};exports['update']=function(_0x29aba2,_0xe26f08){if(_0x29aba2[_0xbd39('0x4b')]['id']){delete _0x29aba2[_0xbd39('0x4b')]['id'];}return db[_0xbd39('0x2e')]['find']({'where':{'id':_0x29aba2[_0xbd39('0x48')]['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0xe26f08,null))['then'](saveUpdates(_0x29aba2[_0xbd39('0x4b')],null))[_0xbd39('0x25')](respondWithResult(_0xe26f08,null))[_0xbd39('0x46')](handleError(_0xe26f08,null));};exports[_0xbd39('0x26')]=function(_0xf6eb3b,_0x3867dd){return db[_0xbd39('0x2e')][_0xbd39('0x49')]({'where':{'id':_0xf6eb3b[_0xbd39('0x48')]['id']}})['then'](handleEntityNotFound(_0x3867dd,null))[_0xbd39('0x25')](removeEntity(_0x3867dd,null))[_0xbd39('0x46')](handleError(_0x3867dd,null));};exports[_0xbd39('0x4f')]=function(_0x140e2c,_0x42583b,_0xb7f482){if(_0x140e2c[_0xbd39('0x4b')]['id']){delete _0x140e2c[_0xbd39('0x4b')]['id'];}return db['Interval'][_0xbd39('0x49')]({'where':{'id':_0x140e2c[_0xbd39('0x48')]['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0x42583b,null))[_0xbd39('0x25')](function(_0x2e74fe){if(_0x2e74fe){_0x140e2c[_0xbd39('0x4b')][_0xbd39('0x50')]=_0x2e74fe['id'];return db[_0xbd39('0x2e')][_0xbd39('0x4a')](_0x140e2c[_0xbd39('0x4b')]);}})[_0xbd39('0x25')](respondWithResult(_0x42583b,null))[_0xbd39('0x46')](handleError(_0x42583b,null));};exports[_0xbd39('0x51')]=function(_0x54ce0c,_0x3811b4,_0x456207){var _0x3cb2f7={};var _0x4ba4f4={};var _0x2099fe;var _0x34dd86;return db[_0xbd39('0x2e')][_0xbd39('0x52')]({'where':{'id':_0x54ce0c[_0xbd39('0x48')]['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0x3811b4,null))[_0xbd39('0x25')](function(_0x3f1d51){if(_0x3f1d51){_0x2099fe=_0x3f1d51;_0x4ba4f4[_0xbd39('0x37')]=_[_0xbd39('0x33')](db[_0xbd39('0x2e')]['rawAttributes']);_0x4ba4f4[_0xbd39('0x32')]=_['keys'](_0x54ce0c[_0xbd39('0x32')]);_0x4ba4f4[_0xbd39('0x34')]=_[_0xbd39('0x35')](_0x4ba4f4[_0xbd39('0x37')],_0x4ba4f4['query']);_0x3cb2f7[_0xbd39('0x36')]=_[_0xbd39('0x35')](_0x4ba4f4[_0xbd39('0x37')],qs[_0xbd39('0x38')](_0x54ce0c[_0xbd39('0x32')]['fields']));_0x3cb2f7[_0xbd39('0x36')]=_0x3cb2f7[_0xbd39('0x36')]['length']?_0x3cb2f7[_0xbd39('0x36')]:_0x4ba4f4[_0xbd39('0x37')];_0x3cb2f7['order']=qs[_0xbd39('0x3c')](_0x54ce0c[_0xbd39('0x32')]['sort']);_0x3cb2f7['where']=qs[_0xbd39('0x34')](_['pick'](_0x54ce0c[_0xbd39('0x32')],_0x4ba4f4[_0xbd39('0x34')]));if(_0x54ce0c[_0xbd39('0x32')]['filter']){_0x3cb2f7[_0xbd39('0x3d')]=_['merge'](_0x3cb2f7['where'],{'$or':_[_0xbd39('0x2d')](_0x3cb2f7[_0xbd39('0x36')],function(_0x33f3c4){var _0x319999={};_0x319999[_0x33f3c4]={'$like':'%'+_0x54ce0c['query'][_0xbd39('0x3f')]+'%'};return _0x319999;})});}_0x3cb2f7=_[_0xbd39('0x40')]({},_0x3cb2f7,_0x54ce0c[_0xbd39('0x42')]);return _0x2099fe[_0xbd39('0x51')](_0x3cb2f7);}})[_0xbd39('0x25')](function(_0x3b2065){if(_0x3b2065){_0x34dd86=_0x3b2065['length'];if(!_0x54ce0c[_0xbd39('0x32')][_0xbd39('0x3a')](_0xbd39('0x53'))){_0x3cb2f7[_0xbd39('0x1d')]=qs[_0xbd39('0x1d')](_0x54ce0c[_0xbd39('0x32')]['limit']);_0x3cb2f7[_0xbd39('0x1f')]=qs[_0xbd39('0x1f')](_0x54ce0c[_0xbd39('0x32')][_0xbd39('0x1f')]);}return _0x2099fe[_0xbd39('0x51')](_0x3cb2f7);}})[_0xbd39('0x25')](function(_0x44925f){if(_0x44925f){return _0x44925f?{'count':_0x34dd86,'rows':_0x44925f}:null;}})[_0xbd39('0x25')](respondWithResult(_0x3811b4,null))[_0xbd39('0x46')](handleError(_0x3811b4,null));};exports[_0xbd39('0x54')]=function(_0x496831,_0x5a46df,_0x348a73){return db[_0xbd39('0x2e')]['findOne']({'where':{'id':_0x496831['params']['id']}})[_0xbd39('0x25')](handleEntityNotFound(_0x5a46df,null))[_0xbd39('0x25')](function(_0xd447e5){if(_0xd447e5){return db['sequelize'][_0xbd39('0x55')](function(_0x46ea0d){return db[_0xbd39('0x2e')][_0xbd39('0x26')]({'where':{'IntervalId':_0x496831[_0xbd39('0x48')]['id']},'transaction':_0x46ea0d})['then'](function(_0x70b210){var _0x5e2f54=_[_0xbd39('0x2d')](_0x496831[_0xbd39('0x4b')],function(_0x1b86e7){delete _0x1b86e7['id'];_0x1b86e7[_0xbd39('0x50')]=_0x496831[_0xbd39('0x48')]['id'];return _0x1b86e7;});return db['Interval']['bulkCreate'](_0x5e2f54,{'transaction':_0x46ea0d});});})[_0xbd39('0x25')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x496831[_0xbd39('0x48')]['id']}});});}})[_0xbd39('0x25')](respondWithResult(_0x5a46df,null))[_0xbd39('0x46')](handleError(_0x5a46df,null));}; \ No newline at end of file +var _0xf97d=['fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','filters','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','params','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','catch','body','IntervalId','getIntervals','pick','findOne','sequelize','transaction','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','offset','undefined','count','json','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','end','error','stack','name','send','Interval','rawAttributes','fieldName','type','key','model','map','query','keys','intersection'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf97d,0xd7));var _0xdf97=function(_0x1222fa,_0x39a7b9){_0x1222fa=_0x1222fa-0x0;var _0x1dcd74=_0xf97d[_0x1222fa];return _0x1dcd74;};'use strict';var emlformat=require(_0xdf97('0x0'));var rimraf=require(_0xdf97('0x1'));var zipdir=require(_0xdf97('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdf97('0x3'));var moment=require(_0xdf97('0x4'));var BPromise=require(_0xdf97('0x5'));var Mustache=require(_0xdf97('0x6'));var util=require(_0xdf97('0x7'));var path=require(_0xdf97('0x8'));var sox=require(_0xdf97('0x9'));var csv=require(_0xdf97('0xa'));var ejs=require(_0xdf97('0xb'));var fs=require('fs');var fs_extra=require(_0xdf97('0xc'));var _=require(_0xdf97('0xd'));var squel=require(_0xdf97('0xe'));var crypto=require('crypto');var jsforce=require(_0xdf97('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf97('0xa'));var querystring=require(_0xdf97('0x10'));var Papa=require(_0xdf97('0x11'));var Redis=require('ioredis');var authService=require(_0xdf97('0x12'));var qs=require(_0xdf97('0x13'));var as=require(_0xdf97('0x14'));var hardwareService=require(_0xdf97('0x15'));var logger=require(_0xdf97('0x16'))(_0xdf97('0x17'));var utils=require(_0xdf97('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdf97('0x19'));var db=require(_0xdf97('0x1a'))['db'];var extensions=require(_0xdf97('0x1b'));function respondWithStatusCode(_0xdbdacc,_0x450267){_0x450267=_0x450267||0xcc;return function(_0x4f2479){if(_0x4f2479){return _0xdbdacc[_0xdf97('0x1c')](_0x450267);}return _0xdbdacc[_0xdf97('0x1d')](_0x450267)['end']();};}function respondWithResult(_0x424e1b,_0x1cf4c0){_0x1cf4c0=_0x1cf4c0||0xc8;return function(_0x104cfe){if(_0x104cfe){return _0x424e1b[_0xdf97('0x1d')](_0x1cf4c0)['json'](_0x104cfe);}};}function respondWithFilteredResult(_0x5a5ff6,_0xae96f9){return function(_0x5edd3e){if(_0x5edd3e){var _0x345542=typeof _0xae96f9[_0xdf97('0x1e')]===_0xdf97('0x1f')&&typeof _0xae96f9['limit']===_0xdf97('0x1f');var _0x26050b=_0x5edd3e[_0xdf97('0x20')];var _0x9b0911=_0x345542?0x0:_0xae96f9[_0xdf97('0x1e')];var _0x10a0a1=_0x345542?_0x5edd3e[_0xdf97('0x20')]:_0xae96f9['offset']+_0xae96f9['limit'];var _0x57b52e;if(_0x10a0a1>=_0x26050b){_0x10a0a1=_0x26050b;_0x57b52e=0xc8;}else{_0x57b52e=0xce;}_0x5a5ff6['status'](_0x57b52e);return _0x5a5ff6['set']('Content-Range',_0x9b0911+'-'+_0x10a0a1+'/'+_0x26050b)[_0xdf97('0x21')](_0x5edd3e);}return null;};}function patchUpdates(_0x167434){return function(_0x3afd7e){try{jsonpatch[_0xdf97('0x22')](_0x3afd7e,_0x167434,!![]);}catch(_0x3aed08){return BPromise[_0xdf97('0x23')](_0x3aed08);}return _0x3afd7e[_0xdf97('0x24')]();};}function saveUpdates(_0x25b4dd,_0x576a01){return function(_0x196b7f){if(_0x196b7f){return _0x196b7f[_0xdf97('0x25')](_0x25b4dd)[_0xdf97('0x26')](function(_0x10b745){return _0x10b745;});}return null;};}function removeEntity(_0x3f0810,_0x52f23c){return function(_0x21fef8){if(_0x21fef8){return _0x21fef8[_0xdf97('0x27')]()[_0xdf97('0x26')](function(){var _0xdfe121=_0x21fef8[_0xdf97('0x28')]({'plain':!![]});var _0x59f9f2=_0xdf97('0x29');return db[_0xdf97('0x2a')][_0xdf97('0x27')]({'where':{'type':_0x59f9f2,'resourceId':_0xdfe121['id']}})[_0xdf97('0x26')](function(){return _0x21fef8;});})[_0xdf97('0x26')](function(){_0x3f0810[_0xdf97('0x1d')](0xcc)[_0xdf97('0x2b')]();});}};}function handleEntityNotFound(_0xfc0f25,_0x447c21){return function(_0x20919a){if(!_0x20919a){_0xfc0f25[_0xdf97('0x1c')](0x194);}return _0x20919a;};}function handleError(_0xda2d0b,_0x1cdc73){_0x1cdc73=_0x1cdc73||0x1f4;return function(_0x2e9036){logger[_0xdf97('0x2c')](_0x2e9036[_0xdf97('0x2d')]);if(_0x2e9036[_0xdf97('0x2e')]){delete _0x2e9036[_0xdf97('0x2e')];}_0xda2d0b[_0xdf97('0x1d')](_0x1cdc73)[_0xdf97('0x2f')](_0x2e9036);};}exports['index']=function(_0x4c41ec,_0x40baf6){var _0x636e71={},_0x590598={},_0x5cda5f={'count':0x0,'rows':[]};var _0x298546=_['map'](db[_0xdf97('0x30')][_0xdf97('0x31')],function(_0x3ac86c){return{'name':_0x3ac86c[_0xdf97('0x32')],'type':_0x3ac86c[_0xdf97('0x33')][_0xdf97('0x34')]};});_0x590598[_0xdf97('0x35')]=_[_0xdf97('0x36')](_0x298546,_0xdf97('0x2e'));_0x590598[_0xdf97('0x37')]=_[_0xdf97('0x38')](_0x4c41ec[_0xdf97('0x37')]);_0x590598['filters']=_[_0xdf97('0x39')](_0x590598[_0xdf97('0x35')],_0x590598['query']);_0x636e71['attributes']=_[_0xdf97('0x39')](_0x590598[_0xdf97('0x35')],qs[_0xdf97('0x3a')](_0x4c41ec[_0xdf97('0x37')][_0xdf97('0x3a')]));_0x636e71[_0xdf97('0x3b')]=_0x636e71[_0xdf97('0x3b')][_0xdf97('0x3c')]?_0x636e71[_0xdf97('0x3b')]:_0x590598[_0xdf97('0x35')];if(!_0x4c41ec[_0xdf97('0x37')][_0xdf97('0x3d')](_0xdf97('0x3e'))){_0x636e71[_0xdf97('0x3f')]=qs[_0xdf97('0x3f')](_0x4c41ec[_0xdf97('0x37')][_0xdf97('0x3f')]);_0x636e71[_0xdf97('0x1e')]=qs[_0xdf97('0x1e')](_0x4c41ec[_0xdf97('0x37')][_0xdf97('0x1e')]);}_0x636e71[_0xdf97('0x40')]=qs['sort'](_0x4c41ec[_0xdf97('0x37')][_0xdf97('0x41')]);_0x636e71['where']=qs['filters'](_['pick'](_0x4c41ec[_0xdf97('0x37')],_0x590598[_0xdf97('0x42')]),_0x298546);if(_0x4c41ec['query']['filter']){_0x636e71[_0xdf97('0x43')]=_[_0xdf97('0x44')](_0x636e71['where'],{'$or':_['map'](_0x298546,function(_0xd954d7){if(_0xd954d7['type']!==_0xdf97('0x45')){var _0x200130={};_0x200130[_0xd954d7[_0xdf97('0x2e')]]={'$like':'%'+_0x4c41ec[_0xdf97('0x37')][_0xdf97('0x46')]+'%'};return _0x200130;}})});}_0x636e71=_[_0xdf97('0x44')]({},_0x636e71,_0x4c41ec[_0xdf97('0x47')]);var _0x44053a={'where':_0x636e71[_0xdf97('0x43')]};return db[_0xdf97('0x30')][_0xdf97('0x20')](_0x44053a)['then'](function(_0x4c726a){_0x5cda5f[_0xdf97('0x20')]=_0x4c726a;if(_0x4c41ec['query'][_0xdf97('0x48')]){_0x636e71['include']=[{'all':!![]}];}return db[_0xdf97('0x30')][_0xdf97('0x49')](_0x636e71);})[_0xdf97('0x26')](function(_0x12fecb){_0x5cda5f[_0xdf97('0x4a')]=_0x12fecb;return _0x5cda5f;})[_0xdf97('0x26')](respondWithFilteredResult(_0x40baf6,_0x636e71))['catch'](handleError(_0x40baf6,null));};exports['show']=function(_0x5cf407,_0x2bf8ef){var _0x45b840={'raw':!![],'where':{'id':_0x5cf407[_0xdf97('0x4b')]['id']}},_0x38e7a9={};_0x38e7a9[_0xdf97('0x35')]=_['keys'](db['Interval'][_0xdf97('0x31')]);_0x38e7a9[_0xdf97('0x37')]=_[_0xdf97('0x38')](_0x5cf407[_0xdf97('0x37')]);_0x38e7a9['filters']=_[_0xdf97('0x39')](_0x38e7a9['model'],_0x38e7a9[_0xdf97('0x37')]);_0x45b840[_0xdf97('0x3b')]=_['intersection'](_0x38e7a9[_0xdf97('0x35')],qs[_0xdf97('0x3a')](_0x5cf407['query'][_0xdf97('0x3a')]));_0x45b840[_0xdf97('0x3b')]=_0x45b840['attributes'][_0xdf97('0x3c')]?_0x45b840['attributes']:_0x38e7a9[_0xdf97('0x35')];if(_0x5cf407['query'][_0xdf97('0x48')]){_0x45b840['include']=[{'all':!![]}];}_0x45b840=_['merge']({},_0x45b840,_0x5cf407[_0xdf97('0x47')]);return db[_0xdf97('0x30')][_0xdf97('0x4c')](_0x45b840)['then'](handleEntityNotFound(_0x2bf8ef,null))[_0xdf97('0x26')](respondWithResult(_0x2bf8ef,null))['catch'](handleError(_0x2bf8ef,null));};exports[_0xdf97('0x4d')]=function(_0x39eed9,_0x2556f6){return db['Interval']['create'](_0x39eed9['body'],{})[_0xdf97('0x26')](function(_0x480525){var _0x319734=_0x39eed9[_0xdf97('0x4e')][_0xdf97('0x28')]({'plain':!![]});if(!_0x319734)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x319734[_0xdf97('0x4f')]===_0xdf97('0x4e')){var _0x4f396b=_0x480525['get']({'plain':!![]});var _0x418569=_0xdf97('0x29');return db[_0xdf97('0x50')][_0xdf97('0x4c')]({'where':{'name':_0x418569,'userProfileId':_0x319734[_0xdf97('0x51')]},'raw':!![]})['then'](function(_0x1dc34b){if(_0x1dc34b&&_0x1dc34b[_0xdf97('0x52')]===0x0){return db[_0xdf97('0x2a')][_0xdf97('0x4d')]({'name':_0x4f396b[_0xdf97('0x2e')],'resourceId':_0x4f396b['id'],'type':_0x1dc34b[_0xdf97('0x2e')],'sectionId':_0x1dc34b['id']},{})['then'](function(){return _0x480525;});}else{return _0x480525;}})['catch'](function(_0x21d0b6){logger[_0xdf97('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x21d0b6);throw _0x21d0b6;});}return _0x480525;})[_0xdf97('0x26')](respondWithResult(_0x2556f6,0xc9))[_0xdf97('0x53')](handleError(_0x2556f6,null));};exports[_0xdf97('0x25')]=function(_0x2326b5,_0x23bcc4){if(_0x2326b5[_0xdf97('0x54')]['id']){delete _0x2326b5[_0xdf97('0x54')]['id'];}return db[_0xdf97('0x30')][_0xdf97('0x4c')]({'where':{'id':_0x2326b5[_0xdf97('0x4b')]['id']}})[_0xdf97('0x26')](handleEntityNotFound(_0x23bcc4,null))[_0xdf97('0x26')](saveUpdates(_0x2326b5['body'],null))[_0xdf97('0x26')](respondWithResult(_0x23bcc4,null))[_0xdf97('0x53')](handleError(_0x23bcc4,null));};exports[_0xdf97('0x27')]=function(_0x1d6046,_0x177a15){return db[_0xdf97('0x30')][_0xdf97('0x4c')]({'where':{'id':_0x1d6046[_0xdf97('0x4b')]['id']}})[_0xdf97('0x26')](handleEntityNotFound(_0x177a15,null))[_0xdf97('0x26')](removeEntity(_0x177a15,null))[_0xdf97('0x53')](handleError(_0x177a15,null));};exports['addInterval']=function(_0x52d3f9,_0x7f9da6,_0x1f0cb5){if(_0x52d3f9[_0xdf97('0x54')]['id']){delete _0x52d3f9[_0xdf97('0x54')]['id'];}return db['Interval'][_0xdf97('0x4c')]({'where':{'id':_0x52d3f9['params']['id']}})['then'](handleEntityNotFound(_0x7f9da6,null))['then'](function(_0xb3bf6f){if(_0xb3bf6f){_0x52d3f9[_0xdf97('0x54')][_0xdf97('0x55')]=_0xb3bf6f['id'];return db['Interval']['create'](_0x52d3f9[_0xdf97('0x54')]);}})[_0xdf97('0x26')](respondWithResult(_0x7f9da6,null))[_0xdf97('0x53')](handleError(_0x7f9da6,null));};exports[_0xdf97('0x56')]=function(_0x4c6fa3,_0x464703,_0x6f3ea9){var _0x48158c={};var _0x2550b4={};var _0x5746a1;var _0x1ad384;return db[_0xdf97('0x30')]['findOne']({'where':{'id':_0x4c6fa3[_0xdf97('0x4b')]['id']}})[_0xdf97('0x26')](handleEntityNotFound(_0x464703,null))[_0xdf97('0x26')](function(_0x11f279){if(_0x11f279){_0x5746a1=_0x11f279;_0x2550b4[_0xdf97('0x35')]=_[_0xdf97('0x38')](db[_0xdf97('0x30')]['rawAttributes']);_0x2550b4[_0xdf97('0x37')]=_[_0xdf97('0x38')](_0x4c6fa3[_0xdf97('0x37')]);_0x2550b4[_0xdf97('0x42')]=_['intersection'](_0x2550b4['model'],_0x2550b4[_0xdf97('0x37')]);_0x48158c[_0xdf97('0x3b')]=_[_0xdf97('0x39')](_0x2550b4[_0xdf97('0x35')],qs[_0xdf97('0x3a')](_0x4c6fa3['query'][_0xdf97('0x3a')]));_0x48158c[_0xdf97('0x3b')]=_0x48158c[_0xdf97('0x3b')][_0xdf97('0x3c')]?_0x48158c['attributes']:_0x2550b4[_0xdf97('0x35')];_0x48158c[_0xdf97('0x40')]=qs['sort'](_0x4c6fa3['query']['sort']);_0x48158c[_0xdf97('0x43')]=qs['filters'](_[_0xdf97('0x57')](_0x4c6fa3[_0xdf97('0x37')],_0x2550b4[_0xdf97('0x42')]));if(_0x4c6fa3['query'][_0xdf97('0x46')]){_0x48158c[_0xdf97('0x43')]=_[_0xdf97('0x44')](_0x48158c[_0xdf97('0x43')],{'$or':_[_0xdf97('0x36')](_0x48158c[_0xdf97('0x3b')],function(_0x52a7a9){var _0x4f641a={};_0x4f641a[_0x52a7a9]={'$like':'%'+_0x4c6fa3['query'][_0xdf97('0x46')]+'%'};return _0x4f641a;})});}_0x48158c=_[_0xdf97('0x44')]({},_0x48158c,_0x4c6fa3[_0xdf97('0x47')]);return _0x5746a1['getIntervals'](_0x48158c);}})[_0xdf97('0x26')](function(_0x4e8cd9){if(_0x4e8cd9){_0x1ad384=_0x4e8cd9['length'];if(!_0x4c6fa3[_0xdf97('0x37')][_0xdf97('0x3d')]('nolimit')){_0x48158c[_0xdf97('0x3f')]=qs[_0xdf97('0x3f')](_0x4c6fa3[_0xdf97('0x37')][_0xdf97('0x3f')]);_0x48158c[_0xdf97('0x1e')]=qs[_0xdf97('0x1e')](_0x4c6fa3['query'][_0xdf97('0x1e')]);}return _0x5746a1[_0xdf97('0x56')](_0x48158c);}})[_0xdf97('0x26')](function(_0x2d2621){if(_0x2d2621){return _0x2d2621?{'count':_0x1ad384,'rows':_0x2d2621}:null;}})['then'](respondWithResult(_0x464703,null))['catch'](handleError(_0x464703,null));};exports['addIntervals']=function(_0x47c62d,_0x205c09,_0x4d3fec){return db[_0xdf97('0x30')][_0xdf97('0x58')]({'where':{'id':_0x47c62d[_0xdf97('0x4b')]['id']}})[_0xdf97('0x26')](handleEntityNotFound(_0x205c09,null))['then'](function(_0xc04629){if(_0xc04629){return db[_0xdf97('0x59')][_0xdf97('0x5a')](function(_0x3d63ac){return db[_0xdf97('0x30')]['destroy']({'where':{'IntervalId':_0x47c62d[_0xdf97('0x4b')]['id']},'transaction':_0x3d63ac})[_0xdf97('0x26')](function(_0x41c973){var _0x51084b=_[_0xdf97('0x36')](_0x47c62d[_0xdf97('0x54')],function(_0x3e25ff){delete _0x3e25ff['id'];_0x3e25ff[_0xdf97('0x55')]=_0x47c62d[_0xdf97('0x4b')]['id'];return _0x3e25ff;});return db[_0xdf97('0x30')]['bulkCreate'](_0x51084b,{'transaction':_0x3d63ac});});})[_0xdf97('0x26')](function(){return db[_0xdf97('0x30')][_0xdf97('0x49')]({'where':{'IntervalId':_0x47c62d[_0xdf97('0x4b')]['id']}});});}})[_0xdf97('0x26')](respondWithResult(_0x205c09,null))[_0xdf97('0x53')](handleError(_0x205c09,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 9456791..afe310c 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 _0x7639=['rewrite','interval','string','then','all','map','ifTime','reduce','./interval.attributes','../../utils/iftime','exports','define','Interval','tools_intervals'];(function(_0x3c7f1b,_0x43b3d0){var _0x525f59=function(_0x4e5585){while(--_0x4e5585){_0x3c7f1b['push'](_0x3c7f1b['shift']());}};_0x525f59(++_0x43b3d0);}(_0x7639,0x19e));var _0x9763=function(_0x59682f,_0x5d1990){_0x59682f=_0x59682f-0x0;var _0xf5c0dd=_0x7639[_0x59682f];return _0xf5c0dd;};'use strict';var attributes=require(_0x9763('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0x9763('0x1'))['iftime'];module[_0x9763('0x2')]=function(_0x477260){return _0x477260[_0x9763('0x3')](_0x9763('0x4'),attributes,{'tableName':_0x9763('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5be5b5){extensions[_0x9763('0x6')](_0x477260,_0x5be5b5);},'afterBulkCreate':function(_0x2db882,_0x5e0372,_0x41a524){_0x41a524();extensions[_0x9763('0x6')](_0x477260,_0x2db882[0x0]);},'afterUpdate':function(_0x2d7c9f){extensions['rewrite'](_0x477260,_0x2d7c9f);},'afterDestroy':function(_0x153421){extensions['rewrite'](_0x477260,_0x153421);}},'instanceMethods':{'ifTime':function(_0xabac49=undefined,_0x55007f=new Date()){if(typeof this[_0x9763('0x7')]===_0x9763('0x8')){return iftime(this['interval'],_0xabac49,_0x55007f);}else{return this['getIntervals']()[_0x9763('0x9')](function(_0xfd144d){return Promise[_0x9763('0xa')](_0xfd144d[_0x9763('0xb')](function(_0x383175){return _0x383175[_0x9763('0xc')](_0xabac49,_0x55007f);}));})['then'](function(_0x121196){return _0x121196[_0x9763('0xd')](function(_0x56c8a2,_0x54a28d){return _0x56c8a2||_0x54a28d;},![]);});}}}});}; \ No newline at end of file +var _0xa0cb=['string','getIntervals','then','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','Interval','tools_intervals','rewrite'];(function(_0x8bb4c1,_0x2d6e53){var _0x67a6e1=function(_0x1155e5){while(--_0x1155e5){_0x8bb4c1['push'](_0x8bb4c1['shift']());}};_0x67a6e1(++_0x2d6e53);}(_0xa0cb,0x69));var _0xba0c=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xa0cb[_0x88cd7b];return _0x56fcc8;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xba0c('0x0'));var iftime=require(_0xba0c('0x1'))[_0xba0c('0x2')];module[_0xba0c('0x3')]=function(_0x16fc03){return _0x16fc03['define'](_0xba0c('0x4'),attributes,{'tableName':_0xba0c('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x43fe1d){extensions[_0xba0c('0x6')](_0x16fc03,_0x43fe1d);},'afterBulkCreate':function(_0xf842a8,_0x7e414e,_0x5ad37b){_0x5ad37b();extensions['rewrite'](_0x16fc03,_0xf842a8[0x0]);},'afterUpdate':function(_0x5e0b9e){extensions[_0xba0c('0x6')](_0x16fc03,_0x5e0b9e);},'afterDestroy':function(_0x56d91f){extensions['rewrite'](_0x16fc03,_0x56d91f);}},'instanceMethods':{'ifTime':function(_0x27abe1=undefined,_0x4f426e=new Date()){if(typeof this['interval']===_0xba0c('0x7')){return iftime(this['interval'],_0x27abe1,_0x4f426e);}else{return this[_0xba0c('0x8')]()[_0xba0c('0x9')](function(_0x116260){return Promise[_0xba0c('0xa')](_0x116260[_0xba0c('0xb')](function(_0xa8109c){return _0xa8109c[_0xba0c('0xc')](_0x27abe1,_0x4f426e);}));})[_0xba0c('0x9')](function(_0x10d8b9){return _0x10d8b9[_0xba0c('0xd')](function(_0x423d73,_0x347499){return _0x423d73||_0x347499;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 073b0cc..b566dca 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 _0x3c67=['message','ShowInterval','Interval','map','ifTime','reduce','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','IntervalIftime','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','silly','lodash','util','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','model','then','info','debug','stringify','catch','error'];(function(_0x166c06,_0x39341e){var _0x265a32=function(_0x24c215){while(--_0x24c215){_0x166c06['push'](_0x166c06['shift']());}};_0x265a32(++_0x39341e);}(_0x3c67,0x125));var _0x73c6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x3c67[_0x8c43de];return _0xa6591b;};'use strict';var _=require(_0x73c6('0x0'));var util=require(_0x73c6('0x1'));var db=require('../../mysqldb')['db'];var iftime=require('../../utils/iftime')['iftime'];var logger=require(_0x73c6('0x2'))(_0x73c6('0x3'));exports[_0x73c6('0x4')]=function(_0x3a22c6){var _0x2ef602=this;return new Promise(function(_0x144433,_0x20937b){return db['Interval'][_0x73c6('0x5')]({'raw':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0x7')]===undefined?!![]:![]:!![],'where':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0x8')]||null:null,'attributes':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6['options'][_0x73c6('0x9')]||null:null,'limit':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0xa')]||null:null,'include':_0x3a22c6[_0x73c6('0x6')]?_0x3a22c6[_0x73c6('0x6')][_0x73c6('0xb')]?_['map'](_0x3a22c6[_0x73c6('0x6')][_0x73c6('0xb')],function(_0x5c0b6f){return{'model':db[_0x5c0b6f['model']],'as':_0x5c0b6f['as'],'attributes':_0x5c0b6f[_0x73c6('0x9')],'include':_0x5c0b6f[_0x73c6('0xb')]?_['map'](_0x5c0b6f[_0x73c6('0xb')],function(_0x4d65ce){return{'model':db[_0x4d65ce[_0x73c6('0xc')]],'as':_0x4d65ce['as'],'attributes':_0x4d65ce[_0x73c6('0x9')],'include':_0x4d65ce[_0x73c6('0xb')]?_['map'](_0x4d65ce[_0x73c6('0xb')],function(_0x1172a7){return{'model':db[_0x1172a7[_0x73c6('0xc')]],'as':_0x1172a7['as'],'attributes':_0x1172a7['attributes']};}):[]};}):[]};}):[]:[]})[_0x73c6('0xd')](function(_0x23a9cd){logger[_0x73c6('0xe')](_0x73c6('0x4'),_0x3a22c6);logger[_0x73c6('0xf')](_0x73c6('0x4'),_0x3a22c6,JSON[_0x73c6('0x10')](_0x23a9cd));_0x144433(_0x23a9cd);})[_0x73c6('0x11')](function(_0x2ce824){logger[_0x73c6('0x12')](_0x73c6('0x4'),_0x2ce824['message'],_0x3a22c6);_0x20937b(_0x2ef602[_0x73c6('0x12')](0x1f4,_0x2ce824[_0x73c6('0x13')]));});});};exports[_0x73c6('0x14')]=function(_0x1d748d){var _0x5d8e18=this;return new Promise(function(_0x1846da,_0x2adb02){return db[_0x73c6('0x15')]['find']({'raw':_0x1d748d['options']?_0x1d748d['options']['raw']===undefined?!![]:![]:!![],'where':_0x1d748d[_0x73c6('0x6')]?_0x1d748d[_0x73c6('0x6')][_0x73c6('0x8')]||null:null,'attributes':_0x1d748d[_0x73c6('0x6')]?_0x1d748d[_0x73c6('0x6')][_0x73c6('0x9')]||null:null,'include':_0x1d748d[_0x73c6('0x6')]?_0x1d748d[_0x73c6('0x6')][_0x73c6('0xb')]?_[_0x73c6('0x16')](_0x1d748d[_0x73c6('0x6')][_0x73c6('0xb')],function(_0x14e1e2){return{'model':db[_0x14e1e2[_0x73c6('0xc')]],'as':_0x14e1e2['as'],'attributes':_0x14e1e2['attributes'],'include':_0x14e1e2['include']?_[_0x73c6('0x16')](_0x14e1e2[_0x73c6('0xb')],function(_0x187242){return{'model':db[_0x187242[_0x73c6('0xc')]],'as':_0x187242['as'],'attributes':_0x187242['attributes'],'include':_0x187242[_0x73c6('0xb')]?_['map'](_0x187242[_0x73c6('0xb')],function(_0x1decd3){return{'model':db[_0x1decd3[_0x73c6('0xc')]],'as':_0x1decd3['as'],'attributes':_0x1decd3[_0x73c6('0x9')]};}):[]};}):[]};}):[]:[]})[_0x73c6('0xd')](function(_0x5b62eb){logger[_0x73c6('0xe')](_0x73c6('0x14'),_0x1d748d);logger[_0x73c6('0xf')](_0x73c6('0x14'),_0x1d748d,JSON[_0x73c6('0x10')](_0x5b62eb));_0x1846da(_0x5b62eb);})[_0x73c6('0x11')](function(_0x27bb64){logger[_0x73c6('0x12')](_0x73c6('0x14'),_0x27bb64[_0x73c6('0x13')],_0x1d748d);_0x2adb02(_0x5d8e18['error'](0x1f4,_0x27bb64[_0x73c6('0x13')]));});});};function checkArrayOfIntervals(_0x374358,_0xc644d9){var _0x14973b=[];return db[_0x73c6('0x15')][_0x73c6('0x5')]({'where':{'id':_0x374358}})['then'](function(_0x2519e6){_0x14973b=_0x2519e6;return Promise['all'](_0x14973b['map'](function(_0x2d8c62){return _0x2d8c62[_0x73c6('0x17')](_0xc644d9);}));})[_0x73c6('0xd')](function(_0x5f5bd8){var _0x213542=_0x5f5bd8[_0x73c6('0x18')](function(_0x405b84,_0xff052){return _0x405b84||_0xff052;},![]);logger['info'](util[_0x73c6('0x19')](_0x73c6('0x1a'),_0x14973b[_0x73c6('0x16')](function(_0x124101){return _0x124101['name'];})[_0x73c6('0x1b')](',\x20'),_0x14973b[_0x73c6('0x16')](function(_0x584712){return _0x584712['id'];})[_0x73c6('0x1b')](',\x20')));return _0x213542;});}function checkSingleInterval(_0xa08e58,_0x376497){return db[_0x73c6('0x15')][_0x73c6('0x1c')](_0xa08e58)['then'](function(_0x47bc8c){if(_0x47bc8c){logger[_0x73c6('0xe')](util[_0x73c6('0x19')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x47bc8c['name'],_0x47bc8c['id']));return _0x47bc8c[_0x73c6('0x17')](_0x376497);}});}exports[_0x73c6('0x1d')]=function(_0x36fafe){var _0x1166b6=_0x36fafe[_0x73c6('0x1e')];var _0x59cc70=Array[_0x73c6('0x1f')](_0x36fafe['intervals'])?_0x36fafe['intervals']:typeof _0x36fafe[_0x73c6('0x20')]===_0x73c6('0x21')?[_0x36fafe[_0x73c6('0x20')]]:[];var _0x1c0a41=_0x36fafe[_0x73c6('0x22')]||undefined;var _0x5877d3=![];if(_0x59cc70[_0x73c6('0x23')]){logger[_0x73c6('0xe')](util[_0x73c6('0x19')](_0x73c6('0x24'),_0x59cc70[_0x73c6('0x1b')](';\x20')));}if(_0x1c0a41){logger[_0x73c6('0xe')](util[_0x73c6('0x19')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x1c0a41));}logger[_0x73c6('0xf')](_0x73c6('0x25'),_0x5877d3);logger[_0x73c6('0x26')](_0x73c6('0x1d'),_0x36fafe);return Promise['resolve']()['then'](function(){if(Array['isArray'](_0x1166b6)){return checkArrayOfIntervals(_0x1166b6,_0x1c0a41);}else if(_0x1166b6){return checkSingleInterval(_0x1166b6,_0x1c0a41);}})[_0x73c6('0xd')](function(_0x112714){var _0x21ae0f=_0x59cc70[_0x73c6('0x18')](function(_0x2c555a,_0x395d9e){return _0x2c555a||iftime(_0x395d9e,_0x1c0a41);},![]);_0x5877d3=_0x112714||_0x21ae0f;return _0x5877d3;})['catch'](function(_0x36b862){logger[_0x73c6('0x12')](_0x73c6('0x1d'),_0x36fafe,_0x36b862);throw this[_0x73c6('0x12')](0x1f4,_0x36b862[_0x73c6('0x13')]);});}; \ No newline at end of file +var _0x2b1b=['limit','include','map','model','info','debug','stringify','catch','error','message','ShowInterval','find','where','then','all','ifTime','reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','IntervalIftime','intervalIds','isArray','intervals','string','timezone','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','lodash','util','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2b1b,0x198));var _0xb2b1=function(_0x43fdbe,_0x480360){_0x43fdbe=_0x43fdbe-0x0;var _0x1dc3c1=_0x2b1b[_0x43fdbe];return _0x1dc3c1;};'use strict';var _=require(_0xb2b1('0x0'));var util=require(_0xb2b1('0x1'));var db=require('../../mysqldb')['db'];var iftime=require(_0xb2b1('0x2'))[_0xb2b1('0x3')];var logger=require(_0xb2b1('0x4'))(_0xb2b1('0x5'));exports[_0xb2b1('0x6')]=function(_0x1dcbd1){var _0xeb45f8=this;return new Promise(function(_0x5c69ea,_0x12863b){return db[_0xb2b1('0x7')][_0xb2b1('0x8')]({'raw':_0x1dcbd1[_0xb2b1('0x9')]?_0x1dcbd1['options'][_0xb2b1('0xa')]===undefined?!![]:![]:!![],'where':_0x1dcbd1[_0xb2b1('0x9')]?_0x1dcbd1['options']['where']||null:null,'attributes':_0x1dcbd1[_0xb2b1('0x9')]?_0x1dcbd1[_0xb2b1('0x9')][_0xb2b1('0xb')]||null:null,'limit':_0x1dcbd1[_0xb2b1('0x9')]?_0x1dcbd1['options'][_0xb2b1('0xc')]||null:null,'include':_0x1dcbd1[_0xb2b1('0x9')]?_0x1dcbd1[_0xb2b1('0x9')][_0xb2b1('0xd')]?_[_0xb2b1('0xe')](_0x1dcbd1['options'][_0xb2b1('0xd')],function(_0x3ca82d){return{'model':db[_0x3ca82d[_0xb2b1('0xf')]],'as':_0x3ca82d['as'],'attributes':_0x3ca82d[_0xb2b1('0xb')],'include':_0x3ca82d[_0xb2b1('0xd')]?_[_0xb2b1('0xe')](_0x3ca82d[_0xb2b1('0xd')],function(_0x2859eb){return{'model':db[_0x2859eb[_0xb2b1('0xf')]],'as':_0x2859eb['as'],'attributes':_0x2859eb[_0xb2b1('0xb')],'include':_0x2859eb[_0xb2b1('0xd')]?_[_0xb2b1('0xe')](_0x2859eb[_0xb2b1('0xd')],function(_0x1e9fd2){return{'model':db[_0x1e9fd2[_0xb2b1('0xf')]],'as':_0x1e9fd2['as'],'attributes':_0x1e9fd2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1018f8){logger[_0xb2b1('0x10')](_0xb2b1('0x6'),_0x1dcbd1);logger[_0xb2b1('0x11')](_0xb2b1('0x6'),_0x1dcbd1,JSON[_0xb2b1('0x12')](_0x1018f8));_0x5c69ea(_0x1018f8);})[_0xb2b1('0x13')](function(_0x1c6d2){logger[_0xb2b1('0x14')]('GetInterval',_0x1c6d2['message'],_0x1dcbd1);_0x12863b(_0xeb45f8[_0xb2b1('0x14')](0x1f4,_0x1c6d2[_0xb2b1('0x15')]));});});};exports[_0xb2b1('0x16')]=function(_0x9b87cb){var _0x36a6df=this;return new Promise(function(_0x2453ab,_0x1490a1){return db[_0xb2b1('0x7')][_0xb2b1('0x17')]({'raw':_0x9b87cb[_0xb2b1('0x9')]?_0x9b87cb[_0xb2b1('0x9')][_0xb2b1('0xa')]===undefined?!![]:![]:!![],'where':_0x9b87cb[_0xb2b1('0x9')]?_0x9b87cb[_0xb2b1('0x9')][_0xb2b1('0x18')]||null:null,'attributes':_0x9b87cb[_0xb2b1('0x9')]?_0x9b87cb[_0xb2b1('0x9')][_0xb2b1('0xb')]||null:null,'include':_0x9b87cb[_0xb2b1('0x9')]?_0x9b87cb[_0xb2b1('0x9')][_0xb2b1('0xd')]?_[_0xb2b1('0xe')](_0x9b87cb[_0xb2b1('0x9')][_0xb2b1('0xd')],function(_0x310f41){return{'model':db[_0x310f41['model']],'as':_0x310f41['as'],'attributes':_0x310f41[_0xb2b1('0xb')],'include':_0x310f41['include']?_['map'](_0x310f41[_0xb2b1('0xd')],function(_0x4da0f){return{'model':db[_0x4da0f[_0xb2b1('0xf')]],'as':_0x4da0f['as'],'attributes':_0x4da0f[_0xb2b1('0xb')],'include':_0x4da0f[_0xb2b1('0xd')]?_[_0xb2b1('0xe')](_0x4da0f['include'],function(_0x56c728){return{'model':db[_0x56c728[_0xb2b1('0xf')]],'as':_0x56c728['as'],'attributes':_0x56c728[_0xb2b1('0xb')]};}):[]};}):[]};}):[]:[]})[_0xb2b1('0x19')](function(_0xc66b77){logger['info'](_0xb2b1('0x16'),_0x9b87cb);logger['debug'](_0xb2b1('0x16'),_0x9b87cb,JSON[_0xb2b1('0x12')](_0xc66b77));_0x2453ab(_0xc66b77);})[_0xb2b1('0x13')](function(_0x53a1df){logger[_0xb2b1('0x14')](_0xb2b1('0x16'),_0x53a1df[_0xb2b1('0x15')],_0x9b87cb);_0x1490a1(_0x36a6df[_0xb2b1('0x14')](0x1f4,_0x53a1df[_0xb2b1('0x15')]));});});};function checkArrayOfIntervals(_0xe9ace7,_0x1a6740){var _0x4e1532=[];return db[_0xb2b1('0x7')][_0xb2b1('0x8')]({'where':{'id':_0xe9ace7}})[_0xb2b1('0x19')](function(_0xd38c62){_0x4e1532=_0xd38c62;return Promise[_0xb2b1('0x1a')](_0x4e1532[_0xb2b1('0xe')](function(_0x346a67){return _0x346a67[_0xb2b1('0x1b')](_0x1a6740);}));})[_0xb2b1('0x19')](function(_0x16725d){var _0x2d0845=_0x16725d[_0xb2b1('0x1c')](function(_0x3fe679,_0x51e793){return _0x3fe679||_0x51e793;},![]);logger['info'](util[_0xb2b1('0x1d')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x4e1532[_0xb2b1('0xe')](function(_0x49d9d7){return _0x49d9d7[_0xb2b1('0x1e')];})[_0xb2b1('0x1f')](',\x20'),_0x4e1532[_0xb2b1('0xe')](function(_0x2fc28f){return _0x2fc28f['id'];})[_0xb2b1('0x1f')](',\x20')));return _0x2d0845;});}function checkSingleInterval(_0x4febaf,_0x5277d3){return db[_0xb2b1('0x7')][_0xb2b1('0x20')](_0x4febaf)[_0xb2b1('0x19')](function(_0x4fff35){if(_0x4fff35){logger[_0xb2b1('0x10')](util[_0xb2b1('0x1d')](_0xb2b1('0x21'),_0x4fff35['name'],_0x4fff35['id']));return _0x4fff35[_0xb2b1('0x1b')](_0x5277d3);}});}exports[_0xb2b1('0x22')]=function(_0x499e7a){var _0x42444f=_0x499e7a[_0xb2b1('0x23')];var _0x1bb86b=Array[_0xb2b1('0x24')](_0x499e7a[_0xb2b1('0x25')])?_0x499e7a['intervals']:typeof _0x499e7a[_0xb2b1('0x25')]===_0xb2b1('0x26')?[_0x499e7a[_0xb2b1('0x25')]]:[];var _0x34f2ba=_0x499e7a[_0xb2b1('0x27')]||undefined;var _0x1ed0b1=![];if(_0x1bb86b['length']){logger[_0xb2b1('0x10')](util['format'](_0xb2b1('0x28'),_0x1bb86b[_0xb2b1('0x1f')](';\x20')));}if(_0x34f2ba){logger[_0xb2b1('0x10')](util[_0xb2b1('0x1d')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x34f2ba));}logger[_0xb2b1('0x11')](_0xb2b1('0x29'),_0x1ed0b1);logger['silly'](_0xb2b1('0x22'),_0x499e7a);return Promise['resolve']()[_0xb2b1('0x19')](function(){if(Array[_0xb2b1('0x24')](_0x42444f)){return checkArrayOfIntervals(_0x42444f,_0x34f2ba);}else if(_0x42444f){return checkSingleInterval(_0x42444f,_0x34f2ba);}})[_0xb2b1('0x19')](function(_0x44b7c2){var _0x410348=_0x1bb86b['reduce'](function(_0x195bb0,_0x47c2aa){return _0x195bb0||iftime(_0x47c2aa,_0x34f2ba);},![]);_0x1ed0b1=_0x44b7c2||_0x410348;return _0x1ed0b1;})[_0xb2b1('0x13')](function(_0x2f17bb){logger['error'](_0xb2b1('0x22'),_0x499e7a,_0x2f17bb);throw this['error'](0x1f4,_0x2f17bb[_0xb2b1('0x15')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index b155247..b1f4748 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x3a78cb,_0x2fbe77){var _0x3c69db=function(_0x267826){while(--_0x267826){_0x3a78cb['push'](_0x3a78cb['shift']());}};_0x3c69db(++_0x2fbe77);}(_0x2ef3,0xba));var _0x32ef=function(_0xb03adc,_0x3cd9d5){_0xb03adc=_0xb03adc-0x0;var _0x4be717=_0x2ef3[_0xb03adc];return _0x4be717;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0xb10b=['./jira.controller','post','send','exports','express','../../components/auth/service'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb10b,0x12a));var _0xbb10=function(_0xb31b62,_0x309405){_0xb31b62=_0xb31b62-0x0;var _0x3928ed=_0xb10b[_0xb31b62];return _0x3928ed;};'use strict';var express=require(_0xbb10('0x0'));var router=express['Router']();var auth=require(_0xbb10('0x1'));var controller=require(_0xbb10('0x2'));router[_0xbb10('0x3')]('/',auth['isAuthenticated'](),controller[_0xbb10('0x4')]);module[_0xbb10('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 fe522a7..81c015a 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 _0x066b=['description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString','base64','setEncoding','utf8','json','parse','error','status','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','end','openIssue','body','headers','remoteAddress','socket','connection','../../config/logger','api','support','3eAmWpBVP0','key','Report','\x20from\x20'];(function(_0x45a766,_0x3c06ea){var _0x270fbe=function(_0x3cb1ce){while(--_0x3cb1ce){_0x45a766['push'](_0x45a766['shift']());}};_0x270fbe(++_0x3c06ea);}(_0x066b,0x1c7));var _0xb066=function(_0xf950f6,_0x21a7e2){_0xf950f6=_0xf950f6-0x0;var _0x136e49=_0x066b[_0xf950f6];return _0x136e49;};'use strict';var BPromise=require('bluebird');var https=require('https');var logger=require(_0xb066('0x0'))(_0xb066('0x1'));var USERNAME=_0xb066('0x2');var PASSWORD=_0xb066('0x3');function openIssue(_0x515ccb,_0x8cc328){var _0x36e029={'fields':{'project':{'key':_0x515ccb[_0xb066('0x4')]||'MOTGUI'},'summary':(_0x515ccb['summary']||_0xb066('0x5'))+_0xb066('0x6')+_0x515ccb['ip'],'description':_0x515ccb[_0xb066('0x7')]||JSON[_0xb066('0x8')](_0x515ccb),'issuetype':{'name':_0x515ccb[_0xb066('0x9')]||_0xb066('0xa')}}};_0x36e029[_0xb066('0xb')][_0xb066('0xc')]=_0x515ccb['email'];_0x36e029[_0xb066('0xb')][_0xb066('0xd')]=_0x515ccb['oldToken'];_0x36e029[_0xb066('0xb')][_0xb066('0xe')]=_0x515ccb[_0xb066('0xf')];_0x36e029[_0xb066('0xb')][_0xb066('0x10')]=_0x515ccb[_0xb066('0x11')];_0x36e029[_0xb066('0xb')][_0xb066('0x12')]=_0x515ccb[_0xb066('0x13')];_0x36e029['fields'][_0xb066('0x14')]=_0x515ccb['ip'];var _0x1753e8={'host':_0xb066('0x15'),'port':0x1bb,'path':_0xb066('0x16'),'method':_0xb066('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xb066('0x18'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xb066('0x19')](_0xb066('0x1a'))}};var _0xbf501a=JSON[_0xb066('0x8')](_0x36e029);var _0x27086f=https['request'](_0x1753e8,function(_0x3be708){_0x3be708[_0xb066('0x1b')](_0xb066('0x1c'));var _0x384771='';_0x3be708['on']('data',function(_0x56ba09){_0x384771+=_0x56ba09;});_0x3be708['on']('end',function(){if(_0x8cc328){return _0x8cc328['status'](_0x3be708['statusCode'])[_0xb066('0x1d')](JSON[_0xb066('0x1e')](_0x384771));}});});_0x27086f['on'](_0xb066('0x1f'),function(_0x3de76d){if(_0x8cc328){return _0x8cc328[_0xb066('0x20')](0x1f4)[_0xb066('0x1d')]({'errors':[{'message':_0xb066('0x21'),'type':_0xb066('0x22')}]});}});_0x27086f['write'](_0xbf501a);_0x27086f[_0xb066('0x23')]();}exports[_0xb066('0x24')]=openIssue;exports['send']=function(_0x59e02c,_0x12e5b8){_0x59e02c[_0xb066('0x25')]['ip']=_0x59e02c[_0xb066('0x26')]['x-forwarded-for']||_0x59e02c['connection'][_0xb066('0x27')]||_0x59e02c[_0xb066('0x28')][_0xb066('0x27')]||_0x59e02c[_0xb066('0x29')][_0xb066('0x28')][_0xb066('0x27')];return openIssue(_0x59e02c[_0xb066('0x25')],_0x12e5b8);}; \ No newline at end of file +var _0x1ebf=['base64','request','utf8','data','end','status','json','parse','error','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','support','key','MOTGUI','summary','Report','\x20from\x20','stringify','issuetype','fields','email','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','toString'];(function(_0x28ef4e,_0x202aa3){var _0x1aa097=function(_0x38ca63){while(--_0x38ca63){_0x28ef4e['push'](_0x28ef4e['shift']());}};_0x1aa097(++_0x202aa3);}(_0x1ebf,0x173));var _0xf1eb=function(_0x320c00,_0x411ae3){_0x320c00=_0x320c00-0x0;var _0x453603=_0x1ebf[_0x320c00];return _0x453603;};'use strict';var BPromise=require(_0xf1eb('0x0'));var https=require(_0xf1eb('0x1'));var logger=require(_0xf1eb('0x2'))('api');var USERNAME=_0xf1eb('0x3');var PASSWORD='3eAmWpBVP0';function openIssue(_0x1da495,_0x5854ca){var _0x550224={'fields':{'project':{'key':_0x1da495[_0xf1eb('0x4')]||_0xf1eb('0x5')},'summary':(_0x1da495[_0xf1eb('0x6')]||_0xf1eb('0x7'))+_0xf1eb('0x8')+_0x1da495['ip'],'description':_0x1da495['description']||JSON[_0xf1eb('0x9')](_0x1da495),'issuetype':{'name':_0x1da495[_0xf1eb('0xa')]||'Bug'}}};_0x550224[_0xf1eb('0xb')]['customfield_11500']=_0x1da495[_0xf1eb('0xc')];_0x550224[_0xf1eb('0xb')]['customfield_11501']=_0x1da495[_0xf1eb('0xd')];_0x550224[_0xf1eb('0xb')][_0xf1eb('0xe')]=_0x1da495[_0xf1eb('0xf')];_0x550224[_0xf1eb('0xb')][_0xf1eb('0x10')]=_0x1da495[_0xf1eb('0x11')];_0x550224['fields'][_0xf1eb('0x12')]=_0x1da495['reason'];_0x550224[_0xf1eb('0xb')][_0xf1eb('0x13')]=_0x1da495['ip'];var _0x2c2ecc={'host':_0xf1eb('0x14'),'port':0x1bb,'path':_0xf1eb('0x15'),'method':_0xf1eb('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0xf1eb('0x17'),'Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xf1eb('0x18')](_0xf1eb('0x19'))}};var _0x4c6739=JSON[_0xf1eb('0x9')](_0x550224);var _0x1598e1=https[_0xf1eb('0x1a')](_0x2c2ecc,function(_0x994199){_0x994199['setEncoding'](_0xf1eb('0x1b'));var _0x503cbc='';_0x994199['on'](_0xf1eb('0x1c'),function(_0x256664){_0x503cbc+=_0x256664;});_0x994199['on'](_0xf1eb('0x1d'),function(){if(_0x5854ca){return _0x5854ca[_0xf1eb('0x1e')](_0x994199['statusCode'])[_0xf1eb('0x1f')](JSON[_0xf1eb('0x20')](_0x503cbc));}});});_0x1598e1['on'](_0xf1eb('0x21'),function(_0x412d39){if(_0x5854ca){return _0x5854ca[_0xf1eb('0x1e')](0x1f4)[_0xf1eb('0x1f')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0xf1eb('0x22')}]});}});_0x1598e1[_0xf1eb('0x23')](_0x4c6739);_0x1598e1['end']();}exports[_0xf1eb('0x24')]=openIssue;exports[_0xf1eb('0x25')]=function(_0x3fc2bd,_0x2ce489){_0x3fc2bd[_0xf1eb('0x26')]['ip']=_0x3fc2bd[_0xf1eb('0x27')][_0xf1eb('0x28')]||_0x3fc2bd[_0xf1eb('0x29')][_0xf1eb('0x2a')]||_0x3fc2bd[_0xf1eb('0x2b')][_0xf1eb('0x2a')]||_0x3fc2bd[_0xf1eb('0x29')]['socket'][_0xf1eb('0x2a')];return openIssue(_0x3fc2bd[_0xf1eb('0x26')],_0x2ce489);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 48ec6a9..30a8be6 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 _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x30d2b1,_0x1d50da){var _0x38533a=function(_0x28bf90){while(--_0x28bf90){_0x30d2b1['push'](_0x30d2b1['shift']());}};_0x38533a(++_0x1d50da);}(_0xa75b,0x170));var _0xba75=function(_0x5f7966,_0x1ea1ff){_0x5f7966=_0x5f7966-0x0;var _0x36f5d7=_0xa75b[_0x5f7966];return _0x36f5d7;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file +var _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x4483,0x1a3));var _0x3448=function(_0x8266d1,_0x2863a3){_0x8266d1=_0x8266d1-0x0;var _0x5192fc=_0x4483[_0x8266d1];return _0x5192fc;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index afd3baf..f0ceb28 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(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x7a54,0x106));var _0x47a5=function(_0x578639,_0x3c6b1d){_0x578639=_0x578639-0x0;var _0x607b07=_0x7a54[_0x578639];return _0x607b07;};'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(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0x7a54,0x106));var _0x47a5=function(_0x79e953,_0x43e816){_0x79e953=_0x79e953-0x0;var _0x1792e8=_0x7a54[_0x79e953];return _0x1792e8;};'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 d21f3e5..033f994 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 _0x4813=['offset','limit','Content-Range','apply','save','then','destroy','end','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','includeAll','include','rows','show','params','keys','catch','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4813,0x14e));var _0x3481=function(_0x4a7bd3,_0x3e1e8a){_0x4a7bd3=_0x4a7bd3-0x0;var _0xf0b402=_0x4813[_0x4a7bd3];return _0xf0b402;};'use strict';var emlformat=require(_0x3481('0x0'));var rimraf=require(_0x3481('0x1'));var zipdir=require(_0x3481('0x2'));var jsonpatch=require(_0x3481('0x3'));var rp=require(_0x3481('0x4'));var moment=require(_0x3481('0x5'));var BPromise=require(_0x3481('0x6'));var Mustache=require('mustache');var util=require(_0x3481('0x7'));var path=require(_0x3481('0x8'));var sox=require(_0x3481('0x9'));var csv=require(_0x3481('0xa'));var ejs=require(_0x3481('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3481('0xc'));var crypto=require('crypto');var jsforce=require(_0x3481('0xd'));var deskjs=require(_0x3481('0xe'));var toCsv=require(_0x3481('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3481('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3481('0x10'));var logger=require(_0x3481('0x11'))(_0x3481('0x12'));var utils=require(_0x3481('0x13'));var config=require(_0x3481('0x14'));var licenseUtil=require(_0x3481('0x15'));var db=require(_0x3481('0x16'))['db'];function respondWithStatusCode(_0x3f1376,_0x37cc2b){_0x37cc2b=_0x37cc2b||0xcc;return function(_0x22b89b){if(_0x22b89b){return _0x3f1376[_0x3481('0x17')](_0x37cc2b);}return _0x3f1376[_0x3481('0x18')](_0x37cc2b)['end']();};}function respondWithResult(_0x16358e,_0xb77c75){_0xb77c75=_0xb77c75||0xc8;return function(_0x1bcfad){if(_0x1bcfad){return _0x16358e[_0x3481('0x18')](_0xb77c75)[_0x3481('0x19')](_0x1bcfad);}};}function respondWithFilteredResult(_0x39e581,_0x4a1d09){return function(_0x1bb126){if(_0x1bb126){var _0x41c2aa=typeof _0x4a1d09['offset']==='undefined'&&typeof _0x4a1d09['limit']==='undefined';var _0x4f5d1b=_0x1bb126['count'];var _0x32a315=_0x41c2aa?0x0:_0x4a1d09[_0x3481('0x1a')];var _0x5a8e65=_0x41c2aa?_0x1bb126['count']:_0x4a1d09[_0x3481('0x1a')]+_0x4a1d09[_0x3481('0x1b')];var _0x3b43dc;if(_0x5a8e65>=_0x4f5d1b){_0x5a8e65=_0x4f5d1b;_0x3b43dc=0xc8;}else{_0x3b43dc=0xce;}_0x39e581['status'](_0x3b43dc);return _0x39e581['set'](_0x3481('0x1c'),_0x32a315+'-'+_0x5a8e65+'/'+_0x4f5d1b)[_0x3481('0x19')](_0x1bb126);}return null;};}function patchUpdates(_0x1e0aa0){return function(_0x1ba743){try{jsonpatch[_0x3481('0x1d')](_0x1ba743,_0x1e0aa0,!![]);}catch(_0x4469d4){return BPromise['reject'](_0x4469d4);}return _0x1ba743[_0x3481('0x1e')]();};}function saveUpdates(_0x3cdb98,_0x162305){return function(_0xea1072){if(_0xea1072){return _0xea1072['update'](_0x3cdb98)[_0x3481('0x1f')](function(_0x48eb64){return _0x48eb64;});}return null;};}function removeEntity(_0x2185ba,_0x33c6fa){return function(_0x418a7d){if(_0x418a7d){return _0x418a7d[_0x3481('0x20')]()['then'](function(){_0x2185ba['status'](0xcc)[_0x3481('0x21')]();});}};}function handleEntityNotFound(_0x3e5963,_0x249754){return function(_0x405816){if(!_0x405816){_0x3e5963['sendStatus'](0x194);}return _0x405816;};}function handleError(_0x2e837a,_0x6ce3f3){_0x6ce3f3=_0x6ce3f3||0x1f4;return function(_0x1181e1){logger[_0x3481('0x22')](_0x1181e1[_0x3481('0x23')]);if(_0x1181e1[_0x3481('0x24')]){delete _0x1181e1[_0x3481('0x24')];}_0x2e837a[_0x3481('0x18')](_0x6ce3f3)[_0x3481('0x25')](_0x1181e1);};}exports[_0x3481('0x26')]=function(_0x4a20d5,_0x131363){var _0x4a8492={},_0xdcacba={},_0x1f079a={'count':0x0,'rows':[]};var _0x2864f1=_['map'](db[_0x3481('0x27')][_0x3481('0x28')],function(_0x2df894){return{'name':_0x2df894[_0x3481('0x29')],'type':_0x2df894[_0x3481('0x2a')]['key']};});_0xdcacba[_0x3481('0x2b')]=_[_0x3481('0x2c')](_0x2864f1,_0x3481('0x24'));_0xdcacba[_0x3481('0x2d')]=_['keys'](_0x4a20d5[_0x3481('0x2d')]);_0xdcacba[_0x3481('0x2e')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],_0xdcacba[_0x3481('0x2d')]);_0x4a8492[_0x3481('0x30')]=_[_0x3481('0x2f')](_0xdcacba[_0x3481('0x2b')],qs['fields'](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x31')]));_0x4a8492[_0x3481('0x30')]=_0x4a8492['attributes'][_0x3481('0x32')]?_0x4a8492['attributes']:_0xdcacba[_0x3481('0x2b')];if(!_0x4a20d5['query'][_0x3481('0x33')]('nolimit')){_0x4a8492[_0x3481('0x1b')]=qs[_0x3481('0x1b')](_0x4a20d5[_0x3481('0x2d')]['limit']);_0x4a8492[_0x3481('0x1a')]=qs['offset'](_0x4a20d5[_0x3481('0x2d')]['offset']);}_0x4a8492[_0x3481('0x34')]=qs[_0x3481('0x35')](_0x4a20d5[_0x3481('0x2d')][_0x3481('0x35')]);_0x4a8492[_0x3481('0x36')]=qs[_0x3481('0x2e')](_[_0x3481('0x37')](_0x4a20d5[_0x3481('0x2d')],_0xdcacba[_0x3481('0x2e')]),_0x2864f1);if(_0x4a20d5['query'][_0x3481('0x38')]){_0x4a8492['where']=_[_0x3481('0x39')](_0x4a8492[_0x3481('0x36')],{'$or':_[_0x3481('0x2c')](_0x2864f1,function(_0x40fd6f){if(_0x40fd6f['type']!=='VIRTUAL'){var _0x2207fb={};_0x2207fb[_0x40fd6f[_0x3481('0x24')]]={'$like':'%'+_0x4a20d5[_0x3481('0x2d')][_0x3481('0x38')]+'%'};return _0x2207fb;}})});}_0x4a8492=_['merge']({},_0x4a8492,_0x4a20d5[_0x3481('0x3a')]);var _0x3c7874={'where':_0x4a8492[_0x3481('0x36')]};return db[_0x3481('0x27')][_0x3481('0x3b')](_0x3c7874)[_0x3481('0x1f')](function(_0x33c33f){_0x1f079a['count']=_0x33c33f;if(_0x4a20d5[_0x3481('0x2d')][_0x3481('0x3c')]){_0x4a8492[_0x3481('0x3d')]=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x4a8492);})[_0x3481('0x1f')](function(_0x420b8c){_0x1f079a[_0x3481('0x3e')]=_0x420b8c;return _0x1f079a;})['then'](respondWithFilteredResult(_0x131363,_0x4a8492))['catch'](handleError(_0x131363,null));};exports[_0x3481('0x3f')]=function(_0x335292,_0x3fc0e7){var _0xbccc9e={'raw':!![],'where':{'id':_0x335292[_0x3481('0x40')]['id']}},_0x5c4928={};_0x5c4928['model']=_[_0x3481('0x41')](db[_0x3481('0x27')][_0x3481('0x28')]);_0x5c4928[_0x3481('0x2d')]=_['keys'](_0x335292['query']);_0x5c4928['filters']=_['intersection'](_0x5c4928[_0x3481('0x2b')],_0x5c4928[_0x3481('0x2d')]);_0xbccc9e[_0x3481('0x30')]=_[_0x3481('0x2f')](_0x5c4928[_0x3481('0x2b')],qs[_0x3481('0x31')](_0x335292[_0x3481('0x2d')][_0x3481('0x31')]));_0xbccc9e[_0x3481('0x30')]=_0xbccc9e[_0x3481('0x30')][_0x3481('0x32')]?_0xbccc9e['attributes']:_0x5c4928['model'];if(_0x335292[_0x3481('0x2d')][_0x3481('0x3c')]){_0xbccc9e[_0x3481('0x3d')]=[{'all':!![]}];}_0xbccc9e=_[_0x3481('0x39')]({},_0xbccc9e,_0x335292['options']);return db[_0x3481('0x27')]['find'](_0xbccc9e)[_0x3481('0x1f')](handleEntityNotFound(_0x3fc0e7,null))[_0x3481('0x1f')](respondWithResult(_0x3fc0e7,null))[_0x3481('0x42')](handleError(_0x3fc0e7,null));};exports[_0x3481('0x43')]=function(_0x30f54e,_0x50dd72){return db[_0x3481('0x27')]['create'](_0x30f54e[_0x3481('0x44')],{})[_0x3481('0x1f')](respondWithResult(_0x50dd72,0xc9))['catch'](handleError(_0x50dd72,null));};exports[_0x3481('0x45')]=function(_0x54ec34,_0x27e106){if(_0x54ec34[_0x3481('0x44')]['id']){delete _0x54ec34[_0x3481('0x44')]['id'];}return db['JscriptyAnswerReport']['find']({'where':{'id':_0x54ec34[_0x3481('0x40')]['id']}})[_0x3481('0x1f')](handleEntityNotFound(_0x27e106,null))[_0x3481('0x1f')](saveUpdates(_0x54ec34[_0x3481('0x44')],null))['then'](respondWithResult(_0x27e106,null))[_0x3481('0x42')](handleError(_0x27e106,null));};exports[_0x3481('0x20')]=function(_0xdd5422,_0x4b7598){return db['JscriptyAnswerReport'][_0x3481('0x46')]({'where':{'id':_0xdd5422[_0x3481('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b7598,null))[_0x3481('0x1f')](removeEntity(_0x4b7598,null))[_0x3481('0x42')](handleError(_0x4b7598,null));};exports[_0x3481('0x47')]=function(_0x222b83,_0x403ba9){return db['JscriptyAnswerReport'][_0x3481('0x47')]()[_0x3481('0x1f')](respondWithResult(_0x403ba9,null))[_0x3481('0x42')](handleError(_0x403ba9,null));}; \ No newline at end of file +var _0x5d58=['undefined','limit','count','set','apply','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','JscriptyAnswerReport','include','findAll','rows','show','params','rawAttributes','keys','length','includeAll','merge','create','update','find','catch','destroy','describe','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x5d58,0x187));var _0x85d5=function(_0x314848,_0x52277){_0x314848=_0x314848-0x0;var _0x26afa2=_0x5d58[_0x314848];return _0x26afa2;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x85d5('0x0'));var BPromise=require(_0x85d5('0x1'));var Mustache=require('mustache');var util=require(_0x85d5('0x2'));var path=require(_0x85d5('0x3'));var sox=require('sox');var csv=require(_0x85d5('0x4'));var ejs=require(_0x85d5('0x5'));var fs=require('fs');var fs_extra=require(_0x85d5('0x6'));var _=require(_0x85d5('0x7'));var squel=require('squel');var crypto=require(_0x85d5('0x8'));var jsforce=require(_0x85d5('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x85d5('0x4'));var querystring=require('querystring');var Papa=require(_0x85d5('0xa'));var Redis=require(_0x85d5('0xb'));var authService=require(_0x85d5('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x85d5('0xd'))(_0x85d5('0xe'));var utils=require(_0x85d5('0xf'));var config=require(_0x85d5('0x10'));var licenseUtil=require(_0x85d5('0x11'));var db=require(_0x85d5('0x12'))['db'];function respondWithStatusCode(_0x31409d,_0x5897af){_0x5897af=_0x5897af||0xcc;return function(_0x4bbf2a){if(_0x4bbf2a){return _0x31409d['sendStatus'](_0x5897af);}return _0x31409d[_0x85d5('0x13')](_0x5897af)[_0x85d5('0x14')]();};}function respondWithResult(_0x339d4f,_0x1704f0){_0x1704f0=_0x1704f0||0xc8;return function(_0x18a20c){if(_0x18a20c){return _0x339d4f[_0x85d5('0x13')](_0x1704f0)[_0x85d5('0x15')](_0x18a20c);}};}function respondWithFilteredResult(_0x586382,_0x18e977){return function(_0x2d7c95){if(_0x2d7c95){var _0x1621ed=typeof _0x18e977[_0x85d5('0x16')]===_0x85d5('0x17')&&typeof _0x18e977[_0x85d5('0x18')]===_0x85d5('0x17');var _0x12bef9=_0x2d7c95[_0x85d5('0x19')];var _0x17acb0=_0x1621ed?0x0:_0x18e977[_0x85d5('0x16')];var _0x432bd6=_0x1621ed?_0x2d7c95[_0x85d5('0x19')]:_0x18e977[_0x85d5('0x16')]+_0x18e977[_0x85d5('0x18')];var _0x26981b;if(_0x432bd6>=_0x12bef9){_0x432bd6=_0x12bef9;_0x26981b=0xc8;}else{_0x26981b=0xce;}_0x586382[_0x85d5('0x13')](_0x26981b);return _0x586382[_0x85d5('0x1a')]('Content-Range',_0x17acb0+'-'+_0x432bd6+'/'+_0x12bef9)[_0x85d5('0x15')](_0x2d7c95);}return null;};}function patchUpdates(_0x133fa9){return function(_0x5f5755){try{jsonpatch[_0x85d5('0x1b')](_0x5f5755,_0x133fa9,!![]);}catch(_0x1264ca){return BPromise['reject'](_0x1264ca);}return _0x5f5755['save']();};}function saveUpdates(_0x347337,_0x5a1b9a){return function(_0x2f2bae){if(_0x2f2bae){return _0x2f2bae['update'](_0x347337)[_0x85d5('0x1c')](function(_0x1f8d27){return _0x1f8d27;});}return null;};}function removeEntity(_0x560b3a,_0x4e11c4){return function(_0x4da71b){if(_0x4da71b){return _0x4da71b['destroy']()[_0x85d5('0x1c')](function(){_0x560b3a[_0x85d5('0x13')](0xcc)[_0x85d5('0x14')]();});}};}function handleEntityNotFound(_0x466bbd,_0x12fea3){return function(_0xef2405){if(!_0xef2405){_0x466bbd['sendStatus'](0x194);}return _0xef2405;};}function handleError(_0x7e9a11,_0x4f8c66){_0x4f8c66=_0x4f8c66||0x1f4;return function(_0x1b3fae){logger[_0x85d5('0x1d')](_0x1b3fae[_0x85d5('0x1e')]);if(_0x1b3fae['name']){delete _0x1b3fae[_0x85d5('0x1f')];}_0x7e9a11[_0x85d5('0x13')](_0x4f8c66)[_0x85d5('0x20')](_0x1b3fae);};}exports[_0x85d5('0x21')]=function(_0x4605c5,_0x56031f){var _0x1cbef1={},_0x476c8b={},_0x330f8a={'count':0x0,'rows':[]};var _0x22a961=_[_0x85d5('0x22')](db['JscriptyAnswerReport']['rawAttributes'],function(_0x2ce7a9){return{'name':_0x2ce7a9[_0x85d5('0x23')],'type':_0x2ce7a9[_0x85d5('0x24')][_0x85d5('0x25')]};});_0x476c8b[_0x85d5('0x26')]=_['map'](_0x22a961,_0x85d5('0x1f'));_0x476c8b[_0x85d5('0x27')]=_['keys'](_0x4605c5['query']);_0x476c8b[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x476c8b['model'],_0x476c8b[_0x85d5('0x27')]);_0x1cbef1['attributes']=_[_0x85d5('0x29')](_0x476c8b[_0x85d5('0x26')],qs['fields'](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x1cbef1[_0x85d5('0x2b')]=_0x1cbef1[_0x85d5('0x2b')]['length']?_0x1cbef1['attributes']:_0x476c8b[_0x85d5('0x26')];if(!_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2c')](_0x85d5('0x2d'))){_0x1cbef1[_0x85d5('0x18')]=qs[_0x85d5('0x18')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x18')]);_0x1cbef1[_0x85d5('0x16')]=qs['offset'](_0x4605c5['query'][_0x85d5('0x16')]);}_0x1cbef1[_0x85d5('0x2e')]=qs[_0x85d5('0x2f')](_0x4605c5[_0x85d5('0x27')][_0x85d5('0x2f')]);_0x1cbef1[_0x85d5('0x30')]=qs[_0x85d5('0x28')](_[_0x85d5('0x31')](_0x4605c5['query'],_0x476c8b[_0x85d5('0x28')]),_0x22a961);if(_0x4605c5[_0x85d5('0x27')][_0x85d5('0x32')]){_0x1cbef1[_0x85d5('0x30')]=_['merge'](_0x1cbef1[_0x85d5('0x30')],{'$or':_[_0x85d5('0x22')](_0x22a961,function(_0x3282d3){if(_0x3282d3[_0x85d5('0x24')]!=='VIRTUAL'){var _0x34caed={};_0x34caed[_0x3282d3['name']]={'$like':'%'+_0x4605c5['query'][_0x85d5('0x32')]+'%'};return _0x34caed;}})});}_0x1cbef1=_['merge']({},_0x1cbef1,_0x4605c5[_0x85d5('0x33')]);var _0x5ddba7={'where':_0x1cbef1['where']};return db[_0x85d5('0x34')][_0x85d5('0x19')](_0x5ddba7)[_0x85d5('0x1c')](function(_0x1beffc){_0x330f8a[_0x85d5('0x19')]=_0x1beffc;if(_0x4605c5['query']['includeAll']){_0x1cbef1[_0x85d5('0x35')]=[{'all':!![]}];}return db[_0x85d5('0x34')][_0x85d5('0x36')](_0x1cbef1);})[_0x85d5('0x1c')](function(_0xdd8b3e){_0x330f8a[_0x85d5('0x37')]=_0xdd8b3e;return _0x330f8a;})['then'](respondWithFilteredResult(_0x56031f,_0x1cbef1))['catch'](handleError(_0x56031f,null));};exports[_0x85d5('0x38')]=function(_0x52c99b,_0xfbf466){var _0x18e94d={'raw':!![],'where':{'id':_0x52c99b[_0x85d5('0x39')]['id']}},_0x7dd430={};_0x7dd430[_0x85d5('0x26')]=_['keys'](db['JscriptyAnswerReport'][_0x85d5('0x3a')]);_0x7dd430[_0x85d5('0x27')]=_[_0x85d5('0x3b')](_0x52c99b[_0x85d5('0x27')]);_0x7dd430[_0x85d5('0x28')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],_0x7dd430[_0x85d5('0x27')]);_0x18e94d[_0x85d5('0x2b')]=_[_0x85d5('0x29')](_0x7dd430[_0x85d5('0x26')],qs[_0x85d5('0x2a')](_0x52c99b[_0x85d5('0x27')][_0x85d5('0x2a')]));_0x18e94d[_0x85d5('0x2b')]=_0x18e94d[_0x85d5('0x2b')][_0x85d5('0x3c')]?_0x18e94d['attributes']:_0x7dd430['model'];if(_0x52c99b[_0x85d5('0x27')][_0x85d5('0x3d')]){_0x18e94d[_0x85d5('0x35')]=[{'all':!![]}];}_0x18e94d=_[_0x85d5('0x3e')]({},_0x18e94d,_0x52c99b[_0x85d5('0x33')]);return db[_0x85d5('0x34')]['find'](_0x18e94d)[_0x85d5('0x1c')](handleEntityNotFound(_0xfbf466,null))['then'](respondWithResult(_0xfbf466,null))['catch'](handleError(_0xfbf466,null));};exports[_0x85d5('0x3f')]=function(_0x13ab32,_0x12a03){return db[_0x85d5('0x34')][_0x85d5('0x3f')](_0x13ab32['body'],{})[_0x85d5('0x1c')](respondWithResult(_0x12a03,0xc9))['catch'](handleError(_0x12a03,null));};exports[_0x85d5('0x40')]=function(_0xd8db57,_0x219154){if(_0xd8db57['body']['id']){delete _0xd8db57['body']['id'];}return db['JscriptyAnswerReport'][_0x85d5('0x41')]({'where':{'id':_0xd8db57[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x219154,null))['then'](saveUpdates(_0xd8db57['body'],null))[_0x85d5('0x1c')](respondWithResult(_0x219154,null))[_0x85d5('0x42')](handleError(_0x219154,null));};exports[_0x85d5('0x43')]=function(_0x288b56,_0x4b2dce){return db[_0x85d5('0x34')][_0x85d5('0x41')]({'where':{'id':_0x288b56[_0x85d5('0x39')]['id']}})[_0x85d5('0x1c')](handleEntityNotFound(_0x4b2dce,null))[_0x85d5('0x1c')](removeEntity(_0x4b2dce,null))[_0x85d5('0x42')](handleError(_0x4b2dce,null));};exports[_0x85d5('0x44')]=function(_0x34b784,_0x185a70){return db[_0x85d5('0x34')][_0x85d5('0x44')]()[_0x85d5('0x1c')](respondWithResult(_0x185a70,null))[_0x85d5('0x42')](handleError(_0x185a70,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index d4d50f2..c89337e 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 _0x02a4=['report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport'];(function(_0x20e127,_0x4f8afb){var _0x4522fc=function(_0x28c32d){while(--_0x28c32d){_0x20e127['push'](_0x20e127['shift']());}};_0x4522fc(++_0x4f8afb);}(_0x02a4,0x146));var _0x402a=function(_0x5c5eb0,_0x550970){_0x5c5eb0=_0x5c5eb0-0x0;var _0x46ab0b=_0x02a4[_0x5c5eb0];return _0x46ab0b;};'use strict';var _=require(_0x402a('0x0'));var util=require(_0x402a('0x1'));var logger=require(_0x402a('0x2'))(_0x402a('0x3'));var moment=require(_0x402a('0x4'));var BPromise=require(_0x402a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x402a('0x6'));var rimraf=require(_0x402a('0x7'));var config=require('../../config/environment');var attributes=require(_0x402a('0x8'));module[_0x402a('0x9')]=function(_0x2b95e3,_0x3c9164){return _0x2b95e3[_0x402a('0xa')](_0x402a('0xb'),attributes,{'tableName':_0x402a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6edf=['request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','util','../../config/logger','api','moment'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x6edf,0x11a));var _0xf6ed=function(_0x27f417,_0x1b2a3d){_0x27f417=_0x27f417-0x0;var _0x195d8e=_0x6edf[_0x27f417];return _0x195d8e;};'use strict';var _=require('lodash');var util=require(_0xf6ed('0x0'));var logger=require(_0xf6ed('0x1'))(_0xf6ed('0x2'));var moment=require(_0xf6ed('0x3'));var BPromise=require('bluebird');var rp=require(_0xf6ed('0x4'));var fs=require('fs');var path=require(_0xf6ed('0x5'));var rimraf=require(_0xf6ed('0x6'));var config=require(_0xf6ed('0x7'));var attributes=require(_0xf6ed('0x8'));module[_0xf6ed('0x9')]=function(_0xe196a5,_0x3c9de8){return _0xe196a5[_0xf6ed('0xa')](_0xf6ed('0xb'),attributes,{'tableName':_0xf6ed('0xc'),'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 18d7463..36fc59a 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 _0x6c23=['http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client'];(function(_0x36f1ec,_0x2ae8df){var _0x3f1a27=function(_0xcd054){while(--_0xcd054){_0x36f1ec['push'](_0x36f1ec['shift']());}};_0x3f1a27(++_0x2ae8df);}(_0x6c23,0x146));var _0x36c2=function(_0x4020bc,_0x17bcf4){_0x4020bc=_0x4020bc-0x0;var _0x4bdae2=_0x6c23[_0x4020bc];return _0x4bdae2;};'use strict';var _=require(_0x36c2('0x0'));var util=require(_0x36c2('0x1'));var moment=require(_0x36c2('0x2'));var BPromise=require(_0x36c2('0x3'));var rs=require(_0x36c2('0x4'));var fs=require('fs');var Redis=require(_0x36c2('0x5'));var db=require(_0x36c2('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x36c2('0x7'));var config=require('../../config/environment');var jayson=require(_0x36c2('0x8'));var client=jayson[_0x36c2('0x9')][_0x36c2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37ffe5,_0x1bcd4b,_0x249a36){return new BPromise(function(_0x23967c,_0x4e39c4){return client[_0x36c2('0xb')](_0x37ffe5,_0x249a36)['then'](function(_0x2d890e){logger[_0x36c2('0xc')](_0x36c2('0xd'),_0x1bcd4b,_0x36c2('0xe'));logger[_0x36c2('0xf')](_0x36c2('0x10'),_0x1bcd4b,'request\x20sent',JSON[_0x36c2('0x11')](_0x2d890e));if(_0x2d890e[_0x36c2('0x12')]){if(_0x2d890e[_0x36c2('0x12')][_0x36c2('0x13')]===0x1f4){logger[_0x36c2('0x12')](_0x36c2('0xd'),_0x1bcd4b,_0x2d890e[_0x36c2('0x12')][_0x36c2('0x14')]);return _0x4e39c4(_0x2d890e[_0x36c2('0x12')][_0x36c2('0x14')]);}logger[_0x36c2('0x12')](_0x36c2('0xd'),_0x1bcd4b,_0x2d890e[_0x36c2('0x12')]['message']);return _0x23967c(_0x2d890e[_0x36c2('0x12')][_0x36c2('0x14')]);}else{logger[_0x36c2('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1bcd4b,_0x36c2('0xe'));_0x23967c(_0x2d890e['result']['message']);}})['catch'](function(_0x29e392){logger[_0x36c2('0x12')](_0x36c2('0xd'),_0x1bcd4b,_0x29e392);_0x4e39c4(_0x29e392);});});} \ No newline at end of file +var _0x2ad4=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x1551b6,_0x278954){var _0x1c0b77=function(_0x252ba8){while(--_0x252ba8){_0x1551b6['push'](_0x1551b6['shift']());}};_0x1c0b77(++_0x278954);}(_0x2ad4,0xbd));var _0x42ad=function(_0x458363,_0x1675db){_0x458363=_0x458363-0x0;var _0x4d0290=_0x2ad4[_0x458363];return _0x4d0290;};'use strict';var _=require(_0x42ad('0x0'));var util=require(_0x42ad('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42ad('0x2'))['db'];var utils=require(_0x42ad('0x3'));var logger=require(_0x42ad('0x4'))(_0x42ad('0x5'));var config=require(_0x42ad('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x42ad('0x7')][_0x42ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x379e3b,_0xad5186,_0x50356f){return new BPromise(function(_0x3c3212,_0x288dac){return client[_0x42ad('0x9')](_0x379e3b,_0x50356f)[_0x42ad('0xa')](function(_0x5dfd84){logger[_0x42ad('0xb')](_0x42ad('0xc'),_0xad5186,'request\x20sent');logger[_0x42ad('0xd')](_0x42ad('0xe'),_0xad5186,_0x42ad('0xf'),JSON[_0x42ad('0x10')](_0x5dfd84));if(_0x5dfd84[_0x42ad('0x11')]){if(_0x5dfd84['error'][_0x42ad('0x12')]===0x1f4){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0xad5186,_0x5dfd84[_0x42ad('0x11')][_0x42ad('0x13')]);return _0x288dac(_0x5dfd84['error'][_0x42ad('0x13')]);}logger[_0x42ad('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xad5186,_0x5dfd84[_0x42ad('0x11')][_0x42ad('0x13')]);return _0x3c3212(_0x5dfd84['error'][_0x42ad('0x13')]);}else{logger[_0x42ad('0xb')](_0x42ad('0xc'),_0xad5186,_0x42ad('0xf'));_0x3c3212(_0x5dfd84[_0x42ad('0x14')][_0x42ad('0x13')]);}})[_0x42ad('0x15')](function(_0x1e358f){logger[_0x42ad('0x11')]('JscriptyAnswerReport,\x20%s,\x20%s',_0xad5186,_0x1e358f);_0x288dac(_0x1e358f);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 47b421e..07c72fb 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 _0xbd40=['/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0xbd40,0x17a));var _0x0bd4=function(_0x1ecc77,_0x3a29cf){_0x1ecc77=_0x1ecc77-0x0;var _0x459696=_0xbd40[_0x1ecc77];return _0x459696;};'use strict';var multer=require(_0x0bd4('0x0'));var util=require(_0x0bd4('0x1'));var path=require(_0x0bd4('0x2'));var timeout=require(_0x0bd4('0x3'));var express=require(_0x0bd4('0x4'));var router=express[_0x0bd4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0bd4('0x6'));var interaction=require(_0x0bd4('0x7'));var config=require('../../config/environment');var controller=require(_0x0bd4('0x8'));router[_0x0bd4('0x9')]('/',auth[_0x0bd4('0xa')](),controller[_0x0bd4('0xb')]);router[_0x0bd4('0x9')](_0x0bd4('0xc'),auth[_0x0bd4('0xa')](),controller[_0x0bd4('0xd')]);router[_0x0bd4('0x9')](_0x0bd4('0xe'),auth[_0x0bd4('0xa')](),controller[_0x0bd4('0xf')]);router['get'](_0x0bd4('0x10'),auth['isAuthenticated'](),controller[_0x0bd4('0x11')]);router[_0x0bd4('0x9')](_0x0bd4('0x12'),auth[_0x0bd4('0xa')](),timeout(_0x0bd4('0x13')),controller['getSummary']);router[_0x0bd4('0x14')]('/',auth[_0x0bd4('0xa')](),controller[_0x0bd4('0x15')]);router[_0x0bd4('0x14')](_0x0bd4('0x16'),auth['isAuthenticated'](),controller[_0x0bd4('0x17')]);router[_0x0bd4('0x18')](_0x0bd4('0xc'),auth[_0x0bd4('0xa')](),controller[_0x0bd4('0x19')]);router[_0x0bd4('0x1a')](_0x0bd4('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x0bd4('0x1b')]=router; \ No newline at end of file +var _0xd3fe=['destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','show','/:id/sessions','isAuthenticated','getAnswers','/:id/summary','30s','post','create','/:id/clone','clone','put','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xd3fe,0x187));var _0xed3f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3fe[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xed3f('0x0'));var path=require(_0xed3f('0x1'));var timeout=require(_0xed3f('0x2'));var express=require(_0xed3f('0x3'));var router=express[_0xed3f('0x4')]();var fs_extra=require(_0xed3f('0x5'));var auth=require(_0xed3f('0x6'));var interaction=require(_0xed3f('0x7'));var config=require(_0xed3f('0x8'));var controller=require(_0xed3f('0x9'));router[_0xed3f('0xa')]('/',auth['isAuthenticated'](),controller[_0xed3f('0xb')]);router[_0xed3f('0xa')](_0xed3f('0xc'),auth['isAuthenticated'](),controller[_0xed3f('0xd')]);router[_0xed3f('0xa')](_0xed3f('0xe'),auth[_0xed3f('0xf')](),controller['getSessions']);router[_0xed3f('0xa')]('/:id/answers',auth[_0xed3f('0xf')](),controller[_0xed3f('0x10')]);router[_0xed3f('0xa')](_0xed3f('0x11'),auth[_0xed3f('0xf')](),timeout(_0xed3f('0x12')),controller['getSummary']);router[_0xed3f('0x13')]('/',auth[_0xed3f('0xf')](),controller[_0xed3f('0x14')]);router[_0xed3f('0x13')](_0xed3f('0x15'),auth[_0xed3f('0xf')](),controller[_0xed3f('0x16')]);router[_0xed3f('0x17')](_0xed3f('0xc'),auth[_0xed3f('0xf')](),controller[_0xed3f('0x18')]);router['delete']('/:id',auth[_0xed3f('0xf')](),controller[_0xed3f('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 4bd8b13..0caa51a 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 _0x5a61=['formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','stringify'];(function(_0x5e8f17,_0x195558){var _0x6f43fd=function(_0x1d4a55){while(--_0x1d4a55){_0x5e8f17['push'](_0x5e8f17['shift']());}};_0x6f43fd(++_0x195558);}(_0x5a61,0x1c5));var _0x15a6=function(_0x132fc8,_0x4f10c0){_0x132fc8=_0x132fc8-0x0;var _0x194b1d=_0x5a61[_0x132fc8];return _0x194b1d;};'use strict';var Sequelize=require('sequelize');var _=require(_0x15a6('0x0'));var util=require('util');module[_0x15a6('0x1')]={'name':{'type':Sequelize[_0x15a6('0x2')],'unique':_0x15a6('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x15a6('0x4')](_0x15a6('0x5')),'set':function(_0x5ac4bf){if(_[_0x15a6('0x6')](_0x5ac4bf)){this[_0x15a6('0x7')]('formData',JSON[_0x15a6('0x8')](_0x5ac4bf));}else if(_['isString'](_0x5ac4bf)){this['setDataValue'](_0x15a6('0x9'),_0x5ac4bf);}else{this[_0x15a6('0x7')](_0x15a6('0x9'),util[_0x15a6('0xa')](_0x15a6('0xb'),this[_0x15a6('0xc')]('name')||'',this[_0x15a6('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x15a6('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x15a6('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x01d2=['isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports','STRING','name','TEXT','setDataValue','formData'];(function(_0x3fcf06,_0x5e1aed){var _0x16205a=function(_0x39fe30){while(--_0x39fe30){_0x3fcf06['push'](_0x3fcf06['shift']());}};_0x16205a(++_0x5e1aed);}(_0x01d2,0xf4));var _0x201d=function(_0x3d12e8,_0x23bed3){_0x3d12e8=_0x3d12e8-0x0;var _0x436b99=_0x01d2[_0x3d12e8];return _0x436b99;};'use strict';var Sequelize=require(_0x201d('0x0'));var _=require('lodash');var util=require(_0x201d('0x1'));module[_0x201d('0x2')]={'name':{'type':Sequelize[_0x201d('0x3')],'unique':_0x201d('0x4')},'description':{'type':Sequelize[_0x201d('0x3')]},'formData':{'type':Sequelize[_0x201d('0x5')]('long'),'set':function(_0x1c3ad2){if(_['isObjectLike'](_0x1c3ad2)){this[_0x201d('0x6')](_0x201d('0x7'),JSON['stringify'](_0x1c3ad2));}else if(_[_0x201d('0x8')](_0x1c3ad2)){this[_0x201d('0x6')](_0x201d('0x7'),_0x1c3ad2);}else{this[_0x201d('0x6')](_0x201d('0x7'),util[_0x201d('0x9')](_0x201d('0xa'),this['getDataValue'](_0x201d('0x4'))||'',this[_0x201d('0xb')](_0x201d('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x201d('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x201d('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 4946f5b..05bfd46 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 _0xa1aa=['length','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','getSessions','findOne','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','fromCharCode','toString','indexOf','replace','getSummary','starttime','startTime','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','hasOwnProperty','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','squel','jsforce','querystring','../../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','destroy','then','get','Projects','UserProfileResource','name','send','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields'];(function(_0x3a54b0,_0x4a0371){var _0x14cae0=function(_0x574290){while(--_0x574290){_0x3a54b0['push'](_0x3a54b0['shift']());}};_0x14cae0(++_0x4a0371);}(_0xa1aa,0x19b));var _0xaa1a=function(_0x98f101,_0x5301d5){_0x98f101=_0x98f101-0x0;var _0x390883=_0xa1aa[_0x98f101];return _0x390883;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa1a('0x0'));var zipdir=require(_0xaa1a('0x1'));var jsonpatch=require(_0xaa1a('0x2'));var rp=require(_0xaa1a('0x3'));var moment=require(_0xaa1a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaa1a('0x5'));var path=require(_0xaa1a('0x6'));var sox=require('sox');var csv=require(_0xaa1a('0x7'));var ejs=require(_0xaa1a('0x8'));var fs=require('fs');var fs_extra=require(_0xaa1a('0x9'));var _=require('lodash');var squel=require(_0xaa1a('0xa'));var crypto=require('crypto');var jsforce=require(_0xaa1a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xaa1a('0x7'));var querystring=require(_0xaa1a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xaa1a('0xd'));var qs=require(_0xaa1a('0xe'));var as=require(_0xaa1a('0xf'));var hardwareService=require(_0xaa1a('0x10'));var logger=require('../../config/logger')(_0xaa1a('0x11'));var utils=require(_0xaa1a('0x12'));var config=require(_0xaa1a('0x13'));var licenseUtil=require(_0xaa1a('0x14'));var db=require(_0xaa1a('0x15'))['db'];function respondWithStatusCode(_0x278079,_0x25ae41){_0x25ae41=_0x25ae41||0xcc;return function(_0x2f018d){if(_0x2f018d){return _0x278079[_0xaa1a('0x16')](_0x25ae41);}return _0x278079[_0xaa1a('0x17')](_0x25ae41)['end']();};}function respondWithResult(_0x5b131c,_0x38715a){_0x38715a=_0x38715a||0xc8;return function(_0x3a577f){if(_0x3a577f){return _0x5b131c[_0xaa1a('0x17')](_0x38715a)[_0xaa1a('0x18')](_0x3a577f);}};}function respondWithFilteredResult(_0x43bd93,_0x5da087){return function(_0x90ef70){if(_0x90ef70){var _0x480a27=typeof _0x5da087[_0xaa1a('0x19')]===_0xaa1a('0x1a')&&typeof _0x5da087[_0xaa1a('0x1b')]===_0xaa1a('0x1a');var _0x5ba030=_0x90ef70['count'];var _0x1b3174=_0x480a27?0x0:_0x5da087[_0xaa1a('0x19')];var _0x56ff91=_0x480a27?_0x90ef70[_0xaa1a('0x1c')]:_0x5da087[_0xaa1a('0x19')]+_0x5da087[_0xaa1a('0x1b')];var _0x120080;if(_0x56ff91>=_0x5ba030){_0x56ff91=_0x5ba030;_0x120080=0xc8;}else{_0x120080=0xce;}_0x43bd93[_0xaa1a('0x17')](_0x120080);return _0x43bd93[_0xaa1a('0x1d')]('Content-Range',_0x1b3174+'-'+_0x56ff91+'/'+_0x5ba030)[_0xaa1a('0x18')](_0x90ef70);}return null;};}function patchUpdates(_0x400a06){return function(_0x8586aa){try{jsonpatch[_0xaa1a('0x1e')](_0x8586aa,_0x400a06,!![]);}catch(_0x2c0238){return BPromise[_0xaa1a('0x1f')](_0x2c0238);}return _0x8586aa[_0xaa1a('0x20')]();};}function saveUpdates(_0x5c01b2,_0xa32c54){return function(_0x282f07){if(_0x282f07){return _0x282f07[_0xaa1a('0x21')](_0x5c01b2)['then'](function(_0x262f83){return _0x262f83;});}return null;};}function removeEntity(_0x15b366,_0x583c90){return function(_0x4accdf){if(_0x4accdf){return _0x4accdf[_0xaa1a('0x22')]()[_0xaa1a('0x23')](function(){var _0xd3225b=_0x4accdf[_0xaa1a('0x24')]({'plain':!![]});var _0x582843=_0xaa1a('0x25');return db[_0xaa1a('0x26')]['destroy']({'where':{'type':_0x582843,'resourceId':_0xd3225b['id']}})[_0xaa1a('0x23')](function(){return _0x4accdf;});})[_0xaa1a('0x23')](function(){_0x15b366[_0xaa1a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43688f,_0x2d1c8f){return function(_0x1b1b67){if(!_0x1b1b67){_0x43688f[_0xaa1a('0x16')](0x194);}return _0x1b1b67;};}function handleError(_0x3f29a8,_0x380a5a){_0x380a5a=_0x380a5a||0x1f4;return function(_0x26fdea){logger['error'](_0x26fdea['stack']);if(_0x26fdea['name']){delete _0x26fdea[_0xaa1a('0x27')];}_0x3f29a8[_0xaa1a('0x17')](_0x380a5a)[_0xaa1a('0x28')](_0x26fdea);};}exports[_0xaa1a('0x29')]=function(_0x559050,_0x14a189){var _0x22ba1d={},_0x2767be={},_0x22b4e3={'count':0x0,'rows':[]};var _0x13afce=_[_0xaa1a('0x2a')](db[_0xaa1a('0x2b')][_0xaa1a('0x2c')],function(_0x2a0d68){return{'name':_0x2a0d68[_0xaa1a('0x2d')],'type':_0x2a0d68[_0xaa1a('0x2e')][_0xaa1a('0x2f')]};});_0x2767be[_0xaa1a('0x30')]=_[_0xaa1a('0x2a')](_0x13afce,_0xaa1a('0x27'));_0x2767be['query']=_['keys'](_0x559050[_0xaa1a('0x31')]);_0x2767be['filters']=_[_0xaa1a('0x32')](_0x2767be[_0xaa1a('0x30')],_0x2767be[_0xaa1a('0x31')]);_0x22ba1d[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0x2767be[_0xaa1a('0x30')],qs['fields'](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0x22ba1d[_0xaa1a('0x33')]=_0x22ba1d[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0x22ba1d[_0xaa1a('0x33')]:_0x2767be[_0xaa1a('0x30')];if(!_0x559050[_0xaa1a('0x31')]['hasOwnProperty'](_0xaa1a('0x36'))){_0x22ba1d[_0xaa1a('0x1b')]=qs[_0xaa1a('0x1b')](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x1b')]);_0x22ba1d[_0xaa1a('0x19')]=qs[_0xaa1a('0x19')](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x19')]);}_0x22ba1d[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x559050[_0xaa1a('0x31')][_0xaa1a('0x38')]);_0x22ba1d[_0xaa1a('0x39')]=qs[_0xaa1a('0x3a')](_[_0xaa1a('0x3b')](_0x559050['query'],_0x2767be['filters']),_0x13afce);if(_0x559050[_0xaa1a('0x31')][_0xaa1a('0x3c')]){_0x22ba1d[_0xaa1a('0x39')]=_[_0xaa1a('0x3d')](_0x22ba1d[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x2a')](_0x13afce,function(_0x48f1b3){if(_0x48f1b3[_0xaa1a('0x2e')]!=='VIRTUAL'){var _0x3da635={};_0x3da635[_0x48f1b3['name']]={'$like':'%'+_0x559050[_0xaa1a('0x31')][_0xaa1a('0x3c')]+'%'};return _0x3da635;}})});}_0x22ba1d=_[_0xaa1a('0x3d')]({},_0x22ba1d,_0x559050[_0xaa1a('0x3e')]);var _0x5f0170={'where':_0x22ba1d['where']};return db[_0xaa1a('0x2b')][_0xaa1a('0x1c')](_0x5f0170)['then'](function(_0x27971e){_0x22b4e3[_0xaa1a('0x1c')]=_0x27971e;if(_0x559050['query']['includeAll']){_0x22ba1d[_0xaa1a('0x3f')]=[{'all':!![]}];}return db['JscriptyProject'][_0xaa1a('0x40')](_0x22ba1d);})[_0xaa1a('0x23')](function(_0x30011d){_0x22b4e3[_0xaa1a('0x41')]=_0x30011d;return _0x22b4e3;})[_0xaa1a('0x23')](respondWithFilteredResult(_0x14a189,_0x22ba1d))[_0xaa1a('0x42')](handleError(_0x14a189,null));};exports['show']=function(_0x54f7bd,_0x4a2a49){var _0x5ce7f1={'raw':![],'where':{'id':_0x54f7bd['params']['id']}},_0x27fcfd={};_0x27fcfd[_0xaa1a('0x30')]=_[_0xaa1a('0x43')](db[_0xaa1a('0x2b')][_0xaa1a('0x2c')]);_0x27fcfd[_0xaa1a('0x31')]=_[_0xaa1a('0x43')](_0x54f7bd[_0xaa1a('0x31')]);_0x27fcfd[_0xaa1a('0x3a')]=_[_0xaa1a('0x32')](_0x27fcfd[_0xaa1a('0x30')],_0x27fcfd[_0xaa1a('0x31')]);_0x5ce7f1['attributes']=_[_0xaa1a('0x32')](_0x27fcfd[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x54f7bd['query'][_0xaa1a('0x34')]));_0x5ce7f1['attributes']=_0x5ce7f1[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0x5ce7f1[_0xaa1a('0x33')]:_0x27fcfd[_0xaa1a('0x30')];if(_0x54f7bd['query'][_0xaa1a('0x44')]){_0x5ce7f1[_0xaa1a('0x3f')]=[{'all':!![]}];}_0x5ce7f1=_[_0xaa1a('0x3d')]({},_0x5ce7f1,_0x54f7bd[_0xaa1a('0x3e')]);return db[_0xaa1a('0x2b')][_0xaa1a('0x45')](_0x5ce7f1)[_0xaa1a('0x23')](handleEntityNotFound(_0x4a2a49,null))[_0xaa1a('0x23')](respondWithResult(_0x4a2a49,null))[_0xaa1a('0x42')](handleError(_0x4a2a49,null));};exports['create']=function(_0x9a63c0,_0x4327b9){return db[_0xaa1a('0x2b')][_0xaa1a('0x46')](_0x9a63c0[_0xaa1a('0x47')],{})[_0xaa1a('0x23')](function(_0x1aad3a){var _0x3a19be=_0x9a63c0[_0xaa1a('0x48')][_0xaa1a('0x24')]({'plain':!![]});if(!_0x3a19be)throw new Error(_0xaa1a('0x49'));if(_0x3a19be[_0xaa1a('0x4a')]===_0xaa1a('0x48')){var _0x169e85=_0x1aad3a[_0xaa1a('0x24')]({'plain':!![]});var _0x42c5e5=_0xaa1a('0x25');return db[_0xaa1a('0x4b')]['find']({'where':{'name':_0x42c5e5,'userProfileId':_0x3a19be[_0xaa1a('0x4c')]},'raw':!![]})[_0xaa1a('0x23')](function(_0x1b0596){if(_0x1b0596&&_0x1b0596['autoAssociation']===0x0){return db['UserProfileResource'][_0xaa1a('0x46')]({'name':_0x169e85['name'],'resourceId':_0x169e85['id'],'type':_0x1b0596[_0xaa1a('0x27')],'sectionId':_0x1b0596['id']},{})['then'](function(){return _0x1aad3a;});}else{return _0x1aad3a;}})[_0xaa1a('0x42')](function(_0x5bad29){logger[_0xaa1a('0x4d')](_0xaa1a('0x4e'),_0x5bad29);throw _0x5bad29;});}return _0x1aad3a;})[_0xaa1a('0x23')](respondWithResult(_0x4327b9,0xc9))[_0xaa1a('0x42')](handleError(_0x4327b9,null));};exports[_0xaa1a('0x4f')]=function(_0x4fc334,_0x57550d){var _0x4cd226={'where':{'id':_0x4fc334[_0xaa1a('0x50')]['id']}},_0x2ce080={};_0x2ce080[_0xaa1a('0x30')]=_['keys'](db[_0xaa1a('0x2b')][_0xaa1a('0x2c')]);_0x4cd226['attributes']=_['intersection'](_0x2ce080[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x4fc334[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0x4cd226[_0xaa1a('0x33')]=_0x4cd226[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0x4cd226[_0xaa1a('0x33')]:_0x2ce080[_0xaa1a('0x30')];if(_0x4fc334[_0xaa1a('0x31')][_0xaa1a('0x44')]){_0x4cd226[_0xaa1a('0x3f')]=[{'all':!![]}];}_0x4cd226=_['merge']({},_0x4cd226,_0x4fc334[_0xaa1a('0x3e')]);return db['JscriptyProject'][_0xaa1a('0x45')](_0x4cd226)[_0xaa1a('0x23')](handleEntityNotFound(_0x57550d,null))['then'](function(_0x55ad1f){if(_0x55ad1f){var _0xc0cbb8=_0x55ad1f['get']({'plain':!![]});_0xc0cbb8=qs[_0xaa1a('0x51')](_0xc0cbb8,['id',_0xaa1a('0x52'),_0xaa1a('0x53')]);_0x4fc334[_0xaa1a('0x47')]=_[_0xaa1a('0x51')](_0x4fc334[_0xaa1a('0x47')],['id',_0xaa1a('0x52'),_0xaa1a('0x53')]);return db['JscriptyProject'][_0xaa1a('0x46')](_[_0xaa1a('0x3d')](_0xc0cbb8,_0x4fc334['body']),{'include':_0x4fc334[_0xaa1a('0x31')][_0xaa1a('0x44')]?[{'all':!![]}]:undefined})[_0xaa1a('0x23')](function(_0x27aa45){var _0x1c5550=_0x4fc334[_0xaa1a('0x48')]['get']({'plain':!![]});if(!_0x1c5550)throw new Error(_0xaa1a('0x49'));if(_0x1c5550[_0xaa1a('0x4a')]===_0xaa1a('0x48')){var _0x48ce6f=_0x27aa45['get']({'plain':!![]});var _0x43ce51=_0xaa1a('0x25');return db[_0xaa1a('0x4b')]['find']({'where':{'name':_0x43ce51,'userProfileId':_0x1c5550['userProfileId']},'raw':!![]})[_0xaa1a('0x23')](function(_0x37f941){if(_0x37f941&&_0x37f941['autoAssociation']===0x0){return db[_0xaa1a('0x26')][_0xaa1a('0x46')]({'name':_0x48ce6f[_0xaa1a('0x27')],'resourceId':_0x48ce6f['id'],'type':_0x37f941[_0xaa1a('0x27')],'sectionId':_0x37f941['id']},{})[_0xaa1a('0x23')](function(){return _0x27aa45;});}else{return _0x27aa45;}})[_0xaa1a('0x42')](function(_0x50732e){logger[_0xaa1a('0x4d')](_0xaa1a('0x4e'),_0x50732e);throw _0x50732e;});}return _0x27aa45;});}})[_0xaa1a('0x23')](respondWithResult(_0x57550d,0xc9))[_0xaa1a('0x42')](handleError(_0x57550d,null));};exports[_0xaa1a('0x21')]=function(_0x40d6a9,_0x1b2c53){if(_0x40d6a9['body']['id']){delete _0x40d6a9[_0xaa1a('0x47')]['id'];}return db['JscriptyProject'][_0xaa1a('0x45')]({'where':{'id':_0x40d6a9[_0xaa1a('0x50')]['id']}})['then'](handleEntityNotFound(_0x1b2c53,null))[_0xaa1a('0x23')](saveUpdates(_0x40d6a9[_0xaa1a('0x47')],null))[_0xaa1a('0x23')](respondWithResult(_0x1b2c53,null))[_0xaa1a('0x42')](handleError(_0x1b2c53,null));};exports[_0xaa1a('0x22')]=function(_0x2d0476,_0x16c704){return db[_0xaa1a('0x2b')][_0xaa1a('0x45')]({'where':{'id':_0x2d0476[_0xaa1a('0x50')]['id']}})[_0xaa1a('0x23')](handleEntityNotFound(_0x16c704,null))[_0xaa1a('0x23')](removeEntity(_0x16c704,null))[_0xaa1a('0x42')](handleError(_0x16c704,null));};exports[_0xaa1a('0x54')]=function(_0x234c53,_0x57f8a1,_0x4b88b0){var _0xec75db={'raw':!![],'where':{}};var _0xba71f7={};var _0x2d038c={'count':0x0,'rows':[]};return db[_0xaa1a('0x2b')][_0xaa1a('0x55')]({'where':{'id':_0x234c53[_0xaa1a('0x50')]['id']}})[_0xaa1a('0x23')](handleEntityNotFound(_0x57f8a1,null))[_0xaa1a('0x23')](function(_0x5942d4){if(_0x5942d4){_0xba71f7[_0xaa1a('0x30')]=_[_0xaa1a('0x43')](db['JscriptySessionReport']['rawAttributes']);_0xba71f7[_0xaa1a('0x31')]=_[_0xaa1a('0x43')](_0x234c53[_0xaa1a('0x31')]);_0xba71f7[_0xaa1a('0x3a')]=_[_0xaa1a('0x32')](_0xba71f7[_0xaa1a('0x30')],_0xba71f7[_0xaa1a('0x31')]);_0xec75db[_0xaa1a('0x33')]=_[_0xaa1a('0x32')](_0xba71f7[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0xec75db[_0xaa1a('0x33')]=_0xec75db[_0xaa1a('0x33')][_0xaa1a('0x35')]?_0xec75db[_0xaa1a('0x33')]:_0xba71f7[_0xaa1a('0x30')];if(!_0x234c53[_0xaa1a('0x31')]['hasOwnProperty'](_0xaa1a('0x36'))){_0xec75db[_0xaa1a('0x1b')]=qs[_0xaa1a('0x1b')](_0x234c53[_0xaa1a('0x31')]['limit']);_0xec75db[_0xaa1a('0x19')]=qs[_0xaa1a('0x19')](_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x19')]);}_0xec75db[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x38')]);_0xec75db[_0xaa1a('0x39')]=qs['filters'](_[_0xaa1a('0x3b')](_0x234c53[_0xaa1a('0x31')],_0xba71f7['filters']));_0xec75db['where'][_0xaa1a('0x56')]=_0x5942d4['id'];if(_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x3c')]){_0xec75db[_0xaa1a('0x39')]=_[_0xaa1a('0x3d')](_0xec75db[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x2a')](_0xec75db['attributes'],function(_0x14ed12){var _0x5ac42e={};_0x5ac42e[_0x14ed12]={'$like':'%'+_0x234c53[_0xaa1a('0x31')][_0xaa1a('0x3c')]+'%'};return _0x5ac42e;})});}_0xec75db=_['merge']({},_0xec75db,_0x234c53['options']);return db['JscriptySessionReport'][_0xaa1a('0x1c')]({'where':_0xec75db['where']})[_0xaa1a('0x23')](function(_0x573b33){_0x2d038c[_0xaa1a('0x1c')]=_0x573b33;if(_0x234c53['query'][_0xaa1a('0x44')]){_0xec75db[_0xaa1a('0x3f')]=[{'all':!![]}];}return db[_0xaa1a('0x57')]['findAll'](_0xec75db);})['then'](function(_0x1f3682){_0x2d038c[_0xaa1a('0x41')]=_0x1f3682;return _0x2d038c;});}})[_0xaa1a('0x23')](respondWithFilteredResult(_0x57f8a1,_0xec75db))[_0xaa1a('0x42')](handleError(_0x57f8a1,null));};exports[_0xaa1a('0x58')]=function(_0x21d6b3,_0x1223be,_0x26f73f){var _0x409aa2={'raw':!![],'where':{}};var _0x1dfbc1={};var _0xb4a868={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xaa1a('0x55')]({'where':{'id':_0x21d6b3[_0xaa1a('0x50')]['id']}})[_0xaa1a('0x23')](handleEntityNotFound(_0x1223be,null))[_0xaa1a('0x23')](function(_0x35c539){if(_0x35c539){_0x1dfbc1['model']=_[_0xaa1a('0x43')](db[_0xaa1a('0x59')]['rawAttributes']);_0x1dfbc1['query']=_['keys'](_0x21d6b3[_0xaa1a('0x31')]);_0x1dfbc1[_0xaa1a('0x3a')]=_[_0xaa1a('0x32')](_0x1dfbc1['model'],_0x1dfbc1[_0xaa1a('0x31')]);_0x409aa2['attributes']=_['intersection'](_0x1dfbc1[_0xaa1a('0x30')],qs[_0xaa1a('0x34')](_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x34')]));_0x409aa2['attributes']=_0x409aa2[_0xaa1a('0x33')]['length']?_0x409aa2[_0xaa1a('0x33')]:_0x1dfbc1[_0xaa1a('0x30')];if(!_0x21d6b3[_0xaa1a('0x31')]['hasOwnProperty'](_0xaa1a('0x36'))){_0x409aa2[_0xaa1a('0x1b')]=qs[_0xaa1a('0x1b')](_0x21d6b3['query']['limit']);_0x409aa2['offset']=qs[_0xaa1a('0x19')](_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x19')]);}_0x409aa2[_0xaa1a('0x37')]=qs[_0xaa1a('0x38')](_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x38')]);_0x409aa2['where']=qs[_0xaa1a('0x3a')](_[_0xaa1a('0x3b')](_0x21d6b3[_0xaa1a('0x31')],_0x1dfbc1[_0xaa1a('0x3a')]));_0x409aa2[_0xaa1a('0x39')][_0xaa1a('0x56')]=_0x35c539['id'];if(_0x21d6b3['query']['filter']){_0x409aa2['where']=_[_0xaa1a('0x3d')](_0x409aa2[_0xaa1a('0x39')],{'$or':_[_0xaa1a('0x2a')](_0x409aa2[_0xaa1a('0x33')],function(_0x23ee8c){var _0x9fcf4b={};_0x9fcf4b[_0x23ee8c]={'$like':'%'+_0x21d6b3[_0xaa1a('0x31')][_0xaa1a('0x3c')]+'%'};return _0x9fcf4b;})});}_0x409aa2=_['merge']({},_0x409aa2,_0x21d6b3[_0xaa1a('0x3e')]);return db[_0xaa1a('0x59')]['count']({'where':_0x409aa2[_0xaa1a('0x39')]})[_0xaa1a('0x23')](function(_0x984c47){_0xb4a868['count']=_0x984c47;if(_0x21d6b3[_0xaa1a('0x31')]['includeAll']){_0x409aa2['include']=[{'all':!![]}];}return db[_0xaa1a('0x59')][_0xaa1a('0x40')](_0x409aa2);})[_0xaa1a('0x23')](function(_0x82bd71){_0xb4a868[_0xaa1a('0x41')]=_0x82bd71;return _0xb4a868;});}})[_0xaa1a('0x23')](respondWithFilteredResult(_0x1223be,_0x409aa2))[_0xaa1a('0x42')](handleError(_0x1223be,null));};function char(_0x5eaea4){return'number'===typeof _0x5eaea4?String[_0xaa1a('0x5a')][_0xaa1a('0x1e')](null,arguments):_0x5eaea4;}function needsEncapsulation(_0x589d75){return!!_0x589d75&&(_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0xd))>=0x0||_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0xa))>=0x0||_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0x2c))>=0x0||_0x589d75[_0xaa1a('0x5b')]()[_0xaa1a('0x5c')](char(0x22))>=0x0);}function encapsulate(_0x3917cb){var _0x2d8990=char(0x22),_0x2f0a51='\x5c'+char(0x22),_0x4a3349=_0x3917cb[_0xaa1a('0x5b')]()[_0xaa1a('0x5d')](new RegExp(_0x2d8990,'g'),_0x2f0a51);return _0x2d8990+_0x4a3349+_0x2d8990;}exports[_0xaa1a('0x5e')]=function(_0x3e89a4,_0x110b9b,_0x4389fb){var _0xa2bd51,_0x2f2ee0;var _0x5d56bd={'where':{'ProjectId':_0x3e89a4['params']['id']}};if(_0x3e89a4[_0xaa1a('0x31')]['startTime']){_0x5d56bd[_0xaa1a('0x39')][_0xaa1a('0x5f')]=JSON['parse'](_0x3e89a4[_0xaa1a('0x31')][_0xaa1a('0x60')]);}return db[_0xaa1a('0x57')][_0xaa1a('0x40')](_0x5d56bd)[_0xaa1a('0x23')](handleEntityNotFound(_0x110b9b,null))[_0xaa1a('0x23')](function(_0x44dfdd){if(_0x44dfdd){_0xa2bd51=_0x44dfdd;return db[_0xaa1a('0x61')][_0xaa1a('0x40')]({'where':{'SessionId':{'$in':_[_0xaa1a('0x2a')](_0xa2bd51,'id')},'ProjectId':_0x3e89a4['params']['id']},'order':_0xaa1a('0x62')});}})[_0xaa1a('0x23')](handleEntityNotFound(_0x110b9b,null))['then'](function(_0x4f3ef9){if(_0x4f3ef9){_0x2f2ee0=_0x4f3ef9;var _0x30a781={};for(var _0x4b5d8d=0x0,_0x46e198=_0x2f2ee0['length'];_0x4b5d8d<_0x46e198;_0x4b5d8d++){if(!_0x30a781['hasOwnProperty'](_0x2f2ee0[_0x4b5d8d][_0xaa1a('0x63')])){_0x30a781[_0x2f2ee0[_0x4b5d8d]['questionId']]=needsEncapsulation(_0x2f2ee0[_0x4b5d8d]['question'])?encapsulate(_0x2f2ee0[_0x4b5d8d][_0xaa1a('0x64')]):_0x2f2ee0[_0x4b5d8d][_0xaa1a('0x64')];}}var _0x142abc=[],_0x440c6f={};for(var _0x1ecc6f=0x0,_0x26df16=_0xa2bd51[_0xaa1a('0x35')];_0x1ecc6f<_0x26df16;_0x1ecc6f++){_0x440c6f={'ProjectId':_0x3e89a4[_0xaa1a('0x50')]['id'],'SessionId':_0xa2bd51[_0x1ecc6f]['id'],'StartTime':moment(_0xa2bd51[_0x1ecc6f][_0xaa1a('0x5f')])[_0xaa1a('0x65')](_0xaa1a('0x66'))};for(var _0x248c7f=0x0,_0xa23325=_0x2f2ee0[_0xaa1a('0x35')];_0x248c7f<_0xa23325;_0x248c7f++){if(_0x2f2ee0[_0x248c7f][_0xaa1a('0x67')]==_0xa2bd51[_0x1ecc6f]['id']&&_0x30a781['hasOwnProperty'](_0x2f2ee0[_0x248c7f][_0xaa1a('0x63')])){_0x440c6f[_0x30a781[_0x2f2ee0[_0x248c7f][_0xaa1a('0x63')]]]=_0x2f2ee0[_0x248c7f][_0xaa1a('0x68')];}}for(var _0x443ecb in _0x30a781){if(!_0x440c6f[_0xaa1a('0x69')](_0x30a781[_0x443ecb])){_0x440c6f[_0x30a781[_0x443ecb]]=null;}}_0x142abc['push'](_0x440c6f);}return _0x142abc;}})[_0xaa1a('0x23')](function(_0x46ed30){if(!_[_0xaa1a('0x6a')](_0x46ed30)){var _0x5f2347=toCsv(_0x46ed30);var _0x3f4cba=Date[_0xaa1a('0x6b')]();fs[_0xaa1a('0x6c')](util['format'](_0xaa1a('0x6d'),_0x3e89a4[_0xaa1a('0x50')]['id'],_0x3f4cba),_0x5f2347);_0x110b9b[_0xaa1a('0x6e')]('Content-disposition',_0xaa1a('0x6f')+util[_0xaa1a('0x65')](_0xaa1a('0x70'),_0x3e89a4[_0xaa1a('0x50')]['id'],_0x3f4cba));_0x110b9b['setHeader'](_0xaa1a('0x71'),_0xaa1a('0x72'));return _0x110b9b[_0xaa1a('0x73')](util[_0xaa1a('0x65')](_0xaa1a('0x6d'),_0x3e89a4['params']['id'],_0x3f4cba));}else{return _0x110b9b[_0xaa1a('0x16')](0xcc);}})[_0xaa1a('0x42')](handleError(_0x110b9b,null));}; \ No newline at end of file +var _0x020a=['status','end','offset','undefined','limit','count','apply','save','update','then','destroy','get','UserProfileResource','stack','name','map','JscriptyProject','rawAttributes','fieldName','type','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','includeAll','role','Projects','getSessions','findOne','JscriptySessionReport','order','ProjectId','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','JscriptyQuestionReport','question','format','SessionId','questionId','answer','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x290b88,_0x2dbbae){var _0x419e61=function(_0x3b8bda){while(--_0x3b8bda){_0x290b88['push'](_0x290b88['shift']());}};_0x419e61(++_0x2dbbae);}(_0x020a,0xc9));var _0xa020=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x020a[_0xd4636c];return _0x5ee17d;};'use strict';var emlformat=require(_0xa020('0x0'));var rimraf=require(_0xa020('0x1'));var zipdir=require(_0xa020('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa020('0x3'));var moment=require(_0xa020('0x4'));var BPromise=require(_0xa020('0x5'));var Mustache=require(_0xa020('0x6'));var util=require(_0xa020('0x7'));var path=require(_0xa020('0x8'));var sox=require(_0xa020('0x9'));var csv=require(_0xa020('0xa'));var ejs=require(_0xa020('0xb'));var fs=require('fs');var fs_extra=require(_0xa020('0xc'));var _=require('lodash');var squel=require(_0xa020('0xd'));var crypto=require(_0xa020('0xe'));var jsforce=require(_0xa020('0xf'));var deskjs=require(_0xa020('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa020('0x11'));var Papa=require(_0xa020('0x12'));var Redis=require(_0xa020('0x13'));var authService=require(_0xa020('0x14'));var qs=require(_0xa020('0x15'));var as=require(_0xa020('0x16'));var hardwareService=require(_0xa020('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xa020('0x18'));var config=require(_0xa020('0x19'));var licenseUtil=require(_0xa020('0x1a'));var db=require(_0xa020('0x1b'))['db'];function respondWithStatusCode(_0x332912,_0x131c05){_0x131c05=_0x131c05||0xcc;return function(_0x112d10){if(_0x112d10){return _0x332912[_0xa020('0x1c')](_0x131c05);}return _0x332912[_0xa020('0x1d')](_0x131c05)[_0xa020('0x1e')]();};}function respondWithResult(_0x33929a,_0x2f58b1){_0x2f58b1=_0x2f58b1||0xc8;return function(_0x3d51c0){if(_0x3d51c0){return _0x33929a[_0xa020('0x1d')](_0x2f58b1)['json'](_0x3d51c0);}};}function respondWithFilteredResult(_0x3a4f08,_0x1388ad){return function(_0x38ee15){if(_0x38ee15){var _0x2eddf3=typeof _0x1388ad[_0xa020('0x1f')]===_0xa020('0x20')&&typeof _0x1388ad[_0xa020('0x21')]==='undefined';var _0xc7e299=_0x38ee15[_0xa020('0x22')];var _0x1b65a6=_0x2eddf3?0x0:_0x1388ad[_0xa020('0x1f')];var _0x141b0e=_0x2eddf3?_0x38ee15['count']:_0x1388ad[_0xa020('0x1f')]+_0x1388ad[_0xa020('0x21')];var _0x1a9723;if(_0x141b0e>=_0xc7e299){_0x141b0e=_0xc7e299;_0x1a9723=0xc8;}else{_0x1a9723=0xce;}_0x3a4f08[_0xa020('0x1d')](_0x1a9723);return _0x3a4f08['set']('Content-Range',_0x1b65a6+'-'+_0x141b0e+'/'+_0xc7e299)['json'](_0x38ee15);}return null;};}function patchUpdates(_0x2704b4){return function(_0x34a0ff){try{jsonpatch[_0xa020('0x23')](_0x34a0ff,_0x2704b4,!![]);}catch(_0xb72f64){return BPromise['reject'](_0xb72f64);}return _0x34a0ff[_0xa020('0x24')]();};}function saveUpdates(_0x4a25ad,_0x43df6c){return function(_0x1a2d9a){if(_0x1a2d9a){return _0x1a2d9a[_0xa020('0x25')](_0x4a25ad)[_0xa020('0x26')](function(_0x1123c0){return _0x1123c0;});}return null;};}function removeEntity(_0x402689,_0x173705){return function(_0xe859a7){if(_0xe859a7){return _0xe859a7[_0xa020('0x27')]()['then'](function(){var _0xce0af9=_0xe859a7[_0xa020('0x28')]({'plain':!![]});var _0x38e596='Projects';return db[_0xa020('0x29')][_0xa020('0x27')]({'where':{'type':_0x38e596,'resourceId':_0xce0af9['id']}})[_0xa020('0x26')](function(){return _0xe859a7;});})['then'](function(){_0x402689['status'](0xcc)[_0xa020('0x1e')]();});}};}function handleEntityNotFound(_0x44f771,_0x2de549){return function(_0x4472a){if(!_0x4472a){_0x44f771['sendStatus'](0x194);}return _0x4472a;};}function handleError(_0x5a9cd2,_0x1619ab){_0x1619ab=_0x1619ab||0x1f4;return function(_0x241a8c){logger['error'](_0x241a8c[_0xa020('0x2a')]);if(_0x241a8c[_0xa020('0x2b')]){delete _0x241a8c[_0xa020('0x2b')];}_0x5a9cd2[_0xa020('0x1d')](_0x1619ab)['send'](_0x241a8c);};}exports['index']=function(_0x364ff5,_0x4b4611){var _0x1e2d3d={},_0x39e8cb={},_0x2cb6af={'count':0x0,'rows':[]};var _0x4d9029=_[_0xa020('0x2c')](db[_0xa020('0x2d')][_0xa020('0x2e')],function(_0x26cb52){return{'name':_0x26cb52[_0xa020('0x2f')],'type':_0x26cb52[_0xa020('0x30')]['key']};});_0x39e8cb['model']=_[_0xa020('0x2c')](_0x4d9029,_0xa020('0x2b'));_0x39e8cb[_0xa020('0x31')]=_[_0xa020('0x32')](_0x364ff5[_0xa020('0x31')]);_0x39e8cb[_0xa020('0x33')]=_['intersection'](_0x39e8cb['model'],_0x39e8cb[_0xa020('0x31')]);_0x1e2d3d[_0xa020('0x34')]=_[_0xa020('0x35')](_0x39e8cb[_0xa020('0x36')],qs[_0xa020('0x37')](_0x364ff5[_0xa020('0x31')][_0xa020('0x37')]));_0x1e2d3d[_0xa020('0x34')]=_0x1e2d3d['attributes'][_0xa020('0x38')]?_0x1e2d3d['attributes']:_0x39e8cb[_0xa020('0x36')];if(!_0x364ff5[_0xa020('0x31')][_0xa020('0x39')](_0xa020('0x3a'))){_0x1e2d3d[_0xa020('0x21')]=qs[_0xa020('0x21')](_0x364ff5['query'][_0xa020('0x21')]);_0x1e2d3d['offset']=qs['offset'](_0x364ff5[_0xa020('0x31')]['offset']);}_0x1e2d3d['order']=qs[_0xa020('0x3b')](_0x364ff5[_0xa020('0x31')]['sort']);_0x1e2d3d[_0xa020('0x3c')]=qs['filters'](_[_0xa020('0x3d')](_0x364ff5[_0xa020('0x31')],_0x39e8cb[_0xa020('0x33')]),_0x4d9029);if(_0x364ff5[_0xa020('0x31')]['filter']){_0x1e2d3d[_0xa020('0x3c')]=_[_0xa020('0x3e')](_0x1e2d3d[_0xa020('0x3c')],{'$or':_['map'](_0x4d9029,function(_0x4e8ce6){if(_0x4e8ce6[_0xa020('0x30')]!==_0xa020('0x3f')){var _0x461f6b={};_0x461f6b[_0x4e8ce6[_0xa020('0x2b')]]={'$like':'%'+_0x364ff5['query'][_0xa020('0x40')]+'%'};return _0x461f6b;}})});}_0x1e2d3d=_[_0xa020('0x3e')]({},_0x1e2d3d,_0x364ff5[_0xa020('0x41')]);var _0x859e4b={'where':_0x1e2d3d['where']};return db[_0xa020('0x2d')]['count'](_0x859e4b)[_0xa020('0x26')](function(_0x3b8eba){_0x2cb6af[_0xa020('0x22')]=_0x3b8eba;if(_0x364ff5['query']['includeAll']){_0x1e2d3d[_0xa020('0x42')]=[{'all':!![]}];}return db[_0xa020('0x2d')][_0xa020('0x43')](_0x1e2d3d);})[_0xa020('0x26')](function(_0x586039){_0x2cb6af[_0xa020('0x44')]=_0x586039;return _0x2cb6af;})[_0xa020('0x26')](respondWithFilteredResult(_0x4b4611,_0x1e2d3d))[_0xa020('0x45')](handleError(_0x4b4611,null));};exports[_0xa020('0x46')]=function(_0x5ceb28,_0x26d5e7){var _0x1e5339={'raw':![],'where':{'id':_0x5ceb28[_0xa020('0x47')]['id']}},_0x4a05c3={};_0x4a05c3[_0xa020('0x36')]=_[_0xa020('0x32')](db['JscriptyProject']['rawAttributes']);_0x4a05c3[_0xa020('0x31')]=_[_0xa020('0x32')](_0x5ceb28[_0xa020('0x31')]);_0x4a05c3['filters']=_[_0xa020('0x35')](_0x4a05c3[_0xa020('0x36')],_0x4a05c3['query']);_0x1e5339[_0xa020('0x34')]=_[_0xa020('0x35')](_0x4a05c3['model'],qs[_0xa020('0x37')](_0x5ceb28['query'][_0xa020('0x37')]));_0x1e5339['attributes']=_0x1e5339[_0xa020('0x34')][_0xa020('0x38')]?_0x1e5339[_0xa020('0x34')]:_0x4a05c3[_0xa020('0x36')];if(_0x5ceb28[_0xa020('0x31')]['includeAll']){_0x1e5339[_0xa020('0x42')]=[{'all':!![]}];}_0x1e5339=_[_0xa020('0x3e')]({},_0x1e5339,_0x5ceb28[_0xa020('0x41')]);return db['JscriptyProject'][_0xa020('0x48')](_0x1e5339)['then'](handleEntityNotFound(_0x26d5e7,null))[_0xa020('0x26')](respondWithResult(_0x26d5e7,null))['catch'](handleError(_0x26d5e7,null));};exports[_0xa020('0x49')]=function(_0x6251d,_0x176893){return db['JscriptyProject'][_0xa020('0x49')](_0x6251d[_0xa020('0x4a')],{})[_0xa020('0x26')](function(_0x123091){var _0x106986=_0x6251d[_0xa020('0x4b')]['get']({'plain':!![]});if(!_0x106986)throw new Error(_0xa020('0x4c'));if(_0x106986['role']==='user'){var _0x328014=_0x123091[_0xa020('0x28')]({'plain':!![]});var _0x224f49='Projects';return db[_0xa020('0x4d')][_0xa020('0x48')]({'where':{'name':_0x224f49,'userProfileId':_0x106986[_0xa020('0x4e')]},'raw':!![]})[_0xa020('0x26')](function(_0x292849){if(_0x292849&&_0x292849['autoAssociation']===0x0){return db[_0xa020('0x29')]['create']({'name':_0x328014[_0xa020('0x2b')],'resourceId':_0x328014['id'],'type':_0x292849['name'],'sectionId':_0x292849['id']},{})[_0xa020('0x26')](function(){return _0x123091;});}else{return _0x123091;}})[_0xa020('0x45')](function(_0xedaa3b){logger[_0xa020('0x4f')](_0xa020('0x50'),_0xedaa3b);throw _0xedaa3b;});}return _0x123091;})[_0xa020('0x26')](respondWithResult(_0x176893,0xc9))[_0xa020('0x45')](handleError(_0x176893,null));};exports[_0xa020('0x51')]=function(_0x44dafa,_0x30c6b5){var _0x26b8b9={'where':{'id':_0x44dafa['params']['id']}},_0x3e3fa5={};_0x3e3fa5[_0xa020('0x36')]=_[_0xa020('0x32')](db['JscriptyProject'][_0xa020('0x2e')]);_0x26b8b9[_0xa020('0x34')]=_[_0xa020('0x35')](_0x3e3fa5[_0xa020('0x36')],qs[_0xa020('0x37')](_0x44dafa['query'][_0xa020('0x37')]));_0x26b8b9[_0xa020('0x34')]=_0x26b8b9[_0xa020('0x34')]['length']?_0x26b8b9[_0xa020('0x34')]:_0x3e3fa5['model'];if(_0x44dafa['query']['includeAll']){_0x26b8b9[_0xa020('0x42')]=[{'all':!![]}];}_0x26b8b9=_[_0xa020('0x3e')]({},_0x26b8b9,_0x44dafa[_0xa020('0x41')]);return db[_0xa020('0x2d')][_0xa020('0x48')](_0x26b8b9)[_0xa020('0x26')](handleEntityNotFound(_0x30c6b5,null))[_0xa020('0x26')](function(_0x1fd80f){if(_0x1fd80f){var _0x2bda2a=_0x1fd80f[_0xa020('0x28')]({'plain':!![]});_0x2bda2a=qs[_0xa020('0x52')](_0x2bda2a,['id',_0xa020('0x53'),'updatedAt']);_0x44dafa[_0xa020('0x4a')]=_['omit'](_0x44dafa[_0xa020('0x4a')],['id',_0xa020('0x53'),_0xa020('0x54')]);return db[_0xa020('0x2d')][_0xa020('0x49')](_[_0xa020('0x3e')](_0x2bda2a,_0x44dafa['body']),{'include':_0x44dafa[_0xa020('0x31')][_0xa020('0x55')]?[{'all':!![]}]:undefined})[_0xa020('0x26')](function(_0xa8f47c){var _0x162527=_0x44dafa[_0xa020('0x4b')][_0xa020('0x28')]({'plain':!![]});if(!_0x162527)throw new Error(_0xa020('0x4c'));if(_0x162527[_0xa020('0x56')]===_0xa020('0x4b')){var _0x1df5e8=_0xa8f47c[_0xa020('0x28')]({'plain':!![]});var _0x5e22de=_0xa020('0x57');return db['UserProfileSection'][_0xa020('0x48')]({'where':{'name':_0x5e22de,'userProfileId':_0x162527[_0xa020('0x4e')]},'raw':!![]})[_0xa020('0x26')](function(_0xdd330c){if(_0xdd330c&&_0xdd330c['autoAssociation']===0x0){return db[_0xa020('0x29')]['create']({'name':_0x1df5e8[_0xa020('0x2b')],'resourceId':_0x1df5e8['id'],'type':_0xdd330c[_0xa020('0x2b')],'sectionId':_0xdd330c['id']},{})['then'](function(){return _0xa8f47c;});}else{return _0xa8f47c;}})[_0xa020('0x45')](function(_0x338fcd){logger[_0xa020('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x338fcd);throw _0x338fcd;});}return _0xa8f47c;});}})[_0xa020('0x26')](respondWithResult(_0x30c6b5,0xc9))[_0xa020('0x45')](handleError(_0x30c6b5,null));};exports[_0xa020('0x25')]=function(_0x596a59,_0x44b886){if(_0x596a59['body']['id']){delete _0x596a59[_0xa020('0x4a')]['id'];}return db[_0xa020('0x2d')][_0xa020('0x48')]({'where':{'id':_0x596a59[_0xa020('0x47')]['id']}})[_0xa020('0x26')](handleEntityNotFound(_0x44b886,null))[_0xa020('0x26')](saveUpdates(_0x596a59[_0xa020('0x4a')],null))[_0xa020('0x26')](respondWithResult(_0x44b886,null))['catch'](handleError(_0x44b886,null));};exports['destroy']=function(_0x3dab98,_0x1a2612){return db[_0xa020('0x2d')][_0xa020('0x48')]({'where':{'id':_0x3dab98[_0xa020('0x47')]['id']}})[_0xa020('0x26')](handleEntityNotFound(_0x1a2612,null))['then'](removeEntity(_0x1a2612,null))['catch'](handleError(_0x1a2612,null));};exports[_0xa020('0x58')]=function(_0x39a477,_0x3c8476,_0x305fa1){var _0x31b0d2={'raw':!![],'where':{}};var _0x556dd2={};var _0x56bae0={'count':0x0,'rows':[]};return db[_0xa020('0x2d')][_0xa020('0x59')]({'where':{'id':_0x39a477[_0xa020('0x47')]['id']}})['then'](handleEntityNotFound(_0x3c8476,null))['then'](function(_0x32ad8e){if(_0x32ad8e){_0x556dd2[_0xa020('0x36')]=_[_0xa020('0x32')](db[_0xa020('0x5a')][_0xa020('0x2e')]);_0x556dd2[_0xa020('0x31')]=_[_0xa020('0x32')](_0x39a477[_0xa020('0x31')]);_0x556dd2[_0xa020('0x33')]=_[_0xa020('0x35')](_0x556dd2[_0xa020('0x36')],_0x556dd2[_0xa020('0x31')]);_0x31b0d2[_0xa020('0x34')]=_['intersection'](_0x556dd2[_0xa020('0x36')],qs[_0xa020('0x37')](_0x39a477[_0xa020('0x31')][_0xa020('0x37')]));_0x31b0d2[_0xa020('0x34')]=_0x31b0d2[_0xa020('0x34')][_0xa020('0x38')]?_0x31b0d2[_0xa020('0x34')]:_0x556dd2[_0xa020('0x36')];if(!_0x39a477[_0xa020('0x31')][_0xa020('0x39')](_0xa020('0x3a'))){_0x31b0d2['limit']=qs[_0xa020('0x21')](_0x39a477[_0xa020('0x31')][_0xa020('0x21')]);_0x31b0d2[_0xa020('0x1f')]=qs[_0xa020('0x1f')](_0x39a477[_0xa020('0x31')][_0xa020('0x1f')]);}_0x31b0d2[_0xa020('0x5b')]=qs[_0xa020('0x3b')](_0x39a477[_0xa020('0x31')][_0xa020('0x3b')]);_0x31b0d2[_0xa020('0x3c')]=qs['filters'](_['pick'](_0x39a477[_0xa020('0x31')],_0x556dd2['filters']));_0x31b0d2[_0xa020('0x3c')][_0xa020('0x5c')]=_0x32ad8e['id'];if(_0x39a477[_0xa020('0x31')][_0xa020('0x40')]){_0x31b0d2[_0xa020('0x3c')]=_['merge'](_0x31b0d2[_0xa020('0x3c')],{'$or':_[_0xa020('0x2c')](_0x31b0d2[_0xa020('0x34')],function(_0x25cb13){var _0x5ea662={};_0x5ea662[_0x25cb13]={'$like':'%'+_0x39a477['query']['filter']+'%'};return _0x5ea662;})});}_0x31b0d2=_[_0xa020('0x3e')]({},_0x31b0d2,_0x39a477[_0xa020('0x41')]);return db[_0xa020('0x5a')][_0xa020('0x22')]({'where':_0x31b0d2['where']})[_0xa020('0x26')](function(_0x201111){_0x56bae0[_0xa020('0x22')]=_0x201111;if(_0x39a477['query'][_0xa020('0x55')]){_0x31b0d2[_0xa020('0x42')]=[{'all':!![]}];}return db[_0xa020('0x5a')]['findAll'](_0x31b0d2);})[_0xa020('0x26')](function(_0x46303e){_0x56bae0[_0xa020('0x44')]=_0x46303e;return _0x56bae0;});}})['then'](respondWithFilteredResult(_0x3c8476,_0x31b0d2))['catch'](handleError(_0x3c8476,null));};exports['getAnswers']=function(_0x2982d0,_0x165b87,_0x42d61d){var _0x2dbb62={'raw':!![],'where':{}};var _0x3990fb={};var _0x332eed={'count':0x0,'rows':[]};return db[_0xa020('0x2d')]['findOne']({'where':{'id':_0x2982d0[_0xa020('0x47')]['id']}})['then'](handleEntityNotFound(_0x165b87,null))[_0xa020('0x26')](function(_0x4ec809){if(_0x4ec809){_0x3990fb[_0xa020('0x36')]=_['keys'](db['JscriptyAnswerReport'][_0xa020('0x2e')]);_0x3990fb[_0xa020('0x31')]=_[_0xa020('0x32')](_0x2982d0[_0xa020('0x31')]);_0x3990fb[_0xa020('0x33')]=_[_0xa020('0x35')](_0x3990fb[_0xa020('0x36')],_0x3990fb[_0xa020('0x31')]);_0x2dbb62[_0xa020('0x34')]=_[_0xa020('0x35')](_0x3990fb['model'],qs[_0xa020('0x37')](_0x2982d0[_0xa020('0x31')][_0xa020('0x37')]));_0x2dbb62['attributes']=_0x2dbb62['attributes'][_0xa020('0x38')]?_0x2dbb62[_0xa020('0x34')]:_0x3990fb['model'];if(!_0x2982d0[_0xa020('0x31')]['hasOwnProperty'](_0xa020('0x3a'))){_0x2dbb62['limit']=qs[_0xa020('0x21')](_0x2982d0[_0xa020('0x31')]['limit']);_0x2dbb62[_0xa020('0x1f')]=qs[_0xa020('0x1f')](_0x2982d0[_0xa020('0x31')]['offset']);}_0x2dbb62[_0xa020('0x5b')]=qs[_0xa020('0x3b')](_0x2982d0[_0xa020('0x31')]['sort']);_0x2dbb62[_0xa020('0x3c')]=qs[_0xa020('0x33')](_[_0xa020('0x3d')](_0x2982d0[_0xa020('0x31')],_0x3990fb['filters']));_0x2dbb62[_0xa020('0x3c')]['ProjectId']=_0x4ec809['id'];if(_0x2982d0[_0xa020('0x31')][_0xa020('0x40')]){_0x2dbb62[_0xa020('0x3c')]=_[_0xa020('0x3e')](_0x2dbb62[_0xa020('0x3c')],{'$or':_['map'](_0x2dbb62[_0xa020('0x34')],function(_0x15de23){var _0xd4fde={};_0xd4fde[_0x15de23]={'$like':'%'+_0x2982d0['query'][_0xa020('0x40')]+'%'};return _0xd4fde;})});}_0x2dbb62=_[_0xa020('0x3e')]({},_0x2dbb62,_0x2982d0[_0xa020('0x41')]);return db['JscriptyAnswerReport']['count']({'where':_0x2dbb62[_0xa020('0x3c')]})[_0xa020('0x26')](function(_0x25b71d){_0x332eed[_0xa020('0x22')]=_0x25b71d;if(_0x2982d0[_0xa020('0x31')][_0xa020('0x55')]){_0x2dbb62['include']=[{'all':!![]}];}return db[_0xa020('0x5d')]['findAll'](_0x2dbb62);})[_0xa020('0x26')](function(_0x243921){_0x332eed[_0xa020('0x44')]=_0x243921;return _0x332eed;});}})[_0xa020('0x26')](respondWithFilteredResult(_0x165b87,_0x2dbb62))[_0xa020('0x45')](handleError(_0x165b87,null));};function char(_0x455d33){return _0xa020('0x5e')===typeof _0x455d33?String[_0xa020('0x5f')][_0xa020('0x23')](null,arguments):_0x455d33;}function needsEncapsulation(_0x3f8793){return!!_0x3f8793&&(_0x3f8793[_0xa020('0x60')]()[_0xa020('0x61')](char(0xd))>=0x0||_0x3f8793[_0xa020('0x60')]()[_0xa020('0x61')](char(0xa))>=0x0||_0x3f8793['toString']()[_0xa020('0x61')](char(0x2c))>=0x0||_0x3f8793[_0xa020('0x60')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x214bc9){var _0x41f1eb=char(0x22),_0x1cc8d3='\x5c'+char(0x22),_0x2065f7=_0x214bc9[_0xa020('0x60')]()[_0xa020('0x62')](new RegExp(_0x41f1eb,'g'),_0x1cc8d3);return _0x41f1eb+_0x2065f7+_0x41f1eb;}exports[_0xa020('0x63')]=function(_0x112325,_0x37646d,_0xa57aaa){var _0x1805e7,_0x243b1d;var _0x47f386={'where':{'ProjectId':_0x112325[_0xa020('0x47')]['id']}};if(_0x112325[_0xa020('0x31')][_0xa020('0x64')]){_0x47f386[_0xa020('0x3c')][_0xa020('0x65')]=JSON['parse'](_0x112325[_0xa020('0x31')][_0xa020('0x64')]);}return db[_0xa020('0x5a')]['findAll'](_0x47f386)['then'](handleEntityNotFound(_0x37646d,null))[_0xa020('0x26')](function(_0x2dcedc){if(_0x2dcedc){_0x1805e7=_0x2dcedc;return db[_0xa020('0x66')][_0xa020('0x43')]({'where':{'SessionId':{'$in':_[_0xa020('0x2c')](_0x1805e7,'id')},'ProjectId':_0x112325[_0xa020('0x47')]['id']},'order':'-createdAt'});}})['then'](handleEntityNotFound(_0x37646d,null))[_0xa020('0x26')](function(_0x1d1b61){if(_0x1d1b61){_0x243b1d=_0x1d1b61;var _0x6a5733={};for(var _0x52d7c4=0x0,_0x263dcf=_0x243b1d['length'];_0x52d7c4<_0x263dcf;_0x52d7c4++){if(!_0x6a5733[_0xa020('0x39')](_0x243b1d[_0x52d7c4]['questionId'])){_0x6a5733[_0x243b1d[_0x52d7c4]['questionId']]=needsEncapsulation(_0x243b1d[_0x52d7c4][_0xa020('0x67')])?encapsulate(_0x243b1d[_0x52d7c4][_0xa020('0x67')]):_0x243b1d[_0x52d7c4][_0xa020('0x67')];}}var _0x1b861f=[],_0xe17e75={};for(var _0x48540f=0x0,_0x30d536=_0x1805e7[_0xa020('0x38')];_0x48540f<_0x30d536;_0x48540f++){_0xe17e75={'ProjectId':_0x112325['params']['id'],'SessionId':_0x1805e7[_0x48540f]['id'],'StartTime':moment(_0x1805e7[_0x48540f][_0xa020('0x65')])[_0xa020('0x68')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x540912=0x0,_0x3ac2c3=_0x243b1d[_0xa020('0x38')];_0x540912<_0x3ac2c3;_0x540912++){if(_0x243b1d[_0x540912][_0xa020('0x69')]==_0x1805e7[_0x48540f]['id']&&_0x6a5733[_0xa020('0x39')](_0x243b1d[_0x540912]['questionId'])){_0xe17e75[_0x6a5733[_0x243b1d[_0x540912][_0xa020('0x6a')]]]=_0x243b1d[_0x540912][_0xa020('0x6b')];}}for(var _0x1e36cd in _0x6a5733){if(!_0xe17e75[_0xa020('0x39')](_0x6a5733[_0x1e36cd])){_0xe17e75[_0x6a5733[_0x1e36cd]]=null;}}_0x1b861f['push'](_0xe17e75);}return _0x1b861f;}})['then'](function(_0x5b4836){if(!_['isEmpty'](_0x5b4836)){var _0x1dfc51=toCsv(_0x5b4836);var _0x2f580d=Date['now']();fs[_0xa020('0x6c')](util[_0xa020('0x68')](_0xa020('0x6d'),_0x112325[_0xa020('0x47')]['id'],_0x2f580d),_0x1dfc51);_0x37646d[_0xa020('0x6e')](_0xa020('0x6f'),_0xa020('0x70')+util[_0xa020('0x68')](_0xa020('0x71'),_0x112325['params']['id'],_0x2f580d));_0x37646d['setHeader']('Content-type',_0xa020('0x72'));return _0x37646d['download'](util[_0xa020('0x68')](_0xa020('0x6d'),_0x112325['params']['id'],_0x2f580d));}else{return _0x37646d[_0xa020('0x1c')](0xcc);}})['catch'](handleError(_0x37646d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index b418f4a..30f5202 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 _0x89fe=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./jscriptyProject.attributes','exports','define','jscripty_projects','lodash'];(function(_0x4074d5,_0xa57194){var _0x502cfe=function(_0x345efa){while(--_0x345efa){_0x4074d5['push'](_0x4074d5['shift']());}};_0x502cfe(++_0xa57194);}(_0x89fe,0x83));var _0xe89f=function(_0x394338,_0x751fd7){_0x394338=_0x394338-0x0;var _0x1ecdb0=_0x89fe[_0x394338];return _0x1ecdb0;};'use strict';var _=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var logger=require(_0xe89f('0x2'))(_0xe89f('0x3'));var moment=require('moment');var BPromise=require(_0xe89f('0x4'));var rp=require(_0xe89f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe89f('0x6'));var config=require(_0xe89f('0x7'));var attributes=require(_0xe89f('0x8'));module[_0xe89f('0x9')]=function(_0x2e61cf,_0x2d5020){return _0x2e61cf[_0xe89f('0xa')]('JscriptyProject',attributes,{'tableName':_0xe89f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1793=['../../config/environment','jscripty_projects','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x1793,0x1ce));var _0x3179=function(_0xacb435,_0x220f20){_0xacb435=_0xacb435-0x0;var _0x32b976=_0x1793[_0xacb435];return _0x32b976;};'use strict';var _=require(_0x3179('0x0'));var util=require(_0x3179('0x1'));var logger=require(_0x3179('0x2'))(_0x3179('0x3'));var moment=require('moment');var BPromise=require(_0x3179('0x4'));var rp=require(_0x3179('0x5'));var fs=require('fs');var path=require(_0x3179('0x6'));var rimraf=require(_0x3179('0x7'));var config=require(_0x3179('0x8'));var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0x43ee6e,_0x2e6158){return _0x43ee6e['define']('JscriptyProject',attributes,{'tableName':_0x3179('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 28699d5..069bf57 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 _0xe706=['http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x52ad9f,_0x341f8f){var _0x30314a=function(_0x450e35){while(--_0x450e35){_0x52ad9f['push'](_0x52ad9f['shift']());}};_0x30314a(++_0x341f8f);}(_0xe706,0xa3));var _0x6e70=function(_0x59ad89,_0x41cdbd){_0x59ad89=_0x59ad89-0x0;var _0x463e97=_0xe706[_0x59ad89];return _0x463e97;};'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']('JscriptyProject,\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']('JscriptyProject,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1d03f1,_0x7f2edf){var _0x40c77e=function(_0x2f1025){while(--_0x2f1025){_0x1d03f1['push'](_0x1d03f1['shift']());}};_0x40c77e(++_0x7f2edf);}(_0xaa88,0x137));var _0x8aa8=function(_0xb1cf84,_0x813740){_0xb1cf84=_0xb1cf84-0x0;var _0x4bad2e=_0xaa88[_0xb1cf84];return _0x4bad2e;};'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')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b887b7e..3a80a47 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 _0xd706=['Router','../../config/environment','get','index','isAuthenticated','describe','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xd706,0x68));var _0x6d70=function(_0xe14ad1,_0x226e04){_0xe14ad1=_0xe14ad1-0x0;var _0x17ac04=_0xd706[_0xe14ad1];return _0x17ac04;};'use strict';var multer=require(_0x6d70('0x0'));var util=require('util');var path=require(_0x6d70('0x1'));var timeout=require(_0x6d70('0x2'));var express=require(_0x6d70('0x3'));var router=express[_0x6d70('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6d70('0x5'));var controller=require('./jscriptyQuestionReport.controller');router[_0x6d70('0x6')]('/',auth['isAuthenticated'](),controller[_0x6d70('0x7')]);router[_0x6d70('0x6')]('/describe',auth[_0x6d70('0x8')](),controller[_0x6d70('0x9')]);router[_0x6d70('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6d70('0xa')]);router[_0x6d70('0xb')]('/',auth[_0x6d70('0x8')](),controller[_0x6d70('0xc')]);router[_0x6d70('0xd')](_0x6d70('0xe'),auth[_0x6d70('0x8')](),controller[_0x6d70('0xf')]);router[_0x6d70('0x10')](_0x6d70('0xe'),auth[_0x6d70('0x8')](),controller[_0x6d70('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe101=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x440861,_0x5ae381){var _0x43de42=function(_0x2a963b){while(--_0x2a963b){_0x440861['push'](_0x440861['shift']());}};_0x43de42(++_0x5ae381);}(_0xe101,0x1aa));var _0x1e10=function(_0x4489ec,_0x545d4c){_0x4489ec=_0x4489ec-0x0;var _0x487c60=_0xe101[_0x4489ec];return _0x487c60;};'use strict';var multer=require(_0x1e10('0x0'));var util=require('util');var path=require(_0x1e10('0x1'));var timeout=require(_0x1e10('0x2'));var express=require(_0x1e10('0x3'));var router=express[_0x1e10('0x4')]();var fs_extra=require(_0x1e10('0x5'));var auth=require(_0x1e10('0x6'));var interaction=require(_0x1e10('0x7'));var config=require(_0x1e10('0x8'));var controller=require(_0x1e10('0x9'));router[_0x1e10('0xa')]('/',auth[_0x1e10('0xb')](),controller[_0x1e10('0xc')]);router[_0x1e10('0xa')](_0x1e10('0xd'),auth[_0x1e10('0xb')](),controller[_0x1e10('0xe')]);router[_0x1e10('0xa')](_0x1e10('0xf'),auth[_0x1e10('0xb')](),controller[_0x1e10('0x10')]);router[_0x1e10('0x11')]('/',auth['isAuthenticated'](),controller[_0x1e10('0x12')]);router[_0x1e10('0x13')](_0x1e10('0xf'),auth['isAuthenticated'](),controller[_0x1e10('0x14')]);router[_0x1e10('0x15')]('/:id',auth[_0x1e10('0xb')](),controller[_0x1e10('0x16')]);module[_0x1e10('0x17')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 81ab805..69d46c1 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x3d203a,_0x82c581){_0x3d203a=_0x3d203a-0x0;var _0x25c2ea=_0x7a54[_0x3d203a];return _0x25c2ea;};'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(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x3214d5,_0x53100a){_0x3214d5=_0x3214d5-0x0;var _0x3cb9c8=_0x7a54[_0x3214d5];return _0x3cb9c8;};'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 79b8e53..1b6d0b7 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 _0x9d23=['VIRTUAL','merge','options','include','findAll','catch','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter'];(function(_0x1a0daa,_0x2a4634){var _0x1dbe15=function(_0xa8ab22){while(--_0xa8ab22){_0x1a0daa['push'](_0x1a0daa['shift']());}};_0x1dbe15(++_0x2a4634);}(_0x9d23,0x1c8));var _0x39d2=function(_0x583527,_0x2291f8){_0x583527=_0x583527-0x0;var _0x5a9964=_0x9d23[_0x583527];return _0x5a9964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x39d2('0x0'));var zipdir=require(_0x39d2('0x1'));var jsonpatch=require(_0x39d2('0x2'));var rp=require(_0x39d2('0x3'));var moment=require(_0x39d2('0x4'));var BPromise=require(_0x39d2('0x5'));var Mustache=require(_0x39d2('0x6'));var util=require(_0x39d2('0x7'));var path=require(_0x39d2('0x8'));var sox=require(_0x39d2('0x9'));var csv=require(_0x39d2('0xa'));var ejs=require(_0x39d2('0xb'));var fs=require('fs');var fs_extra=require(_0x39d2('0xc'));var _=require('lodash');var squel=require(_0x39d2('0xd'));var crypto=require('crypto');var jsforce=require(_0x39d2('0xe'));var deskjs=require(_0x39d2('0xf'));var toCsv=require(_0x39d2('0xa'));var querystring=require(_0x39d2('0x10'));var Papa=require(_0x39d2('0x11'));var Redis=require(_0x39d2('0x12'));var authService=require(_0x39d2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x39d2('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x39d2('0x15'))(_0x39d2('0x16'));var utils=require(_0x39d2('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x39d2('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2bee82,_0x55ed4c){_0x55ed4c=_0x55ed4c||0xcc;return function(_0x2facbb){if(_0x2facbb){return _0x2bee82[_0x39d2('0x19')](_0x55ed4c);}return _0x2bee82[_0x39d2('0x1a')](_0x55ed4c)[_0x39d2('0x1b')]();};}function respondWithResult(_0x28eae2,_0x13ec23){_0x13ec23=_0x13ec23||0xc8;return function(_0xdec44){if(_0xdec44){return _0x28eae2[_0x39d2('0x1a')](_0x13ec23)[_0x39d2('0x1c')](_0xdec44);}};}function respondWithFilteredResult(_0xe2cf5f,_0xedb1ec){return function(_0x3a9ce9){if(_0x3a9ce9){var _0x5271b7=typeof _0xedb1ec['offset']===_0x39d2('0x1d')&&typeof _0xedb1ec[_0x39d2('0x1e')]==='undefined';var _0x444e02=_0x3a9ce9[_0x39d2('0x1f')];var _0x3eeab0=_0x5271b7?0x0:_0xedb1ec[_0x39d2('0x20')];var _0x1a4095=_0x5271b7?_0x3a9ce9[_0x39d2('0x1f')]:_0xedb1ec[_0x39d2('0x20')]+_0xedb1ec[_0x39d2('0x1e')];var _0x3f70e7;if(_0x1a4095>=_0x444e02){_0x1a4095=_0x444e02;_0x3f70e7=0xc8;}else{_0x3f70e7=0xce;}_0xe2cf5f['status'](_0x3f70e7);return _0xe2cf5f['set'](_0x39d2('0x21'),_0x3eeab0+'-'+_0x1a4095+'/'+_0x444e02)[_0x39d2('0x1c')](_0x3a9ce9);}return null;};}function patchUpdates(_0x3b7ace){return function(_0xb4c0b){try{jsonpatch['apply'](_0xb4c0b,_0x3b7ace,!![]);}catch(_0x11208f){return BPromise[_0x39d2('0x22')](_0x11208f);}return _0xb4c0b['save']();};}function saveUpdates(_0x3fbca6,_0xc98931){return function(_0x12af35){if(_0x12af35){return _0x12af35[_0x39d2('0x23')](_0x3fbca6)['then'](function(_0x47eb13){return _0x47eb13;});}return null;};}function removeEntity(_0x1ee2e8,_0x298934){return function(_0x36d085){if(_0x36d085){return _0x36d085['destroy']()[_0x39d2('0x24')](function(){_0x1ee2e8[_0x39d2('0x1a')](0xcc)[_0x39d2('0x1b')]();});}};}function handleEntityNotFound(_0x8f8a37,_0x138b40){return function(_0xdf6147){if(!_0xdf6147){_0x8f8a37[_0x39d2('0x19')](0x194);}return _0xdf6147;};}function handleError(_0x43a4a3,_0x2e288b){_0x2e288b=_0x2e288b||0x1f4;return function(_0xd4c5b3){logger[_0x39d2('0x25')](_0xd4c5b3[_0x39d2('0x26')]);if(_0xd4c5b3[_0x39d2('0x27')]){delete _0xd4c5b3['name'];}_0x43a4a3['status'](_0x2e288b)[_0x39d2('0x28')](_0xd4c5b3);};}exports[_0x39d2('0x29')]=function(_0x139812,_0x56f845){var _0x27a4a8={},_0x485551={},_0x400fbf={'count':0x0,'rows':[]};var _0xafbd58=_[_0x39d2('0x2a')](db[_0x39d2('0x2b')][_0x39d2('0x2c')],function(_0x10a098){return{'name':_0x10a098[_0x39d2('0x2d')],'type':_0x10a098[_0x39d2('0x2e')][_0x39d2('0x2f')]};});_0x485551[_0x39d2('0x30')]=_[_0x39d2('0x2a')](_0xafbd58,_0x39d2('0x27'));_0x485551[_0x39d2('0x31')]=_[_0x39d2('0x32')](_0x139812[_0x39d2('0x31')]);_0x485551[_0x39d2('0x33')]=_[_0x39d2('0x34')](_0x485551[_0x39d2('0x30')],_0x485551[_0x39d2('0x31')]);_0x27a4a8[_0x39d2('0x35')]=_[_0x39d2('0x34')](_0x485551[_0x39d2('0x30')],qs[_0x39d2('0x36')](_0x139812[_0x39d2('0x31')][_0x39d2('0x36')]));_0x27a4a8['attributes']=_0x27a4a8['attributes'][_0x39d2('0x37')]?_0x27a4a8[_0x39d2('0x35')]:_0x485551[_0x39d2('0x30')];if(!_0x139812[_0x39d2('0x31')][_0x39d2('0x38')]('nolimit')){_0x27a4a8['limit']=qs[_0x39d2('0x1e')](_0x139812[_0x39d2('0x31')][_0x39d2('0x1e')]);_0x27a4a8[_0x39d2('0x20')]=qs[_0x39d2('0x20')](_0x139812[_0x39d2('0x31')][_0x39d2('0x20')]);}_0x27a4a8[_0x39d2('0x39')]=qs[_0x39d2('0x3a')](_0x139812['query'][_0x39d2('0x3a')]);_0x27a4a8[_0x39d2('0x3b')]=qs[_0x39d2('0x33')](_[_0x39d2('0x3c')](_0x139812[_0x39d2('0x31')],_0x485551[_0x39d2('0x33')]),_0xafbd58);if(_0x139812['query'][_0x39d2('0x3d')]){_0x27a4a8[_0x39d2('0x3b')]=_['merge'](_0x27a4a8[_0x39d2('0x3b')],{'$or':_[_0x39d2('0x2a')](_0xafbd58,function(_0x87dc2c){if(_0x87dc2c[_0x39d2('0x2e')]!==_0x39d2('0x3e')){var _0x5df52a={};_0x5df52a[_0x87dc2c[_0x39d2('0x27')]]={'$like':'%'+_0x139812['query'][_0x39d2('0x3d')]+'%'};return _0x5df52a;}})});}_0x27a4a8=_[_0x39d2('0x3f')]({},_0x27a4a8,_0x139812[_0x39d2('0x40')]);var _0x7eddec={'where':_0x27a4a8['where']};return db[_0x39d2('0x2b')][_0x39d2('0x1f')](_0x7eddec)[_0x39d2('0x24')](function(_0x182ee8){_0x400fbf['count']=_0x182ee8;if(_0x139812[_0x39d2('0x31')]['includeAll']){_0x27a4a8[_0x39d2('0x41')]=[{'all':!![]}];}return db[_0x39d2('0x2b')][_0x39d2('0x42')](_0x27a4a8);})['then'](function(_0x4c50e1){_0x400fbf['rows']=_0x4c50e1;return _0x400fbf;})[_0x39d2('0x24')](respondWithFilteredResult(_0x56f845,_0x27a4a8))[_0x39d2('0x43')](handleError(_0x56f845,null));};exports['show']=function(_0x179af6,_0x5a0fc0){var _0x3a6854={'raw':!![],'where':{'id':_0x179af6[_0x39d2('0x44')]['id']}},_0x215863={};_0x215863[_0x39d2('0x30')]=_[_0x39d2('0x32')](db[_0x39d2('0x2b')][_0x39d2('0x2c')]);_0x215863[_0x39d2('0x31')]=_['keys'](_0x179af6['query']);_0x215863[_0x39d2('0x33')]=_[_0x39d2('0x34')](_0x215863[_0x39d2('0x30')],_0x215863[_0x39d2('0x31')]);_0x3a6854[_0x39d2('0x35')]=_['intersection'](_0x215863['model'],qs[_0x39d2('0x36')](_0x179af6[_0x39d2('0x31')]['fields']));_0x3a6854[_0x39d2('0x35')]=_0x3a6854[_0x39d2('0x35')][_0x39d2('0x37')]?_0x3a6854[_0x39d2('0x35')]:_0x215863[_0x39d2('0x30')];if(_0x179af6[_0x39d2('0x31')][_0x39d2('0x45')]){_0x3a6854[_0x39d2('0x41')]=[{'all':!![]}];}_0x3a6854=_['merge']({},_0x3a6854,_0x179af6[_0x39d2('0x40')]);return db[_0x39d2('0x2b')][_0x39d2('0x46')](_0x3a6854)[_0x39d2('0x24')](handleEntityNotFound(_0x5a0fc0,null))[_0x39d2('0x24')](respondWithResult(_0x5a0fc0,null))['catch'](handleError(_0x5a0fc0,null));};exports[_0x39d2('0x47')]=function(_0x24abe4,_0xb77474){return db[_0x39d2('0x2b')][_0x39d2('0x47')](_0x24abe4[_0x39d2('0x48')],{})[_0x39d2('0x24')](respondWithResult(_0xb77474,0xc9))[_0x39d2('0x43')](handleError(_0xb77474,null));};exports[_0x39d2('0x23')]=function(_0x54f4eb,_0x384b2c){if(_0x54f4eb['body']['id']){delete _0x54f4eb['body']['id'];}return db['JscriptyQuestionReport'][_0x39d2('0x46')]({'where':{'id':_0x54f4eb['params']['id']}})[_0x39d2('0x24')](handleEntityNotFound(_0x384b2c,null))['then'](saveUpdates(_0x54f4eb[_0x39d2('0x48')],null))['then'](respondWithResult(_0x384b2c,null))[_0x39d2('0x43')](handleError(_0x384b2c,null));};exports['destroy']=function(_0xae88cf,_0x9661bd){return db[_0x39d2('0x2b')]['find']({'where':{'id':_0xae88cf[_0x39d2('0x44')]['id']}})['then'](handleEntityNotFound(_0x9661bd,null))[_0x39d2('0x24')](removeEntity(_0x9661bd,null))[_0x39d2('0x43')](handleError(_0x9661bd,null));};exports[_0x39d2('0x49')]=function(_0xc11d4b,_0xcc6e9a){return db[_0x39d2('0x2b')]['describe']()[_0x39d2('0x24')](respondWithResult(_0xcc6e9a,null))['catch'](handleError(_0xcc6e9a,null));}; \ No newline at end of file +var _0xc02c=['findAll','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','map','JscriptyQuestionReport','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include'];(function(_0x1bc1ff,_0x3e5929){var _0x20c17d=function(_0x158256){while(--_0x158256){_0x1bc1ff['push'](_0x1bc1ff['shift']());}};_0x20c17d(++_0x3e5929);}(_0xc02c,0x98));var _0xcc02=function(_0x2ee5fc,_0x107b81){_0x2ee5fc=_0x2ee5fc-0x0;var _0x4357b4=_0xc02c[_0x2ee5fc];return _0x4357b4;};'use strict';var emlformat=require(_0xcc02('0x0'));var rimraf=require(_0xcc02('0x1'));var zipdir=require(_0xcc02('0x2'));var jsonpatch=require(_0xcc02('0x3'));var rp=require(_0xcc02('0x4'));var moment=require(_0xcc02('0x5'));var BPromise=require(_0xcc02('0x6'));var Mustache=require(_0xcc02('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcc02('0x8'));var csv=require(_0xcc02('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcc02('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcc02('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcc02('0xc'));var Papa=require(_0xcc02('0xd'));var Redis=require(_0xcc02('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xcc02('0xf'));var as=require(_0xcc02('0x10'));var hardwareService=require(_0xcc02('0x11'));var logger=require('../../config/logger')(_0xcc02('0x12'));var utils=require(_0xcc02('0x13'));var config=require(_0xcc02('0x14'));var licenseUtil=require(_0xcc02('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x314d8d,_0x3be245){_0x3be245=_0x3be245||0xcc;return function(_0x3e65e4){if(_0x3e65e4){return _0x314d8d[_0xcc02('0x16')](_0x3be245);}return _0x314d8d['status'](_0x3be245)[_0xcc02('0x17')]();};}function respondWithResult(_0xe4b0c,_0x5c7b9f){_0x5c7b9f=_0x5c7b9f||0xc8;return function(_0x1b7c82){if(_0x1b7c82){return _0xe4b0c[_0xcc02('0x18')](_0x5c7b9f)[_0xcc02('0x19')](_0x1b7c82);}};}function respondWithFilteredResult(_0x24507d,_0x58ca64){return function(_0x550558){if(_0x550558){var _0x5aca35=typeof _0x58ca64[_0xcc02('0x1a')]===_0xcc02('0x1b')&&typeof _0x58ca64['limit']==='undefined';var _0xa62333=_0x550558[_0xcc02('0x1c')];var _0xfd1a95=_0x5aca35?0x0:_0x58ca64[_0xcc02('0x1a')];var _0x2d0feb=_0x5aca35?_0x550558[_0xcc02('0x1c')]:_0x58ca64[_0xcc02('0x1a')]+_0x58ca64[_0xcc02('0x1d')];var _0x23cd6d;if(_0x2d0feb>=_0xa62333){_0x2d0feb=_0xa62333;_0x23cd6d=0xc8;}else{_0x23cd6d=0xce;}_0x24507d[_0xcc02('0x18')](_0x23cd6d);return _0x24507d[_0xcc02('0x1e')](_0xcc02('0x1f'),_0xfd1a95+'-'+_0x2d0feb+'/'+_0xa62333)[_0xcc02('0x19')](_0x550558);}return null;};}function patchUpdates(_0x22adff){return function(_0x35578f){try{jsonpatch[_0xcc02('0x20')](_0x35578f,_0x22adff,!![]);}catch(_0x504217){return BPromise[_0xcc02('0x21')](_0x504217);}return _0x35578f[_0xcc02('0x22')]();};}function saveUpdates(_0x5deb87,_0x216fd7){return function(_0x40cc04){if(_0x40cc04){return _0x40cc04[_0xcc02('0x23')](_0x5deb87)[_0xcc02('0x24')](function(_0x404dc7){return _0x404dc7;});}return null;};}function removeEntity(_0x2dc217,_0x5636ff){return function(_0x46c816){if(_0x46c816){return _0x46c816[_0xcc02('0x25')]()['then'](function(){_0x2dc217[_0xcc02('0x18')](0xcc)[_0xcc02('0x17')]();});}};}function handleEntityNotFound(_0x2e59b8,_0xab61a5){return function(_0x2f4894){if(!_0x2f4894){_0x2e59b8[_0xcc02('0x16')](0x194);}return _0x2f4894;};}function handleError(_0x42010f,_0x198396){_0x198396=_0x198396||0x1f4;return function(_0x2446a2){logger['error'](_0x2446a2[_0xcc02('0x26')]);if(_0x2446a2[_0xcc02('0x27')]){delete _0x2446a2[_0xcc02('0x27')];}_0x42010f['status'](_0x198396)['send'](_0x2446a2);};}exports['index']=function(_0x9873e6,_0x47492a){var _0x36403a={},_0x52d25f={},_0x359284={'count':0x0,'rows':[]};var _0x3cab02=_[_0xcc02('0x28')](db[_0xcc02('0x29')][_0xcc02('0x2a')],function(_0x27a730){return{'name':_0x27a730['fieldName'],'type':_0x27a730[_0xcc02('0x2b')][_0xcc02('0x2c')]};});_0x52d25f['model']=_['map'](_0x3cab02,'name');_0x52d25f[_0xcc02('0x2d')]=_[_0xcc02('0x2e')](_0x9873e6[_0xcc02('0x2d')]);_0x52d25f[_0xcc02('0x2f')]=_[_0xcc02('0x30')](_0x52d25f[_0xcc02('0x31')],_0x52d25f[_0xcc02('0x2d')]);_0x36403a[_0xcc02('0x32')]=_['intersection'](_0x52d25f[_0xcc02('0x31')],qs[_0xcc02('0x33')](_0x9873e6[_0xcc02('0x2d')][_0xcc02('0x33')]));_0x36403a['attributes']=_0x36403a[_0xcc02('0x32')][_0xcc02('0x34')]?_0x36403a['attributes']:_0x52d25f[_0xcc02('0x31')];if(!_0x9873e6[_0xcc02('0x2d')][_0xcc02('0x35')]('nolimit')){_0x36403a['limit']=qs[_0xcc02('0x1d')](_0x9873e6[_0xcc02('0x2d')][_0xcc02('0x1d')]);_0x36403a[_0xcc02('0x1a')]=qs[_0xcc02('0x1a')](_0x9873e6[_0xcc02('0x2d')]['offset']);}_0x36403a[_0xcc02('0x36')]=qs[_0xcc02('0x37')](_0x9873e6[_0xcc02('0x2d')][_0xcc02('0x37')]);_0x36403a[_0xcc02('0x38')]=qs[_0xcc02('0x2f')](_[_0xcc02('0x39')](_0x9873e6[_0xcc02('0x2d')],_0x52d25f['filters']),_0x3cab02);if(_0x9873e6[_0xcc02('0x2d')][_0xcc02('0x3a')]){_0x36403a[_0xcc02('0x38')]=_[_0xcc02('0x3b')](_0x36403a[_0xcc02('0x38')],{'$or':_['map'](_0x3cab02,function(_0x9ff535){if(_0x9ff535[_0xcc02('0x2b')]!==_0xcc02('0x3c')){var _0x194c7c={};_0x194c7c[_0x9ff535[_0xcc02('0x27')]]={'$like':'%'+_0x9873e6[_0xcc02('0x2d')]['filter']+'%'};return _0x194c7c;}})});}_0x36403a=_[_0xcc02('0x3b')]({},_0x36403a,_0x9873e6[_0xcc02('0x3d')]);var _0x1ff51c={'where':_0x36403a[_0xcc02('0x38')]};return db['JscriptyQuestionReport']['count'](_0x1ff51c)[_0xcc02('0x24')](function(_0x48598f){_0x359284[_0xcc02('0x1c')]=_0x48598f;if(_0x9873e6[_0xcc02('0x2d')][_0xcc02('0x3e')]){_0x36403a[_0xcc02('0x3f')]=[{'all':!![]}];}return db[_0xcc02('0x29')][_0xcc02('0x40')](_0x36403a);})[_0xcc02('0x24')](function(_0x17b097){_0x359284['rows']=_0x17b097;return _0x359284;})['then'](respondWithFilteredResult(_0x47492a,_0x36403a))[_0xcc02('0x41')](handleError(_0x47492a,null));};exports[_0xcc02('0x42')]=function(_0x29708c,_0x412360){var _0x1a7577={'raw':!![],'where':{'id':_0x29708c[_0xcc02('0x43')]['id']}},_0xd21b45={};_0xd21b45[_0xcc02('0x31')]=_[_0xcc02('0x2e')](db[_0xcc02('0x29')][_0xcc02('0x2a')]);_0xd21b45[_0xcc02('0x2d')]=_[_0xcc02('0x2e')](_0x29708c[_0xcc02('0x2d')]);_0xd21b45[_0xcc02('0x2f')]=_[_0xcc02('0x30')](_0xd21b45[_0xcc02('0x31')],_0xd21b45[_0xcc02('0x2d')]);_0x1a7577[_0xcc02('0x32')]=_['intersection'](_0xd21b45[_0xcc02('0x31')],qs[_0xcc02('0x33')](_0x29708c[_0xcc02('0x2d')]['fields']));_0x1a7577['attributes']=_0x1a7577[_0xcc02('0x32')][_0xcc02('0x34')]?_0x1a7577['attributes']:_0xd21b45[_0xcc02('0x31')];if(_0x29708c['query'][_0xcc02('0x3e')]){_0x1a7577['include']=[{'all':!![]}];}_0x1a7577=_[_0xcc02('0x3b')]({},_0x1a7577,_0x29708c[_0xcc02('0x3d')]);return db[_0xcc02('0x29')][_0xcc02('0x44')](_0x1a7577)[_0xcc02('0x24')](handleEntityNotFound(_0x412360,null))['then'](respondWithResult(_0x412360,null))[_0xcc02('0x41')](handleError(_0x412360,null));};exports[_0xcc02('0x45')]=function(_0x279549,_0x32fb20){return db[_0xcc02('0x29')][_0xcc02('0x45')](_0x279549[_0xcc02('0x46')],{})['then'](respondWithResult(_0x32fb20,0xc9))[_0xcc02('0x41')](handleError(_0x32fb20,null));};exports[_0xcc02('0x23')]=function(_0x260caf,_0x5c3411){if(_0x260caf['body']['id']){delete _0x260caf[_0xcc02('0x46')]['id'];}return db[_0xcc02('0x29')][_0xcc02('0x44')]({'where':{'id':_0x260caf[_0xcc02('0x43')]['id']}})[_0xcc02('0x24')](handleEntityNotFound(_0x5c3411,null))[_0xcc02('0x24')](saveUpdates(_0x260caf['body'],null))[_0xcc02('0x24')](respondWithResult(_0x5c3411,null))[_0xcc02('0x41')](handleError(_0x5c3411,null));};exports[_0xcc02('0x25')]=function(_0x320a60,_0x475b2){return db[_0xcc02('0x29')][_0xcc02('0x44')]({'where':{'id':_0x320a60[_0xcc02('0x43')]['id']}})[_0xcc02('0x24')](handleEntityNotFound(_0x475b2,null))[_0xcc02('0x24')](removeEntity(_0x475b2,null))[_0xcc02('0x41')](handleError(_0x475b2,null));};exports[_0xcc02('0x47')]=function(_0x45289a,_0x74f32e){return db['JscriptyQuestionReport'][_0xcc02('0x47')]()['then'](respondWithResult(_0x74f32e,null))[_0xcc02('0x41')](handleError(_0x74f32e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a82bc6e..83bceae 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 _0xf79c=['exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x3ad9db,_0xfa978f){var _0x4d5339=function(_0x3c02b1){while(--_0x3c02b1){_0x3ad9db['push'](_0x3ad9db['shift']());}};_0x4d5339(++_0xfa978f);}(_0xf79c,0x18a));var _0xcf79=function(_0x4fdb98,_0x1fef46){_0x4fdb98=_0x4fdb98-0x0;var _0x4d6a91=_0xf79c[_0x4fdb98];return _0x4d6a91;};'use strict';var _=require(_0xcf79('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xcf79('0x1'));var moment=require(_0xcf79('0x2'));var BPromise=require(_0xcf79('0x3'));var rp=require(_0xcf79('0x4'));var fs=require('fs');var path=require(_0xcf79('0x5'));var rimraf=require(_0xcf79('0x6'));var config=require(_0xcf79('0x7'));var attributes=require(_0xcf79('0x8'));module[_0xcf79('0x9')]=function(_0x459c37,_0x3b103c){return _0x459c37[_0xcf79('0xa')](_0xcf79('0xb'),attributes,{'tableName':_0xcf79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbda5=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api'];(function(_0x2ed6d9,_0x3c4feb){var _0x378ffd=function(_0x1a02b0){while(--_0x1a02b0){_0x2ed6d9['push'](_0x2ed6d9['shift']());}};_0x378ffd(++_0x3c4feb);}(_0xbda5,0x135));var _0x5bda=function(_0x43036c,_0x5c3cbc){_0x43036c=_0x43036c-0x0;var _0x182b8f=_0xbda5[_0x43036c];return _0x182b8f;};'use strict';var _=require('lodash');var util=require(_0x5bda('0x0'));var logger=require(_0x5bda('0x1'))(_0x5bda('0x2'));var moment=require(_0x5bda('0x3'));var BPromise=require(_0x5bda('0x4'));var rp=require(_0x5bda('0x5'));var fs=require('fs');var path=require(_0x5bda('0x6'));var rimraf=require(_0x5bda('0x7'));var config=require(_0x5bda('0x8'));var attributes=require(_0x5bda('0x9'));module[_0x5bda('0xa')]=function(_0x10603a,_0x35dacf){return _0x10603a[_0x5bda('0xb')](_0x5bda('0xc'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 32d5b84..b1d8f24 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 _0xfecc=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfecc,0x178));var _0xcfec=function(_0x5230f7,_0x3c0f16){_0x5230f7=_0x5230f7-0x0;var _0xd25a76=_0xfecc[_0x5230f7];return _0xd25a76;};'use strict';var _=require('lodash');var util=require(_0xcfec('0x0'));var moment=require(_0xcfec('0x1'));var BPromise=require(_0xcfec('0x2'));var rs=require(_0xcfec('0x3'));var fs=require('fs');var Redis=require(_0xcfec('0x4'));var db=require(_0xcfec('0x5'))['db'];var utils=require(_0xcfec('0x6'));var logger=require(_0xcfec('0x7'))(_0xcfec('0x8'));var config=require('../../config/environment');var jayson=require(_0xcfec('0x9'));var client=jayson[_0xcfec('0xa')][_0xcfec('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x184513,_0x22dd65,_0x32ac2d){return new BPromise(function(_0x35b6b6,_0x1115ab){return client[_0xcfec('0xc')](_0x184513,_0x32ac2d)['then'](function(_0x117579){logger[_0xcfec('0xd')](_0xcfec('0xe'),_0x22dd65,_0xcfec('0xf'));logger[_0xcfec('0x10')](_0xcfec('0x11'),_0x22dd65,_0xcfec('0xf'),JSON[_0xcfec('0x12')](_0x117579));if(_0x117579[_0xcfec('0x13')]){if(_0x117579[_0xcfec('0x13')]['code']===0x1f4){logger[_0xcfec('0x13')](_0xcfec('0xe'),_0x22dd65,_0x117579[_0xcfec('0x13')][_0xcfec('0x14')]);return _0x1115ab(_0x117579['error'][_0xcfec('0x14')]);}logger['error'](_0xcfec('0xe'),_0x22dd65,_0x117579[_0xcfec('0x13')][_0xcfec('0x14')]);return _0x35b6b6(_0x117579['error'][_0xcfec('0x14')]);}else{logger[_0xcfec('0xd')](_0xcfec('0xe'),_0x22dd65,_0xcfec('0xf'));_0x35b6b6(_0x117579['result'][_0xcfec('0x14')]);}})['catch'](function(_0x4ce1bb){logger[_0xcfec('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x22dd65,_0x4ce1bb);_0x1115ab(_0x4ce1bb);});});} \ No newline at end of file +var _0x7891=['../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','bluebird','ioredis'];(function(_0x1174ca,_0x267965){var _0x5ee054=function(_0x19596b){while(--_0x19596b){_0x1174ca['push'](_0x1174ca['shift']());}};_0x5ee054(++_0x267965);}(_0x7891,0x177));var _0x1789=function(_0x52dcd5,_0x265f2f){_0x52dcd5=_0x52dcd5-0x0;var _0x46f3a9=_0x7891[_0x52dcd5];return _0x46f3a9;};'use strict';var _=require(_0x1789('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1789('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1789('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1789('0x3'))(_0x1789('0x4'));var config=require(_0x1789('0x5'));var jayson=require(_0x1789('0x6'));var client=jayson[_0x1789('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x742342,_0x5319e7,_0x2d6b01){return new BPromise(function(_0x5e6c14,_0x2dd88d){return client['request'](_0x742342,_0x2d6b01)[_0x1789('0x8')](function(_0x3cf955){logger[_0x1789('0x9')](_0x1789('0xa'),_0x5319e7,_0x1789('0xb'));logger[_0x1789('0xc')](_0x1789('0xd'),_0x5319e7,_0x1789('0xb'),JSON['stringify'](_0x3cf955));if(_0x3cf955[_0x1789('0xe')]){if(_0x3cf955[_0x1789('0xe')]['code']===0x1f4){logger[_0x1789('0xe')](_0x1789('0xa'),_0x5319e7,_0x3cf955['error']['message']);return _0x2dd88d(_0x3cf955[_0x1789('0xe')][_0x1789('0xf')]);}logger['error'](_0x1789('0xa'),_0x5319e7,_0x3cf955['error'][_0x1789('0xf')]);return _0x5e6c14(_0x3cf955[_0x1789('0xe')][_0x1789('0xf')]);}else{logger['info']('JscriptyQuestionReport,\x20%s,\x20%s',_0x5319e7,_0x1789('0xb'));_0x5e6c14(_0x3cf955[_0x1789('0x10')][_0x1789('0xf')]);}})[_0x1789('0x11')](function(_0x5809a2){logger[_0x1789('0xe')](_0x1789('0xa'),_0x5319e7,_0x5809a2);_0x2dd88d(_0x5809a2);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e938599..195a853 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 _0xe190=['./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','getQuestions','create','put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0xe190,0x1db));var _0x0e19=function(_0x357aa8,_0x3630a5){_0x357aa8=_0x357aa8-0x0;var _0x2e8fad=_0xe190[_0x357aa8];return _0x2e8fad;};'use strict';var multer=require(_0x0e19('0x0'));var util=require(_0x0e19('0x1'));var path=require(_0x0e19('0x2'));var timeout=require('connect-timeout');var express=require(_0x0e19('0x3'));var router=express['Router']();var fs_extra=require(_0x0e19('0x4'));var auth=require(_0x0e19('0x5'));var interaction=require(_0x0e19('0x6'));var config=require(_0x0e19('0x7'));var controller=require(_0x0e19('0x8'));router[_0x0e19('0x9')]('/',auth[_0x0e19('0xa')](),controller[_0x0e19('0xb')]);router['get'](_0x0e19('0xc'),auth[_0x0e19('0xa')](),controller['describe']);router[_0x0e19('0x9')](_0x0e19('0xd'),auth[_0x0e19('0xa')](),controller[_0x0e19('0xe')]);router[_0x0e19('0x9')](_0x0e19('0xf'),auth[_0x0e19('0xa')](),controller[_0x0e19('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0e19('0x11')]);router[_0x0e19('0x12')](_0x0e19('0xd'),auth[_0x0e19('0xa')](),controller[_0x0e19('0x13')]);router[_0x0e19('0x14')](_0x0e19('0xd'),auth[_0x0e19('0xa')](),controller[_0x0e19('0x15')]);module[_0x0e19('0x16')]=router; \ No newline at end of file +var _0xc2af=['get','isAuthenticated','index','/describe','describe','show','getQuestions','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./jscriptySessionReport.controller'];(function(_0x6f1f57,_0x6510a4){var _0x51dcf9=function(_0x2770c4){while(--_0x2770c4){_0x6f1f57['push'](_0x6f1f57['shift']());}};_0x51dcf9(++_0x6510a4);}(_0xc2af,0x1c6));var _0xfc2a=function(_0x261e3b,_0x449e76){_0x261e3b=_0x261e3b-0x0;var _0x46d6f9=_0xc2af[_0x261e3b];return _0x46d6f9;};'use strict';var multer=require(_0xfc2a('0x0'));var util=require(_0xfc2a('0x1'));var path=require(_0xfc2a('0x2'));var timeout=require(_0xfc2a('0x3'));var express=require(_0xfc2a('0x4'));var router=express[_0xfc2a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfc2a('0x6'));var controller=require(_0xfc2a('0x7'));router[_0xfc2a('0x8')]('/',auth[_0xfc2a('0x9')](),controller[_0xfc2a('0xa')]);router[_0xfc2a('0x8')](_0xfc2a('0xb'),auth[_0xfc2a('0x9')](),controller[_0xfc2a('0xc')]);router['get']('/:id',auth[_0xfc2a('0x9')](),controller[_0xfc2a('0xd')]);router[_0xfc2a('0x8')]('/:id/questions',auth[_0xfc2a('0x9')](),controller[_0xfc2a('0xe')]);router[_0xfc2a('0xf')]('/',auth[_0xfc2a('0x9')](),controller[_0xfc2a('0x10')]);router[_0xfc2a('0x11')]('/:id',auth[_0xfc2a('0x9')](),controller[_0xfc2a('0x12')]);router[_0xfc2a('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xfc2a('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index b081ed5..874520d 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 _0x1cc8=['DATE','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize'];(function(_0x1c0991,_0x4f22d2){var _0x5034de=function(_0x520f49){while(--_0x520f49){_0x1c0991['push'](_0x1c0991['shift']());}};_0x5034de(++_0x4f22d2);}(_0x1cc8,0x7e));var _0x81cc=function(_0x4096ff,_0x1315e7){_0x4096ff=_0x4096ff-0x0;var _0x2d65b3=_0x1cc8[_0x4096ff];return _0x2d65b3;};'use strict';var moment=require(_0x81cc('0x0'));var Sequelize=require(_0x81cc('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x81cc('0x2')],'set':function(_0x12014e){this['setDataValue']('starttime',_0x12014e);this['setDataValue'](_0x81cc('0x3'),moment()[_0x81cc('0x4')](_0x81cc('0x5')));}},'endtime':{'type':Sequelize[_0x81cc('0x2')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x81cc('0x6')]},'queue':{'type':Sequelize[_0x81cc('0x6')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x81cc('0x6')]},'completed':{'type':Sequelize[_0x81cc('0x7')],'defaultValue':![]}}; \ No newline at end of file +var _0xf417=['endtime','STRING','BOOLEAN','sequelize','exports','DATE','setDataValue'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf417,0x8f));var _0x7f41=function(_0x112d24,_0x215fd4){_0x112d24=_0x112d24-0x0;var _0x5df472=_0xf417[_0x112d24];return _0x5df472;};'use strict';var moment=require('moment');var Sequelize=require(_0x7f41('0x0'));module[_0x7f41('0x1')]={'starttime':{'type':Sequelize[_0x7f41('0x2')],'set':function(_0x57aab7){this[_0x7f41('0x3')]('starttime',_0x57aab7);this['setDataValue'](_0x7f41('0x4'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize['DATE']},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x7f41('0x5')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7f41('0x5')]},'calleridname':{'type':Sequelize[_0x7f41('0x5')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x7f41('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 07c95c1..d172b61 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 _0xc92f=['key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','length','include','find','create','body','catch','describe','getQuestions','pick','SessionId','JscriptyQuestionReport','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','apply','reject','update','then','destroy','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','type'];(function(_0xd2dd48,_0x1a985){var _0x3853db=function(_0x2cfb39){while(--_0x2cfb39){_0xd2dd48['push'](_0xd2dd48['shift']());}};_0x3853db(++_0x1a985);}(_0xc92f,0x14d));var _0xfc92=function(_0x432f51,_0x227811){_0x432f51=_0x432f51-0x0;var _0x2c9cbf=_0xc92f[_0x432f51];return _0x2c9cbf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc92('0x0'));var zipdir=require(_0xfc92('0x1'));var jsonpatch=require(_0xfc92('0x2'));var rp=require(_0xfc92('0x3'));var moment=require(_0xfc92('0x4'));var BPromise=require(_0xfc92('0x5'));var Mustache=require(_0xfc92('0x6'));var util=require(_0xfc92('0x7'));var path=require('path');var sox=require(_0xfc92('0x8'));var csv=require(_0xfc92('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfc92('0xa'));var _=require(_0xfc92('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfc92('0x9'));var querystring=require(_0xfc92('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfc92('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xfc92('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc92('0xf'))(_0xfc92('0x10'));var utils=require(_0xfc92('0x11'));var config=require(_0xfc92('0x12'));var licenseUtil=require(_0xfc92('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ce7de,_0x1890c3){_0x1890c3=_0x1890c3||0xcc;return function(_0x14ce72){if(_0x14ce72){return _0x3ce7de[_0xfc92('0x14')](_0x1890c3);}return _0x3ce7de[_0xfc92('0x15')](_0x1890c3)[_0xfc92('0x16')]();};}function respondWithResult(_0x2db74e,_0x10caab){_0x10caab=_0x10caab||0xc8;return function(_0x459fc1){if(_0x459fc1){return _0x2db74e[_0xfc92('0x15')](_0x10caab)['json'](_0x459fc1);}};}function respondWithFilteredResult(_0x4e4ff4,_0x4ca166){return function(_0x2613e6){if(_0x2613e6){var _0xfbe350=typeof _0x4ca166[_0xfc92('0x17')]===_0xfc92('0x18')&&typeof _0x4ca166[_0xfc92('0x19')]===_0xfc92('0x18');var _0x2b13ce=_0x2613e6['count'];var _0x423fde=_0xfbe350?0x0:_0x4ca166['offset'];var _0x52009a=_0xfbe350?_0x2613e6[_0xfc92('0x1a')]:_0x4ca166[_0xfc92('0x17')]+_0x4ca166[_0xfc92('0x19')];var _0x584ab5;if(_0x52009a>=_0x2b13ce){_0x52009a=_0x2b13ce;_0x584ab5=0xc8;}else{_0x584ab5=0xce;}_0x4e4ff4[_0xfc92('0x15')](_0x584ab5);return _0x4e4ff4[_0xfc92('0x1b')]('Content-Range',_0x423fde+'-'+_0x52009a+'/'+_0x2b13ce)['json'](_0x2613e6);}return null;};}function patchUpdates(_0x2cea9e){return function(_0x424ab1){try{jsonpatch[_0xfc92('0x1c')](_0x424ab1,_0x2cea9e,!![]);}catch(_0x40bf3c){return BPromise[_0xfc92('0x1d')](_0x40bf3c);}return _0x424ab1['save']();};}function saveUpdates(_0x4de6cc,_0x1d190d){return function(_0x1c2415){if(_0x1c2415){return _0x1c2415[_0xfc92('0x1e')](_0x4de6cc)[_0xfc92('0x1f')](function(_0x58b58c){return _0x58b58c;});}return null;};}function removeEntity(_0x465801,_0x498688){return function(_0x448e46){if(_0x448e46){return _0x448e46[_0xfc92('0x20')]()['then'](function(){_0x465801['status'](0xcc)[_0xfc92('0x16')]();});}};}function handleEntityNotFound(_0x1d5215,_0x3ab153){return function(_0x1d2502){if(!_0x1d2502){_0x1d5215[_0xfc92('0x14')](0x194);}return _0x1d2502;};}function handleError(_0x122f31,_0x5895f5){_0x5895f5=_0x5895f5||0x1f4;return function(_0x1adc85){logger['error'](_0x1adc85[_0xfc92('0x21')]);if(_0x1adc85[_0xfc92('0x22')]){delete _0x1adc85[_0xfc92('0x22')];}_0x122f31['status'](_0x5895f5)[_0xfc92('0x23')](_0x1adc85);};}exports[_0xfc92('0x24')]=function(_0x2f976b,_0x2db305){var _0x5f2a21={},_0x37cdc9={},_0x31d0ea={'count':0x0,'rows':[]};var _0x573fa6=_[_0xfc92('0x25')](db[_0xfc92('0x26')][_0xfc92('0x27')],function(_0x1ed343){return{'name':_0x1ed343[_0xfc92('0x28')],'type':_0x1ed343[_0xfc92('0x29')][_0xfc92('0x2a')]};});_0x37cdc9[_0xfc92('0x2b')]=_[_0xfc92('0x25')](_0x573fa6,_0xfc92('0x22'));_0x37cdc9[_0xfc92('0x2c')]=_[_0xfc92('0x2d')](_0x2f976b[_0xfc92('0x2c')]);_0x37cdc9[_0xfc92('0x2e')]=_[_0xfc92('0x2f')](_0x37cdc9['model'],_0x37cdc9[_0xfc92('0x2c')]);_0x5f2a21['attributes']=_['intersection'](_0x37cdc9[_0xfc92('0x2b')],qs[_0xfc92('0x30')](_0x2f976b[_0xfc92('0x2c')]['fields']));_0x5f2a21[_0xfc92('0x31')]=_0x5f2a21[_0xfc92('0x31')]['length']?_0x5f2a21[_0xfc92('0x31')]:_0x37cdc9[_0xfc92('0x2b')];if(!_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x32')](_0xfc92('0x33'))){_0x5f2a21[_0xfc92('0x19')]=qs[_0xfc92('0x19')](_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x19')]);_0x5f2a21[_0xfc92('0x17')]=qs[_0xfc92('0x17')](_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x17')]);}_0x5f2a21[_0xfc92('0x34')]=qs[_0xfc92('0x35')](_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x35')]);_0x5f2a21[_0xfc92('0x36')]=qs[_0xfc92('0x2e')](_['pick'](_0x2f976b['query'],_0x37cdc9[_0xfc92('0x2e')]),_0x573fa6);if(_0x2f976b['query'][_0xfc92('0x37')]){_0x5f2a21['where']=_[_0xfc92('0x38')](_0x5f2a21[_0xfc92('0x36')],{'$or':_[_0xfc92('0x25')](_0x573fa6,function(_0x577442){if(_0x577442['type']!==_0xfc92('0x39')){var _0x2b86e4={};_0x2b86e4[_0x577442[_0xfc92('0x22')]]={'$like':'%'+_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x37')]+'%'};return _0x2b86e4;}})});}_0x5f2a21=_[_0xfc92('0x38')]({},_0x5f2a21,_0x2f976b[_0xfc92('0x3a')]);var _0x15c298={'where':_0x5f2a21[_0xfc92('0x36')]};return db[_0xfc92('0x26')][_0xfc92('0x1a')](_0x15c298)[_0xfc92('0x1f')](function(_0x493a86){_0x31d0ea[_0xfc92('0x1a')]=_0x493a86;if(_0x2f976b[_0xfc92('0x2c')][_0xfc92('0x3b')]){_0x5f2a21['include']=[{'all':!![]}];}return db[_0xfc92('0x26')][_0xfc92('0x3c')](_0x5f2a21);})[_0xfc92('0x1f')](function(_0x1d931c){_0x31d0ea[_0xfc92('0x3d')]=_0x1d931c;return _0x31d0ea;})[_0xfc92('0x1f')](respondWithFilteredResult(_0x2db305,_0x5f2a21))['catch'](handleError(_0x2db305,null));};exports[_0xfc92('0x3e')]=function(_0x2536ce,_0x5bc36a){var _0x2296ed={'raw':!![],'where':{'id':_0x2536ce[_0xfc92('0x3f')]['id']}},_0x3cfd8a={};_0x3cfd8a[_0xfc92('0x2b')]=_['keys'](db[_0xfc92('0x26')][_0xfc92('0x27')]);_0x3cfd8a[_0xfc92('0x2c')]=_[_0xfc92('0x2d')](_0x2536ce[_0xfc92('0x2c')]);_0x3cfd8a[_0xfc92('0x2e')]=_[_0xfc92('0x2f')](_0x3cfd8a['model'],_0x3cfd8a[_0xfc92('0x2c')]);_0x2296ed[_0xfc92('0x31')]=_[_0xfc92('0x2f')](_0x3cfd8a[_0xfc92('0x2b')],qs['fields'](_0x2536ce['query']['fields']));_0x2296ed[_0xfc92('0x31')]=_0x2296ed['attributes'][_0xfc92('0x40')]?_0x2296ed[_0xfc92('0x31')]:_0x3cfd8a[_0xfc92('0x2b')];if(_0x2536ce[_0xfc92('0x2c')][_0xfc92('0x3b')]){_0x2296ed[_0xfc92('0x41')]=[{'all':!![]}];}_0x2296ed=_[_0xfc92('0x38')]({},_0x2296ed,_0x2536ce[_0xfc92('0x3a')]);return db[_0xfc92('0x26')][_0xfc92('0x42')](_0x2296ed)[_0xfc92('0x1f')](handleEntityNotFound(_0x5bc36a,null))[_0xfc92('0x1f')](respondWithResult(_0x5bc36a,null))['catch'](handleError(_0x5bc36a,null));};exports[_0xfc92('0x43')]=function(_0x2a428f,_0x3e2180){return db[_0xfc92('0x26')][_0xfc92('0x43')](_0x2a428f[_0xfc92('0x44')],{})[_0xfc92('0x1f')](respondWithResult(_0x3e2180,0xc9))['catch'](handleError(_0x3e2180,null));};exports[_0xfc92('0x1e')]=function(_0x5bd612,_0x5846d6){if(_0x5bd612[_0xfc92('0x44')]['id']){delete _0x5bd612[_0xfc92('0x44')]['id'];}return db['JscriptySessionReport'][_0xfc92('0x42')]({'where':{'id':_0x5bd612['params']['id']}})[_0xfc92('0x1f')](handleEntityNotFound(_0x5846d6,null))[_0xfc92('0x1f')](saveUpdates(_0x5bd612[_0xfc92('0x44')],null))[_0xfc92('0x1f')](respondWithResult(_0x5846d6,null))[_0xfc92('0x45')](handleError(_0x5846d6,null));};exports[_0xfc92('0x20')]=function(_0x5d3c5f,_0x117ed8){return db[_0xfc92('0x26')][_0xfc92('0x42')]({'where':{'id':_0x5d3c5f['params']['id']}})[_0xfc92('0x1f')](handleEntityNotFound(_0x117ed8,null))[_0xfc92('0x1f')](removeEntity(_0x117ed8,null))[_0xfc92('0x45')](handleError(_0x117ed8,null));};exports[_0xfc92('0x46')]=function(_0x1709b1,_0x4df3b3){return db[_0xfc92('0x26')][_0xfc92('0x46')]()[_0xfc92('0x1f')](respondWithResult(_0x4df3b3,null))['catch'](handleError(_0x4df3b3,null));};exports[_0xfc92('0x47')]=function(_0x2579db,_0x186cf6,_0x26d4cb){var _0x54c1e6={'raw':!![],'where':{}};var _0x19a30f={};var _0x30faed={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x2579db['params']['id']}})['then'](handleEntityNotFound(_0x186cf6,null))['then'](function(_0x5f4dfa){if(_0x5f4dfa){_0x19a30f['model']=_[_0xfc92('0x2d')](db['JscriptyQuestionReport']['rawAttributes']);_0x19a30f[_0xfc92('0x2c')]=_[_0xfc92('0x2d')](_0x2579db['query']);_0x19a30f[_0xfc92('0x2e')]=_[_0xfc92('0x2f')](_0x19a30f[_0xfc92('0x2b')],_0x19a30f['query']);_0x54c1e6['attributes']=_[_0xfc92('0x2f')](_0x19a30f['model'],qs['fields'](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x30')]));_0x54c1e6['attributes']=_0x54c1e6[_0xfc92('0x31')][_0xfc92('0x40')]?_0x54c1e6[_0xfc92('0x31')]:_0x19a30f[_0xfc92('0x2b')];if(!_0x2579db[_0xfc92('0x2c')][_0xfc92('0x32')](_0xfc92('0x33'))){_0x54c1e6['limit']=qs[_0xfc92('0x19')](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x19')]);_0x54c1e6[_0xfc92('0x17')]=qs[_0xfc92('0x17')](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x17')]);}_0x54c1e6['order']=qs[_0xfc92('0x35')](_0x2579db[_0xfc92('0x2c')][_0xfc92('0x35')]);_0x54c1e6[_0xfc92('0x36')]=qs[_0xfc92('0x2e')](_[_0xfc92('0x48')](_0x2579db['query'],_0x19a30f['filters']));_0x54c1e6[_0xfc92('0x36')][_0xfc92('0x49')]=_0x5f4dfa['id'];if(_0x2579db['query']['filter']){_0x54c1e6[_0xfc92('0x36')]=_[_0xfc92('0x38')](_0x54c1e6[_0xfc92('0x36')],{'$or':_[_0xfc92('0x25')](_0x54c1e6['attributes'],function(_0x38e15e){var _0x3eecf5={};_0x3eecf5[_0x38e15e]={'$like':'%'+_0x2579db[_0xfc92('0x2c')][_0xfc92('0x37')]+'%'};return _0x3eecf5;})});}_0x54c1e6=_['merge']({},_0x54c1e6,_0x2579db[_0xfc92('0x3a')]);return db[_0xfc92('0x4a')][_0xfc92('0x1a')]({'where':_0x54c1e6[_0xfc92('0x36')]})[_0xfc92('0x1f')](function(_0x52615d){_0x30faed[_0xfc92('0x1a')]=_0x52615d;if(_0x2579db[_0xfc92('0x2c')]['includeAll']){_0x54c1e6['include']=[{'all':!![]}];}return db[_0xfc92('0x4a')][_0xfc92('0x3c')](_0x54c1e6);})[_0xfc92('0x1f')](function(_0x3c1ac1){_0x30faed[_0xfc92('0x3d')]=_0x3c1ac1;return _0x30faed;});}})['then'](respondWithFilteredResult(_0x186cf6,_0x54c1e6))[_0xfc92('0x45')](handleError(_0x186cf6,null));}; \ No newline at end of file +var _0xa660=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','order','sort','where','pick','VIRTUAL','filter','merge','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','length','options','find','create','body','describe','findOne','hasOwnProperty','nolimit','JscriptyQuestionReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x241246,_0x2937ba){var _0x4d7043=function(_0x393fa6){while(--_0x393fa6){_0x241246['push'](_0x241246['shift']());}};_0x4d7043(++_0x2937ba);}(_0xa660,0x1da));var _0x0a66=function(_0x861c20,_0x9fe326){_0x861c20=_0x861c20-0x0;var _0x5dd24c=_0xa660[_0x861c20];return _0x5dd24c;};'use strict';var emlformat=require(_0x0a66('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a66('0x1'));var jsonpatch=require(_0x0a66('0x2'));var rp=require(_0x0a66('0x3'));var moment=require(_0x0a66('0x4'));var BPromise=require(_0x0a66('0x5'));var Mustache=require(_0x0a66('0x6'));var util=require(_0x0a66('0x7'));var path=require('path');var sox=require(_0x0a66('0x8'));var csv=require(_0x0a66('0x9'));var ejs=require(_0x0a66('0xa'));var fs=require('fs');var fs_extra=require(_0x0a66('0xb'));var _=require(_0x0a66('0xc'));var squel=require('squel');var crypto=require(_0x0a66('0xd'));var jsforce=require(_0x0a66('0xe'));var deskjs=require(_0x0a66('0xf'));var toCsv=require(_0x0a66('0x9'));var querystring=require(_0x0a66('0x10'));var Papa=require(_0x0a66('0x11'));var Redis=require(_0x0a66('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0a66('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a66('0x14'));var logger=require(_0x0a66('0x15'))(_0x0a66('0x16'));var utils=require(_0x0a66('0x17'));var config=require(_0x0a66('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45b216,_0x3f1e1a){_0x3f1e1a=_0x3f1e1a||0xcc;return function(_0x3afff2){if(_0x3afff2){return _0x45b216[_0x0a66('0x19')](_0x3f1e1a);}return _0x45b216[_0x0a66('0x1a')](_0x3f1e1a)['end']();};}function respondWithResult(_0xec2bc,_0x58f5d4){_0x58f5d4=_0x58f5d4||0xc8;return function(_0x35d3ba){if(_0x35d3ba){return _0xec2bc['status'](_0x58f5d4)['json'](_0x35d3ba);}};}function respondWithFilteredResult(_0x301107,_0x4b2a80){return function(_0x31ebe0){if(_0x31ebe0){var _0x47e8d4=typeof _0x4b2a80[_0x0a66('0x1b')]===_0x0a66('0x1c')&&typeof _0x4b2a80[_0x0a66('0x1d')]===_0x0a66('0x1c');var _0x108030=_0x31ebe0[_0x0a66('0x1e')];var _0x1e2cf1=_0x47e8d4?0x0:_0x4b2a80[_0x0a66('0x1b')];var _0x242334=_0x47e8d4?_0x31ebe0[_0x0a66('0x1e')]:_0x4b2a80[_0x0a66('0x1b')]+_0x4b2a80['limit'];var _0x1f227d;if(_0x242334>=_0x108030){_0x242334=_0x108030;_0x1f227d=0xc8;}else{_0x1f227d=0xce;}_0x301107[_0x0a66('0x1a')](_0x1f227d);return _0x301107[_0x0a66('0x1f')](_0x0a66('0x20'),_0x1e2cf1+'-'+_0x242334+'/'+_0x108030)[_0x0a66('0x21')](_0x31ebe0);}return null;};}function patchUpdates(_0x40212d){return function(_0xce4e0d){try{jsonpatch[_0x0a66('0x22')](_0xce4e0d,_0x40212d,!![]);}catch(_0x58cc6d){return BPromise[_0x0a66('0x23')](_0x58cc6d);}return _0xce4e0d[_0x0a66('0x24')]();};}function saveUpdates(_0x22262b,_0xb81b68){return function(_0x24eb2e){if(_0x24eb2e){return _0x24eb2e[_0x0a66('0x25')](_0x22262b)[_0x0a66('0x26')](function(_0x1a4313){return _0x1a4313;});}return null;};}function removeEntity(_0x1bad46,_0x475ed3){return function(_0x31b54f){if(_0x31b54f){return _0x31b54f[_0x0a66('0x27')]()[_0x0a66('0x26')](function(){_0x1bad46[_0x0a66('0x1a')](0xcc)[_0x0a66('0x28')]();});}};}function handleEntityNotFound(_0x75e294,_0x10598f){return function(_0x2acb8e){if(!_0x2acb8e){_0x75e294['sendStatus'](0x194);}return _0x2acb8e;};}function handleError(_0x522b9c,_0xc8a3b8){_0xc8a3b8=_0xc8a3b8||0x1f4;return function(_0x4bc7ee){logger[_0x0a66('0x29')](_0x4bc7ee[_0x0a66('0x2a')]);if(_0x4bc7ee[_0x0a66('0x2b')]){delete _0x4bc7ee[_0x0a66('0x2b')];}_0x522b9c[_0x0a66('0x1a')](_0xc8a3b8)[_0x0a66('0x2c')](_0x4bc7ee);};}exports[_0x0a66('0x2d')]=function(_0x5234aa,_0x1f93bc){var _0x3392c9={},_0xc4a57f={},_0x1e3d69={'count':0x0,'rows':[]};var _0x387c62=_['map'](db['JscriptySessionReport'][_0x0a66('0x2e')],function(_0x2bcad4){return{'name':_0x2bcad4[_0x0a66('0x2f')],'type':_0x2bcad4[_0x0a66('0x30')][_0x0a66('0x31')]};});_0xc4a57f['model']=_[_0x0a66('0x32')](_0x387c62,_0x0a66('0x2b'));_0xc4a57f['query']=_[_0x0a66('0x33')](_0x5234aa[_0x0a66('0x34')]);_0xc4a57f[_0x0a66('0x35')]=_[_0x0a66('0x36')](_0xc4a57f[_0x0a66('0x37')],_0xc4a57f[_0x0a66('0x34')]);_0x3392c9[_0x0a66('0x38')]=_[_0x0a66('0x36')](_0xc4a57f[_0x0a66('0x37')],qs[_0x0a66('0x39')](_0x5234aa[_0x0a66('0x34')][_0x0a66('0x39')]));_0x3392c9[_0x0a66('0x38')]=_0x3392c9[_0x0a66('0x38')]['length']?_0x3392c9[_0x0a66('0x38')]:_0xc4a57f[_0x0a66('0x37')];if(!_0x5234aa[_0x0a66('0x34')]['hasOwnProperty']('nolimit')){_0x3392c9[_0x0a66('0x1d')]=qs['limit'](_0x5234aa[_0x0a66('0x34')][_0x0a66('0x1d')]);_0x3392c9['offset']=qs[_0x0a66('0x1b')](_0x5234aa[_0x0a66('0x34')][_0x0a66('0x1b')]);}_0x3392c9[_0x0a66('0x3a')]=qs[_0x0a66('0x3b')](_0x5234aa['query'][_0x0a66('0x3b')]);_0x3392c9[_0x0a66('0x3c')]=qs[_0x0a66('0x35')](_[_0x0a66('0x3d')](_0x5234aa[_0x0a66('0x34')],_0xc4a57f[_0x0a66('0x35')]),_0x387c62);if(_0x5234aa[_0x0a66('0x34')]['filter']){_0x3392c9[_0x0a66('0x3c')]=_['merge'](_0x3392c9[_0x0a66('0x3c')],{'$or':_[_0x0a66('0x32')](_0x387c62,function(_0x39fe25){if(_0x39fe25[_0x0a66('0x30')]!==_0x0a66('0x3e')){var _0x5b4162={};_0x5b4162[_0x39fe25[_0x0a66('0x2b')]]={'$like':'%'+_0x5234aa[_0x0a66('0x34')][_0x0a66('0x3f')]+'%'};return _0x5b4162;}})});}_0x3392c9=_[_0x0a66('0x40')]({},_0x3392c9,_0x5234aa['options']);var _0x3e6a5d={'where':_0x3392c9['where']};return db[_0x0a66('0x41')]['count'](_0x3e6a5d)[_0x0a66('0x26')](function(_0x4731dc){_0x1e3d69[_0x0a66('0x1e')]=_0x4731dc;if(_0x5234aa['query'][_0x0a66('0x42')]){_0x3392c9[_0x0a66('0x43')]=[{'all':!![]}];}return db[_0x0a66('0x41')][_0x0a66('0x44')](_0x3392c9);})['then'](function(_0x4ffd7b){_0x1e3d69[_0x0a66('0x45')]=_0x4ffd7b;return _0x1e3d69;})[_0x0a66('0x26')](respondWithFilteredResult(_0x1f93bc,_0x3392c9))[_0x0a66('0x46')](handleError(_0x1f93bc,null));};exports['show']=function(_0x35c40e,_0x326620){var _0x1b194b={'raw':!![],'where':{'id':_0x35c40e[_0x0a66('0x47')]['id']}},_0x57d9a8={};_0x57d9a8[_0x0a66('0x37')]=_[_0x0a66('0x33')](db['JscriptySessionReport'][_0x0a66('0x2e')]);_0x57d9a8[_0x0a66('0x34')]=_['keys'](_0x35c40e['query']);_0x57d9a8[_0x0a66('0x35')]=_[_0x0a66('0x36')](_0x57d9a8[_0x0a66('0x37')],_0x57d9a8['query']);_0x1b194b[_0x0a66('0x38')]=_[_0x0a66('0x36')](_0x57d9a8[_0x0a66('0x37')],qs[_0x0a66('0x39')](_0x35c40e[_0x0a66('0x34')]['fields']));_0x1b194b[_0x0a66('0x38')]=_0x1b194b['attributes'][_0x0a66('0x48')]?_0x1b194b[_0x0a66('0x38')]:_0x57d9a8[_0x0a66('0x37')];if(_0x35c40e[_0x0a66('0x34')][_0x0a66('0x42')]){_0x1b194b[_0x0a66('0x43')]=[{'all':!![]}];}_0x1b194b=_[_0x0a66('0x40')]({},_0x1b194b,_0x35c40e[_0x0a66('0x49')]);return db[_0x0a66('0x41')][_0x0a66('0x4a')](_0x1b194b)[_0x0a66('0x26')](handleEntityNotFound(_0x326620,null))[_0x0a66('0x26')](respondWithResult(_0x326620,null))[_0x0a66('0x46')](handleError(_0x326620,null));};exports[_0x0a66('0x4b')]=function(_0x4a5e3f,_0x5467e5){return db[_0x0a66('0x41')]['create'](_0x4a5e3f[_0x0a66('0x4c')],{})['then'](respondWithResult(_0x5467e5,0xc9))['catch'](handleError(_0x5467e5,null));};exports[_0x0a66('0x25')]=function(_0x4144e4,_0x604e2c){if(_0x4144e4[_0x0a66('0x4c')]['id']){delete _0x4144e4[_0x0a66('0x4c')]['id'];}return db[_0x0a66('0x41')][_0x0a66('0x4a')]({'where':{'id':_0x4144e4['params']['id']}})[_0x0a66('0x26')](handleEntityNotFound(_0x604e2c,null))[_0x0a66('0x26')](saveUpdates(_0x4144e4[_0x0a66('0x4c')],null))[_0x0a66('0x26')](respondWithResult(_0x604e2c,null))['catch'](handleError(_0x604e2c,null));};exports[_0x0a66('0x27')]=function(_0x2147ce,_0x45af58){return db[_0x0a66('0x41')][_0x0a66('0x4a')]({'where':{'id':_0x2147ce['params']['id']}})[_0x0a66('0x26')](handleEntityNotFound(_0x45af58,null))[_0x0a66('0x26')](removeEntity(_0x45af58,null))['catch'](handleError(_0x45af58,null));};exports[_0x0a66('0x4d')]=function(_0x3110c0,_0x1ffd29){return db['JscriptySessionReport'][_0x0a66('0x4d')]()[_0x0a66('0x26')](respondWithResult(_0x1ffd29,null))[_0x0a66('0x46')](handleError(_0x1ffd29,null));};exports['getQuestions']=function(_0x2c99f6,_0x4e7e50,_0x319ee8){var _0x3d48a2={'raw':!![],'where':{}};var _0x29e751={};var _0x4de80a={'count':0x0,'rows':[]};return db[_0x0a66('0x41')][_0x0a66('0x4e')]({'where':{'id':_0x2c99f6[_0x0a66('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e7e50,null))['then'](function(_0x2556cc){if(_0x2556cc){_0x29e751[_0x0a66('0x37')]=_['keys'](db['JscriptyQuestionReport'][_0x0a66('0x2e')]);_0x29e751[_0x0a66('0x34')]=_[_0x0a66('0x33')](_0x2c99f6[_0x0a66('0x34')]);_0x29e751[_0x0a66('0x35')]=_[_0x0a66('0x36')](_0x29e751[_0x0a66('0x37')],_0x29e751[_0x0a66('0x34')]);_0x3d48a2[_0x0a66('0x38')]=_['intersection'](_0x29e751[_0x0a66('0x37')],qs[_0x0a66('0x39')](_0x2c99f6[_0x0a66('0x34')][_0x0a66('0x39')]));_0x3d48a2[_0x0a66('0x38')]=_0x3d48a2['attributes'][_0x0a66('0x48')]?_0x3d48a2[_0x0a66('0x38')]:_0x29e751[_0x0a66('0x37')];if(!_0x2c99f6[_0x0a66('0x34')][_0x0a66('0x4f')](_0x0a66('0x50'))){_0x3d48a2[_0x0a66('0x1d')]=qs['limit'](_0x2c99f6[_0x0a66('0x34')]['limit']);_0x3d48a2[_0x0a66('0x1b')]=qs[_0x0a66('0x1b')](_0x2c99f6[_0x0a66('0x34')][_0x0a66('0x1b')]);}_0x3d48a2[_0x0a66('0x3a')]=qs['sort'](_0x2c99f6['query'][_0x0a66('0x3b')]);_0x3d48a2[_0x0a66('0x3c')]=qs['filters'](_[_0x0a66('0x3d')](_0x2c99f6['query'],_0x29e751[_0x0a66('0x35')]));_0x3d48a2[_0x0a66('0x3c')]['SessionId']=_0x2556cc['id'];if(_0x2c99f6[_0x0a66('0x34')][_0x0a66('0x3f')]){_0x3d48a2[_0x0a66('0x3c')]=_[_0x0a66('0x40')](_0x3d48a2[_0x0a66('0x3c')],{'$or':_[_0x0a66('0x32')](_0x3d48a2[_0x0a66('0x38')],function(_0x2b8398){var _0x23e1aa={};_0x23e1aa[_0x2b8398]={'$like':'%'+_0x2c99f6[_0x0a66('0x34')][_0x0a66('0x3f')]+'%'};return _0x23e1aa;})});}_0x3d48a2=_[_0x0a66('0x40')]({},_0x3d48a2,_0x2c99f6[_0x0a66('0x49')]);return db['JscriptyQuestionReport']['count']({'where':_0x3d48a2[_0x0a66('0x3c')]})[_0x0a66('0x26')](function(_0x4ba922){_0x4de80a[_0x0a66('0x1e')]=_0x4ba922;if(_0x2c99f6[_0x0a66('0x34')][_0x0a66('0x42')]){_0x3d48a2[_0x0a66('0x43')]=[{'all':!![]}];}return db[_0x0a66('0x51')]['findAll'](_0x3d48a2);})[_0x0a66('0x26')](function(_0x1ae518){_0x4de80a[_0x0a66('0x45')]=_0x1ae518;return _0x4de80a;});}})['then'](respondWithFilteredResult(_0x4e7e50,_0x3d48a2))[_0x0a66('0x46')](handleError(_0x4e7e50,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 2ebd165..f524232 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x54e0ce,_0xc469c8){var _0x1e6d82=function(_0x557f13){while(--_0x557f13){_0x54e0ce['push'](_0x54e0ce['shift']());}};_0x1e6d82(++_0xc469c8);}(_0x7a54,0x106));var _0x47a5=function(_0x5a0887,_0x1b7763){_0x5a0887=_0x5a0887-0x0;var _0x143447=_0x7a54[_0x5a0887];return _0x143447;};'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 _0x82c4=['JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptySessionReport.attributes','define'];(function(_0x351b1c,_0x2376a1){var _0x14afcb=function(_0x127288){while(--_0x127288){_0x351b1c['push'](_0x351b1c['shift']());}};_0x14afcb(++_0x2376a1);}(_0x82c4,0x1ca));var _0x482c=function(_0x35f58d,_0x56c821){_0x35f58d=_0x35f58d-0x0;var _0xbca79b=_0x82c4[_0x35f58d];return _0xbca79b;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var logger=require(_0x482c('0x2'))(_0x482c('0x3'));var moment=require(_0x482c('0x4'));var BPromise=require(_0x482c('0x5'));var rp=require(_0x482c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x482c('0x7'));var config=require('../../config/environment');var attributes=require(_0x482c('0x8'));module['exports']=function(_0x477cf4,_0x5d7c76){return _0x477cf4[_0x482c('0x9')](_0x482c('0xa'),attributes,{'tableName':_0x482c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 8888997..3668093 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 _0x0424=['request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x0424,0x159));var _0x4042=function(_0xa72345,_0x1fd304){_0xa72345=_0xa72345-0x0;var _0xbc82fb=_0x0424[_0xa72345];return _0xbc82fb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4042('0x0'));var BPromise=require(_0x4042('0x1'));var rs=require(_0x4042('0x2'));var fs=require('fs');var Redis=require(_0x4042('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4042('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x4042('0x5'));var jayson=require(_0x4042('0x6'));var client=jayson[_0x4042('0x7')][_0x4042('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3abaf1,_0xa5310f,_0x10ec07){return new BPromise(function(_0x5d11bf,_0x509772){return client[_0x4042('0x9')](_0x3abaf1,_0x10ec07)[_0x4042('0xa')](function(_0x103e4a){logger['info'](_0x4042('0xb'),_0xa5310f,_0x4042('0xc'));logger[_0x4042('0xd')](_0x4042('0xe'),_0xa5310f,_0x4042('0xc'),JSON[_0x4042('0xf')](_0x103e4a));if(_0x103e4a[_0x4042('0x10')]){if(_0x103e4a[_0x4042('0x10')]['code']===0x1f4){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a['error'][_0x4042('0x11')]);return _0x509772(_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);}logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x103e4a[_0x4042('0x10')][_0x4042('0x11')]);return _0x5d11bf(_0x103e4a['error'][_0x4042('0x11')]);}else{logger[_0x4042('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0xa5310f,_0x4042('0xc'));_0x5d11bf(_0x103e4a[_0x4042('0x13')][_0x4042('0x11')]);}})[_0x4042('0x14')](function(_0x31e765){logger[_0x4042('0x10')](_0x4042('0xb'),_0xa5310f,_0x31e765);_0x509772(_0x31e765);});});} \ No newline at end of file +var _0x2a07=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x55257e,_0x216a26){var _0x1bba19=function(_0x58fe93){while(--_0x58fe93){_0x55257e['push'](_0x55257e['shift']());}};_0x1bba19(++_0x216a26);}(_0x2a07,0x74));var _0x72a0=function(_0x32ee50,_0x564493){_0x32ee50=_0x32ee50-0x0;var _0x12a1b3=_0x2a07[_0x32ee50];return _0x12a1b3;};'use strict';var _=require(_0x72a0('0x0'));var util=require(_0x72a0('0x1'));var moment=require(_0x72a0('0x2'));var BPromise=require(_0x72a0('0x3'));var rs=require(_0x72a0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72a0('0x5'))['db'];var utils=require(_0x72a0('0x6'));var logger=require(_0x72a0('0x7'))(_0x72a0('0x8'));var config=require(_0x72a0('0x9'));var jayson=require(_0x72a0('0xa'));var client=jayson[_0x72a0('0xb')][_0x72a0('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x193e3b,_0x287b06,_0x21c819){return new BPromise(function(_0x2c04eb,_0x22270e){return client[_0x72a0('0xd')](_0x193e3b,_0x21c819)[_0x72a0('0xe')](function(_0x2bc45b){logger['info'](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));logger['debug'](_0x72a0('0x11'),_0x287b06,_0x72a0('0x10'),JSON[_0x72a0('0x12')](_0x2bc45b));if(_0x2bc45b[_0x72a0('0x13')]){if(_0x2bc45b[_0x72a0('0x13')]['code']===0x1f4){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);return _0x22270e(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}logger[_0x72a0('0x13')]('JscriptySessionReport,\x20%s,\x20%s',_0x287b06,_0x2bc45b['error'][_0x72a0('0x14')]);return _0x2c04eb(_0x2bc45b[_0x72a0('0x13')][_0x72a0('0x14')]);}else{logger[_0x72a0('0x15')](_0x72a0('0xf'),_0x287b06,_0x72a0('0x10'));_0x2c04eb(_0x2bc45b['result'][_0x72a0('0x14')]);}})[_0x72a0('0x16')](function(_0x16ac70){logger[_0x72a0('0x13')](_0x72a0('0xf'),_0x287b06,_0x16ac70);_0x22270e(_0x16ac70);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index d70daec..c6c5be5 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 _0xd81e=['../../components/auth/service','../../components/interaction/service','get','index','put','/:id','update','/download_log_file','exports','util','path','express','Router'];(function(_0x291a6f,_0x30087e){var _0x2a7921=function(_0x2d2f5b){while(--_0x2d2f5b){_0x291a6f['push'](_0x291a6f['shift']());}};_0x2a7921(++_0x30087e);}(_0xd81e,0x11a));var _0xed81=function(_0x513af4,_0x221bfe){_0x513af4=_0x513af4-0x0;var _0x1da002=_0xd81e[_0x513af4];return _0x1da002;};'use strict';var multer=require('multer');var util=require(_0xed81('0x0'));var path=require(_0xed81('0x1'));var timeout=require('connect-timeout');var express=require(_0xed81('0x2'));var router=express[_0xed81('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xed81('0x4'));var interaction=require(_0xed81('0x5'));var config=require('../../config/environment');var controller=require('./license.controller');router[_0xed81('0x6')]('/',controller[_0xed81('0x7')]);router[_0xed81('0x8')](_0xed81('0x9'),auth['isAuthenticated'](),controller[_0xed81('0xa')]);router[_0xed81('0x6')](_0xed81('0xb'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0xed81('0xc')]=router; \ No newline at end of file +var _0x9494=['fs-extra','../../components/interaction/service','./license.controller','get','put','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','exports','util','express','Router'];(function(_0x2c463d,_0xabbd02){var _0x1c011d=function(_0x16a000){while(--_0x16a000){_0x2c463d['push'](_0x2c463d['shift']());}};_0x1c011d(++_0xabbd02);}(_0x9494,0xcf));var _0x4949=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9494[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x4949('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4949('0x1'));var router=express[_0x4949('0x2')]();var fs_extra=require(_0x4949('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4949('0x4'));var config=require('../../config/environment');var controller=require(_0x4949('0x5'));router[_0x4949('0x6')]('/',controller['index']);router[_0x4949('0x7')](_0x4949('0x8'),auth[_0x4949('0x9')](),controller[_0x4949('0xa')]);router[_0x4949('0x6')](_0x4949('0xb'),auth['isAuthenticated'](),controller[_0x4949('0xc')]);module[_0x4949('0xd')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 1f2f2d3..e52103f 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 _0x1407=['exports','TEXT','STRING','INTEGER'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x1407,0x1c0));var _0x7140=function(_0x169b7a,_0xccd19){_0x169b7a=_0x169b7a-0x0;var _0x37e2e5=_0x1407[_0x169b7a];return _0x37e2e5;};'use strict';var Sequelize=require('sequelize');module[_0x7140('0x0')]={'license':{'type':Sequelize[_0x7140('0x1')]},'data1':{'type':Sequelize[_0x7140('0x2')]},'data2':{'type':Sequelize[_0x7140('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x7140('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xabab=['TEXT','STRING','sequelize','exports'];(function(_0x2ab107,_0x57b6da){var _0x713d36=function(_0x29941e){while(--_0x29941e){_0x2ab107['push'](_0x2ab107['shift']());}};_0x713d36(++_0x57b6da);}(_0xabab,0x1be));var _0xbaba=function(_0x3d02b2,_0x46a45f){_0x3d02b2=_0x3d02b2-0x0;var _0x2aa16e=_0xabab[_0x3d02b2];return _0x2aa16e;};'use strict';var Sequelize=require(_0xbaba('0x0'));module[_0xbaba('0x1')]={'license':{'type':Sequelize[_0xbaba('0x2')]},'data1':{'type':Sequelize[_0xbaba('0x3')]},'data2':{'type':Sequelize[_0xbaba('0x3')]},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 3dc37c5..0dac773 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 _0x206d=['intersection','model','attributes','fields','length','merge','getLicense','catch','body','find','params','get','demo','downloadLogFile','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','download','eml-format','zip-dir','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','License','rawAttributes','keys','query','filters'];(function(_0xb39b52,_0xf60442){var _0x1051bd=function(_0x54bad6){while(--_0x54bad6){_0xb39b52['push'](_0xb39b52['shift']());}};_0x1051bd(++_0xf60442);}(_0x206d,0x1e5));var _0xd206=function(_0x21c170,_0x5684b8){_0x21c170=_0x21c170-0x0;var _0x1d2b6d=_0x206d[_0x21c170];return _0x1d2b6d;};'use strict';var emlformat=require(_0xd206('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd206('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd206('0x2'));var BPromise=require(_0xd206('0x3'));var Mustache=require('mustache');var util=require(_0xd206('0x4'));var path=require(_0xd206('0x5'));var sox=require('sox');var csv=require(_0xd206('0x6'));var ejs=require(_0xd206('0x7'));var fs=require('fs');var fs_extra=require(_0xd206('0x8'));var _=require('lodash');var squel=require(_0xd206('0x9'));var crypto=require(_0xd206('0xa'));var jsforce=require(_0xd206('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd206('0x6'));var querystring=require(_0xd206('0xc'));var Papa=require('papaparse');var Redis=require(_0xd206('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd206('0xe'));var logger=require(_0xd206('0xf'))(_0xd206('0x10'));var utils=require(_0xd206('0x11'));var config=require(_0xd206('0x12'));var licenseUtil=require(_0xd206('0x13'));var db=require(_0xd206('0x14'))['db'];function respondWithStatusCode(_0x1f368a,_0x1092ca){_0x1092ca=_0x1092ca||0xcc;return function(_0x374d9c){if(_0x374d9c){return _0x1f368a[_0xd206('0x15')](_0x1092ca);}return _0x1f368a[_0xd206('0x16')](_0x1092ca)[_0xd206('0x17')]();};}function respondWithResult(_0x58145a,_0x3d1953){_0x3d1953=_0x3d1953||0xc8;return function(_0x5389c0){if(_0x5389c0){return _0x58145a[_0xd206('0x16')](_0x3d1953)[_0xd206('0x18')](_0x5389c0);}};}function respondWithFilteredResult(_0xeba083,_0x2b53a3){return function(_0x1d8094){if(_0x1d8094){var _0x2c045b=typeof _0x2b53a3[_0xd206('0x19')]===_0xd206('0x1a')&&typeof _0x2b53a3[_0xd206('0x1b')]===_0xd206('0x1a');var _0x37c1c2=_0x1d8094['count'];var _0x209470=_0x2c045b?0x0:_0x2b53a3[_0xd206('0x19')];var _0x560a35=_0x2c045b?_0x1d8094[_0xd206('0x1c')]:_0x2b53a3[_0xd206('0x19')]+_0x2b53a3[_0xd206('0x1b')];var _0x5af916;if(_0x560a35>=_0x37c1c2){_0x560a35=_0x37c1c2;_0x5af916=0xc8;}else{_0x5af916=0xce;}_0xeba083[_0xd206('0x16')](_0x5af916);return _0xeba083['set']('Content-Range',_0x209470+'-'+_0x560a35+'/'+_0x37c1c2)['json'](_0x1d8094);}return null;};}function patchUpdates(_0x46df5){return function(_0x2e014e){try{jsonpatch[_0xd206('0x1d')](_0x2e014e,_0x46df5,!![]);}catch(_0x4f02f4){return BPromise['reject'](_0x4f02f4);}return _0x2e014e[_0xd206('0x1e')]();};}function saveUpdates(_0x445952,_0x54a8f1){return function(_0x507ce5){if(_0x507ce5){return _0x507ce5[_0xd206('0x1f')](_0x445952)[_0xd206('0x20')](function(_0x1db21b){return _0x1db21b;});}return null;};}function removeEntity(_0x3a5ea0,_0x1e86e0){return function(_0x59e43f){if(_0x59e43f){return _0x59e43f[_0xd206('0x21')]()['then'](function(){_0x3a5ea0[_0xd206('0x16')](0xcc)[_0xd206('0x17')]();});}};}function handleEntityNotFound(_0x1b244e,_0x10df7c){return function(_0x3221a2){if(!_0x3221a2){_0x1b244e[_0xd206('0x15')](0x194);}return _0x3221a2;};}function handleError(_0x255291,_0x3f36dc){_0x3f36dc=_0x3f36dc||0x1f4;return function(_0x4cd053){logger[_0xd206('0x22')](_0x4cd053[_0xd206('0x23')]);if(_0x4cd053['name']){delete _0x4cd053[_0xd206('0x24')];}_0x255291['status'](_0x3f36dc)[_0xd206('0x25')](_0x4cd053);};}var utilLicense=require(_0xd206('0x13'));exports['index']=function(_0x8fc4cb,_0x3dafb0){var _0x32f91e={'raw':!![],'where':{'id':0x1}},_0x258ad8={};_0x258ad8['model']=_['keys'](db[_0xd206('0x26')][_0xd206('0x27')]);_0x258ad8['query']=_[_0xd206('0x28')](_0x8fc4cb[_0xd206('0x29')]);_0x258ad8[_0xd206('0x2a')]=_[_0xd206('0x2b')](_0x258ad8[_0xd206('0x2c')],_0x258ad8[_0xd206('0x29')]);_0x32f91e[_0xd206('0x2d')]=_['intersection'](_0x258ad8['model'],qs[_0xd206('0x2e')](_0x8fc4cb[_0xd206('0x29')][_0xd206('0x2e')]));_0x32f91e[_0xd206('0x2d')]=_0x32f91e[_0xd206('0x2d')][_0xd206('0x2f')]?_0x32f91e[_0xd206('0x2d')]:_0x258ad8['model'];_0x32f91e=_[_0xd206('0x30')]({},_0x32f91e,_0x8fc4cb['options']);return utilLicense[_0xd206('0x31')](_0x32f91e)[_0xd206('0x20')](respondWithResult(_0x3dafb0,null))[_0xd206('0x32')](handleError(_0x3dafb0,null));};exports['update']=function(_0x2fc300,_0x3401b0){if(_0x2fc300[_0xd206('0x33')]['id']){delete _0x2fc300[_0xd206('0x33')]['id'];}return db['License'][_0xd206('0x34')]({'where':{'id':_0x2fc300[_0xd206('0x35')]['id']}})['then'](handleEntityNotFound(_0x3401b0,null))[_0xd206('0x20')](function(_0x1cb469){var _0x5dc135=_0x1cb469[_0xd206('0x36')]({'plain':!![]});return utilLicense['checkLicense'](_0x5dc135,_0x2fc300['body']['key']);})[_0xd206('0x20')](function(_0x3fd95e){if(!_0x3fd95e[_0xd206('0x37')]){return saveUpdates(_0x2fc300['body'],null);}return _0x3fd95e;})[_0xd206('0x20')](respondWithResult(_0x3401b0,null))[_0xd206('0x32')](handleError(_0x3401b0,null));};exports[_0xd206('0x38')]=function(_0x59a682,_0x3d86ea){var _0x3e8fb7=_0xd206('0x39');var _0x2ce300=path[_0xd206('0x3a')]('/var',_0xd206('0x3b'),_0xd206('0x3c'),_0x3e8fb7);_0x3d86ea['setHeader'](_0xd206('0x3d'),_0xd206('0x3e')+_0x3e8fb7);_0x3d86ea[_0xd206('0x3f')](_0xd206('0x40'),'text/plain');_0x3d86ea[_0xd206('0x41')](_0x2ce300);}; \ No newline at end of file +var _0xcc7a=['text/plain','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','then','error','name','send','index','keys','License','rawAttributes','query','filters','intersection','attributes','model','fields','length','options','getLicense','body','find','params','get','checkLicense','key','demo','catch','downloadLogFile','join','/var','log','setHeader','Content-disposition','attachment;\x20filename=','set','Content-Type'];(function(_0x644bf5,_0x2e227e){var _0x1712ce=function(_0x3ac93d){while(--_0x3ac93d){_0x644bf5['push'](_0x644bf5['shift']());}};_0x1712ce(++_0x2e227e);}(_0xcc7a,0xd0));var _0xacc7=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0xcc7a[_0x3740fe];return _0x55492b;};'use strict';var emlformat=require(_0xacc7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xacc7('0x1'));var jsonpatch=require(_0xacc7('0x2'));var rp=require(_0xacc7('0x3'));var moment=require(_0xacc7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xacc7('0x5'));var path=require(_0xacc7('0x6'));var sox=require(_0xacc7('0x7'));var csv=require(_0xacc7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xacc7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xacc7('0xa'));var deskjs=require(_0xacc7('0xb'));var toCsv=require('to-csv');var querystring=require(_0xacc7('0xc'));var Papa=require('papaparse');var Redis=require(_0xacc7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xacc7('0xe'));var as=require(_0xacc7('0xf'));var hardwareService=require(_0xacc7('0x10'));var logger=require(_0xacc7('0x11'))(_0xacc7('0x12'));var utils=require(_0xacc7('0x13'));var config=require(_0xacc7('0x14'));var licenseUtil=require(_0xacc7('0x15'));var db=require(_0xacc7('0x16'))['db'];function respondWithStatusCode(_0x47455b,_0xac0c35){_0xac0c35=_0xac0c35||0xcc;return function(_0x22f08e){if(_0x22f08e){return _0x47455b[_0xacc7('0x17')](_0xac0c35);}return _0x47455b[_0xacc7('0x18')](_0xac0c35)[_0xacc7('0x19')]();};}function respondWithResult(_0x3b8748,_0x4688f6){_0x4688f6=_0x4688f6||0xc8;return function(_0x5d794c){if(_0x5d794c){return _0x3b8748['status'](_0x4688f6)[_0xacc7('0x1a')](_0x5d794c);}};}function respondWithFilteredResult(_0xad3937,_0x39abdf){return function(_0x5f042f){if(_0x5f042f){var _0x1bebc8=typeof _0x39abdf[_0xacc7('0x1b')]===_0xacc7('0x1c')&&typeof _0x39abdf[_0xacc7('0x1d')]===_0xacc7('0x1c');var _0x7f2e46=_0x5f042f[_0xacc7('0x1e')];var _0x536117=_0x1bebc8?0x0:_0x39abdf[_0xacc7('0x1b')];var _0x36c5aa=_0x1bebc8?_0x5f042f[_0xacc7('0x1e')]:_0x39abdf[_0xacc7('0x1b')]+_0x39abdf[_0xacc7('0x1d')];var _0x5f0a1d;if(_0x36c5aa>=_0x7f2e46){_0x36c5aa=_0x7f2e46;_0x5f0a1d=0xc8;}else{_0x5f0a1d=0xce;}_0xad3937[_0xacc7('0x18')](_0x5f0a1d);return _0xad3937['set']('Content-Range',_0x536117+'-'+_0x36c5aa+'/'+_0x7f2e46)[_0xacc7('0x1a')](_0x5f042f);}return null;};}function patchUpdates(_0x6b9101){return function(_0x20ad57){try{jsonpatch[_0xacc7('0x1f')](_0x20ad57,_0x6b9101,!![]);}catch(_0x32909f){return BPromise['reject'](_0x32909f);}return _0x20ad57[_0xacc7('0x20')]();};}function saveUpdates(_0x57f5d3,_0xd4b94d){return function(_0x80723e){if(_0x80723e){return _0x80723e[_0xacc7('0x21')](_0x57f5d3)[_0xacc7('0x22')](function(_0x1bfa71){return _0x1bfa71;});}return null;};}function removeEntity(_0x2f0578,_0x5ea02d){return function(_0x241188){if(_0x241188){return _0x241188['destroy']()[_0xacc7('0x22')](function(){_0x2f0578[_0xacc7('0x18')](0xcc)[_0xacc7('0x19')]();});}};}function handleEntityNotFound(_0x34c1d3,_0x152179){return function(_0x72df4c){if(!_0x72df4c){_0x34c1d3['sendStatus'](0x194);}return _0x72df4c;};}function handleError(_0x48b676,_0x4349c2){_0x4349c2=_0x4349c2||0x1f4;return function(_0x227440){logger[_0xacc7('0x23')](_0x227440['stack']);if(_0x227440['name']){delete _0x227440[_0xacc7('0x24')];}_0x48b676[_0xacc7('0x18')](_0x4349c2)[_0xacc7('0x25')](_0x227440);};}var utilLicense=require('../../config/license/util');exports[_0xacc7('0x26')]=function(_0x15df86,_0x382dae){var _0x3eefa7={'raw':!![],'where':{'id':0x1}},_0x1c4710={};_0x1c4710['model']=_[_0xacc7('0x27')](db[_0xacc7('0x28')][_0xacc7('0x29')]);_0x1c4710[_0xacc7('0x2a')]=_[_0xacc7('0x27')](_0x15df86[_0xacc7('0x2a')]);_0x1c4710[_0xacc7('0x2b')]=_[_0xacc7('0x2c')](_0x1c4710['model'],_0x1c4710[_0xacc7('0x2a')]);_0x3eefa7[_0xacc7('0x2d')]=_[_0xacc7('0x2c')](_0x1c4710[_0xacc7('0x2e')],qs[_0xacc7('0x2f')](_0x15df86[_0xacc7('0x2a')]['fields']));_0x3eefa7[_0xacc7('0x2d')]=_0x3eefa7['attributes'][_0xacc7('0x30')]?_0x3eefa7['attributes']:_0x1c4710[_0xacc7('0x2e')];_0x3eefa7=_['merge']({},_0x3eefa7,_0x15df86[_0xacc7('0x31')]);return utilLicense[_0xacc7('0x32')](_0x3eefa7)['then'](respondWithResult(_0x382dae,null))['catch'](handleError(_0x382dae,null));};exports['update']=function(_0x4e8d18,_0x46ab80){if(_0x4e8d18[_0xacc7('0x33')]['id']){delete _0x4e8d18['body']['id'];}return db[_0xacc7('0x28')][_0xacc7('0x34')]({'where':{'id':_0x4e8d18[_0xacc7('0x35')]['id']}})[_0xacc7('0x22')](handleEntityNotFound(_0x46ab80,null))[_0xacc7('0x22')](function(_0xcce491){var _0x37a67f=_0xcce491[_0xacc7('0x36')]({'plain':!![]});return utilLicense[_0xacc7('0x37')](_0x37a67f,_0x4e8d18['body'][_0xacc7('0x38')]);})['then'](function(_0x14d67a){if(!_0x14d67a[_0xacc7('0x39')]){return saveUpdates(_0x4e8d18[_0xacc7('0x33')],null);}return _0x14d67a;})[_0xacc7('0x22')](respondWithResult(_0x46ab80,null))[_0xacc7('0x3a')](handleError(_0x46ab80,null));};exports[_0xacc7('0x3b')]=function(_0x39e51a,_0x282307){var _0x492fb6='license-info.log';var _0x5ae52a=path[_0xacc7('0x3c')](_0xacc7('0x3d'),_0xacc7('0x3e'),'xcally',_0x492fb6);_0x282307[_0xacc7('0x3f')](_0xacc7('0x40'),_0xacc7('0x41')+_0x492fb6);_0x282307[_0xacc7('0x42')](_0xacc7('0x43'),_0xacc7('0x44'));_0x282307['download'](_0x5ae52a);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index d064bcb..94d5481 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 _0x80fa=['License','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define'];(function(_0x47bb05,_0x43aa27){var _0x4a33f0=function(_0x212620){while(--_0x212620){_0x47bb05['push'](_0x47bb05['shift']());}};_0x4a33f0(++_0x43aa27);}(_0x80fa,0xf8));var _0xa80f=function(_0x5d8d2b,_0x4f1fc9){_0x5d8d2b=_0x5d8d2b-0x0;var _0x134489=_0x80fa[_0x5d8d2b];return _0x134489;};'use strict';var _=require(_0xa80f('0x0'));var util=require('util');var logger=require(_0xa80f('0x1'))(_0xa80f('0x2'));var moment=require(_0xa80f('0x3'));var BPromise=require(_0xa80f('0x4'));var rp=require(_0xa80f('0x5'));var fs=require('fs');var path=require(_0xa80f('0x6'));var rimraf=require(_0xa80f('0x7'));var config=require(_0xa80f('0x8'));var attributes=require(_0xa80f('0x9'));module[_0xa80f('0xa')]=function(_0x21b20d,_0x142917){return _0x21b20d[_0xa80f('0xb')](_0xa80f('0xc'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6483=['exports','define','license','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./license.attributes'];(function(_0x1b25fa,_0x5be39a){var _0x1e11e4=function(_0x4894c9){while(--_0x4894c9){_0x1b25fa['push'](_0x1b25fa['shift']());}};_0x1e11e4(++_0x5be39a);}(_0x6483,0x184));var _0x3648=function(_0x19d74c,_0x472537){_0x19d74c=_0x19d74c-0x0;var _0x55c5e1=_0x6483[_0x19d74c];return _0x55c5e1;};'use strict';var _=require('lodash');var util=require(_0x3648('0x0'));var logger=require(_0x3648('0x1'))('api');var moment=require(_0x3648('0x2'));var BPromise=require(_0x3648('0x3'));var rp=require(_0x3648('0x4'));var fs=require('fs');var path=require(_0x3648('0x5'));var rimraf=require(_0x3648('0x6'));var config=require('../../config/environment');var attributes=require(_0x3648('0x7'));module[_0x3648('0x8')]=function(_0xf91671,_0x59d7f9){return _0xf91671[_0x3648('0x9')]('License',attributes,{'tableName':_0x3648('0xa'),'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 e01b31a..122bbe3 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 _0xb8d3=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','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'];(function(_0x3185a0,_0x4ac61a){var _0x15260e=function(_0x46b5b4){while(--_0x46b5b4){_0x3185a0['push'](_0x3185a0['shift']());}};_0x15260e(++_0x4ac61a);}(_0xb8d3,0x7a));var _0x3b8d=function(_0x20c59f,_0x583d0a){_0x20c59f=_0x20c59f-0x0;var _0x2b6df8=_0xb8d3[_0x20c59f];return _0x2b6df8;};'use strict';var _=require(_0x3b8d('0x0'));var util=require(_0x3b8d('0x1'));var moment=require(_0x3b8d('0x2'));var BPromise=require(_0x3b8d('0x3'));var rs=require(_0x3b8d('0x4'));var fs=require('fs');var Redis=require(_0x3b8d('0x5'));var db=require(_0x3b8d('0x6'))['db'];var utils=require(_0x3b8d('0x7'));var logger=require('../../config/logger')(_0x3b8d('0x8'));var config=require('../../config/environment');var jayson=require(_0x3b8d('0x9'));var client=jayson[_0x3b8d('0xa')][_0x3b8d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x132efc,_0x113d36,_0x22f541){return new BPromise(function(_0x4129a2,_0x152276){return client[_0x3b8d('0xc')](_0x132efc,_0x22f541)[_0x3b8d('0xd')](function(_0x477d80){logger[_0x3b8d('0xe')](_0x3b8d('0xf'),_0x113d36,_0x3b8d('0x10'));logger[_0x3b8d('0x11')](_0x3b8d('0x12'),_0x113d36,'request\x20sent',JSON[_0x3b8d('0x13')](_0x477d80));if(_0x477d80[_0x3b8d('0x14')]){if(_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x15')]===0x1f4){logger[_0x3b8d('0x14')](_0x3b8d('0xf'),_0x113d36,_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x16')]);return _0x152276(_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x16')]);}logger[_0x3b8d('0x14')](_0x3b8d('0xf'),_0x113d36,_0x477d80[_0x3b8d('0x14')]['message']);return _0x4129a2(_0x477d80[_0x3b8d('0x14')][_0x3b8d('0x16')]);}else{logger[_0x3b8d('0xe')](_0x3b8d('0xf'),_0x113d36,_0x3b8d('0x10'));_0x4129a2(_0x477d80[_0x3b8d('0x17')]['message']);}})[_0x3b8d('0x18')](function(_0x152e4d){logger[_0x3b8d('0x14')](_0x3b8d('0xf'),_0x113d36,_0x152e4d);_0x152276(_0x152e4d);});});} \ No newline at end of file +var _0x4835=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x2e374a,_0x31294f){var _0x4a5a04=function(_0x3c93d2){while(--_0x3c93d2){_0x2e374a['push'](_0x2e374a['shift']());}};_0x4a5a04(++_0x31294f);}(_0x4835,0x150));var _0x5483=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x4835[_0x37ffea];return _0x2e2615;};'use strict';var _=require('lodash');var util=require(_0x5483('0x0'));var moment=require(_0x5483('0x1'));var BPromise=require(_0x5483('0x2'));var rs=require(_0x5483('0x3'));var fs=require('fs');var Redis=require(_0x5483('0x4'));var db=require(_0x5483('0x5'))['db'];var utils=require(_0x5483('0x6'));var logger=require(_0x5483('0x7'))(_0x5483('0x8'));var config=require('../../config/environment');var jayson=require(_0x5483('0x9'));var client=jayson[_0x5483('0xa')][_0x5483('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2330a6,_0x174d44,_0xe3ed31){return new BPromise(function(_0x541407,_0x283054){return client[_0x5483('0xc')](_0x2330a6,_0xe3ed31)[_0x5483('0xd')](function(_0x5c87fe){logger[_0x5483('0xe')](_0x5483('0xf'),_0x174d44,_0x5483('0x10'));logger['debug'](_0x5483('0x11'),_0x174d44,_0x5483('0x10'),JSON[_0x5483('0x12')](_0x5c87fe));if(_0x5c87fe[_0x5483('0x13')]){if(_0x5c87fe['error'][_0x5483('0x14')]===0x1f4){logger[_0x5483('0x13')]('License,\x20%s,\x20%s',_0x174d44,_0x5c87fe[_0x5483('0x13')][_0x5483('0x15')]);return _0x283054(_0x5c87fe['error'][_0x5483('0x15')]);}logger[_0x5483('0x13')](_0x5483('0xf'),_0x174d44,_0x5c87fe['error'][_0x5483('0x15')]);return _0x541407(_0x5c87fe[_0x5483('0x13')][_0x5483('0x15')]);}else{logger['info'](_0x5483('0xf'),_0x174d44,'request\x20sent');_0x541407(_0x5c87fe[_0x5483('0x16')][_0x5483('0x15')]);}})[_0x5483('0x17')](function(_0x1d51d4){logger['error'](_0x5483('0xf'),_0x174d44,_0x1d51d4);_0x283054(_0x1d51d4);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2da7147..3b5dcbe 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 _0x416c=['post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','/:id/applications','send','addAgents','put','update','/:id/dispositions','delete','removeSmtp','destroy','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','/:id/users','getAgents'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x416c,0x1b0));var _0xc416=function(_0x2bc837,_0x2c4ad5){_0x2bc837=_0x2bc837-0x0;var _0x50b3a3=_0x416c[_0x2bc837];return _0x50b3a3;};'use strict';var multer=require(_0xc416('0x0'));var util=require(_0xc416('0x1'));var path=require(_0xc416('0x2'));var timeout=require('connect-timeout');var express=require(_0xc416('0x3'));var router=express['Router']();var fs_extra=require(_0xc416('0x4'));var auth=require(_0xc416('0x5'));var interaction=require(_0xc416('0x6'));var config=require(_0xc416('0x7'));var controller=require(_0xc416('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xc416('0x9')]);router[_0xc416('0xa')](_0xc416('0xb'),auth[_0xc416('0xc')](),controller[_0xc416('0xd')]);router['get'](_0xc416('0xe'),auth[_0xc416('0xc')](),controller['show']);router[_0xc416('0xa')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xc416('0xf')]);router['get']('/:id/canned_answers',auth[_0xc416('0xc')](),controller[_0xc416('0x10')]);router[_0xc416('0xa')](_0xc416('0x11'),auth[_0xc416('0xc')](),controller[_0xc416('0x12')]);router[_0xc416('0xa')](_0xc416('0x13'),auth[_0xc416('0xc')](),controller[_0xc416('0x14')]);router['get'](_0xc416('0x15'),auth['isAuthenticated'](),controller[_0xc416('0x16')]);router['get']('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xc416('0xa')](_0xc416('0x17'),auth['isAuthenticated'](),controller[_0xc416('0x18')]);router[_0xc416('0xa')](_0xc416('0x19'),auth[_0xc416('0xc')](),controller['verifySmtp']);router[_0xc416('0xa')](_0xc416('0x1a'),auth['isAuthenticated'](),controller[_0xc416('0x1b')]);router[_0xc416('0x1c')]('/:id/dispositions',auth[_0xc416('0xc')](),controller[_0xc416('0x1d')]);router['post'](_0xc416('0x1e'),auth[_0xc416('0xc')](),controller[_0xc416('0x1f')]);router['post']('/',auth[_0xc416('0xc')](),controller[_0xc416('0x20')]);router[_0xc416('0x1c')](_0xc416('0x11'),auth[_0xc416('0xc')](),controller['addImap']);router['post'](_0xc416('0x13'),auth[_0xc416('0xc')](),controller[_0xc416('0x21')]);router['post']('/:id/interactions',auth[_0xc416('0xc')](),controller[_0xc416('0x22')]);router[_0xc416('0x1c')](_0xc416('0x23'),auth[_0xc416('0xc')](),controller['addApplications']);router['post']('/:id/send',auth[_0xc416('0xc')](),controller[_0xc416('0x24')]);router['post']('/:id/users',auth[_0xc416('0xc')](),controller[_0xc416('0x25')]);router[_0xc416('0x26')](_0xc416('0xe'),auth[_0xc416('0xc')](),controller[_0xc416('0x27')]);router['delete'](_0xc416('0x28'),auth[_0xc416('0xc')](),controller['removeDispositions']);router[_0xc416('0x29')](_0xc416('0x1e'),auth[_0xc416('0xc')](),controller['removeAnswers']);router[_0xc416('0x29')]('/:id/in_servers',auth[_0xc416('0xc')](),controller['removeImap']);router['delete'](_0xc416('0x13'),auth[_0xc416('0xc')](),controller[_0xc416('0x2a')]);router['delete']('/:id',auth[_0xc416('0xc')](),controller[_0xc416('0x2b')]);router[_0xc416('0x29')](_0xc416('0x1a'),auth[_0xc416('0xc')](),controller[_0xc416('0x2c')]);module[_0xc416('0x2d')]=router; \ No newline at end of file +var _0x1b73=['show','getDispositions','/:id/in_servers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','/:id/canned_answers','addAnswer','create','addImap','/:id/out_servers','addSmtp','addApplications','/:id/send','put','update','/:id/dispositions','removeDispositions','delete','removeImap','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x47a133,_0x45df69){var _0x363fc2=function(_0x425347){while(--_0x425347){_0x47a133['push'](_0x47a133['shift']());}};_0x363fc2(++_0x45df69);}(_0x1b73,0x143));var _0x31b7=function(_0x320f7b,_0x417868){_0x320f7b=_0x320f7b-0x0;var _0x9539ff=_0x1b73[_0x320f7b];return _0x9539ff;};'use strict';var multer=require(_0x31b7('0x0'));var util=require(_0x31b7('0x1'));var path=require(_0x31b7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x31b7('0x3')]();var fs_extra=require(_0x31b7('0x4'));var auth=require(_0x31b7('0x5'));var interaction=require(_0x31b7('0x6'));var config=require(_0x31b7('0x7'));var controller=require('./mailAccount.controller');router[_0x31b7('0x8')]('/',auth[_0x31b7('0x9')](),controller[_0x31b7('0xa')]);router[_0x31b7('0x8')](_0x31b7('0xb'),auth[_0x31b7('0x9')](),controller['describe']);router['get'](_0x31b7('0xc'),auth['isAuthenticated'](),controller[_0x31b7('0xd')]);router[_0x31b7('0x8')]('/:id/dispositions',auth[_0x31b7('0x9')](),controller[_0x31b7('0xe')]);router['get']('/:id/canned_answers',auth[_0x31b7('0x9')](),controller['getAnswers']);router[_0x31b7('0x8')](_0x31b7('0xf'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x10')]);router['get']('/:id/out_servers',auth[_0x31b7('0x9')](),controller[_0x31b7('0x11')]);router['get'](_0x31b7('0x12'),auth['isAuthenticated'](),controller[_0x31b7('0x13')]);router[_0x31b7('0x8')](_0x31b7('0x14'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x15')]);router[_0x31b7('0x8')](_0x31b7('0x16'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x17')]);router[_0x31b7('0x8')](_0x31b7('0x18'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x19')]);router['get'](_0x31b7('0x1a'),auth[_0x31b7('0x9')](),controller['getAgents']);router[_0x31b7('0x1b')]('/:id/dispositions',auth[_0x31b7('0x9')](),controller['addDisposition']);router[_0x31b7('0x1b')](_0x31b7('0x1c'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x1d')]);router[_0x31b7('0x1b')]('/',auth[_0x31b7('0x9')](),controller[_0x31b7('0x1e')]);router[_0x31b7('0x1b')](_0x31b7('0xf'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x1f')]);router[_0x31b7('0x1b')](_0x31b7('0x20'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x21')]);router[_0x31b7('0x1b')](_0x31b7('0x12'),auth[_0x31b7('0x9')](),controller['addInteraction']);router[_0x31b7('0x1b')](_0x31b7('0x14'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x22')]);router[_0x31b7('0x1b')](_0x31b7('0x23'),auth[_0x31b7('0x9')](),controller['send']);router[_0x31b7('0x1b')]('/:id/users',auth['isAuthenticated'](),controller['addAgents']);router[_0x31b7('0x24')](_0x31b7('0xc'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x25')]);router['delete'](_0x31b7('0x26'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x27')]);router[_0x31b7('0x28')](_0x31b7('0x1c'),auth[_0x31b7('0x9')](),controller['removeAnswers']);router[_0x31b7('0x28')](_0x31b7('0xf'),auth[_0x31b7('0x9')](),controller[_0x31b7('0x29')]);router['delete'](_0x31b7('0x20'),auth[_0x31b7('0x9')](),controller['removeSmtp']);router[_0x31b7('0x28')](_0x31b7('0xc'),auth[_0x31b7('0x9')](),controller['destroy']);router[_0x31b7('0x28')]('/:id/users',auth[_0x31b7('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d35e369..7e02dd4 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 _0x4026=['gmail','yahoo','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','Arial,Helvetica,sans-serif','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','ENUM'];(function(_0x356312,_0x4e93b7){var _0x1b1055=function(_0x224f96){while(--_0x224f96){_0x356312['push'](_0x356312['shift']());}};_0x1b1055(++_0x4e93b7);}(_0x4026,0x1bb));var _0x6402=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4026[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x6402('0x0'));module[_0x6402('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x6402('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x6402('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6402('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6402('0x2')],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6402('0x2')],'allowNull':![],'defaultValue':_0x6402('0x4')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0x6402('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6402('0x6');}},'notificationSound':{'type':Sequelize[_0x6402('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6402('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6402('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6402('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x228805){if(!_0x228805)this[_0x6402('0x9')](_0x6402('0xa'),null);this[_0x6402('0x9')](_0x6402('0xb'),_0x228805);}},'provider':{'type':Sequelize[_0x6402('0xc')](_0x6402('0xd'),'hotmail',_0x6402('0xe'),_0x6402('0xf')),'defaultValue':null,'get':function(){var _0x23e50e=this[_0x6402('0x10')](_0x6402('0x11'));return _0x23e50e||_0x6402('0x12');},'set':function(_0x457e06){if(_0x457e06===_0x6402('0x12')){_0x457e06=null;}return this[_0x6402('0x9')]('provider',_0x457e06);}}}; \ No newline at end of file +var _0xf4fe=['INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','ENUM','gmail','hotmail','yahoo','outlook365','getDataValue','custom','provider','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x1b1e76,_0x31695b){var _0x3d743a=function(_0x4ae27b){while(--_0x4ae27b){_0x1b1e76['push'](_0x1b1e76['shift']());}};_0x3d743a(++_0x31695b);}(_0xf4fe,0x1cf));var _0xef4f=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xf4fe[_0xf0bcac];return _0x4e4c65;};'use strict';var Sequelize=require('sequelize');module[_0xef4f('0x0')]={'description':{'type':Sequelize[_0xef4f('0x1')]},'name':{'type':Sequelize[_0xef4f('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0xef4f('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xef4f('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xef4f('0x3')]},'markAsUnread':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xef4f('0x1')],'allowNull':![],'defaultValue':_0xef4f('0x4')},'fontSize':{'type':Sequelize[_0xef4f('0x5')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xef4f('0x3')],'defaultValue':function(){return _0xef4f('0x6');}},'notificationSound':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xef4f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xef4f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef4f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef4f('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef4f('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef4f('0x5')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xef4f('0x7'),'set':function(_0x5544ed){if(!_0x5544ed)this[_0xef4f('0x8')]('mandatoryDispositionPauseId',null);this[_0xef4f('0x8')](_0xef4f('0x9'),_0x5544ed);}},'provider':{'type':Sequelize[_0xef4f('0xa')](_0xef4f('0xb'),_0xef4f('0xc'),_0xef4f('0xd'),_0xef4f('0xe')),'defaultValue':null,'get':function(){var _0x1b305c=this[_0xef4f('0xf')]('provider');return _0x1b305c||_0xef4f('0x10');},'set':function(_0x3cd2a7){if(_0x3cd2a7===_0xef4f('0x10')){_0x3cd2a7=null;}return this[_0xef4f('0x8')](_0xef4f('0x11'),_0x3cd2a7);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 49d06c7..747a363 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 _0x82e0=['addInteraction','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','READ_COMMITTED','MailApplication','priority','finally','sendStatus','getApplications','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','true','CmList','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','subject','attach','out','messageId','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','isArray','userMailAccount:remove','getAgents','User','bluebird','util','path','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','then','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','update','get','UserProfileResource','destroy','stack','name','send','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','password','modernAuthentication','CloudProviderId','host','port','secure','service','username','authentication','pass','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','findAll','show','MailAccount','include','body','provider','Pause','Mail\x20Account\x20not\x20found','describe','addDisposition','params','MailAccountId','Disposition','create','findOne','merge','includeAll','rows','removeDispositions','find','ids','addAnswer','CannedAnswer','removeAnswers','custom','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','getSmtp','addSmtp','removeSmtp','MailInteraction'];(function(_0xf71120,_0x25b7f9){var _0xbe2fd3=function(_0x1acbdd){while(--_0x1acbdd){_0xf71120['push'](_0xf71120['shift']());}};_0xbe2fd3(++_0x25b7f9);}(_0x82e0,0x1c1));var _0x082e=function(_0x58b66e,_0x55a3d6){_0x58b66e=_0x58b66e-0x0;var _0x245660=_0x82e0[_0x58b66e];return _0x245660;};'use strict';var moment=require('moment');var BPromise=require(_0x082e('0x0'));var util=require(_0x082e('0x1'));var path=require(_0x082e('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x082e('0x3'));var qs=require(_0x082e('0x4'));var logger=require(_0x082e('0x5'))(_0x082e('0x6'));var config=require(_0x082e('0x7'));var db=require(_0x082e('0x8'))['db'];config[_0x082e('0x9')]=_[_0x082e('0xa')](config[_0x082e('0x9')],{'host':_0x082e('0xb'),'port':0x18eb});var socket=require(_0x082e('0xc'))(new Redis(config['redis']));require(_0x082e('0xd'))[_0x082e('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x082e('0xf')][_0x082e('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x571091,_0x5bbfa6,_0x28040f,_0x25b92a){return new BPromise(function(_0x3bc585,_0x41e64a){var _0x256671=_0x25b92a||client;return _0x256671['request'](_0x571091,_0x28040f)[_0x082e('0x11')](function(_0x405384){logger['info'](_0x082e('0x12'),_0x5bbfa6,'request\x20sent');logger[_0x082e('0x13')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x5bbfa6,'request\x20sent',JSON[_0x082e('0x14')](_0x405384));if(_0x405384[_0x082e('0x15')]){if(_0x405384[_0x082e('0x15')][_0x082e('0x16')]===0x1f4){logger[_0x082e('0x15')](_0x082e('0x12'),_0x5bbfa6,_0x405384[_0x082e('0x15')]['message']);return _0x41e64a(_0x405384[_0x082e('0x15')][_0x082e('0x17')]);}logger[_0x082e('0x15')](_0x082e('0x12'),_0x5bbfa6,_0x405384[_0x082e('0x15')][_0x082e('0x17')]);return _0x3bc585(_0x405384[_0x082e('0x15')][_0x082e('0x17')]);}else{logger[_0x082e('0x18')](_0x082e('0x12'),_0x5bbfa6,_0x082e('0x19'));_0x3bc585(_0x405384[_0x082e('0x1a')][_0x082e('0x17')]);}})[_0x082e('0x1b')](function(_0x41cb63){logger[_0x082e('0x15')]('MailAccount,\x20%s,\x20%s',_0x5bbfa6,_0x41cb63);_0x41e64a(_0x41cb63);});});}function respondWithStatusCode(_0x2194e0,_0x2f4495){_0x2f4495=_0x2f4495||0xcc;return function(_0x3fa815){if(_0x3fa815){return _0x2194e0['sendStatus'](_0x2f4495);}return _0x2194e0[_0x082e('0x1c')](_0x2f4495)[_0x082e('0x1d')]();};}function respondWithResult(_0x11c5da,_0x26542b){_0x26542b=_0x26542b||0xc8;return function(_0xcc007){if(_0xcc007){return _0x11c5da[_0x082e('0x1c')](_0x26542b)[_0x082e('0x1e')](_0xcc007);}};}function respondWithFilteredResult(_0xd37fda,_0x33a38a){return function(_0x27907a){if(_0x27907a){var _0x3e76d7=typeof _0x33a38a['offset']===_0x082e('0x1f')&&typeof _0x33a38a[_0x082e('0x20')]===_0x082e('0x1f');var _0x2df307=_0x27907a[_0x082e('0x21')];var _0x343037=_0x3e76d7?0x0:_0x33a38a[_0x082e('0x22')];var _0x5403d3=_0x3e76d7?_0x27907a['count']:_0x33a38a[_0x082e('0x22')]+_0x33a38a[_0x082e('0x20')];var _0xe75fc0;if(_0x5403d3>=_0x2df307){_0x5403d3=_0x2df307;_0xe75fc0=0xc8;}else{_0xe75fc0=0xce;}_0xd37fda[_0x082e('0x1c')](_0xe75fc0);return _0xd37fda['set'](_0x082e('0x23'),_0x343037+'-'+_0x5403d3+'/'+_0x2df307)[_0x082e('0x1e')](_0x27907a);}return null;};}function saveUpdates(_0x13c36f){return function(_0x57806d){if(_0x57806d){return _0x57806d[_0x082e('0x24')](_0x13c36f)[_0x082e('0x11')](function(_0x5e7024){return _0x5e7024;});}return null;};}function removeEntity(_0xc9f61f){return function(_0x5e7008){if(_0x5e7008){return _0x5e7008['destroy']()['then'](function(){var _0x189e3a=_0x5e7008[_0x082e('0x25')]({'plain':!![]});var _0xe4b303='MailAccounts';return db[_0x082e('0x26')][_0x082e('0x27')]({'where':{'type':_0xe4b303,'resourceId':_0x189e3a['id']}})[_0x082e('0x11')](function(){return _0x5e7008;});})[_0x082e('0x11')](function(){_0xc9f61f[_0x082e('0x1c')](0xcc)[_0x082e('0x1d')]();});}};}function handleEntityNotFound(_0x48c78b){return function(_0x3b6c57){if(!_0x3b6c57){_0x48c78b['sendStatus'](0x194);}return _0x3b6c57;};}function handleError(_0x197b11,_0x3c4aff){_0x3c4aff=_0x3c4aff||0x1f4;return function(_0x182ddc){logger[_0x082e('0x15')](_0x182ddc[_0x082e('0x28')]);if(_0x182ddc['name']){delete _0x182ddc[_0x082e('0x29')];}_0x197b11[_0x082e('0x1c')](_0x3c4aff)[_0x082e('0x2a')](_0x182ddc);};}function getImapHost(_0x2259be){switch(_0x2259be){case'gmail':return'imap.gmail.com';case _0x082e('0x2b'):return _0x082e('0x2c');case _0x082e('0x2d'):return'imap-mail.outlook.com';case _0x082e('0x2e'):return _0x082e('0x2f');}throw new Error(_0x082e('0x30'),_0x2259be);}function getSmtpHost(_0x4fa189){switch(_0x4fa189){case _0x082e('0x31'):return'smtp.gmail.com';case _0x082e('0x2b'):return _0x082e('0x32');case _0x082e('0x2d'):return _0x082e('0x33');case _0x082e('0x2e'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x4fa189);}function getAuthenticationOptions(_0x103585,_0x3835fa){var _0x2b3fc7={};var _0x1ec3f6={};if(_0x103585){_0x2b3fc7[_0x082e('0x34')]=_0x1ec3f6[_0x082e('0x34')]=_0x3835fa['username'];_0x2b3fc7[_0x082e('0x35')]=_0x1ec3f6['pass']=_0x3835fa[_0x082e('0x35')];if(_0x3835fa[_0x082e('0x36')]){_0x2b3fc7[_0x082e('0x36')]=_0x1ec3f6[_0x082e('0x36')]=!![];_0x2b3fc7['CloudProviderId']=_0x1ec3f6[_0x082e('0x37')]=_0x3835fa[_0x082e('0x37')];_0x2b3fc7[_0x082e('0x35')]=_0x1ec3f6['pass']=null;}else{_0x2b3fc7[_0x082e('0x37')]=_0x1ec3f6[_0x082e('0x37')]=null;}_0x2b3fc7[_0x082e('0x38')]=getImapHost(_0x103585);_0x2b3fc7[_0x082e('0x39')]=0x3e1;_0x1ec3f6[_0x082e('0x38')]=getSmtpHost(_0x103585);_0x1ec3f6[_0x082e('0x39')]=0x24b;_0x1ec3f6[_0x082e('0x3a')]=![];_0x2b3fc7[_0x082e('0x3b')]=_0x1ec3f6[_0x082e('0x3b')]=null;}else{if(_0x3835fa['authentication']){_0x2b3fc7[_0x082e('0x34')]=_0x1ec3f6[_0x082e('0x34')]=_0x3835fa[_0x082e('0x3c')];_0x2b3fc7['password']=_0x1ec3f6['pass']=_0x3835fa[_0x082e('0x35')];}else{_0x2b3fc7['authentication']=_0x1ec3f6[_0x082e('0x3d')]=![];_0x2b3fc7[_0x082e('0x34')]=_0x1ec3f6[_0x082e('0x34')]=null;_0x2b3fc7[_0x082e('0x35')]=_0x1ec3f6[_0x082e('0x3e')]=null;}_0x2b3fc7[_0x082e('0x38')]=_0x3835fa[_0x082e('0x3f')][_0x082e('0x38')];_0x2b3fc7[_0x082e('0x39')]=_0x3835fa['Imap'][_0x082e('0x39')];_0x1ec3f6[_0x082e('0x38')]=_0x3835fa['Smtp']['host'];_0x1ec3f6['port']=_0x3835fa[_0x082e('0x40')][_0x082e('0x39')];}return{'Imap':_0x2b3fc7,'Smtp':_0x1ec3f6};}exports[_0x082e('0x41')]=function(_0x210055,_0x598545){var _0x3acd31={'include':[{'model':db[_0x082e('0x42')],'as':'Imap'},{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db['Pause'],'as':_0x082e('0x44')}]},_0x58bc39={},_0x51e32e={'count':0x0,'rows':[]};var _0x2f7674=_[_0x082e('0x45')](db['MailAccount'][_0x082e('0x46')],function(_0x2cccdd){return{'name':_0x2cccdd[_0x082e('0x47')],'type':_0x2cccdd[_0x082e('0x48')][_0x082e('0x49')]};});_0x58bc39[_0x082e('0x4a')]=_['map'](_0x2f7674,'name');_0x58bc39[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x210055[_0x082e('0x4b')]);_0x58bc39['filters']=_[_0x082e('0x4d')](_0x58bc39['model'],_0x58bc39[_0x082e('0x4b')]);_0x3acd31[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x58bc39[_0x082e('0x4a')],qs['fields'](_0x210055[_0x082e('0x4b')][_0x082e('0x4f')]));_0x3acd31[_0x082e('0x4e')]=_0x3acd31[_0x082e('0x4e')][_0x082e('0x50')]?_0x3acd31['attributes']:_0x58bc39[_0x082e('0x4a')];if(!_0x210055[_0x082e('0x4b')][_0x082e('0x51')](_0x082e('0x52'))){_0x3acd31[_0x082e('0x20')]=qs[_0x082e('0x20')](_0x210055[_0x082e('0x4b')][_0x082e('0x20')]);_0x3acd31['offset']=qs[_0x082e('0x22')](_0x210055[_0x082e('0x4b')][_0x082e('0x22')]);}_0x3acd31[_0x082e('0x53')]=qs[_0x082e('0x54')](_0x210055['query'][_0x082e('0x54')]);_0x3acd31[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x210055[_0x082e('0x4b')],_0x58bc39[_0x082e('0x56')]),_0x2f7674);if(_0x210055['query']['filter']){_0x3acd31[_0x082e('0x55')]=_['merge'](_0x3acd31['where'],{'$or':_[_0x082e('0x45')](_0x2f7674,function(_0x4da68c){if(_0x4da68c[_0x082e('0x48')]!==_0x082e('0x58')){var _0x3921d7={};_0x3921d7[_0x4da68c[_0x082e('0x29')]]={'$like':'%'+_0x210055['query'][_0x082e('0x59')]+'%'};return _0x3921d7;}})});}_0x3acd31=_['merge']({},_0x3acd31,_0x210055[_0x082e('0x5a')]);var _0x4ea343={'where':_0x3acd31[_0x082e('0x55')]};return db['MailAccount'][_0x082e('0x21')](_0x4ea343)[_0x082e('0x11')](function(_0x20ba83){_0x51e32e[_0x082e('0x21')]=_0x20ba83;if(_0x210055[_0x082e('0x4b')]['includeAll']){_0x3acd31['include']=[{'all':!![]}];}return db['MailAccount'][_0x082e('0x5b')](_0x3acd31);})[_0x082e('0x11')](function(_0xd7b0aa){_0x51e32e['rows']=_0xd7b0aa;return _0x51e32e;})[_0x082e('0x11')](respondWithFilteredResult(_0x598545,_0x3acd31))['catch'](handleError(_0x598545,null));};exports[_0x082e('0x5c')]=function(_0x5e06f9,_0x538d2e){var _0x38764f={'raw':![],'where':{'id':_0x5e06f9['params']['id']},'include':[{'model':db[_0x082e('0x42')],'as':_0x082e('0x3f')},{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db['Pause'],'as':_0x082e('0x44')}]},_0x1a33b4={};_0x1a33b4[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0x5d')][_0x082e('0x46')]);_0x1a33b4[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x5e06f9[_0x082e('0x4b')]);_0x1a33b4[_0x082e('0x56')]=_[_0x082e('0x4d')](_0x1a33b4['model'],_0x1a33b4[_0x082e('0x4b')]);_0x38764f[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x1a33b4[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x5e06f9['query'][_0x082e('0x4f')]));_0x38764f['attributes']=_0x38764f[_0x082e('0x4e')]['length']?_0x38764f['attributes']:_0x1a33b4[_0x082e('0x4a')];if(_0x5e06f9[_0x082e('0x4b')]['includeAll']){_0x38764f[_0x082e('0x5e')]=[{'all':!![]}];}_0x38764f=_['merge']({},_0x38764f,_0x5e06f9[_0x082e('0x5a')]);return db[_0x082e('0x5d')]['find'](_0x38764f)['then'](handleEntityNotFound(_0x538d2e,null))[_0x082e('0x11')](respondWithResult(_0x538d2e,null))[_0x082e('0x1b')](handleError(_0x538d2e,null));};exports['update']=function(_0x29eef5,_0x4c7ec5){if(_0x29eef5[_0x082e('0x5f')]['id']){delete _0x29eef5[_0x082e('0x5f')]['id'];}var _0x34c289=_0x29eef5['body'][_0x082e('0x60')]==='custom'?null:_0x29eef5['body'][_0x082e('0x60')];var _0x19199c=_0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')]||{};var _0x386f47=_0x29eef5[_0x082e('0x5f')][_0x082e('0x40')]||{};if(_0x34c289){_0x19199c[_0x082e('0x38')]=getImapHost(_0x34c289);_0x19199c[_0x082e('0x39')]=0x3e1;_0x386f47[_0x082e('0x38')]=getSmtpHost(_0x34c289);_0x386f47[_0x082e('0x39')]=0x24b;_0x386f47[_0x082e('0x3a')]=![];}if(_0x386f47[_0x082e('0x36')]){_0x386f47['secure']=![];}else{_0x386f47[_0x082e('0x37')]=null;}if(!_0x19199c['modernAuthentication'])_0x19199c[_0x082e('0x37')]=null;_0x29eef5['body']['Imap']=_0x19199c;_0x29eef5[_0x082e('0x5f')]['Smtp']=_0x386f47;return db[_0x082e('0x5d')]['find']({'where':{'id':_0x29eef5['params']['id']},'include':[{'model':db[_0x082e('0x42')],'as':_0x082e('0x3f')},{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db[_0x082e('0x61')],'as':_0x082e('0x44')}]})[_0x082e('0x11')](handleEntityNotFound(_0x4c7ec5,null))[_0x082e('0x11')](function(_0x1a9607){if(!_0x1a9607)throw new Error(_0x082e('0x62'));if(_0x1a9607[_0x082e('0x3b')])delete _0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')];return _0x1a9607;})[_0x082e('0x11')](saveUpdates(_0x29eef5['body'],null))['then'](function(_0x51499a){if(!_0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')])return _0x51499a;return db[_0x082e('0x42')]['update'](_0x29eef5[_0x082e('0x5f')][_0x082e('0x3f')],{'where':{'MailAccountId':_0x51499a['id']}})[_0x082e('0x11')](function(){return _0x51499a;});})['then'](function(_0x2b2f45){if(!_0x29eef5[_0x082e('0x5f')][_0x082e('0x40')])return _0x2b2f45;return db[_0x082e('0x43')][_0x082e('0x24')](_0x29eef5[_0x082e('0x5f')]['Smtp'],{'where':{'MailAccountId':_0x2b2f45['id']}})[_0x082e('0x11')](function(){return _0x2b2f45;});})['then'](respondWithResult(_0x4c7ec5,null))[_0x082e('0x1b')](handleError(_0x4c7ec5,null));};exports[_0x082e('0x63')]=function(_0x4d8ebb,_0x87849b){return db['MailAccount'][_0x082e('0x63')]()[_0x082e('0x11')](respondWithResult(_0x87849b,null))['catch'](handleError(_0x87849b,null));};exports[_0x082e('0x64')]=function(_0x530896,_0x6024c5){if(_0x530896[_0x082e('0x5f')]['id']){delete _0x530896[_0x082e('0x5f')]['id'];}return db['MailAccount']['find']({'where':{'id':_0x530896[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x6024c5,null))[_0x082e('0x11')](function(_0x3d3775){if(_0x3d3775){_0x530896[_0x082e('0x5f')][_0x082e('0x66')]=_0x3d3775['id'];return db[_0x082e('0x67')][_0x082e('0x68')](_0x530896[_0x082e('0x5f')]);}})[_0x082e('0x11')](respondWithResult(_0x6024c5,null))[_0x082e('0x1b')](handleError(_0x6024c5,null));};exports['getDispositions']=function(_0x28ce62,_0x2d9bdd){var _0x4e126b={'raw':![],'where':{}};var _0xa16934={};var _0x2507d5={'count':0x0,'rows':[]};return db['MailAccount'][_0x082e('0x69')]({'where':{'id':_0x28ce62[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x2d9bdd,null))['then'](function(_0x19419d){if(_0x19419d){_0xa16934[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0x67')][_0x082e('0x46')]);_0xa16934[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x28ce62['query']);_0xa16934[_0x082e('0x56')]=_[_0x082e('0x4d')](_0xa16934[_0x082e('0x4a')],_0xa16934[_0x082e('0x4b')]);_0x4e126b[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0xa16934[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x28ce62[_0x082e('0x4b')][_0x082e('0x4f')]));_0x4e126b[_0x082e('0x4e')]=_0x4e126b['attributes'][_0x082e('0x50')]?_0x4e126b[_0x082e('0x4e')]:_0xa16934[_0x082e('0x4a')];if(!_0x28ce62[_0x082e('0x4b')][_0x082e('0x51')]('nolimit')){_0x4e126b['limit']=qs[_0x082e('0x20')](_0x28ce62[_0x082e('0x4b')][_0x082e('0x20')]);_0x4e126b['offset']=qs['offset'](_0x28ce62['query'][_0x082e('0x22')]);}_0x4e126b['order']=qs[_0x082e('0x54')](_0x28ce62[_0x082e('0x4b')]['sort']);_0x4e126b['where']=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x28ce62[_0x082e('0x4b')],_0xa16934[_0x082e('0x56')]));_0x4e126b[_0x082e('0x55')][_0x082e('0x66')]=_0x19419d['id'];if(_0x28ce62[_0x082e('0x4b')][_0x082e('0x59')]){_0x4e126b[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x4e126b[_0x082e('0x55')],{'$or':_[_0x082e('0x45')](_0x4e126b['attributes'],function(_0x5ab6f6){var _0x500b86={};_0x500b86[_0x5ab6f6]={'$like':'%'+_0x28ce62[_0x082e('0x4b')][_0x082e('0x59')]+'%'};return _0x500b86;})});}_0x4e126b=_[_0x082e('0x6a')]({},_0x4e126b,_0x28ce62[_0x082e('0x5a')]);return db[_0x082e('0x67')][_0x082e('0x21')]({'where':_0x4e126b[_0x082e('0x55')]})[_0x082e('0x11')](function(_0xd5ca15){_0x2507d5[_0x082e('0x21')]=_0xd5ca15;if(_0x28ce62[_0x082e('0x4b')][_0x082e('0x6b')]){_0x4e126b[_0x082e('0x5e')]=[{'all':!![]}];}return db[_0x082e('0x67')][_0x082e('0x5b')](_0x4e126b);})[_0x082e('0x11')](function(_0x434bed){_0x2507d5[_0x082e('0x6c')]=_0x434bed;return _0x2507d5;});}})[_0x082e('0x11')](respondWithFilteredResult(_0x2d9bdd,_0x4e126b))[_0x082e('0x1b')](handleError(_0x2d9bdd,null));};exports[_0x082e('0x6d')]=function(_0x11ba9e,_0x2e5585){return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x11ba9e[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x2e5585,null))['then'](function(_0x435b4d){if(_0x435b4d){return _0x435b4d[_0x082e('0x6d')](_0x11ba9e['query'][_0x082e('0x6f')]);}})[_0x082e('0x11')](respondWithStatusCode(_0x2e5585,null))[_0x082e('0x1b')](handleError(_0x2e5585,null));};exports[_0x082e('0x70')]=function(_0x253c10,_0x3ed7b6){if(_0x253c10['body']['id']){delete _0x253c10[_0x082e('0x5f')]['id'];}return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x253c10[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x3ed7b6,null))['then'](function(_0x439748){if(_0x439748){_0x253c10[_0x082e('0x5f')]['MailAccountId']=_0x439748['id'];return db[_0x082e('0x71')][_0x082e('0x68')](_0x253c10[_0x082e('0x5f')]);}})[_0x082e('0x11')](respondWithResult(_0x3ed7b6,null))[_0x082e('0x1b')](handleError(_0x3ed7b6,null));};exports['getAnswers']=function(_0x543ffe,_0x42fb7f){var _0x27d5a4={'raw':![],'where':{}};var _0x4b11bb={};var _0x268edf={'count':0x0,'rows':[]};return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x543ffe['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x42fb7f,null))[_0x082e('0x11')](function(_0x47e8c9){if(_0x47e8c9){_0x4b11bb[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0x71')][_0x082e('0x46')]);_0x4b11bb[_0x082e('0x4b')]=_['keys'](_0x543ffe[_0x082e('0x4b')]);_0x4b11bb[_0x082e('0x56')]=_[_0x082e('0x4d')](_0x4b11bb['model'],_0x4b11bb[_0x082e('0x4b')]);_0x27d5a4[_0x082e('0x4e')]=_['intersection'](_0x4b11bb[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x543ffe[_0x082e('0x4b')][_0x082e('0x4f')]));_0x27d5a4[_0x082e('0x4e')]=_0x27d5a4[_0x082e('0x4e')][_0x082e('0x50')]?_0x27d5a4[_0x082e('0x4e')]:_0x4b11bb[_0x082e('0x4a')];if(!_0x543ffe['query'][_0x082e('0x51')](_0x082e('0x52'))){_0x27d5a4['limit']=qs[_0x082e('0x20')](_0x543ffe[_0x082e('0x4b')]['limit']);_0x27d5a4[_0x082e('0x22')]=qs[_0x082e('0x22')](_0x543ffe[_0x082e('0x4b')][_0x082e('0x22')]);}_0x27d5a4['order']=qs[_0x082e('0x54')](_0x543ffe['query']['sort']);_0x27d5a4['where']=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x543ffe['query'],_0x4b11bb[_0x082e('0x56')]));_0x27d5a4[_0x082e('0x55')]['MailAccountId']=_0x47e8c9['id'];if(_0x543ffe[_0x082e('0x4b')][_0x082e('0x59')]){_0x27d5a4[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x27d5a4[_0x082e('0x55')],{'$or':_[_0x082e('0x45')](_0x27d5a4[_0x082e('0x4e')],function(_0x461f2f){var _0x44f641={};_0x44f641[_0x461f2f]={'$like':'%'+_0x543ffe[_0x082e('0x4b')]['filter']+'%'};return _0x44f641;})});}_0x27d5a4=_[_0x082e('0x6a')]({},_0x27d5a4,_0x543ffe[_0x082e('0x5a')]);return db[_0x082e('0x71')][_0x082e('0x21')]({'where':_0x27d5a4[_0x082e('0x55')]})['then'](function(_0x23edb8){_0x268edf[_0x082e('0x21')]=_0x23edb8;if(_0x543ffe[_0x082e('0x4b')][_0x082e('0x6b')]){_0x27d5a4['include']=[{'all':!![]}];}return db[_0x082e('0x71')][_0x082e('0x5b')](_0x27d5a4);})[_0x082e('0x11')](function(_0xf12511){_0x268edf[_0x082e('0x6c')]=_0xf12511;return _0x268edf;});}})[_0x082e('0x11')](respondWithFilteredResult(_0x42fb7f,_0x27d5a4))[_0x082e('0x1b')](handleError(_0x42fb7f,null));};exports[_0x082e('0x72')]=function(_0x1194d8,_0x17f875){return db['MailAccount']['find']({'where':{'id':_0x1194d8[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x17f875,null))['then'](function(_0x3c75b3){if(_0x3c75b3){return _0x3c75b3[_0x082e('0x72')](_0x1194d8[_0x082e('0x4b')]['ids']);}})['then'](respondWithStatusCode(_0x17f875,null))[_0x082e('0x1b')](handleError(_0x17f875,null));};exports['create']=function(_0x252ada,_0x2ebf11){var _0x227527={'name':_0x252ada[_0x082e('0x5f')][_0x082e('0x29')],'key':_0x252ada[_0x082e('0x5f')]['key'],'provider':_0x252ada[_0x082e('0x5f')]['provider']===_0x082e('0x73')?null:_0x252ada[_0x082e('0x5f')][_0x082e('0x60')],'email':_0x252ada['body']['email'],'ListId':_0x252ada[_0x082e('0x5f')]['ListId'],'active':!_[_0x082e('0x74')](_0x252ada['body'][_0x082e('0x75')])?_0x252ada[_0x082e('0x5f')][_0x082e('0x75')]:!![],'description':_0x252ada[_0x082e('0x5f')][_0x082e('0x76')]||null};var _0x3c3a92=getAuthenticationOptions(_0x227527[_0x082e('0x60')],_0x252ada[_0x082e('0x5f')]);_0x227527[_0x082e('0x3f')]=_0x3c3a92['Imap'];_0x227527['Smtp']=_0x3c3a92[_0x082e('0x40')];return db[_0x082e('0x5d')][_0x082e('0x68')](_0x227527,{'include':[{'model':db[_0x082e('0x43')],'as':_0x082e('0x40')},{'model':db[_0x082e('0x42')],'as':_0x082e('0x3f')}]})[_0x082e('0x11')](function(_0xc58f4f){var _0x4a121e=_0x252ada[_0x082e('0x34')][_0x082e('0x25')]({'plain':!![]});if(!_0x4a121e)throw new Error(_0x082e('0x77'));if(_0x4a121e[_0x082e('0x78')]===_0x082e('0x34')){var _0x5c8ca4=_0xc58f4f['get']({'plain':!![]});return db[_0x082e('0x79')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x4a121e[_0x082e('0x7a')]},'raw':!![]})[_0x082e('0x11')](function(_0x4a0d1a){if(_0x4a0d1a&&_0x4a0d1a[_0x082e('0x7b')]===0x0){return db[_0x082e('0x26')][_0x082e('0x68')]({'name':_0x5c8ca4[_0x082e('0x29')],'resourceId':_0x5c8ca4['id'],'type':_0x4a0d1a[_0x082e('0x29')],'sectionId':_0x4a0d1a['id']},{})['then'](function(){return _0xc58f4f;});}else{return _0xc58f4f;}})[_0x082e('0x1b')](function(_0x3755f1){logger[_0x082e('0x15')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3755f1);throw _0x3755f1;});}return _0xc58f4f;})['then'](respondWithResult(_0x2ebf11,0xc9))[_0x082e('0x1b')](handleError(_0x2ebf11,null));};exports[_0x082e('0x7c')]=function(_0x1bb8fd,_0x5c26a6){return db['MailAccount']['findOne']({'where':{'id':_0x1bb8fd[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x5c26a6,null))['then'](function(_0x5da90e){if(_0x5da90e){return _0x5da90e['getImap']();}return null;})[_0x082e('0x11')](respondWithResult(_0x5c26a6,null))[_0x082e('0x1b')](handleError(_0x5c26a6,null));};exports['addImap']=function(_0x472471,_0x5f432f){if(_0x472471['body']['id']){delete _0x472471['body']['id'];}return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x472471['params']['id']}})['then'](handleEntityNotFound(_0x5f432f,null))[_0x082e('0x11')](function(_0x373696){if(_0x373696){_0x472471[_0x082e('0x5f')][_0x082e('0x66')]=_0x373696['id'];return db[_0x082e('0x42')][_0x082e('0x68')](_0x472471['body']);}})[_0x082e('0x11')](respondWithResult(_0x5f432f,null))[_0x082e('0x1b')](handleError(_0x5f432f,null));};exports[_0x082e('0x7d')]=function(_0x2bec44,_0x1fbb01){return db['MailAccount']['findOne']({'where':{'id':_0x2bec44['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x1fbb01,null))[_0x082e('0x11')](function(_0x589613){if(_0x589613){return _0x589613['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x1fbb01,null))[_0x082e('0x1b')](handleError(_0x1fbb01,null));};exports[_0x082e('0x7e')]=function(_0x327cbe,_0x20bb89){return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x327cbe[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x20bb89,null))[_0x082e('0x11')](function(_0x3c89b7){if(_0x3c89b7){return _0x3c89b7[_0x082e('0x7e')]();}return null;})[_0x082e('0x11')](respondWithResult(_0x20bb89,null))[_0x082e('0x1b')](handleError(_0x20bb89,null));};exports[_0x082e('0x7f')]=function(_0x3c1774,_0x2c4a42){if(_0x3c1774[_0x082e('0x5f')]['id']){delete _0x3c1774[_0x082e('0x5f')]['id'];}return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x3c1774['params']['id']}})['then'](handleEntityNotFound(_0x2c4a42,null))[_0x082e('0x11')](function(_0x5b8ff7){if(_0x5b8ff7){_0x3c1774[_0x082e('0x5f')][_0x082e('0x66')]=_0x5b8ff7['id'];return db[_0x082e('0x43')][_0x082e('0x68')](_0x3c1774['body']);}})[_0x082e('0x11')](respondWithResult(_0x2c4a42,null))[_0x082e('0x1b')](handleError(_0x2c4a42,null));};exports[_0x082e('0x80')]=function(_0x195766,_0x5a7edb){return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x195766[_0x082e('0x65')]['id']}})['then'](handleEntityNotFound(_0x5a7edb,null))['then'](function(_0x590aef){if(_0x590aef){return _0x590aef['setSmtp'](null);}return null;})[_0x082e('0x11')](respondWithStatusCode(_0x5a7edb,null))[_0x082e('0x1b')](handleError(_0x5a7edb,null));};exports['addInteraction']=function(_0x12d0d9,_0x4cfe30){return db[_0x082e('0x81')]['find']({'where':{'id':_0x12d0d9[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x4cfe30,null))[_0x082e('0x11')](function(_0x2cc0d1){if(_0x2cc0d1){return _0x2cc0d1[_0x082e('0x82')](_0x12d0d9[_0x082e('0x5f')][_0x082e('0x6f')],_[_0x082e('0x83')](_0x12d0d9[_0x082e('0x5f')],[_0x082e('0x6f'),'id'])||{});}})[_0x082e('0x11')](respondWithResult(_0x4cfe30,null))[_0x082e('0x1b')](handleError(_0x4cfe30,null));};exports[_0x082e('0x84')]=function(_0x409721,_0x19ddbc){var _0x148959={'raw':![],'where':{}};var _0x388ea9={};var _0x363c89={'count':0x0,'rows':[]};return db[_0x082e('0x5d')]['findOne']({'where':{'id':_0x409721[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x19ddbc,null))['then'](function(_0x57466c){if(_0x57466c){_0x388ea9['model']=_['keys'](db['MailInteraction'][_0x082e('0x46')]);_0x388ea9[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x409721[_0x082e('0x4b')]);_0x388ea9['filters']=_[_0x082e('0x4d')](_0x388ea9[_0x082e('0x4a')],_0x388ea9[_0x082e('0x4b')]);_0x148959['attributes']=_[_0x082e('0x4d')](_0x388ea9[_0x082e('0x4a')],qs['fields'](_0x409721[_0x082e('0x4b')][_0x082e('0x4f')]));_0x148959[_0x082e('0x4e')]=_0x148959[_0x082e('0x4e')][_0x082e('0x50')]?_0x148959[_0x082e('0x4e')]:_0x388ea9[_0x082e('0x4a')];if(!_0x409721['query'][_0x082e('0x51')](_0x082e('0x52'))){_0x148959[_0x082e('0x20')]=qs[_0x082e('0x20')](_0x409721[_0x082e('0x4b')][_0x082e('0x20')]);_0x148959[_0x082e('0x22')]=qs[_0x082e('0x22')](_0x409721[_0x082e('0x4b')][_0x082e('0x22')]);}_0x148959[_0x082e('0x53')]=qs[_0x082e('0x54')](_0x409721['query'][_0x082e('0x54')]);_0x148959[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x409721['query'],_0x388ea9[_0x082e('0x56')]));_0x148959[_0x082e('0x55')]['MailAccountId']=_0x57466c['id'];if(_0x409721[_0x082e('0x4b')]['filter']){_0x148959[_0x082e('0x55')]=_['merge'](_0x148959['where'],{'$or':_['map'](_0x148959[_0x082e('0x4e')],function(_0x220791){var _0x20574c={};_0x20574c[_0x220791]={'$like':'%'+_0x409721['query']['filter']+'%'};return _0x20574c;})});}_0x148959=_[_0x082e('0x6a')]({},_0x148959,_0x409721[_0x082e('0x5a')]);return db[_0x082e('0x81')][_0x082e('0x21')]({'where':_0x148959['where']})[_0x082e('0x11')](function(_0x52ed07){_0x363c89['count']=_0x52ed07;if(_0x409721['query'][_0x082e('0x6b')]){_0x148959[_0x082e('0x5e')]=[{'model':db[_0x082e('0x85')],'as':_0x082e('0x86'),'required':![]},{'model':db['User'],'as':_0x082e('0x87'),'attributes':[_0x082e('0x29'),_0x082e('0x88'),_0x082e('0x89')],'required':![]},{'model':db[_0x082e('0x8a')],'as':'Tags','attributes':['id',_0x082e('0x29'),_0x082e('0x8b')],'where':_0x409721[_0x082e('0x4b')][_0x082e('0x8c')]?{'id':_0x409721[_0x082e('0x4b')]['tag']}:undefined,'required':_0x409721[_0x082e('0x4b')][_0x082e('0x8c')]?!![]:![]}];}return db[_0x082e('0x81')][_0x082e('0x5b')](_0x148959);})[_0x082e('0x11')](function(_0x1e482b){_0x363c89['rows']=_0x1e482b;return _0x363c89;});}})[_0x082e('0x11')](respondWithFilteredResult(_0x19ddbc,_0x148959))[_0x082e('0x1b')](handleError(_0x19ddbc,null));};exports[_0x082e('0x8d')]=function addApplications(_0x1d6dd0,_0x24a390){var _0x2b363b=_0x1d6dd0[_0x082e('0x65')]['id'];var _0x977b11=_0x1d6dd0[_0x082e('0x5f')];var _0x2d7583=0xc8;var _0x5b636a=null;return db[_0x082e('0x8e')][_0x082e('0x8f')]({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0x082e('0x90')]},function(_0x1789bc){return db['MailAccount'][_0x082e('0x69')]({'where':{'id':_0x2b363b},'transaction':_0x1789bc})[_0x082e('0x11')](function(_0x57acf5){if(_0x57acf5){return db[_0x082e('0x91')][_0x082e('0x27')]({'where':{'MailAccountId':_0x2b363b},'transaction':_0x1789bc})[_0x082e('0x11')](function(){var _0x4014db=_[_0x082e('0x45')](_0x977b11,function(_0x1a0d59){_0x1a0d59['MailAccountId']=_0x2b363b;return _0x1a0d59;});return db[_0x082e('0x91')]['bulkCreate'](_0x4014db,{'transaction':_0x1789bc});});}else{_0x2d7583=0x194;_0x5b636a=[];}});})[_0x082e('0x11')](function(){if(_0x2d7583!==0x194){return db[_0x082e('0x91')]['findAndCountAll']({'where':{'MailAccountId':_0x2b363b},'order':_0x082e('0x92')})['then'](function(_0x5e7f1d){_0x5b636a=_0x5e7f1d;});}})[_0x082e('0x1b')](function(_0x24fba8){_0x2d7583=0x1f4;logger[_0x082e('0x15')](_0x24fba8[_0x082e('0x28')]);if(_0x24fba8[_0x082e('0x29')]){delete _0x24fba8['name'];}_0x5b636a=_0x24fba8;})[_0x082e('0x93')](function(){if(_0x5b636a===null){_0x24a390[_0x082e('0x94')](_0x2d7583);}else{if(_0x2d7583===0x1f4){_0x24a390[_0x082e('0x1c')](_0x2d7583)[_0x082e('0x2a')](_0x5b636a);}else{_0x24a390[_0x082e('0x1c')](_0x2d7583)[_0x082e('0x1e')](_0x5b636a);}}});};exports['getApplications']=function(_0x6718f1,_0x262cc3){var _0x30007e={};var _0x8e9ac7={};var _0x52ccc7;var _0x3f6d1b;return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x6718f1[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x262cc3,null))[_0x082e('0x11')](function(_0x1ab51c){if(_0x1ab51c){_0x52ccc7=_0x1ab51c;_0x8e9ac7['model']=_[_0x082e('0x4c')](db[_0x082e('0x91')][_0x082e('0x46')]);_0x8e9ac7[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x6718f1[_0x082e('0x4b')]);_0x8e9ac7['filters']=_['intersection'](_0x8e9ac7[_0x082e('0x4a')],_0x8e9ac7['query']);_0x30007e[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x8e9ac7[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x6718f1['query'][_0x082e('0x4f')]));_0x30007e['attributes']=_0x30007e['attributes'][_0x082e('0x50')]?_0x30007e[_0x082e('0x4e')]:_0x8e9ac7[_0x082e('0x4a')];_0x30007e['order']=qs[_0x082e('0x54')](_0x6718f1[_0x082e('0x4b')][_0x082e('0x54')]);_0x30007e[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x6718f1[_0x082e('0x4b')],_0x8e9ac7[_0x082e('0x56')]));if(_0x6718f1[_0x082e('0x4b')][_0x082e('0x59')]){_0x30007e[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x30007e['where'],{'$or':_[_0x082e('0x45')](_0x30007e[_0x082e('0x4e')],function(_0x65ff2c){var _0x3b12a8={};_0x3b12a8[_0x65ff2c]={'$like':'%'+_0x6718f1[_0x082e('0x4b')][_0x082e('0x59')]+'%'};return _0x3b12a8;})});}_0x30007e=_[_0x082e('0x6a')]({},_0x30007e,_0x6718f1[_0x082e('0x5a')]);return _0x52ccc7[_0x082e('0x95')](_0x30007e);}})[_0x082e('0x11')](function(_0x2c35b9){if(_0x2c35b9){_0x3f6d1b=_0x2c35b9[_0x082e('0x50')];if(!_0x6718f1[_0x082e('0x4b')]['hasOwnProperty'](_0x082e('0x52'))){_0x30007e[_0x082e('0x20')]=qs['limit'](_0x6718f1[_0x082e('0x4b')]['limit']);_0x30007e['offset']=qs['offset'](_0x6718f1[_0x082e('0x4b')][_0x082e('0x22')]);}return _0x52ccc7[_0x082e('0x95')](_0x30007e);}})[_0x082e('0x11')](function(_0x1704bc){if(_0x1704bc){return _0x1704bc?{'count':_0x3f6d1b,'rows':_0x1704bc}:null;}})[_0x082e('0x11')](respondWithResult(_0x262cc3,null))[_0x082e('0x1b')](handleError(_0x262cc3,null));};exports[_0x082e('0x96')]=function(_0x13d0ea,_0x1b99ba){var _0x3c56bc={'raw':!![],'where':{}};var _0x27d1d8={};var _0xdb3f23={'count':0x0,'rows':[]};return db[_0x082e('0x5d')][_0x082e('0x69')]({'where':{'id':_0x13d0ea[_0x082e('0x65')]['id']}})['then'](handleEntityNotFound(_0x1b99ba,null))[_0x082e('0x11')](function(_0x52fa00){if(_0x52fa00){_0x27d1d8[_0x082e('0x4a')]=_[_0x082e('0x4c')](db['MailMessage'][_0x082e('0x46')]);_0x27d1d8[_0x082e('0x4b')]=_[_0x082e('0x4c')](_0x13d0ea[_0x082e('0x4b')]);_0x27d1d8[_0x082e('0x56')]=_[_0x082e('0x4d')](_0x27d1d8[_0x082e('0x4a')],_0x27d1d8[_0x082e('0x4b')]);_0x3c56bc[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x27d1d8[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x13d0ea[_0x082e('0x4b')][_0x082e('0x4f')]));_0x3c56bc[_0x082e('0x4e')]=_0x3c56bc[_0x082e('0x4e')][_0x082e('0x50')]?_0x3c56bc[_0x082e('0x4e')]:_0x27d1d8['model'];if(!_0x13d0ea[_0x082e('0x4b')][_0x082e('0x51')]('nolimit')){_0x3c56bc['limit']=qs[_0x082e('0x20')](_0x13d0ea[_0x082e('0x4b')][_0x082e('0x20')]);_0x3c56bc[_0x082e('0x22')]=qs['offset'](_0x13d0ea['query'][_0x082e('0x22')]);}_0x3c56bc[_0x082e('0x53')]=qs['sort'](_0x13d0ea[_0x082e('0x4b')][_0x082e('0x54')]);_0x3c56bc[_0x082e('0x55')]=qs['filters'](_[_0x082e('0x57')](_0x13d0ea[_0x082e('0x4b')],_0x27d1d8[_0x082e('0x56')]));_0x3c56bc[_0x082e('0x55')][_0x082e('0x66')]=_0x52fa00['id'];if(_0x13d0ea[_0x082e('0x4b')]['filter']){_0x3c56bc['where']=_['merge'](_0x3c56bc['where'],{'$or':_[_0x082e('0x45')](_0x3c56bc['attributes'],function(_0x4b93c0){var _0x44b646={};_0x44b646[_0x4b93c0]={'$like':'%'+_0x13d0ea[_0x082e('0x4b')][_0x082e('0x59')]+'%'};return _0x44b646;})});}if(_0x13d0ea[_0x082e('0x4b')][_0x082e('0x97')]){var _0x48b582=_0x13d0ea[_0x082e('0x4b')][_0x082e('0x97')][_0x082e('0x98')](',');var _0x1e8fcc={};_0x1e8fcc[_0x48b582[0x0]]={'$gte':moment(_0x48b582[0x1])[_0x082e('0x99')](_0x082e('0x9a'))};_0x3c56bc[_0x082e('0x55')]=_['merge'](_0x3c56bc['where'],_0x1e8fcc);}_0x3c56bc=_[_0x082e('0x6a')]({},_0x3c56bc,_0x13d0ea[_0x082e('0x5a')]);return db[_0x082e('0x9b')][_0x082e('0x21')]({'where':_0x3c56bc[_0x082e('0x55')]})[_0x082e('0x11')](function(_0x141a08){_0xdb3f23[_0x082e('0x21')]=_0x141a08;if(_0x13d0ea[_0x082e('0x4b')][_0x082e('0x6b')]){_0x3c56bc[_0x082e('0x5e')]=[{'all':!![]}];}return db[_0x082e('0x9b')]['findAll'](_0x3c56bc);})[_0x082e('0x11')](function(_0xc140fe){if(_0x13d0ea[_0x082e('0x4b')][_0x082e('0x9c')]===_0x082e('0x9d')){for(var _0xa6f1d1=0x0;_0xa6f1d1<_0xc140fe[_0x082e('0x50')];_0xa6f1d1++){_0xc140fe[_0xa6f1d1][_0x082e('0x5f')]=juice(_0xc140fe[_0xa6f1d1][_0x082e('0x5f')]);}}_0xdb3f23['rows']=_0xc140fe;return _0xdb3f23;});}})['then'](respondWithFilteredResult(_0x1b99ba,_0x3c56bc))[_0x082e('0x1b')](handleError(_0x1b99ba,null));};exports[_0x082e('0x2a')]=function(_0x2606b3,_0x3b51cd){var _0x2cb79d,_0x32dc24={},_0x3490be;if(_0x2606b3[_0x082e('0x5f')]['to']){_0x3490be=_0x2606b3[_0x082e('0x5f')]['to'][_0x082e('0x98')](',')[0x0];}return db[_0x082e('0x5d')][_0x082e('0x6e')]({'where':{'id':_0x2606b3['params']['id']},'include':[{'model':db[_0x082e('0x9e')],'as':_0x082e('0x9f'),'include':[{'model':db[_0x082e('0x85')],'as':_0x082e('0xa0'),'where':{'email':_0x3490be},'limit':0x1,'order':[[_0x082e('0xa1'),_0x082e('0xa2')]]}]},{'model':db['MailServerOut'],'as':_0x082e('0x40'),'raw':!![],'include':[{'model':db[_0x082e('0xa3')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x3b51cd,null))[_0x082e('0x11')](function(_0x43fe3c){if(!_0x43fe3c)return;_0x2cb79d=_0x43fe3c;if(!_0x43fe3c[_0x082e('0x40')])throw new Error(_0x082e('0xa4'));if(_[_0x082e('0x74')](_0x2606b3[_0x082e('0x5f')][_0x082e('0xa5')])){_0x2606b3[_0x082e('0x5f')][_0x082e('0xa5')]=util[_0x082e('0x99')](_0x082e('0xa6'),_0x43fe3c[_0x082e('0x29')],_0x43fe3c[_0x082e('0xa7')]||_0x43fe3c[_0x082e('0x40')][_0x082e('0x34')]);}if(_0x2606b3[_0x082e('0x5f')]['attachments']&&_0x2606b3[_0x082e('0x5f')][_0x082e('0xa8')][_0x082e('0x50')]){for(var _0x4d6740=0x0;_0x4d6740<_0x2606b3['body'][_0x082e('0xa8')][_0x082e('0x50')];_0x4d6740+=0x1){_0x2606b3[_0x082e('0x5f')][_0x082e('0xa8')][_0x4d6740]={'filename':_0x2606b3['body'][_0x082e('0xa8')][_0x4d6740][_0x082e('0x29')],'path':path['join'](config[_0x082e('0xa9')],_0x082e('0xaa'),_0x2606b3[_0x082e('0x5f')][_0x082e('0xa8')][_0x4d6740]['basename'])};}}var _0x227989=_0x43fe3c[_0x082e('0xab')]();return respondWithRpcPromise(_0x082e('0xac'),_0x082e('0xad'),{'account':_0x227989,'message':_0x2606b3['body']});})[_0x082e('0x11')](function(_0x11217f){if(!_0x11217f)return;_0x32dc24=_0x11217f;if(!_0x2cb79d[_0x082e('0x9f')])throw new Error('List\x20not\x20found');if(_0x2cb79d[_0x082e('0x9f')][_0x082e('0xa0')][_0x082e('0x50')])return _0x2cb79d[_0x082e('0x9f')][_0x082e('0xa0')][0x0];return db[_0x082e('0x85')]['create'](_[_0x082e('0xa')](_0x2606b3[_0x082e('0x5f')],{'firstName':_0x2606b3['body']['to'],'email':_0x2606b3['body']['to'],'phone':_0x2606b3[_0x082e('0x5f')]['to'],'ListId':_0x2cb79d['ListId']}));})[_0x082e('0x11')](function(_0x6eef03){if(!_0x6eef03)return;var _0x598a24={'UserId':_0x2606b3[_0x082e('0x34')]['id'],'ContactId':_0x6eef03['id'],'MailAccountId':_0x2cb79d['id'],'inReplyTo':_0x32dc24['messageId'],'to':_0x2606b3[_0x082e('0x5f')][_0x082e('0xa5')],'cc':_0x2606b3[_0x082e('0x5f')]['cc'],'subject':_0x2606b3[_0x082e('0x5f')][_0x082e('0xae')],'attach':_0x2606b3[_0x082e('0x5f')][_0x082e('0xaf')],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0x082e('0x9a')),'lastMsgDirection':_0x082e('0xb0'),'Messages':[_[_0x082e('0x6a')](_0x2606b3[_0x082e('0x5f')],{'messageId':_0x32dc24[_0x082e('0xb1')],'sentAt':moment()[_0x082e('0x99')](_0x082e('0x9a')),'read':!![],'MailAccountId':_0x2cb79d['id'],'UserId':_0x2606b3[_0x082e('0x34')]['id'],'ContactId':_0x6eef03['id']})]};if(_0x2606b3[_0x082e('0x5f')][_0x082e('0xb2')]){_0x598a24=_[_0x082e('0x6a')](_0x598a24,_0x2606b3['body'][_0x082e('0xb2')]);}return db['MailInteraction'][_0x082e('0x68')](_0x598a24,{'include':[{'model':db['MailMessage'],'as':_0x082e('0xb3')}]});})[_0x082e('0x11')](respondWithResult(_0x3b51cd,null))['catch'](handleError(_0x3b51cd,null));};exports['verifySmtp']=function(_0x5d24f2,_0x3fca4c){return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x5d24f2[_0x082e('0x65')]['id']},'include':[{'model':db[_0x082e('0x43')],'as':_0x082e('0x40'),'raw':!![],'include':[{'model':db[_0x082e('0xa3')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x3fca4c,null))[_0x082e('0x11')](function(_0x31e6ee){if(!_0x31e6ee[_0x082e('0x40')])return;var _0x33b87b=_0x31e6ee[_0x082e('0xab')]();return respondWithRpcPromise(_0x082e('0xb4'),'verifySmtp',{'account':_0x33b87b});})[_0x082e('0x11')](respondWithResult(_0x3fca4c,null))['catch'](handleError(_0x3fca4c,null));};exports[_0x082e('0x27')]=function(_0x3a1ad5,_0x208e15){return db[_0x082e('0x5d')]['find']({'where':{'id':_0x3a1ad5['params']['id']}})['then'](handleEntityNotFound(_0x208e15,null))[_0x082e('0x11')](function(_0xee0eda){if(_0xee0eda&&_0xee0eda[_0x082e('0x3b')]){throw new db[(_0x082e('0xb5'))][(_0x082e('0xb6'))](_0x082e('0xb7'));}return _0xee0eda;})['then'](removeEntity(_0x208e15,null))[_0x082e('0x1b')](handleError(_0x208e15,null));};exports['addAgents']=function(_0x39c26b,_0x591fcb){return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x39c26b['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x591fcb,null))['then'](function(_0x23ce99){if(_0x23ce99){return _0x23ce99[_0x082e('0xb8')](_0x39c26b[_0x082e('0x5f')]['ids'],_[_0x082e('0x83')](_0x39c26b[_0x082e('0x5f')],[_0x082e('0x6f'),'id'])||{})[_0x082e('0xb9')](function(_0x22f2f8){for(var _0x210a20=0x0;_0x210a20<_0x39c26b[_0x082e('0x5f')][_0x082e('0x6f')]['length'];_0x210a20+=0x1){socket[_0x082e('0xba')](_0x082e('0xbb'),{'UserId':Number(_0x39c26b[_0x082e('0x5f')][_0x082e('0x6f')][_0x210a20]),'MailAccountId':Number(_0x39c26b[_0x082e('0x65')]['id'])});}return _0x22f2f8;});}})[_0x082e('0x11')](respondWithResult(_0x591fcb,null))[_0x082e('0x1b')](handleError(_0x591fcb,null));};exports[_0x082e('0xbc')]=function(_0x36bb91,_0x5e2d17){return db['MailAccount'][_0x082e('0x6e')]({'where':{'id':_0x36bb91['params']['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x5e2d17,null))[_0x082e('0x11')](function(_0x387529){if(_0x387529){return _0x387529[_0x082e('0xbc')](_0x36bb91[_0x082e('0x4b')][_0x082e('0x6f')])[_0x082e('0x11')](function(){if(_[_0x082e('0xbd')](_0x36bb91[_0x082e('0x4b')][_0x082e('0x6f')])){for(var _0x4abc15=0x0;_0x4abc15<_0x36bb91[_0x082e('0x4b')][_0x082e('0x6f')]['length'];_0x4abc15+=0x1){socket['emit'](_0x082e('0xbe'),{'UserId':Number(_0x36bb91[_0x082e('0x4b')]['ids'][_0x4abc15]),'MailAccountId':Number(_0x36bb91[_0x082e('0x65')]['id'])});}}else{socket[_0x082e('0xba')](_0x082e('0xbe'),{'UserId':Number(_0x36bb91[_0x082e('0x4b')]['ids']),'MailAccountId':Number(_0x36bb91[_0x082e('0x65')]['id'])});}});}})[_0x082e('0x11')](respondWithStatusCode(_0x5e2d17,null))['catch'](handleError(_0x5e2d17,null));};exports[_0x082e('0xbf')]=function(_0x244820,_0x33e52e){var _0x1bbdcb={};var _0x4f1155={};var _0xf7bc15;var _0x404732;return db['MailAccount']['findOne']({'where':{'id':_0x244820[_0x082e('0x65')]['id']}})[_0x082e('0x11')](handleEntityNotFound(_0x33e52e,null))[_0x082e('0x11')](function(_0xa22d89){if(_0xa22d89){_0xf7bc15=_0xa22d89;_0x4f1155[_0x082e('0x4a')]=_[_0x082e('0x4c')](db[_0x082e('0xc0')][_0x082e('0x46')]);_0x4f1155['query']=_[_0x082e('0x4c')](_0x244820['query']);_0x4f1155[_0x082e('0x56')]=_['intersection'](_0x4f1155[_0x082e('0x4a')],_0x4f1155[_0x082e('0x4b')]);_0x1bbdcb[_0x082e('0x4e')]=_[_0x082e('0x4d')](_0x4f1155[_0x082e('0x4a')],qs[_0x082e('0x4f')](_0x244820['query'][_0x082e('0x4f')]));_0x1bbdcb[_0x082e('0x4e')]=_0x1bbdcb[_0x082e('0x4e')]['length']?_0x1bbdcb[_0x082e('0x4e')]:_0x4f1155[_0x082e('0x4a')];_0x1bbdcb['order']=qs[_0x082e('0x54')](_0x244820['query']['sort']);_0x1bbdcb[_0x082e('0x55')]=qs[_0x082e('0x56')](_[_0x082e('0x57')](_0x244820[_0x082e('0x4b')],_0x4f1155[_0x082e('0x56')]));if(_0x244820[_0x082e('0x4b')][_0x082e('0x59')]){_0x1bbdcb[_0x082e('0x55')]=_[_0x082e('0x6a')](_0x1bbdcb[_0x082e('0x55')],{'$or':_[_0x082e('0x45')](_0x1bbdcb[_0x082e('0x4e')],function(_0x2f3df1){var _0x1844c3={};_0x1844c3[_0x2f3df1]={'$like':'%'+_0x244820['query'][_0x082e('0x59')]+'%'};return _0x1844c3;})});}_0x1bbdcb=_[_0x082e('0x6a')]({},_0x1bbdcb,_0x244820['options']);return _0xf7bc15[_0x082e('0xbf')](_0x1bbdcb);}})[_0x082e('0x11')](function(_0x2a14ee){if(_0x2a14ee){_0x404732=_0x2a14ee['length'];if(!_0x244820['query'][_0x082e('0x51')]('nolimit')){_0x1bbdcb[_0x082e('0x20')]=qs[_0x082e('0x20')](_0x244820[_0x082e('0x4b')][_0x082e('0x20')]);_0x1bbdcb[_0x082e('0x22')]=qs[_0x082e('0x22')](_0x244820['query']['offset']);}return _0xf7bc15[_0x082e('0xbf')](_0x1bbdcb);}})[_0x082e('0x11')](function(_0x3e95da){if(_0x3e95da){return _0x3e95da?{'count':_0x404732,'rows':_0x3e95da}:null;}})[_0x082e('0x11')](respondWithResult(_0x33e52e,null))[_0x082e('0x1b')](handleError(_0x33e52e,null));}; \ No newline at end of file +var _0xb6b9=['verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','removeAgents','emit','userMailAccount:remove','getAgents','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','destroy','get','UserProfileResource','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','smtp-mail.outlook.com','smtp.office365.com','user','username','password','modernAuthentication','CloudProviderId','pass','port','host','secure','service','authentication','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','includeAll','catch','params','MailServerIn','keys','include','find','body','provider','Mail\x20Account\x20not\x20found','addDisposition','MailAccountId','create','findOne','Disposition','nolimit','map','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','findAll','removeAnswers','custom','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','setSmtp','addInteraction','omit','getInteractions','MailInteraction','Contact','User','internal','Tag','Tags','color','tag','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','stack','finally','getApplications','getMessages','MailMessage','$gte','format','inlineCss','true','CmList','List','CmContact','DESC','CloudProvider','from','%s\x20<%s>','attachments','root','basename','SendMail','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','YYYY-MM-DD\x20HH:mm:ss','Interaction','Messages'];(function(_0x1c9cd3,_0x56f875){var _0x39f77a=function(_0x578ee6){while(--_0x578ee6){_0x1c9cd3['push'](_0x1c9cd3['shift']());}};_0x39f77a(++_0x56f875);}(_0xb6b9,0x189));var _0x9b6b=function(_0x127264,_0x20ff30){_0x127264=_0x127264-0x0;var _0x4daa79=_0xb6b9[_0x127264];return _0x4daa79;};'use strict';var moment=require(_0x9b6b('0x0'));var BPromise=require(_0x9b6b('0x1'));var util=require(_0x9b6b('0x2'));var path=require(_0x9b6b('0x3'));var _=require(_0x9b6b('0x4'));var juice=require('juice');var Redis=require(_0x9b6b('0x5'));var qs=require(_0x9b6b('0x6'));var logger=require(_0x9b6b('0x7'))(_0x9b6b('0x8'));var config=require(_0x9b6b('0x9'));var db=require(_0x9b6b('0xa'))['db'];config[_0x9b6b('0xb')]=_[_0x9b6b('0xc')](config['redis'],{'host':_0x9b6b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9b6b('0xb')]));require('./mailAccount.socket')[_0x9b6b('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9b6b('0xf')]['http']({'port':0x232b});function respondWithRpcPromise(_0x242ff8,_0x2f6721,_0xcffba9,_0x4824b3){return new BPromise(function(_0x3b4835,_0x7e23c6){var _0x13bd1d=_0x4824b3||client;return _0x13bd1d[_0x9b6b('0x10')](_0x242ff8,_0xcffba9)[_0x9b6b('0x11')](function(_0xb8672b){logger[_0x9b6b('0x12')](_0x9b6b('0x13'),_0x2f6721,'request\x20sent');logger[_0x9b6b('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2f6721,'request\x20sent',JSON[_0x9b6b('0x15')](_0xb8672b));if(_0xb8672b[_0x9b6b('0x16')]){if(_0xb8672b['error'][_0x9b6b('0x17')]===0x1f4){logger['error'](_0x9b6b('0x13'),_0x2f6721,_0xb8672b[_0x9b6b('0x16')][_0x9b6b('0x18')]);return _0x7e23c6(_0xb8672b[_0x9b6b('0x16')][_0x9b6b('0x18')]);}logger[_0x9b6b('0x16')](_0x9b6b('0x13'),_0x2f6721,_0xb8672b[_0x9b6b('0x16')][_0x9b6b('0x18')]);return _0x3b4835(_0xb8672b[_0x9b6b('0x16')]['message']);}else{logger['info'](_0x9b6b('0x13'),_0x2f6721,'request\x20sent');_0x3b4835(_0xb8672b[_0x9b6b('0x19')][_0x9b6b('0x18')]);}})['catch'](function(_0x488ed7){logger[_0x9b6b('0x16')](_0x9b6b('0x13'),_0x2f6721,_0x488ed7);_0x7e23c6(_0x488ed7);});});}function respondWithStatusCode(_0xc2ce4e,_0x15bcbb){_0x15bcbb=_0x15bcbb||0xcc;return function(_0x373b0f){if(_0x373b0f){return _0xc2ce4e[_0x9b6b('0x1a')](_0x15bcbb);}return _0xc2ce4e['status'](_0x15bcbb)[_0x9b6b('0x1b')]();};}function respondWithResult(_0x217740,_0x1300ae){_0x1300ae=_0x1300ae||0xc8;return function(_0x59e427){if(_0x59e427){return _0x217740[_0x9b6b('0x1c')](_0x1300ae)[_0x9b6b('0x1d')](_0x59e427);}};}function respondWithFilteredResult(_0x468a35,_0x5643fb){return function(_0x5bbf11){if(_0x5bbf11){var _0x3c2b88=typeof _0x5643fb[_0x9b6b('0x1e')]===_0x9b6b('0x1f')&&typeof _0x5643fb[_0x9b6b('0x20')]==='undefined';var _0x28d927=_0x5bbf11[_0x9b6b('0x21')];var _0x270594=_0x3c2b88?0x0:_0x5643fb['offset'];var _0x278cef=_0x3c2b88?_0x5bbf11[_0x9b6b('0x21')]:_0x5643fb['offset']+_0x5643fb[_0x9b6b('0x20')];var _0x521bfd;if(_0x278cef>=_0x28d927){_0x278cef=_0x28d927;_0x521bfd=0xc8;}else{_0x521bfd=0xce;}_0x468a35[_0x9b6b('0x1c')](_0x521bfd);return _0x468a35['set'](_0x9b6b('0x22'),_0x270594+'-'+_0x278cef+'/'+_0x28d927)[_0x9b6b('0x1d')](_0x5bbf11);}return null;};}function saveUpdates(_0x49411c){return function(_0x2c3604){if(_0x2c3604){return _0x2c3604[_0x9b6b('0x23')](_0x49411c)['then'](function(_0x5d9d1e){return _0x5d9d1e;});}return null;};}function removeEntity(_0x423c3a){return function(_0x38561f){if(_0x38561f){return _0x38561f[_0x9b6b('0x24')]()[_0x9b6b('0x11')](function(){var _0x35f145=_0x38561f[_0x9b6b('0x25')]({'plain':!![]});var _0x53ee14='MailAccounts';return db[_0x9b6b('0x26')][_0x9b6b('0x24')]({'where':{'type':_0x53ee14,'resourceId':_0x35f145['id']}})[_0x9b6b('0x11')](function(){return _0x38561f;});})[_0x9b6b('0x11')](function(){_0x423c3a[_0x9b6b('0x1c')](0xcc)[_0x9b6b('0x1b')]();});}};}function handleEntityNotFound(_0x1292df){return function(_0x1a8469){if(!_0x1a8469){_0x1292df['sendStatus'](0x194);}return _0x1a8469;};}function handleError(_0x408203,_0x3dfe9d){_0x3dfe9d=_0x3dfe9d||0x1f4;return function(_0xe54f04){logger['error'](_0xe54f04['stack']);if(_0xe54f04['name']){delete _0xe54f04[_0x9b6b('0x27')];}_0x408203[_0x9b6b('0x1c')](_0x3dfe9d)[_0x9b6b('0x28')](_0xe54f04);};}function getImapHost(_0x236c67){switch(_0x236c67){case'gmail':return _0x9b6b('0x29');case _0x9b6b('0x2a'):return _0x9b6b('0x2b');case'hotmail':return _0x9b6b('0x2c');case _0x9b6b('0x2d'):return _0x9b6b('0x2e');}throw new Error(_0x9b6b('0x2f'),_0x236c67);}function getSmtpHost(_0x281c31){switch(_0x281c31){case _0x9b6b('0x30'):return _0x9b6b('0x31');case _0x9b6b('0x2a'):return _0x9b6b('0x32');case _0x9b6b('0x33'):return _0x9b6b('0x34');case _0x9b6b('0x2d'):return _0x9b6b('0x35');}throw new Error('Unknown\x20email\x20service\x20provider',_0x281c31);}function getAuthenticationOptions(_0x57ea29,_0x1f05a2){var _0x2df440={};var _0x1499c8={};if(_0x57ea29){_0x2df440[_0x9b6b('0x36')]=_0x1499c8[_0x9b6b('0x36')]=_0x1f05a2[_0x9b6b('0x37')];_0x2df440[_0x9b6b('0x38')]=_0x1499c8['pass']=_0x1f05a2[_0x9b6b('0x38')];if(_0x1f05a2[_0x9b6b('0x39')]){_0x2df440['modernAuthentication']=_0x1499c8[_0x9b6b('0x39')]=!![];_0x2df440[_0x9b6b('0x3a')]=_0x1499c8[_0x9b6b('0x3a')]=_0x1f05a2['CloudProviderId'];_0x2df440[_0x9b6b('0x38')]=_0x1499c8[_0x9b6b('0x3b')]=null;}else{_0x2df440[_0x9b6b('0x3a')]=_0x1499c8['CloudProviderId']=null;}_0x2df440['host']=getImapHost(_0x57ea29);_0x2df440[_0x9b6b('0x3c')]=0x3e1;_0x1499c8[_0x9b6b('0x3d')]=getSmtpHost(_0x57ea29);_0x1499c8[_0x9b6b('0x3c')]=0x24b;_0x1499c8[_0x9b6b('0x3e')]=![];_0x2df440['service']=_0x1499c8[_0x9b6b('0x3f')]=null;}else{if(_0x1f05a2[_0x9b6b('0x40')]){_0x2df440['user']=_0x1499c8[_0x9b6b('0x36')]=_0x1f05a2[_0x9b6b('0x37')];_0x2df440[_0x9b6b('0x38')]=_0x1499c8['pass']=_0x1f05a2[_0x9b6b('0x38')];}else{_0x2df440[_0x9b6b('0x40')]=_0x1499c8[_0x9b6b('0x40')]=![];_0x2df440[_0x9b6b('0x36')]=_0x1499c8[_0x9b6b('0x36')]=null;_0x2df440[_0x9b6b('0x38')]=_0x1499c8['pass']=null;}_0x2df440[_0x9b6b('0x3d')]=_0x1f05a2[_0x9b6b('0x41')]['host'];_0x2df440['port']=_0x1f05a2['Imap']['port'];_0x1499c8[_0x9b6b('0x3d')]=_0x1f05a2[_0x9b6b('0x42')][_0x9b6b('0x3d')];_0x1499c8[_0x9b6b('0x3c')]=_0x1f05a2[_0x9b6b('0x42')][_0x9b6b('0x3c')];}return{'Imap':_0x2df440,'Smtp':_0x1499c8};}exports[_0x9b6b('0x43')]=function(_0x2a4c0b,_0x5db46){var _0x7798a7={'include':[{'model':db['MailServerIn'],'as':_0x9b6b('0x41')},{'model':db[_0x9b6b('0x44')],'as':_0x9b6b('0x42')},{'model':db[_0x9b6b('0x45')],'as':_0x9b6b('0x46')}]},_0x1552cd={},_0x2a7ee5={'count':0x0,'rows':[]};var _0x419006=_['map'](db[_0x9b6b('0x47')][_0x9b6b('0x48')],function(_0x137c75){return{'name':_0x137c75[_0x9b6b('0x49')],'type':_0x137c75[_0x9b6b('0x4a')][_0x9b6b('0x4b')]};});_0x1552cd[_0x9b6b('0x4c')]=_['map'](_0x419006,_0x9b6b('0x27'));_0x1552cd[_0x9b6b('0x4d')]=_['keys'](_0x2a4c0b['query']);_0x1552cd[_0x9b6b('0x4e')]=_[_0x9b6b('0x4f')](_0x1552cd[_0x9b6b('0x4c')],_0x1552cd[_0x9b6b('0x4d')]);_0x7798a7[_0x9b6b('0x50')]=_['intersection'](_0x1552cd[_0x9b6b('0x4c')],qs[_0x9b6b('0x51')](_0x2a4c0b[_0x9b6b('0x4d')]['fields']));_0x7798a7[_0x9b6b('0x50')]=_0x7798a7[_0x9b6b('0x50')][_0x9b6b('0x52')]?_0x7798a7['attributes']:_0x1552cd[_0x9b6b('0x4c')];if(!_0x2a4c0b['query']['hasOwnProperty']('nolimit')){_0x7798a7[_0x9b6b('0x20')]=qs[_0x9b6b('0x20')](_0x2a4c0b['query']['limit']);_0x7798a7['offset']=qs[_0x9b6b('0x1e')](_0x2a4c0b[_0x9b6b('0x4d')][_0x9b6b('0x1e')]);}_0x7798a7[_0x9b6b('0x53')]=qs[_0x9b6b('0x54')](_0x2a4c0b['query'][_0x9b6b('0x54')]);_0x7798a7['where']=qs['filters'](_[_0x9b6b('0x55')](_0x2a4c0b['query'],_0x1552cd['filters']),_0x419006);if(_0x2a4c0b[_0x9b6b('0x4d')][_0x9b6b('0x56')]){_0x7798a7[_0x9b6b('0x57')]=_[_0x9b6b('0x58')](_0x7798a7[_0x9b6b('0x57')],{'$or':_['map'](_0x419006,function(_0xeda203){if(_0xeda203[_0x9b6b('0x4a')]!=='VIRTUAL'){var _0x4c044a={};_0x4c044a[_0xeda203[_0x9b6b('0x27')]]={'$like':'%'+_0x2a4c0b[_0x9b6b('0x4d')][_0x9b6b('0x56')]+'%'};return _0x4c044a;}})});}_0x7798a7=_[_0x9b6b('0x58')]({},_0x7798a7,_0x2a4c0b[_0x9b6b('0x59')]);var _0x5c2591={'where':_0x7798a7[_0x9b6b('0x57')]};return db[_0x9b6b('0x47')]['count'](_0x5c2591)[_0x9b6b('0x11')](function(_0xa22f9){_0x2a7ee5[_0x9b6b('0x21')]=_0xa22f9;if(_0x2a4c0b['query'][_0x9b6b('0x5a')]){_0x7798a7['include']=[{'all':!![]}];}return db['MailAccount']['findAll'](_0x7798a7);})['then'](function(_0x90f99e){_0x2a7ee5['rows']=_0x90f99e;return _0x2a7ee5;})[_0x9b6b('0x11')](respondWithFilteredResult(_0x5db46,_0x7798a7))[_0x9b6b('0x5b')](handleError(_0x5db46,null));};exports['show']=function(_0x4845b6,_0x5a4b0f){var _0x560e39={'raw':![],'where':{'id':_0x4845b6[_0x9b6b('0x5c')]['id']},'include':[{'model':db[_0x9b6b('0x5d')],'as':'Imap'},{'model':db[_0x9b6b('0x44')],'as':_0x9b6b('0x42')},{'model':db[_0x9b6b('0x45')],'as':'mandatoryDispositionPause'}]},_0x2aa263={};_0x2aa263[_0x9b6b('0x4c')]=_['keys'](db[_0x9b6b('0x47')][_0x9b6b('0x48')]);_0x2aa263[_0x9b6b('0x4d')]=_[_0x9b6b('0x5e')](_0x4845b6[_0x9b6b('0x4d')]);_0x2aa263[_0x9b6b('0x4e')]=_[_0x9b6b('0x4f')](_0x2aa263['model'],_0x2aa263['query']);_0x560e39[_0x9b6b('0x50')]=_[_0x9b6b('0x4f')](_0x2aa263[_0x9b6b('0x4c')],qs[_0x9b6b('0x51')](_0x4845b6['query'][_0x9b6b('0x51')]));_0x560e39[_0x9b6b('0x50')]=_0x560e39[_0x9b6b('0x50')]['length']?_0x560e39[_0x9b6b('0x50')]:_0x2aa263['model'];if(_0x4845b6[_0x9b6b('0x4d')][_0x9b6b('0x5a')]){_0x560e39[_0x9b6b('0x5f')]=[{'all':!![]}];}_0x560e39=_['merge']({},_0x560e39,_0x4845b6[_0x9b6b('0x59')]);return db['MailAccount'][_0x9b6b('0x60')](_0x560e39)[_0x9b6b('0x11')](handleEntityNotFound(_0x5a4b0f,null))[_0x9b6b('0x11')](respondWithResult(_0x5a4b0f,null))[_0x9b6b('0x5b')](handleError(_0x5a4b0f,null));};exports[_0x9b6b('0x23')]=function(_0x1d330e,_0x3a49f8){if(_0x1d330e[_0x9b6b('0x61')]['id']){delete _0x1d330e[_0x9b6b('0x61')]['id'];}var _0x50feec=_0x1d330e[_0x9b6b('0x61')][_0x9b6b('0x62')]==='custom'?null:_0x1d330e['body'][_0x9b6b('0x62')];var _0x3278a4=_0x1d330e['body'][_0x9b6b('0x41')]||{};var _0x1a1adb=_0x1d330e['body'][_0x9b6b('0x42')]||{};if(_0x50feec){_0x3278a4[_0x9b6b('0x3d')]=getImapHost(_0x50feec);_0x3278a4['port']=0x3e1;_0x1a1adb[_0x9b6b('0x3d')]=getSmtpHost(_0x50feec);_0x1a1adb[_0x9b6b('0x3c')]=0x24b;_0x1a1adb['secure']=![];}if(_0x1a1adb[_0x9b6b('0x39')]){_0x1a1adb[_0x9b6b('0x3e')]=![];}else{_0x1a1adb[_0x9b6b('0x3a')]=null;}if(!_0x3278a4[_0x9b6b('0x39')])_0x3278a4['CloudProviderId']=null;_0x1d330e[_0x9b6b('0x61')]['Imap']=_0x3278a4;_0x1d330e[_0x9b6b('0x61')]['Smtp']=_0x1a1adb;return db[_0x9b6b('0x47')][_0x9b6b('0x60')]({'where':{'id':_0x1d330e['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0x9b6b('0x41')},{'model':db[_0x9b6b('0x44')],'as':'Smtp'},{'model':db[_0x9b6b('0x45')],'as':'mandatoryDispositionPause'}]})[_0x9b6b('0x11')](handleEntityNotFound(_0x3a49f8,null))['then'](function(_0xb9d145){if(!_0xb9d145)throw new Error(_0x9b6b('0x63'));if(_0xb9d145[_0x9b6b('0x3f')])delete _0x1d330e[_0x9b6b('0x61')][_0x9b6b('0x41')];return _0xb9d145;})[_0x9b6b('0x11')](saveUpdates(_0x1d330e['body'],null))[_0x9b6b('0x11')](function(_0x4cef92){if(!_0x1d330e[_0x9b6b('0x61')]['Imap'])return _0x4cef92;return db[_0x9b6b('0x5d')][_0x9b6b('0x23')](_0x1d330e[_0x9b6b('0x61')][_0x9b6b('0x41')],{'where':{'MailAccountId':_0x4cef92['id']}})[_0x9b6b('0x11')](function(){return _0x4cef92;});})['then'](function(_0x638bff){if(!_0x1d330e[_0x9b6b('0x61')][_0x9b6b('0x42')])return _0x638bff;return db['MailServerOut'][_0x9b6b('0x23')](_0x1d330e[_0x9b6b('0x61')][_0x9b6b('0x42')],{'where':{'MailAccountId':_0x638bff['id']}})['then'](function(){return _0x638bff;});})[_0x9b6b('0x11')](respondWithResult(_0x3a49f8,null))['catch'](handleError(_0x3a49f8,null));};exports['describe']=function(_0x22e94b,_0x33b3c6){return db[_0x9b6b('0x47')]['describe']()[_0x9b6b('0x11')](respondWithResult(_0x33b3c6,null))[_0x9b6b('0x5b')](handleError(_0x33b3c6,null));};exports[_0x9b6b('0x64')]=function(_0x3985ff,_0xc0c6fb){if(_0x3985ff['body']['id']){delete _0x3985ff[_0x9b6b('0x61')]['id'];}return db['MailAccount'][_0x9b6b('0x60')]({'where':{'id':_0x3985ff[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0xc0c6fb,null))[_0x9b6b('0x11')](function(_0x35fe2b){if(_0x35fe2b){_0x3985ff[_0x9b6b('0x61')][_0x9b6b('0x65')]=_0x35fe2b['id'];return db['Disposition'][_0x9b6b('0x66')](_0x3985ff[_0x9b6b('0x61')]);}})[_0x9b6b('0x11')](respondWithResult(_0xc0c6fb,null))[_0x9b6b('0x5b')](handleError(_0xc0c6fb,null));};exports['getDispositions']=function(_0x513fc5,_0x392e1a){var _0x4d62a1={'raw':![],'where':{}};var _0x5f5347={};var _0x4a5869={'count':0x0,'rows':[]};return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x513fc5[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x392e1a,null))['then'](function(_0x168ab8){if(_0x168ab8){_0x5f5347[_0x9b6b('0x4c')]=_[_0x9b6b('0x5e')](db[_0x9b6b('0x68')][_0x9b6b('0x48')]);_0x5f5347['query']=_[_0x9b6b('0x5e')](_0x513fc5['query']);_0x5f5347['filters']=_[_0x9b6b('0x4f')](_0x5f5347[_0x9b6b('0x4c')],_0x5f5347['query']);_0x4d62a1[_0x9b6b('0x50')]=_['intersection'](_0x5f5347[_0x9b6b('0x4c')],qs[_0x9b6b('0x51')](_0x513fc5[_0x9b6b('0x4d')][_0x9b6b('0x51')]));_0x4d62a1[_0x9b6b('0x50')]=_0x4d62a1['attributes']['length']?_0x4d62a1['attributes']:_0x5f5347[_0x9b6b('0x4c')];if(!_0x513fc5[_0x9b6b('0x4d')]['hasOwnProperty'](_0x9b6b('0x69'))){_0x4d62a1[_0x9b6b('0x20')]=qs['limit'](_0x513fc5[_0x9b6b('0x4d')][_0x9b6b('0x20')]);_0x4d62a1['offset']=qs[_0x9b6b('0x1e')](_0x513fc5['query'][_0x9b6b('0x1e')]);}_0x4d62a1[_0x9b6b('0x53')]=qs['sort'](_0x513fc5[_0x9b6b('0x4d')][_0x9b6b('0x54')]);_0x4d62a1[_0x9b6b('0x57')]=qs[_0x9b6b('0x4e')](_[_0x9b6b('0x55')](_0x513fc5[_0x9b6b('0x4d')],_0x5f5347[_0x9b6b('0x4e')]));_0x4d62a1['where'][_0x9b6b('0x65')]=_0x168ab8['id'];if(_0x513fc5[_0x9b6b('0x4d')]['filter']){_0x4d62a1['where']=_[_0x9b6b('0x58')](_0x4d62a1['where'],{'$or':_[_0x9b6b('0x6a')](_0x4d62a1[_0x9b6b('0x50')],function(_0x183537){var _0x185c3e={};_0x185c3e[_0x183537]={'$like':'%'+_0x513fc5['query'][_0x9b6b('0x56')]+'%'};return _0x185c3e;})});}_0x4d62a1=_[_0x9b6b('0x58')]({},_0x4d62a1,_0x513fc5[_0x9b6b('0x59')]);return db[_0x9b6b('0x68')][_0x9b6b('0x21')]({'where':_0x4d62a1[_0x9b6b('0x57')]})[_0x9b6b('0x11')](function(_0x179367){_0x4a5869[_0x9b6b('0x21')]=_0x179367;if(_0x513fc5[_0x9b6b('0x4d')]['includeAll']){_0x4d62a1[_0x9b6b('0x5f')]=[{'all':!![]}];}return db[_0x9b6b('0x68')]['findAll'](_0x4d62a1);})[_0x9b6b('0x11')](function(_0x24fe32){_0x4a5869[_0x9b6b('0x6b')]=_0x24fe32;return _0x4a5869;});}})['then'](respondWithFilteredResult(_0x392e1a,_0x4d62a1))[_0x9b6b('0x5b')](handleError(_0x392e1a,null));};exports[_0x9b6b('0x6c')]=function(_0x306bda,_0x559699){return db[_0x9b6b('0x47')]['find']({'where':{'id':_0x306bda[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x559699,null))[_0x9b6b('0x11')](function(_0x2d6396){if(_0x2d6396){return _0x2d6396[_0x9b6b('0x6c')](_0x306bda[_0x9b6b('0x4d')][_0x9b6b('0x6d')]);}})[_0x9b6b('0x11')](respondWithStatusCode(_0x559699,null))[_0x9b6b('0x5b')](handleError(_0x559699,null));};exports[_0x9b6b('0x6e')]=function(_0x25dbe6,_0x5ba539){if(_0x25dbe6[_0x9b6b('0x61')]['id']){delete _0x25dbe6[_0x9b6b('0x61')]['id'];}return db[_0x9b6b('0x47')][_0x9b6b('0x60')]({'where':{'id':_0x25dbe6[_0x9b6b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5ba539,null))[_0x9b6b('0x11')](function(_0x4aad78){if(_0x4aad78){_0x25dbe6[_0x9b6b('0x61')][_0x9b6b('0x65')]=_0x4aad78['id'];return db[_0x9b6b('0x6f')][_0x9b6b('0x66')](_0x25dbe6[_0x9b6b('0x61')]);}})['then'](respondWithResult(_0x5ba539,null))[_0x9b6b('0x5b')](handleError(_0x5ba539,null));};exports[_0x9b6b('0x70')]=function(_0x13f945,_0x19e5c0){var _0x8d9593={'raw':![],'where':{}};var _0x2ec8a3={};var _0x90f554={'count':0x0,'rows':[]};return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x13f945[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x19e5c0,null))[_0x9b6b('0x11')](function(_0x537dec){if(_0x537dec){_0x2ec8a3[_0x9b6b('0x4c')]=_[_0x9b6b('0x5e')](db[_0x9b6b('0x6f')][_0x9b6b('0x48')]);_0x2ec8a3['query']=_['keys'](_0x13f945[_0x9b6b('0x4d')]);_0x2ec8a3['filters']=_[_0x9b6b('0x4f')](_0x2ec8a3[_0x9b6b('0x4c')],_0x2ec8a3[_0x9b6b('0x4d')]);_0x8d9593['attributes']=_[_0x9b6b('0x4f')](_0x2ec8a3[_0x9b6b('0x4c')],qs[_0x9b6b('0x51')](_0x13f945[_0x9b6b('0x4d')][_0x9b6b('0x51')]));_0x8d9593[_0x9b6b('0x50')]=_0x8d9593[_0x9b6b('0x50')][_0x9b6b('0x52')]?_0x8d9593[_0x9b6b('0x50')]:_0x2ec8a3[_0x9b6b('0x4c')];if(!_0x13f945[_0x9b6b('0x4d')][_0x9b6b('0x71')]('nolimit')){_0x8d9593['limit']=qs[_0x9b6b('0x20')](_0x13f945[_0x9b6b('0x4d')][_0x9b6b('0x20')]);_0x8d9593[_0x9b6b('0x1e')]=qs[_0x9b6b('0x1e')](_0x13f945['query'][_0x9b6b('0x1e')]);}_0x8d9593[_0x9b6b('0x53')]=qs[_0x9b6b('0x54')](_0x13f945['query'][_0x9b6b('0x54')]);_0x8d9593['where']=qs[_0x9b6b('0x4e')](_[_0x9b6b('0x55')](_0x13f945['query'],_0x2ec8a3[_0x9b6b('0x4e')]));_0x8d9593[_0x9b6b('0x57')][_0x9b6b('0x65')]=_0x537dec['id'];if(_0x13f945[_0x9b6b('0x4d')][_0x9b6b('0x56')]){_0x8d9593['where']=_[_0x9b6b('0x58')](_0x8d9593['where'],{'$or':_[_0x9b6b('0x6a')](_0x8d9593[_0x9b6b('0x50')],function(_0x1f453c){var _0x36139e={};_0x36139e[_0x1f453c]={'$like':'%'+_0x13f945[_0x9b6b('0x4d')][_0x9b6b('0x56')]+'%'};return _0x36139e;})});}_0x8d9593=_[_0x9b6b('0x58')]({},_0x8d9593,_0x13f945[_0x9b6b('0x59')]);return db['CannedAnswer'][_0x9b6b('0x21')]({'where':_0x8d9593[_0x9b6b('0x57')]})[_0x9b6b('0x11')](function(_0x2927f3){_0x90f554['count']=_0x2927f3;if(_0x13f945[_0x9b6b('0x4d')][_0x9b6b('0x5a')]){_0x8d9593['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x9b6b('0x72')](_0x8d9593);})[_0x9b6b('0x11')](function(_0x53b372){_0x90f554[_0x9b6b('0x6b')]=_0x53b372;return _0x90f554;});}})[_0x9b6b('0x11')](respondWithFilteredResult(_0x19e5c0,_0x8d9593))[_0x9b6b('0x5b')](handleError(_0x19e5c0,null));};exports[_0x9b6b('0x73')]=function(_0x9ab0fa,_0x167a2b){return db['MailAccount'][_0x9b6b('0x60')]({'where':{'id':_0x9ab0fa[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x167a2b,null))['then'](function(_0x55d6d3){if(_0x55d6d3){return _0x55d6d3['removeAnswers'](_0x9ab0fa[_0x9b6b('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x167a2b,null))[_0x9b6b('0x5b')](handleError(_0x167a2b,null));};exports[_0x9b6b('0x66')]=function(_0x3eedf6,_0x5e01e0){var _0x5eba2f={'name':_0x3eedf6[_0x9b6b('0x61')][_0x9b6b('0x27')],'key':_0x3eedf6[_0x9b6b('0x61')]['key'],'provider':_0x3eedf6['body'][_0x9b6b('0x62')]===_0x9b6b('0x74')?null:_0x3eedf6[_0x9b6b('0x61')]['provider'],'email':_0x3eedf6[_0x9b6b('0x61')][_0x9b6b('0x75')],'ListId':_0x3eedf6[_0x9b6b('0x61')][_0x9b6b('0x76')],'active':!_[_0x9b6b('0x77')](_0x3eedf6['body'][_0x9b6b('0x78')])?_0x3eedf6[_0x9b6b('0x61')][_0x9b6b('0x78')]:!![],'description':_0x3eedf6[_0x9b6b('0x61')][_0x9b6b('0x79')]||null};var _0x4ec4fd=getAuthenticationOptions(_0x5eba2f[_0x9b6b('0x62')],_0x3eedf6['body']);_0x5eba2f['Imap']=_0x4ec4fd[_0x9b6b('0x41')];_0x5eba2f['Smtp']=_0x4ec4fd[_0x9b6b('0x42')];return db[_0x9b6b('0x47')][_0x9b6b('0x66')](_0x5eba2f,{'include':[{'model':db[_0x9b6b('0x44')],'as':'Smtp'},{'model':db[_0x9b6b('0x5d')],'as':_0x9b6b('0x41')}]})[_0x9b6b('0x11')](function(_0x1cb70d){var _0x128109=_0x3eedf6[_0x9b6b('0x36')]['get']({'plain':!![]});if(!_0x128109)throw new Error(_0x9b6b('0x7a'));if(_0x128109['role']===_0x9b6b('0x36')){var _0x14d796=_0x1cb70d[_0x9b6b('0x25')]({'plain':!![]});return db[_0x9b6b('0x7b')][_0x9b6b('0x60')]({'where':{'name':'MailAccounts','userProfileId':_0x128109[_0x9b6b('0x7c')]},'raw':!![]})[_0x9b6b('0x11')](function(_0x1f43b1){if(_0x1f43b1&&_0x1f43b1[_0x9b6b('0x7d')]===0x0){return db[_0x9b6b('0x26')]['create']({'name':_0x14d796[_0x9b6b('0x27')],'resourceId':_0x14d796['id'],'type':_0x1f43b1['name'],'sectionId':_0x1f43b1['id']},{})[_0x9b6b('0x11')](function(){return _0x1cb70d;});}else{return _0x1cb70d;}})['catch'](function(_0x280a2e){logger[_0x9b6b('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x280a2e);throw _0x280a2e;});}return _0x1cb70d;})[_0x9b6b('0x11')](respondWithResult(_0x5e01e0,0xc9))[_0x9b6b('0x5b')](handleError(_0x5e01e0,null));};exports[_0x9b6b('0x7e')]=function(_0x35cfb0,_0x248c2e){return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x35cfb0[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x248c2e,null))[_0x9b6b('0x11')](function(_0x4ddbe3){if(_0x4ddbe3){return _0x4ddbe3[_0x9b6b('0x7e')]();}return null;})['then'](respondWithResult(_0x248c2e,null))[_0x9b6b('0x5b')](handleError(_0x248c2e,null));};exports[_0x9b6b('0x7f')]=function(_0x195bab,_0x1539d8){if(_0x195bab[_0x9b6b('0x61')]['id']){delete _0x195bab[_0x9b6b('0x61')]['id'];}return db[_0x9b6b('0x47')]['find']({'where':{'id':_0x195bab[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x1539d8,null))[_0x9b6b('0x11')](function(_0x59c449){if(_0x59c449){_0x195bab['body'][_0x9b6b('0x65')]=_0x59c449['id'];return db['MailServerIn'][_0x9b6b('0x66')](_0x195bab[_0x9b6b('0x61')]);}})['then'](respondWithResult(_0x1539d8,null))[_0x9b6b('0x5b')](handleError(_0x1539d8,null));};exports[_0x9b6b('0x80')]=function(_0x249037,_0x447dba){return db[_0x9b6b('0x47')]['findOne']({'where':{'id':_0x249037[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x447dba,null))[_0x9b6b('0x11')](function(_0x57cc7c){if(_0x57cc7c){return _0x57cc7c[_0x9b6b('0x81')](null);}return null;})[_0x9b6b('0x11')](respondWithStatusCode(_0x447dba,null))[_0x9b6b('0x5b')](handleError(_0x447dba,null));};exports[_0x9b6b('0x82')]=function(_0x361ac1,_0x12c89e){return db['MailAccount'][_0x9b6b('0x67')]({'where':{'id':_0x361ac1[_0x9b6b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x12c89e,null))[_0x9b6b('0x11')](function(_0x5e32d5){if(_0x5e32d5){return _0x5e32d5[_0x9b6b('0x82')]();}return null;})[_0x9b6b('0x11')](respondWithResult(_0x12c89e,null))[_0x9b6b('0x5b')](handleError(_0x12c89e,null));};exports[_0x9b6b('0x83')]=function(_0x50cee7,_0x21406a){if(_0x50cee7[_0x9b6b('0x61')]['id']){delete _0x50cee7[_0x9b6b('0x61')]['id'];}return db['MailAccount'][_0x9b6b('0x60')]({'where':{'id':_0x50cee7['params']['id']}})['then'](handleEntityNotFound(_0x21406a,null))[_0x9b6b('0x11')](function(_0x19e935){if(_0x19e935){_0x50cee7[_0x9b6b('0x61')][_0x9b6b('0x65')]=_0x19e935['id'];return db[_0x9b6b('0x44')][_0x9b6b('0x66')](_0x50cee7[_0x9b6b('0x61')]);}})['then'](respondWithResult(_0x21406a,null))[_0x9b6b('0x5b')](handleError(_0x21406a,null));};exports['removeSmtp']=function(_0x26997f,_0x8f32fb){return db['MailAccount'][_0x9b6b('0x67')]({'where':{'id':_0x26997f[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x8f32fb,null))[_0x9b6b('0x11')](function(_0x328410){if(_0x328410){return _0x328410[_0x9b6b('0x84')](null);}return null;})['then'](respondWithStatusCode(_0x8f32fb,null))[_0x9b6b('0x5b')](handleError(_0x8f32fb,null));};exports[_0x9b6b('0x85')]=function(_0xc8af65,_0x500b28){return db['MailInteraction'][_0x9b6b('0x60')]({'where':{'id':_0xc8af65['params']['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x500b28,null))['then'](function(_0x17d9ed){if(_0x17d9ed){return _0x17d9ed['addInteraction'](_0xc8af65[_0x9b6b('0x61')][_0x9b6b('0x6d')],_[_0x9b6b('0x86')](_0xc8af65[_0x9b6b('0x61')],[_0x9b6b('0x6d'),'id'])||{});}})[_0x9b6b('0x11')](respondWithResult(_0x500b28,null))[_0x9b6b('0x5b')](handleError(_0x500b28,null));};exports[_0x9b6b('0x87')]=function(_0x115636,_0x559480){var _0x167bd5={'raw':![],'where':{}};var _0x2e794b={};var _0xf1355a={'count':0x0,'rows':[]};return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x115636[_0x9b6b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x559480,null))[_0x9b6b('0x11')](function(_0x17a8f0){if(_0x17a8f0){_0x2e794b[_0x9b6b('0x4c')]=_['keys'](db[_0x9b6b('0x88')][_0x9b6b('0x48')]);_0x2e794b[_0x9b6b('0x4d')]=_['keys'](_0x115636[_0x9b6b('0x4d')]);_0x2e794b[_0x9b6b('0x4e')]=_[_0x9b6b('0x4f')](_0x2e794b['model'],_0x2e794b['query']);_0x167bd5[_0x9b6b('0x50')]=_['intersection'](_0x2e794b['model'],qs[_0x9b6b('0x51')](_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x51')]));_0x167bd5['attributes']=_0x167bd5['attributes']['length']?_0x167bd5[_0x9b6b('0x50')]:_0x2e794b[_0x9b6b('0x4c')];if(!_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x71')]('nolimit')){_0x167bd5[_0x9b6b('0x20')]=qs[_0x9b6b('0x20')](_0x115636[_0x9b6b('0x4d')]['limit']);_0x167bd5[_0x9b6b('0x1e')]=qs[_0x9b6b('0x1e')](_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x1e')]);}_0x167bd5['order']=qs[_0x9b6b('0x54')](_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x54')]);_0x167bd5[_0x9b6b('0x57')]=qs[_0x9b6b('0x4e')](_[_0x9b6b('0x55')](_0x115636[_0x9b6b('0x4d')],_0x2e794b['filters']));_0x167bd5[_0x9b6b('0x57')]['MailAccountId']=_0x17a8f0['id'];if(_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x56')]){_0x167bd5[_0x9b6b('0x57')]=_['merge'](_0x167bd5[_0x9b6b('0x57')],{'$or':_[_0x9b6b('0x6a')](_0x167bd5[_0x9b6b('0x50')],function(_0x40b429){var _0x4721bf={};_0x4721bf[_0x40b429]={'$like':'%'+_0x115636[_0x9b6b('0x4d')]['filter']+'%'};return _0x4721bf;})});}_0x167bd5=_[_0x9b6b('0x58')]({},_0x167bd5,_0x115636[_0x9b6b('0x59')]);return db[_0x9b6b('0x88')][_0x9b6b('0x21')]({'where':_0x167bd5[_0x9b6b('0x57')]})[_0x9b6b('0x11')](function(_0x4d3225){_0xf1355a[_0x9b6b('0x21')]=_0x4d3225;if(_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x5a')]){_0x167bd5['include']=[{'model':db['CmContact'],'as':_0x9b6b('0x89'),'required':![]},{'model':db[_0x9b6b('0x8a')],'as':'Owner','attributes':[_0x9b6b('0x27'),'fullname',_0x9b6b('0x8b')],'required':![]},{'model':db[_0x9b6b('0x8c')],'as':_0x9b6b('0x8d'),'attributes':['id',_0x9b6b('0x27'),_0x9b6b('0x8e')],'where':_0x115636['query'][_0x9b6b('0x8f')]?{'id':_0x115636[_0x9b6b('0x4d')]['tag']}:undefined,'required':_0x115636[_0x9b6b('0x4d')][_0x9b6b('0x8f')]?!![]:![]}];}return db['MailInteraction']['findAll'](_0x167bd5);})[_0x9b6b('0x11')](function(_0x1f3b01){_0xf1355a[_0x9b6b('0x6b')]=_0x1f3b01;return _0xf1355a;});}})[_0x9b6b('0x11')](respondWithFilteredResult(_0x559480,_0x167bd5))[_0x9b6b('0x5b')](handleError(_0x559480,null));};exports[_0x9b6b('0x90')]=function addApplications(_0x9a79b0,_0x41fbd5){var _0x5b9257=_0x9a79b0[_0x9b6b('0x5c')]['id'];var _0x82bd27=_0x9a79b0[_0x9b6b('0x61')];var _0x54f9c4=0xc8;var _0x4413ee=null;return db['sequelize'][_0x9b6b('0x91')]({'isolationLevel':db[_0x9b6b('0x92')]['Transaction'][_0x9b6b('0x93')][_0x9b6b('0x94')]},function(_0x5ded15){return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x5b9257},'transaction':_0x5ded15})['then'](function(_0x305fb6){if(_0x305fb6){return db[_0x9b6b('0x95')][_0x9b6b('0x24')]({'where':{'MailAccountId':_0x5b9257},'transaction':_0x5ded15})[_0x9b6b('0x11')](function(){var _0x2a6433=_[_0x9b6b('0x6a')](_0x82bd27,function(_0x282b1e){_0x282b1e[_0x9b6b('0x65')]=_0x5b9257;return _0x282b1e;});return db[_0x9b6b('0x95')][_0x9b6b('0x96')](_0x2a6433,{'transaction':_0x5ded15});});}else{_0x54f9c4=0x194;_0x4413ee=[];}});})['then'](function(){if(_0x54f9c4!==0x194){return db['MailApplication'][_0x9b6b('0x97')]({'where':{'MailAccountId':_0x5b9257},'order':_0x9b6b('0x98')})['then'](function(_0x588ff1){_0x4413ee=_0x588ff1;});}})[_0x9b6b('0x5b')](function(_0x16a60e){_0x54f9c4=0x1f4;logger[_0x9b6b('0x16')](_0x16a60e[_0x9b6b('0x99')]);if(_0x16a60e[_0x9b6b('0x27')]){delete _0x16a60e[_0x9b6b('0x27')];}_0x4413ee=_0x16a60e;})[_0x9b6b('0x9a')](function(){if(_0x4413ee===null){_0x41fbd5[_0x9b6b('0x1a')](_0x54f9c4);}else{if(_0x54f9c4===0x1f4){_0x41fbd5[_0x9b6b('0x1c')](_0x54f9c4)[_0x9b6b('0x28')](_0x4413ee);}else{_0x41fbd5['status'](_0x54f9c4)['json'](_0x4413ee);}}});};exports['getApplications']=function(_0x5902b7,_0x5dcc18){var _0x8e5bcb={};var _0x46ef02={};var _0x1a63f5;var _0x6bcc3b;return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x5902b7[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x5dcc18,null))[_0x9b6b('0x11')](function(_0x3cf82a){if(_0x3cf82a){_0x1a63f5=_0x3cf82a;_0x46ef02[_0x9b6b('0x4c')]=_['keys'](db['MailApplication'][_0x9b6b('0x48')]);_0x46ef02[_0x9b6b('0x4d')]=_['keys'](_0x5902b7[_0x9b6b('0x4d')]);_0x46ef02['filters']=_[_0x9b6b('0x4f')](_0x46ef02[_0x9b6b('0x4c')],_0x46ef02['query']);_0x8e5bcb['attributes']=_[_0x9b6b('0x4f')](_0x46ef02[_0x9b6b('0x4c')],qs[_0x9b6b('0x51')](_0x5902b7['query'][_0x9b6b('0x51')]));_0x8e5bcb[_0x9b6b('0x50')]=_0x8e5bcb[_0x9b6b('0x50')][_0x9b6b('0x52')]?_0x8e5bcb['attributes']:_0x46ef02[_0x9b6b('0x4c')];_0x8e5bcb[_0x9b6b('0x53')]=qs['sort'](_0x5902b7['query'][_0x9b6b('0x54')]);_0x8e5bcb[_0x9b6b('0x57')]=qs['filters'](_[_0x9b6b('0x55')](_0x5902b7[_0x9b6b('0x4d')],_0x46ef02[_0x9b6b('0x4e')]));if(_0x5902b7[_0x9b6b('0x4d')]['filter']){_0x8e5bcb[_0x9b6b('0x57')]=_['merge'](_0x8e5bcb[_0x9b6b('0x57')],{'$or':_[_0x9b6b('0x6a')](_0x8e5bcb[_0x9b6b('0x50')],function(_0xd99ef6){var _0x5a778e={};_0x5a778e[_0xd99ef6]={'$like':'%'+_0x5902b7[_0x9b6b('0x4d')][_0x9b6b('0x56')]+'%'};return _0x5a778e;})});}_0x8e5bcb=_[_0x9b6b('0x58')]({},_0x8e5bcb,_0x5902b7[_0x9b6b('0x59')]);return _0x1a63f5[_0x9b6b('0x9b')](_0x8e5bcb);}})[_0x9b6b('0x11')](function(_0x44f391){if(_0x44f391){_0x6bcc3b=_0x44f391[_0x9b6b('0x52')];if(!_0x5902b7[_0x9b6b('0x4d')][_0x9b6b('0x71')](_0x9b6b('0x69'))){_0x8e5bcb[_0x9b6b('0x20')]=qs['limit'](_0x5902b7[_0x9b6b('0x4d')]['limit']);_0x8e5bcb[_0x9b6b('0x1e')]=qs[_0x9b6b('0x1e')](_0x5902b7['query'][_0x9b6b('0x1e')]);}return _0x1a63f5[_0x9b6b('0x9b')](_0x8e5bcb);}})['then'](function(_0x2f8ad2){if(_0x2f8ad2){return _0x2f8ad2?{'count':_0x6bcc3b,'rows':_0x2f8ad2}:null;}})[_0x9b6b('0x11')](respondWithResult(_0x5dcc18,null))[_0x9b6b('0x5b')](handleError(_0x5dcc18,null));};exports[_0x9b6b('0x9c')]=function(_0x55d119,_0x1b39e7){var _0x110c65={'raw':!![],'where':{}};var _0x2b8bb0={};var _0x2b4f14={'count':0x0,'rows':[]};return db[_0x9b6b('0x47')][_0x9b6b('0x67')]({'where':{'id':_0x55d119[_0x9b6b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x1b39e7,null))[_0x9b6b('0x11')](function(_0x4b2f44){if(_0x4b2f44){_0x2b8bb0[_0x9b6b('0x4c')]=_[_0x9b6b('0x5e')](db[_0x9b6b('0x9d')][_0x9b6b('0x48')]);_0x2b8bb0['query']=_['keys'](_0x55d119[_0x9b6b('0x4d')]);_0x2b8bb0[_0x9b6b('0x4e')]=_[_0x9b6b('0x4f')](_0x2b8bb0['model'],_0x2b8bb0[_0x9b6b('0x4d')]);_0x110c65[_0x9b6b('0x50')]=_['intersection'](_0x2b8bb0[_0x9b6b('0x4c')],qs['fields'](_0x55d119['query'][_0x9b6b('0x51')]));_0x110c65[_0x9b6b('0x50')]=_0x110c65[_0x9b6b('0x50')][_0x9b6b('0x52')]?_0x110c65[_0x9b6b('0x50')]:_0x2b8bb0['model'];if(!_0x55d119[_0x9b6b('0x4d')]['hasOwnProperty'](_0x9b6b('0x69'))){_0x110c65[_0x9b6b('0x20')]=qs[_0x9b6b('0x20')](_0x55d119[_0x9b6b('0x4d')][_0x9b6b('0x20')]);_0x110c65['offset']=qs[_0x9b6b('0x1e')](_0x55d119[_0x9b6b('0x4d')][_0x9b6b('0x1e')]);}_0x110c65[_0x9b6b('0x53')]=qs[_0x9b6b('0x54')](_0x55d119[_0x9b6b('0x4d')][_0x9b6b('0x54')]);_0x110c65['where']=qs[_0x9b6b('0x4e')](_[_0x9b6b('0x55')](_0x55d119[_0x9b6b('0x4d')],_0x2b8bb0[_0x9b6b('0x4e')]));_0x110c65['where'][_0x9b6b('0x65')]=_0x4b2f44['id'];if(_0x55d119[_0x9b6b('0x4d')][_0x9b6b('0x56')]){_0x110c65[_0x9b6b('0x57')]=_['merge'](_0x110c65[_0x9b6b('0x57')],{'$or':_[_0x9b6b('0x6a')](_0x110c65[_0x9b6b('0x50')],function(_0x580fa0){var _0x27efbc={};_0x27efbc[_0x580fa0]={'$like':'%'+_0x55d119[_0x9b6b('0x4d')]['filter']+'%'};return _0x27efbc;})});}if(_0x55d119[_0x9b6b('0x4d')][_0x9b6b('0x9e')]){var _0x18092e=_0x55d119[_0x9b6b('0x4d')]['$gte']['split'](',');var _0x453faa={};_0x453faa[_0x18092e[0x0]]={'$gte':moment(_0x18092e[0x1])[_0x9b6b('0x9f')]('YYYY-MM-DD\x20HH:mm:ss')};_0x110c65[_0x9b6b('0x57')]=_[_0x9b6b('0x58')](_0x110c65[_0x9b6b('0x57')],_0x453faa);}_0x110c65=_[_0x9b6b('0x58')]({},_0x110c65,_0x55d119[_0x9b6b('0x59')]);return db['MailMessage']['count']({'where':_0x110c65[_0x9b6b('0x57')]})[_0x9b6b('0x11')](function(_0x134384){_0x2b4f14['count']=_0x134384;if(_0x55d119[_0x9b6b('0x4d')]['includeAll']){_0x110c65[_0x9b6b('0x5f')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x110c65);})['then'](function(_0x358f1d){if(_0x55d119['query'][_0x9b6b('0xa0')]===_0x9b6b('0xa1')){for(var _0x23dae0=0x0;_0x23dae0<_0x358f1d[_0x9b6b('0x52')];_0x23dae0++){_0x358f1d[_0x23dae0]['body']=juice(_0x358f1d[_0x23dae0]['body']);}}_0x2b4f14[_0x9b6b('0x6b')]=_0x358f1d;return _0x2b4f14;});}})['then'](respondWithFilteredResult(_0x1b39e7,_0x110c65))[_0x9b6b('0x5b')](handleError(_0x1b39e7,null));};exports[_0x9b6b('0x28')]=function(_0xdf59d8,_0x187b78){var _0x5760b7,_0x41f001={},_0xccd9cf;if(_0xdf59d8[_0x9b6b('0x61')]['to']){_0xccd9cf=_0xdf59d8['body']['to']['split'](',')[0x0];}return db[_0x9b6b('0x47')]['find']({'where':{'id':_0xdf59d8[_0x9b6b('0x5c')]['id']},'include':[{'model':db[_0x9b6b('0xa2')],'as':_0x9b6b('0xa3'),'include':[{'model':db[_0x9b6b('0xa4')],'as':'Contacts','where':{'email':_0xccd9cf},'limit':0x1,'order':[['updatedAt',_0x9b6b('0xa5')]]}]},{'model':db['MailServerOut'],'as':_0x9b6b('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x9b6b('0xa6'),'raw':!![]}]}]})[_0x9b6b('0x11')](handleEntityNotFound(_0x187b78,null))[_0x9b6b('0x11')](function(_0x1cc4b0){if(!_0x1cc4b0)return;_0x5760b7=_0x1cc4b0;if(!_0x1cc4b0['Smtp'])throw new Error('Smtp\x20configuration\x20not\x20found');if(_['isNil'](_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xa7')])){_0xdf59d8['body'][_0x9b6b('0xa7')]=util['format'](_0x9b6b('0xa8'),_0x1cc4b0['name'],_0x1cc4b0[_0x9b6b('0x75')]||_0x1cc4b0[_0x9b6b('0x42')][_0x9b6b('0x36')]);}if(_0xdf59d8[_0x9b6b('0x61')]['attachments']&&_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xa9')][_0x9b6b('0x52')]){for(var _0x1c48ae=0x0;_0x1c48ae<_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xa9')][_0x9b6b('0x52')];_0x1c48ae+=0x1){_0xdf59d8['body']['attachments'][_0x1c48ae]={'filename':_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xa9')][_0x1c48ae]['name'],'path':path['join'](config[_0x9b6b('0xaa')],'server/files/attachments',_0xdf59d8[_0x9b6b('0x61')]['attachments'][_0x1c48ae][_0x9b6b('0xab')])};}}var _0x98fb53=_0x1cc4b0['getSmtpOptions']();return respondWithRpcPromise(_0x9b6b('0xac'),_0x9b6b('0xad'),{'account':_0x98fb53,'message':_0xdf59d8['body']});})[_0x9b6b('0x11')](function(_0x2df098){if(!_0x2df098)return;_0x41f001=_0x2df098;if(!_0x5760b7['List'])throw new Error(_0x9b6b('0xae'));if(_0x5760b7[_0x9b6b('0xa3')][_0x9b6b('0xaf')][_0x9b6b('0x52')])return _0x5760b7['List']['Contacts'][0x0];return db[_0x9b6b('0xa4')][_0x9b6b('0x66')](_[_0x9b6b('0xc')](_0xdf59d8[_0x9b6b('0x61')],{'firstName':_0xdf59d8[_0x9b6b('0x61')]['to'],'email':_0xdf59d8[_0x9b6b('0x61')]['to'],'phone':_0xdf59d8[_0x9b6b('0x61')]['to'],'ListId':_0x5760b7[_0x9b6b('0x76')]}));})['then'](function(_0x5a87dc){if(!_0x5a87dc)return;var _0x16f4b9={'UserId':_0xdf59d8[_0x9b6b('0x36')]['id'],'ContactId':_0x5a87dc['id'],'MailAccountId':_0x5760b7['id'],'inReplyTo':_0x41f001[_0x9b6b('0xb0')],'to':_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xa7')],'cc':_0xdf59d8[_0x9b6b('0x61')]['cc'],'subject':_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xb1')],'attach':_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xb2')],'firstMsgDirection':_0x9b6b('0xb3'),'lastMsgAt':moment()[_0x9b6b('0x9f')](_0x9b6b('0xb4')),'lastMsgDirection':_0x9b6b('0xb3'),'Messages':[_['merge'](_0xdf59d8[_0x9b6b('0x61')],{'messageId':_0x41f001[_0x9b6b('0xb0')],'sentAt':moment()[_0x9b6b('0x9f')](_0x9b6b('0xb4')),'read':!![],'MailAccountId':_0x5760b7['id'],'UserId':_0xdf59d8[_0x9b6b('0x36')]['id'],'ContactId':_0x5a87dc['id']})]};if(_0xdf59d8[_0x9b6b('0x61')][_0x9b6b('0xb5')]){_0x16f4b9=_['merge'](_0x16f4b9,_0xdf59d8[_0x9b6b('0x61')]['Interaction']);}return db[_0x9b6b('0x88')][_0x9b6b('0x66')](_0x16f4b9,{'include':[{'model':db[_0x9b6b('0x9d')],'as':_0x9b6b('0xb6')}]});})[_0x9b6b('0x11')](respondWithResult(_0x187b78,null))[_0x9b6b('0x5b')](handleError(_0x187b78,null));};exports[_0x9b6b('0xb7')]=function(_0x25deb2,_0x4353bf){return db['MailAccount']['find']({'where':{'id':_0x25deb2[_0x9b6b('0x5c')]['id']},'include':[{'model':db[_0x9b6b('0x44')],'as':_0x9b6b('0x42'),'raw':!![],'include':[{'model':db[_0x9b6b('0xa6')],'as':_0x9b6b('0xa6'),'raw':!![]}]}]})[_0x9b6b('0x11')](handleEntityNotFound(_0x4353bf,null))[_0x9b6b('0x11')](function(_0x318477){if(!_0x318477[_0x9b6b('0x42')])return;var _0x5b576f=_0x318477['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x9b6b('0xb7'),{'account':_0x5b576f});})[_0x9b6b('0x11')](respondWithResult(_0x4353bf,null))[_0x9b6b('0x5b')](handleError(_0x4353bf,null));};exports['destroy']=function(_0x3643de,_0x4f4c32){return db['MailAccount'][_0x9b6b('0x60')]({'where':{'id':_0x3643de[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x4f4c32,null))[_0x9b6b('0x11')](function(_0x367f87){if(_0x367f87&&_0x367f87[_0x9b6b('0x3f')]){throw new db[(_0x9b6b('0xb8'))]['ValidationError'](_0x9b6b('0xb9'));}return _0x367f87;})['then'](removeEntity(_0x4f4c32,null))[_0x9b6b('0x5b')](handleError(_0x4f4c32,null));};exports[_0x9b6b('0xba')]=function(_0x20e19b,_0x382635){return db[_0x9b6b('0x47')][_0x9b6b('0x60')]({'where':{'id':_0x20e19b[_0x9b6b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x382635,null))[_0x9b6b('0x11')](function(_0x38b912){if(_0x38b912){return _0x38b912[_0x9b6b('0xba')](_0x20e19b['body'][_0x9b6b('0x6d')],_[_0x9b6b('0x86')](_0x20e19b[_0x9b6b('0x61')],[_0x9b6b('0x6d'),'id'])||{})[_0x9b6b('0xbb')](function(_0x5bc6b0){for(var _0x4c3142=0x0;_0x4c3142<_0x20e19b[_0x9b6b('0x61')][_0x9b6b('0x6d')][_0x9b6b('0x52')];_0x4c3142+=0x1){socket['emit']('userMailAccount:save',{'UserId':Number(_0x20e19b[_0x9b6b('0x61')][_0x9b6b('0x6d')][_0x4c3142]),'MailAccountId':Number(_0x20e19b['params']['id'])});}return _0x5bc6b0;});}})[_0x9b6b('0x11')](respondWithResult(_0x382635,null))[_0x9b6b('0x5b')](handleError(_0x382635,null));};exports[_0x9b6b('0xbc')]=function(_0x5571aa,_0x5a9e04){return db['MailAccount']['find']({'where':{'id':_0x5571aa[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x5a9e04,null))[_0x9b6b('0x11')](function(_0x29840a){if(_0x29840a){return _0x29840a[_0x9b6b('0xbc')](_0x5571aa[_0x9b6b('0x4d')][_0x9b6b('0x6d')])[_0x9b6b('0x11')](function(){if(_['isArray'](_0x5571aa[_0x9b6b('0x4d')][_0x9b6b('0x6d')])){for(var _0x24a9bc=0x0;_0x24a9bc<_0x5571aa[_0x9b6b('0x4d')][_0x9b6b('0x6d')][_0x9b6b('0x52')];_0x24a9bc+=0x1){socket[_0x9b6b('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x5571aa[_0x9b6b('0x4d')][_0x9b6b('0x6d')][_0x24a9bc]),'MailAccountId':Number(_0x5571aa[_0x9b6b('0x5c')]['id'])});}}else{socket[_0x9b6b('0xbd')](_0x9b6b('0xbe'),{'UserId':Number(_0x5571aa[_0x9b6b('0x4d')]['ids']),'MailAccountId':Number(_0x5571aa['params']['id'])});}});}})[_0x9b6b('0x11')](respondWithStatusCode(_0x5a9e04,null))[_0x9b6b('0x5b')](handleError(_0x5a9e04,null));};exports[_0x9b6b('0xbf')]=function(_0x25b0f3,_0x598875){var _0x2ad573={};var _0x361f61={};var _0x24de79;var _0x433867;return db[_0x9b6b('0x47')]['findOne']({'where':{'id':_0x25b0f3[_0x9b6b('0x5c')]['id']}})[_0x9b6b('0x11')](handleEntityNotFound(_0x598875,null))[_0x9b6b('0x11')](function(_0x346092){if(_0x346092){_0x24de79=_0x346092;_0x361f61[_0x9b6b('0x4c')]=_['keys'](db['User']['rawAttributes']);_0x361f61[_0x9b6b('0x4d')]=_[_0x9b6b('0x5e')](_0x25b0f3[_0x9b6b('0x4d')]);_0x361f61[_0x9b6b('0x4e')]=_[_0x9b6b('0x4f')](_0x361f61[_0x9b6b('0x4c')],_0x361f61[_0x9b6b('0x4d')]);_0x2ad573[_0x9b6b('0x50')]=_[_0x9b6b('0x4f')](_0x361f61['model'],qs['fields'](_0x25b0f3[_0x9b6b('0x4d')]['fields']));_0x2ad573[_0x9b6b('0x50')]=_0x2ad573[_0x9b6b('0x50')][_0x9b6b('0x52')]?_0x2ad573[_0x9b6b('0x50')]:_0x361f61[_0x9b6b('0x4c')];_0x2ad573[_0x9b6b('0x53')]=qs[_0x9b6b('0x54')](_0x25b0f3[_0x9b6b('0x4d')][_0x9b6b('0x54')]);_0x2ad573[_0x9b6b('0x57')]=qs[_0x9b6b('0x4e')](_['pick'](_0x25b0f3[_0x9b6b('0x4d')],_0x361f61['filters']));if(_0x25b0f3[_0x9b6b('0x4d')][_0x9b6b('0x56')]){_0x2ad573[_0x9b6b('0x57')]=_['merge'](_0x2ad573[_0x9b6b('0x57')],{'$or':_[_0x9b6b('0x6a')](_0x2ad573[_0x9b6b('0x50')],function(_0x2b7dbd){var _0x364b59={};_0x364b59[_0x2b7dbd]={'$like':'%'+_0x25b0f3['query'][_0x9b6b('0x56')]+'%'};return _0x364b59;})});}_0x2ad573=_[_0x9b6b('0x58')]({},_0x2ad573,_0x25b0f3['options']);return _0x24de79[_0x9b6b('0xbf')](_0x2ad573);}})[_0x9b6b('0x11')](function(_0x56d325){if(_0x56d325){_0x433867=_0x56d325[_0x9b6b('0x52')];if(!_0x25b0f3[_0x9b6b('0x4d')]['hasOwnProperty']('nolimit')){_0x2ad573[_0x9b6b('0x20')]=qs['limit'](_0x25b0f3[_0x9b6b('0x4d')][_0x9b6b('0x20')]);_0x2ad573[_0x9b6b('0x1e')]=qs['offset'](_0x25b0f3[_0x9b6b('0x4d')][_0x9b6b('0x1e')]);}return _0x24de79['getAgents'](_0x2ad573);}})['then'](function(_0x3978b1){if(_0x3978b1){return _0x3978b1?{'count':_0x433867,'rows':_0x3978b1}:null;}})[_0x9b6b('0x11')](respondWithResult(_0x598875,null))[_0x9b6b('0x5b')](handleError(_0x598875,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 25fff70..8e1a7fe 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 _0xe683=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hook'];(function(_0x33b271,_0x350f85){var _0x19e353=function(_0x547b75){while(--_0x547b75){_0x33b271['push'](_0x33b271['shift']());}};_0x19e353(++_0x350f85);}(_0xe683,0x1d7));var _0x3e68=function(_0x2198f9,_0x9754b2){_0x2198f9=_0x2198f9-0x0;var _0x5ae31e=_0xe683[_0x2198f9];return _0x5ae31e;};'use strict';var EventEmitter=require(_0x3e68('0x0'));var MailAccount=require(_0x3e68('0x1'))['db'][_0x3e68('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x3e68('0x3')](0x0);var events={'afterCreate':_0x3e68('0x4'),'afterUpdate':_0x3e68('0x5'),'afterDestroy':_0x3e68('0x6')};function emitEvent(_0x691762){return function(_0x30a2a1,_0x4fe031,_0x512275){MailAccountEvents[_0x3e68('0x7')](_0x691762+':'+_0x30a2a1['id'],_0x30a2a1);MailAccountEvents[_0x3e68('0x7')](_0x691762,_0x30a2a1);_0x512275(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x3e68('0x8')](e,emitEvent(event));}}module[_0x3e68('0x9')]=MailAccountEvents; \ No newline at end of file +var _0x044a=['hook','events','../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x22cc58,_0x16dfac){var _0xf959b3=function(_0x17bbc7){while(--_0x17bbc7){_0x22cc58['push'](_0x22cc58['shift']());}};_0xf959b3(++_0x16dfac);}(_0x044a,0x173));var _0xa044=function(_0x3170ed,_0x1f333f){_0x3170ed=_0x3170ed-0x0;var _0x5d183d=_0x044a[_0x3170ed];return _0x5d183d;};'use strict';var EventEmitter=require(_0xa044('0x0'));var MailAccount=require(_0xa044('0x1'))['db'][_0xa044('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xa044('0x3')](0x0);var events={'afterCreate':_0xa044('0x4'),'afterUpdate':_0xa044('0x5'),'afterDestroy':_0xa044('0x6')};function emitEvent(_0x30b0c9){return function(_0x25ed77,_0x116358,_0x566ddf){MailAccountEvents[_0xa044('0x7')](_0x30b0c9+':'+_0x25ed77['id'],_0x25ed77);MailAccountEvents[_0xa044('0x7')](_0x30b0c9,_0x25ed77);_0x566ddf(null);};}for(var e in events){if(events[_0xa044('0x8')](e)){var event=events[e];MailAccount[_0xa044('0x9')](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 7e3b811..f64c3a8 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 _0x7592=['service','Smtp','host','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','./mailAccount.attributes','exports','define','mail_accounts','provider','custom'];(function(_0x1de88e,_0x2fa517){var _0x12ac65=function(_0x25988b){while(--_0x25988b){_0x1de88e['push'](_0x1de88e['shift']());}};_0x12ac65(++_0x2fa517);}(_0x7592,0x19e));var _0x2759=function(_0x372515,_0xdd11f){_0x372515=_0x372515-0x0;var _0xa3bf4e=_0x7592[_0x372515];return _0xa3bf4e;};'use strict';var attributes=require(_0x2759('0x0'));module[_0x2759('0x1')]=function(_0x219e69){return _0x219e69[_0x2759('0x2')]('MailAccount',attributes,{'tableName':_0x2759('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4a212c=this;var _0x37eef8={'id':_0x4a212c['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a212c[_0x2759('0x4')]!==_0x2759('0x5')){_0x37eef8[_0x2759('0x6')]=_0x4a212c['provider'];}else{_0x37eef8['host']=_0x4a212c[_0x2759('0x7')][_0x2759('0x8')];_0x37eef8['port']=_0x4a212c[_0x2759('0x7')][_0x2759('0x9')];_0x37eef8[_0x2759('0xa')]=_0x4a212c[_0x2759('0x7')]['secure'];}if(_0x4a212c['Smtp'][_0x2759('0xb')]){if(_0x4a212c[_0x2759('0x7')][_0x2759('0xc')]){if(!_0x4a212c[_0x2759('0x7')][_0x2759('0xd')])throw new Error(_0x2759('0xe'));_0x37eef8[_0x2759('0xf')]={'type':_0x2759('0x10'),'user':_0x4a212c['Smtp'][_0x2759('0x11')],'accessToken':_0x4a212c['Smtp'][_0x2759('0xd')][_0x2759('0x12')]};}else{_0x37eef8[_0x2759('0xf')]={'user':_0x4a212c[_0x2759('0x7')][_0x2759('0x11')],'pass':_0x4a212c[_0x2759('0x7')][_0x2759('0x13')]};}}return _0x37eef8;}}});}; \ No newline at end of file +var _0xb234=['pass','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','provider','custom','service','host','Smtp','port','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','user'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0xb234,0x1a5));var _0x4b23=function(_0x3a367e,_0x271dbd){_0x3a367e=_0x3a367e-0x0;var _0x536192=_0xb234[_0x3a367e];return _0x536192;};'use strict';var attributes=require(_0x4b23('0x0'));module[_0x4b23('0x1')]=function(_0x39405f){return _0x39405f[_0x4b23('0x2')](_0x4b23('0x3'),attributes,{'tableName':_0x4b23('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x4b6016=this;var _0x429f71={'id':_0x4b6016['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4b6016[_0x4b23('0x5')]!==_0x4b23('0x6')){_0x429f71[_0x4b23('0x7')]=_0x4b6016[_0x4b23('0x5')];}else{_0x429f71[_0x4b23('0x8')]=_0x4b6016[_0x4b23('0x9')][_0x4b23('0x8')];_0x429f71[_0x4b23('0xa')]=_0x4b6016[_0x4b23('0x9')][_0x4b23('0xa')];_0x429f71['secure']=_0x4b6016['Smtp'][_0x4b23('0xb')];}if(_0x4b6016[_0x4b23('0x9')]['authentication']){if(_0x4b6016['Smtp'][_0x4b23('0xc')]){if(!_0x4b6016['Smtp'][_0x4b23('0xd')])throw new Error(_0x4b23('0xe'));_0x429f71[_0x4b23('0xf')]={'type':_0x4b23('0x10'),'user':_0x4b6016[_0x4b23('0x9')]['user'],'accessToken':_0x4b6016[_0x4b23('0x9')][_0x4b23('0xd')][_0x4b23('0x11')]};}else{_0x429f71[_0x4b23('0xf')]={'user':_0x4b6016['Smtp'][_0x4b23('0x12')],'pass':_0x4b6016[_0x4b23('0x9')][_0x4b23('0x13')]};}}return _0x429f71;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 0804378..a3e3133 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 _0xae30=['asc','autoclose','push','length','*,*,*,*','from','create','List\x20not\x20found','contact','messageId','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','Messages','inReplyTo','Contact\x20not\x20found','spread','update','attach','interaction','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','MailQueue','queueId','waitForTheAssignedQueue','Start','startRouting','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','GetMailAccount','options','raw','where','limit','include','model','attributes','map','then','debug','ShowMailAccount','MailAccount','find','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','applications','list','orderBy','priority'];(function(_0x1e42eb,_0xa7cde){var _0x44e37b=function(_0x3e1227){while(--_0x3e1227){_0x1e42eb['push'](_0x1e42eb['shift']());}};_0x44e37b(++_0xa7cde);}(_0xae30,0x10a));var _0x0ae3=function(_0x48c841,_0x27374a){_0x48c841=_0x48c841-0x0;var _0x22c86f=_0xae30[_0x48c841];return _0x22c86f;};'use strict';var _=require(_0x0ae3('0x0'));var moment=require(_0x0ae3('0x1'));var BPromise=require(_0x0ae3('0x2'));var rs=require('randomstring');var Redis=require(_0x0ae3('0x3'));var db=require(_0x0ae3('0x4'))['db'];var logger=require(_0x0ae3('0x5'))(_0x0ae3('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ae3('0x7'));var client=jayson[_0x0ae3('0x8')][_0x0ae3('0x9')]({'port':0x232c});config[_0x0ae3('0xa')]=_[_0x0ae3('0xb')](config[_0x0ae3('0xa')],{'host':_0x0ae3('0xc'),'port':0x18eb});var socket=require(_0x0ae3('0xd'))(new Redis(config[_0x0ae3('0xa')]));require(_0x0ae3('0xe'))[_0x0ae3('0xf')](socket);function respondWithRpcPromise(_0x22566f,_0x32ca2c,_0x49e0a5){return new BPromise(function(_0x98ab46,_0xee8a4c){return client['request'](_0x22566f,_0x49e0a5)['then'](function(_0x59cf73){logger[_0x0ae3('0x10')](_0x0ae3('0x11'),_0x32ca2c,_0x0ae3('0x12'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x32ca2c,_0x0ae3('0x12'),JSON[_0x0ae3('0x13')](_0x59cf73));if(_0x59cf73['error']){if(_0x59cf73['error'][_0x0ae3('0x14')]===0x1f4){logger['error'](_0x0ae3('0x11'),_0x32ca2c,_0x59cf73[_0x0ae3('0x15')][_0x0ae3('0x16')]);return _0xee8a4c(_0x59cf73[_0x0ae3('0x15')][_0x0ae3('0x16')]);}logger[_0x0ae3('0x15')](_0x0ae3('0x11'),_0x32ca2c,_0x59cf73['error'][_0x0ae3('0x16')]);return _0x98ab46(_0x59cf73['error'][_0x0ae3('0x16')]);}else{logger[_0x0ae3('0x10')](_0x0ae3('0x11'),_0x32ca2c,_0x0ae3('0x12'));_0x98ab46(_0x59cf73[_0x0ae3('0x17')][_0x0ae3('0x16')]);}})[_0x0ae3('0x18')](function(_0x1bf406){logger[_0x0ae3('0x15')]('MailAccount,\x20%s,\x20%s',_0x32ca2c,_0x1bf406);_0xee8a4c(_0x1bf406);});});}exports[_0x0ae3('0x19')]=function(_0x4b8949){var _0x49d4b7=this;return new Promise(function(_0x571135,_0x4ac074){return db['MailAccount']['findAll']({'raw':_0x4b8949['options']?_0x4b8949[_0x0ae3('0x1a')][_0x0ae3('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b8949[_0x0ae3('0x1a')]?_0x4b8949['options'][_0x0ae3('0x1c')]||null:null,'attributes':_0x4b8949['options']?_0x4b8949[_0x0ae3('0x1a')]['attributes']||null:null,'limit':_0x4b8949['options']?_0x4b8949['options'][_0x0ae3('0x1d')]||null:null,'include':_0x4b8949[_0x0ae3('0x1a')]?_0x4b8949[_0x0ae3('0x1a')]['include']?_['map'](_0x4b8949[_0x0ae3('0x1a')][_0x0ae3('0x1e')],function(_0x5a76e5){return{'model':db[_0x5a76e5[_0x0ae3('0x1f')]],'as':_0x5a76e5['as'],'attributes':_0x5a76e5[_0x0ae3('0x20')],'include':_0x5a76e5[_0x0ae3('0x1e')]?_['map'](_0x5a76e5[_0x0ae3('0x1e')],function(_0x1f9cde){return{'model':db[_0x1f9cde[_0x0ae3('0x1f')]],'as':_0x1f9cde['as'],'attributes':_0x1f9cde['attributes'],'include':_0x1f9cde[_0x0ae3('0x1e')]?_[_0x0ae3('0x21')](_0x1f9cde[_0x0ae3('0x1e')],function(_0x59a265){return{'model':db[_0x59a265[_0x0ae3('0x1f')]],'as':_0x59a265['as'],'attributes':_0x59a265[_0x0ae3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0ae3('0x22')](function(_0x152876){logger[_0x0ae3('0x10')](_0x0ae3('0x19'),_0x4b8949);logger[_0x0ae3('0x23')](_0x0ae3('0x19'),_0x4b8949,JSON[_0x0ae3('0x13')](_0x152876));_0x571135(_0x152876);})[_0x0ae3('0x18')](function(_0x4032f4){logger[_0x0ae3('0x15')](_0x0ae3('0x19'),_0x4032f4[_0x0ae3('0x16')],_0x4b8949);_0x4ac074(_0x49d4b7[_0x0ae3('0x15')](0x1f4,_0x4032f4['message']));});});};exports[_0x0ae3('0x24')]=function(_0x25ec0d){var _0x34480d=this;return new Promise(function(_0x39886e,_0x5243da){return db[_0x0ae3('0x25')][_0x0ae3('0x26')]({'raw':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x1b')]===undefined?!![]:![]:!![],'where':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d['options'][_0x0ae3('0x1c')]||null:null,'attributes':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x20')]||null:null,'include':_0x25ec0d[_0x0ae3('0x1a')]?_0x25ec0d[_0x0ae3('0x1a')][_0x0ae3('0x1e')]?_['map'](_0x25ec0d['options'][_0x0ae3('0x1e')],function(_0x45ac7d){return{'model':db[_0x45ac7d[_0x0ae3('0x1f')]],'as':_0x45ac7d['as'],'attributes':_0x45ac7d['attributes'],'include':_0x45ac7d['include']?_[_0x0ae3('0x21')](_0x45ac7d[_0x0ae3('0x1e')],function(_0x1ef996){return{'model':db[_0x1ef996[_0x0ae3('0x1f')]],'as':_0x1ef996['as'],'attributes':_0x1ef996[_0x0ae3('0x20')],'include':_0x1ef996[_0x0ae3('0x1e')]?_[_0x0ae3('0x21')](_0x1ef996['include'],function(_0x1453aa){return{'model':db[_0x1453aa[_0x0ae3('0x1f')]],'as':_0x1453aa['as'],'attributes':_0x1453aa[_0x0ae3('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4c7adf){if(_0x25ec0d['options'][_0x0ae3('0x27')]===!![])_0x4c7adf[_0x0ae3('0x28')]('smtpOptions',_0x4c7adf[_0x0ae3('0x29')]());logger[_0x0ae3('0x10')](_0x0ae3('0x24'),_0x25ec0d);logger['debug'](_0x0ae3('0x24'),_0x25ec0d,JSON['stringify'](_0x4c7adf));_0x39886e(_0x4c7adf);})[_0x0ae3('0x18')](function(_0x1626e1){logger['error'](_0x0ae3('0x24'),_0x1626e1[_0x0ae3('0x16')],_0x25ec0d);_0x5243da(_0x34480d[_0x0ae3('0x15')](0x1f4,_0x1626e1[_0x0ae3('0x16')]));});});};exports[_0x0ae3('0x2a')]=function(_0x53eda3){var _0x5298aa=this;return new Promise(function(_0x2e95e5,_0x334163){var _0x5c6874={'body':_0x53eda3['body'],'channel':'mail'};var _0x5b006c=_[_0x0ae3('0x2b')](_[_0x0ae3('0x2c')](db[_0x0ae3('0x2d')][_0x0ae3('0x2e')]),[_0x0ae3('0x2f'),_0x0ae3('0x30'),_0x0ae3('0x31'),_0x0ae3('0x32')]);var _0x2cfc16=![];if(_0x53eda3[_0x0ae3('0x33')]['id']){delete _0x53eda3['body']['id'];}if(_[_0x0ae3('0x34')](_0x53eda3[_0x0ae3('0x33')]['from'])){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,_0x0ae3('0x35')));}if(_[_0x0ae3('0x34')](_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x33')])||_0x53eda3['body'][_0x0ae3('0x33')]===''){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,_0x0ae3('0x36')));}if(_[_0x0ae3('0x34')](_0x53eda3['body'][_0x0ae3('0x37')])){return _0x334163(_0x5298aa[_0x0ae3('0x15')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5b006c));}if(!_[_0x0ae3('0x38')](_0x5b006c,_0x53eda3[_0x0ae3('0x33')]['mapKey'])){return _0x334163(_0x5298aa['error'](0x1f4,_0x0ae3('0x39')+_0x5b006c));}var _0x21b49f={};_0x21b49f[_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x37')]]=_0x53eda3[_0x0ae3('0x33')]['from'];return db['MailAccount'][_0x0ae3('0x26')]({'where':{'id':_0x53eda3['account']['id']},'include':[{'model':db[_0x0ae3('0x3a')],'as':_0x0ae3('0x3b'),'include':[{'model':db['CmContact'],'as':_0x0ae3('0x3c'),'where':_0x21b49f,'limit':0x1,'order':[[_0x0ae3('0x30'),'DESC']]}]},{'model':db[_0x0ae3('0x3d')],'as':_0x0ae3('0x3e')},{'model':db[_0x0ae3('0x3f')],'as':_0x0ae3('0x40'),'include':[{'model':db[_0x0ae3('0x41')],'as':'CloudProvider'}]}]})[_0x0ae3('0x22')](function(_0x53393b){if(_0x53393b&&_0x53393b[_0x0ae3('0x3b')]){var _0x25310c=_0x53393b[_0x0ae3('0x42')]({'plain':!![]});_0x5c6874[_0x0ae3('0x43')]=_[_0x0ae3('0x44')](_0x25310c,[_0x0ae3('0x3e'),_0x0ae3('0x3b')]);_0x5c6874[_0x0ae3('0x43')]['smtpOptions']=_0x53393b[_0x0ae3('0x29')]();_0x5c6874[_0x0ae3('0x45')]=_0x25310c[_0x0ae3('0x3e')];_0x5c6874[_0x0ae3('0x46')]=_0x25310c[_0x0ae3('0x3b')];_0x5c6874[_0x0ae3('0x45')]=_[_0x0ae3('0x47')](_0x5c6874[_0x0ae3('0x45')],[_0x0ae3('0x48')],[_0x0ae3('0x49')]);if(_0x5c6874[_0x0ae3('0x43')]&&_0x5c6874['account'][_0x0ae3('0x4a')]){_0x5c6874['applications'][_0x0ae3('0x4b')]({'id':0x0,'priority':_0x5c6874[_0x0ae3('0x45')][_0x0ae3('0x4c')]+0x1,'app':'close','appdata':'autoclose','interval':_0x0ae3('0x4d')});}if(_0x5c6874['account'][_0x0ae3('0x3e')]){delete _0x5c6874['account'][_0x0ae3('0x3e')];}if(_0x5c6874[_0x0ae3('0x43')]['List']){delete _0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x3b')];}if(_0x25310c[_0x0ae3('0x3b')][_0x0ae3('0x3c')][_0x0ae3('0x4c')]){return _0x25310c['List'][_0x0ae3('0x3c')][0x0];}var _0x4596b5=_['defaults'](_0x53eda3[_0x0ae3('0x33')],{'firstName':_0x53eda3[_0x0ae3('0x33')]['from'],'ListId':_0x25310c[_0x0ae3('0x32')]});_0x4596b5[_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x37')]]=_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x4e')];return db['CmContact'][_0x0ae3('0x4f')](_0x4596b5);}else{throw new Error(_0x0ae3('0x50'));}})[_0x0ae3('0x22')](function(_0x3d554c){_0x5c6874[_0x0ae3('0x51')]=_0x3d554c;if(_0x3d554c){if(!_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['messageId']){_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')]=rs['generate']()+'\x20'+_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x4e')];}var _0x3794df={'ContactId':_0x3d554c['id'],'MailAccountId':_0x53eda3[_0x0ae3('0x43')]['id'],'inReplyTo':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['messageId'],'to':_0x53eda3[_0x0ae3('0x33')]['message']['from'],'cc':_0x53eda3['body'][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['attach'],'lastMsgAt':moment()[_0x0ae3('0x54')](_0x0ae3('0x55')),'lastMsgDirection':'in'};return db[_0x0ae3('0x56')][_0x0ae3('0x26')]({'where':{'closed':![],'MailAccountId':_0x53eda3[_0x0ae3('0x43')]['id']},'include':[{'model':db['MailMessage'],'as':_0x0ae3('0x57'),'attributes':[_0x0ae3('0x52')],'where':{'messageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x58')]}}]})[_0x0ae3('0x22')](function(_0x4f5e27){if(_0x4f5e27){return[_0x4f5e27,![]];}return db['MailInteraction']['create'](_0x3794df)[_0x0ae3('0x22')](function(_0xd07bf7){return[_0xd07bf7,!![]];});});}else{throw new Error(_0x0ae3('0x59'));}})[_0x0ae3('0x5a')](function(_0x4c3808,_0x2f80f2){if(_0x4c3808){_0x2cfc16=_0x2f80f2;if(!_0x2f80f2){return _0x4c3808[_0x0ae3('0x5b')]({'inReplyTo':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')],'to':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x4e')],'cc':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x4c3808['attach']?_0x4c3808[_0x0ae3('0x5c')]:_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x5c')],'substatus':null,'substatusAt':moment()[_0x0ae3('0x54')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x0ae3('0x54')](_0x0ae3('0x55')),'lastMsgDirection':'in'});}else{return _0x4c3808;}}})[_0x0ae3('0x22')](function(_0x5bc332){_0x5c6874[_0x0ae3('0x5d')]=_0x5bc332[_0x0ae3('0x42')]({'plain':!![]});_0x5c6874[_0x0ae3('0x5d')]['created']=_0x2cfc16;return db['MailMessage'][_0x0ae3('0x4f')]({'body':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x33')],'MailAccountId':_0x53eda3['account']['id'],'MailInteractionId':_0x5bc332['id'],'direction':'in','ContactId':_0x5c6874['contact']['id'],'messageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x52')],'from':_0x53eda3['body'][_0x0ae3('0x16')]['from'],'to':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['to'],'cc':_0x53eda3['body'][_0x0ae3('0x16')]['cc'],'subject':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x53')],'attach':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x5c')],'Attachments':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x5e')],'originTo':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x5f')],'originCc':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x60')],'bcc':_0x53eda3[_0x0ae3('0x33')]['message'][_0x0ae3('0x61')],'ChatWebsiteId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')][_0x0ae3('0x62')]||null,'originChannel':_0x53eda3['body'][_0x0ae3('0x16')][_0x0ae3('0x63')]||_0x0ae3('0x64'),'ChatOfflineMessageId':_0x53eda3[_0x0ae3('0x33')][_0x0ae3('0x16')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x0ae3('0x65')],'as':'Attachments'}]});})['then'](function(_0x284dbe){_0x5c6874[_0x0ae3('0x16')]=_0x284dbe;if(!_0x5c6874[_0x0ae3('0x5d')][_0x0ae3('0x66')]){return;}return db[_0x0ae3('0x67')]['find']({'attributes':['id',_0x0ae3('0x68')],'where':{'id':_0x5c6874[_0x0ae3('0x5d')][_0x0ae3('0x66')]}});})[_0x0ae3('0x22')](function(_0x1b94d6){if(_0x1b94d6){_0x5c6874[_0x0ae3('0x45')][_0x0ae3('0x69')]({'id':0x0,'priority':0x0,'app':_0x0ae3('0x6a'),'appdata':_0x1b94d6[_0x0ae3('0x68')]+','+(_0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x6b')]||0xa),'interval':_0x0ae3('0x4d')});}if(!_0x5c6874[_0x0ae3('0x5d')]['queueId']){return;}return db[_0x0ae3('0x6c')][_0x0ae3('0x26')]({'attributes':['id',_0x0ae3('0x68')],'where':{'id':_0x5c6874['interaction'][_0x0ae3('0x6d')]}});})[_0x0ae3('0x22')](function(_0x535ebd){if(_0x535ebd){_0x5c6874[_0x0ae3('0x45')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x535ebd[_0x0ae3('0x68')]+','+(_0x5c6874[_0x0ae3('0x43')][_0x0ae3('0x6e')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0ae3('0x6f'),_0x0ae3('0x70'),_0x5c6874);})[_0x0ae3('0x22')](function(_0x5d4f97){_0x2e95e5(_0x5d4f97);})['catch'](function(_0x21d3d1){_0x334163(_0x5298aa['error'](0x1f4,_0x21d3d1['message']));});});}; \ No newline at end of file +var _0x85d0=['List','Applications','MailServerOut','CloudProvider','get','omit','applications','list','autoclose','push','length','close','Contacts','from','CmContact','List\x20not\x20found','messageId','generate','attach','format','MailInteraction','Messages','create','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','waitForTheAssignedAgent','*,*,*,*','MailQueue','queueId','waitForTheAssignedQueue','Start','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','./mailAccount.socket','register','request','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','MailAccount','options','raw','attributes','limit','include','map','model','GetMailAccount','debug','stringify','ShowMailAccount','find','then','smtp','setDataValue','getSmtpOptions','NotifyMailAccount','mail','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','account','CmList'];(function(_0x2e6b7a,_0x482abb){var _0x2cfab4=function(_0x5bc789){while(--_0x5bc789){_0x2e6b7a['push'](_0x2e6b7a['shift']());}};_0x2cfab4(++_0x482abb);}(_0x85d0,0x164));var _0x085d=function(_0x3237a1,_0x443798){_0x3237a1=_0x3237a1-0x0;var _0x20282e=_0x85d0[_0x3237a1];return _0x20282e;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var Redis=require(_0x085d('0x0'));var db=require(_0x085d('0x1'))['db'];var logger=require(_0x085d('0x2'))(_0x085d('0x3'));var config=require(_0x085d('0x4'));var jayson=require(_0x085d('0x5'));var client=jayson['client'][_0x085d('0x6')]({'port':0x232c});config['redis']=_[_0x085d('0x7')](config[_0x085d('0x8')],{'host':_0x085d('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x085d('0x8')]));require(_0x085d('0xa'))[_0x085d('0xb')](socket);function respondWithRpcPromise(_0x3129a8,_0x349271,_0x6450ab){return new BPromise(function(_0x18b8b0,_0x985cb3){return client[_0x085d('0xc')](_0x3129a8,_0x6450ab)['then'](function(_0x764e2b){logger[_0x085d('0xd')](_0x085d('0xe'),_0x349271,_0x085d('0xf'));logger['debug'](_0x085d('0x10'),_0x349271,_0x085d('0xf'),JSON['stringify'](_0x764e2b));if(_0x764e2b[_0x085d('0x11')]){if(_0x764e2b[_0x085d('0x11')][_0x085d('0x12')]===0x1f4){logger[_0x085d('0x11')]('MailAccount,\x20%s,\x20%s',_0x349271,_0x764e2b[_0x085d('0x11')][_0x085d('0x13')]);return _0x985cb3(_0x764e2b['error']['message']);}logger[_0x085d('0x11')](_0x085d('0xe'),_0x349271,_0x764e2b[_0x085d('0x11')][_0x085d('0x13')]);return _0x18b8b0(_0x764e2b[_0x085d('0x11')]['message']);}else{logger[_0x085d('0xd')](_0x085d('0xe'),_0x349271,_0x085d('0xf'));_0x18b8b0(_0x764e2b[_0x085d('0x14')][_0x085d('0x13')]);}})[_0x085d('0x15')](function(_0x5c046e){logger[_0x085d('0x11')](_0x085d('0xe'),_0x349271,_0x5c046e);_0x985cb3(_0x5c046e);});});}exports['GetMailAccount']=function(_0xba531c){var _0x1a09aa=this;return new Promise(function(_0x159291,_0x258c15){return db[_0x085d('0x16')]['findAll']({'raw':_0xba531c[_0x085d('0x17')]?_0xba531c[_0x085d('0x17')][_0x085d('0x18')]===undefined?!![]:![]:!![],'where':_0xba531c[_0x085d('0x17')]?_0xba531c['options']['where']||null:null,'attributes':_0xba531c['options']?_0xba531c[_0x085d('0x17')][_0x085d('0x19')]||null:null,'limit':_0xba531c[_0x085d('0x17')]?_0xba531c[_0x085d('0x17')][_0x085d('0x1a')]||null:null,'include':_0xba531c[_0x085d('0x17')]?_0xba531c['options'][_0x085d('0x1b')]?_[_0x085d('0x1c')](_0xba531c[_0x085d('0x17')]['include'],function(_0x38cddc){return{'model':db[_0x38cddc[_0x085d('0x1d')]],'as':_0x38cddc['as'],'attributes':_0x38cddc[_0x085d('0x19')],'include':_0x38cddc[_0x085d('0x1b')]?_[_0x085d('0x1c')](_0x38cddc['include'],function(_0x5e5228){return{'model':db[_0x5e5228['model']],'as':_0x5e5228['as'],'attributes':_0x5e5228[_0x085d('0x19')],'include':_0x5e5228[_0x085d('0x1b')]?_[_0x085d('0x1c')](_0x5e5228['include'],function(_0x11bffd){return{'model':db[_0x11bffd[_0x085d('0x1d')]],'as':_0x11bffd['as'],'attributes':_0x11bffd[_0x085d('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f670c){logger[_0x085d('0xd')](_0x085d('0x1e'),_0xba531c);logger[_0x085d('0x1f')]('GetMailAccount',_0xba531c,JSON[_0x085d('0x20')](_0x2f670c));_0x159291(_0x2f670c);})[_0x085d('0x15')](function(_0x494070){logger[_0x085d('0x11')](_0x085d('0x1e'),_0x494070['message'],_0xba531c);_0x258c15(_0x1a09aa[_0x085d('0x11')](0x1f4,_0x494070[_0x085d('0x13')]));});});};exports[_0x085d('0x21')]=function(_0x4d14b4){var _0x30b632=this;return new Promise(function(_0x36bd27,_0x1e5cae){return db['MailAccount'][_0x085d('0x22')]({'raw':_0x4d14b4['options']?_0x4d14b4[_0x085d('0x17')][_0x085d('0x18')]===undefined?!![]:![]:!![],'where':_0x4d14b4[_0x085d('0x17')]?_0x4d14b4[_0x085d('0x17')]['where']||null:null,'attributes':_0x4d14b4[_0x085d('0x17')]?_0x4d14b4[_0x085d('0x17')][_0x085d('0x19')]||null:null,'include':_0x4d14b4[_0x085d('0x17')]?_0x4d14b4['options']['include']?_[_0x085d('0x1c')](_0x4d14b4[_0x085d('0x17')][_0x085d('0x1b')],function(_0x19386){return{'model':db[_0x19386[_0x085d('0x1d')]],'as':_0x19386['as'],'attributes':_0x19386[_0x085d('0x19')],'include':_0x19386[_0x085d('0x1b')]?_[_0x085d('0x1c')](_0x19386[_0x085d('0x1b')],function(_0x596862){return{'model':db[_0x596862[_0x085d('0x1d')]],'as':_0x596862['as'],'attributes':_0x596862[_0x085d('0x19')],'include':_0x596862['include']?_[_0x085d('0x1c')](_0x596862['include'],function(_0x1cc755){return{'model':db[_0x1cc755[_0x085d('0x1d')]],'as':_0x1cc755['as'],'attributes':_0x1cc755['attributes']};}):[]};}):[]};}):[]:[]})[_0x085d('0x23')](function(_0x1c1783){if(_0x4d14b4[_0x085d('0x17')][_0x085d('0x24')]===!![])_0x1c1783[_0x085d('0x25')]('smtpOptions',_0x1c1783[_0x085d('0x26')]());logger['info']('ShowMailAccount',_0x4d14b4);logger[_0x085d('0x1f')](_0x085d('0x21'),_0x4d14b4,JSON[_0x085d('0x20')](_0x1c1783));_0x36bd27(_0x1c1783);})[_0x085d('0x15')](function(_0xd9d33e){logger['error'](_0x085d('0x21'),_0xd9d33e['message'],_0x4d14b4);_0x1e5cae(_0x30b632[_0x085d('0x11')](0x1f4,_0xd9d33e[_0x085d('0x13')]));});});};exports[_0x085d('0x27')]=function(_0x544125){var _0xf8164f=this;return new Promise(function(_0x55d81a,_0x3d3b7e){var _0x284172={'body':_0x544125['body'],'channel':_0x085d('0x28')};var _0x23c52a=_[_0x085d('0x29')](_['keys'](db['CmContact'][_0x085d('0x2a')]),[_0x085d('0x2b'),_0x085d('0x2c'),_0x085d('0x2d'),_0x085d('0x2e')]);var _0x367a32=![];if(_0x544125[_0x085d('0x2f')]['id']){delete _0x544125[_0x085d('0x2f')]['id'];}if(_[_0x085d('0x30')](_0x544125[_0x085d('0x2f')]['from'])){return _0x3d3b7e(_0xf8164f['error'](0x1f4,_0x085d('0x31')));}if(_[_0x085d('0x30')](_0x544125[_0x085d('0x2f')][_0x085d('0x2f')])||_0x544125[_0x085d('0x2f')][_0x085d('0x2f')]===''){return _0x3d3b7e(_0xf8164f[_0x085d('0x11')](0x1f4,_0x085d('0x32')));}if(_[_0x085d('0x30')](_0x544125[_0x085d('0x2f')][_0x085d('0x33')])){return _0x3d3b7e(_0xf8164f['error'](0x1f4,_0x085d('0x34')+_0x23c52a));}if(!_[_0x085d('0x35')](_0x23c52a,_0x544125[_0x085d('0x2f')][_0x085d('0x33')])){return _0x3d3b7e(_0xf8164f[_0x085d('0x11')](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x23c52a));}var _0x13ba2d={};_0x13ba2d[_0x544125['body'][_0x085d('0x33')]]=_0x544125['body']['from'];return db[_0x085d('0x16')][_0x085d('0x22')]({'where':{'id':_0x544125[_0x085d('0x36')]['id']},'include':[{'model':db[_0x085d('0x37')],'as':_0x085d('0x38'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x13ba2d,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db['MailApplication'],'as':_0x085d('0x39')},{'model':db[_0x085d('0x3a')],'as':'Smtp','include':[{'model':db[_0x085d('0x3b')],'as':'CloudProvider'}]}]})['then'](function(_0x415a4b){if(_0x415a4b&&_0x415a4b[_0x085d('0x38')]){var _0x1da4b8=_0x415a4b[_0x085d('0x3c')]({'plain':!![]});_0x284172['account']=_[_0x085d('0x3d')](_0x1da4b8,['Applications',_0x085d('0x38')]);_0x284172[_0x085d('0x36')]['smtpOptions']=_0x415a4b[_0x085d('0x26')]();_0x284172[_0x085d('0x3e')]=_0x1da4b8[_0x085d('0x39')];_0x284172[_0x085d('0x3f')]=_0x1da4b8['List'];_0x284172[_0x085d('0x3e')]=_['orderBy'](_0x284172[_0x085d('0x3e')],['priority'],['asc']);if(_0x284172[_0x085d('0x36')]&&_0x284172[_0x085d('0x36')][_0x085d('0x40')]){_0x284172[_0x085d('0x3e')][_0x085d('0x41')]({'id':0x0,'priority':_0x284172[_0x085d('0x3e')][_0x085d('0x42')]+0x1,'app':_0x085d('0x43'),'appdata':'autoclose','interval':'*,*,*,*'});}if(_0x284172['account'][_0x085d('0x39')]){delete _0x284172['account'][_0x085d('0x39')];}if(_0x284172['account'][_0x085d('0x38')]){delete _0x284172[_0x085d('0x36')][_0x085d('0x38')];}if(_0x1da4b8[_0x085d('0x38')]['Contacts']['length']){return _0x1da4b8[_0x085d('0x38')][_0x085d('0x44')][0x0];}var _0x5389b0=_[_0x085d('0x7')](_0x544125[_0x085d('0x2f')],{'firstName':_0x544125[_0x085d('0x2f')][_0x085d('0x45')],'ListId':_0x1da4b8[_0x085d('0x2e')]});_0x5389b0[_0x544125[_0x085d('0x2f')][_0x085d('0x33')]]=_0x544125[_0x085d('0x2f')]['from'];return db[_0x085d('0x46')]['create'](_0x5389b0);}else{throw new Error(_0x085d('0x47'));}})['then'](function(_0x258405){_0x284172['contact']=_0x258405;if(_0x258405){if(!_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['messageId']){_0x544125['body'][_0x085d('0x13')][_0x085d('0x48')]=rs[_0x085d('0x49')]()+'\x20'+_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x45')];}var _0x6f2f88={'ContactId':_0x258405['id'],'MailAccountId':_0x544125[_0x085d('0x36')]['id'],'inReplyTo':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x48')],'to':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x45')],'cc':_0x544125['body']['message']['cc'],'subject':_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['subject'],'attach':_0x544125['body']['message'][_0x085d('0x4a')],'lastMsgAt':moment()[_0x085d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x085d('0x4c')][_0x085d('0x22')]({'where':{'closed':![],'MailAccountId':_0x544125[_0x085d('0x36')]['id']},'include':[{'model':db['MailMessage'],'as':_0x085d('0x4d'),'attributes':[_0x085d('0x48')],'where':{'messageId':_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['inReplyTo']}}]})[_0x085d('0x23')](function(_0x28018b){if(_0x28018b){return[_0x28018b,![]];}return db['MailInteraction'][_0x085d('0x4e')](_0x6f2f88)[_0x085d('0x23')](function(_0x1a7ddc){return[_0x1a7ddc,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x580904,_0x268ecc){if(_0x580904){_0x367a32=_0x268ecc;if(!_0x268ecc){return _0x580904[_0x085d('0x4f')]({'inReplyTo':_0x544125['body'][_0x085d('0x13')]['messageId'],'to':_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['from'],'cc':_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['cc'],'subject':_0x544125['body'][_0x085d('0x13')][_0x085d('0x50')],'attach':_0x580904[_0x085d('0x4a')]?_0x580904[_0x085d('0x4a')]:_0x544125['body']['message'][_0x085d('0x4a')],'substatus':null,'substatusAt':moment()[_0x085d('0x4b')](_0x085d('0x51')),'lastMsgAt':moment()[_0x085d('0x4b')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x580904;}}})['then'](function(_0x4b7d50){_0x284172[_0x085d('0x52')]=_0x4b7d50['get']({'plain':!![]});_0x284172['interaction'][_0x085d('0x53')]=_0x367a32;return db['MailMessage'][_0x085d('0x4e')]({'body':_0x544125[_0x085d('0x2f')][_0x085d('0x2f')],'MailAccountId':_0x544125[_0x085d('0x36')]['id'],'MailInteractionId':_0x4b7d50['id'],'direction':'in','ContactId':_0x284172['contact']['id'],'messageId':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x48')],'from':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x45')],'to':_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['to'],'cc':_0x544125[_0x085d('0x2f')][_0x085d('0x13')]['cc'],'subject':_0x544125['body']['message'][_0x085d('0x50')],'attach':_0x544125[_0x085d('0x2f')]['message'][_0x085d('0x4a')],'Attachments':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x54')],'originTo':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x55')],'originCc':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x56')],'bcc':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x57')],'ChatWebsiteId':_0x544125[_0x085d('0x2f')][_0x085d('0x13')][_0x085d('0x58')]||null,'originChannel':_0x544125[_0x085d('0x2f')]['message'][_0x085d('0x59')]||_0x085d('0x5a'),'ChatOfflineMessageId':_0x544125[_0x085d('0x2f')]['message'][_0x085d('0x5b')]||null},{'include':[{'model':db[_0x085d('0x5c')],'as':'Attachments'}]});})[_0x085d('0x23')](function(_0x279dcb){_0x284172['message']=_0x279dcb;if(!_0x284172[_0x085d('0x52')][_0x085d('0x5d')]){return;}return db[_0x085d('0x5e')][_0x085d('0x22')]({'attributes':['id',_0x085d('0x5f')],'where':{'id':_0x284172['interaction'][_0x085d('0x5d')]}});})[_0x085d('0x23')](function(_0x5ada01){if(_0x5ada01){_0x284172['applications'][_0x085d('0x60')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5ada01[_0x085d('0x5f')]+','+(_0x284172[_0x085d('0x36')][_0x085d('0x61')]||0xa),'interval':_0x085d('0x62')});}if(!_0x284172['interaction']['queueId']){return;}return db[_0x085d('0x63')][_0x085d('0x22')]({'attributes':['id',_0x085d('0x5f')],'where':{'id':_0x284172['interaction'][_0x085d('0x64')]}});})['then'](function(_0x2f78b6){if(_0x2f78b6){_0x284172[_0x085d('0x3e')][_0x085d('0x60')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x2f78b6[_0x085d('0x5f')]+','+(_0x284172['account'][_0x085d('0x65')]||0x12c),'interval':_0x085d('0x62')});}return respondWithRpcPromise(_0x085d('0x66'),'startRouting',_0x284172);})['then'](function(_0x1c62e5){_0x55d81a(_0x1c62e5);})[_0x085d('0x15')](function(_0x312f83){_0x3d3b7e(_0xf8164f[_0x085d('0x11')](0x1f4,_0x312f83['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index c9d472c..3e23161 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 _0x8aac=['save','remove','update','removeListener','register','length','mailAccount:','./mailAccount.events'];(function(_0x5bf18d,_0x264c55){var _0x1d6cc0=function(_0x2d69d9){while(--_0x2d69d9){_0x5bf18d['push'](_0x5bf18d['shift']());}};_0x1d6cc0(++_0x264c55);}(_0x8aac,0x6f));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0xc8aa('0x0'));var events=[_0xc8aa('0x1'),_0xc8aa('0x2'),_0xc8aa('0x3')];function createListener(_0x49ec7d,_0x308d24){return function(_0xecafb2){_0x308d24['emit'](_0x49ec7d,_0xecafb2);};}function removeListener(_0x352cdf,_0x8fd3b2){return function(){MailAccountEvents[_0xc8aa('0x4')](_0x352cdf,_0x8fd3b2);};}exports[_0xc8aa('0x5')]=function(_0x4975be){for(var _0x54e1b3=0x0,_0x3862b4=events[_0xc8aa('0x6')];_0x54e1b3<_0x3862b4;_0x54e1b3++){var _0x2f5666=events[_0x54e1b3];var _0x33f5df=createListener(_0xc8aa('0x7')+_0x2f5666,_0x4975be);MailAccountEvents['on'](_0x2f5666,_0x33f5df);}}; \ No newline at end of file +var _0x7dff=['emit','removeListener','register','length','mailAccount:','./mailAccount.events','remove'];(function(_0x3d6759,_0x386888){var _0x394d7=function(_0x43f095){while(--_0x43f095){_0x3d6759['push'](_0x3d6759['shift']());}};_0x394d7(++_0x386888);}(_0x7dff,0x75));var _0xf7df=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x7dff[_0x16d10f];return _0x50c823;};'use strict';var MailAccountEvents=require(_0xf7df('0x0'));var events=['save',_0xf7df('0x1'),'update'];function createListener(_0x296d19,_0x1280c4){return function(_0x4c7e00){_0x1280c4[_0xf7df('0x2')](_0x296d19,_0x4c7e00);};}function removeListener(_0xbbf1e3,_0x4c3fb8){return function(){MailAccountEvents[_0xf7df('0x3')](_0xbbf1e3,_0x4c3fb8);};}exports[_0xf7df('0x4')]=function(_0x1a49b7){for(var _0x45b1b8=0x0,_0x8d3f0=events[_0xf7df('0x5')];_0x45b1b8<_0x8d3f0;_0x45b1b8++){var _0x298ffc=events[_0x45b1b8];var _0x542e60=createListener(_0xf7df('0x6')+_0x298ffc,_0x1a49b7);MailAccountEvents['on'](_0x298ffc,_0x542e60);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index a8fbb1e..e351547 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 _0x351e=['/:id','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailApplication.controller','get','isAuthenticated','put'];(function(_0x5bcef5,_0x935d6d){var _0x2f2e6d=function(_0x13c029){while(--_0x13c029){_0x5bcef5['push'](_0x5bcef5['shift']());}};_0x2f2e6d(++_0x935d6d);}(_0x351e,0x115));var _0xe351=function(_0x56222e,_0x48569f){_0x56222e=_0x56222e-0x0;var _0x373b78=_0x351e[_0x56222e];return _0x373b78;};'use strict';var multer=require(_0xe351('0x0'));var util=require(_0xe351('0x1'));var path=require(_0xe351('0x2'));var timeout=require('connect-timeout');var express=require(_0xe351('0x3'));var router=express[_0xe351('0x4')]();var fs_extra=require(_0xe351('0x5'));var auth=require(_0xe351('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe351('0x7'));var controller=require(_0xe351('0x8'));router[_0xe351('0x9')]('/:id',auth[_0xe351('0xa')](),controller['show']);router[_0xe351('0xb')](_0xe351('0xc'),auth[_0xe351('0xa')](),controller[_0xe351('0xd')]);router[_0xe351('0xe')](_0xe351('0xc'),auth['isAuthenticated'](),controller[_0xe351('0xf')]);module[_0xe351('0x10')]=router; \ No newline at end of file +var _0xd206=['show','put','/:id','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x68d94e,_0x5b51dd){var _0x3240a4=function(_0x1e2043){while(--_0x1e2043){_0x68d94e['push'](_0x68d94e['shift']());}};_0x3240a4(++_0x5b51dd);}(_0xd206,0xd5));var _0x6d20=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xd206[_0x411017];return _0x2adeea;};'use strict';var multer=require(_0x6d20('0x0'));var util=require(_0x6d20('0x1'));var path=require(_0x6d20('0x2'));var timeout=require(_0x6d20('0x3'));var express=require(_0x6d20('0x4'));var router=express[_0x6d20('0x5')]();var fs_extra=require(_0x6d20('0x6'));var auth=require(_0x6d20('0x7'));var interaction=require(_0x6d20('0x8'));var config=require(_0x6d20('0x9'));var controller=require(_0x6d20('0xa'));router['get']('/:id',auth['isAuthenticated'](),controller[_0x6d20('0xb')]);router[_0x6d20('0xc')](_0x6d20('0xd'),auth[_0x6d20('0xe')](),controller['update']);router['delete'](_0x6d20('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6d20('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 1a4a713..f7e5503 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 _0xaa93=['*,*,*,*','INTEGER','STRING','noop','TEXT'];(function(_0x26d26f,_0x5ddc55){var _0x142a27=function(_0x22b742){while(--_0x22b742){_0x26d26f['push'](_0x26d26f['shift']());}};_0x142a27(++_0x5ddc55);}(_0xaa93,0x1d7));var _0x3aa9=function(_0x586094,_0x40e039){_0x586094=_0x586094-0x0;var _0x4d4457=_0xaa93[_0x586094];return _0x4d4457;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x3aa9('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x3aa9('0x1')],'allowNull':![],'defaultValue':_0x3aa9('0x2')},'appdata':{'type':Sequelize[_0x3aa9('0x3')]()},'description':{'type':Sequelize[_0x3aa9('0x1')]},'interval':{'type':Sequelize[_0x3aa9('0x1')],'defaultValue':_0x3aa9('0x4')}}; \ No newline at end of file +var _0x9d2d=['INTEGER','noop','TEXT','*,*,*,*','sequelize','exports'];(function(_0x36b2ef,_0x182715){var _0x2a5fae=function(_0x3f22e9){while(--_0x3f22e9){_0x36b2ef['push'](_0x36b2ef['shift']());}};_0x2a5fae(++_0x182715);}(_0x9d2d,0x190));var _0xd9d2=function(_0x5915c8,_0x2f6f54){_0x5915c8=_0x5915c8-0x0;var _0x1bd468=_0x9d2d[_0x5915c8];return _0x1bd468;};'use strict';var Sequelize=require(_0xd9d2('0x0'));module[_0xd9d2('0x1')]={'priority':{'type':Sequelize[_0xd9d2('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd9d2('0x3')},'appdata':{'type':Sequelize[_0xd9d2('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd9d2('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 43d9506..a9dcb4f 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 _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x56f3d4,_0xfc65dd){var _0x2c7ef0=function(_0x587024){while(--_0x587024){_0x56f3d4['push'](_0x56f3d4['shift']());}};_0x2c7ef0(++_0xfc65dd);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file +var _0xe706=['limit','count','offset','set','Content-Range','json','apply','save','update','then','end','name','send','show','params','model','keys','MailApplication','rawAttributes','query','filters','attributes','intersection','fields','length','includeAll','include','merge','options','find','body','catch','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0xe706,0xa3));var _0x6e70=function(_0xfcc030,_0x3ec053){_0xfcc030=_0xfcc030-0x0;var _0x5caa66=_0xe706[_0xfcc030];return _0x5caa66;};'use strict';var emlformat=require(_0x6e70('0x0'));var rimraf=require(_0x6e70('0x1'));var zipdir=require(_0x6e70('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e70('0x3'));var moment=require(_0x6e70('0x4'));var BPromise=require(_0x6e70('0x5'));var Mustache=require(_0x6e70('0x6'));var util=require(_0x6e70('0x7'));var path=require(_0x6e70('0x8'));var sox=require(_0x6e70('0x9'));var csv=require(_0x6e70('0xa'));var ejs=require(_0x6e70('0xb'));var fs=require('fs');var fs_extra=require(_0x6e70('0xc'));var _=require(_0x6e70('0xd'));var squel=require(_0x6e70('0xe'));var crypto=require(_0x6e70('0xf'));var jsforce=require(_0x6e70('0x10'));var deskjs=require(_0x6e70('0x11'));var toCsv=require(_0x6e70('0xa'));var querystring=require(_0x6e70('0x12'));var Papa=require(_0x6e70('0x13'));var Redis=require(_0x6e70('0x14'));var authService=require(_0x6e70('0x15'));var qs=require(_0x6e70('0x16'));var as=require(_0x6e70('0x17'));var hardwareService=require(_0x6e70('0x18'));var logger=require(_0x6e70('0x19'))('api');var utils=require('../../config/utils');var config=require(_0x6e70('0x1a'));var licenseUtil=require(_0x6e70('0x1b'));var db=require(_0x6e70('0x1c'))['db'];function respondWithStatusCode(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xcc;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x1d')](_0x3b38f3);}return _0x27dd9b[_0x6e70('0x1e')](_0x3b38f3)['end']();};}function respondWithResult(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0xc8;return function(_0x257e81){if(_0x257e81){return _0x52737e['status'](_0x48bc72)['json'](_0x257e81);}};}function respondWithFilteredResult(_0x304716,_0x22c50c){return function(_0x5d9263){if(_0x5d9263){var _0x24f3ac=typeof _0x22c50c['offset']===_0x6e70('0x1f')&&typeof _0x22c50c[_0x6e70('0x20')]==='undefined';var _0x49029f=_0x5d9263[_0x6e70('0x21')];var _0x5ea7a5=_0x24f3ac?0x0:_0x22c50c[_0x6e70('0x22')];var _0x173afe=_0x24f3ac?_0x5d9263['count']:_0x22c50c['offset']+_0x22c50c[_0x6e70('0x20')];var _0x208e21;if(_0x173afe>=_0x49029f){_0x173afe=_0x49029f;_0x208e21=0xc8;}else{_0x208e21=0xce;}_0x304716[_0x6e70('0x1e')](_0x208e21);return _0x304716[_0x6e70('0x23')](_0x6e70('0x24'),_0x5ea7a5+'-'+_0x173afe+'/'+_0x49029f)[_0x6e70('0x25')](_0x5d9263);}return null;};}function patchUpdates(_0x1b2453){return function(_0x44a49f){try{jsonpatch[_0x6e70('0x26')](_0x44a49f,_0x1b2453,!![]);}catch(_0xb29a2a){return BPromise['reject'](_0xb29a2a);}return _0x44a49f[_0x6e70('0x27')]();};}function saveUpdates(_0x344b65,_0x27b294){return function(_0x502b2d){if(_0x502b2d){return _0x502b2d[_0x6e70('0x28')](_0x344b65)[_0x6e70('0x29')](function(_0x3337a6){return _0x3337a6;});}return null;};}function removeEntity(_0x50da2c,_0x10fc91){return function(_0x538b9c){if(_0x538b9c){return _0x538b9c['destroy']()['then'](function(){_0x50da2c[_0x6e70('0x1e')](0xcc)[_0x6e70('0x2a')]();});}};}function handleEntityNotFound(_0x51d292,_0x3ecdf1){return function(_0x1196ed){if(!_0x1196ed){_0x51d292['sendStatus'](0x194);}return _0x1196ed;};}function handleError(_0x338ad6,_0x67fb43){_0x67fb43=_0x67fb43||0x1f4;return function(_0x2bb231){logger['error'](_0x2bb231['stack']);if(_0x2bb231[_0x6e70('0x2b')]){delete _0x2bb231[_0x6e70('0x2b')];}_0x338ad6[_0x6e70('0x1e')](_0x67fb43)[_0x6e70('0x2c')](_0x2bb231);};}exports[_0x6e70('0x2d')]=function(_0x5d772a,_0x1952ea){var _0x406f29={'raw':!![],'where':{'id':_0x5d772a[_0x6e70('0x2e')]['id']}},_0xecf336={};_0xecf336[_0x6e70('0x2f')]=_[_0x6e70('0x30')](db[_0x6e70('0x31')][_0x6e70('0x32')]);_0xecf336[_0x6e70('0x33')]=_[_0x6e70('0x30')](_0x5d772a['query']);_0xecf336[_0x6e70('0x34')]=_['intersection'](_0xecf336[_0x6e70('0x2f')],_0xecf336['query']);_0x406f29[_0x6e70('0x35')]=_[_0x6e70('0x36')](_0xecf336[_0x6e70('0x2f')],qs['fields'](_0x5d772a[_0x6e70('0x33')][_0x6e70('0x37')]));_0x406f29['attributes']=_0x406f29[_0x6e70('0x35')][_0x6e70('0x38')]?_0x406f29['attributes']:_0xecf336[_0x6e70('0x2f')];if(_0x5d772a[_0x6e70('0x33')][_0x6e70('0x39')]){_0x406f29[_0x6e70('0x3a')]=[{'all':!![]}];}_0x406f29=_[_0x6e70('0x3b')]({},_0x406f29,_0x5d772a[_0x6e70('0x3c')]);return db[_0x6e70('0x31')][_0x6e70('0x3d')](_0x406f29)[_0x6e70('0x29')](handleEntityNotFound(_0x1952ea,null))[_0x6e70('0x29')](respondWithResult(_0x1952ea,null))['catch'](handleError(_0x1952ea,null));};exports[_0x6e70('0x28')]=function(_0x4795a0,_0x23cd1a){if(_0x4795a0[_0x6e70('0x3e')]['id']){delete _0x4795a0[_0x6e70('0x3e')]['id'];}return db[_0x6e70('0x31')][_0x6e70('0x3d')]({'where':{'id':_0x4795a0[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x23cd1a,null))[_0x6e70('0x29')](saveUpdates(_0x4795a0[_0x6e70('0x3e')],null))[_0x6e70('0x29')](respondWithResult(_0x23cd1a,null))[_0x6e70('0x3f')](handleError(_0x23cd1a,null));};exports[_0x6e70('0x40')]=function(_0x5594d3,_0x501b53){return db['MailApplication']['find']({'where':{'id':_0x5594d3[_0x6e70('0x2e')]['id']}})[_0x6e70('0x29')](handleEntityNotFound(_0x501b53,null))[_0x6e70('0x29')](removeEntity(_0x501b53,null))[_0x6e70('0x3f')](handleError(_0x501b53,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 6b370e2..ca973c6 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 _0xd334=['mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailApplication'];(function(_0x5f3b30,_0x10400b){var _0x2584b2=function(_0x2eb82f){while(--_0x2eb82f){_0x5f3b30['push'](_0x5f3b30['shift']());}};_0x2584b2(++_0x10400b);}(_0xd334,0x1a7));var _0x4d33=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xd334[_0x1d9aa0];return _0x226868;};'use strict';var _=require(_0x4d33('0x0'));var util=require(_0x4d33('0x1'));var logger=require('../../config/logger')(_0x4d33('0x2'));var moment=require(_0x4d33('0x3'));var BPromise=require(_0x4d33('0x4'));var rp=require(_0x4d33('0x5'));var fs=require('fs');var path=require(_0x4d33('0x6'));var rimraf=require(_0x4d33('0x7'));var config=require(_0x4d33('0x8'));var attributes=require('./mailApplication.attributes');module[_0x4d33('0x9')]=function(_0x5b94cc,_0x5da95b){return _0x5b94cc[_0x4d33('0xa')](_0x4d33('0xb'),attributes,{'tableName':_0x4d33('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d33('0xd'),'collate':_0x4d33('0xe')});}; \ No newline at end of file +var _0x9a33=['request-promise','path','exports','define','MailApplication','utf8mb4_unicode_ci','lodash','api','moment','bluebird'];(function(_0x4e7413,_0x5dffb1){var _0x11b6de=function(_0xd6721b){while(--_0xd6721b){_0x4e7413['push'](_0x4e7413['shift']());}};_0x11b6de(++_0x5dffb1);}(_0x9a33,0x11e));var _0x39a3=function(_0x5207d3,_0x1b67d4){_0x5207d3=_0x5207d3-0x0;var _0x36785c=_0x9a33[_0x5207d3];return _0x36785c;};'use strict';var _=require(_0x39a3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x39a3('0x1'));var moment=require(_0x39a3('0x2'));var BPromise=require(_0x39a3('0x3'));var rp=require(_0x39a3('0x4'));var fs=require('fs');var path=require(_0x39a3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module[_0x39a3('0x6')]=function(_0xa47586,_0x40e15f){return _0xa47586[_0x39a3('0x7')](_0x39a3('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x39a3('0x9')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 4503358..a8dba8b 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 _0x136a=['lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','MailApplication,\x20%s,\x20%s','message','catch','UpdateMailApplication','MailApplication','update','body','options','raw','where','limit','then'];(function(_0x418fd2,_0x18ae8b){var _0x49ebee=function(_0x1d990c){while(--_0x1d990c){_0x418fd2['push'](_0x418fd2['shift']());}};_0x49ebee(++_0x18ae8b);}(_0x136a,0x196));var _0xa136=function(_0x423268,_0x2ba81d){_0x423268=_0x423268-0x0;var _0x1dc336=_0x136a[_0x423268];return _0x1dc336;};'use strict';var _=require(_0xa136('0x0'));var util=require('util');var moment=require(_0xa136('0x1'));var BPromise=require(_0xa136('0x2'));var rs=require(_0xa136('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa136('0x4'))['db'];var utils=require(_0xa136('0x5'));var logger=require(_0xa136('0x6'))(_0xa136('0x7'));var config=require('../../config/environment');var jayson=require(_0xa136('0x8'));var client=jayson['client'][_0xa136('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d64e,_0x3da4b1,_0x57124e){return new BPromise(function(_0x21bd51,_0x3fdea7){return client[_0xa136('0xa')](_0x30d64e,_0x57124e)['then'](function(_0x2a2b2c){logger[_0xa136('0xb')]('MailApplication,\x20%s,\x20%s',_0x3da4b1,_0xa136('0xc'));logger[_0xa136('0xd')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x3da4b1,'request\x20sent',JSON[_0xa136('0xe')](_0x2a2b2c));if(_0x2a2b2c[_0xa136('0xf')]){if(_0x2a2b2c[_0xa136('0xf')][_0xa136('0x10')]===0x1f4){logger['error'](_0xa136('0x11'),_0x3da4b1,_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);return _0x3fdea7(_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);}logger[_0xa136('0xf')]('MailApplication,\x20%s,\x20%s',_0x3da4b1,_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);return _0x21bd51(_0x2a2b2c[_0xa136('0xf')][_0xa136('0x12')]);}else{logger[_0xa136('0xb')]('MailApplication,\x20%s,\x20%s',_0x3da4b1,_0xa136('0xc'));_0x21bd51(_0x2a2b2c['result']['message']);}})[_0xa136('0x13')](function(_0x3764f4){logger[_0xa136('0xf')](_0xa136('0x11'),_0x3da4b1,_0x3764f4);_0x3fdea7(_0x3764f4);});});}exports[_0xa136('0x14')]=function(_0x479cf8){var _0x154b7f=this;return new Promise(function(_0xedebe4,_0x5ee62f){return db[_0xa136('0x15')][_0xa136('0x16')](_0x479cf8[_0xa136('0x17')],{'raw':_0x479cf8[_0xa136('0x18')]?_0x479cf8['options'][_0xa136('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x479cf8[_0xa136('0x18')]?_0x479cf8[_0xa136('0x18')][_0xa136('0x1a')]||null:null,'attributes':_0x479cf8[_0xa136('0x18')]?_0x479cf8[_0xa136('0x18')]['attributes']||null:null,'limit':_0x479cf8[_0xa136('0x18')]?_0x479cf8[_0xa136('0x18')][_0xa136('0x1b')]||null:null})[_0xa136('0x1c')](function(_0x2a8b69){logger['info'](_0xa136('0x14'),_0x479cf8);logger[_0xa136('0xd')](_0xa136('0x14'),_0x479cf8,JSON[_0xa136('0xe')](_0x2a8b69));_0xedebe4(_0x2a8b69);})[_0xa136('0x13')](function(_0x54febf){logger[_0xa136('0xf')](_0xa136('0x14'),_0x54febf[_0xa136('0x12')],_0x479cf8);_0x5ee62f(_0x154b7f[_0xa136('0xf')](0x1f4,_0x54febf[_0xa136('0x12')]));});});}; \ No newline at end of file +var _0xb7af=['update','body','options','raw','where','attributes','limit','then','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication'];(function(_0x4d5e76,_0x36c8e0){var _0x5d76ee=function(_0x242f38){while(--_0x242f38){_0x4d5e76['push'](_0x4d5e76['shift']());}};_0x5d76ee(++_0x36c8e0);}(_0xb7af,0x89));var _0xfb7a=function(_0x34f7bb,_0x547eb3){_0x34f7bb=_0x34f7bb-0x0;var _0x2efee3=_0xb7af[_0x34f7bb];return _0x2efee3;};'use strict';var _=require(_0xfb7a('0x0'));var util=require('util');var moment=require(_0xfb7a('0x1'));var BPromise=require(_0xfb7a('0x2'));var rs=require(_0xfb7a('0x3'));var fs=require('fs');var Redis=require(_0xfb7a('0x4'));var db=require(_0xfb7a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb7a('0x6'))('rpc');var config=require(_0xfb7a('0x7'));var jayson=require(_0xfb7a('0x8'));var client=jayson[_0xfb7a('0x9')][_0xfb7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539758,_0x41eccf,_0x6ab988){return new BPromise(function(_0x17eba6,_0x1d467a){return client[_0xfb7a('0xb')](_0x539758,_0x6ab988)['then'](function(_0x679508){logger[_0xfb7a('0xc')](_0xfb7a('0xd'),_0x41eccf,_0xfb7a('0xe'));logger['debug'](_0xfb7a('0xf'),_0x41eccf,_0xfb7a('0xe'),JSON[_0xfb7a('0x10')](_0x679508));if(_0x679508['error']){if(_0x679508[_0xfb7a('0x11')][_0xfb7a('0x12')]===0x1f4){logger[_0xfb7a('0x11')](_0xfb7a('0xd'),_0x41eccf,_0x679508['error'][_0xfb7a('0x13')]);return _0x1d467a(_0x679508[_0xfb7a('0x11')][_0xfb7a('0x13')]);}logger[_0xfb7a('0x11')](_0xfb7a('0xd'),_0x41eccf,_0x679508[_0xfb7a('0x11')]['message']);return _0x17eba6(_0x679508[_0xfb7a('0x11')]['message']);}else{logger[_0xfb7a('0xc')](_0xfb7a('0xd'),_0x41eccf,_0xfb7a('0xe'));_0x17eba6(_0x679508[_0xfb7a('0x14')][_0xfb7a('0x13')]);}})['catch'](function(_0x36b167){logger[_0xfb7a('0x11')](_0xfb7a('0xd'),_0x41eccf,_0x36b167);_0x1d467a(_0x36b167);});});}exports[_0xfb7a('0x15')]=function(_0x2a71ec){var _0x1550d0=this;return new Promise(function(_0x139dfe,_0x2be077){return db[_0xfb7a('0x16')][_0xfb7a('0x17')](_0x2a71ec[_0xfb7a('0x18')],{'raw':_0x2a71ec['options']?_0x2a71ec[_0xfb7a('0x19')][_0xfb7a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a71ec[_0xfb7a('0x19')]?_0x2a71ec['options'][_0xfb7a('0x1b')]||null:null,'attributes':_0x2a71ec[_0xfb7a('0x19')]?_0x2a71ec['options'][_0xfb7a('0x1c')]||null:null,'limit':_0x2a71ec[_0xfb7a('0x19')]?_0x2a71ec[_0xfb7a('0x19')][_0xfb7a('0x1d')]||null:null})[_0xfb7a('0x1e')](function(_0x135e06){logger[_0xfb7a('0xc')]('UpdateMailApplication',_0x2a71ec);logger[_0xfb7a('0x1f')](_0xfb7a('0x15'),_0x2a71ec,JSON[_0xfb7a('0x10')](_0x135e06));_0x139dfe(_0x135e06);})['catch'](function(_0x693e7){logger[_0xfb7a('0x11')](_0xfb7a('0x15'),_0x693e7[_0xfb7a('0x13')],_0x2a71ec);_0x2be077(_0x1550d0[_0xfb7a('0x11')](0x1f4,_0x693e7[_0xfb7a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index f9bbf36..3a0ea3c 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 _0x9883=['tracked','mail','mailinteraction:addtags','addTags','put','mailinteraction:update','delete','mailinteraction:destroy','destroy','removeTags','exports','express','Router','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','/:id/tags'];(function(_0x3a4924,_0x33d2dd){var _0xbc226d=function(_0x25212f){while(--_0x25212f){_0x3a4924['push'](_0x3a4924['shift']());}};_0xbc226d(++_0x33d2dd);}(_0x9883,0x8d));var _0x3988=function(_0x5cd572,_0x452ec8){_0x5cd572=_0x5cd572-0x0;var _0x447a65=_0x9883[_0x5cd572];return _0x447a65;};'use strict';var express=require(_0x3988('0x0'));var router=express[_0x3988('0x1')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var controller=require(_0x3988('0x2'));router[_0x3988('0x3')]('/',auth['isAuthenticated'](),controller[_0x3988('0x4')]);router[_0x3988('0x3')](_0x3988('0x5'),auth[_0x3988('0x6')](),controller[_0x3988('0x7')]);router[_0x3988('0x3')](_0x3988('0x8'),auth[_0x3988('0x6')](),controller[_0x3988('0x9')]);router[_0x3988('0x3')](_0x3988('0xa'),auth['isAuthenticated'](),controller[_0x3988('0xb')]);router[_0x3988('0x3')](_0x3988('0xc'),auth[_0x3988('0x6')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x3988('0xd')]('/:id/messages',auth[_0x3988('0x6')](),controller['addMessage']);router[_0x3988('0xd')](_0x3988('0xe'),auth[_0x3988('0x6')](),interaction[_0x3988('0xf')](_0x3988('0x10'),_0x3988('0x11')),controller[_0x3988('0x12')]);router[_0x3988('0x13')](_0x3988('0x8'),auth[_0x3988('0x6')](),interaction[_0x3988('0xf')](_0x3988('0x10'),_0x3988('0x14')),controller['update']);router[_0x3988('0x15')](_0x3988('0x8'),auth['isAuthenticated'](),interaction[_0x3988('0xf')](_0x3988('0x10'),_0x3988('0x16')),controller[_0x3988('0x17')]);router[_0x3988('0x15')](_0x3988('0xe'),auth['isAuthenticated'](),controller[_0x3988('0x18')]);module[_0x3988('0x19')]=router; \ No newline at end of file +var _0x13ce=['mail','mailinteraction:addtags','addTags','mailinteraction:update','update','mailinteraction:destroy','destroy','delete','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','/:id','show','/:id/messages','getMessages','download','post','addMessage','/:id/tags','tracked'];(function(_0x2940e1,_0x780f8a){var _0x22c76d=function(_0x43b58a){while(--_0x43b58a){_0x2940e1['push'](_0x2940e1['shift']());}};_0x22c76d(++_0x780f8a);}(_0x13ce,0x110));var _0xe13c=function(_0x4ce050,_0x2ec235){_0x4ce050=_0x4ce050-0x0;var _0x2fc8c9=_0x13ce[_0x4ce050];return _0x2fc8c9;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0xe13c('0x0'));var interaction=require(_0xe13c('0x1'));var controller=require(_0xe13c('0x2'));router[_0xe13c('0x3')]('/',auth['isAuthenticated'](),controller[_0xe13c('0x4')]);router['get'](_0xe13c('0x5'),auth[_0xe13c('0x6')](),controller['describe']);router['get'](_0xe13c('0x7'),auth[_0xe13c('0x6')](),controller[_0xe13c('0x8')]);router[_0xe13c('0x3')](_0xe13c('0x9'),auth[_0xe13c('0x6')](),controller[_0xe13c('0xa')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xe13c('0xb')]);router[_0xe13c('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe13c('0xc')](_0xe13c('0x9'),auth[_0xe13c('0x6')](),controller[_0xe13c('0xd')]);router['post'](_0xe13c('0xe'),auth[_0xe13c('0x6')](),interaction[_0xe13c('0xf')](_0xe13c('0x10'),_0xe13c('0x11')),controller[_0xe13c('0x12')]);router['put'](_0xe13c('0x7'),auth['isAuthenticated'](),interaction[_0xe13c('0xf')](_0xe13c('0x10'),_0xe13c('0x13')),controller[_0xe13c('0x14')]);router['delete'](_0xe13c('0x7'),auth[_0xe13c('0x6')](),interaction[_0xe13c('0xf')](_0xe13c('0x10'),_0xe13c('0x15')),controller[_0xe13c('0x16')]);router[_0xe13c('0x17')](_0xe13c('0xe'),auth[_0xe13c('0x6')](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 472d806..0bf6f1c 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 _0x64d4=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','INTEGER','sequelize','iconv','exports'];(function(_0xf74b3a,_0x5244a2){var _0x476154=function(_0x55d5bb){while(--_0x55d5bb){_0xf74b3a['push'](_0xf74b3a['shift']());}};_0x476154(++_0x5244a2);}(_0x64d4,0x1a1));var _0x464d=function(_0x3a0d4b,_0x5bcf1a){_0x3a0d4b=_0x3a0d4b-0x0;var _0x4f3fdf=_0x64d4[_0x3a0d4b];return _0x4f3fdf;};'use strict';var Sequelize=require(_0x464d('0x0'));var iconv=require(_0x464d('0x1'));module[_0x464d('0x2')]={'closed':{'type':Sequelize[_0x464d('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x464d('0x4')]},'disposition':{'type':Sequelize[_0x464d('0x5')]},'secondDisposition':{'type':Sequelize[_0x464d('0x5')]},'thirdDisposition':{'type':Sequelize[_0x464d('0x5')]},'note':{'type':Sequelize[_0x464d('0x5')]},'inReplyTo':{'type':Sequelize[_0x464d('0x5')](0x1fe)},'to':{'type':Sequelize[_0x464d('0x5')]},'cc':{'type':Sequelize[_0x464d('0x6')]('long')},'subject':{'type':Sequelize[_0x464d('0x6')]()},'attach':{'type':Sequelize[_0x464d('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x464d('0x4')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x464d('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x464d('0x7')]('in',_0x464d('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x464d('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x464d('0x7')]('in',_0x464d('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x464d('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x464d('0x9')]}}; \ No newline at end of file +var _0x6c76=['DATE','STRING','long','TEXT','out','INTEGER','sequelize','exports','BOOLEAN'];(function(_0x2db2e4,_0x49130e){var _0x2ef52d=function(_0x429b1a){while(--_0x429b1a){_0x2db2e4['push'](_0x2db2e4['shift']());}};_0x2ef52d(++_0x49130e);}(_0x6c76,0xc3));var _0x66c7=function(_0x242aba,_0x408ca7){_0x242aba=_0x242aba-0x0;var _0x8326f7=_0x6c76[_0x242aba];return _0x8326f7;};'use strict';var Sequelize=require(_0x66c7('0x0'));var iconv=require('iconv');module[_0x66c7('0x1')]={'closed':{'type':Sequelize[_0x66c7('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x66c7('0x3')]},'disposition':{'type':Sequelize[_0x66c7('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x66c7('0x4')]},'note':{'type':Sequelize[_0x66c7('0x4')]},'inReplyTo':{'type':Sequelize[_0x66c7('0x4')](0x1fe)},'to':{'type':Sequelize[_0x66c7('0x4')]},'cc':{'type':Sequelize['TEXT'](_0x66c7('0x5'))},'subject':{'type':Sequelize[_0x66c7('0x6')]()},'attach':{'type':Sequelize[_0x66c7('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x66c7('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x66c7('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x66c7('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x66c7('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x66c7('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x66c7('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 959f32a..e6330ee 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 _0xb60a=['from','decode','headers','Bcc','basename','existsSync','attachments','readFileSync','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','bluebird','path','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','getOptions','findAll','mail','query','catch','show','model','keys','intersection','attributes','fields','length','include','options','MailInteraction','body','params','find','addMessage','MailMessage','ids','omit','getMessages','filters','hasOwnProperty','nolimit','order','sort','pick','where','MailInteractionId','filter','$gte','split','merge','includeAll','true','rows','Tag','emit','removeTags','download','unix','toString','root','server','files','tmp','join','format','transcript-%d-%s.zip','push','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each'];(function(_0x3dbcf7,_0x1e72e2){var _0x10ac80=function(_0x38a169){while(--_0x38a169){_0x3dbcf7['push'](_0x3dbcf7['shift']());}};_0x10ac80(++_0x1e72e2);}(_0xb60a,0x1b6));var _0xab60=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xb60a[_0x2d7f0e];return _0x110b07;};'use strict';var emlformat=require(_0xab60('0x0'));var rimraf=require(_0xab60('0x1'));var zipdir=require(_0xab60('0x2'));var moment=require('moment');var BPromise=require(_0xab60('0x3'));var util=require('util');var path=require(_0xab60('0x4'));var fs=require('fs');var _=require(_0xab60('0x5'));var juice=require('juice');var Redis=require(_0xab60('0x6'));var interaction=require(_0xab60('0x7'));var qs=require('../../components/parsers/qs');var logger=require(_0xab60('0x8'))(_0xab60('0x9'));var config=require('../../config/environment');var db=require(_0xab60('0xa'))['db'];var htmlEntities=require(_0xab60('0xb'));config[_0xab60('0xc')]=_['defaults'](config[_0xab60('0xc')],{'host':_0xab60('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xab60('0xe'))[_0xab60('0xf')](socket);function respondWithStatusCode(_0x44b12c,_0x2004b9){_0x2004b9=_0x2004b9||0xcc;return function(_0x3b6be3){if(_0x3b6be3){return _0x44b12c[_0xab60('0x10')](_0x2004b9);}return _0x44b12c[_0xab60('0x11')](_0x2004b9)[_0xab60('0x12')]();};}function respondWithResult(_0xcc7fe0,_0x23cb63){_0x23cb63=_0x23cb63||0xc8;return function(_0x3930a4){if(_0x3930a4){return _0xcc7fe0[_0xab60('0x11')](_0x23cb63)['json'](_0x3930a4);}};}function respondWithFilteredResult(_0x3f77e9,_0xc9b1ce){return function(_0x33a446){if(_0x33a446){var _0xeea5e2=typeof _0xc9b1ce[_0xab60('0x13')]===_0xab60('0x14')&&typeof _0xc9b1ce[_0xab60('0x15')]==='undefined';var _0x5af438=_0x33a446[_0xab60('0x16')];var _0x5af819=_0xeea5e2?0x0:_0xc9b1ce['offset'];var _0x3ac229=_0xeea5e2?_0x33a446[_0xab60('0x16')]:_0xc9b1ce[_0xab60('0x13')]+_0xc9b1ce[_0xab60('0x15')];var _0x3eeda2;if(_0x3ac229>=_0x5af438){_0x3ac229=_0x5af438;_0x3eeda2=0xc8;}else{_0x3eeda2=0xce;}_0x3f77e9[_0xab60('0x11')](_0x3eeda2);return _0x3f77e9[_0xab60('0x17')](_0xab60('0x18'),_0x5af819+'-'+_0x3ac229+'/'+_0x5af438)[_0xab60('0x19')](_0x33a446);}return null;};}function saveUpdates(_0x1a14fb){return function(_0x3e84f5){if(_0x3e84f5){return _0x3e84f5[_0xab60('0x1a')](_0x1a14fb)[_0xab60('0x1b')](function(_0x41d42f){return _0x41d42f;});}return null;};}function removeEntity(_0x5f02bb){return function(_0x31209e){if(_0x31209e){return _0x31209e[_0xab60('0x1c')]()[_0xab60('0x1b')](function(){_0x5f02bb[_0xab60('0x11')](0xcc)[_0xab60('0x12')]();});}};}function handleEntityNotFound(_0x2785b7){return function(_0x49bb72){if(!_0x49bb72){_0x2785b7['sendStatus'](0x194);}return _0x49bb72;};}function handleError(_0x55fc6a,_0x5bcf7e){_0x5bcf7e=_0x5bcf7e||0x1f4;return function(_0x35147d){logger[_0xab60('0x1d')](_0x35147d[_0xab60('0x1e')]);if(_0x35147d[_0xab60('0x1f')]){delete _0x35147d[_0xab60('0x1f')];}_0x55fc6a[_0xab60('0x11')](_0x5bcf7e)['send'](_0x35147d);};}exports['index']=function(_0x30d70a,_0x387b45){var _0x278dba={};var _0x589d2f=_[_0xab60('0x20')](db['MailInteraction'][_0xab60('0x21')],function(_0xd26c59){return{'name':_0xd26c59[_0xab60('0x22')],'type':_0xd26c59[_0xab60('0x23')][_0xab60('0x24')]};});_0x278dba=qs[_0xab60('0x25')](_0x589d2f,_0x30d70a);return interaction[_0xab60('0x26')](_0xab60('0x27'),_0x30d70a[_0xab60('0x28')],_0x30d70a['user'],_0x278dba,_0x589d2f)[_0xab60('0x1b')](respondWithFilteredResult(_0x387b45,_0x278dba))[_0xab60('0x29')](handleError(_0x387b45,null));};exports[_0xab60('0x2a')]=function(_0x244f93,_0x3751ff){var _0x4f284c={'raw':![],'where':{'id':_0x244f93['params']['id']}},_0x9df8ec={};_0x9df8ec[_0xab60('0x2b')]=_['keys'](db['MailInteraction'][_0xab60('0x21')]);_0x9df8ec[_0xab60('0x28')]=_[_0xab60('0x2c')](_0x244f93[_0xab60('0x28')]);_0x9df8ec['filters']=_[_0xab60('0x2d')](_0x9df8ec[_0xab60('0x2b')],_0x9df8ec[_0xab60('0x28')]);_0x4f284c[_0xab60('0x2e')]=_[_0xab60('0x2d')](_0x9df8ec[_0xab60('0x2b')],qs[_0xab60('0x2f')](_0x244f93[_0xab60('0x28')]['fields']));_0x4f284c[_0xab60('0x2e')]=_0x4f284c[_0xab60('0x2e')][_0xab60('0x30')]?_0x4f284c[_0xab60('0x2e')]:_0x9df8ec[_0xab60('0x2b')];if(_0x244f93['query']['includeAll']){_0x4f284c[_0xab60('0x31')]=[{'all':!![]}];}_0x4f284c=_['merge']({},_0x4f284c,_0x244f93[_0xab60('0x32')]);return db[_0xab60('0x33')]['find'](_0x4f284c)['then'](handleEntityNotFound(_0x3751ff,null))[_0xab60('0x1b')](respondWithResult(_0x3751ff,null))[_0xab60('0x29')](handleError(_0x3751ff,null));};exports['create']=function(_0x558f29,_0x3a5c18){return db[_0xab60('0x33')]['create'](_0x558f29[_0xab60('0x34')],{})[_0xab60('0x1b')](respondWithResult(_0x3a5c18,0xc9))['catch'](handleError(_0x3a5c18,null));};exports[_0xab60('0x1a')]=function(_0x109ecb,_0x2f6e7f){if(_0x109ecb[_0xab60('0x34')]['id']){delete _0x109ecb[_0xab60('0x34')]['id'];}return db[_0xab60('0x33')]['find']({'where':{'id':_0x109ecb[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x2f6e7f,null))[_0xab60('0x1b')](saveUpdates(_0x109ecb['body'],null))[_0xab60('0x1b')](respondWithResult(_0x2f6e7f,null))[_0xab60('0x29')](handleError(_0x2f6e7f,null));};exports[_0xab60('0x1c')]=function(_0x57a53a,_0x3192cd){return db['MailInteraction'][_0xab60('0x36')]({'where':{'id':_0x57a53a[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x3192cd,null))[_0xab60('0x1b')](removeEntity(_0x3192cd,null))[_0xab60('0x29')](handleError(_0x3192cd,null));};exports['describe']=function(_0x44f2a6,_0x2dc886){return db[_0xab60('0x33')]['describe']()[_0xab60('0x1b')](respondWithResult(_0x2dc886,null))[_0xab60('0x29')](handleError(_0x2dc886,null));};exports[_0xab60('0x37')]=function(_0x1e0ad3,_0x117b2a){return db[_0xab60('0x38')][_0xab60('0x36')]({'where':{'id':_0x1e0ad3[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x117b2a,null))[_0xab60('0x1b')](function(_0x4440f3){if(_0x4440f3){return _0x4440f3[_0xab60('0x37')](_0x1e0ad3[_0xab60('0x34')][_0xab60('0x39')],_[_0xab60('0x3a')](_0x1e0ad3[_0xab60('0x34')],[_0xab60('0x39'),'id'])||{});}})['then'](respondWithResult(_0x117b2a,null))[_0xab60('0x29')](handleError(_0x117b2a,null));};exports[_0xab60('0x3b')]=function(_0xc0e4bd,_0x374469){var _0x58fffd={'raw':![],'where':{}};var _0x4eb7be={};var _0x3100d2={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0xc0e4bd[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x374469,null))[_0xab60('0x1b')](function(_0x24d0ba){if(_0x24d0ba){_0x4eb7be['model']=_[_0xab60('0x2c')](db[_0xab60('0x38')]['rawAttributes']);_0x4eb7be[_0xab60('0x28')]=_['keys'](_0xc0e4bd['query']);_0x4eb7be[_0xab60('0x3c')]=_['intersection'](_0x4eb7be['model'],_0x4eb7be[_0xab60('0x28')]);_0x58fffd[_0xab60('0x2e')]=_[_0xab60('0x2d')](_0x4eb7be[_0xab60('0x2b')],qs[_0xab60('0x2f')](_0xc0e4bd[_0xab60('0x28')]['fields']));_0x58fffd[_0xab60('0x2e')]=_0x58fffd['attributes']['length']?_0x58fffd[_0xab60('0x2e')]:_0x4eb7be[_0xab60('0x2b')];if(!_0xc0e4bd[_0xab60('0x28')][_0xab60('0x3d')](_0xab60('0x3e'))){_0x58fffd[_0xab60('0x15')]=qs[_0xab60('0x15')](_0xc0e4bd[_0xab60('0x28')]['limit']);_0x58fffd[_0xab60('0x13')]=qs['offset'](_0xc0e4bd[_0xab60('0x28')]['offset']);}_0x58fffd[_0xab60('0x3f')]=qs[_0xab60('0x40')](_0xc0e4bd[_0xab60('0x28')][_0xab60('0x40')]);_0x58fffd['where']=qs['filters'](_[_0xab60('0x41')](_0xc0e4bd['query'],_0x4eb7be[_0xab60('0x3c')]));_0x58fffd[_0xab60('0x42')][_0xab60('0x43')]=_0x24d0ba['id'];if(_0xc0e4bd[_0xab60('0x28')][_0xab60('0x44')]){_0x58fffd['where']=_['merge'](_0x58fffd[_0xab60('0x42')],{'$or':_[_0xab60('0x20')](_0x58fffd['attributes'],function(_0x36aab9){var _0x529f46={};_0x529f46[_0x36aab9]={'$like':'%'+_0xc0e4bd['query'][_0xab60('0x44')]+'%'};return _0x529f46;})});}if(_0xc0e4bd[_0xab60('0x28')][_0xab60('0x45')]){var _0x288997=_0xc0e4bd[_0xab60('0x28')][_0xab60('0x45')][_0xab60('0x46')](',');var _0x1d9d06={};_0x1d9d06[_0x288997[0x0]]={'$gte':moment(_0x288997[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x58fffd[_0xab60('0x42')]=_['merge'](_0x58fffd[_0xab60('0x42')],_0x1d9d06);}_0x58fffd=_[_0xab60('0x47')]({},_0x58fffd,_0xc0e4bd[_0xab60('0x32')]);return db[_0xab60('0x38')]['count']({'where':_0x58fffd[_0xab60('0x42')]})[_0xab60('0x1b')](function(_0x1e598e){_0x3100d2[_0xab60('0x16')]=_0x1e598e;if(_0xc0e4bd['query'][_0xab60('0x48')]){_0x58fffd[_0xab60('0x31')]=[{'all':!![]}];}return db['MailMessage'][_0xab60('0x26')](_0x58fffd);})[_0xab60('0x1b')](function(_0x362941){if(_0xc0e4bd[_0xab60('0x28')]['inlineCss']===_0xab60('0x49')){for(var _0x364473=0x0;_0x364473<_0x362941[_0xab60('0x30')];_0x364473++){_0x362941[_0x364473][_0xab60('0x34')]=juice(_0x362941[_0x364473][_0xab60('0x34')]);}}_0x3100d2[_0xab60('0x4a')]=_0x362941;return _0x3100d2;});}})[_0xab60('0x1b')](respondWithFilteredResult(_0x374469,_0x58fffd))[_0xab60('0x29')](handleError(_0x374469,null));};exports['addTags']=function(_0x2c9707,_0xe464ef){return db[_0xab60('0x33')][_0xab60('0x36')]({'where':{'id':_0x2c9707['params']['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0xe464ef,null))[_0xab60('0x1b')](function(_0xeacb41){if(_0xeacb41){return _0xeacb41['setTags'](_0x2c9707[_0xab60('0x34')][_0xab60('0x39')],_[_0xab60('0x3a')](_0x2c9707['body'],[_0xab60('0x39'),'id'])||{})['spread'](function(){return db[_0xab60('0x4b')]['findAll']({'attributes':['id',_0xab60('0x1f'),'color'],'where':{'id':_0x2c9707[_0xab60('0x34')][_0xab60('0x39')]}});})[_0xab60('0x1b')](function(_0x5a6a27){socket[_0xab60('0x4c')]('mailInteractionTags:save',{'id':Number(_0x2c9707[_0xab60('0x35')]['id']),'tags':_0x5a6a27||[]});return{'id':Number(_0x2c9707['params']['id']),'tags':_0x5a6a27||[]};});}})[_0xab60('0x1b')](respondWithResult(_0xe464ef,null))['catch'](handleError(_0xe464ef,null));};exports[_0xab60('0x4d')]=function(_0x4bd068,_0x18db98){return db['MailInteraction'][_0xab60('0x36')]({'where':{'id':_0x4bd068[_0xab60('0x35')]['id']}})[_0xab60('0x1b')](handleEntityNotFound(_0x18db98,null))['then'](function(_0x43cc27){if(_0x43cc27){return _0x43cc27[_0xab60('0x4d')](_0x4bd068['query'][_0xab60('0x39')]);}})['then'](respondWithStatusCode(_0x18db98,null))[_0xab60('0x29')](handleError(_0x18db98,null));};exports[_0xab60('0x4e')]=function(_0x580a4d,_0x59e30){var _0x5709ce=moment()[_0xab60('0x4f')]()[_0xab60('0x50')]();var _0x1d4dcb=path['join'](config[_0xab60('0x51')],_0xab60('0x52'),_0xab60('0x53'),_0xab60('0x54'));var _0x4b9dad=path[_0xab60('0x55')](config[_0xab60('0x51')],_0xab60('0x52'),_0xab60('0x53'),'attachments');var _0x4989c8=path[_0xab60('0x55')](_0x1d4dcb,_0x5709ce);var _0x2eb211=util[_0xab60('0x56')](_0xab60('0x57'),_0x580a4d[_0xab60('0x35')]['id'],_0x5709ce);var _0x216ec3=path['join'](_0x1d4dcb,_0x2eb211);var _0x59c50d=[];if(_0x580a4d['query']['attachments']){_0x59c50d[_0xab60('0x58')]({'model':db['Attachment'],'as':_0xab60('0x59'),'raw':!![]});}var _0x429853=[{'model':db[_0xab60('0x38')],'as':_0xab60('0x5a'),'attributes':['id','body','from','to','cc',_0xab60('0x5b'),_0xab60('0x5c'),_0xab60('0x5d')],'where':{'secret':![]},'order':qs[_0xab60('0x40')]('id'),'include':_0x59c50d}];return db[_0xab60('0x33')][_0xab60('0x36')]({'where':{'id':_0x580a4d[_0xab60('0x35')]['id']},'include':_0x429853})[_0xab60('0x1b')](handleEntityNotFound(_0x59e30,null))['then'](function(_0x386677){if(_0x386677&&_0x386677['Messages']){var _0x5245f7=_0x386677[_0xab60('0x5e')]({'plain':!![]});fs[_0xab60('0x5f')](_0x4989c8);return BPromise[_0xab60('0x60')](_0x5245f7[_0xab60('0x5a')],function(_0x48857f,_0x52a7a3){var _0x6e5262={'from':_0x48857f[_0xab60('0x61')],'to':_0x48857f['to']||'missing.recipient@your.company.com','subject':_0x48857f['subject'],'html':htmlEntities[_0xab60('0x62')](_0x48857f[_0xab60('0x34')]),'headers':{'Date':moment(_0x48857f[_0xab60('0x5d')])[_0xab60('0x56')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x48857f['cc']){_0x6e5262['headers']['Cc']=_0x48857f['cc'];}if(_0x48857f['bcc']){_0x6e5262[_0xab60('0x63')][_0xab60('0x64')]=_0x48857f[_0xab60('0x5b')];}return new BPromise(function(_0x45ee43,_0x5230d8){if(_0x48857f[_0xab60('0x59')]){for(var _0xf8c5e1=0x0;_0xf8c5e1<_0x48857f[_0xab60('0x59')]['length'];_0xf8c5e1++){var _0x40e899=_0x48857f['Attachments'][_0xf8c5e1];var _0x449398=path[_0xab60('0x55')](_0x4b9dad,_0x40e899[_0xab60('0x65')]);if(fs[_0xab60('0x66')](_0x449398)){_0x6e5262[_0xab60('0x67')][_0xab60('0x58')]({'name':_0x40e899[_0xab60('0x1f')],'contentType':_0x40e899['type'],'data':fs[_0xab60('0x68')](_0x449398)});}}}emlformat['build'](_0x6e5262,function(_0x341593,_0x364040){if(_0x341593)return _0x5230d8(_0x341593);fs[_0xab60('0x69')](path[_0xab60('0x55')](_0x4989c8,util['format'](_0xab60('0x6a'),_0x52a7a3)),_0x364040);return _0x45ee43(_0x364040);});});})['then'](function(){return new BPromise(function(_0x3ff6b2,_0x4034e8){zipdir(_0x4989c8,{'saveTo':_0x216ec3},function(_0x146198,_0x2dbede){if(_0x146198)return _0x4034e8(_0x146198);return _0x3ff6b2(_0x2dbede);});})['then'](function(){return new BPromise(function(_0x14e927,_0x1d8f82){rimraf(_0x4989c8,function(_0x35433a){if(_0x35433a)_0x1d8f82(_0x35433a);return _0x14e927();});});})[_0xab60('0x1b')](function(){return _0x59e30[_0xab60('0x4e')](_0x216ec3,_0x2eb211,function(_0x147c10){if(!_0x147c10)fs['unlinkSync'](_0x216ec3);});});});}else{return _0x59e30[_0xab60('0x10')](0xc8);}})['catch'](handleError(_0x59e30,null));}; \ No newline at end of file +var _0x5c9a=['../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','html-entities','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','stack','name','send','map','MailInteraction','rawAttributes','type','key','getOptions','mail','query','user','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','params','describe','addMessage','MailMessage','ids','getMessages','findOne','hasOwnProperty','nolimit','order','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','true','rows','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','toString','root','files','tmp','attachments','join','transcript-%d-%s.zip','push','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','message%d.eml','eml-format','zip-dir','moment','bluebird','util','path','ioredis'];(function(_0xf2a638,_0x2e3e9e){var _0x5a5e6d=function(_0x250a13){while(--_0x250a13){_0xf2a638['push'](_0xf2a638['shift']());}};_0x5a5e6d(++_0x2e3e9e);}(_0x5c9a,0x14c));var _0xa5c9=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0x5c9a[_0x24b852];return _0x180ad2;};'use strict';var emlformat=require(_0xa5c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa5c9('0x1'));var moment=require(_0xa5c9('0x2'));var BPromise=require(_0xa5c9('0x3'));var util=require(_0xa5c9('0x4'));var path=require(_0xa5c9('0x5'));var fs=require('fs');var _=require('lodash');var juice=require('juice');var Redis=require(_0xa5c9('0x6'));var interaction=require(_0xa5c9('0x7'));var qs=require(_0xa5c9('0x8'));var logger=require('../../config/logger')(_0xa5c9('0x9'));var config=require('../../config/environment');var db=require(_0xa5c9('0xa'))['db'];var htmlEntities=require(_0xa5c9('0xb'));config['redis']=_[_0xa5c9('0xc')](config[_0xa5c9('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa5c9('0xe'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xa5c9('0xf')](socket);function respondWithStatusCode(_0x397de7,_0x367dc6){_0x367dc6=_0x367dc6||0xcc;return function(_0x5a7a08){if(_0x5a7a08){return _0x397de7[_0xa5c9('0x10')](_0x367dc6);}return _0x397de7[_0xa5c9('0x11')](_0x367dc6)[_0xa5c9('0x12')]();};}function respondWithResult(_0xa65189,_0x58593b){_0x58593b=_0x58593b||0xc8;return function(_0x5747c6){if(_0x5747c6){return _0xa65189[_0xa5c9('0x11')](_0x58593b)[_0xa5c9('0x13')](_0x5747c6);}};}function respondWithFilteredResult(_0x4b26a3,_0x25308f){return function(_0x2db724){if(_0x2db724){var _0x430480=typeof _0x25308f['offset']===_0xa5c9('0x14')&&typeof _0x25308f[_0xa5c9('0x15')]===_0xa5c9('0x14');var _0x425372=_0x2db724[_0xa5c9('0x16')];var _0x1e46dd=_0x430480?0x0:_0x25308f[_0xa5c9('0x17')];var _0x1d6c35=_0x430480?_0x2db724[_0xa5c9('0x16')]:_0x25308f[_0xa5c9('0x17')]+_0x25308f[_0xa5c9('0x15')];var _0x1a73a3;if(_0x1d6c35>=_0x425372){_0x1d6c35=_0x425372;_0x1a73a3=0xc8;}else{_0x1a73a3=0xce;}_0x4b26a3[_0xa5c9('0x11')](_0x1a73a3);return _0x4b26a3[_0xa5c9('0x18')](_0xa5c9('0x19'),_0x1e46dd+'-'+_0x1d6c35+'/'+_0x425372)[_0xa5c9('0x13')](_0x2db724);}return null;};}function saveUpdates(_0x548d01){return function(_0x21a477){if(_0x21a477){return _0x21a477[_0xa5c9('0x1a')](_0x548d01)[_0xa5c9('0x1b')](function(_0x5df6df){return _0x5df6df;});}return null;};}function removeEntity(_0x229b0b){return function(_0x32ea3b){if(_0x32ea3b){return _0x32ea3b[_0xa5c9('0x1c')]()[_0xa5c9('0x1b')](function(){_0x229b0b[_0xa5c9('0x11')](0xcc)[_0xa5c9('0x12')]();});}};}function handleEntityNotFound(_0x574f95){return function(_0x1020c4){if(!_0x1020c4){_0x574f95[_0xa5c9('0x10')](0x194);}return _0x1020c4;};}function handleError(_0x423ad1,_0xf8f44){_0xf8f44=_0xf8f44||0x1f4;return function(_0x212936){logger['error'](_0x212936[_0xa5c9('0x1d')]);if(_0x212936[_0xa5c9('0x1e')]){delete _0x212936[_0xa5c9('0x1e')];}_0x423ad1[_0xa5c9('0x11')](_0xf8f44)[_0xa5c9('0x1f')](_0x212936);};}exports['index']=function(_0x381ba0,_0x434bfd){var _0x2292e1={};var _0x9ff7=_[_0xa5c9('0x20')](db[_0xa5c9('0x21')][_0xa5c9('0x22')],function(_0x5f33fa){return{'name':_0x5f33fa['fieldName'],'type':_0x5f33fa[_0xa5c9('0x23')][_0xa5c9('0x24')]};});_0x2292e1=qs[_0xa5c9('0x25')](_0x9ff7,_0x381ba0);return interaction['findAll'](_0xa5c9('0x26'),_0x381ba0[_0xa5c9('0x27')],_0x381ba0[_0xa5c9('0x28')],_0x2292e1,_0x9ff7)[_0xa5c9('0x1b')](respondWithFilteredResult(_0x434bfd,_0x2292e1))['catch'](handleError(_0x434bfd,null));};exports['show']=function(_0x1153fe,_0x3fec8f){var _0xa84fb0={'raw':![],'where':{'id':_0x1153fe['params']['id']}},_0x2f1771={};_0x2f1771[_0xa5c9('0x29')]=_['keys'](db[_0xa5c9('0x21')][_0xa5c9('0x22')]);_0x2f1771['query']=_[_0xa5c9('0x2a')](_0x1153fe[_0xa5c9('0x27')]);_0x2f1771[_0xa5c9('0x2b')]=_[_0xa5c9('0x2c')](_0x2f1771[_0xa5c9('0x29')],_0x2f1771[_0xa5c9('0x27')]);_0xa84fb0['attributes']=_[_0xa5c9('0x2c')](_0x2f1771[_0xa5c9('0x29')],qs[_0xa5c9('0x2d')](_0x1153fe[_0xa5c9('0x27')][_0xa5c9('0x2d')]));_0xa84fb0[_0xa5c9('0x2e')]=_0xa84fb0[_0xa5c9('0x2e')][_0xa5c9('0x2f')]?_0xa84fb0[_0xa5c9('0x2e')]:_0x2f1771[_0xa5c9('0x29')];if(_0x1153fe[_0xa5c9('0x27')][_0xa5c9('0x30')]){_0xa84fb0[_0xa5c9('0x31')]=[{'all':!![]}];}_0xa84fb0=_[_0xa5c9('0x32')]({},_0xa84fb0,_0x1153fe[_0xa5c9('0x33')]);return db[_0xa5c9('0x21')][_0xa5c9('0x34')](_0xa84fb0)[_0xa5c9('0x1b')](handleEntityNotFound(_0x3fec8f,null))[_0xa5c9('0x1b')](respondWithResult(_0x3fec8f,null))[_0xa5c9('0x35')](handleError(_0x3fec8f,null));};exports[_0xa5c9('0x36')]=function(_0x38b635,_0x3ef975){return db['MailInteraction'][_0xa5c9('0x36')](_0x38b635[_0xa5c9('0x37')],{})['then'](respondWithResult(_0x3ef975,0xc9))[_0xa5c9('0x35')](handleError(_0x3ef975,null));};exports[_0xa5c9('0x1a')]=function(_0x124f0e,_0x26db5f){if(_0x124f0e[_0xa5c9('0x37')]['id']){delete _0x124f0e[_0xa5c9('0x37')]['id'];}return db[_0xa5c9('0x21')][_0xa5c9('0x34')]({'where':{'id':_0x124f0e['params']['id']}})[_0xa5c9('0x1b')](handleEntityNotFound(_0x26db5f,null))[_0xa5c9('0x1b')](saveUpdates(_0x124f0e[_0xa5c9('0x37')],null))[_0xa5c9('0x1b')](respondWithResult(_0x26db5f,null))[_0xa5c9('0x35')](handleError(_0x26db5f,null));};exports[_0xa5c9('0x1c')]=function(_0x3c535e,_0x397899){return db['MailInteraction'][_0xa5c9('0x34')]({'where':{'id':_0x3c535e[_0xa5c9('0x38')]['id']}})[_0xa5c9('0x1b')](handleEntityNotFound(_0x397899,null))[_0xa5c9('0x1b')](removeEntity(_0x397899,null))[_0xa5c9('0x35')](handleError(_0x397899,null));};exports['describe']=function(_0x499ace,_0x36cd1e){return db[_0xa5c9('0x21')][_0xa5c9('0x39')]()[_0xa5c9('0x1b')](respondWithResult(_0x36cd1e,null))[_0xa5c9('0x35')](handleError(_0x36cd1e,null));};exports[_0xa5c9('0x3a')]=function(_0x335959,_0x5dcb9f){return db[_0xa5c9('0x3b')]['find']({'where':{'id':_0x335959['params']['id']}})[_0xa5c9('0x1b')](handleEntityNotFound(_0x5dcb9f,null))['then'](function(_0x1d8b2f){if(_0x1d8b2f){return _0x1d8b2f[_0xa5c9('0x3a')](_0x335959[_0xa5c9('0x37')][_0xa5c9('0x3c')],_['omit'](_0x335959['body'],[_0xa5c9('0x3c'),'id'])||{});}})[_0xa5c9('0x1b')](respondWithResult(_0x5dcb9f,null))[_0xa5c9('0x35')](handleError(_0x5dcb9f,null));};exports[_0xa5c9('0x3d')]=function(_0xa86f85,_0x281eec){var _0x4fb3a6={'raw':![],'where':{}};var _0x467775={};var _0x837eca={'count':0x0,'rows':[]};return db[_0xa5c9('0x21')][_0xa5c9('0x3e')]({'where':{'id':_0xa86f85[_0xa5c9('0x38')]['id']}})['then'](handleEntityNotFound(_0x281eec,null))['then'](function(_0x30df15){if(_0x30df15){_0x467775[_0xa5c9('0x29')]=_['keys'](db[_0xa5c9('0x3b')][_0xa5c9('0x22')]);_0x467775['query']=_[_0xa5c9('0x2a')](_0xa86f85[_0xa5c9('0x27')]);_0x467775[_0xa5c9('0x2b')]=_['intersection'](_0x467775[_0xa5c9('0x29')],_0x467775[_0xa5c9('0x27')]);_0x4fb3a6['attributes']=_[_0xa5c9('0x2c')](_0x467775[_0xa5c9('0x29')],qs[_0xa5c9('0x2d')](_0xa86f85[_0xa5c9('0x27')][_0xa5c9('0x2d')]));_0x4fb3a6[_0xa5c9('0x2e')]=_0x4fb3a6[_0xa5c9('0x2e')]['length']?_0x4fb3a6[_0xa5c9('0x2e')]:_0x467775[_0xa5c9('0x29')];if(!_0xa86f85[_0xa5c9('0x27')][_0xa5c9('0x3f')](_0xa5c9('0x40'))){_0x4fb3a6[_0xa5c9('0x15')]=qs['limit'](_0xa86f85[_0xa5c9('0x27')][_0xa5c9('0x15')]);_0x4fb3a6['offset']=qs[_0xa5c9('0x17')](_0xa86f85['query'][_0xa5c9('0x17')]);}_0x4fb3a6[_0xa5c9('0x41')]=qs['sort'](_0xa86f85['query']['sort']);_0x4fb3a6[_0xa5c9('0x42')]=qs[_0xa5c9('0x2b')](_[_0xa5c9('0x43')](_0xa86f85[_0xa5c9('0x27')],_0x467775[_0xa5c9('0x2b')]));_0x4fb3a6[_0xa5c9('0x42')][_0xa5c9('0x44')]=_0x30df15['id'];if(_0xa86f85[_0xa5c9('0x27')][_0xa5c9('0x45')]){_0x4fb3a6[_0xa5c9('0x42')]=_[_0xa5c9('0x32')](_0x4fb3a6['where'],{'$or':_[_0xa5c9('0x20')](_0x4fb3a6['attributes'],function(_0x428aa0){var _0x5caef6={};_0x5caef6[_0x428aa0]={'$like':'%'+_0xa86f85[_0xa5c9('0x27')][_0xa5c9('0x45')]+'%'};return _0x5caef6;})});}if(_0xa86f85['query'][_0xa5c9('0x46')]){var _0x17d460=_0xa86f85[_0xa5c9('0x27')]['$gte'][_0xa5c9('0x47')](',');var _0x574451={};_0x574451[_0x17d460[0x0]]={'$gte':moment(_0x17d460[0x1])[_0xa5c9('0x48')](_0xa5c9('0x49'))};_0x4fb3a6[_0xa5c9('0x42')]=_[_0xa5c9('0x32')](_0x4fb3a6[_0xa5c9('0x42')],_0x574451);}_0x4fb3a6=_[_0xa5c9('0x32')]({},_0x4fb3a6,_0xa86f85[_0xa5c9('0x33')]);return db[_0xa5c9('0x3b')][_0xa5c9('0x16')]({'where':_0x4fb3a6[_0xa5c9('0x42')]})[_0xa5c9('0x1b')](function(_0x43dcd5){_0x837eca[_0xa5c9('0x16')]=_0x43dcd5;if(_0xa86f85['query'][_0xa5c9('0x30')]){_0x4fb3a6['include']=[{'all':!![]}];}return db[_0xa5c9('0x3b')][_0xa5c9('0x4a')](_0x4fb3a6);})[_0xa5c9('0x1b')](function(_0x3bb7d2){if(_0xa86f85[_0xa5c9('0x27')][_0xa5c9('0x4b')]===_0xa5c9('0x4c')){for(var _0x5cddb9=0x0;_0x5cddb9<_0x3bb7d2[_0xa5c9('0x2f')];_0x5cddb9++){_0x3bb7d2[_0x5cddb9][_0xa5c9('0x37')]=juice(_0x3bb7d2[_0x5cddb9][_0xa5c9('0x37')]);}}_0x837eca[_0xa5c9('0x4d')]=_0x3bb7d2;return _0x837eca;});}})['then'](respondWithFilteredResult(_0x281eec,_0x4fb3a6))[_0xa5c9('0x35')](handleError(_0x281eec,null));};exports['addTags']=function(_0x554d4e,_0x52bcdd){return db[_0xa5c9('0x21')][_0xa5c9('0x34')]({'where':{'id':_0x554d4e[_0xa5c9('0x38')]['id']}})[_0xa5c9('0x1b')](handleEntityNotFound(_0x52bcdd,null))[_0xa5c9('0x1b')](function(_0xa18e2a){if(_0xa18e2a){return _0xa18e2a[_0xa5c9('0x4e')](_0x554d4e[_0xa5c9('0x37')][_0xa5c9('0x3c')],_[_0xa5c9('0x4f')](_0x554d4e[_0xa5c9('0x37')],[_0xa5c9('0x3c'),'id'])||{})[_0xa5c9('0x50')](function(){return db[_0xa5c9('0x51')][_0xa5c9('0x4a')]({'attributes':['id',_0xa5c9('0x1e'),_0xa5c9('0x52')],'where':{'id':_0x554d4e['body']['ids']}});})['then'](function(_0x78f9fc){socket[_0xa5c9('0x53')](_0xa5c9('0x54'),{'id':Number(_0x554d4e[_0xa5c9('0x38')]['id']),'tags':_0x78f9fc||[]});return{'id':Number(_0x554d4e[_0xa5c9('0x38')]['id']),'tags':_0x78f9fc||[]};});}})[_0xa5c9('0x1b')](respondWithResult(_0x52bcdd,null))[_0xa5c9('0x35')](handleError(_0x52bcdd,null));};exports[_0xa5c9('0x55')]=function(_0x4ef6ae,_0xb0f539){return db[_0xa5c9('0x21')][_0xa5c9('0x34')]({'where':{'id':_0x4ef6ae[_0xa5c9('0x38')]['id']}})[_0xa5c9('0x1b')](handleEntityNotFound(_0xb0f539,null))[_0xa5c9('0x1b')](function(_0x3cbb95){if(_0x3cbb95){return _0x3cbb95['removeTags'](_0x4ef6ae[_0xa5c9('0x27')]['ids']);}})[_0xa5c9('0x1b')](respondWithStatusCode(_0xb0f539,null))[_0xa5c9('0x35')](handleError(_0xb0f539,null));};exports[_0xa5c9('0x56')]=function(_0x27bf28,_0x2ecf77){var _0x26eed0=moment()['unix']()[_0xa5c9('0x57')]();var _0xb6916d=path['join'](config[_0xa5c9('0x58')],'server',_0xa5c9('0x59'),_0xa5c9('0x5a'));var _0x3f3fd0=path['join'](config[_0xa5c9('0x58')],'server',_0xa5c9('0x59'),_0xa5c9('0x5b'));var _0x4a62e8=path[_0xa5c9('0x5c')](_0xb6916d,_0x26eed0);var _0x553be9=util['format'](_0xa5c9('0x5d'),_0x27bf28[_0xa5c9('0x38')]['id'],_0x26eed0);var _0x109458=path[_0xa5c9('0x5c')](_0xb6916d,_0x553be9);var _0x4bb699=[];if(_0x27bf28[_0xa5c9('0x27')][_0xa5c9('0x5b')]){_0x4bb699[_0xa5c9('0x5e')]({'model':db['Attachment'],'as':_0xa5c9('0x5f'),'raw':!![]});}var _0x496d96=[{'model':db['MailMessage'],'as':_0xa5c9('0x60'),'attributes':['id',_0xa5c9('0x37'),_0xa5c9('0x61'),'to','cc',_0xa5c9('0x62'),_0xa5c9('0x63'),_0xa5c9('0x64')],'where':{'secret':![]},'order':qs['sort']('id'),'include':_0x4bb699}];return db[_0xa5c9('0x21')][_0xa5c9('0x34')]({'where':{'id':_0x27bf28['params']['id']},'include':_0x496d96})[_0xa5c9('0x1b')](handleEntityNotFound(_0x2ecf77,null))[_0xa5c9('0x1b')](function(_0x2739af){if(_0x2739af&&_0x2739af[_0xa5c9('0x60')]){var _0x20308d=_0x2739af[_0xa5c9('0x65')]({'plain':!![]});fs[_0xa5c9('0x66')](_0x4a62e8);return BPromise[_0xa5c9('0x67')](_0x20308d[_0xa5c9('0x60')],function(_0x3273d4,_0x5c15e3){var _0x3ae82e={'from':_0x3273d4[_0xa5c9('0x61')],'to':_0x3273d4['to']||_0xa5c9('0x68'),'subject':_0x3273d4[_0xa5c9('0x63')],'html':htmlEntities[_0xa5c9('0x69')](_0x3273d4[_0xa5c9('0x37')]),'headers':{'Date':moment(_0x3273d4[_0xa5c9('0x64')])[_0xa5c9('0x48')](_0xa5c9('0x6a'))},'attachments':[]};if(_0x3273d4['cc']){_0x3ae82e[_0xa5c9('0x6b')]['Cc']=_0x3273d4['cc'];}if(_0x3273d4['bcc']){_0x3ae82e[_0xa5c9('0x6b')]['Bcc']=_0x3273d4[_0xa5c9('0x62')];}return new BPromise(function(_0xbba783,_0x204ac2){if(_0x3273d4[_0xa5c9('0x5f')]){for(var _0xaa03e3=0x0;_0xaa03e3<_0x3273d4[_0xa5c9('0x5f')][_0xa5c9('0x2f')];_0xaa03e3++){var _0x50fac6=_0x3273d4['Attachments'][_0xaa03e3];var _0x2a4304=path[_0xa5c9('0x5c')](_0x3f3fd0,_0x50fac6[_0xa5c9('0x6c')]);if(fs[_0xa5c9('0x6d')](_0x2a4304)){_0x3ae82e['attachments'][_0xa5c9('0x5e')]({'name':_0x50fac6['name'],'contentType':_0x50fac6[_0xa5c9('0x23')],'data':fs[_0xa5c9('0x6e')](_0x2a4304)});}}}emlformat[_0xa5c9('0x6f')](_0x3ae82e,function(_0x544a36,_0x566230){if(_0x544a36)return _0x204ac2(_0x544a36);fs['writeFileSync'](path[_0xa5c9('0x5c')](_0x4a62e8,util[_0xa5c9('0x48')](_0xa5c9('0x70'),_0x5c15e3)),_0x566230);return _0xbba783(_0x566230);});});})['then'](function(){return new BPromise(function(_0x2e8a2e,_0x1044cd){zipdir(_0x4a62e8,{'saveTo':_0x109458},function(_0xd7de87,_0x5c0cf5){if(_0xd7de87)return _0x1044cd(_0xd7de87);return _0x2e8a2e(_0x5c0cf5);});})[_0xa5c9('0x1b')](function(){return new BPromise(function(_0x5b58cd,_0xcba966){rimraf(_0x4a62e8,function(_0x3a6663){if(_0x3a6663)_0xcba966(_0x3a6663);return _0x5b58cd();});});})[_0xa5c9('0x1b')](function(){return _0x2ecf77[_0xa5c9('0x56')](_0x109458,_0x553be9,function(_0x5a5e19){if(!_0x5a5e19)fs['unlinkSync'](_0x109458);});});});}else{return _0x2ecf77[_0xa5c9('0x10')](0xc8);}})['catch'](handleError(_0x2ecf77,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index df59e6c..9341791 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 _0x776b=['../../mysqldb','MailInteraction','MailMessage','save','update','remove','then','map','length','emit','hook','events'];(function(_0x1cf220,_0x3cd6b3){var _0x37364f=function(_0x8f135f){while(--_0x8f135f){_0x1cf220['push'](_0x1cf220['shift']());}};_0x37364f(++_0x3cd6b3);}(_0x776b,0x12b));var _0xb776=function(_0x465436,_0x5f2ccd){_0x465436=_0x465436-0x0;var _0x2d15fd=_0x776b[_0x465436];return _0x2d15fd;};'use strict';var EventEmitter=require(_0xb776('0x0'));var MailInteraction=require(_0xb776('0x1'))['db'][_0xb776('0x2')];var MailMessage=require(_0xb776('0x1'))['db'][_0xb776('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb776('0x4'),'afterUpdate':_0xb776('0x5'),'afterDestroy':_0xb776('0x6')};function emitEvent(_0x480a73){return function(_0x24d47c,_0x451ec8,_0x384a96){_0x24d47c['getUsers']({'attributes':['id'],'raw':!![]})[_0xb776('0x7')](function(_0x3bbdf1){_0x24d47c['setDataValue']('Users',_0x3bbdf1[_0xb776('0x8')](function(_0x3d920b){return{'id':_0x3d920b['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x24d47c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb776('0x7')](function(_0x55ddb7){_0x24d47c['setDataValue']('unreadMessages',_0x55ddb7[_0xb776('0x9')]);MailInteractionEvents[_0xb776('0xa')](_0x480a73+':'+_0x24d47c['id'],_0x24d47c);MailInteractionEvents['emit'](_0x480a73,_0x24d47c);_0x384a96(null);})['catch'](_0x384a96(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xb776('0xb')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x5a0d=['map','findAll','then','unreadMessages','emit','hasOwnProperty','hook','exports','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','save','remove','setDataValue'];(function(_0x304ddb,_0x57dcc2){var _0x5bd9ef=function(_0x1247b6){while(--_0x1247b6){_0x304ddb['push'](_0x304ddb['shift']());}};_0x5bd9ef(++_0x57dcc2);}(_0x5a0d,0x170));var _0xd5a0=function(_0x20d9d1,_0xcf39d2){_0x20d9d1=_0x20d9d1-0x0;var _0x54f62a=_0x5a0d[_0x20d9d1];return _0x54f62a;};'use strict';var EventEmitter=require('events');var MailInteraction=require(_0xd5a0('0x0'))['db'][_0xd5a0('0x1')];var MailMessage=require(_0xd5a0('0x0'))['db'][_0xd5a0('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd5a0('0x3')](0x0);var events={'afterCreate':_0xd5a0('0x4'),'afterUpdate':'update','afterDestroy':_0xd5a0('0x5')};function emitEvent(_0x339eb0){return function(_0x1320a5,_0x227ea7,_0x23a0f9){_0x1320a5['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x33b1d4){_0x1320a5[_0xd5a0('0x6')]('Users',_0x33b1d4[_0xd5a0('0x7')](function(_0x36668a){return{'id':_0x36668a['id']};}));return MailMessage[_0xd5a0('0x8')]({'where':{'MailInteractionId':_0x1320a5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd5a0('0x9')](function(_0x2a32cc){_0x1320a5[_0xd5a0('0x6')](_0xd5a0('0xa'),_0x2a32cc['length']);MailInteractionEvents['emit'](_0x339eb0+':'+_0x1320a5['id'],_0x1320a5);MailInteractionEvents[_0xd5a0('0xb')](_0x339eb0,_0x1320a5);_0x23a0f9(null);})['catch'](_0x23a0f9(null));};}for(var e in events){if(events[_0xd5a0('0xc')](e)){var event=events[e];MailInteraction[_0xd5a0('0xd')](e,emitEvent(event));}}module[_0xd5a0('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index f7c0365..cdabeee 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 _0xdcda=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format','closedAt','YYYY-MM-DD\x20HH:mm:ss','changed','closed','substatus','models','get','then','catch','lodash','util'];(function(_0x498108,_0x5e0c70){var _0x1c7059=function(_0x34927a){while(--_0x34927a){_0x498108['push'](_0x498108['shift']());}};_0x1c7059(++_0x5e0c70);}(_0xdcda,0x19e));var _0xadcd=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xdcda[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var logger=require(_0xadcd('0x2'))('api');var moment=require('moment');var BPromise=require(_0xadcd('0x3'));var rp=require(_0xadcd('0x4'));var fs=require('fs');var path=require(_0xadcd('0x5'));var rimraf=require(_0xadcd('0x6'));var config=require(_0xadcd('0x7'));var attributes=require(_0xadcd('0x8'));module['exports']=function(_0x5b1c65,_0x5c1a70){return _0x5b1c65[_0xadcd('0x9')](_0xadcd('0xa'),attributes,{'tableName':_0xadcd('0xb'),'paranoid':![],'indexes':[{'name':_0xadcd('0xc'),'fields':[_0xadcd('0xd'),'to'],'type':_0xadcd('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47def0,_0x358d2e,_0x162243){if(_0x47def0['substatus']){_0x47def0[_0xadcd('0xf')]=moment()[_0xadcd('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x47def0['closed']){_0x47def0[_0xadcd('0x11')]=moment()[_0xadcd('0x10')](_0xadcd('0x12'));}_0x162243(null,_0x358d2e);},'beforeUpdate':function(_0x4f771b,_0x5007c1,_0x27d738){if(_0x4f771b[_0xadcd('0x13')]('substatus')){_0x4f771b['substatusAt']=_0x4f771b['substatus']?moment()['format'](_0xadcd('0x12')):null;}if(_0x4f771b[_0xadcd('0x13')](_0xadcd('0x14'))){_0x4f771b[_0xadcd('0x11')]=moment()[_0xadcd('0x10')](_0xadcd('0x12'));_0x4f771b[_0xadcd('0x15')]=null;_0x4f771b[_0xadcd('0xf')]=null;}_0x27d738(null,_0x4f771b);},'afterUpdate':function(_0x2854ea,_0x3ad6ec,_0x9c0979){var _0x103345=_0x5b1c65[_0xadcd('0x16')];var _0x3aed6c=_0x2854ea[_0xadcd('0x17')]({'plain':!![]});if(_0x3aed6c[_0xadcd('0x14')]){return _0x103345['MailMessage']['update']({'read':!![]},{'where':{'MailInteractionId':_0x3aed6c['id']}})[_0xadcd('0x18')](function(){_0x9c0979();})[_0xadcd('0x19')](function(_0xcde201){_0x9c0979(_0xcde201);});}else{_0x9c0979();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc80f=['bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','update','then','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x6b942a,_0x311643){var _0x22129d=function(_0x5a1a52){while(--_0x5a1a52){_0x6b942a['push'](_0x6b942a['shift']());}};_0x22129d(++_0x311643);}(_0xc80f,0xc1));var _0xfc80=function(_0x4f4711,_0x742586){_0x4f4711=_0x4f4711-0x0;var _0x40e9f7=_0xc80f[_0x4f4711];return _0x40e9f7;};'use strict';var _=require(_0xfc80('0x0'));var util=require(_0xfc80('0x1'));var logger=require(_0xfc80('0x2'))('api');var moment=require('moment');var BPromise=require(_0xfc80('0x3'));var rp=require(_0xfc80('0x4'));var fs=require('fs');var path=require(_0xfc80('0x5'));var rimraf=require(_0xfc80('0x6'));var config=require(_0xfc80('0x7'));var attributes=require(_0xfc80('0x8'));module[_0xfc80('0x9')]=function(_0x98cb65,_0x2b3ad2){return _0x98cb65[_0xfc80('0xa')]('MailInteraction',attributes,{'tableName':_0xfc80('0xb'),'paranoid':![],'indexes':[{'name':_0xfc80('0xc'),'fields':[_0xfc80('0xd'),'to'],'type':_0xfc80('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x24d2a3,_0x2be4b7,_0x22c526){if(_0x24d2a3[_0xfc80('0xf')]){_0x24d2a3['substatusAt']=moment()[_0xfc80('0x10')](_0xfc80('0x11'));}if(_0x24d2a3[_0xfc80('0x12')]){_0x24d2a3[_0xfc80('0x13')]=moment()[_0xfc80('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x22c526(null,_0x2be4b7);},'beforeUpdate':function(_0x4908eb,_0x2b1c99,_0x629509){if(_0x4908eb[_0xfc80('0x14')](_0xfc80('0xf'))){_0x4908eb['substatusAt']=_0x4908eb[_0xfc80('0xf')]?moment()[_0xfc80('0x10')](_0xfc80('0x11')):null;}if(_0x4908eb[_0xfc80('0x14')](_0xfc80('0x12'))){_0x4908eb['closedAt']=moment()[_0xfc80('0x10')](_0xfc80('0x11'));_0x4908eb['substatus']=null;_0x4908eb[_0xfc80('0x15')]=null;}_0x629509(null,_0x4908eb);},'afterUpdate':function(_0x9cf4b4,_0x1884a6,_0xbba660){var _0x22d77d=_0x98cb65[_0xfc80('0x16')];var _0x37b0e2=_0x9cf4b4[_0xfc80('0x17')]({'plain':!![]});if(_0x37b0e2['closed']){return _0x22d77d[_0xfc80('0x18')][_0xfc80('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x37b0e2['id']}})[_0xfc80('0x1a')](function(){_0xbba660();})['catch'](function(_0x1c7aa6){_0xbba660(_0x1c7aa6);});}else{_0xbba660();}}},'charset':'utf8mb4','collate':_0xfc80('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 7255a00..b93c3ca 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 _0xcb95=['code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','attributes','limit','stringify','find','omit','ids','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x5a0bfa,_0x15771f){var _0x32babf=function(_0x34bf55){while(--_0x34bf55){_0x5a0bfa['push'](_0x5a0bfa['shift']());}};_0x32babf(++_0x15771f);}(_0xcb95,0xb5));var _0x5cb9=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xcb95[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x5cb9('0x0'));var util=require(_0x5cb9('0x1'));var moment=require(_0x5cb9('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cb9('0x3'));var fs=require('fs');var Redis=require(_0x5cb9('0x4'));var db=require(_0x5cb9('0x5'))['db'];var utils=require(_0x5cb9('0x6'));var logger=require(_0x5cb9('0x7'))(_0x5cb9('0x8'));var config=require('../../config/environment');var jayson=require(_0x5cb9('0x9'));var client=jayson[_0x5cb9('0xa')]['http']({'port':0x232a});config[_0x5cb9('0xb')]=_[_0x5cb9('0xc')](config[_0x5cb9('0xb')],{'host':_0x5cb9('0xd'),'port':0x18eb});var socket=require(_0x5cb9('0xe'))(new Redis(config[_0x5cb9('0xb')]));require(_0x5cb9('0xf'))[_0x5cb9('0x10')](socket);function respondWithRpcPromise(_0xe0d19b,_0x45b51f,_0x38b4e1){return new BPromise(function(_0x9a629e,_0x472547){return client[_0x5cb9('0x11')](_0xe0d19b,_0x38b4e1)[_0x5cb9('0x12')](function(_0x306c1b){logger[_0x5cb9('0x13')](_0x5cb9('0x14'),_0x45b51f,_0x5cb9('0x15'));logger[_0x5cb9('0x16')]('MailInteraction,\x20%s,\x20%s,\x20%s',_0x45b51f,_0x5cb9('0x15'),JSON['stringify'](_0x306c1b));if(_0x306c1b['error']){if(_0x306c1b[_0x5cb9('0x17')][_0x5cb9('0x18')]===0x1f4){logger[_0x5cb9('0x17')](_0x5cb9('0x14'),_0x45b51f,_0x306c1b['error'][_0x5cb9('0x19')]);return _0x472547(_0x306c1b[_0x5cb9('0x17')][_0x5cb9('0x19')]);}logger['error'](_0x5cb9('0x14'),_0x45b51f,_0x306c1b['error'][_0x5cb9('0x19')]);return _0x9a629e(_0x306c1b['error']['message']);}else{logger['info'](_0x5cb9('0x14'),_0x45b51f,_0x5cb9('0x15'));_0x9a629e(_0x306c1b[_0x5cb9('0x1a')]['message']);}})[_0x5cb9('0x1b')](function(_0x27b9d1){logger['error']('MailInteraction,\x20%s,\x20%s',_0x45b51f,_0x27b9d1);_0x472547(_0x27b9d1);});});}exports[_0x5cb9('0x1c')]=function(_0x53eb54){var _0x1b9306=this;return new Promise(function(_0x1efa79,_0x45b837){return db[_0x5cb9('0x1d')][_0x5cb9('0x1e')](_0x53eb54[_0x5cb9('0x1f')],{'raw':_0x53eb54['options']?_0x53eb54['options'][_0x5cb9('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x53eb54[_0x5cb9('0x21')]?_0x53eb54['options']['where']||null:null,'attributes':_0x53eb54[_0x5cb9('0x21')]?_0x53eb54['options'][_0x5cb9('0x22')]||null:null,'limit':_0x53eb54[_0x5cb9('0x21')]?_0x53eb54[_0x5cb9('0x21')][_0x5cb9('0x23')]||null:null})[_0x5cb9('0x12')](function(_0x2222fc){logger['info'](_0x5cb9('0x1c'),_0x53eb54);logger[_0x5cb9('0x16')]('UpdateMailInteraction',_0x53eb54,JSON[_0x5cb9('0x24')](_0x2222fc));_0x1efa79(_0x2222fc);})[_0x5cb9('0x1b')](function(_0x347d16){logger[_0x5cb9('0x17')](_0x5cb9('0x1c'),_0x347d16['message'],_0x53eb54);_0x45b837(_0x1b9306[_0x5cb9('0x17')](0x1f4,_0x347d16[_0x5cb9('0x19')]));});});};exports['AddTagsToMailInteraction']=function(_0x2c5e3f){return new Promise(function(_0x4b49f5,_0x15d8c2){return db[_0x5cb9('0x1d')][_0x5cb9('0x25')]({'where':_0x2c5e3f[_0x5cb9('0x21')]?_0x2c5e3f[_0x5cb9('0x21')]['where']||null:null})[_0x5cb9('0x12')](function(_0x5d0857){if(_0x5d0857){return _0x5d0857['addTags'](_0x2c5e3f[_0x5cb9('0x1f')]['ids'],_[_0x5cb9('0x26')](_0x2c5e3f[_0x5cb9('0x1f')],[_0x5cb9('0x27'),'id'])||{});}})['spread'](function(_0x352342){logger[_0x5cb9('0x13')](_0x5cb9('0x28'),_0x2c5e3f);logger[_0x5cb9('0x16')](_0x5cb9('0x28'),_0x2c5e3f,JSON[_0x5cb9('0x24')](_0x352342));_0x4b49f5(_0x352342);})[_0x5cb9('0x1b')](function(_0x245eae){logger[_0x5cb9('0x17')](_0x5cb9('0x28'),_0x245eae[_0x5cb9('0x19')],_0x2c5e3f);_0x15d8c2(_this['error'](0x1f4,_0x245eae[_0x5cb9('0x19')]));});});}; \ No newline at end of file +var _0xc11a=['request','then','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','attributes','limit','find','addTags','omit','ids','spread','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc11a,0x10b));var _0xac11=function(_0x9fd887,_0x47f76c){_0x9fd887=_0x9fd887-0x0;var _0x1a54ab=_0xc11a[_0x9fd887];return _0x1a54ab;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac11('0x0'));var BPromise=require(_0xac11('0x1'));var rs=require(_0xac11('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xac11('0x3'));var logger=require('../../config/logger')(_0xac11('0x4'));var config=require(_0xac11('0x5'));var jayson=require(_0xac11('0x6'));var client=jayson['client'][_0xac11('0x7')]({'port':0x232a});config[_0xac11('0x8')]=_[_0xac11('0x9')](config[_0xac11('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xac11('0xa'))(new Redis(config[_0xac11('0x8')]));require(_0xac11('0xb'))[_0xac11('0xc')](socket);function respondWithRpcPromise(_0xaa6660,_0x542c74,_0x362cad){return new BPromise(function(_0x47f7bd,_0x2df67f){return client[_0xac11('0xd')](_0xaa6660,_0x362cad)[_0xac11('0xe')](function(_0x5b2470){logger[_0xac11('0xf')](_0xac11('0x10'),_0x542c74,'request\x20sent');logger[_0xac11('0x11')](_0xac11('0x12'),_0x542c74,_0xac11('0x13'),JSON[_0xac11('0x14')](_0x5b2470));if(_0x5b2470[_0xac11('0x15')]){if(_0x5b2470[_0xac11('0x15')][_0xac11('0x16')]===0x1f4){logger[_0xac11('0x15')](_0xac11('0x10'),_0x542c74,_0x5b2470[_0xac11('0x15')][_0xac11('0x17')]);return _0x2df67f(_0x5b2470[_0xac11('0x15')][_0xac11('0x17')]);}logger[_0xac11('0x15')](_0xac11('0x10'),_0x542c74,_0x5b2470[_0xac11('0x15')]['message']);return _0x47f7bd(_0x5b2470[_0xac11('0x15')][_0xac11('0x17')]);}else{logger['info'](_0xac11('0x10'),_0x542c74,_0xac11('0x13'));_0x47f7bd(_0x5b2470[_0xac11('0x18')][_0xac11('0x17')]);}})[_0xac11('0x19')](function(_0x5ad337){logger[_0xac11('0x15')](_0xac11('0x10'),_0x542c74,_0x5ad337);_0x2df67f(_0x5ad337);});});}exports[_0xac11('0x1a')]=function(_0x10254d){var _0xc3583f=this;return new Promise(function(_0x58b151,_0x4e9030){return db[_0xac11('0x1b')][_0xac11('0x1c')](_0x10254d[_0xac11('0x1d')],{'raw':_0x10254d[_0xac11('0x1e')]?_0x10254d['options'][_0xac11('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10254d['options']?_0x10254d[_0xac11('0x1e')][_0xac11('0x20')]||null:null,'attributes':_0x10254d[_0xac11('0x1e')]?_0x10254d[_0xac11('0x1e')][_0xac11('0x21')]||null:null,'limit':_0x10254d[_0xac11('0x1e')]?_0x10254d[_0xac11('0x1e')][_0xac11('0x22')]||null:null})[_0xac11('0xe')](function(_0x4e0553){logger[_0xac11('0xf')](_0xac11('0x1a'),_0x10254d);logger[_0xac11('0x11')]('UpdateMailInteraction',_0x10254d,JSON[_0xac11('0x14')](_0x4e0553));_0x58b151(_0x4e0553);})[_0xac11('0x19')](function(_0x21a81a){logger[_0xac11('0x15')]('UpdateMailInteraction',_0x21a81a[_0xac11('0x17')],_0x10254d);_0x4e9030(_0xc3583f[_0xac11('0x15')](0x1f4,_0x21a81a[_0xac11('0x17')]));});});};exports['AddTagsToMailInteraction']=function(_0x3488e6){return new Promise(function(_0x25a475,_0x598401){return db[_0xac11('0x1b')][_0xac11('0x23')]({'where':_0x3488e6[_0xac11('0x1e')]?_0x3488e6[_0xac11('0x1e')][_0xac11('0x20')]||null:null})['then'](function(_0x299a11){if(_0x299a11){return _0x299a11[_0xac11('0x24')](_0x3488e6[_0xac11('0x1d')]['ids'],_[_0xac11('0x25')](_0x3488e6[_0xac11('0x1d')],[_0xac11('0x26'),'id'])||{});}})[_0xac11('0x27')](function(_0x1a8655){logger[_0xac11('0xf')]('AddTags',_0x3488e6);logger[_0xac11('0x11')]('AddTags',_0x3488e6,JSON[_0xac11('0x14')](_0x1a8655));_0x25a475(_0x1a8655);})['catch'](function(_0x29eda0){logger[_0xac11('0x15')]('AddTags',_0x29eda0[_0xac11('0x17')],_0x3488e6);_0x598401(_this['error'](0x1f4,_0x29eda0[_0xac11('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 7248451..b61fcd5 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 _0x1f53=['update','length','./mailInteraction.events','save','remove'];(function(_0x145f59,_0x3c0e1f){var _0x3c98cc=function(_0x5c0950){while(--_0x5c0950){_0x145f59['push'](_0x145f59['shift']());}};_0x3c98cc(++_0x3c0e1f);}(_0x1f53,0x16a));var _0x31f5=function(_0x37617e,_0x32c88c){_0x37617e=_0x37617e-0x0;var _0x41db69=_0x1f53[_0x37617e];return _0x41db69;};'use strict';var MailInteractionEvents=require(_0x31f5('0x0'));var events=[_0x31f5('0x1'),_0x31f5('0x2'),_0x31f5('0x3')];function createListener(_0x49540d,_0x2201db){return function(_0x306538){_0x2201db['emit'](_0x49540d,_0x306538);};}function removeListener(_0x3330c2,_0x8ec072){return function(){MailInteractionEvents['removeListener'](_0x3330c2,_0x8ec072);};}exports['register']=function(_0x52aa95){for(var _0x402ea6=0x0,_0x40ded6=events[_0x31f5('0x4')];_0x402ea6<_0x40ded6;_0x402ea6++){var _0x58c14=events[_0x402ea6];var _0x536527=createListener('mailInteraction:'+_0x58c14,_0x52aa95);MailInteractionEvents['on'](_0x58c14,_0x536527);}}; \ No newline at end of file +var _0x0b61=['remove','emit','removeListener','length','mailInteraction:','./mailInteraction.events','save'];(function(_0x125d2d,_0x91ea92){var _0x32b366=function(_0x5d4943){while(--_0x5d4943){_0x125d2d['push'](_0x125d2d['shift']());}};_0x32b366(++_0x91ea92);}(_0x0b61,0xd0));var _0x10b6=function(_0x4c9bf5,_0x4e0251){_0x4c9bf5=_0x4c9bf5-0x0;var _0x335c98=_0x0b61[_0x4c9bf5];return _0x335c98;};'use strict';var MailInteractionEvents=require(_0x10b6('0x0'));var events=[_0x10b6('0x1'),_0x10b6('0x2'),'update'];function createListener(_0x402c83,_0x1cafa4){return function(_0x21cf23){_0x1cafa4[_0x10b6('0x3')](_0x402c83,_0x21cf23);};}function removeListener(_0x141dfe,_0x33213e){return function(){MailInteractionEvents[_0x10b6('0x4')](_0x141dfe,_0x33213e);};}exports['register']=function(_0x424869){for(var _0x4289f2=0x0,_0x291e08=events[_0x10b6('0x5')];_0x4289f2<_0x291e08;_0x4289f2++){var _0x81248e=events[_0x4289f2];var _0x4afe15=createListener(_0x10b6('0x6')+_0x81248e,_0x424869);MailInteractionEvents['on'](_0x81248e,_0x4afe15);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index e03822a..4a62d03 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x543b=['../../components/auth/service','get','/describe','isAuthenticated','exports','express','Router'];(function(_0x508e7a,_0x57e8bc){var _0x54df90=function(_0x4cbb3c){while(--_0x4cbb3c){_0x508e7a['push'](_0x508e7a['shift']());}};_0x54df90(++_0x57e8bc);}(_0x543b,0x18d));var _0xb543=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x543b[_0x2dafbe];return _0x58a45a;};'use strict';var express=require(_0xb543('0x0'));var router=express[_0xb543('0x1')]();var auth=require(_0xb543('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0xb543('0x3')](_0xb543('0x4'),auth[_0xb543('0x5')](),controller['describe']);module[_0xb543('0x6')]=router; \ No newline at end of file +var _0x3189=['get','/describe','isAuthenticated','exports','express','../../components/auth/service','./mailInteractionHasTag.controller'];(function(_0x29f31c,_0x46bbdf){var _0x3b6b8a=function(_0x557471){while(--_0x557471){_0x29f31c['push'](_0x29f31c['shift']());}};_0x3b6b8a(++_0x46bbdf);}(_0x3189,0x19a));var _0x9318=function(_0x539620,_0x9c6646){_0x539620=_0x539620-0x0;var _0x2524de=_0x3189[_0x539620];return _0x2524de;};'use strict';var express=require(_0x9318('0x0'));var router=express['Router']();var auth=require(_0x9318('0x1'));var controller=require(_0x9318('0x2'));router[_0x9318('0x3')](_0x9318('0x4'),auth[_0x9318('0x5')](),controller['describe']);module[_0x9318('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 779fca8..f9ec644 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x18e899,_0x50cd42){var _0x3ae0dd=function(_0x2d89b0){while(--_0x2d89b0){_0x18e899['push'](_0x18e899['shift']());}};_0x3ae0dd(++_0x50cd42);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x3645ed,_0x375e2e){var _0x336ed7=function(_0xc89777){while(--_0xc89777){_0x3645ed['push'](_0x3645ed['shift']());}};_0x336ed7(++_0x375e2e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 48d8556..c733558 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x24a4=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24a4,0x67));var _0x424a=function(_0x74b615,_0x300db4){_0x74b615=_0x74b615-0x0;var _0x149321=_0x24a4[_0x74b615];return _0x149321;};'use strict';var Sequelize=require(_0x424a('0x0'));module[_0x424a('0x1')]={'MailInteractionId':{'type':Sequelize[_0x424a('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0xf416=['sequelize','exports','INTEGER'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf416,0xcf));var _0x6f41=function(_0x1b6b9a,_0x1c6f61){_0x1b6b9a=_0x1b6b9a-0x0;var _0x120a0d=_0xf416[_0x1b6b9a];return _0x120a0d;};'use strict';var Sequelize=require(_0x6f41('0x0'));module[_0x6f41('0x1')]={'MailInteractionId':{'type':Sequelize[_0x6f41('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x6f41('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 71509e8..6baefba 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1de8=['define','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x360916,_0x4ed563){var _0x7f9f83=function(_0x287741){while(--_0x287741){_0x360916['push'](_0x360916['shift']());}};_0x7f9f83(++_0x4ed563);}(_0x1de8,0x10a));var _0x81de=function(_0xf80b3,_0x25d5f3){_0xf80b3=_0xf80b3-0x0;var _0x10c489=_0x1de8[_0xf80b3];return _0x10c489;};'use strict';var attributes=require(_0x81de('0x0'));module['exports']=function(_0x20a3c6){return _0x20a3c6[_0x81de('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0x81de('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20e9=['./mailInteractionHasTag','mail_interaction_has_tags'];(function(_0x480f80,_0x41319a){var _0x1cb934=function(_0x17e6aa){while(--_0x17e6aa){_0x480f80['push'](_0x480f80['shift']());}};_0x1cb934(++_0x41319a);}(_0x20e9,0x13e));var _0x920e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x20e9[_0x4154a6];return _0x3b2786;};'use strict';var attributes=require(_0x920e('0x0'));module['exports']=function(_0x3e9a8b){return _0x3e9a8b['define']('MailInteractionHasTag',attributes,{'tableName':_0x920e('0x1'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 3d050d3..7fa940c 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 _0x042a=['put','/:id/accept','accept','/:id/reject','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','isAuthenticated','describe','/:id','show','get','post','tracked','mail','mailmessage:create'];(function(_0x159b40,_0x323562){var _0x543c1f=function(_0x499676){while(--_0x499676){_0x159b40['push'](_0x159b40['shift']());}};_0x543c1f(++_0x323562);}(_0x042a,0x1ce));var _0xa042=function(_0x49fc97,_0x191334){_0x49fc97=_0x49fc97-0x0;var _0x7a531a=_0x042a[_0x49fc97];return _0x7a531a;};'use strict';var multer=require(_0xa042('0x0'));var util=require(_0xa042('0x1'));var path=require(_0xa042('0x2'));var timeout=require(_0xa042('0x3'));var express=require('express');var router=express[_0xa042('0x4')]();var fs_extra=require(_0xa042('0x5'));var auth=require(_0xa042('0x6'));var interaction=require(_0xa042('0x7'));var config=require('../../config/environment');var controller=require(_0xa042('0x8'));router['get']('/',auth[_0xa042('0x9')](),controller['index']);router['get']('/describe',auth[_0xa042('0x9')](),controller[_0xa042('0xa')]);router['get'](_0xa042('0xb'),auth[_0xa042('0x9')](),controller[_0xa042('0xc')]);router[_0xa042('0xd')]('/:id/download',auth[_0xa042('0x9')](),controller['download']);router[_0xa042('0xe')]('/',auth[_0xa042('0x9')](),interaction[_0xa042('0xf')](_0xa042('0x10'),_0xa042('0x11')),controller['create']);router['put'](_0xa042('0xb'),auth[_0xa042('0x9')](),controller['update']);router[_0xa042('0x12')](_0xa042('0x13'),auth[_0xa042('0x9')](),controller[_0xa042('0x14')]);router[_0xa042('0x12')](_0xa042('0x15'),auth['isAuthenticated'](),controller['reject']);router[_0xa042('0x16')](_0xa042('0xb'),auth[_0xa042('0x9')](),controller[_0xa042('0x17')]);module['exports']=router; \ No newline at end of file +var _0x2e54=['download','post','mail','mailmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download'];(function(_0x462999,_0x24d200){var _0x4b1366=function(_0x1fa353){while(--_0x1fa353){_0x462999['push'](_0x462999['shift']());}};_0x4b1366(++_0x24d200);}(_0x2e54,0x1dd));var _0x42e5=function(_0x5ce52c,_0x52d94a){_0x5ce52c=_0x5ce52c-0x0;var _0x3ebfa9=_0x2e54[_0x5ce52c];return _0x3ebfa9;};'use strict';var multer=require(_0x42e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x42e5('0x1'));var express=require(_0x42e5('0x2'));var router=express[_0x42e5('0x3')]();var fs_extra=require(_0x42e5('0x4'));var auth=require(_0x42e5('0x5'));var interaction=require(_0x42e5('0x6'));var config=require(_0x42e5('0x7'));var controller=require('./mailMessage.controller');router[_0x42e5('0x8')]('/',auth[_0x42e5('0x9')](),controller[_0x42e5('0xa')]);router['get'](_0x42e5('0xb'),auth['isAuthenticated'](),controller[_0x42e5('0xc')]);router['get'](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0xe')]);router[_0x42e5('0x8')](_0x42e5('0xf'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x10')]);router[_0x42e5('0x11')]('/',auth[_0x42e5('0x9')](),interaction['tracked'](_0x42e5('0x12'),_0x42e5('0x13')),controller['create']);router[_0x42e5('0x14')](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x15')]);router[_0x42e5('0x14')](_0x42e5('0x16'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x17')]);router[_0x42e5('0x14')](_0x42e5('0x18'),auth['isAuthenticated'](),controller[_0x42e5('0x19')]);router[_0x42e5('0x1a')](_0x42e5('0xd'),auth[_0x42e5('0x9')](),controller[_0x42e5('0x1b')]);module[_0x42e5('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4f2cfa0..814f856 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 _0xf0ba=['long','medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Chat','Email','sequelize','lodash','exports','TEXT'];(function(_0x1af1dc,_0x1ee272){var _0x218c76=function(_0x514dc4){while(--_0x514dc4){_0x1af1dc['push'](_0x1af1dc['shift']());}};_0x218c76(++_0x1ee272);}(_0xf0ba,0x7a));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaf0b('0x0'));var _=require(_0xaf0b('0x1'));module[_0xaf0b('0x2')]={'body':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xaf0b('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xaf0b('0x6')]('in',_0xaf0b('0x7')),'defaultValue':_0xaf0b('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaf0b('0x8')](0x1fe)},'from':{'type':Sequelize[_0xaf0b('0x8')]},'to':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'cc':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'bcc':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'subject':{'type':Sequelize[_0xaf0b('0x3')]},'sentAt':{'type':Sequelize[_0xaf0b('0x9')]},'attach':{'type':Sequelize[_0xaf0b('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaf0b('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaf0b('0x9')]},'originTo':{'type':Sequelize[_0xaf0b('0x3')](_0xaf0b('0x4'))},'originCc':{'type':Sequelize[_0xaf0b('0x3')]('long')},'originChannel':{'type':Sequelize[_0xaf0b('0x6')]('Email',_0xaf0b('0xc')),'defaultValue':_0xaf0b('0xd'),'allowNull':![]}}; \ No newline at end of file +var _0x5416=['medium','ENUM','out','STRING','DATE','INTEGER','BOOLEAN','Chat','Email','sequelize','lodash','exports','TEXT','long'];(function(_0x4dc5fe,_0x821e29){var _0x41ddd0=function(_0x3c260b){while(--_0x3c260b){_0x4dc5fe['push'](_0x4dc5fe['shift']());}};_0x41ddd0(++_0x821e29);}(_0x5416,0x13d));var _0x6541=function(_0x487675,_0x46a3ce){_0x487675=_0x487675-0x0;var _0x527023=_0x5416[_0x487675];return _0x527023;};'use strict';var Sequelize=require(_0x6541('0x0'));var _=require(_0x6541('0x1'));module[_0x6541('0x2')]={'body':{'type':Sequelize[_0x6541('0x3')](_0x6541('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x6541('0x5'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x6541('0x6')]('in',_0x6541('0x7')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x6541('0x8')](0x1fe)},'from':{'type':Sequelize[_0x6541('0x8')]},'to':{'type':Sequelize[_0x6541('0x3')](_0x6541('0x4'))},'cc':{'type':Sequelize[_0x6541('0x3')](_0x6541('0x4'))},'bcc':{'type':Sequelize[_0x6541('0x3')](_0x6541('0x4'))},'subject':{'type':Sequelize[_0x6541('0x3')]},'sentAt':{'type':Sequelize[_0x6541('0x9')]},'attach':{'type':Sequelize[_0x6541('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x6541('0xb')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x6541('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x6541('0x4'))},'originCc':{'type':Sequelize[_0x6541('0x3')]('long')},'originChannel':{'type':Sequelize['ENUM']('Email',_0x6541('0xc')),'defaultValue':_0x6541('0xd'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 3bbef59..6172c62 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 _0x7915=['name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','body','describe','create','secret','split','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','List','List\x20not\x20found','SendMail','messageId','format','accept','mail','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','MailInteraction','MailInteractionId','read1stAt','interaction','get','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','agent','fullname','internal','manual','SIP/%s','channel','event','fromString','EventManager','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','ContactId','User','email','motionChannel','rejectmessage','download','unix','toString','server','files','tmp','from','bcc','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','path','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','offset','undefined','count','limit','set','json','update','destroy','end','sendStatus','stack','index','map','MailMessage','rawAttributes','fieldName','type','model'];(function(_0x297a0e,_0x1f8aca){var _0x3a46b2=function(_0x3b3430){while(--_0x3b3430){_0x297a0e['push'](_0x297a0e['shift']());}};_0x3a46b2(++_0x1f8aca);}(_0x7915,0x108));var _0x5791=function(_0x29a0c8,_0x311cc4){_0x29a0c8=_0x29a0c8-0x0;var _0x529fc9=_0x7915[_0x29a0c8];return _0x529fc9;};'use strict';var emlformat=require(_0x5791('0x0'));var moment=require(_0x5791('0x1'));var BPromise=require(_0x5791('0x2'));var util=require(_0x5791('0x3'));var path=require(_0x5791('0x4'));var fs=require('fs');var _=require(_0x5791('0x5'));var Redis=require(_0x5791('0x6'));var htmlToText=require(_0x5791('0x7'));var qs=require(_0x5791('0x8'));var logger=require(_0x5791('0x9'))(_0x5791('0xa'));var interaction_log=require('../../config/logger')('mail-interactions');var config=require(_0x5791('0xb'));var db=require('../../mysqldb')['db'];config[_0x5791('0xc')]=_[_0x5791('0xd')](config[_0x5791('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x5791('0xe'))(new Redis(config[_0x5791('0xc')]));var htmlEntities=require('html-entities');require(_0x5791('0xf'))[_0x5791('0x10')](socket);var jayson=require(_0x5791('0x11'));var client=jayson[_0x5791('0x12')][_0x5791('0x13')]({'port':0x232c});var client9003=jayson[_0x5791('0x12')][_0x5791('0x13')]({'port':0x232b});var client9002=jayson[_0x5791('0x12')][_0x5791('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x5e4d6a,_0x58d8c7,_0x1fba10,_0x504ea9){return new BPromise(function(_0x325624,_0x47b01a){var _0x339dd0=_0x504ea9||client;return _0x339dd0[_0x5791('0x14')](_0x5e4d6a,_0x1fba10)[_0x5791('0x15')](function(_0x5b10f9){logger['info'](_0x5791('0x16'),_0x58d8c7,'request\x20sent');logger[_0x5791('0x17')](_0x5791('0x18'),_0x58d8c7,_0x5791('0x19'),JSON[_0x5791('0x1a')](_0x5b10f9));if(_0x5b10f9[_0x5791('0x1b')]){if(_0x5b10f9[_0x5791('0x1b')]['code']===0x1f4){logger[_0x5791('0x1b')](_0x5791('0x16'),_0x58d8c7,_0x5b10f9[_0x5791('0x1b')][_0x5791('0x1c')]);return _0x47b01a(_0x5b10f9[_0x5791('0x1b')]['message']);}logger[_0x5791('0x1b')](_0x5791('0x16'),_0x58d8c7,_0x5b10f9[_0x5791('0x1b')]['message']);return _0x325624(_0x5b10f9[_0x5791('0x1b')][_0x5791('0x1c')]);}else{logger['info'](_0x5791('0x16'),_0x58d8c7,_0x5791('0x19'));_0x325624(_0x5b10f9[_0x5791('0x1d')][_0x5791('0x1c')]);}})[_0x5791('0x1e')](function(_0x11ab82){logger[_0x5791('0x1b')]('MailMessage,\x20%s,\x20%s',_0x58d8c7,_0x11ab82);_0x47b01a(_0x11ab82);});});}function respondWithResult(_0x2d9c7f,_0x21a6cf){_0x21a6cf=_0x21a6cf||0xc8;return function(_0x5228b9){if(_0x5228b9){return _0x2d9c7f[_0x5791('0x1f')](_0x21a6cf)['json'](_0x5228b9);}};}function respondWithFilteredResult(_0x406771,_0x320019){return function(_0x2dcf91){if(_0x2dcf91){var _0x769f01=typeof _0x320019[_0x5791('0x20')]===_0x5791('0x21')&&typeof _0x320019['limit']===_0x5791('0x21');var _0x198365=_0x2dcf91[_0x5791('0x22')];var _0x4c4750=_0x769f01?0x0:_0x320019[_0x5791('0x20')];var _0x6b79f3=_0x769f01?_0x2dcf91[_0x5791('0x22')]:_0x320019[_0x5791('0x20')]+_0x320019[_0x5791('0x23')];var _0x1639d1;if(_0x6b79f3>=_0x198365){_0x6b79f3=_0x198365;_0x1639d1=0xc8;}else{_0x1639d1=0xce;}_0x406771[_0x5791('0x1f')](_0x1639d1);return _0x406771[_0x5791('0x24')]('Content-Range',_0x4c4750+'-'+_0x6b79f3+'/'+_0x198365)[_0x5791('0x25')](_0x2dcf91);}return null;};}function saveUpdates(_0x1ffca6){return function(_0x568098){if(_0x568098){return _0x568098[_0x5791('0x26')](_0x1ffca6)[_0x5791('0x15')](function(_0x4751d6){return _0x4751d6;});}return null;};}function removeEntity(_0x45f1ee){return function(_0x5eafbb){if(_0x5eafbb){return _0x5eafbb[_0x5791('0x27')]()[_0x5791('0x15')](function(){_0x45f1ee[_0x5791('0x1f')](0xcc)[_0x5791('0x28')]();});}};}function handleEntityNotFound(_0x42ddb3){return function(_0x46da8e){if(!_0x46da8e){_0x42ddb3[_0x5791('0x29')](0x194);}return _0x46da8e;};}function handleError(_0xd53a49,_0x11e194){_0x11e194=_0x11e194||0x1f4;return function(_0x197f46){logger[_0x5791('0x1b')](_0x197f46[_0x5791('0x2a')]);if(_0x197f46['name']){delete _0x197f46['name'];}_0xd53a49[_0x5791('0x1f')](_0x11e194)['send'](_0x197f46);};}exports[_0x5791('0x2b')]=function(_0x454e8d,_0x3a232){var _0x35f95c={},_0x2aad08={},_0x5a01d8={'count':0x0,'rows':[]};var _0x1eeb47=_[_0x5791('0x2c')](db[_0x5791('0x2d')][_0x5791('0x2e')],function(_0x1dded2){return{'name':_0x1dded2[_0x5791('0x2f')],'type':_0x1dded2[_0x5791('0x30')]['key']};});_0x2aad08[_0x5791('0x31')]=_[_0x5791('0x2c')](_0x1eeb47,_0x5791('0x32'));_0x2aad08[_0x5791('0x33')]=_[_0x5791('0x34')](_0x454e8d[_0x5791('0x33')]);_0x2aad08[_0x5791('0x35')]=_[_0x5791('0x36')](_0x2aad08[_0x5791('0x31')],_0x2aad08['query']);_0x35f95c[_0x5791('0x37')]=_[_0x5791('0x36')](_0x2aad08[_0x5791('0x31')],qs[_0x5791('0x38')](_0x454e8d[_0x5791('0x33')][_0x5791('0x38')]));_0x35f95c['attributes']=_0x35f95c[_0x5791('0x37')][_0x5791('0x39')]?_0x35f95c[_0x5791('0x37')]:_0x2aad08[_0x5791('0x31')];if(!_0x454e8d[_0x5791('0x33')]['hasOwnProperty'](_0x5791('0x3a'))){_0x35f95c[_0x5791('0x23')]=qs[_0x5791('0x23')](_0x454e8d[_0x5791('0x33')][_0x5791('0x23')]);_0x35f95c[_0x5791('0x20')]=qs[_0x5791('0x20')](_0x454e8d[_0x5791('0x33')][_0x5791('0x20')]);}_0x35f95c[_0x5791('0x3b')]=qs[_0x5791('0x3c')](_0x454e8d['query'][_0x5791('0x3c')]);_0x35f95c[_0x5791('0x3d')]=qs[_0x5791('0x35')](_[_0x5791('0x3e')](_0x454e8d['query'],_0x2aad08['filters']),_0x1eeb47);if(_0x454e8d[_0x5791('0x33')][_0x5791('0x3f')]){_0x35f95c[_0x5791('0x3d')]=_[_0x5791('0x40')](_0x35f95c[_0x5791('0x3d')],{'$or':_[_0x5791('0x2c')](_0x1eeb47,function(_0xf3fa56){if(_0xf3fa56[_0x5791('0x30')]!==_0x5791('0x41')){var _0x25609a={};_0x25609a[_0xf3fa56[_0x5791('0x32')]]={'$like':'%'+_0x454e8d[_0x5791('0x33')][_0x5791('0x3f')]+'%'};return _0x25609a;}})});}_0x35f95c=_[_0x5791('0x40')]({},_0x35f95c,_0x454e8d[_0x5791('0x42')]);var _0x499343={'where':_0x35f95c[_0x5791('0x3d')]};return db[_0x5791('0x2d')][_0x5791('0x22')](_0x499343)[_0x5791('0x15')](function(_0x41ef1f){_0x5a01d8['count']=_0x41ef1f;if(_0x454e8d[_0x5791('0x33')]['includeAll']){_0x35f95c[_0x5791('0x43')]=[{'all':!![]}];}return db[_0x5791('0x2d')][_0x5791('0x44')](_0x35f95c);})[_0x5791('0x15')](function(_0x16075f){_0x5a01d8[_0x5791('0x45')]=_0x16075f;return _0x5a01d8;})[_0x5791('0x15')](respondWithFilteredResult(_0x3a232,_0x35f95c))[_0x5791('0x1e')](handleError(_0x3a232,null));};exports[_0x5791('0x46')]=function(_0x54c962,_0x5d095a){var _0x5b5ac6={'raw':!![],'where':{'id':_0x54c962[_0x5791('0x47')]['id']}},_0x4367db={};_0x4367db[_0x5791('0x31')]=_['keys'](db[_0x5791('0x2d')][_0x5791('0x2e')]);_0x4367db[_0x5791('0x33')]=_[_0x5791('0x34')](_0x54c962[_0x5791('0x33')]);_0x4367db[_0x5791('0x35')]=_['intersection'](_0x4367db[_0x5791('0x31')],_0x4367db[_0x5791('0x33')]);_0x5b5ac6[_0x5791('0x37')]=_['intersection'](_0x4367db['model'],qs[_0x5791('0x38')](_0x54c962[_0x5791('0x33')][_0x5791('0x38')]));_0x5b5ac6['attributes']=_0x5b5ac6['attributes'][_0x5791('0x39')]?_0x5b5ac6[_0x5791('0x37')]:_0x4367db[_0x5791('0x31')];if(_0x54c962[_0x5791('0x33')][_0x5791('0x48')]){_0x5b5ac6['include']=[{'all':!![]}];}_0x5b5ac6=_[_0x5791('0x40')]({},_0x5b5ac6,_0x54c962['options']);return db[_0x5791('0x2d')][_0x5791('0x49')](_0x5b5ac6)[_0x5791('0x15')](handleEntityNotFound(_0x5d095a,null))[_0x5791('0x15')](respondWithResult(_0x5d095a,null))[_0x5791('0x1e')](handleError(_0x5d095a,null));};exports[_0x5791('0x26')]=function(_0x2da0c0,_0x619bc4){if(_0x2da0c0[_0x5791('0x4a')]['id']){delete _0x2da0c0[_0x5791('0x4a')]['id'];}return db[_0x5791('0x2d')][_0x5791('0x49')]({'where':{'id':_0x2da0c0[_0x5791('0x47')]['id']}})[_0x5791('0x15')](handleEntityNotFound(_0x619bc4,null))['then'](saveUpdates(_0x2da0c0['body'],null))[_0x5791('0x15')](respondWithResult(_0x619bc4,null))['catch'](handleError(_0x619bc4,null));};exports[_0x5791('0x27')]=function(_0x2cebfa,_0x50a7c9){return db[_0x5791('0x2d')][_0x5791('0x49')]({'where':{'id':_0x2cebfa[_0x5791('0x47')]['id']}})[_0x5791('0x15')](handleEntityNotFound(_0x50a7c9,null))['then'](removeEntity(_0x50a7c9,null))[_0x5791('0x1e')](handleError(_0x50a7c9,null));};exports['describe']=function(_0x299df3,_0x5b3c8c){return db['MailMessage'][_0x5791('0x4b')]()[_0x5791('0x15')](respondWithResult(_0x5b3c8c,null))[_0x5791('0x1e')](handleError(_0x5b3c8c,null));};exports['create']=function(_0x5b24a5,_0x511905){return db['MailMessage'][_0x5791('0x4c')](_0x5b24a5[_0x5791('0x4a')])['then'](function(_0x373c47){if(_0x373c47){if(_0x373c47['direction']==='out'&&!_0x373c47[_0x5791('0x4d')]){var _0x10fc00,_0x33b687,_0xf7598d;if(_0x5b24a5[_0x5791('0x4a')]['to']){_0x33b687=_0x5b24a5['body']['to'][_0x5791('0x4e')](',')[0x0];}return db[_0x5791('0x4f')][_0x5791('0x50')]({'where':{'id':_0x373c47[_0x5791('0x51')]},'include':[{'model':db[_0x5791('0x52')],'as':'List','include':[{'model':db[_0x5791('0x53')],'as':_0x5791('0x54'),'where':{'email':_0x33b687},'limit':0x1,'order':[[_0x5791('0x55'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x5791('0x56'),'raw':!![],'include':[{'model':db[_0x5791('0x57')],'as':_0x5791('0x57'),'raw':!![]}]}]})[_0x5791('0x15')](function(_0x14df6b){_0x10fc00=_0x14df6b;if(!_0x10fc00||!_0x10fc00[_0x5791('0x56')])return;var _0x55c5b7=_0x10fc00[_0x5791('0x58')]();if(_0x5b24a5[_0x5791('0x4a')][_0x5791('0x59')]&&_0x5b24a5[_0x5791('0x4a')][_0x5791('0x59')]['length']){for(var _0x228751=0x0;_0x228751<_0x5b24a5[_0x5791('0x4a')][_0x5791('0x59')][_0x5791('0x39')];_0x228751+=0x1){_0x5b24a5['body']['attachments'][_0x228751]={'filename':_0x5b24a5['body'][_0x5791('0x59')][_0x228751][_0x5791('0x32')],'path':path[_0x5791('0x5a')](config[_0x5791('0x5b')],'server/files/attachments',_0x5b24a5['body'][_0x5791('0x59')][_0x228751][_0x5791('0x5c')])};}}_0xf7598d={'account':_0x55c5b7,'message':_0x5b24a5[_0x5791('0x4a')]};return;})[_0x5791('0x15')](function(){if(_0x10fc00[_0x5791('0x5d')]){if(_0x10fc00[_0x5791('0x5d')][_0x5791('0x54')][_0x5791('0x39')]){return _0x10fc00[_0x5791('0x5d')][_0x5791('0x54')][0x0];}else{return db[_0x5791('0x53')][_0x5791('0x4c')](_[_0x5791('0xd')](_0x5b24a5[_0x5791('0x4a')],{'firstName':_0x5b24a5['body']['to'],'email':_0x5b24a5['body']['to'],'phone':_0x5b24a5[_0x5791('0x4a')]['to'],'ListId':_0x10fc00['ListId']}));}}else{throw new Error(_0x5791('0x5e'));}})[_0x5791('0x15')](function(){if(_0xf7598d){return respondWithRpcPromise(_0x5791('0x5f'),'sendMail',_0xf7598d,client9003)['then'](function(_0x3edadc){return _0x373c47[_0x5791('0x26')]({'read':!![],'messageId':_0x3edadc[_0x5791('0x60')],'sentAt':moment()[_0x5791('0x61')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x5791('0x1e')](function(_0x1e61aa){logger[_0x5791('0x1b')]('%s',JSON[_0x5791('0x1a')](_0x1e61aa));return _0x373c47;});}return _0x373c47;});}return _0x373c47;}})[_0x5791('0x15')](respondWithResult(_0x511905,0xc9))[_0x5791('0x1e')](handleError(_0x511905,null));};exports[_0x5791('0x62')]=function(_0x1e7b74,_0x390e27){var _0x2a02b3={'agent':{},'channel':_0x5791('0x63')};if(_0x1e7b74[_0x5791('0x4a')]['id']){delete _0x1e7b74['body']['id'];}_0x1e7b74[_0x5791('0x4a')][_0x5791('0x64')]=!![];_0x1e7b74['body'][_0x5791('0x65')]=moment()[_0x5791('0x61')](_0x5791('0x66'));_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')]=_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')]||_0x1e7b74[_0x5791('0x68')]['id'];_0x2a02b3['agent']['id']=_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')];return db['MailMessage'][_0x5791('0x49')]({'where':{'id':_0x1e7b74[_0x5791('0x47')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x390e27,null))[_0x5791('0x15')](saveUpdates(_0x1e7b74[_0x5791('0x4a')],null))[_0x5791('0x15')](function(_0x451f75){if(_0x451f75){_0x2a02b3[_0x5791('0x1c')]=_0x451f75['get']({'plain':!![]});return db[_0x5791('0x69')]['find']({'where':{'id':_0x451f75[_0x5791('0x6a')]}});}return null;})[_0x5791('0x15')](handleEntityNotFound(_0x390e27,null))[_0x5791('0x15')](function(_0x27d860){if(_0x27d860){return _0x27d860[_0x5791('0x26')]({'UserId':_0x1e7b74[_0x5791('0x4a')]['UserId'],'read1stAt':_['isNil'](_0x27d860[_0x5791('0x6b')])?moment()[_0x5791('0x61')](_0x5791('0x66')):undefined});}return null;})[_0x5791('0x15')](function(_0x3b4127){if(_0x3b4127){_0x2a02b3[_0x5791('0x6c')]=_0x3b4127[_0x5791('0x6d')]({'plain':!![]});interaction_log[_0x5791('0x6e')](_0x5791('0x6f'),_0x1e7b74['user']['id'],_0x1e7b74[_0x5791('0x68')][_0x5791('0x32')],_0x1e7b74[_0x5791('0x68')][_0x5791('0x70')],_0x2a02b3[_0x5791('0x6c')]['id'],_0x1e7b74[_0x5791('0x4a')]?JSON[_0x5791('0x1a')](_0x1e7b74[_0x5791('0x4a')]):'null');return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x2a02b3);}return null;})['then'](function(_0x42e924){var _0x1debb2=_0x5791('0x71')+_0x42e924[_0x5791('0x1c')]['ContactId'];return db[_0x5791('0x72')][_0x5791('0x33')](_0x1debb2,{'type':db['Sequelize'][_0x5791('0x73')][_0x5791('0x74')],'raw':!![]})[_0x5791('0x15')](function(_0x42e295){return _0x42e295;});})[_0x5791('0x15')](function(_0x399f44){if(_0x399f44){_0x2a02b3[_0x5791('0x1c')]['contact']=_0x399f44[0x0];if(!_0x1e7b74[_0x5791('0x4a')][_0x5791('0x67')])return;return db['User'][_0x5791('0x49')]({'where':{'id':_0x1e7b74['body'][_0x5791('0x67')],'role':_0x5791('0x75')},'attributes':['id',_0x5791('0x32'),_0x5791('0x76'),'email',_0x5791('0x77')],'raw':!![]});}return null;})[_0x5791('0x15')](function(_0x5284e6){if(!_0x5284e6)return null;_0x2a02b3[_0x5791('0x1c')]['agent']=_0x5284e6;return _0x2a02b3;})[_0x5791('0x15')](function(_0x22a0db){if(_0x22a0db){if(_0x1e7b74['body'][_0x5791('0x78')]){_0x2a02b3['message']['interface']=util[_0x5791('0x61')](_0x5791('0x79'),_0x1e7b74[_0x5791('0x68')][_0x5791('0x32')]);_0x2a02b3[_0x5791('0x1c')][_0x5791('0x7a')]=_0x2a02b3[_0x5791('0x7a')];_0x2a02b3[_0x5791('0x1c')]['motionChannel']=_0x2a02b3[_0x5791('0x7a')];_0x2a02b3[_0x5791('0x1c')][_0x5791('0x7b')]='accept';_0x2a02b3[_0x5791('0x1c')][_0x5791('0x4a')]=htmlToText[_0x5791('0x7c')](_0x2a02b3[_0x5791('0x1c')][_0x5791('0x4a')]);return respondWithRpcPromise(_0x5791('0x7d'),_0x5791('0x7d'),{'event':'acceptmessage','message':_0x2a02b3[_0x5791('0x1c')]},client9002)['then'](function(){return _0x2a02b3;});}return _0x2a02b3;}return null;})[_0x5791('0x15')](respondWithResult(_0x390e27,null))[_0x5791('0x1e')](handleError(_0x390e27,null));};exports[_0x5791('0x7e')]=function(_0x4f5e82,_0x1a2840){var _0x1a1b80={'agent':{},'channel':_0x5791('0x63')};if(_0x4f5e82[_0x5791('0x4a')]['id']){delete _0x4f5e82[_0x5791('0x4a')]['id'];}_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')]=_0x4f5e82['body'][_0x5791('0x67')]||_0x4f5e82[_0x5791('0x68')]['id'];_0x1a1b80[_0x5791('0x75')]['id']=_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')];return db[_0x5791('0x2d')][_0x5791('0x49')]({'where':{'id':_0x4f5e82[_0x5791('0x47')]['id'],'UserId':null}})[_0x5791('0x15')](handleEntityNotFound(_0x1a2840,null))[_0x5791('0x15')](function(_0x405a22){if(_0x405a22){_0x1a1b80[_0x5791('0x1c')]=_0x405a22['get']({'plain':!![]});return db[_0x5791('0x69')][_0x5791('0x49')]({'where':{'id':_0x405a22[_0x5791('0x6a')]}});}return null;})[_0x5791('0x15')](handleEntityNotFound(_0x1a2840,null))[_0x5791('0x15')](function(_0x262600){if(_0x262600){_0x1a1b80[_0x5791('0x6c')]=_0x262600['get']({'plain':!![]});interaction_log['info'](_0x5791('0x7f'),_0x4f5e82[_0x5791('0x68')]['id'],_0x4f5e82[_0x5791('0x68')][_0x5791('0x32')],_0x4f5e82['user']['role'],_0x1a1b80['interaction']['id'],_0x4f5e82[_0x5791('0x4a')]?JSON['stringify'](_0x4f5e82['body']):_0x5791('0x80'));return respondWithRpcPromise(_0x5791('0x81'),_0x5791('0x82'),_0x1a1b80);}return null;})[_0x5791('0x15')](function(_0x31b7a2){var _0x3fc3f7='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x31b7a2['message'][_0x5791('0x83')];return db[_0x5791('0x72')][_0x5791('0x33')](_0x3fc3f7,{'type':db['Sequelize'][_0x5791('0x73')][_0x5791('0x74')],'raw':!![]})[_0x5791('0x15')](function(_0x3587ad){return _0x3587ad;});})[_0x5791('0x15')](function(_0x2820e1){if(_0x2820e1){_0x1a1b80[_0x5791('0x1c')]['contact']=_0x2820e1[0x0];if(!_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')])return;return db[_0x5791('0x84')][_0x5791('0x49')]({'where':{'id':_0x4f5e82[_0x5791('0x4a')][_0x5791('0x67')],'role':'agent'},'attributes':['id',_0x5791('0x32'),'fullname',_0x5791('0x85'),_0x5791('0x77')],'raw':!![]});}return null;})[_0x5791('0x15')](function(_0x186992){if(!_0x186992)return null;_0x1a1b80[_0x5791('0x1c')][_0x5791('0x75')]=_0x186992;return _0x1a1b80;})[_0x5791('0x15')](function(_0x3f0ba7){if(_0x3f0ba7){_0x3f0ba7[_0x5791('0x1c')]['interface']=util[_0x5791('0x61')]('SIP/%s',_0x4f5e82['user'][_0x5791('0x32')]);_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x7a')]=_0x1a1b80[_0x5791('0x7a')];_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x86')]=_0x1a1b80[_0x5791('0x7a')];_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x7b')]=_0x5791('0x7e');_0x3f0ba7[_0x5791('0x1c')][_0x5791('0x4a')]=htmlToText[_0x5791('0x7c')](_0x1a1b80[_0x5791('0x1c')][_0x5791('0x4a')]);respondWithRpcPromise(_0x5791('0x7d'),'EventManager',{'event':_0x5791('0x87'),'message':_0x3f0ba7[_0x5791('0x1c')]},client9002);return _0x1a1b80;}return null;})[_0x5791('0x15')](respondWithResult(_0x1a2840,null))['catch'](handleError(_0x1a2840,null));};exports[_0x5791('0x88')]=function(_0x10c7d7,_0x1743c8){var _0x3df279=moment()[_0x5791('0x89')]()[_0x5791('0x8a')]();var _0x25f4c7=path[_0x5791('0x5a')](config[_0x5791('0x5b')],_0x5791('0x8b'),_0x5791('0x8c'),_0x5791('0x8d'));var _0x432b8d=path[_0x5791('0x5a')](config[_0x5791('0x5b')],_0x5791('0x8b'),_0x5791('0x8c'),_0x5791('0x59'));var _0xb410af=util[_0x5791('0x61')]('message-%s.eml',_0x3df279);return db[_0x5791('0x2d')]['find']({'where':{'id':_0x10c7d7['params']['id']},'attributes':['id','body',_0x5791('0x8e'),'to','cc',_0x5791('0x8f'),_0x5791('0x90'),_0x5791('0x91')],'include':_0x10c7d7[_0x5791('0x33')][_0x5791('0x59')]?[{'model':db[_0x5791('0x92')],'as':_0x5791('0x93')}]:undefined})['then'](handleEntityNotFound(_0x1743c8,null))[_0x5791('0x15')](function(_0x1a2091){if(_0x1a2091){var _0xda0a77=_0x1a2091;var _0x267dbc={'from':_0xda0a77[_0x5791('0x8e')],'to':_0xda0a77['to'],'subject':_0xda0a77[_0x5791('0x90')],'html':htmlEntities[_0x5791('0x94')](_0xda0a77['body']),'headers':{'Date':moment(_0xda0a77['createdAt'])[_0x5791('0x61')](_0x5791('0x95'))},'attachments':[]};if(_0x1a2091['cc']){_0x267dbc['headers']['Cc']=_0x1a2091['cc'];}if(_0x1a2091[_0x5791('0x8f')]){_0x267dbc[_0x5791('0x96')]['Bcc']=_0x1a2091[_0x5791('0x8f')];}return new BPromise(function(_0xbc5a6b,_0x5ed0bc){if(_0x1a2091[_0x5791('0x93')]){for(var _0x3bd50f=0x0;_0x3bd50f<_0x1a2091[_0x5791('0x93')][_0x5791('0x39')];_0x3bd50f++){var _0xe6c8f8=_0x1a2091[_0x5791('0x93')][_0x3bd50f];var _0x455776=path[_0x5791('0x5a')](_0x432b8d,_0xe6c8f8[_0x5791('0x5c')]);if(fs[_0x5791('0x97')](_0x455776)){_0x267dbc[_0x5791('0x59')][_0x5791('0x98')]({'name':_0xe6c8f8[_0x5791('0x32')],'contentType':_0xe6c8f8['type'],'data':fs[_0x5791('0x99')](_0x455776)});}}}emlformat[_0x5791('0x9a')](_0x267dbc,function(_0x760619,_0x29e09c){if(_0x760619)return _0x5ed0bc(_0x760619);fs[_0x5791('0x9b')](path[_0x5791('0x5a')](_0x25f4c7,_0xb410af),_0x29e09c);return _0xbc5a6b(_0x29e09c);});});}})[_0x5791('0x15')](function(_0x59a4f9){if(_0x59a4f9){return _0x1743c8[_0x5791('0x88')](path[_0x5791('0x5a')](_0x25f4c7,_0xb410af),_0xb410af,function(_0x37dc75){if(!_0x37dc75)fs[_0x5791('0x9c')](path[_0x5791('0x5a')](_0x25f4c7,_0xb410af));});}})[_0x5791('0x1e')](handleError(_0x1743c8,null));}; \ No newline at end of file +var _0xcc4f=['acceptmessage','reject','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','ContactId','Sequelize','contact','interface','rejectmessage','download','toString','root','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','util','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','jayson/promise','client','http','request','then','info','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','catch','params','length','body','find','describe','create','out','MailAccount','findOne','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','server/files/attachments','List','defaults','ListId','List\x20not\x20found','sendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteractionId','isNil','read1stAt','format','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','QueryTypes','SELECT','User','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager'];(function(_0x3a4515,_0x51fc75){var _0x3f5fe8=function(_0x50e2b2){while(--_0x50e2b2){_0x3a4515['push'](_0x3a4515['shift']());}};_0x3f5fe8(++_0x51fc75);}(_0xcc4f,0xbd));var _0xfcc4=function(_0x1f6744,_0x399b61){_0x1f6744=_0x1f6744-0x0;var _0x3d56e0=_0xcc4f[_0x1f6744];return _0x3d56e0;};'use strict';var emlformat=require(_0xfcc4('0x0'));var moment=require(_0xfcc4('0x1'));var BPromise=require('bluebird');var util=require(_0xfcc4('0x2'));var path=require(_0xfcc4('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xfcc4('0x4'));var htmlToText=require(_0xfcc4('0x5'));var qs=require(_0xfcc4('0x6'));var logger=require(_0xfcc4('0x7'))('api');var interaction_log=require(_0xfcc4('0x7'))(_0xfcc4('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xfcc4('0x9')],{'host':_0xfcc4('0xa'),'port':0x18eb});var socket=require(_0xfcc4('0xb'))(new Redis(config['redis']));var htmlEntities=require(_0xfcc4('0xc'));require(_0xfcc4('0xd'))['register'](socket);var jayson=require(_0xfcc4('0xe'));var client=jayson[_0xfcc4('0xf')][_0xfcc4('0x10')]({'port':0x232c});var client9003=jayson[_0xfcc4('0xf')][_0xfcc4('0x10')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52354b,_0x4955b2,_0x28d858,_0xba2419){return new BPromise(function(_0x5e17a5,_0x53b19b){var _0x566417=_0xba2419||client;return _0x566417[_0xfcc4('0x11')](_0x52354b,_0x28d858)[_0xfcc4('0x12')](function(_0x57d7df){logger[_0xfcc4('0x13')]('MailMessage,\x20%s,\x20%s',_0x4955b2,_0xfcc4('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x4955b2,_0xfcc4('0x14'),JSON[_0xfcc4('0x15')](_0x57d7df));if(_0x57d7df['error']){if(_0x57d7df[_0xfcc4('0x16')]['code']===0x1f4){logger[_0xfcc4('0x16')](_0xfcc4('0x17'),_0x4955b2,_0x57d7df[_0xfcc4('0x16')][_0xfcc4('0x18')]);return _0x53b19b(_0x57d7df[_0xfcc4('0x16')][_0xfcc4('0x18')]);}logger[_0xfcc4('0x16')](_0xfcc4('0x17'),_0x4955b2,_0x57d7df[_0xfcc4('0x16')][_0xfcc4('0x18')]);return _0x5e17a5(_0x57d7df[_0xfcc4('0x16')][_0xfcc4('0x18')]);}else{logger[_0xfcc4('0x13')](_0xfcc4('0x17'),_0x4955b2,_0xfcc4('0x14'));_0x5e17a5(_0x57d7df[_0xfcc4('0x19')][_0xfcc4('0x18')]);}})['catch'](function(_0x505d16){logger[_0xfcc4('0x16')](_0xfcc4('0x17'),_0x4955b2,_0x505d16);_0x53b19b(_0x505d16);});});}function respondWithResult(_0x119fce,_0x3d4a44){_0x3d4a44=_0x3d4a44||0xc8;return function(_0x4f8f69){if(_0x4f8f69){return _0x119fce[_0xfcc4('0x1a')](_0x3d4a44)[_0xfcc4('0x1b')](_0x4f8f69);}};}function respondWithFilteredResult(_0x4cdcb3,_0x50adcc){return function(_0x15c07c){if(_0x15c07c){var _0x256492=typeof _0x50adcc[_0xfcc4('0x1c')]==='undefined'&&typeof _0x50adcc[_0xfcc4('0x1d')]==='undefined';var _0x32f294=_0x15c07c[_0xfcc4('0x1e')];var _0xf8b1f1=_0x256492?0x0:_0x50adcc[_0xfcc4('0x1c')];var _0x19624f=_0x256492?_0x15c07c['count']:_0x50adcc[_0xfcc4('0x1c')]+_0x50adcc[_0xfcc4('0x1d')];var _0x50bbf5;if(_0x19624f>=_0x32f294){_0x19624f=_0x32f294;_0x50bbf5=0xc8;}else{_0x50bbf5=0xce;}_0x4cdcb3['status'](_0x50bbf5);return _0x4cdcb3[_0xfcc4('0x1f')](_0xfcc4('0x20'),_0xf8b1f1+'-'+_0x19624f+'/'+_0x32f294)['json'](_0x15c07c);}return null;};}function saveUpdates(_0x4a0966){return function(_0x7d2cd6){if(_0x7d2cd6){return _0x7d2cd6[_0xfcc4('0x21')](_0x4a0966)[_0xfcc4('0x12')](function(_0x4f1198){return _0x4f1198;});}return null;};}function removeEntity(_0x56f1b2){return function(_0x245736){if(_0x245736){return _0x245736[_0xfcc4('0x22')]()['then'](function(){_0x56f1b2[_0xfcc4('0x1a')](0xcc)[_0xfcc4('0x23')]();});}};}function handleEntityNotFound(_0x505e8e){return function(_0xf434f8){if(!_0xf434f8){_0x505e8e[_0xfcc4('0x24')](0x194);}return _0xf434f8;};}function handleError(_0x2271ac,_0x3208f8){_0x3208f8=_0x3208f8||0x1f4;return function(_0x427641){logger[_0xfcc4('0x16')](_0x427641[_0xfcc4('0x25')]);if(_0x427641[_0xfcc4('0x26')]){delete _0x427641[_0xfcc4('0x26')];}_0x2271ac[_0xfcc4('0x1a')](_0x3208f8)[_0xfcc4('0x27')](_0x427641);};}exports[_0xfcc4('0x28')]=function(_0x44ef03,_0x1ef563){var _0x4ddb0a={},_0x2d6e75={},_0x53190b={'count':0x0,'rows':[]};var _0x235b0a=_['map'](db[_0xfcc4('0x29')][_0xfcc4('0x2a')],function(_0xaf5e1f){return{'name':_0xaf5e1f[_0xfcc4('0x2b')],'type':_0xaf5e1f[_0xfcc4('0x2c')][_0xfcc4('0x2d')]};});_0x2d6e75[_0xfcc4('0x2e')]=_[_0xfcc4('0x2f')](_0x235b0a,_0xfcc4('0x26'));_0x2d6e75[_0xfcc4('0x30')]=_[_0xfcc4('0x31')](_0x44ef03['query']);_0x2d6e75['filters']=_[_0xfcc4('0x32')](_0x2d6e75[_0xfcc4('0x2e')],_0x2d6e75[_0xfcc4('0x30')]);_0x4ddb0a['attributes']=_['intersection'](_0x2d6e75[_0xfcc4('0x2e')],qs[_0xfcc4('0x33')](_0x44ef03[_0xfcc4('0x30')][_0xfcc4('0x33')]));_0x4ddb0a[_0xfcc4('0x34')]=_0x4ddb0a[_0xfcc4('0x34')]['length']?_0x4ddb0a[_0xfcc4('0x34')]:_0x2d6e75[_0xfcc4('0x2e')];if(!_0x44ef03[_0xfcc4('0x30')][_0xfcc4('0x35')](_0xfcc4('0x36'))){_0x4ddb0a[_0xfcc4('0x1d')]=qs[_0xfcc4('0x1d')](_0x44ef03['query'][_0xfcc4('0x1d')]);_0x4ddb0a[_0xfcc4('0x1c')]=qs['offset'](_0x44ef03[_0xfcc4('0x30')][_0xfcc4('0x1c')]);}_0x4ddb0a[_0xfcc4('0x37')]=qs[_0xfcc4('0x38')](_0x44ef03[_0xfcc4('0x30')][_0xfcc4('0x38')]);_0x4ddb0a[_0xfcc4('0x39')]=qs['filters'](_[_0xfcc4('0x3a')](_0x44ef03[_0xfcc4('0x30')],_0x2d6e75[_0xfcc4('0x3b')]),_0x235b0a);if(_0x44ef03[_0xfcc4('0x30')][_0xfcc4('0x3c')]){_0x4ddb0a[_0xfcc4('0x39')]=_[_0xfcc4('0x3d')](_0x4ddb0a['where'],{'$or':_[_0xfcc4('0x2f')](_0x235b0a,function(_0xfa2e19){if(_0xfa2e19[_0xfcc4('0x2c')]!=='VIRTUAL'){var _0x39b832={};_0x39b832[_0xfa2e19['name']]={'$like':'%'+_0x44ef03['query'][_0xfcc4('0x3c')]+'%'};return _0x39b832;}})});}_0x4ddb0a=_[_0xfcc4('0x3d')]({},_0x4ddb0a,_0x44ef03[_0xfcc4('0x3e')]);var _0x2b2f7b={'where':_0x4ddb0a[_0xfcc4('0x39')]};return db[_0xfcc4('0x29')]['count'](_0x2b2f7b)['then'](function(_0x2141df){_0x53190b[_0xfcc4('0x1e')]=_0x2141df;if(_0x44ef03[_0xfcc4('0x30')][_0xfcc4('0x3f')]){_0x4ddb0a[_0xfcc4('0x40')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x4ddb0a);})[_0xfcc4('0x12')](function(_0x109193){_0x53190b['rows']=_0x109193;return _0x53190b;})[_0xfcc4('0x12')](respondWithFilteredResult(_0x1ef563,_0x4ddb0a))[_0xfcc4('0x41')](handleError(_0x1ef563,null));};exports['show']=function(_0x5b2508,_0x4a0489){var _0x139342={'raw':!![],'where':{'id':_0x5b2508[_0xfcc4('0x42')]['id']}},_0x5d0d70={};_0x5d0d70[_0xfcc4('0x2e')]=_['keys'](db[_0xfcc4('0x29')][_0xfcc4('0x2a')]);_0x5d0d70[_0xfcc4('0x30')]=_['keys'](_0x5b2508['query']);_0x5d0d70[_0xfcc4('0x3b')]=_[_0xfcc4('0x32')](_0x5d0d70[_0xfcc4('0x2e')],_0x5d0d70['query']);_0x139342[_0xfcc4('0x34')]=_[_0xfcc4('0x32')](_0x5d0d70[_0xfcc4('0x2e')],qs[_0xfcc4('0x33')](_0x5b2508[_0xfcc4('0x30')][_0xfcc4('0x33')]));_0x139342[_0xfcc4('0x34')]=_0x139342[_0xfcc4('0x34')][_0xfcc4('0x43')]?_0x139342[_0xfcc4('0x34')]:_0x5d0d70[_0xfcc4('0x2e')];if(_0x5b2508['query'][_0xfcc4('0x3f')]){_0x139342[_0xfcc4('0x40')]=[{'all':!![]}];}_0x139342=_[_0xfcc4('0x3d')]({},_0x139342,_0x5b2508[_0xfcc4('0x3e')]);return db[_0xfcc4('0x29')]['find'](_0x139342)[_0xfcc4('0x12')](handleEntityNotFound(_0x4a0489,null))[_0xfcc4('0x12')](respondWithResult(_0x4a0489,null))['catch'](handleError(_0x4a0489,null));};exports[_0xfcc4('0x21')]=function(_0x22e9f4,_0x5907aa){if(_0x22e9f4[_0xfcc4('0x44')]['id']){delete _0x22e9f4[_0xfcc4('0x44')]['id'];}return db[_0xfcc4('0x29')][_0xfcc4('0x45')]({'where':{'id':_0x22e9f4['params']['id']}})[_0xfcc4('0x12')](handleEntityNotFound(_0x5907aa,null))[_0xfcc4('0x12')](saveUpdates(_0x22e9f4['body'],null))[_0xfcc4('0x12')](respondWithResult(_0x5907aa,null))[_0xfcc4('0x41')](handleError(_0x5907aa,null));};exports[_0xfcc4('0x22')]=function(_0x56803e,_0x30617e){return db[_0xfcc4('0x29')][_0xfcc4('0x45')]({'where':{'id':_0x56803e[_0xfcc4('0x42')]['id']}})[_0xfcc4('0x12')](handleEntityNotFound(_0x30617e,null))[_0xfcc4('0x12')](removeEntity(_0x30617e,null))[_0xfcc4('0x41')](handleError(_0x30617e,null));};exports[_0xfcc4('0x46')]=function(_0x521b0e,_0x269f8d){return db['MailMessage'][_0xfcc4('0x46')]()[_0xfcc4('0x12')](respondWithResult(_0x269f8d,null))[_0xfcc4('0x41')](handleError(_0x269f8d,null));};exports[_0xfcc4('0x47')]=function(_0x6c9270,_0x50a78c){return db[_0xfcc4('0x29')]['create'](_0x6c9270[_0xfcc4('0x44')])[_0xfcc4('0x12')](function(_0x44c562){if(_0x44c562){if(_0x44c562['direction']===_0xfcc4('0x48')&&!_0x44c562['secret']){var _0x4e6f29,_0xcb7836,_0x391b17;if(_0x6c9270[_0xfcc4('0x44')]['to']){_0xcb7836=_0x6c9270[_0xfcc4('0x44')]['to']['split'](',')[0x0];}return db[_0xfcc4('0x49')][_0xfcc4('0x4a')]({'where':{'id':_0x44c562[_0xfcc4('0x4b')]},'include':[{'model':db[_0xfcc4('0x4c')],'as':'List','include':[{'model':db[_0xfcc4('0x4d')],'as':_0xfcc4('0x4e'),'where':{'email':_0xcb7836},'limit':0x1,'order':[[_0xfcc4('0x4f'),_0xfcc4('0x50')]]}]},{'model':db[_0xfcc4('0x51')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xfcc4('0x52')],'as':_0xfcc4('0x52'),'raw':!![]}]}]})[_0xfcc4('0x12')](function(_0xd2b6da){_0x4e6f29=_0xd2b6da;if(!_0x4e6f29||!_0x4e6f29[_0xfcc4('0x53')])return;var _0x5006b7=_0x4e6f29[_0xfcc4('0x54')]();if(_0x6c9270[_0xfcc4('0x44')]['attachments']&&_0x6c9270[_0xfcc4('0x44')][_0xfcc4('0x55')][_0xfcc4('0x43')]){for(var _0x1b9bfa=0x0;_0x1b9bfa<_0x6c9270['body'][_0xfcc4('0x55')][_0xfcc4('0x43')];_0x1b9bfa+=0x1){_0x6c9270[_0xfcc4('0x44')][_0xfcc4('0x55')][_0x1b9bfa]={'filename':_0x6c9270[_0xfcc4('0x44')][_0xfcc4('0x55')][_0x1b9bfa][_0xfcc4('0x26')],'path':path[_0xfcc4('0x56')](config['root'],_0xfcc4('0x57'),_0x6c9270[_0xfcc4('0x44')]['attachments'][_0x1b9bfa]['basename'])};}}_0x391b17={'account':_0x5006b7,'message':_0x6c9270[_0xfcc4('0x44')]};return;})[_0xfcc4('0x12')](function(){if(_0x4e6f29[_0xfcc4('0x58')]){if(_0x4e6f29[_0xfcc4('0x58')][_0xfcc4('0x4e')]['length']){return _0x4e6f29['List'][_0xfcc4('0x4e')][0x0];}else{return db[_0xfcc4('0x4d')]['create'](_[_0xfcc4('0x59')](_0x6c9270['body'],{'firstName':_0x6c9270[_0xfcc4('0x44')]['to'],'email':_0x6c9270[_0xfcc4('0x44')]['to'],'phone':_0x6c9270[_0xfcc4('0x44')]['to'],'ListId':_0x4e6f29[_0xfcc4('0x5a')]}));}}else{throw new Error(_0xfcc4('0x5b'));}})[_0xfcc4('0x12')](function(){if(_0x391b17){return respondWithRpcPromise('SendMail',_0xfcc4('0x5c'),_0x391b17,client9003)[_0xfcc4('0x12')](function(_0xfc105f){return _0x44c562[_0xfcc4('0x21')]({'read':!![],'messageId':_0xfc105f[_0xfcc4('0x5d')],'sentAt':moment()['format'](_0xfcc4('0x5e'))});})['catch'](function(_0x3dbf08){logger[_0xfcc4('0x16')]('%s',JSON['stringify'](_0x3dbf08));return _0x44c562;});}return _0x44c562;});}return _0x44c562;}})[_0xfcc4('0x12')](respondWithResult(_0x50a78c,0xc9))[_0xfcc4('0x41')](handleError(_0x50a78c,null));};exports[_0xfcc4('0x5f')]=function(_0x5017eb,_0x4fc2af){var _0x189042={'agent':{},'channel':_0xfcc4('0x60')};if(_0x5017eb[_0xfcc4('0x44')]['id']){delete _0x5017eb[_0xfcc4('0x44')]['id'];}_0x5017eb['body'][_0xfcc4('0x61')]=!![];_0x5017eb['body'][_0xfcc4('0x62')]=moment()['format'](_0xfcc4('0x5e'));_0x5017eb[_0xfcc4('0x44')][_0xfcc4('0x63')]=_0x5017eb['body']['UserId']||_0x5017eb[_0xfcc4('0x64')]['id'];_0x189042[_0xfcc4('0x65')]['id']=_0x5017eb[_0xfcc4('0x44')]['UserId'];return db[_0xfcc4('0x29')][_0xfcc4('0x45')]({'where':{'id':_0x5017eb['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4fc2af,null))[_0xfcc4('0x12')](saveUpdates(_0x5017eb['body'],null))[_0xfcc4('0x12')](function(_0x14c9ca){if(_0x14c9ca){_0x189042[_0xfcc4('0x18')]=_0x14c9ca[_0xfcc4('0x66')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x14c9ca[_0xfcc4('0x67')]}});}return null;})[_0xfcc4('0x12')](handleEntityNotFound(_0x4fc2af,null))[_0xfcc4('0x12')](function(_0x5dc2a3){if(_0x5dc2a3){return _0x5dc2a3[_0xfcc4('0x21')]({'UserId':_0x5017eb['body'][_0xfcc4('0x63')],'read1stAt':_[_0xfcc4('0x68')](_0x5dc2a3[_0xfcc4('0x69')])?moment()[_0xfcc4('0x6a')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xfcc4('0x12')](function(_0x16528f){if(_0x16528f){_0x189042[_0xfcc4('0x6b')]=_0x16528f[_0xfcc4('0x66')]({'plain':!![]});interaction_log[_0xfcc4('0x13')](_0xfcc4('0x6c'),_0x5017eb[_0xfcc4('0x64')]['id'],_0x5017eb[_0xfcc4('0x64')]['name'],_0x5017eb[_0xfcc4('0x64')]['role'],_0x189042[_0xfcc4('0x6b')]['id'],_0x5017eb[_0xfcc4('0x44')]?JSON['stringify'](_0x5017eb['body']):_0xfcc4('0x6d'));return respondWithRpcPromise('AcceptMessage',_0xfcc4('0x6e'),_0x189042);}return null;})[_0xfcc4('0x12')](function(_0x42efd0){var _0xc2558d=_0xfcc4('0x6f')+_0x42efd0[_0xfcc4('0x18')]['ContactId'];return db[_0xfcc4('0x70')][_0xfcc4('0x30')](_0xc2558d,{'type':db['Sequelize'][_0xfcc4('0x71')][_0xfcc4('0x72')],'raw':!![]})[_0xfcc4('0x12')](function(_0x50003b){return _0x50003b;});})[_0xfcc4('0x12')](function(_0x37d70d){if(_0x37d70d){_0x189042['message']['contact']=_0x37d70d[0x0];if(!_0x5017eb[_0xfcc4('0x44')]['UserId'])return;return db[_0xfcc4('0x73')][_0xfcc4('0x45')]({'where':{'id':_0x5017eb['body'][_0xfcc4('0x63')],'role':_0xfcc4('0x65')},'attributes':['id',_0xfcc4('0x26'),'fullname',_0xfcc4('0x74'),_0xfcc4('0x75')],'raw':!![]});}return null;})['then'](function(_0x5b05b5){if(!_0x5b05b5)return null;_0x189042[_0xfcc4('0x18')]['agent']=_0x5b05b5;return _0x189042;})[_0xfcc4('0x12')](function(_0x1d6367){if(_0x1d6367){if(_0x5017eb[_0xfcc4('0x44')][_0xfcc4('0x76')]){_0x189042[_0xfcc4('0x18')]['interface']=util[_0xfcc4('0x6a')](_0xfcc4('0x77'),_0x5017eb[_0xfcc4('0x64')][_0xfcc4('0x26')]);_0x189042['message'][_0xfcc4('0x78')]=_0x189042[_0xfcc4('0x78')];_0x189042['message'][_0xfcc4('0x79')]=_0x189042['channel'];_0x189042[_0xfcc4('0x18')][_0xfcc4('0x7a')]=_0xfcc4('0x5f');_0x189042[_0xfcc4('0x18')][_0xfcc4('0x44')]=htmlToText[_0xfcc4('0x7b')](_0x189042['message'][_0xfcc4('0x44')]);return respondWithRpcPromise('EventManager',_0xfcc4('0x7c'),{'event':_0xfcc4('0x7d'),'message':_0x189042[_0xfcc4('0x18')]},client9002)[_0xfcc4('0x12')](function(){return _0x189042;});}return _0x189042;}return null;})[_0xfcc4('0x12')](respondWithResult(_0x4fc2af,null))[_0xfcc4('0x41')](handleError(_0x4fc2af,null));};exports[_0xfcc4('0x7e')]=function(_0x3ac881,_0x4e444e){var _0xd98a22={'agent':{},'channel':_0xfcc4('0x60')};if(_0x3ac881[_0xfcc4('0x44')]['id']){delete _0x3ac881[_0xfcc4('0x44')]['id'];}_0x3ac881[_0xfcc4('0x44')][_0xfcc4('0x63')]=_0x3ac881['body']['UserId']||_0x3ac881[_0xfcc4('0x64')]['id'];_0xd98a22[_0xfcc4('0x65')]['id']=_0x3ac881[_0xfcc4('0x44')]['UserId'];return db[_0xfcc4('0x29')]['find']({'where':{'id':_0x3ac881[_0xfcc4('0x42')]['id'],'UserId':null}})[_0xfcc4('0x12')](handleEntityNotFound(_0x4e444e,null))[_0xfcc4('0x12')](function(_0x9a3a6e){if(_0x9a3a6e){_0xd98a22[_0xfcc4('0x18')]=_0x9a3a6e[_0xfcc4('0x66')]({'plain':!![]});return db[_0xfcc4('0x7f')]['find']({'where':{'id':_0x9a3a6e[_0xfcc4('0x67')]}});}return null;})[_0xfcc4('0x12')](handleEntityNotFound(_0x4e444e,null))['then'](function(_0x4ab3ca){if(_0x4ab3ca){_0xd98a22['interaction']=_0x4ab3ca[_0xfcc4('0x66')]({'plain':!![]});interaction_log[_0xfcc4('0x13')](_0xfcc4('0x80'),_0x3ac881['user']['id'],_0x3ac881[_0xfcc4('0x64')]['name'],_0x3ac881[_0xfcc4('0x64')][_0xfcc4('0x81')],_0xd98a22['interaction']['id'],_0x3ac881[_0xfcc4('0x44')]?JSON[_0xfcc4('0x15')](_0x3ac881[_0xfcc4('0x44')]):_0xfcc4('0x6d'));return respondWithRpcPromise('RejectMessage','rejectMessage',_0xd98a22);}return null;})[_0xfcc4('0x12')](function(_0x345dbe){var _0x55ce2b=_0xfcc4('0x6f')+_0x345dbe[_0xfcc4('0x18')][_0xfcc4('0x82')];return db['sequelize'][_0xfcc4('0x30')](_0x55ce2b,{'type':db[_0xfcc4('0x83')]['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x21610f){return _0x21610f;});})[_0xfcc4('0x12')](function(_0x1f4ecc){if(_0x1f4ecc){_0xd98a22[_0xfcc4('0x18')][_0xfcc4('0x84')]=_0x1f4ecc[0x0];if(!_0x3ac881[_0xfcc4('0x44')]['UserId'])return;return db[_0xfcc4('0x73')][_0xfcc4('0x45')]({'where':{'id':_0x3ac881['body'][_0xfcc4('0x63')],'role':_0xfcc4('0x65')},'attributes':['id',_0xfcc4('0x26'),'fullname','email',_0xfcc4('0x75')],'raw':!![]});}return null;})[_0xfcc4('0x12')](function(_0x5479ca){if(!_0x5479ca)return null;_0xd98a22[_0xfcc4('0x18')][_0xfcc4('0x65')]=_0x5479ca;return _0xd98a22;})[_0xfcc4('0x12')](function(_0x2ed951){if(_0x2ed951){_0x2ed951['message'][_0xfcc4('0x85')]=util[_0xfcc4('0x6a')](_0xfcc4('0x77'),_0x3ac881[_0xfcc4('0x64')][_0xfcc4('0x26')]);_0x2ed951[_0xfcc4('0x18')][_0xfcc4('0x78')]=_0xd98a22[_0xfcc4('0x78')];_0x2ed951[_0xfcc4('0x18')][_0xfcc4('0x79')]=_0xd98a22[_0xfcc4('0x78')];_0x2ed951['message']['event']=_0xfcc4('0x7e');_0x2ed951[_0xfcc4('0x18')][_0xfcc4('0x44')]=htmlToText['fromString'](_0xd98a22[_0xfcc4('0x18')][_0xfcc4('0x44')]);respondWithRpcPromise('EventManager','EventManager',{'event':_0xfcc4('0x86'),'message':_0x2ed951[_0xfcc4('0x18')]},client9002);return _0xd98a22;}return null;})[_0xfcc4('0x12')](respondWithResult(_0x4e444e,null))[_0xfcc4('0x41')](handleError(_0x4e444e,null));};exports[_0xfcc4('0x87')]=function(_0x2b841a,_0x41545a){var _0x19661e=moment()['unix']()[_0xfcc4('0x88')]();var _0x293b98=path['join'](config[_0xfcc4('0x89')],_0xfcc4('0x8a'),_0xfcc4('0x8b'),'tmp');var _0x4e0ed2=path[_0xfcc4('0x56')](config[_0xfcc4('0x89')],_0xfcc4('0x8a'),'files',_0xfcc4('0x55'));var _0x2720e8=util[_0xfcc4('0x6a')](_0xfcc4('0x8c'),_0x19661e);return db[_0xfcc4('0x29')][_0xfcc4('0x45')]({'where':{'id':_0x2b841a[_0xfcc4('0x42')]['id']},'attributes':['id','body',_0xfcc4('0x8d'),'to','cc',_0xfcc4('0x8e'),_0xfcc4('0x8f'),_0xfcc4('0x90')],'include':_0x2b841a['query'][_0xfcc4('0x55')]?[{'model':db[_0xfcc4('0x91')],'as':_0xfcc4('0x92')}]:undefined})['then'](handleEntityNotFound(_0x41545a,null))[_0xfcc4('0x12')](function(_0xbab694){if(_0xbab694){var _0x17f16d=_0xbab694;var _0x4aa9e7={'from':_0x17f16d['from'],'to':_0x17f16d['to'],'subject':_0x17f16d[_0xfcc4('0x8f')],'html':htmlEntities[_0xfcc4('0x93')](_0x17f16d[_0xfcc4('0x44')]),'headers':{'Date':moment(_0x17f16d[_0xfcc4('0x90')])['format']('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0xbab694['cc']){_0x4aa9e7[_0xfcc4('0x94')]['Cc']=_0xbab694['cc'];}if(_0xbab694['bcc']){_0x4aa9e7[_0xfcc4('0x94')][_0xfcc4('0x95')]=_0xbab694[_0xfcc4('0x8e')];}return new BPromise(function(_0x3cd272,_0x57c145){if(_0xbab694[_0xfcc4('0x92')]){for(var _0x2cf92d=0x0;_0x2cf92d<_0xbab694['Attachments'][_0xfcc4('0x43')];_0x2cf92d++){var _0x50c8e9=_0xbab694[_0xfcc4('0x92')][_0x2cf92d];var _0x5a3b42=path[_0xfcc4('0x56')](_0x4e0ed2,_0x50c8e9[_0xfcc4('0x96')]);if(fs[_0xfcc4('0x97')](_0x5a3b42)){_0x4aa9e7['attachments'][_0xfcc4('0x98')]({'name':_0x50c8e9[_0xfcc4('0x26')],'contentType':_0x50c8e9[_0xfcc4('0x2c')],'data':fs[_0xfcc4('0x99')](_0x5a3b42)});}}}emlformat[_0xfcc4('0x9a')](_0x4aa9e7,function(_0x54cdd2,_0x340a15){if(_0x54cdd2)return _0x57c145(_0x54cdd2);fs[_0xfcc4('0x9b')](path['join'](_0x293b98,_0x2720e8),_0x340a15);return _0x3cd272(_0x340a15);});});}})[_0xfcc4('0x12')](function(_0x5e9207){if(_0x5e9207){return _0x41545a[_0xfcc4('0x87')](path[_0xfcc4('0x56')](_0x293b98,_0x2720e8),_0x2720e8,function(_0x55cdaa){if(!_0x55cdaa)fs[_0xfcc4('0x9c')](path[_0xfcc4('0x56')](_0x293b98,_0x2720e8));});}})[_0xfcc4('0x41')](handleError(_0x41545a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 14c580e..d5fd528 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 _0xb093=['emit','hasOwnProperty','hook','exports','events','setMaxListeners','save','remove'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb093,0x1ec));var _0x3b09=function(_0x44aeaf,_0x2cd541){_0x44aeaf=_0x44aeaf-0x0;var _0x318a2e=_0xb093[_0x44aeaf];return _0x318a2e;};'use strict';var EventEmitter=require(_0x3b09('0x0'));var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x3b09('0x1')](0x0);var events={'afterCreate':_0x3b09('0x2'),'afterUpdate':'update','afterDestroy':_0x3b09('0x3')};function emitEvent(_0x2383bb){return function(_0x90fcad,_0x16ce87,_0x21832b){MailMessageEvents['emit'](_0x2383bb+':'+_0x90fcad['id'],_0x90fcad);MailMessageEvents[_0x3b09('0x4')](_0x2383bb,_0x90fcad);_0x21832b(null);};}for(var e in events){if(events[_0x3b09('0x5')](e)){var event=events[e];MailMessage[_0x3b09('0x6')](e,emitEvent(event));}}module[_0x3b09('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x5aff=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x10bb6d,_0xbcaf2a){var _0x3d8b4c=function(_0x3fafed){while(--_0x3fafed){_0x10bb6d['push'](_0x10bb6d['shift']());}};_0x3d8b4c(++_0xbcaf2a);}(_0x5aff,0x114));var _0xf5af=function(_0x475ee3,_0x341c57){_0x475ee3=_0x475ee3-0x0;var _0x2a6cb6=_0x5aff[_0x475ee3];return _0x2a6cb6;};'use strict';var EventEmitter=require(_0xf5af('0x0'));var MailMessage=require(_0xf5af('0x1'))['db'][_0xf5af('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xf5af('0x3')](0x0);var events={'afterCreate':_0xf5af('0x4'),'afterUpdate':_0xf5af('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2ff766){return function(_0x1a64d1,_0x2d6b33,_0x20f8cc){MailMessageEvents['emit'](_0x2ff766+':'+_0x1a64d1['id'],_0x1a64d1);MailMessageEvents[_0xf5af('0x6')](_0x2ff766,_0x1a64d1);_0x20f8cc(null);};}for(var e in events){if(events[_0xf5af('0x7')](e)){var event=events[e];MailMessage[_0xf5af('0x8')](e,emitEvent(event));}}module[_0xf5af('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index e4b2b7b..e952821 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 _0x424f=['body','get','direction','out','secret','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','toLowerCase','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','exports','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT'];(function(_0x5f3828,_0xfca3ce){var _0x42b9c5=function(_0x43e497){while(--_0x43e497){_0x5f3828['push'](_0x5f3828['shift']());}};_0x42b9c5(++_0xfca3ce);}(_0x424f,0x9e));var _0xf424=function(_0x2977d3,_0x1769ca){_0x2977d3=_0x2977d3-0x0;var _0x234a81=_0x424f[_0x2977d3];return _0x234a81;};'use strict';var _=require(_0xf424('0x0'));var util=require(_0xf424('0x1'));var logger=require('../../config/logger')(_0xf424('0x2'));var moment=require(_0xf424('0x3'));var BPromise=require(_0xf424('0x4'));var rp=require(_0xf424('0x5'));var htmlToText=require(_0xf424('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf424('0x7'));var config=require(_0xf424('0x8'));var attributes=require('./mailMessage.attributes');module[_0xf424('0x9')]=function(_0x1607c6,_0x56ebd8){return _0x1607c6['define'](_0xf424('0xa'),attributes,{'tableName':_0xf424('0xb'),'paranoid':![],'indexes':[{'name':_0xf424('0xc'),'fields':['messageId']},{'name':_0xf424('0xd'),'fields':[_0xf424('0xe'),_0xf424('0xf')],'type':_0xf424('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2468c6,_0x4114bd,_0xd8c860){if(_0x2468c6[_0xf424('0x11')]){_0x2468c6[_0xf424('0xe')]=htmlToText['fromString'](_0x2468c6[_0xf424('0x11')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xd8c860(null,_0x4114bd);},'afterCreate':function(_0x3b1aba,_0x21607d,_0x374784){var _0xca677c=_0x1607c6['models'];var _0x125912=_0x3b1aba[_0xf424('0x12')]({'plain':!![]});if(_0x125912[_0xf424('0x13')]['toLowerCase']()==='in'||_0x125912[_0xf424('0x13')]['toLowerCase']()===_0xf424('0x14')&&!_0x125912[_0xf424('0x15')]&&!_[_0xf424('0x16')](_0x125912[_0xf424('0x17')])){_0xca677c[_0xf424('0x18')][_0xf424('0x19')]({'where':{'id':_0x125912[_0xf424('0x1a')]}})[_0xf424('0x1b')](function(_0x1f5c03){if(_0x1f5c03){_0x1f5c03[_0xf424('0x1c')]({'lastMsgAt':_0x125912[_0xf424('0x1d')],'lastMsgDirection':_0x125912[_0xf424('0x13')][_0xf424('0x1e')]()});}})[_0xf424('0x1f')](function(_0x1ec9d1){console[_0xf424('0x20')](_0x1ec9d1);});}_0x374784();}},'charset':_0xf424('0x21'),'collate':_0xf424('0x22')});}; \ No newline at end of file +var _0x0a83=['models','get','direction','toLowerCase','secret','isNil','UserId','MailInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','bluebird','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','messageId','fti_mail_messages','subject','FULLTEXT','plainBody'];(function(_0x2ce4bb,_0x4bc632){var _0x19356b=function(_0x47137b){while(--_0x47137b){_0x2ce4bb['push'](_0x2ce4bb['shift']());}};_0x19356b(++_0x4bc632);}(_0x0a83,0x16f));var _0x30a8=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x0a83[_0x28d18d];return _0x470640;};'use strict';var _=require(_0x30a8('0x0'));var util=require(_0x30a8('0x1'));var logger=require('../../config/logger')(_0x30a8('0x2'));var moment=require('moment');var BPromise=require(_0x30a8('0x3'));var rp=require(_0x30a8('0x4'));var htmlToText=require(_0x30a8('0x5'));var fs=require('fs');var path=require(_0x30a8('0x6'));var rimraf=require('rimraf');var config=require(_0x30a8('0x7'));var attributes=require(_0x30a8('0x8'));module[_0x30a8('0x9')]=function(_0x513a65,_0x3c41a1){return _0x513a65[_0x30a8('0xa')](_0x30a8('0xb'),attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':_0x30a8('0xc'),'fields':[_0x30a8('0xc')]},{'name':_0x30a8('0xd'),'fields':['plainBody',_0x30a8('0xe')],'type':_0x30a8('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x350ff8,_0x483b0f,_0x47ed43){if(_0x350ff8['body']){_0x350ff8[_0x30a8('0x10')]=htmlToText['fromString'](_0x350ff8['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x47ed43(null,_0x483b0f);},'afterCreate':function(_0x4cc207,_0x332dec,_0x415770){var _0x297e1d=_0x513a65[_0x30a8('0x11')];var _0x46d261=_0x4cc207[_0x30a8('0x12')]({'plain':!![]});if(_0x46d261[_0x30a8('0x13')][_0x30a8('0x14')]()==='in'||_0x46d261[_0x30a8('0x13')][_0x30a8('0x14')]()==='out'&&!_0x46d261[_0x30a8('0x15')]&&!_[_0x30a8('0x16')](_0x46d261[_0x30a8('0x17')])){_0x297e1d[_0x30a8('0x18')][_0x30a8('0x19')]({'where':{'id':_0x46d261['MailInteractionId']}})[_0x30a8('0x1a')](function(_0x3350d4){if(_0x3350d4){_0x3350d4[_0x30a8('0x1b')]({'lastMsgAt':_0x46d261['createdAt'],'lastMsgDirection':_0x46d261[_0x30a8('0x13')][_0x30a8('0x14')]()});}})[_0x30a8('0x1c')](function(_0x3bc4e7){console[_0x30a8('0x1d')](_0x3bc4e7);});}_0x415770();}},'charset':_0x30a8('0x1e'),'collate':_0x30a8('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b6f4bd7..1696caa 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 _0x6cb4=['result','catch','CreateMailMessage','MailMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','MailMessage,\x20%s,\x20%s','message'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x6cb4,0xff));var _0x46cb=function(_0x24095d,_0x47d7d9){_0x24095d=_0x24095d-0x0;var _0x1db544=_0x6cb4[_0x24095d];return _0x1db544;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var moment=require(_0x46cb('0x2'));var BPromise=require(_0x46cb('0x3'));var rs=require(_0x46cb('0x4'));var fs=require('fs');var Redis=require(_0x46cb('0x5'));var db=require(_0x46cb('0x6'))['db'];var utils=require(_0x46cb('0x7'));var logger=require(_0x46cb('0x8'))('rpc');var config=require(_0x46cb('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x46cb('0xa')]['http']({'port':0x232a});config[_0x46cb('0xb')]=_[_0x46cb('0xc')](config[_0x46cb('0xb')],{'host':_0x46cb('0xd'),'port':0x18eb});var socket=require(_0x46cb('0xe'))(new Redis(config[_0x46cb('0xb')]));require('./mailMessage.socket')[_0x46cb('0xf')](socket);function respondWithRpcPromise(_0x34f9e9,_0x48101c,_0x206f10){return new BPromise(function(_0x106a87,_0x4a60b2){return client[_0x46cb('0x10')](_0x34f9e9,_0x206f10)[_0x46cb('0x11')](function(_0x570cfd){logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,_0x46cb('0x12'));logger[_0x46cb('0x13')](_0x46cb('0x14'),_0x48101c,_0x46cb('0x12'),JSON['stringify'](_0x570cfd));if(_0x570cfd[_0x46cb('0x15')]){if(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x16')]===0x1f4){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);return _0x4a60b2(_0x570cfd[_0x46cb('0x15')][_0x46cb('0x18')]);}logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0x570cfd['error'][_0x46cb('0x18')]);return _0x106a87(_0x570cfd['error'][_0x46cb('0x18')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x48101c,'request\x20sent');_0x106a87(_0x570cfd[_0x46cb('0x19')][_0x46cb('0x18')]);}})[_0x46cb('0x1a')](function(_0xcc8e2){logger[_0x46cb('0x15')](_0x46cb('0x17'),_0x48101c,_0xcc8e2);_0x4a60b2(_0xcc8e2);});});}exports[_0x46cb('0x1b')]=function(_0x32e9fe){var _0x90cd50=this;return new Promise(function(_0xfc9064,_0x149483){return db[_0x46cb('0x1c')][_0x46cb('0x1d')](_0x32e9fe[_0x46cb('0x1e')],{'raw':_0x32e9fe[_0x46cb('0x1f')]?_0x32e9fe[_0x46cb('0x1f')][_0x46cb('0x20')]===undefined?!![]:![]:!![]})[_0x46cb('0x11')](function(_0x41ecd2){logger[_0x46cb('0x21')](_0x46cb('0x1b'),_0x32e9fe);logger[_0x46cb('0x13')](_0x46cb('0x1b'),_0x32e9fe,JSON[_0x46cb('0x22')](_0x41ecd2));_0xfc9064(_0x41ecd2);})[_0x46cb('0x1a')](function(_0x5a1338){logger['error'](_0x46cb('0x1b'),_0x5a1338[_0x46cb('0x18')],_0x32e9fe);_0x149483(_0x90cd50[_0x46cb('0x15')](0x1f4,_0x5a1338[_0x46cb('0x18')]));});});}; \ No newline at end of file +var _0x4b17=['error','message','MailMessage,\x20%s,\x20%s','result','CreateMailMessage','MailMessage','create','body','options','debug','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','stringify'];(function(_0x3d5027,_0x383cc1){var _0x16013f=function(_0x3d951d){while(--_0x3d951d){_0x3d5027['push'](_0x3d5027['shift']());}};_0x16013f(++_0x383cc1);}(_0x4b17,0x10f));var _0x74b1=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x4b17[_0x2b55b5];return _0x103d28;};'use strict';var _=require(_0x74b1('0x0'));var util=require('util');var moment=require(_0x74b1('0x1'));var BPromise=require('bluebird');var rs=require(_0x74b1('0x2'));var fs=require('fs');var Redis=require(_0x74b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x74b1('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x74b1('0x5'));var jayson=require(_0x74b1('0x6'));var client=jayson[_0x74b1('0x7')][_0x74b1('0x8')]({'port':0x232a});config[_0x74b1('0x9')]=_[_0x74b1('0xa')](config[_0x74b1('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x74b1('0xb'))(new Redis(config[_0x74b1('0x9')]));require(_0x74b1('0xc'))[_0x74b1('0xd')](socket);function respondWithRpcPromise(_0xc1952,_0x4eab15,_0x33f4bf){return new BPromise(function(_0x20bd4c,_0x57f3ad){return client[_0x74b1('0xe')](_0xc1952,_0x33f4bf)[_0x74b1('0xf')](function(_0x6434fd){logger[_0x74b1('0x10')]('MailMessage,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x4eab15,_0x74b1('0x11'),JSON[_0x74b1('0x12')](_0x6434fd));if(_0x6434fd['error']){if(_0x6434fd['error']['code']===0x1f4){logger[_0x74b1('0x13')]('MailMessage,\x20%s,\x20%s',_0x4eab15,_0x6434fd['error'][_0x74b1('0x14')]);return _0x57f3ad(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}logger[_0x74b1('0x13')](_0x74b1('0x15'),_0x4eab15,_0x6434fd[_0x74b1('0x13')]['message']);return _0x20bd4c(_0x6434fd[_0x74b1('0x13')][_0x74b1('0x14')]);}else{logger[_0x74b1('0x10')](_0x74b1('0x15'),_0x4eab15,_0x74b1('0x11'));_0x20bd4c(_0x6434fd[_0x74b1('0x16')][_0x74b1('0x14')]);}})['catch'](function(_0xd50f0){logger[_0x74b1('0x13')]('MailMessage,\x20%s,\x20%s',_0x4eab15,_0xd50f0);_0x57f3ad(_0xd50f0);});});}exports[_0x74b1('0x17')]=function(_0x38d932){var _0x39f261=this;return new Promise(function(_0x25704e,_0x13bb44){return db[_0x74b1('0x18')][_0x74b1('0x19')](_0x38d932[_0x74b1('0x1a')],{'raw':_0x38d932['options']?_0x38d932[_0x74b1('0x1b')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x481bf2){logger[_0x74b1('0x10')](_0x74b1('0x17'),_0x38d932);logger[_0x74b1('0x1c')](_0x74b1('0x17'),_0x38d932,JSON[_0x74b1('0x12')](_0x481bf2));_0x25704e(_0x481bf2);})['catch'](function(_0x3c78e5){logger['error'](_0x74b1('0x17'),_0x3c78e5[_0x74b1('0x14')],_0x38d932);_0x13bb44(_0x39f261[_0x74b1('0x13')](0x1f4,_0x3c78e5[_0x74b1('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 413834e..582e06e 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 _0x201d=['./mailMessage.events','remove','update','emit','removeListener','length'];(function(_0x2bc68a,_0x1e9ba1){var _0x5673e7=function(_0x3e0403){while(--_0x3e0403){_0x2bc68a['push'](_0x2bc68a['shift']());}};_0x5673e7(++_0x1e9ba1);}(_0x201d,0xd2));var _0xd201=function(_0x1ab2b5,_0x4a44fb){_0x1ab2b5=_0x1ab2b5-0x0;var _0x225e0d=_0x201d[_0x1ab2b5];return _0x225e0d;};'use strict';var MailMessageEvents=require(_0xd201('0x0'));var events=['save',_0xd201('0x1'),_0xd201('0x2')];function createListener(_0x488730,_0x4b2389){return function(_0x5b57b9){_0x4b2389[_0xd201('0x3')](_0x488730,_0x5b57b9);};}function removeListener(_0x2db87d,_0x59c714){return function(){MailMessageEvents[_0xd201('0x4')](_0x2db87d,_0x59c714);};}exports['register']=function(_0xb1427d){for(var _0x586714=0x0,_0x2614d4=events[_0xd201('0x5')];_0x586714<_0x2614d4;_0x586714++){var _0x2d2b3e=events[_0x586714];var _0x4e6b41=createListener('mailMessage:'+_0x2d2b3e,_0xb1427d);MailMessageEvents['on'](_0x2d2b3e,_0x4e6b41);}}; \ No newline at end of file +var _0xc15e=['remove','update','removeListener','./mailMessage.events','save'];(function(_0x4a68a1,_0x321c31){var _0x3e322d=function(_0xdba1d2){while(--_0xdba1d2){_0x4a68a1['push'](_0x4a68a1['shift']());}};_0x3e322d(++_0x321c31);}(_0xc15e,0xa8));var _0xec15=function(_0x27850c,_0x4753fd){_0x27850c=_0x27850c-0x0;var _0xd47c47=_0xc15e[_0x27850c];return _0xd47c47;};'use strict';var MailMessageEvents=require(_0xec15('0x0'));var events=[_0xec15('0x1'),_0xec15('0x2'),_0xec15('0x3')];function createListener(_0x26b818,_0x42876b){return function(_0x4f0a9d){_0x42876b['emit'](_0x26b818,_0x4f0a9d);};}function removeListener(_0x25f7d4,_0x13f9a6){return function(){MailMessageEvents[_0xec15('0x4')](_0x25f7d4,_0x13f9a6);};}exports['register']=function(_0x4726f9){for(var _0x1b31f2=0x0,_0x5e5442=events['length'];_0x1b31f2<_0x5e5442;_0x1b31f2++){var _0x423691=events[_0x1b31f2];var _0x10bfc6=createListener('mailMessage:'+_0x423691,_0x4726f9);MailMessageEvents['on'](_0x423691,_0x10bfc6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a8bb6f5..e9bc8ad 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 _0x1c0c=['removeTeams','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete'];(function(_0x55e67b,_0x57fbed){var _0x4b71c2=function(_0x2bc5ac){while(--_0x2bc5ac){_0x55e67b['push'](_0x55e67b['shift']());}};_0x4b71c2(++_0x57fbed);}(_0x1c0c,0x137));var _0xc1c0=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x1c0c[_0x2df507];return _0x1f7167;};'use strict';var multer=require('multer');var util=require(_0xc1c0('0x0'));var path=require(_0xc1c0('0x1'));var timeout=require(_0xc1c0('0x2'));var express=require('express');var router=express[_0xc1c0('0x3')]();var fs_extra=require(_0xc1c0('0x4'));var auth=require(_0xc1c0('0x5'));var interaction=require(_0xc1c0('0x6'));var config=require(_0xc1c0('0x7'));var controller=require(_0xc1c0('0x8'));router[_0xc1c0('0x9')]('/',auth[_0xc1c0('0xa')](),controller[_0xc1c0('0xb')]);router[_0xc1c0('0x9')](_0xc1c0('0xc'),auth[_0xc1c0('0xa')](),controller['describe']);router['get'](_0xc1c0('0xd'),auth[_0xc1c0('0xa')](),controller['show']);router[_0xc1c0('0x9')]('/:id/members',auth[_0xc1c0('0xa')](),controller[_0xc1c0('0xe')]);router[_0xc1c0('0x9')](_0xc1c0('0xf'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x10')]);router[_0xc1c0('0x9')](_0xc1c0('0x11'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x12')]);router[_0xc1c0('0x13')]('/',auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x14')]);router[_0xc1c0('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0xc1c0('0x15')]);router[_0xc1c0('0x13')](_0xc1c0('0x11'),auth['isAuthenticated'](),controller[_0xc1c0('0x16')]);router['put'](_0xc1c0('0xd'),auth['isAuthenticated'](),controller[_0xc1c0('0x17')]);router[_0xc1c0('0x18')]('/:id',auth[_0xc1c0('0xa')](),controller['destroy']);router['delete'](_0xc1c0('0xf'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x19')]);router[_0xc1c0('0x18')](_0xc1c0('0x11'),auth[_0xc1c0('0xa')](),controller[_0xc1c0('0x1a')]);module[_0xc1c0('0x1b')]=router; \ No newline at end of file +var _0x368f=['describe','show','/:id/members','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','/:id','delete','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x368f,0x77));var _0xf368=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x368f[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xf368('0x0'));var util=require(_0xf368('0x1'));var path=require('path');var timeout=require(_0xf368('0x2'));var express=require(_0xf368('0x3'));var router=express[_0xf368('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf368('0x5'));var interaction=require(_0xf368('0x6'));var config=require('../../config/environment');var controller=require('./mailQueue.controller');router['get']('/',auth[_0xf368('0x7')](),controller[_0xf368('0x8')]);router[_0xf368('0x9')](_0xf368('0xa'),auth['isAuthenticated'](),controller[_0xf368('0xb')]);router[_0xf368('0x9')]('/:id',auth[_0xf368('0x7')](),controller[_0xf368('0xc')]);router[_0xf368('0x9')](_0xf368('0xd'),auth['isAuthenticated'](),controller[_0xf368('0xe')]);router[_0xf368('0x9')](_0xf368('0xf'),auth[_0xf368('0x7')](),controller[_0xf368('0x10')]);router['get']('/:id/users',auth[_0xf368('0x7')](),controller[_0xf368('0x11')]);router[_0xf368('0x12')]('/',auth[_0xf368('0x7')](),controller['create']);router[_0xf368('0x12')](_0xf368('0xf'),auth[_0xf368('0x7')](),controller[_0xf368('0x13')]);router[_0xf368('0x12')](_0xf368('0x14'),auth['isAuthenticated'](),controller[_0xf368('0x15')]);router[_0xf368('0x16')](_0xf368('0x17'),auth[_0xf368('0x7')](),controller['update']);router[_0xf368('0x18')](_0xf368('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0xf368('0x18')](_0xf368('0xf'),auth[_0xf368('0x7')](),controller['removeTeams']);router[_0xf368('0x18')](_0xf368('0x14'),auth['isAuthenticated'](),controller[_0xf368('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 322cc3e..f464328 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 _0x527c=['STRING','name','ENUM','rrmemory','sequelize','exports'];(function(_0xda6ad1,_0x5f09e3){var _0xedc3a5=function(_0x5459d7){while(--_0x5459d7){_0xda6ad1['push'](_0xda6ad1['shift']());}};_0xedc3a5(++_0x5f09e3);}(_0x527c,0xe2));var _0xc527=function(_0x44976e,_0x311385){_0x44976e=_0x44976e-0x0;var _0x4852b2=_0x527c[_0x44976e];return _0x4852b2;};'use strict';var Sequelize=require(_0xc527('0x0'));module[_0xc527('0x1')]={'name':{'type':Sequelize[_0xc527('0x2')],'unique':_0xc527('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[_0xc527('0x4')](_0xc527('0x5'),'beepall','roundrobin')}}; \ No newline at end of file +var _0x6034=['ENUM','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x35c5b7,_0x513f34){var _0x114645=function(_0x590252){while(--_0x590252){_0x35c5b7['push'](_0x35c5b7['shift']());}};_0x114645(++_0x513f34);}(_0x6034,0x92));var _0x4603=function(_0x2b89bd,_0x1d0548){_0x2b89bd=_0x2b89bd-0x0;var _0x1887fa=_0x6034[_0x2b89bd];return _0x1887fa;};'use strict';var Sequelize=require(_0x4603('0x0'));module[_0x4603('0x1')]={'name':{'type':Sequelize[_0x4603('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x4603('0x2')]},'timeout':{'type':Sequelize[_0x4603('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x4603('0x4')]('rrmemory','beepall',_0x4603('0x5'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 718ecf3..eca6f9f 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 _0x969a=['where','include','findAll','rows','catch','show','model','keys','query','filters','attributes','fields','length','merge','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','describe','getMembers','findOne','UserMailQueue','intersection','nolimit','sort','MailQueueId','filter','map','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','getTeams','Team','order','hasOwnProperty','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','toString','QueryTypes','SELECT','every','TeamId','all','union','value','removeTeams','isEmpty','removeAgents','addAgents','spread','userMailQueue:remove','getAgents','pick','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','get','MailQueues','UserProfileResource','end','error','stack','name','send','index','MailQueue','rawAttributes','type','key','getOptions'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x969a,0x14d));var _0xa969=function(_0x558b7a,_0x893a98){_0x558b7a=_0x558b7a-0x0;var _0xf90999=_0x969a[_0x558b7a];return _0xf90999;};'use strict';var BPromise=require(_0xa969('0x0'));var util=require(_0xa969('0x1'));var _=require(_0xa969('0x2'));var squel=require(_0xa969('0x3'));var Redis=require(_0xa969('0x4'));var qs=require(_0xa969('0x5'));var logger=require('../../config/logger')(_0xa969('0x6'));var config=require(_0xa969('0x7'));var db=require(_0xa969('0x8'))['db'];config[_0xa969('0x9')]=_[_0xa969('0xa')](config[_0xa969('0x9')],{'host':_0xa969('0xb'),'port':0x18eb});var socket=require(_0xa969('0xc'))(new Redis(config[_0xa969('0x9')]));require('./mailQueue.socket')[_0xa969('0xd')](socket);function respondWithStatusCode(_0x263898,_0x4a8afd){_0x4a8afd=_0x4a8afd||0xcc;return function(_0x598403){if(_0x598403){return _0x263898[_0xa969('0xe')](_0x4a8afd);}return _0x263898[_0xa969('0xf')](_0x4a8afd)['end']();};}function respondWithResult(_0x1d7f95,_0x45b52a){_0x45b52a=_0x45b52a||0xc8;return function(_0x4554fb){if(_0x4554fb){return _0x1d7f95[_0xa969('0xf')](_0x45b52a)[_0xa969('0x10')](_0x4554fb);}};}function respondWithFilteredResult(_0x4d1886,_0x272493){return function(_0x5df5ac){if(_0x5df5ac){var _0x365626=typeof _0x272493[_0xa969('0x11')]===_0xa969('0x12')&&typeof _0x272493[_0xa969('0x13')]===_0xa969('0x12');var _0xc6f70d=_0x5df5ac[_0xa969('0x14')];var _0x49c5ba=_0x365626?0x0:_0x272493[_0xa969('0x11')];var _0x4d75a7=_0x365626?_0x5df5ac['count']:_0x272493[_0xa969('0x11')]+_0x272493[_0xa969('0x13')];var _0xa3250f;if(_0x4d75a7>=_0xc6f70d){_0x4d75a7=_0xc6f70d;_0xa3250f=0xc8;}else{_0xa3250f=0xce;}_0x4d1886[_0xa969('0xf')](_0xa3250f);return _0x4d1886[_0xa969('0x15')](_0xa969('0x16'),_0x49c5ba+'-'+_0x4d75a7+'/'+_0xc6f70d)[_0xa969('0x10')](_0x5df5ac);}return null;};}function saveUpdates(_0x26430d){return function(_0x51c463){if(_0x51c463){return _0x51c463[_0xa969('0x17')](_0x26430d)[_0xa969('0x18')](function(_0x4f1d3d){return _0x4f1d3d;});}return null;};}function removeEntity(_0xe2eb38){return function(_0x3f1d79){if(_0x3f1d79){return _0x3f1d79['destroy']()[_0xa969('0x18')](function(){var _0x11c0ba=_0x3f1d79[_0xa969('0x19')]({'plain':!![]});var _0x222eed=_0xa969('0x1a');return db[_0xa969('0x1b')]['destroy']({'where':{'type':_0x222eed,'resourceId':_0x11c0ba['id']}})[_0xa969('0x18')](function(){return _0x3f1d79;});})[_0xa969('0x18')](function(){_0xe2eb38[_0xa969('0xf')](0xcc)[_0xa969('0x1c')]();});}};}function handleEntityNotFound(_0x5db8f7){return function(_0xc3831a){if(!_0xc3831a){_0x5db8f7[_0xa969('0xe')](0x194);}return _0xc3831a;};}function handleError(_0x50af7d,_0x2b914d){_0x2b914d=_0x2b914d||0x1f4;return function(_0x3144f9){logger[_0xa969('0x1d')](_0x3144f9[_0xa969('0x1e')]);if(_0x3144f9[_0xa969('0x1f')]){delete _0x3144f9[_0xa969('0x1f')];}_0x50af7d[_0xa969('0xf')](_0x2b914d)[_0xa969('0x20')](_0x3144f9);};}exports[_0xa969('0x21')]=function(_0x51d9d6,_0x4e7d0f){var _0x3121c9={};var _0x393f9b={'count':0x0,'rows':[]};var _0x180c4d=_['map'](db[_0xa969('0x22')][_0xa969('0x23')],function(_0x4ce0b1){return{'name':_0x4ce0b1['fieldName'],'type':_0x4ce0b1[_0xa969('0x24')][_0xa969('0x25')]};});_0x3121c9=qs[_0xa969('0x26')](_0x180c4d,_0x51d9d6);var _0x48aa9e={'where':_0x3121c9[_0xa969('0x27')]};return db['MailQueue'][_0xa969('0x14')](_0x48aa9e)['then'](function(_0x894592){_0x393f9b[_0xa969('0x14')]=_0x894592;_0x3121c9[_0xa969('0x28')]=qs[_0xa969('0x28')](_0x51d9d6['query']);return db[_0xa969('0x22')][_0xa969('0x29')](_0x3121c9);})[_0xa969('0x18')](function(_0x42d066){_0x393f9b[_0xa969('0x2a')]=_0x42d066;return _0x393f9b;})[_0xa969('0x18')](respondWithFilteredResult(_0x4e7d0f,_0x3121c9))[_0xa969('0x2b')](handleError(_0x4e7d0f,null));};exports[_0xa969('0x2c')]=function(_0x17e131,_0x3e81d8){var _0x3de327={'raw':!![],'where':{'id':_0x17e131['params']['id']}},_0x3e64ec={};_0x3e64ec[_0xa969('0x2d')]=_[_0xa969('0x2e')](db['MailQueue']['rawAttributes']);_0x3e64ec[_0xa969('0x2f')]=_[_0xa969('0x2e')](_0x17e131[_0xa969('0x2f')]);_0x3e64ec[_0xa969('0x30')]=_['intersection'](_0x3e64ec[_0xa969('0x2d')],_0x3e64ec[_0xa969('0x2f')]);_0x3de327[_0xa969('0x31')]=_['intersection'](_0x3e64ec['model'],qs[_0xa969('0x32')](_0x17e131[_0xa969('0x2f')][_0xa969('0x32')]));_0x3de327[_0xa969('0x31')]=_0x3de327[_0xa969('0x31')][_0xa969('0x33')]?_0x3de327[_0xa969('0x31')]:_0x3e64ec[_0xa969('0x2d')];if(_0x17e131[_0xa969('0x2f')]['includeAll']){_0x3de327[_0xa969('0x28')]=[{'all':!![]}];}_0x3de327=_[_0xa969('0x34')]({},_0x3de327,_0x17e131[_0xa969('0x35')]);return db[_0xa969('0x22')][_0xa969('0x36')](_0x3de327)[_0xa969('0x18')](handleEntityNotFound(_0x3e81d8,null))['then'](respondWithResult(_0x3e81d8,null))[_0xa969('0x2b')](handleError(_0x3e81d8,null));};exports[_0xa969('0x37')]=function(_0x4a6392,_0xe4a6c7){return db[_0xa969('0x22')]['create'](_0x4a6392[_0xa969('0x38')],{})[_0xa969('0x18')](function(_0x344dd0){var _0x4c6766=_0x4a6392[_0xa969('0x39')][_0xa969('0x19')]({'plain':!![]});if(!_0x4c6766)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c6766['role']==='user'){var _0x3c2912=_0x344dd0[_0xa969('0x19')]({'plain':!![]});var _0x257a0a=_0xa969('0x1a');return db[_0xa969('0x3a')][_0xa969('0x36')]({'where':{'name':_0x257a0a,'userProfileId':_0x4c6766[_0xa969('0x3b')]},'raw':!![]})[_0xa969('0x18')](function(_0x538606){if(_0x538606&&_0x538606[_0xa969('0x3c')]===0x0){return db['UserProfileResource'][_0xa969('0x37')]({'name':_0x3c2912[_0xa969('0x1f')],'resourceId':_0x3c2912['id'],'type':_0x538606[_0xa969('0x1f')],'sectionId':_0x538606['id']},{})['then'](function(){return _0x344dd0;});}else{return _0x344dd0;}})[_0xa969('0x2b')](function(_0x46b591){logger[_0xa969('0x1d')](_0xa969('0x3d'),_0x46b591);throw _0x46b591;});}return _0x344dd0;})[_0xa969('0x18')](respondWithResult(_0xe4a6c7,0xc9))[_0xa969('0x2b')](handleError(_0xe4a6c7,null));};exports[_0xa969('0x17')]=function(_0x50ef74,_0xfa5152){if(_0x50ef74[_0xa969('0x38')]['id']){delete _0x50ef74['body']['id'];}return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x50ef74[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0xfa5152,null))[_0xa969('0x18')](saveUpdates(_0x50ef74['body'],null))[_0xa969('0x18')](respondWithResult(_0xfa5152,null))['catch'](handleError(_0xfa5152,null));};exports[_0xa969('0x3f')]=function(_0x350fee,_0x1dc8b4){return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x350fee[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x1dc8b4,null))[_0xa969('0x18')](removeEntity(_0x1dc8b4,null))[_0xa969('0x2b')](handleError(_0x1dc8b4,null));};exports[_0xa969('0x40')]=function(_0x351103,_0x8079bc){return db[_0xa969('0x22')][_0xa969('0x40')]()['then'](respondWithResult(_0x8079bc,null))[_0xa969('0x2b')](handleError(_0x8079bc,null));};exports[_0xa969('0x41')]=function(_0x4dd1a6,_0x5d0b6f){var _0x3cdd60={'raw':!![],'where':{}},_0x322050={},_0x471c19;return db[_0xa969('0x22')][_0xa969('0x42')]({'where':{'id':_0x4dd1a6['params']['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x5d0b6f,null))[_0xa969('0x18')](function(_0x3a7649){if(_0x3a7649){_0x471c19=_0x3a7649[_0xa969('0x19')]({'plain':!![]});_0x322050[_0xa969('0x2d')]=_['keys'](db[_0xa969('0x43')]['rawAttributes']);_0x322050[_0xa969('0x2f')]=_[_0xa969('0x2e')](_0x4dd1a6[_0xa969('0x2f')]);_0x322050['filters']=_['intersection'](_0x322050[_0xa969('0x2d')],_0x322050['query']);_0x3cdd60[_0xa969('0x31')]=_[_0xa969('0x44')](_0x322050[_0xa969('0x2d')],qs[_0xa969('0x32')](_0x4dd1a6['query'][_0xa969('0x32')]));_0x3cdd60[_0xa969('0x31')]=_0x3cdd60[_0xa969('0x31')][_0xa969('0x33')]?_0x3cdd60[_0xa969('0x31')]:_0x322050[_0xa969('0x2d')];if(!_0x4dd1a6[_0xa969('0x2f')]['hasOwnProperty'](_0xa969('0x45'))){_0x3cdd60[_0xa969('0x13')]=qs[_0xa969('0x13')](_0x4dd1a6[_0xa969('0x2f')][_0xa969('0x13')]);_0x3cdd60[_0xa969('0x11')]=qs['offset'](_0x4dd1a6['query']['offset']);}_0x3cdd60['order']=qs[_0xa969('0x46')](_0x4dd1a6['query'][_0xa969('0x46')]);_0x3cdd60[_0xa969('0x27')]=qs[_0xa969('0x30')](_['pick'](_0x4dd1a6['query'],_0x322050[_0xa969('0x30')]));_0x3cdd60[_0xa969('0x27')][_0xa969('0x47')]=_0x3a7649['id'];if(_0x4dd1a6[_0xa969('0x2f')][_0xa969('0x48')]){_0x3cdd60[_0xa969('0x27')]=_[_0xa969('0x34')](_0x3cdd60[_0xa969('0x27')],{'$or':_[_0xa969('0x49')](_0x3cdd60[_0xa969('0x31')],function(_0x32b73c){var _0x1f2c3f={};_0x1f2c3f[_0x32b73c]={'$like':'%'+_0x4dd1a6[_0xa969('0x2f')]['filter']+'%'};return _0x1f2c3f;})});}_0x3cdd60=_[_0xa969('0x34')]({},_0x3cdd60,_0x4dd1a6[_0xa969('0x35')]);return db[_0xa969('0x43')][_0xa969('0x29')](_0x3cdd60);}})[_0xa969('0x18')](function(_0x162be1){if(_0x162be1){return db[_0xa969('0x4a')][_0xa969('0x4b')]({'where':{'id':_[_0xa969('0x49')](_0x162be1,_0xa969('0x4c')),'role':'agent'},'attributes':['id',_0xa969('0x1f'),_0xa969('0x4d'),_0xa969('0x4e'),_0xa969('0x4f')]});}})[_0xa969('0x18')](function(_0x2a25a5){if(_0x2a25a5){return{'count':_0x2a25a5['count'],'rows':_[_0xa969('0x49')](_0x2a25a5[_0xa969('0x2a')],function(_0x457500){return{'membername':_0x457500[_0xa969('0x1f')],'UserId':_0x457500['id'],'queue_name':_0x471c19['name'],'MailQueueId':_0x471c19['id'],'interface':util[_0xa969('0x50')]('%s/%s',_0xa969('0x51'),_0x457500[_0xa969('0x1f')]),'penalty':0x0,'paused':_0x457500['mailPause'],'createdAt':_0x457500['createdAt'],'updatedAt':_0x457500[_0xa969('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa969('0x18')](respondWithFilteredResult(_0x5d0b6f,_0x3cdd60))[_0xa969('0x2b')](handleError(_0x5d0b6f,null));};exports[_0xa969('0x52')]=function(_0x441dc6,_0x10d307){var _0x2c4151={};var _0x497661={};var _0x389393;var _0x2632d8;return db[_0xa969('0x22')][_0xa969('0x42')]({'where':{'id':_0x441dc6[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x10d307,null))[_0xa969('0x18')](function(_0x4d2708){if(_0x4d2708){_0x389393=_0x4d2708;_0x497661['model']=_['keys'](db[_0xa969('0x53')][_0xa969('0x23')]);_0x497661['query']=_[_0xa969('0x2e')](_0x441dc6[_0xa969('0x2f')]);_0x497661[_0xa969('0x30')]=_['intersection'](_0x497661['model'],_0x497661[_0xa969('0x2f')]);_0x2c4151['attributes']=_[_0xa969('0x44')](_0x497661[_0xa969('0x2d')],qs[_0xa969('0x32')](_0x441dc6[_0xa969('0x2f')]['fields']));_0x2c4151[_0xa969('0x31')]=_0x2c4151[_0xa969('0x31')][_0xa969('0x33')]?_0x2c4151[_0xa969('0x31')]:_0x497661['model'];_0x2c4151[_0xa969('0x54')]=qs[_0xa969('0x46')](_0x441dc6[_0xa969('0x2f')][_0xa969('0x46')]);_0x2c4151[_0xa969('0x27')]=qs[_0xa969('0x30')](_['pick'](_0x441dc6[_0xa969('0x2f')],_0x497661[_0xa969('0x30')]));if(_0x441dc6[_0xa969('0x2f')][_0xa969('0x48')]){_0x2c4151[_0xa969('0x27')]=_[_0xa969('0x34')](_0x2c4151['where'],{'$or':_['map'](_0x2c4151[_0xa969('0x31')],function(_0x5b9bdb){var _0x2a8207={};_0x2a8207[_0x5b9bdb]={'$like':'%'+_0x441dc6['query']['filter']+'%'};return _0x2a8207;})});}_0x2c4151=_['merge']({},_0x2c4151,_0x441dc6['options']);return _0x389393[_0xa969('0x52')](_0x2c4151);}})['then'](function(_0x589eb2){if(_0x589eb2){_0x2632d8=_0x589eb2[_0xa969('0x33')];if(!_0x441dc6['query'][_0xa969('0x55')]('nolimit')){_0x2c4151[_0xa969('0x13')]=qs[_0xa969('0x13')](_0x441dc6['query'][_0xa969('0x13')]);_0x2c4151[_0xa969('0x11')]=qs['offset'](_0x441dc6[_0xa969('0x2f')][_0xa969('0x11')]);}return _0x389393[_0xa969('0x52')](_0x2c4151);}})['then'](function(_0x49b0b9){if(_0x49b0b9){return _0x49b0b9?{'count':_0x2632d8,'rows':_0x49b0b9}:null;}})[_0xa969('0x18')](respondWithResult(_0x10d307,null))['catch'](handleError(_0x10d307,null));};exports[_0xa969('0x56')]=function(_0x459bce,_0x2ed210){var _0x215c94=_0x459bce['body'][_0xa969('0x57')];return db[_0xa969('0x53')][_0xa969('0x29')]({'where':{'id':_0x215c94},'attributes':['id'],'include':[{'model':db[_0xa969('0x4a')],'as':_0xa969('0x58'),'attributes':['id','name',_0xa969('0x59'),_0xa969('0x5a'),_0xa969('0x5b')],'raw':!![]}]})[_0xa969('0x18')](function(_0x45f27b){if(_0x45f27b){var _0x46b416=_[_0xa969('0x5c')](_0x45f27b,function(_0x524e1d){var _0x34d8cc=_0x524e1d[_0xa969('0x19')]({'plain':!![]});return _0x34d8cc[_0xa969('0x58')];});return db['MailQueue']['find']({'where':{'id':_0x459bce[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](function(_0x30c4b5){return db[_0xa969('0x5d')][_0xa969('0x5e')](function(_0x23d1d8){return _0x30c4b5['addTeams'](_0x215c94,{'transaction':_0x23d1d8})['then'](function(){return BPromise[_0xa969('0x5f')](_0x46b416,function(_0x2ce597){return db[_0xa969('0x43')][_0xa969('0x60')]({'where':{'UserId':_0x2ce597['id'],'MailQueueId':_0x459bce[_0xa969('0x3e')]['id']},'transaction':_0x23d1d8});});})[_0xa969('0x18')](function(){_0x46b416[_0xa969('0x61')](function(_0x25741e){socket[_0xa969('0x62')]('userMailQueue:save',{'UserId':_0x25741e['id'],'MailQueueId':_0x30c4b5['id']});});});});});}})[_0xa969('0x18')](respondWithStatusCode(_0x2ed210,null))[_0xa969('0x2b')](handleError(_0x2ed210,null));};exports['removeTeams']=function(_0x1076b0,_0x3b0eff){return db[_0xa969('0x53')][_0xa969('0x29')]({'where':{'id':_0x1076b0['query'][_0xa969('0x57')]},'attributes':['id'],'include':[{'model':db[_0xa969('0x4a')],'as':_0xa969('0x58'),'attributes':['id'],'raw':!![]}]})[_0xa969('0x18')](handleEntityNotFound(_0x3b0eff,null))[_0xa969('0x18')](function(_0x36fef3){var _0xf77488=_[_0xa969('0x49')](_0x36fef3,'id');var _0x58376c=[];var _0x5c459a=[];var _0x430490=squel['select']();_0x430490[_0xa969('0x63')](_0xa969('0x64'))[_0xa969('0x65')](_0xa969('0x66'),'tq')[_0xa969('0x67')](_0xa969('0x68'),'ut',_0xa969('0x69'))[_0xa969('0x27')](_0xa969('0x6a'),_0x1076b0[_0xa969('0x3e')]['id']);for(var _0x119c12=0x0;_0x119c12<_0x36fef3[_0xa969('0x33')];_0x119c12+=0x1){let _0x521d7f=_0x36fef3[_0x119c12];for(var _0x2199c0=0x0;_0x2199c0<_0x521d7f[_0xa969('0x58')][_0xa969('0x33')];_0x2199c0+=0x1){let _0x33fc79=_0x521d7f[_0xa969('0x58')][_0x2199c0];var _0x5ee500=_0x430490[_0xa969('0x6b')]();_0x5ee500['where']('ut.UserId\x20=\x20?',_0x33fc79['id']);_0x5c459a['push'](db[_0xa969('0x5d')]['query'](_0x5ee500[_0xa969('0x6c')](),{'type':db[_0xa969('0x5d')][_0xa969('0x6d')][_0xa969('0x6e')]})[_0xa969('0x18')](function(_0x48567f){if(_0x48567f[_0xa969('0x33')]===0x1){return _0x33fc79['id'];}else{var _0xf24efc=_[_0xa969('0x6f')](_[_0xa969('0x49')](_0x48567f,_0xa969('0x70')),function(_0x303a60){return _['includes'](_0xf77488,_0x303a60);});if(_0xf24efc){return _0x33fc79['id'];}}}));}}return BPromise[_0xa969('0x71')](_0x5c459a)[_0xa969('0x18')](function(_0x4c95c0){_0x58376c=_(_0x58376c)[_0xa969('0x72')](_0x4c95c0)['compact']()[_0xa969('0x73')]();return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x1076b0[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](function(_0x1a3cc7){return db[_0xa969('0x5d')][_0xa969('0x5e')](function(_0x3ab1ed){return _0x1a3cc7[_0xa969('0x74')](_0x1076b0[_0xa969('0x2f')][_0xa969('0x57')],{'transaction':_0x3ab1ed})[_0xa969('0x18')](function(){if(!_[_0xa969('0x75')](_0x58376c)){return _0x1a3cc7[_0xa969('0x76')](_0x58376c,{'transaction':_0x3ab1ed});}})[_0xa969('0x18')](function(){_0x58376c[_0xa969('0x61')](function(_0x3850b6){socket[_0xa969('0x62')]('userMailQueue:remove',{'UserId':_0x3850b6,'MailQueueId':_0x1a3cc7['id']});});});});});});})[_0xa969('0x18')](respondWithStatusCode(_0x3b0eff,null))['catch'](handleError(_0x3b0eff,null));};exports[_0xa969('0x77')]=function(_0xae931a,_0x25a94e){return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0xae931a[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x25a94e,null))[_0xa969('0x18')](function(_0xcc5ec2){if(_0xcc5ec2){return _0xcc5ec2[_0xa969('0x77')](_0xae931a['body'][_0xa969('0x57')],_['omit'](_0xae931a[_0xa969('0x38')],[_0xa969('0x57'),'id'])||{})[_0xa969('0x78')](function(_0x2ec891){for(var _0x1d6118=0x0;_0x1d6118<_0xae931a[_0xa969('0x38')][_0xa969('0x57')]['length'];_0x1d6118+=0x1){socket['emit']('userMailQueue:save',{'UserId':Number(_0xae931a[_0xa969('0x38')]['ids'][_0x1d6118]),'MailQueueId':Number(_0xae931a[_0xa969('0x3e')]['id'])});}return _0x2ec891;});}})[_0xa969('0x18')](respondWithResult(_0x25a94e,null))[_0xa969('0x2b')](handleError(_0x25a94e,null));};exports[_0xa969('0x76')]=function(_0x2b51d6,_0x194b0f){return db[_0xa969('0x22')][_0xa969('0x36')]({'where':{'id':_0x2b51d6['params']['id']}})['then'](handleEntityNotFound(_0x194b0f,null))[_0xa969('0x18')](function(_0x282f66){if(_0x282f66){return _0x282f66[_0xa969('0x76')](_0x2b51d6['query'][_0xa969('0x57')])[_0xa969('0x18')](function(){if(_['isArray'](_0x2b51d6[_0xa969('0x2f')][_0xa969('0x57')])){for(var _0x723435=0x0;_0x723435<_0x2b51d6[_0xa969('0x2f')][_0xa969('0x57')][_0xa969('0x33')];_0x723435+=0x1){socket['emit'](_0xa969('0x79'),{'UserId':Number(_0x2b51d6['query']['ids'][_0x723435]),'MailQueueId':Number(_0x2b51d6[_0xa969('0x3e')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x2b51d6[_0xa969('0x2f')]['ids']),'MailQueueId':Number(_0x2b51d6[_0xa969('0x3e')]['id'])});}});}})[_0xa969('0x18')](respondWithStatusCode(_0x194b0f,null))[_0xa969('0x2b')](handleError(_0x194b0f,null));};exports[_0xa969('0x7a')]=function(_0x262722,_0x120242){var _0x342ae6={};var _0x222032={};var _0x399220;var _0x2879e0;return db[_0xa969('0x22')][_0xa969('0x42')]({'where':{'id':_0x262722[_0xa969('0x3e')]['id']}})[_0xa969('0x18')](handleEntityNotFound(_0x120242,null))[_0xa969('0x18')](function(_0x22a33c){if(_0x22a33c){_0x399220=_0x22a33c;_0x222032['model']=_['keys'](db['User']['rawAttributes']);_0x222032[_0xa969('0x2f')]=_[_0xa969('0x2e')](_0x262722[_0xa969('0x2f')]);_0x222032['filters']=_[_0xa969('0x44')](_0x222032[_0xa969('0x2d')],_0x222032[_0xa969('0x2f')]);_0x342ae6[_0xa969('0x31')]=_[_0xa969('0x44')](_0x222032[_0xa969('0x2d')],qs['fields'](_0x262722[_0xa969('0x2f')][_0xa969('0x32')]));_0x342ae6[_0xa969('0x31')]=_0x342ae6[_0xa969('0x31')][_0xa969('0x33')]?_0x342ae6['attributes']:_0x222032[_0xa969('0x2d')];_0x342ae6[_0xa969('0x54')]=qs[_0xa969('0x46')](_0x262722[_0xa969('0x2f')][_0xa969('0x46')]);_0x342ae6[_0xa969('0x27')]=qs['filters'](_[_0xa969('0x7b')](_0x262722['query'],_0x222032['filters']));if(_0x262722[_0xa969('0x2f')][_0xa969('0x48')]){_0x342ae6[_0xa969('0x27')]=_['merge'](_0x342ae6[_0xa969('0x27')],{'$or':_[_0xa969('0x49')](_0x342ae6[_0xa969('0x31')],function(_0x281a50){var _0x1d2b37={};_0x1d2b37[_0x281a50]={'$like':'%'+_0x262722[_0xa969('0x2f')][_0xa969('0x48')]+'%'};return _0x1d2b37;})});}_0x342ae6=_[_0xa969('0x34')]({},_0x342ae6,_0x262722[_0xa969('0x35')]);return _0x399220[_0xa969('0x7a')](_0x342ae6);}})[_0xa969('0x18')](function(_0x55b1f3){if(_0x55b1f3){_0x2879e0=_0x55b1f3[_0xa969('0x33')];if(!_0x262722[_0xa969('0x2f')][_0xa969('0x55')](_0xa969('0x45'))){_0x342ae6[_0xa969('0x13')]=qs[_0xa969('0x13')](_0x262722[_0xa969('0x2f')]['limit']);_0x342ae6[_0xa969('0x11')]=qs[_0xa969('0x11')](_0x262722['query'][_0xa969('0x11')]);}return _0x399220[_0xa969('0x7a')](_0x342ae6);}})['then'](function(_0x18ce50){if(_0x18ce50){return _0x18ce50?{'count':_0x2879e0,'rows':_0x18ce50}:null;}})[_0xa969('0x18')](respondWithResult(_0x120242,null))[_0xa969('0x2b')](handleError(_0x120242,null));}; \ No newline at end of file +var _0x8236=['pick','MailQueueId','filter','UserMailQueue','findAndCountAll','agent','mailPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','User','Agents','voicePause','flatMap','transaction','each','findOrCreate','removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','compact','isEmpty','forEach','emit','userMailQueue:remove','addAgents','spread','userMailQueue:save','removeAgents','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','then','get','MailQueues','UserProfileResource','destroy','error','name','send','index','map','MailQueue','rawAttributes','fieldName','getOptions','where','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','hasOwnProperty','nolimit','order','sort'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x8236,0x18f));var _0x6823=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x8236[_0x1992f1];return _0x413dfe;};'use strict';var BPromise=require(_0x6823('0x0'));var util=require('util');var _=require(_0x6823('0x1'));var squel=require('squel');var Redis=require(_0x6823('0x2'));var qs=require(_0x6823('0x3'));var logger=require(_0x6823('0x4'))('api');var config=require(_0x6823('0x5'));var db=require(_0x6823('0x6'))['db'];config[_0x6823('0x7')]=_[_0x6823('0x8')](config[_0x6823('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6823('0x7')]));require(_0x6823('0x9'))['register'](socket);function respondWithStatusCode(_0x59ee1b,_0x4963b3){_0x4963b3=_0x4963b3||0xcc;return function(_0x128af1){if(_0x128af1){return _0x59ee1b[_0x6823('0xa')](_0x4963b3);}return _0x59ee1b[_0x6823('0xb')](_0x4963b3)[_0x6823('0xc')]();};}function respondWithResult(_0x4056ed,_0x190ad4){_0x190ad4=_0x190ad4||0xc8;return function(_0x57d9e0){if(_0x57d9e0){return _0x4056ed[_0x6823('0xb')](_0x190ad4)[_0x6823('0xd')](_0x57d9e0);}};}function respondWithFilteredResult(_0x11416f,_0x429952){return function(_0x41c1a1){if(_0x41c1a1){var _0x52dd21=typeof _0x429952[_0x6823('0xe')]===_0x6823('0xf')&&typeof _0x429952['limit']==='undefined';var _0xc2ce=_0x41c1a1[_0x6823('0x10')];var _0x5afee3=_0x52dd21?0x0:_0x429952['offset'];var _0x576f07=_0x52dd21?_0x41c1a1['count']:_0x429952[_0x6823('0xe')]+_0x429952[_0x6823('0x11')];var _0x34bbd8;if(_0x576f07>=_0xc2ce){_0x576f07=_0xc2ce;_0x34bbd8=0xc8;}else{_0x34bbd8=0xce;}_0x11416f[_0x6823('0xb')](_0x34bbd8);return _0x11416f[_0x6823('0x12')](_0x6823('0x13'),_0x5afee3+'-'+_0x576f07+'/'+_0xc2ce)[_0x6823('0xd')](_0x41c1a1);}return null;};}function saveUpdates(_0x8bbdb7){return function(_0x3aa605){if(_0x3aa605){return _0x3aa605['update'](_0x8bbdb7)['then'](function(_0x3a92da){return _0x3a92da;});}return null;};}function removeEntity(_0x337ecd){return function(_0x46d052){if(_0x46d052){return _0x46d052['destroy']()[_0x6823('0x14')](function(){var _0x4640d3=_0x46d052[_0x6823('0x15')]({'plain':!![]});var _0x1a1ddf=_0x6823('0x16');return db[_0x6823('0x17')][_0x6823('0x18')]({'where':{'type':_0x1a1ddf,'resourceId':_0x4640d3['id']}})[_0x6823('0x14')](function(){return _0x46d052;});})[_0x6823('0x14')](function(){_0x337ecd[_0x6823('0xb')](0xcc)[_0x6823('0xc')]();});}};}function handleEntityNotFound(_0x6e101a){return function(_0x12601d){if(!_0x12601d){_0x6e101a['sendStatus'](0x194);}return _0x12601d;};}function handleError(_0x3ed431,_0x2336e1){_0x2336e1=_0x2336e1||0x1f4;return function(_0x3a5fc7){logger[_0x6823('0x19')](_0x3a5fc7['stack']);if(_0x3a5fc7[_0x6823('0x1a')]){delete _0x3a5fc7[_0x6823('0x1a')];}_0x3ed431[_0x6823('0xb')](_0x2336e1)[_0x6823('0x1b')](_0x3a5fc7);};}exports[_0x6823('0x1c')]=function(_0x1898eb,_0x2e3d4f){var _0x32cb6e={};var _0x21e7ae={'count':0x0,'rows':[]};var _0x14288b=_[_0x6823('0x1d')](db[_0x6823('0x1e')][_0x6823('0x1f')],function(_0x430e03){return{'name':_0x430e03[_0x6823('0x20')],'type':_0x430e03['type']['key']};});_0x32cb6e=qs[_0x6823('0x21')](_0x14288b,_0x1898eb);var _0x12b0a8={'where':_0x32cb6e[_0x6823('0x22')]};return db['MailQueue'][_0x6823('0x10')](_0x12b0a8)[_0x6823('0x14')](function(_0x43ebf7){_0x21e7ae['count']=_0x43ebf7;_0x32cb6e['include']=qs['include'](_0x1898eb[_0x6823('0x23')]);return db['MailQueue'][_0x6823('0x24')](_0x32cb6e);})[_0x6823('0x14')](function(_0x135d32){_0x21e7ae[_0x6823('0x25')]=_0x135d32;return _0x21e7ae;})[_0x6823('0x14')](respondWithFilteredResult(_0x2e3d4f,_0x32cb6e))[_0x6823('0x26')](handleError(_0x2e3d4f,null));};exports[_0x6823('0x27')]=function(_0x2e6df6,_0x55fb87){var _0x5b780d={'raw':!![],'where':{'id':_0x2e6df6[_0x6823('0x28')]['id']}},_0x40dabb={};_0x40dabb[_0x6823('0x29')]=_[_0x6823('0x2a')](db[_0x6823('0x1e')]['rawAttributes']);_0x40dabb[_0x6823('0x23')]=_[_0x6823('0x2a')](_0x2e6df6[_0x6823('0x23')]);_0x40dabb[_0x6823('0x2b')]=_[_0x6823('0x2c')](_0x40dabb[_0x6823('0x29')],_0x40dabb[_0x6823('0x23')]);_0x5b780d[_0x6823('0x2d')]=_[_0x6823('0x2c')](_0x40dabb[_0x6823('0x29')],qs['fields'](_0x2e6df6[_0x6823('0x23')][_0x6823('0x2e')]));_0x5b780d[_0x6823('0x2d')]=_0x5b780d[_0x6823('0x2d')][_0x6823('0x2f')]?_0x5b780d[_0x6823('0x2d')]:_0x40dabb[_0x6823('0x29')];if(_0x2e6df6[_0x6823('0x23')][_0x6823('0x30')]){_0x5b780d[_0x6823('0x31')]=[{'all':!![]}];}_0x5b780d=_[_0x6823('0x32')]({},_0x5b780d,_0x2e6df6[_0x6823('0x33')]);return db[_0x6823('0x1e')][_0x6823('0x34')](_0x5b780d)[_0x6823('0x14')](handleEntityNotFound(_0x55fb87,null))['then'](respondWithResult(_0x55fb87,null))[_0x6823('0x26')](handleError(_0x55fb87,null));};exports[_0x6823('0x35')]=function(_0x35bbfe,_0x248c0){return db[_0x6823('0x1e')][_0x6823('0x35')](_0x35bbfe[_0x6823('0x36')],{})[_0x6823('0x14')](function(_0x3427fd){var _0x38fc9d=_0x35bbfe[_0x6823('0x37')][_0x6823('0x15')]({'plain':!![]});if(!_0x38fc9d)throw new Error(_0x6823('0x38'));if(_0x38fc9d[_0x6823('0x39')]===_0x6823('0x37')){var _0x3cb1d6=_0x3427fd[_0x6823('0x15')]({'plain':!![]});var _0xbbe60b=_0x6823('0x16');return db[_0x6823('0x3a')][_0x6823('0x34')]({'where':{'name':_0xbbe60b,'userProfileId':_0x38fc9d['userProfileId']},'raw':!![]})[_0x6823('0x14')](function(_0x56d7de){if(_0x56d7de&&_0x56d7de[_0x6823('0x3b')]===0x0){return db[_0x6823('0x17')][_0x6823('0x35')]({'name':_0x3cb1d6['name'],'resourceId':_0x3cb1d6['id'],'type':_0x56d7de[_0x6823('0x1a')],'sectionId':_0x56d7de['id']},{})['then'](function(){return _0x3427fd;});}else{return _0x3427fd;}})['catch'](function(_0x4ae570){logger[_0x6823('0x19')](_0x6823('0x3c'),_0x4ae570);throw _0x4ae570;});}return _0x3427fd;})[_0x6823('0x14')](respondWithResult(_0x248c0,0xc9))['catch'](handleError(_0x248c0,null));};exports[_0x6823('0x3d')]=function(_0x1c2295,_0x3c50cf){if(_0x1c2295[_0x6823('0x36')]['id']){delete _0x1c2295['body']['id'];}return db[_0x6823('0x1e')][_0x6823('0x34')]({'where':{'id':_0x1c2295[_0x6823('0x28')]['id']}})['then'](handleEntityNotFound(_0x3c50cf,null))[_0x6823('0x14')](saveUpdates(_0x1c2295[_0x6823('0x36')],null))[_0x6823('0x14')](respondWithResult(_0x3c50cf,null))[_0x6823('0x26')](handleError(_0x3c50cf,null));};exports['destroy']=function(_0x4d4bd3,_0x28589e){return db['MailQueue'][_0x6823('0x34')]({'where':{'id':_0x4d4bd3[_0x6823('0x28')]['id']}})[_0x6823('0x14')](handleEntityNotFound(_0x28589e,null))['then'](removeEntity(_0x28589e,null))[_0x6823('0x26')](handleError(_0x28589e,null));};exports[_0x6823('0x3e')]=function(_0x5d16fa,_0x50d907){return db[_0x6823('0x1e')]['describe']()[_0x6823('0x14')](respondWithResult(_0x50d907,null))[_0x6823('0x26')](handleError(_0x50d907,null));};exports[_0x6823('0x3f')]=function(_0x3576ca,_0x5a22d3){var _0x2f4693={'raw':!![],'where':{}},_0x8c579b={},_0x41486f;return db[_0x6823('0x1e')][_0x6823('0x40')]({'where':{'id':_0x3576ca['params']['id']}})[_0x6823('0x14')](handleEntityNotFound(_0x5a22d3,null))[_0x6823('0x14')](function(_0x3ee718){if(_0x3ee718){_0x41486f=_0x3ee718[_0x6823('0x15')]({'plain':!![]});_0x8c579b[_0x6823('0x29')]=_[_0x6823('0x2a')](db['UserMailQueue'][_0x6823('0x1f')]);_0x8c579b['query']=_['keys'](_0x3576ca[_0x6823('0x23')]);_0x8c579b[_0x6823('0x2b')]=_[_0x6823('0x2c')](_0x8c579b[_0x6823('0x29')],_0x8c579b[_0x6823('0x23')]);_0x2f4693[_0x6823('0x2d')]=_[_0x6823('0x2c')](_0x8c579b[_0x6823('0x29')],qs['fields'](_0x3576ca['query'][_0x6823('0x2e')]));_0x2f4693['attributes']=_0x2f4693[_0x6823('0x2d')][_0x6823('0x2f')]?_0x2f4693[_0x6823('0x2d')]:_0x8c579b['model'];if(!_0x3576ca['query'][_0x6823('0x41')](_0x6823('0x42'))){_0x2f4693[_0x6823('0x11')]=qs[_0x6823('0x11')](_0x3576ca[_0x6823('0x23')][_0x6823('0x11')]);_0x2f4693[_0x6823('0xe')]=qs['offset'](_0x3576ca['query'][_0x6823('0xe')]);}_0x2f4693[_0x6823('0x43')]=qs[_0x6823('0x44')](_0x3576ca[_0x6823('0x23')][_0x6823('0x44')]);_0x2f4693[_0x6823('0x22')]=qs[_0x6823('0x2b')](_[_0x6823('0x45')](_0x3576ca[_0x6823('0x23')],_0x8c579b[_0x6823('0x2b')]));_0x2f4693[_0x6823('0x22')][_0x6823('0x46')]=_0x3ee718['id'];if(_0x3576ca['query']['filter']){_0x2f4693[_0x6823('0x22')]=_[_0x6823('0x32')](_0x2f4693[_0x6823('0x22')],{'$or':_['map'](_0x2f4693[_0x6823('0x2d')],function(_0x41397e){var _0x725a9a={};_0x725a9a[_0x41397e]={'$like':'%'+_0x3576ca['query'][_0x6823('0x47')]+'%'};return _0x725a9a;})});}_0x2f4693=_[_0x6823('0x32')]({},_0x2f4693,_0x3576ca[_0x6823('0x33')]);return db[_0x6823('0x48')][_0x6823('0x24')](_0x2f4693);}})[_0x6823('0x14')](function(_0x3ed5d7){if(_0x3ed5d7){return db['User'][_0x6823('0x49')]({'where':{'id':_['map'](_0x3ed5d7,'UserId'),'role':_0x6823('0x4a')},'attributes':['id',_0x6823('0x1a'),_0x6823('0x4b'),_0x6823('0x4c'),_0x6823('0x4d')]});}})['then'](function(_0x455dfd){if(_0x455dfd){return{'count':_0x455dfd[_0x6823('0x10')],'rows':_[_0x6823('0x1d')](_0x455dfd['rows'],function(_0x5417fd){return{'membername':_0x5417fd[_0x6823('0x1a')],'UserId':_0x5417fd['id'],'queue_name':_0x41486f[_0x6823('0x1a')],'MailQueueId':_0x41486f['id'],'interface':util['format'](_0x6823('0x4e'),'SIP',_0x5417fd[_0x6823('0x1a')]),'penalty':0x0,'paused':_0x5417fd[_0x6823('0x4b')],'createdAt':_0x5417fd['createdAt'],'updatedAt':_0x5417fd[_0x6823('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6823('0x14')](respondWithFilteredResult(_0x5a22d3,_0x2f4693))[_0x6823('0x26')](handleError(_0x5a22d3,null));};exports[_0x6823('0x4f')]=function(_0x304abb,_0x3a34c6){var _0x53ccb0={};var _0x4985cb={};var _0x402686;var _0x2c274a;return db[_0x6823('0x1e')]['findOne']({'where':{'id':_0x304abb[_0x6823('0x28')]['id']}})[_0x6823('0x14')](handleEntityNotFound(_0x3a34c6,null))[_0x6823('0x14')](function(_0x326af3){if(_0x326af3){_0x402686=_0x326af3;_0x4985cb[_0x6823('0x29')]=_[_0x6823('0x2a')](db[_0x6823('0x50')][_0x6823('0x1f')]);_0x4985cb[_0x6823('0x23')]=_[_0x6823('0x2a')](_0x304abb[_0x6823('0x23')]);_0x4985cb[_0x6823('0x2b')]=_[_0x6823('0x2c')](_0x4985cb[_0x6823('0x29')],_0x4985cb[_0x6823('0x23')]);_0x53ccb0[_0x6823('0x2d')]=_['intersection'](_0x4985cb['model'],qs['fields'](_0x304abb['query'][_0x6823('0x2e')]));_0x53ccb0[_0x6823('0x2d')]=_0x53ccb0[_0x6823('0x2d')][_0x6823('0x2f')]?_0x53ccb0[_0x6823('0x2d')]:_0x4985cb[_0x6823('0x29')];_0x53ccb0[_0x6823('0x43')]=qs[_0x6823('0x44')](_0x304abb[_0x6823('0x23')][_0x6823('0x44')]);_0x53ccb0[_0x6823('0x22')]=qs['filters'](_[_0x6823('0x45')](_0x304abb['query'],_0x4985cb[_0x6823('0x2b')]));if(_0x304abb['query'][_0x6823('0x47')]){_0x53ccb0[_0x6823('0x22')]=_[_0x6823('0x32')](_0x53ccb0[_0x6823('0x22')],{'$or':_[_0x6823('0x1d')](_0x53ccb0[_0x6823('0x2d')],function(_0x1c4866){var _0xf16c79={};_0xf16c79[_0x1c4866]={'$like':'%'+_0x304abb[_0x6823('0x23')][_0x6823('0x47')]+'%'};return _0xf16c79;})});}_0x53ccb0=_['merge']({},_0x53ccb0,_0x304abb['options']);return _0x402686[_0x6823('0x4f')](_0x53ccb0);}})['then'](function(_0x1983e0){if(_0x1983e0){_0x2c274a=_0x1983e0[_0x6823('0x2f')];if(!_0x304abb[_0x6823('0x23')][_0x6823('0x41')](_0x6823('0x42'))){_0x53ccb0[_0x6823('0x11')]=qs[_0x6823('0x11')](_0x304abb['query'][_0x6823('0x11')]);_0x53ccb0['offset']=qs[_0x6823('0xe')](_0x304abb[_0x6823('0x23')][_0x6823('0xe')]);}return _0x402686['getTeams'](_0x53ccb0);}})['then'](function(_0x2cdd9f){if(_0x2cdd9f){return _0x2cdd9f?{'count':_0x2c274a,'rows':_0x2cdd9f}:null;}})['then'](respondWithResult(_0x3a34c6,null))['catch'](handleError(_0x3a34c6,null));};exports[_0x6823('0x51')]=function(_0x166ce9,_0x135c08){var _0x5c1e49=_0x166ce9[_0x6823('0x36')][_0x6823('0x52')];return db[_0x6823('0x50')][_0x6823('0x24')]({'where':{'id':_0x5c1e49},'attributes':['id'],'include':[{'model':db[_0x6823('0x53')],'as':_0x6823('0x54'),'attributes':['id',_0x6823('0x1a'),'online',_0x6823('0x55'),'interface'],'raw':!![]}]})[_0x6823('0x14')](function(_0x1fec1e){if(_0x1fec1e){var _0xc84542=_[_0x6823('0x56')](_0x1fec1e,function(_0x2ae854){var _0x13d9c3=_0x2ae854['get']({'plain':!![]});return _0x13d9c3[_0x6823('0x54')];});return db[_0x6823('0x1e')]['find']({'where':{'id':_0x166ce9[_0x6823('0x28')]['id']}})[_0x6823('0x14')](function(_0x15ba31){return db['sequelize'][_0x6823('0x57')](function(_0x156411){return _0x15ba31[_0x6823('0x51')](_0x5c1e49,{'transaction':_0x156411})[_0x6823('0x14')](function(){return BPromise[_0x6823('0x58')](_0xc84542,function(_0x443f72){return db[_0x6823('0x48')][_0x6823('0x59')]({'where':{'UserId':_0x443f72['id'],'MailQueueId':_0x166ce9[_0x6823('0x28')]['id']},'transaction':_0x156411});});})[_0x6823('0x14')](function(){_0xc84542['forEach'](function(_0x1f6c1a){socket['emit']('userMailQueue:save',{'UserId':_0x1f6c1a['id'],'MailQueueId':_0x15ba31['id']});});});});});}})[_0x6823('0x14')](respondWithStatusCode(_0x135c08,null))[_0x6823('0x26')](handleError(_0x135c08,null));};exports[_0x6823('0x5a')]=function(_0x81521c,_0x21affb){return db['Team'][_0x6823('0x24')]({'where':{'id':_0x81521c['query'][_0x6823('0x52')]},'attributes':['id'],'include':[{'model':db[_0x6823('0x53')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x6823('0x14')](handleEntityNotFound(_0x21affb,null))['then'](function(_0x416a18){var _0x3ef26d=_[_0x6823('0x1d')](_0x416a18,'id');var _0x18806f=[];var _0x2d79db=[];var _0x139ac8=squel[_0x6823('0x5b')]();_0x139ac8['field'](_0x6823('0x5c'))[_0x6823('0x5d')](_0x6823('0x5e'),'tq')[_0x6823('0x5f')]('user_has_teams','ut',_0x6823('0x60'))[_0x6823('0x22')]('MailQueueId\x20=\x20?',_0x81521c[_0x6823('0x28')]['id']);for(var _0x3f5a21=0x0;_0x3f5a21<_0x416a18[_0x6823('0x2f')];_0x3f5a21+=0x1){let _0x287657=_0x416a18[_0x3f5a21];for(var _0x2e4f13=0x0;_0x2e4f13<_0x287657[_0x6823('0x54')][_0x6823('0x2f')];_0x2e4f13+=0x1){let _0x98c5ef=_0x287657[_0x6823('0x54')][_0x2e4f13];var _0x5dae58=_0x139ac8[_0x6823('0x61')]();_0x5dae58[_0x6823('0x22')]('ut.UserId\x20=\x20?',_0x98c5ef['id']);_0x2d79db['push'](db['sequelize'][_0x6823('0x23')](_0x5dae58[_0x6823('0x62')](),{'type':db[_0x6823('0x63')][_0x6823('0x64')][_0x6823('0x65')]})[_0x6823('0x14')](function(_0x54afe8){if(_0x54afe8[_0x6823('0x2f')]===0x1){return _0x98c5ef['id'];}else{var _0x27a9a2=_[_0x6823('0x66')](_[_0x6823('0x1d')](_0x54afe8,_0x6823('0x67')),function(_0x581871){return _[_0x6823('0x68')](_0x3ef26d,_0x581871);});if(_0x27a9a2){return _0x98c5ef['id'];}}}));}}return BPromise[_0x6823('0x69')](_0x2d79db)[_0x6823('0x14')](function(_0x3be06b){_0x18806f=_(_0x18806f)['union'](_0x3be06b)[_0x6823('0x6a')]()['value']();return db[_0x6823('0x1e')][_0x6823('0x34')]({'where':{'id':_0x81521c[_0x6823('0x28')]['id']}})[_0x6823('0x14')](function(_0x4e5fae){return db[_0x6823('0x63')][_0x6823('0x57')](function(_0x5b42c5){return _0x4e5fae[_0x6823('0x5a')](_0x81521c[_0x6823('0x23')][_0x6823('0x52')],{'transaction':_0x5b42c5})['then'](function(){if(!_[_0x6823('0x6b')](_0x18806f)){return _0x4e5fae['removeAgents'](_0x18806f,{'transaction':_0x5b42c5});}})[_0x6823('0x14')](function(){_0x18806f[_0x6823('0x6c')](function(_0x2f21be){socket[_0x6823('0x6d')](_0x6823('0x6e'),{'UserId':_0x2f21be,'MailQueueId':_0x4e5fae['id']});});});});});});})['then'](respondWithStatusCode(_0x21affb,null))[_0x6823('0x26')](handleError(_0x21affb,null));};exports[_0x6823('0x6f')]=function(_0x388722,_0x40bc04){return db[_0x6823('0x1e')][_0x6823('0x34')]({'where':{'id':_0x388722[_0x6823('0x28')]['id']}})[_0x6823('0x14')](handleEntityNotFound(_0x40bc04,null))[_0x6823('0x14')](function(_0x171b2c){if(_0x171b2c){return _0x171b2c[_0x6823('0x6f')](_0x388722[_0x6823('0x36')][_0x6823('0x52')],_['omit'](_0x388722['body'],[_0x6823('0x52'),'id'])||{})[_0x6823('0x70')](function(_0x109778){for(var _0x531888=0x0;_0x531888<_0x388722[_0x6823('0x36')]['ids'][_0x6823('0x2f')];_0x531888+=0x1){socket[_0x6823('0x6d')](_0x6823('0x71'),{'UserId':Number(_0x388722[_0x6823('0x36')]['ids'][_0x531888]),'MailQueueId':Number(_0x388722['params']['id'])});}return _0x109778;});}})[_0x6823('0x14')](respondWithResult(_0x40bc04,null))[_0x6823('0x26')](handleError(_0x40bc04,null));};exports[_0x6823('0x72')]=function(_0x4d9819,_0xc64b8c){return db[_0x6823('0x1e')][_0x6823('0x34')]({'where':{'id':_0x4d9819[_0x6823('0x28')]['id']}})['then'](handleEntityNotFound(_0xc64b8c,null))[_0x6823('0x14')](function(_0x455c49){if(_0x455c49){return _0x455c49[_0x6823('0x72')](_0x4d9819['query']['ids'])[_0x6823('0x14')](function(){if(_[_0x6823('0x73')](_0x4d9819[_0x6823('0x23')][_0x6823('0x52')])){for(var _0x54643c=0x0;_0x54643c<_0x4d9819['query'][_0x6823('0x52')][_0x6823('0x2f')];_0x54643c+=0x1){socket[_0x6823('0x6d')](_0x6823('0x6e'),{'UserId':Number(_0x4d9819[_0x6823('0x23')][_0x6823('0x52')][_0x54643c]),'MailQueueId':Number(_0x4d9819[_0x6823('0x28')]['id'])});}}else{socket[_0x6823('0x6d')](_0x6823('0x6e'),{'UserId':Number(_0x4d9819['query'][_0x6823('0x52')]),'MailQueueId':Number(_0x4d9819['params']['id'])});}});}})[_0x6823('0x14')](respondWithStatusCode(_0xc64b8c,null))[_0x6823('0x26')](handleError(_0xc64b8c,null));};exports[_0x6823('0x74')]=function(_0x4f9017,_0x251982){var _0x2419cd={};var _0x5e7a5e={};var _0x21bde7;var _0x2b10f9;return db['MailQueue'][_0x6823('0x40')]({'where':{'id':_0x4f9017[_0x6823('0x28')]['id']}})['then'](handleEntityNotFound(_0x251982,null))[_0x6823('0x14')](function(_0x45f7ed){if(_0x45f7ed){_0x21bde7=_0x45f7ed;_0x5e7a5e[_0x6823('0x29')]=_[_0x6823('0x2a')](db[_0x6823('0x53')][_0x6823('0x1f')]);_0x5e7a5e[_0x6823('0x23')]=_[_0x6823('0x2a')](_0x4f9017[_0x6823('0x23')]);_0x5e7a5e[_0x6823('0x2b')]=_['intersection'](_0x5e7a5e[_0x6823('0x29')],_0x5e7a5e['query']);_0x2419cd['attributes']=_[_0x6823('0x2c')](_0x5e7a5e[_0x6823('0x29')],qs['fields'](_0x4f9017['query']['fields']));_0x2419cd[_0x6823('0x2d')]=_0x2419cd[_0x6823('0x2d')][_0x6823('0x2f')]?_0x2419cd['attributes']:_0x5e7a5e['model'];_0x2419cd['order']=qs['sort'](_0x4f9017[_0x6823('0x23')][_0x6823('0x44')]);_0x2419cd[_0x6823('0x22')]=qs[_0x6823('0x2b')](_['pick'](_0x4f9017[_0x6823('0x23')],_0x5e7a5e[_0x6823('0x2b')]));if(_0x4f9017[_0x6823('0x23')][_0x6823('0x47')]){_0x2419cd[_0x6823('0x22')]=_[_0x6823('0x32')](_0x2419cd[_0x6823('0x22')],{'$or':_['map'](_0x2419cd[_0x6823('0x2d')],function(_0x2d98d7){var _0xbb160={};_0xbb160[_0x2d98d7]={'$like':'%'+_0x4f9017[_0x6823('0x23')]['filter']+'%'};return _0xbb160;})});}_0x2419cd=_[_0x6823('0x32')]({},_0x2419cd,_0x4f9017[_0x6823('0x33')]);return _0x21bde7[_0x6823('0x74')](_0x2419cd);}})[_0x6823('0x14')](function(_0x16a174){if(_0x16a174){_0x2b10f9=_0x16a174['length'];if(!_0x4f9017[_0x6823('0x23')][_0x6823('0x41')](_0x6823('0x42'))){_0x2419cd['limit']=qs[_0x6823('0x11')](_0x4f9017[_0x6823('0x23')][_0x6823('0x11')]);_0x2419cd['offset']=qs['offset'](_0x4f9017[_0x6823('0x23')][_0x6823('0xe')]);}return _0x21bde7[_0x6823('0x74')](_0x2419cd);}})[_0x6823('0x14')](function(_0x58e4d4){if(_0x58e4d4){return _0x58e4d4?{'count':_0x2b10f9,'rows':_0x58e4d4}:null;}})[_0x6823('0x14')](respondWithResult(_0x251982,null))[_0x6823('0x26')](handleError(_0x251982,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 63e28e6..56f7372 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 _0x1fe0=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0x4b91c4,_0x23f35f){var _0x25cb80=function(_0x48e283){while(--_0x48e283){_0x4b91c4['push'](_0x4b91c4['shift']());}};_0x25cb80(++_0x23f35f);}(_0x1fe0,0x1d3));var _0x01fe=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x1fe0[_0x4c445a];return _0x2f611c;};'use strict';var EventEmitter=require(_0x01fe('0x0'));var MailQueue=require(_0x01fe('0x1'))['db']['MailQueue'];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x01fe('0x2')](0x0);var events={'afterCreate':_0x01fe('0x3'),'afterUpdate':_0x01fe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1d75f5){return function(_0x339094,_0x1dc39a,_0xf52bc7){MailQueueEvents['emit'](_0x1d75f5+':'+_0x339094['id'],_0x339094);MailQueueEvents['emit'](_0x1d75f5,_0x339094);_0xf52bc7(null);};}for(var e in events){if(events[_0x01fe('0x5')](e)){var event=events[e];MailQueue[_0x01fe('0x6')](e,emitEvent(event));}}module[_0x01fe('0x7')]=MailQueueEvents; \ No newline at end of file +var _0x785f=['MailQueue','save','remove','emit','hasOwnProperty','exports'];(function(_0x1a9dac,_0x20228c){var _0x1a27a7=function(_0x3de87c){while(--_0x3de87c){_0x1a9dac['push'](_0x1a9dac['shift']());}};_0x1a27a7(++_0x20228c);}(_0x785f,0x1b6));var _0xf785=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x785f[_0x279d37];return _0x530173;};'use strict';var EventEmitter=require('events');var MailQueue=require('../../mysqldb')['db'][_0xf785('0x0')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf785('0x1'),'afterUpdate':'update','afterDestroy':_0xf785('0x2')};function emitEvent(_0x262e78){return function(_0x3fd7ac,_0x26be54,_0x2d03a5){MailQueueEvents[_0xf785('0x3')](_0x262e78+':'+_0x3fd7ac['id'],_0x3fd7ac);MailQueueEvents[_0xf785('0x3')](_0x262e78,_0x3fd7ac);_0x2d03a5(null);};}for(var e in events){if(events[_0xf785('0x4')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xf785('0x5')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 0ec3e6a..f1a4e49 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 _0xb048=['moment','bluebird','request-promise','path','../../config/environment','exports','define','MailQueue','util','../../config/logger','api'];(function(_0x3c78e7,_0x19a615){var _0x46c763=function(_0x5484a1){while(--_0x5484a1){_0x3c78e7['push'](_0x3c78e7['shift']());}};_0x46c763(++_0x19a615);}(_0xb048,0x152));var _0x8b04=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb048[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x8b04('0x0'));var logger=require(_0x8b04('0x1'))(_0x8b04('0x2'));var moment=require(_0x8b04('0x3'));var BPromise=require(_0x8b04('0x4'));var rp=require(_0x8b04('0x5'));var fs=require('fs');var path=require(_0x8b04('0x6'));var rimraf=require('rimraf');var config=require(_0x8b04('0x7'));var attributes=require('./mailQueue.attributes');module[_0x8b04('0x8')]=function(_0x2073b4,_0x1e5f63){return _0x2073b4[_0x8b04('0x9')](_0x8b04('0xa'),attributes,{'tableName':'mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb7=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0xe92706,_0x393edb){var _0x53d1f4=function(_0x3ed9b3){while(--_0x3ed9b3){_0xe92706['push'](_0xe92706['shift']());}};_0x53d1f4(++_0x393edb);}(_0x8fb7,0x172));var _0x78fb=function(_0x1f55c4,_0x5ee526){_0x1f55c4=_0x1f55c4-0x0;var _0x5ec78a=_0x8fb7[_0x1f55c4];return _0x5ec78a;};'use strict';var _=require(_0x78fb('0x0'));var util=require(_0x78fb('0x1'));var logger=require('../../config/logger')(_0x78fb('0x2'));var moment=require(_0x78fb('0x3'));var BPromise=require(_0x78fb('0x4'));var rp=require(_0x78fb('0x5'));var fs=require('fs');var path=require(_0x78fb('0x6'));var rimraf=require('rimraf');var config=require(_0x78fb('0x7'));var attributes=require(_0x78fb('0x8'));module[_0x78fb('0x9')]=function(_0x4b87bc,_0x2635c7){return _0x4b87bc[_0x78fb('0xa')](_0x78fb('0xb'),attributes,{'tableName':_0x78fb('0xc'),'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 64758f0..27e6020 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 _0xd136=['../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailQueue.socket','register','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','find','ShowMailQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x30de33,_0x1ad09d){var _0x37d532=function(_0xb09f98){while(--_0xb09f98){_0x30de33['push'](_0x30de33['shift']());}};_0x37d532(++_0x1ad09d);}(_0xd136,0x94));var _0x6d13=function(_0x15e7ff,_0x13c3bc){_0x15e7ff=_0x15e7ff-0x0;var _0x7d2345=_0xd136[_0x15e7ff];return _0x7d2345;};'use strict';var _=require('lodash');var util=require(_0x6d13('0x0'));var moment=require(_0x6d13('0x1'));var BPromise=require('bluebird');var rs=require(_0x6d13('0x2'));var fs=require('fs');var Redis=require(_0x6d13('0x3'));var db=require(_0x6d13('0x4'))['db'];var utils=require(_0x6d13('0x5'));var logger=require(_0x6d13('0x6'))(_0x6d13('0x7'));var config=require(_0x6d13('0x8'));var jayson=require(_0x6d13('0x9'));var client=jayson[_0x6d13('0xa')]['http']({'port':0x232a});config[_0x6d13('0xb')]=_[_0x6d13('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6d13('0xd'))(new Redis(config[_0x6d13('0xb')]));require(_0x6d13('0xe'))[_0x6d13('0xf')](socket);function respondWithRpcPromise(_0x5c8282,_0x4f494b,_0x1a3613){return new BPromise(function(_0x600fa9,_0x1cf1e1){return client['request'](_0x5c8282,_0x1a3613)['then'](function(_0x1c4992){logger[_0x6d13('0x10')](_0x6d13('0x11'),_0x4f494b,'request\x20sent');logger[_0x6d13('0x12')](_0x6d13('0x13'),_0x4f494b,_0x6d13('0x14'),JSON[_0x6d13('0x15')](_0x1c4992));if(_0x1c4992['error']){if(_0x1c4992['error']['code']===0x1f4){logger[_0x6d13('0x16')](_0x6d13('0x11'),_0x4f494b,_0x1c4992[_0x6d13('0x16')][_0x6d13('0x17')]);return _0x1cf1e1(_0x1c4992[_0x6d13('0x16')]['message']);}logger[_0x6d13('0x16')](_0x6d13('0x11'),_0x4f494b,_0x1c4992[_0x6d13('0x16')][_0x6d13('0x17')]);return _0x600fa9(_0x1c4992[_0x6d13('0x16')][_0x6d13('0x17')]);}else{logger[_0x6d13('0x10')](_0x6d13('0x11'),_0x4f494b,_0x6d13('0x14'));_0x600fa9(_0x1c4992['result'][_0x6d13('0x17')]);}})[_0x6d13('0x18')](function(_0x78eef7){logger[_0x6d13('0x16')](_0x6d13('0x11'),_0x4f494b,_0x78eef7);_0x1cf1e1(_0x78eef7);});});}exports[_0x6d13('0x19')]=function(_0x1daeb2){var _0x9f04de=this;return new Promise(function(_0x40ca19,_0x427bb8){return db[_0x6d13('0x1a')][_0x6d13('0x1b')]({'raw':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x1d')]===undefined?!![]:![]:!![],'where':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2['options'][_0x6d13('0x1e')]||null:null,'attributes':_0x1daeb2['options']?_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x1f')]||null:null,'limit':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2['options'][_0x6d13('0x20')]||null:null,'include':_0x1daeb2[_0x6d13('0x1c')]?_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x21')]?_[_0x6d13('0x22')](_0x1daeb2[_0x6d13('0x1c')][_0x6d13('0x21')],function(_0x821eea){return{'model':db[_0x821eea['model']],'as':_0x821eea['as'],'attributes':_0x821eea[_0x6d13('0x1f')],'include':_0x821eea['include']?_['map'](_0x821eea[_0x6d13('0x21')],function(_0x588c40){return{'model':db[_0x588c40[_0x6d13('0x23')]],'as':_0x588c40['as'],'attributes':_0x588c40[_0x6d13('0x1f')],'include':_0x588c40[_0x6d13('0x21')]?_['map'](_0x588c40[_0x6d13('0x21')],function(_0xd469b6){return{'model':db[_0xd469b6['model']],'as':_0xd469b6['as'],'attributes':_0xd469b6[_0x6d13('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6d13('0x24')](function(_0xb82395){logger[_0x6d13('0x10')](_0x6d13('0x19'),_0x1daeb2);logger[_0x6d13('0x12')](_0x6d13('0x19'),_0x1daeb2,JSON[_0x6d13('0x15')](_0xb82395));_0x40ca19(_0xb82395);})['catch'](function(_0x3857f9){logger[_0x6d13('0x16')]('GetMailQueue',_0x3857f9[_0x6d13('0x17')],_0x1daeb2);_0x427bb8(_0x9f04de[_0x6d13('0x16')](0x1f4,_0x3857f9[_0x6d13('0x17')]));});});};exports['ShowMailQueue']=function(_0xc5f9ef){var _0x42b8ed=this;return new Promise(function(_0x2fd8b1,_0xc8435e){return db[_0x6d13('0x1a')][_0x6d13('0x25')]({'raw':_0xc5f9ef[_0x6d13('0x1c')]?_0xc5f9ef['options'][_0x6d13('0x1d')]===undefined?!![]:![]:!![],'where':_0xc5f9ef['options']?_0xc5f9ef[_0x6d13('0x1c')][_0x6d13('0x1e')]||null:null,'attributes':_0xc5f9ef[_0x6d13('0x1c')]?_0xc5f9ef[_0x6d13('0x1c')][_0x6d13('0x1f')]||null:null,'include':_0xc5f9ef[_0x6d13('0x1c')]?_0xc5f9ef['options']['include']?_[_0x6d13('0x22')](_0xc5f9ef[_0x6d13('0x1c')][_0x6d13('0x21')],function(_0x29aa5a){return{'model':db[_0x29aa5a[_0x6d13('0x23')]],'as':_0x29aa5a['as'],'attributes':_0x29aa5a[_0x6d13('0x1f')],'include':_0x29aa5a['include']?_[_0x6d13('0x22')](_0x29aa5a[_0x6d13('0x21')],function(_0x2f348e){return{'model':db[_0x2f348e[_0x6d13('0x23')]],'as':_0x2f348e['as'],'attributes':_0x2f348e[_0x6d13('0x1f')],'include':_0x2f348e[_0x6d13('0x21')]?_[_0x6d13('0x22')](_0x2f348e[_0x6d13('0x21')],function(_0x3cdff2){return{'model':db[_0x3cdff2[_0x6d13('0x23')]],'as':_0x3cdff2['as'],'attributes':_0x3cdff2['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x452e69){logger['info']('ShowMailQueue',_0xc5f9ef);logger[_0x6d13('0x12')](_0x6d13('0x26'),_0xc5f9ef,JSON[_0x6d13('0x15')](_0x452e69));_0x2fd8b1(_0x452e69);})['catch'](function(_0x598a16){logger[_0x6d13('0x16')](_0x6d13('0x26'),_0x598a16['message'],_0xc5f9ef);_0xc8435e(_0x42b8ed[_0x6d13('0x16')](0x1f4,_0x598a16['message']));});});}; \ No newline at end of file +var _0xfcbf=['./mailQueue.socket','register','request','then','info','debug','request\x20sent','stringify','error','message','MailQueue,\x20%s,\x20%s','result','catch','GetMailQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowMailQueue','MailQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x37da31,_0x30199e){var _0x1924dd=function(_0x65a648){while(--_0x65a648){_0x37da31['push'](_0x37da31['shift']());}};_0x1924dd(++_0x30199e);}(_0xfcbf,0x1d1));var _0xffcb=function(_0x3f1027,_0x20a04b){_0x3f1027=_0x3f1027-0x0;var _0x275d18=_0xfcbf[_0x3f1027];return _0x275d18;};'use strict';var _=require(_0xffcb('0x0'));var util=require(_0xffcb('0x1'));var moment=require(_0xffcb('0x2'));var BPromise=require(_0xffcb('0x3'));var rs=require(_0xffcb('0x4'));var fs=require('fs');var Redis=require(_0xffcb('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xffcb('0x6'))(_0xffcb('0x7'));var config=require(_0xffcb('0x8'));var jayson=require(_0xffcb('0x9'));var client=jayson[_0xffcb('0xa')]['http']({'port':0x232a});config[_0xffcb('0xb')]=_[_0xffcb('0xc')](config[_0xffcb('0xb')],{'host':_0xffcb('0xd'),'port':0x18eb});var socket=require(_0xffcb('0xe'))(new Redis(config[_0xffcb('0xb')]));require(_0xffcb('0xf'))[_0xffcb('0x10')](socket);function respondWithRpcPromise(_0x5cc4ef,_0x500015,_0x3c6bfe){return new BPromise(function(_0xcba76f,_0x2840fc){return client[_0xffcb('0x11')](_0x5cc4ef,_0x3c6bfe)[_0xffcb('0x12')](function(_0x3739a1){logger[_0xffcb('0x13')]('MailQueue,\x20%s,\x20%s',_0x500015,'request\x20sent');logger[_0xffcb('0x14')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x500015,_0xffcb('0x15'),JSON[_0xffcb('0x16')](_0x3739a1));if(_0x3739a1[_0xffcb('0x17')]){if(_0x3739a1[_0xffcb('0x17')]['code']===0x1f4){logger[_0xffcb('0x17')]('MailQueue,\x20%s,\x20%s',_0x500015,_0x3739a1['error']['message']);return _0x2840fc(_0x3739a1[_0xffcb('0x17')][_0xffcb('0x18')]);}logger['error'](_0xffcb('0x19'),_0x500015,_0x3739a1[_0xffcb('0x17')][_0xffcb('0x18')]);return _0xcba76f(_0x3739a1[_0xffcb('0x17')]['message']);}else{logger[_0xffcb('0x13')](_0xffcb('0x19'),_0x500015,_0xffcb('0x15'));_0xcba76f(_0x3739a1[_0xffcb('0x1a')][_0xffcb('0x18')]);}})[_0xffcb('0x1b')](function(_0x459a9f){logger[_0xffcb('0x17')]('MailQueue,\x20%s,\x20%s',_0x500015,_0x459a9f);_0x2840fc(_0x459a9f);});});}exports[_0xffcb('0x1c')]=function(_0x3bf109){var _0x100623=this;return new Promise(function(_0x426d36,_0x29cce2){return db['MailQueue'][_0xffcb('0x1d')]({'raw':_0x3bf109[_0xffcb('0x1e')]?_0x3bf109[_0xffcb('0x1e')][_0xffcb('0x1f')]===undefined?!![]:![]:!![],'where':_0x3bf109[_0xffcb('0x1e')]?_0x3bf109['options'][_0xffcb('0x20')]||null:null,'attributes':_0x3bf109[_0xffcb('0x1e')]?_0x3bf109['options'][_0xffcb('0x21')]||null:null,'limit':_0x3bf109[_0xffcb('0x1e')]?_0x3bf109[_0xffcb('0x1e')][_0xffcb('0x22')]||null:null,'include':_0x3bf109['options']?_0x3bf109[_0xffcb('0x1e')][_0xffcb('0x23')]?_[_0xffcb('0x24')](_0x3bf109[_0xffcb('0x1e')]['include'],function(_0x954b02){return{'model':db[_0x954b02[_0xffcb('0x25')]],'as':_0x954b02['as'],'attributes':_0x954b02[_0xffcb('0x21')],'include':_0x954b02[_0xffcb('0x23')]?_[_0xffcb('0x24')](_0x954b02['include'],function(_0x72d9c4){return{'model':db[_0x72d9c4[_0xffcb('0x25')]],'as':_0x72d9c4['as'],'attributes':_0x72d9c4[_0xffcb('0x21')],'include':_0x72d9c4[_0xffcb('0x23')]?_[_0xffcb('0x24')](_0x72d9c4[_0xffcb('0x23')],function(_0x2c21df){return{'model':db[_0x2c21df['model']],'as':_0x2c21df['as'],'attributes':_0x2c21df[_0xffcb('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x983b9e){logger[_0xffcb('0x13')](_0xffcb('0x1c'),_0x3bf109);logger[_0xffcb('0x14')](_0xffcb('0x1c'),_0x3bf109,JSON[_0xffcb('0x16')](_0x983b9e));_0x426d36(_0x983b9e);})[_0xffcb('0x1b')](function(_0x26955d){logger[_0xffcb('0x17')](_0xffcb('0x1c'),_0x26955d[_0xffcb('0x18')],_0x3bf109);_0x29cce2(_0x100623[_0xffcb('0x17')](0x1f4,_0x26955d[_0xffcb('0x18')]));});});};exports[_0xffcb('0x26')]=function(_0x4383f1){var _0x1f4c1a=this;return new Promise(function(_0x38d5b8,_0x1afd45){return db[_0xffcb('0x27')]['find']({'raw':_0x4383f1['options']?_0x4383f1[_0xffcb('0x1e')][_0xffcb('0x1f')]===undefined?!![]:![]:!![],'where':_0x4383f1[_0xffcb('0x1e')]?_0x4383f1[_0xffcb('0x1e')][_0xffcb('0x20')]||null:null,'attributes':_0x4383f1[_0xffcb('0x1e')]?_0x4383f1['options'][_0xffcb('0x21')]||null:null,'include':_0x4383f1['options']?_0x4383f1[_0xffcb('0x1e')][_0xffcb('0x23')]?_[_0xffcb('0x24')](_0x4383f1[_0xffcb('0x1e')][_0xffcb('0x23')],function(_0x382f26){return{'model':db[_0x382f26[_0xffcb('0x25')]],'as':_0x382f26['as'],'attributes':_0x382f26['attributes'],'include':_0x382f26[_0xffcb('0x23')]?_[_0xffcb('0x24')](_0x382f26[_0xffcb('0x23')],function(_0x7c03d0){return{'model':db[_0x7c03d0[_0xffcb('0x25')]],'as':_0x7c03d0['as'],'attributes':_0x7c03d0[_0xffcb('0x21')],'include':_0x7c03d0[_0xffcb('0x23')]?_[_0xffcb('0x24')](_0x7c03d0[_0xffcb('0x23')],function(_0x48972e){return{'model':db[_0x48972e['model']],'as':_0x48972e['as'],'attributes':_0x48972e[_0xffcb('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x32723b){logger[_0xffcb('0x13')](_0xffcb('0x26'),_0x4383f1);logger[_0xffcb('0x14')](_0xffcb('0x26'),_0x4383f1,JSON[_0xffcb('0x16')](_0x32723b));_0x38d5b8(_0x32723b);})[_0xffcb('0x1b')](function(_0x3502ce){logger[_0xffcb('0x17')](_0xffcb('0x26'),_0x3502ce[_0xffcb('0x18')],_0x4383f1);_0x1afd45(_0x1f4c1a['error'](0x1f4,_0x3502ce[_0xffcb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 30ca0a4..66ae018 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 _0xff30=['save','remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events'];(function(_0x4863cc,_0x4ec662){var _0x382694=function(_0x43c1e1){while(--_0x43c1e1){_0x4863cc['push'](_0x4863cc['shift']());}};_0x382694(++_0x4ec662);}(_0xff30,0x104));var _0x0ff3=function(_0x29b9cd,_0x46434d){_0x29b9cd=_0x29b9cd-0x0;var _0x58dbf5=_0xff30[_0x29b9cd];return _0x58dbf5;};'use strict';var MailQueueEvents=require(_0x0ff3('0x0'));var events=[_0x0ff3('0x1'),_0x0ff3('0x2'),_0x0ff3('0x3')];function createListener(_0x3ae1d2,_0x199320){return function(_0xbd9ab6){_0x199320[_0x0ff3('0x4')](_0x3ae1d2,_0xbd9ab6);};}function removeListener(_0x409be5,_0x3c92c2){return function(){MailQueueEvents[_0x0ff3('0x5')](_0x409be5,_0x3c92c2);};}exports[_0x0ff3('0x6')]=function(_0x32e864){for(var _0x2696ba=0x0,_0x4398b3=events[_0x0ff3('0x7')];_0x2696ba<_0x4398b3;_0x2696ba++){var _0x572085=events[_0x2696ba];var _0x3599e1=createListener(_0x0ff3('0x8')+_0x572085,_0x32e864);MailQueueEvents['on'](_0x572085,_0x3599e1);}}; \ No newline at end of file +var _0x53f5=['./mailQueue.events','update','emit','removeListener','register','length','mailQueue:'];(function(_0x169c43,_0x521563){var _0x175116=function(_0x1d9a91){while(--_0x1d9a91){_0x169c43['push'](_0x169c43['shift']());}};_0x175116(++_0x521563);}(_0x53f5,0x1c0));var _0x553f=function(_0x3c6f9f,_0x21817d){_0x3c6f9f=_0x3c6f9f-0x0;var _0x135767=_0x53f5[_0x3c6f9f];return _0x135767;};'use strict';var MailQueueEvents=require(_0x553f('0x0'));var events=['save','remove',_0x553f('0x1')];function createListener(_0x5975da,_0x2db699){return function(_0x1904fd){_0x2db699[_0x553f('0x2')](_0x5975da,_0x1904fd);};}function removeListener(_0x5d3c56,_0x1a4b97){return function(){MailQueueEvents[_0x553f('0x3')](_0x5d3c56,_0x1a4b97);};}exports[_0x553f('0x4')]=function(_0x57a2ed){for(var _0x15fcbe=0x0,_0x2383e2=events[_0x553f('0x5')];_0x15fcbe<_0x2383e2;_0x15fcbe++){var _0xd883a1=events[_0x15fcbe];var _0x4e635a=createListener(_0x553f('0x6')+_0xd883a1,_0x57a2ed);MailQueueEvents['on'](_0xd883a1,_0x4e635a);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index d60ffe1..7e68cc7 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 _0x3e42=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','describe','post','create','put','/:id','delete','exports','multer','util','path'];(function(_0x27b3b,_0x2f09d0){var _0x4e1850=function(_0x18e507){while(--_0x18e507){_0x27b3b['push'](_0x27b3b['shift']());}};_0x4e1850(++_0x2f09d0);}(_0x3e42,0x195));var _0x23e4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e42[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x23e4('0x0'));var util=require(_0x23e4('0x1'));var path=require(_0x23e4('0x2'));var timeout=require(_0x23e4('0x3'));var express=require(_0x23e4('0x4'));var router=express[_0x23e4('0x5')]();var fs_extra=require(_0x23e4('0x6'));var auth=require(_0x23e4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./mailQueueReport.controller');router[_0x23e4('0x8')]('/',auth[_0x23e4('0x9')](),controller['index']);router[_0x23e4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x23e4('0xa')]);router['get']('/:id',auth[_0x23e4('0x9')](),controller['show']);router[_0x23e4('0xb')]('/',auth[_0x23e4('0x9')](),controller[_0x23e4('0xc')]);router[_0x23e4('0xd')](_0x23e4('0xe'),auth[_0x23e4('0x9')](),controller['update']);router[_0x23e4('0xf')](_0x23e4('0xe'),auth[_0x23e4('0x9')](),controller['destroy']);module[_0x23e4('0x10')]=router; \ No newline at end of file +var _0xbce0=['../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xd72852,_0x1ab23f){var _0x689bf5=function(_0x3cf8ce){while(--_0x3cf8ce){_0xd72852['push'](_0xd72852['shift']());}};_0x689bf5(++_0x1ab23f);}(_0xbce0,0x82));var _0x0bce=function(_0x2442c9,_0x487ed5){_0x2442c9=_0x2442c9-0x0;var _0x3e7346=_0xbce0[_0x2442c9];return _0x3e7346;};'use strict';var multer=require('multer');var util=require(_0x0bce('0x0'));var path=require(_0x0bce('0x1'));var timeout=require(_0x0bce('0x2'));var express=require(_0x0bce('0x3'));var router=express[_0x0bce('0x4')]();var fs_extra=require(_0x0bce('0x5'));var auth=require(_0x0bce('0x6'));var interaction=require(_0x0bce('0x7'));var config=require(_0x0bce('0x8'));var controller=require(_0x0bce('0x9'));router[_0x0bce('0xa')]('/',auth[_0x0bce('0xb')](),controller[_0x0bce('0xc')]);router[_0x0bce('0xa')]('/describe',auth[_0x0bce('0xb')](),controller[_0x0bce('0xd')]);router[_0x0bce('0xa')](_0x0bce('0xe'),auth[_0x0bce('0xb')](),controller[_0x0bce('0xf')]);router[_0x0bce('0x10')]('/',auth[_0x0bce('0xb')](),controller[_0x0bce('0x11')]);router[_0x0bce('0x12')](_0x0bce('0xe'),auth[_0x0bce('0xb')](),controller[_0x0bce('0x13')]);router[_0x0bce('0x14')](_0x0bce('0xe'),auth[_0x0bce('0xb')](),controller[_0x0bce('0x15')]);module[_0x0bce('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index b1db8b5..e1a373c 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 _0xe5ba=['DATE','moment','exports'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xe5ba,0x106));var _0xae5b=function(_0x3b90ca,_0x28d075){_0x3b90ca=_0x3b90ca-0x0;var _0x15052b=_0xe5ba[_0x3b90ca];return _0x15052b;};'use strict';var moment=require(_0xae5b('0x0'));var Sequelize=require('sequelize');module[_0xae5b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xae5b('0x2')]},'leaveAt':{'type':Sequelize[_0xae5b('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xae5b('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcf6f=['moment','STRING','DATE'];(function(_0x28db9d,_0x358bb3){var _0x35ab50=function(_0xfc3ea7){while(--_0xfc3ea7){_0x28db9d['push'](_0x28db9d['shift']());}};_0x35ab50(++_0x358bb3);}(_0xcf6f,0x105));var _0xfcf6=function(_0x4ed003,_0x436397){_0x4ed003=_0x4ed003-0x0;var _0x4a372b=_0xcf6f[_0x4ed003];return _0x4a372b;};'use strict';var moment=require(_0xfcf6('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0xfcf6('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xfcf6('0x2')]},'acceptAt':{'type':Sequelize[_0xfcf6('0x2')]},'exitAt':{'type':Sequelize[_0xfcf6('0x2')]},'reason':{'type':Sequelize[_0xfcf6('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 2292209..6eba939 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 _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x1d32d7,_0x15e7d7){var _0x3f460e=function(_0x534709){while(--_0x534709){_0x1d32d7['push'](_0x1d32d7['shift']());}};_0x3f460e(++_0x15e7d7);}(_0x6050,0x196));var _0x0605=function(_0x532620,_0x474aea){_0x532620=_0x532620-0x0;var _0xadeaec=_0x6050[_0x532620];return _0xadeaec;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file +var _0x2a07=['index','map','MailQueueReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','catch','show','params','fields','includeAll','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','name','send'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2a07,0x74));var _0x72a0=function(_0xd98def,_0x19ebc7){_0xd98def=_0xd98def-0x0;var _0x55b182=_0x2a07[_0xd98def];return _0x55b182;};'use strict';var emlformat=require(_0x72a0('0x0'));var rimraf=require(_0x72a0('0x1'));var zipdir=require(_0x72a0('0x2'));var jsonpatch=require(_0x72a0('0x3'));var rp=require(_0x72a0('0x4'));var moment=require('moment');var BPromise=require(_0x72a0('0x5'));var Mustache=require(_0x72a0('0x6'));var util=require(_0x72a0('0x7'));var path=require(_0x72a0('0x8'));var sox=require(_0x72a0('0x9'));var csv=require(_0x72a0('0xa'));var ejs=require(_0x72a0('0xb'));var fs=require('fs');var fs_extra=require(_0x72a0('0xc'));var _=require(_0x72a0('0xd'));var squel=require(_0x72a0('0xe'));var crypto=require(_0x72a0('0xf'));var jsforce=require(_0x72a0('0x10'));var deskjs=require(_0x72a0('0x11'));var toCsv=require(_0x72a0('0xa'));var querystring=require(_0x72a0('0x12'));var Papa=require(_0x72a0('0x13'));var Redis=require('ioredis');var authService=require(_0x72a0('0x14'));var qs=require(_0x72a0('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x72a0('0x16'));var logger=require(_0x72a0('0x17'))(_0x72a0('0x18'));var utils=require(_0x72a0('0x19'));var config=require(_0x72a0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x72a0('0x1b'))['db'];function respondWithStatusCode(_0x335b9f,_0x123ca4){_0x123ca4=_0x123ca4||0xcc;return function(_0xf91a82){if(_0xf91a82){return _0x335b9f[_0x72a0('0x1c')](_0x123ca4);}return _0x335b9f[_0x72a0('0x1d')](_0x123ca4)[_0x72a0('0x1e')]();};}function respondWithResult(_0x5e0b5f,_0x4930c5){_0x4930c5=_0x4930c5||0xc8;return function(_0xe103dc){if(_0xe103dc){return _0x5e0b5f[_0x72a0('0x1d')](_0x4930c5)[_0x72a0('0x1f')](_0xe103dc);}};}function respondWithFilteredResult(_0x1d1133,_0x23b001){return function(_0x3f3d62){if(_0x3f3d62){var _0x4ab55e=typeof _0x23b001[_0x72a0('0x20')]===_0x72a0('0x21')&&typeof _0x23b001[_0x72a0('0x22')]===_0x72a0('0x21');var _0x2d1e95=_0x3f3d62['count'];var _0x100d8f=_0x4ab55e?0x0:_0x23b001[_0x72a0('0x20')];var _0x131b73=_0x4ab55e?_0x3f3d62['count']:_0x23b001[_0x72a0('0x20')]+_0x23b001[_0x72a0('0x22')];var _0x30899b;if(_0x131b73>=_0x2d1e95){_0x131b73=_0x2d1e95;_0x30899b=0xc8;}else{_0x30899b=0xce;}_0x1d1133[_0x72a0('0x1d')](_0x30899b);return _0x1d1133['set'](_0x72a0('0x23'),_0x100d8f+'-'+_0x131b73+'/'+_0x2d1e95)['json'](_0x3f3d62);}return null;};}function patchUpdates(_0x3d0607){return function(_0x315413){try{jsonpatch[_0x72a0('0x24')](_0x315413,_0x3d0607,!![]);}catch(_0x5c7479){return BPromise[_0x72a0('0x25')](_0x5c7479);}return _0x315413[_0x72a0('0x26')]();};}function saveUpdates(_0x1d22d8,_0x3d1965){return function(_0x5d6145){if(_0x5d6145){return _0x5d6145[_0x72a0('0x27')](_0x1d22d8)[_0x72a0('0x28')](function(_0x1ddd54){return _0x1ddd54;});}return null;};}function removeEntity(_0x23b918,_0x3022b0){return function(_0x174b1b){if(_0x174b1b){return _0x174b1b['destroy']()['then'](function(){_0x23b918[_0x72a0('0x1d')](0xcc)[_0x72a0('0x1e')]();});}};}function handleEntityNotFound(_0x123df4,_0x1504ed){return function(_0xf5cb49){if(!_0xf5cb49){_0x123df4[_0x72a0('0x1c')](0x194);}return _0xf5cb49;};}function handleError(_0xa5bda0,_0x15922a){_0x15922a=_0x15922a||0x1f4;return function(_0xee99e2){logger[_0x72a0('0x29')](_0xee99e2['stack']);if(_0xee99e2[_0x72a0('0x2a')]){delete _0xee99e2[_0x72a0('0x2a')];}_0xa5bda0[_0x72a0('0x1d')](_0x15922a)[_0x72a0('0x2b')](_0xee99e2);};}exports[_0x72a0('0x2c')]=function(_0x177a3a,_0x432179){var _0x12eda2={},_0x23c96a={},_0x916733={'count':0x0,'rows':[]};var _0x4ba037=_[_0x72a0('0x2d')](db[_0x72a0('0x2e')][_0x72a0('0x2f')],function(_0xfbe9b3){return{'name':_0xfbe9b3[_0x72a0('0x30')],'type':_0xfbe9b3[_0x72a0('0x31')][_0x72a0('0x32')]};});_0x23c96a['model']=_[_0x72a0('0x2d')](_0x4ba037,_0x72a0('0x2a'));_0x23c96a[_0x72a0('0x33')]=_[_0x72a0('0x34')](_0x177a3a[_0x72a0('0x33')]);_0x23c96a[_0x72a0('0x35')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],_0x23c96a['query']);_0x12eda2[_0x72a0('0x38')]=_[_0x72a0('0x36')](_0x23c96a[_0x72a0('0x37')],qs['fields'](_0x177a3a[_0x72a0('0x33')]['fields']));_0x12eda2[_0x72a0('0x38')]=_0x12eda2[_0x72a0('0x38')][_0x72a0('0x39')]?_0x12eda2[_0x72a0('0x38')]:_0x23c96a[_0x72a0('0x37')];if(!_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3a')](_0x72a0('0x3b'))){_0x12eda2[_0x72a0('0x22')]=qs[_0x72a0('0x22')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x22')]);_0x12eda2['offset']=qs[_0x72a0('0x20')](_0x177a3a['query'][_0x72a0('0x20')]);}_0x12eda2[_0x72a0('0x3c')]=qs[_0x72a0('0x3d')](_0x177a3a[_0x72a0('0x33')][_0x72a0('0x3d')]);_0x12eda2[_0x72a0('0x3e')]=qs[_0x72a0('0x35')](_[_0x72a0('0x3f')](_0x177a3a[_0x72a0('0x33')],_0x23c96a['filters']),_0x4ba037);if(_0x177a3a['query'][_0x72a0('0x40')]){_0x12eda2[_0x72a0('0x3e')]=_[_0x72a0('0x41')](_0x12eda2[_0x72a0('0x3e')],{'$or':_[_0x72a0('0x2d')](_0x4ba037,function(_0x512a06){if(_0x512a06[_0x72a0('0x31')]!==_0x72a0('0x42')){var _0x582c90={};_0x582c90[_0x512a06[_0x72a0('0x2a')]]={'$like':'%'+_0x177a3a['query']['filter']+'%'};return _0x582c90;}})});}_0x12eda2=_['merge']({},_0x12eda2,_0x177a3a[_0x72a0('0x43')]);var _0x49633b={'where':_0x12eda2[_0x72a0('0x3e')]};return db[_0x72a0('0x2e')][_0x72a0('0x44')](_0x49633b)[_0x72a0('0x28')](function(_0x4bf56e){_0x916733['count']=_0x4bf56e;if(_0x177a3a['query']['includeAll']){_0x12eda2[_0x72a0('0x45')]=[{'all':!![]}];}return db[_0x72a0('0x2e')]['findAll'](_0x12eda2);})[_0x72a0('0x28')](function(_0x35d790){_0x916733['rows']=_0x35d790;return _0x916733;})[_0x72a0('0x28')](respondWithFilteredResult(_0x432179,_0x12eda2))[_0x72a0('0x46')](handleError(_0x432179,null));};exports[_0x72a0('0x47')]=function(_0xe4abe1,_0x340153){var _0x341451={'raw':!![],'where':{'id':_0xe4abe1[_0x72a0('0x48')]['id']}},_0x50eb7f={};_0x50eb7f['model']=_[_0x72a0('0x34')](db['MailQueueReport'][_0x72a0('0x2f')]);_0x50eb7f[_0x72a0('0x33')]=_['keys'](_0xe4abe1[_0x72a0('0x33')]);_0x50eb7f['filters']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],_0x50eb7f[_0x72a0('0x33')]);_0x341451['attributes']=_[_0x72a0('0x36')](_0x50eb7f[_0x72a0('0x37')],qs[_0x72a0('0x49')](_0xe4abe1['query']['fields']));_0x341451[_0x72a0('0x38')]=_0x341451['attributes'][_0x72a0('0x39')]?_0x341451[_0x72a0('0x38')]:_0x50eb7f[_0x72a0('0x37')];if(_0xe4abe1[_0x72a0('0x33')][_0x72a0('0x4a')]){_0x341451[_0x72a0('0x45')]=[{'all':!![]}];}_0x341451=_[_0x72a0('0x41')]({},_0x341451,_0xe4abe1[_0x72a0('0x43')]);return db[_0x72a0('0x2e')]['find'](_0x341451)[_0x72a0('0x28')](handleEntityNotFound(_0x340153,null))[_0x72a0('0x28')](respondWithResult(_0x340153,null))[_0x72a0('0x46')](handleError(_0x340153,null));};exports[_0x72a0('0x4b')]=function(_0x3a669d,_0x304400){return db[_0x72a0('0x2e')]['create'](_0x3a669d['body'],{})[_0x72a0('0x28')](respondWithResult(_0x304400,0xc9))[_0x72a0('0x46')](handleError(_0x304400,null));};exports[_0x72a0('0x27')]=function(_0x3cab6a,_0x35a6ad){if(_0x3cab6a[_0x72a0('0x4c')]['id']){delete _0x3cab6a[_0x72a0('0x4c')]['id'];}return db[_0x72a0('0x2e')][_0x72a0('0x4d')]({'where':{'id':_0x3cab6a[_0x72a0('0x48')]['id']}})['then'](handleEntityNotFound(_0x35a6ad,null))[_0x72a0('0x28')](saveUpdates(_0x3cab6a[_0x72a0('0x4c')],null))[_0x72a0('0x28')](respondWithResult(_0x35a6ad,null))[_0x72a0('0x46')](handleError(_0x35a6ad,null));};exports[_0x72a0('0x4e')]=function(_0x5c1570,_0x143410){return db['MailQueueReport']['find']({'where':{'id':_0x5c1570[_0x72a0('0x48')]['id']}})[_0x72a0('0x28')](handleEntityNotFound(_0x143410,null))[_0x72a0('0x28')](removeEntity(_0x143410,null))[_0x72a0('0x46')](handleError(_0x143410,null));};exports[_0x72a0('0x4f')]=function(_0x50c8d7,_0xc0f323){return db[_0x72a0('0x2e')]['describe']()['then'](respondWithResult(_0xc0f323,null))[_0x72a0('0x46')](handleError(_0xc0f323,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 362fdce..b039eb3 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 _0x76a8=['../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x1b3f22,_0x50adb9){var _0x5e459c=function(_0x2715ca){while(--_0x2715ca){_0x1b3f22['push'](_0x1b3f22['shift']());}};_0x5e459c(++_0x50adb9);}(_0x76a8,0x1e7));var _0x876a=function(_0x515c2e,_0x5963b8){_0x515c2e=_0x515c2e-0x0;var _0x38f065=_0x76a8[_0x515c2e];return _0x38f065;};'use strict';var _=require(_0x876a('0x0'));var util=require(_0x876a('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x876a('0x2'));var BPromise=require(_0x876a('0x3'));var rp=require(_0x876a('0x4'));var fs=require('fs');var path=require(_0x876a('0x5'));var rimraf=require(_0x876a('0x6'));var config=require(_0x876a('0x7'));var attributes=require(_0x876a('0x8'));module[_0x876a('0x9')]=function(_0x51fad1,_0xf39a10){return _0x51fad1[_0x876a('0xa')](_0x876a('0xb'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x876a('0xc'),'fields':[_0x876a('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e96=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1551ea,_0x21272d){var _0xe06058=function(_0x13662c){while(--_0x13662c){_0x1551ea['push'](_0x1551ea['shift']());}};_0xe06058(++_0x21272d);}(_0x9e96,0xbd));var _0x69e9=function(_0xd0ae93,_0x4cd7d3){_0xd0ae93=_0xd0ae93-0x0;var _0x7c6b3a=_0x9e96[_0xd0ae93];return _0x7c6b3a;};'use strict';var _=require(_0x69e9('0x0'));var util=require(_0x69e9('0x1'));var logger=require(_0x69e9('0x2'))(_0x69e9('0x3'));var moment=require(_0x69e9('0x4'));var BPromise=require(_0x69e9('0x5'));var rp=require(_0x69e9('0x6'));var fs=require('fs');var path=require(_0x69e9('0x7'));var rimraf=require(_0x69e9('0x8'));var config=require(_0x69e9('0x9'));var attributes=require(_0x69e9('0xa'));module[_0x69e9('0xb')]=function(_0x1642eb,_0x5df6c5){return _0x1642eb['define'](_0x69e9('0xc'),attributes,{'tableName':_0x69e9('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x69e9('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 0370e87..c31fcc7 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['MailQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateMailQueueReport','create','options','raw','debug','MailQueueReport','body','attributes','limit','UpdateMailQueueReport','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0xee7b66,_0xfddff){var _0x1d6f52=function(_0x588a02){while(--_0x588a02){_0xee7b66['push'](_0xee7b66['shift']());}};_0x1d6f52(++_0xfddff);}(_0xadb5,0xad));var _0x5adb=function(_0x90dade,_0x4d38cc){_0x90dade=_0x90dade-0x0;var _0x1a082c=_0xadb5[_0x90dade];return _0x1a082c;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('MailQueueReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});}exports[_0x5adb('0x15')]=function(_0x529b65){var _0x3fff62=this;return new Promise(function(_0x5de028,_0x1d9e86){return db['MailQueueReport'][_0x5adb('0x16')](_0x529b65['body'],{'raw':_0x529b65['options']?_0x529b65[_0x5adb('0x17')][_0x5adb('0x18')]===undefined?!![]:![]:!![]})[_0x5adb('0xb')](function(_0x1fd4a7){logger[_0x5adb('0xc')]('CreateMailQueueReport',_0x529b65);logger[_0x5adb('0x19')]('CreateMailQueueReport',_0x529b65,JSON['stringify'](_0x1fd4a7));_0x5de028(_0x1fd4a7);})[_0x5adb('0x14')](function(_0x379b33){logger[_0x5adb('0x10')](_0x5adb('0x15'),_0x379b33[_0x5adb('0x12')],_0x529b65);_0x1d9e86(_0x3fff62[_0x5adb('0x10')](0x1f4,_0x379b33[_0x5adb('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x4b1957){var _0x373cc3=this;return new Promise(function(_0x3220cd,_0x3839fb){return db[_0x5adb('0x1a')]['update'](_0x4b1957[_0x5adb('0x1b')],{'raw':_0x4b1957[_0x5adb('0x17')]?_0x4b1957['options'][_0x5adb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')]['where']||null:null,'attributes':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1c')]||null:null,'limit':_0x4b1957[_0x5adb('0x17')]?_0x4b1957[_0x5adb('0x17')][_0x5adb('0x1d')]||null:null})['then'](function(_0x49992e){logger['info'](_0x5adb('0x1e'),_0x4b1957);logger[_0x5adb('0x19')](_0x5adb('0x1e'),_0x4b1957,JSON[_0x5adb('0xf')](_0x49992e));_0x3220cd(_0x49992e);})[_0x5adb('0x14')](function(_0x4de310){logger[_0x5adb('0x10')](_0x5adb('0x1e'),_0x4de310[_0x5adb('0x12')],_0x4b1957);_0x3839fb(_0x373cc3[_0x5adb('0x10')](0x1f4,_0x4de310[_0x5adb('0x12')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x258dea,_0x14051c){var _0x5b7c1a=function(_0x2982e8){while(--_0x2982e8){_0x258dea['push'](_0x258dea['shift']());}};_0x5b7c1a(++_0x14051c);}(_0xdb28,0x106));var _0x8db2=function(_0x4a476e,_0x7c5d15){_0x4a476e=_0x4a476e-0x0;var _0x25073e=_0xdb28[_0x4a476e];return _0x25073e;};'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')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index dc573ac..8fb52b7 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x191366,_0x40a440){var _0x17056c=function(_0x5ae8df){while(--_0x5ae8df){_0x191366['push'](_0x191366['shift']());}};_0x17056c(++_0x40a440);}(_0xe706,0xa3));var _0x6e70=function(_0x3c3b51,_0xe90b55){_0x3c3b51=_0x3c3b51-0x0;var _0x303246=_0xe706[_0x3c3b51];return _0x303246;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x2642be,_0x1502f0){var _0x23ade3=function(_0x1123d1){while(--_0x1123d1){_0x2642be['push'](_0x2642be['shift']());}};_0x23ade3(++_0x1502f0);}(_0x70e0,0x17b));var _0x070e=function(_0x745ed1,_0x2df294){_0x745ed1=_0x745ed1-0x0;var _0xae59b6=_0x70e0[_0x745ed1];return _0xae59b6;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index a27d3d6..6189a08 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 _0xbc4c=['INTEGER','INBOX','sequelize','exports','STRING','BOOLEAN'];(function(_0x5dd1ea,_0x499246){var _0x3f6d42=function(_0x23c68b){while(--_0x23c68b){_0x5dd1ea['push'](_0x5dd1ea['shift']());}};_0x3f6d42(++_0x499246);}(_0xbc4c,0x1b2));var _0xcbc4=function(_0x483d8b,_0x526c52){_0x483d8b=_0x483d8b-0x0;var _0x6500f1=_0xbc4c[_0x483d8b];return _0x6500f1;};'use strict';var Sequelize=require(_0xcbc4('0x0'));module[_0xcbc4('0x1')]={'description':{'type':Sequelize[_0xcbc4('0x2')]},'host':{'type':Sequelize[_0xcbc4('0x2')]},'authentication':{'type':Sequelize[_0xcbc4('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xcbc4('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xcbc4('0x4')]},'tls':{'type':Sequelize[_0xcbc4('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xcbc4('0x2')],'defaultValue':_0xcbc4('0x5')},'connTimeout':{'type':Sequelize[_0xcbc4('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcbc4('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xcbc4('0x2')]},'modernAuthentication':{'type':Sequelize[_0xcbc4('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xad37=['BOOLEAN','INTEGER','INBOX','sequelize','exports','STRING'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0xad37,0x171));var _0x7ad3=function(_0x85f158,_0xcb8f1f){_0x85f158=_0x85f158-0x0;var _0x4ce4e0=_0xad37[_0x85f158];return _0x4ce4e0;};'use strict';var Sequelize=require(_0x7ad3('0x0'));module[_0x7ad3('0x1')]={'description':{'type':Sequelize[_0x7ad3('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x7ad3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x7ad3('0x2')]},'password':{'type':Sequelize[_0x7ad3('0x2')]},'port':{'type':Sequelize[_0x7ad3('0x4')]},'tls':{'type':Sequelize[_0x7ad3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0x7ad3('0x5')},'connTimeout':{'type':Sequelize[_0x7ad3('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x7ad3('0x2')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index acc60cf..d52226f 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 _0x8272=['bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash','util','../../config/logger','api','moment'];(function(_0x3ddd79,_0xc755b9){var _0x328de8=function(_0x55407f){while(--_0x55407f){_0x3ddd79['push'](_0x3ddd79['shift']());}};_0x328de8(++_0xc755b9);}(_0x8272,0xcb));var _0x2827=function(_0x331d3d,_0x32d9b1){_0x331d3d=_0x331d3d-0x0;var _0x300dc5=_0x8272[_0x331d3d];return _0x300dc5;};'use strict';var _=require(_0x2827('0x0'));var util=require(_0x2827('0x1'));var logger=require(_0x2827('0x2'))(_0x2827('0x3'));var moment=require(_0x2827('0x4'));var BPromise=require(_0x2827('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2827('0x6'));var rimraf=require(_0x2827('0x7'));var config=require(_0x2827('0x8'));var attributes=require(_0x2827('0x9'));module['exports']=function(_0x3b22c1,_0x27f795){return _0x3b22c1[_0x2827('0xa')](_0x2827('0xb'),attributes,{'tableName':_0x2827('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa627=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./mailServerIn.attributes','exports','define','MailServerIn','mail_servers_in'];(function(_0x10857a,_0x527258){var _0x18d90=function(_0x50e19b){while(--_0x50e19b){_0x10857a['push'](_0x10857a['shift']());}};_0x18d90(++_0x527258);}(_0xa627,0x16c));var _0x7a62=function(_0x116e2b,_0x27f4f4){_0x116e2b=_0x116e2b-0x0;var _0x35f23b=_0xa627[_0x116e2b];return _0x35f23b;};'use strict';var _=require(_0x7a62('0x0'));var util=require(_0x7a62('0x1'));var logger=require(_0x7a62('0x2'))(_0x7a62('0x3'));var moment=require(_0x7a62('0x4'));var BPromise=require('bluebird');var rp=require(_0x7a62('0x5'));var fs=require('fs');var path=require(_0x7a62('0x6'));var rimraf=require(_0x7a62('0x7'));var config=require('../../config/environment');var attributes=require(_0x7a62('0x8'));module[_0x7a62('0x9')]=function(_0x35aa79,_0x1bc966){return _0x35aa79[_0x7a62('0xa')](_0x7a62('0xb'),attributes,{'tableName':_0x7a62('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 1e2320f..40691e8 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 _0x5c88=['model','then','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','GetMailServerIn','MailServerIn','options','raw','where','attributes','include','map'];(function(_0x37f2f9,_0x662e94){var _0x1b3e97=function(_0x2a1ac3){while(--_0x2a1ac3){_0x37f2f9['push'](_0x37f2f9['shift']());}};_0x1b3e97(++_0x662e94);}(_0x5c88,0x158));var _0x85c8=function(_0xf3e628,_0x193d6e){_0xf3e628=_0xf3e628-0x0;var _0x14d86c=_0x5c88[_0xf3e628];return _0x14d86c;};'use strict';var _=require(_0x85c8('0x0'));var util=require(_0x85c8('0x1'));var moment=require('moment');var BPromise=require(_0x85c8('0x2'));var rs=require(_0x85c8('0x3'));var fs=require('fs');var Redis=require(_0x85c8('0x4'));var db=require(_0x85c8('0x5'))['db'];var utils=require(_0x85c8('0x6'));var logger=require(_0x85c8('0x7'))(_0x85c8('0x8'));var config=require('../../config/environment');var jayson=require(_0x85c8('0x9'));var client=jayson['client'][_0x85c8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ef6cd,_0x18f023,_0x43029f){return new BPromise(function(_0x2a8ce6,_0x35e0b5){return client[_0x85c8('0xb')](_0x3ef6cd,_0x43029f)['then'](function(_0x193acc){logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x18f023,'request\x20sent');logger['debug'](_0x85c8('0xe'),_0x18f023,_0x85c8('0xf'),JSON[_0x85c8('0x10')](_0x193acc));if(_0x193acc[_0x85c8('0x11')]){if(_0x193acc[_0x85c8('0x11')]['code']===0x1f4){logger['error'](_0x85c8('0xd'),_0x18f023,_0x193acc['error'][_0x85c8('0x12')]);return _0x35e0b5(_0x193acc['error'][_0x85c8('0x12')]);}logger[_0x85c8('0x11')]('MailServerIn,\x20%s,\x20%s',_0x18f023,_0x193acc[_0x85c8('0x11')][_0x85c8('0x12')]);return _0x2a8ce6(_0x193acc[_0x85c8('0x11')][_0x85c8('0x12')]);}else{logger[_0x85c8('0xc')](_0x85c8('0xd'),_0x18f023,'request\x20sent');_0x2a8ce6(_0x193acc['result'][_0x85c8('0x12')]);}})[_0x85c8('0x13')](function(_0x25f7ef){logger[_0x85c8('0x11')](_0x85c8('0xd'),_0x18f023,_0x25f7ef);_0x35e0b5(_0x25f7ef);});});}exports[_0x85c8('0x14')]=function(_0x1b310f){var _0x400dc0=this;return new Promise(function(_0x311fd7,_0x55ed86){return db[_0x85c8('0x15')]['findAll']({'raw':_0x1b310f[_0x85c8('0x16')]?_0x1b310f[_0x85c8('0x16')][_0x85c8('0x17')]===undefined?!![]:![]:!![],'where':_0x1b310f[_0x85c8('0x16')]?_0x1b310f[_0x85c8('0x16')][_0x85c8('0x18')]||null:null,'attributes':_0x1b310f[_0x85c8('0x16')]?_0x1b310f[_0x85c8('0x16')][_0x85c8('0x19')]||null:null,'limit':_0x1b310f[_0x85c8('0x16')]?_0x1b310f['options']['limit']||null:null,'include':_0x1b310f[_0x85c8('0x16')]?_0x1b310f['options'][_0x85c8('0x1a')]?_[_0x85c8('0x1b')](_0x1b310f['options'][_0x85c8('0x1a')],function(_0x2d9f5d){return{'model':db[_0x2d9f5d[_0x85c8('0x1c')]],'as':_0x2d9f5d['as'],'attributes':_0x2d9f5d['attributes'],'include':_0x2d9f5d['include']?_[_0x85c8('0x1b')](_0x2d9f5d['include'],function(_0x4a4cef){return{'model':db[_0x4a4cef[_0x85c8('0x1c')]],'as':_0x4a4cef['as'],'attributes':_0x4a4cef[_0x85c8('0x19')],'include':_0x4a4cef[_0x85c8('0x1a')]?_['map'](_0x4a4cef[_0x85c8('0x1a')],function(_0x1bec22){return{'model':db[_0x1bec22[_0x85c8('0x1c')]],'as':_0x1bec22['as'],'attributes':_0x1bec22[_0x85c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x85c8('0x1d')](function(_0x238da9){logger['info'](_0x85c8('0x14'),_0x1b310f);logger[_0x85c8('0x1e')](_0x85c8('0x14'),_0x1b310f,JSON[_0x85c8('0x10')](_0x238da9));_0x311fd7(_0x238da9);})[_0x85c8('0x13')](function(_0x1b91e3){logger[_0x85c8('0x11')](_0x85c8('0x14'),_0x1b91e3['message'],_0x1b310f);_0x55ed86(_0x400dc0[_0x85c8('0x11')](0x1f4,_0x1b91e3[_0x85c8('0x12')]));});});}; \ No newline at end of file +var _0x07f5=['client','http','request','then','MailServerIn,\x20%s,\x20%s','debug','request\x20sent','error','message','info','catch','GetMailServerIn','MailServerIn','findAll','options','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x438bd0,_0x4b2c26){var _0x4f5d60=function(_0x4208c0){while(--_0x4208c0){_0x438bd0['push'](_0x438bd0['shift']());}};_0x4f5d60(++_0x4b2c26);}(_0x07f5,0xc1));var _0x507f=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x07f5[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x507f('0x0'));var util=require(_0x507f('0x1'));var moment=require(_0x507f('0x2'));var BPromise=require(_0x507f('0x3'));var rs=require(_0x507f('0x4'));var fs=require('fs');var Redis=require(_0x507f('0x5'));var db=require(_0x507f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x507f('0x7'))(_0x507f('0x8'));var config=require(_0x507f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x507f('0xa')][_0x507f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28aef4,_0xad9415,_0x406f7b){return new BPromise(function(_0x4ab3d0,_0xcd952f){return client[_0x507f('0xc')](_0x28aef4,_0x406f7b)[_0x507f('0xd')](function(_0x621c9c){logger['info'](_0x507f('0xe'),_0xad9415,'request\x20sent');logger[_0x507f('0xf')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xad9415,_0x507f('0x10'),JSON['stringify'](_0x621c9c));if(_0x621c9c[_0x507f('0x11')]){if(_0x621c9c['error']['code']===0x1f4){logger[_0x507f('0x11')](_0x507f('0xe'),_0xad9415,_0x621c9c['error'][_0x507f('0x12')]);return _0xcd952f(_0x621c9c[_0x507f('0x11')]['message']);}logger['error'](_0x507f('0xe'),_0xad9415,_0x621c9c[_0x507f('0x11')][_0x507f('0x12')]);return _0x4ab3d0(_0x621c9c[_0x507f('0x11')][_0x507f('0x12')]);}else{logger[_0x507f('0x13')](_0x507f('0xe'),_0xad9415,_0x507f('0x10'));_0x4ab3d0(_0x621c9c['result'][_0x507f('0x12')]);}})[_0x507f('0x14')](function(_0xf4e4fa){logger[_0x507f('0x11')](_0x507f('0xe'),_0xad9415,_0xf4e4fa);_0xcd952f(_0xf4e4fa);});});}exports[_0x507f('0x15')]=function(_0x269ba5){var _0xde71c4=this;return new Promise(function(_0x3b892a,_0x420f09){return db[_0x507f('0x16')][_0x507f('0x17')]({'raw':_0x269ba5[_0x507f('0x18')]?_0x269ba5[_0x507f('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x269ba5[_0x507f('0x18')]?_0x269ba5[_0x507f('0x18')]['where']||null:null,'attributes':_0x269ba5[_0x507f('0x18')]?_0x269ba5[_0x507f('0x18')]['attributes']||null:null,'limit':_0x269ba5[_0x507f('0x18')]?_0x269ba5[_0x507f('0x18')]['limit']||null:null,'include':_0x269ba5[_0x507f('0x18')]?_0x269ba5[_0x507f('0x18')][_0x507f('0x19')]?_['map'](_0x269ba5[_0x507f('0x18')][_0x507f('0x19')],function(_0x18f4e5){return{'model':db[_0x18f4e5['model']],'as':_0x18f4e5['as'],'attributes':_0x18f4e5['attributes'],'include':_0x18f4e5[_0x507f('0x19')]?_[_0x507f('0x1a')](_0x18f4e5['include'],function(_0x426a3f){return{'model':db[_0x426a3f[_0x507f('0x1b')]],'as':_0x426a3f['as'],'attributes':_0x426a3f['attributes'],'include':_0x426a3f[_0x507f('0x19')]?_[_0x507f('0x1a')](_0x426a3f[_0x507f('0x19')],function(_0xdc38c2){return{'model':db[_0xdc38c2[_0x507f('0x1b')]],'as':_0xdc38c2['as'],'attributes':_0xdc38c2[_0x507f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x507f('0xd')](function(_0x198a14){logger['info'](_0x507f('0x15'),_0x269ba5);logger[_0x507f('0xf')](_0x507f('0x15'),_0x269ba5,JSON['stringify'](_0x198a14));_0x3b892a(_0x198a14);})[_0x507f('0x14')](function(_0x26e23e){logger[_0x507f('0x11')](_0x507f('0x15'),_0x26e23e[_0x507f('0x12')],_0x269ba5);_0x420f09(_0xde71c4[_0x507f('0x11')](0x1f4,_0x26e23e[_0x507f('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9e2c586..2f0e9f5 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(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7a54,0x106));var _0x47a5=function(_0x427e7b,_0x5678d7){_0x427e7b=_0x427e7b-0x0;var _0x3ff770=_0x7a54[_0x427e7b];return _0x3ff770;};'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(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x7a54,0x106));var _0x47a5=function(_0x5dbdcd,_0x421630){_0x5dbdcd=_0x5dbdcd-0x0;var _0x30f020=_0x7a54[_0x5dbdcd];return _0x30f020;};'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 759d661..0d5459c 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 _0xb7e7=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x36eaac,_0x39d076){var _0x475282=function(_0x3f1e2c){while(--_0x3f1e2c){_0x36eaac['push'](_0x36eaac['shift']());}};_0x475282(++_0x39d076);}(_0xb7e7,0x121));var _0x7b7e=function(_0x5c9307,_0x5b97e4){_0x5c9307=_0x5c9307-0x0;var _0x373e29=_0xb7e7[_0x5c9307];return _0x373e29;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'description':{'type':Sequelize[_0x7b7e('0x1')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x7b7e('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x7b7e('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x7b7e('0x1')]},'authentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x7b7e('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x351d=['sequelize','STRING','INTEGER','BOOLEAN'];(function(_0x8dee,_0x4a01d9){var _0x2ec391=function(_0x215abf){while(--_0x215abf){_0x8dee['push'](_0x8dee['shift']());}};_0x2ec391(++_0x4a01d9);}(_0x351d,0x90));var _0xd351=function(_0x46cb3d,_0x14fe8b){_0x46cb3d=_0x46cb3d-0x0;var _0x2f2885=_0x351d[_0x46cb3d];return _0x2f2885;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'description':{'type':Sequelize[_0xd351('0x1')]},'host':{'type':Sequelize[_0xd351('0x1')]},'user':{'type':Sequelize[_0xd351('0x1')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xd351('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0xd351('0x1')]},'authentication':{'type':Sequelize[_0xd351('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 82f9ebc..7dab625 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 _0xd6b1=['includeAll','find','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','include','rows','catch','show','params'];(function(_0x10f23a,_0xa95e22){var _0x239593=function(_0x177b66){while(--_0x177b66){_0x10f23a['push'](_0x10f23a['shift']());}};_0x239593(++_0xa95e22);}(_0xd6b1,0xdf));var _0x1d6b=function(_0x1f69ae,_0x47884e){_0x1f69ae=_0x1f69ae-0x0;var _0x1074dc=_0xd6b1[_0x1f69ae];return _0x1074dc;};'use strict';var emlformat=require(_0x1d6b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1d6b('0x1'));var jsonpatch=require(_0x1d6b('0x2'));var rp=require(_0x1d6b('0x3'));var moment=require(_0x1d6b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1d6b('0x5'));var util=require(_0x1d6b('0x6'));var path=require(_0x1d6b('0x7'));var sox=require(_0x1d6b('0x8'));var csv=require(_0x1d6b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1d6b('0xa'));var _=require(_0x1d6b('0xb'));var squel=require(_0x1d6b('0xc'));var crypto=require(_0x1d6b('0xd'));var jsforce=require(_0x1d6b('0xe'));var deskjs=require(_0x1d6b('0xf'));var toCsv=require(_0x1d6b('0x9'));var querystring=require('querystring');var Papa=require(_0x1d6b('0x10'));var Redis=require(_0x1d6b('0x11'));var authService=require(_0x1d6b('0x12'));var qs=require(_0x1d6b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d6b('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x1d6b('0x15'));var config=require(_0x1d6b('0x16'));var licenseUtil=require(_0x1d6b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x488d4b,_0x5c57db){_0x5c57db=_0x5c57db||0xcc;return function(_0x38333a){if(_0x38333a){return _0x488d4b[_0x1d6b('0x18')](_0x5c57db);}return _0x488d4b[_0x1d6b('0x19')](_0x5c57db)[_0x1d6b('0x1a')]();};}function respondWithResult(_0x39bf21,_0x53e455){_0x53e455=_0x53e455||0xc8;return function(_0x17cdcc){if(_0x17cdcc){return _0x39bf21[_0x1d6b('0x19')](_0x53e455)[_0x1d6b('0x1b')](_0x17cdcc);}};}function respondWithFilteredResult(_0x55c313,_0x99dd0c){return function(_0x4b34f7){if(_0x4b34f7){var _0x53d2d0=typeof _0x99dd0c[_0x1d6b('0x1c')]===_0x1d6b('0x1d')&&typeof _0x99dd0c[_0x1d6b('0x1e')]===_0x1d6b('0x1d');var _0x1634e3=_0x4b34f7[_0x1d6b('0x1f')];var _0x189e76=_0x53d2d0?0x0:_0x99dd0c[_0x1d6b('0x1c')];var _0xef01a4=_0x53d2d0?_0x4b34f7['count']:_0x99dd0c[_0x1d6b('0x1c')]+_0x99dd0c[_0x1d6b('0x1e')];var _0xde31d9;if(_0xef01a4>=_0x1634e3){_0xef01a4=_0x1634e3;_0xde31d9=0xc8;}else{_0xde31d9=0xce;}_0x55c313[_0x1d6b('0x19')](_0xde31d9);return _0x55c313[_0x1d6b('0x20')](_0x1d6b('0x21'),_0x189e76+'-'+_0xef01a4+'/'+_0x1634e3)[_0x1d6b('0x1b')](_0x4b34f7);}return null;};}function patchUpdates(_0x5eed1c){return function(_0x497225){try{jsonpatch[_0x1d6b('0x22')](_0x497225,_0x5eed1c,!![]);}catch(_0x906f9b){return BPromise[_0x1d6b('0x23')](_0x906f9b);}return _0x497225[_0x1d6b('0x24')]();};}function saveUpdates(_0x1c45d5,_0x583219){return function(_0x1a9f9c){if(_0x1a9f9c){return _0x1a9f9c['update'](_0x1c45d5)[_0x1d6b('0x25')](function(_0x4b9d62){return _0x4b9d62;});}return null;};}function removeEntity(_0xe94d8d,_0x59cc6b){return function(_0x809651){if(_0x809651){return _0x809651['destroy']()[_0x1d6b('0x25')](function(){_0xe94d8d[_0x1d6b('0x19')](0xcc)[_0x1d6b('0x1a')]();});}};}function handleEntityNotFound(_0x40093d,_0x23d3dc){return function(_0x27fa72){if(!_0x27fa72){_0x40093d['sendStatus'](0x194);}return _0x27fa72;};}function handleError(_0x2b4c7f,_0x21b7e9){_0x21b7e9=_0x21b7e9||0x1f4;return function(_0x923683){logger['error'](_0x923683[_0x1d6b('0x26')]);if(_0x923683[_0x1d6b('0x27')]){delete _0x923683[_0x1d6b('0x27')];}_0x2b4c7f[_0x1d6b('0x19')](_0x21b7e9)['send'](_0x923683);};}exports[_0x1d6b('0x28')]=function(_0x152619,_0x2d502e){var _0x2bc46f={},_0x5f31bc={},_0xf863d5={'count':0x0,'rows':[]};var _0x4279e8=_[_0x1d6b('0x29')](db[_0x1d6b('0x2a')][_0x1d6b('0x2b')],function(_0x5515d6){return{'name':_0x5515d6[_0x1d6b('0x2c')],'type':_0x5515d6['type'][_0x1d6b('0x2d')]};});_0x5f31bc[_0x1d6b('0x2e')]=_['map'](_0x4279e8,_0x1d6b('0x27'));_0x5f31bc[_0x1d6b('0x2f')]=_[_0x1d6b('0x30')](_0x152619[_0x1d6b('0x2f')]);_0x5f31bc[_0x1d6b('0x31')]=_['intersection'](_0x5f31bc[_0x1d6b('0x2e')],_0x5f31bc[_0x1d6b('0x2f')]);_0x2bc46f[_0x1d6b('0x32')]=_[_0x1d6b('0x33')](_0x5f31bc[_0x1d6b('0x2e')],qs[_0x1d6b('0x34')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x34')]));_0x2bc46f[_0x1d6b('0x32')]=_0x2bc46f[_0x1d6b('0x32')][_0x1d6b('0x35')]?_0x2bc46f[_0x1d6b('0x32')]:_0x5f31bc[_0x1d6b('0x2e')];if(!_0x152619['query'][_0x1d6b('0x36')](_0x1d6b('0x37'))){_0x2bc46f['limit']=qs[_0x1d6b('0x1e')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x1e')]);_0x2bc46f[_0x1d6b('0x1c')]=qs[_0x1d6b('0x1c')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x1c')]);}_0x2bc46f[_0x1d6b('0x38')]=qs[_0x1d6b('0x39')](_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x39')]);_0x2bc46f[_0x1d6b('0x3a')]=qs['filters'](_[_0x1d6b('0x3b')](_0x152619[_0x1d6b('0x2f')],_0x5f31bc[_0x1d6b('0x31')]),_0x4279e8);if(_0x152619['query']['filter']){_0x2bc46f[_0x1d6b('0x3a')]=_[_0x1d6b('0x3c')](_0x2bc46f[_0x1d6b('0x3a')],{'$or':_[_0x1d6b('0x29')](_0x4279e8,function(_0x5ab40c){if(_0x5ab40c[_0x1d6b('0x3d')]!=='VIRTUAL'){var _0x48c10a={};_0x48c10a[_0x5ab40c[_0x1d6b('0x27')]]={'$like':'%'+_0x152619[_0x1d6b('0x2f')][_0x1d6b('0x3e')]+'%'};return _0x48c10a;}})});}_0x2bc46f=_['merge']({},_0x2bc46f,_0x152619[_0x1d6b('0x3f')]);var _0x1f45a8={'where':_0x2bc46f[_0x1d6b('0x3a')]};return db[_0x1d6b('0x2a')][_0x1d6b('0x1f')](_0x1f45a8)[_0x1d6b('0x25')](function(_0x4ee312){_0xf863d5[_0x1d6b('0x1f')]=_0x4ee312;if(_0x152619[_0x1d6b('0x2f')]['includeAll']){_0x2bc46f[_0x1d6b('0x40')]=[{'all':!![]}];}return db[_0x1d6b('0x2a')]['findAll'](_0x2bc46f);})['then'](function(_0x44f429){_0xf863d5[_0x1d6b('0x41')]=_0x44f429;return _0xf863d5;})[_0x1d6b('0x25')](respondWithFilteredResult(_0x2d502e,_0x2bc46f))[_0x1d6b('0x42')](handleError(_0x2d502e,null));};exports[_0x1d6b('0x43')]=function(_0xf6d3d6,_0xd475b8){var _0x289f4d={'raw':!![],'where':{'id':_0xf6d3d6[_0x1d6b('0x44')]['id']}},_0x49724f={};_0x49724f[_0x1d6b('0x2e')]=_['keys'](db[_0x1d6b('0x2a')][_0x1d6b('0x2b')]);_0x49724f['query']=_[_0x1d6b('0x30')](_0xf6d3d6[_0x1d6b('0x2f')]);_0x49724f[_0x1d6b('0x31')]=_[_0x1d6b('0x33')](_0x49724f[_0x1d6b('0x2e')],_0x49724f[_0x1d6b('0x2f')]);_0x289f4d[_0x1d6b('0x32')]=_[_0x1d6b('0x33')](_0x49724f[_0x1d6b('0x2e')],qs['fields'](_0xf6d3d6[_0x1d6b('0x2f')][_0x1d6b('0x34')]));_0x289f4d['attributes']=_0x289f4d[_0x1d6b('0x32')][_0x1d6b('0x35')]?_0x289f4d[_0x1d6b('0x32')]:_0x49724f['model'];if(_0xf6d3d6['query'][_0x1d6b('0x45')]){_0x289f4d['include']=[{'all':!![]}];}_0x289f4d=_[_0x1d6b('0x3c')]({},_0x289f4d,_0xf6d3d6['options']);return db['MailServerOut'][_0x1d6b('0x46')](_0x289f4d)['then'](handleEntityNotFound(_0xd475b8,null))['then'](respondWithResult(_0xd475b8,null))[_0x1d6b('0x42')](handleError(_0xd475b8,null));};exports['create']=function(_0x19bf02,_0x53eb6a){return db[_0x1d6b('0x2a')]['create'](_0x19bf02[_0x1d6b('0x47')],{})['then'](respondWithResult(_0x53eb6a,0xc9))[_0x1d6b('0x42')](handleError(_0x53eb6a,null));};exports['update']=function(_0x11e90,_0x3350b6){if(_0x11e90['body']['id']){delete _0x11e90[_0x1d6b('0x47')]['id'];}return db[_0x1d6b('0x2a')][_0x1d6b('0x46')]({'where':{'id':_0x11e90[_0x1d6b('0x44')]['id']}})[_0x1d6b('0x25')](handleEntityNotFound(_0x3350b6,null))[_0x1d6b('0x25')](saveUpdates(_0x11e90['body'],null))[_0x1d6b('0x25')](respondWithResult(_0x3350b6,null))['catch'](handleError(_0x3350b6,null));};exports[_0x1d6b('0x48')]=function(_0x2d433f,_0x573250){return db[_0x1d6b('0x2a')][_0x1d6b('0x46')]({'where':{'id':_0x2d433f[_0x1d6b('0x44')]['id']}})[_0x1d6b('0x25')](handleEntityNotFound(_0x573250,null))['then'](removeEntity(_0x573250,null))[_0x1d6b('0x42')](handleError(_0x573250,null));}; \ No newline at end of file +var _0x3111=['VIRTUAL','options','then','include','findAll','show','params','keys','find','catch','create','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../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','end','name','index','map','MailServerOut','rawAttributes','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where'];(function(_0x1162c2,_0xbd22c){var _0x55a6df=function(_0x4f14ce){while(--_0x4f14ce){_0x1162c2['push'](_0x1162c2['shift']());}};_0x55a6df(++_0xbd22c);}(_0x3111,0x99));var _0x1311=function(_0x584339,_0x198259){_0x584339=_0x584339-0x0;var _0x45e6b7=_0x3111[_0x584339];return _0x45e6b7;};'use strict';var emlformat=require(_0x1311('0x0'));var rimraf=require(_0x1311('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1311('0x2'));var rp=require(_0x1311('0x3'));var moment=require(_0x1311('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1311('0x5'));var util=require(_0x1311('0x6'));var path=require('path');var sox=require(_0x1311('0x7'));var csv=require(_0x1311('0x8'));var ejs=require(_0x1311('0x9'));var fs=require('fs');var fs_extra=require(_0x1311('0xa'));var _=require(_0x1311('0xb'));var squel=require(_0x1311('0xc'));var crypto=require(_0x1311('0xd'));var jsforce=require(_0x1311('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1311('0x8'));var querystring=require(_0x1311('0xf'));var Papa=require(_0x1311('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1311('0x11'));var as=require(_0x1311('0x12'));var hardwareService=require(_0x1311('0x13'));var logger=require(_0x1311('0x14'))(_0x1311('0x15'));var utils=require(_0x1311('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1311('0x17'));var db=require(_0x1311('0x18'))['db'];function respondWithStatusCode(_0x2986fe,_0x3e9cfb){_0x3e9cfb=_0x3e9cfb||0xcc;return function(_0x581da5){if(_0x581da5){return _0x2986fe[_0x1311('0x19')](_0x3e9cfb);}return _0x2986fe[_0x1311('0x1a')](_0x3e9cfb)['end']();};}function respondWithResult(_0x546262,_0x1db464){_0x1db464=_0x1db464||0xc8;return function(_0xd4452e){if(_0xd4452e){return _0x546262[_0x1311('0x1a')](_0x1db464)[_0x1311('0x1b')](_0xd4452e);}};}function respondWithFilteredResult(_0x7a32d9,_0x17d5d1){return function(_0x346d87){if(_0x346d87){var _0x2c2b88=typeof _0x17d5d1[_0x1311('0x1c')]===_0x1311('0x1d')&&typeof _0x17d5d1[_0x1311('0x1e')]===_0x1311('0x1d');var _0x20310e=_0x346d87[_0x1311('0x1f')];var _0x19e8fc=_0x2c2b88?0x0:_0x17d5d1[_0x1311('0x1c')];var _0x3f5ceb=_0x2c2b88?_0x346d87['count']:_0x17d5d1[_0x1311('0x1c')]+_0x17d5d1[_0x1311('0x1e')];var _0x1376d9;if(_0x3f5ceb>=_0x20310e){_0x3f5ceb=_0x20310e;_0x1376d9=0xc8;}else{_0x1376d9=0xce;}_0x7a32d9['status'](_0x1376d9);return _0x7a32d9[_0x1311('0x20')](_0x1311('0x21'),_0x19e8fc+'-'+_0x3f5ceb+'/'+_0x20310e)[_0x1311('0x1b')](_0x346d87);}return null;};}function patchUpdates(_0x1f27dc){return function(_0x577f36){try{jsonpatch[_0x1311('0x22')](_0x577f36,_0x1f27dc,!![]);}catch(_0x35fdf6){return BPromise[_0x1311('0x23')](_0x35fdf6);}return _0x577f36['save']();};}function saveUpdates(_0x40ae95,_0x5296f3){return function(_0x27ea25){if(_0x27ea25){return _0x27ea25['update'](_0x40ae95)['then'](function(_0xbe07d9){return _0xbe07d9;});}return null;};}function removeEntity(_0x4f281c,_0x3cffdd){return function(_0x354978){if(_0x354978){return _0x354978['destroy']()['then'](function(){_0x4f281c[_0x1311('0x1a')](0xcc)[_0x1311('0x24')]();});}};}function handleEntityNotFound(_0x326039,_0x41137f){return function(_0x3b64d7){if(!_0x3b64d7){_0x326039['sendStatus'](0x194);}return _0x3b64d7;};}function handleError(_0x3e9a1c,_0x447c9d){_0x447c9d=_0x447c9d||0x1f4;return function(_0x3a6245){logger['error'](_0x3a6245['stack']);if(_0x3a6245[_0x1311('0x25')]){delete _0x3a6245['name'];}_0x3e9a1c[_0x1311('0x1a')](_0x447c9d)['send'](_0x3a6245);};}exports[_0x1311('0x26')]=function(_0x50de09,_0x551faf){var _0x1aa47d={},_0x2f4fc5={},_0x35d5af={'count':0x0,'rows':[]};var _0x44c493=_[_0x1311('0x27')](db[_0x1311('0x28')][_0x1311('0x29')],function(_0x386c43){return{'name':_0x386c43['fieldName'],'type':_0x386c43['type']['key']};});_0x2f4fc5[_0x1311('0x2a')]=_[_0x1311('0x27')](_0x44c493,'name');_0x2f4fc5['query']=_['keys'](_0x50de09[_0x1311('0x2b')]);_0x2f4fc5[_0x1311('0x2c')]=_[_0x1311('0x2d')](_0x2f4fc5[_0x1311('0x2a')],_0x2f4fc5[_0x1311('0x2b')]);_0x1aa47d[_0x1311('0x2e')]=_[_0x1311('0x2d')](_0x2f4fc5[_0x1311('0x2a')],qs[_0x1311('0x2f')](_0x50de09[_0x1311('0x2b')][_0x1311('0x2f')]));_0x1aa47d[_0x1311('0x2e')]=_0x1aa47d[_0x1311('0x2e')][_0x1311('0x30')]?_0x1aa47d[_0x1311('0x2e')]:_0x2f4fc5['model'];if(!_0x50de09[_0x1311('0x2b')][_0x1311('0x31')](_0x1311('0x32'))){_0x1aa47d['limit']=qs['limit'](_0x50de09['query']['limit']);_0x1aa47d[_0x1311('0x1c')]=qs[_0x1311('0x1c')](_0x50de09[_0x1311('0x2b')][_0x1311('0x1c')]);}_0x1aa47d[_0x1311('0x33')]=qs['sort'](_0x50de09[_0x1311('0x2b')][_0x1311('0x34')]);_0x1aa47d['where']=qs[_0x1311('0x2c')](_[_0x1311('0x35')](_0x50de09[_0x1311('0x2b')],_0x2f4fc5[_0x1311('0x2c')]),_0x44c493);if(_0x50de09['query'][_0x1311('0x36')]){_0x1aa47d['where']=_[_0x1311('0x37')](_0x1aa47d[_0x1311('0x38')],{'$or':_[_0x1311('0x27')](_0x44c493,function(_0x1811c9){if(_0x1811c9['type']!==_0x1311('0x39')){var _0x32ea5b={};_0x32ea5b[_0x1811c9[_0x1311('0x25')]]={'$like':'%'+_0x50de09['query']['filter']+'%'};return _0x32ea5b;}})});}_0x1aa47d=_[_0x1311('0x37')]({},_0x1aa47d,_0x50de09[_0x1311('0x3a')]);var _0x294444={'where':_0x1aa47d['where']};return db[_0x1311('0x28')][_0x1311('0x1f')](_0x294444)[_0x1311('0x3b')](function(_0x219603){_0x35d5af['count']=_0x219603;if(_0x50de09['query']['includeAll']){_0x1aa47d[_0x1311('0x3c')]=[{'all':!![]}];}return db[_0x1311('0x28')][_0x1311('0x3d')](_0x1aa47d);})['then'](function(_0x159bf7){_0x35d5af['rows']=_0x159bf7;return _0x35d5af;})[_0x1311('0x3b')](respondWithFilteredResult(_0x551faf,_0x1aa47d))['catch'](handleError(_0x551faf,null));};exports[_0x1311('0x3e')]=function(_0x175ecd,_0x34aad0){var _0x1a5b7d={'raw':!![],'where':{'id':_0x175ecd[_0x1311('0x3f')]['id']}},_0x129743={};_0x129743[_0x1311('0x2a')]=_['keys'](db[_0x1311('0x28')][_0x1311('0x29')]);_0x129743[_0x1311('0x2b')]=_[_0x1311('0x40')](_0x175ecd[_0x1311('0x2b')]);_0x129743[_0x1311('0x2c')]=_[_0x1311('0x2d')](_0x129743[_0x1311('0x2a')],_0x129743[_0x1311('0x2b')]);_0x1a5b7d['attributes']=_[_0x1311('0x2d')](_0x129743['model'],qs['fields'](_0x175ecd[_0x1311('0x2b')][_0x1311('0x2f')]));_0x1a5b7d[_0x1311('0x2e')]=_0x1a5b7d['attributes'][_0x1311('0x30')]?_0x1a5b7d[_0x1311('0x2e')]:_0x129743[_0x1311('0x2a')];if(_0x175ecd[_0x1311('0x2b')]['includeAll']){_0x1a5b7d[_0x1311('0x3c')]=[{'all':!![]}];}_0x1a5b7d=_[_0x1311('0x37')]({},_0x1a5b7d,_0x175ecd[_0x1311('0x3a')]);return db[_0x1311('0x28')][_0x1311('0x41')](_0x1a5b7d)[_0x1311('0x3b')](handleEntityNotFound(_0x34aad0,null))[_0x1311('0x3b')](respondWithResult(_0x34aad0,null))[_0x1311('0x42')](handleError(_0x34aad0,null));};exports[_0x1311('0x43')]=function(_0x4cdc42,_0x5702c3){return db[_0x1311('0x28')][_0x1311('0x43')](_0x4cdc42[_0x1311('0x44')],{})[_0x1311('0x3b')](respondWithResult(_0x5702c3,0xc9))[_0x1311('0x42')](handleError(_0x5702c3,null));};exports[_0x1311('0x45')]=function(_0x4ae988,_0x205e72){if(_0x4ae988[_0x1311('0x44')]['id']){delete _0x4ae988[_0x1311('0x44')]['id'];}return db[_0x1311('0x28')][_0x1311('0x41')]({'where':{'id':_0x4ae988[_0x1311('0x3f')]['id']}})['then'](handleEntityNotFound(_0x205e72,null))['then'](saveUpdates(_0x4ae988[_0x1311('0x44')],null))['then'](respondWithResult(_0x205e72,null))[_0x1311('0x42')](handleError(_0x205e72,null));};exports['destroy']=function(_0xe46008,_0x2244bb){return db[_0x1311('0x28')][_0x1311('0x41')]({'where':{'id':_0xe46008['params']['id']}})[_0x1311('0x3b')](handleEntityNotFound(_0x2244bb,null))[_0x1311('0x3b')](removeEntity(_0x2244bb,null))[_0x1311('0x42')](handleError(_0x2244bb,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index fd1097a..6ac4cde 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 _0xc867=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','MailServerOut','mail_servers_out','lodash','api'];(function(_0x2d08e1,_0x4f0f49){var _0x4e3398=function(_0x81d28e){while(--_0x81d28e){_0x2d08e1['push'](_0x2d08e1['shift']());}};_0x4e3398(++_0x4f0f49);}(_0xc867,0x127));var _0x7c86=function(_0x59df91,_0x12bb7e){_0x59df91=_0x59df91-0x0;var _0xdd4c=_0xc867[_0x59df91];return _0xdd4c;};'use strict';var _=require(_0x7c86('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x7c86('0x1'));var moment=require('moment');var BPromise=require(_0x7c86('0x2'));var rp=require(_0x7c86('0x3'));var fs=require('fs');var path=require(_0x7c86('0x4'));var rimraf=require(_0x7c86('0x5'));var config=require(_0x7c86('0x6'));var attributes=require(_0x7c86('0x7'));module[_0x7c86('0x8')]=function(_0x54af83,_0x126ead){return _0x54af83['define'](_0x7c86('0x9'),attributes,{'tableName':_0x7c86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4629=['api','request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4629,0x126));var _0x9462=function(_0x247583,_0x1c9c28){_0x247583=_0x247583-0x0;var _0x4af33e=_0x4629[_0x247583];return _0x4af33e;};'use strict';var _=require(_0x9462('0x0'));var util=require(_0x9462('0x1'));var logger=require(_0x9462('0x2'))(_0x9462('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9462('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9462('0x5'));var config=require(_0x9462('0x6'));var attributes=require(_0x9462('0x7'));module[_0x9462('0x8')]=function(_0x454ef8,_0x196326){return _0x454ef8[_0x9462('0x9')]('MailServerOut',attributes,{'tableName':_0x9462('0xa'),'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 5279b08..f3b8f9d 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xff6e43,_0x2d5f5d){var _0x230742=function(_0x27eeab){while(--_0x27eeab){_0xff6e43['push'](_0xff6e43['shift']());}};_0x230742(++_0x2d5f5d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0x1261=['then','info','MailServerOut,\x20%s,\x20%s','request\x20sent','MailServerOut,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x6a300b,_0x978f00){var _0x3ccc4c=function(_0x4f611c){while(--_0x4f611c){_0x6a300b['push'](_0x6a300b['shift']());}};_0x3ccc4c(++_0x978f00);}(_0x1261,0x144));var _0x1126=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0x1261[_0x4bfe08];return _0x1f9125;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailServerOut,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 44d9a2f..478b972 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 _0x92e5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','index','/describe','isAuthenticated','show','post','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','Router'];(function(_0xb1de54,_0x2a118a){var _0x299cde=function(_0x48ce0c){while(--_0x48ce0c){_0xb1de54['push'](_0xb1de54['shift']());}};_0x299cde(++_0x2a118a);}(_0x92e5,0x1b3));var _0x592e=function(_0x2fdd8f,_0x28a3a2){_0x2fdd8f=_0x2fdd8f-0x0;var _0x188db6=_0x92e5[_0x2fdd8f];return _0x188db6;};'use strict';var multer=require(_0x592e('0x0'));var util=require('util');var path=require(_0x592e('0x1'));var timeout=require(_0x592e('0x2'));var express=require(_0x592e('0x3'));var router=express[_0x592e('0x4')]();var fs_extra=require(_0x592e('0x5'));var auth=require(_0x592e('0x6'));var interaction=require(_0x592e('0x7'));var config=require(_0x592e('0x8'));var controller=require(_0x592e('0x9'));router[_0x592e('0xa')]('/',auth['isAuthenticated'](),controller[_0x592e('0xb')]);router['get'](_0x592e('0xc'),auth[_0x592e('0xd')](),controller['describe']);router[_0x592e('0xa')]('/:id',auth[_0x592e('0xd')](),controller[_0x592e('0xe')]);router[_0x592e('0xf')]('/',auth[_0x592e('0xd')](),controller['create']);router[_0x592e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x592e('0x11')]);router[_0x592e('0x12')](_0x592e('0x13'),auth[_0x592e('0xd')](),controller[_0x592e('0x14')]);module[_0x592e('0x15')]=router; \ No newline at end of file +var _0x7033=['post','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show'];(function(_0x5137e8,_0x3be6c6){var _0x12a423=function(_0x12ae48){while(--_0x12ae48){_0x5137e8['push'](_0x5137e8['shift']());}};_0x12a423(++_0x3be6c6);}(_0x7033,0x170));var _0x3703=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x7033[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x3703('0x0'));var util=require('util');var path=require(_0x3703('0x1'));var timeout=require(_0x3703('0x2'));var express=require(_0x3703('0x3'));var router=express['Router']();var fs_extra=require(_0x3703('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3703('0x5'));var config=require(_0x3703('0x6'));var controller=require('./mailSubstatus.controller');router['get']('/',auth[_0x3703('0x7')](),controller[_0x3703('0x8')]);router[_0x3703('0x9')](_0x3703('0xa'),auth[_0x3703('0x7')](),controller['describe']);router[_0x3703('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3703('0xb')]);router[_0x3703('0xc')]('/',auth['isAuthenticated'](),controller[_0x3703('0xd')]);router[_0x3703('0xe')](_0x3703('0xf'),auth[_0x3703('0x7')](),controller[_0x3703('0x10')]);router['delete']('/:id',auth[_0x3703('0x7')](),controller[_0x3703('0x11')]);module[_0x3703('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index a3f97d9..2040c29 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 _0x6c7b=['STRING','sequelize'];(function(_0x36ea83,_0x391794){var _0xae2d52=function(_0x2188cf){while(--_0x2188cf){_0x36ea83['push'](_0x36ea83['shift']());}};_0xae2d52(++_0x391794);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x546013,_0x225096){_0x546013=_0x546013-0x0;var _0x16b3aa=_0x6c7b[_0x546013];return _0x16b3aa;};'use strict';var Sequelize=require(_0xb6c7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb6c7('0x1')]}}; \ No newline at end of file +var _0xcaf2=['sequelize','STRING','name'];(function(_0x464f16,_0x47a060){var _0x2d27de=function(_0x3edc55){while(--_0x3edc55){_0x464f16['push'](_0x464f16['shift']());}};_0x2d27de(++_0x47a060);}(_0xcaf2,0x8a));var _0x2caf=function(_0xf62e6c,_0x160938){_0xf62e6c=_0xf62e6c-0x0;var _0x14234f=_0xcaf2[_0xf62e6c];return _0x14234f;};'use strict';var Sequelize=require(_0x2caf('0x0'));module['exports']={'name':{'type':Sequelize[_0x2caf('0x1')],'unique':_0x2caf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 69a81cb..87b9cf6 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 _0x4364=['params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','map','MailSubstatus','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show'];(function(_0x10f62e,_0x303234){var _0x3e032a=function(_0x2d1502){while(--_0x2d1502){_0x10f62e['push'](_0x10f62e['shift']());}};_0x3e032a(++_0x303234);}(_0x4364,0x12f));var _0x4436=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4364[_0x311c35];return _0x5cc50c;};'use strict';var emlformat=require(_0x4436('0x0'));var rimraf=require(_0x4436('0x1'));var zipdir=require(_0x4436('0x2'));var jsonpatch=require(_0x4436('0x3'));var rp=require(_0x4436('0x4'));var moment=require(_0x4436('0x5'));var BPromise=require(_0x4436('0x6'));var Mustache=require('mustache');var util=require(_0x4436('0x7'));var path=require(_0x4436('0x8'));var sox=require('sox');var csv=require(_0x4436('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4436('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4436('0xb'));var jsforce=require(_0x4436('0xc'));var deskjs=require(_0x4436('0xd'));var toCsv=require(_0x4436('0x9'));var querystring=require(_0x4436('0xe'));var Papa=require('papaparse');var Redis=require(_0x4436('0xf'));var authService=require(_0x4436('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4436('0x11'));var hardwareService=require(_0x4436('0x12'));var logger=require(_0x4436('0x13'))(_0x4436('0x14'));var utils=require(_0x4436('0x15'));var config=require(_0x4436('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4436('0x17'))['db'];function respondWithStatusCode(_0x4ae071,_0x5a0f20){_0x5a0f20=_0x5a0f20||0xcc;return function(_0x2378e9){if(_0x2378e9){return _0x4ae071[_0x4436('0x18')](_0x5a0f20);}return _0x4ae071[_0x4436('0x19')](_0x5a0f20)[_0x4436('0x1a')]();};}function respondWithResult(_0x1ee873,_0x488e60){_0x488e60=_0x488e60||0xc8;return function(_0x4d2ae7){if(_0x4d2ae7){return _0x1ee873['status'](_0x488e60)[_0x4436('0x1b')](_0x4d2ae7);}};}function respondWithFilteredResult(_0x5958ca,_0x29501c){return function(_0x9c7f60){if(_0x9c7f60){var _0xd6ec5f=typeof _0x29501c[_0x4436('0x1c')]===_0x4436('0x1d')&&typeof _0x29501c[_0x4436('0x1e')]==='undefined';var _0x3c404c=_0x9c7f60[_0x4436('0x1f')];var _0x57bd5c=_0xd6ec5f?0x0:_0x29501c['offset'];var _0x509d1f=_0xd6ec5f?_0x9c7f60[_0x4436('0x1f')]:_0x29501c[_0x4436('0x1c')]+_0x29501c[_0x4436('0x1e')];var _0x4d3ea7;if(_0x509d1f>=_0x3c404c){_0x509d1f=_0x3c404c;_0x4d3ea7=0xc8;}else{_0x4d3ea7=0xce;}_0x5958ca['status'](_0x4d3ea7);return _0x5958ca[_0x4436('0x20')](_0x4436('0x21'),_0x57bd5c+'-'+_0x509d1f+'/'+_0x3c404c)[_0x4436('0x1b')](_0x9c7f60);}return null;};}function patchUpdates(_0x7b12b7){return function(_0x8aa1f){try{jsonpatch[_0x4436('0x22')](_0x8aa1f,_0x7b12b7,!![]);}catch(_0x31ed87){return BPromise[_0x4436('0x23')](_0x31ed87);}return _0x8aa1f[_0x4436('0x24')]();};}function saveUpdates(_0x599e65,_0x15dfaf){return function(_0x53323a){if(_0x53323a){return _0x53323a['update'](_0x599e65)['then'](function(_0x4cddda){return _0x4cddda;});}return null;};}function removeEntity(_0x74df5,_0x4f7adb){return function(_0x349663){if(_0x349663){return _0x349663[_0x4436('0x25')]()[_0x4436('0x26')](function(){_0x74df5[_0x4436('0x19')](0xcc)[_0x4436('0x1a')]();});}};}function handleEntityNotFound(_0x22f033,_0x2d66f8){return function(_0x47b16c){if(!_0x47b16c){_0x22f033[_0x4436('0x18')](0x194);}return _0x47b16c;};}function handleError(_0x49e654,_0x483ca0){_0x483ca0=_0x483ca0||0x1f4;return function(_0xe48176){logger['error'](_0xe48176[_0x4436('0x27')]);if(_0xe48176[_0x4436('0x28')]){delete _0xe48176[_0x4436('0x28')];}_0x49e654['status'](_0x483ca0)[_0x4436('0x29')](_0xe48176);};}exports['index']=function(_0x4bb94d,_0x370c5c){var _0x14513c={},_0x13ce6b={},_0x371323={'count':0x0,'rows':[]};var _0x5cf72f=_[_0x4436('0x2a')](db[_0x4436('0x2b')][_0x4436('0x2c')],function(_0x2bcfa4){return{'name':_0x2bcfa4[_0x4436('0x2d')],'type':_0x2bcfa4['type'][_0x4436('0x2e')]};});_0x13ce6b[_0x4436('0x2f')]=_[_0x4436('0x2a')](_0x5cf72f,'name');_0x13ce6b['query']=_['keys'](_0x4bb94d[_0x4436('0x30')]);_0x13ce6b[_0x4436('0x31')]=_[_0x4436('0x32')](_0x13ce6b[_0x4436('0x2f')],_0x13ce6b['query']);_0x14513c['attributes']=_[_0x4436('0x32')](_0x13ce6b['model'],qs['fields'](_0x4bb94d['query'][_0x4436('0x33')]));_0x14513c[_0x4436('0x34')]=_0x14513c['attributes'][_0x4436('0x35')]?_0x14513c[_0x4436('0x34')]:_0x13ce6b[_0x4436('0x2f')];if(!_0x4bb94d[_0x4436('0x30')][_0x4436('0x36')](_0x4436('0x37'))){_0x14513c[_0x4436('0x1e')]=qs[_0x4436('0x1e')](_0x4bb94d[_0x4436('0x30')][_0x4436('0x1e')]);_0x14513c['offset']=qs[_0x4436('0x1c')](_0x4bb94d[_0x4436('0x30')][_0x4436('0x1c')]);}_0x14513c['order']=qs[_0x4436('0x38')](_0x4bb94d[_0x4436('0x30')][_0x4436('0x38')]);_0x14513c['where']=qs[_0x4436('0x31')](_[_0x4436('0x39')](_0x4bb94d['query'],_0x13ce6b['filters']),_0x5cf72f);if(_0x4bb94d[_0x4436('0x30')][_0x4436('0x3a')]){_0x14513c['where']=_[_0x4436('0x3b')](_0x14513c['where'],{'$or':_[_0x4436('0x2a')](_0x5cf72f,function(_0x11c6fa){if(_0x11c6fa[_0x4436('0x3c')]!==_0x4436('0x3d')){var _0x1937fb={};_0x1937fb[_0x11c6fa['name']]={'$like':'%'+_0x4bb94d[_0x4436('0x30')][_0x4436('0x3a')]+'%'};return _0x1937fb;}})});}_0x14513c=_['merge']({},_0x14513c,_0x4bb94d[_0x4436('0x3e')]);var _0x34fe79={'where':_0x14513c['where']};return db['MailSubstatus'][_0x4436('0x1f')](_0x34fe79)[_0x4436('0x26')](function(_0x55f50e){_0x371323['count']=_0x55f50e;if(_0x4bb94d[_0x4436('0x30')][_0x4436('0x3f')]){_0x14513c['include']=[{'all':!![]}];}return db[_0x4436('0x2b')][_0x4436('0x40')](_0x14513c);})[_0x4436('0x26')](function(_0x8e5948){_0x371323['rows']=_0x8e5948;return _0x371323;})[_0x4436('0x26')](respondWithFilteredResult(_0x370c5c,_0x14513c))[_0x4436('0x41')](handleError(_0x370c5c,null));};exports[_0x4436('0x42')]=function(_0x6854ba,_0x3d937a){var _0x11ceda={'raw':!![],'where':{'id':_0x6854ba[_0x4436('0x43')]['id']}},_0x470699={};_0x470699['model']=_[_0x4436('0x44')](db[_0x4436('0x2b')]['rawAttributes']);_0x470699[_0x4436('0x30')]=_[_0x4436('0x44')](_0x6854ba['query']);_0x470699[_0x4436('0x31')]=_['intersection'](_0x470699[_0x4436('0x2f')],_0x470699[_0x4436('0x30')]);_0x11ceda[_0x4436('0x34')]=_[_0x4436('0x32')](_0x470699['model'],qs[_0x4436('0x33')](_0x6854ba[_0x4436('0x30')]['fields']));_0x11ceda['attributes']=_0x11ceda[_0x4436('0x34')][_0x4436('0x35')]?_0x11ceda[_0x4436('0x34')]:_0x470699[_0x4436('0x2f')];if(_0x6854ba[_0x4436('0x30')]['includeAll']){_0x11ceda[_0x4436('0x45')]=[{'all':!![]}];}_0x11ceda=_[_0x4436('0x3b')]({},_0x11ceda,_0x6854ba[_0x4436('0x3e')]);return db[_0x4436('0x2b')][_0x4436('0x46')](_0x11ceda)['then'](handleEntityNotFound(_0x3d937a,null))[_0x4436('0x26')](respondWithResult(_0x3d937a,null))[_0x4436('0x41')](handleError(_0x3d937a,null));};exports[_0x4436('0x47')]=function(_0x24a2d4,_0x27f580){return db[_0x4436('0x2b')][_0x4436('0x47')](_0x24a2d4['body'],{})['then'](respondWithResult(_0x27f580,0xc9))['catch'](handleError(_0x27f580,null));};exports['update']=function(_0x44b527,_0x3b1013){if(_0x44b527[_0x4436('0x48')]['id']){delete _0x44b527[_0x4436('0x48')]['id'];}return db[_0x4436('0x2b')][_0x4436('0x46')]({'where':{'id':_0x44b527[_0x4436('0x43')]['id']}})[_0x4436('0x26')](handleEntityNotFound(_0x3b1013,null))[_0x4436('0x26')](saveUpdates(_0x44b527['body'],null))['then'](respondWithResult(_0x3b1013,null))[_0x4436('0x41')](handleError(_0x3b1013,null));};exports['destroy']=function(_0x230640,_0x5118bf){return db[_0x4436('0x2b')][_0x4436('0x46')]({'where':{'id':_0x230640[_0x4436('0x43')]['id']}})[_0x4436('0x26')](handleEntityNotFound(_0x5118bf,null))[_0x4436('0x26')](removeEntity(_0x5118bf,null))[_0x4436('0x41')](handleError(_0x5118bf,null));};exports[_0x4436('0x49')]=function(_0x4dc3ad,_0x466aac){return db[_0x4436('0x2b')][_0x4436('0x49')]()[_0x4436('0x26')](respondWithResult(_0x466aac,null))[_0x4436('0x41')](handleError(_0x466aac,null));}; \ No newline at end of file +var _0x1c51=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','name','send','index','map','MailSubstatus','fieldName','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','findAll','rows','catch','params','keys','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x4766f2,_0x38b8a1){var _0xe746c2=function(_0x27ad6d){while(--_0x27ad6d){_0x4766f2['push'](_0x4766f2['shift']());}};_0xe746c2(++_0x38b8a1);}(_0x1c51,0x1ef));var _0x11c5=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x1c51[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require(_0x11c5('0x0'));var rimraf=require(_0x11c5('0x1'));var zipdir=require(_0x11c5('0x2'));var jsonpatch=require(_0x11c5('0x3'));var rp=require('request-promise');var moment=require(_0x11c5('0x4'));var BPromise=require(_0x11c5('0x5'));var Mustache=require(_0x11c5('0x6'));var util=require('util');var path=require(_0x11c5('0x7'));var sox=require(_0x11c5('0x8'));var csv=require('to-csv');var ejs=require(_0x11c5('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x11c5('0xa'));var crypto=require(_0x11c5('0xb'));var jsforce=require(_0x11c5('0xc'));var deskjs=require(_0x11c5('0xd'));var toCsv=require(_0x11c5('0xe'));var querystring=require(_0x11c5('0xf'));var Papa=require(_0x11c5('0x10'));var Redis=require(_0x11c5('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x11c5('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x11c5('0x13'));var logger=require(_0x11c5('0x14'))(_0x11c5('0x15'));var utils=require(_0x11c5('0x16'));var config=require(_0x11c5('0x17'));var licenseUtil=require(_0x11c5('0x18'));var db=require(_0x11c5('0x19'))['db'];function respondWithStatusCode(_0x18aa50,_0x1017f2){_0x1017f2=_0x1017f2||0xcc;return function(_0x23a0c5){if(_0x23a0c5){return _0x18aa50[_0x11c5('0x1a')](_0x1017f2);}return _0x18aa50[_0x11c5('0x1b')](_0x1017f2)[_0x11c5('0x1c')]();};}function respondWithResult(_0x70c39d,_0x1dd27e){_0x1dd27e=_0x1dd27e||0xc8;return function(_0x57aae8){if(_0x57aae8){return _0x70c39d[_0x11c5('0x1b')](_0x1dd27e)[_0x11c5('0x1d')](_0x57aae8);}};}function respondWithFilteredResult(_0x25f519,_0x15515d){return function(_0x18860b){if(_0x18860b){var _0x1547d9=typeof _0x15515d['offset']===_0x11c5('0x1e')&&typeof _0x15515d[_0x11c5('0x1f')]===_0x11c5('0x1e');var _0x2e1c8a=_0x18860b[_0x11c5('0x20')];var _0x407314=_0x1547d9?0x0:_0x15515d[_0x11c5('0x21')];var _0x45a963=_0x1547d9?_0x18860b[_0x11c5('0x20')]:_0x15515d['offset']+_0x15515d['limit'];var _0xdb61c4;if(_0x45a963>=_0x2e1c8a){_0x45a963=_0x2e1c8a;_0xdb61c4=0xc8;}else{_0xdb61c4=0xce;}_0x25f519[_0x11c5('0x1b')](_0xdb61c4);return _0x25f519[_0x11c5('0x22')](_0x11c5('0x23'),_0x407314+'-'+_0x45a963+'/'+_0x2e1c8a)['json'](_0x18860b);}return null;};}function patchUpdates(_0x5386af){return function(_0x5039c5){try{jsonpatch[_0x11c5('0x24')](_0x5039c5,_0x5386af,!![]);}catch(_0x4bceb3){return BPromise['reject'](_0x4bceb3);}return _0x5039c5[_0x11c5('0x25')]();};}function saveUpdates(_0x323e0c,_0x1493af){return function(_0x476469){if(_0x476469){return _0x476469[_0x11c5('0x26')](_0x323e0c)[_0x11c5('0x27')](function(_0x3ac462){return _0x3ac462;});}return null;};}function removeEntity(_0x229beb,_0xde3aa1){return function(_0x4ba082){if(_0x4ba082){return _0x4ba082['destroy']()[_0x11c5('0x27')](function(){_0x229beb[_0x11c5('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b22ae,_0x225fcc){return function(_0x4f2110){if(!_0x4f2110){_0x5b22ae['sendStatus'](0x194);}return _0x4f2110;};}function handleError(_0x11d6ac,_0x1895db){_0x1895db=_0x1895db||0x1f4;return function(_0x2a8c2e){logger['error'](_0x2a8c2e['stack']);if(_0x2a8c2e[_0x11c5('0x28')]){delete _0x2a8c2e[_0x11c5('0x28')];}_0x11d6ac['status'](_0x1895db)[_0x11c5('0x29')](_0x2a8c2e);};}exports[_0x11c5('0x2a')]=function(_0x327422,_0x4d1b74){var _0x1acba0={},_0x5aa841={},_0x25ab1c={'count':0x0,'rows':[]};var _0x3e27a6=_[_0x11c5('0x2b')](db[_0x11c5('0x2c')]['rawAttributes'],function(_0x23840f){return{'name':_0x23840f[_0x11c5('0x2d')],'type':_0x23840f['type']['key']};});_0x5aa841[_0x11c5('0x2e')]=_[_0x11c5('0x2b')](_0x3e27a6,_0x11c5('0x28'));_0x5aa841[_0x11c5('0x2f')]=_['keys'](_0x327422[_0x11c5('0x2f')]);_0x5aa841[_0x11c5('0x30')]=_[_0x11c5('0x31')](_0x5aa841['model'],_0x5aa841[_0x11c5('0x2f')]);_0x1acba0['attributes']=_[_0x11c5('0x31')](_0x5aa841['model'],qs[_0x11c5('0x32')](_0x327422[_0x11c5('0x2f')][_0x11c5('0x32')]));_0x1acba0[_0x11c5('0x33')]=_0x1acba0['attributes']['length']?_0x1acba0['attributes']:_0x5aa841['model'];if(!_0x327422[_0x11c5('0x2f')][_0x11c5('0x34')](_0x11c5('0x35'))){_0x1acba0[_0x11c5('0x1f')]=qs[_0x11c5('0x1f')](_0x327422[_0x11c5('0x2f')]['limit']);_0x1acba0[_0x11c5('0x21')]=qs[_0x11c5('0x21')](_0x327422['query'][_0x11c5('0x21')]);}_0x1acba0[_0x11c5('0x36')]=qs['sort'](_0x327422['query'][_0x11c5('0x37')]);_0x1acba0['where']=qs['filters'](_[_0x11c5('0x38')](_0x327422[_0x11c5('0x2f')],_0x5aa841[_0x11c5('0x30')]),_0x3e27a6);if(_0x327422[_0x11c5('0x2f')][_0x11c5('0x39')]){_0x1acba0[_0x11c5('0x3a')]=_[_0x11c5('0x3b')](_0x1acba0['where'],{'$or':_[_0x11c5('0x2b')](_0x3e27a6,function(_0x4cfd0d){if(_0x4cfd0d[_0x11c5('0x3c')]!==_0x11c5('0x3d')){var _0x2e20fc={};_0x2e20fc[_0x4cfd0d[_0x11c5('0x28')]]={'$like':'%'+_0x327422[_0x11c5('0x2f')]['filter']+'%'};return _0x2e20fc;}})});}_0x1acba0=_[_0x11c5('0x3b')]({},_0x1acba0,_0x327422['options']);var _0x80248e={'where':_0x1acba0[_0x11c5('0x3a')]};return db[_0x11c5('0x2c')][_0x11c5('0x20')](_0x80248e)[_0x11c5('0x27')](function(_0x199c1f){_0x25ab1c[_0x11c5('0x20')]=_0x199c1f;if(_0x327422['query']['includeAll']){_0x1acba0['include']=[{'all':!![]}];}return db['MailSubstatus'][_0x11c5('0x3e')](_0x1acba0);})[_0x11c5('0x27')](function(_0x2398c7){_0x25ab1c[_0x11c5('0x3f')]=_0x2398c7;return _0x25ab1c;})['then'](respondWithFilteredResult(_0x4d1b74,_0x1acba0))[_0x11c5('0x40')](handleError(_0x4d1b74,null));};exports['show']=function(_0x388c84,_0x5ab980){var _0x43b392={'raw':!![],'where':{'id':_0x388c84[_0x11c5('0x41')]['id']}},_0x46ed4e={};_0x46ed4e['model']=_['keys'](db[_0x11c5('0x2c')]['rawAttributes']);_0x46ed4e[_0x11c5('0x2f')]=_[_0x11c5('0x42')](_0x388c84['query']);_0x46ed4e[_0x11c5('0x30')]=_[_0x11c5('0x31')](_0x46ed4e[_0x11c5('0x2e')],_0x46ed4e[_0x11c5('0x2f')]);_0x43b392[_0x11c5('0x33')]=_[_0x11c5('0x31')](_0x46ed4e['model'],qs[_0x11c5('0x32')](_0x388c84[_0x11c5('0x2f')][_0x11c5('0x32')]));_0x43b392[_0x11c5('0x33')]=_0x43b392['attributes'][_0x11c5('0x43')]?_0x43b392[_0x11c5('0x33')]:_0x46ed4e['model'];if(_0x388c84['query'][_0x11c5('0x44')]){_0x43b392[_0x11c5('0x45')]=[{'all':!![]}];}_0x43b392=_[_0x11c5('0x3b')]({},_0x43b392,_0x388c84['options']);return db[_0x11c5('0x2c')][_0x11c5('0x46')](_0x43b392)[_0x11c5('0x27')](handleEntityNotFound(_0x5ab980,null))[_0x11c5('0x27')](respondWithResult(_0x5ab980,null))[_0x11c5('0x40')](handleError(_0x5ab980,null));};exports['create']=function(_0x56d516,_0x4d3a54){return db['MailSubstatus'][_0x11c5('0x47')](_0x56d516[_0x11c5('0x48')],{})[_0x11c5('0x27')](respondWithResult(_0x4d3a54,0xc9))[_0x11c5('0x40')](handleError(_0x4d3a54,null));};exports[_0x11c5('0x26')]=function(_0x39f4c0,_0x5cc204){if(_0x39f4c0['body']['id']){delete _0x39f4c0[_0x11c5('0x48')]['id'];}return db['MailSubstatus'][_0x11c5('0x46')]({'where':{'id':_0x39f4c0['params']['id']}})['then'](handleEntityNotFound(_0x5cc204,null))['then'](saveUpdates(_0x39f4c0[_0x11c5('0x48')],null))[_0x11c5('0x27')](respondWithResult(_0x5cc204,null))[_0x11c5('0x40')](handleError(_0x5cc204,null));};exports['destroy']=function(_0x1aedd4,_0x1e090b){return db['MailSubstatus'][_0x11c5('0x46')]({'where':{'id':_0x1aedd4['params']['id']}})[_0x11c5('0x27')](handleEntityNotFound(_0x1e090b,null))[_0x11c5('0x27')](removeEntity(_0x1e090b,null))['catch'](handleError(_0x1e090b,null));};exports[_0x11c5('0x49')]=function(_0x36734e,_0x13255e){return db['MailSubstatus'][_0x11c5('0x49')]()[_0x11c5('0x27')](respondWithResult(_0x13255e,null))[_0x11c5('0x40')](handleError(_0x13255e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index e97d9a2..a41fb22 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 _0x80ef=['update','hook','exports','MailSubstatus','setMaxListeners'];(function(_0xeb4155,_0x587bdd){var _0x511b5c=function(_0x279d7d){while(--_0x279d7d){_0xeb4155['push'](_0xeb4155['shift']());}};_0x511b5c(++_0x587bdd);}(_0x80ef,0x102));var _0xf80e=function(_0x365261,_0x58fea7){_0x365261=_0x365261-0x0;var _0x296d84=_0x80ef[_0x365261];return _0x296d84;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0xf80e('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0xf80e('0x1')](0x0);var events={'afterUpdate':_0xf80e('0x2')};function emitEvent(_0x4ce59a){return function(_0xdb34d3,_0x5d7cd6,_0x23d8c5){MailSubstatusEvents['emit'](_0x4ce59a+':'+_0xdb34d3['id'],_0xdb34d3);MailSubstatusEvents['emit'](_0x4ce59a,_0xdb34d3);_0x23d8c5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailSubstatus[_0xf80e('0x3')](e,emitEvent(event));}}module[_0xf80e('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0xa5f6=['emit','hasOwnProperty','hook','exports','MailSubstatus','setMaxListeners','update'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa5f6,0xc8));var _0x6a5f=function(_0x3590f8,_0xa530ec){_0x3590f8=_0x3590f8-0x0;var _0x29e9d3=_0xa5f6[_0x3590f8];return _0x29e9d3;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x6a5f('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x6a5f('0x1')](0x0);var events={'afterUpdate':_0x6a5f('0x2')};function emitEvent(_0x32edab){return function(_0x24fc0b,_0x803f4e,_0x5aab03){MailSubstatusEvents[_0x6a5f('0x3')](_0x32edab+':'+_0x24fc0b['id'],_0x24fc0b);MailSubstatusEvents[_0x6a5f('0x3')](_0x32edab,_0x24fc0b);_0x5aab03(null);};}for(var e in events){if(events[_0x6a5f('0x4')](e)){var event=events[e];MailSubstatus[_0x6a5f('0x5')](e,emitEvent(event));}}module[_0x6a5f('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 692c618..5ce5625 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 _0x3cb6=['MailSubstatus','mail_substatuses','Condition','name','_previousDataValues','catch','./mailSubstatus.attributes','exports','models','define'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3cb6,0x7e));var _0x63cb=function(_0x57c79f,_0xdfe47d){_0x57c79f=_0x57c79f-0x0;var _0x1840d1=_0x3cb6[_0x57c79f];return _0x1840d1;};'use strict';var attributes=require(_0x63cb('0x0'));module[_0x63cb('0x1')]=function(_0x5a838d){var _0x3e0cf8=_0x5a838d[_0x63cb('0x2')];return _0x5a838d[_0x63cb('0x3')](_0x63cb('0x4'),attributes,{'tableName':_0x63cb('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x588c99,_0x4661d9,_0x4df0fa){return _0x3e0cf8[_0x63cb('0x6')]['update']({'value':_0x588c99[_0x63cb('0x7')]},{'where':{'field':'mailSubstatus','value':_0x588c99[_0x63cb('0x8')][_0x63cb('0x7')]}})['then'](function(){_0x4df0fa();})[_0x63cb('0x9')](function(_0x3ef997){_0x4df0fa(_0x3ef997);});}}});}; \ No newline at end of file +var _0xfc25=['_previousDataValues','name','then','catch','./mailSubstatus.attributes','models','define','MailSubstatus','mail_substatuses','Condition','update','mailSubstatus'];(function(_0x41ed97,_0x434874){var _0x1244aa=function(_0xa0cb42){while(--_0xa0cb42){_0x41ed97['push'](_0x41ed97['shift']());}};_0x1244aa(++_0x434874);}(_0xfc25,0x130));var _0x5fc2=function(_0x42ad4a,_0x334b47){_0x42ad4a=_0x42ad4a-0x0;var _0x169d12=_0xfc25[_0x42ad4a];return _0x169d12;};'use strict';var attributes=require(_0x5fc2('0x0'));module['exports']=function(_0x37744d){var _0x8704ea=_0x37744d[_0x5fc2('0x1')];return _0x37744d[_0x5fc2('0x2')](_0x5fc2('0x3'),attributes,{'tableName':_0x5fc2('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x1a3c74,_0x20e76b,_0x2fe2c6){return _0x8704ea[_0x5fc2('0x5')][_0x5fc2('0x6')]({'value':_0x1a3c74['name']},{'where':{'field':_0x5fc2('0x7'),'value':_0x1a3c74[_0x5fc2('0x8')][_0x5fc2('0x9')]}})[_0x5fc2('0xa')](function(){_0x2fe2c6();})[_0x5fc2('0xb')](function(_0x5c699a){_0x2fe2c6(_0x5c699a);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index e609f10..7de0fe4 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 _0xef37=['rpc','../../config/environment','client','http','request','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x23ff36,_0x1b551f){var _0x7e1b0c=function(_0x4c8b4c){while(--_0x4c8b4c){_0x23ff36['push'](_0x23ff36['shift']());}};_0x7e1b0c(++_0x1b551f);}(_0xef37,0x92));var _0x7ef3=function(_0x4c852c,_0x3114a1){_0x4c852c=_0x4c852c-0x0;var _0x2e3b3f=_0xef37[_0x4c852c];return _0x2e3b3f;};'use strict';var _=require(_0x7ef3('0x0'));var util=require('util');var moment=require(_0x7ef3('0x1'));var BPromise=require(_0x7ef3('0x2'));var rs=require(_0x7ef3('0x3'));var fs=require('fs');var Redis=require(_0x7ef3('0x4'));var db=require(_0x7ef3('0x5'))['db'];var utils=require(_0x7ef3('0x6'));var logger=require(_0x7ef3('0x7'))(_0x7ef3('0x8'));var config=require(_0x7ef3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7ef3('0xa')][_0x7ef3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x115120,_0x4f2eba,_0x261fc8){return new BPromise(function(_0x5b1daa,_0x25f7aa){return client[_0x7ef3('0xc')](_0x115120,_0x261fc8)['then'](function(_0x28aefb){logger[_0x7ef3('0xd')](_0x7ef3('0xe'),_0x4f2eba,'request\x20sent');logger[_0x7ef3('0xf')](_0x7ef3('0x10'),_0x4f2eba,_0x7ef3('0x11'),JSON['stringify'](_0x28aefb));if(_0x28aefb[_0x7ef3('0x12')]){if(_0x28aefb[_0x7ef3('0x12')]['code']===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4f2eba,_0x28aefb[_0x7ef3('0x12')]['message']);return _0x25f7aa(_0x28aefb['error'][_0x7ef3('0x13')]);}logger['error'](_0x7ef3('0xe'),_0x4f2eba,_0x28aefb[_0x7ef3('0x12')][_0x7ef3('0x13')]);return _0x5b1daa(_0x28aefb[_0x7ef3('0x12')][_0x7ef3('0x13')]);}else{logger[_0x7ef3('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x4f2eba,_0x7ef3('0x11'));_0x5b1daa(_0x28aefb[_0x7ef3('0x14')]['message']);}})[_0x7ef3('0x15')](function(_0x431122){logger['error'](_0x7ef3('0xe'),_0x4f2eba,_0x431122);_0x25f7aa(_0x431122);});});} \ No newline at end of file +var _0x77aa=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MailSubstatus,\x20%s,\x20%s','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5bd426,_0x4878e5){var _0x23a7eb=function(_0x594b42){while(--_0x594b42){_0x5bd426['push'](_0x5bd426['shift']());}};_0x23a7eb(++_0x4878e5);}(_0x77aa,0x161));var _0xa77a=function(_0x52b192,_0x1747ed){_0x52b192=_0x52b192-0x0;var _0x1d9cd4=_0x77aa[_0x52b192];return _0x1d9cd4;};'use strict';var _=require(_0xa77a('0x0'));var util=require(_0xa77a('0x1'));var moment=require(_0xa77a('0x2'));var BPromise=require(_0xa77a('0x3'));var rs=require(_0xa77a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa77a('0x5'))['db'];var utils=require(_0xa77a('0x6'));var logger=require(_0xa77a('0x7'))(_0xa77a('0x8'));var config=require(_0xa77a('0x9'));var jayson=require(_0xa77a('0xa'));var client=jayson[_0xa77a('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd2e6d,_0x5cdb29,_0x3e10ca){return new BPromise(function(_0x1689e4,_0x3ddc98){return client[_0xa77a('0xc')](_0xd2e6d,_0x3e10ca)[_0xa77a('0xd')](function(_0x5146b5){logger[_0xa77a('0xe')](_0xa77a('0xf'),_0x5cdb29,'request\x20sent');logger[_0xa77a('0x10')](_0xa77a('0x11'),_0x5cdb29,_0xa77a('0x12'),JSON[_0xa77a('0x13')](_0x5146b5));if(_0x5146b5['error']){if(_0x5146b5[_0xa77a('0x14')][_0xa77a('0x15')]===0x1f4){logger[_0xa77a('0x14')](_0xa77a('0xf'),_0x5cdb29,_0x5146b5[_0xa77a('0x14')][_0xa77a('0x16')]);return _0x3ddc98(_0x5146b5[_0xa77a('0x14')][_0xa77a('0x16')]);}logger['error'](_0xa77a('0xf'),_0x5cdb29,_0x5146b5['error'][_0xa77a('0x16')]);return _0x1689e4(_0x5146b5[_0xa77a('0x14')]['message']);}else{logger[_0xa77a('0xe')](_0xa77a('0xf'),_0x5cdb29,'request\x20sent');_0x1689e4(_0x5146b5[_0xa77a('0x17')]['message']);}})[_0xa77a('0x18')](function(_0xadc8c3){logger[_0xa77a('0x14')](_0xa77a('0xf'),_0x5cdb29,_0xadc8c3);_0x3ddc98(_0xadc8c3);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ac57ba3..de62737 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 _0xbbe2=['Router','../../components/auth/service','../../config/environment','./mailTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','update','delete','exports','multer','util','path','express'];(function(_0x488b2f,_0x402d3d){var _0x1a5280=function(_0xc53d0e){while(--_0xc53d0e){_0x488b2f['push'](_0x488b2f['shift']());}};_0x1a5280(++_0x402d3d);}(_0xbbe2,0x176));var _0x2bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe2[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2bbe('0x0'));var util=require(_0x2bbe('0x1'));var path=require(_0x2bbe('0x2'));var timeout=require('connect-timeout');var express=require(_0x2bbe('0x3'));var router=express[_0x2bbe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2bbe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2bbe('0x6'));var controller=require(_0x2bbe('0x7'));router['get']('/',auth[_0x2bbe('0x8')](),controller[_0x2bbe('0x9')]);router[_0x2bbe('0xa')](_0x2bbe('0xb'),auth[_0x2bbe('0x8')](),controller[_0x2bbe('0xc')]);router[_0x2bbe('0xa')](_0x2bbe('0xd'),auth[_0x2bbe('0x8')](),controller['show']);router[_0x2bbe('0xe')]('/',auth[_0x2bbe('0x8')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x2bbe('0xf')]);router[_0x2bbe('0x10')]('/:id',auth[_0x2bbe('0x8')](),controller['destroy']);module[_0x2bbe('0x11')]=router; \ No newline at end of file +var _0xb9e4=['index','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','isAuthenticated'];(function(_0x3d5589,_0x595150){var _0x81d899=function(_0x1adcff){while(--_0x1adcff){_0x3d5589['push'](_0x3d5589['shift']());}};_0x81d899(++_0x595150);}(_0xb9e4,0x174));var _0x4b9e=function(_0xa8fd9,_0x3ee444){_0xa8fd9=_0xa8fd9-0x0;var _0x39cd13=_0xb9e4[_0xa8fd9];return _0x39cd13;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4b9e('0x0'));var timeout=require('connect-timeout');var express=require(_0x4b9e('0x1'));var router=express[_0x4b9e('0x2')]();var fs_extra=require(_0x4b9e('0x3'));var auth=require(_0x4b9e('0x4'));var interaction=require(_0x4b9e('0x5'));var config=require('../../config/environment');var controller=require(_0x4b9e('0x6'));router['get']('/',auth[_0x4b9e('0x7')](),controller[_0x4b9e('0x8')]);router[_0x4b9e('0x9')](_0x4b9e('0xa'),auth['isAuthenticated'](),controller[_0x4b9e('0xb')]);router['get'](_0x4b9e('0xc'),auth[_0x4b9e('0x7')](),controller[_0x4b9e('0xd')]);router[_0x4b9e('0xe')]('/',auth['isAuthenticated'](),controller[_0x4b9e('0xf')]);router[_0x4b9e('0x10')](_0x4b9e('0xc'),auth[_0x4b9e('0x7')](),controller[_0x4b9e('0x11')]);router[_0x4b9e('0x12')]('/:id',auth[_0x4b9e('0x7')](),controller['destroy']);module[_0x4b9e('0x13')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index db805a8..62f3e6b 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x363245,_0x1b02bf){var _0x5738e2=function(_0x260d42){while(--_0x260d42){_0x363245['push'](_0x363245['shift']());}};_0x5738e2(++_0x1b02bf);}(_0xe706,0xa3));var _0x6e70=function(_0x28578d,_0xcf5cf0){_0x28578d=_0x28578d-0x0;var _0x524826=_0xe706[_0x28578d];return _0x524826;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x2aa01,_0x5e1f5b){var _0x49a6cb=function(_0x5c49d9){while(--_0x5c49d9){_0x2aa01['push'](_0x2aa01['shift']());}};_0x49a6cb(++_0x5e1f5b);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0xcb91[_0x2265da];return _0x430c2b;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index bf4f50d..a166bf1 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 _0x0a0c=['send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','merge','where','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','catch','show','params','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','offset','count','set','Content-Range','json','reject','save','then','error','stack','name'];(function(_0x3c2fff,_0x32610b){var _0x1580c5=function(_0x16c2ec){while(--_0x16c2ec){_0x3c2fff['push'](_0x3c2fff['shift']());}};_0x1580c5(++_0x32610b);}(_0x0a0c,0x1df));var _0xc0a0=function(_0x41a07f,_0x2f06fb){_0x41a07f=_0x41a07f-0x0;var _0x2de0ed=_0x0a0c[_0x41a07f];return _0x2de0ed;};'use strict';var emlformat=require(_0xc0a0('0x0'));var rimraf=require(_0xc0a0('0x1'));var zipdir=require(_0xc0a0('0x2'));var jsonpatch=require(_0xc0a0('0x3'));var rp=require('request-promise');var moment=require(_0xc0a0('0x4'));var BPromise=require(_0xc0a0('0x5'));var Mustache=require(_0xc0a0('0x6'));var util=require(_0xc0a0('0x7'));var path=require(_0xc0a0('0x8'));var sox=require(_0xc0a0('0x9'));var csv=require(_0xc0a0('0xa'));var ejs=require(_0xc0a0('0xb'));var fs=require('fs');var fs_extra=require(_0xc0a0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc0a0('0xd'));var jsforce=require(_0xc0a0('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc0a0('0xa'));var querystring=require(_0xc0a0('0xf'));var Papa=require(_0xc0a0('0x10'));var Redis=require(_0xc0a0('0x11'));var authService=require(_0xc0a0('0x12'));var qs=require(_0xc0a0('0x13'));var as=require(_0xc0a0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc0a0('0x15'));var licenseUtil=require(_0xc0a0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3781cf,_0xe3425e){_0xe3425e=_0xe3425e||0xcc;return function(_0x30e754){if(_0x30e754){return _0x3781cf[_0xc0a0('0x17')](_0xe3425e);}return _0x3781cf[_0xc0a0('0x18')](_0xe3425e)[_0xc0a0('0x19')]();};}function respondWithResult(_0x58904a,_0x129c73){_0x129c73=_0x129c73||0xc8;return function(_0x39b5bc){if(_0x39b5bc){return _0x58904a['status'](_0x129c73)['json'](_0x39b5bc);}};}function respondWithFilteredResult(_0x4f84f4,_0x9c03de){return function(_0x9577c3){if(_0x9577c3){var _0x3c9ffa=typeof _0x9c03de['offset']===_0xc0a0('0x1a')&&typeof _0x9c03de[_0xc0a0('0x1b')]===_0xc0a0('0x1a');var _0x2f4b0c=_0x9577c3['count'];var _0x150f4a=_0x3c9ffa?0x0:_0x9c03de[_0xc0a0('0x1c')];var _0x4dff3e=_0x3c9ffa?_0x9577c3[_0xc0a0('0x1d')]:_0x9c03de['offset']+_0x9c03de['limit'];var _0x5db9cc;if(_0x4dff3e>=_0x2f4b0c){_0x4dff3e=_0x2f4b0c;_0x5db9cc=0xc8;}else{_0x5db9cc=0xce;}_0x4f84f4[_0xc0a0('0x18')](_0x5db9cc);return _0x4f84f4[_0xc0a0('0x1e')](_0xc0a0('0x1f'),_0x150f4a+'-'+_0x4dff3e+'/'+_0x2f4b0c)[_0xc0a0('0x20')](_0x9577c3);}return null;};}function patchUpdates(_0x4988ec){return function(_0x30a9e9){try{jsonpatch['apply'](_0x30a9e9,_0x4988ec,!![]);}catch(_0x1cbeab){return BPromise[_0xc0a0('0x21')](_0x1cbeab);}return _0x30a9e9[_0xc0a0('0x22')]();};}function saveUpdates(_0x382669,_0x38125a){return function(_0x2b47cc){if(_0x2b47cc){return _0x2b47cc['update'](_0x382669)[_0xc0a0('0x23')](function(_0x11aad4){return _0x11aad4;});}return null;};}function removeEntity(_0x52dafa,_0x45c550){return function(_0x39a0f0){if(_0x39a0f0){return _0x39a0f0['destroy']()['then'](function(){_0x52dafa[_0xc0a0('0x18')](0xcc)[_0xc0a0('0x19')]();});}};}function handleEntityNotFound(_0x5b3e46,_0x231f41){return function(_0x455798){if(!_0x455798){_0x5b3e46[_0xc0a0('0x17')](0x194);}return _0x455798;};}function handleError(_0xca00c2,_0x144dd2){_0x144dd2=_0x144dd2||0x1f4;return function(_0x2b5185){logger[_0xc0a0('0x24')](_0x2b5185[_0xc0a0('0x25')]);if(_0x2b5185[_0xc0a0('0x26')]){delete _0x2b5185[_0xc0a0('0x26')];}_0xca00c2[_0xc0a0('0x18')](_0x144dd2)[_0xc0a0('0x27')](_0x2b5185);};}exports['index']=function(_0x38fc7f,_0x3cc2dd){var _0x57408e={},_0x341c90={},_0x6fa3f9={'count':0x0,'rows':[]};var _0x595ef5=_[_0xc0a0('0x28')](db['MailTransferReport'][_0xc0a0('0x29')],function(_0x5f5927){return{'name':_0x5f5927[_0xc0a0('0x2a')],'type':_0x5f5927[_0xc0a0('0x2b')][_0xc0a0('0x2c')]};});_0x341c90[_0xc0a0('0x2d')]=_[_0xc0a0('0x28')](_0x595ef5,_0xc0a0('0x26'));_0x341c90[_0xc0a0('0x2e')]=_[_0xc0a0('0x2f')](_0x38fc7f[_0xc0a0('0x2e')]);_0x341c90[_0xc0a0('0x30')]=_[_0xc0a0('0x31')](_0x341c90[_0xc0a0('0x2d')],_0x341c90[_0xc0a0('0x2e')]);_0x57408e[_0xc0a0('0x32')]=_[_0xc0a0('0x31')](_0x341c90['model'],qs[_0xc0a0('0x33')](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x33')]));_0x57408e['attributes']=_0x57408e['attributes']['length']?_0x57408e[_0xc0a0('0x32')]:_0x341c90[_0xc0a0('0x2d')];if(!_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x34')]('nolimit')){_0x57408e['limit']=qs[_0xc0a0('0x1b')](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x1b')]);_0x57408e[_0xc0a0('0x1c')]=qs['offset'](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x1c')]);}_0x57408e[_0xc0a0('0x35')]=qs[_0xc0a0('0x36')](_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x36')]);_0x57408e['where']=qs['filters'](_[_0xc0a0('0x37')](_0x38fc7f[_0xc0a0('0x2e')],_0x341c90[_0xc0a0('0x30')]),_0x595ef5);if(_0x38fc7f['query'][_0xc0a0('0x38')]){_0x57408e['where']=_[_0xc0a0('0x39')](_0x57408e[_0xc0a0('0x3a')],{'$or':_[_0xc0a0('0x28')](_0x595ef5,function(_0x2c9f2f){if(_0x2c9f2f['type']!==_0xc0a0('0x3b')){var _0x2a2d4b={};_0x2a2d4b[_0x2c9f2f[_0xc0a0('0x26')]]={'$like':'%'+_0x38fc7f[_0xc0a0('0x2e')][_0xc0a0('0x38')]+'%'};return _0x2a2d4b;}})});}_0x57408e=_['merge']({},_0x57408e,_0x38fc7f[_0xc0a0('0x3c')]);var _0x24437d={'where':_0x57408e['where']};return db[_0xc0a0('0x3d')][_0xc0a0('0x1d')](_0x24437d)['then'](function(_0x43d4ba){_0x6fa3f9[_0xc0a0('0x1d')]=_0x43d4ba;if(_0x38fc7f['query'][_0xc0a0('0x3e')]){_0x57408e[_0xc0a0('0x3f')]=[{'all':!![]}];}return db['MailTransferReport'][_0xc0a0('0x40')](_0x57408e);})[_0xc0a0('0x23')](function(_0x5d95b8){_0x6fa3f9['rows']=_0x5d95b8;return _0x6fa3f9;})[_0xc0a0('0x23')](respondWithFilteredResult(_0x3cc2dd,_0x57408e))[_0xc0a0('0x41')](handleError(_0x3cc2dd,null));};exports[_0xc0a0('0x42')]=function(_0x210bb3,_0xe49c33){var _0x51f8b0={'raw':!![],'where':{'id':_0x210bb3[_0xc0a0('0x43')]['id']}},_0x5de3c8={};_0x5de3c8[_0xc0a0('0x2d')]=_[_0xc0a0('0x2f')](db[_0xc0a0('0x3d')][_0xc0a0('0x29')]);_0x5de3c8['query']=_[_0xc0a0('0x2f')](_0x210bb3[_0xc0a0('0x2e')]);_0x5de3c8[_0xc0a0('0x30')]=_['intersection'](_0x5de3c8[_0xc0a0('0x2d')],_0x5de3c8[_0xc0a0('0x2e')]);_0x51f8b0['attributes']=_[_0xc0a0('0x31')](_0x5de3c8['model'],qs[_0xc0a0('0x33')](_0x210bb3[_0xc0a0('0x2e')][_0xc0a0('0x33')]));_0x51f8b0[_0xc0a0('0x32')]=_0x51f8b0[_0xc0a0('0x32')][_0xc0a0('0x44')]?_0x51f8b0['attributes']:_0x5de3c8[_0xc0a0('0x2d')];if(_0x210bb3['query'][_0xc0a0('0x3e')]){_0x51f8b0[_0xc0a0('0x3f')]=[{'all':!![]}];}_0x51f8b0=_[_0xc0a0('0x39')]({},_0x51f8b0,_0x210bb3[_0xc0a0('0x3c')]);return db[_0xc0a0('0x3d')][_0xc0a0('0x45')](_0x51f8b0)['then'](handleEntityNotFound(_0xe49c33,null))[_0xc0a0('0x23')](respondWithResult(_0xe49c33,null))['catch'](handleError(_0xe49c33,null));};exports[_0xc0a0('0x46')]=function(_0x2e4b2e,_0x49ac9e){return db[_0xc0a0('0x3d')][_0xc0a0('0x46')](_0x2e4b2e['body'],{})['then'](respondWithResult(_0x49ac9e,0xc9))[_0xc0a0('0x41')](handleError(_0x49ac9e,null));};exports[_0xc0a0('0x47')]=function(_0x2791c0,_0x272dff){if(_0x2791c0[_0xc0a0('0x48')]['id']){delete _0x2791c0[_0xc0a0('0x48')]['id'];}return db[_0xc0a0('0x3d')]['find']({'where':{'id':_0x2791c0['params']['id']}})['then'](handleEntityNotFound(_0x272dff,null))[_0xc0a0('0x23')](saveUpdates(_0x2791c0[_0xc0a0('0x48')],null))[_0xc0a0('0x23')](respondWithResult(_0x272dff,null))[_0xc0a0('0x41')](handleError(_0x272dff,null));};exports['destroy']=function(_0x20be46,_0x55931d){return db[_0xc0a0('0x3d')]['find']({'where':{'id':_0x20be46[_0xc0a0('0x43')]['id']}})[_0xc0a0('0x23')](handleEntityNotFound(_0x55931d,null))[_0xc0a0('0x23')](removeEntity(_0x55931d,null))[_0xc0a0('0x41')](handleError(_0x55931d,null));};exports['describe']=function(_0x498d87,_0x2de31e){return db[_0xc0a0('0x3d')][_0xc0a0('0x49')]()[_0xc0a0('0x23')](respondWithResult(_0x2de31e,null))[_0xc0a0('0x41')](handleError(_0x2de31e,null));}; \ No newline at end of file +var _0xf4f9=['keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','destroy','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','model','query'];(function(_0x4d2566,_0x3a7d68){var _0x3bb19f=function(_0x270a2e){while(--_0x270a2e){_0x4d2566['push'](_0x4d2566['shift']());}};_0x3bb19f(++_0x3a7d68);}(_0xf4f9,0x1cb));var _0x9f4f=function(_0x177ff5,_0xe91ce5){_0x177ff5=_0x177ff5-0x0;var _0x37b356=_0xf4f9[_0x177ff5];return _0x37b356;};'use strict';var emlformat=require(_0x9f4f('0x0'));var rimraf=require(_0x9f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9f4f('0x2'));var rp=require('request-promise');var moment=require(_0x9f4f('0x3'));var BPromise=require(_0x9f4f('0x4'));var Mustache=require(_0x9f4f('0x5'));var util=require('util');var path=require(_0x9f4f('0x6'));var sox=require(_0x9f4f('0x7'));var csv=require(_0x9f4f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f4f('0x9'));var squel=require(_0x9f4f('0xa'));var crypto=require(_0x9f4f('0xb'));var jsforce=require(_0x9f4f('0xc'));var deskjs=require(_0x9f4f('0xd'));var toCsv=require(_0x9f4f('0x8'));var querystring=require('querystring');var Papa=require(_0x9f4f('0xe'));var Redis=require('ioredis');var authService=require(_0x9f4f('0xf'));var qs=require(_0x9f4f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f4f('0x11'))('api');var utils=require(_0x9f4f('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x9f4f('0x13'));var db=require(_0x9f4f('0x14'))['db'];function respondWithStatusCode(_0x535bb4,_0x45234b){_0x45234b=_0x45234b||0xcc;return function(_0x17924e){if(_0x17924e){return _0x535bb4[_0x9f4f('0x15')](_0x45234b);}return _0x535bb4['status'](_0x45234b)[_0x9f4f('0x16')]();};}function respondWithResult(_0x2764e7,_0x313512){_0x313512=_0x313512||0xc8;return function(_0x93339a){if(_0x93339a){return _0x2764e7[_0x9f4f('0x17')](_0x313512)[_0x9f4f('0x18')](_0x93339a);}};}function respondWithFilteredResult(_0x4f6afb,_0x39e0c9){return function(_0xfe794b){if(_0xfe794b){var _0x205525=typeof _0x39e0c9[_0x9f4f('0x19')]===_0x9f4f('0x1a')&&typeof _0x39e0c9[_0x9f4f('0x1b')]===_0x9f4f('0x1a');var _0x7c6909=_0xfe794b[_0x9f4f('0x1c')];var _0x23d961=_0x205525?0x0:_0x39e0c9['offset'];var _0x123709=_0x205525?_0xfe794b[_0x9f4f('0x1c')]:_0x39e0c9[_0x9f4f('0x19')]+_0x39e0c9[_0x9f4f('0x1b')];var _0x5658ad;if(_0x123709>=_0x7c6909){_0x123709=_0x7c6909;_0x5658ad=0xc8;}else{_0x5658ad=0xce;}_0x4f6afb[_0x9f4f('0x17')](_0x5658ad);return _0x4f6afb['set'](_0x9f4f('0x1d'),_0x23d961+'-'+_0x123709+'/'+_0x7c6909)['json'](_0xfe794b);}return null;};}function patchUpdates(_0x5883b4){return function(_0x21dc94){try{jsonpatch[_0x9f4f('0x1e')](_0x21dc94,_0x5883b4,!![]);}catch(_0x15bbff){return BPromise[_0x9f4f('0x1f')](_0x15bbff);}return _0x21dc94[_0x9f4f('0x20')]();};}function saveUpdates(_0x43c295,_0x186a38){return function(_0x3753da){if(_0x3753da){return _0x3753da['update'](_0x43c295)[_0x9f4f('0x21')](function(_0x2aed98){return _0x2aed98;});}return null;};}function removeEntity(_0x49ae42,_0x1066ea){return function(_0x1461eb){if(_0x1461eb){return _0x1461eb['destroy']()[_0x9f4f('0x21')](function(){_0x49ae42[_0x9f4f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8bdf,_0x373ad0){return function(_0x337a29){if(!_0x337a29){_0x3d8bdf[_0x9f4f('0x15')](0x194);}return _0x337a29;};}function handleError(_0x3714bf,_0x4e16c0){_0x4e16c0=_0x4e16c0||0x1f4;return function(_0x34100a){logger[_0x9f4f('0x22')](_0x34100a['stack']);if(_0x34100a['name']){delete _0x34100a[_0x9f4f('0x23')];}_0x3714bf[_0x9f4f('0x17')](_0x4e16c0)[_0x9f4f('0x24')](_0x34100a);};}exports[_0x9f4f('0x25')]=function(_0x27f740,_0xf7d133){var _0x4bea7d={},_0x73b805={},_0xa36c9d={'count':0x0,'rows':[]};var _0x16a8e9=_[_0x9f4f('0x26')](db[_0x9f4f('0x27')][_0x9f4f('0x28')],function(_0x246407){return{'name':_0x246407[_0x9f4f('0x29')],'type':_0x246407[_0x9f4f('0x2a')]['key']};});_0x73b805[_0x9f4f('0x2b')]=_[_0x9f4f('0x26')](_0x16a8e9,_0x9f4f('0x23'));_0x73b805[_0x9f4f('0x2c')]=_[_0x9f4f('0x2d')](_0x27f740['query']);_0x73b805[_0x9f4f('0x2e')]=_['intersection'](_0x73b805[_0x9f4f('0x2b')],_0x73b805['query']);_0x4bea7d[_0x9f4f('0x2f')]=_['intersection'](_0x73b805[_0x9f4f('0x2b')],qs[_0x9f4f('0x30')](_0x27f740[_0x9f4f('0x2c')][_0x9f4f('0x30')]));_0x4bea7d['attributes']=_0x4bea7d[_0x9f4f('0x2f')][_0x9f4f('0x31')]?_0x4bea7d['attributes']:_0x73b805[_0x9f4f('0x2b')];if(!_0x27f740[_0x9f4f('0x2c')][_0x9f4f('0x32')](_0x9f4f('0x33'))){_0x4bea7d['limit']=qs[_0x9f4f('0x1b')](_0x27f740['query'][_0x9f4f('0x1b')]);_0x4bea7d[_0x9f4f('0x19')]=qs[_0x9f4f('0x19')](_0x27f740[_0x9f4f('0x2c')][_0x9f4f('0x19')]);}_0x4bea7d['order']=qs[_0x9f4f('0x34')](_0x27f740[_0x9f4f('0x2c')][_0x9f4f('0x34')]);_0x4bea7d['where']=qs[_0x9f4f('0x2e')](_[_0x9f4f('0x35')](_0x27f740[_0x9f4f('0x2c')],_0x73b805['filters']),_0x16a8e9);if(_0x27f740[_0x9f4f('0x2c')][_0x9f4f('0x36')]){_0x4bea7d['where']=_[_0x9f4f('0x37')](_0x4bea7d['where'],{'$or':_[_0x9f4f('0x26')](_0x16a8e9,function(_0x46ef9a){if(_0x46ef9a[_0x9f4f('0x2a')]!==_0x9f4f('0x38')){var _0x4f8f75={};_0x4f8f75[_0x46ef9a['name']]={'$like':'%'+_0x27f740['query'][_0x9f4f('0x36')]+'%'};return _0x4f8f75;}})});}_0x4bea7d=_[_0x9f4f('0x37')]({},_0x4bea7d,_0x27f740[_0x9f4f('0x39')]);var _0x2784bc={'where':_0x4bea7d[_0x9f4f('0x3a')]};return db['MailTransferReport'][_0x9f4f('0x1c')](_0x2784bc)[_0x9f4f('0x21')](function(_0x1ef995){_0xa36c9d[_0x9f4f('0x1c')]=_0x1ef995;if(_0x27f740[_0x9f4f('0x2c')][_0x9f4f('0x3b')]){_0x4bea7d[_0x9f4f('0x3c')]=[{'all':!![]}];}return db[_0x9f4f('0x27')][_0x9f4f('0x3d')](_0x4bea7d);})[_0x9f4f('0x21')](function(_0x1195fe){_0xa36c9d['rows']=_0x1195fe;return _0xa36c9d;})[_0x9f4f('0x21')](respondWithFilteredResult(_0xf7d133,_0x4bea7d))[_0x9f4f('0x3e')](handleError(_0xf7d133,null));};exports[_0x9f4f('0x3f')]=function(_0x1b0810,_0x417da1){var _0x579ede={'raw':!![],'where':{'id':_0x1b0810[_0x9f4f('0x40')]['id']}},_0x340f3e={};_0x340f3e[_0x9f4f('0x2b')]=_['keys'](db['MailTransferReport'][_0x9f4f('0x28')]);_0x340f3e[_0x9f4f('0x2c')]=_['keys'](_0x1b0810[_0x9f4f('0x2c')]);_0x340f3e[_0x9f4f('0x2e')]=_[_0x9f4f('0x41')](_0x340f3e[_0x9f4f('0x2b')],_0x340f3e[_0x9f4f('0x2c')]);_0x579ede[_0x9f4f('0x2f')]=_[_0x9f4f('0x41')](_0x340f3e[_0x9f4f('0x2b')],qs['fields'](_0x1b0810[_0x9f4f('0x2c')][_0x9f4f('0x30')]));_0x579ede[_0x9f4f('0x2f')]=_0x579ede[_0x9f4f('0x2f')][_0x9f4f('0x31')]?_0x579ede[_0x9f4f('0x2f')]:_0x340f3e[_0x9f4f('0x2b')];if(_0x1b0810[_0x9f4f('0x2c')][_0x9f4f('0x3b')]){_0x579ede['include']=[{'all':!![]}];}_0x579ede=_[_0x9f4f('0x37')]({},_0x579ede,_0x1b0810['options']);return db[_0x9f4f('0x27')][_0x9f4f('0x42')](_0x579ede)[_0x9f4f('0x21')](handleEntityNotFound(_0x417da1,null))[_0x9f4f('0x21')](respondWithResult(_0x417da1,null))['catch'](handleError(_0x417da1,null));};exports['create']=function(_0x53efbb,_0x5b69fa){return db[_0x9f4f('0x27')][_0x9f4f('0x43')](_0x53efbb[_0x9f4f('0x44')],{})[_0x9f4f('0x21')](respondWithResult(_0x5b69fa,0xc9))['catch'](handleError(_0x5b69fa,null));};exports[_0x9f4f('0x45')]=function(_0xd36bc3,_0x564e69){if(_0xd36bc3[_0x9f4f('0x44')]['id']){delete _0xd36bc3['body']['id'];}return db[_0x9f4f('0x27')]['find']({'where':{'id':_0xd36bc3[_0x9f4f('0x40')]['id']}})['then'](handleEntityNotFound(_0x564e69,null))['then'](saveUpdates(_0xd36bc3[_0x9f4f('0x44')],null))[_0x9f4f('0x21')](respondWithResult(_0x564e69,null))[_0x9f4f('0x3e')](handleError(_0x564e69,null));};exports[_0x9f4f('0x46')]=function(_0x195661,_0x1514f0){return db[_0x9f4f('0x27')][_0x9f4f('0x42')]({'where':{'id':_0x195661[_0x9f4f('0x40')]['id']}})['then'](handleEntityNotFound(_0x1514f0,null))[_0x9f4f('0x21')](removeEntity(_0x1514f0,null))[_0x9f4f('0x3e')](handleError(_0x1514f0,null));};exports[_0x9f4f('0x47')]=function(_0x44720c,_0xb80d01){return db[_0x9f4f('0x27')][_0x9f4f('0x47')]()[_0x9f4f('0x21')](respondWithResult(_0xb80d01,null))[_0x9f4f('0x3e')](handleError(_0xb80d01,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 2494da7..3523dfe 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 _0xeed7=['define','MailTransferReport','uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeed7,0xdf));var _0x7eed=function(_0x5005f8,_0x4e9a49){_0x5005f8=_0x5005f8-0x0;var _0x101a4f=_0xeed7[_0x5005f8];return _0x101a4f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7eed('0x0'))(_0x7eed('0x1'));var moment=require('moment');var BPromise=require(_0x7eed('0x2'));var rp=require(_0x7eed('0x3'));var fs=require('fs');var path=require(_0x7eed('0x4'));var rimraf=require(_0x7eed('0x5'));var config=require('../../config/environment');var attributes=require(_0x7eed('0x6'));module[_0x7eed('0x7')]=function(_0x5975af,_0x307a00){return _0x5975af[_0x7eed('0x8')](_0x7eed('0x9'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x7eed('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x76ed=['bluebird','request-promise','path','rimraf','exports','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api','moment'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0x76ed,0x1d0));var _0xd76e=function(_0x1edec6,_0x25764b){_0x1edec6=_0x1edec6-0x0;var _0x2dc747=_0x76ed[_0x1edec6];return _0x2dc747;};'use strict';var _=require(_0xd76e('0x0'));var util=require(_0xd76e('0x1'));var logger=require('../../config/logger')(_0xd76e('0x2'));var moment=require(_0xd76e('0x3'));var BPromise=require(_0xd76e('0x4'));var rp=require(_0xd76e('0x5'));var fs=require('fs');var path=require(_0xd76e('0x6'));var rimraf=require(_0xd76e('0x7'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module[_0xd76e('0x8')]=function(_0x13c9cc,_0x3210d1){return _0x13c9cc[_0xd76e('0x9')](_0xd76e('0xa'),attributes,{'tableName':_0xd76e('0xb'),'paranoid':![],'indexes':[{'name':_0xd76e('0xc'),'fields':[_0xd76e('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 265f169..8ac553c 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 _0x4d7a=['rpc','jayson/promise','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','ioredis','../../config/utils','../../config/logger'];(function(_0x536d9d,_0x3cf1d3){var _0x54a2f2=function(_0x5a1a3c){while(--_0x5a1a3c){_0x536d9d['push'](_0x536d9d['shift']());}};_0x54a2f2(++_0x3cf1d3);}(_0x4d7a,0xb9));var _0xa4d7=function(_0x461ed7,_0x392272){_0x461ed7=_0x461ed7-0x0;var _0x4cc0b0=_0x4d7a[_0x461ed7];return _0x4cc0b0;};'use strict';var _=require(_0xa4d7('0x0'));var util=require(_0xa4d7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa4d7('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa4d7('0x3'));var logger=require(_0xa4d7('0x4'))(_0xa4d7('0x5'));var config=require('../../config/environment');var jayson=require(_0xa4d7('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b5a86,_0x59959a,_0x1a9334){return new BPromise(function(_0x446d03,_0x513647){return client[_0xa4d7('0x7')](_0x2b5a86,_0x1a9334)[_0xa4d7('0x8')](function(_0x230e52){logger[_0xa4d7('0x9')](_0xa4d7('0xa'),_0x59959a,'request\x20sent');logger[_0xa4d7('0xb')](_0xa4d7('0xc'),_0x59959a,_0xa4d7('0xd'),JSON['stringify'](_0x230e52));if(_0x230e52[_0xa4d7('0xe')]){if(_0x230e52[_0xa4d7('0xe')][_0xa4d7('0xf')]===0x1f4){logger[_0xa4d7('0xe')](_0xa4d7('0xa'),_0x59959a,_0x230e52['error']['message']);return _0x513647(_0x230e52[_0xa4d7('0xe')][_0xa4d7('0x10')]);}logger[_0xa4d7('0xe')](_0xa4d7('0xa'),_0x59959a,_0x230e52[_0xa4d7('0xe')]['message']);return _0x446d03(_0x230e52[_0xa4d7('0xe')][_0xa4d7('0x10')]);}else{logger[_0xa4d7('0x9')](_0xa4d7('0xa'),_0x59959a,_0xa4d7('0xd'));_0x446d03(_0x230e52[_0xa4d7('0x11')][_0xa4d7('0x10')]);}})[_0xa4d7('0x12')](function(_0x28e0e6){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x59959a,_0x28e0e6);_0x513647(_0x28e0e6);});});} \ No newline at end of file +var _0xc196=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring'];(function(_0x247404,_0x51fc1f){var _0x4fad56=function(_0x1e068d){while(--_0x1e068d){_0x247404['push'](_0x247404['shift']());}};_0x4fad56(++_0x51fc1f);}(_0xc196,0x115));var _0x6c19=function(_0x2b04b8,_0x2e864c){_0x2b04b8=_0x2b04b8-0x0;var _0x450605=_0xc196[_0x2b04b8];return _0x450605;};'use strict';var _=require('lodash');var util=require(_0x6c19('0x0'));var moment=require('moment');var BPromise=require(_0x6c19('0x1'));var rs=require(_0x6c19('0x2'));var fs=require('fs');var Redis=require(_0x6c19('0x3'));var db=require(_0x6c19('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6c19('0x5'))(_0x6c19('0x6'));var config=require(_0x6c19('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6c19('0x8')][_0x6c19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e1c67,_0x12f8c8,_0xe45945){return new BPromise(function(_0xcc093b,_0x54ea78){return client['request'](_0x3e1c67,_0xe45945)[_0x6c19('0xa')](function(_0x4743bc){logger[_0x6c19('0xb')](_0x6c19('0xc'),_0x12f8c8,_0x6c19('0xd'));logger[_0x6c19('0xe')](_0x6c19('0xf'),_0x12f8c8,_0x6c19('0xd'),JSON['stringify'](_0x4743bc));if(_0x4743bc[_0x6c19('0x10')]){if(_0x4743bc[_0x6c19('0x10')]['code']===0x1f4){logger[_0x6c19('0x10')](_0x6c19('0xc'),_0x12f8c8,_0x4743bc['error'][_0x6c19('0x11')]);return _0x54ea78(_0x4743bc[_0x6c19('0x10')][_0x6c19('0x11')]);}logger['error'](_0x6c19('0xc'),_0x12f8c8,_0x4743bc[_0x6c19('0x10')][_0x6c19('0x11')]);return _0xcc093b(_0x4743bc[_0x6c19('0x10')][_0x6c19('0x11')]);}else{logger['info'](_0x6c19('0xc'),_0x12f8c8,_0x6c19('0xd'));_0xcc093b(_0x4743bc[_0x6c19('0x12')][_0x6c19('0x11')]);}})[_0x6c19('0x13')](function(_0x37a219){logger[_0x6c19('0x10')](_0x6c19('0xc'),_0x12f8c8,_0x37a219);_0x54ea78(_0x37a219);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 006390f..565d9b3 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 _0xdf41=['put','/:id','update','destroy','exports','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','show','post'];(function(_0x59f1e6,_0xda13c5){var _0x2aada5=function(_0x5bf12c){while(--_0x5bf12c){_0x59f1e6['push'](_0x59f1e6['shift']());}};_0x2aada5(++_0xda13c5);}(_0xdf41,0x175));var _0x1df4=function(_0x4c917b,_0x405703){_0x4c917b=_0x4c917b-0x0;var _0x1a7329=_0xdf41[_0x4c917b];return _0x1a7329;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1df4('0x0'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1df4('0x1'));var auth=require(_0x1df4('0x2'));var interaction=require(_0x1df4('0x3'));var config=require(_0x1df4('0x4'));var controller=require('./memberReport.controller');router[_0x1df4('0x5')]('/',auth[_0x1df4('0x6')](),controller[_0x1df4('0x7')]);router[_0x1df4('0x5')](_0x1df4('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0x1df4('0x5')]('/:id',auth[_0x1df4('0x6')](),controller[_0x1df4('0x9')]);router[_0x1df4('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0x1df4('0xb')](_0x1df4('0xc'),auth[_0x1df4('0x6')](),controller[_0x1df4('0xd')]);router['delete'](_0x1df4('0xc'),auth['isAuthenticated'](),controller[_0x1df4('0xe')]);module[_0x1df4('0xf')]=router; \ No newline at end of file +var _0x2e57=['path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','isAuthenticated','index','get','describe','/:id','show','create','put','update','destroy','exports','multer','util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2e57,0xcf));var _0x72e5=function(_0x203bd0,_0x34e69b){_0x203bd0=_0x203bd0-0x0;var _0xf4ba01=_0x2e57[_0x203bd0];return _0xf4ba01;};'use strict';var multer=require(_0x72e5('0x0'));var util=require(_0x72e5('0x1'));var path=require(_0x72e5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x72e5('0x3'));var auth=require(_0x72e5('0x4'));var interaction=require(_0x72e5('0x5'));var config=require(_0x72e5('0x6'));var controller=require(_0x72e5('0x7'));router['get']('/',auth[_0x72e5('0x8')](),controller[_0x72e5('0x9')]);router[_0x72e5('0xa')]('/describe',auth[_0x72e5('0x8')](),controller[_0x72e5('0xb')]);router[_0x72e5('0xa')](_0x72e5('0xc'),auth[_0x72e5('0x8')](),controller[_0x72e5('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x72e5('0xe')]);router[_0x72e5('0xf')](_0x72e5('0xc'),auth['isAuthenticated'](),controller[_0x72e5('0x10')]);router['delete']('/:id',auth[_0x72e5('0x8')](),controller[_0x72e5('0x11')]);module[_0x72e5('0x12')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c954fd0..1912e76 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 _0x507f=['duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','exitAt','setDataValue'];(function(_0x532d78,_0x25b6a8){var _0x5990c4=function(_0x3f23fe){while(--_0x3f23fe){_0x532d78['push'](_0x532d78['shift']());}};_0x5990c4(++_0x25b6a8);}(_0x507f,0x6b));var _0xf507=function(_0x3fdf9d,_0x242c31){_0x3fdf9d=_0x3fdf9d-0x0;var _0x555e1f=_0x507f[_0x3fdf9d];return _0x555e1f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xf507('0x0'));module[_0xf507('0x1')]={'channel':{'type':Sequelize[_0xf507('0x2')]},'membername':{'type':Sequelize[_0xf507('0x2')]},'interface':{'type':Sequelize[_0xf507('0x2')]},'type':{'type':Sequelize[_0xf507('0x2')],'defaultValue':_0xf507('0x3'),'comment':_0xf507('0x4')},'duration':{'type':Sequelize[_0xf507('0x5')]},'enterAt':{'type':Sequelize[_0xf507('0x6')]},'exitAt':{'type':Sequelize[_0xf507('0x6')],'set':function(_0x7a05d5){var _0x57f039=moment(_0x7a05d5);var _0x1dcc84=moment(this[_0xf507('0x7')](_0xf507('0x8')));var _0x5068bd=_0x57f039['diff'](_0x1dcc84,_0xf507('0x9'));this['setDataValue'](_0xf507('0xa'),_0x7a05d5);this[_0xf507('0xb')](_0xf507('0xc'),_0x5068bd>=0x0?_0x5068bd:null);}},'data1':{'type':Sequelize[_0xf507('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0xd')},'data3':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0xe')},'data4':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0xf')},'data5':{'type':Sequelize[_0xf507('0x2')],'comment':_0xf507('0x10')},'role':{'type':Sequelize[_0xf507('0x2')]},'internal':{'type':Sequelize[_0xf507('0x5')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1cf2=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','INTEGER','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','diff','seconds','setDataValue','exitAt'];(function(_0x57ed29,_0x48c52f){var _0x2d6622=function(_0x260be5){while(--_0x260be5){_0x57ed29['push'](_0x57ed29['shift']());}};_0x2d6622(++_0x48c52f);}(_0x1cf2,0x149));var _0x21cf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1cf2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x21cf('0x0'));var moment=require(_0x21cf('0x1'));module[_0x21cf('0x2')]={'channel':{'type':Sequelize[_0x21cf('0x3')]},'membername':{'type':Sequelize[_0x21cf('0x3')]},'interface':{'type':Sequelize[_0x21cf('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x21cf('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x21cf('0x5')]},'exitAt':{'type':Sequelize[_0x21cf('0x5')],'set':function(_0x10d7c8){var _0x3ac602=moment(_0x10d7c8);var _0x440bc8=moment(this[_0x21cf('0x6')]('enterAt'));var _0x5797b3=_0x3ac602[_0x21cf('0x7')](_0x440bc8,_0x21cf('0x8'));this[_0x21cf('0x9')](_0x21cf('0xa'),_0x10d7c8);this['setDataValue'](_0x21cf('0xb'),_0x5797b3>=0x0?_0x5797b3:null);}},'data1':{'type':Sequelize[_0x21cf('0x3')],'comment':_0x21cf('0xc')},'data2':{'type':Sequelize[_0x21cf('0x3')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0x21cf('0x3')],'comment':_0x21cf('0xd')},'data4':{'type':Sequelize[_0x21cf('0x3')],'comment':_0x21cf('0xe')},'data5':{'type':Sequelize[_0x21cf('0x3')],'comment':_0x21cf('0xf')},'role':{'type':Sequelize[_0x21cf('0x3')]},'internal':{'type':Sequelize[_0x21cf('0x10')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index a819629..3611127 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xedd9,0xfc));var _0x9edd=function(_0x195a3b,_0x3b6193){_0x195a3b=_0x195a3b-0x0;var _0x29f57d=_0xedd9[_0x195a3b];return _0x29f57d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9edd('0x0'));var zipdir=require(_0x9edd('0x1'));var jsonpatch=require(_0x9edd('0x2'));var rp=require(_0x9edd('0x3'));var moment=require(_0x9edd('0x4'));var BPromise=require(_0x9edd('0x5'));var Mustache=require(_0x9edd('0x6'));var util=require(_0x9edd('0x7'));var path=require('path');var sox=require(_0x9edd('0x8'));var csv=require(_0x9edd('0x9'));var ejs=require(_0x9edd('0xa'));var fs=require('fs');var fs_extra=require(_0x9edd('0xb'));var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0x9'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0xdde15,_0x566e0f){var _0x313085=function(_0x49387d){while(--_0x49387d){_0xdde15['push'](_0xdde15['shift']());}};_0x313085(++_0x566e0f);}(_0x9c44,0x178));var _0x49c4=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x9c44[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 08ec8a7..f409677 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 _0x29dd=['define','MemberReport','report_member','membername','interface','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports'];(function(_0x23bd95,_0x2247c3){var _0x385bb2=function(_0x2ace34){while(--_0x2ace34){_0x23bd95['push'](_0x23bd95['shift']());}};_0x385bb2(++_0x2247c3);}(_0x29dd,0x1d3));var _0xd29d=function(_0x315908,_0x76e8d8){_0x315908=_0x315908-0x0;var _0xd186c5=_0x29dd[_0x315908];return _0xd186c5;};'use strict';var _=require('lodash');var util=require(_0xd29d('0x0'));var logger=require(_0xd29d('0x1'))('api');var moment=require(_0xd29d('0x2'));var BPromise=require(_0xd29d('0x3'));var rp=require(_0xd29d('0x4'));var fs=require('fs');var path=require(_0xd29d('0x5'));var rimraf=require('rimraf');var config=require(_0xd29d('0x6'));var attributes=require(_0xd29d('0x7'));module[_0xd29d('0x8')]=function(_0x176588,_0x52b7f8){return _0x176588[_0xd29d('0x9')](_0xd29d('0xa'),attributes,{'tableName':_0xd29d('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0xd29d('0xc'),_0xd29d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ab2=['../../config/environment','./memberReport.attributes','define','report_member','membername_interface','membername','interface','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x8ab2,0x89));var _0x28ab=function(_0x1e2b89,_0x4d2361){_0x1e2b89=_0x1e2b89-0x0;var _0x1f513b=_0x8ab2[_0x1e2b89];return _0x1f513b;};'use strict';var _=require(_0x28ab('0x0'));var util=require(_0x28ab('0x1'));var logger=require(_0x28ab('0x2'))('api');var moment=require(_0x28ab('0x3'));var BPromise=require(_0x28ab('0x4'));var rp=require(_0x28ab('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x28ab('0x6'));var attributes=require(_0x28ab('0x7'));module['exports']=function(_0x117158,_0x4d28e0){return _0x117158[_0x28ab('0x8')]('MemberReport',attributes,{'tableName':_0x28ab('0x9'),'paranoid':![],'indexes':[{'name':_0x28ab('0xa'),'fields':[_0x28ab('0xb'),_0x28ab('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e553b34..07b6060 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 _0x37cc=['http','request','then','info','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MemberReport,\x20%s,\x20%s','message','result','catch','findAll','options','raw','attributes','include','map','model','GetMemberReport','CreateMemberReport','MemberReport','body','UpdateMemberReport','update','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ad00b,_0x22c334){var _0x2aab79=function(_0x999352){while(--_0x999352){_0x5ad00b['push'](_0x5ad00b['shift']());}};_0x2aab79(++_0x22c334);}(_0x37cc,0x185));var _0xc37c=function(_0x303251,_0x1cb467){_0x303251=_0x303251-0x0;var _0x558942=_0x37cc[_0x303251];return _0x558942;};'use strict';var _=require(_0xc37c('0x0'));var util=require(_0xc37c('0x1'));var moment=require(_0xc37c('0x2'));var BPromise=require(_0xc37c('0x3'));var rs=require(_0xc37c('0x4'));var fs=require('fs');var Redis=require(_0xc37c('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc37c('0x6'))(_0xc37c('0x7'));var config=require(_0xc37c('0x8'));var jayson=require(_0xc37c('0x9'));var client=jayson[_0xc37c('0xa')][_0xc37c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd8f098,_0x1eaa97,_0x3c5c63){return new BPromise(function(_0x483c8d,_0x15a756){return client[_0xc37c('0xc')](_0xd8f098,_0x3c5c63)[_0xc37c('0xd')](function(_0x3526b5){logger[_0xc37c('0xe')]('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));logger[_0xc37c('0x10')](_0xc37c('0x11'),_0x1eaa97,_0xc37c('0xf'),JSON[_0xc37c('0x12')](_0x3526b5));if(_0x3526b5[_0xc37c('0x13')]){if(_0x3526b5[_0xc37c('0x13')][_0xc37c('0x14')]===0x1f4){logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')]['message']);return _0x15a756(_0x3526b5['error'][_0xc37c('0x16')]);}logger[_0xc37c('0x13')](_0xc37c('0x15'),_0x1eaa97,_0x3526b5[_0xc37c('0x13')][_0xc37c('0x16')]);return _0x483c8d(_0x3526b5[_0xc37c('0x13')]['message']);}else{logger[_0xc37c('0xe')]('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0xc37c('0xf'));_0x483c8d(_0x3526b5[_0xc37c('0x17')][_0xc37c('0x16')]);}})[_0xc37c('0x18')](function(_0x674ccf){logger['error']('MemberReport,\x20%s,\x20%s',_0x1eaa97,_0x674ccf);_0x15a756(_0x674ccf);});});}exports['GetMemberReport']=function(_0x2d6129){var _0x5c7bd2=this;return new Promise(function(_0x370c2f,_0x1f8679){return db['MemberReport'][_0xc37c('0x19')]({'raw':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d6129['options']?_0x2d6129[_0xc37c('0x1a')]['where']||null:null,'attributes':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1c')]||null:null,'limit':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')]['limit']||null:null,'include':_0x2d6129[_0xc37c('0x1a')]?_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x2d6129[_0xc37c('0x1a')][_0xc37c('0x1d')],function(_0x15a392){return{'model':db[_0x15a392[_0xc37c('0x1f')]],'as':_0x15a392['as'],'attributes':_0x15a392[_0xc37c('0x1c')],'include':_0x15a392[_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x15a392[_0xc37c('0x1d')],function(_0x3076fc){return{'model':db[_0x3076fc['model']],'as':_0x3076fc['as'],'attributes':_0x3076fc[_0xc37c('0x1c')],'include':_0x3076fc[_0xc37c('0x1d')]?_[_0xc37c('0x1e')](_0x3076fc[_0xc37c('0x1d')],function(_0x53f062){return{'model':db[_0x53f062[_0xc37c('0x1f')]],'as':_0x53f062['as'],'attributes':_0x53f062[_0xc37c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xc37c('0xd')](function(_0xbd5d3a){logger[_0xc37c('0xe')](_0xc37c('0x20'),_0x2d6129);logger[_0xc37c('0x10')](_0xc37c('0x20'),_0x2d6129,JSON['stringify'](_0xbd5d3a));_0x370c2f(_0xbd5d3a);})[_0xc37c('0x18')](function(_0x466094){logger[_0xc37c('0x13')](_0xc37c('0x20'),_0x466094[_0xc37c('0x16')],_0x2d6129);_0x1f8679(_0x5c7bd2[_0xc37c('0x13')](0x1f4,_0x466094[_0xc37c('0x16')]));});});};exports[_0xc37c('0x21')]=function(_0x2c59df){var _0x472d58=this;return new Promise(function(_0x224641,_0x169b27){return db[_0xc37c('0x22')]['create'](_0x2c59df[_0xc37c('0x23')],{'raw':_0x2c59df[_0xc37c('0x1a')]?_0x2c59df['options']['raw']===undefined?!![]:![]:!![]})[_0xc37c('0xd')](function(_0x3b9ac4){logger[_0xc37c('0xe')]('CreateMemberReport',_0x2c59df);logger[_0xc37c('0x10')]('CreateMemberReport',_0x2c59df,JSON[_0xc37c('0x12')](_0x3b9ac4));_0x224641(_0x3b9ac4);})[_0xc37c('0x18')](function(_0x58429b){logger[_0xc37c('0x13')](_0xc37c('0x21'),_0x58429b[_0xc37c('0x16')],_0x2c59df);_0x169b27(_0x472d58[_0xc37c('0x13')](0x1f4,_0x58429b[_0xc37c('0x16')]));});});};exports[_0xc37c('0x24')]=function(_0x445f07){var _0x5432fe=this;return new Promise(function(_0x5142bd,_0xef4b6c){return db[_0xc37c('0x22')][_0xc37c('0x25')](_0x445f07[_0xc37c('0x23')],{'raw':_0x445f07['options']?_0x445f07[_0xc37c('0x1a')][_0xc37c('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x26')]||null:null,'attributes':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x1c')]||null:null,'limit':_0x445f07[_0xc37c('0x1a')]?_0x445f07['options'][_0xc37c('0x27')]||null:null})[_0xc37c('0xd')](function(_0x17dd56){logger[_0xc37c('0xe')](_0xc37c('0x24'),_0x445f07);logger[_0xc37c('0x10')](_0xc37c('0x24'),_0x445f07,JSON[_0xc37c('0x12')](_0x17dd56));_0x5142bd(_0x17dd56);})[_0xc37c('0x18')](function(_0x188f2c){logger[_0xc37c('0x13')](_0xc37c('0x24'),_0x188f2c[_0xc37c('0x16')],_0x445f07);_0xef4b6c(_0x5432fe[_0xc37c('0x13')](0x1f4,_0x188f2c[_0xc37c('0x16')]));});});}; \ No newline at end of file +var _0xd101=['request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','raw','options','attributes','include','map','model','CreateMemberReport','create','body','stringify','UpdateMemberReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd101,0xc1));var _0x1d10=function(_0x4b523e,_0x111c09){_0x4b523e=_0x4b523e-0x0;var _0x2083e3=_0xd101[_0x4b523e];return _0x2083e3;};'use strict';var _=require(_0x1d10('0x0'));var util=require('util');var moment=require(_0x1d10('0x1'));var BPromise=require(_0x1d10('0x2'));var rs=require(_0x1d10('0x3'));var fs=require('fs');var Redis=require(_0x1d10('0x4'));var db=require(_0x1d10('0x5'))['db'];var utils=require(_0x1d10('0x6'));var logger=require(_0x1d10('0x7'))(_0x1d10('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d10('0x9'));var client=jayson[_0x1d10('0xa')][_0x1d10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x27d569,_0xb9e08,_0x36335e){return new BPromise(function(_0x6d6def,_0x43df2c){return client[_0x1d10('0xc')](_0x27d569,_0x36335e)[_0x1d10('0xd')](function(_0xf7926b){logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,_0x1d10('0x10'));logger[_0x1d10('0x11')](_0x1d10('0x12'),_0xb9e08,_0x1d10('0x10'),JSON['stringify'](_0xf7926b));if(_0xf7926b[_0x1d10('0x13')]){if(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x14')]===0x1f4){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b['error'][_0x1d10('0x15')]);return _0x43df2c(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0xf7926b[_0x1d10('0x13')]['message']);return _0x6d6def(_0xf7926b[_0x1d10('0x13')][_0x1d10('0x15')]);}else{logger[_0x1d10('0xe')](_0x1d10('0xf'),_0xb9e08,'request\x20sent');_0x6d6def(_0xf7926b[_0x1d10('0x16')][_0x1d10('0x15')]);}})[_0x1d10('0x17')](function(_0x3f2f2b){logger[_0x1d10('0x13')](_0x1d10('0xf'),_0xb9e08,_0x3f2f2b);_0x43df2c(_0x3f2f2b);});});}exports[_0x1d10('0x18')]=function(_0x4f3e2a){var _0x23d604=this;return new Promise(function(_0x1163dd,_0x4ca1e8){return db[_0x1d10('0x19')][_0x1d10('0x1a')]({'raw':_0x4f3e2a['options']?_0x4f3e2a['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'where':_0x4f3e2a['options']?_0x4f3e2a['options']['where']||null:null,'attributes':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1d')]||null:null,'limit':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options']['limit']||null:null,'include':_0x4f3e2a[_0x1d10('0x1c')]?_0x4f3e2a['options'][_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x4f3e2a[_0x1d10('0x1c')][_0x1d10('0x1e')],function(_0x127b37){return{'model':db[_0x127b37[_0x1d10('0x20')]],'as':_0x127b37['as'],'attributes':_0x127b37[_0x1d10('0x1d')],'include':_0x127b37[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0x127b37[_0x1d10('0x1e')],function(_0xf1e4c8){return{'model':db[_0xf1e4c8['model']],'as':_0xf1e4c8['as'],'attributes':_0xf1e4c8[_0x1d10('0x1d')],'include':_0xf1e4c8[_0x1d10('0x1e')]?_[_0x1d10('0x1f')](_0xf1e4c8[_0x1d10('0x1e')],function(_0x18e7d9){return{'model':db[_0x18e7d9[_0x1d10('0x20')]],'as':_0x18e7d9['as'],'attributes':_0x18e7d9[_0x1d10('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1d10('0xd')](function(_0x4f7837){logger[_0x1d10('0xe')](_0x1d10('0x18'),_0x4f3e2a);logger['debug'](_0x1d10('0x18'),_0x4f3e2a,JSON['stringify'](_0x4f7837));_0x1163dd(_0x4f7837);})['catch'](function(_0x41b5b8){logger['error'](_0x1d10('0x18'),_0x41b5b8[_0x1d10('0x15')],_0x4f3e2a);_0x4ca1e8(_0x23d604[_0x1d10('0x13')](0x1f4,_0x41b5b8[_0x1d10('0x15')]));});});};exports[_0x1d10('0x21')]=function(_0x9c6cb9){var _0x4b5400=this;return new Promise(function(_0x4e30b2,_0x1ada44){return db[_0x1d10('0x19')][_0x1d10('0x22')](_0x9c6cb9[_0x1d10('0x23')],{'raw':_0x9c6cb9[_0x1d10('0x1c')]?_0x9c6cb9[_0x1d10('0x1c')][_0x1d10('0x1b')]===undefined?!![]:![]:!![]})[_0x1d10('0xd')](function(_0x8f4818){logger[_0x1d10('0xe')]('CreateMemberReport',_0x9c6cb9);logger[_0x1d10('0x11')]('CreateMemberReport',_0x9c6cb9,JSON[_0x1d10('0x24')](_0x8f4818));_0x4e30b2(_0x8f4818);})[_0x1d10('0x17')](function(_0x5d446b){logger[_0x1d10('0x13')]('CreateMemberReport',_0x5d446b[_0x1d10('0x15')],_0x9c6cb9);_0x1ada44(_0x4b5400[_0x1d10('0x13')](0x1f4,_0x5d446b[_0x1d10('0x15')]));});});};exports[_0x1d10('0x25')]=function(_0xd50250){var _0x5eb413=this;return new Promise(function(_0x4c3ef6,_0x35025e){return db[_0x1d10('0x19')][_0x1d10('0x26')](_0xd50250['body'],{'raw':_0xd50250['options']?_0xd50250['options'][_0x1d10('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x27')]||null:null,'attributes':_0xd50250[_0x1d10('0x1c')]?_0xd50250[_0x1d10('0x1c')]['attributes']||null:null,'limit':_0xd50250['options']?_0xd50250[_0x1d10('0x1c')][_0x1d10('0x28')]||null:null})[_0x1d10('0xd')](function(_0x230c19){logger['info'](_0x1d10('0x25'),_0xd50250);logger['debug'](_0x1d10('0x25'),_0xd50250,JSON[_0x1d10('0x24')](_0x230c19));_0x4c3ef6(_0x230c19);})[_0x1d10('0x17')](function(_0x8d8405){logger[_0x1d10('0x13')](_0x1d10('0x25'),_0x8d8405[_0x1d10('0x15')],_0xd50250);_0x35025e(_0x5eb413[_0x1d10('0x13')](0x1f4,_0x8d8405[_0x1d10('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 823820f..645a77c 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 _0x8876=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./migration.controller','get'];(function(_0xa5a920,_0x2d8772){var _0x596618=function(_0x5eab42){while(--_0x5eab42){_0xa5a920['push'](_0xa5a920['shift']());}};_0x596618(++_0x2d8772);}(_0x8876,0xa0));var _0x6887=function(_0x224090,_0x38f7e4){_0x224090=_0x224090-0x0;var _0xd97361=_0x8876[_0x224090];return _0xd97361;};'use strict';var multer=require('multer');var util=require(_0x6887('0x0'));var path=require(_0x6887('0x1'));var timeout=require(_0x6887('0x2'));var express=require(_0x6887('0x3'));var router=express[_0x6887('0x4')]();var fs_extra=require(_0x6887('0x5'));var auth=require(_0x6887('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6887('0x7'));var controller=require(_0x6887('0x8'));router[_0x6887('0x9')]('/',controller['index']);module['exports']=router; \ No newline at end of file +var _0x4108=['get','index','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x45fdae,_0x1dc79c){var _0x1c8728=function(_0x175ec4){while(--_0x175ec4){_0x45fdae['push'](_0x45fdae['shift']());}};_0x1c8728(++_0x1dc79c);}(_0x4108,0x1d0));var _0x8410=function(_0x20270c,_0x3ec7aa){_0x20270c=_0x20270c-0x0;var _0x5b83a5=_0x4108[_0x20270c];return _0x5b83a5;};'use strict';var multer=require('multer');var util=require(_0x8410('0x0'));var path=require(_0x8410('0x1'));var timeout=require(_0x8410('0x2'));var express=require(_0x8410('0x3'));var router=express[_0x8410('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8410('0x5'));var interaction=require(_0x8410('0x6'));var config=require(_0x8410('0x7'));var controller=require(_0x8410('0x8'));router[_0x8410('0x9')]('/',controller[_0x8410('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e159088..55299b2 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 _0x10fa=['sequelize','exports','STRING','version'];(function(_0x28b9fa,_0x25f40a){var _0x1beb5d=function(_0x56dc14){while(--_0x56dc14){_0x28b9fa['push'](_0x28b9fa['shift']());}};_0x1beb5d(++_0x25f40a);}(_0x10fa,0x144));var _0xa10f=function(_0x46e087,_0x3d199a){_0x46e087=_0x46e087-0x0;var _0x57f4ce=_0x10fa[_0x46e087];return _0x57f4ce;};'use strict';var Sequelize=require(_0xa10f('0x0'));module[_0xa10f('0x1')]={'version':{'type':Sequelize[_0xa10f('0x2')],'unique':_0xa10f('0x3')}}; \ No newline at end of file +var _0xb186=['sequelize','STRING'];(function(_0x28d1b3,_0x180127){var _0x552fd3=function(_0x71d19d){while(--_0x71d19d){_0x28d1b3['push'](_0x28d1b3['shift']());}};_0x552fd3(++_0x180127);}(_0xb186,0xb6));var _0x6b18=function(_0x5ecb26,_0xdd72bd){_0x5ecb26=_0x5ecb26-0x0;var _0x5c374a=_0xb186[_0x5ecb26];return _0x5c374a;};'use strict';var Sequelize=require(_0x6b18('0x0'));module['exports']={'version':{'type':Sequelize[_0x6b18('0x1')],'unique':'version'}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 1ade541..95daa04 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 _0xe83d=['error','name','send','Migration','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','sendStatus'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xe83d,0x1b4));var _0xde83=function(_0x2c57f4,_0x264787){_0x2c57f4=_0x2c57f4-0x0;var _0x36752b=_0xe83d[_0x2c57f4];return _0x36752b;};'use strict';var emlformat=require(_0xde83('0x0'));var rimraf=require(_0xde83('0x1'));var zipdir=require(_0xde83('0x2'));var jsonpatch=require(_0xde83('0x3'));var rp=require(_0xde83('0x4'));var moment=require('moment');var BPromise=require(_0xde83('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xde83('0x6'));var sox=require('sox');var csv=require(_0xde83('0x7'));var ejs=require(_0xde83('0x8'));var fs=require('fs');var fs_extra=require(_0xde83('0x9'));var _=require(_0xde83('0xa'));var squel=require(_0xde83('0xb'));var crypto=require('crypto');var jsforce=require(_0xde83('0xc'));var deskjs=require(_0xde83('0xd'));var toCsv=require('to-csv');var querystring=require(_0xde83('0xe'));var Papa=require(_0xde83('0xf'));var Redis=require(_0xde83('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xde83('0x11'));var as=require(_0xde83('0x12'));var hardwareService=require(_0xde83('0x13'));var logger=require(_0xde83('0x14'))('api');var utils=require(_0xde83('0x15'));var config=require(_0xde83('0x16'));var licenseUtil=require(_0xde83('0x17'));var db=require(_0xde83('0x18'))['db'];function respondWithStatusCode(_0x5af0b8,_0x1cf9e6){_0x1cf9e6=_0x1cf9e6||0xcc;return function(_0x5e262a){if(_0x5e262a){return _0x5af0b8['sendStatus'](_0x1cf9e6);}return _0x5af0b8[_0xde83('0x19')](_0x1cf9e6)[_0xde83('0x1a')]();};}function respondWithResult(_0x1259fa,_0x25bcdd){_0x25bcdd=_0x25bcdd||0xc8;return function(_0x1afc19){if(_0x1afc19){return _0x1259fa[_0xde83('0x19')](_0x25bcdd)[_0xde83('0x1b')](_0x1afc19);}};}function respondWithFilteredResult(_0x5a01ea,_0x47e1b4){return function(_0x3b15b2){if(_0x3b15b2){var _0x1ae1e0=typeof _0x47e1b4['offset']===_0xde83('0x1c')&&typeof _0x47e1b4[_0xde83('0x1d')]===_0xde83('0x1c');var _0x1422b7=_0x3b15b2[_0xde83('0x1e')];var _0x1e2285=_0x1ae1e0?0x0:_0x47e1b4['offset'];var _0x464cf1=_0x1ae1e0?_0x3b15b2[_0xde83('0x1e')]:_0x47e1b4[_0xde83('0x1f')]+_0x47e1b4['limit'];var _0x1cb142;if(_0x464cf1>=_0x1422b7){_0x464cf1=_0x1422b7;_0x1cb142=0xc8;}else{_0x1cb142=0xce;}_0x5a01ea[_0xde83('0x19')](_0x1cb142);return _0x5a01ea[_0xde83('0x20')](_0xde83('0x21'),_0x1e2285+'-'+_0x464cf1+'/'+_0x1422b7)[_0xde83('0x1b')](_0x3b15b2);}return null;};}function patchUpdates(_0x2d9691){return function(_0x32a557){try{jsonpatch[_0xde83('0x22')](_0x32a557,_0x2d9691,!![]);}catch(_0x5bec98){return BPromise[_0xde83('0x23')](_0x5bec98);}return _0x32a557[_0xde83('0x24')]();};}function saveUpdates(_0x469983,_0x2e2ab8){return function(_0xda5f26){if(_0xda5f26){return _0xda5f26['update'](_0x469983)[_0xde83('0x25')](function(_0x2b4972){return _0x2b4972;});}return null;};}function removeEntity(_0xe216d6,_0x1acca0){return function(_0x46d0d3){if(_0x46d0d3){return _0x46d0d3[_0xde83('0x26')]()[_0xde83('0x25')](function(){_0xe216d6[_0xde83('0x19')](0xcc)[_0xde83('0x1a')]();});}};}function handleEntityNotFound(_0x5c755c,_0x50f983){return function(_0x7e8012){if(!_0x7e8012){_0x5c755c[_0xde83('0x27')](0x194);}return _0x7e8012;};}function handleError(_0x2d3ee,_0x4c0de9){_0x4c0de9=_0x4c0de9||0x1f4;return function(_0x26b02a){logger[_0xde83('0x28')](_0x26b02a['stack']);if(_0x26b02a[_0xde83('0x29')]){delete _0x26b02a[_0xde83('0x29')];}_0x2d3ee[_0xde83('0x19')](_0x4c0de9)[_0xde83('0x2a')](_0x26b02a);};}exports['index']=function(_0x369396,_0x11437f){var _0x5bb3c7={},_0x2c2285={},_0x2d6dbd={'count':0x0,'rows':[]};var _0x3dd0b7=_['map'](db[_0xde83('0x2b')][_0xde83('0x2c')],function(_0x5115cc){return{'name':_0x5115cc[_0xde83('0x2d')],'type':_0x5115cc[_0xde83('0x2e')]['key']};});_0x2c2285[_0xde83('0x2f')]=_[_0xde83('0x30')](_0x3dd0b7,_0xde83('0x29'));_0x2c2285[_0xde83('0x31')]=_['keys'](_0x369396[_0xde83('0x31')]);_0x2c2285[_0xde83('0x32')]=_[_0xde83('0x33')](_0x2c2285[_0xde83('0x2f')],_0x2c2285[_0xde83('0x31')]);_0x5bb3c7[_0xde83('0x34')]=_['intersection'](_0x2c2285['model'],qs['fields'](_0x369396['query'][_0xde83('0x35')]));_0x5bb3c7[_0xde83('0x34')]=_0x5bb3c7['attributes'][_0xde83('0x36')]?_0x5bb3c7['attributes']:_0x2c2285[_0xde83('0x2f')];if(!_0x369396[_0xde83('0x31')][_0xde83('0x37')](_0xde83('0x38'))){_0x5bb3c7[_0xde83('0x1d')]=qs['limit'](_0x369396[_0xde83('0x31')]['limit']);_0x5bb3c7['offset']=qs[_0xde83('0x1f')](_0x369396[_0xde83('0x31')][_0xde83('0x1f')]);}_0x5bb3c7[_0xde83('0x39')]=qs[_0xde83('0x3a')](_0x369396['query'][_0xde83('0x3a')]);_0x5bb3c7[_0xde83('0x3b')]=qs['filters'](_[_0xde83('0x3c')](_0x369396[_0xde83('0x31')],_0x2c2285[_0xde83('0x32')]),_0x3dd0b7);if(_0x369396['query'][_0xde83('0x3d')]){_0x5bb3c7[_0xde83('0x3b')]=_[_0xde83('0x3e')](_0x5bb3c7[_0xde83('0x3b')],{'$or':_[_0xde83('0x30')](_0x3dd0b7,function(_0x2191e2){if(_0x2191e2[_0xde83('0x2e')]!==_0xde83('0x3f')){var _0x5819ac={};_0x5819ac[_0x2191e2[_0xde83('0x29')]]={'$like':'%'+_0x369396[_0xde83('0x31')][_0xde83('0x3d')]+'%'};return _0x5819ac;}})});}_0x5bb3c7=_['merge']({},_0x5bb3c7,_0x369396['options']);var _0xe36e11={'where':_0x5bb3c7[_0xde83('0x3b')]};return db[_0xde83('0x2b')]['count'](_0xe36e11)[_0xde83('0x25')](function(_0x182a4c){_0x2d6dbd['count']=_0x182a4c;if(_0x369396[_0xde83('0x31')][_0xde83('0x40')]){_0x5bb3c7['include']=[{'all':!![]}];}return db[_0xde83('0x2b')][_0xde83('0x41')](_0x5bb3c7);})[_0xde83('0x25')](function(_0x3998c2){_0x2d6dbd[_0xde83('0x42')]=_0x3998c2;return _0x2d6dbd;})[_0xde83('0x25')](respondWithFilteredResult(_0x11437f,_0x5bb3c7))[_0xde83('0x43')](handleError(_0x11437f,null));}; \ No newline at end of file +var _0xc2f9=['fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','then','includeAll','include','findAll','rows','catch','eml-format'];(function(_0x49a325,_0x1ad57c){var _0x883c3c=function(_0x33d604){while(--_0x33d604){_0x49a325['push'](_0x49a325['shift']());}};_0x883c3c(++_0x1ad57c);}(_0xc2f9,0x167));var _0x9c2f=function(_0x2fdcc5,_0x10926b){_0x2fdcc5=_0x2fdcc5-0x0;var _0x240b80=_0xc2f9[_0x2fdcc5];return _0x240b80;};'use strict';var emlformat=require(_0x9c2f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9c2f('0x1'));var rp=require(_0x9c2f('0x2'));var moment=require(_0x9c2f('0x3'));var BPromise=require(_0x9c2f('0x4'));var Mustache=require(_0x9c2f('0x5'));var util=require('util');var path=require(_0x9c2f('0x6'));var sox=require(_0x9c2f('0x7'));var csv=require(_0x9c2f('0x8'));var ejs=require(_0x9c2f('0x9'));var fs=require('fs');var fs_extra=require(_0x9c2f('0xa'));var _=require(_0x9c2f('0xb'));var squel=require(_0x9c2f('0xc'));var crypto=require(_0x9c2f('0xd'));var jsforce=require(_0x9c2f('0xe'));var deskjs=require(_0x9c2f('0xf'));var toCsv=require(_0x9c2f('0x8'));var querystring=require(_0x9c2f('0x10'));var Papa=require('papaparse');var Redis=require(_0x9c2f('0x11'));var authService=require(_0x9c2f('0x12'));var qs=require(_0x9c2f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c2f('0x14'));var logger=require(_0x9c2f('0x15'))(_0x9c2f('0x16'));var utils=require(_0x9c2f('0x17'));var config=require(_0x9c2f('0x18'));var licenseUtil=require(_0x9c2f('0x19'));var db=require(_0x9c2f('0x1a'))['db'];function respondWithStatusCode(_0xc99058,_0x4cd71d){_0x4cd71d=_0x4cd71d||0xcc;return function(_0x31e697){if(_0x31e697){return _0xc99058[_0x9c2f('0x1b')](_0x4cd71d);}return _0xc99058[_0x9c2f('0x1c')](_0x4cd71d)[_0x9c2f('0x1d')]();};}function respondWithResult(_0x5257ac,_0x201fe8){_0x201fe8=_0x201fe8||0xc8;return function(_0x16de68){if(_0x16de68){return _0x5257ac[_0x9c2f('0x1c')](_0x201fe8)[_0x9c2f('0x1e')](_0x16de68);}};}function respondWithFilteredResult(_0x33c2e5,_0x940be5){return function(_0x14a1f8){if(_0x14a1f8){var _0x22139c=typeof _0x940be5['offset']===_0x9c2f('0x1f')&&typeof _0x940be5[_0x9c2f('0x20')]===_0x9c2f('0x1f');var _0x46f89a=_0x14a1f8[_0x9c2f('0x21')];var _0x17aa5e=_0x22139c?0x0:_0x940be5[_0x9c2f('0x22')];var _0x268245=_0x22139c?_0x14a1f8[_0x9c2f('0x21')]:_0x940be5[_0x9c2f('0x22')]+_0x940be5[_0x9c2f('0x20')];var _0x243c5f;if(_0x268245>=_0x46f89a){_0x268245=_0x46f89a;_0x243c5f=0xc8;}else{_0x243c5f=0xce;}_0x33c2e5['status'](_0x243c5f);return _0x33c2e5[_0x9c2f('0x23')](_0x9c2f('0x24'),_0x17aa5e+'-'+_0x268245+'/'+_0x46f89a)[_0x9c2f('0x1e')](_0x14a1f8);}return null;};}function patchUpdates(_0x504446){return function(_0x237d78){try{jsonpatch[_0x9c2f('0x25')](_0x237d78,_0x504446,!![]);}catch(_0xfaefe2){return BPromise[_0x9c2f('0x26')](_0xfaefe2);}return _0x237d78[_0x9c2f('0x27')]();};}function saveUpdates(_0x5465e2,_0x32f778){return function(_0x4df193){if(_0x4df193){return _0x4df193[_0x9c2f('0x28')](_0x5465e2)['then'](function(_0x529570){return _0x529570;});}return null;};}function removeEntity(_0x242aff,_0x3613d4){return function(_0x2149c4){if(_0x2149c4){return _0x2149c4[_0x9c2f('0x29')]()['then'](function(){_0x242aff[_0x9c2f('0x1c')](0xcc)[_0x9c2f('0x1d')]();});}};}function handleEntityNotFound(_0x2daf6b,_0x55496c){return function(_0x5900d8){if(!_0x5900d8){_0x2daf6b['sendStatus'](0x194);}return _0x5900d8;};}function handleError(_0x57720e,_0x49b1e0){_0x49b1e0=_0x49b1e0||0x1f4;return function(_0x38e962){logger['error'](_0x38e962['stack']);if(_0x38e962[_0x9c2f('0x2a')]){delete _0x38e962[_0x9c2f('0x2a')];}_0x57720e[_0x9c2f('0x1c')](_0x49b1e0)[_0x9c2f('0x2b')](_0x38e962);};}exports['index']=function(_0x4b962e,_0xbc5b9c){var _0x2232c5={},_0x369f1f={},_0x630ea1={'count':0x0,'rows':[]};var _0x543686=_[_0x9c2f('0x2c')](db[_0x9c2f('0x2d')][_0x9c2f('0x2e')],function(_0xf7ceea){return{'name':_0xf7ceea[_0x9c2f('0x2f')],'type':_0xf7ceea[_0x9c2f('0x30')][_0x9c2f('0x31')]};});_0x369f1f[_0x9c2f('0x32')]=_[_0x9c2f('0x2c')](_0x543686,_0x9c2f('0x2a'));_0x369f1f[_0x9c2f('0x33')]=_['keys'](_0x4b962e[_0x9c2f('0x33')]);_0x369f1f[_0x9c2f('0x34')]=_[_0x9c2f('0x35')](_0x369f1f[_0x9c2f('0x32')],_0x369f1f[_0x9c2f('0x33')]);_0x2232c5['attributes']=_[_0x9c2f('0x35')](_0x369f1f['model'],qs[_0x9c2f('0x36')](_0x4b962e[_0x9c2f('0x33')]['fields']));_0x2232c5[_0x9c2f('0x37')]=_0x2232c5[_0x9c2f('0x37')][_0x9c2f('0x38')]?_0x2232c5[_0x9c2f('0x37')]:_0x369f1f[_0x9c2f('0x32')];if(!_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x39')](_0x9c2f('0x3a'))){_0x2232c5[_0x9c2f('0x20')]=qs[_0x9c2f('0x20')](_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x20')]);_0x2232c5[_0x9c2f('0x22')]=qs['offset'](_0x4b962e['query'][_0x9c2f('0x22')]);}_0x2232c5[_0x9c2f('0x3b')]=qs[_0x9c2f('0x3c')](_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x3c')]);_0x2232c5['where']=qs[_0x9c2f('0x34')](_['pick'](_0x4b962e[_0x9c2f('0x33')],_0x369f1f[_0x9c2f('0x34')]),_0x543686);if(_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x3d')]){_0x2232c5[_0x9c2f('0x3e')]=_['merge'](_0x2232c5[_0x9c2f('0x3e')],{'$or':_[_0x9c2f('0x2c')](_0x543686,function(_0x107eb1){if(_0x107eb1[_0x9c2f('0x30')]!==_0x9c2f('0x3f')){var _0x46ac47={};_0x46ac47[_0x107eb1[_0x9c2f('0x2a')]]={'$like':'%'+_0x4b962e[_0x9c2f('0x33')]['filter']+'%'};return _0x46ac47;}})});}_0x2232c5=_[_0x9c2f('0x40')]({},_0x2232c5,_0x4b962e[_0x9c2f('0x41')]);var _0x526b18={'where':_0x2232c5[_0x9c2f('0x3e')]};return db[_0x9c2f('0x2d')][_0x9c2f('0x21')](_0x526b18)[_0x9c2f('0x42')](function(_0x253ba4){_0x630ea1['count']=_0x253ba4;if(_0x4b962e[_0x9c2f('0x33')][_0x9c2f('0x43')]){_0x2232c5[_0x9c2f('0x44')]=[{'all':!![]}];}return db[_0x9c2f('0x2d')][_0x9c2f('0x45')](_0x2232c5);})['then'](function(_0x23cf60){_0x630ea1[_0x9c2f('0x46')]=_0x23cf60;return _0x630ea1;})[_0x9c2f('0x42')](respondWithFilteredResult(_0xbc5b9c,_0x2232c5))[_0x9c2f('0x47')](handleError(_0xbc5b9c,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 6b2ae73..413d847 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 _0x8dbc=['rimraf','./migration.attributes','exports','define','migrations','util','../../config/logger','api'];(function(_0x51e347,_0x1b565a){var _0x49ab46=function(_0x5962cf){while(--_0x5962cf){_0x51e347['push'](_0x51e347['shift']());}};_0x49ab46(++_0x1b565a);}(_0x8dbc,0x105));var _0xc8db=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x8dbc[_0x1d9aa0];return _0x226868;};'use strict';var _=require('lodash');var util=require(_0xc8db('0x0'));var logger=require(_0xc8db('0x1'))(_0xc8db('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(_0xc8db('0x3'));var config=require('../../config/environment');var attributes=require(_0xc8db('0x4'));module[_0xc8db('0x5')]=function(_0xad015,_0x3bf7b8){return _0xad015[_0xc8db('0x6')]('Migration',attributes,{'tableName':_0xc8db('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09e9=['path','../../config/environment','./migration.attributes','exports','define','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x57fb26,_0x7b087b){var _0x3f73c1=function(_0x15a94a){while(--_0x15a94a){_0x57fb26['push'](_0x57fb26['shift']());}};_0x3f73c1(++_0x7b087b);}(_0x09e9,0x89));var _0x909e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x09e9[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0x909e('0x0'));var util=require('util');var logger=require(_0x909e('0x1'))(_0x909e('0x2'));var moment=require(_0x909e('0x3'));var BPromise=require(_0x909e('0x4'));var rp=require(_0x909e('0x5'));var fs=require('fs');var path=require(_0x909e('0x6'));var rimraf=require('rimraf');var config=require(_0x909e('0x7'));var attributes=require(_0x909e('0x8'));module[_0x909e('0x9')]=function(_0x46d46c,_0x4173d4){return _0x46d46c[_0x909e('0xa')]('Migration',attributes,{'tableName':'migrations','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 7bbe927..fa563e7 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 _0xd110=['error','code','message','Migration,\x20%s,\x20%s','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c177d,_0x53103d){var _0x17337a=function(_0x7974d2){while(--_0x7974d2){_0x5c177d['push'](_0x5c177d['shift']());}};_0x17337a(++_0x53103d);}(_0xd110,0x1e8));var _0x0d11=function(_0x57f8fd,_0x74c327){_0x57f8fd=_0x57f8fd-0x0;var _0x4fa11f=_0xd110[_0x57f8fd];return _0x4fa11f;};'use strict';var _=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var moment=require(_0x0d11('0x2'));var BPromise=require('bluebird');var rs=require(_0x0d11('0x3'));var fs=require('fs');var Redis=require(_0x0d11('0x4'));var db=require(_0x0d11('0x5'))['db'];var utils=require(_0x0d11('0x6'));var logger=require(_0x0d11('0x7'))(_0x0d11('0x8'));var config=require(_0x0d11('0x9'));var jayson=require(_0x0d11('0xa'));var client=jayson['client'][_0x0d11('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a889c,_0x33c46e,_0x4f3f3f){return new BPromise(function(_0x47a493,_0x3f9f5a){return client[_0x0d11('0xc')](_0x5a889c,_0x4f3f3f)[_0x0d11('0xd')](function(_0x4c6a59){logger[_0x0d11('0xe')]('Migration,\x20%s,\x20%s',_0x33c46e,_0x0d11('0xf'));logger['debug'](_0x0d11('0x10'),_0x33c46e,_0x0d11('0xf'),JSON[_0x0d11('0x11')](_0x4c6a59));if(_0x4c6a59[_0x0d11('0x12')]){if(_0x4c6a59['error'][_0x0d11('0x13')]===0x1f4){logger[_0x0d11('0x12')]('Migration,\x20%s,\x20%s',_0x33c46e,_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);return _0x3f9f5a(_0x4c6a59[_0x0d11('0x12')]['message']);}logger[_0x0d11('0x12')](_0x0d11('0x15'),_0x33c46e,_0x4c6a59['error'][_0x0d11('0x14')]);return _0x47a493(_0x4c6a59[_0x0d11('0x12')][_0x0d11('0x14')]);}else{logger[_0x0d11('0xe')](_0x0d11('0x15'),_0x33c46e,'request\x20sent');_0x47a493(_0x4c6a59['result'][_0x0d11('0x14')]);}})['catch'](function(_0x46aa4f){logger[_0x0d11('0x12')]('Migration,\x20%s,\x20%s',_0x33c46e,_0x46aa4f);_0x3f9f5a(_0x46aa4f);});});} \ No newline at end of file +var _0x9f4d=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x4a56a6,_0x5b81b2){var _0x4b7217=function(_0x19e522){while(--_0x19e522){_0x4a56a6['push'](_0x4a56a6['shift']());}};_0x4b7217(++_0x5b81b2);}(_0x9f4d,0xb0));var _0xd9f4=function(_0x9a51b3,_0x34ac18){_0x9a51b3=_0x9a51b3-0x0;var _0x4ca7b1=_0x9f4d[_0x9a51b3];return _0x4ca7b1;};'use strict';var _=require(_0xd9f4('0x0'));var util=require(_0xd9f4('0x1'));var moment=require(_0xd9f4('0x2'));var BPromise=require(_0xd9f4('0x3'));var rs=require(_0xd9f4('0x4'));var fs=require('fs');var Redis=require(_0xd9f4('0x5'));var db=require(_0xd9f4('0x6'))['db'];var utils=require(_0xd9f4('0x7'));var logger=require(_0xd9f4('0x8'))('rpc');var config=require(_0xd9f4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xd9f4('0xa')][_0xd9f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2cc036,_0x366b9d,_0x5cf448){return new BPromise(function(_0x6b13b5,_0x18305f){return client['request'](_0x2cc036,_0x5cf448)[_0xd9f4('0xc')](function(_0x47d52f){logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));logger[_0xd9f4('0x10')](_0xd9f4('0x11'),_0x366b9d,'request\x20sent',JSON[_0xd9f4('0x12')](_0x47d52f));if(_0x47d52f[_0xd9f4('0x13')]){if(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x14')]===0x1f4){logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x18305f(_0x47d52f['error'][_0xd9f4('0x15')]);}logger[_0xd9f4('0x13')](_0xd9f4('0xe'),_0x366b9d,_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);return _0x6b13b5(_0x47d52f[_0xd9f4('0x13')][_0xd9f4('0x15')]);}else{logger[_0xd9f4('0xd')](_0xd9f4('0xe'),_0x366b9d,_0xd9f4('0xf'));_0x6b13b5(_0x47d52f[_0xd9f4('0x16')][_0xd9f4('0x15')]);}})[_0xd9f4('0x17')](function(_0x5e7da1){logger['error']('Migration,\x20%s,\x20%s',_0x366b9d,_0x5e7da1);_0x18305f(_0x5e7da1);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index bd3b642..8f12b81 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 _0x9bd9=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports'];(function(_0x4ccfc6,_0x611f5d){var _0x47792e=function(_0x5afc7c){while(--_0x5afc7c){_0x4ccfc6['push'](_0x4ccfc6['shift']());}};_0x47792e(++_0x611f5d);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x40c043,_0x1d064e){_0x40c043=_0x40c043-0x0;var _0x5c2c8d=_0x9bd9[_0x40c043];return _0x5c2c8d;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xe')]('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0x10')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router[_0x99bd('0x12')]('/:id',auth[_0x99bd('0x9')](),controller['destroy']);module[_0x99bd('0x13')]=router; \ No newline at end of file +var _0x3843=['create','put','update','destroy','multer','util','path','Router','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','post'];(function(_0x3f88c6,_0x33ec02){var _0x2eac42=function(_0x4aab73){while(--_0x4aab73){_0x3f88c6['push'](_0x3f88c6['shift']());}};_0x2eac42(++_0x33ec02);}(_0x3843,0x144));var _0x3384=function(_0x575f8c,_0x22433f){_0x575f8c=_0x575f8c-0x0;var _0x362caf=_0x3843[_0x575f8c];return _0x362caf;};'use strict';var multer=require(_0x3384('0x0'));var util=require(_0x3384('0x1'));var path=require(_0x3384('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3384('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x3384('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3384('0x5'));var controller=require('./network.controller');router[_0x3384('0x6')]('/',auth['isAuthenticated'](),controller[_0x3384('0x7')]);router[_0x3384('0x6')](_0x3384('0x8'),auth[_0x3384('0x9')](),controller[_0x3384('0xa')]);router[_0x3384('0xb')]('/',auth[_0x3384('0x9')](),controller[_0x3384('0xc')]);router[_0x3384('0xd')](_0x3384('0x8'),auth[_0x3384('0x9')](),controller[_0x3384('0xe')]);router['delete']('/:id',auth[_0x3384('0x9')](),controller[_0x3384('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 83643ef..8eed34a 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 _0x4541=['turn','STRING','exports','stun'];(function(_0x5a9776,_0x4b5ab3){var _0x454edb=function(_0x4116ae){while(--_0x4116ae){_0x5a9776['push'](_0x5a9776['shift']());}};_0x454edb(++_0x4b5ab3);}(_0x4541,0xfe));var _0x1454=function(_0x2f46f5,_0x1fe332){_0x2f46f5=_0x2f46f5-0x0;var _0x30a2bd=_0x4541[_0x2f46f5];return _0x30a2bd;};'use strict';var Sequelize=require('sequelize');module[_0x1454('0x0')]={'type':{'type':Sequelize['ENUM']('localnet','externip',_0x1454('0x1'),_0x1454('0x2'))},'value':{'type':Sequelize[_0x1454('0x3')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5af2=['STRING','sequelize','exports','ENUM','localnet','turn'];(function(_0x2ba4ed,_0x3fd1ed){var _0x5b27fc=function(_0xa2b1c){while(--_0xa2b1c){_0x2ba4ed['push'](_0x2ba4ed['shift']());}};_0x5b27fc(++_0x3fd1ed);}(_0x5af2,0x18d));var _0x25af=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x5af2[_0x1d1779];return _0x2377e9;};'use strict';var Sequelize=require(_0x25af('0x0'));module[_0x25af('0x1')]={'type':{'type':Sequelize[_0x25af('0x2')](_0x25af('0x3'),'externip','stun',_0x25af('0x4'))},'value':{'type':Sequelize[_0x25af('0x5')]},'username':{'type':Sequelize[_0x25af('0x5')]},'password':{'type':Sequelize[_0x25af('0x5')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 61d9468..db14b92 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 _0x194d=['key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','findAll','catch','show','params','rawAttributes','find','create','body','toUpperCase','readFileSync','join','server/files/templates/stun_multiple.ejs','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','STUN','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','json','offset','undefined','count','limit','set','Content-Range','update','destroy','status','sendStatus','name','index','map','Network','fieldName'];(function(_0x469979,_0x42131f){var _0x443035=function(_0x1ae2df){while(--_0x1ae2df){_0x469979['push'](_0x469979['shift']());}};_0x443035(++_0x42131f);}(_0x194d,0x7f));var _0xd194=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x194d[_0xb0f7c3];return _0x28ea68;};'use strict';var util=require(_0xd194('0x0'));var path=require(_0xd194('0x1'));var ejs=require(_0xd194('0x2'));var fs=require('fs');var _=require(_0xd194('0x3'));var qs=require(_0xd194('0x4'));var logger=require(_0xd194('0x5'))('api');var config=require(_0xd194('0x6'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd194('0x7'));var client=jayson[_0xd194('0x8')][_0xd194('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14867e,_0x2f52dc,_0x570781,_0x3a9e12){return new Promise(function(_0x2172bf,_0x264f09){var _0x1b107d=_0x3a9e12||client;return _0x1b107d['request'](_0x14867e,_0x570781)[_0xd194('0xa')](function(_0x1677de){logger[_0xd194('0xb')](_0xd194('0xc'),_0x2f52dc,'request\x20sent');logger[_0xd194('0xd')](_0xd194('0xe'),_0x2f52dc,_0xd194('0xf'),JSON[_0xd194('0x10')](_0x1677de));if(_0x1677de[_0xd194('0x11')]){if(_0x1677de[_0xd194('0x11')][_0xd194('0x12')]===0x1f4){logger[_0xd194('0x11')]('Network,\x20%s,\x20%s',_0x2f52dc,_0x1677de['error'][_0xd194('0x13')]);return _0x264f09(_0x1677de[_0xd194('0x11')][_0xd194('0x13')]);}logger[_0xd194('0x11')](_0xd194('0xc'),_0x2f52dc,_0x1677de['error']['message']);return _0x2172bf(_0x1677de[_0xd194('0x11')][_0xd194('0x13')]);}else{logger[_0xd194('0xb')](_0xd194('0xc'),_0x2f52dc,_0xd194('0xf'));_0x2172bf(_0x1677de[_0xd194('0x14')][_0xd194('0x13')]);}})['catch'](function(_0x40046d){logger[_0xd194('0x11')](_0xd194('0xc'),_0x2f52dc,_0x40046d);_0x264f09(_0x40046d);});});}function respondWithResult(_0x5bd7aa,_0xd2fd57){_0xd2fd57=_0xd2fd57||0xc8;return function(_0x5b42c4){if(_0x5b42c4){return _0x5bd7aa['status'](_0xd2fd57)[_0xd194('0x15')](_0x5b42c4);}};}function respondWithFilteredResult(_0x3d6d3b,_0x4c14d0){return function(_0x7a3a2c){if(_0x7a3a2c){var _0x3799e9=typeof _0x4c14d0[_0xd194('0x16')]==='undefined'&&typeof _0x4c14d0['limit']===_0xd194('0x17');var _0x491f3f=_0x7a3a2c[_0xd194('0x18')];var _0x399202=_0x3799e9?0x0:_0x4c14d0['offset'];var _0x3c31fc=_0x3799e9?_0x7a3a2c[_0xd194('0x18')]:_0x4c14d0['offset']+_0x4c14d0[_0xd194('0x19')];var _0x599760;if(_0x3c31fc>=_0x491f3f){_0x3c31fc=_0x491f3f;_0x599760=0xc8;}else{_0x599760=0xce;}_0x3d6d3b['status'](_0x599760);return _0x3d6d3b[_0xd194('0x1a')](_0xd194('0x1b'),_0x399202+'-'+_0x3c31fc+'/'+_0x491f3f)[_0xd194('0x15')](_0x7a3a2c);}return null;};}function saveUpdates(_0x443d03){return function(_0x5808e9){if(_0x5808e9){return _0x5808e9[_0xd194('0x1c')](_0x443d03)[_0xd194('0xa')](function(_0x66cd7c){return _0x66cd7c;});}return null;};}function removeEntity(_0x10f499){return function(_0xe0190d){if(_0xe0190d){return _0xe0190d[_0xd194('0x1d')]()['then'](function(){_0x10f499[_0xd194('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2acc67){return function(_0x328d02){if(!_0x328d02){_0x2acc67[_0xd194('0x1f')](0x194);}return _0x328d02;};}function handleError(_0x3157ad,_0x28b745){_0x28b745=_0x28b745||0x1f4;return function(_0x2942e5){logger[_0xd194('0x11')](_0x2942e5['stack']);if(_0x2942e5[_0xd194('0x20')]){delete _0x2942e5[_0xd194('0x20')];}_0x3157ad['status'](_0x28b745)['send'](_0x2942e5);};}exports[_0xd194('0x21')]=function(_0x30d869,_0x128f6a){var _0x57b27e={},_0x165de3={},_0x4b9b99={'count':0x0,'rows':[]};var _0x279957=_[_0xd194('0x22')](db[_0xd194('0x23')]['rawAttributes'],function(_0x45c0ef){return{'name':_0x45c0ef[_0xd194('0x24')],'type':_0x45c0ef['type'][_0xd194('0x25')]};});_0x165de3[_0xd194('0x26')]=_[_0xd194('0x22')](_0x279957,_0xd194('0x20'));_0x165de3[_0xd194('0x27')]=_[_0xd194('0x28')](_0x30d869[_0xd194('0x27')]);_0x165de3[_0xd194('0x29')]=_[_0xd194('0x2a')](_0x165de3[_0xd194('0x26')],_0x165de3[_0xd194('0x27')]);_0x57b27e[_0xd194('0x2b')]=_['intersection'](_0x165de3['model'],qs['fields'](_0x30d869[_0xd194('0x27')][_0xd194('0x2c')]));_0x57b27e[_0xd194('0x2b')]=_0x57b27e['attributes']['length']?_0x57b27e['attributes']:_0x165de3[_0xd194('0x26')];if(!_0x30d869[_0xd194('0x27')][_0xd194('0x2d')](_0xd194('0x2e'))){_0x57b27e['limit']=qs[_0xd194('0x19')](_0x30d869[_0xd194('0x27')][_0xd194('0x19')]);_0x57b27e[_0xd194('0x16')]=qs[_0xd194('0x16')](_0x30d869[_0xd194('0x27')]['offset']);}_0x57b27e['order']=qs[_0xd194('0x2f')](_0x30d869[_0xd194('0x27')]['sort']);_0x57b27e[_0xd194('0x30')]=qs['filters'](_[_0xd194('0x31')](_0x30d869[_0xd194('0x27')],_0x165de3[_0xd194('0x29')]),_0x279957);if(_0x30d869[_0xd194('0x27')][_0xd194('0x32')]){_0x57b27e[_0xd194('0x30')]=_[_0xd194('0x33')](_0x57b27e[_0xd194('0x30')],{'$or':_['map'](_0x279957,function(_0x2b6da0){if(_0x2b6da0[_0xd194('0x34')]!=='VIRTUAL'){var _0x37d036={};_0x37d036[_0x2b6da0['name']]={'$like':'%'+_0x30d869[_0xd194('0x27')][_0xd194('0x32')]+'%'};return _0x37d036;}})});}_0x57b27e=_[_0xd194('0x33')]({},_0x57b27e,_0x30d869[_0xd194('0x35')]);var _0x3b47af={'where':_0x57b27e[_0xd194('0x30')]};return db[_0xd194('0x23')]['count'](_0x3b47af)['then'](function(_0xfc62c8){_0x4b9b99[_0xd194('0x18')]=_0xfc62c8;if(_0x30d869['query']['includeAll']){_0x57b27e['include']=[{'all':!![]}];}return db[_0xd194('0x23')][_0xd194('0x36')](_0x57b27e);})[_0xd194('0xa')](function(_0x3694ac){_0x4b9b99['rows']=_0x3694ac;return _0x4b9b99;})['then'](respondWithFilteredResult(_0x128f6a,_0x57b27e))[_0xd194('0x37')](handleError(_0x128f6a,null));};exports[_0xd194('0x38')]=function(_0x598ca1,_0x29c006){var _0x3d2655={'raw':!![],'where':{'id':_0x598ca1[_0xd194('0x39')]['id']}},_0x2c6449={};_0x2c6449[_0xd194('0x26')]=_[_0xd194('0x28')](db['Network'][_0xd194('0x3a')]);_0x2c6449[_0xd194('0x27')]=_[_0xd194('0x28')](_0x598ca1[_0xd194('0x27')]);_0x2c6449['filters']=_[_0xd194('0x2a')](_0x2c6449[_0xd194('0x26')],_0x2c6449[_0xd194('0x27')]);_0x3d2655[_0xd194('0x2b')]=_[_0xd194('0x2a')](_0x2c6449[_0xd194('0x26')],qs[_0xd194('0x2c')](_0x598ca1['query']['fields']));_0x3d2655[_0xd194('0x2b')]=_0x3d2655[_0xd194('0x2b')]['length']?_0x3d2655[_0xd194('0x2b')]:_0x2c6449[_0xd194('0x26')];if(_0x598ca1[_0xd194('0x27')]['includeAll']){_0x3d2655['include']=[{'all':!![]}];}_0x3d2655=_['merge']({},_0x3d2655,_0x598ca1[_0xd194('0x35')]);return db['Network'][_0xd194('0x3b')](_0x3d2655)[_0xd194('0xa')](handleEntityNotFound(_0x29c006,null))['then'](respondWithResult(_0x29c006,null))['catch'](handleError(_0x29c006,null));};exports[_0xd194('0x3c')]=function(_0x5cacaa,_0x7676b8){var _0x6186a3;return db['Network'][_0xd194('0x3c')](_0x5cacaa[_0xd194('0x3d')],{'raw':!![]})['then'](function(_0x29b250){_0x6186a3=_0x29b250;return db[_0xd194('0x23')][_0xd194('0x36')]({'where':{'type':_0x5cacaa[_0xd194('0x3d')][_0xd194('0x34')]},'raw':!![]});})[_0xd194('0xa')](function(_0x4bcd26){if(_0x6186a3[_0xd194('0x34')][_0xd194('0x3e')]()=='STUN'){var _0x1a6e67=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config['root'],_0xd194('0x41')),'utf8');var _0x3ce455=ejs['render'](_0x1a6e67,{'networks':_0x4bcd26||[]});fs[_0xd194('0x42')](_0xd194('0x43'),_0x3ce455);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x3c'),{'module':_0xd194('0x45')});}else if(_0x6186a3['type'][_0xd194('0x3e')]()==_0xd194('0x46')){var _0x343913=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],_0xd194('0x48')),_0xd194('0x49'));var _0x207d25=ejs['render'](_0x343913,{'networks':_0x4bcd26||[]});fs[_0xd194('0x42')](_0xd194('0x4a'),_0x207d25);return respondWithRpcPromise('Reload',_0xd194('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x32d67f=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],_0xd194('0x4b')),_0xd194('0x49'));var _0x2d4f21=ejs[_0xd194('0x4c')](_0x32d67f,{'networks':_0x4bcd26||[]});fs[_0xd194('0x42')](util[_0xd194('0x4d')](_0xd194('0x4e'),_0x5cacaa[_0xd194('0x3d')][_0xd194('0x34')]['toLowerCase']()),_0x2d4f21);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x3c'),{'module':_0xd194('0x4f')});}})[_0xd194('0xa')](function(){return _0x6186a3;})[_0xd194('0xa')](respondWithResult(_0x7676b8,0xc9))['catch'](handleError(_0x7676b8,null));};exports[_0xd194('0x1c')]=function(_0x17235c,_0x1d18c2){var _0x43c171;return db[_0xd194('0x23')][_0xd194('0x3b')]({'where':{'id':_0x17235c[_0xd194('0x39')]['id']}})[_0xd194('0xa')](handleEntityNotFound(_0x1d18c2,null))[_0xd194('0xa')](saveUpdates(_0x17235c['body'],null))['then'](function(_0x4b3e9b){if(_0x4b3e9b){_0x43c171=_0x4b3e9b;return db['Network'][_0xd194('0x36')]({'where':{'type':_0x43c171[_0xd194('0x34')]},'raw':!![]});}return null;})['then'](function(_0x7b2cc){if(_0x43c171['type'][_0xd194('0x3e')]()==_0xd194('0x50')){var _0x297ef3=fs[_0xd194('0x3f')](path['join'](config[_0xd194('0x47')],_0xd194('0x41')),_0xd194('0x49'));var _0xec1a=ejs[_0xd194('0x4c')](_0x297ef3,{'networks':_0x7b2cc||[]});fs[_0xd194('0x42')](_0xd194('0x43'),_0xec1a);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1c'),{'module':_0xd194('0x45')});}else if(_0x43c171[_0xd194('0x34')]['toUpperCase']()==_0xd194('0x46')){var _0x36480e=fs[_0xd194('0x3f')](path['join'](config[_0xd194('0x47')],_0xd194('0x48')),_0xd194('0x49'));var _0x12760e=ejs[_0xd194('0x4c')](_0x36480e,{'networks':_0x7b2cc||[]});fs[_0xd194('0x42')](_0xd194('0x4a'),_0x12760e);return respondWithRpcPromise('Reload',_0xd194('0x1c'),{'module':'res_stun_monitor.so'});}else{var _0x102d0a=fs[_0xd194('0x3f')](path['join'](config['root'],'server/files/templates/network.ejs'),_0xd194('0x49'));var _0x3b9cbd=ejs[_0xd194('0x4c')](_0x102d0a,{'networks':_0x7b2cc||[]});fs[_0xd194('0x42')](util[_0xd194('0x4d')](_0xd194('0x4e'),_0x17235c['body'][_0xd194('0x34')][_0xd194('0x51')]()),_0x3b9cbd);return respondWithRpcPromise(_0xd194('0x44'),'update',{'module':_0xd194('0x4f')});}})['then'](function(_0x26453c){if(_0x26453c){return _0x43c171;}return null;})[_0xd194('0xa')](respondWithResult(_0x1d18c2,null))[_0xd194('0x37')](handleError(_0x1d18c2,null));};exports[_0xd194('0x1d')]=function(_0x4a37b6,_0x2f1d02){var _0x5d1469;return db['Network']['find']({'where':{'id':_0x4a37b6[_0xd194('0x39')]['id']}})[_0xd194('0xa')](function(_0x14088b){_0x5d1469=_0x14088b;return _0x14088b;})[_0xd194('0xa')](handleEntityNotFound(_0x2f1d02,null))[_0xd194('0xa')](removeEntity(_0x2f1d02,null))[_0xd194('0xa')](function(){if(_0x5d1469){return db[_0xd194('0x23')][_0xd194('0x36')]({'where':{'type':_0x5d1469[_0xd194('0x34')]},'raw':!![]});}})[_0xd194('0xa')](function(_0x411b46){if(_0x5d1469['type']['toUpperCase']()==_0xd194('0x50')){var _0x225a1c=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],'server/files/templates/stun_multiple.ejs'),_0xd194('0x49'));var _0x1a5444=ejs[_0xd194('0x4c')](_0x225a1c,{'networks':_0x411b46||[]});fs[_0xd194('0x42')](_0xd194('0x43'),_0x1a5444);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1d'),{'module':_0xd194('0x45')});}else if(_0x5d1469['type'][_0xd194('0x3e')]()==_0xd194('0x46')){var _0x1427b0=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config[_0xd194('0x47')],_0xd194('0x48')),_0xd194('0x49'));var _0x2abfdc=ejs['render'](_0x1427b0,{'networks':_0x411b46||[]});fs[_0xd194('0x42')](_0xd194('0x4a'),_0x2abfdc);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1d'),{'module':_0xd194('0x45')});}else{var _0x58c4dd=fs[_0xd194('0x3f')](path[_0xd194('0x40')](config['root'],'server/files/templates/network.ejs'),_0xd194('0x49'));var _0x4eece0=ejs[_0xd194('0x4c')](_0x58c4dd,{'networks':_0x411b46||[]});fs[_0xd194('0x42')](util[_0xd194('0x4d')](_0xd194('0x4e'),_0x5d1469[_0xd194('0x34')]['toLowerCase']()),_0x4eece0);return respondWithRpcPromise(_0xd194('0x44'),_0xd194('0x1d'),{'module':_0xd194('0x4f')});}})[_0xd194('0x37')](handleError(_0x2f1d02,null));}; \ No newline at end of file +var _0x0562=['Content-Range','update','then','destroy','stack','name','send','index','map','Network','rawAttributes','type','key','query','keys','filters','attributes','model','fields','length','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','intersection','include','find','create','body','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','STUN','res_stun_monitor.so','util','path','lodash','../../config/logger','../../config/environment','../../mysqldb','client','http','request','info','debug','Network,\x20%s,\x20%s,\x20%s','stringify','code','error','Network,\x20%s,\x20%s','message','request\x20sent','catch','status','json','offset','undefined','limit','count','set'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x0562,0x8c));var _0x2056=function(_0x35ec08,_0x3d7033){_0x35ec08=_0x35ec08-0x0;var _0xd818dd=_0x0562[_0x35ec08];return _0xd818dd;};'use strict';var util=require(_0x2056('0x0'));var path=require(_0x2056('0x1'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2056('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x2056('0x3'))('api');var config=require(_0x2056('0x4'));var db=require(_0x2056('0x5'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x2056('0x6')][_0x2056('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x54ef8b,_0x580600,_0x3218a4,_0x3ca0f2){return new Promise(function(_0x20a93f,_0x20800c){var _0x3d4411=_0x3ca0f2||client;return _0x3d4411[_0x2056('0x8')](_0x54ef8b,_0x3218a4)['then'](function(_0x4b637f){logger[_0x2056('0x9')]('Network,\x20%s,\x20%s',_0x580600,'request\x20sent');logger[_0x2056('0xa')](_0x2056('0xb'),_0x580600,'request\x20sent',JSON[_0x2056('0xc')](_0x4b637f));if(_0x4b637f['error']){if(_0x4b637f['error'][_0x2056('0xd')]===0x1f4){logger[_0x2056('0xe')](_0x2056('0xf'),_0x580600,_0x4b637f['error']['message']);return _0x20800c(_0x4b637f[_0x2056('0xe')]['message']);}logger[_0x2056('0xe')](_0x2056('0xf'),_0x580600,_0x4b637f[_0x2056('0xe')]['message']);return _0x20a93f(_0x4b637f[_0x2056('0xe')][_0x2056('0x10')]);}else{logger[_0x2056('0x9')]('Network,\x20%s,\x20%s',_0x580600,_0x2056('0x11'));_0x20a93f(_0x4b637f['result'][_0x2056('0x10')]);}})[_0x2056('0x12')](function(_0x48a571){logger['error'](_0x2056('0xf'),_0x580600,_0x48a571);_0x20800c(_0x48a571);});});}function respondWithResult(_0x5cab6e,_0x3fc68d){_0x3fc68d=_0x3fc68d||0xc8;return function(_0x482360){if(_0x482360){return _0x5cab6e[_0x2056('0x13')](_0x3fc68d)[_0x2056('0x14')](_0x482360);}};}function respondWithFilteredResult(_0xca84b0,_0x234d19){return function(_0x428b7a){if(_0x428b7a){var _0x23f740=typeof _0x234d19[_0x2056('0x15')]===_0x2056('0x16')&&typeof _0x234d19[_0x2056('0x17')]===_0x2056('0x16');var _0x695a9e=_0x428b7a[_0x2056('0x18')];var _0x559181=_0x23f740?0x0:_0x234d19['offset'];var _0x536335=_0x23f740?_0x428b7a['count']:_0x234d19[_0x2056('0x15')]+_0x234d19[_0x2056('0x17')];var _0x39e5b0;if(_0x536335>=_0x695a9e){_0x536335=_0x695a9e;_0x39e5b0=0xc8;}else{_0x39e5b0=0xce;}_0xca84b0[_0x2056('0x13')](_0x39e5b0);return _0xca84b0[_0x2056('0x19')](_0x2056('0x1a'),_0x559181+'-'+_0x536335+'/'+_0x695a9e)[_0x2056('0x14')](_0x428b7a);}return null;};}function saveUpdates(_0x33fbe6){return function(_0x2b554c){if(_0x2b554c){return _0x2b554c[_0x2056('0x1b')](_0x33fbe6)[_0x2056('0x1c')](function(_0x438157){return _0x438157;});}return null;};}function removeEntity(_0x157f3e){return function(_0x58d0fd){if(_0x58d0fd){return _0x58d0fd[_0x2056('0x1d')]()[_0x2056('0x1c')](function(){_0x157f3e[_0x2056('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x86c99b){return function(_0x2d77b3){if(!_0x2d77b3){_0x86c99b['sendStatus'](0x194);}return _0x2d77b3;};}function handleError(_0xb54f71,_0xa21593){_0xa21593=_0xa21593||0x1f4;return function(_0x536379){logger[_0x2056('0xe')](_0x536379[_0x2056('0x1e')]);if(_0x536379[_0x2056('0x1f')]){delete _0x536379[_0x2056('0x1f')];}_0xb54f71[_0x2056('0x13')](_0xa21593)[_0x2056('0x20')](_0x536379);};}exports[_0x2056('0x21')]=function(_0x1ad103,_0x1b5314){var _0x42dc59={},_0x2251fd={},_0x597225={'count':0x0,'rows':[]};var _0x573232=_[_0x2056('0x22')](db[_0x2056('0x23')][_0x2056('0x24')],function(_0x59f489){return{'name':_0x59f489['fieldName'],'type':_0x59f489[_0x2056('0x25')][_0x2056('0x26')]};});_0x2251fd['model']=_[_0x2056('0x22')](_0x573232,_0x2056('0x1f'));_0x2251fd[_0x2056('0x27')]=_[_0x2056('0x28')](_0x1ad103['query']);_0x2251fd[_0x2056('0x29')]=_['intersection'](_0x2251fd['model'],_0x2251fd['query']);_0x42dc59[_0x2056('0x2a')]=_['intersection'](_0x2251fd[_0x2056('0x2b')],qs[_0x2056('0x2c')](_0x1ad103[_0x2056('0x27')][_0x2056('0x2c')]));_0x42dc59[_0x2056('0x2a')]=_0x42dc59[_0x2056('0x2a')][_0x2056('0x2d')]?_0x42dc59[_0x2056('0x2a')]:_0x2251fd[_0x2056('0x2b')];if(!_0x1ad103['query']['hasOwnProperty'](_0x2056('0x2e'))){_0x42dc59[_0x2056('0x17')]=qs['limit'](_0x1ad103['query'][_0x2056('0x17')]);_0x42dc59[_0x2056('0x15')]=qs[_0x2056('0x15')](_0x1ad103['query'][_0x2056('0x15')]);}_0x42dc59['order']=qs[_0x2056('0x2f')](_0x1ad103[_0x2056('0x27')][_0x2056('0x2f')]);_0x42dc59[_0x2056('0x30')]=qs['filters'](_['pick'](_0x1ad103[_0x2056('0x27')],_0x2251fd[_0x2056('0x29')]),_0x573232);if(_0x1ad103[_0x2056('0x27')][_0x2056('0x31')]){_0x42dc59[_0x2056('0x30')]=_[_0x2056('0x32')](_0x42dc59['where'],{'$or':_[_0x2056('0x22')](_0x573232,function(_0x23121f){if(_0x23121f[_0x2056('0x25')]!==_0x2056('0x33')){var _0x42de3b={};_0x42de3b[_0x23121f[_0x2056('0x1f')]]={'$like':'%'+_0x1ad103['query'][_0x2056('0x31')]+'%'};return _0x42de3b;}})});}_0x42dc59=_[_0x2056('0x32')]({},_0x42dc59,_0x1ad103[_0x2056('0x34')]);var _0x6466c0={'where':_0x42dc59[_0x2056('0x30')]};return db[_0x2056('0x23')][_0x2056('0x18')](_0x6466c0)[_0x2056('0x1c')](function(_0x4dd078){_0x597225[_0x2056('0x18')]=_0x4dd078;if(_0x1ad103[_0x2056('0x27')][_0x2056('0x35')]){_0x42dc59['include']=[{'all':!![]}];}return db['Network'][_0x2056('0x36')](_0x42dc59);})['then'](function(_0x133730){_0x597225[_0x2056('0x37')]=_0x133730;return _0x597225;})['then'](respondWithFilteredResult(_0x1b5314,_0x42dc59))['catch'](handleError(_0x1b5314,null));};exports[_0x2056('0x38')]=function(_0x43b676,_0x56dec6){var _0x52906c={'raw':!![],'where':{'id':_0x43b676['params']['id']}},_0x1c0cd2={};_0x1c0cd2[_0x2056('0x2b')]=_[_0x2056('0x28')](db[_0x2056('0x23')]['rawAttributes']);_0x1c0cd2[_0x2056('0x27')]=_[_0x2056('0x28')](_0x43b676[_0x2056('0x27')]);_0x1c0cd2[_0x2056('0x29')]=_['intersection'](_0x1c0cd2[_0x2056('0x2b')],_0x1c0cd2['query']);_0x52906c[_0x2056('0x2a')]=_[_0x2056('0x39')](_0x1c0cd2[_0x2056('0x2b')],qs['fields'](_0x43b676['query'][_0x2056('0x2c')]));_0x52906c[_0x2056('0x2a')]=_0x52906c[_0x2056('0x2a')][_0x2056('0x2d')]?_0x52906c[_0x2056('0x2a')]:_0x1c0cd2['model'];if(_0x43b676[_0x2056('0x27')]['includeAll']){_0x52906c[_0x2056('0x3a')]=[{'all':!![]}];}_0x52906c=_[_0x2056('0x32')]({},_0x52906c,_0x43b676[_0x2056('0x34')]);return db[_0x2056('0x23')][_0x2056('0x3b')](_0x52906c)[_0x2056('0x1c')](handleEntityNotFound(_0x56dec6,null))[_0x2056('0x1c')](respondWithResult(_0x56dec6,null))['catch'](handleError(_0x56dec6,null));};exports[_0x2056('0x3c')]=function(_0xb0b5d7,_0x1093d6){var _0x250065;return db[_0x2056('0x23')][_0x2056('0x3c')](_0xb0b5d7[_0x2056('0x3d')],{'raw':!![]})[_0x2056('0x1c')](function(_0xe28fd4){_0x250065=_0xe28fd4;return db[_0x2056('0x23')][_0x2056('0x36')]({'where':{'type':_0xb0b5d7[_0x2056('0x3d')][_0x2056('0x25')]},'raw':!![]});})[_0x2056('0x1c')](function(_0xea8f42){if(_0x250065[_0x2056('0x25')]['toUpperCase']()=='STUN'){var _0x509732=fs['readFileSync'](path[_0x2056('0x3e')](config[_0x2056('0x3f')],_0x2056('0x40')),_0x2056('0x41'));var _0x4ceff4=ejs[_0x2056('0x42')](_0x509732,{'networks':_0xea8f42||[]});fs[_0x2056('0x43')](_0x2056('0x44'),_0x4ceff4);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x3c'),{'module':'res_stun_monitor.so'});}else if(_0x250065[_0x2056('0x25')][_0x2056('0x46')]()==_0x2056('0x47')){var _0x3b9638=fs[_0x2056('0x48')](path[_0x2056('0x3e')](config[_0x2056('0x3f')],_0x2056('0x49')),_0x2056('0x41'));var _0x59fdc9=ejs[_0x2056('0x42')](_0x3b9638,{'networks':_0xea8f42||[]});fs[_0x2056('0x43')](_0x2056('0x4a'),_0x59fdc9);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x4a03b6=fs[_0x2056('0x48')](path[_0x2056('0x3e')](config[_0x2056('0x3f')],_0x2056('0x4b')),'utf8');var _0x475ce9=ejs[_0x2056('0x42')](_0x4a03b6,{'networks':_0xea8f42||[]});fs['writeFileSync'](util[_0x2056('0x4c')](_0x2056('0x4d'),_0xb0b5d7['body'][_0x2056('0x25')][_0x2056('0x4e')]()),_0x475ce9);return respondWithRpcPromise('Reload',_0x2056('0x3c'),{'module':_0x2056('0x4f')});}})['then'](function(){return _0x250065;})[_0x2056('0x1c')](respondWithResult(_0x1093d6,0xc9))['catch'](handleError(_0x1093d6,null));};exports[_0x2056('0x1b')]=function(_0x2d11bf,_0x174b30){var _0x46ed52;return db[_0x2056('0x23')][_0x2056('0x3b')]({'where':{'id':_0x2d11bf[_0x2056('0x50')]['id']}})[_0x2056('0x1c')](handleEntityNotFound(_0x174b30,null))[_0x2056('0x1c')](saveUpdates(_0x2d11bf[_0x2056('0x3d')],null))[_0x2056('0x1c')](function(_0xdaa36f){if(_0xdaa36f){_0x46ed52=_0xdaa36f;return db['Network']['findAll']({'where':{'type':_0x46ed52[_0x2056('0x25')]},'raw':!![]});}return null;})['then'](function(_0x820a16){if(_0x46ed52[_0x2056('0x25')]['toUpperCase']()==_0x2056('0x51')){var _0x47f5d2=fs[_0x2056('0x48')](path[_0x2056('0x3e')](config[_0x2056('0x3f')],_0x2056('0x40')),_0x2056('0x41'));var _0x47c790=ejs[_0x2056('0x42')](_0x47f5d2,{'networks':_0x820a16||[]});fs[_0x2056('0x43')](_0x2056('0x44'),_0x47c790);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x1b'),{'module':_0x2056('0x52')});}else if(_0x46ed52[_0x2056('0x25')][_0x2056('0x46')]()=='TURN'){var _0x17ad3c=fs['readFileSync'](path[_0x2056('0x3e')](config[_0x2056('0x3f')],_0x2056('0x49')),_0x2056('0x41'));var _0x39435b=ejs[_0x2056('0x42')](_0x17ad3c,{'networks':_0x820a16||[]});fs[_0x2056('0x43')](_0x2056('0x4a'),_0x39435b);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x1b'),{'module':_0x2056('0x52')});}else{var _0x40d72e=fs[_0x2056('0x48')](path[_0x2056('0x3e')](config['root'],_0x2056('0x4b')),_0x2056('0x41'));var _0x466d23=ejs['render'](_0x40d72e,{'networks':_0x820a16||[]});fs['writeFileSync'](util[_0x2056('0x4c')](_0x2056('0x4d'),_0x2d11bf[_0x2056('0x3d')][_0x2056('0x25')]['toLowerCase']()),_0x466d23);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x1b'),{'module':_0x2056('0x4f')});}})[_0x2056('0x1c')](function(_0x31a25a){if(_0x31a25a){return _0x46ed52;}return null;})[_0x2056('0x1c')](respondWithResult(_0x174b30,null))[_0x2056('0x12')](handleError(_0x174b30,null));};exports[_0x2056('0x1d')]=function(_0x2f7413,_0x4563f4){var _0x3ba5f7;return db[_0x2056('0x23')][_0x2056('0x3b')]({'where':{'id':_0x2f7413[_0x2056('0x50')]['id']}})['then'](function(_0xdbabf9){_0x3ba5f7=_0xdbabf9;return _0xdbabf9;})[_0x2056('0x1c')](handleEntityNotFound(_0x4563f4,null))['then'](removeEntity(_0x4563f4,null))[_0x2056('0x1c')](function(){if(_0x3ba5f7){return db[_0x2056('0x23')][_0x2056('0x36')]({'where':{'type':_0x3ba5f7[_0x2056('0x25')]},'raw':!![]});}})['then'](function(_0x2e1783){if(_0x3ba5f7['type'][_0x2056('0x46')]()==_0x2056('0x51')){var _0x4dfe81=fs[_0x2056('0x48')](path['join'](config[_0x2056('0x3f')],_0x2056('0x40')),'utf8');var _0x1488b1=ejs[_0x2056('0x42')](_0x4dfe81,{'networks':_0x2e1783||[]});fs[_0x2056('0x43')](_0x2056('0x44'),_0x1488b1);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x1d'),{'module':_0x2056('0x52')});}else if(_0x3ba5f7[_0x2056('0x25')]['toUpperCase']()==_0x2056('0x47')){var _0x26f2af=fs[_0x2056('0x48')](path['join'](config[_0x2056('0x3f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x245f21=ejs[_0x2056('0x42')](_0x26f2af,{'networks':_0x2e1783||[]});fs[_0x2056('0x43')](_0x2056('0x4a'),_0x245f21);return respondWithRpcPromise(_0x2056('0x45'),'destroy',{'module':_0x2056('0x52')});}else{var _0x192405=fs[_0x2056('0x48')](path[_0x2056('0x3e')](config[_0x2056('0x3f')],_0x2056('0x4b')),_0x2056('0x41'));var _0x42465d=ejs[_0x2056('0x42')](_0x192405,{'networks':_0x2e1783||[]});fs[_0x2056('0x43')](util[_0x2056('0x4c')](_0x2056('0x4d'),_0x3ba5f7[_0x2056('0x25')]['toLowerCase']()),_0x42465d);return respondWithRpcPromise(_0x2056('0x45'),_0x2056('0x1d'),{'module':'chan_sip.so'});}})[_0x2056('0x12')](handleError(_0x4563f4,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 6256350..f1e8690 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 _0xc6d8=['../../config/logger','moment','request-promise','../../config/environment','./network.attributes','exports','define','Network','lodash'];(function(_0x18a1c6,_0x4c0130){var _0x1f088d=function(_0x440dbc){while(--_0x440dbc){_0x18a1c6['push'](_0x18a1c6['shift']());}};_0x1f088d(++_0x4c0130);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2bdcfd,_0x32697d){_0x2bdcfd=_0x2bdcfd-0x0;var _0x53a635=_0xc6d8[_0x2bdcfd];return _0x53a635;};'use strict';var _=require(_0x8c6d('0x0'));var util=require('util');var logger=require(_0x8c6d('0x1'))('api');var moment=require(_0x8c6d('0x2'));var BPromise=require('bluebird');var rp=require(_0x8c6d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8c6d('0x4'));var attributes=require(_0x8c6d('0x5'));module[_0x8c6d('0x6')]=function(_0x4f5e8f,_0x3c265c){return _0x4f5e8f[_0x8c6d('0x7')](_0x8c6d('0x8'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x668b=['network','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./network.attributes','define','Network'];(function(_0x2b31a8,_0x28b862){var _0x1175a5=function(_0x2cdb5d){while(--_0x2cdb5d){_0x2b31a8['push'](_0x2b31a8['shift']());}};_0x1175a5(++_0x28b862);}(_0x668b,0x140));var _0xb668=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0x668b[_0x108d5f];return _0x456ea3;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var logger=require('../../config/logger')(_0xb668('0x2'));var moment=require(_0xb668('0x3'));var BPromise=require('bluebird');var rp=require(_0xb668('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb668('0x5'));var config=require(_0xb668('0x6'));var attributes=require(_0xb668('0x7'));module['exports']=function(_0x9b99a8,_0x296fa9){return _0x9b99a8[_0xb668('0x8')](_0xb668('0x9'),attributes,{'tableName':_0xb668('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 c3233a3..b54f8f4 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x593758,_0x3f9dde){var _0x4d1cb3=function(_0x1c35bb){while(--_0x1c35bb){_0x593758['push'](_0x593758['shift']());}};_0x4d1cb3(++_0x3f9dde);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +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(_0x5f01c7,_0x108cb8){var _0x338f7f=function(_0x40ade6){while(--_0x40ade6){_0x5f01c7['push'](_0x5f01c7['shift']());}};_0x338f7f(++_0x108cb8);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index dc20618..27d85a1 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 _0x36ee=['removeDispositions','removeAnswers','removeAgents','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/users','post','create','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','delete','destroy'];(function(_0x221a85,_0x1eaa37){var _0x5c58fb=function(_0x1f85f7){while(--_0x1f85f7){_0x221a85['push'](_0x221a85['shift']());}};_0x5c58fb(++_0x1eaa37);}(_0x36ee,0xe8));var _0xe36e=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36ee[_0x397e5f];return _0x5302b8;};'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['getApplications']);router[_0xe36e('0x8')](_0xe36e('0x14'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x15')]);router['get'](_0xe36e('0x16'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe36e('0x17')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0x18')]);router[_0xe36e('0x17')](_0xe36e('0xf'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x19')]);router[_0xe36e('0x17')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller['addAnswer']);router[_0xe36e('0x17')](_0xe36e('0x1a'),controller['notify']);router[_0xe36e('0x17')]('/:id/applications',auth[_0xe36e('0x9')](),controller[_0xe36e('0x1b')]);router['post'](_0xe36e('0x16'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x1c')]);router['post'](_0xe36e('0x1d'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x1e')]);router[_0xe36e('0x1f')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0x20')](_0xe36e('0xd'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x21')]);router[_0xe36e('0x20')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0xe36e('0x22')]);router[_0xe36e('0x20')](_0xe36e('0x11'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x23')]);router[_0xe36e('0x20')](_0xe36e('0x16'),auth['isAuthenticated'](),controller[_0xe36e('0x24')]);module[_0xe36e('0x25')]=router; \ No newline at end of file +var _0xd117=['getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addAgents','/:id/send','send','put','update','destroy','delete','removeDispositions','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/applications','getApplications','getInteractions','/:id/users'];(function(_0x3b0e76,_0x239221){var _0x1e4af4=function(_0x4c1daa){while(--_0x4c1daa){_0x3b0e76['push'](_0x3b0e76['shift']());}};_0x1e4af4(++_0x239221);}(_0xd117,0x182));var _0x7d11=function(_0x37d0bc,_0x109b96){_0x37d0bc=_0x37d0bc-0x0;var _0x170e60=_0xd117[_0x37d0bc];return _0x170e60;};'use strict';var multer=require(_0x7d11('0x0'));var util=require(_0x7d11('0x1'));var path=require(_0x7d11('0x2'));var timeout=require(_0x7d11('0x3'));var express=require(_0x7d11('0x4'));var router=express[_0x7d11('0x5')]();var fs_extra=require(_0x7d11('0x6'));var auth=require(_0x7d11('0x7'));var interaction=require(_0x7d11('0x8'));var config=require(_0x7d11('0x9'));var controller=require(_0x7d11('0xa'));router[_0x7d11('0xb')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0xd')]);router[_0x7d11('0xb')](_0x7d11('0xe'),auth['isAuthenticated'](),controller[_0x7d11('0xf')]);router[_0x7d11('0xb')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x11')]);router[_0x7d11('0xb')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x13')]);router['get']('/:id/canned_answers',auth[_0x7d11('0xc')](),controller['getAnswers']);router['get'](_0x7d11('0x14'),auth['isAuthenticated'](),controller[_0x7d11('0x15')]);router[_0x7d11('0xb')]('/:id/interactions',auth[_0x7d11('0xc')](),controller[_0x7d11('0x16')]);router['get'](_0x7d11('0x17'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x18')]);router[_0x7d11('0x19')]('/',auth[_0x7d11('0xc')](),controller[_0x7d11('0x1a')]);router[_0x7d11('0x19')](_0x7d11('0x12'),auth['isAuthenticated'](),controller[_0x7d11('0x1b')]);router[_0x7d11('0x19')](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x1d')]);router['post'](_0x7d11('0x1e'),controller[_0x7d11('0x1f')]);router['post']('/:id/applications',auth[_0x7d11('0xc')](),controller['addApplications']);router[_0x7d11('0x19')]('/:id/users',auth[_0x7d11('0xc')](),controller[_0x7d11('0x20')]);router[_0x7d11('0x19')](_0x7d11('0x21'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x22')]);router[_0x7d11('0x23')](_0x7d11('0x10'),auth['isAuthenticated'](),controller[_0x7d11('0x24')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x7d11('0x25')]);router[_0x7d11('0x26')](_0x7d11('0x12'),auth[_0x7d11('0xc')](),controller[_0x7d11('0x27')]);router[_0x7d11('0x26')](_0x7d11('0x1c'),auth[_0x7d11('0xc')](),controller['removeAnswers']);router[_0x7d11('0x26')]('/:id/users',auth['isAuthenticated'](),controller['removeAgents']);module[_0x7d11('0x28')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index d580cb5..02b27e0 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 _0x50df=['STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring'];(function(_0x436d8b,_0x49215f){var _0x38e777=function(_0x4ddafc){while(--_0x4ddafc){_0x436d8b['push'](_0x436d8b['shift']());}};_0x38e777(++_0x49215f);}(_0x50df,0xca));var _0xf50d=function(_0x26cdd8,_0x3c3136){_0x26cdd8=_0x26cdd8-0x0;var _0x4687aa=_0x50df[_0x26cdd8];return _0x4687aa;};'use strict';var Sequelize=require(_0xf50d('0x0'));var rs=require(_0xf50d('0x1'));module['exports']={'name':{'type':Sequelize[_0xf50d('0x2')],'unique':_0xf50d('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xf50d('0x4')]();}},'replyUri':{'type':Sequelize[_0xf50d('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xf50d('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xf50d('0x5');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf50d('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xf50d('0x2')]},'queueTransfer':{'type':Sequelize[_0xf50d('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf50d('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf50d('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xf50d('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xf50d('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x12a140){if(!_0x12a140)this[_0xf50d('0x9')](_0xf50d('0xa'),null);this[_0xf50d('0x9')](_0xf50d('0xb'),_0x12a140);}}}; \ No newline at end of file +var _0x8792=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','name'];(function(_0x4e11d5,_0x1ce514){var _0x5e4e4c=function(_0xbee63d){while(--_0xbee63d){_0x4e11d5['push'](_0x4e11d5['shift']());}};_0x5e4e4c(++_0x1ce514);}(_0x8792,0xe0));var _0x2879=function(_0x522405,_0x4d2b79){_0x522405=_0x522405-0x0;var _0x2375a3=_0x8792[_0x522405];return _0x2375a3;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x2879('0x0'));module[_0x2879('0x1')]={'name':{'type':Sequelize[_0x2879('0x2')],'unique':_0x2879('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x2879('0x2')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2879('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2879('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2879('0x4')],'defaultValue':function(){return _0x2879('0x5');}},'notificationSound':{'type':Sequelize[_0x2879('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2879('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2879('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2879('0x2')]},'queueTransfer':{'type':Sequelize[_0x2879('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2879('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2879('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2879('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x2879('0x6')],'defaultValue':![],'comment':_0x2879('0x8'),'set':function(_0x481224){if(!_0x481224)this[_0x2879('0x9')](_0x2879('0xa'),null);this['setDataValue'](_0x2879('0xb'),_0x481224);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 504447c..ef14b84 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 _0xc359=['OpenchannelAccountId','getDispositions','findOne','Disposition','rawAttributes','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','notify','openchannel','CmContact','Sequelize','updatedAt','difference','createdAt','CompanyId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','OpenchannelApplication','Applications','account','list','orderBy','applications','asc','Contacts','threadId','externalUrl','OpenchannelInteraction','ContactId','contact','firstName','lastName','messageId','interaction','created','autoclose','close','*,*,*,*','OpenchannelMessage','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','sequelize','Transaction','READ_COMMITTED','findAndCountAll','priority','finally','send','getApplications','getInteractions','Contact','User','Owner','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','ListId','dataValues','Messages','push','rimraf','fast-json-patch','request-promise','moment','mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','apply','save','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','index','Pause','OpenchannelAccount','key','model','map','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','rows','show','params','mandatoryDispositionPause','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition'];(function(_0x2bdd83,_0x313bcd){var _0xe70e72=function(_0x512e1c){while(--_0x512e1c){_0x2bdd83['push'](_0x2bdd83['shift']());}};_0xe70e72(++_0x313bcd);}(_0xc359,0x1d9));var _0x9c35=function(_0x3f6426,_0x12cbf9){_0x3f6426=_0x3f6426-0x0;var _0x25d790=_0xc359[_0x3f6426];return _0x25d790;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9c35('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c35('0x1'));var rp=require(_0x9c35('0x2'));var moment=require(_0x9c35('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9c35('0x4'));var util=require('util');var path=require(_0x9c35('0x5'));var sox=require('sox');var csv=require(_0x9c35('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x9c35('0x7'));var jsforce=require(_0x9c35('0x8'));var deskjs=require(_0x9c35('0x9'));var toCsv=require(_0x9c35('0x6'));var querystring=require(_0x9c35('0xa'));var Papa=require(_0x9c35('0xb'));var Redis=require('ioredis');var authService=require(_0x9c35('0xc'));var qs=require(_0x9c35('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9c35('0xe'));var utils=require('../../config/utils');var config=require(_0x9c35('0xf'));var licenseUtil=require(_0x9c35('0x10'));var db=require(_0x9c35('0x11'))['db'];config['redis']=_[_0x9c35('0x12')](config[_0x9c35('0x13')],{'host':_0x9c35('0x14'),'port':0x18eb});var socket=require(_0x9c35('0x15'))(new Redis(config[_0x9c35('0x13')]));require('./openchannelAccount.socket')[_0x9c35('0x16')](socket);var jayson=require(_0x9c35('0x17'));var client=jayson[_0x9c35('0x18')][_0x9c35('0x19')]({'port':0x232c});var client9002=jayson[_0x9c35('0x18')][_0x9c35('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x9e7d2d,_0x77588e,_0x34b72d,_0x2b2c2b){return new BPromise(function(_0x387dd7,_0x2e8ec1){var _0x1ef1d8=_0x2b2c2b||client;return _0x1ef1d8[_0x9c35('0x1a')](_0x9e7d2d,_0x34b72d)[_0x9c35('0x1b')](function(_0x4cbeb6){logger[_0x9c35('0x1c')](_0x9c35('0x1d'),_0x77588e,_0x9c35('0x1e'));logger[_0x9c35('0x1f')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x77588e,_0x9c35('0x1e'),JSON[_0x9c35('0x20')](_0x4cbeb6));if(_0x4cbeb6[_0x9c35('0x21')]){if(_0x4cbeb6[_0x9c35('0x21')][_0x9c35('0x22')]===0x1f4){logger['error'](_0x9c35('0x1d'),_0x77588e,_0x4cbeb6['error'][_0x9c35('0x23')]);return _0x2e8ec1(_0x4cbeb6[_0x9c35('0x21')][_0x9c35('0x23')]);}logger[_0x9c35('0x21')](_0x9c35('0x1d'),_0x77588e,_0x4cbeb6[_0x9c35('0x21')][_0x9c35('0x23')]);return _0x387dd7(_0x4cbeb6['error']['message']);}else{logger[_0x9c35('0x1c')](_0x9c35('0x1d'),_0x77588e,_0x9c35('0x1e'));_0x387dd7(_0x4cbeb6[_0x9c35('0x24')]['message']);}})[_0x9c35('0x25')](function(_0x578e00){logger[_0x9c35('0x21')]('OpenchannelAccount,\x20%s,\x20%s',_0x77588e,_0x578e00);_0x2e8ec1(_0x578e00);});});}function respondWithStatusCode(_0x5d924a,_0x39cd10){_0x39cd10=_0x39cd10||0xcc;return function(_0xaf9e58){if(_0xaf9e58){return _0x5d924a[_0x9c35('0x26')](_0x39cd10);}return _0x5d924a['status'](_0x39cd10)[_0x9c35('0x27')]();};}function respondWithResult(_0x55cd82,_0x16cc31){_0x16cc31=_0x16cc31||0xc8;return function(_0x2a0954){if(_0x2a0954){return _0x55cd82[_0x9c35('0x28')](_0x16cc31)[_0x9c35('0x29')](_0x2a0954);}};}function respondWithFilteredResult(_0x4525c9,_0x4f272a){return function(_0x4593e3){if(_0x4593e3){var _0x16e8dd=typeof _0x4f272a['offset']===_0x9c35('0x2a')&&typeof _0x4f272a[_0x9c35('0x2b')]===_0x9c35('0x2a');var _0x45766e=_0x4593e3[_0x9c35('0x2c')];var _0x4cb625=_0x16e8dd?0x0:_0x4f272a[_0x9c35('0x2d')];var _0xd9c6b3=_0x16e8dd?_0x4593e3[_0x9c35('0x2c')]:_0x4f272a[_0x9c35('0x2d')]+_0x4f272a[_0x9c35('0x2b')];var _0x2b5341;if(_0xd9c6b3>=_0x45766e){_0xd9c6b3=_0x45766e;_0x2b5341=0xc8;}else{_0x2b5341=0xce;}_0x4525c9['status'](_0x2b5341);return _0x4525c9[_0x9c35('0x2e')]('Content-Range',_0x4cb625+'-'+_0xd9c6b3+'/'+_0x45766e)[_0x9c35('0x29')](_0x4593e3);}return null;};}function patchUpdates(_0x2e3cd8){return function(_0xb89c8c){try{jsonpatch[_0x9c35('0x2f')](_0xb89c8c,_0x2e3cd8,!![]);}catch(_0x462306){return BPromise['reject'](_0x462306);}return _0xb89c8c[_0x9c35('0x30')]();};}function saveUpdates(_0x182701,_0x4986a9){return function(_0x49cefb){if(_0x49cefb){return _0x49cefb[_0x9c35('0x31')](_0x182701)['then'](function(_0x560b74){return _0x560b74;});}return null;};}function removeEntity(_0x4d20f7,_0x42c748){return function(_0x2b5c69){if(_0x2b5c69){return _0x2b5c69[_0x9c35('0x32')]()[_0x9c35('0x1b')](function(){var _0x232e97=_0x2b5c69[_0x9c35('0x33')]({'plain':!![]});var _0x56b64b=_0x9c35('0x34');return db[_0x9c35('0x35')][_0x9c35('0x32')]({'where':{'type':_0x56b64b,'resourceId':_0x232e97['id']}})[_0x9c35('0x1b')](function(){return _0x2b5c69;});})['then'](function(){_0x4d20f7[_0x9c35('0x28')](0xcc)[_0x9c35('0x27')]();});}};}function handleEntityNotFound(_0x2aacb8,_0x7397f6){return function(_0x2867b8){if(!_0x2867b8){_0x2aacb8[_0x9c35('0x26')](0x194);}return _0x2867b8;};}function handleError(_0x316e10,_0x5628e7){_0x5628e7=_0x5628e7||0x1f4;return function(_0x535edd){logger['error'](_0x535edd[_0x9c35('0x36')]);if(_0x535edd['name']){delete _0x535edd[_0x9c35('0x37')];}_0x316e10['status'](_0x5628e7)['send'](_0x535edd);};}exports[_0x9c35('0x38')]=function(_0x431df0,_0x20f06e){var _0x282694={'include':[{'model':db[_0x9c35('0x39')],'as':'mandatoryDispositionPause'}]},_0x33ad72={},_0x17bace={'count':0x0,'rows':[]};var _0x289222=_['map'](db[_0x9c35('0x3a')]['rawAttributes'],function(_0x5a7bbe){return{'name':_0x5a7bbe['fieldName'],'type':_0x5a7bbe['type'][_0x9c35('0x3b')]};});_0x33ad72[_0x9c35('0x3c')]=_[_0x9c35('0x3d')](_0x289222,_0x9c35('0x37'));_0x33ad72['query']=_[_0x9c35('0x3e')](_0x431df0[_0x9c35('0x3f')]);_0x33ad72[_0x9c35('0x40')]=_['intersection'](_0x33ad72[_0x9c35('0x3c')],_0x33ad72[_0x9c35('0x3f')]);_0x282694[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x33ad72[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x282694[_0x9c35('0x41')]=_0x282694[_0x9c35('0x41')][_0x9c35('0x44')]?_0x282694['attributes']:_0x33ad72[_0x9c35('0x3c')];if(!_0x431df0[_0x9c35('0x3f')][_0x9c35('0x45')](_0x9c35('0x46'))){_0x282694[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x282694[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x2d')]);}_0x282694[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x431df0[_0x9c35('0x3f')][_0x9c35('0x48')]);_0x282694[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x431df0[_0x9c35('0x3f')],_0x33ad72[_0x9c35('0x40')]),_0x289222);if(_0x431df0[_0x9c35('0x3f')]['filter']){_0x282694[_0x9c35('0x49')]=_['merge'](_0x282694[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x289222,function(_0x25c72b){if(_0x25c72b['type']!==_0x9c35('0x4b')){var _0x1d24ae={};_0x1d24ae[_0x25c72b[_0x9c35('0x37')]]={'$like':'%'+_0x431df0['query'][_0x9c35('0x4c')]+'%'};return _0x1d24ae;}})});}_0x282694=_[_0x9c35('0x4d')]({},_0x282694,_0x431df0['options']);var _0x1972dc={'where':_0x282694['where']};return db[_0x9c35('0x3a')][_0x9c35('0x2c')](_0x1972dc)[_0x9c35('0x1b')](function(_0x471e4d){_0x17bace[_0x9c35('0x2c')]=_0x471e4d;if(_0x431df0[_0x9c35('0x3f')][_0x9c35('0x4e')]){_0x282694[_0x9c35('0x4f')]=[{'all':!![]}];}return db[_0x9c35('0x3a')]['findAll'](_0x282694);})[_0x9c35('0x1b')](function(_0x257d9c){_0x17bace[_0x9c35('0x50')]=_0x257d9c;return _0x17bace;})['then'](respondWithFilteredResult(_0x20f06e,_0x282694))['catch'](handleError(_0x20f06e,null));};exports[_0x9c35('0x51')]=function(_0x18727f,_0x51a9f0){var _0x153080={'raw':![],'where':{'id':_0x18727f[_0x9c35('0x52')]['id']},'include':[{'model':db[_0x9c35('0x39')],'as':_0x9c35('0x53')}]},_0x2bd32c={};_0x2bd32c[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x3a')]['rawAttributes']);_0x2bd32c[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x18727f[_0x9c35('0x3f')]);_0x2bd32c['filters']=_[_0x9c35('0x42')](_0x2bd32c[_0x9c35('0x3c')],_0x2bd32c[_0x9c35('0x3f')]);_0x153080[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x2bd32c[_0x9c35('0x3c')],qs['fields'](_0x18727f['query'][_0x9c35('0x43')]));_0x153080[_0x9c35('0x41')]=_0x153080[_0x9c35('0x41')]['length']?_0x153080[_0x9c35('0x41')]:_0x2bd32c[_0x9c35('0x3c')];if(_0x18727f[_0x9c35('0x3f')][_0x9c35('0x4e')]){_0x153080[_0x9c35('0x4f')]=[{'all':!![]}];}_0x153080=_[_0x9c35('0x4d')]({},_0x153080,_0x18727f[_0x9c35('0x54')]);return db['OpenchannelAccount']['find'](_0x153080)[_0x9c35('0x1b')](handleEntityNotFound(_0x51a9f0,null))[_0x9c35('0x1b')](respondWithResult(_0x51a9f0,null))['catch'](handleError(_0x51a9f0,null));};exports[_0x9c35('0x55')]=function(_0x45a840,_0x7e4488){return db[_0x9c35('0x3a')][_0x9c35('0x55')](_0x45a840[_0x9c35('0x56')],{})[_0x9c35('0x1b')](function(_0x2a882e){var _0x1458f1=_0x45a840[_0x9c35('0x57')][_0x9c35('0x33')]({'plain':!![]});if(!_0x1458f1)throw new Error(_0x9c35('0x58'));if(_0x1458f1[_0x9c35('0x59')]===_0x9c35('0x57')){var _0x1effb=_0x2a882e[_0x9c35('0x33')]({'plain':!![]});var _0x29fec1=_0x9c35('0x34');return db[_0x9c35('0x5a')][_0x9c35('0x5b')]({'where':{'name':_0x29fec1,'userProfileId':_0x1458f1[_0x9c35('0x5c')]},'raw':!![]})[_0x9c35('0x1b')](function(_0x2092d4){if(_0x2092d4&&_0x2092d4[_0x9c35('0x5d')]===0x0){return db[_0x9c35('0x35')][_0x9c35('0x55')]({'name':_0x1effb[_0x9c35('0x37')],'resourceId':_0x1effb['id'],'type':_0x2092d4['name'],'sectionId':_0x2092d4['id']},{})[_0x9c35('0x1b')](function(){return _0x2a882e;});}else{return _0x2a882e;}})[_0x9c35('0x25')](function(_0x1bf387){logger['error'](_0x9c35('0x5e'),_0x1bf387);throw _0x1bf387;});}return _0x2a882e;})['then'](respondWithResult(_0x7e4488,0xc9))[_0x9c35('0x25')](handleError(_0x7e4488,null));};exports[_0x9c35('0x31')]=function(_0x3e4b5f,_0x46d60d){if(_0x3e4b5f[_0x9c35('0x56')]['id']){delete _0x3e4b5f[_0x9c35('0x56')]['id'];}return db['OpenchannelAccount'][_0x9c35('0x5b')]({'where':{'id':_0x3e4b5f[_0x9c35('0x52')]['id']},'include':[{'model':db[_0x9c35('0x39')],'as':_0x9c35('0x53')}]})['then'](handleEntityNotFound(_0x46d60d,null))[_0x9c35('0x1b')](saveUpdates(_0x3e4b5f[_0x9c35('0x56')],null))['then'](respondWithResult(_0x46d60d,null))['catch'](handleError(_0x46d60d,null));};exports[_0x9c35('0x32')]=function(_0x2e8dbe,_0x42ffc7){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x2e8dbe[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x42ffc7,null))[_0x9c35('0x1b')](removeEntity(_0x42ffc7,null))['catch'](handleError(_0x42ffc7,null));};exports[_0x9c35('0x5f')]=function(_0x4c4fad,_0xc815e){return db[_0x9c35('0x3a')][_0x9c35('0x5f')]()['then'](respondWithResult(_0xc815e,null))[_0x9c35('0x25')](handleError(_0xc815e,null));};exports[_0x9c35('0x60')]=function(_0x54566e,_0x29526d,_0x15e244){if(_0x54566e[_0x9c35('0x56')]['id']){delete _0x54566e['body']['id'];}return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x54566e[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x29526d,null))[_0x9c35('0x1b')](function(_0x313fb6){if(_0x313fb6){_0x54566e[_0x9c35('0x56')][_0x9c35('0x61')]=_0x313fb6['id'];return db['Disposition'][_0x9c35('0x55')](_0x54566e[_0x9c35('0x56')]);}})[_0x9c35('0x1b')](respondWithResult(_0x29526d,null))[_0x9c35('0x25')](handleError(_0x29526d,null));};exports[_0x9c35('0x62')]=function(_0x19c7ca,_0x321631,_0x3901fb){var _0x2a2ff3={'raw':![],'where':{}};var _0x584da1={};var _0x2b0397={'count':0x0,'rows':[]};return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x19c7ca[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x321631,null))['then'](function(_0x1d5397){if(_0x1d5397){_0x584da1[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x64')][_0x9c35('0x65')]);_0x584da1[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x19c7ca[_0x9c35('0x3f')]);_0x584da1['filters']=_[_0x9c35('0x42')](_0x584da1['model'],_0x584da1[_0x9c35('0x3f')]);_0x2a2ff3[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x584da1[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x2a2ff3['attributes']=_0x2a2ff3[_0x9c35('0x41')][_0x9c35('0x44')]?_0x2a2ff3[_0x9c35('0x41')]:_0x584da1[_0x9c35('0x3c')];if(!_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x45')](_0x9c35('0x46'))){_0x2a2ff3['limit']=qs['limit'](_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x2a2ff3[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x2d')]);}_0x2a2ff3[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x19c7ca['query'][_0x9c35('0x48')]);_0x2a2ff3[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x19c7ca[_0x9c35('0x3f')],_0x584da1['filters']));_0x2a2ff3['where'][_0x9c35('0x61')]=_0x1d5397['id'];if(_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x2a2ff3[_0x9c35('0x49')]=_[_0x9c35('0x4d')](_0x2a2ff3[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x2a2ff3['attributes'],function(_0x1c5201){var _0x306eab={};_0x306eab[_0x1c5201]={'$like':'%'+_0x19c7ca[_0x9c35('0x3f')][_0x9c35('0x4c')]+'%'};return _0x306eab;})});}_0x2a2ff3=_[_0x9c35('0x4d')]({},_0x2a2ff3,_0x19c7ca[_0x9c35('0x54')]);return db[_0x9c35('0x64')]['count']({'where':_0x2a2ff3['where']})[_0x9c35('0x1b')](function(_0x1499db){_0x2b0397[_0x9c35('0x2c')]=_0x1499db;if(_0x19c7ca[_0x9c35('0x3f')]['includeAll']){_0x2a2ff3[_0x9c35('0x4f')]=[{'all':!![]}];}return db[_0x9c35('0x64')][_0x9c35('0x66')](_0x2a2ff3);})[_0x9c35('0x1b')](function(_0x5dac6c){_0x2b0397[_0x9c35('0x50')]=_0x5dac6c;return _0x2b0397;});}})['then'](respondWithFilteredResult(_0x321631,_0x2a2ff3))[_0x9c35('0x25')](handleError(_0x321631,null));};exports[_0x9c35('0x67')]=function(_0x5da53d,_0x220ef6,_0x1acd45){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x5da53d[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x220ef6,null))[_0x9c35('0x1b')](function(_0x1310fe){if(_0x1310fe){return _0x1310fe[_0x9c35('0x67')](_0x5da53d[_0x9c35('0x3f')][_0x9c35('0x68')]);}})[_0x9c35('0x1b')](respondWithStatusCode(_0x220ef6,null))[_0x9c35('0x25')](handleError(_0x220ef6,null));};exports[_0x9c35('0x69')]=function(_0x23f0e3,_0xc8dabc,_0x3d4fe6){if(_0x23f0e3[_0x9c35('0x56')]['id']){delete _0x23f0e3[_0x9c35('0x56')]['id'];}return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x23f0e3['params']['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0xc8dabc,null))[_0x9c35('0x1b')](function(_0x4e86dd){if(_0x4e86dd){_0x23f0e3[_0x9c35('0x56')][_0x9c35('0x61')]=_0x4e86dd['id'];return db[_0x9c35('0x6a')][_0x9c35('0x55')](_0x23f0e3[_0x9c35('0x56')]);}})['then'](respondWithResult(_0xc8dabc,null))[_0x9c35('0x25')](handleError(_0xc8dabc,null));};exports[_0x9c35('0x6b')]=function(_0x5e622a,_0x4af8c7,_0x4c1f79){var _0x89b86c={'raw':![],'where':{}};var _0x2bdfd0={};var _0x49e20b={'count':0x0,'rows':[]};return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x5e622a[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x4af8c7,null))[_0x9c35('0x1b')](function(_0x268b54){if(_0x268b54){_0x2bdfd0[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x6a')][_0x9c35('0x65')]);_0x2bdfd0[_0x9c35('0x3f')]=_['keys'](_0x5e622a[_0x9c35('0x3f')]);_0x2bdfd0[_0x9c35('0x40')]=_[_0x9c35('0x42')](_0x2bdfd0[_0x9c35('0x3c')],_0x2bdfd0[_0x9c35('0x3f')]);_0x89b86c['attributes']=_[_0x9c35('0x42')](_0x2bdfd0['model'],qs[_0x9c35('0x43')](_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x89b86c[_0x9c35('0x41')]=_0x89b86c['attributes']['length']?_0x89b86c[_0x9c35('0x41')]:_0x2bdfd0[_0x9c35('0x3c')];if(!_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x45')]('nolimit')){_0x89b86c[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x5e622a[_0x9c35('0x3f')]['limit']);_0x89b86c[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x2d')]);}_0x89b86c[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x5e622a[_0x9c35('0x3f')]['sort']);_0x89b86c[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x5e622a[_0x9c35('0x3f')],_0x2bdfd0[_0x9c35('0x40')]));_0x89b86c[_0x9c35('0x49')][_0x9c35('0x61')]=_0x268b54['id'];if(_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x89b86c['where']=_[_0x9c35('0x4d')](_0x89b86c[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x89b86c[_0x9c35('0x41')],function(_0x2203c1){var _0x2513d0={};_0x2513d0[_0x2203c1]={'$like':'%'+_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x4c')]+'%'};return _0x2513d0;})});}_0x89b86c=_[_0x9c35('0x4d')]({},_0x89b86c,_0x5e622a[_0x9c35('0x54')]);return db[_0x9c35('0x6a')][_0x9c35('0x2c')]({'where':_0x89b86c[_0x9c35('0x49')]})[_0x9c35('0x1b')](function(_0x35a905){_0x49e20b[_0x9c35('0x2c')]=_0x35a905;if(_0x5e622a[_0x9c35('0x3f')][_0x9c35('0x4e')]){_0x89b86c[_0x9c35('0x4f')]=[{'all':!![]}];}return db[_0x9c35('0x6a')][_0x9c35('0x66')](_0x89b86c);})[_0x9c35('0x1b')](function(_0x417c27){_0x49e20b[_0x9c35('0x50')]=_0x417c27;return _0x49e20b;});}})[_0x9c35('0x1b')](respondWithFilteredResult(_0x4af8c7,_0x89b86c))[_0x9c35('0x25')](handleError(_0x4af8c7,null));};exports['removeAnswers']=function(_0x6e456a,_0x3de11c,_0x39630e){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x6e456a['params']['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x3de11c,null))[_0x9c35('0x1b')](function(_0x503e51){if(_0x503e51){return _0x503e51['removeAnswers'](_0x6e456a[_0x9c35('0x3f')][_0x9c35('0x68')]);}})['then'](respondWithStatusCode(_0x3de11c,null))[_0x9c35('0x25')](handleError(_0x3de11c,null));};exports[_0x9c35('0x6c')]=function(_0x47d131,_0x3b5696,_0x22e0f6){var _0x4838d9={'body':_0x47d131[_0x9c35('0x56')],'channel':_0x9c35('0x6d')};var _0x4b742d=[];var _0x200bfa=[];var _0x213f08={};var _0x3d17bc=![];return db[_0x9c35('0x6e')][_0x9c35('0x5f')]()['then'](function(_0x4aece8){if(!_0x4aece8){throw new db[(_0x9c35('0x6f'))]['ValidationError']('no\x20available\x20attributes');}_0x4b742d=_['difference'](_['keys'](_0x4aece8),['createdAt',_0x9c35('0x70')]);_0x200bfa=_[_0x9c35('0x71')](_[_0x9c35('0x3e')](_0x4aece8),[_0x9c35('0x72'),_0x9c35('0x70'),_0x9c35('0x73'),'ListId']);if(_0x47d131[_0x9c35('0x56')]['id']){delete _0x47d131[_0x9c35('0x56')]['id'];}if(_[_0x9c35('0x74')](_0x47d131[_0x9c35('0x56')][_0x9c35('0x75')])){throw new db[(_0x9c35('0x6f'))]['ValidationError'](_0x9c35('0x76'));}if(_[_0x9c35('0x74')](_0x47d131[_0x9c35('0x56')][_0x9c35('0x56')])||_0x47d131[_0x9c35('0x56')][_0x9c35('0x56')]===''){throw new db[(_0x9c35('0x6f'))][(_0x9c35('0x77'))](_0x9c35('0x78'));}if(_[_0x9c35('0x74')](_0x47d131[_0x9c35('0x56')][_0x9c35('0x79')])){throw new db['Sequelize'][(_0x9c35('0x77'))](_0x9c35('0x7a')+_0x200bfa);}if(!_[_0x9c35('0x7b')](_0x200bfa,_0x47d131['body'][_0x9c35('0x79')])){throw new db[(_0x9c35('0x6f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x200bfa);}_0x213f08[_0x47d131[_0x9c35('0x56')][_0x9c35('0x79')]]=_0x47d131['body'][_0x9c35('0x75')];})[_0x9c35('0x1b')](function(){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x47d131[_0x9c35('0x52')]['id']},'include':[{'model':db['CmList'],'as':_0x9c35('0x7c'),'include':[{'model':db[_0x9c35('0x6e')],'as':'Contacts','where':_0x213f08,'limit':0x1,'order':[[_0x9c35('0x70'),'DESC']]}]},{'model':db[_0x9c35('0x7d')],'as':_0x9c35('0x7e')}]});})[_0x9c35('0x1b')](handleEntityNotFound(_0x3b5696,null))[_0x9c35('0x1b')](function(_0x224f38){if(_0x224f38&&_0x224f38[_0x9c35('0x7c')]){_0x4838d9[_0x9c35('0x7f')]=_0x224f38;_0x4838d9['applications']=_0x224f38[_0x9c35('0x7e')];_0x4838d9[_0x9c35('0x80')]=_0x224f38['List'];_0x4838d9['applications']=_[_0x9c35('0x81')](_0x4838d9[_0x9c35('0x82')],['priority'],[_0x9c35('0x83')]);if(_0x4838d9[_0x9c35('0x7f')][_0x9c35('0x7e')]){delete _0x4838d9[_0x9c35('0x7f')][_0x9c35('0x7e')];}if(_0x4838d9[_0x9c35('0x7f')][_0x9c35('0x7c')]&&_0x4838d9[_0x9c35('0x7f')]['List'][_0x9c35('0x84')]['length']){return _0x4838d9['account'][_0x9c35('0x7c')][_0x9c35('0x84')][0x0];}var _0x3861ab=_['defaults'](_0x47d131['body'],{'firstName':_0x47d131[_0x9c35('0x56')]['from'],'ListId':_0x224f38['ListId']});_0x3861ab[_0x47d131[_0x9c35('0x56')][_0x9c35('0x79')]]=_0x47d131[_0x9c35('0x56')][_0x9c35('0x75')];return db[_0x9c35('0x6e')]['create'](_0x3861ab,{'fields':_0x4b742d,'raw':!![]});}})[_0x9c35('0x1b')](handleEntityNotFound(_0x3b5696,null))[_0x9c35('0x1b')](function(_0x2e6afb){_0x4838d9['contact']=_0x2e6afb;if(_0x2e6afb){var _0x3ec29f={'ContactId':_0x2e6afb['id'],'OpenchannelAccountId':_0x47d131[_0x9c35('0x52')]['id'],'from':(_0x2e6afb['firstName']||'')+'\x20'+(_0x2e6afb['lastName']||'')};var _0x485967={'OpenchannelAccountId':_0x47d131[_0x9c35('0x52')]['id'],'closed':![]};if(_0x47d131[_0x9c35('0x56')][_0x9c35('0x85')]){_0x485967['threadId']=_0x47d131[_0x9c35('0x56')][_0x9c35('0x85')];return db['OpenchannelInteraction'][_0x9c35('0x5b')]({'where':_0x485967})[_0x9c35('0x1b')](function(_0xbea90f){if(_0xbea90f){return[_0xbea90f,![]];}_0x3ec29f['threadId']=_0x47d131[_0x9c35('0x56')][_0x9c35('0x85')];_0x3ec29f['externalUrl']=_0x47d131[_0x9c35('0x56')][_0x9c35('0x86')];return db[_0x9c35('0x87')][_0x9c35('0x55')](_0x3ec29f)[_0x9c35('0x1b')](function(_0x598b39){return[_0x598b39,!![]];});});}else{_0x485967[_0x9c35('0x85')]=null;}_0x485967[_0x9c35('0x88')]=_0x2e6afb['id'];return db[_0x9c35('0x87')][_0x9c35('0x5b')]({'where':_0x485967})[_0x9c35('0x1b')](function(_0x57252c){if(_0x57252c){return[_0x57252c,![]];}return db['OpenchannelInteraction'][_0x9c35('0x55')](_0x3ec29f)[_0x9c35('0x1b')](function(_0x3562ed){return[_0x3562ed,!![]];});});}})['spread'](function(_0x1b6d9e,_0xc097f2){if(_0x1b6d9e){_0x3d17bc=_0xc097f2;if(!_0xc097f2){var _0x245860={'from':(_0x4838d9[_0x9c35('0x89')][_0x9c35('0x8a')]||'')+'\x20'+(_0x4838d9[_0x9c35('0x89')][_0x9c35('0x8b')]||'')};if(_0x47d131['body'][_0x9c35('0x85')]&&_0x47d131['body'][_0x9c35('0x8c')]&&_0x47d131['body']['threadId']!=_0x47d131[_0x9c35('0x56')][_0x9c35('0x8c')]){_0x245860[_0x9c35('0x85')]=_0x47d131[_0x9c35('0x56')][_0x9c35('0x8c')];}return _0x1b6d9e[_0x9c35('0x31')](_0x245860);}else{return _0x1b6d9e;}}})[_0x9c35('0x1b')](function(_0x42ee39){_0x4838d9['interaction']=_0x42ee39['get']({'plain':!![]});_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x8e')]=_0x3d17bc;if(_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x8e')]){if(_0x4838d9['account'][_0x9c35('0x8f')]){_0x4838d9['applications']['push']({'id':0x0,'priority':_0x4838d9['applications'][_0x9c35('0x44')]+0x1,'app':_0x9c35('0x90'),'appdata':'unmanaged','interval':_0x9c35('0x91')});}}return db[_0x9c35('0x92')][_0x9c35('0x55')]({'body':_0x47d131[_0x9c35('0x56')]['body'],'OpenchannelAccountId':_0x47d131[_0x9c35('0x52')]['id'],'OpenchannelInteractionId':_0x42ee39['id'],'direction':'in','ContactId':_0x4838d9[_0x9c35('0x89')]['id'],'AttachmentId':_0x47d131[_0x9c35('0x56')]['AttachmentId']});})[_0x9c35('0x1b')](function(_0x59331f){_0x4838d9[_0x9c35('0x23')]=_0x59331f;if(!_0x4838d9[_0x9c35('0x8d')]['UserId'])return;return db['User'][_0x9c35('0x5b')]({'attributes':['id',_0x9c35('0x37')],'where':{'id':_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x93')]}});})['then'](function(_0x1e7a3e){if(_0x1e7a3e){_0x4838d9[_0x9c35('0x82')][_0x9c35('0x94')]({'id':0x0,'priority':0x0,'app':_0x9c35('0x95'),'appdata':_0x1e7a3e[_0x9c35('0x37')]+','+(_0x4838d9['account'][_0x9c35('0x96')]||0xa),'interval':_0x9c35('0x91')});}if(!_0x4838d9[_0x9c35('0x8d')][_0x9c35('0x97')])return;return db[_0x9c35('0x98')][_0x9c35('0x5b')]({'attributes':['id',_0x9c35('0x37')],'where':{'id':_0x4838d9['interaction'][_0x9c35('0x97')]}});})[_0x9c35('0x1b')](function(_0x4ac0d9){if(_0x4ac0d9){_0x4838d9['applications'][_0x9c35('0x94')]({'id':0x0,'priority':0x1,'app':_0x9c35('0x99'),'appdata':_0x4ac0d9['name']+','+(_0x4838d9['account'][_0x9c35('0x9a')]||0x12c),'interval':_0x9c35('0x91')});}return respondWithRpcPromise(_0x9c35('0x9b'),_0x9c35('0x9c'),_0x4838d9);})['then'](function(_0x12b18d){respondWithRpcPromise('EventManager',_0x9c35('0x9d'),{'event':'notify','message':_0x12b18d},client9002);return _0x12b18d;})['then'](respondWithResult(_0x3b5696,null))[_0x9c35('0x25')](handleError(_0x3b5696,null));};exports['addApplications']=function(_0x20a997,_0x3d0645){var _0x2d7f70=_0x20a997[_0x9c35('0x52')]['id'];var _0x2f3ddd=_0x20a997['body'];var _0x1b910c=0xc8;var _0x108214=null;return db[_0x9c35('0x9e')]['transaction']({'isolationLevel':db['sequelize'][_0x9c35('0x9f')]['ISOLATION_LEVELS'][_0x9c35('0xa0')]},function(_0x475152){return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x2d7f70},'transaction':_0x475152})['then'](function(_0x29385f){if(_0x29385f){return db[_0x9c35('0x7d')][_0x9c35('0x32')]({'where':{'OpenchannelAccountId':_0x2d7f70},'transaction':_0x475152})[_0x9c35('0x1b')](function(){var _0x4a7bd7=_[_0x9c35('0x3d')](_0x2f3ddd,function(_0x3675f1){_0x3675f1[_0x9c35('0x61')]=_0x2d7f70;return _0x3675f1;});return db[_0x9c35('0x7d')]['bulkCreate'](_0x4a7bd7,{'transaction':_0x475152});});}else{_0x1b910c=0x194;_0x108214=[];}});})[_0x9c35('0x1b')](function(){if(_0x1b910c!==0x194){return db['OpenchannelApplication'][_0x9c35('0xa1')]({'where':{'OpenchannelAccountId':_0x2d7f70},'order':_0x9c35('0xa2')})[_0x9c35('0x1b')](function(_0x573688){_0x108214=_0x573688;});}})['catch'](function(_0x2f3805){_0x1b910c=0x1f4;logger['error'](_0x2f3805['stack']);if(_0x2f3805[_0x9c35('0x37')]){delete _0x2f3805['name'];}_0x108214=_0x2f3805;})[_0x9c35('0xa3')](function(){if(_0x108214===null){_0x3d0645['sendStatus'](_0x1b910c);}else{if(_0x1b910c===0x1f4){_0x3d0645['status'](_0x1b910c)[_0x9c35('0xa4')](_0x108214);}else{_0x3d0645['status'](_0x1b910c)['json'](_0x108214);}}});};exports[_0x9c35('0xa5')]=function(_0x51ecee,_0x59d9fa,_0x4c0c0f){var _0x31c5c1={};var _0x547bc1={};var _0x11eecb;var _0x299557;return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x51ecee[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x59d9fa,null))[_0x9c35('0x1b')](function(_0x4b8aa6){if(_0x4b8aa6){_0x11eecb=_0x4b8aa6;_0x547bc1[_0x9c35('0x3c')]=_['keys'](db[_0x9c35('0x7d')][_0x9c35('0x65')]);_0x547bc1[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x51ecee[_0x9c35('0x3f')]);_0x547bc1[_0x9c35('0x40')]=_['intersection'](_0x547bc1[_0x9c35('0x3c')],_0x547bc1[_0x9c35('0x3f')]);_0x31c5c1[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x547bc1[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x31c5c1['attributes']=_0x31c5c1[_0x9c35('0x41')][_0x9c35('0x44')]?_0x31c5c1[_0x9c35('0x41')]:_0x547bc1['model'];_0x31c5c1[_0x9c35('0x47')]=qs['sort'](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x48')]);_0x31c5c1[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_['pick'](_0x51ecee[_0x9c35('0x3f')],_0x547bc1['filters']));if(_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x31c5c1[_0x9c35('0x49')]=_[_0x9c35('0x4d')](_0x31c5c1[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x31c5c1[_0x9c35('0x41')],function(_0x45aa89){var _0x559a1={};_0x559a1[_0x45aa89]={'$like':'%'+_0x51ecee[_0x9c35('0x3f')]['filter']+'%'};return _0x559a1;})});}_0x31c5c1=_[_0x9c35('0x4d')]({},_0x31c5c1,_0x51ecee[_0x9c35('0x54')]);return _0x11eecb[_0x9c35('0xa5')](_0x31c5c1);}})[_0x9c35('0x1b')](function(_0x1ff233){if(_0x1ff233){_0x299557=_0x1ff233['length'];if(!_0x51ecee['query'][_0x9c35('0x45')](_0x9c35('0x46'))){_0x31c5c1['limit']=qs[_0x9c35('0x2b')](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x31c5c1['offset']=qs[_0x9c35('0x2d')](_0x51ecee[_0x9c35('0x3f')][_0x9c35('0x2d')]);}return _0x11eecb[_0x9c35('0xa5')](_0x31c5c1);}})[_0x9c35('0x1b')](function(_0x1eee44){if(_0x1eee44){return _0x1eee44?{'count':_0x299557,'rows':_0x1eee44}:null;}})[_0x9c35('0x1b')](respondWithResult(_0x59d9fa,null))['catch'](handleError(_0x59d9fa,null));};exports[_0x9c35('0xa6')]=function(_0x52e2ed,_0x218bdf,_0x368050){var _0x3538e4={'raw':![],'where':{}};var _0x1c14ff={};var _0x8ede7b={'count':0x0,'rows':[]};return db[_0x9c35('0x3a')]['findOne']({'where':{'id':_0x52e2ed[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x218bdf,null))['then'](function(_0x4bb572){if(_0x4bb572){_0x1c14ff[_0x9c35('0x3c')]=_[_0x9c35('0x3e')](db[_0x9c35('0x87')]['rawAttributes']);_0x1c14ff['query']=_[_0x9c35('0x3e')](_0x52e2ed[_0x9c35('0x3f')]);_0x1c14ff[_0x9c35('0x40')]=_[_0x9c35('0x42')](_0x1c14ff['model'],_0x1c14ff[_0x9c35('0x3f')]);_0x3538e4['attributes']=_[_0x9c35('0x42')](_0x1c14ff[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x3538e4['attributes']=_0x3538e4[_0x9c35('0x41')][_0x9c35('0x44')]?_0x3538e4['attributes']:_0x1c14ff['model'];if(!_0x52e2ed['query'][_0x9c35('0x45')]('nolimit')){_0x3538e4[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x3538e4[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x52e2ed['query']['offset']);}_0x3538e4[_0x9c35('0x47')]=qs['sort'](_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0x48')]);_0x3538e4[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_[_0x9c35('0x4a')](_0x52e2ed[_0x9c35('0x3f')],_0x1c14ff[_0x9c35('0x40')]));_0x3538e4['where'][_0x9c35('0x61')]=_0x4bb572['id'];if(_0x52e2ed[_0x9c35('0x3f')]['filter']){_0x3538e4[_0x9c35('0x49')]=_['merge'](_0x3538e4['where'],{'$or':_[_0x9c35('0x3d')](_0x3538e4['attributes'],function(_0x3eaef6){var _0x402746={};_0x402746[_0x3eaef6]={'$like':'%'+_0x52e2ed['query'][_0x9c35('0x4c')]+'%'};return _0x402746;})});}_0x3538e4=_[_0x9c35('0x4d')]({},_0x3538e4,_0x52e2ed['options']);return db[_0x9c35('0x87')]['count']({'where':_0x3538e4[_0x9c35('0x49')]})[_0x9c35('0x1b')](function(_0x213bb6){_0x8ede7b[_0x9c35('0x2c')]=_0x213bb6;if(_0x52e2ed[_0x9c35('0x3f')]['includeAll']){_0x3538e4['include']=[{'model':db[_0x9c35('0x6e')],'as':_0x9c35('0xa7'),'required':![]},{'model':db[_0x9c35('0xa8')],'as':_0x9c35('0xa9'),'attributes':[_0x9c35('0x37'),'fullname',_0x9c35('0xaa')],'required':![]},{'model':db[_0x9c35('0xab')],'as':_0x9c35('0xac'),'attributes':['id',_0x9c35('0x37'),_0x9c35('0xad')],'where':_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0xae')]?{'id':_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0xae')]}:undefined,'required':_0x52e2ed[_0x9c35('0x3f')][_0x9c35('0xae')]?!![]:![]}];}return db[_0x9c35('0x87')]['findAll'](_0x3538e4);})[_0x9c35('0x1b')](function(_0x500b8a){_0x8ede7b['rows']=_0x500b8a;return _0x8ede7b;});}})[_0x9c35('0x1b')](respondWithFilteredResult(_0x218bdf,_0x3538e4))[_0x9c35('0x25')](handleError(_0x218bdf,null));};exports[_0x9c35('0xaf')]=function(_0x1e2820,_0x23b6fc,_0x503503){return db[_0x9c35('0x3a')]['find']({'where':{'id':_0x1e2820[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x23b6fc,null))[_0x9c35('0x1b')](function(_0x5e6fbb){if(_0x5e6fbb){return _0x5e6fbb[_0x9c35('0xaf')](_0x1e2820['body'][_0x9c35('0x68')],_[_0x9c35('0xb0')](_0x1e2820[_0x9c35('0x56')],['ids','id'])||{})[_0x9c35('0xb1')](function(_0x38e6b5){for(var _0x1df432=0x0;_0x1df432<_0x1e2820[_0x9c35('0x56')]['ids'][_0x9c35('0x44')];_0x1df432+=0x1){socket[_0x9c35('0xb2')](_0x9c35('0xb3'),{'UserId':Number(_0x1e2820[_0x9c35('0x56')][_0x9c35('0x68')][_0x1df432]),'OpenchannelAccountId':Number(_0x1e2820[_0x9c35('0x52')]['id'])});}return _0x38e6b5;});}})['then'](respondWithResult(_0x23b6fc,null))['catch'](handleError(_0x23b6fc,null));};exports[_0x9c35('0xb4')]=function(_0x295295,_0x4c8127,_0x1a0381){return db[_0x9c35('0x3a')]['find']({'where':{'id':_0x295295[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x4c8127,null))['then'](function(_0xd76890){if(_0xd76890){return _0xd76890['removeAgents'](_0x295295[_0x9c35('0x3f')]['ids'])[_0x9c35('0x1b')](function(){if(_[_0x9c35('0xb5')](_0x295295[_0x9c35('0x3f')][_0x9c35('0x68')])){for(var _0x133fdc=0x0;_0x133fdc<_0x295295[_0x9c35('0x3f')][_0x9c35('0x68')][_0x9c35('0x44')];_0x133fdc+=0x1){socket['emit'](_0x9c35('0xb6'),{'UserId':Number(_0x295295[_0x9c35('0x3f')]['ids'][_0x133fdc]),'OpenchannelAccountId':Number(_0x295295[_0x9c35('0x52')]['id'])});}}else{socket[_0x9c35('0xb2')](_0x9c35('0xb6'),{'UserId':Number(_0x295295[_0x9c35('0x3f')][_0x9c35('0x68')]),'OpenchannelAccountId':Number(_0x295295[_0x9c35('0x52')]['id'])});}});}})['then'](respondWithStatusCode(_0x4c8127,null))[_0x9c35('0x25')](handleError(_0x4c8127,null));};exports[_0x9c35('0xb7')]=function(_0x37bf9b,_0x4b6a39,_0x5ac86d){var _0x5885c0={};var _0x5bf3d4={};var _0x225c8b;var _0x452cc4;return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x37bf9b[_0x9c35('0x52')]['id']}})[_0x9c35('0x1b')](handleEntityNotFound(_0x4b6a39,null))[_0x9c35('0x1b')](function(_0x3b07dd){if(_0x3b07dd){_0x225c8b=_0x3b07dd;_0x5bf3d4[_0x9c35('0x3c')]=_[_0x9c35('0x3e')](db['User'][_0x9c35('0x65')]);_0x5bf3d4[_0x9c35('0x3f')]=_[_0x9c35('0x3e')](_0x37bf9b[_0x9c35('0x3f')]);_0x5bf3d4['filters']=_['intersection'](_0x5bf3d4[_0x9c35('0x3c')],_0x5bf3d4[_0x9c35('0x3f')]);_0x5885c0[_0x9c35('0x41')]=_[_0x9c35('0x42')](_0x5bf3d4[_0x9c35('0x3c')],qs[_0x9c35('0x43')](_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x43')]));_0x5885c0['attributes']=_0x5885c0[_0x9c35('0x41')]['length']?_0x5885c0['attributes']:_0x5bf3d4[_0x9c35('0x3c')];_0x5885c0[_0x9c35('0x47')]=qs[_0x9c35('0x48')](_0x37bf9b[_0x9c35('0x3f')]['sort']);_0x5885c0[_0x9c35('0x49')]=qs[_0x9c35('0x40')](_['pick'](_0x37bf9b[_0x9c35('0x3f')],_0x5bf3d4['filters']));if(_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x4c')]){_0x5885c0['where']=_[_0x9c35('0x4d')](_0x5885c0[_0x9c35('0x49')],{'$or':_[_0x9c35('0x3d')](_0x5885c0['attributes'],function(_0x280fe1){var _0x18bd17={};_0x18bd17[_0x280fe1]={'$like':'%'+_0x37bf9b[_0x9c35('0x3f')]['filter']+'%'};return _0x18bd17;})});}_0x5885c0=_['merge']({},_0x5885c0,_0x37bf9b[_0x9c35('0x54')]);return _0x225c8b['getAgents'](_0x5885c0);}})[_0x9c35('0x1b')](function(_0xe1d3c8){if(_0xe1d3c8){_0x452cc4=_0xe1d3c8['length'];if(!_0x37bf9b['query'][_0x9c35('0x45')]('nolimit')){_0x5885c0[_0x9c35('0x2b')]=qs[_0x9c35('0x2b')](_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x2b')]);_0x5885c0[_0x9c35('0x2d')]=qs[_0x9c35('0x2d')](_0x37bf9b[_0x9c35('0x3f')][_0x9c35('0x2d')]);}return _0x225c8b['getAgents'](_0x5885c0);}})[_0x9c35('0x1b')](function(_0x47c152){if(_0x47c152){return _0x47c152?{'count':_0x452cc4,'rows':_0x47c152}:null;}})['then'](respondWithResult(_0x4b6a39,null))['catch'](handleError(_0x4b6a39,null));};exports[_0x9c35('0xa4')]=function(_0x1887f2,_0x6337ef,_0x31765d){var _0x3d7ad5,_0x39f68b,_0x21f150;if(_[_0x9c35('0x74')](_0x1887f2['body'][_0x9c35('0x56')])||_0x1887f2[_0x9c35('0x56')]['body']===''){throw new db[(_0x9c35('0x6f'))][(_0x9c35('0x77'))](_0x9c35('0x78'));}if(_[_0x9c35('0x74')](_0x1887f2['body']['to'])){}_0x3d7ad5=_0x1887f2[_0x9c35('0x56')]['to'];return db[_0x9c35('0x3a')][_0x9c35('0x63')]({'where':{'id':_0x1887f2[_0x9c35('0x52')]['id']}})['then'](handleEntityNotFound(_0x6337ef,null))[_0x9c35('0x1b')](function(_0x2ae44a){if(_0x2ae44a){return db[_0x9c35('0x3a')][_0x9c35('0x5b')]({'where':{'id':_0x2ae44a['id']},'include':[{'model':db[_0x9c35('0xb8')],'as':_0x9c35('0x7c'),'include':[{'model':db[_0x9c35('0x6e')],'as':'Contacts','where':{[_0x2ae44a[_0x9c35('0x79')]]:_0x3d7ad5},'limit':0x1,'order':[['updatedAt',_0x9c35('0xb9')]]}]}]})[_0x9c35('0x1b')](handleEntityNotFound(_0x6337ef,null))['then'](function(_0x38baab){if(_0x38baab&&_0x38baab[_0x9c35('0x7c')]){_0x39f68b=_0x38baab[_0x9c35('0x33')]({'plain':!![]});if(_0x39f68b[_0x9c35('0x7c')]&&_0x39f68b[_0x9c35('0x7c')][_0x9c35('0x84')][_0x9c35('0x44')]){return _0x39f68b[_0x9c35('0x7c')][_0x9c35('0x84')][0x0];}return db[_0x9c35('0x6e')]['create'](_[_0x9c35('0x12')](_0x1887f2[_0x9c35('0x56')],{'firstName':_0x3d7ad5,[_0x38baab[_0x9c35('0x79')]]:_0x3d7ad5,'phone':_0x3d7ad5,'ListId':_0x39f68b[_0x9c35('0xba')]}));}})['then'](handleEntityNotFound(_0x6337ef,null))[_0x9c35('0x1b')](function(_0x261c59){if(_0x261c59){_0x21f150=_0x261c59;return db['OpenchannelInteraction'][_0x9c35('0x5b')]({'where':{'ContactId':_0x21f150['id'],'closed':![],'OpenchannelAccountId':_0x39f68b['id']}})[_0x9c35('0x1b')](function(_0x8cd158){if(_0x8cd158){return[_0x8cd158,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x1887f2[_0x9c35('0x57')]['id'],'ContactId':_0x21f150['id'],'OpenchannelAccountId':_0x39f68b['id'],'lastMsgDirection':'out','firstMsgDirection':'out','Messages':[_[_0x9c35('0x4d')](_0x1887f2[_0x9c35('0x56')],{'read':![],'body':_0x1887f2['body']['body'],'OpenchannelAccountId':_0x39f68b['id'],'UserId':_0x1887f2[_0x9c35('0x57')]['id'],'ContactId':_0x21f150['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':'Messages'}]})[_0x9c35('0x1b')](function(_0x2042c6){return[_0x2042c6,!![]];});});}})[_0x9c35('0xb1')](function(_0x248208,_0x446092){if(_0x446092){return _0x248208;}return db[_0x9c35('0x92')]['create'](_[_0x9c35('0x4d')](_0x1887f2[_0x9c35('0x56')],{'read':![],'body':_0x1887f2[_0x9c35('0x56')][_0x9c35('0x56')],'OpenchannelAccountId':_0x39f68b['id'],'OpenchannelInteractionId':_0x248208['id'],'UserId':_0x1887f2[_0x9c35('0x57')]['id'],'ContactId':_0x21f150['id']}))[_0x9c35('0x1b')](function(_0x2f4454){_0x248208[_0x9c35('0xbb')][_0x9c35('0xbc')]=[];_0x248208[_0x9c35('0xbb')][_0x9c35('0xbc')][_0x9c35('0xbd')](_0x2f4454[_0x9c35('0xbb')]);return _0x248208;});});}})[_0x9c35('0x1b')](respondWithResult(_0x6337ef,null))['catch'](handleError(_0x6337ef,null));}; \ No newline at end of file +var _0xc0e1=['UserProfileResource','destroy','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','findOne','hasOwnProperty','pick','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','Applications','applications','List','orderBy','account','defaults','from','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','autoclose','push','close','unmanaged','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','OpenchannelApplication','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tags','color','tag','omit','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','out','OpenchannelMessage','dataValues','Messages','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','json','undefined','count','offset','status','set','Content-Range','reject','update','get','OpenchannelAccounts'];(function(_0x281a07,_0x19cdaf){var _0xe7fb48=function(_0x551c29){while(--_0x551c29){_0x281a07['push'](_0x281a07['shift']());}};_0xe7fb48(++_0x19cdaf);}(_0xc0e1,0x147));var _0x1c0e=function(_0x260b48,_0x117977){_0x260b48=_0x260b48-0x0;var _0x3f730b=_0xc0e1[_0x260b48];return _0x3f730b;};'use strict';var emlformat=require(_0x1c0e('0x0'));var rimraf=require(_0x1c0e('0x1'));var zipdir=require(_0x1c0e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c0e('0x3'));var moment=require(_0x1c0e('0x4'));var BPromise=require(_0x1c0e('0x5'));var Mustache=require(_0x1c0e('0x6'));var util=require(_0x1c0e('0x7'));var path=require(_0x1c0e('0x8'));var sox=require(_0x1c0e('0x9'));var csv=require(_0x1c0e('0xa'));var ejs=require(_0x1c0e('0xb'));var fs=require('fs');var fs_extra=require(_0x1c0e('0xc'));var _=require(_0x1c0e('0xd'));var squel=require(_0x1c0e('0xe'));var crypto=require(_0x1c0e('0xf'));var jsforce=require(_0x1c0e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1c0e('0xa'));var querystring=require(_0x1c0e('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1c0e('0x12'));var qs=require(_0x1c0e('0x13'));var as=require(_0x1c0e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1c0e('0x15'));var utils=require(_0x1c0e('0x16'));var config=require(_0x1c0e('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x1c0e('0x18')],{'host':_0x1c0e('0x19'),'port':0x18eb});var socket=require(_0x1c0e('0x1a'))(new Redis(config[_0x1c0e('0x18')]));require(_0x1c0e('0x1b'))[_0x1c0e('0x1c')](socket);var jayson=require(_0x1c0e('0x1d'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x1c0e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0xad2c6b,_0x5d9ca9,_0x1d7c97,_0x446b15){return new BPromise(function(_0x449c7d,_0x2b2fa6){var _0x20fb5b=_0x446b15||client;return _0x20fb5b[_0x1c0e('0x1f')](_0xad2c6b,_0x1d7c97)[_0x1c0e('0x20')](function(_0x4c3bfb){logger[_0x1c0e('0x21')](_0x1c0e('0x22'),_0x5d9ca9,_0x1c0e('0x23'));logger[_0x1c0e('0x24')](_0x1c0e('0x25'),_0x5d9ca9,'request\x20sent',JSON[_0x1c0e('0x26')](_0x4c3bfb));if(_0x4c3bfb[_0x1c0e('0x27')]){if(_0x4c3bfb['error'][_0x1c0e('0x28')]===0x1f4){logger[_0x1c0e('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d9ca9,_0x4c3bfb[_0x1c0e('0x27')][_0x1c0e('0x29')]);return _0x2b2fa6(_0x4c3bfb[_0x1c0e('0x27')][_0x1c0e('0x29')]);}logger[_0x1c0e('0x27')](_0x1c0e('0x22'),_0x5d9ca9,_0x4c3bfb[_0x1c0e('0x27')]['message']);return _0x449c7d(_0x4c3bfb['error']['message']);}else{logger[_0x1c0e('0x21')](_0x1c0e('0x22'),_0x5d9ca9,_0x1c0e('0x23'));_0x449c7d(_0x4c3bfb[_0x1c0e('0x2a')]['message']);}})[_0x1c0e('0x2b')](function(_0x380a55){logger[_0x1c0e('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x5d9ca9,_0x380a55);_0x2b2fa6(_0x380a55);});});}function respondWithStatusCode(_0x5618cf,_0x3ba553){_0x3ba553=_0x3ba553||0xcc;return function(_0xd88724){if(_0xd88724){return _0x5618cf[_0x1c0e('0x2c')](_0x3ba553);}return _0x5618cf['status'](_0x3ba553)[_0x1c0e('0x2d')]();};}function respondWithResult(_0x1c2cf2,_0x52a9e5){_0x52a9e5=_0x52a9e5||0xc8;return function(_0x4469aa){if(_0x4469aa){return _0x1c2cf2['status'](_0x52a9e5)[_0x1c0e('0x2e')](_0x4469aa);}};}function respondWithFilteredResult(_0x1e6a17,_0x4dc494){return function(_0x4d96be){if(_0x4d96be){var _0x430ee3=typeof _0x4dc494['offset']===_0x1c0e('0x2f')&&typeof _0x4dc494['limit']===_0x1c0e('0x2f');var _0x628da8=_0x4d96be[_0x1c0e('0x30')];var _0x23a7f2=_0x430ee3?0x0:_0x4dc494[_0x1c0e('0x31')];var _0x21a8a2=_0x430ee3?_0x4d96be[_0x1c0e('0x30')]:_0x4dc494[_0x1c0e('0x31')]+_0x4dc494['limit'];var _0x4eb376;if(_0x21a8a2>=_0x628da8){_0x21a8a2=_0x628da8;_0x4eb376=0xc8;}else{_0x4eb376=0xce;}_0x1e6a17[_0x1c0e('0x32')](_0x4eb376);return _0x1e6a17[_0x1c0e('0x33')](_0x1c0e('0x34'),_0x23a7f2+'-'+_0x21a8a2+'/'+_0x628da8)['json'](_0x4d96be);}return null;};}function patchUpdates(_0x382d9c){return function(_0x104135){try{jsonpatch['apply'](_0x104135,_0x382d9c,!![]);}catch(_0x887b6f){return BPromise[_0x1c0e('0x35')](_0x887b6f);}return _0x104135['save']();};}function saveUpdates(_0x1812b7,_0x5d09ba){return function(_0x408335){if(_0x408335){return _0x408335[_0x1c0e('0x36')](_0x1812b7)[_0x1c0e('0x20')](function(_0x3d7ef8){return _0x3d7ef8;});}return null;};}function removeEntity(_0x5d8a69,_0xb6ba38){return function(_0x1d82f5){if(_0x1d82f5){return _0x1d82f5['destroy']()['then'](function(){var _0x4bd77c=_0x1d82f5[_0x1c0e('0x37')]({'plain':!![]});var _0x4cb359=_0x1c0e('0x38');return db[_0x1c0e('0x39')][_0x1c0e('0x3a')]({'where':{'type':_0x4cb359,'resourceId':_0x4bd77c['id']}})['then'](function(){return _0x1d82f5;});})[_0x1c0e('0x20')](function(){_0x5d8a69[_0x1c0e('0x32')](0xcc)[_0x1c0e('0x2d')]();});}};}function handleEntityNotFound(_0x464905,_0x415fab){return function(_0xcfb183){if(!_0xcfb183){_0x464905['sendStatus'](0x194);}return _0xcfb183;};}function handleError(_0x31c921,_0x4e6289){_0x4e6289=_0x4e6289||0x1f4;return function(_0x305831){logger[_0x1c0e('0x27')](_0x305831['stack']);if(_0x305831['name']){delete _0x305831[_0x1c0e('0x3b')];}_0x31c921[_0x1c0e('0x32')](_0x4e6289)[_0x1c0e('0x3c')](_0x305831);};}exports['index']=function(_0x485be1,_0x58d3e4){var _0x205054={'include':[{'model':db[_0x1c0e('0x3d')],'as':_0x1c0e('0x3e')}]},_0x26fe95={},_0xda42ad={'count':0x0,'rows':[]};var _0x57ed68=_[_0x1c0e('0x3f')](db[_0x1c0e('0x40')][_0x1c0e('0x41')],function(_0x152264){return{'name':_0x152264[_0x1c0e('0x42')],'type':_0x152264[_0x1c0e('0x43')][_0x1c0e('0x44')]};});_0x26fe95[_0x1c0e('0x45')]=_[_0x1c0e('0x3f')](_0x57ed68,_0x1c0e('0x3b'));_0x26fe95[_0x1c0e('0x46')]=_[_0x1c0e('0x47')](_0x485be1[_0x1c0e('0x46')]);_0x26fe95[_0x1c0e('0x48')]=_[_0x1c0e('0x49')](_0x26fe95[_0x1c0e('0x45')],_0x26fe95[_0x1c0e('0x46')]);_0x205054[_0x1c0e('0x4a')]=_[_0x1c0e('0x49')](_0x26fe95[_0x1c0e('0x45')],qs[_0x1c0e('0x4b')](_0x485be1['query'][_0x1c0e('0x4b')]));_0x205054[_0x1c0e('0x4a')]=_0x205054[_0x1c0e('0x4a')][_0x1c0e('0x4c')]?_0x205054[_0x1c0e('0x4a')]:_0x26fe95[_0x1c0e('0x45')];if(!_0x485be1[_0x1c0e('0x46')]['hasOwnProperty'](_0x1c0e('0x4d'))){_0x205054[_0x1c0e('0x4e')]=qs[_0x1c0e('0x4e')](_0x485be1[_0x1c0e('0x46')][_0x1c0e('0x4e')]);_0x205054['offset']=qs['offset'](_0x485be1[_0x1c0e('0x46')][_0x1c0e('0x31')]);}_0x205054[_0x1c0e('0x4f')]=qs[_0x1c0e('0x50')](_0x485be1[_0x1c0e('0x46')][_0x1c0e('0x50')]);_0x205054['where']=qs[_0x1c0e('0x48')](_['pick'](_0x485be1[_0x1c0e('0x46')],_0x26fe95['filters']),_0x57ed68);if(_0x485be1[_0x1c0e('0x46')]['filter']){_0x205054[_0x1c0e('0x51')]=_[_0x1c0e('0x52')](_0x205054[_0x1c0e('0x51')],{'$or':_[_0x1c0e('0x3f')](_0x57ed68,function(_0x38d748){if(_0x38d748['type']!==_0x1c0e('0x53')){var _0x5a9f39={};_0x5a9f39[_0x38d748[_0x1c0e('0x3b')]]={'$like':'%'+_0x485be1[_0x1c0e('0x46')][_0x1c0e('0x54')]+'%'};return _0x5a9f39;}})});}_0x205054=_[_0x1c0e('0x52')]({},_0x205054,_0x485be1[_0x1c0e('0x55')]);var _0x3a8b60={'where':_0x205054[_0x1c0e('0x51')]};return db[_0x1c0e('0x40')][_0x1c0e('0x30')](_0x3a8b60)[_0x1c0e('0x20')](function(_0x58c6ad){_0xda42ad[_0x1c0e('0x30')]=_0x58c6ad;if(_0x485be1[_0x1c0e('0x46')][_0x1c0e('0x56')]){_0x205054[_0x1c0e('0x57')]=[{'all':!![]}];}return db[_0x1c0e('0x40')][_0x1c0e('0x58')](_0x205054);})[_0x1c0e('0x20')](function(_0x4094dc){_0xda42ad[_0x1c0e('0x59')]=_0x4094dc;return _0xda42ad;})[_0x1c0e('0x20')](respondWithFilteredResult(_0x58d3e4,_0x205054))['catch'](handleError(_0x58d3e4,null));};exports[_0x1c0e('0x5a')]=function(_0x51d2a0,_0x492613){var _0x2c2317={'raw':![],'where':{'id':_0x51d2a0[_0x1c0e('0x5b')]['id']},'include':[{'model':db[_0x1c0e('0x3d')],'as':_0x1c0e('0x3e')}]},_0x245cb4={};_0x245cb4[_0x1c0e('0x45')]=_[_0x1c0e('0x47')](db[_0x1c0e('0x40')][_0x1c0e('0x41')]);_0x245cb4[_0x1c0e('0x46')]=_['keys'](_0x51d2a0[_0x1c0e('0x46')]);_0x245cb4[_0x1c0e('0x48')]=_[_0x1c0e('0x49')](_0x245cb4[_0x1c0e('0x45')],_0x245cb4[_0x1c0e('0x46')]);_0x2c2317[_0x1c0e('0x4a')]=_[_0x1c0e('0x49')](_0x245cb4[_0x1c0e('0x45')],qs['fields'](_0x51d2a0[_0x1c0e('0x46')][_0x1c0e('0x4b')]));_0x2c2317['attributes']=_0x2c2317[_0x1c0e('0x4a')][_0x1c0e('0x4c')]?_0x2c2317[_0x1c0e('0x4a')]:_0x245cb4[_0x1c0e('0x45')];if(_0x51d2a0[_0x1c0e('0x46')][_0x1c0e('0x56')]){_0x2c2317[_0x1c0e('0x57')]=[{'all':!![]}];}_0x2c2317=_[_0x1c0e('0x52')]({},_0x2c2317,_0x51d2a0[_0x1c0e('0x55')]);return db[_0x1c0e('0x40')][_0x1c0e('0x5c')](_0x2c2317)[_0x1c0e('0x20')](handleEntityNotFound(_0x492613,null))[_0x1c0e('0x20')](respondWithResult(_0x492613,null))[_0x1c0e('0x2b')](handleError(_0x492613,null));};exports[_0x1c0e('0x5d')]=function(_0x540724,_0xb1d9f1){return db[_0x1c0e('0x40')][_0x1c0e('0x5d')](_0x540724[_0x1c0e('0x5e')],{})[_0x1c0e('0x20')](function(_0x2018e3){var _0x347370=_0x540724[_0x1c0e('0x5f')][_0x1c0e('0x37')]({'plain':!![]});if(!_0x347370)throw new Error(_0x1c0e('0x60'));if(_0x347370[_0x1c0e('0x61')]==='user'){var _0x761b76=_0x2018e3['get']({'plain':!![]});var _0x10ad63=_0x1c0e('0x38');return db[_0x1c0e('0x62')][_0x1c0e('0x5c')]({'where':{'name':_0x10ad63,'userProfileId':_0x347370['userProfileId']},'raw':!![]})[_0x1c0e('0x20')](function(_0x222c5c){if(_0x222c5c&&_0x222c5c[_0x1c0e('0x63')]===0x0){return db[_0x1c0e('0x39')]['create']({'name':_0x761b76[_0x1c0e('0x3b')],'resourceId':_0x761b76['id'],'type':_0x222c5c[_0x1c0e('0x3b')],'sectionId':_0x222c5c['id']},{})['then'](function(){return _0x2018e3;});}else{return _0x2018e3;}})[_0x1c0e('0x2b')](function(_0x640486){logger[_0x1c0e('0x27')](_0x1c0e('0x64'),_0x640486);throw _0x640486;});}return _0x2018e3;})['then'](respondWithResult(_0xb1d9f1,0xc9))[_0x1c0e('0x2b')](handleError(_0xb1d9f1,null));};exports[_0x1c0e('0x36')]=function(_0x334b7a,_0x43a39d){if(_0x334b7a[_0x1c0e('0x5e')]['id']){delete _0x334b7a[_0x1c0e('0x5e')]['id'];}return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0x334b7a['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x43a39d,null))['then'](saveUpdates(_0x334b7a[_0x1c0e('0x5e')],null))[_0x1c0e('0x20')](respondWithResult(_0x43a39d,null))['catch'](handleError(_0x43a39d,null));};exports[_0x1c0e('0x3a')]=function(_0xe92eaf,_0x43fd68){return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0xe92eaf[_0x1c0e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x43fd68,null))[_0x1c0e('0x20')](removeEntity(_0x43fd68,null))[_0x1c0e('0x2b')](handleError(_0x43fd68,null));};exports[_0x1c0e('0x65')]=function(_0x34dfac,_0x53008c){return db['OpenchannelAccount']['describe']()[_0x1c0e('0x20')](respondWithResult(_0x53008c,null))[_0x1c0e('0x2b')](handleError(_0x53008c,null));};exports[_0x1c0e('0x66')]=function(_0x3acb94,_0x41e64d,_0x52c64c){if(_0x3acb94[_0x1c0e('0x5e')]['id']){delete _0x3acb94[_0x1c0e('0x5e')]['id'];}return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0x3acb94['params']['id']}})['then'](handleEntityNotFound(_0x41e64d,null))[_0x1c0e('0x20')](function(_0x1d5063){if(_0x1d5063){_0x3acb94['body'][_0x1c0e('0x67')]=_0x1d5063['id'];return db['Disposition'][_0x1c0e('0x5d')](_0x3acb94['body']);}})[_0x1c0e('0x20')](respondWithResult(_0x41e64d,null))[_0x1c0e('0x2b')](handleError(_0x41e64d,null));};exports['getDispositions']=function(_0x1301d2,_0x335d0d,_0x3a7805){var _0x2d6bad={'raw':![],'where':{}};var _0x502d54={};var _0x13078e={'count':0x0,'rows':[]};return db[_0x1c0e('0x40')][_0x1c0e('0x68')]({'where':{'id':_0x1301d2['params']['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x335d0d,null))['then'](function(_0x4b7347){if(_0x4b7347){_0x502d54[_0x1c0e('0x45')]=_[_0x1c0e('0x47')](db['Disposition']['rawAttributes']);_0x502d54[_0x1c0e('0x46')]=_[_0x1c0e('0x47')](_0x1301d2[_0x1c0e('0x46')]);_0x502d54[_0x1c0e('0x48')]=_[_0x1c0e('0x49')](_0x502d54[_0x1c0e('0x45')],_0x502d54[_0x1c0e('0x46')]);_0x2d6bad[_0x1c0e('0x4a')]=_['intersection'](_0x502d54[_0x1c0e('0x45')],qs[_0x1c0e('0x4b')](_0x1301d2[_0x1c0e('0x46')]['fields']));_0x2d6bad[_0x1c0e('0x4a')]=_0x2d6bad[_0x1c0e('0x4a')][_0x1c0e('0x4c')]?_0x2d6bad[_0x1c0e('0x4a')]:_0x502d54[_0x1c0e('0x45')];if(!_0x1301d2[_0x1c0e('0x46')][_0x1c0e('0x69')](_0x1c0e('0x4d'))){_0x2d6bad[_0x1c0e('0x4e')]=qs[_0x1c0e('0x4e')](_0x1301d2['query']['limit']);_0x2d6bad[_0x1c0e('0x31')]=qs[_0x1c0e('0x31')](_0x1301d2[_0x1c0e('0x46')][_0x1c0e('0x31')]);}_0x2d6bad[_0x1c0e('0x4f')]=qs[_0x1c0e('0x50')](_0x1301d2[_0x1c0e('0x46')][_0x1c0e('0x50')]);_0x2d6bad[_0x1c0e('0x51')]=qs[_0x1c0e('0x48')](_[_0x1c0e('0x6a')](_0x1301d2[_0x1c0e('0x46')],_0x502d54[_0x1c0e('0x48')]));_0x2d6bad['where'][_0x1c0e('0x67')]=_0x4b7347['id'];if(_0x1301d2[_0x1c0e('0x46')][_0x1c0e('0x54')]){_0x2d6bad['where']=_[_0x1c0e('0x52')](_0x2d6bad[_0x1c0e('0x51')],{'$or':_[_0x1c0e('0x3f')](_0x2d6bad[_0x1c0e('0x4a')],function(_0x1deb8e){var _0x563da8={};_0x563da8[_0x1deb8e]={'$like':'%'+_0x1301d2['query']['filter']+'%'};return _0x563da8;})});}_0x2d6bad=_[_0x1c0e('0x52')]({},_0x2d6bad,_0x1301d2[_0x1c0e('0x55')]);return db[_0x1c0e('0x6b')][_0x1c0e('0x30')]({'where':_0x2d6bad[_0x1c0e('0x51')]})[_0x1c0e('0x20')](function(_0x1731c4){_0x13078e[_0x1c0e('0x30')]=_0x1731c4;if(_0x1301d2[_0x1c0e('0x46')][_0x1c0e('0x56')]){_0x2d6bad[_0x1c0e('0x57')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2d6bad);})[_0x1c0e('0x20')](function(_0x301dc2){_0x13078e['rows']=_0x301dc2;return _0x13078e;});}})['then'](respondWithFilteredResult(_0x335d0d,_0x2d6bad))[_0x1c0e('0x2b')](handleError(_0x335d0d,null));};exports['removeDispositions']=function(_0x37c5f6,_0x34c35c,_0xc178a6){return db['OpenchannelAccount'][_0x1c0e('0x5c')]({'where':{'id':_0x37c5f6['params']['id']}})['then'](handleEntityNotFound(_0x34c35c,null))[_0x1c0e('0x20')](function(_0x5b1ac1){if(_0x5b1ac1){return _0x5b1ac1[_0x1c0e('0x6c')](_0x37c5f6['query'][_0x1c0e('0x6d')]);}})['then'](respondWithStatusCode(_0x34c35c,null))[_0x1c0e('0x2b')](handleError(_0x34c35c,null));};exports['addAnswer']=function(_0x28d2c3,_0x3f7ef3,_0x1c91b2){if(_0x28d2c3[_0x1c0e('0x5e')]['id']){delete _0x28d2c3['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x28d2c3['params']['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x3f7ef3,null))[_0x1c0e('0x20')](function(_0x5a27ed){if(_0x5a27ed){_0x28d2c3['body'][_0x1c0e('0x67')]=_0x5a27ed['id'];return db[_0x1c0e('0x6e')]['create'](_0x28d2c3[_0x1c0e('0x5e')]);}})[_0x1c0e('0x20')](respondWithResult(_0x3f7ef3,null))[_0x1c0e('0x2b')](handleError(_0x3f7ef3,null));};exports[_0x1c0e('0x6f')]=function(_0x21d2f9,_0x1f9fd6,_0x49692b){var _0x315349={'raw':![],'where':{}};var _0xc20222={};var _0x51bb1e={'count':0x0,'rows':[]};return db[_0x1c0e('0x40')][_0x1c0e('0x68')]({'where':{'id':_0x21d2f9[_0x1c0e('0x5b')]['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x1f9fd6,null))[_0x1c0e('0x20')](function(_0x4327ba){if(_0x4327ba){_0xc20222[_0x1c0e('0x45')]=_[_0x1c0e('0x47')](db[_0x1c0e('0x6e')][_0x1c0e('0x41')]);_0xc20222['query']=_[_0x1c0e('0x47')](_0x21d2f9[_0x1c0e('0x46')]);_0xc20222[_0x1c0e('0x48')]=_[_0x1c0e('0x49')](_0xc20222[_0x1c0e('0x45')],_0xc20222[_0x1c0e('0x46')]);_0x315349[_0x1c0e('0x4a')]=_[_0x1c0e('0x49')](_0xc20222[_0x1c0e('0x45')],qs[_0x1c0e('0x4b')](_0x21d2f9[_0x1c0e('0x46')][_0x1c0e('0x4b')]));_0x315349[_0x1c0e('0x4a')]=_0x315349[_0x1c0e('0x4a')][_0x1c0e('0x4c')]?_0x315349['attributes']:_0xc20222[_0x1c0e('0x45')];if(!_0x21d2f9[_0x1c0e('0x46')][_0x1c0e('0x69')](_0x1c0e('0x4d'))){_0x315349[_0x1c0e('0x4e')]=qs[_0x1c0e('0x4e')](_0x21d2f9['query'][_0x1c0e('0x4e')]);_0x315349[_0x1c0e('0x31')]=qs[_0x1c0e('0x31')](_0x21d2f9[_0x1c0e('0x46')]['offset']);}_0x315349['order']=qs['sort'](_0x21d2f9[_0x1c0e('0x46')][_0x1c0e('0x50')]);_0x315349[_0x1c0e('0x51')]=qs[_0x1c0e('0x48')](_[_0x1c0e('0x6a')](_0x21d2f9[_0x1c0e('0x46')],_0xc20222[_0x1c0e('0x48')]));_0x315349[_0x1c0e('0x51')][_0x1c0e('0x67')]=_0x4327ba['id'];if(_0x21d2f9['query'][_0x1c0e('0x54')]){_0x315349[_0x1c0e('0x51')]=_[_0x1c0e('0x52')](_0x315349[_0x1c0e('0x51')],{'$or':_[_0x1c0e('0x3f')](_0x315349[_0x1c0e('0x4a')],function(_0x304be0){var _0x5d6e34={};_0x5d6e34[_0x304be0]={'$like':'%'+_0x21d2f9['query'][_0x1c0e('0x54')]+'%'};return _0x5d6e34;})});}_0x315349=_[_0x1c0e('0x52')]({},_0x315349,_0x21d2f9[_0x1c0e('0x55')]);return db['CannedAnswer'][_0x1c0e('0x30')]({'where':_0x315349[_0x1c0e('0x51')]})[_0x1c0e('0x20')](function(_0xa62cf3){_0x51bb1e['count']=_0xa62cf3;if(_0x21d2f9['query']['includeAll']){_0x315349[_0x1c0e('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x1c0e('0x58')](_0x315349);})[_0x1c0e('0x20')](function(_0x59c29c){_0x51bb1e['rows']=_0x59c29c;return _0x51bb1e;});}})[_0x1c0e('0x20')](respondWithFilteredResult(_0x1f9fd6,_0x315349))[_0x1c0e('0x2b')](handleError(_0x1f9fd6,null));};exports['removeAnswers']=function(_0x5a72da,_0x2793ef,_0x46eaef){return db[_0x1c0e('0x40')]['find']({'where':{'id':_0x5a72da[_0x1c0e('0x5b')]['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x2793ef,null))[_0x1c0e('0x20')](function(_0x133d5a){if(_0x133d5a){return _0x133d5a[_0x1c0e('0x70')](_0x5a72da['query']['ids']);}})[_0x1c0e('0x20')](respondWithStatusCode(_0x2793ef,null))[_0x1c0e('0x2b')](handleError(_0x2793ef,null));};exports[_0x1c0e('0x71')]=function(_0x143afd,_0x329f51,_0x3664a0){var _0x3f8ae2={'body':_0x143afd[_0x1c0e('0x5e')],'channel':_0x1c0e('0x72')};var _0x4f7439=[];var _0x2d6e38=[];var _0x257f10={};var _0xf71530=![];return db[_0x1c0e('0x73')][_0x1c0e('0x65')]()[_0x1c0e('0x20')](function(_0x199dbe){if(!_0x199dbe){throw new db[(_0x1c0e('0x74'))]['ValidationError'](_0x1c0e('0x75'));}_0x4f7439=_[_0x1c0e('0x76')](_['keys'](_0x199dbe),['createdAt',_0x1c0e('0x77')]);_0x2d6e38=_[_0x1c0e('0x76')](_[_0x1c0e('0x47')](_0x199dbe),[_0x1c0e('0x78'),_0x1c0e('0x77'),_0x1c0e('0x79'),_0x1c0e('0x7a')]);if(_0x143afd[_0x1c0e('0x5e')]['id']){delete _0x143afd[_0x1c0e('0x5e')]['id'];}if(_[_0x1c0e('0x7b')](_0x143afd[_0x1c0e('0x5e')]['from'])){throw new db[(_0x1c0e('0x74'))][(_0x1c0e('0x7c'))]('from\x20is\x20mandatory');}if(_[_0x1c0e('0x7b')](_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x5e')])||_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x5e')]===''){throw new db['Sequelize'][(_0x1c0e('0x7c'))](_0x1c0e('0x7d'));}if(_[_0x1c0e('0x7b')](_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x7e')])){throw new db[(_0x1c0e('0x74'))][(_0x1c0e('0x7c'))](_0x1c0e('0x7f')+_0x2d6e38);}if(!_[_0x1c0e('0x80')](_0x2d6e38,_0x143afd[_0x1c0e('0x5e')]['mapKey'])){throw new db[(_0x1c0e('0x74'))][(_0x1c0e('0x7c'))](_0x1c0e('0x81')+_0x2d6e38);}_0x257f10[_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x7e')]]=_0x143afd[_0x1c0e('0x5e')]['from'];})[_0x1c0e('0x20')](function(){return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0x143afd[_0x1c0e('0x5b')]['id']},'include':[{'model':db[_0x1c0e('0x82')],'as':'List','include':[{'model':db[_0x1c0e('0x73')],'as':_0x1c0e('0x83'),'where':_0x257f10,'limit':0x1,'order':[[_0x1c0e('0x77'),_0x1c0e('0x84')]]}]},{'model':db['OpenchannelApplication'],'as':_0x1c0e('0x85')}]});})[_0x1c0e('0x20')](handleEntityNotFound(_0x329f51,null))[_0x1c0e('0x20')](function(_0x150edc){if(_0x150edc&&_0x150edc['List']){_0x3f8ae2['account']=_0x150edc;_0x3f8ae2[_0x1c0e('0x86')]=_0x150edc[_0x1c0e('0x85')];_0x3f8ae2['list']=_0x150edc[_0x1c0e('0x87')];_0x3f8ae2[_0x1c0e('0x86')]=_[_0x1c0e('0x88')](_0x3f8ae2[_0x1c0e('0x86')],['priority'],['asc']);if(_0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0x85')]){delete _0x3f8ae2['account'][_0x1c0e('0x85')];}if(_0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0x87')]&&_0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0x87')][_0x1c0e('0x83')][_0x1c0e('0x4c')]){return _0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0x87')][_0x1c0e('0x83')][0x0];}var _0x248046=_[_0x1c0e('0x8a')](_0x143afd[_0x1c0e('0x5e')],{'firstName':_0x143afd['body']['from'],'ListId':_0x150edc[_0x1c0e('0x7a')]});_0x248046[_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x7e')]]=_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x8b')];return db['CmContact'][_0x1c0e('0x5d')](_0x248046,{'fields':_0x4f7439,'raw':!![]});}})[_0x1c0e('0x20')](handleEntityNotFound(_0x329f51,null))[_0x1c0e('0x20')](function(_0x1e7c74){_0x3f8ae2[_0x1c0e('0x8c')]=_0x1e7c74;if(_0x1e7c74){var _0x758d7a={'ContactId':_0x1e7c74['id'],'OpenchannelAccountId':_0x143afd[_0x1c0e('0x5b')]['id'],'from':(_0x1e7c74['firstName']||'')+'\x20'+(_0x1e7c74['lastName']||'')};var _0xf40642={'OpenchannelAccountId':_0x143afd[_0x1c0e('0x5b')]['id'],'closed':![]};if(_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x8d')]){_0xf40642[_0x1c0e('0x8d')]=_0x143afd['body'][_0x1c0e('0x8d')];return db[_0x1c0e('0x8e')][_0x1c0e('0x5c')]({'where':_0xf40642})[_0x1c0e('0x20')](function(_0x3fef26){if(_0x3fef26){return[_0x3fef26,![]];}_0x758d7a['threadId']=_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x8d')];_0x758d7a['externalUrl']=_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x8f')];return db[_0x1c0e('0x8e')][_0x1c0e('0x5d')](_0x758d7a)[_0x1c0e('0x20')](function(_0x307ed1){return[_0x307ed1,!![]];});});}else{_0xf40642[_0x1c0e('0x8d')]=null;}_0xf40642[_0x1c0e('0x90')]=_0x1e7c74['id'];return db[_0x1c0e('0x8e')][_0x1c0e('0x5c')]({'where':_0xf40642})['then'](function(_0x215dd2){if(_0x215dd2){return[_0x215dd2,![]];}return db[_0x1c0e('0x8e')]['create'](_0x758d7a)['then'](function(_0x3127e5){return[_0x3127e5,!![]];});});}})[_0x1c0e('0x91')](function(_0x28b6f1,_0x1bdfae){if(_0x28b6f1){_0xf71530=_0x1bdfae;if(!_0x1bdfae){var _0x135a6a={'from':(_0x3f8ae2[_0x1c0e('0x8c')][_0x1c0e('0x92')]||'')+'\x20'+(_0x3f8ae2[_0x1c0e('0x8c')]['lastName']||'')};if(_0x143afd[_0x1c0e('0x5e')]['threadId']&&_0x143afd[_0x1c0e('0x5e')]['messageId']&&_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x8d')]!=_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x93')]){_0x135a6a[_0x1c0e('0x8d')]=_0x143afd[_0x1c0e('0x5e')]['messageId'];}return _0x28b6f1['update'](_0x135a6a);}else{return _0x28b6f1;}}})[_0x1c0e('0x20')](function(_0x56c3d8){_0x3f8ae2[_0x1c0e('0x94')]=_0x56c3d8[_0x1c0e('0x37')]({'plain':!![]});_0x3f8ae2[_0x1c0e('0x94')]['created']=_0xf71530;if(_0x3f8ae2['interaction']['created']){if(_0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0x95')]){_0x3f8ae2['applications'][_0x1c0e('0x96')]({'id':0x0,'priority':_0x3f8ae2['applications'][_0x1c0e('0x4c')]+0x1,'app':_0x1c0e('0x97'),'appdata':_0x1c0e('0x98'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x1c0e('0x5d')]({'body':_0x143afd['body']['body'],'OpenchannelAccountId':_0x143afd[_0x1c0e('0x5b')]['id'],'OpenchannelInteractionId':_0x56c3d8['id'],'direction':'in','ContactId':_0x3f8ae2[_0x1c0e('0x8c')]['id'],'AttachmentId':_0x143afd[_0x1c0e('0x5e')][_0x1c0e('0x99')]});})[_0x1c0e('0x20')](function(_0x2bad13){_0x3f8ae2[_0x1c0e('0x29')]=_0x2bad13;if(!_0x3f8ae2[_0x1c0e('0x94')][_0x1c0e('0x9a')])return;return db[_0x1c0e('0x9b')][_0x1c0e('0x5c')]({'attributes':['id',_0x1c0e('0x3b')],'where':{'id':_0x3f8ae2['interaction'][_0x1c0e('0x9a')]}});})['then'](function(_0x5aede7){if(_0x5aede7){_0x3f8ae2[_0x1c0e('0x86')][_0x1c0e('0x9c')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5aede7['name']+','+(_0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0x9d')]||0xa),'interval':_0x1c0e('0x9e')});}if(!_0x3f8ae2[_0x1c0e('0x94')][_0x1c0e('0x9f')])return;return db[_0x1c0e('0xa0')][_0x1c0e('0x5c')]({'attributes':['id',_0x1c0e('0x3b')],'where':{'id':_0x3f8ae2[_0x1c0e('0x94')]['queueId']}});})[_0x1c0e('0x20')](function(_0x4a35b0){if(_0x4a35b0){_0x3f8ae2[_0x1c0e('0x86')][_0x1c0e('0x9c')]({'id':0x0,'priority':0x1,'app':_0x1c0e('0xa1'),'appdata':_0x4a35b0[_0x1c0e('0x3b')]+','+(_0x3f8ae2[_0x1c0e('0x89')][_0x1c0e('0xa2')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x1c0e('0xa3'),'startRouting',_0x3f8ae2);})[_0x1c0e('0x20')](function(_0x3dedb0){respondWithRpcPromise(_0x1c0e('0xa4'),_0x1c0e('0xa4'),{'event':_0x1c0e('0x71'),'message':_0x3dedb0},client9002);return _0x3dedb0;})[_0x1c0e('0x20')](respondWithResult(_0x329f51,null))[_0x1c0e('0x2b')](handleError(_0x329f51,null));};exports[_0x1c0e('0xa5')]=function(_0x9a6e5b,_0x3d9c06){var _0x21c0b9=_0x9a6e5b[_0x1c0e('0x5b')]['id'];var _0x52ef9d=_0x9a6e5b[_0x1c0e('0x5e')];var _0x3a1c00=0xc8;var _0x550ffb=null;return db[_0x1c0e('0xa6')][_0x1c0e('0xa7')]({'isolationLevel':db[_0x1c0e('0xa6')][_0x1c0e('0xa8')]['ISOLATION_LEVELS'][_0x1c0e('0xa9')]},function(_0x5307b7){return db['OpenchannelAccount'][_0x1c0e('0x68')]({'where':{'id':_0x21c0b9},'transaction':_0x5307b7})[_0x1c0e('0x20')](function(_0x375073){if(_0x375073){return db[_0x1c0e('0xaa')]['destroy']({'where':{'OpenchannelAccountId':_0x21c0b9},'transaction':_0x5307b7})[_0x1c0e('0x20')](function(){var _0x5b2c81=_[_0x1c0e('0x3f')](_0x52ef9d,function(_0x3068e4){_0x3068e4[_0x1c0e('0x67')]=_0x21c0b9;return _0x3068e4;});return db[_0x1c0e('0xaa')]['bulkCreate'](_0x5b2c81,{'transaction':_0x5307b7});});}else{_0x3a1c00=0x194;_0x550ffb=[];}});})[_0x1c0e('0x20')](function(){if(_0x3a1c00!==0x194){return db[_0x1c0e('0xaa')][_0x1c0e('0xab')]({'where':{'OpenchannelAccountId':_0x21c0b9},'order':'priority'})[_0x1c0e('0x20')](function(_0x218014){_0x550ffb=_0x218014;});}})[_0x1c0e('0x2b')](function(_0x2f0502){_0x3a1c00=0x1f4;logger['error'](_0x2f0502['stack']);if(_0x2f0502[_0x1c0e('0x3b')]){delete _0x2f0502[_0x1c0e('0x3b')];}_0x550ffb=_0x2f0502;})[_0x1c0e('0xac')](function(){if(_0x550ffb===null){_0x3d9c06[_0x1c0e('0x2c')](_0x3a1c00);}else{if(_0x3a1c00===0x1f4){_0x3d9c06['status'](_0x3a1c00)[_0x1c0e('0x3c')](_0x550ffb);}else{_0x3d9c06[_0x1c0e('0x32')](_0x3a1c00)[_0x1c0e('0x2e')](_0x550ffb);}}});};exports[_0x1c0e('0xad')]=function(_0x5adca5,_0x296767,_0x1056fe){var _0x5b89ac={};var _0x47572a={};var _0x43a68a;var _0x5c4205;return db[_0x1c0e('0x40')]['findOne']({'where':{'id':_0x5adca5[_0x1c0e('0x5b')]['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x296767,null))['then'](function(_0x5eaeed){if(_0x5eaeed){_0x43a68a=_0x5eaeed;_0x47572a[_0x1c0e('0x45')]=_[_0x1c0e('0x47')](db[_0x1c0e('0xaa')]['rawAttributes']);_0x47572a[_0x1c0e('0x46')]=_[_0x1c0e('0x47')](_0x5adca5[_0x1c0e('0x46')]);_0x47572a['filters']=_[_0x1c0e('0x49')](_0x47572a[_0x1c0e('0x45')],_0x47572a[_0x1c0e('0x46')]);_0x5b89ac[_0x1c0e('0x4a')]=_['intersection'](_0x47572a[_0x1c0e('0x45')],qs['fields'](_0x5adca5['query']['fields']));_0x5b89ac[_0x1c0e('0x4a')]=_0x5b89ac['attributes'][_0x1c0e('0x4c')]?_0x5b89ac['attributes']:_0x47572a[_0x1c0e('0x45')];_0x5b89ac[_0x1c0e('0x4f')]=qs[_0x1c0e('0x50')](_0x5adca5[_0x1c0e('0x46')][_0x1c0e('0x50')]);_0x5b89ac[_0x1c0e('0x51')]=qs[_0x1c0e('0x48')](_[_0x1c0e('0x6a')](_0x5adca5[_0x1c0e('0x46')],_0x47572a[_0x1c0e('0x48')]));if(_0x5adca5['query']['filter']){_0x5b89ac[_0x1c0e('0x51')]=_['merge'](_0x5b89ac[_0x1c0e('0x51')],{'$or':_[_0x1c0e('0x3f')](_0x5b89ac[_0x1c0e('0x4a')],function(_0x208288){var _0x597719={};_0x597719[_0x208288]={'$like':'%'+_0x5adca5[_0x1c0e('0x46')][_0x1c0e('0x54')]+'%'};return _0x597719;})});}_0x5b89ac=_[_0x1c0e('0x52')]({},_0x5b89ac,_0x5adca5[_0x1c0e('0x55')]);return _0x43a68a[_0x1c0e('0xad')](_0x5b89ac);}})[_0x1c0e('0x20')](function(_0x4babcc){if(_0x4babcc){_0x5c4205=_0x4babcc[_0x1c0e('0x4c')];if(!_0x5adca5[_0x1c0e('0x46')][_0x1c0e('0x69')]('nolimit')){_0x5b89ac[_0x1c0e('0x4e')]=qs[_0x1c0e('0x4e')](_0x5adca5[_0x1c0e('0x46')][_0x1c0e('0x4e')]);_0x5b89ac[_0x1c0e('0x31')]=qs[_0x1c0e('0x31')](_0x5adca5[_0x1c0e('0x46')]['offset']);}return _0x43a68a[_0x1c0e('0xad')](_0x5b89ac);}})[_0x1c0e('0x20')](function(_0x1141f5){if(_0x1141f5){return _0x1141f5?{'count':_0x5c4205,'rows':_0x1141f5}:null;}})[_0x1c0e('0x20')](respondWithResult(_0x296767,null))['catch'](handleError(_0x296767,null));};exports[_0x1c0e('0xae')]=function(_0x23cc3e,_0x296879,_0x530f39){var _0x689d25={'raw':![],'where':{}};var _0x131964={};var _0x2087bf={'count':0x0,'rows':[]};return db[_0x1c0e('0x40')][_0x1c0e('0x68')]({'where':{'id':_0x23cc3e[_0x1c0e('0x5b')]['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x296879,null))['then'](function(_0x30cfa7){if(_0x30cfa7){_0x131964[_0x1c0e('0x45')]=_[_0x1c0e('0x47')](db[_0x1c0e('0x8e')][_0x1c0e('0x41')]);_0x131964['query']=_[_0x1c0e('0x47')](_0x23cc3e[_0x1c0e('0x46')]);_0x131964[_0x1c0e('0x48')]=_[_0x1c0e('0x49')](_0x131964[_0x1c0e('0x45')],_0x131964['query']);_0x689d25[_0x1c0e('0x4a')]=_[_0x1c0e('0x49')](_0x131964[_0x1c0e('0x45')],qs[_0x1c0e('0x4b')](_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0x4b')]));_0x689d25['attributes']=_0x689d25['attributes'][_0x1c0e('0x4c')]?_0x689d25[_0x1c0e('0x4a')]:_0x131964[_0x1c0e('0x45')];if(!_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0x69')]('nolimit')){_0x689d25[_0x1c0e('0x4e')]=qs[_0x1c0e('0x4e')](_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0x4e')]);_0x689d25[_0x1c0e('0x31')]=qs[_0x1c0e('0x31')](_0x23cc3e['query'][_0x1c0e('0x31')]);}_0x689d25[_0x1c0e('0x4f')]=qs['sort'](_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0x50')]);_0x689d25['where']=qs[_0x1c0e('0x48')](_[_0x1c0e('0x6a')](_0x23cc3e[_0x1c0e('0x46')],_0x131964[_0x1c0e('0x48')]));_0x689d25[_0x1c0e('0x51')][_0x1c0e('0x67')]=_0x30cfa7['id'];if(_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0x54')]){_0x689d25[_0x1c0e('0x51')]=_['merge'](_0x689d25['where'],{'$or':_['map'](_0x689d25[_0x1c0e('0x4a')],function(_0x24721d){var _0x18b640={};_0x18b640[_0x24721d]={'$like':'%'+_0x23cc3e[_0x1c0e('0x46')]['filter']+'%'};return _0x18b640;})});}_0x689d25=_[_0x1c0e('0x52')]({},_0x689d25,_0x23cc3e[_0x1c0e('0x55')]);return db['OpenchannelInteraction'][_0x1c0e('0x30')]({'where':_0x689d25['where']})[_0x1c0e('0x20')](function(_0x5d255a){_0x2087bf[_0x1c0e('0x30')]=_0x5d255a;if(_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0x56')]){_0x689d25[_0x1c0e('0x57')]=[{'model':db[_0x1c0e('0x73')],'as':_0x1c0e('0xaf'),'required':![]},{'model':db[_0x1c0e('0x9b')],'as':_0x1c0e('0xb0'),'attributes':[_0x1c0e('0x3b'),_0x1c0e('0xb1'),_0x1c0e('0xb2')],'required':![]},{'model':db['Tag'],'as':_0x1c0e('0xb3'),'attributes':['id',_0x1c0e('0x3b'),_0x1c0e('0xb4')],'where':_0x23cc3e[_0x1c0e('0x46')][_0x1c0e('0xb5')]?{'id':_0x23cc3e[_0x1c0e('0x46')]['tag']}:undefined,'required':_0x23cc3e[_0x1c0e('0x46')]['tag']?!![]:![]}];}return db[_0x1c0e('0x8e')][_0x1c0e('0x58')](_0x689d25);})[_0x1c0e('0x20')](function(_0xdcbde4){_0x2087bf[_0x1c0e('0x59')]=_0xdcbde4;return _0x2087bf;});}})[_0x1c0e('0x20')](respondWithFilteredResult(_0x296879,_0x689d25))['catch'](handleError(_0x296879,null));};exports['addAgents']=function(_0x2ad54a,_0x9cacb4,_0x2b9e9d){return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0x2ad54a[_0x1c0e('0x5b')]['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x9cacb4,null))[_0x1c0e('0x20')](function(_0x2f5458){if(_0x2f5458){return _0x2f5458['addAgents'](_0x2ad54a[_0x1c0e('0x5e')][_0x1c0e('0x6d')],_[_0x1c0e('0xb6')](_0x2ad54a['body'],[_0x1c0e('0x6d'),'id'])||{})[_0x1c0e('0x91')](function(_0x482fd6){for(var _0x425ecb=0x0;_0x425ecb<_0x2ad54a[_0x1c0e('0x5e')][_0x1c0e('0x6d')][_0x1c0e('0x4c')];_0x425ecb+=0x1){socket[_0x1c0e('0xb7')](_0x1c0e('0xb8'),{'UserId':Number(_0x2ad54a[_0x1c0e('0x5e')][_0x1c0e('0x6d')][_0x425ecb]),'OpenchannelAccountId':Number(_0x2ad54a[_0x1c0e('0x5b')]['id'])});}return _0x482fd6;});}})['then'](respondWithResult(_0x9cacb4,null))['catch'](handleError(_0x9cacb4,null));};exports[_0x1c0e('0xb9')]=function(_0x5a927d,_0x38dc05,_0x2e7101){return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0x5a927d['params']['id']}})[_0x1c0e('0x20')](handleEntityNotFound(_0x38dc05,null))['then'](function(_0x4b1a1b){if(_0x4b1a1b){return _0x4b1a1b[_0x1c0e('0xb9')](_0x5a927d['query'][_0x1c0e('0x6d')])[_0x1c0e('0x20')](function(){if(_['isArray'](_0x5a927d[_0x1c0e('0x46')][_0x1c0e('0x6d')])){for(var _0x341b8a=0x0;_0x341b8a<_0x5a927d[_0x1c0e('0x46')][_0x1c0e('0x6d')][_0x1c0e('0x4c')];_0x341b8a+=0x1){socket[_0x1c0e('0xb7')](_0x1c0e('0xba'),{'UserId':Number(_0x5a927d['query'][_0x1c0e('0x6d')][_0x341b8a]),'OpenchannelAccountId':Number(_0x5a927d[_0x1c0e('0x5b')]['id'])});}}else{socket['emit'](_0x1c0e('0xba'),{'UserId':Number(_0x5a927d[_0x1c0e('0x46')][_0x1c0e('0x6d')]),'OpenchannelAccountId':Number(_0x5a927d['params']['id'])});}});}})[_0x1c0e('0x20')](respondWithStatusCode(_0x38dc05,null))['catch'](handleError(_0x38dc05,null));};exports['getAgents']=function(_0x25d98d,_0xcaee64,_0x5cea70){var _0x509ce7={};var _0x46d142={};var _0x42bc76;var _0x3597c7;return db[_0x1c0e('0x40')][_0x1c0e('0x68')]({'where':{'id':_0x25d98d[_0x1c0e('0x5b')]['id']}})['then'](handleEntityNotFound(_0xcaee64,null))[_0x1c0e('0x20')](function(_0x26d7e6){if(_0x26d7e6){_0x42bc76=_0x26d7e6;_0x46d142[_0x1c0e('0x45')]=_[_0x1c0e('0x47')](db[_0x1c0e('0x9b')][_0x1c0e('0x41')]);_0x46d142['query']=_[_0x1c0e('0x47')](_0x25d98d[_0x1c0e('0x46')]);_0x46d142[_0x1c0e('0x48')]=_[_0x1c0e('0x49')](_0x46d142['model'],_0x46d142[_0x1c0e('0x46')]);_0x509ce7[_0x1c0e('0x4a')]=_[_0x1c0e('0x49')](_0x46d142[_0x1c0e('0x45')],qs[_0x1c0e('0x4b')](_0x25d98d[_0x1c0e('0x46')][_0x1c0e('0x4b')]));_0x509ce7[_0x1c0e('0x4a')]=_0x509ce7[_0x1c0e('0x4a')][_0x1c0e('0x4c')]?_0x509ce7[_0x1c0e('0x4a')]:_0x46d142[_0x1c0e('0x45')];_0x509ce7[_0x1c0e('0x4f')]=qs['sort'](_0x25d98d[_0x1c0e('0x46')][_0x1c0e('0x50')]);_0x509ce7['where']=qs[_0x1c0e('0x48')](_[_0x1c0e('0x6a')](_0x25d98d[_0x1c0e('0x46')],_0x46d142[_0x1c0e('0x48')]));if(_0x25d98d[_0x1c0e('0x46')][_0x1c0e('0x54')]){_0x509ce7[_0x1c0e('0x51')]=_[_0x1c0e('0x52')](_0x509ce7['where'],{'$or':_['map'](_0x509ce7['attributes'],function(_0x586230){var _0x336652={};_0x336652[_0x586230]={'$like':'%'+_0x25d98d[_0x1c0e('0x46')][_0x1c0e('0x54')]+'%'};return _0x336652;})});}_0x509ce7=_[_0x1c0e('0x52')]({},_0x509ce7,_0x25d98d[_0x1c0e('0x55')]);return _0x42bc76[_0x1c0e('0xbb')](_0x509ce7);}})[_0x1c0e('0x20')](function(_0x26729d){if(_0x26729d){_0x3597c7=_0x26729d[_0x1c0e('0x4c')];if(!_0x25d98d[_0x1c0e('0x46')]['hasOwnProperty'](_0x1c0e('0x4d'))){_0x509ce7[_0x1c0e('0x4e')]=qs['limit'](_0x25d98d[_0x1c0e('0x46')][_0x1c0e('0x4e')]);_0x509ce7[_0x1c0e('0x31')]=qs[_0x1c0e('0x31')](_0x25d98d[_0x1c0e('0x46')][_0x1c0e('0x31')]);}return _0x42bc76[_0x1c0e('0xbb')](_0x509ce7);}})[_0x1c0e('0x20')](function(_0x467a8f){if(_0x467a8f){return _0x467a8f?{'count':_0x3597c7,'rows':_0x467a8f}:null;}})[_0x1c0e('0x20')](respondWithResult(_0xcaee64,null))['catch'](handleError(_0xcaee64,null));};exports[_0x1c0e('0x3c')]=function(_0x5da268,_0x5de2ea,_0x53ad32){var _0x220660,_0x4bbfc1,_0x2deebe;if(_['isNil'](_0x5da268[_0x1c0e('0x5e')][_0x1c0e('0x5e')])||_0x5da268[_0x1c0e('0x5e')]['body']===''){throw new db[(_0x1c0e('0x74'))][(_0x1c0e('0x7c'))](_0x1c0e('0x7d'));}if(_['isNil'](_0x5da268['body']['to'])){}_0x220660=_0x5da268['body']['to'];return db[_0x1c0e('0x40')]['findOne']({'where':{'id':_0x5da268[_0x1c0e('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5de2ea,null))['then'](function(_0x1d6eed){if(_0x1d6eed){return db[_0x1c0e('0x40')][_0x1c0e('0x5c')]({'where':{'id':_0x1d6eed['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x1d6eed[_0x1c0e('0x7e')]]:_0x220660},'limit':0x1,'order':[[_0x1c0e('0x77'),_0x1c0e('0x84')]]}]}]})['then'](handleEntityNotFound(_0x5de2ea,null))['then'](function(_0x4dbd49){if(_0x4dbd49&&_0x4dbd49[_0x1c0e('0x87')]){_0x4bbfc1=_0x4dbd49['get']({'plain':!![]});if(_0x4bbfc1[_0x1c0e('0x87')]&&_0x4bbfc1[_0x1c0e('0x87')]['Contacts'][_0x1c0e('0x4c')]){return _0x4bbfc1[_0x1c0e('0x87')]['Contacts'][0x0];}return db['CmContact'][_0x1c0e('0x5d')](_[_0x1c0e('0x8a')](_0x5da268[_0x1c0e('0x5e')],{'firstName':_0x220660,[_0x4dbd49[_0x1c0e('0x7e')]]:_0x220660,'phone':_0x220660,'ListId':_0x4bbfc1['ListId']}));}})['then'](handleEntityNotFound(_0x5de2ea,null))['then'](function(_0x4e2249){if(_0x4e2249){_0x2deebe=_0x4e2249;return db['OpenchannelInteraction'][_0x1c0e('0x5c')]({'where':{'ContactId':_0x2deebe['id'],'closed':![],'OpenchannelAccountId':_0x4bbfc1['id']}})[_0x1c0e('0x20')](function(_0x219f4e){if(_0x219f4e){return[_0x219f4e,![]];}return db[_0x1c0e('0x8e')][_0x1c0e('0x5d')]({'UserId':_0x5da268[_0x1c0e('0x5f')]['id'],'ContactId':_0x2deebe['id'],'OpenchannelAccountId':_0x4bbfc1['id'],'lastMsgDirection':_0x1c0e('0xbc'),'firstMsgDirection':'out','Messages':[_[_0x1c0e('0x52')](_0x5da268[_0x1c0e('0x5e')],{'read':![],'body':_0x5da268[_0x1c0e('0x5e')][_0x1c0e('0x5e')],'OpenchannelAccountId':_0x4bbfc1['id'],'UserId':_0x5da268[_0x1c0e('0x5f')]['id'],'ContactId':_0x2deebe['id']})]},{'include':[{'model':db[_0x1c0e('0xbd')],'as':'Messages'}]})[_0x1c0e('0x20')](function(_0x26291a){return[_0x26291a,!![]];});});}})[_0x1c0e('0x91')](function(_0x503010,_0x323d14){if(_0x323d14){return _0x503010;}return db[_0x1c0e('0xbd')]['create'](_[_0x1c0e('0x52')](_0x5da268[_0x1c0e('0x5e')],{'read':![],'body':_0x5da268['body'][_0x1c0e('0x5e')],'OpenchannelAccountId':_0x4bbfc1['id'],'OpenchannelInteractionId':_0x503010['id'],'UserId':_0x5da268[_0x1c0e('0x5f')]['id'],'ContactId':_0x2deebe['id']}))['then'](function(_0x341c52){_0x503010[_0x1c0e('0xbe')][_0x1c0e('0xbf')]=[];_0x503010[_0x1c0e('0xbe')][_0x1c0e('0xbf')][_0x1c0e('0x96')](_0x341c52['dataValues']);return _0x503010;});});}})[_0x1c0e('0x20')](respondWithResult(_0x5de2ea,null))['catch'](handleError(_0x5de2ea,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 72b104c..fb506a0 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 _0x9bde=['exports','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x40ff4e,_0x50a4a3){var _0x2ea887=function(_0x3a177b){while(--_0x3a177b){_0x40ff4e['push'](_0x40ff4e['shift']());}};_0x2ea887(++_0x50a4a3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x7d5120,_0x422539){_0x7d5120=_0x7d5120-0x0;var _0x47f5c6=_0x9bde[_0x7d5120];return _0x47f5c6;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xe9bd('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe9bd('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9bd('0x2'),'afterDestroy':_0xe9bd('0x3')};function emitEvent(_0x131f6a){return function(_0x1c1b34,_0x10822d,_0x1a4d14){OpenchannelAccountEvents[_0xe9bd('0x4')](_0x131f6a+':'+_0x1c1b34['id'],_0x1c1b34);OpenchannelAccountEvents['emit'](_0x131f6a,_0x1c1b34);_0x1a4d14(null);};}for(var e in events){if(events[_0xe9bd('0x5')](e)){var event=events[e];OpenchannelAccount[_0xe9bd('0x6')](e,emitEvent(event));}}module[_0xe9bd('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x5ff3=['emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove'];(function(_0x5e2eed,_0xc57b50){var _0x5bbd7c=function(_0x2cb8c3){while(--_0x2cb8c3){_0x5e2eed['push'](_0x5e2eed['shift']());}};_0x5bbd7c(++_0xc57b50);}(_0x5ff3,0x17d));var _0x35ff=function(_0x38b86e,_0x254481){_0x38b86e=_0x38b86e-0x0;var _0x379921=_0x5ff3[_0x38b86e];return _0x379921;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x35ff('0x0'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x35ff('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x35ff('0x2'),'afterDestroy':_0x35ff('0x3')};function emitEvent(_0x3bd66a){return function(_0xd0846d,_0x551514,_0x2fcb74){OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a+':'+_0xd0846d['id'],_0xd0846d);OpenchannelAccountEvents[_0x35ff('0x4')](_0x3bd66a,_0xd0846d);_0x2fcb74(null);};}for(var e in events){if(events[_0x35ff('0x5')](e)){var event=events[e];OpenchannelAccount[_0x35ff('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 135d531..c2e40be 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(_0x11026a,_0x2fa1f2){var _0xaf0cd1=function(_0x54f0dc){while(--_0x54f0dc){_0x11026a['push'](_0x11026a['shift']());}};_0xaf0cd1(++_0x2fa1f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'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(_0x597903,_0x16802e){var _0x488a84=function(_0x2f0170){while(--_0x2f0170){_0x597903['push'](_0x597903['shift']());}};_0x488a84(++_0x16802e);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index b4f512f..2b0bc62 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 _0x153f=['localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x47da2f,_0x2ad213){var _0x2a8826=function(_0x1ba094){while(--_0x1ba094){_0x47da2f['push'](_0x47da2f['shift']());}};_0x2a8826(++_0x2ad213);}(_0x153f,0x15b));var _0xf153=function(_0x150da2,_0x1df19d){_0x150da2=_0x150da2-0x0;var _0x44ac94=_0x153f[_0x150da2];return _0x44ac94;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});config[_0xf153('0xc')]=_['defaults'](config[_0xf153('0xc')],{'host':_0xf153('0xd'),'port':0x18eb});var socket=require(_0xf153('0xe'))(new Redis(config[_0xf153('0xc')]));require(_0xf153('0xf'))[_0xf153('0x10')](socket);function respondWithRpcPromise(_0x44845c,_0x15a18b,_0x4f84b){return new BPromise(function(_0xeaccb0,_0x5c8ae9){return client[_0xf153('0x11')](_0x44845c,_0x4f84b)[_0xf153('0x12')](function(_0x2bea70){logger['info'](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));logger[_0xf153('0x15')](_0xf153('0x16'),_0x15a18b,_0xf153('0x14'),JSON[_0xf153('0x17')](_0x2bea70));if(_0x2bea70[_0xf153('0x18')]){if(_0x2bea70[_0xf153('0x18')][_0xf153('0x19')]===0x1f4){logger['error'](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);return _0x5c8ae9(_0x2bea70[_0xf153('0x18')][_0xf153('0x1a')]);}logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x2bea70[_0xf153('0x18')]['message']);return _0xeaccb0(_0x2bea70[_0xf153('0x18')]['message']);}else{logger[_0xf153('0x1b')](_0xf153('0x13'),_0x15a18b,_0xf153('0x14'));_0xeaccb0(_0x2bea70[_0xf153('0x1c')]['message']);}})[_0xf153('0x1d')](function(_0x19122e){logger[_0xf153('0x18')](_0xf153('0x13'),_0x15a18b,_0x19122e);_0x5c8ae9(_0x19122e);});});} \ No newline at end of file +var _0xd757=['redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2fa0cd,_0x289003){var _0x3a80b0=function(_0x7c0689){while(--_0x7c0689){_0x2fa0cd['push'](_0x2fa0cd['shift']());}};_0x3a80b0(++_0x289003);}(_0xd757,0x1e5));var _0x7d75=function(_0x2163f8,_0x2226bf){_0x2163f8=_0x2163f8-0x0;var _0x1e9b61=_0xd757[_0x2163f8];return _0x1e9b61;};'use strict';var _=require(_0x7d75('0x0'));var util=require(_0x7d75('0x1'));var moment=require(_0x7d75('0x2'));var BPromise=require(_0x7d75('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7d75('0x4'))['db'];var utils=require(_0x7d75('0x5'));var logger=require('../../config/logger')(_0x7d75('0x6'));var config=require(_0x7d75('0x7'));var jayson=require(_0x7d75('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x7d75('0x9')]=_[_0x7d75('0xa')](config[_0x7d75('0x9')],{'host':_0x7d75('0xb'),'port':0x18eb});var socket=require(_0x7d75('0xc'))(new Redis(config[_0x7d75('0x9')]));require(_0x7d75('0xd'))[_0x7d75('0xe')](socket);function respondWithRpcPromise(_0x24e1d8,_0x79266b,_0x1222b3){return new BPromise(function(_0x3043fc,_0x2ac971){return client['request'](_0x24e1d8,_0x1222b3)['then'](function(_0x38cd18){logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x79266b,'request\x20sent');logger[_0x7d75('0x11')](_0x7d75('0x12'),_0x79266b,'request\x20sent',JSON[_0x7d75('0x13')](_0x38cd18));if(_0x38cd18[_0x7d75('0x14')]){if(_0x38cd18[_0x7d75('0x14')][_0x7d75('0x15')]===0x1f4){logger[_0x7d75('0x14')](_0x7d75('0x10'),_0x79266b,_0x38cd18['error'][_0x7d75('0x16')]);return _0x2ac971(_0x38cd18[_0x7d75('0x14')][_0x7d75('0x16')]);}logger[_0x7d75('0x14')](_0x7d75('0x10'),_0x79266b,_0x38cd18[_0x7d75('0x14')]['message']);return _0x3043fc(_0x38cd18[_0x7d75('0x14')]['message']);}else{logger[_0x7d75('0xf')](_0x7d75('0x10'),_0x79266b,_0x7d75('0x17'));_0x3043fc(_0x38cd18[_0x7d75('0x18')][_0x7d75('0x16')]);}})[_0x7d75('0x19')](function(_0x17a61c){logger[_0x7d75('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x79266b,_0x17a61c);_0x2ac971(_0x17a61c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 5781b1a..1bed0ea 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 _0x18e0=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18e0,0xa2));var _0x018e=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x18e0[_0x59ee6f];return _0x4c0979;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x018e('0x0'),'remove',_0x018e('0x1')];function createListener(_0x110f22,_0x356418){return function(_0x4d12a5){_0x356418[_0x018e('0x2')](_0x110f22,_0x4d12a5);};}function removeListener(_0x4e570f,_0x504293){return function(){OpenchannelAccountEvents[_0x018e('0x3')](_0x4e570f,_0x504293);};}exports[_0x018e('0x4')]=function(_0x1b90dd){for(var _0x50450b=0x0,_0x5b6638=events[_0x018e('0x5')];_0x50450b<_0x5b6638;_0x50450b++){var _0x24e838=events[_0x50450b];var _0x5b2267=createListener(_0x018e('0x6')+_0x24e838,_0x1b90dd);OpenchannelAccountEvents['on'](_0x24e838,_0x5b2267);}}; \ No newline at end of file +var _0xc9b7=['register','length','openchannelAccount:','./openchannelAccount.events','save','remove','update','removeListener'];(function(_0x5026ee,_0x50af2c){var _0x516b21=function(_0x8dbab7){while(--_0x8dbab7){_0x5026ee['push'](_0x5026ee['shift']());}};_0x516b21(++_0x50af2c);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x102470,_0x199a01){_0x102470=_0x102470-0x0;var _0x558eaa=_0xc9b7[_0x102470];return _0x558eaa;};'use strict';var OpenchannelAccountEvents=require(_0x7c9b('0x0'));var events=[_0x7c9b('0x1'),_0x7c9b('0x2'),_0x7c9b('0x3')];function createListener(_0x49bfb8,_0x46f817){return function(_0x1ed731){_0x46f817['emit'](_0x49bfb8,_0x1ed731);};}function removeListener(_0x474486,_0x365dd6){return function(){OpenchannelAccountEvents[_0x7c9b('0x4')](_0x474486,_0x365dd6);};}exports[_0x7c9b('0x5')]=function(_0x3d19d7){for(var _0x4714e0=0x0,_0x351532=events[_0x7c9b('0x6')];_0x4714e0<_0x351532;_0x4714e0++){var _0x456555=events[_0x4714e0];var _0x440561=createListener(_0x7c9b('0x7')+_0x456555,_0x3d19d7);OpenchannelAccountEvents['on'](_0x456555,_0x440561);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 3b9542c..4acb341 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 _0x2763=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2ac87c,_0x1b07b4){var _0x41a0b5=function(_0x390729){while(--_0x390729){_0x2ac87c['push'](_0x2ac87c['shift']());}};_0x41a0b5(++_0x1b07b4);}(_0x2763,0x16b));var _0x3276=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2763[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x3276('0x0'));var path=require(_0x3276('0x1'));var timeout=require(_0x3276('0x2'));var express=require(_0x3276('0x3'));var router=express[_0x3276('0x4')]();var fs_extra=require(_0x3276('0x5'));var auth=require(_0x3276('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3276('0x7'));var controller=require(_0x3276('0x8'));router[_0x3276('0x9')]('/',auth[_0x3276('0xa')](),controller[_0x3276('0xb')]);router[_0x3276('0x9')](_0x3276('0xc'),auth[_0x3276('0xa')](),controller[_0x3276('0xd')]);router[_0x3276('0xe')]('/',auth[_0x3276('0xa')](),controller[_0x3276('0xf')]);router[_0x3276('0x10')](_0x3276('0xc'),auth[_0x3276('0xa')](),controller[_0x3276('0x11')]);router['delete']('/:id',auth[_0x3276('0xa')](),controller[_0x3276('0x12')]);module[_0x3276('0x13')]=router; \ No newline at end of file +var _0xf91a=['../../components/interaction/service','./openchannelApplication.controller','get','isAuthenticated','index','/:id','show','create','put','update','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x377e07,_0xb525d7){var _0x1faf8=function(_0x2aa9e4){while(--_0x2aa9e4){_0x377e07['push'](_0x377e07['shift']());}};_0x1faf8(++_0xb525d7);}(_0xf91a,0x11a));var _0xaf91=function(_0x17e43e,_0x1bd2bd){_0x17e43e=_0x17e43e-0x0;var _0x29b542=_0xf91a[_0x17e43e];return _0x29b542;};'use strict';var multer=require('multer');var util=require(_0xaf91('0x0'));var path=require(_0xaf91('0x1'));var timeout=require(_0xaf91('0x2'));var express=require(_0xaf91('0x3'));var router=express['Router']();var fs_extra=require(_0xaf91('0x4'));var auth=require(_0xaf91('0x5'));var interaction=require(_0xaf91('0x6'));var config=require('../../config/environment');var controller=require(_0xaf91('0x7'));router[_0xaf91('0x8')]('/',auth[_0xaf91('0x9')](),controller[_0xaf91('0xa')]);router[_0xaf91('0x8')](_0xaf91('0xb'),auth[_0xaf91('0x9')](),controller[_0xaf91('0xc')]);router['post']('/',auth[_0xaf91('0x9')](),controller[_0xaf91('0xd')]);router[_0xaf91('0xe')](_0xaf91('0xb'),auth[_0xaf91('0x9')](),controller[_0xaf91('0xf')]);router['delete'](_0xaf91('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 168ad91..8c3e90b 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 _0xf377=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xf377,0xf2));var _0x7f37=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xf377[_0x5416db];return _0x243e35;};'use strict';var Sequelize=require(_0x7f37('0x0'));module[_0x7f37('0x1')]={'priority':{'type':Sequelize[_0x7f37('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7f37('0x3')],'allowNull':![],'defaultValue':_0x7f37('0x4')},'appdata':{'type':Sequelize[_0x7f37('0x5')]()},'description':{'type':Sequelize[_0x7f37('0x3')]},'interval':{'type':Sequelize[_0x7f37('0x3')],'defaultValue':_0x7f37('0x6')}}; \ No newline at end of file +var _0x9481=['sequelize','exports','noop','TEXT','STRING','*,*,*,*'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0x9481,0xd8));var _0x1948=function(_0x4ed80d,_0x3abd38){_0x4ed80d=_0x4ed80d-0x0;var _0x3d2ddf=_0x9481[_0x4ed80d];return _0x3d2ddf;};'use strict';var Sequelize=require(_0x1948('0x0'));module[_0x1948('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1948('0x2')},'appdata':{'type':Sequelize[_0x1948('0x3')]()},'description':{'type':Sequelize[_0x1948('0x4')]},'interval':{'type':Sequelize[_0x1948('0x4')],'defaultValue':_0x1948('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 533624b..9753a87 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 _0x0194=['fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','sendStatus','error','stack','name','map','rawAttributes','fieldName','type','key','model','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','OpenchannelApplication','includeAll','include','findAll','rows','catch','params','keys','find','create','body','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox'];(function(_0x4cc8a9,_0x294eaf){var _0x3213c4=function(_0x4c19d5){while(--_0x4c19d5){_0x4cc8a9['push'](_0x4cc8a9['shift']());}};_0x3213c4(++_0x294eaf);}(_0x0194,0x118));var _0x4019=function(_0x103ead,_0x247665){_0x103ead=_0x103ead-0x0;var _0x5dbce0=_0x0194[_0x103ead];return _0x5dbce0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4019('0x0'));var zipdir=require(_0x4019('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4019('0x2'));var moment=require(_0x4019('0x3'));var BPromise=require(_0x4019('0x4'));var Mustache=require('mustache');var util=require(_0x4019('0x5'));var path=require(_0x4019('0x6'));var sox=require(_0x4019('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4019('0x8'));var _=require('lodash');var squel=require(_0x4019('0x9'));var crypto=require(_0x4019('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x4019('0xb'));var toCsv=require('to-csv');var querystring=require(_0x4019('0xc'));var Papa=require(_0x4019('0xd'));var Redis=require(_0x4019('0xe'));var authService=require(_0x4019('0xf'));var qs=require(_0x4019('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4019('0x11'));var logger=require(_0x4019('0x12'))(_0x4019('0x13'));var utils=require(_0x4019('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4019('0x15'));var db=require(_0x4019('0x16'))['db'];function respondWithStatusCode(_0xa5320,_0x58a9fa){_0x58a9fa=_0x58a9fa||0xcc;return function(_0x1cf063){if(_0x1cf063){return _0xa5320['sendStatus'](_0x58a9fa);}return _0xa5320['status'](_0x58a9fa)[_0x4019('0x17')]();};}function respondWithResult(_0x549e39,_0xbc9fb1){_0xbc9fb1=_0xbc9fb1||0xc8;return function(_0x379edc){if(_0x379edc){return _0x549e39['status'](_0xbc9fb1)[_0x4019('0x18')](_0x379edc);}};}function respondWithFilteredResult(_0x4cad18,_0x42f324){return function(_0x10be7c){if(_0x10be7c){var _0xda5113=typeof _0x42f324[_0x4019('0x19')]===_0x4019('0x1a')&&typeof _0x42f324[_0x4019('0x1b')]===_0x4019('0x1a');var _0x4844e8=_0x10be7c[_0x4019('0x1c')];var _0x3e6be4=_0xda5113?0x0:_0x42f324['offset'];var _0x4e31d3=_0xda5113?_0x10be7c[_0x4019('0x1c')]:_0x42f324[_0x4019('0x19')]+_0x42f324[_0x4019('0x1b')];var _0x4c766d;if(_0x4e31d3>=_0x4844e8){_0x4e31d3=_0x4844e8;_0x4c766d=0xc8;}else{_0x4c766d=0xce;}_0x4cad18['status'](_0x4c766d);return _0x4cad18[_0x4019('0x1d')]('Content-Range',_0x3e6be4+'-'+_0x4e31d3+'/'+_0x4844e8)[_0x4019('0x18')](_0x10be7c);}return null;};}function patchUpdates(_0x4667b1){return function(_0x54e74e){try{jsonpatch[_0x4019('0x1e')](_0x54e74e,_0x4667b1,!![]);}catch(_0x4e8979){return BPromise[_0x4019('0x1f')](_0x4e8979);}return _0x54e74e[_0x4019('0x20')]();};}function saveUpdates(_0x34a88b,_0x37810b){return function(_0x2dee4f){if(_0x2dee4f){return _0x2dee4f[_0x4019('0x21')](_0x34a88b)[_0x4019('0x22')](function(_0x21bbe6){return _0x21bbe6;});}return null;};}function removeEntity(_0x59db67,_0x43283a){return function(_0x46a6bb){if(_0x46a6bb){return _0x46a6bb[_0x4019('0x23')]()[_0x4019('0x22')](function(){_0x59db67[_0x4019('0x24')](0xcc)[_0x4019('0x17')]();});}};}function handleEntityNotFound(_0x5dd323,_0x5de046){return function(_0x4c8799){if(!_0x4c8799){_0x5dd323[_0x4019('0x25')](0x194);}return _0x4c8799;};}function handleError(_0xaec018,_0xe6689){_0xe6689=_0xe6689||0x1f4;return function(_0x4d4b81){logger[_0x4019('0x26')](_0x4d4b81[_0x4019('0x27')]);if(_0x4d4b81[_0x4019('0x28')]){delete _0x4d4b81[_0x4019('0x28')];}_0xaec018[_0x4019('0x24')](_0xe6689)['send'](_0x4d4b81);};}exports['index']=function(_0x422955,_0x505018){var _0x2c98ce={},_0x49b9eb={},_0x4b3efd={'count':0x0,'rows':[]};var _0x36360c=_[_0x4019('0x29')](db['OpenchannelApplication'][_0x4019('0x2a')],function(_0xc54cdf){return{'name':_0xc54cdf[_0x4019('0x2b')],'type':_0xc54cdf[_0x4019('0x2c')][_0x4019('0x2d')]};});_0x49b9eb[_0x4019('0x2e')]=_[_0x4019('0x29')](_0x36360c,_0x4019('0x28'));_0x49b9eb['query']=_['keys'](_0x422955['query']);_0x49b9eb[_0x4019('0x2f')]=_[_0x4019('0x30')](_0x49b9eb[_0x4019('0x2e')],_0x49b9eb['query']);_0x2c98ce[_0x4019('0x31')]=_['intersection'](_0x49b9eb['model'],qs[_0x4019('0x32')](_0x422955[_0x4019('0x33')][_0x4019('0x32')]));_0x2c98ce[_0x4019('0x31')]=_0x2c98ce[_0x4019('0x31')][_0x4019('0x34')]?_0x2c98ce[_0x4019('0x31')]:_0x49b9eb[_0x4019('0x2e')];if(!_0x422955[_0x4019('0x33')][_0x4019('0x35')](_0x4019('0x36'))){_0x2c98ce['limit']=qs[_0x4019('0x1b')](_0x422955[_0x4019('0x33')][_0x4019('0x1b')]);_0x2c98ce['offset']=qs[_0x4019('0x19')](_0x422955[_0x4019('0x33')]['offset']);}_0x2c98ce['order']=qs['sort'](_0x422955[_0x4019('0x33')][_0x4019('0x37')]);_0x2c98ce[_0x4019('0x38')]=qs[_0x4019('0x2f')](_['pick'](_0x422955[_0x4019('0x33')],_0x49b9eb[_0x4019('0x2f')]),_0x36360c);if(_0x422955['query'][_0x4019('0x39')]){_0x2c98ce[_0x4019('0x38')]=_['merge'](_0x2c98ce['where'],{'$or':_[_0x4019('0x29')](_0x36360c,function(_0x103382){if(_0x103382[_0x4019('0x2c')]!==_0x4019('0x3a')){var _0x57ee30={};_0x57ee30[_0x103382[_0x4019('0x28')]]={'$like':'%'+_0x422955[_0x4019('0x33')][_0x4019('0x39')]+'%'};return _0x57ee30;}})});}_0x2c98ce=_[_0x4019('0x3b')]({},_0x2c98ce,_0x422955[_0x4019('0x3c')]);var _0x217235={'where':_0x2c98ce[_0x4019('0x38')]};return db[_0x4019('0x3d')][_0x4019('0x1c')](_0x217235)[_0x4019('0x22')](function(_0x4b5bb1){_0x4b3efd[_0x4019('0x1c')]=_0x4b5bb1;if(_0x422955[_0x4019('0x33')][_0x4019('0x3e')]){_0x2c98ce[_0x4019('0x3f')]=[{'all':!![]}];}return db[_0x4019('0x3d')][_0x4019('0x40')](_0x2c98ce);})[_0x4019('0x22')](function(_0x39332a){_0x4b3efd[_0x4019('0x41')]=_0x39332a;return _0x4b3efd;})[_0x4019('0x22')](respondWithFilteredResult(_0x505018,_0x2c98ce))[_0x4019('0x42')](handleError(_0x505018,null));};exports['show']=function(_0xa50913,_0x297e0a){var _0x24fa6a={'raw':!![],'where':{'id':_0xa50913[_0x4019('0x43')]['id']}},_0x2293eb={};_0x2293eb['model']=_['keys'](db['OpenchannelApplication'][_0x4019('0x2a')]);_0x2293eb[_0x4019('0x33')]=_[_0x4019('0x44')](_0xa50913[_0x4019('0x33')]);_0x2293eb[_0x4019('0x2f')]=_['intersection'](_0x2293eb['model'],_0x2293eb[_0x4019('0x33')]);_0x24fa6a[_0x4019('0x31')]=_['intersection'](_0x2293eb[_0x4019('0x2e')],qs[_0x4019('0x32')](_0xa50913['query'][_0x4019('0x32')]));_0x24fa6a[_0x4019('0x31')]=_0x24fa6a[_0x4019('0x31')][_0x4019('0x34')]?_0x24fa6a[_0x4019('0x31')]:_0x2293eb['model'];if(_0xa50913[_0x4019('0x33')][_0x4019('0x3e')]){_0x24fa6a['include']=[{'all':!![]}];}_0x24fa6a=_[_0x4019('0x3b')]({},_0x24fa6a,_0xa50913[_0x4019('0x3c')]);return db[_0x4019('0x3d')][_0x4019('0x45')](_0x24fa6a)[_0x4019('0x22')](handleEntityNotFound(_0x297e0a,null))['then'](respondWithResult(_0x297e0a,null))[_0x4019('0x42')](handleError(_0x297e0a,null));};exports[_0x4019('0x46')]=function(_0x43f031,_0x579502){return db['OpenchannelApplication'][_0x4019('0x46')](_0x43f031[_0x4019('0x47')],{})[_0x4019('0x22')](respondWithResult(_0x579502,0xc9))[_0x4019('0x42')](handleError(_0x579502,null));};exports['update']=function(_0x3f896b,_0x162090){if(_0x3f896b[_0x4019('0x47')]['id']){delete _0x3f896b[_0x4019('0x47')]['id'];}return db[_0x4019('0x3d')][_0x4019('0x45')]({'where':{'id':_0x3f896b[_0x4019('0x43')]['id']}})[_0x4019('0x22')](handleEntityNotFound(_0x162090,null))['then'](saveUpdates(_0x3f896b['body'],null))[_0x4019('0x22')](respondWithResult(_0x162090,null))[_0x4019('0x42')](handleError(_0x162090,null));};exports[_0x4019('0x23')]=function(_0x44ae2f,_0x4784e3){return db['OpenchannelApplication']['find']({'where':{'id':_0x44ae2f['params']['id']}})[_0x4019('0x22')](handleEntityNotFound(_0x4784e3,null))[_0x4019('0x22')](removeEntity(_0x4784e3,null))['catch'](handleError(_0x4784e3,null));}; \ No newline at end of file +var _0x06dc=['zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','body','eml-format'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x06dc,0x95));var _0xc06d=function(_0x30780e,_0x537b34){_0x30780e=_0x30780e-0x0;var _0x5b9129=_0x06dc[_0x30780e];return _0x5b9129;};'use strict';var emlformat=require(_0xc06d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc06d('0x1'));var jsonpatch=require(_0xc06d('0x2'));var rp=require(_0xc06d('0x3'));var moment=require(_0xc06d('0x4'));var BPromise=require(_0xc06d('0x5'));var Mustache=require('mustache');var util=require(_0xc06d('0x6'));var path=require('path');var sox=require(_0xc06d('0x7'));var csv=require(_0xc06d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc06d('0x9'));var crypto=require('crypto');var jsforce=require(_0xc06d('0xa'));var deskjs=require(_0xc06d('0xb'));var toCsv=require('to-csv');var querystring=require(_0xc06d('0xc'));var Papa=require(_0xc06d('0xd'));var Redis=require(_0xc06d('0xe'));var authService=require(_0xc06d('0xf'));var qs=require(_0xc06d('0x10'));var as=require(_0xc06d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc06d('0x12'))('api');var utils=require(_0xc06d('0x13'));var config=require(_0xc06d('0x14'));var licenseUtil=require(_0xc06d('0x15'));var db=require(_0xc06d('0x16'))['db'];function respondWithStatusCode(_0x4390ba,_0x5d3939){_0x5d3939=_0x5d3939||0xcc;return function(_0x4f28cb){if(_0x4f28cb){return _0x4390ba[_0xc06d('0x17')](_0x5d3939);}return _0x4390ba[_0xc06d('0x18')](_0x5d3939)[_0xc06d('0x19')]();};}function respondWithResult(_0x3b792d,_0x3ec88d){_0x3ec88d=_0x3ec88d||0xc8;return function(_0x5096b0){if(_0x5096b0){return _0x3b792d[_0xc06d('0x18')](_0x3ec88d)[_0xc06d('0x1a')](_0x5096b0);}};}function respondWithFilteredResult(_0x58bf4f,_0x2aa5bd){return function(_0xf97c33){if(_0xf97c33){var _0x41c707=typeof _0x2aa5bd['offset']===_0xc06d('0x1b')&&typeof _0x2aa5bd[_0xc06d('0x1c')]==='undefined';var _0x1ca86e=_0xf97c33[_0xc06d('0x1d')];var _0x3a8f09=_0x41c707?0x0:_0x2aa5bd[_0xc06d('0x1e')];var _0x427f88=_0x41c707?_0xf97c33[_0xc06d('0x1d')]:_0x2aa5bd[_0xc06d('0x1e')]+_0x2aa5bd[_0xc06d('0x1c')];var _0x1bcca5;if(_0x427f88>=_0x1ca86e){_0x427f88=_0x1ca86e;_0x1bcca5=0xc8;}else{_0x1bcca5=0xce;}_0x58bf4f['status'](_0x1bcca5);return _0x58bf4f[_0xc06d('0x1f')](_0xc06d('0x20'),_0x3a8f09+'-'+_0x427f88+'/'+_0x1ca86e)[_0xc06d('0x1a')](_0xf97c33);}return null;};}function patchUpdates(_0x529c26){return function(_0x3b801b){try{jsonpatch['apply'](_0x3b801b,_0x529c26,!![]);}catch(_0x253180){return BPromise[_0xc06d('0x21')](_0x253180);}return _0x3b801b[_0xc06d('0x22')]();};}function saveUpdates(_0x96e318,_0x235513){return function(_0xc12711){if(_0xc12711){return _0xc12711[_0xc06d('0x23')](_0x96e318)['then'](function(_0xbc975f){return _0xbc975f;});}return null;};}function removeEntity(_0x2f68cd,_0x3d6b46){return function(_0x3cb41d){if(_0x3cb41d){return _0x3cb41d[_0xc06d('0x24')]()[_0xc06d('0x25')](function(){_0x2f68cd[_0xc06d('0x18')](0xcc)[_0xc06d('0x19')]();});}};}function handleEntityNotFound(_0x243418,_0x5c1239){return function(_0x5c447b){if(!_0x5c447b){_0x243418['sendStatus'](0x194);}return _0x5c447b;};}function handleError(_0x4cde72,_0x4a1f58){_0x4a1f58=_0x4a1f58||0x1f4;return function(_0xdccc57){logger[_0xc06d('0x26')](_0xdccc57[_0xc06d('0x27')]);if(_0xdccc57[_0xc06d('0x28')]){delete _0xdccc57[_0xc06d('0x28')];}_0x4cde72[_0xc06d('0x18')](_0x4a1f58)[_0xc06d('0x29')](_0xdccc57);};}exports[_0xc06d('0x2a')]=function(_0x4e1b97,_0x57360f){var _0x3c9c9c={},_0x28c5d2={},_0x553ddf={'count':0x0,'rows':[]};var _0x53466b=_['map'](db[_0xc06d('0x2b')][_0xc06d('0x2c')],function(_0x557eaa){return{'name':_0x557eaa[_0xc06d('0x2d')],'type':_0x557eaa[_0xc06d('0x2e')][_0xc06d('0x2f')]};});_0x28c5d2[_0xc06d('0x30')]=_[_0xc06d('0x31')](_0x53466b,_0xc06d('0x28'));_0x28c5d2[_0xc06d('0x32')]=_[_0xc06d('0x33')](_0x4e1b97[_0xc06d('0x32')]);_0x28c5d2['filters']=_[_0xc06d('0x34')](_0x28c5d2[_0xc06d('0x30')],_0x28c5d2[_0xc06d('0x32')]);_0x3c9c9c[_0xc06d('0x35')]=_[_0xc06d('0x34')](_0x28c5d2[_0xc06d('0x30')],qs[_0xc06d('0x36')](_0x4e1b97[_0xc06d('0x32')]['fields']));_0x3c9c9c[_0xc06d('0x35')]=_0x3c9c9c['attributes'][_0xc06d('0x37')]?_0x3c9c9c[_0xc06d('0x35')]:_0x28c5d2['model'];if(!_0x4e1b97[_0xc06d('0x32')][_0xc06d('0x38')](_0xc06d('0x39'))){_0x3c9c9c['limit']=qs[_0xc06d('0x1c')](_0x4e1b97['query']['limit']);_0x3c9c9c['offset']=qs['offset'](_0x4e1b97['query'][_0xc06d('0x1e')]);}_0x3c9c9c[_0xc06d('0x3a')]=qs[_0xc06d('0x3b')](_0x4e1b97[_0xc06d('0x32')]['sort']);_0x3c9c9c[_0xc06d('0x3c')]=qs[_0xc06d('0x3d')](_[_0xc06d('0x3e')](_0x4e1b97[_0xc06d('0x32')],_0x28c5d2['filters']),_0x53466b);if(_0x4e1b97['query'][_0xc06d('0x3f')]){_0x3c9c9c['where']=_[_0xc06d('0x40')](_0x3c9c9c[_0xc06d('0x3c')],{'$or':_[_0xc06d('0x31')](_0x53466b,function(_0x2f62b9){if(_0x2f62b9[_0xc06d('0x2e')]!==_0xc06d('0x41')){var _0x579509={};_0x579509[_0x2f62b9['name']]={'$like':'%'+_0x4e1b97[_0xc06d('0x32')][_0xc06d('0x3f')]+'%'};return _0x579509;}})});}_0x3c9c9c=_[_0xc06d('0x40')]({},_0x3c9c9c,_0x4e1b97[_0xc06d('0x42')]);var _0x13c773={'where':_0x3c9c9c[_0xc06d('0x3c')]};return db[_0xc06d('0x2b')]['count'](_0x13c773)[_0xc06d('0x25')](function(_0x36292d){_0x553ddf[_0xc06d('0x1d')]=_0x36292d;if(_0x4e1b97[_0xc06d('0x32')]['includeAll']){_0x3c9c9c[_0xc06d('0x43')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xc06d('0x44')](_0x3c9c9c);})[_0xc06d('0x25')](function(_0x604f1c){_0x553ddf['rows']=_0x604f1c;return _0x553ddf;})[_0xc06d('0x25')](respondWithFilteredResult(_0x57360f,_0x3c9c9c))[_0xc06d('0x45')](handleError(_0x57360f,null));};exports['show']=function(_0x20740a,_0x593376){var _0x2c97e4={'raw':!![],'where':{'id':_0x20740a[_0xc06d('0x46')]['id']}},_0x528cc8={};_0x528cc8[_0xc06d('0x30')]=_[_0xc06d('0x33')](db['OpenchannelApplication']['rawAttributes']);_0x528cc8['query']=_[_0xc06d('0x33')](_0x20740a[_0xc06d('0x32')]);_0x528cc8[_0xc06d('0x3d')]=_['intersection'](_0x528cc8[_0xc06d('0x30')],_0x528cc8['query']);_0x2c97e4[_0xc06d('0x35')]=_[_0xc06d('0x34')](_0x528cc8[_0xc06d('0x30')],qs['fields'](_0x20740a[_0xc06d('0x32')][_0xc06d('0x36')]));_0x2c97e4[_0xc06d('0x35')]=_0x2c97e4[_0xc06d('0x35')][_0xc06d('0x37')]?_0x2c97e4[_0xc06d('0x35')]:_0x528cc8[_0xc06d('0x30')];if(_0x20740a['query'][_0xc06d('0x47')]){_0x2c97e4[_0xc06d('0x43')]=[{'all':!![]}];}_0x2c97e4=_[_0xc06d('0x40')]({},_0x2c97e4,_0x20740a[_0xc06d('0x42')]);return db[_0xc06d('0x2b')][_0xc06d('0x48')](_0x2c97e4)[_0xc06d('0x25')](handleEntityNotFound(_0x593376,null))['then'](respondWithResult(_0x593376,null))['catch'](handleError(_0x593376,null));};exports[_0xc06d('0x49')]=function(_0x2832bb,_0x233b5e){return db['OpenchannelApplication'][_0xc06d('0x49')](_0x2832bb['body'],{})[_0xc06d('0x25')](respondWithResult(_0x233b5e,0xc9))['catch'](handleError(_0x233b5e,null));};exports[_0xc06d('0x23')]=function(_0xa55a03,_0x40f662){if(_0xa55a03[_0xc06d('0x4a')]['id']){delete _0xa55a03['body']['id'];}return db[_0xc06d('0x2b')]['find']({'where':{'id':_0xa55a03[_0xc06d('0x46')]['id']}})[_0xc06d('0x25')](handleEntityNotFound(_0x40f662,null))[_0xc06d('0x25')](saveUpdates(_0xa55a03[_0xc06d('0x4a')],null))[_0xc06d('0x25')](respondWithResult(_0x40f662,null))['catch'](handleError(_0x40f662,null));};exports['destroy']=function(_0x30f7aa,_0x43229c){return db['OpenchannelApplication'][_0xc06d('0x48')]({'where':{'id':_0x30f7aa[_0xc06d('0x46')]['id']}})[_0xc06d('0x25')](handleEntityNotFound(_0x43229c,null))[_0xc06d('0x25')](removeEntity(_0x43229c,null))[_0xc06d('0x45')](handleError(_0x43229c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 075d893..257797a 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 _0x00fe=['util','api','moment','request-promise','path','../../config/environment','./openchannelApplication.attributes','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x4bf5ed,_0x56ac49){var _0x11d562=function(_0x1b67fc){while(--_0x1b67fc){_0x4bf5ed['push'](_0x4bf5ed['shift']());}};_0x11d562(++_0x56ac49);}(_0x00fe,0xef));var _0xe00f=function(_0x337a10,_0x5191c7){_0x337a10=_0x337a10-0x0;var _0x575f98=_0x00fe[_0x337a10];return _0x575f98;};'use strict';var _=require(_0xe00f('0x0'));var util=require(_0xe00f('0x1'));var logger=require('../../config/logger')(_0xe00f('0x2'));var moment=require(_0xe00f('0x3'));var BPromise=require('bluebird');var rp=require(_0xe00f('0x4'));var fs=require('fs');var path=require(_0xe00f('0x5'));var rimraf=require('rimraf');var config=require(_0xe00f('0x6'));var attributes=require(_0xe00f('0x7'));module['exports']=function(_0x300ca9,_0x1f064e){return _0x300ca9[_0xe00f('0x8')](_0xe00f('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe00f('0xa'),'collate':_0xe00f('0xb')});}; \ No newline at end of file +var _0xd426=['rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x253b45,_0x32b9da){var _0x3e1947=function(_0x442fed){while(--_0x442fed){_0x253b45['push'](_0x253b45['shift']());}};_0x3e1947(++_0x32b9da);}(_0xd426,0x8e));var _0x6d42=function(_0x1c2ed5,_0x58e314){_0x1c2ed5=_0x1c2ed5-0x0;var _0x29f281=_0xd426[_0x1c2ed5];return _0x29f281;};'use strict';var _=require(_0x6d42('0x0'));var util=require(_0x6d42('0x1'));var logger=require(_0x6d42('0x2'))(_0x6d42('0x3'));var moment=require(_0x6d42('0x4'));var BPromise=require(_0x6d42('0x5'));var rp=require(_0x6d42('0x6'));var fs=require('fs');var path=require(_0x6d42('0x7'));var rimraf=require(_0x6d42('0x8'));var config=require(_0x6d42('0x9'));var attributes=require(_0x6d42('0xa'));module[_0x6d42('0xb')]=function(_0xdc3f35,_0x287045){return _0xdc3f35[_0x6d42('0xc')](_0x6d42('0xd'),attributes,{'tableName':_0x6d42('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index ab3024c..50685b3 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 _0x0640=['body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','update'];(function(_0x11e942,_0x17c666){var _0xde6892=function(_0x2a09a9){while(--_0x2a09a9){_0x11e942['push'](_0x11e942['shift']());}};_0xde6892(++_0x17c666);}(_0x0640,0x18c));var _0x0064=function(_0x3f87a9,_0x25003d){_0x3f87a9=_0x3f87a9-0x0;var _0x2e4625=_0x0640[_0x3f87a9];return _0x2e4625;};'use strict';var _=require(_0x0064('0x0'));var util=require(_0x0064('0x1'));var moment=require(_0x0064('0x2'));var BPromise=require(_0x0064('0x3'));var rs=require(_0x0064('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0064('0x5'));var logger=require(_0x0064('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0064('0x7'));var client=jayson[_0x0064('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55b9c7,_0x5294be,_0xd66f7e){return new BPromise(function(_0xdd186a,_0xa5724){return client[_0x0064('0x9')](_0x55b9c7,_0xd66f7e)[_0x0064('0xa')](function(_0x37f91e){logger[_0x0064('0xb')](_0x0064('0xc'),_0x5294be,_0x0064('0xd'));logger[_0x0064('0xe')](_0x0064('0xf'),_0x5294be,_0x0064('0xd'),JSON[_0x0064('0x10')](_0x37f91e));if(_0x37f91e['error']){if(_0x37f91e[_0x0064('0x11')][_0x0064('0x12')]===0x1f4){logger[_0x0064('0x11')](_0x0064('0xc'),_0x5294be,_0x37f91e['error'][_0x0064('0x13')]);return _0xa5724(_0x37f91e['error']['message']);}logger[_0x0064('0x11')]('OpenchannelApplication,\x20%s,\x20%s',_0x5294be,_0x37f91e[_0x0064('0x11')][_0x0064('0x13')]);return _0xdd186a(_0x37f91e[_0x0064('0x11')][_0x0064('0x13')]);}else{logger[_0x0064('0xb')](_0x0064('0xc'),_0x5294be,_0x0064('0xd'));_0xdd186a(_0x37f91e[_0x0064('0x14')]['message']);}})[_0x0064('0x15')](function(_0x2e1693){logger[_0x0064('0x11')](_0x0064('0xc'),_0x5294be,_0x2e1693);_0xa5724(_0x2e1693);});});}exports[_0x0064('0x16')]=function(_0x1415d9){var _0xfe3cb=this;return new Promise(function(_0x437954,_0x2e2858){return db['OpenchannelApplication'][_0x0064('0x17')](_0x1415d9[_0x0064('0x18')],{'raw':_0x1415d9['options']?_0x1415d9[_0x0064('0x19')][_0x0064('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1415d9[_0x0064('0x19')]?_0x1415d9[_0x0064('0x19')][_0x0064('0x1b')]||null:null,'attributes':_0x1415d9['options']?_0x1415d9[_0x0064('0x19')][_0x0064('0x1c')]||null:null,'limit':_0x1415d9[_0x0064('0x19')]?_0x1415d9[_0x0064('0x19')][_0x0064('0x1d')]||null:null})[_0x0064('0xa')](function(_0x54182e){logger[_0x0064('0xb')]('UpdateOpenchannelApplication',_0x1415d9);logger['debug']('UpdateOpenchannelApplication',_0x1415d9,JSON[_0x0064('0x10')](_0x54182e));_0x437954(_0x54182e);})[_0x0064('0x15')](function(_0x957d81){logger['error'](_0x0064('0x16'),_0x957d81[_0x0064('0x13')],_0x1415d9);_0x2e2858(_0xfe3cb['error'](0x1f4,_0x957d81[_0x0064('0x13')]));});});}; \ No newline at end of file +var _0xa154=['then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','update','body','raw','options','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x20bcb0,_0xb5cbdd){var _0xdc4f5b=function(_0x51ec81){while(--_0x51ec81){_0x20bcb0['push'](_0x20bcb0['shift']());}};_0xdc4f5b(++_0xb5cbdd);}(_0xa154,0x18b));var _0x4a15=function(_0x230457,_0x17efa8){_0x230457=_0x230457-0x0;var _0x3118d8=_0xa154[_0x230457];return _0x3118d8;};'use strict';var _=require(_0x4a15('0x0'));var util=require(_0x4a15('0x1'));var moment=require(_0x4a15('0x2'));var BPromise=require(_0x4a15('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a15('0x4'));var db=require(_0x4a15('0x5'))['db'];var utils=require(_0x4a15('0x6'));var logger=require(_0x4a15('0x7'))('rpc');var config=require(_0x4a15('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4a15('0x9')][_0x4a15('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6fe6,_0xf3e6d4,_0x1eee55){return new BPromise(function(_0x4e04ca,_0x439f80){return client['request'](_0x4a6fe6,_0x1eee55)[_0x4a15('0xb')](function(_0x3f1ba5){logger[_0x4a15('0xc')](_0x4a15('0xd'),_0xf3e6d4,_0x4a15('0xe'));logger[_0x4a15('0xf')](_0x4a15('0x10'),_0xf3e6d4,_0x4a15('0xe'),JSON[_0x4a15('0x11')](_0x3f1ba5));if(_0x3f1ba5[_0x4a15('0x12')]){if(_0x3f1ba5[_0x4a15('0x12')]['code']===0x1f4){logger[_0x4a15('0x12')](_0x4a15('0xd'),_0xf3e6d4,_0x3f1ba5['error']['message']);return _0x439f80(_0x3f1ba5['error'][_0x4a15('0x13')]);}logger[_0x4a15('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0xf3e6d4,_0x3f1ba5['error'][_0x4a15('0x13')]);return _0x4e04ca(_0x3f1ba5[_0x4a15('0x12')][_0x4a15('0x13')]);}else{logger[_0x4a15('0xc')](_0x4a15('0xd'),_0xf3e6d4,_0x4a15('0xe'));_0x4e04ca(_0x3f1ba5[_0x4a15('0x14')][_0x4a15('0x13')]);}})[_0x4a15('0x15')](function(_0xac7fe6){logger[_0x4a15('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0xf3e6d4,_0xac7fe6);_0x439f80(_0xac7fe6);});});}exports[_0x4a15('0x16')]=function(_0x4d1ca5){var _0xc88ee1=this;return new Promise(function(_0x36501d,_0x482966){return db['OpenchannelApplication'][_0x4a15('0x17')](_0x4d1ca5[_0x4a15('0x18')],{'raw':_0x4d1ca5['options']?_0x4d1ca5['options'][_0x4a15('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d1ca5['options']?_0x4d1ca5[_0x4a15('0x1a')]['where']||null:null,'attributes':_0x4d1ca5[_0x4a15('0x1a')]?_0x4d1ca5['options'][_0x4a15('0x1b')]||null:null,'limit':_0x4d1ca5[_0x4a15('0x1a')]?_0x4d1ca5[_0x4a15('0x1a')][_0x4a15('0x1c')]||null:null})[_0x4a15('0xb')](function(_0x1a0d76){logger[_0x4a15('0xc')](_0x4a15('0x16'),_0x4d1ca5);logger[_0x4a15('0xf')](_0x4a15('0x16'),_0x4d1ca5,JSON[_0x4a15('0x11')](_0x1a0d76));_0x36501d(_0x1a0d76);})[_0x4a15('0x15')](function(_0x3139ad){logger[_0x4a15('0x12')](_0x4a15('0x16'),_0x3139ad['message'],_0x4d1ca5);_0x482966(_0xc88ee1[_0x4a15('0x12')](0x1f4,_0x3139ad[_0x4a15('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index f7c8057..155c5e6 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 _0xaf1c=['download','create','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','destroy','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download'];(function(_0x5d2443,_0x416eca){var _0x472451=function(_0x4571dc){while(--_0x4571dc){_0x5d2443['push'](_0x5d2443['shift']());}};_0x472451(++_0x416eca);}(_0xaf1c,0x6b));var _0xcaf1=function(_0xe2732b,_0x123f23){_0xe2732b=_0xe2732b-0x0;var _0x117451=_0xaf1c[_0xe2732b];return _0x117451;};'use strict';var multer=require(_0xcaf1('0x0'));var util=require(_0xcaf1('0x1'));var path=require('path');var timeout=require(_0xcaf1('0x2'));var express=require('express');var router=express[_0xcaf1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcaf1('0x4'));var interaction=require(_0xcaf1('0x5'));var config=require(_0xcaf1('0x6'));var controller=require(_0xcaf1('0x7'));router[_0xcaf1('0x8')]('/',auth[_0xcaf1('0x9')](),controller['index']);router['get'](_0xcaf1('0xa'),auth['isAuthenticated'](),controller[_0xcaf1('0xb')]);router[_0xcaf1('0x8')](_0xcaf1('0xc'),auth[_0xcaf1('0x9')](),controller[_0xcaf1('0xd')]);router['get'](_0xcaf1('0xe'),auth[_0xcaf1('0x9')](),controller[_0xcaf1('0xf')]);router[_0xcaf1('0x8')](_0xcaf1('0x10'),auth[_0xcaf1('0x9')](),controller[_0xcaf1('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcaf1('0x12')]);router[_0xcaf1('0x13')](_0xcaf1('0xe'),auth[_0xcaf1('0x9')](),controller['addMessage']);router[_0xcaf1('0x13')](_0xcaf1('0x14'),auth[_0xcaf1('0x9')](),interaction[_0xcaf1('0x15')](_0xcaf1('0x16'),_0xcaf1('0x17')),controller[_0xcaf1('0x18')]);router['put']('/:id',auth[_0xcaf1('0x9')](),interaction[_0xcaf1('0x15')](_0xcaf1('0x16'),_0xcaf1('0x19')),controller[_0xcaf1('0x1a')]);router[_0xcaf1('0x1b')](_0xcaf1('0xc'),auth[_0xcaf1('0x9')](),interaction[_0xcaf1('0x15')](_0xcaf1('0x16'),'openchannelinteraction:destroy'),controller[_0xcaf1('0x1c')]);router[_0xcaf1('0x1b')](_0xcaf1('0x14'),auth['isAuthenticated'](),controller[_0xcaf1('0x1d')]);module[_0xcaf1('0x1e')]=router; \ No newline at end of file +var _0xd46d=['put','openchannelinteraction:update','update','openchannelinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','post','create','addMessage','tracked','openchannel'];(function(_0x4b1960,_0x98cbe6){var _0x16be4b=function(_0x55cea5){while(--_0x55cea5){_0x4b1960['push'](_0x4b1960['shift']());}};_0x16be4b(++_0x98cbe6);}(_0xd46d,0x1ad));var _0xdd46=function(_0x18694b,_0x3882f8){_0x18694b=_0x18694b-0x0;var _0x4a8ebc=_0xd46d[_0x18694b];return _0x4a8ebc;};'use strict';var multer=require('multer');var util=require(_0xdd46('0x0'));var path=require(_0xdd46('0x1'));var timeout=require(_0xdd46('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdd46('0x3'));var interaction=require(_0xdd46('0x4'));var config=require(_0xdd46('0x5'));var controller=require(_0xdd46('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xdd46('0x7')]('/describe',auth[_0xdd46('0x8')](),controller[_0xdd46('0x9')]);router[_0xdd46('0x7')](_0xdd46('0xa'),auth[_0xdd46('0x8')](),controller[_0xdd46('0xb')]);router[_0xdd46('0x7')](_0xdd46('0xc'),auth[_0xdd46('0x8')](),controller[_0xdd46('0xd')]);router[_0xdd46('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0xdd46('0xe')]('/',auth[_0xdd46('0x8')](),controller[_0xdd46('0xf')]);router[_0xdd46('0xe')](_0xdd46('0xc'),auth[_0xdd46('0x8')](),controller[_0xdd46('0x10')]);router[_0xdd46('0xe')]('/:id/tags',auth[_0xdd46('0x8')](),interaction[_0xdd46('0x11')](_0xdd46('0x12'),'openchannelinteraction:addtags'),controller['addTags']);router[_0xdd46('0x13')](_0xdd46('0xa'),auth[_0xdd46('0x8')](),interaction['tracked']('openchannel',_0xdd46('0x14')),controller[_0xdd46('0x15')]);router['delete'](_0xdd46('0xa'),auth['isAuthenticated'](),interaction[_0xdd46('0x11')](_0xdd46('0x12'),_0xdd46('0x16')),controller[_0xdd46('0x17')]);router[_0xdd46('0x18')](_0xdd46('0x19'),auth[_0xdd46('0x8')](),controller[_0xdd46('0x1a')]);module[_0xdd46('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 8e82a46..ec8af11 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 _0x5480=['ENUM','out','sequelize','exports','BOOLEAN','STRING','DATE'];(function(_0x2e3545,_0x20a6ec){var _0xcf18f=function(_0x3c85dd){while(--_0x3c85dd){_0x2e3545['push'](_0x2e3545['shift']());}};_0xcf18f(++_0x20a6ec);}(_0x5480,0x18a));var _0x0548=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0x5480[_0x576e2b];return _0x46461a;};'use strict';var Sequelize=require(_0x0548('0x0'));module[_0x0548('0x1')]={'closed':{'type':Sequelize[_0x0548('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0548('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x0548('0x3')]},'read1stAt':{'type':Sequelize[_0x0548('0x4')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0x0548('0x3')]},'lastMsgAt':{'type':Sequelize[_0x0548('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x0548('0x5')]('in',_0x0548('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x0548('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0x0548('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xfaf3=['sequelize','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xfaf3,0x93));var _0x3faf=function(_0x518799,_0xf04d28){_0x518799=_0x518799-0x0;var _0xd15f40=_0xfaf3[_0x518799];return _0xd15f40;};'use strict';var Sequelize=require(_0x3faf('0x0'));module['exports']={'closed':{'type':Sequelize[_0x3faf('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3faf('0x2')]},'disposition':{'type':Sequelize[_0x3faf('0x3')]},'secondDisposition':{'type':Sequelize[_0x3faf('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3faf('0x3')]},'note':{'type':Sequelize[_0x3faf('0x3')]},'read1stAt':{'type':Sequelize[_0x3faf('0x2')]},'threadId':{'type':Sequelize[_0x3faf('0x3')]},'externalUrl':{'type':Sequelize[_0x3faf('0x3')]},'lastMsgAt':{'type':Sequelize[_0x3faf('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x3faf('0x4')]('in',_0x3faf('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x3faf('0x4')]('in',_0x3faf('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x3faf('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x3faf('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3faf('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 33766b3..5d88959 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 _0x4cfc=['end','json','offset','undefined','count','limit','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','fieldName','type','key','getOptions','findAll','openchannel','query','user','catch','show','from','params','keys','rawAttributes','filters','intersection','attributes','model','fields','include','merge','find','create','body','describe','addMessage','ids','getMessages','findOne','OpenchannelMessage','length','hasOwnProperty','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','options','includeAll','rows','addTags','spread','Tag','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','User','CmContact','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','fullname','N.A.','toString','closed','closedAt','disposition','threadId','Public','Private','existsSync','pipe','createWriteStream','basename','direction','System','firstName','Contact','lastName','out','value','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','zip-dir','moment','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../mysqldb','redis','defaults','localhost','register','sendStatus','status'];(function(_0x29ad84,_0x2bc09c){var _0x2be7c5=function(_0x9f1728){while(--_0x9f1728){_0x29ad84['push'](_0x29ad84['shift']());}};_0x2be7c5(++_0x2bc09c);}(_0x4cfc,0x74));var _0xc4cf=function(_0x1ffa1c,_0x331699){_0x1ffa1c=_0x1ffa1c-0x0;var _0x26d2c3=_0x4cfc[_0x1ffa1c];return _0x26d2c3;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xc4cf('0x0'));var moment=require(_0xc4cf('0x1'));var util=require('util');var path=require(_0xc4cf('0x2'));var ejs=require(_0xc4cf('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xc4cf('0x4'));var interaction=require(_0xc4cf('0x5'));var qs=require(_0xc4cf('0x6'));var pdf=require(_0xc4cf('0x7'));var logger=require('../../config/logger')(_0xc4cf('0x8'));var config=require('../../config/environment');var db=require(_0xc4cf('0x9'))['db'];config[_0xc4cf('0xa')]=_[_0xc4cf('0xb')](config[_0xc4cf('0xa')],{'host':_0xc4cf('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc4cf('0xa')]));require('./openchannelInteraction.socket')[_0xc4cf('0xd')](socket);function respondWithStatusCode(_0x30cbb2,_0x29c4f7){_0x29c4f7=_0x29c4f7||0xcc;return function(_0x3b79a7){if(_0x3b79a7){return _0x30cbb2[_0xc4cf('0xe')](_0x29c4f7);}return _0x30cbb2[_0xc4cf('0xf')](_0x29c4f7)[_0xc4cf('0x10')]();};}function respondWithResult(_0x4a5ec2,_0x4efee7){_0x4efee7=_0x4efee7||0xc8;return function(_0xa95a0a){if(_0xa95a0a){return _0x4a5ec2[_0xc4cf('0xf')](_0x4efee7)[_0xc4cf('0x11')](_0xa95a0a);}};}function respondWithFilteredResult(_0x49d7f9,_0x21bb9a){return function(_0x7ce925){if(_0x7ce925){var _0x54845a=typeof _0x21bb9a[_0xc4cf('0x12')]==='undefined'&&typeof _0x21bb9a['limit']===_0xc4cf('0x13');var _0x3f6ce9=_0x7ce925[_0xc4cf('0x14')];var _0x558a8a=_0x54845a?0x0:_0x21bb9a[_0xc4cf('0x12')];var _0x2ccf96=_0x54845a?_0x7ce925[_0xc4cf('0x14')]:_0x21bb9a[_0xc4cf('0x12')]+_0x21bb9a[_0xc4cf('0x15')];var _0x507cc0;if(_0x2ccf96>=_0x3f6ce9){_0x2ccf96=_0x3f6ce9;_0x507cc0=0xc8;}else{_0x507cc0=0xce;}_0x49d7f9[_0xc4cf('0xf')](_0x507cc0);return _0x49d7f9[_0xc4cf('0x16')](_0xc4cf('0x17'),_0x558a8a+'-'+_0x2ccf96+'/'+_0x3f6ce9)['json'](_0x7ce925);}return null;};}function saveUpdates(_0x25b119){return function(_0x4de813){if(_0x4de813){return _0x4de813[_0xc4cf('0x18')](_0x25b119)[_0xc4cf('0x19')](function(_0x395c90){return _0x395c90;});}return null;};}function removeEntity(_0x196843){return function(_0x3a01cb){if(_0x3a01cb){return _0x3a01cb['destroy']()[_0xc4cf('0x19')](function(){_0x196843[_0xc4cf('0xf')](0xcc)[_0xc4cf('0x10')]();});}};}function handleEntityNotFound(_0x16845c){return function(_0x458a1d){if(!_0x458a1d){_0x16845c[_0xc4cf('0xe')](0x194);}return _0x458a1d;};}function handleError(_0x1f066f,_0x3530ca){_0x3530ca=_0x3530ca||0x1f4;return function(_0x41a3b9){logger[_0xc4cf('0x1a')](_0x41a3b9[_0xc4cf('0x1b')]);if(_0x41a3b9[_0xc4cf('0x1c')]){delete _0x41a3b9[_0xc4cf('0x1c')];}_0x1f066f[_0xc4cf('0xf')](_0x3530ca)[_0xc4cf('0x1d')](_0x41a3b9);};}exports[_0xc4cf('0x1e')]=function(_0x3e389c,_0x77c2a3){var _0x161b88={};var _0x55bd7a=_[_0xc4cf('0x1f')](db[_0xc4cf('0x20')]['rawAttributes'],function(_0x2e1793){return{'name':_0x2e1793[_0xc4cf('0x21')],'type':_0x2e1793[_0xc4cf('0x22')][_0xc4cf('0x23')]};});_0x161b88=qs[_0xc4cf('0x24')](_0x55bd7a,_0x3e389c);return interaction[_0xc4cf('0x25')](_0xc4cf('0x26'),_0x3e389c[_0xc4cf('0x27')],_0x3e389c[_0xc4cf('0x28')],_0x161b88,_0x55bd7a)[_0xc4cf('0x19')](respondWithFilteredResult(_0x77c2a3,_0x161b88))[_0xc4cf('0x29')](handleError(_0x77c2a3,null));};exports[_0xc4cf('0x2a')]=function(_0x150aed,_0x4a2a0c){var _0x55d32b={};if(_0x150aed[_0xc4cf('0x27')]['type']&&_0x150aed[_0xc4cf('0x27')][_0xc4cf('0x22')]===_0xc4cf('0x2b')){_0x55d32b[_0xc4cf('0x2b')]=_0x150aed[_0xc4cf('0x2c')]['id'];}else{_0x55d32b['id']=_0x150aed[_0xc4cf('0x2c')]['id'];}var _0x3cf781={'raw':![],'where':_0x55d32b},_0x16aafc={};_0x16aafc['model']=_[_0xc4cf('0x2d')](db[_0xc4cf('0x20')][_0xc4cf('0x2e')]);_0x16aafc['query']=_[_0xc4cf('0x2d')](_0x150aed[_0xc4cf('0x27')]);_0x16aafc[_0xc4cf('0x2f')]=_[_0xc4cf('0x30')](_0x16aafc['model'],_0x16aafc['query']);_0x3cf781[_0xc4cf('0x31')]=_['intersection'](_0x16aafc[_0xc4cf('0x32')],qs[_0xc4cf('0x33')](_0x150aed[_0xc4cf('0x27')]['fields']));_0x3cf781[_0xc4cf('0x31')]=_0x3cf781[_0xc4cf('0x31')]['length']?_0x3cf781[_0xc4cf('0x31')]:_0x16aafc['model'];if(_0x150aed[_0xc4cf('0x27')]['includeAll']){_0x3cf781[_0xc4cf('0x34')]=[{'all':!![]}];}_0x3cf781=_[_0xc4cf('0x35')]({},_0x3cf781,_0x150aed['options']);return db[_0xc4cf('0x20')][_0xc4cf('0x36')](_0x3cf781)['then'](handleEntityNotFound(_0x4a2a0c,null))['then'](respondWithResult(_0x4a2a0c,null))[_0xc4cf('0x29')](handleError(_0x4a2a0c,null));};exports[_0xc4cf('0x37')]=function(_0x2b286a,_0x52d66d){return db[_0xc4cf('0x20')][_0xc4cf('0x37')](_0x2b286a[_0xc4cf('0x38')],{})['then'](respondWithResult(_0x52d66d,0xc9))[_0xc4cf('0x29')](handleError(_0x52d66d,null));};exports[_0xc4cf('0x18')]=function(_0x5a1943,_0x401527){if(_0x5a1943['body']['id']){delete _0x5a1943['body']['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x5a1943[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x401527,null))[_0xc4cf('0x19')](saveUpdates(_0x5a1943[_0xc4cf('0x38')],null))[_0xc4cf('0x19')](respondWithResult(_0x401527,null))[_0xc4cf('0x29')](handleError(_0x401527,null));};exports['destroy']=function(_0x568f0e,_0x34a650){return db['OpenchannelInteraction'][_0xc4cf('0x36')]({'where':{'id':_0x568f0e[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x34a650,null))['then'](removeEntity(_0x34a650,null))['catch'](handleError(_0x34a650,null));};exports[_0xc4cf('0x39')]=function(_0x3bf133,_0x1933dc){return db[_0xc4cf('0x20')][_0xc4cf('0x39')]()[_0xc4cf('0x19')](respondWithResult(_0x1933dc,null))['catch'](handleError(_0x1933dc,null));};exports[_0xc4cf('0x3a')]=function(_0xca64c6,_0x21a07d){return db['OpenchannelMessage'][_0xc4cf('0x36')]({'where':{'id':_0xca64c6['params']['id']}})['then'](handleEntityNotFound(_0x21a07d,null))[_0xc4cf('0x19')](function(_0x5bb933){if(_0x5bb933){return _0x5bb933[_0xc4cf('0x3a')](_0xca64c6['body'][_0xc4cf('0x3b')],_['omit'](_0xca64c6['body'],['ids','id'])||{});}})[_0xc4cf('0x19')](respondWithResult(_0x21a07d,null))[_0xc4cf('0x29')](handleError(_0x21a07d,null));};exports[_0xc4cf('0x3c')]=function(_0x11fcb1,_0x38d584){var _0x29b2ff={'raw':![],'where':{}};var _0xaa6dd={};var _0x4b6ca7={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0xc4cf('0x3d')]({'where':{'id':_0x11fcb1[_0xc4cf('0x2c')]['id']}})['then'](handleEntityNotFound(_0x38d584,null))[_0xc4cf('0x19')](function(_0x263bdf){if(_0x263bdf){_0xaa6dd[_0xc4cf('0x32')]=_[_0xc4cf('0x2d')](db[_0xc4cf('0x3e')][_0xc4cf('0x2e')]);_0xaa6dd[_0xc4cf('0x27')]=_['keys'](_0x11fcb1[_0xc4cf('0x27')]);_0xaa6dd[_0xc4cf('0x2f')]=_['intersection'](_0xaa6dd[_0xc4cf('0x32')],_0xaa6dd[_0xc4cf('0x27')]);_0x29b2ff['attributes']=_[_0xc4cf('0x30')](_0xaa6dd[_0xc4cf('0x32')],qs[_0xc4cf('0x33')](_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x33')]));_0x29b2ff['attributes']=_0x29b2ff['attributes'][_0xc4cf('0x3f')]?_0x29b2ff[_0xc4cf('0x31')]:_0xaa6dd['model'];if(!_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x40')]('nolimit')){_0x29b2ff[_0xc4cf('0x15')]=qs['limit'](_0x11fcb1['query']['limit']);_0x29b2ff[_0xc4cf('0x12')]=qs[_0xc4cf('0x12')](_0x11fcb1['query'][_0xc4cf('0x12')]);}_0x29b2ff['order']=qs[_0xc4cf('0x41')](_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x41')]);_0x29b2ff[_0xc4cf('0x42')]=qs[_0xc4cf('0x2f')](_[_0xc4cf('0x43')](_0x11fcb1['query'],_0xaa6dd[_0xc4cf('0x2f')]));_0x29b2ff[_0xc4cf('0x42')][_0xc4cf('0x44')]=_0x263bdf['id'];if(_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x45')]){_0x29b2ff['where']=_[_0xc4cf('0x35')](_0x29b2ff['where'],{'$or':_[_0xc4cf('0x1f')](_0x29b2ff[_0xc4cf('0x31')],function(_0x551a69){var _0x4f78da={};_0x4f78da[_0x551a69]={'$like':'%'+_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x45')]+'%'};return _0x4f78da;})});}if(_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x46')]){var _0x2ae70f=_0x11fcb1['query'][_0xc4cf('0x46')][_0xc4cf('0x47')](',');var _0x293325={};_0x293325[_0x2ae70f[0x0]]={'$gte':moment(_0x2ae70f[0x1])[_0xc4cf('0x48')](_0xc4cf('0x49'))};_0x29b2ff[_0xc4cf('0x42')]=_[_0xc4cf('0x35')](_0x29b2ff['where'],_0x293325);}_0x29b2ff=_['merge']({},_0x29b2ff,_0x11fcb1[_0xc4cf('0x4a')]);return db[_0xc4cf('0x3e')][_0xc4cf('0x14')]({'where':_0x29b2ff[_0xc4cf('0x42')]})[_0xc4cf('0x19')](function(_0x1e1a8f){_0x4b6ca7[_0xc4cf('0x14')]=_0x1e1a8f;if(_0x11fcb1[_0xc4cf('0x27')][_0xc4cf('0x4b')]){_0x29b2ff[_0xc4cf('0x34')]=[{'all':!![]}];}return db[_0xc4cf('0x3e')][_0xc4cf('0x25')](_0x29b2ff);})[_0xc4cf('0x19')](function(_0x16da7a){_0x4b6ca7[_0xc4cf('0x4c')]=_0x16da7a;return _0x4b6ca7;});}})[_0xc4cf('0x19')](respondWithFilteredResult(_0x38d584,_0x29b2ff))[_0xc4cf('0x29')](handleError(_0x38d584,null));};exports[_0xc4cf('0x4d')]=function(_0x53e4cd,_0x3f660d){return db[_0xc4cf('0x20')][_0xc4cf('0x36')]({'where':{'id':_0x53e4cd[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x3f660d,null))[_0xc4cf('0x19')](function(_0x3328aa){if(_0x3328aa){return _0x3328aa['setTags'](_0x53e4cd[_0xc4cf('0x38')][_0xc4cf('0x3b')],_['omit'](_0x53e4cd[_0xc4cf('0x38')],[_0xc4cf('0x3b'),'id'])||{})[_0xc4cf('0x4e')](function(){return db[_0xc4cf('0x4f')]['findAll']({'attributes':['id',_0xc4cf('0x1c'),'color'],'where':{'id':_0x53e4cd[_0xc4cf('0x38')][_0xc4cf('0x3b')]}});})[_0xc4cf('0x19')](function(_0x59838b){socket[_0xc4cf('0x50')](_0xc4cf('0x51'),{'id':Number(_0x53e4cd['params']['id']),'tags':_0x59838b||[]});return{'id':Number(_0x53e4cd[_0xc4cf('0x2c')]['id']),'tags':_0x59838b||[]};});}})['then'](respondWithResult(_0x3f660d,null))[_0xc4cf('0x29')](handleError(_0x3f660d,null));};exports[_0xc4cf('0x52')]=function(_0x3ed6d6,_0x5b7eb5){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3ed6d6[_0xc4cf('0x2c')]['id']}})[_0xc4cf('0x19')](handleEntityNotFound(_0x5b7eb5,null))[_0xc4cf('0x19')](function(_0x21dc94){if(_0x21dc94){return _0x21dc94['removeTags'](_0x3ed6d6[_0xc4cf('0x27')][_0xc4cf('0x3b')]);}})[_0xc4cf('0x19')](respondWithStatusCode(_0x5b7eb5,null))['catch'](handleError(_0x5b7eb5,null));};exports[_0xc4cf('0x53')]=function(_0x1381c6,_0x577c41){var _0x2a8f9c=moment()[_0xc4cf('0x54')]()['toString']();var _0x320db0=path[_0xc4cf('0x55')](config[_0xc4cf('0x56')],_0xc4cf('0x57'),_0xc4cf('0x58'),_0xc4cf('0x59'));var _0x56c6b8=path[_0xc4cf('0x55')](config[_0xc4cf('0x56')],_0xc4cf('0x57'),_0xc4cf('0x58'),_0xc4cf('0x5a'));var _0x14d22a=path[_0xc4cf('0x55')](_0x320db0,_0x2a8f9c);var _0x898caa=util['format']('transcript-%d-%s.zip',_0x1381c6['params']['id'],_0x2a8f9c);var _0xb2a6ec=path[_0xc4cf('0x55')](_0x320db0,_0x898caa);var _0x4fb166=[];_0x4fb166[_0xc4cf('0x5b')]({'model':db[_0xc4cf('0x5c')],'as':_0xc4cf('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x4fb166['push']({'model':db[_0xc4cf('0x5d')],'as':'Contact','attributes':['id','firstName','lastName'],'raw':!![]});if(_0x1381c6['query'][_0xc4cf('0x5a')]){_0x4fb166[_0xc4cf('0x5b')]({'model':db[_0xc4cf('0x5e')],'as':_0xc4cf('0x5e'),'raw':!![]});}var _0x41bf57=[{'model':db['OpenchannelMessage'],'as':_0xc4cf('0x5f'),'attributes':['id',_0xc4cf('0x38'),_0xc4cf('0x60'),'direction',_0xc4cf('0x61'),_0xc4cf('0x62')],'include':_0x4fb166}];_0x41bf57[_0xc4cf('0x5b')]({'model':db[_0xc4cf('0x63')],'as':_0xc4cf('0x64'),'attributes':['id',_0xc4cf('0x1c')]});_0x41bf57['push']({'model':db[_0xc4cf('0x5c')],'as':_0xc4cf('0x65'),'attributes':['id','fullname']});return db[_0xc4cf('0x20')][_0xc4cf('0x36')]({'where':{'id':_0x1381c6[_0xc4cf('0x2c')]['id']},'include':_0x41bf57})['then'](handleEntityNotFound(_0x577c41,null))[_0xc4cf('0x19')](function(_0x4832fb){if(_0x4832fb){var _0x53f299=_0x4832fb[_0xc4cf('0x66')]({'plain':!![]});fs[_0xc4cf('0x67')](_0x14d22a);var _0x413b9b={'channel':_0xc4cf('0x68'),'account':_0x53f299[_0xc4cf('0x64')][_0xc4cf('0x1c')],'agent':_0x53f299[_0xc4cf('0x65')]?_0x53f299[_0xc4cf('0x65')][_0xc4cf('0x69')]:_0xc4cf('0x6a'),'createdAt':moment(_0x53f299[_0xc4cf('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xc4cf('0x6b')](),'closedAt':_0x53f299[_0xc4cf('0x6c')]?moment(_0x53f299[_0xc4cf('0x6d')])[_0xc4cf('0x48')](_0xc4cf('0x49'))[_0xc4cf('0x6b')]():'','disposition':_0x53f299[_0xc4cf('0x6e')],'visibility':_0x53f299[_0xc4cf('0x6f')]?_0xc4cf('0x70'):_0xc4cf('0x71'),'messages':_(_0x53f299[_0xc4cf('0x5f')])[_0xc4cf('0x45')]({'secret':![]})[_0xc4cf('0x1f')](function(_0x15eea9){if(_0x15eea9[_0xc4cf('0x5e')]){var _0x626827=path['join'](_0x56c6b8,_0x15eea9[_0xc4cf('0x5e')]['basename']);if(fs[_0xc4cf('0x72')](_0x626827)){fs['createReadStream'](_0x626827)[_0xc4cf('0x73')](fs[_0xc4cf('0x74')](path[_0xc4cf('0x55')](_0x14d22a,_0x15eea9[_0xc4cf('0x5e')][_0xc4cf('0x75')])));}}return{'date':moment(_0x15eea9['createdAt'])[_0xc4cf('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc4cf('0x6b')](),'sender':_0x15eea9[_0xc4cf('0x76')]==='out'?_0x15eea9[_0xc4cf('0x5c')]?_0x15eea9[_0xc4cf('0x5c')][_0xc4cf('0x69')]:_0xc4cf('0x77'):_0x15eea9['Contact'][_0xc4cf('0x78')]+(_0x15eea9[_0xc4cf('0x79')][_0xc4cf('0x7a')]?'\x20'+_0x15eea9[_0xc4cf('0x79')]['lastName']:''),'body':_0x15eea9[_0xc4cf('0x5e')]?_0x15eea9[_0xc4cf('0x5e')]['basename']:_0x15eea9[_0xc4cf('0x38')],'direction':_0x15eea9['direction']===_0xc4cf('0x7b')?'A':'C','secret':_0x15eea9[_0xc4cf('0x61')],'read':_0x15eea9[_0xc4cf('0x62')],'attachment':_0x15eea9[_0xc4cf('0x5e')]};})[_0xc4cf('0x7c')]()};return ejs[_0xc4cf('0x7d')](path[_0xc4cf('0x55')](config[_0xc4cf('0x56')],'server',_0xc4cf('0x7e'),_0xc4cf('0x7f')),{'interaction':_0x413b9b})['then'](function(_0x509214){var _0x177efa=path[_0xc4cf('0x55')](_0x14d22a,'transcript-'+_0x53f299['id']+'-'+_0x2a8f9c+_0xc4cf('0x80'));var _0x4c27b4={'path':_0x177efa,'channel':_0xc4cf('0x68'),'interactionId':_0x53f299['id']};return pdf[_0xc4cf('0x81')](_0x509214,_0x4c27b4);})[_0xc4cf('0x19')](function(){return new Promise(function(_0x3b5875,_0x320209){zipdir(_0x14d22a,{'saveTo':_0xb2a6ec},function(_0x2b3af4,_0x119987){if(_0x2b3af4)return _0x320209(_0x2b3af4);return _0x3b5875(_0x119987);});})[_0xc4cf('0x19')](function(){return new Promise(function(_0x245902,_0x4ca209){rimraf(_0x14d22a,function(_0x34057d){if(_0x34057d)_0x4ca209(_0x34057d);return _0x245902();});});})['then'](function(){return _0x577c41[_0xc4cf('0x53')](_0xb2a6ec,_0x898caa,function(_0x51dceb){if(_0x51dceb){logger[_0xc4cf('0x1a')](_0xc4cf('0x82'),_0x51dceb);}else{fs[_0xc4cf('0x83')](_0xb2a6ec);}});});});}else{return _0x577c41[_0xc4cf('0xe')](0xc8);}})[_0xc4cf('0x29')](handleError(_0x577c41,null));}; \ No newline at end of file +var _0x302b=['../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','update','then','destroy','error','stack','name','send','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','catch','params','keys','filters','model','attributes','intersection','fields','length','includeAll','include','options','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','order','sort','where','OpenchannelInteractionId','filter','merge','$gte','format','rows','addTags','setTags','spread','color','emit','removeTags','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','OpenchannelAccount','Account','Owner','Openchannel','N.A.','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','out','Contact','value','renderFile','transcript-','.pdf','createPdfFromHTML','download','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','util','ejs','lodash','ioredis','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x302b,0xf1));var _0xb302=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x302b[_0x57add2];return _0x4e3670;};'use strict';var rimraf=require(_0xb302('0x0'));var zipdir=require(_0xb302('0x1'));var moment=require('moment');var util=require(_0xb302('0x2'));var path=require('path');var ejs=require(_0xb302('0x3'));var fs=require('fs');var _=require(_0xb302('0x4'));var Redis=require(_0xb302('0x5'));var interaction=require(_0xb302('0x6'));var qs=require(_0xb302('0x7'));var pdf=require(_0xb302('0x8'));var logger=require(_0xb302('0x9'))('api');var config=require('../../config/environment');var db=require(_0xb302('0xa'))['db'];config[_0xb302('0xb')]=_['defaults'](config['redis'],{'host':_0xb302('0xc'),'port':0x18eb});var socket=require(_0xb302('0xd'))(new Redis(config['redis']));require(_0xb302('0xe'))[_0xb302('0xf')](socket);function respondWithStatusCode(_0x2555ce,_0x372243){_0x372243=_0x372243||0xcc;return function(_0x2b197e){if(_0x2b197e){return _0x2555ce[_0xb302('0x10')](_0x372243);}return _0x2555ce['status'](_0x372243)[_0xb302('0x11')]();};}function respondWithResult(_0x1f17c1,_0xcb9039){_0xcb9039=_0xcb9039||0xc8;return function(_0x56c5e9){if(_0x56c5e9){return _0x1f17c1['status'](_0xcb9039)['json'](_0x56c5e9);}};}function respondWithFilteredResult(_0x5b54e3,_0x220038){return function(_0x1b21c8){if(_0x1b21c8){var _0x834d1b=typeof _0x220038[_0xb302('0x12')]===_0xb302('0x13')&&typeof _0x220038[_0xb302('0x14')]===_0xb302('0x13');var _0x4db43f=_0x1b21c8[_0xb302('0x15')];var _0x3b3b48=_0x834d1b?0x0:_0x220038[_0xb302('0x12')];var _0x83ad44=_0x834d1b?_0x1b21c8[_0xb302('0x15')]:_0x220038[_0xb302('0x12')]+_0x220038['limit'];var _0x541cce;if(_0x83ad44>=_0x4db43f){_0x83ad44=_0x4db43f;_0x541cce=0xc8;}else{_0x541cce=0xce;}_0x5b54e3[_0xb302('0x16')](_0x541cce);return _0x5b54e3['set'](_0xb302('0x17'),_0x3b3b48+'-'+_0x83ad44+'/'+_0x4db43f)[_0xb302('0x18')](_0x1b21c8);}return null;};}function saveUpdates(_0x56f2c0){return function(_0xa77eca){if(_0xa77eca){return _0xa77eca[_0xb302('0x19')](_0x56f2c0)[_0xb302('0x1a')](function(_0x23e506){return _0x23e506;});}return null;};}function removeEntity(_0xa9bab0){return function(_0x4dc8bb){if(_0x4dc8bb){return _0x4dc8bb[_0xb302('0x1b')]()['then'](function(){_0xa9bab0[_0xb302('0x16')](0xcc)[_0xb302('0x11')]();});}};}function handleEntityNotFound(_0x2f8449){return function(_0xc508c){if(!_0xc508c){_0x2f8449[_0xb302('0x10')](0x194);}return _0xc508c;};}function handleError(_0x5b70e1,_0x2ea042){_0x2ea042=_0x2ea042||0x1f4;return function(_0x4a14f8){logger[_0xb302('0x1c')](_0x4a14f8[_0xb302('0x1d')]);if(_0x4a14f8[_0xb302('0x1e')]){delete _0x4a14f8[_0xb302('0x1e')];}_0x5b70e1[_0xb302('0x16')](_0x2ea042)[_0xb302('0x1f')](_0x4a14f8);};}exports[_0xb302('0x20')]=function(_0x16f593,_0x1fbfad){var _0x42190a={};var _0x54b932=_[_0xb302('0x21')](db[_0xb302('0x22')][_0xb302('0x23')],function(_0x121af1){return{'name':_0x121af1[_0xb302('0x24')],'type':_0x121af1[_0xb302('0x25')]['key']};});_0x42190a=qs[_0xb302('0x26')](_0x54b932,_0x16f593);return interaction[_0xb302('0x27')](_0xb302('0x28'),_0x16f593[_0xb302('0x29')],_0x16f593[_0xb302('0x2a')],_0x42190a,_0x54b932)[_0xb302('0x1a')](respondWithFilteredResult(_0x1fbfad,_0x42190a))[_0xb302('0x2b')](handleError(_0x1fbfad,null));};exports['show']=function(_0x4811ff,_0x40bdb1){var _0x505c75={};if(_0x4811ff[_0xb302('0x29')][_0xb302('0x25')]&&_0x4811ff[_0xb302('0x29')][_0xb302('0x25')]==='from'){_0x505c75['from']=_0x4811ff[_0xb302('0x2c')]['id'];}else{_0x505c75['id']=_0x4811ff[_0xb302('0x2c')]['id'];}var _0x48d7f7={'raw':![],'where':_0x505c75},_0x237a11={};_0x237a11['model']=_[_0xb302('0x2d')](db['OpenchannelInteraction'][_0xb302('0x23')]);_0x237a11['query']=_[_0xb302('0x2d')](_0x4811ff[_0xb302('0x29')]);_0x237a11[_0xb302('0x2e')]=_['intersection'](_0x237a11[_0xb302('0x2f')],_0x237a11[_0xb302('0x29')]);_0x48d7f7[_0xb302('0x30')]=_[_0xb302('0x31')](_0x237a11['model'],qs[_0xb302('0x32')](_0x4811ff[_0xb302('0x29')][_0xb302('0x32')]));_0x48d7f7[_0xb302('0x30')]=_0x48d7f7[_0xb302('0x30')][_0xb302('0x33')]?_0x48d7f7[_0xb302('0x30')]:_0x237a11[_0xb302('0x2f')];if(_0x4811ff['query'][_0xb302('0x34')]){_0x48d7f7[_0xb302('0x35')]=[{'all':!![]}];}_0x48d7f7=_['merge']({},_0x48d7f7,_0x4811ff[_0xb302('0x36')]);return db[_0xb302('0x22')][_0xb302('0x37')](_0x48d7f7)[_0xb302('0x1a')](handleEntityNotFound(_0x40bdb1,null))[_0xb302('0x1a')](respondWithResult(_0x40bdb1,null))[_0xb302('0x2b')](handleError(_0x40bdb1,null));};exports[_0xb302('0x38')]=function(_0x115903,_0x1d7ab9){return db[_0xb302('0x22')][_0xb302('0x38')](_0x115903[_0xb302('0x39')],{})[_0xb302('0x1a')](respondWithResult(_0x1d7ab9,0xc9))['catch'](handleError(_0x1d7ab9,null));};exports[_0xb302('0x19')]=function(_0x18de32,_0x2e0b63){if(_0x18de32[_0xb302('0x39')]['id']){delete _0x18de32[_0xb302('0x39')]['id'];}return db[_0xb302('0x22')]['find']({'where':{'id':_0x18de32[_0xb302('0x2c')]['id']}})[_0xb302('0x1a')](handleEntityNotFound(_0x2e0b63,null))[_0xb302('0x1a')](saveUpdates(_0x18de32[_0xb302('0x39')],null))[_0xb302('0x1a')](respondWithResult(_0x2e0b63,null))[_0xb302('0x2b')](handleError(_0x2e0b63,null));};exports[_0xb302('0x1b')]=function(_0x340fd6,_0x4c57ea){return db[_0xb302('0x22')][_0xb302('0x37')]({'where':{'id':_0x340fd6[_0xb302('0x2c')]['id']}})[_0xb302('0x1a')](handleEntityNotFound(_0x4c57ea,null))[_0xb302('0x1a')](removeEntity(_0x4c57ea,null))[_0xb302('0x2b')](handleError(_0x4c57ea,null));};exports['describe']=function(_0x53e095,_0x4bb846){return db[_0xb302('0x22')][_0xb302('0x3a')]()[_0xb302('0x1a')](respondWithResult(_0x4bb846,null))[_0xb302('0x2b')](handleError(_0x4bb846,null));};exports[_0xb302('0x3b')]=function(_0x368163,_0x27260a){return db[_0xb302('0x3c')][_0xb302('0x37')]({'where':{'id':_0x368163[_0xb302('0x2c')]['id']}})[_0xb302('0x1a')](handleEntityNotFound(_0x27260a,null))['then'](function(_0x3f0b2c){if(_0x3f0b2c){return _0x3f0b2c[_0xb302('0x3b')](_0x368163[_0xb302('0x39')][_0xb302('0x3d')],_[_0xb302('0x3e')](_0x368163['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x27260a,null))[_0xb302('0x2b')](handleError(_0x27260a,null));};exports[_0xb302('0x3f')]=function(_0x1801c8,_0x310fe1){var _0x21825f={'raw':![],'where':{}};var _0x28e922={};var _0x396a8c={'count':0x0,'rows':[]};return db[_0xb302('0x22')][_0xb302('0x40')]({'where':{'id':_0x1801c8[_0xb302('0x2c')]['id']}})[_0xb302('0x1a')](handleEntityNotFound(_0x310fe1,null))[_0xb302('0x1a')](function(_0x41ee2b){if(_0x41ee2b){_0x28e922[_0xb302('0x2f')]=_[_0xb302('0x2d')](db[_0xb302('0x3c')][_0xb302('0x23')]);_0x28e922[_0xb302('0x29')]=_['keys'](_0x1801c8[_0xb302('0x29')]);_0x28e922[_0xb302('0x2e')]=_[_0xb302('0x31')](_0x28e922['model'],_0x28e922['query']);_0x21825f['attributes']=_[_0xb302('0x31')](_0x28e922[_0xb302('0x2f')],qs['fields'](_0x1801c8[_0xb302('0x29')][_0xb302('0x32')]));_0x21825f[_0xb302('0x30')]=_0x21825f[_0xb302('0x30')][_0xb302('0x33')]?_0x21825f[_0xb302('0x30')]:_0x28e922[_0xb302('0x2f')];if(!_0x1801c8[_0xb302('0x29')]['hasOwnProperty']('nolimit')){_0x21825f[_0xb302('0x14')]=qs[_0xb302('0x14')](_0x1801c8[_0xb302('0x29')]['limit']);_0x21825f[_0xb302('0x12')]=qs[_0xb302('0x12')](_0x1801c8[_0xb302('0x29')]['offset']);}_0x21825f[_0xb302('0x41')]=qs['sort'](_0x1801c8['query'][_0xb302('0x42')]);_0x21825f[_0xb302('0x43')]=qs[_0xb302('0x2e')](_['pick'](_0x1801c8['query'],_0x28e922[_0xb302('0x2e')]));_0x21825f[_0xb302('0x43')][_0xb302('0x44')]=_0x41ee2b['id'];if(_0x1801c8['query'][_0xb302('0x45')]){_0x21825f['where']=_[_0xb302('0x46')](_0x21825f[_0xb302('0x43')],{'$or':_['map'](_0x21825f[_0xb302('0x30')],function(_0x15720c){var _0x3cafb9={};_0x3cafb9[_0x15720c]={'$like':'%'+_0x1801c8['query'][_0xb302('0x45')]+'%'};return _0x3cafb9;})});}if(_0x1801c8[_0xb302('0x29')]['$gte']){var _0x2d4834=_0x1801c8['query'][_0xb302('0x47')]['split'](',');var _0x304d4c={};_0x304d4c[_0x2d4834[0x0]]={'$gte':moment(_0x2d4834[0x1])[_0xb302('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0x21825f[_0xb302('0x43')]=_['merge'](_0x21825f[_0xb302('0x43')],_0x304d4c);}_0x21825f=_['merge']({},_0x21825f,_0x1801c8[_0xb302('0x36')]);return db[_0xb302('0x3c')][_0xb302('0x15')]({'where':_0x21825f[_0xb302('0x43')]})[_0xb302('0x1a')](function(_0x37d52c){_0x396a8c['count']=_0x37d52c;if(_0x1801c8[_0xb302('0x29')][_0xb302('0x34')]){_0x21825f[_0xb302('0x35')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xb302('0x27')](_0x21825f);})[_0xb302('0x1a')](function(_0x2b646a){_0x396a8c[_0xb302('0x49')]=_0x2b646a;return _0x396a8c;});}})[_0xb302('0x1a')](respondWithFilteredResult(_0x310fe1,_0x21825f))[_0xb302('0x2b')](handleError(_0x310fe1,null));};exports[_0xb302('0x4a')]=function(_0x4dd87d,_0x1676ef){return db[_0xb302('0x22')][_0xb302('0x37')]({'where':{'id':_0x4dd87d['params']['id']}})[_0xb302('0x1a')](handleEntityNotFound(_0x1676ef,null))[_0xb302('0x1a')](function(_0x249170){if(_0x249170){return _0x249170[_0xb302('0x4b')](_0x4dd87d[_0xb302('0x39')][_0xb302('0x3d')],_[_0xb302('0x3e')](_0x4dd87d[_0xb302('0x39')],[_0xb302('0x3d'),'id'])||{})[_0xb302('0x4c')](function(){return db['Tag'][_0xb302('0x27')]({'attributes':['id',_0xb302('0x1e'),_0xb302('0x4d')],'where':{'id':_0x4dd87d[_0xb302('0x39')]['ids']}});})[_0xb302('0x1a')](function(_0x35edb0){socket[_0xb302('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x4dd87d[_0xb302('0x2c')]['id']),'tags':_0x35edb0||[]});return{'id':Number(_0x4dd87d[_0xb302('0x2c')]['id']),'tags':_0x35edb0||[]};});}})[_0xb302('0x1a')](respondWithResult(_0x1676ef,null))[_0xb302('0x2b')](handleError(_0x1676ef,null));};exports[_0xb302('0x4f')]=function(_0x28c88f,_0x5447b3){return db['OpenchannelInteraction'][_0xb302('0x37')]({'where':{'id':_0x28c88f[_0xb302('0x2c')]['id']}})[_0xb302('0x1a')](handleEntityNotFound(_0x5447b3,null))[_0xb302('0x1a')](function(_0x2239a5){if(_0x2239a5){return _0x2239a5[_0xb302('0x4f')](_0x28c88f[_0xb302('0x29')][_0xb302('0x3d')]);}})['then'](respondWithStatusCode(_0x5447b3,null))[_0xb302('0x2b')](handleError(_0x5447b3,null));};exports['download']=function(_0x91c558,_0x3efe85){var _0x2abbab=moment()[_0xb302('0x50')]()[_0xb302('0x51')]();var _0x2ea629=path[_0xb302('0x52')](config[_0xb302('0x53')],_0xb302('0x54'),_0xb302('0x55'),_0xb302('0x56'));var _0x98bc91=path['join'](config[_0xb302('0x53')],_0xb302('0x54'),_0xb302('0x55'),_0xb302('0x57'));var _0x39dfe5=path[_0xb302('0x52')](_0x2ea629,_0x2abbab);var _0x4a79b3=util[_0xb302('0x48')](_0xb302('0x58'),_0x91c558['params']['id'],_0x2abbab);var _0x258839=path[_0xb302('0x52')](_0x2ea629,_0x4a79b3);var _0x77932f=[];_0x77932f[_0xb302('0x59')]({'model':db[_0xb302('0x5a')],'as':'User','attributes':['id',_0xb302('0x5b')],'raw':!![]});_0x77932f['push']({'model':db[_0xb302('0x5c')],'as':'Contact','attributes':['id',_0xb302('0x5d'),_0xb302('0x5e')],'raw':!![]});if(_0x91c558[_0xb302('0x29')]['attachments']){_0x77932f['push']({'model':db['Attachment'],'as':_0xb302('0x5f'),'raw':!![]});}var _0x1552c6=[{'model':db['OpenchannelMessage'],'as':_0xb302('0x60'),'attributes':['id',_0xb302('0x39'),_0xb302('0x61'),_0xb302('0x62'),_0xb302('0x63'),_0xb302('0x64')],'include':_0x77932f}];_0x1552c6[_0xb302('0x59')]({'model':db[_0xb302('0x65')],'as':_0xb302('0x66'),'attributes':['id',_0xb302('0x1e')]});_0x1552c6[_0xb302('0x59')]({'model':db[_0xb302('0x5a')],'as':_0xb302('0x67'),'attributes':['id',_0xb302('0x5b')]});return db['OpenchannelInteraction']['find']({'where':{'id':_0x91c558[_0xb302('0x2c')]['id']},'include':_0x1552c6})[_0xb302('0x1a')](handleEntityNotFound(_0x3efe85,null))['then'](function(_0x5902ea){if(_0x5902ea){var _0x4fb604=_0x5902ea['get']({'plain':!![]});fs['mkdirSync'](_0x39dfe5);var _0x40de64={'channel':_0xb302('0x68'),'account':_0x4fb604['Account'][_0xb302('0x1e')],'agent':_0x4fb604[_0xb302('0x67')]?_0x4fb604['Owner']['fullname']:_0xb302('0x69'),'createdAt':moment(_0x4fb604[_0xb302('0x61')])[_0xb302('0x48')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb302('0x51')](),'closedAt':_0x4fb604[_0xb302('0x6a')]?moment(_0x4fb604['closedAt'])['format'](_0xb302('0x6b'))[_0xb302('0x51')]():'','disposition':_0x4fb604[_0xb302('0x6c')],'visibility':_0x4fb604['threadId']?'Public':'Private','messages':_(_0x4fb604[_0xb302('0x60')])['filter']({'secret':![]})['map'](function(_0x4720dc){if(_0x4720dc[_0xb302('0x5f')]){var _0x4171f4=path[_0xb302('0x52')](_0x98bc91,_0x4720dc[_0xb302('0x5f')][_0xb302('0x6d')]);if(fs[_0xb302('0x6e')](_0x4171f4)){fs[_0xb302('0x6f')](_0x4171f4)[_0xb302('0x70')](fs[_0xb302('0x71')](path['join'](_0x39dfe5,_0x4720dc['Attachment'][_0xb302('0x6d')])));}}return{'date':moment(_0x4720dc[_0xb302('0x61')])[_0xb302('0x48')](_0xb302('0x6b'))['toString'](),'sender':_0x4720dc[_0xb302('0x62')]===_0xb302('0x72')?_0x4720dc[_0xb302('0x5a')]?_0x4720dc[_0xb302('0x5a')]['fullname']:'System':_0x4720dc[_0xb302('0x73')][_0xb302('0x5d')]+(_0x4720dc[_0xb302('0x73')][_0xb302('0x5e')]?'\x20'+_0x4720dc[_0xb302('0x73')]['lastName']:''),'body':_0x4720dc[_0xb302('0x5f')]?_0x4720dc[_0xb302('0x5f')][_0xb302('0x6d')]:_0x4720dc['body'],'direction':_0x4720dc[_0xb302('0x62')]===_0xb302('0x72')?'A':'C','secret':_0x4720dc[_0xb302('0x63')],'read':_0x4720dc[_0xb302('0x64')],'attachment':_0x4720dc['Attachment']};})[_0xb302('0x74')]()};return ejs[_0xb302('0x75')](path[_0xb302('0x52')](config[_0xb302('0x53')],'server','views','downloadInteraction.ejs'),{'interaction':_0x40de64})['then'](function(_0x461c68){var _0x31148d=path[_0xb302('0x52')](_0x39dfe5,_0xb302('0x76')+_0x4fb604['id']+'-'+_0x2abbab+_0xb302('0x77'));var _0x4401d9={'path':_0x31148d,'channel':_0xb302('0x68'),'interactionId':_0x4fb604['id']};return pdf[_0xb302('0x78')](_0x461c68,_0x4401d9);})[_0xb302('0x1a')](function(){return new Promise(function(_0xbb1a51,_0x3df76f){zipdir(_0x39dfe5,{'saveTo':_0x258839},function(_0x58cce4,_0x5eec81){if(_0x58cce4)return _0x3df76f(_0x58cce4);return _0xbb1a51(_0x5eec81);});})[_0xb302('0x1a')](function(){return new Promise(function(_0x493700,_0x1ede32){rimraf(_0x39dfe5,function(_0x9dcf5){if(_0x9dcf5)_0x1ede32(_0x9dcf5);return _0x493700();});});})['then'](function(){return _0x3efe85[_0xb302('0x79')](_0x258839,_0x4a79b3,function(_0xd2430c){if(_0xd2430c){logger[_0xb302('0x1c')](_0xb302('0x7a'),_0xd2430c);}else{fs[_0xb302('0x7b')](_0x258839);}});});});}else{return _0x3efe85[_0xb302('0x10')](0xc8);}})[_0xb302('0x2b')](handleError(_0x3efe85,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 35b9b5f..651adef 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 _0x9930=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','findAll','length','emit','catch'];(function(_0x557a30,_0x433df5){var _0x2bf5f6=function(_0x5b9171){while(--_0x5b9171){_0x557a30['push'](_0x557a30['shift']());}};_0x2bf5f6(++_0x433df5);}(_0x9930,0x146));var _0x0993=function(_0x2ad441,_0x1a10aa){_0x2ad441=_0x2ad441-0x0;var _0x131a12=_0x9930[_0x2ad441];return _0x131a12;};'use strict';var EventEmitter=require(_0x0993('0x0'));var OpenchannelInteraction=require(_0x0993('0x1'))['db'][_0x0993('0x2')];var OpenchannelMessage=require(_0x0993('0x1'))['db'][_0x0993('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0993('0x4')](0x0);var events={'afterCreate':_0x0993('0x5'),'afterUpdate':_0x0993('0x6'),'afterDestroy':_0x0993('0x7')};function emitEvent(_0x50517d){return function(_0x492c17,_0x3d65e3,_0x4b14ef){_0x492c17['getUsers']({'attributes':['id'],'raw':!![]})[_0x0993('0x8')](function(_0x2997c6){_0x492c17[_0x0993('0x9')](_0x0993('0xa'),_0x2997c6[_0x0993('0xb')](function(_0x27fdab){return{'id':_0x27fdab['id']};}));return OpenchannelMessage[_0x0993('0xc')]({'where':{'OpenchannelInteractionId':_0x492c17['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0993('0x8')](function(_0x414bcb){_0x492c17[_0x0993('0x9')]('unreadMessages',_0x414bcb[_0x0993('0xd')]);OpenchannelInteractionEvents[_0x0993('0xe')](_0x50517d+':'+_0x492c17['id'],_0x492c17);OpenchannelInteractionEvents[_0x0993('0xe')](_0x50517d,_0x492c17);_0x4b14ef(null);})[_0x0993('0xf')](_0x4b14ef(null));};}for(var e in events){if(events[_0x0993('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x0993('0x11')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file +var _0xdefe=['save','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners'];(function(_0x1a3d4b,_0x165d89){var _0xa60a5=function(_0x1871fd){while(--_0x1871fd){_0x1a3d4b['push'](_0x1a3d4b['shift']());}};_0xa60a5(++_0x165d89);}(_0xdefe,0x10b));var _0xedef=function(_0x2b3878,_0x58ce08){_0x2b3878=_0x2b3878-0x0;var _0xa4c64a=_0xdefe[_0x2b3878];return _0xa4c64a;};'use strict';var EventEmitter=require(_0xedef('0x0'));var OpenchannelInteraction=require(_0xedef('0x1'))['db'][_0xedef('0x2')];var OpenchannelMessage=require(_0xedef('0x1'))['db'][_0xedef('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xedef('0x4')](0x0);var events={'afterCreate':_0xedef('0x5'),'afterUpdate':'update','afterDestroy':_0xedef('0x6')};function emitEvent(_0x521a76){return function(_0x2034c0,_0x4c5ae0,_0x2758f8){_0x2034c0['getUsers']({'attributes':['id'],'raw':!![]})[_0xedef('0x7')](function(_0x189f6e){_0x2034c0[_0xedef('0x8')](_0xedef('0x9'),_0x189f6e[_0xedef('0xa')](function(_0x2144a6){return{'id':_0x2144a6['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x2034c0['id'],'direction':'in','read':![]},'raw':!![]});})[_0xedef('0x7')](function(_0x55a6aa){_0x2034c0[_0xedef('0x8')](_0xedef('0xb'),_0x55a6aa[_0xedef('0xc')]);OpenchannelInteractionEvents[_0xedef('0xd')](_0x521a76+':'+_0x2034c0['id'],_0x2034c0);OpenchannelInteractionEvents[_0xedef('0xd')](_0x521a76,_0x2034c0);_0x2758f8(null);})[_0xedef('0xe')](_0x2758f8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xedef('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 9c04646..2ab0291 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 _0x6647=['moment','bluebird','request-promise','../../config/environment','exports','define','OpenchannelInteraction','utf8mb4','utf8mb4_unicode_ci','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','api'];(function(_0x4982e9,_0xf6d6ba){var _0x363a1d=function(_0x598f5e){while(--_0x598f5e){_0x4982e9['push'](_0x4982e9['shift']());}};_0x363a1d(++_0xf6d6ba);}(_0x6647,0xa2));var _0x7664=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x6647[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x7664('0x0'));var logger=require(_0x7664('0x1'))(_0x7664('0x2'));var moment=require(_0x7664('0x3'));var BPromise=require(_0x7664('0x4'));var rp=require(_0x7664('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7664('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x7664('0x7')]=function(_0x1efe13,_0x14aad8){return _0x1efe13[_0x7664('0x8')](_0x7664('0x9'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7664('0xa'),'collate':_0x7664('0xb'),'hooks':{'beforeUpdate':function(_0x2ca594,_0x1dc73b,_0x4259b1){if(_0x2ca594['changed']('closed')){_0x2ca594[_0x7664('0xc')]=moment()[_0x7664('0xd')](_0x7664('0xe'));}_0x4259b1(null,_0x2ca594);}}});}; \ No newline at end of file +var _0x4b35=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x4b35,0x8a));var _0x54b3=function(_0x180c9b,_0x13d173){_0x180c9b=_0x180c9b-0x0;var _0x3ff116=_0x4b35[_0x180c9b];return _0x3ff116;};'use strict';var _=require(_0x54b3('0x0'));var util=require('util');var logger=require(_0x54b3('0x1'))(_0x54b3('0x2'));var moment=require(_0x54b3('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x54b3('0x4'));var config=require(_0x54b3('0x5'));var attributes=require(_0x54b3('0x6'));module[_0x54b3('0x7')]=function(_0x4e620d,_0x5c9f4c){return _0x4e620d['define'](_0x54b3('0x8'),attributes,{'tableName':_0x54b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x54b3('0xa'),'collate':_0x54b3('0xb'),'hooks':{'beforeUpdate':function(_0x38ae8e,_0x392069,_0x384f14){if(_0x38ae8e[_0x54b3('0xc')](_0x54b3('0xd'))){_0x38ae8e[_0x54b3('0xe')]=moment()[_0x54b3('0xf')](_0x54b3('0x10'));}_0x384f14(null,_0x38ae8e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 1abe4f5..58e8af2 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 _0x5938=['message','OpenchannelInteraction,\x20%s,\x20%s','result','OpenchannelInteraction','update','options','raw','attributes','limit','then','UpdateOpenchannelInteraction','catch','AddTagsToOpenchannelInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./openchannelInteraction.socket','register','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5938,0x175));var _0x8593=function(_0x12d204,_0x207f13){_0x12d204=_0x12d204-0x0;var _0x429203=_0x5938[_0x12d204];return _0x429203;};'use strict';var _=require(_0x8593('0x0'));var util=require(_0x8593('0x1'));var moment=require(_0x8593('0x2'));var BPromise=require(_0x8593('0x3'));var rs=require(_0x8593('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8593('0x5'))['db'];var utils=require(_0x8593('0x6'));var logger=require(_0x8593('0x7'))(_0x8593('0x8'));var config=require('../../config/environment');var jayson=require(_0x8593('0x9'));var client=jayson['client'][_0x8593('0xa')]({'port':0x232a});config[_0x8593('0xb')]=_[_0x8593('0xc')](config['redis'],{'host':_0x8593('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8593('0xe'))[_0x8593('0xf')](socket);function respondWithRpcPromise(_0x13fd6e,_0x51dbe5,_0x4c92bd){return new BPromise(function(_0x595f74,_0x3843f7){return client[_0x8593('0x10')](_0x13fd6e,_0x4c92bd)['then'](function(_0x3d34f5){logger[_0x8593('0x11')]('OpenchannelInteraction,\x20%s,\x20%s',_0x51dbe5,_0x8593('0x12'));logger[_0x8593('0x13')]('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x51dbe5,_0x8593('0x12'),JSON[_0x8593('0x14')](_0x3d34f5));if(_0x3d34f5['error']){if(_0x3d34f5[_0x8593('0x15')][_0x8593('0x16')]===0x1f4){logger[_0x8593('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x51dbe5,_0x3d34f5[_0x8593('0x15')]['message']);return _0x3843f7(_0x3d34f5['error'][_0x8593('0x17')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x51dbe5,_0x3d34f5[_0x8593('0x15')][_0x8593('0x17')]);return _0x595f74(_0x3d34f5[_0x8593('0x15')][_0x8593('0x17')]);}else{logger['info'](_0x8593('0x18'),_0x51dbe5,_0x8593('0x12'));_0x595f74(_0x3d34f5[_0x8593('0x19')]['message']);}})['catch'](function(_0x243f52){logger[_0x8593('0x15')](_0x8593('0x18'),_0x51dbe5,_0x243f52);_0x3843f7(_0x243f52);});});}exports['UpdateOpenchannelInteraction']=function(_0x110497){var _0x3ace4d=this;return new Promise(function(_0x574ed6,_0x360e26){return db[_0x8593('0x1a')][_0x8593('0x1b')](_0x110497['body'],{'raw':_0x110497['options']?_0x110497[_0x8593('0x1c')][_0x8593('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110497[_0x8593('0x1c')]?_0x110497[_0x8593('0x1c')]['where']||null:null,'attributes':_0x110497[_0x8593('0x1c')]?_0x110497[_0x8593('0x1c')][_0x8593('0x1e')]||null:null,'limit':_0x110497[_0x8593('0x1c')]?_0x110497[_0x8593('0x1c')][_0x8593('0x1f')]||null:null})[_0x8593('0x20')](function(_0x368280){logger[_0x8593('0x11')](_0x8593('0x21'),_0x110497);logger[_0x8593('0x13')](_0x8593('0x21'),_0x110497,JSON[_0x8593('0x14')](_0x368280));_0x574ed6(_0x368280);})[_0x8593('0x22')](function(_0x9e441c){logger[_0x8593('0x15')](_0x8593('0x21'),_0x9e441c[_0x8593('0x17')],_0x110497);_0x360e26(_0x3ace4d[_0x8593('0x15')](0x1f4,_0x9e441c[_0x8593('0x17')]));});});};exports[_0x8593('0x23')]=function(_0x3e8de5){return new Promise(function(_0x3c7abb,_0x2f98c2){return db[_0x8593('0x1a')][_0x8593('0x24')]({'where':_0x3e8de5[_0x8593('0x1c')]?_0x3e8de5[_0x8593('0x1c')][_0x8593('0x25')]||null:null})[_0x8593('0x20')](function(_0x117d82){if(_0x117d82){return _0x117d82[_0x8593('0x26')](_0x3e8de5[_0x8593('0x27')][_0x8593('0x28')],_[_0x8593('0x29')](_0x3e8de5[_0x8593('0x27')],['ids','id'])||{});}})[_0x8593('0x2a')](function(_0x577823){logger[_0x8593('0x11')](_0x8593('0x2b'),_0x3e8de5);logger[_0x8593('0x13')](_0x8593('0x2b'),_0x3e8de5,JSON[_0x8593('0x14')](_0x577823));_0x3c7abb(_0x577823);})[_0x8593('0x22')](function(_0x2bffdf){logger[_0x8593('0x15')]('AddTags',_0x2bffdf[_0x8593('0x17')],_0x3e8de5);_0x2f98c2(_this[_0x8593('0x15')](0x1f4,_0x2bffdf[_0x8593('0x17')]));});});}; \ No newline at end of file +var _0x2e35=['socket.io-emitter','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','AddTagsToOpenchannelInteraction','find','where','addTags','ids','omit','body','spread','AddTags','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x18b000,_0x513c1b){var _0xfb7686=function(_0x1f2bb9){while(--_0x1f2bb9){_0x18b000['push'](_0x18b000['shift']());}};_0xfb7686(++_0x513c1b);}(_0x2e35,0x196));var _0x52e3=function(_0x147adc,_0xe6a9db){_0x147adc=_0x147adc-0x0;var _0x332677=_0x2e35[_0x147adc];return _0x332677;};'use strict';var _=require(_0x52e3('0x0'));var util=require(_0x52e3('0x1'));var moment=require('moment');var BPromise=require(_0x52e3('0x2'));var rs=require(_0x52e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x52e3('0x4'))['db'];var utils=require(_0x52e3('0x5'));var logger=require(_0x52e3('0x6'))('rpc');var config=require(_0x52e3('0x7'));var jayson=require(_0x52e3('0x8'));var client=jayson[_0x52e3('0x9')][_0x52e3('0xa')]({'port':0x232a});config[_0x52e3('0xb')]=_[_0x52e3('0xc')](config['redis'],{'host':_0x52e3('0xd'),'port':0x18eb});var socket=require(_0x52e3('0xe'))(new Redis(config['redis']));require('./openchannelInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x34d8ef,_0x1c6399,_0x469f89){return new BPromise(function(_0x450f8f,_0x18b74c){return client['request'](_0x34d8ef,_0x469f89)[_0x52e3('0xf')](function(_0x93a49a){logger[_0x52e3('0x10')](_0x52e3('0x11'),_0x1c6399,_0x52e3('0x12'));logger[_0x52e3('0x13')](_0x52e3('0x14'),_0x1c6399,_0x52e3('0x12'),JSON[_0x52e3('0x15')](_0x93a49a));if(_0x93a49a[_0x52e3('0x16')]){if(_0x93a49a[_0x52e3('0x16')][_0x52e3('0x17')]===0x1f4){logger[_0x52e3('0x16')](_0x52e3('0x11'),_0x1c6399,_0x93a49a['error'][_0x52e3('0x18')]);return _0x18b74c(_0x93a49a[_0x52e3('0x16')][_0x52e3('0x18')]);}logger[_0x52e3('0x16')](_0x52e3('0x11'),_0x1c6399,_0x93a49a['error']['message']);return _0x450f8f(_0x93a49a[_0x52e3('0x16')][_0x52e3('0x18')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x1c6399,'request\x20sent');_0x450f8f(_0x93a49a[_0x52e3('0x19')][_0x52e3('0x18')]);}})['catch'](function(_0x3b5531){logger['error'](_0x52e3('0x11'),_0x1c6399,_0x3b5531);_0x18b74c(_0x3b5531);});});}exports[_0x52e3('0x1a')]=function(_0x4e3be2){var _0xa054be=this;return new Promise(function(_0x52c44f,_0x42d13d){return db[_0x52e3('0x1b')][_0x52e3('0x1c')](_0x4e3be2['body'],{'raw':_0x4e3be2['options']?_0x4e3be2[_0x52e3('0x1d')][_0x52e3('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3be2[_0x52e3('0x1d')]?_0x4e3be2[_0x52e3('0x1d')]['where']||null:null,'attributes':_0x4e3be2[_0x52e3('0x1d')]?_0x4e3be2[_0x52e3('0x1d')][_0x52e3('0x1f')]||null:null,'limit':_0x4e3be2[_0x52e3('0x1d')]?_0x4e3be2[_0x52e3('0x1d')][_0x52e3('0x20')]||null:null})[_0x52e3('0xf')](function(_0x2ce1b6){logger[_0x52e3('0x10')](_0x52e3('0x1a'),_0x4e3be2);logger['debug'](_0x52e3('0x1a'),_0x4e3be2,JSON['stringify'](_0x2ce1b6));_0x52c44f(_0x2ce1b6);})['catch'](function(_0x203ebd){logger[_0x52e3('0x16')]('UpdateOpenchannelInteraction',_0x203ebd[_0x52e3('0x18')],_0x4e3be2);_0x42d13d(_0xa054be[_0x52e3('0x16')](0x1f4,_0x203ebd['message']));});});};exports[_0x52e3('0x21')]=function(_0x1c0d20){return new Promise(function(_0x55d5d1,_0x320346){return db[_0x52e3('0x1b')][_0x52e3('0x22')]({'where':_0x1c0d20[_0x52e3('0x1d')]?_0x1c0d20[_0x52e3('0x1d')][_0x52e3('0x23')]||null:null})[_0x52e3('0xf')](function(_0x366b21){if(_0x366b21){return _0x366b21[_0x52e3('0x24')](_0x1c0d20['body'][_0x52e3('0x25')],_[_0x52e3('0x26')](_0x1c0d20[_0x52e3('0x27')],['ids','id'])||{});}})[_0x52e3('0x28')](function(_0x5778a3){logger[_0x52e3('0x10')](_0x52e3('0x29'),_0x1c0d20);logger['debug'](_0x52e3('0x29'),_0x1c0d20,JSON[_0x52e3('0x15')](_0x5778a3));_0x55d5d1(_0x5778a3);})['catch'](function(_0x17bc4c){logger[_0x52e3('0x16')]('AddTags',_0x17bc4c[_0x52e3('0x18')],_0x1c0d20);_0x320346(_this[_0x52e3('0x16')](0x1f4,_0x17bc4c['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index e64349a..548772d 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 _0xaf79=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update'];(function(_0x5ac55e,_0x5c3ed6){var _0x4c4129=function(_0x5ed53c){while(--_0x5ed53c){_0x5ac55e['push'](_0x5ac55e['shift']());}};_0x4c4129(++_0x5c3ed6);}(_0xaf79,0xc2));var _0x9af7=function(_0x8d33b5,_0x256e21){_0x8d33b5=_0x8d33b5-0x0;var _0x3e2ed7=_0xaf79[_0x8d33b5];return _0x3e2ed7;};'use strict';var OpenchannelInteractionEvents=require(_0x9af7('0x0'));var events=[_0x9af7('0x1'),_0x9af7('0x2'),_0x9af7('0x3')];function createListener(_0x148317,_0x48a1d1){return function(_0x55ae37){_0x48a1d1['emit'](_0x148317,_0x55ae37);};}function removeListener(_0x331dcc,_0x5e2e41){return function(){OpenchannelInteractionEvents['removeListener'](_0x331dcc,_0x5e2e41);};}exports['register']=function(_0x5bb8ff){for(var _0x45fb52=0x0,_0x167957=events[_0x9af7('0x4')];_0x45fb52<_0x167957;_0x45fb52++){var _0x2082d3=events[_0x45fb52];var _0x18edeb=createListener(_0x9af7('0x5')+_0x2082d3,_0x5bb8ff);OpenchannelInteractionEvents['on'](_0x2082d3,_0x18edeb);}}; \ No newline at end of file +var _0xf32c=['openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3208be,_0xe800eb){var _0x2fe4eb=function(_0x14fcb7){while(--_0x14fcb7){_0x3208be['push'](_0x3208be['shift']());}};_0x2fe4eb(++_0xe800eb);}(_0xf32c,0x139));var _0xcf32=function(_0x21d127,_0x586ce7){_0x21d127=_0x21d127-0x0;var _0x77ff7f=_0xf32c[_0x21d127];return _0x77ff7f;};'use strict';var OpenchannelInteractionEvents=require(_0xcf32('0x0'));var events=[_0xcf32('0x1'),_0xcf32('0x2'),_0xcf32('0x3')];function createListener(_0xf10c95,_0x5b09a1){return function(_0x37c2c2){_0x5b09a1[_0xcf32('0x4')](_0xf10c95,_0x37c2c2);};}function removeListener(_0x5055a9,_0x28d539){return function(){OpenchannelInteractionEvents[_0xcf32('0x5')](_0x5055a9,_0x28d539);};}exports[_0xcf32('0x6')]=function(_0x2dc718){for(var _0x4f2b14=0x0,_0x27aea2=events['length'];_0x4f2b14<_0x27aea2;_0x4f2b14++){var _0x233f91=events[_0x4f2b14];var _0x4b67e3=createListener(_0xcf32('0x7')+_0x233f91,_0x2dc718);OpenchannelInteractionEvents['on'](_0x233f91,_0x4b67e3);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index ffb2f08..810078f 100644 --- a/server/api/openchannelMessage/index.js +++ b/server/api/openchannelMessage/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x2e1906,_0xa281e9){var _0x3ea10e=function(_0x19749){while(--_0x19749){_0x2e1906['push'](_0x2e1906['shift']());}};_0x3ea10e(++_0xa281e9);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0xcb91[_0x622035];return _0x326cf2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x65d47e,_0x96d07c){var _0x175407=function(_0x2df16c){while(--_0x2df16c){_0x65d47e['push'](_0x65d47e['shift']());}};_0x175407(++_0x96d07c);}(_0xe706,0xa3));var _0x6e70=function(_0x87239,_0x38c793){_0x87239=_0x87239-0x0;var _0x53af1e=_0xe706[_0x87239];return _0x53af1e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 4dffd21..7357130 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 _0x0fd9=['DATE','STRING','exports','TEXT','medium','BOOLEAN','out'];(function(_0x53f29b,_0x22cf73){var _0x18b486=function(_0x4db84d){while(--_0x4db84d){_0x53f29b['push'](_0x53f29b['shift']());}};_0x18b486(++_0x22cf73);}(_0x0fd9,0xa3));var _0x90fd=function(_0x15942a,_0x13b58c){_0x15942a=_0x15942a-0x0;var _0x36a9fb=_0x0fd9[_0x15942a];return _0x36a9fb;};'use strict';var Sequelize=require('sequelize');module[_0x90fd('0x0')]={'body':{'type':Sequelize[_0x90fd('0x1')](_0x90fd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x90fd('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x90fd('0x4')),'defaultValue':_0x90fd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x90fd('0x5')]},'providerName':{'type':Sequelize[_0x90fd('0x6')]},'providerResponse':{'type':Sequelize[_0x90fd('0x1')]}}; \ No newline at end of file +var _0x8383=['sequelize','medium','BOOLEAN','ENUM','out','DATE','STRING','TEXT'];(function(_0xaf5bf0,_0x1d1fee){var _0x58d9a3=function(_0x4b6606){while(--_0x4b6606){_0xaf5bf0['push'](_0xaf5bf0['shift']());}};_0x58d9a3(++_0x1d1fee);}(_0x8383,0x98));var _0x3838=function(_0x294004,_0x2d300f){_0x294004=_0x294004-0x0;var _0x55d59f=_0x8383[_0x294004];return _0x55d59f;};'use strict';var Sequelize=require(_0x3838('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x3838('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x3838('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x3838('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x3838('0x3')]('in',_0x3838('0x4')),'defaultValue':_0x3838('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x3838('0x5')]},'providerName':{'type':Sequelize[_0x3838('0x6')]},'providerResponse':{'type':Sequelize[_0x3838('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 087a2ca..430a362 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 _0x7a72=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','include','rows','catch','show','includeAll','options','find','create','update','body','params','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','isNil','read1stAt','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','interaction','stringify','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','fullname','email','internal','agent','manual','interface','channel','EventManager','acceptmessage','OpenchannelInteractionId','null','RejectMessage','User','motionChannel','event','rejectmessage','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','socket.io-emitter','register','client','http','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','destroy','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','model','map'];(function(_0x1ee9a1,_0x5f1434){var _0x21270f=function(_0x303251){while(--_0x303251){_0x1ee9a1['push'](_0x1ee9a1['shift']());}};_0x21270f(++_0x5f1434);}(_0x7a72,0xbe));var _0x27a7=function(_0x25291c,_0x161dd6){_0x25291c=_0x25291c-0x0;var _0x3b6190=_0x7a72[_0x25291c];return _0x3b6190;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27a7('0x0'));var zipdir=require(_0x27a7('0x1'));var jsonpatch=require(_0x27a7('0x2'));var rp=require(_0x27a7('0x3'));var moment=require(_0x27a7('0x4'));var BPromise=require(_0x27a7('0x5'));var Mustache=require(_0x27a7('0x6'));var util=require(_0x27a7('0x7'));var path=require('path');var sox=require(_0x27a7('0x8'));var csv=require(_0x27a7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x27a7('0xa'));var _=require(_0x27a7('0xb'));var squel=require(_0x27a7('0xc'));var crypto=require(_0x27a7('0xd'));var jsforce=require(_0x27a7('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x27a7('0x9'));var querystring=require(_0x27a7('0xf'));var Papa=require('papaparse');var Redis=require(_0x27a7('0x10'));var authService=require(_0x27a7('0x11'));var qs=require(_0x27a7('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x27a7('0x13'));var logger=require(_0x27a7('0x14'))(_0x27a7('0x15'));var utils=require(_0x27a7('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x27a7('0x17'))['db'];config['redis']=_[_0x27a7('0x18')](config[_0x27a7('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x27a7('0x1a'))(new Redis(config[_0x27a7('0x19')]));require('./openchannelMessage.socket')[_0x27a7('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0x27a7('0x1c')][_0x27a7('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x27a7('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0xe383e5,_0x2c34c4,_0x239442,_0x3cd96f){return new BPromise(function(_0x32d892,_0x25f1ac){var _0x392e89=_0x3cd96f||client;return _0x392e89[_0x27a7('0x1e')](_0xe383e5,_0x239442)[_0x27a7('0x1f')](function(_0x2098b2){logger[_0x27a7('0x20')](_0x27a7('0x21'),_0x2c34c4,_0x27a7('0x22'));logger[_0x27a7('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x2c34c4,_0x27a7('0x22'),JSON['stringify'](_0x2098b2));if(_0x2098b2['error']){if(_0x2098b2[_0x27a7('0x24')][_0x27a7('0x25')]===0x1f4){logger[_0x27a7('0x24')](_0x27a7('0x21'),_0x2c34c4,_0x2098b2['error'][_0x27a7('0x26')]);return _0x25f1ac(_0x2098b2['error'][_0x27a7('0x26')]);}logger[_0x27a7('0x24')](_0x27a7('0x21'),_0x2c34c4,_0x2098b2[_0x27a7('0x24')][_0x27a7('0x26')]);return _0x32d892(_0x2098b2['error'][_0x27a7('0x26')]);}else{logger[_0x27a7('0x20')](_0x27a7('0x21'),_0x2c34c4,_0x27a7('0x22'));_0x32d892(_0x2098b2[_0x27a7('0x27')][_0x27a7('0x26')]);}})['catch'](function(_0x45a3bf){logger[_0x27a7('0x24')](_0x27a7('0x21'),_0x2c34c4,_0x45a3bf);_0x25f1ac(_0x45a3bf);});});}function respondWithStatusCode(_0x3cde03,_0x49b0fc){_0x49b0fc=_0x49b0fc||0xcc;return function(_0x4c1ea2){if(_0x4c1ea2){return _0x3cde03[_0x27a7('0x28')](_0x49b0fc);}return _0x3cde03[_0x27a7('0x29')](_0x49b0fc)[_0x27a7('0x2a')]();};}function respondWithResult(_0x55dda5,_0xe26e8f){_0xe26e8f=_0xe26e8f||0xc8;return function(_0x5b732f){if(_0x5b732f){return _0x55dda5[_0x27a7('0x29')](_0xe26e8f)['json'](_0x5b732f);}};}function respondWithFilteredResult(_0x26009a,_0x597f1f){return function(_0x3f166c){if(_0x3f166c){var _0x55d8e2=typeof _0x597f1f[_0x27a7('0x2b')]===_0x27a7('0x2c')&&typeof _0x597f1f[_0x27a7('0x2d')]===_0x27a7('0x2c');var _0x12bd47=_0x3f166c[_0x27a7('0x2e')];var _0x18e19c=_0x55d8e2?0x0:_0x597f1f['offset'];var _0x40b5e7=_0x55d8e2?_0x3f166c[_0x27a7('0x2e')]:_0x597f1f[_0x27a7('0x2b')]+_0x597f1f[_0x27a7('0x2d')];var _0x27dba1;if(_0x40b5e7>=_0x12bd47){_0x40b5e7=_0x12bd47;_0x27dba1=0xc8;}else{_0x27dba1=0xce;}_0x26009a[_0x27a7('0x29')](_0x27dba1);return _0x26009a[_0x27a7('0x2f')](_0x27a7('0x30'),_0x18e19c+'-'+_0x40b5e7+'/'+_0x12bd47)[_0x27a7('0x31')](_0x3f166c);}return null;};}function patchUpdates(_0x449e86){return function(_0x34f1ce){try{jsonpatch[_0x27a7('0x32')](_0x34f1ce,_0x449e86,!![]);}catch(_0x24cf4f){return BPromise[_0x27a7('0x33')](_0x24cf4f);}return _0x34f1ce['save']();};}function saveUpdates(_0x2c10dd,_0x4f6e08){return function(_0x16fd06){if(_0x16fd06){return _0x16fd06['update'](_0x2c10dd)[_0x27a7('0x1f')](function(_0xb69632){return _0xb69632;});}return null;};}function removeEntity(_0x1b2c36,_0x1dc256){return function(_0x206699){if(_0x206699){return _0x206699[_0x27a7('0x34')]()[_0x27a7('0x1f')](function(){_0x1b2c36['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d8661,_0x5e218c){return function(_0x303255){if(!_0x303255){_0x3d8661[_0x27a7('0x28')](0x194);}return _0x303255;};}function handleError(_0x3bc72b,_0x1a0850){_0x1a0850=_0x1a0850||0x1f4;return function(_0x49b67c){logger[_0x27a7('0x24')](_0x49b67c['stack']);if(_0x49b67c['name']){delete _0x49b67c[_0x27a7('0x35')];}_0x3bc72b[_0x27a7('0x29')](_0x1a0850)[_0x27a7('0x36')](_0x49b67c);};}exports[_0x27a7('0x37')]=function(_0x563b4c,_0x2cd93a){var _0x1650c2={},_0x3a7f49={},_0x11f9fc={'count':0x0,'rows':[]};var _0x1ae5db=_['map'](db[_0x27a7('0x38')][_0x27a7('0x39')],function(_0x44acc3){return{'name':_0x44acc3[_0x27a7('0x3a')],'type':_0x44acc3[_0x27a7('0x3b')]['key']};});_0x3a7f49[_0x27a7('0x3c')]=_[_0x27a7('0x3d')](_0x1ae5db,'name');_0x3a7f49[_0x27a7('0x3e')]=_[_0x27a7('0x3f')](_0x563b4c[_0x27a7('0x3e')]);_0x3a7f49[_0x27a7('0x40')]=_[_0x27a7('0x41')](_0x3a7f49[_0x27a7('0x3c')],_0x3a7f49[_0x27a7('0x3e')]);_0x1650c2[_0x27a7('0x42')]=_[_0x27a7('0x41')](_0x3a7f49[_0x27a7('0x3c')],qs[_0x27a7('0x43')](_0x563b4c[_0x27a7('0x3e')]['fields']));_0x1650c2['attributes']=_0x1650c2[_0x27a7('0x42')][_0x27a7('0x44')]?_0x1650c2[_0x27a7('0x42')]:_0x3a7f49['model'];if(!_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x45')](_0x27a7('0x46'))){_0x1650c2[_0x27a7('0x2d')]=qs[_0x27a7('0x2d')](_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x2d')]);_0x1650c2[_0x27a7('0x2b')]=qs[_0x27a7('0x2b')](_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x2b')]);}_0x1650c2[_0x27a7('0x47')]=qs[_0x27a7('0x48')](_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x48')]);_0x1650c2['where']=qs['filters'](_[_0x27a7('0x49')](_0x563b4c['query'],_0x3a7f49[_0x27a7('0x40')]),_0x1ae5db);if(_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x4a')]){_0x1650c2['where']=_[_0x27a7('0x4b')](_0x1650c2[_0x27a7('0x4c')],{'$or':_[_0x27a7('0x3d')](_0x1ae5db,function(_0x6e6283){if(_0x6e6283[_0x27a7('0x3b')]!=='VIRTUAL'){var _0x426f98={};_0x426f98[_0x6e6283[_0x27a7('0x35')]]={'$like':'%'+_0x563b4c[_0x27a7('0x3e')][_0x27a7('0x4a')]+'%'};return _0x426f98;}})});}_0x1650c2=_[_0x27a7('0x4b')]({},_0x1650c2,_0x563b4c['options']);var _0x151b95={'where':_0x1650c2[_0x27a7('0x4c')]};return db[_0x27a7('0x38')][_0x27a7('0x2e')](_0x151b95)['then'](function(_0x4009b2){_0x11f9fc[_0x27a7('0x2e')]=_0x4009b2;if(_0x563b4c[_0x27a7('0x3e')]['includeAll']){_0x1650c2[_0x27a7('0x4d')]=[{'all':!![]}];}return db[_0x27a7('0x38')]['findAll'](_0x1650c2);})['then'](function(_0x44b695){_0x11f9fc[_0x27a7('0x4e')]=_0x44b695;return _0x11f9fc;})[_0x27a7('0x1f')](respondWithFilteredResult(_0x2cd93a,_0x1650c2))[_0x27a7('0x4f')](handleError(_0x2cd93a,null));};exports[_0x27a7('0x50')]=function(_0x45df95,_0x4e3d1c){var _0x25684f={'raw':!![],'where':{'id':_0x45df95['params']['id']}},_0x43c0b5={};_0x43c0b5[_0x27a7('0x3c')]=_[_0x27a7('0x3f')](db[_0x27a7('0x38')][_0x27a7('0x39')]);_0x43c0b5['query']=_[_0x27a7('0x3f')](_0x45df95['query']);_0x43c0b5[_0x27a7('0x40')]=_[_0x27a7('0x41')](_0x43c0b5['model'],_0x43c0b5[_0x27a7('0x3e')]);_0x25684f['attributes']=_[_0x27a7('0x41')](_0x43c0b5[_0x27a7('0x3c')],qs['fields'](_0x45df95[_0x27a7('0x3e')][_0x27a7('0x43')]));_0x25684f[_0x27a7('0x42')]=_0x25684f[_0x27a7('0x42')][_0x27a7('0x44')]?_0x25684f[_0x27a7('0x42')]:_0x43c0b5[_0x27a7('0x3c')];if(_0x45df95[_0x27a7('0x3e')][_0x27a7('0x51')]){_0x25684f['include']=[{'all':!![]}];}_0x25684f=_[_0x27a7('0x4b')]({},_0x25684f,_0x45df95[_0x27a7('0x52')]);return db[_0x27a7('0x38')][_0x27a7('0x53')](_0x25684f)['then'](handleEntityNotFound(_0x4e3d1c,null))[_0x27a7('0x1f')](respondWithResult(_0x4e3d1c,null))['catch'](handleError(_0x4e3d1c,null));};exports[_0x27a7('0x54')]=function(_0x154351,_0x245dd4){return db['OpenchannelMessage'][_0x27a7('0x54')](_0x154351['body'],{})[_0x27a7('0x1f')](respondWithResult(_0x245dd4,0xc9))[_0x27a7('0x4f')](handleError(_0x245dd4,null));};exports[_0x27a7('0x55')]=function(_0x504688,_0x1652d5){if(_0x504688['body']['id']){delete _0x504688[_0x27a7('0x56')]['id'];}return db[_0x27a7('0x38')][_0x27a7('0x53')]({'where':{'id':_0x504688[_0x27a7('0x57')]['id']}})[_0x27a7('0x1f')](handleEntityNotFound(_0x1652d5,null))[_0x27a7('0x1f')](saveUpdates(_0x504688[_0x27a7('0x56')],null))[_0x27a7('0x1f')](respondWithResult(_0x1652d5,null))[_0x27a7('0x4f')](handleError(_0x1652d5,null));};exports[_0x27a7('0x34')]=function(_0x528218,_0x5ab275){return db['OpenchannelMessage'][_0x27a7('0x53')]({'where':{'id':_0x528218[_0x27a7('0x57')]['id']}})[_0x27a7('0x1f')](handleEntityNotFound(_0x5ab275,null))[_0x27a7('0x1f')](removeEntity(_0x5ab275,null))['catch'](handleError(_0x5ab275,null));};exports['describe']=function(_0x3b3c70,_0x155b26){return db[_0x27a7('0x38')]['describe']()[_0x27a7('0x1f')](respondWithResult(_0x155b26,null))[_0x27a7('0x4f')](handleError(_0x155b26,null));};var interaction_log=require(_0x27a7('0x14'))(_0x27a7('0x58'));exports['accept']=function(_0x29c270,_0x4dfa16,_0x100c9b){var _0x24276c={'agent':{},'channel':_0x27a7('0x59')};if(_0x29c270['body']['id']){delete _0x29c270[_0x27a7('0x56')]['id'];}_0x29c270[_0x27a7('0x56')]['read']=!![];_0x29c270[_0x27a7('0x56')][_0x27a7('0x5a')]=moment()[_0x27a7('0x5b')](_0x27a7('0x5c'));_0x29c270[_0x27a7('0x56')][_0x27a7('0x5d')]=_0x29c270['body'][_0x27a7('0x5d')]||_0x29c270['user']['id'];_0x24276c['agent']['id']=_0x29c270['body']['UserId'];return db[_0x27a7('0x38')]['find']({'where':{'id':_0x29c270[_0x27a7('0x57')]['id'],'UserId':null}})[_0x27a7('0x1f')](handleEntityNotFound(_0x4dfa16,null))[_0x27a7('0x1f')](saveUpdates(_0x29c270[_0x27a7('0x56')],null))[_0x27a7('0x1f')](function(_0xeb62fb){if(_0xeb62fb){_0x24276c['message']=_0xeb62fb[_0x27a7('0x5e')]({'plain':!![]});return db[_0x27a7('0x5f')][_0x27a7('0x53')]({'where':{'id':_0xeb62fb['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4dfa16,null))[_0x27a7('0x1f')](function(_0x4fdf89){if(_0x4fdf89){return _0x4fdf89[_0x27a7('0x55')]({'UserId':_0x29c270['body'][_0x27a7('0x5d')],'read1stAt':_[_0x27a7('0x60')](_0x4fdf89[_0x27a7('0x61')])?moment()[_0x27a7('0x5b')](_0x27a7('0x5c')):undefined});}return null;})['then'](function(_0x16ef5e){if(_0x16ef5e){_0x24276c['interaction']=_0x16ef5e['get']({'plain':!![]});interaction_log[_0x27a7('0x20')](_0x27a7('0x62'),_0x29c270[_0x27a7('0x63')]['id'],_0x29c270['user'][_0x27a7('0x35')],_0x29c270[_0x27a7('0x63')]['role'],_0x24276c[_0x27a7('0x64')]['id'],_0x29c270[_0x27a7('0x56')]?JSON[_0x27a7('0x65')](_0x29c270[_0x27a7('0x56')]):'null');return respondWithRpcPromise(_0x27a7('0x66'),_0x27a7('0x67'),_0x24276c);}return null;})[_0x27a7('0x1f')](function(_0x45d6c5){var _0xa922be=_0x27a7('0x68')+_0x45d6c5[_0x27a7('0x26')][_0x27a7('0x69')];return db[_0x27a7('0x6a')][_0x27a7('0x3e')](_0xa922be,{'type':db[_0x27a7('0x6b')]['QueryTypes'][_0x27a7('0x6c')],'raw':!![]})[_0x27a7('0x1f')](function(_0x18f47b){return _0x18f47b;});})[_0x27a7('0x1f')](function(_0x197056){if(_0x197056){_0x24276c[_0x27a7('0x26')][_0x27a7('0x6d')]=_0x197056[0x0];if(!_0x29c270[_0x27a7('0x56')][_0x27a7('0x5d')])return;return db['User'][_0x27a7('0x53')]({'where':{'id':_0x29c270[_0x27a7('0x56')][_0x27a7('0x5d')],'role':'agent'},'attributes':['id','name',_0x27a7('0x6e'),_0x27a7('0x6f'),_0x27a7('0x70')],'raw':!![]});}return null;})[_0x27a7('0x1f')](function(_0x3da6bf){if(!_0x3da6bf)return null;_0x24276c['message'][_0x27a7('0x71')]=_0x3da6bf;return _0x24276c;})[_0x27a7('0x1f')](function(_0x355b17){if(_0x355b17){if(_0x29c270['body'][_0x27a7('0x72')]){_0x24276c[_0x27a7('0x26')][_0x27a7('0x73')]=util[_0x27a7('0x5b')]('SIP/%s',_0x29c270['user'][_0x27a7('0x35')]);_0x24276c[_0x27a7('0x26')][_0x27a7('0x74')]=_0x24276c[_0x27a7('0x74')];_0x24276c['message']['motionChannel']=_0x24276c[_0x27a7('0x74')];_0x24276c['message']['event']='accept';return respondWithRpcPromise('EventManager',_0x27a7('0x75'),{'event':_0x27a7('0x76'),'message':_0x24276c['message']},client9002)[_0x27a7('0x1f')](function(){return _0x24276c;});}return _0x24276c;}return null;})['then'](respondWithResult(_0x4dfa16,null))[_0x27a7('0x4f')](handleError(_0x4dfa16,null));};var interaction_log=require(_0x27a7('0x14'))(_0x27a7('0x58'));exports['reject']=function(_0xe13ab7,_0x1fa1c0,_0x1cc1ae){var _0x1b852d={'agent':{},'channel':_0x27a7('0x59')};if(_0xe13ab7[_0x27a7('0x56')]['id']){delete _0xe13ab7[_0x27a7('0x56')]['id'];}_0xe13ab7[_0x27a7('0x56')][_0x27a7('0x5d')]=_0xe13ab7[_0x27a7('0x56')]['UserId']||_0xe13ab7[_0x27a7('0x63')]['id'];_0x1b852d[_0x27a7('0x71')]['id']=_0xe13ab7['body'][_0x27a7('0x5d')];return db[_0x27a7('0x38')]['find']({'where':{'id':_0xe13ab7[_0x27a7('0x57')]['id'],'UserId':null}})[_0x27a7('0x1f')](handleEntityNotFound(_0x1fa1c0,null))[_0x27a7('0x1f')](function(_0x231e1b){if(_0x231e1b){_0x1b852d[_0x27a7('0x26')]=_0x231e1b['get']({'plain':!![]});return db[_0x27a7('0x5f')][_0x27a7('0x53')]({'where':{'id':_0x231e1b[_0x27a7('0x77')]}});}return null;})[_0x27a7('0x1f')](handleEntityNotFound(_0x1fa1c0,null))[_0x27a7('0x1f')](function(_0x5c1b85){if(_0x5c1b85){_0x1b852d[_0x27a7('0x64')]=_0x5c1b85[_0x27a7('0x5e')]({'plain':!![]});interaction_log[_0x27a7('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0xe13ab7[_0x27a7('0x63')]['id'],_0xe13ab7['user'][_0x27a7('0x35')],_0xe13ab7[_0x27a7('0x63')]['role'],_0x1b852d[_0x27a7('0x64')]['id'],_0xe13ab7[_0x27a7('0x56')]?JSON['stringify'](_0xe13ab7['body']):_0x27a7('0x78'));return respondWithRpcPromise(_0x27a7('0x79'),'rejectMessage',_0x1b852d);}return null;})['then'](function(_0x461d52){var _0x5b9b72=_0x27a7('0x68')+_0x461d52['message'][_0x27a7('0x69')];return db[_0x27a7('0x6a')][_0x27a7('0x3e')](_0x5b9b72,{'type':db[_0x27a7('0x6b')]['QueryTypes'][_0x27a7('0x6c')],'raw':!![]})['then'](function(_0x96d43c){return _0x96d43c;});})[_0x27a7('0x1f')](function(_0x7a809f){if(_0x7a809f){_0x1b852d[_0x27a7('0x26')][_0x27a7('0x6d')]=_0x7a809f[0x0];if(!_0xe13ab7[_0x27a7('0x56')][_0x27a7('0x5d')])return;return db[_0x27a7('0x7a')][_0x27a7('0x53')]({'where':{'id':_0xe13ab7[_0x27a7('0x56')]['UserId'],'role':'agent'},'attributes':['id',_0x27a7('0x35'),_0x27a7('0x6e'),_0x27a7('0x6f'),_0x27a7('0x70')],'raw':!![]});}return null;})[_0x27a7('0x1f')](function(_0xcf60c2){if(!_0xcf60c2)return null;_0x1b852d[_0x27a7('0x26')][_0x27a7('0x71')]=_0xcf60c2;return _0x1b852d;})[_0x27a7('0x1f')](function(_0x30a2c7){if(_0x30a2c7){_0x30a2c7[_0x27a7('0x26')]['interface']=util[_0x27a7('0x5b')]('SIP/%s',_0xe13ab7['user'][_0x27a7('0x35')]);_0x30a2c7[_0x27a7('0x26')][_0x27a7('0x74')]=_0x1b852d[_0x27a7('0x74')];_0x30a2c7['message'][_0x27a7('0x7b')]=_0x1b852d[_0x27a7('0x74')];_0x30a2c7['message'][_0x27a7('0x7c')]=_0x27a7('0x33');respondWithRpcPromise(_0x27a7('0x75'),'EventManager',{'event':_0x27a7('0x7d'),'message':_0x30a2c7[_0x27a7('0x26')]},client9002);return _0x1b852d;}return null;})[_0x27a7('0x1f')](respondWithResult(_0x1fa1c0,null))[_0x27a7('0x4f')](handleError(_0x1fa1c0,null));}; \ No newline at end of file +var _0x9973=['index','map','OpenchannelMessage','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','options','where','includeAll','findAll','rows','params','keys','length','merge','catch','create','body','find','describe','openchannel-interactions','accept','openchannel','read','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','interaction','get','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','rejectmessage','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','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','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','http','client','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','name','send'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0x9973,0x157));var _0x3997=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x9973[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3997('0x0'));var zipdir=require(_0x3997('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3997('0x2'));var moment=require(_0x3997('0x3'));var BPromise=require(_0x3997('0x4'));var Mustache=require(_0x3997('0x5'));var util=require(_0x3997('0x6'));var path=require(_0x3997('0x7'));var sox=require(_0x3997('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3997('0x9'));var _=require(_0x3997('0xa'));var squel=require(_0x3997('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3997('0xc'));var querystring=require(_0x3997('0xd'));var Papa=require(_0x3997('0xe'));var Redis=require(_0x3997('0xf'));var authService=require(_0x3997('0x10'));var qs=require(_0x3997('0x11'));var as=require(_0x3997('0x12'));var hardwareService=require(_0x3997('0x13'));var logger=require(_0x3997('0x14'))(_0x3997('0x15'));var utils=require(_0x3997('0x16'));var config=require(_0x3997('0x17'));var licenseUtil=require(_0x3997('0x18'));var db=require(_0x3997('0x19'))['db'];config[_0x3997('0x1a')]=_[_0x3997('0x1b')](config[_0x3997('0x1a')],{'host':_0x3997('0x1c'),'port':0x18eb});var socket=require(_0x3997('0x1d'))(new Redis(config[_0x3997('0x1a')]));require(_0x3997('0x1e'))[_0x3997('0x1f')](socket);var jayson=require(_0x3997('0x20'));var client=jayson['client'][_0x3997('0x21')]({'port':0x232c});var client9002=jayson[_0x3997('0x22')][_0x3997('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2bc94f,_0x59bcaa,_0x444521,_0x3b66f3){return new BPromise(function(_0x4cb897,_0x591b3c){var _0x29280d=_0x3b66f3||client;return _0x29280d[_0x3997('0x23')](_0x2bc94f,_0x444521)['then'](function(_0x26fa41){logger[_0x3997('0x24')](_0x3997('0x25'),_0x59bcaa,_0x3997('0x26'));logger[_0x3997('0x27')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x59bcaa,_0x3997('0x26'),JSON[_0x3997('0x28')](_0x26fa41));if(_0x26fa41[_0x3997('0x29')]){if(_0x26fa41['error'][_0x3997('0x2a')]===0x1f4){logger[_0x3997('0x29')]('OpenchannelMessage,\x20%s,\x20%s',_0x59bcaa,_0x26fa41[_0x3997('0x29')][_0x3997('0x2b')]);return _0x591b3c(_0x26fa41[_0x3997('0x29')]['message']);}logger['error'](_0x3997('0x25'),_0x59bcaa,_0x26fa41[_0x3997('0x29')][_0x3997('0x2b')]);return _0x4cb897(_0x26fa41[_0x3997('0x29')]['message']);}else{logger[_0x3997('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x59bcaa,'request\x20sent');_0x4cb897(_0x26fa41[_0x3997('0x2c')][_0x3997('0x2b')]);}})['catch'](function(_0x5ea781){logger[_0x3997('0x29')](_0x3997('0x25'),_0x59bcaa,_0x5ea781);_0x591b3c(_0x5ea781);});});}function respondWithStatusCode(_0x2d06a5,_0x58fb7b){_0x58fb7b=_0x58fb7b||0xcc;return function(_0x4ce5fb){if(_0x4ce5fb){return _0x2d06a5['sendStatus'](_0x58fb7b);}return _0x2d06a5[_0x3997('0x2d')](_0x58fb7b)[_0x3997('0x2e')]();};}function respondWithResult(_0xa9ebe7,_0x455265){_0x455265=_0x455265||0xc8;return function(_0x134fc4){if(_0x134fc4){return _0xa9ebe7[_0x3997('0x2d')](_0x455265)['json'](_0x134fc4);}};}function respondWithFilteredResult(_0x5ad688,_0x390f8e){return function(_0x36b4ee){if(_0x36b4ee){var _0x55cee5=typeof _0x390f8e[_0x3997('0x2f')]===_0x3997('0x30')&&typeof _0x390f8e[_0x3997('0x31')]===_0x3997('0x30');var _0x8ad88b=_0x36b4ee[_0x3997('0x32')];var _0x5cd2a8=_0x55cee5?0x0:_0x390f8e[_0x3997('0x2f')];var _0x2e36ee=_0x55cee5?_0x36b4ee[_0x3997('0x32')]:_0x390f8e[_0x3997('0x2f')]+_0x390f8e[_0x3997('0x31')];var _0x4aac7c;if(_0x2e36ee>=_0x8ad88b){_0x2e36ee=_0x8ad88b;_0x4aac7c=0xc8;}else{_0x4aac7c=0xce;}_0x5ad688[_0x3997('0x2d')](_0x4aac7c);return _0x5ad688[_0x3997('0x33')](_0x3997('0x34'),_0x5cd2a8+'-'+_0x2e36ee+'/'+_0x8ad88b)[_0x3997('0x35')](_0x36b4ee);}return null;};}function patchUpdates(_0x26413d){return function(_0x7b3b3f){try{jsonpatch['apply'](_0x7b3b3f,_0x26413d,!![]);}catch(_0x189b3b){return BPromise[_0x3997('0x36')](_0x189b3b);}return _0x7b3b3f[_0x3997('0x37')]();};}function saveUpdates(_0x1259ea,_0x141651){return function(_0x27c10a){if(_0x27c10a){return _0x27c10a[_0x3997('0x38')](_0x1259ea)[_0x3997('0x39')](function(_0x16b892){return _0x16b892;});}return null;};}function removeEntity(_0x23e04e,_0x28becb){return function(_0x3fe102){if(_0x3fe102){return _0x3fe102[_0x3997('0x3a')]()[_0x3997('0x39')](function(){_0x23e04e[_0x3997('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4600ae,_0x35facd){return function(_0x14707b){if(!_0x14707b){_0x4600ae[_0x3997('0x3b')](0x194);}return _0x14707b;};}function handleError(_0x59d7b9,_0xb7b84f){_0xb7b84f=_0xb7b84f||0x1f4;return function(_0x211187){logger[_0x3997('0x29')](_0x211187['stack']);if(_0x211187[_0x3997('0x3c')]){delete _0x211187[_0x3997('0x3c')];}_0x59d7b9[_0x3997('0x2d')](_0xb7b84f)[_0x3997('0x3d')](_0x211187);};}exports[_0x3997('0x3e')]=function(_0x364129,_0xc8d681){var _0x41bd78={},_0x4f8c13={},_0x2126cb={'count':0x0,'rows':[]};var _0x4fed9f=_[_0x3997('0x3f')](db[_0x3997('0x40')][_0x3997('0x41')],function(_0x19a032){return{'name':_0x19a032['fieldName'],'type':_0x19a032[_0x3997('0x42')][_0x3997('0x43')]};});_0x4f8c13[_0x3997('0x44')]=_[_0x3997('0x3f')](_0x4fed9f,'name');_0x4f8c13[_0x3997('0x45')]=_['keys'](_0x364129[_0x3997('0x45')]);_0x4f8c13[_0x3997('0x46')]=_[_0x3997('0x47')](_0x4f8c13[_0x3997('0x44')],_0x4f8c13[_0x3997('0x45')]);_0x41bd78[_0x3997('0x48')]=_[_0x3997('0x47')](_0x4f8c13['model'],qs[_0x3997('0x49')](_0x364129[_0x3997('0x45')][_0x3997('0x49')]));_0x41bd78[_0x3997('0x48')]=_0x41bd78['attributes']['length']?_0x41bd78[_0x3997('0x48')]:_0x4f8c13['model'];if(!_0x364129[_0x3997('0x45')][_0x3997('0x4a')](_0x3997('0x4b'))){_0x41bd78[_0x3997('0x31')]=qs['limit'](_0x364129[_0x3997('0x45')][_0x3997('0x31')]);_0x41bd78['offset']=qs[_0x3997('0x2f')](_0x364129[_0x3997('0x45')][_0x3997('0x2f')]);}_0x41bd78[_0x3997('0x4c')]=qs[_0x3997('0x4d')](_0x364129[_0x3997('0x45')]['sort']);_0x41bd78['where']=qs['filters'](_[_0x3997('0x4e')](_0x364129[_0x3997('0x45')],_0x4f8c13[_0x3997('0x46')]),_0x4fed9f);if(_0x364129['query'][_0x3997('0x4f')]){_0x41bd78['where']=_['merge'](_0x41bd78['where'],{'$or':_[_0x3997('0x3f')](_0x4fed9f,function(_0x22bd85){if(_0x22bd85[_0x3997('0x42')]!==_0x3997('0x50')){var _0x5df23c={};_0x5df23c[_0x22bd85[_0x3997('0x3c')]]={'$like':'%'+_0x364129['query'][_0x3997('0x4f')]+'%'};return _0x5df23c;}})});}_0x41bd78=_['merge']({},_0x41bd78,_0x364129[_0x3997('0x51')]);var _0x5b4e14={'where':_0x41bd78[_0x3997('0x52')]};return db['OpenchannelMessage'][_0x3997('0x32')](_0x5b4e14)[_0x3997('0x39')](function(_0x1b8ba2){_0x2126cb[_0x3997('0x32')]=_0x1b8ba2;if(_0x364129[_0x3997('0x45')][_0x3997('0x53')]){_0x41bd78['include']=[{'all':!![]}];}return db[_0x3997('0x40')][_0x3997('0x54')](_0x41bd78);})[_0x3997('0x39')](function(_0x271a41){_0x2126cb[_0x3997('0x55')]=_0x271a41;return _0x2126cb;})[_0x3997('0x39')](respondWithFilteredResult(_0xc8d681,_0x41bd78))['catch'](handleError(_0xc8d681,null));};exports['show']=function(_0x751668,_0x5a0d5a){var _0xb2fcc2={'raw':!![],'where':{'id':_0x751668[_0x3997('0x56')]['id']}},_0x4dc7db={};_0x4dc7db[_0x3997('0x44')]=_[_0x3997('0x57')](db[_0x3997('0x40')]['rawAttributes']);_0x4dc7db['query']=_[_0x3997('0x57')](_0x751668['query']);_0x4dc7db[_0x3997('0x46')]=_[_0x3997('0x47')](_0x4dc7db[_0x3997('0x44')],_0x4dc7db[_0x3997('0x45')]);_0xb2fcc2[_0x3997('0x48')]=_[_0x3997('0x47')](_0x4dc7db[_0x3997('0x44')],qs[_0x3997('0x49')](_0x751668['query'][_0x3997('0x49')]));_0xb2fcc2[_0x3997('0x48')]=_0xb2fcc2[_0x3997('0x48')][_0x3997('0x58')]?_0xb2fcc2[_0x3997('0x48')]:_0x4dc7db[_0x3997('0x44')];if(_0x751668[_0x3997('0x45')][_0x3997('0x53')]){_0xb2fcc2['include']=[{'all':!![]}];}_0xb2fcc2=_[_0x3997('0x59')]({},_0xb2fcc2,_0x751668[_0x3997('0x51')]);return db[_0x3997('0x40')]['find'](_0xb2fcc2)[_0x3997('0x39')](handleEntityNotFound(_0x5a0d5a,null))[_0x3997('0x39')](respondWithResult(_0x5a0d5a,null))[_0x3997('0x5a')](handleError(_0x5a0d5a,null));};exports[_0x3997('0x5b')]=function(_0x1d414c,_0x44aa6c){return db[_0x3997('0x40')][_0x3997('0x5b')](_0x1d414c[_0x3997('0x5c')],{})[_0x3997('0x39')](respondWithResult(_0x44aa6c,0xc9))[_0x3997('0x5a')](handleError(_0x44aa6c,null));};exports['update']=function(_0x8d18f9,_0x34c748){if(_0x8d18f9[_0x3997('0x5c')]['id']){delete _0x8d18f9[_0x3997('0x5c')]['id'];}return db[_0x3997('0x40')][_0x3997('0x5d')]({'where':{'id':_0x8d18f9[_0x3997('0x56')]['id']}})['then'](handleEntityNotFound(_0x34c748,null))['then'](saveUpdates(_0x8d18f9[_0x3997('0x5c')],null))[_0x3997('0x39')](respondWithResult(_0x34c748,null))[_0x3997('0x5a')](handleError(_0x34c748,null));};exports[_0x3997('0x3a')]=function(_0x4b009a,_0x5eb970){return db[_0x3997('0x40')][_0x3997('0x5d')]({'where':{'id':_0x4b009a[_0x3997('0x56')]['id']}})[_0x3997('0x39')](handleEntityNotFound(_0x5eb970,null))[_0x3997('0x39')](removeEntity(_0x5eb970,null))[_0x3997('0x5a')](handleError(_0x5eb970,null));};exports['describe']=function(_0x3017f3,_0x2e5937){return db['OpenchannelMessage'][_0x3997('0x5e')]()[_0x3997('0x39')](respondWithResult(_0x2e5937,null))[_0x3997('0x5a')](handleError(_0x2e5937,null));};var interaction_log=require('../../config/logger')(_0x3997('0x5f'));exports[_0x3997('0x60')]=function(_0x38f6bf,_0x50cd45,_0xe6e006){var _0x37cf2b={'agent':{},'channel':_0x3997('0x61')};if(_0x38f6bf[_0x3997('0x5c')]['id']){delete _0x38f6bf[_0x3997('0x5c')]['id'];}_0x38f6bf[_0x3997('0x5c')][_0x3997('0x62')]=!![];_0x38f6bf[_0x3997('0x5c')][_0x3997('0x63')]=moment()[_0x3997('0x64')]('YYYY-MM-DD\x20HH:mm:ss');_0x38f6bf['body']['UserId']=_0x38f6bf[_0x3997('0x5c')][_0x3997('0x65')]||_0x38f6bf[_0x3997('0x66')]['id'];_0x37cf2b[_0x3997('0x67')]['id']=_0x38f6bf['body'][_0x3997('0x65')];return db[_0x3997('0x40')][_0x3997('0x5d')]({'where':{'id':_0x38f6bf[_0x3997('0x56')]['id'],'UserId':null}})[_0x3997('0x39')](handleEntityNotFound(_0x50cd45,null))[_0x3997('0x39')](saveUpdates(_0x38f6bf[_0x3997('0x5c')],null))[_0x3997('0x39')](function(_0x3dbc48){if(_0x3dbc48){_0x37cf2b['message']=_0x3dbc48['get']({'plain':!![]});return db[_0x3997('0x68')][_0x3997('0x5d')]({'where':{'id':_0x3dbc48[_0x3997('0x69')]}});}return null;})[_0x3997('0x39')](handleEntityNotFound(_0x50cd45,null))[_0x3997('0x39')](function(_0x1d3c5a){if(_0x1d3c5a){return _0x1d3c5a[_0x3997('0x38')]({'UserId':_0x38f6bf['body'][_0x3997('0x65')],'read1stAt':_[_0x3997('0x6a')](_0x1d3c5a['read1stAt'])?moment()[_0x3997('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3997('0x39')](function(_0x38a743){if(_0x38a743){_0x37cf2b[_0x3997('0x6b')]=_0x38a743[_0x3997('0x6c')]({'plain':!![]});interaction_log[_0x3997('0x24')](_0x3997('0x6d'),_0x38f6bf[_0x3997('0x66')]['id'],_0x38f6bf[_0x3997('0x66')][_0x3997('0x3c')],_0x38f6bf[_0x3997('0x66')][_0x3997('0x6e')],_0x37cf2b[_0x3997('0x6b')]['id'],_0x38f6bf[_0x3997('0x5c')]?JSON['stringify'](_0x38f6bf[_0x3997('0x5c')]):'null');return respondWithRpcPromise(_0x3997('0x6f'),_0x3997('0x70'),_0x37cf2b);}return null;})[_0x3997('0x39')](function(_0x23c46c){var _0x177c87=_0x3997('0x71')+_0x23c46c[_0x3997('0x2b')][_0x3997('0x72')];return db[_0x3997('0x73')][_0x3997('0x45')](_0x177c87,{'type':db[_0x3997('0x74')][_0x3997('0x75')][_0x3997('0x76')],'raw':!![]})[_0x3997('0x39')](function(_0x1a0668){return _0x1a0668;});})[_0x3997('0x39')](function(_0x369a93){if(_0x369a93){_0x37cf2b[_0x3997('0x2b')][_0x3997('0x77')]=_0x369a93[0x0];if(!_0x38f6bf[_0x3997('0x5c')][_0x3997('0x65')])return;return db[_0x3997('0x78')]['find']({'where':{'id':_0x38f6bf[_0x3997('0x5c')][_0x3997('0x65')],'role':_0x3997('0x67')},'attributes':['id',_0x3997('0x3c'),_0x3997('0x79'),_0x3997('0x7a'),'internal'],'raw':!![]});}return null;})[_0x3997('0x39')](function(_0x20b471){if(!_0x20b471)return null;_0x37cf2b[_0x3997('0x2b')]['agent']=_0x20b471;return _0x37cf2b;})[_0x3997('0x39')](function(_0x5eaa43){if(_0x5eaa43){if(_0x38f6bf[_0x3997('0x5c')][_0x3997('0x7b')]){_0x37cf2b[_0x3997('0x2b')]['interface']=util[_0x3997('0x64')](_0x3997('0x7c'),_0x38f6bf[_0x3997('0x66')][_0x3997('0x3c')]);_0x37cf2b[_0x3997('0x2b')]['channel']=_0x37cf2b[_0x3997('0x7d')];_0x37cf2b['message'][_0x3997('0x7e')]=_0x37cf2b[_0x3997('0x7d')];_0x37cf2b[_0x3997('0x2b')][_0x3997('0x7f')]='accept';return respondWithRpcPromise('EventManager',_0x3997('0x80'),{'event':_0x3997('0x81'),'message':_0x37cf2b[_0x3997('0x2b')]},client9002)[_0x3997('0x39')](function(){return _0x37cf2b;});}return _0x37cf2b;}return null;})['then'](respondWithResult(_0x50cd45,null))[_0x3997('0x5a')](handleError(_0x50cd45,null));};var interaction_log=require(_0x3997('0x14'))('openchannel-interactions');exports[_0x3997('0x36')]=function(_0x3d1593,_0x55daca,_0x3dddf7){var _0x511324={'agent':{},'channel':'openchannel'};if(_0x3d1593['body']['id']){delete _0x3d1593[_0x3997('0x5c')]['id'];}_0x3d1593['body'][_0x3997('0x65')]=_0x3d1593[_0x3997('0x5c')][_0x3997('0x65')]||_0x3d1593['user']['id'];_0x511324[_0x3997('0x67')]['id']=_0x3d1593[_0x3997('0x5c')][_0x3997('0x65')];return db[_0x3997('0x40')][_0x3997('0x5d')]({'where':{'id':_0x3d1593[_0x3997('0x56')]['id'],'UserId':null}})[_0x3997('0x39')](handleEntityNotFound(_0x55daca,null))['then'](function(_0xab952d){if(_0xab952d){_0x511324[_0x3997('0x2b')]=_0xab952d[_0x3997('0x6c')]({'plain':!![]});return db[_0x3997('0x68')][_0x3997('0x5d')]({'where':{'id':_0xab952d[_0x3997('0x69')]}});}return null;})[_0x3997('0x39')](handleEntityNotFound(_0x55daca,null))[_0x3997('0x39')](function(_0x180b15){if(_0x180b15){_0x511324[_0x3997('0x6b')]=_0x180b15[_0x3997('0x6c')]({'plain':!![]});interaction_log[_0x3997('0x24')](_0x3997('0x82'),_0x3d1593[_0x3997('0x66')]['id'],_0x3d1593[_0x3997('0x66')][_0x3997('0x3c')],_0x3d1593[_0x3997('0x66')]['role'],_0x511324['interaction']['id'],_0x3d1593[_0x3997('0x5c')]?JSON[_0x3997('0x28')](_0x3d1593[_0x3997('0x5c')]):'null');return respondWithRpcPromise(_0x3997('0x83'),_0x3997('0x84'),_0x511324);}return null;})['then'](function(_0x4502ac){var _0x4b0cd0=_0x3997('0x71')+_0x4502ac['message'][_0x3997('0x72')];return db[_0x3997('0x73')][_0x3997('0x45')](_0x4b0cd0,{'type':db[_0x3997('0x74')]['QueryTypes']['SELECT'],'raw':!![]})[_0x3997('0x39')](function(_0x582958){return _0x582958;});})[_0x3997('0x39')](function(_0x529981){if(_0x529981){_0x511324['message']['contact']=_0x529981[0x0];if(!_0x3d1593['body']['UserId'])return;return db[_0x3997('0x78')][_0x3997('0x5d')]({'where':{'id':_0x3d1593[_0x3997('0x5c')]['UserId'],'role':_0x3997('0x67')},'attributes':['id',_0x3997('0x3c'),_0x3997('0x79'),_0x3997('0x7a'),'internal'],'raw':!![]});}return null;})[_0x3997('0x39')](function(_0x88ca1d){if(!_0x88ca1d)return null;_0x511324[_0x3997('0x2b')]['agent']=_0x88ca1d;return _0x511324;})['then'](function(_0x2c8cb1){if(_0x2c8cb1){_0x2c8cb1[_0x3997('0x2b')][_0x3997('0x85')]=util[_0x3997('0x64')](_0x3997('0x7c'),_0x3d1593['user'][_0x3997('0x3c')]);_0x2c8cb1[_0x3997('0x2b')][_0x3997('0x7d')]=_0x511324[_0x3997('0x7d')];_0x2c8cb1[_0x3997('0x2b')][_0x3997('0x7e')]=_0x511324[_0x3997('0x7d')];_0x2c8cb1['message'][_0x3997('0x7f')]=_0x3997('0x36');respondWithRpcPromise(_0x3997('0x80'),'EventManager',{'event':_0x3997('0x86'),'message':_0x2c8cb1['message']},client9002);return _0x511324;}return null;})['then'](respondWithResult(_0x55daca,null))[_0x3997('0x5a')](handleError(_0x55daca,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 82b1443..76e4a00 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 _0x733e=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x733e,0xb6));var _0xe733=function(_0x299784,_0xb0918f){_0x299784=_0x299784-0x0;var _0x5ab008=_0x733e[_0x299784];return _0x5ab008;};'use strict';var EventEmitter=require(_0xe733('0x0'));var OpenchannelMessage=require(_0xe733('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xe733('0x2')](0x0);var events={'afterCreate':_0xe733('0x3'),'afterUpdate':_0xe733('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1a0418){return function(_0x516d56,_0xc8c956,_0x7a0f9e){OpenchannelMessageEvents[_0xe733('0x5')](_0x1a0418+':'+_0x516d56['id'],_0x516d56);OpenchannelMessageEvents[_0xe733('0x5')](_0x1a0418,_0x516d56);_0x7a0f9e(null);};}for(var e in events){if(events[_0xe733('0x6')](e)){var event=events[e];OpenchannelMessage[_0xe733('0x7')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xc250=['events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x50105a,_0x39a5d3){var _0x3b40db=function(_0x1f15b3){while(--_0x1f15b3){_0x50105a['push'](_0x50105a['shift']());}};_0x3b40db(++_0x39a5d3);}(_0xc250,0x104));var _0x0c25=function(_0x390576,_0xf8b4c9){_0x390576=_0x390576-0x0;var _0x2a6f99=_0xc250[_0x390576];return _0x2a6f99;};'use strict';var EventEmitter=require(_0x0c25('0x0'));var OpenchannelMessage=require(_0x0c25('0x1'))['db'][_0x0c25('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x0c25('0x3')](0x0);var events={'afterCreate':_0x0c25('0x4'),'afterUpdate':'update','afterDestroy':_0x0c25('0x5')};function emitEvent(_0x2685ae){return function(_0x2d5f56,_0x3809f5,_0x5dd03f){OpenchannelMessageEvents[_0x0c25('0x6')](_0x2685ae+':'+_0x2d5f56['id'],_0x2d5f56);OpenchannelMessageEvents['emit'](_0x2685ae,_0x2d5f56);_0x5dd03f(null);};}for(var e in events){if(events[_0x0c25('0x7')](e)){var event=events[e];OpenchannelMessage[_0x0c25('0x8')](e,emitEvent(event));}}module[_0x0c25('0x9')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 2bf9dbd..e1ffa39 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 _0x29fd=['out','secret','UserId','OpenchannelInteraction','findOne','then','update','createdAt','catch','CmContact','describe','OpenchannelAccountId','OpenchannelInteractionId','Contact','keys','get','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','POST','GET','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','body','threadId','error','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./openchannelMessage.attributes','exports','define','OpenchannelMessage','models','direction','toLowerCase'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x29fd,0xdd));var _0xd29f=function(_0x187afa,_0x33f591){_0x187afa=_0x187afa-0x0;var _0x18194c=_0x29fd[_0x187afa];return _0x18194c;};'use strict';var _=require(_0xd29f('0x0'));var util=require(_0xd29f('0x1'));var logger=require(_0xd29f('0x2'))('api');var moment=require(_0xd29f('0x3'));var BPromise=require(_0xd29f('0x4'));var rp=require(_0xd29f('0x5'));var fs=require('fs');var path=require(_0xd29f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd29f('0x7'));module[_0xd29f('0x8')]=function(_0x2d81db,_0x23396b){return _0x2d81db[_0xd29f('0x9')](_0xd29f('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':'fti_openchannel_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3727a7,_0x1af75b,_0xdb876c){var _0x458374=_0x2d81db[_0xd29f('0xb')];var _0x490f75=_0x3727a7['get']({'plain':!![]});if(_0x490f75[_0xd29f('0xc')][_0xd29f('0xd')]()==='in'||_0x490f75[_0xd29f('0xc')]['toLowerCase']()===_0xd29f('0xe')&&!_0x490f75[_0xd29f('0xf')]&&!_['isNil'](_0x490f75[_0xd29f('0x10')])){_0x458374[_0xd29f('0x11')][_0xd29f('0x12')]({'where':{'id':_0x490f75['OpenchannelInteractionId']}})[_0xd29f('0x13')](function(_0x446a71){if(_0x446a71){_0x446a71[_0xd29f('0x14')]({'lastMsgAt':_0x490f75[_0xd29f('0x15')],'lastMsgDirection':_0x490f75['direction'][_0xd29f('0xd')]()});}})[_0xd29f('0x16')](function(_0x63773c){console['error'](_0x63773c);});}if(_0x490f75['direction']===_0xd29f('0xe')&&!_0x490f75[_0xd29f('0xf')]){var _0x391d2e;_0x458374[_0xd29f('0x17')][_0xd29f('0x18')]()['then'](function(_0x248f3e){return _0x458374['OpenchannelAccount']['find']({'where':{'id':_0x490f75[_0xd29f('0x19')]},'include':[{'model':_0x458374['OpenchannelInteraction'],'as':'Interactions','where':{'id':_0x490f75[_0xd29f('0x1a')]},'limit':0x1,'include':[{'model':_0x458374['CmContact'],'as':_0xd29f('0x1b'),'attributes':_[_0xd29f('0x1c')](_0x248f3e)}]}]});})[_0xd29f('0x13')](function(_0x1bd446){_0x391d2e=_0x1bd446[_0xd29f('0x1d')]({'plain':!![]});if(_0x391d2e&&_0x391d2e[_0xd29f('0x1e')]){logger[_0xd29f('0x1f')](_0xd29f('0x20'),'afterCreate',util[_0xd29f('0x21')](_0xd29f('0x22'),_0x490f75['id'],_0x391d2e[_0xd29f('0x1e')]));if(_0x391d2e['Interactions']&&_0x391d2e[_0xd29f('0x23')][_0xd29f('0x24')]){_0x490f75[_0xd29f('0x25')]=_['omit'](_0x391d2e['Interactions'][0x0],'Contact');_0x490f75[_0xd29f('0x1b')]=_0x391d2e[_0xd29f('0x23')][0x0][_0xd29f('0x1b')];}var _0x1af75b={'method':_0xd29f('0x26'),'uri':encodeURI(_0x391d2e[_0xd29f('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1af75b['method']){case _0xd29f('0x27'):_0x1af75b['qs']=_0x490f75;break;case'POST':_0x1af75b['body']=_0x490f75;break;}return rp(_0x1af75b)['then'](function(_0x86aac8){logger[_0xd29f('0x1f')](_0xd29f('0x20'),_0xd29f('0x28'),util[_0xd29f('0x21')](_0xd29f('0x29'),_0x490f75['id'],_0x391d2e[_0xd29f('0x1e')]));if(_0x86aac8[_0xd29f('0x2a')][_0xd29f('0x2b')]&&_0x86aac8[_0xd29f('0x2a')][_0xd29f('0x2b')]!=_0x490f75[_0xd29f('0x25')]['threadId']){return _0x458374[_0xd29f('0x11')]['update']({'threadId':_0x86aac8[_0xd29f('0x2a')][_0xd29f('0x2b')]},{'where':{'id':_0x490f75['Interaction']['id']}});}else{return;}})['then'](function(){return _0x3727a7['update']({'read':!![]});})[_0xd29f('0x16')](function(_0x307ff1){logger[_0xd29f('0x2c')](_0xd29f('0x20'),_0xd29f('0x28'),util['inspect'](_0x307ff1,{'showHidden':![],'depth':null}));_0xdb876c();});}else{_0xdb876c();}})[_0xd29f('0x2d')](function(){_0xdb876c();});}else{_0xdb876c();}}},'charset':'utf8mb4','collate':_0xd29f('0x2e')});}; \ No newline at end of file +var _0x8f8e=['get','direction','toLowerCase','secret','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','update','error','out','then','OpenchannelAccountId','Interactions','CmContact','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','POST','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','catch','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','../../config/environment','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','models'];(function(_0x1c7286,_0x259f53){var _0x1f386e=function(_0x3bf1fa){while(--_0x3bf1fa){_0x1c7286['push'](_0x1c7286['shift']());}};_0x1f386e(++_0x259f53);}(_0x8f8e,0x173));var _0xe8f8=function(_0x5d8018,_0x588592){_0x5d8018=_0x5d8018-0x0;var _0x151ac4=_0x8f8e[_0x5d8018];return _0x151ac4;};'use strict';var _=require(_0xe8f8('0x0'));var util=require(_0xe8f8('0x1'));var logger=require(_0xe8f8('0x2'))(_0xe8f8('0x3'));var moment=require(_0xe8f8('0x4'));var BPromise=require(_0xe8f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe8f8('0x6'));var attributes=require(_0xe8f8('0x7'));module[_0xe8f8('0x8')]=function(_0x3958ea,_0x24f5ac){return _0x3958ea[_0xe8f8('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe8f8('0xa'),'fields':[_0xe8f8('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x254946,_0x4c0668,_0x18361e){var _0x2855ec=_0x3958ea[_0xe8f8('0xc')];var _0x42ad1a=_0x254946[_0xe8f8('0xd')]({'plain':!![]});if(_0x42ad1a[_0xe8f8('0xe')][_0xe8f8('0xf')]()==='in'||_0x42ad1a[_0xe8f8('0xe')][_0xe8f8('0xf')]()==='out'&&!_0x42ad1a[_0xe8f8('0x10')]&&!_[_0xe8f8('0x11')](_0x42ad1a[_0xe8f8('0x12')])){_0x2855ec[_0xe8f8('0x13')]['findOne']({'where':{'id':_0x42ad1a[_0xe8f8('0x14')]}})['then'](function(_0x4a92a3){if(_0x4a92a3){_0x4a92a3[_0xe8f8('0x15')]({'lastMsgAt':_0x42ad1a['createdAt'],'lastMsgDirection':_0x42ad1a['direction']['toLowerCase']()});}})['catch'](function(_0x5bae0){console[_0xe8f8('0x16')](_0x5bae0);});}if(_0x42ad1a[_0xe8f8('0xe')]===_0xe8f8('0x17')&&!_0x42ad1a['secret']){var _0x256d4a;_0x2855ec['CmContact']['describe']()[_0xe8f8('0x18')](function(_0x45208c){return _0x2855ec['OpenchannelAccount']['find']({'where':{'id':_0x42ad1a[_0xe8f8('0x19')]},'include':[{'model':_0x2855ec['OpenchannelInteraction'],'as':_0xe8f8('0x1a'),'where':{'id':_0x42ad1a[_0xe8f8('0x14')]},'limit':0x1,'include':[{'model':_0x2855ec[_0xe8f8('0x1b')],'as':_0xe8f8('0x1c'),'attributes':_[_0xe8f8('0x1d')](_0x45208c)}]}]});})[_0xe8f8('0x18')](function(_0x2e57d4){_0x256d4a=_0x2e57d4['get']({'plain':!![]});if(_0x256d4a&&_0x256d4a[_0xe8f8('0x1e')]){logger[_0xe8f8('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0xe8f8('0x20'),util[_0xe8f8('0x21')](_0xe8f8('0x22'),_0x42ad1a['id'],_0x256d4a[_0xe8f8('0x1e')]));if(_0x256d4a[_0xe8f8('0x1a')]&&_0x256d4a['Interactions'][_0xe8f8('0x23')]){_0x42ad1a[_0xe8f8('0x24')]=_[_0xe8f8('0x25')](_0x256d4a['Interactions'][0x0],'Contact');_0x42ad1a[_0xe8f8('0x1c')]=_0x256d4a[_0xe8f8('0x1a')][0x0][_0xe8f8('0x1c')];}var _0x4c0668={'method':'POST','uri':encodeURI(_0x256d4a[_0xe8f8('0x1e')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x4c0668[_0xe8f8('0x26')]){case'GET':_0x4c0668['qs']=_0x42ad1a;break;case _0xe8f8('0x27'):_0x4c0668[_0xe8f8('0xb')]=_0x42ad1a;break;}return rp(_0x4c0668)[_0xe8f8('0x18')](function(_0x1b6372){logger[_0xe8f8('0x1f')](_0xe8f8('0x28'),'afterCreate',util[_0xe8f8('0x21')](_0xe8f8('0x29'),_0x42ad1a['id'],_0x256d4a[_0xe8f8('0x1e')]));if(_0x1b6372[_0xe8f8('0xb')][_0xe8f8('0x2a')]&&_0x1b6372[_0xe8f8('0xb')][_0xe8f8('0x2a')]!=_0x42ad1a[_0xe8f8('0x24')][_0xe8f8('0x2a')]){return _0x2855ec[_0xe8f8('0x13')][_0xe8f8('0x15')]({'threadId':_0x1b6372[_0xe8f8('0xb')][_0xe8f8('0x2a')]},{'where':{'id':_0x42ad1a[_0xe8f8('0x24')]['id']}});}else{return;}})['then'](function(){return _0x254946[_0xe8f8('0x15')]({'read':!![]});})[_0xe8f8('0x2b')](function(_0x9a3cfb){logger[_0xe8f8('0x16')](_0xe8f8('0x28'),_0xe8f8('0x20'),util[_0xe8f8('0x2c')](_0x9a3cfb,{'showHidden':![],'depth':null}));_0x18361e();});}else{_0x18361e();}})[_0xe8f8('0x2d')](function(){_0x18361e();});}else{_0x18361e();}}},'charset':_0xe8f8('0x2e'),'collate':_0xe8f8('0x2f')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 09e609a..40e7cc4 100644 --- a/server/api/openchannelMessage/openchannelMessage.rpc.js +++ b/server/api/openchannelMessage/openchannelMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x4e16e9,_0x13769a){var _0x4c5f41=function(_0x315b71){while(--_0x315b71){_0x4e16e9['push'](_0x4e16e9['shift']());}};_0x4c5f41(++_0x13769a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f66[_0x502c7d];return _0x30b7ed;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file +var _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x929c7e,_0x38c4cc){var _0x5de099=function(_0xc4e8d8){while(--_0xc4e8d8){_0x929c7e['push'](_0x929c7e['shift']());}};_0x5de099(++_0x38c4cc);}(_0x1261,0x144));var _0x1126=function(_0x4ec520,_0x15fee2){_0x4ec520=_0x4ec520-0x0;var _0xed49d7=_0x1261[_0x4ec520];return _0xed49d7;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});config[_0x1126('0xb')]=_['defaults'](config[_0x1126('0xb')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require(_0x1126('0xd'))(new Redis(config[_0x1126('0xb')]));require(_0x1126('0xe'))['register'](socket);function respondWithRpcPromise(_0x3f09ac,_0x18dbe6,_0x167ef1){return new BPromise(function(_0x5e72e2,_0x34571c){return client['request'](_0x3f09ac,_0x167ef1)['then'](function(_0x15c071){logger['info'](_0x1126('0xf'),_0x18dbe6,_0x1126('0x10'));logger[_0x1126('0x11')](_0x1126('0x12'),_0x18dbe6,_0x1126('0x10'),JSON[_0x1126('0x13')](_0x15c071));if(_0x15c071[_0x1126('0x14')]){if(_0x15c071[_0x1126('0x14')][_0x1126('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x5e72e2(_0x15c071[_0x1126('0x14')]['message']);}else{logger[_0x1126('0x17')](_0x1126('0xf'),_0x18dbe6,'request\x20sent');_0x5e72e2(_0x15c071['result'][_0x1126('0x16')]);}})[_0x1126('0x18')](function(_0x58d11a){logger['error'](_0x1126('0xf'),_0x18dbe6,_0x58d11a);_0x34571c(_0x58d11a);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 751c400..551ec7e 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 _0xb04c=['remove','register','length','save'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xb04c,0x1b7));var _0xcb04=function(_0x13f416,_0x1b3157){_0x13f416=_0x13f416-0x0;var _0x20bd1f=_0xb04c[_0x13f416];return _0x20bd1f;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xcb04('0x0'),_0xcb04('0x1'),'update'];function createListener(_0x293637,_0xa387b){return function(_0x56022a){_0xa387b['emit'](_0x293637,_0x56022a);};}function removeListener(_0x59fe05,_0x52b545){return function(){OpenchannelMessageEvents['removeListener'](_0x59fe05,_0x52b545);};}exports[_0xcb04('0x2')]=function(_0x35a67a){for(var _0x4fcabb=0x0,_0x2ac503=events[_0xcb04('0x3')];_0x4fcabb<_0x2ac503;_0x4fcabb++){var _0x10ec59=events[_0x4fcabb];var _0x38faff=createListener('openchannelMessage:'+_0x10ec59,_0x35a67a);OpenchannelMessageEvents['on'](_0x10ec59,_0x38faff);}}; \ No newline at end of file +var _0xef94=['removeListener','register','length','./openchannelMessage.events','save','update','emit'];(function(_0x43232a,_0xfda881){var _0x48db5f=function(_0x203b22){while(--_0x203b22){_0x43232a['push'](_0x43232a['shift']());}};_0x48db5f(++_0xfda881);}(_0xef94,0x1b5));var _0x4ef9=function(_0x4d6676,_0x527623){_0x4d6676=_0x4d6676-0x0;var _0x34e5db=_0xef94[_0x4d6676];return _0x34e5db;};'use strict';var OpenchannelMessageEvents=require(_0x4ef9('0x0'));var events=[_0x4ef9('0x1'),'remove',_0x4ef9('0x2')];function createListener(_0x38168e,_0x466c71){return function(_0x5c6d0d){_0x466c71[_0x4ef9('0x3')](_0x38168e,_0x5c6d0d);};}function removeListener(_0x26747b,_0x370a9d){return function(){OpenchannelMessageEvents[_0x4ef9('0x4')](_0x26747b,_0x370a9d);};}exports[_0x4ef9('0x5')]=function(_0x565c09){for(var _0x5763e7=0x0,_0x5c2962=events[_0x4ef9('0x6')];_0x5763e7<_0x5c2962;_0x5763e7++){var _0x114c85=events[_0x5763e7];var _0x3ecb55=createListener('openchannelMessage:'+_0x114c85,_0x565c09);OpenchannelMessageEvents['on'](_0x114c85,_0x3ecb55);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ae3bc2c..77957b7 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 _0x803c=['describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','destroy','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index'];(function(_0x43df8b,_0x163b58){var _0x3268fd=function(_0x190e88){while(--_0x190e88){_0x43df8b['push'](_0x43df8b['shift']());}};_0x3268fd(++_0x163b58);}(_0x803c,0x11f));var _0xc803=function(_0x13cb8f,_0xa54aad){_0x13cb8f=_0x13cb8f-0x0;var _0x264c61=_0x803c[_0x13cb8f];return _0x264c61;};'use strict';var multer=require(_0xc803('0x0'));var util=require(_0xc803('0x1'));var path=require('path');var timeout=require(_0xc803('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc803('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc803('0x4'));var config=require(_0xc803('0x5'));var controller=require(_0xc803('0x6'));router[_0xc803('0x7')]('/',auth[_0xc803('0x8')](),controller[_0xc803('0x9')]);router['get']('/describe',auth[_0xc803('0x8')](),controller[_0xc803('0xa')]);router['get'](_0xc803('0xb'),auth['isAuthenticated'](),controller[_0xc803('0xc')]);router[_0xc803('0x7')]('/:id/members',auth[_0xc803('0x8')](),controller[_0xc803('0xd')]);router[_0xc803('0x7')](_0xc803('0xe'),auth[_0xc803('0x8')](),controller[_0xc803('0xf')]);router[_0xc803('0x7')](_0xc803('0x10'),auth[_0xc803('0x8')](),controller[_0xc803('0x11')]);router[_0xc803('0x12')]('/',auth[_0xc803('0x8')](),controller[_0xc803('0x13')]);router[_0xc803('0x12')](_0xc803('0xe'),auth[_0xc803('0x8')](),controller['addTeams']);router['post'](_0xc803('0x10'),auth[_0xc803('0x8')](),controller[_0xc803('0x14')]);router['put']('/:id',auth[_0xc803('0x8')](),controller[_0xc803('0x15')]);router['delete'](_0xc803('0xb'),auth['isAuthenticated'](),controller[_0xc803('0x16')]);router[_0xc803('0x17')]('/:id/teams',auth[_0xc803('0x8')](),controller[_0xc803('0x18')]);router[_0xc803('0x17')](_0xc803('0x10'),auth[_0xc803('0x8')](),controller[_0xc803('0x19')]);module[_0xc803('0x1a')]=router; \ No newline at end of file +var _0x62f1=['/:id/teams','/:id/users','getAgents','post','create','addTeams','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members'];(function(_0x32c9c2,_0x11a6a9){var _0x490212=function(_0x49005a){while(--_0x49005a){_0x32c9c2['push'](_0x32c9c2['shift']());}};_0x490212(++_0x11a6a9);}(_0x62f1,0xfd));var _0x162f=function(_0x2c7726,_0x166d51){_0x2c7726=_0x2c7726-0x0;var _0x55bbb7=_0x62f1[_0x2c7726];return _0x55bbb7;};'use strict';var multer=require(_0x162f('0x0'));var util=require(_0x162f('0x1'));var path=require(_0x162f('0x2'));var timeout=require(_0x162f('0x3'));var express=require(_0x162f('0x4'));var router=express[_0x162f('0x5')]();var fs_extra=require(_0x162f('0x6'));var auth=require(_0x162f('0x7'));var interaction=require(_0x162f('0x8'));var config=require('../../config/environment');var controller=require(_0x162f('0x9'));router[_0x162f('0xa')]('/',auth[_0x162f('0xb')](),controller['index']);router[_0x162f('0xa')](_0x162f('0xc'),auth[_0x162f('0xb')](),controller[_0x162f('0xd')]);router[_0x162f('0xa')](_0x162f('0xe'),auth[_0x162f('0xb')](),controller[_0x162f('0xf')]);router[_0x162f('0xa')](_0x162f('0x10'),auth[_0x162f('0xb')](),controller['getMembers']);router['get'](_0x162f('0x11'),auth[_0x162f('0xb')](),controller['getTeams']);router['get'](_0x162f('0x12'),auth[_0x162f('0xb')](),controller[_0x162f('0x13')]);router[_0x162f('0x14')]('/',auth['isAuthenticated'](),controller[_0x162f('0x15')]);router[_0x162f('0x14')](_0x162f('0x11'),auth[_0x162f('0xb')](),controller[_0x162f('0x16')]);router[_0x162f('0x14')]('/:id/users',auth[_0x162f('0xb')](),controller['addAgents']);router['put'](_0x162f('0xe'),auth[_0x162f('0xb')](),controller[_0x162f('0x17')]);router[_0x162f('0x18')](_0x162f('0xe'),auth[_0x162f('0xb')](),controller[_0x162f('0x19')]);router[_0x162f('0x18')](_0x162f('0x11'),auth[_0x162f('0xb')](),controller['removeTeams']);router['delete'](_0x162f('0x12'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x162f('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index dca8962..6a45dfc 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 _0x07f9=['beepall','sequelize','exports','STRING','name','ENUM'];(function(_0x5c1345,_0x40116e){var _0x1c070d=function(_0x1e862f){while(--_0x1e862f){_0x5c1345['push'](_0x5c1345['shift']());}};_0x1c070d(++_0x40116e);}(_0x07f9,0x1db));var _0x907f=function(_0x4c8c22,_0x166929){_0x4c8c22=_0x4c8c22-0x0;var _0x1aa308=_0x07f9[_0x4c8c22];return _0x1aa308;};'use strict';var Sequelize=require(_0x907f('0x0'));module[_0x907f('0x1')]={'name':{'type':Sequelize[_0x907f('0x2')],'unique':_0x907f('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x907f('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x907f('0x4')]('rrmemory',_0x907f('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x67a7=['beepall','roundrobin','exports','STRING','name','INTEGER','rrmemory'];(function(_0x7529ec,_0x49833a){var _0x58b616=function(_0x3e48a5){while(--_0x3e48a5){_0x7529ec['push'](_0x7529ec['shift']());}};_0x58b616(++_0x49833a);}(_0x67a7,0xdb));var _0x767a=function(_0x886736,_0x52e487){_0x886736=_0x886736-0x0;var _0xd5956c=_0x67a7[_0x886736];return _0xd5956c;};'use strict';var Sequelize=require('sequelize');module[_0x767a('0x0')]={'name':{'type':Sequelize[_0x767a('0x1')],'unique':_0x767a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x767a('0x1')]},'timeout':{'type':Sequelize[_0x767a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x767a('0x4'),_0x767a('0x5'),_0x767a('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 15715cc..921c582 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 _0xb541=['get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','getOptions','include','rows','params','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','hasOwnProperty','order','sort','pick','where','OpenchannelQueueId','filter','findAll','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','nolimit','addTeams','Team','Agents','online','interface','flatMap','sequelize','transaction','each','forEach','ids','select','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','toString','SELECT','includes','all','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','emit','userOpenchannelQueue:save','isArray','getAgents','bluebird','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','register','sendStatus','status','end','json','offset','undefined','limit','count','update','then','destroy'];(function(_0x382afe,_0x531424){var _0x1ff212=function(_0x463654){while(--_0x463654){_0x382afe['push'](_0x382afe['shift']());}};_0x1ff212(++_0x531424);}(_0xb541,0x1bc));var _0x1b54=function(_0x3cbf81,_0x4f0512){_0x3cbf81=_0x3cbf81-0x0;var _0x5a25c8=_0xb541[_0x3cbf81];return _0x5a25c8;};'use strict';var BPromise=require(_0x1b54('0x0'));var util=require('util');var _=require(_0x1b54('0x1'));var squel=require('squel');var Redis=require(_0x1b54('0x2'));var qs=require(_0x1b54('0x3'));var logger=require(_0x1b54('0x4'))(_0x1b54('0x5'));var config=require(_0x1b54('0x6'));var db=require('../../mysqldb')['db'];config[_0x1b54('0x7')]=_['defaults'](config[_0x1b54('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1b54('0x7')]));require('./openchannelQueue.socket')[_0x1b54('0x8')](socket);function respondWithStatusCode(_0x64f4d8,_0x495d40){_0x495d40=_0x495d40||0xcc;return function(_0x433cb7){if(_0x433cb7){return _0x64f4d8[_0x1b54('0x9')](_0x495d40);}return _0x64f4d8[_0x1b54('0xa')](_0x495d40)[_0x1b54('0xb')]();};}function respondWithResult(_0x14aef5,_0x152b9d){_0x152b9d=_0x152b9d||0xc8;return function(_0x1fe0e4){if(_0x1fe0e4){return _0x14aef5[_0x1b54('0xa')](_0x152b9d)[_0x1b54('0xc')](_0x1fe0e4);}};}function respondWithFilteredResult(_0x3185f6,_0x59ed98){return function(_0x320e8f){if(_0x320e8f){var _0x5267fa=typeof _0x59ed98[_0x1b54('0xd')]===_0x1b54('0xe')&&typeof _0x59ed98[_0x1b54('0xf')]===_0x1b54('0xe');var _0x1b00f6=_0x320e8f[_0x1b54('0x10')];var _0x441795=_0x5267fa?0x0:_0x59ed98[_0x1b54('0xd')];var _0x43e430=_0x5267fa?_0x320e8f[_0x1b54('0x10')]:_0x59ed98['offset']+_0x59ed98[_0x1b54('0xf')];var _0xa2ffa9;if(_0x43e430>=_0x1b00f6){_0x43e430=_0x1b00f6;_0xa2ffa9=0xc8;}else{_0xa2ffa9=0xce;}_0x3185f6[_0x1b54('0xa')](_0xa2ffa9);return _0x3185f6['set']('Content-Range',_0x441795+'-'+_0x43e430+'/'+_0x1b00f6)['json'](_0x320e8f);}return null;};}function saveUpdates(_0x59ad61){return function(_0x58b7c4){if(_0x58b7c4){return _0x58b7c4[_0x1b54('0x11')](_0x59ad61)[_0x1b54('0x12')](function(_0x145183){return _0x145183;});}return null;};}function removeEntity(_0xfe96c6){return function(_0xecbac2){if(_0xecbac2){return _0xecbac2[_0x1b54('0x13')]()[_0x1b54('0x12')](function(){var _0x5d9713=_0xecbac2[_0x1b54('0x14')]({'plain':!![]});var _0x2a68aa=_0x1b54('0x15');return db[_0x1b54('0x16')][_0x1b54('0x13')]({'where':{'type':_0x2a68aa,'resourceId':_0x5d9713['id']}})['then'](function(){return _0xecbac2;});})[_0x1b54('0x12')](function(){_0xfe96c6[_0x1b54('0xa')](0xcc)[_0x1b54('0xb')]();});}};}function handleEntityNotFound(_0x2fcf5c){return function(_0x47cfd2){if(!_0x47cfd2){_0x2fcf5c[_0x1b54('0x9')](0x194);}return _0x47cfd2;};}function handleError(_0x442b2e,_0x2dd358){_0x2dd358=_0x2dd358||0x1f4;return function(_0xbac7d){logger[_0x1b54('0x17')](_0xbac7d[_0x1b54('0x18')]);if(_0xbac7d[_0x1b54('0x19')]){delete _0xbac7d[_0x1b54('0x19')];}_0x442b2e['status'](_0x2dd358)[_0x1b54('0x1a')](_0xbac7d);};}exports[_0x1b54('0x1b')]=function(_0x4555e4,_0x4fed7f){var _0x3ca077={};var _0x671416={'count':0x0,'rows':[]};var _0x24fcf9=_[_0x1b54('0x1c')](db[_0x1b54('0x1d')][_0x1b54('0x1e')],function(_0x371190){return{'name':_0x371190[_0x1b54('0x1f')],'type':_0x371190[_0x1b54('0x20')]['key']};});_0x3ca077=qs[_0x1b54('0x21')](_0x24fcf9,_0x4555e4);var _0xad4a61={'where':_0x3ca077['where']};return db[_0x1b54('0x1d')]['count'](_0xad4a61)[_0x1b54('0x12')](function(_0xc4302){_0x671416[_0x1b54('0x10')]=_0xc4302;_0x3ca077[_0x1b54('0x22')]=qs[_0x1b54('0x22')](_0x4555e4['query']);return db[_0x1b54('0x1d')]['findAll'](_0x3ca077);})['then'](function(_0x1a5e87){_0x671416[_0x1b54('0x23')]=_0x1a5e87;return _0x671416;})[_0x1b54('0x12')](respondWithFilteredResult(_0x4fed7f,_0x3ca077))['catch'](handleError(_0x4fed7f,null));};exports['show']=function(_0x4b59c8,_0x40b651){var _0x5d0957={'raw':!![],'where':{'id':_0x4b59c8[_0x1b54('0x24')]['id']}},_0x5bf52b={};_0x5bf52b['model']=_[_0x1b54('0x25')](db['OpenchannelQueue']['rawAttributes']);_0x5bf52b[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x4b59c8['query']);_0x5bf52b[_0x1b54('0x27')]=_[_0x1b54('0x28')](_0x5bf52b[_0x1b54('0x29')],_0x5bf52b['query']);_0x5d0957[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x5bf52b[_0x1b54('0x29')],qs['fields'](_0x4b59c8['query'][_0x1b54('0x2b')]));_0x5d0957[_0x1b54('0x2a')]=_0x5d0957[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x5d0957['attributes']:_0x5bf52b[_0x1b54('0x29')];if(_0x4b59c8[_0x1b54('0x26')][_0x1b54('0x2d')]){_0x5d0957['include']=[{'all':!![]}];}_0x5d0957=_[_0x1b54('0x2e')]({},_0x5d0957,_0x4b59c8[_0x1b54('0x2f')]);return db[_0x1b54('0x1d')][_0x1b54('0x30')](_0x5d0957)['then'](handleEntityNotFound(_0x40b651,null))[_0x1b54('0x12')](respondWithResult(_0x40b651,null))[_0x1b54('0x31')](handleError(_0x40b651,null));};exports[_0x1b54('0x32')]=function(_0x9eec32,_0x563f39){return db['OpenchannelQueue'][_0x1b54('0x32')](_0x9eec32[_0x1b54('0x33')],{})['then'](function(_0x44a7c5){var _0x5ce881=_0x9eec32['user'][_0x1b54('0x14')]({'plain':!![]});if(!_0x5ce881)throw new Error(_0x1b54('0x34'));if(_0x5ce881[_0x1b54('0x35')]==='user'){var _0x52170e=_0x44a7c5[_0x1b54('0x14')]({'plain':!![]});var _0x49845d=_0x1b54('0x15');return db['UserProfileSection'][_0x1b54('0x30')]({'where':{'name':_0x49845d,'userProfileId':_0x5ce881[_0x1b54('0x36')]},'raw':!![]})[_0x1b54('0x12')](function(_0x5a3096){if(_0x5a3096&&_0x5a3096[_0x1b54('0x37')]===0x0){return db[_0x1b54('0x16')][_0x1b54('0x32')]({'name':_0x52170e[_0x1b54('0x19')],'resourceId':_0x52170e['id'],'type':_0x5a3096['name'],'sectionId':_0x5a3096['id']},{})[_0x1b54('0x12')](function(){return _0x44a7c5;});}else{return _0x44a7c5;}})[_0x1b54('0x31')](function(_0x4aedf1){logger[_0x1b54('0x17')](_0x1b54('0x38'),_0x4aedf1);throw _0x4aedf1;});}return _0x44a7c5;})['then'](respondWithResult(_0x563f39,0xc9))[_0x1b54('0x31')](handleError(_0x563f39,null));};exports[_0x1b54('0x11')]=function(_0xffd493,_0x23b0fb){if(_0xffd493['body']['id']){delete _0xffd493['body']['id'];}return db[_0x1b54('0x1d')]['find']({'where':{'id':_0xffd493[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x23b0fb,null))[_0x1b54('0x12')](saveUpdates(_0xffd493[_0x1b54('0x33')],null))[_0x1b54('0x12')](respondWithResult(_0x23b0fb,null))[_0x1b54('0x31')](handleError(_0x23b0fb,null));};exports[_0x1b54('0x13')]=function(_0x521ce9,_0x398f48){return db['OpenchannelQueue'][_0x1b54('0x30')]({'where':{'id':_0x521ce9[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x398f48,null))[_0x1b54('0x12')](removeEntity(_0x398f48,null))['catch'](handleError(_0x398f48,null));};exports[_0x1b54('0x39')]=function(_0x5ddc69,_0x161a72){return db[_0x1b54('0x1d')][_0x1b54('0x39')]()['then'](respondWithResult(_0x161a72,null))[_0x1b54('0x31')](handleError(_0x161a72,null));};exports[_0x1b54('0x3a')]=function(_0x487b93,_0x2f973c){var _0x4c8f21={'raw':!![],'where':{}},_0x5626ee={},_0x39a226;return db['OpenchannelQueue'][_0x1b54('0x3b')]({'where':{'id':_0x487b93[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x2f973c,null))[_0x1b54('0x12')](function(_0x41c11b){if(_0x41c11b){_0x39a226=_0x41c11b[_0x1b54('0x14')]({'plain':!![]});_0x5626ee[_0x1b54('0x29')]=_[_0x1b54('0x25')](db[_0x1b54('0x3c')][_0x1b54('0x1e')]);_0x5626ee[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x487b93[_0x1b54('0x26')]);_0x5626ee['filters']=_['intersection'](_0x5626ee['model'],_0x5626ee[_0x1b54('0x26')]);_0x4c8f21[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x5626ee[_0x1b54('0x29')],qs[_0x1b54('0x2b')](_0x487b93[_0x1b54('0x26')][_0x1b54('0x2b')]));_0x4c8f21[_0x1b54('0x2a')]=_0x4c8f21[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x4c8f21[_0x1b54('0x2a')]:_0x5626ee[_0x1b54('0x29')];if(!_0x487b93[_0x1b54('0x26')][_0x1b54('0x3d')]('nolimit')){_0x4c8f21[_0x1b54('0xf')]=qs[_0x1b54('0xf')](_0x487b93[_0x1b54('0x26')]['limit']);_0x4c8f21['offset']=qs[_0x1b54('0xd')](_0x487b93['query'][_0x1b54('0xd')]);}_0x4c8f21[_0x1b54('0x3e')]=qs[_0x1b54('0x3f')](_0x487b93[_0x1b54('0x26')][_0x1b54('0x3f')]);_0x4c8f21['where']=qs[_0x1b54('0x27')](_[_0x1b54('0x40')](_0x487b93[_0x1b54('0x26')],_0x5626ee['filters']));_0x4c8f21[_0x1b54('0x41')][_0x1b54('0x42')]=_0x41c11b['id'];if(_0x487b93[_0x1b54('0x26')][_0x1b54('0x43')]){_0x4c8f21[_0x1b54('0x41')]=_['merge'](_0x4c8f21[_0x1b54('0x41')],{'$or':_['map'](_0x4c8f21[_0x1b54('0x2a')],function(_0x23f8fa){var _0x150bb0={};_0x150bb0[_0x23f8fa]={'$like':'%'+_0x487b93[_0x1b54('0x26')][_0x1b54('0x43')]+'%'};return _0x150bb0;})});}_0x4c8f21=_[_0x1b54('0x2e')]({},_0x4c8f21,_0x487b93['options']);return db[_0x1b54('0x3c')][_0x1b54('0x44')](_0x4c8f21);}})[_0x1b54('0x12')](function(_0x3c268d){if(_0x3c268d){return db[_0x1b54('0x45')][_0x1b54('0x46')]({'where':{'id':_[_0x1b54('0x1c')](_0x3c268d,'UserId'),'role':_0x1b54('0x47')},'attributes':['id',_0x1b54('0x19'),_0x1b54('0x48'),_0x1b54('0x49'),_0x1b54('0x4a')]});}})[_0x1b54('0x12')](function(_0x45c042){if(_0x45c042){return{'count':_0x45c042[_0x1b54('0x10')],'rows':_[_0x1b54('0x1c')](_0x45c042[_0x1b54('0x23')],function(_0x178b0d){return{'membername':_0x178b0d[_0x1b54('0x19')],'UserId':_0x178b0d['id'],'queue_name':_0x39a226[_0x1b54('0x19')],'OpenchannelQueueId':_0x39a226['id'],'interface':util[_0x1b54('0x4b')](_0x1b54('0x4c'),_0x1b54('0x4d'),_0x178b0d[_0x1b54('0x19')]),'penalty':0x0,'paused':_0x178b0d['openchannelPause'],'createdAt':_0x178b0d[_0x1b54('0x4a')],'updatedAt':_0x178b0d[_0x1b54('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1b54('0x12')](respondWithFilteredResult(_0x2f973c,_0x4c8f21))[_0x1b54('0x31')](handleError(_0x2f973c,null));};exports['getTeams']=function(_0x22cbae,_0x410245){var _0x197f95={};var _0x1f047c={};var _0xeea8a7;var _0xc857e8;return db[_0x1b54('0x1d')][_0x1b54('0x3b')]({'where':{'id':_0x22cbae['params']['id']}})[_0x1b54('0x12')](handleEntityNotFound(_0x410245,null))[_0x1b54('0x12')](function(_0x3339c0){if(_0x3339c0){_0xeea8a7=_0x3339c0;_0x1f047c['model']=_[_0x1b54('0x25')](db['Team'][_0x1b54('0x1e')]);_0x1f047c[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x22cbae['query']);_0x1f047c['filters']=_[_0x1b54('0x28')](_0x1f047c[_0x1b54('0x29')],_0x1f047c[_0x1b54('0x26')]);_0x197f95[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x1f047c[_0x1b54('0x29')],qs[_0x1b54('0x2b')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0x2b')]));_0x197f95['attributes']=_0x197f95[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x197f95['attributes']:_0x1f047c[_0x1b54('0x29')];_0x197f95[_0x1b54('0x3e')]=qs[_0x1b54('0x3f')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0x3f')]);_0x197f95['where']=qs[_0x1b54('0x27')](_[_0x1b54('0x40')](_0x22cbae[_0x1b54('0x26')],_0x1f047c[_0x1b54('0x27')]));if(_0x22cbae[_0x1b54('0x26')][_0x1b54('0x43')]){_0x197f95[_0x1b54('0x41')]=_['merge'](_0x197f95[_0x1b54('0x41')],{'$or':_[_0x1b54('0x1c')](_0x197f95[_0x1b54('0x2a')],function(_0x6b760c){var _0xd0f30b={};_0xd0f30b[_0x6b760c]={'$like':'%'+_0x22cbae[_0x1b54('0x26')]['filter']+'%'};return _0xd0f30b;})});}_0x197f95=_[_0x1b54('0x2e')]({},_0x197f95,_0x22cbae[_0x1b54('0x2f')]);return _0xeea8a7[_0x1b54('0x4e')](_0x197f95);}})[_0x1b54('0x12')](function(_0x448d42){if(_0x448d42){_0xc857e8=_0x448d42[_0x1b54('0x2c')];if(!_0x22cbae[_0x1b54('0x26')][_0x1b54('0x3d')](_0x1b54('0x4f'))){_0x197f95[_0x1b54('0xf')]=qs[_0x1b54('0xf')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0xf')]);_0x197f95[_0x1b54('0xd')]=qs[_0x1b54('0xd')](_0x22cbae[_0x1b54('0x26')][_0x1b54('0xd')]);}return _0xeea8a7[_0x1b54('0x4e')](_0x197f95);}})[_0x1b54('0x12')](function(_0x36e1ac){if(_0x36e1ac){return _0x36e1ac?{'count':_0xc857e8,'rows':_0x36e1ac}:null;}})[_0x1b54('0x12')](respondWithResult(_0x410245,null))[_0x1b54('0x31')](handleError(_0x410245,null));};exports[_0x1b54('0x50')]=function(_0x4c1d69,_0x15c656){var _0x1278fc=_0x4c1d69[_0x1b54('0x33')]['ids'];return db[_0x1b54('0x51')][_0x1b54('0x44')]({'where':{'id':_0x1278fc},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1b54('0x52'),'attributes':['id',_0x1b54('0x19'),_0x1b54('0x53'),'voicePause',_0x1b54('0x54')],'raw':!![]}]})[_0x1b54('0x12')](function(_0x5b0dd3){if(_0x5b0dd3){var _0x498788=_[_0x1b54('0x55')](_0x5b0dd3,function(_0x370577){var _0x41fbe9=_0x370577['get']({'plain':!![]});return _0x41fbe9[_0x1b54('0x52')];});return db[_0x1b54('0x1d')][_0x1b54('0x30')]({'where':{'id':_0x4c1d69[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](function(_0x30b749){return db[_0x1b54('0x56')][_0x1b54('0x57')](function(_0x7b9f91){return _0x30b749[_0x1b54('0x50')](_0x1278fc,{'transaction':_0x7b9f91})[_0x1b54('0x12')](function(){return BPromise[_0x1b54('0x58')](_0x498788,function(_0x5098e9){return db[_0x1b54('0x3c')]['findOrCreate']({'where':{'UserId':_0x5098e9['id'],'OpenchannelQueueId':_0x4c1d69['params']['id']},'transaction':_0x7b9f91});});})[_0x1b54('0x12')](function(){_0x498788[_0x1b54('0x59')](function(_0x2daab3){socket['emit']('userOpenchannelQueue:save',{'UserId':_0x2daab3['id'],'OpenchannelQueueId':_0x30b749['id']});});});});});}})[_0x1b54('0x12')](respondWithStatusCode(_0x15c656,null))['catch'](handleError(_0x15c656,null));};exports['removeTeams']=function(_0xcf16c4,_0x5128dc){return db[_0x1b54('0x51')][_0x1b54('0x44')]({'where':{'id':_0xcf16c4[_0x1b54('0x26')][_0x1b54('0x5a')]},'attributes':['id'],'include':[{'model':db[_0x1b54('0x45')],'as':_0x1b54('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5128dc,null))['then'](function(_0x47911f){var _0x145906=_[_0x1b54('0x1c')](_0x47911f,'id');var _0x5c1c96=[];var _0x4af2ad=[];var _0x17ea45=squel[_0x1b54('0x5b')]();_0x17ea45[_0x1b54('0x5c')](_0x1b54('0x5d'))[_0x1b54('0x5e')](_0x1b54('0x5f'),'tq')[_0x1b54('0x60')](_0x1b54('0x61'),'ut',_0x1b54('0x62'))[_0x1b54('0x41')](_0x1b54('0x63'),_0xcf16c4[_0x1b54('0x24')]['id']);for(var _0x50b095=0x0;_0x50b095<_0x47911f['length'];_0x50b095+=0x1){let _0x2f39da=_0x47911f[_0x50b095];for(var _0x8873e0=0x0;_0x8873e0<_0x2f39da[_0x1b54('0x52')]['length'];_0x8873e0+=0x1){let _0x3ad6ef=_0x2f39da[_0x1b54('0x52')][_0x8873e0];var _0x74f160=_0x17ea45[_0x1b54('0x64')]();_0x74f160['where']('ut.UserId\x20=\x20?',_0x3ad6ef['id']);_0x4af2ad['push'](db['sequelize'][_0x1b54('0x26')](_0x74f160[_0x1b54('0x65')](),{'type':db[_0x1b54('0x56')]['QueryTypes'][_0x1b54('0x66')]})[_0x1b54('0x12')](function(_0x507321){if(_0x507321[_0x1b54('0x2c')]===0x1){return _0x3ad6ef['id'];}else{var _0x2a76ca=_['every'](_['map'](_0x507321,'TeamId'),function(_0x2b79a3){return _[_0x1b54('0x67')](_0x145906,_0x2b79a3);});if(_0x2a76ca){return _0x3ad6ef['id'];}}}));}}return BPromise[_0x1b54('0x68')](_0x4af2ad)[_0x1b54('0x12')](function(_0x26cd6a){_0x5c1c96=_(_0x5c1c96)['union'](_0x26cd6a)[_0x1b54('0x69')]()[_0x1b54('0x6a')]();return db['OpenchannelQueue']['find']({'where':{'id':_0xcf16c4[_0x1b54('0x24')]['id']}})[_0x1b54('0x12')](function(_0xbf2806){return db[_0x1b54('0x56')][_0x1b54('0x57')](function(_0x1d17f1){return _0xbf2806[_0x1b54('0x6b')](_0xcf16c4[_0x1b54('0x26')][_0x1b54('0x5a')],{'transaction':_0x1d17f1})[_0x1b54('0x12')](function(){if(!_[_0x1b54('0x6c')](_0x5c1c96)){return _0xbf2806[_0x1b54('0x6d')](_0x5c1c96,{'transaction':_0x1d17f1});}})['then'](function(){_0x5c1c96[_0x1b54('0x59')](function(_0x4da3cf){socket['emit'](_0x1b54('0x6e'),{'UserId':_0x4da3cf,'OpenchannelQueueId':_0xbf2806['id']});});});});});});})[_0x1b54('0x12')](respondWithStatusCode(_0x5128dc,null))[_0x1b54('0x31')](handleError(_0x5128dc,null));};exports[_0x1b54('0x6f')]=function(_0x1b3116,_0x35093d){return db[_0x1b54('0x1d')][_0x1b54('0x30')]({'where':{'id':_0x1b3116[_0x1b54('0x24')]['id']}})['then'](handleEntityNotFound(_0x35093d,null))[_0x1b54('0x12')](function(_0x2442cc){if(_0x2442cc){return _0x2442cc[_0x1b54('0x6f')](_0x1b3116[_0x1b54('0x33')][_0x1b54('0x5a')],_['omit'](_0x1b3116[_0x1b54('0x33')],['ids','id'])||{})['spread'](function(_0x1d7a36){for(var _0xe9ff3=0x0;_0xe9ff3<_0x1b3116['body']['ids'][_0x1b54('0x2c')];_0xe9ff3+=0x1){socket[_0x1b54('0x70')](_0x1b54('0x71'),{'UserId':Number(_0x1b3116[_0x1b54('0x33')][_0x1b54('0x5a')][_0xe9ff3]),'OpenchannelQueueId':Number(_0x1b3116[_0x1b54('0x24')]['id'])});}return _0x1d7a36;});}})[_0x1b54('0x12')](respondWithResult(_0x35093d,null))[_0x1b54('0x31')](handleError(_0x35093d,null));};exports[_0x1b54('0x6d')]=function(_0x49b1db,_0x53c43c){return db[_0x1b54('0x1d')][_0x1b54('0x30')]({'where':{'id':_0x49b1db['params']['id']}})['then'](handleEntityNotFound(_0x53c43c,null))[_0x1b54('0x12')](function(_0x5b20c4){if(_0x5b20c4){return _0x5b20c4[_0x1b54('0x6d')](_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')])['then'](function(){if(_[_0x1b54('0x72')](_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')])){for(var _0x293e92=0x0;_0x293e92<_0x49b1db['query'][_0x1b54('0x5a')][_0x1b54('0x2c')];_0x293e92+=0x1){socket[_0x1b54('0x70')]('userOpenchannelQueue:remove',{'UserId':Number(_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')][_0x293e92]),'OpenchannelQueueId':Number(_0x49b1db[_0x1b54('0x24')]['id'])});}}else{socket['emit'](_0x1b54('0x6e'),{'UserId':Number(_0x49b1db[_0x1b54('0x26')][_0x1b54('0x5a')]),'OpenchannelQueueId':Number(_0x49b1db[_0x1b54('0x24')]['id'])});}});}})[_0x1b54('0x12')](respondWithStatusCode(_0x53c43c,null))[_0x1b54('0x31')](handleError(_0x53c43c,null));};exports['getAgents']=function(_0x5df6c2,_0x2b20ca){var _0x4175f0={};var _0x516b79={};var _0x4f6b2a;var _0x3c7ca4;return db[_0x1b54('0x1d')][_0x1b54('0x3b')]({'where':{'id':_0x5df6c2[_0x1b54('0x24')]['id']}})['then'](handleEntityNotFound(_0x2b20ca,null))[_0x1b54('0x12')](function(_0x4f178e){if(_0x4f178e){_0x4f6b2a=_0x4f178e;_0x516b79[_0x1b54('0x29')]=_['keys'](db[_0x1b54('0x45')]['rawAttributes']);_0x516b79[_0x1b54('0x26')]=_[_0x1b54('0x25')](_0x5df6c2['query']);_0x516b79[_0x1b54('0x27')]=_[_0x1b54('0x28')](_0x516b79['model'],_0x516b79[_0x1b54('0x26')]);_0x4175f0[_0x1b54('0x2a')]=_[_0x1b54('0x28')](_0x516b79[_0x1b54('0x29')],qs['fields'](_0x5df6c2['query'][_0x1b54('0x2b')]));_0x4175f0[_0x1b54('0x2a')]=_0x4175f0[_0x1b54('0x2a')][_0x1b54('0x2c')]?_0x4175f0['attributes']:_0x516b79[_0x1b54('0x29')];_0x4175f0['order']=qs['sort'](_0x5df6c2[_0x1b54('0x26')][_0x1b54('0x3f')]);_0x4175f0[_0x1b54('0x41')]=qs[_0x1b54('0x27')](_[_0x1b54('0x40')](_0x5df6c2[_0x1b54('0x26')],_0x516b79[_0x1b54('0x27')]));if(_0x5df6c2[_0x1b54('0x26')][_0x1b54('0x43')]){_0x4175f0[_0x1b54('0x41')]=_[_0x1b54('0x2e')](_0x4175f0[_0x1b54('0x41')],{'$or':_[_0x1b54('0x1c')](_0x4175f0[_0x1b54('0x2a')],function(_0x383d63){var _0x35011b={};_0x35011b[_0x383d63]={'$like':'%'+_0x5df6c2['query'][_0x1b54('0x43')]+'%'};return _0x35011b;})});}_0x4175f0=_[_0x1b54('0x2e')]({},_0x4175f0,_0x5df6c2[_0x1b54('0x2f')]);return _0x4f6b2a[_0x1b54('0x73')](_0x4175f0);}})['then'](function(_0x2b4e6b){if(_0x2b4e6b){_0x3c7ca4=_0x2b4e6b['length'];if(!_0x5df6c2[_0x1b54('0x26')][_0x1b54('0x3d')](_0x1b54('0x4f'))){_0x4175f0[_0x1b54('0xf')]=qs[_0x1b54('0xf')](_0x5df6c2[_0x1b54('0x26')][_0x1b54('0xf')]);_0x4175f0[_0x1b54('0xd')]=qs['offset'](_0x5df6c2[_0x1b54('0x26')][_0x1b54('0xd')]);}return _0x4f6b2a[_0x1b54('0x73')](_0x4175f0);}})['then'](function(_0x4ed101){if(_0x4ed101){return _0x4ed101?{'count':_0x3c7ca4,'rows':_0x4ed101}:null;}})[_0x1b54('0x12')](respondWithResult(_0x2b20ca,null))[_0x1b54('0x31')](handleError(_0x2b20ca,null));}; \ No newline at end of file +var _0x124c=['UserOpenchannelQueue','hasOwnProperty','nolimit','order','sort','filter','map','User','findAndCountAll','UserId','agent','createdAt','format','SIP','openchannelPause','Team','pick','getTeams','online','voicePause','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','Agents','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','includes','all','value','isEmpty','userOpenchannelQueue:remove','addAgents','ids','omit','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','Content-Range','json','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','name','send','index','OpenchannelQueue','rawAttributes','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','user','role','find','autoAssociation','body','describe','getMembers','findOne'];(function(_0x1a606e,_0x1399ba){var _0x4e580b=function(_0x44909d){while(--_0x44909d){_0x1a606e['push'](_0x1a606e['shift']());}};_0x4e580b(++_0x1399ba);}(_0x124c,0x195));var _0xc124=function(_0x48d1ba,_0x29b7e8){_0x48d1ba=_0x48d1ba-0x0;var _0x2cdc3b=_0x124c[_0x48d1ba];return _0x2cdc3b;};'use strict';var BPromise=require(_0xc124('0x0'));var util=require('util');var _=require(_0xc124('0x1'));var squel=require(_0xc124('0x2'));var Redis=require(_0xc124('0x3'));var qs=require(_0xc124('0x4'));var logger=require('../../config/logger')(_0xc124('0x5'));var config=require(_0xc124('0x6'));var db=require(_0xc124('0x7'))['db'];config[_0xc124('0x8')]=_['defaults'](config[_0xc124('0x8')],{'host':_0xc124('0x9'),'port':0x18eb});var socket=require(_0xc124('0xa'))(new Redis(config[_0xc124('0x8')]));require(_0xc124('0xb'))[_0xc124('0xc')](socket);function respondWithStatusCode(_0x578a14,_0xd09fb1){_0xd09fb1=_0xd09fb1||0xcc;return function(_0xd5cb1c){if(_0xd5cb1c){return _0x578a14[_0xc124('0xd')](_0xd09fb1);}return _0x578a14['status'](_0xd09fb1)[_0xc124('0xe')]();};}function respondWithResult(_0x2ec7de,_0x379700){_0x379700=_0x379700||0xc8;return function(_0x117601){if(_0x117601){return _0x2ec7de['status'](_0x379700)['json'](_0x117601);}};}function respondWithFilteredResult(_0x5039bf,_0x399aa1){return function(_0x2b9495){if(_0x2b9495){var _0x20c07b=typeof _0x399aa1[_0xc124('0xf')]===_0xc124('0x10')&&typeof _0x399aa1[_0xc124('0x11')]===_0xc124('0x10');var _0x48d08a=_0x2b9495[_0xc124('0x12')];var _0x2a854b=_0x20c07b?0x0:_0x399aa1[_0xc124('0xf')];var _0x31d834=_0x20c07b?_0x2b9495['count']:_0x399aa1[_0xc124('0xf')]+_0x399aa1[_0xc124('0x11')];var _0x4811c4;if(_0x31d834>=_0x48d08a){_0x31d834=_0x48d08a;_0x4811c4=0xc8;}else{_0x4811c4=0xce;}_0x5039bf[_0xc124('0x13')](_0x4811c4);return _0x5039bf['set'](_0xc124('0x14'),_0x2a854b+'-'+_0x31d834+'/'+_0x48d08a)[_0xc124('0x15')](_0x2b9495);}return null;};}function saveUpdates(_0xea427a){return function(_0x11081e){if(_0x11081e){return _0x11081e[_0xc124('0x16')](_0xea427a)[_0xc124('0x17')](function(_0x26c5ab){return _0x26c5ab;});}return null;};}function removeEntity(_0x25ae87){return function(_0x1603a7){if(_0x1603a7){return _0x1603a7[_0xc124('0x18')]()[_0xc124('0x17')](function(){var _0x31497f=_0x1603a7[_0xc124('0x19')]({'plain':!![]});var _0x1fa7df=_0xc124('0x1a');return db[_0xc124('0x1b')][_0xc124('0x18')]({'where':{'type':_0x1fa7df,'resourceId':_0x31497f['id']}})[_0xc124('0x17')](function(){return _0x1603a7;});})[_0xc124('0x17')](function(){_0x25ae87[_0xc124('0x13')](0xcc)[_0xc124('0xe')]();});}};}function handleEntityNotFound(_0x1ec986){return function(_0x2b1e8b){if(!_0x2b1e8b){_0x1ec986['sendStatus'](0x194);}return _0x2b1e8b;};}function handleError(_0x597aae,_0x4a2c0b){_0x4a2c0b=_0x4a2c0b||0x1f4;return function(_0x19c1d5){logger[_0xc124('0x1c')](_0x19c1d5['stack']);if(_0x19c1d5['name']){delete _0x19c1d5[_0xc124('0x1d')];}_0x597aae['status'](_0x4a2c0b)[_0xc124('0x1e')](_0x19c1d5);};}exports[_0xc124('0x1f')]=function(_0x4d3bd1,_0x155ca6){var _0x27d72a={};var _0x11c9a4={'count':0x0,'rows':[]};var _0x334776=_['map'](db[_0xc124('0x20')][_0xc124('0x21')],function(_0x45a500){return{'name':_0x45a500['fieldName'],'type':_0x45a500[_0xc124('0x22')]['key']};});_0x27d72a=qs[_0xc124('0x23')](_0x334776,_0x4d3bd1);var _0x5424af={'where':_0x27d72a[_0xc124('0x24')]};return db[_0xc124('0x20')][_0xc124('0x12')](_0x5424af)[_0xc124('0x17')](function(_0x4b9381){_0x11c9a4[_0xc124('0x12')]=_0x4b9381;_0x27d72a[_0xc124('0x25')]=qs[_0xc124('0x25')](_0x4d3bd1[_0xc124('0x26')]);return db[_0xc124('0x20')][_0xc124('0x27')](_0x27d72a);})[_0xc124('0x17')](function(_0x4e92db){_0x11c9a4[_0xc124('0x28')]=_0x4e92db;return _0x11c9a4;})[_0xc124('0x17')](respondWithFilteredResult(_0x155ca6,_0x27d72a))[_0xc124('0x29')](handleError(_0x155ca6,null));};exports[_0xc124('0x2a')]=function(_0x526ef4,_0x2001f5){var _0x27a97a={'raw':!![],'where':{'id':_0x526ef4[_0xc124('0x2b')]['id']}},_0x3d63c6={};_0x3d63c6[_0xc124('0x2c')]=_['keys'](db[_0xc124('0x20')][_0xc124('0x21')]);_0x3d63c6[_0xc124('0x26')]=_[_0xc124('0x2d')](_0x526ef4[_0xc124('0x26')]);_0x3d63c6[_0xc124('0x2e')]=_[_0xc124('0x2f')](_0x3d63c6[_0xc124('0x2c')],_0x3d63c6[_0xc124('0x26')]);_0x27a97a[_0xc124('0x30')]=_[_0xc124('0x2f')](_0x3d63c6[_0xc124('0x2c')],qs[_0xc124('0x31')](_0x526ef4['query'][_0xc124('0x31')]));_0x27a97a[_0xc124('0x30')]=_0x27a97a['attributes'][_0xc124('0x32')]?_0x27a97a[_0xc124('0x30')]:_0x3d63c6[_0xc124('0x2c')];if(_0x526ef4['query'][_0xc124('0x33')]){_0x27a97a[_0xc124('0x25')]=[{'all':!![]}];}_0x27a97a=_[_0xc124('0x34')]({},_0x27a97a,_0x526ef4[_0xc124('0x35')]);return db['OpenchannelQueue']['find'](_0x27a97a)[_0xc124('0x17')](handleEntityNotFound(_0x2001f5,null))[_0xc124('0x17')](respondWithResult(_0x2001f5,null))[_0xc124('0x29')](handleError(_0x2001f5,null));};exports['create']=function(_0x579306,_0x577119){return db[_0xc124('0x20')][_0xc124('0x36')](_0x579306['body'],{})['then'](function(_0x2fe9eb){var _0x122b53=_0x579306[_0xc124('0x37')][_0xc124('0x19')]({'plain':!![]});if(!_0x122b53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x122b53[_0xc124('0x38')]===_0xc124('0x37')){var _0x18d772=_0x2fe9eb[_0xc124('0x19')]({'plain':!![]});var _0x2441c1=_0xc124('0x1a');return db['UserProfileSection'][_0xc124('0x39')]({'where':{'name':_0x2441c1,'userProfileId':_0x122b53['userProfileId']},'raw':!![]})[_0xc124('0x17')](function(_0x51b124){if(_0x51b124&&_0x51b124[_0xc124('0x3a')]===0x0){return db[_0xc124('0x1b')][_0xc124('0x36')]({'name':_0x18d772['name'],'resourceId':_0x18d772['id'],'type':_0x51b124[_0xc124('0x1d')],'sectionId':_0x51b124['id']},{})[_0xc124('0x17')](function(){return _0x2fe9eb;});}else{return _0x2fe9eb;}})['catch'](function(_0x64a123){logger[_0xc124('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x64a123);throw _0x64a123;});}return _0x2fe9eb;})['then'](respondWithResult(_0x577119,0xc9))[_0xc124('0x29')](handleError(_0x577119,null));};exports['update']=function(_0x3bbdb6,_0x14883f){if(_0x3bbdb6[_0xc124('0x3b')]['id']){delete _0x3bbdb6[_0xc124('0x3b')]['id'];}return db[_0xc124('0x20')]['find']({'where':{'id':_0x3bbdb6[_0xc124('0x2b')]['id']}})[_0xc124('0x17')](handleEntityNotFound(_0x14883f,null))[_0xc124('0x17')](saveUpdates(_0x3bbdb6[_0xc124('0x3b')],null))['then'](respondWithResult(_0x14883f,null))[_0xc124('0x29')](handleError(_0x14883f,null));};exports[_0xc124('0x18')]=function(_0x45ae2a,_0x18d640){return db['OpenchannelQueue'][_0xc124('0x39')]({'where':{'id':_0x45ae2a[_0xc124('0x2b')]['id']}})['then'](handleEntityNotFound(_0x18d640,null))[_0xc124('0x17')](removeEntity(_0x18d640,null))[_0xc124('0x29')](handleError(_0x18d640,null));};exports[_0xc124('0x3c')]=function(_0x2149cc,_0x4f714b){return db[_0xc124('0x20')][_0xc124('0x3c')]()[_0xc124('0x17')](respondWithResult(_0x4f714b,null))[_0xc124('0x29')](handleError(_0x4f714b,null));};exports[_0xc124('0x3d')]=function(_0xbb2230,_0x541d9b){var _0x162925={'raw':!![],'where':{}},_0x16cedf={},_0x23a35f;return db[_0xc124('0x20')][_0xc124('0x3e')]({'where':{'id':_0xbb2230[_0xc124('0x2b')]['id']}})[_0xc124('0x17')](handleEntityNotFound(_0x541d9b,null))['then'](function(_0x501c33){if(_0x501c33){_0x23a35f=_0x501c33[_0xc124('0x19')]({'plain':!![]});_0x16cedf[_0xc124('0x2c')]=_[_0xc124('0x2d')](db[_0xc124('0x3f')][_0xc124('0x21')]);_0x16cedf['query']=_['keys'](_0xbb2230[_0xc124('0x26')]);_0x16cedf[_0xc124('0x2e')]=_[_0xc124('0x2f')](_0x16cedf['model'],_0x16cedf[_0xc124('0x26')]);_0x162925[_0xc124('0x30')]=_['intersection'](_0x16cedf[_0xc124('0x2c')],qs[_0xc124('0x31')](_0xbb2230[_0xc124('0x26')][_0xc124('0x31')]));_0x162925[_0xc124('0x30')]=_0x162925[_0xc124('0x30')][_0xc124('0x32')]?_0x162925[_0xc124('0x30')]:_0x16cedf['model'];if(!_0xbb2230[_0xc124('0x26')][_0xc124('0x40')](_0xc124('0x41'))){_0x162925[_0xc124('0x11')]=qs['limit'](_0xbb2230[_0xc124('0x26')][_0xc124('0x11')]);_0x162925[_0xc124('0xf')]=qs[_0xc124('0xf')](_0xbb2230[_0xc124('0x26')][_0xc124('0xf')]);}_0x162925[_0xc124('0x42')]=qs['sort'](_0xbb2230[_0xc124('0x26')][_0xc124('0x43')]);_0x162925[_0xc124('0x24')]=qs[_0xc124('0x2e')](_['pick'](_0xbb2230['query'],_0x16cedf[_0xc124('0x2e')]));_0x162925[_0xc124('0x24')]['OpenchannelQueueId']=_0x501c33['id'];if(_0xbb2230[_0xc124('0x26')][_0xc124('0x44')]){_0x162925[_0xc124('0x24')]=_[_0xc124('0x34')](_0x162925[_0xc124('0x24')],{'$or':_[_0xc124('0x45')](_0x162925[_0xc124('0x30')],function(_0xa70e71){var _0x25433b={};_0x25433b[_0xa70e71]={'$like':'%'+_0xbb2230[_0xc124('0x26')][_0xc124('0x44')]+'%'};return _0x25433b;})});}_0x162925=_['merge']({},_0x162925,_0xbb2230[_0xc124('0x35')]);return db[_0xc124('0x3f')][_0xc124('0x27')](_0x162925);}})[_0xc124('0x17')](function(_0x2e3595){if(_0x2e3595){return db[_0xc124('0x46')][_0xc124('0x47')]({'where':{'id':_['map'](_0x2e3595,_0xc124('0x48')),'role':_0xc124('0x49')},'attributes':['id',_0xc124('0x1d'),'openchannelPause','updatedAt',_0xc124('0x4a')]});}})['then'](function(_0x9a6737){if(_0x9a6737){return{'count':_0x9a6737[_0xc124('0x12')],'rows':_[_0xc124('0x45')](_0x9a6737['rows'],function(_0x164f40){return{'membername':_0x164f40['name'],'UserId':_0x164f40['id'],'queue_name':_0x23a35f['name'],'OpenchannelQueueId':_0x23a35f['id'],'interface':util[_0xc124('0x4b')]('%s/%s',_0xc124('0x4c'),_0x164f40[_0xc124('0x1d')]),'penalty':0x0,'paused':_0x164f40[_0xc124('0x4d')],'createdAt':_0x164f40[_0xc124('0x4a')],'updatedAt':_0x164f40['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc124('0x17')](respondWithFilteredResult(_0x541d9b,_0x162925))[_0xc124('0x29')](handleError(_0x541d9b,null));};exports['getTeams']=function(_0x353dae,_0x381d2e){var _0x3b19aa={};var _0x50c70b={};var _0x36d533;var _0x32514b;return db[_0xc124('0x20')][_0xc124('0x3e')]({'where':{'id':_0x353dae[_0xc124('0x2b')]['id']}})[_0xc124('0x17')](handleEntityNotFound(_0x381d2e,null))[_0xc124('0x17')](function(_0x2d5ce9){if(_0x2d5ce9){_0x36d533=_0x2d5ce9;_0x50c70b[_0xc124('0x2c')]=_[_0xc124('0x2d')](db[_0xc124('0x4e')][_0xc124('0x21')]);_0x50c70b[_0xc124('0x26')]=_[_0xc124('0x2d')](_0x353dae[_0xc124('0x26')]);_0x50c70b['filters']=_[_0xc124('0x2f')](_0x50c70b['model'],_0x50c70b['query']);_0x3b19aa[_0xc124('0x30')]=_[_0xc124('0x2f')](_0x50c70b[_0xc124('0x2c')],qs[_0xc124('0x31')](_0x353dae[_0xc124('0x26')][_0xc124('0x31')]));_0x3b19aa[_0xc124('0x30')]=_0x3b19aa[_0xc124('0x30')]['length']?_0x3b19aa[_0xc124('0x30')]:_0x50c70b[_0xc124('0x2c')];_0x3b19aa['order']=qs[_0xc124('0x43')](_0x353dae[_0xc124('0x26')][_0xc124('0x43')]);_0x3b19aa['where']=qs['filters'](_[_0xc124('0x4f')](_0x353dae['query'],_0x50c70b[_0xc124('0x2e')]));if(_0x353dae['query'][_0xc124('0x44')]){_0x3b19aa[_0xc124('0x24')]=_['merge'](_0x3b19aa[_0xc124('0x24')],{'$or':_[_0xc124('0x45')](_0x3b19aa[_0xc124('0x30')],function(_0x57b506){var _0x1bcebe={};_0x1bcebe[_0x57b506]={'$like':'%'+_0x353dae[_0xc124('0x26')]['filter']+'%'};return _0x1bcebe;})});}_0x3b19aa=_[_0xc124('0x34')]({},_0x3b19aa,_0x353dae['options']);return _0x36d533[_0xc124('0x50')](_0x3b19aa);}})[_0xc124('0x17')](function(_0x334836){if(_0x334836){_0x32514b=_0x334836[_0xc124('0x32')];if(!_0x353dae[_0xc124('0x26')][_0xc124('0x40')](_0xc124('0x41'))){_0x3b19aa[_0xc124('0x11')]=qs[_0xc124('0x11')](_0x353dae[_0xc124('0x26')]['limit']);_0x3b19aa[_0xc124('0xf')]=qs[_0xc124('0xf')](_0x353dae['query'][_0xc124('0xf')]);}return _0x36d533[_0xc124('0x50')](_0x3b19aa);}})['then'](function(_0x4fa9ad){if(_0x4fa9ad){return _0x4fa9ad?{'count':_0x32514b,'rows':_0x4fa9ad}:null;}})[_0xc124('0x17')](respondWithResult(_0x381d2e,null))[_0xc124('0x29')](handleError(_0x381d2e,null));};exports['addTeams']=function(_0x5eafd5,_0x105786){var _0x4d6a81=_0x5eafd5['body']['ids'];return db[_0xc124('0x4e')][_0xc124('0x27')]({'where':{'id':_0x4d6a81},'attributes':['id'],'include':[{'model':db[_0xc124('0x46')],'as':'Agents','attributes':['id',_0xc124('0x1d'),_0xc124('0x51'),_0xc124('0x52'),'interface'],'raw':!![]}]})[_0xc124('0x17')](function(_0x4b9735){if(_0x4b9735){var _0x55a1bc=_['flatMap'](_0x4b9735,function(_0x4ec1a4){var _0xb4d30c=_0x4ec1a4[_0xc124('0x19')]({'plain':!![]});return _0xb4d30c['Agents'];});return db['OpenchannelQueue']['find']({'where':{'id':_0x5eafd5['params']['id']}})['then'](function(_0x431cae){return db[_0xc124('0x53')][_0xc124('0x54')](function(_0x2d5d49){return _0x431cae[_0xc124('0x55')](_0x4d6a81,{'transaction':_0x2d5d49})[_0xc124('0x17')](function(){return BPromise[_0xc124('0x56')](_0x55a1bc,function(_0x196d40){return db['UserOpenchannelQueue'][_0xc124('0x57')]({'where':{'UserId':_0x196d40['id'],'OpenchannelQueueId':_0x5eafd5[_0xc124('0x2b')]['id']},'transaction':_0x2d5d49});});})[_0xc124('0x17')](function(){_0x55a1bc[_0xc124('0x58')](function(_0x4a7d17){socket[_0xc124('0x59')](_0xc124('0x5a'),{'UserId':_0x4a7d17['id'],'OpenchannelQueueId':_0x431cae['id']});});});});});}})[_0xc124('0x17')](respondWithStatusCode(_0x105786,null))['catch'](handleError(_0x105786,null));};exports[_0xc124('0x5b')]=function(_0x28ac4b,_0x20a787){return db[_0xc124('0x4e')][_0xc124('0x27')]({'where':{'id':_0x28ac4b[_0xc124('0x26')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc124('0x46')],'as':_0xc124('0x5c'),'attributes':['id'],'raw':!![]}]})[_0xc124('0x17')](handleEntityNotFound(_0x20a787,null))[_0xc124('0x17')](function(_0x27fcf1){var _0x384e8d=_[_0xc124('0x45')](_0x27fcf1,'id');var _0x5bef99=[];var _0x2af962=[];var _0x1b8540=squel['select']();_0x1b8540['field'](_0xc124('0x5d'))[_0xc124('0x5e')](_0xc124('0x5f'),'tq')[_0xc124('0x60')](_0xc124('0x61'),'ut',_0xc124('0x62'))[_0xc124('0x24')](_0xc124('0x63'),_0x28ac4b[_0xc124('0x2b')]['id']);for(var _0x353a3f=0x0;_0x353a3f<_0x27fcf1[_0xc124('0x32')];_0x353a3f+=0x1){let _0x499f06=_0x27fcf1[_0x353a3f];for(var _0x48d6b3=0x0;_0x48d6b3<_0x499f06[_0xc124('0x5c')]['length'];_0x48d6b3+=0x1){let _0x15ce52=_0x499f06['Agents'][_0x48d6b3];var _0x1cc9e6=_0x1b8540[_0xc124('0x64')]();_0x1cc9e6[_0xc124('0x24')](_0xc124('0x65'),_0x15ce52['id']);_0x2af962[_0xc124('0x66')](db['sequelize'][_0xc124('0x26')](_0x1cc9e6['toString'](),{'type':db[_0xc124('0x53')]['QueryTypes'][_0xc124('0x67')]})[_0xc124('0x17')](function(_0x318328){if(_0x318328[_0xc124('0x32')]===0x1){return _0x15ce52['id'];}else{var _0xe44407=_[_0xc124('0x68')](_[_0xc124('0x45')](_0x318328,_0xc124('0x69')),function(_0xbc10ca){return _[_0xc124('0x6a')](_0x384e8d,_0xbc10ca);});if(_0xe44407){return _0x15ce52['id'];}}}));}}return BPromise[_0xc124('0x6b')](_0x2af962)[_0xc124('0x17')](function(_0x3cdcd1){_0x5bef99=_(_0x5bef99)['union'](_0x3cdcd1)['compact']()[_0xc124('0x6c')]();return db['OpenchannelQueue'][_0xc124('0x39')]({'where':{'id':_0x28ac4b[_0xc124('0x2b')]['id']}})[_0xc124('0x17')](function(_0x2bb574){return db[_0xc124('0x53')][_0xc124('0x54')](function(_0x2f4a6e){return _0x2bb574[_0xc124('0x5b')](_0x28ac4b[_0xc124('0x26')]['ids'],{'transaction':_0x2f4a6e})[_0xc124('0x17')](function(){if(!_[_0xc124('0x6d')](_0x5bef99)){return _0x2bb574['removeAgents'](_0x5bef99,{'transaction':_0x2f4a6e});}})[_0xc124('0x17')](function(){_0x5bef99[_0xc124('0x58')](function(_0x485839){socket[_0xc124('0x59')](_0xc124('0x6e'),{'UserId':_0x485839,'OpenchannelQueueId':_0x2bb574['id']});});});});});});})[_0xc124('0x17')](respondWithStatusCode(_0x20a787,null))['catch'](handleError(_0x20a787,null));};exports[_0xc124('0x6f')]=function(_0x135367,_0xa214b1){return db[_0xc124('0x20')][_0xc124('0x39')]({'where':{'id':_0x135367[_0xc124('0x2b')]['id']}})['then'](handleEntityNotFound(_0xa214b1,null))[_0xc124('0x17')](function(_0x50273c){if(_0x50273c){return _0x50273c[_0xc124('0x6f')](_0x135367['body'][_0xc124('0x70')],_[_0xc124('0x71')](_0x135367['body'],['ids','id'])||{})['spread'](function(_0x1f8b97){for(var _0x34ba2d=0x0;_0x34ba2d<_0x135367[_0xc124('0x3b')][_0xc124('0x70')][_0xc124('0x32')];_0x34ba2d+=0x1){socket['emit'](_0xc124('0x5a'),{'UserId':Number(_0x135367[_0xc124('0x3b')][_0xc124('0x70')][_0x34ba2d]),'OpenchannelQueueId':Number(_0x135367[_0xc124('0x2b')]['id'])});}return _0x1f8b97;});}})[_0xc124('0x17')](respondWithResult(_0xa214b1,null))[_0xc124('0x29')](handleError(_0xa214b1,null));};exports[_0xc124('0x72')]=function(_0x257df4,_0x54b60c){return db[_0xc124('0x20')][_0xc124('0x39')]({'where':{'id':_0x257df4[_0xc124('0x2b')]['id']}})[_0xc124('0x17')](handleEntityNotFound(_0x54b60c,null))[_0xc124('0x17')](function(_0x92f2d6){if(_0x92f2d6){return _0x92f2d6[_0xc124('0x72')](_0x257df4['query'][_0xc124('0x70')])[_0xc124('0x17')](function(){if(_[_0xc124('0x73')](_0x257df4[_0xc124('0x26')][_0xc124('0x70')])){for(var _0x12ef8a=0x0;_0x12ef8a<_0x257df4[_0xc124('0x26')][_0xc124('0x70')]['length'];_0x12ef8a+=0x1){socket['emit'](_0xc124('0x6e'),{'UserId':Number(_0x257df4[_0xc124('0x26')][_0xc124('0x70')][_0x12ef8a]),'OpenchannelQueueId':Number(_0x257df4[_0xc124('0x2b')]['id'])});}}else{socket[_0xc124('0x59')](_0xc124('0x6e'),{'UserId':Number(_0x257df4[_0xc124('0x26')]['ids']),'OpenchannelQueueId':Number(_0x257df4['params']['id'])});}});}})[_0xc124('0x17')](respondWithStatusCode(_0x54b60c,null))[_0xc124('0x29')](handleError(_0x54b60c,null));};exports['getAgents']=function(_0x6ae78e,_0x4543c6){var _0x4363b1={};var _0x5911ea={};var _0x2c9950;var _0x2def8f;return db[_0xc124('0x20')][_0xc124('0x3e')]({'where':{'id':_0x6ae78e[_0xc124('0x2b')]['id']}})['then'](handleEntityNotFound(_0x4543c6,null))[_0xc124('0x17')](function(_0xf2338c){if(_0xf2338c){_0x2c9950=_0xf2338c;_0x5911ea['model']=_['keys'](db[_0xc124('0x46')]['rawAttributes']);_0x5911ea[_0xc124('0x26')]=_['keys'](_0x6ae78e[_0xc124('0x26')]);_0x5911ea[_0xc124('0x2e')]=_['intersection'](_0x5911ea[_0xc124('0x2c')],_0x5911ea['query']);_0x4363b1[_0xc124('0x30')]=_['intersection'](_0x5911ea['model'],qs[_0xc124('0x31')](_0x6ae78e[_0xc124('0x26')][_0xc124('0x31')]));_0x4363b1[_0xc124('0x30')]=_0x4363b1[_0xc124('0x30')]['length']?_0x4363b1[_0xc124('0x30')]:_0x5911ea['model'];_0x4363b1['order']=qs[_0xc124('0x43')](_0x6ae78e[_0xc124('0x26')][_0xc124('0x43')]);_0x4363b1[_0xc124('0x24')]=qs[_0xc124('0x2e')](_[_0xc124('0x4f')](_0x6ae78e['query'],_0x5911ea[_0xc124('0x2e')]));if(_0x6ae78e[_0xc124('0x26')][_0xc124('0x44')]){_0x4363b1[_0xc124('0x24')]=_[_0xc124('0x34')](_0x4363b1[_0xc124('0x24')],{'$or':_['map'](_0x4363b1[_0xc124('0x30')],function(_0x1c444c){var _0x1734f7={};_0x1734f7[_0x1c444c]={'$like':'%'+_0x6ae78e[_0xc124('0x26')][_0xc124('0x44')]+'%'};return _0x1734f7;})});}_0x4363b1=_[_0xc124('0x34')]({},_0x4363b1,_0x6ae78e[_0xc124('0x35')]);return _0x2c9950[_0xc124('0x74')](_0x4363b1);}})[_0xc124('0x17')](function(_0x4e9844){if(_0x4e9844){_0x2def8f=_0x4e9844[_0xc124('0x32')];if(!_0x6ae78e[_0xc124('0x26')][_0xc124('0x40')](_0xc124('0x41'))){_0x4363b1[_0xc124('0x11')]=qs['limit'](_0x6ae78e['query']['limit']);_0x4363b1[_0xc124('0xf')]=qs['offset'](_0x6ae78e['query']['offset']);}return _0x2c9950[_0xc124('0x74')](_0x4363b1);}})[_0xc124('0x17')](function(_0x4b9c9b){if(_0x4b9c9b){return _0x4b9c9b?{'count':_0x2def8f,'rows':_0x4b9c9b}:null;}})[_0xc124('0x17')](respondWithResult(_0x4543c6,null))[_0xc124('0x29')](handleError(_0x4543c6,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index b13a99f..f0b3489 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 _0xdf22=['update','emit','hook','exports','events','../../mysqldb','OpenchannelQueue'];(function(_0x3e3724,_0x56eccf){var _0x4de33e=function(_0x595294){while(--_0x595294){_0x3e3724['push'](_0x3e3724['shift']());}};_0x4de33e(++_0x56eccf);}(_0xdf22,0x7b));var _0x2df2=function(_0x257f68,_0x28cd3d){_0x257f68=_0x257f68-0x0;var _0x1b1437=_0xdf22[_0x257f68];return _0x1b1437;};'use strict';var EventEmitter=require(_0x2df2('0x0'));var OpenchannelQueue=require(_0x2df2('0x1'))['db'][_0x2df2('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x2df2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x57c1bd){return function(_0x2a4c65,_0x3ad36f,_0x14c2c0){OpenchannelQueueEvents[_0x2df2('0x4')](_0x57c1bd+':'+_0x2a4c65['id'],_0x2a4c65);OpenchannelQueueEvents[_0x2df2('0x4')](_0x57c1bd,_0x2a4c65);_0x14c2c0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x2df2('0x5')](e,emitEvent(event));}}module[_0x2df2('0x6')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x594f=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update'];(function(_0x53758c,_0x5664af){var _0x425eff=function(_0x3d0c89){while(--_0x3d0c89){_0x53758c['push'](_0x53758c['shift']());}};_0x425eff(++_0x5664af);}(_0x594f,0x90));var _0xf594=function(_0x1d652a,_0x1d4406){_0x1d652a=_0x1d652a-0x0;var _0x221d4c=_0x594f[_0x1d652a];return _0x221d4c;};'use strict';var EventEmitter=require(_0xf594('0x0'));var OpenchannelQueue=require(_0xf594('0x1'))['db'][_0xf594('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xf594('0x3')](0x0);var events={'afterCreate':_0xf594('0x4'),'afterUpdate':_0xf594('0x5'),'afterDestroy':_0xf594('0x6')};function emitEvent(_0x5e1764){return function(_0x3703b6,_0x25fa8e,_0x578392){OpenchannelQueueEvents[_0xf594('0x7')](_0x5e1764+':'+_0x3703b6['id'],_0x3703b6);OpenchannelQueueEvents[_0xf594('0x7')](_0x5e1764,_0x3703b6);_0x578392(null);};}for(var e in events){if(events[_0xf594('0x8')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xf594('0x9')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 8b8241b..ce2c050 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 _0x798e=['../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xb05b44,_0x2839da){var _0x1a7b4a=function(_0x42749e){while(--_0x42749e){_0xb05b44['push'](_0xb05b44['shift']());}};_0x1a7b4a(++_0x2839da);}(_0x798e,0x92));var _0xe798=function(_0x4a135a,_0x42f38f){_0x4a135a=_0x4a135a-0x0;var _0x493f78=_0x798e[_0x4a135a];return _0x493f78;};'use strict';var _=require(_0xe798('0x0'));var util=require(_0xe798('0x1'));var logger=require(_0xe798('0x2'))(_0xe798('0x3'));var moment=require(_0xe798('0x4'));var BPromise=require(_0xe798('0x5'));var rp=require(_0xe798('0x6'));var fs=require('fs');var path=require(_0xe798('0x7'));var rimraf=require('rimraf');var config=require(_0xe798('0x8'));var attributes=require(_0xe798('0x9'));module[_0xe798('0xa')]=function(_0x2147d6,_0x2d57a3){return _0x2147d6[_0xe798('0xb')](_0xe798('0xc'),attributes,{'tableName':_0xe798('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x831d=['OpenchannelQueue','openchannel_queues','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x831d,0x1f1));var _0xd831=function(_0x21ecf3,_0x3b4b99){_0x21ecf3=_0x21ecf3-0x0;var _0x3cf63a=_0x831d[_0x21ecf3];return _0x3cf63a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd831('0x0'))(_0xd831('0x1'));var moment=require(_0xd831('0x2'));var BPromise=require(_0xd831('0x3'));var rp=require(_0xd831('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd831('0x5'));var config=require(_0xd831('0x6'));var attributes=require(_0xd831('0x7'));module[_0xd831('0x8')]=function(_0x364c0c,_0x338f0e){return _0x364c0c['define'](_0xd831('0x9'),attributes,{'tableName':_0xd831('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.rpc.js b/server/api/openchannelQueue/openchannelQueue.rpc.js index 52d690a..4d207f6 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 _0x8793=['result','GetOpenchannelQueue','OpenchannelQueue','findAll','raw','options','where','attributes','limit','include','map','model','catch','ShowOpenchannelQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x5d0a06,_0x2f8043){var _0x2350ca=function(_0xcda60d){while(--_0xcda60d){_0x5d0a06['push'](_0x5d0a06['shift']());}};_0x2350ca(++_0x2f8043);}(_0x8793,0x89));var _0x3879=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x8793[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x3879('0x0'));var util=require(_0x3879('0x1'));var moment=require(_0x3879('0x2'));var BPromise=require(_0x3879('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3879('0x4'));var db=require(_0x3879('0x5'))['db'];var utils=require(_0x3879('0x6'));var logger=require(_0x3879('0x7'))('rpc');var config=require(_0x3879('0x8'));var jayson=require(_0x3879('0x9'));var client=jayson[_0x3879('0xa')][_0x3879('0xb')]({'port':0x232a});config[_0x3879('0xc')]=_[_0x3879('0xd')](config['redis'],{'host':_0x3879('0xe'),'port':0x18eb});var socket=require(_0x3879('0xf'))(new Redis(config[_0x3879('0xc')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x525122,_0x49bd95,_0x504d81){return new BPromise(function(_0x3ce151,_0x40867f){return client[_0x3879('0x10')](_0x525122,_0x504d81)[_0x3879('0x11')](function(_0x9279f7){logger['info'](_0x3879('0x12'),_0x49bd95,'request\x20sent');logger[_0x3879('0x13')](_0x3879('0x14'),_0x49bd95,_0x3879('0x15'),JSON[_0x3879('0x16')](_0x9279f7));if(_0x9279f7[_0x3879('0x17')]){if(_0x9279f7['error'][_0x3879('0x18')]===0x1f4){logger[_0x3879('0x17')](_0x3879('0x12'),_0x49bd95,_0x9279f7[_0x3879('0x17')][_0x3879('0x19')]);return _0x40867f(_0x9279f7[_0x3879('0x17')][_0x3879('0x19')]);}logger[_0x3879('0x17')](_0x3879('0x12'),_0x49bd95,_0x9279f7[_0x3879('0x17')]['message']);return _0x3ce151(_0x9279f7[_0x3879('0x17')][_0x3879('0x19')]);}else{logger[_0x3879('0x1a')](_0x3879('0x12'),_0x49bd95,_0x3879('0x15'));_0x3ce151(_0x9279f7[_0x3879('0x1b')]['message']);}})['catch'](function(_0xb02018){logger['error'](_0x3879('0x12'),_0x49bd95,_0xb02018);_0x40867f(_0xb02018);});});}exports[_0x3879('0x1c')]=function(_0xc4ab96){var _0x2e1a22=this;return new Promise(function(_0x2df870,_0x5147c0){return db[_0x3879('0x1d')][_0x3879('0x1e')]({'raw':_0xc4ab96['options']?_0xc4ab96['options'][_0x3879('0x1f')]===undefined?!![]:![]:!![],'where':_0xc4ab96['options']?_0xc4ab96[_0x3879('0x20')][_0x3879('0x21')]||null:null,'attributes':_0xc4ab96['options']?_0xc4ab96['options'][_0x3879('0x22')]||null:null,'limit':_0xc4ab96['options']?_0xc4ab96[_0x3879('0x20')][_0x3879('0x23')]||null:null,'include':_0xc4ab96[_0x3879('0x20')]?_0xc4ab96[_0x3879('0x20')][_0x3879('0x24')]?_[_0x3879('0x25')](_0xc4ab96[_0x3879('0x20')][_0x3879('0x24')],function(_0x29882c){return{'model':db[_0x29882c[_0x3879('0x26')]],'as':_0x29882c['as'],'attributes':_0x29882c[_0x3879('0x22')],'include':_0x29882c['include']?_[_0x3879('0x25')](_0x29882c[_0x3879('0x24')],function(_0x25f0ba){return{'model':db[_0x25f0ba[_0x3879('0x26')]],'as':_0x25f0ba['as'],'attributes':_0x25f0ba[_0x3879('0x22')],'include':_0x25f0ba['include']?_[_0x3879('0x25')](_0x25f0ba[_0x3879('0x24')],function(_0x1740f5){return{'model':db[_0x1740f5[_0x3879('0x26')]],'as':_0x1740f5['as'],'attributes':_0x1740f5['attributes']};}):[]};}):[]};}):[]:[]})[_0x3879('0x11')](function(_0x10d038){logger[_0x3879('0x1a')]('GetOpenchannelQueue',_0xc4ab96);logger[_0x3879('0x13')](_0x3879('0x1c'),_0xc4ab96,JSON['stringify'](_0x10d038));_0x2df870(_0x10d038);})[_0x3879('0x27')](function(_0x39afa5){logger[_0x3879('0x17')](_0x3879('0x1c'),_0x39afa5['message'],_0xc4ab96);_0x5147c0(_0x2e1a22[_0x3879('0x17')](0x1f4,_0x39afa5[_0x3879('0x19')]));});});};exports['ShowOpenchannelQueue']=function(_0x1d1762){var _0x39673b=this;return new Promise(function(_0x5f113d,_0x4e977f){return db[_0x3879('0x1d')]['find']({'raw':_0x1d1762['options']?_0x1d1762[_0x3879('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x1d1762[_0x3879('0x20')]?_0x1d1762[_0x3879('0x20')][_0x3879('0x21')]||null:null,'attributes':_0x1d1762[_0x3879('0x20')]?_0x1d1762[_0x3879('0x20')][_0x3879('0x22')]||null:null,'include':_0x1d1762[_0x3879('0x20')]?_0x1d1762[_0x3879('0x20')][_0x3879('0x24')]?_[_0x3879('0x25')](_0x1d1762[_0x3879('0x20')][_0x3879('0x24')],function(_0x2090e0){return{'model':db[_0x2090e0[_0x3879('0x26')]],'as':_0x2090e0['as'],'attributes':_0x2090e0[_0x3879('0x22')],'include':_0x2090e0['include']?_[_0x3879('0x25')](_0x2090e0[_0x3879('0x24')],function(_0x431121){return{'model':db[_0x431121['model']],'as':_0x431121['as'],'attributes':_0x431121[_0x3879('0x22')],'include':_0x431121[_0x3879('0x24')]?_['map'](_0x431121[_0x3879('0x24')],function(_0x2f3cf0){return{'model':db[_0x2f3cf0[_0x3879('0x26')]],'as':_0x2f3cf0['as'],'attributes':_0x2f3cf0[_0x3879('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3879('0x11')](function(_0x1b805f){logger[_0x3879('0x1a')](_0x3879('0x28'),_0x1d1762);logger[_0x3879('0x13')](_0x3879('0x28'),_0x1d1762,JSON[_0x3879('0x16')](_0x1b805f));_0x5f113d(_0x1b805f);})[_0x3879('0x27')](function(_0x270245){logger['error'](_0x3879('0x28'),_0x270245['message'],_0x1d1762);_0x4e977f(_0x39673b['error'](0x1f4,_0x270245['message']));});});}; \ No newline at end of file +var _0xdb0f=['error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','include','map','model','debug','stringify','catch','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent'];(function(_0x2fbbbf,_0x12ea46){var _0x2a9d83=function(_0x1e2ad8){while(--_0x1e2ad8){_0x2fbbbf['push'](_0x2fbbbf['shift']());}};_0x2a9d83(++_0x12ea46);}(_0xdb0f,0x14b));var _0xfdb0=function(_0x4edff2,_0x3bedaf){_0x4edff2=_0x4edff2-0x0;var _0x39b99e=_0xdb0f[_0x4edff2];return _0x39b99e;};'use strict';var _=require(_0xfdb0('0x0'));var util=require('util');var moment=require(_0xfdb0('0x1'));var BPromise=require(_0xfdb0('0x2'));var rs=require(_0xfdb0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfdb0('0x4'))['db'];var utils=require(_0xfdb0('0x5'));var logger=require('../../config/logger')(_0xfdb0('0x6'));var config=require(_0xfdb0('0x7'));var jayson=require(_0xfdb0('0x8'));var client=jayson[_0xfdb0('0x9')][_0xfdb0('0xa')]({'port':0x232a});config[_0xfdb0('0xb')]=_['defaults'](config[_0xfdb0('0xb')],{'host':_0xfdb0('0xc'),'port':0x18eb});var socket=require(_0xfdb0('0xd'))(new Redis(config[_0xfdb0('0xb')]));require(_0xfdb0('0xe'))[_0xfdb0('0xf')](socket);function respondWithRpcPromise(_0xc7b892,_0x741ca,_0x160037){return new BPromise(function(_0x55c5ce,_0x3bf581){return client[_0xfdb0('0x10')](_0xc7b892,_0x160037)[_0xfdb0('0x11')](function(_0x3a8b84){logger[_0xfdb0('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x741ca,_0xfdb0('0x13'));logger['debug']('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x741ca,_0xfdb0('0x13'),JSON['stringify'](_0x3a8b84));if(_0x3a8b84[_0xfdb0('0x14')]){if(_0x3a8b84[_0xfdb0('0x14')][_0xfdb0('0x15')]===0x1f4){logger[_0xfdb0('0x14')]('OpenchannelQueue,\x20%s,\x20%s',_0x741ca,_0x3a8b84[_0xfdb0('0x14')][_0xfdb0('0x16')]);return _0x3bf581(_0x3a8b84[_0xfdb0('0x14')][_0xfdb0('0x16')]);}logger[_0xfdb0('0x14')](_0xfdb0('0x17'),_0x741ca,_0x3a8b84[_0xfdb0('0x14')][_0xfdb0('0x16')]);return _0x55c5ce(_0x3a8b84[_0xfdb0('0x14')][_0xfdb0('0x16')]);}else{logger['info'](_0xfdb0('0x17'),_0x741ca,_0xfdb0('0x13'));_0x55c5ce(_0x3a8b84[_0xfdb0('0x18')][_0xfdb0('0x16')]);}})['catch'](function(_0x77b5f6){logger[_0xfdb0('0x14')](_0xfdb0('0x17'),_0x741ca,_0x77b5f6);_0x3bf581(_0x77b5f6);});});}exports[_0xfdb0('0x19')]=function(_0xe5ad02){var _0x4ca42e=this;return new Promise(function(_0x59d37c,_0x12197b){return db[_0xfdb0('0x1a')][_0xfdb0('0x1b')]({'raw':_0xe5ad02[_0xfdb0('0x1c')]?_0xe5ad02[_0xfdb0('0x1c')][_0xfdb0('0x1d')]===undefined?!![]:![]:!![],'where':_0xe5ad02[_0xfdb0('0x1c')]?_0xe5ad02[_0xfdb0('0x1c')]['where']||null:null,'attributes':_0xe5ad02[_0xfdb0('0x1c')]?_0xe5ad02[_0xfdb0('0x1c')][_0xfdb0('0x1e')]||null:null,'limit':_0xe5ad02[_0xfdb0('0x1c')]?_0xe5ad02[_0xfdb0('0x1c')]['limit']||null:null,'include':_0xe5ad02[_0xfdb0('0x1c')]?_0xe5ad02[_0xfdb0('0x1c')][_0xfdb0('0x1f')]?_[_0xfdb0('0x20')](_0xe5ad02['options'][_0xfdb0('0x1f')],function(_0x1fbc16){return{'model':db[_0x1fbc16[_0xfdb0('0x21')]],'as':_0x1fbc16['as'],'attributes':_0x1fbc16[_0xfdb0('0x1e')],'include':_0x1fbc16['include']?_[_0xfdb0('0x20')](_0x1fbc16['include'],function(_0x177ed7){return{'model':db[_0x177ed7[_0xfdb0('0x21')]],'as':_0x177ed7['as'],'attributes':_0x177ed7[_0xfdb0('0x1e')],'include':_0x177ed7[_0xfdb0('0x1f')]?_[_0xfdb0('0x20')](_0x177ed7['include'],function(_0x453d4c){return{'model':db[_0x453d4c[_0xfdb0('0x21')]],'as':_0x453d4c['as'],'attributes':_0x453d4c['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdb0('0x11')](function(_0x223f8d){logger['info'](_0xfdb0('0x19'),_0xe5ad02);logger[_0xfdb0('0x22')](_0xfdb0('0x19'),_0xe5ad02,JSON[_0xfdb0('0x23')](_0x223f8d));_0x59d37c(_0x223f8d);})[_0xfdb0('0x24')](function(_0x402fc7){logger[_0xfdb0('0x14')](_0xfdb0('0x19'),_0x402fc7[_0xfdb0('0x16')],_0xe5ad02);_0x12197b(_0x4ca42e[_0xfdb0('0x14')](0x1f4,_0x402fc7[_0xfdb0('0x16')]));});});};exports[_0xfdb0('0x25')]=function(_0x5c2c25){var _0x4c06f3=this;return new Promise(function(_0x8d8974,_0x5754b4){return db[_0xfdb0('0x1a')][_0xfdb0('0x26')]({'raw':_0x5c2c25[_0xfdb0('0x1c')]?_0x5c2c25[_0xfdb0('0x1c')][_0xfdb0('0x1d')]===undefined?!![]:![]:!![],'where':_0x5c2c25[_0xfdb0('0x1c')]?_0x5c2c25['options']['where']||null:null,'attributes':_0x5c2c25[_0xfdb0('0x1c')]?_0x5c2c25['options']['attributes']||null:null,'include':_0x5c2c25[_0xfdb0('0x1c')]?_0x5c2c25['options'][_0xfdb0('0x1f')]?_[_0xfdb0('0x20')](_0x5c2c25['options']['include'],function(_0x183449){return{'model':db[_0x183449['model']],'as':_0x183449['as'],'attributes':_0x183449[_0xfdb0('0x1e')],'include':_0x183449[_0xfdb0('0x1f')]?_[_0xfdb0('0x20')](_0x183449[_0xfdb0('0x1f')],function(_0x27c9fe){return{'model':db[_0x27c9fe[_0xfdb0('0x21')]],'as':_0x27c9fe['as'],'attributes':_0x27c9fe[_0xfdb0('0x1e')],'include':_0x27c9fe['include']?_[_0xfdb0('0x20')](_0x27c9fe['include'],function(_0x311ca6){return{'model':db[_0x311ca6['model']],'as':_0x311ca6['as'],'attributes':_0x311ca6['attributes']};}):[]};}):[]};}):[]:[]})[_0xfdb0('0x11')](function(_0x396b0e){logger[_0xfdb0('0x12')]('ShowOpenchannelQueue',_0x5c2c25);logger[_0xfdb0('0x22')]('ShowOpenchannelQueue',_0x5c2c25,JSON[_0xfdb0('0x23')](_0x396b0e));_0x8d8974(_0x396b0e);})[_0xfdb0('0x24')](function(_0x454b10){logger[_0xfdb0('0x14')](_0xfdb0('0x25'),_0x454b10[_0xfdb0('0x16')],_0x5c2c25);_0x5754b4(_0x4c06f3[_0xfdb0('0x14')](0x1f4,_0x454b10[_0xfdb0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index c97de3c..1ca8804 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 _0x9d5c=['save','removeListener','length','./openchannelQueue.events'];(function(_0x5ba1ef,_0x121ef4){var _0xb3f9a8=function(_0x5398eb){while(--_0x5398eb){_0x5ba1ef['push'](_0x5ba1ef['shift']());}};_0xb3f9a8(++_0x121ef4);}(_0x9d5c,0x67));var _0xc9d5=function(_0x2903f8,_0x444a03){_0x2903f8=_0x2903f8-0x0;var _0x4d757f=_0x9d5c[_0x2903f8];return _0x4d757f;};'use strict';var OpenchannelQueueEvents=require(_0xc9d5('0x0'));var events=[_0xc9d5('0x1'),'remove','update'];function createListener(_0x27fb2c,_0x17dcf2){return function(_0x56d733){_0x17dcf2['emit'](_0x27fb2c,_0x56d733);};}function removeListener(_0x19b892,_0x4bf4ff){return function(){OpenchannelQueueEvents[_0xc9d5('0x2')](_0x19b892,_0x4bf4ff);};}exports['register']=function(_0x17e5c6){for(var _0x210932=0x0,_0x112210=events[_0xc9d5('0x3')];_0x210932<_0x112210;_0x210932++){var _0x154ff4=events[_0x210932];var _0x1db574=createListener('openchannelQueue:'+_0x154ff4,_0x17e5c6);OpenchannelQueueEvents['on'](_0x154ff4,_0x1db574);}}; \ No newline at end of file +var _0x1280=['length','./openchannelQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x24697b,_0x2eb072){var _0x585b99=function(_0x261980){while(--_0x261980){_0x24697b['push'](_0x24697b['shift']());}};_0x585b99(++_0x2eb072);}(_0x1280,0x189));var _0x0128=function(_0x267c52,_0x3c0df3){_0x267c52=_0x267c52-0x0;var _0x46c47b=_0x1280[_0x267c52];return _0x46c47b;};'use strict';var OpenchannelQueueEvents=require(_0x0128('0x0'));var events=[_0x0128('0x1'),_0x0128('0x2'),_0x0128('0x3')];function createListener(_0x1a13b3,_0x119f50){return function(_0x3807bf){_0x119f50[_0x0128('0x4')](_0x1a13b3,_0x3807bf);};}function removeListener(_0x2c1b90,_0x1c4ad5){return function(){OpenchannelQueueEvents[_0x0128('0x5')](_0x2c1b90,_0x1c4ad5);};}exports[_0x0128('0x6')]=function(_0x5aa52b){for(var _0x41d818=0x0,_0x4c27fd=events[_0x0128('0x7')];_0x41d818<_0x4c27fd;_0x41d818++){var _0x13867c=events[_0x41d818];var _0x1ac8c=createListener('openchannelQueue:'+_0x13867c,_0x5aa52b);OpenchannelQueueEvents['on'](_0x13867c,_0x1ac8c);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 0d91af6..77d4f82 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 _0x4022=['path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','get','describe','/:id','show','post','update','delete','exports','util'];(function(_0x26721d,_0x448ba5){var _0x1035c5=function(_0x1c1b86){while(--_0x1c1b86){_0x26721d['push'](_0x26721d['shift']());}};_0x1035c5(++_0x448ba5);}(_0x4022,0xed));var _0x2402=function(_0x3590fc,_0x26e447){_0x3590fc=_0x3590fc-0x0;var _0x429de2=_0x4022[_0x3590fc];return _0x429de2;};'use strict';var multer=require('multer');var util=require(_0x2402('0x0'));var path=require(_0x2402('0x1'));var timeout=require(_0x2402('0x2'));var express=require(_0x2402('0x3'));var router=express['Router']();var fs_extra=require(_0x2402('0x4'));var auth=require(_0x2402('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2402('0x6'));var controller=require(_0x2402('0x7'));router['get']('/',auth[_0x2402('0x8')](),controller['index']);router[_0x2402('0x9')]('/describe',auth[_0x2402('0x8')](),controller[_0x2402('0xa')]);router['get'](_0x2402('0xb'),auth[_0x2402('0x8')](),controller[_0x2402('0xc')]);router[_0x2402('0xd')]('/',auth[_0x2402('0x8')](),controller['create']);router['put'](_0x2402('0xb'),auth[_0x2402('0x8')](),controller[_0x2402('0xe')]);router[_0x2402('0xf')](_0x2402('0xb'),auth[_0x2402('0x8')](),controller['destroy']);module[_0x2402('0x10')]=router; \ No newline at end of file +var _0x8192=['exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','destroy'];(function(_0xe50651,_0x78b476){var _0xc8931c=function(_0x1c2902){while(--_0x1c2902){_0xe50651['push'](_0xe50651['shift']());}};_0xc8931c(++_0x78b476);}(_0x8192,0x12d));var _0x2819=function(_0x32950d,_0x1caf2b){_0x32950d=_0x32950d-0x0;var _0x7e80aa=_0x8192[_0x32950d];return _0x7e80aa;};'use strict';var multer=require(_0x2819('0x0'));var util=require('util');var path=require(_0x2819('0x1'));var timeout=require(_0x2819('0x2'));var express=require(_0x2819('0x3'));var router=express['Router']();var fs_extra=require(_0x2819('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2819('0x5'));var config=require(_0x2819('0x6'));var controller=require(_0x2819('0x7'));router[_0x2819('0x8')]('/',auth[_0x2819('0x9')](),controller[_0x2819('0xa')]);router[_0x2819('0x8')](_0x2819('0xb'),auth[_0x2819('0x9')](),controller[_0x2819('0xc')]);router['get'](_0x2819('0xd'),auth[_0x2819('0x9')](),controller['show']);router[_0x2819('0xe')]('/',auth[_0x2819('0x9')](),controller[_0x2819('0xf')]);router[_0x2819('0x10')](_0x2819('0xd'),auth[_0x2819('0x9')](),controller[_0x2819('0x11')]);router['delete']('/:id',auth[_0x2819('0x9')](),controller[_0x2819('0x12')]);module[_0x2819('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9931f46..96c8cca 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 _0xd84d=['DATE','moment','exports','STRING'];(function(_0x89097f,_0x565dfb){var _0x233f38=function(_0x2c9b2a){while(--_0x2c9b2a){_0x89097f['push'](_0x89097f['shift']());}};_0x233f38(++_0x565dfb);}(_0xd84d,0x69));var _0xdd84=function(_0x1d1ebd,_0x55b797){_0x1d1ebd=_0x1d1ebd-0x0;var _0xdc271c=_0xd84d[_0x1d1ebd];return _0xdc271c;};'use strict';var moment=require(_0xdd84('0x0'));var Sequelize=require('sequelize');module[_0xdd84('0x1')]={'uniqueid':{'type':Sequelize[_0xdd84('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xdd84('0x2')]},'joinAt':{'type':Sequelize[_0xdd84('0x3')]},'leaveAt':{'type':Sequelize[_0xdd84('0x3')]},'acceptAt':{'type':Sequelize[_0xdd84('0x3')]},'exitAt':{'type':Sequelize[_0xdd84('0x3')]},'reason':{'type':Sequelize[_0xdd84('0x2')]}}; \ No newline at end of file +var _0x87cc=['exports','STRING','DATE','moment','sequelize'];(function(_0x9d1e6b,_0x3bdc22){var _0x2b3070=function(_0x4c4ced){while(--_0x4c4ced){_0x9d1e6b['push'](_0x9d1e6b['shift']());}};_0x2b3070(++_0x3bdc22);}(_0x87cc,0x15c));var _0xc87c=function(_0x1f0d95,_0x976eb1){_0x1f0d95=_0x1f0d95-0x0;var _0x26dba7=_0x87cc[_0x1f0d95];return _0x26dba7;};'use strict';var moment=require(_0xc87c('0x0'));var Sequelize=require(_0xc87c('0x1'));module[_0xc87c('0x2')]={'uniqueid':{'type':Sequelize[_0xc87c('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc87c('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xc87c('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xc87c('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index edf4f0b..eda54db 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 _0xa308=['where','merge','VIRTUAL','includeAll','findAll','rows','catch','show','params','options','create','body','find','describe','eml-format','fast-json-patch','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','Content-Range','apply','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','limit','order','filters','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa308,0x171));var _0x8a30=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xa308[_0x21f931];return _0x3f083c;};'use strict';var emlformat=require(_0x8a30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8a30('0x1'));var rp=require('request-promise');var moment=require(_0x8a30('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x8a30('0x3'));var util=require(_0x8a30('0x4'));var path=require('path');var sox=require('sox');var csv=require(_0x8a30('0x5'));var ejs=require(_0x8a30('0x6'));var fs=require('fs');var fs_extra=require(_0x8a30('0x7'));var _=require(_0x8a30('0x8'));var squel=require(_0x8a30('0x9'));var crypto=require(_0x8a30('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x8a30('0xb'));var toCsv=require(_0x8a30('0x5'));var querystring=require(_0x8a30('0xc'));var Papa=require(_0x8a30('0xd'));var Redis=require(_0x8a30('0xe'));var authService=require(_0x8a30('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x8a30('0x10'));var hardwareService=require(_0x8a30('0x11'));var logger=require(_0x8a30('0x12'))(_0x8a30('0x13'));var utils=require(_0x8a30('0x14'));var config=require(_0x8a30('0x15'));var licenseUtil=require(_0x8a30('0x16'));var db=require(_0x8a30('0x17'))['db'];function respondWithStatusCode(_0x4d3fc9,_0x625631){_0x625631=_0x625631||0xcc;return function(_0x28684d){if(_0x28684d){return _0x4d3fc9['sendStatus'](_0x625631);}return _0x4d3fc9['status'](_0x625631)['end']();};}function respondWithResult(_0x1555f6,_0x1d77e3){_0x1d77e3=_0x1d77e3||0xc8;return function(_0x1eb1d5){if(_0x1eb1d5){return _0x1555f6[_0x8a30('0x18')](_0x1d77e3)['json'](_0x1eb1d5);}};}function respondWithFilteredResult(_0x435c33,_0x2a8c60){return function(_0x234db9){if(_0x234db9){var _0xcd841b=typeof _0x2a8c60[_0x8a30('0x19')]===_0x8a30('0x1a')&&typeof _0x2a8c60['limit']===_0x8a30('0x1a');var _0x152d40=_0x234db9[_0x8a30('0x1b')];var _0x5edf3d=_0xcd841b?0x0:_0x2a8c60[_0x8a30('0x19')];var _0x5d794b=_0xcd841b?_0x234db9[_0x8a30('0x1b')]:_0x2a8c60[_0x8a30('0x19')]+_0x2a8c60['limit'];var _0x20b3e1;if(_0x5d794b>=_0x152d40){_0x5d794b=_0x152d40;_0x20b3e1=0xc8;}else{_0x20b3e1=0xce;}_0x435c33['status'](_0x20b3e1);return _0x435c33['set'](_0x8a30('0x1c'),_0x5edf3d+'-'+_0x5d794b+'/'+_0x152d40)['json'](_0x234db9);}return null;};}function patchUpdates(_0xe59490){return function(_0x5aa807){try{jsonpatch[_0x8a30('0x1d')](_0x5aa807,_0xe59490,!![]);}catch(_0x32ee26){return BPromise['reject'](_0x32ee26);}return _0x5aa807['save']();};}function saveUpdates(_0x365843,_0x4ee057){return function(_0x1a3ca0){if(_0x1a3ca0){return _0x1a3ca0[_0x8a30('0x1e')](_0x365843)[_0x8a30('0x1f')](function(_0x157175){return _0x157175;});}return null;};}function removeEntity(_0x29966e,_0x318018){return function(_0x111311){if(_0x111311){return _0x111311[_0x8a30('0x20')]()[_0x8a30('0x1f')](function(){_0x29966e[_0x8a30('0x18')](0xcc)[_0x8a30('0x21')]();});}};}function handleEntityNotFound(_0x591258,_0x2d0735){return function(_0x3e08c0){if(!_0x3e08c0){_0x591258['sendStatus'](0x194);}return _0x3e08c0;};}function handleError(_0x3573b6,_0x5e366d){_0x5e366d=_0x5e366d||0x1f4;return function(_0x39a780){logger[_0x8a30('0x22')](_0x39a780[_0x8a30('0x23')]);if(_0x39a780[_0x8a30('0x24')]){delete _0x39a780[_0x8a30('0x24')];}_0x3573b6[_0x8a30('0x18')](_0x5e366d)[_0x8a30('0x25')](_0x39a780);};}exports[_0x8a30('0x26')]=function(_0x9115c4,_0x4754db){var _0x5a59c5={},_0x4bbc6b={},_0x166145={'count':0x0,'rows':[]};var _0x127d36=_[_0x8a30('0x27')](db[_0x8a30('0x28')][_0x8a30('0x29')],function(_0x4b2c9b){return{'name':_0x4b2c9b[_0x8a30('0x2a')],'type':_0x4b2c9b[_0x8a30('0x2b')][_0x8a30('0x2c')]};});_0x4bbc6b[_0x8a30('0x2d')]=_[_0x8a30('0x27')](_0x127d36,'name');_0x4bbc6b[_0x8a30('0x2e')]=_[_0x8a30('0x2f')](_0x9115c4['query']);_0x4bbc6b['filters']=_[_0x8a30('0x30')](_0x4bbc6b['model'],_0x4bbc6b['query']);_0x5a59c5[_0x8a30('0x31')]=_['intersection'](_0x4bbc6b['model'],qs[_0x8a30('0x32')](_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x32')]));_0x5a59c5[_0x8a30('0x31')]=_0x5a59c5[_0x8a30('0x31')][_0x8a30('0x33')]?_0x5a59c5[_0x8a30('0x31')]:_0x4bbc6b[_0x8a30('0x2d')];if(!_0x9115c4[_0x8a30('0x2e')]['hasOwnProperty']('nolimit')){_0x5a59c5['limit']=qs[_0x8a30('0x34')](_0x9115c4['query'][_0x8a30('0x34')]);_0x5a59c5[_0x8a30('0x19')]=qs[_0x8a30('0x19')](_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x19')]);}_0x5a59c5[_0x8a30('0x35')]=qs['sort'](_0x9115c4[_0x8a30('0x2e')]['sort']);_0x5a59c5['where']=qs[_0x8a30('0x36')](_[_0x8a30('0x37')](_0x9115c4['query'],_0x4bbc6b[_0x8a30('0x36')]),_0x127d36);if(_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x38')]){_0x5a59c5[_0x8a30('0x39')]=_[_0x8a30('0x3a')](_0x5a59c5[_0x8a30('0x39')],{'$or':_[_0x8a30('0x27')](_0x127d36,function(_0x261d45){if(_0x261d45[_0x8a30('0x2b')]!==_0x8a30('0x3b')){var _0x1a0be2={};_0x1a0be2[_0x261d45['name']]={'$like':'%'+_0x9115c4[_0x8a30('0x2e')][_0x8a30('0x38')]+'%'};return _0x1a0be2;}})});}_0x5a59c5=_[_0x8a30('0x3a')]({},_0x5a59c5,_0x9115c4['options']);var _0x25bdc4={'where':_0x5a59c5[_0x8a30('0x39')]};return db[_0x8a30('0x28')]['count'](_0x25bdc4)[_0x8a30('0x1f')](function(_0xd15e2f){_0x166145[_0x8a30('0x1b')]=_0xd15e2f;if(_0x9115c4['query'][_0x8a30('0x3c')]){_0x5a59c5['include']=[{'all':!![]}];}return db[_0x8a30('0x28')][_0x8a30('0x3d')](_0x5a59c5);})[_0x8a30('0x1f')](function(_0x524ffe){_0x166145[_0x8a30('0x3e')]=_0x524ffe;return _0x166145;})[_0x8a30('0x1f')](respondWithFilteredResult(_0x4754db,_0x5a59c5))[_0x8a30('0x3f')](handleError(_0x4754db,null));};exports[_0x8a30('0x40')]=function(_0x3fe7bc,_0x191441){var _0x28effe={'raw':!![],'where':{'id':_0x3fe7bc[_0x8a30('0x41')]['id']}},_0x51e5c3={};_0x51e5c3[_0x8a30('0x2d')]=_[_0x8a30('0x2f')](db[_0x8a30('0x28')][_0x8a30('0x29')]);_0x51e5c3[_0x8a30('0x2e')]=_['keys'](_0x3fe7bc[_0x8a30('0x2e')]);_0x51e5c3[_0x8a30('0x36')]=_[_0x8a30('0x30')](_0x51e5c3[_0x8a30('0x2d')],_0x51e5c3[_0x8a30('0x2e')]);_0x28effe[_0x8a30('0x31')]=_[_0x8a30('0x30')](_0x51e5c3[_0x8a30('0x2d')],qs[_0x8a30('0x32')](_0x3fe7bc['query'][_0x8a30('0x32')]));_0x28effe[_0x8a30('0x31')]=_0x28effe[_0x8a30('0x31')][_0x8a30('0x33')]?_0x28effe[_0x8a30('0x31')]:_0x51e5c3[_0x8a30('0x2d')];if(_0x3fe7bc[_0x8a30('0x2e')][_0x8a30('0x3c')]){_0x28effe['include']=[{'all':!![]}];}_0x28effe=_[_0x8a30('0x3a')]({},_0x28effe,_0x3fe7bc[_0x8a30('0x42')]);return db['OpenchannelQueueReport']['find'](_0x28effe)['then'](handleEntityNotFound(_0x191441,null))[_0x8a30('0x1f')](respondWithResult(_0x191441,null))[_0x8a30('0x3f')](handleError(_0x191441,null));};exports[_0x8a30('0x43')]=function(_0x2caa5b,_0x4bdb76){return db['OpenchannelQueueReport']['create'](_0x2caa5b[_0x8a30('0x44')],{})[_0x8a30('0x1f')](respondWithResult(_0x4bdb76,0xc9))[_0x8a30('0x3f')](handleError(_0x4bdb76,null));};exports[_0x8a30('0x1e')]=function(_0x17d8b2,_0x47ab9f){if(_0x17d8b2[_0x8a30('0x44')]['id']){delete _0x17d8b2[_0x8a30('0x44')]['id'];}return db['OpenchannelQueueReport']['find']({'where':{'id':_0x17d8b2['params']['id']}})[_0x8a30('0x1f')](handleEntityNotFound(_0x47ab9f,null))[_0x8a30('0x1f')](saveUpdates(_0x17d8b2[_0x8a30('0x44')],null))['then'](respondWithResult(_0x47ab9f,null))[_0x8a30('0x3f')](handleError(_0x47ab9f,null));};exports[_0x8a30('0x20')]=function(_0x4c800d,_0x54a6c0){return db[_0x8a30('0x28')][_0x8a30('0x45')]({'where':{'id':_0x4c800d[_0x8a30('0x41')]['id']}})[_0x8a30('0x1f')](handleEntityNotFound(_0x54a6c0,null))[_0x8a30('0x1f')](removeEntity(_0x54a6c0,null))[_0x8a30('0x3f')](handleError(_0x54a6c0,null));};exports[_0x8a30('0x46')]=function(_0x3aefb7,_0xc9e511){return db[_0x8a30('0x28')][_0x8a30('0x46')]()[_0x8a30('0x1f')](respondWithResult(_0xc9e511,null))[_0x8a30('0x3f')](handleError(_0xc9e511,null));}; \ No newline at end of file +var _0x211b=['fs-extra','lodash','squel','jsforce','desk.js','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','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','OpenchannelQueueReport','rawAttributes','fieldName','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','mustache','util','sox','to-csv'];(function(_0x476e3a,_0x238e7f){var _0x495c07=function(_0x34a55e){while(--_0x34a55e){_0x476e3a['push'](_0x476e3a['shift']());}};_0x495c07(++_0x238e7f);}(_0x211b,0xd7));var _0xb211=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x211b[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0xb211('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb211('0x1'));var jsonpatch=require(_0xb211('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb211('0x3'));var util=require(_0xb211('0x4'));var path=require('path');var sox=require(_0xb211('0x5'));var csv=require(_0xb211('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb211('0x7'));var _=require(_0xb211('0x8'));var squel=require(_0xb211('0x9'));var crypto=require('crypto');var jsforce=require(_0xb211('0xa'));var deskjs=require(_0xb211('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb211('0xc'));var Redis=require(_0xb211('0xd'));var authService=require(_0xb211('0xe'));var qs=require(_0xb211('0xf'));var as=require(_0xb211('0x10'));var hardwareService=require(_0xb211('0x11'));var logger=require(_0xb211('0x12'))('api');var utils=require(_0xb211('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb211('0x14'));var db=require(_0xb211('0x15'))['db'];function respondWithStatusCode(_0x45be3f,_0x3148b2){_0x3148b2=_0x3148b2||0xcc;return function(_0x250957){if(_0x250957){return _0x45be3f[_0xb211('0x16')](_0x3148b2);}return _0x45be3f[_0xb211('0x17')](_0x3148b2)[_0xb211('0x18')]();};}function respondWithResult(_0x5cc10e,_0x40c908){_0x40c908=_0x40c908||0xc8;return function(_0x363760){if(_0x363760){return _0x5cc10e[_0xb211('0x17')](_0x40c908)['json'](_0x363760);}};}function respondWithFilteredResult(_0x3c8810,_0x2b4189){return function(_0x30f554){if(_0x30f554){var _0x1c9def=typeof _0x2b4189[_0xb211('0x19')]==='undefined'&&typeof _0x2b4189['limit']===_0xb211('0x1a');var _0x4e8fd9=_0x30f554[_0xb211('0x1b')];var _0x53841a=_0x1c9def?0x0:_0x2b4189[_0xb211('0x19')];var _0x53cf8d=_0x1c9def?_0x30f554[_0xb211('0x1b')]:_0x2b4189[_0xb211('0x19')]+_0x2b4189[_0xb211('0x1c')];var _0x270b71;if(_0x53cf8d>=_0x4e8fd9){_0x53cf8d=_0x4e8fd9;_0x270b71=0xc8;}else{_0x270b71=0xce;}_0x3c8810[_0xb211('0x17')](_0x270b71);return _0x3c8810['set'](_0xb211('0x1d'),_0x53841a+'-'+_0x53cf8d+'/'+_0x4e8fd9)['json'](_0x30f554);}return null;};}function patchUpdates(_0x19ff9c){return function(_0x33b15c){try{jsonpatch[_0xb211('0x1e')](_0x33b15c,_0x19ff9c,!![]);}catch(_0x59e5c9){return BPromise[_0xb211('0x1f')](_0x59e5c9);}return _0x33b15c[_0xb211('0x20')]();};}function saveUpdates(_0x1c9b03,_0xe5517f){return function(_0x18a478){if(_0x18a478){return _0x18a478[_0xb211('0x21')](_0x1c9b03)['then'](function(_0x3891d0){return _0x3891d0;});}return null;};}function removeEntity(_0x4fed01,_0x3cfbaa){return function(_0x31f994){if(_0x31f994){return _0x31f994[_0xb211('0x22')]()[_0xb211('0x23')](function(){_0x4fed01[_0xb211('0x17')](0xcc)[_0xb211('0x18')]();});}};}function handleEntityNotFound(_0x3db765,_0x1bb83a){return function(_0x1c735b){if(!_0x1c735b){_0x3db765[_0xb211('0x16')](0x194);}return _0x1c735b;};}function handleError(_0x164a78,_0x22c890){_0x22c890=_0x22c890||0x1f4;return function(_0x108369){logger[_0xb211('0x24')](_0x108369[_0xb211('0x25')]);if(_0x108369[_0xb211('0x26')]){delete _0x108369[_0xb211('0x26')];}_0x164a78['status'](_0x22c890)[_0xb211('0x27')](_0x108369);};}exports[_0xb211('0x28')]=function(_0x962ab4,_0x10f3c7){var _0xbd5305={},_0x395d51={},_0x1dcbbf={'count':0x0,'rows':[]};var _0x24778f=_['map'](db[_0xb211('0x29')][_0xb211('0x2a')],function(_0x5c3f15){return{'name':_0x5c3f15[_0xb211('0x2b')],'type':_0x5c3f15['type']['key']};});_0x395d51[_0xb211('0x2c')]=_[_0xb211('0x2d')](_0x24778f,_0xb211('0x26'));_0x395d51['query']=_[_0xb211('0x2e')](_0x962ab4[_0xb211('0x2f')]);_0x395d51[_0xb211('0x30')]=_[_0xb211('0x31')](_0x395d51[_0xb211('0x2c')],_0x395d51[_0xb211('0x2f')]);_0xbd5305[_0xb211('0x32')]=_['intersection'](_0x395d51[_0xb211('0x2c')],qs[_0xb211('0x33')](_0x962ab4[_0xb211('0x2f')][_0xb211('0x33')]));_0xbd5305['attributes']=_0xbd5305[_0xb211('0x32')]['length']?_0xbd5305['attributes']:_0x395d51[_0xb211('0x2c')];if(!_0x962ab4[_0xb211('0x2f')][_0xb211('0x34')](_0xb211('0x35'))){_0xbd5305[_0xb211('0x1c')]=qs[_0xb211('0x1c')](_0x962ab4['query']['limit']);_0xbd5305[_0xb211('0x19')]=qs[_0xb211('0x19')](_0x962ab4['query'][_0xb211('0x19')]);}_0xbd5305[_0xb211('0x36')]=qs[_0xb211('0x37')](_0x962ab4[_0xb211('0x2f')][_0xb211('0x37')]);_0xbd5305['where']=qs[_0xb211('0x30')](_[_0xb211('0x38')](_0x962ab4[_0xb211('0x2f')],_0x395d51['filters']),_0x24778f);if(_0x962ab4[_0xb211('0x2f')]['filter']){_0xbd5305[_0xb211('0x39')]=_[_0xb211('0x3a')](_0xbd5305[_0xb211('0x39')],{'$or':_['map'](_0x24778f,function(_0x2bd2dc){if(_0x2bd2dc[_0xb211('0x3b')]!==_0xb211('0x3c')){var _0x5e5496={};_0x5e5496[_0x2bd2dc[_0xb211('0x26')]]={'$like':'%'+_0x962ab4[_0xb211('0x2f')][_0xb211('0x3d')]+'%'};return _0x5e5496;}})});}_0xbd5305=_['merge']({},_0xbd5305,_0x962ab4[_0xb211('0x3e')]);var _0x2818e7={'where':_0xbd5305[_0xb211('0x39')]};return db['OpenchannelQueueReport'][_0xb211('0x1b')](_0x2818e7)[_0xb211('0x23')](function(_0x2ee00c){_0x1dcbbf['count']=_0x2ee00c;if(_0x962ab4[_0xb211('0x2f')]['includeAll']){_0xbd5305['include']=[{'all':!![]}];}return db[_0xb211('0x29')][_0xb211('0x3f')](_0xbd5305);})[_0xb211('0x23')](function(_0x5b281b){_0x1dcbbf[_0xb211('0x40')]=_0x5b281b;return _0x1dcbbf;})[_0xb211('0x23')](respondWithFilteredResult(_0x10f3c7,_0xbd5305))[_0xb211('0x41')](handleError(_0x10f3c7,null));};exports[_0xb211('0x42')]=function(_0x9c8f4d,_0x17f15a){var _0x4025e4={'raw':!![],'where':{'id':_0x9c8f4d[_0xb211('0x43')]['id']}},_0x5567a2={};_0x5567a2[_0xb211('0x2c')]=_[_0xb211('0x2e')](db[_0xb211('0x29')][_0xb211('0x2a')]);_0x5567a2['query']=_[_0xb211('0x2e')](_0x9c8f4d['query']);_0x5567a2[_0xb211('0x30')]=_[_0xb211('0x31')](_0x5567a2['model'],_0x5567a2[_0xb211('0x2f')]);_0x4025e4[_0xb211('0x32')]=_[_0xb211('0x31')](_0x5567a2[_0xb211('0x2c')],qs[_0xb211('0x33')](_0x9c8f4d[_0xb211('0x2f')][_0xb211('0x33')]));_0x4025e4[_0xb211('0x32')]=_0x4025e4[_0xb211('0x32')]['length']?_0x4025e4[_0xb211('0x32')]:_0x5567a2[_0xb211('0x2c')];if(_0x9c8f4d['query'][_0xb211('0x44')]){_0x4025e4[_0xb211('0x45')]=[{'all':!![]}];}_0x4025e4=_[_0xb211('0x3a')]({},_0x4025e4,_0x9c8f4d[_0xb211('0x3e')]);return db[_0xb211('0x29')]['find'](_0x4025e4)['then'](handleEntityNotFound(_0x17f15a,null))[_0xb211('0x23')](respondWithResult(_0x17f15a,null))[_0xb211('0x41')](handleError(_0x17f15a,null));};exports['create']=function(_0x279514,_0x4f1c74){return db[_0xb211('0x29')][_0xb211('0x46')](_0x279514[_0xb211('0x47')],{})['then'](respondWithResult(_0x4f1c74,0xc9))[_0xb211('0x41')](handleError(_0x4f1c74,null));};exports[_0xb211('0x21')]=function(_0x205fa9,_0x4cf70c){if(_0x205fa9['body']['id']){delete _0x205fa9['body']['id'];}return db[_0xb211('0x29')][_0xb211('0x48')]({'where':{'id':_0x205fa9[_0xb211('0x43')]['id']}})[_0xb211('0x23')](handleEntityNotFound(_0x4cf70c,null))[_0xb211('0x23')](saveUpdates(_0x205fa9[_0xb211('0x47')],null))[_0xb211('0x23')](respondWithResult(_0x4cf70c,null))[_0xb211('0x41')](handleError(_0x4cf70c,null));};exports['destroy']=function(_0x5a03a8,_0x2675f3){return db[_0xb211('0x29')][_0xb211('0x48')]({'where':{'id':_0x5a03a8[_0xb211('0x43')]['id']}})[_0xb211('0x23')](handleEntityNotFound(_0x2675f3,null))[_0xb211('0x23')](removeEntity(_0x2675f3,null))[_0xb211('0x41')](handleError(_0x2675f3,null));};exports[_0xb211('0x49')]=function(_0x20e94d,_0x300658){return db[_0xb211('0x29')][_0xb211('0x49')]()[_0xb211('0x23')](respondWithResult(_0x300658,null))[_0xb211('0x41')](handleError(_0x300658,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 96eb263..2a981bf 100644 --- a/server/api/openchannelQueueReport/openchannelQueueReport.model.js +++ b/server/api/openchannelQueueReport/openchannelQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','uniqueid','lodash','util'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x814b,0x1a2));var _0xb814=function(_0x17823f,_0xffd807){_0x17823f=_0x17823f-0x0;var _0x51fc21=_0x814b[_0x17823f];return _0x51fc21;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_openchannel_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['report_openchannel_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','exports','OpenchannelQueueReport'];(function(_0x50b8e9,_0x84d2f9){var _0x25379e=function(_0x35a5a2){while(--_0x35a5a2){_0x50b8e9['push'](_0x50b8e9['shift']());}};_0x25379e(++_0x84d2f9);}(_0x7a54,0x106));var _0x47a5=function(_0x226d04,_0x3130ab){_0x226d04=_0x226d04-0x0;var _0x48fde8=_0x7a54[_0x226d04];return _0x48fde8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index cf96425..1006e17 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 _0xfcbb=['body','raw','where','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','options','UpdateOpenchannelQueueReport','update'];(function(_0x398483,_0x2cbf55){var _0xe1b3d5=function(_0x38623b){while(--_0x38623b){_0x398483['push'](_0x398483['shift']());}};_0xe1b3d5(++_0x2cbf55);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x18f54a,_0x3af323){_0x18f54a=_0x18f54a-0x0;var _0x154f3f=_0xfcbb[_0x18f54a];return _0x154f3f;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var moment=require(_0xbfcb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfcb('0x3'));var db=require(_0xbfcb('0x4'))['db'];var utils=require(_0xbfcb('0x5'));var logger=require(_0xbfcb('0x6'))(_0xbfcb('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbfcb('0x8')][_0xbfcb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8d4e6a,_0x2df839,_0x288ee5){return new BPromise(function(_0x2f875c,_0x49717b){return client['request'](_0x8d4e6a,_0x288ee5)[_0xbfcb('0xa')](function(_0x331173){logger[_0xbfcb('0xb')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2df839,_0xbfcb('0xc'));logger[_0xbfcb('0xd')](_0xbfcb('0xe'),_0x2df839,_0xbfcb('0xc'),JSON[_0xbfcb('0xf')](_0x331173));if(_0x331173[_0xbfcb('0x10')]){if(_0x331173['error'][_0xbfcb('0x11')]===0x1f4){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')]['message']);return _0x49717b(_0x331173[_0xbfcb('0x10')]['message']);}logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);return _0x2f875c(_0x331173[_0xbfcb('0x10')][_0xbfcb('0x13')]);}else{logger[_0xbfcb('0xb')](_0xbfcb('0x12'),_0x2df839,_0xbfcb('0xc'));_0x2f875c(_0x331173[_0xbfcb('0x14')][_0xbfcb('0x13')]);}})[_0xbfcb('0x15')](function(_0x26f335){logger[_0xbfcb('0x10')](_0xbfcb('0x12'),_0x2df839,_0x26f335);_0x49717b(_0x26f335);});});}exports[_0xbfcb('0x16')]=function(_0xba1d6){var _0x38689e=this;return new Promise(function(_0x3404aa,_0x46b8d2){return db[_0xbfcb('0x17')][_0xbfcb('0x18')](_0xba1d6['body'],{'raw':_0xba1d6[_0xbfcb('0x19')]?_0xba1d6[_0xbfcb('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xbfcb('0xa')](function(_0x1a7225){logger['info']('CreateOpenchannelQueueReport',_0xba1d6);logger[_0xbfcb('0xd')](_0xbfcb('0x16'),_0xba1d6,JSON[_0xbfcb('0xf')](_0x1a7225));_0x3404aa(_0x1a7225);})[_0xbfcb('0x15')](function(_0x1c5924){logger['error'](_0xbfcb('0x16'),_0x1c5924[_0xbfcb('0x13')],_0xba1d6);_0x46b8d2(_0x38689e[_0xbfcb('0x10')](0x1f4,_0x1c5924[_0xbfcb('0x13')]));});});};exports[_0xbfcb('0x1a')]=function(_0x19616c){var _0x69c8e9=this;return new Promise(function(_0x14e43c,_0x11f6f7){return db[_0xbfcb('0x17')][_0xbfcb('0x1b')](_0x19616c[_0xbfcb('0x1c')],{'raw':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1e')]||null:null,'attributes':_0x19616c[_0xbfcb('0x19')]?_0x19616c['options'][_0xbfcb('0x1f')]||null:null,'limit':_0x19616c[_0xbfcb('0x19')]?_0x19616c[_0xbfcb('0x19')][_0xbfcb('0x20')]||null:null})[_0xbfcb('0xa')](function(_0x3542e9){logger[_0xbfcb('0xb')](_0xbfcb('0x1a'),_0x19616c);logger[_0xbfcb('0xd')](_0xbfcb('0x1a'),_0x19616c,JSON['stringify'](_0x3542e9));_0x14e43c(_0x3542e9);})[_0xbfcb('0x15')](function(_0x3aa3cd){logger[_0xbfcb('0x10')](_0xbfcb('0x1a'),_0x3aa3cd[_0xbfcb('0x13')],_0x19616c);_0x11f6f7(_0x69c8e9[_0xbfcb('0x10')](0x1f4,_0x3aa3cd[_0xbfcb('0x13')]));});});}; \ No newline at end of file +var _0x3de3=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateOpenchannelQueueReport','create','options','raw','OpenchannelQueueReport','body','attributes','limit','UpdateOpenchannelQueueReport','lodash','moment','bluebird'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x3de3,0x1ce));var _0x33de=function(_0x99e7b5,_0x5c18eb){_0x99e7b5=_0x99e7b5-0x0;var _0x297607=_0x3de3[_0x99e7b5];return _0x297607;};'use strict';var _=require(_0x33de('0x0'));var util=require('util');var moment=require(_0x33de('0x1'));var BPromise=require(_0x33de('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x33de('0x3'));var db=require(_0x33de('0x4'))['db'];var utils=require(_0x33de('0x5'));var logger=require(_0x33de('0x6'))('rpc');var config=require(_0x33de('0x7'));var jayson=require(_0x33de('0x8'));var client=jayson['client'][_0x33de('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x587be8,_0x13afea,_0x35ee93){return new BPromise(function(_0x7ceca6,_0x486ab6){return client[_0x33de('0xa')](_0x587be8,_0x35ee93)[_0x33de('0xb')](function(_0x2e0419){logger['info'](_0x33de('0xc'),_0x13afea,_0x33de('0xd'));logger[_0x33de('0xe')](_0x33de('0xf'),_0x13afea,_0x33de('0xd'),JSON[_0x33de('0x10')](_0x2e0419));if(_0x2e0419[_0x33de('0x11')]){if(_0x2e0419[_0x33de('0x11')][_0x33de('0x12')]===0x1f4){logger[_0x33de('0x11')](_0x33de('0xc'),_0x13afea,_0x2e0419['error'][_0x33de('0x13')]);return _0x486ab6(_0x2e0419[_0x33de('0x11')]['message']);}logger['error'](_0x33de('0xc'),_0x13afea,_0x2e0419[_0x33de('0x11')][_0x33de('0x13')]);return _0x7ceca6(_0x2e0419[_0x33de('0x11')]['message']);}else{logger[_0x33de('0x14')](_0x33de('0xc'),_0x13afea,'request\x20sent');_0x7ceca6(_0x2e0419['result'][_0x33de('0x13')]);}})[_0x33de('0x15')](function(_0x13e832){logger['error'](_0x33de('0xc'),_0x13afea,_0x13e832);_0x486ab6(_0x13e832);});});}exports[_0x33de('0x16')]=function(_0x52cfa0){var _0x2815a7=this;return new Promise(function(_0x201ff3,_0x482667){return db['OpenchannelQueueReport'][_0x33de('0x17')](_0x52cfa0['body'],{'raw':_0x52cfa0[_0x33de('0x18')]?_0x52cfa0[_0x33de('0x18')][_0x33de('0x19')]===undefined?!![]:![]:!![]})[_0x33de('0xb')](function(_0xc4f1a4){logger[_0x33de('0x14')](_0x33de('0x16'),_0x52cfa0);logger['debug']('CreateOpenchannelQueueReport',_0x52cfa0,JSON[_0x33de('0x10')](_0xc4f1a4));_0x201ff3(_0xc4f1a4);})['catch'](function(_0x8acd8d){logger['error'](_0x33de('0x16'),_0x8acd8d[_0x33de('0x13')],_0x52cfa0);_0x482667(_0x2815a7['error'](0x1f4,_0x8acd8d[_0x33de('0x13')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x67d040){var _0x5c602d=this;return new Promise(function(_0x62743b,_0x24e282){return db[_0x33de('0x1a')]['update'](_0x67d040[_0x33de('0x1b')],{'raw':_0x67d040[_0x33de('0x18')]?_0x67d040[_0x33de('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x67d040[_0x33de('0x18')]?_0x67d040['options']['where']||null:null,'attributes':_0x67d040[_0x33de('0x18')]?_0x67d040[_0x33de('0x18')][_0x33de('0x1c')]||null:null,'limit':_0x67d040[_0x33de('0x18')]?_0x67d040[_0x33de('0x18')][_0x33de('0x1d')]||null:null})[_0x33de('0xb')](function(_0x1b4703){logger['info']('UpdateOpenchannelQueueReport',_0x67d040);logger[_0x33de('0xe')](_0x33de('0x1e'),_0x67d040,JSON[_0x33de('0x10')](_0x1b4703));_0x62743b(_0x1b4703);})[_0x33de('0x15')](function(_0x167cec){logger[_0x33de('0x11')](_0x33de('0x1e'),_0x167cec['message'],_0x67d040);_0x24e282(_0x5c602d[_0x33de('0x11')](0x1f4,_0x167cec[_0x33de('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f805992..ba2f84e 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 _0x64d2=['get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x64d2,0x162));var _0x264d=function(_0x59db19,_0x30c1c6){_0x59db19=_0x59db19-0x0;var _0x5f0f09=_0x64d2[_0x59db19];return _0x5f0f09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x264d('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x264d('0x1')]();var fs_extra=require(_0x264d('0x2'));var auth=require(_0x264d('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x264d('0x4'));var controller=require(_0x264d('0x5'));router[_0x264d('0x6')]('/',auth[_0x264d('0x7')](),controller[_0x264d('0x8')]);router[_0x264d('0x6')](_0x264d('0x9'),auth[_0x264d('0x7')](),controller[_0x264d('0xa')]);router[_0x264d('0x6')](_0x264d('0xb'),auth[_0x264d('0x7')](),controller['show']);router[_0x264d('0xc')]('/',auth[_0x264d('0x7')](),controller[_0x264d('0xd')]);router[_0x264d('0xe')](_0x264d('0xb'),auth[_0x264d('0x7')](),controller[_0x264d('0xf')]);router[_0x264d('0x10')](_0x264d('0xb'),auth[_0x264d('0x7')](),controller[_0x264d('0x11')]);module['exports']=router; \ No newline at end of file +var _0x869b=['update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','put'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x869b,0x76));var _0xb869=function(_0x469f47,_0x3a6e68){_0x469f47=_0x469f47-0x0;var _0x28e76f=_0x869b[_0x469f47];return _0x28e76f;};'use strict';var multer=require(_0xb869('0x0'));var util=require(_0xb869('0x1'));var path=require(_0xb869('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xb869('0x3'));var auth=require(_0xb869('0x4'));var interaction=require(_0xb869('0x5'));var config=require(_0xb869('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0xb869('0x7')]('/',auth[_0xb869('0x8')](),controller[_0xb869('0x9')]);router[_0xb869('0x7')](_0xb869('0xa'),auth[_0xb869('0x8')](),controller[_0xb869('0xb')]);router[_0xb869('0x7')](_0xb869('0xc'),auth[_0xb869('0x8')](),controller['show']);router[_0xb869('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb869('0xe')](_0xb869('0xc'),auth[_0xb869('0x8')](),controller[_0xb869('0xf')]);router[_0xb869('0x10')]('/:id',auth[_0xb869('0x8')](),controller[_0xb869('0x11')]);module[_0xb869('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 5d7d67f..2a61c40 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0xe7625d,_0x4dc922){var _0x31c7c9=function(_0x7c3531){while(--_0x7c3531){_0xe7625d['push'](_0xe7625d['shift']());}};_0x31c7c9(++_0x4dc922);}(_0x70e0,0x17b));var _0x070e=function(_0x357f44,_0x3eb92c){_0x357f44=_0x357f44-0x0;var _0x2c86da=_0x70e0[_0x357f44];return _0x2c86da;};'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 +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0xb43b,0x1b2));var _0xbb43=function(_0x42f5fe,_0xc452c3){_0x42f5fe=_0x42f5fe-0x0;var _0x1d01e6=_0xb43b[_0x42f5fe];return _0x1d01e6;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 9670db3..65a1535 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 _0xd9c4=['apply','reject','save','then','destroy','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','create','body','update','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range'];(function(_0x32b750,_0x2e914a){var _0x1cc809=function(_0x33f598){while(--_0x33f598){_0x32b750['push'](_0x32b750['shift']());}};_0x1cc809(++_0x2e914a);}(_0xd9c4,0x162));var _0x4d9c=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xd9c4[_0x26b8b5];return _0x2150a9;};'use strict';var emlformat=require(_0x4d9c('0x0'));var rimraf=require(_0x4d9c('0x1'));var zipdir=require(_0x4d9c('0x2'));var jsonpatch=require(_0x4d9c('0x3'));var rp=require(_0x4d9c('0x4'));var moment=require(_0x4d9c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4d9c('0x6'));var path=require('path');var sox=require(_0x4d9c('0x7'));var csv=require(_0x4d9c('0x8'));var ejs=require(_0x4d9c('0x9'));var fs=require('fs');var fs_extra=require(_0x4d9c('0xa'));var _=require('lodash');var squel=require(_0x4d9c('0xb'));var crypto=require(_0x4d9c('0xc'));var jsforce=require(_0x4d9c('0xd'));var deskjs=require(_0x4d9c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4d9c('0xf'));var Papa=require(_0x4d9c('0x10'));var Redis=require(_0x4d9c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4d9c('0x12'));var as=require(_0x4d9c('0x13'));var hardwareService=require(_0x4d9c('0x14'));var logger=require(_0x4d9c('0x15'))(_0x4d9c('0x16'));var utils=require('../../config/utils');var config=require(_0x4d9c('0x17'));var licenseUtil=require(_0x4d9c('0x18'));var db=require(_0x4d9c('0x19'))['db'];function respondWithStatusCode(_0x26c04b,_0x4cc37a){_0x4cc37a=_0x4cc37a||0xcc;return function(_0xb1d6e5){if(_0xb1d6e5){return _0x26c04b[_0x4d9c('0x1a')](_0x4cc37a);}return _0x26c04b[_0x4d9c('0x1b')](_0x4cc37a)[_0x4d9c('0x1c')]();};}function respondWithResult(_0x3d9216,_0x26ff44){_0x26ff44=_0x26ff44||0xc8;return function(_0x4b2d44){if(_0x4b2d44){return _0x3d9216[_0x4d9c('0x1b')](_0x26ff44)[_0x4d9c('0x1d')](_0x4b2d44);}};}function respondWithFilteredResult(_0x3bb994,_0x2c7159){return function(_0x1b2ca5){if(_0x1b2ca5){var _0x1c8de5=typeof _0x2c7159[_0x4d9c('0x1e')]===_0x4d9c('0x1f')&&typeof _0x2c7159[_0x4d9c('0x20')]===_0x4d9c('0x1f');var _0x28cd54=_0x1b2ca5[_0x4d9c('0x21')];var _0x88e413=_0x1c8de5?0x0:_0x2c7159[_0x4d9c('0x1e')];var _0x4cdcd8=_0x1c8de5?_0x1b2ca5['count']:_0x2c7159[_0x4d9c('0x1e')]+_0x2c7159['limit'];var _0x5f19be;if(_0x4cdcd8>=_0x28cd54){_0x4cdcd8=_0x28cd54;_0x5f19be=0xc8;}else{_0x5f19be=0xce;}_0x3bb994[_0x4d9c('0x1b')](_0x5f19be);return _0x3bb994[_0x4d9c('0x22')](_0x4d9c('0x23'),_0x88e413+'-'+_0x4cdcd8+'/'+_0x28cd54)[_0x4d9c('0x1d')](_0x1b2ca5);}return null;};}function patchUpdates(_0x5181f7){return function(_0x41a578){try{jsonpatch[_0x4d9c('0x24')](_0x41a578,_0x5181f7,!![]);}catch(_0x1f84e9){return BPromise[_0x4d9c('0x25')](_0x1f84e9);}return _0x41a578[_0x4d9c('0x26')]();};}function saveUpdates(_0x35afd6,_0x5889c0){return function(_0x3c24d1){if(_0x3c24d1){return _0x3c24d1['update'](_0x35afd6)[_0x4d9c('0x27')](function(_0x2b5ffa){return _0x2b5ffa;});}return null;};}function removeEntity(_0x4b2021,_0x267d61){return function(_0x4f3faf){if(_0x4f3faf){return _0x4f3faf[_0x4d9c('0x28')]()[_0x4d9c('0x27')](function(){_0x4b2021['status'](0xcc)[_0x4d9c('0x1c')]();});}};}function handleEntityNotFound(_0x249e47,_0x2fb7ed){return function(_0x44feda){if(!_0x44feda){_0x249e47[_0x4d9c('0x1a')](0x194);}return _0x44feda;};}function handleError(_0x5ba8f4,_0x483c0f){_0x483c0f=_0x483c0f||0x1f4;return function(_0x108dc6){logger[_0x4d9c('0x29')](_0x108dc6[_0x4d9c('0x2a')]);if(_0x108dc6[_0x4d9c('0x2b')]){delete _0x108dc6['name'];}_0x5ba8f4[_0x4d9c('0x1b')](_0x483c0f)['send'](_0x108dc6);};}exports[_0x4d9c('0x2c')]=function(_0x4fc99c,_0x5751df){var _0x491c77={},_0x498754={},_0x4de3fc={'count':0x0,'rows':[]};var _0x4edb49=_[_0x4d9c('0x2d')](db[_0x4d9c('0x2e')][_0x4d9c('0x2f')],function(_0x5ee995){return{'name':_0x5ee995[_0x4d9c('0x30')],'type':_0x5ee995[_0x4d9c('0x31')][_0x4d9c('0x32')]};});_0x498754['model']=_[_0x4d9c('0x2d')](_0x4edb49,_0x4d9c('0x2b'));_0x498754['query']=_[_0x4d9c('0x33')](_0x4fc99c[_0x4d9c('0x34')]);_0x498754['filters']=_[_0x4d9c('0x35')](_0x498754[_0x4d9c('0x36')],_0x498754['query']);_0x491c77['attributes']=_[_0x4d9c('0x35')](_0x498754[_0x4d9c('0x36')],qs[_0x4d9c('0x37')](_0x4fc99c[_0x4d9c('0x34')]['fields']));_0x491c77['attributes']=_0x491c77[_0x4d9c('0x38')][_0x4d9c('0x39')]?_0x491c77[_0x4d9c('0x38')]:_0x498754[_0x4d9c('0x36')];if(!_0x4fc99c[_0x4d9c('0x34')][_0x4d9c('0x3a')]('nolimit')){_0x491c77['limit']=qs['limit'](_0x4fc99c['query']['limit']);_0x491c77[_0x4d9c('0x1e')]=qs[_0x4d9c('0x1e')](_0x4fc99c['query'][_0x4d9c('0x1e')]);}_0x491c77[_0x4d9c('0x3b')]=qs[_0x4d9c('0x3c')](_0x4fc99c['query'][_0x4d9c('0x3c')]);_0x491c77[_0x4d9c('0x3d')]=qs[_0x4d9c('0x3e')](_['pick'](_0x4fc99c[_0x4d9c('0x34')],_0x498754['filters']),_0x4edb49);if(_0x4fc99c[_0x4d9c('0x34')][_0x4d9c('0x3f')]){_0x491c77[_0x4d9c('0x3d')]=_['merge'](_0x491c77[_0x4d9c('0x3d')],{'$or':_['map'](_0x4edb49,function(_0x611b96){if(_0x611b96[_0x4d9c('0x31')]!==_0x4d9c('0x40')){var _0x29a98e={};_0x29a98e[_0x611b96[_0x4d9c('0x2b')]]={'$like':'%'+_0x4fc99c['query']['filter']+'%'};return _0x29a98e;}})});}_0x491c77=_[_0x4d9c('0x41')]({},_0x491c77,_0x4fc99c['options']);var _0x871969={'where':_0x491c77[_0x4d9c('0x3d')]};return db[_0x4d9c('0x2e')][_0x4d9c('0x21')](_0x871969)[_0x4d9c('0x27')](function(_0x44fff1){_0x4de3fc[_0x4d9c('0x21')]=_0x44fff1;if(_0x4fc99c[_0x4d9c('0x34')][_0x4d9c('0x42')]){_0x491c77[_0x4d9c('0x43')]=[{'all':!![]}];}return db[_0x4d9c('0x2e')][_0x4d9c('0x44')](_0x491c77);})[_0x4d9c('0x27')](function(_0x4e98b2){_0x4de3fc[_0x4d9c('0x45')]=_0x4e98b2;return _0x4de3fc;})[_0x4d9c('0x27')](respondWithFilteredResult(_0x5751df,_0x491c77))[_0x4d9c('0x46')](handleError(_0x5751df,null));};exports[_0x4d9c('0x47')]=function(_0x25f465,_0x2695c7){var _0x19f0e6={'raw':!![],'where':{'id':_0x25f465[_0x4d9c('0x48')]['id']}},_0x2a024e={};_0x2a024e[_0x4d9c('0x36')]=_[_0x4d9c('0x33')](db[_0x4d9c('0x2e')]['rawAttributes']);_0x2a024e['query']=_[_0x4d9c('0x33')](_0x25f465[_0x4d9c('0x34')]);_0x2a024e[_0x4d9c('0x3e')]=_[_0x4d9c('0x35')](_0x2a024e[_0x4d9c('0x36')],_0x2a024e[_0x4d9c('0x34')]);_0x19f0e6[_0x4d9c('0x38')]=_[_0x4d9c('0x35')](_0x2a024e[_0x4d9c('0x36')],qs['fields'](_0x25f465[_0x4d9c('0x34')][_0x4d9c('0x37')]));_0x19f0e6[_0x4d9c('0x38')]=_0x19f0e6[_0x4d9c('0x38')][_0x4d9c('0x39')]?_0x19f0e6[_0x4d9c('0x38')]:_0x2a024e[_0x4d9c('0x36')];if(_0x25f465[_0x4d9c('0x34')][_0x4d9c('0x42')]){_0x19f0e6[_0x4d9c('0x43')]=[{'all':!![]}];}_0x19f0e6=_[_0x4d9c('0x41')]({},_0x19f0e6,_0x25f465['options']);return db[_0x4d9c('0x2e')]['find'](_0x19f0e6)['then'](handleEntityNotFound(_0x2695c7,null))[_0x4d9c('0x27')](respondWithResult(_0x2695c7,null))['catch'](handleError(_0x2695c7,null));};exports['create']=function(_0x453145,_0x3e79f4){return db[_0x4d9c('0x2e')][_0x4d9c('0x49')](_0x453145[_0x4d9c('0x4a')],{})['then'](respondWithResult(_0x3e79f4,0xc9))[_0x4d9c('0x46')](handleError(_0x3e79f4,null));};exports[_0x4d9c('0x4b')]=function(_0x519e49,_0x57a81c){if(_0x519e49[_0x4d9c('0x4a')]['id']){delete _0x519e49['body']['id'];}return db[_0x4d9c('0x2e')][_0x4d9c('0x4c')]({'where':{'id':_0x519e49['params']['id']}})['then'](handleEntityNotFound(_0x57a81c,null))[_0x4d9c('0x27')](saveUpdates(_0x519e49[_0x4d9c('0x4a')],null))['then'](respondWithResult(_0x57a81c,null))[_0x4d9c('0x46')](handleError(_0x57a81c,null));};exports[_0x4d9c('0x28')]=function(_0x1fc56f,_0x13cebe){return db[_0x4d9c('0x2e')][_0x4d9c('0x4c')]({'where':{'id':_0x1fc56f['params']['id']}})[_0x4d9c('0x27')](handleEntityNotFound(_0x13cebe,null))[_0x4d9c('0x27')](removeEntity(_0x13cebe,null))[_0x4d9c('0x46')](handleError(_0x13cebe,null));};exports[_0x4d9c('0x4d')]=function(_0xedc1e8,_0x2c9b01){return db['OpenchannelTransferReport'][_0x4d9c('0x4d')]()[_0x4d9c('0x27')](respondWithResult(_0x2c9b01,null))[_0x4d9c('0x46')](handleError(_0x2c9b01,null));}; \ No newline at end of file +var _0x404e=['../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','send','map','OpenchannelTransferReport','rawAttributes','fieldName','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','show','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x30fd57,_0x600465){var _0x23c677=function(_0xd11428){while(--_0xd11428){_0x30fd57['push'](_0x30fd57['shift']());}};_0x23c677(++_0x600465);}(_0x404e,0x1bf));var _0xe404=function(_0x24cc72,_0x4dc73a){_0x24cc72=_0x24cc72-0x0;var _0xd49f1e=_0x404e[_0x24cc72];return _0xd49f1e;};'use strict';var emlformat=require(_0xe404('0x0'));var rimraf=require(_0xe404('0x1'));var zipdir=require(_0xe404('0x2'));var jsonpatch=require(_0xe404('0x3'));var rp=require(_0xe404('0x4'));var moment=require(_0xe404('0x5'));var BPromise=require(_0xe404('0x6'));var Mustache=require(_0xe404('0x7'));var util=require('util');var path=require(_0xe404('0x8'));var sox=require(_0xe404('0x9'));var csv=require(_0xe404('0xa'));var ejs=require(_0xe404('0xb'));var fs=require('fs');var fs_extra=require(_0xe404('0xc'));var _=require(_0xe404('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe404('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe404('0xa'));var querystring=require(_0xe404('0xf'));var Papa=require('papaparse');var Redis=require(_0xe404('0x10'));var authService=require(_0xe404('0x11'));var qs=require(_0xe404('0x12'));var as=require(_0xe404('0x13'));var hardwareService=require(_0xe404('0x14'));var logger=require(_0xe404('0x15'))(_0xe404('0x16'));var utils=require('../../config/utils');var config=require(_0xe404('0x17'));var licenseUtil=require(_0xe404('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a8338,_0x38ebfd){_0x38ebfd=_0x38ebfd||0xcc;return function(_0x1c89c9){if(_0x1c89c9){return _0x3a8338[_0xe404('0x19')](_0x38ebfd);}return _0x3a8338[_0xe404('0x1a')](_0x38ebfd)[_0xe404('0x1b')]();};}function respondWithResult(_0x453ddd,_0x3be323){_0x3be323=_0x3be323||0xc8;return function(_0x5b5324){if(_0x5b5324){return _0x453ddd[_0xe404('0x1a')](_0x3be323)[_0xe404('0x1c')](_0x5b5324);}};}function respondWithFilteredResult(_0x517c1a,_0x2123a4){return function(_0x89c36c){if(_0x89c36c){var _0x12b6a2=typeof _0x2123a4['offset']===_0xe404('0x1d')&&typeof _0x2123a4['limit']===_0xe404('0x1d');var _0x13c826=_0x89c36c['count'];var _0x1c9588=_0x12b6a2?0x0:_0x2123a4[_0xe404('0x1e')];var _0x2d9a8c=_0x12b6a2?_0x89c36c['count']:_0x2123a4['offset']+_0x2123a4[_0xe404('0x1f')];var _0x4c3da3;if(_0x2d9a8c>=_0x13c826){_0x2d9a8c=_0x13c826;_0x4c3da3=0xc8;}else{_0x4c3da3=0xce;}_0x517c1a[_0xe404('0x1a')](_0x4c3da3);return _0x517c1a[_0xe404('0x20')](_0xe404('0x21'),_0x1c9588+'-'+_0x2d9a8c+'/'+_0x13c826)[_0xe404('0x1c')](_0x89c36c);}return null;};}function patchUpdates(_0xe617c0){return function(_0x4d0c64){try{jsonpatch[_0xe404('0x22')](_0x4d0c64,_0xe617c0,!![]);}catch(_0x2269c3){return BPromise['reject'](_0x2269c3);}return _0x4d0c64[_0xe404('0x23')]();};}function saveUpdates(_0x15cb83,_0xd6f071){return function(_0x3a3bfd){if(_0x3a3bfd){return _0x3a3bfd[_0xe404('0x24')](_0x15cb83)[_0xe404('0x25')](function(_0x4bec14){return _0x4bec14;});}return null;};}function removeEntity(_0x38d2fb,_0x413502){return function(_0xa50704){if(_0xa50704){return _0xa50704[_0xe404('0x26')]()['then'](function(){_0x38d2fb[_0xe404('0x1a')](0xcc)[_0xe404('0x1b')]();});}};}function handleEntityNotFound(_0x970faf,_0x3a22e6){return function(_0x45aa9a){if(!_0x45aa9a){_0x970faf['sendStatus'](0x194);}return _0x45aa9a;};}function handleError(_0x385bc7,_0x4dd033){_0x4dd033=_0x4dd033||0x1f4;return function(_0xeba5e6){logger[_0xe404('0x27')](_0xeba5e6['stack']);if(_0xeba5e6[_0xe404('0x28')]){delete _0xeba5e6[_0xe404('0x28')];}_0x385bc7['status'](_0x4dd033)[_0xe404('0x29')](_0xeba5e6);};}exports['index']=function(_0x5e58e0,_0x34bc42){var _0x929618={},_0x3d4153={},_0xa319a4={'count':0x0,'rows':[]};var _0x60b9ff=_[_0xe404('0x2a')](db[_0xe404('0x2b')][_0xe404('0x2c')],function(_0x3be6aa){return{'name':_0x3be6aa[_0xe404('0x2d')],'type':_0x3be6aa['type'][_0xe404('0x2e')]};});_0x3d4153[_0xe404('0x2f')]=_[_0xe404('0x2a')](_0x60b9ff,_0xe404('0x28'));_0x3d4153['query']=_[_0xe404('0x30')](_0x5e58e0['query']);_0x3d4153[_0xe404('0x31')]=_[_0xe404('0x32')](_0x3d4153[_0xe404('0x2f')],_0x3d4153['query']);_0x929618['attributes']=_['intersection'](_0x3d4153['model'],qs[_0xe404('0x33')](_0x5e58e0[_0xe404('0x34')]['fields']));_0x929618[_0xe404('0x35')]=_0x929618[_0xe404('0x35')][_0xe404('0x36')]?_0x929618[_0xe404('0x35')]:_0x3d4153[_0xe404('0x2f')];if(!_0x5e58e0[_0xe404('0x34')][_0xe404('0x37')](_0xe404('0x38'))){_0x929618[_0xe404('0x1f')]=qs[_0xe404('0x1f')](_0x5e58e0[_0xe404('0x34')][_0xe404('0x1f')]);_0x929618[_0xe404('0x1e')]=qs['offset'](_0x5e58e0[_0xe404('0x34')]['offset']);}_0x929618[_0xe404('0x39')]=qs[_0xe404('0x3a')](_0x5e58e0[_0xe404('0x34')][_0xe404('0x3a')]);_0x929618[_0xe404('0x3b')]=qs[_0xe404('0x31')](_[_0xe404('0x3c')](_0x5e58e0[_0xe404('0x34')],_0x3d4153[_0xe404('0x31')]),_0x60b9ff);if(_0x5e58e0[_0xe404('0x34')][_0xe404('0x3d')]){_0x929618[_0xe404('0x3b')]=_[_0xe404('0x3e')](_0x929618[_0xe404('0x3b')],{'$or':_[_0xe404('0x2a')](_0x60b9ff,function(_0x4c1815){if(_0x4c1815[_0xe404('0x3f')]!==_0xe404('0x40')){var _0x26bf17={};_0x26bf17[_0x4c1815[_0xe404('0x28')]]={'$like':'%'+_0x5e58e0[_0xe404('0x34')][_0xe404('0x3d')]+'%'};return _0x26bf17;}})});}_0x929618=_['merge']({},_0x929618,_0x5e58e0[_0xe404('0x41')]);var _0x1c5ed6={'where':_0x929618[_0xe404('0x3b')]};return db[_0xe404('0x2b')][_0xe404('0x42')](_0x1c5ed6)[_0xe404('0x25')](function(_0x3e6f19){_0xa319a4['count']=_0x3e6f19;if(_0x5e58e0[_0xe404('0x34')][_0xe404('0x43')]){_0x929618[_0xe404('0x44')]=[{'all':!![]}];}return db[_0xe404('0x2b')][_0xe404('0x45')](_0x929618);})[_0xe404('0x25')](function(_0x130bb8){_0xa319a4[_0xe404('0x46')]=_0x130bb8;return _0xa319a4;})['then'](respondWithFilteredResult(_0x34bc42,_0x929618))['catch'](handleError(_0x34bc42,null));};exports[_0xe404('0x47')]=function(_0x49916c,_0x2d9cd8){var _0x56bda8={'raw':!![],'where':{'id':_0x49916c['params']['id']}},_0x21a577={};_0x21a577[_0xe404('0x2f')]=_[_0xe404('0x30')](db[_0xe404('0x2b')][_0xe404('0x2c')]);_0x21a577[_0xe404('0x34')]=_[_0xe404('0x30')](_0x49916c['query']);_0x21a577['filters']=_['intersection'](_0x21a577['model'],_0x21a577[_0xe404('0x34')]);_0x56bda8[_0xe404('0x35')]=_['intersection'](_0x21a577[_0xe404('0x2f')],qs[_0xe404('0x33')](_0x49916c[_0xe404('0x34')]['fields']));_0x56bda8[_0xe404('0x35')]=_0x56bda8[_0xe404('0x35')]['length']?_0x56bda8[_0xe404('0x35')]:_0x21a577[_0xe404('0x2f')];if(_0x49916c['query'][_0xe404('0x43')]){_0x56bda8[_0xe404('0x44')]=[{'all':!![]}];}_0x56bda8=_[_0xe404('0x3e')]({},_0x56bda8,_0x49916c['options']);return db[_0xe404('0x2b')][_0xe404('0x48')](_0x56bda8)[_0xe404('0x25')](handleEntityNotFound(_0x2d9cd8,null))['then'](respondWithResult(_0x2d9cd8,null))[_0xe404('0x49')](handleError(_0x2d9cd8,null));};exports['create']=function(_0xf25746,_0x7babbe){return db['OpenchannelTransferReport'][_0xe404('0x4a')](_0xf25746[_0xe404('0x4b')],{})[_0xe404('0x25')](respondWithResult(_0x7babbe,0xc9))[_0xe404('0x49')](handleError(_0x7babbe,null));};exports[_0xe404('0x24')]=function(_0x5919b1,_0x394e9b){if(_0x5919b1[_0xe404('0x4b')]['id']){delete _0x5919b1[_0xe404('0x4b')]['id'];}return db[_0xe404('0x2b')][_0xe404('0x48')]({'where':{'id':_0x5919b1[_0xe404('0x4c')]['id']}})[_0xe404('0x25')](handleEntityNotFound(_0x394e9b,null))[_0xe404('0x25')](saveUpdates(_0x5919b1[_0xe404('0x4b')],null))[_0xe404('0x25')](respondWithResult(_0x394e9b,null))['catch'](handleError(_0x394e9b,null));};exports['destroy']=function(_0x51410b,_0x225503){return db[_0xe404('0x2b')]['find']({'where':{'id':_0x51410b[_0xe404('0x4c')]['id']}})[_0xe404('0x25')](handleEntityNotFound(_0x225503,null))[_0xe404('0x25')](removeEntity(_0x225503,null))['catch'](handleError(_0x225503,null));};exports['describe']=function(_0x5b3082,_0x4721fc){return db['OpenchannelTransferReport'][_0xe404('0x4d')]()[_0xe404('0x25')](respondWithResult(_0x4721fc,null))[_0xe404('0x49')](handleError(_0x4721fc,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 9846cd3..f6b3087 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 _0xaae7=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport'];(function(_0x36bfdd,_0x425a87){var _0x2f60c0=function(_0x384135){while(--_0x384135){_0x36bfdd['push'](_0x36bfdd['shift']());}};_0x2f60c0(++_0x425a87);}(_0xaae7,0x175));var _0x7aae=function(_0x1f4193,_0x12e139){_0x1f4193=_0x1f4193-0x0;var _0x36019f=_0xaae7[_0x1f4193];return _0x36019f;};'use strict';var _=require(_0x7aae('0x0'));var util=require(_0x7aae('0x1'));var logger=require(_0x7aae('0x2'))(_0x7aae('0x3'));var moment=require(_0x7aae('0x4'));var BPromise=require(_0x7aae('0x5'));var rp=require(_0x7aae('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7aae('0x7'));var config=require('../../config/environment');var attributes=require(_0x7aae('0x8'));module[_0x7aae('0x9')]=function(_0x548597,_0x53e24a){return _0x548597['define'](_0x7aae('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x7aae('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5b6=['OpenchannelTransferReport','report_openchannel_transfer','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','exports','define'];(function(_0x152064,_0x18dd78){var _0x4b169d=function(_0x413eeb){while(--_0x413eeb){_0x152064['push'](_0x152064['shift']());}};_0x4b169d(++_0x18dd78);}(_0xc5b6,0xf2));var _0x6c5b=function(_0x363a6e,_0x482d40){_0x363a6e=_0x363a6e-0x0;var _0x5d622d=_0xc5b6[_0x363a6e];return _0x5d622d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6c5b('0x0'))('api');var moment=require(_0x6c5b('0x1'));var BPromise=require(_0x6c5b('0x2'));var rp=require(_0x6c5b('0x3'));var fs=require('fs');var path=require(_0x6c5b('0x4'));var rimraf=require(_0x6c5b('0x5'));var config=require(_0x6c5b('0x6'));var attributes=require(_0x6c5b('0x7'));module[_0x6c5b('0x8')]=function(_0x2f2b2d,_0x39530d){return _0x2f2b2d[_0x6c5b('0x9')](_0x6c5b('0xa'),attributes,{'tableName':_0x6c5b('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index fa6b601..25b5059 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 _0xa7e6=['stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa7e6,0x74));var _0x6a7e=function(_0x148073,_0x37dbaa){_0x148073=_0x148073-0x0;var _0x30ba58=_0xa7e6[_0x148073];return _0x30ba58;};'use strict';var _=require(_0x6a7e('0x0'));var util=require(_0x6a7e('0x1'));var moment=require(_0x6a7e('0x2'));var BPromise=require(_0x6a7e('0x3'));var rs=require(_0x6a7e('0x4'));var fs=require('fs');var Redis=require(_0x6a7e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6a7e('0x6'));var logger=require(_0x6a7e('0x7'))(_0x6a7e('0x8'));var config=require(_0x6a7e('0x9'));var jayson=require(_0x6a7e('0xa'));var client=jayson['client'][_0x6a7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16249d,_0x37165d,_0x342c96){return new BPromise(function(_0x45e92e,_0x3f3f2f){return client[_0x6a7e('0xc')](_0x16249d,_0x342c96)[_0x6a7e('0xd')](function(_0xdaa33d){logger['info']('OpenchannelTransferReport,\x20%s,\x20%s',_0x37165d,'request\x20sent');logger['debug'](_0x6a7e('0xe'),_0x37165d,_0x6a7e('0xf'),JSON[_0x6a7e('0x10')](_0xdaa33d));if(_0xdaa33d[_0x6a7e('0x11')]){if(_0xdaa33d[_0x6a7e('0x11')]['code']===0x1f4){logger[_0x6a7e('0x11')](_0x6a7e('0x12'),_0x37165d,_0xdaa33d['error']['message']);return _0x3f3f2f(_0xdaa33d[_0x6a7e('0x11')][_0x6a7e('0x13')]);}logger[_0x6a7e('0x11')](_0x6a7e('0x12'),_0x37165d,_0xdaa33d['error'][_0x6a7e('0x13')]);return _0x45e92e(_0xdaa33d[_0x6a7e('0x11')][_0x6a7e('0x13')]);}else{logger[_0x6a7e('0x14')](_0x6a7e('0x12'),_0x37165d,'request\x20sent');_0x45e92e(_0xdaa33d[_0x6a7e('0x15')]['message']);}})['catch'](function(_0x454561){logger['error'](_0x6a7e('0x12'),_0x37165d,_0x454561);_0x3f3f2f(_0x454561);});});} \ No newline at end of file +var _0xf3be=['code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','http','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xf3be,0x1e1));var _0xef3b=function(_0x22bb2c,_0x30b8be){_0x22bb2c=_0x22bb2c-0x0;var _0x4dbe03=_0xf3be[_0x22bb2c];return _0x4dbe03;};'use strict';var _=require(_0xef3b('0x0'));var util=require(_0xef3b('0x1'));var moment=require(_0xef3b('0x2'));var BPromise=require(_0xef3b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xef3b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xef3b('0x5'));var jayson=require(_0xef3b('0x6'));var client=jayson['client'][_0xef3b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3f7873,_0x17e70a,_0x19191a){return new BPromise(function(_0x47069a,_0x3a36db){return client['request'](_0x3f7873,_0x19191a)['then'](function(_0x273a7d){logger['info'](_0xef3b('0x8'),_0x17e70a,_0xef3b('0x9'));logger[_0xef3b('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x17e70a,_0xef3b('0x9'),JSON['stringify'](_0x273a7d));if(_0x273a7d[_0xef3b('0xb')]){if(_0x273a7d[_0xef3b('0xb')][_0xef3b('0xc')]===0x1f4){logger[_0xef3b('0xb')](_0xef3b('0x8'),_0x17e70a,_0x273a7d[_0xef3b('0xb')][_0xef3b('0xd')]);return _0x3a36db(_0x273a7d[_0xef3b('0xb')][_0xef3b('0xd')]);}logger[_0xef3b('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x17e70a,_0x273a7d['error'][_0xef3b('0xd')]);return _0x47069a(_0x273a7d[_0xef3b('0xb')][_0xef3b('0xd')]);}else{logger[_0xef3b('0xe')](_0xef3b('0x8'),_0x17e70a,'request\x20sent');_0x47069a(_0x273a7d[_0xef3b('0xf')][_0xef3b('0xd')]);}})[_0xef3b('0x10')](function(_0x3c96a6){logger[_0xef3b('0xb')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x17e70a,_0x3c96a6);_0x3a36db(_0x3c96a6);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 843232c..6504266 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 _0xa11d=['index','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','get'];(function(_0x12fe66,_0x28e2e9){var _0xff4bd9=function(_0x236074){while(--_0x236074){_0x12fe66['push'](_0x12fe66['shift']());}};_0xff4bd9(++_0x28e2e9);}(_0xa11d,0xd1));var _0xda11=function(_0x5cc2dc,_0x527ac3){_0x5cc2dc=_0x5cc2dc-0x0;var _0x32b6a8=_0xa11d[_0x5cc2dc];return _0x32b6a8;};'use strict';var multer=require(_0xda11('0x0'));var util=require(_0xda11('0x1'));var path=require(_0xda11('0x2'));var timeout=require('connect-timeout');var express=require(_0xda11('0x3'));var router=express[_0xda11('0x4')]();var fs_extra=require(_0xda11('0x5'));var auth=require(_0xda11('0x6'));var interaction=require(_0xda11('0x7'));var config=require(_0xda11('0x8'));var controller=require(_0xda11('0x9'));router[_0xda11('0xa')]('/',auth['isAuthenticated'](),controller[_0xda11('0xb')]);router[_0xda11('0xa')](_0xda11('0xc'),auth[_0xda11('0xd')](),controller[_0xda11('0xe')]);router[_0xda11('0xf')]('/',auth[_0xda11('0xd')](),controller['create']);router[_0xda11('0x10')](_0xda11('0xc'),auth[_0xda11('0xd')](),controller['update']);router[_0xda11('0x11')](_0xda11('0xc'),auth[_0xda11('0xd')](),controller[_0xda11('0x12')]);module[_0xda11('0x13')]=router; \ No newline at end of file +var _0xd0cf=['../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1ed311,_0xb346e7){var _0x34f63b=function(_0x45e720){while(--_0x45e720){_0x1ed311['push'](_0x1ed311['shift']());}};_0x34f63b(++_0xb346e7);}(_0xd0cf,0x77));var _0xfd0c=function(_0x13594e,_0x6f0ed0){_0x13594e=_0x13594e-0x0;var _0x1a4f42=_0xd0cf[_0x13594e];return _0x1a4f42;};'use strict';var multer=require(_0xfd0c('0x0'));var util=require(_0xfd0c('0x1'));var path=require(_0xfd0c('0x2'));var timeout=require(_0xfd0c('0x3'));var express=require(_0xfd0c('0x4'));var router=express['Router']();var fs_extra=require(_0xfd0c('0x5'));var auth=require(_0xfd0c('0x6'));var interaction=require(_0xfd0c('0x7'));var config=require(_0xfd0c('0x8'));var controller=require(_0xfd0c('0x9'));router[_0xfd0c('0xa')]('/',auth[_0xfd0c('0xb')](),controller[_0xfd0c('0xc')]);router[_0xfd0c('0xa')](_0xfd0c('0xd'),auth[_0xfd0c('0xb')](),controller[_0xfd0c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xfd0c('0xf')]);router[_0xfd0c('0x10')](_0xfd0c('0xd'),auth[_0xfd0c('0xb')](),controller[_0xfd0c('0x11')]);router[_0xfd0c('0x12')]('/:id',auth[_0xfd0c('0xb')](),controller[_0xfd0c('0x13')]);module[_0xfd0c('0x14')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index ebd5005..17c0e29 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 _0x4873=['STRING','name'];(function(_0x1ec9c1,_0x33e417){var _0x49670b=function(_0x4a4b22){while(--_0x4a4b22){_0x1ec9c1['push'](_0x1ec9c1['shift']());}};_0x49670b(++_0x33e417);}(_0x4873,0x115));var _0x3487=function(_0x171411,_0x5e84f4){_0x171411=_0x171411-0x0;var _0x16a760=_0x4873[_0x171411];return _0x16a760;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x3487('0x0'),'allowNull':![]},'description':{'type':Sequelize[_0x3487('0x1')]}}; \ No newline at end of file +var _0xc4d3=['name','sequelize','STRING'];(function(_0xd72ae6,_0x4fe479){var _0x2ca7f9=function(_0x247635){while(--_0x247635){_0xd72ae6['push'](_0xd72ae6['shift']());}};_0x2ca7f9(++_0x4fe479);}(_0xc4d3,0x1c6));var _0x3c4d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4d3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3c4d('0x0'));module['exports']={'name':{'type':Sequelize[_0x3c4d('0x1')],'unique':_0x3c4d('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index a68bcb5..72a4a28 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 _0x73b6=['sendStatus','error','stack','name','send','index','map','Pause','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','find','userProfileId','autoAssociation','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','UserProfileResource'];(function(_0x2de020,_0x252df0){var _0x182b7c=function(_0xcbcdaa){while(--_0xcbcdaa){_0x2de020['push'](_0x2de020['shift']());}};_0x182b7c(++_0x252df0);}(_0x73b6,0x12b));var _0x673b=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0x73b6[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x673b('0x0'));var rimraf=require(_0x673b('0x1'));var zipdir=require(_0x673b('0x2'));var jsonpatch=require(_0x673b('0x3'));var rp=require('request-promise');var moment=require(_0x673b('0x4'));var BPromise=require(_0x673b('0x5'));var Mustache=require(_0x673b('0x6'));var util=require(_0x673b('0x7'));var path=require('path');var sox=require(_0x673b('0x8'));var csv=require('to-csv');var ejs=require(_0x673b('0x9'));var fs=require('fs');var fs_extra=require(_0x673b('0xa'));var _=require(_0x673b('0xb'));var squel=require(_0x673b('0xc'));var crypto=require(_0x673b('0xd'));var jsforce=require(_0x673b('0xe'));var deskjs=require(_0x673b('0xf'));var toCsv=require('to-csv');var querystring=require(_0x673b('0x10'));var Papa=require(_0x673b('0x11'));var Redis=require(_0x673b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x673b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x673b('0x14'))('api');var utils=require(_0x673b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x673b('0x16'));var db=require(_0x673b('0x17'))['db'];function respondWithStatusCode(_0x544f26,_0x1d4a6e){_0x1d4a6e=_0x1d4a6e||0xcc;return function(_0x72aca){if(_0x72aca){return _0x544f26['sendStatus'](_0x1d4a6e);}return _0x544f26[_0x673b('0x18')](_0x1d4a6e)[_0x673b('0x19')]();};}function respondWithResult(_0x2cca21,_0x57e94a){_0x57e94a=_0x57e94a||0xc8;return function(_0x391f77){if(_0x391f77){return _0x2cca21['status'](_0x57e94a)[_0x673b('0x1a')](_0x391f77);}};}function respondWithFilteredResult(_0x4ef797,_0x2e3a20){return function(_0x590287){if(_0x590287){var _0x28f1d7=typeof _0x2e3a20['offset']===_0x673b('0x1b')&&typeof _0x2e3a20[_0x673b('0x1c')]==='undefined';var _0xd94540=_0x590287[_0x673b('0x1d')];var _0x50dd99=_0x28f1d7?0x0:_0x2e3a20[_0x673b('0x1e')];var _0x53ff74=_0x28f1d7?_0x590287[_0x673b('0x1d')]:_0x2e3a20[_0x673b('0x1e')]+_0x2e3a20[_0x673b('0x1c')];var _0x2ddaba;if(_0x53ff74>=_0xd94540){_0x53ff74=_0xd94540;_0x2ddaba=0xc8;}else{_0x2ddaba=0xce;}_0x4ef797[_0x673b('0x18')](_0x2ddaba);return _0x4ef797[_0x673b('0x1f')](_0x673b('0x20'),_0x50dd99+'-'+_0x53ff74+'/'+_0xd94540)[_0x673b('0x1a')](_0x590287);}return null;};}function patchUpdates(_0x36c6aa){return function(_0x2c87a2){try{jsonpatch[_0x673b('0x21')](_0x2c87a2,_0x36c6aa,!![]);}catch(_0x4137a9){return BPromise['reject'](_0x4137a9);}return _0x2c87a2[_0x673b('0x22')]();};}function saveUpdates(_0x2eb5f5,_0x193f79){return function(_0x57c986){if(_0x57c986){return _0x57c986['update'](_0x2eb5f5)[_0x673b('0x23')](function(_0x352d5d){return _0x352d5d;});}return null;};}function removeEntity(_0x350969,_0x59a725){return function(_0x2eca4b){if(_0x2eca4b){return _0x2eca4b['destroy']()[_0x673b('0x23')](function(){var _0x26878f=_0x2eca4b['get']({'plain':!![]});var _0x2a2833='Pauses';return db[_0x673b('0x24')]['destroy']({'where':{'type':_0x2a2833,'resourceId':_0x26878f['id']}})[_0x673b('0x23')](function(){return _0x2eca4b;});})[_0x673b('0x23')](function(){_0x350969['status'](0xcc)[_0x673b('0x19')]();});}};}function handleEntityNotFound(_0x5c357e,_0x46ec68){return function(_0x1452a8){if(!_0x1452a8){_0x5c357e[_0x673b('0x25')](0x194);}return _0x1452a8;};}function handleError(_0x39fdd0,_0xea30d){_0xea30d=_0xea30d||0x1f4;return function(_0x767996){logger[_0x673b('0x26')](_0x767996[_0x673b('0x27')]);if(_0x767996[_0x673b('0x28')]){delete _0x767996[_0x673b('0x28')];}_0x39fdd0['status'](_0xea30d)[_0x673b('0x29')](_0x767996);};}exports[_0x673b('0x2a')]=function(_0x430fb2,_0x245b32){var _0x4254cc={},_0x44e7c2={},_0x154dd6={'count':0x0,'rows':[]};var _0x5bc1a8=_[_0x673b('0x2b')](db[_0x673b('0x2c')]['rawAttributes'],function(_0x35b449){return{'name':_0x35b449['fieldName'],'type':_0x35b449[_0x673b('0x2d')][_0x673b('0x2e')]};});_0x44e7c2['model']=_[_0x673b('0x2b')](_0x5bc1a8,_0x673b('0x28'));_0x44e7c2[_0x673b('0x2f')]=_[_0x673b('0x30')](_0x430fb2[_0x673b('0x2f')]);_0x44e7c2['filters']=_[_0x673b('0x31')](_0x44e7c2[_0x673b('0x32')],_0x44e7c2['query']);_0x4254cc[_0x673b('0x33')]=_[_0x673b('0x31')](_0x44e7c2['model'],qs[_0x673b('0x34')](_0x430fb2[_0x673b('0x2f')][_0x673b('0x34')]));_0x4254cc[_0x673b('0x33')]=_0x4254cc[_0x673b('0x33')][_0x673b('0x35')]?_0x4254cc[_0x673b('0x33')]:_0x44e7c2[_0x673b('0x32')];if(!_0x430fb2[_0x673b('0x2f')][_0x673b('0x36')](_0x673b('0x37'))){_0x4254cc['limit']=qs['limit'](_0x430fb2['query']['limit']);_0x4254cc[_0x673b('0x1e')]=qs['offset'](_0x430fb2[_0x673b('0x2f')]['offset']);}_0x4254cc[_0x673b('0x38')]=qs[_0x673b('0x39')](_0x430fb2['query'][_0x673b('0x39')]);_0x4254cc[_0x673b('0x3a')]=qs[_0x673b('0x3b')](_[_0x673b('0x3c')](_0x430fb2[_0x673b('0x2f')],_0x44e7c2[_0x673b('0x3b')]),_0x5bc1a8);if(_0x430fb2[_0x673b('0x2f')]['filter']){_0x4254cc['where']=_[_0x673b('0x3d')](_0x4254cc[_0x673b('0x3a')],{'$or':_['map'](_0x5bc1a8,function(_0x2c8359){if(_0x2c8359['type']!=='VIRTUAL'){var _0x307c3e={};_0x307c3e[_0x2c8359[_0x673b('0x28')]]={'$like':'%'+_0x430fb2[_0x673b('0x2f')][_0x673b('0x3e')]+'%'};return _0x307c3e;}})});}_0x4254cc=_[_0x673b('0x3d')]({},_0x4254cc,_0x430fb2['options']);var _0x2352b6={'where':_0x4254cc[_0x673b('0x3a')]};return db['Pause'][_0x673b('0x1d')](_0x2352b6)[_0x673b('0x23')](function(_0x9955dd){_0x154dd6[_0x673b('0x1d')]=_0x9955dd;if(_0x430fb2[_0x673b('0x2f')][_0x673b('0x3f')]){_0x4254cc[_0x673b('0x40')]=[{'all':!![]}];}return db['Pause'][_0x673b('0x41')](_0x4254cc);})[_0x673b('0x23')](function(_0x3e1db0){_0x154dd6[_0x673b('0x42')]=_0x3e1db0;return _0x154dd6;})['then'](respondWithFilteredResult(_0x245b32,_0x4254cc))[_0x673b('0x43')](handleError(_0x245b32,null));};exports[_0x673b('0x44')]=function(_0x2ddea8,_0x5b101b){var _0x1a1e46={'raw':!![],'where':{'id':_0x2ddea8[_0x673b('0x45')]['id']}},_0x262a61={};_0x262a61['model']=_[_0x673b('0x30')](db[_0x673b('0x2c')][_0x673b('0x46')]);_0x262a61[_0x673b('0x2f')]=_[_0x673b('0x30')](_0x2ddea8[_0x673b('0x2f')]);_0x262a61['filters']=_[_0x673b('0x31')](_0x262a61['model'],_0x262a61[_0x673b('0x2f')]);_0x1a1e46['attributes']=_[_0x673b('0x31')](_0x262a61[_0x673b('0x32')],qs['fields'](_0x2ddea8[_0x673b('0x2f')][_0x673b('0x34')]));_0x1a1e46[_0x673b('0x33')]=_0x1a1e46[_0x673b('0x33')][_0x673b('0x35')]?_0x1a1e46[_0x673b('0x33')]:_0x262a61['model'];if(_0x2ddea8[_0x673b('0x2f')][_0x673b('0x3f')]){_0x1a1e46[_0x673b('0x40')]=[{'all':!![]}];}_0x1a1e46=_['merge']({},_0x1a1e46,_0x2ddea8[_0x673b('0x47')]);return db[_0x673b('0x2c')]['find'](_0x1a1e46)['then'](handleEntityNotFound(_0x5b101b,null))[_0x673b('0x23')](respondWithResult(_0x5b101b,null))['catch'](handleError(_0x5b101b,null));};exports[_0x673b('0x48')]=function(_0x461737,_0x335ce2){return db[_0x673b('0x2c')]['create'](_0x461737[_0x673b('0x49')],{})['then'](function(_0x5b76f0){var _0x5ca2a2=_0x461737[_0x673b('0x4a')][_0x673b('0x4b')]({'plain':!![]});if(!_0x5ca2a2)throw new Error(_0x673b('0x4c'));if(_0x5ca2a2[_0x673b('0x4d')]==='user'){var _0x2cfee5=_0x5b76f0[_0x673b('0x4b')]({'plain':!![]});var _0x9ef32d=_0x673b('0x4e');return db[_0x673b('0x4f')][_0x673b('0x50')]({'where':{'name':_0x9ef32d,'userProfileId':_0x5ca2a2[_0x673b('0x51')]},'raw':!![]})['then'](function(_0x2f4844){if(_0x2f4844&&_0x2f4844[_0x673b('0x52')]===0x0){return db[_0x673b('0x24')][_0x673b('0x48')]({'name':_0x2cfee5[_0x673b('0x28')],'resourceId':_0x2cfee5['id'],'type':_0x2f4844['name'],'sectionId':_0x2f4844['id']},{})[_0x673b('0x23')](function(){return _0x5b76f0;});}else{return _0x5b76f0;}})[_0x673b('0x43')](function(_0x3e0617){logger[_0x673b('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e0617);throw _0x3e0617;});}return _0x5b76f0;})[_0x673b('0x23')](respondWithResult(_0x335ce2,0xc9))[_0x673b('0x43')](handleError(_0x335ce2,null));};exports['update']=function(_0x28b52a,_0x3cfd28){if(_0x28b52a['body']['id']){delete _0x28b52a[_0x673b('0x49')]['id'];}return db[_0x673b('0x2c')][_0x673b('0x50')]({'where':{'id':_0x28b52a[_0x673b('0x45')]['id']}})[_0x673b('0x23')](handleEntityNotFound(_0x3cfd28,null))[_0x673b('0x23')](saveUpdates(_0x28b52a['body'],null))[_0x673b('0x23')](respondWithResult(_0x3cfd28,null))['catch'](handleError(_0x3cfd28,null));};exports[_0x673b('0x53')]=function(_0x2a11e5,_0xe1f3f){return db[_0x673b('0x2c')]['find']({'where':{'id':_0x2a11e5[_0x673b('0x45')]['id']}})[_0x673b('0x23')](handleEntityNotFound(_0xe1f3f,null))['then'](removeEntity(_0xe1f3f,null))[_0x673b('0x43')](handleError(_0xe1f3f,null));}; \ No newline at end of file +var _0x1f27=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','map','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','moment','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x2bbc6c,_0x12610e){var _0xa98766=function(_0x24c862){while(--_0x24c862){_0x2bbc6c['push'](_0x2bbc6c['shift']());}};_0xa98766(++_0x12610e);}(_0x1f27,0x1ea));var _0x71f2=function(_0x2283d2,_0x336d28){_0x2283d2=_0x2283d2-0x0;var _0x67c5f8=_0x1f27[_0x2283d2];return _0x67c5f8;};'use strict';var emlformat=require(_0x71f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x71f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71f2('0x2'));var BPromise=require(_0x71f2('0x3'));var Mustache=require('mustache');var util=require(_0x71f2('0x4'));var path=require('path');var sox=require(_0x71f2('0x5'));var csv=require('to-csv');var ejs=require(_0x71f2('0x6'));var fs=require('fs');var fs_extra=require(_0x71f2('0x7'));var _=require(_0x71f2('0x8'));var squel=require(_0x71f2('0x9'));var crypto=require(_0x71f2('0xa'));var jsforce=require(_0x71f2('0xb'));var deskjs=require(_0x71f2('0xc'));var toCsv=require(_0x71f2('0xd'));var querystring=require(_0x71f2('0xe'));var Papa=require(_0x71f2('0xf'));var Redis=require(_0x71f2('0x10'));var authService=require(_0x71f2('0x11'));var qs=require(_0x71f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x71f2('0x13'))(_0x71f2('0x14'));var utils=require(_0x71f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x71f2('0x16'));var db=require(_0x71f2('0x17'))['db'];function respondWithStatusCode(_0x17ee97,_0x5eb637){_0x5eb637=_0x5eb637||0xcc;return function(_0x54bd2e){if(_0x54bd2e){return _0x17ee97[_0x71f2('0x18')](_0x5eb637);}return _0x17ee97[_0x71f2('0x19')](_0x5eb637)[_0x71f2('0x1a')]();};}function respondWithResult(_0x505125,_0x1d0618){_0x1d0618=_0x1d0618||0xc8;return function(_0x2e44b7){if(_0x2e44b7){return _0x505125[_0x71f2('0x19')](_0x1d0618)[_0x71f2('0x1b')](_0x2e44b7);}};}function respondWithFilteredResult(_0x629386,_0x3c98bc){return function(_0x3c64f4){if(_0x3c64f4){var _0x4a9b14=typeof _0x3c98bc['offset']===_0x71f2('0x1c')&&typeof _0x3c98bc[_0x71f2('0x1d')]===_0x71f2('0x1c');var _0x81c6b5=_0x3c64f4[_0x71f2('0x1e')];var _0x1cf0f4=_0x4a9b14?0x0:_0x3c98bc[_0x71f2('0x1f')];var _0x3946e0=_0x4a9b14?_0x3c64f4[_0x71f2('0x1e')]:_0x3c98bc['offset']+_0x3c98bc[_0x71f2('0x1d')];var _0x36703e;if(_0x3946e0>=_0x81c6b5){_0x3946e0=_0x81c6b5;_0x36703e=0xc8;}else{_0x36703e=0xce;}_0x629386['status'](_0x36703e);return _0x629386['set'](_0x71f2('0x20'),_0x1cf0f4+'-'+_0x3946e0+'/'+_0x81c6b5)['json'](_0x3c64f4);}return null;};}function patchUpdates(_0x2a6dca){return function(_0x502355){try{jsonpatch[_0x71f2('0x21')](_0x502355,_0x2a6dca,!![]);}catch(_0x3910cd){return BPromise[_0x71f2('0x22')](_0x3910cd);}return _0x502355[_0x71f2('0x23')]();};}function saveUpdates(_0xdf731e,_0x6b5392){return function(_0x4a50f8){if(_0x4a50f8){return _0x4a50f8[_0x71f2('0x24')](_0xdf731e)[_0x71f2('0x25')](function(_0x18f210){return _0x18f210;});}return null;};}function removeEntity(_0x1cd6b0,_0x944632){return function(_0xa452b2){if(_0xa452b2){return _0xa452b2[_0x71f2('0x26')]()[_0x71f2('0x25')](function(){var _0x5d9a01=_0xa452b2[_0x71f2('0x27')]({'plain':!![]});var _0x49af61=_0x71f2('0x28');return db[_0x71f2('0x29')][_0x71f2('0x26')]({'where':{'type':_0x49af61,'resourceId':_0x5d9a01['id']}})[_0x71f2('0x25')](function(){return _0xa452b2;});})['then'](function(){_0x1cd6b0['status'](0xcc)[_0x71f2('0x1a')]();});}};}function handleEntityNotFound(_0x50cdaf,_0x40fc5f){return function(_0x5bf510){if(!_0x5bf510){_0x50cdaf[_0x71f2('0x18')](0x194);}return _0x5bf510;};}function handleError(_0x3e5558,_0x2e4097){_0x2e4097=_0x2e4097||0x1f4;return function(_0xf14577){logger[_0x71f2('0x2a')](_0xf14577[_0x71f2('0x2b')]);if(_0xf14577['name']){delete _0xf14577[_0x71f2('0x2c')];}_0x3e5558[_0x71f2('0x19')](_0x2e4097)[_0x71f2('0x2d')](_0xf14577);};}exports[_0x71f2('0x2e')]=function(_0x4b0235,_0x4909fe){var _0x195aeb={},_0x3efc8f={},_0x36806a={'count':0x0,'rows':[]};var _0x5583d3=_['map'](db[_0x71f2('0x2f')][_0x71f2('0x30')],function(_0x5c7715){return{'name':_0x5c7715[_0x71f2('0x31')],'type':_0x5c7715[_0x71f2('0x32')]['key']};});_0x3efc8f['model']=_[_0x71f2('0x33')](_0x5583d3,_0x71f2('0x2c'));_0x3efc8f[_0x71f2('0x34')]=_['keys'](_0x4b0235[_0x71f2('0x34')]);_0x3efc8f['filters']=_[_0x71f2('0x35')](_0x3efc8f[_0x71f2('0x36')],_0x3efc8f[_0x71f2('0x34')]);_0x195aeb[_0x71f2('0x37')]=_[_0x71f2('0x35')](_0x3efc8f['model'],qs[_0x71f2('0x38')](_0x4b0235['query'][_0x71f2('0x38')]));_0x195aeb[_0x71f2('0x37')]=_0x195aeb[_0x71f2('0x37')][_0x71f2('0x39')]?_0x195aeb['attributes']:_0x3efc8f[_0x71f2('0x36')];if(!_0x4b0235[_0x71f2('0x34')][_0x71f2('0x3a')]('nolimit')){_0x195aeb[_0x71f2('0x1d')]=qs[_0x71f2('0x1d')](_0x4b0235[_0x71f2('0x34')][_0x71f2('0x1d')]);_0x195aeb['offset']=qs['offset'](_0x4b0235[_0x71f2('0x34')][_0x71f2('0x1f')]);}_0x195aeb[_0x71f2('0x3b')]=qs['sort'](_0x4b0235[_0x71f2('0x34')][_0x71f2('0x3c')]);_0x195aeb[_0x71f2('0x3d')]=qs[_0x71f2('0x3e')](_['pick'](_0x4b0235[_0x71f2('0x34')],_0x3efc8f[_0x71f2('0x3e')]),_0x5583d3);if(_0x4b0235[_0x71f2('0x34')][_0x71f2('0x3f')]){_0x195aeb[_0x71f2('0x3d')]=_['merge'](_0x195aeb[_0x71f2('0x3d')],{'$or':_[_0x71f2('0x33')](_0x5583d3,function(_0x52bc47){if(_0x52bc47[_0x71f2('0x32')]!==_0x71f2('0x40')){var _0x122051={};_0x122051[_0x52bc47[_0x71f2('0x2c')]]={'$like':'%'+_0x4b0235[_0x71f2('0x34')]['filter']+'%'};return _0x122051;}})});}_0x195aeb=_[_0x71f2('0x41')]({},_0x195aeb,_0x4b0235['options']);var _0x289523={'where':_0x195aeb[_0x71f2('0x3d')]};return db[_0x71f2('0x2f')][_0x71f2('0x1e')](_0x289523)['then'](function(_0x16a3aa){_0x36806a[_0x71f2('0x1e')]=_0x16a3aa;if(_0x4b0235['query'][_0x71f2('0x42')]){_0x195aeb[_0x71f2('0x43')]=[{'all':!![]}];}return db[_0x71f2('0x2f')][_0x71f2('0x44')](_0x195aeb);})['then'](function(_0x4784b3){_0x36806a[_0x71f2('0x45')]=_0x4784b3;return _0x36806a;})['then'](respondWithFilteredResult(_0x4909fe,_0x195aeb))[_0x71f2('0x46')](handleError(_0x4909fe,null));};exports[_0x71f2('0x47')]=function(_0x38faed,_0x4c7af6){var _0x3d91b5={'raw':!![],'where':{'id':_0x38faed[_0x71f2('0x48')]['id']}},_0x480f1b={};_0x480f1b['model']=_['keys'](db[_0x71f2('0x2f')][_0x71f2('0x30')]);_0x480f1b[_0x71f2('0x34')]=_[_0x71f2('0x49')](_0x38faed['query']);_0x480f1b[_0x71f2('0x3e')]=_[_0x71f2('0x35')](_0x480f1b[_0x71f2('0x36')],_0x480f1b[_0x71f2('0x34')]);_0x3d91b5['attributes']=_['intersection'](_0x480f1b[_0x71f2('0x36')],qs['fields'](_0x38faed[_0x71f2('0x34')][_0x71f2('0x38')]));_0x3d91b5['attributes']=_0x3d91b5[_0x71f2('0x37')][_0x71f2('0x39')]?_0x3d91b5[_0x71f2('0x37')]:_0x480f1b[_0x71f2('0x36')];if(_0x38faed[_0x71f2('0x34')][_0x71f2('0x42')]){_0x3d91b5[_0x71f2('0x43')]=[{'all':!![]}];}_0x3d91b5=_[_0x71f2('0x41')]({},_0x3d91b5,_0x38faed[_0x71f2('0x4a')]);return db['Pause'][_0x71f2('0x4b')](_0x3d91b5)['then'](handleEntityNotFound(_0x4c7af6,null))[_0x71f2('0x25')](respondWithResult(_0x4c7af6,null))[_0x71f2('0x46')](handleError(_0x4c7af6,null));};exports[_0x71f2('0x4c')]=function(_0x2279f1,_0x2a26ec){return db[_0x71f2('0x2f')][_0x71f2('0x4c')](_0x2279f1[_0x71f2('0x4d')],{})[_0x71f2('0x25')](function(_0x2a59c8){var _0x29a3fa=_0x2279f1[_0x71f2('0x4e')][_0x71f2('0x27')]({'plain':!![]});if(!_0x29a3fa)throw new Error(_0x71f2('0x4f'));if(_0x29a3fa['role']===_0x71f2('0x4e')){var _0xcf147d=_0x2a59c8[_0x71f2('0x27')]({'plain':!![]});var _0x2424c7=_0x71f2('0x28');return db[_0x71f2('0x50')][_0x71f2('0x4b')]({'where':{'name':_0x2424c7,'userProfileId':_0x29a3fa[_0x71f2('0x51')]},'raw':!![]})['then'](function(_0x488398){if(_0x488398&&_0x488398[_0x71f2('0x52')]===0x0){return db[_0x71f2('0x29')]['create']({'name':_0xcf147d[_0x71f2('0x2c')],'resourceId':_0xcf147d['id'],'type':_0x488398[_0x71f2('0x2c')],'sectionId':_0x488398['id']},{})[_0x71f2('0x25')](function(){return _0x2a59c8;});}else{return _0x2a59c8;}})[_0x71f2('0x46')](function(_0x1684b4){logger[_0x71f2('0x2a')](_0x71f2('0x53'),_0x1684b4);throw _0x1684b4;});}return _0x2a59c8;})[_0x71f2('0x25')](respondWithResult(_0x2a26ec,0xc9))[_0x71f2('0x46')](handleError(_0x2a26ec,null));};exports[_0x71f2('0x24')]=function(_0x4e0565,_0x204650){if(_0x4e0565[_0x71f2('0x4d')]['id']){delete _0x4e0565[_0x71f2('0x4d')]['id'];}return db['Pause']['find']({'where':{'id':_0x4e0565[_0x71f2('0x48')]['id']}})['then'](handleEntityNotFound(_0x204650,null))[_0x71f2('0x25')](saveUpdates(_0x4e0565[_0x71f2('0x4d')],null))[_0x71f2('0x25')](respondWithResult(_0x204650,null))[_0x71f2('0x46')](handleError(_0x204650,null));};exports['destroy']=function(_0x3fcbc6,_0xf2c947){return db['Pause'][_0x71f2('0x4b')]({'where':{'id':_0x3fcbc6[_0x71f2('0x48')]['id']}})[_0x71f2('0x25')](handleEntityNotFound(_0xf2c947,null))[_0x71f2('0x25')](removeEntity(_0xf2c947,null))['catch'](handleError(_0xf2c947,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index dd5bc98..02c474f 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 _0x53ec=['bluebird','path','../../config/environment','./pause.attributes','define','Pause','lodash','util','../../config/logger','api','moment'];(function(_0x1b413e,_0x296e12){var _0x53d567=function(_0x39c108){while(--_0x39c108){_0x1b413e['push'](_0x1b413e['shift']());}};_0x53d567(++_0x296e12);}(_0x53ec,0x192));var _0xc53e=function(_0x3cff6c,_0x107a6c){_0x3cff6c=_0x3cff6c-0x0;var _0x442fb7=_0x53ec[_0x3cff6c];return _0x442fb7;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x142be6,_0x55f613){_0x142be6=_0x142be6-0x0;var _0x3630d9=_0x7fbe[_0x142be6];return _0x3630d9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));module[_0xe7fb('0x9')]=function(_0x290172,_0x12d1b0){return _0x290172[_0xe7fb('0xa')](_0xe7fb('0xb'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1a03d0c..09b0e74 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x319244,_0xacc207){var _0x4b0640=function(_0x473f8d){while(--_0x473f8d){_0x319244['push'](_0x319244['shift']());}};_0x4b0640(++_0xacc207);}(_0x7a54,0x106));var _0x47a5=function(_0x4a057b,_0x594e41){_0x4a057b=_0x4a057b-0x0;var _0x3d1b00=_0x7a54[_0x4a057b];return _0x3d1b00;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5eeeae,_0x21a5da){var _0x1cb1be=function(_0xc73b70){while(--_0xc73b70){_0x5eeeae['push'](_0x5eeeae['shift']());}};_0x1cb1be(++_0x21a5da);}(_0x7a54,0x106));var _0x47a5=function(_0x970755,_0x4c61d5){_0x970755=_0x970755-0x0;var _0x589f87=_0x7a54[_0x970755];return _0x589f87;};'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 ead01eb..e9a0530 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 _0x9bde=['exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','diskStorage','join','root','server/files/plugins','originalname','replace','format','extname','now','post','file','upload','webhookPost','put','delete'];(function(_0x5a3bd8,_0x197e06){var _0x29de1a=function(_0x2c3eae){while(--_0x2c3eae){_0x5a3bd8['push'](_0x5a3bd8['shift']());}};_0x29de1a(++_0x197e06);}(_0x9bde,0xe1));var _0xe9bd=function(_0x42d91a,_0x36906e){_0x42d91a=_0x42d91a-0x0;var _0x3d335d=_0x9bde[_0x42d91a];return _0x3d335d;};'use strict';var multer=require('multer');var util=require(_0xe9bd('0x0'));var path=require('path');var timeout=require(_0xe9bd('0x1'));var express=require('express');var router=express[_0xe9bd('0x2')]();var fs_extra=require(_0xe9bd('0x3'));var auth=require(_0xe9bd('0x4'));var interaction=require(_0xe9bd('0x5'));var config=require(_0xe9bd('0x6'));var controller=require(_0xe9bd('0x7'));router[_0xe9bd('0x8')]('/',auth['isAuthenticated'](),controller[_0xe9bd('0x9')]);router[_0xe9bd('0x8')](_0xe9bd('0xa'),controller[_0xe9bd('0xb')]);router[_0xe9bd('0x8')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller[_0xe9bd('0xe')]);router[_0xe9bd('0x8')](_0xe9bd('0xf'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0xe9bd('0x10')]({'destination':function(_0x145521,_0x2601ac,_0x581ab9){_0x581ab9(null,path[_0xe9bd('0x11')](config[_0xe9bd('0x12')],_0xe9bd('0x13')));},'filename':function(_0x141587,_0x5e022a,_0x2c1d98){_0x5e022a['originalname']=_0x5e022a[_0xe9bd('0x14')][_0xe9bd('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2c1d98(null,util[_0xe9bd('0x16')]('%s-%s%s',path['basename'](_0x5e022a[_0xe9bd('0x14')],path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])),Date[_0xe9bd('0x18')](),path[_0xe9bd('0x17')](_0x5e022a[_0xe9bd('0x14')])));}})});router[_0xe9bd('0x19')]('/',upload['single'](_0xe9bd('0x1a')),controller[_0xe9bd('0x1b')]);router[_0xe9bd('0x19')]('/webhook',controller[_0xe9bd('0x1c')]);router[_0xe9bd('0x1d')](_0xe9bd('0xc'),auth[_0xe9bd('0xd')](),controller['update']);router[_0xe9bd('0x1e')]('/:id',auth[_0xe9bd('0xd')](),controller['delete']);module[_0xe9bd('0x1f')]=router; \ No newline at end of file +var _0x5c12=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','isAuthenticated','index','get','/:id','show','download','diskStorage','join','root','originalname','basename','extname','now','upload','post','put','update','delete','exports'];(function(_0x1c19cc,_0x55524e){var _0x28c89c=function(_0x22e7ff){while(--_0x22e7ff){_0x1c19cc['push'](_0x1c19cc['shift']());}};_0x28c89c(++_0x55524e);}(_0x5c12,0x188));var _0x25c1=function(_0x845505,_0x19e5f3){_0x845505=_0x845505-0x0;var _0x2513b9=_0x5c12[_0x845505];return _0x2513b9;};'use strict';var multer=require('multer');var util=require(_0x25c1('0x0'));var path=require(_0x25c1('0x1'));var timeout=require('connect-timeout');var express=require(_0x25c1('0x2'));var router=express[_0x25c1('0x3')]();var fs_extra=require(_0x25c1('0x4'));var auth=require(_0x25c1('0x5'));var interaction=require(_0x25c1('0x6'));var config=require(_0x25c1('0x7'));var controller=require(_0x25c1('0x8'));router['get']('/',auth[_0x25c1('0x9')](),controller[_0x25c1('0xa')]);router[_0x25c1('0xb')]('/webhook',controller['webhookGet']);router[_0x25c1('0xb')](_0x25c1('0xc'),auth[_0x25c1('0x9')](),controller[_0x25c1('0xd')]);router[_0x25c1('0xb')]('/:id/download',auth[_0x25c1('0x9')](),controller[_0x25c1('0xe')]);var upload=multer({'storage':multer[_0x25c1('0xf')]({'destination':function(_0x81f0f4,_0x2872b2,_0x5e44e2){_0x5e44e2(null,path[_0x25c1('0x10')](config[_0x25c1('0x11')],'server/files/plugins'));},'filename':function(_0x256ecd,_0x209af5,_0x323d3c){_0x209af5[_0x25c1('0x12')]=_0x209af5['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x323d3c(null,util['format']('%s-%s%s',path[_0x25c1('0x13')](_0x209af5[_0x25c1('0x12')],path[_0x25c1('0x14')](_0x209af5[_0x25c1('0x12')])),Date[_0x25c1('0x15')](),path['extname'](_0x209af5[_0x25c1('0x12')])));}})});router['post']('/',upload['single']('file'),controller[_0x25c1('0x16')]);router[_0x25c1('0x17')]('/webhook',controller['webhookPost']);router[_0x25c1('0x18')]('/:id',auth[_0x25c1('0x9')](),controller[_0x25c1('0x19')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x25c1('0x1a')]);module[_0x25c1('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index ea91a59..687fe0a 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 _0x76d2=['agentOnly','always','never','sequelize','exports','STRING','ENUM','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly'];(function(_0x81dcac,_0x8ff7db){var _0xc7803b=function(_0x499b29){while(--_0x499b29){_0x81dcac['push'](_0x81dcac['shift']());}};_0xc7803b(++_0x8ff7db);}(_0x76d2,0x162));var _0x276d=function(_0x5b76fe,_0x156f0f){_0x5b76fe=_0x5b76fe-0x0;var _0x54ed48=_0x76d2[_0x5b76fe];return _0x54ed48;};'use strict';var Sequelize=require(_0x276d('0x0'));module[_0x276d('0x1')]={'name':{'type':Sequelize[_0x276d('0x2')]},'type':{'type':Sequelize[_0x276d('0x3')]('html',_0x276d('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x276d('0x5')]},'path':{'type':Sequelize[_0x276d('0x2')],'comment':_0x276d('0x6')},'active':{'type':Sequelize[_0x276d('0x7')],'defaultValue':0x0,'comment':_0x276d('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x276d('0x9'),_0x276d('0xa'),_0x276d('0xb'),_0x276d('0xc')),'defaultValue':_0x276d('0xb'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x276d('0x2')]},'adminUrl':{'type':Sequelize[_0x276d('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x276d('0x2')]},'scriptPath':{'type':Sequelize[_0x276d('0x2')]}}; \ No newline at end of file +var _0x607e=['ENUM','html','script','TEXT','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports'];(function(_0x1b10e9,_0x3c4d68){var _0xdfe7a8=function(_0x9b4ccf){while(--_0x9b4ccf){_0x1b10e9['push'](_0x1b10e9['shift']());}};_0xdfe7a8(++_0x3c4d68);}(_0x607e,0x112));var _0xe607=function(_0x19af30,_0x5c43c1){_0x19af30=_0x19af30-0x0;var _0x4a362f=_0x607e[_0x19af30];return _0x4a362f;};'use strict';var Sequelize=require('sequelize');module[_0xe607('0x0')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xe607('0x1')](_0xe607('0x2'),_0xe607('0x3'))},'description':{'type':Sequelize[_0xe607('0x4')]},'version':{'type':Sequelize[_0xe607('0x4')]},'path':{'type':Sequelize[_0xe607('0x5')],'comment':_0xe607('0x6')},'active':{'type':Sequelize[_0xe607('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0xe607('0x1')](_0xe607('0x8'),'agentOnly',_0xe607('0x9'),'never'),'defaultValue':_0xe607('0x9'),'comment':_0xe607('0xa')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0xe607('0x5')]},'scriptName':{'type':Sequelize[_0xe607('0x5')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 1af0135..7f4ce1c 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 _0x4b69=['Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','set','statusCode','webhookPost','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','Plugin','findAll','rows','catch','params','intersection','download','find','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','filename','extname','file','Plugin\x20upload\x20filepath:\x20%s','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','html','test','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xd307d9,_0x50e8e0){var _0x209bf8=function(_0x335069){while(--_0x335069){_0xd307d9['push'](_0xd307d9['shift']());}};_0x209bf8(++_0x50e8e0);}(_0x4b69,0x167));var _0x94b6=function(_0x421e73,_0x2d3fdc){_0x421e73=_0x421e73-0x0;var _0x2f71ec=_0x4b69[_0x421e73];return _0x2f71ec;};'use strict';var emlformat=require(_0x94b6('0x0'));var rimraf=require(_0x94b6('0x1'));var zipdir=require(_0x94b6('0x2'));var jsonpatch=require(_0x94b6('0x3'));var rp=require('request-promise');var moment=require(_0x94b6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x94b6('0x5'));var util=require('util');var path=require(_0x94b6('0x6'));var sox=require(_0x94b6('0x7'));var csv=require(_0x94b6('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x94b6('0x9'));var _=require(_0x94b6('0xa'));var squel=require('squel');var crypto=require(_0x94b6('0xb'));var jsforce=require(_0x94b6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x94b6('0x8'));var querystring=require(_0x94b6('0xd'));var Papa=require(_0x94b6('0xe'));var extract=require('extract-zip');var rimraf=require(_0x94b6('0x1'));var archiver=require(_0x94b6('0xf'));var Redis=require(_0x94b6('0x10'));var authService=require(_0x94b6('0x11'));var qs=require(_0x94b6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x94b6('0x13'));var logger=require(_0x94b6('0x14'))(_0x94b6('0x15'));var utils=require('../../config/utils');var config=require(_0x94b6('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x94b6('0x17'))['db'];config[_0x94b6('0x18')]=_[_0x94b6('0x19')](config[_0x94b6('0x18')],{'host':_0x94b6('0x1a'),'port':0x18eb});var socket=require(_0x94b6('0x1b'))(new Redis(config[_0x94b6('0x18')]));require('./plugin.socket')['register'](socket);function respondWithStatusCode(_0x388a42,_0x1a058f){_0x1a058f=_0x1a058f||0xcc;return function(_0x417684){if(_0x417684){return _0x388a42[_0x94b6('0x1c')](_0x1a058f);}return _0x388a42[_0x94b6('0x1d')](_0x1a058f)[_0x94b6('0x1e')]();};}function respondWithResult(_0x56dfd6,_0x1c0dac){_0x1c0dac=_0x1c0dac||0xc8;return function(_0xee926c){if(_0xee926c){return _0x56dfd6['status'](_0x1c0dac)[_0x94b6('0x1f')](_0xee926c);}};}function respondWithFilteredResult(_0x5d8da6,_0x468d89){return function(_0xc48750){if(_0xc48750){var _0x562789=typeof _0x468d89['offset']===_0x94b6('0x20')&&typeof _0x468d89[_0x94b6('0x21')]===_0x94b6('0x20');var _0xfb7fad=_0xc48750[_0x94b6('0x22')];var _0x16803d=_0x562789?0x0:_0x468d89[_0x94b6('0x23')];var _0x2de390=_0x562789?_0xc48750[_0x94b6('0x22')]:_0x468d89[_0x94b6('0x23')]+_0x468d89[_0x94b6('0x21')];var _0x11be18;if(_0x2de390>=_0xfb7fad){_0x2de390=_0xfb7fad;_0x11be18=0xc8;}else{_0x11be18=0xce;}_0x5d8da6[_0x94b6('0x1d')](_0x11be18);return _0x5d8da6['set'](_0x94b6('0x24'),_0x16803d+'-'+_0x2de390+'/'+_0xfb7fad)['json'](_0xc48750);}return null;};}function patchUpdates(_0xa1db5a){return function(_0xc2ce2f){try{jsonpatch[_0x94b6('0x25')](_0xc2ce2f,_0xa1db5a,!![]);}catch(_0x218666){return BPromise[_0x94b6('0x26')](_0x218666);}return _0xc2ce2f['save']();};}function saveUpdates(_0x24e331,_0x1f5ed4){return function(_0x50ddb6){if(_0x50ddb6){return _0x50ddb6[_0x94b6('0x27')](_0x24e331)[_0x94b6('0x28')](function(_0x4adff0){return _0x4adff0;});}return null;};}function removeEntity(_0x347bef,_0x4673b9){return function(_0x3006e5){if(_0x3006e5){return _0x3006e5['destroy']()[_0x94b6('0x28')](function(){var _0x429619=_0x3006e5[_0x94b6('0x29')]({'plain':!![]});var _0x77aabe='Plugins';return db[_0x94b6('0x2a')][_0x94b6('0x2b')]({'where':{'type':_0x77aabe,'resourceId':_0x429619['id']}})['then'](function(){return _0x3006e5;});})[_0x94b6('0x28')](function(){_0x347bef[_0x94b6('0x1d')](0xcc)[_0x94b6('0x1e')]();});}};}function handleEntityNotFound(_0x5e2397,_0x1580fa){return function(_0x342fac){if(!_0x342fac){_0x5e2397[_0x94b6('0x1c')](0x194);}return _0x342fac;};}function handleError(_0x20a0b6,_0x26bb5c){_0x26bb5c=_0x26bb5c||0x1f4;return function(_0x41073c){logger[_0x94b6('0x2c')](_0x41073c[_0x94b6('0x2d')]);if(_0x41073c[_0x94b6('0x2e')]){delete _0x41073c['name'];}_0x20a0b6[_0x94b6('0x1d')](_0x26bb5c)[_0x94b6('0x2f')](_0x41073c);};}exports['index']=function(_0x1ad588,_0x1db019){var _0x368561={},_0x3107c1={},_0x33822e={'count':0x0,'rows':[]};var _0x503f20=_[_0x94b6('0x30')](db['Plugin'][_0x94b6('0x31')],function(_0x7077ed){return{'name':_0x7077ed[_0x94b6('0x32')],'type':_0x7077ed[_0x94b6('0x33')][_0x94b6('0x34')]};});_0x3107c1['model']=_[_0x94b6('0x30')](_0x503f20,_0x94b6('0x2e'));_0x3107c1[_0x94b6('0x35')]=_[_0x94b6('0x36')](_0x1ad588[_0x94b6('0x35')]);_0x3107c1['filters']=_['intersection'](_0x3107c1[_0x94b6('0x37')],_0x3107c1['query']);_0x368561[_0x94b6('0x38')]=_['intersection'](_0x3107c1[_0x94b6('0x37')],qs[_0x94b6('0x39')](_0x1ad588[_0x94b6('0x35')][_0x94b6('0x39')]));_0x368561[_0x94b6('0x38')]=_0x368561['attributes'][_0x94b6('0x3a')]?_0x368561[_0x94b6('0x38')]:_0x3107c1[_0x94b6('0x37')];if(!_0x1ad588[_0x94b6('0x35')][_0x94b6('0x3b')](_0x94b6('0x3c'))){_0x368561[_0x94b6('0x21')]=qs[_0x94b6('0x21')](_0x1ad588[_0x94b6('0x35')][_0x94b6('0x21')]);_0x368561[_0x94b6('0x23')]=qs[_0x94b6('0x23')](_0x1ad588[_0x94b6('0x35')]['offset']);}_0x368561[_0x94b6('0x3d')]=qs[_0x94b6('0x3e')](_0x1ad588['query'][_0x94b6('0x3e')]);_0x368561[_0x94b6('0x3f')]=qs[_0x94b6('0x40')](_[_0x94b6('0x41')](_0x1ad588[_0x94b6('0x35')],_0x3107c1[_0x94b6('0x40')]),_0x503f20);if(_0x1ad588[_0x94b6('0x35')]['filter']){_0x368561[_0x94b6('0x3f')]=_[_0x94b6('0x42')](_0x368561['where'],{'$or':_[_0x94b6('0x30')](_0x503f20,function(_0x4d87ce){if(_0x4d87ce[_0x94b6('0x33')]!==_0x94b6('0x43')){var _0xbadfd6={};_0xbadfd6[_0x4d87ce['name']]={'$like':'%'+_0x1ad588[_0x94b6('0x35')][_0x94b6('0x44')]+'%'};return _0xbadfd6;}})});}_0x368561=_[_0x94b6('0x42')]({},_0x368561,_0x1ad588[_0x94b6('0x45')]);var _0x52a38b={'where':_0x368561[_0x94b6('0x3f')]};return db['Plugin'][_0x94b6('0x22')](_0x52a38b)[_0x94b6('0x28')](function(_0x53e290){_0x33822e[_0x94b6('0x22')]=_0x53e290;if(_0x1ad588[_0x94b6('0x35')][_0x94b6('0x46')]){_0x368561[_0x94b6('0x47')]=[{'all':!![]}];}return db[_0x94b6('0x48')][_0x94b6('0x49')](_0x368561);})[_0x94b6('0x28')](function(_0x5b6e0c){_0x33822e[_0x94b6('0x4a')]=_0x5b6e0c;return _0x33822e;})[_0x94b6('0x28')](respondWithFilteredResult(_0x1db019,_0x368561))[_0x94b6('0x4b')](handleError(_0x1db019,null));};exports['show']=function(_0xdc4715,_0x272263){var _0x16d499={'raw':!![],'where':{'id':_0xdc4715[_0x94b6('0x4c')]['id']}},_0x1c0ad4={};_0x1c0ad4['model']=_[_0x94b6('0x36')](db[_0x94b6('0x48')][_0x94b6('0x31')]);_0x1c0ad4['query']=_['keys'](_0xdc4715['query']);_0x1c0ad4[_0x94b6('0x40')]=_[_0x94b6('0x4d')](_0x1c0ad4[_0x94b6('0x37')],_0x1c0ad4[_0x94b6('0x35')]);_0x16d499['attributes']=_['intersection'](_0x1c0ad4['model'],qs[_0x94b6('0x39')](_0xdc4715[_0x94b6('0x35')][_0x94b6('0x39')]));_0x16d499[_0x94b6('0x38')]=_0x16d499[_0x94b6('0x38')][_0x94b6('0x3a')]?_0x16d499[_0x94b6('0x38')]:_0x1c0ad4[_0x94b6('0x37')];if(_0xdc4715[_0x94b6('0x35')][_0x94b6('0x46')]){_0x16d499[_0x94b6('0x47')]=[{'all':!![]}];}_0x16d499=_['merge']({},_0x16d499,_0xdc4715['options']);return db['Plugin']['find'](_0x16d499)[_0x94b6('0x28')](handleEntityNotFound(_0x272263,null))[_0x94b6('0x28')](respondWithResult(_0x272263,null))[_0x94b6('0x4b')](handleError(_0x272263,null));};exports[_0x94b6('0x4e')]=function(_0x28e959,_0x13001d,_0x179952){return db[_0x94b6('0x48')][_0x94b6('0x4f')]({'where':{'id':_0x28e959[_0x94b6('0x4c')]['id']},'attributes':[_0x94b6('0x2e'),_0x94b6('0x6')],'raw':!![]})[_0x94b6('0x28')](handleEntityNotFound(_0x13001d,null))[_0x94b6('0x28')](function(_0x367982){if(_0x367982){var _0x12b8c1=path[_0x94b6('0x50')](config[_0x94b6('0x51')],_0x94b6('0x52'),util[_0x94b6('0x53')](_0x94b6('0x54'),path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')])));var _0x33e94d=fs[_0x94b6('0x56')](_0x12b8c1);var _0x3f09b9=archiver(_0x94b6('0x57'),{'zlib':{'level':0x9}});_0x3f09b9['on'](_0x94b6('0x58'),function(_0x34acd5){if(_0x34acd5[_0x94b6('0x59')]===_0x94b6('0x5a')){logger[_0x94b6('0x2c')](_0x34acd5);}else{throw new db['Sequelize']['Error'](_0x94b6('0x5b'));}});_0x3f09b9['on'](_0x94b6('0x2c'),function(_0x263061){throw new db[(_0x94b6('0x5c'))][(_0x94b6('0x5d'))](_0x94b6('0x5b'));});_0x3f09b9[_0x94b6('0x5e')](_0x33e94d);_0x3f09b9['glob'](_0x94b6('0x5f'),{'cwd':path[_0x94b6('0x50')](config[_0x94b6('0x51')],_0x94b6('0x52'),path[_0x94b6('0x60')](_0x367982[_0x94b6('0x6')])),'ignore':[path[_0x94b6('0x50')](path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')]),_0x94b6('0x61')),path[_0x94b6('0x50')](path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')]),_0x94b6('0x62'))],'nodir':!![]})[_0x94b6('0x63')]();_0x33e94d['on'](_0x94b6('0x64'),function(){if(!fs['existsSync'](_0x12b8c1)){throw new db['Sequelize'][(_0x94b6('0x5d'))]('Plugin\x20not\x20found');}return _0x13001d[_0x94b6('0x4e')](_0x12b8c1,util[_0x94b6('0x53')]('%s.zip',path[_0x94b6('0x55')](_0x367982[_0x94b6('0x6')])),function(_0x2e2cce){if(_0x2e2cce){throw new db[(_0x94b6('0x5c'))][(_0x94b6('0x5d'))](_0x94b6('0x65'));}fs[_0x94b6('0x66')](_0x12b8c1);logger['info'](_0x94b6('0x67'));logger[_0x94b6('0x68')](_0x94b6('0x69'));});});}return null;})[_0x94b6('0x4b')](handleError(_0x13001d,null));};exports['upload']=function(_0x2f8352,_0x1338d4,_0x3dfb52){var _0x5e6bcf=path[_0x94b6('0x55')](_0x2f8352['file'][_0x94b6('0x6a')],path[_0x94b6('0x6b')](_0x2f8352[_0x94b6('0x6c')][_0x94b6('0x6a')]));var _0x5c009f=path[_0x94b6('0x50')](config[_0x94b6('0x51')],_0x94b6('0x52'),_0x2f8352[_0x94b6('0x6c')]['filename']);var _0x5a7ecc=path[_0x94b6('0x50')](config[_0x94b6('0x51')],'server/files/plugins',_0x5e6bcf);logger[_0x94b6('0x68')](_0x94b6('0x6d'),_0x5c009f);logger[_0x94b6('0x68')]('Plugin\x20upload\x20destination:\x20%s',_0x5a7ecc);try{fs['chmodSync'](_0x5c009f,parseInt(_0x94b6('0x6e'),0x8));extract(_0x5c009f,{'dir':_0x5a7ecc},function(_0x4032c8){if(_0x4032c8){logger[_0x94b6('0x2c')](_0x4032c8);handleError(_0x4032c8,!![]);};var _0x4501b4=fs[_0x94b6('0x6f')](_0x5a7ecc);if(_0x4501b4['length']>0x1){removeReferences(_0x5c009f,_0x5a7ecc);logger[_0x94b6('0x2c')](_0x94b6('0x70'));return _0x3dfb52(new Error(_0x94b6('0x70')));}var _0x36dd92=fs[_0x94b6('0x71')](path['join'](_0x5a7ecc,_0x4501b4[0x0]));if(_0x36dd92[_0x94b6('0x72')]()){removeReferences(_0x5c009f,_0x5a7ecc);logger[_0x94b6('0x2c')]('Invalid\x20plugin\x20structure');return _0x3dfb52(new Error('Invalid\x20plugin\x20structure'));}if(_0x36dd92[_0x94b6('0x73')]()){var _0x5cbe85=fs[_0x94b6('0x6f')](path['join'](_0x5a7ecc,_0x4501b4[0x0]));if(_0x5cbe85[_0x94b6('0x3a')]===0x0){removeReferences(_0x5c009f,_0x5a7ecc);logger[_0x94b6('0x2c')]('Invalid\x20plugin\x20structure');return _0x3dfb52(new Error('Invalid\x20plugin\x20structure'));}var _0x3be058=_0x5cbe85['some'](function(_0x4023ac){return _0x4023ac===_0x94b6('0x74');});if(!_0x3be058){return _0x3dfb52(new Error(_0x94b6('0x75')));}var _0x1d28e8=fs[_0x94b6('0x76')](path[_0x94b6('0x50')](_0x5a7ecc,_0x4501b4[0x0],'manifest.json'));var _0x412530=JSON[_0x94b6('0x77')](_0x1d28e8);if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x2e')]){return _0x3dfb52(new Error(_0x94b6('0x78')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x33')]){return _0x3dfb52(new Error(_0x94b6('0x79')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7a')]){return _0x3dfb52(new Error(_0x94b6('0x7b')));}if(_0x94b6('0x20')==typeof _0x412530['parameters']){return _0x3dfb52(new Error(_0x94b6('0x7c')));}if(_0x412530['type']==='html'){if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]){return _0x3dfb52(new Error(_0x94b6('0x7f')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x80')]&&_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')]['views']['agent']){return _0x3dfb52(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x412530['type']===_0x94b6('0x81')){if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x82')]){return _0x3dfb52(new Error(_0x94b6('0x83')));}if(_0x94b6('0x20')==typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x84')]){return _0x3dfb52(new Error(_0x94b6('0x85')));}}else{return _0x3dfb52(new Error(_0x94b6('0x86')));}var _0x3f580a=_0x412530[_0x94b6('0x2e')];var _0x220b6b=_0x412530[_0x94b6('0x87')];var _0xdf57bc=_0x412530[_0x94b6('0x33')];var _0x55cf24=_0x412530[_0x94b6('0x88')]?_0x412530[_0x94b6('0x88')]:'always';var _0x3f3bad=_0x412530[_0x94b6('0x89')]?_0x412530[_0x94b6('0x89')]:'icon-apps';var _0x4b76d0='';var _0x6b4c9f='';var _0x98bb63='';var _0x55077e='';var _0x154cab=_0x412530['version'];if(_0xdf57bc===_0x94b6('0x8a')){if(_0x94b6('0x20')!=typeof _0x412530[_0x94b6('0x7d')]['views'][_0x94b6('0x80')]){var _0x344454=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x344454)){_0x4b76d0=path[_0x94b6('0x50')]('plugins',_0x5e6bcf,_0x4501b4[0x0],_0x344454);}else{_0x4b76d0=_0x344454;}}else{logger[_0x94b6('0x68')](_0x94b6('0x8c'));}if('undefined'!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x8d')]){var _0x2be677=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x2be677)){_0x6b4c9f=path[_0x94b6('0x50')](_0x94b6('0x8e'),_0x5e6bcf,_0x4501b4[0x0],_0x2be677);}else{_0x6b4c9f=_0x2be677;}}else{logger[_0x94b6('0x68')](_0x94b6('0x8f'));}}else if(_0xdf57bc===_0x94b6('0x81')){_0x98bb63=_0x412530['parameters']['scriptName'];_0x55077e=_0x412530[_0x94b6('0x7d')][_0x94b6('0x84')];if(_0x94b6('0x20')!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]){if(_0x94b6('0x20')!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x80')]){var _0x344454=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x344454)){_0x4b76d0=path[_0x94b6('0x50')]('plugins',_0x5e6bcf,_0x4501b4[0x0],_0x344454);}else{_0x4b76d0=_0x344454;}}if('undefined'!=typeof _0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')]['agent']){var _0x2be677=_0x412530[_0x94b6('0x7d')][_0x94b6('0x7e')][_0x94b6('0x8d')];if(!/^(f|ht)tps?:\/\//i[_0x94b6('0x8b')](_0x2be677)){_0x6b4c9f=path[_0x94b6('0x50')](_0x94b6('0x8e'),_0x5e6bcf,_0x4501b4[0x0],_0x2be677);}else{_0x6b4c9f=_0x2be677;}}}}var _0x438d98={'name':_0x3f580a,'description':_0x220b6b,'path':path[_0x94b6('0x50')](_0x5e6bcf,_0x4501b4[0x0]),'type':_0xdf57bc,'sidebar':_0x55cf24,'icon':_0x3f3bad,'adminUrl':_0x4b76d0,'agentUrl':_0x6b4c9f,'scriptName':_0x98bb63,'scriptPath':_0x55077e,'version':_0x154cab};removeReferences(_0x5c009f,null);return db['Plugin'][_0x94b6('0x90')](_0x438d98)[_0x94b6('0x28')](function(_0x2eb565){var _0x202ae8={'role':_0x2f8352[_0x94b6('0x91')][_0x94b6('0x92')],'userProfileId':_0x2f8352['body']['userProfileId']};if(!_0x202ae8)throw new Error(_0x94b6('0x93'));if(_0x202ae8[_0x94b6('0x92')]===_0x94b6('0x94')){var _0x54be98=_0x2eb565['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0x94b6('0x95'),'userProfileId':_0x202ae8['userProfileId']},'raw':!![]})[_0x94b6('0x28')](function(_0x54e2c7){if(_0x54e2c7&&_0x54e2c7['autoAssociation']===0x0){return db[_0x94b6('0x2a')][_0x94b6('0x90')]({'name':_0x54be98[_0x94b6('0x2e')],'resourceId':_0x54be98['id'],'type':_0x54e2c7[_0x94b6('0x2e')],'sectionId':_0x54e2c7['id']},{})[_0x94b6('0x28')](function(){return _0x2eb565;});}else{return _0x2eb565;}})[_0x94b6('0x4b')](function(_0x488cc3){logger[_0x94b6('0x2c')](_0x94b6('0x96'),_0x488cc3);throw _0x488cc3;});}return _0x2eb565;})[_0x94b6('0x28')](respondWithResult(_0x1338d4,null))[_0x94b6('0x4b')](handleError(_0x1338d4,null));}});}catch(_0x231a29){_0x1338d4['status'](0x1f4)['send'](_0x231a29);}};function removeReferences(_0x3b4af7,_0x30b84a){try{if(_0x3b4af7){fs[_0x94b6('0x66')](_0x3b4af7);logger[_0x94b6('0x68')](_0x94b6('0x97'));}if(_0x30b84a){rimraf(_0x30b84a,function(){});logger[_0x94b6('0x68')](_0x94b6('0x98'));}}catch(_0x3fbb06){logger[_0x94b6('0x2c')](_0x3fbb06);}}exports[_0x94b6('0x27')]=function(_0x15dd8b,_0x3fd061,_0x5258ff){return db['Plugin'][_0x94b6('0x4f')]({'where':{'id':_0x15dd8b[_0x94b6('0x4c')]['id']}})[_0x94b6('0x28')](handleEntityNotFound(_0x3fd061,null))[_0x94b6('0x28')](saveUpdates(_0x15dd8b[_0x94b6('0x91')],null))['then'](respondWithResult(_0x3fd061,null))[_0x94b6('0x4b')](handleError(_0x3fd061,null));};exports[_0x94b6('0x99')]=function(_0x429005,_0xa41b25,_0x2f6718){return db['Plugin'][_0x94b6('0x4f')]({'where':{'id':_0x429005[_0x94b6('0x4c')]['id']}})['then'](function(_0x1bf523){if(_0x1bf523){return _0x1bf523['destroy']();}})[_0x94b6('0x28')](function(_0x7f75c3){rimraf(path['join'](config[_0x94b6('0x51')],'server/files/plugins',path['dirname'](_0x7f75c3[_0x94b6('0x6')])),function(){});return _0x7f75c3;})[_0x94b6('0x28')](handleEntityNotFound(_0xa41b25,null))[_0x94b6('0x28')](respondWithStatusCode(_0xa41b25,null))[_0x94b6('0x4b')](handleError(_0xa41b25,null));};exports[_0x94b6('0x9a')]=function(_0x581af1,_0x1dc93e,_0x4c2cc8){return BPromise[_0x94b6('0x9b')]()[_0x94b6('0x28')](function(){if(!_0x581af1[_0x94b6('0x35')][_0x94b6('0x6')]){throw new Error(_0x94b6('0x9c'));}if(!_0x581af1[_0x94b6('0x35')]['port']){throw new Error(_0x94b6('0x9d'));}var _0x327a6f=_0x581af1['query']['hostname']?_0x581af1[_0x94b6('0x35')][_0x94b6('0x9e')]+':'+_0x581af1[_0x94b6('0x35')][_0x94b6('0x9f')]:_0x94b6('0xa0')+_0x581af1[_0x94b6('0x35')]['port'];var _0x145657=_0x581af1['query']['json']?_0x581af1[_0x94b6('0x35')][_0x94b6('0x1f')]:!![];var _0x464802=_0x581af1[_0x94b6('0x35')][_0x94b6('0xa1')]?_0x581af1[_0x94b6('0x35')]['encoding']:null;var _0x3a2635={'method':_0x581af1[_0x94b6('0xa2')],'uri':util[_0x94b6('0x53')](_0x94b6('0xa3'),_0x327a6f,_0x581af1[_0x94b6('0x35')][_0x94b6('0x6')]),'json':_0x145657,'resolveWithFullResponse':!![],'encoding':_0x464802,'qs':_0x581af1[_0x94b6('0x35')]};if(_0x581af1[_0x94b6('0xa4')]){_0x3a2635['headers']=_0x581af1[_0x94b6('0xa4')];if(_0x3a2635['headers'][_0x94b6('0xa5')]){delete _0x3a2635[_0x94b6('0xa4')]['content-length'];}}if(_0x3a2635[_0x94b6('0xa4')]['content-type']){delete _0x3a2635[_0x94b6('0xa4')][_0x94b6('0xa6')];}return rp(_0x3a2635);})[_0x94b6('0x28')](function(_0x48afa4){if(_0x48afa4){_0x1dc93e[_0x94b6('0xa7')](_0x48afa4['headers']);logger[_0x94b6('0x68')](_0x48afa4['body']);if(_['endsWith'](_0x581af1[_0x94b6('0x35')]['path'],_0x94b6('0x4e'))&&_0x48afa4[_0x94b6('0xa8')]==0x1f4){return _0x1dc93e[_0x94b6('0x1c')](_0x48afa4[_0x94b6('0xa8')]);}else{return _0x1dc93e['status'](_0x48afa4[_0x94b6('0xa8')])[_0x94b6('0x2f')](_0x48afa4[_0x94b6('0x91')]);}}else{return _0x1dc93e[_0x94b6('0x1c')](0xc8);}})['catch'](handleError(_0x1dc93e,null));};exports[_0x94b6('0xa9')]=function(_0xed08e5,_0x2fbe68,_0x19082d){return BPromise[_0x94b6('0x9b')]()['then'](function(){if(!_0xed08e5[_0x94b6('0x35')][_0x94b6('0x6')]){throw new Error(_0x94b6('0x9c'));}if(!_0xed08e5[_0x94b6('0x35')]['port']){throw new Error(_0x94b6('0x9d'));}var _0x4d9bd7=_0xed08e5[_0x94b6('0x35')][_0x94b6('0x9e')]?_0xed08e5[_0x94b6('0x35')][_0x94b6('0x9e')]+':'+_0xed08e5[_0x94b6('0x35')]['port']:'http://localhost:'+_0xed08e5['query'][_0x94b6('0x9f')];var _0x2d45c1=_0xed08e5[_0x94b6('0x35')][_0x94b6('0x1f')]?_0xed08e5['query'][_0x94b6('0x1f')]:!![];var _0x223375=_0xed08e5[_0x94b6('0x35')][_0x94b6('0xa1')]?_0xed08e5[_0x94b6('0x35')][_0x94b6('0xa1')]:null;var _0x186f54={'method':_0xed08e5[_0x94b6('0xa2')],'uri':util[_0x94b6('0x53')]('%s%s',_0x4d9bd7,_0xed08e5[_0x94b6('0x35')]['path']),'json':_0x2d45c1,'resolveWithFullResponse':!![],'encoding':_0x223375,'body':_0xed08e5[_0x94b6('0x91')]};if(_0xed08e5[_0x94b6('0xa4')]){_0x186f54[_0x94b6('0xa4')]=_0xed08e5[_0x94b6('0xa4')];if(_0x186f54[_0x94b6('0xa4')][_0x94b6('0xa5')]){delete _0x186f54[_0x94b6('0xa4')][_0x94b6('0xa5')];}}if(_0x186f54['headers'][_0x94b6('0xa6')]){delete _0x186f54[_0x94b6('0xa4')][_0x94b6('0xa6')];}return rp(_0x186f54);})[_0x94b6('0x28')](function(_0x44aff0){if(_0x44aff0){_0x2fbe68[_0x94b6('0xa7')](_0x44aff0[_0x94b6('0xa4')]);logger[_0x94b6('0x68')](_0x44aff0[_0x94b6('0x91')]);return _0x2fbe68[_0x94b6('0x1d')](_0x44aff0[_0x94b6('0xa8')])['send'](_0x44aff0[_0x94b6('0x91')]);}else{return _0x2fbe68[_0x94b6('0x1c')](0xc8);}})[_0x94b6('0x4b')](handleError(_0x2fbe68,null));}; \ No newline at end of file +var _0xe48c=['Invalid\x20manifest:\x20no\x20view\x20specified','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','description','sidebar','always','icon','version','Warning:\x20admin\x20view\x20not\x20specified','agent','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptName','test','create','body','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','%s%s','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','rimraf','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','get','Plugins','UserProfileResource','destroy','end','error','stack','name','index','map','Plugin','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','download','path','join','root','server/files/plugins','%s.zip','basename','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','attachments/**/*','finalize','Plugin\x20not\x20found','format','info','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','some','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin'];(function(_0x45d64d,_0x314243){var _0x4ee7ee=function(_0x3c59a5){while(--_0x3c59a5){_0x45d64d['push'](_0x45d64d['shift']());}};_0x4ee7ee(++_0x314243);}(_0xe48c,0x167));var _0xce48=function(_0x49fd6f,_0x3c31e9){_0x49fd6f=_0x49fd6f-0x0;var _0x58bb5e=_0xe48c[_0x49fd6f];return _0x58bb5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xce48('0x0'));var jsonpatch=require(_0xce48('0x1'));var rp=require(_0xce48('0x2'));var moment=require(_0xce48('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xce48('0x4'));var util=require(_0xce48('0x5'));var path=require('path');var sox=require(_0xce48('0x6'));var csv=require('to-csv');var ejs=require(_0xce48('0x7'));var fs=require('fs');var fs_extra=require(_0xce48('0x8'));var _=require(_0xce48('0x9'));var squel=require('squel');var crypto=require(_0xce48('0xa'));var jsforce=require(_0xce48('0xb'));var deskjs=require(_0xce48('0xc'));var toCsv=require('to-csv');var querystring=require(_0xce48('0xd'));var Papa=require(_0xce48('0xe'));var extract=require(_0xce48('0xf'));var rimraf=require(_0xce48('0x10'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xce48('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xce48('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce48('0x13'))('api');var utils=require(_0xce48('0x14'));var config=require(_0xce48('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xce48('0x16'))['db'];config[_0xce48('0x17')]=_['defaults'](config[_0xce48('0x17')],{'host':_0xce48('0x18'),'port':0x18eb});var socket=require(_0xce48('0x19'))(new Redis(config[_0xce48('0x17')]));require(_0xce48('0x1a'))[_0xce48('0x1b')](socket);function respondWithStatusCode(_0x245000,_0x3f0dad){_0x3f0dad=_0x3f0dad||0xcc;return function(_0x38104f){if(_0x38104f){return _0x245000[_0xce48('0x1c')](_0x3f0dad);}return _0x245000[_0xce48('0x1d')](_0x3f0dad)['end']();};}function respondWithResult(_0xf575ca,_0xb9c8f5){_0xb9c8f5=_0xb9c8f5||0xc8;return function(_0x1d4e40){if(_0x1d4e40){return _0xf575ca[_0xce48('0x1d')](_0xb9c8f5)[_0xce48('0x1e')](_0x1d4e40);}};}function respondWithFilteredResult(_0x3aa885,_0x470d88){return function(_0x3c63be){if(_0x3c63be){var _0x279014=typeof _0x470d88[_0xce48('0x1f')]===_0xce48('0x20')&&typeof _0x470d88['limit']===_0xce48('0x20');var _0x565921=_0x3c63be[_0xce48('0x21')];var _0x3085e3=_0x279014?0x0:_0x470d88[_0xce48('0x1f')];var _0x5140a3=_0x279014?_0x3c63be[_0xce48('0x21')]:_0x470d88[_0xce48('0x1f')]+_0x470d88[_0xce48('0x22')];var _0xf0eaee;if(_0x5140a3>=_0x565921){_0x5140a3=_0x565921;_0xf0eaee=0xc8;}else{_0xf0eaee=0xce;}_0x3aa885[_0xce48('0x1d')](_0xf0eaee);return _0x3aa885[_0xce48('0x23')](_0xce48('0x24'),_0x3085e3+'-'+_0x5140a3+'/'+_0x565921)[_0xce48('0x1e')](_0x3c63be);}return null;};}function patchUpdates(_0x195456){return function(_0x1a1249){try{jsonpatch[_0xce48('0x25')](_0x1a1249,_0x195456,!![]);}catch(_0x3a9b3f){return BPromise[_0xce48('0x26')](_0x3a9b3f);}return _0x1a1249['save']();};}function saveUpdates(_0x17b236,_0x85e2dd){return function(_0x2e6ddd){if(_0x2e6ddd){return _0x2e6ddd[_0xce48('0x27')](_0x17b236)['then'](function(_0x1b2bca){return _0x1b2bca;});}return null;};}function removeEntity(_0x2be976,_0x4612e9){return function(_0x1bb017){if(_0x1bb017){return _0x1bb017['destroy']()[_0xce48('0x28')](function(){var _0x100e04=_0x1bb017[_0xce48('0x29')]({'plain':!![]});var _0x3ebd41=_0xce48('0x2a');return db[_0xce48('0x2b')][_0xce48('0x2c')]({'where':{'type':_0x3ebd41,'resourceId':_0x100e04['id']}})[_0xce48('0x28')](function(){return _0x1bb017;});})[_0xce48('0x28')](function(){_0x2be976['status'](0xcc)[_0xce48('0x2d')]();});}};}function handleEntityNotFound(_0xdac53f,_0x1fe7bc){return function(_0x3e8920){if(!_0x3e8920){_0xdac53f[_0xce48('0x1c')](0x194);}return _0x3e8920;};}function handleError(_0x524bd9,_0x383bbe){_0x383bbe=_0x383bbe||0x1f4;return function(_0xb2cc3c){logger[_0xce48('0x2e')](_0xb2cc3c[_0xce48('0x2f')]);if(_0xb2cc3c[_0xce48('0x30')]){delete _0xb2cc3c[_0xce48('0x30')];}_0x524bd9['status'](_0x383bbe)['send'](_0xb2cc3c);};}exports[_0xce48('0x31')]=function(_0x304112,_0x32141c){var _0x55a1c8={},_0x221fb1={},_0x5ec414={'count':0x0,'rows':[]};var _0x4bd2d0=_[_0xce48('0x32')](db[_0xce48('0x33')][_0xce48('0x34')],function(_0xcce8f0){return{'name':_0xcce8f0[_0xce48('0x35')],'type':_0xcce8f0[_0xce48('0x36')]['key']};});_0x221fb1[_0xce48('0x37')]=_['map'](_0x4bd2d0,_0xce48('0x30'));_0x221fb1[_0xce48('0x38')]=_[_0xce48('0x39')](_0x304112['query']);_0x221fb1[_0xce48('0x3a')]=_[_0xce48('0x3b')](_0x221fb1[_0xce48('0x37')],_0x221fb1[_0xce48('0x38')]);_0x55a1c8[_0xce48('0x3c')]=_[_0xce48('0x3b')](_0x221fb1[_0xce48('0x37')],qs[_0xce48('0x3d')](_0x304112[_0xce48('0x38')][_0xce48('0x3d')]));_0x55a1c8[_0xce48('0x3c')]=_0x55a1c8[_0xce48('0x3c')][_0xce48('0x3e')]?_0x55a1c8[_0xce48('0x3c')]:_0x221fb1['model'];if(!_0x304112[_0xce48('0x38')][_0xce48('0x3f')]('nolimit')){_0x55a1c8[_0xce48('0x22')]=qs['limit'](_0x304112['query'][_0xce48('0x22')]);_0x55a1c8[_0xce48('0x1f')]=qs[_0xce48('0x1f')](_0x304112[_0xce48('0x38')][_0xce48('0x1f')]);}_0x55a1c8['order']=qs[_0xce48('0x40')](_0x304112[_0xce48('0x38')]['sort']);_0x55a1c8[_0xce48('0x41')]=qs[_0xce48('0x3a')](_[_0xce48('0x42')](_0x304112[_0xce48('0x38')],_0x221fb1[_0xce48('0x3a')]),_0x4bd2d0);if(_0x304112[_0xce48('0x38')][_0xce48('0x43')]){_0x55a1c8['where']=_[_0xce48('0x44')](_0x55a1c8[_0xce48('0x41')],{'$or':_[_0xce48('0x32')](_0x4bd2d0,function(_0x392992){if(_0x392992[_0xce48('0x36')]!=='VIRTUAL'){var _0x4ca4e1={};_0x4ca4e1[_0x392992['name']]={'$like':'%'+_0x304112['query'][_0xce48('0x43')]+'%'};return _0x4ca4e1;}})});}_0x55a1c8=_[_0xce48('0x44')]({},_0x55a1c8,_0x304112[_0xce48('0x45')]);var _0xd177ea={'where':_0x55a1c8[_0xce48('0x41')]};return db['Plugin']['count'](_0xd177ea)[_0xce48('0x28')](function(_0x87087b){_0x5ec414[_0xce48('0x21')]=_0x87087b;if(_0x304112[_0xce48('0x38')][_0xce48('0x46')]){_0x55a1c8[_0xce48('0x47')]=[{'all':!![]}];}return db[_0xce48('0x33')][_0xce48('0x48')](_0x55a1c8);})[_0xce48('0x28')](function(_0x25e1f7){_0x5ec414['rows']=_0x25e1f7;return _0x5ec414;})[_0xce48('0x28')](respondWithFilteredResult(_0x32141c,_0x55a1c8))[_0xce48('0x49')](handleError(_0x32141c,null));};exports[_0xce48('0x4a')]=function(_0x49b0c5,_0x47a3ea){var _0x2dbd2a={'raw':!![],'where':{'id':_0x49b0c5[_0xce48('0x4b')]['id']}},_0x577bc6={};_0x577bc6['model']=_[_0xce48('0x39')](db[_0xce48('0x33')][_0xce48('0x34')]);_0x577bc6[_0xce48('0x38')]=_['keys'](_0x49b0c5['query']);_0x577bc6['filters']=_[_0xce48('0x3b')](_0x577bc6[_0xce48('0x37')],_0x577bc6[_0xce48('0x38')]);_0x2dbd2a[_0xce48('0x3c')]=_[_0xce48('0x3b')](_0x577bc6[_0xce48('0x37')],qs['fields'](_0x49b0c5['query'][_0xce48('0x3d')]));_0x2dbd2a['attributes']=_0x2dbd2a[_0xce48('0x3c')][_0xce48('0x3e')]?_0x2dbd2a[_0xce48('0x3c')]:_0x577bc6[_0xce48('0x37')];if(_0x49b0c5[_0xce48('0x38')][_0xce48('0x46')]){_0x2dbd2a['include']=[{'all':!![]}];}_0x2dbd2a=_[_0xce48('0x44')]({},_0x2dbd2a,_0x49b0c5['options']);return db[_0xce48('0x33')][_0xce48('0x4c')](_0x2dbd2a)[_0xce48('0x28')](handleEntityNotFound(_0x47a3ea,null))[_0xce48('0x28')](respondWithResult(_0x47a3ea,null))[_0xce48('0x49')](handleError(_0x47a3ea,null));};exports[_0xce48('0x4d')]=function(_0x1efe60,_0x2e2c96,_0x3542c5){return db[_0xce48('0x33')][_0xce48('0x4c')]({'where':{'id':_0x1efe60[_0xce48('0x4b')]['id']},'attributes':[_0xce48('0x30'),_0xce48('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x2e2c96,null))['then'](function(_0x17f977){if(_0x17f977){var _0x2c6070=path[_0xce48('0x4f')](config[_0xce48('0x50')],_0xce48('0x51'),util['format'](_0xce48('0x52'),path[_0xce48('0x53')](_0x17f977[_0xce48('0x4e')])));var _0x43ffc7=fs['createWriteStream'](_0x2c6070);var _0x11e8fb=archiver(_0xce48('0x54'),{'zlib':{'level':0x9}});_0x11e8fb['on'](_0xce48('0x55'),function(_0x3b663a){if(_0x3b663a[_0xce48('0x56')]===_0xce48('0x57')){logger[_0xce48('0x2e')](_0x3b663a);}else{throw new db[(_0xce48('0x58'))][(_0xce48('0x59'))](_0xce48('0x5a'));}});_0x11e8fb['on'](_0xce48('0x2e'),function(_0x4bd9fe){throw new db[(_0xce48('0x58'))][(_0xce48('0x59'))](_0xce48('0x5a'));});_0x11e8fb[_0xce48('0x5b')](_0x43ffc7);_0x11e8fb[_0xce48('0x5c')](_0xce48('0x5d'),{'cwd':path[_0xce48('0x4f')](config[_0xce48('0x50')],_0xce48('0x51'),path['dirname'](_0x17f977[_0xce48('0x4e')])),'ignore':[path[_0xce48('0x4f')](path[_0xce48('0x53')](_0x17f977[_0xce48('0x4e')]),'node_modules/**/*'),path[_0xce48('0x4f')](path[_0xce48('0x53')](_0x17f977[_0xce48('0x4e')]),_0xce48('0x5e'))],'nodir':!![]})[_0xce48('0x5f')]();_0x43ffc7['on']('close',function(){if(!fs['existsSync'](_0x2c6070)){throw new db[(_0xce48('0x58'))][(_0xce48('0x59'))](_0xce48('0x60'));}return _0x2e2c96[_0xce48('0x4d')](_0x2c6070,util[_0xce48('0x61')](_0xce48('0x52'),path['basename'](_0x17f977[_0xce48('0x4e')])),function(_0xd4ce96){if(_0xd4ce96){throw new db[(_0xce48('0x58'))]['Error']('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x2c6070);logger[_0xce48('0x62')]('Download\x20completed');logger[_0xce48('0x62')]('Temporary\x20file\x20removed');});});}return null;})[_0xce48('0x49')](handleError(_0x2e2c96,null));};exports['upload']=function(_0x242d30,_0x375f90,_0x103867){var _0xee0df5=path[_0xce48('0x53')](_0x242d30[_0xce48('0x63')][_0xce48('0x64')],path[_0xce48('0x65')](_0x242d30[_0xce48('0x63')][_0xce48('0x64')]));var _0x3c04ce=path[_0xce48('0x4f')](config['root'],_0xce48('0x51'),_0x242d30[_0xce48('0x63')]['filename']);var _0x1a44d3=path[_0xce48('0x4f')](config[_0xce48('0x50')],_0xce48('0x51'),_0xee0df5);logger[_0xce48('0x62')]('Plugin\x20upload\x20filepath:\x20%s',_0x3c04ce);logger[_0xce48('0x62')](_0xce48('0x66'),_0x1a44d3);try{fs[_0xce48('0x67')](_0x3c04ce,parseInt('0777',0x8));extract(_0x3c04ce,{'dir':_0x1a44d3},function(_0x3c0ce3){if(_0x3c0ce3){logger['error'](_0x3c0ce3);handleError(_0x3c0ce3,!![]);};var _0x8e2f74=fs[_0xce48('0x68')](_0x1a44d3);if(_0x8e2f74[_0xce48('0x3e')]>0x1){removeReferences(_0x3c04ce,_0x1a44d3);logger[_0xce48('0x2e')](_0xce48('0x69'));return _0x103867(new Error(_0xce48('0x69')));}var _0x5dd3a9=fs['lstatSync'](path[_0xce48('0x4f')](_0x1a44d3,_0x8e2f74[0x0]));if(_0x5dd3a9['isFile']()){removeReferences(_0x3c04ce,_0x1a44d3);logger[_0xce48('0x2e')]('Invalid\x20plugin\x20structure');return _0x103867(new Error(_0xce48('0x69')));}if(_0x5dd3a9['isDirectory']()){var _0x416966=fs['readdirSync'](path[_0xce48('0x4f')](_0x1a44d3,_0x8e2f74[0x0]));if(_0x416966[_0xce48('0x3e')]===0x0){removeReferences(_0x3c04ce,_0x1a44d3);logger[_0xce48('0x2e')](_0xce48('0x69'));return _0x103867(new Error('Invalid\x20plugin\x20structure'));}var _0x4c7dce=_0x416966[_0xce48('0x6a')](function(_0x239023){return _0x239023===_0xce48('0x6b');});if(!_0x4c7dce){return _0x103867(new Error('Plugin\x20manifest\x20missing'));}var _0x9de752=fs['readFileSync'](path['join'](_0x1a44d3,_0x8e2f74[0x0],_0xce48('0x6b')));var _0x3a4e51=JSON['parse'](_0x9de752);if(_0xce48('0x20')==typeof _0x3a4e51[_0xce48('0x30')]){return _0x103867(new Error(_0xce48('0x6c')));}if(_0xce48('0x20')==typeof _0x3a4e51[_0xce48('0x36')]){return _0x103867(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x3a4e51['version']){return _0x103867(new Error(_0xce48('0x6d')));}if(_0xce48('0x20')==typeof _0x3a4e51['parameters']){return _0x103867(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3a4e51[_0xce48('0x36')]===_0xce48('0x6e')){if(_0xce48('0x20')==typeof _0x3a4e51['parameters'][_0xce48('0x6f')]){return _0x103867(new Error(_0xce48('0x70')));}if('undefined'==typeof _0x3a4e51[_0xce48('0x71')]['views'][_0xce48('0x72')]&&'undefined'==typeof _0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')]['agent']){return _0x103867(new Error(_0xce48('0x73')));}}else if(_0x3a4e51[_0xce48('0x36')]==='script'){if(_0xce48('0x20')==typeof _0x3a4e51[_0xce48('0x71')]['scriptName']){return _0x103867(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xce48('0x20')==typeof _0x3a4e51['parameters'][_0xce48('0x74')]){return _0x103867(new Error(_0xce48('0x75')));}}else{return _0x103867(new Error('Invalid\x20manifest:\x20invalid\x20type'));}var _0x1106f9=_0x3a4e51[_0xce48('0x30')];var _0x5d0597=_0x3a4e51[_0xce48('0x76')];var _0x1e6a9e=_0x3a4e51['type'];var _0x9873d2=_0x3a4e51[_0xce48('0x77')]?_0x3a4e51[_0xce48('0x77')]:_0xce48('0x78');var _0x5b5279=_0x3a4e51[_0xce48('0x79')]?_0x3a4e51[_0xce48('0x79')]:'icon-apps';var _0x5babaf='';var _0x5e3420='';var _0x24b398='';var _0x240732='';var _0x13131c=_0x3a4e51[_0xce48('0x7a')];if(_0x1e6a9e===_0xce48('0x6e')){if('undefined'!=typeof _0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')][_0xce48('0x72')]){var _0x2e59d3=_0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')][_0xce48('0x72')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2e59d3)){_0x5babaf=path[_0xce48('0x4f')]('plugins',_0xee0df5,_0x8e2f74[0x0],_0x2e59d3);}else{_0x5babaf=_0x2e59d3;}}else{logger[_0xce48('0x62')](_0xce48('0x7b'));}if(_0xce48('0x20')!=typeof _0x3a4e51[_0xce48('0x71')]['views'][_0xce48('0x7c')]){var _0x2d86b7=_0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')][_0xce48('0x7c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2d86b7)){_0x5e3420=path[_0xce48('0x4f')](_0xce48('0x7d'),_0xee0df5,_0x8e2f74[0x0],_0x2d86b7);}else{_0x5e3420=_0x2d86b7;}}else{logger[_0xce48('0x62')](_0xce48('0x7e'));}}else if(_0x1e6a9e===_0xce48('0x7f')){_0x24b398=_0x3a4e51[_0xce48('0x71')][_0xce48('0x80')];_0x240732=_0x3a4e51[_0xce48('0x71')]['scriptPath'];if(_0xce48('0x20')!=typeof _0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')]){if(_0xce48('0x20')!=typeof _0x3a4e51['parameters'][_0xce48('0x6f')]['admin']){var _0x2e59d3=_0x3a4e51[_0xce48('0x71')]['views'][_0xce48('0x72')];if(!/^(f|ht)tps?:\/\//i[_0xce48('0x81')](_0x2e59d3)){_0x5babaf=path['join'](_0xce48('0x7d'),_0xee0df5,_0x8e2f74[0x0],_0x2e59d3);}else{_0x5babaf=_0x2e59d3;}}if(_0xce48('0x20')!=typeof _0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')][_0xce48('0x7c')]){var _0x2d86b7=_0x3a4e51[_0xce48('0x71')][_0xce48('0x6f')][_0xce48('0x7c')];if(!/^(f|ht)tps?:\/\//i[_0xce48('0x81')](_0x2d86b7)){_0x5e3420=path['join'](_0xce48('0x7d'),_0xee0df5,_0x8e2f74[0x0],_0x2d86b7);}else{_0x5e3420=_0x2d86b7;}}}}var _0x578bd8={'name':_0x1106f9,'description':_0x5d0597,'path':path[_0xce48('0x4f')](_0xee0df5,_0x8e2f74[0x0]),'type':_0x1e6a9e,'sidebar':_0x9873d2,'icon':_0x5b5279,'adminUrl':_0x5babaf,'agentUrl':_0x5e3420,'scriptName':_0x24b398,'scriptPath':_0x240732,'version':_0x13131c};removeReferences(_0x3c04ce,null);return db['Plugin'][_0xce48('0x82')](_0x578bd8)[_0xce48('0x28')](function(_0xeb049e){var _0x38d38f={'role':_0x242d30[_0xce48('0x83')]['role'],'userProfileId':_0x242d30[_0xce48('0x83')]['userProfileId']};if(!_0x38d38f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38d38f[_0xce48('0x84')]===_0xce48('0x85')){var _0x26a43c=_0xeb049e['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':_0xce48('0x2a'),'userProfileId':_0x38d38f[_0xce48('0x86')]},'raw':!![]})[_0xce48('0x28')](function(_0x380bad){if(_0x380bad&&_0x380bad[_0xce48('0x87')]===0x0){return db[_0xce48('0x2b')][_0xce48('0x82')]({'name':_0x26a43c[_0xce48('0x30')],'resourceId':_0x26a43c['id'],'type':_0x380bad[_0xce48('0x30')],'sectionId':_0x380bad['id']},{})[_0xce48('0x28')](function(){return _0xeb049e;});}else{return _0xeb049e;}})[_0xce48('0x49')](function(_0x36b124){logger[_0xce48('0x2e')](_0xce48('0x88'),_0x36b124);throw _0x36b124;});}return _0xeb049e;})[_0xce48('0x28')](respondWithResult(_0x375f90,null))[_0xce48('0x49')](handleError(_0x375f90,null));}});}catch(_0x2d881d){_0x375f90[_0xce48('0x1d')](0x1f4)[_0xce48('0x89')](_0x2d881d);}};function removeReferences(_0x4fbe14,_0x906ea0){try{if(_0x4fbe14){fs[_0xce48('0x8a')](_0x4fbe14);logger[_0xce48('0x62')](_0xce48('0x8b'));}if(_0x906ea0){rimraf(_0x906ea0,function(){});logger[_0xce48('0x62')](_0xce48('0x8c'));}}catch(_0x3739f0){logger[_0xce48('0x2e')](_0x3739f0);}}exports[_0xce48('0x27')]=function(_0x4dd4ea,_0x877882,_0x47b2d8){return db[_0xce48('0x33')][_0xce48('0x4c')]({'where':{'id':_0x4dd4ea[_0xce48('0x4b')]['id']}})[_0xce48('0x28')](handleEntityNotFound(_0x877882,null))[_0xce48('0x28')](saveUpdates(_0x4dd4ea[_0xce48('0x83')],null))['then'](respondWithResult(_0x877882,null))[_0xce48('0x49')](handleError(_0x877882,null));};exports[_0xce48('0x8d')]=function(_0x26a028,_0x3657d9,_0x579300){return db[_0xce48('0x33')][_0xce48('0x4c')]({'where':{'id':_0x26a028[_0xce48('0x4b')]['id']}})[_0xce48('0x28')](function(_0x57b1f8){if(_0x57b1f8){return _0x57b1f8[_0xce48('0x2c')]();}})['then'](function(_0x2898ed){rimraf(path[_0xce48('0x4f')](config[_0xce48('0x50')],'server/files/plugins',path['dirname'](_0x2898ed['path'])),function(){});return _0x2898ed;})['then'](handleEntityNotFound(_0x3657d9,null))[_0xce48('0x28')](respondWithStatusCode(_0x3657d9,null))[_0xce48('0x49')](handleError(_0x3657d9,null));};exports[_0xce48('0x8e')]=function(_0x3bc99e,_0x431248,_0x1ef981){return BPromise[_0xce48('0x8f')]()[_0xce48('0x28')](function(){if(!_0x3bc99e[_0xce48('0x38')][_0xce48('0x4e')]){throw new Error(_0xce48('0x90'));}if(!_0x3bc99e[_0xce48('0x38')][_0xce48('0x91')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5b8c7d=_0x3bc99e[_0xce48('0x38')][_0xce48('0x92')]?_0x3bc99e[_0xce48('0x38')]['hostname']+':'+_0x3bc99e['query'][_0xce48('0x91')]:_0xce48('0x93')+_0x3bc99e[_0xce48('0x38')][_0xce48('0x91')];var _0x5d7ca3=_0x3bc99e[_0xce48('0x38')][_0xce48('0x1e')]?_0x3bc99e[_0xce48('0x38')]['json']:!![];var _0x6f12bb=_0x3bc99e[_0xce48('0x38')][_0xce48('0x94')]?_0x3bc99e[_0xce48('0x38')]['encoding']:null;var _0x3e899a={'method':_0x3bc99e[_0xce48('0x95')],'uri':util['format']('%s%s',_0x5b8c7d,_0x3bc99e[_0xce48('0x38')][_0xce48('0x4e')]),'json':_0x5d7ca3,'resolveWithFullResponse':!![],'encoding':_0x6f12bb,'qs':_0x3bc99e[_0xce48('0x38')]};if(_0x3bc99e[_0xce48('0x96')]){_0x3e899a[_0xce48('0x96')]=_0x3bc99e[_0xce48('0x96')];if(_0x3e899a['headers'][_0xce48('0x97')]){delete _0x3e899a[_0xce48('0x96')][_0xce48('0x97')];}}if(_0x3e899a[_0xce48('0x96')][_0xce48('0x98')]){delete _0x3e899a['headers'][_0xce48('0x98')];}return rp(_0x3e899a);})['then'](function(_0x313cef){if(_0x313cef){_0x431248[_0xce48('0x23')](_0x313cef[_0xce48('0x96')]);logger[_0xce48('0x62')](_0x313cef[_0xce48('0x83')]);if(_[_0xce48('0x99')](_0x3bc99e[_0xce48('0x38')][_0xce48('0x4e')],'download')&&_0x313cef['statusCode']==0x1f4){return _0x431248['sendStatus'](_0x313cef[_0xce48('0x9a')]);}else{return _0x431248[_0xce48('0x1d')](_0x313cef[_0xce48('0x9a')])[_0xce48('0x89')](_0x313cef[_0xce48('0x83')]);}}else{return _0x431248['sendStatus'](0xc8);}})[_0xce48('0x49')](handleError(_0x431248,null));};exports[_0xce48('0x9b')]=function(_0x5cd862,_0x5129d3,_0x3f07a5){return BPromise[_0xce48('0x8f')]()['then'](function(){if(!_0x5cd862[_0xce48('0x38')][_0xce48('0x4e')]){throw new Error(_0xce48('0x90'));}if(!_0x5cd862[_0xce48('0x38')]['port']){throw new Error(_0xce48('0x9c'));}var _0x15e182=_0x5cd862[_0xce48('0x38')][_0xce48('0x92')]?_0x5cd862[_0xce48('0x38')][_0xce48('0x92')]+':'+_0x5cd862[_0xce48('0x38')][_0xce48('0x91')]:_0xce48('0x93')+_0x5cd862[_0xce48('0x38')][_0xce48('0x91')];var _0x22bcbf=_0x5cd862[_0xce48('0x38')]['json']?_0x5cd862['query']['json']:!![];var _0x5f1bf5=_0x5cd862[_0xce48('0x38')]['encoding']?_0x5cd862['query']['encoding']:null;var _0x474755={'method':_0x5cd862['method'],'uri':util[_0xce48('0x61')](_0xce48('0x9d'),_0x15e182,_0x5cd862['query']['path']),'json':_0x22bcbf,'resolveWithFullResponse':!![],'encoding':_0x5f1bf5,'body':_0x5cd862[_0xce48('0x83')]};if(_0x5cd862[_0xce48('0x96')]){_0x474755['headers']=_0x5cd862[_0xce48('0x96')];if(_0x474755[_0xce48('0x96')][_0xce48('0x97')]){delete _0x474755[_0xce48('0x96')]['content-length'];}}if(_0x474755[_0xce48('0x96')][_0xce48('0x98')]){delete _0x474755[_0xce48('0x96')]['content-type'];}return rp(_0x474755);})['then'](function(_0x46ba4c){if(_0x46ba4c){_0x5129d3['set'](_0x46ba4c[_0xce48('0x96')]);logger['info'](_0x46ba4c['body']);return _0x5129d3[_0xce48('0x1d')](_0x46ba4c[_0xce48('0x9a')])[_0xce48('0x89')](_0x46ba4c[_0xce48('0x83')]);}else{return _0x5129d3[_0xce48('0x1c')](0xc8);}})['catch'](handleError(_0x5129d3,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 7b5549c..54883f9 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 _0x21cd=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x2c1dcd,_0x350452){var _0x158ce5=function(_0x5c1c57){while(--_0x5c1c57){_0x2c1dcd['push'](_0x2c1dcd['shift']());}};_0x158ce5(++_0x350452);}(_0x21cd,0x6a));var _0xd21c=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x21cd[_0x199572];return _0x13cfa3;};'use strict';var EventEmitter=require(_0xd21c('0x0'));var Plugin=require(_0xd21c('0x1'))['db'][_0xd21c('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xd21c('0x3')](0x0);var events={'afterCreate':_0xd21c('0x4'),'afterUpdate':_0xd21c('0x5'),'afterDestroy':_0xd21c('0x6')};function emitEvent(_0xd67178){return function(_0x4122cb,_0x53e0b2,_0x5902fc){PluginEvents[_0xd21c('0x7')](_0xd67178+':'+_0x4122cb['id'],_0x4122cb);PluginEvents[_0xd21c('0x7')](_0xd67178,_0x4122cb);_0x5902fc(null);};}for(var e in events){if(events[_0xd21c('0x8')](e)){var event=events[e];Plugin[_0xd21c('0x9')](e,emitEvent(event));}}module[_0xd21c('0xa')]=PluginEvents; \ No newline at end of file +var _0xeda8=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xeda8,0x104));var _0x8eda=function(_0x564208,_0x517d8e){_0x564208=_0x564208-0x0;var _0x1b65dc=_0xeda8[_0x564208];return _0x1b65dc;};'use strict';var EventEmitter=require(_0x8eda('0x0'));var Plugin=require(_0x8eda('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x8eda('0x2')](0x0);var events={'afterCreate':_0x8eda('0x3'),'afterUpdate':_0x8eda('0x4'),'afterDestroy':_0x8eda('0x5')};function emitEvent(_0x37ab2c){return function(_0x94b83f,_0x25b19a,_0x3eb7b1){PluginEvents[_0x8eda('0x6')](_0x37ab2c+':'+_0x94b83f['id'],_0x94b83f);PluginEvents[_0x8eda('0x6')](_0x37ab2c,_0x94b83f);_0x3eb7b1(null);};}for(var e in events){if(events[_0x8eda('0x7')](e)){var event=events[e];Plugin[_0x8eda('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index f973ec4..89a5d1c 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 _0xdfb4=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./plugin.attributes','exports','define','Plugin','plugins','lodash','util','../../config/logger'];(function(_0x3313c5,_0x1c3309){var _0x45923a=function(_0x280ccf){while(--_0x280ccf){_0x3313c5['push'](_0x3313c5['shift']());}};_0x45923a(++_0x1c3309);}(_0xdfb4,0x169));var _0x4dfb=function(_0x3dc8b9,_0xe3d669){_0x3dc8b9=_0x3dc8b9-0x0;var _0x27918f=_0xdfb4[_0x3dc8b9];return _0x27918f;};'use strict';var _=require(_0x4dfb('0x0'));var util=require(_0x4dfb('0x1'));var logger=require(_0x4dfb('0x2'))(_0x4dfb('0x3'));var moment=require(_0x4dfb('0x4'));var BPromise=require(_0x4dfb('0x5'));var rp=require(_0x4dfb('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4dfb('0x7'));var config=require(_0x4dfb('0x8'));var attributes=require(_0x4dfb('0x9'));module[_0x4dfb('0xa')]=function(_0xe2ec60,_0x169f07){return _0xe2ec60[_0x4dfb('0xb')](_0x4dfb('0xc'),attributes,{'tableName':_0x4dfb('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8702=['bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','plugins','lodash','../../config/logger','moment'];(function(_0x4ca9f4,_0x135093){var _0x2adc43=function(_0x438ac0){while(--_0x438ac0){_0x4ca9f4['push'](_0x4ca9f4['shift']());}};_0x2adc43(++_0x135093);}(_0x8702,0xad));var _0x2870=function(_0x1006d7,_0x433024){_0x1006d7=_0x1006d7-0x0;var _0x168bfb=_0x8702[_0x1006d7];return _0x168bfb;};'use strict';var _=require(_0x2870('0x0'));var util=require('util');var logger=require(_0x2870('0x1'))('api');var moment=require(_0x2870('0x2'));var BPromise=require(_0x2870('0x3'));var rp=require(_0x2870('0x4'));var fs=require('fs');var path=require(_0x2870('0x5'));var rimraf=require(_0x2870('0x6'));var config=require(_0x2870('0x7'));var attributes=require(_0x2870('0x8'));module[_0x2870('0x9')]=function(_0x2fffd4,_0x2afee){return _0x2fffd4['define']('Plugin',attributes,{'tableName':_0x2870('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index 2bffd05..2be2705 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 _0xfc45=['socket.io-emitter','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','error','code','message','CreatePlugin','create','body','options','raw','lodash','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis'];(function(_0x4dc763,_0x1b7936){var _0x529a48=function(_0x248a40){while(--_0x248a40){_0x4dc763['push'](_0x4dc763['shift']());}};_0x529a48(++_0x1b7936);}(_0xfc45,0x7e));var _0x5fc4=function(_0x500c24,_0x320f94){_0x500c24=_0x500c24-0x0;var _0xd5b6e6=_0xfc45[_0x500c24];return _0xd5b6e6;};'use strict';var _=require(_0x5fc4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5fc4('0x1'));var fs=require('fs');var Redis=require(_0x5fc4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fc4('0x3'));var logger=require(_0x5fc4('0x4'))(_0x5fc4('0x5'));var config=require(_0x5fc4('0x6'));var jayson=require(_0x5fc4('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x5fc4('0x8')]=_['defaults'](config[_0x5fc4('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x5fc4('0x9'))(new Redis(config['redis']));require(_0x5fc4('0xa'))[_0x5fc4('0xb')](socket);function respondWithRpcPromise(_0x48f7db,_0x192e3b,_0x140298){return new BPromise(function(_0x11c11e,_0x2f0c1f){return client[_0x5fc4('0xc')](_0x48f7db,_0x140298)[_0x5fc4('0xd')](function(_0x1d32c8){logger[_0x5fc4('0xe')](_0x5fc4('0xf'),_0x192e3b,_0x5fc4('0x10'));logger[_0x5fc4('0x11')](_0x5fc4('0x12'),_0x192e3b,'request\x20sent',JSON['stringify'](_0x1d32c8));if(_0x1d32c8[_0x5fc4('0x13')]){if(_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x14')]===0x1f4){logger[_0x5fc4('0x13')](_0x5fc4('0xf'),_0x192e3b,_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x15')]);return _0x2f0c1f(_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x15')]);}logger[_0x5fc4('0x13')](_0x5fc4('0xf'),_0x192e3b,_0x1d32c8[_0x5fc4('0x13')][_0x5fc4('0x15')]);return _0x11c11e(_0x1d32c8[_0x5fc4('0x13')]['message']);}else{logger['info'](_0x5fc4('0xf'),_0x192e3b,_0x5fc4('0x10'));_0x11c11e(_0x1d32c8['result'][_0x5fc4('0x15')]);}})['catch'](function(_0x25ec3e){logger[_0x5fc4('0x13')]('Plugin,\x20%s,\x20%s',_0x192e3b,_0x25ec3e);_0x2f0c1f(_0x25ec3e);});});}exports[_0x5fc4('0x16')]=function(_0x37d449){var _0x2e3483=this;return new Promise(function(_0x2b874a,_0x2f0437){return db['Plugin'][_0x5fc4('0x17')](_0x37d449[_0x5fc4('0x18')],{'raw':_0x37d449[_0x5fc4('0x19')]?_0x37d449['options'][_0x5fc4('0x1a')]===undefined?!![]:![]:!![]})[_0x5fc4('0xd')](function(_0x1f142d){logger['info'](_0x5fc4('0x16'),_0x37d449);logger[_0x5fc4('0x11')]('CreatePlugin',_0x37d449,JSON['stringify'](_0x1f142d));_0x2b874a(_0x1f142d);})['catch'](function(_0xee4389){logger[_0x5fc4('0x13')](_0x5fc4('0x16'),_0xee4389[_0x5fc4('0x15')],_0x37d449);_0x2f0437(_0x2e3483[_0x5fc4('0x13')](0x1f4,_0xee4389[_0x5fc4('0x15')]));});});}; \ No newline at end of file +var _0xafd0=['message','info','result','catch','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xafd0,0xb3));var _0x0afd=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xafd0[_0x51020b];return _0x371e47;};'use strict';var _=require(_0x0afd('0x0'));var util=require(_0x0afd('0x1'));var moment=require(_0x0afd('0x2'));var BPromise=require(_0x0afd('0x3'));var rs=require(_0x0afd('0x4'));var fs=require('fs');var Redis=require(_0x0afd('0x5'));var db=require(_0x0afd('0x6'))['db'];var utils=require(_0x0afd('0x7'));var logger=require(_0x0afd('0x8'))(_0x0afd('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0afd('0xa')][_0x0afd('0xb')]({'port':0x232a});config[_0x0afd('0xc')]=_[_0x0afd('0xd')](config[_0x0afd('0xc')],{'host':_0x0afd('0xe'),'port':0x18eb});var socket=require(_0x0afd('0xf'))(new Redis(config['redis']));require(_0x0afd('0x10'))['register'](socket);function respondWithRpcPromise(_0x348dab,_0x344e5a,_0x412c81){return new BPromise(function(_0xa72d76,_0x4659cf){return client['request'](_0x348dab,_0x412c81)[_0x0afd('0x11')](function(_0x194e8b){logger['info'](_0x0afd('0x12'),_0x344e5a,_0x0afd('0x13'));logger[_0x0afd('0x14')](_0x0afd('0x15'),_0x344e5a,_0x0afd('0x13'),JSON[_0x0afd('0x16')](_0x194e8b));if(_0x194e8b['error']){if(_0x194e8b[_0x0afd('0x17')][_0x0afd('0x18')]===0x1f4){logger[_0x0afd('0x17')](_0x0afd('0x12'),_0x344e5a,_0x194e8b['error']['message']);return _0x4659cf(_0x194e8b['error']['message']);}logger['error'](_0x0afd('0x12'),_0x344e5a,_0x194e8b['error']['message']);return _0xa72d76(_0x194e8b[_0x0afd('0x17')][_0x0afd('0x19')]);}else{logger[_0x0afd('0x1a')](_0x0afd('0x12'),_0x344e5a,_0x0afd('0x13'));_0xa72d76(_0x194e8b[_0x0afd('0x1b')][_0x0afd('0x19')]);}})[_0x0afd('0x1c')](function(_0x27d33e){logger[_0x0afd('0x17')]('Plugin,\x20%s,\x20%s',_0x344e5a,_0x27d33e);_0x4659cf(_0x27d33e);});});}exports['CreatePlugin']=function(_0x2969dd){var _0x159262=this;return new Promise(function(_0xaec80b,_0x169066){return db['Plugin'][_0x0afd('0x1d')](_0x2969dd[_0x0afd('0x1e')],{'raw':_0x2969dd[_0x0afd('0x1f')]?_0x2969dd[_0x0afd('0x1f')][_0x0afd('0x20')]===undefined?!![]:![]:!![]})[_0x0afd('0x11')](function(_0x1f410c){logger[_0x0afd('0x1a')](_0x0afd('0x21'),_0x2969dd);logger[_0x0afd('0x14')](_0x0afd('0x21'),_0x2969dd,JSON[_0x0afd('0x16')](_0x1f410c));_0xaec80b(_0x1f410c);})['catch'](function(_0x5ed013){logger[_0x0afd('0x17')](_0x0afd('0x21'),_0x5ed013[_0x0afd('0x19')],_0x2969dd);_0x169066(_0x159262[_0x0afd('0x17')](0x1f4,_0x5ed013['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 5998bb7..3141b8e 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 _0x80b3=['./plugin.events','save','remove','removeListener','length','plugin:'];(function(_0x5d9ceb,_0x1a49f5){var _0x33ce82=function(_0x583915){while(--_0x583915){_0x5d9ceb['push'](_0x5d9ceb['shift']());}};_0x33ce82(++_0x1a49f5);}(_0x80b3,0x138));var _0x380b=function(_0x24c4b5,_0x3528cc){_0x24c4b5=_0x24c4b5-0x0;var _0x2184f8=_0x80b3[_0x24c4b5];return _0x2184f8;};'use strict';var PluginEvents=require(_0x380b('0x0'));var events=[_0x380b('0x1'),_0x380b('0x2'),'update'];function createListener(_0x1479bb,_0x58e904){return function(_0x4f0bb1){_0x58e904['emit'](_0x1479bb,_0x4f0bb1);};}function removeListener(_0x5e7501,_0x52951c){return function(){PluginEvents[_0x380b('0x3')](_0x5e7501,_0x52951c);};}exports['register']=function(_0x15f7cf){for(var _0x2a033f=0x0,_0x3d22e7=events[_0x380b('0x4')];_0x2a033f<_0x3d22e7;_0x2a033f++){var _0xd0eaff=events[_0x2a033f];var _0x34a977=createListener(_0x380b('0x5')+_0xd0eaff,_0x15f7cf);PluginEvents['on'](_0xd0eaff,_0x34a977);}}; \ No newline at end of file +var _0xe4c4=['remove','emit','removeListener','register','length','plugin:','save'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0xe4c4,0x1f0));var _0x4e4c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0xe4c4[_0x819464];return _0x49dcc0;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x4e4c('0x0'),_0x4e4c('0x1'),'update'];function createListener(_0x1229c3,_0x458c33){return function(_0x55e8cc){_0x458c33[_0x4e4c('0x2')](_0x1229c3,_0x55e8cc);};}function removeListener(_0xd547c1,_0x467d7c){return function(){PluginEvents[_0x4e4c('0x3')](_0xd547c1,_0x467d7c);};}exports[_0x4e4c('0x4')]=function(_0x5cc93f){for(var _0xc1e696=0x0,_0x6436d1=events[_0x4e4c('0x5')];_0xc1e696<_0x6436d1;_0xc1e696++){var _0x93c0af=events[_0xc1e696];var _0xffdf6a=createListener(_0x4e4c('0x6')+_0x93c0af,_0x5cc93f);PluginEvents['on'](_0x93c0af,_0xffdf6a);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 4ca140e..e14b036 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(_0x5cf21a,_0x8aff91){var _0x2e8647=function(_0x35c70a){while(--_0x35c70a){_0x5cf21a['push'](_0x5cf21a['shift']());}};_0x2e8647(++_0x8aff91);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0xad92e1,_0x3cda67){var _0x41cc41=function(_0x1006be){while(--_0x1006be){_0xad92e1['push'](_0xad92e1['shift']());}};_0x41cc41(++_0x3cda67);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 87d8b5a..bdebf82 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 _0x0102=['length','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dump','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty','destroy','delete','../../config/pm2','../../config/logger','api','path','sendStatus','status','error','stack','name','send','npm\x20install','info','index','list','then','reject','express'];(function(_0x30407d,_0x2e1c35){var _0x3ffa6e=function(_0x2ee44b){while(--_0x2ee44b){_0x30407d['push'](_0x30407d['shift']());}};_0x3ffa6e(++_0x2e1c35);}(_0x0102,0x186));var _0x2010=function(_0x546ae2,_0x42a38a){_0x546ae2=_0x546ae2-0x0;var _0x1acfbb=_0x0102[_0x546ae2];return _0x1acfbb;};'use strict';var _=require('lodash');var pm2=require(_0x2010('0x0'));var logger=require(_0x2010('0x1'))(_0x2010('0x2'));var path=require(_0x2010('0x3'));var exec=require('child_process')['exec'];var BPromise=require('bluebird');function handleEntityNotFound(_0x4e30b3,_0x59082d){return function(_0x22e49f){if(!_0x22e49f){_0x4e30b3[_0x2010('0x4')](0x194);;}return _0x22e49f;};}function respondWithResult(_0x130725,_0x304264){_0x304264=_0x304264||0xc8;return function(_0x4eeb67){if(_0x4eeb67){return _0x130725[_0x2010('0x5')](_0x304264)['json'](_0x4eeb67);}return null;};}function handleError(_0x4728c0,_0x160e41){_0x160e41=_0x160e41||0x1f4;return function(_0x48dd91){logger[_0x2010('0x6')](_0x48dd91[_0x2010('0x7')]);if(_0x48dd91[_0x2010('0x8')]){delete _0x48dd91[_0x2010('0x8')];}_0x4728c0[_0x2010('0x5')](_0x160e41)[_0x2010('0x9')](_0x48dd91);};}function execChildProcess(){return new BPromise(function(_0x289ad4,_0x466c71){exec(_0x2010('0xa'),function(_0x39a821,_0x1d3b39,_0x32fe2e){logger[_0x2010('0xb')](_0x1d3b39);logger[_0x2010('0xb')](_0x32fe2e);if(_0x39a821){logger[_0x2010('0x6')](_0x39a821);return _0x466c71(_0x39a821);}return _0x289ad4(_0x1d3b39);});});}exports[_0x2010('0xc')]=function(_0x528a38,_0x579340){return pm2[_0x2010('0xd')]()[_0x2010('0xe')](function(_0x2e8ec2){if(_0x2e8ec2){var _0x10b587=_[_0x2010('0xf')](_0x2e8ec2,function(_0x335be4){return _0x335be4['name']===_0x2010('0x10')||_0x335be4[_0x2010('0x8')]==='motion2';});return{'rows':_0x10b587,'count':_0x10b587[_0x2010('0x11')]};}return null;})[_0x2010('0xe')](respondWithResult(_0x579340,null))[_0x2010('0x12')](handleError(_0x579340,null));};exports[_0x2010('0x13')]=function(_0x2d0bf2,_0x11bd28){return pm2[_0x2010('0x14')](_0x2d0bf2[_0x2010('0x15')]['id'])[_0x2010('0xe')](respondWithResult(_0x11bd28,null))['then'](handleEntityNotFound(_0x11bd28,null))['catch'](handleError(_0x11bd28,null));};exports[_0x2010('0x16')]=function(_0x38a15a,_0x3f9d62){if(_0x38a15a[_0x2010('0x17')]['name']&&_0x38a15a['body'][_0x2010('0x18')]){var _0x171e45=path[_0x2010('0x19')](__dirname,_0x2010('0x1a'),_0x38a15a[_0x2010('0x17')][_0x2010('0x18')]);var _0x4f621c=process[_0x2010('0x1b')]();process[_0x2010('0x1c')](path['dirname'](_0x171e45));return execChildProcess()['then'](function(_0x50aecc){process[_0x2010('0x1c')](_0x4f621c);return pm2['start']({'name':_0x38a15a[_0x2010('0x17')]['name'],'script':_0x171e45});})['then'](function(_0xdb57be){pm2[_0x2010('0x1d')]();return _0xdb57be[0x0];})['then'](respondWithResult(_0x3f9d62,0xc9))[_0x2010('0x12')](handleError(_0x3f9d62,null));}else{return _0x3f9d62['status'](0x1f4)[_0x2010('0x9')]({'message':_0x2010('0x1e')});}};exports[_0x2010('0x1f')]=function(_0x3dcea4,_0x3c5862){if(_0x3dcea4[_0x2010('0x17')]['id']){delete _0x3dcea4[_0x2010('0x17')]['id'];}var _0x3eb4dc={'online':_0x2010('0x20'),'stopped':_0x2010('0x21')};if(_0x3eb4dc[_0x2010('0x22')](_0x3dcea4[_0x2010('0x17')]['status'])){return pm2[_0x3eb4dc[_0x3dcea4[_0x2010('0x17')]['status']]](_0x3dcea4[_0x2010('0x15')]['id'])[_0x2010('0xe')](respondWithResult(_0x3c5862,0xc8))[_0x2010('0x12')](handleError(_0x3c5862,null));}else{return _0x3c5862[_0x2010('0x5')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports[_0x2010('0x23')]=function(_0x48d9f2,_0x2839f2){if(_0x48d9f2[_0x2010('0x17')]['id']){delete _0x48d9f2['body']['id'];}if(_0x48d9f2[_0x2010('0x15')]['id']){return pm2[_0x2010('0x24')](_0x48d9f2[_0x2010('0x15')]['id'])[_0x2010('0xe')](function(_0x692ddc){pm2['dump']();return _0x692ddc[0x0];})[_0x2010('0xe')](respondWithResult(_0x2839f2,null))[_0x2010('0x12')](handleError(_0x2839f2,null));}else{return _0x2839f2[_0x2010('0x5')](0x1f4)['send']({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0xa9e0=['list','then','reject','express','motion2','catch','describe','params','create','body','script','join','../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','child_process','bluebird','sendStatus','status','stack','name','send','info','error','index'];(function(_0x1ef210,_0x417516){var _0x53ae55=function(_0x373b51){while(--_0x373b51){_0x1ef210['push'](_0x1ef210['shift']());}};_0x53ae55(++_0x417516);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x0a9e('0x0'));var pm2=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var path=require('path');var exec=require(_0x0a9e('0x3'))['exec'];var BPromise=require(_0x0a9e('0x4'));function handleEntityNotFound(_0x432180,_0x2ab90b){return function(_0x991246){if(!_0x991246){_0x432180[_0x0a9e('0x5')](0x194);;}return _0x991246;};}function respondWithResult(_0x57b080,_0x219af0){_0x219af0=_0x219af0||0xc8;return function(_0x441e3a){if(_0x441e3a){return _0x57b080[_0x0a9e('0x6')](_0x219af0)['json'](_0x441e3a);}return null;};}function handleError(_0x503809,_0xe42b77){_0xe42b77=_0xe42b77||0x1f4;return function(_0x56465b){logger['error'](_0x56465b[_0x0a9e('0x7')]);if(_0x56465b[_0x0a9e('0x8')]){delete _0x56465b[_0x0a9e('0x8')];}_0x503809[_0x0a9e('0x6')](_0xe42b77)[_0x0a9e('0x9')](_0x56465b);};}function execChildProcess(){return new BPromise(function(_0xbd1168,_0x4a4c56){exec('npm\x20install',function(_0x527cdd,_0x4cfe67,_0x273d4d){logger[_0x0a9e('0xa')](_0x4cfe67);logger[_0x0a9e('0xa')](_0x273d4d);if(_0x527cdd){logger[_0x0a9e('0xb')](_0x527cdd);return _0x4a4c56(_0x527cdd);}return _0xbd1168(_0x4cfe67);});});}exports[_0x0a9e('0xc')]=function(_0x69aeb7,_0x5db4b0){return pm2[_0x0a9e('0xd')]()[_0x0a9e('0xe')](function(_0x2b4227){if(_0x2b4227){var _0x281129=_[_0x0a9e('0xf')](_0x2b4227,function(_0x4d5611){return _0x4d5611['name']===_0x0a9e('0x10')||_0x4d5611['name']===_0x0a9e('0x11');});return{'rows':_0x281129,'count':_0x281129['length']};}return null;})[_0x0a9e('0xe')](respondWithResult(_0x5db4b0,null))[_0x0a9e('0x12')](handleError(_0x5db4b0,null));};exports['show']=function(_0x225616,_0x5a0a06){return pm2[_0x0a9e('0x13')](_0x225616[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x5a0a06,null))[_0x0a9e('0xe')](handleEntityNotFound(_0x5a0a06,null))[_0x0a9e('0x12')](handleError(_0x5a0a06,null));};exports[_0x0a9e('0x15')]=function(_0x530eb7,_0x20559e){if(_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')]&&_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x17')]){var _0x4bb1e3=path[_0x0a9e('0x18')](__dirname,_0x0a9e('0x19'),_0x530eb7['body'][_0x0a9e('0x17')]);var _0x5a09ef=process['cwd']();process[_0x0a9e('0x1a')](path[_0x0a9e('0x1b')](_0x4bb1e3));return execChildProcess()[_0x0a9e('0xe')](function(_0x30bae6){process['chdir'](_0x5a09ef);return pm2[_0x0a9e('0x1c')]({'name':_0x530eb7[_0x0a9e('0x16')][_0x0a9e('0x8')],'script':_0x4bb1e3});})[_0x0a9e('0xe')](function(_0x370d86){pm2[_0x0a9e('0x1d')]();return _0x370d86[0x0];})[_0x0a9e('0xe')](respondWithResult(_0x20559e,0xc9))['catch'](handleError(_0x20559e,null));}else{return _0x20559e['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x1e')});}};exports[_0x0a9e('0x1f')]=function(_0x33161b,_0x526cf3){if(_0x33161b[_0x0a9e('0x16')]['id']){delete _0x33161b['body']['id'];}var _0x45a1e7={'online':'restart','stopped':_0x0a9e('0x20')};if(_0x45a1e7[_0x0a9e('0x21')](_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')])){return pm2[_0x45a1e7[_0x33161b[_0x0a9e('0x16')][_0x0a9e('0x6')]]](_0x33161b[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](respondWithResult(_0x526cf3,0xc8))['catch'](handleError(_0x526cf3,null));}else{return _0x526cf3[_0x0a9e('0x6')](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x22')});}};exports[_0x0a9e('0x23')]=function(_0x5c877d,_0x15b200){if(_0x5c877d[_0x0a9e('0x16')]['id']){delete _0x5c877d[_0x0a9e('0x16')]['id'];}if(_0x5c877d[_0x0a9e('0x14')]['id']){return pm2[_0x0a9e('0x24')](_0x5c877d[_0x0a9e('0x14')]['id'])[_0x0a9e('0xe')](function(_0x2e8759){pm2[_0x0a9e('0x1d')]();return _0x2e8759[0x0];})['then'](respondWithResult(_0x15b200,null))[_0x0a9e('0x12')](handleError(_0x15b200,null));}else{return _0x15b200['status'](0x1f4)[_0x0a9e('0x9')]({'message':_0x0a9e('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 0d40c48..8697eba 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 _0xf0fb=['exports','express','Router','../../components/auth/service','get','getAgents','/queues','isAuthenticated','getQueues'];(function(_0x36c894,_0x4bd853){var _0x13fd9c=function(_0x1da8c6){while(--_0x1da8c6){_0x36c894['push'](_0x36c894['shift']());}};_0x13fd9c(++_0x4bd853);}(_0xf0fb,0x13c));var _0xbf0f=function(_0x58b44a,_0x1a7aa6){_0x58b44a=_0x58b44a-0x0;var _0xd6779d=_0xf0fb[_0x58b44a];return _0xd6779d;};'use strict';var express=require(_0xbf0f('0x0'));var router=express[_0xbf0f('0x1')]();var auth=require(_0xbf0f('0x2'));var controller=require('./realtime.controller');router[_0xbf0f('0x3')]('/agents',auth['isAuthenticated'](),controller[_0xbf0f('0x4')]);router['get'](_0xbf0f('0x5'),auth[_0xbf0f('0x6')](),controller[_0xbf0f('0x7')]);module[_0xbf0f('0x8')]=router; \ No newline at end of file +var _0x0681=['getAgents','/queues','getQueues','express','Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated'];(function(_0x28fe94,_0x120b9b){var _0x3560da=function(_0x4d4e25){while(--_0x4d4e25){_0x28fe94['push'](_0x28fe94['shift']());}};_0x3560da(++_0x120b9b);}(_0x0681,0x16b));var _0x1068=function(_0xf4d05,_0x5e601f){_0xf4d05=_0xf4d05-0x0;var _0x47c971=_0x0681[_0xf4d05];return _0x47c971;};'use strict';var express=require(_0x1068('0x0'));var router=express[_0x1068('0x1')]();var auth=require(_0x1068('0x2'));var controller=require(_0x1068('0x3'));router[_0x1068('0x4')](_0x1068('0x5'),auth[_0x1068('0x6')](),controller[_0x1068('0x7')]);router['get'](_0x1068('0x8'),auth['isAuthenticated'](),controller[_0x1068('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 9a9445c..3d0a8e1 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 _0x22d3=['initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../errors/api','APIBadRequestError','undefined','limit','count','offset','status','set','Content-Range','json','getChannels','query','pauseTypeFilter','resolve','then','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','order','getAgentIdsByQueues','rows','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','push','sequelize','literal','FIELD(id,','forEach','*pause','Pause','where','user','userProfileId','Agents','omit','UserProfile','getResources','findAndCountAll','find','merge','getAgentStatus','pause','voice','voiceStatus','talking','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','Queue','name','outbound','dialActive','join','Queues','assign','getRealtimeQueues'];(function(_0x280c21,_0x2ad997){var _0x1897bb=function(_0x410f07){while(--_0x410f07){_0x280c21['push'](_0x280c21['shift']());}};_0x1897bb(++_0x2ad997);}(_0x22d3,0xa3));var _0x322d=function(_0x5400b,_0x55943a){_0x5400b=_0x5400b-0x0;var _0x36a39b=_0x22d3[_0x5400b];return _0x36a39b;};'use strict';var _=require('lodash');var util=require(_0x322d('0x0'));var rta=require(_0x322d('0x1'));var rtq=require(_0x322d('0x2'));var qs=require(_0x322d('0x3'));var utils=require(_0x322d('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x322d('0x5'))[_0x322d('0x6')];var APIHandleError=require(_0x322d('0x5'))['handleError'];function respondWithFilteredResult(_0x3fdb61,_0xcce6b5){return function(_0x110697){if(_0x110697){var _0x2a0e1b=typeof _0xcce6b5['offset']===_0x322d('0x7')&&typeof _0xcce6b5[_0x322d('0x8')]===_0x322d('0x7');var _0x4f5135=_0x110697[_0x322d('0x9')];var _0x15e7ee=_0x2a0e1b?0x0:_0xcce6b5['offset'];var _0x1cddc7=_0x2a0e1b?_0x110697[_0x322d('0x9')]:_0xcce6b5[_0x322d('0xa')]+_0xcce6b5[_0x322d('0x8')];var _0x5d540f;if(_0x1cddc7>=_0x4f5135){_0x1cddc7=_0x4f5135;_0x5d540f=0xc8;}else{_0x5d540f=0xce;}_0x3fdb61[_0x322d('0xb')](_0x5d540f);return _0x3fdb61[_0x322d('0xc')](_0x322d('0xd'),_0x15e7ee+'-'+_0x1cddc7+'/'+_0x4f5135)[_0x322d('0xe')](_0x110697);}return null;};}exports['getAgents']=function(_0x2fe8ed,_0x3e1c78){var _0x30614a={'count':0x0,'rows':[]};var _0x43ba18={};var _0x4d655d;var _0x1dfc7b=utils[_0x322d('0xf')]();var _0x39c1d7;var _0xc292c8;var _0x42211f=_0x2fe8ed['query']['globalQueueFilter'];var _0x52f200=_0x2fe8ed[_0x322d('0x10')]['globalStatusFilter'];var _0x172386=_0x2fe8ed[_0x322d('0x10')][_0x322d('0x11')];var _0x16b7f6=_0x52f200==='pause'||_0x52f200==='*pause'?!![]:![];var _0x312c4c=[];var _0x510c20;var _0x594734;Promise[_0x322d('0x12')]()[_0x322d('0x13')](function(){if(_0x2fe8ed[_0x322d('0x10')][_0x322d('0x14')]){if(!utils[_0x322d('0x15')](_0x2fe8ed['query'][_0x322d('0x14')])){throw new APIBadRequestError(util[_0x322d('0x16')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2fe8ed[_0x322d('0x10')]['channel']));}_0x4d655d=_0x2fe8ed[_0x322d('0x10')][_0x322d('0x14')][_0x322d('0x17')]();}if(!_0x2fe8ed['query'][_0x322d('0x18')]||!_0x2fe8ed[_0x322d('0x10')][_0x322d('0x18')][_0x322d('0x19')](_0x322d('0x1a'))){_0x2fe8ed[_0x322d('0x10')][_0x322d('0x18')]=rta[_0x322d('0x1b')](_0x2fe8ed['query'][_0x322d('0x18')]);return;}var _0x50e9f0=rta['getUpdatedSortOptions'](_0x2fe8ed['query'][_0x322d('0x18')]);_0x2fe8ed['query'][_0x322d('0x18')]=_0x50e9f0[_0x322d('0x1c')]['join'](',');_0x510c20=_0x50e9f0[_0x322d('0x1d')];})[_0x322d('0x13')](function(){if(!_0x42211f){return[];}return rta[_0x322d('0x1e')](_0x42211f,_0x4d655d);})[_0x322d('0x13')](function(_0x300728){_0x312c4c=_0x300728;return rta['getRealtimeAgents']();})[_0x322d('0x13')](function(_0x4c1a2b){_0xc292c8=_0x4c1a2b[_0x322d('0x1f')];if((!_0x52f200||_0x16b7f6)&&!_0x510c20){return _0x312c4c;}if(_0x510c20&&!_0x52f200){return rta['getSortedAgentsIdsByStatus'](_0xc292c8,_0x312c4c,_0x510c20);}else{return rta[_0x322d('0x20')](_0xc292c8,_0x312c4c,_0x52f200);}})[_0x322d('0x13')](function(_0x40a364){_0x312c4c=_0x40a364;var _0x262ae4=![];if(_0x312c4c[_0x322d('0x21')]===0x0){if(_0x42211f||_0x52f200){_0x262ae4=!![];}if(_0x16b7f6){_0x262ae4=![];}}if(_0x262ae4){return _0x30614a;}var _0x416452=_[_0x322d('0x22')](db[_0x322d('0x23')][_0x322d('0x24')],function(_0x5802d0){return{'name':_0x5802d0[_0x322d('0x25')],'type':_0x5802d0[_0x322d('0x26')][_0x322d('0x27')]};});_0x2fe8ed[_0x322d('0x10')][_0x322d('0x28')]=_0x322d('0x29');_0x43ba18=qs[_0x322d('0x2a')](_0x416452,_0x2fe8ed);_0x43ba18['raw']=!![];var _0x1ae2c3=[];if(_0x312c4c[_0x322d('0x21')]>0x0){_0x1ae2c3[_0x322d('0x2b')]({'id':{'$in':_0x312c4c}});if(_0x510c20&&!_0x52f200){_0x594734=[db[_0x322d('0x2c')][_0x322d('0x2d')](_0x322d('0x2e')+_0x312c4c+')')];_0x43ba18['order']=_0x594734;}}if(_0x16b7f6){_0x1dfc7b[_0x322d('0x2f')](function(_0x5806a8){var _0x3529d6=!![];if(_0x52f200===_0x322d('0x30')&&_0x4d655d!==_0x5806a8){_0x3529d6=![];}_0x1ae2c3[_0x322d('0x2b')]({[_0x5806a8+_0x322d('0x31')]:_0x3529d6});});if(_0x172386){_0x1ae2c3[_0x322d('0x2b')]({'pauseType':_0x172386});}}else if(_0x52f200){_0x1dfc7b[_0x322d('0x2f')](function(_0x4d3465){_0x1ae2c3[_0x322d('0x2b')]({[_0x4d3465+_0x322d('0x31')]:![]});});}_0x43ba18['where']=_['merge'](_0x43ba18[_0x322d('0x32')],{'$and':_0x1ae2c3});if(_0x2fe8ed[_0x322d('0x33')][_0x322d('0x28')]===_0x322d('0x33')){var _0x190240={'params':{'id':_0x2fe8ed[_0x322d('0x33')][_0x322d('0x34')]},'query':{'section':_0x322d('0x35'),'role':_0x322d('0x29'),'raw':!![],'ids':_0x312c4c,'customSorting':_0x594734}};if(_0x2fe8ed[_0x322d('0x10')]['online']){_0x190240[_0x322d('0x10')]['online']=!![];}if(_0x16b7f6){_0x190240['query']['extraQueryConditions']=_0x1ae2c3;}_0x190240[_0x322d('0x10')]=Object['assign'](_0x190240[_0x322d('0x10')],_[_0x322d('0x36')](_0x2fe8ed['query'],'id'));return db[_0x322d('0x37')][_0x322d('0x38')](_0x190240);}return db[_0x322d('0x23')][_0x322d('0x39')](_0x43ba18);})[_0x322d('0x13')](function(_0x26c54d){_0x30614a[_0x322d('0x9')]=_0x26c54d[_0x322d('0x9')];_0x39c1d7=_0x26c54d[_0x322d('0x1f')];return _0x39c1d7[_0x322d('0x22')](function(_0x2bb746){var _0x79a9f0=_[_0x322d('0x3a')](_0xc292c8,['id',_0x2bb746['id']]);if(_0x79a9f0){var _0x542e04=rta['filterAgentAttributes'](_0x79a9f0);_[_0x322d('0x3b')](_0x2bb746,_0x542e04);}_0x2bb746['globalStatus']=rta[_0x322d('0x3c')](_0x2bb746);if(_0x2bb746[_0x322d('0x1a')][_0x322d('0x19')](_0x322d('0x3d'))){_0x1dfc7b['forEach'](function(_0x5dcfdc){if(_0x2bb746[_0x5dcfdc+'Pause']){if(_0x5dcfdc===_0x322d('0x3e')){if(_0x2bb746[_0x322d('0x3f')]!==_0x322d('0x40')){_0x2bb746[_0x322d('0x3f')]=_0x322d('0x3d');}}else{_0x2bb746[_0x5dcfdc+'Status']=_0x322d('0x3d');}}});}return _0x2bb746;});})[_0x322d('0x13')](function(_0x349275){if(!_0x510c20||_0x594734){return _0x349275;}return rta[_0x322d('0x41')](_0x349275,_0x510c20);})['then'](function(_0x4da1d6){var _0x5b1bb0=rta[_0x322d('0x42')]();_0x30614a['rows']=_0x4da1d6[_0x322d('0x22')](function(_0x48ac11){return _[_0x322d('0x43')](_0x48ac11,_0x5b1bb0);});return _0x30614a;})[_0x322d('0x13')](respondWithFilteredResult(_0x3e1c78,_0x43ba18))[_0x322d('0x44')](APIHandleError(_0x3e1c78));};exports[_0x322d('0x45')]=function(_0x1424f3,_0x23fc64){var _0x539b5b={'count':0x0,'rows':[]};var _0x57a5d5={};var _0x369cbc;var _0x155b7e;var _0x2724ea;Promise[_0x322d('0x12')]()['then'](function(){if(_0x1424f3['query'][_0x322d('0x14')]){if(!utils[_0x322d('0x15')](_0x1424f3[_0x322d('0x10')][_0x322d('0x14')])){throw new APIBadRequestError(util[_0x322d('0x16')](_0x322d('0x46'),_0x1424f3[_0x322d('0x10')]['channel']));}_0x369cbc=_0x1424f3[_0x322d('0x10')]['channel'][_0x322d('0x17')]();}var _0x319f65=_[_0x322d('0x47')](_0x369cbc)+_0x322d('0x48');var _0x31c1b2=_[_0x322d('0x22')](db[_0x319f65][_0x322d('0x24')],function(_0x160e05){return{'name':_0x160e05[_0x322d('0x25')],'type':_0x160e05[_0x322d('0x26')][_0x322d('0x27')]};});if(!_0x1424f3[_0x322d('0x10')][_0x322d('0x1c')]){var _0x2ab1fc=['id',_0x322d('0x49')];if(_0x369cbc===_0x322d('0x3e')){_0x2ab1fc[_0x322d('0x2b')]('type');if(_0x1424f3['query'][_0x322d('0x26')]===_0x322d('0x4a')){_0x2ab1fc['push']([_0x322d('0x4b'),'dialMethod']);}}_0x1424f3[_0x322d('0x10')][_0x322d('0x1c')]=_0x2ab1fc[_0x322d('0x4c')](',');}_0x57a5d5=qs[_0x322d('0x2a')](_0x31c1b2,_0x1424f3);if(_0x1424f3[_0x322d('0x33')][_0x322d('0x28')]===_0x322d('0x33')){var _0x409034={'params':{'id':_0x1424f3[_0x322d('0x33')][_0x322d('0x34')]},'query':{'section':_0x369cbc==='voice'&&_0x1424f3[_0x322d('0x10')]['type']===_0x322d('0x4a')?'QueueCampaigns':_['startCase'](_0x369cbc)+_0x322d('0x4d'),'type':_0x1424f3['query'][_0x322d('0x26')],'nolimit':!![],'sort':_0x322d('0x49'),'filter':_0x1424f3[_0x322d('0x10')]['filter']}};_0x409034[_0x322d('0x10')]=Object[_0x322d('0x4e')](_0x409034['query'],_0x1424f3[_0x322d('0x10')]);delete _0x409034[_0x322d('0x10')]['id'];return db[_0x322d('0x37')][_0x322d('0x38')](_0x409034);}return db[_0x319f65][_0x322d('0x39')](_0x57a5d5);})[_0x322d('0x13')](function(_0x4b49ff){_0x539b5b[_0x322d('0x9')]=_0x4b49ff[_0x322d('0x9')];_0x155b7e=_0x4b49ff[_0x322d('0x1f')];return rtq[_0x322d('0x4f')](_0x1424f3,_0x369cbc);})[_0x322d('0x13')](function(_0x2969af){_0x2724ea=_0x2969af[_0x322d('0x1f')];return rtq[_0x322d('0x50')](_0x155b7e,_0x2724ea,_0x369cbc,_0x1424f3[_0x322d('0x10')][_0x322d('0x26')]);})[_0x322d('0x13')](function(_0x342b57){_0x539b5b['rows']=_0x342b57;return _0x539b5b;})['then'](respondWithFilteredResult(_0x23fc64,_0x57a5d5))[_0x322d('0x44')](APIHandleError(_0x23fc64));}; \ No newline at end of file +var _0x4473=['getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','getAgentIdsByStatus','User','rawAttributes','fieldName','key','role','agent','getOptions','raw','sequelize','literal','FIELD(id,','forEach','push','Pause','merge','user','userProfileId','online','extraQueryConditions','assign','omit','UserProfile','rows','find','getAgentStatus','globalStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','map','pick','catch','getQueues','Queue','type','name','outbound','dialActive','QueueCampaigns','filter','getResources','getRealtimeQueues','initializeQueues','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','validateSortParameter'];(function(_0x4ab3fb,_0x776775){var _0x34fe1e=function(_0x1c94c5){while(--_0x1c94c5){_0x4ab3fb['push'](_0x4ab3fb['shift']());}};_0x34fe1e(++_0x776775);}(_0x4473,0x1e3));var _0x3447=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x4473[_0x13b02f];return _0x12e9a6;};'use strict';var _=require('lodash');var util=require(_0x3447('0x0'));var rta=require(_0x3447('0x1'));var rtq=require(_0x3447('0x2'));var qs=require(_0x3447('0x3'));var utils=require(_0x3447('0x4'));var db=require(_0x3447('0x5'))['db'];var APIBadRequestError=require(_0x3447('0x6'))[_0x3447('0x7')];var APIHandleError=require(_0x3447('0x6'))[_0x3447('0x8')];function respondWithFilteredResult(_0x29221a,_0xd62d9){return function(_0x2cf581){if(_0x2cf581){var _0x55cdbf=typeof _0xd62d9[_0x3447('0x9')]===_0x3447('0xa')&&typeof _0xd62d9[_0x3447('0xb')]===_0x3447('0xa');var _0x411082=_0x2cf581[_0x3447('0xc')];var _0x3b3ceb=_0x55cdbf?0x0:_0xd62d9['offset'];var _0x52899=_0x55cdbf?_0x2cf581[_0x3447('0xc')]:_0xd62d9[_0x3447('0x9')]+_0xd62d9['limit'];var _0x5ab4a2;if(_0x52899>=_0x411082){_0x52899=_0x411082;_0x5ab4a2=0xc8;}else{_0x5ab4a2=0xce;}_0x29221a[_0x3447('0xd')](_0x5ab4a2);return _0x29221a[_0x3447('0xe')](_0x3447('0xf'),_0x3b3ceb+'-'+_0x52899+'/'+_0x411082)['json'](_0x2cf581);}return null;};}exports['getAgents']=function(_0x5370ae,_0x453baa){var _0x449edb={'count':0x0,'rows':[]};var _0x53e3da={};var _0x4e153f;var _0x80d821=utils[_0x3447('0x10')]();var _0x38ca10;var _0x5864ba;var _0x277ca3=_0x5370ae[_0x3447('0x11')][_0x3447('0x12')];var _0x3c3403=_0x5370ae['query'][_0x3447('0x13')];var _0x5f5bfe=_0x5370ae[_0x3447('0x11')][_0x3447('0x14')];var _0x11bc1c=_0x3c3403===_0x3447('0x15')||_0x3c3403===_0x3447('0x16')?!![]:![];var _0x43859e=[];var _0x1964cf;var _0x1e2737;Promise[_0x3447('0x17')]()[_0x3447('0x18')](function(){if(_0x5370ae[_0x3447('0x11')][_0x3447('0x19')]){if(!utils[_0x3447('0x1a')](_0x5370ae[_0x3447('0x11')][_0x3447('0x19')])){throw new APIBadRequestError(util[_0x3447('0x1b')](_0x3447('0x1c'),_0x5370ae[_0x3447('0x11')]['channel']));}_0x4e153f=_0x5370ae[_0x3447('0x11')]['channel'][_0x3447('0x1d')]();}if(!_0x5370ae['query']['sort']||!_0x5370ae[_0x3447('0x11')][_0x3447('0x1e')][_0x3447('0x1f')]('globalStatus')){_0x5370ae[_0x3447('0x11')][_0x3447('0x1e')]=rta[_0x3447('0x20')](_0x5370ae[_0x3447('0x11')][_0x3447('0x1e')]);return;}var _0x496079=rta[_0x3447('0x21')](_0x5370ae[_0x3447('0x11')][_0x3447('0x1e')]);_0x5370ae[_0x3447('0x11')][_0x3447('0x1e')]=_0x496079[_0x3447('0x22')]['join'](',');_0x1964cf=_0x496079[_0x3447('0x23')];})[_0x3447('0x18')](function(){if(!_0x277ca3){return[];}return rta[_0x3447('0x24')](_0x277ca3,_0x4e153f);})['then'](function(_0xfd3929){_0x43859e=_0xfd3929;return rta[_0x3447('0x25')]();})['then'](function(_0x2b8ecb){_0x5864ba=_0x2b8ecb['rows'];if((!_0x3c3403||_0x11bc1c)&&!_0x1964cf){return _0x43859e;}if(_0x1964cf&&!_0x3c3403){return rta[_0x3447('0x26')](_0x5864ba,_0x43859e,_0x1964cf);}else{return rta[_0x3447('0x27')](_0x5864ba,_0x43859e,_0x3c3403);}})[_0x3447('0x18')](function(_0x4098b0){_0x43859e=_0x4098b0;var _0x4c0490=![];if(_0x43859e['length']===0x0){if(_0x277ca3||_0x3c3403){_0x4c0490=!![];}if(_0x11bc1c){_0x4c0490=![];}}if(_0x4c0490){return _0x449edb;}var _0x50a7ca=_['map'](db[_0x3447('0x28')][_0x3447('0x29')],function(_0x517984){return{'name':_0x517984[_0x3447('0x2a')],'type':_0x517984['type'][_0x3447('0x2b')]};});_0x5370ae[_0x3447('0x11')][_0x3447('0x2c')]=_0x3447('0x2d');_0x53e3da=qs[_0x3447('0x2e')](_0x50a7ca,_0x5370ae);_0x53e3da[_0x3447('0x2f')]=!![];var _0x422431=[];if(_0x43859e['length']>0x0){_0x422431['push']({'id':{'$in':_0x43859e}});if(_0x1964cf&&!_0x3c3403){_0x1e2737=[db[_0x3447('0x30')][_0x3447('0x31')](_0x3447('0x32')+_0x43859e+')')];_0x53e3da[_0x3447('0x23')]=_0x1e2737;}}if(_0x11bc1c){_0x80d821[_0x3447('0x33')](function(_0x344566){var _0x3392a0=!![];if(_0x3c3403===_0x3447('0x16')&&_0x4e153f!==_0x344566){_0x3392a0=![];}_0x422431[_0x3447('0x34')]({[_0x344566+_0x3447('0x35')]:_0x3392a0});});if(_0x5f5bfe){_0x422431['push']({'pauseType':_0x5f5bfe});}}else if(_0x3c3403){_0x80d821[_0x3447('0x33')](function(_0x14c45d){_0x422431[_0x3447('0x34')]({[_0x14c45d+_0x3447('0x35')]:![]});});}_0x53e3da['where']=_[_0x3447('0x36')](_0x53e3da['where'],{'$and':_0x422431});if(_0x5370ae[_0x3447('0x37')][_0x3447('0x2c')]==='user'){var _0x2e9f89={'params':{'id':_0x5370ae[_0x3447('0x37')][_0x3447('0x38')]},'query':{'section':'Agents','role':_0x3447('0x2d'),'raw':!![],'ids':_0x43859e,'customSorting':_0x1e2737}};if(_0x5370ae[_0x3447('0x11')][_0x3447('0x39')]){_0x2e9f89[_0x3447('0x11')][_0x3447('0x39')]=!![];}if(_0x11bc1c){_0x2e9f89['query'][_0x3447('0x3a')]=_0x422431;}_0x2e9f89['query']=Object[_0x3447('0x3b')](_0x2e9f89[_0x3447('0x11')],_[_0x3447('0x3c')](_0x5370ae[_0x3447('0x11')],'id'));return db[_0x3447('0x3d')]['getResources'](_0x2e9f89);}return db[_0x3447('0x28')]['findAndCountAll'](_0x53e3da);})[_0x3447('0x18')](function(_0x45a9c9){_0x449edb[_0x3447('0xc')]=_0x45a9c9[_0x3447('0xc')];_0x38ca10=_0x45a9c9[_0x3447('0x3e')];return _0x38ca10['map'](function(_0x447fb6){var _0x57981a=_[_0x3447('0x3f')](_0x5864ba,['id',_0x447fb6['id']]);if(_0x57981a){var _0x1d7d9d=rta['filterAgentAttributes'](_0x57981a);_['merge'](_0x447fb6,_0x1d7d9d);}_0x447fb6['globalStatus']=rta[_0x3447('0x40')](_0x447fb6);if(_0x447fb6[_0x3447('0x41')]['includes'](_0x3447('0x15'))){_0x80d821[_0x3447('0x33')](function(_0x2d8d51){if(_0x447fb6[_0x2d8d51+_0x3447('0x35')]){if(_0x2d8d51===_0x3447('0x42')){if(_0x447fb6[_0x3447('0x43')]!==_0x3447('0x44')){_0x447fb6[_0x3447('0x43')]=_0x3447('0x15');}}else{_0x447fb6[_0x2d8d51+_0x3447('0x45')]='pause';}}});}return _0x447fb6;});})[_0x3447('0x18')](function(_0x19405d){if(!_0x1964cf||_0x1e2737){return _0x19405d;}return rta[_0x3447('0x46')](_0x19405d,_0x1964cf);})[_0x3447('0x18')](function(_0x4ef134){var _0x3b7d43=rta[_0x3447('0x47')]();_0x449edb[_0x3447('0x3e')]=_0x4ef134[_0x3447('0x48')](function(_0xf6fe24){return _[_0x3447('0x49')](_0xf6fe24,_0x3b7d43);});return _0x449edb;})[_0x3447('0x18')](respondWithFilteredResult(_0x453baa,_0x53e3da))[_0x3447('0x4a')](APIHandleError(_0x453baa));};exports[_0x3447('0x4b')]=function(_0x33d8f5,_0x1af58d){var _0x1cb8fb={'count':0x0,'rows':[]};var _0x3234a5={};var _0x2efd4b;var _0xb0a1c5;var _0x2e32ac;Promise['resolve']()[_0x3447('0x18')](function(){if(_0x33d8f5[_0x3447('0x11')][_0x3447('0x19')]){if(!utils[_0x3447('0x1a')](_0x33d8f5[_0x3447('0x11')][_0x3447('0x19')])){throw new APIBadRequestError(util['format'](_0x3447('0x1c'),_0x33d8f5[_0x3447('0x11')][_0x3447('0x19')]));}_0x2efd4b=_0x33d8f5['query'][_0x3447('0x19')][_0x3447('0x1d')]();}var _0x1343a2=_['startCase'](_0x2efd4b)+_0x3447('0x4c');var _0x4856f5=_['map'](db[_0x1343a2][_0x3447('0x29')],function(_0x4dd773){return{'name':_0x4dd773[_0x3447('0x2a')],'type':_0x4dd773[_0x3447('0x4d')]['key']};});if(!_0x33d8f5[_0x3447('0x11')][_0x3447('0x22')]){var _0x3ba40d=['id',_0x3447('0x4e')];if(_0x2efd4b===_0x3447('0x42')){_0x3ba40d[_0x3447('0x34')](_0x3447('0x4d'));if(_0x33d8f5['query'][_0x3447('0x4d')]===_0x3447('0x4f')){_0x3ba40d[_0x3447('0x34')]([_0x3447('0x50'),'dialMethod']);}}_0x33d8f5[_0x3447('0x11')]['fields']=_0x3ba40d['join'](',');}_0x3234a5=qs['getOptions'](_0x4856f5,_0x33d8f5);if(_0x33d8f5[_0x3447('0x37')][_0x3447('0x2c')]===_0x3447('0x37')){var _0xdcb37f={'params':{'id':_0x33d8f5[_0x3447('0x37')]['userProfileId']},'query':{'section':_0x2efd4b===_0x3447('0x42')&&_0x33d8f5[_0x3447('0x11')][_0x3447('0x4d')]==='outbound'?_0x3447('0x51'):_['startCase'](_0x2efd4b)+'Queues','type':_0x33d8f5[_0x3447('0x11')][_0x3447('0x4d')],'nolimit':!![],'sort':_0x3447('0x4e'),'filter':_0x33d8f5['query'][_0x3447('0x52')]}};_0xdcb37f[_0x3447('0x11')]=Object[_0x3447('0x3b')](_0xdcb37f[_0x3447('0x11')],_0x33d8f5[_0x3447('0x11')]);delete _0xdcb37f[_0x3447('0x11')]['id'];return db[_0x3447('0x3d')][_0x3447('0x53')](_0xdcb37f);}return db[_0x1343a2]['findAndCountAll'](_0x3234a5);})[_0x3447('0x18')](function(_0x167240){_0x1cb8fb[_0x3447('0xc')]=_0x167240[_0x3447('0xc')];_0xb0a1c5=_0x167240[_0x3447('0x3e')];return rtq[_0x3447('0x54')](_0x33d8f5,_0x2efd4b);})['then'](function(_0x576683){_0x2e32ac=_0x576683[_0x3447('0x3e')];return rtq[_0x3447('0x55')](_0xb0a1c5,_0x2e32ac,_0x2efd4b,_0x33d8f5[_0x3447('0x11')][_0x3447('0x4d')]);})[_0x3447('0x18')](function(_0x43068e){_0x1cb8fb['rows']=_0x43068e;return _0x1cb8fb;})[_0x3447('0x18')](respondWithFilteredResult(_0x1af58d,_0x3234a5))[_0x3447('0x4a')](APIHandleError(_0x1af58d));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 5abb66c..bf8c57a 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(_0x44dc73,_0xe28876){var _0x30639a=function(_0x406391){while(--_0x406391){_0x44dc73['push'](_0x44dc73['shift']());}};_0x30639a(++_0xe28876);}(_0xedd9,0xfc));var _0x9edd=function(_0x27db19,_0x41debc){_0x27db19=_0x27db19-0x0;var _0x437fa8=_0xedd9[_0x27db19];return _0x437fa8;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x310681,_0x5a352c){var _0x27dbab=function(_0x3cebb5){while(--_0x3cebb5){_0x310681['push'](_0x310681['shift']());}};_0x27dbab(++_0x5a352c);}(_0xe706,0xa3));var _0x6e70=function(_0x569744,_0x30c532){_0x569744=_0x569744-0x0;var _0x57e918=_0xe706[_0x569744];return _0x57e918;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 86c35b9..bf5d82f 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 _0x2e65=['INTEGER','STRING','DATE','sequelize','exports'];(function(_0x44c974,_0x1bcfde){var _0x5214c6=function(_0x10aad5){while(--_0x10aad5){_0x44c974['push'](_0x44c974['shift']());}};_0x5214c6(++_0x1bcfde);}(_0x2e65,0x193));var _0x52e6=function(_0x310504,_0x26ad95){_0x310504=_0x310504-0x0;var _0x5b36d0=_0x2e65[_0x310504];return _0x5b36d0;};'use strict';var Sequelize=require(_0x52e6('0x0'));module[_0x52e6('0x1')]={'state':{'type':Sequelize[_0x52e6('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x52e6('0x3')]},'scheduledat':{'type':Sequelize[_0x52e6('0x4')]},'uniqueid':{'type':Sequelize[_0x52e6('0x3')]},'starttime':{'type':Sequelize[_0x52e6('0x4')]},'responsetime':{'type':Sequelize[_0x52e6('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x52e6('0x3')]},'campaigntype':{'type':Sequelize[_0x52e6('0x3')]},'membername':{'type':Sequelize[_0x52e6('0x3')]}}; \ No newline at end of file +var _0x46e1=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x4d2cc0,_0x31ebfb){var _0x4110b8=function(_0x5e640c){while(--_0x5e640c){_0x4d2cc0['push'](_0x4d2cc0['shift']());}};_0x4110b8(++_0x31ebfb);}(_0x46e1,0x155));var _0x146e=function(_0x624894,_0x45d777){_0x624894=_0x624894-0x0;var _0x3e19ea=_0x46e1[_0x624894];return _0x3e19ea;};'use strict';var Sequelize=require(_0x146e('0x0'));module[_0x146e('0x1')]={'state':{'type':Sequelize[_0x146e('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x146e('0x3')]},'scheduledat':{'type':Sequelize[_0x146e('0x4')]},'uniqueid':{'type':Sequelize[_0x146e('0x3')]},'starttime':{'type':Sequelize[_0x146e('0x4')]},'responsetime':{'type':Sequelize[_0x146e('0x4')]},'ringtime':{'type':Sequelize[_0x146e('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x146e('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x146e('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index acf782c..af8a7f1 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 _0x723d=['moment','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','ReportAgentPreview','report_agent_preview','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x723d,0x15d));var _0xd723=function(_0x425561,_0x3a4598){_0x425561=_0x425561-0x0;var _0x303b28=_0x723d[_0x425561];return _0x303b28;};'use strict';var _=require('lodash');var util=require(_0xd723('0x0'));var logger=require(_0xd723('0x1'))(_0xd723('0x2'));var moment=require(_0xd723('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd723('0x4'));var rimraf=require(_0xd723('0x5'));var config=require(_0xd723('0x6'));var attributes=require(_0xd723('0x7'));module[_0xd723('0x8')]=function(_0x3a483e,_0xdb3e76){return _0x3a483e['define'](_0xd723('0x9'),attributes,{'tableName':_0xd723('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xea84=['lodash','util','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview','report_agent_preview'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xea84,0x118));var _0x4ea8=function(_0xbb8840,_0x3a33f2){_0xbb8840=_0xbb8840-0x0;var _0x10d8fd=_0xea84[_0xbb8840];return _0x10d8fd;};'use strict';var _=require(_0x4ea8('0x0'));var util=require(_0x4ea8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x4ea8('0x2'));var rp=require(_0x4ea8('0x3'));var fs=require('fs');var path=require(_0x4ea8('0x4'));var rimraf=require(_0x4ea8('0x5'));var config=require(_0x4ea8('0x6'));var attributes=require(_0x4ea8('0x7'));module['exports']=function(_0x15d91c,_0x3bd8ee){return _0x15d91c['define'](_0x4ea8('0x8'),attributes,{'tableName':_0x4ea8('0x9'),'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 cbfb229..e9b6d3f 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 _0xbacf=['rpc','../../config/environment','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateReportAgentPreview','ReportAgentPreview','create','options','raw','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a68c8,_0x19c1e9){var _0x408fd4=function(_0x4018bf){while(--_0x4018bf){_0x5a68c8['push'](_0x5a68c8['shift']());}};_0x408fd4(++_0x19c1e9);}(_0xbacf,0x1de));var _0xfbac=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0xbacf[_0x352d28];return _0x387d7e;};'use strict';var _=require('lodash');var util=require(_0xfbac('0x0'));var moment=require(_0xfbac('0x1'));var BPromise=require(_0xfbac('0x2'));var rs=require(_0xfbac('0x3'));var fs=require('fs');var Redis=require(_0xfbac('0x4'));var db=require(_0xfbac('0x5'))['db'];var utils=require(_0xfbac('0x6'));var logger=require(_0xfbac('0x7'))(_0xfbac('0x8'));var config=require(_0xfbac('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xfbac('0xa')][_0xfbac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x108129,_0x251da9,_0x4e92f9){return new BPromise(function(_0x28c7ab,_0x2ebafa){return client[_0xfbac('0xc')](_0x108129,_0x4e92f9)[_0xfbac('0xd')](function(_0x307ee7){logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x251da9,_0xfbac('0x10'));logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x251da9,_0xfbac('0x10'),JSON[_0xfbac('0x11')](_0x307ee7));if(_0x307ee7[_0xfbac('0x12')]){if(_0x307ee7[_0xfbac('0x12')]['code']===0x1f4){logger['error'](_0xfbac('0xf'),_0x251da9,_0x307ee7['error'][_0xfbac('0x13')]);return _0x2ebafa(_0x307ee7[_0xfbac('0x12')][_0xfbac('0x13')]);}logger[_0xfbac('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x251da9,_0x307ee7[_0xfbac('0x12')][_0xfbac('0x13')]);return _0x28c7ab(_0x307ee7[_0xfbac('0x12')]['message']);}else{logger[_0xfbac('0xe')](_0xfbac('0xf'),_0x251da9,_0xfbac('0x10'));_0x28c7ab(_0x307ee7[_0xfbac('0x14')][_0xfbac('0x13')]);}})['catch'](function(_0x479b58){logger[_0xfbac('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x251da9,_0x479b58);_0x2ebafa(_0x479b58);});});}exports[_0xfbac('0x15')]=function(_0x5ce971){var _0x2cacc6=this;return new Promise(function(_0x3ee68b,_0x29d43d){return db[_0xfbac('0x16')][_0xfbac('0x17')](_0x5ce971['body'],{'raw':_0x5ce971[_0xfbac('0x18')]?_0x5ce971[_0xfbac('0x18')][_0xfbac('0x19')]===undefined?!![]:![]:!![]})[_0xfbac('0xd')](function(_0x5d9616){logger[_0xfbac('0xe')](_0xfbac('0x15'),_0x5ce971);logger[_0xfbac('0x1a')](_0xfbac('0x15'),_0x5ce971,JSON['stringify'](_0x5d9616));_0x3ee68b(_0x5d9616);})['catch'](function(_0x24ab7c){logger['error']('CreateReportAgentPreview',_0x24ab7c['message'],_0x5ce971);_0x29d43d(_0x2cacc6[_0xfbac('0x12')](0x1f4,_0x24ab7c[_0xfbac('0x13')]));});});}; \ No newline at end of file +var _0x521a=['create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','catch','CreateReportAgentPreview','ReportAgentPreview'];(function(_0x2b0f81,_0x3917f0){var _0x5ce74c=function(_0x12dc0d){while(--_0x12dc0d){_0x2b0f81['push'](_0x2b0f81['shift']());}};_0x5ce74c(++_0x3917f0);}(_0x521a,0x95));var _0xa521=function(_0x46a81e,_0x28ca60){_0x46a81e=_0x46a81e-0x0;var _0x464725=_0x521a[_0x46a81e];return _0x464725;};'use strict';var _=require(_0xa521('0x0'));var util=require(_0xa521('0x1'));var moment=require(_0xa521('0x2'));var BPromise=require(_0xa521('0x3'));var rs=require(_0xa521('0x4'));var fs=require('fs');var Redis=require(_0xa521('0x5'));var db=require(_0xa521('0x6'))['db'];var utils=require(_0xa521('0x7'));var logger=require(_0xa521('0x8'))(_0xa521('0x9'));var config=require(_0xa521('0xa'));var jayson=require(_0xa521('0xb'));var client=jayson[_0xa521('0xc')][_0xa521('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x24a27,_0x563ffb,_0x1881c8){return new BPromise(function(_0x260f3a,_0x497dba){return client[_0xa521('0xe')](_0x24a27,_0x1881c8)['then'](function(_0x53715c){logger[_0xa521('0xf')](_0xa521('0x10'),_0x563ffb,'request\x20sent');logger[_0xa521('0x11')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x563ffb,_0xa521('0x12'),JSON[_0xa521('0x13')](_0x53715c));if(_0x53715c[_0xa521('0x14')]){if(_0x53715c[_0xa521('0x14')]['code']===0x1f4){logger[_0xa521('0x14')](_0xa521('0x10'),_0x563ffb,_0x53715c[_0xa521('0x14')][_0xa521('0x15')]);return _0x497dba(_0x53715c[_0xa521('0x14')][_0xa521('0x15')]);}logger[_0xa521('0x14')](_0xa521('0x10'),_0x563ffb,_0x53715c[_0xa521('0x14')][_0xa521('0x15')]);return _0x260f3a(_0x53715c['error'][_0xa521('0x15')]);}else{logger['info'](_0xa521('0x10'),_0x563ffb,_0xa521('0x12'));_0x260f3a(_0x53715c['result'][_0xa521('0x15')]);}})[_0xa521('0x16')](function(_0x1773ed){logger[_0xa521('0x14')]('ReportAgentPreview,\x20%s,\x20%s',_0x563ffb,_0x1773ed);_0x497dba(_0x1773ed);});});}exports[_0xa521('0x17')]=function(_0x55924b){var _0x117041=this;return new Promise(function(_0x5f2312,_0x4ecb41){return db[_0xa521('0x18')][_0xa521('0x19')](_0x55924b[_0xa521('0x1a')],{'raw':_0x55924b[_0xa521('0x1b')]?_0x55924b[_0xa521('0x1b')][_0xa521('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5c8cf8){logger[_0xa521('0xf')]('CreateReportAgentPreview',_0x55924b);logger['debug'](_0xa521('0x17'),_0x55924b,JSON[_0xa521('0x13')](_0x5c8cf8));_0x5f2312(_0x5c8cf8);})[_0xa521('0x16')](function(_0x2788bf){logger[_0xa521('0x14')](_0xa521('0x17'),_0x2788bf['message'],_0x55924b);_0x4ecb41(_0x117041[_0xa521('0x14')](0x1f4,_0x2788bf[_0xa521('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9a22cd2..f5c2b85 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 _0xf87a=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','express','Router','./rpc.controller','get','/voice/channels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailAccounts','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','faxQueues'];(function(_0x58e45a,_0x24915d){var _0x451162=function(_0x4efaf9){while(--_0x4efaf9){_0x58e45a['push'](_0x58e45a['shift']());}};_0x451162(++_0x24915d);}(_0xf87a,0x8b));var _0xaf87=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf87a[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var express=require(_0xaf87('0x0'));var router=express[_0xaf87('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xaf87('0x2'));router[_0xaf87('0x3')](_0xaf87('0x4'),auth['isAuthenticated'](),controller['voiceChannels']);router['get'](_0xaf87('0x5'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x7')]);router[_0xaf87('0x3')](_0xaf87('0x8'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x9')]);router['get'](_0xaf87('0xa'),auth[_0xaf87('0x6')](),controller[_0xaf87('0xb')]);router[_0xaf87('0x3')](_0xaf87('0xc'),auth[_0xaf87('0x6')](),controller[_0xaf87('0xd')]);router[_0xaf87('0x3')](_0xaf87('0xe'),auth[_0xaf87('0x6')](),controller['mailQueues']);router['get']('/mail/accounts',auth['isAuthenticated'](),controller[_0xaf87('0xf')]);router[_0xaf87('0x3')]('/openchannel/queues',auth[_0xaf87('0x6')](),controller[_0xaf87('0x10')]);router['get']('/sms/queues',auth['isAuthenticated'](),controller[_0xaf87('0x11')]);router[_0xaf87('0x3')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0xaf87('0x12')]);router[_0xaf87('0x3')](_0xaf87('0x13'),auth['isAuthenticated'](),controller[_0xaf87('0x14')]);router[_0xaf87('0x3')](_0xaf87('0x15'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x16')]);router[_0xaf87('0x3')]('/voice/queues/channels',auth[_0xaf87('0x6')](),controller['voiceQueuesChannels']);router[_0xaf87('0x3')](_0xaf87('0x17'),auth[_0xaf87('0x6')](),controller['voiceQueuesChannel']);router['get'](_0xaf87('0x18'),auth[_0xaf87('0x6')](),controller['voiceQueuesChannelHangup']);router['get'](_0xaf87('0x19'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x1a')]);router[_0xaf87('0x3')](_0xaf87('0x1b'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x1c')]);router[_0xaf87('0x1d')]('/voice/queues/:id',auth[_0xaf87('0x6')](),controller[_0xaf87('0x1e')]);router[_0xaf87('0x3')](_0xaf87('0x1f'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x20')]);router['get'](_0xaf87('0x21'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x22')]);router[_0xaf87('0x3')](_0xaf87('0x23'),auth['isAuthenticated'](),controller[_0xaf87('0x24')]);router['put'](_0xaf87('0x25'),auth['isAuthenticated'](),controller['agentCapacity']);router[_0xaf87('0x3')]('/telephones',auth['isAuthenticated'](),controller[_0xaf87('0x26')]);router[_0xaf87('0x3')]('/trunks',auth[_0xaf87('0x6')](),controller[_0xaf87('0x27')]);router[_0xaf87('0x3')](_0xaf87('0x28'),auth['isAuthenticated'](),controller[_0xaf87('0x29')]);router[_0xaf87('0x3')](_0xaf87('0x2a'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x2b')]);router[_0xaf87('0x3')](_0xaf87('0x2c'),auth['isAuthenticated'](),controller[_0xaf87('0x2d')]);router['get']('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0xaf87('0x2e')]);router[_0xaf87('0x3')](_0xaf87('0x2f'),auth[_0xaf87('0x6')](),controller['openchannelQueuesWaitingInteractions']);router['get'](_0xaf87('0x30'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x31')]);router[_0xaf87('0x3')](_0xaf87('0x32'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x33')]);router[_0xaf87('0x3')](_0xaf87('0x34'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x35')]);router[_0xaf87('0x3')](_0xaf87('0x36'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x37')]);router[_0xaf87('0x38')](_0xaf87('0x39'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')](_0xaf87('0x3b')));router['get'](_0xaf87('0x3c'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3d')]);router[_0xaf87('0x38')](_0xaf87('0x3e'),auth['isAuthenticated'](),controller['queueNotify'](_0xaf87('0x3f')));router['get'](_0xaf87('0x40'),auth['isAuthenticated'](),controller[_0xaf87('0x41')]);router[_0xaf87('0x38')](_0xaf87('0x42'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')](_0xaf87('0x43')));router[_0xaf87('0x3')]('/fax/queues/:id',auth[_0xaf87('0x6')](),controller[_0xaf87('0x44')]);router[_0xaf87('0x38')](_0xaf87('0x45'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')](_0xaf87('0x46')));router[_0xaf87('0x3')](_0xaf87('0x47'),auth['isAuthenticated'](),controller[_0xaf87('0x48')]);router[_0xaf87('0x38')]('/sms/queues/:id/notify',auth[_0xaf87('0x6')](),controller['queueNotify'](_0xaf87('0x49')));router[_0xaf87('0x38')](_0xaf87('0x4a'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x3a')]('whatsapp'));router[_0xaf87('0x3')](_0xaf87('0x4b'),auth[_0xaf87('0x6')](),controller[_0xaf87('0x4c')]);router[_0xaf87('0x3')](_0xaf87('0x4d'),auth[_0xaf87('0x6')](),controller['showWhatsappQueues']);router[_0xaf87('0x38')]('/agents/:id/notify',auth[_0xaf87('0x6')](),controller[_0xaf87('0x4e')]);module[_0xaf87('0x4f')]=router; \ No newline at end of file +var _0x5b57=['/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','/outbound/channels','/agents','agents','/agents/:id/capacity','/telephones','telephones','/trunks','/campaigns','campaigns','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','mail','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','path','express','Router','../../components/auth/service','/voice/channels','isAuthenticated','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','/openchannel/queues','openchannelQueues','smsQueues','/fax/queues','faxQueues','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel'];(function(_0x1b3f4d,_0x3877bf){var _0x4ce527=function(_0x2e0301){while(--_0x2e0301){_0x1b3f4d['push'](_0x1b3f4d['shift']());}};_0x4ce527(++_0x3877bf);}(_0x5b57,0x80));var _0x75b5=function(_0x3ac48b,_0x34c26e){_0x3ac48b=_0x3ac48b-0x0;var _0x2fab04=_0x5b57[_0x3ac48b];return _0x2fab04;};'use strict';var multer=require(_0x75b5('0x0'));var util=require('util');var path=require(_0x75b5('0x1'));var express=require(_0x75b5('0x2'));var router=express[_0x75b5('0x3')]();var auth=require(_0x75b5('0x4'));var controller=require('./rpc.controller');router['get'](_0x75b5('0x5'),auth[_0x75b5('0x6')](),controller['voiceChannels']);router[_0x75b5('0x7')](_0x75b5('0x8'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x9')]);router[_0x75b5('0x7')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x75b5('0x6')](),controller[_0x75b5('0xa')]);router[_0x75b5('0x7')](_0x75b5('0xb'),auth[_0x75b5('0x6')](),controller['voiceQueues']);router['get'](_0x75b5('0xc'),auth[_0x75b5('0x6')](),controller[_0x75b5('0xd')]);router[_0x75b5('0x7')](_0x75b5('0xe'),auth[_0x75b5('0x6')](),controller['mailQueues']);router[_0x75b5('0x7')]('/mail/accounts',auth[_0x75b5('0x6')](),controller['mailAccounts']);router[_0x75b5('0x7')](_0x75b5('0xf'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x10')]);router[_0x75b5('0x7')]('/sms/queues',auth[_0x75b5('0x6')](),controller[_0x75b5('0x11')]);router[_0x75b5('0x7')]('/whatsapp/queues',auth[_0x75b5('0x6')](),controller['whatsappQueues']);router[_0x75b5('0x7')](_0x75b5('0x12'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x13')]);router[_0x75b5('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x75b5('0x14'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x15')]);router[_0x75b5('0x7')](_0x75b5('0x16'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x17')]);router[_0x75b5('0x7')](_0x75b5('0x18'),auth[_0x75b5('0x6')](),controller['voiceQueuesChannelHangup']);router[_0x75b5('0x7')](_0x75b5('0x19'),auth['isAuthenticated'](),controller[_0x75b5('0x1a')]);router[_0x75b5('0x7')](_0x75b5('0x1b'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x1c')]);router[_0x75b5('0x1d')]('/voice/queues/:id',auth[_0x75b5('0x6')](),controller[_0x75b5('0x1e')]);router[_0x75b5('0x7')](_0x75b5('0x1f'),auth[_0x75b5('0x6')](),controller['outbound']);router[_0x75b5('0x7')](_0x75b5('0x20'),auth[_0x75b5('0x6')](),controller['outboundChannels']);router[_0x75b5('0x7')](_0x75b5('0x21'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x22')]);router[_0x75b5('0x1d')](_0x75b5('0x23'),auth[_0x75b5('0x6')](),controller['agentCapacity']);router[_0x75b5('0x7')](_0x75b5('0x24'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x25')]);router[_0x75b5('0x7')](_0x75b5('0x26'),auth[_0x75b5('0x6')](),controller['trunks']);router[_0x75b5('0x7')](_0x75b5('0x27'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x28')]);router[_0x75b5('0x7')]('/fax/accounts',auth[_0x75b5('0x6')](),controller['faxAccounts']);router[_0x75b5('0x7')](_0x75b5('0x29'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x2a')]);router['get'](_0x75b5('0x2b'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x2c')]);router[_0x75b5('0x7')](_0x75b5('0x2d'),auth[_0x75b5('0x6')](),controller['openchannelQueuesWaitingInteractions']);router[_0x75b5('0x7')]('/openchannel/queues/:id/waitinginteractions',auth['isAuthenticated'](),controller[_0x75b5('0x2e')]);router['get'](_0x75b5('0x2f'),auth['isAuthenticated'](),controller['smsQueuesWaitingInteractions']);router['get'](_0x75b5('0x30'),auth['isAuthenticated'](),controller['whatsappQueuesWaitingInteractions']);router[_0x75b5('0x7')](_0x75b5('0x31'),auth['isAuthenticated'](),controller[_0x75b5('0x32')]);router[_0x75b5('0x33')](_0x75b5('0x34'),auth[_0x75b5('0x6')](),controller['queueNotify'](_0x75b5('0x35')));router[_0x75b5('0x7')](_0x75b5('0x36'),auth[_0x75b5('0x6')](),controller['showMailQueues']);router[_0x75b5('0x33')](_0x75b5('0x37'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x38')](_0x75b5('0x39')));router[_0x75b5('0x7')](_0x75b5('0x3a'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x3b')]);router[_0x75b5('0x33')](_0x75b5('0x3c'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x38')](_0x75b5('0x3d')));router[_0x75b5('0x7')](_0x75b5('0x3e'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x3f')]);router[_0x75b5('0x33')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x75b5('0x38')](_0x75b5('0x40')));router[_0x75b5('0x7')](_0x75b5('0x41'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x42')]);router['post'](_0x75b5('0x43'),auth[_0x75b5('0x6')](),controller['queueNotify'](_0x75b5('0x44')));router[_0x75b5('0x33')]('/whatsapp/queues/:id/notify',auth['isAuthenticated'](),controller[_0x75b5('0x38')](_0x75b5('0x45')));router['get'](_0x75b5('0x46'),auth['isAuthenticated'](),controller[_0x75b5('0x47')]);router['get'](_0x75b5('0x48'),auth['isAuthenticated'](),controller[_0x75b5('0x49')]);router[_0x75b5('0x33')](_0x75b5('0x4a'),auth[_0x75b5('0x6')](),controller[_0x75b5('0x4b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 0fa7120..485d206 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 _0xe706=['indexOf','queue_id','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','Website','Queue','\x20Queue\x20not\x20found','Message','findOne','Interaction','Account','update','queue','MessageId','InteractionId','TransferReport','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','chat','User','Agent\x20not\x20found','messageId','\x20Message\x20not\x20found','From','create','Start','agentTransferTimeout','bluebird','moment','lodash','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','name','send','isNil','rows','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','user','hasOwnProperty','MemberReport','findAll','INTERACTION','interaction','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','SIP/%s','interface','agent','internal','capacity','Telephones','trunks','Trunks','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','OpenchannelQueues','showOpenchannelQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','uniq'];(function(_0x7ea75c,_0x309442){var _0x46c5e5=function(_0x572626){while(--_0x572626){_0x7ea75c['push'](_0x7ea75c['shift']());}};_0x46c5e5(++_0x309442);}(_0xe706,0xa3));var _0x6e70=function(_0x350258,_0x4e0a50){_0x350258=_0x350258-0x0;var _0x3714b3=_0xe706[_0x350258];return _0x3714b3;};'use strict';var BPromise=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));var _=require(_0x6e70('0x2'));var util=require('util');var db=require(_0x6e70('0x3'))['db'];var logger=require(_0x6e70('0x4'))(_0x6e70('0x5'));var jayson=require(_0x6e70('0x6'));var amiClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232a});var mailClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232b});var routingClient=jayson[_0x6e70('0x7')][_0x6e70('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){var _0x449b48=_0x45a2d4?_0x45a2d4:amiClient;return _0x449b48[_0x6e70('0x9')](_0x36357b,_0x293ce7)[_0x6e70('0xa')](function(_0x100eb7){if(_0x100eb7[_0x6e70('0xb')]){if(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xc')]===0x1f4){return _0x3c4843(_0x100eb7[_0x6e70('0xb')][_0x6e70('0xd')]);}return _0x188ed3(_0x100eb7['error']['message']);}else{_0x188ed3(_0x100eb7[_0x6e70('0xe')]);}})[_0x6e70('0xf')](function(_0x18cf27){_0x3c4843(_0x18cf27);});});}function respondWithResult(_0x27dd9b,_0x3b38f3){_0x3b38f3=_0x3b38f3||0xc8;return function(_0x310eb7){if(_0x310eb7){return _0x27dd9b[_0x6e70('0x10')](_0x3b38f3)[_0x6e70('0x11')](_0x310eb7);}return _0x27dd9b['sendStatus'](0x194);};}function handleError(_0x52737e,_0x48bc72){_0x48bc72=_0x48bc72||0x1f4;return function(_0x257e81){logger['error'](_0x257e81['stack']);if(_0x257e81[_0x6e70('0x12')]){delete _0x257e81[_0x6e70('0x12')];}_0x52737e['status'](_0x48bc72)[_0x6e70('0x13')](_0x257e81);};}function findById(_0x5c3fe7){return function(_0x2efc0f){if(!_[_0x6e70('0x14')](_0x5c3fe7)&&!_['isNil'](_0x2efc0f)&&!_['isNil'](_0x2efc0f[_0x6e70('0x15')])){return _['find'](_0x2efc0f[_0x6e70('0x15')],function(_0x173afe){return _0x173afe['id']==_0x5c3fe7;});}return null;};}exports['voiceChannels']=function(_0x497d61,_0xc238ba){return respondWithRpcPromise(_0x6e70('0x16'),_0x497d61[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0xc238ba,null))[_0x6e70('0xf')](handleError(_0xc238ba,null));};exports[_0x6e70('0x18')]=function(_0x1b2453,_0x44a49f){return respondWithRpcPromise(_0x6e70('0x19'),_[_0x6e70('0x1a')](_0x1b2453['query'],_0x1b2453[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x44a49f,null))[_0x6e70('0xf')](handleError(_0x44a49f,null));};exports['voiceChannelStopMixMonitor']=function(_0x3ccd87,_0xa5d49){return respondWithRpcPromise(_0x6e70('0x1c'),_['merge'](_0x3ccd87[_0x6e70('0x17')],_0x3ccd87['params']))['then'](respondWithResult(_0xa5d49,null))['catch'](handleError(_0xa5d49,null));};exports[_0x6e70('0x1d')]=function(_0x19c5ae,_0x51d292){return respondWithRpcPromise(_0x6e70('0x1e'),_0x19c5ae[_0x6e70('0x17')])['then'](respondWithResult(_0x51d292,null))[_0x6e70('0xf')](handleError(_0x51d292,null));};exports[_0x6e70('0x1f')]=function(_0x2bb231,_0x4a67ac){return respondWithRpcPromise('VoiceQueues',_0x2bb231[_0x6e70('0x17')])[_0x6e70('0xa')](findById(_0x2bb231[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4a67ac,null))[_0x6e70('0xf')](handleError(_0x4a67ac,null));};exports['updateVoiceQueue']=function(_0x1952ea,_0x406f29){return respondWithRpcPromise(_0x6e70('0x20'),_[_0x6e70('0x1a')](_0x1952ea[_0x6e70('0x21')],_0x1952ea[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x406f29,null))[_0x6e70('0xf')](handleError(_0x406f29,null));};exports[_0x6e70('0x22')]=function(_0x3a5d30,_0x4b1229){return respondWithRpcPromise(_0x6e70('0x23'),_['merge'](_0x3a5d30[_0x6e70('0x17')],_0x3a5d30['params']))[_0x6e70('0xa')](respondWithResult(_0x4b1229,null))[_0x6e70('0xf')](handleError(_0x4b1229,null));};exports[_0x6e70('0x24')]=function(_0x56f6f7,_0x38c40d){return respondWithRpcPromise(_0x6e70('0x25'),_0x56f6f7['query'])[_0x6e70('0xa')](respondWithResult(_0x38c40d,null))[_0x6e70('0xf')](handleError(_0x38c40d,null));};exports['voiceQueuesChannel']=function(_0x10d8f6,_0x3665a1){return respondWithRpcPromise(_0x6e70('0x26'),_[_0x6e70('0x1a')](_0x10d8f6[_0x6e70('0x17')],_0x10d8f6[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x3665a1,null))[_0x6e70('0xf')](handleError(_0x3665a1,null));};exports[_0x6e70('0x27')]=function(_0x419a41,_0x4d32d8){return respondWithRpcPromise(_0x6e70('0x28'),_['merge'](_0x419a41[_0x6e70('0x17')],_0x419a41[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x4d32d8,null))[_0x6e70('0xf')](handleError(_0x4d32d8,null));};exports[_0x6e70('0x29')]=function(_0x989b80,_0x2440be){return respondWithRpcPromise(_0x6e70('0x2a'),_[_0x6e70('0x1a')](_0x989b80[_0x6e70('0x17')],_0x989b80[_0x6e70('0x1b')]))[_0x6e70('0xa')](respondWithResult(_0x2440be,null))[_0x6e70('0xf')](handleError(_0x2440be,null));};exports['outbound']=function(_0x5446a2,_0x5424eb){return respondWithRpcPromise(_0x6e70('0x2b'),_0x5446a2[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x5424eb,null))[_0x6e70('0xf')](handleError(_0x5424eb,null));};exports[_0x6e70('0x2c')]=function(_0x3bdd87,_0x572a71){return respondWithRpcPromise(_0x6e70('0x2d'),_0x3bdd87[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x572a71,null))[_0x6e70('0xf')](handleError(_0x572a71,null));};exports[_0x6e70('0x2e')]=function(_0x37bf46,_0x246e61){var _0x16fc7d;return respondWithRpcPromise('Agents',_0x37bf46[_0x6e70('0x17')])[_0x6e70('0xa')](function(_0x22fce9){_0x16fc7d=_0x22fce9;return respondWithRpcPromise(_0x6e70('0x2f'),_0x37bf46[_0x6e70('0x17')],routingClient);})[_0x6e70('0xa')](function(_0x21b0e7){return _['merge']({},_0x21b0e7,_0x16fc7d);})['then'](respondWithResult(_0x246e61,null))['catch'](handleError(_0x246e61,null));};exports[_0x6e70('0x30')]=function(_0x2b63cc,_0x83847b){if(_0x2b63cc[_0x6e70('0x21')]&&_0x2b63cc[_0x6e70('0x21')]['interaction']&&_0x2b63cc[_0x6e70('0x31')]&&_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]){for(var _0x52b197 in _0x2b63cc['body']['interaction']){if(_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x6e70('0x32')](_0x52b197)){db[_0x6e70('0x33')][_0x6e70('0x34')]({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'exitAt':null,'uniqueid':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]&&_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')]?{'$notIn':_0x2b63cc['body'][_0x6e70('0x36')][_0x52b197]}:{'$ne':null}}})[_0x6e70('0xa')](function(_0x3d39c3){var _0xac87d6=moment()[_0x6e70('0x38')](_0x6e70('0x39'));for(var _0x3d9c5=0x0,_0x552e7e=_0x3d39c3[_0x6e70('0x37')];_0x3d9c5<_0x552e7e;_0x3d9c5+=0x1){_0x3d39c3[_0x3d9c5][_0x6e70('0x3a')]({'exitAt':_0xac87d6});}});for(var _0x10de2a=0x0;_0x10de2a<_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x36')][_0x52b197][_0x6e70('0x37')];_0x10de2a+=0x1){db[_0x6e70('0x33')]['findOrCreate']({'where':{'channel':_0x52b197,'membername':_0x2b63cc[_0x6e70('0x31')]['name'],'type':_0x6e70('0x35'),'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a],'exitAt':null},'defaults':{'channel':_0x52b197,'membername':_0x2b63cc['user'][_0x6e70('0x12')],'interface':_[_0x6e70('0x14')](_0x2b63cc[_0x6e70('0x31')]['interface'])?util['format'](_0x6e70('0x3b'),_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x12')]):_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3c')],'type':_0x6e70('0x35'),'enterAt':moment()['format'](_0x6e70('0x39')),'role':_0x6e70('0x3d'),'internal':_0x2b63cc[_0x6e70('0x31')][_0x6e70('0x3e')],'uniqueid':_0x2b63cc[_0x6e70('0x21')]['interaction'][_0x52b197][_0x10de2a]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x2b63cc[_0x6e70('0x1b')]['id'],'capacity':_0x2b63cc[_0x6e70('0x21')][_0x6e70('0x3f')]},routingClient)[_0x6e70('0xa')](respondWithResult(_0x83847b,null))[_0x6e70('0xf')](handleError(_0x83847b,null));};exports['telephones']=function(_0x41bd0b,_0x232366){return respondWithRpcPromise(_0x6e70('0x40'),_0x41bd0b[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x232366,null))['catch'](handleError(_0x232366,null));};exports[_0x6e70('0x41')]=function(_0x1dd242,_0x2c20d3){return respondWithRpcPromise(_0x6e70('0x42'),_0x1dd242[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x2c20d3,null))['catch'](handleError(_0x2c20d3,null));};exports[_0x6e70('0x43')]=function(_0x8d425d,_0x5c2396){return respondWithRpcPromise(_0x6e70('0x44'),_0x8d425d[_0x6e70('0x17')])['then'](respondWithResult(_0x5c2396,null))[_0x6e70('0xf')](handleError(_0x5c2396,null));};exports[_0x6e70('0x45')]=function(_0x2134c4,_0x46d536){return respondWithRpcPromise(_0x6e70('0x46'),_0x2134c4['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x46d536,null))[_0x6e70('0xf')](handleError(_0x46d536,null));};exports[_0x6e70('0x47')]=function(_0x13be81,_0x1c02d7){return respondWithRpcPromise(_0x6e70('0x46'),_0x13be81[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x13be81[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x1c02d7,null))[_0x6e70('0xf')](handleError(_0x1c02d7,null));};exports[_0x6e70('0x48')]=function(_0xb8f78,_0x1fd9a6){return respondWithRpcPromise(_0x6e70('0x49'),_0xb8f78[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x1fd9a6,null))[_0x6e70('0xf')](handleError(_0x1fd9a6,null));};exports[_0x6e70('0x4a')]=function(_0x1c7dca,_0x4c6aab){return respondWithRpcPromise(_0x6e70('0x49'),_0x1c7dca[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x1c7dca[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x4c6aab,null))[_0x6e70('0xf')](handleError(_0x4c6aab,null));};exports['mailAccounts']=function(_0x42bd85,_0x6cabf0){return respondWithRpcPromise('MailAccounts',_0x42bd85[_0x6e70('0x17')],mailClient)[_0x6e70('0xa')](respondWithResult(_0x6cabf0,null))[_0x6e70('0xf')](handleError(_0x6cabf0,null));};exports['openchannelQueues']=function(_0x51f268,_0x2f9be4){return respondWithRpcPromise(_0x6e70('0x4b'),_0x51f268[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2f9be4,null))[_0x6e70('0xf')](handleError(_0x2f9be4,null));};exports[_0x6e70('0x4c')]=function(_0x30cd88,_0x57bfe5){return respondWithRpcPromise('OpenchannelQueues',_0x30cd88[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x30cd88[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x57bfe5,null))['catch'](handleError(_0x57bfe5,null));};exports['smsQueues']=function(_0x2e972b,_0x4e5545){return respondWithRpcPromise('SmsQueues',_0x2e972b['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x4e5545,null))['catch'](handleError(_0x4e5545,null));};exports[_0x6e70('0x4d')]=function(_0x23900b,_0x3b4da0){return respondWithRpcPromise(_0x6e70('0x4e'),_0x23900b[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](findById(_0x23900b[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0x3b4da0,null))['catch'](handleError(_0x3b4da0,null));};exports[_0x6e70('0x4f')]=function(_0x6a560f,_0x22c836){return respondWithRpcPromise(_0x6e70('0x50'),_0x6a560f[_0x6e70('0x17')],routingClient)['then'](respondWithResult(_0x22c836,null))['catch'](handleError(_0x22c836,null));};exports['showWhatsappQueues']=function(_0x1bb338,_0xd91b9){return respondWithRpcPromise(_0x6e70('0x50'),_0x1bb338['query'],routingClient)['then'](findById(_0x1bb338[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xd91b9,null))[_0x6e70('0xf')](handleError(_0xd91b9,null));};exports[_0x6e70('0x51')]=function(_0x2285f1,_0x32b884){return respondWithRpcPromise('FaxQueues',_0x2285f1[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x32b884,null))[_0x6e70('0xf')](handleError(_0x32b884,null));};exports[_0x6e70('0x52')]=function(_0x515c0c,_0xce964b){return respondWithRpcPromise('FaxQueues',_0x515c0c['query'],routingClient)[_0x6e70('0xa')](findById(_0x515c0c[_0x6e70('0x1b')]['id']))[_0x6e70('0xa')](respondWithResult(_0xce964b,null))[_0x6e70('0xf')](handleError(_0xce964b,null));};exports[_0x6e70('0x53')]=function(_0x2be0fc,_0x4b5b19){return respondWithRpcPromise(_0x6e70('0x54'),_0x2be0fc[_0x6e70('0x17')])[_0x6e70('0xa')](respondWithResult(_0x4b5b19,null))[_0x6e70('0xf')](handleError(_0x4b5b19,null));};exports[_0x6e70('0x55')]=function(_0x13c092,_0x363722){return respondWithRpcPromise(_0x6e70('0x56'),_0x13c092[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x363722,null))['catch'](handleError(_0x363722,null));};exports[_0x6e70('0x57')]=function(_0x303c5a,_0x577c3b){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x303c5a['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x577c3b,null))[_0x6e70('0xf')](handleError(_0x577c3b,null));};exports[_0x6e70('0x58')]=function(_0x14bb74,_0x5a3dcb){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x14bb74['query'],routingClient)[_0x6e70('0xa')](respondWithResult(_0x5a3dcb,null))[_0x6e70('0xf')](handleError(_0x5a3dcb,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x58666a,_0x1c7c5f){return respondWithRpcPromise(_0x6e70('0x59'),_0x58666a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](function(_0x44bf96){if(_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')]!==undefined){var _0x3650e9=_(_0x44bf96[_0x6e70('0x15')])[_0x6e70('0x5b')]([_0x58666a[_0x6e70('0x17')][_0x6e70('0x5a')],_0x58666a[_0x6e70('0x1b')]['id']])['map']('queue_id')[_0x6e70('0x5c')]()['value']();return _0x44bf96[_0x6e70('0x15')]['filter'](function(_0x5b5471){return _0x3650e9[_0x6e70('0x5d')](_0x5b5471['queue_id'])>-0x1;});}else{return _0x44bf96['rows'][_0x6e70('0x5b')](function(_0x21e4c2){return _0x21e4c2[_0x6e70('0x5e')]===parseInt(_0x58666a['params']['id']);});}})['then'](respondWithResult(_0x1c7c5f,null))['catch'](handleError(_0x1c7c5f,null));};exports[_0x6e70('0x5f')]=function(_0x512b0a,_0x2e8ed3){return respondWithRpcPromise(_0x6e70('0x60'),_0x512b0a[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x2e8ed3,null))[_0x6e70('0xf')](handleError(_0x2e8ed3,null));};exports[_0x6e70('0x61')]=function(_0x214a8f,_0x50046a){return respondWithRpcPromise(_0x6e70('0x62'),_0x214a8f[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x50046a,null))['catch'](handleError(_0x50046a,null));};exports[_0x6e70('0x63')]=function(_0x227d94,_0x11a615){return respondWithRpcPromise(_0x6e70('0x64'),_0x227d94[_0x6e70('0x17')],routingClient)[_0x6e70('0xa')](respondWithResult(_0x11a615,null))[_0x6e70('0xf')](handleError(_0x11a615,null));};exports[_0x6e70('0x65')]=function(_0x461ec0){return function(_0x48f6fd,_0x463eed){var _0x39e6db,_0x53acc8;var _0x252f07=_[_0x6e70('0x66')](_0x461ec0);var _0x51be27=_0x461ec0==='chat'?_0x6e70('0x67'):'Account';return db[_0x252f07+_0x6e70('0x68')]['findOne']({'raw':!![],'where':{'id':_0x48f6fd[_0x6e70('0x1b')]['id']}})[_0x6e70('0xa')](function(_0x106f32){if(_[_0x6e70('0x14')](_0x106f32)){throw new Error(_0x252f07+_0x6e70('0x69'));}_0x39e6db=_0x106f32;return db[_0x252f07+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x48f6fd['body']['messageId']},'include':[{'model':db[_0x252f07+_0x6e70('0x6c')],'as':'Interaction'},{'model':db[_0x252f07+_0x51be27],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x28e5b1){if(_[_0x6e70('0x14')](_0x28e5b1)){throw new Error(_0x252f07+'\x20Message\x20not\x20found');}_0x53acc8=_0x28e5b1;return _0x28e5b1[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x260dfa={'uniqueid':_0x461ec0+'.'+_0x53acc8['id']+'.'+_0x53acc8[_0x6e70('0x6c')]['id'],'FromUserId':_0x48f6fd[_0x6e70('0x31')]['id'],'type':_0x6e70('0x6f')};_0x260dfa[_0x252f07+_0x6e70('0x70')]=_0x53acc8['id'];_0x260dfa[_0x252f07+_0x6e70('0x71')]=_0x53acc8[_0x6e70('0x6c')]['id'];_0x260dfa['From'+_0x252f07+_0x51be27+'Id']=_0x53acc8[_0x6e70('0x6d')]['id'];_0x260dfa['To'+_0x252f07+'QueueId']=_0x39e6db['id'];return db[_0x252f07+_0x6e70('0x72')]['create'](_0x260dfa);})['then'](function(){return respondWithRpcPromise('Start',{'channel':_0x461ec0,'interaction':_0x53acc8[_0x6e70('0x6c')],'message':_0x53acc8,'account':_0x53acc8[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x6f'),'appdata':_0x39e6db[_0x6e70('0x12')]+','+(_0x53acc8[_0x6e70('0x6d')]['queueTransferTimeout']||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})[_0x6e70('0xa')](respondWithResult(_0x463eed,null))['catch'](handleError(_0x463eed,null));};};exports[_0x6e70('0x74')]=function(_0x50e494,_0x17d3a4){var _0x5d0585,_0x4a87e2;if(_[_0x6e70('0x14')](_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')])){throw new Error(_0x6e70('0x76'));}var _0x3e6661=_0x50e494[_0x6e70('0x21')][_0x6e70('0x75')];var _0x5c0276=_[_0x6e70('0x66')](_0x3e6661);var _0x4f4a16=_0x3e6661===_0x6e70('0x77')?_0x6e70('0x67'):_0x6e70('0x6d');return db[_0x6e70('0x78')][_0x6e70('0x6b')]({'raw':!![],'where':{'id':_0x50e494[_0x6e70('0x1b')]['id'],'role':_0x6e70('0x3d')}})['then'](function(_0x4466f0){if(_['isNil'](_0x4466f0)){throw new Error(_0x6e70('0x79'));}_0x5d0585=_0x4466f0;return db[_0x5c0276+_0x6e70('0x6a')][_0x6e70('0x6b')]({'where':{'id':_0x50e494[_0x6e70('0x21')][_0x6e70('0x7a')]},'include':[{'model':db[_0x5c0276+_0x6e70('0x6c')],'as':_0x6e70('0x6c')},{'model':db[_0x5c0276+_0x4f4a16],'as':_0x6e70('0x6d')}]});})[_0x6e70('0xa')](function(_0x162bc3){if(_['isNil'](_0x162bc3)){throw new Error(_0x5c0276+_0x6e70('0x7b'));}_0x4a87e2=_0x162bc3;return _0x162bc3[_0x6e70('0x6e')]({'read':0x0,'readAt':null,'UserId':null});})[_0x6e70('0xa')](function(){var _0x181802={'uniqueid':_0x3e6661+'.'+_0x4a87e2['id']+'.'+_0x4a87e2[_0x6e70('0x6c')]['id'],'FromUserId':_0x50e494['user']['id'],'type':'agent','ToUserId':_0x5d0585['id']};_0x181802[_0x5c0276+'MessageId']=_0x4a87e2['id'];_0x181802[_0x5c0276+_0x6e70('0x71')]=_0x4a87e2[_0x6e70('0x6c')]['id'];_0x181802[_0x6e70('0x7c')+_0x5c0276+_0x4f4a16+'Id']=_0x4a87e2[_0x6e70('0x6d')]['id'];return db[_0x5c0276+_0x6e70('0x72')][_0x6e70('0x7d')](_0x181802);})[_0x6e70('0xa')](function(){return respondWithRpcPromise(_0x6e70('0x7e'),{'channel':_0x3e6661,'interaction':_0x4a87e2[_0x6e70('0x6c')],'message':_0x4a87e2,'account':_0x4a87e2[_0x6e70('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x6e70('0x3d'),'appdata':_0x5d0585[_0x6e70('0x12')]+','+(_0x4a87e2[_0x6e70('0x6d')][_0x6e70('0x7f')]||0x12c),'interval':_0x6e70('0x73')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x17d3a4,null))[_0x6e70('0xf')](handleError(_0x17d3a4,null));}; \ No newline at end of file +var _0xbaf0=['MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','value','indexOf','smsQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','From','QueueId','TransferReport','create','Start','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','Website','Agent\x20not\x20found','InteractionId','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','then','error','code','message','result','status','sendStatus','stack','name','isNil','rows','voiceChannels','VoiceChannels','catch','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','query','params','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','UpdateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','interface','SIP/%s','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','mailQueuesWaitingInteractions'];(function(_0xc5bd9a,_0xae1556){var _0x448f52=function(_0x529c7b){while(--_0x529c7b){_0xc5bd9a['push'](_0xc5bd9a['shift']());}};_0x448f52(++_0xae1556);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var BPromise=require('bluebird');var moment=require(_0x0baf('0x0'));var _=require(_0x0baf('0x1'));var util=require(_0x0baf('0x2'));var db=require(_0x0baf('0x3'))['db'];var logger=require(_0x0baf('0x4'))(_0x0baf('0x5'));var jayson=require('jayson/promise');var amiClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232a});var mailClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232b});var routingClient=jayson[_0x0baf('0x6')][_0x0baf('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){var _0x5f20aa=_0x1d0a0d?_0x1d0a0d:amiClient;return _0x5f20aa[_0x0baf('0x8')](_0x1a10b1,_0x2dcaac)[_0x0baf('0x9')](function(_0x465528){if(_0x465528[_0x0baf('0xa')]){if(_0x465528[_0x0baf('0xa')][_0x0baf('0xb')]===0x1f4){return _0x11b947(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}return _0x5f5030(_0x465528[_0x0baf('0xa')][_0x0baf('0xc')]);}else{_0x5f5030(_0x465528[_0x0baf('0xd')]);}})['catch'](function(_0x5a53e2){_0x11b947(_0x5a53e2);});});}function respondWithResult(_0x465dd7,_0xe4378c){_0xe4378c=_0xe4378c||0xc8;return function(_0x5db689){if(_0x5db689){return _0x465dd7[_0x0baf('0xe')](_0xe4378c)['json'](_0x5db689);}return _0x465dd7[_0x0baf('0xf')](0x194);};}function handleError(_0x49e44b,_0x1c76a8){_0x1c76a8=_0x1c76a8||0x1f4;return function(_0x1f50c3){logger[_0x0baf('0xa')](_0x1f50c3[_0x0baf('0x10')]);if(_0x1f50c3[_0x0baf('0x11')]){delete _0x1f50c3[_0x0baf('0x11')];}_0x49e44b['status'](_0x1c76a8)['send'](_0x1f50c3);};}function findById(_0x2312c7){return function(_0x38395b){if(!_[_0x0baf('0x12')](_0x2312c7)&&!_[_0x0baf('0x12')](_0x38395b)&&!_[_0x0baf('0x12')](_0x38395b[_0x0baf('0x13')])){return _['find'](_0x38395b[_0x0baf('0x13')],function(_0xfbecec){return _0xfbecec['id']==_0x2312c7;});}return null;};}exports[_0x0baf('0x14')]=function(_0x3e9cb4,_0x47070d){return respondWithRpcPromise(_0x0baf('0x15'),_0x3e9cb4['query'])['then'](respondWithResult(_0x47070d,null))[_0x0baf('0x16')](handleError(_0x47070d,null));};exports[_0x0baf('0x17')]=function(_0x32e839,_0x1848e8){return respondWithRpcPromise(_0x0baf('0x18'),_[_0x0baf('0x19')](_0x32e839[_0x0baf('0x1a')],_0x32e839[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1848e8,null))[_0x0baf('0x16')](handleError(_0x1848e8,null));};exports['voiceChannelStopMixMonitor']=function(_0x334bd6,_0x482522){return respondWithRpcPromise(_0x0baf('0x1c'),_['merge'](_0x334bd6['query'],_0x334bd6[_0x0baf('0x1b')]))['then'](respondWithResult(_0x482522,null))['catch'](handleError(_0x482522,null));};exports[_0x0baf('0x1d')]=function(_0x27b59c,_0x34e264){return respondWithRpcPromise(_0x0baf('0x1e'),_0x27b59c[_0x0baf('0x1a')])['then'](respondWithResult(_0x34e264,null))[_0x0baf('0x16')](handleError(_0x34e264,null));};exports[_0x0baf('0x1f')]=function(_0x1ca35a,_0x366e71){return respondWithRpcPromise(_0x0baf('0x1e'),_0x1ca35a[_0x0baf('0x1a')])[_0x0baf('0x9')](findById(_0x1ca35a['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x366e71,null))[_0x0baf('0x16')](handleError(_0x366e71,null));};exports[_0x0baf('0x20')]=function(_0x265915,_0x55c715){return respondWithRpcPromise(_0x0baf('0x21'),_[_0x0baf('0x19')](_0x265915['body'],_0x265915[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x55c715,null))[_0x0baf('0x16')](handleError(_0x55c715,null));};exports[_0x0baf('0x22')]=function(_0xd14f0f,_0x366924){return respondWithRpcPromise(_0x0baf('0x23'),_['merge'](_0xd14f0f[_0x0baf('0x1a')],_0xd14f0f[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x366924,null))[_0x0baf('0x16')](handleError(_0x366924,null));};exports[_0x0baf('0x24')]=function(_0x275ea1,_0x2fc983){return respondWithRpcPromise(_0x0baf('0x25'),_0x275ea1[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x2fc983,null))[_0x0baf('0x16')](handleError(_0x2fc983,null));};exports[_0x0baf('0x26')]=function(_0x45294a,_0x3a3353){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0baf('0x19')](_0x45294a['query'],_0x45294a[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x3a3353,null))[_0x0baf('0x16')](handleError(_0x3a3353,null));};exports[_0x0baf('0x27')]=function(_0x5300a5,_0x1a2b03){return respondWithRpcPromise(_0x0baf('0x28'),_['merge'](_0x5300a5[_0x0baf('0x1a')],_0x5300a5[_0x0baf('0x1b')]))[_0x0baf('0x9')](respondWithResult(_0x1a2b03,null))[_0x0baf('0x16')](handleError(_0x1a2b03,null));};exports[_0x0baf('0x29')]=function(_0x1b0991,_0xe03d82){return respondWithRpcPromise(_0x0baf('0x2a'),_['merge'](_0x1b0991[_0x0baf('0x1a')],_0x1b0991[_0x0baf('0x1b')]))['then'](respondWithResult(_0xe03d82,null))[_0x0baf('0x16')](handleError(_0xe03d82,null));};exports['outbound']=function(_0x5c545f,_0x11bc49){return respondWithRpcPromise(_0x0baf('0x2b'),_0x5c545f['query'])['then'](respondWithResult(_0x11bc49,null))[_0x0baf('0x16')](handleError(_0x11bc49,null));};exports[_0x0baf('0x2c')]=function(_0x3412bc,_0xb2d9ab){return respondWithRpcPromise(_0x0baf('0x2d'),_0x3412bc[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0xb2d9ab,null))[_0x0baf('0x16')](handleError(_0xb2d9ab,null));};exports[_0x0baf('0x2e')]=function(_0x36c6d2,_0x200864){var _0x148540;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2[_0x0baf('0x1a')])['then'](function(_0x3573ce){_0x148540=_0x3573ce;return respondWithRpcPromise(_0x0baf('0x2f'),_0x36c6d2['query'],routingClient);})[_0x0baf('0x9')](function(_0x324369){return _[_0x0baf('0x19')]({},_0x324369,_0x148540);})[_0x0baf('0x9')](respondWithResult(_0x200864,null))[_0x0baf('0x16')](handleError(_0x200864,null));};exports[_0x0baf('0x30')]=function(_0x57b581,_0x23ad34){if(_0x57b581[_0x0baf('0x31')]&&_0x57b581['body'][_0x0baf('0x32')]&&_0x57b581[_0x0baf('0x33')]&&_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]){for(var _0x504031 in _0x57b581[_0x0baf('0x31')][_0x0baf('0x32')]){if(_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x0baf('0x34')](_0x504031)){db[_0x0baf('0x35')][_0x0baf('0x36')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':_0x0baf('0x37'),'exitAt':null,'uniqueid':_0x57b581['body'][_0x0baf('0x32')][_0x504031]&&_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')]?{'$notIn':_0x57b581[_0x0baf('0x31')]['interaction'][_0x504031]}:{'$ne':null}}})[_0x0baf('0x9')](function(_0x310240){var _0x27c3ee=moment()[_0x0baf('0x39')](_0x0baf('0x3a'));for(var _0x54ed41=0x0,_0x2a0924=_0x310240[_0x0baf('0x38')];_0x54ed41<_0x2a0924;_0x54ed41+=0x1){_0x310240[_0x54ed41][_0x0baf('0x3b')]({'exitAt':_0x27c3ee});}});for(var _0x1522b0=0x0;_0x1522b0<_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x0baf('0x38')];_0x1522b0+=0x1){db['MemberReport'][_0x0baf('0x3c')]({'where':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'type':'INTERACTION','uniqueid':_0x57b581[_0x0baf('0x31')][_0x0baf('0x32')][_0x504031][_0x1522b0],'exitAt':null},'defaults':{'channel':_0x504031,'membername':_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')],'interface':_[_0x0baf('0x12')](_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')])?util['format'](_0x0baf('0x3e'),_0x57b581[_0x0baf('0x33')][_0x0baf('0x11')]):_0x57b581[_0x0baf('0x33')][_0x0baf('0x3d')],'type':_0x0baf('0x37'),'enterAt':moment()[_0x0baf('0x39')](_0x0baf('0x3a')),'role':_0x0baf('0x3f'),'internal':_0x57b581[_0x0baf('0x33')][_0x0baf('0x40')],'uniqueid':_0x57b581['body']['interaction'][_0x504031][_0x1522b0]}});}}}}return respondWithRpcPromise(_0x0baf('0x41'),{'id':_0x57b581[_0x0baf('0x1b')]['id'],'capacity':_0x57b581[_0x0baf('0x31')][_0x0baf('0x42')]},routingClient)[_0x0baf('0x9')](respondWithResult(_0x23ad34,null))[_0x0baf('0x16')](handleError(_0x23ad34,null));};exports[_0x0baf('0x43')]=function(_0x4b492c,_0x3fe534){return respondWithRpcPromise(_0x0baf('0x44'),_0x4b492c[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x3fe534,null))[_0x0baf('0x16')](handleError(_0x3fe534,null));};exports[_0x0baf('0x45')]=function(_0x5e1849,_0x3eebe5){return respondWithRpcPromise('Trunks',_0x5e1849[_0x0baf('0x1a')])['then'](respondWithResult(_0x3eebe5,null))[_0x0baf('0x16')](handleError(_0x3eebe5,null));};exports['campaigns']=function(_0x35b1a5,_0x4c035b){return respondWithRpcPromise(_0x0baf('0x46'),_0x35b1a5[_0x0baf('0x1a')])[_0x0baf('0x9')](respondWithResult(_0x4c035b,null))[_0x0baf('0x16')](handleError(_0x4c035b,null));};exports[_0x0baf('0x47')]=function(_0x576475,_0x21f179){return respondWithRpcPromise(_0x0baf('0x48'),_0x576475[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21f179,null))[_0x0baf('0x16')](handleError(_0x21f179,null));};exports[_0x0baf('0x49')]=function(_0x480834,_0x402f4d){return respondWithRpcPromise(_0x0baf('0x48'),_0x480834[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x480834[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x402f4d,null))[_0x0baf('0x16')](handleError(_0x402f4d,null));};exports['mailQueues']=function(_0x48e855,_0x23f6ea){return respondWithRpcPromise(_0x0baf('0x4a'),_0x48e855[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x23f6ea,null))[_0x0baf('0x16')](handleError(_0x23f6ea,null));};exports[_0x0baf('0x4b')]=function(_0xaa4293,_0x14a667){return respondWithRpcPromise(_0x0baf('0x4a'),_0xaa4293['query'],routingClient)[_0x0baf('0x9')](findById(_0xaa4293[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x14a667,null))[_0x0baf('0x16')](handleError(_0x14a667,null));};exports[_0x0baf('0x4c')]=function(_0xebfc0c,_0x26f5c9){return respondWithRpcPromise('MailAccounts',_0xebfc0c[_0x0baf('0x1a')],mailClient)[_0x0baf('0x9')](respondWithResult(_0x26f5c9,null))[_0x0baf('0x16')](handleError(_0x26f5c9,null));};exports[_0x0baf('0x4d')]=function(_0x1c7d88,_0x1a6d22){return respondWithRpcPromise(_0x0baf('0x4e'),_0x1c7d88[_0x0baf('0x1a')],routingClient)['then'](respondWithResult(_0x1a6d22,null))[_0x0baf('0x16')](handleError(_0x1a6d22,null));};exports['showOpenchannelQueues']=function(_0x3c00e7,_0x5f2fbe){return respondWithRpcPromise('OpenchannelQueues',_0x3c00e7[_0x0baf('0x1a')],routingClient)['then'](findById(_0x3c00e7[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0x5f2fbe,null))['catch'](handleError(_0x5f2fbe,null));};exports[_0x0baf('0x4f')]=function(_0xfb6708,_0x156572){return respondWithRpcPromise('SmsQueues',_0xfb6708['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x156572,null))[_0x0baf('0x16')](handleError(_0x156572,null));};exports[_0x0baf('0x50')]=function(_0x7f49e,_0x784e1a){return respondWithRpcPromise('SmsQueues',_0x7f49e[_0x0baf('0x1a')],routingClient)['then'](findById(_0x7f49e['params']['id']))['then'](respondWithResult(_0x784e1a,null))[_0x0baf('0x16')](handleError(_0x784e1a,null));};exports['whatsappQueues']=function(_0x4946d4,_0x11a81e){return respondWithRpcPromise(_0x0baf('0x51'),_0x4946d4[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x11a81e,null))[_0x0baf('0x16')](handleError(_0x11a81e,null));};exports[_0x0baf('0x52')]=function(_0x4c05d6,_0xec3b32){return respondWithRpcPromise(_0x0baf('0x51'),_0x4c05d6[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](findById(_0x4c05d6[_0x0baf('0x1b')]['id']))[_0x0baf('0x9')](respondWithResult(_0xec3b32,null))['catch'](handleError(_0xec3b32,null));};exports[_0x0baf('0x53')]=function(_0x468363,_0x29fd46){return respondWithRpcPromise('FaxQueues',_0x468363[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x29fd46,null))[_0x0baf('0x16')](handleError(_0x29fd46,null));};exports[_0x0baf('0x54')]=function(_0x125906,_0x27a959){return respondWithRpcPromise(_0x0baf('0x55'),_0x125906['query'],routingClient)['then'](findById(_0x125906['params']['id']))[_0x0baf('0x9')](respondWithResult(_0x27a959,null))[_0x0baf('0x16')](handleError(_0x27a959,null));};exports[_0x0baf('0x56')]=function(_0x12b9b5,_0x3e65d4){return respondWithRpcPromise(_0x0baf('0x57'),_0x12b9b5['query'])['then'](respondWithResult(_0x3e65d4,null))[_0x0baf('0x16')](handleError(_0x3e65d4,null));};exports['chatQueuesWaitingInteractions']=function(_0x22cd07,_0x3e9b79){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x22cd07[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x3e9b79,null))[_0x0baf('0x16')](handleError(_0x3e9b79,null));};exports[_0x0baf('0x58')]=function(_0x115ff5,_0x33a5af){return respondWithRpcPromise(_0x0baf('0x59'),_0x115ff5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x33a5af,null))['catch'](handleError(_0x33a5af,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x58a079,_0x493784){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x58a079[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x493784,null))[_0x0baf('0x16')](handleError(_0x493784,null));};exports[_0x0baf('0x5a')]=function(_0x5093f5,_0x1be7f2){return respondWithRpcPromise(_0x0baf('0x5b'),_0x5093f5['query'],routingClient)['then'](function(_0x43aecd){if(_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')]!==undefined){var _0x442e5f=_(_0x43aecd[_0x0baf('0x13')])[_0x0baf('0x5d')]([_0x5093f5[_0x0baf('0x1a')][_0x0baf('0x5c')],_0x5093f5['params']['id']])[_0x0baf('0x5e')](_0x0baf('0x5f'))['uniq']()[_0x0baf('0x60')]();return _0x43aecd[_0x0baf('0x13')]['filter'](function(_0x97d385){return _0x442e5f[_0x0baf('0x61')](_0x97d385[_0x0baf('0x5f')])>-0x1;});}else{return _0x43aecd[_0x0baf('0x13')][_0x0baf('0x5d')](function(_0x4fc5af){return _0x4fc5af['queue_id']===parseInt(_0x5093f5[_0x0baf('0x1b')]['id']);});}})[_0x0baf('0x9')](respondWithResult(_0x1be7f2,null))['catch'](handleError(_0x1be7f2,null));};exports[_0x0baf('0x62')]=function(_0x59dad5,_0x21ad25){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x59dad5[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x21ad25,null))[_0x0baf('0x16')](handleError(_0x21ad25,null));};exports['whatsappQueuesWaitingInteractions']=function(_0x3c2bc1,_0x5008c5){return respondWithRpcPromise(_0x0baf('0x63'),_0x3c2bc1[_0x0baf('0x1a')],routingClient)[_0x0baf('0x9')](respondWithResult(_0x5008c5,null))[_0x0baf('0x16')](handleError(_0x5008c5,null));};exports[_0x0baf('0x64')]=function(_0x52e845,_0x866e6e){return respondWithRpcPromise(_0x0baf('0x65'),_0x52e845['query'],routingClient)[_0x0baf('0x9')](respondWithResult(_0x866e6e,null))[_0x0baf('0x16')](handleError(_0x866e6e,null));};exports[_0x0baf('0x66')]=function(_0x379c54){return function(_0x1cbbcc,_0x250df2){var _0xa4fd1b,_0x1cda78;var _0x44ef57=_[_0x0baf('0x67')](_0x379c54);var _0x3b7abf=_0x379c54===_0x0baf('0x68')?'Website':'Account';return db[_0x44ef57+_0x0baf('0x69')][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1cbbcc[_0x0baf('0x1b')]['id']}})['then'](function(_0x507783){if(_[_0x0baf('0x12')](_0x507783)){throw new Error(_0x44ef57+_0x0baf('0x6b'));}_0xa4fd1b=_0x507783;return db[_0x44ef57+_0x0baf('0x6c')][_0x0baf('0x6a')]({'where':{'id':_0x1cbbcc[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x44ef57+_0x0baf('0x6e')],'as':_0x0baf('0x6e')},{'model':db[_0x44ef57+_0x3b7abf],'as':_0x0baf('0x6f')}]});})['then'](function(_0x1590a5){if(_[_0x0baf('0x12')](_0x1590a5)){throw new Error(_0x44ef57+_0x0baf('0x70'));}_0x1cda78=_0x1590a5;return _0x1590a5[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x5d26e6={'uniqueid':_0x379c54+'.'+_0x1cda78['id']+'.'+_0x1cda78['Interaction']['id'],'FromUserId':_0x1cbbcc[_0x0baf('0x33')]['id'],'type':_0x0baf('0x72')};_0x5d26e6[_0x44ef57+'MessageId']=_0x1cda78['id'];_0x5d26e6[_0x44ef57+'InteractionId']=_0x1cda78[_0x0baf('0x6e')]['id'];_0x5d26e6[_0x0baf('0x73')+_0x44ef57+_0x3b7abf+'Id']=_0x1cda78['Account']['id'];_0x5d26e6['To'+_0x44ef57+_0x0baf('0x74')]=_0xa4fd1b['id'];return db[_0x44ef57+_0x0baf('0x75')][_0x0baf('0x76')](_0x5d26e6);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x379c54,'interaction':_0x1cda78[_0x0baf('0x6e')],'message':_0x1cda78,'account':_0x1cda78[_0x0baf('0x6f')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0baf('0x72'),'appdata':_0xa4fd1b[_0x0baf('0x11')]+','+(_0x1cda78[_0x0baf('0x6f')][_0x0baf('0x78')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x250df2,null))[_0x0baf('0x16')](handleError(_0x250df2,null));};};exports[_0x0baf('0x7a')]=function(_0x1e1adb,_0x3bd15b){var _0x3c37b4,_0x195303;if(_['isNil'](_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x7b')])){throw new Error(_0x0baf('0x7c'));}var _0x457ae8=_0x1e1adb[_0x0baf('0x31')]['channel'];var _0x3761b5=_[_0x0baf('0x67')](_0x457ae8);var _0x2eae1b=_0x457ae8===_0x0baf('0x68')?_0x0baf('0x7d'):'Account';return db['User'][_0x0baf('0x6a')]({'raw':!![],'where':{'id':_0x1e1adb['params']['id'],'role':_0x0baf('0x3f')}})['then'](function(_0x32d8b6){if(_[_0x0baf('0x12')](_0x32d8b6)){throw new Error(_0x0baf('0x7e'));}_0x3c37b4=_0x32d8b6;return db[_0x3761b5+_0x0baf('0x6c')]['findOne']({'where':{'id':_0x1e1adb[_0x0baf('0x31')][_0x0baf('0x6d')]},'include':[{'model':db[_0x3761b5+_0x0baf('0x6e')],'as':'Interaction'},{'model':db[_0x3761b5+_0x2eae1b],'as':'Account'}]});})['then'](function(_0x4d4884){if(_[_0x0baf('0x12')](_0x4d4884)){throw new Error(_0x3761b5+_0x0baf('0x70'));}_0x195303=_0x4d4884;return _0x4d4884[_0x0baf('0x71')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0baf('0x9')](function(){var _0x597830={'uniqueid':_0x457ae8+'.'+_0x195303['id']+'.'+_0x195303[_0x0baf('0x6e')]['id'],'FromUserId':_0x1e1adb[_0x0baf('0x33')]['id'],'type':_0x0baf('0x3f'),'ToUserId':_0x3c37b4['id']};_0x597830[_0x3761b5+'MessageId']=_0x195303['id'];_0x597830[_0x3761b5+_0x0baf('0x7f')]=_0x195303[_0x0baf('0x6e')]['id'];_0x597830['From'+_0x3761b5+_0x2eae1b+'Id']=_0x195303[_0x0baf('0x6f')]['id'];return db[_0x3761b5+'TransferReport'][_0x0baf('0x76')](_0x597830);})[_0x0baf('0x9')](function(){return respondWithRpcPromise(_0x0baf('0x77'),{'channel':_0x457ae8,'interaction':_0x195303[_0x0baf('0x6e')],'message':_0x195303,'account':_0x195303['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x3c37b4[_0x0baf('0x11')]+','+(_0x195303['Account'][_0x0baf('0x80')]||0x12c),'interval':_0x0baf('0x79')}],'transfer':!![]},routingClient);})[_0x0baf('0x9')](respondWithResult(_0x3bd15b,null))[_0x0baf('0x16')](handleError(_0x3bd15b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 73a161e..82180dc 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 _0xa918=['../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','index','/:id','isAuthenticated','show','/:id/run','run','create','put','delete','destroy','exports','util','path','connect-timeout'];(function(_0x20e81e,_0x2ad41f){var _0x3e6654=function(_0x3f2904){while(--_0x3f2904){_0x20e81e['push'](_0x20e81e['shift']());}};_0x3e6654(++_0x2ad41f);}(_0xa918,0x1d1));var _0x8a91=function(_0x546000,_0x3459f2){_0x546000=_0x546000-0x0;var _0x780c08=_0xa918[_0x546000];return _0x780c08;};'use strict';var multer=require('multer');var util=require(_0x8a91('0x0'));var path=require(_0x8a91('0x1'));var timeout=require(_0x8a91('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8a91('0x3'));var interaction=require(_0x8a91('0x4'));var config=require(_0x8a91('0x5'));var controller=require(_0x8a91('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x8a91('0x7')]);router['get'](_0x8a91('0x8'),auth[_0x8a91('0x9')](),controller[_0x8a91('0xa')]);router['get'](_0x8a91('0xb'),auth[_0x8a91('0x9')](),controller[_0x8a91('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8a91('0xd')]);router[_0x8a91('0xe')](_0x8a91('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x8a91('0xf')](_0x8a91('0x8'),auth['isAuthenticated'](),controller[_0x8a91('0x10')]);module[_0x8a91('0x11')]=router; \ No newline at end of file +var _0xc923=['index','/:id','show','/:id/run','put','destroy','util','path','express','fs-extra','../../config/environment','./schedule.controller','get','isAuthenticated'];(function(_0x33a205,_0x31c146){var _0x1c59ab=function(_0x2e01eb){while(--_0x2e01eb){_0x33a205['push'](_0x33a205['shift']());}};_0x1c59ab(++_0x31c146);}(_0xc923,0x11e));var _0x3c92=function(_0x5efc4e,_0x11c6e2){_0x5efc4e=_0x5efc4e-0x0;var _0x39fa6b=_0xc923[_0x5efc4e];return _0x39fa6b;};'use strict';var multer=require('multer');var util=require(_0x3c92('0x0'));var path=require(_0x3c92('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c92('0x2'));var router=express['Router']();var fs_extra=require(_0x3c92('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c92('0x4'));var controller=require(_0x3c92('0x5'));router[_0x3c92('0x6')]('/',auth[_0x3c92('0x7')](),controller[_0x3c92('0x8')]);router[_0x3c92('0x6')](_0x3c92('0x9'),auth[_0x3c92('0x7')](),controller[_0x3c92('0xa')]);router[_0x3c92('0x6')](_0x3c92('0xb'),auth[_0x3c92('0x7')](),controller['run']);router['post']('/',auth[_0x3c92('0x7')](),controller['create']);router[_0x3c92('0xc')](_0x3c92('0x9'),auth[_0x3c92('0x7')](),controller['update']);router['delete'](_0x3c92('0x9'),auth[_0x3c92('0x7')](),controller[_0x3c92('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index d55813d..fdf3a8c 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 _0x6cdd=['weeks','days','hours','minutes','csv','pdf','ENUM','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months'];(function(_0x15ca1a,_0x30fc82){var _0x507626=function(_0x14c9bc){while(--_0x14c9bc){_0x15ca1a['push'](_0x15ca1a['shift']());}};_0x507626(++_0x30fc82);}(_0x6cdd,0x1ac));var _0xd6cd=function(_0x47101c,_0x3665e8){_0x47101c=_0x47101c-0x0;var _0x132d33=_0x6cdd[_0x47101c];return _0x132d33;};'use strict';var Sequelize=require(_0xd6cd('0x0'));module[_0xd6cd('0x1')]={'name':{'type':Sequelize[_0xd6cd('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd6cd('0x2')]},'active':{'type':Sequelize[_0xd6cd('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd6cd('0x2')],'allowNull':![],'defaultValue':_0xd6cd('0x4')},'startAt':{'type':Sequelize[_0xd6cd('0x5')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0xd6cd('0x6'),_0xd6cd('0x7'),_0xd6cd('0x8'),_0xd6cd('0x9'),_0xd6cd('0xa'),_0xd6cd('0xb'),_0xd6cd('0xc')),'allowNull':![],'defaultValue':_0xd6cd('0xa')},'output':{'type':Sequelize['ENUM'](_0xd6cd('0xd'),_0xd6cd('0xe'),'xlsx'),'allowNull':![],'defaultValue':_0xd6cd('0xd')},'type':{'type':Sequelize[_0xd6cd('0xf')]('custom',_0xd6cd('0x10')),'allowNull':![],'defaultValue':_0xd6cd('0x11')},'sendMail':{'type':Sequelize[_0xd6cd('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xd6cd('0x2')]},'cc':{'type':Sequelize[_0xd6cd('0x12')]},'bcc':{'type':Sequelize[_0xd6cd('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd6cd('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc784=['BOOLEAN','TEXT','exports','STRING','DATE','years','quarters','months','weeks','days','hours','ENUM','pdf','xlsx','custom','default'];(function(_0x1b2255,_0x3de34f){var _0x33e57d=function(_0x2f9cce){while(--_0x2f9cce){_0x1b2255['push'](_0x1b2255['shift']());}};_0x33e57d(++_0x3de34f);}(_0xc784,0x172));var _0x4c78=function(_0x2a8832,_0x425b96){_0x2a8832=_0x2a8832-0x0;var _0x463795=_0xc784[_0x2a8832];return _0x463795;};'use strict';var Sequelize=require('sequelize');module[_0x4c78('0x0')]={'name':{'type':Sequelize[_0x4c78('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4c78('0x1')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4c78('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4c78('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x4c78('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x4c78('0x3'),_0x4c78('0x4'),_0x4c78('0x5'),_0x4c78('0x6'),_0x4c78('0x7'),_0x4c78('0x8'),'minutes'),'allowNull':![],'defaultValue':_0x4c78('0x7')},'output':{'type':Sequelize[_0x4c78('0x9')]('csv',_0x4c78('0xa'),_0x4c78('0xb')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x4c78('0x9')](_0x4c78('0xc'),_0x4c78('0xd')),'allowNull':![],'defaultValue':_0x4c78('0xc')},'sendMail':{'type':Sequelize[_0x4c78('0xe')],'defaultValue':![]},'email':{'type':Sequelize[_0x4c78('0x1')]},'cc':{'type':Sequelize[_0x4c78('0xf')]},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x4c78('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 0d733fb..8a42152 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 _0xb688=['intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','Schedule','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','apply','reject','save','then','destroy','get','Scheduler','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','query','keys'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb688,0x1e2));var _0x8b68=function(_0x329dcb,_0x2f243b){_0x329dcb=_0x329dcb-0x0;var _0x29f90e=_0xb688[_0x329dcb];return _0x29f90e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8b68('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b68('0x1'));var moment=require(_0x8b68('0x2'));var BPromise=require(_0x8b68('0x3'));var Mustache=require(_0x8b68('0x4'));var util=require(_0x8b68('0x5'));var path=require(_0x8b68('0x6'));var sox=require(_0x8b68('0x7'));var csv=require(_0x8b68('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8b68('0x9'));var _=require(_0x8b68('0xa'));var squel=require(_0x8b68('0xb'));var crypto=require(_0x8b68('0xc'));var jsforce=require(_0x8b68('0xd'));var deskjs=require(_0x8b68('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8b68('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8b68('0x10'));var qs=require(_0x8b68('0x11'));var as=require(_0x8b68('0x12'));var hardwareService=require(_0x8b68('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x8b68('0x14'));var config=require(_0x8b68('0x15'));var licenseUtil=require(_0x8b68('0x16'));var db=require(_0x8b68('0x17'))['db'];function respondWithStatusCode(_0x209d12,_0x41703b){_0x41703b=_0x41703b||0xcc;return function(_0x1ea2ac){if(_0x1ea2ac){return _0x209d12[_0x8b68('0x18')](_0x41703b);}return _0x209d12['status'](_0x41703b)[_0x8b68('0x19')]();};}function respondWithResult(_0x2bb5c0,_0x3551d3){_0x3551d3=_0x3551d3||0xc8;return function(_0x319729){if(_0x319729){return _0x2bb5c0['status'](_0x3551d3)[_0x8b68('0x1a')](_0x319729);}};}function respondWithFilteredResult(_0x29e265,_0x5a1804){return function(_0x8b5d0d){if(_0x8b5d0d){var _0x380237=typeof _0x5a1804['offset']===_0x8b68('0x1b')&&typeof _0x5a1804[_0x8b68('0x1c')]===_0x8b68('0x1b');var _0x583b19=_0x8b5d0d[_0x8b68('0x1d')];var _0x55e72f=_0x380237?0x0:_0x5a1804['offset'];var _0x22d1ca=_0x380237?_0x8b5d0d[_0x8b68('0x1d')]:_0x5a1804[_0x8b68('0x1e')]+_0x5a1804[_0x8b68('0x1c')];var _0x5bab3c;if(_0x22d1ca>=_0x583b19){_0x22d1ca=_0x583b19;_0x5bab3c=0xc8;}else{_0x5bab3c=0xce;}_0x29e265[_0x8b68('0x1f')](_0x5bab3c);return _0x29e265[_0x8b68('0x20')]('Content-Range',_0x55e72f+'-'+_0x22d1ca+'/'+_0x583b19)[_0x8b68('0x1a')](_0x8b5d0d);}return null;};}function patchUpdates(_0x4fa503){return function(_0x43ba5a){try{jsonpatch[_0x8b68('0x21')](_0x43ba5a,_0x4fa503,!![]);}catch(_0x43a316){return BPromise[_0x8b68('0x22')](_0x43a316);}return _0x43ba5a[_0x8b68('0x23')]();};}function saveUpdates(_0x384549,_0x17593f){return function(_0x588160){if(_0x588160){return _0x588160['update'](_0x384549)[_0x8b68('0x24')](function(_0x27188d){return _0x27188d;});}return null;};}function removeEntity(_0x314b4e,_0x6dd26b){return function(_0x46811d){if(_0x46811d){return _0x46811d[_0x8b68('0x25')]()[_0x8b68('0x24')](function(){var _0xaa50ce=_0x46811d[_0x8b68('0x26')]({'plain':!![]});var _0x2cd78a=_0x8b68('0x27');return db['UserProfileResource'][_0x8b68('0x25')]({'where':{'type':_0x2cd78a,'resourceId':_0xaa50ce['id']}})[_0x8b68('0x24')](function(){return _0x46811d;});})[_0x8b68('0x24')](function(){_0x314b4e[_0x8b68('0x1f')](0xcc)[_0x8b68('0x19')]();});}};}function handleEntityNotFound(_0x263775,_0x35e821){return function(_0x85c952){if(!_0x85c952){_0x263775[_0x8b68('0x18')](0x194);}return _0x85c952;};}function handleError(_0x1140da,_0x551488){_0x551488=_0x551488||0x1f4;return function(_0x57c8f2){logger[_0x8b68('0x28')](_0x57c8f2[_0x8b68('0x29')]);if(_0x57c8f2[_0x8b68('0x2a')]){delete _0x57c8f2[_0x8b68('0x2a')];}_0x1140da['status'](_0x551488)[_0x8b68('0x2b')](_0x57c8f2);};}exports[_0x8b68('0x2c')]=function(_0x2b8b47,_0x12cc2c){var _0x597d65={},_0x4c0ef3={},_0x423c02={'count':0x0,'rows':[]};var _0x22b167=_['map'](db['Schedule'][_0x8b68('0x2d')],function(_0x517cac){return{'name':_0x517cac[_0x8b68('0x2e')],'type':_0x517cac[_0x8b68('0x2f')][_0x8b68('0x30')]};});_0x4c0ef3['model']=_[_0x8b68('0x31')](_0x22b167,_0x8b68('0x2a'));_0x4c0ef3[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x2b8b47[_0x8b68('0x32')]);_0x4c0ef3['filters']=_[_0x8b68('0x34')](_0x4c0ef3[_0x8b68('0x35')],_0x4c0ef3[_0x8b68('0x32')]);_0x597d65['attributes']=_[_0x8b68('0x34')](_0x4c0ef3[_0x8b68('0x35')],qs[_0x8b68('0x36')](_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x36')]));_0x597d65[_0x8b68('0x37')]=_0x597d65['attributes'][_0x8b68('0x38')]?_0x597d65[_0x8b68('0x37')]:_0x4c0ef3[_0x8b68('0x35')];if(!_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x39')](_0x8b68('0x3a'))){_0x597d65[_0x8b68('0x1c')]=qs[_0x8b68('0x1c')](_0x2b8b47[_0x8b68('0x32')]['limit']);_0x597d65[_0x8b68('0x1e')]=qs[_0x8b68('0x1e')](_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x1e')]);}_0x597d65[_0x8b68('0x3b')]=qs[_0x8b68('0x3c')](_0x2b8b47['query'][_0x8b68('0x3c')]);_0x597d65[_0x8b68('0x3d')]=qs['filters'](_[_0x8b68('0x3e')](_0x2b8b47[_0x8b68('0x32')],_0x4c0ef3[_0x8b68('0x3f')]),_0x22b167);if(_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x40')]){_0x597d65['where']=_['merge'](_0x597d65['where'],{'$or':_['map'](_0x22b167,function(_0x1f0c67){if(_0x1f0c67[_0x8b68('0x2f')]!==_0x8b68('0x41')){var _0x4f93c4={};_0x4f93c4[_0x1f0c67[_0x8b68('0x2a')]]={'$like':'%'+_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x40')]+'%'};return _0x4f93c4;}})});}_0x597d65=_[_0x8b68('0x42')]({},_0x597d65,_0x2b8b47[_0x8b68('0x43')]);var _0x257881={'where':_0x597d65['where']};return db[_0x8b68('0x44')][_0x8b68('0x1d')](_0x257881)['then'](function(_0x5d3929){_0x423c02[_0x8b68('0x1d')]=_0x5d3929;if(_0x2b8b47[_0x8b68('0x32')][_0x8b68('0x45')]){_0x597d65[_0x8b68('0x46')]=[{'all':!![]}];}return db[_0x8b68('0x44')][_0x8b68('0x47')](_0x597d65);})[_0x8b68('0x24')](function(_0x4798e3){_0x423c02[_0x8b68('0x48')]=_0x4798e3;return _0x423c02;})[_0x8b68('0x24')](respondWithFilteredResult(_0x12cc2c,_0x597d65))[_0x8b68('0x49')](handleError(_0x12cc2c,null));};exports['show']=function(_0x323e8a,_0x43b051){var _0x15a866={'raw':![],'where':{'id':_0x323e8a[_0x8b68('0x4a')]['id']}},_0x383ebf={};_0x383ebf[_0x8b68('0x35')]=_[_0x8b68('0x33')](db[_0x8b68('0x44')][_0x8b68('0x2d')]);_0x383ebf[_0x8b68('0x32')]=_[_0x8b68('0x33')](_0x323e8a[_0x8b68('0x32')]);_0x383ebf[_0x8b68('0x3f')]=_[_0x8b68('0x34')](_0x383ebf[_0x8b68('0x35')],_0x383ebf[_0x8b68('0x32')]);_0x15a866[_0x8b68('0x37')]=_[_0x8b68('0x34')](_0x383ebf['model'],qs['fields'](_0x323e8a['query'][_0x8b68('0x36')]));_0x15a866[_0x8b68('0x37')]=_0x15a866[_0x8b68('0x37')]['length']?_0x15a866['attributes']:_0x383ebf[_0x8b68('0x35')];if(_0x323e8a[_0x8b68('0x32')][_0x8b68('0x45')]){_0x15a866[_0x8b68('0x46')]=[{'all':!![]}];}_0x15a866=_[_0x8b68('0x42')]({},_0x15a866,_0x323e8a[_0x8b68('0x43')]);return db['Schedule'][_0x8b68('0x4b')](_0x15a866)['then'](handleEntityNotFound(_0x43b051,null))[_0x8b68('0x24')](respondWithResult(_0x43b051,null))['catch'](handleError(_0x43b051,null));};exports[_0x8b68('0x4c')]=function(_0x4456a2,_0x5b53ed){return db['Schedule'][_0x8b68('0x4c')](_0x4456a2[_0x8b68('0x4d')],{})[_0x8b68('0x24')](function(_0x12b182){var _0x4110c8=_0x4456a2[_0x8b68('0x4e')][_0x8b68('0x26')]({'plain':!![]});if(!_0x4110c8)throw new Error(_0x8b68('0x4f'));if(_0x4110c8[_0x8b68('0x50')]===_0x8b68('0x4e')){var _0xd4821=_0x12b182[_0x8b68('0x26')]({'plain':!![]});var _0x52dcd6='Scheduler';return db[_0x8b68('0x51')][_0x8b68('0x4b')]({'where':{'name':_0x52dcd6,'userProfileId':_0x4110c8[_0x8b68('0x52')]},'raw':!![]})[_0x8b68('0x24')](function(_0x51bd78){if(_0x51bd78&&_0x51bd78[_0x8b68('0x53')]===0x0){return db[_0x8b68('0x54')][_0x8b68('0x4c')]({'name':_0xd4821[_0x8b68('0x2a')],'resourceId':_0xd4821['id'],'type':_0x51bd78[_0x8b68('0x2a')],'sectionId':_0x51bd78['id']},{})['then'](function(){return _0x12b182;});}else{return _0x12b182;}})[_0x8b68('0x49')](function(_0x4be254){logger[_0x8b68('0x28')](_0x8b68('0x55'),_0x4be254);throw _0x4be254;});}return _0x12b182;})[_0x8b68('0x24')](respondWithResult(_0x5b53ed,0xc9))[_0x8b68('0x49')](handleError(_0x5b53ed,null));};exports[_0x8b68('0x56')]=function(_0x70db9c,_0x3ee58e){if(_0x70db9c[_0x8b68('0x4d')]['id']){delete _0x70db9c['body']['id'];}return db[_0x8b68('0x44')][_0x8b68('0x4b')]({'where':{'id':_0x70db9c[_0x8b68('0x4a')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x3ee58e,null))[_0x8b68('0x24')](saveUpdates(_0x70db9c[_0x8b68('0x4d')],null))[_0x8b68('0x24')](respondWithResult(_0x3ee58e,null))['catch'](handleError(_0x3ee58e,null));};exports[_0x8b68('0x25')]=function(_0x43be92,_0x498c25){return db['Schedule'][_0x8b68('0x4b')]({'where':{'id':_0x43be92[_0x8b68('0x4a')]['id']}})[_0x8b68('0x24')](handleEntityNotFound(_0x498c25,null))[_0x8b68('0x24')](removeEntity(_0x498c25,null))[_0x8b68('0x49')](handleError(_0x498c25,null));};exports[_0x8b68('0x57')]=function(_0x2d8537,_0xbf546a,_0x180394){var _0x258a6c=require(_0x8b68('0x58'));return db['Schedule'][_0x8b68('0x4b')]({'where':{'id':_0x2d8537[_0x8b68('0x4a')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbf546a,null))['then'](function(){_0x258a6c[_0x8b68('0x57')](_0x2d8537[_0x8b68('0x4a')]['id']);})['then'](respondWithStatusCode(_0xbf546a,null))[_0x8b68('0x49')](handleError(_0xbf546a,null));}; \ No newline at end of file +var _0x4aa4=['VIRTUAL','options','includeAll','include','findAll','show','fields','find','catch','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Scheduler','UserProfileResource','stack','name','send','Schedule','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0x4b465e,_0x33ac38){var _0x18a693=function(_0x1e8f52){while(--_0x1e8f52){_0x4b465e['push'](_0x4b465e['shift']());}};_0x18a693(++_0x33ac38);}(_0x4aa4,0x68));var _0x44aa=function(_0xbb6c77,_0x135b45){_0xbb6c77=_0xbb6c77-0x0;var _0x5cc62d=_0x4aa4[_0xbb6c77];return _0x5cc62d;};'use strict';var emlformat=require(_0x44aa('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x44aa('0x1'));var jsonpatch=require(_0x44aa('0x2'));var rp=require(_0x44aa('0x3'));var moment=require(_0x44aa('0x4'));var BPromise=require(_0x44aa('0x5'));var Mustache=require(_0x44aa('0x6'));var util=require(_0x44aa('0x7'));var path=require(_0x44aa('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x44aa('0x9'));var fs=require('fs');var fs_extra=require(_0x44aa('0xa'));var _=require(_0x44aa('0xb'));var squel=require('squel');var crypto=require(_0x44aa('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x44aa('0xd'));var toCsv=require('to-csv');var querystring=require(_0x44aa('0xe'));var Papa=require(_0x44aa('0xf'));var Redis=require(_0x44aa('0x10'));var authService=require(_0x44aa('0x11'));var qs=require(_0x44aa('0x12'));var as=require(_0x44aa('0x13'));var hardwareService=require(_0x44aa('0x14'));var logger=require(_0x44aa('0x15'))(_0x44aa('0x16'));var utils=require(_0x44aa('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x117b6b,_0x234056){_0x234056=_0x234056||0xcc;return function(_0xa6ebe3){if(_0xa6ebe3){return _0x117b6b[_0x44aa('0x18')](_0x234056);}return _0x117b6b[_0x44aa('0x19')](_0x234056)[_0x44aa('0x1a')]();};}function respondWithResult(_0x1e8749,_0x120e7a){_0x120e7a=_0x120e7a||0xc8;return function(_0x53796b){if(_0x53796b){return _0x1e8749[_0x44aa('0x19')](_0x120e7a)['json'](_0x53796b);}};}function respondWithFilteredResult(_0x228ea9,_0x330ba4){return function(_0x1d4f5c){if(_0x1d4f5c){var _0x24627b=typeof _0x330ba4[_0x44aa('0x1b')]==='undefined'&&typeof _0x330ba4[_0x44aa('0x1c')]===_0x44aa('0x1d');var _0xe17ac8=_0x1d4f5c[_0x44aa('0x1e')];var _0xa7f544=_0x24627b?0x0:_0x330ba4[_0x44aa('0x1b')];var _0x25d136=_0x24627b?_0x1d4f5c[_0x44aa('0x1e')]:_0x330ba4[_0x44aa('0x1b')]+_0x330ba4[_0x44aa('0x1c')];var _0x4ac65d;if(_0x25d136>=_0xe17ac8){_0x25d136=_0xe17ac8;_0x4ac65d=0xc8;}else{_0x4ac65d=0xce;}_0x228ea9[_0x44aa('0x19')](_0x4ac65d);return _0x228ea9[_0x44aa('0x1f')](_0x44aa('0x20'),_0xa7f544+'-'+_0x25d136+'/'+_0xe17ac8)['json'](_0x1d4f5c);}return null;};}function patchUpdates(_0x458cce){return function(_0x4ee267){try{jsonpatch[_0x44aa('0x21')](_0x4ee267,_0x458cce,!![]);}catch(_0x2dfc03){return BPromise[_0x44aa('0x22')](_0x2dfc03);}return _0x4ee267['save']();};}function saveUpdates(_0x3aa7da,_0x433a0d){return function(_0x2abd34){if(_0x2abd34){return _0x2abd34[_0x44aa('0x23')](_0x3aa7da)[_0x44aa('0x24')](function(_0x38586f){return _0x38586f;});}return null;};}function removeEntity(_0x45f3c2,_0x41e902){return function(_0x116e39){if(_0x116e39){return _0x116e39[_0x44aa('0x25')]()[_0x44aa('0x24')](function(){var _0xcc09e8=_0x116e39[_0x44aa('0x26')]({'plain':!![]});var _0x13349a=_0x44aa('0x27');return db[_0x44aa('0x28')][_0x44aa('0x25')]({'where':{'type':_0x13349a,'resourceId':_0xcc09e8['id']}})[_0x44aa('0x24')](function(){return _0x116e39;});})[_0x44aa('0x24')](function(){_0x45f3c2[_0x44aa('0x19')](0xcc)[_0x44aa('0x1a')]();});}};}function handleEntityNotFound(_0x1e57f4,_0x468aef){return function(_0x3bf1fc){if(!_0x3bf1fc){_0x1e57f4[_0x44aa('0x18')](0x194);}return _0x3bf1fc;};}function handleError(_0x30ca4f,_0x5755a1){_0x5755a1=_0x5755a1||0x1f4;return function(_0x203642){logger['error'](_0x203642[_0x44aa('0x29')]);if(_0x203642[_0x44aa('0x2a')]){delete _0x203642[_0x44aa('0x2a')];}_0x30ca4f[_0x44aa('0x19')](_0x5755a1)[_0x44aa('0x2b')](_0x203642);};}exports['index']=function(_0x5617ca,_0x401ae2){var _0x136dad={},_0x37053f={},_0x5d8e2f={'count':0x0,'rows':[]};var _0x32a9eb=_['map'](db[_0x44aa('0x2c')][_0x44aa('0x2d')],function(_0x4915eb){return{'name':_0x4915eb[_0x44aa('0x2e')],'type':_0x4915eb[_0x44aa('0x2f')][_0x44aa('0x30')]};});_0x37053f[_0x44aa('0x31')]=_[_0x44aa('0x32')](_0x32a9eb,'name');_0x37053f['query']=_[_0x44aa('0x33')](_0x5617ca[_0x44aa('0x34')]);_0x37053f[_0x44aa('0x35')]=_['intersection'](_0x37053f[_0x44aa('0x31')],_0x37053f[_0x44aa('0x34')]);_0x136dad[_0x44aa('0x36')]=_[_0x44aa('0x37')](_0x37053f[_0x44aa('0x31')],qs['fields'](_0x5617ca['query']['fields']));_0x136dad[_0x44aa('0x36')]=_0x136dad['attributes'][_0x44aa('0x38')]?_0x136dad['attributes']:_0x37053f[_0x44aa('0x31')];if(!_0x5617ca[_0x44aa('0x34')][_0x44aa('0x39')](_0x44aa('0x3a'))){_0x136dad[_0x44aa('0x1c')]=qs[_0x44aa('0x1c')](_0x5617ca[_0x44aa('0x34')][_0x44aa('0x1c')]);_0x136dad['offset']=qs['offset'](_0x5617ca[_0x44aa('0x34')][_0x44aa('0x1b')]);}_0x136dad[_0x44aa('0x3b')]=qs[_0x44aa('0x3c')](_0x5617ca[_0x44aa('0x34')][_0x44aa('0x3c')]);_0x136dad[_0x44aa('0x3d')]=qs[_0x44aa('0x35')](_['pick'](_0x5617ca[_0x44aa('0x34')],_0x37053f[_0x44aa('0x35')]),_0x32a9eb);if(_0x5617ca[_0x44aa('0x34')][_0x44aa('0x3e')]){_0x136dad[_0x44aa('0x3d')]=_[_0x44aa('0x3f')](_0x136dad[_0x44aa('0x3d')],{'$or':_[_0x44aa('0x32')](_0x32a9eb,function(_0x3e471c){if(_0x3e471c['type']!==_0x44aa('0x40')){var _0x3252ea={};_0x3252ea[_0x3e471c['name']]={'$like':'%'+_0x5617ca[_0x44aa('0x34')][_0x44aa('0x3e')]+'%'};return _0x3252ea;}})});}_0x136dad=_['merge']({},_0x136dad,_0x5617ca[_0x44aa('0x41')]);var _0x1b769d={'where':_0x136dad[_0x44aa('0x3d')]};return db['Schedule'][_0x44aa('0x1e')](_0x1b769d)[_0x44aa('0x24')](function(_0x33facf){_0x5d8e2f[_0x44aa('0x1e')]=_0x33facf;if(_0x5617ca['query'][_0x44aa('0x42')]){_0x136dad[_0x44aa('0x43')]=[{'all':!![]}];}return db[_0x44aa('0x2c')][_0x44aa('0x44')](_0x136dad);})['then'](function(_0x51f183){_0x5d8e2f['rows']=_0x51f183;return _0x5d8e2f;})[_0x44aa('0x24')](respondWithFilteredResult(_0x401ae2,_0x136dad))['catch'](handleError(_0x401ae2,null));};exports[_0x44aa('0x45')]=function(_0x55bab5,_0x30355d){var _0x39c91b={'raw':![],'where':{'id':_0x55bab5['params']['id']}},_0xce5b87={};_0xce5b87[_0x44aa('0x31')]=_[_0x44aa('0x33')](db[_0x44aa('0x2c')]['rawAttributes']);_0xce5b87['query']=_[_0x44aa('0x33')](_0x55bab5[_0x44aa('0x34')]);_0xce5b87[_0x44aa('0x35')]=_[_0x44aa('0x37')](_0xce5b87['model'],_0xce5b87[_0x44aa('0x34')]);_0x39c91b[_0x44aa('0x36')]=_[_0x44aa('0x37')](_0xce5b87[_0x44aa('0x31')],qs[_0x44aa('0x46')](_0x55bab5[_0x44aa('0x34')][_0x44aa('0x46')]));_0x39c91b[_0x44aa('0x36')]=_0x39c91b[_0x44aa('0x36')][_0x44aa('0x38')]?_0x39c91b[_0x44aa('0x36')]:_0xce5b87['model'];if(_0x55bab5['query'][_0x44aa('0x42')]){_0x39c91b[_0x44aa('0x43')]=[{'all':!![]}];}_0x39c91b=_[_0x44aa('0x3f')]({},_0x39c91b,_0x55bab5[_0x44aa('0x41')]);return db[_0x44aa('0x2c')][_0x44aa('0x47')](_0x39c91b)['then'](handleEntityNotFound(_0x30355d,null))[_0x44aa('0x24')](respondWithResult(_0x30355d,null))[_0x44aa('0x48')](handleError(_0x30355d,null));};exports[_0x44aa('0x49')]=function(_0x5d1669,_0x448a01){return db[_0x44aa('0x2c')][_0x44aa('0x49')](_0x5d1669[_0x44aa('0x4a')],{})['then'](function(_0x285acb){var _0x3b2cc2=_0x5d1669[_0x44aa('0x4b')][_0x44aa('0x26')]({'plain':!![]});if(!_0x3b2cc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b2cc2[_0x44aa('0x4c')]==='user'){var _0x344aff=_0x285acb[_0x44aa('0x26')]({'plain':!![]});var _0x1a7f29=_0x44aa('0x27');return db[_0x44aa('0x4d')][_0x44aa('0x47')]({'where':{'name':_0x1a7f29,'userProfileId':_0x3b2cc2['userProfileId']},'raw':!![]})[_0x44aa('0x24')](function(_0x1c301a){if(_0x1c301a&&_0x1c301a[_0x44aa('0x4e')]===0x0){return db[_0x44aa('0x28')][_0x44aa('0x49')]({'name':_0x344aff[_0x44aa('0x2a')],'resourceId':_0x344aff['id'],'type':_0x1c301a[_0x44aa('0x2a')],'sectionId':_0x1c301a['id']},{})[_0x44aa('0x24')](function(){return _0x285acb;});}else{return _0x285acb;}})[_0x44aa('0x48')](function(_0x25742e){logger[_0x44aa('0x4f')](_0x44aa('0x50'),_0x25742e);throw _0x25742e;});}return _0x285acb;})[_0x44aa('0x24')](respondWithResult(_0x448a01,0xc9))[_0x44aa('0x48')](handleError(_0x448a01,null));};exports[_0x44aa('0x23')]=function(_0x10f6b7,_0x597df9){if(_0x10f6b7[_0x44aa('0x4a')]['id']){delete _0x10f6b7[_0x44aa('0x4a')]['id'];}return db[_0x44aa('0x2c')][_0x44aa('0x47')]({'where':{'id':_0x10f6b7[_0x44aa('0x51')]['id']}})[_0x44aa('0x24')](handleEntityNotFound(_0x597df9,null))[_0x44aa('0x24')](saveUpdates(_0x10f6b7['body'],null))['then'](respondWithResult(_0x597df9,null))[_0x44aa('0x48')](handleError(_0x597df9,null));};exports[_0x44aa('0x25')]=function(_0x3b1a3b,_0x306a3b){return db['Schedule']['find']({'where':{'id':_0x3b1a3b[_0x44aa('0x51')]['id']}})[_0x44aa('0x24')](handleEntityNotFound(_0x306a3b,null))['then'](removeEntity(_0x306a3b,null))[_0x44aa('0x48')](handleError(_0x306a3b,null));};exports[_0x44aa('0x52')]=function(_0x465580,_0x3be732,_0xcb2d1e){var _0x459629=require(_0x44aa('0x53'));return db[_0x44aa('0x2c')]['find']({'where':{'id':_0x465580[_0x44aa('0x51')]['id']},'raw':!![]})[_0x44aa('0x24')](handleEntityNotFound(_0x3be732,null))[_0x44aa('0x24')](function(){_0x459629[_0x44aa('0x52')](_0x465580[_0x44aa('0x51')]['id']);})[_0x44aa('0x24')](respondWithStatusCode(_0x3be732,null))['catch'](handleError(_0x3be732,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 438beac..bb191f8 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 _0x281b=['rimraf','./schedule.attributes','exports','define','tools_schedules','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x4ce187,_0x4467e5){var _0x2796c1=function(_0x48cb5f){while(--_0x48cb5f){_0x4ce187['push'](_0x4ce187['shift']());}};_0x2796c1(++_0x4467e5);}(_0x281b,0x94));var _0xb281=function(_0x54c583,_0xf8c8cb){_0x54c583=_0x54c583-0x0;var _0x14d514=_0x281b[_0x54c583];return _0x14d514;};'use strict';var _=require(_0xb281('0x0'));var util=require(_0xb281('0x1'));var logger=require(_0xb281('0x2'))(_0xb281('0x3'));var moment=require(_0xb281('0x4'));var BPromise=require(_0xb281('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb281('0x6'));var config=require('../../config/environment');var attributes=require(_0xb281('0x7'));module[_0xb281('0x8')]=function(_0x594386,_0x15edf3){return _0x594386[_0xb281('0x9')]('Schedule',attributes,{'tableName':_0xb281('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2125=['api','moment','request-promise','rimraf','../../config/environment','./schedule.attributes','exports','define','Schedule','tools_schedules','util','../../config/logger'];(function(_0x571078,_0x1c72c7){var _0x1d0b84=function(_0x30c4fc){while(--_0x30c4fc){_0x571078['push'](_0x571078['shift']());}};_0x1d0b84(++_0x1c72c7);}(_0x2125,0x112));var _0x5212=function(_0xed2e03,_0x32da34){_0xed2e03=_0xed2e03-0x0;var _0x5e2cbc=_0x2125[_0xed2e03];return _0x5e2cbc;};'use strict';var _=require('lodash');var util=require(_0x5212('0x0'));var logger=require(_0x5212('0x1'))(_0x5212('0x2'));var moment=require(_0x5212('0x3'));var BPromise=require('bluebird');var rp=require(_0x5212('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5212('0x5'));var config=require(_0x5212('0x6'));var attributes=require(_0x5212('0x7'));module[_0x5212('0x8')]=function(_0x3a7eaa,_0x3edcc6){return _0x3a7eaa[_0x5212('0x9')](_0x5212('0xa'),attributes,{'tableName':_0x5212('0xb'),'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 be2a82d..8a67575 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 _0x2c8a=['message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x6f68bb,_0xbf80b2){var _0xc680c2=function(_0x1dca8a){while(--_0x1dca8a){_0x6f68bb['push'](_0x6f68bb['shift']());}};_0xc680c2(++_0xbf80b2);}(_0x2c8a,0x191));var _0xa2c8=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x2c8a[_0x1969a7];return _0x3d665f;};'use strict';var _=require('lodash');var util=require(_0xa2c8('0x0'));var moment=require(_0xa2c8('0x1'));var BPromise=require(_0xa2c8('0x2'));var rs=require(_0xa2c8('0x3'));var fs=require('fs');var Redis=require(_0xa2c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa2c8('0x5'));var logger=require(_0xa2c8('0x6'))(_0xa2c8('0x7'));var config=require(_0xa2c8('0x8'));var jayson=require(_0xa2c8('0x9'));var client=jayson[_0xa2c8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43aca7,_0x30bb7c,_0x27c87e){return new BPromise(function(_0x12e7fb,_0x4ce17e){return client['request'](_0x43aca7,_0x27c87e)[_0xa2c8('0xb')](function(_0xa95baa){logger[_0xa2c8('0xc')](_0xa2c8('0xd'),_0x30bb7c,_0xa2c8('0xe'));logger['debug'](_0xa2c8('0xf'),_0x30bb7c,'request\x20sent',JSON['stringify'](_0xa95baa));if(_0xa95baa['error']){if(_0xa95baa[_0xa2c8('0x10')]['code']===0x1f4){logger[_0xa2c8('0x10')](_0xa2c8('0xd'),_0x30bb7c,_0xa95baa['error'][_0xa2c8('0x11')]);return _0x4ce17e(_0xa95baa['error'][_0xa2c8('0x11')]);}logger[_0xa2c8('0x10')](_0xa2c8('0xd'),_0x30bb7c,_0xa95baa[_0xa2c8('0x10')]['message']);return _0x12e7fb(_0xa95baa[_0xa2c8('0x10')][_0xa2c8('0x11')]);}else{logger[_0xa2c8('0xc')](_0xa2c8('0xd'),_0x30bb7c,'request\x20sent');_0x12e7fb(_0xa95baa['result'][_0xa2c8('0x11')]);}})[_0xa2c8('0x12')](function(_0x28ce86){logger[_0xa2c8('0x10')](_0xa2c8('0xd'),_0x30bb7c,_0x28ce86);_0x4ce17e(_0x28ce86);});});} \ No newline at end of file +var _0x03d5=['Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5b02c5,_0x1c4bc0){var _0x334967=function(_0x2e37d9){while(--_0x2e37d9){_0x5b02c5['push'](_0x5b02c5['shift']());}};_0x334967(++_0x1c4bc0);}(_0x03d5,0x11e));var _0x503d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x503d('0x0'));var util=require(_0x503d('0x1'));var moment=require(_0x503d('0x2'));var BPromise=require(_0x503d('0x3'));var rs=require(_0x503d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x503d('0x5'))['db'];var utils=require(_0x503d('0x6'));var logger=require('../../config/logger')(_0x503d('0x7'));var config=require(_0x503d('0x8'));var jayson=require(_0x503d('0x9'));var client=jayson[_0x503d('0xa')][_0x503d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fc042,_0x27ea1f,_0x31f441){return new BPromise(function(_0x4864e1,_0x1f06a3){return client[_0x503d('0xc')](_0x2fc042,_0x31f441)['then'](function(_0x4cf42a){logger['info'](_0x503d('0xd'),_0x27ea1f,_0x503d('0xe'));logger[_0x503d('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x27ea1f,'request\x20sent',JSON[_0x503d('0x10')](_0x4cf42a));if(_0x4cf42a[_0x503d('0x11')]){if(_0x4cf42a[_0x503d('0x11')][_0x503d('0x12')]===0x1f4){logger[_0x503d('0x11')](_0x503d('0xd'),_0x27ea1f,_0x4cf42a[_0x503d('0x11')][_0x503d('0x13')]);return _0x1f06a3(_0x4cf42a[_0x503d('0x11')][_0x503d('0x13')]);}logger[_0x503d('0x11')](_0x503d('0xd'),_0x27ea1f,_0x4cf42a[_0x503d('0x11')][_0x503d('0x13')]);return _0x4864e1(_0x4cf42a['error'][_0x503d('0x13')]);}else{logger[_0x503d('0x14')](_0x503d('0xd'),_0x27ea1f,_0x503d('0xe'));_0x4864e1(_0x4cf42a[_0x503d('0x15')][_0x503d('0x13')]);}})[_0x503d('0x16')](function(_0x5d30d6){logger['error']('Schedule,\x20%s,\x20%s',_0x27ea1f,_0x5d30d6);_0x1f06a3(_0x5d30d6);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 62d0e73..4213407 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 _0x424b=['/:id/download','download','post','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','/:id','show'];(function(_0x4c8439,_0x2003e8){var _0x3aeab6=function(_0x49fb03){while(--_0x49fb03){_0x4c8439['push'](_0x4c8439['shift']());}};_0x3aeab6(++_0x2003e8);}(_0x424b,0x70));var _0xb424=function(_0x2b6eae,_0xd45fa9){_0x2b6eae=_0x2b6eae-0x0;var _0x2ed981=_0x424b[_0x2b6eae];return _0x2ed981;};'use strict';var multer=require(_0xb424('0x0'));var util=require(_0xb424('0x1'));var path=require('path');var timeout=require(_0xb424('0x2'));var express=require(_0xb424('0x3'));var router=express[_0xb424('0x4')]();var fs_extra=require(_0xb424('0x5'));var auth=require(_0xb424('0x6'));var interaction=require(_0xb424('0x7'));var config=require('../../config/environment');var controller=require(_0xb424('0x8'));router[_0xb424('0x9')]('/',auth[_0xb424('0xa')](),controller['index']);router['get'](_0xb424('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xb424('0x9')](_0xb424('0xc'),auth[_0xb424('0xa')](),controller[_0xb424('0xd')]);router['get'](_0xb424('0xe'),auth[_0xb424('0xa')](),controller[_0xb424('0xf')]);router[_0xb424('0x10')]('/',auth[_0xb424('0xa')](),controller['create']);router[_0xb424('0x11')](_0xb424('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xb424('0x12')](_0xb424('0xc'),auth[_0xb424('0xa')](),controller[_0xb424('0x13')]);module[_0xb424('0x14')]=router; \ No newline at end of file +var _0x01c0=['show','/:id/download','download','post','create','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0x01c0,0x1ec));var _0x001c=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x01c0[_0x819464];return _0x49dcc0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x001c('0x0'));var timeout=require('connect-timeout');var express=require(_0x001c('0x1'));var router=express[_0x001c('0x2')]();var fs_extra=require(_0x001c('0x3'));var auth=require(_0x001c('0x4'));var interaction=require(_0x001c('0x5'));var config=require(_0x001c('0x6'));var controller=require('./screenRecording.controller');router[_0x001c('0x7')]('/',auth[_0x001c('0x8')](),controller['index']);router['get'](_0x001c('0x9'),auth[_0x001c('0x8')](),controller[_0x001c('0xa')]);router['get'](_0x001c('0xb'),auth['isAuthenticated'](),controller[_0x001c('0xc')]);router[_0x001c('0x7')](_0x001c('0xd'),auth[_0x001c('0x8')](),controller[_0x001c('0xe')]);router[_0x001c('0xf')]('/',auth['isAuthenticated'](),controller[_0x001c('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x001c('0x11')]);router[_0x001c('0x12')](_0x001c('0xb'),auth[_0x001c('0x8')](),controller[_0x001c('0x13')]);module[_0x001c('0x14')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 874fefe..b7fbe90 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 _0xb515=['path','../../config/environment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format','createdAt','updatedAt','sequelize'];(function(_0x3a675b,_0x4e5df2){var _0x2e7f72=function(_0x30749c){while(--_0x30749c){_0x3a675b['push'](_0x3a675b['shift']());}};_0x2e7f72(++_0x4e5df2);}(_0xb515,0x1b8));var _0x5b51=function(_0x4179e2,_0xf2dbb){_0x4179e2=_0x4179e2-0x0;var _0x24cb50=_0xb515[_0x4179e2];return _0x24cb50;};'use strict';var Sequelize=require(_0x5b51('0x0'));var moment=require('moment');var path=require(_0x5b51('0x1'));var config=require(_0x5b51('0x2'));module[_0x5b51('0x3')]={'format':{'type':Sequelize[_0x5b51('0x4')],'get':function(){return this[_0x5b51('0x5')](_0x5b51('0x6'))?path[_0x5b51('0x7')](this[_0x5b51('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x5b51('0x8')]},'channel':{'type':Sequelize[_0x5b51('0x8')]},'value':{'type':Sequelize[_0x5b51('0x8')],'set':function(_0x293d82){var _0x396b3f=_0x293d82[_0x5b51('0x9')](/\\/g,'/');this[_0x5b51('0xa')](_0x5b51('0x6'),_0x396b3f);}},'rating':{'type':Sequelize[_0x5b51('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5b51('0xb')],'set':function(_0x1085e6){this[_0x5b51('0xa')]('startedAt',moment()[_0x5b51('0xc')](_0x1085e6,'ms'));this[_0x5b51('0xa')](_0x5b51('0xd'),moment());this[_0x5b51('0xa')](_0x5b51('0xe'),_0x1085e6);}},'startedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this['getDataValue']('startedAt'))['format'](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'closedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')]('closedAt'))[_0x5b51('0x12')](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'createdAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')](_0x5b51('0x13')))[_0x5b51('0x12')](_0x5b51('0x10'))[_0x5b51('0x11')]();}},'updatedAt':{'type':Sequelize[_0x5b51('0xf')],'get':function(){return moment(this[_0x5b51('0x5')](_0x5b51('0x14')))['format'](_0x5b51('0x10'))['toString']();}}}; \ No newline at end of file +var _0xd26f=['createdAt','updatedAt','sequelize','moment','exports','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE'];(function(_0x3244fe,_0x438f5a){var _0x1518c4=function(_0xb8e89e){while(--_0xb8e89e){_0x3244fe['push'](_0x3244fe['shift']());}};_0x1518c4(++_0x438f5a);}(_0xd26f,0x113));var _0xfd26=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xd26f[_0x15bc81];return _0x59440e;};'use strict';var Sequelize=require(_0xfd26('0x0'));var moment=require(_0xfd26('0x1'));var path=require('path');var config=require('../../config/environment');module[_0xfd26('0x2')]={'format':{'type':Sequelize[_0xfd26('0x3')],'get':function(){return this[_0xfd26('0x4')](_0xfd26('0x5'))?path[_0xfd26('0x6')](this[_0xfd26('0x4')](_0xfd26('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0xfd26('0x7')]},'channel':{'type':Sequelize[_0xfd26('0x7')]},'value':{'type':Sequelize['STRING'],'set':function(_0x22b353){var _0x3c148d=_0x22b353[_0xfd26('0x8')](/\\/g,'/');this[_0xfd26('0x9')](_0xfd26('0x5'),_0x3c148d);}},'rating':{'type':Sequelize[_0xfd26('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0xcf2fdb){this[_0xfd26('0x9')](_0xfd26('0xb'),moment()[_0xfd26('0xc')](_0xcf2fdb,'ms'));this[_0xfd26('0x9')](_0xfd26('0xd'),moment());this['setDataValue'](_0xfd26('0xe'),_0xcf2fdb);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xfd26('0x4')]('startedAt'))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xfd26('0x4')](_0xfd26('0xd')))[_0xfd26('0xf')](_0xfd26('0x10'))[_0xfd26('0x11')]();}},'createdAt':{'type':Sequelize[_0xfd26('0x12')],'get':function(){return moment(this[_0xfd26('0x4')](_0xfd26('0x13')))[_0xfd26('0xf')](_0xfd26('0x10'))[_0xfd26('0x11')]();}},'updatedAt':{'type':Sequelize[_0xfd26('0x12')],'get':function(){return moment(this[_0xfd26('0x4')](_0xfd26('0x14')))[_0xfd26('0xf')]('MM-DD-YYYY\x20HH:mm')[_0xfd26('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index e31d912..63b9bf1 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 _0x55ca=['sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','ScreenRecording','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','merge','where','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','join','root','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','moment','bluebird','util','path'];(function(_0x184bc5,_0x494653){var _0x4ac5e4=function(_0x3bfc7d){while(--_0x3bfc7d){_0x184bc5['push'](_0x184bc5['shift']());}};_0x4ac5e4(++_0x494653);}(_0x55ca,0x126));var _0xa55c=function(_0x43762c,_0x48ff0f){_0x43762c=_0x43762c-0x0;var _0x4a85e0=_0x55ca[_0x43762c];return _0x4a85e0;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x2d')](_['map'](_0x201941,_0xa55c('0x25')),[_0xa55c('0x2e')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x906caa[_0xa55c('0x2f')]);_0x22f6b6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2f')]);_0x1377b0[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x22f6b6['model'],qs['fields'](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x1377b0['attributes']=_0x1377b0[_0xa55c('0x33')][_0xa55c('0x35')]?_0x1377b0[_0xa55c('0x33')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2f')][_0xa55c('0x36')](_0xa55c('0x37'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa['query']['limit']);_0x1377b0['offset']=qs[_0xa55c('0x1a')](_0x906caa[_0xa55c('0x2f')][_0xa55c('0x1a')]);}_0x1377b0['order']=qs[_0xa55c('0x38')](_0x906caa['query'][_0xa55c('0x38')]);_0x1377b0['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x39')](_0x906caa[_0xa55c('0x2f')],_0x22f6b6['filters']),_0x201941);if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3a')]){_0x1377b0['where']=_[_0xa55c('0x3b')](_0x1377b0[_0xa55c('0x3c')],{'$or':_['map'](_0x201941,function(_0x529ff8){if(_0x529ff8[_0xa55c('0x2a')]!=='VIRTUAL'){var _0x1e75dc={};_0x1e75dc[_0x529ff8[_0xa55c('0x25')]]={'$like':'%'+_0x906caa['query']['filter']+'%'};return _0x1e75dc;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x3b3308={'where':_0x1377b0[_0xa55c('0x3c')]};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x3b3308)[_0xa55c('0x20')](function(_0x56d17c){_0x1b8388[_0xa55c('0x1d')]=_0x56d17c;if(_0x906caa[_0xa55c('0x2f')][_0xa55c('0x3d')]){_0x1377b0[_0xa55c('0x3e')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0x1377b0);})['then'](function(_0x386e34){_0x1b8388['rows']=_0x386e34;return _0x1b8388;})['then'](respondWithFilteredResult(_0x5d940d,_0x1377b0))[_0xa55c('0x40')](handleError(_0x5d940d,null));};exports[_0xa55c('0x41')]=function(_0x496920,_0x2bd98b){var _0x508bd3={'raw':![],'where':{'id':_0x496920[_0xa55c('0x42')]['id']}},_0x5f25f7={};_0x5f25f7[_0xa55c('0x2c')]=_[_0xa55c('0x30')](db['ScreenRecording'][_0xa55c('0x43')]);_0x5f25f7[_0xa55c('0x2f')]=_['keys'](_0x496920[_0xa55c('0x2f')]);_0x5f25f7['filters']=_[_0xa55c('0x32')](_0x5f25f7[_0xa55c('0x2c')],_0x5f25f7['query']);_0x508bd3[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5f25f7['model'],qs[_0xa55c('0x34')](_0x496920[_0xa55c('0x2f')][_0xa55c('0x34')]));_0x508bd3['attributes']=_0x508bd3[_0xa55c('0x33')]['length']?_0x508bd3[_0xa55c('0x33')]:_0x5f25f7[_0xa55c('0x2c')];if(_0x496920[_0xa55c('0x2f')]['includeAll']){_0x508bd3[_0xa55c('0x3e')]=[{'all':!![]}];}_0x508bd3=_[_0xa55c('0x3b')]({},_0x508bd3,_0x496920['options']);return db[_0xa55c('0x29')][_0xa55c('0x44')](_0x508bd3)['then'](handleEntityNotFound(_0x2bd98b,null))[_0xa55c('0x20')](respondWithResult(_0x2bd98b,null))[_0xa55c('0x40')](handleError(_0x2bd98b,null));};exports['create']=function(_0x46f839,_0x81cee8){return db[_0xa55c('0x29')][_0xa55c('0x45')](_0x46f839['body'],{})[_0xa55c('0x20')](respondWithResult(_0x81cee8,0xc9))['catch'](handleError(_0x81cee8,null));};exports[_0xa55c('0x1f')]=function(_0x213100,_0x194a79){if(_0x213100['body']['id']){delete _0x213100[_0xa55c('0x46')]['id'];}delete _0x213100[_0xa55c('0x46')]['duration'];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x47')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x48')];delete _0x213100[_0xa55c('0x46')][_0xa55c('0x49')];return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x213100[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x194a79,null))['then'](saveUpdates(_0x213100[_0xa55c('0x46')],null))[_0xa55c('0x20')](respondWithResult(_0x194a79,null))[_0xa55c('0x40')](handleError(_0x194a79,null));};exports['describe']=function(_0x4c3095,_0x35bf0a){return db['ScreenRecording'][_0xa55c('0x4a')]()['then'](respondWithResult(_0x35bf0a,null))[_0xa55c('0x40')](handleError(_0x35bf0a,null));};exports[_0xa55c('0x4b')]=function(_0x181802,_0x3f9313,_0x2ecf79){var _0x5b1cf3=require(_0xa55c('0x4c'));var _0x4607ca=![];var _0x4b85cc={};if(_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]&&_0x181802[_0xa55c('0x2f')][_0xa55c('0x2a')]==='uniqueid'){_0x4b85cc['uniqueid']=_0x181802[_0xa55c('0x42')]['id'];}else{_0x4b85cc['id']=_0x181802[_0xa55c('0x42')]['id'];}return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':_0x4b85cc,'attributes':['id','value'],'raw':!![]})[_0xa55c('0x20')](handleEntityNotFound(_0x3f9313,null))['then'](function(_0x2742e4){if(_0x2742e4){var _0x437ced=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x2742e4['value']);var _0x1cb73b=util['format'](_0xa55c('0x50'),_0x437ced);if(fs[_0xa55c('0x51')](_0x1cb73b)){_0x4607ca=!![];return _0x5b1cf3[_0xa55c('0x52')](_0x1cb73b,_0x437ced,config[_0xa55c('0x53')][_0xa55c('0x54')])[_0xa55c('0x20')](function(){return _0x2742e4;});}return _0x2742e4;}})[_0xa55c('0x20')](function(_0x53e2be){if(_0x53e2be){var _0x450567=path[_0xa55c('0x4d')](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x53e2be[_0xa55c('0x49')]);if(!fs['existsSync'](_0x450567)){throw new db[(_0xa55c('0x55'))][(_0xa55c('0x56'))](_0xa55c('0x57'));}if(_0x53e2be[_0xa55c('0x58')]){return _0x3f9313[_0xa55c('0x4b')](_0x450567,_0x53e2be['filename']+path[_0xa55c('0x59')](_0x450567),function(){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}else{return _0x3f9313[_0xa55c('0x4b')](_0x450567,function(_0x16d9b2){if(_0x4607ca){fs[_0xa55c('0x5a')](_0x450567);}});}}})['catch'](function(_0x419fc3){if(_0x419fc3['message']===_0xa55c('0x57')){_0x3f9313['status'](0x194)[_0xa55c('0x26')]('Not\x20found');}else{return handleError(_0x3f9313,null);}});};exports[_0xa55c('0x5b')]=function(_0x1333da,_0x21d6b4){return db[_0xa55c('0x29')][_0xa55c('0x44')]({'where':{'id':_0x1333da[_0xa55c('0x42')]['id']}})[_0xa55c('0x20')](function(_0x2f2226){if(_[_0xa55c('0x5c')](_0x2f2226)){throw new ReferenceError(_0xa55c('0x5d'));}return _0x2f2226;})['then'](function(_0x150a07){var _0x311bb9=path['join'](config[_0xa55c('0x4e')],_0xa55c('0x4f'),_0x150a07[_0xa55c('0x49')]);logger[_0xa55c('0x5e')](_0xa55c('0x5f'),_0x311bb9);if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger['info'](_0xa55c('0x60')+_0x311bb9+_0xa55c('0x61'));fs[_0xa55c('0x62')](_0x311bb9);}_0x311bb9=_0x311bb9+_0xa55c('0x63');if(!_[_0xa55c('0x5c')](_0x150a07[_0xa55c('0x49')])&&fs[_0xa55c('0x51')](_0x311bb9)){logger[_0xa55c('0x5e')](_0xa55c('0x60')+_0x311bb9+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xa55c('0x62')](_0x311bb9);}return _0x150a07;})[_0xa55c('0x20')](function(_0x40c56a){if(!_0x40c56a)throw new InternalError();return _0x40c56a[_0xa55c('0x5b')]();})[_0xa55c('0x20')](function(){_0x21d6b4[_0xa55c('0x18')](0xcc)[_0xa55c('0x21')]();})[_0xa55c('0x40')](handleError(_0x21d6b4,null));}; \ No newline at end of file +var _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x008c,0x188));var _0xc008=function(_0x2f4748,_0x24af55){_0x2f4748=_0x2f4748-0x0;var _0x18eece=_0x008c[_0x2f4748];return _0x18eece;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index e8129b6..b91cbf4 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 _0xe83d=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x110596,_0x1faae7){var _0x51fef2=function(_0x443662){while(--_0x443662){_0x110596['push'](_0x110596['shift']());}};_0x51fef2(++_0x1faae7);}(_0xe83d,0xfa));var _0xde83=function(_0xca2782,_0x4b4860){_0xca2782=_0xca2782-0x0;var _0x1e30be=_0xe83d[_0xca2782];return _0x1e30be;};'use strict';var _=require(_0xde83('0x0'));var util=require(_0xde83('0x1'));var logger=require(_0xde83('0x2'))(_0xde83('0x3'));var moment=require('moment');var BPromise=require(_0xde83('0x4'));var rp=require(_0xde83('0x5'));var fs=require('fs');var path=require(_0xde83('0x6'));var rimraf=require(_0xde83('0x7'));var config=require(_0xde83('0x8'));var attributes=require('./screenRecording.attributes');module[_0xde83('0x9')]=function(_0x6e7812,_0x316bfb){return _0x6e7812[_0xde83('0xa')](_0xde83('0xb'),attributes,{'tableName':_0xde83('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xde83('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7bc=['path','../../config/environment','./screenRecording.attributes','exports','screen_recordings','interactionid','lodash','util','../../config/logger','api','request-promise'];(function(_0x2114d1,_0x268b13){var _0x2299ae=function(_0x316b1b){while(--_0x316b1b){_0x2114d1['push'](_0x2114d1['shift']());}};_0x2299ae(++_0x268b13);}(_0xd7bc,0x1d4));var _0xcd7b=function(_0x4b4f24,_0x5654a8){_0x4b4f24=_0x4b4f24-0x0;var _0x1c13d4=_0xd7bc[_0x4b4f24];return _0x1c13d4;};'use strict';var _=require(_0xcd7b('0x0'));var util=require(_0xcd7b('0x1'));var logger=require(_0xcd7b('0x2'))(_0xcd7b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcd7b('0x4'));var fs=require('fs');var path=require(_0xcd7b('0x5'));var rimraf=require('rimraf');var config=require(_0xcd7b('0x6'));var attributes=require(_0xcd7b('0x7'));module[_0xcd7b('0x8')]=function(_0x3151fb,_0x417219){return _0x3151fb['define']('ScreenRecording',attributes,{'tableName':_0xcd7b('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0xcd7b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index baec663..cf856f9 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 _0x5031=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util'];(function(_0x122354,_0x5bba72){var _0xb68790=function(_0x539fda){while(--_0x539fda){_0x122354['push'](_0x122354['shift']());}};_0xb68790(++_0x5bba72);}(_0x5031,0xaf));var _0x1503=function(_0xac7c29,_0x3374f4){_0xac7c29=_0xac7c29-0x0;var _0x4b5ce8=_0x5031[_0xac7c29];return _0x4b5ce8;};'use strict';var _=require('lodash');var util=require(_0x1503('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1503('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1503('0x2'))['db'];var utils=require(_0x1503('0x3'));var logger=require(_0x1503('0x4'))(_0x1503('0x5'));var config=require(_0x1503('0x6'));var jayson=require(_0x1503('0x7'));var client=jayson[_0x1503('0x8')][_0x1503('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x382adc,_0x328542,_0x30a871){return new BPromise(function(_0xfc39c6,_0x427470){return client[_0x1503('0xa')](_0x382adc,_0x30a871)[_0x1503('0xb')](function(_0x2cf23e){logger[_0x1503('0xc')](_0x1503('0xd'),_0x328542,'request\x20sent');logger[_0x1503('0xe')](_0x1503('0xf'),_0x328542,_0x1503('0x10'),JSON[_0x1503('0x11')](_0x2cf23e));if(_0x2cf23e[_0x1503('0x12')]){if(_0x2cf23e['error'][_0x1503('0x13')]===0x1f4){logger[_0x1503('0x12')](_0x1503('0xd'),_0x328542,_0x2cf23e[_0x1503('0x12')][_0x1503('0x14')]);return _0x427470(_0x2cf23e[_0x1503('0x12')]['message']);}logger[_0x1503('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x328542,_0x2cf23e[_0x1503('0x12')][_0x1503('0x14')]);return _0xfc39c6(_0x2cf23e['error']['message']);}else{logger[_0x1503('0xc')](_0x1503('0xd'),_0x328542,'request\x20sent');_0xfc39c6(_0x2cf23e[_0x1503('0x15')][_0x1503('0x14')]);}})['catch'](function(_0x3c9de1){logger['error'](_0x1503('0xd'),_0x328542,_0x3c9de1);_0x427470(_0x3c9de1);});});} \ No newline at end of file +var _0x168a=['info','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','ScreenRecording,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x402637,_0x5ab36d){var _0x3347b4=function(_0x3d9325){while(--_0x3d9325){_0x402637['push'](_0x402637['shift']());}};_0x3347b4(++_0x5ab36d);}(_0x168a,0x1c3));var _0xa168=function(_0x1ee7a4,_0x47eb61){_0x1ee7a4=_0x1ee7a4-0x0;var _0x5319d7=_0x168a[_0x1ee7a4];return _0x5319d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa168('0x0'));var BPromise=require(_0xa168('0x1'));var rs=require(_0xa168('0x2'));var fs=require('fs');var Redis=require(_0xa168('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa168('0x4'))(_0xa168('0x5'));var config=require(_0xa168('0x6'));var jayson=require(_0xa168('0x7'));var client=jayson[_0xa168('0x8')][_0xa168('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365196,_0x2eb881,_0x45fe70){return new BPromise(function(_0x50c01e,_0x10ce3c){return client['request'](_0x365196,_0x45fe70)[_0xa168('0xa')](function(_0x1d7561){logger[_0xa168('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x2eb881,_0xa168('0xc'));logger[_0xa168('0xd')](_0xa168('0xe'),_0x2eb881,'request\x20sent',JSON[_0xa168('0xf')](_0x1d7561));if(_0x1d7561['error']){if(_0x1d7561['error'][_0xa168('0x10')]===0x1f4){logger[_0xa168('0x11')](_0xa168('0x12'),_0x2eb881,_0x1d7561['error'][_0xa168('0x13')]);return _0x10ce3c(_0x1d7561[_0xa168('0x11')]['message']);}logger[_0xa168('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x2eb881,_0x1d7561[_0xa168('0x11')]['message']);return _0x50c01e(_0x1d7561[_0xa168('0x11')][_0xa168('0x13')]);}else{logger['info'](_0xa168('0x12'),_0x2eb881,_0xa168('0xc'));_0x50c01e(_0x1d7561[_0xa168('0x14')][_0xa168('0x13')]);}})[_0xa168('0x15')](function(_0x48b8cc){logger['error'](_0xa168('0x12'),_0x2eb881,_0x48b8cc);_0x10ce3c(_0x48b8cc);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 874e8ed..45555de 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 _0x6694=['format','%s%s','logo','extname','post','single','file','addLogo','logologin','originalname','/:id/logo_login','preferred','put','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/'];(function(_0x4315c6,_0x4b9296){var _0x36b60b=function(_0x302d0d){while(--_0x302d0d){_0x4315c6['push'](_0x4315c6['shift']());}};_0x36b60b(++_0x4b9296);}(_0x6694,0x1f3));var _0x4669=function(_0x403981,_0x5164d8){_0x403981=_0x403981-0x0;var _0x2f8df6=_0x6694[_0x403981];return _0x2f8df6;};'use strict';var multer=require('multer');var util=require(_0x4669('0x0'));var path=require(_0x4669('0x1'));var timeout=require(_0x4669('0x2'));var express=require(_0x4669('0x3'));var router=express[_0x4669('0x4')]();var fs_extra=require(_0x4669('0x5'));var auth=require(_0x4669('0x6'));var interaction=require(_0x4669('0x7'));var config=require(_0x4669('0x8'));var controller=require(_0x4669('0x9'));router[_0x4669('0xa')]('/',auth[_0x4669('0xb')](),controller[_0x4669('0xc')]);router[_0x4669('0xa')](_0x4669('0xd'),controller[_0x4669('0xe')]);router['get'](_0x4669('0xf'),controller[_0x4669('0x10')]);router[_0x4669('0xa')](_0x4669('0x11'),controller[_0x4669('0x12')]);router[_0x4669('0xa')]('/:id/logo_login',controller[_0x4669('0x13')]);router[_0x4669('0xa')](_0x4669('0x14'),controller['gdpr']);router[_0x4669('0xa')](_0x4669('0x15'),controller[_0x4669('0x16')]);router[_0x4669('0xa')](_0x4669('0x17'),controller[_0x4669('0x18')]);var upload=multer({'storage':multer[_0x4669('0x19')]({'destination':function(_0x295958,_0x470e75,_0x3d8a65){_0x3d8a65(null,path[_0x4669('0x1a')](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x2113d0,_0x2b0d94,_0x39488b){_0x39488b(null,util[_0x4669('0x1d')](_0x4669('0x1e'),_0x4669('0x1f'),path[_0x4669('0x20')](_0x2b0d94['originalname'])));}})});router[_0x4669('0x21')](_0x4669('0x11'),upload[_0x4669('0x22')](_0x4669('0x23')),controller[_0x4669('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2a1f4c,_0x2b124a,_0x409781){_0x409781(null,path['join'](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x5df35a,_0x2676e2,_0x21d9f9){_0x21d9f9(null,util[_0x4669('0x1d')](_0x4669('0x1e'),_0x4669('0x25'),path['extname'](_0x2676e2[_0x4669('0x26')])));}})});router['post'](_0x4669('0x27'),upload[_0x4669('0x22')](_0x4669('0x23')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x4669('0x19')]({'destination':function(_0x362117,_0x5a0ad4,_0x1330e8){_0x1330e8(null,path[_0x4669('0x1a')](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x29b0ba,_0x287297,_0x436494){_0x436494(null,util[_0x4669('0x1d')]('%s%s',_0x4669('0x28'),path['extname'](_0x287297[_0x4669('0x26')])));}})});router[_0x4669('0x21')](_0x4669('0x15'),upload['single']('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0x4669('0x19')]({'destination':function(_0x28f3ce,_0x11db8c,_0x3a61f7){_0x3a61f7(null,path[_0x4669('0x1a')](config[_0x4669('0x1b')],_0x4669('0x1c')));},'filename':function(_0x52183d,_0x5c5814,_0x574dd5){_0x574dd5(null,util[_0x4669('0x1d')](_0x4669('0x1e'),'favicon',path[_0x4669('0x20')](_0x5c5814['originalname'])));}})});router['post'](_0x4669('0x17'),upload[_0x4669('0x22')](_0x4669('0x23')),controller['addFavicon']);router[_0x4669('0x29')](_0x4669('0xf'),auth[_0x4669('0xb')](),controller[_0x4669('0x2a')]);module[_0x4669('0x2b')]=router; \ No newline at end of file +var _0xb987=['/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','diskStorage','logologin','addPreferred','favicon','addFavicon','put','util','path','express','Router','../../components/auth/service','get','isAuthenticated','/now','getDate','/:id','show','/:id/logo','getLogo'];(function(_0x22a71d,_0x216142){var _0x362280=function(_0x302923){while(--_0x302923){_0x22a71d['push'](_0x22a71d['shift']());}};_0x362280(++_0x216142);}(_0xb987,0x1bb));var _0x7b98=function(_0x4f435d,_0x4f382a){_0x4f435d=_0x4f435d-0x0;var _0xd2d7ad=_0xb987[_0x4f435d];return _0xd2d7ad;};'use strict';var multer=require('multer');var util=require(_0x7b98('0x0'));var path=require(_0x7b98('0x1'));var timeout=require('connect-timeout');var express=require(_0x7b98('0x2'));var router=express[_0x7b98('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7b98('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x7b98('0x5')]('/',auth[_0x7b98('0x6')](),controller['index']);router[_0x7b98('0x5')](_0x7b98('0x7'),controller[_0x7b98('0x8')]);router[_0x7b98('0x5')](_0x7b98('0x9'),controller[_0x7b98('0xa')]);router[_0x7b98('0x5')](_0x7b98('0xb'),controller[_0x7b98('0xc')]);router[_0x7b98('0x5')](_0x7b98('0xd'),controller[_0x7b98('0xe')]);router['get'](_0x7b98('0xf'),controller[_0x7b98('0x10')]);router[_0x7b98('0x5')](_0x7b98('0x11'),controller[_0x7b98('0x12')]);router['get'](_0x7b98('0x13'),controller[_0x7b98('0x14')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3746df,_0x45b553,_0x54380b){_0x54380b(null,path[_0x7b98('0x15')](config[_0x7b98('0x16')],_0x7b98('0x17')));},'filename':function(_0x47ca21,_0x2d11e1,_0x4abe9a){_0x4abe9a(null,util[_0x7b98('0x18')](_0x7b98('0x19'),'logo',path[_0x7b98('0x1a')](_0x2d11e1[_0x7b98('0x1b')])));}})});router[_0x7b98('0x1c')](_0x7b98('0xb'),upload[_0x7b98('0x1d')](_0x7b98('0x1e')),controller[_0x7b98('0x1f')]);var upload=multer({'storage':multer[_0x7b98('0x20')]({'destination':function(_0x97a04a,_0xb5614d,_0x3b141a){_0x3b141a(null,path[_0x7b98('0x15')](config[_0x7b98('0x16')],_0x7b98('0x17')));},'filename':function(_0x479759,_0x44ea61,_0x1c14a5){_0x1c14a5(null,util[_0x7b98('0x18')](_0x7b98('0x19'),_0x7b98('0x21'),path[_0x7b98('0x1a')](_0x44ea61[_0x7b98('0x1b')])));}})});router[_0x7b98('0x1c')](_0x7b98('0xd'),upload[_0x7b98('0x1d')](_0x7b98('0x1e')),controller['addLogoLogin']);var upload=multer({'storage':multer[_0x7b98('0x20')]({'destination':function(_0x38c54a,_0x2092f1,_0x55b30d){_0x55b30d(null,path[_0x7b98('0x15')](config[_0x7b98('0x16')],_0x7b98('0x17')));},'filename':function(_0x4118ac,_0x24185f,_0x38e51d){_0x38e51d(null,util[_0x7b98('0x18')](_0x7b98('0x19'),'preferred',path[_0x7b98('0x1a')](_0x24185f['originalname'])));}})});router['post'](_0x7b98('0x11'),upload['single'](_0x7b98('0x1e')),controller[_0x7b98('0x22')]);var upload=multer({'storage':multer[_0x7b98('0x20')]({'destination':function(_0x37c2ce,_0x5a37d0,_0x47c484){_0x47c484(null,path[_0x7b98('0x15')](config[_0x7b98('0x16')],_0x7b98('0x17')));},'filename':function(_0x26c796,_0x708ffa,_0x253ca3){_0x253ca3(null,util[_0x7b98('0x18')](_0x7b98('0x19'),_0x7b98('0x23'),path[_0x7b98('0x1a')](_0x708ffa[_0x7b98('0x1b')])));}})});router[_0x7b98('0x1c')](_0x7b98('0x13'),upload[_0x7b98('0x1d')](_0x7b98('0x1e')),controller[_0x7b98('0x24')]);router[_0x7b98('0x25')]('/:id',auth[_0x7b98('0x6')](),controller['update']);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 8b2822d..351afe0 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 _0xfb23=['min_internal','INTEGER','/var/opt/motion2/server/files/sounds/converted','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports'];(function(_0x2093e3,_0x8eb650){var _0x841d6=function(_0x2b386b){while(--_0x2b386b){_0x2093e3['push'](_0x2093e3['shift']());}};_0x841d6(++_0x8eb650);}(_0xfb23,0x102));var _0x3fb2=function(_0x3b3fae,_0x522f53){_0x3b3fae=_0x3b3fae-0x0;var _0x10b2f0=_0xfb23[_0x3b3fae];return _0x10b2f0;};'use strict';var Sequelize=require(_0x3fb2('0x0'));module[_0x3fb2('0x1')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0x3fb2('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x3fb2('0x3')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':_0x3fb2('0x4')},'logo':{'type':Sequelize[_0x3fb2('0x5')]},'defaultLogo':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x3fb2('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x3fb2('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x3fb2('0x5')]},'turnaddr':{'type':Sequelize[_0x3fb2('0x5')]},'turnusername':{'type':Sequelize[_0x3fb2('0x5')]},'turnpassword':{'type':Sequelize[_0x3fb2('0x5')]},'pageTitle':{'type':Sequelize[_0x3fb2('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x3fb2('0x3')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x3fb2('0x5')],'defaultValue':_0x3fb2('0x7')},'enableEmailPreview':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x3fb2('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x3fb2('0x5')]},'defaultPreferred':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x3fb2('0x3')]},'transcribeRegion':{'type':Sequelize[_0x3fb2('0x5')]},'sentiment':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x3fb2('0x3')]},'sentimentRegion':{'type':Sequelize[_0x3fb2('0x5')]},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x3fb2('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x3fb2('0x3')](0x2)[_0x3fb2('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x3fb2('0x3')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x3fb2('0x6')],'defaultValue':![]},'limitTabs':{'type':Sequelize['INTEGER'],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x9df5=['STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal'];(function(_0x137059,_0x3fbaa3){var _0x4453d2=function(_0x35849d){while(--_0x35849d){_0x137059['push'](_0x137059['shift']());}};_0x4453d2(++_0x3fbaa3);}(_0x9df5,0x1be));var _0x59df=function(_0x2fafdf,_0xc956a4){_0x2fafdf=_0x2fafdf-0x0;var _0x570f8a=_0x9df5[_0x2fafdf];return _0x570f8a;};'use strict';var Sequelize=require(_0x59df('0x0'));module[_0x59df('0x1')]={'min_internal':{'type':Sequelize[_0x59df('0x2')](0xb),'unique':_0x59df('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x59df('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x59df('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x59df('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x59df('0x4')]},'defaultLogo':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x59df('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x59df('0x4')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x59df('0x4')]},'pageTitle':{'type':Sequelize[_0x59df('0x4')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x59df('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x59df('0x6')},'enableEmailPreview':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x59df('0x4')],'defaultValue':_0x59df('0x7')},'chatTimeout':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x59df('0x4')]},'defaultPreferred':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x59df('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x59df('0x4')]},'sentiment':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x59df('0x2')]},'sentimentRegion':{'type':Sequelize[_0x59df('0x4')]},'language':{'type':Sequelize[_0x59df('0x4')]},'bucket':{'type':Sequelize[_0x59df('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x59df('0x2')](0x2)[_0x59df('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x59df('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x59df('0x2')](0x2)[_0x59df('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x59df('0x2')](0x2)[_0x59df('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x59df('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x59df('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x59df('0x5')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index fd6c01f..f605c9d 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 _0x6361=['bluebird','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','request','info','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','save','then','destroy','name','index','Setting','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','show','params','keys','rawAttributes','update','body','find','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','toLower','default_logo.svg','default','custom','Sequelize','ValidationError','upperFirst','download','getLogoLogin','server/files/images/logos','defaultLogo','root','default_loginLogo.svg','gdpr','securePassword','addPreferred','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','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6361,0x76));var _0x1636=function(_0xbf689f,_0x37264a){_0xbf689f=_0xbf689f-0x0;var _0x5a11db=_0x6361[_0xbf689f];return _0x5a11db;};'use strict';var emlformat=require(_0x1636('0x0'));var rimraf=require(_0x1636('0x1'));var zipdir=require(_0x1636('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1636('0x3'));var moment=require(_0x1636('0x4'));var BPromise=require(_0x1636('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x1636('0x6'));var ejs=require(_0x1636('0x7'));var fs=require('fs');var fs_extra=require(_0x1636('0x8'));var _=require(_0x1636('0x9'));var squel=require('squel');var crypto=require(_0x1636('0xa'));var jsforce=require(_0x1636('0xb'));var deskjs=require(_0x1636('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1636('0xd'));var Papa=require(_0x1636('0xe'));var Redis=require('ioredis');var authService=require(_0x1636('0xf'));var qs=require(_0x1636('0x10'));var as=require(_0x1636('0x11'));var hardwareService=require(_0x1636('0x12'));var logger=require('../../config/logger')(_0x1636('0x13'));var utils=require('../../config/utils');var config=require(_0x1636('0x14'));var licenseUtil=require(_0x1636('0x15'));var db=require(_0x1636('0x16'))['db'];var jayson=require(_0x1636('0x17'));var client=jayson['client'][_0x1636('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x53c163,_0x1ce42c,_0x364ae7,_0x4ad504){return new BPromise(function(_0xa8cdc1,_0x100838){var _0x1ab416=_0x4ad504||client;return _0x1ab416[_0x1636('0x19')](_0x53c163,_0x364ae7)['then'](function(_0x5d101f){logger[_0x1636('0x1a')]('Setting,\x20%s,\x20%s',_0x1ce42c,_0x1636('0x1b'));logger[_0x1636('0x1c')](_0x1636('0x1d'),_0x1ce42c,_0x1636('0x1b'),JSON[_0x1636('0x1e')](_0x5d101f));if(_0x5d101f[_0x1636('0x1f')]){if(_0x5d101f[_0x1636('0x1f')][_0x1636('0x20')]===0x1f4){logger[_0x1636('0x1f')](_0x1636('0x21'),_0x1ce42c,_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);return _0x100838(_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);}logger['error'](_0x1636('0x21'),_0x1ce42c,_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);return _0xa8cdc1(_0x5d101f[_0x1636('0x1f')][_0x1636('0x22')]);}else{logger['info'](_0x1636('0x21'),_0x1ce42c,_0x1636('0x1b'));_0xa8cdc1(_0x5d101f[_0x1636('0x23')][_0x1636('0x22')]);}})[_0x1636('0x24')](function(_0x130d37){logger[_0x1636('0x1f')](_0x1636('0x21'),_0x1ce42c,_0x130d37);_0x100838(_0x130d37);});});}function respondWithStatusCode(_0xeab834,_0x269e3c){_0x269e3c=_0x269e3c||0xcc;return function(_0x406a16){if(_0x406a16){return _0xeab834[_0x1636('0x25')](_0x269e3c);}return _0xeab834[_0x1636('0x26')](_0x269e3c)[_0x1636('0x27')]();};}function respondWithResult(_0x5dc240,_0x1e734e){_0x1e734e=_0x1e734e||0xc8;return function(_0x38de60){if(_0x38de60){return _0x5dc240[_0x1636('0x26')](_0x1e734e)[_0x1636('0x28')](_0x38de60);}};}function respondWithFilteredResult(_0x28878a,_0x4c50bb){return function(_0x309b34){if(_0x309b34){var _0x33eb37=typeof _0x4c50bb[_0x1636('0x29')]===_0x1636('0x2a')&&typeof _0x4c50bb[_0x1636('0x2b')]===_0x1636('0x2a');var _0x32d826=_0x309b34['count'];var _0x21c1eb=_0x33eb37?0x0:_0x4c50bb[_0x1636('0x29')];var _0x6709ef=_0x33eb37?_0x309b34['count']:_0x4c50bb[_0x1636('0x29')]+_0x4c50bb[_0x1636('0x2b')];var _0x2e9253;if(_0x6709ef>=_0x32d826){_0x6709ef=_0x32d826;_0x2e9253=0xc8;}else{_0x2e9253=0xce;}_0x28878a[_0x1636('0x26')](_0x2e9253);return _0x28878a['set'](_0x1636('0x2c'),_0x21c1eb+'-'+_0x6709ef+'/'+_0x32d826)[_0x1636('0x28')](_0x309b34);}return null;};}function patchUpdates(_0x1eb1fd){return function(_0x3bb687){try{jsonpatch[_0x1636('0x2d')](_0x3bb687,_0x1eb1fd,!![]);}catch(_0x440bba){return BPromise['reject'](_0x440bba);}return _0x3bb687[_0x1636('0x2e')]();};}function saveUpdates(_0x47fa22,_0xc4b6ac){return function(_0x175fbb){if(_0x175fbb){return _0x175fbb['update'](_0x47fa22)[_0x1636('0x2f')](function(_0x2dbc61){return _0x2dbc61;});}return null;};}function removeEntity(_0x3fea4f,_0x4dd653){return function(_0x253b3a){if(_0x253b3a){return _0x253b3a[_0x1636('0x30')]()[_0x1636('0x2f')](function(){_0x3fea4f[_0x1636('0x26')](0xcc)[_0x1636('0x27')]();});}};}function handleEntityNotFound(_0x5e0bad,_0x17a4ad){return function(_0x1de9b8){if(!_0x1de9b8){_0x5e0bad[_0x1636('0x25')](0x194);}return _0x1de9b8;};}function handleError(_0x4cd99e,_0x166042){_0x166042=_0x166042||0x1f4;return function(_0x4a83fe){logger[_0x1636('0x1f')](_0x4a83fe['stack']);if(_0x4a83fe[_0x1636('0x31')]){delete _0x4a83fe['name'];}_0x4cd99e['status'](_0x166042)['send'](_0x4a83fe);};}exports[_0x1636('0x32')]=function(_0x49a200,_0x28ce38){var _0x397360={},_0x2a2217={},_0x4c5b49={'count':0x0,'rows':[]};var _0xd84808=_['map'](db[_0x1636('0x33')]['rawAttributes'],function(_0x25a6ff){return{'name':_0x25a6ff[_0x1636('0x34')],'type':_0x25a6ff[_0x1636('0x35')][_0x1636('0x36')]};});_0x2a2217[_0x1636('0x37')]=_['map'](_0xd84808,_0x1636('0x31'));_0x2a2217[_0x1636('0x38')]=_['keys'](_0x49a200['query']);_0x2a2217[_0x1636('0x39')]=_[_0x1636('0x3a')](_0x2a2217['model'],_0x2a2217[_0x1636('0x38')]);_0x397360[_0x1636('0x3b')]=_[_0x1636('0x3a')](_0x2a2217[_0x1636('0x37')],qs[_0x1636('0x3c')](_0x49a200['query'][_0x1636('0x3c')]));_0x397360[_0x1636('0x3b')]=_0x397360['attributes'][_0x1636('0x3d')]?_0x397360[_0x1636('0x3b')]:_0x2a2217['model'];if(!_0x49a200[_0x1636('0x38')]['hasOwnProperty'](_0x1636('0x3e'))){_0x397360[_0x1636('0x2b')]=qs[_0x1636('0x2b')](_0x49a200['query'][_0x1636('0x2b')]);_0x397360[_0x1636('0x29')]=qs[_0x1636('0x29')](_0x49a200[_0x1636('0x38')][_0x1636('0x29')]);}_0x397360[_0x1636('0x3f')]=qs[_0x1636('0x40')](_0x49a200[_0x1636('0x38')][_0x1636('0x40')]);_0x397360[_0x1636('0x41')]=qs[_0x1636('0x39')](_['pick'](_0x49a200['query'],_0x2a2217['filters']),_0xd84808);if(_0x49a200[_0x1636('0x38')][_0x1636('0x42')]){_0x397360[_0x1636('0x41')]=_[_0x1636('0x43')](_0x397360[_0x1636('0x41')],{'$or':_[_0x1636('0x44')](_0xd84808,function(_0x1901a2){if(_0x1901a2['type']!==_0x1636('0x45')){var _0x26a562={};_0x26a562[_0x1901a2['name']]={'$like':'%'+_0x49a200['query'][_0x1636('0x42')]+'%'};return _0x26a562;}})});}_0x397360=_[_0x1636('0x43')]({},_0x397360,_0x49a200['options']);var _0x26bade={'where':_0x397360['where']};return db[_0x1636('0x33')][_0x1636('0x46')](_0x26bade)[_0x1636('0x2f')](function(_0x5371fa){_0x4c5b49[_0x1636('0x46')]=_0x5371fa;if(_0x49a200[_0x1636('0x38')][_0x1636('0x47')]){_0x397360[_0x1636('0x48')]=[{'all':!![]}];}return db[_0x1636('0x33')][_0x1636('0x49')](_0x397360);})[_0x1636('0x2f')](function(_0x1a79c5){_0x4c5b49[_0x1636('0x4a')]=_0x1a79c5;return _0x4c5b49;})['then'](respondWithFilteredResult(_0x28ce38,_0x397360))[_0x1636('0x24')](handleError(_0x28ce38,null));};exports[_0x1636('0x4b')]=function(_0x14126f,_0x4a3ba6){var _0x55bb38={'raw':![],'where':{'id':_0x14126f[_0x1636('0x4c')]['id']}},_0x674026={};_0x674026[_0x1636('0x37')]=_[_0x1636('0x4d')](db[_0x1636('0x33')][_0x1636('0x4e')]);_0x674026['query']=_[_0x1636('0x4d')](_0x14126f[_0x1636('0x38')]);_0x674026[_0x1636('0x39')]=_[_0x1636('0x3a')](_0x674026['model'],_0x674026[_0x1636('0x38')]);_0x55bb38[_0x1636('0x3b')]=_[_0x1636('0x3a')](_0x674026['model'],qs[_0x1636('0x3c')](_0x14126f[_0x1636('0x38')]['fields']));_0x55bb38[_0x1636('0x3b')]=_0x55bb38[_0x1636('0x3b')]['length']?_0x55bb38[_0x1636('0x3b')]:_0x674026[_0x1636('0x37')];if(_0x14126f['query'][_0x1636('0x47')]){_0x55bb38['include']=[{'all':!![]}];}_0x55bb38=_[_0x1636('0x43')]({},_0x55bb38,_0x14126f['options']);return db[_0x1636('0x33')]['find'](_0x55bb38)[_0x1636('0x2f')](handleEntityNotFound(_0x4a3ba6,null))['then'](respondWithResult(_0x4a3ba6,null))[_0x1636('0x24')](handleError(_0x4a3ba6,null));};exports[_0x1636('0x4f')]=function(_0x5538d0,_0x295c05){if(_0x5538d0[_0x1636('0x50')]['id']){delete _0x5538d0[_0x1636('0x50')]['id'];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x5538d0[_0x1636('0x4c')]['id']}})[_0x1636('0x2f')](handleEntityNotFound(_0x295c05,null))['then'](saveUpdates(_0x5538d0[_0x1636('0x50')],null))[_0x1636('0x2f')](respondWithResult(_0x295c05,null))[_0x1636('0x24')](handleError(_0x295c05,null));};exports['addLogo']=function(_0x3f87e2,_0x21f6bd,_0x429f4e){if(_0x3f87e2[_0x1636('0x52')]&&_0x3f87e2[_0x1636('0x52')][_0x1636('0x53')]){_0x3f87e2[_0x1636('0x50')]['logo']=_0x3f87e2[_0x1636('0x52')][_0x1636('0x53')];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x3f87e2['params']['id']}})[_0x1636('0x2f')](handleEntityNotFound(_0x21f6bd,null))[_0x1636('0x2f')](saveUpdates(_0x3f87e2['body'],null))[_0x1636('0x2f')](respondWithResult(_0x21f6bd,null))[_0x1636('0x24')](handleError(_0x21f6bd,null));};exports[_0x1636('0x54')]=function(_0x444457,_0x495a1e,_0x25d5e3){if(_0x444457[_0x1636('0x52')]&&_0x444457[_0x1636('0x52')][_0x1636('0x53')]){_0x444457[_0x1636('0x50')][_0x1636('0x55')]=_0x444457['file']['filename'];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x444457['params']['id']}})['then'](handleEntityNotFound(_0x495a1e,null))[_0x1636('0x2f')](saveUpdates(_0x444457[_0x1636('0x50')],null))[_0x1636('0x2f')](respondWithResult(_0x495a1e,null))[_0x1636('0x24')](handleError(_0x495a1e,null));};var utilLicense=require(_0x1636('0x15'));exports[_0x1636('0x56')]=function(_0x17c43a,_0x2f1c31,_0x5abf9c){var _0x736aa2='server/files/images/logos';var _0x176a9f={'custom':![]};return utilLicense[_0x1636('0x57')]()[_0x1636('0x2f')](function(_0x1fc3e3){if(_0x1fc3e3){_0x176a9f=_0x1fc3e3;}return db[_0x1636('0x33')]['find']({'where':{'id':_0x17c43a[_0x1636('0x4c')]['id']},'attributes':[_0x1636('0x58'),'loginLogo',_0x1636('0x59'),_0x1636('0x5a'),'defaultLogo',_0x1636('0x5b'),_0x1636('0x5c'),_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x2f1c31,null))['then'](function(_0x215f06){if(_0x215f06){var _0x467435=_0x215f06['logo']&&fs[_0x1636('0x5e')](path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')](_0x215f06[_0x1636('0x58')])))?path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')](_0x215f06[_0x1636('0x58')])):path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')](_0x1636('0x61')));var _0x26d13a=_0x1636('0x62')+_['upperFirst'](_0x1636('0x58'));if(_0x215f06[_0x26d13a]||!_0x176a9f[_0x1636('0x63')]){_0x467435=path[_0x1636('0x5f')](config['root'],_0x736aa2,_[_0x1636('0x60')]('default_logo.svg'));}if(!fs['existsSync'](_0x467435)){throw new db[(_0x1636('0x64'))][(_0x1636('0x65'))](_[_0x1636('0x66')](_0x1636('0x58'))+'\x20not\x20found');}return _0x2f1c31[_0x1636('0x67')](_0x467435);}})[_0x1636('0x24')](handleError(_0x2f1c31,null));};var utilLicense=require(_0x1636('0x15'));exports[_0x1636('0x68')]=function(_0x3877de,_0x56c829,_0xb0aba1){var _0x3623df=_0x1636('0x69');var _0x24cde6={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x290799){if(_0x290799){_0x24cde6=_0x290799;}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x3877de[_0x1636('0x4c')]['id']},'attributes':[_0x1636('0x58'),_0x1636('0x55'),_0x1636('0x59'),_0x1636('0x5a'),_0x1636('0x6a'),_0x1636('0x5b'),_0x1636('0x5c'),_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x56c829,null))[_0x1636('0x2f')](function(_0x2dc471){if(_0x2dc471){var _0x2eea41=_0x2dc471[_0x1636('0x55')]&&fs[_0x1636('0x5e')](path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x3623df,_['toLower'](_0x2dc471['loginLogo'])))?path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x3623df,_[_0x1636('0x60')](_0x2dc471['loginLogo'])):path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x3623df,_[_0x1636('0x60')](_0x1636('0x6c')));var _0x283ce0=_0x1636('0x62')+_['upperFirst'](_0x1636('0x55'));if(_0x2dc471[_0x283ce0]||!_0x24cde6[_0x1636('0x63')]){_0x2eea41=path[_0x1636('0x5f')](config['root'],_0x3623df,_[_0x1636('0x60')]('default_loginLogo.svg'));}if(!fs[_0x1636('0x5e')](_0x2eea41)){throw new db[(_0x1636('0x64'))][(_0x1636('0x65'))](_[_0x1636('0x66')](_0x1636('0x55'))+'\x20not\x20found');}return _0x56c829[_0x1636('0x67')](_0x2eea41);}})['catch'](handleError(_0x56c829,null));};exports[_0x1636('0x6d')]=function(_0x86ba34,_0xbad0d6){return db['Setting'][_0x1636('0x51')]({'where':{'id':_0x86ba34[_0x1636('0x4c')]['id']},'attributes':[_0x1636('0x6e')]})[_0x1636('0x2f')](respondWithResult(_0xbad0d6,null))['catch'](handleError(_0xbad0d6,null));};exports[_0x1636('0x6f')]=function(_0x164e3b,_0x77eaa3,_0x1d99b5){if(_0x164e3b['file']&&_0x164e3b[_0x1636('0x52')][_0x1636('0x53')]){_0x164e3b['body'][_0x1636('0x59')]=_0x164e3b[_0x1636('0x52')][_0x1636('0x53')];}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x164e3b['params']['id']}})['then'](handleEntityNotFound(_0x77eaa3,null))[_0x1636('0x2f')](saveUpdates(_0x164e3b[_0x1636('0x50')],null))['then'](respondWithResult(_0x77eaa3,null))['catch'](handleError(_0x77eaa3,null));};var utilLicense=require(_0x1636('0x15'));exports[_0x1636('0x70')]=function(_0x3afa1f,_0x1ae210,_0x5b5248){var _0x47250a='server/files/images/logos';var _0x3d46f4={'custom':![]};return utilLicense[_0x1636('0x57')]()[_0x1636('0x2f')](function(_0x228765){if(_0x228765){_0x3d46f4=_0x228765;}return db['Setting'][_0x1636('0x51')]({'where':{'id':_0x3afa1f['params']['id']},'attributes':[_0x1636('0x58'),_0x1636('0x55'),_0x1636('0x59'),'favicon',_0x1636('0x6a'),_0x1636('0x5b'),'defaultPreferred',_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x1ae210,null))[_0x1636('0x2f')](function(_0x431ff0){if(_0x431ff0){var _0x13ce2e=_0x431ff0[_0x1636('0x59')]&&fs['existsSync'](path['join'](config[_0x1636('0x6b')],_0x47250a,_[_0x1636('0x60')](_0x431ff0[_0x1636('0x59')])))?path[_0x1636('0x5f')](config['root'],_0x47250a,_['toLower'](_0x431ff0[_0x1636('0x59')])):path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x47250a,_[_0x1636('0x60')]('default_preferred.png'));var _0xae7dc7=_0x1636('0x62')+_[_0x1636('0x66')](_0x1636('0x59'));if(_0x431ff0[_0xae7dc7]||!_0x3d46f4[_0x1636('0x63')]||!_0x3d46f4['preferred']){_0x13ce2e=path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x47250a,_[_0x1636('0x60')](_0x1636('0x71')));}if(!fs[_0x1636('0x5e')](_0x13ce2e)){throw new db[(_0x1636('0x64'))]['ValidationError'](_[_0x1636('0x66')](_0x1636('0x59'))+'\x20not\x20found');}return _0x1ae210[_0x1636('0x67')](_0x13ce2e);}})[_0x1636('0x24')](handleError(_0x1ae210,null));};exports[_0x1636('0x72')]=function(_0x5db155,_0x3275e6,_0x4edcb4){if(_0x5db155[_0x1636('0x52')]&&_0x5db155[_0x1636('0x52')][_0x1636('0x53')]){_0x5db155[_0x1636('0x50')][_0x1636('0x5a')]=_0x5db155[_0x1636('0x52')][_0x1636('0x53')];}return db['Setting'][_0x1636('0x51')]({'where':{'id':_0x5db155[_0x1636('0x4c')]['id']}})[_0x1636('0x2f')](handleEntityNotFound(_0x3275e6,null))[_0x1636('0x2f')](saveUpdates(_0x5db155[_0x1636('0x50')],null))[_0x1636('0x2f')](respondWithResult(_0x3275e6,null))[_0x1636('0x24')](handleError(_0x3275e6,null));};var utilLicense=require('../../config/license/util');exports[_0x1636('0x73')]=function(_0x156e4c,_0x52a586,_0x4ae546){var _0x87c73b='server/files/images/logos';var _0x4a40bf={'custom':![]};return utilLicense['getLicense']()[_0x1636('0x2f')](function(_0x4adfca){if(_0x4adfca){_0x4a40bf=_0x4adfca;}return db[_0x1636('0x33')][_0x1636('0x51')]({'where':{'id':_0x156e4c['params']['id']},'attributes':[_0x1636('0x58'),_0x1636('0x55'),_0x1636('0x59'),_0x1636('0x5a'),_0x1636('0x6a'),_0x1636('0x5b'),_0x1636('0x5c'),_0x1636('0x5d')],'raw':!![]});})[_0x1636('0x2f')](handleEntityNotFound(_0x52a586,null))[_0x1636('0x2f')](function(_0x224135){if(_0x224135){var _0x3cd641=_0x224135[_0x1636('0x5a')]&&fs[_0x1636('0x5e')](path[_0x1636('0x5f')](config[_0x1636('0x6b')],_0x87c73b,_[_0x1636('0x60')](_0x224135[_0x1636('0x5a')])))?path['join'](config[_0x1636('0x6b')],_0x87c73b,_[_0x1636('0x60')](_0x224135[_0x1636('0x5a')])):path[_0x1636('0x5f')](config['root'],_0x87c73b,_[_0x1636('0x60')](_0x1636('0x74')));var _0x58e608=_0x1636('0x62')+_[_0x1636('0x66')](_0x1636('0x5a'));if(_0x224135[_0x58e608]||!_0x4a40bf['custom']){_0x3cd641=path['join'](config['root'],_0x87c73b,_[_0x1636('0x60')](_0x1636('0x74')));}if(!fs['existsSync'](_0x3cd641)){throw new db[(_0x1636('0x64'))][(_0x1636('0x65'))](_[_0x1636('0x66')](_0x1636('0x5a'))+'\x20not\x20found');}return _0x52a586[_0x1636('0x67')](_0x3cd641);}})['catch'](handleError(_0x52a586,null));};exports[_0x1636('0x75')]=function(_0x171aa1,_0x165dec){var _0x4acd37={'offset':moment()[_0x1636('0x76')]()};_0x4acd37[_0x1636('0x77')]=moment()['utcOffset'](_0x4acd37[_0x1636('0x29')])[_0x1636('0x78')](_0x1636('0x79'));return _0x165dec['status'](0xc8)[_0x1636('0x7a')](_0x4acd37);}; \ No newline at end of file +var _0xd01a=['length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','includeAll','findAll','rows','params','fields','find','update','body','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','getLicense','logo','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','defaultLogo','default_loginLogo.svg','gdpr','addPreferred','getPreferred','server/files/images/logos','favicon','default_preferred.png','getFavicon','default_favicon.ico','download','getDate','now','utcOffset','format','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','destroy','then','stack','name','send','index','map','Setting','rawAttributes','key','model','query','keys','filters','intersection','attributes'];(function(_0x32712,_0x157e1f){var _0xeb406e=function(_0xc12597){while(--_0xc12597){_0x32712['push'](_0x32712['shift']());}};_0xeb406e(++_0x157e1f);}(_0xd01a,0x1ae));var _0xad01=function(_0x4e6822,_0x1bdc32){_0x4e6822=_0x4e6822-0x0;var _0x5b7781=_0xd01a[_0x4e6822];return _0x5b7781;};'use strict';var emlformat=require(_0xad01('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xad01('0x1'));var jsonpatch=require(_0xad01('0x2'));var rp=require('request-promise');var moment=require(_0xad01('0x3'));var BPromise=require(_0xad01('0x4'));var Mustache=require(_0xad01('0x5'));var util=require('util');var path=require('path');var sox=require(_0xad01('0x6'));var csv=require(_0xad01('0x7'));var ejs=require(_0xad01('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xad01('0x9'));var crypto=require(_0xad01('0xa'));var jsforce=require(_0xad01('0xb'));var deskjs=require(_0xad01('0xc'));var toCsv=require(_0xad01('0x7'));var querystring=require(_0xad01('0xd'));var Papa=require('papaparse');var Redis=require(_0xad01('0xe'));var authService=require(_0xad01('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xad01('0x10'));var hardwareService=require(_0xad01('0x11'));var logger=require(_0xad01('0x12'))(_0xad01('0x13'));var utils=require(_0xad01('0x14'));var config=require(_0xad01('0x15'));var licenseUtil=require(_0xad01('0x16'));var db=require(_0xad01('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xad01('0x18')][_0xad01('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x227afa,_0x46fb4d,_0x115152,_0x6f76fb){return new BPromise(function(_0x4bea62,_0xfb6615){var _0x43c65e=_0x6f76fb||client;return _0x43c65e[_0xad01('0x1a')](_0x227afa,_0x115152)['then'](function(_0x34b56e){logger['info'](_0xad01('0x1b'),_0x46fb4d,_0xad01('0x1c'));logger[_0xad01('0x1d')]('Setting,\x20%s,\x20%s,\x20%s',_0x46fb4d,'request\x20sent',JSON[_0xad01('0x1e')](_0x34b56e));if(_0x34b56e[_0xad01('0x1f')]){if(_0x34b56e[_0xad01('0x1f')][_0xad01('0x20')]===0x1f4){logger[_0xad01('0x1f')](_0xad01('0x1b'),_0x46fb4d,_0x34b56e[_0xad01('0x1f')]['message']);return _0xfb6615(_0x34b56e[_0xad01('0x1f')]['message']);}logger[_0xad01('0x1f')](_0xad01('0x1b'),_0x46fb4d,_0x34b56e[_0xad01('0x1f')]['message']);return _0x4bea62(_0x34b56e[_0xad01('0x1f')][_0xad01('0x21')]);}else{logger[_0xad01('0x22')]('Setting,\x20%s,\x20%s',_0x46fb4d,_0xad01('0x1c'));_0x4bea62(_0x34b56e[_0xad01('0x23')][_0xad01('0x21')]);}})[_0xad01('0x24')](function(_0xb35d2b){logger[_0xad01('0x1f')]('Setting,\x20%s,\x20%s',_0x46fb4d,_0xb35d2b);_0xfb6615(_0xb35d2b);});});}function respondWithStatusCode(_0x4e054b,_0x422e17){_0x422e17=_0x422e17||0xcc;return function(_0x19c4dc){if(_0x19c4dc){return _0x4e054b[_0xad01('0x25')](_0x422e17);}return _0x4e054b['status'](_0x422e17)[_0xad01('0x26')]();};}function respondWithResult(_0x30ddc5,_0x317bfd){_0x317bfd=_0x317bfd||0xc8;return function(_0x1542f6){if(_0x1542f6){return _0x30ddc5[_0xad01('0x27')](_0x317bfd)['json'](_0x1542f6);}};}function respondWithFilteredResult(_0x38e11b,_0x33f3ca){return function(_0x576475){if(_0x576475){var _0x4f390e=typeof _0x33f3ca['offset']===_0xad01('0x28')&&typeof _0x33f3ca[_0xad01('0x29')]===_0xad01('0x28');var _0x424bf2=_0x576475[_0xad01('0x2a')];var _0x1d6ecc=_0x4f390e?0x0:_0x33f3ca[_0xad01('0x2b')];var _0x247808=_0x4f390e?_0x576475['count']:_0x33f3ca[_0xad01('0x2b')]+_0x33f3ca[_0xad01('0x29')];var _0x2f272c;if(_0x247808>=_0x424bf2){_0x247808=_0x424bf2;_0x2f272c=0xc8;}else{_0x2f272c=0xce;}_0x38e11b[_0xad01('0x27')](_0x2f272c);return _0x38e11b[_0xad01('0x2c')](_0xad01('0x2d'),_0x1d6ecc+'-'+_0x247808+'/'+_0x424bf2)[_0xad01('0x2e')](_0x576475);}return null;};}function patchUpdates(_0x5e8180){return function(_0x13cff0){try{jsonpatch[_0xad01('0x2f')](_0x13cff0,_0x5e8180,!![]);}catch(_0x4313f1){return BPromise[_0xad01('0x30')](_0x4313f1);}return _0x13cff0[_0xad01('0x31')]();};}function saveUpdates(_0x259a55,_0x33292f){return function(_0x2e1493){if(_0x2e1493){return _0x2e1493['update'](_0x259a55)['then'](function(_0x20e159){return _0x20e159;});}return null;};}function removeEntity(_0x5a7080,_0x3339a4){return function(_0xf951a6){if(_0xf951a6){return _0xf951a6[_0xad01('0x32')]()[_0xad01('0x33')](function(){_0x5a7080['status'](0xcc)[_0xad01('0x26')]();});}};}function handleEntityNotFound(_0x4f4cd6,_0x55e07d){return function(_0x2a0105){if(!_0x2a0105){_0x4f4cd6[_0xad01('0x25')](0x194);}return _0x2a0105;};}function handleError(_0x7a591b,_0xc0e999){_0xc0e999=_0xc0e999||0x1f4;return function(_0x576c77){logger['error'](_0x576c77[_0xad01('0x34')]);if(_0x576c77[_0xad01('0x35')]){delete _0x576c77[_0xad01('0x35')];}_0x7a591b[_0xad01('0x27')](_0xc0e999)[_0xad01('0x36')](_0x576c77);};}exports[_0xad01('0x37')]=function(_0x11ea0d,_0x10faeb){var _0x5c42d7={},_0x1b0cbc={},_0x55fc1d={'count':0x0,'rows':[]};var _0x576360=_[_0xad01('0x38')](db[_0xad01('0x39')][_0xad01('0x3a')],function(_0x5b62ef){return{'name':_0x5b62ef['fieldName'],'type':_0x5b62ef['type'][_0xad01('0x3b')]};});_0x1b0cbc[_0xad01('0x3c')]=_['map'](_0x576360,'name');_0x1b0cbc[_0xad01('0x3d')]=_[_0xad01('0x3e')](_0x11ea0d[_0xad01('0x3d')]);_0x1b0cbc[_0xad01('0x3f')]=_[_0xad01('0x40')](_0x1b0cbc['model'],_0x1b0cbc['query']);_0x5c42d7[_0xad01('0x41')]=_[_0xad01('0x40')](_0x1b0cbc[_0xad01('0x3c')],qs['fields'](_0x11ea0d['query']['fields']));_0x5c42d7['attributes']=_0x5c42d7[_0xad01('0x41')][_0xad01('0x42')]?_0x5c42d7['attributes']:_0x1b0cbc[_0xad01('0x3c')];if(!_0x11ea0d['query'][_0xad01('0x43')](_0xad01('0x44'))){_0x5c42d7[_0xad01('0x29')]=qs[_0xad01('0x29')](_0x11ea0d[_0xad01('0x3d')][_0xad01('0x29')]);_0x5c42d7[_0xad01('0x2b')]=qs['offset'](_0x11ea0d[_0xad01('0x3d')]['offset']);}_0x5c42d7[_0xad01('0x45')]=qs[_0xad01('0x46')](_0x11ea0d[_0xad01('0x3d')][_0xad01('0x46')]);_0x5c42d7['where']=qs[_0xad01('0x3f')](_[_0xad01('0x47')](_0x11ea0d['query'],_0x1b0cbc[_0xad01('0x3f')]),_0x576360);if(_0x11ea0d[_0xad01('0x3d')]['filter']){_0x5c42d7[_0xad01('0x48')]=_['merge'](_0x5c42d7[_0xad01('0x48')],{'$or':_[_0xad01('0x38')](_0x576360,function(_0x5ca239){if(_0x5ca239[_0xad01('0x49')]!==_0xad01('0x4a')){var _0x4f8d87={};_0x4f8d87[_0x5ca239[_0xad01('0x35')]]={'$like':'%'+_0x11ea0d[_0xad01('0x3d')][_0xad01('0x4b')]+'%'};return _0x4f8d87;}})});}_0x5c42d7=_[_0xad01('0x4c')]({},_0x5c42d7,_0x11ea0d[_0xad01('0x4d')]);var _0x37c236={'where':_0x5c42d7[_0xad01('0x48')]};return db[_0xad01('0x39')][_0xad01('0x2a')](_0x37c236)['then'](function(_0x4ab961){_0x55fc1d[_0xad01('0x2a')]=_0x4ab961;if(_0x11ea0d[_0xad01('0x3d')][_0xad01('0x4e')]){_0x5c42d7['include']=[{'all':!![]}];}return db[_0xad01('0x39')][_0xad01('0x4f')](_0x5c42d7);})['then'](function(_0x58b444){_0x55fc1d[_0xad01('0x50')]=_0x58b444;return _0x55fc1d;})[_0xad01('0x33')](respondWithFilteredResult(_0x10faeb,_0x5c42d7))[_0xad01('0x24')](handleError(_0x10faeb,null));};exports['show']=function(_0x525921,_0x18c15a){var _0x199610={'raw':![],'where':{'id':_0x525921[_0xad01('0x51')]['id']}},_0x41fa11={};_0x41fa11[_0xad01('0x3c')]=_[_0xad01('0x3e')](db[_0xad01('0x39')]['rawAttributes']);_0x41fa11[_0xad01('0x3d')]=_[_0xad01('0x3e')](_0x525921[_0xad01('0x3d')]);_0x41fa11[_0xad01('0x3f')]=_[_0xad01('0x40')](_0x41fa11[_0xad01('0x3c')],_0x41fa11[_0xad01('0x3d')]);_0x199610[_0xad01('0x41')]=_['intersection'](_0x41fa11[_0xad01('0x3c')],qs[_0xad01('0x52')](_0x525921[_0xad01('0x3d')][_0xad01('0x52')]));_0x199610[_0xad01('0x41')]=_0x199610['attributes'][_0xad01('0x42')]?_0x199610['attributes']:_0x41fa11['model'];if(_0x525921[_0xad01('0x3d')][_0xad01('0x4e')]){_0x199610['include']=[{'all':!![]}];}_0x199610=_[_0xad01('0x4c')]({},_0x199610,_0x525921[_0xad01('0x4d')]);return db['Setting'][_0xad01('0x53')](_0x199610)[_0xad01('0x33')](handleEntityNotFound(_0x18c15a,null))[_0xad01('0x33')](respondWithResult(_0x18c15a,null))[_0xad01('0x24')](handleError(_0x18c15a,null));};exports[_0xad01('0x54')]=function(_0x3ae589,_0x1c2f78){if(_0x3ae589[_0xad01('0x55')]['id']){delete _0x3ae589['body']['id'];}return db[_0xad01('0x39')][_0xad01('0x53')]({'where':{'id':_0x3ae589[_0xad01('0x51')]['id']}})[_0xad01('0x33')](handleEntityNotFound(_0x1c2f78,null))[_0xad01('0x33')](saveUpdates(_0x3ae589[_0xad01('0x55')],null))[_0xad01('0x33')](respondWithResult(_0x1c2f78,null))[_0xad01('0x24')](handleError(_0x1c2f78,null));};exports[_0xad01('0x56')]=function(_0x5f395f,_0x4698fc,_0x5e7ff9){if(_0x5f395f['file']&&_0x5f395f[_0xad01('0x57')][_0xad01('0x58')]){_0x5f395f[_0xad01('0x55')]['logo']=_0x5f395f[_0xad01('0x57')][_0xad01('0x58')];}return db['Setting'][_0xad01('0x53')]({'where':{'id':_0x5f395f[_0xad01('0x51')]['id']}})[_0xad01('0x33')](handleEntityNotFound(_0x4698fc,null))[_0xad01('0x33')](saveUpdates(_0x5f395f[_0xad01('0x55')],null))[_0xad01('0x33')](respondWithResult(_0x4698fc,null))[_0xad01('0x24')](handleError(_0x4698fc,null));};exports[_0xad01('0x59')]=function(_0x30534c,_0x514ccf,_0x32feb6){if(_0x30534c[_0xad01('0x57')]&&_0x30534c['file'][_0xad01('0x58')]){_0x30534c[_0xad01('0x55')][_0xad01('0x5a')]=_0x30534c[_0xad01('0x57')][_0xad01('0x58')];}return db[_0xad01('0x39')]['find']({'where':{'id':_0x30534c['params']['id']}})[_0xad01('0x33')](handleEntityNotFound(_0x514ccf,null))[_0xad01('0x33')](saveUpdates(_0x30534c[_0xad01('0x55')],null))[_0xad01('0x33')](respondWithResult(_0x514ccf,null))[_0xad01('0x24')](handleError(_0x514ccf,null));};var utilLicense=require('../../config/license/util');exports[_0xad01('0x5b')]=function(_0x39c39e,_0x400b98,_0x353579){var _0x14f854='server/files/images/logos';var _0x5f4ee1={'custom':![]};return utilLicense[_0xad01('0x5c')]()[_0xad01('0x33')](function(_0x5c3750){if(_0x5c3750){_0x5f4ee1=_0x5c3750;}return db[_0xad01('0x39')][_0xad01('0x53')]({'where':{'id':_0x39c39e['params']['id']},'attributes':[_0xad01('0x5d'),'loginLogo',_0xad01('0x5e'),'favicon','defaultLogo',_0xad01('0x5f'),_0xad01('0x60'),_0xad01('0x61')],'raw':!![]});})['then'](handleEntityNotFound(_0x400b98,null))[_0xad01('0x33')](function(_0x414f20){if(_0x414f20){var _0x1e14e5=_0x414f20['logo']&&fs[_0xad01('0x62')](path[_0xad01('0x63')](config[_0xad01('0x64')],_0x14f854,_['toLower'](_0x414f20[_0xad01('0x5d')])))?path[_0xad01('0x63')](config[_0xad01('0x64')],_0x14f854,_[_0xad01('0x65')](_0x414f20[_0xad01('0x5d')])):path['join'](config['root'],_0x14f854,_['toLower'](_0xad01('0x66')));var _0x3ac33f=_0xad01('0x67')+_[_0xad01('0x68')]('logo');if(_0x414f20[_0x3ac33f]||!_0x5f4ee1[_0xad01('0x69')]){_0x1e14e5=path[_0xad01('0x63')](config[_0xad01('0x64')],_0x14f854,_[_0xad01('0x65')](_0xad01('0x66')));}if(!fs[_0xad01('0x62')](_0x1e14e5)){throw new db[(_0xad01('0x6a'))][(_0xad01('0x6b'))](_[_0xad01('0x68')](_0xad01('0x5d'))+_0xad01('0x6c'));}return _0x400b98['download'](_0x1e14e5);}})[_0xad01('0x24')](handleError(_0x400b98,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x3ca99d,_0x2cd899,_0x3490a2){var _0x1528ca='server/files/images/logos';var _0x86db58={'custom':![]};return utilLicense[_0xad01('0x5c')]()[_0xad01('0x33')](function(_0x290703){if(_0x290703){_0x86db58=_0x290703;}return db['Setting'][_0xad01('0x53')]({'where':{'id':_0x3ca99d[_0xad01('0x51')]['id']},'attributes':[_0xad01('0x5d'),_0xad01('0x5a'),_0xad01('0x5e'),'favicon',_0xad01('0x6d'),_0xad01('0x5f'),'defaultPreferred',_0xad01('0x61')],'raw':!![]});})[_0xad01('0x33')](handleEntityNotFound(_0x2cd899,null))[_0xad01('0x33')](function(_0x237c9a){if(_0x237c9a){var _0x59244b=_0x237c9a[_0xad01('0x5a')]&&fs['existsSync'](path[_0xad01('0x63')](config[_0xad01('0x64')],_0x1528ca,_[_0xad01('0x65')](_0x237c9a[_0xad01('0x5a')])))?path[_0xad01('0x63')](config[_0xad01('0x64')],_0x1528ca,_[_0xad01('0x65')](_0x237c9a[_0xad01('0x5a')])):path[_0xad01('0x63')](config[_0xad01('0x64')],_0x1528ca,_[_0xad01('0x65')](_0xad01('0x6e')));var _0xc7b756=_0xad01('0x67')+_['upperFirst'](_0xad01('0x5a'));if(_0x237c9a[_0xc7b756]||!_0x86db58[_0xad01('0x69')]){_0x59244b=path[_0xad01('0x63')](config['root'],_0x1528ca,_[_0xad01('0x65')](_0xad01('0x6e')));}if(!fs[_0xad01('0x62')](_0x59244b)){throw new db[(_0xad01('0x6a'))]['ValidationError'](_['upperFirst'](_0xad01('0x5a'))+_0xad01('0x6c'));}return _0x2cd899['download'](_0x59244b);}})['catch'](handleError(_0x2cd899,null));};exports[_0xad01('0x6f')]=function(_0x2d5dc0,_0x16643b){return db['Setting'][_0xad01('0x53')]({'where':{'id':_0x2d5dc0[_0xad01('0x51')]['id']},'attributes':['securePassword']})[_0xad01('0x33')](respondWithResult(_0x16643b,null))[_0xad01('0x24')](handleError(_0x16643b,null));};exports[_0xad01('0x70')]=function(_0x17b291,_0x384e01,_0x1de838){if(_0x17b291['file']&&_0x17b291[_0xad01('0x57')][_0xad01('0x58')]){_0x17b291[_0xad01('0x55')][_0xad01('0x5e')]=_0x17b291[_0xad01('0x57')]['filename'];}return db['Setting'][_0xad01('0x53')]({'where':{'id':_0x17b291[_0xad01('0x51')]['id']}})[_0xad01('0x33')](handleEntityNotFound(_0x384e01,null))[_0xad01('0x33')](saveUpdates(_0x17b291[_0xad01('0x55')],null))[_0xad01('0x33')](respondWithResult(_0x384e01,null))[_0xad01('0x24')](handleError(_0x384e01,null));};var utilLicense=require(_0xad01('0x16'));exports[_0xad01('0x71')]=function(_0x16db43,_0x548fba,_0x27d91e){var _0x2e1699=_0xad01('0x72');var _0x54fdd6={'custom':![]};return utilLicense['getLicense']()[_0xad01('0x33')](function(_0x49ea3a){if(_0x49ea3a){_0x54fdd6=_0x49ea3a;}return db[_0xad01('0x39')][_0xad01('0x53')]({'where':{'id':_0x16db43[_0xad01('0x51')]['id']},'attributes':[_0xad01('0x5d'),_0xad01('0x5a'),_0xad01('0x5e'),_0xad01('0x73'),'defaultLogo',_0xad01('0x5f'),'defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xad01('0x33')](handleEntityNotFound(_0x548fba,null))['then'](function(_0x3e58f5){if(_0x3e58f5){var _0x41b203=_0x3e58f5[_0xad01('0x5e')]&&fs['existsSync'](path[_0xad01('0x63')](config[_0xad01('0x64')],_0x2e1699,_['toLower'](_0x3e58f5['preferred'])))?path['join'](config[_0xad01('0x64')],_0x2e1699,_[_0xad01('0x65')](_0x3e58f5[_0xad01('0x5e')])):path[_0xad01('0x63')](config[_0xad01('0x64')],_0x2e1699,_[_0xad01('0x65')](_0xad01('0x74')));var _0x16bdf7='default'+_[_0xad01('0x68')](_0xad01('0x5e'));if(_0x3e58f5[_0x16bdf7]||!_0x54fdd6[_0xad01('0x69')]||!_0x54fdd6[_0xad01('0x5e')]){_0x41b203=path[_0xad01('0x63')](config[_0xad01('0x64')],_0x2e1699,_['toLower'](_0xad01('0x74')));}if(!fs[_0xad01('0x62')](_0x41b203)){throw new db[(_0xad01('0x6a'))]['ValidationError'](_[_0xad01('0x68')](_0xad01('0x5e'))+_0xad01('0x6c'));}return _0x548fba['download'](_0x41b203);}})[_0xad01('0x24')](handleError(_0x548fba,null));};exports['addFavicon']=function(_0x5b203e,_0xa867b2,_0x363681){if(_0x5b203e[_0xad01('0x57')]&&_0x5b203e[_0xad01('0x57')][_0xad01('0x58')]){_0x5b203e['body'][_0xad01('0x73')]=_0x5b203e['file'][_0xad01('0x58')];}return db['Setting']['find']({'where':{'id':_0x5b203e['params']['id']}})[_0xad01('0x33')](handleEntityNotFound(_0xa867b2,null))['then'](saveUpdates(_0x5b203e[_0xad01('0x55')],null))[_0xad01('0x33')](respondWithResult(_0xa867b2,null))[_0xad01('0x24')](handleError(_0xa867b2,null));};var utilLicense=require(_0xad01('0x16'));exports[_0xad01('0x75')]=function(_0x392b7d,_0x36c8b4,_0x266174){var _0x8cc506=_0xad01('0x72');var _0x19858d={'custom':![]};return utilLicense[_0xad01('0x5c')]()['then'](function(_0x489bb2){if(_0x489bb2){_0x19858d=_0x489bb2;}return db['Setting'][_0xad01('0x53')]({'where':{'id':_0x392b7d['params']['id']},'attributes':['logo','loginLogo',_0xad01('0x5e'),_0xad01('0x73'),_0xad01('0x6d'),_0xad01('0x5f'),'defaultPreferred',_0xad01('0x61')],'raw':!![]});})[_0xad01('0x33')](handleEntityNotFound(_0x36c8b4,null))[_0xad01('0x33')](function(_0x409acf){if(_0x409acf){var _0x1af4a4=_0x409acf['favicon']&&fs[_0xad01('0x62')](path[_0xad01('0x63')](config[_0xad01('0x64')],_0x8cc506,_[_0xad01('0x65')](_0x409acf[_0xad01('0x73')])))?path[_0xad01('0x63')](config[_0xad01('0x64')],_0x8cc506,_[_0xad01('0x65')](_0x409acf[_0xad01('0x73')])):path[_0xad01('0x63')](config[_0xad01('0x64')],_0x8cc506,_[_0xad01('0x65')](_0xad01('0x76')));var _0x5bb9a4=_0xad01('0x67')+_[_0xad01('0x68')]('favicon');if(_0x409acf[_0x5bb9a4]||!_0x19858d[_0xad01('0x69')]){_0x1af4a4=path[_0xad01('0x63')](config[_0xad01('0x64')],_0x8cc506,_[_0xad01('0x65')]('default_favicon.ico'));}if(!fs[_0xad01('0x62')](_0x1af4a4)){throw new db[(_0xad01('0x6a'))][(_0xad01('0x6b'))](_['upperFirst']('favicon')+_0xad01('0x6c'));}return _0x36c8b4[_0xad01('0x77')](_0x1af4a4);}})[_0xad01('0x24')](handleError(_0x36c8b4,null));};exports[_0xad01('0x78')]=function(_0x1147fc,_0x2d7913){var _0x35f910={'offset':moment()['utcOffset']()};_0x35f910[_0xad01('0x79')]=moment()[_0xad01('0x7a')](_0x35f910[_0xad01('0x2b')])[_0xad01('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2d7913['status'](0xc8)['send'](_0x35f910);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 468c340..4652c18 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0xb452c1,_0x5a289a){var _0x2af79d=function(_0x3a0ddc){while(--_0x3a0ddc){_0xb452c1['push'](_0xb452c1['shift']());}};_0x2af79d(++_0x5a289a);}(_0xe14b,0x93));var _0xbe14=function(_0x3922c1,_0x3992f1){_0x3922c1=_0x3922c1-0x0;var _0x48e08a=_0xe14b[_0x3922c1];return _0x48e08a;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0x5e83c6,_0x432201){var _0xf1531e=function(_0x412ab5){while(--_0x412ab5){_0x5e83c6['push'](_0x5e83c6['shift']());}};_0xf1531e(++_0x432201);}(_0xe14b,0x93));var _0xbe14=function(_0x299ecb,_0x360ce8){_0x299ecb=_0x299ecb-0x0;var _0x140c25=_0xe14b[_0x299ecb];return _0x140c25;};'use strict';var _=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xbe14('0x2'));var BPromise=require(_0xbe14('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbe14('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xbe14('0x5'));module[_0xbe14('0x6')]=function(_0x1fe204,_0x1ff100){return _0x1fe204[_0xbe14('0x7')](_0xbe14('0x8'),attributes,{'tableName':_0xbe14('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index efe96d4..2bef2d2 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 _0xdd28=['raw','options','include','model','attributes','map','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','ShowSetting','find'];(function(_0x2a2fa2,_0x549c2b){var _0x3eff7b=function(_0x276dbb){while(--_0x276dbb){_0x2a2fa2['push'](_0x2a2fa2['shift']());}};_0x3eff7b(++_0x549c2b);}(_0xdd28,0x14a));var _0x8dd2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd28[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8dd2('0x0'));var util=require(_0x8dd2('0x1'));var moment=require(_0x8dd2('0x2'));var BPromise=require('bluebird');var rs=require(_0x8dd2('0x3'));var fs=require('fs');var Redis=require(_0x8dd2('0x4'));var db=require(_0x8dd2('0x5'))['db'];var utils=require(_0x8dd2('0x6'));var logger=require('../../config/logger')(_0x8dd2('0x7'));var config=require(_0x8dd2('0x8'));var jayson=require(_0x8dd2('0x9'));var client=jayson[_0x8dd2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e8961,_0x5421f1,_0x10173d){return new BPromise(function(_0x2a64c3,_0x241898){return client[_0x8dd2('0xb')](_0x2e8961,_0x10173d)[_0x8dd2('0xc')](function(_0x2e7bd5){logger['info'](_0x8dd2('0xd'),_0x5421f1,_0x8dd2('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x5421f1,'request\x20sent',JSON[_0x8dd2('0xf')](_0x2e7bd5));if(_0x2e7bd5[_0x8dd2('0x10')]){if(_0x2e7bd5[_0x8dd2('0x10')]['code']===0x1f4){logger[_0x8dd2('0x10')](_0x8dd2('0xd'),_0x5421f1,_0x2e7bd5[_0x8dd2('0x10')][_0x8dd2('0x11')]);return _0x241898(_0x2e7bd5[_0x8dd2('0x10')]['message']);}logger['error'](_0x8dd2('0xd'),_0x5421f1,_0x2e7bd5['error'][_0x8dd2('0x11')]);return _0x2a64c3(_0x2e7bd5[_0x8dd2('0x10')]['message']);}else{logger[_0x8dd2('0x12')]('Setting,\x20%s,\x20%s',_0x5421f1,_0x8dd2('0xe'));_0x2a64c3(_0x2e7bd5['result'][_0x8dd2('0x11')]);}})['catch'](function(_0x2cadc0){logger['error']('Setting,\x20%s,\x20%s',_0x5421f1,_0x2cadc0);_0x241898(_0x2cadc0);});});}exports[_0x8dd2('0x13')]=function(_0x94aa69){var _0x3fc196=this;return new Promise(function(_0x465807,_0x52ab44){return db['Setting'][_0x8dd2('0x14')]({'raw':_0x94aa69['options']?_0x94aa69['options'][_0x8dd2('0x15')]===undefined?!![]:![]:!![],'where':_0x94aa69[_0x8dd2('0x16')]?_0x94aa69['options']['where']||null:null,'attributes':_0x94aa69[_0x8dd2('0x16')]?_0x94aa69['options']['attributes']||null:null,'include':_0x94aa69[_0x8dd2('0x16')]?_0x94aa69[_0x8dd2('0x16')][_0x8dd2('0x17')]?_['map'](_0x94aa69[_0x8dd2('0x16')][_0x8dd2('0x17')],function(_0x2a2170){return{'model':db[_0x2a2170[_0x8dd2('0x18')]],'as':_0x2a2170['as'],'attributes':_0x2a2170[_0x8dd2('0x19')],'include':_0x2a2170[_0x8dd2('0x17')]?_[_0x8dd2('0x1a')](_0x2a2170[_0x8dd2('0x17')],function(_0x29e467){return{'model':db[_0x29e467[_0x8dd2('0x18')]],'as':_0x29e467['as'],'attributes':_0x29e467['attributes'],'include':_0x29e467[_0x8dd2('0x17')]?_['map'](_0x29e467[_0x8dd2('0x17')],function(_0x1e0767){return{'model':db[_0x1e0767['model']],'as':_0x1e0767['as'],'attributes':_0x1e0767[_0x8dd2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x8dd2('0xc')](function(_0xfbb7d9){logger[_0x8dd2('0x12')](_0x8dd2('0x13'),_0x94aa69);logger['debug'](_0x8dd2('0x13'),_0x94aa69,JSON['stringify'](_0xfbb7d9));_0x465807(_0xfbb7d9);})['catch'](function(_0x815aeb){logger['error'](_0x8dd2('0x13'),_0x815aeb[_0x8dd2('0x11')],_0x94aa69);_0x52ab44(_0x3fc196['error'](0x1f4,_0x815aeb[_0x8dd2('0x11')]));});});}; \ No newline at end of file +var _0x033b=['request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','then','bluebird','ioredis','../../config/logger','client','http','info','Setting,\x20%s,\x20%s'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x033b,0x76));var _0xb033=function(_0x295bef,_0x384cf2){_0x295bef=_0x295bef-0x0;var _0x1d80ff=_0x033b[_0x295bef];return _0x1d80ff;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb033('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb033('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb033('0x2'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb033('0x3')][_0xb033('0x4')]({'port':0x232a});function respondWithRpcPromise(_0x28225a,_0x4a7abe,_0x3f0cb7){return new BPromise(function(_0x4c58b7,_0x1c81d8){return client['request'](_0x28225a,_0x3f0cb7)['then'](function(_0x529e0e){logger[_0xb033('0x5')](_0xb033('0x6'),_0x4a7abe,_0xb033('0x7'));logger[_0xb033('0x8')](_0xb033('0x9'),_0x4a7abe,_0xb033('0x7'),JSON[_0xb033('0xa')](_0x529e0e));if(_0x529e0e['error']){if(_0x529e0e[_0xb033('0xb')][_0xb033('0xc')]===0x1f4){logger[_0xb033('0xb')](_0xb033('0x6'),_0x4a7abe,_0x529e0e['error'][_0xb033('0xd')]);return _0x1c81d8(_0x529e0e[_0xb033('0xb')]['message']);}logger[_0xb033('0xb')](_0xb033('0x6'),_0x4a7abe,_0x529e0e[_0xb033('0xb')][_0xb033('0xd')]);return _0x4c58b7(_0x529e0e['error'][_0xb033('0xd')]);}else{logger[_0xb033('0x5')](_0xb033('0x6'),_0x4a7abe,_0xb033('0x7'));_0x4c58b7(_0x529e0e['result']['message']);}})['catch'](function(_0x26acbb){logger['error'](_0xb033('0x6'),_0x4a7abe,_0x26acbb);_0x1c81d8(_0x26acbb);});});}exports[_0xb033('0xe')]=function(_0x4bd18c){var _0x4e6cc0=this;return new Promise(function(_0x24d687,_0x415843){return db[_0xb033('0xf')][_0xb033('0x10')]({'raw':_0x4bd18c[_0xb033('0x11')]?_0x4bd18c['options'][_0xb033('0x12')]===undefined?!![]:![]:!![],'where':_0x4bd18c[_0xb033('0x11')]?_0x4bd18c[_0xb033('0x11')][_0xb033('0x13')]||null:null,'attributes':_0x4bd18c[_0xb033('0x11')]?_0x4bd18c[_0xb033('0x11')][_0xb033('0x14')]||null:null,'include':_0x4bd18c[_0xb033('0x11')]?_0x4bd18c[_0xb033('0x11')][_0xb033('0x15')]?_[_0xb033('0x16')](_0x4bd18c[_0xb033('0x11')][_0xb033('0x15')],function(_0x5a6768){return{'model':db[_0x5a6768[_0xb033('0x17')]],'as':_0x5a6768['as'],'attributes':_0x5a6768[_0xb033('0x14')],'include':_0x5a6768[_0xb033('0x15')]?_['map'](_0x5a6768['include'],function(_0x441685){return{'model':db[_0x441685['model']],'as':_0x441685['as'],'attributes':_0x441685[_0xb033('0x14')],'include':_0x441685[_0xb033('0x15')]?_[_0xb033('0x16')](_0x441685['include'],function(_0x28879d){return{'model':db[_0x28879d['model']],'as':_0x28879d['as'],'attributes':_0x28879d[_0xb033('0x14')]};}):[]};}):[]};}):[]:[]})[_0xb033('0x18')](function(_0x1f018e){logger['info']('ShowSetting',_0x4bd18c);logger[_0xb033('0x8')](_0xb033('0xe'),_0x4bd18c,JSON[_0xb033('0xa')](_0x1f018e));_0x24d687(_0x1f018e);})['catch'](function(_0x568710){logger['error'](_0xb033('0xe'),_0x568710[_0xb033('0xd')],_0x4bd18c);_0x415843(_0x4e6cc0[_0xb033('0xb')](0x1f4,_0x568710['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d19a2a4..b10f8df 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x25f3e3,_0x207891){var _0xa89b6d=function(_0xa51f2){while(--_0xa51f2){_0x25f3e3['push'](_0x25f3e3['shift']());}};_0xa89b6d(++_0x207891);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x13802b,_0xda3409){var _0x4f6cff=function(_0xa5b879){while(--_0xa5b879){_0x13802b['push'](_0x13802b['shift']());}};_0x4f6cff(++_0xda3409);}(_0x7a54,0x106));var _0x47a5=function(_0xa2c863,_0x403f0e){_0xa2c863=_0xa2c863-0x0;var _0x4147a4=_0x7a54[_0xa2c863];return _0x4147a4;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 62cb409..f7b7f0c 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 _0x1573=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','infobip','intelepeer','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1573,0x7b));var _0x3157=function(_0x6bb814,_0x17196b){_0x6bb814=_0x6bb814-0x0;var _0x3c4bf6=_0x1573[_0x6bb814];return _0x3c4bf6;};'use strict';var Sequelize=require(_0x3157('0x0'));var rs=require(_0x3157('0x1'));module[_0x3157('0x2')]={'name':{'type':Sequelize[_0x3157('0x3')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x3157('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x3157('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x3157('0x3')],'defaultValue':function(){return rs[_0x3157('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3157('0x5')](_0x3157('0x6'),_0x3157('0x7'),_0x3157('0x8'),_0x3157('0x9'),'plivo',_0x3157('0xa'),_0x3157('0xb'),'csc',_0x3157('0xc'),_0x3157('0xd'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x3157('0x3')]},'authToken':{'type':Sequelize[_0x3157('0x3')]},'smsMethod':{'type':Sequelize[_0x3157('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x3157('0x3')]},'password':{'type':Sequelize[_0x3157('0x3')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x3157('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x3157('0x3')]},'deliveryReport':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![]},'description':{'type':Sequelize[_0x3157('0x3')]},'notificationTemplate':{'type':Sequelize[_0x3157('0xf')],'defaultValue':function(){return _0x3157('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3157('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x3157('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3157('0x11')],'comment':_0x3157('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x3157('0xe')],'defaultValue':![],'comment':_0x3157('0x13'),'set':function(_0x39b285){if(!_0x39b285)this[_0x3157('0x14')](_0x3157('0x15'),null);this[_0x3157('0x14')](_0x3157('0x16'),_0x39b285);}}}; \ No newline at end of file +var _0xfe3b=['bandwidth','csc','infobip','intelepeer','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clickatell'];(function(_0x1f94ea,_0x1e75c4){var _0x485b1d=function(_0xf1180a){while(--_0xf1180a){_0x1f94ea['push'](_0x1f94ea['shift']());}};_0x485b1d(++_0x1e75c4);}(_0xfe3b,0x197));var _0xbfe3=function(_0x52096b,_0x20bab4){_0x52096b=_0x52096b-0x0;var _0x2b1cc7=_0xfe3b[_0x52096b];return _0x2b1cc7;};'use strict';var Sequelize=require(_0xbfe3('0x0'));var rs=require(_0xbfe3('0x1'));module[_0xbfe3('0x2')]={'name':{'type':Sequelize[_0xbfe3('0x3')],'unique':_0xbfe3('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0xbfe3('0x3')],'defaultValue':function(){return rs[_0xbfe3('0x5')]();}},'phone':{'type':Sequelize[_0xbfe3('0x3')]},'type':{'type':Sequelize[_0xbfe3('0x6')](_0xbfe3('0x7'),_0xbfe3('0x8'),_0xbfe3('0x9'),'clicksend','plivo',_0xbfe3('0xa'),_0xbfe3('0xb'),_0xbfe3('0xc'),_0xbfe3('0xd'),_0xbfe3('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xbfe3('0x3')]},'smsMethod':{'type':Sequelize[_0xbfe3('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xbfe3('0x3')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0xbfe3('0x3')]},'applicationId':{'type':Sequelize[_0xbfe3('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xbfe3('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xbfe3('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xbfe3('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xbfe3('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xbfe3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xbfe3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xbfe3('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xbfe3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xbfe3('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xbfe3('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xbfe3('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbfe3('0x10')],'comment':_0xbfe3('0x11')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xbfe3('0x12'),'set':function(_0x4e1429){if(!_0x4e1429)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue']('mandatoryDisposition',_0x4e1429);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 6e00e8d..2c24ffe 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 _0xdbcc=['twilio','set','Content-Type','text/xml','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','Owner','fullname','color','tag','to\x20is\x20mandatory','List','out','Messages','SmsMessage','dataValues','inspect','skebby_dispatch_id','connectel','requestid','statusInt','status_code','DELIVERED','groupName','clickatell','redif','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','info','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','error','code','SmsAccount,\x20%s,\x20%s','message','result','sendStatus','status','undefined','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','type','key','keys','query','intersection','attributes','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','findAll','rows','show','params','rawAttributes','model','includeAll','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','findOne','include','removeDispositions','ids','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','notify','sms','SmsApplication','account','applications','orderBy','Applications','priority','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','CompanyId','ListId','from','From','MessageSid','skebby','sender','clicksend','messageId','message_id','plivo','MessageUUID','infobip','results','text','csc','segmentedMessage','replyMessageId','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','omit','SmsInteraction','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','SmsQueue','queue','Start','startRouting','receiveMessage','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xdbcc,0x115));var _0xcdbc=function(_0x306796,_0x3117d5){_0x306796=_0x306796-0x0;var _0x20804e=_0xdbcc[_0x306796];return _0x20804e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcdbc('0x0'));var zipdir=require(_0xcdbc('0x1'));var jsonpatch=require(_0xcdbc('0x2'));var rp=require(_0xcdbc('0x3'));var moment=require(_0xcdbc('0x4'));var BPromise=require(_0xcdbc('0x5'));var Mustache=require(_0xcdbc('0x6'));var util=require(_0xcdbc('0x7'));var path=require(_0xcdbc('0x8'));var sox=require(_0xcdbc('0x9'));var csv=require(_0xcdbc('0xa'));var ejs=require(_0xcdbc('0xb'));var fs=require('fs');var fs_extra=require(_0xcdbc('0xc'));var _=require('lodash');var squel=require(_0xcdbc('0xd'));var crypto=require(_0xcdbc('0xe'));var jsforce=require(_0xcdbc('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xcdbc('0xa'));var querystring=require(_0xcdbc('0x10'));var Papa=require(_0xcdbc('0x11'));var Redis=require(_0xcdbc('0x12'));var authService=require(_0xcdbc('0x13'));var qs=require(_0xcdbc('0x14'));var as=require(_0xcdbc('0x15'));var hardwareService=require(_0xcdbc('0x16'));var logger=require('../../config/logger')(_0xcdbc('0x17'));var utils=require('../../config/utils');var config=require(_0xcdbc('0x18'));var licenseUtil=require(_0xcdbc('0x19'));var db=require('../../mysqldb')['db'];config[_0xcdbc('0x1a')]=_[_0xcdbc('0x1b')](config[_0xcdbc('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xcdbc('0x1c'))(new Redis(config[_0xcdbc('0x1a')]));require(_0xcdbc('0x1d'))[_0xcdbc('0x1e')](socket);var jayson=require(_0xcdbc('0x1f'));var client=jayson['client'][_0xcdbc('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x4e957b,_0x75f0a0,_0x3a21bb,_0x1f6646){return new BPromise(function(_0x4c8ef2,_0x290b0b){var _0x460f93=_0x1f6646||client;return _0x460f93['request'](_0x4e957b,_0x3a21bb)[_0xcdbc('0x21')](function(_0x25dd4b){logger[_0xcdbc('0x22')]('SmsAccount,\x20%s,\x20%s',_0x75f0a0,_0xcdbc('0x23'));logger['debug'](_0xcdbc('0x24'),_0x75f0a0,_0xcdbc('0x23'),JSON['stringify'](_0x25dd4b));if(_0x25dd4b['error']){if(_0x25dd4b[_0xcdbc('0x25')][_0xcdbc('0x26')]===0x1f4){logger['error'](_0xcdbc('0x27'),_0x75f0a0,_0x25dd4b[_0xcdbc('0x25')]['message']);return _0x290b0b(_0x25dd4b['error'][_0xcdbc('0x28')]);}logger['error'](_0xcdbc('0x27'),_0x75f0a0,_0x25dd4b[_0xcdbc('0x25')]['message']);return _0x4c8ef2(_0x25dd4b[_0xcdbc('0x25')]['message']);}else{logger[_0xcdbc('0x22')](_0xcdbc('0x27'),_0x75f0a0,'request\x20sent');_0x4c8ef2(_0x25dd4b[_0xcdbc('0x29')]['message']);}})['catch'](function(_0x391ad3){logger[_0xcdbc('0x25')](_0xcdbc('0x27'),_0x75f0a0,_0x391ad3);_0x290b0b(_0x391ad3);});});}function respondWithStatusCode(_0xcb9189,_0x44d3ca){_0x44d3ca=_0x44d3ca||0xcc;return function(_0x3bf5b8){if(_0x3bf5b8){return _0xcb9189[_0xcdbc('0x2a')](_0x44d3ca);}return _0xcb9189[_0xcdbc('0x2b')](_0x44d3ca)['end']();};}function respondWithResult(_0x57c2bd,_0x1bff0a){_0x1bff0a=_0x1bff0a||0xc8;return function(_0x4ff2f9){if(_0x4ff2f9){return _0x57c2bd[_0xcdbc('0x2b')](_0x1bff0a)['json'](_0x4ff2f9);}};}function respondWithFilteredResult(_0x5bfa32,_0x4454f4){return function(_0x42f64e){if(_0x42f64e){var _0x56bbd3=typeof _0x4454f4['offset']===_0xcdbc('0x2c')&&typeof _0x4454f4['limit']==='undefined';var _0x3b4407=_0x42f64e[_0xcdbc('0x2d')];var _0x291489=_0x56bbd3?0x0:_0x4454f4[_0xcdbc('0x2e')];var _0x4bbc77=_0x56bbd3?_0x42f64e[_0xcdbc('0x2d')]:_0x4454f4[_0xcdbc('0x2e')]+_0x4454f4[_0xcdbc('0x2f')];var _0x567db7;if(_0x4bbc77>=_0x3b4407){_0x4bbc77=_0x3b4407;_0x567db7=0xc8;}else{_0x567db7=0xce;}_0x5bfa32[_0xcdbc('0x2b')](_0x567db7);return _0x5bfa32['set'](_0xcdbc('0x30'),_0x291489+'-'+_0x4bbc77+'/'+_0x3b4407)[_0xcdbc('0x31')](_0x42f64e);}return null;};}function patchUpdates(_0x2ef680){return function(_0x26eb6f){try{jsonpatch[_0xcdbc('0x32')](_0x26eb6f,_0x2ef680,!![]);}catch(_0x4cb483){return BPromise[_0xcdbc('0x33')](_0x4cb483);}return _0x26eb6f[_0xcdbc('0x34')]();};}function saveUpdates(_0x541a70,_0x3f364a){return function(_0x110990){if(_0x110990){return _0x110990[_0xcdbc('0x35')](_0x541a70)[_0xcdbc('0x21')](function(_0x10755a){return _0x10755a;});}return null;};}function removeEntity(_0x1f2911,_0x553e3f){return function(_0x1da7e9){if(_0x1da7e9){return _0x1da7e9[_0xcdbc('0x36')]()['then'](function(){var _0x2b029b=_0x1da7e9[_0xcdbc('0x37')]({'plain':!![]});var _0xc8affa=_0xcdbc('0x38');return db[_0xcdbc('0x39')][_0xcdbc('0x36')]({'where':{'type':_0xc8affa,'resourceId':_0x2b029b['id']}})[_0xcdbc('0x21')](function(){return _0x1da7e9;});})[_0xcdbc('0x21')](function(){_0x1f2911[_0xcdbc('0x2b')](0xcc)[_0xcdbc('0x3a')]();});}};}function handleEntityNotFound(_0x3f4101,_0x59dacf){return function(_0x1ac7cc){if(!_0x1ac7cc){_0x3f4101[_0xcdbc('0x2a')](0x194);}return _0x1ac7cc;};}function handleError(_0x37055a,_0x76cf79){_0x76cf79=_0x76cf79||0x1f4;return function(_0x49260a){logger['error'](_0x49260a[_0xcdbc('0x3b')]);if(_0x49260a[_0xcdbc('0x3c')]){delete _0x49260a[_0xcdbc('0x3c')];}_0x37055a[_0xcdbc('0x2b')](_0x76cf79)[_0xcdbc('0x3d')](_0x49260a);};}exports[_0xcdbc('0x3e')]=function(_0x51395e,_0xb8e327){var _0x3f2ff1={'include':[{'model':db[_0xcdbc('0x3f')],'as':_0xcdbc('0x40')}]},_0x28b511={},_0x12eb13={'count':0x0,'rows':[]};var _0x53d5af=_[_0xcdbc('0x41')](db[_0xcdbc('0x42')]['rawAttributes'],function(_0x4dd9ae){return{'name':_0x4dd9ae[_0xcdbc('0x43')],'type':_0x4dd9ae[_0xcdbc('0x44')][_0xcdbc('0x45')]};});_0x28b511['model']=_[_0xcdbc('0x41')](_0x53d5af,_0xcdbc('0x3c'));_0x28b511['query']=_[_0xcdbc('0x46')](_0x51395e[_0xcdbc('0x47')]);_0x28b511['filters']=_[_0xcdbc('0x48')](_0x28b511['model'],_0x28b511['query']);_0x3f2ff1[_0xcdbc('0x49')]=_['intersection'](_0x28b511['model'],qs[_0xcdbc('0x4a')](_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x4a')]));_0x3f2ff1[_0xcdbc('0x49')]=_0x3f2ff1['attributes'][_0xcdbc('0x4b')]?_0x3f2ff1[_0xcdbc('0x49')]:_0x28b511['model'];if(!_0x51395e[_0xcdbc('0x47')]['hasOwnProperty'](_0xcdbc('0x4c'))){_0x3f2ff1[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x2f')]);_0x3f2ff1[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}_0x3f2ff1[_0xcdbc('0x4d')]=qs[_0xcdbc('0x4e')](_0x51395e['query']['sort']);_0x3f2ff1['where']=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x51395e[_0xcdbc('0x47')],_0x28b511[_0xcdbc('0x4f')]),_0x53d5af);if(_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x51')]){_0x3f2ff1[_0xcdbc('0x52')]=_[_0xcdbc('0x53')](_0x3f2ff1['where'],{'$or':_['map'](_0x53d5af,function(_0x5bb2bd){if(_0x5bb2bd[_0xcdbc('0x44')]!==_0xcdbc('0x54')){var _0x4e9064={};_0x4e9064[_0x5bb2bd['name']]={'$like':'%'+_0x51395e[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x4e9064;}})});}_0x3f2ff1=_['merge']({},_0x3f2ff1,_0x51395e[_0xcdbc('0x55')]);var _0x275d19={'where':_0x3f2ff1[_0xcdbc('0x52')]};return db['SmsAccount'][_0xcdbc('0x2d')](_0x275d19)[_0xcdbc('0x21')](function(_0x224fcf){_0x12eb13[_0xcdbc('0x2d')]=_0x224fcf;if(_0x51395e[_0xcdbc('0x47')]['includeAll']){_0x3f2ff1['include']=[{'all':!![]}];}return db[_0xcdbc('0x42')][_0xcdbc('0x56')](_0x3f2ff1);})['then'](function(_0x3971aa){_0x12eb13[_0xcdbc('0x57')]=_0x3971aa;return _0x12eb13;})[_0xcdbc('0x21')](respondWithFilteredResult(_0xb8e327,_0x3f2ff1))['catch'](handleError(_0xb8e327,null));};exports[_0xcdbc('0x58')]=function(_0x1a4619,_0x3e6014){var _0x563894={'raw':![],'where':{'id':_0x1a4619[_0xcdbc('0x59')]['id']},'include':[{'model':db[_0xcdbc('0x3f')],'as':_0xcdbc('0x40')}]},_0x524810={};_0x524810['model']=_[_0xcdbc('0x46')](db[_0xcdbc('0x42')][_0xcdbc('0x5a')]);_0x524810['query']=_[_0xcdbc('0x46')](_0x1a4619[_0xcdbc('0x47')]);_0x524810['filters']=_[_0xcdbc('0x48')](_0x524810[_0xcdbc('0x5b')],_0x524810[_0xcdbc('0x47')]);_0x563894[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x524810[_0xcdbc('0x5b')],qs['fields'](_0x1a4619[_0xcdbc('0x47')]['fields']));_0x563894['attributes']=_0x563894['attributes'][_0xcdbc('0x4b')]?_0x563894[_0xcdbc('0x49')]:_0x524810[_0xcdbc('0x5b')];if(_0x1a4619[_0xcdbc('0x47')][_0xcdbc('0x5c')]){_0x563894['include']=[{'all':!![]}];}_0x563894=_[_0xcdbc('0x53')]({},_0x563894,_0x1a4619[_0xcdbc('0x55')]);return db['SmsAccount'][_0xcdbc('0x5d')](_0x563894)[_0xcdbc('0x21')](handleEntityNotFound(_0x3e6014,null))[_0xcdbc('0x21')](respondWithResult(_0x3e6014,null))[_0xcdbc('0x5e')](handleError(_0x3e6014,null));};exports[_0xcdbc('0x5f')]=function(_0x1dd031,_0x5d4f99){return db[_0xcdbc('0x42')][_0xcdbc('0x5f')](_0x1dd031['body'],{})[_0xcdbc('0x21')](function(_0x3e43cb){var _0x21bf8f=_0x1dd031[_0xcdbc('0x60')]['get']({'plain':!![]});if(!_0x21bf8f)throw new Error(_0xcdbc('0x61'));if(_0x21bf8f[_0xcdbc('0x62')]===_0xcdbc('0x60')){var _0x513a92=_0x3e43cb[_0xcdbc('0x37')]({'plain':!![]});var _0x54fff1=_0xcdbc('0x38');return db[_0xcdbc('0x63')][_0xcdbc('0x5d')]({'where':{'name':_0x54fff1,'userProfileId':_0x21bf8f[_0xcdbc('0x64')]},'raw':!![]})[_0xcdbc('0x21')](function(_0xae9de8){if(_0xae9de8&&_0xae9de8[_0xcdbc('0x65')]===0x0){return db['UserProfileResource'][_0xcdbc('0x5f')]({'name':_0x513a92[_0xcdbc('0x3c')],'resourceId':_0x513a92['id'],'type':_0xae9de8[_0xcdbc('0x3c')],'sectionId':_0xae9de8['id']},{})[_0xcdbc('0x21')](function(){return _0x3e43cb;});}else{return _0x3e43cb;}})[_0xcdbc('0x5e')](function(_0x273d57){logger[_0xcdbc('0x25')](_0xcdbc('0x66'),_0x273d57);throw _0x273d57;});}return _0x3e43cb;})[_0xcdbc('0x21')](respondWithResult(_0x5d4f99,0xc9))[_0xcdbc('0x5e')](handleError(_0x5d4f99,null));};exports[_0xcdbc('0x35')]=function(_0x3ce06a,_0x1a64b7){if(_0x3ce06a[_0xcdbc('0x67')]['id']){delete _0x3ce06a[_0xcdbc('0x67')]['id'];}return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x3ce06a[_0xcdbc('0x59')]['id']},'include':[{'model':db['Pause'],'as':_0xcdbc('0x40')}]})[_0xcdbc('0x21')](handleEntityNotFound(_0x1a64b7,null))[_0xcdbc('0x21')](saveUpdates(_0x3ce06a[_0xcdbc('0x67')],null))[_0xcdbc('0x21')](respondWithResult(_0x1a64b7,null))[_0xcdbc('0x5e')](handleError(_0x1a64b7,null));};exports[_0xcdbc('0x36')]=function(_0x546f25,_0x5b1f95){return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x546f25['params']['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x5b1f95,null))[_0xcdbc('0x21')](removeEntity(_0x5b1f95,null))['catch'](handleError(_0x5b1f95,null));};exports[_0xcdbc('0x68')]=function(_0x300617,_0x24ae98){return db[_0xcdbc('0x42')]['describe']()[_0xcdbc('0x21')](respondWithResult(_0x24ae98,null))['catch'](handleError(_0x24ae98,null));};exports['addDisposition']=function(_0x275626,_0x26e305,_0xf9da7f){if(_0x275626[_0xcdbc('0x67')]['id']){delete _0x275626[_0xcdbc('0x67')]['id'];}return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x275626[_0xcdbc('0x59')]['id']}})['then'](handleEntityNotFound(_0x26e305,null))[_0xcdbc('0x21')](function(_0x36b495){if(_0x36b495){_0x275626[_0xcdbc('0x67')][_0xcdbc('0x69')]=_0x36b495['id'];return db[_0xcdbc('0x6a')][_0xcdbc('0x5f')](_0x275626[_0xcdbc('0x67')]);}})[_0xcdbc('0x21')](respondWithResult(_0x26e305,null))[_0xcdbc('0x5e')](handleError(_0x26e305,null));};exports[_0xcdbc('0x6b')]=function(_0xdf8091,_0x22a43a,_0x20427d){var _0x55c79e={'raw':![],'where':{}};var _0x2bbe2e={};var _0x2cbfb1={'count':0x0,'rows':[]};return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0xdf8091[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x22a43a,null))[_0xcdbc('0x21')](function(_0x32a848){if(_0x32a848){_0x2bbe2e[_0xcdbc('0x5b')]=_['keys'](db[_0xcdbc('0x6a')][_0xcdbc('0x5a')]);_0x2bbe2e[_0xcdbc('0x47')]=_['keys'](_0xdf8091[_0xcdbc('0x47')]);_0x2bbe2e['filters']=_[_0xcdbc('0x48')](_0x2bbe2e['model'],_0x2bbe2e[_0xcdbc('0x47')]);_0x55c79e[_0xcdbc('0x49')]=_['intersection'](_0x2bbe2e['model'],qs[_0xcdbc('0x4a')](_0xdf8091['query'][_0xcdbc('0x4a')]));_0x55c79e['attributes']=_0x55c79e[_0xcdbc('0x49')][_0xcdbc('0x4b')]?_0x55c79e['attributes']:_0x2bbe2e['model'];if(!_0xdf8091[_0xcdbc('0x47')]['hasOwnProperty'](_0xcdbc('0x4c'))){_0x55c79e[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x2f')]);_0x55c79e[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}_0x55c79e[_0xcdbc('0x4d')]=qs[_0xcdbc('0x4e')](_0xdf8091[_0xcdbc('0x47')]['sort']);_0x55c79e[_0xcdbc('0x52')]=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0xdf8091[_0xcdbc('0x47')],_0x2bbe2e['filters']));_0x55c79e[_0xcdbc('0x52')][_0xcdbc('0x69')]=_0x32a848['id'];if(_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x51')]){_0x55c79e[_0xcdbc('0x52')]=_[_0xcdbc('0x53')](_0x55c79e[_0xcdbc('0x52')],{'$or':_['map'](_0x55c79e[_0xcdbc('0x49')],function(_0x2a8aa2){var _0x2ac811={};_0x2ac811[_0x2a8aa2]={'$like':'%'+_0xdf8091[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x2ac811;})});}_0x55c79e=_[_0xcdbc('0x53')]({},_0x55c79e,_0xdf8091[_0xcdbc('0x55')]);return db[_0xcdbc('0x6a')][_0xcdbc('0x2d')]({'where':_0x55c79e['where']})['then'](function(_0x52c82d){_0x2cbfb1[_0xcdbc('0x2d')]=_0x52c82d;if(_0xdf8091[_0xcdbc('0x47')]['includeAll']){_0x55c79e[_0xcdbc('0x6d')]=[{'all':!![]}];}return db[_0xcdbc('0x6a')][_0xcdbc('0x56')](_0x55c79e);})['then'](function(_0xe09cf2){_0x2cbfb1['rows']=_0xe09cf2;return _0x2cbfb1;});}})[_0xcdbc('0x21')](respondWithFilteredResult(_0x22a43a,_0x55c79e))[_0xcdbc('0x5e')](handleError(_0x22a43a,null));};exports[_0xcdbc('0x6e')]=function(_0x1a0d35,_0x11dfdf,_0x4482ae){return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x1a0d35[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x11dfdf,null))[_0xcdbc('0x21')](function(_0xc295e1){if(_0xc295e1){return _0xc295e1['removeDispositions'](_0x1a0d35[_0xcdbc('0x47')][_0xcdbc('0x6f')]);}})['then'](respondWithStatusCode(_0x11dfdf,null))[_0xcdbc('0x5e')](handleError(_0x11dfdf,null));};exports['addAnswer']=function(_0x28498f,_0x4cf3a7,_0x5d68f9){if(_0x28498f[_0xcdbc('0x67')]['id']){delete _0x28498f[_0xcdbc('0x67')]['id'];}return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x28498f[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4cf3a7,null))[_0xcdbc('0x21')](function(_0x272a42){if(_0x272a42){_0x28498f[_0xcdbc('0x67')][_0xcdbc('0x69')]=_0x272a42['id'];return db[_0xcdbc('0x70')][_0xcdbc('0x5f')](_0x28498f[_0xcdbc('0x67')]);}})[_0xcdbc('0x21')](respondWithResult(_0x4cf3a7,null))[_0xcdbc('0x5e')](handleError(_0x4cf3a7,null));};exports[_0xcdbc('0x71')]=function(_0x331a31,_0x4c421e,_0x1b87bf){var _0x3e91c9={'raw':![],'where':{}};var _0x1956c0={};var _0x38719b={'count':0x0,'rows':[]};return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0x331a31[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4c421e,null))[_0xcdbc('0x21')](function(_0x2a9f29){if(_0x2a9f29){_0x1956c0[_0xcdbc('0x5b')]=_[_0xcdbc('0x46')](db[_0xcdbc('0x70')][_0xcdbc('0x5a')]);_0x1956c0[_0xcdbc('0x47')]=_[_0xcdbc('0x46')](_0x331a31[_0xcdbc('0x47')]);_0x1956c0['filters']=_[_0xcdbc('0x48')](_0x1956c0['model'],_0x1956c0['query']);_0x3e91c9[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x1956c0[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x331a31[_0xcdbc('0x47')]['fields']));_0x3e91c9['attributes']=_0x3e91c9['attributes'][_0xcdbc('0x4b')]?_0x3e91c9[_0xcdbc('0x49')]:_0x1956c0[_0xcdbc('0x5b')];if(!_0x331a31['query'][_0xcdbc('0x72')](_0xcdbc('0x4c'))){_0x3e91c9['limit']=qs[_0xcdbc('0x2f')](_0x331a31[_0xcdbc('0x47')]['limit']);_0x3e91c9[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x331a31[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}_0x3e91c9[_0xcdbc('0x4d')]=qs['sort'](_0x331a31[_0xcdbc('0x47')][_0xcdbc('0x4e')]);_0x3e91c9[_0xcdbc('0x52')]=qs[_0xcdbc('0x4f')](_['pick'](_0x331a31['query'],_0x1956c0[_0xcdbc('0x4f')]));_0x3e91c9[_0xcdbc('0x52')][_0xcdbc('0x69')]=_0x2a9f29['id'];if(_0x331a31[_0xcdbc('0x47')]['filter']){_0x3e91c9['where']=_[_0xcdbc('0x53')](_0x3e91c9[_0xcdbc('0x52')],{'$or':_[_0xcdbc('0x41')](_0x3e91c9['attributes'],function(_0x390f72){var _0x5d7251={};_0x5d7251[_0x390f72]={'$like':'%'+_0x331a31[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x5d7251;})});}_0x3e91c9=_[_0xcdbc('0x53')]({},_0x3e91c9,_0x331a31[_0xcdbc('0x55')]);return db[_0xcdbc('0x70')][_0xcdbc('0x2d')]({'where':_0x3e91c9[_0xcdbc('0x52')]})[_0xcdbc('0x21')](function(_0x56ed39){_0x38719b['count']=_0x56ed39;if(_0x331a31[_0xcdbc('0x47')]['includeAll']){_0x3e91c9[_0xcdbc('0x6d')]=[{'all':!![]}];}return db[_0xcdbc('0x70')]['findAll'](_0x3e91c9);})['then'](function(_0x1cdae0){_0x38719b[_0xcdbc('0x57')]=_0x1cdae0;return _0x38719b;});}})[_0xcdbc('0x21')](respondWithFilteredResult(_0x4c421e,_0x3e91c9))[_0xcdbc('0x5e')](handleError(_0x4c421e,null));};exports[_0xcdbc('0x73')]=function(_0x4c933b,_0x27d18f,_0x171ba2){return db['SmsAccount'][_0xcdbc('0x5d')]({'where':{'id':_0x4c933b[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x27d18f,null))[_0xcdbc('0x21')](function(_0x50090b){if(_0x50090b){return _0x50090b[_0xcdbc('0x73')](_0x4c933b['query']['ids']);}})[_0xcdbc('0x21')](respondWithStatusCode(_0x27d18f,null))[_0xcdbc('0x5e')](handleError(_0x27d18f,null));};exports[_0xcdbc('0x74')]=function(_0x5704dd,_0x2c4407,_0x357c){var _0x59e039={'channel':_0xcdbc('0x75')};var _0x42a053=[];var _0x5dfeca=[];var _0x8d7e4c={};return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x5704dd['params']['id']},'include':[{'model':db[_0xcdbc('0x76')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x2c4407,null))[_0xcdbc('0x21')](function(_0x10622f){_0x59e039[_0xcdbc('0x77')]=_0x10622f;_0x59e039[_0xcdbc('0x78')]=_[_0xcdbc('0x79')](_0x10622f[_0xcdbc('0x7a')],[_0xcdbc('0x7b')],['asc']);if(_0x59e039['account'][_0xcdbc('0x7a')]){delete _0x59e039[_0xcdbc('0x77')][_0xcdbc('0x7a')];}return db[_0xcdbc('0x7c')]['describe']();})[_0xcdbc('0x21')](function(_0x123237){if(!_0x123237){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))]('no\x20available\x20attributes');}_0x42a053=_['difference'](_[_0xcdbc('0x46')](_0x123237),[_0xcdbc('0x7f'),_0xcdbc('0x80')]);_0x5dfeca=_[_0xcdbc('0x81')](_[_0xcdbc('0x46')](_0x123237),['createdAt',_0xcdbc('0x80'),_0xcdbc('0x82'),_0xcdbc('0x83')]);_0x59e039['body']={'mapKey':'mobile'};if(_0x59e039[_0xcdbc('0x77')][_0xcdbc('0x44')]){switch(_0x59e039[_0xcdbc('0x77')]['type']){case'twilio':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x85')];_0x59e039[_0xcdbc('0x67')]['body']=_0x5704dd['body']['Body'];_0x59e039['body']['messageId']=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x86')];break;case _0xcdbc('0x87'):_0x59e039[_0xcdbc('0x67')]['from']='+'+_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x88')];_0x59e039['body'][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')]['text'];break;case'connectel':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd['body'][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x28')];break;case _0xcdbc('0x89'):_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')]['body']=_0x5704dd[_0xcdbc('0x67')]['body'];_0x59e039['body'][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8b')];break;case _0xcdbc('0x8c'):_0x59e039['body'][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x85')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')]['Text'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8d')];break;case _0xcdbc('0x8e'):_0x59e039['body'][_0xcdbc('0x84')]='+'+_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8f')][0x0][_0xcdbc('0x84')];_0x59e039['body'][_0xcdbc('0x67')]=_0x5704dd['body'][_0xcdbc('0x8f')][0x0][_0xcdbc('0x90')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x8f')][0x0][_0xcdbc('0x8a')];break;case _0xcdbc('0x91'):_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')]['originatingAddress'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd['body'][_0xcdbc('0x92')][_0xcdbc('0x28')];break;case'clickatell':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd['body']['fromNumber'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd['body'][_0xcdbc('0x90')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd['body'][_0xcdbc('0x93')];break;case _0xcdbc('0x94'):_0x59e039['body']['messageId']=_0x5704dd[_0xcdbc('0x67')][0x0]['message']['id'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd['body'][0x0]['message'][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd[_0xcdbc('0x67')][0x0][_0xcdbc('0x28')]['text'];break;case _0xcdbc('0x95'):_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x84')];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')]=_0x5704dd['body']['message'];_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x8a')]=_0x5704dd[_0xcdbc('0x67')][_0xcdbc('0x96')];break;}}if(_0x59e039['body']['id']){delete _0x59e039['body']['id'];}if(_[_0xcdbc('0x97')](_0x59e039[_0xcdbc('0x67')]['from'])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))](_0xcdbc('0x98'));}if(_['isNil'](_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')])||_0x59e039['body'][_0xcdbc('0x67')]===''){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))](_0xcdbc('0x99'));}if(_[_0xcdbc('0x97')](_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x9a')])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dfeca);}if(!_[_0xcdbc('0x9b')](_0x5dfeca,_0x59e039['body']['mapKey'])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5dfeca);}_0x8d7e4c[_0x59e039[_0xcdbc('0x67')]['mapKey']]=_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')];return db[_0xcdbc('0x9c')]['find']({'where':{'id':_0x59e039[_0xcdbc('0x77')][_0xcdbc('0x83')]},'include':[{'model':db[_0xcdbc('0x7c')],'as':_0xcdbc('0x9d'),'where':_0x8d7e4c,'limit':0x1,'order':[['updatedAt',_0xcdbc('0x9e')]]}]});})[_0xcdbc('0x21')](handleEntityNotFound(_0x2c4407,null))['then'](function(_0x3b52fc){if(_0x3b52fc){_0x59e039[_0xcdbc('0x9f')]=_[_0xcdbc('0xa0')](_0x3b52fc,['Contacts']);if(_0x3b52fc[_0xcdbc('0x9d')]['length']){return _0x3b52fc[_0xcdbc('0x9d')][0x0];}var _0x54ac8f=_[_0xcdbc('0x1b')](_0x59e039[_0xcdbc('0x67')],{'firstName':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')],'ListId':_0x3b52fc['id']});_0x54ac8f[_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x9a')]]=_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')];return db[_0xcdbc('0x7c')][_0xcdbc('0x5f')](_0x54ac8f,{'fields':_0x42a053,'raw':!![]});}})[_0xcdbc('0x21')](handleEntityNotFound(_0x2c4407,null))[_0xcdbc('0x21')](function(_0x4ca1a8){if(_0x4ca1a8){_0x59e039['contact']=_0x4ca1a8;var _0x2d9c81={'ContactId':_0x4ca1a8['id'],'phone':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x84')],'SmsAccountId':_0x5704dd[_0xcdbc('0x59')]['id']};var _0x94d561={'ContactId':_0x4ca1a8['id'],'SmsAccountId':_0x5704dd[_0xcdbc('0x59')]['id'],'closed':![]};return db[_0xcdbc('0xa1')]['find']({'where':_0x94d561})[_0xcdbc('0x21')](function(_0x389228){if(_0x389228){return[_0x389228,![]];}return db[_0xcdbc('0xa1')][_0xcdbc('0x5f')](_0x2d9c81)[_0xcdbc('0x21')](function(_0x2a4adc){return[_0x2a4adc,!![]];});});}})['spread'](function(_0x105c37,_0x3be347){_0x59e039['interaction']=_0x105c37[_0xcdbc('0x37')]({'plain':!![]});_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xa3')]=![];if(_0x3be347){if(_0x59e039[_0xcdbc('0x77')][_0xcdbc('0xa4')]){_0x59e039[_0xcdbc('0x78')][_0xcdbc('0xa5')]({'id':0x0,'priority':_0x59e039['applications'][_0xcdbc('0x4b')]+0x1,'app':_0xcdbc('0xa6'),'appdata':'unmanaged','interval':_0xcdbc('0xa7')});}_0x59e039[_0xcdbc('0xa2')]['created']=!![];}return db['SmsMessage'][_0xcdbc('0x5f')]({'phone':_0x59e039['body'][_0xcdbc('0x84')],'messageId':_0x59e039[_0xcdbc('0x67')]['messageId'],'body':_0x59e039[_0xcdbc('0x67')][_0xcdbc('0x67')],'SmsAccountId':_0x5704dd[_0xcdbc('0x59')]['id'],'SmsInteractionId':_0x105c37['id'],'direction':'in','ContactId':_0x105c37[_0xcdbc('0xa8')],'AttachmentId':_0x59e039['body'][_0xcdbc('0xa9')]});})['then'](function(_0x59a522){_0x59e039[_0xcdbc('0x28')]=_0x59a522;if(!_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xaa')])return;return db[_0xcdbc('0xab')][_0xcdbc('0x5d')]({'attributes':['id','name'],'where':{'id':_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xaa')]}});})[_0xcdbc('0x21')](function(_0x2ee1e0){if(_0x2ee1e0){_0x59e039[_0xcdbc('0x78')][_0xcdbc('0xac')]({'id':0x0,'priority':0x0,'app':_0xcdbc('0xad'),'appdata':_0x2ee1e0[_0xcdbc('0x3c')]+','+(_0x59e039[_0xcdbc('0x77')][_0xcdbc('0xae')]||0xa),'interval':_0xcdbc('0xa7')});}if(!_0x59e039[_0xcdbc('0xa2')][_0xcdbc('0xaf')])return;return db[_0xcdbc('0xb0')][_0xcdbc('0x5d')]({'attributes':['id',_0xcdbc('0x3c')],'where':{'id':_0x59e039['interaction']['queueId']}});})[_0xcdbc('0x21')](function(_0x3ab0d2){if(_0x3ab0d2){_0x59e039['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xcdbc('0xb1'),'appdata':_0x3ab0d2['name']+','+(_0x59e039['account']['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xcdbc('0xb2'),_0xcdbc('0xb3'),_0x59e039);})['then'](function(_0x69e00e){if(_0x69e00e){var _0x1a82df=0xc8;var _0x3385ca=_0xcdbc('0xb4');logger[_0xcdbc('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x3385ca,_0x1a82df,'entity\x20found');logger[_0xcdbc('0xb5')](_0xcdbc('0xb6'),_0x3385ca,_0x1a82df,_0xcdbc('0xb7'),JSON[_0xcdbc('0xb8')](_0x69e00e));if(_0x59e039['account'][_0xcdbc('0x44')]===_0xcdbc('0xb9')){return _0x2c4407[_0xcdbc('0x2b')](_0x1a82df)[_0xcdbc('0xba')](_0xcdbc('0xbb'),_0xcdbc('0xbc'))['send']('\x0a');}else{return _0x2c4407[_0xcdbc('0x2b')](_0x1a82df)[_0xcdbc('0x31')](_0x69e00e);}}})[_0xcdbc('0x5e')](handleError(_0x2c4407,null));};exports['addApplications']=function(_0x41419a,_0x2e7122){var _0x522d7b=_0x41419a[_0xcdbc('0x59')]['id'];var _0x522058=_0x41419a[_0xcdbc('0x67')];var _0x429f18=0xc8;var _0x52081e=null;return db[_0xcdbc('0xbd')][_0xcdbc('0xbe')]({'isolationLevel':db[_0xcdbc('0xbd')][_0xcdbc('0xbf')][_0xcdbc('0xc0')][_0xcdbc('0xc1')]},function(_0xcc51f8){return db['SmsAccount'][_0xcdbc('0x6c')]({'where':{'id':_0x522d7b},'transaction':_0xcc51f8})[_0xcdbc('0x21')](function(_0x263646){if(_0x263646){return db[_0xcdbc('0x76')]['destroy']({'where':{'SmsAccountId':_0x522d7b},'transaction':_0xcc51f8})['then'](function(){var _0x253910=_[_0xcdbc('0x41')](_0x522058,function(_0x5bc0fa){_0x5bc0fa[_0xcdbc('0x69')]=_0x522d7b;return _0x5bc0fa;});return db[_0xcdbc('0x76')][_0xcdbc('0xc2')](_0x253910,{'transaction':_0xcc51f8});});}else{_0x429f18=0x194;_0x52081e=[];}});})[_0xcdbc('0x21')](function(){if(_0x429f18!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x522d7b},'order':'priority'})[_0xcdbc('0x21')](function(_0x5a48ec){_0x52081e=_0x5a48ec;});}})[_0xcdbc('0x5e')](function(_0x1f3554){_0x429f18=0x1f4;logger['error'](_0x1f3554[_0xcdbc('0x3b')]);if(_0x1f3554['name']){delete _0x1f3554[_0xcdbc('0x3c')];}_0x52081e=_0x1f3554;})[_0xcdbc('0xc3')](function(){if(_0x52081e===null){_0x2e7122[_0xcdbc('0x2a')](_0x429f18);}else{if(_0x429f18===0x1f4){_0x2e7122[_0xcdbc('0x2b')](_0x429f18)[_0xcdbc('0x3d')](_0x52081e);}else{_0x2e7122[_0xcdbc('0x2b')](_0x429f18)[_0xcdbc('0x31')](_0x52081e);}}});};exports[_0xcdbc('0xc4')]=function(_0x599b93,_0x4b6d43,_0xa4f118){var _0x4d75d1={};var _0x8d806a={};var _0x41eb12;var _0x51f76f;return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0x599b93['params']['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4b6d43,null))[_0xcdbc('0x21')](function(_0x4ea2a4){if(_0x4ea2a4){_0x41eb12=_0x4ea2a4;_0x8d806a['model']=_[_0xcdbc('0x46')](db[_0xcdbc('0x76')][_0xcdbc('0x5a')]);_0x8d806a[_0xcdbc('0x47')]=_['keys'](_0x599b93[_0xcdbc('0x47')]);_0x8d806a['filters']=_[_0xcdbc('0x48')](_0x8d806a[_0xcdbc('0x5b')],_0x8d806a['query']);_0x4d75d1[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x8d806a[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x599b93[_0xcdbc('0x47')][_0xcdbc('0x4a')]));_0x4d75d1[_0xcdbc('0x49')]=_0x4d75d1[_0xcdbc('0x49')][_0xcdbc('0x4b')]?_0x4d75d1[_0xcdbc('0x49')]:_0x8d806a['model'];_0x4d75d1[_0xcdbc('0x4d')]=qs[_0xcdbc('0x4e')](_0x599b93[_0xcdbc('0x47')][_0xcdbc('0x4e')]);_0x4d75d1['where']=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x599b93[_0xcdbc('0x47')],_0x8d806a[_0xcdbc('0x4f')]));if(_0x599b93[_0xcdbc('0x47')]['filter']){_0x4d75d1[_0xcdbc('0x52')]=_[_0xcdbc('0x53')](_0x4d75d1['where'],{'$or':_[_0xcdbc('0x41')](_0x4d75d1['attributes'],function(_0x31e6ce){var _0x366975={};_0x366975[_0x31e6ce]={'$like':'%'+_0x599b93[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x366975;})});}_0x4d75d1=_[_0xcdbc('0x53')]({},_0x4d75d1,_0x599b93['options']);return _0x41eb12[_0xcdbc('0xc4')](_0x4d75d1);}})[_0xcdbc('0x21')](function(_0x5dabb8){if(_0x5dabb8){_0x51f76f=_0x5dabb8['length'];if(!_0x599b93['query'][_0xcdbc('0x72')](_0xcdbc('0x4c'))){_0x4d75d1['limit']=qs['limit'](_0x599b93['query'][_0xcdbc('0x2f')]);_0x4d75d1[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x599b93[_0xcdbc('0x47')]['offset']);}return _0x41eb12[_0xcdbc('0xc4')](_0x4d75d1);}})[_0xcdbc('0x21')](function(_0xa995a2){if(_0xa995a2){return _0xa995a2?{'count':_0x51f76f,'rows':_0xa995a2}:null;}})[_0xcdbc('0x21')](respondWithResult(_0x4b6d43,null))['catch'](handleError(_0x4b6d43,null));};exports[_0xcdbc('0xc5')]=function(_0x49bb32,_0x321291,_0x1efd6c){var _0x20fa6b={'raw':![],'where':{}};var _0x3b9cae={};var _0x27ed07={'count':0x0,'rows':[]};return db['SmsAccount'][_0xcdbc('0x6c')]({'where':{'id':_0x49bb32['params']['id']}})['then'](handleEntityNotFound(_0x321291,null))['then'](function(_0x42e8e8){if(_0x42e8e8){_0x3b9cae['model']=_[_0xcdbc('0x46')](db[_0xcdbc('0xa1')][_0xcdbc('0x5a')]);_0x3b9cae['query']=_['keys'](_0x49bb32['query']);_0x3b9cae[_0xcdbc('0x4f')]=_[_0xcdbc('0x48')](_0x3b9cae[_0xcdbc('0x5b')],_0x3b9cae[_0xcdbc('0x47')]);_0x20fa6b[_0xcdbc('0x49')]=_['intersection'](_0x3b9cae[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x49bb32['query']['fields']));_0x20fa6b['attributes']=_0x20fa6b['attributes'][_0xcdbc('0x4b')]?_0x20fa6b[_0xcdbc('0x49')]:_0x3b9cae[_0xcdbc('0x5b')];if(!_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x72')](_0xcdbc('0x4c'))){_0x20fa6b[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x2f')]);_0x20fa6b[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x49bb32[_0xcdbc('0x47')]['offset']);}_0x20fa6b['order']=qs[_0xcdbc('0x4e')](_0x49bb32['query']['sort']);_0x20fa6b['where']=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x49bb32['query'],_0x3b9cae[_0xcdbc('0x4f')]));_0x20fa6b[_0xcdbc('0x52')][_0xcdbc('0x69')]=_0x42e8e8['id'];if(_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x51')]){_0x20fa6b['where']=_['merge'](_0x20fa6b[_0xcdbc('0x52')],{'$or':_[_0xcdbc('0x41')](_0x20fa6b[_0xcdbc('0x49')],function(_0x56c076){var _0x27930f={};_0x27930f[_0x56c076]={'$like':'%'+_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0x51')]+'%'};return _0x27930f;})});}_0x20fa6b=_[_0xcdbc('0x53')]({},_0x20fa6b,_0x49bb32[_0xcdbc('0x55')]);return db[_0xcdbc('0xa1')][_0xcdbc('0x2d')]({'where':_0x20fa6b[_0xcdbc('0x52')]})[_0xcdbc('0x21')](function(_0x588f6c){_0x27ed07['count']=_0x588f6c;if(_0x49bb32[_0xcdbc('0x47')]['includeAll']){_0x20fa6b[_0xcdbc('0x6d')]=[{'model':db['CmContact'],'as':_0xcdbc('0xc6'),'required':![]},{'model':db[_0xcdbc('0xab')],'as':_0xcdbc('0xc7'),'attributes':[_0xcdbc('0x3c'),_0xcdbc('0xc8'),'internal'],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0xcdbc('0xc9')],'where':_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0xca')]?{'id':_0x49bb32[_0xcdbc('0x47')]['tag']}:undefined,'required':_0x49bb32[_0xcdbc('0x47')][_0xcdbc('0xca')]?!![]:![]}];}return db[_0xcdbc('0xa1')][_0xcdbc('0x56')](_0x20fa6b);})[_0xcdbc('0x21')](function(_0x50e708){_0x27ed07[_0xcdbc('0x57')]=_0x50e708;return _0x27ed07;});}})[_0xcdbc('0x21')](respondWithFilteredResult(_0x321291,_0x20fa6b))[_0xcdbc('0x5e')](handleError(_0x321291,null));};exports['send']=function(_0xbcb0b7,_0x4554a8,_0x1d5680){var _0x3eab1b,_0x5a1b42,_0xeec346;if(_[_0xcdbc('0x97')](_0xbcb0b7[_0xcdbc('0x67')][_0xcdbc('0x67')])||_0xbcb0b7[_0xcdbc('0x67')][_0xcdbc('0x67')]===''){throw new db['Sequelize'][(_0xcdbc('0x7e'))](_0xcdbc('0x99'));}if(_[_0xcdbc('0x97')](_0xbcb0b7['body']['to'])){throw new db[(_0xcdbc('0x7d'))][(_0xcdbc('0x7e'))](_0xcdbc('0xcb'));}_0x3eab1b=_0xbcb0b7['body']['to'];return db[_0xcdbc('0x42')]['find']({'where':{'id':_0xbcb0b7['params']['id']},'include':[{'model':db[_0xcdbc('0x9c')],'as':_0xcdbc('0xcc'),'include':[{'model':db[_0xcdbc('0x7c')],'as':_0xcdbc('0x9d'),'where':{'mobile':_0x3eab1b},'limit':0x1,'order':[['updatedAt',_0xcdbc('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x4554a8,null))[_0xcdbc('0x21')](function(_0x6abc2a){if(_0x6abc2a&&_0x6abc2a[_0xcdbc('0xcc')]){_0x5a1b42=_0x6abc2a[_0xcdbc('0x37')]({'plain':!![]});if(_0x5a1b42[_0xcdbc('0xcc')]&&_0x5a1b42[_0xcdbc('0xcc')]['Contacts'][_0xcdbc('0x4b')]){return _0x5a1b42[_0xcdbc('0xcc')][_0xcdbc('0x9d')][0x0];}return db['CmContact'][_0xcdbc('0x5f')](_[_0xcdbc('0x1b')](_0xbcb0b7['body'],{'firstName':_0x3eab1b,'mobile':_0x3eab1b,'phone':_0x3eab1b,'ListId':_0x5a1b42[_0xcdbc('0x83')]}));}})[_0xcdbc('0x21')](handleEntityNotFound(_0x4554a8,null))['then'](function(_0x1943e5){if(_0x1943e5){_0xeec346=_0x1943e5;return db['SmsInteraction'][_0xcdbc('0x5d')]({'where':{'ContactId':_0xeec346['id'],'closed':![],'SmsAccountId':_0x5a1b42['id']}})[_0xcdbc('0x21')](function(_0x1d90c7){if(_0x1d90c7){return[_0x1d90c7,![]];}return db[_0xcdbc('0xa1')][_0xcdbc('0x5f')]({'UserId':_0xbcb0b7['user']['id'],'ContactId':_0xeec346['id'],'SmsAccountId':_0x5a1b42['id'],'phone':_0x3eab1b,'firstMsgDirection':_0xcdbc('0xcd'),'Messages':[_['merge'](_0xbcb0b7[_0xcdbc('0x67')],{'read':![],'body':_0xbcb0b7['body']['body'],'phone':_0x3eab1b,'SmsAccountId':_0x5a1b42['id'],'UserId':_0xbcb0b7[_0xcdbc('0x60')]['id'],'ContactId':_0xeec346['id']})]},{'include':[{'model':db['SmsMessage'],'as':_0xcdbc('0xce')}]})['then'](function(_0x5abb81){return[_0x5abb81,!![]];});});}})['spread'](function(_0x1f024a,_0x439a51){if(_0x439a51){return _0x1f024a;}return db[_0xcdbc('0xcf')][_0xcdbc('0x5f')](_[_0xcdbc('0x53')](_0xbcb0b7[_0xcdbc('0x67')],{'read':![],'body':_0xbcb0b7[_0xcdbc('0x67')][_0xcdbc('0x67')],'phone':_0x3eab1b,'SmsAccountId':_0x5a1b42['id'],'SmsInteractionId':_0x1f024a['id'],'UserId':_0xbcb0b7[_0xcdbc('0x60')]['id'],'ContactId':_0xeec346['id']}))[_0xcdbc('0x21')](function(_0x3154da){_0x1f024a['dataValues']['Messages']=[];_0x1f024a['dataValues'][_0xcdbc('0xce')][_0xcdbc('0xa5')](_0x3154da[_0xcdbc('0xd0')]);return _0x1f024a;});})[_0xcdbc('0x21')](respondWithResult(_0x4554a8,null))[_0xcdbc('0x5e')](handleError(_0x4554a8,null));};exports[_0xcdbc('0x2b')]=function(_0x5e72ed,_0x950e4c,_0x3ea148){if(_0x5e72ed[_0xcdbc('0x67')]['id']){delete _0x5e72ed['body']['id'];}var _0x297752,_0xa30171,_0x512fff;return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x5e72ed[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x950e4c,null))['then'](function(_0x34513d){if(_0x34513d){_0x512fff=_0x34513d;logger['debug'](_0xcdbc('0x24'),_0xcdbc('0x2b'),'received\x20delivery\x20report\x20from',_0x34513d[_0xcdbc('0x44')],util[_0xcdbc('0xd1')](_0x5e72ed['body'],{'showHidden':![],'depth':null}));switch(_0x34513d[_0xcdbc('0x44')]){case _0xcdbc('0x87'):if(_0x5e72ed['body'][_0xcdbc('0xd2')]&&_0x5e72ed[_0xcdbc('0x67')]['status']){_0xa30171=_0x5e72ed[_0xcdbc('0x67')]['status'];return db[_0xcdbc('0xcf')]['find']({'where':{'messageId':_0x5e72ed['body'][_0xcdbc('0xd2')]}});}break;case _0xcdbc('0xd3'):if(_0x5e72ed['body'][_0xcdbc('0xd4')]&&_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd5')]){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd5')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd4')]}});}break;case _0xcdbc('0x89'):if(_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0x8b')]&&_0x5e72ed['body']['status_code']){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xd6')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed['body'][_0xcdbc('0x8b')]}});}break;case _0xcdbc('0x8e'):var _0xcd687f=_0x5e72ed['body'][_0xcdbc('0x8f')][0x0];if(_0xcd687f[_0xcdbc('0x8a')]&&_0xcd687f[_0xcdbc('0x2b')]['groupName']===_0xcdbc('0xd7')){_0xa30171=_0xcd687f[_0xcdbc('0x2b')][_0xcdbc('0xd8')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0xcd687f[_0xcdbc('0x8a')]}});}break;case _0xcdbc('0xd9'):if(_0x5e72ed[_0xcdbc('0x67')]['messageId']&&_0x5e72ed['body'][_0xcdbc('0x2b')]){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0x2b')];return db[_0xcdbc('0xcf')]['find']({'where':{'messageId':_0x5e72ed['body'][_0xcdbc('0x8a')]}});}break;case'bandwidth':if(_0x5e72ed[_0xcdbc('0x67')][0x0]['message']['id']){_0xa30171=_0x5e72ed[_0xcdbc('0x67')][0x0][_0xcdbc('0x44')];return db['SmsMessage'][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed[_0xcdbc('0x67')][0x0][_0xcdbc('0x28')]['id']}});}break;case _0xcdbc('0x95'):if(_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xda')]&&_0x5e72ed[_0xcdbc('0x67')]['status']){_0xa30171=_0x5e72ed['body'][_0xcdbc('0x2b')];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x5e72ed[_0xcdbc('0x67')][_0xcdbc('0xda')]}});}break;}}})[_0xcdbc('0x21')](handleEntityNotFound(_0x950e4c,null))[_0xcdbc('0x21')](function(_0x5d1dd9){if(_0x5d1dd9){_0x297752=_0x5d1dd9;switch(_0x512fff[_0xcdbc('0x44')]){case _0xcdbc('0x87'):if(_0xa30171===_0xcdbc('0xd7')){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x87'),util[_0xcdbc('0xd1')](_0x5e72ed['body'],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0xd3'):if(_0xa30171==='1'){return _0x297752[_0xcdbc('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xcdbc('0x2b'),_0xcdbc('0x87'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x89'):if(!_0x5e72ed['body']['error_code']&&_0xa30171>=0xc8&&_0xa30171<=0xce){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x89'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x8e'):var _0x1d7133=_0x5e72ed[_0xcdbc('0x67')]['results'][0x0];if(_0x1d7133[_0xcdbc('0x2b')]['groupName']===_0xcdbc('0xd7')){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),'status','infobip',util['inspect'](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xa30171=='DELIVERED_TO_GATEWAY'||_0xa30171==_0xcdbc('0xdb')){return _0x297752['update']({'read':!![]});}else{logger[_0xcdbc('0x25')](_0xcdbc('0x24'),'status','clickatell',util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x94'):if(_0xa30171=='message-delivered'){return _0x297752[_0xcdbc('0x35')]({'read':!![]});}else{logger['error'](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x94'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;case _0xcdbc('0x95'):if(_0xa30171===_0xcdbc('0xdc')||_0xa30171===_0xcdbc('0xdd')){return _0x297752[_0xcdbc('0x35')]({'read':!![]});}else{logger['error'](_0xcdbc('0x24'),_0xcdbc('0x2b'),_0xcdbc('0x95'),util[_0xcdbc('0xd1')](_0x5e72ed[_0xcdbc('0x67')],{'showHidden':![],'depth':null}));}break;}return _0x297752;}})[_0xcdbc('0x21')](respondWithResult(_0x950e4c,null))[_0xcdbc('0x5e')](handleError(_0x950e4c,null));};exports[_0xcdbc('0xde')]=function(_0x544c8d,_0x50098e,_0x4110de){var _0x5bd3f4,_0x380815,_0x31390b;return db['SmsAccount'][_0xcdbc('0x5d')]({'where':{'id':_0x544c8d[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x50098e,null))[_0xcdbc('0x21')](function(_0x35fa4b){if(_0x35fa4b){_0x31390b=_0x35fa4b;logger[_0xcdbc('0xb5')](_0xcdbc('0x24'),_0xcdbc('0x2b'),'received\x20delivery\x20report\x20from',_0x35fa4b[_0xcdbc('0x44')],util[_0xcdbc('0xd1')](_0x544c8d[_0xcdbc('0x47')],{'showHidden':![],'depth':null}));switch(_0x35fa4b[_0xcdbc('0x44')]){case'csc':if(_0x544c8d[_0xcdbc('0x47')][_0xcdbc('0xdf')]&&_0x544c8d[_0xcdbc('0x47')][_0xcdbc('0xe0')]){_0x380815=_0x544c8d['query']['state'];return db[_0xcdbc('0xcf')][_0xcdbc('0x5d')]({'where':{'messageId':_0x544c8d[_0xcdbc('0x47')][_0xcdbc('0xdf')]}});}break;}}})[_0xcdbc('0x21')](handleEntityNotFound(_0x50098e,null))[_0xcdbc('0x21')](function(_0x42987f){if(_0x42987f){_0x5bd3f4=_0x42987f;switch(_0x31390b[_0xcdbc('0x44')]){case _0xcdbc('0x91'):if(_0x380815==='2'||_0x380815==='6'){return _0x5bd3f4[_0xcdbc('0x35')]({'read':!![]});}else{logger['error'](_0xcdbc('0x24'),'status',_0xcdbc('0x91'),util[_0xcdbc('0xd1')](_0x544c8d['query'],{'showHidden':![],'depth':null}));};break;}return _0x5bd3f4;}})[_0xcdbc('0x21')](respondWithResult(_0x50098e,null))[_0xcdbc('0x5e')](handleError(_0x50098e,null));};exports[_0xcdbc('0xe1')]=function(_0x4d859b,_0x28acb9,_0x144670){return db[_0xcdbc('0x42')][_0xcdbc('0x5d')]({'where':{'id':_0x4d859b[_0xcdbc('0x59')]['id']}})['then'](handleEntityNotFound(_0x28acb9,null))['then'](function(_0x4cdfec){if(_0x4cdfec){return _0x4cdfec[_0xcdbc('0xe1')](_0x4d859b[_0xcdbc('0x67')][_0xcdbc('0x6f')],_[_0xcdbc('0xa0')](_0x4d859b[_0xcdbc('0x67')],[_0xcdbc('0x6f'),'id'])||{})['spread'](function(_0x42c619){for(var _0x186aaa=0x0;_0x186aaa<_0x4d859b[_0xcdbc('0x67')][_0xcdbc('0x6f')]['length'];_0x186aaa+=0x1){socket[_0xcdbc('0xe2')](_0xcdbc('0xe3'),{'UserId':Number(_0x4d859b['body'][_0xcdbc('0x6f')][_0x186aaa]),'SmsAccountId':Number(_0x4d859b[_0xcdbc('0x59')]['id'])});}return _0x42c619;});}})[_0xcdbc('0x21')](respondWithResult(_0x28acb9,null))[_0xcdbc('0x5e')](handleError(_0x28acb9,null));};exports['removeAgents']=function(_0x1239a0,_0x3493fa,_0x5b9d2a){return db[_0xcdbc('0x42')]['find']({'where':{'id':_0x1239a0[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x3493fa,null))[_0xcdbc('0x21')](function(_0x119361){if(_0x119361){return _0x119361['removeAgents'](_0x1239a0['query'][_0xcdbc('0x6f')])['then'](function(){if(_[_0xcdbc('0xe4')](_0x1239a0[_0xcdbc('0x47')][_0xcdbc('0x6f')])){for(var _0x2ae061=0x0;_0x2ae061<_0x1239a0[_0xcdbc('0x47')][_0xcdbc('0x6f')][_0xcdbc('0x4b')];_0x2ae061+=0x1){socket[_0xcdbc('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x1239a0['query'][_0xcdbc('0x6f')][_0x2ae061]),'SmsAccountId':Number(_0x1239a0[_0xcdbc('0x59')]['id'])});}}else{socket[_0xcdbc('0xe2')](_0xcdbc('0xe5'),{'UserId':Number(_0x1239a0[_0xcdbc('0x47')][_0xcdbc('0x6f')]),'SmsAccountId':Number(_0x1239a0['params']['id'])});}});}})[_0xcdbc('0x21')](respondWithStatusCode(_0x3493fa,null))[_0xcdbc('0x5e')](handleError(_0x3493fa,null));};exports['getAgents']=function(_0x2500b3,_0x356de6,_0xe3ebed){var _0x32d975={};var _0x4c5638={};var _0x1cb468;var _0x43d451;return db[_0xcdbc('0x42')][_0xcdbc('0x6c')]({'where':{'id':_0x2500b3[_0xcdbc('0x59')]['id']}})[_0xcdbc('0x21')](handleEntityNotFound(_0x356de6,null))['then'](function(_0x43bdfb){if(_0x43bdfb){_0x1cb468=_0x43bdfb;_0x4c5638[_0xcdbc('0x5b')]=_[_0xcdbc('0x46')](db['User']['rawAttributes']);_0x4c5638[_0xcdbc('0x47')]=_['keys'](_0x2500b3[_0xcdbc('0x47')]);_0x4c5638[_0xcdbc('0x4f')]=_['intersection'](_0x4c5638['model'],_0x4c5638[_0xcdbc('0x47')]);_0x32d975[_0xcdbc('0x49')]=_[_0xcdbc('0x48')](_0x4c5638[_0xcdbc('0x5b')],qs[_0xcdbc('0x4a')](_0x2500b3[_0xcdbc('0x47')][_0xcdbc('0x4a')]));_0x32d975[_0xcdbc('0x49')]=_0x32d975[_0xcdbc('0x49')][_0xcdbc('0x4b')]?_0x32d975[_0xcdbc('0x49')]:_0x4c5638[_0xcdbc('0x5b')];_0x32d975['order']=qs[_0xcdbc('0x4e')](_0x2500b3['query']['sort']);_0x32d975[_0xcdbc('0x52')]=qs[_0xcdbc('0x4f')](_[_0xcdbc('0x50')](_0x2500b3[_0xcdbc('0x47')],_0x4c5638['filters']));if(_0x2500b3['query']['filter']){_0x32d975['where']=_['merge'](_0x32d975[_0xcdbc('0x52')],{'$or':_[_0xcdbc('0x41')](_0x32d975['attributes'],function(_0xc94826){var _0x2f724f={};_0x2f724f[_0xc94826]={'$like':'%'+_0x2500b3['query'][_0xcdbc('0x51')]+'%'};return _0x2f724f;})});}_0x32d975=_[_0xcdbc('0x53')]({},_0x32d975,_0x2500b3[_0xcdbc('0x55')]);return _0x1cb468['getAgents'](_0x32d975);}})['then'](function(_0x73271f){if(_0x73271f){_0x43d451=_0x73271f['length'];if(!_0x2500b3[_0xcdbc('0x47')]['hasOwnProperty'](_0xcdbc('0x4c'))){_0x32d975[_0xcdbc('0x2f')]=qs[_0xcdbc('0x2f')](_0x2500b3[_0xcdbc('0x47')]['limit']);_0x32d975[_0xcdbc('0x2e')]=qs[_0xcdbc('0x2e')](_0x2500b3[_0xcdbc('0x47')][_0xcdbc('0x2e')]);}return _0x1cb468[_0xcdbc('0xe6')](_0x32d975);}})[_0xcdbc('0x21')](function(_0x192d8f){if(_0x192d8f){return _0x192d8f?{'count':_0x43d451,'rows':_0x192d8f}:null;}})[_0xcdbc('0x21')](respondWithResult(_0x356de6,null))[_0xcdbc('0x5e')](handleError(_0x356de6,null));}; \ No newline at end of file +var _0x8e5b=['UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','waitForTheAssignedQueue','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','priority','finally','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','List','dataValues','Messages','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','connectel','requestid','statusInt','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','client','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','fieldName','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','rawAttributes','length','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','from','Body','MessageSid','sender','text','clicksend','messageId','message_id','plivo','From','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','SmsInteraction','spread','interaction','created','autoclose','push','SmsMessage','ContactId','AttachmentId'];(function(_0x403f33,_0x208c94){var _0x5928db=function(_0x2e5695){while(--_0x2e5695){_0x403f33['push'](_0x403f33['shift']());}};_0x5928db(++_0x208c94);}(_0x8e5b,0x12d));var _0xb8e5=function(_0x560d6b,_0xd9537d){_0x560d6b=_0x560d6b-0x0;var _0x49848e=_0x8e5b[_0x560d6b];return _0x49848e;};'use strict';var emlformat=require(_0xb8e5('0x0'));var rimraf=require(_0xb8e5('0x1'));var zipdir=require(_0xb8e5('0x2'));var jsonpatch=require(_0xb8e5('0x3'));var rp=require(_0xb8e5('0x4'));var moment=require(_0xb8e5('0x5'));var BPromise=require(_0xb8e5('0x6'));var Mustache=require('mustache');var util=require(_0xb8e5('0x7'));var path=require(_0xb8e5('0x8'));var sox=require(_0xb8e5('0x9'));var csv=require(_0xb8e5('0xa'));var ejs=require(_0xb8e5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xb8e5('0xc'));var jsforce=require(_0xb8e5('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb8e5('0xa'));var querystring=require(_0xb8e5('0xe'));var Papa=require('papaparse');var Redis=require(_0xb8e5('0xf'));var authService=require(_0xb8e5('0x10'));var qs=require(_0xb8e5('0x11'));var as=require(_0xb8e5('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8e5('0x13'))(_0xb8e5('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb8e5('0x15'))['db'];config['redis']=_[_0xb8e5('0x16')](config[_0xb8e5('0x17')],{'host':_0xb8e5('0x18'),'port':0x18eb});var socket=require(_0xb8e5('0x19'))(new Redis(config['redis']));require(_0xb8e5('0x1a'))[_0xb8e5('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xb8e5('0x1c')][_0xb8e5('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0xf14c76,_0xd25ef,_0x2c2995,_0x4d424a){return new BPromise(function(_0x2869c9,_0x230fa9){var _0x539f2e=_0x4d424a||client;return _0x539f2e[_0xb8e5('0x1e')](_0xf14c76,_0x2c2995)[_0xb8e5('0x1f')](function(_0x20dfc9){logger[_0xb8e5('0x20')]('SmsAccount,\x20%s,\x20%s',_0xd25ef,'request\x20sent');logger[_0xb8e5('0x21')](_0xb8e5('0x22'),_0xd25ef,_0xb8e5('0x23'),JSON['stringify'](_0x20dfc9));if(_0x20dfc9[_0xb8e5('0x24')]){if(_0x20dfc9[_0xb8e5('0x24')][_0xb8e5('0x25')]===0x1f4){logger['error'](_0xb8e5('0x26'),_0xd25ef,_0x20dfc9['error'][_0xb8e5('0x27')]);return _0x230fa9(_0x20dfc9['error'][_0xb8e5('0x27')]);}logger[_0xb8e5('0x24')](_0xb8e5('0x26'),_0xd25ef,_0x20dfc9[_0xb8e5('0x24')][_0xb8e5('0x27')]);return _0x2869c9(_0x20dfc9[_0xb8e5('0x24')][_0xb8e5('0x27')]);}else{logger[_0xb8e5('0x20')](_0xb8e5('0x26'),_0xd25ef,'request\x20sent');_0x2869c9(_0x20dfc9[_0xb8e5('0x28')][_0xb8e5('0x27')]);}})[_0xb8e5('0x29')](function(_0x20a869){logger[_0xb8e5('0x24')]('SmsAccount,\x20%s,\x20%s',_0xd25ef,_0x20a869);_0x230fa9(_0x20a869);});});}function respondWithStatusCode(_0x17b165,_0x2698b2){_0x2698b2=_0x2698b2||0xcc;return function(_0xc3107d){if(_0xc3107d){return _0x17b165[_0xb8e5('0x2a')](_0x2698b2);}return _0x17b165[_0xb8e5('0x2b')](_0x2698b2)[_0xb8e5('0x2c')]();};}function respondWithResult(_0x3028ef,_0x43e5f7){_0x43e5f7=_0x43e5f7||0xc8;return function(_0x40e630){if(_0x40e630){return _0x3028ef[_0xb8e5('0x2b')](_0x43e5f7)['json'](_0x40e630);}};}function respondWithFilteredResult(_0x2747cf,_0x25cb6a){return function(_0x2ebddc){if(_0x2ebddc){var _0x47d2eb=typeof _0x25cb6a[_0xb8e5('0x2d')]==='undefined'&&typeof _0x25cb6a[_0xb8e5('0x2e')]===_0xb8e5('0x2f');var _0x9a458f=_0x2ebddc[_0xb8e5('0x30')];var _0x1110d4=_0x47d2eb?0x0:_0x25cb6a[_0xb8e5('0x2d')];var _0x3bb70f=_0x47d2eb?_0x2ebddc[_0xb8e5('0x30')]:_0x25cb6a[_0xb8e5('0x2d')]+_0x25cb6a['limit'];var _0x5649d1;if(_0x3bb70f>=_0x9a458f){_0x3bb70f=_0x9a458f;_0x5649d1=0xc8;}else{_0x5649d1=0xce;}_0x2747cf['status'](_0x5649d1);return _0x2747cf['set'](_0xb8e5('0x31'),_0x1110d4+'-'+_0x3bb70f+'/'+_0x9a458f)[_0xb8e5('0x32')](_0x2ebddc);}return null;};}function patchUpdates(_0x105cf9){return function(_0x270982){try{jsonpatch[_0xb8e5('0x33')](_0x270982,_0x105cf9,!![]);}catch(_0x5320c2){return BPromise['reject'](_0x5320c2);}return _0x270982[_0xb8e5('0x34')]();};}function saveUpdates(_0x5cd4dc,_0x4277ea){return function(_0x4aefc4){if(_0x4aefc4){return _0x4aefc4[_0xb8e5('0x35')](_0x5cd4dc)[_0xb8e5('0x1f')](function(_0x45911d){return _0x45911d;});}return null;};}function removeEntity(_0x43d18c,_0x3e2caa){return function(_0x3da137){if(_0x3da137){return _0x3da137[_0xb8e5('0x36')]()['then'](function(){var _0xaf308c=_0x3da137['get']({'plain':!![]});var _0x1c3e3c=_0xb8e5('0x37');return db[_0xb8e5('0x38')]['destroy']({'where':{'type':_0x1c3e3c,'resourceId':_0xaf308c['id']}})[_0xb8e5('0x1f')](function(){return _0x3da137;});})[_0xb8e5('0x1f')](function(){_0x43d18c[_0xb8e5('0x2b')](0xcc)[_0xb8e5('0x2c')]();});}};}function handleEntityNotFound(_0x3da113,_0x3626de){return function(_0xfefeb1){if(!_0xfefeb1){_0x3da113[_0xb8e5('0x2a')](0x194);}return _0xfefeb1;};}function handleError(_0x2ffe22,_0x3bd153){_0x3bd153=_0x3bd153||0x1f4;return function(_0x1c6f71){logger[_0xb8e5('0x24')](_0x1c6f71[_0xb8e5('0x39')]);if(_0x1c6f71[_0xb8e5('0x3a')]){delete _0x1c6f71[_0xb8e5('0x3a')];}_0x2ffe22[_0xb8e5('0x2b')](_0x3bd153)[_0xb8e5('0x3b')](_0x1c6f71);};}exports[_0xb8e5('0x3c')]=function(_0x1ca361,_0x15722f){var _0x1e0a4e={'include':[{'model':db[_0xb8e5('0x3d')],'as':_0xb8e5('0x3e')}]},_0x275810={},_0x1a5046={'count':0x0,'rows':[]};var _0x2b8a47=_[_0xb8e5('0x3f')](db[_0xb8e5('0x40')]['rawAttributes'],function(_0x4720e6){return{'name':_0x4720e6[_0xb8e5('0x41')],'type':_0x4720e6['type'][_0xb8e5('0x42')]};});_0x275810[_0xb8e5('0x43')]=_[_0xb8e5('0x3f')](_0x2b8a47,'name');_0x275810[_0xb8e5('0x44')]=_['keys'](_0x1ca361[_0xb8e5('0x44')]);_0x275810[_0xb8e5('0x45')]=_[_0xb8e5('0x46')](_0x275810[_0xb8e5('0x43')],_0x275810[_0xb8e5('0x44')]);_0x1e0a4e[_0xb8e5('0x47')]=_[_0xb8e5('0x46')](_0x275810['model'],qs[_0xb8e5('0x48')](_0x1ca361[_0xb8e5('0x44')][_0xb8e5('0x48')]));_0x1e0a4e[_0xb8e5('0x47')]=_0x1e0a4e['attributes']['length']?_0x1e0a4e[_0xb8e5('0x47')]:_0x275810[_0xb8e5('0x43')];if(!_0x1ca361[_0xb8e5('0x44')]['hasOwnProperty'](_0xb8e5('0x49'))){_0x1e0a4e[_0xb8e5('0x2e')]=qs[_0xb8e5('0x2e')](_0x1ca361[_0xb8e5('0x44')][_0xb8e5('0x2e')]);_0x1e0a4e['offset']=qs['offset'](_0x1ca361[_0xb8e5('0x44')][_0xb8e5('0x2d')]);}_0x1e0a4e[_0xb8e5('0x4a')]=qs[_0xb8e5('0x4b')](_0x1ca361[_0xb8e5('0x44')]['sort']);_0x1e0a4e[_0xb8e5('0x4c')]=qs[_0xb8e5('0x45')](_[_0xb8e5('0x4d')](_0x1ca361['query'],_0x275810[_0xb8e5('0x45')]),_0x2b8a47);if(_0x1ca361['query']['filter']){_0x1e0a4e[_0xb8e5('0x4c')]=_[_0xb8e5('0x4e')](_0x1e0a4e[_0xb8e5('0x4c')],{'$or':_['map'](_0x2b8a47,function(_0x37b764){if(_0x37b764[_0xb8e5('0x4f')]!==_0xb8e5('0x50')){var _0x54d712={};_0x54d712[_0x37b764[_0xb8e5('0x3a')]]={'$like':'%'+_0x1ca361[_0xb8e5('0x44')][_0xb8e5('0x51')]+'%'};return _0x54d712;}})});}_0x1e0a4e=_[_0xb8e5('0x4e')]({},_0x1e0a4e,_0x1ca361[_0xb8e5('0x52')]);var _0x5d157c={'where':_0x1e0a4e[_0xb8e5('0x4c')]};return db['SmsAccount'][_0xb8e5('0x30')](_0x5d157c)[_0xb8e5('0x1f')](function(_0x2d714a){_0x1a5046[_0xb8e5('0x30')]=_0x2d714a;if(_0x1ca361['query'][_0xb8e5('0x53')]){_0x1e0a4e[_0xb8e5('0x54')]=[{'all':!![]}];}return db[_0xb8e5('0x40')][_0xb8e5('0x55')](_0x1e0a4e);})[_0xb8e5('0x1f')](function(_0x27c8e4){_0x1a5046[_0xb8e5('0x56')]=_0x27c8e4;return _0x1a5046;})[_0xb8e5('0x1f')](respondWithFilteredResult(_0x15722f,_0x1e0a4e))[_0xb8e5('0x29')](handleError(_0x15722f,null));};exports[_0xb8e5('0x57')]=function(_0x35adee,_0x174a4c){var _0x4be525={'raw':![],'where':{'id':_0x35adee['params']['id']},'include':[{'model':db[_0xb8e5('0x3d')],'as':_0xb8e5('0x3e')}]},_0x279b09={};_0x279b09['model']=_[_0xb8e5('0x58')](db[_0xb8e5('0x40')][_0xb8e5('0x59')]);_0x279b09['query']=_[_0xb8e5('0x58')](_0x35adee['query']);_0x279b09[_0xb8e5('0x45')]=_[_0xb8e5('0x46')](_0x279b09['model'],_0x279b09[_0xb8e5('0x44')]);_0x4be525[_0xb8e5('0x47')]=_[_0xb8e5('0x46')](_0x279b09[_0xb8e5('0x43')],qs['fields'](_0x35adee[_0xb8e5('0x44')][_0xb8e5('0x48')]));_0x4be525[_0xb8e5('0x47')]=_0x4be525[_0xb8e5('0x47')][_0xb8e5('0x5a')]?_0x4be525['attributes']:_0x279b09['model'];if(_0x35adee[_0xb8e5('0x44')][_0xb8e5('0x53')]){_0x4be525[_0xb8e5('0x54')]=[{'all':!![]}];}_0x4be525=_[_0xb8e5('0x4e')]({},_0x4be525,_0x35adee[_0xb8e5('0x52')]);return db[_0xb8e5('0x40')][_0xb8e5('0x5b')](_0x4be525)['then'](handleEntityNotFound(_0x174a4c,null))[_0xb8e5('0x1f')](respondWithResult(_0x174a4c,null))[_0xb8e5('0x29')](handleError(_0x174a4c,null));};exports['create']=function(_0xb71d3f,_0x149f38){return db[_0xb8e5('0x40')]['create'](_0xb71d3f[_0xb8e5('0x5c')],{})[_0xb8e5('0x1f')](function(_0x223c19){var _0xf4cad=_0xb71d3f[_0xb8e5('0x5d')]['get']({'plain':!![]});if(!_0xf4cad)throw new Error(_0xb8e5('0x5e'));if(_0xf4cad[_0xb8e5('0x5f')]===_0xb8e5('0x5d')){var _0x174db5=_0x223c19[_0xb8e5('0x60')]({'plain':!![]});var _0x30d7ab=_0xb8e5('0x37');return db[_0xb8e5('0x61')][_0xb8e5('0x5b')]({'where':{'name':_0x30d7ab,'userProfileId':_0xf4cad[_0xb8e5('0x62')]},'raw':!![]})[_0xb8e5('0x1f')](function(_0xb15f8d){if(_0xb15f8d&&_0xb15f8d['autoAssociation']===0x0){return db[_0xb8e5('0x38')][_0xb8e5('0x63')]({'name':_0x174db5[_0xb8e5('0x3a')],'resourceId':_0x174db5['id'],'type':_0xb15f8d[_0xb8e5('0x3a')],'sectionId':_0xb15f8d['id']},{})[_0xb8e5('0x1f')](function(){return _0x223c19;});}else{return _0x223c19;}})['catch'](function(_0x391ca4){logger[_0xb8e5('0x24')](_0xb8e5('0x64'),_0x391ca4);throw _0x391ca4;});}return _0x223c19;})[_0xb8e5('0x1f')](respondWithResult(_0x149f38,0xc9))[_0xb8e5('0x29')](handleError(_0x149f38,null));};exports[_0xb8e5('0x35')]=function(_0x128b3a,_0x2f185b){if(_0x128b3a['body']['id']){delete _0x128b3a['body']['id'];}return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x128b3a['params']['id']},'include':[{'model':db[_0xb8e5('0x3d')],'as':_0xb8e5('0x3e')}]})[_0xb8e5('0x1f')](handleEntityNotFound(_0x2f185b,null))[_0xb8e5('0x1f')](saveUpdates(_0x128b3a['body'],null))[_0xb8e5('0x1f')](respondWithResult(_0x2f185b,null))[_0xb8e5('0x29')](handleError(_0x2f185b,null));};exports[_0xb8e5('0x36')]=function(_0x523a1d,_0xcf5bba){return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x523a1d[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0xcf5bba,null))['then'](removeEntity(_0xcf5bba,null))[_0xb8e5('0x29')](handleError(_0xcf5bba,null));};exports[_0xb8e5('0x66')]=function(_0x5eb879,_0x126156){return db['SmsAccount'][_0xb8e5('0x66')]()[_0xb8e5('0x1f')](respondWithResult(_0x126156,null))[_0xb8e5('0x29')](handleError(_0x126156,null));};exports[_0xb8e5('0x67')]=function(_0x305a32,_0x1dae11,_0x3d59f0){if(_0x305a32['body']['id']){delete _0x305a32[_0xb8e5('0x5c')]['id'];}return db['SmsAccount'][_0xb8e5('0x5b')]({'where':{'id':_0x305a32[_0xb8e5('0x65')]['id']}})['then'](handleEntityNotFound(_0x1dae11,null))[_0xb8e5('0x1f')](function(_0x111a44){if(_0x111a44){_0x305a32[_0xb8e5('0x5c')][_0xb8e5('0x68')]=_0x111a44['id'];return db['Disposition'][_0xb8e5('0x63')](_0x305a32[_0xb8e5('0x5c')]);}})[_0xb8e5('0x1f')](respondWithResult(_0x1dae11,null))[_0xb8e5('0x29')](handleError(_0x1dae11,null));};exports[_0xb8e5('0x69')]=function(_0x3c6108,_0x36d4d7,_0x394079){var _0x2cf36e={'raw':![],'where':{}};var _0x1db881={};var _0x59738f={'count':0x0,'rows':[]};return db[_0xb8e5('0x40')][_0xb8e5('0x6a')]({'where':{'id':_0x3c6108[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x36d4d7,null))[_0xb8e5('0x1f')](function(_0x438052){if(_0x438052){_0x1db881[_0xb8e5('0x43')]=_[_0xb8e5('0x58')](db[_0xb8e5('0x6b')][_0xb8e5('0x59')]);_0x1db881[_0xb8e5('0x44')]=_[_0xb8e5('0x58')](_0x3c6108[_0xb8e5('0x44')]);_0x1db881[_0xb8e5('0x45')]=_[_0xb8e5('0x46')](_0x1db881['model'],_0x1db881[_0xb8e5('0x44')]);_0x2cf36e[_0xb8e5('0x47')]=_[_0xb8e5('0x46')](_0x1db881[_0xb8e5('0x43')],qs[_0xb8e5('0x48')](_0x3c6108[_0xb8e5('0x44')][_0xb8e5('0x48')]));_0x2cf36e[_0xb8e5('0x47')]=_0x2cf36e[_0xb8e5('0x47')][_0xb8e5('0x5a')]?_0x2cf36e[_0xb8e5('0x47')]:_0x1db881[_0xb8e5('0x43')];if(!_0x3c6108[_0xb8e5('0x44')][_0xb8e5('0x6c')]('nolimit')){_0x2cf36e[_0xb8e5('0x2e')]=qs[_0xb8e5('0x2e')](_0x3c6108[_0xb8e5('0x44')][_0xb8e5('0x2e')]);_0x2cf36e[_0xb8e5('0x2d')]=qs[_0xb8e5('0x2d')](_0x3c6108[_0xb8e5('0x44')][_0xb8e5('0x2d')]);}_0x2cf36e[_0xb8e5('0x4a')]=qs[_0xb8e5('0x4b')](_0x3c6108['query'][_0xb8e5('0x4b')]);_0x2cf36e[_0xb8e5('0x4c')]=qs[_0xb8e5('0x45')](_['pick'](_0x3c6108[_0xb8e5('0x44')],_0x1db881['filters']));_0x2cf36e[_0xb8e5('0x4c')][_0xb8e5('0x68')]=_0x438052['id'];if(_0x3c6108[_0xb8e5('0x44')][_0xb8e5('0x51')]){_0x2cf36e[_0xb8e5('0x4c')]=_[_0xb8e5('0x4e')](_0x2cf36e[_0xb8e5('0x4c')],{'$or':_[_0xb8e5('0x3f')](_0x2cf36e['attributes'],function(_0x319356){var _0x3b3f65={};_0x3b3f65[_0x319356]={'$like':'%'+_0x3c6108[_0xb8e5('0x44')][_0xb8e5('0x51')]+'%'};return _0x3b3f65;})});}_0x2cf36e=_[_0xb8e5('0x4e')]({},_0x2cf36e,_0x3c6108[_0xb8e5('0x52')]);return db[_0xb8e5('0x6b')][_0xb8e5('0x30')]({'where':_0x2cf36e[_0xb8e5('0x4c')]})['then'](function(_0x12d387){_0x59738f[_0xb8e5('0x30')]=_0x12d387;if(_0x3c6108[_0xb8e5('0x44')]['includeAll']){_0x2cf36e[_0xb8e5('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xb8e5('0x55')](_0x2cf36e);})[_0xb8e5('0x1f')](function(_0x3e9407){_0x59738f[_0xb8e5('0x56')]=_0x3e9407;return _0x59738f;});}})[_0xb8e5('0x1f')](respondWithFilteredResult(_0x36d4d7,_0x2cf36e))[_0xb8e5('0x29')](handleError(_0x36d4d7,null));};exports[_0xb8e5('0x6d')]=function(_0x188c66,_0x17f32d,_0x33e0cb){return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x188c66[_0xb8e5('0x65')]['id']}})['then'](handleEntityNotFound(_0x17f32d,null))[_0xb8e5('0x1f')](function(_0x55a457){if(_0x55a457){return _0x55a457[_0xb8e5('0x6d')](_0x188c66[_0xb8e5('0x44')][_0xb8e5('0x6e')]);}})[_0xb8e5('0x1f')](respondWithStatusCode(_0x17f32d,null))[_0xb8e5('0x29')](handleError(_0x17f32d,null));};exports[_0xb8e5('0x6f')]=function(_0x4899be,_0xe6f6ee,_0x26e19c){if(_0x4899be['body']['id']){delete _0x4899be['body']['id'];}return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x4899be[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0xe6f6ee,null))[_0xb8e5('0x1f')](function(_0x206d27){if(_0x206d27){_0x4899be[_0xb8e5('0x5c')][_0xb8e5('0x68')]=_0x206d27['id'];return db['CannedAnswer'][_0xb8e5('0x63')](_0x4899be['body']);}})[_0xb8e5('0x1f')](respondWithResult(_0xe6f6ee,null))[_0xb8e5('0x29')](handleError(_0xe6f6ee,null));};exports[_0xb8e5('0x70')]=function(_0x4f57b6,_0x268bae,_0x361db3){var _0x2235a3={'raw':![],'where':{}};var _0xa82430={};var _0x28bec2={'count':0x0,'rows':[]};return db[_0xb8e5('0x40')][_0xb8e5('0x6a')]({'where':{'id':_0x4f57b6[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x268bae,null))['then'](function(_0x206491){if(_0x206491){_0xa82430[_0xb8e5('0x43')]=_[_0xb8e5('0x58')](db[_0xb8e5('0x71')]['rawAttributes']);_0xa82430[_0xb8e5('0x44')]=_[_0xb8e5('0x58')](_0x4f57b6[_0xb8e5('0x44')]);_0xa82430[_0xb8e5('0x45')]=_[_0xb8e5('0x46')](_0xa82430[_0xb8e5('0x43')],_0xa82430['query']);_0x2235a3[_0xb8e5('0x47')]=_[_0xb8e5('0x46')](_0xa82430[_0xb8e5('0x43')],qs[_0xb8e5('0x48')](_0x4f57b6[_0xb8e5('0x44')]['fields']));_0x2235a3[_0xb8e5('0x47')]=_0x2235a3[_0xb8e5('0x47')][_0xb8e5('0x5a')]?_0x2235a3['attributes']:_0xa82430[_0xb8e5('0x43')];if(!_0x4f57b6[_0xb8e5('0x44')][_0xb8e5('0x6c')](_0xb8e5('0x49'))){_0x2235a3[_0xb8e5('0x2e')]=qs[_0xb8e5('0x2e')](_0x4f57b6['query'][_0xb8e5('0x2e')]);_0x2235a3[_0xb8e5('0x2d')]=qs[_0xb8e5('0x2d')](_0x4f57b6[_0xb8e5('0x44')]['offset']);}_0x2235a3[_0xb8e5('0x4a')]=qs[_0xb8e5('0x4b')](_0x4f57b6[_0xb8e5('0x44')][_0xb8e5('0x4b')]);_0x2235a3[_0xb8e5('0x4c')]=qs[_0xb8e5('0x45')](_['pick'](_0x4f57b6[_0xb8e5('0x44')],_0xa82430['filters']));_0x2235a3[_0xb8e5('0x4c')]['SmsAccountId']=_0x206491['id'];if(_0x4f57b6[_0xb8e5('0x44')][_0xb8e5('0x51')]){_0x2235a3[_0xb8e5('0x4c')]=_[_0xb8e5('0x4e')](_0x2235a3[_0xb8e5('0x4c')],{'$or':_[_0xb8e5('0x3f')](_0x2235a3[_0xb8e5('0x47')],function(_0x5b5c39){var _0x159e4a={};_0x159e4a[_0x5b5c39]={'$like':'%'+_0x4f57b6[_0xb8e5('0x44')][_0xb8e5('0x51')]+'%'};return _0x159e4a;})});}_0x2235a3=_['merge']({},_0x2235a3,_0x4f57b6[_0xb8e5('0x52')]);return db[_0xb8e5('0x71')][_0xb8e5('0x30')]({'where':_0x2235a3[_0xb8e5('0x4c')]})[_0xb8e5('0x1f')](function(_0x2a15a1){_0x28bec2[_0xb8e5('0x30')]=_0x2a15a1;if(_0x4f57b6[_0xb8e5('0x44')][_0xb8e5('0x53')]){_0x2235a3['include']=[{'all':!![]}];}return db[_0xb8e5('0x71')][_0xb8e5('0x55')](_0x2235a3);})[_0xb8e5('0x1f')](function(_0x1bec96){_0x28bec2[_0xb8e5('0x56')]=_0x1bec96;return _0x28bec2;});}})[_0xb8e5('0x1f')](respondWithFilteredResult(_0x268bae,_0x2235a3))[_0xb8e5('0x29')](handleError(_0x268bae,null));};exports[_0xb8e5('0x72')]=function(_0x1a33db,_0x20e15b,_0x169d2a){return db['SmsAccount']['find']({'where':{'id':_0x1a33db['params']['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x20e15b,null))['then'](function(_0x34c578){if(_0x34c578){return _0x34c578[_0xb8e5('0x72')](_0x1a33db['query']['ids']);}})[_0xb8e5('0x1f')](respondWithStatusCode(_0x20e15b,null))[_0xb8e5('0x29')](handleError(_0x20e15b,null));};exports[_0xb8e5('0x73')]=function(_0x446c8f,_0x19ca51,_0x36b1e8){var _0x33b89a={'channel':_0xb8e5('0x74')};var _0x503ca0=[];var _0x39ab3e=[];var _0x1f7556={};return db['SmsAccount'][_0xb8e5('0x5b')]({'where':{'id':_0x446c8f['params']['id']},'include':[{'model':db[_0xb8e5('0x75')],'as':_0xb8e5('0x76')}]})[_0xb8e5('0x1f')](handleEntityNotFound(_0x19ca51,null))[_0xb8e5('0x1f')](function(_0x3a0391){_0x33b89a[_0xb8e5('0x77')]=_0x3a0391;_0x33b89a[_0xb8e5('0x78')]=_['orderBy'](_0x3a0391[_0xb8e5('0x76')],['priority'],[_0xb8e5('0x79')]);if(_0x33b89a[_0xb8e5('0x77')]['Applications']){delete _0x33b89a[_0xb8e5('0x77')][_0xb8e5('0x76')];}return db[_0xb8e5('0x7a')][_0xb8e5('0x66')]();})[_0xb8e5('0x1f')](function(_0x464351){if(!_0x464351){throw new db['Sequelize'][(_0xb8e5('0x7b'))](_0xb8e5('0x7c'));}_0x503ca0=_[_0xb8e5('0x7d')](_[_0xb8e5('0x58')](_0x464351),[_0xb8e5('0x7e'),'updatedAt']);_0x39ab3e=_[_0xb8e5('0x7d')](_[_0xb8e5('0x58')](_0x464351),[_0xb8e5('0x7e'),'updatedAt',_0xb8e5('0x7f'),_0xb8e5('0x80')]);_0x33b89a['body']={'mapKey':_0xb8e5('0x81')};if(_0x33b89a['account']['type']){switch(_0x33b89a['account'][_0xb8e5('0x4f')]){case'twilio':_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')]['From'];_0x33b89a['body'][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x83')];_0x33b89a[_0xb8e5('0x5c')]['messageId']=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x84')];break;case'skebby':_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')]='+'+_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x85')];_0x33b89a['body'][_0xb8e5('0x5c')]=_0x446c8f['body'][_0xb8e5('0x86')];break;case'connectel':_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x82')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')]['message'];break;case _0xb8e5('0x87'):_0x33b89a[_0xb8e5('0x5c')]['from']=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x82')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')]['body'];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x88')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x89')];break;case _0xb8e5('0x8a'):_0x33b89a['body'][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x8b')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')]['Text'];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x88')]=_0x446c8f['body'][_0xb8e5('0x8c')];break;case _0xb8e5('0x8d'):_0x33b89a['body'][_0xb8e5('0x82')]='+'+_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x8e')][0x0][_0xb8e5('0x82')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')]['results'][0x0][_0xb8e5('0x86')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x88')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x8e')][0x0][_0xb8e5('0x88')];break;case _0xb8e5('0x8f'):_0x33b89a['body'][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x90')];_0x33b89a[_0xb8e5('0x5c')]['body']=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x91')]['message'];break;case _0xb8e5('0x92'):_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x93')];_0x33b89a['body'][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x86')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x88')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x94')];break;case _0xb8e5('0x95'):_0x33b89a['body']['messageId']=_0x446c8f[_0xb8e5('0x5c')][0x0][_0xb8e5('0x27')]['id'];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')][0x0][_0xb8e5('0x27')]['from'];_0x33b89a['body'][_0xb8e5('0x5c')]=_0x446c8f['body'][0x0][_0xb8e5('0x27')][_0xb8e5('0x86')];break;case _0xb8e5('0x96'):_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x82')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x5c')]=_0x446c8f[_0xb8e5('0x5c')][_0xb8e5('0x27')];_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x88')]=_0x446c8f['body']['refid'];break;}}if(_0x33b89a['body']['id']){delete _0x33b89a[_0xb8e5('0x5c')]['id'];}if(_[_0xb8e5('0x97')](_0x33b89a['body'][_0xb8e5('0x82')])){throw new db[(_0xb8e5('0x98'))][(_0xb8e5('0x7b'))](_0xb8e5('0x99'));}if(_[_0xb8e5('0x97')](_0x33b89a['body'][_0xb8e5('0x5c')])||_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x5c')]===''){throw new db[(_0xb8e5('0x98'))]['ValidationError'](_0xb8e5('0x9a'));}if(_[_0xb8e5('0x97')](_0x33b89a[_0xb8e5('0x5c')]['mapKey'])){throw new db[(_0xb8e5('0x98'))][(_0xb8e5('0x7b'))](_0xb8e5('0x9b')+_0x39ab3e);}if(!_[_0xb8e5('0x9c')](_0x39ab3e,_0x33b89a['body'][_0xb8e5('0x9d')])){throw new db[(_0xb8e5('0x98'))]['ValidationError'](_0xb8e5('0x9e')+_0x39ab3e);}_0x1f7556[_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x9d')]]=_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')];return db[_0xb8e5('0x9f')][_0xb8e5('0x5b')]({'where':{'id':_0x33b89a[_0xb8e5('0x77')][_0xb8e5('0x80')]},'include':[{'model':db[_0xb8e5('0x7a')],'as':_0xb8e5('0xa0'),'where':_0x1f7556,'limit':0x1,'order':[['updatedAt',_0xb8e5('0xa1')]]}]});})[_0xb8e5('0x1f')](handleEntityNotFound(_0x19ca51,null))['then'](function(_0x5573cc){if(_0x5573cc){_0x33b89a[_0xb8e5('0xa2')]=_[_0xb8e5('0xa3')](_0x5573cc,[_0xb8e5('0xa0')]);if(_0x5573cc[_0xb8e5('0xa0')][_0xb8e5('0x5a')]){return _0x5573cc[_0xb8e5('0xa0')][0x0];}var _0x275f9f=_[_0xb8e5('0x16')](_0x33b89a['body'],{'firstName':_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')],'ListId':_0x5573cc['id']});_0x275f9f[_0x33b89a['body']['mapKey']]=_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0x82')];return db[_0xb8e5('0x7a')][_0xb8e5('0x63')](_0x275f9f,{'fields':_0x503ca0,'raw':!![]});}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x19ca51,null))['then'](function(_0x38b2cb){if(_0x38b2cb){_0x33b89a['contact']=_0x38b2cb;var _0x11affc={'ContactId':_0x38b2cb['id'],'phone':_0x33b89a['body'][_0xb8e5('0x82')],'SmsAccountId':_0x446c8f['params']['id']};var _0x5e3745={'ContactId':_0x38b2cb['id'],'SmsAccountId':_0x446c8f[_0xb8e5('0x65')]['id'],'closed':![]};return db[_0xb8e5('0xa4')][_0xb8e5('0x5b')]({'where':_0x5e3745})['then'](function(_0x1e529e){if(_0x1e529e){return[_0x1e529e,![]];}return db['SmsInteraction'][_0xb8e5('0x63')](_0x11affc)[_0xb8e5('0x1f')](function(_0x21dde2){return[_0x21dde2,!![]];});});}})[_0xb8e5('0xa5')](function(_0x4c2e6a,_0x18f0e9){_0x33b89a['interaction']=_0x4c2e6a[_0xb8e5('0x60')]({'plain':!![]});_0x33b89a[_0xb8e5('0xa6')][_0xb8e5('0xa7')]=![];if(_0x18f0e9){if(_0x33b89a['account'][_0xb8e5('0xa8')]){_0x33b89a[_0xb8e5('0x78')][_0xb8e5('0xa9')]({'id':0x0,'priority':_0x33b89a[_0xb8e5('0x78')][_0xb8e5('0x5a')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}_0x33b89a[_0xb8e5('0xa6')][_0xb8e5('0xa7')]=!![];}return db[_0xb8e5('0xaa')]['create']({'phone':_0x33b89a['body']['from'],'messageId':_0x33b89a['body']['messageId'],'body':_0x33b89a['body'][_0xb8e5('0x5c')],'SmsAccountId':_0x446c8f[_0xb8e5('0x65')]['id'],'SmsInteractionId':_0x4c2e6a['id'],'direction':'in','ContactId':_0x4c2e6a[_0xb8e5('0xab')],'AttachmentId':_0x33b89a[_0xb8e5('0x5c')][_0xb8e5('0xac')]});})[_0xb8e5('0x1f')](function(_0x404877){_0x33b89a[_0xb8e5('0x27')]=_0x404877;if(!_0x33b89a[_0xb8e5('0xa6')][_0xb8e5('0xad')])return;return db[_0xb8e5('0xae')]['find']({'attributes':['id',_0xb8e5('0x3a')],'where':{'id':_0x33b89a[_0xb8e5('0xa6')]['UserId']}});})[_0xb8e5('0x1f')](function(_0xb72249){if(_0xb72249){_0x33b89a[_0xb8e5('0x78')][_0xb8e5('0xaf')]({'id':0x0,'priority':0x0,'app':_0xb8e5('0xb0'),'appdata':_0xb72249[_0xb8e5('0x3a')]+','+(_0x33b89a[_0xb8e5('0x77')][_0xb8e5('0xb1')]||0xa),'interval':_0xb8e5('0xb2')});}if(!_0x33b89a[_0xb8e5('0xa6')][_0xb8e5('0xb3')])return;return db[_0xb8e5('0xb4')]['find']({'attributes':['id',_0xb8e5('0x3a')],'where':{'id':_0x33b89a[_0xb8e5('0xa6')][_0xb8e5('0xb3')]}});})[_0xb8e5('0x1f')](function(_0x4f4d0c){if(_0x4f4d0c){_0x33b89a['applications'][_0xb8e5('0xaf')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4f4d0c[_0xb8e5('0x3a')]+','+(_0x33b89a[_0xb8e5('0x77')][_0xb8e5('0xb5')]||0x12c),'interval':_0xb8e5('0xb2')});}return respondWithRpcPromise('Start',_0xb8e5('0xb6'),_0x33b89a);})['then'](function(_0x389c62){if(_0x389c62){var _0x36ccff=0xc8;var _0x374db4=_0xb8e5('0xb7');logger[_0xb8e5('0x20')](_0xb8e5('0x22'),_0x374db4,_0x36ccff,_0xb8e5('0xb8'));logger[_0xb8e5('0x21')](_0xb8e5('0xb9'),_0x374db4,_0x36ccff,'entity\x20found',JSON[_0xb8e5('0xba')](_0x389c62));if(_0x33b89a[_0xb8e5('0x77')][_0xb8e5('0x4f')]===_0xb8e5('0xbb')){return _0x19ca51['status'](_0x36ccff)[_0xb8e5('0xbc')](_0xb8e5('0xbd'),_0xb8e5('0xbe'))[_0xb8e5('0x3b')](_0xb8e5('0xbf'));}else{return _0x19ca51['status'](_0x36ccff)[_0xb8e5('0x32')](_0x389c62);}}})[_0xb8e5('0x29')](handleError(_0x19ca51,null));};exports[_0xb8e5('0xc0')]=function(_0x563447,_0x6e1bd1){var _0x171512=_0x563447[_0xb8e5('0x65')]['id'];var _0x21171f=_0x563447[_0xb8e5('0x5c')];var _0x4b3ded=0xc8;var _0x5e5865=null;return db[_0xb8e5('0xc1')][_0xb8e5('0xc2')]({'isolationLevel':db[_0xb8e5('0xc1')][_0xb8e5('0xc3')][_0xb8e5('0xc4')][_0xb8e5('0xc5')]},function(_0x10f470){return db['SmsAccount'][_0xb8e5('0x6a')]({'where':{'id':_0x171512},'transaction':_0x10f470})[_0xb8e5('0x1f')](function(_0x1d08a9){if(_0x1d08a9){return db[_0xb8e5('0x75')]['destroy']({'where':{'SmsAccountId':_0x171512},'transaction':_0x10f470})['then'](function(){var _0x3ba6ff=_[_0xb8e5('0x3f')](_0x21171f,function(_0x4a847a){_0x4a847a[_0xb8e5('0x68')]=_0x171512;return _0x4a847a;});return db[_0xb8e5('0x75')][_0xb8e5('0xc6')](_0x3ba6ff,{'transaction':_0x10f470});});}else{_0x4b3ded=0x194;_0x5e5865=[];}});})[_0xb8e5('0x1f')](function(){if(_0x4b3ded!==0x194){return db[_0xb8e5('0x75')]['findAndCountAll']({'where':{'SmsAccountId':_0x171512},'order':_0xb8e5('0xc7')})[_0xb8e5('0x1f')](function(_0x3b0bc6){_0x5e5865=_0x3b0bc6;});}})[_0xb8e5('0x29')](function(_0x1ef466){_0x4b3ded=0x1f4;logger[_0xb8e5('0x24')](_0x1ef466['stack']);if(_0x1ef466[_0xb8e5('0x3a')]){delete _0x1ef466[_0xb8e5('0x3a')];}_0x5e5865=_0x1ef466;})[_0xb8e5('0xc8')](function(){if(_0x5e5865===null){_0x6e1bd1['sendStatus'](_0x4b3ded);}else{if(_0x4b3ded===0x1f4){_0x6e1bd1[_0xb8e5('0x2b')](_0x4b3ded)[_0xb8e5('0x3b')](_0x5e5865);}else{_0x6e1bd1['status'](_0x4b3ded)[_0xb8e5('0x32')](_0x5e5865);}}});};exports[_0xb8e5('0xc9')]=function(_0x2ae311,_0x391f62,_0x2202d3){var _0x3cce04={};var _0x5c04da={};var _0x272135;var _0x44098a;return db[_0xb8e5('0x40')][_0xb8e5('0x6a')]({'where':{'id':_0x2ae311[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x391f62,null))['then'](function(_0x405442){if(_0x405442){_0x272135=_0x405442;_0x5c04da[_0xb8e5('0x43')]=_['keys'](db[_0xb8e5('0x75')][_0xb8e5('0x59')]);_0x5c04da[_0xb8e5('0x44')]=_[_0xb8e5('0x58')](_0x2ae311[_0xb8e5('0x44')]);_0x5c04da['filters']=_['intersection'](_0x5c04da[_0xb8e5('0x43')],_0x5c04da[_0xb8e5('0x44')]);_0x3cce04[_0xb8e5('0x47')]=_[_0xb8e5('0x46')](_0x5c04da[_0xb8e5('0x43')],qs['fields'](_0x2ae311[_0xb8e5('0x44')][_0xb8e5('0x48')]));_0x3cce04['attributes']=_0x3cce04[_0xb8e5('0x47')][_0xb8e5('0x5a')]?_0x3cce04[_0xb8e5('0x47')]:_0x5c04da['model'];_0x3cce04[_0xb8e5('0x4a')]=qs['sort'](_0x2ae311[_0xb8e5('0x44')][_0xb8e5('0x4b')]);_0x3cce04[_0xb8e5('0x4c')]=qs[_0xb8e5('0x45')](_['pick'](_0x2ae311['query'],_0x5c04da[_0xb8e5('0x45')]));if(_0x2ae311[_0xb8e5('0x44')]['filter']){_0x3cce04[_0xb8e5('0x4c')]=_[_0xb8e5('0x4e')](_0x3cce04[_0xb8e5('0x4c')],{'$or':_[_0xb8e5('0x3f')](_0x3cce04[_0xb8e5('0x47')],function(_0x3bf326){var _0x1ee704={};_0x1ee704[_0x3bf326]={'$like':'%'+_0x2ae311[_0xb8e5('0x44')][_0xb8e5('0x51')]+'%'};return _0x1ee704;})});}_0x3cce04=_['merge']({},_0x3cce04,_0x2ae311[_0xb8e5('0x52')]);return _0x272135['getApplications'](_0x3cce04);}})[_0xb8e5('0x1f')](function(_0xadd5c4){if(_0xadd5c4){_0x44098a=_0xadd5c4[_0xb8e5('0x5a')];if(!_0x2ae311[_0xb8e5('0x44')][_0xb8e5('0x6c')](_0xb8e5('0x49'))){_0x3cce04[_0xb8e5('0x2e')]=qs[_0xb8e5('0x2e')](_0x2ae311['query'][_0xb8e5('0x2e')]);_0x3cce04['offset']=qs[_0xb8e5('0x2d')](_0x2ae311[_0xb8e5('0x44')]['offset']);}return _0x272135[_0xb8e5('0xc9')](_0x3cce04);}})['then'](function(_0x2896c3){if(_0x2896c3){return _0x2896c3?{'count':_0x44098a,'rows':_0x2896c3}:null;}})['then'](respondWithResult(_0x391f62,null))[_0xb8e5('0x29')](handleError(_0x391f62,null));};exports['getInteractions']=function(_0x27ba79,_0x3a1d6c,_0xfd2204){var _0x3fb555={'raw':![],'where':{}};var _0x544247={};var _0x1865ce={'count':0x0,'rows':[]};return db[_0xb8e5('0x40')][_0xb8e5('0x6a')]({'where':{'id':_0x27ba79['params']['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x3a1d6c,null))[_0xb8e5('0x1f')](function(_0x4cb5ab){if(_0x4cb5ab){_0x544247['model']=_[_0xb8e5('0x58')](db['SmsInteraction']['rawAttributes']);_0x544247[_0xb8e5('0x44')]=_[_0xb8e5('0x58')](_0x27ba79['query']);_0x544247[_0xb8e5('0x45')]=_[_0xb8e5('0x46')](_0x544247[_0xb8e5('0x43')],_0x544247[_0xb8e5('0x44')]);_0x3fb555['attributes']=_[_0xb8e5('0x46')](_0x544247[_0xb8e5('0x43')],qs[_0xb8e5('0x48')](_0x27ba79['query'][_0xb8e5('0x48')]));_0x3fb555['attributes']=_0x3fb555[_0xb8e5('0x47')][_0xb8e5('0x5a')]?_0x3fb555[_0xb8e5('0x47')]:_0x544247[_0xb8e5('0x43')];if(!_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0x6c')](_0xb8e5('0x49'))){_0x3fb555[_0xb8e5('0x2e')]=qs[_0xb8e5('0x2e')](_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0x2e')]);_0x3fb555[_0xb8e5('0x2d')]=qs[_0xb8e5('0x2d')](_0x27ba79['query'][_0xb8e5('0x2d')]);}_0x3fb555['order']=qs[_0xb8e5('0x4b')](_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0x4b')]);_0x3fb555[_0xb8e5('0x4c')]=qs[_0xb8e5('0x45')](_[_0xb8e5('0x4d')](_0x27ba79[_0xb8e5('0x44')],_0x544247['filters']));_0x3fb555[_0xb8e5('0x4c')]['SmsAccountId']=_0x4cb5ab['id'];if(_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0x51')]){_0x3fb555[_0xb8e5('0x4c')]=_['merge'](_0x3fb555[_0xb8e5('0x4c')],{'$or':_[_0xb8e5('0x3f')](_0x3fb555[_0xb8e5('0x47')],function(_0x5161c8){var _0x3bd21c={};_0x3bd21c[_0x5161c8]={'$like':'%'+_0x27ba79['query']['filter']+'%'};return _0x3bd21c;})});}_0x3fb555=_[_0xb8e5('0x4e')]({},_0x3fb555,_0x27ba79[_0xb8e5('0x52')]);return db[_0xb8e5('0xa4')][_0xb8e5('0x30')]({'where':_0x3fb555[_0xb8e5('0x4c')]})['then'](function(_0x4ec7c8){_0x1865ce['count']=_0x4ec7c8;if(_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0x53')]){_0x3fb555[_0xb8e5('0x54')]=[{'model':db[_0xb8e5('0x7a')],'as':_0xb8e5('0xca'),'required':![]},{'model':db[_0xb8e5('0xae')],'as':_0xb8e5('0xcb'),'attributes':['name',_0xb8e5('0xcc'),_0xb8e5('0xcd')],'required':![]},{'model':db[_0xb8e5('0xce')],'as':_0xb8e5('0xcf'),'attributes':['id',_0xb8e5('0x3a'),_0xb8e5('0xd0')],'where':_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0xd1')]?{'id':_0x27ba79[_0xb8e5('0x44')]['tag']}:undefined,'required':_0x27ba79[_0xb8e5('0x44')][_0xb8e5('0xd1')]?!![]:![]}];}return db['SmsInteraction'][_0xb8e5('0x55')](_0x3fb555);})['then'](function(_0x20ab83){_0x1865ce['rows']=_0x20ab83;return _0x1865ce;});}})['then'](respondWithFilteredResult(_0x3a1d6c,_0x3fb555))[_0xb8e5('0x29')](handleError(_0x3a1d6c,null));};exports[_0xb8e5('0x3b')]=function(_0x3dd0e5,_0x31dc91,_0x3ca16c){var _0x13ff73,_0x4e3de5,_0xb9acbd;if(_[_0xb8e5('0x97')](_0x3dd0e5['body'][_0xb8e5('0x5c')])||_0x3dd0e5['body'][_0xb8e5('0x5c')]===''){throw new db[(_0xb8e5('0x98'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb8e5('0x97')](_0x3dd0e5['body']['to'])){throw new db['Sequelize'][(_0xb8e5('0x7b'))]('to\x20is\x20mandatory');}_0x13ff73=_0x3dd0e5[_0xb8e5('0x5c')]['to'];return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x3dd0e5[_0xb8e5('0x65')]['id']},'include':[{'model':db[_0xb8e5('0x9f')],'as':_0xb8e5('0xd2'),'include':[{'model':db[_0xb8e5('0x7a')],'as':_0xb8e5('0xa0'),'where':{'mobile':_0x13ff73},'limit':0x1,'order':[['updatedAt',_0xb8e5('0xa1')]]}]}]})['then'](handleEntityNotFound(_0x31dc91,null))['then'](function(_0x13ac4d){if(_0x13ac4d&&_0x13ac4d[_0xb8e5('0xd2')]){_0x4e3de5=_0x13ac4d['get']({'plain':!![]});if(_0x4e3de5[_0xb8e5('0xd2')]&&_0x4e3de5['List'][_0xb8e5('0xa0')]['length']){return _0x4e3de5['List'][_0xb8e5('0xa0')][0x0];}return db[_0xb8e5('0x7a')]['create'](_[_0xb8e5('0x16')](_0x3dd0e5[_0xb8e5('0x5c')],{'firstName':_0x13ff73,'mobile':_0x13ff73,'phone':_0x13ff73,'ListId':_0x4e3de5[_0xb8e5('0x80')]}));}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x31dc91,null))['then'](function(_0x54557e){if(_0x54557e){_0xb9acbd=_0x54557e;return db[_0xb8e5('0xa4')]['find']({'where':{'ContactId':_0xb9acbd['id'],'closed':![],'SmsAccountId':_0x4e3de5['id']}})['then'](function(_0x32aaf0){if(_0x32aaf0){return[_0x32aaf0,![]];}return db[_0xb8e5('0xa4')][_0xb8e5('0x63')]({'UserId':_0x3dd0e5[_0xb8e5('0x5d')]['id'],'ContactId':_0xb9acbd['id'],'SmsAccountId':_0x4e3de5['id'],'phone':_0x13ff73,'firstMsgDirection':'out','Messages':[_[_0xb8e5('0x4e')](_0x3dd0e5[_0xb8e5('0x5c')],{'read':![],'body':_0x3dd0e5[_0xb8e5('0x5c')][_0xb8e5('0x5c')],'phone':_0x13ff73,'SmsAccountId':_0x4e3de5['id'],'UserId':_0x3dd0e5[_0xb8e5('0x5d')]['id'],'ContactId':_0xb9acbd['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})['then'](function(_0x177c61){return[_0x177c61,!![]];});});}})[_0xb8e5('0xa5')](function(_0x25a46e,_0x28d3f4){if(_0x28d3f4){return _0x25a46e;}return db['SmsMessage'][_0xb8e5('0x63')](_['merge'](_0x3dd0e5[_0xb8e5('0x5c')],{'read':![],'body':_0x3dd0e5['body'][_0xb8e5('0x5c')],'phone':_0x13ff73,'SmsAccountId':_0x4e3de5['id'],'SmsInteractionId':_0x25a46e['id'],'UserId':_0x3dd0e5[_0xb8e5('0x5d')]['id'],'ContactId':_0xb9acbd['id']}))[_0xb8e5('0x1f')](function(_0x22ce4a){_0x25a46e[_0xb8e5('0xd3')][_0xb8e5('0xd4')]=[];_0x25a46e[_0xb8e5('0xd3')]['Messages'][_0xb8e5('0xa9')](_0x22ce4a[_0xb8e5('0xd3')]);return _0x25a46e;});})[_0xb8e5('0x1f')](respondWithResult(_0x31dc91,null))[_0xb8e5('0x29')](handleError(_0x31dc91,null));};exports[_0xb8e5('0x2b')]=function(_0x3d2a97,_0x54f62d,_0x50e060){if(_0x3d2a97[_0xb8e5('0x5c')]['id']){delete _0x3d2a97[_0xb8e5('0x5c')]['id'];}var _0x38bf32,_0xa3a46f,_0x400284;return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x3d2a97[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x54f62d,null))['then'](function(_0x2fa631){if(_0x2fa631){_0x400284=_0x2fa631;logger[_0xb8e5('0x21')](_0xb8e5('0x22'),_0xb8e5('0x2b'),_0xb8e5('0xd5'),_0x2fa631[_0xb8e5('0x4f')],util[_0xb8e5('0xd6')](_0x3d2a97[_0xb8e5('0x5c')],{'showHidden':![],'depth':null}));switch(_0x2fa631['type']){case _0xb8e5('0xd7'):if(_0x3d2a97['body'][_0xb8e5('0xd8')]&&_0x3d2a97['body'][_0xb8e5('0x2b')]){_0xa3a46f=_0x3d2a97['body']['status'];return db[_0xb8e5('0xaa')][_0xb8e5('0x5b')]({'where':{'messageId':_0x3d2a97[_0xb8e5('0x5c')]['skebby_dispatch_id']}});}break;case _0xb8e5('0xd9'):if(_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xda')]&&_0x3d2a97[_0xb8e5('0x5c')]['statusInt']){_0xa3a46f=_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xdb')];return db['SmsMessage'][_0xb8e5('0x5b')]({'where':{'messageId':_0x3d2a97[_0xb8e5('0x5c')]['requestid']}});}break;case'clicksend':if(_0x3d2a97[_0xb8e5('0x5c')]['message_id']&&_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xdc')]){_0xa3a46f=_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xdc')];return db[_0xb8e5('0xaa')]['find']({'where':{'messageId':_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0x89')]}});}break;case _0xb8e5('0x8d'):var _0x28ed55=_0x3d2a97[_0xb8e5('0x5c')]['results'][0x0];if(_0x28ed55[_0xb8e5('0x88')]&&_0x28ed55[_0xb8e5('0x2b')][_0xb8e5('0xdd')]===_0xb8e5('0xde')){_0xa3a46f=_0x28ed55[_0xb8e5('0x2b')]['groupName'];return db[_0xb8e5('0xaa')]['find']({'where':{'messageId':_0x28ed55[_0xb8e5('0x88')]}});}break;case'clickatell':if(_0x3d2a97['body']['messageId']&&_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0x2b')]){_0xa3a46f=_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0x2b')];return db[_0xb8e5('0xaa')]['find']({'where':{'messageId':_0x3d2a97['body'][_0xb8e5('0x88')]}});}break;case _0xb8e5('0x95'):if(_0x3d2a97['body'][0x0][_0xb8e5('0x27')]['id']){_0xa3a46f=_0x3d2a97['body'][0x0][_0xb8e5('0x4f')];return db['SmsMessage'][_0xb8e5('0x5b')]({'where':{'messageId':_0x3d2a97[_0xb8e5('0x5c')][0x0][_0xb8e5('0x27')]['id']}});}break;case _0xb8e5('0x96'):if(_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xdf')]&&_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0x2b')]){_0xa3a46f=_0x3d2a97['body'][_0xb8e5('0x2b')];return db[_0xb8e5('0xaa')][_0xb8e5('0x5b')]({'where':{'messageId':_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xdf')]}});}break;}}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x54f62d,null))[_0xb8e5('0x1f')](function(_0x5e5c6f){if(_0x5e5c6f){_0x38bf32=_0x5e5c6f;switch(_0x400284[_0xb8e5('0x4f')]){case _0xb8e5('0xd7'):if(_0xa3a46f===_0xb8e5('0xde')){return _0x38bf32['update']({'read':!![]});}else{logger[_0xb8e5('0x24')](_0xb8e5('0x22'),_0xb8e5('0x2b'),'skebby',util[_0xb8e5('0xd6')](_0x3d2a97[_0xb8e5('0x5c')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0xa3a46f==='1'){return _0x38bf32[_0xb8e5('0x35')]({'read':!![]});}else{logger[_0xb8e5('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xb8e5('0x2b'),_0xb8e5('0xd7'),util[_0xb8e5('0xd6')](_0x3d2a97['body'],{'showHidden':![],'depth':null}));}break;case _0xb8e5('0x87'):if(!_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0xe0')]&&_0xa3a46f>=0xc8&&_0xa3a46f<=0xce){return _0x38bf32[_0xb8e5('0x35')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clicksend',util['inspect'](_0x3d2a97[_0xb8e5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xb8e5('0x8d'):var _0x216ce0=_0x3d2a97[_0xb8e5('0x5c')][_0xb8e5('0x8e')][0x0];if(_0x216ce0[_0xb8e5('0x2b')][_0xb8e5('0xdd')]===_0xb8e5('0xde')){return _0x38bf32[_0xb8e5('0x35')]({'read':!![]});}else{logger[_0xb8e5('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xb8e5('0x8d'),util[_0xb8e5('0xd6')](_0x3d2a97['body'],{'showHidden':![],'depth':null}));}break;case _0xb8e5('0x92'):if(_0xa3a46f==_0xb8e5('0xe1')||_0xa3a46f=='RECEIVED_BY_RECIPIENT'){return _0x38bf32['update']({'read':!![]});}else{logger[_0xb8e5('0x24')](_0xb8e5('0x22'),_0xb8e5('0x2b'),_0xb8e5('0x92'),util[_0xb8e5('0xd6')](_0x3d2a97['body'],{'showHidden':![],'depth':null}));}break;case _0xb8e5('0x95'):if(_0xa3a46f==_0xb8e5('0xe2')){return _0x38bf32['update']({'read':!![]});}else{logger[_0xb8e5('0x24')](_0xb8e5('0x22'),'status',_0xb8e5('0x95'),util[_0xb8e5('0xd6')](_0x3d2a97[_0xb8e5('0x5c')],{'showHidden':![],'depth':null}));}break;case _0xb8e5('0x96'):if(_0xa3a46f===_0xb8e5('0xe3')||_0xa3a46f==='ACCEPTD'){return _0x38bf32[_0xb8e5('0x35')]({'read':!![]});}else{logger[_0xb8e5('0x24')](_0xb8e5('0x22'),_0xb8e5('0x2b'),'intelepeer',util[_0xb8e5('0xd6')](_0x3d2a97['body'],{'showHidden':![],'depth':null}));}break;}return _0x38bf32;}})['then'](respondWithResult(_0x54f62d,null))['catch'](handleError(_0x54f62d,null));};exports['statusGet']=function(_0x4b1800,_0x1798ae,_0x308792){var _0x459426,_0x44ce40,_0x5ae500;return db['SmsAccount'][_0xb8e5('0x5b')]({'where':{'id':_0x4b1800[_0xb8e5('0x65')]['id']}})['then'](handleEntityNotFound(_0x1798ae,null))['then'](function(_0x14b4ab){if(_0x14b4ab){_0x5ae500=_0x14b4ab;logger[_0xb8e5('0x21')](_0xb8e5('0x22'),_0xb8e5('0x2b'),'received\x20delivery\x20report\x20from',_0x14b4ab[_0xb8e5('0x4f')],util[_0xb8e5('0xd6')](_0x4b1800[_0xb8e5('0x44')],{'showHidden':![],'depth':null}));switch(_0x14b4ab['type']){case'csc':if(_0x4b1800[_0xb8e5('0x44')][_0xb8e5('0xe4')]&&_0x4b1800['query'][_0xb8e5('0xe5')]){_0x44ce40=_0x4b1800[_0xb8e5('0x44')][_0xb8e5('0xe5')];return db['SmsMessage'][_0xb8e5('0x5b')]({'where':{'messageId':_0x4b1800['query'][_0xb8e5('0xe4')]}});}break;}}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x1798ae,null))['then'](function(_0x5866ef){if(_0x5866ef){_0x459426=_0x5866ef;switch(_0x5ae500[_0xb8e5('0x4f')]){case _0xb8e5('0x8f'):if(_0x44ce40==='2'||_0x44ce40==='6'){return _0x459426[_0xb8e5('0x35')]({'read':!![]});}else{logger[_0xb8e5('0x24')](_0xb8e5('0x22'),'status','csc',util[_0xb8e5('0xd6')](_0x4b1800[_0xb8e5('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x459426;}})[_0xb8e5('0x1f')](respondWithResult(_0x1798ae,null))[_0xb8e5('0x29')](handleError(_0x1798ae,null));};exports[_0xb8e5('0xe6')]=function(_0x3f459d,_0x435f9a,_0x17243f){return db[_0xb8e5('0x40')][_0xb8e5('0x5b')]({'where':{'id':_0x3f459d[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x435f9a,null))[_0xb8e5('0x1f')](function(_0x3276b6){if(_0x3276b6){return _0x3276b6[_0xb8e5('0xe6')](_0x3f459d[_0xb8e5('0x5c')][_0xb8e5('0x6e')],_[_0xb8e5('0xa3')](_0x3f459d[_0xb8e5('0x5c')],['ids','id'])||{})[_0xb8e5('0xa5')](function(_0x5ca6b9){for(var _0x104e67=0x0;_0x104e67<_0x3f459d[_0xb8e5('0x5c')]['ids']['length'];_0x104e67+=0x1){socket[_0xb8e5('0xe7')](_0xb8e5('0xe8'),{'UserId':Number(_0x3f459d['body'][_0xb8e5('0x6e')][_0x104e67]),'SmsAccountId':Number(_0x3f459d['params']['id'])});}return _0x5ca6b9;});}})[_0xb8e5('0x1f')](respondWithResult(_0x435f9a,null))['catch'](handleError(_0x435f9a,null));};exports[_0xb8e5('0xe9')]=function(_0xc3aab5,_0xa56b07,_0x4e3596){return db['SmsAccount'][_0xb8e5('0x5b')]({'where':{'id':_0xc3aab5[_0xb8e5('0x65')]['id']}})['then'](handleEntityNotFound(_0xa56b07,null))[_0xb8e5('0x1f')](function(_0x24fa41){if(_0x24fa41){return _0x24fa41[_0xb8e5('0xe9')](_0xc3aab5[_0xb8e5('0x44')][_0xb8e5('0x6e')])[_0xb8e5('0x1f')](function(){if(_[_0xb8e5('0xea')](_0xc3aab5['query']['ids'])){for(var _0xc8d7dd=0x0;_0xc8d7dd<_0xc3aab5[_0xb8e5('0x44')][_0xb8e5('0x6e')][_0xb8e5('0x5a')];_0xc8d7dd+=0x1){socket[_0xb8e5('0xe7')](_0xb8e5('0xeb'),{'UserId':Number(_0xc3aab5[_0xb8e5('0x44')][_0xb8e5('0x6e')][_0xc8d7dd]),'SmsAccountId':Number(_0xc3aab5['params']['id'])});}}else{socket['emit'](_0xb8e5('0xeb'),{'UserId':Number(_0xc3aab5[_0xb8e5('0x44')][_0xb8e5('0x6e')]),'SmsAccountId':Number(_0xc3aab5[_0xb8e5('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0xa56b07,null))[_0xb8e5('0x29')](handleError(_0xa56b07,null));};exports['getAgents']=function(_0x12d9d2,_0x19b141,_0x59387a){var _0x45ec9b={};var _0x4a21b0={};var _0x29d0fb;var _0x4d0d78;return db[_0xb8e5('0x40')][_0xb8e5('0x6a')]({'where':{'id':_0x12d9d2[_0xb8e5('0x65')]['id']}})[_0xb8e5('0x1f')](handleEntityNotFound(_0x19b141,null))[_0xb8e5('0x1f')](function(_0x2c341c){if(_0x2c341c){_0x29d0fb=_0x2c341c;_0x4a21b0[_0xb8e5('0x43')]=_[_0xb8e5('0x58')](db[_0xb8e5('0xae')][_0xb8e5('0x59')]);_0x4a21b0[_0xb8e5('0x44')]=_[_0xb8e5('0x58')](_0x12d9d2[_0xb8e5('0x44')]);_0x4a21b0[_0xb8e5('0x45')]=_[_0xb8e5('0x46')](_0x4a21b0[_0xb8e5('0x43')],_0x4a21b0['query']);_0x45ec9b[_0xb8e5('0x47')]=_[_0xb8e5('0x46')](_0x4a21b0[_0xb8e5('0x43')],qs['fields'](_0x12d9d2[_0xb8e5('0x44')][_0xb8e5('0x48')]));_0x45ec9b[_0xb8e5('0x47')]=_0x45ec9b[_0xb8e5('0x47')][_0xb8e5('0x5a')]?_0x45ec9b[_0xb8e5('0x47')]:_0x4a21b0[_0xb8e5('0x43')];_0x45ec9b[_0xb8e5('0x4a')]=qs[_0xb8e5('0x4b')](_0x12d9d2['query']['sort']);_0x45ec9b[_0xb8e5('0x4c')]=qs[_0xb8e5('0x45')](_[_0xb8e5('0x4d')](_0x12d9d2[_0xb8e5('0x44')],_0x4a21b0[_0xb8e5('0x45')]));if(_0x12d9d2[_0xb8e5('0x44')][_0xb8e5('0x51')]){_0x45ec9b[_0xb8e5('0x4c')]=_[_0xb8e5('0x4e')](_0x45ec9b[_0xb8e5('0x4c')],{'$or':_['map'](_0x45ec9b[_0xb8e5('0x47')],function(_0x40b761){var _0x2aaaf0={};_0x2aaaf0[_0x40b761]={'$like':'%'+_0x12d9d2['query'][_0xb8e5('0x51')]+'%'};return _0x2aaaf0;})});}_0x45ec9b=_[_0xb8e5('0x4e')]({},_0x45ec9b,_0x12d9d2[_0xb8e5('0x52')]);return _0x29d0fb[_0xb8e5('0xec')](_0x45ec9b);}})[_0xb8e5('0x1f')](function(_0xb69825){if(_0xb69825){_0x4d0d78=_0xb69825['length'];if(!_0x12d9d2[_0xb8e5('0x44')][_0xb8e5('0x6c')](_0xb8e5('0x49'))){_0x45ec9b[_0xb8e5('0x2e')]=qs[_0xb8e5('0x2e')](_0x12d9d2['query'][_0xb8e5('0x2e')]);_0x45ec9b[_0xb8e5('0x2d')]=qs[_0xb8e5('0x2d')](_0x12d9d2['query'][_0xb8e5('0x2d')]);}return _0x29d0fb[_0xb8e5('0xec')](_0x45ec9b);}})[_0xb8e5('0x1f')](function(_0x73079d){if(_0x73079d){return _0x73079d?{'count':_0x4d0d78,'rows':_0x73079d}:null;}})[_0xb8e5('0x1f')](respondWithResult(_0x19b141,null))[_0xb8e5('0x29')](handleError(_0x19b141,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 5262269..54b4119 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 _0x09a0=['SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x38f38c,_0x31a4f4){var _0x13ab65=function(_0x485281){while(--_0x485281){_0x38f38c['push'](_0x38f38c['shift']());}};_0x13ab65(++_0x31a4f4);}(_0x09a0,0x8e));var _0x009a=function(_0x5c822e,_0x47f1ad){_0x5c822e=_0x5c822e-0x0;var _0x1ee4bc=_0x09a0[_0x5c822e];return _0x1ee4bc;};'use strict';var EventEmitter=require(_0x009a('0x0'));var SmsAccount=require(_0x009a('0x1'))['db'][_0x009a('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x009a('0x3')](0x0);var events={'afterCreate':_0x009a('0x4'),'afterUpdate':_0x009a('0x5'),'afterDestroy':_0x009a('0x6')};function emitEvent(_0x1bbb6e){return function(_0x1cba50,_0x4dc931,_0x2d3403){SmsAccountEvents[_0x009a('0x7')](_0x1bbb6e+':'+_0x1cba50['id'],_0x1cba50);SmsAccountEvents[_0x009a('0x7')](_0x1bbb6e,_0x1cba50);_0x2d3403(null);};}for(var e in events){if(events[_0x009a('0x8')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xcb01=['SmsAccount','save','update','remove','emit','exports','events'];(function(_0x38f737,_0x54f685){var _0x7afda3=function(_0x1ac1d7){while(--_0x1ac1d7){_0x38f737['push'](_0x38f737['shift']());}};_0x7afda3(++_0x54f685);}(_0xcb01,0x1aa));var _0x1cb0=function(_0x507cad,_0xe4b334){_0x507cad=_0x507cad-0x0;var _0x1beaa1=_0xcb01[_0x507cad];return _0x1beaa1;};'use strict';var EventEmitter=require(_0x1cb0('0x0'));var SmsAccount=require('../../mysqldb')['db'][_0x1cb0('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cb0('0x2'),'afterUpdate':_0x1cb0('0x3'),'afterDestroy':_0x1cb0('0x4')};function emitEvent(_0x3bfee7){return function(_0x272ad9,_0x241f7b,_0x589133){SmsAccountEvents[_0x1cb0('0x5')](_0x3bfee7+':'+_0x272ad9['id'],_0x272ad9);SmsAccountEvents[_0x1cb0('0x5')](_0x3bfee7,_0x272ad9);_0x589133(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x1cb0('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index d99334e..07b7262 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 _0xfadd=['request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','define','lodash','util','bluebird'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0xfadd,0x1a4));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xdfad('0x0'));var util=require(_0xdfad('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xdfad('0x2'));var rp=require(_0xdfad('0x3'));var fs=require('fs');var path=require(_0xdfad('0x4'));var rimraf=require(_0xdfad('0x5'));var config=require(_0xdfad('0x6'));var attributes=require(_0xdfad('0x7'));module['exports']=function(_0x14ce85,_0x1a17fe){return _0x14ce85[_0xdfad('0x8')]('SmsAccount',attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7877=['define','SmsAccount','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x3358ba,_0x24c5fc){var _0x296e73=function(_0x843ff3){while(--_0x843ff3){_0x3358ba['push'](_0x3358ba['shift']());}};_0x296e73(++_0x24c5fc);}(_0x7877,0x156));var _0x7787=function(_0x510fa0,_0x263638){_0x510fa0=_0x510fa0-0x0;var _0x156428=_0x7877[_0x510fa0];return _0x156428;};'use strict';var _=require(_0x7787('0x0'));var util=require(_0x7787('0x1'));var logger=require(_0x7787('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7787('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7787('0x4'));var rimraf=require(_0x7787('0x5'));var config=require(_0x7787('0x6'));var attributes=require('./smsAccount.attributes');module[_0x7787('0x7')]=function(_0x10e9f3,_0xe56f61){return _0x10e9f3[_0x7787('0x8')](_0x7787('0x9'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 1876978..e59b7c2 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 _0x677a=['info','ShowSmsAccount','find','options','raw','where','attributes','include','model','map','stringify','catch','lodash','util','moment','bluebird','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x677a,0xbb));var _0xa677=function(_0x37a150,_0x5404b0){_0x37a150=_0x37a150-0x0;var _0x15d8ab=_0x677a[_0x37a150];return _0x15d8ab;};'use strict';var _=require(_0xa677('0x0'));var util=require(_0xa677('0x1'));var moment=require(_0xa677('0x2'));var BPromise=require(_0xa677('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa677('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa677('0x5'));var config=require(_0xa677('0x6'));var jayson=require(_0xa677('0x7'));var client=jayson[_0xa677('0x8')][_0xa677('0x9')]({'port':0x232a});config[_0xa677('0xa')]=_[_0xa677('0xb')](config[_0xa677('0xa')],{'host':_0xa677('0xc'),'port':0x18eb});var socket=require(_0xa677('0xd'))(new Redis(config['redis']));require(_0xa677('0xe'))[_0xa677('0xf')](socket);function respondWithRpcPromise(_0x2a851c,_0x4a6ba9,_0x48546f){return new BPromise(function(_0x6dd9df,_0xb46c91){return client['request'](_0x2a851c,_0x48546f)['then'](function(_0x133c60){logger['info'](_0xa677('0x10'),_0x4a6ba9,'request\x20sent');logger[_0xa677('0x11')](_0xa677('0x12'),_0x4a6ba9,_0xa677('0x13'),JSON['stringify'](_0x133c60));if(_0x133c60['error']){if(_0x133c60[_0xa677('0x14')][_0xa677('0x15')]===0x1f4){logger[_0xa677('0x14')](_0xa677('0x10'),_0x4a6ba9,_0x133c60[_0xa677('0x14')][_0xa677('0x16')]);return _0xb46c91(_0x133c60[_0xa677('0x14')]['message']);}logger[_0xa677('0x14')](_0xa677('0x10'),_0x4a6ba9,_0x133c60[_0xa677('0x14')]['message']);return _0x6dd9df(_0x133c60['error'][_0xa677('0x16')]);}else{logger[_0xa677('0x17')](_0xa677('0x10'),_0x4a6ba9,'request\x20sent');_0x6dd9df(_0x133c60['result']['message']);}})['catch'](function(_0x18fb0b){logger[_0xa677('0x14')](_0xa677('0x10'),_0x4a6ba9,_0x18fb0b);_0xb46c91(_0x18fb0b);});});}exports[_0xa677('0x18')]=function(_0xfe3fe6){var _0x138964=this;return new Promise(function(_0xae1835,_0x41cade){return db['SmsAccount'][_0xa677('0x19')]({'raw':_0xfe3fe6[_0xa677('0x1a')]?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1b')]===undefined?!![]:![]:!![],'where':_0xfe3fe6[_0xa677('0x1a')]?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1c')]||null:null,'attributes':_0xfe3fe6[_0xa677('0x1a')]?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1d')]||null:null,'include':_0xfe3fe6['options']?_0xfe3fe6[_0xa677('0x1a')][_0xa677('0x1e')]?_['map'](_0xfe3fe6['options'][_0xa677('0x1e')],function(_0x37f861){return{'model':db[_0x37f861[_0xa677('0x1f')]],'as':_0x37f861['as'],'attributes':_0x37f861[_0xa677('0x1d')],'include':_0x37f861['include']?_[_0xa677('0x20')](_0x37f861[_0xa677('0x1e')],function(_0x4337c6){return{'model':db[_0x4337c6[_0xa677('0x1f')]],'as':_0x4337c6['as'],'attributes':_0x4337c6['attributes'],'include':_0x4337c6['include']?_[_0xa677('0x20')](_0x4337c6[_0xa677('0x1e')],function(_0x718aa8){return{'model':db[_0x718aa8[_0xa677('0x1f')]],'as':_0x718aa8['as'],'attributes':_0x718aa8[_0xa677('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x6b8cc8){logger['info'](_0xa677('0x18'),_0xfe3fe6);logger[_0xa677('0x11')](_0xa677('0x18'),_0xfe3fe6,JSON[_0xa677('0x21')](_0x6b8cc8));_0xae1835(_0x6b8cc8);})[_0xa677('0x22')](function(_0x1e285b){logger[_0xa677('0x14')](_0xa677('0x18'),_0x1e285b['message'],_0xfe3fe6);_0x41cade(_0x138964[_0xa677('0x14')](0x1f4,_0x1e285b[_0xa677('0x16')]));});});}; \ No newline at end of file +var _0x3744=['debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent'];(function(_0x5ed70d,_0x3beccd){var _0x152b3e=function(_0x48649d){while(--_0x48649d){_0x5ed70d['push'](_0x5ed70d['shift']());}};_0x152b3e(++_0x3beccd);}(_0x3744,0x103));var _0x4374=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x3744[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x4374('0x0'));var util=require(_0x4374('0x1'));var moment=require(_0x4374('0x2'));var BPromise=require(_0x4374('0x3'));var rs=require(_0x4374('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4374('0x5'))['db'];var utils=require(_0x4374('0x6'));var logger=require(_0x4374('0x7'))(_0x4374('0x8'));var config=require(_0x4374('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4374('0xa')][_0x4374('0xb')]({'port':0x232a});config[_0x4374('0xc')]=_[_0x4374('0xd')](config[_0x4374('0xc')],{'host':_0x4374('0xe'),'port':0x18eb});var socket=require(_0x4374('0xf'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x4374('0x10')](socket);function respondWithRpcPromise(_0x17e374,_0x404c4c,_0x1b3edc){return new BPromise(function(_0x360b05,_0x5a1b4c){return client[_0x4374('0x11')](_0x17e374,_0x1b3edc)[_0x4374('0x12')](function(_0x25871f){logger[_0x4374('0x13')]('SmsAccount,\x20%s,\x20%s',_0x404c4c,_0x4374('0x14'));logger[_0x4374('0x15')](_0x4374('0x16'),_0x404c4c,'request\x20sent',JSON[_0x4374('0x17')](_0x25871f));if(_0x25871f[_0x4374('0x18')]){if(_0x25871f['error'][_0x4374('0x19')]===0x1f4){logger[_0x4374('0x18')](_0x4374('0x1a'),_0x404c4c,_0x25871f[_0x4374('0x18')][_0x4374('0x1b')]);return _0x5a1b4c(_0x25871f[_0x4374('0x18')]['message']);}logger[_0x4374('0x18')]('SmsAccount,\x20%s,\x20%s',_0x404c4c,_0x25871f[_0x4374('0x18')]['message']);return _0x360b05(_0x25871f[_0x4374('0x18')][_0x4374('0x1b')]);}else{logger[_0x4374('0x13')](_0x4374('0x1a'),_0x404c4c,'request\x20sent');_0x360b05(_0x25871f[_0x4374('0x1c')][_0x4374('0x1b')]);}})['catch'](function(_0x315482){logger[_0x4374('0x18')](_0x4374('0x1a'),_0x404c4c,_0x315482);_0x5a1b4c(_0x315482);});});}exports[_0x4374('0x1d')]=function(_0x67ad01){var _0x3ca445=this;return new Promise(function(_0x5589b8,_0x594d59){return db[_0x4374('0x1e')][_0x4374('0x1f')]({'raw':_0x67ad01[_0x4374('0x20')]?_0x67ad01[_0x4374('0x20')][_0x4374('0x21')]===undefined?!![]:![]:!![],'where':_0x67ad01[_0x4374('0x20')]?_0x67ad01[_0x4374('0x20')][_0x4374('0x22')]||null:null,'attributes':_0x67ad01[_0x4374('0x20')]?_0x67ad01[_0x4374('0x20')]['attributes']||null:null,'include':_0x67ad01[_0x4374('0x20')]?_0x67ad01[_0x4374('0x20')][_0x4374('0x23')]?_['map'](_0x67ad01[_0x4374('0x20')]['include'],function(_0x5d5275){return{'model':db[_0x5d5275['model']],'as':_0x5d5275['as'],'attributes':_0x5d5275['attributes'],'include':_0x5d5275[_0x4374('0x23')]?_[_0x4374('0x24')](_0x5d5275[_0x4374('0x23')],function(_0x2a11e9){return{'model':db[_0x2a11e9[_0x4374('0x25')]],'as':_0x2a11e9['as'],'attributes':_0x2a11e9[_0x4374('0x26')],'include':_0x2a11e9[_0x4374('0x23')]?_[_0x4374('0x24')](_0x2a11e9[_0x4374('0x23')],function(_0x3b2e07){return{'model':db[_0x3b2e07[_0x4374('0x25')]],'as':_0x3b2e07['as'],'attributes':_0x3b2e07[_0x4374('0x26')]};}):[]};}):[]};}):[]:[]})[_0x4374('0x12')](function(_0xf862b2){logger['info'](_0x4374('0x1d'),_0x67ad01);logger[_0x4374('0x15')](_0x4374('0x1d'),_0x67ad01,JSON[_0x4374('0x17')](_0xf862b2));_0x5589b8(_0xf862b2);})[_0x4374('0x27')](function(_0x45dbce){logger[_0x4374('0x18')]('ShowSmsAccount',_0x45dbce[_0x4374('0x1b')],_0x67ad01);_0x594d59(_0x3ca445['error'](0x1f4,_0x45dbce[_0x4374('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 6daa4db..3cae97e 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'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 dae3f02..10fb515 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x60dd1c,_0x384166){var _0xba1c5b=function(_0x3311f4){while(--_0x3311f4){_0x60dd1c['push'](_0x60dd1c['shift']());}};_0xba1c5b(++_0x384166);}(_0x55ca,0x126));var _0xa55c=function(_0x32ee50,_0x564493){_0x32ee50=_0x32ee50-0x0;var _0x12a1b3=_0x55ca[_0x32ee50];return _0x12a1b3;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0xb')]);router['put']('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xc')]);router[_0xa55c('0xd')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);module[_0xa55c('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x34021d,_0x753aa6){var _0x16597b=function(_0x2d040a){while(--_0x2d040a){_0x34021d['push'](_0x34021d['shift']());}};_0x16597b(++_0x753aa6);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 51ec6d0..67f6e06 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 _0x2e98=['STRING','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x459dcd,_0x4ff703){var _0x1fbb32=function(_0xab9cc){while(--_0xab9cc){_0x459dcd['push'](_0x459dcd['shift']());}};_0x1fbb32(++_0x4ff703);}(_0x2e98,0x110));var _0x82e9=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x2e98[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0x82e9('0x0'));module[_0x82e9('0x1')]={'priority':{'type':Sequelize[_0x82e9('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x82e9('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x82e9('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x82e9('0x4')}}; \ No newline at end of file +var _0xfef0=['*,*,*,*','sequelize','STRING','noop','TEXT'];(function(_0x5ebbea,_0x361571){var _0x4bb3a5=function(_0x39b7e4){while(--_0x39b7e4){_0x5ebbea['push'](_0x5ebbea['shift']());}};_0x4bb3a5(++_0x361571);}(_0xfef0,0x105));var _0x0fef=function(_0x11d9cf,_0x170ac7){_0x11d9cf=_0x11d9cf-0x0;var _0xc9f70b=_0xfef0[_0x11d9cf];return _0xc9f70b;};'use strict';var Sequelize=require(_0x0fef('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0fef('0x1')],'allowNull':![],'defaultValue':_0x0fef('0x2')},'appdata':{'type':Sequelize[_0x0fef('0x3')]()},'description':{'type':Sequelize[_0x0fef('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0fef('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 7cbe50b..8afd82b 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 _0x77fb=['squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','update','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','create','body','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra'];(function(_0x24fcfd,_0x73ed5b){var _0x27107c=function(_0x4e66e5){while(--_0x4e66e5){_0x24fcfd['push'](_0x24fcfd['shift']());}};_0x27107c(++_0x73ed5b);}(_0x77fb,0xdf));var _0xb77f=function(_0x27fe47,_0x1d5375){_0x27fe47=_0x27fe47-0x0;var _0x2d3a66=_0x77fb[_0x27fe47];return _0x2d3a66;};'use strict';var emlformat=require(_0xb77f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb77f('0x1'));var jsonpatch=require(_0xb77f('0x2'));var rp=require(_0xb77f('0x3'));var moment=require(_0xb77f('0x4'));var BPromise=require(_0xb77f('0x5'));var Mustache=require(_0xb77f('0x6'));var util=require(_0xb77f('0x7'));var path=require(_0xb77f('0x8'));var sox=require(_0xb77f('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb77f('0xa'));var _=require('lodash');var squel=require(_0xb77f('0xb'));var crypto=require(_0xb77f('0xc'));var jsforce=require(_0xb77f('0xd'));var deskjs=require(_0xb77f('0xe'));var toCsv=require(_0xb77f('0xf'));var querystring=require(_0xb77f('0x10'));var Papa=require(_0xb77f('0x11'));var Redis=require(_0xb77f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb77f('0x13'));var as=require(_0xb77f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb77f('0x15'))('api');var utils=require(_0xb77f('0x16'));var config=require(_0xb77f('0x17'));var licenseUtil=require(_0xb77f('0x18'));var db=require(_0xb77f('0x19'))['db'];function respondWithStatusCode(_0x40758c,_0x4468e7){_0x4468e7=_0x4468e7||0xcc;return function(_0x13ca49){if(_0x13ca49){return _0x40758c[_0xb77f('0x1a')](_0x4468e7);}return _0x40758c[_0xb77f('0x1b')](_0x4468e7)[_0xb77f('0x1c')]();};}function respondWithResult(_0x3fa37b,_0x23d75b){_0x23d75b=_0x23d75b||0xc8;return function(_0x5d022b){if(_0x5d022b){return _0x3fa37b['status'](_0x23d75b)[_0xb77f('0x1d')](_0x5d022b);}};}function respondWithFilteredResult(_0x29c5a0,_0x51359e){return function(_0x108f03){if(_0x108f03){var _0x21bb5a=typeof _0x51359e[_0xb77f('0x1e')]==='undefined'&&typeof _0x51359e['limit']===_0xb77f('0x1f');var _0x50a816=_0x108f03[_0xb77f('0x20')];var _0x5d0a89=_0x21bb5a?0x0:_0x51359e['offset'];var _0x5f1065=_0x21bb5a?_0x108f03['count']:_0x51359e[_0xb77f('0x1e')]+_0x51359e[_0xb77f('0x21')];var _0x49444c;if(_0x5f1065>=_0x50a816){_0x5f1065=_0x50a816;_0x49444c=0xc8;}else{_0x49444c=0xce;}_0x29c5a0[_0xb77f('0x1b')](_0x49444c);return _0x29c5a0['set'](_0xb77f('0x22'),_0x5d0a89+'-'+_0x5f1065+'/'+_0x50a816)[_0xb77f('0x1d')](_0x108f03);}return null;};}function patchUpdates(_0x37cce7){return function(_0x3a27f0){try{jsonpatch[_0xb77f('0x23')](_0x3a27f0,_0x37cce7,!![]);}catch(_0x70777e){return BPromise['reject'](_0x70777e);}return _0x3a27f0['save']();};}function saveUpdates(_0x49c737,_0x34d4b8){return function(_0xa61dd0){if(_0xa61dd0){return _0xa61dd0[_0xb77f('0x24')](_0x49c737)[_0xb77f('0x25')](function(_0x3f19c2){return _0x3f19c2;});}return null;};}function removeEntity(_0x39d67d,_0x3e5589){return function(_0x13e599){if(_0x13e599){return _0x13e599['destroy']()[_0xb77f('0x25')](function(){_0x39d67d[_0xb77f('0x1b')](0xcc)[_0xb77f('0x1c')]();});}};}function handleEntityNotFound(_0x3c14c4,_0x1bcf43){return function(_0x22d81c){if(!_0x22d81c){_0x3c14c4[_0xb77f('0x1a')](0x194);}return _0x22d81c;};}function handleError(_0x57ee16,_0x212e41){_0x212e41=_0x212e41||0x1f4;return function(_0x407cc7){logger[_0xb77f('0x26')](_0x407cc7[_0xb77f('0x27')]);if(_0x407cc7[_0xb77f('0x28')]){delete _0x407cc7[_0xb77f('0x28')];}_0x57ee16['status'](_0x212e41)[_0xb77f('0x29')](_0x407cc7);};}exports[_0xb77f('0x2a')]=function(_0x3893b2,_0x19e27f){var _0x671ca5={},_0x224cb3={},_0x6f5b34={'count':0x0,'rows':[]};var _0x4cd9cb=_[_0xb77f('0x2b')](db[_0xb77f('0x2c')][_0xb77f('0x2d')],function(_0x1b5d96){return{'name':_0x1b5d96[_0xb77f('0x2e')],'type':_0x1b5d96[_0xb77f('0x2f')][_0xb77f('0x30')]};});_0x224cb3[_0xb77f('0x31')]=_[_0xb77f('0x2b')](_0x4cd9cb,'name');_0x224cb3['query']=_['keys'](_0x3893b2['query']);_0x224cb3[_0xb77f('0x32')]=_[_0xb77f('0x33')](_0x224cb3[_0xb77f('0x31')],_0x224cb3[_0xb77f('0x34')]);_0x671ca5[_0xb77f('0x35')]=_[_0xb77f('0x33')](_0x224cb3[_0xb77f('0x31')],qs[_0xb77f('0x36')](_0x3893b2['query'][_0xb77f('0x36')]));_0x671ca5[_0xb77f('0x35')]=_0x671ca5[_0xb77f('0x35')][_0xb77f('0x37')]?_0x671ca5['attributes']:_0x224cb3['model'];if(!_0x3893b2[_0xb77f('0x34')][_0xb77f('0x38')](_0xb77f('0x39'))){_0x671ca5[_0xb77f('0x21')]=qs['limit'](_0x3893b2[_0xb77f('0x34')][_0xb77f('0x21')]);_0x671ca5[_0xb77f('0x1e')]=qs[_0xb77f('0x1e')](_0x3893b2[_0xb77f('0x34')]['offset']);}_0x671ca5[_0xb77f('0x3a')]=qs['sort'](_0x3893b2[_0xb77f('0x34')][_0xb77f('0x3b')]);_0x671ca5[_0xb77f('0x3c')]=qs[_0xb77f('0x32')](_[_0xb77f('0x3d')](_0x3893b2[_0xb77f('0x34')],_0x224cb3[_0xb77f('0x32')]),_0x4cd9cb);if(_0x3893b2[_0xb77f('0x34')][_0xb77f('0x3e')]){_0x671ca5[_0xb77f('0x3c')]=_[_0xb77f('0x3f')](_0x671ca5[_0xb77f('0x3c')],{'$or':_['map'](_0x4cd9cb,function(_0x1730df){if(_0x1730df[_0xb77f('0x2f')]!==_0xb77f('0x40')){var _0xf4605a={};_0xf4605a[_0x1730df[_0xb77f('0x28')]]={'$like':'%'+_0x3893b2['query'][_0xb77f('0x3e')]+'%'};return _0xf4605a;}})});}_0x671ca5=_[_0xb77f('0x3f')]({},_0x671ca5,_0x3893b2[_0xb77f('0x41')]);var _0x1369cb={'where':_0x671ca5['where']};return db[_0xb77f('0x2c')]['count'](_0x1369cb)[_0xb77f('0x25')](function(_0xb1e20b){_0x6f5b34['count']=_0xb1e20b;if(_0x3893b2[_0xb77f('0x34')][_0xb77f('0x42')]){_0x671ca5[_0xb77f('0x43')]=[{'all':!![]}];}return db[_0xb77f('0x2c')][_0xb77f('0x44')](_0x671ca5);})[_0xb77f('0x25')](function(_0x371fcf){_0x6f5b34[_0xb77f('0x45')]=_0x371fcf;return _0x6f5b34;})[_0xb77f('0x25')](respondWithFilteredResult(_0x19e27f,_0x671ca5))['catch'](handleError(_0x19e27f,null));};exports[_0xb77f('0x46')]=function(_0x40d630,_0x44d48d){var _0x5d96cd={'raw':!![],'where':{'id':_0x40d630[_0xb77f('0x47')]['id']}},_0x1b29bb={};_0x1b29bb[_0xb77f('0x31')]=_['keys'](db['SmsApplication'][_0xb77f('0x2d')]);_0x1b29bb['query']=_[_0xb77f('0x48')](_0x40d630[_0xb77f('0x34')]);_0x1b29bb['filters']=_['intersection'](_0x1b29bb[_0xb77f('0x31')],_0x1b29bb[_0xb77f('0x34')]);_0x5d96cd[_0xb77f('0x35')]=_[_0xb77f('0x33')](_0x1b29bb['model'],qs['fields'](_0x40d630[_0xb77f('0x34')][_0xb77f('0x36')]));_0x5d96cd[_0xb77f('0x35')]=_0x5d96cd[_0xb77f('0x35')][_0xb77f('0x37')]?_0x5d96cd[_0xb77f('0x35')]:_0x1b29bb[_0xb77f('0x31')];if(_0x40d630[_0xb77f('0x34')][_0xb77f('0x42')]){_0x5d96cd[_0xb77f('0x43')]=[{'all':!![]}];}_0x5d96cd=_[_0xb77f('0x3f')]({},_0x5d96cd,_0x40d630[_0xb77f('0x41')]);return db[_0xb77f('0x2c')][_0xb77f('0x49')](_0x5d96cd)[_0xb77f('0x25')](handleEntityNotFound(_0x44d48d,null))[_0xb77f('0x25')](respondWithResult(_0x44d48d,null))[_0xb77f('0x4a')](handleError(_0x44d48d,null));};exports[_0xb77f('0x4b')]=function(_0x95c9fd,_0x6aec){return db[_0xb77f('0x2c')][_0xb77f('0x4b')](_0x95c9fd[_0xb77f('0x4c')],{})['then'](respondWithResult(_0x6aec,0xc9))[_0xb77f('0x4a')](handleError(_0x6aec,null));};exports[_0xb77f('0x24')]=function(_0x1148ff,_0x4a67b9){if(_0x1148ff['body']['id']){delete _0x1148ff[_0xb77f('0x4c')]['id'];}return db[_0xb77f('0x2c')]['find']({'where':{'id':_0x1148ff['params']['id']}})['then'](handleEntityNotFound(_0x4a67b9,null))[_0xb77f('0x25')](saveUpdates(_0x1148ff[_0xb77f('0x4c')],null))[_0xb77f('0x25')](respondWithResult(_0x4a67b9,null))[_0xb77f('0x4a')](handleError(_0x4a67b9,null));};exports[_0xb77f('0x4d')]=function(_0x2e6e84,_0x55cccb){return db[_0xb77f('0x2c')][_0xb77f('0x49')]({'where':{'id':_0x2e6e84[_0xb77f('0x47')]['id']}})[_0xb77f('0x25')](handleEntityNotFound(_0x55cccb,null))[_0xb77f('0x25')](removeEntity(_0x55cccb,null))[_0xb77f('0x4a')](handleError(_0x55cccb,null));}; \ No newline at end of file +var _0x782a=['ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','save','update','then','destroy','error','stack','name','send','index','map','SmsApplication','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','where','merge','options','includeAll','findAll','rows','catch','show','keys','rawAttributes','length','include','find','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0xaaaf50,_0x440801){var _0x334143=function(_0x45ece5){while(--_0x45ece5){_0xaaaf50['push'](_0xaaaf50['shift']());}};_0x334143(++_0x440801);}(_0x782a,0x8a));var _0xa782=function(_0x2fc040,_0x33fb2f){_0x2fc040=_0x2fc040-0x0;var _0x41c15b=_0x782a[_0x2fc040];return _0x41c15b;};'use strict';var emlformat=require(_0xa782('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa782('0x1'));var jsonpatch=require(_0xa782('0x2'));var rp=require(_0xa782('0x3'));var moment=require(_0xa782('0x4'));var BPromise=require(_0xa782('0x5'));var Mustache=require('mustache');var util=require(_0xa782('0x6'));var path=require(_0xa782('0x7'));var sox=require(_0xa782('0x8'));var csv=require(_0xa782('0x9'));var ejs=require(_0xa782('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa782('0xb'));var crypto=require('crypto');var jsforce=require(_0xa782('0xc'));var deskjs=require(_0xa782('0xd'));var toCsv=require('to-csv');var querystring=require(_0xa782('0xe'));var Papa=require(_0xa782('0xf'));var Redis=require(_0xa782('0x10'));var authService=require(_0xa782('0x11'));var qs=require(_0xa782('0x12'));var as=require(_0xa782('0x13'));var hardwareService=require(_0xa782('0x14'));var logger=require('../../config/logger')(_0xa782('0x15'));var utils=require(_0xa782('0x16'));var config=require(_0xa782('0x17'));var licenseUtil=require(_0xa782('0x18'));var db=require(_0xa782('0x19'))['db'];function respondWithStatusCode(_0x26d5a8,_0x2fa017){_0x2fa017=_0x2fa017||0xcc;return function(_0x24288b){if(_0x24288b){return _0x26d5a8[_0xa782('0x1a')](_0x2fa017);}return _0x26d5a8[_0xa782('0x1b')](_0x2fa017)[_0xa782('0x1c')]();};}function respondWithResult(_0x578a8b,_0x319814){_0x319814=_0x319814||0xc8;return function(_0x5c953a){if(_0x5c953a){return _0x578a8b[_0xa782('0x1b')](_0x319814)['json'](_0x5c953a);}};}function respondWithFilteredResult(_0x53cefc,_0x3833a6){return function(_0x2f831d){if(_0x2f831d){var _0xc1c7a5=typeof _0x3833a6[_0xa782('0x1d')]===_0xa782('0x1e')&&typeof _0x3833a6['limit']===_0xa782('0x1e');var _0x35eb4b=_0x2f831d['count'];var _0x4c853c=_0xc1c7a5?0x0:_0x3833a6[_0xa782('0x1d')];var _0x5ca77f=_0xc1c7a5?_0x2f831d[_0xa782('0x1f')]:_0x3833a6[_0xa782('0x1d')]+_0x3833a6[_0xa782('0x20')];var _0x3da3ad;if(_0x5ca77f>=_0x35eb4b){_0x5ca77f=_0x35eb4b;_0x3da3ad=0xc8;}else{_0x3da3ad=0xce;}_0x53cefc[_0xa782('0x1b')](_0x3da3ad);return _0x53cefc[_0xa782('0x21')]('Content-Range',_0x4c853c+'-'+_0x5ca77f+'/'+_0x35eb4b)[_0xa782('0x22')](_0x2f831d);}return null;};}function patchUpdates(_0x5f2887){return function(_0x1410e0){try{jsonpatch['apply'](_0x1410e0,_0x5f2887,!![]);}catch(_0x7ce8a8){return BPromise['reject'](_0x7ce8a8);}return _0x1410e0[_0xa782('0x23')]();};}function saveUpdates(_0x50a7d6,_0x2831b7){return function(_0xa38320){if(_0xa38320){return _0xa38320[_0xa782('0x24')](_0x50a7d6)[_0xa782('0x25')](function(_0x4117b4){return _0x4117b4;});}return null;};}function removeEntity(_0x27418e,_0x51a798){return function(_0x47cc21){if(_0x47cc21){return _0x47cc21[_0xa782('0x26')]()[_0xa782('0x25')](function(){_0x27418e['status'](0xcc)[_0xa782('0x1c')]();});}};}function handleEntityNotFound(_0x523f7d,_0x268ca8){return function(_0x3103d){if(!_0x3103d){_0x523f7d[_0xa782('0x1a')](0x194);}return _0x3103d;};}function handleError(_0x7a4ee9,_0x5a2d8d){_0x5a2d8d=_0x5a2d8d||0x1f4;return function(_0x2fc30f){logger[_0xa782('0x27')](_0x2fc30f[_0xa782('0x28')]);if(_0x2fc30f['name']){delete _0x2fc30f[_0xa782('0x29')];}_0x7a4ee9['status'](_0x5a2d8d)[_0xa782('0x2a')](_0x2fc30f);};}exports[_0xa782('0x2b')]=function(_0x2e912b,_0x55e200){var _0x38efc2={},_0x11105b={},_0x502837={'count':0x0,'rows':[]};var _0xea1f4c=_[_0xa782('0x2c')](db[_0xa782('0x2d')]['rawAttributes'],function(_0x4c1e2b){return{'name':_0x4c1e2b[_0xa782('0x2e')],'type':_0x4c1e2b[_0xa782('0x2f')]['key']};});_0x11105b[_0xa782('0x30')]=_[_0xa782('0x2c')](_0xea1f4c,'name');_0x11105b[_0xa782('0x31')]=_['keys'](_0x2e912b[_0xa782('0x31')]);_0x11105b[_0xa782('0x32')]=_[_0xa782('0x33')](_0x11105b['model'],_0x11105b[_0xa782('0x31')]);_0x38efc2[_0xa782('0x34')]=_[_0xa782('0x33')](_0x11105b[_0xa782('0x30')],qs[_0xa782('0x35')](_0x2e912b[_0xa782('0x31')][_0xa782('0x35')]));_0x38efc2[_0xa782('0x34')]=_0x38efc2['attributes']['length']?_0x38efc2[_0xa782('0x34')]:_0x11105b[_0xa782('0x30')];if(!_0x2e912b['query'][_0xa782('0x36')]('nolimit')){_0x38efc2[_0xa782('0x20')]=qs[_0xa782('0x20')](_0x2e912b[_0xa782('0x31')][_0xa782('0x20')]);_0x38efc2['offset']=qs[_0xa782('0x1d')](_0x2e912b[_0xa782('0x31')][_0xa782('0x1d')]);}_0x38efc2['order']=qs[_0xa782('0x37')](_0x2e912b[_0xa782('0x31')][_0xa782('0x37')]);_0x38efc2['where']=qs[_0xa782('0x32')](_[_0xa782('0x38')](_0x2e912b['query'],_0x11105b[_0xa782('0x32')]),_0xea1f4c);if(_0x2e912b['query'][_0xa782('0x39')]){_0x38efc2['where']=_['merge'](_0x38efc2[_0xa782('0x3a')],{'$or':_[_0xa782('0x2c')](_0xea1f4c,function(_0x56c5fc){if(_0x56c5fc[_0xa782('0x2f')]!=='VIRTUAL'){var _0x252d3c={};_0x252d3c[_0x56c5fc[_0xa782('0x29')]]={'$like':'%'+_0x2e912b[_0xa782('0x31')][_0xa782('0x39')]+'%'};return _0x252d3c;}})});}_0x38efc2=_[_0xa782('0x3b')]({},_0x38efc2,_0x2e912b[_0xa782('0x3c')]);var _0x763891={'where':_0x38efc2[_0xa782('0x3a')]};return db['SmsApplication'][_0xa782('0x1f')](_0x763891)[_0xa782('0x25')](function(_0x2e9b5b){_0x502837['count']=_0x2e9b5b;if(_0x2e912b[_0xa782('0x31')][_0xa782('0x3d')]){_0x38efc2['include']=[{'all':!![]}];}return db['SmsApplication'][_0xa782('0x3e')](_0x38efc2);})[_0xa782('0x25')](function(_0x3334c9){_0x502837[_0xa782('0x3f')]=_0x3334c9;return _0x502837;})[_0xa782('0x25')](respondWithFilteredResult(_0x55e200,_0x38efc2))[_0xa782('0x40')](handleError(_0x55e200,null));};exports[_0xa782('0x41')]=function(_0x377cab,_0x4d2f24){var _0xa6e658={'raw':!![],'where':{'id':_0x377cab['params']['id']}},_0x5115e7={};_0x5115e7[_0xa782('0x30')]=_[_0xa782('0x42')](db[_0xa782('0x2d')][_0xa782('0x43')]);_0x5115e7[_0xa782('0x31')]=_[_0xa782('0x42')](_0x377cab[_0xa782('0x31')]);_0x5115e7[_0xa782('0x32')]=_[_0xa782('0x33')](_0x5115e7[_0xa782('0x30')],_0x5115e7['query']);_0xa6e658['attributes']=_[_0xa782('0x33')](_0x5115e7[_0xa782('0x30')],qs[_0xa782('0x35')](_0x377cab[_0xa782('0x31')][_0xa782('0x35')]));_0xa6e658['attributes']=_0xa6e658[_0xa782('0x34')][_0xa782('0x44')]?_0xa6e658[_0xa782('0x34')]:_0x5115e7[_0xa782('0x30')];if(_0x377cab[_0xa782('0x31')][_0xa782('0x3d')]){_0xa6e658[_0xa782('0x45')]=[{'all':!![]}];}_0xa6e658=_[_0xa782('0x3b')]({},_0xa6e658,_0x377cab[_0xa782('0x3c')]);return db[_0xa782('0x2d')][_0xa782('0x46')](_0xa6e658)['then'](handleEntityNotFound(_0x4d2f24,null))['then'](respondWithResult(_0x4d2f24,null))[_0xa782('0x40')](handleError(_0x4d2f24,null));};exports['create']=function(_0x19b4ff,_0x56c7e4){return db[_0xa782('0x2d')][_0xa782('0x47')](_0x19b4ff['body'],{})[_0xa782('0x25')](respondWithResult(_0x56c7e4,0xc9))['catch'](handleError(_0x56c7e4,null));};exports['update']=function(_0x3d13a2,_0x13f09d){if(_0x3d13a2[_0xa782('0x48')]['id']){delete _0x3d13a2['body']['id'];}return db[_0xa782('0x2d')][_0xa782('0x46')]({'where':{'id':_0x3d13a2[_0xa782('0x49')]['id']}})[_0xa782('0x25')](handleEntityNotFound(_0x13f09d,null))[_0xa782('0x25')](saveUpdates(_0x3d13a2[_0xa782('0x48')],null))[_0xa782('0x25')](respondWithResult(_0x13f09d,null))['catch'](handleError(_0x13f09d,null));};exports['destroy']=function(_0x4612af,_0x63893a){return db[_0xa782('0x2d')]['find']({'where':{'id':_0x4612af['params']['id']}})[_0xa782('0x25')](handleEntityNotFound(_0x63893a,null))['then'](removeEntity(_0x63893a,null))[_0xa782('0x40')](handleError(_0x63893a,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 9a86e5e..6a1d2cc 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 _0xf79f=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsApplication','sms_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xf79f,0x182));var _0xff79=function(_0x96b6a,_0x12471d){_0x96b6a=_0x96b6a-0x0;var _0x3e16f3=_0xf79f[_0x96b6a];return _0x3e16f3;};'use strict';var _=require('lodash');var util=require(_0xff79('0x0'));var logger=require(_0xff79('0x1'))(_0xff79('0x2'));var moment=require(_0xff79('0x3'));var BPromise=require(_0xff79('0x4'));var rp=require(_0xff79('0x5'));var fs=require('fs');var path=require(_0xff79('0x6'));var rimraf=require(_0xff79('0x7'));var config=require(_0xff79('0x8'));var attributes=require('./smsApplication.attributes');module[_0xff79('0x9')]=function(_0x10accc,_0x342ded){return _0x10accc[_0xff79('0xa')](_0xff79('0xb'),attributes,{'tableName':_0xff79('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xff79('0xd'),'collate':_0xff79('0xe')});}; \ No newline at end of file +var _0x0a21=['sms_applications','utf8mb4','utf8mb4_unicode_ci','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','define'];(function(_0x13f23e,_0x7336bb){var _0x36cc13=function(_0x1f2901){while(--_0x1f2901){_0x13f23e['push'](_0x13f23e['shift']());}};_0x36cc13(++_0x7336bb);}(_0x0a21,0x9f));var _0x10a2=function(_0x5206f6,_0x475258){_0x5206f6=_0x5206f6-0x0;var _0x5ba460=_0x0a21[_0x5206f6];return _0x5ba460;};'use strict';var _=require('lodash');var util=require(_0x10a2('0x0'));var logger=require('../../config/logger')(_0x10a2('0x1'));var moment=require(_0x10a2('0x2'));var BPromise=require('bluebird');var rp=require(_0x10a2('0x3'));var fs=require('fs');var path=require(_0x10a2('0x4'));var rimraf=require(_0x10a2('0x5'));var config=require(_0x10a2('0x6'));var attributes=require(_0x10a2('0x7'));module['exports']=function(_0x41195e,_0x4d14d0){return _0x41195e[_0x10a2('0x8')]('SmsApplication',attributes,{'tableName':_0x10a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x10a2('0xa'),'collate':_0x10a2('0xb')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index f32ce99..28cb2cf 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 _0x9541=['http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x9541,0xb3));var _0x1954=function(_0x43642d,_0x25b89f){_0x43642d=_0x43642d-0x0;var _0x2fc586=_0x9541[_0x43642d];return _0x2fc586;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require(_0x1954('0x3'));var rs=require(_0x1954('0x4'));var fs=require('fs');var Redis=require(_0x1954('0x5'));var db=require(_0x1954('0x6'))['db'];var utils=require(_0x1954('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x1954('0x8'));var jayson=require(_0x1954('0x9'));var client=jayson['client'][_0x1954('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ceca,_0x30beea,_0x2ccff8){return new BPromise(function(_0xda7a2f,_0xa7a784){return client['request'](_0x21ceca,_0x2ccff8)[_0x1954('0xb')](function(_0x2f2c4b){logger[_0x1954('0xc')](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));logger[_0x1954('0xf')](_0x1954('0x10'),_0x30beea,_0x1954('0xe'),JSON['stringify'](_0x2f2c4b));if(_0x2f2c4b[_0x1954('0x11')]){if(_0x2f2c4b[_0x1954('0x11')]['code']===0x1f4){logger[_0x1954('0x11')]('SmsApplication,\x20%s,\x20%s',_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xa7a784(_0x2f2c4b['error']['message']);}logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x2f2c4b[_0x1954('0x11')]['message']);return _0xda7a2f(_0x2f2c4b[_0x1954('0x11')]['message']);}else{logger['info'](_0x1954('0xd'),_0x30beea,_0x1954('0xe'));_0xda7a2f(_0x2f2c4b[_0x1954('0x12')][_0x1954('0x13')]);}})[_0x1954('0x14')](function(_0x37f4fc){logger[_0x1954('0x11')](_0x1954('0xd'),_0x30beea,_0x37f4fc);_0xa7a784(_0x37f4fc);});});} \ No newline at end of file +var _0x65c9=['then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x65c9,0x182));var _0x965c=function(_0x6a4d85,_0x57e785){_0x6a4d85=_0x6a4d85-0x0;var _0x2908b4=_0x65c9[_0x6a4d85];return _0x2908b4;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var moment=require('moment');var BPromise=require(_0x965c('0x2'));var rs=require(_0x965c('0x3'));var fs=require('fs');var Redis=require(_0x965c('0x4'));var db=require(_0x965c('0x5'))['db'];var utils=require(_0x965c('0x6'));var logger=require(_0x965c('0x7'))(_0x965c('0x8'));var config=require(_0x965c('0x9'));var jayson=require(_0x965c('0xa'));var client=jayson[_0x965c('0xb')][_0x965c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x849260,_0x5ec702,_0xd19e57){return new BPromise(function(_0x263652,_0x41d248){return client[_0x965c('0xd')](_0x849260,_0xd19e57)[_0x965c('0xe')](function(_0x26d859){logger[_0x965c('0xf')]('SmsApplication,\x20%s,\x20%s',_0x5ec702,_0x965c('0x10'));logger[_0x965c('0x11')](_0x965c('0x12'),_0x5ec702,_0x965c('0x10'),JSON[_0x965c('0x13')](_0x26d859));if(_0x26d859[_0x965c('0x14')]){if(_0x26d859[_0x965c('0x14')][_0x965c('0x15')]===0x1f4){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x41d248(_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);}logger['error'](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x263652(_0x26d859['error'][_0x965c('0x17')]);}else{logger[_0x965c('0xf')](_0x965c('0x16'),_0x5ec702,'request\x20sent');_0x263652(_0x26d859[_0x965c('0x18')]['message']);}})['catch'](function(_0x542499){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x542499);_0x41d248(_0x542499);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 73745f5..8669f47 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 _0x9354=['/:id/messages','getMessages','download','create','post','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0xd2e988,_0x3c642e){var _0x2ccd3b=function(_0x217238){while(--_0x217238){_0xd2e988['push'](_0xd2e988['shift']());}};_0x2ccd3b(++_0x3c642e);}(_0x9354,0x96));var _0x4935=function(_0x25ede0,_0x29dc39){_0x25ede0=_0x25ede0-0x0;var _0x16fc37=_0x9354[_0x25ede0];return _0x16fc37;};'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('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x4935('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4935('0x12')]);router[_0x4935('0x13')](_0x4935('0xf'),auth[_0x4935('0x9')](),controller[_0x4935('0x14')]);router[_0x4935('0x13')](_0x4935('0x15'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')](_0x4935('0x17'),_0x4935('0x18')),controller[_0x4935('0x19')]);router[_0x4935('0x1a')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1b')),controller[_0x4935('0x1c')]);router[_0x4935('0x1d')](_0x4935('0xd'),auth[_0x4935('0x9')](),interaction[_0x4935('0x16')]('sms',_0x4935('0x1e')),controller[_0x4935('0x1f')]);router['delete'](_0x4935('0x15'),auth[_0x4935('0x9')](),controller[_0x4935('0x20')]);module['exports']=router; \ No newline at end of file +var _0xdd4f=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','sms','addTags','put','tracked','delete','smsinteraction:destroy','destroy','removeTags','exports','multer','express'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x3c5aab,_0xba5d29){_0x3c5aab=_0x3c5aab-0x0;var _0x2e7580=_0xdd4f[_0x3c5aab];return _0x2e7580;};'use strict';var multer=require(_0xfdd4('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfdd4('0x1'));var router=express[_0xfdd4('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xfdd4('0x3'));var interaction=require(_0xfdd4('0x4'));var config=require(_0xfdd4('0x5'));var controller=require('./smsInteraction.controller');router[_0xfdd4('0x6')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x8')]);router[_0xfdd4('0x6')](_0xfdd4('0x9'),auth['isAuthenticated'](),controller[_0xfdd4('0xa')]);router['get'](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0xc')]);router['get'](_0xfdd4('0xd'),auth['isAuthenticated'](),controller[_0xfdd4('0xe')]);router[_0xfdd4('0x6')](_0xfdd4('0xf'),auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x10')]);router[_0xfdd4('0x11')]('/',auth[_0xfdd4('0x7')](),controller[_0xfdd4('0x12')]);router[_0xfdd4('0x11')](_0xfdd4('0xd'),auth[_0xfdd4('0x7')](),controller['addMessage']);router[_0xfdd4('0x11')](_0xfdd4('0x13'),auth[_0xfdd4('0x7')](),interaction['tracked'](_0xfdd4('0x14'),'smsinteraction:addtags'),controller[_0xfdd4('0x15')]);router[_0xfdd4('0x16')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')]('sms','smsinteraction:update'),controller['update']);router[_0xfdd4('0x18')](_0xfdd4('0xb'),auth[_0xfdd4('0x7')](),interaction[_0xfdd4('0x17')](_0xfdd4('0x14'),_0xfdd4('0x19')),controller[_0xfdd4('0x1a')]);router[_0xfdd4('0x18')](_0xfdd4('0x13'),auth['isAuthenticated'](),controller[_0xfdd4('0x1b')]);module[_0xfdd4('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 fefde82..589700d 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 _0xde1e=['STRING','ENUM','out','INTEGER','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x49a6f3,_0x346c12){var _0x166e04=function(_0x2047c7){while(--_0x2047c7){_0x49a6f3['push'](_0x49a6f3['shift']());}};_0x166e04(++_0x346c12);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xede1('0x0'));var moment=require(_0xede1('0x1'));module[_0xede1('0x2')]={'closed':{'type':Sequelize[_0xede1('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xede1('0x4')]},'disposition':{'type':Sequelize[_0xede1('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xede1('0x5')]},'note':{'type':Sequelize[_0xede1('0x5')]},'phone':{'type':Sequelize[_0xede1('0x5')]},'read1stAt':{'type':Sequelize[_0xede1('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xede1('0x6')]('in',_0xede1('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xede1('0x6')]('in',_0xede1('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xede1('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xede1('0x8')]}}; \ No newline at end of file +var _0x7d06=['sequelize','moment','exports','BOOLEAN','DATE','STRING','out','ENUM'];(function(_0x582494,_0x28f40a){var _0x294df3=function(_0x4993db){while(--_0x4993db){_0x582494['push'](_0x582494['shift']());}};_0x294df3(++_0x28f40a);}(_0x7d06,0x158));var _0x67d0=function(_0x4e5d3d,_0x53ddf4){_0x4e5d3d=_0x4e5d3d-0x0;var _0x26e85c=_0x7d06[_0x4e5d3d];return _0x26e85c;};'use strict';var Sequelize=require(_0x67d0('0x0'));var moment=require(_0x67d0('0x1'));module[_0x67d0('0x2')]={'closed':{'type':Sequelize[_0x67d0('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x67d0('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x67d0('0x5')]},'thirdDisposition':{'type':Sequelize[_0x67d0('0x5')]},'note':{'type':Sequelize[_0x67d0('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x67d0('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x67d0('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x67d0('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x67d0('0x7')]('in',_0x67d0('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x67d0('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index c7060c6..2b61d7f 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 _0xd481=['SmsInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','omit','spread','Tag','findAll','color','emit','smsInteractionTags:save','download','unix','join','root','server','files','format','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','read','fullname','Owner','N.A.','closed','closedAt','toString','disposition','out','value','renderFile','views','downloadInteraction.ejs','.pdf','Sms','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','util','path','lodash','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','./smsInteraction.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','sms','query','catch','params','model','keys','SmsInteraction','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','describe','SmsMessage','ids','getMessages','findOne','nolimit','order','sort','where','pick'];(function(_0x1aebd7,_0x4618ff){var _0x2a238a=function(_0x6091ea){while(--_0x6091ea){_0x1aebd7['push'](_0x1aebd7['shift']());}};_0x2a238a(++_0x4618ff);}(_0xd481,0x197));var _0x1d48=function(_0x33cb6f,_0x5d7ad5){_0x33cb6f=_0x33cb6f-0x0;var _0x554831=_0xd481[_0x33cb6f];return _0x554831;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x1d48('0x0'));var moment=require(_0x1d48('0x1'));var BPromise=require('bluebird');var util=require(_0x1d48('0x2'));var path=require(_0x1d48('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x1d48('0x4'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0x1d48('0x5'));var logger=require(_0x1d48('0x6'))(_0x1d48('0x7'));var config=require(_0x1d48('0x8'));var db=require(_0x1d48('0x9'))['db'];config['redis']=_[_0x1d48('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1d48('0xb'))[_0x1d48('0xc')](socket);function respondWithStatusCode(_0x387bb2,_0x4d8a92){_0x4d8a92=_0x4d8a92||0xcc;return function(_0x3053aa){if(_0x3053aa){return _0x387bb2[_0x1d48('0xd')](_0x4d8a92);}return _0x387bb2['status'](_0x4d8a92)['end']();};}function respondWithResult(_0x76cfa4,_0x3ec3f5){_0x3ec3f5=_0x3ec3f5||0xc8;return function(_0x443105){if(_0x443105){return _0x76cfa4[_0x1d48('0xe')](_0x3ec3f5)[_0x1d48('0xf')](_0x443105);}};}function respondWithFilteredResult(_0x307736,_0x5d3d7d){return function(_0x46c4a7){if(_0x46c4a7){var _0x12a30e=typeof _0x5d3d7d['offset']===_0x1d48('0x10')&&typeof _0x5d3d7d[_0x1d48('0x11')]===_0x1d48('0x10');var _0x517dd5=_0x46c4a7[_0x1d48('0x12')];var _0x49fa1b=_0x12a30e?0x0:_0x5d3d7d[_0x1d48('0x13')];var _0x411b54=_0x12a30e?_0x46c4a7[_0x1d48('0x12')]:_0x5d3d7d['offset']+_0x5d3d7d[_0x1d48('0x11')];var _0x2598e2;if(_0x411b54>=_0x517dd5){_0x411b54=_0x517dd5;_0x2598e2=0xc8;}else{_0x2598e2=0xce;}_0x307736['status'](_0x2598e2);return _0x307736[_0x1d48('0x14')](_0x1d48('0x15'),_0x49fa1b+'-'+_0x411b54+'/'+_0x517dd5)[_0x1d48('0xf')](_0x46c4a7);}return null;};}function saveUpdates(_0x196d52){return function(_0x3d7e0b){if(_0x3d7e0b){return _0x3d7e0b[_0x1d48('0x16')](_0x196d52)[_0x1d48('0x17')](function(_0x51842b){return _0x51842b;});}return null;};}function removeEntity(_0x2a26a3){return function(_0x305e78){if(_0x305e78){return _0x305e78[_0x1d48('0x18')]()['then'](function(){_0x2a26a3[_0x1d48('0xe')](0xcc)[_0x1d48('0x19')]();});}};}function handleEntityNotFound(_0x27c7fc){return function(_0x242852){if(!_0x242852){_0x27c7fc[_0x1d48('0xd')](0x194);}return _0x242852;};}function handleError(_0x33b59e,_0x304ba7){_0x304ba7=_0x304ba7||0x1f4;return function(_0x54e5e4){logger[_0x1d48('0x1a')](_0x54e5e4[_0x1d48('0x1b')]);if(_0x54e5e4[_0x1d48('0x1c')]){delete _0x54e5e4['name'];}_0x33b59e[_0x1d48('0xe')](_0x304ba7)[_0x1d48('0x1d')](_0x54e5e4);};}exports[_0x1d48('0x1e')]=function(_0x293fd4,_0x181fa){var _0x291ddf={};var _0x27b38a=_[_0x1d48('0x1f')](db['SmsInteraction'][_0x1d48('0x20')],function(_0x36edf4){return{'name':_0x36edf4[_0x1d48('0x21')],'type':_0x36edf4[_0x1d48('0x22')][_0x1d48('0x23')]};});_0x291ddf=qs[_0x1d48('0x24')](_0x27b38a,_0x293fd4);return interaction['findAll'](_0x1d48('0x25'),_0x293fd4[_0x1d48('0x26')],_0x293fd4['user'],_0x291ddf,_0x27b38a)['then'](respondWithFilteredResult(_0x181fa,_0x291ddf))[_0x1d48('0x27')](handleError(_0x181fa,null));};exports['show']=function(_0x3d71f1,_0x338904){var _0x5ccd3a={'raw':![],'where':{'id':_0x3d71f1[_0x1d48('0x28')]['id']}},_0x2f0448={};_0x2f0448[_0x1d48('0x29')]=_[_0x1d48('0x2a')](db[_0x1d48('0x2b')]['rawAttributes']);_0x2f0448['query']=_['keys'](_0x3d71f1['query']);_0x2f0448[_0x1d48('0x2c')]=_[_0x1d48('0x2d')](_0x2f0448[_0x1d48('0x29')],_0x2f0448['query']);_0x5ccd3a[_0x1d48('0x2e')]=_[_0x1d48('0x2d')](_0x2f0448[_0x1d48('0x29')],qs['fields'](_0x3d71f1[_0x1d48('0x26')][_0x1d48('0x2f')]));_0x5ccd3a['attributes']=_0x5ccd3a[_0x1d48('0x2e')][_0x1d48('0x30')]?_0x5ccd3a[_0x1d48('0x2e')]:_0x2f0448[_0x1d48('0x29')];if(_0x3d71f1[_0x1d48('0x26')][_0x1d48('0x31')]){_0x5ccd3a[_0x1d48('0x32')]=[{'all':!![]}];}_0x5ccd3a=_['merge']({},_0x5ccd3a,_0x3d71f1[_0x1d48('0x33')]);return db[_0x1d48('0x2b')][_0x1d48('0x34')](_0x5ccd3a)[_0x1d48('0x17')](handleEntityNotFound(_0x338904,null))[_0x1d48('0x17')](respondWithResult(_0x338904,null))[_0x1d48('0x27')](handleError(_0x338904,null));};exports[_0x1d48('0x35')]=function(_0x3a07b4,_0x33c5c7){return db['SmsInteraction'][_0x1d48('0x35')](_0x3a07b4[_0x1d48('0x36')],{})['then'](respondWithResult(_0x33c5c7,0xc9))[_0x1d48('0x27')](handleError(_0x33c5c7,null));};exports[_0x1d48('0x16')]=function(_0x17ce13,_0x13f24d){if(_0x17ce13[_0x1d48('0x36')]['id']){delete _0x17ce13[_0x1d48('0x36')]['id'];}return db[_0x1d48('0x2b')][_0x1d48('0x34')]({'where':{'id':_0x17ce13[_0x1d48('0x28')]['id']}})['then'](handleEntityNotFound(_0x13f24d,null))[_0x1d48('0x17')](saveUpdates(_0x17ce13[_0x1d48('0x36')],null))[_0x1d48('0x17')](respondWithResult(_0x13f24d,null))[_0x1d48('0x27')](handleError(_0x13f24d,null));};exports[_0x1d48('0x18')]=function(_0x55aa0c,_0x4dd352){return db[_0x1d48('0x2b')][_0x1d48('0x34')]({'where':{'id':_0x55aa0c['params']['id']}})['then'](handleEntityNotFound(_0x4dd352,null))['then'](removeEntity(_0x4dd352,null))[_0x1d48('0x27')](handleError(_0x4dd352,null));};exports['describe']=function(_0x16b160,_0x122382){return db['SmsInteraction'][_0x1d48('0x37')]()[_0x1d48('0x17')](respondWithResult(_0x122382,null))[_0x1d48('0x27')](handleError(_0x122382,null));};exports['addMessage']=function(_0x29d67f,_0x47d52a){return db[_0x1d48('0x38')]['find']({'where':{'id':_0x29d67f[_0x1d48('0x28')]['id']}})['then'](handleEntityNotFound(_0x47d52a,null))[_0x1d48('0x17')](function(_0x61104d){if(_0x61104d){return _0x61104d['addMessage'](_0x29d67f[_0x1d48('0x36')]['ids'],_['omit'](_0x29d67f['body'],[_0x1d48('0x39'),'id'])||{});}})[_0x1d48('0x17')](respondWithResult(_0x47d52a,null))[_0x1d48('0x27')](handleError(_0x47d52a,null));};exports[_0x1d48('0x3a')]=function(_0x2a62cd,_0x5d8ce9){var _0x11f15c={'raw':![],'where':{}};var _0x165c15={};var _0x2c59e5={'count':0x0,'rows':[]};return db['SmsInteraction'][_0x1d48('0x3b')]({'where':{'id':_0x2a62cd[_0x1d48('0x28')]['id']}})[_0x1d48('0x17')](handleEntityNotFound(_0x5d8ce9,null))[_0x1d48('0x17')](function(_0x12cec7){if(_0x12cec7){_0x165c15['model']=_['keys'](db[_0x1d48('0x38')]['rawAttributes']);_0x165c15['query']=_[_0x1d48('0x2a')](_0x2a62cd[_0x1d48('0x26')]);_0x165c15[_0x1d48('0x2c')]=_[_0x1d48('0x2d')](_0x165c15[_0x1d48('0x29')],_0x165c15[_0x1d48('0x26')]);_0x11f15c[_0x1d48('0x2e')]=_[_0x1d48('0x2d')](_0x165c15['model'],qs['fields'](_0x2a62cd['query']['fields']));_0x11f15c['attributes']=_0x11f15c['attributes'][_0x1d48('0x30')]?_0x11f15c[_0x1d48('0x2e')]:_0x165c15[_0x1d48('0x29')];if(!_0x2a62cd['query']['hasOwnProperty'](_0x1d48('0x3c'))){_0x11f15c['limit']=qs[_0x1d48('0x11')](_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x11')]);_0x11f15c[_0x1d48('0x13')]=qs[_0x1d48('0x13')](_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x13')]);}_0x11f15c[_0x1d48('0x3d')]=qs['sort'](_0x2a62cd['query'][_0x1d48('0x3e')]);_0x11f15c[_0x1d48('0x3f')]=qs[_0x1d48('0x2c')](_[_0x1d48('0x40')](_0x2a62cd[_0x1d48('0x26')],_0x165c15[_0x1d48('0x2c')]));_0x11f15c['where'][_0x1d48('0x41')]=_0x12cec7['id'];if(_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x42')]){_0x11f15c[_0x1d48('0x3f')]=_[_0x1d48('0x43')](_0x11f15c[_0x1d48('0x3f')],{'$or':_[_0x1d48('0x1f')](_0x11f15c['attributes'],function(_0x5db571){var _0x51ede5={};_0x51ede5[_0x5db571]={'$like':'%'+_0x2a62cd['query'][_0x1d48('0x42')]+'%'};return _0x51ede5;})});}if(_0x2a62cd[_0x1d48('0x26')]['$gte']){var _0x43dbca=_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x44')][_0x1d48('0x45')](',');var _0x129d74={};_0x129d74[_0x43dbca[0x0]]={'$gte':moment(_0x43dbca[0x1])['format'](_0x1d48('0x46'))};_0x11f15c[_0x1d48('0x3f')]=_[_0x1d48('0x43')](_0x11f15c[_0x1d48('0x3f')],_0x129d74);}_0x11f15c=_[_0x1d48('0x43')]({},_0x11f15c,_0x2a62cd[_0x1d48('0x33')]);return db[_0x1d48('0x38')][_0x1d48('0x12')]({'where':_0x11f15c[_0x1d48('0x3f')]})['then'](function(_0x144773){_0x2c59e5[_0x1d48('0x12')]=_0x144773;if(_0x2a62cd[_0x1d48('0x26')][_0x1d48('0x31')]){_0x11f15c[_0x1d48('0x32')]=[{'all':!![]}];}return db[_0x1d48('0x38')]['findAll'](_0x11f15c);})['then'](function(_0x4931bb){_0x2c59e5[_0x1d48('0x47')]=_0x4931bb;return _0x2c59e5;});}})[_0x1d48('0x17')](respondWithFilteredResult(_0x5d8ce9,_0x11f15c))[_0x1d48('0x27')](handleError(_0x5d8ce9,null));};exports[_0x1d48('0x48')]=function(_0x3eaa99,_0xdfcecc){return db['SmsInteraction']['find']({'where':{'id':_0x3eaa99[_0x1d48('0x28')]['id']}})[_0x1d48('0x17')](handleEntityNotFound(_0xdfcecc,null))[_0x1d48('0x17')](function(_0x186858){if(_0x186858){return _0x186858[_0x1d48('0x49')](_0x3eaa99['body'][_0x1d48('0x39')],_[_0x1d48('0x4a')](_0x3eaa99[_0x1d48('0x36')],['ids','id'])||{})[_0x1d48('0x4b')](function(){return db[_0x1d48('0x4c')][_0x1d48('0x4d')]({'attributes':['id',_0x1d48('0x1c'),_0x1d48('0x4e')],'where':{'id':_0x3eaa99[_0x1d48('0x36')][_0x1d48('0x39')]}});})['then'](function(_0x2813f3){socket[_0x1d48('0x4f')](_0x1d48('0x50'),{'id':Number(_0x3eaa99[_0x1d48('0x28')]['id']),'tags':_0x2813f3||[]});return{'id':Number(_0x3eaa99['params']['id']),'tags':_0x2813f3||[]};});}})[_0x1d48('0x17')](respondWithResult(_0xdfcecc,null))[_0x1d48('0x27')](handleError(_0xdfcecc,null));};exports['removeTags']=function(_0xbda1f7,_0x13952b){return db[_0x1d48('0x2b')][_0x1d48('0x34')]({'where':{'id':_0xbda1f7[_0x1d48('0x28')]['id']}})[_0x1d48('0x17')](handleEntityNotFound(_0x13952b,null))[_0x1d48('0x17')](function(_0x5ec9e2){if(_0x5ec9e2){return _0x5ec9e2['removeTags'](_0xbda1f7[_0x1d48('0x26')][_0x1d48('0x39')]);}})['then'](respondWithStatusCode(_0x13952b,null))[_0x1d48('0x27')](handleError(_0x13952b,null));};exports[_0x1d48('0x51')]=function(_0x128adc,_0x45c754){var _0x4c7452=moment()[_0x1d48('0x52')]()['toString']();var _0x33e00d=path[_0x1d48('0x53')](config[_0x1d48('0x54')],_0x1d48('0x55'),_0x1d48('0x56'),'tmp');var _0x476aa8=path[_0x1d48('0x53')](_0x33e00d,_0x4c7452);var _0xf12fc0=util[_0x1d48('0x57')](_0x1d48('0x58'),_0x128adc['params']['id'],_0x4c7452);var _0x361884=path[_0x1d48('0x53')](_0x33e00d,_0xf12fc0);var _0x2ee32e=[];_0x2ee32e[_0x1d48('0x59')]({'model':db[_0x1d48('0x5a')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x2ee32e[_0x1d48('0x59')]({'model':db[_0x1d48('0x5b')],'as':_0x1d48('0x5c'),'attributes':['id',_0x1d48('0x5d'),_0x1d48('0x5e')],'raw':!![]});var _0x383473=[{'model':db[_0x1d48('0x38')],'as':_0x1d48('0x5f'),'attributes':['id','body',_0x1d48('0x60'),_0x1d48('0x61'),_0x1d48('0x62'),_0x1d48('0x63')],'include':_0x2ee32e}];_0x383473['push']({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x1d48('0x1c')]});_0x383473['push']({'model':db[_0x1d48('0x5a')],'as':'Owner','attributes':['id',_0x1d48('0x64')]});return db['SmsInteraction'][_0x1d48('0x34')]({'where':{'id':_0x128adc[_0x1d48('0x28')]['id']},'include':_0x383473})[_0x1d48('0x17')](handleEntityNotFound(_0x45c754,null))[_0x1d48('0x17')](function(_0x4c9eb2){if(_0x4c9eb2){var _0x58fce0=_0x4c9eb2['get']({'plain':!![]});fs['mkdirSync'](_0x476aa8);var _0x9bd4a4={'channel':'Sms','account':_0x58fce0['Account']['name'],'agent':_0x58fce0[_0x1d48('0x65')]?_0x58fce0[_0x1d48('0x65')]['fullname']:_0x1d48('0x66'),'createdAt':moment(_0x58fce0[_0x1d48('0x60')])[_0x1d48('0x57')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x58fce0[_0x1d48('0x67')]?moment(_0x58fce0[_0x1d48('0x68')])['format'](_0x1d48('0x46'))[_0x1d48('0x69')]():'','disposition':_0x58fce0[_0x1d48('0x6a')],'messages':_(_0x58fce0[_0x1d48('0x5f')])['filter']({'secret':![]})[_0x1d48('0x1f')](function(_0x8eba81){return{'date':moment(_0x8eba81[_0x1d48('0x60')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x1d48('0x69')](),'sender':_0x8eba81[_0x1d48('0x61')]===_0x1d48('0x6b')?_0x8eba81['User']?_0x8eba81[_0x1d48('0x5a')][_0x1d48('0x64')]:'System':_0x8eba81[_0x1d48('0x5c')]['firstName']+(_0x8eba81[_0x1d48('0x5c')]['lastName']?'\x20'+_0x8eba81['Contact'][_0x1d48('0x5e')]:''),'body':_0x8eba81['body'],'direction':_0x8eba81[_0x1d48('0x61')]===_0x1d48('0x6b')?'A':'C','secret':_0x8eba81['secret'],'read':_0x8eba81[_0x1d48('0x63')]};})[_0x1d48('0x6c')]()};return ejs[_0x1d48('0x6d')](path[_0x1d48('0x53')](config[_0x1d48('0x54')],'server',_0x1d48('0x6e'),_0x1d48('0x6f')),{'interaction':_0x9bd4a4})[_0x1d48('0x17')](function(_0x4582ad){var _0x5b3704=path[_0x1d48('0x53')](_0x476aa8,'transcript-'+_0x58fce0['id']+'-'+_0x4c7452+_0x1d48('0x70'));var _0x567e18={'path':_0x5b3704,'channel':_0x1d48('0x71'),'interactionId':_0x58fce0['id']};return pdf[_0x1d48('0x72')](_0x4582ad,_0x567e18);})[_0x1d48('0x17')](function(){return new BPromise(function(_0x5cbdea,_0x326c08){zipdir(_0x476aa8,{'saveTo':_0x361884},function(_0x88de1b,_0x58ca0a){if(_0x88de1b)return _0x326c08(_0x88de1b);return _0x5cbdea(_0x58ca0a);});})[_0x1d48('0x17')](function(){return new BPromise(function(_0x333abc,_0x40ff5d){rimraf(_0x476aa8,function(_0x3373c8){if(_0x3373c8)_0x40ff5d(_0x3373c8);return _0x333abc();});});})[_0x1d48('0x17')](function(){return _0x45c754[_0x1d48('0x51')](_0x361884,_0xf12fc0,function(_0x312398){if(_0x312398){console[_0x1d48('0x73')](_0x1d48('0x74'),_0x312398);}else{fs[_0x1d48('0x75')](_0x361884);}});});});}else{return _0x45c754[_0x1d48('0xd')](0xc8);}})[_0x1d48('0x27')](handleError(_0x45c754,null));}; \ No newline at end of file +var _0x6994=['set','Content-Range','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','findAll','query','catch','show','model','keys','SmsInteraction','filters','intersection','fields','attributes','includeAll','merge','options','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','SmsMessage','hasOwnProperty','sort','where','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','User','fullname','push','CmContact','firstName','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','N.A.','closedAt','disposition','Contact','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset'];(function(_0x2ebea3,_0x37a36e){var _0x46e1b5=function(_0x5bc377){while(--_0x5bc377){_0x2ebea3['push'](_0x2ebea3['shift']());}};_0x46e1b5(++_0x37a36e);}(_0x6994,0x14c));var _0x4699=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x6994[_0x35da42];return _0x370035;};'use strict';var rimraf=require(_0x4699('0x0'));var zipdir=require(_0x4699('0x1'));var moment=require(_0x4699('0x2'));var BPromise=require(_0x4699('0x3'));var util=require(_0x4699('0x4'));var path=require(_0x4699('0x5'));var ejs=require(_0x4699('0x6'));var fs=require('fs');var _=require(_0x4699('0x7'));var Redis=require(_0x4699('0x8'));var interaction=require(_0x4699('0x9'));var qs=require(_0x4699('0xa'));var pdf=require(_0x4699('0xb'));var logger=require(_0x4699('0xc'))(_0x4699('0xd'));var config=require(_0x4699('0xe'));var db=require(_0x4699('0xf'))['db'];config[_0x4699('0x10')]=_['defaults'](config[_0x4699('0x10')],{'host':_0x4699('0x11'),'port':0x18eb});var socket=require(_0x4699('0x12'))(new Redis(config['redis']));require(_0x4699('0x13'))['register'](socket);function respondWithStatusCode(_0x59891d,_0x3cc417){_0x3cc417=_0x3cc417||0xcc;return function(_0x5dbc75){if(_0x5dbc75){return _0x59891d[_0x4699('0x14')](_0x3cc417);}return _0x59891d[_0x4699('0x15')](_0x3cc417)[_0x4699('0x16')]();};}function respondWithResult(_0x2d749e,_0x243d3b){_0x243d3b=_0x243d3b||0xc8;return function(_0x211b0a){if(_0x211b0a){return _0x2d749e['status'](_0x243d3b)[_0x4699('0x17')](_0x211b0a);}};}function respondWithFilteredResult(_0x148159,_0x182fb7){return function(_0x24ead9){if(_0x24ead9){var _0x56999f=typeof _0x182fb7['offset']===_0x4699('0x18')&&typeof _0x182fb7[_0x4699('0x19')]===_0x4699('0x18');var _0x4d6fd7=_0x24ead9[_0x4699('0x1a')];var _0x5371f0=_0x56999f?0x0:_0x182fb7[_0x4699('0x1b')];var _0x46ddfc=_0x56999f?_0x24ead9[_0x4699('0x1a')]:_0x182fb7[_0x4699('0x1b')]+_0x182fb7[_0x4699('0x19')];var _0xe61830;if(_0x46ddfc>=_0x4d6fd7){_0x46ddfc=_0x4d6fd7;_0xe61830=0xc8;}else{_0xe61830=0xce;}_0x148159[_0x4699('0x15')](_0xe61830);return _0x148159[_0x4699('0x1c')](_0x4699('0x1d'),_0x5371f0+'-'+_0x46ddfc+'/'+_0x4d6fd7)[_0x4699('0x17')](_0x24ead9);}return null;};}function saveUpdates(_0x221a62){return function(_0x11afa4){if(_0x11afa4){return _0x11afa4[_0x4699('0x1e')](_0x221a62)[_0x4699('0x1f')](function(_0x28691a){return _0x28691a;});}return null;};}function removeEntity(_0x1fdfc2){return function(_0x2011dc){if(_0x2011dc){return _0x2011dc[_0x4699('0x20')]()[_0x4699('0x1f')](function(){_0x1fdfc2[_0x4699('0x15')](0xcc)[_0x4699('0x16')]();});}};}function handleEntityNotFound(_0x4c83a8){return function(_0xebe3f9){if(!_0xebe3f9){_0x4c83a8[_0x4699('0x14')](0x194);}return _0xebe3f9;};}function handleError(_0x518574,_0x435399){_0x435399=_0x435399||0x1f4;return function(_0x27e45e){logger['error'](_0x27e45e[_0x4699('0x21')]);if(_0x27e45e['name']){delete _0x27e45e[_0x4699('0x22')];}_0x518574[_0x4699('0x15')](_0x435399)['send'](_0x27e45e);};}exports[_0x4699('0x23')]=function(_0x3f2941,_0x1d1907){var _0x1b79c6={};var _0x6d7b5c=_[_0x4699('0x24')](db['SmsInteraction'][_0x4699('0x25')],function(_0x2e2a9a){return{'name':_0x2e2a9a[_0x4699('0x26')],'type':_0x2e2a9a[_0x4699('0x27')][_0x4699('0x28')]};});_0x1b79c6=qs['getOptions'](_0x6d7b5c,_0x3f2941);return interaction[_0x4699('0x29')]('sms',_0x3f2941[_0x4699('0x2a')],_0x3f2941['user'],_0x1b79c6,_0x6d7b5c)[_0x4699('0x1f')](respondWithFilteredResult(_0x1d1907,_0x1b79c6))[_0x4699('0x2b')](handleError(_0x1d1907,null));};exports[_0x4699('0x2c')]=function(_0x29c4f2,_0x2cad11){var _0x476645={'raw':![],'where':{'id':_0x29c4f2['params']['id']}},_0x30e2a4={};_0x30e2a4[_0x4699('0x2d')]=_[_0x4699('0x2e')](db[_0x4699('0x2f')][_0x4699('0x25')]);_0x30e2a4['query']=_[_0x4699('0x2e')](_0x29c4f2[_0x4699('0x2a')]);_0x30e2a4[_0x4699('0x30')]=_[_0x4699('0x31')](_0x30e2a4[_0x4699('0x2d')],_0x30e2a4[_0x4699('0x2a')]);_0x476645['attributes']=_[_0x4699('0x31')](_0x30e2a4[_0x4699('0x2d')],qs[_0x4699('0x32')](_0x29c4f2[_0x4699('0x2a')][_0x4699('0x32')]));_0x476645['attributes']=_0x476645[_0x4699('0x33')]['length']?_0x476645[_0x4699('0x33')]:_0x30e2a4['model'];if(_0x29c4f2[_0x4699('0x2a')][_0x4699('0x34')]){_0x476645['include']=[{'all':!![]}];}_0x476645=_[_0x4699('0x35')]({},_0x476645,_0x29c4f2[_0x4699('0x36')]);return db['SmsInteraction'][_0x4699('0x37')](_0x476645)[_0x4699('0x1f')](handleEntityNotFound(_0x2cad11,null))[_0x4699('0x1f')](respondWithResult(_0x2cad11,null))[_0x4699('0x2b')](handleError(_0x2cad11,null));};exports[_0x4699('0x38')]=function(_0x241421,_0x30c73e){return db[_0x4699('0x2f')][_0x4699('0x38')](_0x241421[_0x4699('0x39')],{})[_0x4699('0x1f')](respondWithResult(_0x30c73e,0xc9))['catch'](handleError(_0x30c73e,null));};exports['update']=function(_0x55b512,_0x187517){if(_0x55b512[_0x4699('0x39')]['id']){delete _0x55b512[_0x4699('0x39')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x55b512[_0x4699('0x3a')]['id']}})[_0x4699('0x1f')](handleEntityNotFound(_0x187517,null))[_0x4699('0x1f')](saveUpdates(_0x55b512[_0x4699('0x39')],null))[_0x4699('0x1f')](respondWithResult(_0x187517,null))[_0x4699('0x2b')](handleError(_0x187517,null));};exports[_0x4699('0x20')]=function(_0x32ac17,_0x464425){return db['SmsInteraction'][_0x4699('0x37')]({'where':{'id':_0x32ac17[_0x4699('0x3a')]['id']}})[_0x4699('0x1f')](handleEntityNotFound(_0x464425,null))[_0x4699('0x1f')](removeEntity(_0x464425,null))['catch'](handleError(_0x464425,null));};exports[_0x4699('0x3b')]=function(_0x2895f9,_0x348376){return db[_0x4699('0x2f')][_0x4699('0x3b')]()['then'](respondWithResult(_0x348376,null))[_0x4699('0x2b')](handleError(_0x348376,null));};exports['addMessage']=function(_0x5751c7,_0x2cb2a6){return db['SmsMessage'][_0x4699('0x37')]({'where':{'id':_0x5751c7[_0x4699('0x3a')]['id']}})[_0x4699('0x1f')](handleEntityNotFound(_0x2cb2a6,null))['then'](function(_0x30a71b){if(_0x30a71b){return _0x30a71b[_0x4699('0x3c')](_0x5751c7[_0x4699('0x39')][_0x4699('0x3d')],_[_0x4699('0x3e')](_0x5751c7[_0x4699('0x39')],['ids','id'])||{});}})['then'](respondWithResult(_0x2cb2a6,null))[_0x4699('0x2b')](handleError(_0x2cb2a6,null));};exports[_0x4699('0x3f')]=function(_0x5d48a7,_0x2f75bb){var _0x28f86c={'raw':![],'where':{}};var _0x47a918={};var _0x92f5cb={'count':0x0,'rows':[]};return db[_0x4699('0x2f')][_0x4699('0x40')]({'where':{'id':_0x5d48a7[_0x4699('0x3a')]['id']}})[_0x4699('0x1f')](handleEntityNotFound(_0x2f75bb,null))[_0x4699('0x1f')](function(_0x29ef14){if(_0x29ef14){_0x47a918[_0x4699('0x2d')]=_[_0x4699('0x2e')](db[_0x4699('0x41')][_0x4699('0x25')]);_0x47a918[_0x4699('0x2a')]=_[_0x4699('0x2e')](_0x5d48a7[_0x4699('0x2a')]);_0x47a918[_0x4699('0x30')]=_[_0x4699('0x31')](_0x47a918[_0x4699('0x2d')],_0x47a918[_0x4699('0x2a')]);_0x28f86c['attributes']=_[_0x4699('0x31')](_0x47a918[_0x4699('0x2d')],qs['fields'](_0x5d48a7[_0x4699('0x2a')][_0x4699('0x32')]));_0x28f86c[_0x4699('0x33')]=_0x28f86c[_0x4699('0x33')]['length']?_0x28f86c['attributes']:_0x47a918['model'];if(!_0x5d48a7['query'][_0x4699('0x42')]('nolimit')){_0x28f86c[_0x4699('0x19')]=qs[_0x4699('0x19')](_0x5d48a7['query'][_0x4699('0x19')]);_0x28f86c[_0x4699('0x1b')]=qs[_0x4699('0x1b')](_0x5d48a7['query'][_0x4699('0x1b')]);}_0x28f86c['order']=qs[_0x4699('0x43')](_0x5d48a7[_0x4699('0x2a')][_0x4699('0x43')]);_0x28f86c['where']=qs[_0x4699('0x30')](_['pick'](_0x5d48a7[_0x4699('0x2a')],_0x47a918[_0x4699('0x30')]));_0x28f86c[_0x4699('0x44')][_0x4699('0x45')]=_0x29ef14['id'];if(_0x5d48a7['query']['filter']){_0x28f86c[_0x4699('0x44')]=_['merge'](_0x28f86c[_0x4699('0x44')],{'$or':_[_0x4699('0x24')](_0x28f86c[_0x4699('0x33')],function(_0x3e6bf5){var _0x9ecc9a={};_0x9ecc9a[_0x3e6bf5]={'$like':'%'+_0x5d48a7[_0x4699('0x2a')][_0x4699('0x46')]+'%'};return _0x9ecc9a;})});}if(_0x5d48a7[_0x4699('0x2a')][_0x4699('0x47')]){var _0x2b059c=_0x5d48a7[_0x4699('0x2a')][_0x4699('0x47')][_0x4699('0x48')](',');var _0x138a4b={};_0x138a4b[_0x2b059c[0x0]]={'$gte':moment(_0x2b059c[0x1])[_0x4699('0x49')](_0x4699('0x4a'))};_0x28f86c[_0x4699('0x44')]=_[_0x4699('0x35')](_0x28f86c[_0x4699('0x44')],_0x138a4b);}_0x28f86c=_[_0x4699('0x35')]({},_0x28f86c,_0x5d48a7[_0x4699('0x36')]);return db[_0x4699('0x41')][_0x4699('0x1a')]({'where':_0x28f86c[_0x4699('0x44')]})[_0x4699('0x1f')](function(_0x26d561){_0x92f5cb[_0x4699('0x1a')]=_0x26d561;if(_0x5d48a7[_0x4699('0x2a')][_0x4699('0x34')]){_0x28f86c['include']=[{'all':!![]}];}return db[_0x4699('0x41')][_0x4699('0x29')](_0x28f86c);})['then'](function(_0x2489dc){_0x92f5cb[_0x4699('0x4b')]=_0x2489dc;return _0x92f5cb;});}})[_0x4699('0x1f')](respondWithFilteredResult(_0x2f75bb,_0x28f86c))[_0x4699('0x2b')](handleError(_0x2f75bb,null));};exports[_0x4699('0x4c')]=function(_0x433d48,_0x39ecf1){return db['SmsInteraction'][_0x4699('0x37')]({'where':{'id':_0x433d48[_0x4699('0x3a')]['id']}})['then'](handleEntityNotFound(_0x39ecf1,null))[_0x4699('0x1f')](function(_0x53ed01){if(_0x53ed01){return _0x53ed01[_0x4699('0x4d')](_0x433d48[_0x4699('0x39')][_0x4699('0x3d')],_['omit'](_0x433d48[_0x4699('0x39')],[_0x4699('0x3d'),'id'])||{})[_0x4699('0x4e')](function(){return db[_0x4699('0x4f')]['findAll']({'attributes':['id',_0x4699('0x22'),'color'],'where':{'id':_0x433d48['body'][_0x4699('0x3d')]}});})['then'](function(_0x499adc){socket['emit'](_0x4699('0x50'),{'id':Number(_0x433d48[_0x4699('0x3a')]['id']),'tags':_0x499adc||[]});return{'id':Number(_0x433d48[_0x4699('0x3a')]['id']),'tags':_0x499adc||[]};});}})['then'](respondWithResult(_0x39ecf1,null))['catch'](handleError(_0x39ecf1,null));};exports[_0x4699('0x51')]=function(_0x92c161,_0x25f578){return db[_0x4699('0x2f')][_0x4699('0x37')]({'where':{'id':_0x92c161['params']['id']}})[_0x4699('0x1f')](handleEntityNotFound(_0x25f578,null))[_0x4699('0x1f')](function(_0x3d06fe){if(_0x3d06fe){return _0x3d06fe[_0x4699('0x51')](_0x92c161[_0x4699('0x2a')][_0x4699('0x3d')]);}})[_0x4699('0x1f')](respondWithStatusCode(_0x25f578,null))[_0x4699('0x2b')](handleError(_0x25f578,null));};exports[_0x4699('0x52')]=function(_0x12914e,_0x49ef2e){var _0x1ec2c1=moment()[_0x4699('0x53')]()[_0x4699('0x54')]();var _0x53e0f9=path['join'](config[_0x4699('0x55')],_0x4699('0x56'),_0x4699('0x57'),_0x4699('0x58'));var _0x154f99=path[_0x4699('0x59')](_0x53e0f9,_0x1ec2c1);var _0x1a2628=util[_0x4699('0x49')]('transcript-%d-%s.zip',_0x12914e['params']['id'],_0x1ec2c1);var _0x4a452a=path[_0x4699('0x59')](_0x53e0f9,_0x1a2628);var _0x19eece=[];_0x19eece['push']({'model':db[_0x4699('0x5a')],'as':_0x4699('0x5a'),'attributes':['id',_0x4699('0x5b')],'raw':!![]});_0x19eece[_0x4699('0x5c')]({'model':db[_0x4699('0x5d')],'as':'Contact','attributes':['id',_0x4699('0x5e'),_0x4699('0x5f')],'raw':!![]});var _0x378b2c=[{'model':db['SmsMessage'],'as':_0x4699('0x60'),'attributes':['id',_0x4699('0x39'),_0x4699('0x61'),_0x4699('0x62'),_0x4699('0x63'),_0x4699('0x64')],'include':_0x19eece}];_0x378b2c['push']({'model':db[_0x4699('0x65')],'as':_0x4699('0x66'),'attributes':['id',_0x4699('0x22')]});_0x378b2c[_0x4699('0x5c')]({'model':db[_0x4699('0x5a')],'as':_0x4699('0x67'),'attributes':['id',_0x4699('0x5b')]});return db[_0x4699('0x2f')][_0x4699('0x37')]({'where':{'id':_0x12914e['params']['id']},'include':_0x378b2c})[_0x4699('0x1f')](handleEntityNotFound(_0x49ef2e,null))[_0x4699('0x1f')](function(_0x1d393e){if(_0x1d393e){var _0x5c28ee=_0x1d393e['get']({'plain':!![]});fs[_0x4699('0x68')](_0x154f99);var _0x29a1d9={'channel':'Sms','account':_0x5c28ee[_0x4699('0x66')][_0x4699('0x22')],'agent':_0x5c28ee[_0x4699('0x67')]?_0x5c28ee[_0x4699('0x67')][_0x4699('0x5b')]:_0x4699('0x69'),'createdAt':moment(_0x5c28ee[_0x4699('0x61')])[_0x4699('0x49')](_0x4699('0x4a'))['toString'](),'closedAt':_0x5c28ee['closed']?moment(_0x5c28ee[_0x4699('0x6a')])['format'](_0x4699('0x4a'))[_0x4699('0x54')]():'','disposition':_0x5c28ee[_0x4699('0x6b')],'messages':_(_0x5c28ee[_0x4699('0x60')])[_0x4699('0x46')]({'secret':![]})['map'](function(_0x4cdd3d){return{'date':moment(_0x4cdd3d[_0x4699('0x61')])['format'](_0x4699('0x4a'))[_0x4699('0x54')](),'sender':_0x4cdd3d[_0x4699('0x62')]==='out'?_0x4cdd3d[_0x4699('0x5a')]?_0x4cdd3d[_0x4699('0x5a')][_0x4699('0x5b')]:'System':_0x4cdd3d[_0x4699('0x6c')][_0x4699('0x5e')]+(_0x4cdd3d[_0x4699('0x6c')][_0x4699('0x5f')]?'\x20'+_0x4cdd3d[_0x4699('0x6c')][_0x4699('0x5f')]:''),'body':_0x4cdd3d[_0x4699('0x39')],'direction':_0x4cdd3d[_0x4699('0x62')]===_0x4699('0x6d')?'A':'C','secret':_0x4cdd3d['secret'],'read':_0x4cdd3d['read']};})[_0x4699('0x6e')]()};return ejs[_0x4699('0x6f')](path[_0x4699('0x59')](config['root'],'server',_0x4699('0x70'),_0x4699('0x71')),{'interaction':_0x29a1d9})[_0x4699('0x1f')](function(_0x34eec1){var _0x192661=path['join'](_0x154f99,_0x4699('0x72')+_0x5c28ee['id']+'-'+_0x1ec2c1+_0x4699('0x73'));var _0x400347={'path':_0x192661,'channel':'Sms','interactionId':_0x5c28ee['id']};return pdf[_0x4699('0x74')](_0x34eec1,_0x400347);})[_0x4699('0x1f')](function(){return new BPromise(function(_0x275758,_0x3d767e){zipdir(_0x154f99,{'saveTo':_0x4a452a},function(_0x2c6cbe,_0x5bb0f4){if(_0x2c6cbe)return _0x3d767e(_0x2c6cbe);return _0x275758(_0x5bb0f4);});})[_0x4699('0x1f')](function(){return new BPromise(function(_0x1b093f,_0xb7b51){rimraf(_0x154f99,function(_0xdf64df){if(_0xdf64df)_0xb7b51(_0xdf64df);return _0x1b093f();});});})[_0x4699('0x1f')](function(){return _0x49ef2e[_0x4699('0x52')](_0x4a452a,_0x1a2628,function(_0x4fd808){if(_0x4fd808){console[_0x4699('0x75')](_0x4699('0x76'),_0x4fd808);}else{fs[_0x4699('0x77')](_0x4a452a);}});});});}else{return _0x49ef2e[_0x4699('0x14')](0xc8);}})[_0x4699('0x2b')](handleError(_0x49ef2e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 7339478..b52c82b 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 _0x9f0e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update','remove','then','setDataValue','map','findAll'];(function(_0x342465,_0x3aa51b){var _0x4a4da7=function(_0x1047e1){while(--_0x1047e1){_0x342465['push'](_0x342465['shift']());}};_0x4a4da7(++_0x3aa51b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x268b6b,_0x22994a){_0x268b6b=_0x268b6b-0x0;var _0x3cd483=_0x9f0e[_0x268b6b];return _0x3cd483;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var SmsInteraction=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var SmsMessage=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9f0('0x4'),'afterDestroy':_0xe9f0('0x5')};function emitEvent(_0x3c589d){return function(_0x202d69,_0x1eed45,_0x50313d){_0x202d69['getUsers']({'attributes':['id'],'raw':!![]})[_0xe9f0('0x6')](function(_0x167198){_0x202d69[_0xe9f0('0x7')]('Users',_0x167198[_0xe9f0('0x8')](function(_0x335b82){return{'id':_0x335b82['id']};}));return SmsMessage[_0xe9f0('0x9')]({'where':{'SmsInteractionId':_0x202d69['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9f0('0x6')](function(_0xa523c0){_0x202d69[_0xe9f0('0x7')](_0xe9f0('0xa'),_0xa523c0[_0xe9f0('0xb')]);SmsInteractionEvents[_0xe9f0('0xc')](_0x3c589d+':'+_0x202d69['id'],_0x202d69);SmsInteractionEvents['emit'](_0x3c589d,_0x202d69);_0x50313d(null);})[_0xe9f0('0xd')](_0x50313d(null));};}for(var e in events){if(events[_0xe9f0('0xe')](e)){var event=events[e];SmsInteraction[_0xe9f0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x8aad=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','getUsers','then','setDataValue','Users','map','unreadMessages'];(function(_0x2b9c25,_0x23586e){var _0xdc109a=function(_0x38679a){while(--_0x38679a){_0x2b9c25['push'](_0x2b9c25['shift']());}};_0xdc109a(++_0x23586e);}(_0x8aad,0x146));var _0xd8aa=function(_0xd23470,_0x4827f9){_0xd23470=_0xd23470-0x0;var _0x1be2b5=_0x8aad[_0xd23470];return _0x1be2b5;};'use strict';var EventEmitter=require(_0xd8aa('0x0'));var SmsInteraction=require(_0xd8aa('0x1'))['db']['SmsInteraction'];var SmsMessage=require(_0xd8aa('0x1'))['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xd8aa('0x2')](0x0);var events={'afterCreate':_0xd8aa('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x401aef){return function(_0x59804a,_0x53248c,_0x16b648){_0x59804a[_0xd8aa('0x4')]({'attributes':['id'],'raw':!![]})[_0xd8aa('0x5')](function(_0x4a4b10){_0x59804a[_0xd8aa('0x6')](_0xd8aa('0x7'),_0x4a4b10[_0xd8aa('0x8')](function(_0x350171){return{'id':_0x350171['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x59804a['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x24f3f1){_0x59804a[_0xd8aa('0x6')](_0xd8aa('0x9'),_0x24f3f1[_0xd8aa('0xa')]);SmsInteractionEvents[_0xd8aa('0xb')](_0x401aef+':'+_0x59804a['id'],_0x59804a);SmsInteractionEvents['emit'](_0x401aef,_0x59804a);_0x16b648(null);})[_0xd8aa('0xc')](_0x16b648(null));};}for(var e in events){if(events[_0xd8aa('0xd')](e)){var event=events[e];SmsInteraction[_0xd8aa('0xe')](e,emitEvent(event));}}module[_0xd8aa('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 8fa1853..b396326 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 _0xe31c=['YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','changed','closed','format'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xe31c,0x1dd));var _0xce31=function(_0x5f2a55,_0x1c9e68){_0x5f2a55=_0x5f2a55-0x0;var _0x25fb9e=_0xe31c[_0x5f2a55];return _0x25fb9e;};'use strict';var _=require('lodash');var util=require(_0xce31('0x0'));var logger=require(_0xce31('0x1'))('api');var moment=require(_0xce31('0x2'));var BPromise=require('bluebird');var rp=require(_0xce31('0x3'));var fs=require('fs');var path=require(_0xce31('0x4'));var rimraf=require(_0xce31('0x5'));var config=require('../../config/environment');var attributes=require(_0xce31('0x6'));module[_0xce31('0x7')]=function(_0x3a2e9a,_0x2d23e6){return _0x3a2e9a[_0xce31('0x8')](_0xce31('0x9'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x8f429a,_0x1004ed,_0x2b8f84){if(_0x8f429a[_0xce31('0xa')](_0xce31('0xb'))){_0x8f429a['closedAt']=moment()[_0xce31('0xc')](_0xce31('0xd'));}_0x2b8f84(null,_0x8f429a);}}});}; \ No newline at end of file +var _0xb6b3=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','define','changed','closed','closedAt'];(function(_0x24b0b7,_0x48baf1){var _0x27632d=function(_0x4fe4f){while(--_0x4fe4f){_0x24b0b7['push'](_0x24b0b7['shift']());}};_0x27632d(++_0x48baf1);}(_0xb6b3,0xc5));var _0x3b6b=function(_0x3974d2,_0x13d92c){_0x3974d2=_0x3974d2-0x0;var _0x1ce777=_0xb6b3[_0x3974d2];return _0x1ce777;};'use strict';var _=require(_0x3b6b('0x0'));var util=require(_0x3b6b('0x1'));var logger=require(_0x3b6b('0x2'))('api');var moment=require(_0x3b6b('0x3'));var BPromise=require(_0x3b6b('0x4'));var rp=require(_0x3b6b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3b6b('0x6'));var config=require(_0x3b6b('0x7'));var attributes=require(_0x3b6b('0x8'));module['exports']=function(_0x20a720,_0xa59e34){return _0x20a720[_0x3b6b('0x9')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49c346,_0x1de929,_0x39a1d4){if(_0x49c346[_0x3b6b('0xa')](_0x3b6b('0xb'))){_0x49c346[_0x3b6b('0xc')]=moment()[_0x3b6b('0xd')](_0x3b6b('0xe'));}_0x39a1d4(null,_0x49c346);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 6c53e58..3a086d3 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 _0x9dfd=['error','code','message','SmsInteraction,\x20%s,\x20%s','result','catch','UpdateSmsInteraction','update','options','where','attributes','limit','AddTagsToSmsInteraction','find','addTags','body','omit','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9dfd,0x1cb));var _0xd9df=function(_0x5ecc2d,_0x1f94de){_0x5ecc2d=_0x5ecc2d-0x0;var _0x585a86=_0x9dfd[_0x5ecc2d];return _0x585a86;};'use strict';var _=require('lodash');var util=require(_0xd9df('0x0'));var moment=require(_0xd9df('0x1'));var BPromise=require('bluebird');var rs=require(_0xd9df('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9df('0x3'))['db'];var utils=require(_0xd9df('0x4'));var logger=require('../../config/logger')(_0xd9df('0x5'));var config=require(_0xd9df('0x6'));var jayson=require(_0xd9df('0x7'));var client=jayson[_0xd9df('0x8')][_0xd9df('0x9')]({'port':0x232a});config[_0xd9df('0xa')]=_[_0xd9df('0xb')](config[_0xd9df('0xa')],{'host':_0xd9df('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd9df('0xa')]));require('./smsInteraction.socket')[_0xd9df('0xd')](socket);function respondWithRpcPromise(_0x339eea,_0x503f90,_0x3aabe5){return new BPromise(function(_0x4b7a18,_0x8b81b4){return client[_0xd9df('0xe')](_0x339eea,_0x3aabe5)[_0xd9df('0xf')](function(_0x4a9760){logger[_0xd9df('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0xd9df('0x11'));logger[_0xd9df('0x12')](_0xd9df('0x13'),_0x503f90,_0xd9df('0x11'),JSON[_0xd9df('0x14')](_0x4a9760));if(_0x4a9760[_0xd9df('0x15')]){if(_0x4a9760[_0xd9df('0x15')][_0xd9df('0x16')]===0x1f4){logger[_0xd9df('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0x4a9760[_0xd9df('0x15')][_0xd9df('0x17')]);return _0x8b81b4(_0x4a9760['error'][_0xd9df('0x17')]);}logger[_0xd9df('0x15')]('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0x4a9760['error'][_0xd9df('0x17')]);return _0x4b7a18(_0x4a9760[_0xd9df('0x15')][_0xd9df('0x17')]);}else{logger[_0xd9df('0x10')](_0xd9df('0x18'),_0x503f90,_0xd9df('0x11'));_0x4b7a18(_0x4a9760[_0xd9df('0x19')][_0xd9df('0x17')]);}})[_0xd9df('0x1a')](function(_0x448648){logger['error']('SmsInteraction,\x20%s,\x20%s',_0x503f90,_0x448648);_0x8b81b4(_0x448648);});});}exports[_0xd9df('0x1b')]=function(_0x5ccbb4){var _0x32b311=this;return new Promise(function(_0x4a2217,_0x4505df){return db['SmsInteraction'][_0xd9df('0x1c')](_0x5ccbb4['body'],{'raw':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4[_0xd9df('0x1d')][_0xd9df('0x1e')]||null:null,'attributes':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4[_0xd9df('0x1d')][_0xd9df('0x1f')]||null:null,'limit':_0x5ccbb4[_0xd9df('0x1d')]?_0x5ccbb4[_0xd9df('0x1d')][_0xd9df('0x20')]||null:null})[_0xd9df('0xf')](function(_0x18fde8){logger[_0xd9df('0x10')](_0xd9df('0x1b'),_0x5ccbb4);logger[_0xd9df('0x12')](_0xd9df('0x1b'),_0x5ccbb4,JSON['stringify'](_0x18fde8));_0x4a2217(_0x18fde8);})[_0xd9df('0x1a')](function(_0x2ea7c4){logger[_0xd9df('0x15')](_0xd9df('0x1b'),_0x2ea7c4[_0xd9df('0x17')],_0x5ccbb4);_0x4505df(_0x32b311[_0xd9df('0x15')](0x1f4,_0x2ea7c4[_0xd9df('0x17')]));});});};exports[_0xd9df('0x21')]=function(_0x4a667b){return new Promise(function(_0x5e9263,_0x393141){return db['SmsInteraction'][_0xd9df('0x22')]({'where':_0x4a667b[_0xd9df('0x1d')]?_0x4a667b[_0xd9df('0x1d')]['where']||null:null})[_0xd9df('0xf')](function(_0x371fbe){if(_0x371fbe){return _0x371fbe[_0xd9df('0x23')](_0x4a667b[_0xd9df('0x24')]['ids'],_[_0xd9df('0x25')](_0x4a667b['body'],['ids','id'])||{});}})[_0xd9df('0x26')](function(_0x14b8b9){logger['info'](_0xd9df('0x27'),_0x4a667b);logger[_0xd9df('0x12')]('AddTags',_0x4a667b,JSON['stringify'](_0x14b8b9));_0x5e9263(_0x14b8b9);})[_0xd9df('0x1a')](function(_0x4d7573){logger[_0xd9df('0x15')](_0xd9df('0x27'),_0x4d7573[_0xd9df('0x17')],_0x4a667b);_0x393141(_this[_0xd9df('0x15')](0x1f4,_0x4d7573[_0xd9df('0x17')]));});});}; \ No newline at end of file +var _0xb61a=['http','defaults','localhost','socket.io-emitter','redis','./smsInteraction.socket','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','attributes','limit','AddTagsToSmsInteraction','addTags','ids','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x3406d2,_0x17338c){var _0x46f2ed=function(_0xf91007){while(--_0xf91007){_0x3406d2['push'](_0x3406d2['shift']());}};_0x46f2ed(++_0x17338c);}(_0xb61a,0xb2));var _0xab61=function(_0x593b14,_0x1e3b8c){_0x593b14=_0x593b14-0x0;var _0x125409=_0xb61a[_0x593b14];return _0x125409;};'use strict';var _=require('lodash');var util=require(_0xab61('0x0'));var moment=require(_0xab61('0x1'));var BPromise=require(_0xab61('0x2'));var rs=require(_0xab61('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab61('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xab61('0x5'))(_0xab61('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xab61('0x7')]({'port':0x232a});config['redis']=_[_0xab61('0x8')](config['redis'],{'host':_0xab61('0x9'),'port':0x18eb});var socket=require(_0xab61('0xa'))(new Redis(config[_0xab61('0xb')]));require(_0xab61('0xc'))['register'](socket);function respondWithRpcPromise(_0x18126f,_0x4c31d0,_0x2ab3f7){return new BPromise(function(_0x2b72d7,_0x2a4690){return client[_0xab61('0xd')](_0x18126f,_0x2ab3f7)[_0xab61('0xe')](function(_0x2f0595){logger['info'](_0xab61('0xf'),_0x4c31d0,_0xab61('0x10'));logger[_0xab61('0x11')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4c31d0,_0xab61('0x10'),JSON[_0xab61('0x12')](_0x2f0595));if(_0x2f0595[_0xab61('0x13')]){if(_0x2f0595[_0xab61('0x13')]['code']===0x1f4){logger['error'](_0xab61('0xf'),_0x4c31d0,_0x2f0595[_0xab61('0x13')][_0xab61('0x14')]);return _0x2a4690(_0x2f0595[_0xab61('0x13')][_0xab61('0x14')]);}logger[_0xab61('0x13')](_0xab61('0xf'),_0x4c31d0,_0x2f0595[_0xab61('0x13')]['message']);return _0x2b72d7(_0x2f0595[_0xab61('0x13')]['message']);}else{logger[_0xab61('0x15')](_0xab61('0xf'),_0x4c31d0,_0xab61('0x10'));_0x2b72d7(_0x2f0595[_0xab61('0x16')][_0xab61('0x14')]);}})[_0xab61('0x17')](function(_0x94cae0){logger[_0xab61('0x13')](_0xab61('0xf'),_0x4c31d0,_0x94cae0);_0x2a4690(_0x94cae0);});});}exports[_0xab61('0x18')]=function(_0x4cb1ae){var _0x11e320=this;return new Promise(function(_0x1edf3f,_0x2d4276){return db[_0xab61('0x19')][_0xab61('0x1a')](_0x4cb1ae[_0xab61('0x1b')],{'raw':_0x4cb1ae[_0xab61('0x1c')]?_0x4cb1ae['options'][_0xab61('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cb1ae[_0xab61('0x1c')]?_0x4cb1ae[_0xab61('0x1c')][_0xab61('0x1e')]||null:null,'attributes':_0x4cb1ae[_0xab61('0x1c')]?_0x4cb1ae['options'][_0xab61('0x1f')]||null:null,'limit':_0x4cb1ae[_0xab61('0x1c')]?_0x4cb1ae[_0xab61('0x1c')][_0xab61('0x20')]||null:null})[_0xab61('0xe')](function(_0x41c5be){logger['info'](_0xab61('0x18'),_0x4cb1ae);logger[_0xab61('0x11')](_0xab61('0x18'),_0x4cb1ae,JSON[_0xab61('0x12')](_0x41c5be));_0x1edf3f(_0x41c5be);})[_0xab61('0x17')](function(_0x4c9a3d){logger[_0xab61('0x13')]('UpdateSmsInteraction',_0x4c9a3d[_0xab61('0x14')],_0x4cb1ae);_0x2d4276(_0x11e320[_0xab61('0x13')](0x1f4,_0x4c9a3d['message']));});});};exports[_0xab61('0x21')]=function(_0x20a184){return new Promise(function(_0x424ef9,_0x3a223b){return db['SmsInteraction']['find']({'where':_0x20a184['options']?_0x20a184[_0xab61('0x1c')][_0xab61('0x1e')]||null:null})['then'](function(_0x387a5f){if(_0x387a5f){return _0x387a5f[_0xab61('0x22')](_0x20a184[_0xab61('0x1b')][_0xab61('0x23')],_['omit'](_0x20a184[_0xab61('0x1b')],['ids','id'])||{});}})['spread'](function(_0x49b179){logger['info'](_0xab61('0x24'),_0x20a184);logger[_0xab61('0x11')](_0xab61('0x24'),_0x20a184,JSON[_0xab61('0x12')](_0x49b179));_0x424ef9(_0x49b179);})[_0xab61('0x17')](function(_0x45b1ec){logger[_0xab61('0x13')](_0xab61('0x24'),_0x45b1ec[_0xab61('0x14')],_0x20a184);_0x3a223b(_this[_0xab61('0x13')](0x1f4,_0x45b1ec[_0xab61('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index e1402e0..c0e31b0 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 _0xe5ba=['save','remove','update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0xe5ba,0x167));var _0xae5b=function(_0x5c0f70,_0x5b700b){_0x5c0f70=_0x5c0f70-0x0;var _0x3fa4d0=_0xe5ba[_0x5c0f70];return _0x3fa4d0;};'use strict';var SmsInteractionEvents=require(_0xae5b('0x0'));var events=[_0xae5b('0x1'),_0xae5b('0x2'),_0xae5b('0x3')];function createListener(_0x2fb3d4,_0x5052c3){return function(_0x477207){_0x5052c3[_0xae5b('0x4')](_0x2fb3d4,_0x477207);};}function removeListener(_0x5ca46d,_0x2e6c84){return function(){SmsInteractionEvents[_0xae5b('0x5')](_0x5ca46d,_0x2e6c84);};}exports[_0xae5b('0x6')]=function(_0x1fdc4e){for(var _0x7acecf=0x0,_0x735671=events[_0xae5b('0x7')];_0x7acecf<_0x735671;_0x7acecf++){var _0x4dec60=events[_0x7acecf];var _0x55fb82=createListener(_0xae5b('0x8')+_0x4dec60,_0x1fdc4e);SmsInteractionEvents['on'](_0x4dec60,_0x55fb82);}}; \ No newline at end of file +var _0x51f4=['./smsInteraction.events','save','remove','update','emit','removeListener','register','length','smsInteraction:'];(function(_0x50dbb0,_0x2988da){var _0x11285c=function(_0x4e8d7d){while(--_0x4e8d7d){_0x50dbb0['push'](_0x50dbb0['shift']());}};_0x11285c(++_0x2988da);}(_0x51f4,0x120));var _0x451f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x51f4[_0x2641f9];return _0x585741;};'use strict';var SmsInteractionEvents=require(_0x451f('0x0'));var events=[_0x451f('0x1'),_0x451f('0x2'),_0x451f('0x3')];function createListener(_0x382231,_0x1d8e44){return function(_0x9475ce){_0x1d8e44[_0x451f('0x4')](_0x382231,_0x9475ce);};}function removeListener(_0x3a6d46,_0xc61670){return function(){SmsInteractionEvents[_0x451f('0x5')](_0x3a6d46,_0xc61670);};}exports[_0x451f('0x6')]=function(_0xbf427e){for(var _0x2df86a=0x0,_0x3939a8=events[_0x451f('0x7')];_0x2df86a<_0x3939a8;_0x2df86a++){var _0x4dbd6e=events[_0x2df86a];var _0x3efcf1=createListener(_0x451f('0x8')+_0x4dbd6e,_0xbf427e);SmsInteractionEvents['on'](_0x4dbd6e,_0x3efcf1);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index fb76b0e..8fc03b3 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 _0x6a5f=['tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/reject','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../config/environment','isAuthenticated','get','/describe','describe','/:id','show','post'];(function(_0x5b5c45,_0x199467){var _0x2cd0dd=function(_0x3f3266){while(--_0x3f3266){_0x5b5c45['push'](_0x5b5c45['shift']());}};_0x2cd0dd(++_0x199467);}(_0x6a5f,0xbb));var _0xf6a5=function(_0x32cc68,_0x5d2b21){_0x32cc68=_0x32cc68-0x0;var _0x472ab1=_0x6a5f[_0x32cc68];return _0x472ab1;};'use strict';var multer=require(_0xf6a5('0x0'));var util=require(_0xf6a5('0x1'));var path=require('path');var timeout=require(_0xf6a5('0x2'));var express=require(_0xf6a5('0x3'));var router=express['Router']();var fs_extra=require(_0xf6a5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf6a5('0x5'));var controller=require('./smsMessage.controller');router['get']('/',auth[_0xf6a5('0x6')](),controller['index']);router[_0xf6a5('0x7')](_0xf6a5('0x8'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0x9')]);router[_0xf6a5('0x7')](_0xf6a5('0xa'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0xb')]);router[_0xf6a5('0xc')]('/',auth['isAuthenticated'](),interaction[_0xf6a5('0xd')](_0xf6a5('0xe'),_0xf6a5('0xf')),controller[_0xf6a5('0x10')]);router[_0xf6a5('0xc')](_0xf6a5('0x11'),controller[_0xf6a5('0x12')]);router['put'](_0xf6a5('0xa'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0x13')]);router[_0xf6a5('0x14')]('/:id/accept',auth[_0xf6a5('0x6')](),controller['accept']);router['put'](_0xf6a5('0x15'),auth[_0xf6a5('0x6')](),controller['reject']);router[_0xf6a5('0x16')](_0xf6a5('0xa'),auth[_0xf6a5('0x6')](),controller[_0xf6a5('0x17')]);module[_0xf6a5('0x18')]=router; \ No newline at end of file +var _0x578d=['../../config/environment','./smsMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','tracked','smsmessage:create','create','status','put','/:id/accept','accept','reject','delete','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x578d,0x11a));var _0xd578=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x578d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd578('0x0'));var util=require('util');var path=require(_0xd578('0x1'));var timeout=require(_0xd578('0x2'));var express=require(_0xd578('0x3'));var router=express[_0xd578('0x4')]();var fs_extra=require(_0xd578('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd578('0x6'));var controller=require(_0xd578('0x7'));router[_0xd578('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd578('0x9'),auth[_0xd578('0xa')](),controller[_0xd578('0xb')]);router[_0xd578('0x8')](_0xd578('0xc'),auth[_0xd578('0xa')](),controller[_0xd578('0xd')]);router['post']('/',auth[_0xd578('0xa')](),interaction[_0xd578('0xe')]('sms',_0xd578('0xf')),controller[_0xd578('0x10')]);router['post']('/:id/status',controller[_0xd578('0x11')]);router['put'](_0xd578('0xc'),auth[_0xd578('0xa')](),controller['update']);router[_0xd578('0x12')](_0xd578('0x13'),auth['isAuthenticated'](),controller[_0xd578('0x14')]);router['put']('/:id/reject',auth[_0xd578('0xa')](),controller[_0xd578('0x15')]);router[_0xd578('0x16')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd578('0x17')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 6ddf290..c9dfac3 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 _0xe574=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x2bcc5e,_0x503321){var _0x51df66=function(_0x5cd7e6){while(--_0x5cd7e6){_0x2bcc5e['push'](_0x2bcc5e['shift']());}};_0x51df66(++_0x503321);}(_0xe574,0x100));var _0x4e57=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xe574[_0x5d6456];return _0x4d66c1;};'use strict';var Sequelize=require(_0x4e57('0x0'));module['exports']={'body':{'type':Sequelize[_0x4e57('0x1')](_0x4e57('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4e57('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4e57('0x4')]('in',_0x4e57('0x5')),'defaultValue':_0x4e57('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4e57('0x6')](0xbe)},'phone':{'type':Sequelize[_0x4e57('0x6')]},'readAt':{'type':Sequelize[_0x4e57('0x7')]},'secret':{'type':Sequelize[_0x4e57('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x4e57('0x6')]},'providerResponse':{'type':Sequelize[_0x4e57('0x1')]}}; \ No newline at end of file +var _0xea5a=['out','STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM'];(function(_0x152427,_0xaafff4){var _0x961036=function(_0x2908a3){while(--_0x2908a3){_0x152427['push'](_0x152427['shift']());}};_0x961036(++_0xaafff4);}(_0xea5a,0x8b));var _0xaea5=function(_0x13eaae,_0x11ec0a){_0x13eaae=_0x13eaae-0x0;var _0x4493db=_0xea5a[_0x13eaae];return _0x4493db;};'use strict';var Sequelize=require(_0xaea5('0x0'));module[_0xaea5('0x1')]={'body':{'type':Sequelize[_0xaea5('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xaea5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaea5('0x4')]('in',_0xaea5('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xaea5('0x6')]},'readAt':{'type':Sequelize[_0xaea5('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xaea5('0x6')]},'providerResponse':{'type':Sequelize[_0xaea5('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 345a34e..d8a2223 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 _0x3c8e=['path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','stack','name','index','map','SmsMessage','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','params','length','include','options','find','create','body','describe','sms-interactions','sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','read1stAt','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','SELECT','contact','fullname','email','internal','manual','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','event','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','inspect','MessageUUID','indexOf','sent','Status','plivio','infobip','results','DELIVERED','eml-format','rimraf','request-promise','moment','bluebird','util'];(function(_0x458c79,_0x1a183a){var _0x4a15ea=function(_0x17c789){while(--_0x17c789){_0x458c79['push'](_0x458c79['shift']());}};_0x4a15ea(++_0x1a183a);}(_0x3c8e,0x89));var _0xe3c8=function(_0x4ed7b6,_0x4ec70b){_0x4ed7b6=_0x4ed7b6-0x0;var _0x2f0a6b=_0x3c8e[_0x4ed7b6];return _0x2f0a6b;};'use strict';var emlformat=require(_0xe3c8('0x0'));var rimraf=require(_0xe3c8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe3c8('0x2'));var moment=require(_0xe3c8('0x3'));var BPromise=require(_0xe3c8('0x4'));var Mustache=require('mustache');var util=require(_0xe3c8('0x5'));var path=require(_0xe3c8('0x6'));var sox=require(_0xe3c8('0x7'));var csv=require(_0xe3c8('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe3c8('0x9'));var _=require(_0xe3c8('0xa'));var squel=require(_0xe3c8('0xb'));var crypto=require(_0xe3c8('0xc'));var jsforce=require(_0xe3c8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe3c8('0x8'));var querystring=require('querystring');var Papa=require(_0xe3c8('0xe'));var Redis=require(_0xe3c8('0xf'));var authService=require(_0xe3c8('0x10'));var qs=require(_0xe3c8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c8('0x12'));var logger=require(_0xe3c8('0x13'))(_0xe3c8('0x14'));var utils=require('../../config/utils');var config=require(_0xe3c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe3c8('0x16'))['db'];config['redis']=_['defaults'](config[_0xe3c8('0x17')],{'host':_0xe3c8('0x18'),'port':0x18eb});var socket=require(_0xe3c8('0x19'))(new Redis(config['redis']));require(_0xe3c8('0x1a'))[_0xe3c8('0x1b')](socket);var jayson=require(_0xe3c8('0x1c'));var client=jayson[_0xe3c8('0x1d')][_0xe3c8('0x1e')]({'port':0x232c});var client9002=jayson[_0xe3c8('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b7c91,_0x138dc8,_0x599149,_0x7b146b){return new BPromise(function(_0x10d57b,_0x17e26c){var _0x4d94de=_0x7b146b||client;return _0x4d94de[_0xe3c8('0x1f')](_0x2b7c91,_0x599149)[_0xe3c8('0x20')](function(_0x36d454){logger[_0xe3c8('0x21')](_0xe3c8('0x22'),_0x138dc8,_0xe3c8('0x23'));logger[_0xe3c8('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x138dc8,_0xe3c8('0x23'),JSON[_0xe3c8('0x25')](_0x36d454));if(_0x36d454[_0xe3c8('0x26')]){if(_0x36d454[_0xe3c8('0x26')][_0xe3c8('0x27')]===0x1f4){logger[_0xe3c8('0x26')]('SmsMessage,\x20%s,\x20%s',_0x138dc8,_0x36d454[_0xe3c8('0x26')][_0xe3c8('0x28')]);return _0x17e26c(_0x36d454['error'][_0xe3c8('0x28')]);}logger[_0xe3c8('0x26')]('SmsMessage,\x20%s,\x20%s',_0x138dc8,_0x36d454[_0xe3c8('0x26')][_0xe3c8('0x28')]);return _0x10d57b(_0x36d454['error'][_0xe3c8('0x28')]);}else{logger[_0xe3c8('0x21')](_0xe3c8('0x22'),_0x138dc8,_0xe3c8('0x23'));_0x10d57b(_0x36d454[_0xe3c8('0x29')]['message']);}})[_0xe3c8('0x2a')](function(_0x50a2ce){logger['error']('SmsMessage,\x20%s,\x20%s',_0x138dc8,_0x50a2ce);_0x17e26c(_0x50a2ce);});});}function respondWithStatusCode(_0xf2f111,_0x4f2d7f){_0x4f2d7f=_0x4f2d7f||0xcc;return function(_0x350134){if(_0x350134){return _0xf2f111[_0xe3c8('0x2b')](_0x4f2d7f);}return _0xf2f111['status'](_0x4f2d7f)[_0xe3c8('0x2c')]();};}function respondWithResult(_0x4c6933,_0x2941c2){_0x2941c2=_0x2941c2||0xc8;return function(_0x1b6ed3){if(_0x1b6ed3){return _0x4c6933[_0xe3c8('0x2d')](_0x2941c2)[_0xe3c8('0x2e')](_0x1b6ed3);}};}function respondWithFilteredResult(_0xca96ed,_0x182d57){return function(_0x9d9e45){if(_0x9d9e45){var _0x497448=typeof _0x182d57['offset']===_0xe3c8('0x2f')&&typeof _0x182d57[_0xe3c8('0x30')]===_0xe3c8('0x2f');var _0x564b86=_0x9d9e45[_0xe3c8('0x31')];var _0x266399=_0x497448?0x0:_0x182d57[_0xe3c8('0x32')];var _0x1d5da7=_0x497448?_0x9d9e45['count']:_0x182d57[_0xe3c8('0x32')]+_0x182d57['limit'];var _0x364fa3;if(_0x1d5da7>=_0x564b86){_0x1d5da7=_0x564b86;_0x364fa3=0xc8;}else{_0x364fa3=0xce;}_0xca96ed[_0xe3c8('0x2d')](_0x364fa3);return _0xca96ed[_0xe3c8('0x33')](_0xe3c8('0x34'),_0x266399+'-'+_0x1d5da7+'/'+_0x564b86)['json'](_0x9d9e45);}return null;};}function patchUpdates(_0x2dbaa3){return function(_0xb0e545){try{jsonpatch[_0xe3c8('0x35')](_0xb0e545,_0x2dbaa3,!![]);}catch(_0x4bfd46){return BPromise[_0xe3c8('0x36')](_0x4bfd46);}return _0xb0e545[_0xe3c8('0x37')]();};}function saveUpdates(_0x111fd6,_0x461d76){return function(_0x1a1645){if(_0x1a1645){return _0x1a1645[_0xe3c8('0x38')](_0x111fd6)['then'](function(_0x257277){return _0x257277;});}return null;};}function removeEntity(_0x5c6103,_0x3d36d5){return function(_0x2f789e){if(_0x2f789e){return _0x2f789e[_0xe3c8('0x39')]()[_0xe3c8('0x20')](function(){_0x5c6103[_0xe3c8('0x2d')](0xcc)[_0xe3c8('0x2c')]();});}};}function handleEntityNotFound(_0x973a85,_0x212bb9){return function(_0x553991){if(!_0x553991){_0x973a85[_0xe3c8('0x2b')](0x194);}return _0x553991;};}function handleError(_0x47cb7c,_0x5b8378){_0x5b8378=_0x5b8378||0x1f4;return function(_0x3ce1f9){logger[_0xe3c8('0x26')](_0x3ce1f9[_0xe3c8('0x3a')]);if(_0x3ce1f9[_0xe3c8('0x3b')]){delete _0x3ce1f9['name'];}_0x47cb7c[_0xe3c8('0x2d')](_0x5b8378)['send'](_0x3ce1f9);};}exports[_0xe3c8('0x3c')]=function(_0x4138c2,_0x436b37){var _0x3f01fb={},_0x308a74={},_0x543d70={'count':0x0,'rows':[]};var _0x257c02=_[_0xe3c8('0x3d')](db[_0xe3c8('0x3e')][_0xe3c8('0x3f')],function(_0x1efb42){return{'name':_0x1efb42['fieldName'],'type':_0x1efb42['type'][_0xe3c8('0x40')]};});_0x308a74[_0xe3c8('0x41')]=_[_0xe3c8('0x3d')](_0x257c02,_0xe3c8('0x3b'));_0x308a74['query']=_[_0xe3c8('0x42')](_0x4138c2['query']);_0x308a74[_0xe3c8('0x43')]=_[_0xe3c8('0x44')](_0x308a74[_0xe3c8('0x41')],_0x308a74['query']);_0x3f01fb[_0xe3c8('0x45')]=_[_0xe3c8('0x44')](_0x308a74[_0xe3c8('0x41')],qs[_0xe3c8('0x46')](_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x46')]));_0x3f01fb[_0xe3c8('0x45')]=_0x3f01fb['attributes']['length']?_0x3f01fb[_0xe3c8('0x45')]:_0x308a74['model'];if(!_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x48')](_0xe3c8('0x49'))){_0x3f01fb[_0xe3c8('0x30')]=qs[_0xe3c8('0x30')](_0x4138c2[_0xe3c8('0x47')]['limit']);_0x3f01fb[_0xe3c8('0x32')]=qs[_0xe3c8('0x32')](_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x32')]);}_0x3f01fb['order']=qs['sort'](_0x4138c2['query']['sort']);_0x3f01fb[_0xe3c8('0x4a')]=qs[_0xe3c8('0x43')](_[_0xe3c8('0x4b')](_0x4138c2['query'],_0x308a74['filters']),_0x257c02);if(_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x4c')]){_0x3f01fb[_0xe3c8('0x4a')]=_[_0xe3c8('0x4d')](_0x3f01fb[_0xe3c8('0x4a')],{'$or':_[_0xe3c8('0x3d')](_0x257c02,function(_0x44cd90){if(_0x44cd90['type']!==_0xe3c8('0x4e')){var _0x1edd00={};_0x1edd00[_0x44cd90[_0xe3c8('0x3b')]]={'$like':'%'+_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x4c')]+'%'};return _0x1edd00;}})});}_0x3f01fb=_[_0xe3c8('0x4d')]({},_0x3f01fb,_0x4138c2['options']);var _0x76ec9d={'where':_0x3f01fb[_0xe3c8('0x4a')]};return db['SmsMessage']['count'](_0x76ec9d)[_0xe3c8('0x20')](function(_0x335c81){_0x543d70['count']=_0x335c81;if(_0x4138c2[_0xe3c8('0x47')][_0xe3c8('0x4f')]){_0x3f01fb['include']=[{'all':!![]}];}return db[_0xe3c8('0x3e')][_0xe3c8('0x50')](_0x3f01fb);})[_0xe3c8('0x20')](function(_0x16ed1f){_0x543d70[_0xe3c8('0x51')]=_0x16ed1f;return _0x543d70;})[_0xe3c8('0x20')](respondWithFilteredResult(_0x436b37,_0x3f01fb))[_0xe3c8('0x2a')](handleError(_0x436b37,null));};exports['show']=function(_0x5e8352,_0x34ebc8){var _0x405a09={'raw':!![],'where':{'id':_0x5e8352[_0xe3c8('0x52')]['id']}},_0xcd39a={};_0xcd39a[_0xe3c8('0x41')]=_['keys'](db[_0xe3c8('0x3e')][_0xe3c8('0x3f')]);_0xcd39a[_0xe3c8('0x47')]=_[_0xe3c8('0x42')](_0x5e8352[_0xe3c8('0x47')]);_0xcd39a[_0xe3c8('0x43')]=_['intersection'](_0xcd39a[_0xe3c8('0x41')],_0xcd39a[_0xe3c8('0x47')]);_0x405a09[_0xe3c8('0x45')]=_[_0xe3c8('0x44')](_0xcd39a[_0xe3c8('0x41')],qs['fields'](_0x5e8352['query'][_0xe3c8('0x46')]));_0x405a09[_0xe3c8('0x45')]=_0x405a09[_0xe3c8('0x45')][_0xe3c8('0x53')]?_0x405a09[_0xe3c8('0x45')]:_0xcd39a[_0xe3c8('0x41')];if(_0x5e8352[_0xe3c8('0x47')][_0xe3c8('0x4f')]){_0x405a09[_0xe3c8('0x54')]=[{'all':!![]}];}_0x405a09=_['merge']({},_0x405a09,_0x5e8352[_0xe3c8('0x55')]);return db[_0xe3c8('0x3e')][_0xe3c8('0x56')](_0x405a09)['then'](handleEntityNotFound(_0x34ebc8,null))['then'](respondWithResult(_0x34ebc8,null))['catch'](handleError(_0x34ebc8,null));};exports[_0xe3c8('0x57')]=function(_0x1ecdc0,_0x4bebd9){return db[_0xe3c8('0x3e')][_0xe3c8('0x57')](_0x1ecdc0['body'],{})['then'](respondWithResult(_0x4bebd9,0xc9))['catch'](handleError(_0x4bebd9,null));};exports['update']=function(_0x4d6301,_0x3798a7){if(_0x4d6301['body']['id']){delete _0x4d6301[_0xe3c8('0x58')]['id'];}return db[_0xe3c8('0x3e')][_0xe3c8('0x56')]({'where':{'id':_0x4d6301[_0xe3c8('0x52')]['id']}})[_0xe3c8('0x20')](handleEntityNotFound(_0x3798a7,null))[_0xe3c8('0x20')](saveUpdates(_0x4d6301[_0xe3c8('0x58')],null))['then'](respondWithResult(_0x3798a7,null))[_0xe3c8('0x2a')](handleError(_0x3798a7,null));};exports[_0xe3c8('0x39')]=function(_0x35d903,_0xdb2ac1){return db['SmsMessage'][_0xe3c8('0x56')]({'where':{'id':_0x35d903[_0xe3c8('0x52')]['id']}})[_0xe3c8('0x20')](handleEntityNotFound(_0xdb2ac1,null))[_0xe3c8('0x20')](removeEntity(_0xdb2ac1,null))[_0xe3c8('0x2a')](handleError(_0xdb2ac1,null));};exports['describe']=function(_0x4b3289,_0x34ba49){return db[_0xe3c8('0x3e')][_0xe3c8('0x59')]()['then'](respondWithResult(_0x34ba49,null))[_0xe3c8('0x2a')](handleError(_0x34ba49,null));};var interaction_log=require(_0xe3c8('0x13'))(_0xe3c8('0x5a'));exports['accept']=function(_0x2a9685,_0x5f58cb,_0x7333da){var _0x227a6e={'agent':{},'channel':_0xe3c8('0x5b')};if(_0x2a9685[_0xe3c8('0x58')]['id']){delete _0x2a9685['body']['id'];}_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x5c')]=!![];_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x5d')]=moment()[_0xe3c8('0x5e')](_0xe3c8('0x5f'));_0x2a9685[_0xe3c8('0x58')]['UserId']=_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x60')]||_0x2a9685[_0xe3c8('0x61')]['id'];_0x227a6e[_0xe3c8('0x62')]['id']=_0x2a9685[_0xe3c8('0x58')]['UserId'];return db[_0xe3c8('0x3e')][_0xe3c8('0x56')]({'where':{'id':_0x2a9685[_0xe3c8('0x52')]['id'],'UserId':null}})[_0xe3c8('0x20')](handleEntityNotFound(_0x5f58cb,null))['then'](saveUpdates(_0x2a9685[_0xe3c8('0x58')],null))[_0xe3c8('0x20')](function(_0x372257){if(_0x372257){_0x227a6e[_0xe3c8('0x28')]=_0x372257[_0xe3c8('0x63')]({'plain':!![]});return db[_0xe3c8('0x64')][_0xe3c8('0x56')]({'where':{'id':_0x372257['SmsInteractionId']}});}return null;})[_0xe3c8('0x20')](handleEntityNotFound(_0x5f58cb,null))[_0xe3c8('0x20')](function(_0x526947){if(_0x526947){return _0x526947[_0xe3c8('0x38')]({'UserId':_0x2a9685[_0xe3c8('0x58')]['UserId'],'read1stAt':_[_0xe3c8('0x65')](_0x526947[_0xe3c8('0x66')])?moment()['format'](_0xe3c8('0x5f')):undefined});}return null;})[_0xe3c8('0x20')](function(_0x2f9451){if(_0x2f9451){_0x227a6e[_0xe3c8('0x67')]=_0x2f9451['get']({'plain':!![]});interaction_log[_0xe3c8('0x21')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2a9685[_0xe3c8('0x61')]['id'],_0x2a9685[_0xe3c8('0x61')][_0xe3c8('0x3b')],_0x2a9685[_0xe3c8('0x61')]['role'],_0x227a6e[_0xe3c8('0x67')]['id'],_0x2a9685[_0xe3c8('0x58')]?JSON['stringify'](_0x2a9685[_0xe3c8('0x58')]):_0xe3c8('0x68'));return respondWithRpcPromise('AcceptMessage',_0xe3c8('0x69'),_0x227a6e);}return null;})[_0xe3c8('0x20')](function(_0x41cae0){var _0x5a61b3=_0xe3c8('0x6a')+_0x41cae0['message']['ContactId'];return db[_0xe3c8('0x6b')][_0xe3c8('0x47')](_0x5a61b3,{'type':db[_0xe3c8('0x6c')]['QueryTypes'][_0xe3c8('0x6d')],'raw':!![]})[_0xe3c8('0x20')](function(_0x17fa4b){return _0x17fa4b;});})['then'](function(_0x4de14c){if(_0x4de14c){_0x227a6e[_0xe3c8('0x28')][_0xe3c8('0x6e')]=_0x4de14c[0x0];if(!_0x2a9685['body'][_0xe3c8('0x60')])return;return db['User']['find']({'where':{'id':_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x60')],'role':_0xe3c8('0x62')},'attributes':['id',_0xe3c8('0x3b'),_0xe3c8('0x6f'),_0xe3c8('0x70'),_0xe3c8('0x71')],'raw':!![]});}return null;})[_0xe3c8('0x20')](function(_0x966021){if(!_0x966021)return null;_0x227a6e['message'][_0xe3c8('0x62')]=_0x966021;return _0x227a6e;})['then'](function(_0x2500e7){if(_0x2500e7){if(_0x2a9685[_0xe3c8('0x58')][_0xe3c8('0x72')]){_0x227a6e['message']['interface']=util[_0xe3c8('0x5e')](_0xe3c8('0x73'),_0x2a9685[_0xe3c8('0x61')][_0xe3c8('0x3b')]);_0x227a6e[_0xe3c8('0x28')][_0xe3c8('0x74')]=_0x227a6e[_0xe3c8('0x74')];_0x227a6e['message'][_0xe3c8('0x75')]=_0x227a6e['channel'];_0x227a6e['message']['event']='accept';return respondWithRpcPromise(_0xe3c8('0x76'),_0xe3c8('0x76'),{'event':_0xe3c8('0x77'),'message':_0x227a6e[_0xe3c8('0x28')]},client9002)[_0xe3c8('0x20')](function(){return _0x227a6e;});}return _0x227a6e;}return null;})[_0xe3c8('0x20')](respondWithResult(_0x5f58cb,null))[_0xe3c8('0x2a')](handleError(_0x5f58cb,null));};var interaction_log=require(_0xe3c8('0x13'))(_0xe3c8('0x5a'));exports[_0xe3c8('0x36')]=function(_0x1021f,_0x2d0eca,_0xa2aafa){var _0x563f74={'agent':{},'channel':'sms'};if(_0x1021f[_0xe3c8('0x58')]['id']){delete _0x1021f[_0xe3c8('0x58')]['id'];}_0x1021f[_0xe3c8('0x58')][_0xe3c8('0x60')]=_0x1021f[_0xe3c8('0x58')][_0xe3c8('0x60')]||_0x1021f[_0xe3c8('0x61')]['id'];_0x563f74[_0xe3c8('0x62')]['id']=_0x1021f[_0xe3c8('0x58')][_0xe3c8('0x60')];return db['SmsMessage'][_0xe3c8('0x56')]({'where':{'id':_0x1021f[_0xe3c8('0x52')]['id'],'UserId':null}})[_0xe3c8('0x20')](handleEntityNotFound(_0x2d0eca,null))[_0xe3c8('0x20')](function(_0x3588){if(_0x3588){_0x563f74['message']=_0x3588[_0xe3c8('0x63')]({'plain':!![]});return db[_0xe3c8('0x64')]['find']({'where':{'id':_0x3588[_0xe3c8('0x78')]}});}return null;})[_0xe3c8('0x20')](handleEntityNotFound(_0x2d0eca,null))[_0xe3c8('0x20')](function(_0x221aa0){if(_0x221aa0){_0x563f74[_0xe3c8('0x67')]=_0x221aa0[_0xe3c8('0x63')]({'plain':!![]});interaction_log[_0xe3c8('0x21')](_0xe3c8('0x79'),_0x1021f['user']['id'],_0x1021f['user'][_0xe3c8('0x3b')],_0x1021f[_0xe3c8('0x61')]['role'],_0x563f74['interaction']['id'],_0x1021f[_0xe3c8('0x58')]?JSON[_0xe3c8('0x25')](_0x1021f['body']):_0xe3c8('0x68'));return respondWithRpcPromise(_0xe3c8('0x7a'),_0xe3c8('0x7b'),_0x563f74);}return null;})[_0xe3c8('0x20')](function(_0x5e4846){var _0x5cffb1=_0xe3c8('0x6a')+_0x5e4846[_0xe3c8('0x28')][_0xe3c8('0x7c')];return db[_0xe3c8('0x6b')][_0xe3c8('0x47')](_0x5cffb1,{'type':db[_0xe3c8('0x6c')]['QueryTypes'][_0xe3c8('0x6d')],'raw':!![]})[_0xe3c8('0x20')](function(_0x5061b4){return _0x5061b4;});})[_0xe3c8('0x20')](function(_0x114eec){if(_0x114eec){_0x563f74[_0xe3c8('0x28')][_0xe3c8('0x6e')]=_0x114eec[0x0];if(!_0x1021f['body'][_0xe3c8('0x60')])return;return db['User']['find']({'where':{'id':_0x1021f[_0xe3c8('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0xe3c8('0x3b'),_0xe3c8('0x6f'),_0xe3c8('0x70'),_0xe3c8('0x71')],'raw':!![]});}return null;})[_0xe3c8('0x20')](function(_0x492a57){if(!_0x492a57)return null;_0x563f74['message']['agent']=_0x492a57;return _0x563f74;})[_0xe3c8('0x20')](function(_0x3c054a){if(_0x3c054a){_0x3c054a[_0xe3c8('0x28')]['interface']=util[_0xe3c8('0x5e')](_0xe3c8('0x73'),_0x1021f['user']['name']);_0x3c054a['message'][_0xe3c8('0x74')]=_0x563f74[_0xe3c8('0x74')];_0x3c054a['message']['motionChannel']=_0x563f74[_0xe3c8('0x74')];_0x3c054a[_0xe3c8('0x28')][_0xe3c8('0x7d')]=_0xe3c8('0x36');respondWithRpcPromise(_0xe3c8('0x76'),_0xe3c8('0x76'),{'event':_0xe3c8('0x7e'),'message':_0x3c054a[_0xe3c8('0x28')]},client9002);return _0x563f74;}return null;})['then'](respondWithResult(_0x2d0eca,null))[_0xe3c8('0x2a')](handleError(_0x2d0eca,null));};exports[_0xe3c8('0x2d')]=function(_0x5c744c,_0x2b1b24,_0x30d9fc){if(_0x5c744c[_0xe3c8('0x58')]['id']){delete _0x5c744c[_0xe3c8('0x58')]['id'];}var _0x2fc79f;return db['SmsMessage'][_0xe3c8('0x56')]({'where':{'id':_0x5c744c[_0xe3c8('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b1b24,null))['then'](function(_0x1e64df){if(_0x1e64df){_0x2fc79f=_0x1e64df;return db[_0xe3c8('0x7f')][_0xe3c8('0x56')]({'where':{'id':_0x1e64df[_0xe3c8('0x80')]}});}})[_0xe3c8('0x20')](handleEntityNotFound(_0x2b1b24,null))[_0xe3c8('0x20')](function(_0x55d91f){if(_0x55d91f){logger[_0xe3c8('0x24')](_0xe3c8('0x81'),_0xe3c8('0x2d'),'received\x20delivery\x20report\x20from',_0x55d91f['type'],util['inspect'](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));switch(_0x55d91f['type']){case _0xe3c8('0x82'):if(_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x83')]&&_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x83')]===_0x2fc79f[_0xe3c8('0x84')]){return _0x2fc79f['update']({'read':!![]});}else{logger['error'](_0xe3c8('0x85'),'status',_0xe3c8('0x82'),util[_0xe3c8('0x86')](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5c744c[_0xe3c8('0x58')]['MessageUUID']&&_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x87')]===_0x2fc79f[_0xe3c8('0x84')]&&_[_0xe3c8('0x88')]([_0xe3c8('0x89'),'delivered'],_0x5c744c['body'][_0xe3c8('0x8a')])>=0x0){return _0x2fc79f[_0xe3c8('0x38')]({'read':!![]});}else{logger['error'](_0xe3c8('0x85'),_0xe3c8('0x2d'),_0xe3c8('0x8b'),util[_0xe3c8('0x86')](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));}break;case _0xe3c8('0x8c'):var _0x4305a5=_0x5c744c[_0xe3c8('0x58')][_0xe3c8('0x8d')][0x0];if(_0x4305a5['status']['groupName']===_0xe3c8('0x8e')){return _0x2fc79f[_0xe3c8('0x38')]({'read':!![]});}else{logger[_0xe3c8('0x26')](_0xe3c8('0x85'),'status','infobip',util[_0xe3c8('0x86')](_0x5c744c[_0xe3c8('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x2fc79f;}})[_0xe3c8('0x20')](respondWithResult(_0x2b1b24,null))[_0xe3c8('0x2a')](handleError(_0x2b1b24,null));}; \ No newline at end of file +var _0x2906=['map','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SmsMessage','includeAll','include','findAll','show','params','options','find','create','body','describe','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','user','UserId','get','SmsInteractionId','read1stAt','interaction','role','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','sms-interactions','reject','sms','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','SELECT','SIP/%s','rejectmessage','SmsAccount','SmsAccountId','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','delivered','Status','groupName','DELIVERED','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','then','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','stack','name','send','index'];(function(_0x166985,_0x336b39){var _0x2d4339=function(_0x3f52a3){while(--_0x3f52a3){_0x166985['push'](_0x166985['shift']());}};_0x2d4339(++_0x336b39);}(_0x2906,0xe0));var _0x6290=function(_0x5b75c4,_0xca1d42){_0x5b75c4=_0x5b75c4-0x0;var _0x6f2bda=_0x2906[_0x5b75c4];return _0x6f2bda;};'use strict';var emlformat=require(_0x6290('0x0'));var rimraf=require(_0x6290('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6290('0x2'));var rp=require('request-promise');var moment=require(_0x6290('0x3'));var BPromise=require(_0x6290('0x4'));var Mustache=require(_0x6290('0x5'));var util=require(_0x6290('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6290('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6290('0x8'));var squel=require('squel');var crypto=require(_0x6290('0x9'));var jsforce=require(_0x6290('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x6290('0xb'));var querystring=require(_0x6290('0xc'));var Papa=require(_0x6290('0xd'));var Redis=require(_0x6290('0xe'));var authService=require(_0x6290('0xf'));var qs=require(_0x6290('0x10'));var as=require(_0x6290('0x11'));var hardwareService=require(_0x6290('0x12'));var logger=require(_0x6290('0x13'))(_0x6290('0x14'));var utils=require(_0x6290('0x15'));var config=require(_0x6290('0x16'));var licenseUtil=require(_0x6290('0x17'));var db=require('../../mysqldb')['db'];config[_0x6290('0x18')]=_['defaults'](config[_0x6290('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x6290('0x19'))(new Redis(config[_0x6290('0x18')]));require(_0x6290('0x1a'))[_0x6290('0x1b')](socket);var jayson=require(_0x6290('0x1c'));var client=jayson['client'][_0x6290('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x6290('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5ba781,_0x204336,_0x5cf917,_0x7b7a23){return new BPromise(function(_0x268cbf,_0x3490d6){var _0x3080e3=_0x7b7a23||client;return _0x3080e3['request'](_0x5ba781,_0x5cf917)[_0x6290('0x1e')](function(_0xe9c974){logger['info'](_0x6290('0x1f'),_0x204336,'request\x20sent');logger[_0x6290('0x20')](_0x6290('0x21'),_0x204336,_0x6290('0x22'),JSON['stringify'](_0xe9c974));if(_0xe9c974[_0x6290('0x23')]){if(_0xe9c974[_0x6290('0x23')]['code']===0x1f4){logger[_0x6290('0x23')](_0x6290('0x1f'),_0x204336,_0xe9c974[_0x6290('0x23')]['message']);return _0x3490d6(_0xe9c974['error'][_0x6290('0x24')]);}logger[_0x6290('0x23')]('SmsMessage,\x20%s,\x20%s',_0x204336,_0xe9c974[_0x6290('0x23')][_0x6290('0x24')]);return _0x268cbf(_0xe9c974[_0x6290('0x23')][_0x6290('0x24')]);}else{logger[_0x6290('0x25')](_0x6290('0x1f'),_0x204336,'request\x20sent');_0x268cbf(_0xe9c974['result']['message']);}})[_0x6290('0x26')](function(_0x321ac4){logger[_0x6290('0x23')]('SmsMessage,\x20%s,\x20%s',_0x204336,_0x321ac4);_0x3490d6(_0x321ac4);});});}function respondWithStatusCode(_0x53c5a8,_0x4c058b){_0x4c058b=_0x4c058b||0xcc;return function(_0x198e1f){if(_0x198e1f){return _0x53c5a8[_0x6290('0x27')](_0x4c058b);}return _0x53c5a8[_0x6290('0x28')](_0x4c058b)[_0x6290('0x29')]();};}function respondWithResult(_0x5aae29,_0x360d9e){_0x360d9e=_0x360d9e||0xc8;return function(_0x4112db){if(_0x4112db){return _0x5aae29[_0x6290('0x28')](_0x360d9e)[_0x6290('0x2a')](_0x4112db);}};}function respondWithFilteredResult(_0x5452f7,_0x3f1570){return function(_0x26bdf0){if(_0x26bdf0){var _0x142b05=typeof _0x3f1570[_0x6290('0x2b')]===_0x6290('0x2c')&&typeof _0x3f1570[_0x6290('0x2d')]==='undefined';var _0x118904=_0x26bdf0['count'];var _0x49188d=_0x142b05?0x0:_0x3f1570[_0x6290('0x2b')];var _0x2eefa0=_0x142b05?_0x26bdf0[_0x6290('0x2e')]:_0x3f1570['offset']+_0x3f1570['limit'];var _0x48f27b;if(_0x2eefa0>=_0x118904){_0x2eefa0=_0x118904;_0x48f27b=0xc8;}else{_0x48f27b=0xce;}_0x5452f7[_0x6290('0x28')](_0x48f27b);return _0x5452f7['set'](_0x6290('0x2f'),_0x49188d+'-'+_0x2eefa0+'/'+_0x118904)['json'](_0x26bdf0);}return null;};}function patchUpdates(_0xc3a147){return function(_0x52f0ee){try{jsonpatch[_0x6290('0x30')](_0x52f0ee,_0xc3a147,!![]);}catch(_0x7290e3){return BPromise['reject'](_0x7290e3);}return _0x52f0ee[_0x6290('0x31')]();};}function saveUpdates(_0x1cd318,_0x885af5){return function(_0x1d157b){if(_0x1d157b){return _0x1d157b[_0x6290('0x32')](_0x1cd318)[_0x6290('0x1e')](function(_0x3edd20){return _0x3edd20;});}return null;};}function removeEntity(_0x497698,_0x4321b6){return function(_0x57d62b){if(_0x57d62b){return _0x57d62b[_0x6290('0x33')]()[_0x6290('0x1e')](function(){_0x497698['status'](0xcc)[_0x6290('0x29')]();});}};}function handleEntityNotFound(_0x30d045,_0x26da00){return function(_0x4ea561){if(!_0x4ea561){_0x30d045['sendStatus'](0x194);}return _0x4ea561;};}function handleError(_0xc42763,_0x34ce5a){_0x34ce5a=_0x34ce5a||0x1f4;return function(_0x56796c){logger[_0x6290('0x23')](_0x56796c[_0x6290('0x34')]);if(_0x56796c[_0x6290('0x35')]){delete _0x56796c[_0x6290('0x35')];}_0xc42763['status'](_0x34ce5a)[_0x6290('0x36')](_0x56796c);};}exports[_0x6290('0x37')]=function(_0x3449ea,_0x3b25ec){var _0x1b03ca={},_0x39d763={},_0x10621f={'count':0x0,'rows':[]};var _0x566ff1=_[_0x6290('0x38')](db['SmsMessage']['rawAttributes'],function(_0x3649a5){return{'name':_0x3649a5[_0x6290('0x39')],'type':_0x3649a5[_0x6290('0x3a')][_0x6290('0x3b')]};});_0x39d763['model']=_[_0x6290('0x38')](_0x566ff1,_0x6290('0x35'));_0x39d763[_0x6290('0x3c')]=_[_0x6290('0x3d')](_0x3449ea[_0x6290('0x3c')]);_0x39d763[_0x6290('0x3e')]=_[_0x6290('0x3f')](_0x39d763[_0x6290('0x40')],_0x39d763[_0x6290('0x3c')]);_0x1b03ca['attributes']=_[_0x6290('0x3f')](_0x39d763['model'],qs['fields'](_0x3449ea[_0x6290('0x3c')][_0x6290('0x41')]));_0x1b03ca[_0x6290('0x42')]=_0x1b03ca[_0x6290('0x42')][_0x6290('0x43')]?_0x1b03ca['attributes']:_0x39d763['model'];if(!_0x3449ea[_0x6290('0x3c')][_0x6290('0x44')](_0x6290('0x45'))){_0x1b03ca[_0x6290('0x2d')]=qs[_0x6290('0x2d')](_0x3449ea[_0x6290('0x3c')][_0x6290('0x2d')]);_0x1b03ca['offset']=qs[_0x6290('0x2b')](_0x3449ea[_0x6290('0x3c')][_0x6290('0x2b')]);}_0x1b03ca[_0x6290('0x46')]=qs[_0x6290('0x47')](_0x3449ea[_0x6290('0x3c')][_0x6290('0x47')]);_0x1b03ca[_0x6290('0x48')]=qs[_0x6290('0x3e')](_[_0x6290('0x49')](_0x3449ea['query'],_0x39d763[_0x6290('0x3e')]),_0x566ff1);if(_0x3449ea[_0x6290('0x3c')][_0x6290('0x4a')]){_0x1b03ca['where']=_[_0x6290('0x4b')](_0x1b03ca['where'],{'$or':_['map'](_0x566ff1,function(_0x40a08d){if(_0x40a08d[_0x6290('0x3a')]!=='VIRTUAL'){var _0x378161={};_0x378161[_0x40a08d['name']]={'$like':'%'+_0x3449ea[_0x6290('0x3c')]['filter']+'%'};return _0x378161;}})});}_0x1b03ca=_[_0x6290('0x4b')]({},_0x1b03ca,_0x3449ea['options']);var _0x3a2d17={'where':_0x1b03ca[_0x6290('0x48')]};return db[_0x6290('0x4c')][_0x6290('0x2e')](_0x3a2d17)[_0x6290('0x1e')](function(_0x1827d2){_0x10621f['count']=_0x1827d2;if(_0x3449ea[_0x6290('0x3c')][_0x6290('0x4d')]){_0x1b03ca[_0x6290('0x4e')]=[{'all':!![]}];}return db['SmsMessage'][_0x6290('0x4f')](_0x1b03ca);})[_0x6290('0x1e')](function(_0x18eb35){_0x10621f['rows']=_0x18eb35;return _0x10621f;})['then'](respondWithFilteredResult(_0x3b25ec,_0x1b03ca))[_0x6290('0x26')](handleError(_0x3b25ec,null));};exports[_0x6290('0x50')]=function(_0x5d6a9f,_0x4ef1c7){var _0x1d7fd4={'raw':!![],'where':{'id':_0x5d6a9f[_0x6290('0x51')]['id']}},_0x40b8c8={};_0x40b8c8[_0x6290('0x40')]=_[_0x6290('0x3d')](db[_0x6290('0x4c')]['rawAttributes']);_0x40b8c8[_0x6290('0x3c')]=_[_0x6290('0x3d')](_0x5d6a9f[_0x6290('0x3c')]);_0x40b8c8[_0x6290('0x3e')]=_[_0x6290('0x3f')](_0x40b8c8[_0x6290('0x40')],_0x40b8c8[_0x6290('0x3c')]);_0x1d7fd4['attributes']=_[_0x6290('0x3f')](_0x40b8c8[_0x6290('0x40')],qs[_0x6290('0x41')](_0x5d6a9f['query'][_0x6290('0x41')]));_0x1d7fd4[_0x6290('0x42')]=_0x1d7fd4[_0x6290('0x42')][_0x6290('0x43')]?_0x1d7fd4[_0x6290('0x42')]:_0x40b8c8[_0x6290('0x40')];if(_0x5d6a9f[_0x6290('0x3c')][_0x6290('0x4d')]){_0x1d7fd4['include']=[{'all':!![]}];}_0x1d7fd4=_['merge']({},_0x1d7fd4,_0x5d6a9f[_0x6290('0x52')]);return db[_0x6290('0x4c')][_0x6290('0x53')](_0x1d7fd4)[_0x6290('0x1e')](handleEntityNotFound(_0x4ef1c7,null))[_0x6290('0x1e')](respondWithResult(_0x4ef1c7,null))[_0x6290('0x26')](handleError(_0x4ef1c7,null));};exports['create']=function(_0x4c1a20,_0x53d85c){return db[_0x6290('0x4c')][_0x6290('0x54')](_0x4c1a20[_0x6290('0x55')],{})['then'](respondWithResult(_0x53d85c,0xc9))[_0x6290('0x26')](handleError(_0x53d85c,null));};exports[_0x6290('0x32')]=function(_0xd42fac,_0x4a3f02){if(_0xd42fac[_0x6290('0x55')]['id']){delete _0xd42fac[_0x6290('0x55')]['id'];}return db[_0x6290('0x4c')][_0x6290('0x53')]({'where':{'id':_0xd42fac[_0x6290('0x51')]['id']}})['then'](handleEntityNotFound(_0x4a3f02,null))[_0x6290('0x1e')](saveUpdates(_0xd42fac[_0x6290('0x55')],null))[_0x6290('0x1e')](respondWithResult(_0x4a3f02,null))[_0x6290('0x26')](handleError(_0x4a3f02,null));};exports[_0x6290('0x33')]=function(_0x221162,_0x30e9de){return db[_0x6290('0x4c')]['find']({'where':{'id':_0x221162[_0x6290('0x51')]['id']}})[_0x6290('0x1e')](handleEntityNotFound(_0x30e9de,null))[_0x6290('0x1e')](removeEntity(_0x30e9de,null))[_0x6290('0x26')](handleError(_0x30e9de,null));};exports['describe']=function(_0x1eef14,_0x44e90a){return db['SmsMessage'][_0x6290('0x56')]()[_0x6290('0x1e')](respondWithResult(_0x44e90a,null))[_0x6290('0x26')](handleError(_0x44e90a,null));};var interaction_log=require(_0x6290('0x13'))('sms-interactions');exports[_0x6290('0x57')]=function(_0x47fce5,_0x4c499e,_0x1ff6e8){var _0x3cdde2={'agent':{},'channel':'sms'};if(_0x47fce5[_0x6290('0x55')]['id']){delete _0x47fce5['body']['id'];}_0x47fce5[_0x6290('0x55')]['read']=!![];_0x47fce5['body'][_0x6290('0x58')]=moment()[_0x6290('0x59')](_0x6290('0x5a'));_0x47fce5[_0x6290('0x55')]['UserId']=_0x47fce5[_0x6290('0x55')]['UserId']||_0x47fce5[_0x6290('0x5b')]['id'];_0x3cdde2['agent']['id']=_0x47fce5[_0x6290('0x55')][_0x6290('0x5c')];return db[_0x6290('0x4c')][_0x6290('0x53')]({'where':{'id':_0x47fce5[_0x6290('0x51')]['id'],'UserId':null}})[_0x6290('0x1e')](handleEntityNotFound(_0x4c499e,null))[_0x6290('0x1e')](saveUpdates(_0x47fce5['body'],null))[_0x6290('0x1e')](function(_0x208a3f){if(_0x208a3f){_0x3cdde2['message']=_0x208a3f[_0x6290('0x5d')]({'plain':!![]});return db['SmsInteraction'][_0x6290('0x53')]({'where':{'id':_0x208a3f[_0x6290('0x5e')]}});}return null;})[_0x6290('0x1e')](handleEntityNotFound(_0x4c499e,null))['then'](function(_0x3a2912){if(_0x3a2912){return _0x3a2912[_0x6290('0x32')]({'UserId':_0x47fce5[_0x6290('0x55')][_0x6290('0x5c')],'read1stAt':_['isNil'](_0x3a2912[_0x6290('0x5f')])?moment()['format'](_0x6290('0x5a')):undefined});}return null;})[_0x6290('0x1e')](function(_0x27698e){if(_0x27698e){_0x3cdde2[_0x6290('0x60')]=_0x27698e[_0x6290('0x5d')]({'plain':!![]});interaction_log[_0x6290('0x25')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x47fce5['user']['id'],_0x47fce5[_0x6290('0x5b')][_0x6290('0x35')],_0x47fce5[_0x6290('0x5b')][_0x6290('0x61')],_0x3cdde2[_0x6290('0x60')]['id'],_0x47fce5['body']?JSON[_0x6290('0x62')](_0x47fce5[_0x6290('0x55')]):'null');return respondWithRpcPromise('AcceptMessage',_0x6290('0x63'),_0x3cdde2);}return null;})[_0x6290('0x1e')](function(_0x366d4e){var _0x3a49bc=_0x6290('0x64')+_0x366d4e[_0x6290('0x24')]['ContactId'];return db[_0x6290('0x65')][_0x6290('0x3c')](_0x3a49bc,{'type':db[_0x6290('0x66')][_0x6290('0x67')]['SELECT'],'raw':!![]})[_0x6290('0x1e')](function(_0x30a372){return _0x30a372;});})[_0x6290('0x1e')](function(_0x5cd3f6){if(_0x5cd3f6){_0x3cdde2[_0x6290('0x24')][_0x6290('0x68')]=_0x5cd3f6[0x0];if(!_0x47fce5[_0x6290('0x55')][_0x6290('0x5c')])return;return db[_0x6290('0x69')][_0x6290('0x53')]({'where':{'id':_0x47fce5[_0x6290('0x55')]['UserId'],'role':_0x6290('0x6a')},'attributes':['id',_0x6290('0x35'),_0x6290('0x6b'),_0x6290('0x6c'),_0x6290('0x6d')],'raw':!![]});}return null;})[_0x6290('0x1e')](function(_0x54b091){if(!_0x54b091)return null;_0x3cdde2[_0x6290('0x24')][_0x6290('0x6a')]=_0x54b091;return _0x3cdde2;})[_0x6290('0x1e')](function(_0x35b836){if(_0x35b836){if(_0x47fce5['body'][_0x6290('0x6e')]){_0x3cdde2[_0x6290('0x24')][_0x6290('0x6f')]=util[_0x6290('0x59')]('SIP/%s',_0x47fce5[_0x6290('0x5b')][_0x6290('0x35')]);_0x3cdde2['message']['channel']=_0x3cdde2[_0x6290('0x70')];_0x3cdde2[_0x6290('0x24')][_0x6290('0x71')]=_0x3cdde2[_0x6290('0x70')];_0x3cdde2[_0x6290('0x24')][_0x6290('0x72')]=_0x6290('0x57');return respondWithRpcPromise(_0x6290('0x73'),_0x6290('0x73'),{'event':_0x6290('0x74'),'message':_0x3cdde2[_0x6290('0x24')]},client9002)[_0x6290('0x1e')](function(){return _0x3cdde2;});}return _0x3cdde2;}return null;})[_0x6290('0x1e')](respondWithResult(_0x4c499e,null))[_0x6290('0x26')](handleError(_0x4c499e,null));};var interaction_log=require(_0x6290('0x13'))(_0x6290('0x75'));exports[_0x6290('0x76')]=function(_0x494e67,_0x1ce880,_0x58bb3e){var _0x3964c6={'agent':{},'channel':_0x6290('0x77')};if(_0x494e67[_0x6290('0x55')]['id']){delete _0x494e67[_0x6290('0x55')]['id'];}_0x494e67['body']['UserId']=_0x494e67['body'][_0x6290('0x5c')]||_0x494e67[_0x6290('0x5b')]['id'];_0x3964c6[_0x6290('0x6a')]['id']=_0x494e67[_0x6290('0x55')][_0x6290('0x5c')];return db[_0x6290('0x4c')][_0x6290('0x53')]({'where':{'id':_0x494e67[_0x6290('0x51')]['id'],'UserId':null}})[_0x6290('0x1e')](handleEntityNotFound(_0x1ce880,null))[_0x6290('0x1e')](function(_0x4512ac){if(_0x4512ac){_0x3964c6[_0x6290('0x24')]=_0x4512ac['get']({'plain':!![]});return db[_0x6290('0x78')][_0x6290('0x53')]({'where':{'id':_0x4512ac[_0x6290('0x5e')]}});}return null;})[_0x6290('0x1e')](handleEntityNotFound(_0x1ce880,null))[_0x6290('0x1e')](function(_0x489a48){if(_0x489a48){_0x3964c6['interaction']=_0x489a48[_0x6290('0x5d')]({'plain':!![]});interaction_log[_0x6290('0x25')](_0x6290('0x79'),_0x494e67[_0x6290('0x5b')]['id'],_0x494e67['user'][_0x6290('0x35')],_0x494e67[_0x6290('0x5b')][_0x6290('0x61')],_0x3964c6[_0x6290('0x60')]['id'],_0x494e67[_0x6290('0x55')]?JSON[_0x6290('0x62')](_0x494e67[_0x6290('0x55')]):'null');return respondWithRpcPromise(_0x6290('0x7a'),_0x6290('0x7b'),_0x3964c6);}return null;})['then'](function(_0x262430){var _0x3e10d1=_0x6290('0x64')+_0x262430[_0x6290('0x24')][_0x6290('0x7c')];return db[_0x6290('0x65')][_0x6290('0x3c')](_0x3e10d1,{'type':db[_0x6290('0x66')]['QueryTypes'][_0x6290('0x7d')],'raw':!![]})[_0x6290('0x1e')](function(_0x332658){return _0x332658;});})[_0x6290('0x1e')](function(_0x7437e){if(_0x7437e){_0x3964c6['message'][_0x6290('0x68')]=_0x7437e[0x0];if(!_0x494e67[_0x6290('0x55')][_0x6290('0x5c')])return;return db[_0x6290('0x69')][_0x6290('0x53')]({'where':{'id':_0x494e67[_0x6290('0x55')]['UserId'],'role':'agent'},'attributes':['id',_0x6290('0x35'),_0x6290('0x6b'),_0x6290('0x6c'),_0x6290('0x6d')],'raw':!![]});}return null;})[_0x6290('0x1e')](function(_0x22b85f){if(!_0x22b85f)return null;_0x3964c6['message']['agent']=_0x22b85f;return _0x3964c6;})[_0x6290('0x1e')](function(_0x24749a){if(_0x24749a){_0x24749a['message'][_0x6290('0x6f')]=util[_0x6290('0x59')](_0x6290('0x7e'),_0x494e67[_0x6290('0x5b')]['name']);_0x24749a[_0x6290('0x24')][_0x6290('0x70')]=_0x3964c6[_0x6290('0x70')];_0x24749a[_0x6290('0x24')]['motionChannel']=_0x3964c6[_0x6290('0x70')];_0x24749a[_0x6290('0x24')][_0x6290('0x72')]=_0x6290('0x76');respondWithRpcPromise('EventManager',_0x6290('0x73'),{'event':_0x6290('0x7f'),'message':_0x24749a[_0x6290('0x24')]},client9002);return _0x3964c6;}return null;})['then'](respondWithResult(_0x1ce880,null))[_0x6290('0x26')](handleError(_0x1ce880,null));};exports[_0x6290('0x28')]=function(_0x4ac10c,_0x253e28,_0xc0cb3c){if(_0x4ac10c[_0x6290('0x55')]['id']){delete _0x4ac10c[_0x6290('0x55')]['id'];}var _0x626158;return db['SmsMessage']['find']({'where':{'id':_0x4ac10c[_0x6290('0x51')]['id']}})['then'](handleEntityNotFound(_0x253e28,null))[_0x6290('0x1e')](function(_0x276f5c){if(_0x276f5c){_0x626158=_0x276f5c;return db[_0x6290('0x80')][_0x6290('0x53')]({'where':{'id':_0x276f5c[_0x6290('0x81')]}});}})[_0x6290('0x1e')](handleEntityNotFound(_0x253e28,null))[_0x6290('0x1e')](function(_0x466576){if(_0x466576){logger[_0x6290('0x20')]('SmsMessage,\x20%s,\x20%s,\x20%s','status','received\x20delivery\x20report\x20from',_0x466576[_0x6290('0x3a')],util[_0x6290('0x82')](_0x4ac10c[_0x6290('0x55')],{'showHidden':![],'depth':null}));switch(_0x466576[_0x6290('0x3a')]){case _0x6290('0x83'):if(_0x4ac10c['body'][_0x6290('0x84')]&&_0x4ac10c['body'][_0x6290('0x84')]===_0x626158[_0x6290('0x85')]){return _0x626158['update']({'read':!![]});}else{logger[_0x6290('0x23')](_0x6290('0x86'),_0x6290('0x28'),'twilio',util['inspect'](_0x4ac10c[_0x6290('0x55')],{'showHidden':![],'depth':null}));}break;case _0x6290('0x87'):if(_0x4ac10c[_0x6290('0x55')]['MessageUUID']&&_0x4ac10c[_0x6290('0x55')]['MessageUUID']===_0x626158[_0x6290('0x85')]&&_['indexOf'](['sent',_0x6290('0x88')],_0x4ac10c[_0x6290('0x55')][_0x6290('0x89')])>=0x0){return _0x626158[_0x6290('0x32')]({'read':!![]});}else{logger['error'](_0x6290('0x86'),_0x6290('0x28'),'plivio',util['inspect'](_0x4ac10c[_0x6290('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x138c12=_0x4ac10c[_0x6290('0x55')]['results'][0x0];if(_0x138c12[_0x6290('0x28')][_0x6290('0x8a')]===_0x6290('0x8b')){return _0x626158[_0x6290('0x32')]({'read':!![]});}else{logger[_0x6290('0x23')](_0x6290('0x86'),_0x6290('0x28'),'infobip',util[_0x6290('0x82')](_0x4ac10c[_0x6290('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x626158;}})[_0x6290('0x1e')](respondWithResult(_0x253e28,null))[_0x6290('0x26')](handleError(_0x253e28,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index f4bea1b..ee95090 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 _0x2136=['hook','exports','events','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0xeb8b1c,_0x59fee9){var _0x37fb25=function(_0x171691){while(--_0x171691){_0xeb8b1c['push'](_0xeb8b1c['shift']());}};_0x37fb25(++_0x59fee9);}(_0x2136,0x9b));var _0x6213=function(_0x4671a5,_0x1db5f4){_0x4671a5=_0x4671a5-0x0;var _0x12f1ac=_0x2136[_0x4671a5];return _0x12f1ac;};'use strict';var EventEmitter=require(_0x6213('0x0'));var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x6213('0x1')](0x0);var events={'afterCreate':_0x6213('0x2'),'afterUpdate':_0x6213('0x3'),'afterDestroy':_0x6213('0x4')};function emitEvent(_0x5e1dc8){return function(_0x12a800,_0x31e56c,_0x2f6315){SmsMessageEvents[_0x6213('0x5')](_0x5e1dc8+':'+_0x12a800['id'],_0x12a800);SmsMessageEvents[_0x6213('0x5')](_0x5e1dc8,_0x12a800);_0x2f6315(null);};}for(var e in events){if(events[_0x6213('0x6')](e)){var event=events[e];SmsMessage[_0x6213('0x7')](e,emitEvent(event));}}module[_0x6213('0x8')]=SmsMessageEvents; \ No newline at end of file +var _0x1c44=['hook','exports','events','SmsMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x38496e,_0x4a4dba){var _0x41c0c7=function(_0x3c67f9){while(--_0x3c67f9){_0x38496e['push'](_0x38496e['shift']());}};_0x41c0c7(++_0x4a4dba);}(_0x1c44,0xde));var _0x41c4=function(_0x15434a,_0x10a30){_0x15434a=_0x15434a-0x0;var _0x1a310e=_0x1c44[_0x15434a];return _0x1a310e;};'use strict';var EventEmitter=require(_0x41c4('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x41c4('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x41c4('0x2')](0x0);var events={'afterCreate':_0x41c4('0x3'),'afterUpdate':_0x41c4('0x4'),'afterDestroy':_0x41c4('0x5')};function emitEvent(_0x5ac692){return function(_0x3c8b60,_0x391f29,_0x56c19b){SmsMessageEvents[_0x41c4('0x6')](_0x5ac692+':'+_0x3c8b60['id'],_0x3c8b60);SmsMessageEvents[_0x41c4('0x6')](_0x5ac692,_0x3c8b60);_0x56c19b(null);};}for(var e in events){if(events[_0x41c4('0x7')](e)){var event=events[e];SmsMessage[_0x41c4('0x8')](e,emitEvent(event));}}module[_0x41c4('0x9')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index fc2f466..0512d80 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 _0xe83d=['inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','login?username=','password','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','catch','Missing\x20parameters:\x20username,\x20password','deliveryReport','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','%s:%s','https://rest.clicksend.com/v3/sms/send','format','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','infobip','baseUrl','/auth/1/session','application/json','Missing\x20parameters:\x20base_url','csc','crypto','login','text','sort','length','apiKey','createHash','digest','hex','signature=','keys','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate'];(function(_0x412342,_0x180734){var _0x3e62cb=function(_0x501fc6){while(--_0x501fc6){_0x412342['push'](_0x412342['shift']());}};_0x3e62cb(++_0x180734);}(_0xe83d,0x1c6));var _0xde83=function(_0x5ce324,_0x43174f){_0x5ce324=_0x5ce324-0x0;var _0x158e15=_0xe83d[_0x5ce324];return _0x158e15;};'use strict';var _=require(_0xde83('0x0'));var util=require(_0xde83('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde83('0x2'));var BPromise=require('bluebird');var rp=require(_0xde83('0x3'));var fs=require('fs');var path=require(_0xde83('0x4'));var rimraf=require(_0xde83('0x5'));var config=require(_0xde83('0x6'));var attributes=require(_0xde83('0x7'));module[_0xde83('0x8')]=function(_0x4b884e,_0x179c16){return _0x4b884e[_0xde83('0x9')](_0xde83('0xa'),attributes,{'tableName':_0xde83('0xb'),'paranoid':![],'indexes':[{'name':_0xde83('0xc'),'fields':['messageId']},{'name':_0xde83('0xd'),'fields':[_0xde83('0xe')],'type':_0xde83('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2fb742,_0x3e46c8,_0x47a011){var _0x5cc909=_0x4b884e[_0xde83('0x10')];var _0x1d31a7=_0x2fb742[_0xde83('0x11')]({'plain':!![]});if(_0x1d31a7[_0xde83('0x12')][_0xde83('0x13')]()==='in'||_0x1d31a7[_0xde83('0x12')]['toLowerCase']()===_0xde83('0x14')&&!_0x1d31a7[_0xde83('0x15')]&&!_['isNil'](_0x1d31a7[_0xde83('0x16')])&&!_[_0xde83('0x17')](_0x1d31a7[_0xde83('0x18')])){_0x5cc909[_0xde83('0x19')][_0xde83('0x1a')]({'where':{'id':_0x1d31a7['SmsInteractionId']}})[_0xde83('0x1b')](function(_0x3d83d4){if(_0x3d83d4){_0x3d83d4[_0xde83('0x1c')]({'lastMsgAt':_0x1d31a7['createdAt'],'lastMsgDirection':_0x1d31a7[_0xde83('0x12')][_0xde83('0x13')]()});}})['catch'](function(_0x1a4023){console[_0xde83('0x1d')](_0x1a4023);});}if(_0x1d31a7[_0xde83('0x12')]==='out'&&!_0x1d31a7[_0xde83('0x15')]){var _0x4f9d4f;_0x5cc909[_0xde83('0x1e')][_0xde83('0x1f')]({'where':{'id':_0x1d31a7[_0xde83('0x20')]},'raw':!![]})['then'](function(_0x10ce92){_0x4f9d4f=_0x10ce92;if(_0x4f9d4f&&_0x4f9d4f[_0xde83('0x21')]){switch(_0x4f9d4f['type']){case'twilio':var _0x472ee7=require(_0xde83('0x22'));if(_0x4f9d4f['accountSid']&&_0x4f9d4f[_0xde83('0x23')]&&_0x4f9d4f[_0xde83('0x24')]){var _0x4e1fa5=new _0x472ee7(_0x4f9d4f[_0xde83('0x25')],_0x4f9d4f[_0xde83('0x23')]);_0x4e1fa5[_0xde83('0x26')][_0xde83('0x27')]({'body':_0x1d31a7[_0xde83('0xe')],'to':_0x1d31a7[_0xde83('0x24')],'from':_0x4f9d4f['phone'],'statusCallback':_0x4f9d4f[_0xde83('0x28')]+_0xde83('0x29')+_0x1d31a7['id']+_0xde83('0x2a')+_0x4f9d4f[_0xde83('0x2b')]})[_0xde83('0x1b')](function(_0x80c975){if(_0x80c975[_0xde83('0x2c')]){return _0x2fb742['update']({'messageId':_0x80c975['sid']});}})['catch'](function(_0x583e6e){logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x22'),util[_0xde83('0x2e')](_0x583e6e,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x22'),_0xde83('0x2f'));}break;case _0xde83('0x30'):var _0x1a4dd0=_0xde83('0x31');if(_0x4f9d4f[_0xde83('0x32')]&&_0x4f9d4f['password']){var _0x16143c={'recipient':[_0x1d31a7['phone']],'message':_0x1d31a7['body'],'message_type':_0x4f9d4f[_0xde83('0x33')]};if(_0x4f9d4f[_0xde83('0x33')]&&_0x4f9d4f[_0xde83('0x33')]!=='SI'){_0x16143c[_0xde83('0x34')]=_0x4f9d4f[_0xde83('0x24')];}var _0x3a162={'url':_0x1a4dd0+_0xde83('0x35')+_0x4f9d4f['username']+'&password='+_0x4f9d4f[_0xde83('0x36')],'method':_0xde83('0x37')};rp(_0x3a162)['then'](function(_0x3fa279){var _0x24df7e=_0x3fa279[_0xde83('0x38')](';');var _0x32be69={'user_key':_0x24df7e[0x0],'session_key':_0x24df7e[0x1]};_0x3a162={'url':_0x1a4dd0+_0xde83('0x39'),'method':_0xde83('0x3a'),'headers':{'user_key':_0x32be69[_0xde83('0x3b')],'Session_key':_0x32be69[_0xde83('0x3c')]},'json':!![],'body':_0x16143c};return rp(_0x3a162);})[_0xde83('0x1b')](function(_0x43da1a){if(_0x43da1a[_0xde83('0x3d')]>=0x1){var _0xb4b99a={'messageId':_0x43da1a[_0xde83('0x3e')]};if(_0x4f9d4f[_0xde83('0x33')]!=='GP'||!_0x4f9d4f['deliveryReport']){_0xb4b99a[_0xde83('0x3f')]=!![];}return _0x2fb742[_0xde83('0x1c')](_0xb4b99a);}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),'skebby',util[_0xde83('0x2e')](_0x43da1a,{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x416783){return logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x30'),util['inspect'](_0x416783,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x30'),_0xde83('0x42'));}break;case'connectel':if(_0x4f9d4f['authToken']){var _0x563603={'recipient':_0x1d31a7[_0xde83('0x24')],'message':_0x1d31a7[_0xde83('0xe')],'sender':_0x4f9d4f['senderString']||_0x4f9d4f[_0xde83('0x24')],'authorization':_0x4f9d4f[_0xde83('0x23')]};var _0x3e46c8={'method':_0xde83('0x3a'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x563603,'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x4b4e17){var _0x48dfd3={'messageId':_0x4b4e17['requestid']};if(!_0x4f9d4f[_0xde83('0x43')]){_0x48dfd3['read']=!![];}return _0x2fb742['update'](_0x48dfd3);})[_0xde83('0x41')](function(_0x41446a){logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x44'),util[_0xde83('0x2e')](_0x41446a,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel',_0xde83('0x45'));}break;case _0xde83('0x46'):if(_0x4f9d4f[_0xde83('0x32')]&&_0x4f9d4f[_0xde83('0x36')]){var _0x563603={'messages':[{'source':_0xde83('0x47'),'to':_0x1d31a7[_0xde83('0x24')],'body':_0x1d31a7[_0xde83('0xe')],'from':_0x4f9d4f[_0xde83('0x48')]||_0x4f9d4f[_0xde83('0x24')]}]};var _0x4cab0c=util['format'](_0xde83('0x49'),_0x4f9d4f[_0xde83('0x32')],_0x4f9d4f[_0xde83('0x36')]);var _0x3e46c8={'method':_0xde83('0x3a'),'uri':_0xde83('0x4a'),'body':_0x563603,'headers':{'Authorization':util[_0xde83('0x4b')]('Basic\x20%s',new Buffer(_0x4cab0c)[_0xde83('0x4c')](_0xde83('0x4d')))},'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x3c370c){if(_0x3c370c[_0xde83('0x4e')]>=0xc8&&_0x3c370c[_0xde83('0x4e')]<=0xce){if(_0x3c370c[_0xde83('0x4f')]&&_0x3c370c[_0xde83('0x4f')][_0xde83('0x50')]>0x0){var _0x4d9373=_[_0xde83('0x51')](_0x3c370c[_0xde83('0x4f')]['messages']);var _0x14075a={'messageId':_0x4d9373[_0xde83('0x52')]};if(!_0x4f9d4f[_0xde83('0x43')]){_0x14075a[_0xde83('0x3f')]=!![];}return _0x2fb742['update'](_0x14075a);}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),'clickSend',util[_0xde83('0x2e')](_0x3c370c,{'showHidden':![],'depth':null}));}}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),'clickSend',util[_0xde83('0x2e')](_0x3c370c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x531139){logger['error'](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x53'),util[_0xde83('0x2e')](_0x531139,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x53'),_0xde83('0x42'));}break;case _0xde83('0x54'):if(_0x4f9d4f[_0xde83('0x55')]&&_0x4f9d4f['authToken']){var _0x563603={'dst':_0x1d31a7[_0xde83('0x24')],'text':_0x1d31a7['body'],'src':_0x4f9d4f[_0xde83('0x48')]||_0x4f9d4f[_0xde83('0x24')],'url':_0x4f9d4f[_0xde83('0x28')]+_0xde83('0x29')+_0x1d31a7['id']+_0xde83('0x2a')+_0x4f9d4f[_0xde83('0x2b')]};var _0x4cab0c=util['format'](_0xde83('0x49'),_0x4f9d4f[_0xde83('0x55')],_0x4f9d4f[_0xde83('0x23')]);var _0x3e46c8={'method':_0xde83('0x3a'),'uri':util[_0xde83('0x4b')](_0xde83('0x56'),_0x4f9d4f[_0xde83('0x55')]),'body':_0x563603,'headers':{'Authorization':util['format'](_0xde83('0x57'),new Buffer(_0x4cab0c)[_0xde83('0x4c')]('base64'))},'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x1a909e){var _0x583176={'messageId':_0x1a909e['message_uuid'][0x0]};return _0x2fb742[_0xde83('0x1c')](_0x583176);})[_0xde83('0x41')](function(_0x59e2f8){logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x54'),util['inspect'](_0x59e2f8,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xde83('0x58'):if(_0x4f9d4f['username']&&_0x4f9d4f[_0xde83('0x36')]){if(_0x4f9d4f[_0xde83('0x59')]){var _0x47da8a={'method':_0xde83('0x3a'),'uri':_0x4f9d4f['baseUrl']+_0xde83('0x5a'),'body':{'username':_0x4f9d4f['username'],'password':_0x4f9d4f[_0xde83('0x36')]},'json':!![]};return rp(_0x47da8a)['then'](function(_0x434724){var _0x4842af={'method':'POST','uri':_0x4f9d4f[_0xde83('0x59')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x4f9d4f['phone'],'destinations':[{'to':_0x1d31a7[_0xde83('0x24')]}],'text':_0x1d31a7[_0xde83('0xe')],'notifyUrl':_0x4f9d4f[_0xde83('0x28')]+_0xde83('0x29')+_0x1d31a7['id']+_0xde83('0x2a')+_0x4f9d4f[_0xde83('0x2b')],'notifyContentType':_0xde83('0x5b'),'callbackData':_0x4f9d4f[_0xde83('0x24')]+';'+_0x1d31a7[_0xde83('0xe')]}]},'headers':{'Authorization':'IBSSO\x20'+_0x434724[_0xde83('0x2b')]},'json':!![]};return rp(_0x4842af)['then'](function(_0x3ad3c7){if(_0x3ad3c7[_0xde83('0x26')]){var _0x231878={'messageId':_0x3ad3c7['messages'][0x0][_0xde83('0xc')]};if(!_0x4f9d4f[_0xde83('0x43')]){_0x231878[_0xde83('0x3f')]=!![];}return _0x2fb742['update'](_0x231878);}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x58'),util['inspect'](_0x3ad3c7,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x31d00a){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x58'),util['inspect'](_0x31d00a,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x58'),_0xde83('0x5c'));}}else{logger['error'](_0xde83('0x40'),_0xde83('0x2d'),'infobip',_0xde83('0x42'));}break;case _0xde83('0x5d'):var _0x484a61=require(_0xde83('0x5e'));if(_0x4f9d4f['apiKey']){var _0x1dc59e={};_0x1dc59e[_0xde83('0x5f')]=_0x4f9d4f['username'];_0x1dc59e[_0xde83('0x24')]=_0x1d31a7[_0xde83('0x24')];_0x1dc59e['sender']=_0x4f9d4f[_0xde83('0x24')];_0x1dc59e[_0xde83('0x60')]=_0x1d31a7[_0xde83('0xe')];_0x1dc59e['timestamp']=+new Date();var _0x23566e='';var _0x5154cf='';var _0x31a62a=Object['keys'](_0x1dc59e);_0x31a62a[_0xde83('0x61')]();for(var _0x380bd1=0x0;_0x380bd1<_0x31a62a[_0xde83('0x62')];_0x380bd1++){if(_0x23566e!=''){_0x23566e+='&';}_0x23566e+=_0x31a62a[_0x380bd1]+'='+encodeURIComponent(_0x1dc59e[_0x31a62a[_0x380bd1]]);_0x5154cf+=_0x1dc59e[_0x31a62a[_0x380bd1]];}_0x5154cf+=_0x4f9d4f[_0xde83('0x63')];_0x5154cf=_0x484a61[_0xde83('0x64')]('md5')[_0xde83('0x1c')](_0x5154cf)[_0xde83('0x65')](_0xde83('0x66'));if(_0x23566e!==''){_0x23566e+='&';}_0x23566e+=_0xde83('0x67')+_0x5154cf;var _0x3a162={'method':'GET','uri':_0x4f9d4f[_0xde83('0x59')]+'/external/get/send.php?'+_0x23566e,'json':!![]};return rp(_0x3a162)[_0xde83('0x1b')](function(_0x3efcb5){var _0x2b3496=Object[_0xde83('0x68')](_0x3efcb5);if(_0x3efcb5[_0x2b3496[0x0]][_0xde83('0x1d')]&&parseInt(_0x3efcb5[_0x2b3496[0x0]][_0xde83('0x1d')])===0x0){var _0x117996={'messageId':_0x3efcb5[_0x2b3496[0x0]][_0xde83('0x69')]};if(!_0x4f9d4f['deliveryReport']){_0x117996[_0xde83('0x3f')]=!![];}return _0x2fb742['update'](_0x117996);}else{return logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),'csc',util[_0xde83('0x2e')](_0x3efcb5['error'],{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x10f448){return logger['error'](_0xde83('0x40'),_0xde83('0x2d'),'csc',util[_0xde83('0x2e')](_0x10f448,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x5d'),_0xde83('0x6a'));}break;case _0xde83('0x6b'):if(_0x4f9d4f[_0xde83('0x63')]){var _0x363671={'method':_0xde83('0x3a'),'uri':_0xde83('0x6c'),'headers':{'Authorization':_0x4f9d4f['apiKey']},'body':{'content':_0x1d31a7[_0xde83('0xe')],'to':[_0x1d31a7[_0xde83('0x24')]],'from':_0x4f9d4f[_0xde83('0x24')],'binary':![],'clientMessageId':_0xde83('0x6d'),'charset':'UTF-8'},'json':!![]};rp(_0x363671)[_0xde83('0x1b')](function(_0x5eb986){if(!_0x5eb986['error']){var _0x2e69e5={'messageId':_0x5eb986['messages'][0x0][_0xde83('0x6e')]};if(!_0x4f9d4f[_0xde83('0x43')]){_0x2e69e5[_0xde83('0x3f')]=!![];}return _0x2fb742[_0xde83('0x1c')](_0x2e69e5);}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),'afterCreate','clickatell',util['inspect'](_0x5eb986[_0xde83('0x1d')],{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x43778d){return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x6b'),util['inspect'](_0x43778d,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x6b'),_0xde83('0x6a'));}break;case _0xde83('0x6f'):if(_0x4f9d4f['username']&&_0x4f9d4f[_0xde83('0x36')]){var _0x4cab0c=util[_0xde83('0x4b')](_0xde83('0x49'),_0x4f9d4f[_0xde83('0x32')],_0x4f9d4f[_0xde83('0x36')]);var _0x3e46c8={'method':_0xde83('0x3a'),'uri':_0xde83('0x70')+_0x4f9d4f[_0xde83('0x71')]+_0xde83('0x72'),'body':{'to':[_0x1d31a7[_0xde83('0x24')]],'text':_0x1d31a7['body'],'from':_0x4f9d4f[_0xde83('0x24')],'applicationId':_0x4f9d4f['applicationId']},'headers':{'Authorization':util[_0xde83('0x4b')](_0xde83('0x57'),new Buffer(_0x4cab0c)[_0xde83('0x4c')](_0xde83('0x4d')))},'json':!![]};rp(_0x3e46c8)[_0xde83('0x1b')](function(_0x928029){if(_0x928029['id']){var _0x17dc29={'messageId':_0x928029['id']};return _0x2fb742['update'](_0x17dc29);}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xde83('0x2d'),_0xde83('0x6f'),util['inspect'](_0x928029,{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x2c372){logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x6f'),util[_0xde83('0x2e')](_0x2c372,{'showHidden':![],'depth':null}));});}else{logger[_0xde83('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xde83('0x6f'),_0xde83('0x42'));}break;case'intelepeer':if(_0x4f9d4f[_0xde83('0x63')]){var _0x5959bc={};var _0x3a162={'method':_0xde83('0x3a'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0xde83('0x73')+_0x4f9d4f[_0xde83('0x63')],'Content-Type':_0xde83('0x5b')},'body':{'from':_0x4f9d4f[_0xde83('0x24')],'to':_0x1d31a7['phone'],'text':_0x1d31a7['body']},'json':!![]};return rp(_0x3a162)[_0xde83('0x1b')](function(_0x43db23){if(_0x43db23[_0xde83('0x74')]==0xca){_0x5959bc[_0xde83('0x75')]=_0x43db23;var _0x4819f0={'method':_0xde83('0x3a'),'uri':_0xde83('0x76'),'headers':{'Authorization':_0xde83('0x73')+_0x4f9d4f[_0xde83('0x63')],'Content-Type':'application/json'},'body':{'refid':_0x5959bc[_0xde83('0x75')][_0xde83('0x77')]},'json':!![]};return rp(_0x4819f0)[_0xde83('0x1b')](function(_0x563977){_0x5959bc[_0xde83('0x78')]=_0x563977;var _0x58c8b5={'messageId':_0x5959bc[_0xde83('0x75')][_0xde83('0x77')],'read':!![]};return _0x2fb742['update'](_0x58c8b5);});}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),'afterCreate',_0xde83('0x79'),util[_0xde83('0x2e')](_0x43db23,{'showHidden':![],'depth':null}));}})[_0xde83('0x41')](function(_0x1356f9){return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x79'),util[_0xde83('0x2e')](_0x1356f9,{'showHidden':![],'depth':null}));});}else{return logger[_0xde83('0x1d')](_0xde83('0x40'),_0xde83('0x2d'),_0xde83('0x79'),_0xde83('0x7a'));}break;}}})[_0xde83('0x7b')](function(){_0x47a011();});}else{_0x47a011();}}},'charset':'utf8mb4','collate':_0xde83('0x7c')});}; \ No newline at end of file +var _0x4486=['get','direction','toLowerCase','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','out','SmsAccount','type','twilio','accountSid','authToken','phone','messages','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','skebby','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','username','xCALLY\x20Motion','%s:%s','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','read','clickSend','plivo','authId','/api/sms/messages/','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','remote','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','hex','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','uuid','UTF-8','apiMessageId','clickatell','bandwidth','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models'];(function(_0x478d2d,_0x1f87ee){var _0x2d9249=function(_0x13916c){while(--_0x13916c){_0x478d2d['push'](_0x478d2d['shift']());}};_0x2d9249(++_0x1f87ee);}(_0x4486,0xea));var _0x6448=function(_0x3a0c4f,_0x5dd1a3){_0x3a0c4f=_0x3a0c4f-0x0;var _0x247049=_0x4486[_0x3a0c4f];return _0x247049;};'use strict';var _=require(_0x6448('0x0'));var util=require(_0x6448('0x1'));var logger=require(_0x6448('0x2'))(_0x6448('0x3'));var moment=require(_0x6448('0x4'));var BPromise=require('bluebird');var rp=require(_0x6448('0x5'));var fs=require('fs');var path=require(_0x6448('0x6'));var rimraf=require(_0x6448('0x7'));var config=require(_0x6448('0x8'));var attributes=require(_0x6448('0x9'));module[_0x6448('0xa')]=function(_0x40511f,_0x5823fc){return _0x40511f['define'](_0x6448('0xb'),attributes,{'tableName':_0x6448('0xc'),'paranoid':![],'indexes':[{'name':_0x6448('0xd'),'fields':[_0x6448('0xd')]},{'name':_0x6448('0xe'),'fields':[_0x6448('0xf')],'type':_0x6448('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5834ca,_0x31ec37,_0x21ae61){var _0x735423=_0x40511f[_0x6448('0x11')];var _0x22caf3=_0x5834ca[_0x6448('0x12')]({'plain':!![]});if(_0x22caf3[_0x6448('0x13')][_0x6448('0x14')]()==='in'||_0x22caf3['direction'][_0x6448('0x14')]()==='out'&&!_0x22caf3[_0x6448('0x15')]&&!_[_0x6448('0x16')](_0x22caf3[_0x6448('0x17')])&&!_[_0x6448('0x16')](_0x22caf3[_0x6448('0x18')])){_0x735423[_0x6448('0x19')][_0x6448('0x1a')]({'where':{'id':_0x22caf3['SmsInteractionId']}})[_0x6448('0x1b')](function(_0x548f5c){if(_0x548f5c){_0x548f5c[_0x6448('0x1c')]({'lastMsgAt':_0x22caf3[_0x6448('0x1d')],'lastMsgDirection':_0x22caf3[_0x6448('0x13')][_0x6448('0x14')]()});}})[_0x6448('0x1e')](function(_0xec9018){console[_0x6448('0x1f')](_0xec9018);});}if(_0x22caf3[_0x6448('0x13')]===_0x6448('0x20')&&!_0x22caf3[_0x6448('0x15')]){var _0xac0ef5;_0x735423[_0x6448('0x21')]['find']({'where':{'id':_0x22caf3['SmsAccountId']},'raw':!![]})[_0x6448('0x1b')](function(_0x36e0ed){_0xac0ef5=_0x36e0ed;if(_0xac0ef5&&_0xac0ef5[_0x6448('0x22')]){switch(_0xac0ef5[_0x6448('0x22')]){case'twilio':var _0x1738d5=require(_0x6448('0x23'));if(_0xac0ef5[_0x6448('0x24')]&&_0xac0ef5[_0x6448('0x25')]&&_0xac0ef5[_0x6448('0x26')]){var _0x2c30f5=new _0x1738d5(_0xac0ef5[_0x6448('0x24')],_0xac0ef5[_0x6448('0x25')]);_0x2c30f5[_0x6448('0x27')]['create']({'body':_0x22caf3['body'],'to':_0x22caf3[_0x6448('0x26')],'from':_0xac0ef5['phone'],'statusCallback':_0xac0ef5['remote']+'/api/sms/messages/'+_0x22caf3['id']+'/status?token='+_0xac0ef5[_0x6448('0x28')]})['then'](function(_0x4f8a29){if(_0x4f8a29[_0x6448('0x29')]){return _0x5834ca[_0x6448('0x1c')]({'messageId':_0x4f8a29['sid']});}})[_0x6448('0x1e')](function(_0x21ebfb){logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x23'),util[_0x6448('0x2c')](_0x21ebfb,{'showHidden':![],'depth':null}));});}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x23'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6448('0x2d'):var _0x35c8e0='https://api.skebby.it/API/v1.0/REST/';if(_0xac0ef5['username']&&_0xac0ef5[_0x6448('0x2e')]){var _0x476338={'recipient':[_0x22caf3[_0x6448('0x26')]],'message':_0x22caf3[_0x6448('0xf')],'message_type':_0xac0ef5[_0x6448('0x2f')]};if(_0xac0ef5[_0x6448('0x2f')]&&_0xac0ef5['smsMethod']!=='SI'){_0x476338[_0x6448('0x30')]=_0xac0ef5[_0x6448('0x26')];}var _0x462d60={'url':_0x35c8e0+_0x6448('0x31')+_0xac0ef5['username']+_0x6448('0x32')+_0xac0ef5[_0x6448('0x2e')],'method':_0x6448('0x33')};rp(_0x462d60)[_0x6448('0x1b')](function(_0x59be66){var _0x4a7d7a=_0x59be66[_0x6448('0x34')](';');var _0x540091={'user_key':_0x4a7d7a[0x0],'session_key':_0x4a7d7a[0x1]};_0x462d60={'url':_0x35c8e0+_0x6448('0x35'),'method':_0x6448('0x36'),'headers':{'user_key':_0x540091[_0x6448('0x37')],'Session_key':_0x540091[_0x6448('0x38')]},'json':!![],'body':_0x476338};return rp(_0x462d60);})['then'](function(_0x4cab9a){if(_0x4cab9a['total_sent']>=0x1){var _0x2ae390={'messageId':_0x4cab9a[_0x6448('0x39')]};if(_0xac0ef5[_0x6448('0x2f')]!=='GP'||!_0xac0ef5[_0x6448('0x3a')]){_0x2ae390['read']=!![];}return _0x5834ca[_0x6448('0x1c')](_0x2ae390);}else{return logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6448('0x2d'),util[_0x6448('0x2c')](_0x4cab9a,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1e69cf){return logger['error'](_0x6448('0x2a'),_0x6448('0x2b'),'skebby',util[_0x6448('0x2c')](_0x1e69cf,{'showHidden':![],'depth':null}));});}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),'afterCreate','skebby',_0x6448('0x3b'));}break;case _0x6448('0x3c'):if(_0xac0ef5['authToken']){var _0x542a8c={'recipient':_0x22caf3[_0x6448('0x26')],'message':_0x22caf3[_0x6448('0xf')],'sender':_0xac0ef5[_0x6448('0x3d')]||_0xac0ef5[_0x6448('0x26')],'authorization':_0xac0ef5[_0x6448('0x25')]};var _0x31ec37={'method':_0x6448('0x36'),'uri':_0x6448('0x3e'),'body':_0x542a8c,'json':!![]};rp(_0x31ec37)[_0x6448('0x1b')](function(_0x4c4093){var _0x5746d5={'messageId':_0x4c4093[_0x6448('0x3f')]};if(!_0xac0ef5[_0x6448('0x3a')]){_0x5746d5['read']=!![];}return _0x5834ca['update'](_0x5746d5);})[_0x6448('0x1e')](function(_0x41b1de){logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6448('0x2b'),_0x6448('0x3c'),util[_0x6448('0x2c')](_0x41b1de,{'showHidden':![],'depth':null}));});}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x3c'),_0x6448('0x40'));}break;case _0x6448('0x41'):if(_0xac0ef5[_0x6448('0x42')]&&_0xac0ef5[_0x6448('0x2e')]){var _0x542a8c={'messages':[{'source':_0x6448('0x43'),'to':_0x22caf3['phone'],'body':_0x22caf3[_0x6448('0xf')],'from':_0xac0ef5[_0x6448('0x3d')]||_0xac0ef5[_0x6448('0x26')]}]};var _0x36632e=util['format'](_0x6448('0x44'),_0xac0ef5[_0x6448('0x42')],_0xac0ef5['password']);var _0x31ec37={'method':_0x6448('0x36'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x542a8c,'headers':{'Authorization':util[_0x6448('0x45')](_0x6448('0x46'),new Buffer(_0x36632e)[_0x6448('0x47')](_0x6448('0x48')))},'json':!![]};rp(_0x31ec37)[_0x6448('0x1b')](function(_0x17cd71){if(_0x17cd71[_0x6448('0x49')]>=0xc8&&_0x17cd71['http_code']<=0xce){if(_0x17cd71['data']&&_0x17cd71[_0x6448('0x4a')][_0x6448('0x4b')]>0x0){var _0x38cb80=_[_0x6448('0x4c')](_0x17cd71[_0x6448('0x4a')]['messages']);var _0x4ba6f1={'messageId':_0x38cb80[_0x6448('0x4d')]};if(!_0xac0ef5[_0x6448('0x3a')]){_0x4ba6f1[_0x6448('0x4e')]=!![];}return _0x5834ca[_0x6448('0x1c')](_0x4ba6f1);}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x4f'),util[_0x6448('0x2c')](_0x17cd71,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6448('0x2a'),'afterCreate',_0x6448('0x4f'),util[_0x6448('0x2c')](_0x17cd71,{'showHidden':![],'depth':null}));}})[_0x6448('0x1e')](function(_0x43e417){logger[_0x6448('0x1f')](_0x6448('0x2a'),'afterCreate',_0x6448('0x4f'),util[_0x6448('0x2c')](_0x43e417,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6448('0x2a'),'afterCreate',_0x6448('0x4f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6448('0x50'):if(_0xac0ef5[_0x6448('0x51')]&&_0xac0ef5['authToken']){var _0x542a8c={'dst':_0x22caf3[_0x6448('0x26')],'text':_0x22caf3[_0x6448('0xf')],'src':_0xac0ef5['senderString']||_0xac0ef5[_0x6448('0x26')],'url':_0xac0ef5['remote']+_0x6448('0x52')+_0x22caf3['id']+'/status?token='+_0xac0ef5['token']};var _0x36632e=util['format'](_0x6448('0x44'),_0xac0ef5[_0x6448('0x51')],_0xac0ef5['authToken']);var _0x31ec37={'method':_0x6448('0x36'),'uri':util[_0x6448('0x45')](_0x6448('0x53'),_0xac0ef5['authId']),'body':_0x542a8c,'headers':{'Authorization':util[_0x6448('0x45')](_0x6448('0x46'),new Buffer(_0x36632e)[_0x6448('0x47')](_0x6448('0x48')))},'json':!![]};rp(_0x31ec37)[_0x6448('0x1b')](function(_0x372408){var _0x1e7cc8={'messageId':_0x372408[_0x6448('0x54')][0x0]};return _0x5834ca[_0x6448('0x1c')](_0x1e7cc8);})['catch'](function(_0x8573c4){logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),'plivo',util['inspect'](_0x8573c4,{'showHidden':![],'depth':null}));});}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x50'),_0x6448('0x55'));}break;case'infobip':if(_0xac0ef5[_0x6448('0x42')]&&_0xac0ef5[_0x6448('0x2e')]){if(_0xac0ef5[_0x6448('0x56')]){var _0x4d66c1={'method':_0x6448('0x36'),'uri':_0xac0ef5['baseUrl']+_0x6448('0x57'),'body':{'username':_0xac0ef5[_0x6448('0x42')],'password':_0xac0ef5[_0x6448('0x2e')]},'json':!![]};return rp(_0x4d66c1)['then'](function(_0x5758d3){var _0x2b119c={'method':_0x6448('0x36'),'uri':_0xac0ef5[_0x6448('0x56')]+_0x6448('0x58'),'body':{'messages':[{'from':_0xac0ef5[_0x6448('0x26')],'destinations':[{'to':_0x22caf3[_0x6448('0x26')]}],'text':_0x22caf3[_0x6448('0xf')],'notifyUrl':_0xac0ef5[_0x6448('0x59')]+'/api/sms/messages/'+_0x22caf3['id']+'/status?token='+_0xac0ef5[_0x6448('0x28')],'notifyContentType':_0x6448('0x5a'),'callbackData':_0xac0ef5['phone']+';'+_0x22caf3['body']}]},'headers':{'Authorization':_0x6448('0x5b')+_0x5758d3[_0x6448('0x28')]},'json':!![]};return rp(_0x2b119c)[_0x6448('0x1b')](function(_0x4b139e){if(_0x4b139e[_0x6448('0x27')]){var _0x398a2e={'messageId':_0x4b139e[_0x6448('0x27')][0x0]['messageId']};if(!_0xac0ef5[_0x6448('0x3a')]){_0x398a2e[_0x6448('0x4e')]=!![];}return _0x5834ca[_0x6448('0x1c')](_0x398a2e);}else{return logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6448('0x2b'),'infobip',util[_0x6448('0x2c')](_0x4b139e,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x313024){return logger['error'](_0x6448('0x2a'),'afterCreate',_0x6448('0x5c'),util[_0x6448('0x2c')](_0x313024,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6448('0x2a'),'afterCreate',_0x6448('0x5c'),_0x6448('0x5d'));}}else{logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6448('0x5c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6448('0x5e'):var _0x12f4a3=require(_0x6448('0x5f'));if(_0xac0ef5[_0x6448('0x60')]){var _0xf91bdb={};_0xf91bdb[_0x6448('0x61')]=_0xac0ef5[_0x6448('0x42')];_0xf91bdb[_0x6448('0x26')]=_0x22caf3['phone'];_0xf91bdb[_0x6448('0x30')]=_0xac0ef5[_0x6448('0x26')];_0xf91bdb[_0x6448('0x62')]=_0x22caf3[_0x6448('0xf')];_0xf91bdb[_0x6448('0x63')]=+new Date();var _0xea987='';var _0x33d2f9='';var _0x22a190=Object[_0x6448('0x64')](_0xf91bdb);_0x22a190[_0x6448('0x65')]();for(var _0x596159=0x0;_0x596159<_0x22a190['length'];_0x596159++){if(_0xea987!=''){_0xea987+='&';}_0xea987+=_0x22a190[_0x596159]+'='+encodeURIComponent(_0xf91bdb[_0x22a190[_0x596159]]);_0x33d2f9+=_0xf91bdb[_0x22a190[_0x596159]];}_0x33d2f9+=_0xac0ef5[_0x6448('0x60')];_0x33d2f9=_0x12f4a3[_0x6448('0x66')](_0x6448('0x67'))[_0x6448('0x1c')](_0x33d2f9)['digest'](_0x6448('0x68'));if(_0xea987!==''){_0xea987+='&';}_0xea987+='signature='+_0x33d2f9;var _0x462d60={'method':'GET','uri':_0xac0ef5[_0x6448('0x56')]+_0x6448('0x69')+_0xea987,'json':!![]};return rp(_0x462d60)[_0x6448('0x1b')](function(_0x1320aa){var _0x28cea5=Object[_0x6448('0x64')](_0x1320aa);if(_0x1320aa[_0x28cea5[0x0]][_0x6448('0x1f')]&&parseInt(_0x1320aa[_0x28cea5[0x0]][_0x6448('0x1f')])===0x0){var _0x9dd0ad={'messageId':_0x1320aa[_0x28cea5[0x0]][_0x6448('0x6a')]};if(!_0xac0ef5['deliveryReport']){_0x9dd0ad[_0x6448('0x4e')]=!![];}return _0x5834ca[_0x6448('0x1c')](_0x9dd0ad);}else{return logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6448('0x2b'),'csc',util['inspect'](_0x1320aa[_0x6448('0x1f')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x24f337){return logger['error'](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x5e'),util[_0x6448('0x2c')](_0x24f337,{'showHidden':![],'depth':null}));});}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x5e'),_0x6448('0x6b'));}break;case'clickatell':if(_0xac0ef5[_0x6448('0x60')]){var _0xbfab11={'method':'POST','uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0xac0ef5[_0x6448('0x60')]},'body':{'content':_0x22caf3['body'],'to':[_0x22caf3['phone']],'from':_0xac0ef5[_0x6448('0x26')],'binary':![],'clientMessageId':_0x6448('0x6c'),'charset':_0x6448('0x6d')},'json':!![]};rp(_0xbfab11)['then'](function(_0x5de860){if(!_0x5de860[_0x6448('0x1f')]){var _0x1e748e={'messageId':_0x5de860[_0x6448('0x27')][0x0][_0x6448('0x6e')]};if(!_0xac0ef5[_0x6448('0x3a')]){_0x1e748e['read']=!![];}return _0x5834ca[_0x6448('0x1c')](_0x1e748e);}else{return logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6448('0x2b'),_0x6448('0x6f'),util[_0x6448('0x2c')](_0x5de860[_0x6448('0x1f')],{'showHidden':![],'depth':null}));}})[_0x6448('0x1e')](function(_0x13fc21){return logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x6f'),util[_0x6448('0x2c')](_0x13fc21,{'showHidden':![],'depth':null}));});}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),'clickatell',_0x6448('0x6b'));}break;case _0x6448('0x70'):if(_0xac0ef5['username']&&_0xac0ef5['password']){var _0x36632e=util[_0x6448('0x45')](_0x6448('0x44'),_0xac0ef5[_0x6448('0x42')],_0xac0ef5[_0x6448('0x2e')]);var _0x31ec37={'method':_0x6448('0x36'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0xac0ef5[_0x6448('0x71')]+_0x6448('0x72'),'body':{'to':[_0x22caf3[_0x6448('0x26')]],'text':_0x22caf3[_0x6448('0xf')],'from':_0xac0ef5[_0x6448('0x26')],'applicationId':_0xac0ef5[_0x6448('0x73')]},'headers':{'Authorization':util['format'](_0x6448('0x46'),new Buffer(_0x36632e)[_0x6448('0x47')](_0x6448('0x48')))},'json':!![]};rp(_0x31ec37)[_0x6448('0x1b')](function(_0x30d1c0){if(_0x30d1c0['id']){var _0x3f4851={'messageId':_0x30d1c0['id']};return _0x5834ca['update'](_0x3f4851);}else{logger[_0x6448('0x1f')](_0x6448('0x2a'),'afterCreate',_0x6448('0x70'),util[_0x6448('0x2c')](_0x30d1c0,{'showHidden':![],'depth':null}));}})[_0x6448('0x1e')](function(_0x899b95){logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x70'),util['inspect'](_0x899b95,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6448('0x70'),_0x6448('0x3b'));}break;case _0x6448('0x74'):if(_0xac0ef5['apiKey']){var _0x3f46f6={};var _0x462d60={'method':_0x6448('0x36'),'uri':_0x6448('0x75'),'headers':{'Authorization':_0x6448('0x76')+_0xac0ef5[_0x6448('0x60')],'Content-Type':'application/json'},'body':{'from':_0xac0ef5['phone'],'to':_0x22caf3['phone'],'text':_0x22caf3[_0x6448('0xf')]},'json':!![]};return rp(_0x462d60)['then'](function(_0x4d02ea){if(_0x4d02ea[_0x6448('0x77')]==0xca){_0x3f46f6['message']=_0x4d02ea;var _0x1c6985={'method':_0x6448('0x36'),'uri':_0x6448('0x78'),'headers':{'Authorization':'Bearer\x20'+_0xac0ef5[_0x6448('0x60')],'Content-Type':'application/json'},'body':{'refid':_0x3f46f6[_0x6448('0x79')][_0x6448('0x7a')]},'json':!![]};return rp(_0x1c6985)[_0x6448('0x1b')](function(_0x1e8f2f){_0x3f46f6['status']=_0x1e8f2f;var _0xd62d1f={'messageId':_0x3f46f6[_0x6448('0x79')]['refid'],'read':!![]};return _0x5834ca[_0x6448('0x1c')](_0xd62d1f);});}else{return logger[_0x6448('0x1f')](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x74'),util['inspect'](_0x4d02ea,{'showHidden':![],'depth':null}));}})[_0x6448('0x1e')](function(_0xf44313){return logger[_0x6448('0x1f')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6448('0x2b'),_0x6448('0x74'),util[_0x6448('0x2c')](_0xf44313,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x6448('0x2a'),_0x6448('0x2b'),_0x6448('0x74'),_0x6448('0x7b'));}break;}}})[_0x6448('0x7c')](function(){_0x21ae61();});}else{_0x21ae61();}}},'charset':_0x6448('0x7d'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 55a4296..0e5eb98 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 _0x34cf=['redis','defaults','localhost','socket.io-emitter','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsMessage','options','raw','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2fd641,_0xb2cde){var _0x423198=function(_0x26bccf){while(--_0x26bccf){_0x2fd641['push'](_0x2fd641['shift']());}};_0x423198(++_0xb2cde);}(_0x34cf,0x1b5));var _0xf34c=function(_0xfc3272,_0x5b017f){_0xfc3272=_0xfc3272-0x0;var _0x133dbe=_0x34cf[_0xfc3272];return _0x133dbe;};'use strict';var _=require('lodash');var util=require(_0xf34c('0x0'));var moment=require(_0xf34c('0x1'));var BPromise=require('bluebird');var rs=require(_0xf34c('0x2'));var fs=require('fs');var Redis=require(_0xf34c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf34c('0x4'));var logger=require(_0xf34c('0x5'))(_0xf34c('0x6'));var config=require(_0xf34c('0x7'));var jayson=require(_0xf34c('0x8'));var client=jayson[_0xf34c('0x9')][_0xf34c('0xa')]({'port':0x232a});config[_0xf34c('0xb')]=_[_0xf34c('0xc')](config[_0xf34c('0xb')],{'host':_0xf34c('0xd'),'port':0x18eb});var socket=require(_0xf34c('0xe'))(new Redis(config['redis']));require('./smsMessage.socket')[_0xf34c('0xf')](socket);function respondWithRpcPromise(_0x4fca7d,_0x369a7b,_0x5aa7f9){return new BPromise(function(_0x14cf09,_0x3e36db){return client[_0xf34c('0x10')](_0x4fca7d,_0x5aa7f9)[_0xf34c('0x11')](function(_0x636d4a){logger[_0xf34c('0x12')](_0xf34c('0x13'),_0x369a7b,_0xf34c('0x14'));logger[_0xf34c('0x15')](_0xf34c('0x16'),_0x369a7b,_0xf34c('0x14'),JSON[_0xf34c('0x17')](_0x636d4a));if(_0x636d4a['error']){if(_0x636d4a[_0xf34c('0x18')][_0xf34c('0x19')]===0x1f4){logger[_0xf34c('0x18')](_0xf34c('0x13'),_0x369a7b,_0x636d4a[_0xf34c('0x18')]['message']);return _0x3e36db(_0x636d4a[_0xf34c('0x18')]['message']);}logger[_0xf34c('0x18')]('SmsMessage,\x20%s,\x20%s',_0x369a7b,_0x636d4a[_0xf34c('0x18')][_0xf34c('0x1a')]);return _0x14cf09(_0x636d4a[_0xf34c('0x18')]['message']);}else{logger[_0xf34c('0x12')](_0xf34c('0x13'),_0x369a7b,_0xf34c('0x14'));_0x14cf09(_0x636d4a[_0xf34c('0x1b')][_0xf34c('0x1a')]);}})[_0xf34c('0x1c')](function(_0x21c9ca){logger[_0xf34c('0x18')](_0xf34c('0x13'),_0x369a7b,_0x21c9ca);_0x3e36db(_0x21c9ca);});});}exports[_0xf34c('0x1d')]=function(_0x41b413){var _0x4a758f=this;return new Promise(function(_0x15b5b6,_0x6a9223){return db['SmsMessage']['create'](_0x41b413['body'],{'raw':_0x41b413[_0xf34c('0x1e')]?_0x41b413[_0xf34c('0x1e')][_0xf34c('0x1f')]===undefined?!![]:![]:!![]})[_0xf34c('0x11')](function(_0x5a0bdd){logger[_0xf34c('0x12')]('CreateSmsMessage',_0x41b413);logger['debug'](_0xf34c('0x1d'),_0x41b413,JSON[_0xf34c('0x17')](_0x5a0bdd));_0x15b5b6(_0x5a0bdd);})[_0xf34c('0x1c')](function(_0x5cd640){logger['error']('CreateSmsMessage',_0x5cd640[_0xf34c('0x1a')],_0x41b413);_0x6a9223(_0x4a758f['error'](0x1f4,_0x5cd640['message']));});});}; \ No newline at end of file +var _0x9a80=['./smsMessage.socket','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter'];(function(_0x15555e,_0x4bc644){var _0x232fa5=function(_0x5e52b2){while(--_0x5e52b2){_0x15555e['push'](_0x15555e['shift']());}};_0x232fa5(++_0x4bc644);}(_0x9a80,0x1d1));var _0x09a8=function(_0x3d15de,_0x3a9fbc){_0x3d15de=_0x3d15de-0x0;var _0x4b79a2=_0x9a80[_0x3d15de];return _0x4b79a2;};'use strict';var _=require(_0x09a8('0x0'));var util=require(_0x09a8('0x1'));var moment=require(_0x09a8('0x2'));var BPromise=require(_0x09a8('0x3'));var rs=require(_0x09a8('0x4'));var fs=require('fs');var Redis=require(_0x09a8('0x5'));var db=require(_0x09a8('0x6'))['db'];var utils=require(_0x09a8('0x7'));var logger=require(_0x09a8('0x8'))('rpc');var config=require(_0x09a8('0x9'));var jayson=require(_0x09a8('0xa'));var client=jayson[_0x09a8('0xb')]['http']({'port':0x232a});config['redis']=_[_0x09a8('0xc')](config[_0x09a8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x09a8('0xe'))(new Redis(config['redis']));require(_0x09a8('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d729b,_0x19efe7,_0x33b338){return new BPromise(function(_0x4e7c97,_0x2ff32c){return client['request'](_0x4d729b,_0x33b338)[_0x09a8('0x10')](function(_0x11e171){logger[_0x09a8('0x11')]('SmsMessage,\x20%s,\x20%s',_0x19efe7,_0x09a8('0x12'));logger[_0x09a8('0x13')](_0x09a8('0x14'),_0x19efe7,_0x09a8('0x12'),JSON[_0x09a8('0x15')](_0x11e171));if(_0x11e171[_0x09a8('0x16')]){if(_0x11e171[_0x09a8('0x16')][_0x09a8('0x17')]===0x1f4){logger[_0x09a8('0x16')](_0x09a8('0x18'),_0x19efe7,_0x11e171['error'][_0x09a8('0x19')]);return _0x2ff32c(_0x11e171[_0x09a8('0x16')][_0x09a8('0x19')]);}logger[_0x09a8('0x16')](_0x09a8('0x18'),_0x19efe7,_0x11e171[_0x09a8('0x16')][_0x09a8('0x19')]);return _0x4e7c97(_0x11e171['error'][_0x09a8('0x19')]);}else{logger[_0x09a8('0x11')](_0x09a8('0x18'),_0x19efe7,'request\x20sent');_0x4e7c97(_0x11e171['result'][_0x09a8('0x19')]);}})[_0x09a8('0x1a')](function(_0x23f2fb){logger[_0x09a8('0x16')](_0x09a8('0x18'),_0x19efe7,_0x23f2fb);_0x2ff32c(_0x23f2fb);});});}exports[_0x09a8('0x1b')]=function(_0x48e28a){var _0x1ab8c8=this;return new Promise(function(_0x4cdb5b,_0x3d4796){return db[_0x09a8('0x1c')][_0x09a8('0x1d')](_0x48e28a[_0x09a8('0x1e')],{'raw':_0x48e28a[_0x09a8('0x1f')]?_0x48e28a[_0x09a8('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x09a8('0x10')](function(_0x2f0775){logger[_0x09a8('0x11')]('CreateSmsMessage',_0x48e28a);logger[_0x09a8('0x13')](_0x09a8('0x1b'),_0x48e28a,JSON[_0x09a8('0x15')](_0x2f0775));_0x4cdb5b(_0x2f0775);})[_0x09a8('0x1a')](function(_0x42ae13){logger[_0x09a8('0x16')](_0x09a8('0x1b'),_0x42ae13[_0x09a8('0x19')],_0x48e28a);_0x3d4796(_0x1ab8c8[_0x09a8('0x16')](0x1f4,_0x42ae13['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index f8b8b36..6eedb50 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 _0xafc2=['smsMessage:','./smsMessage.events','save','update','emit','removeListener','register','length'];(function(_0x5651ef,_0x4fd99a){var _0x392fba=function(_0x14c7dd){while(--_0x14c7dd){_0x5651ef['push'](_0x5651ef['shift']());}};_0x392fba(++_0x4fd99a);}(_0xafc2,0x1d9));var _0x2afc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xafc2[_0x1facfa];return _0x9ec701;};'use strict';var SmsMessageEvents=require(_0x2afc('0x0'));var events=[_0x2afc('0x1'),'remove',_0x2afc('0x2')];function createListener(_0x282d25,_0xae9eb9){return function(_0x48782e){_0xae9eb9[_0x2afc('0x3')](_0x282d25,_0x48782e);};}function removeListener(_0x406811,_0x525e4c){return function(){SmsMessageEvents[_0x2afc('0x4')](_0x406811,_0x525e4c);};}exports[_0x2afc('0x5')]=function(_0x36c90a){for(var _0x59307b=0x0,_0x5ed165=events[_0x2afc('0x6')];_0x59307b<_0x5ed165;_0x59307b++){var _0x1cb860=events[_0x59307b];var _0x5320c7=createListener(_0x2afc('0x7')+_0x1cb860,_0x36c90a);SmsMessageEvents['on'](_0x1cb860,_0x5320c7);}}; \ No newline at end of file +var _0x7ddc=['update','register','length','smsMessage:','save','remove'];(function(_0x2763f2,_0x416af8){var _0x3ef471=function(_0x288aa2){while(--_0x288aa2){_0x2763f2['push'](_0x2763f2['shift']());}};_0x3ef471(++_0x416af8);}(_0x7ddc,0x124));var _0xc7dd=function(_0x47017b,_0x23a83a){_0x47017b=_0x47017b-0x0;var _0x2d594b=_0x7ddc[_0x47017b];return _0x2d594b;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xc7dd('0x0'),_0xc7dd('0x1'),_0xc7dd('0x2')];function createListener(_0x5097d2,_0x2fae14){return function(_0x53bd0d){_0x2fae14['emit'](_0x5097d2,_0x53bd0d);};}function removeListener(_0x19e77f,_0x1d2f36){return function(){SmsMessageEvents['removeListener'](_0x19e77f,_0x1d2f36);};}exports[_0xc7dd('0x3')]=function(_0x418154){for(var _0x255b92=0x0,_0x450827=events[_0xc7dd('0x4')];_0x255b92<_0x450827;_0x255b92++){var _0x31a24b=events[_0x255b92];var _0xd93be2=createListener(_0xc7dd('0x5')+_0x31a24b,_0x418154);SmsMessageEvents['on'](_0x31a24b,_0xd93be2);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index b125f8c..916b124 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 _0x7daf=['/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','put','update','delete','removeTeams','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index'];(function(_0x349c20,_0x43850e){var _0x1fca2a=function(_0x3db1a3){while(--_0x3db1a3){_0x349c20['push'](_0x349c20['shift']());}};_0x1fca2a(++_0x43850e);}(_0x7daf,0x15b));var _0xf7da=function(_0x25a04e,_0x435456){_0x25a04e=_0x25a04e-0x0;var _0x195480=_0x7daf[_0x25a04e];return _0x195480;};'use strict';var multer=require('multer');var util=require(_0xf7da('0x0'));var path=require(_0xf7da('0x1'));var timeout=require(_0xf7da('0x2'));var express=require(_0xf7da('0x3'));var router=express[_0xf7da('0x4')]();var fs_extra=require(_0xf7da('0x5'));var auth=require(_0xf7da('0x6'));var interaction=require(_0xf7da('0x7'));var config=require(_0xf7da('0x8'));var controller=require(_0xf7da('0x9'));router[_0xf7da('0xa')]('/',auth[_0xf7da('0xb')](),controller[_0xf7da('0xc')]);router['get'](_0xf7da('0xd'),auth[_0xf7da('0xb')](),controller['describe']);router[_0xf7da('0xa')](_0xf7da('0xe'),auth[_0xf7da('0xb')](),controller[_0xf7da('0xf')]);router['get'](_0xf7da('0x10'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x11')]);router['get'](_0xf7da('0x12'),auth['isAuthenticated'](),controller[_0xf7da('0x13')]);router[_0xf7da('0xa')](_0xf7da('0x14'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x15')]);router[_0xf7da('0x16')]('/',auth[_0xf7da('0xb')](),controller[_0xf7da('0x17')]);router['post'](_0xf7da('0x12'),auth[_0xf7da('0xb')](),controller['addTeams']);router[_0xf7da('0x16')](_0xf7da('0x14'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x18')]);router[_0xf7da('0x19')](_0xf7da('0xe'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x1a')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xf7da('0x1b')](_0xf7da('0x12'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x1c')]);router[_0xf7da('0x1b')](_0xf7da('0x14'),auth[_0xf7da('0xb')](),controller[_0xf7da('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xa3b0=['/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa3b0,0x15f));var _0x0a3b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa3b0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x0a3b('0x0'));var timeout=require('connect-timeout');var express=require(_0x0a3b('0x1'));var router=express['Router']();var fs_extra=require(_0x0a3b('0x2'));var auth=require(_0x0a3b('0x3'));var interaction=require(_0x0a3b('0x4'));var config=require('../../config/environment');var controller=require(_0x0a3b('0x5'));router[_0x0a3b('0x6')]('/',auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x8')]);router['get'](_0x0a3b('0x9'),auth['isAuthenticated'](),controller[_0x0a3b('0xa')]);router['get'](_0x0a3b('0xb'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0xc')]);router[_0x0a3b('0x6')](_0x0a3b('0xd'),auth[_0x0a3b('0x7')](),controller['getMembers']);router['get'](_0x0a3b('0xe'),auth['isAuthenticated'](),controller[_0x0a3b('0xf')]);router[_0x0a3b('0x6')](_0x0a3b('0x10'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x11')]);router[_0x0a3b('0x12')]('/',auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x13')]);router[_0x0a3b('0x12')](_0x0a3b('0xe'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x14')]);router['post'](_0x0a3b('0x10'),auth[_0x0a3b('0x7')](),controller['addAgents']);router[_0x0a3b('0x15')](_0x0a3b('0xb'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x16')]);router['delete'](_0x0a3b('0xb'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x17')]);router[_0x0a3b('0x18')](_0x0a3b('0xe'),auth[_0x0a3b('0x7')](),controller[_0x0a3b('0x19')]);router[_0x0a3b('0x18')](_0x0a3b('0x10'),auth['isAuthenticated'](),controller[_0x0a3b('0x1a')]);module[_0x0a3b('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 34732e6..c22e6b3 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 _0x9d93=['INTEGER','ENUM','rrmemory','roundrobin','exports','name','STRING'];(function(_0x2e57d1,_0x4fae3a){var _0x2bb271=function(_0x129321){while(--_0x129321){_0x2e57d1['push'](_0x2e57d1['shift']());}};_0x2bb271(++_0x4fae3a);}(_0x9d93,0x1e0));var _0x39d9=function(_0x9d6c46,_0x412f52){_0x9d6c46=_0x9d6c46-0x0;var _0x4a3250=_0x9d93[_0x9d6c46];return _0x4a3250;};'use strict';var Sequelize=require('sequelize');module[_0x39d9('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x39d9('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x39d9('0x2')]},'timeout':{'type':Sequelize[_0x39d9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x39d9('0x4')](_0x39d9('0x5'),'beepall',_0x39d9('0x6'))}}; \ No newline at end of file +var _0x807d=['ENUM','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x49ef74,_0xa445fb){var _0x30f6fb=function(_0x25b52e){while(--_0x25b52e){_0x49ef74['push'](_0x49ef74['shift']());}};_0x30f6fb(++_0xa445fb);}(_0x807d,0x164));var _0xd807=function(_0xfb27d5,_0x341a17){_0xfb27d5=_0xfb27d5-0x0;var _0x524cb9=_0x807d[_0xfb27d5];return _0x524cb9;};'use strict';var Sequelize=require(_0xd807('0x0'));module[_0xd807('0x1')]={'name':{'type':Sequelize[_0xd807('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd807('0x2')]},'timeout':{'type':Sequelize[_0xd807('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd807('0x4')]('rrmemory','beepall',_0xd807('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 939fc6d..9244a4f 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 _0x7a54=['transaction','addTeams','each','findOrCreate','userSmsQueue:save','removeTeams','Team','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','QueryTypes','SELECT','every','includes','all','compact','isEmpty','forEach','userSmsQueue:remove','addAgents','omit','emit','removeAgents','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./smsQueue.socket','status','end','json','offset','undefined','count','set','Content-Range','update','destroy','then','get','SmsQueues','UserProfileResource','error','name','send','index','map','rawAttributes','fieldName','type','key','getOptions','where','SmsQueue','include','rows','catch','show','params','model','query','intersection','fields','attributes','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','limit','order','sort','filters','pick','filter','User','UserId','createdAt','format','%s/%s','smsPause','getTeams','keys','nolimit','ids','findAll','Agents','online','voicePause','interface','flatMap','sequelize'];(function(_0x6cc929,_0x4aa47a){var _0x596529=function(_0x350aca){while(--_0x350aca){_0x6cc929['push'](_0x6cc929['shift']());}};_0x596529(++_0x4aa47a);}(_0x7a54,0x106));var _0x47a5=function(_0x19eb61,_0x37c430){_0x19eb61=_0x19eb61-0x0;var _0x460c4c=_0x7a54[_0x19eb61];return _0x460c4c;};'use strict';var BPromise=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));var squel=require('squel');var Redis=require(_0x47a5('0x3'));var qs=require(_0x47a5('0x4'));var logger=require('../../config/logger')(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var db=require(_0x47a5('0x7'))['db'];config[_0x47a5('0x8')]=_[_0x47a5('0x9')](config['redis'],{'host':_0x47a5('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x47a5('0x8')]));require(_0x47a5('0xb'))['register'](socket);function respondWithStatusCode(_0x194fb0,_0x5077f3){_0x5077f3=_0x5077f3||0xcc;return function(_0x5d90b3){if(_0x5d90b3){return _0x194fb0['sendStatus'](_0x5077f3);}return _0x194fb0[_0x47a5('0xc')](_0x5077f3)[_0x47a5('0xd')]();};}function respondWithResult(_0x5e31dd,_0x2eb0dd){_0x2eb0dd=_0x2eb0dd||0xc8;return function(_0x49e844){if(_0x49e844){return _0x5e31dd['status'](_0x2eb0dd)[_0x47a5('0xe')](_0x49e844);}};}function respondWithFilteredResult(_0x69e4d4,_0x2f399b){return function(_0x250fad){if(_0x250fad){var _0xd612dd=typeof _0x2f399b[_0x47a5('0xf')]===_0x47a5('0x10')&&typeof _0x2f399b['limit']===_0x47a5('0x10');var _0x221b54=_0x250fad[_0x47a5('0x11')];var _0x711793=_0xd612dd?0x0:_0x2f399b[_0x47a5('0xf')];var _0x620ee9=_0xd612dd?_0x250fad[_0x47a5('0x11')]:_0x2f399b[_0x47a5('0xf')]+_0x2f399b['limit'];var _0x362359;if(_0x620ee9>=_0x221b54){_0x620ee9=_0x221b54;_0x362359=0xc8;}else{_0x362359=0xce;}_0x69e4d4[_0x47a5('0xc')](_0x362359);return _0x69e4d4[_0x47a5('0x12')](_0x47a5('0x13'),_0x711793+'-'+_0x620ee9+'/'+_0x221b54)[_0x47a5('0xe')](_0x250fad);}return null;};}function saveUpdates(_0x574af6){return function(_0x549de3){if(_0x549de3){return _0x549de3[_0x47a5('0x14')](_0x574af6)['then'](function(_0x5247fd){return _0x5247fd;});}return null;};}function removeEntity(_0x423a81){return function(_0xaf70a6){if(_0xaf70a6){return _0xaf70a6[_0x47a5('0x15')]()[_0x47a5('0x16')](function(){var _0x477b1d=_0xaf70a6[_0x47a5('0x17')]({'plain':!![]});var _0x2763d6=_0x47a5('0x18');return db[_0x47a5('0x19')]['destroy']({'where':{'type':_0x2763d6,'resourceId':_0x477b1d['id']}})[_0x47a5('0x16')](function(){return _0xaf70a6;});})[_0x47a5('0x16')](function(){_0x423a81['status'](0xcc)[_0x47a5('0xd')]();});}};}function handleEntityNotFound(_0x1f03f7){return function(_0x36874d){if(!_0x36874d){_0x1f03f7['sendStatus'](0x194);}return _0x36874d;};}function handleError(_0xb8ae6c,_0x2f142b){_0x2f142b=_0x2f142b||0x1f4;return function(_0x23db32){logger[_0x47a5('0x1a')](_0x23db32['stack']);if(_0x23db32[_0x47a5('0x1b')]){delete _0x23db32[_0x47a5('0x1b')];}_0xb8ae6c['status'](_0x2f142b)[_0x47a5('0x1c')](_0x23db32);};}exports[_0x47a5('0x1d')]=function(_0x4437f1,_0x129ce5){var _0x3abd6a={};var _0x50bf17={'count':0x0,'rows':[]};var _0x53078a=_[_0x47a5('0x1e')](db['SmsQueue'][_0x47a5('0x1f')],function(_0x5b6c4e){return{'name':_0x5b6c4e[_0x47a5('0x20')],'type':_0x5b6c4e[_0x47a5('0x21')][_0x47a5('0x22')]};});_0x3abd6a=qs[_0x47a5('0x23')](_0x53078a,_0x4437f1);var _0x21f296={'where':_0x3abd6a[_0x47a5('0x24')]};return db[_0x47a5('0x25')][_0x47a5('0x11')](_0x21f296)[_0x47a5('0x16')](function(_0x361bfa){_0x50bf17[_0x47a5('0x11')]=_0x361bfa;_0x3abd6a[_0x47a5('0x26')]=qs[_0x47a5('0x26')](_0x4437f1['query']);return db[_0x47a5('0x25')]['findAll'](_0x3abd6a);})[_0x47a5('0x16')](function(_0x9ac908){_0x50bf17[_0x47a5('0x27')]=_0x9ac908;return _0x50bf17;})['then'](respondWithFilteredResult(_0x129ce5,_0x3abd6a))[_0x47a5('0x28')](handleError(_0x129ce5,null));};exports[_0x47a5('0x29')]=function(_0x39b50b,_0x1f1c68){var _0x51cc81={'raw':!![],'where':{'id':_0x39b50b[_0x47a5('0x2a')]['id']}},_0x50d875={};_0x50d875[_0x47a5('0x2b')]=_['keys'](db['SmsQueue'][_0x47a5('0x1f')]);_0x50d875[_0x47a5('0x2c')]=_['keys'](_0x39b50b[_0x47a5('0x2c')]);_0x50d875['filters']=_[_0x47a5('0x2d')](_0x50d875[_0x47a5('0x2b')],_0x50d875['query']);_0x51cc81['attributes']=_[_0x47a5('0x2d')](_0x50d875['model'],qs[_0x47a5('0x2e')](_0x39b50b[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x51cc81['attributes']=_0x51cc81[_0x47a5('0x2f')]['length']?_0x51cc81['attributes']:_0x50d875[_0x47a5('0x2b')];if(_0x39b50b['query'][_0x47a5('0x30')]){_0x51cc81['include']=[{'all':!![]}];}_0x51cc81=_[_0x47a5('0x31')]({},_0x51cc81,_0x39b50b[_0x47a5('0x32')]);return db[_0x47a5('0x25')][_0x47a5('0x33')](_0x51cc81)[_0x47a5('0x16')](handleEntityNotFound(_0x1f1c68,null))[_0x47a5('0x16')](respondWithResult(_0x1f1c68,null))[_0x47a5('0x28')](handleError(_0x1f1c68,null));};exports[_0x47a5('0x34')]=function(_0x1a0d23,_0x4caed5){return db[_0x47a5('0x25')][_0x47a5('0x34')](_0x1a0d23['body'],{})[_0x47a5('0x16')](function(_0x2bf53d){var _0x1d4348=_0x1a0d23['user'][_0x47a5('0x17')]({'plain':!![]});if(!_0x1d4348)throw new Error(_0x47a5('0x35'));if(_0x1d4348['role']===_0x47a5('0x36')){var _0x19218a=_0x2bf53d['get']({'plain':!![]});var _0x55c5eb='SmsQueues';return db[_0x47a5('0x37')]['find']({'where':{'name':_0x55c5eb,'userProfileId':_0x1d4348[_0x47a5('0x38')]},'raw':!![]})[_0x47a5('0x16')](function(_0x301a85){if(_0x301a85&&_0x301a85[_0x47a5('0x39')]===0x0){return db[_0x47a5('0x19')][_0x47a5('0x34')]({'name':_0x19218a[_0x47a5('0x1b')],'resourceId':_0x19218a['id'],'type':_0x301a85[_0x47a5('0x1b')],'sectionId':_0x301a85['id']},{})[_0x47a5('0x16')](function(){return _0x2bf53d;});}else{return _0x2bf53d;}})[_0x47a5('0x28')](function(_0x280500){logger[_0x47a5('0x1a')](_0x47a5('0x3a'),_0x280500);throw _0x280500;});}return _0x2bf53d;})['then'](respondWithResult(_0x4caed5,0xc9))[_0x47a5('0x28')](handleError(_0x4caed5,null));};exports[_0x47a5('0x14')]=function(_0x331474,_0x23bd8d){if(_0x331474['body']['id']){delete _0x331474[_0x47a5('0x3b')]['id'];}return db['SmsQueue']['find']({'where':{'id':_0x331474['params']['id']}})['then'](handleEntityNotFound(_0x23bd8d,null))[_0x47a5('0x16')](saveUpdates(_0x331474['body'],null))[_0x47a5('0x16')](respondWithResult(_0x23bd8d,null))[_0x47a5('0x28')](handleError(_0x23bd8d,null));};exports[_0x47a5('0x15')]=function(_0x494526,_0x3805fd){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x494526['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3805fd,null))['then'](removeEntity(_0x3805fd,null))[_0x47a5('0x28')](handleError(_0x3805fd,null));};exports[_0x47a5('0x3c')]=function(_0x188614,_0xd75ca3){return db[_0x47a5('0x25')][_0x47a5('0x3c')]()[_0x47a5('0x16')](respondWithResult(_0xd75ca3,null))[_0x47a5('0x28')](handleError(_0xd75ca3,null));};exports[_0x47a5('0x3d')]=function(_0x162fa0,_0x24ecb1){var _0x3c3ebf={'raw':!![],'where':{}},_0xe28d76={},_0x3574d4;return db[_0x47a5('0x25')][_0x47a5('0x3e')]({'where':{'id':_0x162fa0['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x24ecb1,null))[_0x47a5('0x16')](function(_0x49eab1){if(_0x49eab1){_0x3574d4=_0x49eab1['get']({'plain':!![]});_0xe28d76[_0x47a5('0x2b')]=_['keys'](db[_0x47a5('0x3f')][_0x47a5('0x1f')]);_0xe28d76['query']=_['keys'](_0x162fa0[_0x47a5('0x2c')]);_0xe28d76['filters']=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],_0xe28d76[_0x47a5('0x2c')]);_0x3c3ebf[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0xe28d76[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x162fa0['query']['fields']));_0x3c3ebf[_0x47a5('0x2f')]=_0x3c3ebf[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x3c3ebf[_0x47a5('0x2f')]:_0xe28d76[_0x47a5('0x2b')];if(!_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x41')]('nolimit')){_0x3c3ebf[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x162fa0[_0x47a5('0x2c')]['limit']);_0x3c3ebf[_0x47a5('0xf')]=qs['offset'](_0x162fa0[_0x47a5('0x2c')][_0x47a5('0xf')]);}_0x3c3ebf[_0x47a5('0x43')]=qs[_0x47a5('0x44')](_0x162fa0['query'][_0x47a5('0x44')]);_0x3c3ebf[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_[_0x47a5('0x46')](_0x162fa0[_0x47a5('0x2c')],_0xe28d76[_0x47a5('0x45')]));_0x3c3ebf[_0x47a5('0x24')]['SmsQueueId']=_0x49eab1['id'];if(_0x162fa0[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x3c3ebf[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x3c3ebf[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x3c3ebf['attributes'],function(_0x1ad6a9){var _0x245a15={};_0x245a15[_0x1ad6a9]={'$like':'%'+_0x162fa0[_0x47a5('0x2c')]['filter']+'%'};return _0x245a15;})});}_0x3c3ebf=_[_0x47a5('0x31')]({},_0x3c3ebf,_0x162fa0[_0x47a5('0x32')]);return db[_0x47a5('0x3f')]['findAll'](_0x3c3ebf);}})['then'](function(_0x274e38){if(_0x274e38){return db[_0x47a5('0x48')]['findAndCountAll']({'where':{'id':_['map'](_0x274e38,_0x47a5('0x49')),'role':'agent'},'attributes':['id',_0x47a5('0x1b'),'smsPause','updatedAt',_0x47a5('0x4a')]});}})[_0x47a5('0x16')](function(_0x53eedf){if(_0x53eedf){return{'count':_0x53eedf[_0x47a5('0x11')],'rows':_[_0x47a5('0x1e')](_0x53eedf['rows'],function(_0x5b6127){return{'membername':_0x5b6127[_0x47a5('0x1b')],'UserId':_0x5b6127['id'],'queue_name':_0x3574d4[_0x47a5('0x1b')],'SmsQueueId':_0x3574d4['id'],'interface':util[_0x47a5('0x4b')](_0x47a5('0x4c'),'SIP',_0x5b6127[_0x47a5('0x1b')]),'penalty':0x0,'paused':_0x5b6127[_0x47a5('0x4d')],'createdAt':_0x5b6127[_0x47a5('0x4a')],'updatedAt':_0x5b6127['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x47a5('0x16')](respondWithFilteredResult(_0x24ecb1,_0x3c3ebf))['catch'](handleError(_0x24ecb1,null));};exports[_0x47a5('0x4e')]=function(_0x470da6,_0x943a15){var _0x1c485b={};var _0x3603b7={};var _0x4966af;var _0x144af9;return db['SmsQueue']['findOne']({'where':{'id':_0x470da6['params']['id']}})['then'](handleEntityNotFound(_0x943a15,null))[_0x47a5('0x16')](function(_0x6cd4ea){if(_0x6cd4ea){_0x4966af=_0x6cd4ea;_0x3603b7[_0x47a5('0x2b')]=_['keys'](db['Team'][_0x47a5('0x1f')]);_0x3603b7[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x470da6[_0x47a5('0x2c')]);_0x3603b7[_0x47a5('0x45')]=_['intersection'](_0x3603b7[_0x47a5('0x2b')],_0x3603b7['query']);_0x1c485b[_0x47a5('0x2f')]=_[_0x47a5('0x2d')](_0x3603b7['model'],qs[_0x47a5('0x2e')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x1c485b[_0x47a5('0x2f')]=_0x1c485b[_0x47a5('0x2f')][_0x47a5('0x40')]?_0x1c485b[_0x47a5('0x2f')]:_0x3603b7[_0x47a5('0x2b')];_0x1c485b['order']=qs[_0x47a5('0x44')](_0x470da6[_0x47a5('0x2c')][_0x47a5('0x44')]);_0x1c485b[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x470da6[_0x47a5('0x2c')],_0x3603b7[_0x47a5('0x45')]));if(_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x1c485b[_0x47a5('0x24')]=_[_0x47a5('0x31')](_0x1c485b[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x1c485b[_0x47a5('0x2f')],function(_0x44cb90){var _0x1d56f3={};_0x1d56f3[_0x44cb90]={'$like':'%'+_0x470da6[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x1d56f3;})});}_0x1c485b=_[_0x47a5('0x31')]({},_0x1c485b,_0x470da6[_0x47a5('0x32')]);return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x284fb8){if(_0x284fb8){_0x144af9=_0x284fb8[_0x47a5('0x40')];if(!_0x470da6['query'][_0x47a5('0x41')](_0x47a5('0x50'))){_0x1c485b[_0x47a5('0x42')]=qs[_0x47a5('0x42')](_0x470da6['query'][_0x47a5('0x42')]);_0x1c485b['offset']=qs[_0x47a5('0xf')](_0x470da6['query'][_0x47a5('0xf')]);}return _0x4966af['getTeams'](_0x1c485b);}})[_0x47a5('0x16')](function(_0x2f27c3){if(_0x2f27c3){return _0x2f27c3?{'count':_0x144af9,'rows':_0x2f27c3}:null;}})[_0x47a5('0x16')](respondWithResult(_0x943a15,null))['catch'](handleError(_0x943a15,null));};exports['addTeams']=function(_0x4b8084,_0x4164a3){var _0x2b1303=_0x4b8084[_0x47a5('0x3b')][_0x47a5('0x51')];return db['Team'][_0x47a5('0x52')]({'where':{'id':_0x2b1303},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id',_0x47a5('0x1b'),_0x47a5('0x54'),_0x47a5('0x55'),_0x47a5('0x56')],'raw':!![]}]})[_0x47a5('0x16')](function(_0x4618a0){if(_0x4618a0){var _0xc69a68=_[_0x47a5('0x57')](_0x4618a0,function(_0x463e5e){var _0x49d3dc=_0x463e5e[_0x47a5('0x17')]({'plain':!![]});return _0x49d3dc['Agents'];});return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x4b8084[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x40e584){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x448981){return _0x40e584[_0x47a5('0x5a')](_0x2b1303,{'transaction':_0x448981})[_0x47a5('0x16')](function(){return BPromise[_0x47a5('0x5b')](_0xc69a68,function(_0x1f07ac){return db[_0x47a5('0x3f')][_0x47a5('0x5c')]({'where':{'UserId':_0x1f07ac['id'],'SmsQueueId':_0x4b8084[_0x47a5('0x2a')]['id']},'transaction':_0x448981});});})['then'](function(){_0xc69a68['forEach'](function(_0x5ccc89){socket['emit'](_0x47a5('0x5d'),{'UserId':_0x5ccc89['id'],'SmsQueueId':_0x40e584['id']});});});});});}})[_0x47a5('0x16')](respondWithStatusCode(_0x4164a3,null))['catch'](handleError(_0x4164a3,null));};exports[_0x47a5('0x5e')]=function(_0x44dda2,_0x1baa5a){return db[_0x47a5('0x5f')][_0x47a5('0x52')]({'where':{'id':_0x44dda2[_0x47a5('0x2c')][_0x47a5('0x51')]},'attributes':['id'],'include':[{'model':db[_0x47a5('0x48')],'as':_0x47a5('0x53'),'attributes':['id'],'raw':!![]}]})[_0x47a5('0x16')](handleEntityNotFound(_0x1baa5a,null))[_0x47a5('0x16')](function(_0x5e5f16){var _0x18fa31=_[_0x47a5('0x1e')](_0x5e5f16,'id');var _0x420671=[];var _0x4f35ff=[];var _0x340846=squel[_0x47a5('0x60')]();_0x340846[_0x47a5('0x61')]('tq.TeamId')[_0x47a5('0x62')]('team_has_sms_queues','tq')['join'](_0x47a5('0x63'),'ut',_0x47a5('0x64'))[_0x47a5('0x24')](_0x47a5('0x65'),_0x44dda2[_0x47a5('0x2a')]['id']);for(var _0xea50f3=0x0;_0xea50f3<_0x5e5f16['length'];_0xea50f3+=0x1){let _0x592322=_0x5e5f16[_0xea50f3];for(var _0x3e0dbd=0x0;_0x3e0dbd<_0x592322['Agents'][_0x47a5('0x40')];_0x3e0dbd+=0x1){let _0x3fffd1=_0x592322[_0x47a5('0x53')][_0x3e0dbd];var _0xb16bdd=_0x340846['clone']();_0xb16bdd[_0x47a5('0x24')]('ut.UserId\x20=\x20?',_0x3fffd1['id']);_0x4f35ff['push'](db[_0x47a5('0x58')][_0x47a5('0x2c')](_0xb16bdd['toString'](),{'type':db[_0x47a5('0x58')][_0x47a5('0x66')][_0x47a5('0x67')]})['then'](function(_0x280372){if(_0x280372['length']===0x1){return _0x3fffd1['id'];}else{var _0x2307da=_[_0x47a5('0x68')](_[_0x47a5('0x1e')](_0x280372,'TeamId'),function(_0x2e0af1){return _[_0x47a5('0x69')](_0x18fa31,_0x2e0af1);});if(_0x2307da){return _0x3fffd1['id'];}}}));}}return BPromise[_0x47a5('0x6a')](_0x4f35ff)['then'](function(_0x3525e7){_0x420671=_(_0x420671)['union'](_0x3525e7)[_0x47a5('0x6b')]()['value']();return db[_0x47a5('0x25')][_0x47a5('0x33')]({'where':{'id':_0x44dda2[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](function(_0x51738b){return db[_0x47a5('0x58')][_0x47a5('0x59')](function(_0x23c393){return _0x51738b[_0x47a5('0x5e')](_0x44dda2[_0x47a5('0x2c')]['ids'],{'transaction':_0x23c393})['then'](function(){if(!_[_0x47a5('0x6c')](_0x420671)){return _0x51738b['removeAgents'](_0x420671,{'transaction':_0x23c393});}})[_0x47a5('0x16')](function(){_0x420671[_0x47a5('0x6d')](function(_0x216402){socket['emit'](_0x47a5('0x6e'),{'UserId':_0x216402,'SmsQueueId':_0x51738b['id']});});});});});});})[_0x47a5('0x16')](respondWithStatusCode(_0x1baa5a,null))['catch'](handleError(_0x1baa5a,null));};exports[_0x47a5('0x6f')]=function(_0x8a9dea,_0x19acfa){return db[_0x47a5('0x25')]['find']({'where':{'id':_0x8a9dea['params']['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x19acfa,null))[_0x47a5('0x16')](function(_0x48e7f3){if(_0x48e7f3){return _0x48e7f3[_0x47a5('0x6f')](_0x8a9dea[_0x47a5('0x3b')]['ids'],_[_0x47a5('0x70')](_0x8a9dea[_0x47a5('0x3b')],[_0x47a5('0x51'),'id'])||{})['spread'](function(_0x3f2ad9){for(var _0x59b4a5=0x0;_0x59b4a5<_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x47a5('0x40')];_0x59b4a5+=0x1){socket[_0x47a5('0x71')]('userSmsQueue:save',{'UserId':Number(_0x8a9dea[_0x47a5('0x3b')]['ids'][_0x59b4a5]),'SmsQueueId':Number(_0x8a9dea[_0x47a5('0x2a')]['id'])});}return _0x3f2ad9;});}})[_0x47a5('0x16')](respondWithResult(_0x19acfa,null))[_0x47a5('0x28')](handleError(_0x19acfa,null));};exports[_0x47a5('0x72')]=function(_0x49b76a,_0x3eb5c1){return db['SmsQueue']['find']({'where':{'id':_0x49b76a[_0x47a5('0x2a')]['id']}})[_0x47a5('0x16')](handleEntityNotFound(_0x3eb5c1,null))[_0x47a5('0x16')](function(_0x96fb22){if(_0x96fb22){return _0x96fb22[_0x47a5('0x72')](_0x49b76a['query'][_0x47a5('0x51')])[_0x47a5('0x16')](function(){if(_[_0x47a5('0x73')](_0x49b76a[_0x47a5('0x2c')]['ids'])){for(var _0x240db9=0x0;_0x240db9<_0x49b76a['query'][_0x47a5('0x51')][_0x47a5('0x40')];_0x240db9+=0x1){socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a[_0x47a5('0x2c')][_0x47a5('0x51')][_0x240db9]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}}else{socket[_0x47a5('0x71')](_0x47a5('0x6e'),{'UserId':Number(_0x49b76a['query'][_0x47a5('0x51')]),'SmsQueueId':Number(_0x49b76a[_0x47a5('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3eb5c1,null))[_0x47a5('0x28')](handleError(_0x3eb5c1,null));};exports[_0x47a5('0x74')]=function(_0x6d6a5,_0x5b85cd){var _0x4bf1f5={};var _0x126bb1={};var _0x3d7371;var _0x47fbb6;return db['SmsQueue'][_0x47a5('0x3e')]({'where':{'id':_0x6d6a5[_0x47a5('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5b85cd,null))[_0x47a5('0x16')](function(_0x269ff6){if(_0x269ff6){_0x3d7371=_0x269ff6;_0x126bb1['model']=_[_0x47a5('0x4f')](db[_0x47a5('0x48')][_0x47a5('0x1f')]);_0x126bb1[_0x47a5('0x2c')]=_[_0x47a5('0x4f')](_0x6d6a5[_0x47a5('0x2c')]);_0x126bb1['filters']=_['intersection'](_0x126bb1['model'],_0x126bb1[_0x47a5('0x2c')]);_0x4bf1f5[_0x47a5('0x2f')]=_['intersection'](_0x126bb1[_0x47a5('0x2b')],qs[_0x47a5('0x2e')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x2e')]));_0x4bf1f5[_0x47a5('0x2f')]=_0x4bf1f5['attributes'][_0x47a5('0x40')]?_0x4bf1f5['attributes']:_0x126bb1['model'];_0x4bf1f5['order']=qs[_0x47a5('0x44')](_0x6d6a5['query'][_0x47a5('0x44')]);_0x4bf1f5[_0x47a5('0x24')]=qs[_0x47a5('0x45')](_['pick'](_0x6d6a5[_0x47a5('0x2c')],_0x126bb1[_0x47a5('0x45')]));if(_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]){_0x4bf1f5[_0x47a5('0x24')]=_['merge'](_0x4bf1f5[_0x47a5('0x24')],{'$or':_[_0x47a5('0x1e')](_0x4bf1f5['attributes'],function(_0x42ba59){var _0x419870={};_0x419870[_0x42ba59]={'$like':'%'+_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x47')]+'%'};return _0x419870;})});}_0x4bf1f5=_[_0x47a5('0x31')]({},_0x4bf1f5,_0x6d6a5[_0x47a5('0x32')]);return _0x3d7371['getAgents'](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x2e418d){if(_0x2e418d){_0x47fbb6=_0x2e418d['length'];if(!_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0x41')](_0x47a5('0x50'))){_0x4bf1f5[_0x47a5('0x42')]=qs['limit'](_0x6d6a5['query']['limit']);_0x4bf1f5['offset']=qs[_0x47a5('0xf')](_0x6d6a5[_0x47a5('0x2c')][_0x47a5('0xf')]);}return _0x3d7371[_0x47a5('0x74')](_0x4bf1f5);}})[_0x47a5('0x16')](function(_0x6bc37b){if(_0x6bc37b){return _0x6bc37b?{'count':_0x47fbb6,'rows':_0x6bc37b}:null;}})[_0x47a5('0x16')](respondWithResult(_0x5b85cd,null))[_0x47a5('0x28')](handleError(_0x5b85cd,null));}; \ No newline at end of file +var _0xadb5=['%s/%s','pick','filter','getTeams','addTeams','ids','findAll','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','forEach','userSmsQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_sms_queues','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','find','isEmpty','removeAgents','emit','userSmsQueue:remove','addAgents','omit','spread','isArray','getAgents','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','update','then','destroy','SmsQueues','UserProfileResource','error','stack','name','send','index','SmsQueue','rawAttributes','type','key','getOptions','where','count','include','query','rows','catch','show','model','keys','filters','fields','attributes','length','includeAll','options','create','user','get','role','autoAssociation','body','params','describe','getMembers','findOne','intersection','hasOwnProperty','nolimit','order','sort','SmsQueueId','merge','UserSmsQueue','User','findAndCountAll','map','UserId','agent','smsPause','updatedAt','createdAt','format'];(function(_0x1aeda2,_0x1217eb){var _0x32dc6d=function(_0x34a460){while(--_0x34a460){_0x1aeda2['push'](_0x1aeda2['shift']());}};_0x32dc6d(++_0x1217eb);}(_0xadb5,0xad));var _0x5adb=function(_0x3a8c50,_0x357a20){_0x3a8c50=_0x3a8c50-0x0;var _0x2bb8c2=_0xadb5[_0x3a8c50];return _0x2bb8c2;};'use strict';var BPromise=require('bluebird');var util=require(_0x5adb('0x0'));var _=require('lodash');var squel=require(_0x5adb('0x1'));var Redis=require(_0x5adb('0x2'));var qs=require(_0x5adb('0x3'));var logger=require('../../config/logger')(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var db=require(_0x5adb('0x6'))['db'];config['redis']=_[_0x5adb('0x7')](config[_0x5adb('0x8')],{'host':_0x5adb('0x9'),'port':0x18eb});var socket=require(_0x5adb('0xa'))(new Redis(config[_0x5adb('0x8')]));require(_0x5adb('0xb'))[_0x5adb('0xc')](socket);function respondWithStatusCode(_0x6d1b45,_0x41261c){_0x41261c=_0x41261c||0xcc;return function(_0x7293ab){if(_0x7293ab){return _0x6d1b45[_0x5adb('0xd')](_0x41261c);}return _0x6d1b45[_0x5adb('0xe')](_0x41261c)[_0x5adb('0xf')]();};}function respondWithResult(_0x275428,_0x563d86){_0x563d86=_0x563d86||0xc8;return function(_0x4c268d){if(_0x4c268d){return _0x275428[_0x5adb('0xe')](_0x563d86)[_0x5adb('0x10')](_0x4c268d);}};}function respondWithFilteredResult(_0x82e67e,_0x53b772){return function(_0x29f0d5){if(_0x29f0d5){var _0x56012f=typeof _0x53b772[_0x5adb('0x11')]==='undefined'&&typeof _0x53b772[_0x5adb('0x12')]===_0x5adb('0x13');var _0x44abe3=_0x29f0d5['count'];var _0x2a545b=_0x56012f?0x0:_0x53b772[_0x5adb('0x11')];var _0xf82f72=_0x56012f?_0x29f0d5['count']:_0x53b772[_0x5adb('0x11')]+_0x53b772['limit'];var _0x367d82;if(_0xf82f72>=_0x44abe3){_0xf82f72=_0x44abe3;_0x367d82=0xc8;}else{_0x367d82=0xce;}_0x82e67e[_0x5adb('0xe')](_0x367d82);return _0x82e67e[_0x5adb('0x14')](_0x5adb('0x15'),_0x2a545b+'-'+_0xf82f72+'/'+_0x44abe3)[_0x5adb('0x10')](_0x29f0d5);}return null;};}function saveUpdates(_0x39d24d){return function(_0xa29dc){if(_0xa29dc){return _0xa29dc[_0x5adb('0x16')](_0x39d24d)[_0x5adb('0x17')](function(_0x529b65){return _0x529b65;});}return null;};}function removeEntity(_0x3fff62){return function(_0x5de028){if(_0x5de028){return _0x5de028[_0x5adb('0x18')]()['then'](function(){var _0x3ef465=_0x5de028['get']({'plain':!![]});var _0x5e218c=_0x5adb('0x19');return db[_0x5adb('0x1a')][_0x5adb('0x18')]({'where':{'type':_0x5e218c,'resourceId':_0x3ef465['id']}})[_0x5adb('0x17')](function(){return _0x5de028;});})[_0x5adb('0x17')](function(){_0x3fff62['status'](0xcc)[_0x5adb('0xf')]();});}};}function handleEntityNotFound(_0x5c296e){return function(_0x4e9f16){if(!_0x4e9f16){_0x5c296e[_0x5adb('0xd')](0x194);}return _0x4e9f16;};}function handleError(_0x379b33,_0x1a38d3){_0x1a38d3=_0x1a38d3||0x1f4;return function(_0x1a8014){logger[_0x5adb('0x1b')](_0x1a8014[_0x5adb('0x1c')]);if(_0x1a8014[_0x5adb('0x1d')]){delete _0x1a8014['name'];}_0x379b33[_0x5adb('0xe')](_0x1a38d3)[_0x5adb('0x1e')](_0x1a8014);};}exports[_0x5adb('0x1f')]=function(_0x3839fb,_0xeb556c){var _0x49f203={};var _0x2fee18={'count':0x0,'rows':[]};var _0x2e1e63=_['map'](db[_0x5adb('0x20')][_0x5adb('0x21')],function(_0x1a0acd){return{'name':_0x1a0acd['fieldName'],'type':_0x1a0acd[_0x5adb('0x22')][_0x5adb('0x23')]};});_0x49f203=qs[_0x5adb('0x24')](_0x2e1e63,_0x3839fb);var _0x2c64a3={'where':_0x49f203[_0x5adb('0x25')]};return db[_0x5adb('0x20')]['count'](_0x2c64a3)['then'](function(_0x5d457e){_0x2fee18[_0x5adb('0x26')]=_0x5d457e;_0x49f203[_0x5adb('0x27')]=qs[_0x5adb('0x27')](_0x3839fb[_0x5adb('0x28')]);return db[_0x5adb('0x20')]['findAll'](_0x49f203);})[_0x5adb('0x17')](function(_0x34b793){_0x2fee18[_0x5adb('0x29')]=_0x34b793;return _0x2fee18;})[_0x5adb('0x17')](respondWithFilteredResult(_0xeb556c,_0x49f203))[_0x5adb('0x2a')](handleError(_0xeb556c,null));};exports[_0x5adb('0x2b')]=function(_0x28190d,_0x28bf1f){var _0x138bf6={'raw':!![],'where':{'id':_0x28190d['params']['id']}},_0x260295={};_0x260295[_0x5adb('0x2c')]=_['keys'](db[_0x5adb('0x20')][_0x5adb('0x21')]);_0x260295['query']=_[_0x5adb('0x2d')](_0x28190d[_0x5adb('0x28')]);_0x260295[_0x5adb('0x2e')]=_['intersection'](_0x260295[_0x5adb('0x2c')],_0x260295[_0x5adb('0x28')]);_0x138bf6['attributes']=_['intersection'](_0x260295[_0x5adb('0x2c')],qs['fields'](_0x28190d[_0x5adb('0x28')][_0x5adb('0x2f')]));_0x138bf6[_0x5adb('0x30')]=_0x138bf6[_0x5adb('0x30')][_0x5adb('0x31')]?_0x138bf6['attributes']:_0x260295[_0x5adb('0x2c')];if(_0x28190d[_0x5adb('0x28')][_0x5adb('0x32')]){_0x138bf6['include']=[{'all':!![]}];}_0x138bf6=_['merge']({},_0x138bf6,_0x28190d[_0x5adb('0x33')]);return db[_0x5adb('0x20')]['find'](_0x138bf6)[_0x5adb('0x17')](handleEntityNotFound(_0x28bf1f,null))['then'](respondWithResult(_0x28bf1f,null))[_0x5adb('0x2a')](handleError(_0x28bf1f,null));};exports['create']=function(_0x11cb37,_0x4d052f){return db[_0x5adb('0x20')][_0x5adb('0x34')](_0x11cb37['body'],{})[_0x5adb('0x17')](function(_0x5a6a79){var _0xadbe37=_0x11cb37[_0x5adb('0x35')][_0x5adb('0x36')]({'plain':!![]});if(!_0xadbe37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xadbe37[_0x5adb('0x37')]===_0x5adb('0x35')){var _0xcdaf8e=_0x5a6a79[_0x5adb('0x36')]({'plain':!![]});var _0x22aa95='SmsQueues';return db['UserProfileSection']['find']({'where':{'name':_0x22aa95,'userProfileId':_0xadbe37['userProfileId']},'raw':!![]})[_0x5adb('0x17')](function(_0x2fbe14){if(_0x2fbe14&&_0x2fbe14[_0x5adb('0x38')]===0x0){return db[_0x5adb('0x1a')][_0x5adb('0x34')]({'name':_0xcdaf8e[_0x5adb('0x1d')],'resourceId':_0xcdaf8e['id'],'type':_0x2fbe14[_0x5adb('0x1d')],'sectionId':_0x2fbe14['id']},{})[_0x5adb('0x17')](function(){return _0x5a6a79;});}else{return _0x5a6a79;}})['catch'](function(_0x53f2c6){logger[_0x5adb('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53f2c6);throw _0x53f2c6;});}return _0x5a6a79;})[_0x5adb('0x17')](respondWithResult(_0x4d052f,0xc9))[_0x5adb('0x2a')](handleError(_0x4d052f,null));};exports[_0x5adb('0x16')]=function(_0x121714,_0xdfecfd){if(_0x121714['body']['id']){delete _0x121714[_0x5adb('0x39')]['id'];}return db[_0x5adb('0x20')]['find']({'where':{'id':_0x121714[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0xdfecfd,null))['then'](saveUpdates(_0x121714[_0x5adb('0x39')],null))[_0x5adb('0x17')](respondWithResult(_0xdfecfd,null))[_0x5adb('0x2a')](handleError(_0xdfecfd,null));};exports[_0x5adb('0x18')]=function(_0xea3307,_0x4362ec){return db[_0x5adb('0x20')]['find']({'where':{'id':_0xea3307['params']['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x4362ec,null))[_0x5adb('0x17')](removeEntity(_0x4362ec,null))[_0x5adb('0x2a')](handleError(_0x4362ec,null));};exports[_0x5adb('0x3b')]=function(_0x57b8af,_0x507e48){return db[_0x5adb('0x20')][_0x5adb('0x3b')]()[_0x5adb('0x17')](respondWithResult(_0x507e48,null))[_0x5adb('0x2a')](handleError(_0x507e48,null));};exports[_0x5adb('0x3c')]=function(_0x5358c0,_0x182cbc){var _0x437f52={'raw':!![],'where':{}},_0x5b574c={},_0x7786c4;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0x5358c0[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x182cbc,null))[_0x5adb('0x17')](function(_0x39840e){if(_0x39840e){_0x7786c4=_0x39840e[_0x5adb('0x36')]({'plain':!![]});_0x5b574c['model']=_[_0x5adb('0x2d')](db['UserSmsQueue']['rawAttributes']);_0x5b574c['query']=_[_0x5adb('0x2d')](_0x5358c0[_0x5adb('0x28')]);_0x5b574c[_0x5adb('0x2e')]=_['intersection'](_0x5b574c[_0x5adb('0x2c')],_0x5b574c['query']);_0x437f52[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x5b574c[_0x5adb('0x2c')],qs['fields'](_0x5358c0[_0x5adb('0x28')]['fields']));_0x437f52[_0x5adb('0x30')]=_0x437f52[_0x5adb('0x30')]['length']?_0x437f52[_0x5adb('0x30')]:_0x5b574c[_0x5adb('0x2c')];if(!_0x5358c0[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x437f52['limit']=qs[_0x5adb('0x12')](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x12')]);_0x437f52[_0x5adb('0x11')]=qs['offset'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x11')]);}_0x437f52[_0x5adb('0x41')]=qs['sort'](_0x5358c0[_0x5adb('0x28')][_0x5adb('0x42')]);_0x437f52[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_['pick'](_0x5358c0[_0x5adb('0x28')],_0x5b574c[_0x5adb('0x2e')]));_0x437f52[_0x5adb('0x25')][_0x5adb('0x43')]=_0x39840e['id'];if(_0x5358c0[_0x5adb('0x28')]['filter']){_0x437f52[_0x5adb('0x25')]=_['merge'](_0x437f52[_0x5adb('0x25')],{'$or':_['map'](_0x437f52[_0x5adb('0x30')],function(_0x35df22){var _0x1a9358={};_0x1a9358[_0x35df22]={'$like':'%'+_0x5358c0[_0x5adb('0x28')]['filter']+'%'};return _0x1a9358;})});}_0x437f52=_[_0x5adb('0x44')]({},_0x437f52,_0x5358c0[_0x5adb('0x33')]);return db[_0x5adb('0x45')]['findAll'](_0x437f52);}})['then'](function(_0x4ddfdf){if(_0x4ddfdf){return db[_0x5adb('0x46')][_0x5adb('0x47')]({'where':{'id':_[_0x5adb('0x48')](_0x4ddfdf,_0x5adb('0x49')),'role':_0x5adb('0x4a')},'attributes':['id',_0x5adb('0x1d'),_0x5adb('0x4b'),_0x5adb('0x4c'),_0x5adb('0x4d')]});}})[_0x5adb('0x17')](function(_0x452767){if(_0x452767){return{'count':_0x452767[_0x5adb('0x26')],'rows':_[_0x5adb('0x48')](_0x452767['rows'],function(_0x49f4c8){return{'membername':_0x49f4c8[_0x5adb('0x1d')],'UserId':_0x49f4c8['id'],'queue_name':_0x7786c4[_0x5adb('0x1d')],'SmsQueueId':_0x7786c4['id'],'interface':util[_0x5adb('0x4e')](_0x5adb('0x4f'),'SIP',_0x49f4c8[_0x5adb('0x1d')]),'penalty':0x0,'paused':_0x49f4c8[_0x5adb('0x4b')],'createdAt':_0x49f4c8['createdAt'],'updatedAt':_0x49f4c8[_0x5adb('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5adb('0x17')](respondWithFilteredResult(_0x182cbc,_0x437f52))[_0x5adb('0x2a')](handleError(_0x182cbc,null));};exports['getTeams']=function(_0x30d185,_0x409357){var _0x19df2f={};var _0x30c92c={};var _0x330290;var _0x428019;return db['SmsQueue'][_0x5adb('0x3d')]({'where':{'id':_0x30d185[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x409357,null))['then'](function(_0xcd71d2){if(_0xcd71d2){_0x330290=_0xcd71d2;_0x30c92c[_0x5adb('0x2c')]=_[_0x5adb('0x2d')](db['Team'][_0x5adb('0x21')]);_0x30c92c['query']=_[_0x5adb('0x2d')](_0x30d185[_0x5adb('0x28')]);_0x30c92c[_0x5adb('0x2e')]=_['intersection'](_0x30c92c[_0x5adb('0x2c')],_0x30c92c[_0x5adb('0x28')]);_0x19df2f['attributes']=_[_0x5adb('0x3e')](_0x30c92c[_0x5adb('0x2c')],qs[_0x5adb('0x2f')](_0x30d185[_0x5adb('0x28')]['fields']));_0x19df2f[_0x5adb('0x30')]=_0x19df2f[_0x5adb('0x30')][_0x5adb('0x31')]?_0x19df2f[_0x5adb('0x30')]:_0x30c92c['model'];_0x19df2f['order']=qs[_0x5adb('0x42')](_0x30d185['query']['sort']);_0x19df2f['where']=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0x30d185['query'],_0x30c92c[_0x5adb('0x2e')]));if(_0x30d185[_0x5adb('0x28')][_0x5adb('0x51')]){_0x19df2f[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x19df2f[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x19df2f[_0x5adb('0x30')],function(_0x5240c1){var _0x4b9e80={};_0x4b9e80[_0x5240c1]={'$like':'%'+_0x30d185['query'][_0x5adb('0x51')]+'%'};return _0x4b9e80;})});}_0x19df2f=_[_0x5adb('0x44')]({},_0x19df2f,_0x30d185[_0x5adb('0x33')]);return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x2f6ef7){if(_0x2f6ef7){_0x428019=_0x2f6ef7[_0x5adb('0x31')];if(!_0x30d185[_0x5adb('0x28')]['hasOwnProperty']('nolimit')){_0x19df2f[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x12')]);_0x19df2f[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0x30d185[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x330290[_0x5adb('0x52')](_0x19df2f);}})[_0x5adb('0x17')](function(_0x484f3d){if(_0x484f3d){return _0x484f3d?{'count':_0x428019,'rows':_0x484f3d}:null;}})[_0x5adb('0x17')](respondWithResult(_0x409357,null))[_0x5adb('0x2a')](handleError(_0x409357,null));};exports[_0x5adb('0x53')]=function(_0x5d3aa4,_0x31f041){var _0xa1bd33=_0x5d3aa4['body'][_0x5adb('0x54')];return db['Team'][_0x5adb('0x55')]({'where':{'id':_0xa1bd33},'attributes':['id'],'include':[{'model':db[_0x5adb('0x46')],'as':'Agents','attributes':['id',_0x5adb('0x1d'),_0x5adb('0x56'),_0x5adb('0x57'),_0x5adb('0x58')],'raw':!![]}]})[_0x5adb('0x17')](function(_0x10f54a){if(_0x10f54a){var _0x3cee6c=_[_0x5adb('0x59')](_0x10f54a,function(_0x49a8a6){var _0x3786b4=_0x49a8a6[_0x5adb('0x36')]({'plain':!![]});return _0x3786b4[_0x5adb('0x5a')];});return db['SmsQueue']['find']({'where':{'id':_0x5d3aa4[_0x5adb('0x3a')]['id']}})['then'](function(_0x27d3d8){return db[_0x5adb('0x5b')][_0x5adb('0x5c')](function(_0x50600f){return _0x27d3d8[_0x5adb('0x53')](_0xa1bd33,{'transaction':_0x50600f})[_0x5adb('0x17')](function(){return BPromise[_0x5adb('0x5d')](_0x3cee6c,function(_0x3ecc56){return db[_0x5adb('0x45')]['findOrCreate']({'where':{'UserId':_0x3ecc56['id'],'SmsQueueId':_0x5d3aa4[_0x5adb('0x3a')]['id']},'transaction':_0x50600f});});})[_0x5adb('0x17')](function(){_0x3cee6c[_0x5adb('0x5e')](function(_0xe3d12d){socket['emit'](_0x5adb('0x5f'),{'UserId':_0xe3d12d['id'],'SmsQueueId':_0x27d3d8['id']});});});});});}})[_0x5adb('0x17')](respondWithStatusCode(_0x31f041,null))[_0x5adb('0x2a')](handleError(_0x31f041,null));};exports[_0x5adb('0x60')]=function(_0x15d4f1,_0x20faf6){return db[_0x5adb('0x61')]['findAll']({'where':{'id':_0x15d4f1[_0x5adb('0x28')][_0x5adb('0x54')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x5adb('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x5adb('0x17')](handleEntityNotFound(_0x20faf6,null))['then'](function(_0x462fa0){var _0x50f8ed=_[_0x5adb('0x48')](_0x462fa0,'id');var _0x268df2=[];var _0x4a2ebc=[];var _0x167432=squel['select']();_0x167432[_0x5adb('0x62')](_0x5adb('0x63'))[_0x5adb('0x64')](_0x5adb('0x65'),'tq')[_0x5adb('0x66')]('user_has_teams','ut',_0x5adb('0x67'))[_0x5adb('0x25')](_0x5adb('0x68'),_0x15d4f1[_0x5adb('0x3a')]['id']);for(var _0x47c631=0x0;_0x47c631<_0x462fa0['length'];_0x47c631+=0x1){let _0x3f3db9=_0x462fa0[_0x47c631];for(var _0x461a07=0x0;_0x461a07<_0x3f3db9[_0x5adb('0x5a')][_0x5adb('0x31')];_0x461a07+=0x1){let _0x277668=_0x3f3db9[_0x5adb('0x5a')][_0x461a07];var _0x31f5b2=_0x167432['clone']();_0x31f5b2[_0x5adb('0x25')](_0x5adb('0x69'),_0x277668['id']);_0x4a2ebc[_0x5adb('0x6a')](db[_0x5adb('0x5b')]['query'](_0x31f5b2[_0x5adb('0x6b')](),{'type':db[_0x5adb('0x5b')][_0x5adb('0x6c')][_0x5adb('0x6d')]})[_0x5adb('0x17')](function(_0x188cbd){if(_0x188cbd[_0x5adb('0x31')]===0x1){return _0x277668['id'];}else{var _0x2d1b65=_[_0x5adb('0x6e')](_['map'](_0x188cbd,_0x5adb('0x6f')),function(_0x456799){return _['includes'](_0x50f8ed,_0x456799);});if(_0x2d1b65){return _0x277668['id'];}}}));}}return BPromise[_0x5adb('0x70')](_0x4a2ebc)[_0x5adb('0x17')](function(_0x2b8915){_0x268df2=_(_0x268df2)[_0x5adb('0x71')](_0x2b8915)[_0x5adb('0x72')]()[_0x5adb('0x73')]();return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x15d4f1['params']['id']}})[_0x5adb('0x17')](function(_0x2386c0){return db['sequelize'][_0x5adb('0x5c')](function(_0x58a26f){return _0x2386c0[_0x5adb('0x60')](_0x15d4f1['query']['ids'],{'transaction':_0x58a26f})[_0x5adb('0x17')](function(){if(!_[_0x5adb('0x75')](_0x268df2)){return _0x2386c0[_0x5adb('0x76')](_0x268df2,{'transaction':_0x58a26f});}})['then'](function(){_0x268df2[_0x5adb('0x5e')](function(_0x321c3a){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':_0x321c3a,'SmsQueueId':_0x2386c0['id']});});});});});});})[_0x5adb('0x17')](respondWithStatusCode(_0x20faf6,null))[_0x5adb('0x2a')](handleError(_0x20faf6,null));};exports[_0x5adb('0x79')]=function(_0x463e84,_0x28bd33){return db[_0x5adb('0x20')][_0x5adb('0x74')]({'where':{'id':_0x463e84[_0x5adb('0x3a')]['id']}})['then'](handleEntityNotFound(_0x28bd33,null))['then'](function(_0x312463){if(_0x312463){return _0x312463[_0x5adb('0x79')](_0x463e84['body'][_0x5adb('0x54')],_[_0x5adb('0x7a')](_0x463e84[_0x5adb('0x39')],[_0x5adb('0x54'),'id'])||{})[_0x5adb('0x7b')](function(_0x24cd3b){for(var _0x15626b=0x0;_0x15626b<_0x463e84[_0x5adb('0x39')][_0x5adb('0x54')]['length'];_0x15626b+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x5f'),{'UserId':Number(_0x463e84[_0x5adb('0x39')]['ids'][_0x15626b]),'SmsQueueId':Number(_0x463e84[_0x5adb('0x3a')]['id'])});}return _0x24cd3b;});}})[_0x5adb('0x17')](respondWithResult(_0x28bd33,null))[_0x5adb('0x2a')](handleError(_0x28bd33,null));};exports[_0x5adb('0x76')]=function(_0x64475f,_0x2a78f9){return db['SmsQueue'][_0x5adb('0x74')]({'where':{'id':_0x64475f[_0x5adb('0x3a')]['id']}})[_0x5adb('0x17')](handleEntityNotFound(_0x2a78f9,null))[_0x5adb('0x17')](function(_0x2c3af8){if(_0x2c3af8){return _0x2c3af8[_0x5adb('0x76')](_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')])[_0x5adb('0x17')](function(){if(_[_0x5adb('0x7c')](_0x64475f['query'][_0x5adb('0x54')])){for(var _0x5b9565=0x0;_0x5b9565<_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')][_0x5adb('0x31')];_0x5b9565+=0x1){socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f['query']['ids'][_0x5b9565]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}}else{socket[_0x5adb('0x77')](_0x5adb('0x78'),{'UserId':Number(_0x64475f[_0x5adb('0x28')][_0x5adb('0x54')]),'SmsQueueId':Number(_0x64475f[_0x5adb('0x3a')]['id'])});}});}})['then'](respondWithStatusCode(_0x2a78f9,null))['catch'](handleError(_0x2a78f9,null));};exports[_0x5adb('0x7d')]=function(_0xd5b95d,_0x9d80fd){var _0x4f5721={};var _0x542626={};var _0x227c17;var _0x5982a5;return db[_0x5adb('0x20')][_0x5adb('0x3d')]({'where':{'id':_0xd5b95d['params']['id']}})['then'](handleEntityNotFound(_0x9d80fd,null))[_0x5adb('0x17')](function(_0x4bb198){if(_0x4bb198){_0x227c17=_0x4bb198;_0x542626['model']=_[_0x5adb('0x2d')](db[_0x5adb('0x46')][_0x5adb('0x21')]);_0x542626[_0x5adb('0x28')]=_[_0x5adb('0x2d')](_0xd5b95d[_0x5adb('0x28')]);_0x542626[_0x5adb('0x2e')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],_0x542626[_0x5adb('0x28')]);_0x4f5721[_0x5adb('0x30')]=_[_0x5adb('0x3e')](_0x542626[_0x5adb('0x2c')],qs['fields'](_0xd5b95d[_0x5adb('0x28')]['fields']));_0x4f5721[_0x5adb('0x30')]=_0x4f5721[_0x5adb('0x30')][_0x5adb('0x31')]?_0x4f5721[_0x5adb('0x30')]:_0x542626[_0x5adb('0x2c')];_0x4f5721[_0x5adb('0x41')]=qs[_0x5adb('0x42')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x42')]);_0x4f5721[_0x5adb('0x25')]=qs[_0x5adb('0x2e')](_[_0x5adb('0x50')](_0xd5b95d['query'],_0x542626[_0x5adb('0x2e')]));if(_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]){_0x4f5721[_0x5adb('0x25')]=_[_0x5adb('0x44')](_0x4f5721[_0x5adb('0x25')],{'$or':_[_0x5adb('0x48')](_0x4f5721[_0x5adb('0x30')],function(_0x57c160){var _0xe7ddc4={};_0xe7ddc4[_0x57c160]={'$like':'%'+_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x51')]+'%'};return _0xe7ddc4;})});}_0x4f5721=_['merge']({},_0x4f5721,_0xd5b95d[_0x5adb('0x33')]);return _0x227c17['getAgents'](_0x4f5721);}})[_0x5adb('0x17')](function(_0x50c3a3){if(_0x50c3a3){_0x5982a5=_0x50c3a3['length'];if(!_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x3f')](_0x5adb('0x40'))){_0x4f5721[_0x5adb('0x12')]=qs[_0x5adb('0x12')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x12')]);_0x4f5721[_0x5adb('0x11')]=qs[_0x5adb('0x11')](_0xd5b95d[_0x5adb('0x28')][_0x5adb('0x11')]);}return _0x227c17[_0x5adb('0x7d')](_0x4f5721);}})['then'](function(_0x364da7){if(_0x364da7){return _0x364da7?{'count':_0x5982a5,'rows':_0x364da7}:null;}})['then'](respondWithResult(_0x9d80fd,null))[_0x5adb('0x2a')](handleError(_0x9d80fd,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 3abb8d2..8d7c588 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 _0x5fa6=['hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners','update','remove','emit'];(function(_0x5aff85,_0x1c6a3c){var _0x1b57f4=function(_0x41d38b){while(--_0x41d38b){_0x5aff85['push'](_0x5aff85['shift']());}};_0x1b57f4(++_0x1c6a3c);}(_0x5fa6,0xc8));var _0x65fa=function(_0x4d8764,_0xd13d7b){_0x4d8764=_0x4d8764-0x0;var _0x4e0b49=_0x5fa6[_0x4d8764];return _0x4e0b49;};'use strict';var EventEmitter=require(_0x65fa('0x0'));var SmsQueue=require(_0x65fa('0x1'))['db'][_0x65fa('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x65fa('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x65fa('0x4'),'afterDestroy':_0x65fa('0x5')};function emitEvent(_0x2c9b13){return function(_0x1cbf2e,_0xd2c928,_0x447f99){SmsQueueEvents[_0x65fa('0x6')](_0x2c9b13+':'+_0x1cbf2e['id'],_0x1cbf2e);SmsQueueEvents[_0x65fa('0x6')](_0x2c9b13,_0x1cbf2e);_0x447f99(null);};}for(var e in events){if(events[_0x65fa('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x65fa('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0xdd8f=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x3525b4,_0x5ed561){var _0x462fe3=function(_0x12d1d7){while(--_0x12d1d7){_0x3525b4['push'](_0x3525b4['shift']());}};_0x462fe3(++_0x5ed561);}(_0xdd8f,0x1e2));var _0xfdd8=function(_0x24d2e0,_0x3cd6ff){_0x24d2e0=_0x24d2e0-0x0;var _0x51f9ae=_0xdd8f[_0x24d2e0];return _0x51f9ae;};'use strict';var EventEmitter=require(_0xfdd8('0x0'));var SmsQueue=require(_0xfdd8('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xfdd8('0x2')](0x0);var events={'afterCreate':_0xfdd8('0x3'),'afterUpdate':_0xfdd8('0x4'),'afterDestroy':'remove'};function emitEvent(_0x286d30){return function(_0x446cca,_0x4ccefd,_0x5d219d){SmsQueueEvents[_0xfdd8('0x5')](_0x286d30+':'+_0x446cca['id'],_0x446cca);SmsQueueEvents[_0xfdd8('0x5')](_0x286d30,_0x446cca);_0x5d219d(null);};}for(var e in events){if(events[_0xfdd8('0x6')](e)){var event=events[e];SmsQueue[_0xfdd8('0x7')](e,emitEvent(event));}}module[_0xfdd8('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 3d1b44b..d56510e 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 _0x328e=['SmsQueue','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x328e,0x18d));var _0xe328=function(_0x176a70,_0x38f5c7){_0x176a70=_0x176a70-0x0;var _0x429666=_0x328e[_0x176a70];return _0x429666;};'use strict';var _=require(_0xe328('0x0'));var util=require(_0xe328('0x1'));var logger=require('../../config/logger')(_0xe328('0x2'));var moment=require(_0xe328('0x3'));var BPromise=require('bluebird');var rp=require(_0xe328('0x4'));var fs=require('fs');var path=require(_0xe328('0x5'));var rimraf=require(_0xe328('0x6'));var config=require(_0xe328('0x7'));var attributes=require(_0xe328('0x8'));module[_0xe328('0x9')]=function(_0xbd4fc6,_0x9ca2c1){return _0xbd4fc6[_0xe328('0xa')](_0xe328('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd580=['moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','sms_queues','lodash','util','api'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd580,0x1c5));var _0x0d58=function(_0x18ef65,_0x252e28){_0x18ef65=_0x18ef65-0x0;var _0x5d40dc=_0xd580[_0x18ef65];return _0x5d40dc;};'use strict';var _=require(_0x0d58('0x0'));var util=require(_0x0d58('0x1'));var logger=require('../../config/logger')(_0x0d58('0x2'));var moment=require(_0x0d58('0x3'));var BPromise=require(_0x0d58('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0d58('0x5'));var rimraf=require(_0x0d58('0x6'));var config=require(_0x0d58('0x7'));var attributes=require(_0x0d58('0x8'));module[_0x0d58('0x9')]=function(_0x135093,_0x20376f){return _0x135093[_0x0d58('0xa')]('SmsQueue',attributes,{'tableName':_0x0d58('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 ed9d3fd..70273c1 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 _0x92f6=['info','result','catch','SmsQueue','findAll','options','where','attributes','map','include','model','GetSmsQueue','stringify','ShowSmsQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','SmsQueue,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x92f6,0x1f0));var _0x692f=function(_0x1e46e3,_0x35df6a){_0x1e46e3=_0x1e46e3-0x0;var _0x3e31c4=_0x92f6[_0x1e46e3];return _0x3e31c4;};'use strict';var _=require(_0x692f('0x0'));var util=require(_0x692f('0x1'));var moment=require(_0x692f('0x2'));var BPromise=require(_0x692f('0x3'));var rs=require(_0x692f('0x4'));var fs=require('fs');var Redis=require(_0x692f('0x5'));var db=require(_0x692f('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x692f('0x7'));var config=require(_0x692f('0x8'));var jayson=require(_0x692f('0x9'));var client=jayson[_0x692f('0xa')][_0x692f('0xb')]({'port':0x232a});config[_0x692f('0xc')]=_[_0x692f('0xd')](config[_0x692f('0xc')],{'host':_0x692f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x692f('0xc')]));require('./smsQueue.socket')[_0x692f('0xf')](socket);function respondWithRpcPromise(_0x39f94c,_0x581309,_0x37fe8b){return new BPromise(function(_0xc0abd8,_0x2d4956){return client[_0x692f('0x10')](_0x39f94c,_0x37fe8b)[_0x692f('0x11')](function(_0x474cf0){logger['info']('SmsQueue,\x20%s,\x20%s',_0x581309,_0x692f('0x12'));logger[_0x692f('0x13')](_0x692f('0x14'),_0x581309,_0x692f('0x12'),JSON['stringify'](_0x474cf0));if(_0x474cf0[_0x692f('0x15')]){if(_0x474cf0[_0x692f('0x15')]['code']===0x1f4){logger[_0x692f('0x15')](_0x692f('0x16'),_0x581309,_0x474cf0[_0x692f('0x15')][_0x692f('0x17')]);return _0x2d4956(_0x474cf0[_0x692f('0x15')][_0x692f('0x17')]);}logger[_0x692f('0x15')](_0x692f('0x16'),_0x581309,_0x474cf0[_0x692f('0x15')][_0x692f('0x17')]);return _0xc0abd8(_0x474cf0['error'][_0x692f('0x17')]);}else{logger[_0x692f('0x18')](_0x692f('0x16'),_0x581309,'request\x20sent');_0xc0abd8(_0x474cf0[_0x692f('0x19')][_0x692f('0x17')]);}})[_0x692f('0x1a')](function(_0x2cd9cb){logger[_0x692f('0x15')](_0x692f('0x16'),_0x581309,_0x2cd9cb);_0x2d4956(_0x2cd9cb);});});}exports['GetSmsQueue']=function(_0x22b08d){var _0x198f7b=this;return new Promise(function(_0x19ab03,_0x61934){return db[_0x692f('0x1b')][_0x692f('0x1c')]({'raw':_0x22b08d['options']?_0x22b08d[_0x692f('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x22b08d[_0x692f('0x1d')]?_0x22b08d['options'][_0x692f('0x1e')]||null:null,'attributes':_0x22b08d['options']?_0x22b08d[_0x692f('0x1d')][_0x692f('0x1f')]||null:null,'limit':_0x22b08d[_0x692f('0x1d')]?_0x22b08d[_0x692f('0x1d')]['limit']||null:null,'include':_0x22b08d[_0x692f('0x1d')]?_0x22b08d[_0x692f('0x1d')]['include']?_[_0x692f('0x20')](_0x22b08d[_0x692f('0x1d')][_0x692f('0x21')],function(_0x13b715){return{'model':db[_0x13b715[_0x692f('0x22')]],'as':_0x13b715['as'],'attributes':_0x13b715[_0x692f('0x1f')],'include':_0x13b715[_0x692f('0x21')]?_[_0x692f('0x20')](_0x13b715[_0x692f('0x21')],function(_0x4fda70){return{'model':db[_0x4fda70[_0x692f('0x22')]],'as':_0x4fda70['as'],'attributes':_0x4fda70[_0x692f('0x1f')],'include':_0x4fda70[_0x692f('0x21')]?_[_0x692f('0x20')](_0x4fda70[_0x692f('0x21')],function(_0x40a578){return{'model':db[_0x40a578['model']],'as':_0x40a578['as'],'attributes':_0x40a578[_0x692f('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x692f('0x11')](function(_0x547c84){logger['info'](_0x692f('0x23'),_0x22b08d);logger[_0x692f('0x13')](_0x692f('0x23'),_0x22b08d,JSON[_0x692f('0x24')](_0x547c84));_0x19ab03(_0x547c84);})['catch'](function(_0x4a8001){logger[_0x692f('0x15')](_0x692f('0x23'),_0x4a8001[_0x692f('0x17')],_0x22b08d);_0x61934(_0x198f7b['error'](0x1f4,_0x4a8001[_0x692f('0x17')]));});});};exports[_0x692f('0x25')]=function(_0x44407b){var _0x120aec=this;return new Promise(function(_0x24923b,_0x2a89f8){return db[_0x692f('0x1b')][_0x692f('0x26')]({'raw':_0x44407b[_0x692f('0x1d')]?_0x44407b['options'][_0x692f('0x27')]===undefined?!![]:![]:!![],'where':_0x44407b[_0x692f('0x1d')]?_0x44407b['options'][_0x692f('0x1e')]||null:null,'attributes':_0x44407b['options']?_0x44407b[_0x692f('0x1d')][_0x692f('0x1f')]||null:null,'include':_0x44407b[_0x692f('0x1d')]?_0x44407b['options']['include']?_['map'](_0x44407b[_0x692f('0x1d')][_0x692f('0x21')],function(_0x4d03b9){return{'model':db[_0x4d03b9[_0x692f('0x22')]],'as':_0x4d03b9['as'],'attributes':_0x4d03b9[_0x692f('0x1f')],'include':_0x4d03b9[_0x692f('0x21')]?_['map'](_0x4d03b9[_0x692f('0x21')],function(_0x4a2cad){return{'model':db[_0x4a2cad['model']],'as':_0x4a2cad['as'],'attributes':_0x4a2cad[_0x692f('0x1f')],'include':_0x4a2cad[_0x692f('0x21')]?_[_0x692f('0x20')](_0x4a2cad['include'],function(_0x124251){return{'model':db[_0x124251['model']],'as':_0x124251['as'],'attributes':_0x124251['attributes']};}):[]};}):[]};}):[]:[]})[_0x692f('0x11')](function(_0x39dfcb){logger[_0x692f('0x18')](_0x692f('0x25'),_0x44407b);logger[_0x692f('0x13')](_0x692f('0x25'),_0x44407b,JSON[_0x692f('0x24')](_0x39dfcb));_0x24923b(_0x39dfcb);})[_0x692f('0x1a')](function(_0x1bef49){logger['error'](_0x692f('0x25'),_0x1bef49['message'],_0x44407b);_0x2a89f8(_0x120aec[_0x692f('0x15')](0x1f4,_0x1bef49['message']));});});}; \ No newline at end of file +var _0xd6c8=['options','raw','where','limit','include','map','model','attributes','GetSmsQueue','catch','find','ShowSmsQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SmsQueue','findAll'];(function(_0x3f928f,_0x4be6d5){var _0x29ae39=function(_0x14ff30){while(--_0x14ff30){_0x3f928f['push'](_0x3f928f['shift']());}};_0x29ae39(++_0x4be6d5);}(_0xd6c8,0xde));var _0x8d6c=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xd6c8[_0x3207aa];return _0x51758f;};'use strict';var _=require(_0x8d6c('0x0'));var util=require(_0x8d6c('0x1'));var moment=require(_0x8d6c('0x2'));var BPromise=require(_0x8d6c('0x3'));var rs=require(_0x8d6c('0x4'));var fs=require('fs');var Redis=require(_0x8d6c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8d6c('0x6'));var logger=require('../../config/logger')(_0x8d6c('0x7'));var config=require(_0x8d6c('0x8'));var jayson=require(_0x8d6c('0x9'));var client=jayson[_0x8d6c('0xa')][_0x8d6c('0xb')]({'port':0x232a});config[_0x8d6c('0xc')]=_[_0x8d6c('0xd')](config['redis'],{'host':_0x8d6c('0xe'),'port':0x18eb});var socket=require(_0x8d6c('0xf'))(new Redis(config['redis']));require('./smsQueue.socket')[_0x8d6c('0x10')](socket);function respondWithRpcPromise(_0x4cae02,_0x3b5cdc,_0x7115e9){return new BPromise(function(_0x2d2d55,_0x2852f7){return client['request'](_0x4cae02,_0x7115e9)[_0x8d6c('0x11')](function(_0x302972){logger[_0x8d6c('0x12')](_0x8d6c('0x13'),_0x3b5cdc,_0x8d6c('0x14'));logger[_0x8d6c('0x15')](_0x8d6c('0x16'),_0x3b5cdc,_0x8d6c('0x14'),JSON[_0x8d6c('0x17')](_0x302972));if(_0x302972['error']){if(_0x302972[_0x8d6c('0x18')][_0x8d6c('0x19')]===0x1f4){logger['error']('SmsQueue,\x20%s,\x20%s',_0x3b5cdc,_0x302972[_0x8d6c('0x18')][_0x8d6c('0x1a')]);return _0x2852f7(_0x302972[_0x8d6c('0x18')][_0x8d6c('0x1a')]);}logger[_0x8d6c('0x18')](_0x8d6c('0x13'),_0x3b5cdc,_0x302972[_0x8d6c('0x18')]['message']);return _0x2d2d55(_0x302972['error'][_0x8d6c('0x1a')]);}else{logger['info']('SmsQueue,\x20%s,\x20%s',_0x3b5cdc,_0x8d6c('0x14'));_0x2d2d55(_0x302972[_0x8d6c('0x1b')][_0x8d6c('0x1a')]);}})['catch'](function(_0x546ab1){logger[_0x8d6c('0x18')](_0x8d6c('0x13'),_0x3b5cdc,_0x546ab1);_0x2852f7(_0x546ab1);});});}exports['GetSmsQueue']=function(_0x5be9d1){var _0x4b3b9a=this;return new Promise(function(_0x159643,_0x97b5f9){return db[_0x8d6c('0x1c')][_0x8d6c('0x1d')]({'raw':_0x5be9d1[_0x8d6c('0x1e')]?_0x5be9d1[_0x8d6c('0x1e')][_0x8d6c('0x1f')]===undefined?!![]:![]:!![],'where':_0x5be9d1['options']?_0x5be9d1[_0x8d6c('0x1e')][_0x8d6c('0x20')]||null:null,'attributes':_0x5be9d1[_0x8d6c('0x1e')]?_0x5be9d1[_0x8d6c('0x1e')]['attributes']||null:null,'limit':_0x5be9d1[_0x8d6c('0x1e')]?_0x5be9d1[_0x8d6c('0x1e')][_0x8d6c('0x21')]||null:null,'include':_0x5be9d1[_0x8d6c('0x1e')]?_0x5be9d1[_0x8d6c('0x1e')][_0x8d6c('0x22')]?_[_0x8d6c('0x23')](_0x5be9d1[_0x8d6c('0x1e')]['include'],function(_0x151f30){return{'model':db[_0x151f30[_0x8d6c('0x24')]],'as':_0x151f30['as'],'attributes':_0x151f30[_0x8d6c('0x25')],'include':_0x151f30[_0x8d6c('0x22')]?_[_0x8d6c('0x23')](_0x151f30[_0x8d6c('0x22')],function(_0x57c469){return{'model':db[_0x57c469[_0x8d6c('0x24')]],'as':_0x57c469['as'],'attributes':_0x57c469[_0x8d6c('0x25')],'include':_0x57c469['include']?_[_0x8d6c('0x23')](_0x57c469[_0x8d6c('0x22')],function(_0x339453){return{'model':db[_0x339453[_0x8d6c('0x24')]],'as':_0x339453['as'],'attributes':_0x339453[_0x8d6c('0x25')]};}):[]};}):[]};}):[]:[]})[_0x8d6c('0x11')](function(_0x346733){logger[_0x8d6c('0x12')](_0x8d6c('0x26'),_0x5be9d1);logger[_0x8d6c('0x15')](_0x8d6c('0x26'),_0x5be9d1,JSON[_0x8d6c('0x17')](_0x346733));_0x159643(_0x346733);})[_0x8d6c('0x27')](function(_0x466d9d){logger['error'](_0x8d6c('0x26'),_0x466d9d[_0x8d6c('0x1a')],_0x5be9d1);_0x97b5f9(_0x4b3b9a[_0x8d6c('0x18')](0x1f4,_0x466d9d[_0x8d6c('0x1a')]));});});};exports['ShowSmsQueue']=function(_0xa92874){var _0x15acf6=this;return new Promise(function(_0x3c2871,_0xdb0659){return db[_0x8d6c('0x1c')][_0x8d6c('0x28')]({'raw':_0xa92874[_0x8d6c('0x1e')]?_0xa92874['options'][_0x8d6c('0x1f')]===undefined?!![]:![]:!![],'where':_0xa92874[_0x8d6c('0x1e')]?_0xa92874['options']['where']||null:null,'attributes':_0xa92874[_0x8d6c('0x1e')]?_0xa92874['options'][_0x8d6c('0x25')]||null:null,'include':_0xa92874[_0x8d6c('0x1e')]?_0xa92874[_0x8d6c('0x1e')][_0x8d6c('0x22')]?_['map'](_0xa92874[_0x8d6c('0x1e')][_0x8d6c('0x22')],function(_0x55a535){return{'model':db[_0x55a535[_0x8d6c('0x24')]],'as':_0x55a535['as'],'attributes':_0x55a535[_0x8d6c('0x25')],'include':_0x55a535[_0x8d6c('0x22')]?_[_0x8d6c('0x23')](_0x55a535[_0x8d6c('0x22')],function(_0x3b6dff){return{'model':db[_0x3b6dff['model']],'as':_0x3b6dff['as'],'attributes':_0x3b6dff['attributes'],'include':_0x3b6dff[_0x8d6c('0x22')]?_[_0x8d6c('0x23')](_0x3b6dff[_0x8d6c('0x22')],function(_0x1e030f){return{'model':db[_0x1e030f[_0x8d6c('0x24')]],'as':_0x1e030f['as'],'attributes':_0x1e030f[_0x8d6c('0x25')]};}):[]};}):[]};}):[]:[]})[_0x8d6c('0x11')](function(_0x568713){logger[_0x8d6c('0x12')](_0x8d6c('0x29'),_0xa92874);logger['debug'](_0x8d6c('0x29'),_0xa92874,JSON[_0x8d6c('0x17')](_0x568713));_0x3c2871(_0x568713);})[_0x8d6c('0x27')](function(_0x1ef750){logger[_0x8d6c('0x18')](_0x8d6c('0x29'),_0x1ef750['message'],_0xa92874);_0xdb0659(_0x15acf6['error'](0x1f4,_0x1ef750[_0x8d6c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 74e50dc..da976bd 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 _0xcbe0=['length','smsQueue:','./smsQueue.events','remove','update','emit','register'];(function(_0x4e0f5e,_0x4168c4){var _0x45de30=function(_0x139cde){while(--_0x139cde){_0x4e0f5e['push'](_0x4e0f5e['shift']());}};_0x45de30(++_0x4168c4);}(_0xcbe0,0x121));var _0x0cbe=function(_0x1f1e31,_0x27b5c3){_0x1f1e31=_0x1f1e31-0x0;var _0x229b56=_0xcbe0[_0x1f1e31];return _0x229b56;};'use strict';var SmsQueueEvents=require(_0x0cbe('0x0'));var events=['save',_0x0cbe('0x1'),_0x0cbe('0x2')];function createListener(_0x144076,_0x710d19){return function(_0x2cae8d){_0x710d19[_0x0cbe('0x3')](_0x144076,_0x2cae8d);};}function removeListener(_0x9cc946,_0x401867){return function(){SmsQueueEvents['removeListener'](_0x9cc946,_0x401867);};}exports[_0x0cbe('0x4')]=function(_0x240b67){for(var _0x2ee903=0x0,_0x49865e=events[_0x0cbe('0x5')];_0x2ee903<_0x49865e;_0x2ee903++){var _0x4ebf25=events[_0x2ee903];var _0x501e08=createListener(_0x0cbe('0x6')+_0x4ebf25,_0x240b67);SmsQueueEvents['on'](_0x4ebf25,_0x501e08);}}; \ No newline at end of file +var _0xe4da=['removeListener','register','./smsQueue.events','save','remove','update','emit'];(function(_0x4257b7,_0x26b995){var _0x581af2=function(_0x843905){while(--_0x843905){_0x4257b7['push'](_0x4257b7['shift']());}};_0x581af2(++_0x26b995);}(_0xe4da,0xd4));var _0xae4d=function(_0x3c5053,_0x8418dd){_0x3c5053=_0x3c5053-0x0;var _0x57ebf5=_0xe4da[_0x3c5053];return _0x57ebf5;};'use strict';var SmsQueueEvents=require(_0xae4d('0x0'));var events=[_0xae4d('0x1'),_0xae4d('0x2'),_0xae4d('0x3')];function createListener(_0x4e6633,_0x54f15c){return function(_0x57236d){_0x54f15c[_0xae4d('0x4')](_0x4e6633,_0x57236d);};}function removeListener(_0x25c27f,_0x536813){return function(){SmsQueueEvents[_0xae4d('0x5')](_0x25c27f,_0x536813);};}exports[_0xae4d('0x6')]=function(_0x40a9d8){for(var _0x4c77dc=0x0,_0x43cf23=events['length'];_0x4c77dc<_0x43cf23;_0x4c77dc++){var _0x2b0560=events[_0x4c77dc];var _0x439484=createListener('smsQueue:'+_0x2b0560,_0x40a9d8);SmsQueueEvents['on'](_0x2b0560,_0x439484);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index dab1d47..cd52571 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 _0xe260=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','/describe','isAuthenticated','describe','/:id','post','create','put','delete','destroy'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe260,0x94));var _0x0e26=function(_0x153ca5,_0x18e039){_0x153ca5=_0x153ca5-0x0;var _0x18807a=_0xe260[_0x153ca5];return _0x18807a;};'use strict';var multer=require(_0x0e26('0x0'));var util=require('util');var path=require(_0x0e26('0x1'));var timeout=require(_0x0e26('0x2'));var express=require(_0x0e26('0x3'));var router=express[_0x0e26('0x4')]();var fs_extra=require(_0x0e26('0x5'));var auth=require(_0x0e26('0x6'));var interaction=require(_0x0e26('0x7'));var config=require(_0x0e26('0x8'));var controller=require(_0x0e26('0x9'));router[_0x0e26('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0e26('0xa')](_0x0e26('0xb'),auth[_0x0e26('0xc')](),controller[_0x0e26('0xd')]);router[_0x0e26('0xa')](_0x0e26('0xe'),auth[_0x0e26('0xc')](),controller['show']);router[_0x0e26('0xf')]('/',auth['isAuthenticated'](),controller[_0x0e26('0x10')]);router[_0x0e26('0x11')](_0x0e26('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x0e26('0x12')](_0x0e26('0xe'),auth['isAuthenticated'](),controller[_0x0e26('0x13')]);module[_0x0e26('0x14')]=router; \ No newline at end of file +var _0xac4f=['delete','destroy','multer','path','express','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update'];(function(_0xd4636c,_0x34dbf6){var _0x5ee17d=function(_0x223c38){while(--_0x223c38){_0xd4636c['push'](_0xd4636c['shift']());}};_0x5ee17d(++_0x34dbf6);}(_0xac4f,0x122));var _0xfac4=function(_0x3612c5,_0x23593e){_0x3612c5=_0x3612c5-0x0;var _0x2e6706=_0xac4f[_0x3612c5];return _0x2e6706;};'use strict';var multer=require(_0xfac4('0x0'));var util=require('util');var path=require(_0xfac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfac4('0x3'));var interaction=require(_0xfac4('0x4'));var config=require('../../config/environment');var controller=require(_0xfac4('0x5'));router[_0xfac4('0x6')]('/',auth[_0xfac4('0x7')](),controller['index']);router[_0xfac4('0x6')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x9')]);router[_0xfac4('0x6')](_0xfac4('0xa'),auth['isAuthenticated'](),controller[_0xfac4('0xb')]);router[_0xfac4('0xc')]('/',auth[_0xfac4('0x7')](),controller[_0xfac4('0xd')]);router[_0xfac4('0xe')](_0xfac4('0xa'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xf')]);router[_0xfac4('0x10')](_0xfac4('0xa'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index f3ed7af..3e70818 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 _0x7a7d=['moment','sequelize','exports','STRING','DATE'];(function(_0x5e4d7a,_0x474456){var _0x446c84=function(_0x254e70){while(--_0x254e70){_0x5e4d7a['push'](_0x5e4d7a['shift']());}};_0x446c84(++_0x474456);}(_0x7a7d,0x109));var _0xd7a7=function(_0x282b8f,_0x12fe0b){_0x282b8f=_0x282b8f-0x0;var _0x3ed0ac=_0x7a7d[_0x282b8f];return _0x3ed0ac;};'use strict';var moment=require(_0xd7a7('0x0'));var Sequelize=require(_0xd7a7('0x1'));module[_0xd7a7('0x2')]={'uniqueid':{'type':Sequelize[_0xd7a7('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xd7a7('0x4')]},'leaveAt':{'type':Sequelize[_0xd7a7('0x4')]},'acceptAt':{'type':Sequelize[_0xd7a7('0x4')]},'exitAt':{'type':Sequelize[_0xd7a7('0x4')]},'reason':{'type':Sequelize[_0xd7a7('0x3')]}}; \ No newline at end of file +var _0xb1c4=['exports','STRING','DATE','sequelize'];(function(_0x4d5703,_0x2f6ee1){var _0x2b2044=function(_0x5aa23d){while(--_0x5aa23d){_0x4d5703['push'](_0x4d5703['shift']());}};_0x2b2044(++_0x2f6ee1);}(_0xb1c4,0x8f));var _0x4b1c=function(_0x2a9162,_0x19f3e0){_0x2a9162=_0x2a9162-0x0;var _0x2fc48f=_0xb1c4[_0x2a9162];return _0x2fc48f;};'use strict';var moment=require('moment');var Sequelize=require(_0x4b1c('0x0'));module[_0x4b1c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x4b1c('0x2')]},'joinAt':{'type':Sequelize[_0x4b1c('0x3')]},'leaveAt':{'type':Sequelize[_0x4b1c('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4b1c('0x3')]},'reason':{'type':Sequelize[_0x4b1c('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 4325926..c605c1d 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 _0x5df9=['hasOwnProperty','order','sort','where','VIRTUAL','filter','options','includeAll','include','keys','merge','find','catch','create','body','params','describe','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x22c90b,_0x51db33){var _0x5e1e21=function(_0x2195bd){while(--_0x2195bd){_0x22c90b['push'](_0x22c90b['shift']());}};_0x5e1e21(++_0x51db33);}(_0x5df9,0xf2));var _0x95df=function(_0x1d0961,_0x14699e){_0x1d0961=_0x1d0961-0x0;var _0x43d633=_0x5df9[_0x1d0961];return _0x43d633;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x95df('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95df('0x1'));var rp=require(_0x95df('0x2'));var moment=require(_0x95df('0x3'));var BPromise=require(_0x95df('0x4'));var Mustache=require(_0x95df('0x5'));var util=require(_0x95df('0x6'));var path=require('path');var sox=require(_0x95df('0x7'));var csv=require(_0x95df('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95df('0x9'));var _=require(_0x95df('0xa'));var squel=require(_0x95df('0xb'));var crypto=require(_0x95df('0xc'));var jsforce=require(_0x95df('0xd'));var deskjs=require(_0x95df('0xe'));var toCsv=require('to-csv');var querystring=require(_0x95df('0xf'));var Papa=require(_0x95df('0x10'));var Redis=require('ioredis');var authService=require(_0x95df('0x11'));var qs=require(_0x95df('0x12'));var as=require(_0x95df('0x13'));var hardwareService=require(_0x95df('0x14'));var logger=require(_0x95df('0x15'))(_0x95df('0x16'));var utils=require(_0x95df('0x17'));var config=require(_0x95df('0x18'));var licenseUtil=require(_0x95df('0x19'));var db=require(_0x95df('0x1a'))['db'];function respondWithStatusCode(_0x20ce23,_0x146827){_0x146827=_0x146827||0xcc;return function(_0x834b6c){if(_0x834b6c){return _0x20ce23[_0x95df('0x1b')](_0x146827);}return _0x20ce23[_0x95df('0x1c')](_0x146827)[_0x95df('0x1d')]();};}function respondWithResult(_0x399cb6,_0x24f345){_0x24f345=_0x24f345||0xc8;return function(_0x2fd0a4){if(_0x2fd0a4){return _0x399cb6[_0x95df('0x1c')](_0x24f345)['json'](_0x2fd0a4);}};}function respondWithFilteredResult(_0x2dedf9,_0xaa20cb){return function(_0x3b9238){if(_0x3b9238){var _0xc60430=typeof _0xaa20cb[_0x95df('0x1e')]===_0x95df('0x1f')&&typeof _0xaa20cb[_0x95df('0x20')]===_0x95df('0x1f');var _0x24792e=_0x3b9238[_0x95df('0x21')];var _0x4d0b64=_0xc60430?0x0:_0xaa20cb[_0x95df('0x1e')];var _0xcdf164=_0xc60430?_0x3b9238[_0x95df('0x21')]:_0xaa20cb['offset']+_0xaa20cb[_0x95df('0x20')];var _0xec7c0a;if(_0xcdf164>=_0x24792e){_0xcdf164=_0x24792e;_0xec7c0a=0xc8;}else{_0xec7c0a=0xce;}_0x2dedf9[_0x95df('0x1c')](_0xec7c0a);return _0x2dedf9['set'](_0x95df('0x22'),_0x4d0b64+'-'+_0xcdf164+'/'+_0x24792e)[_0x95df('0x23')](_0x3b9238);}return null;};}function patchUpdates(_0x52bbf6){return function(_0x18c97a){try{jsonpatch[_0x95df('0x24')](_0x18c97a,_0x52bbf6,!![]);}catch(_0x237c70){return BPromise[_0x95df('0x25')](_0x237c70);}return _0x18c97a[_0x95df('0x26')]();};}function saveUpdates(_0x48229b,_0x45c052){return function(_0x27922d){if(_0x27922d){return _0x27922d[_0x95df('0x27')](_0x48229b)['then'](function(_0x4095ee){return _0x4095ee;});}return null;};}function removeEntity(_0x481201,_0x3018ad){return function(_0x213983){if(_0x213983){return _0x213983[_0x95df('0x28')]()[_0x95df('0x29')](function(){_0x481201[_0x95df('0x1c')](0xcc)[_0x95df('0x1d')]();});}};}function handleEntityNotFound(_0x4757f1,_0x11e3e5){return function(_0x21daae){if(!_0x21daae){_0x4757f1[_0x95df('0x1b')](0x194);}return _0x21daae;};}function handleError(_0x4cd84e,_0x379067){_0x379067=_0x379067||0x1f4;return function(_0x4c50e4){logger['error'](_0x4c50e4['stack']);if(_0x4c50e4['name']){delete _0x4c50e4[_0x95df('0x2a')];}_0x4cd84e[_0x95df('0x1c')](_0x379067)[_0x95df('0x2b')](_0x4c50e4);};}exports[_0x95df('0x2c')]=function(_0x37fbbc,_0x2204c7){var _0x24b8ed={},_0x29c7bc={},_0x73783f={'count':0x0,'rows':[]};var _0x316ab1=_[_0x95df('0x2d')](db[_0x95df('0x2e')][_0x95df('0x2f')],function(_0x5196d0){return{'name':_0x5196d0[_0x95df('0x30')],'type':_0x5196d0[_0x95df('0x31')][_0x95df('0x32')]};});_0x29c7bc['model']=_[_0x95df('0x2d')](_0x316ab1,_0x95df('0x2a'));_0x29c7bc['query']=_['keys'](_0x37fbbc[_0x95df('0x33')]);_0x29c7bc[_0x95df('0x34')]=_[_0x95df('0x35')](_0x29c7bc[_0x95df('0x36')],_0x29c7bc[_0x95df('0x33')]);_0x24b8ed[_0x95df('0x37')]=_['intersection'](_0x29c7bc[_0x95df('0x36')],qs[_0x95df('0x38')](_0x37fbbc[_0x95df('0x33')][_0x95df('0x38')]));_0x24b8ed['attributes']=_0x24b8ed['attributes'][_0x95df('0x39')]?_0x24b8ed[_0x95df('0x37')]:_0x29c7bc[_0x95df('0x36')];if(!_0x37fbbc[_0x95df('0x33')][_0x95df('0x3a')]('nolimit')){_0x24b8ed['limit']=qs['limit'](_0x37fbbc[_0x95df('0x33')]['limit']);_0x24b8ed['offset']=qs[_0x95df('0x1e')](_0x37fbbc[_0x95df('0x33')][_0x95df('0x1e')]);}_0x24b8ed[_0x95df('0x3b')]=qs[_0x95df('0x3c')](_0x37fbbc[_0x95df('0x33')][_0x95df('0x3c')]);_0x24b8ed['where']=qs[_0x95df('0x34')](_['pick'](_0x37fbbc['query'],_0x29c7bc[_0x95df('0x34')]),_0x316ab1);if(_0x37fbbc[_0x95df('0x33')]['filter']){_0x24b8ed[_0x95df('0x3d')]=_['merge'](_0x24b8ed['where'],{'$or':_[_0x95df('0x2d')](_0x316ab1,function(_0x201c57){if(_0x201c57[_0x95df('0x31')]!==_0x95df('0x3e')){var _0x357372={};_0x357372[_0x201c57[_0x95df('0x2a')]]={'$like':'%'+_0x37fbbc[_0x95df('0x33')][_0x95df('0x3f')]+'%'};return _0x357372;}})});}_0x24b8ed=_['merge']({},_0x24b8ed,_0x37fbbc[_0x95df('0x40')]);var _0x3a0801={'where':_0x24b8ed['where']};return db[_0x95df('0x2e')][_0x95df('0x21')](_0x3a0801)['then'](function(_0x5cc5ef){_0x73783f['count']=_0x5cc5ef;if(_0x37fbbc[_0x95df('0x33')][_0x95df('0x41')]){_0x24b8ed[_0x95df('0x42')]=[{'all':!![]}];}return db[_0x95df('0x2e')]['findAll'](_0x24b8ed);})[_0x95df('0x29')](function(_0x2b44bc){_0x73783f['rows']=_0x2b44bc;return _0x73783f;})['then'](respondWithFilteredResult(_0x2204c7,_0x24b8ed))['catch'](handleError(_0x2204c7,null));};exports['show']=function(_0x1b4178,_0x40abba){var _0x2edd67={'raw':!![],'where':{'id':_0x1b4178['params']['id']}},_0x26e70e={};_0x26e70e[_0x95df('0x36')]=_['keys'](db[_0x95df('0x2e')]['rawAttributes']);_0x26e70e[_0x95df('0x33')]=_[_0x95df('0x43')](_0x1b4178[_0x95df('0x33')]);_0x26e70e['filters']=_[_0x95df('0x35')](_0x26e70e[_0x95df('0x36')],_0x26e70e['query']);_0x2edd67[_0x95df('0x37')]=_[_0x95df('0x35')](_0x26e70e['model'],qs['fields'](_0x1b4178[_0x95df('0x33')][_0x95df('0x38')]));_0x2edd67[_0x95df('0x37')]=_0x2edd67[_0x95df('0x37')][_0x95df('0x39')]?_0x2edd67[_0x95df('0x37')]:_0x26e70e[_0x95df('0x36')];if(_0x1b4178[_0x95df('0x33')][_0x95df('0x41')]){_0x2edd67['include']=[{'all':!![]}];}_0x2edd67=_[_0x95df('0x44')]({},_0x2edd67,_0x1b4178[_0x95df('0x40')]);return db[_0x95df('0x2e')][_0x95df('0x45')](_0x2edd67)[_0x95df('0x29')](handleEntityNotFound(_0x40abba,null))[_0x95df('0x29')](respondWithResult(_0x40abba,null))[_0x95df('0x46')](handleError(_0x40abba,null));};exports[_0x95df('0x47')]=function(_0x49dfe9,_0x1adc91){return db[_0x95df('0x2e')]['create'](_0x49dfe9[_0x95df('0x48')],{})['then'](respondWithResult(_0x1adc91,0xc9))[_0x95df('0x46')](handleError(_0x1adc91,null));};exports[_0x95df('0x27')]=function(_0x13c574,_0x447829){if(_0x13c574['body']['id']){delete _0x13c574[_0x95df('0x48')]['id'];}return db[_0x95df('0x2e')][_0x95df('0x45')]({'where':{'id':_0x13c574[_0x95df('0x49')]['id']}})[_0x95df('0x29')](handleEntityNotFound(_0x447829,null))[_0x95df('0x29')](saveUpdates(_0x13c574[_0x95df('0x48')],null))[_0x95df('0x29')](respondWithResult(_0x447829,null))['catch'](handleError(_0x447829,null));};exports[_0x95df('0x28')]=function(_0x33c94f,_0x19dd5e){return db[_0x95df('0x2e')][_0x95df('0x45')]({'where':{'id':_0x33c94f[_0x95df('0x49')]['id']}})[_0x95df('0x29')](handleEntityNotFound(_0x19dd5e,null))['then'](removeEntity(_0x19dd5e,null))[_0x95df('0x46')](handleError(_0x19dd5e,null));};exports[_0x95df('0x4a')]=function(_0xa2d57f,_0x1a46e2){return db[_0x95df('0x2e')][_0x95df('0x4a')]()['then'](respondWithResult(_0x1a46e2,null))[_0x95df('0x46')](handleError(_0x1a46e2,null));}; \ No newline at end of file +var _0x57df=['path','sox','to-csv','ejs','lodash','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','SmsQueueReport','findAll','rows','show','length','find','catch','create','body','params','destroy','describe','eml-format','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x364b32,_0x4dec35){var _0x3f3ea0=function(_0x1911a8){while(--_0x1911a8){_0x364b32['push'](_0x364b32['shift']());}};_0x3f3ea0(++_0x4dec35);}(_0x57df,0xd2));var _0xf57d=function(_0x443b59,_0xf382){_0x443b59=_0x443b59-0x0;var _0x2c5de9=_0x57df[_0x443b59];return _0x2c5de9;};'use strict';var emlformat=require(_0xf57d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf57d('0x1'));var rp=require(_0xf57d('0x2'));var moment=require(_0xf57d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf57d('0x4'));var util=require(_0xf57d('0x5'));var path=require(_0xf57d('0x6'));var sox=require(_0xf57d('0x7'));var csv=require(_0xf57d('0x8'));var ejs=require(_0xf57d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf57d('0xa'));var squel=require('squel');var crypto=require(_0xf57d('0xb'));var jsforce=require(_0xf57d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf57d('0x8'));var querystring=require('querystring');var Papa=require(_0xf57d('0xd'));var Redis=require(_0xf57d('0xe'));var authService=require(_0xf57d('0xf'));var qs=require(_0xf57d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf57d('0x11'));var logger=require('../../config/logger')(_0xf57d('0x12'));var utils=require(_0xf57d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf57d('0x14'));var db=require(_0xf57d('0x15'))['db'];function respondWithStatusCode(_0x2569ea,_0x19ac72){_0x19ac72=_0x19ac72||0xcc;return function(_0x539c86){if(_0x539c86){return _0x2569ea[_0xf57d('0x16')](_0x19ac72);}return _0x2569ea[_0xf57d('0x17')](_0x19ac72)[_0xf57d('0x18')]();};}function respondWithResult(_0x2bbcda,_0x328bc1){_0x328bc1=_0x328bc1||0xc8;return function(_0x665132){if(_0x665132){return _0x2bbcda[_0xf57d('0x17')](_0x328bc1)['json'](_0x665132);}};}function respondWithFilteredResult(_0x4d4c99,_0x4d8a5e){return function(_0x5be6f4){if(_0x5be6f4){var _0x82b7df=typeof _0x4d8a5e[_0xf57d('0x19')]===_0xf57d('0x1a')&&typeof _0x4d8a5e[_0xf57d('0x1b')]===_0xf57d('0x1a');var _0x5c468e=_0x5be6f4['count'];var _0x4c5c57=_0x82b7df?0x0:_0x4d8a5e['offset'];var _0x54ed9a=_0x82b7df?_0x5be6f4[_0xf57d('0x1c')]:_0x4d8a5e[_0xf57d('0x19')]+_0x4d8a5e[_0xf57d('0x1b')];var _0x39decb;if(_0x54ed9a>=_0x5c468e){_0x54ed9a=_0x5c468e;_0x39decb=0xc8;}else{_0x39decb=0xce;}_0x4d4c99[_0xf57d('0x17')](_0x39decb);return _0x4d4c99[_0xf57d('0x1d')](_0xf57d('0x1e'),_0x4c5c57+'-'+_0x54ed9a+'/'+_0x5c468e)['json'](_0x5be6f4);}return null;};}function patchUpdates(_0x275ee3){return function(_0x164c98){try{jsonpatch[_0xf57d('0x1f')](_0x164c98,_0x275ee3,!![]);}catch(_0x44d193){return BPromise[_0xf57d('0x20')](_0x44d193);}return _0x164c98[_0xf57d('0x21')]();};}function saveUpdates(_0x2f9442,_0x598850){return function(_0x133fa1){if(_0x133fa1){return _0x133fa1[_0xf57d('0x22')](_0x2f9442)[_0xf57d('0x23')](function(_0x15c1f4){return _0x15c1f4;});}return null;};}function removeEntity(_0x240407,_0x1e3557){return function(_0x597c59){if(_0x597c59){return _0x597c59['destroy']()[_0xf57d('0x23')](function(){_0x240407[_0xf57d('0x17')](0xcc)[_0xf57d('0x18')]();});}};}function handleEntityNotFound(_0x559343,_0x4db612){return function(_0x5edd4a){if(!_0x5edd4a){_0x559343[_0xf57d('0x16')](0x194);}return _0x5edd4a;};}function handleError(_0x388ef3,_0x236222){_0x236222=_0x236222||0x1f4;return function(_0x120c36){logger[_0xf57d('0x24')](_0x120c36[_0xf57d('0x25')]);if(_0x120c36[_0xf57d('0x26')]){delete _0x120c36['name'];}_0x388ef3[_0xf57d('0x17')](_0x236222)[_0xf57d('0x27')](_0x120c36);};}exports['index']=function(_0x381196,_0xca123b){var _0x55412b={},_0x40bb7e={},_0x5d31c8={'count':0x0,'rows':[]};var _0x194b25=_[_0xf57d('0x28')](db['SmsQueueReport'][_0xf57d('0x29')],function(_0x4991d9){return{'name':_0x4991d9[_0xf57d('0x2a')],'type':_0x4991d9[_0xf57d('0x2b')]['key']};});_0x40bb7e[_0xf57d('0x2c')]=_[_0xf57d('0x28')](_0x194b25,_0xf57d('0x26'));_0x40bb7e['query']=_[_0xf57d('0x2d')](_0x381196[_0xf57d('0x2e')]);_0x40bb7e['filters']=_[_0xf57d('0x2f')](_0x40bb7e[_0xf57d('0x2c')],_0x40bb7e[_0xf57d('0x2e')]);_0x55412b[_0xf57d('0x30')]=_[_0xf57d('0x2f')](_0x40bb7e[_0xf57d('0x2c')],qs[_0xf57d('0x31')](_0x381196[_0xf57d('0x2e')]['fields']));_0x55412b[_0xf57d('0x30')]=_0x55412b[_0xf57d('0x30')]['length']?_0x55412b[_0xf57d('0x30')]:_0x40bb7e[_0xf57d('0x2c')];if(!_0x381196[_0xf57d('0x2e')]['hasOwnProperty'](_0xf57d('0x32'))){_0x55412b[_0xf57d('0x1b')]=qs[_0xf57d('0x1b')](_0x381196[_0xf57d('0x2e')][_0xf57d('0x1b')]);_0x55412b['offset']=qs['offset'](_0x381196[_0xf57d('0x2e')]['offset']);}_0x55412b[_0xf57d('0x33')]=qs[_0xf57d('0x34')](_0x381196[_0xf57d('0x2e')]['sort']);_0x55412b['where']=qs['filters'](_['pick'](_0x381196['query'],_0x40bb7e[_0xf57d('0x35')]),_0x194b25);if(_0x381196['query'][_0xf57d('0x36')]){_0x55412b[_0xf57d('0x37')]=_[_0xf57d('0x38')](_0x55412b['where'],{'$or':_[_0xf57d('0x28')](_0x194b25,function(_0x1f65de){if(_0x1f65de[_0xf57d('0x2b')]!==_0xf57d('0x39')){var _0x2ebad2={};_0x2ebad2[_0x1f65de[_0xf57d('0x26')]]={'$like':'%'+_0x381196[_0xf57d('0x2e')][_0xf57d('0x36')]+'%'};return _0x2ebad2;}})});}_0x55412b=_[_0xf57d('0x38')]({},_0x55412b,_0x381196[_0xf57d('0x3a')]);var _0x632601={'where':_0x55412b[_0xf57d('0x37')]};return db['SmsQueueReport']['count'](_0x632601)['then'](function(_0x567011){_0x5d31c8[_0xf57d('0x1c')]=_0x567011;if(_0x381196[_0xf57d('0x2e')]['includeAll']){_0x55412b[_0xf57d('0x3b')]=[{'all':!![]}];}return db[_0xf57d('0x3c')][_0xf57d('0x3d')](_0x55412b);})[_0xf57d('0x23')](function(_0x417029){_0x5d31c8[_0xf57d('0x3e')]=_0x417029;return _0x5d31c8;})[_0xf57d('0x23')](respondWithFilteredResult(_0xca123b,_0x55412b))['catch'](handleError(_0xca123b,null));};exports[_0xf57d('0x3f')]=function(_0x84f2cc,_0x5e625f){var _0xc98bc={'raw':!![],'where':{'id':_0x84f2cc['params']['id']}},_0x464655={};_0x464655[_0xf57d('0x2c')]=_[_0xf57d('0x2d')](db[_0xf57d('0x3c')]['rawAttributes']);_0x464655[_0xf57d('0x2e')]=_[_0xf57d('0x2d')](_0x84f2cc[_0xf57d('0x2e')]);_0x464655[_0xf57d('0x35')]=_[_0xf57d('0x2f')](_0x464655['model'],_0x464655[_0xf57d('0x2e')]);_0xc98bc[_0xf57d('0x30')]=_['intersection'](_0x464655[_0xf57d('0x2c')],qs[_0xf57d('0x31')](_0x84f2cc[_0xf57d('0x2e')]['fields']));_0xc98bc[_0xf57d('0x30')]=_0xc98bc['attributes'][_0xf57d('0x40')]?_0xc98bc[_0xf57d('0x30')]:_0x464655[_0xf57d('0x2c')];if(_0x84f2cc[_0xf57d('0x2e')]['includeAll']){_0xc98bc[_0xf57d('0x3b')]=[{'all':!![]}];}_0xc98bc=_[_0xf57d('0x38')]({},_0xc98bc,_0x84f2cc[_0xf57d('0x3a')]);return db[_0xf57d('0x3c')][_0xf57d('0x41')](_0xc98bc)[_0xf57d('0x23')](handleEntityNotFound(_0x5e625f,null))[_0xf57d('0x23')](respondWithResult(_0x5e625f,null))[_0xf57d('0x42')](handleError(_0x5e625f,null));};exports[_0xf57d('0x43')]=function(_0x58352f,_0x6d3c75){return db[_0xf57d('0x3c')][_0xf57d('0x43')](_0x58352f[_0xf57d('0x44')],{})[_0xf57d('0x23')](respondWithResult(_0x6d3c75,0xc9))[_0xf57d('0x42')](handleError(_0x6d3c75,null));};exports[_0xf57d('0x22')]=function(_0x3ca5dc,_0x57480f){if(_0x3ca5dc[_0xf57d('0x44')]['id']){delete _0x3ca5dc[_0xf57d('0x44')]['id'];}return db[_0xf57d('0x3c')]['find']({'where':{'id':_0x3ca5dc[_0xf57d('0x45')]['id']}})[_0xf57d('0x23')](handleEntityNotFound(_0x57480f,null))['then'](saveUpdates(_0x3ca5dc[_0xf57d('0x44')],null))[_0xf57d('0x23')](respondWithResult(_0x57480f,null))[_0xf57d('0x42')](handleError(_0x57480f,null));};exports[_0xf57d('0x46')]=function(_0x3ef3d6,_0x3f7b8b){return db[_0xf57d('0x3c')][_0xf57d('0x41')]({'where':{'id':_0x3ef3d6[_0xf57d('0x45')]['id']}})['then'](handleEntityNotFound(_0x3f7b8b,null))[_0xf57d('0x23')](removeEntity(_0x3f7b8b,null))['catch'](handleError(_0x3f7b8b,null));};exports[_0xf57d('0x47')]=function(_0x5c20e2,_0x51c4eb){return db[_0xf57d('0x3c')]['describe']()[_0xf57d('0x23')](respondWithResult(_0x51c4eb,null))[_0xf57d('0x42')](handleError(_0x51c4eb,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b8066a6..19e7ddc 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[{'name':_0x3071('0xc'),'fields':[_0x3071('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x38d9d3,_0x17ad7c){var _0x1334bd=function(_0x153a8a){while(--_0x153a8a){_0x38d9d3['push'](_0x38d9d3['shift']());}};_0x1334bd(++_0x17ad7c);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x24875d,_0x4fb24d){_0x24875d=_0x24875d-0x0;var _0x181471=_0xcb91[_0x24875d];return _0x181471;};'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 8d88691..37fc914 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 _0xdb12=['limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','UpdateSmsQueueReport','where'];(function(_0x5233fd,_0x13b2fc){var _0x1b596b=function(_0x4b71e0){while(--_0x4b71e0){_0x5233fd['push'](_0x5233fd['shift']());}};_0x1b596b(++_0x13b2fc);}(_0xdb12,0x133));var _0x2db1=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xdb12[_0x3acee8];return _0x5046cc;};'use strict';var _=require(_0x2db1('0x0'));var util=require(_0x2db1('0x1'));var moment=require(_0x2db1('0x2'));var BPromise=require(_0x2db1('0x3'));var rs=require(_0x2db1('0x4'));var fs=require('fs');var Redis=require(_0x2db1('0x5'));var db=require(_0x2db1('0x6'))['db'];var utils=require(_0x2db1('0x7'));var logger=require(_0x2db1('0x8'))(_0x2db1('0x9'));var config=require(_0x2db1('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x2db1('0xb')][_0x2db1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x41c007,_0x2d87a9,_0x278073){return new BPromise(function(_0x3fecb4,_0xbdef73){return client['request'](_0x41c007,_0x278073)[_0x2db1('0xd')](function(_0x374ed0){logger[_0x2db1('0xe')](_0x2db1('0xf'),_0x2d87a9,'request\x20sent');logger[_0x2db1('0x10')](_0x2db1('0x11'),_0x2d87a9,_0x2db1('0x12'),JSON[_0x2db1('0x13')](_0x374ed0));if(_0x374ed0['error']){if(_0x374ed0[_0x2db1('0x14')][_0x2db1('0x15')]===0x1f4){logger[_0x2db1('0x14')](_0x2db1('0xf'),_0x2d87a9,_0x374ed0['error'][_0x2db1('0x16')]);return _0xbdef73(_0x374ed0[_0x2db1('0x14')]['message']);}logger['error'](_0x2db1('0xf'),_0x2d87a9,_0x374ed0['error']['message']);return _0x3fecb4(_0x374ed0[_0x2db1('0x14')]['message']);}else{logger[_0x2db1('0xe')](_0x2db1('0xf'),_0x2d87a9,'request\x20sent');_0x3fecb4(_0x374ed0[_0x2db1('0x17')][_0x2db1('0x16')]);}})[_0x2db1('0x18')](function(_0x5cf8bf){logger['error'](_0x2db1('0xf'),_0x2d87a9,_0x5cf8bf);_0xbdef73(_0x5cf8bf);});});}exports[_0x2db1('0x19')]=function(_0x40f333){var _0x5a8126=this;return new Promise(function(_0x496419,_0x5ed11f){return db[_0x2db1('0x1a')][_0x2db1('0x1b')](_0x40f333[_0x2db1('0x1c')],{'raw':_0x40f333[_0x2db1('0x1d')]?_0x40f333[_0x2db1('0x1d')][_0x2db1('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x2b7184){logger[_0x2db1('0xe')](_0x2db1('0x19'),_0x40f333);logger['debug'](_0x2db1('0x19'),_0x40f333,JSON[_0x2db1('0x13')](_0x2b7184));_0x496419(_0x2b7184);})['catch'](function(_0xdc0729){logger[_0x2db1('0x14')]('CreateSmsQueueReport',_0xdc0729[_0x2db1('0x16')],_0x40f333);_0x5ed11f(_0x5a8126[_0x2db1('0x14')](0x1f4,_0xdc0729[_0x2db1('0x16')]));});});};exports[_0x2db1('0x1f')]=function(_0x1148b4){var _0x216a20=this;return new Promise(function(_0x21f6d7,_0x238488){return db[_0x2db1('0x1a')]['update'](_0x1148b4['body'],{'raw':_0x1148b4[_0x2db1('0x1d')]?_0x1148b4[_0x2db1('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1148b4[_0x2db1('0x1d')]?_0x1148b4[_0x2db1('0x1d')][_0x2db1('0x20')]||null:null,'attributes':_0x1148b4[_0x2db1('0x1d')]?_0x1148b4['options']['attributes']||null:null,'limit':_0x1148b4['options']?_0x1148b4[_0x2db1('0x1d')][_0x2db1('0x21')]||null:null})['then'](function(_0x4f66c8){logger[_0x2db1('0xe')]('UpdateSmsQueueReport',_0x1148b4);logger['debug'](_0x2db1('0x1f'),_0x1148b4,JSON['stringify'](_0x4f66c8));_0x21f6d7(_0x4f66c8);})['catch'](function(_0x4942ec){logger[_0x2db1('0x14')](_0x2db1('0x1f'),_0x4942ec[_0x2db1('0x16')],_0x1148b4);_0x238488(_0x216a20[_0x2db1('0x14')](0x1f4,_0x4942ec['message']));});});}; \ No newline at end of file +var _0x2acc=['client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsQueueReport','body','options','raw','then','CreateSmsQueueReport','limit','UpdateSmsQueueReport','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2f2f67,_0x388685){var _0x3a81e1=function(_0x26d130){while(--_0x26d130){_0x2f2f67['push'](_0x2f2f67['shift']());}};_0x3a81e1(++_0x388685);}(_0x2acc,0x11d));var _0xc2ac=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2acc[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc2ac('0x0'));var util=require(_0xc2ac('0x1'));var moment=require(_0xc2ac('0x2'));var BPromise=require(_0xc2ac('0x3'));var rs=require(_0xc2ac('0x4'));var fs=require('fs');var Redis=require(_0xc2ac('0x5'));var db=require(_0xc2ac('0x6'))['db'];var utils=require(_0xc2ac('0x7'));var logger=require(_0xc2ac('0x8'))(_0xc2ac('0x9'));var config=require(_0xc2ac('0xa'));var jayson=require(_0xc2ac('0xb'));var client=jayson[_0xc2ac('0xc')][_0xc2ac('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4050a2,_0x32f8a4,_0x293fb0){return new BPromise(function(_0x4c01e4,_0x2ca8cd){return client[_0xc2ac('0xe')](_0x4050a2,_0x293fb0)['then'](function(_0x3eaac5){logger[_0xc2ac('0xf')](_0xc2ac('0x10'),_0x32f8a4,_0xc2ac('0x11'));logger[_0xc2ac('0x12')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x32f8a4,'request\x20sent',JSON[_0xc2ac('0x13')](_0x3eaac5));if(_0x3eaac5[_0xc2ac('0x14')]){if(_0x3eaac5[_0xc2ac('0x14')][_0xc2ac('0x15')]===0x1f4){logger['error'](_0xc2ac('0x10'),_0x32f8a4,_0x3eaac5[_0xc2ac('0x14')][_0xc2ac('0x16')]);return _0x2ca8cd(_0x3eaac5['error'][_0xc2ac('0x16')]);}logger['error'](_0xc2ac('0x10'),_0x32f8a4,_0x3eaac5[_0xc2ac('0x14')][_0xc2ac('0x16')]);return _0x4c01e4(_0x3eaac5['error'][_0xc2ac('0x16')]);}else{logger[_0xc2ac('0xf')](_0xc2ac('0x10'),_0x32f8a4,_0xc2ac('0x11'));_0x4c01e4(_0x3eaac5[_0xc2ac('0x17')][_0xc2ac('0x16')]);}})[_0xc2ac('0x18')](function(_0x872fe7){logger[_0xc2ac('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x32f8a4,_0x872fe7);_0x2ca8cd(_0x872fe7);});});}exports['CreateSmsQueueReport']=function(_0x2d7726){var _0x3f9cea=this;return new Promise(function(_0xf52b80,_0x180e2d){return db[_0xc2ac('0x19')]['create'](_0x2d7726[_0xc2ac('0x1a')],{'raw':_0x2d7726[_0xc2ac('0x1b')]?_0x2d7726['options'][_0xc2ac('0x1c')]===undefined?!![]:![]:!![]})[_0xc2ac('0x1d')](function(_0x5c6dd5){logger[_0xc2ac('0xf')](_0xc2ac('0x1e'),_0x2d7726);logger[_0xc2ac('0x12')](_0xc2ac('0x1e'),_0x2d7726,JSON['stringify'](_0x5c6dd5));_0xf52b80(_0x5c6dd5);})[_0xc2ac('0x18')](function(_0x5a0bcd){logger[_0xc2ac('0x14')]('CreateSmsQueueReport',_0x5a0bcd[_0xc2ac('0x16')],_0x2d7726);_0x180e2d(_0x3f9cea[_0xc2ac('0x14')](0x1f4,_0x5a0bcd[_0xc2ac('0x16')]));});});};exports['UpdateSmsQueueReport']=function(_0x516232){var _0x36a9ac=this;return new Promise(function(_0x1535cb,_0x36019b){return db[_0xc2ac('0x19')]['update'](_0x516232['body'],{'raw':_0x516232[_0xc2ac('0x1b')]?_0x516232[_0xc2ac('0x1b')][_0xc2ac('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x516232[_0xc2ac('0x1b')]?_0x516232[_0xc2ac('0x1b')]['where']||null:null,'attributes':_0x516232[_0xc2ac('0x1b')]?_0x516232[_0xc2ac('0x1b')]['attributes']||null:null,'limit':_0x516232[_0xc2ac('0x1b')]?_0x516232['options'][_0xc2ac('0x1f')]||null:null})[_0xc2ac('0x1d')](function(_0x349551){logger['info']('UpdateSmsQueueReport',_0x516232);logger[_0xc2ac('0x12')]('UpdateSmsQueueReport',_0x516232,JSON['stringify'](_0x349551));_0x1535cb(_0x349551);})[_0xc2ac('0x18')](function(_0x231d3a){logger[_0xc2ac('0x14')](_0xc2ac('0x20'),_0x231d3a[_0xc2ac('0x16')],_0x516232);_0x36019b(_0x36a9ac['error'](0x1f4,_0x231d3a[_0xc2ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index d005361..8c92daf 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 _0xb647=['get','isAuthenticated','index','/describe','describe','/:id','show','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x48dec4,_0x2284f8){var _0x31d38b=function(_0x1f5cf4){while(--_0x1f5cf4){_0x48dec4['push'](_0x48dec4['shift']());}};_0x31d38b(++_0x2284f8);}(_0xb647,0xdb));var _0x7b64=function(_0xda90d7,_0x2f62f5){_0xda90d7=_0xda90d7-0x0;var _0x520af6=_0xb647[_0xda90d7];return _0x520af6;};'use strict';var multer=require(_0x7b64('0x0'));var util=require(_0x7b64('0x1'));var path=require(_0x7b64('0x2'));var timeout=require(_0x7b64('0x3'));var express=require(_0x7b64('0x4'));var router=express[_0x7b64('0x5')]();var fs_extra=require(_0x7b64('0x6'));var auth=require(_0x7b64('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x7b64('0x8'));var controller=require('./smsTransferReport.controller');router[_0x7b64('0x9')]('/',auth[_0x7b64('0xa')](),controller[_0x7b64('0xb')]);router[_0x7b64('0x9')](_0x7b64('0xc'),auth[_0x7b64('0xa')](),controller[_0x7b64('0xd')]);router[_0x7b64('0x9')](_0x7b64('0xe'),auth['isAuthenticated'](),controller[_0x7b64('0xf')]);router['post']('/',auth[_0x7b64('0xa')](),controller['create']);router['put'](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller['update']);router[_0x7b64('0x10')](_0x7b64('0xe'),auth[_0x7b64('0xa')](),controller[_0x7b64('0x11')]);module[_0x7b64('0x12')]=router; \ No newline at end of file +var _0x4f17=['put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','post','create'];(function(_0x587f07,_0x1b31bd){var _0xdbd3af=function(_0x166140){while(--_0x166140){_0x587f07['push'](_0x587f07['shift']());}};_0xdbd3af(++_0x1b31bd);}(_0x4f17,0x9e));var _0x74f1=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x4f17[_0x10bcc4];return _0x2da988;};'use strict';var multer=require(_0x74f1('0x0'));var util=require('util');var path=require(_0x74f1('0x1'));var timeout=require(_0x74f1('0x2'));var express=require('express');var router=express[_0x74f1('0x3')]();var fs_extra=require(_0x74f1('0x4'));var auth=require(_0x74f1('0x5'));var interaction=require(_0x74f1('0x6'));var config=require(_0x74f1('0x7'));var controller=require('./smsTransferReport.controller');router['get']('/',auth[_0x74f1('0x8')](),controller['index']);router[_0x74f1('0x9')]('/describe',auth[_0x74f1('0x8')](),controller[_0x74f1('0xa')]);router[_0x74f1('0x9')]('/:id',auth[_0x74f1('0x8')](),controller['show']);router[_0x74f1('0xb')]('/',auth['isAuthenticated'](),controller[_0x74f1('0xc')]);router[_0x74f1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x74f1('0xe')]);router[_0x74f1('0xf')](_0x74f1('0x10'),auth[_0x74f1('0x8')](),controller[_0x74f1('0x11')]);module[_0x74f1('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 6bb5166..20cc5b7 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['account','agent','queue','NOW','sequelize','exports','STRING','ENUM'];(function(_0x29c983,_0x18e322){var _0x3c8d10=function(_0x585e75){while(--_0x585e75){_0x29c983['push'](_0x29c983['shift']());}};_0x3c8d10(++_0x18e322);}(_0xedd9,0xfc));var _0x9edd=function(_0x4e7f0c,_0x55e6a7){_0x4e7f0c=_0x4e7f0c-0x0;var _0x19c6b1=_0xedd9[_0x4e7f0c];return _0x19c6b1;};'use strict';var moment=require('moment');var Sequelize=require(_0x9edd('0x0'));module[_0x9edd('0x1')]={'uniqueid':{'type':Sequelize[_0x9edd('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9edd('0x3')](_0x9edd('0x4'),_0x9edd('0x5'),_0x9edd('0x6')),'allowNull':![],'defaultValue':_0x9edd('0x6')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x9edd('0x7')]}}; \ No newline at end of file +var _0x9bde=['NOW','sequelize','STRING','account','agent','queue','DATE'];(function(_0x2e4cbf,_0x8763d3){var _0x52840f=function(_0x31b93f){while(--_0x31b93f){_0x2e4cbf['push'](_0x2e4cbf['shift']());}};_0x52840f(++_0x8763d3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x218bb1,_0x1069a7){_0x218bb1=_0x218bb1-0x0;var _0x8c382=_0x9bde[_0x218bb1];return _0x8c382;};'use strict';var moment=require('moment');var Sequelize=require(_0xe9bd('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xe9bd('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xe9bd('0x2'),_0xe9bd('0x3'),_0xe9bd('0x4')),'allowNull':![],'defaultValue':_0xe9bd('0x4')},'transferredAt':{'type':Sequelize[_0xe9bd('0x5')],'allowNull':![],'defaultValue':Sequelize[_0xe9bd('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 1c4bb6a..1189710 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 _0xa342=['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/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SmsTransferReport','rawAttributes','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv'];(function(_0x3427c8,_0x2713c2){var _0x1a90d5=function(_0x356eec){while(--_0x356eec){_0x3427c8['push'](_0x3427c8['shift']());}};_0x1a90d5(++_0x2713c2);}(_0xa342,0x18b));var _0x2a34=function(_0x6fa132,_0x5ccdc5){_0x6fa132=_0x6fa132-0x0;var _0x22c750=_0xa342[_0x6fa132];return _0x22c750;};'use strict';var emlformat=require(_0x2a34('0x0'));var rimraf=require(_0x2a34('0x1'));var zipdir=require(_0x2a34('0x2'));var jsonpatch=require(_0x2a34('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a34('0x4'));var Mustache=require(_0x2a34('0x5'));var util=require(_0x2a34('0x6'));var path=require(_0x2a34('0x7'));var sox=require(_0x2a34('0x8'));var csv=require(_0x2a34('0x9'));var ejs=require(_0x2a34('0xa'));var fs=require('fs');var fs_extra=require(_0x2a34('0xb'));var _=require('lodash');var squel=require(_0x2a34('0xc'));var crypto=require(_0x2a34('0xd'));var jsforce=require(_0x2a34('0xe'));var deskjs=require(_0x2a34('0xf'));var toCsv=require(_0x2a34('0x9'));var querystring=require(_0x2a34('0x10'));var Papa=require(_0x2a34('0x11'));var Redis=require(_0x2a34('0x12'));var authService=require(_0x2a34('0x13'));var qs=require(_0x2a34('0x14'));var as=require(_0x2a34('0x15'));var hardwareService=require(_0x2a34('0x16'));var logger=require(_0x2a34('0x17'))(_0x2a34('0x18'));var utils=require(_0x2a34('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x2a34('0x1a'));var db=require(_0x2a34('0x1b'))['db'];function respondWithStatusCode(_0x534b94,_0x2c8694){_0x2c8694=_0x2c8694||0xcc;return function(_0x17e6c3){if(_0x17e6c3){return _0x534b94[_0x2a34('0x1c')](_0x2c8694);}return _0x534b94[_0x2a34('0x1d')](_0x2c8694)[_0x2a34('0x1e')]();};}function respondWithResult(_0x36ec52,_0x2c29ab){_0x2c29ab=_0x2c29ab||0xc8;return function(_0x41a7d5){if(_0x41a7d5){return _0x36ec52[_0x2a34('0x1d')](_0x2c29ab)[_0x2a34('0x1f')](_0x41a7d5);}};}function respondWithFilteredResult(_0x412378,_0x231415){return function(_0x22f8e6){if(_0x22f8e6){var _0x3572b8=typeof _0x231415[_0x2a34('0x20')]===_0x2a34('0x21')&&typeof _0x231415['limit']===_0x2a34('0x21');var _0x4f4631=_0x22f8e6[_0x2a34('0x22')];var _0x59b791=_0x3572b8?0x0:_0x231415[_0x2a34('0x20')];var _0x27bbfe=_0x3572b8?_0x22f8e6[_0x2a34('0x22')]:_0x231415[_0x2a34('0x20')]+_0x231415[_0x2a34('0x23')];var _0x54f76b;if(_0x27bbfe>=_0x4f4631){_0x27bbfe=_0x4f4631;_0x54f76b=0xc8;}else{_0x54f76b=0xce;}_0x412378[_0x2a34('0x1d')](_0x54f76b);return _0x412378[_0x2a34('0x24')](_0x2a34('0x25'),_0x59b791+'-'+_0x27bbfe+'/'+_0x4f4631)['json'](_0x22f8e6);}return null;};}function patchUpdates(_0x77980f){return function(_0x97f8){try{jsonpatch[_0x2a34('0x26')](_0x97f8,_0x77980f,!![]);}catch(_0x4828f7){return BPromise[_0x2a34('0x27')](_0x4828f7);}return _0x97f8[_0x2a34('0x28')]();};}function saveUpdates(_0x4a68a7,_0x2750cd){return function(_0x1fcb7){if(_0x1fcb7){return _0x1fcb7[_0x2a34('0x29')](_0x4a68a7)[_0x2a34('0x2a')](function(_0x3c4ac5){return _0x3c4ac5;});}return null;};}function removeEntity(_0x478e73,_0x5467b5){return function(_0x24b248){if(_0x24b248){return _0x24b248[_0x2a34('0x2b')]()['then'](function(){_0x478e73[_0x2a34('0x1d')](0xcc)[_0x2a34('0x1e')]();});}};}function handleEntityNotFound(_0x1a68df,_0x34fa2a){return function(_0x53799b){if(!_0x53799b){_0x1a68df[_0x2a34('0x1c')](0x194);}return _0x53799b;};}function handleError(_0x37113f,_0x4e165d){_0x4e165d=_0x4e165d||0x1f4;return function(_0x548739){logger[_0x2a34('0x2c')](_0x548739[_0x2a34('0x2d')]);if(_0x548739[_0x2a34('0x2e')]){delete _0x548739[_0x2a34('0x2e')];}_0x37113f['status'](_0x4e165d)[_0x2a34('0x2f')](_0x548739);};}exports[_0x2a34('0x30')]=function(_0x3292a4,_0x28613a){var _0x2b603b={},_0x32971c={},_0x39dae5={'count':0x0,'rows':[]};var _0x455cf6=_['map'](db[_0x2a34('0x31')][_0x2a34('0x32')],function(_0x9e0032){return{'name':_0x9e0032['fieldName'],'type':_0x9e0032['type'][_0x2a34('0x33')]};});_0x32971c[_0x2a34('0x34')]=_[_0x2a34('0x35')](_0x455cf6,_0x2a34('0x2e'));_0x32971c[_0x2a34('0x36')]=_[_0x2a34('0x37')](_0x3292a4['query']);_0x32971c['filters']=_['intersection'](_0x32971c['model'],_0x32971c[_0x2a34('0x36')]);_0x2b603b[_0x2a34('0x38')]=_[_0x2a34('0x39')](_0x32971c[_0x2a34('0x34')],qs[_0x2a34('0x3a')](_0x3292a4[_0x2a34('0x36')][_0x2a34('0x3a')]));_0x2b603b[_0x2a34('0x38')]=_0x2b603b['attributes'][_0x2a34('0x3b')]?_0x2b603b['attributes']:_0x32971c[_0x2a34('0x34')];if(!_0x3292a4['query'][_0x2a34('0x3c')](_0x2a34('0x3d'))){_0x2b603b[_0x2a34('0x23')]=qs[_0x2a34('0x23')](_0x3292a4[_0x2a34('0x36')][_0x2a34('0x23')]);_0x2b603b[_0x2a34('0x20')]=qs[_0x2a34('0x20')](_0x3292a4[_0x2a34('0x36')][_0x2a34('0x20')]);}_0x2b603b['order']=qs[_0x2a34('0x3e')](_0x3292a4[_0x2a34('0x36')]['sort']);_0x2b603b[_0x2a34('0x3f')]=qs[_0x2a34('0x40')](_[_0x2a34('0x41')](_0x3292a4[_0x2a34('0x36')],_0x32971c[_0x2a34('0x40')]),_0x455cf6);if(_0x3292a4['query'][_0x2a34('0x42')]){_0x2b603b[_0x2a34('0x3f')]=_[_0x2a34('0x43')](_0x2b603b[_0x2a34('0x3f')],{'$or':_[_0x2a34('0x35')](_0x455cf6,function(_0x2b5d1f){if(_0x2b5d1f['type']!==_0x2a34('0x44')){var _0x4160db={};_0x4160db[_0x2b5d1f[_0x2a34('0x2e')]]={'$like':'%'+_0x3292a4[_0x2a34('0x36')][_0x2a34('0x42')]+'%'};return _0x4160db;}})});}_0x2b603b=_[_0x2a34('0x43')]({},_0x2b603b,_0x3292a4[_0x2a34('0x45')]);var _0x586fa2={'where':_0x2b603b[_0x2a34('0x3f')]};return db['SmsTransferReport'][_0x2a34('0x22')](_0x586fa2)['then'](function(_0x31e811){_0x39dae5[_0x2a34('0x22')]=_0x31e811;if(_0x3292a4[_0x2a34('0x36')]['includeAll']){_0x2b603b[_0x2a34('0x46')]=[{'all':!![]}];}return db[_0x2a34('0x31')][_0x2a34('0x47')](_0x2b603b);})['then'](function(_0x346254){_0x39dae5[_0x2a34('0x48')]=_0x346254;return _0x39dae5;})[_0x2a34('0x2a')](respondWithFilteredResult(_0x28613a,_0x2b603b))[_0x2a34('0x49')](handleError(_0x28613a,null));};exports[_0x2a34('0x4a')]=function(_0x3b78b5,_0x2cdb99){var _0x29878e={'raw':!![],'where':{'id':_0x3b78b5[_0x2a34('0x4b')]['id']}},_0x76b118={};_0x76b118[_0x2a34('0x34')]=_['keys'](db[_0x2a34('0x31')]['rawAttributes']);_0x76b118['query']=_['keys'](_0x3b78b5[_0x2a34('0x36')]);_0x76b118[_0x2a34('0x40')]=_[_0x2a34('0x39')](_0x76b118[_0x2a34('0x34')],_0x76b118['query']);_0x29878e[_0x2a34('0x38')]=_[_0x2a34('0x39')](_0x76b118[_0x2a34('0x34')],qs[_0x2a34('0x3a')](_0x3b78b5[_0x2a34('0x36')][_0x2a34('0x3a')]));_0x29878e[_0x2a34('0x38')]=_0x29878e[_0x2a34('0x38')][_0x2a34('0x3b')]?_0x29878e[_0x2a34('0x38')]:_0x76b118['model'];if(_0x3b78b5[_0x2a34('0x36')][_0x2a34('0x4c')]){_0x29878e[_0x2a34('0x46')]=[{'all':!![]}];}_0x29878e=_['merge']({},_0x29878e,_0x3b78b5[_0x2a34('0x45')]);return db[_0x2a34('0x31')][_0x2a34('0x4d')](_0x29878e)[_0x2a34('0x2a')](handleEntityNotFound(_0x2cdb99,null))['then'](respondWithResult(_0x2cdb99,null))[_0x2a34('0x49')](handleError(_0x2cdb99,null));};exports['create']=function(_0x426ef6,_0x428950){return db[_0x2a34('0x31')][_0x2a34('0x4e')](_0x426ef6[_0x2a34('0x4f')],{})[_0x2a34('0x2a')](respondWithResult(_0x428950,0xc9))[_0x2a34('0x49')](handleError(_0x428950,null));};exports[_0x2a34('0x29')]=function(_0x5fd66a,_0x29b4df){if(_0x5fd66a[_0x2a34('0x4f')]['id']){delete _0x5fd66a['body']['id'];}return db[_0x2a34('0x31')][_0x2a34('0x4d')]({'where':{'id':_0x5fd66a[_0x2a34('0x4b')]['id']}})[_0x2a34('0x2a')](handleEntityNotFound(_0x29b4df,null))[_0x2a34('0x2a')](saveUpdates(_0x5fd66a[_0x2a34('0x4f')],null))[_0x2a34('0x2a')](respondWithResult(_0x29b4df,null))[_0x2a34('0x49')](handleError(_0x29b4df,null));};exports[_0x2a34('0x2b')]=function(_0x2b76df,_0x33e2d4){return db['SmsTransferReport'][_0x2a34('0x4d')]({'where':{'id':_0x2b76df['params']['id']}})['then'](handleEntityNotFound(_0x33e2d4,null))['then'](removeEntity(_0x33e2d4,null))[_0x2a34('0x49')](handleError(_0x33e2d4,null));};exports[_0x2a34('0x50')]=function(_0x2d444b,_0x54d9df){return db[_0x2a34('0x31')]['describe']()[_0x2a34('0x2a')](respondWithResult(_0x54d9df,null))[_0x2a34('0x49')](handleError(_0x54d9df,null));}; \ No newline at end of file +var _0xb439=['keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','params','rawAttributes','catch','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SmsTransferReport','fieldName','key'];(function(_0x283b30,_0x5d208f){var _0x45629a=function(_0x488a93){while(--_0x488a93){_0x283b30['push'](_0x283b30['shift']());}};_0x45629a(++_0x5d208f);}(_0xb439,0x159));var _0x9b43=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xb439[_0x1035c1];return _0x308d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9b43('0x0'));var zipdir=require(_0x9b43('0x1'));var jsonpatch=require(_0x9b43('0x2'));var rp=require(_0x9b43('0x3'));var moment=require(_0x9b43('0x4'));var BPromise=require(_0x9b43('0x5'));var Mustache=require('mustache');var util=require(_0x9b43('0x6'));var path=require(_0x9b43('0x7'));var sox=require(_0x9b43('0x8'));var csv=require(_0x9b43('0x9'));var ejs=require(_0x9b43('0xa'));var fs=require('fs');var fs_extra=require(_0x9b43('0xb'));var _=require(_0x9b43('0xc'));var squel=require(_0x9b43('0xd'));var crypto=require(_0x9b43('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9b43('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9b43('0x10'));var Papa=require(_0x9b43('0x11'));var Redis=require(_0x9b43('0x12'));var authService=require(_0x9b43('0x13'));var qs=require(_0x9b43('0x14'));var as=require(_0x9b43('0x15'));var hardwareService=require(_0x9b43('0x16'));var logger=require(_0x9b43('0x17'))(_0x9b43('0x18'));var utils=require(_0x9b43('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x9b43('0x1a'));var db=require(_0x9b43('0x1b'))['db'];function respondWithStatusCode(_0x1094f4,_0xa78eb4){_0xa78eb4=_0xa78eb4||0xcc;return function(_0x3820a0){if(_0x3820a0){return _0x1094f4['sendStatus'](_0xa78eb4);}return _0x1094f4[_0x9b43('0x1c')](_0xa78eb4)[_0x9b43('0x1d')]();};}function respondWithResult(_0x59ca55,_0x24d77f){_0x24d77f=_0x24d77f||0xc8;return function(_0x3dc260){if(_0x3dc260){return _0x59ca55[_0x9b43('0x1c')](_0x24d77f)[_0x9b43('0x1e')](_0x3dc260);}};}function respondWithFilteredResult(_0x3097af,_0x28b4f9){return function(_0x31bbaa){if(_0x31bbaa){var _0x4e03ca=typeof _0x28b4f9['offset']===_0x9b43('0x1f')&&typeof _0x28b4f9[_0x9b43('0x20')]===_0x9b43('0x1f');var _0x5ccb4b=_0x31bbaa[_0x9b43('0x21')];var _0x1180bd=_0x4e03ca?0x0:_0x28b4f9[_0x9b43('0x22')];var _0x54efff=_0x4e03ca?_0x31bbaa[_0x9b43('0x21')]:_0x28b4f9[_0x9b43('0x22')]+_0x28b4f9[_0x9b43('0x20')];var _0x56b92e;if(_0x54efff>=_0x5ccb4b){_0x54efff=_0x5ccb4b;_0x56b92e=0xc8;}else{_0x56b92e=0xce;}_0x3097af[_0x9b43('0x1c')](_0x56b92e);return _0x3097af['set']('Content-Range',_0x1180bd+'-'+_0x54efff+'/'+_0x5ccb4b)[_0x9b43('0x1e')](_0x31bbaa);}return null;};}function patchUpdates(_0x4af29d){return function(_0x50aeb2){try{jsonpatch[_0x9b43('0x23')](_0x50aeb2,_0x4af29d,!![]);}catch(_0x55fc26){return BPromise['reject'](_0x55fc26);}return _0x50aeb2[_0x9b43('0x24')]();};}function saveUpdates(_0x191498,_0x2f4640){return function(_0x427df6){if(_0x427df6){return _0x427df6[_0x9b43('0x25')](_0x191498)['then'](function(_0x4f7f35){return _0x4f7f35;});}return null;};}function removeEntity(_0x28419d,_0x37b041){return function(_0x29668a){if(_0x29668a){return _0x29668a[_0x9b43('0x26')]()[_0x9b43('0x27')](function(){_0x28419d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x574b60,_0x25f158){return function(_0x3cf91a){if(!_0x3cf91a){_0x574b60[_0x9b43('0x28')](0x194);}return _0x3cf91a;};}function handleError(_0x6db3df,_0x11daa6){_0x11daa6=_0x11daa6||0x1f4;return function(_0x2f03e5){logger[_0x9b43('0x29')](_0x2f03e5[_0x9b43('0x2a')]);if(_0x2f03e5['name']){delete _0x2f03e5[_0x9b43('0x2b')];}_0x6db3df['status'](_0x11daa6)[_0x9b43('0x2c')](_0x2f03e5);};}exports[_0x9b43('0x2d')]=function(_0x1f5132,_0x1f7ea9){var _0x11649f={},_0x467738={},_0x5724b3={'count':0x0,'rows':[]};var _0x1a30d5=_[_0x9b43('0x2e')](db[_0x9b43('0x2f')]['rawAttributes'],function(_0xd6f061){return{'name':_0xd6f061[_0x9b43('0x30')],'type':_0xd6f061['type'][_0x9b43('0x31')]};});_0x467738['model']=_['map'](_0x1a30d5,_0x9b43('0x2b'));_0x467738['query']=_[_0x9b43('0x32')](_0x1f5132['query']);_0x467738['filters']=_[_0x9b43('0x33')](_0x467738[_0x9b43('0x34')],_0x467738[_0x9b43('0x35')]);_0x11649f[_0x9b43('0x36')]=_[_0x9b43('0x33')](_0x467738[_0x9b43('0x34')],qs['fields'](_0x1f5132[_0x9b43('0x35')][_0x9b43('0x37')]));_0x11649f['attributes']=_0x11649f[_0x9b43('0x36')][_0x9b43('0x38')]?_0x11649f[_0x9b43('0x36')]:_0x467738[_0x9b43('0x34')];if(!_0x1f5132[_0x9b43('0x35')][_0x9b43('0x39')](_0x9b43('0x3a'))){_0x11649f[_0x9b43('0x20')]=qs[_0x9b43('0x20')](_0x1f5132[_0x9b43('0x35')][_0x9b43('0x20')]);_0x11649f[_0x9b43('0x22')]=qs['offset'](_0x1f5132['query'][_0x9b43('0x22')]);}_0x11649f[_0x9b43('0x3b')]=qs[_0x9b43('0x3c')](_0x1f5132[_0x9b43('0x35')][_0x9b43('0x3c')]);_0x11649f[_0x9b43('0x3d')]=qs[_0x9b43('0x3e')](_[_0x9b43('0x3f')](_0x1f5132[_0x9b43('0x35')],_0x467738[_0x9b43('0x3e')]),_0x1a30d5);if(_0x1f5132[_0x9b43('0x35')][_0x9b43('0x40')]){_0x11649f[_0x9b43('0x3d')]=_['merge'](_0x11649f[_0x9b43('0x3d')],{'$or':_['map'](_0x1a30d5,function(_0x5d7da1){if(_0x5d7da1[_0x9b43('0x41')]!==_0x9b43('0x42')){var _0x803620={};_0x803620[_0x5d7da1[_0x9b43('0x2b')]]={'$like':'%'+_0x1f5132[_0x9b43('0x35')][_0x9b43('0x40')]+'%'};return _0x803620;}})});}_0x11649f=_[_0x9b43('0x43')]({},_0x11649f,_0x1f5132[_0x9b43('0x44')]);var _0xc96046={'where':_0x11649f[_0x9b43('0x3d')]};return db[_0x9b43('0x2f')][_0x9b43('0x21')](_0xc96046)[_0x9b43('0x27')](function(_0x57db8b){_0x5724b3['count']=_0x57db8b;if(_0x1f5132[_0x9b43('0x35')][_0x9b43('0x45')]){_0x11649f[_0x9b43('0x46')]=[{'all':!![]}];}return db[_0x9b43('0x2f')][_0x9b43('0x47')](_0x11649f);})[_0x9b43('0x27')](function(_0x8e9d9a){_0x5724b3['rows']=_0x8e9d9a;return _0x5724b3;})[_0x9b43('0x27')](respondWithFilteredResult(_0x1f7ea9,_0x11649f))['catch'](handleError(_0x1f7ea9,null));};exports['show']=function(_0x45e9dc,_0x57e66d){var _0x226998={'raw':!![],'where':{'id':_0x45e9dc[_0x9b43('0x48')]['id']}},_0x3945bc={};_0x3945bc['model']=_[_0x9b43('0x32')](db[_0x9b43('0x2f')][_0x9b43('0x49')]);_0x3945bc[_0x9b43('0x35')]=_[_0x9b43('0x32')](_0x45e9dc[_0x9b43('0x35')]);_0x3945bc[_0x9b43('0x3e')]=_[_0x9b43('0x33')](_0x3945bc[_0x9b43('0x34')],_0x3945bc[_0x9b43('0x35')]);_0x226998[_0x9b43('0x36')]=_['intersection'](_0x3945bc[_0x9b43('0x34')],qs[_0x9b43('0x37')](_0x45e9dc[_0x9b43('0x35')]['fields']));_0x226998[_0x9b43('0x36')]=_0x226998[_0x9b43('0x36')][_0x9b43('0x38')]?_0x226998['attributes']:_0x3945bc[_0x9b43('0x34')];if(_0x45e9dc[_0x9b43('0x35')][_0x9b43('0x45')]){_0x226998[_0x9b43('0x46')]=[{'all':!![]}];}_0x226998=_['merge']({},_0x226998,_0x45e9dc[_0x9b43('0x44')]);return db[_0x9b43('0x2f')]['find'](_0x226998)['then'](handleEntityNotFound(_0x57e66d,null))[_0x9b43('0x27')](respondWithResult(_0x57e66d,null))[_0x9b43('0x4a')](handleError(_0x57e66d,null));};exports[_0x9b43('0x4b')]=function(_0x24de06,_0x792a2d){return db['SmsTransferReport'][_0x9b43('0x4b')](_0x24de06[_0x9b43('0x4c')],{})[_0x9b43('0x27')](respondWithResult(_0x792a2d,0xc9))[_0x9b43('0x4a')](handleError(_0x792a2d,null));};exports[_0x9b43('0x25')]=function(_0x10922e,_0x5e2239){if(_0x10922e[_0x9b43('0x4c')]['id']){delete _0x10922e[_0x9b43('0x4c')]['id'];}return db[_0x9b43('0x2f')][_0x9b43('0x4d')]({'where':{'id':_0x10922e[_0x9b43('0x48')]['id']}})['then'](handleEntityNotFound(_0x5e2239,null))['then'](saveUpdates(_0x10922e[_0x9b43('0x4c')],null))[_0x9b43('0x27')](respondWithResult(_0x5e2239,null))[_0x9b43('0x4a')](handleError(_0x5e2239,null));};exports['destroy']=function(_0x5e4089,_0x599c02){return db[_0x9b43('0x2f')][_0x9b43('0x4d')]({'where':{'id':_0x5e4089[_0x9b43('0x48')]['id']}})[_0x9b43('0x27')](handleEntityNotFound(_0x599c02,null))[_0x9b43('0x27')](removeEntity(_0x599c02,null))['catch'](handleError(_0x599c02,null));};exports[_0x9b43('0x4e')]=function(_0x71b165,_0x581a4f){return db[_0x9b43('0x2f')][_0x9b43('0x4e')]()[_0x9b43('0x27')](respondWithResult(_0x581a4f,null))['catch'](handleError(_0x581a4f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index fb58f5c..f44b4a4 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 _0xb1be=['report_sms_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','SmsTransferReport'];(function(_0x2302a1,_0x4bc33d){var _0x413cae=function(_0x233632){while(--_0x233632){_0x2302a1['push'](_0x2302a1['shift']());}};_0x413cae(++_0x4bc33d);}(_0xb1be,0x1c9));var _0xeb1b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb1be[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xeb1b('0x0'));var util=require(_0xeb1b('0x1'));var logger=require(_0xeb1b('0x2'))('api');var moment=require(_0xeb1b('0x3'));var BPromise=require(_0xeb1b('0x4'));var rp=require(_0xeb1b('0x5'));var fs=require('fs');var path=require(_0xeb1b('0x6'));var rimraf=require(_0xeb1b('0x7'));var config=require(_0xeb1b('0x8'));var attributes=require(_0xeb1b('0x9'));module['exports']=function(_0x11be51,_0x5270c7){return _0x11be51['define'](_0xeb1b('0xa'),attributes,{'tableName':_0xeb1b('0xb'),'paranoid':![],'indexes':[{'name':_0xeb1b('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x14de=['rimraf','./smsTransferReport.attributes','exports','define','SmsTransferReport','uniqueid','../../config/logger','api','moment','request-promise','path'];(function(_0x1acc2d,_0x597696){var _0xabfa6d=function(_0x41e83c){while(--_0x41e83c){_0x1acc2d['push'](_0x1acc2d['shift']());}};_0xabfa6d(++_0x597696);}(_0x14de,0x1ea));var _0xe14d=function(_0x15797e,_0x2bb5f5){_0x15797e=_0x15797e-0x0;var _0x21da13=_0x14de[_0x15797e];return _0x21da13;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe14d('0x0'))(_0xe14d('0x1'));var moment=require(_0xe14d('0x2'));var BPromise=require('bluebird');var rp=require(_0xe14d('0x3'));var fs=require('fs');var path=require(_0xe14d('0x4'));var rimraf=require(_0xe14d('0x5'));var config=require('../../config/environment');var attributes=require(_0xe14d('0x6'));module[_0xe14d('0x7')]=function(_0x1e04de,_0x561c4a){return _0x1e04de[_0xe14d('0x8')](_0xe14d('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0xe14d('0xa'),'fields':[_0xe14d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 430603e..a4f1359 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 _0x4b19=['stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x134afd,_0x276b1a){var _0x5280ab=function(_0x38a079){while(--_0x38a079){_0x134afd['push'](_0x134afd['shift']());}};_0x5280ab(++_0x276b1a);}(_0x4b19,0x195));var _0x94b1=function(_0x770605,_0x55ef0a){_0x770605=_0x770605-0x0;var _0x52dd64=_0x4b19[_0x770605];return _0x52dd64;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var moment=require(_0x94b1('0x1'));var BPromise=require(_0x94b1('0x2'));var rs=require(_0x94b1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x94b1('0x4'))['db'];var utils=require(_0x94b1('0x5'));var logger=require(_0x94b1('0x6'))('rpc');var config=require(_0x94b1('0x7'));var jayson=require(_0x94b1('0x8'));var client=jayson['client'][_0x94b1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x110a52,_0x4ea1f9,_0x40c69c){return new BPromise(function(_0x201a02,_0xad0a85){return client['request'](_0x110a52,_0x40c69c)[_0x94b1('0xa')](function(_0x4f948b){logger['info'](_0x94b1('0xb'),_0x4ea1f9,_0x94b1('0xc'));logger[_0x94b1('0xd')](_0x94b1('0xe'),_0x4ea1f9,_0x94b1('0xc'),JSON[_0x94b1('0xf')](_0x4f948b));if(_0x4f948b['error']){if(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x11')]===0x1f4){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x4f948b['error']['message']);return _0xad0a85(_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x4ea1f9,_0x4f948b[_0x94b1('0x10')][_0x94b1('0x12')]);return _0x201a02(_0x4f948b['error'][_0x94b1('0x12')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x4ea1f9,_0x94b1('0xc'));_0x201a02(_0x4f948b[_0x94b1('0x13')][_0x94b1('0x12')]);}})[_0x94b1('0x14')](function(_0x494138){logger[_0x94b1('0x10')](_0x94b1('0xb'),_0x4ea1f9,_0x494138);_0xad0a85(_0x494138);});});} \ No newline at end of file +var _0xf13b=['../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb'];(function(_0x3e517b,_0x1d564b){var _0x27feff=function(_0x59d239){while(--_0x59d239){_0x3e517b['push'](_0x3e517b['shift']());}};_0x27feff(++_0x1d564b);}(_0xf13b,0x1f0));var _0xbf13=function(_0x304d73,_0x54b61f){_0x304d73=_0x304d73-0x0;var _0x1335a9=_0xf13b[_0x304d73];return _0x1335a9;};'use strict';var _=require(_0xbf13('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbf13('0x1'));var fs=require('fs');var Redis=require(_0xbf13('0x2'));var db=require(_0xbf13('0x3'))['db'];var utils=require(_0xbf13('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xbf13('0x5'));var jayson=require(_0xbf13('0x6'));var client=jayson['client'][_0xbf13('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2316ad,_0x4e5a2c,_0x462933){return new BPromise(function(_0x212fac,_0x56c981){return client[_0xbf13('0x8')](_0x2316ad,_0x462933)[_0xbf13('0x9')](function(_0x2ba55d){logger[_0xbf13('0xa')]('SmsTransferReport,\x20%s,\x20%s',_0x4e5a2c,_0xbf13('0xb'));logger['debug'](_0xbf13('0xc'),_0x4e5a2c,'request\x20sent',JSON[_0xbf13('0xd')](_0x2ba55d));if(_0x2ba55d[_0xbf13('0xe')]){if(_0x2ba55d['error'][_0xbf13('0xf')]===0x1f4){logger[_0xbf13('0xe')](_0xbf13('0x10'),_0x4e5a2c,_0x2ba55d[_0xbf13('0xe')]['message']);return _0x56c981(_0x2ba55d[_0xbf13('0xe')][_0xbf13('0x11')]);}logger[_0xbf13('0xe')](_0xbf13('0x10'),_0x4e5a2c,_0x2ba55d['error']['message']);return _0x212fac(_0x2ba55d['error'][_0xbf13('0x11')]);}else{logger[_0xbf13('0xa')](_0xbf13('0x10'),_0x4e5a2c,_0xbf13('0xb'));_0x212fac(_0x2ba55d[_0xbf13('0x12')][_0xbf13('0x11')]);}})[_0xbf13('0x13')](function(_0x268013){logger['error'](_0xbf13('0x10'),_0x4e5a2c,_0x268013);_0x56c981(_0x268013);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 97aacf5..1e6ba50 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 _0x82f5=['originalname','replace','format','basename','now','post','single','file','create','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','get','index','isAuthenticated','show','/:id/download','download','diskStorage','join','root','server/files/sounds/original/'];(function(_0x5d7b12,_0x35077c){var _0x208bc0=function(_0x35ca14){while(--_0x35ca14){_0x5d7b12['push'](_0x5d7b12['shift']());}};_0x208bc0(++_0x35077c);}(_0x82f5,0xe6));var _0x582f=function(_0x1f98b1,_0x3140fe){_0x1f98b1=_0x1f98b1-0x0;var _0x58f42b=_0x82f5[_0x1f98b1];return _0x58f42b;};'use strict';var multer=require(_0x582f('0x0'));var util=require(_0x582f('0x1'));var path=require('path');var timeout=require(_0x582f('0x2'));var express=require(_0x582f('0x3'));var router=express[_0x582f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x582f('0x5'));var config=require(_0x582f('0x6'));var controller=require(_0x582f('0x7'));router[_0x582f('0x8')]('/',auth['isAuthenticated'](),controller[_0x582f('0x9')]);router[_0x582f('0x8')]('/:id',auth[_0x582f('0xa')](),controller[_0x582f('0xb')]);router[_0x582f('0x8')](_0x582f('0xc'),auth[_0x582f('0xa')](),controller[_0x582f('0xd')]);var upload=multer({'storage':multer[_0x582f('0xe')]({'destination':function(_0x58e0a8,_0x1e7946,_0xfefcc7){_0xfefcc7(null,path[_0x582f('0xf')](config[_0x582f('0x10')],_0x582f('0x11')));},'filename':function(_0x443cf7,_0x6f3033,_0x46ae8c){_0x6f3033[_0x582f('0x12')]=_0x6f3033[_0x582f('0x12')][_0x582f('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x46ae8c(null,util[_0x582f('0x14')]('%s-%s%s',path[_0x582f('0x15')](_0x6f3033[_0x582f('0x12')],path['extname'](_0x6f3033[_0x582f('0x12')])),Date[_0x582f('0x16')](),path['extname'](_0x6f3033[_0x582f('0x12')])));}})});router[_0x582f('0x17')]('/',upload[_0x582f('0x18')](_0x582f('0x19')),controller[_0x582f('0x1a')]);router['put'](_0x582f('0x1b'),auth[_0x582f('0xa')](),controller[_0x582f('0x1c')]);router[_0x582f('0x1d')](_0x582f('0x1b'),auth[_0x582f('0xa')](),controller[_0x582f('0x1d')]);module[_0x582f('0x1e')]=router; \ No newline at end of file +var _0x24ed=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','/:id','show','get','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','basename','extname','now','single','file','put','update','delete','exports'];(function(_0x8a71b3,_0xa65f11){var _0x105384=function(_0xf5323d){while(--_0xf5323d){_0x8a71b3['push'](_0x8a71b3['shift']());}};_0x105384(++_0xa65f11);}(_0x24ed,0xf0));var _0xd24e=function(_0x48daab,_0x460ed0){_0x48daab=_0x48daab-0x0;var _0x1dda11=_0x24ed[_0x48daab];return _0x1dda11;};'use strict';var multer=require(_0xd24e('0x0'));var util=require(_0xd24e('0x1'));var path=require(_0xd24e('0x2'));var timeout=require('connect-timeout');var express=require(_0xd24e('0x3'));var router=express[_0xd24e('0x4')]();var fs_extra=require(_0xd24e('0x5'));var auth=require(_0xd24e('0x6'));var interaction=require(_0xd24e('0x7'));var config=require(_0xd24e('0x8'));var controller=require(_0xd24e('0x9'));router['get']('/',auth[_0xd24e('0xa')](),controller['index']);router['get'](_0xd24e('0xb'),auth['isAuthenticated'](),controller[_0xd24e('0xc')]);router[_0xd24e('0xd')](_0xd24e('0xe'),auth[_0xd24e('0xa')](),controller[_0xd24e('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x164f89,_0x2da065,_0x86a1e8){_0x86a1e8(null,path[_0xd24e('0x10')](config[_0xd24e('0x11')],_0xd24e('0x12')));},'filename':function(_0x49830b,_0x41d51f,_0x8899a9){_0x41d51f['originalname']=_0x41d51f[_0xd24e('0x13')][_0xd24e('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x8899a9(null,util['format']('%s-%s%s',path[_0xd24e('0x15')](_0x41d51f[_0xd24e('0x13')],path[_0xd24e('0x16')](_0x41d51f[_0xd24e('0x13')])),Date[_0xd24e('0x17')](),path['extname'](_0x41d51f[_0xd24e('0x13')])));}})});router['post']('/',upload[_0xd24e('0x18')](_0xd24e('0x19')),controller['create']);router[_0xd24e('0x1a')]('/:id',auth[_0xd24e('0xa')](),controller[_0xd24e('0x1b')]);router['delete'](_0xd24e('0xb'),auth[_0xd24e('0xa')](),controller[_0xd24e('0x1c')]);module[_0xd24e('0x1d')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index f952c57..c2a89fd 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 _0xe343=['sequelize','exports','STRING','FLOAT','BIGINT','INTEGER'];(function(_0x72de3,_0x2ed060){var _0x2a8e6c=function(_0x1b50b0){while(--_0x1b50b0){_0x72de3['push'](_0x72de3['shift']());}};_0x2a8e6c(++_0x2ed060);}(_0xe343,0x90));var _0x3e34=function(_0x368587,_0x1b6554){_0x368587=_0x368587-0x0;var _0x42d33c=_0xe343[_0x368587];return _0x42d33c;};'use strict';var Sequelize=require(_0x3e34('0x0'));module[_0x3e34('0x1')]={'name':{'type':Sequelize[_0x3e34('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x3e34('0x2')]},'display_name':{'type':Sequelize[_0x3e34('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x3e34('0x2')]},'original_format':{'type':Sequelize[_0x3e34('0x2')]},'original_duration':{'type':Sequelize[_0x3e34('0x3')]},'original_sampleCount':{'type':Sequelize[_0x3e34('0x4')]},'original_channelCount':{'type':Sequelize[_0x3e34('0x5')]},'original_bitRate':{'type':Sequelize[_0x3e34('0x4')]},'original_sampleRate':{'type':Sequelize[_0x3e34('0x5')]},'converted_format':{'type':Sequelize[_0x3e34('0x2')]},'converted_duration':{'type':Sequelize[_0x3e34('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x3e34('0x4')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3e34('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x3e34('0x5')]}}; \ No newline at end of file +var _0x617a=['BIGINT','INTEGER','FLOAT','sequelize','STRING','name'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x617a,0x129));var _0xa617=function(_0x173d97,_0x1028d6){_0x173d97=_0x173d97-0x0;var _0x2ebce0=_0x617a[_0x173d97];return _0x2ebce0;};'use strict';var Sequelize=require(_0xa617('0x0'));module['exports']={'name':{'type':Sequelize[_0xa617('0x1')],'unique':_0xa617('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xa617('0x1')]},'display_name':{'type':Sequelize[_0xa617('0x1')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0xa617('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xa617('0x3')]},'original_channelCount':{'type':Sequelize[_0xa617('0x4')]},'original_bitRate':{'type':Sequelize[_0xa617('0x3')]},'original_sampleRate':{'type':Sequelize[_0xa617('0x4')]},'converted_format':{'type':Sequelize[_0xa617('0x1')]},'converted_duration':{'type':Sequelize[_0xa617('0x5')]},'converted_sampleCount':{'type':Sequelize[_0xa617('0x3')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index faf7213..f945f77 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 _0x461f=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','params','keys','rawAttributes','options','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','Sequelize','ValidationError','root','%s.%s','catch','file','originalname','extname','substring','server/files/sounds/original','filename','basename','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','error','unlinkSync','src','original_duration','duration','original_sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','converted_duration','converted_sampleCount','sampleCount','converted_channelCount','converted_bitRate','sampleRate','create','role','userProfileId','UserProfileSection','start','body','delete','original_format','format','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../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','Content-Range','reject','then','destroy','get','Sounds','end','name','send','index','map','Sound','type','key','model','query'];(function(_0x30bd4d,_0x50eb60){var _0x306915=function(_0x5ae782){while(--_0x5ae782){_0x30bd4d['push'](_0x30bd4d['shift']());}};_0x306915(++_0x50eb60);}(_0x461f,0x1bc));var _0xf461=function(_0x43f136,_0x365817){_0x43f136=_0x43f136-0x0;var _0x531928=_0x461f[_0x43f136];return _0x531928;};'use strict';var emlformat=require(_0xf461('0x0'));var rimraf=require(_0xf461('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf461('0x2'));var rp=require(_0xf461('0x3'));var moment=require(_0xf461('0x4'));var BPromise=require(_0xf461('0x5'));var Mustache=require(_0xf461('0x6'));var util=require(_0xf461('0x7'));var path=require(_0xf461('0x8'));var sox=require(_0xf461('0x9'));var csv=require('to-csv');var ejs=require(_0xf461('0xa'));var fs=require('fs');var fs_extra=require(_0xf461('0xb'));var _=require(_0xf461('0xc'));var squel=require(_0xf461('0xd'));var crypto=require('crypto');var jsforce=require(_0xf461('0xe'));var deskjs=require(_0xf461('0xf'));var toCsv=require(_0xf461('0x10'));var querystring=require(_0xf461('0x11'));var Papa=require(_0xf461('0x12'));var Redis=require('ioredis');var authService=require(_0xf461('0x13'));var qs=require(_0xf461('0x14'));var as=require(_0xf461('0x15'));var hardwareService=require(_0xf461('0x16'));var logger=require('../../config/logger')(_0xf461('0x17'));var utils=require(_0xf461('0x18'));var config=require(_0xf461('0x19'));var licenseUtil=require(_0xf461('0x1a'));var db=require(_0xf461('0x1b'))['db'];function respondWithStatusCode(_0x3142e1,_0x23f80e){_0x23f80e=_0x23f80e||0xcc;return function(_0xca6f59){if(_0xca6f59){return _0x3142e1[_0xf461('0x1c')](_0x23f80e);}return _0x3142e1[_0xf461('0x1d')](_0x23f80e)['end']();};}function respondWithResult(_0x5a26ca,_0x4d7593){_0x4d7593=_0x4d7593||0xc8;return function(_0x132b45){if(_0x132b45){return _0x5a26ca[_0xf461('0x1d')](_0x4d7593)[_0xf461('0x1e')](_0x132b45);}};}function respondWithFilteredResult(_0x56915d,_0x4fed46){return function(_0x5d4ba2){if(_0x5d4ba2){var _0x1c72c3=typeof _0x4fed46[_0xf461('0x1f')]===_0xf461('0x20')&&typeof _0x4fed46[_0xf461('0x21')]===_0xf461('0x20');var _0x5da11f=_0x5d4ba2[_0xf461('0x22')];var _0x3455c0=_0x1c72c3?0x0:_0x4fed46[_0xf461('0x1f')];var _0x58254c=_0x1c72c3?_0x5d4ba2[_0xf461('0x22')]:_0x4fed46[_0xf461('0x1f')]+_0x4fed46[_0xf461('0x21')];var _0x19f4ac;if(_0x58254c>=_0x5da11f){_0x58254c=_0x5da11f;_0x19f4ac=0xc8;}else{_0x19f4ac=0xce;}_0x56915d[_0xf461('0x1d')](_0x19f4ac);return _0x56915d[_0xf461('0x23')](_0xf461('0x24'),_0x3455c0+'-'+_0x58254c+'/'+_0x5da11f)['json'](_0x5d4ba2);}return null;};}function patchUpdates(_0x224546){return function(_0xd33409){try{jsonpatch['apply'](_0xd33409,_0x224546,!![]);}catch(_0x2941be){return BPromise[_0xf461('0x25')](_0x2941be);}return _0xd33409['save']();};}function saveUpdates(_0x539483,_0x3675a7){return function(_0x3d13eb){if(_0x3d13eb){return _0x3d13eb['update'](_0x539483)[_0xf461('0x26')](function(_0x3daca9){return _0x3daca9;});}return null;};}function removeEntity(_0x5d4e60,_0x5c143f){return function(_0x1d8ff9){if(_0x1d8ff9){return _0x1d8ff9[_0xf461('0x27')]()[_0xf461('0x26')](function(){var _0xab3032=_0x1d8ff9[_0xf461('0x28')]({'plain':!![]});var _0xfc3270=_0xf461('0x29');return db['UserProfileResource'][_0xf461('0x27')]({'where':{'type':_0xfc3270,'resourceId':_0xab3032['id']}})[_0xf461('0x26')](function(){return _0x1d8ff9;});})[_0xf461('0x26')](function(){_0x5d4e60[_0xf461('0x1d')](0xcc)[_0xf461('0x2a')]();});}};}function handleEntityNotFound(_0x14e24c,_0x4cc72d){return function(_0x5f542a){if(!_0x5f542a){_0x14e24c[_0xf461('0x1c')](0x194);}return _0x5f542a;};}function handleError(_0x3dd4f2,_0x5b86e1){_0x5b86e1=_0x5b86e1||0x1f4;return function(_0x5b1ccd){logger['error'](_0x5b1ccd['stack']);if(_0x5b1ccd['name']){delete _0x5b1ccd[_0xf461('0x2b')];}_0x3dd4f2[_0xf461('0x1d')](_0x5b86e1)[_0xf461('0x2c')](_0x5b1ccd);};}exports[_0xf461('0x2d')]=function(_0x509a44,_0x1cbd2c){var _0xed277e={},_0x18e41d={},_0x3ba876={'count':0x0,'rows':[]};var _0x260eb2=_[_0xf461('0x2e')](db[_0xf461('0x2f')]['rawAttributes'],function(_0x5d5ac3){return{'name':_0x5d5ac3['fieldName'],'type':_0x5d5ac3[_0xf461('0x30')][_0xf461('0x31')]};});_0x18e41d[_0xf461('0x32')]=_[_0xf461('0x2e')](_0x260eb2,_0xf461('0x2b'));_0x18e41d[_0xf461('0x33')]=_['keys'](_0x509a44[_0xf461('0x33')]);_0x18e41d[_0xf461('0x34')]=_[_0xf461('0x35')](_0x18e41d['model'],_0x18e41d[_0xf461('0x33')]);_0xed277e[_0xf461('0x36')]=_[_0xf461('0x35')](_0x18e41d[_0xf461('0x32')],qs['fields'](_0x509a44['query'][_0xf461('0x37')]));_0xed277e[_0xf461('0x36')]=_0xed277e[_0xf461('0x36')][_0xf461('0x38')]?_0xed277e[_0xf461('0x36')]:_0x18e41d[_0xf461('0x32')];if(!_0x509a44[_0xf461('0x33')][_0xf461('0x39')](_0xf461('0x3a'))){_0xed277e[_0xf461('0x21')]=qs['limit'](_0x509a44[_0xf461('0x33')]['limit']);_0xed277e['offset']=qs[_0xf461('0x1f')](_0x509a44['query'][_0xf461('0x1f')]);}_0xed277e[_0xf461('0x3b')]=qs[_0xf461('0x3c')](_0x509a44[_0xf461('0x33')][_0xf461('0x3c')]);_0xed277e[_0xf461('0x3d')]=qs['filters'](_[_0xf461('0x3e')](_0x509a44[_0xf461('0x33')],_0x18e41d['filters']),_0x260eb2);if(_0x509a44[_0xf461('0x33')][_0xf461('0x3f')]){_0xed277e[_0xf461('0x3d')]=_[_0xf461('0x40')](_0xed277e[_0xf461('0x3d')],{'$or':_['map'](_0x260eb2,function(_0x322ce1){if(_0x322ce1[_0xf461('0x30')]!=='VIRTUAL'){var _0x4ba712={};_0x4ba712[_0x322ce1[_0xf461('0x2b')]]={'$like':'%'+_0x509a44[_0xf461('0x33')][_0xf461('0x3f')]+'%'};return _0x4ba712;}})});}_0xed277e=_[_0xf461('0x40')]({},_0xed277e,_0x509a44['options']);var _0x20b278={'where':_0xed277e[_0xf461('0x3d')]};return db[_0xf461('0x2f')][_0xf461('0x22')](_0x20b278)['then'](function(_0x4f6b24){_0x3ba876['count']=_0x4f6b24;if(_0x509a44['query'][_0xf461('0x41')]){_0xed277e[_0xf461('0x42')]=[{'all':!![]}];}return db['Sound'][_0xf461('0x43')](_0xed277e);})[_0xf461('0x26')](function(_0x44a0d3){_0x3ba876[_0xf461('0x44')]=_0x44a0d3;return _0x3ba876;})['then'](respondWithFilteredResult(_0x1cbd2c,_0xed277e))['catch'](handleError(_0x1cbd2c,null));};exports['show']=function(_0x1dd2ff,_0x4ff7c2){var _0x212d3f={'raw':!![],'where':{'id':_0x1dd2ff[_0xf461('0x45')]['id']}},_0x1a49d4={};_0x1a49d4[_0xf461('0x32')]=_[_0xf461('0x46')](db[_0xf461('0x2f')][_0xf461('0x47')]);_0x1a49d4[_0xf461('0x33')]=_[_0xf461('0x46')](_0x1dd2ff[_0xf461('0x33')]);_0x1a49d4['filters']=_[_0xf461('0x35')](_0x1a49d4['model'],_0x1a49d4[_0xf461('0x33')]);_0x212d3f[_0xf461('0x36')]=_[_0xf461('0x35')](_0x1a49d4[_0xf461('0x32')],qs[_0xf461('0x37')](_0x1dd2ff[_0xf461('0x33')][_0xf461('0x37')]));_0x212d3f[_0xf461('0x36')]=_0x212d3f[_0xf461('0x36')][_0xf461('0x38')]?_0x212d3f['attributes']:_0x1a49d4[_0xf461('0x32')];if(_0x1dd2ff[_0xf461('0x33')][_0xf461('0x41')]){_0x212d3f[_0xf461('0x42')]=[{'all':!![]}];}_0x212d3f=_[_0xf461('0x40')]({},_0x212d3f,_0x1dd2ff[_0xf461('0x48')]);return db[_0xf461('0x2f')][_0xf461('0x49')](_0x212d3f)[_0xf461('0x26')](handleEntityNotFound(_0x4ff7c2,null))[_0xf461('0x26')](respondWithResult(_0x4ff7c2,null))['catch'](handleError(_0x4ff7c2,null));};exports[_0xf461('0x4a')]=function(_0x3dcd36,_0x2b3762,_0x45880e){return db[_0xf461('0x2f')][_0xf461('0x49')]({'where':{'id':_0x3dcd36[_0xf461('0x45')]['id']},'attributes':[_0xf461('0x2b'),_0xf461('0x4b'),_0xf461('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x2b3762,null))[_0xf461('0x26')](function(_0x195fe4){if(_0x195fe4){if(!fs[_0xf461('0x4d')](path[_0xf461('0x4e')](config['root'],_0xf461('0x4f'),_0x195fe4[_0xf461('0x4b')]+'.'+_0x195fe4[_0xf461('0x4c')]))){throw new db[(_0xf461('0x50'))][(_0xf461('0x51'))]('Sound\x20not\x20found');}return _0x2b3762['download'](path[_0xf461('0x4e')](config[_0xf461('0x52')],_0xf461('0x4f'),util['format'](_0xf461('0x53'),_0x195fe4['save_name'],_0x195fe4['converted_format'])),util['format'](_0xf461('0x53'),_0x195fe4[_0xf461('0x2b')],_0x195fe4['converted_format']));}return null;})[_0xf461('0x54')](handleError(_0x2b3762,null));};exports['create']=function(_0x2d5b1e,_0x2380ee,_0x4364c6){var _0x2debd1={'name':path['basename'](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x56')],path[_0xf461('0x57')](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x56')])),'save_name':path['basename'](_0x2d5b1e['file']['filename'],path[_0xf461('0x57')](_0x2d5b1e[_0xf461('0x55')]['filename'])),'original_format':path['extname'](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x56')])[_0xf461('0x58')](0x1),'converted_format':'wav'};var _0x3c50cb=path['join'](config[_0xf461('0x52')],_0xf461('0x59'),_0x2d5b1e['file'][_0xf461('0x5a')]);var _0x1e0df7=path[_0xf461('0x4e')](config[_0xf461('0x52')],_0xf461('0x4f'),util['format']('%s.%s',path[_0xf461('0x5b')](_0x2d5b1e[_0xf461('0x55')][_0xf461('0x5a')],path[_0xf461('0x57')](_0x2d5b1e['file'][_0xf461('0x5a')])),_0x2debd1[_0xf461('0x4c')]));logger[_0xf461('0x5c')](_0xf461('0x5d'),_0x3c50cb);logger[_0xf461('0x5c')](_0xf461('0x5e'),_0x1e0df7);try{fs[_0xf461('0x5f')](_0x3c50cb,parseInt(_0xf461('0x60'),0x8));var _0x408476=sox[_0xf461('0x61')](_0x3c50cb,_0x1e0df7,{'sampleRate':0x1f40,'format':_0xf461('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x408476['on'](_0xf461('0x63'),function(_0x14fb22){fs[_0xf461('0x64')](_0x3c50cb);_0x2380ee[_0xf461('0x1d')](0x1f4)['send'](_0x14fb22);});_0x408476['on'](_0xf461('0x65'),function(_0x280e4e){_0x2debd1[_0xf461('0x66')]=isNaN(_0x280e4e['duration'])?null:_0x280e4e[_0xf461('0x67')]*0x3e8;_0x2debd1[_0xf461('0x68')]=isNaN(_0x280e4e['sampleCount'])?null:_0x280e4e['sampleCount'];_0x2debd1['original_channelCount']=isNaN(_0x280e4e['channelCount'])?null:_0x280e4e[_0xf461('0x69')];_0x2debd1[_0xf461('0x6a')]=isNaN(_0x280e4e[_0xf461('0x6b')])?null:_0x280e4e[_0xf461('0x6b')];_0x2debd1[_0xf461('0x6c')]=isNaN(_0x280e4e['sampleRate'])?null:_0x280e4e['sampleRate'];});_0x408476['on']('dest',function(_0x2d8ad8){_0x2debd1[_0xf461('0x6d')]=isNaN(_0x2d8ad8[_0xf461('0x67')])?null:_0x2d8ad8[_0xf461('0x67')]*0x3e8;_0x2debd1[_0xf461('0x6e')]=isNaN(_0x2d8ad8[_0xf461('0x6f')])?null:_0x2d8ad8['sampleCount'];_0x2debd1[_0xf461('0x70')]=isNaN(_0x2d8ad8['channelCount'])?null:_0x2d8ad8[_0xf461('0x69')];_0x2debd1[_0xf461('0x71')]=isNaN(_0x2d8ad8[_0xf461('0x6b')])?null:_0x2d8ad8[_0xf461('0x6b')];_0x2debd1['converted_sampleRate']=isNaN(_0x2d8ad8[_0xf461('0x72')])?null:_0x2d8ad8[_0xf461('0x72')];});_0x408476['on'](_0xf461('0x2a'),function(){fs[_0xf461('0x5f')](_0x1e0df7,parseInt(_0xf461('0x60'),0x8));return db[_0xf461('0x2f')][_0xf461('0x73')](_0x2debd1)[_0xf461('0x26')](function(_0x1b66a5){var _0x57c9d8={'role':_0x2d5b1e['body'][_0xf461('0x74')],'userProfileId':_0x2d5b1e['body'][_0xf461('0x75')]};if(!_0x57c9d8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c9d8[_0xf461('0x74')]==='user'){var _0x237c32=_0x1b66a5[_0xf461('0x28')]({'plain':!![]});return db[_0xf461('0x76')][_0xf461('0x49')]({'where':{'name':_0xf461('0x29'),'userProfileId':_0x57c9d8['userProfileId']},'raw':!![]})[_0xf461('0x26')](function(_0x22c80c){if(_0x22c80c&&_0x22c80c['autoAssociation']===0x0){return db['UserProfileResource'][_0xf461('0x73')]({'name':_0x237c32[_0xf461('0x2b')],'resourceId':_0x237c32['id'],'type':_0x22c80c['name'],'sectionId':_0x22c80c['id']},{})[_0xf461('0x26')](function(){return _0x1b66a5;});}else{return _0x1b66a5;}})[_0xf461('0x54')](function(_0x2ecd8f){logger[_0xf461('0x63')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ecd8f);throw _0x2ecd8f;});}return _0x1b66a5;})[_0xf461('0x26')](respondWithResult(_0x2380ee,null))[_0xf461('0x54')](handleError(_0x2380ee,null));});_0x408476[_0xf461('0x77')]();}catch(_0xab479f){_0x2380ee[_0xf461('0x1d')](0x1f4)[_0xf461('0x2c')](_0xab479f);}};exports['update']=function(_0x4eea77,_0x889d6f,_0x10d900){return db[_0xf461('0x2f')][_0xf461('0x49')]({'where':{'id':_0x4eea77[_0xf461('0x45')]['id']}})[_0xf461('0x26')](handleEntityNotFound(_0x889d6f,null))[_0xf461('0x26')](saveUpdates(_['pick'](_0x4eea77[_0xf461('0x78')],[_0xf461('0x2b'),'description']),null))[_0xf461('0x26')](respondWithResult(_0x889d6f,null))[_0xf461('0x54')](handleError(_0x889d6f,null));};exports[_0xf461('0x79')]=function(_0x1cee72,_0x467b08,_0x5ff02a){return db[_0xf461('0x2f')]['find']({'where':{'id':_0x1cee72[_0xf461('0x45')]['id']}})[_0xf461('0x26')](function(_0x12ac3a){if(_0x12ac3a){return _0x12ac3a[_0xf461('0x27')]();}})['then'](function(_0x1a64c5){var _0x8065ce=path[_0xf461('0x4e')](config[_0xf461('0x52')],'server/files/sounds/original',util['format'](_0xf461('0x53'),_0x1a64c5[_0xf461('0x4b')],_0x1a64c5[_0xf461('0x7a')]));var _0x4d421d=path['join'](config[_0xf461('0x52')],_0xf461('0x4f'),util[_0xf461('0x7b')](_0xf461('0x53'),_0x1a64c5[_0xf461('0x4b')],_0x1a64c5[_0xf461('0x4c')]));fs['unlinkSync'](_0x8065ce);fs[_0xf461('0x64')](_0x4d421d);return _0x1a64c5;})[_0xf461('0x26')](function(_0xf04da2){if(_0xf04da2){return _0x467b08[_0xf461('0x1d')](0xcc)[_0xf461('0x2a')]();}})[_0xf461('0x26')](handleEntityNotFound(_0x467b08,null))[_0xf461('0x54')](handleError(_0x467b08,null));}; \ No newline at end of file +var _0xe4cd=['find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','body','delete','rimraf','fast-json-patch','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','Content-Range','json','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','name','send','index','map','Sound','type','key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','download','converted_format','existsSync','join','save_name','Sequelize','ValidationError','root','server/files/sounds/converted','format','create','basename','file','originalname','extname','filename','wav','server/files/sounds/original','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','sampleRate','converted_duration','converted_bitRate','converted_sampleRate','chmodSync','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection'];(function(_0x5e2751,_0x518a55){var _0x139a39=function(_0x4802db){while(--_0x4802db){_0x5e2751['push'](_0x5e2751['shift']());}};_0x139a39(++_0x518a55);}(_0xe4cd,0x80));var _0xde4c=function(_0x3ba628,_0x25e134){_0x3ba628=_0x3ba628-0x0;var _0xeba66b=_0xe4cd[_0x3ba628];return _0xeba66b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde4c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xde4c('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xde4c('0x2'));var util=require('util');var path=require(_0xde4c('0x3'));var sox=require(_0xde4c('0x4'));var csv=require(_0xde4c('0x5'));var ejs=require(_0xde4c('0x6'));var fs=require('fs');var fs_extra=require(_0xde4c('0x7'));var _=require('lodash');var squel=require(_0xde4c('0x8'));var crypto=require(_0xde4c('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xde4c('0xa'));var toCsv=require('to-csv');var querystring=require(_0xde4c('0xb'));var Papa=require(_0xde4c('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xde4c('0xd'));var as=require(_0xde4c('0xe'));var hardwareService=require(_0xde4c('0xf'));var logger=require(_0xde4c('0x10'))(_0xde4c('0x11'));var utils=require('../../config/utils');var config=require(_0xde4c('0x12'));var licenseUtil=require(_0xde4c('0x13'));var db=require(_0xde4c('0x14'))['db'];function respondWithStatusCode(_0x282016,_0x5cf8d1){_0x5cf8d1=_0x5cf8d1||0xcc;return function(_0x87f640){if(_0x87f640){return _0x282016[_0xde4c('0x15')](_0x5cf8d1);}return _0x282016[_0xde4c('0x16')](_0x5cf8d1)[_0xde4c('0x17')]();};}function respondWithResult(_0x1699d7,_0x37823d){_0x37823d=_0x37823d||0xc8;return function(_0x4d3061){if(_0x4d3061){return _0x1699d7['status'](_0x37823d)['json'](_0x4d3061);}};}function respondWithFilteredResult(_0x18b121,_0x391fb2){return function(_0x267455){if(_0x267455){var _0x3e8607=typeof _0x391fb2['offset']===_0xde4c('0x18')&&typeof _0x391fb2['limit']==='undefined';var _0x38b31e=_0x267455['count'];var _0x5cb620=_0x3e8607?0x0:_0x391fb2[_0xde4c('0x19')];var _0x5e3407=_0x3e8607?_0x267455[_0xde4c('0x1a')]:_0x391fb2[_0xde4c('0x19')]+_0x391fb2[_0xde4c('0x1b')];var _0x1e3cf3;if(_0x5e3407>=_0x38b31e){_0x5e3407=_0x38b31e;_0x1e3cf3=0xc8;}else{_0x1e3cf3=0xce;}_0x18b121[_0xde4c('0x16')](_0x1e3cf3);return _0x18b121['set'](_0xde4c('0x1c'),_0x5cb620+'-'+_0x5e3407+'/'+_0x38b31e)[_0xde4c('0x1d')](_0x267455);}return null;};}function patchUpdates(_0x5d317c){return function(_0x4f73ed){try{jsonpatch[_0xde4c('0x1e')](_0x4f73ed,_0x5d317c,!![]);}catch(_0x5df34c){return BPromise[_0xde4c('0x1f')](_0x5df34c);}return _0x4f73ed[_0xde4c('0x20')]();};}function saveUpdates(_0x40e0d1,_0x532bd9){return function(_0x7177b1){if(_0x7177b1){return _0x7177b1[_0xde4c('0x21')](_0x40e0d1)[_0xde4c('0x22')](function(_0x2b66fa){return _0x2b66fa;});}return null;};}function removeEntity(_0x4b2f66,_0x394401){return function(_0x3ff9f2){if(_0x3ff9f2){return _0x3ff9f2['destroy']()[_0xde4c('0x22')](function(){var _0x58cefe=_0x3ff9f2[_0xde4c('0x23')]({'plain':!![]});var _0x3acca8=_0xde4c('0x24');return db[_0xde4c('0x25')][_0xde4c('0x26')]({'where':{'type':_0x3acca8,'resourceId':_0x58cefe['id']}})[_0xde4c('0x22')](function(){return _0x3ff9f2;});})[_0xde4c('0x22')](function(){_0x4b2f66[_0xde4c('0x16')](0xcc)[_0xde4c('0x17')]();});}};}function handleEntityNotFound(_0x2038d0,_0xfa8a71){return function(_0x22c301){if(!_0x22c301){_0x2038d0[_0xde4c('0x15')](0x194);}return _0x22c301;};}function handleError(_0x2445c8,_0x1dd7fb){_0x1dd7fb=_0x1dd7fb||0x1f4;return function(_0x488ff9){logger['error'](_0x488ff9['stack']);if(_0x488ff9['name']){delete _0x488ff9[_0xde4c('0x27')];}_0x2445c8['status'](_0x1dd7fb)[_0xde4c('0x28')](_0x488ff9);};}exports[_0xde4c('0x29')]=function(_0x2e7da7,_0x3a9011){var _0x367c0f={},_0x418de9={},_0x5c6ef9={'count':0x0,'rows':[]};var _0x3987c1=_[_0xde4c('0x2a')](db[_0xde4c('0x2b')]['rawAttributes'],function(_0x342956){return{'name':_0x342956['fieldName'],'type':_0x342956[_0xde4c('0x2c')][_0xde4c('0x2d')]};});_0x418de9['model']=_[_0xde4c('0x2a')](_0x3987c1,_0xde4c('0x27'));_0x418de9[_0xde4c('0x2e')]=_['keys'](_0x2e7da7['query']);_0x418de9['filters']=_[_0xde4c('0x2f')](_0x418de9[_0xde4c('0x30')],_0x418de9[_0xde4c('0x2e')]);_0x367c0f[_0xde4c('0x31')]=_[_0xde4c('0x2f')](_0x418de9[_0xde4c('0x30')],qs[_0xde4c('0x32')](_0x2e7da7[_0xde4c('0x2e')][_0xde4c('0x32')]));_0x367c0f[_0xde4c('0x31')]=_0x367c0f[_0xde4c('0x31')][_0xde4c('0x33')]?_0x367c0f[_0xde4c('0x31')]:_0x418de9[_0xde4c('0x30')];if(!_0x2e7da7[_0xde4c('0x2e')][_0xde4c('0x34')](_0xde4c('0x35'))){_0x367c0f['limit']=qs[_0xde4c('0x1b')](_0x2e7da7[_0xde4c('0x2e')][_0xde4c('0x1b')]);_0x367c0f[_0xde4c('0x19')]=qs['offset'](_0x2e7da7[_0xde4c('0x2e')][_0xde4c('0x19')]);}_0x367c0f[_0xde4c('0x36')]=qs[_0xde4c('0x37')](_0x2e7da7['query'][_0xde4c('0x37')]);_0x367c0f[_0xde4c('0x38')]=qs['filters'](_[_0xde4c('0x39')](_0x2e7da7['query'],_0x418de9[_0xde4c('0x3a')]),_0x3987c1);if(_0x2e7da7['query'][_0xde4c('0x3b')]){_0x367c0f['where']=_[_0xde4c('0x3c')](_0x367c0f[_0xde4c('0x38')],{'$or':_[_0xde4c('0x2a')](_0x3987c1,function(_0x4776a0){if(_0x4776a0[_0xde4c('0x2c')]!==_0xde4c('0x3d')){var _0x2f28a9={};_0x2f28a9[_0x4776a0[_0xde4c('0x27')]]={'$like':'%'+_0x2e7da7[_0xde4c('0x2e')][_0xde4c('0x3b')]+'%'};return _0x2f28a9;}})});}_0x367c0f=_[_0xde4c('0x3c')]({},_0x367c0f,_0x2e7da7['options']);var _0x452d43={'where':_0x367c0f[_0xde4c('0x38')]};return db[_0xde4c('0x2b')][_0xde4c('0x1a')](_0x452d43)['then'](function(_0x359533){_0x5c6ef9['count']=_0x359533;if(_0x2e7da7[_0xde4c('0x2e')][_0xde4c('0x3e')]){_0x367c0f[_0xde4c('0x3f')]=[{'all':!![]}];}return db[_0xde4c('0x2b')][_0xde4c('0x40')](_0x367c0f);})[_0xde4c('0x22')](function(_0x3e5df9){_0x5c6ef9[_0xde4c('0x41')]=_0x3e5df9;return _0x5c6ef9;})['then'](respondWithFilteredResult(_0x3a9011,_0x367c0f))[_0xde4c('0x42')](handleError(_0x3a9011,null));};exports[_0xde4c('0x43')]=function(_0x414a0c,_0x3ba28b){var _0x508288={'raw':!![],'where':{'id':_0x414a0c[_0xde4c('0x44')]['id']}},_0x50670f={};_0x50670f[_0xde4c('0x30')]=_[_0xde4c('0x45')](db[_0xde4c('0x2b')][_0xde4c('0x46')]);_0x50670f['query']=_[_0xde4c('0x45')](_0x414a0c[_0xde4c('0x2e')]);_0x50670f[_0xde4c('0x3a')]=_[_0xde4c('0x2f')](_0x50670f[_0xde4c('0x30')],_0x50670f['query']);_0x508288[_0xde4c('0x31')]=_[_0xde4c('0x2f')](_0x50670f[_0xde4c('0x30')],qs['fields'](_0x414a0c['query']['fields']));_0x508288['attributes']=_0x508288[_0xde4c('0x31')][_0xde4c('0x33')]?_0x508288[_0xde4c('0x31')]:_0x50670f[_0xde4c('0x30')];if(_0x414a0c['query']['includeAll']){_0x508288[_0xde4c('0x3f')]=[{'all':!![]}];}_0x508288=_[_0xde4c('0x3c')]({},_0x508288,_0x414a0c['options']);return db[_0xde4c('0x2b')]['find'](_0x508288)[_0xde4c('0x22')](handleEntityNotFound(_0x3ba28b,null))['then'](respondWithResult(_0x3ba28b,null))[_0xde4c('0x42')](handleError(_0x3ba28b,null));};exports[_0xde4c('0x47')]=function(_0x428b83,_0x132548,_0x3b47e4){return db[_0xde4c('0x2b')]['find']({'where':{'id':_0x428b83[_0xde4c('0x44')]['id']},'attributes':[_0xde4c('0x27'),'save_name',_0xde4c('0x48')],'raw':!![]})['then'](handleEntityNotFound(_0x132548,null))[_0xde4c('0x22')](function(_0x49ad2a){if(_0x49ad2a){if(!fs[_0xde4c('0x49')](path[_0xde4c('0x4a')](config['root'],'server/files/sounds/converted',_0x49ad2a[_0xde4c('0x4b')]+'.'+_0x49ad2a[_0xde4c('0x48')]))){throw new db[(_0xde4c('0x4c'))][(_0xde4c('0x4d'))]('Sound\x20not\x20found');}return _0x132548['download'](path[_0xde4c('0x4a')](config[_0xde4c('0x4e')],_0xde4c('0x4f'),util[_0xde4c('0x50')]('%s.%s',_0x49ad2a[_0xde4c('0x4b')],_0x49ad2a['converted_format'])),util[_0xde4c('0x50')]('%s.%s',_0x49ad2a['name'],_0x49ad2a['converted_format']));}return null;})[_0xde4c('0x42')](handleError(_0x132548,null));};exports[_0xde4c('0x51')]=function(_0x7f3691,_0x39f2f,_0x53fd79){var _0x2ad518={'name':path[_0xde4c('0x52')](_0x7f3691[_0xde4c('0x53')][_0xde4c('0x54')],path[_0xde4c('0x55')](_0x7f3691['file']['originalname'])),'save_name':path[_0xde4c('0x52')](_0x7f3691[_0xde4c('0x53')][_0xde4c('0x56')],path[_0xde4c('0x55')](_0x7f3691[_0xde4c('0x53')][_0xde4c('0x56')])),'original_format':path[_0xde4c('0x55')](_0x7f3691[_0xde4c('0x53')][_0xde4c('0x54')])['substring'](0x1),'converted_format':_0xde4c('0x57')};var _0x23d0ab=path[_0xde4c('0x4a')](config[_0xde4c('0x4e')],_0xde4c('0x58'),_0x7f3691['file'][_0xde4c('0x56')]);var _0x18e11c=path[_0xde4c('0x4a')](config[_0xde4c('0x4e')],_0xde4c('0x4f'),util['format'](_0xde4c('0x59'),path['basename'](_0x7f3691['file']['filename'],path[_0xde4c('0x55')](_0x7f3691[_0xde4c('0x53')][_0xde4c('0x56')])),_0x2ad518['converted_format']));logger[_0xde4c('0x5a')](_0xde4c('0x5b'),_0x23d0ab);logger[_0xde4c('0x5a')](_0xde4c('0x5c'),_0x18e11c);try{fs['chmodSync'](_0x23d0ab,parseInt(_0xde4c('0x5d'),0x8));var _0x413c6d=sox[_0xde4c('0x5e')](_0x23d0ab,_0x18e11c,{'sampleRate':0x1f40,'format':_0xde4c('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x413c6d['on']('error',function(_0x35673f){fs[_0xde4c('0x5f')](_0x23d0ab);_0x39f2f[_0xde4c('0x16')](0x1f4)[_0xde4c('0x28')](_0x35673f);});_0x413c6d['on'](_0xde4c('0x60'),function(_0x565f01){_0x2ad518[_0xde4c('0x61')]=isNaN(_0x565f01[_0xde4c('0x62')])?null:_0x565f01[_0xde4c('0x62')]*0x3e8;_0x2ad518[_0xde4c('0x63')]=isNaN(_0x565f01[_0xde4c('0x64')])?null:_0x565f01[_0xde4c('0x64')];_0x2ad518['original_channelCount']=isNaN(_0x565f01['channelCount'])?null:_0x565f01[_0xde4c('0x65')];_0x2ad518[_0xde4c('0x66')]=isNaN(_0x565f01[_0xde4c('0x67')])?null:_0x565f01[_0xde4c('0x67')];_0x2ad518['original_sampleRate']=isNaN(_0x565f01[_0xde4c('0x68')])?null:_0x565f01[_0xde4c('0x68')];});_0x413c6d['on']('dest',function(_0x494a2a){_0x2ad518[_0xde4c('0x69')]=isNaN(_0x494a2a['duration'])?null:_0x494a2a[_0xde4c('0x62')]*0x3e8;_0x2ad518['converted_sampleCount']=isNaN(_0x494a2a['sampleCount'])?null:_0x494a2a['sampleCount'];_0x2ad518['converted_channelCount']=isNaN(_0x494a2a['channelCount'])?null:_0x494a2a[_0xde4c('0x65')];_0x2ad518[_0xde4c('0x6a')]=isNaN(_0x494a2a[_0xde4c('0x67')])?null:_0x494a2a[_0xde4c('0x67')];_0x2ad518[_0xde4c('0x6b')]=isNaN(_0x494a2a['sampleRate'])?null:_0x494a2a[_0xde4c('0x68')];});_0x413c6d['on'](_0xde4c('0x17'),function(){fs[_0xde4c('0x6c')](_0x18e11c,parseInt(_0xde4c('0x5d'),0x8));return db[_0xde4c('0x2b')][_0xde4c('0x51')](_0x2ad518)['then'](function(_0xc26562){var _0x3e1629={'role':_0x7f3691['body'][_0xde4c('0x6d')],'userProfileId':_0x7f3691['body'][_0xde4c('0x6e')]};if(!_0x3e1629)throw new Error(_0xde4c('0x6f'));if(_0x3e1629[_0xde4c('0x6d')]===_0xde4c('0x70')){var _0xf66743=_0xc26562['get']({'plain':!![]});return db[_0xde4c('0x71')][_0xde4c('0x72')]({'where':{'name':_0xde4c('0x24'),'userProfileId':_0x3e1629[_0xde4c('0x6e')]},'raw':!![]})[_0xde4c('0x22')](function(_0x102f6f){if(_0x102f6f&&_0x102f6f[_0xde4c('0x73')]===0x0){return db[_0xde4c('0x25')]['create']({'name':_0xf66743['name'],'resourceId':_0xf66743['id'],'type':_0x102f6f[_0xde4c('0x27')],'sectionId':_0x102f6f['id']},{})[_0xde4c('0x22')](function(){return _0xc26562;});}else{return _0xc26562;}})[_0xde4c('0x42')](function(_0x18d57e){logger[_0xde4c('0x74')](_0xde4c('0x75'),_0x18d57e);throw _0x18d57e;});}return _0xc26562;})[_0xde4c('0x22')](respondWithResult(_0x39f2f,null))[_0xde4c('0x42')](handleError(_0x39f2f,null));});_0x413c6d[_0xde4c('0x76')]();}catch(_0x158a9d){_0x39f2f[_0xde4c('0x16')](0x1f4)[_0xde4c('0x28')](_0x158a9d);}};exports[_0xde4c('0x21')]=function(_0x12e409,_0x2af8d6,_0xd43ac9){return db['Sound'][_0xde4c('0x72')]({'where':{'id':_0x12e409[_0xde4c('0x44')]['id']}})[_0xde4c('0x22')](handleEntityNotFound(_0x2af8d6,null))[_0xde4c('0x22')](saveUpdates(_[_0xde4c('0x39')](_0x12e409[_0xde4c('0x77')],[_0xde4c('0x27'),'description']),null))[_0xde4c('0x22')](respondWithResult(_0x2af8d6,null))[_0xde4c('0x42')](handleError(_0x2af8d6,null));};exports[_0xde4c('0x78')]=function(_0x5a0707,_0x964fa4,_0x3424e0){return db[_0xde4c('0x2b')][_0xde4c('0x72')]({'where':{'id':_0x5a0707[_0xde4c('0x44')]['id']}})[_0xde4c('0x22')](function(_0x1a9eb1){if(_0x1a9eb1){return _0x1a9eb1[_0xde4c('0x26')]();}})[_0xde4c('0x22')](function(_0x49c9fe){var _0x19662b=path[_0xde4c('0x4a')](config[_0xde4c('0x4e')],_0xde4c('0x58'),util[_0xde4c('0x50')](_0xde4c('0x59'),_0x49c9fe['save_name'],_0x49c9fe['original_format']));var _0x125c4a=path[_0xde4c('0x4a')](config[_0xde4c('0x4e')],_0xde4c('0x4f'),util[_0xde4c('0x50')](_0xde4c('0x59'),_0x49c9fe[_0xde4c('0x4b')],_0x49c9fe[_0xde4c('0x48')]));fs[_0xde4c('0x5f')](_0x19662b);fs['unlinkSync'](_0x125c4a);return _0x49c9fe;})['then'](function(_0x39ac00){if(_0x39ac00){return _0x964fa4[_0xde4c('0x16')](0xcc)['end']();}})[_0xde4c('0x22')](handleEntityNotFound(_0x964fa4,null))[_0xde4c('0x42')](handleError(_0x964fa4,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 4cfcd55..8157eba 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 _0x9f41=['../../config/environment','./sound.attributes','exports','define','Sound','tools_sounds','util','../../config/logger','api','moment','path','rimraf'];(function(_0x546c68,_0x5c0116){var _0x4a2389=function(_0x5aa205){while(--_0x5aa205){_0x546c68['push'](_0x546c68['shift']());}};_0x4a2389(++_0x5c0116);}(_0x9f41,0x96));var _0x19f4=function(_0x12928d,_0x57c359){_0x12928d=_0x12928d-0x0;var _0x1424c7=_0x9f41[_0x12928d];return _0x1424c7;};'use strict';var _=require('lodash');var util=require(_0x19f4('0x0'));var logger=require(_0x19f4('0x1'))(_0x19f4('0x2'));var moment=require(_0x19f4('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x19f4('0x4'));var rimraf=require(_0x19f4('0x5'));var config=require(_0x19f4('0x6'));var attributes=require(_0x19f4('0x7'));module[_0x19f4('0x8')]=function(_0xf6379e,_0x37f926){return _0xf6379e[_0x19f4('0x9')](_0x19f4('0xa'),attributes,{'tableName':_0x19f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1d5=['../../config/environment','./sound.attributes','exports','Sound','tools_sounds','util','api','moment','request-promise','rimraf'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xc1d5,0x18b));var _0x5c1d=function(_0xb603f1,_0x31555a){_0xb603f1=_0xb603f1-0x0;var _0x5a77aa=_0xc1d5[_0xb603f1];return _0x5a77aa;};'use strict';var _=require('lodash');var util=require(_0x5c1d('0x0'));var logger=require('../../config/logger')(_0x5c1d('0x1'));var moment=require(_0x5c1d('0x2'));var BPromise=require('bluebird');var rp=require(_0x5c1d('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5c1d('0x4'));var config=require(_0x5c1d('0x5'));var attributes=require(_0x5c1d('0x6'));module[_0x5c1d('0x7')]=function(_0x5a6977,_0x20d3f8){return _0x5a6977['define'](_0x5c1d('0x8'),attributes,{'tableName':_0x5c1d('0x9'),'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 f373532..f0af5be 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 _0x0229=['options','raw','where','include','attributes','map','model','catch','ShowSound','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','Sound,\x20%s,\x20%s','result','Sound','find'];(function(_0x56a60a,_0xf4c330){var _0x5c4057=function(_0x5ed7f8){while(--_0x5ed7f8){_0x56a60a['push'](_0x56a60a['shift']());}};_0x5c4057(++_0xf4c330);}(_0x0229,0x1f3));var _0x9022=function(_0x8c482f,_0x454dd7){_0x8c482f=_0x8c482f-0x0;var _0x55aa3d=_0x0229[_0x8c482f];return _0x55aa3d;};'use strict';var _=require(_0x9022('0x0'));var util=require(_0x9022('0x1'));var moment=require(_0x9022('0x2'));var BPromise=require(_0x9022('0x3'));var rs=require(_0x9022('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9022('0x5'))['db'];var utils=require(_0x9022('0x6'));var logger=require(_0x9022('0x7'))(_0x9022('0x8'));var config=require(_0x9022('0x9'));var jayson=require(_0x9022('0xa'));var client=jayson[_0x9022('0xb')][_0x9022('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2236a6,_0x321079,_0x5a3656){return new BPromise(function(_0x1a695f,_0x47b436){return client[_0x9022('0xd')](_0x2236a6,_0x5a3656)[_0x9022('0xe')](function(_0x66ac72){logger[_0x9022('0xf')]('Sound,\x20%s,\x20%s',_0x321079,_0x9022('0x10'));logger[_0x9022('0x11')]('Sound,\x20%s,\x20%s,\x20%s',_0x321079,'request\x20sent',JSON[_0x9022('0x12')](_0x66ac72));if(_0x66ac72[_0x9022('0x13')]){if(_0x66ac72[_0x9022('0x13')][_0x9022('0x14')]===0x1f4){logger[_0x9022('0x13')]('Sound,\x20%s,\x20%s',_0x321079,_0x66ac72[_0x9022('0x13')][_0x9022('0x15')]);return _0x47b436(_0x66ac72['error'][_0x9022('0x15')]);}logger[_0x9022('0x13')](_0x9022('0x16'),_0x321079,_0x66ac72[_0x9022('0x13')][_0x9022('0x15')]);return _0x1a695f(_0x66ac72[_0x9022('0x13')][_0x9022('0x15')]);}else{logger[_0x9022('0xf')](_0x9022('0x16'),_0x321079,_0x9022('0x10'));_0x1a695f(_0x66ac72[_0x9022('0x17')][_0x9022('0x15')]);}})['catch'](function(_0x59daa5){logger[_0x9022('0x13')]('Sound,\x20%s,\x20%s',_0x321079,_0x59daa5);_0x47b436(_0x59daa5);});});}exports['ShowSound']=function(_0x533a8b){var _0x287f16=this;return new Promise(function(_0x5ca683,_0x16f2e8){return db[_0x9022('0x18')][_0x9022('0x19')]({'raw':_0x533a8b[_0x9022('0x1a')]?_0x533a8b['options'][_0x9022('0x1b')]===undefined?!![]:![]:!![],'where':_0x533a8b[_0x9022('0x1a')]?_0x533a8b[_0x9022('0x1a')][_0x9022('0x1c')]||null:null,'attributes':_0x533a8b[_0x9022('0x1a')]?_0x533a8b[_0x9022('0x1a')]['attributes']||null:null,'include':_0x533a8b[_0x9022('0x1a')]?_0x533a8b['options']['include']?_['map'](_0x533a8b[_0x9022('0x1a')][_0x9022('0x1d')],function(_0x3c5c27){return{'model':db[_0x3c5c27['model']],'as':_0x3c5c27['as'],'attributes':_0x3c5c27[_0x9022('0x1e')],'include':_0x3c5c27['include']?_[_0x9022('0x1f')](_0x3c5c27['include'],function(_0x119d4d){return{'model':db[_0x119d4d[_0x9022('0x20')]],'as':_0x119d4d['as'],'attributes':_0x119d4d['attributes'],'include':_0x119d4d[_0x9022('0x1d')]?_[_0x9022('0x1f')](_0x119d4d['include'],function(_0x3c6ab3){return{'model':db[_0x3c6ab3['model']],'as':_0x3c6ab3['as'],'attributes':_0x3c6ab3[_0x9022('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9022('0xe')](function(_0x3f13cc){logger[_0x9022('0xf')]('ShowSound',_0x533a8b);logger['debug']('ShowSound',_0x533a8b,JSON[_0x9022('0x12')](_0x3f13cc));_0x5ca683(_0x3f13cc);})[_0x9022('0x21')](function(_0x4196d9){logger[_0x9022('0x13')](_0x9022('0x22'),_0x4196d9[_0x9022('0x15')],_0x533a8b);_0x16f2e8(_0x287f16['error'](0x1f4,_0x4196d9[_0x9022('0x15')]));});});}; \ No newline at end of file +var _0x4cf5=['Sound','options','raw','where','attributes','map','include','model','lodash','util','moment','../../mysqldb','../../config/utils','jayson/promise','client','http','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSound'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4cf5,0x1a8));var _0x54cf=function(_0x38d07c,_0x19736a){_0x38d07c=_0x38d07c-0x0;var _0x37f717=_0x4cf5[_0x38d07c];return _0x37f717;};'use strict';var _=require(_0x54cf('0x0'));var util=require(_0x54cf('0x1'));var moment=require(_0x54cf('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x54cf('0x3'))['db'];var utils=require(_0x54cf('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x54cf('0x5'));var client=jayson[_0x54cf('0x6')][_0x54cf('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x519b39,_0x46e834,_0x2bc94d){return new BPromise(function(_0x42d6ee,_0x4bc1a5){return client['request'](_0x519b39,_0x2bc94d)['then'](function(_0x3ecfa4){logger[_0x54cf('0x8')](_0x54cf('0x9'),_0x46e834,_0x54cf('0xa'));logger[_0x54cf('0xb')](_0x54cf('0xc'),_0x46e834,_0x54cf('0xa'),JSON[_0x54cf('0xd')](_0x3ecfa4));if(_0x3ecfa4[_0x54cf('0xe')]){if(_0x3ecfa4['error']['code']===0x1f4){logger[_0x54cf('0xe')](_0x54cf('0x9'),_0x46e834,_0x3ecfa4[_0x54cf('0xe')]['message']);return _0x4bc1a5(_0x3ecfa4[_0x54cf('0xe')][_0x54cf('0xf')]);}logger['error'](_0x54cf('0x9'),_0x46e834,_0x3ecfa4[_0x54cf('0xe')]['message']);return _0x42d6ee(_0x3ecfa4[_0x54cf('0xe')]['message']);}else{logger[_0x54cf('0x8')]('Sound,\x20%s,\x20%s',_0x46e834,_0x54cf('0xa'));_0x42d6ee(_0x3ecfa4['result'][_0x54cf('0xf')]);}})[_0x54cf('0x10')](function(_0x11971b){logger[_0x54cf('0xe')]('Sound,\x20%s,\x20%s',_0x46e834,_0x11971b);_0x4bc1a5(_0x11971b);});});}exports[_0x54cf('0x11')]=function(_0x3ef998){var _0x14448b=this;return new Promise(function(_0x521876,_0x477fe7){return db[_0x54cf('0x12')]['find']({'raw':_0x3ef998[_0x54cf('0x13')]?_0x3ef998[_0x54cf('0x13')][_0x54cf('0x14')]===undefined?!![]:![]:!![],'where':_0x3ef998[_0x54cf('0x13')]?_0x3ef998[_0x54cf('0x13')][_0x54cf('0x15')]||null:null,'attributes':_0x3ef998[_0x54cf('0x13')]?_0x3ef998[_0x54cf('0x13')][_0x54cf('0x16')]||null:null,'include':_0x3ef998[_0x54cf('0x13')]?_0x3ef998[_0x54cf('0x13')]['include']?_[_0x54cf('0x17')](_0x3ef998['options'][_0x54cf('0x18')],function(_0x42e9ad){return{'model':db[_0x42e9ad['model']],'as':_0x42e9ad['as'],'attributes':_0x42e9ad[_0x54cf('0x16')],'include':_0x42e9ad[_0x54cf('0x18')]?_[_0x54cf('0x17')](_0x42e9ad[_0x54cf('0x18')],function(_0x37bdd6){return{'model':db[_0x37bdd6[_0x54cf('0x19')]],'as':_0x37bdd6['as'],'attributes':_0x37bdd6[_0x54cf('0x16')],'include':_0x37bdd6['include']?_['map'](_0x37bdd6[_0x54cf('0x18')],function(_0x597d67){return{'model':db[_0x597d67[_0x54cf('0x19')]],'as':_0x597d67['as'],'attributes':_0x597d67[_0x54cf('0x16')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a3b42){logger[_0x54cf('0x8')]('ShowSound',_0x3ef998);logger[_0x54cf('0xb')](_0x54cf('0x11'),_0x3ef998,JSON['stringify'](_0x3a3b42));_0x521876(_0x3a3b42);})[_0x54cf('0x10')](function(_0x53e538){logger[_0x54cf('0xe')]('ShowSound',_0x53e538[_0x54cf('0xf')],_0x3ef998);_0x477fe7(_0x14448b[_0x54cf('0xe')](0x1f4,_0x53e538['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 22617fd..39ac2cc 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x253b37,_0xdb7ae0){var _0x24b147=function(_0x38c58d){while(--_0x38c58d){_0x253b37['push'](_0x253b37['shift']());}};_0x24b147(++_0xdb7ae0);}(_0x2032,0xd9));var _0x2203=function(_0x48a0fd,_0x1bd5ce){_0x48a0fd=_0x48a0fd-0x0;var _0x500845=_0x2032[_0x48a0fd];return _0x500845;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x311909,_0x414bf7){var _0x8d3163=function(_0x226f55){while(--_0x226f55){_0x311909['push'](_0x311909['shift']());}};_0x8d3163(++_0x414bf7);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1c139f,_0x1c9803){_0x1c139f=_0x1c139f-0x0;var _0x3a0664=_0x9ffd[_0x1c139f];return _0x3a0664;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('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 009ba90..4275e2a 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 _0xe58f=['ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x5159a4,_0x2bf494){var _0x10b8fb=function(_0x2c6351){while(--_0x2c6351){_0x5159a4['push'](_0x5159a4['shift']());}};_0x10b8fb(++_0x2bf494);}(_0xe58f,0x176));var _0xfe58=function(_0xba030e,_0x429125){_0xba030e=_0xba030e-0x0;var _0x4d897c=_0xe58f[_0xba030e];return _0x4d897c;};'use strict';var Sequelize=require(_0xfe58('0x0'));module[_0xfe58('0x1')]={'uniqueid':{'type':Sequelize[_0xfe58('0x2')]},'body':{'type':Sequelize[_0xfe58('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xfe58('0x4')]('in',_0xfe58('0x5')),'defaultValue':_0xfe58('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0xfe58('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7b64=['out','sequelize','exports','STRING','TEXT'];(function(_0x32a0ae,_0x7e669f){var _0x2eaa8e=function(_0x597804){while(--_0x597804){_0x32a0ae['push'](_0x32a0ae['shift']());}};_0x2eaa8e(++_0x7e669f);}(_0x7b64,0x8d));var _0x47b6=function(_0x4e2be3,_0x5e4149){_0x4e2be3=_0x4e2be3-0x0;var _0x4d2390=_0x7b64[_0x4e2be3];return _0x4d2390;};'use strict';var Sequelize=require(_0x47b6('0x0'));module[_0x47b6('0x1')]={'uniqueid':{'type':Sequelize[_0x47b6('0x2')]},'body':{'type':Sequelize[_0x47b6('0x3')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x47b6('0x4')),'defaultValue':_0x47b6('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x47b6('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 2e6af31..3da396d 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 _0x11c1=['include','findAll','catch','show','params','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','map','SquareMessage','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options'];(function(_0x1b28e,_0x3837e5){var _0x48856f=function(_0x5d795c){while(--_0x5d795c){_0x1b28e['push'](_0x1b28e['shift']());}};_0x48856f(++_0x3837e5);}(_0x11c1,0x1cb));var _0x111c=function(_0x176595,_0x3c430a){_0x176595=_0x176595-0x0;var _0x446e95=_0x11c1[_0x176595];return _0x446e95;};'use strict';var emlformat=require(_0x111c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x111c('0x1'));var jsonpatch=require(_0x111c('0x2'));var rp=require(_0x111c('0x3'));var moment=require(_0x111c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x111c('0x5'));var util=require(_0x111c('0x6'));var path=require(_0x111c('0x7'));var sox=require(_0x111c('0x8'));var csv=require(_0x111c('0x9'));var ejs=require(_0x111c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x111c('0xb'));var squel=require(_0x111c('0xc'));var crypto=require(_0x111c('0xd'));var jsforce=require(_0x111c('0xe'));var deskjs=require(_0x111c('0xf'));var toCsv=require(_0x111c('0x9'));var querystring=require(_0x111c('0x10'));var Papa=require(_0x111c('0x11'));var Redis=require(_0x111c('0x12'));var authService=require(_0x111c('0x13'));var qs=require(_0x111c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x111c('0x15'));var config=require(_0x111c('0x16'));var licenseUtil=require(_0x111c('0x17'));var db=require(_0x111c('0x18'))['db'];function respondWithStatusCode(_0x161df9,_0x18f728){_0x18f728=_0x18f728||0xcc;return function(_0x37deee){if(_0x37deee){return _0x161df9[_0x111c('0x19')](_0x18f728);}return _0x161df9[_0x111c('0x1a')](_0x18f728)[_0x111c('0x1b')]();};}function respondWithResult(_0x1b0dd5,_0x37a4bd){_0x37a4bd=_0x37a4bd||0xc8;return function(_0x3ad856){if(_0x3ad856){return _0x1b0dd5[_0x111c('0x1a')](_0x37a4bd)[_0x111c('0x1c')](_0x3ad856);}};}function respondWithFilteredResult(_0x412f7e,_0x2d2adb){return function(_0x9e7a7c){if(_0x9e7a7c){var _0x3babf6=typeof _0x2d2adb['offset']==='undefined'&&typeof _0x2d2adb['limit']===_0x111c('0x1d');var _0x4bd3d8=_0x9e7a7c['count'];var _0x198249=_0x3babf6?0x0:_0x2d2adb[_0x111c('0x1e')];var _0x2d54e6=_0x3babf6?_0x9e7a7c[_0x111c('0x1f')]:_0x2d2adb[_0x111c('0x1e')]+_0x2d2adb[_0x111c('0x20')];var _0x5b9171;if(_0x2d54e6>=_0x4bd3d8){_0x2d54e6=_0x4bd3d8;_0x5b9171=0xc8;}else{_0x5b9171=0xce;}_0x412f7e[_0x111c('0x1a')](_0x5b9171);return _0x412f7e[_0x111c('0x21')]('Content-Range',_0x198249+'-'+_0x2d54e6+'/'+_0x4bd3d8)[_0x111c('0x1c')](_0x9e7a7c);}return null;};}function patchUpdates(_0x211de8){return function(_0x1df840){try{jsonpatch['apply'](_0x1df840,_0x211de8,!![]);}catch(_0x39ebe3){return BPromise[_0x111c('0x22')](_0x39ebe3);}return _0x1df840[_0x111c('0x23')]();};}function saveUpdates(_0x54a586,_0x31b236){return function(_0x17d02b){if(_0x17d02b){return _0x17d02b[_0x111c('0x24')](_0x54a586)[_0x111c('0x25')](function(_0x2c4c6b){return _0x2c4c6b;});}return null;};}function removeEntity(_0x3da021,_0xe5b252){return function(_0x3694b5){if(_0x3694b5){return _0x3694b5[_0x111c('0x26')]()['then'](function(){_0x3da021[_0x111c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26b3b8,_0x2576b8){return function(_0x5764b9){if(!_0x5764b9){_0x26b3b8[_0x111c('0x19')](0x194);}return _0x5764b9;};}function handleError(_0x17a9cd,_0x55e7d0){_0x55e7d0=_0x55e7d0||0x1f4;return function(_0x33040d){logger[_0x111c('0x27')](_0x33040d[_0x111c('0x28')]);if(_0x33040d[_0x111c('0x29')]){delete _0x33040d[_0x111c('0x29')];}_0x17a9cd[_0x111c('0x1a')](_0x55e7d0)[_0x111c('0x2a')](_0x33040d);};}exports[_0x111c('0x2b')]=function(_0x46e407,_0x70592b){var _0x5e3047={},_0x40d992={},_0x45bd8c={'count':0x0,'rows':[]};var _0x4c9c67=_[_0x111c('0x2c')](db[_0x111c('0x2d')]['rawAttributes'],function(_0x401138){return{'name':_0x401138[_0x111c('0x2e')],'type':_0x401138['type'][_0x111c('0x2f')]};});_0x40d992['model']=_['map'](_0x4c9c67,_0x111c('0x29'));_0x40d992[_0x111c('0x30')]=_[_0x111c('0x31')](_0x46e407[_0x111c('0x30')]);_0x40d992[_0x111c('0x32')]=_[_0x111c('0x33')](_0x40d992[_0x111c('0x34')],_0x40d992[_0x111c('0x30')]);_0x5e3047[_0x111c('0x35')]=_[_0x111c('0x33')](_0x40d992[_0x111c('0x34')],qs[_0x111c('0x36')](_0x46e407[_0x111c('0x30')]['fields']));_0x5e3047[_0x111c('0x35')]=_0x5e3047[_0x111c('0x35')][_0x111c('0x37')]?_0x5e3047['attributes']:_0x40d992[_0x111c('0x34')];if(!_0x46e407[_0x111c('0x30')][_0x111c('0x38')](_0x111c('0x39'))){_0x5e3047[_0x111c('0x20')]=qs[_0x111c('0x20')](_0x46e407[_0x111c('0x30')]['limit']);_0x5e3047[_0x111c('0x1e')]=qs['offset'](_0x46e407[_0x111c('0x30')][_0x111c('0x1e')]);}_0x5e3047[_0x111c('0x3a')]=qs[_0x111c('0x3b')](_0x46e407['query'][_0x111c('0x3b')]);_0x5e3047['where']=qs[_0x111c('0x32')](_['pick'](_0x46e407[_0x111c('0x30')],_0x40d992[_0x111c('0x32')]),_0x4c9c67);if(_0x46e407[_0x111c('0x30')][_0x111c('0x3c')]){_0x5e3047[_0x111c('0x3d')]=_[_0x111c('0x3e')](_0x5e3047[_0x111c('0x3d')],{'$or':_[_0x111c('0x2c')](_0x4c9c67,function(_0x56fb83){if(_0x56fb83[_0x111c('0x3f')]!==_0x111c('0x40')){var _0x591fe1={};_0x591fe1[_0x56fb83['name']]={'$like':'%'+_0x46e407[_0x111c('0x30')]['filter']+'%'};return _0x591fe1;}})});}_0x5e3047=_['merge']({},_0x5e3047,_0x46e407[_0x111c('0x41')]);var _0x5ffb09={'where':_0x5e3047[_0x111c('0x3d')]};return db[_0x111c('0x2d')][_0x111c('0x1f')](_0x5ffb09)[_0x111c('0x25')](function(_0x167b00){_0x45bd8c[_0x111c('0x1f')]=_0x167b00;if(_0x46e407[_0x111c('0x30')]['includeAll']){_0x5e3047[_0x111c('0x42')]=[{'all':!![]}];}return db[_0x111c('0x2d')][_0x111c('0x43')](_0x5e3047);})['then'](function(_0x354dca){_0x45bd8c['rows']=_0x354dca;return _0x45bd8c;})['then'](respondWithFilteredResult(_0x70592b,_0x5e3047))[_0x111c('0x44')](handleError(_0x70592b,null));};exports[_0x111c('0x45')]=function(_0x10f4f7,_0x22e95b){var _0x38d7a0={'raw':!![],'where':{'id':_0x10f4f7[_0x111c('0x46')]['id']}},_0x1b4e4f={};_0x1b4e4f[_0x111c('0x34')]=_['keys'](db[_0x111c('0x2d')]['rawAttributes']);_0x1b4e4f[_0x111c('0x30')]=_[_0x111c('0x31')](_0x10f4f7[_0x111c('0x30')]);_0x1b4e4f[_0x111c('0x32')]=_[_0x111c('0x33')](_0x1b4e4f['model'],_0x1b4e4f['query']);_0x38d7a0[_0x111c('0x35')]=_[_0x111c('0x33')](_0x1b4e4f[_0x111c('0x34')],qs['fields'](_0x10f4f7['query']['fields']));_0x38d7a0['attributes']=_0x38d7a0[_0x111c('0x35')]['length']?_0x38d7a0['attributes']:_0x1b4e4f['model'];if(_0x10f4f7[_0x111c('0x30')][_0x111c('0x47')]){_0x38d7a0['include']=[{'all':!![]}];}_0x38d7a0=_['merge']({},_0x38d7a0,_0x10f4f7['options']);return db[_0x111c('0x2d')]['find'](_0x38d7a0)[_0x111c('0x25')](handleEntityNotFound(_0x22e95b,null))[_0x111c('0x25')](respondWithResult(_0x22e95b,null))[_0x111c('0x44')](handleError(_0x22e95b,null));};exports[_0x111c('0x48')]=function(_0x2849b6,_0x137ee5){return db['SquareMessage'][_0x111c('0x48')](_0x2849b6[_0x111c('0x49')],{})['then'](respondWithResult(_0x137ee5,0xc9))[_0x111c('0x44')](handleError(_0x137ee5,null));};exports[_0x111c('0x24')]=function(_0x8cad9c,_0x24731d){if(_0x8cad9c[_0x111c('0x49')]['id']){delete _0x8cad9c[_0x111c('0x49')]['id'];}return db[_0x111c('0x2d')][_0x111c('0x4a')]({'where':{'id':_0x8cad9c[_0x111c('0x46')]['id']}})[_0x111c('0x25')](handleEntityNotFound(_0x24731d,null))['then'](saveUpdates(_0x8cad9c['body'],null))[_0x111c('0x25')](respondWithResult(_0x24731d,null))[_0x111c('0x44')](handleError(_0x24731d,null));};exports[_0x111c('0x26')]=function(_0x4288ab,_0x584c6f){return db['SquareMessage'][_0x111c('0x4a')]({'where':{'id':_0x4288ab[_0x111c('0x46')]['id']}})[_0x111c('0x25')](handleEntityNotFound(_0x584c6f,null))[_0x111c('0x25')](removeEntity(_0x584c6f,null))['catch'](handleError(_0x584c6f,null));}; \ No newline at end of file +var _0xd81e=['limit','count','status','set','Content-Range','json','apply','save','then','error','stack','name','send','index','map','SquareMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','update','destroy','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','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','../../mysqldb','sendStatus','end','offset'];(function(_0x118ebd,_0x2f229d){var _0x15236c=function(_0x6ed4c8){while(--_0x6ed4c8){_0x118ebd['push'](_0x118ebd['shift']());}};_0x15236c(++_0x2f229d);}(_0xd81e,0x7b));var _0xed81=function(_0x204012,_0xe21466){_0x204012=_0x204012-0x0;var _0x1667f0=_0xd81e[_0x204012];return _0x1667f0;};'use strict';var emlformat=require(_0xed81('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed81('0x1'));var jsonpatch=require(_0xed81('0x2'));var rp=require(_0xed81('0x3'));var moment=require(_0xed81('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed81('0x5'));var path=require(_0xed81('0x6'));var sox=require(_0xed81('0x7'));var csv=require('to-csv');var ejs=require(_0xed81('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed81('0x9'));var squel=require('squel');var crypto=require(_0xed81('0xa'));var jsforce=require(_0xed81('0xb'));var deskjs=require(_0xed81('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed81('0xd'));var Papa=require(_0xed81('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xed81('0xf'));var as=require(_0xed81('0x10'));var hardwareService=require(_0xed81('0x11'));var logger=require(_0xed81('0x12'))(_0xed81('0x13'));var utils=require(_0xed81('0x14'));var config=require(_0xed81('0x15'));var licenseUtil=require(_0xed81('0x16'));var db=require(_0xed81('0x17'))['db'];function respondWithStatusCode(_0x214d87,_0x27e6c5){_0x27e6c5=_0x27e6c5||0xcc;return function(_0xde35d4){if(_0xde35d4){return _0x214d87[_0xed81('0x18')](_0x27e6c5);}return _0x214d87['status'](_0x27e6c5)[_0xed81('0x19')]();};}function respondWithResult(_0x146c70,_0xceb36c){_0xceb36c=_0xceb36c||0xc8;return function(_0x5b8a92){if(_0x5b8a92){return _0x146c70['status'](_0xceb36c)['json'](_0x5b8a92);}};}function respondWithFilteredResult(_0x4939af,_0x4f19cf){return function(_0x577fd7){if(_0x577fd7){var _0x4f580e=typeof _0x4f19cf[_0xed81('0x1a')]==='undefined'&&typeof _0x4f19cf[_0xed81('0x1b')]==='undefined';var _0x52187d=_0x577fd7[_0xed81('0x1c')];var _0x16d513=_0x4f580e?0x0:_0x4f19cf['offset'];var _0x5cb5a=_0x4f580e?_0x577fd7[_0xed81('0x1c')]:_0x4f19cf[_0xed81('0x1a')]+_0x4f19cf[_0xed81('0x1b')];var _0x27581c;if(_0x5cb5a>=_0x52187d){_0x5cb5a=_0x52187d;_0x27581c=0xc8;}else{_0x27581c=0xce;}_0x4939af[_0xed81('0x1d')](_0x27581c);return _0x4939af[_0xed81('0x1e')](_0xed81('0x1f'),_0x16d513+'-'+_0x5cb5a+'/'+_0x52187d)[_0xed81('0x20')](_0x577fd7);}return null;};}function patchUpdates(_0x244596){return function(_0x22922f){try{jsonpatch[_0xed81('0x21')](_0x22922f,_0x244596,!![]);}catch(_0x192b9b){return BPromise['reject'](_0x192b9b);}return _0x22922f[_0xed81('0x22')]();};}function saveUpdates(_0x3762a5,_0x53ff01){return function(_0x43a252){if(_0x43a252){return _0x43a252['update'](_0x3762a5)[_0xed81('0x23')](function(_0x51f070){return _0x51f070;});}return null;};}function removeEntity(_0x26a3b0,_0x4aa7e8){return function(_0x5baa7e){if(_0x5baa7e){return _0x5baa7e['destroy']()[_0xed81('0x23')](function(){_0x26a3b0['status'](0xcc)[_0xed81('0x19')]();});}};}function handleEntityNotFound(_0x14c8f7,_0x2d4a6f){return function(_0x3ca1fc){if(!_0x3ca1fc){_0x14c8f7['sendStatus'](0x194);}return _0x3ca1fc;};}function handleError(_0x343480,_0x5c456f){_0x5c456f=_0x5c456f||0x1f4;return function(_0x5e758e){logger[_0xed81('0x24')](_0x5e758e[_0xed81('0x25')]);if(_0x5e758e[_0xed81('0x26')]){delete _0x5e758e['name'];}_0x343480['status'](_0x5c456f)[_0xed81('0x27')](_0x5e758e);};}exports[_0xed81('0x28')]=function(_0x10d5d1,_0x40c269){var _0x51da28={},_0x19e7dd={},_0x826f00={'count':0x0,'rows':[]};var _0x5dfffa=_[_0xed81('0x29')](db[_0xed81('0x2a')][_0xed81('0x2b')],function(_0x332a3a){return{'name':_0x332a3a[_0xed81('0x2c')],'type':_0x332a3a[_0xed81('0x2d')][_0xed81('0x2e')]};});_0x19e7dd[_0xed81('0x2f')]=_[_0xed81('0x29')](_0x5dfffa,_0xed81('0x26'));_0x19e7dd['query']=_[_0xed81('0x30')](_0x10d5d1[_0xed81('0x31')]);_0x19e7dd[_0xed81('0x32')]=_[_0xed81('0x33')](_0x19e7dd[_0xed81('0x2f')],_0x19e7dd[_0xed81('0x31')]);_0x51da28[_0xed81('0x34')]=_[_0xed81('0x33')](_0x19e7dd[_0xed81('0x2f')],qs['fields'](_0x10d5d1['query']['fields']));_0x51da28['attributes']=_0x51da28[_0xed81('0x34')][_0xed81('0x35')]?_0x51da28[_0xed81('0x34')]:_0x19e7dd[_0xed81('0x2f')];if(!_0x10d5d1[_0xed81('0x31')]['hasOwnProperty'](_0xed81('0x36'))){_0x51da28['limit']=qs[_0xed81('0x1b')](_0x10d5d1[_0xed81('0x31')]['limit']);_0x51da28['offset']=qs[_0xed81('0x1a')](_0x10d5d1[_0xed81('0x31')][_0xed81('0x1a')]);}_0x51da28[_0xed81('0x37')]=qs[_0xed81('0x38')](_0x10d5d1[_0xed81('0x31')][_0xed81('0x38')]);_0x51da28[_0xed81('0x39')]=qs[_0xed81('0x32')](_[_0xed81('0x3a')](_0x10d5d1[_0xed81('0x31')],_0x19e7dd['filters']),_0x5dfffa);if(_0x10d5d1[_0xed81('0x31')]['filter']){_0x51da28[_0xed81('0x39')]=_[_0xed81('0x3b')](_0x51da28[_0xed81('0x39')],{'$or':_[_0xed81('0x29')](_0x5dfffa,function(_0x515533){if(_0x515533[_0xed81('0x2d')]!=='VIRTUAL'){var _0x25cd9c={};_0x25cd9c[_0x515533[_0xed81('0x26')]]={'$like':'%'+_0x10d5d1['query'][_0xed81('0x3c')]+'%'};return _0x25cd9c;}})});}_0x51da28=_[_0xed81('0x3b')]({},_0x51da28,_0x10d5d1[_0xed81('0x3d')]);var _0x5b5690={'where':_0x51da28[_0xed81('0x39')]};return db[_0xed81('0x2a')][_0xed81('0x1c')](_0x5b5690)[_0xed81('0x23')](function(_0xa312dc){_0x826f00['count']=_0xa312dc;if(_0x10d5d1['query'][_0xed81('0x3e')]){_0x51da28[_0xed81('0x3f')]=[{'all':!![]}];}return db[_0xed81('0x2a')][_0xed81('0x40')](_0x51da28);})[_0xed81('0x23')](function(_0x25c0f2){_0x826f00[_0xed81('0x41')]=_0x25c0f2;return _0x826f00;})['then'](respondWithFilteredResult(_0x40c269,_0x51da28))[_0xed81('0x42')](handleError(_0x40c269,null));};exports[_0xed81('0x43')]=function(_0x51449d,_0x2ab74c){var _0xa6156b={'raw':!![],'where':{'id':_0x51449d[_0xed81('0x44')]['id']}},_0x372e8a={};_0x372e8a['model']=_[_0xed81('0x30')](db[_0xed81('0x2a')]['rawAttributes']);_0x372e8a[_0xed81('0x31')]=_[_0xed81('0x30')](_0x51449d[_0xed81('0x31')]);_0x372e8a[_0xed81('0x32')]=_[_0xed81('0x33')](_0x372e8a['model'],_0x372e8a[_0xed81('0x31')]);_0xa6156b['attributes']=_['intersection'](_0x372e8a['model'],qs[_0xed81('0x45')](_0x51449d[_0xed81('0x31')][_0xed81('0x45')]));_0xa6156b[_0xed81('0x34')]=_0xa6156b[_0xed81('0x34')][_0xed81('0x35')]?_0xa6156b[_0xed81('0x34')]:_0x372e8a[_0xed81('0x2f')];if(_0x51449d[_0xed81('0x31')]['includeAll']){_0xa6156b[_0xed81('0x3f')]=[{'all':!![]}];}_0xa6156b=_['merge']({},_0xa6156b,_0x51449d['options']);return db[_0xed81('0x2a')][_0xed81('0x46')](_0xa6156b)['then'](handleEntityNotFound(_0x2ab74c,null))[_0xed81('0x23')](respondWithResult(_0x2ab74c,null))[_0xed81('0x42')](handleError(_0x2ab74c,null));};exports['create']=function(_0x42b576,_0x21030e){return db[_0xed81('0x2a')][_0xed81('0x47')](_0x42b576[_0xed81('0x48')],{})['then'](respondWithResult(_0x21030e,0xc9))[_0xed81('0x42')](handleError(_0x21030e,null));};exports[_0xed81('0x49')]=function(_0x5ddba6,_0x1bd78c){if(_0x5ddba6[_0xed81('0x48')]['id']){delete _0x5ddba6['body']['id'];}return db[_0xed81('0x2a')][_0xed81('0x46')]({'where':{'id':_0x5ddba6['params']['id']}})['then'](handleEntityNotFound(_0x1bd78c,null))['then'](saveUpdates(_0x5ddba6[_0xed81('0x48')],null))[_0xed81('0x23')](respondWithResult(_0x1bd78c,null))[_0xed81('0x42')](handleError(_0x1bd78c,null));};exports[_0xed81('0x4a')]=function(_0x11fb2d,_0x5f2234){return db[_0xed81('0x2a')]['find']({'where':{'id':_0x11fb2d['params']['id']}})[_0xed81('0x23')](handleEntityNotFound(_0x5f2234,null))['then'](removeEntity(_0x5f2234,null))[_0xed81('0x42')](handleError(_0x5f2234,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index a460d22..03601b4 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 _0x9226=['moment','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','square_messages','lodash','util'];(function(_0x19a1ae,_0x38a7b9){var _0x32f843=function(_0x5e1a8c){while(--_0x5e1a8c){_0x19a1ae['push'](_0x19a1ae['shift']());}};_0x32f843(++_0x38a7b9);}(_0x9226,0x11e));var _0x6922=function(_0x497c6d,_0x2a18b0){_0x497c6d=_0x497c6d-0x0;var _0x4f440a=_0x9226[_0x497c6d];return _0x4f440a;};'use strict';var _=require(_0x6922('0x0'));var util=require(_0x6922('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6922('0x2'));var BPromise=require('bluebird');var rp=require(_0x6922('0x3'));var fs=require('fs');var path=require(_0x6922('0x4'));var rimraf=require(_0x6922('0x5'));var config=require(_0x6922('0x6'));var attributes=require(_0x6922('0x7'));module['exports']=function(_0x576d6f,_0x1177d5){return _0x576d6f['define']('SquareMessage',attributes,{'tableName':_0x6922('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6389=['path','rimraf','../../config/environment','./squareMessage.attributes','define','../../config/logger','api','bluebird'];(function(_0x525f58,_0xfa97d3){var _0x159734=function(_0x28900d){while(--_0x28900d){_0x525f58['push'](_0x525f58['shift']());}};_0x159734(++_0xfa97d3);}(_0x6389,0x1ad));var _0x9638=function(_0xa57063,_0x205e5c){_0xa57063=_0xa57063-0x0;var _0x412c51=_0x6389[_0xa57063];return _0x412c51;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9638('0x0'))(_0x9638('0x1'));var moment=require('moment');var BPromise=require(_0x9638('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9638('0x3'));var rimraf=require(_0x9638('0x4'));var config=require(_0x9638('0x5'));var attributes=require(_0x9638('0x6'));module['exports']=function(_0x368c06,_0xabd4e2){return _0x368c06[_0x9638('0x7')]('SquareMessage',attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index 71ff62f..ec15e21 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 _0x621b=['../../config/environment','jayson/promise','client','http','request','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','SquareMessage','create','CreateSquareMessage','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x301064,_0x1985aa){var _0x5bc841=function(_0x57dffc){while(--_0x57dffc){_0x301064['push'](_0x301064['shift']());}};_0x5bc841(++_0x1985aa);}(_0x621b,0x14a));var _0xb621=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0x621b[_0x616290];return _0x453879;};'use strict';var _=require(_0xb621('0x0'));var util=require(_0xb621('0x1'));var moment=require(_0xb621('0x2'));var BPromise=require(_0xb621('0x3'));var rs=require(_0xb621('0x4'));var fs=require('fs');var Redis=require(_0xb621('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xb621('0x6'));var jayson=require(_0xb621('0x7'));var client=jayson[_0xb621('0x8')][_0xb621('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d3039,_0x4b300d,_0x84d806){return new BPromise(function(_0x323ec4,_0x49dfcb){return client[_0xb621('0xa')](_0x3d3039,_0x84d806)[_0xb621('0xb')](function(_0x38fced){logger['info'](_0xb621('0xc'),_0x4b300d,_0xb621('0xd'));logger[_0xb621('0xe')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4b300d,_0xb621('0xd'),JSON['stringify'](_0x38fced));if(_0x38fced[_0xb621('0xf')]){if(_0x38fced[_0xb621('0xf')][_0xb621('0x10')]===0x1f4){logger['error'](_0xb621('0xc'),_0x4b300d,_0x38fced['error'][_0xb621('0x11')]);return _0x49dfcb(_0x38fced[_0xb621('0xf')][_0xb621('0x11')]);}logger[_0xb621('0xf')](_0xb621('0xc'),_0x4b300d,_0x38fced[_0xb621('0xf')][_0xb621('0x11')]);return _0x323ec4(_0x38fced[_0xb621('0xf')]['message']);}else{logger[_0xb621('0x12')]('SquareMessage,\x20%s,\x20%s',_0x4b300d,'request\x20sent');_0x323ec4(_0x38fced[_0xb621('0x13')][_0xb621('0x11')]);}})[_0xb621('0x14')](function(_0xc60c40){logger[_0xb621('0xf')](_0xb621('0xc'),_0x4b300d,_0xc60c40);_0x49dfcb(_0xc60c40);});});}exports['CreateSquareMessage']=function(_0x9522cf){var _0x5f5bfa=this;return new Promise(function(_0x4f33a6,_0x5f2f12){return db[_0xb621('0x15')][_0xb621('0x16')](_0x9522cf['body'],{'raw':_0x9522cf['options']?_0x9522cf['options']['raw']===undefined?!![]:![]:!![]})[_0xb621('0xb')](function(_0x1e64a3){logger['info'](_0xb621('0x17'),_0x9522cf);logger[_0xb621('0xe')](_0xb621('0x17'),_0x9522cf,JSON['stringify'](_0x1e64a3));_0x4f33a6(_0x1e64a3);})[_0xb621('0x14')](function(_0x3e3594){logger['error'](_0xb621('0x17'),_0x3e3594[_0xb621('0x11')],_0x9522cf);_0x5f2f12(_0x5f5bfa[_0xb621('0xf')](0x1f4,_0x3e3594[_0xb621('0x11')]));});});}; \ No newline at end of file +var _0xb271=['result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0xb271,0x18e));var _0x1b27=function(_0x4f1c90,_0x57dc64){_0x4f1c90=_0x4f1c90-0x0;var _0x3ea392=_0xb271[_0x4f1c90];return _0x3ea392;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1b27('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b27('0x1'))['db'];var utils=require(_0x1b27('0x2'));var logger=require('../../config/logger')(_0x1b27('0x3'));var config=require(_0x1b27('0x4'));var jayson=require(_0x1b27('0x5'));var client=jayson['client'][_0x1b27('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x32e96d,_0x108c34,_0x37ccdc){return new BPromise(function(_0x28bbe6,_0x3503df){return client[_0x1b27('0x7')](_0x32e96d,_0x37ccdc)[_0x1b27('0x8')](function(_0x591a28){logger[_0x1b27('0x9')](_0x1b27('0xa'),_0x108c34,'request\x20sent');logger[_0x1b27('0xb')](_0x1b27('0xc'),_0x108c34,_0x1b27('0xd'),JSON[_0x1b27('0xe')](_0x591a28));if(_0x591a28[_0x1b27('0xf')]){if(_0x591a28[_0x1b27('0xf')][_0x1b27('0x10')]===0x1f4){logger[_0x1b27('0xf')]('SquareMessage,\x20%s,\x20%s',_0x108c34,_0x591a28['error'][_0x1b27('0x11')]);return _0x3503df(_0x591a28[_0x1b27('0xf')]['message']);}logger[_0x1b27('0xf')](_0x1b27('0xa'),_0x108c34,_0x591a28['error'][_0x1b27('0x11')]);return _0x28bbe6(_0x591a28[_0x1b27('0xf')][_0x1b27('0x11')]);}else{logger[_0x1b27('0x9')](_0x1b27('0xa'),_0x108c34,_0x1b27('0xd'));_0x28bbe6(_0x591a28[_0x1b27('0x12')][_0x1b27('0x11')]);}})['catch'](function(_0x1f4971){logger[_0x1b27('0xf')](_0x1b27('0xa'),_0x108c34,_0x1f4971);_0x3503df(_0x1f4971);});});}exports[_0x1b27('0x13')]=function(_0x477a07){var _0x30f403=this;return new Promise(function(_0x5cce36,_0x107f39){return db[_0x1b27('0x14')][_0x1b27('0x15')](_0x477a07[_0x1b27('0x16')],{'raw':_0x477a07['options']?_0x477a07[_0x1b27('0x17')][_0x1b27('0x18')]===undefined?!![]:![]:!![]})[_0x1b27('0x8')](function(_0x4619d3){logger['info'](_0x1b27('0x13'),_0x477a07);logger['debug'](_0x1b27('0x13'),_0x477a07,JSON['stringify'](_0x4619d3));_0x5cce36(_0x4619d3);})[_0x1b27('0x19')](function(_0x1812b9){logger['error'](_0x1b27('0x13'),_0x1812b9[_0x1b27('0x11')],_0x477a07);_0x107f39(_0x30f403[_0x1b27('0xf')](0x1f4,_0x1812b9[_0x1b27('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 5ec2b53..0d6af9a 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 _0xc761=['isAuthenticated','show','/:id/test','test','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareOdbc.controller','index','get','/:id'];(function(_0xfa73ac,_0x2a7395){var _0x4e8e14=function(_0x9b5698){while(--_0x9b5698){_0xfa73ac['push'](_0xfa73ac['shift']());}};_0x4e8e14(++_0x2a7395);}(_0xc761,0x1d6));var _0x1c76=function(_0xf33afd,_0x2363b6){_0xf33afd=_0xf33afd-0x0;var _0x5f432a=_0xc761[_0xf33afd];return _0x5f432a;};'use strict';var multer=require(_0x1c76('0x0'));var util=require(_0x1c76('0x1'));var path=require(_0x1c76('0x2'));var timeout=require(_0x1c76('0x3'));var express=require(_0x1c76('0x4'));var router=express[_0x1c76('0x5')]();var fs_extra=require(_0x1c76('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1c76('0x7'));var config=require(_0x1c76('0x8'));var controller=require(_0x1c76('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c76('0xa')]);router[_0x1c76('0xb')](_0x1c76('0xc'),auth[_0x1c76('0xd')](),controller[_0x1c76('0xe')]);router['get'](_0x1c76('0xf'),auth[_0x1c76('0xd')](),timeout('15s'),controller[_0x1c76('0x10')]);router[_0x1c76('0x11')]('/',auth[_0x1c76('0xd')](),controller[_0x1c76('0x12')]);router[_0x1c76('0x13')](_0x1c76('0xc'),auth[_0x1c76('0xd')](),controller[_0x1c76('0x14')]);router[_0x1c76('0x15')](_0x1c76('0xc'),auth[_0x1c76('0xd')](),controller[_0x1c76('0x16')]);module['exports']=router; \ No newline at end of file +var _0x0b4a=['../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','post','update','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3ca7a9,_0x4fc0c7){var _0x399428=function(_0x3f30b2){while(--_0x3f30b2){_0x3ca7a9['push'](_0x3ca7a9['shift']());}};_0x399428(++_0x4fc0c7);}(_0x0b4a,0xdd));var _0xa0b4=function(_0x55ff4e,_0x4934fd){_0x55ff4e=_0x55ff4e-0x0;var _0x124584=_0x0b4a[_0x55ff4e];return _0x124584;};'use strict';var multer=require(_0xa0b4('0x0'));var util=require(_0xa0b4('0x1'));var path=require(_0xa0b4('0x2'));var timeout=require(_0xa0b4('0x3'));var express=require(_0xa0b4('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa0b4('0x5'));var interaction=require(_0xa0b4('0x6'));var config=require(_0xa0b4('0x7'));var controller=require(_0xa0b4('0x8'));router[_0xa0b4('0x9')]('/',auth[_0xa0b4('0xa')](),controller[_0xa0b4('0xb')]);router[_0xa0b4('0x9')](_0xa0b4('0xc'),auth[_0xa0b4('0xa')](),controller[_0xa0b4('0xd')]);router[_0xa0b4('0x9')](_0xa0b4('0xe'),auth['isAuthenticated'](),timeout('15s'),controller['test']);router[_0xa0b4('0xf')]('/',auth[_0xa0b4('0xa')](),controller['create']);router['put'](_0xa0b4('0xc'),auth[_0xa0b4('0xa')](),controller[_0xa0b4('0x10')]);router['delete'](_0xa0b4('0xc'),auth[_0xa0b4('0xa')](),controller[_0xa0b4('0x11')]);module[_0xa0b4('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 e5de8d3..da3291e 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 _0x24c1=['STRING'];(function(_0x423306,_0x146f5a){var _0x476860=function(_0x4af8c4){while(--_0x4af8c4){_0x423306['push'](_0x423306['shift']());}};_0x476860(++_0x146f5a);}(_0x24c1,0x6f));var _0x124c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x24c1[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x124c('0x0')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x124c('0x0')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x65bf=['name','exports','STRING'];(function(_0x59f670,_0x2a34aa){var _0x4ad264=function(_0x4a8709){while(--_0x4a8709){_0x59f670['push'](_0x59f670['shift']());}};_0x4ad264(++_0x2a34aa);}(_0x65bf,0xc4));var _0xf65b=function(_0x8abcc1,_0x5aed45){_0x8abcc1=_0x8abcc1-0x0;var _0x20ceb8=_0x65bf[_0x8abcc1];return _0x20ceb8;};'use strict';var Sequelize=require('sequelize');module[_0xf65b('0x0')]={'name':{'type':Sequelize[_0xf65b('0x1')],'unique':_0xf65b('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xf65b('0x1')]},'description':{'type':Sequelize[_0xf65b('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index a3f4a5d..50f03f7 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 _0xa058=['rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','get','ODBC','error','name','send','index','map','SquareOdbc','type','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','rawAttributes','intersection','includeAll','find','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format'];(function(_0x3efabd,_0x8cbc81){var _0x3b07e2=function(_0x2a0d3c){while(--_0x2a0d3c){_0x3efabd['push'](_0x3efabd['shift']());}};_0x3b07e2(++_0x8cbc81);}(_0xa058,0x153));var _0x8a05=function(_0x4017b0,_0x4347db){_0x4017b0=_0x4017b0-0x0;var _0x5ed4f7=_0xa058[_0x4017b0];return _0x5ed4f7;};'use strict';var emlformat=require(_0x8a05('0x0'));var rimraf=require(_0x8a05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8a05('0x2'));var rp=require(_0x8a05('0x3'));var moment=require(_0x8a05('0x4'));var BPromise=require(_0x8a05('0x5'));var Mustache=require(_0x8a05('0x6'));var util=require(_0x8a05('0x7'));var path=require(_0x8a05('0x8'));var sox=require(_0x8a05('0x9'));var csv=require(_0x8a05('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8a05('0xb'));var crypto=require(_0x8a05('0xc'));var jsforce=require(_0x8a05('0xd'));var deskjs=require(_0x8a05('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8a05('0xf'));var Papa=require('papaparse');var Redis=require(_0x8a05('0x10'));var authService=require(_0x8a05('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8a05('0x12'));var hardwareService=require(_0x8a05('0x13'));var logger=require(_0x8a05('0x14'))(_0x8a05('0x15'));var utils=require('../../config/utils');var config=require(_0x8a05('0x16'));var licenseUtil=require(_0x8a05('0x17'));var db=require(_0x8a05('0x18'))['db'];function respondWithStatusCode(_0x444d03,_0x3dd101){_0x3dd101=_0x3dd101||0xcc;return function(_0x320288){if(_0x320288){return _0x444d03[_0x8a05('0x19')](_0x3dd101);}return _0x444d03[_0x8a05('0x1a')](_0x3dd101)['end']();};}function respondWithResult(_0x13da75,_0x292ee){_0x292ee=_0x292ee||0xc8;return function(_0x6e0586){if(_0x6e0586){return _0x13da75[_0x8a05('0x1a')](_0x292ee)[_0x8a05('0x1b')](_0x6e0586);}};}function respondWithFilteredResult(_0x169330,_0x3e11e){return function(_0x2bdab3){if(_0x2bdab3){var _0x13a317=typeof _0x3e11e[_0x8a05('0x1c')]===_0x8a05('0x1d')&&typeof _0x3e11e[_0x8a05('0x1e')]===_0x8a05('0x1d');var _0x4815c9=_0x2bdab3[_0x8a05('0x1f')];var _0x530b4d=_0x13a317?0x0:_0x3e11e[_0x8a05('0x1c')];var _0x17eac0=_0x13a317?_0x2bdab3[_0x8a05('0x1f')]:_0x3e11e[_0x8a05('0x1c')]+_0x3e11e[_0x8a05('0x1e')];var _0x4a700a;if(_0x17eac0>=_0x4815c9){_0x17eac0=_0x4815c9;_0x4a700a=0xc8;}else{_0x4a700a=0xce;}_0x169330[_0x8a05('0x1a')](_0x4a700a);return _0x169330[_0x8a05('0x20')]('Content-Range',_0x530b4d+'-'+_0x17eac0+'/'+_0x4815c9)[_0x8a05('0x1b')](_0x2bdab3);}return null;};}function patchUpdates(_0x9e9f9c){return function(_0x765ffa){try{jsonpatch[_0x8a05('0x21')](_0x765ffa,_0x9e9f9c,!![]);}catch(_0x13bf38){return BPromise[_0x8a05('0x22')](_0x13bf38);}return _0x765ffa[_0x8a05('0x23')]();};}function saveUpdates(_0x1cfb93,_0x543f2e){return function(_0x331311){if(_0x331311){return _0x331311[_0x8a05('0x24')](_0x1cfb93)['then'](function(_0x36c54f){return _0x36c54f;});}return null;};}function removeEntity(_0xeb944d,_0x4d422f){return function(_0x23c59e){if(_0x23c59e){return _0x23c59e[_0x8a05('0x25')]()[_0x8a05('0x26')](function(){var _0x179f45=_0x23c59e[_0x8a05('0x27')]({'plain':!![]});var _0x7d844b=_0x8a05('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x7d844b,'resourceId':_0x179f45['id']}})['then'](function(){return _0x23c59e;});})['then'](function(){_0xeb944d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x28b5af,_0x2573ab){return function(_0xcdca48){if(!_0xcdca48){_0x28b5af['sendStatus'](0x194);}return _0xcdca48;};}function handleError(_0x445cf5,_0x5e45e8){_0x5e45e8=_0x5e45e8||0x1f4;return function(_0x5de4fa){logger[_0x8a05('0x29')](_0x5de4fa['stack']);if(_0x5de4fa[_0x8a05('0x2a')]){delete _0x5de4fa[_0x8a05('0x2a')];}_0x445cf5['status'](_0x5e45e8)[_0x8a05('0x2b')](_0x5de4fa);};}exports[_0x8a05('0x2c')]=function(_0x4fa9fc,_0x59a500){var _0xfb2be1={},_0x5111df={},_0x28fd55={'count':0x0,'rows':[]};var _0x44f967=_[_0x8a05('0x2d')](db[_0x8a05('0x2e')]['rawAttributes'],function(_0x404e99){return{'name':_0x404e99['fieldName'],'type':_0x404e99[_0x8a05('0x2f')]['key']};});_0x5111df[_0x8a05('0x30')]=_[_0x8a05('0x2d')](_0x44f967,_0x8a05('0x2a'));_0x5111df[_0x8a05('0x31')]=_[_0x8a05('0x32')](_0x4fa9fc[_0x8a05('0x31')]);_0x5111df['filters']=_['intersection'](_0x5111df[_0x8a05('0x30')],_0x5111df[_0x8a05('0x31')]);_0xfb2be1[_0x8a05('0x33')]=_['intersection'](_0x5111df[_0x8a05('0x30')],qs['fields'](_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x34')]));_0xfb2be1['attributes']=_0xfb2be1['attributes'][_0x8a05('0x35')]?_0xfb2be1[_0x8a05('0x33')]:_0x5111df[_0x8a05('0x30')];if(!_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x36')](_0x8a05('0x37'))){_0xfb2be1[_0x8a05('0x1e')]=qs['limit'](_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x1e')]);_0xfb2be1[_0x8a05('0x1c')]=qs[_0x8a05('0x1c')](_0x4fa9fc['query']['offset']);}_0xfb2be1[_0x8a05('0x38')]=qs[_0x8a05('0x39')](_0x4fa9fc[_0x8a05('0x31')]['sort']);_0xfb2be1['where']=qs[_0x8a05('0x3a')](_[_0x8a05('0x3b')](_0x4fa9fc['query'],_0x5111df[_0x8a05('0x3a')]),_0x44f967);if(_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x3c')]){_0xfb2be1[_0x8a05('0x3d')]=_['merge'](_0xfb2be1[_0x8a05('0x3d')],{'$or':_[_0x8a05('0x2d')](_0x44f967,function(_0x5a1a30){if(_0x5a1a30[_0x8a05('0x2f')]!==_0x8a05('0x3e')){var _0x3c00ab={};_0x3c00ab[_0x5a1a30[_0x8a05('0x2a')]]={'$like':'%'+_0x4fa9fc[_0x8a05('0x31')][_0x8a05('0x3c')]+'%'};return _0x3c00ab;}})});}_0xfb2be1=_[_0x8a05('0x3f')]({},_0xfb2be1,_0x4fa9fc[_0x8a05('0x40')]);var _0x36f57e={'where':_0xfb2be1['where']};return db['SquareOdbc'][_0x8a05('0x1f')](_0x36f57e)[_0x8a05('0x26')](function(_0x411ac3){_0x28fd55[_0x8a05('0x1f')]=_0x411ac3;if(_0x4fa9fc['query']['includeAll']){_0xfb2be1[_0x8a05('0x41')]=[{'all':!![]}];}return db[_0x8a05('0x2e')][_0x8a05('0x42')](_0xfb2be1);})[_0x8a05('0x26')](function(_0x720696){_0x28fd55[_0x8a05('0x43')]=_0x720696;return _0x28fd55;})[_0x8a05('0x26')](respondWithFilteredResult(_0x59a500,_0xfb2be1))[_0x8a05('0x44')](handleError(_0x59a500,null));};exports['show']=function(_0x2dc3f0,_0x459fdf){var _0x4d34a8={'raw':!![],'where':{'id':_0x2dc3f0[_0x8a05('0x45')]['id']}},_0x1727e1={};_0x1727e1[_0x8a05('0x30')]=_['keys'](db[_0x8a05('0x2e')][_0x8a05('0x46')]);_0x1727e1[_0x8a05('0x31')]=_[_0x8a05('0x32')](_0x2dc3f0[_0x8a05('0x31')]);_0x1727e1[_0x8a05('0x3a')]=_['intersection'](_0x1727e1['model'],_0x1727e1[_0x8a05('0x31')]);_0x4d34a8[_0x8a05('0x33')]=_[_0x8a05('0x47')](_0x1727e1[_0x8a05('0x30')],qs[_0x8a05('0x34')](_0x2dc3f0[_0x8a05('0x31')]['fields']));_0x4d34a8[_0x8a05('0x33')]=_0x4d34a8['attributes'][_0x8a05('0x35')]?_0x4d34a8['attributes']:_0x1727e1['model'];if(_0x2dc3f0[_0x8a05('0x31')][_0x8a05('0x48')]){_0x4d34a8['include']=[{'all':!![]}];}_0x4d34a8=_['merge']({},_0x4d34a8,_0x2dc3f0[_0x8a05('0x40')]);return db[_0x8a05('0x2e')][_0x8a05('0x49')](_0x4d34a8)['then'](handleEntityNotFound(_0x459fdf,null))[_0x8a05('0x26')](respondWithResult(_0x459fdf,null))[_0x8a05('0x44')](handleError(_0x459fdf,null));};exports['create']=function(_0x209c31,_0x224cfd){return db[_0x8a05('0x2e')]['create'](_0x209c31[_0x8a05('0x4a')],{})[_0x8a05('0x26')](function(_0x579946){var _0x4c1651=_0x209c31[_0x8a05('0x4b')][_0x8a05('0x27')]({'plain':!![]});if(!_0x4c1651)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1651[_0x8a05('0x4c')]===_0x8a05('0x4b')){var _0x3fec88=_0x579946[_0x8a05('0x27')]({'plain':!![]});var _0x4b4278=_0x8a05('0x28');return db[_0x8a05('0x4d')]['find']({'where':{'name':_0x4b4278,'userProfileId':_0x4c1651['userProfileId']},'raw':!![]})[_0x8a05('0x26')](function(_0x475d42){if(_0x475d42&&_0x475d42[_0x8a05('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0x3fec88['name'],'resourceId':_0x3fec88['id'],'type':_0x475d42[_0x8a05('0x2a')],'sectionId':_0x475d42['id']},{})['then'](function(){return _0x579946;});}else{return _0x579946;}})[_0x8a05('0x44')](function(_0x3acba2){logger['error'](_0x8a05('0x4f'),_0x3acba2);throw _0x3acba2;});}return _0x579946;})[_0x8a05('0x26')](respondWithResult(_0x224cfd,0xc9))['catch'](handleError(_0x224cfd,null));};exports['update']=function(_0x599750,_0x5b72bf){if(_0x599750[_0x8a05('0x4a')]['id']){delete _0x599750['body']['id'];}return db[_0x8a05('0x2e')]['find']({'where':{'id':_0x599750[_0x8a05('0x45')]['id']}})[_0x8a05('0x26')](handleEntityNotFound(_0x5b72bf,null))[_0x8a05('0x26')](saveUpdates(_0x599750[_0x8a05('0x4a')],null))['then'](respondWithResult(_0x5b72bf,null))[_0x8a05('0x44')](handleError(_0x5b72bf,null));};exports[_0x8a05('0x25')]=function(_0x36444a,_0x5b00b5){return db['SquareOdbc'][_0x8a05('0x49')]({'where':{'id':_0x36444a['params']['id']}})['then'](handleEntityNotFound(_0x5b00b5,null))['then'](removeEntity(_0x5b00b5,null))[_0x8a05('0x44')](handleError(_0x5b00b5,null));};exports[_0x8a05('0x50')]=function(_0xbe7523,_0x1a3b45,_0x5b1920){var _0x55cb37;return db['SquareOdbc']['find']({'where':{'id':_0xbe7523[_0x8a05('0x45')]['id']},'attributes':['id',_0x8a05('0x51')]})[_0x8a05('0x26')](handleEntityNotFound(_0x1a3b45,null))[_0x8a05('0x26')](function(_0x7ed79a){if(_0x7ed79a){var _0xd81803=require(_0x8a05('0x52'))();_0xd81803[_0x8a05('0x53')](_0x7ed79a['dsn']);_0xd81803[_0x8a05('0x54')]();return _0x7ed79a;}})[_0x8a05('0x26')](respondWithResult(_0x1a3b45,null))[_0x8a05('0x44')](handleError(_0x1a3b45,null));}; \ No newline at end of file +var _0xf28f=['get','UserProfileResource','end','error','stack','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','name','merge','includeAll','include','findAll','catch','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','test','odbc','openSync','dsn','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy'];(function(_0x3c1ad6,_0x1dd210){var _0x4e24fb=function(_0x30ceea){while(--_0x30ceea){_0x3c1ad6['push'](_0x3c1ad6['shift']());}};_0x4e24fb(++_0x1dd210);}(_0xf28f,0x13c));var _0xff28=function(_0x55abd9,_0x1148af){_0x55abd9=_0x55abd9-0x0;var _0x3e5669=_0xf28f[_0x55abd9];return _0x3e5669;};'use strict';var emlformat=require(_0xff28('0x0'));var rimraf=require(_0xff28('0x1'));var zipdir=require(_0xff28('0x2'));var jsonpatch=require(_0xff28('0x3'));var rp=require('request-promise');var moment=require(_0xff28('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xff28('0x5'));var util=require(_0xff28('0x6'));var path=require('path');var sox=require(_0xff28('0x7'));var csv=require('to-csv');var ejs=require(_0xff28('0x8'));var fs=require('fs');var fs_extra=require(_0xff28('0x9'));var _=require(_0xff28('0xa'));var squel=require(_0xff28('0xb'));var crypto=require(_0xff28('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xff28('0xd'));var toCsv=require('to-csv');var querystring=require(_0xff28('0xe'));var Papa=require('papaparse');var Redis=require(_0xff28('0xf'));var authService=require(_0xff28('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xff28('0x11'));var logger=require(_0xff28('0x12'))(_0xff28('0x13'));var utils=require(_0xff28('0x14'));var config=require(_0xff28('0x15'));var licenseUtil=require(_0xff28('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3e68a4,_0x41b005){_0x41b005=_0x41b005||0xcc;return function(_0x199d04){if(_0x199d04){return _0x3e68a4[_0xff28('0x17')](_0x41b005);}return _0x3e68a4[_0xff28('0x18')](_0x41b005)['end']();};}function respondWithResult(_0x402ec7,_0x2b2350){_0x2b2350=_0x2b2350||0xc8;return function(_0x29b86c){if(_0x29b86c){return _0x402ec7['status'](_0x2b2350)[_0xff28('0x19')](_0x29b86c);}};}function respondWithFilteredResult(_0x42c87f,_0x4e504a){return function(_0x1269a6){if(_0x1269a6){var _0x2278b6=typeof _0x4e504a[_0xff28('0x1a')]===_0xff28('0x1b')&&typeof _0x4e504a[_0xff28('0x1c')]==='undefined';var _0x123560=_0x1269a6[_0xff28('0x1d')];var _0x48169e=_0x2278b6?0x0:_0x4e504a['offset'];var _0xc71006=_0x2278b6?_0x1269a6['count']:_0x4e504a[_0xff28('0x1a')]+_0x4e504a[_0xff28('0x1c')];var _0x1ae8a6;if(_0xc71006>=_0x123560){_0xc71006=_0x123560;_0x1ae8a6=0xc8;}else{_0x1ae8a6=0xce;}_0x42c87f[_0xff28('0x18')](_0x1ae8a6);return _0x42c87f['set'](_0xff28('0x1e'),_0x48169e+'-'+_0xc71006+'/'+_0x123560)[_0xff28('0x19')](_0x1269a6);}return null;};}function patchUpdates(_0xa4403){return function(_0x5dd08a){try{jsonpatch[_0xff28('0x1f')](_0x5dd08a,_0xa4403,!![]);}catch(_0x12f417){return BPromise[_0xff28('0x20')](_0x12f417);}return _0x5dd08a[_0xff28('0x21')]();};}function saveUpdates(_0x3d912b,_0x53031a){return function(_0x470a67){if(_0x470a67){return _0x470a67['update'](_0x3d912b)[_0xff28('0x22')](function(_0x187623){return _0x187623;});}return null;};}function removeEntity(_0x1605f4,_0x398bdf){return function(_0x535642){if(_0x535642){return _0x535642[_0xff28('0x23')]()[_0xff28('0x22')](function(){var _0x53b86f=_0x535642[_0xff28('0x24')]({'plain':!![]});var _0x25185a='ODBC';return db[_0xff28('0x25')][_0xff28('0x23')]({'where':{'type':_0x25185a,'resourceId':_0x53b86f['id']}})[_0xff28('0x22')](function(){return _0x535642;});})[_0xff28('0x22')](function(){_0x1605f4['status'](0xcc)[_0xff28('0x26')]();});}};}function handleEntityNotFound(_0x353e29,_0x39cab0){return function(_0x38975f){if(!_0x38975f){_0x353e29[_0xff28('0x17')](0x194);}return _0x38975f;};}function handleError(_0x4e2e49,_0x163e56){_0x163e56=_0x163e56||0x1f4;return function(_0x564f16){logger[_0xff28('0x27')](_0x564f16[_0xff28('0x28')]);if(_0x564f16['name']){delete _0x564f16['name'];}_0x4e2e49[_0xff28('0x18')](_0x163e56)[_0xff28('0x29')](_0x564f16);};}exports[_0xff28('0x2a')]=function(_0x5087fe,_0xea8922){var _0x20ee50={},_0x2dd9b7={},_0x19bd77={'count':0x0,'rows':[]};var _0x2f096f=_[_0xff28('0x2b')](db[_0xff28('0x2c')][_0xff28('0x2d')],function(_0x2eeb4d){return{'name':_0x2eeb4d[_0xff28('0x2e')],'type':_0x2eeb4d[_0xff28('0x2f')][_0xff28('0x30')]};});_0x2dd9b7[_0xff28('0x31')]=_['map'](_0x2f096f,'name');_0x2dd9b7[_0xff28('0x32')]=_[_0xff28('0x33')](_0x5087fe[_0xff28('0x32')]);_0x2dd9b7[_0xff28('0x34')]=_[_0xff28('0x35')](_0x2dd9b7[_0xff28('0x31')],_0x2dd9b7[_0xff28('0x32')]);_0x20ee50[_0xff28('0x36')]=_[_0xff28('0x35')](_0x2dd9b7[_0xff28('0x31')],qs['fields'](_0x5087fe['query'][_0xff28('0x37')]));_0x20ee50[_0xff28('0x36')]=_0x20ee50[_0xff28('0x36')][_0xff28('0x38')]?_0x20ee50[_0xff28('0x36')]:_0x2dd9b7[_0xff28('0x31')];if(!_0x5087fe[_0xff28('0x32')][_0xff28('0x39')](_0xff28('0x3a'))){_0x20ee50['limit']=qs['limit'](_0x5087fe[_0xff28('0x32')][_0xff28('0x1c')]);_0x20ee50[_0xff28('0x1a')]=qs[_0xff28('0x1a')](_0x5087fe[_0xff28('0x32')][_0xff28('0x1a')]);}_0x20ee50[_0xff28('0x3b')]=qs[_0xff28('0x3c')](_0x5087fe['query'][_0xff28('0x3c')]);_0x20ee50[_0xff28('0x3d')]=qs[_0xff28('0x34')](_[_0xff28('0x3e')](_0x5087fe[_0xff28('0x32')],_0x2dd9b7[_0xff28('0x34')]),_0x2f096f);if(_0x5087fe['query'][_0xff28('0x3f')]){_0x20ee50[_0xff28('0x3d')]=_['merge'](_0x20ee50[_0xff28('0x3d')],{'$or':_[_0xff28('0x2b')](_0x2f096f,function(_0x4984c2){if(_0x4984c2[_0xff28('0x2f')]!==_0xff28('0x40')){var _0x109180={};_0x109180[_0x4984c2[_0xff28('0x41')]]={'$like':'%'+_0x5087fe[_0xff28('0x32')][_0xff28('0x3f')]+'%'};return _0x109180;}})});}_0x20ee50=_[_0xff28('0x42')]({},_0x20ee50,_0x5087fe['options']);var _0x551efd={'where':_0x20ee50[_0xff28('0x3d')]};return db[_0xff28('0x2c')][_0xff28('0x1d')](_0x551efd)[_0xff28('0x22')](function(_0x1e40bb){_0x19bd77['count']=_0x1e40bb;if(_0x5087fe[_0xff28('0x32')][_0xff28('0x43')]){_0x20ee50[_0xff28('0x44')]=[{'all':!![]}];}return db['SquareOdbc'][_0xff28('0x45')](_0x20ee50);})[_0xff28('0x22')](function(_0x53ffb5){_0x19bd77['rows']=_0x53ffb5;return _0x19bd77;})['then'](respondWithFilteredResult(_0xea8922,_0x20ee50))[_0xff28('0x46')](handleError(_0xea8922,null));};exports[_0xff28('0x47')]=function(_0x398969,_0x50d479){var _0x44ef3f={'raw':!![],'where':{'id':_0x398969[_0xff28('0x48')]['id']}},_0x41038e={};_0x41038e[_0xff28('0x31')]=_[_0xff28('0x33')](db[_0xff28('0x2c')][_0xff28('0x2d')]);_0x41038e[_0xff28('0x32')]=_[_0xff28('0x33')](_0x398969[_0xff28('0x32')]);_0x41038e['filters']=_[_0xff28('0x35')](_0x41038e[_0xff28('0x31')],_0x41038e['query']);_0x44ef3f[_0xff28('0x36')]=_[_0xff28('0x35')](_0x41038e[_0xff28('0x31')],qs[_0xff28('0x37')](_0x398969[_0xff28('0x32')][_0xff28('0x37')]));_0x44ef3f[_0xff28('0x36')]=_0x44ef3f[_0xff28('0x36')][_0xff28('0x38')]?_0x44ef3f[_0xff28('0x36')]:_0x41038e[_0xff28('0x31')];if(_0x398969[_0xff28('0x32')][_0xff28('0x43')]){_0x44ef3f[_0xff28('0x44')]=[{'all':!![]}];}_0x44ef3f=_[_0xff28('0x42')]({},_0x44ef3f,_0x398969[_0xff28('0x49')]);return db[_0xff28('0x2c')][_0xff28('0x4a')](_0x44ef3f)[_0xff28('0x22')](handleEntityNotFound(_0x50d479,null))[_0xff28('0x22')](respondWithResult(_0x50d479,null))[_0xff28('0x46')](handleError(_0x50d479,null));};exports[_0xff28('0x4b')]=function(_0x4fbe13,_0x56578a){return db[_0xff28('0x2c')][_0xff28('0x4b')](_0x4fbe13[_0xff28('0x4c')],{})[_0xff28('0x22')](function(_0x5d9dc7){var _0x4279c4=_0x4fbe13[_0xff28('0x4d')][_0xff28('0x24')]({'plain':!![]});if(!_0x4279c4)throw new Error(_0xff28('0x4e'));if(_0x4279c4['role']===_0xff28('0x4d')){var _0xd853f6=_0x5d9dc7['get']({'plain':!![]});var _0x376111='ODBC';return db[_0xff28('0x4f')][_0xff28('0x4a')]({'where':{'name':_0x376111,'userProfileId':_0x4279c4[_0xff28('0x50')]},'raw':!![]})[_0xff28('0x22')](function(_0x599b52){if(_0x599b52&&_0x599b52['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0xd853f6[_0xff28('0x41')],'resourceId':_0xd853f6['id'],'type':_0x599b52[_0xff28('0x41')],'sectionId':_0x599b52['id']},{})[_0xff28('0x22')](function(){return _0x5d9dc7;});}else{return _0x5d9dc7;}})[_0xff28('0x46')](function(_0x195a3e){logger[_0xff28('0x27')](_0xff28('0x51'),_0x195a3e);throw _0x195a3e;});}return _0x5d9dc7;})[_0xff28('0x22')](respondWithResult(_0x56578a,0xc9))[_0xff28('0x46')](handleError(_0x56578a,null));};exports[_0xff28('0x52')]=function(_0x56603b,_0x217dfe){if(_0x56603b[_0xff28('0x4c')]['id']){delete _0x56603b['body']['id'];}return db[_0xff28('0x2c')]['find']({'where':{'id':_0x56603b[_0xff28('0x48')]['id']}})['then'](handleEntityNotFound(_0x217dfe,null))['then'](saveUpdates(_0x56603b[_0xff28('0x4c')],null))[_0xff28('0x22')](respondWithResult(_0x217dfe,null))['catch'](handleError(_0x217dfe,null));};exports[_0xff28('0x23')]=function(_0x41b0e6,_0x3dbc37){return db['SquareOdbc'][_0xff28('0x4a')]({'where':{'id':_0x41b0e6[_0xff28('0x48')]['id']}})['then'](handleEntityNotFound(_0x3dbc37,null))[_0xff28('0x22')](removeEntity(_0x3dbc37,null))[_0xff28('0x46')](handleError(_0x3dbc37,null));};exports[_0xff28('0x53')]=function(_0x4d31a7,_0x3d10de,_0x54a4de){var _0x1bd302;return db['SquareOdbc']['find']({'where':{'id':_0x4d31a7[_0xff28('0x48')]['id']},'attributes':['id','dsn']})[_0xff28('0x22')](handleEntityNotFound(_0x3d10de,null))[_0xff28('0x22')](function(_0xbcbbef){if(_0xbcbbef){var _0x4f3398=require(_0xff28('0x54'))();_0x4f3398[_0xff28('0x55')](_0xbcbbef[_0xff28('0x56')]);_0x4f3398[_0xff28('0x57')]();return _0xbcbbef;}})[_0xff28('0x22')](respondWithResult(_0x3d10de,null))[_0xff28('0x46')](handleError(_0x3d10de,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a5718d4..799cbb8 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 _0x1dc9=['request-promise','rimraf','exports','define','square_odbc','util','../../config/logger','api','bluebird'];(function(_0x468378,_0x2c2a05){var _0x4e4d05=function(_0x260df9){while(--_0x260df9){_0x468378['push'](_0x468378['shift']());}};_0x4e4d05(++_0x2c2a05);}(_0x1dc9,0xd4));var _0x91dc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1dc9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x91dc('0x0'));var logger=require(_0x91dc('0x1'))(_0x91dc('0x2'));var moment=require('moment');var BPromise=require(_0x91dc('0x3'));var rp=require(_0x91dc('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x91dc('0x5'));var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x91dc('0x6')]=function(_0x1b15bf,_0x5c3ecc){return _0x1b15bf[_0x91dc('0x7')]('SquareOdbc',attributes,{'tableName':_0x91dc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf89b=['define','SquareOdbc','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf89b,0x157));var _0xbf89=function(_0x1f123d,_0x6efe9){_0x1f123d=_0x1f123d-0x0;var _0x1ab570=_0xf89b[_0x1f123d];return _0x1ab570;};'use strict';var _=require(_0xbf89('0x0'));var util=require(_0xbf89('0x1'));var logger=require('../../config/logger')(_0xbf89('0x2'));var moment=require(_0xbf89('0x3'));var BPromise=require(_0xbf89('0x4'));var rp=require(_0xbf89('0x5'));var fs=require('fs');var path=require(_0xbf89('0x6'));var rimraf=require('rimraf');var config=require(_0xbf89('0x7'));var attributes=require('./squareOdbc.attributes');module[_0xbf89('0x8')]=function(_0x49e25f,_0x1b09d6){return _0x49e25f[_0xbf89('0x9')](_0xbf89('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 7933a1f..2e6ef1d 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 _0x1529=['attributes','map','include','model','ShowSquareOdbc','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','find','options','raw'];(function(_0x37db9f,_0x4c93ed){var _0x48fb29=function(_0x5d27a4){while(--_0x5d27a4){_0x37db9f['push'](_0x37db9f['shift']());}};_0x48fb29(++_0x4c93ed);}(_0x1529,0x11c));var _0x9152=function(_0x2f4d41,_0x104d39){_0x2f4d41=_0x2f4d41-0x0;var _0x2197d1=_0x1529[_0x2f4d41];return _0x2197d1;};'use strict';var _=require('lodash');var util=require(_0x9152('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9152('0x1'));var fs=require('fs');var Redis=require(_0x9152('0x2'));var db=require(_0x9152('0x3'))['db'];var utils=require(_0x9152('0x4'));var logger=require(_0x9152('0x5'))(_0x9152('0x6'));var config=require(_0x9152('0x7'));var jayson=require(_0x9152('0x8'));var client=jayson[_0x9152('0x9')][_0x9152('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x132f81,_0x46279d,_0x8fcf36){return new BPromise(function(_0x130aa3,_0xb91fef){return client[_0x9152('0xb')](_0x132f81,_0x8fcf36)[_0x9152('0xc')](function(_0x3131ec){logger[_0x9152('0xd')](_0x9152('0xe'),_0x46279d,_0x9152('0xf'));logger[_0x9152('0x10')](_0x9152('0x11'),_0x46279d,_0x9152('0xf'),JSON[_0x9152('0x12')](_0x3131ec));if(_0x3131ec['error']){if(_0x3131ec[_0x9152('0x13')][_0x9152('0x14')]===0x1f4){logger[_0x9152('0x13')](_0x9152('0xe'),_0x46279d,_0x3131ec[_0x9152('0x13')][_0x9152('0x15')]);return _0xb91fef(_0x3131ec[_0x9152('0x13')][_0x9152('0x15')]);}logger[_0x9152('0x13')](_0x9152('0xe'),_0x46279d,_0x3131ec['error'][_0x9152('0x15')]);return _0x130aa3(_0x3131ec[_0x9152('0x13')][_0x9152('0x15')]);}else{logger[_0x9152('0xd')](_0x9152('0xe'),_0x46279d,_0x9152('0xf'));_0x130aa3(_0x3131ec['result'][_0x9152('0x15')]);}})[_0x9152('0x16')](function(_0x19bdab){logger[_0x9152('0x13')](_0x9152('0xe'),_0x46279d,_0x19bdab);_0xb91fef(_0x19bdab);});});}exports['ShowSquareOdbc']=function(_0xd7d2b0){var _0x4be11d=this;return new Promise(function(_0x50d89b,_0x12822b){return db['SquareOdbc'][_0x9152('0x17')]({'raw':_0xd7d2b0[_0x9152('0x18')]?_0xd7d2b0[_0x9152('0x18')][_0x9152('0x19')]===undefined?!![]:![]:!![],'where':_0xd7d2b0[_0x9152('0x18')]?_0xd7d2b0[_0x9152('0x18')]['where']||null:null,'attributes':_0xd7d2b0['options']?_0xd7d2b0[_0x9152('0x18')][_0x9152('0x1a')]||null:null,'include':_0xd7d2b0[_0x9152('0x18')]?_0xd7d2b0[_0x9152('0x18')]['include']?_[_0x9152('0x1b')](_0xd7d2b0[_0x9152('0x18')][_0x9152('0x1c')],function(_0x18575d){return{'model':db[_0x18575d[_0x9152('0x1d')]],'as':_0x18575d['as'],'attributes':_0x18575d['attributes'],'include':_0x18575d[_0x9152('0x1c')]?_[_0x9152('0x1b')](_0x18575d[_0x9152('0x1c')],function(_0x45c6de){return{'model':db[_0x45c6de['model']],'as':_0x45c6de['as'],'attributes':_0x45c6de['attributes'],'include':_0x45c6de['include']?_[_0x9152('0x1b')](_0x45c6de[_0x9152('0x1c')],function(_0x317562){return{'model':db[_0x317562['model']],'as':_0x317562['as'],'attributes':_0x317562['attributes']};}):[]};}):[]};}):[]:[]})[_0x9152('0xc')](function(_0x1954f7){logger[_0x9152('0xd')](_0x9152('0x1e'),_0xd7d2b0);logger[_0x9152('0x10')]('ShowSquareOdbc',_0xd7d2b0,JSON['stringify'](_0x1954f7));_0x50d89b(_0x1954f7);})[_0x9152('0x16')](function(_0x7e30e2){logger[_0x9152('0x13')](_0x9152('0x1e'),_0x7e30e2['message'],_0xd7d2b0);_0x12822b(_0x4be11d[_0x9152('0x13')](0x1f4,_0x7e30e2[_0x9152('0x15')]));});});}; \ No newline at end of file +var _0x944e=['debug','SquareOdbc,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','ShowSquareOdbc','SquareOdbc','options','raw','attributes','include','model','map','stringify','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent'];(function(_0x555e30,_0x4392cd){var _0x19eaac=function(_0x4b8b51){while(--_0x4b8b51){_0x555e30['push'](_0x555e30['shift']());}};_0x19eaac(++_0x4392cd);}(_0x944e,0xe2));var _0xe944=function(_0x589216,_0x4b5cda){_0x589216=_0x589216-0x0;var _0x38d4cd=_0x944e[_0x589216];return _0x38d4cd;};'use strict';var _=require('lodash');var util=require(_0xe944('0x0'));var moment=require('moment');var BPromise=require(_0xe944('0x1'));var rs=require(_0xe944('0x2'));var fs=require('fs');var Redis=require(_0xe944('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xe944('0x4'));var logger=require('../../config/logger')(_0xe944('0x5'));var config=require(_0xe944('0x6'));var jayson=require(_0xe944('0x7'));var client=jayson['client'][_0xe944('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30d6d1,_0x2d4394,_0x5f1c37){return new BPromise(function(_0x42e6ca,_0x3fb759){return client[_0xe944('0x9')](_0x30d6d1,_0x5f1c37)[_0xe944('0xa')](function(_0x2f7a99){logger[_0xe944('0xb')](_0xe944('0xc'),_0x2d4394,_0xe944('0xd'));logger[_0xe944('0xe')](_0xe944('0xf'),_0x2d4394,'request\x20sent',JSON['stringify'](_0x2f7a99));if(_0x2f7a99['error']){if(_0x2f7a99['error'][_0xe944('0x10')]===0x1f4){logger[_0xe944('0x11')](_0xe944('0xc'),_0x2d4394,_0x2f7a99[_0xe944('0x11')][_0xe944('0x12')]);return _0x3fb759(_0x2f7a99[_0xe944('0x11')][_0xe944('0x12')]);}logger['error'](_0xe944('0xc'),_0x2d4394,_0x2f7a99['error']['message']);return _0x42e6ca(_0x2f7a99['error'][_0xe944('0x12')]);}else{logger[_0xe944('0xb')](_0xe944('0xc'),_0x2d4394,_0xe944('0xd'));_0x42e6ca(_0x2f7a99[_0xe944('0x13')][_0xe944('0x12')]);}})[_0xe944('0x14')](function(_0x327102){logger[_0xe944('0x11')](_0xe944('0xc'),_0x2d4394,_0x327102);_0x3fb759(_0x327102);});});}exports[_0xe944('0x15')]=function(_0x3def5f){var _0x28332b=this;return new Promise(function(_0x2ab704,_0x46c2a0){return db[_0xe944('0x16')]['find']({'raw':_0x3def5f[_0xe944('0x17')]?_0x3def5f['options'][_0xe944('0x18')]===undefined?!![]:![]:!![],'where':_0x3def5f[_0xe944('0x17')]?_0x3def5f['options']['where']||null:null,'attributes':_0x3def5f[_0xe944('0x17')]?_0x3def5f['options'][_0xe944('0x19')]||null:null,'include':_0x3def5f[_0xe944('0x17')]?_0x3def5f['options'][_0xe944('0x1a')]?_['map'](_0x3def5f[_0xe944('0x17')][_0xe944('0x1a')],function(_0x374407){return{'model':db[_0x374407[_0xe944('0x1b')]],'as':_0x374407['as'],'attributes':_0x374407[_0xe944('0x19')],'include':_0x374407[_0xe944('0x1a')]?_[_0xe944('0x1c')](_0x374407[_0xe944('0x1a')],function(_0x5146da){return{'model':db[_0x5146da[_0xe944('0x1b')]],'as':_0x5146da['as'],'attributes':_0x5146da[_0xe944('0x19')],'include':_0x5146da[_0xe944('0x1a')]?_['map'](_0x5146da[_0xe944('0x1a')],function(_0x330161){return{'model':db[_0x330161[_0xe944('0x1b')]],'as':_0x330161['as'],'attributes':_0x330161[_0xe944('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c38ef){logger[_0xe944('0xb')](_0xe944('0x15'),_0x3def5f);logger[_0xe944('0xe')](_0xe944('0x15'),_0x3def5f,JSON[_0xe944('0x1d')](_0x1c38ef));_0x2ab704(_0x1c38ef);})[_0xe944('0x14')](function(_0x5bac72){logger['error'](_0xe944('0x15'),_0x5bac72[_0xe944('0x12')],_0x3def5f);_0x46c2a0(_0x28332b[_0xe944('0x11')](0x1f4,_0x5bac72[_0xe944('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 8ddb3d6..689f6f7 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 _0x3319=['index','/:id','show','create','put','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated'];(function(_0x527a96,_0x4472ae){var _0x39785b=function(_0x5e18a5){while(--_0x5e18a5){_0x527a96['push'](_0x527a96['shift']());}};_0x39785b(++_0x4472ae);}(_0x3319,0x97));var _0x9331=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x3319[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x9331('0x0'));var util=require(_0x9331('0x1'));var path=require(_0x9331('0x2'));var timeout=require('connect-timeout');var express=require(_0x9331('0x3'));var router=express[_0x9331('0x4')]();var fs_extra=require(_0x9331('0x5'));var auth=require(_0x9331('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x9331('0x7'));var controller=require(_0x9331('0x8'));router[_0x9331('0x9')]('/',auth[_0x9331('0xa')](),controller[_0x9331('0xb')]);router[_0x9331('0x9')](_0x9331('0xc'),auth[_0x9331('0xa')](),controller[_0x9331('0xd')]);router['post']('/',auth[_0x9331('0xa')](),controller[_0x9331('0xe')]);router[_0x9331('0xf')](_0x9331('0xc'),auth[_0x9331('0xa')](),controller[_0x9331('0x10')]);router['delete'](_0x9331('0xc'),auth[_0x9331('0xa')](),controller[_0x9331('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa50b=['../../config/environment','get','index','/:id','isAuthenticated','show','create','put','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x47ed1a,_0x34e1d8){var _0x23b059=function(_0xed7fa4){while(--_0xed7fa4){_0x47ed1a['push'](_0x47ed1a['shift']());}};_0x23b059(++_0x34e1d8);}(_0xa50b,0xba));var _0xba50=function(_0x45ccc2,_0x448d07){_0x45ccc2=_0x45ccc2-0x0;var _0x5e1836=_0xa50b[_0x45ccc2];return _0x5e1836;};'use strict';var multer=require(_0xba50('0x0'));var util=require(_0xba50('0x1'));var path=require('path');var timeout=require(_0xba50('0x2'));var express=require('express');var router=express[_0xba50('0x3')]();var fs_extra=require(_0xba50('0x4'));var auth=require(_0xba50('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xba50('0x6'));var controller=require('./squareProject.controller');router[_0xba50('0x7')]('/',auth['isAuthenticated'](),controller[_0xba50('0x8')]);router[_0xba50('0x7')](_0xba50('0x9'),auth[_0xba50('0xa')](),controller[_0xba50('0xb')]);router['post']('/',auth[_0xba50('0xa')](),controller[_0xba50('0xc')]);router[_0xba50('0xd')]('/:id',auth[_0xba50('0xa')](),controller['update']);router[_0xba50('0xe')]('/:id',auth[_0xba50('0xa')](),controller[_0xba50('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 846d014..1a3c49b 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 _0xe2a7=['preproduction','toString','utf8','production','DATE','sequelize','exports','name','STRING','BLOB','long'];(function(_0x5db5cd,_0x5353af){var _0x5c888a=function(_0x5543d7){while(--_0x5543d7){_0x5db5cd['push'](_0x5db5cd['shift']());}};_0x5c888a(++_0x5353af);}(_0xe2a7,0x12e));var _0x7e2a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2a7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7e2a('0x0'));module[_0x7e2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7e2a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x7e2a('0x3')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x7e2a('0x4')](_0x7e2a('0x5')),'get':function(){if(this['getDataValue'](_0x7e2a('0x6'))){return this['getDataValue']('preproduction')[_0x7e2a('0x7')](_0x7e2a('0x8'));}}},'production':{'type':Sequelize[_0x7e2a('0x4')](_0x7e2a('0x5')),'get':function(){if(this['getDataValue'](_0x7e2a('0x9'))){return this['getDataValue'](_0x7e2a('0x9'))[_0x7e2a('0x7')](_0x7e2a('0x8'));}}},'savedAt':{'type':Sequelize[_0x7e2a('0xa')]},'publishedAt':{'type':Sequelize[_0x7e2a('0xa')]}}; \ No newline at end of file +var _0x3dab=['long','production','DATE','sequelize','STRING','name','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x20e382,_0x17e68e){var _0xbac348=function(_0x2b1df6){while(--_0x2b1df6){_0x20e382['push'](_0x20e382['shift']());}};_0xbac348(++_0x17e68e);}(_0x3dab,0x1d7));var _0xb3da=function(_0x3050ec,_0x435c05){_0x3050ec=_0x3050ec-0x0;var _0x5563d9=_0x3dab[_0x3050ec];return _0x5563d9;};'use strict';var Sequelize=require(_0xb3da('0x0'));module['exports']={'name':{'type':Sequelize[_0xb3da('0x1')],'unique':_0xb3da('0x2'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xb3da('0x3')]},'preproduction':{'type':Sequelize[_0xb3da('0x4')]('long'),'get':function(){if(this[_0xb3da('0x5')](_0xb3da('0x6'))){return this['getDataValue'](_0xb3da('0x6'))[_0xb3da('0x7')](_0xb3da('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0xb3da('0x9')),'get':function(){if(this[_0xb3da('0x5')]('production')){return this[_0xb3da('0x5')](_0xb3da('0xa'))[_0xb3da('0x7')](_0xb3da('0x8'));}}},'savedAt':{'type':Sequelize[_0xb3da('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 1a48a1d..09fc8a9 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 _0x084e=['update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','end','error','stack','send','index','map','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','options','SquareProject','include','findAll','rows','catch','show','params','rawAttributes','fields','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','json','offset','limit','undefined','count','status','set','Content-Range'];(function(_0x1d081e,_0x42b074){var _0x5687e2=function(_0x43be51){while(--_0x43be51){_0x1d081e['push'](_0x1d081e['shift']());}};_0x5687e2(++_0x42b074);}(_0x084e,0x7a));var _0xe084=function(_0x31ed74,_0x96d0de){_0x31ed74=_0x31ed74-0x0;var _0x260f84=_0x084e[_0x31ed74];return _0x260f84;};'use strict';var _=require('lodash');var Redis=require(_0xe084('0x0'));var qs=require(_0xe084('0x1'));var logger=require(_0xe084('0x2'))(_0xe084('0x3'));var config=require(_0xe084('0x4'));var db=require(_0xe084('0x5'))['db'];config[_0xe084('0x6')]=_['defaults'](config[_0xe084('0x6')],{'host':_0xe084('0x7'),'port':0x18eb});var socket=require(_0xe084('0x8'))(new Redis(config[_0xe084('0x6')]));require('./squareProject.socket')[_0xe084('0x9')](socket);function respondWithResult(_0x143494,_0x264a82){_0x264a82=_0x264a82||0xc8;return function(_0x47c06f){if(_0x47c06f){return _0x143494['status'](_0x264a82)[_0xe084('0xa')](_0x47c06f);}};}function respondWithFilteredResult(_0x338e7d,_0x25297d){return function(_0x28c2a8){if(_0x28c2a8){var _0xce10cc=typeof _0x25297d[_0xe084('0xb')]==='undefined'&&typeof _0x25297d[_0xe084('0xc')]===_0xe084('0xd');var _0x626099=_0x28c2a8[_0xe084('0xe')];var _0x1dba6f=_0xce10cc?0x0:_0x25297d['offset'];var _0x71eea2=_0xce10cc?_0x28c2a8[_0xe084('0xe')]:_0x25297d[_0xe084('0xb')]+_0x25297d['limit'];var _0x4f321d;if(_0x71eea2>=_0x626099){_0x71eea2=_0x626099;_0x4f321d=0xc8;}else{_0x4f321d=0xce;}_0x338e7d[_0xe084('0xf')](_0x4f321d);return _0x338e7d[_0xe084('0x10')](_0xe084('0x11'),_0x1dba6f+'-'+_0x71eea2+'/'+_0x626099)['json'](_0x28c2a8);}return null;};}function saveUpdates(_0x406de0){return function(_0x1a6670){if(_0x1a6670){return _0x1a6670[_0xe084('0x12')](_0x406de0)[_0xe084('0x13')](function(_0x3dc130){return _0x3dc130;});}return null;};}function removeEntity(_0x36000c){return function(_0x1a7087){if(_0x1a7087){return _0x1a7087[_0xe084('0x14')]()[_0xe084('0x13')](function(){var _0x57b066=_0x1a7087[_0xe084('0x15')]({'plain':!![]});var _0x2e62a2=_0xe084('0x16');return db[_0xe084('0x17')][_0xe084('0x14')]({'where':{'type':_0x2e62a2,'resourceId':_0x57b066['id']}})[_0xe084('0x13')](function(){return _0x1a7087;});})['then'](function(){var _0xb5f094=new Redis(config[_0xe084('0x6')]);_0xb5f094['publish'](_0xe084('0x18'),JSON[_0xe084('0x19')]({'id':_0x1a7087['id'],'deleted':!![]}));})[_0xe084('0x13')](function(){_0x36000c['status'](0xcc)[_0xe084('0x1a')]();});}};}function handleEntityNotFound(_0x21c7c4){return function(_0x5b128d){if(!_0x5b128d){_0x21c7c4['sendStatus'](0x194);}return _0x5b128d;};}function handleError(_0x4a2dbd,_0x39845a){_0x39845a=_0x39845a||0x1f4;return function(_0x2bad83){logger[_0xe084('0x1b')](_0x2bad83[_0xe084('0x1c')]);if(_0x2bad83['name']){delete _0x2bad83['name'];}_0x4a2dbd[_0xe084('0xf')](_0x39845a)[_0xe084('0x1d')](_0x2bad83);};}exports[_0xe084('0x1e')]=function(_0x2a2963,_0x9f3124){var _0x51963f={},_0xdf0477={},_0x3ff6d5={'count':0x0,'rows':[]};var _0x1c760d=_[_0xe084('0x1f')](db['SquareProject']['rawAttributes'],function(_0x1c0c39){return{'name':_0x1c0c39['fieldName'],'type':_0x1c0c39[_0xe084('0x20')][_0xe084('0x21')]};});_0xdf0477[_0xe084('0x22')]=_[_0xe084('0x1f')](_0x1c760d,_0xe084('0x23'));_0xdf0477[_0xe084('0x24')]=_[_0xe084('0x25')](_0x2a2963[_0xe084('0x24')]);_0xdf0477['filters']=_[_0xe084('0x26')](_0xdf0477['model'],_0xdf0477[_0xe084('0x24')]);_0x51963f[_0xe084('0x27')]=_[_0xe084('0x26')](_0xdf0477[_0xe084('0x22')],qs['fields'](_0x2a2963[_0xe084('0x24')]['fields']));_0x51963f['attributes']=_0x51963f[_0xe084('0x27')][_0xe084('0x28')]?_0x51963f[_0xe084('0x27')]:_0xdf0477['model'];if(!_0x2a2963[_0xe084('0x24')][_0xe084('0x29')](_0xe084('0x2a'))){_0x51963f[_0xe084('0xc')]=qs[_0xe084('0xc')](_0x2a2963['query']['limit']);_0x51963f['offset']=qs['offset'](_0x2a2963['query']['offset']);}_0x51963f[_0xe084('0x2b')]=qs[_0xe084('0x2c')](_0x2a2963[_0xe084('0x24')][_0xe084('0x2c')]);_0x51963f[_0xe084('0x2d')]=qs[_0xe084('0x2e')](_['pick'](_0x2a2963[_0xe084('0x24')],_0xdf0477[_0xe084('0x2e')]),_0x1c760d);if(_0x2a2963[_0xe084('0x24')][_0xe084('0x2f')]){_0x51963f[_0xe084('0x2d')]=_['merge'](_0x51963f[_0xe084('0x2d')],{'$or':_[_0xe084('0x1f')](_0x1c760d,function(_0x416fba){if(_0x416fba[_0xe084('0x20')]!==_0xe084('0x30')){var _0x35d79={};_0x35d79[_0x416fba['name']]={'$like':'%'+_0x2a2963[_0xe084('0x24')][_0xe084('0x2f')]+'%'};return _0x35d79;}})});}_0x51963f=_[_0xe084('0x31')]({},_0x51963f,_0x2a2963[_0xe084('0x32')]);var _0x1595f3={'where':_0x51963f[_0xe084('0x2d')]};return db[_0xe084('0x33')][_0xe084('0xe')](_0x1595f3)[_0xe084('0x13')](function(_0x2e83d4){_0x3ff6d5[_0xe084('0xe')]=_0x2e83d4;if(_0x2a2963[_0xe084('0x24')]['includeAll']){_0x51963f[_0xe084('0x34')]=[{'all':!![]}];}return db['SquareProject'][_0xe084('0x35')](_0x51963f);})[_0xe084('0x13')](function(_0x46a880){_0x3ff6d5[_0xe084('0x36')]=_0x46a880;return _0x3ff6d5;})[_0xe084('0x13')](respondWithFilteredResult(_0x9f3124,_0x51963f))[_0xe084('0x37')](handleError(_0x9f3124,null));};exports[_0xe084('0x38')]=function(_0x50ba8f,_0x43f2b5){var _0x284792={'raw':![],'where':{'id':_0x50ba8f[_0xe084('0x39')]['id']}},_0x83be47={};_0x83be47[_0xe084('0x22')]=_[_0xe084('0x25')](db[_0xe084('0x33')][_0xe084('0x3a')]);_0x83be47[_0xe084('0x24')]=_[_0xe084('0x25')](_0x50ba8f[_0xe084('0x24')]);_0x83be47[_0xe084('0x2e')]=_[_0xe084('0x26')](_0x83be47[_0xe084('0x22')],_0x83be47[_0xe084('0x24')]);_0x284792['attributes']=_['intersection'](_0x83be47[_0xe084('0x22')],qs[_0xe084('0x3b')](_0x50ba8f[_0xe084('0x24')][_0xe084('0x3b')]));_0x284792[_0xe084('0x27')]=_0x284792['attributes'][_0xe084('0x28')]?_0x284792[_0xe084('0x27')]:_0x83be47['model'];if(_0x50ba8f['query']['includeAll']){_0x284792[_0xe084('0x34')]=[{'all':!![]}];}_0x284792=_[_0xe084('0x31')]({},_0x284792,_0x50ba8f['options']);return db[_0xe084('0x33')]['find'](_0x284792)[_0xe084('0x13')](handleEntityNotFound(_0x43f2b5,null))[_0xe084('0x13')](respondWithResult(_0x43f2b5,null))[_0xe084('0x37')](handleError(_0x43f2b5,null));};exports['create']=function(_0x2ec069,_0x1f0ad7){return db['SquareProject'][_0xe084('0x3c')](_0x2ec069[_0xe084('0x3d')],{})[_0xe084('0x13')](function(_0x18614f){var _0x2e66e1=_0x2ec069['user']['get']({'plain':!![]});if(!_0x2e66e1)throw new Error(_0xe084('0x3e'));if(_0x2e66e1[_0xe084('0x3f')]==='user'){var _0x2ab221=_0x18614f[_0xe084('0x15')]({'plain':!![]});var _0x4e95e3=_0xe084('0x16');return db[_0xe084('0x40')][_0xe084('0x41')]({'where':{'name':_0x4e95e3,'userProfileId':_0x2e66e1[_0xe084('0x42')]},'raw':!![]})['then'](function(_0x37bed4){if(_0x37bed4&&_0x37bed4[_0xe084('0x43')]===0x0){return db['UserProfileResource'][_0xe084('0x3c')]({'name':_0x2ab221[_0xe084('0x23')],'resourceId':_0x2ab221['id'],'type':_0x37bed4[_0xe084('0x23')],'sectionId':_0x37bed4['id']},{})[_0xe084('0x13')](function(){return _0x18614f;});}else{return _0x18614f;}})[_0xe084('0x37')](function(_0x6f4a14){logger['error'](_0xe084('0x44'),_0x6f4a14);throw _0x6f4a14;});}return _0x18614f;})[_0xe084('0x13')](respondWithResult(_0x1f0ad7,0xc9))[_0xe084('0x37')](handleError(_0x1f0ad7,null));};exports[_0xe084('0x12')]=function(_0x169f23,_0x517646){if(_0x169f23[_0xe084('0x3d')]['id']){delete _0x169f23['body']['id'];}return db[_0xe084('0x33')][_0xe084('0x41')]({'where':{'id':_0x169f23['params']['id']}})[_0xe084('0x13')](handleEntityNotFound(_0x517646,null))[_0xe084('0x13')](saveUpdates(_0x169f23[_0xe084('0x3d')],null))['then'](function(_0xe678be){if(!_0xe678be)return;var _0x54e827=_0xe678be[_0xe084('0x15')]({'plain':!![]});return _0x54e827;})[_0xe084('0x13')](function(_0x3d8d07){var _0x11d497=new Redis(config[_0xe084('0x6')]);_0x11d497['publish'](_0xe084('0x18'),JSON[_0xe084('0x19')](_[_0xe084('0x45')](_0x3d8d07,['id',_0xe084('0x23'),'production'])));return _0x3d8d07;})['then'](respondWithResult(_0x517646,null))['catch'](handleError(_0x517646,null));};exports['destroy']=function(_0x216fea,_0x131e22){return db[_0xe084('0x33')][_0xe084('0x41')]({'where':{'id':_0x216fea[_0xe084('0x39')]['id']}})[_0xe084('0x13')](handleEntityNotFound(_0x131e22,null))[_0xe084('0x13')](removeEntity(_0x131e22,null))[_0xe084('0x37')](handleError(_0x131e22,null));}; \ No newline at end of file +var _0xe2e9=['limit','count','set','Content-Range','json','update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','end','error','name','send','index','map','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','SquareProject','findAll','rows','catch','params','keys','rawAttributes','length','includeAll','include','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','publish','pick','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','register','status','offset','undefined'];(function(_0x3e5738,_0x24f9ef){var _0x3b0401=function(_0x36ded8){while(--_0x36ded8){_0x3e5738['push'](_0x3e5738['shift']());}};_0x3b0401(++_0x24f9ef);}(_0xe2e9,0x151));var _0x9e2e=function(_0x4c8057,_0x17b448){_0x4c8057=_0x4c8057-0x0;var _0x337627=_0xe2e9[_0x4c8057];return _0x337627;};'use strict';var _=require(_0x9e2e('0x0'));var Redis=require(_0x9e2e('0x1'));var qs=require(_0x9e2e('0x2'));var logger=require(_0x9e2e('0x3'))(_0x9e2e('0x4'));var config=require('../../config/environment');var db=require(_0x9e2e('0x5'))['db'];config[_0x9e2e('0x6')]=_[_0x9e2e('0x7')](config[_0x9e2e('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x9e2e('0x8'))(new Redis(config[_0x9e2e('0x6')]));require('./squareProject.socket')[_0x9e2e('0x9')](socket);function respondWithResult(_0x47c90e,_0x3b29d6){_0x3b29d6=_0x3b29d6||0xc8;return function(_0x34499a){if(_0x34499a){return _0x47c90e[_0x9e2e('0xa')](_0x3b29d6)['json'](_0x34499a);}};}function respondWithFilteredResult(_0x28ece9,_0x3ad2f9){return function(_0x23f460){if(_0x23f460){var _0x3131a3=typeof _0x3ad2f9[_0x9e2e('0xb')]===_0x9e2e('0xc')&&typeof _0x3ad2f9[_0x9e2e('0xd')]===_0x9e2e('0xc');var _0xa172f4=_0x23f460[_0x9e2e('0xe')];var _0x35b794=_0x3131a3?0x0:_0x3ad2f9['offset'];var _0x147706=_0x3131a3?_0x23f460['count']:_0x3ad2f9[_0x9e2e('0xb')]+_0x3ad2f9[_0x9e2e('0xd')];var _0xe4e0d5;if(_0x147706>=_0xa172f4){_0x147706=_0xa172f4;_0xe4e0d5=0xc8;}else{_0xe4e0d5=0xce;}_0x28ece9[_0x9e2e('0xa')](_0xe4e0d5);return _0x28ece9[_0x9e2e('0xf')](_0x9e2e('0x10'),_0x35b794+'-'+_0x147706+'/'+_0xa172f4)[_0x9e2e('0x11')](_0x23f460);}return null;};}function saveUpdates(_0x3468ac){return function(_0x1af7f8){if(_0x1af7f8){return _0x1af7f8[_0x9e2e('0x12')](_0x3468ac)[_0x9e2e('0x13')](function(_0x3a76a0){return _0x3a76a0;});}return null;};}function removeEntity(_0x467a92){return function(_0x3828a0){if(_0x3828a0){return _0x3828a0[_0x9e2e('0x14')]()[_0x9e2e('0x13')](function(){var _0xd9ed82=_0x3828a0[_0x9e2e('0x15')]({'plain':!![]});var _0x5d1f4b=_0x9e2e('0x16');return db[_0x9e2e('0x17')]['destroy']({'where':{'type':_0x5d1f4b,'resourceId':_0xd9ed82['id']}})['then'](function(){return _0x3828a0;});})[_0x9e2e('0x13')](function(){var _0x1eff85=new Redis(config[_0x9e2e('0x6')]);_0x1eff85['publish'](_0x9e2e('0x18'),JSON[_0x9e2e('0x19')]({'id':_0x3828a0['id'],'deleted':!![]}));})[_0x9e2e('0x13')](function(){_0x467a92[_0x9e2e('0xa')](0xcc)[_0x9e2e('0x1a')]();});}};}function handleEntityNotFound(_0x454ddc){return function(_0x50f598){if(!_0x50f598){_0x454ddc['sendStatus'](0x194);}return _0x50f598;};}function handleError(_0x31c7d5,_0x392e67){_0x392e67=_0x392e67||0x1f4;return function(_0x19d722){logger[_0x9e2e('0x1b')](_0x19d722['stack']);if(_0x19d722[_0x9e2e('0x1c')]){delete _0x19d722[_0x9e2e('0x1c')];}_0x31c7d5[_0x9e2e('0xa')](_0x392e67)[_0x9e2e('0x1d')](_0x19d722);};}exports[_0x9e2e('0x1e')]=function(_0x42a0f5,_0x1868e6){var _0x257410={},_0x583f3c={},_0x1192a4={'count':0x0,'rows':[]};var _0x39c4ae=_[_0x9e2e('0x1f')](db['SquareProject']['rawAttributes'],function(_0x4f3ef5){return{'name':_0x4f3ef5['fieldName'],'type':_0x4f3ef5[_0x9e2e('0x20')]['key']};});_0x583f3c[_0x9e2e('0x21')]=_['map'](_0x39c4ae,_0x9e2e('0x1c'));_0x583f3c[_0x9e2e('0x22')]=_['keys'](_0x42a0f5[_0x9e2e('0x22')]);_0x583f3c[_0x9e2e('0x23')]=_['intersection'](_0x583f3c['model'],_0x583f3c[_0x9e2e('0x22')]);_0x257410[_0x9e2e('0x24')]=_[_0x9e2e('0x25')](_0x583f3c[_0x9e2e('0x21')],qs[_0x9e2e('0x26')](_0x42a0f5[_0x9e2e('0x22')]['fields']));_0x257410[_0x9e2e('0x24')]=_0x257410['attributes']['length']?_0x257410[_0x9e2e('0x24')]:_0x583f3c[_0x9e2e('0x21')];if(!_0x42a0f5[_0x9e2e('0x22')][_0x9e2e('0x27')](_0x9e2e('0x28'))){_0x257410['limit']=qs['limit'](_0x42a0f5[_0x9e2e('0x22')][_0x9e2e('0xd')]);_0x257410['offset']=qs['offset'](_0x42a0f5[_0x9e2e('0x22')][_0x9e2e('0xb')]);}_0x257410['order']=qs['sort'](_0x42a0f5[_0x9e2e('0x22')][_0x9e2e('0x29')]);_0x257410[_0x9e2e('0x2a')]=qs[_0x9e2e('0x23')](_['pick'](_0x42a0f5[_0x9e2e('0x22')],_0x583f3c[_0x9e2e('0x23')]),_0x39c4ae);if(_0x42a0f5['query'][_0x9e2e('0x2b')]){_0x257410[_0x9e2e('0x2a')]=_[_0x9e2e('0x2c')](_0x257410[_0x9e2e('0x2a')],{'$or':_['map'](_0x39c4ae,function(_0x805d70){if(_0x805d70[_0x9e2e('0x20')]!==_0x9e2e('0x2d')){var _0x3a6dfb={};_0x3a6dfb[_0x805d70[_0x9e2e('0x1c')]]={'$like':'%'+_0x42a0f5[_0x9e2e('0x22')][_0x9e2e('0x2b')]+'%'};return _0x3a6dfb;}})});}_0x257410=_[_0x9e2e('0x2c')]({},_0x257410,_0x42a0f5[_0x9e2e('0x2e')]);var _0x598467={'where':_0x257410[_0x9e2e('0x2a')]};return db['SquareProject']['count'](_0x598467)[_0x9e2e('0x13')](function(_0x1dc9bc){_0x1192a4[_0x9e2e('0xe')]=_0x1dc9bc;if(_0x42a0f5['query']['includeAll']){_0x257410['include']=[{'all':!![]}];}return db[_0x9e2e('0x2f')][_0x9e2e('0x30')](_0x257410);})[_0x9e2e('0x13')](function(_0xf75af){_0x1192a4[_0x9e2e('0x31')]=_0xf75af;return _0x1192a4;})[_0x9e2e('0x13')](respondWithFilteredResult(_0x1868e6,_0x257410))[_0x9e2e('0x32')](handleError(_0x1868e6,null));};exports['show']=function(_0x1e9a14,_0x55ee22){var _0x11faaf={'raw':![],'where':{'id':_0x1e9a14[_0x9e2e('0x33')]['id']}},_0x3c3907={};_0x3c3907['model']=_[_0x9e2e('0x34')](db[_0x9e2e('0x2f')][_0x9e2e('0x35')]);_0x3c3907['query']=_[_0x9e2e('0x34')](_0x1e9a14[_0x9e2e('0x22')]);_0x3c3907[_0x9e2e('0x23')]=_[_0x9e2e('0x25')](_0x3c3907[_0x9e2e('0x21')],_0x3c3907[_0x9e2e('0x22')]);_0x11faaf[_0x9e2e('0x24')]=_[_0x9e2e('0x25')](_0x3c3907[_0x9e2e('0x21')],qs[_0x9e2e('0x26')](_0x1e9a14['query'][_0x9e2e('0x26')]));_0x11faaf['attributes']=_0x11faaf[_0x9e2e('0x24')][_0x9e2e('0x36')]?_0x11faaf['attributes']:_0x3c3907[_0x9e2e('0x21')];if(_0x1e9a14['query'][_0x9e2e('0x37')]){_0x11faaf[_0x9e2e('0x38')]=[{'all':!![]}];}_0x11faaf=_[_0x9e2e('0x2c')]({},_0x11faaf,_0x1e9a14[_0x9e2e('0x2e')]);return db[_0x9e2e('0x2f')][_0x9e2e('0x39')](_0x11faaf)[_0x9e2e('0x13')](handleEntityNotFound(_0x55ee22,null))['then'](respondWithResult(_0x55ee22,null))['catch'](handleError(_0x55ee22,null));};exports['create']=function(_0x597e82,_0xf5b2ca){return db[_0x9e2e('0x2f')][_0x9e2e('0x3a')](_0x597e82['body'],{})['then'](function(_0x587498){var _0x68be77=_0x597e82[_0x9e2e('0x3b')][_0x9e2e('0x15')]({'plain':!![]});if(!_0x68be77)throw new Error(_0x9e2e('0x3c'));if(_0x68be77[_0x9e2e('0x3d')]===_0x9e2e('0x3b')){var _0x50393d=_0x587498['get']({'plain':!![]});var _0xe45c44=_0x9e2e('0x16');return db[_0x9e2e('0x3e')][_0x9e2e('0x39')]({'where':{'name':_0xe45c44,'userProfileId':_0x68be77[_0x9e2e('0x3f')]},'raw':!![]})[_0x9e2e('0x13')](function(_0x5d1f58){if(_0x5d1f58&&_0x5d1f58[_0x9e2e('0x40')]===0x0){return db[_0x9e2e('0x17')]['create']({'name':_0x50393d[_0x9e2e('0x1c')],'resourceId':_0x50393d['id'],'type':_0x5d1f58['name'],'sectionId':_0x5d1f58['id']},{})[_0x9e2e('0x13')](function(){return _0x587498;});}else{return _0x587498;}})[_0x9e2e('0x32')](function(_0x5a7b8e){logger[_0x9e2e('0x1b')](_0x9e2e('0x41'),_0x5a7b8e);throw _0x5a7b8e;});}return _0x587498;})['then'](respondWithResult(_0xf5b2ca,0xc9))[_0x9e2e('0x32')](handleError(_0xf5b2ca,null));};exports[_0x9e2e('0x12')]=function(_0x4b413a,_0x37691a){if(_0x4b413a[_0x9e2e('0x42')]['id']){delete _0x4b413a['body']['id'];}return db['SquareProject'][_0x9e2e('0x39')]({'where':{'id':_0x4b413a[_0x9e2e('0x33')]['id']}})[_0x9e2e('0x13')](handleEntityNotFound(_0x37691a,null))[_0x9e2e('0x13')](saveUpdates(_0x4b413a[_0x9e2e('0x42')],null))[_0x9e2e('0x13')](function(_0x39b83b){if(!_0x39b83b)return;var _0x20320f=_0x39b83b['get']({'plain':!![]});return _0x20320f;})[_0x9e2e('0x13')](function(_0x1ad8f6){var _0x4c89b0=new Redis(config[_0x9e2e('0x6')]);_0x4c89b0[_0x9e2e('0x43')](_0x9e2e('0x18'),JSON['stringify'](_[_0x9e2e('0x44')](_0x1ad8f6,['id',_0x9e2e('0x1c'),_0x9e2e('0x45')])));return _0x1ad8f6;})[_0x9e2e('0x13')](respondWithResult(_0x37691a,null))[_0x9e2e('0x32')](handleError(_0x37691a,null));};exports['destroy']=function(_0x719422,_0x1837b8){return db[_0x9e2e('0x2f')][_0x9e2e('0x39')]({'where':{'id':_0x719422['params']['id']}})[_0x9e2e('0x13')](handleEntityNotFound(_0x1837b8,null))[_0x9e2e('0x13')](removeEntity(_0x1837b8,null))[_0x9e2e('0x32')](handleError(_0x1837b8,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 4482d59..4d4472b 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 _0xe467=['events','../../mysqldb','SquareProject','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x81a08d,_0x44efda){var _0x5acff3=function(_0x2131b9){while(--_0x2131b9){_0x81a08d['push'](_0x81a08d['shift']());}};_0x5acff3(++_0x44efda);}(_0xe467,0xe1));var _0x7e46=function(_0x1a45e3,_0x385589){_0x1a45e3=_0x1a45e3-0x0;var _0x3615f8=_0xe467[_0x1a45e3];return _0x3615f8;};'use strict';var EventEmitter=require(_0x7e46('0x0'));var SquareProject=require(_0x7e46('0x1'))['db'][_0x7e46('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x7e46('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7e46('0x4'),'afterDestroy':_0x7e46('0x5')};function emitEvent(_0x90a463){return function(_0x2f9c7e,_0x4b122d,_0x4b5532){SquareProjectEvents[_0x7e46('0x6')](_0x90a463+':'+_0x2f9c7e['id'],_0x2f9c7e);SquareProjectEvents[_0x7e46('0x6')](_0x90a463,_0x2f9c7e);_0x4b5532(null);};}for(var e in events){if(events[_0x7e46('0x7')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0x7e46('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0xb8ea=['events','SquareProject','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x15cba7,_0x457f3f){var _0x375806=function(_0x293518){while(--_0x293518){_0x15cba7['push'](_0x15cba7['shift']());}};_0x375806(++_0x457f3f);}(_0xb8ea,0x68));var _0xab8e=function(_0x3530c6,_0x17880e){_0x3530c6=_0x3530c6-0x0;var _0x304a09=_0xb8ea[_0x3530c6];return _0x304a09;};'use strict';var EventEmitter=require(_0xab8e('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xab8e('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xab8e('0x2')](0x0);var events={'afterCreate':_0xab8e('0x3'),'afterUpdate':'update','afterDestroy':_0xab8e('0x4')};function emitEvent(_0x4a0cca){return function(_0x10e2b4,_0x1134e5,_0x404398){SquareProjectEvents[_0xab8e('0x5')](_0x4a0cca+':'+_0x10e2b4['id'],_0x10e2b4);SquareProjectEvents[_0xab8e('0x5')](_0x4a0cca,_0x10e2b4);_0x404398(null);};}for(var e in events){if(events[_0xab8e('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xab8e('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 3a2e0a3..20fc901 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 _0x08a6=['../../config/environment','exports','define','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','../../config/logger','bluebird','path'];(function(_0x574394,_0x49d75f){var _0x93a092=function(_0x1bcaf2){while(--_0x1bcaf2){_0x574394['push'](_0x574394['shift']());}};_0x93a092(++_0x49d75f);}(_0x08a6,0x131));var _0x608a=function(_0x4b1bb0,_0x7dc32b){_0x4b1bb0=_0x4b1bb0-0x0;var _0x549407=_0x08a6[_0x4b1bb0];return _0x549407;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x608a('0x0'))('api');var moment=require('moment');var BPromise=require(_0x608a('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x608a('0x2'));var rimraf=require('rimraf');var config=require(_0x608a('0x3'));var attributes=require('./squareProject.attributes');module[_0x608a('0x4')]=function(_0x5c5362,_0x3d8458){return _0x5c5362[_0x608a('0x5')]('SquareProject',attributes,{'tableName':_0x608a('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d2e12,_0x54dfb9,_0x46375b){if(_0x4d2e12[_0x608a('0x7')](_0x608a('0x8'))){_0x4d2e12[_0x608a('0x9')]=moment()[_0x608a('0xa')](_0x608a('0xb'));}if(_0x4d2e12[_0x608a('0x7')](_0x608a('0xc'))){_0x4d2e12[_0x608a('0xd')]=moment()[_0x608a('0xa')](_0x608a('0xb'));}_0x46375b(null,_0x4d2e12);}}});}; \ No newline at end of file +var _0xaf75=['define','SquareProject','changed','preproduction','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0xbc4560,_0x4020b8){var _0x298cfb=function(_0x254423){while(--_0x254423){_0xbc4560['push'](_0xbc4560['shift']());}};_0x298cfb(++_0x4020b8);}(_0xaf75,0xc3));var _0x5af7=function(_0x14acc7,_0x3ba62b){_0x14acc7=_0x14acc7-0x0;var _0xfcbb2b=_0xaf75[_0x14acc7];return _0xfcbb2b;};'use strict';var _=require(_0x5af7('0x0'));var util=require(_0x5af7('0x1'));var logger=require(_0x5af7('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5af7('0x3'));var rp=require(_0x5af7('0x4'));var fs=require('fs');var path=require(_0x5af7('0x5'));var rimraf=require(_0x5af7('0x6'));var config=require(_0x5af7('0x7'));var attributes=require('./squareProject.attributes');module[_0x5af7('0x8')]=function(_0x22e41d,_0x4ee118){return _0x22e41d[_0x5af7('0x9')](_0x5af7('0xa'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x252379,_0x5022f5,_0xcbbb71){if(_0x252379[_0x5af7('0xb')](_0x5af7('0xc'))){_0x252379['savedAt']=moment()[_0x5af7('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x252379[_0x5af7('0xb')](_0x5af7('0xe'))){_0x252379[_0x5af7('0xf')]=moment()[_0x5af7('0xd')](_0x5af7('0x10'));}_0xcbbb71(null,_0x252379);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index ae8bb78..90ad9c8 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 _0x44cc=['attributes','then','info','GetSquareProjects','debug','error','message','ShowSquareProject','raw','stringify','catch','lodash','../../config/logger','rpc','redis','defaults','localhost','./squareProject.socket','register','SquareProject','findAll','options','limit','include','map','model'];(function(_0x277721,_0x46971e){var _0x286051=function(_0x130c98){while(--_0x130c98){_0x277721['push'](_0x277721['shift']());}};_0x286051(++_0x46971e);}(_0x44cc,0x73));var _0xc44c=function(_0xc5225a,_0x3f24fe){_0xc5225a=_0xc5225a-0x0;var _0x36352a=_0x44cc[_0xc5225a];return _0x36352a;};'use strict';var _=require(_0xc44c('0x0'));var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var logger=require(_0xc44c('0x1'))(_0xc44c('0x2'));var config=require('../../config/environment');config[_0xc44c('0x3')]=_[_0xc44c('0x4')](config[_0xc44c('0x3')],{'host':_0xc44c('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc44c('0x6'))[_0xc44c('0x7')](socket);exports['GetSquareProjects']=function(_0x49ce6a){var _0x55deca=this;return new Promise(function(_0x100cd4,_0x37546a){return db[_0xc44c('0x8')][_0xc44c('0x9')]({'raw':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')]['raw']===undefined?!![]:![]:!![],'where':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a['options']['where']||null:null,'attributes':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')]['attributes']||null:null,'limit':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')][_0xc44c('0xb')]||null:null,'include':_0x49ce6a[_0xc44c('0xa')]?_0x49ce6a[_0xc44c('0xa')][_0xc44c('0xc')]?_[_0xc44c('0xd')](_0x49ce6a['options'][_0xc44c('0xc')],function(_0x5b9828){return{'model':db[_0x5b9828[_0xc44c('0xe')]],'as':_0x5b9828['as'],'attributes':_0x5b9828[_0xc44c('0xf')],'include':_0x5b9828['include']?_[_0xc44c('0xd')](_0x5b9828['include'],function(_0x3c9c74){return{'model':db[_0x3c9c74[_0xc44c('0xe')]],'as':_0x3c9c74['as'],'attributes':_0x3c9c74[_0xc44c('0xf')],'include':_0x3c9c74[_0xc44c('0xc')]?_[_0xc44c('0xd')](_0x3c9c74[_0xc44c('0xc')],function(_0x280df6){return{'model':db[_0x280df6['model']],'as':_0x280df6['as'],'attributes':_0x280df6[_0xc44c('0xf')]};}):[]};}):[]};}):[]:[]})[_0xc44c('0x10')](function(_0x3e1116){logger[_0xc44c('0x11')](_0xc44c('0x12'),_0x49ce6a);logger[_0xc44c('0x13')]('GetSquareProjects',_0x49ce6a,JSON['stringify'](_0x3e1116));_0x100cd4(_0x3e1116);})['catch'](function(_0x30d75c){logger[_0xc44c('0x14')]('GetSquareProjects',_0x30d75c[_0xc44c('0x15')],_0x49ce6a);_0x37546a(_0x55deca[_0xc44c('0x14')](0x1f4,_0x30d75c[_0xc44c('0x15')]));});});};exports[_0xc44c('0x16')]=function(_0x1f07a7){var _0x2913bc=this;return new Promise(function(_0x30426f,_0x352d21){return db['SquareProject']['find']({'raw':_0x1f07a7[_0xc44c('0xa')]?_0x1f07a7['options'][_0xc44c('0x17')]===undefined?!![]:![]:!![],'where':_0x1f07a7[_0xc44c('0xa')]?_0x1f07a7[_0xc44c('0xa')]['where']||null:null,'attributes':_0x1f07a7['options']?_0x1f07a7[_0xc44c('0xa')][_0xc44c('0xf')]||null:null,'include':_0x1f07a7[_0xc44c('0xa')]?_0x1f07a7['options'][_0xc44c('0xc')]?_['map'](_0x1f07a7[_0xc44c('0xa')][_0xc44c('0xc')],function(_0x225252){return{'model':db[_0x225252['model']],'as':_0x225252['as'],'attributes':_0x225252[_0xc44c('0xf')],'include':_0x225252[_0xc44c('0xc')]?_[_0xc44c('0xd')](_0x225252[_0xc44c('0xc')],function(_0xb2ce7c){return{'model':db[_0xb2ce7c[_0xc44c('0xe')]],'as':_0xb2ce7c['as'],'attributes':_0xb2ce7c[_0xc44c('0xf')],'include':_0xb2ce7c['include']?_[_0xc44c('0xd')](_0xb2ce7c[_0xc44c('0xc')],function(_0x1ba7bc){return{'model':db[_0x1ba7bc[_0xc44c('0xe')]],'as':_0x1ba7bc['as'],'attributes':_0x1ba7bc['attributes']};}):[]};}):[]};}):[]:[]})[_0xc44c('0x10')](function(_0x4f3771){logger['info'](_0xc44c('0x16'),_0x1f07a7);logger['debug']('ShowSquareProject',_0x1f07a7,JSON[_0xc44c('0x18')](_0x4f3771));_0x30426f(_0x4f3771);})[_0xc44c('0x19')](function(_0x57d4f9){logger[_0xc44c('0x14')]('ShowSquareProject',_0x57d4f9[_0xc44c('0x15')],_0x1f07a7);_0x352d21(_0x2913bc[_0xc44c('0x14')](0x1f4,_0x57d4f9[_0xc44c('0x15')]));});});}; \ No newline at end of file +var _0x2986=['GetSquareProjects','SquareProject','findAll','options','limit','include','map','attributes','model','info','catch','error','message','find','raw','where','then','ShowSquareProject','debug','../../mysqldb','rpc','redis','localhost','./squareProject.socket','register'];(function(_0x1a4f6d,_0x39a399){var _0xc9a618=function(_0x3d23c2){while(--_0x3d23c2){_0x1a4f6d['push'](_0x1a4f6d['shift']());}};_0xc9a618(++_0x39a399);}(_0x2986,0x1a3));var _0x6298=function(_0xca79a3,_0x17e657){_0xca79a3=_0xca79a3-0x0;var _0x39ec31=_0x2986[_0xca79a3];return _0x39ec31;};'use strict';var _=require('lodash');var Redis=require('ioredis');var db=require(_0x6298('0x0'))['db'];var logger=require('../../config/logger')(_0x6298('0x1'));var config=require('../../config/environment');config['redis']=_['defaults'](config[_0x6298('0x2')],{'host':_0x6298('0x3'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6298('0x4'))[_0x6298('0x5')](socket);exports[_0x6298('0x6')]=function(_0x52835a){var _0x49df01=this;return new Promise(function(_0x374289,_0x5a292c){return db[_0x6298('0x7')][_0x6298('0x8')]({'raw':_0x52835a[_0x6298('0x9')]?_0x52835a['options']['raw']===undefined?!![]:![]:!![],'where':_0x52835a[_0x6298('0x9')]?_0x52835a[_0x6298('0x9')]['where']||null:null,'attributes':_0x52835a[_0x6298('0x9')]?_0x52835a[_0x6298('0x9')]['attributes']||null:null,'limit':_0x52835a[_0x6298('0x9')]?_0x52835a['options'][_0x6298('0xa')]||null:null,'include':_0x52835a[_0x6298('0x9')]?_0x52835a[_0x6298('0x9')][_0x6298('0xb')]?_[_0x6298('0xc')](_0x52835a[_0x6298('0x9')][_0x6298('0xb')],function(_0x497aaf){return{'model':db[_0x497aaf['model']],'as':_0x497aaf['as'],'attributes':_0x497aaf[_0x6298('0xd')],'include':_0x497aaf[_0x6298('0xb')]?_[_0x6298('0xc')](_0x497aaf[_0x6298('0xb')],function(_0x1225d9){return{'model':db[_0x1225d9[_0x6298('0xe')]],'as':_0x1225d9['as'],'attributes':_0x1225d9[_0x6298('0xd')],'include':_0x1225d9[_0x6298('0xb')]?_[_0x6298('0xc')](_0x1225d9[_0x6298('0xb')],function(_0x31186c){return{'model':db[_0x31186c['model']],'as':_0x31186c['as'],'attributes':_0x31186c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x258882){logger[_0x6298('0xf')]('GetSquareProjects',_0x52835a);logger['debug'](_0x6298('0x6'),_0x52835a,JSON['stringify'](_0x258882));_0x374289(_0x258882);})[_0x6298('0x10')](function(_0x28ff36){logger[_0x6298('0x11')]('GetSquareProjects',_0x28ff36['message'],_0x52835a);_0x5a292c(_0x49df01['error'](0x1f4,_0x28ff36[_0x6298('0x12')]));});});};exports['ShowSquareProject']=function(_0x5a6edf){var _0x24f0e4=this;return new Promise(function(_0x279949,_0x5d0419){return db['SquareProject'][_0x6298('0x13')]({'raw':_0x5a6edf[_0x6298('0x9')]?_0x5a6edf['options'][_0x6298('0x14')]===undefined?!![]:![]:!![],'where':_0x5a6edf['options']?_0x5a6edf[_0x6298('0x9')][_0x6298('0x15')]||null:null,'attributes':_0x5a6edf[_0x6298('0x9')]?_0x5a6edf['options'][_0x6298('0xd')]||null:null,'include':_0x5a6edf[_0x6298('0x9')]?_0x5a6edf['options'][_0x6298('0xb')]?_[_0x6298('0xc')](_0x5a6edf['options'][_0x6298('0xb')],function(_0xf5ffc9){return{'model':db[_0xf5ffc9[_0x6298('0xe')]],'as':_0xf5ffc9['as'],'attributes':_0xf5ffc9[_0x6298('0xd')],'include':_0xf5ffc9[_0x6298('0xb')]?_[_0x6298('0xc')](_0xf5ffc9[_0x6298('0xb')],function(_0x37792b){return{'model':db[_0x37792b[_0x6298('0xe')]],'as':_0x37792b['as'],'attributes':_0x37792b['attributes'],'include':_0x37792b[_0x6298('0xb')]?_[_0x6298('0xc')](_0x37792b[_0x6298('0xb')],function(_0x43f6c3){return{'model':db[_0x43f6c3['model']],'as':_0x43f6c3['as'],'attributes':_0x43f6c3[_0x6298('0xd')]};}):[]};}):[]};}):[]:[]})[_0x6298('0x16')](function(_0x41e8c4){logger[_0x6298('0xf')](_0x6298('0x17'),_0x5a6edf);logger[_0x6298('0x18')]('ShowSquareProject',_0x5a6edf,JSON['stringify'](_0x41e8c4));_0x279949(_0x41e8c4);})[_0x6298('0x10')](function(_0x39bbaa){logger[_0x6298('0x11')]('ShowSquareProject',_0x39bbaa[_0x6298('0x12')],_0x5a6edf);_0x5d0419(_0x24f0e4[_0x6298('0x11')](0x1f4,_0x39bbaa[_0x6298('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index bcb5c81..0fded7f 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 _0x0ce4=['squareProject:','./squareProject.events','update','emit','removeListener','register','length'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x0ce4,0x6a));var _0x40ce=function(_0x1ca2e1,_0x10d773){_0x1ca2e1=_0x1ca2e1-0x0;var _0x2d1c34=_0x0ce4[_0x1ca2e1];return _0x2d1c34;};'use strict';var SquareProjectEvents=require(_0x40ce('0x0'));var events=['save','remove',_0x40ce('0x1')];function createListener(_0x4b2bbc,_0x2a6089){return function(_0x3d30bc){_0x2a6089[_0x40ce('0x2')](_0x4b2bbc,_0x3d30bc);};}function removeListener(_0x2250fe,_0x56b89f){return function(){SquareProjectEvents[_0x40ce('0x3')](_0x2250fe,_0x56b89f);};}exports[_0x40ce('0x4')]=function(_0x307fd4){for(var _0x4ccd9f=0x0,_0x3ccba8=events[_0x40ce('0x5')];_0x4ccd9f<_0x3ccba8;_0x4ccd9f++){var _0x559688=events[_0x4ccd9f];var _0x17a4a1=createListener(_0x40ce('0x6')+_0x559688,_0x307fd4);SquareProjectEvents['on'](_0x559688,_0x17a4a1);}}; \ No newline at end of file +var _0x5bd2=['length','./squareProject.events','save','remove','update','emit','removeListener','register'];(function(_0x57add2,_0x4f2b7d){var _0x4e3670=function(_0x3311b){while(--_0x3311b){_0x57add2['push'](_0x57add2['shift']());}};_0x4e3670(++_0x4f2b7d);}(_0x5bd2,0x69));var _0x25bd=function(_0x526ec0,_0x1c4f96){_0x526ec0=_0x526ec0-0x0;var _0x346169=_0x5bd2[_0x526ec0];return _0x346169;};'use strict';var SquareProjectEvents=require(_0x25bd('0x0'));var events=[_0x25bd('0x1'),_0x25bd('0x2'),_0x25bd('0x3')];function createListener(_0x1e302c,_0x3b53af){return function(_0x26d48d){_0x3b53af[_0x25bd('0x4')](_0x1e302c,_0x26d48d);};}function removeListener(_0x58ba35,_0x541ce4){return function(){SquareProjectEvents[_0x25bd('0x5')](_0x58ba35,_0x541ce4);};}exports[_0x25bd('0x6')]=function(_0x8d4035){for(var _0x3aba7e=0x0,_0x5789ee=events[_0x25bd('0x7')];_0x3aba7e<_0x5789ee;_0x3aba7e++){var _0x3a9638=events[_0x3aba7e];var _0x3e2001=createListener('squareProject:'+_0x3a9638,_0x8d4035);SquareProjectEvents['on'](_0x3a9638,_0x3e2001);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 4ec0fcf..4eaf5dd 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7fbe=['/:id','show','/:id/download','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index'];(function(_0x243d03,_0xedcae7){var _0x3bc936=function(_0x37d43d){while(--_0x37d43d){_0x243d03['push'](_0x243d03['shift']());}};_0x3bc936(++_0xedcae7);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2de9c0,_0x2ae1f2){_0x2de9c0=_0x2de9c0-0x0;var _0x1c4daa=_0x7fbe[_0x2de9c0];return _0x1c4daa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')]('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xb')]);router[_0xe7fb('0x9')](_0xe7fb('0xc'),auth['isAuthenticated'](),controller[_0xe7fb('0xd')]);router[_0xe7fb('0x9')](_0xe7fb('0xe'),auth[_0xe7fb('0xa')](),controller['download']);router['post']('/',auth[_0xe7fb('0xa')](),controller[_0xe7fb('0xf')]);router[_0xe7fb('0x10')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x11')]);router[_0xe7fb('0x12')](_0xe7fb('0xc'),auth[_0xe7fb('0xa')](),controller[_0xe7fb('0x13')]);module[_0xe7fb('0x14')]=router; \ No newline at end of file +var _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0xda7a9d,_0x37ae4d){var _0x1f804b=function(_0x39893e){while(--_0x39893e){_0xda7a9d['push'](_0xda7a9d['shift']());}};_0x1f804b(++_0x37ae4d);}(_0x1261,0x144));var _0x1126=function(_0x5a2291,_0x3ddda7){_0x5a2291=_0x5a2291-0x0;var _0x10e3f5=_0x1261[_0x5a2291];return _0x10e3f5;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 6d5ec20..331971e 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 _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x95eba8,_0x128c50){var _0x54f606=function(_0x75bbce){while(--_0x75bbce){_0x95eba8['push'](_0x95eba8['shift']());}};_0x54f606(++_0x128c50);}(_0x2675,0x75));var _0x5267=function(_0x334cbd,_0x47a1ad){_0x334cbd=_0x334cbd-0x0;var _0x48a8ed=_0x2675[_0x334cbd];return _0x48a8ed;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file +var _0x81bd=['STRING','VIRTUAL','getDataValue','substring','lastIndexOf','sequelize','exports'];(function(_0x567dab,_0x1130e8){var _0x92a679=function(_0x273c84){while(--_0x273c84){_0x567dab['push'](_0x567dab['shift']());}};_0x92a679(++_0x1130e8);}(_0x81bd,0x7c));var _0xd81b=function(_0x2da230,_0x5a5dfc){_0x2da230=_0x2da230-0x0;var _0x3504a9=_0x81bd[_0x2da230];return _0x3504a9;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'uniqueid':{'type':Sequelize[_0xd81b('0x2')]},'callerid':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize[_0xd81b('0x2')]},'context':{'type':Sequelize[_0xd81b('0x2')]},'extension':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd81b('0x2')]},'dnid':{'type':Sequelize[_0xd81b('0x2')]},'projectName':{'type':Sequelize[_0xd81b('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0xd81b('0x2')]},'savePath':{'type':Sequelize[_0xd81b('0x2')]},'format':{'type':Sequelize[_0xd81b('0x3')],'get':function(){var _0x562084='';var _0x5e14e8=this[_0xd81b('0x4')]('savePath');if(_0x5e14e8){_0x562084=_0x5e14e8[_0xd81b('0x5')](_0x5e14e8[_0xd81b('0x6')]('.'));}return _0x562084;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 0c6c4fe..ea91c18 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 _0x2db9=['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','status','end','limit','undefined','count','offset','set','json','apply','save','update','destroy','then','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','include','findAll','params','options','find','catch','create','body','../../components/encryptor','savePath','filename','%s.cypher','decryptFile','recording','existsSync','ValidationError','download','unlink','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1649fe,_0x5916da){var _0x473a67=function(_0x163cae){while(--_0x163cae){_0x1649fe['push'](_0x1649fe['shift']());}};_0x473a67(++_0x5916da);}(_0x2db9,0x169));var _0x92db=function(_0x4ec077,_0x3b2929){_0x4ec077=_0x4ec077-0x0;var _0x5ace8d=_0x2db9[_0x4ec077];return _0x5ace8d;};'use strict';var emlformat=require(_0x92db('0x0'));var rimraf=require(_0x92db('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x92db('0x2'));var rp=require(_0x92db('0x3'));var moment=require(_0x92db('0x4'));var BPromise=require(_0x92db('0x5'));var Mustache=require(_0x92db('0x6'));var util=require(_0x92db('0x7'));var path=require(_0x92db('0x8'));var sox=require(_0x92db('0x9'));var csv=require(_0x92db('0xa'));var ejs=require(_0x92db('0xb'));var fs=require('fs');var fs_extra=require(_0x92db('0xc'));var _=require(_0x92db('0xd'));var squel=require(_0x92db('0xe'));var crypto=require(_0x92db('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x92db('0x10'));var toCsv=require('to-csv');var querystring=require(_0x92db('0x11'));var Papa=require(_0x92db('0x12'));var Redis=require(_0x92db('0x13'));var authService=require(_0x92db('0x14'));var qs=require(_0x92db('0x15'));var as=require(_0x92db('0x16'));var hardwareService=require(_0x92db('0x17'));var logger=require(_0x92db('0x18'))(_0x92db('0x19'));var utils=require(_0x92db('0x1a'));var config=require(_0x92db('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x92db('0x1c'))['db'];function respondWithStatusCode(_0x440882,_0x51c426){_0x51c426=_0x51c426||0xcc;return function(_0x4bbfa4){if(_0x4bbfa4){return _0x440882[_0x92db('0x1d')](_0x51c426);}return _0x440882[_0x92db('0x1e')](_0x51c426)[_0x92db('0x1f')]();};}function respondWithResult(_0x3effb2,_0x1f1d81){_0x1f1d81=_0x1f1d81||0xc8;return function(_0x18a898){if(_0x18a898){return _0x3effb2[_0x92db('0x1e')](_0x1f1d81)['json'](_0x18a898);}};}function respondWithFilteredResult(_0x4afa3e,_0x3a1f4d){return function(_0x4b8172){if(_0x4b8172){var _0x3748a5=typeof _0x3a1f4d['offset']==='undefined'&&typeof _0x3a1f4d[_0x92db('0x20')]===_0x92db('0x21');var _0x2e8089=_0x4b8172[_0x92db('0x22')];var _0x20ca93=_0x3748a5?0x0:_0x3a1f4d['offset'];var _0x47af2b=_0x3748a5?_0x4b8172[_0x92db('0x22')]:_0x3a1f4d[_0x92db('0x23')]+_0x3a1f4d[_0x92db('0x20')];var _0x163d19;if(_0x47af2b>=_0x2e8089){_0x47af2b=_0x2e8089;_0x163d19=0xc8;}else{_0x163d19=0xce;}_0x4afa3e['status'](_0x163d19);return _0x4afa3e[_0x92db('0x24')]('Content-Range',_0x20ca93+'-'+_0x47af2b+'/'+_0x2e8089)[_0x92db('0x25')](_0x4b8172);}return null;};}function patchUpdates(_0xa0aafc){return function(_0x56fc4c){try{jsonpatch[_0x92db('0x26')](_0x56fc4c,_0xa0aafc,!![]);}catch(_0x36e13f){return BPromise['reject'](_0x36e13f);}return _0x56fc4c[_0x92db('0x27')]();};}function saveUpdates(_0x21ff60,_0x2061b9){return function(_0x1af176){if(_0x1af176){return _0x1af176[_0x92db('0x28')](_0x21ff60)['then'](function(_0x14e3b6){return _0x14e3b6;});}return null;};}function removeEntity(_0x21fc42,_0x540ef3){return function(_0x108735){if(_0x108735){return _0x108735[_0x92db('0x29')]()[_0x92db('0x2a')](function(){_0x21fc42[_0x92db('0x1e')](0xcc)[_0x92db('0x1f')]();});}};}function handleEntityNotFound(_0x896941,_0x398308){return function(_0x389383){if(!_0x389383){_0x896941[_0x92db('0x1d')](0x194);}return _0x389383;};}function handleError(_0x26d8d5,_0x48174c){_0x48174c=_0x48174c||0x1f4;return function(_0x4a4587){logger[_0x92db('0x2b')](_0x4a4587[_0x92db('0x2c')]);if(_0x4a4587[_0x92db('0x2d')]){delete _0x4a4587[_0x92db('0x2d')];}_0x26d8d5['status'](_0x48174c)[_0x92db('0x2e')](_0x4a4587);};}exports['index']=function(_0x282dd6,_0x4bd6ff){var _0x2c560e={},_0x3a9e8e={},_0x29face={'count':0x0,'rows':[]};var _0x4039a8=_[_0x92db('0x2f')](db[_0x92db('0x30')][_0x92db('0x31')],function(_0xbb2631){return{'name':_0xbb2631[_0x92db('0x32')],'type':_0xbb2631[_0x92db('0x33')]['key']};});_0x3a9e8e['model']=_[_0x92db('0x2f')](_0x4039a8,_0x92db('0x2d'));_0x3a9e8e[_0x92db('0x34')]=_[_0x92db('0x35')](_0x282dd6[_0x92db('0x34')]);_0x3a9e8e[_0x92db('0x36')]=_['intersection'](_0x3a9e8e['model'],_0x3a9e8e[_0x92db('0x34')]);_0x2c560e['attributes']=_[_0x92db('0x37')](_0x3a9e8e['model'],qs[_0x92db('0x38')](_0x282dd6[_0x92db('0x34')][_0x92db('0x38')]));_0x2c560e[_0x92db('0x39')]=_0x2c560e[_0x92db('0x39')][_0x92db('0x3a')]?_0x2c560e['attributes']:_0x3a9e8e[_0x92db('0x3b')];if(!_0x282dd6[_0x92db('0x34')][_0x92db('0x3c')](_0x92db('0x3d'))){_0x2c560e['limit']=qs[_0x92db('0x20')](_0x282dd6[_0x92db('0x34')][_0x92db('0x20')]);_0x2c560e[_0x92db('0x23')]=qs[_0x92db('0x23')](_0x282dd6[_0x92db('0x34')][_0x92db('0x23')]);}_0x2c560e[_0x92db('0x3e')]=qs[_0x92db('0x3f')](_0x282dd6['query'][_0x92db('0x3f')]);_0x2c560e[_0x92db('0x40')]=qs[_0x92db('0x36')](_[_0x92db('0x41')](_0x282dd6['query'],_0x3a9e8e[_0x92db('0x36')]),_0x4039a8);if(_0x282dd6['query']['filter']){_0x2c560e[_0x92db('0x40')]=_['merge'](_0x2c560e['where'],{'$or':_[_0x92db('0x2f')](_0x4039a8,function(_0xe9aa0d){if(_0xe9aa0d[_0x92db('0x33')]!=='VIRTUAL'){var _0x4a1fc1={};_0x4a1fc1[_0xe9aa0d[_0x92db('0x2d')]]={'$like':'%'+_0x282dd6['query']['filter']+'%'};return _0x4a1fc1;}})});}_0x2c560e=_[_0x92db('0x42')]({},_0x2c560e,_0x282dd6['options']);var _0x4b38e6={'where':_0x2c560e[_0x92db('0x40')]};return db[_0x92db('0x30')][_0x92db('0x22')](_0x4b38e6)[_0x92db('0x2a')](function(_0x4c03df){_0x29face['count']=_0x4c03df;if(_0x282dd6[_0x92db('0x34')][_0x92db('0x43')]){_0x2c560e[_0x92db('0x44')]=[{'all':!![]}];}return db[_0x92db('0x30')][_0x92db('0x45')](_0x2c560e);})['then'](function(_0x103589){_0x29face['rows']=_0x103589;return _0x29face;})['then'](respondWithFilteredResult(_0x4bd6ff,_0x2c560e))['catch'](handleError(_0x4bd6ff,null));};exports['show']=function(_0x302878,_0x4363d7){var _0x495ae1={'raw':!![],'where':{'id':_0x302878[_0x92db('0x46')]['id']}},_0x395e74={};_0x395e74[_0x92db('0x3b')]=_[_0x92db('0x35')](db[_0x92db('0x30')]['rawAttributes']);_0x395e74[_0x92db('0x34')]=_[_0x92db('0x35')](_0x302878[_0x92db('0x34')]);_0x395e74[_0x92db('0x36')]=_[_0x92db('0x37')](_0x395e74[_0x92db('0x3b')],_0x395e74['query']);_0x495ae1[_0x92db('0x39')]=_[_0x92db('0x37')](_0x395e74['model'],qs[_0x92db('0x38')](_0x302878['query']['fields']));_0x495ae1[_0x92db('0x39')]=_0x495ae1['attributes'][_0x92db('0x3a')]?_0x495ae1['attributes']:_0x395e74[_0x92db('0x3b')];if(_0x302878[_0x92db('0x34')]['includeAll']){_0x495ae1[_0x92db('0x44')]=[{'all':!![]}];}_0x495ae1=_[_0x92db('0x42')]({},_0x495ae1,_0x302878[_0x92db('0x47')]);return db[_0x92db('0x30')][_0x92db('0x48')](_0x495ae1)[_0x92db('0x2a')](handleEntityNotFound(_0x4363d7,null))[_0x92db('0x2a')](respondWithResult(_0x4363d7,null))[_0x92db('0x49')](handleError(_0x4363d7,null));};exports[_0x92db('0x4a')]=function(_0x1c6619,_0x19e204){return db[_0x92db('0x30')][_0x92db('0x4a')](_0x1c6619[_0x92db('0x4b')],{})[_0x92db('0x2a')](respondWithResult(_0x19e204,0xc9))['catch'](handleError(_0x19e204,null));};exports[_0x92db('0x28')]=function(_0x477686,_0x40abeb){if(_0x477686['body']['id']){delete _0x477686[_0x92db('0x4b')]['id'];}return db[_0x92db('0x30')]['find']({'where':{'id':_0x477686[_0x92db('0x46')]['id']}})[_0x92db('0x2a')](handleEntityNotFound(_0x40abeb,null))['then'](saveUpdates(_0x477686[_0x92db('0x4b')],null))[_0x92db('0x2a')](respondWithResult(_0x40abeb,null))[_0x92db('0x49')](handleError(_0x40abeb,null));};exports['download']=function(_0x506531,_0x20a8d2,_0x51f8aa){var _0x393b9b=require(_0x92db('0x4c'));var _0x6c11a=![];var _0x1d482f={};if(_0x506531[_0x92db('0x34')]['type']&&_0x506531[_0x92db('0x34')][_0x92db('0x33')]==='uniqueid'){_0x1d482f['uniqueid']=_0x506531[_0x92db('0x46')]['id'];}else{_0x1d482f['id']=_0x506531[_0x92db('0x46')]['id'];}return db[_0x92db('0x30')][_0x92db('0x48')]({'where':_0x1d482f,'attributes':['id',_0x92db('0x4d'),_0x92db('0x4e')],'raw':!![]})[_0x92db('0x2a')](handleEntityNotFound(_0x20a8d2,null))['then'](function(_0x4b4f1e){if(_0x4b4f1e){var _0x136c36=_0x4b4f1e[_0x92db('0x4d')];var _0x44619d=util['format'](_0x92db('0x4f'),_0x136c36);if(fs['existsSync'](_0x44619d)){_0x6c11a=!![];return _0x393b9b[_0x92db('0x50')](_0x44619d,_0x136c36,config['secrets'][_0x92db('0x51')])[_0x92db('0x2a')](function(){return _0x4b4f1e;});}return _0x4b4f1e;}})[_0x92db('0x2a')](function(_0x1883ad){if(_0x1883ad){var _0x3f9edf=_0x1883ad[_0x92db('0x4d')];if(!fs[_0x92db('0x52')](_0x3f9edf)){throw new db['Sequelize'][(_0x92db('0x53'))]('SquareRecording\x20not\x20found');}if(_0x1883ad[_0x92db('0x4e')]){return _0x20a8d2[_0x92db('0x54')](_0x3f9edf,_0x1883ad['filename']+path['extname'](_0x3f9edf),function(){if(_0x6c11a){fs[_0x92db('0x55')](_0x3f9edf);}});}else{return _0x20a8d2[_0x92db('0x54')](_0x3f9edf,function(_0x5e04ea){if(_0x6c11a){fs['unlink'](_0x3f9edf);}});}}})['catch'](function(_0xbdfac4){if(_0xbdfac4[_0x92db('0x56')]==='SquareRecording\x20not\x20found'){_0x20a8d2[_0x92db('0x1e')](0x194)['send'](_0x92db('0x57'));}else{return handleError(_0x20a8d2,null);}});};exports['destroy']=function(_0x14dd5a,_0x3e570b){return db[_0x92db('0x30')][_0x92db('0x48')]({'where':{'id':_0x14dd5a[_0x92db('0x46')]['id']}})[_0x92db('0x2a')](function(_0x646305){if(_[_0x92db('0x58')](_0x646305)){throw new ReferenceError('Entity\x20not\x20found');}return _0x646305;})[_0x92db('0x2a')](function(_0x305151){var _0x13319b=_0x305151[_0x92db('0x4d')];logger[_0x92db('0x59')]('cancellazione\x20fisica\x20documento\x20%s',_0x13319b);if(!_['isNil'](_0x305151[_0x92db('0x4d')])&&fs[_0x92db('0x52')](_0x13319b)){logger[_0x92db('0x59')](_0x92db('0x5a')+_0x13319b+_0x92db('0x5b'));fs[_0x92db('0x5c')](_0x13319b);}_0x13319b=_0x13319b+_0x92db('0x5d');if(!_[_0x92db('0x58')](_0x305151[_0x92db('0x4d')])&&fs[_0x92db('0x52')](_0x13319b)){logger[_0x92db('0x59')]('File:\x20\x22'+_0x13319b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x13319b);}return _0x305151;})['then'](function(_0x2541b2){if(!_0x2541b2)throw new InternalError();return _0x2541b2[_0x92db('0x29')]();})[_0x92db('0x2a')](function(){_0x3e570b[_0x92db('0x1e')](0xcc)['end']();})[_0x92db('0x49')](handleError(_0x3e570b,null));}; \ No newline at end of file +var _0x75bc=['secrets','recording','savePath','Sequelize','ValidationError','filename','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','options','include','rows','catch','show','params','intersection','includeAll','create','body','find','download','../../components/encryptor','uniqueid','format','%s.cypher','existsSync'];(function(_0x250430,_0x3aff2e){var _0x4f9390=function(_0x5cd7ce){while(--_0x5cd7ce){_0x250430['push'](_0x250430['shift']());}};_0x4f9390(++_0x3aff2e);}(_0x75bc,0x19a));var _0xc75b=function(_0x240995,_0x1ee936){_0x240995=_0x240995-0x0;var _0x49b4d5=_0x75bc[_0x240995];return _0x49b4d5;};'use strict';var emlformat=require(_0xc75b('0x0'));var rimraf=require(_0xc75b('0x1'));var zipdir=require(_0xc75b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc75b('0x3'));var moment=require(_0xc75b('0x4'));var BPromise=require(_0xc75b('0x5'));var Mustache=require('mustache');var util=require(_0xc75b('0x6'));var path=require('path');var sox=require(_0xc75b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc75b('0x8'));var squel=require(_0xc75b('0x9'));var crypto=require(_0xc75b('0xa'));var jsforce=require(_0xc75b('0xb'));var deskjs=require(_0xc75b('0xc'));var toCsv=require('to-csv');var querystring=require(_0xc75b('0xd'));var Papa=require(_0xc75b('0xe'));var Redis=require(_0xc75b('0xf'));var authService=require(_0xc75b('0x10'));var qs=require(_0xc75b('0x11'));var as=require(_0xc75b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc75b('0x13'));var utils=require(_0xc75b('0x14'));var config=require(_0xc75b('0x15'));var licenseUtil=require(_0xc75b('0x16'));var db=require(_0xc75b('0x17'))['db'];function respondWithStatusCode(_0xc669de,_0x3ad119){_0x3ad119=_0x3ad119||0xcc;return function(_0x44d5f8){if(_0x44d5f8){return _0xc669de['sendStatus'](_0x3ad119);}return _0xc669de[_0xc75b('0x18')](_0x3ad119)[_0xc75b('0x19')]();};}function respondWithResult(_0x21134f,_0x87b193){_0x87b193=_0x87b193||0xc8;return function(_0x3a4875){if(_0x3a4875){return _0x21134f['status'](_0x87b193)[_0xc75b('0x1a')](_0x3a4875);}};}function respondWithFilteredResult(_0x502d4c,_0x2339fa){return function(_0xc76c9f){if(_0xc76c9f){var _0x506495=typeof _0x2339fa[_0xc75b('0x1b')]===_0xc75b('0x1c')&&typeof _0x2339fa[_0xc75b('0x1d')]==='undefined';var _0x295a28=_0xc76c9f[_0xc75b('0x1e')];var _0x4c2009=_0x506495?0x0:_0x2339fa[_0xc75b('0x1b')];var _0x10af0b=_0x506495?_0xc76c9f[_0xc75b('0x1e')]:_0x2339fa[_0xc75b('0x1b')]+_0x2339fa['limit'];var _0x35f003;if(_0x10af0b>=_0x295a28){_0x10af0b=_0x295a28;_0x35f003=0xc8;}else{_0x35f003=0xce;}_0x502d4c['status'](_0x35f003);return _0x502d4c[_0xc75b('0x1f')](_0xc75b('0x20'),_0x4c2009+'-'+_0x10af0b+'/'+_0x295a28)[_0xc75b('0x1a')](_0xc76c9f);}return null;};}function patchUpdates(_0x19f735){return function(_0x3ce447){try{jsonpatch['apply'](_0x3ce447,_0x19f735,!![]);}catch(_0x3901ca){return BPromise[_0xc75b('0x21')](_0x3901ca);}return _0x3ce447[_0xc75b('0x22')]();};}function saveUpdates(_0x25fa14,_0x4ca84b){return function(_0x1c859b){if(_0x1c859b){return _0x1c859b[_0xc75b('0x23')](_0x25fa14)['then'](function(_0x63666){return _0x63666;});}return null;};}function removeEntity(_0x663a36,_0x28c3b7){return function(_0x160eda){if(_0x160eda){return _0x160eda[_0xc75b('0x24')]()[_0xc75b('0x25')](function(){_0x663a36[_0xc75b('0x18')](0xcc)[_0xc75b('0x19')]();});}};}function handleEntityNotFound(_0x4138b9,_0x3dfff8){return function(_0x4a5ef1){if(!_0x4a5ef1){_0x4138b9[_0xc75b('0x26')](0x194);}return _0x4a5ef1;};}function handleError(_0x311c69,_0x43f77d){_0x43f77d=_0x43f77d||0x1f4;return function(_0x3083af){logger[_0xc75b('0x27')](_0x3083af[_0xc75b('0x28')]);if(_0x3083af['name']){delete _0x3083af[_0xc75b('0x29')];}_0x311c69[_0xc75b('0x18')](_0x43f77d)[_0xc75b('0x2a')](_0x3083af);};}exports[_0xc75b('0x2b')]=function(_0x5b5177,_0x527b31){var _0x12bbc8={},_0x83ed16={},_0x43b0c0={'count':0x0,'rows':[]};var _0x20ae46=_[_0xc75b('0x2c')](db[_0xc75b('0x2d')][_0xc75b('0x2e')],function(_0x75f4ad){return{'name':_0x75f4ad[_0xc75b('0x2f')],'type':_0x75f4ad[_0xc75b('0x30')]['key']};});_0x83ed16['model']=_[_0xc75b('0x2c')](_0x20ae46,'name');_0x83ed16[_0xc75b('0x31')]=_[_0xc75b('0x32')](_0x5b5177[_0xc75b('0x31')]);_0x83ed16['filters']=_['intersection'](_0x83ed16[_0xc75b('0x33')],_0x83ed16[_0xc75b('0x31')]);_0x12bbc8[_0xc75b('0x34')]=_['intersection'](_0x83ed16[_0xc75b('0x33')],qs[_0xc75b('0x35')](_0x5b5177[_0xc75b('0x31')]['fields']));_0x12bbc8[_0xc75b('0x34')]=_0x12bbc8['attributes'][_0xc75b('0x36')]?_0x12bbc8[_0xc75b('0x34')]:_0x83ed16[_0xc75b('0x33')];if(!_0x5b5177['query'][_0xc75b('0x37')](_0xc75b('0x38'))){_0x12bbc8[_0xc75b('0x1d')]=qs[_0xc75b('0x1d')](_0x5b5177[_0xc75b('0x31')][_0xc75b('0x1d')]);_0x12bbc8[_0xc75b('0x1b')]=qs[_0xc75b('0x1b')](_0x5b5177[_0xc75b('0x31')][_0xc75b('0x1b')]);}_0x12bbc8[_0xc75b('0x39')]=qs['sort'](_0x5b5177['query']['sort']);_0x12bbc8[_0xc75b('0x3a')]=qs['filters'](_[_0xc75b('0x3b')](_0x5b5177[_0xc75b('0x31')],_0x83ed16[_0xc75b('0x3c')]),_0x20ae46);if(_0x5b5177[_0xc75b('0x31')][_0xc75b('0x3d')]){_0x12bbc8[_0xc75b('0x3a')]=_[_0xc75b('0x3e')](_0x12bbc8[_0xc75b('0x3a')],{'$or':_[_0xc75b('0x2c')](_0x20ae46,function(_0x69f8a1){if(_0x69f8a1[_0xc75b('0x30')]!=='VIRTUAL'){var _0x35fd92={};_0x35fd92[_0x69f8a1[_0xc75b('0x29')]]={'$like':'%'+_0x5b5177[_0xc75b('0x31')][_0xc75b('0x3d')]+'%'};return _0x35fd92;}})});}_0x12bbc8=_[_0xc75b('0x3e')]({},_0x12bbc8,_0x5b5177[_0xc75b('0x3f')]);var _0xb84313={'where':_0x12bbc8[_0xc75b('0x3a')]};return db[_0xc75b('0x2d')]['count'](_0xb84313)['then'](function(_0x3e02a6){_0x43b0c0['count']=_0x3e02a6;if(_0x5b5177[_0xc75b('0x31')]['includeAll']){_0x12bbc8[_0xc75b('0x40')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x12bbc8);})['then'](function(_0x24643c){_0x43b0c0[_0xc75b('0x41')]=_0x24643c;return _0x43b0c0;})['then'](respondWithFilteredResult(_0x527b31,_0x12bbc8))[_0xc75b('0x42')](handleError(_0x527b31,null));};exports[_0xc75b('0x43')]=function(_0x341988,_0x65530d){var _0x408626={'raw':!![],'where':{'id':_0x341988[_0xc75b('0x44')]['id']}},_0x4c9a3a={};_0x4c9a3a['model']=_[_0xc75b('0x32')](db[_0xc75b('0x2d')][_0xc75b('0x2e')]);_0x4c9a3a[_0xc75b('0x31')]=_['keys'](_0x341988[_0xc75b('0x31')]);_0x4c9a3a['filters']=_['intersection'](_0x4c9a3a[_0xc75b('0x33')],_0x4c9a3a['query']);_0x408626[_0xc75b('0x34')]=_[_0xc75b('0x45')](_0x4c9a3a['model'],qs['fields'](_0x341988['query'][_0xc75b('0x35')]));_0x408626[_0xc75b('0x34')]=_0x408626[_0xc75b('0x34')][_0xc75b('0x36')]?_0x408626['attributes']:_0x4c9a3a[_0xc75b('0x33')];if(_0x341988[_0xc75b('0x31')][_0xc75b('0x46')]){_0x408626['include']=[{'all':!![]}];}_0x408626=_['merge']({},_0x408626,_0x341988[_0xc75b('0x3f')]);return db[_0xc75b('0x2d')]['find'](_0x408626)[_0xc75b('0x25')](handleEntityNotFound(_0x65530d,null))['then'](respondWithResult(_0x65530d,null))[_0xc75b('0x42')](handleError(_0x65530d,null));};exports[_0xc75b('0x47')]=function(_0x1e98e6,_0x5a135e){return db['SquareRecording'][_0xc75b('0x47')](_0x1e98e6['body'],{})[_0xc75b('0x25')](respondWithResult(_0x5a135e,0xc9))[_0xc75b('0x42')](handleError(_0x5a135e,null));};exports[_0xc75b('0x23')]=function(_0x12f3d9,_0x548056){if(_0x12f3d9['body']['id']){delete _0x12f3d9[_0xc75b('0x48')]['id'];}return db['SquareRecording'][_0xc75b('0x49')]({'where':{'id':_0x12f3d9['params']['id']}})[_0xc75b('0x25')](handleEntityNotFound(_0x548056,null))[_0xc75b('0x25')](saveUpdates(_0x12f3d9['body'],null))[_0xc75b('0x25')](respondWithResult(_0x548056,null))[_0xc75b('0x42')](handleError(_0x548056,null));};exports[_0xc75b('0x4a')]=function(_0x5d4430,_0x386156,_0x3ebfff){var _0x3879ba=require(_0xc75b('0x4b'));var _0x36bfcf=![];var _0x4188e6={};if(_0x5d4430[_0xc75b('0x31')][_0xc75b('0x30')]&&_0x5d4430[_0xc75b('0x31')][_0xc75b('0x30')]==='uniqueid'){_0x4188e6[_0xc75b('0x4c')]=_0x5d4430[_0xc75b('0x44')]['id'];}else{_0x4188e6['id']=_0x5d4430[_0xc75b('0x44')]['id'];}return db[_0xc75b('0x2d')]['find']({'where':_0x4188e6,'attributes':['id','savePath','filename'],'raw':!![]})[_0xc75b('0x25')](handleEntityNotFound(_0x386156,null))['then'](function(_0x129b6c){if(_0x129b6c){var _0x561139=_0x129b6c['savePath'];var _0x5da3bc=util[_0xc75b('0x4d')](_0xc75b('0x4e'),_0x561139);if(fs[_0xc75b('0x4f')](_0x5da3bc)){_0x36bfcf=!![];return _0x3879ba['decryptFile'](_0x5da3bc,_0x561139,config[_0xc75b('0x50')][_0xc75b('0x51')])[_0xc75b('0x25')](function(){return _0x129b6c;});}return _0x129b6c;}})[_0xc75b('0x25')](function(_0x56a1a5){if(_0x56a1a5){var _0x4cfad4=_0x56a1a5[_0xc75b('0x52')];if(!fs['existsSync'](_0x4cfad4)){throw new db[(_0xc75b('0x53'))][(_0xc75b('0x54'))]('SquareRecording\x20not\x20found');}if(_0x56a1a5['filename']){return _0x386156['download'](_0x4cfad4,_0x56a1a5[_0xc75b('0x55')]+path[_0xc75b('0x56')](_0x4cfad4),function(){if(_0x36bfcf){fs[_0xc75b('0x57')](_0x4cfad4);}});}else{return _0x386156['download'](_0x4cfad4,function(_0x26bed0){if(_0x36bfcf){fs['unlink'](_0x4cfad4);}});}}})[_0xc75b('0x42')](function(_0x5d0ae9){if(_0x5d0ae9[_0xc75b('0x58')]===_0xc75b('0x59')){_0x386156['status'](0x194)[_0xc75b('0x2a')](_0xc75b('0x5a'));}else{return handleError(_0x386156,null);}});};exports[_0xc75b('0x24')]=function(_0xa13e32,_0x2e7fe0){return db[_0xc75b('0x2d')]['find']({'where':{'id':_0xa13e32[_0xc75b('0x44')]['id']}})[_0xc75b('0x25')](function(_0x289a4c){if(_[_0xc75b('0x5b')](_0x289a4c)){throw new ReferenceError(_0xc75b('0x5c'));}return _0x289a4c;})[_0xc75b('0x25')](function(_0x58b60b){var _0x5b8ba0=_0x58b60b['savePath'];logger[_0xc75b('0x5d')]('cancellazione\x20fisica\x20documento\x20%s',_0x5b8ba0);if(!_[_0xc75b('0x5b')](_0x58b60b[_0xc75b('0x52')])&&fs[_0xc75b('0x4f')](_0x5b8ba0)){logger['info'](_0xc75b('0x5e')+_0x5b8ba0+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc75b('0x5f')](_0x5b8ba0);}_0x5b8ba0=_0x5b8ba0+_0xc75b('0x60');if(!_[_0xc75b('0x5b')](_0x58b60b['savePath'])&&fs[_0xc75b('0x4f')](_0x5b8ba0)){logger[_0xc75b('0x5d')](_0xc75b('0x5e')+_0x5b8ba0+_0xc75b('0x61'));fs[_0xc75b('0x5f')](_0x5b8ba0);}return _0x58b60b;})['then'](function(_0x13ed0e){if(!_0x13ed0e)throw new InternalError();return _0x13ed0e[_0xc75b('0x24')]();})['then'](function(){_0x2e7fe0[_0xc75b('0x18')](0xcc)[_0xc75b('0x19')]();})[_0xc75b('0x42')](handleError(_0x2e7fe0,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 33ef983..a0e5bdd 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 _0xa5c1=['bluebird','path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','square_recordings','lodash','util','../../config/logger'];(function(_0x3e8285,_0x1ff5e4){var _0xe21112=function(_0xf395cc){while(--_0xf395cc){_0x3e8285['push'](_0x3e8285['shift']());}};_0xe21112(++_0x1ff5e4);}(_0xa5c1,0x19f));var _0x1a5c=function(_0x565012,_0x507412){_0x565012=_0x565012-0x0;var _0x91ebe5=_0xa5c1[_0x565012];return _0x91ebe5;};'use strict';var _=require(_0x1a5c('0x0'));var util=require(_0x1a5c('0x1'));var logger=require(_0x1a5c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x1a5c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a5c('0x4'));var rimraf=require(_0x1a5c('0x5'));var config=require(_0x1a5c('0x6'));var attributes=require(_0x1a5c('0x7'));module[_0x1a5c('0x8')]=function(_0x3c3558,_0x4d7377){return _0x3c3558[_0x1a5c('0x9')]('SquareRecording',attributes,{'tableName':_0x1a5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x14b2=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','SquareRecording','square_recordings','lodash'];(function(_0xb47dc0,_0x407032){var _0x57f0b0=function(_0x11c030){while(--_0x11c030){_0xb47dc0['push'](_0xb47dc0['shift']());}};_0x57f0b0(++_0x407032);}(_0x14b2,0x1a1));var _0x214b=function(_0x1c4582,_0x18ac51){_0x1c4582=_0x1c4582-0x0;var _0x4b16f2=_0x14b2[_0x1c4582];return _0x4b16f2;};'use strict';var _=require(_0x214b('0x0'));var util=require(_0x214b('0x1'));var logger=require('../../config/logger')(_0x214b('0x2'));var moment=require(_0x214b('0x3'));var BPromise=require(_0x214b('0x4'));var rp=require(_0x214b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x214b('0x6'));var config=require(_0x214b('0x7'));var attributes=require('./squareRecording.attributes');module['exports']=function(_0x16cce0,_0x264d5e){return _0x16cce0[_0x214b('0x8')](_0x214b('0x9'),attributes,{'tableName':_0x214b('0xa'),'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 e12102b..6ad0f2e 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 _0x46e4=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','CreateSquareRecording','SquareRecording','options','raw','info','lodash','util','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x46e4,0xce));var _0x446e=function(_0x57c501,_0x319f03){_0x57c501=_0x57c501-0x0;var _0x4f15ba=_0x46e4[_0x57c501];return _0x4f15ba;};'use strict';var _=require(_0x446e('0x0'));var util=require(_0x446e('0x1'));var moment=require(_0x446e('0x2'));var BPromise=require(_0x446e('0x3'));var rs=require(_0x446e('0x4'));var fs=require('fs');var Redis=require(_0x446e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x446e('0x6'));var logger=require(_0x446e('0x7'))(_0x446e('0x8'));var config=require(_0x446e('0x9'));var jayson=require(_0x446e('0xa'));var client=jayson[_0x446e('0xb')][_0x446e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x50692b,_0x240d85,_0x5c713c){return new BPromise(function(_0x53f333,_0xdd8616){return client[_0x446e('0xd')](_0x50692b,_0x5c713c)[_0x446e('0xe')](function(_0x5ba157){logger['info'](_0x446e('0xf'),_0x240d85,_0x446e('0x10'));logger[_0x446e('0x11')](_0x446e('0x12'),_0x240d85,'request\x20sent',JSON[_0x446e('0x13')](_0x5ba157));if(_0x5ba157['error']){if(_0x5ba157['error'][_0x446e('0x14')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x240d85,_0x5ba157[_0x446e('0x15')][_0x446e('0x16')]);return _0xdd8616(_0x5ba157['error'][_0x446e('0x16')]);}logger[_0x446e('0x15')](_0x446e('0xf'),_0x240d85,_0x5ba157[_0x446e('0x15')][_0x446e('0x16')]);return _0x53f333(_0x5ba157[_0x446e('0x15')][_0x446e('0x16')]);}else{logger['info'](_0x446e('0xf'),_0x240d85,'request\x20sent');_0x53f333(_0x5ba157[_0x446e('0x17')][_0x446e('0x16')]);}})[_0x446e('0x18')](function(_0x4f77bf){logger[_0x446e('0x15')]('SquareRecording,\x20%s,\x20%s',_0x240d85,_0x4f77bf);_0xdd8616(_0x4f77bf);});});}exports[_0x446e('0x19')]=function(_0x44f317){var _0x4ca77a=this;return new Promise(function(_0x1efe98,_0x4d717c){return db[_0x446e('0x1a')]['create'](_0x44f317['body'],{'raw':_0x44f317[_0x446e('0x1b')]?_0x44f317[_0x446e('0x1b')][_0x446e('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x4d7d4b){logger[_0x446e('0x1d')](_0x446e('0x19'),_0x44f317);logger[_0x446e('0x11')](_0x446e('0x19'),_0x44f317,JSON[_0x446e('0x13')](_0x4d7d4b));_0x1efe98(_0x4d7d4b);})[_0x446e('0x18')](function(_0x17d3ac){logger[_0x446e('0x15')](_0x446e('0x19'),_0x17d3ac['message'],_0x44f317);_0x4d717c(_0x4ca77a[_0x446e('0x15')](0x1f4,_0x17d3ac[_0x446e('0x16')]));});});}; \ No newline at end of file +var _0xe0c7=['info','SquareRecording,\x20%s,\x20%s','debug','request\x20sent','stringify','code','error','message','result','SquareRecording','create','options','raw','CreateSquareRecording','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0c7,0x1a5));var _0x7e0c=function(_0x568975,_0x1f66b1){_0x568975=_0x568975-0x0;var _0x34461b=_0xe0c7[_0x568975];return _0x34461b;};'use strict';var _=require(_0x7e0c('0x0'));var util=require(_0x7e0c('0x1'));var moment=require(_0x7e0c('0x2'));var BPromise=require(_0x7e0c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e0c('0x4'));var db=require(_0x7e0c('0x5'))['db'];var utils=require(_0x7e0c('0x6'));var logger=require(_0x7e0c('0x7'))(_0x7e0c('0x8'));var config=require(_0x7e0c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7e0c('0xa')][_0x7e0c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x29795d,_0x34893b,_0x5d75a6){return new BPromise(function(_0x2ad8f9,_0x589cd2){return client[_0x7e0c('0xc')](_0x29795d,_0x5d75a6)[_0x7e0c('0xd')](function(_0x5e37ca){logger[_0x7e0c('0xe')](_0x7e0c('0xf'),_0x34893b,'request\x20sent');logger[_0x7e0c('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x34893b,_0x7e0c('0x11'),JSON[_0x7e0c('0x12')](_0x5e37ca));if(_0x5e37ca['error']){if(_0x5e37ca['error'][_0x7e0c('0x13')]===0x1f4){logger[_0x7e0c('0x14')](_0x7e0c('0xf'),_0x34893b,_0x5e37ca[_0x7e0c('0x14')][_0x7e0c('0x15')]);return _0x589cd2(_0x5e37ca['error'][_0x7e0c('0x15')]);}logger['error'](_0x7e0c('0xf'),_0x34893b,_0x5e37ca['error']['message']);return _0x2ad8f9(_0x5e37ca[_0x7e0c('0x14')][_0x7e0c('0x15')]);}else{logger[_0x7e0c('0xe')](_0x7e0c('0xf'),_0x34893b,_0x7e0c('0x11'));_0x2ad8f9(_0x5e37ca[_0x7e0c('0x16')][_0x7e0c('0x15')]);}})['catch'](function(_0xf1db3){logger[_0x7e0c('0x14')](_0x7e0c('0xf'),_0x34893b,_0xf1db3);_0x589cd2(_0xf1db3);});});}exports['CreateSquareRecording']=function(_0x16c0b4){var _0x30fca9=this;return new Promise(function(_0x160b3e,_0x4a92a9){return db[_0x7e0c('0x17')][_0x7e0c('0x18')](_0x16c0b4['body'],{'raw':_0x16c0b4[_0x7e0c('0x19')]?_0x16c0b4[_0x7e0c('0x19')][_0x7e0c('0x1a')]===undefined?!![]:![]:!![]})[_0x7e0c('0xd')](function(_0x514074){logger['info'](_0x7e0c('0x1b'),_0x16c0b4);logger[_0x7e0c('0x10')]('CreateSquareRecording',_0x16c0b4,JSON[_0x7e0c('0x12')](_0x514074));_0x160b3e(_0x514074);})[_0x7e0c('0x1c')](function(_0x336c9d){logger[_0x7e0c('0x14')](_0x7e0c('0x1b'),_0x336c9d[_0x7e0c('0x15')],_0x16c0b4);_0x4a92a9(_0x30fca9[_0x7e0c('0x14')](0x1f4,_0x336c9d[_0x7e0c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index e5f7220..267cb99 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x3db622,_0x14e98b){var _0x37d2ee=function(_0x51b487){while(--_0x51b487){_0x3db622['push'](_0x3db622['shift']());}};_0x37d2ee(++_0x14e98b);}(_0xe706,0xa3));var _0x6e70=function(_0x403c57,_0x280a51){_0x403c57=_0x403c57-0x0;var _0x35fa69=_0xe706[_0x403c57];return _0x35fa69;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0xfc0976,_0x33776f){var _0x23579f=function(_0x4143d9){while(--_0x4143d9){_0xfc0976['push'](_0xfc0976['shift']());}};_0x23579f(++_0x33776f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 8c0ba5c..b311dca 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 _0xa3f0=['sequelize','STRING','DATE'];(function(_0x3b794b,_0x325186){var _0x2a9fa3=function(_0x5f3427){while(--_0x5f3427){_0x3b794b['push'](_0x3b794b['shift']());}};_0x2a9fa3(++_0x325186);}(_0xa3f0,0x1ad));var _0x0a3f=function(_0x770f7,_0x3af003){_0x770f7=_0x770f7-0x0;var _0xe797c6=_0xa3f0[_0x770f7];return _0xe797c6;};'use strict';var Sequelize=require(_0x0a3f('0x0'));module['exports']={'network':{'type':Sequelize[_0x0a3f('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x0a3f('0x1')]},'channel':{'type':Sequelize[_0x0a3f('0x1')]},'language':{'type':Sequelize[_0x0a3f('0x1')]},'type':{'type':Sequelize[_0x0a3f('0x1')]},'uniqueid':{'type':Sequelize[_0x0a3f('0x1')]},'version':{'type':Sequelize[_0x0a3f('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a3f('0x1')]},'callingpres':{'type':Sequelize[_0x0a3f('0x1')]},'callingani2':{'type':Sequelize[_0x0a3f('0x1')]},'callington':{'type':Sequelize[_0x0a3f('0x1')]},'callingtns':{'type':Sequelize[_0x0a3f('0x1')]},'dnid':{'type':Sequelize[_0x0a3f('0x1')]},'rdnis':{'type':Sequelize[_0x0a3f('0x1')]},'context':{'type':Sequelize[_0x0a3f('0x1')]},'extension':{'type':Sequelize[_0x0a3f('0x1')]},'priority':{'type':Sequelize[_0x0a3f('0x1')]},'enhanced':{'type':Sequelize[_0x0a3f('0x1')]},'accountcode':{'type':Sequelize[_0x0a3f('0x1')]},'threadid':{'type':Sequelize[_0x0a3f('0x1')]},'project_name':{'type':Sequelize[_0x0a3f('0x1')]},'joinAt':{'type':Sequelize[_0x0a3f('0x2')]},'leaveAt':{'type':Sequelize[_0x0a3f('0x2')]},'bot':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x0b6a=['BOOLEAN','sequelize','exports','STRING','DATE'];(function(_0x37810c,_0x480382){var _0x44c4ef=function(_0x1daddc){while(--_0x1daddc){_0x37810c['push'](_0x37810c['shift']());}};_0x44c4ef(++_0x480382);}(_0x0b6a,0x10f));var _0xa0b6=function(_0x253901,_0x181aee){_0x253901=_0x253901-0x0;var _0x1751ad=_0x0b6a[_0x253901];return _0x1751ad;};'use strict';var Sequelize=require(_0xa0b6('0x0'));module[_0xa0b6('0x1')]={'network':{'type':Sequelize[_0xa0b6('0x2')]},'network_script':{'type':Sequelize[_0xa0b6('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xa0b6('0x2')]},'language':{'type':Sequelize[_0xa0b6('0x2')]},'type':{'type':Sequelize[_0xa0b6('0x2')]},'uniqueid':{'type':Sequelize[_0xa0b6('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa0b6('0x2')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0xa0b6('0x2')]},'callingani2':{'type':Sequelize[_0xa0b6('0x2')]},'callington':{'type':Sequelize[_0xa0b6('0x2')]},'callingtns':{'type':Sequelize[_0xa0b6('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xa0b6('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa0b6('0x2')]},'enhanced':{'type':Sequelize[_0xa0b6('0x2')]},'accountcode':{'type':Sequelize[_0xa0b6('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize[_0xa0b6('0x2')]},'joinAt':{'type':Sequelize[_0xa0b6('0x3')]},'leaveAt':{'type':Sequelize[_0xa0b6('0x3')]},'bot':{'type':Sequelize[_0xa0b6('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 98ca5b8..b226cba 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 _0xc6c0=['include','find','catch','create','body','update','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','limit','undefined','count','offset','set','json','apply','reject','save','then','destroy','status','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','rows','show','keys'];(function(_0x1ca846,_0x5e6cdf){var _0x1e523d=function(_0x2cd9a2){while(--_0x2cd9a2){_0x1ca846['push'](_0x1ca846['shift']());}};_0x1e523d(++_0x5e6cdf);}(_0xc6c0,0x1d5));var _0x0c6c=function(_0x2f4c1c,_0x5a3dd4){_0x2f4c1c=_0x2f4c1c-0x0;var _0x25e0f2=_0xc6c0[_0x2f4c1c];return _0x25e0f2;};'use strict';var emlformat=require(_0x0c6c('0x0'));var rimraf=require(_0x0c6c('0x1'));var zipdir=require(_0x0c6c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0c6c('0x3'));var moment=require(_0x0c6c('0x4'));var BPromise=require(_0x0c6c('0x5'));var Mustache=require(_0x0c6c('0x6'));var util=require(_0x0c6c('0x7'));var path=require(_0x0c6c('0x8'));var sox=require(_0x0c6c('0x9'));var csv=require(_0x0c6c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0c6c('0xb'));var _=require(_0x0c6c('0xc'));var squel=require(_0x0c6c('0xd'));var crypto=require(_0x0c6c('0xe'));var jsforce=require(_0x0c6c('0xf'));var deskjs=require(_0x0c6c('0x10'));var toCsv=require(_0x0c6c('0xa'));var querystring=require('querystring');var Papa=require(_0x0c6c('0x11'));var Redis=require(_0x0c6c('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x0c6c('0x13'));var as=require(_0x0c6c('0x14'));var hardwareService=require(_0x0c6c('0x15'));var logger=require(_0x0c6c('0x16'))(_0x0c6c('0x17'));var utils=require(_0x0c6c('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x0c6c('0x19'));var db=require(_0x0c6c('0x1a'))['db'];function respondWithStatusCode(_0x41b71c,_0x8aef05){_0x8aef05=_0x8aef05||0xcc;return function(_0x321270){if(_0x321270){return _0x41b71c[_0x0c6c('0x1b')](_0x8aef05);}return _0x41b71c['status'](_0x8aef05)[_0x0c6c('0x1c')]();};}function respondWithResult(_0x43ebf0,_0x609683){_0x609683=_0x609683||0xc8;return function(_0x263d4d){if(_0x263d4d){return _0x43ebf0['status'](_0x609683)['json'](_0x263d4d);}};}function respondWithFilteredResult(_0x13926f,_0x3af5cb){return function(_0xfc010a){if(_0xfc010a){var _0x1aa854=typeof _0x3af5cb['offset']==='undefined'&&typeof _0x3af5cb[_0x0c6c('0x1d')]===_0x0c6c('0x1e');var _0x58c9c0=_0xfc010a[_0x0c6c('0x1f')];var _0x323cd0=_0x1aa854?0x0:_0x3af5cb[_0x0c6c('0x20')];var _0xf94bf2=_0x1aa854?_0xfc010a['count']:_0x3af5cb[_0x0c6c('0x20')]+_0x3af5cb[_0x0c6c('0x1d')];var _0x13872e;if(_0xf94bf2>=_0x58c9c0){_0xf94bf2=_0x58c9c0;_0x13872e=0xc8;}else{_0x13872e=0xce;}_0x13926f['status'](_0x13872e);return _0x13926f[_0x0c6c('0x21')]('Content-Range',_0x323cd0+'-'+_0xf94bf2+'/'+_0x58c9c0)[_0x0c6c('0x22')](_0xfc010a);}return null;};}function patchUpdates(_0x1d5d14){return function(_0x16ba2c){try{jsonpatch[_0x0c6c('0x23')](_0x16ba2c,_0x1d5d14,!![]);}catch(_0x570c08){return BPromise[_0x0c6c('0x24')](_0x570c08);}return _0x16ba2c[_0x0c6c('0x25')]();};}function saveUpdates(_0xb871c5,_0x22fa59){return function(_0x39d306){if(_0x39d306){return _0x39d306['update'](_0xb871c5)[_0x0c6c('0x26')](function(_0x341f88){return _0x341f88;});}return null;};}function removeEntity(_0x27e921,_0x3ae3be){return function(_0x40aad7){if(_0x40aad7){return _0x40aad7[_0x0c6c('0x27')]()[_0x0c6c('0x26')](function(){_0x27e921[_0x0c6c('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5816fa,_0x5ccadf){return function(_0x27ce95){if(!_0x27ce95){_0x5816fa[_0x0c6c('0x1b')](0x194);}return _0x27ce95;};}function handleError(_0x359756,_0xfd7777){_0xfd7777=_0xfd7777||0x1f4;return function(_0x31cdbd){logger[_0x0c6c('0x29')](_0x31cdbd[_0x0c6c('0x2a')]);if(_0x31cdbd[_0x0c6c('0x2b')]){delete _0x31cdbd[_0x0c6c('0x2b')];}_0x359756[_0x0c6c('0x28')](_0xfd7777)[_0x0c6c('0x2c')](_0x31cdbd);};}exports[_0x0c6c('0x2d')]=function(_0x58b284,_0x509311){var _0x9e3f89={},_0x1462e7={},_0x27fdfb={'count':0x0,'rows':[]};var _0x5e5a30=_[_0x0c6c('0x2e')](db[_0x0c6c('0x2f')][_0x0c6c('0x30')],function(_0x13797d){return{'name':_0x13797d[_0x0c6c('0x31')],'type':_0x13797d[_0x0c6c('0x32')]['key']};});_0x1462e7[_0x0c6c('0x33')]=_[_0x0c6c('0x2e')](_0x5e5a30,_0x0c6c('0x2b'));_0x1462e7[_0x0c6c('0x34')]=_['keys'](_0x58b284[_0x0c6c('0x34')]);_0x1462e7[_0x0c6c('0x35')]=_[_0x0c6c('0x36')](_0x1462e7['model'],_0x1462e7['query']);_0x9e3f89[_0x0c6c('0x37')]=_['intersection'](_0x1462e7[_0x0c6c('0x33')],qs[_0x0c6c('0x38')](_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x38')]));_0x9e3f89[_0x0c6c('0x37')]=_0x9e3f89[_0x0c6c('0x37')][_0x0c6c('0x39')]?_0x9e3f89[_0x0c6c('0x37')]:_0x1462e7[_0x0c6c('0x33')];if(!_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x3a')](_0x0c6c('0x3b'))){_0x9e3f89[_0x0c6c('0x1d')]=qs[_0x0c6c('0x1d')](_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x1d')]);_0x9e3f89[_0x0c6c('0x20')]=qs[_0x0c6c('0x20')](_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x20')]);}_0x9e3f89[_0x0c6c('0x3c')]=qs[_0x0c6c('0x3d')](_0x58b284['query'][_0x0c6c('0x3d')]);_0x9e3f89[_0x0c6c('0x3e')]=qs[_0x0c6c('0x35')](_['pick'](_0x58b284['query'],_0x1462e7[_0x0c6c('0x35')]),_0x5e5a30);if(_0x58b284['query']['filter']){_0x9e3f89['where']=_[_0x0c6c('0x3f')](_0x9e3f89[_0x0c6c('0x3e')],{'$or':_[_0x0c6c('0x2e')](_0x5e5a30,function(_0x4cb871){if(_0x4cb871[_0x0c6c('0x32')]!==_0x0c6c('0x40')){var _0x42a9cf={};_0x42a9cf[_0x4cb871[_0x0c6c('0x2b')]]={'$like':'%'+_0x58b284[_0x0c6c('0x34')]['filter']+'%'};return _0x42a9cf;}})});}_0x9e3f89=_[_0x0c6c('0x3f')]({},_0x9e3f89,_0x58b284[_0x0c6c('0x41')]);var _0x5dfceb={'where':_0x9e3f89[_0x0c6c('0x3e')]};return db[_0x0c6c('0x2f')]['count'](_0x5dfceb)[_0x0c6c('0x26')](function(_0x262ea6){_0x27fdfb[_0x0c6c('0x1f')]=_0x262ea6;if(_0x58b284[_0x0c6c('0x34')][_0x0c6c('0x42')]){_0x9e3f89['include']=[{'all':!![]}];}return db[_0x0c6c('0x2f')]['findAll'](_0x9e3f89);})[_0x0c6c('0x26')](function(_0x36dac1){_0x27fdfb[_0x0c6c('0x43')]=_0x36dac1;return _0x27fdfb;})[_0x0c6c('0x26')](respondWithFilteredResult(_0x509311,_0x9e3f89))['catch'](handleError(_0x509311,null));};exports[_0x0c6c('0x44')]=function(_0x31d3f2,_0x421e16){var _0x286033={'raw':!![],'where':{'id':_0x31d3f2['params']['id']}},_0x5d3212={};_0x5d3212[_0x0c6c('0x33')]=_['keys'](db[_0x0c6c('0x2f')][_0x0c6c('0x30')]);_0x5d3212[_0x0c6c('0x34')]=_[_0x0c6c('0x45')](_0x31d3f2[_0x0c6c('0x34')]);_0x5d3212[_0x0c6c('0x35')]=_['intersection'](_0x5d3212['model'],_0x5d3212[_0x0c6c('0x34')]);_0x286033['attributes']=_[_0x0c6c('0x36')](_0x5d3212['model'],qs[_0x0c6c('0x38')](_0x31d3f2[_0x0c6c('0x34')]['fields']));_0x286033[_0x0c6c('0x37')]=_0x286033['attributes']['length']?_0x286033['attributes']:_0x5d3212[_0x0c6c('0x33')];if(_0x31d3f2[_0x0c6c('0x34')][_0x0c6c('0x42')]){_0x286033[_0x0c6c('0x46')]=[{'all':!![]}];}_0x286033=_['merge']({},_0x286033,_0x31d3f2[_0x0c6c('0x41')]);return db[_0x0c6c('0x2f')][_0x0c6c('0x47')](_0x286033)[_0x0c6c('0x26')](handleEntityNotFound(_0x421e16,null))[_0x0c6c('0x26')](respondWithResult(_0x421e16,null))[_0x0c6c('0x48')](handleError(_0x421e16,null));};exports[_0x0c6c('0x49')]=function(_0x2f1555,_0x4cd7b7){return db[_0x0c6c('0x2f')][_0x0c6c('0x49')](_0x2f1555[_0x0c6c('0x4a')],{})[_0x0c6c('0x26')](respondWithResult(_0x4cd7b7,0xc9))['catch'](handleError(_0x4cd7b7,null));};exports[_0x0c6c('0x4b')]=function(_0x1added,_0x137b3a){if(_0x1added[_0x0c6c('0x4a')]['id']){delete _0x1added[_0x0c6c('0x4a')]['id'];}return db[_0x0c6c('0x2f')][_0x0c6c('0x47')]({'where':{'id':_0x1added[_0x0c6c('0x4c')]['id']}})[_0x0c6c('0x26')](handleEntityNotFound(_0x137b3a,null))['then'](saveUpdates(_0x1added['body'],null))[_0x0c6c('0x26')](respondWithResult(_0x137b3a,null))[_0x0c6c('0x48')](handleError(_0x137b3a,null));};exports[_0x0c6c('0x27')]=function(_0x204299,_0x32c202){return db[_0x0c6c('0x2f')]['find']({'where':{'id':_0x204299[_0x0c6c('0x4c')]['id']}})[_0x0c6c('0x26')](handleEntityNotFound(_0x32c202,null))[_0x0c6c('0x26')](removeEntity(_0x32c202,null))[_0x0c6c('0x48')](handleError(_0x32c202,null));};exports['describe']=function(_0x5c6f35,_0x18b8eb){return db[_0x0c6c('0x2f')]['describe']()[_0x0c6c('0x26')](respondWithResult(_0x18b8eb,null))[_0x0c6c('0x48')](handleError(_0x18b8eb,null));}; \ No newline at end of file +var _0xfd6e=['querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','type','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xfd6e,0xd9));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefd6('0x0'));var zipdir=require(_0xefd6('0x1'));var jsonpatch=require(_0xefd6('0x2'));var rp=require('request-promise');var moment=require(_0xefd6('0x3'));var BPromise=require(_0xefd6('0x4'));var Mustache=require(_0xefd6('0x5'));var util=require(_0xefd6('0x6'));var path=require(_0xefd6('0x7'));var sox=require('sox');var csv=require(_0xefd6('0x8'));var ejs=require(_0xefd6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefd6('0xa'));var squel=require(_0xefd6('0xb'));var crypto=require(_0xefd6('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xefd6('0xd'));var toCsv=require(_0xefd6('0x8'));var querystring=require(_0xefd6('0xe'));var Papa=require(_0xefd6('0xf'));var Redis=require(_0xefd6('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xefd6('0x11'));var as=require(_0xefd6('0x12'));var hardwareService=require(_0xefd6('0x13'));var logger=require(_0xefd6('0x14'))(_0xefd6('0x15'));var utils=require('../../config/utils');var config=require(_0xefd6('0x16'));var licenseUtil=require(_0xefd6('0x17'));var db=require(_0xefd6('0x18'))['db'];function respondWithStatusCode(_0x28ca86,_0x51258c){_0x51258c=_0x51258c||0xcc;return function(_0x3baee5){if(_0x3baee5){return _0x28ca86[_0xefd6('0x19')](_0x51258c);}return _0x28ca86[_0xefd6('0x1a')](_0x51258c)[_0xefd6('0x1b')]();};}function respondWithResult(_0x456357,_0x44e89e){_0x44e89e=_0x44e89e||0xc8;return function(_0x15b4c7){if(_0x15b4c7){return _0x456357['status'](_0x44e89e)[_0xefd6('0x1c')](_0x15b4c7);}};}function respondWithFilteredResult(_0x1b5414,_0x1ecccf){return function(_0xa763c9){if(_0xa763c9){var _0x4d6c94=typeof _0x1ecccf[_0xefd6('0x1d')]==='undefined'&&typeof _0x1ecccf[_0xefd6('0x1e')]===_0xefd6('0x1f');var _0x1965a9=_0xa763c9[_0xefd6('0x20')];var _0xf04063=_0x4d6c94?0x0:_0x1ecccf[_0xefd6('0x1d')];var _0x3c60da=_0x4d6c94?_0xa763c9[_0xefd6('0x20')]:_0x1ecccf[_0xefd6('0x1d')]+_0x1ecccf[_0xefd6('0x1e')];var _0xb626dc;if(_0x3c60da>=_0x1965a9){_0x3c60da=_0x1965a9;_0xb626dc=0xc8;}else{_0xb626dc=0xce;}_0x1b5414['status'](_0xb626dc);return _0x1b5414[_0xefd6('0x21')](_0xefd6('0x22'),_0xf04063+'-'+_0x3c60da+'/'+_0x1965a9)[_0xefd6('0x1c')](_0xa763c9);}return null;};}function patchUpdates(_0x281f71){return function(_0x2b7daf){try{jsonpatch[_0xefd6('0x23')](_0x2b7daf,_0x281f71,!![]);}catch(_0x1a65cc){return BPromise[_0xefd6('0x24')](_0x1a65cc);}return _0x2b7daf[_0xefd6('0x25')]();};}function saveUpdates(_0xd1ccf6,_0x9cc465){return function(_0x21fc6a){if(_0x21fc6a){return _0x21fc6a[_0xefd6('0x26')](_0xd1ccf6)[_0xefd6('0x27')](function(_0x2c1b21){return _0x2c1b21;});}return null;};}function removeEntity(_0x7f8f78,_0x55f785){return function(_0x511ec3){if(_0x511ec3){return _0x511ec3[_0xefd6('0x28')]()[_0xefd6('0x27')](function(){_0x7f8f78[_0xefd6('0x1a')](0xcc)[_0xefd6('0x1b')]();});}};}function handleEntityNotFound(_0x341a82,_0x3b85b9){return function(_0x5d0530){if(!_0x5d0530){_0x341a82[_0xefd6('0x19')](0x194);}return _0x5d0530;};}function handleError(_0x55f4f1,_0x445708){_0x445708=_0x445708||0x1f4;return function(_0x508bef){logger[_0xefd6('0x29')](_0x508bef[_0xefd6('0x2a')]);if(_0x508bef[_0xefd6('0x2b')]){delete _0x508bef[_0xefd6('0x2b')];}_0x55f4f1[_0xefd6('0x1a')](_0x445708)[_0xefd6('0x2c')](_0x508bef);};}exports['index']=function(_0x35ccb0,_0x3345a7){var _0x2ffb42={},_0x5c00ca={},_0x51dea2={'count':0x0,'rows':[]};var _0x5cf651=_[_0xefd6('0x2d')](db[_0xefd6('0x2e')][_0xefd6('0x2f')],function(_0x215b5d){return{'name':_0x215b5d['fieldName'],'type':_0x215b5d['type'][_0xefd6('0x30')]};});_0x5c00ca[_0xefd6('0x31')]=_[_0xefd6('0x2d')](_0x5cf651,_0xefd6('0x2b'));_0x5c00ca[_0xefd6('0x32')]=_[_0xefd6('0x33')](_0x35ccb0[_0xefd6('0x32')]);_0x5c00ca[_0xefd6('0x34')]=_[_0xefd6('0x35')](_0x5c00ca['model'],_0x5c00ca['query']);_0x2ffb42[_0xefd6('0x36')]=_[_0xefd6('0x35')](_0x5c00ca[_0xefd6('0x31')],qs[_0xefd6('0x37')](_0x35ccb0[_0xefd6('0x32')][_0xefd6('0x37')]));_0x2ffb42[_0xefd6('0x36')]=_0x2ffb42[_0xefd6('0x36')][_0xefd6('0x38')]?_0x2ffb42[_0xefd6('0x36')]:_0x5c00ca['model'];if(!_0x35ccb0[_0xefd6('0x32')][_0xefd6('0x39')]('nolimit')){_0x2ffb42[_0xefd6('0x1e')]=qs['limit'](_0x35ccb0[_0xefd6('0x32')][_0xefd6('0x1e')]);_0x2ffb42[_0xefd6('0x1d')]=qs['offset'](_0x35ccb0[_0xefd6('0x32')]['offset']);}_0x2ffb42[_0xefd6('0x3a')]=qs[_0xefd6('0x3b')](_0x35ccb0['query']['sort']);_0x2ffb42[_0xefd6('0x3c')]=qs[_0xefd6('0x34')](_[_0xefd6('0x3d')](_0x35ccb0[_0xefd6('0x32')],_0x5c00ca[_0xefd6('0x34')]),_0x5cf651);if(_0x35ccb0[_0xefd6('0x32')][_0xefd6('0x3e')]){_0x2ffb42[_0xefd6('0x3c')]=_['merge'](_0x2ffb42[_0xefd6('0x3c')],{'$or':_['map'](_0x5cf651,function(_0x463454){if(_0x463454[_0xefd6('0x3f')]!=='VIRTUAL'){var _0x1a5333={};_0x1a5333[_0x463454[_0xefd6('0x2b')]]={'$like':'%'+_0x35ccb0[_0xefd6('0x32')][_0xefd6('0x3e')]+'%'};return _0x1a5333;}})});}_0x2ffb42=_['merge']({},_0x2ffb42,_0x35ccb0[_0xefd6('0x40')]);var _0x5dc7d6={'where':_0x2ffb42['where']};return db[_0xefd6('0x2e')][_0xefd6('0x20')](_0x5dc7d6)[_0xefd6('0x27')](function(_0x1ab554){_0x51dea2[_0xefd6('0x20')]=_0x1ab554;if(_0x35ccb0['query'][_0xefd6('0x41')]){_0x2ffb42[_0xefd6('0x42')]=[{'all':!![]}];}return db[_0xefd6('0x2e')][_0xefd6('0x43')](_0x2ffb42);})[_0xefd6('0x27')](function(_0x4fce6b){_0x51dea2[_0xefd6('0x44')]=_0x4fce6b;return _0x51dea2;})[_0xefd6('0x27')](respondWithFilteredResult(_0x3345a7,_0x2ffb42))[_0xefd6('0x45')](handleError(_0x3345a7,null));};exports[_0xefd6('0x46')]=function(_0x28510c,_0x46e0a8){var _0xefe91a={'raw':!![],'where':{'id':_0x28510c[_0xefd6('0x47')]['id']}},_0x2e219d={};_0x2e219d[_0xefd6('0x31')]=_[_0xefd6('0x33')](db['SquareReport'][_0xefd6('0x2f')]);_0x2e219d['query']=_[_0xefd6('0x33')](_0x28510c[_0xefd6('0x32')]);_0x2e219d['filters']=_[_0xefd6('0x35')](_0x2e219d[_0xefd6('0x31')],_0x2e219d[_0xefd6('0x32')]);_0xefe91a[_0xefd6('0x36')]=_[_0xefd6('0x35')](_0x2e219d[_0xefd6('0x31')],qs[_0xefd6('0x37')](_0x28510c[_0xefd6('0x32')]['fields']));_0xefe91a[_0xefd6('0x36')]=_0xefe91a['attributes'][_0xefd6('0x38')]?_0xefe91a[_0xefd6('0x36')]:_0x2e219d[_0xefd6('0x31')];if(_0x28510c['query'][_0xefd6('0x41')]){_0xefe91a[_0xefd6('0x42')]=[{'all':!![]}];}_0xefe91a=_[_0xefd6('0x48')]({},_0xefe91a,_0x28510c[_0xefd6('0x40')]);return db[_0xefd6('0x2e')][_0xefd6('0x49')](_0xefe91a)[_0xefd6('0x27')](handleEntityNotFound(_0x46e0a8,null))['then'](respondWithResult(_0x46e0a8,null))[_0xefd6('0x45')](handleError(_0x46e0a8,null));};exports[_0xefd6('0x4a')]=function(_0x1d851a,_0x2a45f8){return db['SquareReport'][_0xefd6('0x4a')](_0x1d851a[_0xefd6('0x4b')],{})[_0xefd6('0x27')](respondWithResult(_0x2a45f8,0xc9))[_0xefd6('0x45')](handleError(_0x2a45f8,null));};exports['update']=function(_0x190b8e,_0x3cc273){if(_0x190b8e[_0xefd6('0x4b')]['id']){delete _0x190b8e[_0xefd6('0x4b')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x190b8e[_0xefd6('0x47')]['id']}})[_0xefd6('0x27')](handleEntityNotFound(_0x3cc273,null))[_0xefd6('0x27')](saveUpdates(_0x190b8e['body'],null))[_0xefd6('0x27')](respondWithResult(_0x3cc273,null))['catch'](handleError(_0x3cc273,null));};exports[_0xefd6('0x28')]=function(_0x221f5b,_0x5ca8f3){return db['SquareReport'][_0xefd6('0x49')]({'where':{'id':_0x221f5b[_0xefd6('0x47')]['id']}})[_0xefd6('0x27')](handleEntityNotFound(_0x5ca8f3,null))['then'](removeEntity(_0x5ca8f3,null))['catch'](handleError(_0x5ca8f3,null));};exports[_0xefd6('0x4c')]=function(_0x2b5c9b,_0x1d4acf){return db[_0xefd6('0x2e')]['describe']()['then'](respondWithResult(_0x1d4acf,null))[_0xefd6('0x45')](handleError(_0x1d4acf,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1a0149b..63081ee 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 _0xb805=['path','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uniqueid','project_name','leaveAt','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13f6fe,_0x4864c0){var _0x49aafb=function(_0x61e319){while(--_0x61e319){_0x13f6fe['push'](_0x13f6fe['shift']());}};_0x49aafb(++_0x4864c0);}(_0xb805,0x72));var _0x5b80=function(_0x487252,_0x51cd99){_0x487252=_0x487252-0x0;var _0x472e06=_0xb805[_0x487252];return _0x472e06;};'use strict';var _=require(_0x5b80('0x0'));var util=require('util');var logger=require(_0x5b80('0x1'))(_0x5b80('0x2'));var moment=require(_0x5b80('0x3'));var BPromise=require(_0x5b80('0x4'));var rp=require(_0x5b80('0x5'));var fs=require('fs');var path=require(_0x5b80('0x6'));var rimraf=require('rimraf');var config=require(_0x5b80('0x7'));var attributes=require(_0x5b80('0x8'));module[_0x5b80('0x9')]=function(_0x5159fb,_0x4dcaf5){return _0x5159fb['define'](_0x5b80('0xa'),attributes,{'tableName':_0x5b80('0xb'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x5b80('0xc'),_0x5b80('0xd')]},{'name':_0x5b80('0xe'),'fields':[_0x5b80('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb159=['uniqueid','project_name','leaveAt','lodash','util','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb159,0xb9));var _0x9b15=function(_0x4e242d,_0x31bc14){_0x4e242d=_0x4e242d-0x0;var _0x4a34b5=_0xb159[_0x4e242d];return _0x4a34b5;};'use strict';var _=require(_0x9b15('0x0'));var util=require(_0x9b15('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x9b15('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9b15('0x3'));var config=require(_0x9b15('0x4'));var attributes=require(_0x9b15('0x5'));module[_0x9b15('0x6')]=function(_0x2d06bd,_0x269549){return _0x2d06bd[_0x9b15('0x7')](_0x9b15('0x8'),attributes,{'tableName':_0x9b15('0x9'),'paranoid':![],'indexes':[{'name':_0x9b15('0xa'),'fields':[_0x9b15('0xb'),_0x9b15('0xc')]},{'name':_0x9b15('0xd'),'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 195dfaa..9b2a6c4 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 _0xaab4=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','SquareReport,\x20%s,\x20%s','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xaab4,0x110));var _0x4aab=function(_0xa81649,_0x1d180f){_0xa81649=_0xa81649-0x0;var _0x5c02a0=_0xaab4[_0xa81649];return _0x5c02a0;};'use strict';var _=require(_0x4aab('0x0'));var util=require(_0x4aab('0x1'));var moment=require(_0x4aab('0x2'));var BPromise=require(_0x4aab('0x3'));var rs=require(_0x4aab('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4aab('0x5'))['db'];var utils=require(_0x4aab('0x6'));var logger=require(_0x4aab('0x7'))(_0x4aab('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4aab('0x9')][_0x4aab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1728e7,_0x40a4ee,_0x55ee89){return new BPromise(function(_0x32eec2,_0x4ccd07){return client[_0x4aab('0xb')](_0x1728e7,_0x55ee89)[_0x4aab('0xc')](function(_0x4c71d3){logger[_0x4aab('0xd')]('SquareReport,\x20%s,\x20%s',_0x40a4ee,_0x4aab('0xe'));logger[_0x4aab('0xf')](_0x4aab('0x10'),_0x40a4ee,_0x4aab('0xe'),JSON[_0x4aab('0x11')](_0x4c71d3));if(_0x4c71d3[_0x4aab('0x12')]){if(_0x4c71d3[_0x4aab('0x12')]['code']===0x1f4){logger[_0x4aab('0x12')]('SquareReport,\x20%s,\x20%s',_0x40a4ee,_0x4c71d3[_0x4aab('0x12')]['message']);return _0x4ccd07(_0x4c71d3[_0x4aab('0x12')][_0x4aab('0x13')]);}logger[_0x4aab('0x12')](_0x4aab('0x14'),_0x40a4ee,_0x4c71d3[_0x4aab('0x12')]['message']);return _0x32eec2(_0x4c71d3[_0x4aab('0x12')][_0x4aab('0x13')]);}else{logger[_0x4aab('0xd')](_0x4aab('0x14'),_0x40a4ee,_0x4aab('0xe'));_0x32eec2(_0x4c71d3[_0x4aab('0x15')][_0x4aab('0x13')]);}})['catch'](function(_0x621e93){logger[_0x4aab('0x12')]('SquareReport,\x20%s,\x20%s',_0x40a4ee,_0x621e93);_0x4ccd07(_0x621e93);});});}exports[_0x4aab('0x16')]=function(_0x170cb6){var _0x22ec72=this;return new Promise(function(_0x219299,_0x2389f1){return db[_0x4aab('0x17')][_0x4aab('0x18')](_0x170cb6[_0x4aab('0x19')],{'raw':_0x170cb6[_0x4aab('0x1a')]?_0x170cb6['options'][_0x4aab('0x1b')]===undefined?!![]:![]:!![]})[_0x4aab('0xc')](function(_0x44a9c2){logger[_0x4aab('0xd')]('CreateSquareReport',_0x170cb6);logger['debug'](_0x4aab('0x16'),_0x170cb6,JSON['stringify'](_0x44a9c2));_0x219299(_0x44a9c2);})[_0x4aab('0x1c')](function(_0x1801f1){logger['error']('CreateSquareReport',_0x1801f1[_0x4aab('0x13')],_0x170cb6);_0x2389f1(_0x22ec72['error'](0x1f4,_0x1801f1[_0x4aab('0x13')]));});});};exports[_0x4aab('0x1d')]=function(_0x2e2ac6){var _0x2e3dd9=this;return new Promise(function(_0x1c5d98,_0x122a06){return db['SquareReport'][_0x4aab('0x1e')](_0x2e2ac6[_0x4aab('0x19')],{'raw':_0x2e2ac6[_0x4aab('0x1a')]?_0x2e2ac6[_0x4aab('0x1a')][_0x4aab('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e2ac6[_0x4aab('0x1a')]?_0x2e2ac6[_0x4aab('0x1a')]['where']||null:null,'attributes':_0x2e2ac6[_0x4aab('0x1a')]?_0x2e2ac6[_0x4aab('0x1a')]['attributes']||null:null,'limit':_0x2e2ac6['options']?_0x2e2ac6[_0x4aab('0x1a')][_0x4aab('0x1f')]||null:null})[_0x4aab('0xc')](function(_0x48a1e5){logger[_0x4aab('0xd')](_0x4aab('0x1d'),_0x2e2ac6);logger[_0x4aab('0xf')](_0x4aab('0x1d'),_0x2e2ac6,JSON[_0x4aab('0x11')](_0x48a1e5));_0x1c5d98(_0x48a1e5);})['catch'](function(_0x138a50){logger['error']('UpdateSquareReport',_0x138a50[_0x4aab('0x13')],_0x2e2ac6);_0x122a06(_0x2e3dd9[_0x4aab('0x12')](0x1f4,_0x138a50[_0x4aab('0x13')]));});});}; \ No newline at end of file +var _0x95ac=['update','body','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport'];(function(_0x527740,_0x2dee29){var _0x154fd0=function(_0x4508b1){while(--_0x4508b1){_0x527740['push'](_0x527740['shift']());}};_0x154fd0(++_0x2dee29);}(_0x95ac,0xa3));var _0xc95a=function(_0xc27400,_0x2b14f2){_0xc27400=_0xc27400-0x0;var _0x121a3b=_0x95ac[_0xc27400];return _0x121a3b;};'use strict';var _=require(_0xc95a('0x0'));var util=require(_0xc95a('0x1'));var moment=require(_0xc95a('0x2'));var BPromise=require(_0xc95a('0x3'));var rs=require(_0xc95a('0x4'));var fs=require('fs');var Redis=require(_0xc95a('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc95a('0x6'));var logger=require(_0xc95a('0x7'))(_0xc95a('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc95a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15c6d8,_0x4a96e9,_0x54735b){return new BPromise(function(_0x11e622,_0x3cdb13){return client[_0xc95a('0xa')](_0x15c6d8,_0x54735b)[_0xc95a('0xb')](function(_0x503f78){logger['info'](_0xc95a('0xc'),_0x4a96e9,_0xc95a('0xd'));logger[_0xc95a('0xe')](_0xc95a('0xf'),_0x4a96e9,_0xc95a('0xd'),JSON[_0xc95a('0x10')](_0x503f78));if(_0x503f78[_0xc95a('0x11')]){if(_0x503f78[_0xc95a('0x11')][_0xc95a('0x12')]===0x1f4){logger[_0xc95a('0x11')](_0xc95a('0xc'),_0x4a96e9,_0x503f78['error'][_0xc95a('0x13')]);return _0x3cdb13(_0x503f78[_0xc95a('0x11')]['message']);}logger['error']('SquareReport,\x20%s,\x20%s',_0x4a96e9,_0x503f78[_0xc95a('0x11')][_0xc95a('0x13')]);return _0x11e622(_0x503f78[_0xc95a('0x11')]['message']);}else{logger[_0xc95a('0x14')](_0xc95a('0xc'),_0x4a96e9,_0xc95a('0xd'));_0x11e622(_0x503f78[_0xc95a('0x15')]['message']);}})[_0xc95a('0x16')](function(_0x1357bb){logger['error'](_0xc95a('0xc'),_0x4a96e9,_0x1357bb);_0x3cdb13(_0x1357bb);});});}exports[_0xc95a('0x17')]=function(_0x2d82e6){var _0x5a7bc3=this;return new Promise(function(_0x2d12ac,_0x3f7062){return db[_0xc95a('0x18')][_0xc95a('0x19')](_0x2d82e6['body'],{'raw':_0x2d82e6[_0xc95a('0x1a')]?_0x2d82e6[_0xc95a('0x1a')][_0xc95a('0x1b')]===undefined?!![]:![]:!![]})[_0xc95a('0xb')](function(_0x345b5d){logger['info'](_0xc95a('0x17'),_0x2d82e6);logger[_0xc95a('0xe')](_0xc95a('0x17'),_0x2d82e6,JSON[_0xc95a('0x10')](_0x345b5d));_0x2d12ac(_0x345b5d);})['catch'](function(_0x475d61){logger[_0xc95a('0x11')](_0xc95a('0x17'),_0x475d61[_0xc95a('0x13')],_0x2d82e6);_0x3f7062(_0x5a7bc3['error'](0x1f4,_0x475d61[_0xc95a('0x13')]));});});};exports[_0xc95a('0x1c')]=function(_0x153577){var _0x114496=this;return new Promise(function(_0x1603e1,_0x3c1b97){return db['SquareReport'][_0xc95a('0x1d')](_0x153577[_0xc95a('0x1e')],{'raw':_0x153577['options']?_0x153577[_0xc95a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x153577[_0xc95a('0x1a')]?_0x153577[_0xc95a('0x1a')][_0xc95a('0x1f')]||null:null,'attributes':_0x153577['options']?_0x153577[_0xc95a('0x1a')]['attributes']||null:null,'limit':_0x153577['options']?_0x153577[_0xc95a('0x1a')]['limit']||null:null})['then'](function(_0x14d480){logger[_0xc95a('0x14')](_0xc95a('0x1c'),_0x153577);logger[_0xc95a('0xe')](_0xc95a('0x1c'),_0x153577,JSON[_0xc95a('0x10')](_0x14d480));_0x1603e1(_0x14d480);})['catch'](function(_0x3196bc){logger['error']('UpdateSquareReport',_0x3196bc[_0xc95a('0x13')],_0x153577);_0x3c1b97(_0x114496['error'](0x1f4,_0x3196bc[_0xc95a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index ca27549..9053f55 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 _0x829a=['describe','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','isAuthenticated','index'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x829a,0x120));var _0xa829=function(_0x14e5ef,_0x10cce4){_0x14e5ef=_0x14e5ef-0x0;var _0x5ce0db=_0x829a[_0x14e5ef];return _0x5ce0db;};'use strict';var multer=require(_0xa829('0x0'));var util=require(_0xa829('0x1'));var path=require('path');var timeout=require(_0xa829('0x2'));var express=require(_0xa829('0x3'));var router=express[_0xa829('0x4')]();var fs_extra=require(_0xa829('0x5'));var auth=require(_0xa829('0x6'));var interaction=require(_0xa829('0x7'));var config=require(_0xa829('0x8'));var controller=require(_0xa829('0x9'));router['get']('/',auth[_0xa829('0xa')](),controller[_0xa829('0xb')]);router['get']('/describe',auth[_0xa829('0xa')](),controller[_0xa829('0xc')]);router['get'](_0xa829('0xd'),auth[_0xa829('0xa')](),controller[_0xa829('0xe')]);router['post']('/',auth[_0xa829('0xa')](),controller['create']);router[_0xa829('0xf')](_0xa829('0xd'),auth[_0xa829('0xa')](),controller[_0xa829('0x10')]);router[_0xa829('0x11')](_0xa829('0xd'),auth[_0xa829('0xa')](),controller[_0xa829('0x12')]);module[_0xa829('0x13')]=router; \ No newline at end of file +var _0x6e3a=['exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','show','create','put','delete','destroy'];(function(_0x3e4f87,_0x3634af){var _0x5acd7a=function(_0x2d46b5){while(--_0x2d46b5){_0x3e4f87['push'](_0x3e4f87['shift']());}};_0x5acd7a(++_0x3634af);}(_0x6e3a,0x81));var _0xa6e3=function(_0x36641f,_0x1de996){_0x36641f=_0x36641f-0x0;var _0x264197=_0x6e3a[_0x36641f];return _0x264197;};'use strict';var multer=require('multer');var util=require(_0xa6e3('0x0'));var path=require(_0xa6e3('0x1'));var timeout=require(_0xa6e3('0x2'));var express=require(_0xa6e3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xa6e3('0x4'));var interaction=require(_0xa6e3('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0xa6e3('0x6')](),controller[_0xa6e3('0x7')]);router['get']('/describe',auth[_0xa6e3('0x6')](),controller['describe']);router[_0xa6e3('0x8')](_0xa6e3('0x9'),auth['isAuthenticated'](),controller[_0xa6e3('0xa')]);router['post']('/',auth[_0xa6e3('0x6')](),controller[_0xa6e3('0xb')]);router[_0xa6e3('0xc')](_0xa6e3('0x9'),auth[_0xa6e3('0x6')](),controller['update']);router[_0xa6e3('0xd')](_0xa6e3('0x9'),auth['isAuthenticated'](),controller[_0xa6e3('0xe')]);module[_0xa6e3('0xf')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index cd3f1b2..cfce0b4 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 _0xfda8=['sequelize','exports','STRING','TEXT'];(function(_0x5020fa,_0x1902e6){var _0x57de03=function(_0x490131){while(--_0x490131){_0x5020fa['push'](_0x5020fa['shift']());}};_0x57de03(++_0x1902e6);}(_0xfda8,0x170));var _0x8fda=function(_0x517f39,_0x2a2627){_0x517f39=_0x517f39-0x0;var _0x186f39=_0xfda8[_0x517f39];return _0x186f39;};'use strict';var Sequelize=require(_0x8fda('0x0'));module[_0x8fda('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x8fda('0x2')]},'application':{'type':Sequelize[_0x8fda('0x2')]},'data':{'type':Sequelize[_0x8fda('0x3')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5108=['TEXT','STRING'];(function(_0x322b8e,_0x576d02){var _0x3615a0=function(_0x2923df){while(--_0x2923df){_0x322b8e['push'](_0x322b8e['shift']());}};_0x3615a0(++_0x576d02);}(_0x5108,0x1e9));var _0x8510=function(_0x2dc368,_0x1f92d8){_0x2dc368=_0x2dc368-0x0;var _0x134a76=_0x5108[_0x2dc368];return _0x134a76;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x8510('0x0')]},'node':{'type':Sequelize[_0x8510('0x0')]},'application':{'type':Sequelize[_0x8510('0x0')]},'data':{'type':Sequelize[_0x8510('0x1')]},'project_name':{'type':Sequelize[_0x8510('0x0')]},'callerid':{'type':Sequelize[_0x8510('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index c418c9e..11af204 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 _0xcaf9=['length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','rawAttributes','include','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','json','apply','save','update','then','destroy','error','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields'];(function(_0x1cca37,_0x48f415){var _0x21b2fa=function(_0x4bd2cb){while(--_0x4bd2cb){_0x1cca37['push'](_0x1cca37['shift']());}};_0x21b2fa(++_0x48f415);}(_0xcaf9,0x19d));var _0x9caf=function(_0x2ca1b7,_0x22ae5e){_0x2ca1b7=_0x2ca1b7-0x0;var _0x51c98c=_0xcaf9[_0x2ca1b7];return _0x51c98c;};'use strict';var emlformat=require(_0x9caf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9caf('0x1'));var jsonpatch=require(_0x9caf('0x2'));var rp=require(_0x9caf('0x3'));var moment=require(_0x9caf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9caf('0x5'));var util=require(_0x9caf('0x6'));var path=require(_0x9caf('0x7'));var sox=require('sox');var csv=require(_0x9caf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9caf('0x9'));var _=require(_0x9caf('0xa'));var squel=require(_0x9caf('0xb'));var crypto=require('crypto');var jsforce=require(_0x9caf('0xc'));var deskjs=require(_0x9caf('0xd'));var toCsv=require(_0x9caf('0x8'));var querystring=require(_0x9caf('0xe'));var Papa=require(_0x9caf('0xf'));var Redis=require(_0x9caf('0x10'));var authService=require(_0x9caf('0x11'));var qs=require(_0x9caf('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9caf('0x13'));var logger=require('../../config/logger')(_0x9caf('0x14'));var utils=require(_0x9caf('0x15'));var config=require(_0x9caf('0x16'));var licenseUtil=require(_0x9caf('0x17'));var db=require(_0x9caf('0x18'))['db'];function respondWithStatusCode(_0x22c20c,_0x116caf){_0x116caf=_0x116caf||0xcc;return function(_0x52f684){if(_0x52f684){return _0x22c20c[_0x9caf('0x19')](_0x116caf);}return _0x22c20c[_0x9caf('0x1a')](_0x116caf)[_0x9caf('0x1b')]();};}function respondWithResult(_0xb4db99,_0x5843c8){_0x5843c8=_0x5843c8||0xc8;return function(_0x48dbf8){if(_0x48dbf8){return _0xb4db99[_0x9caf('0x1a')](_0x5843c8)['json'](_0x48dbf8);}};}function respondWithFilteredResult(_0x56cbfe,_0x456567){return function(_0x105b36){if(_0x105b36){var _0x22f0ea=typeof _0x456567['offset']===_0x9caf('0x1c')&&typeof _0x456567[_0x9caf('0x1d')]==='undefined';var _0x5cb8aa=_0x105b36[_0x9caf('0x1e')];var _0x201620=_0x22f0ea?0x0:_0x456567[_0x9caf('0x1f')];var _0x463634=_0x22f0ea?_0x105b36['count']:_0x456567[_0x9caf('0x1f')]+_0x456567['limit'];var _0x364848;if(_0x463634>=_0x5cb8aa){_0x463634=_0x5cb8aa;_0x364848=0xc8;}else{_0x364848=0xce;}_0x56cbfe[_0x9caf('0x1a')](_0x364848);return _0x56cbfe['set']('Content-Range',_0x201620+'-'+_0x463634+'/'+_0x5cb8aa)[_0x9caf('0x20')](_0x105b36);}return null;};}function patchUpdates(_0x1580a0){return function(_0x53406b){try{jsonpatch[_0x9caf('0x21')](_0x53406b,_0x1580a0,!![]);}catch(_0x38ac9f){return BPromise['reject'](_0x38ac9f);}return _0x53406b[_0x9caf('0x22')]();};}function saveUpdates(_0x27000f,_0x4d4c00){return function(_0x1b2dbf){if(_0x1b2dbf){return _0x1b2dbf[_0x9caf('0x23')](_0x27000f)[_0x9caf('0x24')](function(_0x57e31e){return _0x57e31e;});}return null;};}function removeEntity(_0xaccaa7,_0x531750){return function(_0x1eb9fa){if(_0x1eb9fa){return _0x1eb9fa[_0x9caf('0x25')]()['then'](function(){_0xaccaa7[_0x9caf('0x1a')](0xcc)[_0x9caf('0x1b')]();});}};}function handleEntityNotFound(_0x12c716,_0x3effc3){return function(_0x5a1727){if(!_0x5a1727){_0x12c716['sendStatus'](0x194);}return _0x5a1727;};}function handleError(_0x5ed06e,_0x3ec658){_0x3ec658=_0x3ec658||0x1f4;return function(_0x3b59f7){logger[_0x9caf('0x26')](_0x3b59f7[_0x9caf('0x27')]);if(_0x3b59f7[_0x9caf('0x28')]){delete _0x3b59f7[_0x9caf('0x28')];}_0x5ed06e['status'](_0x3ec658)[_0x9caf('0x29')](_0x3b59f7);};}exports[_0x9caf('0x2a')]=function(_0x4a8f71,_0x4ffb06){var _0x3f6d3b={},_0xe248fd={},_0x57aec5={'count':0x0,'rows':[]};var _0x1b6309=_[_0x9caf('0x2b')](db[_0x9caf('0x2c')]['rawAttributes'],function(_0x405e34){return{'name':_0x405e34[_0x9caf('0x2d')],'type':_0x405e34[_0x9caf('0x2e')][_0x9caf('0x2f')]};});_0xe248fd[_0x9caf('0x30')]=_[_0x9caf('0x2b')](_0x1b6309,_0x9caf('0x28'));_0xe248fd[_0x9caf('0x31')]=_[_0x9caf('0x32')](_0x4a8f71['query']);_0xe248fd[_0x9caf('0x33')]=_[_0x9caf('0x34')](_0xe248fd[_0x9caf('0x30')],_0xe248fd['query']);_0x3f6d3b[_0x9caf('0x35')]=_[_0x9caf('0x34')](_0xe248fd[_0x9caf('0x30')],qs[_0x9caf('0x36')](_0x4a8f71['query']['fields']));_0x3f6d3b[_0x9caf('0x35')]=_0x3f6d3b[_0x9caf('0x35')][_0x9caf('0x37')]?_0x3f6d3b[_0x9caf('0x35')]:_0xe248fd[_0x9caf('0x30')];if(!_0x4a8f71[_0x9caf('0x31')][_0x9caf('0x38')](_0x9caf('0x39'))){_0x3f6d3b['limit']=qs[_0x9caf('0x1d')](_0x4a8f71[_0x9caf('0x31')]['limit']);_0x3f6d3b[_0x9caf('0x1f')]=qs[_0x9caf('0x1f')](_0x4a8f71['query']['offset']);}_0x3f6d3b[_0x9caf('0x3a')]=qs[_0x9caf('0x3b')](_0x4a8f71[_0x9caf('0x31')][_0x9caf('0x3b')]);_0x3f6d3b[_0x9caf('0x3c')]=qs[_0x9caf('0x33')](_[_0x9caf('0x3d')](_0x4a8f71[_0x9caf('0x31')],_0xe248fd[_0x9caf('0x33')]),_0x1b6309);if(_0x4a8f71[_0x9caf('0x31')]['filter']){_0x3f6d3b[_0x9caf('0x3c')]=_[_0x9caf('0x3e')](_0x3f6d3b[_0x9caf('0x3c')],{'$or':_[_0x9caf('0x2b')](_0x1b6309,function(_0x394560){if(_0x394560['type']!==_0x9caf('0x3f')){var _0x3943b0={};_0x3943b0[_0x394560['name']]={'$like':'%'+_0x4a8f71['query'][_0x9caf('0x40')]+'%'};return _0x3943b0;}})});}_0x3f6d3b=_['merge']({},_0x3f6d3b,_0x4a8f71['options']);var _0x553fff={'where':_0x3f6d3b[_0x9caf('0x3c')]};return db[_0x9caf('0x2c')][_0x9caf('0x1e')](_0x553fff)[_0x9caf('0x24')](function(_0x11bd9e){_0x57aec5[_0x9caf('0x1e')]=_0x11bd9e;if(_0x4a8f71['query'][_0x9caf('0x41')]){_0x3f6d3b['include']=[{'all':!![]}];}return db[_0x9caf('0x2c')][_0x9caf('0x42')](_0x3f6d3b);})[_0x9caf('0x24')](function(_0x30b5c9){_0x57aec5[_0x9caf('0x43')]=_0x30b5c9;return _0x57aec5;})[_0x9caf('0x24')](respondWithFilteredResult(_0x4ffb06,_0x3f6d3b))[_0x9caf('0x44')](handleError(_0x4ffb06,null));};exports[_0x9caf('0x45')]=function(_0x2f5f7e,_0x34d8b7){var _0x54a251={'raw':!![],'where':{'id':_0x2f5f7e[_0x9caf('0x46')]['id']}},_0x2ea5ea={};_0x2ea5ea[_0x9caf('0x30')]=_[_0x9caf('0x32')](db['SquareDetailsReport'][_0x9caf('0x47')]);_0x2ea5ea[_0x9caf('0x31')]=_['keys'](_0x2f5f7e['query']);_0x2ea5ea[_0x9caf('0x33')]=_[_0x9caf('0x34')](_0x2ea5ea[_0x9caf('0x30')],_0x2ea5ea[_0x9caf('0x31')]);_0x54a251[_0x9caf('0x35')]=_[_0x9caf('0x34')](_0x2ea5ea['model'],qs[_0x9caf('0x36')](_0x2f5f7e['query'][_0x9caf('0x36')]));_0x54a251[_0x9caf('0x35')]=_0x54a251['attributes'][_0x9caf('0x37')]?_0x54a251[_0x9caf('0x35')]:_0x2ea5ea['model'];if(_0x2f5f7e[_0x9caf('0x31')][_0x9caf('0x41')]){_0x54a251[_0x9caf('0x48')]=[{'all':!![]}];}_0x54a251=_[_0x9caf('0x3e')]({},_0x54a251,_0x2f5f7e[_0x9caf('0x49')]);return db['SquareDetailsReport'][_0x9caf('0x4a')](_0x54a251)['then'](handleEntityNotFound(_0x34d8b7,null))[_0x9caf('0x24')](respondWithResult(_0x34d8b7,null))[_0x9caf('0x44')](handleError(_0x34d8b7,null));};exports[_0x9caf('0x4b')]=function(_0x34d4a7,_0x496b24){return db['SquareDetailsReport'][_0x9caf('0x4b')](_0x34d4a7['body'],{})[_0x9caf('0x24')](respondWithResult(_0x496b24,0xc9))[_0x9caf('0x44')](handleError(_0x496b24,null));};exports[_0x9caf('0x23')]=function(_0x45630b,_0x537721){if(_0x45630b[_0x9caf('0x4c')]['id']){delete _0x45630b['body']['id'];}return db[_0x9caf('0x2c')]['find']({'where':{'id':_0x45630b[_0x9caf('0x46')]['id']}})[_0x9caf('0x24')](handleEntityNotFound(_0x537721,null))[_0x9caf('0x24')](saveUpdates(_0x45630b['body'],null))[_0x9caf('0x24')](respondWithResult(_0x537721,null))['catch'](handleError(_0x537721,null));};exports[_0x9caf('0x25')]=function(_0x31d7ec,_0x102f9d){return db[_0x9caf('0x2c')][_0x9caf('0x4a')]({'where':{'id':_0x31d7ec[_0x9caf('0x46')]['id']}})[_0x9caf('0x24')](handleEntityNotFound(_0x102f9d,null))[_0x9caf('0x24')](removeEntity(_0x102f9d,null))[_0x9caf('0x44')](handleError(_0x102f9d,null));};exports[_0x9caf('0x4d')]=function(_0x48c1d4,_0x19ef42){return db[_0x9caf('0x2c')]['describe']()['then'](respondWithResult(_0x19ef42,null))[_0x9caf('0x44')](handleError(_0x19ef42,null));}; \ No newline at end of file +var _0xe85b=['where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','find','body','describe','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x44720f,_0x27de69){var _0xf525ff=function(_0x398642){while(--_0x398642){_0x44720f['push'](_0x44720f['shift']());}};_0xf525ff(++_0x27de69);}(_0xe85b,0x18a));var _0xbe85=function(_0x359377,_0x1a63ef){_0x359377=_0x359377-0x0;var _0x8be18a=_0xe85b[_0x359377];return _0x8be18a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xbe85('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe85('0x1'));var moment=require(_0xbe85('0x2'));var BPromise=require(_0xbe85('0x3'));var Mustache=require(_0xbe85('0x4'));var util=require(_0xbe85('0x5'));var path=require(_0xbe85('0x6'));var sox=require(_0xbe85('0x7'));var csv=require(_0xbe85('0x8'));var ejs=require(_0xbe85('0x9'));var fs=require('fs');var fs_extra=require(_0xbe85('0xa'));var _=require(_0xbe85('0xb'));var squel=require(_0xbe85('0xc'));var crypto=require(_0xbe85('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbe85('0x8'));var querystring=require(_0xbe85('0xe'));var Papa=require(_0xbe85('0xf'));var Redis=require(_0xbe85('0x10'));var authService=require(_0xbe85('0x11'));var qs=require(_0xbe85('0x12'));var as=require(_0xbe85('0x13'));var hardwareService=require(_0xbe85('0x14'));var logger=require(_0xbe85('0x15'))('api');var utils=require(_0xbe85('0x16'));var config=require(_0xbe85('0x17'));var licenseUtil=require(_0xbe85('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cea52,_0x267294){_0x267294=_0x267294||0xcc;return function(_0x31be14){if(_0x31be14){return _0x4cea52['sendStatus'](_0x267294);}return _0x4cea52[_0xbe85('0x19')](_0x267294)[_0xbe85('0x1a')]();};}function respondWithResult(_0x1e0ba6,_0x365101){_0x365101=_0x365101||0xc8;return function(_0x477d46){if(_0x477d46){return _0x1e0ba6[_0xbe85('0x19')](_0x365101)[_0xbe85('0x1b')](_0x477d46);}};}function respondWithFilteredResult(_0x3008e3,_0x5454fe){return function(_0x5c621f){if(_0x5c621f){var _0x6dced0=typeof _0x5454fe[_0xbe85('0x1c')]===_0xbe85('0x1d')&&typeof _0x5454fe['limit']===_0xbe85('0x1d');var _0x3de3b3=_0x5c621f[_0xbe85('0x1e')];var _0x2661bf=_0x6dced0?0x0:_0x5454fe[_0xbe85('0x1c')];var _0x3519f0=_0x6dced0?_0x5c621f[_0xbe85('0x1e')]:_0x5454fe[_0xbe85('0x1c')]+_0x5454fe[_0xbe85('0x1f')];var _0x17439b;if(_0x3519f0>=_0x3de3b3){_0x3519f0=_0x3de3b3;_0x17439b=0xc8;}else{_0x17439b=0xce;}_0x3008e3[_0xbe85('0x19')](_0x17439b);return _0x3008e3[_0xbe85('0x20')]('Content-Range',_0x2661bf+'-'+_0x3519f0+'/'+_0x3de3b3)[_0xbe85('0x1b')](_0x5c621f);}return null;};}function patchUpdates(_0x4fb629){return function(_0x5937ad){try{jsonpatch[_0xbe85('0x21')](_0x5937ad,_0x4fb629,!![]);}catch(_0x27ce61){return BPromise[_0xbe85('0x22')](_0x27ce61);}return _0x5937ad[_0xbe85('0x23')]();};}function saveUpdates(_0x12f0fb,_0x47a786){return function(_0x867c92){if(_0x867c92){return _0x867c92[_0xbe85('0x24')](_0x12f0fb)[_0xbe85('0x25')](function(_0x30ea5b){return _0x30ea5b;});}return null;};}function removeEntity(_0x437409,_0x70f6fa){return function(_0x5dac84){if(_0x5dac84){return _0x5dac84[_0xbe85('0x26')]()[_0xbe85('0x25')](function(){_0x437409[_0xbe85('0x19')](0xcc)[_0xbe85('0x1a')]();});}};}function handleEntityNotFound(_0xd10830,_0x49c4c8){return function(_0x56fb92){if(!_0x56fb92){_0xd10830[_0xbe85('0x27')](0x194);}return _0x56fb92;};}function handleError(_0x5dc25e,_0x216b47){_0x216b47=_0x216b47||0x1f4;return function(_0x5a1cc8){logger[_0xbe85('0x28')](_0x5a1cc8[_0xbe85('0x29')]);if(_0x5a1cc8[_0xbe85('0x2a')]){delete _0x5a1cc8[_0xbe85('0x2a')];}_0x5dc25e[_0xbe85('0x19')](_0x216b47)[_0xbe85('0x2b')](_0x5a1cc8);};}exports[_0xbe85('0x2c')]=function(_0x4f26ff,_0x547f9f){var _0x406527={},_0x553f0f={},_0x3c1d36={'count':0x0,'rows':[]};var _0x8cac69=_[_0xbe85('0x2d')](db[_0xbe85('0x2e')][_0xbe85('0x2f')],function(_0x48cfe8){return{'name':_0x48cfe8['fieldName'],'type':_0x48cfe8[_0xbe85('0x30')][_0xbe85('0x31')]};});_0x553f0f[_0xbe85('0x32')]=_[_0xbe85('0x2d')](_0x8cac69,'name');_0x553f0f[_0xbe85('0x33')]=_[_0xbe85('0x34')](_0x4f26ff['query']);_0x553f0f[_0xbe85('0x35')]=_[_0xbe85('0x36')](_0x553f0f[_0xbe85('0x32')],_0x553f0f[_0xbe85('0x33')]);_0x406527[_0xbe85('0x37')]=_[_0xbe85('0x36')](_0x553f0f[_0xbe85('0x32')],qs[_0xbe85('0x38')](_0x4f26ff['query'][_0xbe85('0x38')]));_0x406527[_0xbe85('0x37')]=_0x406527[_0xbe85('0x37')][_0xbe85('0x39')]?_0x406527['attributes']:_0x553f0f[_0xbe85('0x32')];if(!_0x4f26ff[_0xbe85('0x33')][_0xbe85('0x3a')](_0xbe85('0x3b'))){_0x406527[_0xbe85('0x1f')]=qs[_0xbe85('0x1f')](_0x4f26ff[_0xbe85('0x33')][_0xbe85('0x1f')]);_0x406527[_0xbe85('0x1c')]=qs[_0xbe85('0x1c')](_0x4f26ff['query'][_0xbe85('0x1c')]);}_0x406527[_0xbe85('0x3c')]=qs[_0xbe85('0x3d')](_0x4f26ff[_0xbe85('0x33')][_0xbe85('0x3d')]);_0x406527[_0xbe85('0x3e')]=qs[_0xbe85('0x35')](_[_0xbe85('0x3f')](_0x4f26ff[_0xbe85('0x33')],_0x553f0f[_0xbe85('0x35')]),_0x8cac69);if(_0x4f26ff[_0xbe85('0x33')][_0xbe85('0x40')]){_0x406527[_0xbe85('0x3e')]=_[_0xbe85('0x41')](_0x406527[_0xbe85('0x3e')],{'$or':_[_0xbe85('0x2d')](_0x8cac69,function(_0x342694){if(_0x342694[_0xbe85('0x30')]!=='VIRTUAL'){var _0x290f3d={};_0x290f3d[_0x342694[_0xbe85('0x2a')]]={'$like':'%'+_0x4f26ff[_0xbe85('0x33')][_0xbe85('0x40')]+'%'};return _0x290f3d;}})});}_0x406527=_[_0xbe85('0x41')]({},_0x406527,_0x4f26ff[_0xbe85('0x42')]);var _0x9f7f54={'where':_0x406527[_0xbe85('0x3e')]};return db[_0xbe85('0x2e')]['count'](_0x9f7f54)[_0xbe85('0x25')](function(_0x44e69b){_0x3c1d36['count']=_0x44e69b;if(_0x4f26ff[_0xbe85('0x33')][_0xbe85('0x43')]){_0x406527[_0xbe85('0x44')]=[{'all':!![]}];}return db[_0xbe85('0x2e')][_0xbe85('0x45')](_0x406527);})[_0xbe85('0x25')](function(_0x1b0293){_0x3c1d36['rows']=_0x1b0293;return _0x3c1d36;})[_0xbe85('0x25')](respondWithFilteredResult(_0x547f9f,_0x406527))[_0xbe85('0x46')](handleError(_0x547f9f,null));};exports[_0xbe85('0x47')]=function(_0x34601d,_0x3a8961){var _0x1af6a9={'raw':!![],'where':{'id':_0x34601d[_0xbe85('0x48')]['id']}},_0x13244d={};_0x13244d[_0xbe85('0x32')]=_['keys'](db[_0xbe85('0x2e')][_0xbe85('0x2f')]);_0x13244d[_0xbe85('0x33')]=_[_0xbe85('0x34')](_0x34601d[_0xbe85('0x33')]);_0x13244d[_0xbe85('0x35')]=_[_0xbe85('0x36')](_0x13244d[_0xbe85('0x32')],_0x13244d[_0xbe85('0x33')]);_0x1af6a9[_0xbe85('0x37')]=_[_0xbe85('0x36')](_0x13244d['model'],qs[_0xbe85('0x38')](_0x34601d[_0xbe85('0x33')]['fields']));_0x1af6a9[_0xbe85('0x37')]=_0x1af6a9[_0xbe85('0x37')][_0xbe85('0x39')]?_0x1af6a9['attributes']:_0x13244d[_0xbe85('0x32')];if(_0x34601d[_0xbe85('0x33')][_0xbe85('0x43')]){_0x1af6a9[_0xbe85('0x44')]=[{'all':!![]}];}_0x1af6a9=_[_0xbe85('0x41')]({},_0x1af6a9,_0x34601d[_0xbe85('0x42')]);return db[_0xbe85('0x2e')][_0xbe85('0x49')](_0x1af6a9)[_0xbe85('0x25')](handleEntityNotFound(_0x3a8961,null))[_0xbe85('0x25')](respondWithResult(_0x3a8961,null))['catch'](handleError(_0x3a8961,null));};exports['create']=function(_0x394909,_0x104b49){return db[_0xbe85('0x2e')]['create'](_0x394909['body'],{})[_0xbe85('0x25')](respondWithResult(_0x104b49,0xc9))[_0xbe85('0x46')](handleError(_0x104b49,null));};exports[_0xbe85('0x24')]=function(_0x36acf9,_0x2f99a2){if(_0x36acf9[_0xbe85('0x4a')]['id']){delete _0x36acf9[_0xbe85('0x4a')]['id'];}return db[_0xbe85('0x2e')][_0xbe85('0x49')]({'where':{'id':_0x36acf9[_0xbe85('0x48')]['id']}})[_0xbe85('0x25')](handleEntityNotFound(_0x2f99a2,null))['then'](saveUpdates(_0x36acf9['body'],null))[_0xbe85('0x25')](respondWithResult(_0x2f99a2,null))['catch'](handleError(_0x2f99a2,null));};exports['destroy']=function(_0x5679b8,_0x10618e){return db[_0xbe85('0x2e')][_0xbe85('0x49')]({'where':{'id':_0x5679b8['params']['id']}})['then'](handleEntityNotFound(_0x10618e,null))[_0xbe85('0x25')](removeEntity(_0x10618e,null))[_0xbe85('0x46')](handleError(_0x10618e,null));};exports[_0xbe85('0x4b')]=function(_0x4ba895,_0x3c2632){return db[_0xbe85('0x2e')]['describe']()[_0xbe85('0x25')](respondWithResult(_0x3c2632,null))[_0xbe85('0x46')](handleError(_0x3c2632,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index ca384f0..285a503 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 _0x7cab=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','./squareReportDetail.attributes','SquareDetailsReport'];(function(_0x2c63a4,_0x18a34f){var _0x210eb8=function(_0x300bb0){while(--_0x300bb0){_0x2c63a4['push'](_0x2c63a4['shift']());}};_0x210eb8(++_0x18a34f);}(_0x7cab,0x15f));var _0xb7ca=function(_0x18cac4,_0x57a4d5){_0x18cac4=_0x18cac4-0x0;var _0x2227c6=_0x7cab[_0x18cac4];return _0x2227c6;};'use strict';var _=require(_0xb7ca('0x0'));var util=require('util');var logger=require(_0xb7ca('0x1'))(_0xb7ca('0x2'));var moment=require(_0xb7ca('0x3'));var BPromise=require(_0xb7ca('0x4'));var rp=require(_0xb7ca('0x5'));var fs=require('fs');var path=require(_0xb7ca('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xb7ca('0x7'));module['exports']=function(_0x283259,_0x3a70dd){return _0x283259['define'](_0xb7ca('0x8'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb39b=['../../config/logger','moment','bluebird','request-promise','path','rimraf','define','SquareDetailsReport'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xb39b,0x1b0));var _0xbb39=function(_0x408432,_0x1115ac){_0x408432=_0x408432-0x0;var _0x19075a=_0xb39b[_0x408432];return _0x19075a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xbb39('0x0'))('api');var moment=require(_0xbb39('0x1'));var BPromise=require(_0xbb39('0x2'));var rp=require(_0xbb39('0x3'));var fs=require('fs');var path=require(_0xbb39('0x4'));var rimraf=require(_0xbb39('0x5'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x1dc46a,_0x253ed5){return _0x1dc46a[_0xbb39('0x6')](_0xbb39('0x7'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index b9eee35..54d62dd 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 _0xe511=['options','raw','then','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareDetailsReport','SquareDetailsReport','body'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0xe511,0x16f));var _0x1e51=function(_0x31766c,_0x1cd917){_0x31766c=_0x31766c-0x0;var _0x4a19c5=_0xe511[_0x31766c];return _0x4a19c5;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21ed6b,_0x5c4590,_0x4fa2ba){return new BPromise(function(_0x394ad8,_0x133021){return client['request'](_0x21ed6b,_0x4fa2ba)['then'](function(_0x658941){logger[_0x1e51('0xa')](_0x1e51('0xb'),_0x5c4590,_0x1e51('0xc'));logger[_0x1e51('0xd')](_0x1e51('0xe'),_0x5c4590,'request\x20sent',JSON[_0x1e51('0xf')](_0x658941));if(_0x658941[_0x1e51('0x10')]){if(_0x658941[_0x1e51('0x10')][_0x1e51('0x11')]===0x1f4){logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941['error'][_0x1e51('0x12')]);return _0x133021(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}logger[_0x1e51('0x10')](_0x1e51('0xb'),_0x5c4590,_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);return _0x394ad8(_0x658941[_0x1e51('0x10')][_0x1e51('0x12')]);}else{logger[_0x1e51('0xa')]('SquareDetailsReport,\x20%s,\x20%s',_0x5c4590,_0x1e51('0xc'));_0x394ad8(_0x658941[_0x1e51('0x13')][_0x1e51('0x12')]);}})['catch'](function(_0xa3b410){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x5c4590,_0xa3b410);_0x133021(_0xa3b410);});});}exports[_0x1e51('0x14')]=function(_0x27dcad){var _0x40ae4c=this;return new Promise(function(_0x4785a5,_0x4d1aae){return db[_0x1e51('0x15')]['create'](_0x27dcad[_0x1e51('0x16')],{'raw':_0x27dcad['options']?_0x27dcad[_0x1e51('0x17')][_0x1e51('0x18')]===undefined?!![]:![]:!![]})[_0x1e51('0x19')](function(_0x183a95){logger['info']('CreateSquareDetailsReport',_0x27dcad);logger['debug']('CreateSquareDetailsReport',_0x27dcad,JSON[_0x1e51('0xf')](_0x183a95));_0x4785a5(_0x183a95);})['catch'](function(_0x3f7340){logger[_0x1e51('0x10')](_0x1e51('0x14'),_0x3f7340[_0x1e51('0x12')],_0x27dcad);_0x4d1aae(_0x40ae4c[_0x1e51('0x10')](0x1f4,_0x3f7340[_0x1e51('0x12')]));});});}; \ No newline at end of file +var _0x0647=['stringify','error','code','SquareDetailsReport,\x20%s,\x20%s','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s'];(function(_0xbf76e2,_0x5a62bf){var _0x8290a7=function(_0x22a4cb){while(--_0x22a4cb){_0xbf76e2['push'](_0xbf76e2['shift']());}};_0x8290a7(++_0x5a62bf);}(_0x0647,0xd0));var _0x7064=function(_0x3cbe1c,_0x4bcabd){_0x3cbe1c=_0x3cbe1c-0x0;var _0x5ee08b=_0x0647[_0x3cbe1c];return _0x5ee08b;};'use strict';var _=require(_0x7064('0x0'));var util=require('util');var moment=require(_0x7064('0x1'));var BPromise=require(_0x7064('0x2'));var rs=require(_0x7064('0x3'));var fs=require('fs');var Redis=require(_0x7064('0x4'));var db=require(_0x7064('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7064('0x6'));var config=require(_0x7064('0x7'));var jayson=require(_0x7064('0x8'));var client=jayson[_0x7064('0x9')][_0x7064('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1101e4,_0x58186b,_0x536336){return new BPromise(function(_0x1c85b1,_0x39b7e3){return client[_0x7064('0xb')](_0x1101e4,_0x536336)['then'](function(_0x38c195){logger[_0x7064('0xc')]('SquareDetailsReport,\x20%s,\x20%s',_0x58186b,_0x7064('0xd'));logger[_0x7064('0xe')](_0x7064('0xf'),_0x58186b,'request\x20sent',JSON[_0x7064('0x10')](_0x38c195));if(_0x38c195[_0x7064('0x11')]){if(_0x38c195[_0x7064('0x11')][_0x7064('0x12')]===0x1f4){logger['error'](_0x7064('0x13'),_0x58186b,_0x38c195[_0x7064('0x11')][_0x7064('0x14')]);return _0x39b7e3(_0x38c195[_0x7064('0x11')][_0x7064('0x14')]);}logger[_0x7064('0x11')](_0x7064('0x13'),_0x58186b,_0x38c195[_0x7064('0x11')]['message']);return _0x1c85b1(_0x38c195['error']['message']);}else{logger[_0x7064('0xc')](_0x7064('0x13'),_0x58186b,_0x7064('0xd'));_0x1c85b1(_0x38c195['result'][_0x7064('0x14')]);}})[_0x7064('0x15')](function(_0x5bb1cc){logger[_0x7064('0x11')](_0x7064('0x13'),_0x58186b,_0x5bb1cc);_0x39b7e3(_0x5bb1cc);});});}exports[_0x7064('0x16')]=function(_0x203633){var _0x181ca0=this;return new Promise(function(_0x17f306,_0x3f3695){return db[_0x7064('0x17')][_0x7064('0x18')](_0x203633[_0x7064('0x19')],{'raw':_0x203633[_0x7064('0x1a')]?_0x203633[_0x7064('0x1a')][_0x7064('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x431fac){logger[_0x7064('0xc')](_0x7064('0x16'),_0x203633);logger[_0x7064('0xe')]('CreateSquareDetailsReport',_0x203633,JSON[_0x7064('0x10')](_0x431fac));_0x17f306(_0x431fac);})['catch'](function(_0x446730){logger[_0x7064('0x11')]('CreateSquareDetailsReport',_0x446730[_0x7064('0x14')],_0x203633);_0x3f3695(_0x181ca0[_0x7064('0x11')](0x1f4,_0x446730[_0x7064('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 1aa3afd..2138864 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 _0xe500=['/process/:pid/kill','express','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x4ce851,_0x263eea){var _0x126bf1=function(_0x2958a0){while(--_0x2958a0){_0x4ce851['push'](_0x4ce851['shift']());}};_0x126bf1(++_0x263eea);}(_0xe500,0xf9));var _0x0e50=function(_0x1261c2,_0x3ef819){_0x1261c2=_0x1261c2-0x0;var _0x3aabd2=_0xe500[_0x1261c2];return _0x3aabd2;};'use strict';var express=require(_0x0e50('0x0'));var router=express[_0x0e50('0x1')]();var auth=require(_0x0e50('0x2'));var controller=require(_0x0e50('0x3'));router[_0x0e50('0x4')]('/',auth[_0x0e50('0x5')](),controller[_0x0e50('0x6')]);router[_0x0e50('0x4')](_0x0e50('0x7'),auth['isAuthenticated'](),controller['killProcess']);module['exports']=router; \ No newline at end of file +var _0xf434=['isAuthenticated','index','/process/:pid/kill','killProcess','exports','express','../../components/auth/service','./system.controller','get'];(function(_0x439872,_0x26be19){var _0x35c329=function(_0x15a1f4){while(--_0x15a1f4){_0x439872['push'](_0x439872['shift']());}};_0x35c329(++_0x26be19);}(_0xf434,0x15b));var _0x4f43=function(_0x5c5f91,_0xe5152d){_0x5c5f91=_0x5c5f91-0x0;var _0xe79a61=_0xf434[_0x5c5f91];return _0xe79a61;};'use strict';var express=require(_0x4f43('0x0'));var router=express['Router']();var auth=require(_0x4f43('0x1'));var controller=require(_0x4f43('0x2'));router[_0x4f43('0x3')]('/',auth[_0x4f43('0x4')](),controller[_0x4f43('0x5')]);router[_0x4f43('0x3')](_0x4f43('0x6'),auth[_0x4f43('0x4')](),controller[_0x4f43('0x7')]);module[_0x4f43('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 98dd174..5b995d6 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 _0x8289=['split','length','params','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','killProcess','systeminformation','exec','api','util','lodash','error','inspect','name','status','send','index','getAllData','then','catch','json','format','pid'];(function(_0x1613d9,_0x2f583e){var _0x1ab5e0=function(_0xbfca35){while(--_0xbfca35){_0x1613d9['push'](_0x1613d9['shift']());}};_0x1ab5e0(++_0x2f583e);}(_0x8289,0x1bb));var _0x9828=function(_0x3b1d66,_0x59476f){_0x3b1d66=_0x3b1d66-0x0;var _0x68ed2d=_0x8289[_0x3b1d66];return _0x68ed2d;};'use strict';var info=require(_0x9828('0x0'));var exec=require('child_process')[_0x9828('0x1')];var logger=require('../../config/logger')(_0x9828('0x2'));var util=require(_0x9828('0x3'));var BPromise=require('bluebird');var _=require(_0x9828('0x4'));function handleError(_0xd2292a,_0x487827,_0x15e5bf){_0x487827=_0x487827||0x1f4;return function(_0x1838a5){logger[_0x9828('0x5')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x15e5bf,_0x487827,util[_0x9828('0x6')](_0x1838a5,{'showHidden':![],'depth':null}));delete _0x1838a5[_0x9828('0x7')];_0xd2292a[_0x9828('0x8')](_0x487827)[_0x9828('0x9')](_0x1838a5);};}exports[_0x9828('0xa')]=function(_0x431a0d,_0x2cf5a4){return info[_0x9828('0xb')]()[_0x9828('0xc')](function(_0x22461e){return _0x2cf5a4[_0x9828('0x8')](0xc8)['json'](_0x22461e);})[_0x9828('0xd')](function(_0x47ef5c){return _0x2cf5a4[_0x9828('0x8')](0x1f4)[_0x9828('0xe')](_0x47ef5c);});};exports['killProcess']=function(_0x35b491,_0x5cadb9){var _0x5a2343=['components/import/cm'];return new BPromise(function(_0x49811c,_0x1f0436){return exec(util[_0x9828('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x35b491['params'][_0x9828('0x10')]),function(_0x39e704,_0x10c2d6,_0x4ee70d){if(_0x39e704){return _0x1f0436(_0x39e704);}return _0x49811c(_0x10c2d6);});})[_0x9828('0xc')](function(_0x32621d){var _0x44275d=![];var _0x1c7903=_0x32621d[_0x9828('0x11')](/\n/);for(var _0x14fc0d=0x0,_0x19e522=_0x5a2343[_0x9828('0x12')];_0x14fc0d<_0x19e522,_0x44275d===![];_0x14fc0d+=0x1){if(_0x32621d['indexOf'](_0x5a2343[_0x14fc0d])>=0x0){_0x44275d=!![];}}if(!_0x44275d){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x35b491[_0x9828('0x13')][_0x9828('0x10')]));}process[_0x9828('0x14')](_0x35b491[_0x9828('0x13')][_0x9828('0x10')],'SIGINT');return _0x5cadb9['status'](0xc8)[_0x9828('0xe')]({'message':util[_0x9828('0xf')](_0x9828('0x15'),_0x35b491['params'][_0x9828('0x10')])});})[_0x9828('0xd')](handleError(_0x5cadb9,null,_0x9828('0x16')));}; \ No newline at end of file +var _0x07d0=['status','getAllData','then','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','systeminformation','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x2b6e26,_0x42d071){var _0x3b1a2b=function(_0x33f1ad){while(--_0x33f1ad){_0x2b6e26['push'](_0x2b6e26['shift']());}};_0x3b1a2b(++_0x42d071);}(_0x07d0,0xb6));var _0x007d=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0x07d0[_0x40a825];return _0x273a54;};'use strict';var info=require(_0x007d('0x0'));var exec=require('child_process')[_0x007d('0x1')];var logger=require(_0x007d('0x2'))('api');var util=require(_0x007d('0x3'));var BPromise=require(_0x007d('0x4'));var _=require(_0x007d('0x5'));function handleError(_0x34a44c,_0x57e917,_0x204e6f){_0x57e917=_0x57e917||0x1f4;return function(_0x18285b){logger[_0x007d('0x6')](_0x007d('0x7'),_0x204e6f,_0x57e917,util[_0x007d('0x8')](_0x18285b,{'showHidden':![],'depth':null}));delete _0x18285b[_0x007d('0x9')];_0x34a44c[_0x007d('0xa')](_0x57e917)['send'](_0x18285b);};}exports['index']=function(_0x46033a,_0x5d8730){return info[_0x007d('0xb')]()[_0x007d('0xc')](function(_0x1c92bb){return _0x5d8730[_0x007d('0xa')](0xc8)['json'](_0x1c92bb);})[_0x007d('0xd')](function(_0x5ca0f0){return _0x5d8730[_0x007d('0xa')](0x1f4)[_0x007d('0xe')](_0x5ca0f0);});};exports[_0x007d('0xf')]=function(_0x23f79d,_0x549398){var _0x57444e=[_0x007d('0x10')];return new BPromise(function(_0x562aff,_0x20f832){return exec(util[_0x007d('0x11')](_0x007d('0x12'),_0x23f79d[_0x007d('0x13')][_0x007d('0x14')]),function(_0x372e23,_0x3d327d,_0x177fa9){if(_0x372e23){return _0x20f832(_0x372e23);}return _0x562aff(_0x3d327d);});})[_0x007d('0xc')](function(_0x5cc468){var _0xff8e70=![];var _0x5f1a5b=_0x5cc468[_0x007d('0x15')](/\n/);for(var _0x3a7e3e=0x0,_0x16c365=_0x57444e[_0x007d('0x16')];_0x3a7e3e<_0x16c365,_0xff8e70===![];_0x3a7e3e+=0x1){if(_0x5cc468[_0x007d('0x17')](_0x57444e[_0x3a7e3e])>=0x0){_0xff8e70=!![];}}if(!_0xff8e70){throw new Error(util['format']('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x23f79d['params'][_0x007d('0x14')]));}process['kill'](_0x23f79d['params'][_0x007d('0x14')],'SIGINT');return _0x549398[_0x007d('0xa')](0xc8)[_0x007d('0xe')]({'message':util[_0x007d('0x11')]('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x23f79d['params'][_0x007d('0x14')])});})[_0x007d('0xd')](handleError(_0x549398,null,_0x007d('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 883a4ee..6679357 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 _0x99e9=['update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put'];(function(_0x1332ef,_0x39f987){var _0x17cef2=function(_0x1b4128){while(--_0x1b4128){_0x1332ef['push'](_0x1332ef['shift']());}};_0x17cef2(++_0x39f987);}(_0x99e9,0xb4));var _0x999e=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x99e9[_0x2aea9e];return _0x430b92;};'use strict';var multer=require('multer');var util=require(_0x999e('0x0'));var path=require(_0x999e('0x1'));var timeout=require(_0x999e('0x2'));var express=require(_0x999e('0x3'));var router=express['Router']();var fs_extra=require(_0x999e('0x4'));var auth=require(_0x999e('0x5'));var interaction=require(_0x999e('0x6'));var config=require('../../config/environment');var controller=require(_0x999e('0x7'));router['get']('/',auth[_0x999e('0x8')](),controller[_0x999e('0x9')]);router[_0x999e('0xa')](_0x999e('0xb'),auth['isAuthenticated'](),controller[_0x999e('0xc')]);router[_0x999e('0xa')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0xe')]);router[_0x999e('0xf')]('/',auth[_0x999e('0x8')](),controller[_0x999e('0x10')]);router[_0x999e('0x11')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x12')]);router[_0x999e('0x13')](_0x999e('0xd'),auth[_0x999e('0x8')](),controller[_0x999e('0x14')]);module[_0x999e('0x15')]=router; \ No newline at end of file +var _0x5b02=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0x25307e,_0x3d3d14){var _0x54b43f=function(_0x2d8cba){while(--_0x2d8cba){_0x25307e['push'](_0x25307e['shift']());}};_0x54b43f(++_0x3d3d14);}(_0x5b02,0xe9));var _0x25b0=function(_0x5f53cb,_0x3eda91){_0x5f53cb=_0x5f53cb-0x0;var _0x395155=_0x5b02[_0x5f53cb];return _0x395155;};'use strict';var multer=require(_0x25b0('0x0'));var util=require(_0x25b0('0x1'));var path=require(_0x25b0('0x2'));var timeout=require(_0x25b0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25b0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x25b0('0x5'));var config=require(_0x25b0('0x6'));var controller=require(_0x25b0('0x7'));router[_0x25b0('0x8')]('/',auth[_0x25b0('0x9')](),controller['index']);router[_0x25b0('0x8')](_0x25b0('0xa'),auth['isAuthenticated'](),controller[_0x25b0('0xb')]);router['get']('/:id',auth[_0x25b0('0x9')](),controller[_0x25b0('0xc')]);router[_0x25b0('0xd')]('/',auth['isAuthenticated'](),controller[_0x25b0('0xe')]);router[_0x25b0('0xf')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x11')]);router[_0x25b0('0x12')](_0x25b0('0x10'),auth[_0x25b0('0x9')](),controller[_0x25b0('0x13')]);module[_0x25b0('0x14')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 9a09ce0..d96243e 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 _0x48bc=['STRING','#0091EA','sequelize','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x48bc,0x1b6));var _0xc48b=function(_0x1583e4,_0x4615e2){_0x1583e4=_0x1583e4-0x0;var _0x2e2248=_0x48bc[_0x1583e4];return _0x2e2248;};'use strict';var Sequelize=require(_0xc48b('0x0'));module[_0xc48b('0x1')]={'name':{'type':Sequelize[_0xc48b('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc48b('0x2')],'defaultValue':_0xc48b('0x3')},'description':{'type':Sequelize[_0xc48b('0x2')]}}; \ No newline at end of file +var _0x9434=['sequelize','exports','STRING','name','#0091EA'];(function(_0x367d7a,_0x10ca84){var _0x2ab492=function(_0x56a7c8){while(--_0x56a7c8){_0x367d7a['push'](_0x367d7a['shift']());}};_0x2ab492(++_0x10ca84);}(_0x9434,0x168));var _0x4943=function(_0x35574f,_0xe02c60){_0x35574f=_0x35574f-0x0;var _0x106233=_0x9434[_0x35574f];return _0x106233;};'use strict';var Sequelize=require(_0x4943('0x0'));module[_0x4943('0x1')]={'name':{'type':Sequelize[_0x4943('0x2')],'unique':_0x4943('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x4943('0x2')],'defaultValue':_0x4943('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index fe62669..5b30a40 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 _0x7a8a=['nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','end','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x290694,_0x281935){var _0x5a0f2e=function(_0x58d7d4){while(--_0x58d7d4){_0x290694['push'](_0x290694['shift']());}};_0x5a0f2e(++_0x281935);}(_0x7a8a,0x173));var _0xa7a8=function(_0x294ba1,_0x444885){_0x294ba1=_0x294ba1-0x0;var _0x31586d=_0x7a8a[_0x294ba1];return _0x31586d;};'use strict';var emlformat=require(_0xa7a8('0x0'));var rimraf=require(_0xa7a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa7a8('0x2'));var rp=require(_0xa7a8('0x3'));var moment=require('moment');var BPromise=require(_0xa7a8('0x4'));var Mustache=require('mustache');var util=require(_0xa7a8('0x5'));var path=require(_0xa7a8('0x6'));var sox=require(_0xa7a8('0x7'));var csv=require(_0xa7a8('0x8'));var ejs=require(_0xa7a8('0x9'));var fs=require('fs');var fs_extra=require(_0xa7a8('0xa'));var _=require(_0xa7a8('0xb'));var squel=require(_0xa7a8('0xc'));var crypto=require(_0xa7a8('0xd'));var jsforce=require(_0xa7a8('0xe'));var deskjs=require(_0xa7a8('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa7a8('0x10'));var Papa=require(_0xa7a8('0x11'));var Redis=require('ioredis');var authService=require(_0xa7a8('0x12'));var qs=require(_0xa7a8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa7a8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xa7a8('0x15'));var config=require(_0xa7a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7a8('0x17'))['db'];function respondWithStatusCode(_0x50a639,_0x152482){_0x152482=_0x152482||0xcc;return function(_0x12e02f){if(_0x12e02f){return _0x50a639[_0xa7a8('0x18')](_0x152482);}return _0x50a639[_0xa7a8('0x19')](_0x152482)['end']();};}function respondWithResult(_0x39b319,_0xc7a2ab){_0xc7a2ab=_0xc7a2ab||0xc8;return function(_0x31cf96){if(_0x31cf96){return _0x39b319[_0xa7a8('0x19')](_0xc7a2ab)[_0xa7a8('0x1a')](_0x31cf96);}};}function respondWithFilteredResult(_0x573a84,_0x2f6fae){return function(_0x5b3f36){if(_0x5b3f36){var _0x598989=typeof _0x2f6fae['offset']==='undefined'&&typeof _0x2f6fae[_0xa7a8('0x1b')]===_0xa7a8('0x1c');var _0x169586=_0x5b3f36[_0xa7a8('0x1d')];var _0x37d724=_0x598989?0x0:_0x2f6fae[_0xa7a8('0x1e')];var _0x346d96=_0x598989?_0x5b3f36[_0xa7a8('0x1d')]:_0x2f6fae[_0xa7a8('0x1e')]+_0x2f6fae[_0xa7a8('0x1b')];var _0x40ca84;if(_0x346d96>=_0x169586){_0x346d96=_0x169586;_0x40ca84=0xc8;}else{_0x40ca84=0xce;}_0x573a84[_0xa7a8('0x19')](_0x40ca84);return _0x573a84[_0xa7a8('0x1f')](_0xa7a8('0x20'),_0x37d724+'-'+_0x346d96+'/'+_0x169586)[_0xa7a8('0x1a')](_0x5b3f36);}return null;};}function patchUpdates(_0x507f63){return function(_0x5685c3){try{jsonpatch[_0xa7a8('0x21')](_0x5685c3,_0x507f63,!![]);}catch(_0x52c547){return BPromise[_0xa7a8('0x22')](_0x52c547);}return _0x5685c3['save']();};}function saveUpdates(_0x3ab84e,_0x5dd4e4){return function(_0x5dff6b){if(_0x5dff6b){return _0x5dff6b[_0xa7a8('0x23')](_0x3ab84e)[_0xa7a8('0x24')](function(_0x2176ce){return _0x2176ce;});}return null;};}function removeEntity(_0x3c19e3,_0x4e31b6){return function(_0x2506b0){if(_0x2506b0){return _0x2506b0[_0xa7a8('0x25')]()[_0xa7a8('0x24')](function(){var _0x1c1a00=_0x2506b0[_0xa7a8('0x26')]({'plain':!![]});var _0xe3b9c7='Tags';return db[_0xa7a8('0x27')][_0xa7a8('0x25')]({'where':{'type':_0xe3b9c7,'resourceId':_0x1c1a00['id']}})[_0xa7a8('0x24')](function(){return _0x2506b0;});})['then'](function(){_0x3c19e3[_0xa7a8('0x19')](0xcc)[_0xa7a8('0x28')]();});}};}function handleEntityNotFound(_0x6530d9,_0x41a801){return function(_0x22e9f9){if(!_0x22e9f9){_0x6530d9['sendStatus'](0x194);}return _0x22e9f9;};}function handleError(_0x26ef6e,_0x106289){_0x106289=_0x106289||0x1f4;return function(_0x5be739){logger[_0xa7a8('0x29')](_0x5be739[_0xa7a8('0x2a')]);if(_0x5be739[_0xa7a8('0x2b')]){delete _0x5be739[_0xa7a8('0x2b')];}_0x26ef6e[_0xa7a8('0x19')](_0x106289)[_0xa7a8('0x2c')](_0x5be739);};}exports['index']=function(_0x3707d3,_0xfdc4c7){var _0x2f4430={},_0x3210ea={},_0x4ff2b5={'count':0x0,'rows':[]};var _0x444b09=_[_0xa7a8('0x2d')](db[_0xa7a8('0x2e')][_0xa7a8('0x2f')],function(_0x5ee17c){return{'name':_0x5ee17c[_0xa7a8('0x30')],'type':_0x5ee17c[_0xa7a8('0x31')][_0xa7a8('0x32')]};});_0x3210ea[_0xa7a8('0x33')]=_[_0xa7a8('0x2d')](_0x444b09,_0xa7a8('0x2b'));_0x3210ea[_0xa7a8('0x34')]=_['keys'](_0x3707d3[_0xa7a8('0x34')]);_0x3210ea[_0xa7a8('0x35')]=_[_0xa7a8('0x36')](_0x3210ea[_0xa7a8('0x33')],_0x3210ea['query']);_0x2f4430[_0xa7a8('0x37')]=_[_0xa7a8('0x36')](_0x3210ea[_0xa7a8('0x33')],qs[_0xa7a8('0x38')](_0x3707d3['query'][_0xa7a8('0x38')]));_0x2f4430[_0xa7a8('0x37')]=_0x2f4430[_0xa7a8('0x37')][_0xa7a8('0x39')]?_0x2f4430['attributes']:_0x3210ea[_0xa7a8('0x33')];if(!_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x3a')](_0xa7a8('0x3b'))){_0x2f4430[_0xa7a8('0x1b')]=qs[_0xa7a8('0x1b')](_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x1b')]);_0x2f4430[_0xa7a8('0x1e')]=qs[_0xa7a8('0x1e')](_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x1e')]);}_0x2f4430[_0xa7a8('0x3c')]=qs[_0xa7a8('0x3d')](_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x3d')]);_0x2f4430[_0xa7a8('0x3e')]=qs[_0xa7a8('0x35')](_['pick'](_0x3707d3[_0xa7a8('0x34')],_0x3210ea[_0xa7a8('0x35')]),_0x444b09);if(_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x3f')]){_0x2f4430[_0xa7a8('0x3e')]=_[_0xa7a8('0x40')](_0x2f4430[_0xa7a8('0x3e')],{'$or':_['map'](_0x444b09,function(_0x34777e){if(_0x34777e[_0xa7a8('0x31')]!==_0xa7a8('0x41')){var _0x5138e4={};_0x5138e4[_0x34777e['name']]={'$like':'%'+_0x3707d3['query'][_0xa7a8('0x3f')]+'%'};return _0x5138e4;}})});}_0x2f4430=_[_0xa7a8('0x40')]({},_0x2f4430,_0x3707d3[_0xa7a8('0x42')]);var _0x19ba42={'where':_0x2f4430['where']};return db['Tag'][_0xa7a8('0x1d')](_0x19ba42)['then'](function(_0x239fcf){_0x4ff2b5[_0xa7a8('0x1d')]=_0x239fcf;if(_0x3707d3[_0xa7a8('0x34')][_0xa7a8('0x43')]){_0x2f4430[_0xa7a8('0x44')]=[{'all':!![]}];}return db[_0xa7a8('0x2e')][_0xa7a8('0x45')](_0x2f4430);})[_0xa7a8('0x24')](function(_0x5ec863){_0x4ff2b5[_0xa7a8('0x46')]=_0x5ec863;return _0x4ff2b5;})['then'](respondWithFilteredResult(_0xfdc4c7,_0x2f4430))[_0xa7a8('0x47')](handleError(_0xfdc4c7,null));};exports[_0xa7a8('0x48')]=function(_0xc9396c,_0x5aa1d1){var _0x1f00bb={'raw':!![],'where':{'id':_0xc9396c[_0xa7a8('0x49')]['id']}},_0x34c317={};_0x34c317['model']=_[_0xa7a8('0x4a')](db[_0xa7a8('0x2e')][_0xa7a8('0x2f')]);_0x34c317[_0xa7a8('0x34')]=_[_0xa7a8('0x4a')](_0xc9396c[_0xa7a8('0x34')]);_0x34c317[_0xa7a8('0x35')]=_[_0xa7a8('0x36')](_0x34c317['model'],_0x34c317[_0xa7a8('0x34')]);_0x1f00bb[_0xa7a8('0x37')]=_[_0xa7a8('0x36')](_0x34c317[_0xa7a8('0x33')],qs['fields'](_0xc9396c[_0xa7a8('0x34')][_0xa7a8('0x38')]));_0x1f00bb[_0xa7a8('0x37')]=_0x1f00bb[_0xa7a8('0x37')]['length']?_0x1f00bb['attributes']:_0x34c317[_0xa7a8('0x33')];if(_0xc9396c['query'][_0xa7a8('0x43')]){_0x1f00bb[_0xa7a8('0x44')]=[{'all':!![]}];}_0x1f00bb=_['merge']({},_0x1f00bb,_0xc9396c[_0xa7a8('0x42')]);return db[_0xa7a8('0x2e')][_0xa7a8('0x4b')](_0x1f00bb)[_0xa7a8('0x24')](handleEntityNotFound(_0x5aa1d1,null))[_0xa7a8('0x24')](respondWithResult(_0x5aa1d1,null))[_0xa7a8('0x47')](handleError(_0x5aa1d1,null));};exports[_0xa7a8('0x4c')]=function(_0x69aa92,_0x2b62cc){return db[_0xa7a8('0x2e')]['create'](_0x69aa92[_0xa7a8('0x4d')],{})[_0xa7a8('0x24')](function(_0x553b86){var _0x5123c4=_0x69aa92[_0xa7a8('0x4e')][_0xa7a8('0x26')]({'plain':!![]});if(!_0x5123c4)throw new Error(_0xa7a8('0x4f'));if(_0x5123c4[_0xa7a8('0x50')]===_0xa7a8('0x4e')){var _0x6c1272=_0x553b86[_0xa7a8('0x26')]({'plain':!![]});var _0x4af1f6=_0xa7a8('0x51');return db['UserProfileSection'][_0xa7a8('0x4b')]({'where':{'name':_0x4af1f6,'userProfileId':_0x5123c4[_0xa7a8('0x52')]},'raw':!![]})['then'](function(_0x57bf7c){if(_0x57bf7c&&_0x57bf7c[_0xa7a8('0x53')]===0x0){return db[_0xa7a8('0x27')][_0xa7a8('0x4c')]({'name':_0x6c1272[_0xa7a8('0x2b')],'resourceId':_0x6c1272['id'],'type':_0x57bf7c[_0xa7a8('0x2b')],'sectionId':_0x57bf7c['id']},{})[_0xa7a8('0x24')](function(){return _0x553b86;});}else{return _0x553b86;}})[_0xa7a8('0x47')](function(_0x3f5f86){logger['error'](_0xa7a8('0x54'),_0x3f5f86);throw _0x3f5f86;});}return _0x553b86;})[_0xa7a8('0x24')](respondWithResult(_0x2b62cc,0xc9))['catch'](handleError(_0x2b62cc,null));};exports[_0xa7a8('0x23')]=function(_0x2e89da,_0x5a43a6){if(_0x2e89da[_0xa7a8('0x4d')]['id']){delete _0x2e89da[_0xa7a8('0x4d')]['id'];}return db['Tag'][_0xa7a8('0x4b')]({'where':{'id':_0x2e89da[_0xa7a8('0x49')]['id']}})[_0xa7a8('0x24')](handleEntityNotFound(_0x5a43a6,null))[_0xa7a8('0x24')](saveUpdates(_0x2e89da[_0xa7a8('0x4d')],null))[_0xa7a8('0x24')](respondWithResult(_0x5a43a6,null))[_0xa7a8('0x47')](handleError(_0x5a43a6,null));};exports['destroy']=function(_0x1e8ade,_0x275fbb){return db[_0xa7a8('0x2e')][_0xa7a8('0x4b')]({'where':{'id':_0x1e8ade['params']['id']}})[_0xa7a8('0x24')](handleEntityNotFound(_0x275fbb,null))[_0xa7a8('0x24')](removeEntity(_0x275fbb,null))[_0xa7a8('0x47')](handleError(_0x275fbb,null));};exports[_0xa7a8('0x55')]=function(_0x143581,_0x1e7982){return db['Tag'][_0xa7a8('0x55')]()[_0xa7a8('0x24')](respondWithResult(_0x1e7982,null))[_0xa7a8('0x47')](handleError(_0x1e7982,null));}; \ No newline at end of file +var _0x1250=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Tags','UserProfileResource','error','stack','name','index','map','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','Tag','includeAll','include','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x599a8b,_0x1a1908){var _0x502590=function(_0x3cfcd7){while(--_0x3cfcd7){_0x599a8b['push'](_0x599a8b['shift']());}};_0x502590(++_0x1a1908);}(_0x1250,0xde));var _0x0125=function(_0x1b47e0,_0x45142b){_0x1b47e0=_0x1b47e0-0x0;var _0x5d9041=_0x1250[_0x1b47e0];return _0x5d9041;};'use strict';var emlformat=require(_0x0125('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0125('0x1'));var jsonpatch=require(_0x0125('0x2'));var rp=require(_0x0125('0x3'));var moment=require(_0x0125('0x4'));var BPromise=require(_0x0125('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0125('0x6'));var sox=require(_0x0125('0x7'));var csv=require(_0x0125('0x8'));var ejs=require(_0x0125('0x9'));var fs=require('fs');var fs_extra=require(_0x0125('0xa'));var _=require('lodash');var squel=require(_0x0125('0xb'));var crypto=require(_0x0125('0xc'));var jsforce=require(_0x0125('0xd'));var deskjs=require(_0x0125('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0125('0xf'));var Papa=require('papaparse');var Redis=require(_0x0125('0x10'));var authService=require(_0x0125('0x11'));var qs=require(_0x0125('0x12'));var as=require(_0x0125('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0125('0x14'));var config=require(_0x0125('0x15'));var licenseUtil=require(_0x0125('0x16'));var db=require(_0x0125('0x17'))['db'];function respondWithStatusCode(_0x3f71d4,_0x4b4bdf){_0x4b4bdf=_0x4b4bdf||0xcc;return function(_0x53f521){if(_0x53f521){return _0x3f71d4['sendStatus'](_0x4b4bdf);}return _0x3f71d4[_0x0125('0x18')](_0x4b4bdf)[_0x0125('0x19')]();};}function respondWithResult(_0x2a3bd2,_0x505838){_0x505838=_0x505838||0xc8;return function(_0x219873){if(_0x219873){return _0x2a3bd2[_0x0125('0x18')](_0x505838)[_0x0125('0x1a')](_0x219873);}};}function respondWithFilteredResult(_0x5dedfa,_0x27e979){return function(_0x441140){if(_0x441140){var _0x178d5d=typeof _0x27e979[_0x0125('0x1b')]===_0x0125('0x1c')&&typeof _0x27e979[_0x0125('0x1d')]===_0x0125('0x1c');var _0x5efac0=_0x441140[_0x0125('0x1e')];var _0x2634b9=_0x178d5d?0x0:_0x27e979[_0x0125('0x1b')];var _0x2562ae=_0x178d5d?_0x441140['count']:_0x27e979[_0x0125('0x1b')]+_0x27e979[_0x0125('0x1d')];var _0x79c804;if(_0x2562ae>=_0x5efac0){_0x2562ae=_0x5efac0;_0x79c804=0xc8;}else{_0x79c804=0xce;}_0x5dedfa[_0x0125('0x18')](_0x79c804);return _0x5dedfa[_0x0125('0x1f')](_0x0125('0x20'),_0x2634b9+'-'+_0x2562ae+'/'+_0x5efac0)[_0x0125('0x1a')](_0x441140);}return null;};}function patchUpdates(_0x4b82e1){return function(_0x4b13d1){try{jsonpatch[_0x0125('0x21')](_0x4b13d1,_0x4b82e1,!![]);}catch(_0x4546de){return BPromise[_0x0125('0x22')](_0x4546de);}return _0x4b13d1[_0x0125('0x23')]();};}function saveUpdates(_0x4a1382,_0x2020f8){return function(_0x5af96a){if(_0x5af96a){return _0x5af96a[_0x0125('0x24')](_0x4a1382)['then'](function(_0x2aa796){return _0x2aa796;});}return null;};}function removeEntity(_0x18921f,_0x4716b2){return function(_0x23243a){if(_0x23243a){return _0x23243a[_0x0125('0x25')]()[_0x0125('0x26')](function(){var _0x2ee2e6=_0x23243a[_0x0125('0x27')]({'plain':!![]});var _0x4dc75d=_0x0125('0x28');return db[_0x0125('0x29')][_0x0125('0x25')]({'where':{'type':_0x4dc75d,'resourceId':_0x2ee2e6['id']}})[_0x0125('0x26')](function(){return _0x23243a;});})[_0x0125('0x26')](function(){_0x18921f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x18457f,_0x533951){return function(_0x546d21){if(!_0x546d21){_0x18457f['sendStatus'](0x194);}return _0x546d21;};}function handleError(_0x454914,_0x46642d){_0x46642d=_0x46642d||0x1f4;return function(_0x56759c){logger[_0x0125('0x2a')](_0x56759c[_0x0125('0x2b')]);if(_0x56759c[_0x0125('0x2c')]){delete _0x56759c[_0x0125('0x2c')];}_0x454914[_0x0125('0x18')](_0x46642d)['send'](_0x56759c);};}exports[_0x0125('0x2d')]=function(_0x1be9f6,_0x534234){var _0xbcb8df={},_0x1124b2={},_0x49023b={'count':0x0,'rows':[]};var _0x5b9f87=_[_0x0125('0x2e')](db['Tag']['rawAttributes'],function(_0x40ef2c){return{'name':_0x40ef2c['fieldName'],'type':_0x40ef2c[_0x0125('0x2f')][_0x0125('0x30')]};});_0x1124b2[_0x0125('0x31')]=_[_0x0125('0x2e')](_0x5b9f87,_0x0125('0x2c'));_0x1124b2[_0x0125('0x32')]=_[_0x0125('0x33')](_0x1be9f6['query']);_0x1124b2['filters']=_[_0x0125('0x34')](_0x1124b2['model'],_0x1124b2[_0x0125('0x32')]);_0xbcb8df[_0x0125('0x35')]=_['intersection'](_0x1124b2[_0x0125('0x31')],qs[_0x0125('0x36')](_0x1be9f6[_0x0125('0x32')]['fields']));_0xbcb8df['attributes']=_0xbcb8df[_0x0125('0x35')][_0x0125('0x37')]?_0xbcb8df[_0x0125('0x35')]:_0x1124b2[_0x0125('0x31')];if(!_0x1be9f6[_0x0125('0x32')]['hasOwnProperty'](_0x0125('0x38'))){_0xbcb8df['limit']=qs[_0x0125('0x1d')](_0x1be9f6[_0x0125('0x32')][_0x0125('0x1d')]);_0xbcb8df[_0x0125('0x1b')]=qs['offset'](_0x1be9f6[_0x0125('0x32')][_0x0125('0x1b')]);}_0xbcb8df[_0x0125('0x39')]=qs['sort'](_0x1be9f6[_0x0125('0x32')][_0x0125('0x3a')]);_0xbcb8df[_0x0125('0x3b')]=qs[_0x0125('0x3c')](_[_0x0125('0x3d')](_0x1be9f6['query'],_0x1124b2[_0x0125('0x3c')]),_0x5b9f87);if(_0x1be9f6[_0x0125('0x32')][_0x0125('0x3e')]){_0xbcb8df[_0x0125('0x3b')]=_[_0x0125('0x3f')](_0xbcb8df[_0x0125('0x3b')],{'$or':_[_0x0125('0x2e')](_0x5b9f87,function(_0x283004){if(_0x283004[_0x0125('0x2f')]!==_0x0125('0x40')){var _0x41a502={};_0x41a502[_0x283004[_0x0125('0x2c')]]={'$like':'%'+_0x1be9f6[_0x0125('0x32')][_0x0125('0x3e')]+'%'};return _0x41a502;}})});}_0xbcb8df=_['merge']({},_0xbcb8df,_0x1be9f6[_0x0125('0x41')]);var _0x19a1c7={'where':_0xbcb8df[_0x0125('0x3b')]};return db[_0x0125('0x42')][_0x0125('0x1e')](_0x19a1c7)[_0x0125('0x26')](function(_0xebed68){_0x49023b[_0x0125('0x1e')]=_0xebed68;if(_0x1be9f6[_0x0125('0x32')][_0x0125('0x43')]){_0xbcb8df[_0x0125('0x44')]=[{'all':!![]}];}return db[_0x0125('0x42')]['findAll'](_0xbcb8df);})[_0x0125('0x26')](function(_0x97fb82){_0x49023b['rows']=_0x97fb82;return _0x49023b;})['then'](respondWithFilteredResult(_0x534234,_0xbcb8df))[_0x0125('0x45')](handleError(_0x534234,null));};exports[_0x0125('0x46')]=function(_0x92d7b7,_0x5e2a93){var _0x11f5dc={'raw':!![],'where':{'id':_0x92d7b7[_0x0125('0x47')]['id']}},_0xbebd4d={};_0xbebd4d[_0x0125('0x31')]=_[_0x0125('0x33')](db[_0x0125('0x42')]['rawAttributes']);_0xbebd4d[_0x0125('0x32')]=_['keys'](_0x92d7b7[_0x0125('0x32')]);_0xbebd4d['filters']=_[_0x0125('0x34')](_0xbebd4d['model'],_0xbebd4d[_0x0125('0x32')]);_0x11f5dc['attributes']=_['intersection'](_0xbebd4d[_0x0125('0x31')],qs['fields'](_0x92d7b7['query'][_0x0125('0x36')]));_0x11f5dc[_0x0125('0x35')]=_0x11f5dc[_0x0125('0x35')][_0x0125('0x37')]?_0x11f5dc[_0x0125('0x35')]:_0xbebd4d[_0x0125('0x31')];if(_0x92d7b7[_0x0125('0x32')][_0x0125('0x43')]){_0x11f5dc[_0x0125('0x44')]=[{'all':!![]}];}_0x11f5dc=_[_0x0125('0x3f')]({},_0x11f5dc,_0x92d7b7[_0x0125('0x41')]);return db[_0x0125('0x42')][_0x0125('0x48')](_0x11f5dc)[_0x0125('0x26')](handleEntityNotFound(_0x5e2a93,null))[_0x0125('0x26')](respondWithResult(_0x5e2a93,null))[_0x0125('0x45')](handleError(_0x5e2a93,null));};exports[_0x0125('0x49')]=function(_0x3067e4,_0x3d080f){return db[_0x0125('0x42')]['create'](_0x3067e4[_0x0125('0x4a')],{})[_0x0125('0x26')](function(_0xf71d9e){var _0x228e85=_0x3067e4['user']['get']({'plain':!![]});if(!_0x228e85)throw new Error(_0x0125('0x4b'));if(_0x228e85[_0x0125('0x4c')]===_0x0125('0x4d')){var _0x4a3259=_0xf71d9e[_0x0125('0x27')]({'plain':!![]});var _0x2d8c1e=_0x0125('0x28');return db[_0x0125('0x4e')]['find']({'where':{'name':_0x2d8c1e,'userProfileId':_0x228e85['userProfileId']},'raw':!![]})[_0x0125('0x26')](function(_0x135273){if(_0x135273&&_0x135273[_0x0125('0x4f')]===0x0){return db[_0x0125('0x29')][_0x0125('0x49')]({'name':_0x4a3259['name'],'resourceId':_0x4a3259['id'],'type':_0x135273[_0x0125('0x2c')],'sectionId':_0x135273['id']},{})[_0x0125('0x26')](function(){return _0xf71d9e;});}else{return _0xf71d9e;}})[_0x0125('0x45')](function(_0x10c0e7){logger[_0x0125('0x2a')](_0x0125('0x50'),_0x10c0e7);throw _0x10c0e7;});}return _0xf71d9e;})[_0x0125('0x26')](respondWithResult(_0x3d080f,0xc9))[_0x0125('0x45')](handleError(_0x3d080f,null));};exports[_0x0125('0x24')]=function(_0x4d28d0,_0x362bf6){if(_0x4d28d0[_0x0125('0x4a')]['id']){delete _0x4d28d0[_0x0125('0x4a')]['id'];}return db[_0x0125('0x42')]['find']({'where':{'id':_0x4d28d0[_0x0125('0x47')]['id']}})['then'](handleEntityNotFound(_0x362bf6,null))[_0x0125('0x26')](saveUpdates(_0x4d28d0[_0x0125('0x4a')],null))[_0x0125('0x26')](respondWithResult(_0x362bf6,null))[_0x0125('0x45')](handleError(_0x362bf6,null));};exports[_0x0125('0x25')]=function(_0xaa9672,_0x3540a2){return db[_0x0125('0x42')][_0x0125('0x48')]({'where':{'id':_0xaa9672['params']['id']}})[_0x0125('0x26')](handleEntityNotFound(_0x3540a2,null))[_0x0125('0x26')](removeEntity(_0x3540a2,null))[_0x0125('0x45')](handleError(_0x3540a2,null));};exports[_0x0125('0x51')]=function(_0xb73fd8,_0x541b07){return db['Tag']['describe']()[_0x0125('0x26')](respondWithResult(_0x541b07,null))[_0x0125('0x45')](handleError(_0x541b07,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index dd9e778..511126a 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 _0x5119=['../../config/environment','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5119,0xc0));var _0x9511=function(_0x334201,_0x39f06f){_0x334201=_0x334201-0x0;var _0x134700=_0x5119[_0x334201];return _0x134700;};'use strict';var _=require(_0x9511('0x0'));var util=require('util');var logger=require(_0x9511('0x1'))(_0x9511('0x2'));var moment=require(_0x9511('0x3'));var BPromise=require(_0x9511('0x4'));var rp=require(_0x9511('0x5'));var fs=require('fs');var path=require(_0x9511('0x6'));var rimraf=require(_0x9511('0x7'));var config=require(_0x9511('0x8'));var attributes=require('./tag.attributes');module['exports']=function(_0x5575b5,_0xda3c1a){return _0x5575b5['define']('Tag',attributes,{'tableName':_0x9511('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac7f=['Tag','tools_tags','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xac7f,0x1e2));var _0xfac7=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xac7f[_0x13ea00];return _0x1f7347;};'use strict';var _=require(_0xfac7('0x0'));var util=require('util');var logger=require(_0xfac7('0x1'))(_0xfac7('0x2'));var moment=require(_0xfac7('0x3'));var BPromise=require('bluebird');var rp=require(_0xfac7('0x4'));var fs=require('fs');var path=require(_0xfac7('0x5'));var rimraf=require(_0xfac7('0x6'));var config=require(_0xfac7('0x7'));var attributes=require(_0xfac7('0x8'));module[_0xfac7('0x9')]=function(_0x523494,_0x31c831){return _0x523494['define'](_0xfac7('0xa'),attributes,{'tableName':_0xfac7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index bc8bf6d..038b73f 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','error'];(function(_0x1ee211,_0x5dca96){var _0x3d5fc7=function(_0x5d1f32){while(--_0x5d1f32){_0x1ee211['push'](_0x1ee211['shift']());}};_0x3d5fc7(++_0x5dca96);}(_0x207c,0x1e8));var _0xc207=function(_0x251f27,_0x1237bc){_0x251f27=_0x251f27-0x0;var _0x452654=_0x207c[_0x251f27];return _0x452654;};'use strict';var _=require('lodash');var util=require(_0xc207('0x0'));var moment=require(_0xc207('0x1'));var BPromise=require(_0xc207('0x2'));var rs=require(_0xc207('0x3'));var fs=require('fs');var Redis=require(_0xc207('0x4'));var db=require(_0xc207('0x5'))['db'];var utils=require(_0xc207('0x6'));var logger=require('../../config/logger')(_0xc207('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc207('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('Tag,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('Tag,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0xb717=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x196e8d,_0x328ac4){var _0x5200d7=function(_0x23d5f3){while(--_0x23d5f3){_0x196e8d['push'](_0x196e8d['shift']());}};_0x5200d7(++_0x328ac4);}(_0xb717,0x1b4));var _0x7b71=function(_0x2fd339,_0x11a643){_0x2fd339=_0x2fd339-0x0;var _0x132ba8=_0xb717[_0x2fd339];return _0x132ba8;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b71('0x2'));var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217efe,_0x27b060,_0xd81a5c){return new BPromise(function(_0x4238f6,_0xc46853){return client['request'](_0x217efe,_0xd81a5c)[_0x7b71('0xa')](function(_0x3e13a1){logger['info'](_0x7b71('0xb'),_0x27b060,_0x7b71('0xc'));logger[_0x7b71('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x27b060,_0x7b71('0xc'),JSON['stringify'](_0x3e13a1));if(_0x3e13a1[_0x7b71('0xe')]){if(_0x3e13a1['error'][_0x7b71('0xf')]===0x1f4){logger[_0x7b71('0xe')](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);return _0xc46853(_0x3e13a1['error'][_0x7b71('0x10')]);}logger['error'](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')]['message']);return _0x4238f6(_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);}else{logger[_0x7b71('0x11')]('Tag,\x20%s,\x20%s',_0x27b060,'request\x20sent');_0x4238f6(_0x3e13a1[_0x7b71('0x12')][_0x7b71('0x10')]);}})[_0x7b71('0x13')](function(_0x1b5d57){logger['error'](_0x7b71('0xb'),_0x27b060,_0x1b5d57);_0xc46853(_0x1b5d57);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index ddbc134..5f1de35 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'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 2335868..62750d6 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 _0x0713=['STRING','name'];(function(_0x46ced5,_0x5dc6f6){var _0x599d5d=function(_0x6fa289){while(--_0x6fa289){_0x46ced5['push'](_0x46ced5['shift']());}};_0x599d5d(++_0x5dc6f6);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'description':{'type':Sequelize[_0x3071('0x0')]}}; \ No newline at end of file +var _0xb10b=['name','sequelize','STRING'];(function(_0x417011,_0x273680){var _0x15f5d6=function(_0x5abc52){while(--_0x5abc52){_0x417011['push'](_0x417011['shift']());}};_0x15f5d6(++_0x273680);}(_0xb10b,0x12a));var _0xbb10=function(_0xfc2644,_0x4a3b13){_0xfc2644=_0xfc2644-0x0;var _0x4873b7=_0xb10b[_0xfc2644];return _0x4873b7;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 3eeb991..8bc020c 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 _0xa936=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','end','json','undefined','limit','count','offset','status','Content-Range','reject','save','then','sendStatus','error','stack','name','index','Team','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','catch','body','user','get','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','Sequelize','QueryTypes','SELECT','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId','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','UserProfileResource','Teams','send','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','toLowerCase','Queue','capitalize','Queues','addQueues','add','ids','removeQueues','remove','addAgents','isArray','Mail','Sms','Fax','Openchannel','Whatsapp','penalty','QueueId','Voice','TeamVoiceQueue','User','online','voicePause','upsert','isNil','interface','SIP/%s','all','UserVoicePrefix','VoicePrefixId','removeAgents','Chat','Queue:remove','UserVoiceQueueRt','getAgents','order','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x1c0d0c,_0xb9cecd){var _0x580f29=function(_0x58c1b2){while(--_0x58c1b2){_0x1c0d0c['push'](_0x1c0d0c['shift']());}};_0x580f29(++_0xb9cecd);}(_0xa936,0x1aa));var _0x6a93=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xa936[_0x25e7cb];return _0x375d92;};'use strict';var emlformat=require(_0x6a93('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6a93('0x1'));var rp=require(_0x6a93('0x2'));var moment=require(_0x6a93('0x3'));var BPromise=require(_0x6a93('0x4'));var Mustache=require(_0x6a93('0x5'));var util=require('util');var path=require(_0x6a93('0x6'));var sox=require(_0x6a93('0x7'));var csv=require(_0x6a93('0x8'));var ejs=require(_0x6a93('0x9'));var fs=require('fs');var fs_extra=require(_0x6a93('0xa'));var _=require(_0x6a93('0xb'));var squel=require('squel');var crypto=require(_0x6a93('0xc'));var jsforce=require(_0x6a93('0xd'));var deskjs=require(_0x6a93('0xe'));var toCsv=require(_0x6a93('0x8'));var querystring=require('querystring');var Papa=require(_0x6a93('0xf'));var Redis=require(_0x6a93('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6a93('0x11'));var as=require(_0x6a93('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6a93('0x13'))('api');var utils=require(_0x6a93('0x14'));var config=require(_0x6a93('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6a93('0x16'))['db'];config[_0x6a93('0x17')]=_[_0x6a93('0x18')](config[_0x6a93('0x17')],{'host':_0x6a93('0x19'),'port':0x18eb});var socket=require(_0x6a93('0x1a'))(new Redis(config[_0x6a93('0x17')]));require(_0x6a93('0x1b'))[_0x6a93('0x1c')](socket);function respondWithStatusCode(_0x4963f8,_0x1c08cf){_0x1c08cf=_0x1c08cf||0xcc;return function(_0x18f0c4){if(_0x18f0c4){return _0x4963f8['sendStatus'](_0x1c08cf);}return _0x4963f8['status'](_0x1c08cf)[_0x6a93('0x1d')]();};}function respondWithResult(_0x45c94a,_0x42ae9a){_0x42ae9a=_0x42ae9a||0xc8;return function(_0x29fba9){if(_0x29fba9){return _0x45c94a['status'](_0x42ae9a)[_0x6a93('0x1e')](_0x29fba9);}};}function respondWithFilteredResult(_0x48785c,_0x152ffe){return function(_0x1933cf){if(_0x1933cf){var _0x8b85bc=typeof _0x152ffe['offset']===_0x6a93('0x1f')&&typeof _0x152ffe[_0x6a93('0x20')]===_0x6a93('0x1f');var _0x5dccfd=_0x1933cf[_0x6a93('0x21')];var _0x382f35=_0x8b85bc?0x0:_0x152ffe[_0x6a93('0x22')];var _0x1c4852=_0x8b85bc?_0x1933cf[_0x6a93('0x21')]:_0x152ffe['offset']+_0x152ffe[_0x6a93('0x20')];var _0x63f0c8;if(_0x1c4852>=_0x5dccfd){_0x1c4852=_0x5dccfd;_0x63f0c8=0xc8;}else{_0x63f0c8=0xce;}_0x48785c[_0x6a93('0x23')](_0x63f0c8);return _0x48785c['set'](_0x6a93('0x24'),_0x382f35+'-'+_0x1c4852+'/'+_0x5dccfd)[_0x6a93('0x1e')](_0x1933cf);}return null;};}function patchUpdates(_0x38aa06){return function(_0x58e4ee){try{jsonpatch['apply'](_0x58e4ee,_0x38aa06,!![]);}catch(_0x46bbc6){return BPromise[_0x6a93('0x25')](_0x46bbc6);}return _0x58e4ee[_0x6a93('0x26')]();};}function saveUpdates(_0x17c99b,_0x5efcd0){return function(_0x369d01){if(_0x369d01){return _0x369d01['update'](_0x17c99b)[_0x6a93('0x27')](function(_0x39676f){return _0x39676f;});}return null;};}function handleEntityNotFound(_0x4911f8,_0x5843ca){return function(_0x1020d9){if(!_0x1020d9){_0x4911f8[_0x6a93('0x28')](0x194);}return _0x1020d9;};}function handleError(_0x2c6cab,_0x5f17c7){_0x5f17c7=_0x5f17c7||0x1f4;return function(_0x2a5e93){logger[_0x6a93('0x29')](_0x2a5e93[_0x6a93('0x2a')]);if(_0x2a5e93[_0x6a93('0x2b')]){delete _0x2a5e93['name'];}_0x2c6cab[_0x6a93('0x23')](_0x5f17c7)['send'](_0x2a5e93);};}exports[_0x6a93('0x2c')]=function(_0x2f7e60,_0x26c042){var _0x5ee5ba={},_0x132b31={},_0x109085={'count':0x0,'rows':[]};var _0x5667a2=_['map'](db[_0x6a93('0x2d')][_0x6a93('0x2e')],function(_0x253b9e){return{'name':_0x253b9e[_0x6a93('0x2f')],'type':_0x253b9e[_0x6a93('0x30')][_0x6a93('0x31')]};});_0x132b31[_0x6a93('0x32')]=_[_0x6a93('0x33')](_0x5667a2,_0x6a93('0x2b'));_0x132b31[_0x6a93('0x34')]=_[_0x6a93('0x35')](_0x2f7e60[_0x6a93('0x34')]);_0x132b31[_0x6a93('0x36')]=_[_0x6a93('0x37')](_0x132b31[_0x6a93('0x32')],_0x132b31[_0x6a93('0x34')]);_0x5ee5ba[_0x6a93('0x38')]=_[_0x6a93('0x37')](_0x132b31['model'],qs['fields'](_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x39')]));_0x5ee5ba[_0x6a93('0x38')]=_0x5ee5ba['attributes'][_0x6a93('0x3a')]?_0x5ee5ba[_0x6a93('0x38')]:_0x132b31['model'];if(!_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x3b')](_0x6a93('0x3c'))){_0x5ee5ba[_0x6a93('0x20')]=qs[_0x6a93('0x20')](_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x20')]);_0x5ee5ba['offset']=qs['offset'](_0x2f7e60['query'][_0x6a93('0x22')]);}_0x5ee5ba['order']=qs[_0x6a93('0x3d')](_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x3d')]);_0x5ee5ba[_0x6a93('0x3e')]=qs[_0x6a93('0x36')](_[_0x6a93('0x3f')](_0x2f7e60[_0x6a93('0x34')],_0x132b31[_0x6a93('0x36')]),_0x5667a2);if(_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x40')]){_0x5ee5ba[_0x6a93('0x3e')]=_[_0x6a93('0x41')](_0x5ee5ba[_0x6a93('0x3e')],{'$or':_[_0x6a93('0x33')](_0x5667a2,function(_0x26be72){if(_0x26be72['type']!=='VIRTUAL'){var _0x2f6e48={};_0x2f6e48[_0x26be72[_0x6a93('0x2b')]]={'$like':'%'+_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x40')]+'%'};return _0x2f6e48;}})});}_0x5ee5ba=_[_0x6a93('0x41')]({},_0x5ee5ba,_0x2f7e60[_0x6a93('0x42')]);var _0x320bfc={'where':_0x5ee5ba[_0x6a93('0x3e')]};return db[_0x6a93('0x2d')]['count'](_0x320bfc)[_0x6a93('0x27')](function(_0x3f0248){_0x109085[_0x6a93('0x21')]=_0x3f0248;if(_0x2f7e60[_0x6a93('0x34')][_0x6a93('0x43')]){_0x5ee5ba[_0x6a93('0x44')]=[{'all':!![]}];}return db[_0x6a93('0x2d')][_0x6a93('0x45')](_0x5ee5ba);})['then'](function(_0x31aa43){_0x109085[_0x6a93('0x46')]=_0x31aa43;return _0x109085;})[_0x6a93('0x27')](respondWithFilteredResult(_0x26c042,_0x5ee5ba))['catch'](handleError(_0x26c042,null));};exports[_0x6a93('0x47')]=function(_0x7d75e7,_0x6a92cc){var _0xc2a3e4={'raw':![],'where':{'id':_0x7d75e7[_0x6a93('0x48')]['id']}},_0x50174e={};_0x50174e[_0x6a93('0x32')]=_[_0x6a93('0x35')](db[_0x6a93('0x2d')][_0x6a93('0x2e')]);_0x50174e[_0x6a93('0x34')]=_[_0x6a93('0x35')](_0x7d75e7[_0x6a93('0x34')]);_0x50174e['filters']=_[_0x6a93('0x37')](_0x50174e[_0x6a93('0x32')],_0x50174e[_0x6a93('0x34')]);_0xc2a3e4[_0x6a93('0x38')]=_['intersection'](_0x50174e['model'],qs[_0x6a93('0x39')](_0x7d75e7['query'][_0x6a93('0x39')]));_0xc2a3e4['attributes']=_0xc2a3e4[_0x6a93('0x38')][_0x6a93('0x3a')]?_0xc2a3e4[_0x6a93('0x38')]:_0x50174e[_0x6a93('0x32')];if(_0x7d75e7['query'][_0x6a93('0x43')]){_0xc2a3e4[_0x6a93('0x44')]=[{'all':!![]}];}_0xc2a3e4=_[_0x6a93('0x41')]({},_0xc2a3e4,_0x7d75e7[_0x6a93('0x42')]);return db[_0x6a93('0x2d')]['find'](_0xc2a3e4)['then'](handleEntityNotFound(_0x6a92cc,null))[_0x6a93('0x27')](respondWithResult(_0x6a92cc,null))[_0x6a93('0x49')](handleError(_0x6a92cc,null));};exports['create']=function(_0x363179,_0x3a12eb){return db[_0x6a93('0x2d')]['create'](_0x363179[_0x6a93('0x4a')],{})[_0x6a93('0x27')](function(_0xa7bb62){var _0x5d0927=_0x363179[_0x6a93('0x4b')][_0x6a93('0x4c')]({'plain':!![]});if(!_0x5d0927)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5d0927[_0x6a93('0x4d')]===_0x6a93('0x4b')){var _0xc2605b=_0xa7bb62[_0x6a93('0x4c')]({'plain':!![]});var _0x37b16d='Teams';return db[_0x6a93('0x4e')][_0x6a93('0x4f')]({'where':{'name':_0x37b16d,'userProfileId':_0x5d0927['userProfileId']},'raw':!![]})[_0x6a93('0x27')](function(_0xd29131){if(_0xd29131&&_0xd29131[_0x6a93('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xc2605b['name'],'resourceId':_0xc2605b['id'],'type':_0xd29131[_0x6a93('0x2b')],'sectionId':_0xd29131['id']},{})[_0x6a93('0x27')](function(){return _0xa7bb62;});}else{return _0xa7bb62;}})[_0x6a93('0x49')](function(_0x5303dd){logger[_0x6a93('0x29')](_0x6a93('0x51'),_0x5303dd);throw _0x5303dd;});}return _0xa7bb62;})[_0x6a93('0x27')](respondWithResult(_0x3a12eb,0xc9))[_0x6a93('0x49')](handleError(_0x3a12eb,null));};exports[_0x6a93('0x52')]=function(_0x31935f,_0x13417e){if(_0x31935f[_0x6a93('0x4a')]['id']){delete _0x31935f[_0x6a93('0x4a')]['id'];}return db['Team'][_0x6a93('0x4f')]({'where':{'id':_0x31935f[_0x6a93('0x48')]['id']}})[_0x6a93('0x27')](handleEntityNotFound(_0x13417e,null))[_0x6a93('0x27')](saveUpdates(_0x31935f['body'],null))[_0x6a93('0x27')](respondWithResult(_0x13417e,null))[_0x6a93('0x49')](handleError(_0x13417e,null));};exports[_0x6a93('0x53')]=function(_0x5d0fd2,_0x447ef4){var _0x2c9db6=_0x5d0fd2[_0x6a93('0x48')]['id'];var _0x57cbbf=[];return db[_0x6a93('0x54')][_0x6a93('0x55')](function(_0xfd5f8){var _0x57428e='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x57428e,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8})[_0x6a93('0x27')](function(_0x48a3e0){_0x57cbbf=_[_0x6a93('0x33')](_0x48a3e0,function(_0x527a6a){return Number(_0x527a6a['UserId']);});})[_0x6a93('0x27')](function(){var _0x180f6c=_0x6a93('0x59')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x180f6c,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x5477ce){var _0x2a9e97=_[_0x6a93('0x33')](_0x5477ce,function(_0x25e261){return Number(_0x25e261[_0x6a93('0x5a')]);});return db[_0x6a93('0x5b')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'VoiceQueueId':{'$in':_0x2a9e97}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x4e75f0=_0x6a93('0x5c')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x4e75f0,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')]['SELECT'],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x36ed10){var _0x4f1d40=_[_0x6a93('0x33')](_0x36ed10,function(_0x51966b){return Number(_0x51966b[_0x6a93('0x5d')]);});return db[_0x6a93('0x5e')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'MailQueueId':{'$in':_0x4f1d40}},'transaction':_0xfd5f8});})['then'](function(){var _0x9ade92=_0x6a93('0x5f')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x9ade92,{'type':db[_0x6a93('0x56')]['QueryTypes'][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x5f0b5e){var _0x442a2d=_['map'](_0x5f0b5e,function(_0x492107){return Number(_0x492107['SmsQueueId']);});return db[_0x6a93('0x60')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'SmsQueueId':{'$in':_0x442a2d}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x4447a8='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c9db6;return db[_0x6a93('0x54')]['query'](_0x4447a8,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x3af8db){var _0x104a35=_[_0x6a93('0x33')](_0x3af8db,function(_0x329008){return Number(_0x329008[_0x6a93('0x61')]);});return db['UserChatQueue'][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'ChatQueueId':{'$in':_0x104a35}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x565113='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x565113,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x5fb881){var _0x589d58=_[_0x6a93('0x33')](_0x5fb881,function(_0x45882c){return Number(_0x45882c['FaxQueueId']);});return db['UserFaxQueue'][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'FaxQueueId':{'$in':_0x589d58}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x22d3d7=_0x6a93('0x62')+_0x2c9db6;return db[_0x6a93('0x54')][_0x6a93('0x34')](_0x22d3d7,{'type':db[_0x6a93('0x56')][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x41a669){var _0x18d1eb=_['map'](_0x41a669,function(_0x10e6d4){return Number(_0x10e6d4[_0x6a93('0x63')]);});return db[_0x6a93('0x64')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'OpenchannelQueueId':{'$in':_0x18d1eb}},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){var _0x799c81=_0x6a93('0x65')+_0x2c9db6;return db[_0x6a93('0x54')]['query'](_0x799c81,{'type':db['Sequelize'][_0x6a93('0x57')][_0x6a93('0x58')],'raw':!![],'transaction':_0xfd5f8});})['then'](function(_0x4af24c){var _0x175b6f=_[_0x6a93('0x33')](_0x4af24c,function(_0xd443a3){return Number(_0xd443a3['WhatsappQueueId']);});return db[_0x6a93('0x66')][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'WhatsappQueueId':{'$in':_0x175b6f}},'transaction':_0xfd5f8});})['then'](function(){return db[_0x6a93('0x67')]['find']({'where':{'TeamId':_0x2c9db6}});})[_0x6a93('0x27')](function(_0x6e7477){if(_0x6e7477===null){return;}return db['UserVoicePrefix'][_0x6a93('0x53')]({'where':{'UserId':{'$in':_0x57cbbf},'VoicePrefixId':_0x6e7477['VoicePrefixId']},'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(){return db[_0x6a93('0x2d')][_0x6a93('0x53')]({'where':{'id':_0x2c9db6},'cascade':!![],'transaction':_0xfd5f8});})[_0x6a93('0x27')](function(_0x500416){if(_0x500416===0x0){_0x447ef4[_0x6a93('0x28')](0x194);}else{return db[_0x6a93('0x68')][_0x6a93('0x53')]({'where':{'type':_0x6a93('0x69'),'resourceId':_0x2c9db6},'cascade':!![],'transaction':_0xfd5f8})[_0x6a93('0x27')](function(){_0x447ef4[_0x6a93('0x23')](0xcc)['end']();});}})['catch'](function(_0x1a0b1a){_0x447ef4[_0x6a93('0x23')](0x1f4)[_0x6a93('0x6a')](_0x1a0b1a);});});};exports[_0x6a93('0x6b')]=function(_0x371062,_0x234d91,_0xc65191){return db[_0x6a93('0x2d')][_0x6a93('0x6c')]({'where':{'id':_0x371062[_0x6a93('0x48')]['id']}})['then'](handleEntityNotFound(_0x234d91,null))[_0x6a93('0x27')](function(_0x1e5d07){if(!_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')]||!utils[_0x6a93('0x6e')](_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')])){throw new db['Sequelize'][(_0x6a93('0x6f'))](_0x6a93('0x70'));}var _0x242c7a={};var _0x4bea3a={};_0x4bea3a[_0x6a93('0x32')]=_[_0x6a93('0x35')](db[_['capitalize'](_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')][_0x6a93('0x71')]())+_0x6a93('0x72')][_0x6a93('0x2e')]);_0x4bea3a[_0x6a93('0x34')]=_[_0x6a93('0x35')](_0x371062[_0x6a93('0x34')]);_0x4bea3a[_0x6a93('0x36')]=_[_0x6a93('0x37')](_0x4bea3a[_0x6a93('0x32')],_0x4bea3a[_0x6a93('0x34')]);_0x242c7a['attributes']=_['intersection'](_0x4bea3a[_0x6a93('0x32')],qs[_0x6a93('0x39')](_0x371062[_0x6a93('0x34')][_0x6a93('0x39')]));_0x242c7a[_0x6a93('0x38')]=_0x242c7a[_0x6a93('0x38')]['length']?_0x242c7a[_0x6a93('0x38')]:_0x4bea3a[_0x6a93('0x32')];_0x242c7a[_0x6a93('0x20')]=qs[_0x6a93('0x20')](_0x371062[_0x6a93('0x34')][_0x6a93('0x20')]);_0x242c7a[_0x6a93('0x22')]=qs[_0x6a93('0x22')](_0x371062['query']['offset']);_0x242c7a['order']=qs[_0x6a93('0x3d')](_0x371062['query'][_0x6a93('0x3d')]);_0x242c7a[_0x6a93('0x3e')]=qs['filters'](_[_0x6a93('0x3f')](_0x371062['query'],_0x4bea3a[_0x6a93('0x36')]));_0x242c7a=_[_0x6a93('0x41')]({},_0x242c7a,_0x371062[_0x6a93('0x42')]);return _0x1e5d07[_0x6a93('0x4c')+_[_0x6a93('0x73')](_0x371062[_0x6a93('0x34')][_0x6a93('0x6d')]['toLowerCase']())+_0x6a93('0x74')](_0x242c7a);})[_0x6a93('0x27')](respondWithResult(_0x234d91,null))['catch'](handleError(_0x234d91,null));};exports[_0x6a93('0x75')]=function(_0x218961,_0xafb956,_0x51bbca){return db[_0x6a93('0x2d')][_0x6a93('0x6c')]({'where':{'id':_0x218961[_0x6a93('0x48')]['id']}})[_0x6a93('0x27')](function(_0x4819bd){if(_0x4819bd){if(!_0x218961['body'][_0x6a93('0x6d')]||!utils['isValidChannel'](_0x218961[_0x6a93('0x4a')]['channel'])){throw new db['Sequelize'][(_0x6a93('0x6f'))](_0x6a93('0x70'));}return _0x4819bd[_0x6a93('0x76')+_[_0x6a93('0x73')](_0x218961['body'][_0x6a93('0x6d')][_0x6a93('0x71')]())+_0x6a93('0x74')](_0x218961[_0x6a93('0x4a')][_0x6a93('0x77')]);}return null;})[_0x6a93('0x27')](handleEntityNotFound(_0xafb956,null))[_0x6a93('0x27')](respondWithStatusCode(_0xafb956,null))[_0x6a93('0x49')](handleError(_0xafb956,null));};exports[_0x6a93('0x78')]=function(_0x584950,_0xa146cb,_0x34328f){return db[_0x6a93('0x2d')][_0x6a93('0x6c')]({'where':{'id':_0x584950['params']['id']}})[_0x6a93('0x27')](function(_0x1d56a3){if(_0x1d56a3){if(!_0x584950[_0x6a93('0x34')]['channel']||!utils[_0x6a93('0x6e')](_0x584950['query'][_0x6a93('0x6d')])){throw new db[(_0x6a93('0x56'))][(_0x6a93('0x6f'))](_0x6a93('0x70'));}return _0x1d56a3[_0x6a93('0x79')+_[_0x6a93('0x73')](_0x584950[_0x6a93('0x34')][_0x6a93('0x6d')][_0x6a93('0x71')]())+_0x6a93('0x74')](_0x584950[_0x6a93('0x34')][_0x6a93('0x77')]);}return null;})[_0x6a93('0x27')](handleEntityNotFound(_0xa146cb,null))[_0x6a93('0x27')](respondWithStatusCode(_0xa146cb,null))[_0x6a93('0x49')](handleError(_0xa146cb,null));};exports[_0x6a93('0x7a')]=function(_0x1f9a81,_0x452a3d){var _0x24e000=_[_0x6a93('0x7b')](_0x1f9a81['body'][_0x6a93('0x77')])?_0x1f9a81[_0x6a93('0x4a')][_0x6a93('0x77')]:[_0x1f9a81[_0x6a93('0x4a')]['ids']];var _0x53662e=_0x1f9a81[_0x6a93('0x48')]['id'];return db[_0x6a93('0x2d')][_0x6a93('0x4f')]({'where':{'id':_0x53662e}})['then'](handleEntityNotFound(_0x452a3d,null))[_0x6a93('0x27')](function(_0x18a6a0){if(_0x18a6a0){var _0x483c81=['Voice','Chat',_0x6a93('0x7c'),_0x6a93('0x7d'),_0x6a93('0x7e'),_0x6a93('0x7f'),_0x6a93('0x80')];return db[_0x6a93('0x54')][_0x6a93('0x55')](function(_0x32736d){var _0x581810=_[_0x6a93('0x33')](_0x483c81,function(_0x178846){var _0x5324d6={'attributes':['id',_0x6a93('0x2b')]};if(_0x178846==='Voice'){_0x5324d6['through']={'attributes':[_0x6a93('0x81')]};}return _0x18a6a0[_0x6a93('0x4c')+_0x178846+'Queues'](_0x5324d6)[_0x6a93('0x27')](function(_0xc04c3e){var _0x583e4d=_[_0x6a93('0x33')](_0xc04c3e,function(_0x4f169c){var _0x107dc2=_[_0x6a93('0x33')](_0x24e000,function(_0x239bbb){var _0xe20e9b={'where':{'UserId':_0x239bbb,[_0x178846+_0x6a93('0x82')]:_0x4f169c['id']},'transaction':_0x32736d};if(_0x178846===_0x6a93('0x83')){_0xe20e9b[_0x6a93('0x18')]={'penalty':_0x4f169c[_0x6a93('0x84')][_0x6a93('0x81')]};}return db[_0x6a93('0x85')+_0x178846+'Queue']['findOrCreate'](_0xe20e9b)[_0x6a93('0x27')](function(){socket['emit']('user'+_0x178846+'Queue:save',{'UserId':_0x239bbb,[_0x178846+_0x6a93('0x82')]:_0x4f169c['id']});if(_0x178846!==_0x6a93('0x83')){return;}return db['User'][_0x6a93('0x45')]({'where':{'id':_0x24e000,'online':0x1},'attributes':['id',_0x6a93('0x2b'),_0x6a93('0x86'),_0x6a93('0x87'),'interface'],'raw':!![]})[_0x6a93('0x27')](function(_0x7b023a){var _0x5a1606=_['map'](_0x7b023a,function(_0x5c38dc){return db['UserVoiceQueueRt'][_0x6a93('0x88')]({'membername':_0x5c38dc[_0x6a93('0x2b')],'UserId':_0x5c38dc['id'],'queue_name':_0x4f169c['name'],'VoiceQueueId':_0x4f169c['id'],'interface':_[_0x6a93('0x89')](_0x5c38dc[_0x6a93('0x8a')])?util['format'](_0x6a93('0x8b'),_0x5c38dc[_0x6a93('0x2b')]):_0x5c38dc[_0x6a93('0x8a')],'paused':_0x5c38dc[_0x6a93('0x87')]||![],'penalty':_0x4f169c[_0x6a93('0x84')]['penalty']},{'transaction':_0x32736d});});return Promise['all'](_0x5a1606);});});});return Promise[_0x6a93('0x8c')](_0x107dc2);});return Promise['all'](_0x583e4d);})['then'](function(){return db['TeamVoicePrefix'][_0x6a93('0x6c')]({'where':{'teamId':_0x53662e}})['then'](function(_0x230ce9){if(_0x230ce9){var _0x4c0ede=_[_0x6a93('0x33')](_0x24e000,function(_0x2d3058){db[_0x6a93('0x8d')]['upsert']({'UserId':_0x2d3058,'VoicePrefixId':_0x230ce9[_0x6a93('0x8e')]});});return Promise[_0x6a93('0x8c')](_0x4c0ede);}});});});return Promise[_0x6a93('0x8c')](_0x581810)['then'](function(){return _0x18a6a0[_0x6a93('0x7a')](_0x24e000,{'transaction':_0x32736d})['spread'](function(_0x4caa7c){return _0x4caa7c;});});});}})[_0x6a93('0x27')](respondWithResult(_0x452a3d,null))['catch'](handleError(_0x452a3d,null));};exports[_0x6a93('0x8f')]=function(_0x5a5e6e,_0x113a20){var _0x3e8c2e=_[_0x6a93('0x7b')](_0x5a5e6e[_0x6a93('0x34')][_0x6a93('0x77')])?_0x5a5e6e['query'][_0x6a93('0x77')]:[_0x5a5e6e[_0x6a93('0x34')][_0x6a93('0x77')]];var _0x267f70=_0x5a5e6e[_0x6a93('0x48')]['id'];return db['Team'][_0x6a93('0x4f')]({'where':{'id':_0x267f70}})[_0x6a93('0x27')](handleEntityNotFound(_0x113a20,null))[_0x6a93('0x27')](function(_0x33bc4e){if(_0x33bc4e){var _0xba3b77=[_0x6a93('0x83'),_0x6a93('0x90'),_0x6a93('0x7c'),_0x6a93('0x7d'),_0x6a93('0x7e'),'Openchannel',_0x6a93('0x80')];return db[_0x6a93('0x54')]['transaction'](function(_0x5b9c70){var _0x261933=_['map'](_0xba3b77,function(_0x59b7e4){var _0x47bd62={'attributes':['id',_0x6a93('0x2b')]};return _0x33bc4e[_0x6a93('0x4c')+_0x59b7e4+_0x6a93('0x74')](_0x47bd62)[_0x6a93('0x27')](function(_0xefebb8){var _0xae5ee3=_[_0x6a93('0x33')](_0xefebb8,function(_0x93fbc1){return _0x93fbc1[_0x6a93('0x8f')](_0x3e8c2e,{'transaction':_0x5b9c70})[_0x6a93('0x27')](function(){var _0x22bdb0=_['map'](_0x3e8c2e,function(_0x2d503e){socket['emit'](_0x6a93('0x4b')+_0x59b7e4+_0x6a93('0x91'),{'UserId':Number(_0x2d503e),[_0x59b7e4+_0x6a93('0x82')]:_0x93fbc1['id']});if(_0x59b7e4!==_0x6a93('0x83')){return;}return db[_0x6a93('0x92')][_0x6a93('0x53')]({'where':{'VoiceQueueId':_0x93fbc1['id'],'UserId':_0x2d503e},'transaction':_0x5b9c70});});return Promise['all'](_0x22bdb0);});});return Promise[_0x6a93('0x8c')](_0xae5ee3);});});return Promise['all'](_0x261933)[_0x6a93('0x27')](function(){return _0x33bc4e[_0x6a93('0x8f')](_0x3e8c2e,{'transaction':_0x5b9c70});})['then'](function(){return db[_0x6a93('0x67')][_0x6a93('0x6c')]({'where':{'teamId':_0x267f70}})[_0x6a93('0x27')](function(_0x1c4990){if(_0x1c4990){var _0xa3ee86=_[_0x6a93('0x33')](_0x3e8c2e,function(_0x4e77fa){db[_0x6a93('0x8d')][_0x6a93('0x53')]({'where':{'UserId':_0x4e77fa,'VoicePrefixId':_0x1c4990['VoicePrefixId']}});});return Promise[_0x6a93('0x8c')](_0xa3ee86);}});});});}})['then'](respondWithStatusCode(_0x113a20,null))[_0x6a93('0x49')](handleError(_0x113a20,null));};exports[_0x6a93('0x93')]=function(_0x3bd182,_0x337a15,_0x4f4777){var _0xb964a={};var _0x2406bc={};var _0x4e853a;var _0x17404b;return db[_0x6a93('0x2d')]['findOne']({'where':{'id':_0x3bd182['params']['id']}})['then'](handleEntityNotFound(_0x337a15,null))[_0x6a93('0x27')](function(_0x6e8444){if(_0x6e8444){_0x4e853a=_0x6e8444;_0x2406bc[_0x6a93('0x32')]=_[_0x6a93('0x35')](db[_0x6a93('0x85')]['rawAttributes']);_0x2406bc['query']=_[_0x6a93('0x35')](_0x3bd182[_0x6a93('0x34')]);_0x2406bc[_0x6a93('0x36')]=_[_0x6a93('0x37')](_0x2406bc[_0x6a93('0x32')],_0x2406bc[_0x6a93('0x34')]);_0xb964a['attributes']=_['intersection'](_0x2406bc[_0x6a93('0x32')],qs['fields'](_0x3bd182[_0x6a93('0x34')][_0x6a93('0x39')]));_0xb964a[_0x6a93('0x38')]=_0xb964a[_0x6a93('0x38')][_0x6a93('0x3a')]?_0xb964a[_0x6a93('0x38')]:_0x2406bc[_0x6a93('0x32')];_0xb964a[_0x6a93('0x94')]=qs[_0x6a93('0x3d')](_0x3bd182[_0x6a93('0x34')]['sort']);_0xb964a['where']=qs[_0x6a93('0x36')](_[_0x6a93('0x3f')](_0x3bd182['query'],_0x2406bc['filters']));if(_0x3bd182['query']['filter']){_0xb964a[_0x6a93('0x3e')]=_[_0x6a93('0x41')](_0xb964a[_0x6a93('0x3e')],{'$or':_[_0x6a93('0x33')](_0xb964a[_0x6a93('0x38')],function(_0x30074e){var _0x17eb23={};_0x17eb23[_0x30074e]={'$like':'%'+_0x3bd182[_0x6a93('0x34')][_0x6a93('0x40')]+'%'};return _0x17eb23;})});}_0xb964a=_['merge']({},_0xb964a,_0x3bd182[_0x6a93('0x42')]);return _0x4e853a[_0x6a93('0x93')](_0xb964a);}})[_0x6a93('0x27')](function(_0x2f92e1){if(_0x2f92e1){_0x17404b=_0x2f92e1[_0x6a93('0x3a')];if(!_0x3bd182['query']['hasOwnProperty'](_0x6a93('0x3c'))){_0xb964a['limit']=qs['limit'](_0x3bd182[_0x6a93('0x34')][_0x6a93('0x20')]);_0xb964a[_0x6a93('0x22')]=qs[_0x6a93('0x22')](_0x3bd182['query'][_0x6a93('0x22')]);}return _0x4e853a[_0x6a93('0x93')](_0xb964a);}})[_0x6a93('0x27')](function(_0x36338){if(_0x36338){return _0x36338?{'count':_0x17404b,'rows':_0x36338}:null;}})['then'](respondWithResult(_0x337a15,null))[_0x6a93('0x49')](handleError(_0x337a15,null));}; \ No newline at end of file +var _0x2d7c=['reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','Team','include','findAll','rows','catch','params','keys','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','find','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','getQueues','channel','isValidChannel','ValidationError','capitalize','toLowerCase','Queue','order','Queues','addQueues','Unknown\x20channel','add','ids','findOne','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','through','penalty','TeamVoiceQueue','User','emit','QueueId','online','voicePause','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','all','VoicePrefixId','removeAgents','Queue:remove','getAgents','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','set'];(function(_0x283782,_0x41ef05){var _0x5af2de=function(_0x43b3ac){while(--_0x43b3ac){_0x283782['push'](_0x283782['shift']());}};_0x5af2de(++_0x41ef05);}(_0x2d7c,0x1a3));var _0xc2d7=function(_0x20f060,_0xe160c9){_0x20f060=_0x20f060-0x0;var _0x46077c=_0x2d7c[_0x20f060];return _0x46077c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc2d7('0x0'));var jsonpatch=require(_0xc2d7('0x1'));var rp=require(_0xc2d7('0x2'));var moment=require('moment');var BPromise=require(_0xc2d7('0x3'));var Mustache=require(_0xc2d7('0x4'));var util=require(_0xc2d7('0x5'));var path=require(_0xc2d7('0x6'));var sox=require(_0xc2d7('0x7'));var csv=require(_0xc2d7('0x8'));var ejs=require(_0xc2d7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc2d7('0xa'));var squel=require('squel');var crypto=require(_0xc2d7('0xb'));var jsforce=require(_0xc2d7('0xc'));var deskjs=require(_0xc2d7('0xd'));var toCsv=require(_0xc2d7('0x8'));var querystring=require('querystring');var Papa=require(_0xc2d7('0xe'));var Redis=require(_0xc2d7('0xf'));var authService=require(_0xc2d7('0x10'));var qs=require(_0xc2d7('0x11'));var as=require(_0xc2d7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2d7('0x13'))(_0xc2d7('0x14'));var utils=require(_0xc2d7('0x15'));var config=require(_0xc2d7('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc2d7('0x17'))['db'];config[_0xc2d7('0x18')]=_[_0xc2d7('0x19')](config[_0xc2d7('0x18')],{'host':_0xc2d7('0x1a'),'port':0x18eb});var socket=require(_0xc2d7('0x1b'))(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x4af175,_0x316422){_0x316422=_0x316422||0xcc;return function(_0x404d4c){if(_0x404d4c){return _0x4af175[_0xc2d7('0x1c')](_0x316422);}return _0x4af175[_0xc2d7('0x1d')](_0x316422)[_0xc2d7('0x1e')]();};}function respondWithResult(_0x3ea940,_0x4d2176){_0x4d2176=_0x4d2176||0xc8;return function(_0x1be85f){if(_0x1be85f){return _0x3ea940[_0xc2d7('0x1d')](_0x4d2176)[_0xc2d7('0x1f')](_0x1be85f);}};}function respondWithFilteredResult(_0x20aa6f,_0x35ac9c){return function(_0x2172f2){if(_0x2172f2){var _0xbeba89=typeof _0x35ac9c['offset']===_0xc2d7('0x20')&&typeof _0x35ac9c['limit']===_0xc2d7('0x20');var _0x172abd=_0x2172f2[_0xc2d7('0x21')];var _0x12e54e=_0xbeba89?0x0:_0x35ac9c[_0xc2d7('0x22')];var _0x5aa5d5=_0xbeba89?_0x2172f2['count']:_0x35ac9c[_0xc2d7('0x22')]+_0x35ac9c[_0xc2d7('0x23')];var _0x2b0fab;if(_0x5aa5d5>=_0x172abd){_0x5aa5d5=_0x172abd;_0x2b0fab=0xc8;}else{_0x2b0fab=0xce;}_0x20aa6f[_0xc2d7('0x1d')](_0x2b0fab);return _0x20aa6f[_0xc2d7('0x24')]('Content-Range',_0x12e54e+'-'+_0x5aa5d5+'/'+_0x172abd)['json'](_0x2172f2);}return null;};}function patchUpdates(_0x46b4a7){return function(_0x23bde3){try{jsonpatch['apply'](_0x23bde3,_0x46b4a7,!![]);}catch(_0x513dba){return BPromise[_0xc2d7('0x25')](_0x513dba);}return _0x23bde3[_0xc2d7('0x26')]();};}function saveUpdates(_0x3ab53e,_0x3421da){return function(_0x2eb894){if(_0x2eb894){return _0x2eb894[_0xc2d7('0x27')](_0x3ab53e)[_0xc2d7('0x28')](function(_0x4b9c7a){return _0x4b9c7a;});}return null;};}function handleEntityNotFound(_0x3a8308,_0x67cc85){return function(_0x270fec){if(!_0x270fec){_0x3a8308[_0xc2d7('0x1c')](0x194);}return _0x270fec;};}function handleError(_0x5017dc,_0x341e4c){_0x341e4c=_0x341e4c||0x1f4;return function(_0x5d16b2){logger[_0xc2d7('0x29')](_0x5d16b2[_0xc2d7('0x2a')]);if(_0x5d16b2[_0xc2d7('0x2b')]){delete _0x5d16b2[_0xc2d7('0x2b')];}_0x5017dc['status'](_0x341e4c)[_0xc2d7('0x2c')](_0x5d16b2);};}exports[_0xc2d7('0x2d')]=function(_0x1f028f,_0x46c6e5){var _0x9116fc={},_0x2947c4={},_0x36ef7b={'count':0x0,'rows':[]};var _0x15b7c5=_[_0xc2d7('0x2e')](db['Team'][_0xc2d7('0x2f')],function(_0x3bdbee){return{'name':_0x3bdbee[_0xc2d7('0x30')],'type':_0x3bdbee[_0xc2d7('0x31')]['key']};});_0x2947c4[_0xc2d7('0x32')]=_[_0xc2d7('0x2e')](_0x15b7c5,_0xc2d7('0x2b'));_0x2947c4[_0xc2d7('0x33')]=_['keys'](_0x1f028f['query']);_0x2947c4[_0xc2d7('0x34')]=_[_0xc2d7('0x35')](_0x2947c4[_0xc2d7('0x32')],_0x2947c4[_0xc2d7('0x33')]);_0x9116fc[_0xc2d7('0x36')]=_[_0xc2d7('0x35')](_0x2947c4[_0xc2d7('0x32')],qs[_0xc2d7('0x37')](_0x1f028f[_0xc2d7('0x33')][_0xc2d7('0x37')]));_0x9116fc[_0xc2d7('0x36')]=_0x9116fc['attributes'][_0xc2d7('0x38')]?_0x9116fc[_0xc2d7('0x36')]:_0x2947c4[_0xc2d7('0x32')];if(!_0x1f028f[_0xc2d7('0x33')][_0xc2d7('0x39')](_0xc2d7('0x3a'))){_0x9116fc[_0xc2d7('0x23')]=qs['limit'](_0x1f028f[_0xc2d7('0x33')]['limit']);_0x9116fc['offset']=qs[_0xc2d7('0x22')](_0x1f028f[_0xc2d7('0x33')]['offset']);}_0x9116fc['order']=qs['sort'](_0x1f028f['query'][_0xc2d7('0x3b')]);_0x9116fc[_0xc2d7('0x3c')]=qs[_0xc2d7('0x34')](_[_0xc2d7('0x3d')](_0x1f028f[_0xc2d7('0x33')],_0x2947c4[_0xc2d7('0x34')]),_0x15b7c5);if(_0x1f028f[_0xc2d7('0x33')]['filter']){_0x9116fc[_0xc2d7('0x3c')]=_[_0xc2d7('0x3e')](_0x9116fc[_0xc2d7('0x3c')],{'$or':_[_0xc2d7('0x2e')](_0x15b7c5,function(_0x62b49e){if(_0x62b49e[_0xc2d7('0x31')]!==_0xc2d7('0x3f')){var _0x487a9b={};_0x487a9b[_0x62b49e[_0xc2d7('0x2b')]]={'$like':'%'+_0x1f028f['query'][_0xc2d7('0x40')]+'%'};return _0x487a9b;}})});}_0x9116fc=_[_0xc2d7('0x3e')]({},_0x9116fc,_0x1f028f[_0xc2d7('0x41')]);var _0x5da867={'where':_0x9116fc['where']};return db[_0xc2d7('0x42')][_0xc2d7('0x21')](_0x5da867)[_0xc2d7('0x28')](function(_0x5c7218){_0x36ef7b[_0xc2d7('0x21')]=_0x5c7218;if(_0x1f028f['query']['includeAll']){_0x9116fc[_0xc2d7('0x43')]=[{'all':!![]}];}return db[_0xc2d7('0x42')][_0xc2d7('0x44')](_0x9116fc);})['then'](function(_0x17b853){_0x36ef7b[_0xc2d7('0x45')]=_0x17b853;return _0x36ef7b;})[_0xc2d7('0x28')](respondWithFilteredResult(_0x46c6e5,_0x9116fc))[_0xc2d7('0x46')](handleError(_0x46c6e5,null));};exports['show']=function(_0xccbffc,_0x2a4b2e){var _0x24c92a={'raw':![],'where':{'id':_0xccbffc[_0xc2d7('0x47')]['id']}},_0x485537={};_0x485537[_0xc2d7('0x32')]=_[_0xc2d7('0x48')](db[_0xc2d7('0x42')][_0xc2d7('0x2f')]);_0x485537['query']=_[_0xc2d7('0x48')](_0xccbffc[_0xc2d7('0x33')]);_0x485537[_0xc2d7('0x34')]=_[_0xc2d7('0x35')](_0x485537[_0xc2d7('0x32')],_0x485537[_0xc2d7('0x33')]);_0x24c92a[_0xc2d7('0x36')]=_[_0xc2d7('0x35')](_0x485537[_0xc2d7('0x32')],qs[_0xc2d7('0x37')](_0xccbffc[_0xc2d7('0x33')]['fields']));_0x24c92a[_0xc2d7('0x36')]=_0x24c92a['attributes']['length']?_0x24c92a['attributes']:_0x485537[_0xc2d7('0x32')];if(_0xccbffc[_0xc2d7('0x33')][_0xc2d7('0x49')]){_0x24c92a['include']=[{'all':!![]}];}_0x24c92a=_[_0xc2d7('0x3e')]({},_0x24c92a,_0xccbffc[_0xc2d7('0x41')]);return db[_0xc2d7('0x42')]['find'](_0x24c92a)['then'](handleEntityNotFound(_0x2a4b2e,null))['then'](respondWithResult(_0x2a4b2e,null))[_0xc2d7('0x46')](handleError(_0x2a4b2e,null));};exports[_0xc2d7('0x4a')]=function(_0x5eb707,_0x417c6d){return db[_0xc2d7('0x42')][_0xc2d7('0x4a')](_0x5eb707[_0xc2d7('0x4b')],{})[_0xc2d7('0x28')](function(_0x1262ea){var _0xc093cc=_0x5eb707[_0xc2d7('0x4c')][_0xc2d7('0x4d')]({'plain':!![]});if(!_0xc093cc)throw new Error(_0xc2d7('0x4e'));if(_0xc093cc['role']===_0xc2d7('0x4c')){var _0x371542=_0x1262ea[_0xc2d7('0x4d')]({'plain':!![]});var _0x505f3b=_0xc2d7('0x4f');return db[_0xc2d7('0x50')][_0xc2d7('0x51')]({'where':{'name':_0x505f3b,'userProfileId':_0xc093cc['userProfileId']},'raw':!![]})[_0xc2d7('0x28')](function(_0xa3eecd){if(_0xa3eecd&&_0xa3eecd['autoAssociation']===0x0){return db[_0xc2d7('0x52')][_0xc2d7('0x4a')]({'name':_0x371542[_0xc2d7('0x2b')],'resourceId':_0x371542['id'],'type':_0xa3eecd[_0xc2d7('0x2b')],'sectionId':_0xa3eecd['id']},{})['then'](function(){return _0x1262ea;});}else{return _0x1262ea;}})['catch'](function(_0x4ad91e){logger[_0xc2d7('0x29')](_0xc2d7('0x53'),_0x4ad91e);throw _0x4ad91e;});}return _0x1262ea;})[_0xc2d7('0x28')](respondWithResult(_0x417c6d,0xc9))[_0xc2d7('0x46')](handleError(_0x417c6d,null));};exports['update']=function(_0x20e46b,_0x19a832){if(_0x20e46b[_0xc2d7('0x4b')]['id']){delete _0x20e46b[_0xc2d7('0x4b')]['id'];}return db[_0xc2d7('0x42')][_0xc2d7('0x51')]({'where':{'id':_0x20e46b[_0xc2d7('0x47')]['id']}})[_0xc2d7('0x28')](handleEntityNotFound(_0x19a832,null))[_0xc2d7('0x28')](saveUpdates(_0x20e46b[_0xc2d7('0x4b')],null))[_0xc2d7('0x28')](respondWithResult(_0x19a832,null))[_0xc2d7('0x46')](handleError(_0x19a832,null));};exports[_0xc2d7('0x54')]=function(_0x3b6b96,_0x2a3aad){var _0x323653=_0x3b6b96[_0xc2d7('0x47')]['id'];var _0xb34304=[];return db['sequelize'][_0xc2d7('0x55')](function(_0x4b2f51){var _0x27a86e=_0xc2d7('0x56')+_0x323653;return db[_0xc2d7('0x57')][_0xc2d7('0x33')](_0x27a86e,{'type':db[_0xc2d7('0x58')][_0xc2d7('0x59')][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51})[_0xc2d7('0x28')](function(_0x38af72){_0xb34304=_[_0xc2d7('0x2e')](_0x38af72,function(_0x2c4668){return Number(_0x2c4668[_0xc2d7('0x5b')]);});})[_0xc2d7('0x28')](function(){var _0x1c500f=_0xc2d7('0x5c')+_0x323653;return db[_0xc2d7('0x57')]['query'](_0x1c500f,{'type':db[_0xc2d7('0x58')][_0xc2d7('0x59')][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x27c199){var _0x196db5=_['map'](_0x27c199,function(_0x519621){return Number(_0x519621[_0xc2d7('0x5d')]);});return db[_0xc2d7('0x5e')][_0xc2d7('0x54')]({'where':{'UserId':{'$in':_0xb34304},'VoiceQueueId':{'$in':_0x196db5}},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){var _0xcfdc92='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x323653;return db[_0xc2d7('0x57')][_0xc2d7('0x33')](_0xcfdc92,{'type':db['Sequelize'][_0xc2d7('0x59')][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0xd691a2){var _0x468c4c=_[_0xc2d7('0x2e')](_0xd691a2,function(_0x221a70){return Number(_0x221a70[_0xc2d7('0x5f')]);});return db[_0xc2d7('0x60')][_0xc2d7('0x54')]({'where':{'UserId':{'$in':_0xb34304},'MailQueueId':{'$in':_0x468c4c}},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){var _0x1d609f=_0xc2d7('0x61')+_0x323653;return db[_0xc2d7('0x57')]['query'](_0x1d609f,{'type':db[_0xc2d7('0x58')]['QueryTypes'][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x3065ca){var _0x348dab=_[_0xc2d7('0x2e')](_0x3065ca,function(_0x4569c2){return Number(_0x4569c2[_0xc2d7('0x62')]);});return db[_0xc2d7('0x63')][_0xc2d7('0x54')]({'where':{'UserId':{'$in':_0xb34304},'SmsQueueId':{'$in':_0x348dab}},'transaction':_0x4b2f51});})['then'](function(){var _0x485277=_0xc2d7('0x64')+_0x323653;return db['sequelize']['query'](_0x485277,{'type':db[_0xc2d7('0x58')][_0xc2d7('0x59')][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x270b48){var _0x4b5189=_[_0xc2d7('0x2e')](_0x270b48,function(_0x26964d){return Number(_0x26964d['ChatQueueId']);});return db['UserChatQueue'][_0xc2d7('0x54')]({'where':{'UserId':{'$in':_0xb34304},'ChatQueueId':{'$in':_0x4b5189}},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){var _0x33dd90='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x323653;return db[_0xc2d7('0x57')]['query'](_0x33dd90,{'type':db[_0xc2d7('0x58')]['QueryTypes'][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x592084){var _0x525281=_['map'](_0x592084,function(_0x402af9){return Number(_0x402af9[_0xc2d7('0x65')]);});return db['UserFaxQueue'][_0xc2d7('0x54')]({'where':{'UserId':{'$in':_0xb34304},'FaxQueueId':{'$in':_0x525281}},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){var _0x33d6e0=_0xc2d7('0x66')+_0x323653;return db[_0xc2d7('0x57')]['query'](_0x33d6e0,{'type':db[_0xc2d7('0x58')]['QueryTypes'][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x1ec139){var _0x137c47=_[_0xc2d7('0x2e')](_0x1ec139,function(_0xbbdf99){return Number(_0xbbdf99['OpenchannelQueueId']);});return db[_0xc2d7('0x67')]['destroy']({'where':{'UserId':{'$in':_0xb34304},'OpenchannelQueueId':{'$in':_0x137c47}},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){var _0x1f8286=_0xc2d7('0x68')+_0x323653;return db[_0xc2d7('0x57')][_0xc2d7('0x33')](_0x1f8286,{'type':db['Sequelize'][_0xc2d7('0x59')][_0xc2d7('0x5a')],'raw':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x3b1b51){var _0x57069d=_[_0xc2d7('0x2e')](_0x3b1b51,function(_0x115240){return Number(_0x115240[_0xc2d7('0x69')]);});return db[_0xc2d7('0x6a')]['destroy']({'where':{'UserId':{'$in':_0xb34304},'WhatsappQueueId':{'$in':_0x57069d}},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){return db[_0xc2d7('0x6b')]['find']({'where':{'TeamId':_0x323653}});})[_0xc2d7('0x28')](function(_0x4015c8){if(_0x4015c8===null){return;}return db[_0xc2d7('0x6c')][_0xc2d7('0x54')]({'where':{'UserId':{'$in':_0xb34304},'VoicePrefixId':_0x4015c8['VoicePrefixId']},'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(){return db[_0xc2d7('0x42')][_0xc2d7('0x54')]({'where':{'id':_0x323653},'cascade':!![],'transaction':_0x4b2f51});})[_0xc2d7('0x28')](function(_0x2855e5){if(_0x2855e5===0x0){_0x2a3aad[_0xc2d7('0x1c')](0x194);}else{return db[_0xc2d7('0x52')][_0xc2d7('0x54')]({'where':{'type':_0xc2d7('0x4f'),'resourceId':_0x323653},'cascade':!![],'transaction':_0x4b2f51})['then'](function(){_0x2a3aad[_0xc2d7('0x1d')](0xcc)[_0xc2d7('0x1e')]();});}})['catch'](function(_0x52d728){_0x2a3aad['status'](0x1f4)[_0xc2d7('0x2c')](_0x52d728);});});};exports[_0xc2d7('0x6d')]=function(_0x2ceb88,_0x3336b4,_0x32e898){return db[_0xc2d7('0x42')]['findOne']({'where':{'id':_0x2ceb88['params']['id']}})['then'](handleEntityNotFound(_0x3336b4,null))[_0xc2d7('0x28')](function(_0x4748c0){if(!_0x2ceb88['query'][_0xc2d7('0x6e')]||!utils[_0xc2d7('0x6f')](_0x2ceb88[_0xc2d7('0x33')][_0xc2d7('0x6e')])){throw new db[(_0xc2d7('0x58'))][(_0xc2d7('0x70'))]('Unknown\x20channel');}var _0x5d6489={};var _0x4906ce={};_0x4906ce[_0xc2d7('0x32')]=_['keys'](db[_[_0xc2d7('0x71')](_0x2ceb88[_0xc2d7('0x33')]['channel'][_0xc2d7('0x72')]())+_0xc2d7('0x73')]['rawAttributes']);_0x4906ce[_0xc2d7('0x33')]=_['keys'](_0x2ceb88[_0xc2d7('0x33')]);_0x4906ce[_0xc2d7('0x34')]=_[_0xc2d7('0x35')](_0x4906ce[_0xc2d7('0x32')],_0x4906ce['query']);_0x5d6489[_0xc2d7('0x36')]=_[_0xc2d7('0x35')](_0x4906ce[_0xc2d7('0x32')],qs[_0xc2d7('0x37')](_0x2ceb88[_0xc2d7('0x33')][_0xc2d7('0x37')]));_0x5d6489[_0xc2d7('0x36')]=_0x5d6489[_0xc2d7('0x36')][_0xc2d7('0x38')]?_0x5d6489[_0xc2d7('0x36')]:_0x4906ce['model'];_0x5d6489[_0xc2d7('0x23')]=qs[_0xc2d7('0x23')](_0x2ceb88[_0xc2d7('0x33')]['limit']);_0x5d6489[_0xc2d7('0x22')]=qs[_0xc2d7('0x22')](_0x2ceb88[_0xc2d7('0x33')][_0xc2d7('0x22')]);_0x5d6489[_0xc2d7('0x74')]=qs[_0xc2d7('0x3b')](_0x2ceb88['query'][_0xc2d7('0x3b')]);_0x5d6489['where']=qs['filters'](_[_0xc2d7('0x3d')](_0x2ceb88[_0xc2d7('0x33')],_0x4906ce[_0xc2d7('0x34')]));_0x5d6489=_[_0xc2d7('0x3e')]({},_0x5d6489,_0x2ceb88[_0xc2d7('0x41')]);return _0x4748c0[_0xc2d7('0x4d')+_[_0xc2d7('0x71')](_0x2ceb88[_0xc2d7('0x33')][_0xc2d7('0x6e')][_0xc2d7('0x72')]())+_0xc2d7('0x75')](_0x5d6489);})['then'](respondWithResult(_0x3336b4,null))[_0xc2d7('0x46')](handleError(_0x3336b4,null));};exports[_0xc2d7('0x76')]=function(_0x14586c,_0x3929d1,_0x2988df){return db[_0xc2d7('0x42')]['findOne']({'where':{'id':_0x14586c[_0xc2d7('0x47')]['id']}})['then'](function(_0x167e16){if(_0x167e16){if(!_0x14586c['body'][_0xc2d7('0x6e')]||!utils[_0xc2d7('0x6f')](_0x14586c['body'][_0xc2d7('0x6e')])){throw new db[(_0xc2d7('0x58'))][(_0xc2d7('0x70'))](_0xc2d7('0x77'));}return _0x167e16[_0xc2d7('0x78')+_['capitalize'](_0x14586c['body'][_0xc2d7('0x6e')]['toLowerCase']())+'Queues'](_0x14586c[_0xc2d7('0x4b')][_0xc2d7('0x79')]);}return null;})[_0xc2d7('0x28')](handleEntityNotFound(_0x3929d1,null))['then'](respondWithStatusCode(_0x3929d1,null))[_0xc2d7('0x46')](handleError(_0x3929d1,null));};exports['removeQueues']=function(_0x53096b,_0x35dbfa,_0x47d001){return db['Team'][_0xc2d7('0x7a')]({'where':{'id':_0x53096b[_0xc2d7('0x47')]['id']}})[_0xc2d7('0x28')](function(_0x18be57){if(_0x18be57){if(!_0x53096b[_0xc2d7('0x33')]['channel']||!utils[_0xc2d7('0x6f')](_0x53096b[_0xc2d7('0x33')][_0xc2d7('0x6e')])){throw new db[(_0xc2d7('0x58'))][(_0xc2d7('0x70'))](_0xc2d7('0x77'));}return _0x18be57[_0xc2d7('0x7b')+_['capitalize'](_0x53096b['query']['channel'][_0xc2d7('0x72')]())+'Queues'](_0x53096b[_0xc2d7('0x33')][_0xc2d7('0x79')]);}return null;})[_0xc2d7('0x28')](handleEntityNotFound(_0x35dbfa,null))[_0xc2d7('0x28')](respondWithStatusCode(_0x35dbfa,null))['catch'](handleError(_0x35dbfa,null));};exports[_0xc2d7('0x7c')]=function(_0x266c40,_0x566cda){var _0x254b78=_[_0xc2d7('0x7d')](_0x266c40['body'][_0xc2d7('0x79')])?_0x266c40[_0xc2d7('0x4b')][_0xc2d7('0x79')]:[_0x266c40[_0xc2d7('0x4b')][_0xc2d7('0x79')]];var _0x290880=_0x266c40[_0xc2d7('0x47')]['id'];return db['Team'][_0xc2d7('0x51')]({'where':{'id':_0x290880}})[_0xc2d7('0x28')](handleEntityNotFound(_0x566cda,null))[_0xc2d7('0x28')](function(_0x4199c9){if(_0x4199c9){var _0x1c7420=[_0xc2d7('0x7e'),_0xc2d7('0x7f'),_0xc2d7('0x80'),_0xc2d7('0x81'),_0xc2d7('0x82'),_0xc2d7('0x83'),_0xc2d7('0x84')];return db[_0xc2d7('0x57')][_0xc2d7('0x55')](function(_0x2798a0){var _0x37b31f=_['map'](_0x1c7420,function(_0x338bb4){var _0x3fae93={'attributes':['id',_0xc2d7('0x2b')]};if(_0x338bb4===_0xc2d7('0x7e')){_0x3fae93[_0xc2d7('0x85')]={'attributes':[_0xc2d7('0x86')]};}return _0x4199c9[_0xc2d7('0x4d')+_0x338bb4+_0xc2d7('0x75')](_0x3fae93)[_0xc2d7('0x28')](function(_0xfa6923){var _0x394c49=_[_0xc2d7('0x2e')](_0xfa6923,function(_0x36453e){var _0x572f72=_[_0xc2d7('0x2e')](_0x254b78,function(_0x4c625b){var _0x409512={'where':{'UserId':_0x4c625b,[_0x338bb4+'QueueId']:_0x36453e['id']},'transaction':_0x2798a0};if(_0x338bb4===_0xc2d7('0x7e')){_0x409512[_0xc2d7('0x19')]={'penalty':_0x36453e[_0xc2d7('0x87')][_0xc2d7('0x86')]};}return db[_0xc2d7('0x88')+_0x338bb4+_0xc2d7('0x73')]['findOrCreate'](_0x409512)['then'](function(){socket[_0xc2d7('0x89')](_0xc2d7('0x4c')+_0x338bb4+'Queue:save',{'UserId':_0x4c625b,[_0x338bb4+_0xc2d7('0x8a')]:_0x36453e['id']});if(_0x338bb4!==_0xc2d7('0x7e')){return;}return db[_0xc2d7('0x88')][_0xc2d7('0x44')]({'where':{'id':_0x254b78,'online':0x1},'attributes':['id','name',_0xc2d7('0x8b'),_0xc2d7('0x8c'),'interface'],'raw':!![]})[_0xc2d7('0x28')](function(_0x51472e){var _0x5538b8=_[_0xc2d7('0x2e')](_0x51472e,function(_0x3e99ac){return db[_0xc2d7('0x8d')][_0xc2d7('0x8e')]({'membername':_0x3e99ac['name'],'UserId':_0x3e99ac['id'],'queue_name':_0x36453e[_0xc2d7('0x2b')],'VoiceQueueId':_0x36453e['id'],'interface':_[_0xc2d7('0x8f')](_0x3e99ac[_0xc2d7('0x90')])?util[_0xc2d7('0x91')](_0xc2d7('0x92'),_0x3e99ac[_0xc2d7('0x2b')]):_0x3e99ac[_0xc2d7('0x90')],'paused':_0x3e99ac[_0xc2d7('0x8c')]||![],'penalty':_0x36453e['TeamVoiceQueue'][_0xc2d7('0x86')]},{'transaction':_0x2798a0});});return Promise[_0xc2d7('0x93')](_0x5538b8);});});});return Promise[_0xc2d7('0x93')](_0x572f72);});return Promise['all'](_0x394c49);})['then'](function(){return db['TeamVoicePrefix'][_0xc2d7('0x7a')]({'where':{'teamId':_0x290880}})['then'](function(_0x301ee2){if(_0x301ee2){var _0x5ad887=_[_0xc2d7('0x2e')](_0x254b78,function(_0x33e4da){db['UserVoicePrefix'][_0xc2d7('0x8e')]({'UserId':_0x33e4da,'VoicePrefixId':_0x301ee2[_0xc2d7('0x94')]});});return Promise[_0xc2d7('0x93')](_0x5ad887);}});});});return Promise[_0xc2d7('0x93')](_0x37b31f)[_0xc2d7('0x28')](function(){return _0x4199c9[_0xc2d7('0x7c')](_0x254b78,{'transaction':_0x2798a0})['spread'](function(_0x22611a){return _0x22611a;});});});}})[_0xc2d7('0x28')](respondWithResult(_0x566cda,null))[_0xc2d7('0x46')](handleError(_0x566cda,null));};exports[_0xc2d7('0x95')]=function(_0x2b17cf,_0x3190f5){var _0x3383b9=_[_0xc2d7('0x7d')](_0x2b17cf[_0xc2d7('0x33')][_0xc2d7('0x79')])?_0x2b17cf[_0xc2d7('0x33')][_0xc2d7('0x79')]:[_0x2b17cf[_0xc2d7('0x33')][_0xc2d7('0x79')]];var _0x1585ed=_0x2b17cf[_0xc2d7('0x47')]['id'];return db['Team'][_0xc2d7('0x51')]({'where':{'id':_0x1585ed}})['then'](handleEntityNotFound(_0x3190f5,null))[_0xc2d7('0x28')](function(_0x3c05e){if(_0x3c05e){var _0xdf75db=[_0xc2d7('0x7e'),'Chat','Mail',_0xc2d7('0x81'),_0xc2d7('0x82'),_0xc2d7('0x83'),_0xc2d7('0x84')];return db[_0xc2d7('0x57')][_0xc2d7('0x55')](function(_0x5f3dfc){var _0x30b8bf=_['map'](_0xdf75db,function(_0x575493){var _0x432e5a={'attributes':['id',_0xc2d7('0x2b')]};return _0x3c05e[_0xc2d7('0x4d')+_0x575493+'Queues'](_0x432e5a)[_0xc2d7('0x28')](function(_0x24ab1a){var _0x2f3f06=_[_0xc2d7('0x2e')](_0x24ab1a,function(_0x524608){return _0x524608[_0xc2d7('0x95')](_0x3383b9,{'transaction':_0x5f3dfc})[_0xc2d7('0x28')](function(){var _0x5669f5=_[_0xc2d7('0x2e')](_0x3383b9,function(_0x144de8){socket[_0xc2d7('0x89')]('user'+_0x575493+_0xc2d7('0x96'),{'UserId':Number(_0x144de8),[_0x575493+'QueueId']:_0x524608['id']});if(_0x575493!==_0xc2d7('0x7e')){return;}return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x524608['id'],'UserId':_0x144de8},'transaction':_0x5f3dfc});});return Promise['all'](_0x5669f5);});});return Promise['all'](_0x2f3f06);});});return Promise['all'](_0x30b8bf)[_0xc2d7('0x28')](function(){return _0x3c05e['removeAgents'](_0x3383b9,{'transaction':_0x5f3dfc});})[_0xc2d7('0x28')](function(){return db[_0xc2d7('0x6b')][_0xc2d7('0x7a')]({'where':{'teamId':_0x1585ed}})[_0xc2d7('0x28')](function(_0x5192e5){if(_0x5192e5){var _0x31da30=_[_0xc2d7('0x2e')](_0x3383b9,function(_0x465aa5){db[_0xc2d7('0x6c')][_0xc2d7('0x54')]({'where':{'UserId':_0x465aa5,'VoicePrefixId':_0x5192e5['VoicePrefixId']}});});return Promise[_0xc2d7('0x93')](_0x31da30);}});});});}})[_0xc2d7('0x28')](respondWithStatusCode(_0x3190f5,null))[_0xc2d7('0x46')](handleError(_0x3190f5,null));};exports[_0xc2d7('0x97')]=function(_0x9bfead,_0x4ae2c2,_0xf71b2){var _0x16be28={};var _0xd643c0={};var _0x22ff42;var _0x87c63f;return db[_0xc2d7('0x42')][_0xc2d7('0x7a')]({'where':{'id':_0x9bfead['params']['id']}})[_0xc2d7('0x28')](handleEntityNotFound(_0x4ae2c2,null))[_0xc2d7('0x28')](function(_0x32a104){if(_0x32a104){_0x22ff42=_0x32a104;_0xd643c0[_0xc2d7('0x32')]=_['keys'](db[_0xc2d7('0x88')][_0xc2d7('0x2f')]);_0xd643c0[_0xc2d7('0x33')]=_[_0xc2d7('0x48')](_0x9bfead[_0xc2d7('0x33')]);_0xd643c0[_0xc2d7('0x34')]=_[_0xc2d7('0x35')](_0xd643c0[_0xc2d7('0x32')],_0xd643c0['query']);_0x16be28[_0xc2d7('0x36')]=_[_0xc2d7('0x35')](_0xd643c0[_0xc2d7('0x32')],qs['fields'](_0x9bfead[_0xc2d7('0x33')]['fields']));_0x16be28['attributes']=_0x16be28[_0xc2d7('0x36')][_0xc2d7('0x38')]?_0x16be28['attributes']:_0xd643c0[_0xc2d7('0x32')];_0x16be28[_0xc2d7('0x74')]=qs[_0xc2d7('0x3b')](_0x9bfead[_0xc2d7('0x33')][_0xc2d7('0x3b')]);_0x16be28[_0xc2d7('0x3c')]=qs[_0xc2d7('0x34')](_[_0xc2d7('0x3d')](_0x9bfead[_0xc2d7('0x33')],_0xd643c0[_0xc2d7('0x34')]));if(_0x9bfead[_0xc2d7('0x33')]['filter']){_0x16be28['where']=_[_0xc2d7('0x3e')](_0x16be28['where'],{'$or':_[_0xc2d7('0x2e')](_0x16be28[_0xc2d7('0x36')],function(_0x2b6680){var _0x90eaad={};_0x90eaad[_0x2b6680]={'$like':'%'+_0x9bfead[_0xc2d7('0x33')][_0xc2d7('0x40')]+'%'};return _0x90eaad;})});}_0x16be28=_[_0xc2d7('0x3e')]({},_0x16be28,_0x9bfead['options']);return _0x22ff42[_0xc2d7('0x97')](_0x16be28);}})[_0xc2d7('0x28')](function(_0xc1bdda){if(_0xc1bdda){_0x87c63f=_0xc1bdda[_0xc2d7('0x38')];if(!_0x9bfead[_0xc2d7('0x33')][_0xc2d7('0x39')]('nolimit')){_0x16be28['limit']=qs[_0xc2d7('0x23')](_0x9bfead[_0xc2d7('0x33')]['limit']);_0x16be28[_0xc2d7('0x22')]=qs['offset'](_0x9bfead[_0xc2d7('0x33')][_0xc2d7('0x22')]);}return _0x22ff42[_0xc2d7('0x97')](_0x16be28);}})[_0xc2d7('0x28')](function(_0x7901f5){if(_0x7901f5){return _0x7901f5?{'count':_0x87c63f,'rows':_0x7901f5}:null;}})[_0xc2d7('0x28')](respondWithResult(_0x4ae2c2,null))[_0xc2d7('0x46')](handleError(_0x4ae2c2,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 99c2354..3c8d395 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 _0x6d89=['events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x5aa7d0,_0x415c23){var _0x18d504=function(_0x3a9e18){while(--_0x3a9e18){_0x5aa7d0['push'](_0x5aa7d0['shift']());}};_0x18d504(++_0x415c23);}(_0x6d89,0x77));var _0x96d8=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x6d89[_0x5d2803];return _0xdcad2c;};'use strict';var EventEmitter=require(_0x96d8('0x0'));var Team=require(_0x96d8('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0x96d8('0x2')](0x0);var events={'afterCreate':_0x96d8('0x3'),'afterUpdate':_0x96d8('0x4'),'afterDestroy':_0x96d8('0x5')};function emitEvent(_0x52190d){return function(_0x575594,_0x1d9250,_0x420b61){TeamEvents[_0x96d8('0x6')](_0x52190d+':'+_0x575594['id'],_0x575594);TeamEvents[_0x96d8('0x6')](_0x52190d,_0x575594);_0x420b61(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0x09ea=['save','update','remove','emit','hook','exports','events'];(function(_0x104a80,_0x2258d7){var _0x2686b6=function(_0x980444){while(--_0x980444){_0x104a80['push'](_0x104a80['shift']());}};_0x2686b6(++_0x2258d7);}(_0x09ea,0x141));var _0xa09e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09ea[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xa09e('0x0'));var Team=require('../../mysqldb')['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa09e('0x1'),'afterUpdate':_0xa09e('0x2'),'afterDestroy':_0xa09e('0x3')};function emitEvent(_0x43f1dc){return function(_0x3c4e72,_0x3a41bd,_0x5a1e37){TeamEvents[_0xa09e('0x4')](_0x43f1dc+':'+_0x3c4e72['id'],_0x3c4e72);TeamEvents['emit'](_0x43f1dc,_0x3c4e72);_0x5a1e37(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team[_0xa09e('0x5')](e,emitEvent(event));}}module[_0xa09e('0x6')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index fd09b3e..85885db 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 _0xca0f=['then','map','setDataValue','channel','catch','exports','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','Queues'];(function(_0x345caf,_0x59bda5){var _0x4ff6d1=function(_0x35dd55){while(--_0x35dd55){_0x345caf['push'](_0x345caf['shift']());}};_0x4ff6d1(++_0x59bda5);}(_0xca0f,0xb0));var _0xfca0=function(_0x87190a,_0xa068cd){_0x87190a=_0x87190a-0x0;var _0xbe5758=_0xca0f[_0x87190a];return _0xbe5758;};'use strict';var _=require(_0xfca0('0x0'));var attributes=require(_0xfca0('0x1'));function getQueuesByChannel(_0x2e4915,_0x58361f){var _0x13516d=_0xfca0('0x2')+_0x58361f+_0xfca0('0x3');return _0x2e4915[_0x13516d]()[_0xfca0('0x4')](function(_0x575037){return _[_0xfca0('0x5')](_0x575037,function(_0x3760de){_0x3760de[_0xfca0('0x6')](_0xfca0('0x7'),_0x58361f);return _0x3760de;});})[_0xfca0('0x8')](function(_0xab7755){throw _0xab7755;});}module[_0xfca0('0x9')]=function(_0x4c2356){return _0x4c2356['define']('Team',attributes,{'tableName':_0xfca0('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x199957=this;var _0x13a540=[_0xfca0('0xb'),_0xfca0('0xc'),_0xfca0('0xd'),_0xfca0('0xe'),_0xfca0('0xf'),_0xfca0('0x10'),_0xfca0('0x11')];return Promise[_0xfca0('0x12')]()[_0xfca0('0x4')](function(){var _0x62357=_[_0xfca0('0x5')](_0x13a540,function(_0x36c902){return getQueuesByChannel(_0x199957,_0x36c902);});return Promise[_0xfca0('0x13')](_0x62357);})[_0xfca0('0x8')](function(_0x29acbd){throw _0x29acbd;});}}});}; \ No newline at end of file +var _0x1ebd=['get','Queues','map','setDataValue','catch','exports','define','Team','teams','Chat','Mail','Sms','Voice','resolve','then','all','./team.attributes'];(function(_0x4b584e,_0x59e486){var _0x103564=function(_0x743c){while(--_0x743c){_0x4b584e['push'](_0x4b584e['shift']());}};_0x103564(++_0x59e486);}(_0x1ebd,0x1db));var _0xd1eb=function(_0x31ce92,_0x5d5a50){_0x31ce92=_0x31ce92-0x0;var _0x3478f6=_0x1ebd[_0x31ce92];return _0x3478f6;};'use strict';var _=require('lodash');var attributes=require(_0xd1eb('0x0'));function getQueuesByChannel(_0x42751c,_0x258555){var _0x1aad99=_0xd1eb('0x1')+_0x258555+_0xd1eb('0x2');return _0x42751c[_0x1aad99]()['then'](function(_0x489c8f){return _[_0xd1eb('0x3')](_0x489c8f,function(_0x48aa1e){_0x48aa1e[_0xd1eb('0x4')]('channel',_0x258555);return _0x48aa1e;});})[_0xd1eb('0x5')](function(_0x21fdc0){throw _0x21fdc0;});}module[_0xd1eb('0x6')]=function(_0x24e758){return _0x24e758[_0xd1eb('0x7')](_0xd1eb('0x8'),attributes,{'tableName':_0xd1eb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x1036c0=this;var _0x428cac=[_0xd1eb('0xa'),'Fax',_0xd1eb('0xb'),'Openchannel',_0xd1eb('0xc'),_0xd1eb('0xd'),'Whatsapp'];return Promise[_0xd1eb('0xe')]()[_0xd1eb('0xf')](function(){var _0x590026=_[_0xd1eb('0x3')](_0x428cac,function(_0x4979ef){return getQueuesByChannel(_0x1036c0,_0x4979ef);});return Promise[_0xd1eb('0x10')](_0x590026);})[_0xd1eb('0x5')](function(_0x5e750){throw _0x5e750;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f4fd217..8dcd0ac 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 _0x0974=['bluebird','randomstring','../../config/logger','rpc','../../config/environment','client','http','defaults','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x5a0f53,_0x3cf8a4){var _0x262793=function(_0x7d6caa){while(--_0x7d6caa){_0x5a0f53['push'](_0x5a0f53['shift']());}};_0x262793(++_0x3cf8a4);}(_0x0974,0xb0));var _0x4097=function(_0x216535,_0x4ce86c){_0x216535=_0x216535-0x0;var _0x39984a=_0x0974[_0x216535];return _0x39984a;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4097('0x0'));var rs=require(_0x4097('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4097('0x2'))(_0x4097('0x3'));var config=require(_0x4097('0x4'));var jayson=require('jayson/promise');var client=jayson[_0x4097('0x5')][_0x4097('0x6')]({'port':0x232a});config['redis']=_[_0x4097('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4097('0x8'))[_0x4097('0x9')](socket);function respondWithRpcPromise(_0x3b377b,_0x28550a,_0x107328){return new BPromise(function(_0xf4b2df,_0x390e09){return client[_0x4097('0xa')](_0x3b377b,_0x107328)[_0x4097('0xb')](function(_0x1629e2){logger['info'](_0x4097('0xc'),_0x28550a,_0x4097('0xd'));logger[_0x4097('0xe')](_0x4097('0xf'),_0x28550a,_0x4097('0xd'),JSON[_0x4097('0x10')](_0x1629e2));if(_0x1629e2['error']){if(_0x1629e2[_0x4097('0x11')]['code']===0x1f4){logger['error']('Team,\x20%s,\x20%s',_0x28550a,_0x1629e2[_0x4097('0x11')][_0x4097('0x12')]);return _0x390e09(_0x1629e2['error'][_0x4097('0x12')]);}logger[_0x4097('0x11')](_0x4097('0xc'),_0x28550a,_0x1629e2[_0x4097('0x11')][_0x4097('0x12')]);return _0xf4b2df(_0x1629e2[_0x4097('0x11')][_0x4097('0x12')]);}else{logger[_0x4097('0x13')](_0x4097('0xc'),_0x28550a,_0x4097('0xd'));_0xf4b2df(_0x1629e2[_0x4097('0x14')][_0x4097('0x12')]);}})[_0x4097('0x15')](function(_0x301157){logger[_0x4097('0x11')](_0x4097('0xc'),_0x28550a,_0x301157);_0x390e09(_0x301157);});});} \ No newline at end of file +var _0xbeea=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./team.socket','register','request','then','Team,\x20%s,\x20%s','request\x20sent','debug','code','error','message'];(function(_0x3f4be9,_0x58114e){var _0x10b016=function(_0x47cdb7){while(--_0x47cdb7){_0x3f4be9['push'](_0x3f4be9['shift']());}};_0x10b016(++_0x58114e);}(_0xbeea,0xb1));var _0xabee=function(_0x37e770,_0x5b327b){_0x37e770=_0x37e770-0x0;var _0x4c92bf=_0xbeea[_0x37e770];return _0x4c92bf;};'use strict';var _=require(_0xabee('0x0'));var util=require('util');var moment=require(_0xabee('0x1'));var BPromise=require(_0xabee('0x2'));var rs=require(_0xabee('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xabee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xabee('0x5'))(_0xabee('0x6'));var config=require(_0xabee('0x7'));var jayson=require(_0xabee('0x8'));var client=jayson[_0xabee('0x9')]['http']({'port':0x232a});config['redis']=_[_0xabee('0xa')](config[_0xabee('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xabee('0xc'))(new Redis(config['redis']));require(_0xabee('0xd'))[_0xabee('0xe')](socket);function respondWithRpcPromise(_0x2a1c06,_0x45bca4,_0x33a862){return new BPromise(function(_0xc88c6d,_0x58c43c){return client[_0xabee('0xf')](_0x2a1c06,_0x33a862)[_0xabee('0x10')](function(_0xe8620){logger['info'](_0xabee('0x11'),_0x45bca4,_0xabee('0x12'));logger[_0xabee('0x13')]('Team,\x20%s,\x20%s,\x20%s',_0x45bca4,'request\x20sent',JSON['stringify'](_0xe8620));if(_0xe8620['error']){if(_0xe8620['error'][_0xabee('0x14')]===0x1f4){logger[_0xabee('0x15')](_0xabee('0x11'),_0x45bca4,_0xe8620[_0xabee('0x15')][_0xabee('0x16')]);return _0x58c43c(_0xe8620['error'][_0xabee('0x16')]);}logger[_0xabee('0x15')](_0xabee('0x11'),_0x45bca4,_0xe8620[_0xabee('0x15')][_0xabee('0x16')]);return _0xc88c6d(_0xe8620[_0xabee('0x15')][_0xabee('0x16')]);}else{logger['info'](_0xabee('0x11'),_0x45bca4,_0xabee('0x12'));_0xc88c6d(_0xe8620[_0xabee('0x17')][_0xabee('0x16')]);}})[_0xabee('0x18')](function(_0xcf2973){logger['error']('Team,\x20%s,\x20%s',_0x45bca4,_0xcf2973);_0x58c43c(_0xcf2973);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 149eb7a..34a9f58 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 _0x22dd=['./team.events','save','remove','emit','removeListener','register'];(function(_0x41648f,_0x4a8936){var _0x20340a=function(_0x358f29){while(--_0x358f29){_0x41648f['push'](_0x41648f['shift']());}};_0x20340a(++_0x4a8936);}(_0x22dd,0xe4));var _0xd22d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x22dd[_0x3dd15e];return _0x231fd0;};'use strict';var TeamEvents=require(_0xd22d('0x0'));var events=[_0xd22d('0x1'),_0xd22d('0x2'),'update'];function createListener(_0x4f39fe,_0x42ad34){return function(_0x3764ac){_0x42ad34[_0xd22d('0x3')](_0x4f39fe,_0x3764ac);};}function removeListener(_0x166f52,_0x26e4ba){return function(){TeamEvents[_0xd22d('0x4')](_0x166f52,_0x26e4ba);};}exports[_0xd22d('0x5')]=function(_0x2df700){for(var _0x3f4197=0x0,_0x3a466f=events['length'];_0x3f4197<_0x3a466f;_0x3f4197++){var _0x40986a=events[_0x3f4197];var _0x3649df=createListener('team:'+_0x40986a,_0x2df700);TeamEvents['on'](_0x40986a,_0x3649df);}}; \ No newline at end of file +var _0xb75c=['./team.events','save','remove','emit','removeListener','length'];(function(_0x4a5cd8,_0x2439a9){var _0x5d71c2=function(_0x381641){while(--_0x381641){_0x4a5cd8['push'](_0x4a5cd8['shift']());}};_0x5d71c2(++_0x2439a9);}(_0xb75c,0x1ce));var _0xcb75=function(_0x5ac2a3,_0x157ff1){_0x5ac2a3=_0x5ac2a3-0x0;var _0x5823d4=_0xb75c[_0x5ac2a3];return _0x5823d4;};'use strict';var TeamEvents=require(_0xcb75('0x0'));var events=[_0xcb75('0x1'),_0xcb75('0x2'),'update'];function createListener(_0x348403,_0x4da54f){return function(_0x21a350){_0x4da54f[_0xcb75('0x3')](_0x348403,_0x21a350);};}function removeListener(_0x390961,_0x4a39a6){return function(){TeamEvents[_0xcb75('0x4')](_0x390961,_0x4a39a6);};}exports['register']=function(_0x5f488c){for(var _0xb12187=0x0,_0x284ea6=events[_0xcb75('0x5')];_0xb12187<_0x284ea6;_0xb12187++){var _0x498656=events[_0xb12187];var _0x57ef56=createListener('team:'+_0x498656,_0x5f488c);TeamEvents['on'](_0x498656,_0x57ef56);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 1e1b5ec..d126582 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 _0x3cfb=['exports','INTEGER','sequelize'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0x3cfb,0x1b8));var _0xb3cf=function(_0x9474c2,_0x47eec9){_0x9474c2=_0x9474c2-0x0;var _0x3ac7b8=_0x3cfb[_0x9474c2];return _0x3ac7b8;};'use strict';var Sequelize=require(_0xb3cf('0x0'));module[_0xb3cf('0x1')]={'TeamId':{'type':Sequelize[_0xb3cf('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xb3cf('0x2')]}}; \ No newline at end of file +var _0x89e3=['exports','INTEGER'];(function(_0x4402dc,_0x505e9f){var _0x40fc62=function(_0x3417de){while(--_0x3417de){_0x4402dc['push'](_0x4402dc['shift']());}};_0x40fc62(++_0x505e9f);}(_0x89e3,0x66));var _0x389e=function(_0x590c62,_0x124a0d){_0x590c62=_0x590c62-0x0;var _0x3f0577=_0x89e3[_0x590c62];return _0x3f0577;};'use strict';var Sequelize=require('sequelize');module[_0x389e('0x0')]={'TeamId':{'type':Sequelize[_0x389e('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x389e('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 59d2b31..e64c1d7 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 _0x4959=['team_has_voice_prefixes','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','TeamVoicePrefix'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x4959,0x9b));var _0x9495=function(_0xdc5aa8,_0x4931e0){_0xdc5aa8=_0xdc5aa8-0x0;var _0x328a1a=_0x4959[_0xdc5aa8];return _0x328a1a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9495('0x0'))(_0x9495('0x1'));var moment=require(_0x9495('0x2'));var BPromise=require('bluebird');var rp=require(_0x9495('0x3'));var fs=require('fs');var path=require(_0x9495('0x4'));var rimraf=require(_0x9495('0x5'));var config=require(_0x9495('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x9495('0x7')]=function(_0x2225a0,_0x2c716d){return _0x2225a0[_0x9495('0x8')](_0x9495('0x9'),attributes,{'tableName':_0x9495('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c9c=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash'];(function(_0x48df98,_0x324236){var _0x5a871e=function(_0x1f7dbd){while(--_0x1f7dbd){_0x48df98['push'](_0x48df98['shift']());}};_0x5a871e(++_0x324236);}(_0x6c9c,0x12a));var _0xc6c9=function(_0x5117ad,_0x5aaa10){_0x5117ad=_0x5117ad-0x0;var _0xe41598=_0x6c9c[_0x5117ad];return _0xe41598;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var logger=require('../../config/logger')(_0xc6c9('0x2'));var moment=require(_0xc6c9('0x3'));var BPromise=require(_0xc6c9('0x4'));var rp=require(_0xc6c9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc6c9('0x6'));var config=require(_0xc6c9('0x7'));var attributes=require(_0xc6c9('0x8'));module[_0xc6c9('0x9')]=function(_0x422195,_0x84b96e){return _0x422195[_0xc6c9('0xa')](_0xc6c9('0xb'),attributes,{'tableName':_0xc6c9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 6ac36db..15e73c7 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5c9008,_0x4bb3a6){var _0x31a5e0=function(_0x3f7f1d){while(--_0x3f7f1d){_0x5c9008['push'](_0x5c9008['shift']());}};_0x31a5e0(++_0x4bb3a6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x3a5c03,_0x194e4a){var _0x5c9af7=function(_0x252681){while(--_0x252681){_0x3a5c03['push'](_0x3a5c03['shift']());}};_0x5c9af7(++_0x194e4a);}(_0x70e0,0x17b));var _0x070e=function(_0x24404c,_0x34cde8){_0x24404c=_0x24404c-0x0;var _0x2d6fa7=_0x70e0[_0x24404c];return _0x2d6fa7;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 21a16bc..c858005 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 _0x3e51=['INTEGER'];(function(_0x3d122c,_0x7efb42){var _0x339ae1=function(_0x270524){while(--_0x270524){_0x3d122c['push'](_0x3d122c['shift']());}};_0x339ae1(++_0x7efb42);}(_0x3e51,0xa3));var _0x13e5=function(_0x159f86,_0x2a0c48){_0x159f86=_0x159f86-0x0;var _0x134d50=_0x3e51[_0x159f86];return _0x134d50;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x13e5('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd70b=['INTEGER','sequelize','exports'];(function(_0x538306,_0x18573d){var _0x4de8f6=function(_0x324c18){while(--_0x324c18){_0x538306['push'](_0x538306['shift']());}};_0x4de8f6(++_0x18573d);}(_0xd70b,0x17b));var _0xbd70=function(_0x32292b,_0x4e9525){_0x32292b=_0x32292b-0x0;var _0x1845b4=_0xd70b[_0x32292b];return _0x1845b4;};'use strict';var Sequelize=require(_0xbd70('0x0'));module[_0xbd70('0x1')]={'penalty':{'type':Sequelize[_0xbd70('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 be6a03f..815e0f5 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 _0xd0b5=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','bluebird','request-promise'];(function(_0x408e38,_0x23cda8){var _0x426b0e=function(_0x8f2898){while(--_0x8f2898){_0x408e38['push'](_0x408e38['shift']());}};_0x426b0e(++_0x23cda8);}(_0xd0b5,0x1b8));var _0x5d0b=function(_0x1b7e63,_0x3ae7d5){_0x1b7e63=_0x1b7e63-0x0;var _0x5335a0=_0xd0b5[_0x1b7e63];return _0x5335a0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5d0b('0x0'))(_0x5d0b('0x1'));var moment=require('moment');var BPromise=require(_0x5d0b('0x2'));var rp=require(_0x5d0b('0x3'));var fs=require('fs');var path=require(_0x5d0b('0x4'));var rimraf=require(_0x5d0b('0x5'));var config=require(_0x5d0b('0x6'));var attributes=require(_0x5d0b('0x7'));module[_0x5d0b('0x8')]=function(_0x41b7c1,_0xd514d0){return _0x41b7c1[_0x5d0b('0x9')](_0x5d0b('0xa'),attributes,{'tableName':_0x5d0b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47c7=['api','bluebird','request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','TeamVoiceQueue','team_has_voice_queues','lodash','../../config/logger'];(function(_0x3559f8,_0x12a279){var _0x5b2ea3=function(_0x182883){while(--_0x182883){_0x3559f8['push'](_0x3559f8['shift']());}};_0x5b2ea3(++_0x12a279);}(_0x47c7,0x1ab));var _0x747c=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0x47c7[_0x3e6729];return _0x535bcd;};'use strict';var _=require(_0x747c('0x0'));var util=require('util');var logger=require(_0x747c('0x1'))(_0x747c('0x2'));var moment=require('moment');var BPromise=require(_0x747c('0x3'));var rp=require(_0x747c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x747c('0x5'));var config=require(_0x747c('0x6'));var attributes=require(_0x747c('0x7'));module[_0x747c('0x8')]=function(_0x5e991e,_0xa1148a){return _0x5e991e['define'](_0x747c('0x9'),attributes,{'tableName':_0x747c('0xa'),'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 5e430b8..7201549 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 _0xb549=['request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xb549,0x164));var _0x9b54=function(_0x8db3ab,_0x797312){_0x8db3ab=_0x8db3ab-0x0;var _0x5814a8=_0xb549[_0x8db3ab];return _0x5814a8;};'use strict';var _=require(_0x9b54('0x0'));var util=require(_0x9b54('0x1'));var moment=require(_0x9b54('0x2'));var BPromise=require(_0x9b54('0x3'));var rs=require(_0x9b54('0x4'));var fs=require('fs');var Redis=require(_0x9b54('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9b54('0x6'));var logger=require(_0x9b54('0x7'))(_0x9b54('0x8'));var config=require(_0x9b54('0x9'));var jayson=require(_0x9b54('0xa'));var client=jayson[_0x9b54('0xb')][_0x9b54('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1ca4a1,_0xad9f5d,_0x277695){return new BPromise(function(_0x13bcfd,_0x1d1723){return client[_0x9b54('0xd')](_0x1ca4a1,_0x277695)[_0x9b54('0xe')](function(_0x470578){logger[_0x9b54('0xf')](_0x9b54('0x10'),_0xad9f5d,'request\x20sent');logger[_0x9b54('0x11')](_0x9b54('0x12'),_0xad9f5d,_0x9b54('0x13'),JSON[_0x9b54('0x14')](_0x470578));if(_0x470578[_0x9b54('0x15')]){if(_0x470578[_0x9b54('0x15')]['code']===0x1f4){logger['error'](_0x9b54('0x10'),_0xad9f5d,_0x470578[_0x9b54('0x15')][_0x9b54('0x16')]);return _0x1d1723(_0x470578[_0x9b54('0x15')]['message']);}logger[_0x9b54('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0xad9f5d,_0x470578['error'][_0x9b54('0x16')]);return _0x13bcfd(_0x470578['error'][_0x9b54('0x16')]);}else{logger[_0x9b54('0xf')](_0x9b54('0x10'),_0xad9f5d,_0x9b54('0x13'));_0x13bcfd(_0x470578[_0x9b54('0x17')][_0x9b54('0x16')]);}})[_0x9b54('0x18')](function(_0x217b44){logger[_0x9b54('0x15')]('TeamVoiceQueue,\x20%s,\x20%s',_0xad9f5d,_0x217b44);_0x1d1723(_0x217b44);});});} \ No newline at end of file +var _0xf26a=['jayson/promise','client','http','request','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf26a,0x158));var _0xaf26=function(_0x4eb7ad,_0x96465){_0x4eb7ad=_0x4eb7ad-0x0;var _0x53ad4e=_0xf26a[_0x4eb7ad];return _0x53ad4e;};'use strict';var _=require(_0xaf26('0x0'));var util=require(_0xaf26('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xaf26('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf26('0x3'))['db'];var utils=require(_0xaf26('0x4'));var logger=require(_0xaf26('0x5'))(_0xaf26('0x6'));var config=require(_0xaf26('0x7'));var jayson=require(_0xaf26('0x8'));var client=jayson[_0xaf26('0x9')][_0xaf26('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31300e,_0x33295e,_0x18313d){return new BPromise(function(_0x2568cc,_0x2f8dc5){return client[_0xaf26('0xb')](_0x31300e,_0x18313d)['then'](function(_0x40e73e){logger['info'](_0xaf26('0xc'),_0x33295e,'request\x20sent');logger[_0xaf26('0xd')](_0xaf26('0xe'),_0x33295e,_0xaf26('0xf'),JSON[_0xaf26('0x10')](_0x40e73e));if(_0x40e73e['error']){if(_0x40e73e[_0xaf26('0x11')]['code']===0x1f4){logger[_0xaf26('0x11')](_0xaf26('0xc'),_0x33295e,_0x40e73e[_0xaf26('0x11')][_0xaf26('0x12')]);return _0x2f8dc5(_0x40e73e['error'][_0xaf26('0x12')]);}logger[_0xaf26('0x11')](_0xaf26('0xc'),_0x33295e,_0x40e73e[_0xaf26('0x11')][_0xaf26('0x12')]);return _0x2568cc(_0x40e73e['error'][_0xaf26('0x12')]);}else{logger[_0xaf26('0x13')](_0xaf26('0xc'),_0x33295e,'request\x20sent');_0x2568cc(_0x40e73e[_0xaf26('0x14')][_0xaf26('0x12')]);}})[_0xaf26('0x15')](function(_0x4bbce4){logger[_0xaf26('0x11')](_0xaf26('0xc'),_0x33295e,_0x4bbce4);_0x2f8dc5(_0x4bbce4);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index b7c2c30..f9e65c2 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 _0x0a93=['path','express','Router','fs-extra','../../components/auth/service','index','get','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x4476c7,_0x48ed6d){var _0x2c47c5=function(_0x39ad83){while(--_0x39ad83){_0x4476c7['push'](_0x4476c7['shift']());}};_0x2c47c5(++_0x48ed6d);}(_0x0a93,0x6a));var _0x30a9=function(_0xdf3ab6,_0x261eed){_0xdf3ab6=_0xdf3ab6-0x0;var _0x18d630=_0x0a93[_0xdf3ab6];return _0x18d630;};'use strict';var multer=require(_0x30a9('0x0'));var util=require(_0x30a9('0x1'));var path=require(_0x30a9('0x2'));var timeout=require('connect-timeout');var express=require(_0x30a9('0x3'));var router=express[_0x30a9('0x4')]();var fs_extra=require(_0x30a9('0x5'));var auth=require(_0x30a9('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./template.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x30a9('0x7')]);router[_0x30a9('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x30a9('0x9')]);router[_0x30a9('0xa')]('/',auth[_0x30a9('0xb')](),controller['create']);router[_0x30a9('0xc')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0xe')]);router[_0x30a9('0xf')](_0x30a9('0xd'),auth[_0x30a9('0xb')](),controller[_0x30a9('0x10')]);module[_0x30a9('0x11')]=router; \ No newline at end of file +var _0x11f3=['put','update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','post','create'];(function(_0x4a16b4,_0x38d700){var _0xdf3c42=function(_0x333011){while(--_0x333011){_0x4a16b4['push'](_0x4a16b4['shift']());}};_0xdf3c42(++_0x38d700);}(_0x11f3,0x149));var _0x311f=function(_0x3073c5,_0x426ccc){_0x3073c5=_0x3073c5-0x0;var _0x35f385=_0x11f3[_0x3073c5];return _0x35f385;};'use strict';var multer=require(_0x311f('0x0'));var util=require(_0x311f('0x1'));var path=require(_0x311f('0x2'));var timeout=require('connect-timeout');var express=require(_0x311f('0x3'));var router=express['Router']();var fs_extra=require(_0x311f('0x4'));var auth=require(_0x311f('0x5'));var interaction=require(_0x311f('0x6'));var config=require('../../config/environment');var controller=require('./template.controller');router[_0x311f('0x7')]('/',auth['isAuthenticated'](),controller[_0x311f('0x8')]);router[_0x311f('0x7')](_0x311f('0x9'),auth[_0x311f('0xa')](),controller['show']);router[_0x311f('0xb')]('/',auth[_0x311f('0xa')](),controller[_0x311f('0xc')]);router[_0x311f('0xd')](_0x311f('0x9'),auth['isAuthenticated'](),controller[_0x311f('0xe')]);router[_0x311f('0xf')](_0x311f('0x9'),auth[_0x311f('0xa')](),controller[_0x311f('0x10')]);module[_0x311f('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 66b232e..003f675 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 _0xdfbc=['sequelize','STRING','TEXT'];(function(_0x39fe49,_0x3b004f){var _0xbfd16f=function(_0x31e03f){while(--_0x31e03f){_0x39fe49['push'](_0x39fe49['shift']());}};_0xbfd16f(++_0x3b004f);}(_0xdfbc,0x1ec));var _0xcdfb=function(_0x3e4ae9,_0x52426d){_0x3e4ae9=_0x3e4ae9-0x0;var _0x59e72e=_0xdfbc[_0x3e4ae9];return _0x59e72e;};'use strict';var Sequelize=require(_0xcdfb('0x0'));module['exports']={'name':{'type':Sequelize[_0xcdfb('0x1')]},'description':{'type':Sequelize[_0xcdfb('0x1')]},'html':{'type':Sequelize[_0xcdfb('0x2')]}}; \ No newline at end of file +var _0xec0b=['exports','STRING','TEXT','sequelize'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xec0b,0xd7));var _0xbec0=function(_0x2079ec,_0x26230c){_0x2079ec=_0x2079ec-0x0;var _0x3f2ef6=_0xec0b[_0x2079ec];return _0x3f2ef6;};'use strict';var Sequelize=require(_0xbec0('0x0'));module[_0xbec0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbec0('0x2')]},'html':{'type':Sequelize[_0xbec0('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index f3f3bf0..c227eb5 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 _0x98e5=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','Templates','sendStatus','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','Template','findAll','show','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2e6c75,_0x1bdbb7){var _0x13a9ea=function(_0x6ad297){while(--_0x6ad297){_0x2e6c75['push'](_0x2e6c75['shift']());}};_0x13a9ea(++_0x1bdbb7);}(_0x98e5,0x12d));var _0x598e=function(_0x46dd53,_0x16df27){_0x46dd53=_0x46dd53-0x0;var _0x829672=_0x98e5[_0x46dd53];return _0x829672;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x598e('0x0'));var zipdir=require(_0x598e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x598e('0x2'));var moment=require(_0x598e('0x3'));var BPromise=require(_0x598e('0x4'));var Mustache=require(_0x598e('0x5'));var util=require('util');var path=require(_0x598e('0x6'));var sox=require('sox');var csv=require(_0x598e('0x7'));var ejs=require(_0x598e('0x8'));var fs=require('fs');var fs_extra=require(_0x598e('0x9'));var _=require('lodash');var squel=require(_0x598e('0xa'));var crypto=require(_0x598e('0xb'));var jsforce=require(_0x598e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x598e('0x7'));var querystring=require(_0x598e('0xd'));var Papa=require(_0x598e('0xe'));var Redis=require(_0x598e('0xf'));var authService=require(_0x598e('0x10'));var qs=require(_0x598e('0x11'));var as=require(_0x598e('0x12'));var hardwareService=require(_0x598e('0x13'));var logger=require(_0x598e('0x14'))('api');var utils=require(_0x598e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x598e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x54901b,_0x16a4fc){_0x16a4fc=_0x16a4fc||0xcc;return function(_0x47556c){if(_0x47556c){return _0x54901b['sendStatus'](_0x16a4fc);}return _0x54901b[_0x598e('0x17')](_0x16a4fc)[_0x598e('0x18')]();};}function respondWithResult(_0x4623e9,_0xe8638){_0xe8638=_0xe8638||0xc8;return function(_0x442dfc){if(_0x442dfc){return _0x4623e9[_0x598e('0x17')](_0xe8638)[_0x598e('0x19')](_0x442dfc);}};}function respondWithFilteredResult(_0x4f4074,_0x5404a2){return function(_0x253385){if(_0x253385){var _0x3a756b=typeof _0x5404a2['offset']===_0x598e('0x1a')&&typeof _0x5404a2['limit']===_0x598e('0x1a');var _0x2b1ab5=_0x253385[_0x598e('0x1b')];var _0x1e1cb9=_0x3a756b?0x0:_0x5404a2['offset'];var _0x55dc11=_0x3a756b?_0x253385[_0x598e('0x1b')]:_0x5404a2[_0x598e('0x1c')]+_0x5404a2[_0x598e('0x1d')];var _0xd6748;if(_0x55dc11>=_0x2b1ab5){_0x55dc11=_0x2b1ab5;_0xd6748=0xc8;}else{_0xd6748=0xce;}_0x4f4074['status'](_0xd6748);return _0x4f4074[_0x598e('0x1e')](_0x598e('0x1f'),_0x1e1cb9+'-'+_0x55dc11+'/'+_0x2b1ab5)[_0x598e('0x19')](_0x253385);}return null;};}function patchUpdates(_0x127751){return function(_0x35f321){try{jsonpatch[_0x598e('0x20')](_0x35f321,_0x127751,!![]);}catch(_0x440716){return BPromise[_0x598e('0x21')](_0x440716);}return _0x35f321[_0x598e('0x22')]();};}function saveUpdates(_0x145d66,_0x126aa7){return function(_0x47ef5f){if(_0x47ef5f){return _0x47ef5f['update'](_0x145d66)[_0x598e('0x23')](function(_0x544f89){return _0x544f89;});}return null;};}function removeEntity(_0xe11703,_0x2434a8){return function(_0x1748bf){if(_0x1748bf){return _0x1748bf[_0x598e('0x24')]()[_0x598e('0x23')](function(){var _0xef6362=_0x1748bf[_0x598e('0x25')]({'plain':!![]});var _0x3984bc=_0x598e('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x3984bc,'resourceId':_0xef6362['id']}})[_0x598e('0x23')](function(){return _0x1748bf;});})['then'](function(){_0xe11703[_0x598e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21d5c7,_0x76949a){return function(_0x3e1d73){if(!_0x3e1d73){_0x21d5c7[_0x598e('0x27')](0x194);}return _0x3e1d73;};}function handleError(_0x27b9a9,_0x27e73b){_0x27e73b=_0x27e73b||0x1f4;return function(_0xe869ef){logger[_0x598e('0x28')](_0xe869ef['stack']);if(_0xe869ef[_0x598e('0x29')]){delete _0xe869ef[_0x598e('0x29')];}_0x27b9a9['status'](_0x27e73b)['send'](_0xe869ef);};}exports[_0x598e('0x2a')]=function(_0x33f7fe,_0x45d47b){var _0x27d501={},_0x55e37b={},_0x1f8ab5={'count':0x0,'rows':[]};var _0x322976=_[_0x598e('0x2b')](db['Template'][_0x598e('0x2c')],function(_0x4c4186){return{'name':_0x4c4186[_0x598e('0x2d')],'type':_0x4c4186[_0x598e('0x2e')][_0x598e('0x2f')]};});_0x55e37b[_0x598e('0x30')]=_[_0x598e('0x2b')](_0x322976,_0x598e('0x29'));_0x55e37b[_0x598e('0x31')]=_[_0x598e('0x32')](_0x33f7fe['query']);_0x55e37b[_0x598e('0x33')]=_[_0x598e('0x34')](_0x55e37b[_0x598e('0x30')],_0x55e37b[_0x598e('0x31')]);_0x27d501[_0x598e('0x35')]=_[_0x598e('0x34')](_0x55e37b[_0x598e('0x30')],qs['fields'](_0x33f7fe[_0x598e('0x31')][_0x598e('0x36')]));_0x27d501[_0x598e('0x35')]=_0x27d501['attributes'][_0x598e('0x37')]?_0x27d501['attributes']:_0x55e37b[_0x598e('0x30')];if(!_0x33f7fe[_0x598e('0x31')][_0x598e('0x38')](_0x598e('0x39'))){_0x27d501['limit']=qs['limit'](_0x33f7fe['query'][_0x598e('0x1d')]);_0x27d501['offset']=qs[_0x598e('0x1c')](_0x33f7fe[_0x598e('0x31')]['offset']);}_0x27d501[_0x598e('0x3a')]=qs[_0x598e('0x3b')](_0x33f7fe[_0x598e('0x31')][_0x598e('0x3b')]);_0x27d501[_0x598e('0x3c')]=qs['filters'](_['pick'](_0x33f7fe['query'],_0x55e37b[_0x598e('0x33')]),_0x322976);if(_0x33f7fe[_0x598e('0x31')][_0x598e('0x3d')]){_0x27d501[_0x598e('0x3c')]=_[_0x598e('0x3e')](_0x27d501[_0x598e('0x3c')],{'$or':_[_0x598e('0x2b')](_0x322976,function(_0x139ef7){if(_0x139ef7['type']!==_0x598e('0x3f')){var _0x1a5c15={};_0x1a5c15[_0x139ef7[_0x598e('0x29')]]={'$like':'%'+_0x33f7fe[_0x598e('0x31')][_0x598e('0x3d')]+'%'};return _0x1a5c15;}})});}_0x27d501=_[_0x598e('0x3e')]({},_0x27d501,_0x33f7fe[_0x598e('0x40')]);var _0x588189={'where':_0x27d501[_0x598e('0x3c')]};return db[_0x598e('0x41')][_0x598e('0x1b')](_0x588189)[_0x598e('0x23')](function(_0x375930){_0x1f8ab5[_0x598e('0x1b')]=_0x375930;if(_0x33f7fe['query']['includeAll']){_0x27d501['include']=[{'all':!![]}];}return db['Template'][_0x598e('0x42')](_0x27d501);})[_0x598e('0x23')](function(_0x2ff064){_0x1f8ab5['rows']=_0x2ff064;return _0x1f8ab5;})[_0x598e('0x23')](respondWithFilteredResult(_0x45d47b,_0x27d501))['catch'](handleError(_0x45d47b,null));};exports[_0x598e('0x43')]=function(_0x3479ae,_0x1cc253){var _0x198067={'raw':!![],'where':{'id':_0x3479ae[_0x598e('0x44')]['id']}},_0x5912a5={};_0x5912a5[_0x598e('0x30')]=_[_0x598e('0x32')](db[_0x598e('0x41')][_0x598e('0x2c')]);_0x5912a5[_0x598e('0x31')]=_[_0x598e('0x32')](_0x3479ae[_0x598e('0x31')]);_0x5912a5[_0x598e('0x33')]=_[_0x598e('0x34')](_0x5912a5['model'],_0x5912a5[_0x598e('0x31')]);_0x198067['attributes']=_[_0x598e('0x34')](_0x5912a5[_0x598e('0x30')],qs[_0x598e('0x36')](_0x3479ae[_0x598e('0x31')][_0x598e('0x36')]));_0x198067[_0x598e('0x35')]=_0x198067[_0x598e('0x35')]['length']?_0x198067['attributes']:_0x5912a5[_0x598e('0x30')];if(_0x3479ae['query']['includeAll']){_0x198067['include']=[{'all':!![]}];}_0x198067=_[_0x598e('0x3e')]({},_0x198067,_0x3479ae[_0x598e('0x40')]);return db[_0x598e('0x41')][_0x598e('0x45')](_0x198067)['then'](handleEntityNotFound(_0x1cc253,null))['then'](respondWithResult(_0x1cc253,null))[_0x598e('0x46')](handleError(_0x1cc253,null));};exports[_0x598e('0x47')]=function(_0x5ce691,_0x3686f2){return db[_0x598e('0x41')][_0x598e('0x47')](_0x5ce691[_0x598e('0x48')],{})[_0x598e('0x23')](function(_0x54eddf){var _0xc9bde9=_0x5ce691[_0x598e('0x49')][_0x598e('0x25')]({'plain':!![]});if(!_0xc9bde9)throw new Error(_0x598e('0x4a'));if(_0xc9bde9[_0x598e('0x4b')]===_0x598e('0x49')){var _0x14a5d4=_0x54eddf[_0x598e('0x25')]({'plain':!![]});var _0x27dbbc='Templates';return db[_0x598e('0x4c')][_0x598e('0x45')]({'where':{'name':_0x27dbbc,'userProfileId':_0xc9bde9[_0x598e('0x4d')]},'raw':!![]})[_0x598e('0x23')](function(_0x4ffe88){if(_0x4ffe88&&_0x4ffe88['autoAssociation']===0x0){return db[_0x598e('0x4e')][_0x598e('0x47')]({'name':_0x14a5d4[_0x598e('0x29')],'resourceId':_0x14a5d4['id'],'type':_0x4ffe88[_0x598e('0x29')],'sectionId':_0x4ffe88['id']},{})[_0x598e('0x23')](function(){return _0x54eddf;});}else{return _0x54eddf;}})[_0x598e('0x46')](function(_0x4d5aa1){logger[_0x598e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4d5aa1);throw _0x4d5aa1;});}return _0x54eddf;})[_0x598e('0x23')](respondWithResult(_0x3686f2,0xc9))['catch'](handleError(_0x3686f2,null));};exports[_0x598e('0x4f')]=function(_0x1f9a32,_0x15e6fc){if(_0x1f9a32[_0x598e('0x48')]['id']){delete _0x1f9a32[_0x598e('0x48')]['id'];}return db[_0x598e('0x41')][_0x598e('0x45')]({'where':{'id':_0x1f9a32['params']['id']}})['then'](handleEntityNotFound(_0x15e6fc,null))[_0x598e('0x23')](saveUpdates(_0x1f9a32[_0x598e('0x48')],null))[_0x598e('0x23')](respondWithResult(_0x15e6fc,null))[_0x598e('0x46')](handleError(_0x15e6fc,null));};exports['destroy']=function(_0x18e7c3,_0x28f4e3){return db[_0x598e('0x41')][_0x598e('0x45')]({'where':{'id':_0x18e7c3['params']['id']}})[_0x598e('0x23')](handleEntityNotFound(_0x28f4e3,null))['then'](removeEntity(_0x28f4e3,null))[_0x598e('0x46')](handleError(_0x28f4e3,null));}; \ No newline at end of file +var _0x846f=['undefined','limit','count','set','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','error','name','send','index','map','Template','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset'];(function(_0xd1eff0,_0x5ca30d){var _0x22e88a=function(_0x46a721){while(--_0x46a721){_0xd1eff0['push'](_0xd1eff0['shift']());}};_0x22e88a(++_0x5ca30d);}(_0x846f,0x81));var _0xf846=function(_0x185233,_0x317744){_0x185233=_0x185233-0x0;var _0x2121e4=_0x846f[_0x185233];return _0x2121e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf846('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf846('0x1'));var moment=require('moment');var BPromise=require(_0xf846('0x2'));var Mustache=require(_0xf846('0x3'));var util=require(_0xf846('0x4'));var path=require(_0xf846('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf846('0x6'));var fs=require('fs');var fs_extra=require(_0xf846('0x7'));var _=require('lodash');var squel=require(_0xf846('0x8'));var crypto=require(_0xf846('0x9'));var jsforce=require(_0xf846('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xf846('0xb'));var querystring=require(_0xf846('0xc'));var Papa=require('papaparse');var Redis=require(_0xf846('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf846('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf846('0xf'))(_0xf846('0x10'));var utils=require(_0xf846('0x11'));var config=require(_0xf846('0x12'));var licenseUtil=require(_0xf846('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x17f9fc,_0x54874b){_0x54874b=_0x54874b||0xcc;return function(_0x3e629d){if(_0x3e629d){return _0x17f9fc[_0xf846('0x14')](_0x54874b);}return _0x17f9fc[_0xf846('0x15')](_0x54874b)[_0xf846('0x16')]();};}function respondWithResult(_0x4a4c61,_0x4da560){_0x4da560=_0x4da560||0xc8;return function(_0x54f662){if(_0x54f662){return _0x4a4c61['status'](_0x4da560)[_0xf846('0x17')](_0x54f662);}};}function respondWithFilteredResult(_0x3b5452,_0x436612){return function(_0x520fc6){if(_0x520fc6){var _0x25539c=typeof _0x436612[_0xf846('0x18')]===_0xf846('0x19')&&typeof _0x436612[_0xf846('0x1a')]==='undefined';var _0xd44962=_0x520fc6[_0xf846('0x1b')];var _0x5aebad=_0x25539c?0x0:_0x436612[_0xf846('0x18')];var _0x5e3ed6=_0x25539c?_0x520fc6[_0xf846('0x1b')]:_0x436612['offset']+_0x436612[_0xf846('0x1a')];var _0x2be937;if(_0x5e3ed6>=_0xd44962){_0x5e3ed6=_0xd44962;_0x2be937=0xc8;}else{_0x2be937=0xce;}_0x3b5452[_0xf846('0x15')](_0x2be937);return _0x3b5452[_0xf846('0x1c')]('Content-Range',_0x5aebad+'-'+_0x5e3ed6+'/'+_0xd44962)[_0xf846('0x17')](_0x520fc6);}return null;};}function patchUpdates(_0xa96fbb){return function(_0x1db249){try{jsonpatch[_0xf846('0x1d')](_0x1db249,_0xa96fbb,!![]);}catch(_0x2b9c2){return BPromise[_0xf846('0x1e')](_0x2b9c2);}return _0x1db249[_0xf846('0x1f')]();};}function saveUpdates(_0x34ad90,_0x51136d){return function(_0x56ea7b){if(_0x56ea7b){return _0x56ea7b[_0xf846('0x20')](_0x34ad90)['then'](function(_0x39167c){return _0x39167c;});}return null;};}function removeEntity(_0x2c4dee,_0x26f087){return function(_0x5bd457){if(_0x5bd457){return _0x5bd457['destroy']()[_0xf846('0x21')](function(){var _0x267602=_0x5bd457[_0xf846('0x22')]({'plain':!![]});var _0x235de2=_0xf846('0x23');return db[_0xf846('0x24')][_0xf846('0x25')]({'where':{'type':_0x235de2,'resourceId':_0x267602['id']}})['then'](function(){return _0x5bd457;});})[_0xf846('0x21')](function(){_0x2c4dee[_0xf846('0x15')](0xcc)[_0xf846('0x16')]();});}};}function handleEntityNotFound(_0xbd929e,_0x2155bb){return function(_0x3c4127){if(!_0x3c4127){_0xbd929e[_0xf846('0x14')](0x194);}return _0x3c4127;};}function handleError(_0x12d1fb,_0x2185a9){_0x2185a9=_0x2185a9||0x1f4;return function(_0x5776cb){logger[_0xf846('0x26')](_0x5776cb['stack']);if(_0x5776cb[_0xf846('0x27')]){delete _0x5776cb[_0xf846('0x27')];}_0x12d1fb[_0xf846('0x15')](_0x2185a9)[_0xf846('0x28')](_0x5776cb);};}exports[_0xf846('0x29')]=function(_0x45b314,_0x402311){var _0x2a6599={},_0x48c3f8={},_0x132db4={'count':0x0,'rows':[]};var _0x24ebca=_[_0xf846('0x2a')](db[_0xf846('0x2b')]['rawAttributes'],function(_0x5adac0){return{'name':_0x5adac0[_0xf846('0x2c')],'type':_0x5adac0[_0xf846('0x2d')]['key']};});_0x48c3f8[_0xf846('0x2e')]=_['map'](_0x24ebca,'name');_0x48c3f8[_0xf846('0x2f')]=_[_0xf846('0x30')](_0x45b314['query']);_0x48c3f8[_0xf846('0x31')]=_['intersection'](_0x48c3f8[_0xf846('0x2e')],_0x48c3f8[_0xf846('0x2f')]);_0x2a6599[_0xf846('0x32')]=_[_0xf846('0x33')](_0x48c3f8[_0xf846('0x2e')],qs[_0xf846('0x34')](_0x45b314[_0xf846('0x2f')][_0xf846('0x34')]));_0x2a6599[_0xf846('0x32')]=_0x2a6599[_0xf846('0x32')]['length']?_0x2a6599[_0xf846('0x32')]:_0x48c3f8[_0xf846('0x2e')];if(!_0x45b314['query'][_0xf846('0x35')]('nolimit')){_0x2a6599[_0xf846('0x1a')]=qs[_0xf846('0x1a')](_0x45b314['query'][_0xf846('0x1a')]);_0x2a6599[_0xf846('0x18')]=qs[_0xf846('0x18')](_0x45b314[_0xf846('0x2f')][_0xf846('0x18')]);}_0x2a6599[_0xf846('0x36')]=qs[_0xf846('0x37')](_0x45b314[_0xf846('0x2f')][_0xf846('0x37')]);_0x2a6599[_0xf846('0x38')]=qs[_0xf846('0x31')](_['pick'](_0x45b314['query'],_0x48c3f8['filters']),_0x24ebca);if(_0x45b314['query'][_0xf846('0x39')]){_0x2a6599[_0xf846('0x38')]=_[_0xf846('0x3a')](_0x2a6599['where'],{'$or':_['map'](_0x24ebca,function(_0x4b17cb){if(_0x4b17cb[_0xf846('0x2d')]!==_0xf846('0x3b')){var _0x24c8db={};_0x24c8db[_0x4b17cb['name']]={'$like':'%'+_0x45b314['query']['filter']+'%'};return _0x24c8db;}})});}_0x2a6599=_['merge']({},_0x2a6599,_0x45b314[_0xf846('0x3c')]);var _0x179683={'where':_0x2a6599['where']};return db[_0xf846('0x2b')][_0xf846('0x1b')](_0x179683)[_0xf846('0x21')](function(_0x2ae552){_0x132db4['count']=_0x2ae552;if(_0x45b314[_0xf846('0x2f')][_0xf846('0x3d')]){_0x2a6599['include']=[{'all':!![]}];}return db['Template'][_0xf846('0x3e')](_0x2a6599);})[_0xf846('0x21')](function(_0x172246){_0x132db4[_0xf846('0x3f')]=_0x172246;return _0x132db4;})[_0xf846('0x21')](respondWithFilteredResult(_0x402311,_0x2a6599))[_0xf846('0x40')](handleError(_0x402311,null));};exports[_0xf846('0x41')]=function(_0x5d6af6,_0xac18a){var _0x5e0c97={'raw':!![],'where':{'id':_0x5d6af6[_0xf846('0x42')]['id']}},_0x40fb94={};_0x40fb94[_0xf846('0x2e')]=_['keys'](db['Template'][_0xf846('0x43')]);_0x40fb94[_0xf846('0x2f')]=_[_0xf846('0x30')](_0x5d6af6['query']);_0x40fb94[_0xf846('0x31')]=_['intersection'](_0x40fb94['model'],_0x40fb94['query']);_0x5e0c97[_0xf846('0x32')]=_[_0xf846('0x33')](_0x40fb94[_0xf846('0x2e')],qs['fields'](_0x5d6af6[_0xf846('0x2f')][_0xf846('0x34')]));_0x5e0c97[_0xf846('0x32')]=_0x5e0c97[_0xf846('0x32')][_0xf846('0x44')]?_0x5e0c97[_0xf846('0x32')]:_0x40fb94['model'];if(_0x5d6af6[_0xf846('0x2f')][_0xf846('0x3d')]){_0x5e0c97[_0xf846('0x45')]=[{'all':!![]}];}_0x5e0c97=_[_0xf846('0x3a')]({},_0x5e0c97,_0x5d6af6['options']);return db[_0xf846('0x2b')][_0xf846('0x46')](_0x5e0c97)['then'](handleEntityNotFound(_0xac18a,null))[_0xf846('0x21')](respondWithResult(_0xac18a,null))['catch'](handleError(_0xac18a,null));};exports[_0xf846('0x47')]=function(_0x46f5fb,_0x47734c){return db['Template'][_0xf846('0x47')](_0x46f5fb[_0xf846('0x48')],{})['then'](function(_0x4462cd){var _0x4b38b9=_0x46f5fb[_0xf846('0x49')][_0xf846('0x22')]({'plain':!![]});if(!_0x4b38b9)throw new Error(_0xf846('0x4a'));if(_0x4b38b9['role']===_0xf846('0x49')){var _0x501f9b=_0x4462cd[_0xf846('0x22')]({'plain':!![]});var _0x263038=_0xf846('0x23');return db[_0xf846('0x4b')][_0xf846('0x46')]({'where':{'name':_0x263038,'userProfileId':_0x4b38b9['userProfileId']},'raw':!![]})[_0xf846('0x21')](function(_0x49e10a){if(_0x49e10a&&_0x49e10a['autoAssociation']===0x0){return db[_0xf846('0x24')]['create']({'name':_0x501f9b[_0xf846('0x27')],'resourceId':_0x501f9b['id'],'type':_0x49e10a[_0xf846('0x27')],'sectionId':_0x49e10a['id']},{})[_0xf846('0x21')](function(){return _0x4462cd;});}else{return _0x4462cd;}})['catch'](function(_0x2bcfaa){logger['error'](_0xf846('0x4c'),_0x2bcfaa);throw _0x2bcfaa;});}return _0x4462cd;})[_0xf846('0x21')](respondWithResult(_0x47734c,0xc9))[_0xf846('0x40')](handleError(_0x47734c,null));};exports[_0xf846('0x20')]=function(_0x4df612,_0x3642ad){if(_0x4df612['body']['id']){delete _0x4df612[_0xf846('0x48')]['id'];}return db[_0xf846('0x2b')][_0xf846('0x46')]({'where':{'id':_0x4df612[_0xf846('0x42')]['id']}})[_0xf846('0x21')](handleEntityNotFound(_0x3642ad,null))[_0xf846('0x21')](saveUpdates(_0x4df612[_0xf846('0x48')],null))[_0xf846('0x21')](respondWithResult(_0x3642ad,null))[_0xf846('0x40')](handleError(_0x3642ad,null));};exports['destroy']=function(_0x5f51ff,_0x4f26cd){return db['Template']['find']({'where':{'id':_0x5f51ff['params']['id']}})[_0xf846('0x21')](handleEntityNotFound(_0x4f26cd,null))['then'](removeEntity(_0x4f26cd,null))[_0xf846('0x40')](handleError(_0x4f26cd,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index ed06095..b3fa5ee 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 _0x7c5d=['bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger','api','moment'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x7c5d,0xf7));var _0xd7c5=function(_0x2dc6e0,_0x29b460){_0x2dc6e0=_0x2dc6e0-0x0;var _0x42164b=_0x7c5d[_0x2dc6e0];return _0x42164b;};'use strict';var _=require(_0xd7c5('0x0'));var util=require(_0xd7c5('0x1'));var logger=require(_0xd7c5('0x2'))(_0xd7c5('0x3'));var moment=require(_0xd7c5('0x4'));var BPromise=require(_0xd7c5('0x5'));var rp=require(_0xd7c5('0x6'));var fs=require('fs');var path=require(_0xd7c5('0x7'));var rimraf=require(_0xd7c5('0x8'));var config=require(_0xd7c5('0x9'));var attributes=require(_0xd7c5('0xa'));module['exports']=function(_0x3b3d47,_0x49858d){return _0x3b3d47[_0xd7c5('0xb')](_0xd7c5('0xc'),attributes,{'tableName':_0xd7c5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb324=['../../config/logger','moment','bluebird','request-promise','path','rimraf','./template.attributes','exports','define','Template','tools_templates','util'];(function(_0x5f378b,_0x408bf8){var _0x5427ef=function(_0x10d024){while(--_0x10d024){_0x5f378b['push'](_0x5f378b['shift']());}};_0x5427ef(++_0x408bf8);}(_0xb324,0x1bb));var _0x4b32=function(_0xc15d95,_0x49890a){_0xc15d95=_0xc15d95-0x0;var _0x5b8ee8=_0xb324[_0xc15d95];return _0x5b8ee8;};'use strict';var _=require('lodash');var util=require(_0x4b32('0x0'));var logger=require(_0x4b32('0x1'))('api');var moment=require(_0x4b32('0x2'));var BPromise=require(_0x4b32('0x3'));var rp=require(_0x4b32('0x4'));var fs=require('fs');var path=require(_0x4b32('0x5'));var rimraf=require(_0x4b32('0x6'));var config=require('../../config/environment');var attributes=require(_0x4b32('0x7'));module[_0x4b32('0x8')]=function(_0x3290a2,_0x5f318c){return _0x3290a2[_0x4b32('0x9')](_0x4b32('0xa'),attributes,{'tableName':_0x4b32('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/template/template.rpc.js b/server/api/template/template.rpc.js index d6465e7..54973a8 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 _0xebd0=['request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3ddde9,_0x1a6a2b){var _0xdfb693=function(_0x1c1c20){while(--_0x1c1c20){_0x3ddde9['push'](_0x3ddde9['shift']());}};_0xdfb693(++_0x1a6a2b);}(_0xebd0,0x149));var _0x0ebd=function(_0x56aef4,_0x4eeaba){_0x56aef4=_0x56aef4-0x0;var _0x405f05=_0xebd0[_0x56aef4];return _0x405f05;};'use strict';var _=require(_0x0ebd('0x0'));var util=require(_0x0ebd('0x1'));var moment=require(_0x0ebd('0x2'));var BPromise=require('bluebird');var rs=require(_0x0ebd('0x3'));var fs=require('fs');var Redis=require(_0x0ebd('0x4'));var db=require(_0x0ebd('0x5'))['db'];var utils=require(_0x0ebd('0x6'));var logger=require(_0x0ebd('0x7'))(_0x0ebd('0x8'));var config=require('../../config/environment');var jayson=require(_0x0ebd('0x9'));var client=jayson[_0x0ebd('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20f3eb,_0x3037d1,_0xd91292){return new BPromise(function(_0x4a48d1,_0x4df660){return client[_0x0ebd('0xb')](_0x20f3eb,_0xd91292)[_0x0ebd('0xc')](function(_0x4e7a9b){logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));logger[_0x0ebd('0x10')](_0x0ebd('0x11'),_0x3037d1,_0x0ebd('0xf'),JSON[_0x0ebd('0x12')](_0x4e7a9b));if(_0x4e7a9b[_0x0ebd('0x13')]){if(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x14')]===0x1f4){logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')]['message']);return _0x4df660(_0x4e7a9b['error'][_0x0ebd('0x15')]);}logger[_0x0ebd('0x13')](_0x0ebd('0xe'),_0x3037d1,_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);return _0x4a48d1(_0x4e7a9b[_0x0ebd('0x13')][_0x0ebd('0x15')]);}else{logger[_0x0ebd('0xd')](_0x0ebd('0xe'),_0x3037d1,_0x0ebd('0xf'));_0x4a48d1(_0x4e7a9b[_0x0ebd('0x16')][_0x0ebd('0x15')]);}})[_0x0ebd('0x17')](function(_0x2f34f8){logger['error'](_0x0ebd('0xe'),_0x3037d1,_0x2f34f8);_0x4df660(_0x2f34f8);});});}exports[_0x0ebd('0x18')]=function(_0x420d43){var _0xe574ea=this;return new Promise(function(_0xf3c97d,_0x4ac278){return db['Template'][_0x0ebd('0x19')]({'raw':_0x420d43[_0x0ebd('0x1a')]?_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1b')]===undefined?!![]:![]:!![],'where':_0x420d43[_0x0ebd('0x1a')]?_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1c')]||null:null,'attributes':_0x420d43[_0x0ebd('0x1a')]?_0x420d43['options'][_0x0ebd('0x1d')]||null:null,'limit':_0x420d43[_0x0ebd('0x1a')]?_0x420d43['options'][_0x0ebd('0x1e')]||null:null,'include':_0x420d43['options']?_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1f')]?_[_0x0ebd('0x20')](_0x420d43[_0x0ebd('0x1a')][_0x0ebd('0x1f')],function(_0xaf09c2){return{'model':db[_0xaf09c2[_0x0ebd('0x21')]],'as':_0xaf09c2['as'],'attributes':_0xaf09c2[_0x0ebd('0x1d')],'include':_0xaf09c2[_0x0ebd('0x1f')]?_[_0x0ebd('0x20')](_0xaf09c2[_0x0ebd('0x1f')],function(_0x5d1fc8){return{'model':db[_0x5d1fc8[_0x0ebd('0x21')]],'as':_0x5d1fc8['as'],'attributes':_0x5d1fc8['attributes'],'include':_0x5d1fc8[_0x0ebd('0x1f')]?_[_0x0ebd('0x20')](_0x5d1fc8[_0x0ebd('0x1f')],function(_0x29d68e){return{'model':db[_0x29d68e[_0x0ebd('0x21')]],'as':_0x29d68e['as'],'attributes':_0x29d68e['attributes']};}):[]};}):[]};}):[]:[]})[_0x0ebd('0xc')](function(_0x1a6ff1){logger[_0x0ebd('0xd')](_0x0ebd('0x18'),_0x420d43);logger[_0x0ebd('0x10')](_0x0ebd('0x18'),_0x420d43,JSON['stringify'](_0x1a6ff1));_0xf3c97d(_0x1a6ff1);})[_0x0ebd('0x17')](function(_0x50161c){logger[_0x0ebd('0x13')]('GetTemplate',_0x50161c[_0x0ebd('0x15')],_0x420d43);_0x4ac278(_0xe574ea['error'](0x1f4,_0x50161c['message']));});});}; \ No newline at end of file +var _0xd0fc=['http','request','then','info','Template,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x59e476,_0x22b61e){var _0x17e6de=function(_0x355076){while(--_0x355076){_0x59e476['push'](_0x59e476['shift']());}};_0x17e6de(++_0x22b61e);}(_0xd0fc,0x1e4));var _0xcd0f=function(_0x2e5c20,_0x489d16){_0x2e5c20=_0x2e5c20-0x0;var _0x582e8f=_0xd0fc[_0x2e5c20];return _0x582e8f;};'use strict';var _=require(_0xcd0f('0x0'));var util=require(_0xcd0f('0x1'));var moment=require(_0xcd0f('0x2'));var BPromise=require(_0xcd0f('0x3'));var rs=require(_0xcd0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd0f('0x5'))['db'];var utils=require(_0xcd0f('0x6'));var logger=require(_0xcd0f('0x7'))(_0xcd0f('0x8'));var config=require(_0xcd0f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcd0f('0xa')][_0xcd0f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a97f0,_0x3162eb,_0x322e02){return new BPromise(function(_0x28977f,_0x5d1bd3){return client[_0xcd0f('0xc')](_0x3a97f0,_0x322e02)[_0xcd0f('0xd')](function(_0x4f1fe2){logger[_0xcd0f('0xe')](_0xcd0f('0xf'),_0x3162eb,'request\x20sent');logger[_0xcd0f('0x10')]('Template,\x20%s,\x20%s,\x20%s',_0x3162eb,'request\x20sent',JSON[_0xcd0f('0x11')](_0x4f1fe2));if(_0x4f1fe2['error']){if(_0x4f1fe2[_0xcd0f('0x12')]['code']===0x1f4){logger[_0xcd0f('0x12')](_0xcd0f('0xf'),_0x3162eb,_0x4f1fe2[_0xcd0f('0x12')][_0xcd0f('0x13')]);return _0x5d1bd3(_0x4f1fe2[_0xcd0f('0x12')][_0xcd0f('0x13')]);}logger[_0xcd0f('0x12')](_0xcd0f('0xf'),_0x3162eb,_0x4f1fe2['error']['message']);return _0x28977f(_0x4f1fe2[_0xcd0f('0x12')][_0xcd0f('0x13')]);}else{logger[_0xcd0f('0xe')]('Template,\x20%s,\x20%s',_0x3162eb,_0xcd0f('0x14'));_0x28977f(_0x4f1fe2[_0xcd0f('0x15')][_0xcd0f('0x13')]);}})[_0xcd0f('0x16')](function(_0xe8e66e){logger['error'](_0xcd0f('0xf'),_0x3162eb,_0xe8e66e);_0x5d1bd3(_0xe8e66e);});});}exports[_0xcd0f('0x17')]=function(_0x376f9a){var _0x5f24c2=this;return new Promise(function(_0x393192,_0x52a62b){return db[_0xcd0f('0x18')]['findAll']({'raw':_0x376f9a[_0xcd0f('0x19')]?_0x376f9a[_0xcd0f('0x19')][_0xcd0f('0x1a')]===undefined?!![]:![]:!![],'where':_0x376f9a[_0xcd0f('0x19')]?_0x376f9a[_0xcd0f('0x19')][_0xcd0f('0x1b')]||null:null,'attributes':_0x376f9a['options']?_0x376f9a['options'][_0xcd0f('0x1c')]||null:null,'limit':_0x376f9a[_0xcd0f('0x19')]?_0x376f9a[_0xcd0f('0x19')][_0xcd0f('0x1d')]||null:null,'include':_0x376f9a['options']?_0x376f9a['options'][_0xcd0f('0x1e')]?_[_0xcd0f('0x1f')](_0x376f9a[_0xcd0f('0x19')][_0xcd0f('0x1e')],function(_0x3b80d3){return{'model':db[_0x3b80d3[_0xcd0f('0x20')]],'as':_0x3b80d3['as'],'attributes':_0x3b80d3[_0xcd0f('0x1c')],'include':_0x3b80d3[_0xcd0f('0x1e')]?_[_0xcd0f('0x1f')](_0x3b80d3[_0xcd0f('0x1e')],function(_0x374627){return{'model':db[_0x374627[_0xcd0f('0x20')]],'as':_0x374627['as'],'attributes':_0x374627[_0xcd0f('0x1c')],'include':_0x374627[_0xcd0f('0x1e')]?_[_0xcd0f('0x1f')](_0x374627[_0xcd0f('0x1e')],function(_0x42616c){return{'model':db[_0x42616c[_0xcd0f('0x20')]],'as':_0x42616c['as'],'attributes':_0x42616c[_0xcd0f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x722614){logger['info'](_0xcd0f('0x17'),_0x376f9a);logger[_0xcd0f('0x10')](_0xcd0f('0x17'),_0x376f9a,JSON[_0xcd0f('0x11')](_0x722614));_0x393192(_0x722614);})[_0xcd0f('0x16')](function(_0xa4f2ff){logger[_0xcd0f('0x12')](_0xcd0f('0x17'),_0xa4f2ff[_0xcd0f('0x13')],_0x376f9a);_0x52a62b(_0x5f24c2['error'](0x1f4,_0xa4f2ff[_0xcd0f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 8528e18..1fe0e02 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 _0x4742=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','show','/:id/all_conditions','get','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','put','update','delete','exports'];(function(_0x31e5cb,_0x2f5adf){var _0x4170df=function(_0x31c53e){while(--_0x31c53e){_0x31e5cb['push'](_0x31e5cb['shift']());}};_0x4170df(++_0x2f5adf);}(_0x4742,0x64));var _0x2474=function(_0x1d8dbb,_0x38fb81){_0x1d8dbb=_0x1d8dbb-0x0;var _0x1d0f6f=_0x4742[_0x1d8dbb];return _0x1d0f6f;};'use strict';var multer=require(_0x2474('0x0'));var util=require(_0x2474('0x1'));var path=require('path');var timeout=require(_0x2474('0x2'));var express=require(_0x2474('0x3'));var router=express[_0x2474('0x4')]();var fs_extra=require(_0x2474('0x5'));var auth=require(_0x2474('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2474('0x7'));var controller=require(_0x2474('0x8'));router['get']('/',auth[_0x2474('0x9')](),controller[_0x2474('0xa')]);router['get'](_0x2474('0xb'),auth['isAuthenticated'](),controller[_0x2474('0xc')]);router['get'](_0x2474('0xd'),auth[_0x2474('0x9')](),controller['getAllConditions']);router[_0x2474('0xe')](_0x2474('0xf'),auth['isAuthenticated'](),controller[_0x2474('0x10')]);router[_0x2474('0xe')](_0x2474('0x11'),auth['isAuthenticated'](),controller['getActions']);router[_0x2474('0x12')]('/',auth[_0x2474('0x9')](),controller['create']);router[_0x2474('0x12')](_0x2474('0xd'),auth[_0x2474('0x9')](),controller[_0x2474('0x13')]);router[_0x2474('0x12')]('/:id/any_conditions',auth[_0x2474('0x9')](),controller[_0x2474('0x14')]);router[_0x2474('0x12')](_0x2474('0x11'),auth[_0x2474('0x9')](),controller['addAction']);router[_0x2474('0x15')](_0x2474('0xb'),auth[_0x2474('0x9')](),controller[_0x2474('0x16')]);router[_0x2474('0x17')]('/:id',auth[_0x2474('0x9')](),controller['destroy']);module[_0x2474('0x18')]=router; \ No newline at end of file +var _0x17b1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','post','addAllCondition','put','/:id','update','destroy','exports','multer','util','path'];(function(_0x1ed1cc,_0x557a83){var _0x410c70=function(_0x5c4edc){while(--_0x5c4edc){_0x1ed1cc['push'](_0x1ed1cc['shift']());}};_0x410c70(++_0x557a83);}(_0x17b1,0x7a));var _0x117b=function(_0x471a85,_0x239e8d){_0x471a85=_0x471a85-0x0;var _0x5f2039=_0x17b1[_0x471a85];return _0x5f2039;};'use strict';var multer=require(_0x117b('0x0'));var util=require(_0x117b('0x1'));var path=require(_0x117b('0x2'));var timeout=require(_0x117b('0x3'));var express=require(_0x117b('0x4'));var router=express[_0x117b('0x5')]();var fs_extra=require(_0x117b('0x6'));var auth=require(_0x117b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x117b('0x8'));var controller=require(_0x117b('0x9'));router[_0x117b('0xa')]('/',auth[_0x117b('0xb')](),controller[_0x117b('0xc')]);router[_0x117b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x117b('0xd')]);router[_0x117b('0xa')](_0x117b('0xe'),auth[_0x117b('0xb')](),controller[_0x117b('0xf')]);router['get']('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x117b('0x10')]);router[_0x117b('0xa')](_0x117b('0x11'),auth[_0x117b('0xb')](),controller['getActions']);router[_0x117b('0x12')]('/',auth[_0x117b('0xb')](),controller['create']);router[_0x117b('0x12')](_0x117b('0xe'),auth[_0x117b('0xb')](),controller[_0x117b('0x13')]);router[_0x117b('0x12')]('/:id/any_conditions',auth[_0x117b('0xb')](),controller['addAnyCondition']);router['post'](_0x117b('0x11'),auth[_0x117b('0xb')](),controller['addAction']);router[_0x117b('0x14')](_0x117b('0x15'),auth[_0x117b('0xb')](),controller[_0x117b('0x16')]);router['delete'](_0x117b('0x15'),auth[_0x117b('0xb')](),controller[_0x117b('0x17')]);module[_0x117b('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 2495702..a6452aa 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 _0xb3d2=['sequelize','exports','STRING','BOOLEAN'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xb3d2,0x140));var _0x2b3d=function(_0x29b382,_0x362495){_0x29b382=_0x29b382-0x0;var _0x160149=_0xb3d2[_0x29b382];return _0x160149;};'use strict';var Sequelize=require(_0x2b3d('0x0'));module[_0x2b3d('0x1')]={'name':{'type':Sequelize[_0x2b3d('0x2')]},'channel':{'type':Sequelize[_0x2b3d('0x2')]},'description':{'type':Sequelize[_0x2b3d('0x2')]},'status':{'type':Sequelize[_0x2b3d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x395a=['STRING','sequelize','exports'];(function(_0x65d12e,_0x4b0a30){var _0x4274e0=function(_0x121624){while(--_0x121624){_0x65d12e['push'](_0x65d12e['shift']());}};_0x4274e0(++_0x4b0a30);}(_0x395a,0x199));var _0xa395=function(_0x5756f8,_0x22b6d5){_0x5756f8=_0x5756f8-0x0;var _0x3bb749=_0x395a[_0x5756f8];return _0x3bb749;};'use strict';var Sequelize=require(_0xa395('0x0'));module[_0xa395('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa395('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 51e98ad..9756d08 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 _0xb69a=['to-csv','fs-extra','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','Content-Range','reject','update','then','destroy','get','Triggers','UserProfileResource','sendStatus','error','name','send','Trigger','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Condition','addAnyCondition','TriggerAnyId','getAllConditions','filter','getAnyConditions','addAction','TriggerId','findOne','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x4fe14d,_0x40b1ac){var _0x54abe3=function(_0x21da5b){while(--_0x21da5b){_0x4fe14d['push'](_0x4fe14d['shift']());}};_0x54abe3(++_0x40b1ac);}(_0xb69a,0xfb));var _0xab69=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb69a[_0x1a36a5];return _0x746243;};'use strict';var emlformat=require(_0xab69('0x0'));var rimraf=require(_0xab69('0x1'));var zipdir=require(_0xab69('0x2'));var jsonpatch=require(_0xab69('0x3'));var rp=require(_0xab69('0x4'));var moment=require(_0xab69('0x5'));var BPromise=require(_0xab69('0x6'));var Mustache=require(_0xab69('0x7'));var util=require('util');var path=require(_0xab69('0x8'));var sox=require(_0xab69('0x9'));var csv=require(_0xab69('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xab69('0xb'));var _=require('lodash');var squel=require(_0xab69('0xc'));var crypto=require(_0xab69('0xd'));var jsforce=require(_0xab69('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xab69('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xab69('0xf'));var authService=require(_0xab69('0x10'));var qs=require(_0xab69('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xab69('0x12'))(_0xab69('0x13'));var utils=require(_0xab69('0x14'));var config=require(_0xab69('0x15'));var licenseUtil=require(_0xab69('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x78939e,_0x2f1265){_0x2f1265=_0x2f1265||0xcc;return function(_0xe45e4){if(_0xe45e4){return _0x78939e['sendStatus'](_0x2f1265);}return _0x78939e[_0xab69('0x17')](_0x2f1265)[_0xab69('0x18')]();};}function respondWithResult(_0x35d830,_0x2ddb05){_0x2ddb05=_0x2ddb05||0xc8;return function(_0x166a15){if(_0x166a15){return _0x35d830[_0xab69('0x17')](_0x2ddb05)[_0xab69('0x19')](_0x166a15);}};}function respondWithFilteredResult(_0x15a4ba,_0xca263a){return function(_0x5874ad){if(_0x5874ad){var _0x57b5a5=typeof _0xca263a[_0xab69('0x1a')]==='undefined'&&typeof _0xca263a[_0xab69('0x1b')]==='undefined';var _0x55bef0=_0x5874ad['count'];var _0x58fc34=_0x57b5a5?0x0:_0xca263a[_0xab69('0x1a')];var _0x346325=_0x57b5a5?_0x5874ad[_0xab69('0x1c')]:_0xca263a['offset']+_0xca263a[_0xab69('0x1b')];var _0x52ab36;if(_0x346325>=_0x55bef0){_0x346325=_0x55bef0;_0x52ab36=0xc8;}else{_0x52ab36=0xce;}_0x15a4ba[_0xab69('0x17')](_0x52ab36);return _0x15a4ba['set'](_0xab69('0x1d'),_0x58fc34+'-'+_0x346325+'/'+_0x55bef0)[_0xab69('0x19')](_0x5874ad);}return null;};}function patchUpdates(_0x5d7c87){return function(_0x5e3cbb){try{jsonpatch['apply'](_0x5e3cbb,_0x5d7c87,!![]);}catch(_0x5cc22b){return BPromise[_0xab69('0x1e')](_0x5cc22b);}return _0x5e3cbb['save']();};}function saveUpdates(_0x1e478f,_0x292e36){return function(_0x3b7099){if(_0x3b7099){return _0x3b7099[_0xab69('0x1f')](_0x1e478f)[_0xab69('0x20')](function(_0x1fc0c2){return _0x1fc0c2;});}return null;};}function removeEntity(_0x27d439,_0x556651){return function(_0x1281f3){if(_0x1281f3){return _0x1281f3[_0xab69('0x21')]()[_0xab69('0x20')](function(){var _0xd029f7=_0x1281f3[_0xab69('0x22')]({'plain':!![]});var _0x2a867e=_0xab69('0x23');return db[_0xab69('0x24')][_0xab69('0x21')]({'where':{'type':_0x2a867e,'resourceId':_0xd029f7['id']}})['then'](function(){return _0x1281f3;});})[_0xab69('0x20')](function(){_0x27d439[_0xab69('0x17')](0xcc)[_0xab69('0x18')]();});}};}function handleEntityNotFound(_0x1ea074,_0x198eab){return function(_0x266a7f){if(!_0x266a7f){_0x1ea074[_0xab69('0x25')](0x194);}return _0x266a7f;};}function handleError(_0x70348f,_0x455d9b){_0x455d9b=_0x455d9b||0x1f4;return function(_0x5b5a00){logger[_0xab69('0x26')](_0x5b5a00['stack']);if(_0x5b5a00[_0xab69('0x27')]){delete _0x5b5a00[_0xab69('0x27')];}_0x70348f[_0xab69('0x17')](_0x455d9b)[_0xab69('0x28')](_0x5b5a00);};}exports['index']=function(_0x5e7fa3,_0x236abd){var _0x470edf={},_0x4801a5={},_0x13b87f={'count':0x0,'rows':[]};var _0x10fa17=_['map'](db[_0xab69('0x29')][_0xab69('0x2a')],function(_0x3de5df){return{'name':_0x3de5df[_0xab69('0x2b')],'type':_0x3de5df['type'][_0xab69('0x2c')]};});_0x4801a5[_0xab69('0x2d')]=_[_0xab69('0x2e')](_0x10fa17,_0xab69('0x27'));_0x4801a5[_0xab69('0x2f')]=_[_0xab69('0x30')](_0x5e7fa3[_0xab69('0x2f')]);_0x4801a5[_0xab69('0x31')]=_[_0xab69('0x32')](_0x4801a5[_0xab69('0x2d')],_0x4801a5[_0xab69('0x2f')]);_0x470edf['attributes']=_[_0xab69('0x32')](_0x4801a5[_0xab69('0x2d')],qs[_0xab69('0x33')](_0x5e7fa3['query'][_0xab69('0x33')]));_0x470edf[_0xab69('0x34')]=_0x470edf['attributes'][_0xab69('0x35')]?_0x470edf[_0xab69('0x34')]:_0x4801a5[_0xab69('0x2d')];if(!_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x36')](_0xab69('0x37'))){_0x470edf['limit']=qs['limit'](_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x1b')]);_0x470edf[_0xab69('0x1a')]=qs[_0xab69('0x1a')](_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x1a')]);}_0x470edf[_0xab69('0x38')]=qs[_0xab69('0x39')](_0x5e7fa3[_0xab69('0x2f')][_0xab69('0x39')]);_0x470edf[_0xab69('0x3a')]=qs['filters'](_[_0xab69('0x3b')](_0x5e7fa3[_0xab69('0x2f')],_0x4801a5['filters']),_0x10fa17);if(_0x5e7fa3[_0xab69('0x2f')]['filter']){_0x470edf['where']=_[_0xab69('0x3c')](_0x470edf[_0xab69('0x3a')],{'$or':_['map'](_0x10fa17,function(_0x2cbb06){if(_0x2cbb06['type']!==_0xab69('0x3d')){var _0x307fe2={};_0x307fe2[_0x2cbb06[_0xab69('0x27')]]={'$like':'%'+_0x5e7fa3['query']['filter']+'%'};return _0x307fe2;}})});}_0x470edf=_[_0xab69('0x3c')]({},_0x470edf,_0x5e7fa3[_0xab69('0x3e')]);var _0x1831db={'where':_0x470edf[_0xab69('0x3a')]};return db['Trigger']['count'](_0x1831db)[_0xab69('0x20')](function(_0x36852b){_0x13b87f[_0xab69('0x1c')]=_0x36852b;if(_0x5e7fa3['query'][_0xab69('0x3f')]){_0x470edf[_0xab69('0x40')]=[{'all':!![]}];}return db[_0xab69('0x29')]['findAll'](_0x470edf);})['then'](function(_0x5cf197){_0x13b87f['rows']=_0x5cf197;return _0x13b87f;})['then'](respondWithFilteredResult(_0x236abd,_0x470edf))[_0xab69('0x41')](handleError(_0x236abd,null));};exports['show']=function(_0xc449,_0x50d9c2){var _0x52382f={'raw':![],'where':{'id':_0xc449[_0xab69('0x42')]['id']}},_0x5421b8={};_0x5421b8[_0xab69('0x2d')]=_[_0xab69('0x30')](db[_0xab69('0x29')][_0xab69('0x2a')]);_0x5421b8[_0xab69('0x2f')]=_[_0xab69('0x30')](_0xc449[_0xab69('0x2f')]);_0x5421b8[_0xab69('0x31')]=_['intersection'](_0x5421b8['model'],_0x5421b8[_0xab69('0x2f')]);_0x52382f[_0xab69('0x34')]=_[_0xab69('0x32')](_0x5421b8[_0xab69('0x2d')],qs['fields'](_0xc449[_0xab69('0x2f')][_0xab69('0x33')]));_0x52382f['attributes']=_0x52382f[_0xab69('0x34')][_0xab69('0x35')]?_0x52382f[_0xab69('0x34')]:_0x5421b8[_0xab69('0x2d')];if(_0xc449[_0xab69('0x2f')]['includeAll']){_0x52382f[_0xab69('0x40')]=[{'all':!![]}];}_0x52382f=_['merge']({},_0x52382f,_0xc449[_0xab69('0x3e')]);return db[_0xab69('0x29')][_0xab69('0x43')](_0x52382f)[_0xab69('0x20')](handleEntityNotFound(_0x50d9c2,null))[_0xab69('0x20')](respondWithResult(_0x50d9c2,null))['catch'](handleError(_0x50d9c2,null));};exports[_0xab69('0x44')]=function(_0x47c5d4,_0x4e364b){return db[_0xab69('0x29')]['create'](_0x47c5d4[_0xab69('0x45')],{})['then'](function(_0x4cd291){var _0x5563f8=_0x47c5d4[_0xab69('0x46')][_0xab69('0x22')]({'plain':!![]});if(!_0x5563f8)throw new Error(_0xab69('0x47'));if(_0x5563f8[_0xab69('0x48')]==='user'){var _0x251c2f=_0x4cd291[_0xab69('0x22')]({'plain':!![]});var _0x2905e5='Triggers';return db[_0xab69('0x49')][_0xab69('0x43')]({'where':{'name':_0x2905e5,'userProfileId':_0x5563f8[_0xab69('0x4a')]},'raw':!![]})[_0xab69('0x20')](function(_0x34bd75){if(_0x34bd75&&_0x34bd75['autoAssociation']===0x0){return db['UserProfileResource'][_0xab69('0x44')]({'name':_0x251c2f[_0xab69('0x27')],'resourceId':_0x251c2f['id'],'type':_0x34bd75[_0xab69('0x27')],'sectionId':_0x34bd75['id']},{})['then'](function(){return _0x4cd291;});}else{return _0x4cd291;}})[_0xab69('0x41')](function(_0x5e5a8c){logger['error'](_0xab69('0x4b'),_0x5e5a8c);throw _0x5e5a8c;});}return _0x4cd291;})[_0xab69('0x20')](respondWithResult(_0x4e364b,0xc9))[_0xab69('0x41')](handleError(_0x4e364b,null));};exports['update']=function(_0x477b7c,_0x2c871f){if(_0x477b7c[_0xab69('0x45')]['id']){delete _0x477b7c[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x477b7c[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x2c871f,null))[_0xab69('0x20')](saveUpdates(_0x477b7c[_0xab69('0x45')],null))[_0xab69('0x20')](respondWithResult(_0x2c871f,null))['catch'](handleError(_0x2c871f,null));};exports[_0xab69('0x21')]=function(_0x6236a4,_0x4c41b5){return db['Trigger'][_0xab69('0x43')]({'where':{'id':_0x6236a4[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x4c41b5,null))[_0xab69('0x20')](removeEntity(_0x4c41b5,null))[_0xab69('0x41')](handleError(_0x4c41b5,null));};exports['addAllCondition']=function(_0x407e71,_0x25b733,_0x200c01){if(_0x407e71[_0xab69('0x45')]['id']){delete _0x407e71[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x407e71[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x25b733,null))['then'](function(_0x34c31c){if(_0x34c31c){_0x407e71[_0xab69('0x45')]['TriggerAllId']=_0x34c31c['id'];return db[_0xab69('0x4c')]['create'](_0x407e71[_0xab69('0x45')]);}})[_0xab69('0x20')](respondWithResult(_0x25b733,null))[_0xab69('0x41')](handleError(_0x25b733,null));};exports[_0xab69('0x4d')]=function(_0x30ba1c,_0x3f5c7a,_0x565ae8){if(_0x30ba1c[_0xab69('0x45')]['id']){delete _0x30ba1c[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x30ba1c[_0xab69('0x42')]['id']}})['then'](handleEntityNotFound(_0x3f5c7a,null))[_0xab69('0x20')](function(_0x4a5e44){if(_0x4a5e44){_0x30ba1c[_0xab69('0x45')][_0xab69('0x4e')]=_0x4a5e44['id'];return db[_0xab69('0x4c')]['create'](_0x30ba1c[_0xab69('0x45')]);}})['then'](respondWithResult(_0x3f5c7a,null))[_0xab69('0x41')](handleError(_0x3f5c7a,null));};exports[_0xab69('0x4f')]=function(_0x42ff0f,_0x42e3f6,_0x24c98b){var _0x2c2a12={};var _0x529b43={};var _0x3ce414;var _0x239445;return db[_0xab69('0x29')]['findOne']({'where':{'id':_0x42ff0f['params']['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x42e3f6,null))[_0xab69('0x20')](function(_0x49d4c0){if(_0x49d4c0){_0x3ce414=_0x49d4c0;_0x529b43[_0xab69('0x2d')]=_[_0xab69('0x30')](db[_0xab69('0x4c')]['rawAttributes']);_0x529b43[_0xab69('0x2f')]=_[_0xab69('0x30')](_0x42ff0f[_0xab69('0x2f')]);_0x529b43['filters']=_[_0xab69('0x32')](_0x529b43[_0xab69('0x2d')],_0x529b43[_0xab69('0x2f')]);_0x2c2a12['attributes']=_['intersection'](_0x529b43[_0xab69('0x2d')],qs[_0xab69('0x33')](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x33')]));_0x2c2a12[_0xab69('0x34')]=_0x2c2a12[_0xab69('0x34')][_0xab69('0x35')]?_0x2c2a12['attributes']:_0x529b43['model'];_0x2c2a12[_0xab69('0x38')]=qs[_0xab69('0x39')](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x39')]);_0x2c2a12[_0xab69('0x3a')]=qs[_0xab69('0x31')](_[_0xab69('0x3b')](_0x42ff0f[_0xab69('0x2f')],_0x529b43[_0xab69('0x31')]));if(_0x42ff0f['query'][_0xab69('0x50')]){_0x2c2a12['where']=_[_0xab69('0x3c')](_0x2c2a12[_0xab69('0x3a')],{'$or':_[_0xab69('0x2e')](_0x2c2a12[_0xab69('0x34')],function(_0x470962){var _0x54d86e={};_0x54d86e[_0x470962]={'$like':'%'+_0x42ff0f[_0xab69('0x2f')][_0xab69('0x50')]+'%'};return _0x54d86e;})});}_0x2c2a12=_[_0xab69('0x3c')]({},_0x2c2a12,_0x42ff0f['options']);return _0x3ce414[_0xab69('0x4f')](_0x2c2a12);}})['then'](function(_0x40bddc){if(_0x40bddc){_0x239445=_0x40bddc[_0xab69('0x35')];if(!_0x42ff0f[_0xab69('0x2f')]['hasOwnProperty'](_0xab69('0x37'))){_0x2c2a12[_0xab69('0x1b')]=qs['limit'](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x1b')]);_0x2c2a12[_0xab69('0x1a')]=qs['offset'](_0x42ff0f[_0xab69('0x2f')][_0xab69('0x1a')]);}return _0x3ce414[_0xab69('0x4f')](_0x2c2a12);}})[_0xab69('0x20')](function(_0x9c8111){if(_0x9c8111){return _0x9c8111?{'count':_0x239445,'rows':_0x9c8111}:null;}})[_0xab69('0x20')](respondWithResult(_0x42e3f6,null))[_0xab69('0x41')](handleError(_0x42e3f6,null));};exports[_0xab69('0x51')]=function(_0xd6ceac,_0x53e225,_0x353fa2){var _0x465149={};var _0x5bacb5={};var _0x294673;var _0x468502;return db[_0xab69('0x29')]['findOne']({'where':{'id':_0xd6ceac['params']['id']}})['then'](handleEntityNotFound(_0x53e225,null))['then'](function(_0x260ba5){if(_0x260ba5){_0x294673=_0x260ba5;_0x5bacb5['model']=_[_0xab69('0x30')](db[_0xab69('0x4c')][_0xab69('0x2a')]);_0x5bacb5[_0xab69('0x2f')]=_[_0xab69('0x30')](_0xd6ceac['query']);_0x5bacb5['filters']=_[_0xab69('0x32')](_0x5bacb5['model'],_0x5bacb5['query']);_0x465149[_0xab69('0x34')]=_['intersection'](_0x5bacb5[_0xab69('0x2d')],qs['fields'](_0xd6ceac['query']['fields']));_0x465149[_0xab69('0x34')]=_0x465149[_0xab69('0x34')][_0xab69('0x35')]?_0x465149[_0xab69('0x34')]:_0x5bacb5[_0xab69('0x2d')];_0x465149[_0xab69('0x38')]=qs['sort'](_0xd6ceac[_0xab69('0x2f')][_0xab69('0x39')]);_0x465149[_0xab69('0x3a')]=qs[_0xab69('0x31')](_[_0xab69('0x3b')](_0xd6ceac[_0xab69('0x2f')],_0x5bacb5[_0xab69('0x31')]));if(_0xd6ceac[_0xab69('0x2f')][_0xab69('0x50')]){_0x465149[_0xab69('0x3a')]=_[_0xab69('0x3c')](_0x465149[_0xab69('0x3a')],{'$or':_[_0xab69('0x2e')](_0x465149[_0xab69('0x34')],function(_0x7c392f){var _0x47b57e={};_0x47b57e[_0x7c392f]={'$like':'%'+_0xd6ceac[_0xab69('0x2f')][_0xab69('0x50')]+'%'};return _0x47b57e;})});}_0x465149=_[_0xab69('0x3c')]({},_0x465149,_0xd6ceac[_0xab69('0x3e')]);return _0x294673[_0xab69('0x51')](_0x465149);}})[_0xab69('0x20')](function(_0x20e6b1){if(_0x20e6b1){_0x468502=_0x20e6b1[_0xab69('0x35')];if(!_0xd6ceac[_0xab69('0x2f')][_0xab69('0x36')](_0xab69('0x37'))){_0x465149[_0xab69('0x1b')]=qs[_0xab69('0x1b')](_0xd6ceac['query']['limit']);_0x465149['offset']=qs[_0xab69('0x1a')](_0xd6ceac['query']['offset']);}return _0x294673[_0xab69('0x51')](_0x465149);}})[_0xab69('0x20')](function(_0x56ea54){if(_0x56ea54){return _0x56ea54?{'count':_0x468502,'rows':_0x56ea54}:null;}})[_0xab69('0x20')](respondWithResult(_0x53e225,null))[_0xab69('0x41')](handleError(_0x53e225,null));};exports[_0xab69('0x52')]=function(_0x254e63,_0x271ae2,_0x26b4ce){if(_0x254e63[_0xab69('0x45')]['id']){delete _0x254e63[_0xab69('0x45')]['id'];}return db[_0xab69('0x29')][_0xab69('0x43')]({'where':{'id':_0x254e63[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x271ae2,null))[_0xab69('0x20')](function(_0xc8500e){if(_0xc8500e){_0x254e63['body'][_0xab69('0x53')]=_0xc8500e['id'];return db['Action'][_0xab69('0x44')](_0x254e63[_0xab69('0x45')]);}})[_0xab69('0x20')](respondWithResult(_0x271ae2,null))[_0xab69('0x41')](handleError(_0x271ae2,null));};exports['getActions']=function(_0x267b8d,_0x3bc2e8,_0x1253b3){var _0x2fa386={};var _0x210764={};var _0x40872b;var _0x442994;return db[_0xab69('0x29')][_0xab69('0x54')]({'where':{'id':_0x267b8d[_0xab69('0x42')]['id']}})[_0xab69('0x20')](handleEntityNotFound(_0x3bc2e8,null))[_0xab69('0x20')](function(_0x1bee0e){if(_0x1bee0e){_0x40872b=_0x1bee0e;_0x210764[_0xab69('0x2d')]=_[_0xab69('0x30')](db[_0xab69('0x55')][_0xab69('0x2a')]);_0x210764[_0xab69('0x2f')]=_[_0xab69('0x30')](_0x267b8d['query']);_0x210764[_0xab69('0x31')]=_[_0xab69('0x32')](_0x210764[_0xab69('0x2d')],_0x210764[_0xab69('0x2f')]);_0x2fa386[_0xab69('0x34')]=_[_0xab69('0x32')](_0x210764[_0xab69('0x2d')],qs[_0xab69('0x33')](_0x267b8d['query'][_0xab69('0x33')]));_0x2fa386['attributes']=_0x2fa386['attributes'][_0xab69('0x35')]?_0x2fa386['attributes']:_0x210764['model'];_0x2fa386[_0xab69('0x38')]=qs[_0xab69('0x39')](_0x267b8d[_0xab69('0x2f')][_0xab69('0x39')]);_0x2fa386[_0xab69('0x3a')]=qs[_0xab69('0x31')](_[_0xab69('0x3b')](_0x267b8d['query'],_0x210764[_0xab69('0x31')]));if(_0x267b8d[_0xab69('0x2f')][_0xab69('0x50')]){_0x2fa386[_0xab69('0x3a')]=_[_0xab69('0x3c')](_0x2fa386[_0xab69('0x3a')],{'$or':_[_0xab69('0x2e')](_0x2fa386[_0xab69('0x34')],function(_0x3933f9){var _0x36c8df={};_0x36c8df[_0x3933f9]={'$like':'%'+_0x267b8d['query']['filter']+'%'};return _0x36c8df;})});}_0x2fa386=_[_0xab69('0x3c')]({},_0x2fa386,_0x267b8d[_0xab69('0x3e')]);return _0x40872b[_0xab69('0x56')](_0x2fa386);}})[_0xab69('0x20')](function(_0x55f4be){if(_0x55f4be){_0x442994=_0x55f4be[_0xab69('0x35')];if(!_0x267b8d['query'][_0xab69('0x36')](_0xab69('0x37'))){_0x2fa386['limit']=qs['limit'](_0x267b8d[_0xab69('0x2f')][_0xab69('0x1b')]);_0x2fa386[_0xab69('0x1a')]=qs['offset'](_0x267b8d[_0xab69('0x2f')][_0xab69('0x1a')]);}return _0x40872b[_0xab69('0x56')](_0x2fa386);}})['then'](function(_0x5a484b){if(_0x5a484b){return _0x5a484b?{'count':_0x442994,'rows':_0x5a484b}:null;}})[_0xab69('0x20')](respondWithResult(_0x3bc2e8,null))['catch'](handleError(_0x3bc2e8,null));}; \ No newline at end of file +var _0xa077=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','get','Triggers','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','VIRTUAL','filter','options','Trigger','count','findAll','catch','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','params','addAllCondition','TriggerAllId','Condition','TriggerAnyId','findOne','sort','getAllConditions','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service'];(function(_0xff2a94,_0x16d5c7){var _0x2b763e=function(_0x2d4859){while(--_0x2d4859){_0xff2a94['push'](_0xff2a94['shift']());}};_0x2b763e(++_0x16d5c7);}(_0xa077,0x14f));var _0x7a07=function(_0x39f141,_0x37d5b0){_0x39f141=_0x39f141-0x0;var _0x4218fc=_0xa077[_0x39f141];return _0x4218fc;};'use strict';var emlformat=require(_0x7a07('0x0'));var rimraf=require(_0x7a07('0x1'));var zipdir=require(_0x7a07('0x2'));var jsonpatch=require(_0x7a07('0x3'));var rp=require('request-promise');var moment=require(_0x7a07('0x4'));var BPromise=require(_0x7a07('0x5'));var Mustache=require(_0x7a07('0x6'));var util=require('util');var path=require(_0x7a07('0x7'));var sox=require('sox');var csv=require(_0x7a07('0x8'));var ejs=require(_0x7a07('0x9'));var fs=require('fs');var fs_extra=require(_0x7a07('0xa'));var _=require(_0x7a07('0xb'));var squel=require(_0x7a07('0xc'));var crypto=require(_0x7a07('0xd'));var jsforce=require(_0x7a07('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7a07('0x8'));var querystring=require('querystring');var Papa=require(_0x7a07('0xf'));var Redis=require('ioredis');var authService=require(_0x7a07('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a07('0x11'))(_0x7a07('0x12'));var utils=require(_0x7a07('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7a07('0x14'))['db'];function respondWithStatusCode(_0x59eaf6,_0x547b89){_0x547b89=_0x547b89||0xcc;return function(_0xaffa4){if(_0xaffa4){return _0x59eaf6[_0x7a07('0x15')](_0x547b89);}return _0x59eaf6['status'](_0x547b89)[_0x7a07('0x16')]();};}function respondWithResult(_0x3e3a0c,_0x4101a9){_0x4101a9=_0x4101a9||0xc8;return function(_0x183673){if(_0x183673){return _0x3e3a0c[_0x7a07('0x17')](_0x4101a9)[_0x7a07('0x18')](_0x183673);}};}function respondWithFilteredResult(_0x49c081,_0x16be21){return function(_0x5eb86b){if(_0x5eb86b){var _0x5a73f6=typeof _0x16be21[_0x7a07('0x19')]===_0x7a07('0x1a')&&typeof _0x16be21[_0x7a07('0x1b')]==='undefined';var _0x26e15e=_0x5eb86b['count'];var _0x464c8a=_0x5a73f6?0x0:_0x16be21[_0x7a07('0x19')];var _0xf849b=_0x5a73f6?_0x5eb86b['count']:_0x16be21['offset']+_0x16be21[_0x7a07('0x1b')];var _0x58382b;if(_0xf849b>=_0x26e15e){_0xf849b=_0x26e15e;_0x58382b=0xc8;}else{_0x58382b=0xce;}_0x49c081[_0x7a07('0x17')](_0x58382b);return _0x49c081[_0x7a07('0x1c')](_0x7a07('0x1d'),_0x464c8a+'-'+_0xf849b+'/'+_0x26e15e)[_0x7a07('0x18')](_0x5eb86b);}return null;};}function patchUpdates(_0x3636a3){return function(_0x78316a){try{jsonpatch[_0x7a07('0x1e')](_0x78316a,_0x3636a3,!![]);}catch(_0x3e25b4){return BPromise[_0x7a07('0x1f')](_0x3e25b4);}return _0x78316a[_0x7a07('0x20')]();};}function saveUpdates(_0x3f829c,_0x85cade){return function(_0x3f0a6d){if(_0x3f0a6d){return _0x3f0a6d[_0x7a07('0x21')](_0x3f829c)[_0x7a07('0x22')](function(_0xa68ab7){return _0xa68ab7;});}return null;};}function removeEntity(_0x4cd9c4,_0x3c92fd){return function(_0x244e0a){if(_0x244e0a){return _0x244e0a['destroy']()[_0x7a07('0x22')](function(){var _0x2d586d=_0x244e0a[_0x7a07('0x23')]({'plain':!![]});var _0x130522=_0x7a07('0x24');return db['UserProfileResource'][_0x7a07('0x25')]({'where':{'type':_0x130522,'resourceId':_0x2d586d['id']}})[_0x7a07('0x22')](function(){return _0x244e0a;});})[_0x7a07('0x22')](function(){_0x4cd9c4[_0x7a07('0x17')](0xcc)[_0x7a07('0x16')]();});}};}function handleEntityNotFound(_0x143ecb,_0x16f64a){return function(_0x310fe2){if(!_0x310fe2){_0x143ecb[_0x7a07('0x15')](0x194);}return _0x310fe2;};}function handleError(_0x16069a,_0x25b532){_0x25b532=_0x25b532||0x1f4;return function(_0x42d093){logger[_0x7a07('0x26')](_0x42d093[_0x7a07('0x27')]);if(_0x42d093[_0x7a07('0x28')]){delete _0x42d093[_0x7a07('0x28')];}_0x16069a[_0x7a07('0x17')](_0x25b532)['send'](_0x42d093);};}exports[_0x7a07('0x29')]=function(_0x5a9ce5,_0xacb079){var _0x1b7d76={},_0x5994da={},_0x422b58={'count':0x0,'rows':[]};var _0x560e72=_[_0x7a07('0x2a')](db['Trigger'][_0x7a07('0x2b')],function(_0xca1529){return{'name':_0xca1529[_0x7a07('0x2c')],'type':_0xca1529[_0x7a07('0x2d')][_0x7a07('0x2e')]};});_0x5994da[_0x7a07('0x2f')]=_[_0x7a07('0x2a')](_0x560e72,_0x7a07('0x28'));_0x5994da['query']=_[_0x7a07('0x30')](_0x5a9ce5['query']);_0x5994da[_0x7a07('0x31')]=_[_0x7a07('0x32')](_0x5994da[_0x7a07('0x2f')],_0x5994da[_0x7a07('0x33')]);_0x1b7d76[_0x7a07('0x34')]=_[_0x7a07('0x32')](_0x5994da[_0x7a07('0x2f')],qs['fields'](_0x5a9ce5[_0x7a07('0x33')][_0x7a07('0x35')]));_0x1b7d76[_0x7a07('0x34')]=_0x1b7d76[_0x7a07('0x34')][_0x7a07('0x36')]?_0x1b7d76[_0x7a07('0x34')]:_0x5994da[_0x7a07('0x2f')];if(!_0x5a9ce5[_0x7a07('0x33')][_0x7a07('0x37')](_0x7a07('0x38'))){_0x1b7d76[_0x7a07('0x1b')]=qs[_0x7a07('0x1b')](_0x5a9ce5['query'][_0x7a07('0x1b')]);_0x1b7d76[_0x7a07('0x19')]=qs[_0x7a07('0x19')](_0x5a9ce5[_0x7a07('0x33')][_0x7a07('0x19')]);}_0x1b7d76[_0x7a07('0x39')]=qs['sort'](_0x5a9ce5['query']['sort']);_0x1b7d76['where']=qs[_0x7a07('0x31')](_[_0x7a07('0x3a')](_0x5a9ce5['query'],_0x5994da['filters']),_0x560e72);if(_0x5a9ce5['query']['filter']){_0x1b7d76[_0x7a07('0x3b')]=_[_0x7a07('0x3c')](_0x1b7d76[_0x7a07('0x3b')],{'$or':_[_0x7a07('0x2a')](_0x560e72,function(_0x409d5a){if(_0x409d5a[_0x7a07('0x2d')]!==_0x7a07('0x3d')){var _0x2d0589={};_0x2d0589[_0x409d5a[_0x7a07('0x28')]]={'$like':'%'+_0x5a9ce5['query'][_0x7a07('0x3e')]+'%'};return _0x2d0589;}})});}_0x1b7d76=_[_0x7a07('0x3c')]({},_0x1b7d76,_0x5a9ce5[_0x7a07('0x3f')]);var _0x3bbe9f={'where':_0x1b7d76[_0x7a07('0x3b')]};return db[_0x7a07('0x40')][_0x7a07('0x41')](_0x3bbe9f)['then'](function(_0x444061){_0x422b58[_0x7a07('0x41')]=_0x444061;if(_0x5a9ce5[_0x7a07('0x33')]['includeAll']){_0x1b7d76['include']=[{'all':!![]}];}return db[_0x7a07('0x40')][_0x7a07('0x42')](_0x1b7d76);})[_0x7a07('0x22')](function(_0x4325b2){_0x422b58['rows']=_0x4325b2;return _0x422b58;})[_0x7a07('0x22')](respondWithFilteredResult(_0xacb079,_0x1b7d76))[_0x7a07('0x43')](handleError(_0xacb079,null));};exports['show']=function(_0x5975c9,_0x4ca898){var _0x17a94c={'raw':![],'where':{'id':_0x5975c9['params']['id']}},_0x4c823f={};_0x4c823f['model']=_[_0x7a07('0x30')](db[_0x7a07('0x40')][_0x7a07('0x2b')]);_0x4c823f['query']=_[_0x7a07('0x30')](_0x5975c9['query']);_0x4c823f[_0x7a07('0x31')]=_[_0x7a07('0x32')](_0x4c823f['model'],_0x4c823f[_0x7a07('0x33')]);_0x17a94c[_0x7a07('0x34')]=_[_0x7a07('0x32')](_0x4c823f[_0x7a07('0x2f')],qs[_0x7a07('0x35')](_0x5975c9[_0x7a07('0x33')]['fields']));_0x17a94c[_0x7a07('0x34')]=_0x17a94c[_0x7a07('0x34')]['length']?_0x17a94c['attributes']:_0x4c823f[_0x7a07('0x2f')];if(_0x5975c9[_0x7a07('0x33')]['includeAll']){_0x17a94c['include']=[{'all':!![]}];}_0x17a94c=_[_0x7a07('0x3c')]({},_0x17a94c,_0x5975c9['options']);return db['Trigger']['find'](_0x17a94c)['then'](handleEntityNotFound(_0x4ca898,null))[_0x7a07('0x22')](respondWithResult(_0x4ca898,null))[_0x7a07('0x43')](handleError(_0x4ca898,null));};exports[_0x7a07('0x44')]=function(_0x399faf,_0x733577){return db[_0x7a07('0x40')][_0x7a07('0x44')](_0x399faf[_0x7a07('0x45')],{})['then'](function(_0x321d3b){var _0x243080=_0x399faf[_0x7a07('0x46')][_0x7a07('0x23')]({'plain':!![]});if(!_0x243080)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x243080['role']===_0x7a07('0x46')){var _0x10c1b7=_0x321d3b[_0x7a07('0x23')]({'plain':!![]});var _0xaedbaa=_0x7a07('0x24');return db[_0x7a07('0x47')][_0x7a07('0x48')]({'where':{'name':_0xaedbaa,'userProfileId':_0x243080[_0x7a07('0x49')]},'raw':!![]})[_0x7a07('0x22')](function(_0x491103){if(_0x491103&&_0x491103[_0x7a07('0x4a')]===0x0){return db['UserProfileResource'][_0x7a07('0x44')]({'name':_0x10c1b7[_0x7a07('0x28')],'resourceId':_0x10c1b7['id'],'type':_0x491103[_0x7a07('0x28')],'sectionId':_0x491103['id']},{})[_0x7a07('0x22')](function(){return _0x321d3b;});}else{return _0x321d3b;}})['catch'](function(_0x4a86b9){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4a86b9);throw _0x4a86b9;});}return _0x321d3b;})[_0x7a07('0x22')](respondWithResult(_0x733577,0xc9))['catch'](handleError(_0x733577,null));};exports[_0x7a07('0x21')]=function(_0x36e01f,_0x301719){if(_0x36e01f[_0x7a07('0x45')]['id']){delete _0x36e01f[_0x7a07('0x45')]['id'];}return db['Trigger'][_0x7a07('0x48')]({'where':{'id':_0x36e01f[_0x7a07('0x4b')]['id']}})[_0x7a07('0x22')](handleEntityNotFound(_0x301719,null))[_0x7a07('0x22')](saveUpdates(_0x36e01f['body'],null))['then'](respondWithResult(_0x301719,null))['catch'](handleError(_0x301719,null));};exports['destroy']=function(_0x278795,_0x4e242e){return db[_0x7a07('0x40')][_0x7a07('0x48')]({'where':{'id':_0x278795[_0x7a07('0x4b')]['id']}})[_0x7a07('0x22')](handleEntityNotFound(_0x4e242e,null))[_0x7a07('0x22')](removeEntity(_0x4e242e,null))[_0x7a07('0x43')](handleError(_0x4e242e,null));};exports[_0x7a07('0x4c')]=function(_0x118394,_0x3f062a,_0x4ff770){if(_0x118394[_0x7a07('0x45')]['id']){delete _0x118394[_0x7a07('0x45')]['id'];}return db[_0x7a07('0x40')]['find']({'where':{'id':_0x118394[_0x7a07('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3f062a,null))[_0x7a07('0x22')](function(_0xd2f9fa){if(_0xd2f9fa){_0x118394[_0x7a07('0x45')][_0x7a07('0x4d')]=_0xd2f9fa['id'];return db[_0x7a07('0x4e')][_0x7a07('0x44')](_0x118394[_0x7a07('0x45')]);}})[_0x7a07('0x22')](respondWithResult(_0x3f062a,null))[_0x7a07('0x43')](handleError(_0x3f062a,null));};exports['addAnyCondition']=function(_0x37ed1d,_0x1ca201,_0x5364fe){if(_0x37ed1d[_0x7a07('0x45')]['id']){delete _0x37ed1d[_0x7a07('0x45')]['id'];}return db[_0x7a07('0x40')][_0x7a07('0x48')]({'where':{'id':_0x37ed1d[_0x7a07('0x4b')]['id']}})[_0x7a07('0x22')](handleEntityNotFound(_0x1ca201,null))['then'](function(_0x112131){if(_0x112131){_0x37ed1d[_0x7a07('0x45')][_0x7a07('0x4f')]=_0x112131['id'];return db[_0x7a07('0x4e')]['create'](_0x37ed1d['body']);}})['then'](respondWithResult(_0x1ca201,null))['catch'](handleError(_0x1ca201,null));};exports['getAllConditions']=function(_0x5ae9f7,_0x5741a4,_0x49207c){var _0x533755={};var _0x7fcd3e={};var _0x5b39fa;var _0x115578;return db['Trigger'][_0x7a07('0x50')]({'where':{'id':_0x5ae9f7[_0x7a07('0x4b')]['id']}})[_0x7a07('0x22')](handleEntityNotFound(_0x5741a4,null))['then'](function(_0x5326f8){if(_0x5326f8){_0x5b39fa=_0x5326f8;_0x7fcd3e[_0x7a07('0x2f')]=_['keys'](db['Condition'][_0x7a07('0x2b')]);_0x7fcd3e['query']=_[_0x7a07('0x30')](_0x5ae9f7[_0x7a07('0x33')]);_0x7fcd3e['filters']=_['intersection'](_0x7fcd3e[_0x7a07('0x2f')],_0x7fcd3e[_0x7a07('0x33')]);_0x533755[_0x7a07('0x34')]=_[_0x7a07('0x32')](_0x7fcd3e['model'],qs[_0x7a07('0x35')](_0x5ae9f7['query'][_0x7a07('0x35')]));_0x533755['attributes']=_0x533755['attributes'][_0x7a07('0x36')]?_0x533755['attributes']:_0x7fcd3e[_0x7a07('0x2f')];_0x533755['order']=qs[_0x7a07('0x51')](_0x5ae9f7['query'][_0x7a07('0x51')]);_0x533755[_0x7a07('0x3b')]=qs[_0x7a07('0x31')](_[_0x7a07('0x3a')](_0x5ae9f7[_0x7a07('0x33')],_0x7fcd3e[_0x7a07('0x31')]));if(_0x5ae9f7[_0x7a07('0x33')][_0x7a07('0x3e')]){_0x533755['where']=_[_0x7a07('0x3c')](_0x533755['where'],{'$or':_['map'](_0x533755[_0x7a07('0x34')],function(_0x106911){var _0x29a305={};_0x29a305[_0x106911]={'$like':'%'+_0x5ae9f7[_0x7a07('0x33')]['filter']+'%'};return _0x29a305;})});}_0x533755=_['merge']({},_0x533755,_0x5ae9f7[_0x7a07('0x3f')]);return _0x5b39fa[_0x7a07('0x52')](_0x533755);}})[_0x7a07('0x22')](function(_0x520f3b){if(_0x520f3b){_0x115578=_0x520f3b[_0x7a07('0x36')];if(!_0x5ae9f7[_0x7a07('0x33')][_0x7a07('0x37')](_0x7a07('0x38'))){_0x533755[_0x7a07('0x1b')]=qs[_0x7a07('0x1b')](_0x5ae9f7[_0x7a07('0x33')][_0x7a07('0x1b')]);_0x533755['offset']=qs[_0x7a07('0x19')](_0x5ae9f7['query'][_0x7a07('0x19')]);}return _0x5b39fa[_0x7a07('0x52')](_0x533755);}})['then'](function(_0x1bac54){if(_0x1bac54){return _0x1bac54?{'count':_0x115578,'rows':_0x1bac54}:null;}})[_0x7a07('0x22')](respondWithResult(_0x5741a4,null))[_0x7a07('0x43')](handleError(_0x5741a4,null));};exports['getAnyConditions']=function(_0x29e156,_0x5b3027,_0x19308f){var _0x586632={};var _0x4bf0bc={};var _0x8cb56e;var _0x1178c1;return db[_0x7a07('0x40')]['findOne']({'where':{'id':_0x29e156['params']['id']}})['then'](handleEntityNotFound(_0x5b3027,null))[_0x7a07('0x22')](function(_0x147ec6){if(_0x147ec6){_0x8cb56e=_0x147ec6;_0x4bf0bc[_0x7a07('0x2f')]=_[_0x7a07('0x30')](db[_0x7a07('0x4e')][_0x7a07('0x2b')]);_0x4bf0bc[_0x7a07('0x33')]=_[_0x7a07('0x30')](_0x29e156[_0x7a07('0x33')]);_0x4bf0bc[_0x7a07('0x31')]=_[_0x7a07('0x32')](_0x4bf0bc[_0x7a07('0x2f')],_0x4bf0bc['query']);_0x586632[_0x7a07('0x34')]=_[_0x7a07('0x32')](_0x4bf0bc[_0x7a07('0x2f')],qs[_0x7a07('0x35')](_0x29e156[_0x7a07('0x33')][_0x7a07('0x35')]));_0x586632[_0x7a07('0x34')]=_0x586632[_0x7a07('0x34')][_0x7a07('0x36')]?_0x586632['attributes']:_0x4bf0bc['model'];_0x586632[_0x7a07('0x39')]=qs[_0x7a07('0x51')](_0x29e156[_0x7a07('0x33')][_0x7a07('0x51')]);_0x586632['where']=qs[_0x7a07('0x31')](_[_0x7a07('0x3a')](_0x29e156[_0x7a07('0x33')],_0x4bf0bc[_0x7a07('0x31')]));if(_0x29e156[_0x7a07('0x33')][_0x7a07('0x3e')]){_0x586632[_0x7a07('0x3b')]=_['merge'](_0x586632[_0x7a07('0x3b')],{'$or':_[_0x7a07('0x2a')](_0x586632[_0x7a07('0x34')],function(_0xc89e60){var _0x27e9be={};_0x27e9be[_0xc89e60]={'$like':'%'+_0x29e156['query'][_0x7a07('0x3e')]+'%'};return _0x27e9be;})});}_0x586632=_[_0x7a07('0x3c')]({},_0x586632,_0x29e156['options']);return _0x8cb56e[_0x7a07('0x53')](_0x586632);}})[_0x7a07('0x22')](function(_0x3a3f09){if(_0x3a3f09){_0x1178c1=_0x3a3f09[_0x7a07('0x36')];if(!_0x29e156[_0x7a07('0x33')][_0x7a07('0x37')](_0x7a07('0x38'))){_0x586632[_0x7a07('0x1b')]=qs[_0x7a07('0x1b')](_0x29e156['query']['limit']);_0x586632[_0x7a07('0x19')]=qs[_0x7a07('0x19')](_0x29e156[_0x7a07('0x33')][_0x7a07('0x19')]);}return _0x8cb56e[_0x7a07('0x53')](_0x586632);}})[_0x7a07('0x22')](function(_0x2ebcae){if(_0x2ebcae){return _0x2ebcae?{'count':_0x1178c1,'rows':_0x2ebcae}:null;}})[_0x7a07('0x22')](respondWithResult(_0x5b3027,null))[_0x7a07('0x43')](handleError(_0x5b3027,null));};exports[_0x7a07('0x54')]=function(_0x3da2df,_0x518b72,_0x565a37){if(_0x3da2df[_0x7a07('0x45')]['id']){delete _0x3da2df[_0x7a07('0x45')]['id'];}return db[_0x7a07('0x40')]['find']({'where':{'id':_0x3da2df[_0x7a07('0x4b')]['id']}})['then'](handleEntityNotFound(_0x518b72,null))[_0x7a07('0x22')](function(_0x863889){if(_0x863889){_0x3da2df[_0x7a07('0x45')][_0x7a07('0x55')]=_0x863889['id'];return db[_0x7a07('0x56')][_0x7a07('0x44')](_0x3da2df['body']);}})[_0x7a07('0x22')](respondWithResult(_0x518b72,null))[_0x7a07('0x43')](handleError(_0x518b72,null));};exports[_0x7a07('0x57')]=function(_0x1f7274,_0x307750,_0x1078d5){var _0x391559={};var _0x4af49d={};var _0x56b9b6;var _0x342c72;return db[_0x7a07('0x40')][_0x7a07('0x50')]({'where':{'id':_0x1f7274[_0x7a07('0x4b')]['id']}})[_0x7a07('0x22')](handleEntityNotFound(_0x307750,null))[_0x7a07('0x22')](function(_0x347803){if(_0x347803){_0x56b9b6=_0x347803;_0x4af49d['model']=_[_0x7a07('0x30')](db['Action'][_0x7a07('0x2b')]);_0x4af49d[_0x7a07('0x33')]=_['keys'](_0x1f7274[_0x7a07('0x33')]);_0x4af49d[_0x7a07('0x31')]=_[_0x7a07('0x32')](_0x4af49d[_0x7a07('0x2f')],_0x4af49d['query']);_0x391559[_0x7a07('0x34')]=_[_0x7a07('0x32')](_0x4af49d[_0x7a07('0x2f')],qs[_0x7a07('0x35')](_0x1f7274[_0x7a07('0x33')][_0x7a07('0x35')]));_0x391559[_0x7a07('0x34')]=_0x391559['attributes'][_0x7a07('0x36')]?_0x391559[_0x7a07('0x34')]:_0x4af49d[_0x7a07('0x2f')];_0x391559['order']=qs['sort'](_0x1f7274[_0x7a07('0x33')][_0x7a07('0x51')]);_0x391559[_0x7a07('0x3b')]=qs[_0x7a07('0x31')](_[_0x7a07('0x3a')](_0x1f7274[_0x7a07('0x33')],_0x4af49d[_0x7a07('0x31')]));if(_0x1f7274[_0x7a07('0x33')][_0x7a07('0x3e')]){_0x391559['where']=_[_0x7a07('0x3c')](_0x391559[_0x7a07('0x3b')],{'$or':_[_0x7a07('0x2a')](_0x391559[_0x7a07('0x34')],function(_0x936929){var _0xdd5b0b={};_0xdd5b0b[_0x936929]={'$like':'%'+_0x1f7274['query']['filter']+'%'};return _0xdd5b0b;})});}_0x391559=_['merge']({},_0x391559,_0x1f7274[_0x7a07('0x3f')]);return _0x56b9b6[_0x7a07('0x57')](_0x391559);}})['then'](function(_0x3b5368){if(_0x3b5368){_0x342c72=_0x3b5368['length'];if(!_0x1f7274[_0x7a07('0x33')][_0x7a07('0x37')]('nolimit')){_0x391559['limit']=qs['limit'](_0x1f7274[_0x7a07('0x33')]['limit']);_0x391559[_0x7a07('0x19')]=qs[_0x7a07('0x19')](_0x1f7274[_0x7a07('0x33')][_0x7a07('0x19')]);}return _0x56b9b6['getActions'](_0x391559);}})[_0x7a07('0x22')](function(_0xc22835){if(_0xc22835){return _0xc22835?{'count':_0x342c72,'rows':_0xc22835}:null;}})[_0x7a07('0x22')](respondWithResult(_0x307750,null))[_0x7a07('0x43')](handleError(_0x307750,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 89e820c..0c29878 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 _0x093a=['Trigger','tools_triggers','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./trigger.attributes','exports','define'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x093a,0x16a));var _0xa093=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0x093a[_0x318840];return _0x223da4;};'use strict';var _=require('lodash');var util=require(_0xa093('0x0'));var logger=require(_0xa093('0x1'))(_0xa093('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa093('0x3'));var fs=require('fs');var path=require(_0xa093('0x4'));var rimraf=require(_0xa093('0x5'));var config=require(_0xa093('0x6'));var attributes=require(_0xa093('0x7'));module[_0xa093('0x8')]=function(_0x2346f1,_0x145f58){return _0x2346f1[_0xa093('0x9')](_0xa093('0xa'),attributes,{'tableName':_0xa093('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf197=['lodash','util','../../config/logger','bluebird','../../config/environment','define','Trigger','tools_triggers'];(function(_0x3a5db5,_0x44f3fa){var _0x2b936f=function(_0x52aa05){while(--_0x52aa05){_0x3a5db5['push'](_0x3a5db5['shift']());}};_0x2b936f(++_0x44f3fa);}(_0xf197,0x130));var _0x7f19=function(_0x292e4f,_0x1f6a1c){_0x292e4f=_0x292e4f-0x0;var _0x682f01=_0xf197[_0x292e4f];return _0x682f01;};'use strict';var _=require(_0x7f19('0x0'));var util=require(_0x7f19('0x1'));var logger=require(_0x7f19('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7f19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7f19('0x4'));var attributes=require('./trigger.attributes');module['exports']=function(_0x1a3591,_0x3c076e){return _0x1a3591[_0x7f19('0x5')](_0x7f19('0x6'),attributes,{'tableName':_0x7f19('0x7'),'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 8b1a824..2e9ae51 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 _0x3e68=['request','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trigger,\x20%s,\x20%s','message','result','catch','GetTrigger','findAll','options','raw','where','attributes','limit','include','model','map','then','ShowTrigger','Trigger','find','lodash','util','moment','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2cb1df,_0x4b439c){var _0x30e674=function(_0x532f8b){while(--_0x532f8b){_0x2cb1df['push'](_0x2cb1df['shift']());}};_0x30e674(++_0x4b439c);}(_0x3e68,0x82));var _0x83e6=function(_0x565fe1,_0x56552a){_0x565fe1=_0x565fe1-0x0;var _0x3bdca5=_0x3e68[_0x565fe1];return _0x3bdca5;};'use strict';var _=require(_0x83e6('0x0'));var util=require(_0x83e6('0x1'));var moment=require(_0x83e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x83e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x83e6('0x4'))(_0x83e6('0x5'));var config=require(_0x83e6('0x6'));var jayson=require(_0x83e6('0x7'));var client=jayson[_0x83e6('0x8')][_0x83e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d4309,_0x3b48b7,_0x4b2ac7){return new BPromise(function(_0x220aee,_0x1c80b2){return client[_0x83e6('0xa')](_0x4d4309,_0x4b2ac7)['then'](function(_0x2a0d16){logger[_0x83e6('0xb')]('Trigger,\x20%s,\x20%s',_0x3b48b7,'request\x20sent');logger[_0x83e6('0xc')](_0x83e6('0xd'),_0x3b48b7,_0x83e6('0xe'),JSON[_0x83e6('0xf')](_0x2a0d16));if(_0x2a0d16[_0x83e6('0x10')]){if(_0x2a0d16[_0x83e6('0x10')]['code']===0x1f4){logger[_0x83e6('0x10')](_0x83e6('0x11'),_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x1c80b2(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}logger[_0x83e6('0x10')]('Trigger,\x20%s,\x20%s',_0x3b48b7,_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);return _0x220aee(_0x2a0d16[_0x83e6('0x10')][_0x83e6('0x12')]);}else{logger[_0x83e6('0xb')](_0x83e6('0x11'),_0x3b48b7,'request\x20sent');_0x220aee(_0x2a0d16[_0x83e6('0x13')][_0x83e6('0x12')]);}})[_0x83e6('0x14')](function(_0x5f0741){logger[_0x83e6('0x10')]('Trigger,\x20%s,\x20%s',_0x3b48b7,_0x5f0741);_0x1c80b2(_0x5f0741);});});}exports[_0x83e6('0x15')]=function(_0x22a467){var _0x30516c=this;return new Promise(function(_0x71fd47,_0x4e4e0f){return db['Trigger'][_0x83e6('0x16')]({'raw':_0x22a467[_0x83e6('0x17')]?_0x22a467['options'][_0x83e6('0x18')]===undefined?!![]:![]:!![],'where':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x19')]||null:null,'attributes':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x1a')]||null:null,'limit':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x1b')]||null:null,'include':_0x22a467[_0x83e6('0x17')]?_0x22a467[_0x83e6('0x17')][_0x83e6('0x1c')]?_['map'](_0x22a467['options'][_0x83e6('0x1c')],function(_0x17e82b){return{'model':db[_0x17e82b[_0x83e6('0x1d')]],'as':_0x17e82b['as'],'attributes':_0x17e82b['attributes'],'include':_0x17e82b[_0x83e6('0x1c')]?_['map'](_0x17e82b[_0x83e6('0x1c')],function(_0x448dc){return{'model':db[_0x448dc[_0x83e6('0x1d')]],'as':_0x448dc['as'],'attributes':_0x448dc[_0x83e6('0x1a')],'include':_0x448dc[_0x83e6('0x1c')]?_[_0x83e6('0x1e')](_0x448dc[_0x83e6('0x1c')],function(_0x417295){return{'model':db[_0x417295['model']],'as':_0x417295['as'],'attributes':_0x417295[_0x83e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x83e6('0x1f')](function(_0x14012a){logger['info']('GetTrigger',_0x22a467);logger[_0x83e6('0xc')](_0x83e6('0x15'),_0x22a467,JSON[_0x83e6('0xf')](_0x14012a));_0x71fd47(_0x14012a);})['catch'](function(_0x57e2b5){logger[_0x83e6('0x10')]('GetTrigger',_0x57e2b5[_0x83e6('0x12')],_0x22a467);_0x4e4e0f(_0x30516c[_0x83e6('0x10')](0x1f4,_0x57e2b5[_0x83e6('0x12')]));});});};exports[_0x83e6('0x20')]=function(_0x308273){var _0x540e5f=this;return new Promise(function(_0x1eef7b,_0xe0909c){return db[_0x83e6('0x21')][_0x83e6('0x22')]({'raw':_0x308273['options']?_0x308273['options'][_0x83e6('0x18')]===undefined?!![]:![]:!![],'where':_0x308273[_0x83e6('0x17')]?_0x308273[_0x83e6('0x17')]['where']||null:null,'attributes':_0x308273[_0x83e6('0x17')]?_0x308273[_0x83e6('0x17')][_0x83e6('0x1a')]||null:null,'include':_0x308273[_0x83e6('0x17')]?_0x308273[_0x83e6('0x17')][_0x83e6('0x1c')]?_['map'](_0x308273[_0x83e6('0x17')]['include'],function(_0x156fb7){return{'model':db[_0x156fb7[_0x83e6('0x1d')]],'as':_0x156fb7['as'],'attributes':_0x156fb7['attributes'],'include':_0x156fb7[_0x83e6('0x1c')]?_[_0x83e6('0x1e')](_0x156fb7['include'],function(_0x408787){return{'model':db[_0x408787[_0x83e6('0x1d')]],'as':_0x408787['as'],'attributes':_0x408787['attributes'],'include':_0x408787[_0x83e6('0x1c')]?_[_0x83e6('0x1e')](_0x408787['include'],function(_0x542048){return{'model':db[_0x542048['model']],'as':_0x542048['as'],'attributes':_0x542048[_0x83e6('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x83e6('0x1f')](function(_0x11fc95){logger[_0x83e6('0xb')](_0x83e6('0x20'),_0x308273);logger[_0x83e6('0xc')](_0x83e6('0x20'),_0x308273,JSON['stringify'](_0x11fc95));_0x1eef7b(_0x11fc95);})[_0x83e6('0x14')](function(_0x43f6ad){logger[_0x83e6('0x10')](_0x83e6('0x20'),_0x43f6ad[_0x83e6('0x12')],_0x308273);_0xe0909c(_0x540e5f[_0x83e6('0x10')](0x1f4,_0x43f6ad['message']));});});}; \ No newline at end of file +var _0x561b=['Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map','model','include','then','catch','find','ShowTrigger','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x48b596,_0x165079){var _0x259b0f=function(_0x12c334){while(--_0x12c334){_0x48b596['push'](_0x48b596['shift']());}};_0x259b0f(++_0x165079);}(_0x561b,0xfb));var _0xb561=function(_0x15848f,_0x26db77){_0x15848f=_0x15848f-0x0;var _0xb5c50=_0x561b[_0x15848f];return _0xb5c50;};'use strict';var _=require(_0xb561('0x0'));var util=require(_0xb561('0x1'));var moment=require('moment');var BPromise=require(_0xb561('0x2'));var rs=require(_0xb561('0x3'));var fs=require('fs');var Redis=require(_0xb561('0x4'));var db=require(_0xb561('0x5'))['db'];var utils=require(_0xb561('0x6'));var logger=require(_0xb561('0x7'))(_0xb561('0x8'));var config=require(_0xb561('0x9'));var jayson=require(_0xb561('0xa'));var client=jayson[_0xb561('0xb')][_0xb561('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x13779d,_0x31a126,_0x371d37){return new BPromise(function(_0x18457c,_0x1795c3){return client[_0xb561('0xd')](_0x13779d,_0x371d37)['then'](function(_0x55e758){logger[_0xb561('0xe')](_0xb561('0xf'),_0x31a126,_0xb561('0x10'));logger[_0xb561('0x11')](_0xb561('0x12'),_0x31a126,_0xb561('0x10'),JSON[_0xb561('0x13')](_0x55e758));if(_0x55e758[_0xb561('0x14')]){if(_0x55e758[_0xb561('0x14')]['code']===0x1f4){logger[_0xb561('0x14')]('Trigger,\x20%s,\x20%s',_0x31a126,_0x55e758[_0xb561('0x14')][_0xb561('0x15')]);return _0x1795c3(_0x55e758[_0xb561('0x14')]['message']);}logger[_0xb561('0x14')](_0xb561('0xf'),_0x31a126,_0x55e758[_0xb561('0x14')][_0xb561('0x15')]);return _0x18457c(_0x55e758[_0xb561('0x14')][_0xb561('0x15')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x31a126,_0xb561('0x10'));_0x18457c(_0x55e758[_0xb561('0x16')]['message']);}})['catch'](function(_0x317943){logger[_0xb561('0x14')](_0xb561('0xf'),_0x31a126,_0x317943);_0x1795c3(_0x317943);});});}exports[_0xb561('0x17')]=function(_0x2a2876){var _0x570217=this;return new Promise(function(_0x38c320,_0x199795){return db[_0xb561('0x18')][_0xb561('0x19')]({'raw':_0x2a2876[_0xb561('0x1a')]?_0x2a2876[_0xb561('0x1a')][_0xb561('0x1b')]===undefined?!![]:![]:!![],'where':_0x2a2876[_0xb561('0x1a')]?_0x2a2876[_0xb561('0x1a')][_0xb561('0x1c')]||null:null,'attributes':_0x2a2876[_0xb561('0x1a')]?_0x2a2876['options'][_0xb561('0x1d')]||null:null,'limit':_0x2a2876[_0xb561('0x1a')]?_0x2a2876[_0xb561('0x1a')][_0xb561('0x1e')]||null:null,'include':_0x2a2876[_0xb561('0x1a')]?_0x2a2876[_0xb561('0x1a')]['include']?_[_0xb561('0x1f')](_0x2a2876[_0xb561('0x1a')]['include'],function(_0x440e1f){return{'model':db[_0x440e1f[_0xb561('0x20')]],'as':_0x440e1f['as'],'attributes':_0x440e1f[_0xb561('0x1d')],'include':_0x440e1f[_0xb561('0x21')]?_[_0xb561('0x1f')](_0x440e1f[_0xb561('0x21')],function(_0x201b5e){return{'model':db[_0x201b5e[_0xb561('0x20')]],'as':_0x201b5e['as'],'attributes':_0x201b5e[_0xb561('0x1d')],'include':_0x201b5e[_0xb561('0x21')]?_[_0xb561('0x1f')](_0x201b5e['include'],function(_0x3df5bb){return{'model':db[_0x3df5bb[_0xb561('0x20')]],'as':_0x3df5bb['as'],'attributes':_0x3df5bb[_0xb561('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb561('0x22')](function(_0x55b60f){logger[_0xb561('0xe')]('GetTrigger',_0x2a2876);logger[_0xb561('0x11')](_0xb561('0x17'),_0x2a2876,JSON[_0xb561('0x13')](_0x55b60f));_0x38c320(_0x55b60f);})[_0xb561('0x23')](function(_0x34f06d){logger['error'](_0xb561('0x17'),_0x34f06d[_0xb561('0x15')],_0x2a2876);_0x199795(_0x570217[_0xb561('0x14')](0x1f4,_0x34f06d[_0xb561('0x15')]));});});};exports['ShowTrigger']=function(_0x4717c5){var _0x2e0ac2=this;return new Promise(function(_0x248bd6,_0x2b0544){return db['Trigger'][_0xb561('0x24')]({'raw':_0x4717c5['options']?_0x4717c5[_0xb561('0x1a')][_0xb561('0x1b')]===undefined?!![]:![]:!![],'where':_0x4717c5[_0xb561('0x1a')]?_0x4717c5['options'][_0xb561('0x1c')]||null:null,'attributes':_0x4717c5['options']?_0x4717c5[_0xb561('0x1a')][_0xb561('0x1d')]||null:null,'include':_0x4717c5[_0xb561('0x1a')]?_0x4717c5[_0xb561('0x1a')][_0xb561('0x21')]?_[_0xb561('0x1f')](_0x4717c5[_0xb561('0x1a')]['include'],function(_0x2f172a){return{'model':db[_0x2f172a[_0xb561('0x20')]],'as':_0x2f172a['as'],'attributes':_0x2f172a[_0xb561('0x1d')],'include':_0x2f172a['include']?_[_0xb561('0x1f')](_0x2f172a['include'],function(_0x33e32c){return{'model':db[_0x33e32c[_0xb561('0x20')]],'as':_0x33e32c['as'],'attributes':_0x33e32c[_0xb561('0x1d')],'include':_0x33e32c[_0xb561('0x21')]?_['map'](_0x33e32c['include'],function(_0x140520){return{'model':db[_0x140520[_0xb561('0x20')]],'as':_0x140520['as'],'attributes':_0x140520[_0xb561('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38e750){logger['info'](_0xb561('0x25'),_0x4717c5);logger[_0xb561('0x11')]('ShowTrigger',_0x4717c5,JSON[_0xb561('0x13')](_0x38e750));_0x248bd6(_0x38e750);})[_0xb561('0x23')](function(_0x196ec7){logger[_0xb561('0x14')](_0xb561('0x25'),_0x196ec7[_0xb561('0x15')],_0x4717c5);_0x2b0544(_0x2e0ac2[_0xb561('0x14')](0x1f4,_0x196ec7[_0xb561('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 6d3c482..37ecc52 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 _0xc2d5=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xc2d5,0xde));var _0x5c2d=function(_0x2c1dcd,_0x350452){_0x2c1dcd=_0x2c1dcd-0x0;var _0x158ce5=_0xc2d5[_0x2c1dcd];return _0x158ce5;};'use strict';var multer=require(_0x5c2d('0x0'));var util=require(_0x5c2d('0x1'));var path=require(_0x5c2d('0x2'));var timeout=require(_0x5c2d('0x3'));var express=require(_0x5c2d('0x4'));var router=express[_0x5c2d('0x5')]();var fs_extra=require(_0x5c2d('0x6'));var auth=require(_0x5c2d('0x7'));var interaction=require(_0x5c2d('0x8'));var config=require(_0x5c2d('0x9'));var controller=require('./trunk.controller');router[_0x5c2d('0xa')]('/',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0xc')]);router['get'](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller['show']);router[_0x5c2d('0xe')](_0x5c2d('0xf'),auth['isAuthenticated'](),controller[_0x5c2d('0x10')]);router[_0x5c2d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5c2d('0x11')]);router[_0x5c2d('0x12')](_0x5c2d('0xd'),auth[_0x5c2d('0xb')](),controller[_0x5c2d('0x13')]);router[_0x5c2d('0x14')]('/:id',auth[_0x5c2d('0xb')](),controller[_0x5c2d('0x15')]);module[_0x5c2d('0x16')]=router; \ No newline at end of file +var _0xc5e4=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/clone','post','create','put','destroy','exports','path','connect-timeout'];(function(_0x2e7c9a,_0x1e7d2a){var _0x301c67=function(_0x52a50d){while(--_0x52a50d){_0x2e7c9a['push'](_0x2e7c9a['shift']());}};_0x301c67(++_0x1e7d2a);}(_0xc5e4,0x11f));var _0x4c5e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc5e4[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4c5e('0x0'));var timeout=require(_0x4c5e('0x1'));var express=require(_0x4c5e('0x2'));var router=express[_0x4c5e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4c5e('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c5e('0x5'));var controller=require('./trunk.controller');router[_0x4c5e('0x6')]('/',auth[_0x4c5e('0x7')](),controller[_0x4c5e('0x8')]);router['get'](_0x4c5e('0x9'),auth[_0x4c5e('0x7')](),controller[_0x4c5e('0xa')]);router['post'](_0x4c5e('0xb'),auth['isAuthenticated'](),controller['clone']);router[_0x4c5e('0xc')]('/',auth['isAuthenticated'](),controller[_0x4c5e('0xd')]);router[_0x4c5e('0xe')]('/:id',auth[_0x4c5e('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x4c5e('0xf')]);module[_0x4c5e('0x10')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 0849ea4..ba1d530 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 _0x495f=['ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','shortinfo','inband','auto','rfc2833','nonat','update','yes','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','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','ALLOWED_PASSED_SCREEN'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0x495f,0x1c2));var _0xf495=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x495f[_0x4fc9e6];return _0x551d28;};'use strict';var Sequelize=require(_0xf495('0x0'));module[_0xf495('0x1')]={'name':{'type':Sequelize[_0xf495('0x2')],'allowNull':![],'unique':_0xf495('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x5'),_0xf495('0x6'),_0xf495('0x7')),'allowNull':![],'defaultValue':_0xf495('0x5')},'context':{'type':Sequelize[_0xf495('0x2')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0xf495('0x4')]('ALLOWED_NOT_SCREENED',_0xf495('0x8'),_0xf495('0x9'),_0xf495('0xa'),_0xf495('0xb'),_0xf495('0xc'),_0xf495('0xd'),'PROHIB')},'deny':{'type':Sequelize[_0xf495('0x2')]},'permit':{'type':Sequelize[_0xf495('0x2')]},'secret':{'type':Sequelize[_0xf495('0x2')]},'md5secret':{'type':Sequelize[_0xf495('0x2')]},'remotesecret':{'type':Sequelize[_0xf495('0x2')]},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x5240c4){this[_0xf495('0xe')](_0xf495('0xf'),_0x5240c4?_0x5240c4[_0xf495('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xf495('0xf'))?this[_0xf495('0x11')](_0xf495('0xf'))[_0xf495('0x12')](','):null;},'comment':_0xf495('0x13')},'dtmfmode':{'type':Sequelize[_0xf495('0x4')]('rfc2833','info',_0xf495('0x14'),_0xf495('0x15'),_0xf495('0x16')),'defaultValue':_0xf495('0x17')},'directmedia':{'type':Sequelize[_0xf495('0x4')]('yes','no',_0xf495('0x18'),_0xf495('0x19'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0xf495('0x2')]},'nat':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x1b'),'set':function(_0x59199e){this[_0xf495('0xe')]('nat',_0x59199e?_0x59199e[_0xf495('0x10')](','):null);},'get':function(){return this['getDataValue'](_0xf495('0x1c'))?this[_0xf495('0x11')](_0xf495('0x1c'))['split'](','):null;},'comment':_0xf495('0x1d')},'callgroup':{'type':Sequelize[_0xf495('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xf495('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xf495('0x2')]},'language':{'type':Sequelize[_0xf495('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xf495('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2ccb73){this[_0xf495('0xe')]('allow',_0x2ccb73?_0x2ccb73[_0xf495('0x10')](';'):_0xf495('0x1f'));},'get':function(){return this[_0xf495('0x11')]('allow')?this[_0xf495('0x11')](_0xf495('0x20'))[_0xf495('0x12')](';'):null;},'comment':_0xf495('0x21')},'autoframing':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'insecure':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x22'),'set':function(_0x15bef5){this[_0xf495('0xe')](_0xf495('0x23'),_0x15bef5?_0x15bef5[_0xf495('0x10')](','):null);},'get':function(){return this[_0xf495('0x11')](_0xf495('0x23'))?this['getDataValue']('insecure')[_0xf495('0x12')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no',_0xf495('0x24'))},'promiscredir':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'useclientcode':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'accountcode':{'type':Sequelize[_0xf495('0x25')](0xb)},'setvar':{'type':Sequelize[_0xf495('0x2')]},'callerid':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no'),'defaultValue':_0xf495('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'allowtransfer':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0xf495('0x2')]},'videosupport':{'type':Sequelize[_0xf495('0x4')]('yes','no',_0xf495('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xf495('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'mailbox':{'type':Sequelize[_0xf495('0x2')]},'session_timers':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x28'),_0xf495('0x29'),_0xf495('0x2a'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xf495('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0xf495('0x4')]('uac',_0xf495('0x2b')),'defaultValue':_0xf495('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0xf495('0x2')]},'regexten':{'type':Sequelize[_0xf495('0x2')]},'fromdomain':{'type':Sequelize[_0xf495('0x2')]},'fromuser':{'type':Sequelize[_0xf495('0x2')]},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0xf495('0x4')]('yes','no'),'defaultValue':_0xf495('0x1a')},'keepalive':{'type':Sequelize[_0xf495('0x25')](0xb)},'defaultip':{'type':Sequelize[_0xf495('0x2')]},'defaultuser':{'type':Sequelize[_0xf495('0x2')]},'rtptimeout':{'type':Sequelize[_0xf495('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xf495('0x25')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf495('0x2')]},'callbackextension':{'type':Sequelize[_0xf495('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xf495('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0xf495('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0xf495('0x2')]},'contactdeny':{'type':Sequelize[_0xf495('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0xf495('0x2')]},'use_q850_reason':{'type':Sequelize[_0xf495('0x2')]},'maxforwards':{'type':Sequelize[_0xf495('0x25')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf495('0x4')]('yes','no')},'force_avp':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0xf495('0x4')]('yes','no')},'dtlsverify':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no',_0xf495('0x2c'),_0xf495('0x2d'))},'dtlsrekey':{'type':Sequelize[_0xf495('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0xf495('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xf495('0x2')]},'dtlscipher':{'type':Sequelize[_0xf495('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0xf495('0x2')]},'dtlssetup':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x2e'),_0xf495('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xf495('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf495('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0xf495('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xf495('0x4')](_0xf495('0x1a'),'no')},'subscribemwi':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no')},'vmexten':{'type':Sequelize[_0xf495('0x2')]},'mohinterpret':{'type':Sequelize[_0xf495('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0xf495('0x2')]},'description':{'type':Sequelize[_0xf495('0x2')]},'host':{'type':Sequelize[_0xf495('0x2')],'defaultValue':_0xf495('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0xf495('0x1a'),'no','nonat','update',_0xf495('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xf495('0x2')]},'otherFields':{'type':Sequelize[_0xf495('0x2')]},'active':{'type':Sequelize[_0xf495('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file +var _0x33b5=['certificate','passive','actpass','dynamic','BOOLEAN','sequelize','STRING','ENUM','user','friend','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','update','nat','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','originate','uas','fingerprint'];(function(_0x507f20,_0x536dac){var _0x44c0c2=function(_0x4d1a19){while(--_0x4d1a19){_0x507f20['push'](_0x507f20['shift']());}};_0x44c0c2(++_0x536dac);}(_0x33b5,0x10d));var _0x533b=function(_0x158902,_0x4c45bc){_0x158902=_0x158902-0x0;var _0x2bec55=_0x33b5[_0x158902];return _0x2bec55;};'use strict';var Sequelize=require(_0x533b('0x0'));module['exports']={'name':{'type':Sequelize[_0x533b('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x533b('0x2')]('friend',_0x533b('0x3'),'peer'),'allowNull':![],'defaultValue':_0x533b('0x4')},'context':{'type':Sequelize[_0x533b('0x1')],'allowNull':![],'defaultValue':_0x533b('0x5')},'callingpres':{'type':Sequelize['ENUM'](_0x533b('0x6'),'ALLOWED_PASSED_SCREEN',_0x533b('0x7'),_0x533b('0x8'),_0x533b('0x9'),'PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x533b('0xa'))},'deny':{'type':Sequelize[_0x533b('0x1')]},'permit':{'type':Sequelize[_0x533b('0x1')]},'secret':{'type':Sequelize[_0x533b('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x533b('0x1')],'defaultValue':_0x533b('0xb'),'set':function(_0x50a45c){this[_0x533b('0xc')](_0x533b('0xd'),_0x50a45c?_0x50a45c[_0x533b('0xe')](','):null);},'get':function(){return this[_0x533b('0xf')](_0x533b('0xd'))?this[_0x533b('0xf')]('transport')[_0x533b('0x10')](','):null;},'comment':_0x533b('0x11')},'dtmfmode':{'type':Sequelize[_0x533b('0x2')]('rfc2833',_0x533b('0x12'),_0x533b('0x13'),_0x533b('0x14'),_0x533b('0x15')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no',_0x533b('0x17'),_0x533b('0x18'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x533b('0x2')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x533b('0x1')]},'directmediadeny':{'type':Sequelize[_0x533b('0x1')]},'nat':{'type':Sequelize[_0x533b('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x33d9ff){this['setDataValue']('nat',_0x33d9ff?_0x33d9ff[_0x533b('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x533b('0x19'))?this[_0x533b('0xf')](_0x533b('0x19'))[_0x533b('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x533b('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0x533b('0x1')]},'language':{'type':Sequelize[_0x533b('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x533b('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x533b('0x1a')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5e458f){this[_0x533b('0xc')](_0x533b('0x1b'),_0x5e458f?_0x5e458f[_0x533b('0xe')](';'):_0x533b('0x1c'));},'get':function(){return this[_0x533b('0xf')](_0x533b('0x1b'))?this[_0x533b('0xf')]('allow')['split'](';'):null;},'comment':_0x533b('0x1d')},'autoframing':{'type':Sequelize[_0x533b('0x2')]('yes','no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':'port,invite','set':function(_0x43fe6c){this['setDataValue'](_0x533b('0x1e'),_0x43fe6c?_0x43fe6c[_0x533b('0xe')](','):null);},'get':function(){return this[_0x533b('0xf')](_0x533b('0x1e'))?this[_0x533b('0xf')](_0x533b('0x1e'))[_0x533b('0x10')](','):null;},'comment':_0x533b('0x1f')},'trustrpid':{'type':Sequelize[_0x533b('0x2')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x533b('0x16'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x533b('0x2')]('yes','no',_0x533b('0x20'))},'promiscredir':{'type':Sequelize[_0x533b('0x2')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x533b('0x16'),'no')},'accountcode':{'type':Sequelize[_0x533b('0x21')](0xb)},'setvar':{'type':Sequelize[_0x533b('0x1')]},'callerid':{'type':Sequelize[_0x533b('0x1')],'defaultValue':_0x533b('0x22')},'amaflags':{'type':Sequelize[_0x533b('0x1')]},'callcounter':{'type':Sequelize['ENUM'](_0x533b('0x16'),'no'),'defaultValue':_0x533b('0x16')},'busylevel':{'type':Sequelize[_0x533b('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no')},'allowsubscribe':{'type':Sequelize[_0x533b('0x2')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no')},'ignoresdpversion':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no')},'subscribecontext':{'type':Sequelize[_0x533b('0x1')]},'template':{'type':Sequelize[_0x533b('0x1')]},'videosupport':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no',_0x533b('0x23')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x533b('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x533b('0x16'),'no')},'mailbox':{'type':Sequelize[_0x533b('0x1')]},'session_timers':{'type':Sequelize[_0x533b('0x2')]('accept','refuse',_0x533b('0x24'))},'session_expires':{'type':Sequelize[_0x533b('0x21')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x533b('0x2')]('uac',_0x533b('0x25')),'defaultValue':_0x533b('0x25')},'t38pt_usertpsource':{'type':Sequelize[_0x533b('0x1')]},'regexten':{'type':Sequelize[_0x533b('0x1')]},'fromdomain':{'type':Sequelize[_0x533b('0x1')]},'fromuser':{'type':Sequelize[_0x533b('0x1')]},'port':{'type':Sequelize[_0x533b('0x21')](0x5)},'qualify':{'type':Sequelize[_0x533b('0x2')]('yes','no'),'defaultValue':_0x533b('0x16')},'keepalive':{'type':Sequelize[_0x533b('0x21')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x533b('0x1')]},'rtptimeout':{'type':Sequelize[_0x533b('0x21')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x533b('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x533b('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x533b('0x1')]},'timert1':{'type':Sequelize[_0x533b('0x21')](0xb)},'timerb':{'type':Sequelize[_0x533b('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x533b('0x1')]},'contactacl':{'type':Sequelize[_0x533b('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x533b('0x1')]},'use_q850_reason':{'type':Sequelize[_0x533b('0x1')]},'maxforwards':{'type':Sequelize[_0x533b('0x21')](0xb)},'encryption':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x533b('0x2')]('yes','no')},'force_avp':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no')},'icesupport':{'type':Sequelize[_0x533b('0x2')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no')},'dtlsverify':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no',_0x533b('0x26'),_0x533b('0x27'))},'dtlsrekey':{'type':Sequelize[_0x533b('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x533b('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x533b('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x533b('0x1')]},'dtlssetup':{'type':Sequelize['ENUM']('active',_0x533b('0x28'),_0x533b('0x29')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x533b('0x1')]},'usereqphone':{'type':Sequelize[_0x533b('0x2')](_0x533b('0x16'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x533b('0x1')]},'recordofffeature':{'type':Sequelize[_0x533b('0x1')]},'call_limit':{'type':Sequelize[_0x533b('0x21')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x533b('0x2')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x533b('0x16'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x533b('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x533b('0x1')],'defaultValue':_0x533b('0x2a')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x533b('0x17'),_0x533b('0x18'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x533b('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x533b('0x2b')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4d0069f..efcd6d0 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 _0x4b84=['omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','create','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','mustache','util','path','fs-extra','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','Trunks','UserProfileResource','stack','name','send','index','Trunk','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','include','findAll','rows','catch','show','params','length','find','includeAll','get'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x4b84,0x1cc));var _0x44b8=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x4b84[_0x34325b];return _0x3da348;};'use strict';var emlformat=require(_0x44b8('0x0'));var rimraf=require(_0x44b8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x44b8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x44b8('0x3'));var util=require(_0x44b8('0x4'));var path=require(_0x44b8('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44b8('0x6'));var _=require('lodash');var squel=require(_0x44b8('0x7'));var crypto=require('crypto');var jsforce=require(_0x44b8('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x44b8('0x9'));var Papa=require(_0x44b8('0xa'));var Redis=require(_0x44b8('0xb'));var authService=require('../../components/auth/service');var qs=require(_0x44b8('0xc'));var as=require(_0x44b8('0xd'));var hardwareService=require(_0x44b8('0xe'));var logger=require(_0x44b8('0xf'))(_0x44b8('0x10'));var utils=require(_0x44b8('0x11'));var config=require(_0x44b8('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x44b8('0x13'))['db'];var jayson=require(_0x44b8('0x14'));var client=jayson['client'][_0x44b8('0x15')]({'port':0x232a});function respondWithRpcPromise(_0x490bc6,_0x833ea3,_0x18d642,_0x4df670){return new BPromise(function(_0x63e8f6,_0x4be54c){var _0x54fa95=_0x4df670||client;return _0x54fa95[_0x44b8('0x16')](_0x490bc6,_0x18d642)[_0x44b8('0x17')](function(_0x1722da){logger[_0x44b8('0x18')]('Trunk,\x20%s,\x20%s',_0x833ea3,'request\x20sent');logger['debug'](_0x44b8('0x19'),_0x833ea3,'request\x20sent',JSON[_0x44b8('0x1a')](_0x1722da));if(_0x1722da[_0x44b8('0x1b')]){if(_0x1722da['error'][_0x44b8('0x1c')]===0x1f4){logger[_0x44b8('0x1b')]('Trunk,\x20%s,\x20%s',_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x4be54c(_0x1722da['error'][_0x44b8('0x1d')]);}logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);return _0x63e8f6(_0x1722da[_0x44b8('0x1b')][_0x44b8('0x1d')]);}else{logger[_0x44b8('0x18')](_0x44b8('0x1e'),_0x833ea3,_0x44b8('0x1f'));_0x63e8f6(_0x1722da[_0x44b8('0x20')][_0x44b8('0x1d')]);}})['catch'](function(_0x56549a){logger[_0x44b8('0x1b')](_0x44b8('0x1e'),_0x833ea3,_0x56549a);_0x4be54c(_0x56549a);});});}function respondWithStatusCode(_0x1418db,_0x305a5c){_0x305a5c=_0x305a5c||0xcc;return function(_0x51a34a){if(_0x51a34a){return _0x1418db[_0x44b8('0x21')](_0x305a5c);}return _0x1418db['status'](_0x305a5c)[_0x44b8('0x22')]();};}function respondWithResult(_0x228c81,_0x25a0c1){_0x25a0c1=_0x25a0c1||0xc8;return function(_0x47689e){if(_0x47689e){return _0x228c81[_0x44b8('0x23')](_0x25a0c1)['json'](_0x47689e);}};}function respondWithFilteredResult(_0x474f01,_0x502acf){return function(_0x41d673){if(_0x41d673){var _0x350482=typeof _0x502acf['offset']===_0x44b8('0x24')&&typeof _0x502acf[_0x44b8('0x25')]===_0x44b8('0x24');var _0x59c1bf=_0x41d673[_0x44b8('0x26')];var _0x242342=_0x350482?0x0:_0x502acf['offset'];var _0x2e0174=_0x350482?_0x41d673['count']:_0x502acf[_0x44b8('0x27')]+_0x502acf['limit'];var _0x559f0b;if(_0x2e0174>=_0x59c1bf){_0x2e0174=_0x59c1bf;_0x559f0b=0xc8;}else{_0x559f0b=0xce;}_0x474f01['status'](_0x559f0b);return _0x474f01[_0x44b8('0x28')](_0x44b8('0x29'),_0x242342+'-'+_0x2e0174+'/'+_0x59c1bf)[_0x44b8('0x2a')](_0x41d673);}return null;};}function patchUpdates(_0x1bd1be){return function(_0x38cd17){try{jsonpatch[_0x44b8('0x2b')](_0x38cd17,_0x1bd1be,!![]);}catch(_0x2cf205){return BPromise[_0x44b8('0x2c')](_0x2cf205);}return _0x38cd17[_0x44b8('0x2d')]();};}function saveUpdates(_0x28f918,_0x5e1129){return function(_0x417d81){if(_0x417d81){return _0x417d81[_0x44b8('0x2e')](_0x28f918)['then'](function(_0x261ff2){return _0x261ff2;});}return null;};}function removeEntity(_0x538db7,_0x212983){return function(_0x1652cb){if(_0x1652cb){return _0x1652cb[_0x44b8('0x2f')]()[_0x44b8('0x17')](function(){var _0x1b63a7=_0x1652cb['get']({'plain':!![]});var _0x16b706=_0x44b8('0x30');return db[_0x44b8('0x31')][_0x44b8('0x2f')]({'where':{'type':_0x16b706,'resourceId':_0x1b63a7['id']}})[_0x44b8('0x17')](function(){return _0x1652cb;});})['then'](function(){_0x538db7[_0x44b8('0x23')](0xcc)[_0x44b8('0x22')]();});}};}function handleEntityNotFound(_0x1a30fc,_0x3e93af){return function(_0x140a79){if(!_0x140a79){_0x1a30fc[_0x44b8('0x21')](0x194);}return _0x140a79;};}function handleError(_0x2e8b88,_0x14a9d7){_0x14a9d7=_0x14a9d7||0x1f4;return function(_0x28c10d){logger[_0x44b8('0x1b')](_0x28c10d[_0x44b8('0x32')]);if(_0x28c10d[_0x44b8('0x33')]){delete _0x28c10d[_0x44b8('0x33')];}_0x2e8b88[_0x44b8('0x23')](_0x14a9d7)[_0x44b8('0x34')](_0x28c10d);};}exports[_0x44b8('0x35')]=function(_0x323c50,_0xeff999){var _0x28faa9={},_0x3984f8={},_0x2c02d6={'count':0x0,'rows':[]};var _0x282345=_['map'](db[_0x44b8('0x36')][_0x44b8('0x37')],function(_0x4fcfa0){return{'name':_0x4fcfa0[_0x44b8('0x38')],'type':_0x4fcfa0[_0x44b8('0x39')][_0x44b8('0x3a')]};});_0x3984f8[_0x44b8('0x3b')]=_['map'](_0x282345,_0x44b8('0x33'));_0x3984f8[_0x44b8('0x3c')]=_[_0x44b8('0x3d')](_0x323c50[_0x44b8('0x3c')]);_0x3984f8[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],_0x3984f8[_0x44b8('0x3c')]);_0x28faa9[_0x44b8('0x40')]=_[_0x44b8('0x3f')](_0x3984f8[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x28faa9[_0x44b8('0x40')]=_0x28faa9[_0x44b8('0x40')]['length']?_0x28faa9[_0x44b8('0x40')]:_0x3984f8[_0x44b8('0x3b')];if(!_0x323c50[_0x44b8('0x3c')]['hasOwnProperty'](_0x44b8('0x42'))){_0x28faa9[_0x44b8('0x25')]=qs[_0x44b8('0x25')](_0x323c50['query'][_0x44b8('0x25')]);_0x28faa9[_0x44b8('0x27')]=qs[_0x44b8('0x27')](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x27')]);}_0x28faa9['order']=qs['sort'](_0x323c50[_0x44b8('0x3c')][_0x44b8('0x43')]);_0x28faa9[_0x44b8('0x44')]=qs[_0x44b8('0x3e')](_[_0x44b8('0x45')](_0x323c50[_0x44b8('0x3c')],_0x3984f8[_0x44b8('0x3e')]),_0x282345);if(_0x323c50[_0x44b8('0x3c')][_0x44b8('0x46')]){_0x28faa9[_0x44b8('0x44')]=_[_0x44b8('0x47')](_0x28faa9[_0x44b8('0x44')],{'$or':_[_0x44b8('0x48')](_0x282345,function(_0x1236c7){if(_0x1236c7[_0x44b8('0x39')]!==_0x44b8('0x49')){var _0xce06dc={};_0xce06dc[_0x1236c7[_0x44b8('0x33')]]={'$like':'%'+_0x323c50[_0x44b8('0x3c')]['filter']+'%'};return _0xce06dc;}})});}_0x28faa9=_['merge']({},_0x28faa9,_0x323c50[_0x44b8('0x4a')]);var _0x1df74b={'where':_0x28faa9[_0x44b8('0x44')]};return db[_0x44b8('0x36')][_0x44b8('0x26')](_0x1df74b)[_0x44b8('0x17')](function(_0x411ed6){_0x2c02d6['count']=_0x411ed6;if(_0x323c50[_0x44b8('0x3c')]['includeAll']){_0x28faa9[_0x44b8('0x4b')]=[{'all':!![]}];}return db[_0x44b8('0x36')][_0x44b8('0x4c')](_0x28faa9);})[_0x44b8('0x17')](function(_0x103d57){_0x2c02d6[_0x44b8('0x4d')]=_0x103d57;return _0x2c02d6;})['then'](respondWithFilteredResult(_0xeff999,_0x28faa9))[_0x44b8('0x4e')](handleError(_0xeff999,null));};exports[_0x44b8('0x4f')]=function(_0x10602c,_0x25d266){var _0x4ccc77={'raw':![],'where':{'id':_0x10602c[_0x44b8('0x50')]['id']}},_0x4e4ed1={};_0x4e4ed1[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')][_0x44b8('0x37')]);_0x4e4ed1['query']=_[_0x44b8('0x3d')](_0x10602c[_0x44b8('0x3c')]);_0x4e4ed1[_0x44b8('0x3e')]=_[_0x44b8('0x3f')](_0x4e4ed1[_0x44b8('0x3b')],_0x4e4ed1['query']);_0x4ccc77['attributes']=_[_0x44b8('0x3f')](_0x4e4ed1['model'],qs[_0x44b8('0x41')](_0x10602c['query'][_0x44b8('0x41')]));_0x4ccc77[_0x44b8('0x40')]=_0x4ccc77[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4ccc77[_0x44b8('0x40')]:_0x4e4ed1[_0x44b8('0x3b')];if(_0x10602c[_0x44b8('0x3c')]['includeAll']){_0x4ccc77[_0x44b8('0x4b')]=[{'all':!![]}];}_0x4ccc77=_[_0x44b8('0x47')]({},_0x4ccc77,_0x10602c[_0x44b8('0x4a')]);return db['Trunk'][_0x44b8('0x52')](_0x4ccc77)[_0x44b8('0x17')](handleEntityNotFound(_0x25d266,null))[_0x44b8('0x17')](respondWithResult(_0x25d266,null))[_0x44b8('0x4e')](handleError(_0x25d266,null));};exports['clone']=function(_0x399d6b,_0x308f7b){var _0x4a6e55={'where':{'id':_0x399d6b[_0x44b8('0x50')]['id']}},_0x3de425={};_0x3de425[_0x44b8('0x3b')]=_[_0x44b8('0x3d')](db[_0x44b8('0x36')]['rawAttributes']);_0x4a6e55['attributes']=_[_0x44b8('0x3f')](_0x3de425[_0x44b8('0x3b')],qs[_0x44b8('0x41')](_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x41')]));_0x4a6e55[_0x44b8('0x40')]=_0x4a6e55[_0x44b8('0x40')][_0x44b8('0x51')]?_0x4a6e55[_0x44b8('0x40')]:_0x3de425[_0x44b8('0x3b')];if(_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]){_0x4a6e55['include']=[{'all':!![]}];}_0x4a6e55=_[_0x44b8('0x47')]({},_0x4a6e55,_0x399d6b[_0x44b8('0x4a')]);return db[_0x44b8('0x36')][_0x44b8('0x52')](_0x4a6e55)[_0x44b8('0x17')](handleEntityNotFound(_0x308f7b,null))[_0x44b8('0x17')](function(_0x426a6a){if(_0x426a6a){var _0x172ff3=_0x426a6a[_0x44b8('0x54')]({'plain':!![]});_0x172ff3=qs[_0x44b8('0x55')](_0x172ff3,['id',_0x44b8('0x56'),_0x44b8('0x57')]);_0x399d6b[_0x44b8('0x58')]=_[_0x44b8('0x55')](_0x399d6b[_0x44b8('0x58')],['id',_0x44b8('0x56'),_0x44b8('0x57')]);return db[_0x44b8('0x36')]['create'](_[_0x44b8('0x47')](_0x172ff3,_0x399d6b[_0x44b8('0x58')]),{'include':_0x399d6b[_0x44b8('0x3c')][_0x44b8('0x53')]?[{'all':!![]}]:undefined})[_0x44b8('0x17')](function(_0x29ed5d){var _0x2ecf65=_0x399d6b['user'][_0x44b8('0x54')]({'plain':!![]});if(!_0x2ecf65)throw new Error(_0x44b8('0x59'));if(_0x2ecf65['role']===_0x44b8('0x5a')){var _0x3354bd=_0x29ed5d['get']({'plain':!![]});var _0x37e42e=_0x44b8('0x30');return db[_0x44b8('0x5b')]['find']({'where':{'name':_0x37e42e,'userProfileId':_0x2ecf65[_0x44b8('0x5c')]},'raw':!![]})['then'](function(_0x36cdd8){if(_0x36cdd8&&_0x36cdd8['autoAssociation']===0x0){return db[_0x44b8('0x31')][_0x44b8('0x5d')]({'name':_0x3354bd[_0x44b8('0x33')],'resourceId':_0x3354bd['id'],'type':_0x36cdd8[_0x44b8('0x33')],'sectionId':_0x36cdd8['id']},{})[_0x44b8('0x17')](function(){return _0x29ed5d;});}else{return _0x29ed5d;}})[_0x44b8('0x4e')](function(_0x4c7edd){logger[_0x44b8('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c7edd);throw _0x4c7edd;});}return _0x29ed5d;});}})[_0x44b8('0x17')](respondWithResult(_0x308f7b,0xc9))[_0x44b8('0x4e')](handleError(_0x308f7b,null));};exports['create']=function(_0x3f9438,_0x1ee26b,_0x1cf31f){var _0x30d60f;return db[_0x44b8('0x36')][_0x44b8('0x5d')](_0x3f9438[_0x44b8('0x58')],{'raw':!![]})[_0x44b8('0x17')](function(_0x3f9102){_0x30d60f=_0x3f9102;return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0x52381a){var _0xd20d0=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],_0x44b8('0x60')),_0x44b8('0x61'));var _0x5bff09=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],_0x44b8('0x63')),_0x44b8('0x61'));var _0x59060b=ejs[_0x44b8('0x64')](_0xd20d0,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x59060b);if(_0x30d60f[_0x44b8('0x67')]){var _0x2e02d7=ejs[_0x44b8('0x64')](_0x5bff09,{'trunks':_0x52381a||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x2e02d7);}})['then'](function(){return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x5d'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x17')](function(){var _0x5b26e8=_0x3f9438['user']['get']({'plain':!![]});if(!_0x5b26e8)throw new Error(_0x44b8('0x59'));if(_0x5b26e8[_0x44b8('0x6b')]===_0x44b8('0x5a')){var _0x46e20f=_0x30d60f[_0x44b8('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x44b8('0x52')]({'where':{'name':'Trunks','userProfileId':_0x5b26e8[_0x44b8('0x5c')]},'raw':!![]})[_0x44b8('0x17')](function(_0xea2c3e){if(_0xea2c3e&&_0xea2c3e['autoAssociation']===0x0){return db['UserProfileResource'][_0x44b8('0x5d')]({'name':_0x46e20f[_0x44b8('0x33')],'resourceId':_0x46e20f['id'],'type':_0xea2c3e[_0x44b8('0x33')],'sectionId':_0xea2c3e['id']},{})['then'](function(){return _0x30d60f;});}else{return _0x30d60f;}})[_0x44b8('0x4e')](function(_0x36f217){logger[_0x44b8('0x1b')](_0x44b8('0x6c'),_0x36f217);throw _0x36f217;});}return _0x30d60f;})[_0x44b8('0x17')](respondWithResult(_0x1ee26b,0xc9))['catch'](handleError(_0x1ee26b,null));};exports[_0x44b8('0x2e')]=function(_0x1888f8,_0xbbdab9,_0x2a8ccc){var _0x220f1b;return db['Trunk'][_0x44b8('0x52')]({'where':{'id':_0x1888f8[_0x44b8('0x50')]['id']}})[_0x44b8('0x17')](handleEntityNotFound(_0xbbdab9,null))[_0x44b8('0x17')](saveUpdates(_0x1888f8[_0x44b8('0x58')],null))[_0x44b8('0x17')](function(_0x1c7ef2){if(_0x1c7ef2){_0x220f1b=_0x1c7ef2;return db['Trunk'][_0x44b8('0x4c')]({'raw':!![]});}})[_0x44b8('0x17')](function(_0x4c3fea){if(_0x4c3fea){var _0x3bb7d8=fs[_0x44b8('0x5e')](path['join'](config[_0x44b8('0x62')],'server/files/templates/trunk.ejs'),'utf8');var _0x31d3b6=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/registry.ejs'),'utf8');var _0x36334a=ejs[_0x44b8('0x64')](_0x3bb7d8,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x36334a);var _0x1a5621=ejs[_0x44b8('0x64')](_0x31d3b6,{'trunks':_0x4c3fea||[]});fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x1a5621);return respondWithRpcPromise('Reload',_0x44b8('0x2e'),{'module':'chan_sip.so'});}return null;})['then'](function(_0x55f4e4){if(_0x55f4e4){return _0x220f1b;}})[_0x44b8('0x17')](respondWithResult(_0xbbdab9,null))['catch'](handleError(_0xbbdab9,null));};exports[_0x44b8('0x2f')]=function(_0x1e37fd,_0x268e1e,_0x306793){var _0x3a9780;return db[_0x44b8('0x36')][_0x44b8('0x52')]({'where':{'id':_0x1e37fd[_0x44b8('0x50')]['id']}})['then'](handleEntityNotFound(_0x268e1e,null))[_0x44b8('0x17')](removeEntity(_0x268e1e,null))[_0x44b8('0x17')](function(){return db[_0x44b8('0x36')][_0x44b8('0x4c')]({'raw':!![]});})[_0x44b8('0x17')](function(_0xee44b3){var _0x10034d=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config['root'],'server/files/templates/trunk.ejs'),_0x44b8('0x61'));var _0x553aa9=fs[_0x44b8('0x5e')](path[_0x44b8('0x5f')](config[_0x44b8('0x62')],'server/files/templates/registry.ejs'),'utf8');var _0x4b22e7=ejs[_0x44b8('0x64')](_0x10034d,{'trunks':_0xee44b3});var _0x4860af=ejs[_0x44b8('0x64')](_0x553aa9,{'trunks':_0xee44b3});fs[_0x44b8('0x65')](_0x44b8('0x66'),_0x4b22e7);fs[_0x44b8('0x65')](_0x44b8('0x68'),_0x4860af);return respondWithRpcPromise(_0x44b8('0x69'),_0x44b8('0x2f'),{'module':_0x44b8('0x6a')});})[_0x44b8('0x4e')](handleError(_0x268e1e,null));}; \ No newline at end of file +var _0x9957=['clone','includeAll','merge','get','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','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','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','Trunks','stack','name','send','map','Trunk','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','filter','options','include','rows','show','params','find'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_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'];var jayson=require(_0x7995('0x1b'));var client=jayson[_0x7995('0x1c')][_0x7995('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x23999f,_0x2bbe7a,_0x4cc004,_0x58f5ad){return new BPromise(function(_0x2b4e94,_0x2233dd){var _0x24b5bb=_0x58f5ad||client;return _0x24b5bb[_0x7995('0x1e')](_0x23999f,_0x4cc004)[_0x7995('0x1f')](function(_0x1a5310){logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,'request\x20sent');logger[_0x7995('0x22')]('Trunk,\x20%s,\x20%s,\x20%s',_0x2bbe7a,_0x7995('0x23'),JSON[_0x7995('0x24')](_0x1a5310));if(_0x1a5310[_0x7995('0x25')]){if(_0x1a5310[_0x7995('0x25')][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x25')]('Trunk,\x20%s,\x20%s',_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2233dd(_0x1a5310['error']['message']);}logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x1a5310['error'][_0x7995('0x27')]);return _0x2b4e94(_0x1a5310['error']['message']);}else{logger[_0x7995('0x20')](_0x7995('0x21'),_0x2bbe7a,_0x7995('0x23'));_0x2b4e94(_0x1a5310[_0x7995('0x28')][_0x7995('0x27')]);}})[_0x7995('0x29')](function(_0x5d40ae){logger[_0x7995('0x25')](_0x7995('0x21'),_0x2bbe7a,_0x5d40ae);_0x2233dd(_0x5d40ae);});});}function respondWithStatusCode(_0x204507,_0x285437){_0x285437=_0x285437||0xcc;return function(_0x563799){if(_0x563799){return _0x204507[_0x7995('0x2a')](_0x285437);}return _0x204507[_0x7995('0x2b')](_0x285437)[_0x7995('0x2c')]();};}function respondWithResult(_0x59405a,_0x39df42){_0x39df42=_0x39df42||0xc8;return function(_0x34e70c){if(_0x34e70c){return _0x59405a[_0x7995('0x2b')](_0x39df42)[_0x7995('0x2d')](_0x34e70c);}};}function respondWithFilteredResult(_0x3a3fcf,_0x2a307e){return function(_0x56691a){if(_0x56691a){var _0x47625f=typeof _0x2a307e['offset']===_0x7995('0x2e')&&typeof _0x2a307e[_0x7995('0x2f')]===_0x7995('0x2e');var _0x132a42=_0x56691a[_0x7995('0x30')];var _0x4b6f99=_0x47625f?0x0:_0x2a307e[_0x7995('0x31')];var _0x514445=_0x47625f?_0x56691a[_0x7995('0x30')]:_0x2a307e[_0x7995('0x31')]+_0x2a307e[_0x7995('0x2f')];var _0x574574;if(_0x514445>=_0x132a42){_0x514445=_0x132a42;_0x574574=0xc8;}else{_0x574574=0xce;}_0x3a3fcf['status'](_0x574574);return _0x3a3fcf['set'](_0x7995('0x32'),_0x4b6f99+'-'+_0x514445+'/'+_0x132a42)[_0x7995('0x2d')](_0x56691a);}return null;};}function patchUpdates(_0x327a81){return function(_0x2b874d){try{jsonpatch[_0x7995('0x33')](_0x2b874d,_0x327a81,!![]);}catch(_0x1ca460){return BPromise['reject'](_0x1ca460);}return _0x2b874d['save']();};}function saveUpdates(_0xfa8f15,_0x5524af){return function(_0x553671){if(_0x553671){return _0x553671[_0x7995('0x34')](_0xfa8f15)[_0x7995('0x1f')](function(_0x1e9fa4){return _0x1e9fa4;});}return null;};}function removeEntity(_0x1f7d27,_0x510841){return function(_0x44309d){if(_0x44309d){return _0x44309d[_0x7995('0x35')]()['then'](function(){var _0x48db25=_0x44309d['get']({'plain':!![]});var _0x45bc5e=_0x7995('0x36');return db['UserProfileResource'][_0x7995('0x35')]({'where':{'type':_0x45bc5e,'resourceId':_0x48db25['id']}})['then'](function(){return _0x44309d;});})[_0x7995('0x1f')](function(){_0x1f7d27[_0x7995('0x2b')](0xcc)[_0x7995('0x2c')]();});}};}function handleEntityNotFound(_0x5014d2,_0x52d76d){return function(_0x36d057){if(!_0x36d057){_0x5014d2['sendStatus'](0x194);}return _0x36d057;};}function handleError(_0x5d2428,_0x3e99cd){_0x3e99cd=_0x3e99cd||0x1f4;return function(_0xe328b1){logger['error'](_0xe328b1[_0x7995('0x37')]);if(_0xe328b1[_0x7995('0x38')]){delete _0xe328b1[_0x7995('0x38')];}_0x5d2428[_0x7995('0x2b')](_0x3e99cd)[_0x7995('0x39')](_0xe328b1);};}exports['index']=function(_0x2d4285,_0x242713){var _0xf612e6={},_0x1d60b8={},_0x4b1541={'count':0x0,'rows':[]};var _0x2be2c0=_[_0x7995('0x3a')](db[_0x7995('0x3b')][_0x7995('0x3c')],function(_0x1f5bee){return{'name':_0x1f5bee[_0x7995('0x3d')],'type':_0x1f5bee['type'][_0x7995('0x3e')]};});_0x1d60b8[_0x7995('0x3f')]=_[_0x7995('0x3a')](_0x2be2c0,_0x7995('0x38'));_0x1d60b8[_0x7995('0x40')]=_[_0x7995('0x41')](_0x2d4285[_0x7995('0x40')]);_0x1d60b8[_0x7995('0x42')]=_[_0x7995('0x43')](_0x1d60b8[_0x7995('0x3f')],_0x1d60b8[_0x7995('0x40')]);_0xf612e6[_0x7995('0x44')]=_[_0x7995('0x43')](_0x1d60b8['model'],qs['fields'](_0x2d4285[_0x7995('0x40')][_0x7995('0x45')]));_0xf612e6['attributes']=_0xf612e6['attributes'][_0x7995('0x46')]?_0xf612e6['attributes']:_0x1d60b8['model'];if(!_0x2d4285[_0x7995('0x40')][_0x7995('0x47')](_0x7995('0x48'))){_0xf612e6['limit']=qs[_0x7995('0x2f')](_0x2d4285['query'][_0x7995('0x2f')]);_0xf612e6['offset']=qs['offset'](_0x2d4285[_0x7995('0x40')][_0x7995('0x31')]);}_0xf612e6[_0x7995('0x49')]=qs[_0x7995('0x4a')](_0x2d4285['query'][_0x7995('0x4a')]);_0xf612e6[_0x7995('0x4b')]=qs[_0x7995('0x42')](_[_0x7995('0x4c')](_0x2d4285['query'],_0x1d60b8['filters']),_0x2be2c0);if(_0x2d4285[_0x7995('0x40')]['filter']){_0xf612e6[_0x7995('0x4b')]=_['merge'](_0xf612e6[_0x7995('0x4b')],{'$or':_['map'](_0x2be2c0,function(_0x1e795e){if(_0x1e795e[_0x7995('0x4d')]!=='VIRTUAL'){var _0x3e9e62={};_0x3e9e62[_0x1e795e[_0x7995('0x38')]]={'$like':'%'+_0x2d4285[_0x7995('0x40')][_0x7995('0x4e')]+'%'};return _0x3e9e62;}})});}_0xf612e6=_['merge']({},_0xf612e6,_0x2d4285[_0x7995('0x4f')]);var _0x3e787d={'where':_0xf612e6[_0x7995('0x4b')]};return db['Trunk'][_0x7995('0x30')](_0x3e787d)[_0x7995('0x1f')](function(_0x511567){_0x4b1541[_0x7995('0x30')]=_0x511567;if(_0x2d4285[_0x7995('0x40')]['includeAll']){_0xf612e6[_0x7995('0x50')]=[{'all':!![]}];}return db[_0x7995('0x3b')]['findAll'](_0xf612e6);})[_0x7995('0x1f')](function(_0x5843ba){_0x4b1541[_0x7995('0x51')]=_0x5843ba;return _0x4b1541;})[_0x7995('0x1f')](respondWithFilteredResult(_0x242713,_0xf612e6))[_0x7995('0x29')](handleError(_0x242713,null));};exports[_0x7995('0x52')]=function(_0xddf537,_0x14b537){var _0x1579b9={'raw':![],'where':{'id':_0xddf537[_0x7995('0x53')]['id']}},_0x4d46bc={};_0x4d46bc[_0x7995('0x3f')]=_[_0x7995('0x41')](db['Trunk'][_0x7995('0x3c')]);_0x4d46bc[_0x7995('0x40')]=_[_0x7995('0x41')](_0xddf537['query']);_0x4d46bc['filters']=_['intersection'](_0x4d46bc[_0x7995('0x3f')],_0x4d46bc[_0x7995('0x40')]);_0x1579b9['attributes']=_[_0x7995('0x43')](_0x4d46bc[_0x7995('0x3f')],qs[_0x7995('0x45')](_0xddf537[_0x7995('0x40')][_0x7995('0x45')]));_0x1579b9['attributes']=_0x1579b9[_0x7995('0x44')]['length']?_0x1579b9[_0x7995('0x44')]:_0x4d46bc[_0x7995('0x3f')];if(_0xddf537[_0x7995('0x40')]['includeAll']){_0x1579b9['include']=[{'all':!![]}];}_0x1579b9=_['merge']({},_0x1579b9,_0xddf537['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x1579b9)[_0x7995('0x1f')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x1f')](respondWithResult(_0x14b537,null))[_0x7995('0x29')](handleError(_0x14b537,null));};exports[_0x7995('0x55')]=function(_0x1f4270,_0xda6ce8){var _0x328671={'where':{'id':_0x1f4270[_0x7995('0x53')]['id']}},_0x17ecd3={};_0x17ecd3[_0x7995('0x3f')]=_[_0x7995('0x41')](db[_0x7995('0x3b')][_0x7995('0x3c')]);_0x328671[_0x7995('0x44')]=_[_0x7995('0x43')](_0x17ecd3[_0x7995('0x3f')],qs[_0x7995('0x45')](_0x1f4270['query'][_0x7995('0x45')]));_0x328671[_0x7995('0x44')]=_0x328671[_0x7995('0x44')][_0x7995('0x46')]?_0x328671['attributes']:_0x17ecd3['model'];if(_0x1f4270[_0x7995('0x40')][_0x7995('0x56')]){_0x328671[_0x7995('0x50')]=[{'all':!![]}];}_0x328671=_[_0x7995('0x57')]({},_0x328671,_0x1f4270['options']);return db[_0x7995('0x3b')][_0x7995('0x54')](_0x328671)[_0x7995('0x1f')](handleEntityNotFound(_0xda6ce8,null))[_0x7995('0x1f')](function(_0x502d43){if(_0x502d43){var _0x5e2d97=_0x502d43[_0x7995('0x58')]({'plain':!![]});_0x5e2d97=qs[_0x7995('0x59')](_0x5e2d97,['id',_0x7995('0x5a'),_0x7995('0x5b')]);_0x1f4270[_0x7995('0x5c')]=_[_0x7995('0x59')](_0x1f4270[_0x7995('0x5c')],['id',_0x7995('0x5a'),_0x7995('0x5b')]);return db['Trunk'][_0x7995('0x5d')](_[_0x7995('0x57')](_0x5e2d97,_0x1f4270[_0x7995('0x5c')]),{'include':_0x1f4270[_0x7995('0x40')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x3053fd){var _0xebb5c8=_0x1f4270['user'][_0x7995('0x58')]({'plain':!![]});if(!_0xebb5c8)throw new Error(_0x7995('0x5e'));if(_0xebb5c8[_0x7995('0x5f')]===_0x7995('0x60')){var _0x32cb04=_0x3053fd['get']({'plain':!![]});var _0x457d09='Trunks';return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':_0x457d09,'userProfileId':_0xebb5c8[_0x7995('0x62')]},'raw':!![]})[_0x7995('0x1f')](function(_0x4388c1){if(_0x4388c1&&_0x4388c1[_0x7995('0x63')]===0x0){return db[_0x7995('0x64')][_0x7995('0x5d')]({'name':_0x32cb04[_0x7995('0x38')],'resourceId':_0x32cb04['id'],'type':_0x4388c1[_0x7995('0x38')],'sectionId':_0x4388c1['id']},{})[_0x7995('0x1f')](function(){return _0x3053fd;});}else{return _0x3053fd;}})[_0x7995('0x29')](function(_0x56eb85){logger[_0x7995('0x25')](_0x7995('0x65'),_0x56eb85);throw _0x56eb85;});}return _0x3053fd;});}})[_0x7995('0x1f')](respondWithResult(_0xda6ce8,0xc9))[_0x7995('0x29')](handleError(_0xda6ce8,null));};exports[_0x7995('0x5d')]=function(_0x54a2e0,_0x4b54f2,_0x268fde){var _0x87e38d;return db[_0x7995('0x3b')][_0x7995('0x5d')](_0x54a2e0['body'],{'raw':!![]})[_0x7995('0x1f')](function(_0x50a12e){_0x87e38d=_0x50a12e;return db['Trunk'][_0x7995('0x66')]({'raw':!![]});})[_0x7995('0x1f')](function(_0x3f0a71){var _0x44bf2b=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x2466df=fs['readFileSync'](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6c')),'utf8');var _0x1fe1cb=ejs[_0x7995('0x6d')](_0x44bf2b,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x1fe1cb);if(_0x87e38d[_0x7995('0x70')]){var _0x51ab1e=ejs[_0x7995('0x6d')](_0x2466df,{'trunks':_0x3f0a71||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x51ab1e);}})[_0x7995('0x1f')](function(){return respondWithRpcPromise(_0x7995('0x72'),'create',{'module':'chan_sip.so'});})[_0x7995('0x1f')](function(){var _0xfe1105=_0x54a2e0[_0x7995('0x60')][_0x7995('0x58')]({'plain':!![]});if(!_0xfe1105)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfe1105[_0x7995('0x5f')]===_0x7995('0x60')){var _0x54b955=_0x87e38d['get']({'plain':!![]});return db[_0x7995('0x61')][_0x7995('0x54')]({'where':{'name':'Trunks','userProfileId':_0xfe1105[_0x7995('0x62')]},'raw':!![]})['then'](function(_0x3758f9){if(_0x3758f9&&_0x3758f9[_0x7995('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x54b955[_0x7995('0x38')],'resourceId':_0x54b955['id'],'type':_0x3758f9['name'],'sectionId':_0x3758f9['id']},{})[_0x7995('0x1f')](function(){return _0x87e38d;});}else{return _0x87e38d;}})[_0x7995('0x29')](function(_0x3dd197){logger[_0x7995('0x25')](_0x7995('0x65'),_0x3dd197);throw _0x3dd197;});}return _0x87e38d;})[_0x7995('0x1f')](respondWithResult(_0x4b54f2,0xc9))[_0x7995('0x29')](handleError(_0x4b54f2,null));};exports[_0x7995('0x34')]=function(_0x29e0ee,_0x117317,_0x1ab590){var _0x16108c;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x29e0ee[_0x7995('0x53')]['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0x117317,null))[_0x7995('0x1f')](saveUpdates(_0x29e0ee[_0x7995('0x5c')],null))[_0x7995('0x1f')](function(_0xa2fc8e){if(_0xa2fc8e){_0x16108c=_0xa2fc8e;return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});}})[_0x7995('0x1f')](function(_0x280fbb){if(_0x280fbb){var _0x260ef1=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/trunk.ejs'),_0x7995('0x6b'));var _0x10f4ca=fs['readFileSync'](path['join'](config[_0x7995('0x69')],_0x7995('0x6c')),_0x7995('0x6b'));var _0x38acda=ejs[_0x7995('0x6d')](_0x260ef1,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_trunks.conf',_0x38acda);var _0x2f8a2d=ejs[_0x7995('0x6d')](_0x10f4ca,{'trunks':_0x280fbb||[]});fs[_0x7995('0x6e')](_0x7995('0x71'),_0x2f8a2d);return respondWithRpcPromise(_0x7995('0x72'),_0x7995('0x34'),{'module':_0x7995('0x73')});}return null;})[_0x7995('0x1f')](function(_0x560095){if(_0x560095){return _0x16108c;}})[_0x7995('0x1f')](respondWithResult(_0x117317,null))[_0x7995('0x29')](handleError(_0x117317,null));};exports['destroy']=function(_0x479271,_0xd24c64,_0xf8c2ed){var _0x18e1a2;return db[_0x7995('0x3b')][_0x7995('0x54')]({'where':{'id':_0x479271['params']['id']}})[_0x7995('0x1f')](handleEntityNotFound(_0xd24c64,null))[_0x7995('0x1f')](removeEntity(_0xd24c64,null))['then'](function(){return db[_0x7995('0x3b')][_0x7995('0x66')]({'raw':!![]});})['then'](function(_0x1535a3){var _0x4a5bc5=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],_0x7995('0x6a')),_0x7995('0x6b'));var _0x5d16da=fs[_0x7995('0x67')](path[_0x7995('0x68')](config[_0x7995('0x69')],'server/files/templates/registry.ejs'),_0x7995('0x6b'));var _0x3f3434=ejs[_0x7995('0x6d')](_0x4a5bc5,{'trunks':_0x1535a3});var _0x308a26=ejs['render'](_0x5d16da,{'trunks':_0x1535a3});fs[_0x7995('0x6e')](_0x7995('0x6f'),_0x3f3434);fs[_0x7995('0x6e')]('/etc/asterisk/sip_xcally_registers.conf',_0x308a26);return respondWithRpcPromise('Reload',_0x7995('0x35'),{'module':_0x7995('0x73')});})['catch'](handleError(_0xd24c64,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 2cacc47..d44d5a1 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 _0xa0e3=['tools_trunks','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./trunk.attributes','define','Trunk'];(function(_0x6f3957,_0x5cf071){var _0x20e1d5=function(_0x15a1f8){while(--_0x15a1f8){_0x6f3957['push'](_0x6f3957['shift']());}};_0x20e1d5(++_0x5cf071);}(_0xa0e3,0xbc));var _0x3a0e=function(_0x5a6e2e,_0x32d439){_0x5a6e2e=_0x5a6e2e-0x0;var _0x2221c1=_0xa0e3[_0x5a6e2e];return _0x2221c1;};'use strict';var _=require(_0x3a0e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3a0e('0x1'));var moment=require(_0x3a0e('0x2'));var BPromise=require(_0x3a0e('0x3'));var rp=require(_0x3a0e('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3a0e('0x5'));var config=require(_0x3a0e('0x6'));var attributes=require(_0x3a0e('0x7'));module['exports']=function(_0x122a80,_0x59deb4){return _0x122a80[_0x3a0e('0x8')](_0x3a0e('0x9'),attributes,{'tableName':_0x3a0e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6313=['define','tools_trunks','lodash','util','../../config/logger','moment','../../config/environment','exports'];(function(_0x1c4a44,_0x15abd4){var _0x2009f5=function(_0x1ceced){while(--_0x1ceced){_0x1c4a44['push'](_0x1c4a44['shift']());}};_0x2009f5(++_0x15abd4);}(_0x6313,0x1ea));var _0x3631=function(_0x187ee1,_0x486fdd){_0x187ee1=_0x187ee1-0x0;var _0x174752=_0x6313[_0x187ee1];return _0x174752;};'use strict';var _=require(_0x3631('0x0'));var util=require(_0x3631('0x1'));var logger=require(_0x3631('0x2'))('api');var moment=require(_0x3631('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3631('0x4'));var attributes=require('./trunk.attributes');module[_0x3631('0x5')]=function(_0x19a6a9,_0x3d2bad){return _0x19a6a9[_0x3631('0x6')]('Trunk',attributes,{'tableName':_0x3631('0x7'),'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 2646cd1..283c93c 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 _0x1a75=['then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTrunk','Trunk','options','raw','attributes','limit','include','map','model','stringify','ShowTrunk','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1a75,0xa3));var _0x51a7=function(_0x54788d,_0x12e4ad){_0x54788d=_0x54788d-0x0;var _0x4acd4e=_0x1a75[_0x54788d];return _0x4acd4e;};'use strict';var _=require(_0x51a7('0x0'));var util=require('util');var moment=require(_0x51a7('0x1'));var BPromise=require(_0x51a7('0x2'));var rs=require(_0x51a7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x51a7('0x4'))['db'];var utils=require(_0x51a7('0x5'));var logger=require(_0x51a7('0x6'))(_0x51a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x51a7('0x8'));var client=jayson[_0x51a7('0x9')][_0x51a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6a01,_0x2eacdc,_0x43590c){return new BPromise(function(_0x3e1aa3,_0xb73d3e){return client[_0x51a7('0xb')](_0x4a6a01,_0x43590c)[_0x51a7('0xc')](function(_0x5660cf){logger[_0x51a7('0xd')](_0x51a7('0xe'),_0x2eacdc,_0x51a7('0xf'));logger[_0x51a7('0x10')](_0x51a7('0x11'),_0x2eacdc,_0x51a7('0xf'),JSON['stringify'](_0x5660cf));if(_0x5660cf[_0x51a7('0x12')]){if(_0x5660cf[_0x51a7('0x12')][_0x51a7('0x13')]===0x1f4){logger['error'](_0x51a7('0xe'),_0x2eacdc,_0x5660cf[_0x51a7('0x12')][_0x51a7('0x14')]);return _0xb73d3e(_0x5660cf['error']['message']);}logger[_0x51a7('0x12')](_0x51a7('0xe'),_0x2eacdc,_0x5660cf['error'][_0x51a7('0x14')]);return _0x3e1aa3(_0x5660cf[_0x51a7('0x12')][_0x51a7('0x14')]);}else{logger[_0x51a7('0xd')](_0x51a7('0xe'),_0x2eacdc,_0x51a7('0xf'));_0x3e1aa3(_0x5660cf[_0x51a7('0x15')][_0x51a7('0x14')]);}})[_0x51a7('0x16')](function(_0x289485){logger[_0x51a7('0x12')](_0x51a7('0xe'),_0x2eacdc,_0x289485);_0xb73d3e(_0x289485);});});}exports[_0x51a7('0x17')]=function(_0x5a9bcb){var _0x372f23=this;return new Promise(function(_0x542892,_0x4ae048){return db[_0x51a7('0x18')]['findAll']({'raw':_0x5a9bcb['options']?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x5a9bcb['options']?_0x5a9bcb[_0x51a7('0x19')]['where']||null:null,'attributes':_0x5a9bcb[_0x51a7('0x19')]?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1b')]||null:null,'limit':_0x5a9bcb[_0x51a7('0x19')]?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1c')]||null:null,'include':_0x5a9bcb[_0x51a7('0x19')]?_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0x5a9bcb[_0x51a7('0x19')][_0x51a7('0x1d')],function(_0x1d6b1c){return{'model':db[_0x1d6b1c['model']],'as':_0x1d6b1c['as'],'attributes':_0x1d6b1c['attributes'],'include':_0x1d6b1c[_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0x1d6b1c[_0x51a7('0x1d')],function(_0x511471){return{'model':db[_0x511471['model']],'as':_0x511471['as'],'attributes':_0x511471[_0x51a7('0x1b')],'include':_0x511471[_0x51a7('0x1d')]?_['map'](_0x511471[_0x51a7('0x1d')],function(_0x1ec87a){return{'model':db[_0x1ec87a[_0x51a7('0x1f')]],'as':_0x1ec87a['as'],'attributes':_0x1ec87a[_0x51a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x51a7('0xc')](function(_0xfc7784){logger[_0x51a7('0xd')](_0x51a7('0x17'),_0x5a9bcb);logger[_0x51a7('0x10')]('GetTrunk',_0x5a9bcb,JSON[_0x51a7('0x20')](_0xfc7784));_0x542892(_0xfc7784);})['catch'](function(_0x27224c){logger[_0x51a7('0x12')](_0x51a7('0x17'),_0x27224c['message'],_0x5a9bcb);_0x4ae048(_0x372f23[_0x51a7('0x12')](0x1f4,_0x27224c['message']));});});};exports[_0x51a7('0x21')]=function(_0x38b9be){var _0x4ada0b=this;return new Promise(function(_0x4c4ba7,_0x2af8b1){return db[_0x51a7('0x18')]['find']({'raw':_0x38b9be[_0x51a7('0x19')]?_0x38b9be['options'][_0x51a7('0x1a')]===undefined?!![]:![]:!![],'where':_0x38b9be[_0x51a7('0x19')]?_0x38b9be[_0x51a7('0x19')][_0x51a7('0x22')]||null:null,'attributes':_0x38b9be[_0x51a7('0x19')]?_0x38b9be[_0x51a7('0x19')][_0x51a7('0x1b')]||null:null,'include':_0x38b9be['options']?_0x38b9be['options']['include']?_['map'](_0x38b9be[_0x51a7('0x19')][_0x51a7('0x1d')],function(_0xf0c5f){return{'model':db[_0xf0c5f[_0x51a7('0x1f')]],'as':_0xf0c5f['as'],'attributes':_0xf0c5f[_0x51a7('0x1b')],'include':_0xf0c5f[_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0xf0c5f[_0x51a7('0x1d')],function(_0x4dd2e7){return{'model':db[_0x4dd2e7[_0x51a7('0x1f')]],'as':_0x4dd2e7['as'],'attributes':_0x4dd2e7[_0x51a7('0x1b')],'include':_0x4dd2e7[_0x51a7('0x1d')]?_[_0x51a7('0x1e')](_0x4dd2e7['include'],function(_0x2d0718){return{'model':db[_0x2d0718[_0x51a7('0x1f')]],'as':_0x2d0718['as'],'attributes':_0x2d0718[_0x51a7('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x51a7('0xc')](function(_0x3047cd){logger[_0x51a7('0xd')]('ShowTrunk',_0x38b9be);logger[_0x51a7('0x10')](_0x51a7('0x21'),_0x38b9be,JSON[_0x51a7('0x20')](_0x3047cd));_0x4c4ba7(_0x3047cd);})[_0x51a7('0x16')](function(_0x2fb77f){logger[_0x51a7('0x12')]('ShowTrunk',_0x2fb77f['message'],_0x38b9be);_0x2af8b1(_0x4ada0b['error'](0x1f4,_0x2fb77f[_0x51a7('0x14')]));});});}; \ No newline at end of file +var _0xbd2a=['jayson/promise','client','http','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','catch','GetTrunk','Trunk','findAll','options','raw','attributes','limit','map','include','model','ShowTrunk','find','where','util','moment','randomstring','ioredis','../../config/logger','rpc'];(function(_0x5b13ad,_0x3e165b){var _0x456b73=function(_0x59f245){while(--_0x59f245){_0x5b13ad['push'](_0x5b13ad['shift']());}};_0x456b73(++_0x3e165b);}(_0xbd2a,0x7e));var _0xabd2=function(_0xcc78ca,_0xe838f9){_0xcc78ca=_0xcc78ca-0x0;var _0x448e8a=_0xbd2a[_0xcc78ca];return _0x448e8a;};'use strict';var _=require('lodash');var util=require(_0xabd2('0x0'));var moment=require(_0xabd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xabd2('0x2'));var fs=require('fs');var Redis=require(_0xabd2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xabd2('0x4'))(_0xabd2('0x5'));var config=require('../../config/environment');var jayson=require(_0xabd2('0x6'));var client=jayson[_0xabd2('0x7')][_0xabd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x106a7f,_0x23bb18,_0x2130e4){return new BPromise(function(_0x455d0f,_0x3b998a){return client['request'](_0x106a7f,_0x2130e4)[_0xabd2('0x9')](function(_0x14e22c){logger[_0xabd2('0xa')]('Trunk,\x20%s,\x20%s',_0x23bb18,_0xabd2('0xb'));logger[_0xabd2('0xc')](_0xabd2('0xd'),_0x23bb18,_0xabd2('0xb'),JSON[_0xabd2('0xe')](_0x14e22c));if(_0x14e22c[_0xabd2('0xf')]){if(_0x14e22c[_0xabd2('0xf')][_0xabd2('0x10')]===0x1f4){logger[_0xabd2('0xf')](_0xabd2('0x11'),_0x23bb18,_0x14e22c[_0xabd2('0xf')][_0xabd2('0x12')]);return _0x3b998a(_0x14e22c['error'][_0xabd2('0x12')]);}logger[_0xabd2('0xf')](_0xabd2('0x11'),_0x23bb18,_0x14e22c[_0xabd2('0xf')][_0xabd2('0x12')]);return _0x455d0f(_0x14e22c[_0xabd2('0xf')][_0xabd2('0x12')]);}else{logger[_0xabd2('0xa')](_0xabd2('0x11'),_0x23bb18,_0xabd2('0xb'));_0x455d0f(_0x14e22c['result'][_0xabd2('0x12')]);}})[_0xabd2('0x13')](function(_0x1a1239){logger[_0xabd2('0xf')](_0xabd2('0x11'),_0x23bb18,_0x1a1239);_0x3b998a(_0x1a1239);});});}exports[_0xabd2('0x14')]=function(_0x3dc7cb){var _0x3e3bee=this;return new Promise(function(_0x5d3ff4,_0x444a28){return db[_0xabd2('0x15')][_0xabd2('0x16')]({'raw':_0x3dc7cb[_0xabd2('0x17')]?_0x3dc7cb[_0xabd2('0x17')][_0xabd2('0x18')]===undefined?!![]:![]:!![],'where':_0x3dc7cb[_0xabd2('0x17')]?_0x3dc7cb['options']['where']||null:null,'attributes':_0x3dc7cb[_0xabd2('0x17')]?_0x3dc7cb['options'][_0xabd2('0x19')]||null:null,'limit':_0x3dc7cb[_0xabd2('0x17')]?_0x3dc7cb[_0xabd2('0x17')][_0xabd2('0x1a')]||null:null,'include':_0x3dc7cb['options']?_0x3dc7cb[_0xabd2('0x17')]['include']?_[_0xabd2('0x1b')](_0x3dc7cb[_0xabd2('0x17')][_0xabd2('0x1c')],function(_0x3ac4ff){return{'model':db[_0x3ac4ff['model']],'as':_0x3ac4ff['as'],'attributes':_0x3ac4ff[_0xabd2('0x19')],'include':_0x3ac4ff[_0xabd2('0x1c')]?_[_0xabd2('0x1b')](_0x3ac4ff[_0xabd2('0x1c')],function(_0x500332){return{'model':db[_0x500332['model']],'as':_0x500332['as'],'attributes':_0x500332['attributes'],'include':_0x500332[_0xabd2('0x1c')]?_['map'](_0x500332['include'],function(_0x5f4b09){return{'model':db[_0x5f4b09[_0xabd2('0x1d')]],'as':_0x5f4b09['as'],'attributes':_0x5f4b09['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x579253){logger[_0xabd2('0xa')](_0xabd2('0x14'),_0x3dc7cb);logger[_0xabd2('0xc')](_0xabd2('0x14'),_0x3dc7cb,JSON[_0xabd2('0xe')](_0x579253));_0x5d3ff4(_0x579253);})[_0xabd2('0x13')](function(_0x458f0a){logger[_0xabd2('0xf')](_0xabd2('0x14'),_0x458f0a[_0xabd2('0x12')],_0x3dc7cb);_0x444a28(_0x3e3bee[_0xabd2('0xf')](0x1f4,_0x458f0a[_0xabd2('0x12')]));});});};exports[_0xabd2('0x1e')]=function(_0x102cf6){var _0x483942=this;return new Promise(function(_0xc7a99f,_0x4095ee){return db['Trunk'][_0xabd2('0x1f')]({'raw':_0x102cf6[_0xabd2('0x17')]?_0x102cf6[_0xabd2('0x17')][_0xabd2('0x18')]===undefined?!![]:![]:!![],'where':_0x102cf6[_0xabd2('0x17')]?_0x102cf6['options'][_0xabd2('0x20')]||null:null,'attributes':_0x102cf6[_0xabd2('0x17')]?_0x102cf6[_0xabd2('0x17')][_0xabd2('0x19')]||null:null,'include':_0x102cf6[_0xabd2('0x17')]?_0x102cf6[_0xabd2('0x17')]['include']?_[_0xabd2('0x1b')](_0x102cf6[_0xabd2('0x17')][_0xabd2('0x1c')],function(_0x114e4a){return{'model':db[_0x114e4a[_0xabd2('0x1d')]],'as':_0x114e4a['as'],'attributes':_0x114e4a[_0xabd2('0x19')],'include':_0x114e4a[_0xabd2('0x1c')]?_['map'](_0x114e4a[_0xabd2('0x1c')],function(_0x4bef9e){return{'model':db[_0x4bef9e['model']],'as':_0x4bef9e['as'],'attributes':_0x4bef9e[_0xabd2('0x19')],'include':_0x4bef9e[_0xabd2('0x1c')]?_[_0xabd2('0x1b')](_0x4bef9e[_0xabd2('0x1c')],function(_0x2d7424){return{'model':db[_0x2d7424['model']],'as':_0x2d7424['as'],'attributes':_0x2d7424['attributes']};}):[]};}):[]};}):[]:[]})[_0xabd2('0x9')](function(_0xf94792){logger[_0xabd2('0xa')](_0xabd2('0x1e'),_0x102cf6);logger['debug']('ShowTrunk',_0x102cf6,JSON['stringify'](_0xf94792));_0xc7a99f(_0xf94792);})[_0xabd2('0x13')](function(_0xe542c4){logger[_0xabd2('0xf')]('ShowTrunk',_0xe542c4[_0xabd2('0x12')],_0x102cf6);_0x4095ee(_0x483942[_0xabd2('0xf')](0x1f4,_0xe542c4[_0xabd2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e3d8a65..5b74c92 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 _0xc662=['express','Router','./user-setting.controller','/:id','isAuthenticated','update','exports'];(function(_0x140849,_0x108e56){var _0x2e50a8=function(_0x3ef503){while(--_0x3ef503){_0x140849['push'](_0x140849['shift']());}};_0x2e50a8(++_0x108e56);}(_0xc662,0x1c0));var _0x2c66=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xc662[_0x1ddedd];return _0xa3e1ac;};'use strict';var express=require(_0x2c66('0x0'));var router=express[_0x2c66('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x2c66('0x2'));router['put'](_0x2c66('0x3'),auth[_0x2c66('0x4')](),controller[_0x2c66('0x5')]);module[_0x2c66('0x6')]=router; \ No newline at end of file +var _0x6111=['../../components/auth/service','/:id','isAuthenticated','express','Router'];(function(_0xb7cb72,_0x19d391){var _0x4b7570=function(_0x5a4a93){while(--_0x5a4a93){_0xb7cb72['push'](_0xb7cb72['shift']());}};_0x4b7570(++_0x19d391);}(_0x6111,0x12a));var _0x1611=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6111[_0x17d9e3];return _0x14192d;};'use strict';var express=require(_0x1611('0x0'));var router=express[_0x1611('0x1')]();var auth=require(_0x1611('0x2'));var controller=require('./user-setting.controller');router['put'](_0x1611('0x3'),auth[_0x1611('0x4')](),controller['update']);module['exports']=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 a659536..41cdca4 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 _0x1178=['sequelize','info','debug','exports','ENUM','error','BOOLEAN','DATE','INTEGER','UserId'];(function(_0x5490b4,_0x3a4ffd){var _0x3e8e46=function(_0x2efdee){while(--_0x2efdee){_0x5490b4['push'](_0x5490b4['shift']());}};_0x3e8e46(++_0x3a4ffd);}(_0x1178,0xf0));var _0x8117=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1178[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x8117('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x8117('0x1'),_0x8117('0x2')];module[_0x8117('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0x8117('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8117('0x5'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8117('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8117('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8117('0x8')],'unique':_0x8117('0x9')}}; \ No newline at end of file +var _0x329b=['INTEGER','UserId','sequelize','error','warning','info','debug','ENUM','TEXT','DATE'];(function(_0x4a2a8b,_0x40f374){var _0x4a7583=function(_0x1edc8e){while(--_0x1edc8e){_0x4a2a8b['push'](_0x4a2a8b['shift']());}};_0x4a7583(++_0x40f374);}(_0x329b,0x1ba));var _0xb329=function(_0x206338,_0x2d800b){_0x206338=_0x206338-0x0;var _0x2b87f2=_0x329b[_0x206338];return _0x2b87f2;};'use strict';var Sequelize=require(_0xb329('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xb329('0x1'),_0xb329('0x2'),_0xb329('0x3'),_0xb329('0x4')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb329('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb329('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb329('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb329('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb329('0x8')],'unique':_0xb329('0x9')}}; \ 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 8be50c5..ed5370f 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 _0xd82a=['update','then','sendStatus','error','name','status','user','role','admin','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','redis','./user-setting.socket','register','defaults','localhost','json'];(function(_0x43432a,_0x4d1703){var _0x4d50a5=function(_0x33aa47){while(--_0x33aa47){_0x43432a['push'](_0x43432a['shift']());}};_0x4d50a5(++_0x4d1703);}(_0xd82a,0xbd));var _0xad82=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0xd82a[_0x2d34d6];return _0x1d3d12;};'use strict';var _=require(_0xad82('0x0'));var Redis=require(_0xad82('0x1'));var logger=require(_0xad82('0x2'))(_0xad82('0x3'));var config=require('../../config/environment');var db=require(_0xad82('0x4'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0xad82('0x5')]));require(_0xad82('0x6'))[_0xad82('0x7')](socket);config[_0xad82('0x5')]=_[_0xad82('0x8')](config[_0xad82('0x5')],{'host':_0xad82('0x9'),'port':0x18eb});function respondWithResult(_0x45b835,_0x3cd50f){_0x3cd50f=_0x3cd50f||0xc8;return function(_0x2d37c8){if(_0x2d37c8){return _0x45b835['status'](_0x3cd50f)[_0xad82('0xa')](_0x2d37c8);}};}function saveUpdates(_0x1c55bb){return function(_0x1d0720){if(_0x1d0720){return _0x1d0720[_0xad82('0xb')](_0x1c55bb)[_0xad82('0xc')](function(_0x3dcbdd){return _0x3dcbdd;});}return null;};}function handleEntityNotFound(_0x3d4823){return function(_0x1d5b0d){if(!_0x1d5b0d){_0x3d4823[_0xad82('0xd')](0x194);}return _0x1d5b0d;};}function handleError(_0x1e3aa4,_0x1650b4){_0x1650b4=_0x1650b4||0x1f4;return function(_0x2f8efb){logger[_0xad82('0xe')](_0x2f8efb['stack']);if(_0x2f8efb[_0xad82('0xf')]){delete _0x2f8efb['name'];}_0x1e3aa4[_0xad82('0x10')](_0x1650b4)['send'](_0x2f8efb);};}exports[_0xad82('0xb')]=function(_0xd8239d,_0xaaf129){if(_0xd8239d[_0xad82('0x11')][_0xad82('0x12')]!==_0xad82('0x13'))throw new Error('Unauthorized');if(isNaN(Number(_0xd8239d[_0xad82('0x14')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0xad82('0x15')][_0xad82('0x16')]({'where':{'id':_0xd8239d[_0xad82('0x14')]['id']}})[_0xad82('0xc')](handleEntityNotFound(_0xaaf129,null))[_0xad82('0xc')](saveUpdates(_0xd8239d[_0xad82('0x17')],null))[_0xad82('0xc')](respondWithResult(_0xaaf129,null))[_0xad82('0x18')](handleError(_0xaaf129,null));}; \ No newline at end of file +var _0xe8f7=['../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','defaults','status','json','then','sendStatus','error','stack','name','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','body','catch','lodash'];(function(_0x2c24df,_0x2e46a3){var _0x309b15=function(_0x5d525b){while(--_0x5d525b){_0x2c24df['push'](_0x2c24df['shift']());}};_0x309b15(++_0x2e46a3);}(_0xe8f7,0x137));var _0x7e8f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe8f7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7e8f('0x0'));var Redis=require('ioredis');var logger=require(_0x7e8f('0x1'))(_0x7e8f('0x2'));var config=require(_0x7e8f('0x3'));var db=require(_0x7e8f('0x4'))['db'];var socket=require(_0x7e8f('0x5'))(new Redis(config[_0x7e8f('0x6')]));require(_0x7e8f('0x7'))['register'](socket);config['redis']=_[_0x7e8f('0x8')](config[_0x7e8f('0x6')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x3524f2,_0x337175){_0x337175=_0x337175||0xc8;return function(_0x8e9115){if(_0x8e9115){return _0x3524f2[_0x7e8f('0x9')](_0x337175)[_0x7e8f('0xa')](_0x8e9115);}};}function saveUpdates(_0x3ab557){return function(_0x23ed0b){if(_0x23ed0b){return _0x23ed0b['update'](_0x3ab557)[_0x7e8f('0xb')](function(_0x43e13c){return _0x43e13c;});}return null;};}function handleEntityNotFound(_0x47bbe2){return function(_0x61b3d1){if(!_0x61b3d1){_0x47bbe2[_0x7e8f('0xc')](0x194);}return _0x61b3d1;};}function handleError(_0x2569bd,_0xa8760){_0xa8760=_0xa8760||0x1f4;return function(_0x5da526){logger[_0x7e8f('0xd')](_0x5da526[_0x7e8f('0xe')]);if(_0x5da526['name']){delete _0x5da526[_0x7e8f('0xf')];}_0x2569bd[_0x7e8f('0x9')](_0xa8760)['send'](_0x5da526);};}exports['update']=function(_0x72bf8f,_0x27287f){if(_0x72bf8f[_0x7e8f('0x10')][_0x7e8f('0x11')]!==_0x7e8f('0x12'))throw new Error(_0x7e8f('0x13'));if(isNaN(Number(_0x72bf8f[_0x7e8f('0x14')]['id'])))throw new Error(_0x7e8f('0x15'));return db[_0x7e8f('0x16')][_0x7e8f('0x17')]({'where':{'id':_0x72bf8f[_0x7e8f('0x14')]['id']}})[_0x7e8f('0xb')](handleEntityNotFound(_0x27287f,null))[_0x7e8f('0xb')](saveUpdates(_0x72bf8f[_0x7e8f('0x18')],null))[_0x7e8f('0xb')](respondWithResult(_0x27287f,null))[_0x7e8f('0x19')](handleError(_0x27287f,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 482f6bd..cdf45c8 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 _0x3f00=['emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x571cfb,_0x177d42){var _0x19111f=function(_0x4ba9cb){while(--_0x4ba9cb){_0x571cfb['push'](_0x571cfb['shift']());}};_0x19111f(++_0x177d42);}(_0x3f00,0x6a));var _0x03f0=function(_0x45494,_0x1040a5){_0x45494=_0x45494-0x0;var _0x2ee547=_0x3f00[_0x45494];return _0x2ee547;};'use strict';var EventEmitter=require(_0x03f0('0x0'));var UserSetting=require(_0x03f0('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x03f0('0x2')](0x0);var events={'afterCreate':_0x03f0('0x3'),'afterUpdate':_0x03f0('0x4'),'afterDestroy':_0x03f0('0x5')};function emitEvent(_0x406934){return function(_0x3a0ede,_0x19ec2e,_0x31342f){UserSettingEvents['emit'](_0x406934+':'+_0x3a0ede['id'],_0x3a0ede);UserSettingEvents[_0x03f0('0x6')](_0x406934,_0x3a0ede);_0x31342f(null);};}for(var e in events){if(events[_0x03f0('0x7')](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x6a7e=['../../mysqldb','UserSetting','setMaxListeners','save','update','remove','emit','hook','exports'];(function(_0x3d65a4,_0x132874){var _0x33a40f=function(_0x59d1b2){while(--_0x59d1b2){_0x3d65a4['push'](_0x3d65a4['shift']());}};_0x33a40f(++_0x132874);}(_0x6a7e,0x1b0));var _0xe6a7=function(_0x31a887,_0x1f8c84){_0x31a887=_0x31a887-0x0;var _0xcb6552=_0x6a7e[_0x31a887];return _0xcb6552;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xe6a7('0x0'))['db'][_0xe6a7('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe6a7('0x2')](0x0);var events={'afterCreate':_0xe6a7('0x3'),'afterUpdate':_0xe6a7('0x4'),'afterDestroy':_0xe6a7('0x5')};function emitEvent(_0xb58f7f){return function(_0x1b0756,_0x3ce8e8,_0x5c5e7b){UserSettingEvents[_0xe6a7('0x6')](_0xb58f7f+':'+_0x1b0756['id'],_0x1b0756);UserSettingEvents[_0xe6a7('0x6')](_0xb58f7f,_0x1b0756);_0x5c5e7b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe6a7('0x7')](e,emitEvent(event));}}module[_0xe6a7('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 1de86a0..a78b9a0 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 _0xd87e=['exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes'];(function(_0x540479,_0x340e8e){var _0x532937=function(_0x5e6a3e){while(--_0x5e6a3e){_0x540479['push'](_0x540479['shift']());}};_0x532937(++_0x340e8e);}(_0xd87e,0x1bf));var _0xed87=function(_0x47f8d2,_0x259040){_0x47f8d2=_0x47f8d2-0x0;var _0x5b31bb=_0xd87e[_0x47f8d2];return _0x5b31bb;};'use strict';var attributes=require(_0xed87('0x0'));module[_0xed87('0x1')]=function(_0x4a7ab7){return _0x4a7ab7[_0xed87('0x2')](_0xed87('0x3'),attributes,{'tableName':_0xed87('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5901be){if(!_0x5901be[_0xed87('0x5')])_0x5901be['clientSideLoggingEnabledSince']=null;else if(_0x5901be[_0xed87('0x6')]===null)_0x5901be[_0xed87('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x867f=['./user-setting.attributes','exports','UserSetting','user_settings','clientSideLoggingEnabledSince'];(function(_0x32d879,_0x1b9f21){var _0xf8af81=function(_0x2a461b){while(--_0x2a461b){_0x32d879['push'](_0x32d879['shift']());}};_0xf8af81(++_0x1b9f21);}(_0x867f,0xdc));var _0xf867=function(_0x48d933,_0x4eaabe){_0x48d933=_0x48d933-0x0;var _0x4caf07=_0x867f[_0x48d933];return _0x4caf07;};'use strict';var attributes=require(_0xf867('0x0'));module[_0xf867('0x1')]=function(_0x41e5e6){return _0x41e5e6['define'](_0xf867('0x2'),attributes,{'tableName':_0xf867('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x25d64a){if(!_0x25d64a['clientSideLoggingEnabled'])_0x25d64a[_0xf867('0x4')]=null;else if(_0x25d64a['clientSideLoggingEnabledSince']===null)_0x25d64a[_0xf867('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 d08d06b..a352297 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 _0x5043=['length','user-setting:','./user-setting.events','save','remove','update','emit','user-setting:update:user-'];(function(_0x5a7481,_0x224a1e){var _0x12d0bb=function(_0x3b597a){while(--_0x3b597a){_0x5a7481['push'](_0x5a7481['shift']());}};_0x12d0bb(++_0x224a1e);}(_0x5043,0x152));var _0x3504=function(_0x1ee1b7,_0x5ee1b4){_0x1ee1b7=_0x1ee1b7-0x0;var _0x564761=_0x5043[_0x1ee1b7];return _0x564761;};'use strict';var UserSettingEvents=require(_0x3504('0x0'));var events=[_0x3504('0x1'),_0x3504('0x2'),_0x3504('0x3')];function createListener(_0x589b02,_0x2a5155){return function(_0xd4a32a){_0x2a5155[_0x3504('0x4')](_0x589b02,_0xd4a32a);if(_0x589b02==='user-setting:update'){_0x2a5155[_0x3504('0x4')](_0x3504('0x5')+_0xd4a32a['UserId'],_0xd4a32a);}};}exports['register']=function(_0x2d6d13){for(var _0x1f4080=0x0,_0x21f91f=events[_0x3504('0x6')];_0x1f4080<_0x21f91f;_0x1f4080++){var _0x4a25fc=events[_0x1f4080];var _0x185899=createListener(_0x3504('0x7')+_0x4a25fc,_0x2d6d13);UserSettingEvents['on'](_0x4a25fc,_0x185899);}}; \ No newline at end of file +var _0x8f6e=['user-setting:','update','user-setting:update:user-','UserId','register','length'];(function(_0x377fd8,_0x11062d){var _0x451606=function(_0x25e2e9){while(--_0x25e2e9){_0x377fd8['push'](_0x377fd8['shift']());}};_0x451606(++_0x11062d);}(_0x8f6e,0x1f3));var _0xe8f6=function(_0x16cb03,_0x43ea58){_0x16cb03=_0x16cb03-0x0;var _0x10944e=_0x8f6e[_0x16cb03];return _0x10944e;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=['save','remove',_0xe8f6('0x0')];function createListener(_0xeb79c9,_0x2fbfbc){return function(_0x373162){_0x2fbfbc['emit'](_0xeb79c9,_0x373162);if(_0xeb79c9==='user-setting:update'){_0x2fbfbc['emit'](_0xe8f6('0x1')+_0x373162[_0xe8f6('0x2')],_0x373162);}};}exports[_0xe8f6('0x3')]=function(_0x10bcaa){for(var _0x46ed3c=0x0,_0x13c305=events[_0xe8f6('0x4')];_0x46ed3c<_0x13c305;_0x46ed3c++){var _0x399523=events[_0x46ed3c];var _0x2ab103=createListener(_0xe8f6('0x5')+_0x399523,_0x10bcaa);UserSettingEvents['on'](_0x399523,_0x2ab103);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index ab72c8e..3b5ddcf 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 _0xa3da=['getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','getApiKey','post','/:id/contacts','addContacts','/create_many','join','format','%s-%s','now','single','file','addAvatar','/:id/logout','/:id/pause','pause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addOpenchannelAccounts','/:id/sms_accounts','addSmsAccounts','addChatWebsites','addWhatsappAccounts','createApiKey','update','put','/:id/password','changePassword','delete','removeQueues','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/messengerSoundNotification','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./user.controller','get','isAuthenticated','/describe','describe','/whoami','whoami','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','/:id/screen_recordings','getScreenRecordings','getChatInteractions','/:id/openchannel/interactions'];(function(_0x4cf205,_0xb79c74){var _0x2c3942=function(_0x355b39){while(--_0x355b39){_0x4cf205['push'](_0x4cf205['shift']());}};_0x2c3942(++_0xb79c74);}(_0xa3da,0xb4));var _0xaa3d=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa3da[_0xa1e3e3];return _0xc980e9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xaa3d('0x0'));var timeout=require(_0xaa3d('0x1'));var express=require(_0xaa3d('0x2'));var router=express[_0xaa3d('0x3')]();var fs_extra=require(_0xaa3d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaa3d('0x5'));var config=require('../../config/environment');var controller=require(_0xaa3d('0x6'));router[_0xaa3d('0x7')]('/',auth[_0xaa3d('0x8')](),controller['index']);router['get'](_0xaa3d('0x9'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0xa')]);router[_0xaa3d('0x7')](_0xaa3d('0xb'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0xc')]);router[_0xaa3d('0x7')]('/presence',auth[_0xaa3d('0x8')](),controller['getPresence']);router[_0xaa3d('0x7')](_0xaa3d('0xd'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0xe')]);router[_0xaa3d('0x7')]('/:id/avatar',controller[_0xaa3d('0xf')]);router[_0xaa3d('0x7')](_0xaa3d('0x10'),auth['isAuthenticated'](),controller[_0xaa3d('0x11')]);router[_0xaa3d('0x7')]('/:id/contacts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x12')]);router[_0xaa3d('0x7')](_0xaa3d('0x13'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x14')]);router[_0xaa3d('0x7')](_0xaa3d('0x15'),auth['isAuthenticated'](),controller[_0xaa3d('0x16')]);router[_0xaa3d('0x7')](_0xaa3d('0x17'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x18')]);router[_0xaa3d('0x7')](_0xaa3d('0x19'),auth['isAuthenticated'](),controller['getRecordings']);router['get'](_0xaa3d('0x1a'),auth['isAuthenticated'](),controller[_0xaa3d('0x1b')]);router['get']('/:id/chat/interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x1c')]);router[_0xaa3d('0x7')](_0xaa3d('0x1d'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x1e')]);router[_0xaa3d('0x7')](_0xaa3d('0x1f'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x20')]);router['get']('/:id/sms/interactions',auth['isAuthenticated'](),controller[_0xaa3d('0x21')]);router['get'](_0xaa3d('0x22'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x23')]);router[_0xaa3d('0x7')](_0xaa3d('0x24'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x25')]);router[_0xaa3d('0x7')](_0xaa3d('0x26'),auth[_0xaa3d('0x8')](),controller['getTeams']);router[_0xaa3d('0x7')]('/:id/lists',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x27')]);router[_0xaa3d('0x7')](_0xaa3d('0x28'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xaa3d('0x29'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x2a')]);router[_0xaa3d('0x7')](_0xaa3d('0x2b'),auth[_0xaa3d('0x8')](),controller['getFaxAccounts']);router[_0xaa3d('0x7')](_0xaa3d('0x2c'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x2d')]);router['get'](_0xaa3d('0x2e'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x2f')]);router[_0xaa3d('0x7')]('/:id/sms_accounts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x30')]);router[_0xaa3d('0x7')](_0xaa3d('0x31'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x32')]);router['get'](_0xaa3d('0x33'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x34')]);router['get'](_0xaa3d('0x35'),auth[_0xaa3d('0x8')](),controller['getScheduledCalls']);router[_0xaa3d('0x7')](_0xaa3d('0x36'),auth['isAuthenticated'](),controller[_0xaa3d('0x37')]);router[_0xaa3d('0x38')](_0xaa3d('0x39'),auth['isAuthenticated'](),controller[_0xaa3d('0x3a')]);router['post']('/',auth[_0xaa3d('0x8')](),controller['create']);router[_0xaa3d('0x38')](_0xaa3d('0x3b'),auth[_0xaa3d('0x8')](),controller['bulkCreate']);router[_0xaa3d('0x38')](_0xaa3d('0x13'),auth[_0xaa3d('0x8')](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7c83a0,_0x255cd4,_0x4e87df){_0x4e87df(null,path[_0xaa3d('0x3c')](config['root'],'server/files/images/'));},'filename':function(_0x1a7062,_0x183393,_0x320649){_0x320649(null,util[_0xaa3d('0x3d')](_0xaa3d('0x3e'),Date[_0xaa3d('0x3f')](),_0x183393['originalname']));}})});router[_0xaa3d('0x38')]('/:id/avatar',upload[_0xaa3d('0x40')](_0xaa3d('0x41')),controller[_0xaa3d('0x42')]);router[_0xaa3d('0x38')]('/:id/login',auth[_0xaa3d('0x8')](),controller['login']);router['post'](_0xaa3d('0x43'),auth['isAuthenticated'](),controller['logout']);router[_0xaa3d('0x38')](_0xaa3d('0x44'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x45')]);router[_0xaa3d('0x38')]('/:id/unpause',auth['isAuthenticated'](),controller[_0xaa3d('0x46')]);router[_0xaa3d('0x38')](_0xaa3d('0x26'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x47')]);router['post']('/:id/chat_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x48')]);router[_0xaa3d('0x38')](_0xaa3d('0x49'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x4a')]);router[_0xaa3d('0x38')](_0xaa3d('0x4b'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x4c')]);router[_0xaa3d('0x38')](_0xaa3d('0x4d'),auth['isAuthenticated'](),controller['addSmsInteractions']);router[_0xaa3d('0x38')](_0xaa3d('0x4e'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x4f')]);router[_0xaa3d('0x38')]('/:id/whatsapp_interactions',auth[_0xaa3d('0x8')](),controller['addWhatsappInteractions']);router['post'](_0xaa3d('0x2b'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x50')]);router['post'](_0xaa3d('0x2c'),auth[_0xaa3d('0x8')](),controller['addMailAccounts']);router['post'](_0xaa3d('0x2e'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x51')]);router['post'](_0xaa3d('0x52'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x53')]);router[_0xaa3d('0x38')]('/:id/chat_websites',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x54')]);router['post'](_0xaa3d('0x33'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x55')]);router[_0xaa3d('0x38')](_0xaa3d('0x36'),auth['isAuthenticated'](),controller[_0xaa3d('0x56')]);router['put']('/:id',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x57')]);router[_0xaa3d('0x58')](_0xaa3d('0x59'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5a')]);router[_0xaa3d('0x5b')](_0xaa3d('0x13'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5c')]);router[_0xaa3d('0x5b')]('/:id/teams',auth[_0xaa3d('0x8')](),controller['removeTeams']);router[_0xaa3d('0x5b')](_0xaa3d('0xd'),auth[_0xaa3d('0x8')](),controller['destroy']);router[_0xaa3d('0x5b')]('/:id/chat_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5d')]);router[_0xaa3d('0x5b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xaa3d('0x5b')]('/:id/fax_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5e')]);router[_0xaa3d('0x5b')](_0xaa3d('0x4d'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x5f')]);router['delete']('/:id/openchannel_interactions',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x60')]);router[_0xaa3d('0x5b')](_0xaa3d('0x61'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x62')]);router[_0xaa3d('0x5b')]('/:id/fax_accounts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x63')]);router['delete'](_0xaa3d('0x2c'),auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x64')]);router['delete'](_0xaa3d('0x2e'),auth[_0xaa3d('0x8')](),controller['removeOpenchannelAccounts']);router[_0xaa3d('0x5b')](_0xaa3d('0x52'),auth['isAuthenticated'](),controller[_0xaa3d('0x65')]);router[_0xaa3d('0x5b')]('/:id/chat_websites',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x66')]);router[_0xaa3d('0x5b')]('/:id/whatsapp_accounts',auth[_0xaa3d('0x8')](),controller[_0xaa3d('0x67')]);router[_0xaa3d('0x5b')](_0xaa3d('0x36'),auth[_0xaa3d('0x8')](),controller['removeApiKey']);router[_0xaa3d('0x38')](_0xaa3d('0x68'),auth[_0xaa3d('0x8')](),controller['messengerSoundNotification']);module['exports']=router; \ No newline at end of file +var _0xaefa=['removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./user.controller','get','index','/describe','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','/:id/api_key','/:id/contacts','addContacts','post','create','/create_many','/:id/queues','addQueues','diskStorage','join','format','%s-%s','now','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','pause','/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addMailAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','createApiKey','put','update','changePassword','delete','removeQueues','removeTeams','removeChatInteractions','removeMailInteractions','removeFaxInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xaefa,0xf2));var _0xaaef=function(_0x192896,_0x15c5f8){_0x192896=_0x192896-0x0;var _0x450008=_0xaefa[_0x192896];return _0x450008;};'use strict';var multer=require(_0xaaef('0x0'));var util=require(_0xaaef('0x1'));var path=require(_0xaaef('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xaaef('0x3')]();var fs_extra=require(_0xaaef('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xaaef('0x5'));var config=require(_0xaaef('0x6'));var controller=require(_0xaaef('0x7'));router[_0xaaef('0x8')]('/',auth['isAuthenticated'](),controller[_0xaaef('0x9')]);router[_0xaaef('0x8')](_0xaaef('0xa'),auth[_0xaaef('0xb')](),controller[_0xaaef('0xc')]);router[_0xaaef('0x8')](_0xaaef('0xd'),auth[_0xaaef('0xb')](),controller[_0xaaef('0xe')]);router[_0xaaef('0x8')](_0xaaef('0xf'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x10')]);router[_0xaaef('0x8')](_0xaaef('0x11'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x12')]);router['get']('/:id/avatar',controller[_0xaaef('0x13')]);router['get'](_0xaaef('0x14'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x15')]);router['get']('/:id/contacts',auth[_0xaaef('0xb')](),controller[_0xaaef('0x16')]);router[_0xaaef('0x8')]('/:id/queues',auth[_0xaaef('0xb')](),controller[_0xaaef('0x17')]);router[_0xaaef('0x8')](_0xaaef('0x18'),auth['isAuthenticated'](),controller[_0xaaef('0x19')]);router[_0xaaef('0x8')](_0xaaef('0x1a'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x1b')]);router[_0xaaef('0x8')](_0xaaef('0x1c'),auth['isAuthenticated'](),controller[_0xaaef('0x1d')]);router[_0xaaef('0x8')](_0xaaef('0x1e'),auth[_0xaaef('0xb')](),controller['getScreenRecordings']);router[_0xaaef('0x8')]('/:id/chat/interactions',auth[_0xaaef('0xb')](),controller[_0xaaef('0x1f')]);router[_0xaaef('0x8')](_0xaaef('0x20'),auth['isAuthenticated'](),controller[_0xaaef('0x21')]);router['get'](_0xaaef('0x22'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x23')]);router[_0xaaef('0x8')]('/:id/sms/interactions',auth[_0xaaef('0xb')](),controller[_0xaaef('0x24')]);router[_0xaaef('0x8')](_0xaaef('0x25'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x26')]);router[_0xaaef('0x8')](_0xaaef('0x27'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x28')]);router['get']('/:id/teams',auth[_0xaaef('0xb')](),controller[_0xaaef('0x29')]);router[_0xaaef('0x8')](_0xaaef('0x2a'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x2b')]);router[_0xaaef('0x8')](_0xaaef('0x2c'),auth['isAuthenticated'](),controller[_0xaaef('0x2d')]);router[_0xaaef('0x8')](_0xaaef('0x2e'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x2f')]);router['get'](_0xaaef('0x30'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x31')]);router[_0xaaef('0x8')](_0xaaef('0x32'),auth[_0xaaef('0xb')](),controller['getMailAccounts']);router[_0xaaef('0x8')](_0xaaef('0x33'),auth[_0xaaef('0xb')](),controller['getOpenchannelAccounts']);router[_0xaaef('0x8')](_0xaaef('0x34'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x35')]);router[_0xaaef('0x8')]('/:id/chat_websites',auth[_0xaaef('0xb')](),controller[_0xaaef('0x36')]);router['get']('/:id/whatsapp_accounts',auth[_0xaaef('0xb')](),controller[_0xaaef('0x37')]);router[_0xaaef('0x8')](_0xaaef('0x38'),auth[_0xaaef('0xb')](),controller['getScheduledCalls']);router[_0xaaef('0x8')](_0xaaef('0x39'),auth[_0xaaef('0xb')](),controller['getApiKey']);router['post'](_0xaaef('0x3a'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x3b')]);router[_0xaaef('0x3c')]('/',auth[_0xaaef('0xb')](),controller[_0xaaef('0x3d')]);router[_0xaaef('0x3c')](_0xaaef('0x3e'),auth[_0xaaef('0xb')](),controller['bulkCreate']);router[_0xaaef('0x3c')](_0xaaef('0x3f'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x40')]);var upload=multer({'storage':multer[_0xaaef('0x41')]({'destination':function(_0x1164aa,_0x1c49b1,_0x53783a){_0x53783a(null,path[_0xaaef('0x42')](config['root'],'server/files/images/'));},'filename':function(_0x1c652f,_0x798809,_0x2c1816){_0x2c1816(null,util[_0xaaef('0x43')](_0xaaef('0x44'),Date[_0xaaef('0x45')](),_0x798809[_0xaaef('0x46')]));}})});router[_0xaaef('0x3c')](_0xaaef('0x47'),upload['single'](_0xaaef('0x48')),controller[_0xaaef('0x49')]);router[_0xaaef('0x3c')](_0xaaef('0x4a'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x4b')]);router[_0xaaef('0x3c')]('/:id/logout',auth[_0xaaef('0xb')](),controller[_0xaaef('0x4c')]);router[_0xaaef('0x3c')]('/:id/pause',auth['isAuthenticated'](),controller[_0xaaef('0x4d')]);router[_0xaaef('0x3c')](_0xaaef('0x4e'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x4f')]);router['post'](_0xaaef('0x50'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x51')]);router['post'](_0xaaef('0x52'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x53')]);router[_0xaaef('0x3c')](_0xaaef('0x54'),auth['isAuthenticated'](),controller[_0xaaef('0x55')]);router[_0xaaef('0x3c')](_0xaaef('0x56'),auth['isAuthenticated'](),controller[_0xaaef('0x57')]);router['post'](_0xaaef('0x58'),auth[_0xaaef('0xb')](),controller['addSmsInteractions']);router[_0xaaef('0x3c')]('/:id/openchannel_interactions',auth[_0xaaef('0xb')](),controller[_0xaaef('0x59')]);router['post']('/:id/whatsapp_interactions',auth[_0xaaef('0xb')](),controller[_0xaaef('0x5a')]);router[_0xaaef('0x3c')]('/:id/fax_accounts',auth[_0xaaef('0xb')](),controller[_0xaaef('0x5b')]);router[_0xaaef('0x3c')](_0xaaef('0x32'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x5c')]);router['post'](_0xaaef('0x33'),auth[_0xaaef('0xb')](),controller['addOpenchannelAccounts']);router[_0xaaef('0x3c')](_0xaaef('0x34'),auth[_0xaaef('0xb')](),controller['addSmsAccounts']);router['post'](_0xaaef('0x5d'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x5e')]);router[_0xaaef('0x3c')]('/:id/whatsapp_accounts',auth[_0xaaef('0xb')](),controller[_0xaaef('0x5f')]);router[_0xaaef('0x3c')]('/:id/api_key',auth[_0xaaef('0xb')](),controller[_0xaaef('0x60')]);router[_0xaaef('0x61')](_0xaaef('0x11'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x62')]);router[_0xaaef('0x61')]('/:id/password',auth[_0xaaef('0xb')](),controller[_0xaaef('0x63')]);router[_0xaaef('0x64')]('/:id/queues',auth['isAuthenticated'](),controller[_0xaaef('0x65')]);router[_0xaaef('0x64')](_0xaaef('0x50'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x66')]);router[_0xaaef('0x64')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0xaaef('0x64')](_0xaaef('0x52'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x67')]);router[_0xaaef('0x64')](_0xaaef('0x54'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x68')]);router[_0xaaef('0x64')](_0xaaef('0x56'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x69')]);router[_0xaaef('0x64')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0xaaef('0x64')](_0xaaef('0x6a'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x6b')]);router['delete']('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0xaaef('0x6c')]);router[_0xaaef('0x64')](_0xaaef('0x30'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x6d')]);router['delete'](_0xaaef('0x32'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x6e')]);router[_0xaaef('0x64')](_0xaaef('0x33'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x6f')]);router[_0xaaef('0x64')](_0xaaef('0x34'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x70')]);router[_0xaaef('0x64')](_0xaaef('0x5d'),auth[_0xaaef('0xb')](),controller[_0xaaef('0x71')]);router[_0xaaef('0x64')]('/:id/whatsapp_accounts',auth[_0xaaef('0xb')](),controller[_0xaaef('0x72')]);router[_0xaaef('0x64')]('/:id/api_key',auth[_0xaaef('0xb')](),controller[_0xaaef('0x73')]);router['post'](_0xaaef('0x74'),auth['isAuthenticated'](),controller[_0xaaef('0x75')]);module[_0xaaef('0x76')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 1c0de3b..9361743 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 _0xf6ee=['dtlssetup','dtlscertfile','rtcp_mux','wss','encryption','icesupport','dtlsprivatekey','TEXT','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','util','exports','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','internal','STRING','email','toLowerCase','admin','user','local','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','info','shortinfo','inband','auto','yes','nonat','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','certificate','active','passive','actpass','update,nonat','showWebBar','get','udp','avpf','force_avp','dtlsenable','dtlsverify'];(function(_0x3bf7f6,_0x307dd0){var _0x383261=function(_0x11f376){while(--_0x11f376){_0x3bf7f6['push'](_0x3bf7f6['shift']());}};_0x383261(++_0x307dd0);}(_0xf6ee,0x18e));var _0xef6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf6ee[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xef6e('0x0'));var moment=require(_0xef6e('0x1'));var util=require(_0xef6e('0x2'));var _=require('lodash');module[_0xef6e('0x3')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xef6e('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x494db2){this[_0xef6e('0x5')](_0xef6e('0x4'),_0x494db2);this[_0xef6e('0x5')](_0xef6e('0x6'),_0x494db2);},'comment':_0xef6e('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x138624){this[_0xef6e('0x5')](_0xef6e('0x8'),_0x138624);this[_0xef6e('0x5')](_0xef6e('0x9'),util[_0xef6e('0xa')]('\x22%s\x22\x20<%s>',_0x138624,this['getDataValue'](_0xef6e('0xb'))));}},'alias':{'type':Sequelize[_0xef6e('0xc')]},'email':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x288370){if(_0x288370){this[_0xef6e('0x5')](_0xef6e('0xd'),_0x288370[_0xef6e('0xe')]());}}},'role':{'type':Sequelize['ENUM'](_0xef6e('0xf'),_0xef6e('0x10'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xef6e('0xc')],'defaultValue':_0xef6e('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xef6e('0xb'),'set':function(_0x445b1a){this[_0xef6e('0x5')]('internal',_0x445b1a);this[_0xef6e('0x5')](_0xef6e('0x12'),_0x445b1a);this[_0xef6e('0x5')](_0xef6e('0x9'),util[_0xef6e('0xa')](_0xef6e('0x13'),this[_0xef6e('0x14')](_0xef6e('0x8')),_0x445b1a));}},'salt':{'type':Sequelize[_0xef6e('0xc')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xef6e('0xc')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xef6e('0xc')]},'userpic':{'type':Sequelize[_0xef6e('0xc')]},'city':{'type':Sequelize[_0xef6e('0xc')]},'country':{'type':Sequelize[_0xef6e('0xc')]},'online':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xef6e('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xef6e('0xc')],'defaultValue':_0xef6e('0x17')},'lastPauseAt':{'type':Sequelize[_0xef6e('0x16')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xef6e('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'host':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![],'defaultValue':_0xef6e('0x19')},'ipaddr':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x1b'),_0xef6e('0x10'),_0xef6e('0x1c')),'allowNull':!![],'defaultValue':_0xef6e('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xef6e('0x1d')},'callingpres':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x1e'),_0xef6e('0x1f'),_0xef6e('0x20'),_0xef6e('0x21'),_0xef6e('0x22'),_0xef6e('0x23'),_0xef6e('0x24'),_0xef6e('0x25')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize['STRING'],'allowNull':!![]},'secret':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'transport':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![],'defaultValue':'udp','set':function(_0x100253){this['setDataValue'](_0xef6e('0x26'),_0x100253?_0x100253[_0xef6e('0x27')](','):null);},'get':function(){return this[_0xef6e('0x14')]('transport')?this[_0xef6e('0x14')](_0xef6e('0x26'))[_0xef6e('0x28')](','):null;},'comment':_0xef6e('0x29')},'dtmfmode':{'type':Sequelize[_0xef6e('0x1a')]('rfc2833',_0xef6e('0x2a'),_0xef6e('0x2b'),_0xef6e('0x2c'),_0xef6e('0x2d')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no',_0xef6e('0x2f'),'update',_0xef6e('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'nat':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![],'defaultValue':_0xef6e('0x31'),'set':function(_0x12b1ab){this[_0xef6e('0x5')](_0xef6e('0x32'),_0x12b1ab?_0x12b1ab[_0xef6e('0x27')](','):null);},'get':function(){return this[_0xef6e('0x14')](_0xef6e('0x32'))?this[_0xef6e('0x14')]('nat')[_0xef6e('0x28')](','):null;},'comment':_0xef6e('0x33')},'callgroup':{'type':Sequelize[_0xef6e('0xc')]},'namedcallgroup':{'type':Sequelize[_0xef6e('0xc')]},'pickupgroup':{'type':Sequelize[_0xef6e('0xc')]},'namedpickupgroup':{'type':Sequelize[_0xef6e('0xc')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'defaultValue':_0xef6e('0x34')},'allow':{'type':Sequelize[_0xef6e('0xc')],'allowNull':![],'defaultValue':_0xef6e('0x35'),'set':function(_0x5cd7e5){this['setDataValue']('allow',_0x5cd7e5?_0x5cd7e5[_0xef6e('0x27')](';'):_0xef6e('0x35'));},'get':function(){return this[_0xef6e('0x14')](_0xef6e('0x36'))?this[_0xef6e('0x14')](_0xef6e('0x36'))[_0xef6e('0x28')](';'):null;},'comment':_0xef6e('0x37')},'autoframing':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x45373d){this[_0xef6e('0x5')](_0xef6e('0x38'),_0x45373d?_0x45373d[_0xef6e('0x27')](','):null);},'get':function(){return this['getDataValue'](_0xef6e('0x38'))?this[_0xef6e('0x14')](_0xef6e('0x38'))[_0xef6e('0x28')](','):null;},'comment':_0xef6e('0x39')},'trustrpid':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xef6e('0x1a')]('yes','no',_0xef6e('0x3a')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xef6e('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xef6e('0x3b')},'amaflags':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xef6e('0x2e')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'template':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xef6e('0x2e'),'no',_0xef6e('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x3d'),'refuse',_0xef6e('0x3e')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0xef6e('0x3f'),_0xef6e('0x40')),'allowNull':!![],'defaultValue':_0xef6e('0x40')},'t38pt_usertpsource':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xef6e('0x2e')},'keepalive':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no','fingerprint',_0xef6e('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x42'),_0xef6e('0x43'),_0xef6e('0x44')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xef6e('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no',_0xef6e('0x2f'),'update',_0xef6e('0x45')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xef6e('0xc')]},'resetPasswordExpires':{'type':Sequelize[_0xef6e('0x16')]},'passwordResetAt':{'type':Sequelize[_0xef6e('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0,'set':function(_0x62a2a9){this[_0xef6e('0x5')](_0xef6e('0x46'),_0x62a2a9);var _0x42fc94=this[_0xef6e('0x47')]({'plain':!![]});switch(_0x62a2a9){case 0x0:case 0x1:var _0x3f71ab=_0x42fc94['transport']?_['isArray'](_0x42fc94['transport'])?_0x42fc94[_0xef6e('0x26')][_0xef6e('0x27')]():_0x42fc94['transport']:'udp';if(_0x3f71ab==='wss'){_0x3f71ab=_0xef6e('0x48');}this[_0xef6e('0x5')](_0xef6e('0x26'),_0x3f71ab);this['setDataValue']('encryption','no');this[_0xef6e('0x5')](_0xef6e('0x49'),null);this[_0xef6e('0x5')](_0xef6e('0x4a'),null);this[_0xef6e('0x5')]('icesupport',null);this[_0xef6e('0x5')](_0xef6e('0x4b'),null);this[_0xef6e('0x5')](_0xef6e('0x4c'),null);this['setDataValue'](_0xef6e('0x4d'),null);this[_0xef6e('0x5')](_0xef6e('0x4e'),null);this[_0xef6e('0x5')]('dtlsprivatekey',null);this[_0xef6e('0x5')](_0xef6e('0x4f'),'no');break;case 0x2:this[_0xef6e('0x5')](_0xef6e('0x26'),_0xef6e('0x50'));this[_0xef6e('0x5')](_0xef6e('0x51'),_0xef6e('0x2e'));this[_0xef6e('0x5')]('avpf',_0xef6e('0x2e'));this['setDataValue'](_0xef6e('0x4a'),_0xef6e('0x2e'));this[_0xef6e('0x5')](_0xef6e('0x52'),_0xef6e('0x2e'));this[_0xef6e('0x5')]('dtlsenable',_0xef6e('0x2e'));this[_0xef6e('0x5')](_0xef6e('0x4c'),'no');this['setDataValue'](_0xef6e('0x4d'),_0xef6e('0x44'));this[_0xef6e('0x5')](_0xef6e('0x4e'),_0x42fc94[_0xef6e('0x4e')]||'/etc/pki/tls/certs/motion.crt');this[_0xef6e('0x5')]('dtlsprivatekey',_0x42fc94[_0xef6e('0x53')]||'/etc/pki/tls/private/motion.key');this[_0xef6e('0x5')](_0xef6e('0x4f'),_0xef6e('0x2e'));break;default:}}},'permissions':{'type':Sequelize[_0xef6e('0x54')],'set':function(_0x141a17){this[_0xef6e('0x5')](_0xef6e('0x55'),_0x141a17?_0x141a17['join'](','):[]);},'get':function(){return this['getDataValue'](_0xef6e('0x55'))?_['map'](this[_0xef6e('0x14')](_0xef6e('0x55'))[_0xef6e('0x28')](','),function(_0x451f1c){return parseInt(_0x451f1c,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xef6e('0xc')]},'phoneBarBusyNumber':{'type':Sequelize[_0xef6e('0xc')]},'phoneBarUnconditional':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xef6e('0x1a')](_0xef6e('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xef6e('0xc')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xef6e('0x56')],'get':function(){return this[_0xef6e('0x14')](_0xef6e('0x57'))?this['getDataValue'](_0xef6e('0x57')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xef6e('0xc')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xef6e('0xc')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![],'set':function(_0x3621bb){if(typeof _0x3621bb===_0xef6e('0x58')){var _0x4df8dd=_0x3621bb==='1'?!![]:_0x3621bb==='0'?![]:_0x3621bb==='true'?!![]:_0x3621bb===_0xef6e('0x59')?![]:![];this[_0xef6e('0x5')](_0xef6e('0x5a'),_0x4df8dd);}else{this[_0xef6e('0x5')](_0xef6e('0x5a'),_0x3621bb);}}},'blocked':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![],'set':function(_0x33506b){this['setDataValue'](_0xef6e('0x5b'),_0x33506b);if(_0x33506b===!![]){this[_0xef6e('0x5')](_0xef6e('0x5c'),moment());this['setDataValue'](_0xef6e('0x5d'),0x0);}else{this[_0xef6e('0x5')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize[_0xef6e('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)[_0xef6e('0x5e')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xef6e('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xef6e('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xe589=['callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','admin','user','agent','telephone','local','INTEGER','accountcode','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','udp','join','transport','split','info','shortinfo','inband','yes','nonat','update','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\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uas','certificate','active','passive','actpass','update,nonat','showWebBar','isArray','wss','encryption','avpf','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','blockedAt','UNSIGNED','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xe589,0x100));var _0x9e58=function(_0x4e68f8,_0x561a43){_0x4e68f8=_0x4e68f8-0x0;var _0x5c9b32=_0xe589[_0x4e68f8];return _0x5c9b32;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x9e58('0x0'));var _=require(_0x9e58('0x1'));module[_0x9e58('0x2')]={'name':{'type':Sequelize[_0x9e58('0x3')],'allowNull':![],'unique':_0x9e58('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x292553){this[_0x9e58('0x5')](_0x9e58('0x4'),_0x292553);this[_0x9e58('0x5')](_0x9e58('0x6'),_0x292553);},'comment':_0x9e58('0x7')},'fullname':{'type':Sequelize[_0x9e58('0x3')],'allowNull':![],'set':function(_0x3e53aa){this[_0x9e58('0x5')]('fullname',_0x3e53aa);this[_0x9e58('0x5')](_0x9e58('0x8'),util[_0x9e58('0x9')](_0x9e58('0xa'),_0x3e53aa,this[_0x9e58('0xb')](_0x9e58('0xc'))));}},'alias':{'type':Sequelize[_0x9e58('0x3')]},'email':{'type':Sequelize[_0x9e58('0x3')],'allowNull':![],'unique':_0x9e58('0xd'),'validate':{'isEmail':!![]},'set':function(_0x554b4b){if(_0x554b4b){this['setDataValue'](_0x9e58('0xd'),_0x554b4b['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x9e58('0xe'),_0x9e58('0xf'),_0x9e58('0x10'),_0x9e58('0x11')),'allowNull':![]},'password':{'type':Sequelize[_0x9e58('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x9e58('0x3')],'defaultValue':_0x9e58('0x12')},'internal':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':![],'unique':_0x9e58('0xc'),'set':function(_0x10aafa){this[_0x9e58('0x5')](_0x9e58('0xc'),_0x10aafa);this[_0x9e58('0x5')](_0x9e58('0x14'),_0x10aafa);this[_0x9e58('0x5')](_0x9e58('0x8'),util[_0x9e58('0x9')](_0x9e58('0xa'),this[_0x9e58('0xb')](_0x9e58('0x15')),_0x10aafa));}},'salt':{'type':Sequelize[_0x9e58('0x3')]},'phone':{'type':Sequelize[_0x9e58('0x3')]},'mobile':{'type':Sequelize[_0x9e58('0x3')]},'address':{'type':Sequelize[_0x9e58('0x3')]},'zipcode':{'type':Sequelize[_0x9e58('0x3')]},'userpic':{'type':Sequelize[_0x9e58('0x3')]},'city':{'type':Sequelize[_0x9e58('0x3')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x9e58('0x17')]},'voicePause':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'mailPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x9e58('0x3')],'defaultValue':_0x9e58('0x18')},'lastPauseAt':{'type':Sequelize[_0x9e58('0x17')]},'chatCapacity':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x9e58('0x13')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'description':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize['STRING'],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x1a'),'user',_0x9e58('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![],'defaultValue':_0x9e58('0x1c')},'callingpres':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x1d'),_0x9e58('0x1e'),_0x9e58('0x1f'),'ALLOWED','PROHIB_NOT_SCREENED',_0x9e58('0x20'),'PROHIB_FAILED_SCREEN','PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![],'defaultValue':_0x9e58('0x21'),'set':function(_0x136d30){this['setDataValue']('transport',_0x136d30?_0x136d30[_0x9e58('0x22')](','):null);},'get':function(){return this[_0x9e58('0xb')]('transport')?this[_0x9e58('0xb')](_0x9e58('0x23'))[_0x9e58('0x24')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x9e58('0x19')]('rfc2833',_0x9e58('0x25'),_0x9e58('0x26'),_0x9e58('0x27'),'auto'),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no',_0x9e58('0x29'),_0x9e58('0x2a'),_0x9e58('0x2b')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![],'defaultValue':_0x9e58('0x2c'),'set':function(_0x1540d1){this[_0x9e58('0x5')](_0x9e58('0x2d'),_0x1540d1?_0x1540d1['join'](','):null);},'get':function(){return this['getDataValue'](_0x9e58('0x2d'))?this[_0x9e58('0xb')]('nat')[_0x9e58('0x24')](','):null;},'comment':_0x9e58('0x2e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x9e58('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x9e58('0x3')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x9e58('0x3')]},'disallow':{'type':Sequelize[_0x9e58('0x3')],'allowNull':![],'defaultValue':_0x9e58('0x2f')},'allow':{'type':Sequelize[_0x9e58('0x3')],'allowNull':![],'defaultValue':_0x9e58('0x30'),'set':function(_0x36d226){this[_0x9e58('0x5')](_0x9e58('0x31'),_0x36d226?_0x36d226[_0x9e58('0x22')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x9e58('0xb')](_0x9e58('0x31'))?this[_0x9e58('0xb')](_0x9e58('0x31'))[_0x9e58('0x24')](';'):null;},'comment':_0x9e58('0x32')},'autoframing':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x3ca778){this['setDataValue'](_0x9e58('0x33'),_0x3ca778?_0x3ca778[_0x9e58('0x22')](','):null);},'get':function(){return this[_0x9e58('0xb')](_0x9e58('0x33'))?this[_0x9e58('0xb')]('insecure')[_0x9e58('0x24')](','):null;},'comment':_0x9e58('0x34')},'trustrpid':{'type':Sequelize[_0x9e58('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no',_0x9e58('0x35')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':_0x9e58('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x9e58('0x19')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no',_0x9e58('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x37'),_0x9e58('0x38'),_0x9e58('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x9e58('0x19')]('uac',_0x9e58('0x3a')),'allowNull':!![],'defaultValue':_0x9e58('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x9e58('0x19')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x9e58('0x19')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x9e58('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no','fingerprint',_0x9e58('0x3b')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize['ENUM'](_0x9e58('0x3c'),_0x9e58('0x3d'),_0x9e58('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x9e58('0x13')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no',_0x9e58('0x29'),_0x9e58('0x2a'),_0x9e58('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0x9e58('0x17')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x449980){this[_0x9e58('0x5')](_0x9e58('0x40'),_0x449980);var _0x230e95=this['get']({'plain':!![]});switch(_0x449980){case 0x0:case 0x1:var _0x3af6b7=_0x230e95[_0x9e58('0x23')]?_[_0x9e58('0x41')](_0x230e95[_0x9e58('0x23')])?_0x230e95['transport'][_0x9e58('0x22')]():_0x230e95[_0x9e58('0x23')]:_0x9e58('0x21');if(_0x3af6b7===_0x9e58('0x42')){_0x3af6b7='udp';}this[_0x9e58('0x5')](_0x9e58('0x23'),_0x3af6b7);this[_0x9e58('0x5')](_0x9e58('0x43'),'no');this[_0x9e58('0x5')](_0x9e58('0x44'),null);this[_0x9e58('0x5')]('force_avp',null);this[_0x9e58('0x5')](_0x9e58('0x45'),null);this[_0x9e58('0x5')](_0x9e58('0x46'),null);this[_0x9e58('0x5')](_0x9e58('0x47'),null);this[_0x9e58('0x5')](_0x9e58('0x48'),null);this['setDataValue'](_0x9e58('0x49'),null);this[_0x9e58('0x5')](_0x9e58('0x4a'),null);this[_0x9e58('0x5')]('rtcp_mux','no');break;case 0x2:this['setDataValue'](_0x9e58('0x23'),_0x9e58('0x42'));this[_0x9e58('0x5')](_0x9e58('0x43'),_0x9e58('0x28'));this['setDataValue'](_0x9e58('0x44'),_0x9e58('0x28'));this[_0x9e58('0x5')]('force_avp',_0x9e58('0x28'));this['setDataValue'](_0x9e58('0x45'),_0x9e58('0x28'));this[_0x9e58('0x5')](_0x9e58('0x46'),_0x9e58('0x28'));this[_0x9e58('0x5')](_0x9e58('0x47'),'no');this[_0x9e58('0x5')]('dtlssetup','actpass');this[_0x9e58('0x5')]('dtlscertfile',_0x230e95[_0x9e58('0x49')]||'/etc/pki/tls/certs/motion.crt');this['setDataValue'](_0x9e58('0x4a'),_0x230e95['dtlsprivatekey']||_0x9e58('0x4b'));this[_0x9e58('0x5')](_0x9e58('0x4c'),_0x9e58('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x9e58('0x4d')],'set':function(_0x438a83){this[_0x9e58('0x5')](_0x9e58('0x4e'),_0x438a83?_0x438a83[_0x9e58('0x22')](','):[]);},'get':function(){return this['getDataValue'](_0x9e58('0x4e'))?_[_0x9e58('0x4f')](this['getDataValue'](_0x9e58('0x4e'))[_0x9e58('0x24')](','),function(_0x13c93d){return parseInt(_0x13c93d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x9e58('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x9e58('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x9e58('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x9e58('0x19')](_0x9e58('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x9e58('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x9e58('0x50')],'get':function(){return this[_0x9e58('0xb')](_0x9e58('0x51'))?this[_0x9e58('0xb')](_0x9e58('0x51')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'interface':{'type':Sequelize[_0x9e58('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x9e58('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x8638b5){if(typeof _0x8638b5===_0x9e58('0x52')){var _0x33eded=_0x8638b5==='1'?!![]:_0x8638b5==='0'?![]:_0x8638b5===_0x9e58('0x53')?!![]:_0x8638b5==='false'?![]:![];this[_0x9e58('0x5')](_0x9e58('0x54'),_0x33eded);}else{this[_0x9e58('0x5')](_0x9e58('0x54'),_0x8638b5);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x55f001){this[_0x9e58('0x5')](_0x9e58('0x55'),_0x55f001);if(_0x55f001===!![]){this['setDataValue'](_0x9e58('0x56'),moment());this[_0x9e58('0x5')]('loginAttempts',0x0);}else{this[_0x9e58('0x5')](_0x9e58('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x9e58('0x13')](0x5)[_0x9e58('0x57')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x9e58('0x13')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x9e58('0x16')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index b7dfad4..098fe66 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 _0xc4d4=['user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','FaxAccount','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','removeChatWebsites','WhatsappAccount','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$gt','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$notILike','$like','$overlap','$contained','CmContact','dialActive','VoiceQueue','getApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','send','getUserSetting','getPresence','idle','ringing','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','unavailable','voiceStatus','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','enabled','moment','util','path','lodash','squel','jayson/promise','../../components/contacts','../../config/logger','api','../../config/environment','../../config/license/util','../../errors/api','APIBadRequestError','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','localhost','http','sendStatus','status','json','undefined','limit','offset','set','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','agent','userNotification:recalc:','destroy','get','role','admin','Agents','Telephones','telephone','filter','ignore','value','includes','name','UserProfileResource','end','stack','User','rawAttributes','map','type','key','password','salt','resetPasswordToken','md5secret','index','count','query','userSetting','true','include','UserSetting','attributes','push','openTabs','chat','rows','dataValues','sms','mail','whatsapp','all','params','getOptions','includeAll','options','find','fax','body','describe','addContacts','ids','internal','Setting','findById','securePassword','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','VoiceMail','fullname','permissions','101','102','103','113','110','105','106','107','108','109','100','114','115','create','user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','findAll','isEmpty','compact','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','voicePause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','voice','format','SIP/%s','UserVoiceQueueRt','upsert','removeQueues','remove','isArray','QueueId','emit','Queue:remove','addAvatar','userpic','file','filename','getAvatar','existsSync','join','root','download','getOpenTabs','openchannel','ChatOpenTabs','createdAt','FAX','OPENCHANNEL','MailOpenTabs','MAIL','WhatsappOpenTabs','WHATSAPP','getContacts','hasOwnProperty','Tags','tag','getQueues','model','keys','Queue','filters','intersection','fields','sort','where','pick','merge','Unknown\x20role','order','getVoiceQueuesRt','ChatGroup','getGroups','getRecordings','nolimit','VoiceRecording','ScreenRecording','UserId','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','mobile','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','MemberReport','forEach','update','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','bulkCreate','concat','isMiddleware','resolve','logout','pause','QueuePause','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','User\x20with\x20id\x20%s\x20not\x20found','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','getAssociatedQueues','removeAgent','VoicePrefixId','getLists','CmList','getAgents','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','omit','user_has_chat_interactions:save','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:remove','addOpenchannelInteractions'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc4d4,0x1f2));var _0x4c4d=function(_0x46dedf,_0xa59cac){_0x46dedf=_0x46dedf-0x0;var _0x3851dc=_0xc4d4[_0x46dedf];return _0x3851dc;};'use strict';var moment=require(_0x4c4d('0x0'));var util=require(_0x4c4d('0x1'));var path=require(_0x4c4d('0x2'));var fs=require('fs');var _=require(_0x4c4d('0x3'));var squel=require(_0x4c4d('0x4'));var Redis=require('ioredis');var jayson=require(_0x4c4d('0x5'));var authService=require('../../components/auth/service');var contacts=require(_0x4c4d('0x6'));var qs=require('../../components/parsers/qs');var rta=require('../../components/realtime/agents');var logger=require(_0x4c4d('0x7'))(_0x4c4d('0x8'));var utils=require('../../config/utils');var config=require(_0x4c4d('0x9'));var licenseUtil=require(_0x4c4d('0xa'));var APIBadRequestError=require(_0x4c4d('0xb'))[_0x4c4d('0xc')];var APINotFoundError=require('../../errors/api')['APINotFoundError'];var APIForbiddenError=require(_0x4c4d('0xb'))['APIForbiddenrror'];var APIHandleError=require(_0x4c4d('0xb'))[_0x4c4d('0xd')];var db=require(_0x4c4d('0xe'))['db'];var socket=require(_0x4c4d('0xf'))(new Redis(config[_0x4c4d('0x10')]));require(_0x4c4d('0x11'))[_0x4c4d('0x12')](socket);config['redis']=_['defaults'](config['redis'],{'host':_0x4c4d('0x13'),'port':0x18eb});var amiClient=jayson['client'][_0x4c4d('0x14')]({'port':0x232a});var values;function respondWithStatusCode(_0x36908e,_0x1569a6){_0x1569a6=_0x1569a6||0xcc;return function(_0x471d2f){if(_0x471d2f){return _0x36908e[_0x4c4d('0x15')](_0x1569a6);}return _0x36908e[_0x4c4d('0x16')](_0x1569a6)['end']();};}function respondWithResult(_0x52e941,_0x1e2e2b){_0x1e2e2b=_0x1e2e2b||0xc8;return function(_0x4a9364){if(_0x4a9364){return _0x52e941[_0x4c4d('0x16')](_0x1e2e2b)[_0x4c4d('0x17')](_0x4a9364);}};}function respondWithFilteredResult(_0x5ba3b5,_0x47c961){return function(_0x5f2b73){if(_0x5f2b73){var _0x5c8020=typeof _0x47c961['offset']===_0x4c4d('0x18')&&typeof _0x47c961[_0x4c4d('0x19')]===_0x4c4d('0x18');var _0x3c27f2=_0x5f2b73['count'];var _0x204eb1=_0x5c8020?0x0:_0x47c961[_0x4c4d('0x1a')];var _0x4ef169=_0x5c8020?_0x5f2b73['count']:_0x47c961[_0x4c4d('0x1a')]+_0x47c961['limit'];var _0x40e994;if(_0x4ef169>=_0x3c27f2){_0x4ef169=_0x3c27f2;_0x40e994=0xc8;}else{_0x40e994=0xce;}_0x5ba3b5[_0x4c4d('0x16')](_0x40e994);return _0x5ba3b5[_0x4c4d('0x1b')]('Content-Range',_0x204eb1+'-'+_0x4ef169+'/'+_0x3c27f2)[_0x4c4d('0x17')](_0x5f2b73);}return null;};}function respondWithRpcPromise(_0x298479,_0x42a554,_0x4e809c,_0x25e033){return new Promise(function(_0x3334b3,_0x38396e){var _0x230948=_0x25e033||amiClient;return _0x230948[_0x4c4d('0x1c')](_0x298479,_0x4e809c)[_0x4c4d('0x1d')](function(_0x4e9696){logger[_0x4c4d('0x1e')](_0x4c4d('0x1f'),_0x42a554,_0x4c4d('0x20'));logger[_0x4c4d('0x21')](_0x4c4d('0x22'),_0x42a554,_0x4c4d('0x20'),JSON[_0x4c4d('0x23')](_0x4e9696));if(_0x4e9696[_0x4c4d('0x24')]){if(_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x25')]===0x1f4){logger[_0x4c4d('0x24')](_0x4c4d('0x1f'),_0x42a554,_0x4e9696[_0x4c4d('0x24')]['message']);return _0x38396e(_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x26')]);}logger['error'](_0x4c4d('0x1f'),_0x42a554,_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x26')]);return _0x3334b3(_0x4e9696[_0x4c4d('0x24')][_0x4c4d('0x26')]);}else{logger['info'](_0x4c4d('0x1f'),_0x42a554,_0x4c4d('0x20'));_0x3334b3(_0x4e9696[_0x4c4d('0x27')][_0x4c4d('0x26')]);}})[_0x4c4d('0x28')](function(_0x28333f){logger['error'](_0x4c4d('0x1f'),_0x42a554,_0x28333f);_0x38396e(_0x28333f);});});}function saveUpdates(_0x15af7c){return function(_0x4c0db4){if(_0x4c0db4){return _0x4c0db4['update'](_0x15af7c)[_0x4c4d('0x1d')](function(_0x206085){if(_0x206085['role']===_0x4c4d('0x29')){socket['emit'](_0x4c4d('0x2a')+_0x206085['id'],_0x206085);}return _0x206085;});}return null;};}function removeEntity(_0x2a92f1,_0x485c09){return function(_0x5d510d){if(_0x5d510d){return _0x5d510d[_0x4c4d('0x2b')]({'transaction':_0x485c09})['then'](function(){var _0x41365e=_0x5d510d[_0x4c4d('0x2c')]({'plain':!![]});if(_0x41365e[_0x4c4d('0x2d')]===_0x4c4d('0x2e'))return;var _0x4ff26d=[{'name':'Users','value':'user','ignore':!![]},{'name':_0x4c4d('0x2f'),'value':_0x4c4d('0x29'),'ignore':![]},{'name':_0x4c4d('0x30'),'value':_0x4c4d('0x31'),'ignore':![]}];var _0x4cd4c9=_(_0x4ff26d)[_0x4c4d('0x32')](_0x4c4d('0x33'))['map'](_0x4c4d('0x34'))[_0x4c4d('0x34')]();if(_[_0x4c4d('0x35')](_0x4cd4c9,_0x41365e[_0x4c4d('0x2d')])){return;}var _0x4ee62c=_['find'](_0x4ff26d,[_0x4c4d('0x34'),_0x41365e[_0x4c4d('0x2d')]])[_0x4c4d('0x36')];return db[_0x4c4d('0x37')][_0x4c4d('0x2b')]({'where':{'type':_0x4ee62c,'resourceId':_0x41365e['id']},'transaction':_0x485c09})[_0x4c4d('0x1d')](function(){return _0x5d510d;});})['then'](function(){_0x2a92f1[_0x4c4d('0x16')](0xcc)[_0x4c4d('0x38')]();});}};}function handleEntityNotFound(_0x5f00e7){return function(_0x20d681){if(!_0x20d681){_0x5f00e7[_0x4c4d('0x15')](0x194);}return _0x20d681;};}function handleError(_0x2652c4,_0x32824d){_0x32824d=_0x32824d||0x1f4;return function(_0xdc96d8){logger[_0x4c4d('0x24')](_0xdc96d8[_0x4c4d('0x39')]);if(_0xdc96d8[_0x4c4d('0x36')]){delete _0xdc96d8[_0x4c4d('0x36')];}_0x2652c4[_0x4c4d('0x16')](_0x32824d)['send'](_0xdc96d8);};}function getUserAttributes(){return _(db[_0x4c4d('0x3a')][_0x4c4d('0x3b')])[_0x4c4d('0x3c')](function(_0x5160e9){return{'name':_0x5160e9['fieldName'],'type':_0x5160e9[_0x4c4d('0x3d')][_0x4c4d('0x3e')]};})[_0x4c4d('0x32')](function(_0x58cbd5){return![_0x4c4d('0x3f'),_0x4c4d('0x40'),'previousPasswords',_0x4c4d('0x41'),'resetPasswordExpires',_0x4c4d('0x42')][_0x4c4d('0x35')](_0x58cbd5['name']);})['value']();}exports[_0x4c4d('0x43')]=function(_0x4a8e06,_0x2d0668){var _0x328e8b={},_0x3ee292={'count':0x0,'rows':[]};var _0x1eec6f=getUserAttributes();_0x328e8b=qs['getOptions'](_0x1eec6f,_0x4a8e06);var _0x28d105={'where':_0x328e8b['where']};return db[_0x4c4d('0x3a')][_0x4c4d('0x44')](_0x28d105)[_0x4c4d('0x1d')](function(_0x522672){_0x3ee292[_0x4c4d('0x44')]=_0x522672;if(_0x4a8e06[_0x4c4d('0x45')]['includeAll']){_0x328e8b['include']=[{'all':!![]}];}if(_0x4a8e06[_0x4c4d('0x45')][_0x4c4d('0x46')]===_0x4c4d('0x47')){_0x328e8b[_0x4c4d('0x48')]=[{'model':db[_0x4c4d('0x49')],'as':_0x4c4d('0x46')}];}if(!_['includes'](_0x328e8b[_0x4c4d('0x4a')],'id')){_0x328e8b['attributes'][_0x4c4d('0x4b')]('id');}return db[_0x4c4d('0x3a')]['findAll'](_0x328e8b);})[_0x4c4d('0x1d')](function(_0x4c52ed){_0x3ee292['rows']=_0x4c52ed;if(_0x4a8e06[_0x4c4d('0x45')][_0x4c4d('0x4c')]===_0x4c4d('0x47')){var _0x2f6ffa=[];for(var _0x778ed=0x0;_0x778ed<_0x3ee292['rows']['length'];_0x778ed++){_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x4d'),_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x50'),_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa['push'](get_open_tabs('fax',_0x3ee292['rows'][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa['push'](get_open_tabs(_0x4c4d('0x51'),_0x3ee292['rows'][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs('openchannel',_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));_0x2f6ffa[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x52'),_0x3ee292[_0x4c4d('0x4e')][_0x778ed][_0x4c4d('0x4f')]));}return Promise[_0x4c4d('0x53')](_0x2f6ffa)['then'](function(){return _0x3ee292;});}else{return _0x3ee292;}})[_0x4c4d('0x1d')](respondWithFilteredResult(_0x2d0668,_0x328e8b))[_0x4c4d('0x28')](handleError(_0x2d0668,null));};exports['show']=function(_0x5b9bee,_0x5a5f38){var _0x47823f=getUserAttributes();_0x5b9bee['query']['id']=_0x5b9bee[_0x4c4d('0x54')]['id'];var _0x135212=qs[_0x4c4d('0x55')](_0x47823f,_0x5b9bee);if(_0x5b9bee[_0x4c4d('0x45')][_0x4c4d('0x56')]){_0x135212['include']=[{'all':!![]}];}if(_0x5b9bee[_0x4c4d('0x45')][_0x4c4d('0x46')]===_0x4c4d('0x47')){_0x135212[_0x4c4d('0x48')]=[{'model':db['UserSetting'],'as':_0x4c4d('0x46')}];}_0x135212=_['merge']({},_0x135212,_0x5b9bee[_0x4c4d('0x57')]);if(!_['includes'](_0x135212[_0x4c4d('0x4a')],'id')){_0x135212['attributes'][_0x4c4d('0x4b')]('id');}return db['User'][_0x4c4d('0x58')](_0x135212)[_0x4c4d('0x1d')](handleEntityNotFound(_0x5a5f38,null))[_0x4c4d('0x1d')](function(_0x14ff89){var _0x131335=[];values=_0x14ff89;if(_0x5b9bee[_0x4c4d('0x45')][_0x4c4d('0x4c')]===_0x4c4d('0x47')){_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x4d'),_0x14ff89[_0x4c4d('0x4f')]));_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x50'),_0x14ff89['dataValues']));_0x131335[_0x4c4d('0x4b')](get_open_tabs('openchannel',_0x14ff89[_0x4c4d('0x4f')]));_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x52'),_0x14ff89['dataValues']));_0x131335[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x59'),_0x14ff89[_0x4c4d('0x4f')]));_0x131335['push'](get_open_tabs(_0x4c4d('0x51'),_0x14ff89[_0x4c4d('0x4f')]));return Promise[_0x4c4d('0x53')](_0x131335);}else{return values;}})[_0x4c4d('0x1d')](function(){return values;})[_0x4c4d('0x1d')](respondWithResult(_0x5a5f38,null))['catch'](handleError(_0x5a5f38,null));};exports['update']=function(_0x1f04e6,_0x3af68a){if(_0x1f04e6[_0x4c4d('0x5a')]['id']){delete _0x1f04e6[_0x4c4d('0x5a')]['id'];}delete _0x1f04e6['body'][_0x4c4d('0x2d')];return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x1f04e6[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x3af68a,null))[_0x4c4d('0x1d')](saveUpdates(_0x1f04e6[_0x4c4d('0x5a')],null))[_0x4c4d('0x1d')](respondWithResult(_0x3af68a,null))[_0x4c4d('0x28')](handleError(_0x3af68a,null));};exports[_0x4c4d('0x5b')]=function(_0x252a6c,_0x189e93){return db['User'][_0x4c4d('0x5b')]()[_0x4c4d('0x1d')](respondWithResult(_0x189e93,null))['catch'](handleError(_0x189e93,null));};exports[_0x4c4d('0x5c')]=function(_0x15ac7c,_0x5794d3){return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x15ac7c['params']['id']}})['then'](handleEntityNotFound(_0x5794d3,null))[_0x4c4d('0x1d')](function(_0xb35f){if(_0xb35f){return _0xb35f[_0x4c4d('0x5c')](_0x15ac7c[_0x4c4d('0x5a')][_0x4c4d('0x5d')],_['omit'](_0x15ac7c[_0x4c4d('0x5a')],[_0x4c4d('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x5794d3,null))[_0x4c4d('0x28')](handleError(_0x5794d3,null));};function validateUser(_0x233da7){return new Promise(function(_0x439089,_0x37a558){if(_0x233da7[_0x4c4d('0x5e')])return _0x439089(_0x233da7);return db[_0x4c4d('0x5f')][_0x4c4d('0x60')](0x1)[_0x4c4d('0x1d')](function(_0x415b5f){if(_0x415b5f[_0x4c4d('0x61')])authService[_0x4c4d('0x62')](_0x233da7[_0x4c4d('0x3f')]);db[_0x4c4d('0x3a')][_0x4c4d('0x63')](_0x4c4d('0x5e'))[_0x4c4d('0x1d')](function(_0x58dfed){if(_[_0x4c4d('0x64')](_0x58dfed)){_0x233da7[_0x4c4d('0x5e')]=_0x415b5f['min_internal']||0x1;return;}if(_[_0x4c4d('0x64')](_0x415b5f[_0x4c4d('0x65')])||_0x415b5f[_0x4c4d('0x65')]===_0x58dfed){_0x233da7['internal']=_0x58dfed+0x1;return;}if(_0x415b5f[_0x4c4d('0x65')]>_0x58dfed){_0x233da7['internal']=_0x415b5f['min_internal'];return;}return db[_0x4c4d('0x66')][_0x4c4d('0x45')](_0x4c4d('0x67'),{'type':db[_0x4c4d('0x66')][_0x4c4d('0x68')][_0x4c4d('0x69')]})['then'](function(_0x5ace9c){if(_0x5ace9c&&_0x5ace9c[_0x4c4d('0x6a')]){for(var _0x5e17ff=0x0,_0x10ada4=_0x5ace9c[_0x4c4d('0x6a')];_0x5e17ff<_0x10ada4&&_[_0x4c4d('0x64')](_0x233da7['internal']);_0x5e17ff++){if(_0x415b5f[_0x4c4d('0x65')]<=_0x5ace9c[_0x5e17ff]['from']){_0x233da7[_0x4c4d('0x5e')]=_0x5ace9c[_0x5e17ff]['from'];}else if(_0x415b5f['min_internal']>_0x5ace9c[_0x5e17ff][_0x4c4d('0x6b')]&&_0x415b5f[_0x4c4d('0x65')]<=_0x5ace9c[_0x5e17ff]['to']){_0x233da7[_0x4c4d('0x5e')]=_0x415b5f['min_internal'];}}}if(_[_0x4c4d('0x64')](_0x233da7['internal'])){_0x233da7[_0x4c4d('0x5e')]=_0x58dfed+0x1;}return _0x439089(_0x233da7);});});})[_0x4c4d('0x28')](function(_0x2957c9){_0x37a558(_0x2957c9);});});}function updateUser(_0x15ab18){return new Promise(function(_0x467b4c,_0x2a55d){try{if(_0x15ab18['voicemail']){_0x15ab18['mailbox']=_0x15ab18[_0x4c4d('0x5e')];_0x15ab18[_0x4c4d('0x6c')]={'mailbox':_0x15ab18['internal'],'password':_0x15ab18[_0x4c4d('0x3f')],'fullname':_0x15ab18[_0x4c4d('0x6d')],'email':_0x15ab18['email']};}if(_0x15ab18[_0x4c4d('0x2d')]===_0x4c4d('0x29')){if(!_0x15ab18[_0x4c4d('0x6e')])_0x15ab18[_0x4c4d('0x6e')]=[_0x4c4d('0x6f'),_0x4c4d('0x70'),_0x4c4d('0x71'),_0x4c4d('0x72'),_0x4c4d('0x73'),'104',_0x4c4d('0x74'),_0x4c4d('0x75'),_0x4c4d('0x76'),_0x4c4d('0x77'),_0x4c4d('0x78'),_0x4c4d('0x79'),'111',_0x4c4d('0x7a'),_0x4c4d('0x7b')];}_0x467b4c(_0x15ab18);}catch(_0x39b8c0){_0x2a55d(_0x39b8c0);}});}exports[_0x4c4d('0x7c')]=function(_0x5531a4,_0x2ff4b0){if(_0x5531a4['user']['role']===_0x4c4d('0x29'))throw new Error('Unauthorized');if(_0x5531a4[_0x4c4d('0x5a')][_0x4c4d('0x2d')]===_0x4c4d('0x7d')&&_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x2d')]!==_0x4c4d('0x2e')){throw new Error(_0x4c4d('0x7e'));}if(_0x5531a4['body'][_0x4c4d('0x2d')]==='admin'&&_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x2d')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x4c4d('0x7f')]([_0x5531a4['body']])['then'](function(){return validateUser(_0x5531a4[_0x4c4d('0x5a')]);})[_0x4c4d('0x1d')](function(_0x4201d8){return updateUser(_0x4201d8)[_0x4c4d('0x1d')](function(_0x47f666){if(_0x47f666[_0x4c4d('0x2d')]===_0x4c4d('0x2e')){_0x47f666[_0x4c4d('0x80')]=_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x80')];delete _0x47f666[_0x4c4d('0x81')];}return _0x47f666;});})[_0x4c4d('0x1d')](function(_0xd6b2f){return db['User'][_0x4c4d('0x7c')](_0xd6b2f,{'include':[{'model':db['VoiceMail'],'as':_0x4c4d('0x6c')}]});})[_0x4c4d('0x1d')](function(_0x47df23){if(_0x5531a4[_0x4c4d('0x5a')][_0x4c4d('0x2d')]===_0x4c4d('0x7d'))return _0x47df23;if(_0x5531a4[_0x4c4d('0x7d')]['role']!=='user')return _0x47df23;return db[_0x4c4d('0x82')][_0x4c4d('0x58')]({'where':{'name':_0x47df23[_0x4c4d('0x2d')]===_0x4c4d('0x29')?_0x4c4d('0x2f'):_0x4c4d('0x30'),'userProfileId':_0x5531a4[_0x4c4d('0x7d')][_0x4c4d('0x81')]},'raw':!![]})[_0x4c4d('0x1d')](function(_0x15e722){if(!_0x15e722||_0x15e722[_0x4c4d('0x83')]!=0x0)return _0x47df23;return db[_0x4c4d('0x37')][_0x4c4d('0x7c')]({'name':_0x47df23['name'],'resourceId':_0x47df23['id'],'type':_0x15e722['name'],'sectionId':_0x15e722['id']},{})[_0x4c4d('0x1d')](function(){return _0x47df23;});})['catch'](function(_0x3124a1){logger['error'](_0x4c4d('0x84'),_0x3124a1);throw _0x3124a1;});})[_0x4c4d('0x1d')](respondWithResult(_0x2ff4b0,0xc9))[_0x4c4d('0x28')](handleError(_0x2ff4b0,null));};exports['bulkCreate']=function(_0x25488e,_0x435b4e){var _0x4051d9=_0x25488e[_0x4c4d('0x5a')];var _0x9adbf=[];if(_0x25488e[_0x4c4d('0x7d')][_0x4c4d('0x2d')]===_0x4c4d('0x29'))throw new Error('Unauthorized');if(_[_0x4c4d('0x85')](_0x4051d9,[_0x4c4d('0x2d'),_0x4c4d('0x7d')])&&_0x25488e[_0x4c4d('0x7d')]['role']!==_0x4c4d('0x2e')){throw new Error(_0x4c4d('0x7e'));}if(_[_0x4c4d('0x85')](_0x4051d9,[_0x4c4d('0x2d'),_0x4c4d('0x2e')])&&_0x25488e[_0x4c4d('0x7d')]['role']!==_0x4c4d('0x2e')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil['checkUserLimits'](_0x4051d9)[_0x4c4d('0x1d')](function(){return validateUser(_0x4051d9[0x0]);})[_0x4c4d('0x1d')](function(){for(var _0x54d429=0x1;_0x54d429<_0x4051d9[_0x4c4d('0x6a')];_0x54d429++){var _0x3f208c=_0x4051d9[_0x54d429-0x1][_0x4c4d('0x5e')];if(!_0x4051d9[_0x54d429][_0x4c4d('0x5e')])_0x4051d9[_0x54d429][_0x4c4d('0x5e')]=_0x3f208c+0x1;_0x9adbf['push'](validateUser(_0x4051d9[_0x54d429]));}return Promise[_0x4c4d('0x53')](_0x9adbf);})['then'](function(){_0x9adbf=[];for(var _0x34d619=0x0;_0x34d619<_0x4051d9[_0x4c4d('0x6a')];_0x34d619++){_0x9adbf['push'](updateUser(_0x4051d9[_0x34d619]));}return Promise[_0x4c4d('0x53')](_0x9adbf);})['then'](function(){_0x9adbf=_0x4051d9[_0x4c4d('0x3c')](function(_0x2a05a3){return db['User']['create'](_0x2a05a3,{'include':[{'model':db[_0x4c4d('0x6c')],'as':_0x4c4d('0x6c')}]})[_0x4c4d('0x1d')](function(_0x4ee89d){_0x2a05a3['id']=_0x4ee89d['id'];return _0x2a05a3;});});return Promise[_0x4c4d('0x53')](_0x9adbf);})[_0x4c4d('0x1d')](function(_0x48554f){if(_0x25488e['body']['role']===_0x4c4d('0x7d'))return _0x48554f;if(_0x25488e[_0x4c4d('0x7d')][_0x4c4d('0x2d')]!==_0x4c4d('0x7d'))return _0x48554f;var _0x5040db=_['some'](_0x48554f,function(_0xad8359){return _0xad8359[_0x4c4d('0x2d')]===_0x4c4d('0x29')||_0xad8359[_0x4c4d('0x2d')]==='telephone';});if(!_0x5040db)return _0x48554f;return db[_0x4c4d('0x82')][_0x4c4d('0x86')]({'where':{'name':{'$or':[_0x4c4d('0x2f'),_0x4c4d('0x30')]},'userProfileId':_0x25488e[_0x4c4d('0x7d')]['userProfileId']},'raw':!![]})[_0x4c4d('0x1d')](function(_0x8f357c){if(_[_0x4c4d('0x87')](_0x8f357c)||!_[_0x4c4d('0x85')](_0x8f357c,[_0x4c4d('0x83'),0x0]))return _0x48554f;_0x9adbf=[];var _0xcb6670=_(_0x8f357c)['map'](function(_0x1d0e98){if(_0x1d0e98['autoAssociation']===0x1)return;return _0x1d0e98[_0x4c4d('0x36')]===_0x4c4d('0x2f')?_0x4c4d('0x29'):_0x4c4d('0x31');})[_0x4c4d('0x88')]()[_0x4c4d('0x34')]();for(var _0x9a1158=0x0;_0x9a1158<_0x48554f[_0x4c4d('0x6a')];_0x9a1158++){if(!_[_0x4c4d('0x35')](_0xcb6670,_0x48554f[_0x9a1158][_0x4c4d('0x2d')]))return;var _0x2fbd4c=_0x48554f[_0x9a1158][_0x4c4d('0x2d')]===_0x4c4d('0x29')?'Agents':_0x4c4d('0x30');_0x9adbf[_0x4c4d('0x4b')](db[_0x4c4d('0x37')][_0x4c4d('0x7c')]({'name':_0x48554f[_0x9a1158][_0x4c4d('0x36')],'resourceId':_0x48554f[_0x9a1158]['id'],'type':_0x2fbd4c,'sectionId':_['find'](_0x8f357c,[_0x4c4d('0x36'),_0x2fbd4c])['id']},{}));}return Promise['all'](_0x9adbf);});})['then'](respondWithResult(_0x435b4e,0xc9))[_0x4c4d('0x28')](handleError(_0x435b4e,null));};exports['changePassword']=function(_0x27ad44,_0x5f59cf){if(_0x27ad44['body']['id']){delete _0x27ad44['body']['id'];}return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x27ad44[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](function(_0x57f7c2){if(!_0x57f7c2)return null;if(_0x57f7c2['id']===_0x27ad44[_0x4c4d('0x7d')]['id']){if(!_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x89')]||!_0x27ad44['body'][_0x4c4d('0x8a')]){throw new db[(_0x4c4d('0x8b'))]['ValidationError'](_0x4c4d('0x8c'));}if(!_0x57f7c2[_0x4c4d('0x8d')](_0x27ad44['body']['oldPassword'])){throw new db['Sequelize'][(_0x4c4d('0x8e'))](_0x4c4d('0x8f'));}if(_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x89')]===_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')]){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))]('New\x20password\x20must\x20be\x20different\x20from\x20old\x20password');}}else if(_0x27ad44[_0x4c4d('0x7d')]['role']==='admin'){if(!_0x27ad44[_0x4c4d('0x5a')]['newPassword']){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x90'));}}else if(_0x27ad44[_0x4c4d('0x7d')][_0x4c4d('0x2d')]==='user'){if(!_0x27ad44['body'][_0x4c4d('0x8a')]){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x90'));}if(_0x57f7c2[_0x4c4d('0x2d')]!==_0x4c4d('0x29')){throw new db['Sequelize']['ValidationError'](_0x4c4d('0x91'));}}else{throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))]('Unauthorized');}return _0x57f7c2;})['then'](handleEntityNotFound(_0x5f59cf,null))[_0x4c4d('0x1d')](function(_0x274e5e){return db['Setting'][_0x4c4d('0x92')]({'attributes':['id','securePassword',_0x4c4d('0x93'),_0x4c4d('0x94')]})[_0x4c4d('0x1d')](function(_0x5b0135){if(_0x5b0135[_0x4c4d('0x61')])authService[_0x4c4d('0x62')](_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')]);if(!_0x5b0135['enforcePasswordHistory']||!_0x274e5e[_0x4c4d('0x95')])return _0x274e5e;authService[_0x4c4d('0x96')](_0x27ad44['body']['newPassword'],_0x274e5e['previousPasswords'],_0x5b0135['passwordHistoryLimit']);return _0x274e5e;})[_0x4c4d('0x1d')](saveUpdates({'password':_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')],'passwordResetAt':_0x27ad44[_0x4c4d('0x7d')]['id']==_0x27ad44['params']['id']?moment():null,'previousPasswords':authService[_0x4c4d('0x97')](_0x27ad44[_0x4c4d('0x5a')][_0x4c4d('0x8a')],_0x274e5e[_0x4c4d('0x95')])},null));})['then'](respondWithResult(_0x5f59cf,null))['catch'](handleError(_0x5f59cf,null));};exports[_0x4c4d('0x98')]=function(_0x3d77d2,_0x51b6c4){var _0x45e9e4=_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0x99')];return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x3d77d2[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d'),_0x4c4d('0x9a'),_0x4c4d('0x9b'),_0x4c4d('0x9c'),_0x4c4d('0x9d')]})['then'](handleEntityNotFound(_0x51b6c4,null))[_0x4c4d('0x1d')](function(_0x3556cf){if(_0x3556cf){if(!utils[_0x4c4d('0x9e')](_0x45e9e4)){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x9f'));}return _0x3556cf[_0x4c4d('0xa0')+_[_0x4c4d('0xa1')](_0x45e9e4[_0x4c4d('0xa2')]())+_0x4c4d('0xa3')](_0x3d77d2['body']['ids'],{'penalty':_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0xa4')]||0x0})[_0x4c4d('0xa5')](function(_0xcdfe03){for(var _0x209706=0x0;_0x209706<_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0x5d')]['length'];_0x209706+=0x1){var _0x3903a0={'UserId':Number(_0x3d77d2['params']['id'])};_0x3903a0[_[_0x4c4d('0xa1')](_0x45e9e4[_0x4c4d('0xa2')]())+'QueueId']=Number(_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0x5d')][_0x209706]);socket['emit']('user'+_[_0x4c4d('0xa1')](_0x45e9e4[_0x4c4d('0xa2')]())+'Queue:save',_0x3903a0);}return _0xcdfe03;})[_0x4c4d('0x1d')](function(){if(_0x45e9e4===_0x4c4d('0xa6')){return db['VoiceQueue'][_0x4c4d('0x86')]({'where':{'id':_0x3d77d2[_0x4c4d('0x5a')]['ids']||[]},'raw':!![],'attributes':['id',_0x4c4d('0x36')]});}})['then'](function(_0x45f09d){var _0x201d32=_0x3556cf[_0x4c4d('0x2c')]({'plain':!![]});var _0x3e55f6=[];if(_0x45e9e4===_0x4c4d('0xa6')&&_0x201d32[_0x4c4d('0x2d')]==='agent'&&_0x201d32[_0x4c4d('0x9a')]){for(let _0x541e38=0x0;_0x541e38<_0x45f09d[_0x4c4d('0x6a')];_0x541e38+=0x1){_0x3e55f6[_0x4c4d('0x4b')]({'membername':_0x201d32[_0x4c4d('0x36')],'UserId':_0x201d32['id'],'queue_name':_0x45f09d[_0x541e38][_0x4c4d('0x36')],'VoiceQueueId':_0x45f09d[_0x541e38]['id'],'interface':_[_0x4c4d('0x64')](_0x201d32[_0x4c4d('0x9d')])?util[_0x4c4d('0xa7')](_0x4c4d('0xa8'),_0x201d32[_0x4c4d('0x36')]):_0x201d32['interface'],'paused':_0x201d32[_0x4c4d('0x9c')]||![],'penalty':_0x3d77d2[_0x4c4d('0x5a')][_0x4c4d('0xa4')]||0x0});}return Promise[_0x4c4d('0x53')](_0x3e55f6['map'](function(_0x36569){return db[_0x4c4d('0xa9')][_0x4c4d('0xaa')](_0x36569);}));}return _0x3556cf;});}})[_0x4c4d('0x1d')](respondWithStatusCode(_0x51b6c4,null))[_0x4c4d('0x28')](handleError(_0x51b6c4,null));};exports[_0x4c4d('0xab')]=function(_0x3c0df6,_0x45edcb){var _0x577a84,_0x16ffc9;return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x3c0df6['params']['id']},'attributes':['id',_0x4c4d('0x36'),'role']})[_0x4c4d('0x1d')](handleEntityNotFound(_0x45edcb,null))[_0x4c4d('0x1d')](function(_0x397fa1){if(_0x397fa1){_0x577a84=_0x397fa1;if(!_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')]||!utils[_0x4c4d('0x9e')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')])){throw new db['Sequelize'][(_0x4c4d('0x8e'))]('Unknown\x20channel');}return _0x397fa1[_0x4c4d('0xac')+_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')][_0x4c4d('0xa2')]())+'Queues'](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x5d')]);}})['then'](function(_0x25e28e){if(_[_0x4c4d('0xad')](_0x3c0df6[_0x4c4d('0x45')]['ids'])){for(var _0x38e085=0x0;_0x38e085<_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x5d')][_0x4c4d('0x6a')];_0x38e085+=0x1){_0x16ffc9={'UserId':Number(_0x3c0df6[_0x4c4d('0x54')]['id'])};_0x16ffc9[_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')]['channel'][_0x4c4d('0xa2')]())+_0x4c4d('0xae')]=Number(_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x5d')][_0x38e085]);socket[_0x4c4d('0xaf')](_0x4c4d('0x7d')+_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')][_0x4c4d('0xa2')]())+_0x4c4d('0xb0'),_0x16ffc9);}}else{_0x16ffc9={'UserId':Number(_0x3c0df6[_0x4c4d('0x54')]['id'])};_0x16ffc9[_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')]['channel'][_0x4c4d('0xa2')]())+_0x4c4d('0xae')]=Number(_0x3c0df6['query'][_0x4c4d('0x5d')]);socket[_0x4c4d('0xaf')](_0x4c4d('0x7d')+_[_0x4c4d('0xa1')](_0x3c0df6[_0x4c4d('0x45')][_0x4c4d('0x99')][_0x4c4d('0xa2')]())+'Queue:remove',_0x16ffc9);}return _0x25e28e;})['then'](function(){if(_0x3c0df6['query']['channel']===_0x4c4d('0xa6')){return db[_0x4c4d('0xa9')]['destroy']({'where':{'UserId':_0x3c0df6[_0x4c4d('0x54')]['id'],'VoiceQueueId':_0x3c0df6['query'][_0x4c4d('0x5d')]},'individualHooks':!![]})[_0x4c4d('0x1d')](function(){return _0x577a84;});}return _0x577a84;})[_0x4c4d('0x1d')](respondWithStatusCode(_0x45edcb,null))[_0x4c4d('0x28')](handleError(_0x45edcb,null));};exports[_0x4c4d('0xb1')]=function(_0x4c54cf,_0x1599cc){_0x4c54cf[_0x4c4d('0x5a')][_0x4c4d('0xb2')]=_0x4c54cf[_0x4c4d('0xb3')][_0x4c4d('0xb4')];return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x4c54cf[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x1599cc,null))[_0x4c4d('0x1d')](saveUpdates(_0x4c54cf[_0x4c4d('0x5a')],null))[_0x4c4d('0x1d')](respondWithResult(_0x1599cc,null))[_0x4c4d('0x28')](handleError(_0x1599cc,null));};exports[_0x4c4d('0xb5')]=function(_0x4f79bc,_0x471bb2){var _0x48d4b6=path['join'](config['root'],'server/files/images/logos/default_profile.png');return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x4f79bc[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0xb2')],'raw':!![]})[_0x4c4d('0x1d')](handleEntityNotFound(_0x471bb2,null))[_0x4c4d('0x1d')](function(_0x3ec0ce){if(_0x3ec0ce){if(_[_0x4c4d('0x64')](_0x3ec0ce['userpic'])){return _0x471bb2['download'](_0x48d4b6);}else{if(!fs[_0x4c4d('0xb6')](path[_0x4c4d('0xb7')](config[_0x4c4d('0xb8')],'server/files/images/',_0x3ec0ce[_0x4c4d('0xb2')]))){return _0x471bb2[_0x4c4d('0xb9')](_0x48d4b6);}return _0x471bb2[_0x4c4d('0xb9')](path[_0x4c4d('0xb7')](config[_0x4c4d('0xb8')],'server/files/images/',_0x3ec0ce[_0x4c4d('0xb2')]));}}})[_0x4c4d('0x28')](handleError(_0x471bb2,null));};exports[_0x4c4d('0xba')]=function(_0x3f3c85,_0x209816){return db[_0x4c4d('0x3a')]['find']({'where':{'id':_0x3f3c85[_0x4c4d('0x54')]['id']},'attributes':['id']})[_0x4c4d('0x1d')](handleEntityNotFound(_0x209816,null))[_0x4c4d('0x1d')](function(_0x192caf){var _0x147396=[];values=_0x192caf[_0x4c4d('0x4f')];_0x147396[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x4d'),_0x192caf['dataValues']));_0x147396['push'](get_open_tabs('sms',_0x192caf['dataValues']));_0x147396['push'](get_open_tabs(_0x4c4d('0xbb'),_0x192caf['dataValues']));_0x147396[_0x4c4d('0x4b')](get_open_tabs('whatsapp',_0x192caf['dataValues']));_0x147396[_0x4c4d('0x4b')](get_open_tabs(_0x4c4d('0x59'),_0x192caf[_0x4c4d('0x4f')]));_0x147396['push'](get_open_tabs(_0x4c4d('0x51'),_0x192caf['dataValues']));return Promise[_0x4c4d('0x53')](_0x147396);})[_0x4c4d('0x1d')](function(_0x22fc05){if(_0x22fc05){var _0x941d68=_[_0x4c4d('0x3c')](values[_0x4c4d('0xbc')],function(_0x3bb3eb){return{'channel':'CHAT','id':_0x3bb3eb['id'],'createdAt':_0x3bb3eb[_0x4c4d('0xbd')]};});var _0x3b11e0=_['map'](values['FaxOpenTabs'],function(_0x374fa7){return{'channel':_0x4c4d('0xbe'),'id':_0x374fa7['id'],'createdAt':_0x374fa7[_0x4c4d('0xbd')]};});var _0x4c81de=_[_0x4c4d('0x3c')](values['OpenchannelOpenTabs'],function(_0x446803){return{'channel':_0x4c4d('0xbf'),'id':_0x446803['id'],'createdAt':_0x446803[_0x4c4d('0xbd')]};});var _0x54507c=_['map'](values[_0x4c4d('0xc0')],function(_0x128ad9){return{'channel':_0x4c4d('0xc1'),'id':_0x128ad9['id'],'createdAt':_0x128ad9[_0x4c4d('0xbd')]};});var _0x79105c=_['map'](values['SmsOpenTabs'],function(_0x24bf0f){return{'channel':'SMS','id':_0x24bf0f['id'],'createdAt':_0x24bf0f[_0x4c4d('0xbd')]};});var _0x58f2fc=_[_0x4c4d('0x3c')](values[_0x4c4d('0xc2')],function(_0x56986c){return{'channel':_0x4c4d('0xc3'),'id':_0x56986c['id'],'createdAt':_0x56986c['createdAt']};});var _0x4738a3=_['concat'](_0x941d68,_0x3b11e0,_0x4c81de,_0x54507c,_0x79105c,_0x58f2fc);var _0x1bb588={'count':_0x4738a3['length'],'rows':_0x4738a3};return _0x1bb588;}else return null;})[_0x4c4d('0x1d')](respondWithResult(_0x209816,null))['catch'](handleError(_0x209816,null));};exports[_0x4c4d('0xc4')]=function(_0x20cb49,_0x34ddd3){var _0x2e4925={};return db[_0x4c4d('0x3a')]['findOne']({'where':{'id':_0x20cb49[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](function(_0x4796e5){if(!_0x4796e5){throw new APINotFoundError(util[_0x4c4d('0xa7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x20cb49[_0x4c4d('0x54')]['id']));}return contacts['describe']();})[_0x4c4d('0x1d')](function(_0x99cf86){_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0x3a')]=_0x20cb49[_0x4c4d('0x54')]['id'];_0x2e4925=qs[_0x4c4d('0x55')](_0x99cf86,_0x20cb49);if(_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0x56'))){_0x2e4925[_0x4c4d('0x48')]=[{'model':db['CmList'],'as':'List','required':![]},{'model':db['Tag'],'as':_0x4c4d('0xc6'),'attributes':['id',_0x4c4d('0x36'),'color'],'where':_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0xc7')]?{'id':_0x20cb49[_0x4c4d('0x45')][_0x4c4d('0xc7')]}:undefined,'required':_0x20cb49['query'][_0x4c4d('0xc7')]?!![]:![]}];}return contacts[_0x4c4d('0x86')](_0x20cb49[_0x4c4d('0x45')],_0x20cb49[_0x4c4d('0x7d')],_0x2e4925,_0x99cf86);})['then'](respondWithFilteredResult(_0x34ddd3,_0x2e4925))[_0x4c4d('0x28')](APIHandleError(_0x34ddd3));};exports[_0x4c4d('0xc8')]=function(_0x3ac28e,_0x1b44de){var _0x436302;var _0x5d262d={};var _0x158238;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x3ac28e[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d')]})[_0x4c4d('0x1d')](handleEntityNotFound(_0x1b44de,null))[_0x4c4d('0x1d')](function(_0xa0f449){if(!utils[_0x4c4d('0x9e')](_0x3ac28e[_0x4c4d('0x45')]['channel'])){throw new db[(_0x4c4d('0x8b'))][(_0x4c4d('0x8e'))](_0x4c4d('0x9f'));}_0x436302=_0xa0f449;var _0x577d3f={};_0x577d3f[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_[_0x4c4d('0xa1')](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0x99')])+_0x4c4d('0xcb')][_0x4c4d('0x3b')]);_0x577d3f[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x3ac28e['query']);_0x577d3f[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x577d3f['model'],_0x577d3f[_0x4c4d('0x45')]);_0x5d262d[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x577d3f[_0x4c4d('0xc9')],qs['fields'](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x5d262d[_0x4c4d('0x4a')]=_0x5d262d[_0x4c4d('0x4a')]['length']?_0x5d262d[_0x4c4d('0x4a')]:_0x577d3f['model'];_0x5d262d['order']=qs[_0x4c4d('0xcf')](_0x3ac28e['query'][_0x4c4d('0xcf')]);_0x5d262d[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x3ac28e['query'],_0x577d3f['filters']));if(_0x3ac28e['query'][_0x4c4d('0x32')]){_0x5d262d[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x5d262d[_0x4c4d('0xd0')],{'$or':_['map'](_0x5d262d[_0x4c4d('0x4a')],function(_0x568f4d){var _0xce644={};_0xce644[_0x568f4d]={'$like':'%'+_0x3ac28e['query'][_0x4c4d('0x32')]+'%'};return _0xce644;})});}_0x5d262d=_[_0x4c4d('0xd2')]({},_0x5d262d,_0x3ac28e[_0x4c4d('0x57')]);switch(_0x436302['role']){case _0x4c4d('0x2e'):return db[_['capitalize'](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0x99')])+_0x4c4d('0xcb')]['findAll'](_0x5d262d);case _0x4c4d('0x7d'):case _0x4c4d('0x29'):return _0x436302['get'+_[_0x4c4d('0xa1')](_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0x99')])+_0x4c4d('0xa3')](_0x5d262d);default:throw new db[(_0x4c4d('0x8b'))]['ValidationError'](_0x4c4d('0xd3'));}})['then'](function(_0x74dfd6){_0x158238=_0x74dfd6[_0x4c4d('0x6a')];if(!_0x3ac28e[_0x4c4d('0x45')][_0x4c4d('0xc5')]('nolimit')){_0x5d262d[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x3ac28e[_0x4c4d('0x45')]['limit']);_0x5d262d['offset']=qs['offset'](_0x3ac28e[_0x4c4d('0x45')]['offset']);}switch(_0x436302[_0x4c4d('0x2d')]){case _0x4c4d('0x2e'):return db[_[_0x4c4d('0xa1')](_0x3ac28e['query'][_0x4c4d('0x99')])+_0x4c4d('0xcb')][_0x4c4d('0x86')](_0x5d262d);case _0x4c4d('0x7d'):case _0x4c4d('0x29'):return _0x436302[_0x4c4d('0x2c')+_[_0x4c4d('0xa1')](_0x3ac28e['query'][_0x4c4d('0x99')])+'Queues'](_0x5d262d);}})[_0x4c4d('0x1d')](function(_0x5b2606){return{'count':_0x158238,'rows':_0x5b2606};})['then'](respondWithResult(_0x1b44de,null))['catch'](handleError(_0x1b44de,null));};exports['getVoiceQueuesRt']=function(_0xf9a7a0,_0x234b5c){var _0x34b81f={};var _0x2a3db3={};var _0xdc19b9;var _0x555fc3;return db['User'][_0x4c4d('0x92')]({'where':{'id':_0xf9a7a0[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x234b5c,null))[_0x4c4d('0x1d')](function(_0x5e418b){if(_0x5e418b){_0xdc19b9=_0x5e418b;_0x2a3db3['model']=_['keys'](db['UserVoiceQueueRt'][_0x4c4d('0x3b')]);_0x2a3db3['query']=_[_0x4c4d('0xca')](_0xf9a7a0[_0x4c4d('0x45')]);_0x2a3db3[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x2a3db3[_0x4c4d('0xc9')],_0x2a3db3[_0x4c4d('0x45')]);_0x34b81f[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x2a3db3[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x34b81f[_0x4c4d('0x4a')]=_0x34b81f[_0x4c4d('0x4a')]['length']?_0x34b81f[_0x4c4d('0x4a')]:_0x2a3db3[_0x4c4d('0xc9')];_0x34b81f[_0x4c4d('0xd4')]=qs[_0x4c4d('0xcf')](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x34b81f['where']=qs['filters'](_[_0x4c4d('0xd1')](_0xf9a7a0[_0x4c4d('0x45')],_0x2a3db3[_0x4c4d('0xcc')]));if(_0xf9a7a0['query'][_0x4c4d('0x32')]){_0x34b81f[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x34b81f[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x34b81f[_0x4c4d('0x4a')],function(_0x1549d5){var _0x54cdd1={};_0x54cdd1[_0x1549d5]={'$like':'%'+_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x54cdd1;})});}_0x34b81f=_['merge']({},_0x34b81f,_0xf9a7a0[_0x4c4d('0x57')]);return _0xdc19b9[_0x4c4d('0xd5')](_0x34b81f);}})['then'](function(_0x244c0f){if(_0x244c0f){_0x555fc3=_0x244c0f[_0x4c4d('0x6a')];if(!_0xf9a7a0[_0x4c4d('0x45')]['hasOwnProperty']('nolimit')){_0x34b81f[_0x4c4d('0x19')]=qs['limit'](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x34b81f['offset']=qs[_0x4c4d('0x1a')](_0xf9a7a0[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0xdc19b9[_0x4c4d('0xd5')](_0x34b81f);}})[_0x4c4d('0x1d')](function(_0x127b6e){if(_0x127b6e){return _0x127b6e?{'count':_0x555fc3,'rows':_0x127b6e}:null;}})['then'](respondWithResult(_0x234b5c,null))['catch'](handleError(_0x234b5c,null));};exports['getGroups']=function(_0x5ce18d,_0x491909){var _0x44e57e={};var _0x427432={};var _0xe1bb28;var _0x4e1d26;return db[_0x4c4d('0x3a')]['findOne']({'where':{'id':_0x5ce18d[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x491909,null))[_0x4c4d('0x1d')](function(_0x2a84de){if(_0x2a84de){_0xe1bb28=_0x2a84de;_0x427432[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xd6')]['rawAttributes']);_0x427432[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x5ce18d[_0x4c4d('0x45')]);_0x427432[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x427432[_0x4c4d('0xc9')],_0x427432[_0x4c4d('0x45')]);_0x44e57e[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x427432[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x5ce18d[_0x4c4d('0x45')]['fields']));_0x44e57e[_0x4c4d('0x4a')]=_0x44e57e['attributes']['length']?_0x44e57e[_0x4c4d('0x4a')]:_0x427432[_0x4c4d('0xc9')];_0x44e57e['order']=qs['sort'](_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x44e57e[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x5ce18d['query'],_0x427432[_0x4c4d('0xcc')]));if(_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x44e57e[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x44e57e['where'],{'$or':_['map'](_0x44e57e[_0x4c4d('0x4a')],function(_0x15fd31){var _0x38156={};_0x38156[_0x15fd31]={'$like':'%'+_0x5ce18d[_0x4c4d('0x45')]['filter']+'%'};return _0x38156;})});}_0x44e57e=_[_0x4c4d('0xd2')]({},_0x44e57e,_0x5ce18d[_0x4c4d('0x57')]);return _0xe1bb28[_0x4c4d('0xd7')](_0x44e57e);}})['then'](function(_0x2b26a9){if(_0x2b26a9){_0x4e1d26=_0x2b26a9[_0x4c4d('0x6a')];if(!_0x5ce18d['query']['hasOwnProperty']('nolimit')){_0x44e57e[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x44e57e[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x5ce18d[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0xe1bb28[_0x4c4d('0xd7')](_0x44e57e);}})[_0x4c4d('0x1d')](function(_0x125f65){if(_0x125f65){return _0x125f65?{'count':_0x4e1d26,'rows':_0x125f65}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x491909,null))[_0x4c4d('0x28')](handleError(_0x491909,null));};exports[_0x4c4d('0xd8')]=function(_0x4f6da5,_0x5736c3){var _0x430bbd={'raw':!![],'where':{}};var _0xec2f54={};var _0x57815d={'count':0x0,'rows':[]};return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x4f6da5[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x5736c3,null))[_0x4c4d('0x1d')](function(_0x437efc){if(_0x437efc){_0xec2f54['model']=_['keys'](db['VoiceRecording'][_0x4c4d('0x3b')]);_0xec2f54['query']=_[_0x4c4d('0xca')](_0x4f6da5['query']);_0xec2f54[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0xec2f54['model'],_0xec2f54[_0x4c4d('0x45')]);_0x430bbd[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0xec2f54[_0x4c4d('0xc9')],qs['fields'](_0x4f6da5[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x430bbd[_0x4c4d('0x4a')]=_0x430bbd['attributes'][_0x4c4d('0x6a')]?_0x430bbd[_0x4c4d('0x4a')]:_0xec2f54['model'];if(!_0x4f6da5['query'][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x430bbd[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x4f6da5[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x430bbd[_0x4c4d('0x1a')]=qs['offset'](_0x4f6da5[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}_0x430bbd[_0x4c4d('0xd4')]=qs['sort'](_0x4f6da5[_0x4c4d('0x45')]['sort']);_0x430bbd[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x4f6da5[_0x4c4d('0x45')],_0xec2f54[_0x4c4d('0xcc')]));_0x430bbd[_0x4c4d('0xd0')]['UserId']=_0x437efc['id'];if(_0x4f6da5[_0x4c4d('0x45')]['filter']){_0x430bbd[_0x4c4d('0xd0')]=_['merge'](_0x430bbd['where'],{'$or':_[_0x4c4d('0x3c')](_0x430bbd[_0x4c4d('0x4a')],function(_0x940941){var _0x1d65ae={};_0x1d65ae[_0x940941]={'$like':'%'+_0x4f6da5['query'][_0x4c4d('0x32')]+'%'};return _0x1d65ae;})});}_0x430bbd=_['merge']({},_0x430bbd,_0x4f6da5[_0x4c4d('0x57')]);return db[_0x4c4d('0xda')][_0x4c4d('0x44')]({'where':_0x430bbd[_0x4c4d('0xd0')]})['then'](function(_0x2b95f2){_0x57815d[_0x4c4d('0x44')]=_0x2b95f2;if(_0x4f6da5[_0x4c4d('0x45')]['includeAll']){_0x430bbd['include']=[{'all':!![]}];}return db[_0x4c4d('0xda')][_0x4c4d('0x86')](_0x430bbd);})[_0x4c4d('0x1d')](function(_0x46621a){_0x57815d[_0x4c4d('0x4e')]=_0x46621a;return _0x57815d;});}})['then'](respondWithFilteredResult(_0x5736c3,_0x430bbd))[_0x4c4d('0x28')](handleError(_0x5736c3,null));};exports['getScreenRecordings']=function(_0x4cd514,_0x5b7491){var _0x4cd334={'raw':!![],'where':{}};var _0x1f27b6={};var _0x481f6c={'count':0x0,'rows':[]};return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x4cd514[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x5b7491,null))[_0x4c4d('0x1d')](function(_0x52195e){if(_0x52195e){_0x1f27b6[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xdb')]['rawAttributes']);_0x1f27b6[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x4cd514[_0x4c4d('0x45')]);_0x1f27b6[_0x4c4d('0xcc')]=_['intersection'](_0x1f27b6[_0x4c4d('0xc9')],_0x1f27b6[_0x4c4d('0x45')]);_0x4cd334[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x1f27b6[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x4cd334[_0x4c4d('0x4a')]=_0x4cd334['attributes'][_0x4c4d('0x6a')]?_0x4cd334['attributes']:_0x1f27b6[_0x4c4d('0xc9')];if(!_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x4cd334[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x4cd334[_0x4c4d('0x1a')]=qs['offset'](_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}_0x4cd334['order']=qs[_0x4c4d('0xcf')](_0x4cd514[_0x4c4d('0x45')]['sort']);_0x4cd334[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_['pick'](_0x4cd514[_0x4c4d('0x45')],_0x1f27b6[_0x4c4d('0xcc')]));_0x4cd334[_0x4c4d('0xd0')][_0x4c4d('0xdc')]=_0x52195e['id'];if(_0x4cd514[_0x4c4d('0x45')]['filter']){_0x4cd334[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x4cd334[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x4cd334['attributes'],function(_0x5ae7eb){var _0xf2566d={};_0xf2566d[_0x5ae7eb]={'$like':'%'+_0x4cd514['query'][_0x4c4d('0x32')]+'%'};return _0xf2566d;})});}_0x4cd334=_[_0x4c4d('0xd2')]({},_0x4cd334,_0x4cd514[_0x4c4d('0x57')]);return db[_0x4c4d('0xdb')][_0x4c4d('0x44')]({'where':_0x4cd334[_0x4c4d('0xd0')]})[_0x4c4d('0x1d')](function(_0x1265da){_0x481f6c['count']=_0x1265da;if(_0x4cd514[_0x4c4d('0x45')][_0x4c4d('0x56')]){_0x4cd334[_0x4c4d('0x48')]=[{'all':!![]}];}return db['ScreenRecording'][_0x4c4d('0x86')](_0x4cd334);})[_0x4c4d('0x1d')](function(_0x377ce3){_0x481f6c['rows']=_0x377ce3;return _0x481f6c;});}})[_0x4c4d('0x1d')](respondWithFilteredResult(_0x5b7491,_0x4cd334))[_0x4c4d('0x28')](handleError(_0x5b7491,null));};exports[_0x4c4d('0xdd')]=function(_0x3bbd7c,_0x562d1e){var _0x4b2dd5={};var _0x116460={};var _0x45fd20;var _0x802440;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x3bbd7c['params']['id']}})['then'](handleEntityNotFound(_0x562d1e,null))[_0x4c4d('0x1d')](function(_0x50d899){if(_0x50d899){_0x45fd20=_0x50d899;_0x116460[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xde')][_0x4c4d('0x3b')]);_0x116460['query']=_['keys'](_0x3bbd7c[_0x4c4d('0x45')]);_0x116460['filters']=_['intersection'](_0x116460[_0x4c4d('0xc9')],_0x116460['query']);_0x4b2dd5[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x116460[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x3bbd7c[_0x4c4d('0x45')]['fields']));_0x4b2dd5[_0x4c4d('0x4a')]=_0x4b2dd5['attributes'][_0x4c4d('0x6a')]?_0x4b2dd5[_0x4c4d('0x4a')]:_0x116460[_0x4c4d('0xc9')];_0x4b2dd5['order']=qs[_0x4c4d('0xcf')](_0x3bbd7c['query'][_0x4c4d('0xcf')]);_0x4b2dd5[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x3bbd7c[_0x4c4d('0x45')],_0x116460[_0x4c4d('0xcc')]));if(_0x3bbd7c['query'][_0x4c4d('0x32')]){_0x4b2dd5[_0x4c4d('0xd0')]=_['merge'](_0x4b2dd5[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x4b2dd5[_0x4c4d('0x4a')],function(_0x1cfc28){var _0x12ceb8={};_0x12ceb8[_0x1cfc28]={'$like':'%'+_0x3bbd7c[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x12ceb8;})});}_0x4b2dd5=_['merge']({},_0x4b2dd5,_0x3bbd7c['options']);return _0x45fd20[_0x4c4d('0xdd')](_0x4b2dd5);}})[_0x4c4d('0x1d')](function(_0x31c56a){if(_0x31c56a){_0x802440=_0x31c56a[_0x4c4d('0x6a')];if(!_0x3bbd7c[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x4b2dd5['limit']=qs['limit'](_0x3bbd7c[_0x4c4d('0x45')]['limit']);_0x4b2dd5[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x3bbd7c[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x45fd20[_0x4c4d('0xdd')](_0x4b2dd5);}})[_0x4c4d('0x1d')](function(_0x12c467){if(_0x12c467){return _0x12c467?{'count':_0x802440,'rows':_0x12c467}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x562d1e,null))[_0x4c4d('0x28')](handleError(_0x562d1e,null));};exports['getOpenchannelInteractions']=function(_0x4bff49,_0xab8424){var _0x56bf11={};var _0x1a471a={};var _0x3c5a71;var _0x49fbf1;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x4bff49[_0x4c4d('0x54')]['id']}})['then'](handleEntityNotFound(_0xab8424,null))[_0x4c4d('0x1d')](function(_0xa48f19){if(_0xa48f19){_0x3c5a71=_0xa48f19;_0x1a471a[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xdf')][_0x4c4d('0x3b')]);_0x1a471a['query']=_[_0x4c4d('0xca')](_0x4bff49[_0x4c4d('0x45')]);_0x1a471a[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x1a471a[_0x4c4d('0xc9')],_0x1a471a[_0x4c4d('0x45')]);_0x56bf11[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x1a471a[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x56bf11['attributes']=_0x56bf11[_0x4c4d('0x4a')]['length']?_0x56bf11[_0x4c4d('0x4a')]:_0x1a471a[_0x4c4d('0xc9')];_0x56bf11[_0x4c4d('0xd4')]=qs['sort'](_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x56bf11[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x4bff49['query'],_0x1a471a[_0x4c4d('0xcc')]));if(_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x56bf11[_0x4c4d('0xd0')]=_['merge'](_0x56bf11[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x56bf11[_0x4c4d('0x4a')],function(_0x31e77c){var _0x4ed1e1={};_0x4ed1e1[_0x31e77c]={'$like':'%'+_0x4bff49[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x4ed1e1;})});}_0x56bf11=_[_0x4c4d('0xd2')]({},_0x56bf11,_0x4bff49[_0x4c4d('0x57')]);return _0x3c5a71['getOpenchannelInteractions'](_0x56bf11);}})['then'](function(_0x42ea71){if(_0x42ea71){_0x49fbf1=_0x42ea71[_0x4c4d('0x6a')];if(!_0x4bff49[_0x4c4d('0x45')]['hasOwnProperty'](_0x4c4d('0xd9'))){_0x56bf11[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x4bff49['query'][_0x4c4d('0x19')]);_0x56bf11[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x4bff49[_0x4c4d('0x45')]['offset']);}return _0x3c5a71[_0x4c4d('0xe0')](_0x56bf11);}})[_0x4c4d('0x1d')](function(_0x5288a8){if(_0x5288a8){return _0x5288a8?{'count':_0x49fbf1,'rows':_0x5288a8}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0xab8424,null))[_0x4c4d('0x28')](handleError(_0xab8424,null));};exports[_0x4c4d('0xe1')]=function(_0x309c8f,_0x35b019){var _0x4dfdbc={'raw':!![],'where':{}};var _0x29e085={};var _0x5098a2={'count':0x0,'rows':[]};return db['User'][_0x4c4d('0x92')]({'where':{'id':_0x309c8f[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x35b019,null))[_0x4c4d('0x1d')](function(_0xf630d1){if(_0xf630d1){_0x29e085['model']=_['keys'](db['MailInteraction']['rawAttributes']);_0x29e085[_0x4c4d('0x45')]=_['keys'](_0x309c8f[_0x4c4d('0x45')]);_0x29e085[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x29e085[_0x4c4d('0xc9')],_0x29e085['query']);_0x4dfdbc[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x29e085[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x309c8f[_0x4c4d('0x45')]['fields']));_0x4dfdbc['attributes']=_0x4dfdbc[_0x4c4d('0x4a')][_0x4c4d('0x6a')]?_0x4dfdbc[_0x4c4d('0x4a')]:_0x29e085[_0x4c4d('0xc9')];if(!_0x309c8f['query'][_0x4c4d('0xc5')]('nolimit')){_0x4dfdbc['limit']=qs[_0x4c4d('0x19')](_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x4dfdbc[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x309c8f[_0x4c4d('0x45')]['offset']);}_0x4dfdbc[_0x4c4d('0xd4')]=qs['sort'](_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x4dfdbc['where']=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x309c8f[_0x4c4d('0x45')],_0x29e085[_0x4c4d('0xcc')]));_0x4dfdbc['where'][_0x4c4d('0xdc')]=_0xf630d1['id'];if(_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x4dfdbc[_0x4c4d('0xd0')]=_['merge'](_0x4dfdbc['where'],{'$or':_['map'](_0x4dfdbc[_0x4c4d('0x4a')],function(_0x24f1b6){var _0x632ec6={};_0x632ec6[_0x24f1b6]={'$like':'%'+_0x309c8f[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x632ec6;})});}_0x4dfdbc=_[_0x4c4d('0xd2')]({},_0x4dfdbc,_0x309c8f['options']);return db['MailInteraction'][_0x4c4d('0x44')]({'where':_0x4dfdbc[_0x4c4d('0xd0')]})[_0x4c4d('0x1d')](function(_0x3fee53){_0x5098a2[_0x4c4d('0x44')]=_0x3fee53;if(_0x309c8f['query']['includeAll']){_0x4dfdbc[_0x4c4d('0x48')]=[{'all':!![]}];}return db['MailInteraction'][_0x4c4d('0x86')](_0x4dfdbc);})['then'](function(_0x53e802){_0x5098a2[_0x4c4d('0x4e')]=_0x53e802;return _0x5098a2;});}})[_0x4c4d('0x1d')](respondWithFilteredResult(_0x35b019,_0x4dfdbc))[_0x4c4d('0x28')](handleError(_0x35b019,null));};exports[_0x4c4d('0xe2')]=function(_0x13ad06,_0xe8514){var _0x3853f3={};var _0x31f046={};var _0x29a5bf;var _0x56720a;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x13ad06['params']['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0xe8514,null))[_0x4c4d('0x1d')](function(_0x147b57){if(_0x147b57){_0x29a5bf=_0x147b57;_0x31f046[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xe3')][_0x4c4d('0x3b')]);_0x31f046[_0x4c4d('0x45')]=_['keys'](_0x13ad06[_0x4c4d('0x45')]);_0x31f046['filters']=_[_0x4c4d('0xcd')](_0x31f046[_0x4c4d('0xc9')],_0x31f046[_0x4c4d('0x45')]);_0x3853f3[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x31f046[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x3853f3[_0x4c4d('0x4a')]=_0x3853f3[_0x4c4d('0x4a')]['length']?_0x3853f3[_0x4c4d('0x4a')]:_0x31f046[_0x4c4d('0xc9')];_0x3853f3[_0x4c4d('0xd4')]=qs[_0x4c4d('0xcf')](_0x13ad06[_0x4c4d('0x45')]['sort']);_0x3853f3[_0x4c4d('0xd0')]=qs['filters'](_[_0x4c4d('0xd1')](_0x13ad06['query'],_0x31f046[_0x4c4d('0xcc')]));if(_0x13ad06[_0x4c4d('0x45')]['filter']){_0x3853f3[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x3853f3['where'],{'$or':_[_0x4c4d('0x3c')](_0x3853f3['attributes'],function(_0x1fac49){var _0x223c19={};_0x223c19[_0x1fac49]={'$like':'%'+_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x223c19;})});}_0x3853f3=_[_0x4c4d('0xd2')]({},_0x3853f3,_0x13ad06[_0x4c4d('0x57')]);return _0x29a5bf[_0x4c4d('0xe2')](_0x3853f3);}})['then'](function(_0x293ce5){if(_0x293ce5){_0x56720a=_0x293ce5[_0x4c4d('0x6a')];if(!_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x3853f3['limit']=qs[_0x4c4d('0x19')](_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x3853f3[_0x4c4d('0x1a')]=qs['offset'](_0x13ad06[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x29a5bf['getSmsInteractions'](_0x3853f3);}})[_0x4c4d('0x1d')](function(_0x2b7d9d){if(_0x2b7d9d){return _0x2b7d9d?{'count':_0x56720a,'rows':_0x2b7d9d}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0xe8514,null))[_0x4c4d('0x28')](handleError(_0xe8514,null));};exports[_0x4c4d('0xe4')]=function(_0x42f4ae,_0x5f57bd){var _0x4616e2={};var _0x5e188f={};var _0x5f3c04;var _0x623609;return db[_0x4c4d('0x3a')]['findOne']({'where':{'id':_0x42f4ae[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x5f57bd,null))[_0x4c4d('0x1d')](function(_0x401c6c){if(_0x401c6c){_0x5f3c04=_0x401c6c;_0x5e188f[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0xe5')][_0x4c4d('0x3b')]);_0x5e188f[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x42f4ae[_0x4c4d('0x45')]);_0x5e188f[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x5e188f[_0x4c4d('0xc9')],_0x5e188f[_0x4c4d('0x45')]);_0x4616e2[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x5e188f[_0x4c4d('0xc9')],qs['fields'](_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x4616e2[_0x4c4d('0x4a')]=_0x4616e2['attributes'][_0x4c4d('0x6a')]?_0x4616e2[_0x4c4d('0x4a')]:_0x5e188f[_0x4c4d('0xc9')];_0x4616e2[_0x4c4d('0xd4')]=qs['sort'](_0x42f4ae['query'][_0x4c4d('0xcf')]);_0x4616e2[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_['pick'](_0x42f4ae['query'],_0x5e188f['filters']));if(_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x4616e2['where']=_[_0x4c4d('0xd2')](_0x4616e2[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x4616e2[_0x4c4d('0x4a')],function(_0x57bc15){var _0x4a2b16={};_0x4a2b16[_0x57bc15]={'$like':'%'+_0x42f4ae[_0x4c4d('0x45')]['filter']+'%'};return _0x4a2b16;})});}_0x4616e2=_[_0x4c4d('0xd2')]({},_0x4616e2,_0x42f4ae['options']);return _0x5f3c04['getFaxInteractions'](_0x4616e2);}})[_0x4c4d('0x1d')](function(_0x15d328){if(_0x15d328){_0x623609=_0x15d328['length'];if(!_0x42f4ae[_0x4c4d('0x45')]['hasOwnProperty'](_0x4c4d('0xd9'))){_0x4616e2[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x4616e2[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x42f4ae[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x5f3c04['getFaxInteractions'](_0x4616e2);}})['then'](function(_0x36fb97){if(_0x36fb97){return _0x36fb97?{'count':_0x623609,'rows':_0x36fb97}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x5f57bd,null))['catch'](handleError(_0x5f57bd,null));};exports['getWhatsappInteractions']=function(_0x3de502,_0x4a6fdd){var _0x3d90c1={};var _0x47bc46={};var _0xb50e3b;var _0x3a0921;return db['User'][_0x4c4d('0x92')]({'where':{'id':_0x3de502['params']['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x4a6fdd,null))['then'](function(_0x5ec51f){if(_0x5ec51f){_0xb50e3b=_0x5ec51f;_0x47bc46[_0x4c4d('0xc9')]=_['keys'](db[_0x4c4d('0xe6')]['rawAttributes']);_0x47bc46[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x3de502[_0x4c4d('0x45')]);_0x47bc46[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0x47bc46['model'],_0x47bc46[_0x4c4d('0x45')]);_0x3d90c1[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x47bc46[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x3de502[_0x4c4d('0x45')]['fields']));_0x3d90c1[_0x4c4d('0x4a')]=_0x3d90c1[_0x4c4d('0x4a')]['length']?_0x3d90c1['attributes']:_0x47bc46['model'];_0x3d90c1['order']=qs['sort'](_0x3de502[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x3d90c1['where']=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x3de502[_0x4c4d('0x45')],_0x47bc46[_0x4c4d('0xcc')]));if(_0x3de502[_0x4c4d('0x45')]['filter']){_0x3d90c1[_0x4c4d('0xd0')]=_[_0x4c4d('0xd2')](_0x3d90c1[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x3d90c1[_0x4c4d('0x4a')],function(_0x50ba58){var _0x533a12={};_0x533a12[_0x50ba58]={'$like':'%'+_0x3de502[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x533a12;})});}_0x3d90c1=_['merge']({},_0x3d90c1,_0x3de502[_0x4c4d('0x57')]);return _0xb50e3b[_0x4c4d('0xe7')](_0x3d90c1);}})[_0x4c4d('0x1d')](function(_0x12a599){if(_0x12a599){_0x3a0921=_0x12a599[_0x4c4d('0x6a')];if(!_0x3de502['query'][_0x4c4d('0xc5')]('nolimit')){_0x3d90c1['limit']=qs[_0x4c4d('0x19')](_0x3de502[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x3d90c1[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x3de502['query'][_0x4c4d('0x1a')]);}return _0xb50e3b[_0x4c4d('0xe7')](_0x3d90c1);}})[_0x4c4d('0x1d')](function(_0x41540e){if(_0x41540e){return _0x41540e?{'count':_0x3a0921,'rows':_0x41540e}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x4a6fdd,null))[_0x4c4d('0x28')](handleError(_0x4a6fdd,null));};exports['login']=function(_0xb367a4,_0x27aa3c,_0x5018c9){var _0x5d2e1d;var _0x1ab3b8;var _0x12f8df;var _0x16a025=!_[_0x4c4d('0x64')](_0xb367a4[_0x4c4d('0x54')]['id'])?_0xb367a4[_0x4c4d('0x54')]['id']:!_[_0x4c4d('0x64')](_0xb367a4[_0x4c4d('0x7d')]['id'])?_0xb367a4['user']['id']:null;return db['User'][_0x4c4d('0x58')]({'where':{'id':_0x16a025,'role':{'$or':[_0x4c4d('0x2e'),_0x4c4d('0x7d'),_0x4c4d('0x29')]}},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0xe8'),_0x4c4d('0xe9'),'role','internal',_0x4c4d('0x9b')]})[_0x4c4d('0x1d')](function(_0x3664a0){if(_0x3664a0){if(_0x3664a0['role']===_0x4c4d('0x29')){_0x5d2e1d=_0x3664a0;if(_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0x9d')]){_0x12f8df=util[_0x4c4d('0xa7')]('LOCAL/%s@from-sip/n',_0x5d2e1d[_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0x9d')]]);}else if(_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0xea')]){_0x12f8df=util[_0x4c4d('0xa7')](_0x4c4d('0xa8'),_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0xea')]);}else{_0x12f8df=util[_0x4c4d('0xa7')]('SIP/%s',_0x5d2e1d[_0x4c4d('0x36')]);}socket['to'](util[_0x4c4d('0xa7')](_0x4c4d('0xeb'),_0x5d2e1d[_0x4c4d('0x36')]))[_0x4c4d('0xaf')](_0x4c4d('0xec'),{'user':{'id':_0x5d2e1d['id'],'name':_0x5d2e1d[_0x4c4d('0x36')]},'ip':_0xb367a4[_0x4c4d('0xed')][_0x4c4d('0xee')]||_0xb367a4[_0x4c4d('0xef')][_0x4c4d('0xf0')]||_0xb367a4[_0x4c4d('0xf1')][_0x4c4d('0xf0')]||_0xb367a4[_0x4c4d('0xef')]['socket'][_0x4c4d('0xf0')]});return db[_0x4c4d('0xa9')]['destroy']({'where':{'membername':_0x5d2e1d[_0x4c4d('0x36')]},'individualHooks':!![]});}}else{throw new db[(_0x4c4d('0x8b'))]['ValidationError'](_0x4c4d('0xf2'));}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){return _0x5d2e1d[_0x4c4d('0xf3')]({'raw':!![]});}})[_0x4c4d('0x1d')](function(_0x433cfc){if(_0x5d2e1d){if(_0x433cfc){_0x1ab3b8=_0x433cfc;if(_0x1ab3b8[_0x4c4d('0x6a')]){var _0x3ebfab=_0x1ab3b8[_0x4c4d('0x3c')](function(_0x584ae4){var _0x41c7f9={'membername':_0x5d2e1d[_0x4c4d('0x36')],'UserId':_0x5d2e1d['id'],'queue_name':_0x584ae4[_0x4c4d('0x36')],'VoiceQueueId':_0x584ae4['id'],'interface':_0x12f8df,'paused':_0x5d2e1d[_0x4c4d('0x9b')]||![],'penalty':_0x584ae4['UserVoiceQueue.penalty']||0x0};return db['UserVoiceQueueRt'][_0x4c4d('0xaa')](_0x41c7f9);});return Promise[_0x4c4d('0x53')](_0x3ebfab);}}}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){return db[_0x4c4d('0xf4')][_0x4c4d('0x86')]({'where':{'membername':_0x5d2e1d[_0x4c4d('0x36')],'exitAt':null}});}})['then'](function(_0x4e896b){if(_0x5d2e1d){var _0x4fa91e=[];_0x4e896b[_0x4c4d('0xf5')](function(_0x31117d){_0x4fa91e[_0x4c4d('0x4b')](_0x31117d[_0x4c4d('0xf6')]({'exitAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'))}));});return Promise[_0x4c4d('0x53')](_0x4fa91e);}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){var _0x409b96=[];var _0x596a64=[];var _0x3e639d=utils[_0x4c4d('0xf8')]();var _0x8debcb={'membername':_0x5d2e1d[_0x4c4d('0x36')],'interface':_0x12f8df,'enterAt':moment()['format'](_0x4c4d('0xf7')),'role':_0x5d2e1d[_0x4c4d('0x2d')],'internal':_0x5d2e1d['internal']};_0x3e639d[_0x4c4d('0xf5')](function(_0x58f350){_0x409b96[_0x4c4d('0x4b')](_[_0x4c4d('0xd2')]({'channel':_0x58f350,'type':_0x4c4d('0xf9'),'data1':_0xb367a4[_0x4c4d('0x5a')][_0x4c4d('0xfa')],'data2':_0x12f8df},_0x8debcb));if(_0x5d2e1d[_0x4c4d('0x9b')]){_0x596a64[_0x4c4d('0x4b')](_[_0x4c4d('0xd2')]({'channel':_0x58f350,'type':_0x4c4d('0xfb'),'data1':_0x4c4d('0xfc')},_0x8debcb));}});return db['MemberReport'][_0x4c4d('0xfd')](_0x409b96[_0x4c4d('0xfe')](_0x596a64),{'individualHooks':!![]});}})[_0x4c4d('0x1d')](function(){if(_0x5d2e1d){return _0x5d2e1d['update']({'online':!![],'lastLoginAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7')),'voicePause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'mailPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'chatPause':_0x5d2e1d['loginInPause']||![],'faxPause':_0x5d2e1d['loginInPause']||![],'smsPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'openchannelPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'whatsappPause':_0x5d2e1d[_0x4c4d('0x9b')]||![],'pauseType':_0x5d2e1d[_0x4c4d('0x9b')]?_0x4c4d('0xfc'):null,'interface':_0x12f8df,'lastPauseAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'))});}})[_0x4c4d('0x1d')](function(_0x221565){if(_0xb367a4[_0x4c4d('0xff')]){return _0x5018c9();}else{return Promise[_0x4c4d('0x100')](_0x221565)[_0x4c4d('0x1d')](respondWithResult(_0x27aa3c,null));}})['catch'](handleError(_0x27aa3c,null));};exports[_0x4c4d('0x101')]=function(_0x14b4d9,_0x3a0838){var _0x26238e;return db[_0x4c4d('0x3a')]['find']({'where':{'id':_0x14b4d9[_0x4c4d('0x54')]['id'],'role':'agent'},'attributes':['id','name',_0x4c4d('0x2d')]})['then'](handleEntityNotFound(_0x3a0838,null))[_0x4c4d('0x1d')](function(_0x334c86){if(_0x334c86){_0x26238e=_0x334c86;return db[_0x4c4d('0xa9')]['destroy']({'where':{'membername':_0x26238e['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x4c4d('0xf4')][_0x4c4d('0x86')]({'where':{'membername':_0x26238e[_0x4c4d('0x36')],'exitAt':null}});})[_0x4c4d('0x1d')](function(_0xc93d3b){var _0x559d9b=[];_0xc93d3b[_0x4c4d('0xf5')](function(_0x48c858){_0x559d9b[_0x4c4d('0x4b')](_0x48c858[_0x4c4d('0xf6')]({'exitAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'))}));});return Promise['all'](_0x559d9b);})[_0x4c4d('0x1d')](function(){return _0x26238e[_0x4c4d('0xf6')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x4c4d('0x1d')](respondWithResult(_0x3a0838,null))[_0x4c4d('0x28')](handleError(_0x3a0838,null));};exports[_0x4c4d('0x102')]=function(_0x1fde84,_0x2b8a75){var _0x2c3b3a;return db[_0x4c4d('0xa9')]['update']({'paused':0x1},{'where':{'UserId':_0x1fde84[_0x4c4d('0x54')]['id']},'individualHooks':!![]})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x1fde84[_0x4c4d('0x54')]['id'],'role':_0x4c4d('0x29')},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d'),_0x4c4d('0x5e'),_0x4c4d('0x9d'),'online']});})[_0x4c4d('0x1d')](handleEntityNotFound(_0x2b8a75,null))[_0x4c4d('0x1d')](function(_0x175e0d){if(_0x175e0d){_0x2c3b3a=_0x175e0d;return respondWithRpcPromise(_0x4c4d('0x103'),_0x4c4d('0x102'),{'id':_0x2c3b3a['id'],'name':_0x2c3b3a[_0x4c4d('0x36')],'pause':!![]});}})[_0x4c4d('0x1d')](function(){if(_0x2c3b3a){return db[_0x4c4d('0xf4')]['findAll']({'where':{'membername':_0x2c3b3a[_0x4c4d('0x36')],'type':_0x4c4d('0xfb'),'exitAt':null}});}})[_0x4c4d('0x1d')](function(_0x548c9f){if(_0x548c9f[_0x4c4d('0x6a')]){var _0x31dd0f=moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7'));for(var _0x20a45a=0x0,_0x1d01a2=_0x548c9f[_0x4c4d('0x6a')];_0x20a45a<_0x1d01a2;_0x20a45a++){_0x548c9f[_0x20a45a]['updateAttributes']({'exitAt':_0x31dd0f});}}})[_0x4c4d('0x1d')](function(){var _0x2bf8f5=[];var _0x5674bb=utils[_0x4c4d('0xf8')]();_0x5674bb[_0x4c4d('0xf5')](function(_0xdb9df5){_0x2bf8f5[_0x4c4d('0x4b')]({'channel':_0xdb9df5,'membername':_0x2c3b3a[_0x4c4d('0x36')],'interface':_[_0x4c4d('0x64')](_0x2c3b3a[_0x4c4d('0x9d')])?util[_0x4c4d('0xa7')]('SIP/%s',_0x2c3b3a[_0x4c4d('0x36')]):_0x2c3b3a[_0x4c4d('0x9d')],'type':_0x4c4d('0xfb'),'enterAt':moment()[_0x4c4d('0xa7')](_0x4c4d('0xf7')),'data1':_0x1fde84[_0x4c4d('0x5a')][_0x4c4d('0x3d')]||_0x4c4d('0x104'),'role':_0x2c3b3a['role'],'internal':_0x2c3b3a['internal']});});return db[_0x4c4d('0xf4')][_0x4c4d('0xfd')](_0x2bf8f5,{'individualHooks':!![]});})[_0x4c4d('0x1d')](function(){return _0x2c3b3a[_0x4c4d('0xf6')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x1fde84[_0x4c4d('0x5a')]['type']||_0x4c4d('0x104'),'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['then'](respondWithResult(_0x2b8a75,null))[_0x4c4d('0x28')](handleError(_0x2b8a75,null));};exports[_0x4c4d('0x105')]=function(_0x214aaa,_0x48a615){if(_0x214aaa[_0x4c4d('0x5a')][_0x4c4d('0x99')]&&!utils['isValidChannel'](_0x214aaa[_0x4c4d('0x5a')]['channel'])){throw new APIBadRequestError(util[_0x4c4d('0xa7')](_0x4c4d('0x106'),_0x214aaa['body'][_0x4c4d('0x99')]));}return db[_0x4c4d('0x3a')][_0x4c4d('0x58')]({'where':{'id':_0x214aaa[_0x4c4d('0x54')]['id']},'attributes':['id',_0x4c4d('0x36'),_0x4c4d('0x2d'),_0x4c4d('0x5e'),_0x4c4d('0x9d'),_0x4c4d('0x9a'),_0x4c4d('0x9c'),_0x4c4d('0x107'),_0x4c4d('0x108'),_0x4c4d('0x109'),_0x4c4d('0x10a'),_0x4c4d('0x10b'),_0x4c4d('0x10c'),_0x4c4d('0x10d'),'lastPauseAt']})[_0x4c4d('0x1d')](function(_0x3b0cb7){if(!_0x3b0cb7){throw new APINotFoundError(util[_0x4c4d('0xa7')](_0x4c4d('0x10e'),_0x214aaa['params']['id']));}return _0x3b0cb7['unpause'](_0x214aaa[_0x4c4d('0x5a')][_0x4c4d('0x99')]);})[_0x4c4d('0x1d')](respondWithResult(_0x48a615,null))[_0x4c4d('0x28')](APIHandleError(_0x48a615));};exports[_0x4c4d('0x10f')]=function(_0x237bda,_0x550006){var _0xcaa219={};var _0x418f2d={};var _0x130be8;var _0x2ed62b;return db['User'][_0x4c4d('0x92')]({'where':{'id':_0x237bda['params']['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x550006,null))[_0x4c4d('0x1d')](function(_0x20a40a){if(_0x20a40a){_0x130be8=_0x20a40a;_0x418f2d[_0x4c4d('0xc9')]=_['keys'](db['Team']['rawAttributes']);_0x418f2d[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x237bda[_0x4c4d('0x45')]);_0x418f2d[_0x4c4d('0xcc')]=_['intersection'](_0x418f2d[_0x4c4d('0xc9')],_0x418f2d[_0x4c4d('0x45')]);_0xcaa219[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x418f2d[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x237bda['query'][_0x4c4d('0xce')]));_0xcaa219[_0x4c4d('0x4a')]=_0xcaa219[_0x4c4d('0x4a')][_0x4c4d('0x6a')]?_0xcaa219['attributes']:_0x418f2d[_0x4c4d('0xc9')];_0xcaa219[_0x4c4d('0xd4')]=qs['sort'](_0x237bda[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0xcaa219[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_['pick'](_0x237bda[_0x4c4d('0x45')],_0x418f2d[_0x4c4d('0xcc')]));if(_0x237bda[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0xcaa219['where']=_[_0x4c4d('0xd2')](_0xcaa219[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0xcaa219[_0x4c4d('0x4a')],function(_0x353ead){var _0x4e272d={};_0x4e272d[_0x353ead]={'$like':'%'+_0x237bda['query']['filter']+'%'};return _0x4e272d;})});}_0xcaa219=_[_0x4c4d('0xd2')]({},_0xcaa219,_0x237bda[_0x4c4d('0x57')]);return _0x130be8[_0x4c4d('0x10f')](_0xcaa219);}})['then'](function(_0x32f965){if(_0x32f965){_0x2ed62b=_0x32f965['length'];if(!_0x237bda['query'][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0xcaa219['limit']=qs[_0x4c4d('0x19')](_0x237bda[_0x4c4d('0x45')]['limit']);_0xcaa219[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x237bda[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x130be8[_0x4c4d('0x10f')](_0xcaa219);}})[_0x4c4d('0x1d')](function(_0x572dd0){if(_0x572dd0){return _0x572dd0?{'count':_0x2ed62b,'rows':_0x572dd0}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x550006,null))[_0x4c4d('0x28')](handleError(_0x550006,null));};exports[_0x4c4d('0x110')]=function(_0x3744ae,_0x386dec){var _0x2b927b=_0x3744ae[_0x4c4d('0x54')]['id'];var _0x1dcee5=_0x3744ae[_0x4c4d('0x5a')]?_0x3744ae[_0x4c4d('0x5a')][_0x4c4d('0x5d')]:null;var _0x4c60a6=[];return Promise['resolve']()[_0x4c4d('0x1d')](function(){if(!_0x1dcee5)throw new APIBadRequestError(_0x4c4d('0x111'));})[_0x4c4d('0x1d')](function(){return db['User']['findOne']({'where':{'id':_0x2b927b}});})['then'](function(_0x337bc1){if(!_0x337bc1)throw new APINotFoundError(util[_0x4c4d('0xa7')](_0x4c4d('0x10e'),_0x3744ae['params']['id']));return db[_0x4c4d('0x66')][_0x4c4d('0x112')](function(_0x278b93){return _0x337bc1[_0x4c4d('0x110')](_0x1dcee5,{'transaction':_0x278b93})['then'](function(){return db[_0x4c4d('0x113')][_0x4c4d('0x86')]({'where':{'id':{'$in':_0x1dcee5}}});})['then'](function(_0x23c372){var _0x510707=_['map'](_0x23c372,function(_0x496d3f){return _0x496d3f['getAssociatedQueues']();});return Promise[_0x4c4d('0x53')](_0x510707);})['then'](function(_0x15454c){_0x4c60a6=_[_0x4c4d('0x114')](_0x15454c);var _0x26350b=_['map'](_0x4c60a6,function(_0x5a20aa){return _0x5a20aa[_0x4c4d('0x115')](_0x337bc1['id'],{'transaction':_0x278b93});});return Promise[_0x4c4d('0x53')](_0x26350b);})[_0x4c4d('0x1d')](function(){if(!_0x337bc1['online'])return;var _0x4cab8c=_[_0x4c4d('0x32')](_0x4c60a6,function(_0x178e37){return _0x178e37[_0x4c4d('0x116')](_0x4c4d('0x99'))===_0x4c4d('0x117');});var _0x46bc22=_[_0x4c4d('0x3c')](_0x4cab8c,function(_0x5503c9){return db['UserVoiceQueueRt'][_0x4c4d('0xaa')]({'membername':_0x337bc1[_0x4c4d('0x36')],'UserId':_0x337bc1['id'],'queue_name':_0x5503c9[_0x4c4d('0x36')],'VoiceQueueId':_0x5503c9['id'],'interface':_['isNil'](_0x337bc1[_0x4c4d('0x9d')])?util['format']('SIP/%s',_0x337bc1[_0x4c4d('0x36')]):_0x337bc1[_0x4c4d('0x9d')],'paused':_0x337bc1[_0x4c4d('0x9c')]||![],'penalty':_0x337bc1[_0x4c4d('0xa4')]},{'transaction':_0x278b93});});return Promise[_0x4c4d('0x53')](_0x46bc22);})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x118')]['findAll']({'where':{'teamId':{'$in':_0x1dcee5}}});})[_0x4c4d('0x1d')](function(_0x2cdacf){var _0x5a2290=_[_0x4c4d('0x3c')](_0x2cdacf,function(_0x48f9e6){return db[_0x4c4d('0x119')][_0x4c4d('0x7c')]({'UserId':_0x337bc1['id'],'VoicePrefixId':_0x48f9e6['VoicePrefixId']},{'transaction':_0x278b93});});return Promise[_0x4c4d('0x53')](_0x5a2290);});});})['then'](function(){for(var _0x13e023=0x0;_0x13e023<_0x4c60a6[_0x4c4d('0x6a')];_0x13e023++){var _0x300387=_0x4c60a6[_0x13e023][_0x4c4d('0x116')](_0x4c4d('0x99'));var _0x56d49f=_0x300387+'QueueId';socket[_0x4c4d('0xaf')](_0x4c4d('0x7d')+_0x300387+'Queue:save',{'UserId':_0x2b927b,['queueField']:_0x4c60a6[_0x13e023]['id']});}})[_0x4c4d('0x1d')](respondWithStatusCode(_0x386dec,null))[_0x4c4d('0x28')](APIHandleError(_0x386dec));};exports[_0x4c4d('0x11a')]=function(_0x547956,_0x58c3ab){var _0x38b53e=_0x547956[_0x4c4d('0x54')]['id'];var _0x3b7344=null;if(_0x547956[_0x4c4d('0x45')][_0x4c4d('0x5d')]){_0x3b7344=_[_0x4c4d('0xad')](_0x547956[_0x4c4d('0x45')][_0x4c4d('0x5d')])?_0x547956['query'][_0x4c4d('0x5d')]:[_0x547956[_0x4c4d('0x45')][_0x4c4d('0x5d')]];}var _0x4bac32=[];return Promise['resolve']()[_0x4c4d('0x1d')](function(){if(!_0x3b7344)throw new APIBadRequestError(_0x4c4d('0x11b'));})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x38b53e}});})[_0x4c4d('0x1d')](function(_0x46aee5){if(!_0x46aee5)throw new APINotFoundError(util[_0x4c4d('0xa7')](_0x4c4d('0x10e'),_0x547956[_0x4c4d('0x54')]['id']));return db[_0x4c4d('0x66')][_0x4c4d('0x112')](function(_0x5697b5){return _0x46aee5[_0x4c4d('0x11a')](_0x3b7344,{'transaction':_0x5697b5})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x113')][_0x4c4d('0x86')]({'where':{'id':{'$in':_0x3b7344}}});})[_0x4c4d('0x1d')](function(_0x528f34){var _0x2b8089=_['map'](_0x528f34,function(_0x293dd8){return _0x293dd8[_0x4c4d('0x11c')]();});return Promise[_0x4c4d('0x53')](_0x2b8089);})['then'](function(_0x303049){_0x4bac32=_[_0x4c4d('0x114')](_0x303049);var _0x20c532=_[_0x4c4d('0x3c')](_0x4bac32,function(_0x27995a){return _0x27995a[_0x4c4d('0x11d')](_0x46aee5['id'],{'transaction':_0x5697b5});});return Promise[_0x4c4d('0x53')](_0x20c532);})[_0x4c4d('0x1d')](function(){if(!_0x46aee5[_0x4c4d('0x9a')])return;var _0x3e2140=_['filter'](_0x4bac32,function(_0x543fb8){return _0x543fb8[_0x4c4d('0x116')]('channel')==='Voice';});var _0xb406e0=_[_0x4c4d('0x3c')](_0x3e2140,function(_0x55224c){return db[_0x4c4d('0xa9')][_0x4c4d('0x2b')]({'where':{'VoiceQueueId':_0x55224c['id'],'UserId':_0x46aee5['id']},'transaction':_0x5697b5});});return Promise[_0x4c4d('0x53')](_0xb406e0);})[_0x4c4d('0x1d')](function(){return db[_0x4c4d('0x118')]['findAll']({'where':{'teamId':{'$in':_0x3b7344}}});})['then'](function(_0x51a0cf){var _0x46cfb0=_[_0x4c4d('0x3c')](_0x51a0cf,function(_0x40db88){return db[_0x4c4d('0x119')][_0x4c4d('0x2b')]({'where':{'UserId':_0x46aee5['id'],'VoicePrefixId':_0x40db88[_0x4c4d('0x11e')]}},{'transaction':_0x5697b5});});return Promise[_0x4c4d('0x53')](_0x46cfb0);});});})['then'](function(){for(var _0x2237a0=0x0;_0x2237a0<_0x4bac32['length'];_0x2237a0++){var _0x49b5a1=_0x4bac32[_0x2237a0][_0x4c4d('0x116')](_0x4c4d('0x99'));var _0x554286=_0x49b5a1+_0x4c4d('0xae');socket[_0x4c4d('0xaf')]('user'+_0x49b5a1+_0x4c4d('0xb0'),{'UserId':_0x38b53e,['queueField']:_0x4bac32[_0x2237a0]['id']});}})[_0x4c4d('0x1d')](respondWithStatusCode(_0x58c3ab,null))[_0x4c4d('0x28')](APIHandleError(_0x58c3ab));};exports[_0x4c4d('0x11f')]=function(_0x11441e,_0x70d136){var _0x1a82d1={};var _0x37f9e8={};var _0x14c0da;var _0x17eb50;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x11441e[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0x70d136,null))[_0x4c4d('0x1d')](function(_0x52c798){if(_0x52c798){_0x14c0da=_0x52c798;_0x37f9e8['model']=_[_0x4c4d('0xca')](db[_0x4c4d('0x120')][_0x4c4d('0x3b')]);_0x37f9e8[_0x4c4d('0x45')]=_['keys'](_0x11441e[_0x4c4d('0x45')]);_0x37f9e8['filters']=_[_0x4c4d('0xcd')](_0x37f9e8['model'],_0x37f9e8['query']);_0x1a82d1[_0x4c4d('0x4a')]=_[_0x4c4d('0xcd')](_0x37f9e8[_0x4c4d('0xc9')],qs[_0x4c4d('0xce')](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x1a82d1[_0x4c4d('0x4a')]=_0x1a82d1['attributes'][_0x4c4d('0x6a')]?_0x1a82d1[_0x4c4d('0x4a')]:_0x37f9e8['model'];_0x1a82d1['order']=qs['sort'](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x1a82d1[_0x4c4d('0xd0')]=qs['filters'](_[_0x4c4d('0xd1')](_0x11441e[_0x4c4d('0x45')],_0x37f9e8[_0x4c4d('0xcc')]));if(_0x11441e['query']['filter']){_0x1a82d1[_0x4c4d('0xd0')]=_['merge'](_0x1a82d1[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x1a82d1[_0x4c4d('0x4a')],function(_0x388169){var _0x47ff2e={};_0x47ff2e[_0x388169]={'$like':'%'+_0x11441e[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x47ff2e;})});}_0x1a82d1=_['merge']({},_0x1a82d1,_0x11441e[_0x4c4d('0x57')]);return _0x14c0da[_0x4c4d('0x11f')](_0x1a82d1);}})[_0x4c4d('0x1d')](function(_0x93e6e2){if(_0x93e6e2){_0x17eb50=_0x93e6e2[_0x4c4d('0x6a')];if(!_0x11441e['query'][_0x4c4d('0xc5')](_0x4c4d('0xd9'))){_0x1a82d1[_0x4c4d('0x19')]=qs[_0x4c4d('0x19')](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0x19')]);_0x1a82d1[_0x4c4d('0x1a')]=qs[_0x4c4d('0x1a')](_0x11441e[_0x4c4d('0x45')][_0x4c4d('0x1a')]);}return _0x14c0da[_0x4c4d('0x11f')](_0x1a82d1);}})['then'](function(_0x110d06){if(_0x110d06){return _0x110d06?{'count':_0x17eb50,'rows':_0x110d06}:null;}})[_0x4c4d('0x1d')](respondWithResult(_0x70d136,null))[_0x4c4d('0x28')](handleError(_0x70d136,null));};exports[_0x4c4d('0x121')]=function(_0x2af521,_0xf2f978){var _0x5b57de={};var _0xb7eb31={};var _0xeed3d9;return db[_0x4c4d('0x3a')][_0x4c4d('0x92')]({'where':{'id':_0x2af521[_0x4c4d('0x54')]['id']}})[_0x4c4d('0x1d')](handleEntityNotFound(_0xf2f978,null))[_0x4c4d('0x1d')](function(_0x1cb565){if(_0x1cb565){_0xeed3d9=_0x1cb565;_0xb7eb31[_0x4c4d('0xc9')]=_[_0x4c4d('0xca')](db[_0x4c4d('0x3a')]['rawAttributes']);_0xb7eb31[_0x4c4d('0x45')]=_[_0x4c4d('0xca')](_0x2af521['query']);_0xb7eb31[_0x4c4d('0xcc')]=_[_0x4c4d('0xcd')](_0xb7eb31[_0x4c4d('0xc9')],_0xb7eb31[_0x4c4d('0x45')]);_0x5b57de[_0x4c4d('0x4a')]=_['intersection'](_0xb7eb31['model'],qs['fields'](_0x2af521[_0x4c4d('0x45')][_0x4c4d('0xce')]));_0x5b57de[_0x4c4d('0x4a')]=_0x5b57de[_0x4c4d('0x4a')][_0x4c4d('0x6a')]?_0x5b57de[_0x4c4d('0x4a')]:_0xb7eb31['model'];_0x5b57de[_0x4c4d('0xd4')]=qs['sort'](_0x2af521[_0x4c4d('0x45')][_0x4c4d('0xcf')]);_0x5b57de[_0x4c4d('0xd0')]=qs[_0x4c4d('0xcc')](_[_0x4c4d('0xd1')](_0x2af521[_0x4c4d('0x45')],_0xb7eb31[_0x4c4d('0xcc')]));if(_0x2af521[_0x4c4d('0x45')][_0x4c4d('0x32')]){_0x5b57de[_0x4c4d('0xd0')]=_['merge'](_0x5b57de[_0x4c4d('0xd0')],{'$or':_[_0x4c4d('0x3c')](_0x5b57de[_0x4c4d('0x4a')],function(_0x394f56){var _0x4fa943={};_0x4fa943[_0x394f56]={'$like':'%'+_0x2af521[_0x4c4d('0x45')][_0x4c4d('0x32')]+'%'};return _0x4fa943;})});}_0x5b57de[_0x4c4d('0xc9')]=db['User'];_0x5b57de['as']='Agents';_0x5b57de=_[_0x4c4d('0xd2')]({},_0x5b57de,_0x2af521[_0x4c4d('0x57')]);return _0xeed3d9[_0x4c4d('0xf3')]({'include':[_0x5b57de]});}})[_0x4c4d('0x1d')](function(_0x449ede){if(_0x449ede){var _0x2c0180={},_0x1b5cf8=[];for(var _0x216f81=0x0;_0x216f81<_0x449ede['length'];_0x216f81+=0x1){for(var _0x1a9e33=0x0,_0x28e670;_0x1a9e33<_0x449ede[_0x216f81][_0x4c4d('0x2f')]['length'];_0x1a9e33+=0x1){_0x28e670=_0x449ede[_0x216f81][_0x4c4d('0x2f')][_0x1a9e33][_0x4c4d('0x2c')]({'plain':!![]});_0x2c0180[_0x28e670['id']]=_0x28e670;}}_0x2c0180=_[_0x4c4d('0x122')](_0x2c0180);for(var _0x53fda2=qs[_0x4c4d('0x1a')](_0x2af521['query'][_0x4c4d('0x1a')]);_0x53fda2<_0x2c0180[_0x4c4d('0x6a')]&&_0x1b5cf8[_0x4c4d('0x6a')]=_0x2ca8cb){_0x3a1f64=_0x2ca8cb;_0x5b982d=0xc8;}else{_0x5b982d=0xce;}_0x2855c7[_0xbc49('0x1c')](_0x5b982d);return _0x2855c7[_0xbc49('0x1d')](_0xbc49('0x1e'),_0x51aa47+'-'+_0x3a1f64+'/'+_0x2ca8cb)[_0xbc49('0x17')](_0xe2f069);}return null;};}function respondWithRpcPromise(_0x3ec915,_0x4107cf,_0x1be12d,_0xf20b42){return new Promise(function(_0x3e4a49,_0x5aa236){var _0x4c5899=_0xf20b42||amiClient;return _0x4c5899[_0xbc49('0x1f')](_0x3ec915,_0x1be12d)[_0xbc49('0x20')](function(_0x5035e7){logger['info'](_0xbc49('0x21'),_0x4107cf,_0xbc49('0x22'));logger[_0xbc49('0x23')]('User,\x20%s,\x20%s,\x20%s',_0x4107cf,_0xbc49('0x22'),JSON['stringify'](_0x5035e7));if(_0x5035e7['error']){if(_0x5035e7[_0xbc49('0x24')][_0xbc49('0x25')]===0x1f4){logger[_0xbc49('0x24')](_0xbc49('0x21'),_0x4107cf,_0x5035e7[_0xbc49('0x24')][_0xbc49('0x26')]);return _0x5aa236(_0x5035e7[_0xbc49('0x24')]['message']);}logger[_0xbc49('0x24')](_0xbc49('0x21'),_0x4107cf,_0x5035e7[_0xbc49('0x24')][_0xbc49('0x26')]);return _0x3e4a49(_0x5035e7[_0xbc49('0x24')][_0xbc49('0x26')]);}else{logger['info'](_0xbc49('0x21'),_0x4107cf,_0xbc49('0x22'));_0x3e4a49(_0x5035e7[_0xbc49('0x27')][_0xbc49('0x26')]);}})[_0xbc49('0x28')](function(_0x3f3b79){logger[_0xbc49('0x24')](_0xbc49('0x21'),_0x4107cf,_0x3f3b79);_0x5aa236(_0x3f3b79);});});}function saveUpdates(_0x31db7a){return function(_0x1b189e){if(_0x1b189e){return _0x1b189e[_0xbc49('0x29')](_0x31db7a)[_0xbc49('0x20')](function(_0xd5b1e7){if(_0xd5b1e7[_0xbc49('0x2a')]===_0xbc49('0x2b')){socket['emit'](_0xbc49('0x2c')+_0xd5b1e7['id'],_0xd5b1e7);}return _0xd5b1e7;});}return null;};}function removeEntity(_0x1cd9f2,_0x1d1539){return function(_0x1e7cfb){if(_0x1e7cfb){return _0x1e7cfb[_0xbc49('0x2d')]({'transaction':_0x1d1539})['then'](function(){var _0x1067b3=_0x1e7cfb[_0xbc49('0x2e')]({'plain':!![]});if(_0x1067b3[_0xbc49('0x2a')]===_0xbc49('0x2f'))return;var _0x3c9e2c=[{'name':_0xbc49('0x30'),'value':'user','ignore':!![]},{'name':_0xbc49('0x31'),'value':_0xbc49('0x2b'),'ignore':![]},{'name':_0xbc49('0x32'),'value':_0xbc49('0x33'),'ignore':![]}];var _0x6f77d3=_(_0x3c9e2c)['filter'](_0xbc49('0x34'))[_0xbc49('0x35')]('value')[_0xbc49('0x36')]();if(_['includes'](_0x6f77d3,_0x1067b3[_0xbc49('0x2a')])){return;}var _0x2e4244=_[_0xbc49('0x37')](_0x3c9e2c,[_0xbc49('0x36'),_0x1067b3[_0xbc49('0x2a')]])[_0xbc49('0x38')];return db[_0xbc49('0x39')][_0xbc49('0x2d')]({'where':{'type':_0x2e4244,'resourceId':_0x1067b3['id']},'transaction':_0x1d1539})[_0xbc49('0x20')](function(){return _0x1e7cfb;});})[_0xbc49('0x20')](function(){_0x1cd9f2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2f8048){return function(_0x364d7f){if(!_0x364d7f){_0x2f8048[_0xbc49('0x16')](0x194);}return _0x364d7f;};}function handleError(_0x3b7f85,_0x54f1f3){_0x54f1f3=_0x54f1f3||0x1f4;return function(_0xd7d546){logger[_0xbc49('0x24')](_0xd7d546[_0xbc49('0x3a')]);if(_0xd7d546[_0xbc49('0x38')]){delete _0xd7d546[_0xbc49('0x38')];}_0x3b7f85[_0xbc49('0x1c')](_0x54f1f3)['send'](_0xd7d546);};}function getUserAttributes(){return _(db[_0xbc49('0x3b')][_0xbc49('0x3c')])[_0xbc49('0x35')](function(_0x290abd){return{'name':_0x290abd[_0xbc49('0x3d')],'type':_0x290abd[_0xbc49('0x3e')][_0xbc49('0x3f')]};})[_0xbc49('0x40')](function(_0x432247){return![_0xbc49('0x41'),'salt',_0xbc49('0x42'),_0xbc49('0x43'),_0xbc49('0x44'),_0xbc49('0x45')][_0xbc49('0x46')](_0x432247[_0xbc49('0x38')]);})[_0xbc49('0x36')]();}exports[_0xbc49('0x47')]=function(_0x300ddd,_0x6fc4a8){var _0x11d609={},_0x436022={'count':0x0,'rows':[]};var _0x3e377e=getUserAttributes();_0x11d609=qs[_0xbc49('0x48')](_0x3e377e,_0x300ddd);var _0x51156a={'where':_0x11d609['where']};return db[_0xbc49('0x3b')][_0xbc49('0x1b')](_0x51156a)[_0xbc49('0x20')](function(_0x2b9371){_0x436022[_0xbc49('0x1b')]=_0x2b9371;if(_0x300ddd[_0xbc49('0x49')][_0xbc49('0x4a')]){_0x11d609[_0xbc49('0x4b')]=[{'all':!![]}];}if(_0x300ddd[_0xbc49('0x49')]['userSetting']==='true'){_0x11d609['include']=[{'model':db[_0xbc49('0x4c')],'as':_0xbc49('0x4d')}];}if(!_[_0xbc49('0x46')](_0x11d609[_0xbc49('0x4e')],'id')){_0x11d609[_0xbc49('0x4e')][_0xbc49('0x4f')]('id');}return db[_0xbc49('0x3b')][_0xbc49('0x50')](_0x11d609);})['then'](function(_0x4a359f){_0x436022[_0xbc49('0x51')]=_0x4a359f;if(_0x300ddd[_0xbc49('0x49')][_0xbc49('0x52')]===_0xbc49('0x53')){var _0x42da18=[];for(var _0x3e8ec6=0x0;_0x3e8ec6<_0x436022[_0xbc49('0x51')][_0xbc49('0x54')];_0x3e8ec6++){_0x42da18['push'](get_open_tabs(_0xbc49('0x55'),_0x436022[_0xbc49('0x51')][_0x3e8ec6][_0xbc49('0x56')]));_0x42da18[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x57'),_0x436022[_0xbc49('0x51')][_0x3e8ec6]['dataValues']));_0x42da18['push'](get_open_tabs(_0xbc49('0x58'),_0x436022[_0xbc49('0x51')][_0x3e8ec6][_0xbc49('0x56')]));_0x42da18[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x59'),_0x436022[_0xbc49('0x51')][_0x3e8ec6]['dataValues']));_0x42da18['push'](get_open_tabs(_0xbc49('0x5a'),_0x436022[_0xbc49('0x51')][_0x3e8ec6][_0xbc49('0x56')]));_0x42da18[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x5b'),_0x436022[_0xbc49('0x51')][_0x3e8ec6][_0xbc49('0x56')]));}return Promise[_0xbc49('0x5c')](_0x42da18)[_0xbc49('0x20')](function(){return _0x436022;});}else{return _0x436022;}})[_0xbc49('0x20')](respondWithFilteredResult(_0x6fc4a8,_0x11d609))['catch'](handleError(_0x6fc4a8,null));};exports[_0xbc49('0x5d')]=function(_0x11bc2e,_0x10ac92){var _0x5b498b=getUserAttributes();_0x11bc2e['query']['id']=_0x11bc2e[_0xbc49('0x5e')]['id'];var _0xc12cd=qs[_0xbc49('0x48')](_0x5b498b,_0x11bc2e);if(_0x11bc2e[_0xbc49('0x49')]['includeAll']){_0xc12cd[_0xbc49('0x4b')]=[{'all':!![]}];}if(_0x11bc2e[_0xbc49('0x49')]['userSetting']===_0xbc49('0x53')){_0xc12cd[_0xbc49('0x4b')]=[{'model':db[_0xbc49('0x4c')],'as':_0xbc49('0x4d')}];}_0xc12cd=_[_0xbc49('0x5f')]({},_0xc12cd,_0x11bc2e[_0xbc49('0x60')]);if(!_[_0xbc49('0x46')](_0xc12cd[_0xbc49('0x4e')],'id')){_0xc12cd[_0xbc49('0x4e')][_0xbc49('0x4f')]('id');}return db[_0xbc49('0x3b')]['find'](_0xc12cd)[_0xbc49('0x20')](handleEntityNotFound(_0x10ac92,null))[_0xbc49('0x20')](function(_0x3467ec){var _0x3c7a37=[];values=_0x3467ec;if(_0x11bc2e[_0xbc49('0x49')][_0xbc49('0x52')]===_0xbc49('0x53')){_0x3c7a37['push'](get_open_tabs('chat',_0x3467ec[_0xbc49('0x56')]));_0x3c7a37[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x57'),_0x3467ec[_0xbc49('0x56')]));_0x3c7a37[_0xbc49('0x4f')](get_open_tabs('openchannel',_0x3467ec[_0xbc49('0x56')]));_0x3c7a37[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x5b'),_0x3467ec['dataValues']));_0x3c7a37[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x58'),_0x3467ec[_0xbc49('0x56')]));_0x3c7a37['push'](get_open_tabs(_0xbc49('0x59'),_0x3467ec[_0xbc49('0x56')]));return Promise[_0xbc49('0x5c')](_0x3c7a37);}else{return values;}})[_0xbc49('0x20')](function(){return values;})[_0xbc49('0x20')](respondWithResult(_0x10ac92,null))['catch'](handleError(_0x10ac92,null));};exports[_0xbc49('0x29')]=function(_0xae7e1d,_0x306967){if(_0xae7e1d['body']['id']){delete _0xae7e1d['body']['id'];}delete _0xae7e1d[_0xbc49('0x61')][_0xbc49('0x2a')];return db['User'][_0xbc49('0x37')]({'where':{'id':_0xae7e1d['params']['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x306967,null))[_0xbc49('0x20')](saveUpdates(_0xae7e1d['body'],null))[_0xbc49('0x20')](respondWithResult(_0x306967,null))[_0xbc49('0x28')](handleError(_0x306967,null));};exports['describe']=function(_0x343e72,_0x57ba01){return db[_0xbc49('0x3b')][_0xbc49('0x62')]()[_0xbc49('0x20')](respondWithResult(_0x57ba01,null))[_0xbc49('0x28')](handleError(_0x57ba01,null));};exports[_0xbc49('0x63')]=function(_0x2f17ee,_0x1ad73f){return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x2f17ee[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x1ad73f,null))[_0xbc49('0x20')](function(_0x4ce3d1){if(_0x4ce3d1){return _0x4ce3d1[_0xbc49('0x63')](_0x2f17ee['body'][_0xbc49('0x64')],_[_0xbc49('0x65')](_0x2f17ee['body'],[_0xbc49('0x64'),'id'])||{});}})[_0xbc49('0x20')](respondWithResult(_0x1ad73f,null))['catch'](handleError(_0x1ad73f,null));};function validateUser(_0x14b94){return new Promise(function(_0x1a396c,_0x428d9c){if(_0x14b94[_0xbc49('0x66')])return _0x1a396c(_0x14b94);return db[_0xbc49('0x67')][_0xbc49('0x68')](0x1)['then'](function(_0xeece1d){if(_0xeece1d[_0xbc49('0x69')])authService[_0xbc49('0x6a')](_0x14b94[_0xbc49('0x41')]);db[_0xbc49('0x3b')][_0xbc49('0x6b')]('internal')['then'](function(_0x45e3ed){if(_['isNil'](_0x45e3ed)){_0x14b94['internal']=_0xeece1d[_0xbc49('0x6c')]||0x1;return;}if(_[_0xbc49('0x6d')](_0xeece1d[_0xbc49('0x6c')])||_0xeece1d['min_internal']===_0x45e3ed){_0x14b94['internal']=_0x45e3ed+0x1;return;}if(_0xeece1d['min_internal']>_0x45e3ed){_0x14b94['internal']=_0xeece1d[_0xbc49('0x6c')];return;}return db[_0xbc49('0x6e')][_0xbc49('0x49')]('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0xbc49('0x6e')][_0xbc49('0x6f')][_0xbc49('0x70')]})['then'](function(_0x3289b4){if(_0x3289b4&&_0x3289b4[_0xbc49('0x54')]){for(var _0x2b0b3f=0x0,_0x14f10a=_0x3289b4['length'];_0x2b0b3f<_0x14f10a&&_[_0xbc49('0x6d')](_0x14b94['internal']);_0x2b0b3f++){if(_0xeece1d['min_internal']<=_0x3289b4[_0x2b0b3f]['from']){_0x14b94[_0xbc49('0x66')]=_0x3289b4[_0x2b0b3f][_0xbc49('0x71')];}else if(_0xeece1d['min_internal']>_0x3289b4[_0x2b0b3f]['from']&&_0xeece1d[_0xbc49('0x6c')]<=_0x3289b4[_0x2b0b3f]['to']){_0x14b94['internal']=_0xeece1d[_0xbc49('0x6c')];}}}if(_['isNil'](_0x14b94[_0xbc49('0x66')])){_0x14b94['internal']=_0x45e3ed+0x1;}return _0x1a396c(_0x14b94);});});})[_0xbc49('0x28')](function(_0x159c1b){_0x428d9c(_0x159c1b);});});}function updateUser(_0x28948c){return new Promise(function(_0x23e0bb,_0x55d61a){try{if(_0x28948c[_0xbc49('0x72')]){_0x28948c[_0xbc49('0x73')]=_0x28948c['internal'];_0x28948c[_0xbc49('0x74')]={'mailbox':_0x28948c[_0xbc49('0x66')],'password':_0x28948c[_0xbc49('0x41')],'fullname':_0x28948c[_0xbc49('0x75')],'email':_0x28948c[_0xbc49('0x76')]};}if(_0x28948c[_0xbc49('0x2a')]===_0xbc49('0x2b')){if(!_0x28948c[_0xbc49('0x77')])_0x28948c['permissions']=[_0xbc49('0x78'),_0xbc49('0x79'),_0xbc49('0x7a'),_0xbc49('0x7b'),'110',_0xbc49('0x7c'),_0xbc49('0x7d'),_0xbc49('0x7e'),_0xbc49('0x7f'),_0xbc49('0x80'),_0xbc49('0x81'),_0xbc49('0x82'),_0xbc49('0x83'),'114',_0xbc49('0x84')];}_0x23e0bb(_0x28948c);}catch(_0x5e7958){_0x55d61a(_0x5e7958);}});}exports[_0xbc49('0x85')]=function(_0x5e766a,_0x3c139b){if(_0x5e766a[_0xbc49('0x86')]['role']===_0xbc49('0x2b'))throw new Error(_0xbc49('0x87'));if(_0x5e766a['body'][_0xbc49('0x2a')]==='user'&&_0x5e766a[_0xbc49('0x86')][_0xbc49('0x2a')]!==_0xbc49('0x2f')){throw new Error(_0xbc49('0x88'));}if(_0x5e766a[_0xbc49('0x61')][_0xbc49('0x2a')]==='admin'&&_0x5e766a[_0xbc49('0x86')][_0xbc49('0x2a')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xbc49('0x89')]([_0x5e766a[_0xbc49('0x61')]])[_0xbc49('0x20')](function(){return validateUser(_0x5e766a[_0xbc49('0x61')]);})[_0xbc49('0x20')](function(_0x5ddb09){return updateUser(_0x5ddb09)['then'](function(_0x54e05c){if(_0x54e05c['role']===_0xbc49('0x2f')){_0x54e05c[_0xbc49('0x8a')]=_0x5e766a[_0xbc49('0x86')][_0xbc49('0x8a')];delete _0x54e05c[_0xbc49('0x8b')];}return _0x54e05c;});})[_0xbc49('0x20')](function(_0x1f2bd0){return db[_0xbc49('0x3b')][_0xbc49('0x85')](_0x1f2bd0,{'include':[{'model':db[_0xbc49('0x74')],'as':_0xbc49('0x74')}]});})[_0xbc49('0x20')](function(_0x52ea9b){if(_0x5e766a[_0xbc49('0x61')][_0xbc49('0x2a')]===_0xbc49('0x86'))return _0x52ea9b;if(_0x5e766a[_0xbc49('0x86')][_0xbc49('0x2a')]!=='user')return _0x52ea9b;return db[_0xbc49('0x8c')][_0xbc49('0x37')]({'where':{'name':_0x52ea9b[_0xbc49('0x2a')]===_0xbc49('0x2b')?_0xbc49('0x31'):'Telephones','userProfileId':_0x5e766a['user'][_0xbc49('0x8b')]},'raw':!![]})[_0xbc49('0x20')](function(_0x5c204d){if(!_0x5c204d||_0x5c204d['autoAssociation']!=0x0)return _0x52ea9b;return db[_0xbc49('0x39')][_0xbc49('0x85')]({'name':_0x52ea9b[_0xbc49('0x38')],'resourceId':_0x52ea9b['id'],'type':_0x5c204d['name'],'sectionId':_0x5c204d['id']},{})[_0xbc49('0x20')](function(){return _0x52ea9b;});})['catch'](function(_0x29466b){logger[_0xbc49('0x24')](_0xbc49('0x8d'),_0x29466b);throw _0x29466b;});})[_0xbc49('0x20')](respondWithResult(_0x3c139b,0xc9))['catch'](handleError(_0x3c139b,null));};exports[_0xbc49('0x8e')]=function(_0x5f0381,_0x56c688){var _0x395904=_0x5f0381[_0xbc49('0x61')];var _0x598b00=[];if(_0x5f0381[_0xbc49('0x86')][_0xbc49('0x2a')]===_0xbc49('0x2b'))throw new Error('Unauthorized');if(_[_0xbc49('0x8f')](_0x395904,['role',_0xbc49('0x86')])&&_0x5f0381['user']['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0xbc49('0x8f')](_0x395904,['role','admin'])&&_0x5f0381[_0xbc49('0x86')][_0xbc49('0x2a')]!==_0xbc49('0x2f')){throw new Error(_0xbc49('0x90'));}return licenseUtil[_0xbc49('0x89')](_0x395904)[_0xbc49('0x20')](function(){return validateUser(_0x395904[0x0]);})['then'](function(){for(var _0x5bc023=0x1;_0x5bc023<_0x395904[_0xbc49('0x54')];_0x5bc023++){var _0x51dfa4=_0x395904[_0x5bc023-0x1]['internal'];if(!_0x395904[_0x5bc023]['internal'])_0x395904[_0x5bc023]['internal']=_0x51dfa4+0x1;_0x598b00['push'](validateUser(_0x395904[_0x5bc023]));}return Promise['all'](_0x598b00);})[_0xbc49('0x20')](function(){_0x598b00=[];for(var _0x40ec2c=0x0;_0x40ec2c<_0x395904['length'];_0x40ec2c++){_0x598b00[_0xbc49('0x4f')](updateUser(_0x395904[_0x40ec2c]));}return Promise['all'](_0x598b00);})[_0xbc49('0x20')](function(){_0x598b00=_0x395904[_0xbc49('0x35')](function(_0x385889){return db[_0xbc49('0x3b')][_0xbc49('0x85')](_0x385889,{'include':[{'model':db[_0xbc49('0x74')],'as':_0xbc49('0x74')}]})[_0xbc49('0x20')](function(_0x2edf8e){_0x385889['id']=_0x2edf8e['id'];return _0x385889;});});return Promise['all'](_0x598b00);})['then'](function(_0x32bbad){if(_0x5f0381[_0xbc49('0x61')][_0xbc49('0x2a')]==='user')return _0x32bbad;if(_0x5f0381[_0xbc49('0x86')][_0xbc49('0x2a')]!==_0xbc49('0x86'))return _0x32bbad;var _0x265eb2=_[_0xbc49('0x8f')](_0x32bbad,function(_0x15fc36){return _0x15fc36[_0xbc49('0x2a')]===_0xbc49('0x2b')||_0x15fc36[_0xbc49('0x2a')]===_0xbc49('0x33');});if(!_0x265eb2)return _0x32bbad;return db[_0xbc49('0x8c')][_0xbc49('0x50')]({'where':{'name':{'$or':['Agents',_0xbc49('0x32')]},'userProfileId':_0x5f0381[_0xbc49('0x86')][_0xbc49('0x8b')]},'raw':!![]})[_0xbc49('0x20')](function(_0x2b4d10){if(_[_0xbc49('0x91')](_0x2b4d10)||!_['some'](_0x2b4d10,['autoAssociation',0x0]))return _0x32bbad;_0x598b00=[];var _0x13790f=_(_0x2b4d10)['map'](function(_0x5afd1d){if(_0x5afd1d['autoAssociation']===0x1)return;return _0x5afd1d['name']==='Agents'?_0xbc49('0x2b'):_0xbc49('0x33');})[_0xbc49('0x92')]()[_0xbc49('0x36')]();for(var _0x187a28=0x0;_0x187a28<_0x32bbad[_0xbc49('0x54')];_0x187a28++){if(!_['includes'](_0x13790f,_0x32bbad[_0x187a28][_0xbc49('0x2a')]))return;var _0x2287a9=_0x32bbad[_0x187a28][_0xbc49('0x2a')]==='agent'?'Agents':_0xbc49('0x32');_0x598b00[_0xbc49('0x4f')](db[_0xbc49('0x39')][_0xbc49('0x85')]({'name':_0x32bbad[_0x187a28][_0xbc49('0x38')],'resourceId':_0x32bbad[_0x187a28]['id'],'type':_0x2287a9,'sectionId':_[_0xbc49('0x37')](_0x2b4d10,[_0xbc49('0x38'),_0x2287a9])['id']},{}));}return Promise[_0xbc49('0x5c')](_0x598b00);});})[_0xbc49('0x20')](respondWithResult(_0x56c688,0xc9))['catch'](handleError(_0x56c688,null));};exports['changePassword']=function(_0x5c2247,_0x3c1f4c){if(_0x5c2247[_0xbc49('0x61')]['id']){delete _0x5c2247[_0xbc49('0x61')]['id'];}return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x5c2247['params']['id']}})[_0xbc49('0x20')](function(_0x57bd87){if(!_0x57bd87)return null;if(_0x57bd87['id']===_0x5c2247['user']['id']){if(!_0x5c2247[_0xbc49('0x61')][_0xbc49('0x93')]||!_0x5c2247[_0xbc49('0x61')][_0xbc49('0x94')]){throw new db[(_0xbc49('0x95'))][(_0xbc49('0x96'))](_0xbc49('0x97'));}if(!_0x57bd87[_0xbc49('0x98')](_0x5c2247[_0xbc49('0x61')]['oldPassword'])){throw new db[(_0xbc49('0x95'))]['ValidationError'](_0xbc49('0x99'));}if(_0x5c2247['body']['oldPassword']===_0x5c2247[_0xbc49('0x61')][_0xbc49('0x94')]){throw new db[(_0xbc49('0x95'))][(_0xbc49('0x96'))](_0xbc49('0x9a'));}}else if(_0x5c2247['user']['role']===_0xbc49('0x2f')){if(!_0x5c2247['body']['newPassword']){throw new db[(_0xbc49('0x95'))][(_0xbc49('0x96'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x5c2247[_0xbc49('0x86')][_0xbc49('0x2a')]===_0xbc49('0x86')){if(!_0x5c2247[_0xbc49('0x61')][_0xbc49('0x94')]){throw new db[(_0xbc49('0x95'))][(_0xbc49('0x96'))](_0xbc49('0x9b'));}if(_0x57bd87[_0xbc49('0x2a')]!=='agent'){throw new db[(_0xbc49('0x95'))][(_0xbc49('0x96'))](_0xbc49('0x87'));}}else{throw new db[(_0xbc49('0x95'))]['ValidationError'](_0xbc49('0x87'));}return _0x57bd87;})[_0xbc49('0x20')](handleEntityNotFound(_0x3c1f4c,null))[_0xbc49('0x20')](function(_0x4ed43b){return db[_0xbc49('0x67')][_0xbc49('0x9c')]({'attributes':['id',_0xbc49('0x69'),'enforcePasswordHistory',_0xbc49('0x9d')]})['then'](function(_0x399d80){if(_0x399d80[_0xbc49('0x69')])authService[_0xbc49('0x6a')](_0x5c2247['body'][_0xbc49('0x94')]);if(!_0x399d80['enforcePasswordHistory']||!_0x4ed43b[_0xbc49('0x42')])return _0x4ed43b;authService[_0xbc49('0x9e')](_0x5c2247[_0xbc49('0x61')]['newPassword'],_0x4ed43b['previousPasswords'],_0x399d80[_0xbc49('0x9d')]);return _0x4ed43b;})[_0xbc49('0x20')](saveUpdates({'password':_0x5c2247['body'][_0xbc49('0x94')],'passwordResetAt':_0x5c2247[_0xbc49('0x86')]['id']==_0x5c2247[_0xbc49('0x5e')]['id']?moment():null,'previousPasswords':authService[_0xbc49('0x9f')](_0x5c2247[_0xbc49('0x61')][_0xbc49('0x94')],_0x4ed43b[_0xbc49('0x42')])},null));})['then'](respondWithResult(_0x3c1f4c,null))[_0xbc49('0x28')](handleError(_0x3c1f4c,null));};exports[_0xbc49('0xa0')]=function(_0x239a0e,_0x52c05d){var _0x105907=_0x239a0e[_0xbc49('0x61')][_0xbc49('0xa1')];return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x239a0e[_0xbc49('0x5e')]['id']},'attributes':['id','name',_0xbc49('0x2a'),_0xbc49('0xa2'),_0xbc49('0xa3'),'voicePause','interface']})[_0xbc49('0x20')](handleEntityNotFound(_0x52c05d,null))['then'](function(_0x2ab5cb){if(_0x2ab5cb){if(!utils[_0xbc49('0xa4')](_0x105907)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x2ab5cb[_0xbc49('0xa5')+_['capitalize'](_0x105907[_0xbc49('0xa6')]())+_0xbc49('0xa7')](_0x239a0e[_0xbc49('0x61')][_0xbc49('0x64')],{'penalty':_0x239a0e[_0xbc49('0x61')][_0xbc49('0xa8')]||0x0})['spread'](function(_0x2213ab){for(var _0x1358a2=0x0;_0x1358a2<_0x239a0e['body'][_0xbc49('0x64')]['length'];_0x1358a2+=0x1){var _0x14cd2d={'UserId':Number(_0x239a0e['params']['id'])};_0x14cd2d[_[_0xbc49('0xa9')](_0x105907[_0xbc49('0xa6')]())+_0xbc49('0xaa')]=Number(_0x239a0e[_0xbc49('0x61')][_0xbc49('0x64')][_0x1358a2]);socket[_0xbc49('0xab')]('user'+_[_0xbc49('0xa9')](_0x105907['toLowerCase']())+'Queue:save',_0x14cd2d);}return _0x2213ab;})[_0xbc49('0x20')](function(){if(_0x105907===_0xbc49('0xac')){return db[_0xbc49('0xad')][_0xbc49('0x50')]({'where':{'id':_0x239a0e[_0xbc49('0x61')][_0xbc49('0x64')]||[]},'raw':!![],'attributes':['id',_0xbc49('0x38')]});}})[_0xbc49('0x20')](function(_0xa1beb1){var _0xf48198=_0x2ab5cb['get']({'plain':!![]});var _0x459c1c=[];if(_0x105907===_0xbc49('0xac')&&_0xf48198[_0xbc49('0x2a')]===_0xbc49('0x2b')&&_0xf48198[_0xbc49('0xa2')]){for(let _0x2736a4=0x0;_0x2736a4<_0xa1beb1[_0xbc49('0x54')];_0x2736a4+=0x1){_0x459c1c[_0xbc49('0x4f')]({'membername':_0xf48198[_0xbc49('0x38')],'UserId':_0xf48198['id'],'queue_name':_0xa1beb1[_0x2736a4][_0xbc49('0x38')],'VoiceQueueId':_0xa1beb1[_0x2736a4]['id'],'interface':_[_0xbc49('0x6d')](_0xf48198[_0xbc49('0xae')])?util['format'](_0xbc49('0xaf'),_0xf48198[_0xbc49('0x38')]):_0xf48198[_0xbc49('0xae')],'paused':_0xf48198[_0xbc49('0xb0')]||![],'penalty':_0x239a0e[_0xbc49('0x61')][_0xbc49('0xa8')]||0x0});}return Promise[_0xbc49('0x5c')](_0x459c1c[_0xbc49('0x35')](function(_0x3c4021){return db[_0xbc49('0xb1')]['upsert'](_0x3c4021);}));}return _0x2ab5cb;});}})['then'](respondWithStatusCode(_0x52c05d,null))[_0xbc49('0x28')](handleError(_0x52c05d,null));};exports[_0xbc49('0xb2')]=function(_0x45eb13,_0x2ccd64){var _0x4cb92f,_0x29e26e;return db[_0xbc49('0x3b')]['find']({'where':{'id':_0x45eb13[_0xbc49('0x5e')]['id']},'attributes':['id',_0xbc49('0x38'),_0xbc49('0x2a')]})[_0xbc49('0x20')](handleEntityNotFound(_0x2ccd64,null))['then'](function(_0x3690f9){if(_0x3690f9){_0x4cb92f=_0x3690f9;if(!_0x45eb13['query']['channel']||!utils[_0xbc49('0xa4')](_0x45eb13['query']['channel'])){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x3690f9[_0xbc49('0xb3')+_[_0xbc49('0xa9')](_0x45eb13['query'][_0xbc49('0xa1')][_0xbc49('0xa6')]())+_0xbc49('0xa7')](_0x45eb13[_0xbc49('0x49')]['ids']);}})[_0xbc49('0x20')](function(_0x45f3e9){if(_[_0xbc49('0xb4')](_0x45eb13[_0xbc49('0x49')]['ids'])){for(var _0x46fc56=0x0;_0x46fc56<_0x45eb13[_0xbc49('0x49')][_0xbc49('0x64')][_0xbc49('0x54')];_0x46fc56+=0x1){_0x29e26e={'UserId':Number(_0x45eb13[_0xbc49('0x5e')]['id'])};_0x29e26e[_['capitalize'](_0x45eb13['query']['channel'][_0xbc49('0xa6')]())+_0xbc49('0xaa')]=Number(_0x45eb13[_0xbc49('0x49')]['ids'][_0x46fc56]);socket[_0xbc49('0xab')](_0xbc49('0x86')+_[_0xbc49('0xa9')](_0x45eb13[_0xbc49('0x49')][_0xbc49('0xa1')]['toLowerCase']())+_0xbc49('0xb5'),_0x29e26e);}}else{_0x29e26e={'UserId':Number(_0x45eb13[_0xbc49('0x5e')]['id'])};_0x29e26e[_[_0xbc49('0xa9')](_0x45eb13[_0xbc49('0x49')][_0xbc49('0xa1')][_0xbc49('0xa6')]())+'QueueId']=Number(_0x45eb13[_0xbc49('0x49')][_0xbc49('0x64')]);socket['emit'](_0xbc49('0x86')+_[_0xbc49('0xa9')](_0x45eb13[_0xbc49('0x49')]['channel'][_0xbc49('0xa6')]())+'Queue:remove',_0x29e26e);}return _0x45f3e9;})['then'](function(){if(_0x45eb13['query']['channel']===_0xbc49('0xac')){return db[_0xbc49('0xb1')]['destroy']({'where':{'UserId':_0x45eb13[_0xbc49('0x5e')]['id'],'VoiceQueueId':_0x45eb13[_0xbc49('0x49')][_0xbc49('0x64')]},'individualHooks':!![]})['then'](function(){return _0x4cb92f;});}return _0x4cb92f;})[_0xbc49('0x20')](respondWithStatusCode(_0x2ccd64,null))['catch'](handleError(_0x2ccd64,null));};exports[_0xbc49('0xb6')]=function(_0x458ad4,_0x286f61){_0x458ad4['body'][_0xbc49('0xb7')]=_0x458ad4[_0xbc49('0xb8')][_0xbc49('0xb9')];return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x458ad4[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x286f61,null))['then'](saveUpdates(_0x458ad4['body'],null))[_0xbc49('0x20')](respondWithResult(_0x286f61,null))['catch'](handleError(_0x286f61,null));};exports[_0xbc49('0xba')]=function(_0xcfa1ee,_0x2d04f4){var _0x10e018=path[_0xbc49('0xbb')](config[_0xbc49('0xbc')],_0xbc49('0xbd'));return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0xcfa1ee['params']['id']},'attributes':['id',_0xbc49('0xb7')],'raw':!![]})[_0xbc49('0x20')](handleEntityNotFound(_0x2d04f4,null))[_0xbc49('0x20')](function(_0x5004f8){if(_0x5004f8){if(_['isNil'](_0x5004f8[_0xbc49('0xb7')])){return _0x2d04f4[_0xbc49('0xbe')](_0x10e018);}else{if(!fs[_0xbc49('0xbf')](path['join'](config[_0xbc49('0xbc')],'server/files/images/',_0x5004f8[_0xbc49('0xb7')]))){return _0x2d04f4[_0xbc49('0xbe')](_0x10e018);}return _0x2d04f4['download'](path[_0xbc49('0xbb')](config[_0xbc49('0xbc')],'server/files/images/',_0x5004f8['userpic']));}}})['catch'](handleError(_0x2d04f4,null));};exports[_0xbc49('0xc0')]=function(_0x48fbf1,_0x55c90c){return db[_0xbc49('0x3b')]['find']({'where':{'id':_0x48fbf1[_0xbc49('0x5e')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x55c90c,null))[_0xbc49('0x20')](function(_0x5dc2f5){var _0x3841a2=[];values=_0x5dc2f5[_0xbc49('0x56')];_0x3841a2[_0xbc49('0x4f')](get_open_tabs('chat',_0x5dc2f5[_0xbc49('0x56')]));_0x3841a2[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x57'),_0x5dc2f5[_0xbc49('0x56')]));_0x3841a2[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x5a'),_0x5dc2f5[_0xbc49('0x56')]));_0x3841a2[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x5b'),_0x5dc2f5['dataValues']));_0x3841a2[_0xbc49('0x4f')](get_open_tabs(_0xbc49('0x58'),_0x5dc2f5[_0xbc49('0x56')]));_0x3841a2['push'](get_open_tabs(_0xbc49('0x59'),_0x5dc2f5[_0xbc49('0x56')]));return Promise[_0xbc49('0x5c')](_0x3841a2);})[_0xbc49('0x20')](function(_0x38565c){if(_0x38565c){var _0x4beace=_[_0xbc49('0x35')](values[_0xbc49('0xc1')],function(_0x1f247b){return{'channel':_0xbc49('0xc2'),'id':_0x1f247b['id'],'createdAt':_0x1f247b[_0xbc49('0xc3')]};});var _0xe665af=_[_0xbc49('0x35')](values[_0xbc49('0xc4')],function(_0x2667f8){return{'channel':_0xbc49('0xc5'),'id':_0x2667f8['id'],'createdAt':_0x2667f8['createdAt']};});var _0x3827ae=_[_0xbc49('0x35')](values[_0xbc49('0xc6')],function(_0x31ba0d){return{'channel':_0xbc49('0xc7'),'id':_0x31ba0d['id'],'createdAt':_0x31ba0d[_0xbc49('0xc3')]};});var _0xc00f86=_['map'](values['MailOpenTabs'],function(_0x1537d5){return{'channel':_0xbc49('0xc8'),'id':_0x1537d5['id'],'createdAt':_0x1537d5[_0xbc49('0xc3')]};});var _0x405a23=_[_0xbc49('0x35')](values[_0xbc49('0xc9')],function(_0x4c89b6){return{'channel':_0xbc49('0xca'),'id':_0x4c89b6['id'],'createdAt':_0x4c89b6[_0xbc49('0xc3')]};});var _0x1b510b=_[_0xbc49('0x35')](values[_0xbc49('0xcb')],function(_0x34feba){return{'channel':_0xbc49('0xcc'),'id':_0x34feba['id'],'createdAt':_0x34feba[_0xbc49('0xc3')]};});var _0x310292=_[_0xbc49('0xcd')](_0x4beace,_0xe665af,_0x3827ae,_0xc00f86,_0x405a23,_0x1b510b);var _0x2ba654={'count':_0x310292[_0xbc49('0x54')],'rows':_0x310292};return _0x2ba654;}else return null;})[_0xbc49('0x20')](respondWithResult(_0x55c90c,null))[_0xbc49('0x28')](handleError(_0x55c90c,null));};exports[_0xbc49('0xce')]=function(_0x28f570,_0x40b29d){var _0x58f9f0={};return db[_0xbc49('0x3b')]['findOne']({'where':{'id':_0x28f570[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](function(_0x559b35){if(!_0x559b35){throw new APINotFoundError(util['format'](_0xbc49('0xcf'),_0x28f570[_0xbc49('0x5e')]['id']));}return contacts[_0xbc49('0x62')]();})['then'](function(_0x10512b){_0x28f570['query']['User']=_0x28f570[_0xbc49('0x5e')]['id'];_0x58f9f0=qs[_0xbc49('0x48')](_0x10512b,_0x28f570);if(_0x28f570[_0xbc49('0x49')]['hasOwnProperty']('includeAll')){_0x58f9f0[_0xbc49('0x4b')]=[{'model':db[_0xbc49('0xd0')],'as':_0xbc49('0xd1'),'required':![]},{'model':db[_0xbc49('0xd2')],'as':'Tags','attributes':['id',_0xbc49('0x38'),_0xbc49('0xd3')],'where':_0x28f570[_0xbc49('0x49')][_0xbc49('0xd4')]?{'id':_0x28f570[_0xbc49('0x49')][_0xbc49('0xd4')]}:undefined,'required':_0x28f570['query'][_0xbc49('0xd4')]?!![]:![]}];}return contacts['findAll'](_0x28f570[_0xbc49('0x49')],_0x28f570[_0xbc49('0x86')],_0x58f9f0,_0x10512b);})['then'](respondWithFilteredResult(_0x40b29d,_0x58f9f0))[_0xbc49('0x28')](APIHandleError(_0x40b29d));};exports[_0xbc49('0xd5')]=function(_0x227eab,_0x2d206a){var _0x47c3f8;var _0xa857d6={};var _0x5e91a4;return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x227eab[_0xbc49('0x5e')]['id']},'attributes':['id',_0xbc49('0x38'),_0xbc49('0x2a')]})['then'](handleEntityNotFound(_0x2d206a,null))[_0xbc49('0x20')](function(_0x5c7dc6){if(!utils[_0xbc49('0xa4')](_0x227eab[_0xbc49('0x49')][_0xbc49('0xa1')])){throw new db[(_0xbc49('0x95'))][(_0xbc49('0x96'))](_0xbc49('0xd6'));}_0x47c3f8=_0x5c7dc6;var _0x349873={};_0x349873[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_[_0xbc49('0xa9')](_0x227eab[_0xbc49('0x49')][_0xbc49('0xa1')])+_0xbc49('0xd9')][_0xbc49('0x3c')]);_0x349873[_0xbc49('0x49')]=_['keys'](_0x227eab[_0xbc49('0x49')]);_0x349873[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x349873[_0xbc49('0xd7')],_0x349873[_0xbc49('0x49')]);_0xa857d6[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x349873[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x227eab[_0xbc49('0x49')][_0xbc49('0xdc')]));_0xa857d6['attributes']=_0xa857d6[_0xbc49('0x4e')][_0xbc49('0x54')]?_0xa857d6[_0xbc49('0x4e')]:_0x349873[_0xbc49('0xd7')];_0xa857d6['order']=qs[_0xbc49('0xdd')](_0x227eab[_0xbc49('0x49')][_0xbc49('0xdd')]);_0xa857d6[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_[_0xbc49('0xdf')](_0x227eab[_0xbc49('0x49')],_0x349873['filters']));if(_0x227eab[_0xbc49('0x49')][_0xbc49('0x40')]){_0xa857d6['where']=_[_0xbc49('0x5f')](_0xa857d6['where'],{'$or':_['map'](_0xa857d6[_0xbc49('0x4e')],function(_0x2b8375){var _0x335766={};_0x335766[_0x2b8375]={'$like':'%'+_0x227eab[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x335766;})});}_0xa857d6=_['merge']({},_0xa857d6,_0x227eab[_0xbc49('0x60')]);switch(_0x47c3f8[_0xbc49('0x2a')]){case'admin':return db[_['capitalize'](_0x227eab['query']['channel'])+_0xbc49('0xd9')][_0xbc49('0x50')](_0xa857d6);case _0xbc49('0x86'):case _0xbc49('0x2b'):return _0x47c3f8[_0xbc49('0x2e')+_['capitalize'](_0x227eab[_0xbc49('0x49')][_0xbc49('0xa1')])+_0xbc49('0xa7')](_0xa857d6);default:throw new db[(_0xbc49('0x95'))]['ValidationError'](_0xbc49('0xe0'));}})[_0xbc49('0x20')](function(_0x1a37dc){_0x5e91a4=_0x1a37dc[_0xbc49('0x54')];if(!_0x227eab[_0xbc49('0x49')][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0xa857d6[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x227eab[_0xbc49('0x49')]['limit']);_0xa857d6[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x227eab[_0xbc49('0x49')][_0xbc49('0x18')]);}switch(_0x47c3f8[_0xbc49('0x2a')]){case _0xbc49('0x2f'):return db[_[_0xbc49('0xa9')](_0x227eab['query']['channel'])+_0xbc49('0xd9')]['findAll'](_0xa857d6);case'user':case'agent':return _0x47c3f8[_0xbc49('0x2e')+_[_0xbc49('0xa9')](_0x227eab[_0xbc49('0x49')][_0xbc49('0xa1')])+_0xbc49('0xa7')](_0xa857d6);}})[_0xbc49('0x20')](function(_0x383dd0){return{'count':_0x5e91a4,'rows':_0x383dd0};})[_0xbc49('0x20')](respondWithResult(_0x2d206a,null))[_0xbc49('0x28')](handleError(_0x2d206a,null));};exports[_0xbc49('0xe3')]=function(_0x133031,_0x564b1b){var _0x3c2277={};var _0xe9a72a={};var _0x23bf3;var _0xcf77ec;return db[_0xbc49('0x3b')]['findOne']({'where':{'id':_0x133031[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x564b1b,null))[_0xbc49('0x20')](function(_0x4fa285){if(_0x4fa285){_0x23bf3=_0x4fa285;_0xe9a72a['model']=_['keys'](db[_0xbc49('0xb1')][_0xbc49('0x3c')]);_0xe9a72a[_0xbc49('0x49')]=_[_0xbc49('0xd8')](_0x133031[_0xbc49('0x49')]);_0xe9a72a[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0xe9a72a[_0xbc49('0xd7')],_0xe9a72a[_0xbc49('0x49')]);_0x3c2277[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0xe9a72a[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x133031[_0xbc49('0x49')][_0xbc49('0xdc')]));_0x3c2277['attributes']=_0x3c2277[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x3c2277[_0xbc49('0x4e')]:_0xe9a72a[_0xbc49('0xd7')];_0x3c2277['order']=qs[_0xbc49('0xdd')](_0x133031[_0xbc49('0x49')]['sort']);_0x3c2277[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_['pick'](_0x133031['query'],_0xe9a72a[_0xbc49('0xda')]));if(_0x133031['query'][_0xbc49('0x40')]){_0x3c2277[_0xbc49('0xde')]=_['merge'](_0x3c2277[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x3c2277[_0xbc49('0x4e')],function(_0x5a0623){var _0x2284f3={};_0x2284f3[_0x5a0623]={'$like':'%'+_0x133031[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x2284f3;})});}_0x3c2277=_[_0xbc49('0x5f')]({},_0x3c2277,_0x133031[_0xbc49('0x60')]);return _0x23bf3[_0xbc49('0xe3')](_0x3c2277);}})['then'](function(_0x9ff761){if(_0x9ff761){_0xcf77ec=_0x9ff761['length'];if(!_0x133031['query'][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x3c2277[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x133031['query'][_0xbc49('0x1a')]);_0x3c2277[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x133031[_0xbc49('0x49')]['offset']);}return _0x23bf3[_0xbc49('0xe3')](_0x3c2277);}})[_0xbc49('0x20')](function(_0x1e3611){if(_0x1e3611){return _0x1e3611?{'count':_0xcf77ec,'rows':_0x1e3611}:null;}})[_0xbc49('0x20')](respondWithResult(_0x564b1b,null))[_0xbc49('0x28')](handleError(_0x564b1b,null));};exports[_0xbc49('0xe4')]=function(_0x2d4c54,_0x25bb28){var _0x661c5d={};var _0x3a8ad0={};var _0x226e52;var _0x33c955;return db['User']['findOne']({'where':{'id':_0x2d4c54['params']['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x25bb28,null))[_0xbc49('0x20')](function(_0x4f704a){if(_0x4f704a){_0x226e52=_0x4f704a;_0x3a8ad0[_0xbc49('0xd7')]=_['keys'](db['ChatGroup']['rawAttributes']);_0x3a8ad0[_0xbc49('0x49')]=_['keys'](_0x2d4c54['query']);_0x3a8ad0[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x3a8ad0[_0xbc49('0xd7')],_0x3a8ad0['query']);_0x661c5d[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x3a8ad0[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x2d4c54['query'][_0xbc49('0xdc')]));_0x661c5d[_0xbc49('0x4e')]=_0x661c5d[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x661c5d['attributes']:_0x3a8ad0[_0xbc49('0xd7')];_0x661c5d['order']=qs[_0xbc49('0xdd')](_0x2d4c54[_0xbc49('0x49')]['sort']);_0x661c5d[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_[_0xbc49('0xdf')](_0x2d4c54[_0xbc49('0x49')],_0x3a8ad0[_0xbc49('0xda')]));if(_0x2d4c54[_0xbc49('0x49')][_0xbc49('0x40')]){_0x661c5d[_0xbc49('0xde')]=_['merge'](_0x661c5d[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x661c5d[_0xbc49('0x4e')],function(_0x45b466){var _0x5518ec={};_0x5518ec[_0x45b466]={'$like':'%'+_0x2d4c54[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x5518ec;})});}_0x661c5d=_['merge']({},_0x661c5d,_0x2d4c54['options']);return _0x226e52[_0xbc49('0xe4')](_0x661c5d);}})['then'](function(_0x294b9c){if(_0x294b9c){_0x33c955=_0x294b9c[_0xbc49('0x54')];if(!_0x2d4c54[_0xbc49('0x49')][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x661c5d['limit']=qs['limit'](_0x2d4c54['query'][_0xbc49('0x1a')]);_0x661c5d[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x2d4c54['query'][_0xbc49('0x18')]);}return _0x226e52[_0xbc49('0xe4')](_0x661c5d);}})[_0xbc49('0x20')](function(_0x15cbbd){if(_0x15cbbd){return _0x15cbbd?{'count':_0x33c955,'rows':_0x15cbbd}:null;}})[_0xbc49('0x20')](respondWithResult(_0x25bb28,null))['catch'](handleError(_0x25bb28,null));};exports[_0xbc49('0xe5')]=function(_0x59eb2d,_0x31d008){var _0xb90341={'raw':!![],'where':{}};var _0x475953={};var _0x441063={'count':0x0,'rows':[]};return db['User'][_0xbc49('0x9c')]({'where':{'id':_0x59eb2d[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x31d008,null))[_0xbc49('0x20')](function(_0x3b97be){if(_0x3b97be){_0x475953[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_0xbc49('0xe6')]['rawAttributes']);_0x475953[_0xbc49('0x49')]=_[_0xbc49('0xd8')](_0x59eb2d['query']);_0x475953['filters']=_[_0xbc49('0xdb')](_0x475953[_0xbc49('0xd7')],_0x475953['query']);_0xb90341[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x475953[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x59eb2d[_0xbc49('0x49')][_0xbc49('0xdc')]));_0xb90341[_0xbc49('0x4e')]=_0xb90341[_0xbc49('0x4e')][_0xbc49('0x54')]?_0xb90341[_0xbc49('0x4e')]:_0x475953[_0xbc49('0xd7')];if(!_0x59eb2d[_0xbc49('0x49')][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0xb90341[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x59eb2d[_0xbc49('0x49')][_0xbc49('0x1a')]);_0xb90341['offset']=qs[_0xbc49('0x18')](_0x59eb2d['query']['offset']);}_0xb90341['order']=qs[_0xbc49('0xdd')](_0x59eb2d[_0xbc49('0x49')]['sort']);_0xb90341[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_[_0xbc49('0xdf')](_0x59eb2d[_0xbc49('0x49')],_0x475953['filters']));_0xb90341['where'][_0xbc49('0xe7')]=_0x3b97be['id'];if(_0x59eb2d[_0xbc49('0x49')][_0xbc49('0x40')]){_0xb90341['where']=_[_0xbc49('0x5f')](_0xb90341['where'],{'$or':_['map'](_0xb90341[_0xbc49('0x4e')],function(_0x2d98d2){var _0x229aab={};_0x229aab[_0x2d98d2]={'$like':'%'+_0x59eb2d[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x229aab;})});}_0xb90341=_[_0xbc49('0x5f')]({},_0xb90341,_0x59eb2d[_0xbc49('0x60')]);return db[_0xbc49('0xe6')][_0xbc49('0x1b')]({'where':_0xb90341[_0xbc49('0xde')]})[_0xbc49('0x20')](function(_0x12fea7){_0x441063['count']=_0x12fea7;if(_0x59eb2d[_0xbc49('0x49')][_0xbc49('0x4a')]){_0xb90341[_0xbc49('0x4b')]=[{'all':!![]}];}return db[_0xbc49('0xe6')][_0xbc49('0x50')](_0xb90341);})[_0xbc49('0x20')](function(_0x2e9ed1){_0x441063['rows']=_0x2e9ed1;return _0x441063;});}})[_0xbc49('0x20')](respondWithFilteredResult(_0x31d008,_0xb90341))['catch'](handleError(_0x31d008,null));};exports[_0xbc49('0xe8')]=function(_0x35c06a,_0x1d82d2){var _0x1ace5e={'raw':!![],'where':{}};var _0x9c78df={};var _0x25f8a3={'count':0x0,'rows':[]};return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x35c06a[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x1d82d2,null))[_0xbc49('0x20')](function(_0x4f43ca){if(_0x4f43ca){_0x9c78df[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_0xbc49('0xe9')][_0xbc49('0x3c')]);_0x9c78df['query']=_[_0xbc49('0xd8')](_0x35c06a[_0xbc49('0x49')]);_0x9c78df[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x9c78df['model'],_0x9c78df[_0xbc49('0x49')]);_0x1ace5e[_0xbc49('0x4e')]=_['intersection'](_0x9c78df[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x35c06a['query']['fields']));_0x1ace5e[_0xbc49('0x4e')]=_0x1ace5e[_0xbc49('0x4e')]['length']?_0x1ace5e['attributes']:_0x9c78df['model'];if(!_0x35c06a[_0xbc49('0x49')][_0xbc49('0xe1')]('nolimit')){_0x1ace5e[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x35c06a['query'][_0xbc49('0x1a')]);_0x1ace5e['offset']=qs[_0xbc49('0x18')](_0x35c06a[_0xbc49('0x49')]['offset']);}_0x1ace5e[_0xbc49('0xea')]=qs[_0xbc49('0xdd')](_0x35c06a[_0xbc49('0x49')]['sort']);_0x1ace5e[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_[_0xbc49('0xdf')](_0x35c06a[_0xbc49('0x49')],_0x9c78df[_0xbc49('0xda')]));_0x1ace5e['where'][_0xbc49('0xe7')]=_0x4f43ca['id'];if(_0x35c06a['query'][_0xbc49('0x40')]){_0x1ace5e['where']=_[_0xbc49('0x5f')](_0x1ace5e['where'],{'$or':_[_0xbc49('0x35')](_0x1ace5e['attributes'],function(_0x1ffd4d){var _0x4f042f={};_0x4f042f[_0x1ffd4d]={'$like':'%'+_0x35c06a['query'][_0xbc49('0x40')]+'%'};return _0x4f042f;})});}_0x1ace5e=_[_0xbc49('0x5f')]({},_0x1ace5e,_0x35c06a[_0xbc49('0x60')]);return db[_0xbc49('0xe9')][_0xbc49('0x1b')]({'where':_0x1ace5e[_0xbc49('0xde')]})['then'](function(_0x519109){_0x25f8a3[_0xbc49('0x1b')]=_0x519109;if(_0x35c06a[_0xbc49('0x49')]['includeAll']){_0x1ace5e[_0xbc49('0x4b')]=[{'all':!![]}];}return db['ScreenRecording'][_0xbc49('0x50')](_0x1ace5e);})['then'](function(_0x19056a){_0x25f8a3['rows']=_0x19056a;return _0x25f8a3;});}})[_0xbc49('0x20')](respondWithFilteredResult(_0x1d82d2,_0x1ace5e))[_0xbc49('0x28')](handleError(_0x1d82d2,null));};exports['getChatInteractions']=function(_0x25012f,_0x5a23f5){var _0x3ef1ad={};var _0x525ebc={};var _0x33ddbb;var _0x55c123;return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x25012f[_0xbc49('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5a23f5,null))[_0xbc49('0x20')](function(_0x38761a){if(_0x38761a){_0x33ddbb=_0x38761a;_0x525ebc[_0xbc49('0xd7')]=_['keys'](db[_0xbc49('0xeb')][_0xbc49('0x3c')]);_0x525ebc[_0xbc49('0x49')]=_[_0xbc49('0xd8')](_0x25012f[_0xbc49('0x49')]);_0x525ebc['filters']=_['intersection'](_0x525ebc['model'],_0x525ebc['query']);_0x3ef1ad[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x525ebc[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x25012f['query']['fields']));_0x3ef1ad[_0xbc49('0x4e')]=_0x3ef1ad[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x3ef1ad[_0xbc49('0x4e')]:_0x525ebc[_0xbc49('0xd7')];_0x3ef1ad[_0xbc49('0xea')]=qs['sort'](_0x25012f[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x3ef1ad[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_[_0xbc49('0xdf')](_0x25012f[_0xbc49('0x49')],_0x525ebc[_0xbc49('0xda')]));if(_0x25012f['query'][_0xbc49('0x40')]){_0x3ef1ad[_0xbc49('0xde')]=_[_0xbc49('0x5f')](_0x3ef1ad[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x3ef1ad['attributes'],function(_0x226916){var _0xb06845={};_0xb06845[_0x226916]={'$like':'%'+_0x25012f['query'][_0xbc49('0x40')]+'%'};return _0xb06845;})});}_0x3ef1ad=_['merge']({},_0x3ef1ad,_0x25012f[_0xbc49('0x60')]);return _0x33ddbb[_0xbc49('0xec')](_0x3ef1ad);}})[_0xbc49('0x20')](function(_0x2f27e5){if(_0x2f27e5){_0x55c123=_0x2f27e5['length'];if(!_0x25012f['query'][_0xbc49('0xe1')]('nolimit')){_0x3ef1ad[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x25012f['query']['limit']);_0x3ef1ad[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x25012f[_0xbc49('0x49')]['offset']);}return _0x33ddbb[_0xbc49('0xec')](_0x3ef1ad);}})[_0xbc49('0x20')](function(_0x2e1cf8){if(_0x2e1cf8){return _0x2e1cf8?{'count':_0x55c123,'rows':_0x2e1cf8}:null;}})[_0xbc49('0x20')](respondWithResult(_0x5a23f5,null))['catch'](handleError(_0x5a23f5,null));};exports['getOpenchannelInteractions']=function(_0x3387d2,_0x518565){var _0x30ea4c={};var _0x2cf1e6={};var _0x3dfb42;var _0x2e21aa;return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x3387d2[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x518565,null))[_0xbc49('0x20')](function(_0x318bc3){if(_0x318bc3){_0x3dfb42=_0x318bc3;_0x2cf1e6[_0xbc49('0xd7')]=_['keys'](db[_0xbc49('0xed')][_0xbc49('0x3c')]);_0x2cf1e6[_0xbc49('0x49')]=_['keys'](_0x3387d2[_0xbc49('0x49')]);_0x2cf1e6[_0xbc49('0xda')]=_['intersection'](_0x2cf1e6['model'],_0x2cf1e6[_0xbc49('0x49')]);_0x30ea4c[_0xbc49('0x4e')]=_['intersection'](_0x2cf1e6['model'],qs['fields'](_0x3387d2['query'][_0xbc49('0xdc')]));_0x30ea4c[_0xbc49('0x4e')]=_0x30ea4c[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x30ea4c[_0xbc49('0x4e')]:_0x2cf1e6[_0xbc49('0xd7')];_0x30ea4c[_0xbc49('0xea')]=qs[_0xbc49('0xdd')](_0x3387d2[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x30ea4c['where']=qs['filters'](_[_0xbc49('0xdf')](_0x3387d2[_0xbc49('0x49')],_0x2cf1e6['filters']));if(_0x3387d2[_0xbc49('0x49')]['filter']){_0x30ea4c[_0xbc49('0xde')]=_[_0xbc49('0x5f')](_0x30ea4c['where'],{'$or':_['map'](_0x30ea4c[_0xbc49('0x4e')],function(_0x38a79c){var _0x4e783e={};_0x4e783e[_0x38a79c]={'$like':'%'+_0x3387d2['query'][_0xbc49('0x40')]+'%'};return _0x4e783e;})});}_0x30ea4c=_[_0xbc49('0x5f')]({},_0x30ea4c,_0x3387d2[_0xbc49('0x60')]);return _0x3dfb42[_0xbc49('0xee')](_0x30ea4c);}})[_0xbc49('0x20')](function(_0x19684b){if(_0x19684b){_0x2e21aa=_0x19684b[_0xbc49('0x54')];if(!_0x3387d2[_0xbc49('0x49')][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x30ea4c[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x3387d2['query'][_0xbc49('0x1a')]);_0x30ea4c[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x3387d2[_0xbc49('0x49')]['offset']);}return _0x3dfb42['getOpenchannelInteractions'](_0x30ea4c);}})['then'](function(_0x23a68a){if(_0x23a68a){return _0x23a68a?{'count':_0x2e21aa,'rows':_0x23a68a}:null;}})[_0xbc49('0x20')](respondWithResult(_0x518565,null))['catch'](handleError(_0x518565,null));};exports['getMailInteractions']=function(_0x5d4411,_0x198a42){var _0x4b45c7={'raw':!![],'where':{}};var _0x1880ad={};var _0x16769a={'count':0x0,'rows':[]};return db[_0xbc49('0x3b')]['findOne']({'where':{'id':_0x5d4411[_0xbc49('0x5e')]['id']}})['then'](handleEntityNotFound(_0x198a42,null))[_0xbc49('0x20')](function(_0x107c72){if(_0x107c72){_0x1880ad[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_0xbc49('0xef')]['rawAttributes']);_0x1880ad['query']=_[_0xbc49('0xd8')](_0x5d4411[_0xbc49('0x49')]);_0x1880ad[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x1880ad[_0xbc49('0xd7')],_0x1880ad[_0xbc49('0x49')]);_0x4b45c7[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x1880ad['model'],qs[_0xbc49('0xdc')](_0x5d4411[_0xbc49('0x49')][_0xbc49('0xdc')]));_0x4b45c7[_0xbc49('0x4e')]=_0x4b45c7[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x4b45c7['attributes']:_0x1880ad['model'];if(!_0x5d4411[_0xbc49('0x49')][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x4b45c7[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x5d4411[_0xbc49('0x49')][_0xbc49('0x1a')]);_0x4b45c7[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x5d4411[_0xbc49('0x49')][_0xbc49('0x18')]);}_0x4b45c7[_0xbc49('0xea')]=qs[_0xbc49('0xdd')](_0x5d4411[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x4b45c7[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_['pick'](_0x5d4411['query'],_0x1880ad['filters']));_0x4b45c7[_0xbc49('0xde')]['UserId']=_0x107c72['id'];if(_0x5d4411[_0xbc49('0x49')][_0xbc49('0x40')]){_0x4b45c7[_0xbc49('0xde')]=_[_0xbc49('0x5f')](_0x4b45c7[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x4b45c7['attributes'],function(_0x4499eb){var _0x1ae499={};_0x1ae499[_0x4499eb]={'$like':'%'+_0x5d4411[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x1ae499;})});}_0x4b45c7=_[_0xbc49('0x5f')]({},_0x4b45c7,_0x5d4411[_0xbc49('0x60')]);return db[_0xbc49('0xef')][_0xbc49('0x1b')]({'where':_0x4b45c7[_0xbc49('0xde')]})[_0xbc49('0x20')](function(_0xaa981d){_0x16769a[_0xbc49('0x1b')]=_0xaa981d;if(_0x5d4411[_0xbc49('0x49')][_0xbc49('0x4a')]){_0x4b45c7['include']=[{'all':!![]}];}return db[_0xbc49('0xef')][_0xbc49('0x50')](_0x4b45c7);})[_0xbc49('0x20')](function(_0x1a6524){_0x16769a[_0xbc49('0x51')]=_0x1a6524;return _0x16769a;});}})['then'](respondWithFilteredResult(_0x198a42,_0x4b45c7))[_0xbc49('0x28')](handleError(_0x198a42,null));};exports[_0xbc49('0xf0')]=function(_0x15ef39,_0x3dd2a2){var _0x228ade={};var _0x1798de={};var _0x85c346;var _0x5b2fd2;return db['User']['findOne']({'where':{'id':_0x15ef39[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x3dd2a2,null))['then'](function(_0x13ca9b){if(_0x13ca9b){_0x85c346=_0x13ca9b;_0x1798de['model']=_[_0xbc49('0xd8')](db[_0xbc49('0xf1')][_0xbc49('0x3c')]);_0x1798de[_0xbc49('0x49')]=_['keys'](_0x15ef39[_0xbc49('0x49')]);_0x1798de[_0xbc49('0xda')]=_['intersection'](_0x1798de[_0xbc49('0xd7')],_0x1798de['query']);_0x228ade[_0xbc49('0x4e')]=_['intersection'](_0x1798de[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x15ef39[_0xbc49('0x49')][_0xbc49('0xdc')]));_0x228ade['attributes']=_0x228ade['attributes'][_0xbc49('0x54')]?_0x228ade[_0xbc49('0x4e')]:_0x1798de[_0xbc49('0xd7')];_0x228ade[_0xbc49('0xea')]=qs['sort'](_0x15ef39[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x228ade[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_['pick'](_0x15ef39[_0xbc49('0x49')],_0x1798de[_0xbc49('0xda')]));if(_0x15ef39[_0xbc49('0x49')]['filter']){_0x228ade['where']=_[_0xbc49('0x5f')](_0x228ade[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x228ade['attributes'],function(_0x5c24a6){var _0x4f5b13={};_0x4f5b13[_0x5c24a6]={'$like':'%'+_0x15ef39[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x4f5b13;})});}_0x228ade=_[_0xbc49('0x5f')]({},_0x228ade,_0x15ef39['options']);return _0x85c346[_0xbc49('0xf0')](_0x228ade);}})[_0xbc49('0x20')](function(_0x80bbeb){if(_0x80bbeb){_0x5b2fd2=_0x80bbeb[_0xbc49('0x54')];if(!_0x15ef39[_0xbc49('0x49')][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x228ade[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x15ef39['query']['limit']);_0x228ade[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x15ef39[_0xbc49('0x49')][_0xbc49('0x18')]);}return _0x85c346['getSmsInteractions'](_0x228ade);}})['then'](function(_0x5b852f){if(_0x5b852f){return _0x5b852f?{'count':_0x5b2fd2,'rows':_0x5b852f}:null;}})[_0xbc49('0x20')](respondWithResult(_0x3dd2a2,null))[_0xbc49('0x28')](handleError(_0x3dd2a2,null));};exports[_0xbc49('0xf2')]=function(_0x41c225,_0x179f48){var _0x3f2aaf={};var _0x161b9b={};var _0x17d2a0;var _0x2cb3c0;return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x41c225[_0xbc49('0x5e')]['id']}})['then'](handleEntityNotFound(_0x179f48,null))[_0xbc49('0x20')](function(_0xac7d18){if(_0xac7d18){_0x17d2a0=_0xac7d18;_0x161b9b[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_0xbc49('0xf3')][_0xbc49('0x3c')]);_0x161b9b['query']=_[_0xbc49('0xd8')](_0x41c225['query']);_0x161b9b[_0xbc49('0xda')]=_['intersection'](_0x161b9b[_0xbc49('0xd7')],_0x161b9b[_0xbc49('0x49')]);_0x3f2aaf['attributes']=_[_0xbc49('0xdb')](_0x161b9b['model'],qs[_0xbc49('0xdc')](_0x41c225['query'][_0xbc49('0xdc')]));_0x3f2aaf['attributes']=_0x3f2aaf[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x3f2aaf['attributes']:_0x161b9b[_0xbc49('0xd7')];_0x3f2aaf['order']=qs[_0xbc49('0xdd')](_0x41c225['query'][_0xbc49('0xdd')]);_0x3f2aaf[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_['pick'](_0x41c225[_0xbc49('0x49')],_0x161b9b[_0xbc49('0xda')]));if(_0x41c225[_0xbc49('0x49')][_0xbc49('0x40')]){_0x3f2aaf['where']=_[_0xbc49('0x5f')](_0x3f2aaf[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x3f2aaf[_0xbc49('0x4e')],function(_0x59dafc){var _0x24d44e={};_0x24d44e[_0x59dafc]={'$like':'%'+_0x41c225[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x24d44e;})});}_0x3f2aaf=_[_0xbc49('0x5f')]({},_0x3f2aaf,_0x41c225['options']);return _0x17d2a0['getFaxInteractions'](_0x3f2aaf);}})[_0xbc49('0x20')](function(_0x51a98b){if(_0x51a98b){_0x2cb3c0=_0x51a98b[_0xbc49('0x54')];if(!_0x41c225['query'][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x3f2aaf[_0xbc49('0x1a')]=qs[_0xbc49('0x1a')](_0x41c225[_0xbc49('0x49')][_0xbc49('0x1a')]);_0x3f2aaf[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x41c225['query'][_0xbc49('0x18')]);}return _0x17d2a0['getFaxInteractions'](_0x3f2aaf);}})['then'](function(_0x1cdc12){if(_0x1cdc12){return _0x1cdc12?{'count':_0x2cb3c0,'rows':_0x1cdc12}:null;}})['then'](respondWithResult(_0x179f48,null))[_0xbc49('0x28')](handleError(_0x179f48,null));};exports['getWhatsappInteractions']=function(_0x24a9e6,_0x2f6cc5){var _0x1a0f1f={};var _0x29fc72={};var _0xe17277;var _0x18d62a;return db['User'][_0xbc49('0x9c')]({'where':{'id':_0x24a9e6[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x2f6cc5,null))[_0xbc49('0x20')](function(_0x26ecee){if(_0x26ecee){_0xe17277=_0x26ecee;_0x29fc72[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db['WhatsappInteraction'][_0xbc49('0x3c')]);_0x29fc72[_0xbc49('0x49')]=_['keys'](_0x24a9e6[_0xbc49('0x49')]);_0x29fc72['filters']=_[_0xbc49('0xdb')](_0x29fc72['model'],_0x29fc72['query']);_0x1a0f1f[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x29fc72[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x24a9e6['query']['fields']));_0x1a0f1f[_0xbc49('0x4e')]=_0x1a0f1f[_0xbc49('0x4e')]['length']?_0x1a0f1f[_0xbc49('0x4e')]:_0x29fc72['model'];_0x1a0f1f[_0xbc49('0xea')]=qs[_0xbc49('0xdd')](_0x24a9e6[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x1a0f1f[_0xbc49('0xde')]=qs['filters'](_[_0xbc49('0xdf')](_0x24a9e6[_0xbc49('0x49')],_0x29fc72['filters']));if(_0x24a9e6[_0xbc49('0x49')]['filter']){_0x1a0f1f[_0xbc49('0xde')]=_[_0xbc49('0x5f')](_0x1a0f1f[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x1a0f1f[_0xbc49('0x4e')],function(_0x32a291){var _0x1fbc6b={};_0x1fbc6b[_0x32a291]={'$like':'%'+_0x24a9e6[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x1fbc6b;})});}_0x1a0f1f=_[_0xbc49('0x5f')]({},_0x1a0f1f,_0x24a9e6[_0xbc49('0x60')]);return _0xe17277[_0xbc49('0xf4')](_0x1a0f1f);}})[_0xbc49('0x20')](function(_0x2bca03){if(_0x2bca03){_0x18d62a=_0x2bca03['length'];if(!_0x24a9e6['query'][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x1a0f1f['limit']=qs[_0xbc49('0x1a')](_0x24a9e6[_0xbc49('0x49')][_0xbc49('0x1a')]);_0x1a0f1f[_0xbc49('0x18')]=qs[_0xbc49('0x18')](_0x24a9e6[_0xbc49('0x49')][_0xbc49('0x18')]);}return _0xe17277[_0xbc49('0xf4')](_0x1a0f1f);}})['then'](function(_0x2b79f4){if(_0x2b79f4){return _0x2b79f4?{'count':_0x18d62a,'rows':_0x2b79f4}:null;}})[_0xbc49('0x20')](respondWithResult(_0x2f6cc5,null))[_0xbc49('0x28')](handleError(_0x2f6cc5,null));};exports[_0xbc49('0xf5')]=function(_0x5bc5a0,_0x4a7f52,_0xb3860e){var _0x76664f;var _0x34ce21;var _0x488f3f;var _0x5712d8=!_[_0xbc49('0x6d')](_0x5bc5a0[_0xbc49('0x5e')]['id'])?_0x5bc5a0['params']['id']:!_[_0xbc49('0x6d')](_0x5bc5a0[_0xbc49('0x86')]['id'])?_0x5bc5a0[_0xbc49('0x86')]['id']:null;return db['User']['find']({'where':{'id':_0x5712d8,'role':{'$or':[_0xbc49('0x2f'),_0xbc49('0x86'),_0xbc49('0x2b')]}},'attributes':['id','name',_0xbc49('0xf6'),_0xbc49('0xf7'),_0xbc49('0x2a'),_0xbc49('0x66'),'loginInPause']})[_0xbc49('0x20')](function(_0x3a9972){if(_0x3a9972){if(_0x3a9972[_0xbc49('0x2a')]===_0xbc49('0x2b')){_0x76664f=_0x3a9972;if(_0x5bc5a0[_0xbc49('0x61')]['interface']){_0x488f3f=util[_0xbc49('0xf8')]('LOCAL/%s@from-sip/n',_0x76664f[_0x5bc5a0[_0xbc49('0x61')][_0xbc49('0xae')]]);}else if(_0x5bc5a0[_0xbc49('0x61')][_0xbc49('0xf9')]){_0x488f3f=util[_0xbc49('0xf8')](_0xbc49('0xaf'),_0x5bc5a0[_0xbc49('0x61')][_0xbc49('0xf9')]);}else{_0x488f3f=util[_0xbc49('0xf8')](_0xbc49('0xaf'),_0x76664f[_0xbc49('0x38')]);}socket['to'](util[_0xbc49('0xf8')](_0xbc49('0xfa'),_0x76664f[_0xbc49('0x38')]))[_0xbc49('0xab')](_0xbc49('0xfb'),{'user':{'id':_0x76664f['id'],'name':_0x76664f[_0xbc49('0x38')]},'ip':_0x5bc5a0[_0xbc49('0xfc')][_0xbc49('0xfd')]||_0x5bc5a0[_0xbc49('0xfe')]['remoteAddress']||_0x5bc5a0[_0xbc49('0xff')]['remoteAddress']||_0x5bc5a0['connection'][_0xbc49('0xff')]['remoteAddress']});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x76664f[_0xbc49('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0xbc49('0x95'))]['ValidationError'](_0xbc49('0x100'));}})[_0xbc49('0x20')](function(){if(_0x76664f){return _0x76664f['getVoiceQueues']({'raw':!![]});}})[_0xbc49('0x20')](function(_0x1324a3){if(_0x76664f){if(_0x1324a3){_0x34ce21=_0x1324a3;if(_0x34ce21[_0xbc49('0x54')]){var _0x430e09=_0x34ce21[_0xbc49('0x35')](function(_0xc1e3be){var _0x1a3427={'membername':_0x76664f[_0xbc49('0x38')],'UserId':_0x76664f['id'],'queue_name':_0xc1e3be['name'],'VoiceQueueId':_0xc1e3be['id'],'interface':_0x488f3f,'paused':_0x76664f[_0xbc49('0xa3')]||![],'penalty':_0xc1e3be[_0xbc49('0x101')]||0x0};return db[_0xbc49('0xb1')][_0xbc49('0x102')](_0x1a3427);});return Promise[_0xbc49('0x5c')](_0x430e09);}}}})[_0xbc49('0x20')](function(){if(_0x76664f){return db[_0xbc49('0x103')][_0xbc49('0x50')]({'where':{'membername':_0x76664f[_0xbc49('0x38')],'exitAt':null}});}})[_0xbc49('0x20')](function(_0x33aa69){if(_0x76664f){var _0x1a8261=[];_0x33aa69[_0xbc49('0x104')](function(_0x5a4fb9){_0x1a8261[_0xbc49('0x4f')](_0x5a4fb9[_0xbc49('0x29')]({'exitAt':moment()[_0xbc49('0xf8')](_0xbc49('0x105'))}));});return Promise[_0xbc49('0x5c')](_0x1a8261);}})['then'](function(){if(_0x76664f){var _0x1cd6a7=[];var _0x5c59f1=[];var _0x465c41=utils['getChannels']();var _0x7729e7={'membername':_0x76664f['name'],'interface':_0x488f3f,'enterAt':moment()[_0xbc49('0xf8')](_0xbc49('0x105')),'role':_0x76664f[_0xbc49('0x2a')],'internal':_0x76664f[_0xbc49('0x66')]};_0x465c41['forEach'](function(_0x28fe90){_0x1cd6a7[_0xbc49('0x4f')](_[_0xbc49('0x5f')]({'channel':_0x28fe90,'type':_0xbc49('0x106'),'data1':_0x5bc5a0[_0xbc49('0x61')]['device'],'data2':_0x488f3f},_0x7729e7));if(_0x76664f['loginInPause']){_0x5c59f1[_0xbc49('0x4f')](_[_0xbc49('0x5f')]({'channel':_0x28fe90,'type':'PAUSE','data1':'LOGININPAUSE'},_0x7729e7));}});return db[_0xbc49('0x103')]['bulkCreate'](_0x1cd6a7[_0xbc49('0xcd')](_0x5c59f1),{'individualHooks':!![]});}})[_0xbc49('0x20')](function(){if(_0x76664f){return _0x76664f['update']({'online':!![],'lastLoginAt':moment()['format'](_0xbc49('0x105')),'voicePause':_0x76664f[_0xbc49('0xa3')]||![],'mailPause':_0x76664f[_0xbc49('0xa3')]||![],'chatPause':_0x76664f[_0xbc49('0xa3')]||![],'faxPause':_0x76664f[_0xbc49('0xa3')]||![],'smsPause':_0x76664f[_0xbc49('0xa3')]||![],'openchannelPause':_0x76664f[_0xbc49('0xa3')]||![],'whatsappPause':_0x76664f[_0xbc49('0xa3')]||![],'pauseType':_0x76664f[_0xbc49('0xa3')]?_0xbc49('0x107'):null,'interface':_0x488f3f,'lastPauseAt':moment()[_0xbc49('0xf8')](_0xbc49('0x105'))});}})['then'](function(_0x794aab){if(_0x5bc5a0['isMiddleware']){return _0xb3860e();}else{return Promise[_0xbc49('0x108')](_0x794aab)[_0xbc49('0x20')](respondWithResult(_0x4a7f52,null));}})[_0xbc49('0x28')](handleError(_0x4a7f52,null));};exports['logout']=function(_0x4e1a8d,_0x13d061){var _0x1fe614;return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x4e1a8d[_0xbc49('0x5e')]['id'],'role':_0xbc49('0x2b')},'attributes':['id',_0xbc49('0x38'),'role']})['then'](handleEntityNotFound(_0x13d061,null))[_0xbc49('0x20')](function(_0x4ada39){if(_0x4ada39){_0x1fe614=_0x4ada39;return db[_0xbc49('0xb1')][_0xbc49('0x2d')]({'where':{'membername':_0x1fe614[_0xbc49('0x38')]},'individualHooks':!![]});}})['then'](function(){return db[_0xbc49('0x103')][_0xbc49('0x50')]({'where':{'membername':_0x1fe614[_0xbc49('0x38')],'exitAt':null}});})[_0xbc49('0x20')](function(_0x288a6e){var _0x1cb900=[];_0x288a6e[_0xbc49('0x104')](function(_0x552348){_0x1cb900[_0xbc49('0x4f')](_0x552348[_0xbc49('0x29')]({'exitAt':moment()[_0xbc49('0xf8')](_0xbc49('0x105'))}));});return Promise[_0xbc49('0x5c')](_0x1cb900);})[_0xbc49('0x20')](function(){return _0x1fe614['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xbc49('0x20')](respondWithResult(_0x13d061,null))[_0xbc49('0x28')](handleError(_0x13d061,null));};exports[_0xbc49('0x109')]=function(_0x5c76c9,_0xf8fffe){var _0x43974a;return db['UserVoiceQueueRt'][_0xbc49('0x29')]({'paused':0x1},{'where':{'UserId':_0x5c76c9[_0xbc49('0x5e')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x5c76c9['params']['id'],'role':_0xbc49('0x2b')},'attributes':['id',_0xbc49('0x38'),_0xbc49('0x2a'),_0xbc49('0x66'),_0xbc49('0xae'),_0xbc49('0xa2')]});})['then'](handleEntityNotFound(_0xf8fffe,null))['then'](function(_0x3b4dec){if(_0x3b4dec){_0x43974a=_0x3b4dec;return respondWithRpcPromise(_0xbc49('0x10a'),_0xbc49('0x109'),{'id':_0x43974a['id'],'name':_0x43974a[_0xbc49('0x38')],'pause':!![]});}})[_0xbc49('0x20')](function(){if(_0x43974a){return db[_0xbc49('0x103')][_0xbc49('0x50')]({'where':{'membername':_0x43974a[_0xbc49('0x38')],'type':_0xbc49('0x10b'),'exitAt':null}});}})[_0xbc49('0x20')](function(_0x371649){if(_0x371649[_0xbc49('0x54')]){var _0x22d654=moment()[_0xbc49('0xf8')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x515e43=0x0,_0x2bae0b=_0x371649[_0xbc49('0x54')];_0x515e43<_0x2bae0b;_0x515e43++){_0x371649[_0x515e43][_0xbc49('0x10c')]({'exitAt':_0x22d654});}}})[_0xbc49('0x20')](function(){var _0xb7ac75=[];var _0x25762a=utils[_0xbc49('0x10d')]();_0x25762a['forEach'](function(_0x31820f){_0xb7ac75[_0xbc49('0x4f')]({'channel':_0x31820f,'membername':_0x43974a[_0xbc49('0x38')],'interface':_[_0xbc49('0x6d')](_0x43974a[_0xbc49('0xae')])?util['format'](_0xbc49('0xaf'),_0x43974a[_0xbc49('0x38')]):_0x43974a[_0xbc49('0xae')],'type':_0xbc49('0x10b'),'enterAt':moment()[_0xbc49('0xf8')](_0xbc49('0x105')),'data1':_0x5c76c9[_0xbc49('0x61')][_0xbc49('0x3e')]||_0xbc49('0x10e'),'role':_0x43974a[_0xbc49('0x2a')],'internal':_0x43974a[_0xbc49('0x66')]});});return db[_0xbc49('0x103')][_0xbc49('0x8e')](_0xb7ac75,{'individualHooks':!![]});})[_0xbc49('0x20')](function(){return _0x43974a[_0xbc49('0x29')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x5c76c9[_0xbc49('0x61')][_0xbc49('0x3e')]||_0xbc49('0x10e'),'lastPauseAt':moment()[_0xbc49('0xf8')](_0xbc49('0x105'))});})[_0xbc49('0x20')](respondWithResult(_0xf8fffe,null))[_0xbc49('0x28')](handleError(_0xf8fffe,null));};exports[_0xbc49('0x10f')]=function(_0x40ab86,_0x5ddf64){if(_0x40ab86[_0xbc49('0x61')][_0xbc49('0xa1')]&&!utils[_0xbc49('0xa4')](_0x40ab86[_0xbc49('0x61')][_0xbc49('0xa1')])){throw new APIBadRequestError(util[_0xbc49('0xf8')](_0xbc49('0x110'),_0x40ab86[_0xbc49('0x61')]['channel']));}return db[_0xbc49('0x3b')][_0xbc49('0x37')]({'where':{'id':_0x40ab86[_0xbc49('0x5e')]['id']},'attributes':['id','name',_0xbc49('0x2a'),'internal',_0xbc49('0xae'),_0xbc49('0xa2'),_0xbc49('0xb0'),_0xbc49('0x111'),'chatPause',_0xbc49('0x112'),'openchannelPause',_0xbc49('0x113'),_0xbc49('0x114'),_0xbc49('0x115'),_0xbc49('0x116')]})[_0xbc49('0x20')](function(_0x19dc75){if(!_0x19dc75){throw new APINotFoundError(util[_0xbc49('0xf8')](_0xbc49('0xcf'),_0x40ab86[_0xbc49('0x5e')]['id']));}return _0x19dc75[_0xbc49('0x10f')](_0x40ab86[_0xbc49('0x61')][_0xbc49('0xa1')]);})[_0xbc49('0x20')](respondWithResult(_0x5ddf64,null))[_0xbc49('0x28')](APIHandleError(_0x5ddf64));};exports['getTeams']=function(_0x171f1a,_0x517c7a){var _0x392c25={};var _0x3bbf20={};var _0xab5de1;var _0x524596;return db[_0xbc49('0x3b')]['findOne']({'where':{'id':_0x171f1a[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x517c7a,null))['then'](function(_0x494182){if(_0x494182){_0xab5de1=_0x494182;_0x3bbf20[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_0xbc49('0x117')]['rawAttributes']);_0x3bbf20[_0xbc49('0x49')]=_[_0xbc49('0xd8')](_0x171f1a['query']);_0x3bbf20[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x3bbf20[_0xbc49('0xd7')],_0x3bbf20[_0xbc49('0x49')]);_0x392c25['attributes']=_[_0xbc49('0xdb')](_0x3bbf20[_0xbc49('0xd7')],qs['fields'](_0x171f1a[_0xbc49('0x49')][_0xbc49('0xdc')]));_0x392c25[_0xbc49('0x4e')]=_0x392c25[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x392c25[_0xbc49('0x4e')]:_0x3bbf20[_0xbc49('0xd7')];_0x392c25[_0xbc49('0xea')]=qs['sort'](_0x171f1a[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x392c25[_0xbc49('0xde')]=qs[_0xbc49('0xda')](_[_0xbc49('0xdf')](_0x171f1a[_0xbc49('0x49')],_0x3bbf20[_0xbc49('0xda')]));if(_0x171f1a[_0xbc49('0x49')]['filter']){_0x392c25[_0xbc49('0xde')]=_[_0xbc49('0x5f')](_0x392c25[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x392c25[_0xbc49('0x4e')],function(_0x1b657f){var _0x5c9763={};_0x5c9763[_0x1b657f]={'$like':'%'+_0x171f1a['query']['filter']+'%'};return _0x5c9763;})});}_0x392c25=_[_0xbc49('0x5f')]({},_0x392c25,_0x171f1a[_0xbc49('0x60')]);return _0xab5de1[_0xbc49('0x118')](_0x392c25);}})[_0xbc49('0x20')](function(_0x40ab17){if(_0x40ab17){_0x524596=_0x40ab17[_0xbc49('0x54')];if(!_0x171f1a['query'][_0xbc49('0xe1')](_0xbc49('0xe2'))){_0x392c25[_0xbc49('0x1a')]=qs['limit'](_0x171f1a[_0xbc49('0x49')][_0xbc49('0x1a')]);_0x392c25['offset']=qs['offset'](_0x171f1a['query'][_0xbc49('0x18')]);}return _0xab5de1[_0xbc49('0x118')](_0x392c25);}})['then'](function(_0x12c564){if(_0x12c564){return _0x12c564?{'count':_0x524596,'rows':_0x12c564}:null;}})['then'](respondWithResult(_0x517c7a,null))[_0xbc49('0x28')](handleError(_0x517c7a,null));};exports['addTeams']=function(_0x41df33,_0x5e5b97){var _0x1d7dca=_0x41df33['params']['id'];var _0x1635d3=_0x41df33[_0xbc49('0x61')]?_0x41df33[_0xbc49('0x61')]['ids']:null;var _0x1af121=[];return Promise[_0xbc49('0x108')]()[_0xbc49('0x20')](function(){if(!_0x1635d3)throw new APIBadRequestError(_0xbc49('0x119'));})[_0xbc49('0x20')](function(){return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x1d7dca}});})[_0xbc49('0x20')](function(_0x4d0af7){if(!_0x4d0af7)throw new APINotFoundError(util[_0xbc49('0xf8')]('User\x20with\x20id\x20%s\x20not\x20found',_0x41df33[_0xbc49('0x5e')]['id']));return db['sequelize'][_0xbc49('0x11a')](function(_0x43f46d){return _0x4d0af7['addTeams'](_0x1635d3,{'transaction':_0x43f46d})[_0xbc49('0x20')](function(){return db['Team'][_0xbc49('0x50')]({'where':{'id':{'$in':_0x1635d3}}});})['then'](function(_0x16da82){var _0x5c4b92=_['map'](_0x16da82,function(_0x54efc3){return _0x54efc3[_0xbc49('0x11b')]();});return Promise[_0xbc49('0x5c')](_0x5c4b92);})[_0xbc49('0x20')](function(_0x1b102c){_0x1af121=_[_0xbc49('0x11c')](_0x1b102c);var _0x45e102=_[_0xbc49('0x35')](_0x1af121,function(_0x214518){return _0x214518[_0xbc49('0x11d')](_0x4d0af7['id'],{'transaction':_0x43f46d});});return Promise[_0xbc49('0x5c')](_0x45e102);})[_0xbc49('0x20')](function(){if(!_0x4d0af7['online'])return;var _0x327966=_[_0xbc49('0x40')](_0x1af121,function(_0x44c829){return _0x44c829[_0xbc49('0x11e')](_0xbc49('0xa1'))===_0xbc49('0x11f');});var _0x4c712b=_[_0xbc49('0x35')](_0x327966,function(_0x869627){return db['UserVoiceQueueRt'][_0xbc49('0x102')]({'membername':_0x4d0af7[_0xbc49('0x38')],'UserId':_0x4d0af7['id'],'queue_name':_0x869627[_0xbc49('0x38')],'VoiceQueueId':_0x869627['id'],'interface':_['isNil'](_0x4d0af7[_0xbc49('0xae')])?util[_0xbc49('0xf8')](_0xbc49('0xaf'),_0x4d0af7[_0xbc49('0x38')]):_0x4d0af7[_0xbc49('0xae')],'paused':_0x4d0af7[_0xbc49('0xb0')]||![],'penalty':_0x4d0af7[_0xbc49('0xa8')]},{'transaction':_0x43f46d});});return Promise[_0xbc49('0x5c')](_0x4c712b);})[_0xbc49('0x20')](function(){return db[_0xbc49('0x120')][_0xbc49('0x50')]({'where':{'teamId':{'$in':_0x1635d3}}});})[_0xbc49('0x20')](function(_0x3abf48){var _0x5006c4=_[_0xbc49('0x35')](_0x3abf48,function(_0x14d08f){return db[_0xbc49('0x121')][_0xbc49('0x85')]({'UserId':_0x4d0af7['id'],'VoicePrefixId':_0x14d08f['VoicePrefixId']},{'transaction':_0x43f46d});});return Promise[_0xbc49('0x5c')](_0x5006c4);});});})['then'](function(){for(var _0x1eed4f=0x0;_0x1eed4f<_0x1af121['length'];_0x1eed4f++){var _0x43d3ff=_0x1af121[_0x1eed4f]['getDataValue'](_0xbc49('0xa1'));var _0x2e2e7d=_0x43d3ff+_0xbc49('0xaa');socket[_0xbc49('0xab')](_0xbc49('0x86')+_0x43d3ff+'Queue:save',{'UserId':_0x1d7dca,['queueField']:_0x1af121[_0x1eed4f]['id']});}})['then'](respondWithStatusCode(_0x5e5b97,null))[_0xbc49('0x28')](APIHandleError(_0x5e5b97));};exports[_0xbc49('0x122')]=function(_0x10425d,_0x1f35c1){var _0x1ecbe5=_0x10425d[_0xbc49('0x5e')]['id'];var _0x335822=null;if(_0x10425d[_0xbc49('0x49')][_0xbc49('0x64')]){_0x335822=_[_0xbc49('0xb4')](_0x10425d[_0xbc49('0x49')][_0xbc49('0x64')])?_0x10425d['query'][_0xbc49('0x64')]:[_0x10425d['query']['ids']];}var _0xe6b2a6=[];return Promise[_0xbc49('0x108')]()[_0xbc49('0x20')](function(){if(!_0x335822)throw new APIBadRequestError(_0xbc49('0x123'));})[_0xbc49('0x20')](function(){return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x1ecbe5}});})[_0xbc49('0x20')](function(_0xe80fe0){if(!_0xe80fe0)throw new APINotFoundError(util['format'](_0xbc49('0xcf'),_0x10425d[_0xbc49('0x5e')]['id']));return db['sequelize'][_0xbc49('0x11a')](function(_0x49d69a){return _0xe80fe0[_0xbc49('0x122')](_0x335822,{'transaction':_0x49d69a})[_0xbc49('0x20')](function(){return db[_0xbc49('0x117')][_0xbc49('0x50')]({'where':{'id':{'$in':_0x335822}}});})[_0xbc49('0x20')](function(_0x5f33f9){var _0xebbdd3=_[_0xbc49('0x35')](_0x5f33f9,function(_0x37481d){return _0x37481d[_0xbc49('0x11b')]();});return Promise['all'](_0xebbdd3);})[_0xbc49('0x20')](function(_0x2c843d){_0xe6b2a6=_[_0xbc49('0x11c')](_0x2c843d);var _0x36f949=_[_0xbc49('0x35')](_0xe6b2a6,function(_0x3ec12e){return _0x3ec12e[_0xbc49('0x124')](_0xe80fe0['id'],{'transaction':_0x49d69a});});return Promise[_0xbc49('0x5c')](_0x36f949);})['then'](function(){if(!_0xe80fe0[_0xbc49('0xa2')])return;var _0x1d5734=_[_0xbc49('0x40')](_0xe6b2a6,function(_0x56b580){return _0x56b580['getDataValue']('channel')==='Voice';});var _0x59168c=_[_0xbc49('0x35')](_0x1d5734,function(_0x1d4cbb){return db[_0xbc49('0xb1')][_0xbc49('0x2d')]({'where':{'VoiceQueueId':_0x1d4cbb['id'],'UserId':_0xe80fe0['id']},'transaction':_0x49d69a});});return Promise[_0xbc49('0x5c')](_0x59168c);})['then'](function(){return db['TeamVoicePrefix'][_0xbc49('0x50')]({'where':{'teamId':{'$in':_0x335822}}});})[_0xbc49('0x20')](function(_0x2e77d2){var _0xeab7b6=_[_0xbc49('0x35')](_0x2e77d2,function(_0x2789d7){return db[_0xbc49('0x121')][_0xbc49('0x2d')]({'where':{'UserId':_0xe80fe0['id'],'VoicePrefixId':_0x2789d7[_0xbc49('0x125')]}},{'transaction':_0x49d69a});});return Promise['all'](_0xeab7b6);});});})[_0xbc49('0x20')](function(){for(var _0x28fc88=0x0;_0x28fc88<_0xe6b2a6['length'];_0x28fc88++){var _0x452555=_0xe6b2a6[_0x28fc88][_0xbc49('0x11e')](_0xbc49('0xa1'));var _0x666789=_0x452555+'QueueId';socket[_0xbc49('0xab')](_0xbc49('0x86')+_0x452555+'Queue:remove',{'UserId':_0x1ecbe5,['queueField']:_0xe6b2a6[_0x28fc88]['id']});}})[_0xbc49('0x20')](respondWithStatusCode(_0x1f35c1,null))[_0xbc49('0x28')](APIHandleError(_0x1f35c1));};exports['getLists']=function(_0x5960f9,_0x21d330){var _0x9dab76={};var _0x97892={};var _0x38b784;var _0x32b047;return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x5960f9[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x21d330,null))[_0xbc49('0x20')](function(_0x2a01cd){if(_0x2a01cd){_0x38b784=_0x2a01cd;_0x97892[_0xbc49('0xd7')]=_['keys'](db[_0xbc49('0xd0')][_0xbc49('0x3c')]);_0x97892[_0xbc49('0x49')]=_[_0xbc49('0xd8')](_0x5960f9[_0xbc49('0x49')]);_0x97892[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x97892['model'],_0x97892['query']);_0x9dab76[_0xbc49('0x4e')]=_[_0xbc49('0xdb')](_0x97892[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x5960f9['query'][_0xbc49('0xdc')]));_0x9dab76[_0xbc49('0x4e')]=_0x9dab76[_0xbc49('0x4e')]['length']?_0x9dab76[_0xbc49('0x4e')]:_0x97892[_0xbc49('0xd7')];_0x9dab76[_0xbc49('0xea')]=qs[_0xbc49('0xdd')](_0x5960f9[_0xbc49('0x49')][_0xbc49('0xdd')]);_0x9dab76['where']=qs['filters'](_[_0xbc49('0xdf')](_0x5960f9[_0xbc49('0x49')],_0x97892[_0xbc49('0xda')]));if(_0x5960f9['query']['filter']){_0x9dab76[_0xbc49('0xde')]=_['merge'](_0x9dab76[_0xbc49('0xde')],{'$or':_['map'](_0x9dab76[_0xbc49('0x4e')],function(_0x4046d0){var _0xf0254e={};_0xf0254e[_0x4046d0]={'$like':'%'+_0x5960f9[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0xf0254e;})});}_0x9dab76=_['merge']({},_0x9dab76,_0x5960f9['options']);return _0x38b784['getLists'](_0x9dab76);}})[_0xbc49('0x20')](function(_0x462764){if(_0x462764){_0x32b047=_0x462764[_0xbc49('0x54')];if(!_0x5960f9['query']['hasOwnProperty'](_0xbc49('0xe2'))){_0x9dab76['limit']=qs[_0xbc49('0x1a')](_0x5960f9[_0xbc49('0x49')][_0xbc49('0x1a')]);_0x9dab76[_0xbc49('0x18')]=qs['offset'](_0x5960f9[_0xbc49('0x49')][_0xbc49('0x18')]);}return _0x38b784[_0xbc49('0x126')](_0x9dab76);}})[_0xbc49('0x20')](function(_0x55c5a3){if(_0x55c5a3){return _0x55c5a3?{'count':_0x32b047,'rows':_0x55c5a3}:null;}})['then'](respondWithResult(_0x21d330,null))[_0xbc49('0x28')](handleError(_0x21d330,null));};exports[_0xbc49('0x127')]=function(_0x46c808,_0x5df62c){var _0x1a6d44={};var _0x53cd55={};var _0x2cf5fc;return db[_0xbc49('0x3b')][_0xbc49('0x9c')]({'where':{'id':_0x46c808[_0xbc49('0x5e')]['id']}})[_0xbc49('0x20')](handleEntityNotFound(_0x5df62c,null))[_0xbc49('0x20')](function(_0x28a3aa){if(_0x28a3aa){_0x2cf5fc=_0x28a3aa;_0x53cd55[_0xbc49('0xd7')]=_[_0xbc49('0xd8')](db[_0xbc49('0x3b')][_0xbc49('0x3c')]);_0x53cd55[_0xbc49('0x49')]=_[_0xbc49('0xd8')](_0x46c808['query']);_0x53cd55[_0xbc49('0xda')]=_[_0xbc49('0xdb')](_0x53cd55['model'],_0x53cd55[_0xbc49('0x49')]);_0x1a6d44['attributes']=_[_0xbc49('0xdb')](_0x53cd55[_0xbc49('0xd7')],qs[_0xbc49('0xdc')](_0x46c808[_0xbc49('0x49')][_0xbc49('0xdc')]));_0x1a6d44[_0xbc49('0x4e')]=_0x1a6d44[_0xbc49('0x4e')][_0xbc49('0x54')]?_0x1a6d44[_0xbc49('0x4e')]:_0x53cd55[_0xbc49('0xd7')];_0x1a6d44['order']=qs[_0xbc49('0xdd')](_0x46c808['query'][_0xbc49('0xdd')]);_0x1a6d44[_0xbc49('0xde')]=qs['filters'](_['pick'](_0x46c808[_0xbc49('0x49')],_0x53cd55['filters']));if(_0x46c808['query'][_0xbc49('0x40')]){_0x1a6d44['where']=_['merge'](_0x1a6d44[_0xbc49('0xde')],{'$or':_[_0xbc49('0x35')](_0x1a6d44[_0xbc49('0x4e')],function(_0x3564dc){var _0x5bf265={};_0x5bf265[_0x3564dc]={'$like':'%'+_0x46c808[_0xbc49('0x49')][_0xbc49('0x40')]+'%'};return _0x5bf265;})});}_0x1a6d44['model']=db[_0xbc49('0x3b')];_0x1a6d44['as']=_0xbc49('0x31');_0x1a6d44=_[_0xbc49('0x5f')]({},_0x1a6d44,_0x46c808[_0xbc49('0x60')]);return _0x2cf5fc[_0xbc49('0x128')]({'include':[_0x1a6d44]});}})[_0xbc49('0x20')](function(_0x524c05){if(_0x524c05){var _0x1acd38={},_0x4cb84c=[];for(var _0x593faa=0x0;_0x593faa<_0x524c05['length'];_0x593faa+=0x1){for(var _0x1d5b01=0x0,_0x5d2197;_0x1d5b01<_0x524c05[_0x593faa][_0xbc49('0x31')][_0xbc49('0x54')];_0x1d5b01+=0x1){_0x5d2197=_0x524c05[_0x593faa][_0xbc49('0x31')][_0x1d5b01][_0xbc49('0x2e')]({'plain':!![]});_0x1acd38[_0x5d2197['id']]=_0x5d2197;}}_0x1acd38=_[_0xbc49('0x129')](_0x1acd38);for(var _0x25dc03=qs[_0xbc49('0x18')](_0x46c808['query'][_0xbc49('0x18')]);_0x25dc03<_0x1acd38['length']&&_0x4cb84c['length']=_0x2e6ba3[_0xc2a5('0x4b')]){throw new Error(_0xc2a5('0x4c'));}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){return db[_0xc2a5('0x43')]['destroy']({'where':{'membername':_0x2d7503[_0xc2a5('0x21')]},'individualHooks':!![]});}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){return _0x2d7503[_0xc2a5('0x4d')]({'raw':!![]});}})[_0xc2a5('0x1e')](function(_0x16083c){if(_0x2d7503){if(_0x16083c){var _0x4abe1b=[];_0x1b3555=_0x16083c;if(_0x1b3555[_0xc2a5('0x26')]){for(var _0xdee566=0x0;_0xdee566<_0x1b3555[_0xc2a5('0x26')];_0xdee566++){_0x4abe1b[_0xc2a5('0x4e')](db[_0xc2a5('0x43')][_0xc2a5('0x4f')]({'membername':_0x2d7503['name'],'UserId':_0x2d7503['id'],'queue_name':_0x1b3555[_0xdee566][_0xc2a5('0x21')],'VoiceQueueId':_0x1b3555[_0xdee566]['id'],'interface':_0x20599c,'paused':_0x2d7503[_0xc2a5('0x50')]||![],'penalty':_0x1b3555[_0xdee566][_0xc2a5('0x51')]||0x0}));}return BPromise[_0xc2a5('0x45')](_0x4abe1b);}}}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){return db['MemberReport'][_0xc2a5('0xe')]({'where':{'membername':_0x2d7503[_0xc2a5('0x21')],'exitAt':null}});}})[_0xc2a5('0x1e')](function(_0x58c2bf){if(_0x2d7503){if(_0x58c2bf&&_0x58c2bf[_0xc2a5('0x26')]){var _0x4abfca=[];_0x58c2bf[_0xc2a5('0x2a')](function(_0x197e92){_0x4abfca['push'](_0x197e92[_0xc2a5('0x32')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xc2a5('0x45')](_0x4abfca);}}})[_0xc2a5('0x1e')](function(){if(_0x2d7503){var _0x29299d=[];var _0x302b69=[];var _0x481702=utils[_0xc2a5('0x29')]();var _0x1fbc93={'membername':_0x2d7503[_0xc2a5('0x21')],'interface':_0x20599c,'enterAt':moment()[_0xc2a5('0x24')](_0xc2a5('0x27')),'role':_0x2d7503['role'],'internal':_0x2d7503[_0xc2a5('0x23')]};_0x481702[_0xc2a5('0x2a')](function(_0x3103f6){_0x29299d[_0xc2a5('0x4e')](_[_0xc2a5('0x52')]({'channel':_0x3103f6,'type':'LOGIN','data1':_0xc2a5('0x53'),'data2':_0x20599c},_0x1fbc93));if(_0x2d7503[_0xc2a5('0x50')]){_0x302b69['push'](_[_0xc2a5('0x52')]({'channel':_0x3103f6,'type':_0xc2a5('0x54'),'data1':_0xc2a5('0x55')},_0x1fbc93));}});return db['MemberReport']['bulkCreate'](_0x29299d[_0xc2a5('0x56')](_0x302b69),{'individualHooks':!![]});}})['then'](function(){if(_0x2d7503){return _0x2d7503['update']({'online':!![],'lastLoginAt':moment()[_0xc2a5('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x2d7503[_0xc2a5('0x50')]||![],'mailPause':_0x2d7503[_0xc2a5('0x50')]||![],'chatPause':_0x2d7503[_0xc2a5('0x50')]||![],'faxPause':_0x2d7503[_0xc2a5('0x50')]||![],'smsPause':_0x2d7503[_0xc2a5('0x50')]||![],'openchannelPause':_0x2d7503[_0xc2a5('0x50')]||![],'pauseType':_0x2d7503[_0xc2a5('0x50')]?_0xc2a5('0x55'):null,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x20599c});}})[_0xc2a5('0x1e')](function(_0xf7c044){_0x3b7d7d(_0xf7c044);})['catch'](function(_0x347fe6){_0x2b8e9c(_0x222566[_0xc2a5('0x1a')](0x1f4,_0x347fe6[_0xc2a5('0x1b')]));});});}; \ No newline at end of file +var _0xc83d=['ShowUser','then','find','name','internal','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','update','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','SIP/%s','type','DEFAULT\x20PAUSE','role','body','bulkCreate','UnpauseUser','resolve','isValidChannel','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','unpause','system','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','push','upsert','UserVoiceQueue.penalty','findAll','all','merge','concat','LOGININPAUSE','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./user.socket','register','GetUser','User','options','raw','where','include','map','model','attributes','info','stringify','catch','error','message'];(function(_0x2272b5,_0x362458){var _0x110156=function(_0x5c2e32){while(--_0x5c2e32){_0x2272b5['push'](_0x2272b5['shift']());}};_0x110156(++_0x362458);}(_0xc83d,0xeb));var _0xdc83=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc83d[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xdc83('0x0'));var util=require(_0xdc83('0x1'));var moment=require('moment');var BPromise=require(_0xdc83('0x2'));var Redis=require(_0xdc83('0x3'));var db=require(_0xdc83('0x4'))['db'];var utils=require(_0xdc83('0x5'));var logger=require(_0xdc83('0x6'))(_0xdc83('0x7'));var config=require(_0xdc83('0x8'));config[_0xdc83('0x9')]=_[_0xdc83('0xa')](config[_0xdc83('0x9')],{'host':_0xdc83('0xb'),'port':0x18eb});var socket=require(_0xdc83('0xc'))(new Redis(config[_0xdc83('0x9')]));require(_0xdc83('0xd'))[_0xdc83('0xe')](socket);exports[_0xdc83('0xf')]=function(_0x57baa6){var _0x3a8358=this;return new Promise(function(_0xdda182,_0x41c5d6){return db[_0xdc83('0x10')]['findAll']({'raw':_0x57baa6[_0xdc83('0x11')]?_0x57baa6[_0xdc83('0x11')][_0xdc83('0x12')]===undefined?!![]:![]:!![],'where':_0x57baa6[_0xdc83('0x11')]?_0x57baa6[_0xdc83('0x11')][_0xdc83('0x13')]||null:null,'attributes':_0x57baa6[_0xdc83('0x11')]?_0x57baa6[_0xdc83('0x11')]['attributes']||null:null,'limit':_0x57baa6[_0xdc83('0x11')]?_0x57baa6[_0xdc83('0x11')]['limit']||null:null,'include':_0x57baa6[_0xdc83('0x11')]?_0x57baa6[_0xdc83('0x11')][_0xdc83('0x14')]?_[_0xdc83('0x15')](_0x57baa6[_0xdc83('0x11')]['include'],function(_0x1231e8){return{'model':db[_0x1231e8[_0xdc83('0x16')]],'as':_0x1231e8['as'],'attributes':_0x1231e8['attributes'],'include':_0x1231e8[_0xdc83('0x14')]?_['map'](_0x1231e8[_0xdc83('0x14')],function(_0x1bb93b){return{'model':db[_0x1bb93b[_0xdc83('0x16')]],'as':_0x1bb93b['as'],'attributes':_0x1bb93b[_0xdc83('0x17')],'include':_0x1bb93b[_0xdc83('0x14')]?_[_0xdc83('0x15')](_0x1bb93b[_0xdc83('0x14')],function(_0xf8bb26){return{'model':db[_0xf8bb26[_0xdc83('0x16')]],'as':_0xf8bb26['as'],'attributes':_0xf8bb26['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x194a45){logger[_0xdc83('0x18')]('GetUser',_0x57baa6);logger['debug'](_0xdc83('0xf'),_0x57baa6,JSON[_0xdc83('0x19')](_0x194a45));_0xdda182(_0x194a45);})[_0xdc83('0x1a')](function(_0x5c5044){logger[_0xdc83('0x1b')](_0xdc83('0xf'),_0x5c5044[_0xdc83('0x1c')],_0x57baa6);_0x41c5d6(_0x3a8358[_0xdc83('0x1b')](0x1f4,_0x5c5044[_0xdc83('0x1c')]));});});};exports[_0xdc83('0x1d')]=function(_0x27966b){var _0x42f3db=this;return new Promise(function(_0x15446e,_0x2690f2){return db[_0xdc83('0x10')]['find']({'raw':_0x27966b[_0xdc83('0x11')]?_0x27966b[_0xdc83('0x11')]['raw']===undefined?!![]:![]:!![],'where':_0x27966b[_0xdc83('0x11')]?_0x27966b['options']['where']||null:null,'attributes':_0x27966b[_0xdc83('0x11')]?_0x27966b[_0xdc83('0x11')][_0xdc83('0x17')]||null:null,'include':_0x27966b[_0xdc83('0x11')]?_0x27966b[_0xdc83('0x11')]['include']?_['map'](_0x27966b[_0xdc83('0x11')][_0xdc83('0x14')],function(_0x45d356){return{'model':db[_0x45d356[_0xdc83('0x16')]],'as':_0x45d356['as'],'attributes':_0x45d356[_0xdc83('0x17')],'include':_0x45d356[_0xdc83('0x14')]?_[_0xdc83('0x15')](_0x45d356[_0xdc83('0x14')],function(_0x4ddc0c){return{'model':db[_0x4ddc0c[_0xdc83('0x16')]],'as':_0x4ddc0c['as'],'attributes':_0x4ddc0c[_0xdc83('0x17')],'include':_0x4ddc0c[_0xdc83('0x14')]?_[_0xdc83('0x15')](_0x4ddc0c[_0xdc83('0x14')],function(_0x4f75a0){return{'model':db[_0x4f75a0[_0xdc83('0x16')]],'as':_0x4f75a0['as'],'attributes':_0x4f75a0[_0xdc83('0x17')]};}):[]};}):[]};}):[]:[]})[_0xdc83('0x1e')](function(_0x3a534f){logger[_0xdc83('0x18')](_0xdc83('0x1d'),_0x27966b);logger['debug'](_0xdc83('0x1d'),_0x27966b,JSON[_0xdc83('0x19')](_0x3a534f));_0x15446e(_0x3a534f);})[_0xdc83('0x1a')](function(_0x1ade41){logger['error']('ShowUser',_0x1ade41[_0xdc83('0x1c')],_0x27966b);_0x2690f2(_0x42f3db['error'](0x1f4,_0x1ade41['message']));});});};exports['PauseUser']=function(_0x57a7fd){var _0x26f952;return db['User'][_0xdc83('0x1f')]({'where':_0x57a7fd['options'][_0xdc83('0x13')]||{},'attributes':['id',_0xdc83('0x20'),'role',_0xdc83('0x21'),_0xdc83('0x22')]})[_0xdc83('0x1e')](function(_0x1296c8){if(!_0x1296c8){throw new Error(util[_0xdc83('0x23')](_0xdc83('0x24'),_0x57a7fd[_0xdc83('0x25')]['id']));}_0x26f952=_0x1296c8;return db[_0xdc83('0x26')][_0xdc83('0x27')]({'paused':0x1},{'where':{'UserId':_0x26f952['id']},'individualHooks':!![]});})[_0xdc83('0x1e')](function(){return db[_0xdc83('0x28')]['findAll']({'where':{'membername':_0x26f952['name'],'type':_0xdc83('0x29'),'exitAt':null}});})[_0xdc83('0x1e')](function(_0x2e4f56){if(_0x2e4f56&&_0x2e4f56[_0xdc83('0x2a')]){var _0x49bbae=moment()[_0xdc83('0x23')](_0xdc83('0x2b'));for(var _0x49f6d4=0x0,_0x1ee45a=_0x2e4f56[_0xdc83('0x2a')];_0x49f6d4<_0x1ee45a;_0x49f6d4++){_0x2e4f56[_0x49f6d4][_0xdc83('0x2c')]({'exitAt':_0x49bbae});}}})[_0xdc83('0x1e')](function(){var _0xf683ce=[];var _0x50cdc5=utils[_0xdc83('0x2d')]();_0x50cdc5[_0xdc83('0x2e')](function(_0x2a2400){_0xf683ce['push']({'channel':_0x2a2400,'membername':_0x26f952[_0xdc83('0x20')],'interface':_['isNil'](_0x26f952[_0xdc83('0x22')])?util['format'](_0xdc83('0x2f'),_0x26f952[_0xdc83('0x20')]):_0x26f952[_0xdc83('0x22')],'type':_0xdc83('0x29'),'enterAt':moment()[_0xdc83('0x23')](_0xdc83('0x2b')),'data1':_0x57a7fd['body'][_0xdc83('0x30')]||_0xdc83('0x31'),'role':_0x26f952[_0xdc83('0x32')],'internal':_0x26f952['internal'],'uniqueid':_0x57a7fd[_0xdc83('0x33')]['uniqueid']||null});});return db[_0xdc83('0x28')][_0xdc83('0x34')](_0xf683ce,{'individualHooks':!![]});})['then'](function(){return _0x26f952[_0xdc83('0x27')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x57a7fd[_0xdc83('0x33')][_0xdc83('0x30')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0xdc83('0x1a')](function(_0x16db48){throw _0x16db48;});};exports[_0xdc83('0x35')]=function(_0x171acf){return Promise[_0xdc83('0x36')]()[_0xdc83('0x1e')](function(){if(_0x171acf['body']['channel']&&!utils[_0xdc83('0x37')](_0x171acf['body'][_0xdc83('0x38')])){throw new Error(util[_0xdc83('0x23')](_0xdc83('0x39'),_0x171acf[_0xdc83('0x33')][_0xdc83('0x38')]));}return db['User'][_0xdc83('0x3a')]({'where':_0x171acf[_0xdc83('0x11')][_0xdc83('0x13')]||{},'attributes':['id',_0xdc83('0x20'),_0xdc83('0x32'),_0xdc83('0x21'),_0xdc83('0x22'),_0xdc83('0x3b'),_0xdc83('0x3c'),_0xdc83('0x3d'),_0xdc83('0x3e'),_0xdc83('0x3f'),_0xdc83('0x40'),_0xdc83('0x41'),'whatsappPause','pauseType','lastPauseAt']});})[_0xdc83('0x1e')](function(_0x5ee332){if(!_0x5ee332){throw new Error(util[_0xdc83('0x23')](_0xdc83('0x24'),_0x171acf[_0xdc83('0x25')]['id']));}return _0x5ee332[_0xdc83('0x42')](_0x171acf[_0xdc83('0x33')][_0xdc83('0x38')],_0xdc83('0x43'));})[_0xdc83('0x1a')](function(_0x51aa7f){throw _0x51aa7f;});};exports['LogoutUser']=function(_0x2474b6){var _0x2db6ef=this;return new Promise(function(_0x506b42,_0x2da206){var _0x5114e1;return db[_0xdc83('0x10')]['findOne']({'where':_0x2474b6[_0xdc83('0x11')][_0xdc83('0x13')]||{},'attributes':['id',_0xdc83('0x20')]})[_0xdc83('0x1e')](function(_0x37b221){if(_0x37b221){_0x5114e1=_0x37b221;return db[_0xdc83('0x26')]['destroy']({'where':{'membername':_0x5114e1[_0xdc83('0x20')]},'individualHooks':!![]});}})[_0xdc83('0x1e')](function(){if(_0x5114e1){return db['MemberReport']['findAll']({'where':{'membername':_0x5114e1['name'],'exitAt':null}});}})[_0xdc83('0x1e')](function(_0x449280){if(_0x5114e1){if(_0x449280&&_0x449280['length']){var _0x56ad03=[];_0x449280[_0xdc83('0x2e')](function(_0x260750){_0x56ad03['push'](_0x260750['update']({'exitAt':moment()[_0xdc83('0x23')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x56ad03);}}})[_0xdc83('0x1e')](function(){if(_0x5114e1){return _0x5114e1[_0xdc83('0x27')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0xdc83('0x1e')](function(_0x4b3d5b){_0x506b42(_0x4b3d5b);})['catch'](function(_0x3412ce){_0x2da206(_0x2db6ef[_0xdc83('0x1b')](0x1f4,_0x3412ce[_0xdc83('0x1c')]));});});};exports[_0xdc83('0x44')]=function(_0x507a17){var _0xc3f487=this;return new Promise(function(_0x79801,_0x102054){var _0x2da334;var _0x4424e6;var _0x3df94b;var _0xe4ea79;return db[_0xdc83('0x10')][_0xdc83('0x3a')]({'where':_0x507a17['options'][_0xdc83('0x13')]||{},'attributes':['id',_0xdc83('0x20'),_0xdc83('0x32'),_0xdc83('0x45'),_0xdc83('0x46'),_0xdc83('0x21'),_0xdc83('0x47'),_0xdc83('0x22')]})[_0xdc83('0x1e')](function(_0x35dc42){if(_0x35dc42){_0x2da334=_0x35dc42;_0xe4ea79=_0x507a17[_0xdc83('0x33')][_0xdc83('0x22')]?_0x507a17[_0xdc83('0x33')][_0xdc83('0x22')]:util[_0xdc83('0x23')](_0xdc83('0x2f'),_0x2da334[_0xdc83('0x20')]);return db[_0xdc83('0x10')][_0xdc83('0x48')]({'where':{'role':_0xdc83('0x49'),'online':!![],'id':{'$ne':_0x2da334['id']}}});}})[_0xdc83('0x1e')](function(_0x24ca77){if(_0x24ca77){_0x3df94b=_0x24ca77;return require(_0xdc83('0x4a'))[_0xdc83('0x4b')]();}})[_0xdc83('0x1e')](function(_0x3579a9){if(_0x3579a9&&_0x3579a9[_0xdc83('0x4c')]&&_0x3df94b>=_0x3579a9[_0xdc83('0x4c')]){throw new Error(_0xdc83('0x4d'));}})['then'](function(){if(_0x2da334){return db['UserVoiceQueueRt'][_0xdc83('0x4e')]({'where':{'membername':_0x2da334[_0xdc83('0x20')]},'individualHooks':!![]});}})[_0xdc83('0x1e')](function(){if(_0x2da334){return _0x2da334[_0xdc83('0x4f')]({'raw':!![]});}})['then'](function(_0xfb6715){if(_0x2da334){if(_0xfb6715){var _0x453757=[];_0x4424e6=_0xfb6715;if(_0x4424e6[_0xdc83('0x2a')]){for(var _0x4d8a04=0x0;_0x4d8a04<_0x4424e6[_0xdc83('0x2a')];_0x4d8a04++){_0x453757[_0xdc83('0x50')](db[_0xdc83('0x26')][_0xdc83('0x51')]({'membername':_0x2da334[_0xdc83('0x20')],'UserId':_0x2da334['id'],'queue_name':_0x4424e6[_0x4d8a04][_0xdc83('0x20')],'VoiceQueueId':_0x4424e6[_0x4d8a04]['id'],'interface':_0xe4ea79,'paused':_0x2da334[_0xdc83('0x47')]||![],'penalty':_0x4424e6[_0x4d8a04][_0xdc83('0x52')]||0x0}));}return BPromise['all'](_0x453757);}}}})[_0xdc83('0x1e')](function(){if(_0x2da334){return db[_0xdc83('0x28')][_0xdc83('0x53')]({'where':{'membername':_0x2da334[_0xdc83('0x20')],'exitAt':null}});}})['then'](function(_0x256a17){if(_0x2da334){if(_0x256a17&&_0x256a17[_0xdc83('0x2a')]){var _0x327cec=[];_0x256a17['forEach'](function(_0x2eb394){_0x327cec[_0xdc83('0x50')](_0x2eb394[_0xdc83('0x27')]({'exitAt':moment()[_0xdc83('0x23')](_0xdc83('0x2b'))}));});return BPromise[_0xdc83('0x54')](_0x327cec);}}})[_0xdc83('0x1e')](function(){if(_0x2da334){var _0x53e8ed=[];var _0x431c85=[];var _0x3671ee=utils[_0xdc83('0x2d')]();var _0x552167={'membername':_0x2da334['name'],'interface':_0xe4ea79,'enterAt':moment()[_0xdc83('0x23')](_0xdc83('0x2b')),'role':_0x2da334[_0xdc83('0x32')],'internal':_0x2da334[_0xdc83('0x21')]};_0x3671ee[_0xdc83('0x2e')](function(_0x328b69){_0x53e8ed[_0xdc83('0x50')](_['merge']({'channel':_0x328b69,'type':'LOGIN','data1':'callysquare','data2':_0xe4ea79},_0x552167));if(_0x2da334['loginInPause']){_0x431c85['push'](_[_0xdc83('0x55')]({'channel':_0x328b69,'type':'PAUSE','data1':'LOGININPAUSE'},_0x552167));}});return db[_0xdc83('0x28')]['bulkCreate'](_0x53e8ed[_0xdc83('0x56')](_0x431c85),{'individualHooks':!![]});}})['then'](function(){if(_0x2da334){return _0x2da334['update']({'online':!![],'lastLoginAt':moment()['format'](_0xdc83('0x2b')),'voicePause':_0x2da334[_0xdc83('0x47')]||![],'mailPause':_0x2da334[_0xdc83('0x47')]||![],'chatPause':_0x2da334[_0xdc83('0x47')]||![],'faxPause':_0x2da334['loginInPause']||![],'smsPause':_0x2da334[_0xdc83('0x47')]||![],'openchannelPause':_0x2da334[_0xdc83('0x47')]||![],'pauseType':_0x2da334[_0xdc83('0x47')]?_0xdc83('0x57'):null,'lastPauseAt':moment()[_0xdc83('0x23')](_0xdc83('0x2b')),'interface':_0xe4ea79});}})[_0xdc83('0x1e')](function(_0xc1ad0a){_0x79801(_0xc1ad0a);})[_0xdc83('0x1a')](function(_0x274329){_0x102054(_0xc3f487[_0xdc83('0x1b')](0x1f4,_0x274329['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 0439878..4341210 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 _0xf9e5=['length','user:','./user.events','save','remove','update','emit','removeListener','register'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xf9e5,0x13d));var _0x5f9e=function(_0x29f3e3,_0x227bea){_0x29f3e3=_0x29f3e3-0x0;var _0x44b1b0=_0xf9e5[_0x29f3e3];return _0x44b1b0;};'use strict';var UserEvents=require(_0x5f9e('0x0'));var events=[_0x5f9e('0x1'),_0x5f9e('0x2'),_0x5f9e('0x3')];function createListener(_0x34b73e,_0x37256c){return function(_0x89474a){_0x37256c[_0x5f9e('0x4')](_0x34b73e,_0x89474a);};}function removeListener(_0x55bac3,_0x2bcaef){return function(){UserEvents[_0x5f9e('0x5')](_0x55bac3,_0x2bcaef);};}exports[_0x5f9e('0x6')]=function(_0x57e08b){for(var _0x2032e1=0x0,_0x44b55e=events[_0x5f9e('0x7')];_0x2032e1<_0x44b55e;_0x2032e1++){var _0x4cd279=events[_0x2032e1];var _0x23a6b7=createListener(_0x5f9e('0x8')+_0x4cd279,_0x57e08b);UserEvents['on'](_0x4cd279,_0x23a6b7);}}; \ No newline at end of file +var _0x4da7=['update','emit','register','length','save','remove'];(function(_0x16a065,_0x62d8a7){var _0x3e3b91=function(_0x11e604){while(--_0x11e604){_0x16a065['push'](_0x16a065['shift']());}};_0x3e3b91(++_0x62d8a7);}(_0x4da7,0x1ba));var _0x74da=function(_0x3fcdb3,_0x2528a6){_0x3fcdb3=_0x3fcdb3-0x0;var _0x3ff87b=_0x4da7[_0x3fcdb3];return _0x3ff87b;};'use strict';var UserEvents=require('./user.events');var events=[_0x74da('0x0'),_0x74da('0x1'),_0x74da('0x2')];function createListener(_0x1806a7,_0x3d8a8c){return function(_0x559ba7){_0x3d8a8c[_0x74da('0x3')](_0x1806a7,_0x559ba7);};}function removeListener(_0xf70186,_0x557792){return function(){UserEvents['removeListener'](_0xf70186,_0x557792);};}exports[_0x74da('0x4')]=function(_0xf4cace){for(var _0x4acc13=0x0,_0x5b3d8a=events[_0x74da('0x5')];_0x4acc13<_0x5b3d8a;_0x4acc13++){var _0x4e71b8=events[_0x4acc13];var _0xe95f9=createListener('user:'+_0x4e71b8,_0xf4cace);UserEvents['on'](_0x4e71b8,_0xe95f9);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 88744ac..57784b5 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x28d8d6,_0x452f71){var _0x12ba8e=function(_0x4548c8){while(--_0x4548c8){_0x28d8d6['push'](_0x28d8d6['shift']());}};_0x12ba8e(++_0x452f71);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2b6611,_0x366ffe){var _0x108264=function(_0x1d3c78){while(--_0x1d3c78){_0x2b6611['push'](_0x2b6611['shift']());}};_0x108264(++_0x366ffe);}(_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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e53b169..a954da9 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 _0xbe83=['sequelize','INTEGER'];(function(_0x145e4c,_0x180ceb){var _0x2deb14=function(_0x51b2e1){while(--_0x51b2e1){_0x145e4c['push'](_0x145e4c['shift']());}};_0x2deb14(++_0x180ceb);}(_0xbe83,0xee));var _0x3be8=function(_0x3d9ded,_0x1ffcd0){_0x3d9ded=_0x3d9ded-0x0;var _0x348b01=_0xbe83[_0x3d9ded];return _0x348b01;};'use strict';var Sequelize=require(_0x3be8('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3be8('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1fb7=['sequelize','INTEGER'];(function(_0x3e8e14,_0x3c489b){var _0x3ba918=function(_0x5511b2){while(--_0x5511b2){_0x3e8e14['push'](_0x3e8e14['shift']());}};_0x3ba918(++_0x3c489b);}(_0x1fb7,0xda));var _0x71fb=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0x1fb7[_0x44b0de];return _0x21da2a;};'use strict';var Sequelize=require(_0x71fb('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x71fb('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 9e6144b..15f8ef3 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 _0x35b8=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','lodash','../../config/logger','api'];(function(_0x6b2718,_0x40e9f3){var _0x49b993=function(_0x30ca07){while(--_0x30ca07){_0x6b2718['push'](_0x6b2718['shift']());}};_0x49b993(++_0x40e9f3);}(_0x35b8,0x176));var _0x835b=function(_0x353abb,_0x194c80){_0x353abb=_0x353abb-0x0;var _0x43c9c5=_0x35b8[_0x353abb];return _0x43c9c5;};'use strict';var _=require(_0x835b('0x0'));var util=require('util');var logger=require(_0x835b('0x1'))(_0x835b('0x2'));var moment=require(_0x835b('0x3'));var BPromise=require(_0x835b('0x4'));var rp=require(_0x835b('0x5'));var fs=require('fs');var path=require(_0x835b('0x6'));var rimraf=require(_0x835b('0x7'));var config=require(_0x835b('0x8'));var attributes=require(_0x835b('0x9'));module[_0x835b('0xa')]=function(_0x4fa1e4,_0x26adf3){return _0x4fa1e4[_0x835b('0xb')](_0x835b('0xc'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c2d=['UserChatQueue','user_has_chat_queues','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x22491c,_0x163c40){var _0x4740bb=function(_0x14ae78){while(--_0x14ae78){_0x22491c['push'](_0x22491c['shift']());}};_0x4740bb(++_0x163c40);}(_0x1c2d,0x16d));var _0xd1c2=function(_0x3c2576,_0x10994b){_0x3c2576=_0x3c2576-0x0;var _0x3435d0=_0x1c2d[_0x3c2576];return _0x3435d0;};'use strict';var _=require(_0xd1c2('0x0'));var util=require(_0xd1c2('0x1'));var logger=require('../../config/logger')(_0xd1c2('0x2'));var moment=require(_0xd1c2('0x3'));var BPromise=require(_0xd1c2('0x4'));var rp=require(_0xd1c2('0x5'));var fs=require('fs');var path=require(_0xd1c2('0x6'));var rimraf=require('rimraf');var config=require(_0xd1c2('0x7'));var attributes=require('./userChatQueue.attributes');module[_0xd1c2('0x8')]=function(_0x25b426,_0x1d90e7){return _0x25b426['define'](_0xd1c2('0x9'),attributes,{'tableName':_0xd1c2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 160aced..33b75d5 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 _0x0623=['http','info','request\x20sent','debug','error','code','message','result','catch','UserChatQueue,\x20%s,\x20%s','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0623,0xbe));var _0x3062=function(_0x149756,_0x3ca594){_0x149756=_0x149756-0x0;var _0x7b8dc2=_0x0623[_0x149756];return _0x7b8dc2;};'use strict';var _=require(_0x3062('0x0'));var util=require(_0x3062('0x1'));var moment=require(_0x3062('0x2'));var BPromise=require(_0x3062('0x3'));var rs=require(_0x3062('0x4'));var fs=require('fs');var Redis=require(_0x3062('0x5'));var db=require(_0x3062('0x6'))['db'];var utils=require(_0x3062('0x7'));var logger=require('../../config/logger')(_0x3062('0x8'));var config=require(_0x3062('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3062('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3da16f,_0xad1bdb,_0x5a6968){return new BPromise(function(_0x192660,_0x4fefc5){return client['request'](_0x3da16f,_0x5a6968)['then'](function(_0xc1d664){logger[_0x3062('0xb')]('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0x3062('0xc'));logger[_0x3062('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xad1bdb,'request\x20sent',JSON['stringify'](_0xc1d664));if(_0xc1d664[_0x3062('0xe')]){if(_0xc1d664[_0x3062('0xe')][_0x3062('0xf')]===0x1f4){logger[_0x3062('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0xc1d664[_0x3062('0xe')]['message']);return _0x4fefc5(_0xc1d664[_0x3062('0xe')][_0x3062('0x10')]);}logger[_0x3062('0xe')]('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0xc1d664[_0x3062('0xe')]['message']);return _0x192660(_0xc1d664[_0x3062('0xe')][_0x3062('0x10')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0xad1bdb,_0x3062('0xc'));_0x192660(_0xc1d664[_0x3062('0x11')][_0x3062('0x10')]);}})[_0x3062('0x12')](function(_0x50989c){logger['error'](_0x3062('0x13'),_0xad1bdb,_0x50989c);_0x4fefc5(_0x50989c);});});} \ No newline at end of file +var _0x48f4=['UserChatQueue,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','request\x20sent','debug','stringify','error','code'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x48f4,0x1e8));var _0x448f=function(_0x142ec2,_0x5bb03d){_0x142ec2=_0x142ec2-0x0;var _0x45ef4e=_0x48f4[_0x142ec2];return _0x45ef4e;};'use strict';var _=require(_0x448f('0x0'));var util=require(_0x448f('0x1'));var moment=require(_0x448f('0x2'));var BPromise=require(_0x448f('0x3'));var rs=require(_0x448f('0x4'));var fs=require('fs');var Redis=require(_0x448f('0x5'));var db=require(_0x448f('0x6'))['db'];var utils=require(_0x448f('0x7'));var logger=require('../../config/logger')(_0x448f('0x8'));var config=require(_0x448f('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x448f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55c6bd,_0x4c1afe,_0x22429c){return new BPromise(function(_0x264053,_0x21d4d4){return client[_0x448f('0xb')](_0x55c6bd,_0x22429c)[_0x448f('0xc')](function(_0x2bb6ef){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x4c1afe,_0x448f('0xd'));logger[_0x448f('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x4c1afe,'request\x20sent',JSON[_0x448f('0xf')](_0x2bb6ef));if(_0x2bb6ef[_0x448f('0x10')]){if(_0x2bb6ef[_0x448f('0x10')][_0x448f('0x11')]===0x1f4){logger[_0x448f('0x10')](_0x448f('0x12'),_0x4c1afe,_0x2bb6ef[_0x448f('0x10')][_0x448f('0x13')]);return _0x21d4d4(_0x2bb6ef[_0x448f('0x10')][_0x448f('0x13')]);}logger[_0x448f('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x4c1afe,_0x2bb6ef[_0x448f('0x10')][_0x448f('0x13')]);return _0x264053(_0x2bb6ef[_0x448f('0x10')][_0x448f('0x13')]);}else{logger[_0x448f('0x14')](_0x448f('0x12'),_0x4c1afe,_0x448f('0xd'));_0x264053(_0x2bb6ef['result'][_0x448f('0x13')]);}})[_0x448f('0x15')](function(_0x5e483c){logger[_0x448f('0x10')](_0x448f('0x12'),_0x4c1afe,_0x5e483c);_0x21d4d4(_0x5e483c);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index dd74347..47e6cc9 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x55f6d7,_0x5bd984){var _0x2153cc=function(_0x11ff8b){while(--_0x11ff8b){_0x55f6d7['push'](_0x55f6d7['shift']());}};_0x2153cc(++_0x5bd984);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xa9e0[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x32f375,_0x42072c){var _0x415558=function(_0x1730a0){while(--_0x1730a0){_0x32f375['push'](_0x32f375['shift']());}};_0x415558(++_0x42072c);}(_0x70e0,0x17b));var _0x070e=function(_0x1be163,_0x290ca8){_0x1be163=_0x1be163-0x0;var _0x7bcbab=_0x70e0[_0x1be163];return _0x7bcbab;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 94892c0..9a07e00 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 _0x3f4d=['INTEGER','sequelize'];(function(_0x4953c9,_0x24591d){var _0x263a5e=function(_0x4181bf){while(--_0x4181bf){_0x4953c9['push'](_0x4953c9['shift']());}};_0x263a5e(++_0x24591d);}(_0x3f4d,0xeb));var _0xd3f4=function(_0x5e4fb9,_0x45caf4){_0x5e4fb9=_0x5e4fb9-0x0;var _0x4189b4=_0x3f4d[_0x5e4fb9];return _0x4189b4;};'use strict';var Sequelize=require(_0xd3f4('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd3f4('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xd3f4('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf06b=['sequelize','exports','STRING'];(function(_0x1e5dee,_0x1615f8){var _0x52aa4f=function(_0x52bf9c){while(--_0x52bf9c){_0x1e5dee['push'](_0x1e5dee['shift']());}};_0x52aa4f(++_0x1615f8);}(_0xf06b,0x75));var _0xbf06=function(_0x12f773,_0x98bc4c){_0x12f773=_0x12f773-0x0;var _0x3f008a=_0xf06b[_0x12f773];return _0x3f008a;};'use strict';var Sequelize=require(_0xbf06('0x0'));module[_0xbf06('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize[_0xbf06('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 4ac3ab5..d96d988 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 _0xd849=['exports','define','user_has_fax_queues','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x2c17a2,_0x58f80f){var _0x21d8c3=function(_0x41c5a5){while(--_0x41c5a5){_0x2c17a2['push'](_0x2c17a2['shift']());}};_0x21d8c3(++_0x58f80f);}(_0xd849,0x6f));var _0x9d84=function(_0x5bc28b,_0x5bf1a0){_0x5bc28b=_0x5bc28b-0x0;var _0x27a1d9=_0xd849[_0x5bc28b];return _0x27a1d9;};'use strict';var _=require(_0x9d84('0x0'));var util=require('util');var logger=require(_0x9d84('0x1'))('api');var moment=require(_0x9d84('0x2'));var BPromise=require(_0x9d84('0x3'));var rp=require(_0x9d84('0x4'));var fs=require('fs');var path=require(_0x9d84('0x5'));var rimraf=require(_0x9d84('0x6'));var config=require(_0x9d84('0x7'));var attributes=require(_0x9d84('0x8'));module[_0x9d84('0x9')]=function(_0x8f4da0,_0x4644c1){return _0x8f4da0[_0x9d84('0xa')]('UserFaxQueue',attributes,{'tableName':_0x9d84('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedbb=['exports','define','UserFaxQueue','user_has_fax_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x79cd47,_0x16102d){var _0x3b9484=function(_0x23db95){while(--_0x23db95){_0x79cd47['push'](_0x79cd47['shift']());}};_0x3b9484(++_0x16102d);}(_0xedbb,0x74));var _0xbedb=function(_0x98fd7c,_0x488a10){_0x98fd7c=_0x98fd7c-0x0;var _0x3ae559=_0xedbb[_0x98fd7c];return _0x3ae559;};'use strict';var _=require(_0xbedb('0x0'));var util=require(_0xbedb('0x1'));var logger=require(_0xbedb('0x2'))(_0xbedb('0x3'));var moment=require(_0xbedb('0x4'));var BPromise=require(_0xbedb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbedb('0x6'));var rimraf=require(_0xbedb('0x7'));var config=require(_0xbedb('0x8'));var attributes=require(_0xbedb('0x9'));module[_0xbedb('0xa')]=function(_0x32cd7a,_0x24321b){return _0x32cd7a[_0xbedb('0xb')](_0xbedb('0xc'),attributes,{'tableName':_0xbedb('0xd'),'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 eff1bb4..3b75ebc 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 _0xdbad=['lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x524cb3,_0x2d702a){var _0x288975=function(_0x5e4b56){while(--_0x5e4b56){_0x524cb3['push'](_0x524cb3['shift']());}};_0x288975(++_0x2d702a);}(_0xdbad,0x1db));var _0xddba=function(_0x4b37c2,_0x13d497){_0x4b37c2=_0x4b37c2-0x0;var _0x5032f5=_0xdbad[_0x4b37c2];return _0x5032f5;};'use strict';var _=require(_0xddba('0x0'));var util=require(_0xddba('0x1'));var moment=require('moment');var BPromise=require(_0xddba('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xddba('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xddba('0x4'));var logger=require(_0xddba('0x5'))(_0xddba('0x6'));var config=require(_0xddba('0x7'));var jayson=require(_0xddba('0x8'));var client=jayson['client'][_0xddba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c834d,_0x5db4ca,_0x4b13cf){return new BPromise(function(_0x5a5bc0,_0x55c1e4){return client['request'](_0x2c834d,_0x4b13cf)[_0xddba('0xa')](function(_0x3e4eaf){logger[_0xddba('0xb')](_0xddba('0xc'),_0x5db4ca,_0xddba('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5db4ca,_0xddba('0xd'),JSON[_0xddba('0xe')](_0x3e4eaf));if(_0x3e4eaf['error']){if(_0x3e4eaf[_0xddba('0xf')][_0xddba('0x10')]===0x1f4){logger['error'](_0xddba('0xc'),_0x5db4ca,_0x3e4eaf[_0xddba('0xf')]['message']);return _0x55c1e4(_0x3e4eaf['error'][_0xddba('0x11')]);}logger['error'](_0xddba('0xc'),_0x5db4ca,_0x3e4eaf['error']['message']);return _0x5a5bc0(_0x3e4eaf[_0xddba('0xf')][_0xddba('0x11')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x5db4ca,'request\x20sent');_0x5a5bc0(_0x3e4eaf['result'][_0xddba('0x11')]);}})[_0xddba('0x12')](function(_0x3f5874){logger[_0xddba('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x5db4ca,_0x3f5874);_0x55c1e4(_0x3f5874);});});} \ No newline at end of file +var _0x0186=['stringify','error','code','message','result','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s'];(function(_0x48093c,_0x482d40){var _0x44c9dd=function(_0x2614e1){while(--_0x2614e1){_0x48093c['push'](_0x48093c['shift']());}};_0x44c9dd(++_0x482d40);}(_0x0186,0xd7));var _0x6018=function(_0x3954bf,_0x543592){_0x3954bf=_0x3954bf-0x0;var _0xde6fec=_0x0186[_0x3954bf];return _0xde6fec;};'use strict';var _=require('lodash');var util=require(_0x6018('0x0'));var moment=require(_0x6018('0x1'));var BPromise=require('bluebird');var rs=require(_0x6018('0x2'));var fs=require('fs');var Redis=require(_0x6018('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6018('0x4'));var logger=require(_0x6018('0x5'))(_0x6018('0x6'));var config=require(_0x6018('0x7'));var jayson=require(_0x6018('0x8'));var client=jayson[_0x6018('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21187b,_0x5f1534,_0xb35cae){return new BPromise(function(_0x4447c7,_0x20b2f5){return client[_0x6018('0xa')](_0x21187b,_0xb35cae)[_0x6018('0xb')](function(_0x22c6be){logger[_0x6018('0xc')](_0x6018('0xd'),_0x5f1534,_0x6018('0xe'));logger['debug'](_0x6018('0xf'),_0x5f1534,_0x6018('0xe'),JSON[_0x6018('0x10')](_0x22c6be));if(_0x22c6be[_0x6018('0x11')]){if(_0x22c6be[_0x6018('0x11')][_0x6018('0x12')]===0x1f4){logger[_0x6018('0x11')](_0x6018('0xd'),_0x5f1534,_0x22c6be[_0x6018('0x11')][_0x6018('0x13')]);return _0x20b2f5(_0x22c6be['error'][_0x6018('0x13')]);}logger[_0x6018('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x5f1534,_0x22c6be[_0x6018('0x11')][_0x6018('0x13')]);return _0x4447c7(_0x22c6be[_0x6018('0x11')][_0x6018('0x13')]);}else{logger['info'](_0x6018('0xd'),_0x5f1534,_0x6018('0xe'));_0x4447c7(_0x22c6be[_0x6018('0x14')][_0x6018('0x13')]);}})['catch'](function(_0x2d91c7){logger[_0x6018('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x5f1534,_0x2d91c7);_0x20b2f5(_0x2d91c7);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index aa19ee9..08925ec 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x54a479,_0x1b321d){var _0x2474ab=function(_0x428755){while(--_0x428755){_0x54a479['push'](_0x54a479['shift']());}};_0x2474ab(++_0x1b321d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x23deec,_0x207fc0){var _0xe9659e=function(_0x2a3995){while(--_0x2a3995){_0x23deec['push'](_0x23deec['shift']());}};_0xe9659e(++_0x207fc0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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 edc83de..ff2b627 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 _0x555b=['exports','sequelize'];(function(_0x7c1a5d,_0x4bcb22){var _0x1cceb3=function(_0x3b235d){while(--_0x3b235d){_0x7c1a5d['push'](_0x7c1a5d['shift']());}};_0x1cceb3(++_0x4bcb22);}(_0x555b,0x16f));var _0xb555=function(_0x25eec4,_0x381181){_0x25eec4=_0x25eec4-0x0;var _0x189da5=_0x555b[_0x25eec4];return _0x189da5;};'use strict';var Sequelize=require(_0xb555('0x0'));module[_0xb555('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d8a=['INTEGER','sequelize','exports'];(function(_0x2fedb3,_0x15684b){var _0x255ac0=function(_0x4003f3){while(--_0x4003f3){_0x2fedb3['push'](_0x2fedb3['shift']());}};_0x255ac0(++_0x15684b);}(_0x7d8a,0x1e1));var _0xa7d8=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x7d8a[_0x3b231a];return _0x18d67a;};'use strict';var Sequelize=require(_0xa7d8('0x0'));module[_0xa7d8('0x1')]={'penalty':{'type':Sequelize[_0xa7d8('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 5c70fb1..285a2bb 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 _0x0296=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','user_has_mail_queues','lodash','util'];(function(_0xa53e85,_0x41e734){var _0x573073=function(_0x3f0f83){while(--_0x3f0f83){_0xa53e85['push'](_0xa53e85['shift']());}};_0x573073(++_0x41e734);}(_0x0296,0x1b0));var _0x6029=function(_0x130d82,_0x25f49b){_0x130d82=_0x130d82-0x0;var _0x112070=_0x0296[_0x130d82];return _0x112070;};'use strict';var _=require(_0x6029('0x0'));var util=require(_0x6029('0x1'));var logger=require(_0x6029('0x2'))(_0x6029('0x3'));var moment=require(_0x6029('0x4'));var BPromise=require(_0x6029('0x5'));var rp=require(_0x6029('0x6'));var fs=require('fs');var path=require(_0x6029('0x7'));var rimraf=require(_0x6029('0x8'));var config=require(_0x6029('0x9'));var attributes=require(_0x6029('0xa'));module[_0x6029('0xb')]=function(_0x3434f2,_0x476a0a){return _0x3434f2[_0x6029('0xc')]('UserMailQueue',attributes,{'tableName':_0x6029('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9d48=['path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x522e4c,_0x4c9476){var _0x59370c=function(_0xf23c37){while(--_0xf23c37){_0x522e4c['push'](_0x522e4c['shift']());}};_0x59370c(++_0x4c9476);}(_0x9d48,0x1cf));var _0x89d4=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x9d48[_0x134192];return _0x3cd080;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x89d4('0x0'))(_0x89d4('0x1'));var moment=require(_0x89d4('0x2'));var BPromise=require(_0x89d4('0x3'));var rp=require(_0x89d4('0x4'));var fs=require('fs');var path=require(_0x89d4('0x5'));var rimraf=require(_0x89d4('0x6'));var config=require(_0x89d4('0x7'));var attributes=require(_0x89d4('0x8'));module[_0x89d4('0x9')]=function(_0x234544,_0x2241fe){return _0x234544[_0x89d4('0xa')](_0x89d4('0xb'),attributes,{'tableName':_0x89d4('0xc'),'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 9827b6f..5a5bacc 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 _0xa41a=['rpc','../../config/environment','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27095b,_0x33dcd5){var _0x14cffc=function(_0xaa8784){while(--_0xaa8784){_0x27095b['push'](_0x27095b['shift']());}};_0x14cffc(++_0x33dcd5);}(_0xa41a,0x6b));var _0xaa41=function(_0x3ea9ca,_0x15a154){_0x3ea9ca=_0x3ea9ca-0x0;var _0x4d3307=_0xa41a[_0x3ea9ca];return _0x4d3307;};'use strict';var _=require(_0xaa41('0x0'));var util=require(_0xaa41('0x1'));var moment=require('moment');var BPromise=require(_0xaa41('0x2'));var rs=require(_0xaa41('0x3'));var fs=require('fs');var Redis=require(_0xaa41('0x4'));var db=require(_0xaa41('0x5'))['db'];var utils=require(_0xaa41('0x6'));var logger=require(_0xaa41('0x7'))(_0xaa41('0x8'));var config=require(_0xaa41('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa41('0xa')][_0xaa41('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54bc5a,_0x5b1fff,_0x179545){return new BPromise(function(_0x202cce,_0x588ab4){return client[_0xaa41('0xc')](_0x54bc5a,_0x179545)[_0xaa41('0xd')](function(_0x409dab){logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));logger[_0xaa41('0x11')](_0xaa41('0x12'),_0x5b1fff,_0xaa41('0x10'),JSON['stringify'](_0x409dab));if(_0x409dab[_0xaa41('0x13')]){if(_0x409dab[_0xaa41('0x13')]['code']===0x1f4){logger['error'](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x588ab4(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x409dab['error'][_0xaa41('0x14')]);return _0x202cce(_0x409dab[_0xaa41('0x13')][_0xaa41('0x14')]);}else{logger[_0xaa41('0xe')](_0xaa41('0xf'),_0x5b1fff,_0xaa41('0x10'));_0x202cce(_0x409dab[_0xaa41('0x15')]['message']);}})[_0xaa41('0x16')](function(_0x16b930){logger[_0xaa41('0x13')](_0xaa41('0xf'),_0x5b1fff,_0x16b930);_0x588ab4(_0x16b930);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x4d75b8,_0x1cf0e0){var _0x485e55=function(_0x1a4cc5){while(--_0x1a4cc5){_0x4d75b8['push'](_0x4d75b8['shift']());}};_0x485e55(++_0x1cf0e0);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x9c1f48,_0x25da55){_0x9c1f48=_0x9c1f48-0x0;var _0x52ecd4=_0xf3cd[_0x9c1f48];return _0x52ecd4;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 91b735f..3dda8af 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 _0x8f0c=['../../components/interaction/service','../../config/environment','./userNotification.controller','post','util','path','express','Router','fs-extra'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x8f0c,0xee));var _0xc8f0=function(_0x5311e8,_0x57c5bb){_0x5311e8=_0x5311e8-0x0;var _0x582ad8=_0x8f0c[_0x5311e8];return _0x582ad8;};'use strict';var multer=require('multer');var util=require(_0xc8f0('0x0'));var path=require(_0xc8f0('0x1'));var timeout=require('connect-timeout');var express=require(_0xc8f0('0x2'));var router=express[_0xc8f0('0x3')]();var fs_extra=require(_0xc8f0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc8f0('0x5'));var config=require(_0xc8f0('0x6'));var controller=require(_0xc8f0('0x7'));router[_0xc8f0('0x8')]('/',auth['isAuthenticated'](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x11a0=['../../components/interaction/service','../../config/environment','./userNotification.controller','isAuthenticated','sendUserNotification','multer','express','Router','fs-extra'];(function(_0x3b69a3,_0x3f5c3f){var _0x40fa6c=function(_0x265c02){while(--_0x265c02){_0x3b69a3['push'](_0x3b69a3['shift']());}};_0x40fa6c(++_0x3f5c3f);}(_0x11a0,0x152));var _0x011a=function(_0x15ee1e,_0x3d704e){_0x15ee1e=_0x15ee1e-0x0;var _0xc6b423=_0x11a0[_0x15ee1e];return _0xc6b423;};'use strict';var multer=require(_0x011a('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x011a('0x1'));var router=express[_0x011a('0x2')]();var fs_extra=require(_0x011a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x011a('0x4'));var config=require(_0x011a('0x5'));var controller=require(_0x011a('0x6'));router['post']('/',auth[_0x011a('0x7')](),controller[_0x011a('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index b750638..96dbde1 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 _0x56de=['BOOLEAN','exports','TEXT','STRING'];(function(_0x10595e,_0x9bf938){var _0x55873f=function(_0x31b4e7){while(--_0x31b4e7){_0x10595e['push'](_0x10595e['shift']());}};_0x55873f(++_0x9bf938);}(_0x56de,0xf5));var _0xe56d=function(_0x308ae6,_0x2abf31){_0x308ae6=_0x308ae6-0x0;var _0xb5575c=_0x56de[_0x308ae6];return _0xb5575c;};'use strict';var Sequelize=require('sequelize');module[_0xe56d('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0xe56d('0x1')]},'recipientsDescription':{'type':Sequelize[_0xe56d('0x2')]},'beep':{'type':Sequelize[_0xe56d('0x3')]}}; \ No newline at end of file +var _0x9ab7=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9ab7,0xc5));var _0x79ab=function(_0x484174,_0x3bec35){_0x484174=_0x484174-0x0;var _0x31ccb7=_0x9ab7[_0x484174];return _0x31ccb7;};'use strict';var Sequelize=require(_0x79ab('0x0'));module[_0x79ab('0x1')]={'body':{'type':Sequelize[_0x79ab('0x2')]},'senderName':{'type':Sequelize[_0x79ab('0x3')]},'recipientsId':{'type':Sequelize[_0x79ab('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x79ab('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 0112ff3..ee64c6c 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 _0x1b4c=['html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','model','User','ids','queue','replace','Queue','all','union','flatten','map','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','sendUserNotification','hasOwnProperty','text','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','create','forEach','recipient','emit','userNotification:send','findOne'];(function(_0x48255d,_0x3331e7){var _0x16a000=function(_0x5d0c1a){while(--_0x5d0c1a){_0x48255d['push'](_0x48255d['shift']());}};_0x16a000(++_0x3331e7);}(_0x1b4c,0xe4));var _0xc1b4=function(_0x27c7b2,_0x3c8adc){_0x27c7b2=_0x27c7b2-0x0;var _0x33829e=_0x1b4c[_0x27c7b2];return _0x33829e;};'use strict';var emlformat=require(_0xc1b4('0x0'));var rimraf=require(_0xc1b4('0x1'));var zipdir=require(_0xc1b4('0x2'));var jsonpatch=require(_0xc1b4('0x3'));var rp=require(_0xc1b4('0x4'));var moment=require('moment');var BPromise=require(_0xc1b4('0x5'));var Mustache=require(_0xc1b4('0x6'));var util=require(_0xc1b4('0x7'));var path=require(_0xc1b4('0x8'));var sox=require(_0xc1b4('0x9'));var csv=require(_0xc1b4('0xa'));var ejs=require(_0xc1b4('0xb'));var fs=require('fs');var fs_extra=require(_0xc1b4('0xc'));var _=require(_0xc1b4('0xd'));var squel=require(_0xc1b4('0xe'));var crypto=require(_0xc1b4('0xf'));var jsforce=require(_0xc1b4('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xc1b4('0xa'));var querystring=require(_0xc1b4('0x11'));var Papa=require(_0xc1b4('0x12'));var Redis=require('ioredis');var authService=require(_0xc1b4('0x13'));var qs=require(_0xc1b4('0x14'));var as=require(_0xc1b4('0x15'));var hardwareService=require(_0xc1b4('0x16'));var logger=require('../../config/logger')(_0xc1b4('0x17'));var utils=require(_0xc1b4('0x18'));var config=require(_0xc1b4('0x19'));var licenseUtil=require(_0xc1b4('0x1a'));var db=require(_0xc1b4('0x1b'))['db'];config[_0xc1b4('0x1c')]=_[_0xc1b4('0x1d')](config[_0xc1b4('0x1c')],{'host':_0xc1b4('0x1e'),'port':0x18eb});var socket=require(_0xc1b4('0x1f'))(new Redis(config[_0xc1b4('0x1c')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0x5ee3c7,_0x4becaf){_0x4becaf=_0x4becaf||0xcc;return function(_0x10a8b8){if(_0x10a8b8){return _0x5ee3c7[_0xc1b4('0x20')](_0x4becaf);}return _0x5ee3c7['status'](_0x4becaf)[_0xc1b4('0x21')]();};}function respondWithResult(_0x518821,_0x5c6cac){_0x5c6cac=_0x5c6cac||0xc8;return function(_0x146a3c){if(_0x146a3c){return _0x518821[_0xc1b4('0x22')](_0x5c6cac)[_0xc1b4('0x23')](_0x146a3c);}};}function respondWithFilteredResult(_0x1a7775,_0x15dab4){return function(_0xbd8e33){if(_0xbd8e33){var _0x58d035=typeof _0x15dab4[_0xc1b4('0x24')]===_0xc1b4('0x25')&&typeof _0x15dab4[_0xc1b4('0x26')]===_0xc1b4('0x25');var _0x380dd2=_0xbd8e33['count'];var _0x4908d7=_0x58d035?0x0:_0x15dab4[_0xc1b4('0x24')];var _0x5eeb48=_0x58d035?_0xbd8e33[_0xc1b4('0x27')]:_0x15dab4[_0xc1b4('0x24')]+_0x15dab4['limit'];var _0x101e15;if(_0x5eeb48>=_0x380dd2){_0x5eeb48=_0x380dd2;_0x101e15=0xc8;}else{_0x101e15=0xce;}_0x1a7775[_0xc1b4('0x22')](_0x101e15);return _0x1a7775[_0xc1b4('0x28')](_0xc1b4('0x29'),_0x4908d7+'-'+_0x5eeb48+'/'+_0x380dd2)['json'](_0xbd8e33);}return null;};}function patchUpdates(_0x5067a9){return function(_0x2a14f9){try{jsonpatch[_0xc1b4('0x2a')](_0x2a14f9,_0x5067a9,!![]);}catch(_0x573fcc){return BPromise[_0xc1b4('0x2b')](_0x573fcc);}return _0x2a14f9[_0xc1b4('0x2c')]();};}function saveUpdates(_0x12bdbe,_0x29e882){return function(_0x4130e9){if(_0x4130e9){return _0x4130e9['update'](_0x12bdbe)[_0xc1b4('0x2d')](function(_0x37e76f){return _0x37e76f;});}return null;};}function removeEntity(_0x12b490,_0x38dbb6){return function(_0x51f9cd){if(_0x51f9cd){return _0x51f9cd[_0xc1b4('0x2e')]()[_0xc1b4('0x2d')](function(){_0x12b490[_0xc1b4('0x22')](0xcc)[_0xc1b4('0x21')]();});}};}function handleEntityNotFound(_0x273d63,_0x2dda87){return function(_0x126705){if(!_0x126705){_0x273d63[_0xc1b4('0x20')](0x194);}return _0x126705;};}function handleError(_0x2e0e9b,_0x366239){_0x366239=_0x366239||0x1f4;return function(_0x53460d){logger[_0xc1b4('0x2f')](_0x53460d['stack']);if(_0x53460d['name']){delete _0x53460d[_0xc1b4('0x30')];}_0x2e0e9b[_0xc1b4('0x22')](_0x366239)[_0xc1b4('0x31')](_0x53460d);};}exports[_0xc1b4('0x32')]=function(_0x4f6197,_0x43a441,_0xc642eb){if(!_0x4f6197['body'][_0xc1b4('0x33')](_0xc1b4('0x34'))&&!_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x36'))){throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x39'));}else{if(_0x4f6197[_0xc1b4('0x35')]['hasOwnProperty'](_0xc1b4('0x36'))&&!_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x3a'))){throw new db[(_0xc1b4('0x37'))]['ValidationError']('Missing\x20\x27view\x27\x20parameter');}if(!_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x3b'))){throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x3c'));}else{try{var _0x52e937=JSON[_0xc1b4('0x3d')](_0x4f6197['body'][_0xc1b4('0x3b')]);}catch(_0x50c630){logger['error'](_0x50c630);throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x3e'));}var _0xdb25d5=[_0xc1b4('0x3f'),_0xc1b4('0x40'),_0xc1b4('0x41'),_0xc1b4('0x42'),_0xc1b4('0x43'),_0xc1b4('0x44'),_0xc1b4('0x45'),_0xc1b4('0x46'),_0xc1b4('0x47')];if(_[_0xc1b4('0x48')](_0x52e937,function(_0x55b4cf){return!_[_0xc1b4('0x49')](_0xdb25d5,_0x55b4cf['model'][_0xc1b4('0x4a')]());})){throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x4b'));}}}var _0xe4031c={};_0xe4031c[_0xc1b4('0x4c')]=_0x4f6197[_0xc1b4('0x35')][_0xc1b4('0x33')](_0xc1b4('0x4c'))?_0x4f6197['body'][_0xc1b4('0x4c')]:_0x4f6197[_0xc1b4('0x47')][_0xc1b4('0x4d')];_0xe4031c[_0xc1b4('0x4e')]=_[_0xc1b4('0x4f')](_0x4f6197['body'][_0xc1b4('0x4e')])?null:_0x4f6197['body'][_0xc1b4('0x4e')];_0xe4031c[_0xc1b4('0x50')]=_0x4f6197[_0xc1b4('0x35')]['beep']||![];_0xe4031c[_0xc1b4('0x51')]=_0x4f6197[_0xc1b4('0x47')]['id'];return getContent(_0x4f6197[_0xc1b4('0x35')])[_0xc1b4('0x2d')](function(_0x3c89a2){_0xe4031c[_0xc1b4('0x35')]=_0x3c89a2;return getRecipients(_0x52e937);})['then'](function(_0x465744){_0xe4031c[_0xc1b4('0x52')]=_[_0xc1b4('0x53')](_0x465744)[_0xc1b4('0x54')](',');return db[_0xc1b4('0x55')][_0xc1b4('0x56')](function(_0x366602){return db['UserNotification'][_0xc1b4('0x57')](_0xe4031c,{'raw':!![],'transaction':_0x366602})['then'](function(_0x261fd9){var _0x4b35f2={'sender':_0xe4031c[_0xc1b4('0x4c')],'description':_0xe4031c['recipientsDescription'],'content':_0xe4031c[_0xc1b4('0x35')],'beep':_0xe4031c[_0xc1b4('0x50')]};_0x465744[_0xc1b4('0x58')](function(_0x310071){_0x4b35f2[_0xc1b4('0x59')]=_0x310071;socket[_0xc1b4('0x5a')](_0xc1b4('0x5b'),_0x4b35f2);});return _0x261fd9;});});})['then'](respondWithResult(_0x43a441,0xc9))['catch'](handleError(_0x43a441,null));};function getContent(_0x21e63d){return new BPromise(function(_0x176eff,_0x52b8f9){if(_0x21e63d[_0xc1b4('0x34')]){_0x176eff(_0x21e63d[_0xc1b4('0x34')]);return;}return db['Template'][_0xc1b4('0x5c')]({'attributes':[_0xc1b4('0x5d')],'where':{'id':_0x21e63d[_0xc1b4('0x36')]},'raw':!![]})[_0xc1b4('0x2d')](function(_0x33281f){if(!_0x33281f)throw new db[(_0xc1b4('0x37'))][(_0xc1b4('0x38'))](_0xc1b4('0x5e'));var _0x406b36=Mustache[_0xc1b4('0x5f')](_0x33281f[_0xc1b4('0x5d')],_0x21e63d[_0xc1b4('0x3a')]);_0x176eff(_0x406b36);})[_0xc1b4('0x60')](function(_0x6d1d9d){_0x52b8f9(_0x6d1d9d);});});}function getRecipients(_0x56013b){return new BPromise(function(_0x337e6a,_0x429597){var _0x557b15=[];var _0x31a8ef=[];_0x56013b[_0xc1b4('0x58')](function(_0x28c4d6){var _0x1cbc16=_['startCase'](_0x28c4d6[_0xc1b4('0x61')][_0xc1b4('0x4a')]());if(_0x1cbc16===_0xc1b4('0x62')){_0x557b15=_['union'](_0x557b15,_0x28c4d6[_0xc1b4('0x63')]);}else{if(_[_0xc1b4('0x49')](_0x1cbc16,_0xc1b4('0x64')))_0x1cbc16=_0x1cbc16[_0xc1b4('0x65')](_0xc1b4('0x64'),_0xc1b4('0x66'));_0x28c4d6['ids'][_0xc1b4('0x58')](function(_0xd9c269){_0x31a8ef['push'](getAgents(_0x1cbc16,_0xd9c269));});}});return BPromise[_0xc1b4('0x67')](_0x31a8ef)[_0xc1b4('0x2d')](function(_0x21d571){_0x557b15=_[_0xc1b4('0x68')](_0x557b15,_[_0xc1b4('0x69')](_0x21d571));_0x337e6a(_0x557b15);})[_0xc1b4('0x60')](function(_0x2fb8c4){_0x429597(_0x2fb8c4);});});}function getAgents(_0x2e76aa,_0x3f84d0){return new BPromise(function(_0x1f95d9,_0x48597e){return db[_0x2e76aa][_0xc1b4('0x5c')]({'where':{'id':_0x3f84d0}})[_0xc1b4('0x2d')](function(_0x5e7dfc){return _0x5e7dfc['getAgents']({'attributes':['id'],'raw':!![]})[_0xc1b4('0x2d')](function(_0x3422bd){var _0x292480=_[_0xc1b4('0x6a')](_0x3422bd,'id');_0x1f95d9(_0x292480);});})[_0xc1b4('0x60')](function(_0x4d84f0){_0x48597e(_0x4d84f0);});});} \ No newline at end of file +var _0x4703=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','sendUserNotification','body','text','hasOwnProperty','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Sequelize','Missing\x20\x27view\x27\x20parameter','Missing\x20\x27recipients\x27\x20parameter','parse','recipients','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','user','some','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','recipient','userNotification:send','catch','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','startCase','User','union','ids','queue','replace','Queue','forEach','all','flatten','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x254fd1,_0x17eae1){var _0x2d33f1=function(_0x42dffd){while(--_0x42dffd){_0x254fd1['push'](_0x254fd1['shift']());}};_0x2d33f1(++_0x17eae1);}(_0x4703,0x12b));var _0x3470=function(_0x337f9d,_0x361328){_0x337f9d=_0x337f9d-0x0;var _0x25c23a=_0x4703[_0x337f9d];return _0x25c23a;};'use strict';var emlformat=require(_0x3470('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3470('0x1'));var jsonpatch=require(_0x3470('0x2'));var rp=require(_0x3470('0x3'));var moment=require(_0x3470('0x4'));var BPromise=require(_0x3470('0x5'));var Mustache=require('mustache');var util=require(_0x3470('0x6'));var path=require(_0x3470('0x7'));var sox=require(_0x3470('0x8'));var csv=require(_0x3470('0x9'));var ejs=require(_0x3470('0xa'));var fs=require('fs');var fs_extra=require(_0x3470('0xb'));var _=require(_0x3470('0xc'));var squel=require('squel');var crypto=require(_0x3470('0xd'));var jsforce=require(_0x3470('0xe'));var deskjs=require(_0x3470('0xf'));var toCsv=require(_0x3470('0x9'));var querystring=require(_0x3470('0x10'));var Papa=require(_0x3470('0x11'));var Redis=require(_0x3470('0x12'));var authService=require(_0x3470('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3470('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3470('0x15'))(_0x3470('0x16'));var utils=require(_0x3470('0x17'));var config=require(_0x3470('0x18'));var licenseUtil=require(_0x3470('0x19'));var db=require(_0x3470('0x1a'))['db'];config[_0x3470('0x1b')]=_[_0x3470('0x1c')](config[_0x3470('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3470('0x1d'))[_0x3470('0x1e')](socket);function respondWithStatusCode(_0x2d3d95,_0x8e663a){_0x8e663a=_0x8e663a||0xcc;return function(_0x227f16){if(_0x227f16){return _0x2d3d95[_0x3470('0x1f')](_0x8e663a);}return _0x2d3d95[_0x3470('0x20')](_0x8e663a)[_0x3470('0x21')]();};}function respondWithResult(_0x38f221,_0x30e181){_0x30e181=_0x30e181||0xc8;return function(_0x135c89){if(_0x135c89){return _0x38f221[_0x3470('0x20')](_0x30e181)[_0x3470('0x22')](_0x135c89);}};}function respondWithFilteredResult(_0x8d7af7,_0x1f328a){return function(_0x17650e){if(_0x17650e){var _0x5e18fd=typeof _0x1f328a['offset']===_0x3470('0x23')&&typeof _0x1f328a['limit']===_0x3470('0x23');var _0x48f699=_0x17650e[_0x3470('0x24')];var _0x238e2d=_0x5e18fd?0x0:_0x1f328a[_0x3470('0x25')];var _0x5773af=_0x5e18fd?_0x17650e[_0x3470('0x24')]:_0x1f328a['offset']+_0x1f328a[_0x3470('0x26')];var _0x5477ea;if(_0x5773af>=_0x48f699){_0x5773af=_0x48f699;_0x5477ea=0xc8;}else{_0x5477ea=0xce;}_0x8d7af7[_0x3470('0x20')](_0x5477ea);return _0x8d7af7[_0x3470('0x27')]('Content-Range',_0x238e2d+'-'+_0x5773af+'/'+_0x48f699)['json'](_0x17650e);}return null;};}function patchUpdates(_0x1cf1df){return function(_0xf0e715){try{jsonpatch[_0x3470('0x28')](_0xf0e715,_0x1cf1df,!![]);}catch(_0x3e3209){return BPromise[_0x3470('0x29')](_0x3e3209);}return _0xf0e715[_0x3470('0x2a')]();};}function saveUpdates(_0x1cabe8,_0x28fd26){return function(_0x47b364){if(_0x47b364){return _0x47b364[_0x3470('0x2b')](_0x1cabe8)[_0x3470('0x2c')](function(_0x185980){return _0x185980;});}return null;};}function removeEntity(_0x401db4,_0x182cb1){return function(_0x12f141){if(_0x12f141){return _0x12f141['destroy']()['then'](function(){_0x401db4[_0x3470('0x20')](0xcc)[_0x3470('0x21')]();});}};}function handleEntityNotFound(_0x5102cd,_0x1f63a3){return function(_0xc03150){if(!_0xc03150){_0x5102cd['sendStatus'](0x194);}return _0xc03150;};}function handleError(_0x4959d3,_0x50a72a){_0x50a72a=_0x50a72a||0x1f4;return function(_0x4eef3d){logger[_0x3470('0x2d')](_0x4eef3d[_0x3470('0x2e')]);if(_0x4eef3d['name']){delete _0x4eef3d[_0x3470('0x2f')];}_0x4959d3[_0x3470('0x20')](_0x50a72a)[_0x3470('0x30')](_0x4eef3d);};}exports[_0x3470('0x31')]=function(_0x30fcbb,_0x1d7678,_0x4eafcb){if(!_0x30fcbb[_0x3470('0x32')]['hasOwnProperty'](_0x3470('0x33'))&&!_0x30fcbb['body'][_0x3470('0x34')](_0x3470('0x35'))){throw new db['Sequelize'][(_0x3470('0x36'))](_0x3470('0x37'));}else{if(_0x30fcbb[_0x3470('0x32')]['hasOwnProperty'](_0x3470('0x35'))&&!_0x30fcbb['body'][_0x3470('0x34')](_0x3470('0x38'))){throw new db[(_0x3470('0x39'))][(_0x3470('0x36'))](_0x3470('0x3a'));}if(!_0x30fcbb['body'][_0x3470('0x34')]('recipients')){throw new db[(_0x3470('0x39'))][(_0x3470('0x36'))](_0x3470('0x3b'));}else{try{var _0x3a829e=JSON[_0x3470('0x3c')](_0x30fcbb[_0x3470('0x32')][_0x3470('0x3d')]);}catch(_0x244ac3){logger[_0x3470('0x2d')](_0x244ac3);throw new db[(_0x3470('0x39'))][(_0x3470('0x36'))](_0x3470('0x3e'));}var _0x59ed68=[_0x3470('0x3f'),_0x3470('0x40'),_0x3470('0x41'),'openchannelqueue',_0x3470('0x42'),_0x3470('0x43'),'whatsappqueue','team',_0x3470('0x44')];if(_[_0x3470('0x45')](_0x3a829e,function(_0x10ffc1){return!_[_0x3470('0x46')](_0x59ed68,_0x10ffc1[_0x3470('0x47')][_0x3470('0x48')]());})){throw new db[(_0x3470('0x39'))][(_0x3470('0x36'))](_0x3470('0x49'));}}}var _0x26cf9d={};_0x26cf9d[_0x3470('0x4a')]=_0x30fcbb['body'][_0x3470('0x34')](_0x3470('0x4a'))?_0x30fcbb['body'][_0x3470('0x4a')]:_0x30fcbb[_0x3470('0x44')][_0x3470('0x4b')];_0x26cf9d[_0x3470('0x4c')]=_[_0x3470('0x4d')](_0x30fcbb['body'][_0x3470('0x4c')])?null:_0x30fcbb[_0x3470('0x32')][_0x3470('0x4c')];_0x26cf9d[_0x3470('0x4e')]=_0x30fcbb['body']['beep']||![];_0x26cf9d[_0x3470('0x4f')]=_0x30fcbb[_0x3470('0x44')]['id'];return getContent(_0x30fcbb[_0x3470('0x32')])['then'](function(_0x186580){_0x26cf9d[_0x3470('0x32')]=_0x186580;return getRecipients(_0x3a829e);})[_0x3470('0x2c')](function(_0x438dab){_0x26cf9d[_0x3470('0x50')]=_[_0x3470('0x51')](_0x438dab)[_0x3470('0x52')](',');return db[_0x3470('0x53')][_0x3470('0x54')](function(_0x11550c){return db[_0x3470('0x55')][_0x3470('0x56')](_0x26cf9d,{'raw':!![],'transaction':_0x11550c})[_0x3470('0x2c')](function(_0x3373c0){var _0x39b065={'sender':_0x26cf9d[_0x3470('0x4a')],'description':_0x26cf9d[_0x3470('0x4c')],'content':_0x26cf9d['body'],'beep':_0x26cf9d['beep']};_0x438dab['forEach'](function(_0x545fa3){_0x39b065[_0x3470('0x57')]=_0x545fa3;socket['emit'](_0x3470('0x58'),_0x39b065);});return _0x3373c0;});});})[_0x3470('0x2c')](respondWithResult(_0x1d7678,0xc9))[_0x3470('0x59')](handleError(_0x1d7678,null));};function getContent(_0x17a2c5){return new BPromise(function(_0x147476,_0x28b752){if(_0x17a2c5['text']){_0x147476(_0x17a2c5['text']);return;}return db[_0x3470('0x5a')][_0x3470('0x5b')]({'attributes':[_0x3470('0x5c')],'where':{'id':_0x17a2c5[_0x3470('0x35')]},'raw':!![]})[_0x3470('0x2c')](function(_0x4e0829){if(!_0x4e0829)throw new db[(_0x3470('0x39'))][(_0x3470('0x36'))](_0x3470('0x5d'));var _0x4da5cd=Mustache[_0x3470('0x5e')](_0x4e0829['html'],_0x17a2c5[_0x3470('0x38')]);_0x147476(_0x4da5cd);})['catch'](function(_0x32c034){_0x28b752(_0x32c034);});});}function getRecipients(_0x112564){return new BPromise(function(_0x16498f,_0xbc8060){var _0x163f94=[];var _0x4acafa=[];_0x112564['forEach'](function(_0x50daa5){var _0xbee3d=_[_0x3470('0x5f')](_0x50daa5['model'][_0x3470('0x48')]());if(_0xbee3d===_0x3470('0x60')){_0x163f94=_[_0x3470('0x61')](_0x163f94,_0x50daa5[_0x3470('0x62')]);}else{if(_[_0x3470('0x46')](_0xbee3d,_0x3470('0x63')))_0xbee3d=_0xbee3d[_0x3470('0x64')](_0x3470('0x63'),_0x3470('0x65'));_0x50daa5[_0x3470('0x62')][_0x3470('0x66')](function(_0x4d45d7){_0x4acafa['push'](getAgents(_0xbee3d,_0x4d45d7));});}});return BPromise[_0x3470('0x67')](_0x4acafa)[_0x3470('0x2c')](function(_0x4212af){_0x163f94=_[_0x3470('0x61')](_0x163f94,_[_0x3470('0x68')](_0x4212af));_0x16498f(_0x163f94);})['catch'](function(_0x5d86f1){_0xbc8060(_0x5d86f1);});});}function getAgents(_0x410487,_0x1f0c64){return new BPromise(function(_0x3f8305,_0x4dcd1a){return db[_0x410487][_0x3470('0x5b')]({'where':{'id':_0x1f0c64}})[_0x3470('0x2c')](function(_0x47fe2a){return _0x47fe2a[_0x3470('0x69')]({'attributes':['id'],'raw':!![]})[_0x3470('0x2c')](function(_0x2ff2f5){var _0x5869ec=_['map'](_0x2ff2f5,'id');_0x3f8305(_0x5869ec);});})[_0x3470('0x59')](function(_0x20ce72){_0x4dcd1a(_0x20ce72);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index c70f8c0..2740f32 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 _0xea6a=['remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserNotification','setMaxListeners'];(function(_0x578081,_0x48fdf2){var _0xba77b8=function(_0x133518){while(--_0x133518){_0x578081['push'](_0x578081['shift']());}};_0xba77b8(++_0x48fdf2);}(_0xea6a,0x135));var _0xaea6=function(_0x5ec45c,_0x4f8362){_0x5ec45c=_0x5ec45c-0x0;var _0x4934e1=_0xea6a[_0x5ec45c];return _0x4934e1;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0xaea6('0x0'))['db'][_0xaea6('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xaea6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xaea6('0x3')};function emitEvent(_0x2ed35c){return function(_0x2a82ac,_0x3fa92f,_0x2c3667){UserNotificationEvents[_0xaea6('0x4')](_0x2ed35c+':'+_0x2a82ac['id'],_0x2a82ac);UserNotificationEvents['emit'](_0x2ed35c,_0x2a82ac);_0x2c3667(null);};}for(var e in events){if(events[_0xaea6('0x5')](e)){var event=events[e];UserNotification[_0xaea6('0x6')](e,emitEvent(event));}}module[_0xaea6('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x3463=['hook','UserNotification','save','remove','emit','hasOwnProperty'];(function(_0x24bdb2,_0x164e52){var _0x26a8f3=function(_0xe389e4){while(--_0xe389e4){_0x24bdb2['push'](_0x24bdb2['shift']());}};_0x26a8f3(++_0x164e52);}(_0x3463,0x17b));var _0x3346=function(_0x282ac4,_0x556ae3){_0x282ac4=_0x282ac4-0x0;var _0x188ced=_0x3463[_0x282ac4];return _0x188ced;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db'][_0x3346('0x0')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3346('0x1'),'afterUpdate':'update','afterDestroy':_0x3346('0x2')};function emitEvent(_0x447499){return function(_0x7f30e8,_0x385ffa,_0x597ec3){UserNotificationEvents[_0x3346('0x3')](_0x447499+':'+_0x7f30e8['id'],_0x7f30e8);UserNotificationEvents[_0x3346('0x3')](_0x447499,_0x7f30e8);_0x597ec3(null);};}for(var e in events){if(events[_0x3346('0x4')](e)){var event=events[e];UserNotification[_0x3346('0x5')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9bbfb39..f178725 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 _0x1551=['userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment','UserNotification'];(function(_0x20c551,_0x5a28d0){var _0x24df8f=function(_0x3dae99){while(--_0x3dae99){_0x20c551['push'](_0x20c551['shift']());}};_0x24df8f(++_0x5a28d0);}(_0x1551,0x16e));var _0x1155=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x1551[_0x43f881];return _0x365c14;};'use strict';var _=require(_0x1155('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1155('0x1'));var moment=require(_0x1155('0x2'));var BPromise=require(_0x1155('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1155('0x4'));var rimraf=require(_0x1155('0x5'));var config=require(_0x1155('0x6'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x21a611,_0x471cc9){return _0x21a611['define'](_0x1155('0x7'),attributes,{'tableName':_0x1155('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1155('0x9'),'collate':_0x1155('0xa')});}; \ No newline at end of file +var _0x0818=['./userNotification.attributes','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0818,0x1da));var _0x8081=function(_0x5a474c,_0x3d8725){_0x5a474c=_0x5a474c-0x0;var _0x5b8361=_0x0818[_0x5a474c];return _0x5b8361;};'use strict';var _=require(_0x8081('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8081('0x1'));var moment=require(_0x8081('0x2'));var BPromise=require(_0x8081('0x3'));var rp=require(_0x8081('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8081('0x5'));var config=require('../../config/environment');var attributes=require(_0x8081('0x6'));module['exports']=function(_0x23a0dd,_0x29931d){return _0x23a0dd[_0x8081('0x7')](_0x8081('0x8'),attributes,{'tableName':_0x8081('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8081('0xa'),'collate':_0x8081('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 5cd062f..7833dec 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 _0xc78c=['catch','lodash','util','moment','ioredis','../../mysqldb','rpc','jayson/promise','client','http','redis','defaults','localhost','request','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0x34bd5b,_0x40d40f){var _0x25890f=function(_0x3888ce){while(--_0x3888ce){_0x34bd5b['push'](_0x34bd5b['shift']());}};_0x25890f(++_0x40d40f);}(_0xc78c,0x161));var _0xcc78=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xc78c[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xcc78('0x0'));var util=require(_0xcc78('0x1'));var moment=require(_0xcc78('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc78('0x3'));var db=require(_0xcc78('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcc78('0x5'));var config=require('../../config/environment');var jayson=require(_0xcc78('0x6'));var client=jayson[_0xcc78('0x7')][_0xcc78('0x8')]({'port':0x232a});config[_0xcc78('0x9')]=_[_0xcc78('0xa')](config['redis'],{'host':_0xcc78('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcc78('0x9')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x4030ab,_0x5a2137,_0x16fd47){return new BPromise(function(_0x161fc9,_0x22ee1e){return client[_0xcc78('0xc')](_0x4030ab,_0x16fd47)['then'](function(_0x4ea44e){logger[_0xcc78('0xd')](_0xcc78('0xe'),_0x5a2137,_0xcc78('0xf'));logger[_0xcc78('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x5a2137,_0xcc78('0xf'),JSON['stringify'](_0x4ea44e));if(_0x4ea44e[_0xcc78('0x11')]){if(_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x12')]===0x1f4){logger[_0xcc78('0x11')](_0xcc78('0xe'),_0x5a2137,_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);return _0x22ee1e(_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);}logger['error'](_0xcc78('0xe'),_0x5a2137,_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);return _0x161fc9(_0x4ea44e[_0xcc78('0x11')][_0xcc78('0x13')]);}else{logger[_0xcc78('0xd')](_0xcc78('0xe'),_0x5a2137,'request\x20sent');_0x161fc9(_0x4ea44e[_0xcc78('0x14')][_0xcc78('0x13')]);}})[_0xcc78('0x15')](function(_0x3fe87b){logger[_0xcc78('0x11')](_0xcc78('0xe'),_0x5a2137,_0x3fe87b);_0x22ee1e(_0x3fe87b);});});} \ No newline at end of file +var _0x907a=['request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','then','info','UserNotification,\x20%s,\x20%s'];(function(_0x3d71ba,_0x49a38b){var _0x5e0ed0=function(_0x4d0bfb){while(--_0x4d0bfb){_0x3d71ba['push'](_0x3d71ba['shift']());}};_0x5e0ed0(++_0x49a38b);}(_0x907a,0x9f));var _0xa907=function(_0x5afba1,_0x2afea8){_0x5afba1=_0x5afba1-0x0;var _0xe5d8b=_0x907a[_0x5afba1];return _0xe5d8b;};'use strict';var _=require('lodash');var util=require(_0xa907('0x0'));var moment=require(_0xa907('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa907('0x2'));var db=require(_0xa907('0x3'))['db'];var utils=require(_0xa907('0x4'));var logger=require('../../config/logger')(_0xa907('0x5'));var config=require(_0xa907('0x6'));var jayson=require(_0xa907('0x7'));var client=jayson[_0xa907('0x8')][_0xa907('0x9')]({'port':0x232a});config['redis']=_[_0xa907('0xa')](config[_0xa907('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa907('0xc'))(new Redis(config[_0xa907('0xb')]));require('./userNotification.socket')['register'](socket);function respondWithRpcPromise(_0x51c98f,_0x428755,_0x175b36){return new BPromise(function(_0x244079,_0x3c22d3){return client['request'](_0x51c98f,_0x175b36)[_0xa907('0xd')](function(_0x2eb281){logger[_0xa907('0xe')](_0xa907('0xf'),_0x428755,_0xa907('0x10'));logger[_0xa907('0x11')](_0xa907('0x12'),_0x428755,'request\x20sent',JSON[_0xa907('0x13')](_0x2eb281));if(_0x2eb281[_0xa907('0x14')]){if(_0x2eb281[_0xa907('0x14')][_0xa907('0x15')]===0x1f4){logger[_0xa907('0x14')](_0xa907('0xf'),_0x428755,_0x2eb281[_0xa907('0x14')][_0xa907('0x16')]);return _0x3c22d3(_0x2eb281['error']['message']);}logger[_0xa907('0x14')](_0xa907('0xf'),_0x428755,_0x2eb281[_0xa907('0x14')][_0xa907('0x16')]);return _0x244079(_0x2eb281[_0xa907('0x14')]['message']);}else{logger[_0xa907('0xe')](_0xa907('0xf'),_0x428755,_0xa907('0x10'));_0x244079(_0x2eb281[_0xa907('0x17')][_0xa907('0x16')]);}})[_0xa907('0x18')](function(_0x19338b){logger[_0xa907('0x14')](_0xa907('0xf'),_0x428755,_0x19338b);_0x3c22d3(_0x19338b);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index bf5a427..e598445 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 _0x5649=['./userNotification.events','update','emit','removeListener','register','length'];(function(_0x2eee25,_0x53460d){var _0x1cb8c4=function(_0x4dad56){while(--_0x4dad56){_0x2eee25['push'](_0x2eee25['shift']());}};_0x1cb8c4(++_0x53460d);}(_0x5649,0x162));var _0x9564=function(_0x149478,_0x380771){_0x149478=_0x149478-0x0;var _0x2bcd4d=_0x5649[_0x149478];return _0x2bcd4d;};'use strict';var UserNotificationEvents=require(_0x9564('0x0'));var events=['save','remove',_0x9564('0x1')];function createListener(_0x219497,_0x454541){return function(_0x409684){_0x454541[_0x9564('0x2')](_0x219497,_0x409684);};}function removeListener(_0x51c3f1,_0xe879e2){return function(){UserNotificationEvents[_0x9564('0x3')](_0x51c3f1,_0xe879e2);};}exports[_0x9564('0x4')]=function(_0x1a22ec){for(var _0x4e7490=0x0,_0x7885ea=events[_0x9564('0x5')];_0x4e7490<_0x7885ea;_0x4e7490++){var _0x828391=events[_0x4e7490];var _0x2bc420=createListener('userNotification:'+_0x828391,_0x1a22ec);UserNotificationEvents['on'](_0x828391,_0x2bc420);}}; \ No newline at end of file +var _0x19c6=['remove','removeListener','register','length','userNotification:','./userNotification.events','save'];(function(_0x1722bf,_0x2fa7f4){var _0x58c607=function(_0x4b13f5){while(--_0x4b13f5){_0x1722bf['push'](_0x1722bf['shift']());}};_0x58c607(++_0x2fa7f4);}(_0x19c6,0x98));var _0x619c=function(_0x32f755,_0x5af6fb){_0x32f755=_0x32f755-0x0;var _0x30a0de=_0x19c6[_0x32f755];return _0x30a0de;};'use strict';var UserNotificationEvents=require(_0x619c('0x0'));var events=[_0x619c('0x1'),_0x619c('0x2'),'update'];function createListener(_0x1f8a5d,_0x1a4cd9){return function(_0x488152){_0x1a4cd9['emit'](_0x1f8a5d,_0x488152);};}function removeListener(_0x15ab88,_0x159b08){return function(){UserNotificationEvents[_0x619c('0x3')](_0x15ab88,_0x159b08);};}exports[_0x619c('0x4')]=function(_0x41335d){for(var _0x53402f=0x0,_0xefd80b=events[_0x619c('0x5')];_0x53402f<_0xefd80b;_0x53402f++){var _0x2537a5=events[_0x53402f];var _0x1dd82a=createListener(_0x619c('0x6')+_0x2537a5,_0x41335d);UserNotificationEvents['on'](_0x2537a5,_0x1dd82a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 89b747a..5d111ff 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(_0x4651ae,_0x3d2bc0){var _0x29a97c=function(_0xf05c25){while(--_0xf05c25){_0x4651ae['push'](_0x4651ae['shift']());}};_0x29a97c(++_0x3d2bc0);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0xb61433,_0x31d758){var _0x123400=function(_0x14b3db){while(--_0x14b3db){_0xb61433['push'](_0xb61433['shift']());}};_0x123400(++_0x31d758);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 56e32ea..9d1cb0c 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 _0x3e67=['INTEGER','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e67,0x88));var _0x73e6=function(_0x5c2a2b,_0x22c94e){_0x5c2a2b=_0x5c2a2b-0x0;var _0x19921f=_0x3e67[_0x5c2a2b];return _0x19921f;};'use strict';var Sequelize=require(_0x73e6('0x0'));module[_0x73e6('0x1')]={'penalty':{'type':Sequelize[_0x73e6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xceae=['sequelize','exports'];(function(_0x5cbf0e,_0x4cd140){var _0x1c76f8=function(_0xcc9be4){while(--_0xcc9be4){_0x5cbf0e['push'](_0x5cbf0e['shift']());}};_0x1c76f8(++_0x4cd140);}(_0xceae,0x122));var _0xecea=function(_0x3504a0,_0x3f770f){_0x3504a0=_0x3504a0-0x0;var _0x3dfca3=_0xceae[_0x3504a0];return _0x3dfca3;};'use strict';var Sequelize=require(_0xecea('0x0'));module[_0xecea('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 30d383f..6807f71 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 _0x132d=['user_has_openchannel_queues','lodash','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x132d,0x140));var _0xd132=function(_0x445179,_0x389247){_0x445179=_0x445179-0x0;var _0x36626f=_0x132d[_0x445179];return _0x36626f;};'use strict';var _=require(_0xd132('0x0'));var util=require('util');var logger=require(_0xd132('0x1'))('api');var moment=require('moment');var BPromise=require(_0xd132('0x2'));var rp=require(_0xd132('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd132('0x4'));var config=require(_0xd132('0x5'));var attributes=require(_0xd132('0x6'));module[_0xd132('0x7')]=function(_0x5a9cc7,_0x39f821){return _0x5a9cc7[_0xd132('0x8')](_0xd132('0x9'),attributes,{'tableName':_0xd132('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b01=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x14dd10,_0x4900d6){var _0x5cb641=function(_0x499124){while(--_0x499124){_0x14dd10['push'](_0x14dd10['shift']());}};_0x5cb641(++_0x4900d6);}(_0x7b01,0x1bf));var _0x17b0=function(_0x253519,_0x4ca17f){_0x253519=_0x253519-0x0;var _0x2f55e0=_0x7b01[_0x253519];return _0x2f55e0;};'use strict';var _=require(_0x17b0('0x0'));var util=require(_0x17b0('0x1'));var logger=require(_0x17b0('0x2'))('api');var moment=require(_0x17b0('0x3'));var BPromise=require(_0x17b0('0x4'));var rp=require(_0x17b0('0x5'));var fs=require('fs');var path=require(_0x17b0('0x6'));var rimraf=require(_0x17b0('0x7'));var config=require(_0x17b0('0x8'));var attributes=require(_0x17b0('0x9'));module[_0x17b0('0xa')]=function(_0x40dc1e,_0x2dbabd){return _0x40dc1e[_0x17b0('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0x17b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 12cde8a..aa4c1ed 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 _0xb88a=['../../config/utils','../../config/logger','jayson/promise','client','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1e89fd,_0x24ef0d){var _0x530c87=function(_0x2b35b5){while(--_0x2b35b5){_0x1e89fd['push'](_0x1e89fd['shift']());}};_0x530c87(++_0x24ef0d);}(_0xb88a,0x145));var _0xab88=function(_0x1054a8,_0xfbf0fc){_0x1054a8=_0x1054a8-0x0;var _0x68c389=_0xb88a[_0x1054a8];return _0x68c389;};'use strict';var _=require('lodash');var util=require(_0xab88('0x0'));var moment=require('moment');var BPromise=require(_0xab88('0x1'));var rs=require(_0xab88('0x2'));var fs=require('fs');var Redis=require(_0xab88('0x3'));var db=require(_0xab88('0x4'))['db'];var utils=require(_0xab88('0x5'));var logger=require(_0xab88('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab88('0x7'));var client=jayson[_0xab88('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x323e57,_0x1ce9a8,_0x253eab){return new BPromise(function(_0x1cc750,_0x403044){return client[_0xab88('0x9')](_0x323e57,_0x253eab)[_0xab88('0xa')](function(_0x2f5439){logger['info'](_0xab88('0xb'),_0x1ce9a8,_0xab88('0xc'));logger[_0xab88('0xd')](_0xab88('0xe'),_0x1ce9a8,'request\x20sent',JSON[_0xab88('0xf')](_0x2f5439));if(_0x2f5439[_0xab88('0x10')]){if(_0x2f5439[_0xab88('0x10')][_0xab88('0x11')]===0x1f4){logger[_0xab88('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1ce9a8,_0x2f5439['error']['message']);return _0x403044(_0x2f5439[_0xab88('0x10')]['message']);}logger[_0xab88('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x1ce9a8,_0x2f5439[_0xab88('0x10')][_0xab88('0x12')]);return _0x1cc750(_0x2f5439['error']['message']);}else{logger[_0xab88('0x13')](_0xab88('0xb'),_0x1ce9a8,_0xab88('0xc'));_0x1cc750(_0x2f5439[_0xab88('0x14')][_0xab88('0x12')]);}})[_0xab88('0x15')](function(_0x4fe489){logger['error'](_0xab88('0xb'),_0x1ce9a8,_0x4fe489);_0x403044(_0x4fe489);});});} \ No newline at end of file +var _0x788d=['info','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x15ef61,_0xdf0ae2){var _0x41007c=function(_0x1825a4){while(--_0x1825a4){_0x15ef61['push'](_0x15ef61['shift']());}};_0x41007c(++_0xdf0ae2);}(_0x788d,0x83));var _0xd788=function(_0x4199b1,_0x1736c0){_0x4199b1=_0x4199b1-0x0;var _0x354f22=_0x788d[_0x4199b1];return _0x354f22;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd788('0x0'));var BPromise=require('bluebird');var rs=require(_0xd788('0x1'));var fs=require('fs');var Redis=require(_0xd788('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd788('0x3'));var config=require(_0xd788('0x4'));var jayson=require(_0xd788('0x5'));var client=jayson[_0xd788('0x6')][_0xd788('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3706fd,_0x5c71a1,_0x2de960){return new BPromise(function(_0x494f5e,_0x12bd82){return client['request'](_0x3706fd,_0x2de960)[_0xd788('0x8')](function(_0x2a20d1){logger[_0xd788('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5c71a1,_0xd788('0xa'));logger[_0xd788('0xb')](_0xd788('0xc'),_0x5c71a1,'request\x20sent',JSON[_0xd788('0xd')](_0x2a20d1));if(_0x2a20d1[_0xd788('0xe')]){if(_0x2a20d1[_0xd788('0xe')][_0xd788('0xf')]===0x1f4){logger[_0xd788('0xe')](_0xd788('0x10'),_0x5c71a1,_0x2a20d1[_0xd788('0xe')]['message']);return _0x12bd82(_0x2a20d1[_0xd788('0xe')][_0xd788('0x11')]);}logger[_0xd788('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5c71a1,_0x2a20d1['error']['message']);return _0x494f5e(_0x2a20d1[_0xd788('0xe')][_0xd788('0x11')]);}else{logger[_0xd788('0x9')](_0xd788('0x10'),_0x5c71a1,'request\x20sent');_0x494f5e(_0x2a20d1[_0xd788('0x12')]['message']);}})[_0xd788('0x13')](function(_0x1360f7){logger['error'](_0xd788('0x10'),_0x5c71a1,_0x1360f7);_0x12bd82(_0x1360f7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index e377d13..fabda1a 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 _0xda3c=['clone','addSections','/:id/resources','put','update','delete','destroy','removeSections','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','./userProfile.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/sections','getSections','getResources','create','post','/:id/clone'];(function(_0x16e5b3,_0x30d91d){var _0x4d6874=function(_0x2fffbe){while(--_0x2fffbe){_0x16e5b3['push'](_0x16e5b3['shift']());}};_0x4d6874(++_0x30d91d);}(_0xda3c,0x79));var _0xcda3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xda3c[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xcda3('0x0'));var util=require(_0xcda3('0x1'));var path=require(_0xcda3('0x2'));var timeout=require(_0xcda3('0x3'));var express=require(_0xcda3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcda3('0x5'));var config=require('../../config/environment');var controller=require(_0xcda3('0x6'));router[_0xcda3('0x7')]('/',auth[_0xcda3('0x8')](),controller['index']);router['get'](_0xcda3('0x9'),auth[_0xcda3('0x8')](),controller[_0xcda3('0xa')]);router[_0xcda3('0x7')](_0xcda3('0xb'),auth[_0xcda3('0x8')](),controller[_0xcda3('0xc')]);router['get'](_0xcda3('0xd'),auth['isAuthenticated'](),controller[_0xcda3('0xe')]);router['get']('/:id/resources',auth[_0xcda3('0x8')](),controller[_0xcda3('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcda3('0x10')]);router[_0xcda3('0x11')](_0xcda3('0x12'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x13')]);router[_0xcda3('0x11')](_0xcda3('0xd'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x14')]);router[_0xcda3('0x11')](_0xcda3('0x15'),auth[_0xcda3('0x8')](),controller['addResources']);router[_0xcda3('0x16')]('/:id',auth[_0xcda3('0x8')](),controller[_0xcda3('0x17')]);router[_0xcda3('0x18')](_0xcda3('0xb'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x19')]);router['delete'](_0xcda3('0xd'),auth[_0xcda3('0x8')](),controller[_0xcda3('0x1a')]);router['delete'](_0xcda3('0x15'),auth[_0xcda3('0x8')](),controller['removeResources']);module[_0xcda3('0x1b')]=router; \ No newline at end of file +var _0x7f81=['/:id/sections','post','/:id/clone','addSections','/:id/resources','addResources','put','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','describe','/:id','show'];(function(_0xbdc136,_0x5943d5){var _0x3386c2=function(_0x1479f8){while(--_0x1479f8){_0xbdc136['push'](_0xbdc136['shift']());}};_0x3386c2(++_0x5943d5);}(_0x7f81,0x185));var _0x17f8=function(_0x5de002,_0x1b1dd8){_0x5de002=_0x5de002-0x0;var _0x101759=_0x7f81[_0x5de002];return _0x101759;};'use strict';var multer=require(_0x17f8('0x0'));var util=require(_0x17f8('0x1'));var path=require(_0x17f8('0x2'));var timeout=require(_0x17f8('0x3'));var express=require(_0x17f8('0x4'));var router=express[_0x17f8('0x5')]();var fs_extra=require(_0x17f8('0x6'));var auth=require(_0x17f8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x17f8('0x8'));var controller=require(_0x17f8('0x9'));router[_0x17f8('0xa')]('/',auth[_0x17f8('0xb')](),controller[_0x17f8('0xc')]);router[_0x17f8('0xa')]('/describe',auth[_0x17f8('0xb')](),controller[_0x17f8('0xd')]);router[_0x17f8('0xa')](_0x17f8('0xe'),auth[_0x17f8('0xb')](),controller[_0x17f8('0xf')]);router['get'](_0x17f8('0x10'),auth[_0x17f8('0xb')](),controller['getSections']);router[_0x17f8('0xa')]('/:id/resources',auth[_0x17f8('0xb')](),controller['getResources']);router[_0x17f8('0x11')]('/',auth[_0x17f8('0xb')](),controller['create']);router[_0x17f8('0x11')](_0x17f8('0x12'),auth[_0x17f8('0xb')](),controller['clone']);router[_0x17f8('0x11')](_0x17f8('0x10'),auth[_0x17f8('0xb')](),controller[_0x17f8('0x13')]);router['post'](_0x17f8('0x14'),auth[_0x17f8('0xb')](),controller[_0x17f8('0x15')]);router[_0x17f8('0x16')]('/:id',auth[_0x17f8('0xb')](),controller['update']);router['delete'](_0x17f8('0xe'),auth['isAuthenticated'](),controller[_0x17f8('0x17')]);router['delete'](_0x17f8('0x10'),auth['isAuthenticated'](),controller[_0x17f8('0x18')]);router['delete'](_0x17f8('0x14'),auth[_0x17f8('0xb')](),controller[_0x17f8('0x19')]);module[_0x17f8('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index f3903e5..a7a3585 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 _0x4c47=['setDataValue','join','getDataValue','crudPermissions','BOOLEAN','sequelize','exports','STRING','name'];(function(_0x11ced7,_0x29a8b0){var _0x4bed14=function(_0x2b62d0){while(--_0x2b62d0){_0x11ced7['push'](_0x11ced7['shift']());}};_0x4bed14(++_0x29a8b0);}(_0x4c47,0x16d));var _0x74c4=function(_0x46a2dd,_0x3897a4){_0x46a2dd=_0x46a2dd-0x0;var _0x5cc6fb=_0x4c47[_0x46a2dd];return _0x5cc6fb;};'use strict';var Sequelize=require(_0x74c4('0x0'));module[_0x74c4('0x1')]={'name':{'type':Sequelize[_0x74c4('0x2')],'allowNull':![],'unique':_0x74c4('0x3')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x22e1aa){this[_0x74c4('0x4')]('crudPermissions',_0x22e1aa?_0x22e1aa[_0x74c4('0x5')](''):[]);},'get':function(){return this[_0x74c4('0x6')](_0x74c4('0x7'))?this[_0x74c4('0x6')](_0x74c4('0x7'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x74c4('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x74c4('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x1007=['join','getDataValue','split','BOOLEAN','STRING','crudPermissions'];(function(_0x4f86e4,_0x4d843f){var _0x4bf4b1=function(_0x201bd8){while(--_0x201bd8){_0x4f86e4['push'](_0x4f86e4['shift']());}};_0x4bf4b1(++_0x4d843f);}(_0x1007,0x124));var _0x7100=function(_0xea14ab,_0x445af7){_0xea14ab=_0xea14ab-0x0;var _0x297a5b=_0x1007[_0xea14ab];return _0x297a5b;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7100('0x0')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x7100('0x0')],'set':function(_0x39adab){this['setDataValue'](_0x7100('0x1'),_0x39adab?_0x39adab[_0x7100('0x2')](''):[]);},'get':function(){return this[_0x7100('0x3')](_0x7100('0x1'))?this[_0x7100('0x3')](_0x7100('0x1'))[_0x7100('0x4')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x7100('0x5')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x7100('0x5')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x7100('0x5')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x7100('0x5')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x7100('0x5')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x7100('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index b4692c2..0adbf94 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 _0x7544=['transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','update','destroy','addSections','ids','getSections','enabled','isEmpty','includes','subsections','push','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','then','error','name','send','index','map','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','UserProfile','includeAll','findAll','rows','catch','show','keys','intersection','include','find','create','body','params','get','omit','createdAt','updatedAt','crudPermissions','sequelize'];(function(_0x1b5fd4,_0x552689){var _0x5757ac=function(_0x33c015){while(--_0x33c015){_0x1b5fd4['push'](_0x1b5fd4['shift']());}};_0x5757ac(++_0x552689);}(_0x7544,0x15d));var _0x4754=function(_0x546d5a,_0x320511){_0x546d5a=_0x546d5a-0x0;var _0x4da949=_0x7544[_0x546d5a];return _0x4da949;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4754('0x0'));var zipdir=require(_0x4754('0x1'));var jsonpatch=require(_0x4754('0x2'));var rp=require('request-promise');var moment=require(_0x4754('0x3'));var BPromise=require(_0x4754('0x4'));var Mustache=require(_0x4754('0x5'));var util=require(_0x4754('0x6'));var path=require('path');var sox=require(_0x4754('0x7'));var csv=require(_0x4754('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4754('0x9'));var _=require(_0x4754('0xa'));var squel=require(_0x4754('0xb'));var crypto=require(_0x4754('0xc'));var jsforce=require(_0x4754('0xd'));var deskjs=require(_0x4754('0xe'));var toCsv=require(_0x4754('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4754('0xf'));var as=require(_0x4754('0x10'));var hardwareService=require(_0x4754('0x11'));var logger=require(_0x4754('0x12'))(_0x4754('0x13'));var utils=require(_0x4754('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4754('0x15'));var db=require(_0x4754('0x16'))['db'];config[_0x4754('0x17')]=_['defaults'](config['redis'],{'host':_0x4754('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4754('0x17')]));require('./userProfile.socket')[_0x4754('0x19')](socket);function respondWithStatusCode(_0x9bde2d,_0x6e4ab5){_0x6e4ab5=_0x6e4ab5||0xcc;return function(_0x30c8fb){if(_0x30c8fb){return _0x9bde2d[_0x4754('0x1a')](_0x6e4ab5);}return _0x9bde2d['status'](_0x6e4ab5)[_0x4754('0x1b')]();};}function respondWithResult(_0xbf153e,_0x5754b8){_0x5754b8=_0x5754b8||0xc8;return function(_0x56e2e5){if(_0x56e2e5){return _0xbf153e[_0x4754('0x1c')](_0x5754b8)[_0x4754('0x1d')](_0x56e2e5);}};}function respondWithFilteredResult(_0x424239,_0x7146e2){return function(_0x44f933){if(_0x44f933){var _0x54f3f2=typeof _0x7146e2['offset']===_0x4754('0x1e')&&typeof _0x7146e2[_0x4754('0x1f')]===_0x4754('0x1e');var _0x305bb9=_0x44f933[_0x4754('0x20')];var _0x2bf7aa=_0x54f3f2?0x0:_0x7146e2[_0x4754('0x21')];var _0x15d8b0=_0x54f3f2?_0x44f933[_0x4754('0x20')]:_0x7146e2[_0x4754('0x21')]+_0x7146e2[_0x4754('0x1f')];var _0x253fce;if(_0x15d8b0>=_0x305bb9){_0x15d8b0=_0x305bb9;_0x253fce=0xc8;}else{_0x253fce=0xce;}_0x424239['status'](_0x253fce);return _0x424239[_0x4754('0x22')](_0x4754('0x23'),_0x2bf7aa+'-'+_0x15d8b0+'/'+_0x305bb9)[_0x4754('0x1d')](_0x44f933);}return null;};}function patchUpdates(_0x284448){return function(_0x147e5c){try{jsonpatch[_0x4754('0x24')](_0x147e5c,_0x284448,!![]);}catch(_0x1dd97e){return BPromise['reject'](_0x1dd97e);}return _0x147e5c['save']();};}function saveUpdates(_0x3a2bdf,_0x5848a3){return function(_0x102325){if(_0x102325){return _0x102325['update'](_0x3a2bdf)[_0x4754('0x25')](function(_0x3cc86e){return _0x3cc86e;});}return null;};}function removeEntity(_0x102fe3,_0x54ba8f){return function(_0x212445){if(_0x212445){return _0x212445['destroy']()['then'](function(){_0x102fe3['status'](0xcc)[_0x4754('0x1b')]();});}};}function handleEntityNotFound(_0x50dd1f,_0x5c1f64){return function(_0x125810){if(!_0x125810){_0x50dd1f[_0x4754('0x1a')](0x194);}return _0x125810;};}function handleError(_0x145e51,_0x57b110){_0x57b110=_0x57b110||0x1f4;return function(_0x9b482e){logger[_0x4754('0x26')](_0x9b482e['stack']);if(_0x9b482e[_0x4754('0x27')]){delete _0x9b482e[_0x4754('0x27')];}_0x145e51['status'](_0x57b110)[_0x4754('0x28')](_0x9b482e);};}exports[_0x4754('0x29')]=function(_0x177d91,_0x4ad3d3){var _0x45945a={},_0x4abcbf={},_0x1ea4ab={'count':0x0,'rows':[]};var _0x3551e7=_[_0x4754('0x2a')](db['UserProfile'][_0x4754('0x2b')],function(_0x4b4722){return{'name':_0x4b4722['fieldName'],'type':_0x4b4722['type'][_0x4754('0x2c')]};});_0x4abcbf[_0x4754('0x2d')]=_[_0x4754('0x2a')](_0x3551e7,'name');_0x4abcbf[_0x4754('0x2e')]=_['keys'](_0x177d91[_0x4754('0x2e')]);_0x4abcbf[_0x4754('0x2f')]=_['intersection'](_0x4abcbf[_0x4754('0x2d')],_0x4abcbf['query']);_0x45945a[_0x4754('0x30')]=_['intersection'](_0x4abcbf[_0x4754('0x2d')],qs[_0x4754('0x31')](_0x177d91[_0x4754('0x2e')][_0x4754('0x31')]));_0x45945a[_0x4754('0x30')]=_0x45945a['attributes'][_0x4754('0x32')]?_0x45945a[_0x4754('0x30')]:_0x4abcbf[_0x4754('0x2d')];if(!_0x177d91[_0x4754('0x2e')][_0x4754('0x33')](_0x4754('0x34'))){_0x45945a[_0x4754('0x1f')]=qs[_0x4754('0x1f')](_0x177d91[_0x4754('0x2e')][_0x4754('0x1f')]);_0x45945a[_0x4754('0x21')]=qs[_0x4754('0x21')](_0x177d91[_0x4754('0x2e')]['offset']);}_0x45945a['order']=qs[_0x4754('0x35')](_0x177d91['query'][_0x4754('0x35')]);_0x45945a['where']=qs['filters'](_[_0x4754('0x36')](_0x177d91['query'],_0x4abcbf[_0x4754('0x2f')]),_0x3551e7);if(_0x177d91[_0x4754('0x2e')][_0x4754('0x37')]){_0x45945a[_0x4754('0x38')]=_[_0x4754('0x39')](_0x45945a['where'],{'$or':_[_0x4754('0x2a')](_0x3551e7,function(_0x3c9c99){if(_0x3c9c99['type']!==_0x4754('0x3a')){var _0x455b0a={};_0x455b0a[_0x3c9c99[_0x4754('0x27')]]={'$like':'%'+_0x177d91['query'][_0x4754('0x37')]+'%'};return _0x455b0a;}})});}_0x45945a=_[_0x4754('0x39')]({},_0x45945a,_0x177d91[_0x4754('0x3b')]);var _0x497a29={'where':_0x45945a[_0x4754('0x38')]};return db[_0x4754('0x3c')]['count'](_0x497a29)[_0x4754('0x25')](function(_0x396ab1){_0x1ea4ab[_0x4754('0x20')]=_0x396ab1;if(_0x177d91[_0x4754('0x2e')][_0x4754('0x3d')]){_0x45945a['include']=[{'all':!![]}];}return db[_0x4754('0x3c')][_0x4754('0x3e')](_0x45945a);})[_0x4754('0x25')](function(_0x586279){_0x1ea4ab[_0x4754('0x3f')]=_0x586279;return _0x1ea4ab;})[_0x4754('0x25')](respondWithFilteredResult(_0x4ad3d3,_0x45945a))[_0x4754('0x40')](handleError(_0x4ad3d3,null));};exports[_0x4754('0x41')]=function(_0x5b9eba,_0x3d5856){var _0xe10dcb={'raw':![],'where':{'id':_0x5b9eba['params']['id']}},_0x46a901={};_0x46a901[_0x4754('0x2d')]=_[_0x4754('0x42')](db[_0x4754('0x3c')][_0x4754('0x2b')]);_0x46a901['query']=_['keys'](_0x5b9eba[_0x4754('0x2e')]);_0x46a901[_0x4754('0x2f')]=_[_0x4754('0x43')](_0x46a901[_0x4754('0x2d')],_0x46a901[_0x4754('0x2e')]);_0xe10dcb[_0x4754('0x30')]=_['intersection'](_0x46a901[_0x4754('0x2d')],qs[_0x4754('0x31')](_0x5b9eba[_0x4754('0x2e')]['fields']));_0xe10dcb[_0x4754('0x30')]=_0xe10dcb[_0x4754('0x30')][_0x4754('0x32')]?_0xe10dcb[_0x4754('0x30')]:_0x46a901[_0x4754('0x2d')];if(_0x5b9eba[_0x4754('0x2e')][_0x4754('0x3d')]){_0xe10dcb[_0x4754('0x44')]=[{'all':!![]}];}_0xe10dcb=_[_0x4754('0x39')]({},_0xe10dcb,_0x5b9eba[_0x4754('0x3b')]);return db[_0x4754('0x3c')][_0x4754('0x45')](_0xe10dcb)['then'](handleEntityNotFound(_0x3d5856,null))[_0x4754('0x25')](respondWithResult(_0x3d5856,null))[_0x4754('0x40')](handleError(_0x3d5856,null));};exports[_0x4754('0x46')]=function(_0x5c4481,_0x3e1157){return db[_0x4754('0x3c')][_0x4754('0x46')](_0x5c4481[_0x4754('0x47')],{})[_0x4754('0x25')](respondWithResult(_0x3e1157,0xc9))[_0x4754('0x40')](handleError(_0x3e1157,null));};exports['clone']=function(_0x1c4061,_0x43ed74){var _0x307b71={'where':{'id':_0x1c4061[_0x4754('0x48')]['id']}},_0x382c88={};_0x382c88[_0x4754('0x2d')]=_[_0x4754('0x42')](db['UserProfile'][_0x4754('0x2b')]);_0x307b71[_0x4754('0x30')]=_[_0x4754('0x43')](_0x382c88[_0x4754('0x2d')],qs[_0x4754('0x31')](_0x1c4061[_0x4754('0x2e')][_0x4754('0x31')]));_0x307b71['attributes']=_0x307b71[_0x4754('0x30')][_0x4754('0x32')]?_0x307b71[_0x4754('0x30')]:_0x382c88['model'];if(_0x1c4061[_0x4754('0x2e')]['includeAll']){_0x307b71[_0x4754('0x44')]=[{'all':!![]}];}_0x307b71=_['merge']({},_0x307b71,_0x1c4061['options']);return db['UserProfile'][_0x4754('0x45')](_0x307b71)[_0x4754('0x25')](handleEntityNotFound(_0x43ed74,null))['then'](function(_0x2d4bfd){if(_0x2d4bfd){var _0x25c2d8=_0x2d4bfd[_0x4754('0x49')]({'plain':!![]});_0x25c2d8=qs[_0x4754('0x4a')](_0x25c2d8,['id',_0x4754('0x4b'),_0x4754('0x4c'),_0x4754('0x4d')]);_0x1c4061[_0x4754('0x47')]=_[_0x4754('0x4a')](_0x1c4061[_0x4754('0x47')],['id','createdAt','updatedAt']);return db[_0x4754('0x4e')][_0x4754('0x4f')](function(_0x4b5309){return db[_0x4754('0x3c')]['create'](_[_0x4754('0x39')](_0x25c2d8,_0x1c4061[_0x4754('0x47')]),{'include':_0x1c4061[_0x4754('0x2e')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b5309})[_0x4754('0x25')](function(_0x4769e8){var _0x581e69=_0x4769e8['get']({'plain':!![]});return db[_0x4754('0x50')][_0x4754('0x3e')]({'where':{'userProfileId':_0x1c4061['params']['id']},'raw':!![]})[_0x4754('0x25')](function(_0x421abb){if(_0x421abb){return BPromise[_0x4754('0x51')](_0x421abb,function(_0x20aff6){return new BPromise(function(_0x2df591,_0x1b1c90){if(_0x20aff6['autoAssociation']===null||_0x20aff6[_0x4754('0x52')]===0x1)_0x2df591(null);return db['UserProfileResource'][_0x4754('0x3e')]({'where':{'sectionId':_0x20aff6['id']},'raw':!![]})['then'](function(_0x3674be){var _0xef3d9a=_[_0x4754('0x2a')](_0x3674be,function(_0x536f63){return qs['omit'](_0x536f63,['id',_0x4754('0x4b'),_0x4754('0x4c'),_0x4754('0x53')]);});_0x2df591(_0xef3d9a);})[_0x4754('0x40')](function(_0x221913){_0x1b1c90(_0x221913);});})[_0x4754('0x25')](function(_0x411dc6){var _0x28822d=qs['omit'](_0x20aff6,['id',_0x4754('0x4b'),_0x4754('0x4c')]);_0x28822d[_0x4754('0x54')]=_0x581e69['id'];if(_0x411dc6)_0x28822d[_0x4754('0x55')]=_0x411dc6;return _0x28822d;})[_0x4754('0x25')](function(_0x145fc9){return db[_0x4754('0x50')][_0x4754('0x46')](_0x145fc9,{'include':[{'model':db[_0x4754('0x56')],'as':_0x4754('0x55')}],'raw':!![],'transaction':_0x4b5309});});})['then'](function(){return _0x581e69;});}});});});}})['then'](respondWithResult(_0x43ed74,0xc9))[_0x4754('0x40')](handleError(_0x43ed74,null));};exports[_0x4754('0x57')]=function(_0x1f006c,_0xe7495e){if(_0x1f006c['body']['id']){delete _0x1f006c[_0x4754('0x47')]['id'];}return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0x1f006c[_0x4754('0x48')]['id']}})[_0x4754('0x25')](handleEntityNotFound(_0xe7495e,null))['then'](saveUpdates(_0x1f006c[_0x4754('0x47')],null))[_0x4754('0x25')](respondWithResult(_0xe7495e,null))[_0x4754('0x40')](handleError(_0xe7495e,null));};exports[_0x4754('0x58')]=function(_0x3f6e0c,_0x927939){return db['UserProfile'][_0x4754('0x45')]({'where':{'id':_0x3f6e0c['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x927939,null))[_0x4754('0x25')](removeEntity(_0x927939,null))[_0x4754('0x40')](handleError(_0x927939,null));};exports['describe']=function(_0x8de7d7,_0x5e2795){return db[_0x4754('0x3c')]['describe']()[_0x4754('0x25')](respondWithResult(_0x5e2795,null))[_0x4754('0x40')](handleError(_0x5e2795,null));};exports[_0x4754('0x59')]=function(_0x4e41b2,_0x56f2ec){var _0x18df47=_0x4e41b2[_0x4754('0x47')];return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0x4e41b2[_0x4754('0x48')]['id']}})['then'](handleEntityNotFound(_0x56f2ec,null))['then'](function(_0x53721d){if(_0x53721d){return db[_0x4754('0x4e')][_0x4754('0x4f')](function(_0x231a78){return db['UserProfileSection'][_0x4754('0x58')]({'where':{'userProfileId':_0x4e41b2['params']['id'],'sectionId':_['map'](_0x18df47,function(_0x40d33f){return _0x40d33f[_0x4754('0x53')];})},'transaction':_0x231a78})[_0x4754('0x25')](function(){var _0x483912=_['map'](_0x18df47,function(_0x378ad6){_0x378ad6[_0x4754('0x54')]=_0x4e41b2[_0x4754('0x48')]['id'];return _0x378ad6;});var _0x554af2=[];return BPromise[_0x4754('0x51')](_0x483912,function(_0xfac42b){return db[_0x4754('0x50')][_0x4754('0x46')](_0xfac42b,{'include':[{'model':db[_0x4754('0x56')],'as':_0x4754('0x55')}],'raw':!![],'transaction':_0x231a78})['then'](function(_0x20a82a){_0x554af2['push'](_0x20a82a['get']({'plain':!![]}));});})[_0x4754('0x25')](function(){return _0x554af2;});});});}})[_0x4754('0x25')](function(_0x45b2c8){return _0x45b2c8;})['then'](respondWithResult(_0x56f2ec,null))[_0x4754('0x40')](handleError(_0x56f2ec,null));};exports['removeSections']=function(_0x46e0fa,_0x5197cf){var _0x4571e2;return db['UserProfile']['find']({'where':{'id':_0x46e0fa['params']['id']},'attributes':['id',_0x4754('0x27')]})[_0x4754('0x25')](handleEntityNotFound(_0x5197cf,null))['then'](function(_0x93349c){if(_0x93349c){_0x4571e2=_0x93349c;return db[_0x4754('0x50')][_0x4754('0x58')]({'where':{'userProfileId':_0x46e0fa[_0x4754('0x48')]['id'],'sectionId':_0x46e0fa[_0x4754('0x2e')][_0x4754('0x5a')]}});}})[_0x4754('0x25')](function(){return _0x4571e2;})[_0x4754('0x25')](respondWithStatusCode(_0x5197cf,null))[_0x4754('0x40')](handleError(_0x5197cf,null));};exports[_0x4754('0x5b')]=function(_0x1b2608,_0x1d9652){var _0x263c1e=[];var _0x3273b7=[];return db[_0x4754('0x50')][_0x4754('0x3e')]({'where':{'userProfileId':_0x1b2608[_0x4754('0x48')]['id']},'raw':!![]})[_0x4754('0x25')](function(_0x2f7cab){_0x263c1e=_['filter'](_0x2f7cab,function(_0x4db338){return _0x4db338[_0x4754('0x5c')]===0x1||_['includes']([0x3eb,0x709],_0x4db338['sectionId']);});if(!_[_0x4754('0x5d')](_0x263c1e)){return _[_0x4754('0x2a')](_0x263c1e,function(_0x5a6b3b){return _0x5a6b3b[_0x4754('0x53')];});}else{return;}})[_0x4754('0x25')](function(_0x5d9628){if(_0x5d9628)_0x3273b7=_0x5d9628;if(_[_0x4754('0x5e')](_0x3273b7,0x64)){var _0x43c393=_['find'](_0x263c1e,{'sectionId':0x64});return hasDefaultDashboard(_0x43c393)[_0x4754('0x25')](function(_0x5b458b){return _[_0x4754('0x2a')](_0x263c1e,function(_0xc1b037){if(_0xc1b037['sectionId']===0x64){_0xc1b037[_0x4754('0x5f')]=_0x5b458b;}return _0xc1b037;});});}else{return;}})['then'](function(_0x2721ac){if(_0x2721ac)_0x263c1e=_0x2721ac;if(_[_0x4754('0x5e')](_0x3273b7,0x3eb)){var _0x381a40=_[_0x4754('0x45')](_0x263c1e,{'sectionId':0x3eb});return getCustomDashboards(_0x381a40)[_0x4754('0x25')](function(_0x4b74a1){return _['map'](_0x263c1e,function(_0x41bb94){if(_0x381a40[_0x4754('0x5c')]){if(_0x41bb94[_0x4754('0x53')]===0x3eb){_0x41bb94['subsections']=_0x4b74a1;}}else{if(_0x41bb94['sectionId']===0x64){if(!_0x41bb94[_0x4754('0x5f')]){_0x41bb94[_0x4754('0x5f')]=[];}_0x41bb94[_0x4754('0x5f')]=_0x41bb94[_0x4754('0x5f')]['concat'](_0x4b74a1);}}return _0x41bb94;});});}else{return;}})['then'](function(_0x437489){if(_0x437489)_0x263c1e=_0x437489;if(_['includes'](_0x3273b7,0x709)){var _0x50ad16=_['find'](_0x263c1e,{'sectionId':0x709});return getPlugins(_0x50ad16)['then'](function(_0x3d52c5){if(_0x50ad16[_0x4754('0x5c')]){return _[_0x4754('0x2a')](_0x263c1e,function(_0x5597f5){if(_0x5597f5[_0x4754('0x53')]===0x709){_0x5597f5[_0x4754('0x5f')]=_0x3d52c5;}return _0x5597f5;});}else{var _0x56f0e5={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3d52c5};var _0x14bfe2=_[_0x4754('0x2a')](_0x263c1e);_0x14bfe2[_0x4754('0x60')](_0x56f0e5);return _0x14bfe2;}});}else{return;}})[_0x4754('0x25')](function(_0x1aa855){if(_0x1aa855)_0x263c1e=_0x1aa855;return _['filter'](_0x263c1e,[_0x4754('0x5c'),0x1]);})['then'](respondWithResult(_0x1d9652,null))[_0x4754('0x40')](handleError(_0x1d9652,null));};function hasDefaultDashboard(_0x50ba3f){var _0x23e81b=[0x65];return new BPromise(function(_0x192910,_0x432d80){try{if(_0x50ba3f[_0x4754('0x52')]){_0x192910(_0x23e81b);}else{return db[_0x4754('0x56')]['findOne']({'where':{'sectionId':_0x50ba3f['id']},'raw':!![]})[_0x4754('0x25')](function(_0x5aee78){_0x5aee78?_0x192910(_0x23e81b):_0x192910();});}}catch(_0xe280b4){_0x432d80(_0xe280b4);}});}function getCustomDashboards(_0xecf201){var _0x25603d=[];return new BPromise(function(_0x49da38,_0x58759f){try{if(_0xecf201[_0x4754('0x52')]){return db[_0x4754('0x61')][_0x4754('0x3e')]({'raw':!![]})[_0x4754('0x25')](function(_0x1732f0){_0x1732f0['forEach'](function(_0x4f90ca){_0x25603d[_0x4754('0x60')](_0x4f90ca['id']+0x1869f);});_0x49da38(_0x25603d);});}else{return db[_0x4754('0x56')]['findAll']({'where':{'sectionId':_0xecf201['id']},'raw':!![]})[_0x4754('0x25')](function(_0x4cdb0a){_0x4cdb0a[_0x4754('0x62')](function(_0x4dd815){_0x25603d[_0x4754('0x60')](_0x4dd815[_0x4754('0x63')]+0x1869f);});_0x49da38(_0x25603d);});}}catch(_0x417856){_0x58759f(_0x417856);}});}function getPlugins(_0x842afd){var _0x172b05=[];return new BPromise(function(_0x293cd4,_0x277093){try{if(_0x842afd[_0x4754('0x52')]){return db[_0x4754('0x64')][_0x4754('0x3e')]({'raw':!![]})[_0x4754('0x25')](function(_0x509554){_0x509554[_0x4754('0x62')](function(_0x310302){_0x172b05[_0x4754('0x60')](_0x310302['id']+0x15b38);});_0x293cd4(_0x172b05);});}else{return db[_0x4754('0x56')][_0x4754('0x3e')]({'where':{'sectionId':_0x842afd['id']},'raw':!![]})[_0x4754('0x25')](function(_0x24a2dd){_0x24a2dd['forEach'](function(_0x14929a){_0x172b05[_0x4754('0x60')](_0x14929a[_0x4754('0x63')]+0x15b38);});_0x293cd4(_0x172b05);});}}catch(_0x4a8963){_0x277093(_0x4a8963);}});}exports[_0x4754('0x65')]=function(_0xdf9e6f,_0x3ef07d){return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0xdf9e6f['params']['id']}})[_0x4754('0x25')](handleEntityNotFound(_0x3ef07d,null))['then'](function(_0x2d5b0f){if(_0x2d5b0f){return db['sequelize'][_0x4754('0x4f')](function(_0x4ff272){return db['UserProfileSection'][_0x4754('0x3e')]({'where':{'userProfileId':_0xdf9e6f[_0x4754('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x4754('0x25')](function(_0x4b1925){if(_0x4b1925){return db['UserProfileSection'][_0x4754('0x58')]({'where':{'userProfileId':_0xdf9e6f[_0x4754('0x48')]['id'],'id':_[_0x4754('0x2a')](_0x4b1925,function(_0x5bf5f8){return _0x5bf5f8['id'];})},'transaction':_0x4ff272});}})['then'](function(_0x60f54c){var _0x119763=_[_0x4754('0x2a')](_0xdf9e6f[_0x4754('0x47')],function(_0x5966a7){_0x5966a7[_0x4754('0x54')]=_0xdf9e6f['params']['id'];return _0x5966a7;});return db[_0x4754('0x50')][_0x4754('0x66')](_0x119763,{'raw':!![],'transaction':_0x4ff272});})[_0x4754('0x25')](function(_0x147856){var _0x4b874e=_[_0x4754('0x37')](_[_0x4754('0x2a')](_0x147856,function(_0x5bdcfa){return _0x5bdcfa[_0x4754('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x4b874e){return db[_0x4754('0x50')][_0x4754('0x3e')]({'where':{'userProfileId':_0xdf9e6f[_0x4754('0x48')]['id'],'sectionId':_[_0x4754('0x2a')](_0x4b874e,function(_0x5ceb6f){return _0x5ceb6f[_0x4754('0x53')];})},'attributes':['id',_0x4754('0x53')],'raw':!![]})[_0x4754('0x25')](function(_0x1c056e){var _0x590d2e=_[_0x4754('0x2a')](_0xdf9e6f[_0x4754('0x47')],function(_0x22a59a){_0x22a59a['userProfileId']=_0xdf9e6f[_0x4754('0x48')]['id'];return _0x22a59a;});return db[_0x4754('0x56')]['bulkCreate'](_0x590d2e,{'raw':!![],'transaction':_0x4ff272});});}})[_0x4754('0x40')](handleError(_0x3ef07d,null));});}})[_0x4754('0x25')](function(_0x3e41a1){var _0x5cff70=_[_0x4754('0x2a')](_0x3e41a1,function(_0xb7fd08){return _0xb7fd08[_0x4754('0x49')]({'plain':!![]});});})[_0x4754('0x25')](respondWithResult(_0x3ef07d,null))[_0x4754('0x40')](handleError(_0x3ef07d,null));};exports['removeResources']=function(_0x499a4f,_0x1f4ecb,_0x3e9503){return db[_0x4754('0x3c')][_0x4754('0x45')]({'where':{'id':_0x499a4f['params']['id']}})['then'](handleEntityNotFound(_0x1f4ecb,null))[_0x4754('0x25')](function(_0x2e2426){if(_0x2e2426){return _0x2e2426['removeResources'](_0x499a4f[_0x4754('0x2e')]['ids']);}})[_0x4754('0x25')](respondWithStatusCode(_0x1f4ecb,null))['catch'](handleError(_0x1f4ecb,null));};exports[_0x4754('0x67')]=function(_0x3f8e2e,_0x51085f){var _0x5e9630={};if(!_0x3f8e2e['query'][_0x4754('0x68')])throw new Error(_0x4754('0x69'));if(!_0x3f8e2e[_0x4754('0x2e')][_0x4754('0x33')](_0x4754('0x34'))){_0x5e9630[_0x4754('0x1f')]=qs[_0x4754('0x1f')](_0x3f8e2e[_0x4754('0x2e')][_0x4754('0x1f')]);_0x5e9630[_0x4754('0x21')]=qs[_0x4754('0x21')](_0x3f8e2e['query'][_0x4754('0x21')]);}return db[_0x4754('0x3c')]['find']({'where':{'id':_0x3f8e2e[_0x4754('0x48')]['id']}})[_0x4754('0x25')](function(_0x1ee7a6){if(!_0x1ee7a6)throw new Error(_0x4754('0x6a')+_0x3f8e2e[_0x4754('0x48')]['id']);return db['UserProfile'][_0x4754('0x67')](_0x3f8e2e);})[_0x4754('0x25')](respondWithFilteredResult(_0x51085f,_0x5e9630))[_0x4754('0x40')](handleError(_0x51085f,null));}; \ No newline at end of file +var _0x0f49=['type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','length','options','find','create','body','clone','get','omit','createdAt','updatedAt','crudPermissions','sequelize','transaction','autoAssociation','sectionId','userProfileId','Resources','UserProfileSection','describe','each','UserProfileResource','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','findOne','Dashboard','forEach','Plugin','resourceId','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','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/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','localhost','socket.io-emitter','redis','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','UserProfile','rawAttributes','fieldName'];(function(_0x465d94,_0x404ea6){var _0x4e20c0=function(_0xe33694){while(--_0xe33694){_0x465d94['push'](_0x465d94['shift']());}};_0x4e20c0(++_0x404ea6);}(_0x0f49,0xb2));var _0x90f4=function(_0x47794f,_0x12c9b3){_0x47794f=_0x47794f-0x0;var _0x2ca51d=_0x0f49[_0x47794f];return _0x2ca51d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90f4('0x0'));var zipdir=require(_0x90f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x90f4('0x2'));var moment=require(_0x90f4('0x3'));var BPromise=require(_0x90f4('0x4'));var Mustache=require(_0x90f4('0x5'));var util=require(_0x90f4('0x6'));var path=require(_0x90f4('0x7'));var sox=require(_0x90f4('0x8'));var csv=require(_0x90f4('0x9'));var ejs=require(_0x90f4('0xa'));var fs=require('fs');var fs_extra=require(_0x90f4('0xb'));var _=require(_0x90f4('0xc'));var squel=require('squel');var crypto=require(_0x90f4('0xd'));var jsforce=require(_0x90f4('0xe'));var deskjs=require(_0x90f4('0xf'));var toCsv=require(_0x90f4('0x9'));var querystring=require(_0x90f4('0x10'));var Papa=require(_0x90f4('0x11'));var Redis=require(_0x90f4('0x12'));var authService=require(_0x90f4('0x13'));var qs=require(_0x90f4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f4('0x15'));var logger=require(_0x90f4('0x16'))(_0x90f4('0x17'));var utils=require(_0x90f4('0x18'));var config=require(_0x90f4('0x19'));var licenseUtil=require(_0x90f4('0x1a'));var db=require(_0x90f4('0x1b'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x90f4('0x1c'),'port':0x18eb});var socket=require(_0x90f4('0x1d'))(new Redis(config[_0x90f4('0x1e')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x1733a4,_0x11b85c){_0x11b85c=_0x11b85c||0xcc;return function(_0x319abe){if(_0x319abe){return _0x1733a4[_0x90f4('0x1f')](_0x11b85c);}return _0x1733a4[_0x90f4('0x20')](_0x11b85c)[_0x90f4('0x21')]();};}function respondWithResult(_0x5b6129,_0x5d1ab6){_0x5d1ab6=_0x5d1ab6||0xc8;return function(_0x3fb8e6){if(_0x3fb8e6){return _0x5b6129['status'](_0x5d1ab6)[_0x90f4('0x22')](_0x3fb8e6);}};}function respondWithFilteredResult(_0x2944c3,_0x5600c1){return function(_0x42de14){if(_0x42de14){var _0x5d93ca=typeof _0x5600c1[_0x90f4('0x23')]==='undefined'&&typeof _0x5600c1[_0x90f4('0x24')]===_0x90f4('0x25');var _0x2c28c4=_0x42de14[_0x90f4('0x26')];var _0x550e0d=_0x5d93ca?0x0:_0x5600c1['offset'];var _0x4f2309=_0x5d93ca?_0x42de14['count']:_0x5600c1[_0x90f4('0x23')]+_0x5600c1[_0x90f4('0x24')];var _0x531fbf;if(_0x4f2309>=_0x2c28c4){_0x4f2309=_0x2c28c4;_0x531fbf=0xc8;}else{_0x531fbf=0xce;}_0x2944c3[_0x90f4('0x20')](_0x531fbf);return _0x2944c3[_0x90f4('0x27')](_0x90f4('0x28'),_0x550e0d+'-'+_0x4f2309+'/'+_0x2c28c4)['json'](_0x42de14);}return null;};}function patchUpdates(_0x59672e){return function(_0x5dd028){try{jsonpatch[_0x90f4('0x29')](_0x5dd028,_0x59672e,!![]);}catch(_0x308b4b){return BPromise[_0x90f4('0x2a')](_0x308b4b);}return _0x5dd028[_0x90f4('0x2b')]();};}function saveUpdates(_0x47c916,_0x592e6f){return function(_0x5a6083){if(_0x5a6083){return _0x5a6083[_0x90f4('0x2c')](_0x47c916)[_0x90f4('0x2d')](function(_0x4d6b5d){return _0x4d6b5d;});}return null;};}function removeEntity(_0x172a65,_0x42ee68){return function(_0xd62950){if(_0xd62950){return _0xd62950[_0x90f4('0x2e')]()[_0x90f4('0x2d')](function(){_0x172a65['status'](0xcc)[_0x90f4('0x21')]();});}};}function handleEntityNotFound(_0x18e806,_0x15b41f){return function(_0x2fe927){if(!_0x2fe927){_0x18e806[_0x90f4('0x1f')](0x194);}return _0x2fe927;};}function handleError(_0x19c642,_0x113fc0){_0x113fc0=_0x113fc0||0x1f4;return function(_0x112a4f){logger[_0x90f4('0x2f')](_0x112a4f[_0x90f4('0x30')]);if(_0x112a4f[_0x90f4('0x31')]){delete _0x112a4f['name'];}_0x19c642[_0x90f4('0x20')](_0x113fc0)[_0x90f4('0x32')](_0x112a4f);};}exports[_0x90f4('0x33')]=function(_0x33f8a6,_0x10f5df){var _0x3fd996={},_0x1aea18={},_0x2a7ff4={'count':0x0,'rows':[]};var _0x60ab02=_[_0x90f4('0x34')](db[_0x90f4('0x35')][_0x90f4('0x36')],function(_0x252376){return{'name':_0x252376[_0x90f4('0x37')],'type':_0x252376[_0x90f4('0x38')]['key']};});_0x1aea18['model']=_[_0x90f4('0x34')](_0x60ab02,_0x90f4('0x31'));_0x1aea18['query']=_['keys'](_0x33f8a6[_0x90f4('0x39')]);_0x1aea18[_0x90f4('0x3a')]=_[_0x90f4('0x3b')](_0x1aea18[_0x90f4('0x3c')],_0x1aea18[_0x90f4('0x39')]);_0x3fd996[_0x90f4('0x3d')]=_[_0x90f4('0x3b')](_0x1aea18[_0x90f4('0x3c')],qs[_0x90f4('0x3e')](_0x33f8a6[_0x90f4('0x39')][_0x90f4('0x3e')]));_0x3fd996[_0x90f4('0x3d')]=_0x3fd996[_0x90f4('0x3d')]['length']?_0x3fd996[_0x90f4('0x3d')]:_0x1aea18[_0x90f4('0x3c')];if(!_0x33f8a6[_0x90f4('0x39')][_0x90f4('0x3f')](_0x90f4('0x40'))){_0x3fd996[_0x90f4('0x24')]=qs['limit'](_0x33f8a6['query']['limit']);_0x3fd996[_0x90f4('0x23')]=qs[_0x90f4('0x23')](_0x33f8a6[_0x90f4('0x39')][_0x90f4('0x23')]);}_0x3fd996[_0x90f4('0x41')]=qs['sort'](_0x33f8a6[_0x90f4('0x39')]['sort']);_0x3fd996[_0x90f4('0x42')]=qs[_0x90f4('0x3a')](_[_0x90f4('0x43')](_0x33f8a6[_0x90f4('0x39')],_0x1aea18[_0x90f4('0x3a')]),_0x60ab02);if(_0x33f8a6['query'][_0x90f4('0x44')]){_0x3fd996[_0x90f4('0x42')]=_['merge'](_0x3fd996[_0x90f4('0x42')],{'$or':_[_0x90f4('0x34')](_0x60ab02,function(_0x1f280c){if(_0x1f280c[_0x90f4('0x38')]!=='VIRTUAL'){var _0x37c7ce={};_0x37c7ce[_0x1f280c[_0x90f4('0x31')]]={'$like':'%'+_0x33f8a6['query'][_0x90f4('0x44')]+'%'};return _0x37c7ce;}})});}_0x3fd996=_[_0x90f4('0x45')]({},_0x3fd996,_0x33f8a6['options']);var _0x357b33={'where':_0x3fd996[_0x90f4('0x42')]};return db['UserProfile'][_0x90f4('0x26')](_0x357b33)[_0x90f4('0x2d')](function(_0x1497c2){_0x2a7ff4[_0x90f4('0x26')]=_0x1497c2;if(_0x33f8a6[_0x90f4('0x39')][_0x90f4('0x46')]){_0x3fd996[_0x90f4('0x47')]=[{'all':!![]}];}return db[_0x90f4('0x35')][_0x90f4('0x48')](_0x3fd996);})[_0x90f4('0x2d')](function(_0x3b4c14){_0x2a7ff4[_0x90f4('0x49')]=_0x3b4c14;return _0x2a7ff4;})[_0x90f4('0x2d')](respondWithFilteredResult(_0x10f5df,_0x3fd996))[_0x90f4('0x4a')](handleError(_0x10f5df,null));};exports[_0x90f4('0x4b')]=function(_0x4e4c34,_0x3de1a4){var _0x242c81={'raw':![],'where':{'id':_0x4e4c34[_0x90f4('0x4c')]['id']}},_0x1f2d24={};_0x1f2d24[_0x90f4('0x3c')]=_['keys'](db[_0x90f4('0x35')][_0x90f4('0x36')]);_0x1f2d24['query']=_[_0x90f4('0x4d')](_0x4e4c34['query']);_0x1f2d24[_0x90f4('0x3a')]=_['intersection'](_0x1f2d24[_0x90f4('0x3c')],_0x1f2d24[_0x90f4('0x39')]);_0x242c81[_0x90f4('0x3d')]=_['intersection'](_0x1f2d24[_0x90f4('0x3c')],qs[_0x90f4('0x3e')](_0x4e4c34[_0x90f4('0x39')]['fields']));_0x242c81['attributes']=_0x242c81['attributes'][_0x90f4('0x4e')]?_0x242c81[_0x90f4('0x3d')]:_0x1f2d24[_0x90f4('0x3c')];if(_0x4e4c34[_0x90f4('0x39')][_0x90f4('0x46')]){_0x242c81[_0x90f4('0x47')]=[{'all':!![]}];}_0x242c81=_[_0x90f4('0x45')]({},_0x242c81,_0x4e4c34[_0x90f4('0x4f')]);return db[_0x90f4('0x35')][_0x90f4('0x50')](_0x242c81)['then'](handleEntityNotFound(_0x3de1a4,null))[_0x90f4('0x2d')](respondWithResult(_0x3de1a4,null))[_0x90f4('0x4a')](handleError(_0x3de1a4,null));};exports[_0x90f4('0x51')]=function(_0x280ef1,_0x327028){return db[_0x90f4('0x35')][_0x90f4('0x51')](_0x280ef1[_0x90f4('0x52')],{})[_0x90f4('0x2d')](respondWithResult(_0x327028,0xc9))[_0x90f4('0x4a')](handleError(_0x327028,null));};exports[_0x90f4('0x53')]=function(_0x916b5,_0x403238){var _0x1d0d78={'where':{'id':_0x916b5[_0x90f4('0x4c')]['id']}},_0x1a2df0={};_0x1a2df0[_0x90f4('0x3c')]=_['keys'](db[_0x90f4('0x35')][_0x90f4('0x36')]);_0x1d0d78[_0x90f4('0x3d')]=_['intersection'](_0x1a2df0[_0x90f4('0x3c')],qs[_0x90f4('0x3e')](_0x916b5['query'][_0x90f4('0x3e')]));_0x1d0d78[_0x90f4('0x3d')]=_0x1d0d78[_0x90f4('0x3d')]['length']?_0x1d0d78[_0x90f4('0x3d')]:_0x1a2df0[_0x90f4('0x3c')];if(_0x916b5[_0x90f4('0x39')][_0x90f4('0x46')]){_0x1d0d78['include']=[{'all':!![]}];}_0x1d0d78=_[_0x90f4('0x45')]({},_0x1d0d78,_0x916b5[_0x90f4('0x4f')]);return db[_0x90f4('0x35')][_0x90f4('0x50')](_0x1d0d78)['then'](handleEntityNotFound(_0x403238,null))[_0x90f4('0x2d')](function(_0x1c4afe){if(_0x1c4afe){var _0x51a194=_0x1c4afe[_0x90f4('0x54')]({'plain':!![]});_0x51a194=qs[_0x90f4('0x55')](_0x51a194,['id',_0x90f4('0x56'),_0x90f4('0x57'),_0x90f4('0x58')]);_0x916b5[_0x90f4('0x52')]=_[_0x90f4('0x55')](_0x916b5[_0x90f4('0x52')],['id',_0x90f4('0x56'),_0x90f4('0x57')]);return db[_0x90f4('0x59')][_0x90f4('0x5a')](function(_0x5036d2){return db[_0x90f4('0x35')][_0x90f4('0x51')](_[_0x90f4('0x45')](_0x51a194,_0x916b5[_0x90f4('0x52')]),{'include':_0x916b5['query'][_0x90f4('0x46')]?[{'all':!![]}]:undefined,'transaction':_0x5036d2})[_0x90f4('0x2d')](function(_0x5d91d7){var _0x29cdf2=_0x5d91d7[_0x90f4('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x90f4('0x48')]({'where':{'userProfileId':_0x916b5[_0x90f4('0x4c')]['id']},'raw':!![]})[_0x90f4('0x2d')](function(_0x17653e){if(_0x17653e){return BPromise['each'](_0x17653e,function(_0x2bbd7e){return new BPromise(function(_0x11e6fb,_0x26ff2f){if(_0x2bbd7e[_0x90f4('0x5b')]===null||_0x2bbd7e['autoAssociation']===0x1)_0x11e6fb(null);return db['UserProfileResource'][_0x90f4('0x48')]({'where':{'sectionId':_0x2bbd7e['id']},'raw':!![]})[_0x90f4('0x2d')](function(_0x5e487a){var _0x18bae0=_[_0x90f4('0x34')](_0x5e487a,function(_0x8dfcf4){return qs[_0x90f4('0x55')](_0x8dfcf4,['id',_0x90f4('0x56'),_0x90f4('0x57'),_0x90f4('0x5c')]);});_0x11e6fb(_0x18bae0);})['catch'](function(_0x19f2b5){_0x26ff2f(_0x19f2b5);});})[_0x90f4('0x2d')](function(_0x596a6f){var _0x3f9d07=qs[_0x90f4('0x55')](_0x2bbd7e,['id',_0x90f4('0x56'),_0x90f4('0x57')]);_0x3f9d07[_0x90f4('0x5d')]=_0x29cdf2['id'];if(_0x596a6f)_0x3f9d07[_0x90f4('0x5e')]=_0x596a6f;return _0x3f9d07;})[_0x90f4('0x2d')](function(_0x41df6e){return db[_0x90f4('0x5f')][_0x90f4('0x51')](_0x41df6e,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x5036d2});});})['then'](function(){return _0x29cdf2;});}});});});}})[_0x90f4('0x2d')](respondWithResult(_0x403238,0xc9))[_0x90f4('0x4a')](handleError(_0x403238,null));};exports[_0x90f4('0x2c')]=function(_0x29dd14,_0xf5db0a){if(_0x29dd14['body']['id']){delete _0x29dd14[_0x90f4('0x52')]['id'];}return db['UserProfile'][_0x90f4('0x50')]({'where':{'id':_0x29dd14[_0x90f4('0x4c')]['id']}})[_0x90f4('0x2d')](handleEntityNotFound(_0xf5db0a,null))[_0x90f4('0x2d')](saveUpdates(_0x29dd14[_0x90f4('0x52')],null))[_0x90f4('0x2d')](respondWithResult(_0xf5db0a,null))[_0x90f4('0x4a')](handleError(_0xf5db0a,null));};exports[_0x90f4('0x2e')]=function(_0x21b647,_0x5fdeaf){return db[_0x90f4('0x35')][_0x90f4('0x50')]({'where':{'id':_0x21b647[_0x90f4('0x4c')]['id']}})[_0x90f4('0x2d')](handleEntityNotFound(_0x5fdeaf,null))[_0x90f4('0x2d')](removeEntity(_0x5fdeaf,null))['catch'](handleError(_0x5fdeaf,null));};exports[_0x90f4('0x60')]=function(_0xd3ac10,_0x3a504b){return db['UserProfile'][_0x90f4('0x60')]()[_0x90f4('0x2d')](respondWithResult(_0x3a504b,null))['catch'](handleError(_0x3a504b,null));};exports['addSections']=function(_0x6a5f4a,_0x9e95a7){var _0x4100e7=_0x6a5f4a[_0x90f4('0x52')];return db[_0x90f4('0x35')]['find']({'where':{'id':_0x6a5f4a[_0x90f4('0x4c')]['id']}})[_0x90f4('0x2d')](handleEntityNotFound(_0x9e95a7,null))[_0x90f4('0x2d')](function(_0x4de584){if(_0x4de584){return db[_0x90f4('0x59')]['transaction'](function(_0x3c3f7d){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x6a5f4a[_0x90f4('0x4c')]['id'],'sectionId':_[_0x90f4('0x34')](_0x4100e7,function(_0x394ee1){return _0x394ee1[_0x90f4('0x5c')];})},'transaction':_0x3c3f7d})[_0x90f4('0x2d')](function(){var _0x302e77=_[_0x90f4('0x34')](_0x4100e7,function(_0x2b9172){_0x2b9172['userProfileId']=_0x6a5f4a['params']['id'];return _0x2b9172;});var _0xfb6934=[];return BPromise[_0x90f4('0x61')](_0x302e77,function(_0x277edb){return db[_0x90f4('0x5f')][_0x90f4('0x51')](_0x277edb,{'include':[{'model':db[_0x90f4('0x62')],'as':_0x90f4('0x5e')}],'raw':!![],'transaction':_0x3c3f7d})[_0x90f4('0x2d')](function(_0xff3ea5){_0xfb6934[_0x90f4('0x63')](_0xff3ea5[_0x90f4('0x54')]({'plain':!![]}));});})['then'](function(){return _0xfb6934;});});});}})[_0x90f4('0x2d')](function(_0x48d62c){return _0x48d62c;})['then'](respondWithResult(_0x9e95a7,null))[_0x90f4('0x4a')](handleError(_0x9e95a7,null));};exports[_0x90f4('0x64')]=function(_0x4af76f,_0x43abb7){var _0x130df7;return db[_0x90f4('0x35')]['find']({'where':{'id':_0x4af76f['params']['id']},'attributes':['id','name']})[_0x90f4('0x2d')](handleEntityNotFound(_0x43abb7,null))['then'](function(_0x31e21f){if(_0x31e21f){_0x130df7=_0x31e21f;return db[_0x90f4('0x5f')][_0x90f4('0x2e')]({'where':{'userProfileId':_0x4af76f[_0x90f4('0x4c')]['id'],'sectionId':_0x4af76f['query'][_0x90f4('0x65')]}});}})[_0x90f4('0x2d')](function(){return _0x130df7;})[_0x90f4('0x2d')](respondWithStatusCode(_0x43abb7,null))[_0x90f4('0x4a')](handleError(_0x43abb7,null));};exports[_0x90f4('0x66')]=function(_0x45f109,_0x5bfbc2){var _0x55e038=[];var _0x2f7079=[];return db[_0x90f4('0x5f')][_0x90f4('0x48')]({'where':{'userProfileId':_0x45f109[_0x90f4('0x4c')]['id']},'raw':!![]})[_0x90f4('0x2d')](function(_0x144227){_0x55e038=_[_0x90f4('0x44')](_0x144227,function(_0xf0039e){return _0xf0039e[_0x90f4('0x67')]===0x1||_[_0x90f4('0x68')]([0x3eb,0x709],_0xf0039e[_0x90f4('0x5c')]);});if(!_[_0x90f4('0x69')](_0x55e038)){return _[_0x90f4('0x34')](_0x55e038,function(_0x1b02d8){return _0x1b02d8[_0x90f4('0x5c')];});}else{return;}})[_0x90f4('0x2d')](function(_0x38bc82){if(_0x38bc82)_0x2f7079=_0x38bc82;if(_[_0x90f4('0x68')](_0x2f7079,0x64)){var _0xf94194=_[_0x90f4('0x50')](_0x55e038,{'sectionId':0x64});return hasDefaultDashboard(_0xf94194)[_0x90f4('0x2d')](function(_0x4b1fba){return _[_0x90f4('0x34')](_0x55e038,function(_0xa30437){if(_0xa30437[_0x90f4('0x5c')]===0x64){_0xa30437[_0x90f4('0x6a')]=_0x4b1fba;}return _0xa30437;});});}else{return;}})[_0x90f4('0x2d')](function(_0x11f04f){if(_0x11f04f)_0x55e038=_0x11f04f;if(_[_0x90f4('0x68')](_0x2f7079,0x3eb)){var _0x17464b=_[_0x90f4('0x50')](_0x55e038,{'sectionId':0x3eb});return getCustomDashboards(_0x17464b)['then'](function(_0xf4cbb4){return _[_0x90f4('0x34')](_0x55e038,function(_0x234ee9){if(_0x17464b[_0x90f4('0x67')]){if(_0x234ee9['sectionId']===0x3eb){_0x234ee9[_0x90f4('0x6a')]=_0xf4cbb4;}}else{if(_0x234ee9[_0x90f4('0x5c')]===0x64){if(!_0x234ee9[_0x90f4('0x6a')]){_0x234ee9[_0x90f4('0x6a')]=[];}_0x234ee9['subsections']=_0x234ee9[_0x90f4('0x6a')]['concat'](_0xf4cbb4);}}return _0x234ee9;});});}else{return;}})[_0x90f4('0x2d')](function(_0x3fffdb){if(_0x3fffdb)_0x55e038=_0x3fffdb;if(_[_0x90f4('0x68')](_0x2f7079,0x709)){var _0x15a66e=_['find'](_0x55e038,{'sectionId':0x709});return getPlugins(_0x15a66e)[_0x90f4('0x2d')](function(_0x243cfd){if(_0x15a66e['enabled']){return _[_0x90f4('0x34')](_0x55e038,function(_0x3c0586){if(_0x3c0586[_0x90f4('0x5c')]===0x709){_0x3c0586['subsections']=_0x243cfd;}return _0x3c0586;});}else{var _0x83ba49={'sectionId':0x76c,'enabled':0x1,'subsections':_0x243cfd};var _0x3940cf=_['map'](_0x55e038);_0x3940cf['push'](_0x83ba49);return _0x3940cf;}});}else{return;}})[_0x90f4('0x2d')](function(_0x24e0f9){if(_0x24e0f9)_0x55e038=_0x24e0f9;return _[_0x90f4('0x44')](_0x55e038,[_0x90f4('0x67'),0x1]);})['then'](respondWithResult(_0x5bfbc2,null))['catch'](handleError(_0x5bfbc2,null));};function hasDefaultDashboard(_0xf660ff){var _0x5848c1=[0x65];return new BPromise(function(_0x5ff7d1,_0x16212d){try{if(_0xf660ff[_0x90f4('0x5b')]){_0x5ff7d1(_0x5848c1);}else{return db[_0x90f4('0x62')][_0x90f4('0x6b')]({'where':{'sectionId':_0xf660ff['id']},'raw':!![]})[_0x90f4('0x2d')](function(_0x3dcbba){_0x3dcbba?_0x5ff7d1(_0x5848c1):_0x5ff7d1();});}}catch(_0xfbdfac){_0x16212d(_0xfbdfac);}});}function getCustomDashboards(_0x3832b0){var _0x959a21=[];return new BPromise(function(_0x43a35c,_0x2fa693){try{if(_0x3832b0['autoAssociation']){return db[_0x90f4('0x6c')]['findAll']({'raw':!![]})['then'](function(_0x16e672){_0x16e672['forEach'](function(_0x157936){_0x959a21[_0x90f4('0x63')](_0x157936['id']+0x1869f);});_0x43a35c(_0x959a21);});}else{return db[_0x90f4('0x62')][_0x90f4('0x48')]({'where':{'sectionId':_0x3832b0['id']},'raw':!![]})[_0x90f4('0x2d')](function(_0x2b29a1){_0x2b29a1[_0x90f4('0x6d')](function(_0x41d8e5){_0x959a21[_0x90f4('0x63')](_0x41d8e5['resourceId']+0x1869f);});_0x43a35c(_0x959a21);});}}catch(_0xa83e82){_0x2fa693(_0xa83e82);}});}function getPlugins(_0x3d5670){var _0xb7d1f9=[];return new BPromise(function(_0x4b1696,_0x368efa){try{if(_0x3d5670[_0x90f4('0x5b')]){return db[_0x90f4('0x6e')]['findAll']({'raw':!![]})[_0x90f4('0x2d')](function(_0x55dbfc){_0x55dbfc['forEach'](function(_0x848af1){_0xb7d1f9[_0x90f4('0x63')](_0x848af1['id']+0x15b38);});_0x4b1696(_0xb7d1f9);});}else{return db['UserProfileResource'][_0x90f4('0x48')]({'where':{'sectionId':_0x3d5670['id']},'raw':!![]})[_0x90f4('0x2d')](function(_0x32b89f){_0x32b89f['forEach'](function(_0x11948c){_0xb7d1f9[_0x90f4('0x63')](_0x11948c[_0x90f4('0x6f')]+0x15b38);});_0x4b1696(_0xb7d1f9);});}}catch(_0x44922d){_0x368efa(_0x44922d);}});}exports['addResources']=function(_0xfc3093,_0xb9d29e){return db[_0x90f4('0x35')][_0x90f4('0x50')]({'where':{'id':_0xfc3093[_0x90f4('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb9d29e,null))['then'](function(_0x48e448){if(_0x48e448){return db[_0x90f4('0x59')]['transaction'](function(_0x2db49a){return db['UserProfileSection'][_0x90f4('0x48')]({'where':{'userProfileId':_0xfc3093[_0x90f4('0x4c')]['id']},'attributes':['id'],'raw':!![]})[_0x90f4('0x2d')](function(_0x44e4c3){if(_0x44e4c3){return db[_0x90f4('0x5f')][_0x90f4('0x2e')]({'where':{'userProfileId':_0xfc3093[_0x90f4('0x4c')]['id'],'id':_['map'](_0x44e4c3,function(_0x580177){return _0x580177['id'];})},'transaction':_0x2db49a});}})[_0x90f4('0x2d')](function(_0x50b51f){var _0x5488df=_[_0x90f4('0x34')](_0xfc3093[_0x90f4('0x52')],function(_0xd55ff6){_0xd55ff6[_0x90f4('0x5d')]=_0xfc3093[_0x90f4('0x4c')]['id'];return _0xd55ff6;});return db[_0x90f4('0x5f')][_0x90f4('0x70')](_0x5488df,{'raw':!![],'transaction':_0x2db49a});})[_0x90f4('0x2d')](function(_0x43c15d){var _0x350976=_[_0x90f4('0x44')](_[_0x90f4('0x34')](_0x43c15d,function(_0x2e9a68){return _0x2e9a68[_0x90f4('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x350976){return db[_0x90f4('0x5f')][_0x90f4('0x48')]({'where':{'userProfileId':_0xfc3093[_0x90f4('0x4c')]['id'],'sectionId':_[_0x90f4('0x34')](_0x350976,function(_0x127dc1){return _0x127dc1['sectionId'];})},'attributes':['id',_0x90f4('0x5c')],'raw':!![]})[_0x90f4('0x2d')](function(_0x4ad6c9){var _0x33495b=_[_0x90f4('0x34')](_0xfc3093['body'],function(_0x4403d4){_0x4403d4[_0x90f4('0x5d')]=_0xfc3093[_0x90f4('0x4c')]['id'];return _0x4403d4;});return db[_0x90f4('0x62')][_0x90f4('0x70')](_0x33495b,{'raw':!![],'transaction':_0x2db49a});});}})[_0x90f4('0x4a')](handleError(_0xb9d29e,null));});}})[_0x90f4('0x2d')](function(_0x221c08){var _0x1b8148=_[_0x90f4('0x34')](_0x221c08,function(_0x1efb20){return _0x1efb20[_0x90f4('0x54')]({'plain':!![]});});})[_0x90f4('0x2d')](respondWithResult(_0xb9d29e,null))['catch'](handleError(_0xb9d29e,null));};exports[_0x90f4('0x71')]=function(_0x3ed6d8,_0x5c6a4b,_0x47e5a8){return db[_0x90f4('0x35')][_0x90f4('0x50')]({'where':{'id':_0x3ed6d8[_0x90f4('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5c6a4b,null))[_0x90f4('0x2d')](function(_0x565089){if(_0x565089){return _0x565089[_0x90f4('0x71')](_0x3ed6d8[_0x90f4('0x39')][_0x90f4('0x65')]);}})['then'](respondWithStatusCode(_0x5c6a4b,null))[_0x90f4('0x4a')](handleError(_0x5c6a4b,null));};exports['getResources']=function(_0x125791,_0x215254){var _0x3d1795={};if(!_0x125791[_0x90f4('0x39')][_0x90f4('0x72')])throw new Error(_0x90f4('0x73'));if(!_0x125791[_0x90f4('0x39')][_0x90f4('0x3f')]('nolimit')){_0x3d1795[_0x90f4('0x24')]=qs[_0x90f4('0x24')](_0x125791[_0x90f4('0x39')][_0x90f4('0x24')]);_0x3d1795[_0x90f4('0x23')]=qs['offset'](_0x125791[_0x90f4('0x39')]['offset']);}return db[_0x90f4('0x35')]['find']({'where':{'id':_0x125791[_0x90f4('0x4c')]['id']}})['then'](function(_0x596f97){if(!_0x596f97)throw new Error(_0x90f4('0x74')+_0x125791[_0x90f4('0x4c')]['id']);return db[_0x90f4('0x35')]['getResources'](_0x125791);})['then'](respondWithFilteredResult(_0x215254,_0x3d1795))[_0x90f4('0x4a')](handleError(_0x215254,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 2ab6f2e..657c109 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 _0xee2c=['update','emit','hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save'];(function(_0x5ee4b6,_0x1fb059){var _0x22f62f=function(_0x2ec02e){while(--_0x2ec02e){_0x5ee4b6['push'](_0x5ee4b6['shift']());}};_0x22f62f(++_0x1fb059);}(_0xee2c,0x1c7));var _0xcee2=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xee2c[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xcee2('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xcee2('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcee2('0x2')](0x0);var events={'afterCreate':_0xcee2('0x3'),'afterUpdate':_0xcee2('0x4'),'afterDestroy':'remove'};function emitEvent(_0x589e9d){return function(_0xc9b213,_0xb70cd1,_0x49d04d){UserProfileEvents[_0xcee2('0x5')](_0x589e9d+':'+_0xc9b213['id'],_0xc9b213);UserProfileEvents[_0xcee2('0x5')](_0x589e9d,_0xc9b213);_0x49d04d(null);};}for(var e in events){if(events[_0xcee2('0x6')](e)){var event=events[e];UserProfile[_0xcee2('0x7')](e,emitEvent(event));}}module[_0xcee2('0x8')]=UserProfileEvents; \ No newline at end of file +var _0x8a9a=['UserProfile','setMaxListeners','save','update','remove','emit','hook','../../mysqldb'];(function(_0xc922ed,_0x1e0aa5){var _0x5d3f8c=function(_0x466044){while(--_0x466044){_0xc922ed['push'](_0xc922ed['shift']());}};_0x5d3f8c(++_0x1e0aa5);}(_0x8a9a,0x17f));var _0xa8a9=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x8a9a[_0x209941];return _0x1e8729;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xa8a9('0x0'))['db'][_0xa8a9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa8a9('0x2')](0x0);var events={'afterCreate':_0xa8a9('0x3'),'afterUpdate':_0xa8a9('0x4'),'afterDestroy':_0xa8a9('0x5')};function emitEvent(_0x2d782d){return function(_0x9570dc,_0x3fcb8c,_0xe5e64b){UserProfileEvents[_0xa8a9('0x6')](_0x2d782d+':'+_0x9570dc['id'],_0x9570dc);UserProfileEvents[_0xa8a9('0x6')](_0x2d782d,_0x9570dc);_0xe5e64b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0xa8a9('0x7')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index e42261f..2d76faf 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 _0x33a2=['nolimit','limit','offset','sort','filters','pick','merge','key','VIRTUAL','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','exports','models','filter','field','value','then','associatedResources','catch','model','map','name','resolve','findAll','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','lists','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsaccounts','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','zendeskaccounts','ZendeskAccount','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','Variable','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','toUpperCase','slice','Sequelize','SELECT','select','ui.','InteractionId','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','find','params','all','union','ignore','autoAssociation','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x312a5c,_0x59990a){var _0x329f31=function(_0x52791c){while(--_0x52791c){_0x312a5c['push'](_0x312a5c['shift']());}};_0x329f31(++_0x59990a);}(_0x33a2,0x1be));var _0x233a=function(_0x1c869d,_0x34184b){_0x1c869d=_0x1c869d-0x0;var _0x4dc0ce=_0x33a2[_0x1c869d];return _0x4dc0ce;};'use strict';var _=require(_0x233a('0x0'));var attributes=require(_0x233a('0x1'));var squel=require(_0x233a('0x2'));module[_0x233a('0x3')]=function(_0x2f1e3b){var _0x140c3b=_0x2f1e3b[_0x233a('0x4')];function _0x708b9f(_0x551db5,_0x5c6d54){return new Promise(function(_0x808ffd,_0x357a3){if(!_0x5c6d54)return _0x808ffd(null);var _0x4e8ca6=_0x5c6d54[_0x233a('0x5')]?{[_0x5c6d54[_0x233a('0x5')][_0x233a('0x6')]]:_0x5c6d54[_0x233a('0x5')][_0x233a('0x7')]}:undefined;return _0x140c3b[_0x551db5]['findAll']({'where':_0x4e8ca6,'raw':!![]})[_0x233a('0x8')](function(_0x1d0e4c){_0x5c6d54[_0x233a('0x9')]=_['map'](_0x1d0e4c,'id');_0x808ffd(_0x5c6d54);})[_0x233a('0xa')](function(_0x1e6a52){_0x357a3(_0x1e6a52);});});}function _0x174fef(_0x47b455,_0x398280){return new Promise(function(_0x111664,_0x49955a){var _0x4cbc5d=_0x47b455[_0x233a('0x5')]?{[_0x47b455['filter'][_0x233a('0x6')]]:_0x47b455['filter'][_0x233a('0x7')]}:undefined;return _0x140c3b[_0x47b455[_0x233a('0xb')]]['findAll']({'where':_0x4cbc5d,'raw':!![]})[_0x233a('0x8')](function(_0x409276){_0x398280[_0x233a('0x9')]=_[_0x233a('0xc')](_0x409276,function(_0x212134){return _0x212134[_0x233a('0xd')];});_0x111664(_0x398280);})[_0x233a('0xa')](function(_0x3f26e1){_0x49955a(_0x3f26e1);});});}function _0x3387fc(_0x31b60b,_0xb03de5,_0x58cb0f){if(!_0xb03de5)return Promise[_0x233a('0xe')](null);return new Promise(function(_0x1585ed,_0x291452){return _0x140c3b['UserProfileResource'][_0x233a('0xf')]({'where':{'sectionId':_0xb03de5['id']},'raw':!![]})[_0x233a('0x8')](function(_0x2803bd){if(_0x31b60b[_0x233a('0x6')]&&_0x31b60b['field']!=='id'){_0xb03de5[_0x233a('0x9')]=_[_0x233a('0xc')](_0x2803bd,function(_0x546d26){return _0x546d26[_0x31b60b[_0x233a('0x6')]];});}else{if(_0x58cb0f===_0x233a('0x10')){_0xb03de5[_0x233a('0x9')]=_['map'](_0x2803bd,function(_0x45b294){return{'id':_0x45b294[_0x233a('0x11')],'type':_0x45b294[_0x233a('0x12')]};});}else{_0xb03de5[_0x233a('0x9')]=_[_0x233a('0xc')](_0x2803bd,function(_0x118fae){return _0x118fae[_0x233a('0x11')];});}}_0x1585ed(_0xb03de5);})[_0x233a('0xa')](function(_0x252afd){_0x291452(_0x252afd);});});}function _0x10480b(_0x5e1403,_0x3469c0){var _0xe5ae7a={'parentSections':[]};switch(_0x5e1403[_0x233a('0x13')]()){case _0x233a('0x14'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x16');break;case _0x233a('0x17'):_0xe5ae7a[_0x233a('0x15')]='SquareOdbc';break;case _0x233a('0x18'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x19');_0xe5ae7a[_0x233a('0x1a')]=[{'name':'SquareProjects','field':_0x233a('0xd'),'foreignKey':'projectName'}];break;case _0x233a('0x1b'):_0xe5ae7a['childModel']=_0x233a('0x1c');break;case _0x233a('0x1d'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x1e');_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0x233a('0x20'):_0xe5ae7a[_0x233a('0x15')]='CmList';break;case _0x233a('0x21'):_0xe5ae7a[_0x233a('0x15')]='CmCompany';break;case _0x233a('0x22'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x23');break;case _0x233a('0x24'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x25');break;case _0x233a('0x26'):_0xe5ae7a['childModel']=_0x233a('0x27');break;case _0x233a('0x28'):_0xe5ae7a[_0x233a('0x15')]='FaxQueue';break;case _0x233a('0x29'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x2a');break;case _0x233a('0x2b'):case _0x233a('0x2c'):case _0x233a('0x2d'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x2e');break;case _0x233a('0x2f'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x30');break;case'voicemails':_0xe5ae7a['childModel']=_0x233a('0x31');break;case'voicerecordings':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x32');_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x33'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x34'),'model':_0x233a('0x35'),'filter':{'field':_0x233a('0x36'),'value':[_0x233a('0x37')]}},{'name':_0x233a('0x38'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x34'),'model':_0x233a('0x35'),'filter':{'field':_0x233a('0x36'),'value':['telephone']}},{'name':_0x233a('0x39'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x3a'),'model':_0x233a('0x3b'),'filter':{'field':'type','value':[_0x233a('0x3c')]}},{'name':_0x233a('0x3d'),'field':_0x233a('0xd'),'foreignKey':_0x233a('0x3a'),'model':'VoiceQueue','filter':{'field':_0x233a('0x12'),'value':[_0x233a('0x3e')]}}];break;case _0x233a('0x3f'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x40');break;case _0x233a('0x41'):_0xe5ae7a['childModel']=_0x233a('0x42');break;case _0x233a('0x43'):_0xe5ae7a[_0x233a('0x15')]='VoicePrefix';break;case'ivrcampaigns':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x44');break;case _0x233a('0x45'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x46');break;case _0x233a('0x47'):_0xe5ae7a['childModel']=_0x233a('0x48');break;case _0x233a('0x49'):_0xe5ae7a[_0x233a('0x15')]='MailSubstatus';break;case _0x233a('0x4a'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x4b');break;case _0x233a('0x4c'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x4d');break;case'smsqueues':_0xe5ae7a[_0x233a('0x15')]='SmsQueue';break;case _0x233a('0x4e'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x4f');break;case'whatsappqueues':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x50');break;case _0x233a('0x51'):_0xe5ae7a['childModel']=_0x233a('0x52');break;case _0x233a('0x53'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x54');break;case _0x233a('0x55'):case _0x233a('0x56'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x3b');if(_0x3469c0){_0xe5ae7a['parentSections']=[{'name':_0x233a('0x39')},{'name':'QueueCampaigns'}];}break;case _0x233a('0x57'):case _0x233a('0x58'):case _0x233a('0x59'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x35');if(_0x3469c0){_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x5a'),'filter':{'field':'role','value':['admin','user']},'ignore':!![]},{'name':'Agents'},{'name':_0x233a('0x38')}];}break;case _0x233a('0x5b'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x5c');break;case'salesforceaccounts':_0xe5ae7a['childModel']=_0x233a('0x5d');break;case _0x233a('0x5e'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x5f');break;case _0x233a('0x60'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x61');break;case _0x233a('0x62'):_0xe5ae7a['childModel']='DeskAccount';break;case _0x233a('0x63'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x64');break;case _0x233a('0x65'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x35');break;case _0x233a('0x66'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x67');break;case _0x233a('0x68'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x69');break;case _0x233a('0x6a'):_0xe5ae7a['childModel']=_0x233a('0x6b');break;case _0x233a('0x6c'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x6d');break;case _0x233a('0x6e'):_0xe5ae7a['childModel']=_0x233a('0x6f');break;case'scheduler':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x70');break;case _0x233a('0x71'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x72');break;case _0x233a('0x73'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x74');break;case _0x233a('0x75'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x76');break;case _0x233a('0x77'):_0xe5ae7a['childModel']=_0x233a('0x78');break;case _0x233a('0x79'):_0xe5ae7a[_0x233a('0x15')]='Trunk';break;case'variables':_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x7a');break;case'plugins':_0xe5ae7a['childModel']=_0x233a('0x7b');break;case _0x233a('0x7c'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x10');_0xe5ae7a[_0x233a('0x1a')]=[{'name':_0x233a('0x7d'),'field':'id','foreignKey':_0x233a('0x7e')}];break;case _0x233a('0x7f'):_0xe5ae7a[_0x233a('0x15')]=_0x233a('0x80');break;}return _0xe5ae7a;}function _0x56dbfa(_0x5d1cf6,_0x5c933e){var _0x13417c=_0x5d1cf6['charAt'](0x0)[_0x233a('0x81')]()+_0x5d1cf6[_0x233a('0x82')](0x1);var _0x996b5c={'type':_0x140c3b[_0x233a('0x83')]['QueryTypes'][_0x233a('0x84')],'raw':!![]};return new Promise(function(_0x63677f,_0x13ea5d){var _0x4b773a=squel[_0x233a('0x85')]()['field'](_0x233a('0x86')+_0x13417c+_0x233a('0x87'),'id')['field']('ui.createdAt')[_0x233a('0x88')]('user_has_'+_0x5d1cf6+_0x233a('0x89'),'ui')[_0x233a('0x8a')](_0x233a('0x8b'),_0x5c933e['id']);return _0x140c3b[_0x233a('0x8c')]['query'](_0x4b773a[_0x233a('0x8d')](),_0x996b5c)[_0x233a('0x8')](function(_0x5322d8){_0x5c933e[_0x13417c+_0x233a('0x8e')]=_0x5322d8;_0x63677f(_0x5322d8);})[_0x233a('0xa')](function(_0x878853){_0x13ea5d(_0x878853);});});}return _0x2f1e3b[_0x233a('0x8f')](_0x233a('0x90'),attributes,{'tableName':_0x233a('0x91'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1e303d){var _0x3acdcf=require(_0x233a('0x92'));var _0x262b27={'raw':_0x1e303d[_0x233a('0x93')][_0x233a('0x94')],'where':{}};var _0x541bf2={};var _0x2d6810={'count':0x0,'rows':[]};var _0x494af4=_0x1e303d[_0x233a('0x93')][_0x233a('0x95')];var _0x4c6b48=_0x1e303d[_0x233a('0x93')][_0x233a('0x96')]||![];var _0x1ebcd6=_0x10480b(_0x494af4,_0x4c6b48);if(!_0x1ebcd6[_0x233a('0x15')])throw new Error('Invalid\x20section\x20\x27'+_0x494af4+'\x27');var _0x25b17e=[{'name':_0x494af4}];if(!_[_0x233a('0x97')](_0x1ebcd6[_0x233a('0x1a')]))_0x25b17e=_0x1ebcd6[_0x233a('0x1a')];var _0x31a6d0=[];for(var _0x48db0f=0x0;_0x48db0f<_0x25b17e[_0x233a('0x98')];_0x48db0f++){_0x31a6d0[_0x233a('0x99')](_0x140c3b[_0x233a('0x9a')][_0x233a('0x9b')]({'where':{'userProfileId':_0x1e303d[_0x233a('0x9c')]['id'],'name':_0x25b17e[_0x48db0f][_0x233a('0xd')]},'raw':!![]}));}return Promise[_0x233a('0x9d')](_0x31a6d0)[_0x233a('0x8')](function(_0x3942b6){var _0x21da9d=_['filter'](_0x3942b6,function(_0x51a733){return _0x51a733?_0x51a733:undefined;});var _0x529bc1=_[_0x233a('0x5')](_0x25b17e,['ignore',!![]]);var _0x1e1f18=_[_0x233a('0x97')](_0x21da9d)&&_[_0x233a('0x97')](_0x529bc1)?null:_[_0x233a('0x9e')](_0x529bc1,_0x21da9d);if(!_0x1e1f18)return null;var _0x3d42ab=[];for(var _0x40db4a=0x0;_0x40db4a<_0x1e1f18[_0x233a('0x98')];_0x40db4a++){var _0x4e43c2=_[_0x233a('0x9b')](_0x25b17e,function(_0x404d8e){return _0x1e1f18[_0x40db4a]?_0x404d8e[_0x233a('0xd')]===_0x1e1f18[_0x40db4a][_0x233a('0xd')]:null;});if(_0x4e43c2){if(_0x1e1f18[_0x40db4a][_0x233a('0x9f')]){_0x3d42ab[_0x233a('0x99')](_0x708b9f(_0x1ebcd6[_0x233a('0x15')],_0x1e1f18[_0x40db4a]));}else{if(!_0x1e1f18[_0x40db4a][_0x233a('0xa0')]){_0x3d42ab['push'](_0x3387fc(_0x4e43c2,_0x1e1f18[_0x40db4a],_0x1ebcd6[_0x233a('0x15')]));}else{if(_0x4e43c2[_0x233a('0xb')]){_0x3d42ab[_0x233a('0x99')](_0x174fef(_0x4e43c2,_0x1e1f18[_0x40db4a]));}}}}}return Promise['all'](_0x3d42ab);})[_0x233a('0x8')](function(_0x122b99){var _0x23d6fb=_0x122b99;var _0x41abdb=null;if(_0x23d6fb){_0x41abdb=_0x23d6fb[_0x233a('0x98')]===0x1?_0x23d6fb[0x0]:null;}if(!_0x41abdb&&!_0x23d6fb)return _0x2d6810;var _0x28cd76=_0x140c3b[_0x1ebcd6[_0x233a('0x15')]]['rawAttributes'];_0x541bf2[_0x233a('0xb')]=_[_0x233a('0xa1')](_0x28cd76);_0x541bf2[_0x233a('0x93')]=_['keys'](_0x1e303d[_0x233a('0x93')]);_0x541bf2['filters']=_[_0x233a('0xa2')](_0x541bf2[_0x233a('0xb')],_0x541bf2[_0x233a('0x93')]);_0x262b27[_0x233a('0xa3')]=_['intersection'](_0x541bf2[_0x233a('0xb')],_0x3acdcf[_0x233a('0xa4')](_0x1e303d[_0x233a('0x93')]['fields']));_0x262b27[_0x233a('0xa3')]=_0x262b27[_0x233a('0xa3')][_0x233a('0x98')]?_0x262b27[_0x233a('0xa3')]:_0x541bf2[_0x233a('0xb')];if(!_0x1e303d[_0x233a('0x93')][_0x233a('0xa5')](_0x233a('0xa6'))){_0x262b27['limit']=_0x3acdcf[_0x233a('0xa7')](_0x1e303d['query'][_0x233a('0xa7')]);_0x262b27[_0x233a('0xa8')]=_0x3acdcf[_0x233a('0xa8')](_0x1e303d[_0x233a('0x93')][_0x233a('0xa8')]);}_0x262b27['order']=_0x3acdcf[_0x233a('0xa9')](_0x1e303d[_0x233a('0x93')][_0x233a('0xa9')]);_0x262b27[_0x233a('0x8a')]=_0x3acdcf[_0x233a('0xaa')](_[_0x233a('0xab')](_0x1e303d[_0x233a('0x93')],_0x541bf2[_0x233a('0xaa')]));if(_0x1e303d['query'][_0x233a('0x5')]){_0x262b27['where']=_[_0x233a('0xac')](_0x262b27[_0x233a('0x8a')],{'$or':_[_0x233a('0xc')](_0x28cd76,function(_0x329266){if(_0x329266[_0x233a('0x12')][_0x233a('0xad')]!==_0x233a('0xae')){var _0x65c67e={};_0x65c67e[_0x329266[_0x233a('0x6')]]={'$like':'%'+_0x1e303d[_0x233a('0x93')][_0x233a('0x5')]+'%'};return _0x65c67e;}})});}var _0x5c53dd=[];var _0x177a64=null;var _0x2d53fa={};if(_0x41abdb){_0x177a64=_[_0x233a('0x9b')](_0x25b17e,['name',_0x41abdb[_0x233a('0xd')]]);if(_0x177a64[_0x233a('0x6')]){_0x2d53fa={};if(_0x1ebcd6['childModel']===_0x233a('0x10')){_0x2d53fa[_0x177a64['foreignKey']]=_[_0x233a('0xc')](_0x41abdb[_0x233a('0x9')],'id');}else{_0x2d53fa[_0x177a64['foreignKey']]=_0x41abdb[_0x233a('0x9')];}_0x5c53dd[_0x233a('0x99')](_0x2d53fa);}else{_0x262b27[_0x233a('0x8a')]['id']=_0x41abdb['associatedResources'];}}else{for(var _0x317430=0x0;_0x317430<_0x23d6fb[_0x233a('0x98')];_0x317430++){_0x177a64=_[_0x233a('0x9b')](_0x25b17e,[_0x233a('0xd'),_0x23d6fb[_0x317430][_0x233a('0xd')]]);if(_0x177a64[_0x233a('0x6')]){_0x2d53fa={};_0x2d53fa[_0x177a64[_0x233a('0xaf')]]=_0x23d6fb[_0x317430][_0x233a('0x9')];_0x5c53dd['push'](_0x2d53fa);}else{if(!_0x262b27[_0x233a('0x8a')]['id'])_0x262b27[_0x233a('0x8a')]['id']=[];_0x23d6fb[_0x317430][_0x233a('0x9')][_0x233a('0xb0')](function(_0x2609be){_0x262b27['where']['id'][_0x233a('0x99')](_0x2609be);});}}}if(!_['isEmpty'](_0x5c53dd)){_0x262b27[_0x233a('0x8a')]=_['merge'](_0x262b27['where'],{'$and':{'$or':_0x5c53dd}});}_0x262b27=_['merge']({},_0x262b27,_0x1e303d[_0x233a('0xb1')]);if(_0x41abdb&&!_0x41abdb['autoAssociation']&&_0x1ebcd6[_0x233a('0x15')]===_0x233a('0x10')){if(_0x1e303d[_0x233a('0x93')][_0x233a('0xb2')]){_0x262b27[_0x233a('0xb3')]=[{'all':!![]}];}return _0x140c3b[_0x1ebcd6[_0x233a('0x15')]]['findAll'](_0x262b27)[_0x233a('0x8')](function(_0x217d74){var _0x427568=[];_0x217d74[_0x233a('0xb0')](function(_0x3e63d9){var _0x4bf503;switch(_0x3e63d9[_0x233a('0xb4')]){case _0x233a('0xb5'):_0x4bf503=_[_0x233a('0x9b')](_0x41abdb[_0x233a('0x9')],function(_0x2be2f7){return _0x2be2f7['id']===_0x3e63d9[_0x233a('0x7e')]&&_0x2be2f7[_0x233a('0x12')]===_0x233a('0xb6');});break;case _0x233a('0xb7'):_0x4bf503=_[_0x233a('0x9b')](_0x41abdb[_0x233a('0x9')],function(_0x300787){return _0x300787['id']===_0x3e63d9[_0x233a('0x7e')]&&_0x300787['type']===_0x233a('0xb8');});break;}if(_0x4bf503)_0x427568[_0x233a('0x99')](_0x3e63d9);});_0x2d6810[_0x233a('0xb9')]=_0x427568['length'];_0x2d6810[_0x233a('0xba')]=_0x427568;return _0x2d6810;});}else{if(!_[_0x233a('0x97')](_0x1e303d[_0x233a('0x93')][_0x233a('0xbb')])){_0x262b27[_0x233a('0x8a')]['id']=_0x262b27[_0x233a('0x8a')]['id']?_[_0x233a('0xa2')](_0x262b27['where']['id'],_0x1e303d[_0x233a('0x93')][_0x233a('0xbb')]):_0x1e303d[_0x233a('0x93')][_0x233a('0xbb')];if(_0x1e303d[_0x233a('0x93')][_0x233a('0xbc')]){_0x262b27[_0x233a('0xbd')]=_0x1e303d[_0x233a('0x93')][_0x233a('0xbc')];}}if(_0x1e303d[_0x233a('0x93')][_0x233a('0xbe')]){_0x262b27[_0x233a('0x8a')]=_[_0x233a('0xac')](_0x262b27['where'],{'$and':_0x1e303d[_0x233a('0x93')][_0x233a('0xbe')]});}return _0x140c3b[_0x1ebcd6['childModel']][_0x233a('0xb9')]({'where':_0x262b27['where']})[_0x233a('0x8')](function(_0x298d30){_0x2d6810[_0x233a('0xb9')]=_0x298d30;if(_0x1e303d[_0x233a('0x93')][_0x233a('0xb2')]){if(_0x1ebcd6['childModel']===_0x233a('0x1e')){_0x262b27[_0x233a('0xb3')]=[{'model':_0x140c3b['Tag'],'as':_0x233a('0xbf'),'attributes':['id',_0x233a('0xd'),_0x233a('0xc0')],'required':_0x1e303d['query'][_0x233a('0xc1')]?!![]:![]},{'model':_0x140c3b[_0x233a('0x74')],'as':_0x233a('0xc2'),'attributes':['id',_0x233a('0xd'),_0x233a('0xc0')],'through':_0x1e303d[_0x233a('0x93')][_0x233a('0xc1')]?{'attributes':[],'where':{'TagId':_0x1e303d[_0x233a('0x93')][_0x233a('0xc1')]||undefined}}:{},'required':_0x1e303d['query'][_0x233a('0xc1')]?!![]:![]}];}else{_0x262b27[_0x233a('0xb3')]=[{'all':!![]}];}}return _0x140c3b[_0x1ebcd6[_0x233a('0x15')]][_0x233a('0xf')](_0x262b27);})[_0x233a('0x8')](function(_0x27949f){_0x2d6810[_0x233a('0xba')]=_0x27949f;if(_0x494af4===_0x233a('0x33')&&_0x1e303d[_0x233a('0x93')][_0x233a('0xc3')]===_0x233a('0xc4')){var _0x4d56c8=[];for(var _0x3c75b6=0x0;_0x3c75b6<_0x2d6810[_0x233a('0xba')][_0x233a('0x98')];_0x3c75b6++){_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc5'),_0x2d6810['rows'][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc7'),_0x2d6810['rows'][_0x3c75b6]['dataValues']));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc8'),_0x2d6810[_0x233a('0xba')][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xc9'),_0x2d6810[_0x233a('0xba')][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xca'),_0x2d6810[_0x233a('0xba')][_0x3c75b6][_0x233a('0xc6')]));_0x4d56c8[_0x233a('0x99')](_0x56dbfa(_0x233a('0xcb'),_0x2d6810['rows'][_0x3c75b6][_0x233a('0xc6')]));}return Promise[_0x233a('0x9d')](_0x4d56c8)[_0x233a('0x8')](function(){return _0x2d6810;});}return _0x2d6810;});}});}}});}; \ No newline at end of file +var _0x5148=['mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','users','telephones','Users','role','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','intervals','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','OpenTabs','UserProfile','user_profiles','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','params','all','union','find','ignore','autoAssociation','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','merge','options','include','forEach','reportType','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','CmContact','Tags','color','tag','ThroughTags','openTabs','true','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','squel','exports','field','filter','then','associatedResources','map','catch','value','model','findAll','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','projects','contacts','ListId','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','faxqueues','FaxQueue','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','agent','Telephones','membername','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','type','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign'];(function(_0x293b54,_0x46ad26){var _0x570ebc=function(_0x4681e2){while(--_0x4681e2){_0x293b54['push'](_0x293b54['shift']());}};_0x570ebc(++_0x46ad26);}(_0x5148,0x89));var _0x8514=function(_0x44f9c0,_0x391085){_0x44f9c0=_0x44f9c0-0x0;var _0x241aa7=_0x5148[_0x44f9c0];return _0x241aa7;};'use strict';var _=require(_0x8514('0x0'));var attributes=require(_0x8514('0x1'));var squel=require(_0x8514('0x2'));module[_0x8514('0x3')]=function(_0x1639d2){var _0x347983=_0x1639d2['models'];function _0x275882(_0x3a5fab,_0x1741a7){return new Promise(function(_0x5b7289,_0x52c3f2){if(!_0x1741a7)return _0x5b7289(null);var _0x1ec336=_0x1741a7['filter']?{[_0x1741a7['filter'][_0x8514('0x4')]]:_0x1741a7[_0x8514('0x5')]['value']}:undefined;return _0x347983[_0x3a5fab]['findAll']({'where':_0x1ec336,'raw':!![]})[_0x8514('0x6')](function(_0x435f5a){_0x1741a7[_0x8514('0x7')]=_[_0x8514('0x8')](_0x435f5a,'id');_0x5b7289(_0x1741a7);})[_0x8514('0x9')](function(_0x307444){_0x52c3f2(_0x307444);});});}function _0x41536d(_0x5e05c5,_0x3b9327){return new Promise(function(_0x5c946f,_0x67705f){var _0x40fd73=_0x5e05c5[_0x8514('0x5')]?{[_0x5e05c5['filter'][_0x8514('0x4')]]:_0x5e05c5[_0x8514('0x5')][_0x8514('0xa')]}:undefined;return _0x347983[_0x5e05c5[_0x8514('0xb')]][_0x8514('0xc')]({'where':_0x40fd73,'raw':!![]})[_0x8514('0x6')](function(_0xb95a29){_0x3b9327[_0x8514('0x7')]=_[_0x8514('0x8')](_0xb95a29,function(_0x403ab0){return _0x403ab0[_0x8514('0xd')];});_0x5c946f(_0x3b9327);})[_0x8514('0x9')](function(_0x4b8845){_0x67705f(_0x4b8845);});});}function _0x482ade(_0x24bb16,_0x3d13d7,_0x5d9631){if(!_0x3d13d7)return Promise[_0x8514('0xe')](null);return new Promise(function(_0x198915,_0x35150e){return _0x347983[_0x8514('0xf')][_0x8514('0xc')]({'where':{'sectionId':_0x3d13d7['id']},'raw':!![]})[_0x8514('0x6')](function(_0x2cee69){if(_0x24bb16[_0x8514('0x4')]&&_0x24bb16[_0x8514('0x4')]!=='id'){_0x3d13d7[_0x8514('0x7')]=_[_0x8514('0x8')](_0x2cee69,function(_0x206169){return _0x206169[_0x24bb16[_0x8514('0x4')]];});}else{if(_0x5d9631===_0x8514('0x10')){_0x3d13d7[_0x8514('0x7')]=_[_0x8514('0x8')](_0x2cee69,function(_0x3c52fb){return{'id':_0x3c52fb[_0x8514('0x11')],'type':_0x3c52fb['type']};});}else{_0x3d13d7[_0x8514('0x7')]=_['map'](_0x2cee69,function(_0x531a70){return _0x531a70[_0x8514('0x11')];});}}_0x198915(_0x3d13d7);})[_0x8514('0x9')](function(_0x4ccdc3){_0x35150e(_0x4ccdc3);});});}function _0x27fe23(_0x305d2f,_0x59eb2e){var _0x46c625={'parentSections':[]};switch(_0x305d2f[_0x8514('0x12')]()){case _0x8514('0x13'):_0x46c625[_0x8514('0x14')]=_0x8514('0x15');break;case _0x8514('0x16'):_0x46c625[_0x8514('0x14')]='SquareOdbc';break;case _0x8514('0x17'):_0x46c625[_0x8514('0x14')]=_0x8514('0x18');_0x46c625[_0x8514('0x19')]=[{'name':_0x8514('0x1a'),'field':_0x8514('0xd'),'foreignKey':_0x8514('0x1b')}];break;case _0x8514('0x1c'):_0x46c625[_0x8514('0x14')]='JscriptyProject';break;case _0x8514('0x1d'):_0x46c625['childModel']='CmContact';_0x46c625[_0x8514('0x19')]=[{'name':'Lists','field':'id','foreignKey':_0x8514('0x1e')}];break;case _0x8514('0x1f'):_0x46c625['childModel']=_0x8514('0x20');break;case _0x8514('0x21'):_0x46c625[_0x8514('0x14')]=_0x8514('0x22');break;case _0x8514('0x23'):_0x46c625[_0x8514('0x14')]=_0x8514('0x24');break;case _0x8514('0x25'):_0x46c625[_0x8514('0x14')]=_0x8514('0x26');break;case'chatwebsites':_0x46c625['childModel']='ChatWebsite';break;case _0x8514('0x27'):_0x46c625[_0x8514('0x14')]=_0x8514('0x28');break;case'faxaccounts':_0x46c625[_0x8514('0x14')]='FaxAccount';break;case _0x8514('0x29'):case _0x8514('0x2a'):case _0x8514('0x2b'):_0x46c625[_0x8514('0x14')]='VoiceExtension';break;case _0x8514('0x2c'):_0x46c625['childModel']=_0x8514('0x2d');break;case _0x8514('0x2e'):_0x46c625['childModel']=_0x8514('0x2f');break;case _0x8514('0x30'):_0x46c625['childModel']=_0x8514('0x31');_0x46c625[_0x8514('0x19')]=[{'name':_0x8514('0x32'),'field':_0x8514('0xd'),'foreignKey':'membername','model':_0x8514('0x33'),'filter':{'field':'role','value':[_0x8514('0x34')]}},{'name':_0x8514('0x35'),'field':'name','foreignKey':_0x8514('0x36'),'model':_0x8514('0x33'),'filter':{'field':'role','value':[_0x8514('0x37')]}},{'name':_0x8514('0x38'),'field':_0x8514('0xd'),'foreignKey':_0x8514('0x39'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x8514('0x3a')]}},{'name':_0x8514('0x3b'),'field':_0x8514('0xd'),'foreignKey':_0x8514('0x39'),'model':_0x8514('0x3c'),'filter':{'field':_0x8514('0x3d'),'value':[_0x8514('0x3e')]}}];break;case _0x8514('0x3f'):_0x46c625[_0x8514('0x14')]=_0x8514('0x40');break;case _0x8514('0x41'):_0x46c625['childModel']=_0x8514('0x42');break;case _0x8514('0x43'):_0x46c625[_0x8514('0x14')]=_0x8514('0x44');break;case'ivrcampaigns':_0x46c625[_0x8514('0x14')]=_0x8514('0x45');break;case _0x8514('0x46'):_0x46c625[_0x8514('0x14')]=_0x8514('0x47');break;case _0x8514('0x48'):_0x46c625[_0x8514('0x14')]=_0x8514('0x49');break;case _0x8514('0x4a'):_0x46c625[_0x8514('0x14')]=_0x8514('0x4b');break;case _0x8514('0x4c'):_0x46c625[_0x8514('0x14')]='OpenchannelQueue';break;case _0x8514('0x4d'):_0x46c625[_0x8514('0x14')]=_0x8514('0x4e');break;case _0x8514('0x4f'):_0x46c625[_0x8514('0x14')]='SmsQueue';break;case _0x8514('0x50'):_0x46c625[_0x8514('0x14')]=_0x8514('0x51');break;case _0x8514('0x52'):_0x46c625[_0x8514('0x14')]=_0x8514('0x53');break;case'whatsappaccounts':_0x46c625[_0x8514('0x14')]=_0x8514('0x54');break;case _0x8514('0x55'):_0x46c625['childModel']=_0x8514('0x56');break;case'voicequeues':case _0x8514('0x57'):_0x46c625['childModel']=_0x8514('0x3c');if(_0x59eb2e){_0x46c625['parentSections']=[{'name':_0x8514('0x38')},{'name':_0x8514('0x3b')}];}break;case _0x8514('0x58'):case'agents':case _0x8514('0x59'):_0x46c625[_0x8514('0x14')]=_0x8514('0x33');if(_0x59eb2e){_0x46c625[_0x8514('0x19')]=[{'name':_0x8514('0x5a'),'filter':{'field':_0x8514('0x5b'),'value':['admin',_0x8514('0x5c')]},'ignore':!![]},{'name':_0x8514('0x32')},{'name':_0x8514('0x35')}];}break;case _0x8514('0x5d'):_0x46c625[_0x8514('0x14')]=_0x8514('0x5e');break;case _0x8514('0x5f'):_0x46c625[_0x8514('0x14')]=_0x8514('0x60');break;case _0x8514('0x61'):_0x46c625[_0x8514('0x14')]=_0x8514('0x62');break;case _0x8514('0x63'):_0x46c625['childModel']=_0x8514('0x64');break;case _0x8514('0x65'):_0x46c625[_0x8514('0x14')]=_0x8514('0x66');break;case _0x8514('0x67'):_0x46c625[_0x8514('0x14')]=_0x8514('0x68');break;case _0x8514('0x69'):_0x46c625[_0x8514('0x14')]=_0x8514('0x33');break;case _0x8514('0x6a'):_0x46c625[_0x8514('0x14')]=_0x8514('0x6b');break;case'dispositions':_0x46c625[_0x8514('0x14')]=_0x8514('0x6c');break;case'customdashboards':_0x46c625['childModel']=_0x8514('0x6d');break;case _0x8514('0x6e'):_0x46c625[_0x8514('0x14')]=_0x8514('0x6f');break;case _0x8514('0x70'):_0x46c625[_0x8514('0x14')]=_0x8514('0x71');break;case _0x8514('0x72'):_0x46c625[_0x8514('0x14')]=_0x8514('0x73');break;case _0x8514('0x74'):_0x46c625[_0x8514('0x14')]=_0x8514('0x75');break;case _0x8514('0x76'):_0x46c625[_0x8514('0x14')]=_0x8514('0x77');break;case'templates':_0x46c625[_0x8514('0x14')]=_0x8514('0x78');break;case _0x8514('0x79'):_0x46c625[_0x8514('0x14')]=_0x8514('0x7a');break;case _0x8514('0x7b'):_0x46c625[_0x8514('0x14')]=_0x8514('0x7c');break;case _0x8514('0x7d'):_0x46c625[_0x8514('0x14')]=_0x8514('0x7e');break;case _0x8514('0x7f'):_0x46c625['childModel']='Plugin';break;case _0x8514('0x80'):_0x46c625['childModel']=_0x8514('0x10');_0x46c625[_0x8514('0x19')]=[{'name':_0x8514('0x81'),'field':'id','foreignKey':_0x8514('0x82')}];break;case _0x8514('0x83'):_0x46c625[_0x8514('0x14')]=_0x8514('0x84');break;}return _0x46c625;}function _0x2783cc(_0xcfe03a,_0x34c18d){var _0xb51f34=_0xcfe03a[_0x8514('0x85')](0x0)['toUpperCase']()+_0xcfe03a[_0x8514('0x86')](0x1);var _0x3c8669={'type':_0x347983[_0x8514('0x87')][_0x8514('0x88')][_0x8514('0x89')],'raw':!![]};return new Promise(function(_0x1391b8,_0x3d7c4f){var _0x288e16=squel['select']()[_0x8514('0x4')](_0x8514('0x8a')+_0xb51f34+_0x8514('0x8b'),'id')['field'](_0x8514('0x8c'))[_0x8514('0x8d')](_0x8514('0x8e')+_0xcfe03a+_0x8514('0x8f'),'ui')[_0x8514('0x90')]('ui.UserId\x20=\x20?',_0x34c18d['id']);return _0x347983[_0x8514('0x91')][_0x8514('0x92')](_0x288e16[_0x8514('0x93')](),_0x3c8669)[_0x8514('0x6')](function(_0x4f666f){_0x34c18d[_0xb51f34+_0x8514('0x94')]=_0x4f666f;_0x1391b8(_0x4f666f);})[_0x8514('0x9')](function(_0x187768){_0x3d7c4f(_0x187768);});});}return _0x1639d2['define'](_0x8514('0x95'),attributes,{'tableName':_0x8514('0x96'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x32c8a9){var _0x3e7f69=require(_0x8514('0x97'));var _0x41ab0d={'raw':_0x32c8a9[_0x8514('0x92')]['raw'],'where':{}};var _0x32ca55={};var _0x4f52e9={'count':0x0,'rows':[]};var _0x4e33e3=_0x32c8a9[_0x8514('0x92')][_0x8514('0x98')];var _0x32c4fc=_0x32c8a9[_0x8514('0x92')][_0x8514('0x99')]||![];var _0x5c6561=_0x27fe23(_0x4e33e3,_0x32c4fc);if(!_0x5c6561[_0x8514('0x14')])throw new Error(_0x8514('0x9a')+_0x4e33e3+'\x27');var _0x118c2e=[{'name':_0x4e33e3}];if(!_[_0x8514('0x9b')](_0x5c6561[_0x8514('0x19')]))_0x118c2e=_0x5c6561[_0x8514('0x19')];var _0x218917=[];for(var _0x142d83=0x0;_0x142d83<_0x118c2e[_0x8514('0x9c')];_0x142d83++){_0x218917[_0x8514('0x9d')](_0x347983[_0x8514('0x9e')]['find']({'where':{'userProfileId':_0x32c8a9[_0x8514('0x9f')]['id'],'name':_0x118c2e[_0x142d83][_0x8514('0xd')]},'raw':!![]}));}return Promise[_0x8514('0xa0')](_0x218917)[_0x8514('0x6')](function(_0x36c595){var _0x583371=_['filter'](_0x36c595,function(_0x52e00b){return _0x52e00b?_0x52e00b:undefined;});var _0x346e8b=_[_0x8514('0x5')](_0x118c2e,['ignore',!![]]);var _0x1e3f0a=_['isEmpty'](_0x583371)&&_[_0x8514('0x9b')](_0x346e8b)?null:_[_0x8514('0xa1')](_0x346e8b,_0x583371);if(!_0x1e3f0a)return null;var _0x42fd02=[];for(var _0x103f67=0x0;_0x103f67<_0x1e3f0a[_0x8514('0x9c')];_0x103f67++){var _0x358798=_[_0x8514('0xa2')](_0x118c2e,function(_0x461e9f){return _0x1e3f0a[_0x103f67]?_0x461e9f[_0x8514('0xd')]===_0x1e3f0a[_0x103f67]['name']:null;});if(_0x358798){if(_0x1e3f0a[_0x103f67][_0x8514('0xa3')]){_0x42fd02[_0x8514('0x9d')](_0x275882(_0x5c6561[_0x8514('0x14')],_0x1e3f0a[_0x103f67]));}else{if(!_0x1e3f0a[_0x103f67][_0x8514('0xa4')]){_0x42fd02[_0x8514('0x9d')](_0x482ade(_0x358798,_0x1e3f0a[_0x103f67],_0x5c6561[_0x8514('0x14')]));}else{if(_0x358798[_0x8514('0xb')]){_0x42fd02[_0x8514('0x9d')](_0x41536d(_0x358798,_0x1e3f0a[_0x103f67]));}}}}}return Promise['all'](_0x42fd02);})[_0x8514('0x6')](function(_0x3585d7){var _0x2d349e=_0x3585d7;var _0xafdcb3=null;if(_0x2d349e){_0xafdcb3=_0x2d349e[_0x8514('0x9c')]===0x1?_0x2d349e[0x0]:null;}if(!_0xafdcb3&&!_0x2d349e)return _0x4f52e9;var _0x2c9f8b=_0x347983[_0x5c6561[_0x8514('0x14')]][_0x8514('0xa5')];_0x32ca55[_0x8514('0xb')]=_[_0x8514('0xa6')](_0x2c9f8b);_0x32ca55['query']=_[_0x8514('0xa6')](_0x32c8a9['query']);_0x32ca55[_0x8514('0xa7')]=_[_0x8514('0xa8')](_0x32ca55[_0x8514('0xb')],_0x32ca55[_0x8514('0x92')]);_0x41ab0d[_0x8514('0xa9')]=_[_0x8514('0xa8')](_0x32ca55[_0x8514('0xb')],_0x3e7f69[_0x8514('0xaa')](_0x32c8a9['query'][_0x8514('0xaa')]));_0x41ab0d[_0x8514('0xa9')]=_0x41ab0d[_0x8514('0xa9')][_0x8514('0x9c')]?_0x41ab0d['attributes']:_0x32ca55[_0x8514('0xb')];if(!_0x32c8a9['query'][_0x8514('0xab')](_0x8514('0xac'))){_0x41ab0d[_0x8514('0xad')]=_0x3e7f69[_0x8514('0xad')](_0x32c8a9[_0x8514('0x92')][_0x8514('0xad')]);_0x41ab0d[_0x8514('0xae')]=_0x3e7f69[_0x8514('0xae')](_0x32c8a9[_0x8514('0x92')][_0x8514('0xae')]);}_0x41ab0d[_0x8514('0xaf')]=_0x3e7f69[_0x8514('0xb0')](_0x32c8a9['query'][_0x8514('0xb0')]);_0x41ab0d['where']=_0x3e7f69[_0x8514('0xa7')](_[_0x8514('0xb1')](_0x32c8a9[_0x8514('0x92')],_0x32ca55['filters']));if(_0x32c8a9[_0x8514('0x92')][_0x8514('0x5')]){_0x41ab0d['where']=_['merge'](_0x41ab0d['where'],{'$or':_[_0x8514('0x8')](_0x2c9f8b,function(_0x3c68f5){if(_0x3c68f5[_0x8514('0x3d')][_0x8514('0xb2')]!==_0x8514('0xb3')){var _0x6f71a1={};_0x6f71a1[_0x3c68f5[_0x8514('0x4')]]={'$like':'%'+_0x32c8a9['query'][_0x8514('0x5')]+'%'};return _0x6f71a1;}})});}var _0xc59e3e=[];var _0x28b64c=null;var _0x57b418={};if(_0xafdcb3){_0x28b64c=_[_0x8514('0xa2')](_0x118c2e,[_0x8514('0xd'),_0xafdcb3[_0x8514('0xd')]]);if(_0x28b64c['field']){_0x57b418={};if(_0x5c6561[_0x8514('0x14')]==='AnalyticExtractedReport'){_0x57b418[_0x28b64c[_0x8514('0xb4')]]=_['map'](_0xafdcb3[_0x8514('0x7')],'id');}else{_0x57b418[_0x28b64c[_0x8514('0xb4')]]=_0xafdcb3[_0x8514('0x7')];}_0xc59e3e[_0x8514('0x9d')](_0x57b418);}else{_0x41ab0d[_0x8514('0x90')]['id']=_0xafdcb3[_0x8514('0x7')];}}else{for(var _0x1a201a=0x0;_0x1a201a<_0x2d349e['length'];_0x1a201a++){_0x28b64c=_[_0x8514('0xa2')](_0x118c2e,[_0x8514('0xd'),_0x2d349e[_0x1a201a][_0x8514('0xd')]]);if(_0x28b64c['field']){_0x57b418={};_0x57b418[_0x28b64c['foreignKey']]=_0x2d349e[_0x1a201a][_0x8514('0x7')];_0xc59e3e[_0x8514('0x9d')](_0x57b418);}else{if(!_0x41ab0d[_0x8514('0x90')]['id'])_0x41ab0d[_0x8514('0x90')]['id']=[];_0x2d349e[_0x1a201a][_0x8514('0x7')]['forEach'](function(_0x3b2f0e){_0x41ab0d['where']['id'][_0x8514('0x9d')](_0x3b2f0e);});}}}if(!_[_0x8514('0x9b')](_0xc59e3e)){_0x41ab0d['where']=_['merge'](_0x41ab0d[_0x8514('0x90')],{'$and':{'$or':_0xc59e3e}});}_0x41ab0d=_[_0x8514('0xb5')]({},_0x41ab0d,_0x32c8a9[_0x8514('0xb6')]);if(_0xafdcb3&&!_0xafdcb3[_0x8514('0xa4')]&&_0x5c6561['childModel']===_0x8514('0x10')){if(_0x32c8a9[_0x8514('0x92')]['includeAll']){_0x41ab0d[_0x8514('0xb7')]=[{'all':!![]}];}return _0x347983[_0x5c6561[_0x8514('0x14')]][_0x8514('0xc')](_0x41ab0d)['then'](function(_0x1f4032){var _0x4f3c69=[];_0x1f4032[_0x8514('0xb8')](function(_0x3dd5fd){var _0x147459;switch(_0x3dd5fd[_0x8514('0xb9')]){case'default':_0x147459=_[_0x8514('0xa2')](_0xafdcb3[_0x8514('0x7')],function(_0x50ca4a){return _0x50ca4a['id']===_0x3dd5fd[_0x8514('0x82')]&&_0x50ca4a['type']===_0x8514('0xba');});break;case _0x8514('0xbb'):_0x147459=_[_0x8514('0xa2')](_0xafdcb3[_0x8514('0x7')],function(_0x46b85e){return _0x46b85e['id']===_0x3dd5fd[_0x8514('0x82')]&&_0x46b85e[_0x8514('0x3d')]===_0x8514('0xbc');});break;}if(_0x147459)_0x4f3c69[_0x8514('0x9d')](_0x3dd5fd);});_0x4f52e9[_0x8514('0xbd')]=_0x4f3c69['length'];_0x4f52e9[_0x8514('0xbe')]=_0x4f3c69;return _0x4f52e9;});}else{if(!_[_0x8514('0x9b')](_0x32c8a9[_0x8514('0x92')][_0x8514('0xbf')])){_0x41ab0d[_0x8514('0x90')]['id']=_0x41ab0d['where']['id']?_[_0x8514('0xa8')](_0x41ab0d['where']['id'],_0x32c8a9[_0x8514('0x92')][_0x8514('0xbf')]):_0x32c8a9[_0x8514('0x92')]['ids'];if(_0x32c8a9[_0x8514('0x92')][_0x8514('0xc0')]){_0x41ab0d['order']=_0x32c8a9['query'][_0x8514('0xc0')];}}if(_0x32c8a9['query'][_0x8514('0xc1')]){_0x41ab0d[_0x8514('0x90')]=_['merge'](_0x41ab0d[_0x8514('0x90')],{'$and':_0x32c8a9[_0x8514('0x92')][_0x8514('0xc1')]});}return _0x347983[_0x5c6561[_0x8514('0x14')]][_0x8514('0xbd')]({'where':_0x41ab0d['where']})[_0x8514('0x6')](function(_0x1403d0){_0x4f52e9[_0x8514('0xbd')]=_0x1403d0;if(_0x32c8a9[_0x8514('0x92')][_0x8514('0xc2')]){if(_0x5c6561[_0x8514('0x14')]===_0x8514('0xc3')){_0x41ab0d[_0x8514('0xb7')]=[{'model':_0x347983[_0x8514('0x77')],'as':_0x8514('0xc4'),'attributes':['id',_0x8514('0xd'),_0x8514('0xc5')],'required':_0x32c8a9[_0x8514('0x92')][_0x8514('0xc6')]?!![]:![]},{'model':_0x347983[_0x8514('0x77')],'as':_0x8514('0xc7'),'attributes':['id','name','color'],'through':_0x32c8a9[_0x8514('0x92')]['tag']?{'attributes':[],'where':{'TagId':_0x32c8a9[_0x8514('0x92')]['tag']||undefined}}:{},'required':_0x32c8a9[_0x8514('0x92')][_0x8514('0xc6')]?!![]:![]}];}else{_0x41ab0d[_0x8514('0xb7')]=[{'all':!![]}];}}return _0x347983[_0x5c6561[_0x8514('0x14')]][_0x8514('0xc')](_0x41ab0d);})[_0x8514('0x6')](function(_0x45073f){_0x4f52e9[_0x8514('0xbe')]=_0x45073f;if(_0x4e33e3===_0x8514('0x32')&&_0x32c8a9[_0x8514('0x92')][_0x8514('0xc8')]===_0x8514('0xc9')){var _0x282242=[];for(var _0x27fc83=0x0;_0x27fc83<_0x4f52e9[_0x8514('0xbe')][_0x8514('0x9c')];_0x27fc83++){_0x282242[_0x8514('0x9d')](_0x2783cc('chat',_0x4f52e9[_0x8514('0xbe')][_0x27fc83][_0x8514('0xca')]));_0x282242[_0x8514('0x9d')](_0x2783cc(_0x8514('0xcb'),_0x4f52e9['rows'][_0x27fc83][_0x8514('0xca')]));_0x282242[_0x8514('0x9d')](_0x2783cc(_0x8514('0xcc'),_0x4f52e9[_0x8514('0xbe')][_0x27fc83][_0x8514('0xca')]));_0x282242[_0x8514('0x9d')](_0x2783cc(_0x8514('0xcd'),_0x4f52e9['rows'][_0x27fc83][_0x8514('0xca')]));_0x282242[_0x8514('0x9d')](_0x2783cc('openchannel',_0x4f52e9[_0x8514('0xbe')][_0x27fc83][_0x8514('0xca')]));_0x282242[_0x8514('0x9d')](_0x2783cc(_0x8514('0xce'),_0x4f52e9['rows'][_0x27fc83][_0x8514('0xca')]));}return Promise['all'](_0x282242)[_0x8514('0x6')](function(){return _0x4f52e9;});}return _0x4f52e9;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 11e39d9..348c923 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 _0x36c3=['defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x1e2096,_0x1fba06){var _0x181f01=function(_0x39f0d9){while(--_0x39f0d9){_0x1e2096['push'](_0x1e2096['shift']());}};_0x181f01(++_0x1fba06);}(_0x36c3,0x1a6));var _0x336c=function(_0x3e25c1,_0x1d15f9){_0x3e25c1=_0x3e25c1-0x0;var _0x52e7f2=_0x36c3[_0x3e25c1];return _0x52e7f2;};'use strict';var _=require(_0x336c('0x0'));var util=require(_0x336c('0x1'));var moment=require('moment');var BPromise=require(_0x336c('0x2'));var rs=require(_0x336c('0x3'));var fs=require('fs');var Redis=require(_0x336c('0x4'));var db=require(_0x336c('0x5'))['db'];var utils=require(_0x336c('0x6'));var logger=require(_0x336c('0x7'))(_0x336c('0x8'));var config=require('../../config/environment');var jayson=require(_0x336c('0x9'));var client=jayson[_0x336c('0xa')][_0x336c('0xb')]({'port':0x232a});config[_0x336c('0xc')]=_[_0x336c('0xd')](config['redis'],{'host':_0x336c('0xe'),'port':0x18eb});var socket=require(_0x336c('0xf'))(new Redis(config[_0x336c('0xc')]));require(_0x336c('0x10'))[_0x336c('0x11')](socket);function respondWithRpcPromise(_0x243984,_0x33ced0,_0x1a4503){return new BPromise(function(_0x179247,_0x31cee7){return client[_0x336c('0x12')](_0x243984,_0x1a4503)[_0x336c('0x13')](function(_0x1d896b){logger[_0x336c('0x14')](_0x336c('0x15'),_0x33ced0,_0x336c('0x16'));logger[_0x336c('0x17')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x33ced0,'request\x20sent',JSON[_0x336c('0x18')](_0x1d896b));if(_0x1d896b['error']){if(_0x1d896b[_0x336c('0x19')][_0x336c('0x1a')]===0x1f4){logger[_0x336c('0x19')](_0x336c('0x15'),_0x33ced0,_0x1d896b['error'][_0x336c('0x1b')]);return _0x31cee7(_0x1d896b[_0x336c('0x19')]['message']);}logger[_0x336c('0x19')]('UserProfile,\x20%s,\x20%s',_0x33ced0,_0x1d896b[_0x336c('0x19')]['message']);return _0x179247(_0x1d896b[_0x336c('0x19')]['message']);}else{logger[_0x336c('0x14')](_0x336c('0x15'),_0x33ced0,'request\x20sent');_0x179247(_0x1d896b['result'][_0x336c('0x1b')]);}})[_0x336c('0x1c')](function(_0x1d306c){logger[_0x336c('0x19')](_0x336c('0x15'),_0x33ced0,_0x1d306c);_0x31cee7(_0x1d306c);});});} \ No newline at end of file +var _0x761c=['rpc','jayson/promise','client','http','redis','defaults','localhost','./userProfile.socket','register','then','request\x20sent','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfile,\x20%s,\x20%s','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x761c,0x18a));var _0xc761=function(_0x5f1866,_0x5806f2){_0x5f1866=_0x5f1866-0x0;var _0x1be7e9=_0x761c[_0x5f1866];return _0x1be7e9;};'use strict';var _=require(_0xc761('0x0'));var util=require('util');var moment=require(_0xc761('0x1'));var BPromise=require(_0xc761('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc761('0x3'));var db=require(_0xc761('0x4'))['db'];var utils=require(_0xc761('0x5'));var logger=require('../../config/logger')(_0xc761('0x6'));var config=require('../../config/environment');var jayson=require(_0xc761('0x7'));var client=jayson[_0xc761('0x8')][_0xc761('0x9')]({'port':0x232a});config[_0xc761('0xa')]=_[_0xc761('0xb')](config[_0xc761('0xa')],{'host':_0xc761('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc761('0xa')]));require(_0xc761('0xd'))[_0xc761('0xe')](socket);function respondWithRpcPromise(_0x2440e3,_0x1dd2a0,_0x2bde36){return new BPromise(function(_0x205c96,_0x49add8){return client['request'](_0x2440e3,_0x2bde36)[_0xc761('0xf')](function(_0x4405a2){logger['info']('UserProfile,\x20%s,\x20%s',_0x1dd2a0,_0xc761('0x10'));logger['debug'](_0xc761('0x11'),_0x1dd2a0,'request\x20sent',JSON[_0xc761('0x12')](_0x4405a2));if(_0x4405a2['error']){if(_0x4405a2[_0xc761('0x13')][_0xc761('0x14')]===0x1f4){logger[_0xc761('0x13')](_0xc761('0x15'),_0x1dd2a0,_0x4405a2[_0xc761('0x13')][_0xc761('0x16')]);return _0x49add8(_0x4405a2[_0xc761('0x13')]['message']);}logger['error'](_0xc761('0x15'),_0x1dd2a0,_0x4405a2[_0xc761('0x13')][_0xc761('0x16')]);return _0x205c96(_0x4405a2['error'][_0xc761('0x16')]);}else{logger[_0xc761('0x17')](_0xc761('0x15'),_0x1dd2a0,_0xc761('0x10'));_0x205c96(_0x4405a2[_0xc761('0x18')]['message']);}})['catch'](function(_0x505b5c){logger[_0xc761('0x13')]('UserProfile,\x20%s,\x20%s',_0x1dd2a0,_0x505b5c);_0x49add8(_0x505b5c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d536779..5991286 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 _0x1882=['length','save','remove','update','emit','register'];(function(_0x22dd78,_0x21c5d7){var _0x282002=function(_0x2dbb9c){while(--_0x2dbb9c){_0x22dd78['push'](_0x22dd78['shift']());}};_0x282002(++_0x21c5d7);}(_0x1882,0x1a5));var _0x2188=function(_0x39ea44,_0x5e8297){_0x39ea44=_0x39ea44-0x0;var _0x23b5cb=_0x1882[_0x39ea44];return _0x23b5cb;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x2188('0x0'),_0x2188('0x1'),_0x2188('0x2')];function createListener(_0x429f6a,_0x10d621){return function(_0x3314ea){_0x10d621[_0x2188('0x3')](_0x429f6a,_0x3314ea);};}function removeListener(_0x1234f2,_0x143358){return function(){UserProfileEvents['removeListener'](_0x1234f2,_0x143358);};}exports[_0x2188('0x4')]=function(_0xfa2496){for(var _0x3cb593=0x0,_0x23d45a=events[_0x2188('0x5')];_0x3cb593<_0x23d45a;_0x3cb593++){var _0xa84004=events[_0x3cb593];var _0x1103af=createListener('userProfile:'+_0xa84004,_0xfa2496);UserProfileEvents['on'](_0xa84004,_0x1103af);}}; \ No newline at end of file +var _0xead5=['length','./userProfile.events','remove','update','emit','removeListener','register'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0xead5,0x112));var _0x5ead=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xead5[_0x102e37];return _0x35a07c;};'use strict';var UserProfileEvents=require(_0x5ead('0x0'));var events=['save',_0x5ead('0x1'),_0x5ead('0x2')];function createListener(_0x4b4521,_0x4b4fd1){return function(_0x28c8a8){_0x4b4fd1[_0x5ead('0x3')](_0x4b4521,_0x28c8a8);};}function removeListener(_0x3c8c55,_0x5d9c74){return function(){UserProfileEvents[_0x5ead('0x4')](_0x3c8c55,_0x5d9c74);};}exports[_0x5ead('0x5')]=function(_0x47fc8a){for(var _0x30b469=0x0,_0x48cc77=events[_0x5ead('0x6')];_0x30b469<_0x48cc77;_0x30b469++){var _0x3bffda=events[_0x30b469];var _0x5332fb=createListener('userProfile:'+_0x3bffda,_0x47fc8a);UserProfileEvents['on'](_0x3bffda,_0x5332fb);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 55625e8..4e4c826 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 _0x2410=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','describe','/:id','create','update','delete','destroy','exports','multer','util'];(function(_0x2a8292,_0x173125){var _0x575fa1=function(_0x49f0fc){while(--_0x49f0fc){_0x2a8292['push'](_0x2a8292['shift']());}};_0x575fa1(++_0x173125);}(_0x2410,0x11e));var _0x0241=function(_0x3a2bce,_0x1d45ab){_0x3a2bce=_0x3a2bce-0x0;var _0x27d397=_0x2410[_0x3a2bce];return _0x27d397;};'use strict';var multer=require(_0x0241('0x0'));var util=require(_0x0241('0x1'));var path=require('path');var timeout=require(_0x0241('0x2'));var express=require('express');var router=express[_0x0241('0x3')]();var fs_extra=require(_0x0241('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0241('0x5'));var config=require(_0x0241('0x6'));var controller=require(_0x0241('0x7'));router[_0x0241('0x8')]('/',auth[_0x0241('0x9')](),controller['index']);router[_0x0241('0x8')](_0x0241('0xa'),auth['isAuthenticated'](),controller[_0x0241('0xb')]);router[_0x0241('0x8')](_0x0241('0xc'),auth[_0x0241('0x9')](),controller['show']);router['post']('/',auth[_0x0241('0x9')](),controller[_0x0241('0xd')]);router['put'](_0x0241('0xc'),auth['isAuthenticated'](),controller[_0x0241('0xe')]);router[_0x0241('0xf')](_0x0241('0xc'),auth[_0x0241('0x9')](),controller[_0x0241('0x10')]);module[_0x0241('0x11')]=router; \ No newline at end of file +var _0x198d=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post'];(function(_0x77d7ce,_0x33727d){var _0x3bf43a=function(_0x245e65){while(--_0x245e65){_0x77d7ce['push'](_0x77d7ce['shift']());}};_0x3bf43a(++_0x33727d);}(_0x198d,0x1aa));var _0xd198=function(_0x4a455c,_0x3126d6){_0x4a455c=_0x4a455c-0x0;var _0x563c1f=_0x198d[_0x4a455c];return _0x563c1f;};'use strict';var multer=require(_0xd198('0x0'));var util=require(_0xd198('0x1'));var path=require('path');var timeout=require(_0xd198('0x2'));var express=require('express');var router=express[_0xd198('0x3')]();var fs_extra=require(_0xd198('0x4'));var auth=require(_0xd198('0x5'));var interaction=require(_0xd198('0x6'));var config=require(_0xd198('0x7'));var controller=require('./userProfileResource.controller');router[_0xd198('0x8')]('/',auth[_0xd198('0x9')](),controller[_0xd198('0xa')]);router['get']('/describe',auth[_0xd198('0x9')](),controller[_0xd198('0xb')]);router[_0xd198('0x8')](_0xd198('0xc'),auth[_0xd198('0x9')](),controller[_0xd198('0xd')]);router[_0xd198('0xe')]('/',auth[_0xd198('0x9')](),controller[_0xd198('0xf')]);router[_0xd198('0x10')](_0xd198('0xc'),auth[_0xd198('0x9')](),controller[_0xd198('0x11')]);router[_0xd198('0x12')](_0xd198('0xc'),auth[_0xd198('0x9')](),controller[_0xd198('0x13')]);module[_0xd198('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index f1a0954..33b1ac5 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 _0xfe25=['sequelize','exports','STRING','INTEGER'];(function(_0x34482d,_0x2c1abb){var _0x2b8095=function(_0x107d61){while(--_0x107d61){_0x34482d['push'](_0x34482d['shift']());}};_0x2b8095(++_0x2c1abb);}(_0xfe25,0x1a8));var _0x5fe2=function(_0xd6b9b,_0x2a01f6){_0xd6b9b=_0xd6b9b-0x0;var _0x5bd427=_0xfe25[_0xd6b9b];return _0x5bd427;};'use strict';var Sequelize=require(_0x5fe2('0x0'));module[_0x5fe2('0x1')]={'name':{'type':Sequelize[_0x5fe2('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x5fe2('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xd127=['STRING','INTEGER','sequelize','exports'];(function(_0x5c17f3,_0x13b530){var _0x2eaab8=function(_0x301abc){while(--_0x301abc){_0x5c17f3['push'](_0x5c17f3['shift']());}};_0x2eaab8(++_0x13b530);}(_0xd127,0xc6));var _0x7d12=function(_0x332c9d,_0x134f06){_0x332c9d=_0x332c9d-0x0;var _0x27d7a7=_0xd127[_0x332c9d];return _0x27d7a7;};'use strict';var Sequelize=require(_0x7d12('0x0'));module[_0x7d12('0x1')]={'name':{'type':Sequelize[_0x7d12('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x7d12('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7d12('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 1d3915d..d575857 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 _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','UserProfileResource','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x315e19,_0x36bfc3){var _0x439799=function(_0x1332f2){while(--_0x1332f2){_0x315e19['push'](_0x315e19['shift']());}};_0x439799(++_0x36bfc3);}(_0x7096,0x10c));var _0x6709=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x7096[_0x2dea24];return _0x309d58;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['UserProfileResource'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['UserProfileResource'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['UserProfileResource']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['UserProfileResource'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['UserProfileResource']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['UserProfileResource'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['UserProfileResource'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file +var _0x2542=['json','offset','limit','undefined','count','set','Content-Range','apply','update','then','error','stack','name','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x2601b4,_0x5b558d){var _0xd5ebe2=function(_0x5bf814){while(--_0x5bf814){_0x2601b4['push'](_0x2601b4['shift']());}};_0xd5ebe2(++_0x5b558d);}(_0x2542,0x169));var _0x2254=function(_0x319674,_0x3be6e7){_0x319674=_0x319674-0x0;var _0x5b140a=_0x2542[_0x319674];return _0x5b140a;};'use strict';var emlformat=require(_0x2254('0x0'));var rimraf=require(_0x2254('0x1'));var zipdir=require(_0x2254('0x2'));var jsonpatch=require(_0x2254('0x3'));var rp=require('request-promise');var moment=require(_0x2254('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2254('0x5'));var util=require(_0x2254('0x6'));var path=require(_0x2254('0x7'));var sox=require(_0x2254('0x8'));var csv=require(_0x2254('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2254('0xa'));var _=require(_0x2254('0xb'));var squel=require(_0x2254('0xc'));var crypto=require(_0x2254('0xd'));var jsforce=require(_0x2254('0xe'));var deskjs=require(_0x2254('0xf'));var toCsv=require(_0x2254('0x9'));var querystring=require(_0x2254('0x10'));var Papa=require(_0x2254('0x11'));var Redis=require(_0x2254('0x12'));var authService=require(_0x2254('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2254('0x14'));var hardwareService=require(_0x2254('0x15'));var logger=require(_0x2254('0x16'))(_0x2254('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x2254('0x18'));var db=require(_0x2254('0x19'))['db'];function respondWithStatusCode(_0x116b70,_0xdcb670){_0xdcb670=_0xdcb670||0xcc;return function(_0x3c326b){if(_0x3c326b){return _0x116b70[_0x2254('0x1a')](_0xdcb670);}return _0x116b70['status'](_0xdcb670)[_0x2254('0x1b')]();};}function respondWithResult(_0x7c7ab0,_0x504749){_0x504749=_0x504749||0xc8;return function(_0x2f4de){if(_0x2f4de){return _0x7c7ab0[_0x2254('0x1c')](_0x504749)[_0x2254('0x1d')](_0x2f4de);}};}function respondWithFilteredResult(_0x145272,_0x26285a){return function(_0xbc5548){if(_0xbc5548){var _0x50f137=typeof _0x26285a[_0x2254('0x1e')]==='undefined'&&typeof _0x26285a[_0x2254('0x1f')]===_0x2254('0x20');var _0x170ffa=_0xbc5548[_0x2254('0x21')];var _0x1ae11e=_0x50f137?0x0:_0x26285a[_0x2254('0x1e')];var _0x497724=_0x50f137?_0xbc5548['count']:_0x26285a['offset']+_0x26285a[_0x2254('0x1f')];var _0x3a79f8;if(_0x497724>=_0x170ffa){_0x497724=_0x170ffa;_0x3a79f8=0xc8;}else{_0x3a79f8=0xce;}_0x145272[_0x2254('0x1c')](_0x3a79f8);return _0x145272[_0x2254('0x22')](_0x2254('0x23'),_0x1ae11e+'-'+_0x497724+'/'+_0x170ffa)[_0x2254('0x1d')](_0xbc5548);}return null;};}function patchUpdates(_0x487f72){return function(_0x28381e){try{jsonpatch[_0x2254('0x24')](_0x28381e,_0x487f72,!![]);}catch(_0x906cde){return BPromise['reject'](_0x906cde);}return _0x28381e['save']();};}function saveUpdates(_0x5bd982,_0x1e8a98){return function(_0x559af4){if(_0x559af4){return _0x559af4[_0x2254('0x25')](_0x5bd982)['then'](function(_0x5713e4){return _0x5713e4;});}return null;};}function removeEntity(_0x4d8faf,_0x540020){return function(_0x5e5edb){if(_0x5e5edb){return _0x5e5edb['destroy']()[_0x2254('0x26')](function(){_0x4d8faf[_0x2254('0x1c')](0xcc)[_0x2254('0x1b')]();});}};}function handleEntityNotFound(_0x265467,_0x13522d){return function(_0x1349c9){if(!_0x1349c9){_0x265467['sendStatus'](0x194);}return _0x1349c9;};}function handleError(_0x4a8274,_0x1ada42){_0x1ada42=_0x1ada42||0x1f4;return function(_0x4f6877){logger[_0x2254('0x27')](_0x4f6877[_0x2254('0x28')]);if(_0x4f6877[_0x2254('0x29')]){delete _0x4f6877[_0x2254('0x29')];}_0x4a8274[_0x2254('0x1c')](_0x1ada42)['send'](_0x4f6877);};}exports[_0x2254('0x2a')]=function(_0x2a789b,_0x21285d){var _0x37af8b={},_0x13366a={},_0x377c41={'count':0x0,'rows':[]};var _0x3214a7=_[_0x2254('0x2b')](db[_0x2254('0x2c')][_0x2254('0x2d')],function(_0x21c641){return{'name':_0x21c641[_0x2254('0x2e')],'type':_0x21c641[_0x2254('0x2f')][_0x2254('0x30')]};});_0x13366a[_0x2254('0x31')]=_[_0x2254('0x2b')](_0x3214a7,_0x2254('0x29'));_0x13366a[_0x2254('0x32')]=_[_0x2254('0x33')](_0x2a789b['query']);_0x13366a[_0x2254('0x34')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],_0x13366a[_0x2254('0x32')]);_0x37af8b[_0x2254('0x36')]=_[_0x2254('0x35')](_0x13366a[_0x2254('0x31')],qs[_0x2254('0x37')](_0x2a789b[_0x2254('0x32')]['fields']));_0x37af8b[_0x2254('0x36')]=_0x37af8b[_0x2254('0x36')]['length']?_0x37af8b[_0x2254('0x36')]:_0x13366a[_0x2254('0x31')];if(!_0x2a789b[_0x2254('0x32')][_0x2254('0x38')]('nolimit')){_0x37af8b['limit']=qs[_0x2254('0x1f')](_0x2a789b['query'][_0x2254('0x1f')]);_0x37af8b[_0x2254('0x1e')]=qs[_0x2254('0x1e')](_0x2a789b[_0x2254('0x32')][_0x2254('0x1e')]);}_0x37af8b[_0x2254('0x39')]=qs[_0x2254('0x3a')](_0x2a789b['query'][_0x2254('0x3a')]);_0x37af8b[_0x2254('0x3b')]=qs[_0x2254('0x34')](_[_0x2254('0x3c')](_0x2a789b[_0x2254('0x32')],_0x13366a[_0x2254('0x34')]),_0x3214a7);if(_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]){_0x37af8b[_0x2254('0x3b')]=_[_0x2254('0x3e')](_0x37af8b['where'],{'$or':_[_0x2254('0x2b')](_0x3214a7,function(_0xde3e4a){if(_0xde3e4a[_0x2254('0x2f')]!==_0x2254('0x3f')){var _0x4c7cc3={};_0x4c7cc3[_0xde3e4a[_0x2254('0x29')]]={'$like':'%'+_0x2a789b[_0x2254('0x32')][_0x2254('0x3d')]+'%'};return _0x4c7cc3;}})});}_0x37af8b=_[_0x2254('0x3e')]({},_0x37af8b,_0x2a789b[_0x2254('0x40')]);var _0x2602db={'where':_0x37af8b[_0x2254('0x3b')]};return db[_0x2254('0x2c')]['count'](_0x2602db)[_0x2254('0x26')](function(_0x5c15d7){_0x377c41[_0x2254('0x21')]=_0x5c15d7;if(_0x2a789b[_0x2254('0x32')][_0x2254('0x41')]){_0x37af8b[_0x2254('0x42')]=[{'all':!![]}];}return db[_0x2254('0x2c')][_0x2254('0x43')](_0x37af8b);})[_0x2254('0x26')](function(_0x568ec9){_0x377c41[_0x2254('0x44')]=_0x568ec9;return _0x377c41;})[_0x2254('0x26')](respondWithFilteredResult(_0x21285d,_0x37af8b))[_0x2254('0x45')](handleError(_0x21285d,null));};exports[_0x2254('0x46')]=function(_0x40d4da,_0x57cda2){var _0x22bb98={'raw':![],'where':{'id':_0x40d4da[_0x2254('0x47')]['id']}},_0x1dec43={};_0x1dec43[_0x2254('0x31')]=_[_0x2254('0x33')](db['UserProfileResource'][_0x2254('0x2d')]);_0x1dec43['query']=_[_0x2254('0x33')](_0x40d4da[_0x2254('0x32')]);_0x1dec43[_0x2254('0x34')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],_0x1dec43[_0x2254('0x32')]);_0x22bb98[_0x2254('0x36')]=_[_0x2254('0x35')](_0x1dec43[_0x2254('0x31')],qs[_0x2254('0x37')](_0x40d4da[_0x2254('0x32')][_0x2254('0x37')]));_0x22bb98[_0x2254('0x36')]=_0x22bb98['attributes'][_0x2254('0x48')]?_0x22bb98[_0x2254('0x36')]:_0x1dec43[_0x2254('0x31')];if(_0x40d4da['query'][_0x2254('0x41')]){_0x22bb98[_0x2254('0x42')]=[{'all':!![]}];}_0x22bb98=_[_0x2254('0x3e')]({},_0x22bb98,_0x40d4da[_0x2254('0x40')]);return db[_0x2254('0x2c')][_0x2254('0x49')](_0x22bb98)[_0x2254('0x26')](handleEntityNotFound(_0x57cda2,null))[_0x2254('0x26')](respondWithResult(_0x57cda2,null))[_0x2254('0x45')](handleError(_0x57cda2,null));};exports['create']=function(_0x239ba0,_0x405eb2){return db[_0x2254('0x2c')][_0x2254('0x4a')](_0x239ba0[_0x2254('0x4b')],{})[_0x2254('0x26')](respondWithResult(_0x405eb2,0xc9))[_0x2254('0x45')](handleError(_0x405eb2,null));};exports[_0x2254('0x25')]=function(_0x3ac691,_0xa103ea){if(_0x3ac691['body']['id']){delete _0x3ac691[_0x2254('0x4b')]['id'];}return db[_0x2254('0x2c')]['find']({'where':{'id':_0x3ac691[_0x2254('0x47')]['id']}})[_0x2254('0x26')](handleEntityNotFound(_0xa103ea,null))[_0x2254('0x26')](saveUpdates(_0x3ac691[_0x2254('0x4b')],null))['then'](respondWithResult(_0xa103ea,null))[_0x2254('0x45')](handleError(_0xa103ea,null));};exports[_0x2254('0x4c')]=function(_0x4d2c96,_0x26d01a){return db[_0x2254('0x2c')][_0x2254('0x49')]({'where':{'id':_0x4d2c96[_0x2254('0x47')]['id']}})['then'](handleEntityNotFound(_0x26d01a,null))[_0x2254('0x26')](removeEntity(_0x26d01a,null))[_0x2254('0x45')](handleError(_0x26d01a,null));};exports[_0x2254('0x4d')]=function(_0x4ba6ef,_0x4cc18a){return db[_0x2254('0x2c')][_0x2254('0x4d')]()['then'](respondWithResult(_0x4cc18a,null))[_0x2254('0x45')](handleError(_0x4cc18a,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3f5b1be..31f5602 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 _0x8fe0=['bluebird','rimraf','./userProfileResource.attributes','UserProfileResource','resourceId','lodash','util','../../config/logger','moment'];(function(_0x5ae8f1,_0x58098e){var _0x4ac982=function(_0x469656){while(--_0x469656){_0x5ae8f1['push'](_0x5ae8f1['shift']());}};_0x4ac982(++_0x58098e);}(_0x8fe0,0xcb));var _0x08fe=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8fe0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x08fe('0x0'));var util=require(_0x08fe('0x1'));var logger=require(_0x08fe('0x2'))('api');var moment=require(_0x08fe('0x3'));var BPromise=require(_0x08fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x08fe('0x5'));var config=require('../../config/environment');var attributes=require(_0x08fe('0x6'));module['exports']=function(_0x2c4761,_0x508a6f){return _0x2c4761['define'](_0x08fe('0x7'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x08fe('0x8'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x828b=['UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes','exports','define'];(function(_0x1f146c,_0xfb86d6){var _0x2354fb=function(_0x2078d0){while(--_0x2078d0){_0x1f146c['push'](_0x1f146c['shift']());}};_0x2354fb(++_0xfb86d6);}(_0x828b,0xa7));var _0xb828=function(_0x2ab365,_0xa3812e){_0x2ab365=_0x2ab365-0x0;var _0x49fef3=_0x828b[_0x2ab365];return _0x49fef3;};'use strict';var _=require(_0xb828('0x0'));var util=require(_0xb828('0x1'));var logger=require(_0xb828('0x2'))(_0xb828('0x3'));var moment=require(_0xb828('0x4'));var BPromise=require(_0xb828('0x5'));var rp=require(_0xb828('0x6'));var fs=require('fs');var path=require(_0xb828('0x7'));var rimraf=require(_0xb828('0x8'));var config=require(_0xb828('0x9'));var attributes=require(_0xb828('0xa'));module[_0xb828('0xb')]=function(_0x5f2203,_0x19a006){return _0x5f2203[_0xb828('0xc')](_0xb828('0xd'),attributes,{'tableName':_0xb828('0xe'),'paranoid':![],'indexes':[{'name':_0xb828('0xf'),'fields':[_0xb828('0x10'),_0xb828('0x11')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index b90fa6d..54e3928 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 _0xb0cf=['code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3b711a,_0x410be8){var _0x89061d=function(_0x57d61a){while(--_0x57d61a){_0x3b711a['push'](_0x3b711a['shift']());}};_0x89061d(++_0x410be8);}(_0xb0cf,0x1d1));var _0xfb0c=function(_0x2e5093,_0x516434){_0x2e5093=_0x2e5093-0x0;var _0x1062b6=_0xb0cf[_0x2e5093];return _0x1062b6;};'use strict';var _=require(_0xfb0c('0x0'));var util=require(_0xfb0c('0x1'));var moment=require(_0xfb0c('0x2'));var BPromise=require('bluebird');var rs=require(_0xfb0c('0x3'));var fs=require('fs');var Redis=require(_0xfb0c('0x4'));var db=require(_0xfb0c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfb0c('0x6'))(_0xfb0c('0x7'));var config=require(_0xfb0c('0x8'));var jayson=require(_0xfb0c('0x9'));var client=jayson['client'][_0xfb0c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfe1cd9,_0x59b278,_0x56e855){return new BPromise(function(_0x5d5e95,_0x4a63cb){return client['request'](_0xfe1cd9,_0x56e855)[_0xfb0c('0xb')](function(_0x197730){logger[_0xfb0c('0xc')](_0xfb0c('0xd'),_0x59b278,_0xfb0c('0xe'));logger[_0xfb0c('0xf')](_0xfb0c('0x10'),_0x59b278,_0xfb0c('0xe'),JSON[_0xfb0c('0x11')](_0x197730));if(_0x197730[_0xfb0c('0x12')]){if(_0x197730[_0xfb0c('0x12')][_0xfb0c('0x13')]===0x1f4){logger[_0xfb0c('0x12')](_0xfb0c('0xd'),_0x59b278,_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);return _0x4a63cb(_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);}logger[_0xfb0c('0x12')](_0xfb0c('0xd'),_0x59b278,_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);return _0x5d5e95(_0x197730[_0xfb0c('0x12')][_0xfb0c('0x14')]);}else{logger['info'](_0xfb0c('0xd'),_0x59b278,_0xfb0c('0xe'));_0x5d5e95(_0x197730[_0xfb0c('0x15')]['message']);}})['catch'](function(_0x2c542a){logger[_0xfb0c('0x12')]('UserProfileResource,\x20%s,\x20%s',_0x59b278,_0x2c542a);_0x4a63cb(_0x2c542a);});});} \ No newline at end of file +var _0xa806=['http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xa806,0x69));var _0x6a80=function(_0x12bcf7,_0xc11103){_0x12bcf7=_0x12bcf7-0x0;var _0x2825a=_0xa806[_0x12bcf7];return _0x2825a;};'use strict';var _=require('lodash');var util=require(_0x6a80('0x0'));var moment=require(_0x6a80('0x1'));var BPromise=require(_0x6a80('0x2'));var rs=require(_0x6a80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6a80('0x4'))['db'];var utils=require(_0x6a80('0x5'));var logger=require(_0x6a80('0x6'))(_0x6a80('0x7'));var config=require('../../config/environment');var jayson=require(_0x6a80('0x8'));var client=jayson[_0x6a80('0x9')][_0x6a80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21edf8,_0x9ebf49,_0xdcddc8){return new BPromise(function(_0x41232f,_0x16eac8){return client[_0x6a80('0xb')](_0x21edf8,_0xdcddc8)[_0x6a80('0xc')](function(_0x272c9a){logger[_0x6a80('0xd')](_0x6a80('0xe'),_0x9ebf49,_0x6a80('0xf'));logger[_0x6a80('0x10')](_0x6a80('0x11'),_0x9ebf49,'request\x20sent',JSON[_0x6a80('0x12')](_0x272c9a));if(_0x272c9a[_0x6a80('0x13')]){if(_0x272c9a['error'][_0x6a80('0x14')]===0x1f4){logger[_0x6a80('0x13')](_0x6a80('0xe'),_0x9ebf49,_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);return _0x16eac8(_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);}logger[_0x6a80('0x13')](_0x6a80('0xe'),_0x9ebf49,_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);return _0x41232f(_0x272c9a[_0x6a80('0x13')][_0x6a80('0x15')]);}else{logger[_0x6a80('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x9ebf49,_0x6a80('0xf'));_0x41232f(_0x272c9a['result'][_0x6a80('0x15')]);}})[_0x6a80('0x16')](function(_0x439d98){logger['error'](_0x6a80('0xe'),_0x9ebf49,_0x439d98);_0x16eac8(_0x439d98);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 0627a34..b83993a 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 _0xf0f3=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0xd07629,_0x280a38){var _0x2ea107=function(_0x529ff8){while(--_0x529ff8){_0xd07629['push'](_0xd07629['shift']());}};_0x2ea107(++_0x280a38);}(_0xf0f3,0x18d));var _0x3f0f=function(_0x5e972b,_0x47aeae){_0x5e972b=_0x5e972b-0x0;var _0x5f5bbb=_0xf0f3[_0x5e972b];return _0x5f5bbb;};'use strict';var multer=require(_0x3f0f('0x0'));var util=require(_0x3f0f('0x1'));var path=require(_0x3f0f('0x2'));var timeout=require(_0x3f0f('0x3'));var express=require('express');var router=express[_0x3f0f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f0f('0x5'));var interaction=require(_0x3f0f('0x6'));var config=require(_0x3f0f('0x7'));var controller=require(_0x3f0f('0x8'));router[_0x3f0f('0x9')]('/',auth[_0x3f0f('0xa')](),controller['index']);router[_0x3f0f('0x9')]('/describe',auth[_0x3f0f('0xa')](),controller[_0x3f0f('0xb')]);router['get'](_0x3f0f('0xc'),auth[_0x3f0f('0xa')](),controller[_0x3f0f('0xd')]);router[_0x3f0f('0xe')]('/',auth[_0x3f0f('0xa')](),controller[_0x3f0f('0xf')]);router[_0x3f0f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x3f0f('0x11')]);router[_0x3f0f('0x12')](_0x3f0f('0xc'),auth[_0x3f0f('0xa')](),controller[_0x3f0f('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcfb6=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','update'];(function(_0x56de9e,_0x5e742a){var _0x863b3a=function(_0x431fd1){while(--_0x431fd1){_0x56de9e['push'](_0x56de9e['shift']());}};_0x863b3a(++_0x5e742a);}(_0xcfb6,0x6b));var _0x6cfb=function(_0x13b7fd,_0x4eaf7f){_0x13b7fd=_0x13b7fd-0x0;var _0x32a74a=_0xcfb6[_0x13b7fd];return _0x32a74a;};'use strict';var multer=require(_0x6cfb('0x0'));var util=require(_0x6cfb('0x1'));var path=require(_0x6cfb('0x2'));var timeout=require(_0x6cfb('0x3'));var express=require(_0x6cfb('0x4'));var router=express[_0x6cfb('0x5')]();var fs_extra=require(_0x6cfb('0x6'));var auth=require(_0x6cfb('0x7'));var interaction=require(_0x6cfb('0x8'));var config=require('../../config/environment');var controller=require(_0x6cfb('0x9'));router[_0x6cfb('0xa')]('/',auth['isAuthenticated'](),controller[_0x6cfb('0xb')]);router[_0x6cfb('0xa')](_0x6cfb('0xc'),auth[_0x6cfb('0xd')](),controller[_0x6cfb('0xe')]);router['get'](_0x6cfb('0xf'),auth[_0x6cfb('0xd')](),controller[_0x6cfb('0x10')]);router[_0x6cfb('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x6cfb('0xf'),auth[_0x6cfb('0xd')](),controller[_0x6cfb('0x12')]);router['delete'](_0x6cfb('0xf'),auth[_0x6cfb('0xd')](),controller[_0x6cfb('0x13')]);module[_0x6cfb('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 ea11654..260f713 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 _0xb10b=['split','sequelize','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x58ae8a,_0x3c619e){var _0x2f0b6b=function(_0x6db940){while(--_0x6db940){_0x58ae8a['push'](_0x58ae8a['shift']());}};_0x2f0b6b(++_0x3c619e);}(_0xb10b,0x12a));var _0xbb10=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0xb10b[_0x34aec4];return _0x51e1a7;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xbb10('0x2')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xbb10('0x1')],'set':function(_0x460981){this[_0xbb10('0x4')](_0xbb10('0x5'),_0x460981?_0x460981[_0xbb10('0x6')](''):[]);},'get':function(){return this['getDataValue'](_0xbb10('0x5'))?this[_0xbb10('0x7')]('crudPermissions')[_0xbb10('0x8')](''):[];}}}; \ No newline at end of file +var _0x7072=['exports','STRING','INTEGER','BOOLEAN','crudPermissions','join','getDataValue','split'];(function(_0x13dac6,_0x103885){var _0x29fe47=function(_0x5aae97){while(--_0x5aae97){_0x13dac6['push'](_0x13dac6['shift']());}};_0x29fe47(++_0x103885);}(_0x7072,0x138));var _0x2707=function(_0x58afd5,_0x534a48){_0x58afd5=_0x58afd5-0x0;var _0x3e503b=_0x7072[_0x58afd5];return _0x3e503b;};'use strict';var Sequelize=require('sequelize');module[_0x2707('0x0')]={'name':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x2707('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x2707('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x2707('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0xfdfa7a){this['setDataValue'](_0x2707('0x4'),_0xfdfa7a?_0xfdfa7a[_0x2707('0x5')](''):[]);},'get':function(){return this[_0x2707('0x6')](_0x2707('0x4'))?this[_0x2707('0x6')](_0x2707('0x4'))[_0x2707('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index bd6c915..fbefae9 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 _0x5d1e=['../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','Content-Range','apply','save','update','then','error','name','send','index','map','UserProfileSection','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','catch','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x39d7ca,_0x4b30cc){var _0xf38800=function(_0x2879c1){while(--_0x2879c1){_0x39d7ca['push'](_0x39d7ca['shift']());}};_0xf38800(++_0x4b30cc);}(_0x5d1e,0x1b0));var _0xe5d1=function(_0x3af265,_0x45fe72){_0x3af265=_0x3af265-0x0;var _0x17b752=_0x5d1e[_0x3af265];return _0x17b752;};'use strict';var emlformat=require(_0xe5d1('0x0'));var rimraf=require(_0xe5d1('0x1'));var zipdir=require(_0xe5d1('0x2'));var jsonpatch=require(_0xe5d1('0x3'));var rp=require(_0xe5d1('0x4'));var moment=require(_0xe5d1('0x5'));var BPromise=require(_0xe5d1('0x6'));var Mustache=require(_0xe5d1('0x7'));var util=require(_0xe5d1('0x8'));var path=require(_0xe5d1('0x9'));var sox=require(_0xe5d1('0xa'));var csv=require(_0xe5d1('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5d1('0xc'));var _=require(_0xe5d1('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5d1('0xe'));var deskjs=require(_0xe5d1('0xf'));var toCsv=require(_0xe5d1('0xb'));var querystring=require('querystring');var Papa=require(_0xe5d1('0x10'));var Redis=require(_0xe5d1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5d1('0x12'));var as=require(_0xe5d1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5d1('0x14'))('api');var utils=require(_0xe5d1('0x15'));var config=require(_0xe5d1('0x16'));var licenseUtil=require(_0xe5d1('0x17'));var db=require(_0xe5d1('0x18'))['db'];function respondWithStatusCode(_0x1886b2,_0x31e95a){_0x31e95a=_0x31e95a||0xcc;return function(_0x454603){if(_0x454603){return _0x1886b2[_0xe5d1('0x19')](_0x31e95a);}return _0x1886b2['status'](_0x31e95a)[_0xe5d1('0x1a')]();};}function respondWithResult(_0x1838a5,_0x3c0f89){_0x3c0f89=_0x3c0f89||0xc8;return function(_0x79b4a5){if(_0x79b4a5){return _0x1838a5['status'](_0x3c0f89)[_0xe5d1('0x1b')](_0x79b4a5);}};}function respondWithFilteredResult(_0x5176aa,_0x2a8a13){return function(_0x189aea){if(_0x189aea){var _0x216330=typeof _0x2a8a13[_0xe5d1('0x1c')]===_0xe5d1('0x1d')&&typeof _0x2a8a13[_0xe5d1('0x1e')]===_0xe5d1('0x1d');var _0x2a3f64=_0x189aea['count'];var _0x46a965=_0x216330?0x0:_0x2a8a13[_0xe5d1('0x1c')];var _0x3fc512=_0x216330?_0x189aea[_0xe5d1('0x1f')]:_0x2a8a13[_0xe5d1('0x1c')]+_0x2a8a13[_0xe5d1('0x1e')];var _0x508c9a;if(_0x3fc512>=_0x2a3f64){_0x3fc512=_0x2a3f64;_0x508c9a=0xc8;}else{_0x508c9a=0xce;}_0x5176aa[_0xe5d1('0x20')](_0x508c9a);return _0x5176aa['set'](_0xe5d1('0x21'),_0x46a965+'-'+_0x3fc512+'/'+_0x2a3f64)[_0xe5d1('0x1b')](_0x189aea);}return null;};}function patchUpdates(_0xf12797){return function(_0x118fc1){try{jsonpatch[_0xe5d1('0x22')](_0x118fc1,_0xf12797,!![]);}catch(_0xd4b0df){return BPromise['reject'](_0xd4b0df);}return _0x118fc1[_0xe5d1('0x23')]();};}function saveUpdates(_0xe1c606,_0x33a1f9){return function(_0x434832){if(_0x434832){return _0x434832[_0xe5d1('0x24')](_0xe1c606)[_0xe5d1('0x25')](function(_0x3083c1){return _0x3083c1;});}return null;};}function removeEntity(_0x5f5829,_0x64b8bb){return function(_0x5cb8d1){if(_0x5cb8d1){return _0x5cb8d1['destroy']()[_0xe5d1('0x25')](function(){_0x5f5829[_0xe5d1('0x20')](0xcc)[_0xe5d1('0x1a')]();});}};}function handleEntityNotFound(_0x2c633c,_0x567b9f){return function(_0x1d2af3){if(!_0x1d2af3){_0x2c633c['sendStatus'](0x194);}return _0x1d2af3;};}function handleError(_0x222bba,_0x72d919){_0x72d919=_0x72d919||0x1f4;return function(_0x21e4e6){logger[_0xe5d1('0x26')](_0x21e4e6['stack']);if(_0x21e4e6[_0xe5d1('0x27')]){delete _0x21e4e6[_0xe5d1('0x27')];}_0x222bba[_0xe5d1('0x20')](_0x72d919)[_0xe5d1('0x28')](_0x21e4e6);};}exports[_0xe5d1('0x29')]=function(_0x44b145,_0x1088ea){var _0x457fc4={},_0x5805ef={},_0x324e38={'count':0x0,'rows':[]};var _0x33b50f=_[_0xe5d1('0x2a')](db[_0xe5d1('0x2b')][_0xe5d1('0x2c')],function(_0x5d2b10){return{'name':_0x5d2b10['fieldName'],'type':_0x5d2b10[_0xe5d1('0x2d')][_0xe5d1('0x2e')]};});_0x5805ef['model']=_[_0xe5d1('0x2a')](_0x33b50f,'name');_0x5805ef[_0xe5d1('0x2f')]=_[_0xe5d1('0x30')](_0x44b145[_0xe5d1('0x2f')]);_0x5805ef[_0xe5d1('0x31')]=_[_0xe5d1('0x32')](_0x5805ef[_0xe5d1('0x33')],_0x5805ef[_0xe5d1('0x2f')]);_0x457fc4['attributes']=_[_0xe5d1('0x32')](_0x5805ef['model'],qs[_0xe5d1('0x34')](_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x34')]));_0x457fc4[_0xe5d1('0x35')]=_0x457fc4[_0xe5d1('0x35')][_0xe5d1('0x36')]?_0x457fc4[_0xe5d1('0x35')]:_0x5805ef[_0xe5d1('0x33')];if(!_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x37')](_0xe5d1('0x38'))){_0x457fc4[_0xe5d1('0x1e')]=qs['limit'](_0x44b145['query'][_0xe5d1('0x1e')]);_0x457fc4['offset']=qs[_0xe5d1('0x1c')](_0x44b145['query']['offset']);}_0x457fc4[_0xe5d1('0x39')]=qs[_0xe5d1('0x3a')](_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x3a')]);_0x457fc4['where']=qs[_0xe5d1('0x31')](_['pick'](_0x44b145['query'],_0x5805ef[_0xe5d1('0x31')]),_0x33b50f);if(_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x3b')]){_0x457fc4[_0xe5d1('0x3c')]=_[_0xe5d1('0x3d')](_0x457fc4[_0xe5d1('0x3c')],{'$or':_[_0xe5d1('0x2a')](_0x33b50f,function(_0x426ac8){if(_0x426ac8['type']!==_0xe5d1('0x3e')){var _0x170bd2={};_0x170bd2[_0x426ac8[_0xe5d1('0x27')]]={'$like':'%'+_0x44b145['query'][_0xe5d1('0x3b')]+'%'};return _0x170bd2;}})});}_0x457fc4=_[_0xe5d1('0x3d')]({},_0x457fc4,_0x44b145['options']);var _0x2e81dc={'where':_0x457fc4[_0xe5d1('0x3c')]};return db[_0xe5d1('0x2b')][_0xe5d1('0x1f')](_0x2e81dc)[_0xe5d1('0x25')](function(_0x4bd7f5){_0x324e38['count']=_0x4bd7f5;if(_0x44b145[_0xe5d1('0x2f')][_0xe5d1('0x3f')]){_0x457fc4['include']=[{'all':!![]}];}return db[_0xe5d1('0x2b')][_0xe5d1('0x40')](_0x457fc4);})[_0xe5d1('0x25')](function(_0x439bee){_0x324e38[_0xe5d1('0x41')]=_0x439bee;return _0x324e38;})[_0xe5d1('0x25')](respondWithFilteredResult(_0x1088ea,_0x457fc4))['catch'](handleError(_0x1088ea,null));};exports[_0xe5d1('0x42')]=function(_0x40001a,_0x31cfd){var _0x5d5523={'raw':![],'where':{'id':_0x40001a[_0xe5d1('0x43')]['id']}},_0x3633a8={};_0x3633a8['model']=_['keys'](db[_0xe5d1('0x2b')][_0xe5d1('0x2c')]);_0x3633a8[_0xe5d1('0x2f')]=_[_0xe5d1('0x30')](_0x40001a[_0xe5d1('0x2f')]);_0x3633a8[_0xe5d1('0x31')]=_[_0xe5d1('0x32')](_0x3633a8[_0xe5d1('0x33')],_0x3633a8['query']);_0x5d5523[_0xe5d1('0x35')]=_['intersection'](_0x3633a8[_0xe5d1('0x33')],qs[_0xe5d1('0x34')](_0x40001a['query']['fields']));_0x5d5523['attributes']=_0x5d5523[_0xe5d1('0x35')][_0xe5d1('0x36')]?_0x5d5523[_0xe5d1('0x35')]:_0x3633a8[_0xe5d1('0x33')];if(_0x40001a[_0xe5d1('0x2f')][_0xe5d1('0x3f')]){_0x5d5523[_0xe5d1('0x44')]=[{'all':!![]}];}_0x5d5523=_[_0xe5d1('0x3d')]({},_0x5d5523,_0x40001a[_0xe5d1('0x45')]);return db[_0xe5d1('0x2b')]['find'](_0x5d5523)[_0xe5d1('0x25')](handleEntityNotFound(_0x31cfd,null))[_0xe5d1('0x25')](respondWithResult(_0x31cfd,null))[_0xe5d1('0x46')](handleError(_0x31cfd,null));};exports[_0xe5d1('0x47')]=function(_0x3f0635,_0x454c29){return db['UserProfileSection'][_0xe5d1('0x47')](_0x3f0635[_0xe5d1('0x48')],{})['then'](respondWithResult(_0x454c29,0xc9))['catch'](handleError(_0x454c29,null));};exports[_0xe5d1('0x24')]=function(_0x378e71,_0xd03927){if(_0x378e71[_0xe5d1('0x48')]['id']){delete _0x378e71[_0xe5d1('0x48')]['id'];}return db[_0xe5d1('0x2b')][_0xe5d1('0x49')]({'where':{'id':_0x378e71['params']['id']}})[_0xe5d1('0x25')](handleEntityNotFound(_0xd03927,null))[_0xe5d1('0x25')](saveUpdates(_0x378e71[_0xe5d1('0x48')],null))[_0xe5d1('0x25')](respondWithResult(_0xd03927,null))[_0xe5d1('0x46')](handleError(_0xd03927,null));};exports[_0xe5d1('0x4a')]=function(_0xf4a0d6,_0x34c40b){return db[_0xe5d1('0x2b')][_0xe5d1('0x49')]({'where':{'id':_0xf4a0d6[_0xe5d1('0x43')]['id']}})['then'](handleEntityNotFound(_0x34c40b,null))['then'](removeEntity(_0x34c40b,null))['catch'](handleError(_0x34c40b,null));};exports[_0xe5d1('0x4b')]=function(_0x465239,_0x508973){return db['UserProfileSection'][_0xe5d1('0x4b')]()['then'](respondWithResult(_0x508973,null))[_0xe5d1('0x46')](handleError(_0x508973,null));}; \ No newline at end of file +var _0xfcbb=['rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','catch','show','params','UserProfileSection','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xfcbb,0x6d));var _0xbfcb=function(_0x498eb3,_0x536ff9){_0x498eb3=_0x498eb3-0x0;var _0x4338b4=_0xfcbb[_0x498eb3];return _0x4338b4;};'use strict';var emlformat=require(_0xbfcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbfcb('0x1'));var jsonpatch=require(_0xbfcb('0x2'));var rp=require(_0xbfcb('0x3'));var moment=require(_0xbfcb('0x4'));var BPromise=require(_0xbfcb('0x5'));var Mustache=require(_0xbfcb('0x6'));var util=require('util');var path=require('path');var sox=require(_0xbfcb('0x7'));var csv=require(_0xbfcb('0x8'));var ejs=require(_0xbfcb('0x9'));var fs=require('fs');var fs_extra=require(_0xbfcb('0xa'));var _=require('lodash');var squel=require(_0xbfcb('0xb'));var crypto=require(_0xbfcb('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbfcb('0x8'));var querystring=require(_0xbfcb('0xd'));var Papa=require(_0xbfcb('0xe'));var Redis=require(_0xbfcb('0xf'));var authService=require(_0xbfcb('0x10'));var qs=require(_0xbfcb('0x11'));var as=require(_0xbfcb('0x12'));var hardwareService=require(_0xbfcb('0x13'));var logger=require('../../config/logger')(_0xbfcb('0x14'));var utils=require(_0xbfcb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xbfcb('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fe1c7,_0x1e1413){_0x1e1413=_0x1e1413||0xcc;return function(_0x3363b7){if(_0x3363b7){return _0x3fe1c7[_0xbfcb('0x17')](_0x1e1413);}return _0x3fe1c7['status'](_0x1e1413)[_0xbfcb('0x18')]();};}function respondWithResult(_0x19347c,_0x460ab3){_0x460ab3=_0x460ab3||0xc8;return function(_0x1ef786){if(_0x1ef786){return _0x19347c[_0xbfcb('0x19')](_0x460ab3)[_0xbfcb('0x1a')](_0x1ef786);}};}function respondWithFilteredResult(_0x46d5ac,_0x4e85f6){return function(_0x4643ea){if(_0x4643ea){var _0x1542d4=typeof _0x4e85f6[_0xbfcb('0x1b')]===_0xbfcb('0x1c')&&typeof _0x4e85f6[_0xbfcb('0x1d')]===_0xbfcb('0x1c');var _0xd8e153=_0x4643ea[_0xbfcb('0x1e')];var _0x5a4b85=_0x1542d4?0x0:_0x4e85f6[_0xbfcb('0x1b')];var _0x5dfa96=_0x1542d4?_0x4643ea['count']:_0x4e85f6[_0xbfcb('0x1b')]+_0x4e85f6[_0xbfcb('0x1d')];var _0x8afeaf;if(_0x5dfa96>=_0xd8e153){_0x5dfa96=_0xd8e153;_0x8afeaf=0xc8;}else{_0x8afeaf=0xce;}_0x46d5ac[_0xbfcb('0x19')](_0x8afeaf);return _0x46d5ac[_0xbfcb('0x1f')](_0xbfcb('0x20'),_0x5a4b85+'-'+_0x5dfa96+'/'+_0xd8e153)[_0xbfcb('0x1a')](_0x4643ea);}return null;};}function patchUpdates(_0x3e75ae){return function(_0x174f71){try{jsonpatch['apply'](_0x174f71,_0x3e75ae,!![]);}catch(_0x185a20){return BPromise[_0xbfcb('0x21')](_0x185a20);}return _0x174f71[_0xbfcb('0x22')]();};}function saveUpdates(_0x353705,_0x1de3a3){return function(_0x16a43c){if(_0x16a43c){return _0x16a43c[_0xbfcb('0x23')](_0x353705)[_0xbfcb('0x24')](function(_0x4b82d6){return _0x4b82d6;});}return null;};}function removeEntity(_0xb11ee1,_0x5c3dcd){return function(_0x2bf70d){if(_0x2bf70d){return _0x2bf70d[_0xbfcb('0x25')]()[_0xbfcb('0x24')](function(){_0xb11ee1[_0xbfcb('0x19')](0xcc)[_0xbfcb('0x18')]();});}};}function handleEntityNotFound(_0x1c77a1,_0x597481){return function(_0x1014b2){if(!_0x1014b2){_0x1c77a1['sendStatus'](0x194);}return _0x1014b2;};}function handleError(_0xb7470,_0x1ed302){_0x1ed302=_0x1ed302||0x1f4;return function(_0x1a1766){logger[_0xbfcb('0x26')](_0x1a1766[_0xbfcb('0x27')]);if(_0x1a1766[_0xbfcb('0x28')]){delete _0x1a1766[_0xbfcb('0x28')];}_0xb7470[_0xbfcb('0x19')](_0x1ed302)[_0xbfcb('0x29')](_0x1a1766);};}exports[_0xbfcb('0x2a')]=function(_0x5b0df4,_0x54e089){var _0x1dbb03={},_0x334bc2={},_0x44350d={'count':0x0,'rows':[]};var _0x46466c=_['map'](db['UserProfileSection'][_0xbfcb('0x2b')],function(_0x1a81e0){return{'name':_0x1a81e0[_0xbfcb('0x2c')],'type':_0x1a81e0[_0xbfcb('0x2d')][_0xbfcb('0x2e')]};});_0x334bc2[_0xbfcb('0x2f')]=_[_0xbfcb('0x30')](_0x46466c,_0xbfcb('0x28'));_0x334bc2['query']=_[_0xbfcb('0x31')](_0x5b0df4[_0xbfcb('0x32')]);_0x334bc2[_0xbfcb('0x33')]=_[_0xbfcb('0x34')](_0x334bc2[_0xbfcb('0x2f')],_0x334bc2[_0xbfcb('0x32')]);_0x1dbb03[_0xbfcb('0x35')]=_[_0xbfcb('0x34')](_0x334bc2['model'],qs[_0xbfcb('0x36')](_0x5b0df4[_0xbfcb('0x32')][_0xbfcb('0x36')]));_0x1dbb03['attributes']=_0x1dbb03[_0xbfcb('0x35')][_0xbfcb('0x37')]?_0x1dbb03[_0xbfcb('0x35')]:_0x334bc2[_0xbfcb('0x2f')];if(!_0x5b0df4[_0xbfcb('0x32')][_0xbfcb('0x38')](_0xbfcb('0x39'))){_0x1dbb03[_0xbfcb('0x1d')]=qs[_0xbfcb('0x1d')](_0x5b0df4[_0xbfcb('0x32')][_0xbfcb('0x1d')]);_0x1dbb03['offset']=qs[_0xbfcb('0x1b')](_0x5b0df4[_0xbfcb('0x32')][_0xbfcb('0x1b')]);}_0x1dbb03[_0xbfcb('0x3a')]=qs[_0xbfcb('0x3b')](_0x5b0df4[_0xbfcb('0x32')]['sort']);_0x1dbb03['where']=qs[_0xbfcb('0x33')](_[_0xbfcb('0x3c')](_0x5b0df4['query'],_0x334bc2[_0xbfcb('0x33')]),_0x46466c);if(_0x5b0df4[_0xbfcb('0x32')][_0xbfcb('0x3d')]){_0x1dbb03[_0xbfcb('0x3e')]=_[_0xbfcb('0x3f')](_0x1dbb03[_0xbfcb('0x3e')],{'$or':_[_0xbfcb('0x30')](_0x46466c,function(_0x1639fb){if(_0x1639fb[_0xbfcb('0x2d')]!==_0xbfcb('0x40')){var _0x33f1b3={};_0x33f1b3[_0x1639fb[_0xbfcb('0x28')]]={'$like':'%'+_0x5b0df4[_0xbfcb('0x32')][_0xbfcb('0x3d')]+'%'};return _0x33f1b3;}})});}_0x1dbb03=_[_0xbfcb('0x3f')]({},_0x1dbb03,_0x5b0df4[_0xbfcb('0x41')]);var _0x6e72b6={'where':_0x1dbb03[_0xbfcb('0x3e')]};return db['UserProfileSection'][_0xbfcb('0x1e')](_0x6e72b6)[_0xbfcb('0x24')](function(_0xfeac08){_0x44350d['count']=_0xfeac08;if(_0x5b0df4['query']['includeAll']){_0x1dbb03['include']=[{'all':!![]}];}return db['UserProfileSection'][_0xbfcb('0x42')](_0x1dbb03);})[_0xbfcb('0x24')](function(_0x2ce4eb){_0x44350d['rows']=_0x2ce4eb;return _0x44350d;})[_0xbfcb('0x24')](respondWithFilteredResult(_0x54e089,_0x1dbb03))[_0xbfcb('0x43')](handleError(_0x54e089,null));};exports[_0xbfcb('0x44')]=function(_0x47965a,_0xa885ba){var _0x5eb0d2={'raw':![],'where':{'id':_0x47965a[_0xbfcb('0x45')]['id']}},_0x5da4a4={};_0x5da4a4[_0xbfcb('0x2f')]=_[_0xbfcb('0x31')](db[_0xbfcb('0x46')]['rawAttributes']);_0x5da4a4[_0xbfcb('0x32')]=_[_0xbfcb('0x31')](_0x47965a[_0xbfcb('0x32')]);_0x5da4a4[_0xbfcb('0x33')]=_[_0xbfcb('0x34')](_0x5da4a4[_0xbfcb('0x2f')],_0x5da4a4[_0xbfcb('0x32')]);_0x5eb0d2['attributes']=_[_0xbfcb('0x34')](_0x5da4a4[_0xbfcb('0x2f')],qs[_0xbfcb('0x36')](_0x47965a[_0xbfcb('0x32')][_0xbfcb('0x36')]));_0x5eb0d2[_0xbfcb('0x35')]=_0x5eb0d2[_0xbfcb('0x35')][_0xbfcb('0x37')]?_0x5eb0d2[_0xbfcb('0x35')]:_0x5da4a4[_0xbfcb('0x2f')];if(_0x47965a[_0xbfcb('0x32')][_0xbfcb('0x47')]){_0x5eb0d2['include']=[{'all':!![]}];}_0x5eb0d2=_[_0xbfcb('0x3f')]({},_0x5eb0d2,_0x47965a[_0xbfcb('0x41')]);return db[_0xbfcb('0x46')][_0xbfcb('0x48')](_0x5eb0d2)[_0xbfcb('0x24')](handleEntityNotFound(_0xa885ba,null))[_0xbfcb('0x24')](respondWithResult(_0xa885ba,null))['catch'](handleError(_0xa885ba,null));};exports[_0xbfcb('0x49')]=function(_0x523ffe,_0x2d960d){return db[_0xbfcb('0x46')][_0xbfcb('0x49')](_0x523ffe['body'],{})[_0xbfcb('0x24')](respondWithResult(_0x2d960d,0xc9))[_0xbfcb('0x43')](handleError(_0x2d960d,null));};exports['update']=function(_0xec53f8,_0x3260b9){if(_0xec53f8[_0xbfcb('0x4a')]['id']){delete _0xec53f8[_0xbfcb('0x4a')]['id'];}return db[_0xbfcb('0x46')][_0xbfcb('0x48')]({'where':{'id':_0xec53f8[_0xbfcb('0x45')]['id']}})[_0xbfcb('0x24')](handleEntityNotFound(_0x3260b9,null))['then'](saveUpdates(_0xec53f8[_0xbfcb('0x4a')],null))['then'](respondWithResult(_0x3260b9,null))[_0xbfcb('0x43')](handleError(_0x3260b9,null));};exports[_0xbfcb('0x25')]=function(_0x28b491,_0x493fe6){return db[_0xbfcb('0x46')]['find']({'where':{'id':_0x28b491[_0xbfcb('0x45')]['id']}})['then'](handleEntityNotFound(_0x493fe6,null))['then'](removeEntity(_0x493fe6,null))[_0xbfcb('0x43')](handleError(_0x493fe6,null));};exports[_0xbfcb('0x4b')]=function(_0x3d53c2,_0x5a1402){return db[_0xbfcb('0x46')][_0xbfcb('0x4b')]()[_0xbfcb('0x24')](respondWithResult(_0x5a1402,null))[_0xbfcb('0x43')](handleError(_0x5a1402,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index c589aea..ffd10c7 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 _0x7e2b=['api','bluebird','request-promise','rimraf','../../config/environment','exports','define','UserProfileSection','compositeIndex','lodash','util'];(function(_0x5ad22d,_0x21efb3){var _0x5bcc79=function(_0x448f1a){while(--_0x448f1a){_0x5ad22d['push'](_0x5ad22d['shift']());}};_0x5bcc79(++_0x21efb3);}(_0x7e2b,0x13d));var _0xb7e2=function(_0xb77d35,_0x291854){_0xb77d35=_0xb77d35-0x0;var _0x5389a8=_0x7e2b[_0xb77d35];return _0x5389a8;};'use strict';var _=require(_0xb7e2('0x0'));var util=require(_0xb7e2('0x1'));var logger=require('../../config/logger')(_0xb7e2('0x2'));var moment=require('moment');var BPromise=require(_0xb7e2('0x3'));var rp=require(_0xb7e2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb7e2('0x5'));var config=require(_0xb7e2('0x6'));var attributes=require('./userProfileSection.attributes');module[_0xb7e2('0x7')]=function(_0x352bf4,_0x1a3308){return _0x352bf4[_0xb7e2('0x8')](_0xb7e2('0x9'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xb7e2('0xa'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8f8=['./userProfileSection.attributes','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x279f44,_0x532755){var _0xf73115=function(_0x528662){while(--_0x528662){_0x279f44['push'](_0x279f44['shift']());}};_0xf73115(++_0x532755);}(_0xc8f8,0xf7));var _0x8c8f=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xc8f8[_0x341e0f];return _0x59555a;};'use strict';var _=require(_0x8c8f('0x0'));var util=require('util');var logger=require(_0x8c8f('0x1'))(_0x8c8f('0x2'));var moment=require(_0x8c8f('0x3'));var BPromise=require(_0x8c8f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c8f('0x5'));var rimraf=require(_0x8c8f('0x6'));var config=require(_0x8c8f('0x7'));var attributes=require(_0x8c8f('0x8'));module[_0x8c8f('0x9')]=function(_0x1cbdb1,_0x6dcf7f){return _0x1cbdb1['define'](_0x8c8f('0xa'),attributes,{'tableName':_0x8c8f('0xb'),'paranoid':![],'indexes':[{'name':_0x8c8f('0xc'),'fields':[_0x8c8f('0xd'),_0x8c8f('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 1e2d7f4..60d975c 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 _0x2f92=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','moment','bluebird','ioredis'];(function(_0xea6d16,_0x11c300){var _0x59662c=function(_0xc2fdb0){while(--_0xc2fdb0){_0xea6d16['push'](_0xea6d16['shift']());}};_0x59662c(++_0x11c300);}(_0x2f92,0xe2));var _0x22f9=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0x2f92[_0x2f3848];return _0x102668;};'use strict';var _=require(_0x22f9('0x0'));var util=require('util');var moment=require(_0x22f9('0x1'));var BPromise=require(_0x22f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x22f9('0x3'));var db=require(_0x22f9('0x4'))['db'];var utils=require(_0x22f9('0x5'));var logger=require(_0x22f9('0x6'))(_0x22f9('0x7'));var config=require(_0x22f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x22f9('0x9')][_0x22f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3bce5d,_0x2c8b99,_0x49c971){return new BPromise(function(_0x1166eb,_0x261d90){return client['request'](_0x3bce5d,_0x49c971)[_0x22f9('0xb')](function(_0x317362){logger['info'](_0x22f9('0xc'),_0x2c8b99,'request\x20sent');logger[_0x22f9('0xd')](_0x22f9('0xe'),_0x2c8b99,_0x22f9('0xf'),JSON[_0x22f9('0x10')](_0x317362));if(_0x317362['error']){if(_0x317362[_0x22f9('0x11')][_0x22f9('0x12')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2c8b99,_0x317362[_0x22f9('0x11')]['message']);return _0x261d90(_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);}logger[_0x22f9('0x11')](_0x22f9('0xc'),_0x2c8b99,_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);return _0x1166eb(_0x317362[_0x22f9('0x11')][_0x22f9('0x13')]);}else{logger[_0x22f9('0x14')](_0x22f9('0xc'),_0x2c8b99,_0x22f9('0xf'));_0x1166eb(_0x317362[_0x22f9('0x15')]['message']);}})[_0x22f9('0x16')](function(_0x2c75bf){logger['error'](_0x22f9('0xc'),_0x2c8b99,_0x2c75bf);_0x261d90(_0x2c75bf);});});} \ No newline at end of file +var _0x4ffa=['code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32b00a,_0x3632cd){var _0x2e00ab=function(_0x12b7a9){while(--_0x12b7a9){_0x32b00a['push'](_0x32b00a['shift']());}};_0x2e00ab(++_0x3632cd);}(_0x4ffa,0x130));var _0xa4ff=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x4ffa[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xa4ff('0x0'));var util=require(_0xa4ff('0x1'));var moment=require('moment');var BPromise=require(_0xa4ff('0x2'));var rs=require(_0xa4ff('0x3'));var fs=require('fs');var Redis=require(_0xa4ff('0x4'));var db=require(_0xa4ff('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa4ff('0x6'))('rpc');var config=require(_0xa4ff('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa4ff('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1256a1,_0x2b21e1,_0x160e7b){return new BPromise(function(_0x487007,_0x3412c9){return client['request'](_0x1256a1,_0x160e7b)[_0xa4ff('0x9')](function(_0x2c15b6){logger[_0xa4ff('0xa')](_0xa4ff('0xb'),_0x2b21e1,_0xa4ff('0xc'));logger['debug'](_0xa4ff('0xd'),_0x2b21e1,_0xa4ff('0xc'),JSON[_0xa4ff('0xe')](_0x2c15b6));if(_0x2c15b6[_0xa4ff('0xf')]){if(_0x2c15b6['error'][_0xa4ff('0x10')]===0x1f4){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2b21e1,_0x2c15b6['error'][_0xa4ff('0x11')]);return _0x3412c9(_0x2c15b6[_0xa4ff('0xf')]['message']);}logger[_0xa4ff('0xf')]('UserProfileSection,\x20%s,\x20%s',_0x2b21e1,_0x2c15b6[_0xa4ff('0xf')][_0xa4ff('0x11')]);return _0x487007(_0x2c15b6[_0xa4ff('0xf')]['message']);}else{logger[_0xa4ff('0xa')]('UserProfileSection,\x20%s,\x20%s',_0x2b21e1,'request\x20sent');_0x487007(_0x2c15b6[_0xa4ff('0x12')]['message']);}})[_0xa4ff('0x13')](function(_0x39e608){logger['error']('UserProfileSection,\x20%s,\x20%s',_0x2b21e1,_0x39e608);_0x3412c9(_0x39e608);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ba32a88..23f1dd1 100644 --- a/server/api/userSmsQueue/index.js +++ b/server/api/userSmsQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x428355,_0x362fd6){var _0x2c8c5a=function(_0x579cbf){while(--_0x579cbf){_0x428355['push'](_0x428355['shift']());}};_0x2c8c5a(++_0x362fd6);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5b30de,_0x5470ee){var _0x3b45d8=function(_0x56aa3a){while(--_0x56aa3a){_0x5b30de['push'](_0x5b30de['shift']());}};_0x3b45d8(++_0x5470ee);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f8d0a12..105d042 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 _0xedeb=['sequelize','exports','INTEGER'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xedeb,0x114));var _0xbede=function(_0x5be892,_0x68238a){_0x5be892=_0x5be892-0x0;var _0x53fc35=_0xedeb[_0x5be892];return _0x53fc35;};'use strict';var Sequelize=require(_0xbede('0x0'));module[_0xbede('0x1')]={'penalty':{'type':Sequelize[_0xbede('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x525d=['sequelize','exports','INTEGER'];(function(_0x3a8964,_0x442434){var _0x23d342=function(_0x13eae2){while(--_0x13eae2){_0x3a8964['push'](_0x3a8964['shift']());}};_0x23d342(++_0x442434);}(_0x525d,0x15c));var _0xd525=function(_0x221e5b,_0x2f11a8){_0x221e5b=_0x221e5b-0x0;var _0x19d04e=_0x525d[_0x221e5b];return _0x19d04e;};'use strict';var Sequelize=require(_0xd525('0x0'));module[_0xd525('0x1')]={'penalty':{'type':Sequelize[_0xd525('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index fdd9a4b..6c5509b 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 _0x4ccb=['util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','exports','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x4a2858,_0x4dffde){var _0x567858=function(_0x107490){while(--_0x107490){_0x4a2858['push'](_0x4a2858['shift']());}};_0x567858(++_0x4dffde);}(_0x4ccb,0x196));var _0xb4cc=function(_0x50d46e,_0x20b9ed){_0x50d46e=_0x50d46e-0x0;var _0x1a0d9f=_0x4ccb[_0x50d46e];return _0x1a0d9f;};'use strict';var _=require(_0xb4cc('0x0'));var util=require(_0xb4cc('0x1'));var logger=require(_0xb4cc('0x2'))('api');var moment=require(_0xb4cc('0x3'));var BPromise=require(_0xb4cc('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb4cc('0x5'));var rimraf=require(_0xb4cc('0x6'));var config=require(_0xb4cc('0x7'));var attributes=require('./userSmsQueue.attributes');module[_0xb4cc('0x8')]=function(_0x2181b2,_0x1e19dd){return _0x2181b2['define'](_0xb4cc('0x9'),attributes,{'tableName':_0xb4cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0adf=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','define','UserSmsQueue','user_has_sms_queues','lodash','util'];(function(_0xe206ed,_0x179821){var _0x4423ab=function(_0x2668d2){while(--_0x2668d2){_0xe206ed['push'](_0xe206ed['shift']());}};_0x4423ab(++_0x179821);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x39907b,_0x450e0e){_0x39907b=_0x39907b-0x0;var _0x38fdbd=_0x0adf[_0x39907b];return _0x38fdbd;};'use strict';var _=require(_0xf0ad('0x0'));var util=require(_0xf0ad('0x1'));var logger=require(_0xf0ad('0x2'))('api');var moment=require(_0xf0ad('0x3'));var BPromise=require(_0xf0ad('0x4'));var rp=require(_0xf0ad('0x5'));var fs=require('fs');var path=require(_0xf0ad('0x6'));var rimraf=require(_0xf0ad('0x7'));var config=require(_0xf0ad('0x8'));var attributes=require(_0xf0ad('0x9'));module['exports']=function(_0x3bbf85,_0x53221f){return _0x3bbf85[_0xf0ad('0xa')](_0xf0ad('0xb'),attributes,{'tableName':_0xf0ad('0xc'),'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 036eafb..4613026 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 _0x03f0=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x5aa582,_0x20267a){var _0x28cd1a=function(_0xce2031){while(--_0xce2031){_0x5aa582['push'](_0x5aa582['shift']());}};_0x28cd1a(++_0x20267a);}(_0x03f0,0x95));var _0x003f=function(_0x3bcde6,_0x4aad58){_0x3bcde6=_0x3bcde6-0x0;var _0x25b0f8=_0x03f0[_0x3bcde6];return _0x25b0f8;};'use strict';var _=require('lodash');var util=require(_0x003f('0x0'));var moment=require(_0x003f('0x1'));var BPromise=require(_0x003f('0x2'));var rs=require(_0x003f('0x3'));var fs=require('fs');var Redis=require(_0x003f('0x4'));var db=require(_0x003f('0x5'))['db'];var utils=require(_0x003f('0x6'));var logger=require(_0x003f('0x7'))(_0x003f('0x8'));var config=require(_0x003f('0x9'));var jayson=require(_0x003f('0xa'));var client=jayson[_0x003f('0xb')][_0x003f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x123589,_0x30b91a,_0x29f582){return new BPromise(function(_0x248f1b,_0x15fe1d){return client[_0x003f('0xd')](_0x123589,_0x29f582)[_0x003f('0xe')](function(_0xc0323d){logger[_0x003f('0xf')](_0x003f('0x10'),_0x30b91a,_0x003f('0x11'));logger[_0x003f('0x12')](_0x003f('0x13'),_0x30b91a,'request\x20sent',JSON[_0x003f('0x14')](_0xc0323d));if(_0xc0323d[_0x003f('0x15')]){if(_0xc0323d['error'][_0x003f('0x16')]===0x1f4){logger['error'](_0x003f('0x10'),_0x30b91a,_0xc0323d[_0x003f('0x15')]['message']);return _0x15fe1d(_0xc0323d[_0x003f('0x15')][_0x003f('0x17')]);}logger[_0x003f('0x15')](_0x003f('0x10'),_0x30b91a,_0xc0323d['error'][_0x003f('0x17')]);return _0x248f1b(_0xc0323d[_0x003f('0x15')]['message']);}else{logger[_0x003f('0xf')](_0x003f('0x10'),_0x30b91a,'request\x20sent');_0x248f1b(_0xc0323d['result'][_0x003f('0x17')]);}})[_0x003f('0x18')](function(_0x55a2d1){logger[_0x003f('0x15')](_0x003f('0x10'),_0x30b91a,_0x55a2d1);_0x15fe1d(_0x55a2d1);});});} \ No newline at end of file +var _0x367e=['UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1d3d45,_0x7afc99){var _0x170d92=function(_0x3fa5d9){while(--_0x3fa5d9){_0x1d3d45['push'](_0x1d3d45['shift']());}};_0x170d92(++_0x7afc99);}(_0x367e,0x126));var _0xe367=function(_0x5aada8,_0x460a35){_0x5aada8=_0x5aada8-0x0;var _0xf5247e=_0x367e[_0x5aada8];return _0xf5247e;};'use strict';var _=require(_0xe367('0x0'));var util=require(_0xe367('0x1'));var moment=require('moment');var BPromise=require(_0xe367('0x2'));var rs=require(_0xe367('0x3'));var fs=require('fs');var Redis=require(_0xe367('0x4'));var db=require(_0xe367('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe367('0x6'))(_0xe367('0x7'));var config=require(_0xe367('0x8'));var jayson=require(_0xe367('0x9'));var client=jayson[_0xe367('0xa')][_0xe367('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b6538,_0x51d140,_0x253e0f){return new BPromise(function(_0xc1305c,_0x3f02d2){return client[_0xe367('0xc')](_0x2b6538,_0x253e0f)[_0xe367('0xd')](function(_0xd8649e){logger[_0xe367('0xe')](_0xe367('0xf'),_0x51d140,_0xe367('0x10'));logger[_0xe367('0x11')](_0xe367('0x12'),_0x51d140,_0xe367('0x10'),JSON['stringify'](_0xd8649e));if(_0xd8649e[_0xe367('0x13')]){if(_0xd8649e[_0xe367('0x13')][_0xe367('0x14')]===0x1f4){logger['error'](_0xe367('0xf'),_0x51d140,_0xd8649e[_0xe367('0x13')]['message']);return _0x3f02d2(_0xd8649e[_0xe367('0x13')]['message']);}logger['error'](_0xe367('0xf'),_0x51d140,_0xd8649e[_0xe367('0x13')][_0xe367('0x15')]);return _0xc1305c(_0xd8649e[_0xe367('0x13')]['message']);}else{logger[_0xe367('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x51d140,_0xe367('0x10'));_0xc1305c(_0xd8649e[_0xe367('0x16')][_0xe367('0x15')]);}})[_0xe367('0x17')](function(_0xb7220c){logger[_0xe367('0x13')](_0xe367('0xf'),_0x51d140,_0xb7220c);_0x3f02d2(_0xb7220c);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index b035377..68dd67a 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 _0x8bd9=['exports','sequelize'];(function(_0x57975f,_0x388556){var _0x4793b8=function(_0x652c05){while(--_0x652c05){_0x57975f['push'](_0x57975f['shift']());}};_0x4793b8(++_0x388556);}(_0x8bd9,0x191));var _0x98bd=function(_0x6cf3b6,_0x4b7560){_0x6cf3b6=_0x6cf3b6-0x0;var _0xdbe948=_0x8bd9[_0x6cf3b6];return _0xdbe948;};'use strict';var Sequelize=require(_0x98bd('0x0'));module[_0x98bd('0x1')]={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x2dd8=['exports','INTEGER','sequelize'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x2dd8,0x170));var _0x82dd=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2dd8[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x82dd('0x0'));module[_0x82dd('0x1')]={'UserId':{'type':Sequelize[_0x82dd('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x82dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0a919d6..d99fc7b 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(_0x39f767,_0x37031b){var _0xe88cf6=function(_0x374677){while(--_0x374677){_0x39f767['push'](_0x39f767['shift']());}};_0xe88cf6(++_0x37031b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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(_0xdc2def,_0x46d89b){var _0x45a44b=function(_0x217703){while(--_0x217703){_0xdc2def['push'](_0xdc2def['shift']());}};_0x45a44b(++_0x46d89b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 81464ee..28ff899 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(_0x37a348,_0xc4d184){var _0x497dea=function(_0x280e51){while(--_0x280e51){_0x37a348['push'](_0x37a348['shift']());}};_0x497dea(++_0xc4d184);}(_0xe706,0xa3));var _0x6e70=function(_0x313a00,_0x107929){_0x313a00=_0x313a00-0x0;var _0x46d07b=_0xe706[_0x313a00];return _0x46d07b;};'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(_0x33ebf5,_0x258ec6){var _0x66957b=function(_0x49739a){while(--_0x49739a){_0x33ebf5['push'](_0x33ebf5['shift']());}};_0x66957b(++_0x258ec6);}(_0x9c44,0x178));var _0x49c4=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x9c44[_0xb0f7c3];return _0x28ea68;};'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 4ed6744..8dad287 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 _0x20e1=['INTEGER','sequelize','exports'];(function(_0x14acf7,_0x4d077e){var _0x2557d6=function(_0x5db867){while(--_0x5db867){_0x14acf7['push'](_0x14acf7['shift']());}};_0x2557d6(++_0x4d077e);}(_0x20e1,0x139));var _0x120e=function(_0xaf0996,_0x3ee642){_0xaf0996=_0xaf0996-0x0;var _0x8fde5a=_0x20e1[_0xaf0996];return _0x8fde5a;};'use strict';var Sequelize=require(_0x120e('0x0'));module[_0x120e('0x1')]={'penalty':{'type':Sequelize[_0x120e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6f0d=['INTEGER','sequelize'];(function(_0x58f012,_0x2dce4e){var _0x3d7842=function(_0x3dc3ea){while(--_0x3dc3ea){_0x58f012['push'](_0x58f012['shift']());}};_0x3d7842(++_0x2dce4e);}(_0x6f0d,0x1e5));var _0xd6f0=function(_0x5bd6d9,_0x51aa71){_0x5bd6d9=_0x5bd6d9-0x0;var _0x32dab4=_0x6f0d[_0x5bd6d9];return _0x32dab4;};'use strict';var Sequelize=require(_0xd6f0('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd6f0('0x1')],'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 6804285..80f583c 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 _0x391c=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueue.attributes','define','user_has_voice_queues','util'];(function(_0x2a3cb2,_0x55280a){var _0x4120af=function(_0x2f470c){while(--_0x2f470c){_0x2a3cb2['push'](_0x2a3cb2['shift']());}};_0x4120af(++_0x55280a);}(_0x391c,0xd0));var _0xc391=function(_0x4b9e01,_0xdd6b1b){_0x4b9e01=_0x4b9e01-0x0;var _0x2092ae=_0x391c[_0x4b9e01];return _0x2092ae;};'use strict';var _=require('lodash');var util=require(_0xc391('0x0'));var logger=require(_0xc391('0x1'))(_0xc391('0x2'));var moment=require(_0xc391('0x3'));var BPromise=require(_0xc391('0x4'));var rp=require(_0xc391('0x5'));var fs=require('fs');var path=require(_0xc391('0x6'));var rimraf=require(_0xc391('0x7'));var config=require('../../config/environment');var attributes=require(_0xc391('0x8'));module['exports']=function(_0x4012e3,_0x1965f0){return _0x4012e3[_0xc391('0x9')]('UserVoiceQueue',attributes,{'tableName':_0xc391('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x95c6=['../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues','lodash','util','api','moment','request-promise'];(function(_0x2cc711,_0x300328){var _0x31a52e=function(_0x588378){while(--_0x588378){_0x2cc711['push'](_0x2cc711['shift']());}};_0x31a52e(++_0x300328);}(_0x95c6,0xe1));var _0x695c=function(_0x515b55,_0x54a9b6){_0x515b55=_0x515b55-0x0;var _0x6e6108=_0x95c6[_0x515b55];return _0x6e6108;};'use strict';var _=require(_0x695c('0x0'));var util=require(_0x695c('0x1'));var logger=require('../../config/logger')(_0x695c('0x2'));var moment=require(_0x695c('0x3'));var BPromise=require('bluebird');var rp=require(_0x695c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x695c('0x5'));var attributes=require(_0x695c('0x6'));module['exports']=function(_0x212499,_0x4c16d6){return _0x212499[_0x695c('0x7')](_0x695c('0x8'),attributes,{'tableName':_0x695c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index 8c66fa6..b9cb714 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 _0x040b=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug'];(function(_0xcd6ec5,_0x34e983){var _0x8e7b0b=function(_0x217d41){while(--_0x217d41){_0xcd6ec5['push'](_0xcd6ec5['shift']());}};_0x8e7b0b(++_0x34e983);}(_0x040b,0xf9));var _0xb040=function(_0x2197eb,_0x432efa){_0x2197eb=_0x2197eb-0x0;var _0x13ade6=_0x040b[_0x2197eb];return _0x13ade6;};'use strict';var _=require(_0xb040('0x0'));var util=require(_0xb040('0x1'));var moment=require(_0xb040('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb040('0x3'));var db=require(_0xb040('0x4'))['db'];var utils=require(_0xb040('0x5'));var logger=require(_0xb040('0x6'))(_0xb040('0x7'));var config=require(_0xb040('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb040('0x9')][_0xb040('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b13d5,_0x408905,_0x293ac7){return new BPromise(function(_0x4dc0fa,_0x2d7f21){return client['request'](_0x1b13d5,_0x293ac7)[_0xb040('0xb')](function(_0x4e9086){logger[_0xb040('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x408905,_0xb040('0xd'));logger[_0xb040('0xe')](_0xb040('0xf'),_0x408905,_0xb040('0xd'),JSON[_0xb040('0x10')](_0x4e9086));if(_0x4e9086[_0xb040('0x11')]){if(_0x4e9086[_0xb040('0x11')][_0xb040('0x12')]===0x1f4){logger['error'](_0xb040('0x13'),_0x408905,_0x4e9086['error'][_0xb040('0x14')]);return _0x2d7f21(_0x4e9086[_0xb040('0x11')][_0xb040('0x14')]);}logger[_0xb040('0x11')](_0xb040('0x13'),_0x408905,_0x4e9086[_0xb040('0x11')][_0xb040('0x14')]);return _0x4dc0fa(_0x4e9086['error'][_0xb040('0x14')]);}else{logger[_0xb040('0xc')](_0xb040('0x13'),_0x408905,_0xb040('0xd'));_0x4dc0fa(_0x4e9086[_0xb040('0x15')][_0xb040('0x14')]);}})['catch'](function(_0x384353){logger[_0xb040('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x408905,_0x384353);_0x2d7f21(_0x384353);});});} \ No newline at end of file +var _0xbf49=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xbf49,0x126));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9bf4('0x0'));var util=require(_0x9bf4('0x1'));var moment=require(_0x9bf4('0x2'));var BPromise=require(_0x9bf4('0x3'));var rs=require(_0x9bf4('0x4'));var fs=require('fs');var Redis=require(_0x9bf4('0x5'));var db=require(_0x9bf4('0x6'))['db'];var utils=require(_0x9bf4('0x7'));var logger=require(_0x9bf4('0x8'))(_0x9bf4('0x9'));var config=require(_0x9bf4('0xa'));var jayson=require(_0x9bf4('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1c4d1e,_0x3c276f,_0xc3ebe1){return new BPromise(function(_0x17971b,_0x57ec5d){return client[_0x9bf4('0xc')](_0x1c4d1e,_0xc3ebe1)['then'](function(_0x3b74b3){logger['info'](_0x9bf4('0xd'),_0x3c276f,_0x9bf4('0xe'));logger[_0x9bf4('0xf')](_0x9bf4('0x10'),_0x3c276f,_0x9bf4('0xe'),JSON[_0x9bf4('0x11')](_0x3b74b3));if(_0x3b74b3['error']){if(_0x3b74b3['error'][_0x9bf4('0x12')]===0x1f4){logger[_0x9bf4('0x13')](_0x9bf4('0xd'),_0x3c276f,_0x3b74b3[_0x9bf4('0x13')][_0x9bf4('0x14')]);return _0x57ec5d(_0x3b74b3['error']['message']);}logger['error'](_0x9bf4('0xd'),_0x3c276f,_0x3b74b3[_0x9bf4('0x13')]['message']);return _0x17971b(_0x3b74b3[_0x9bf4('0x13')]['message']);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3c276f,_0x9bf4('0xe'));_0x17971b(_0x3b74b3['result'][_0x9bf4('0x14')]);}})['catch'](function(_0x2f818e){logger['error'](_0x9bf4('0xd'),_0x3c276f,_0x2f818e);_0x57ec5d(_0x2f818e);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 35c78bc..212813d 100644 --- a/server/api/userVoiceQueueRt/index.js +++ b/server/api/userVoiceQueueRt/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x261643,_0x192def){var _0x56e3cb=function(_0x37da46){while(--_0x37da46){_0x261643['push'](_0x261643['shift']());}};_0x56e3cb(++_0x192def);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x136a0d,_0x476fe2){_0x136a0d=_0x136a0d-0x0;var _0x212ea5=_0xcb91[_0x136a0d];return _0x212ea5;};'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(_0x450199,_0x527446){var _0x551bf2=function(_0x4a5fb6){while(--_0x4a5fb6){_0x450199['push'](_0x450199['shift']());}};_0x551bf2(++_0x527446);}(_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 80976d7..2225b07 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 _0xc9e6=['queue_interface','INTEGER','Required\x20by\x20Asterisk','STRING'];(function(_0x1d472e,_0x181da6){var _0x9344b3=function(_0x1c4402){while(--_0x1c4402){_0x1d472e['push'](_0x1d472e['shift']());}};_0x9344b3(++_0x181da6);}(_0xc9e6,0x1a9));var _0x6c9e=function(_0x45ad02,_0x26cd82){_0x45ad02=_0x45ad02-0x0;var _0x1cac12=_0xc9e6[_0x45ad02];return _0x1cac12;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x6c9e('0x0')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x6c9e('0x1')},'membername':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'comment':_0x6c9e('0x1')},'UserId':{'type':Sequelize[_0x6c9e('0x0')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x6c9e('0x3'),'comment':_0x6c9e('0x1')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x6c9e('0x2')],'allowNull':![],'unique':_0x6c9e('0x3'),'comment':_0x6c9e('0x1')},'penalty':{'type':Sequelize[_0x6c9e('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0x6c9e('0x0')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x49fb=['Required\x20by\x20Asterisk','STRING','queue_interface','INTEGER','sequelize','exports'];(function(_0x584baf,_0x444df7){var _0x119419=function(_0x34f375){while(--_0x34f375){_0x584baf['push'](_0x584baf['shift']());}};_0x119419(++_0x444df7);}(_0x49fb,0x10c));var _0xb49f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x49fb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb49f('0x0'));module[_0xb49f('0x1')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0xb49f('0x2')},'membername':{'type':Sequelize[_0xb49f('0x3')],'allowNull':![],'comment':_0xb49f('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xb49f('0x3')],'allowNull':![],'unique':_0xb49f('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xb49f('0x5')],'allowNull':![]},'interface':{'type':Sequelize[_0xb49f('0x3')],'allowNull':![],'unique':_0xb49f('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb49f('0x2')},'paused':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xb49f('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 87d4505..f7e3415 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 _0x5067=['emit','hook','exports','events','UserVoiceQueueRt','setMaxListeners','remove'];(function(_0x3b93ca,_0x1e8709){var _0x1b0d9c=function(_0x80ab81){while(--_0x80ab81){_0x3b93ca['push'](_0x3b93ca['shift']());}};_0x1b0d9c(++_0x1e8709);}(_0x5067,0xe3));var _0x7506=function(_0x20bb88,_0x4abe7f){_0x20bb88=_0x20bb88-0x0;var _0x8a8aab=_0x5067[_0x20bb88];return _0x8a8aab;};'use strict';var EventEmitter=require(_0x7506('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x7506('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x7506('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7506('0x3')};function emitEvent(_0x5291e7){return function(_0x501c42,_0x178691,_0x3e23ff){UserVoiceQueueRtEvents['emit'](_0x5291e7+':'+_0x501c42['id'],_0x501c42);UserVoiceQueueRtEvents[_0x7506('0x4')](_0x5291e7,_0x501c42);_0x3e23ff(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x7506('0x5')](e,emitEvent(event));}}module[_0x7506('0x6')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xf406=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x4fb47c,_0x68346){var _0x46768a=function(_0x4bd704){while(--_0x4bd704){_0x4fb47c['push'](_0x4fb47c['shift']());}};_0x46768a(++_0x68346);}(_0xf406,0xbb));var _0x6f40=function(_0x4b1012,_0x1415eb){_0x4b1012=_0x4b1012-0x0;var _0x23d715=_0xf406[_0x4b1012];return _0x23d715;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x6f40('0x0'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6f40('0x1')](0x0);var events={'afterCreate':_0x6f40('0x2'),'afterUpdate':_0x6f40('0x3'),'afterDestroy':_0x6f40('0x4')};function emitEvent(_0x4a2191){return function(_0x36ed7d,_0x42b192,_0x48978c){UserVoiceQueueRtEvents[_0x6f40('0x5')](_0x4a2191+':'+_0x36ed7d['id'],_0x36ed7d);UserVoiceQueueRtEvents[_0x6f40('0x5')](_0x4a2191,_0x36ed7d);_0x48978c(null);};}for(var e in events){if(events[_0x6f40('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x6f40('0x7')](e,emitEvent(event));}}module[_0x6f40('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index ea4cfbe..9057fd2 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 _0xc520=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util'];(function(_0x5df98f,_0x140e19){var _0x4e6900=function(_0xe73e1a){while(--_0xe73e1a){_0x5df98f['push'](_0x5df98f['shift']());}};_0x4e6900(++_0x140e19);}(_0xc520,0x112));var _0x0c52=function(_0x3324f7,_0x31218f){_0x3324f7=_0x3324f7-0x0;var _0x3f27a3=_0xc520[_0x3324f7];return _0x3f27a3;};'use strict';var _=require(_0x0c52('0x0'));var util=require(_0x0c52('0x1'));var logger=require(_0x0c52('0x2'))('api');var moment=require(_0x0c52('0x3'));var BPromise=require(_0x0c52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0c52('0x5'));var rimraf=require(_0x0c52('0x6'));var config=require(_0x0c52('0x7'));var attributes=require(_0x0c52('0x8'));module['exports']=function(_0x566e13,_0x42058a){return _0x566e13[_0x0c52('0x9')](_0x0c52('0xa'),attributes,{'tableName':_0x0c52('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01b5=['./userVoiceQueueRt.attributes','define','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x209302,_0x5826ac){var _0x1df8e9=function(_0x16ae49){while(--_0x16ae49){_0x209302['push'](_0x209302['shift']());}};_0x1df8e9(++_0x5826ac);}(_0x01b5,0x110));var _0x501b=function(_0x30a8e4,_0x6fc828){_0x30a8e4=_0x30a8e4-0x0;var _0x2752da=_0x01b5[_0x30a8e4];return _0x2752da;};'use strict';var _=require(_0x501b('0x0'));var util=require('util');var logger=require(_0x501b('0x1'))(_0x501b('0x2'));var moment=require(_0x501b('0x3'));var BPromise=require('bluebird');var rp=require(_0x501b('0x4'));var fs=require('fs');var path=require(_0x501b('0x5'));var rimraf=require(_0x501b('0x6'));var config=require(_0x501b('0x7'));var attributes=require(_0x501b('0x8'));module['exports']=function(_0x5ceccb,_0x1d9285){return _0x5ceccb[_0x501b('0x9')]('UserVoiceQueueRt',attributes,{'tableName':'user_has_voice_queues_rt','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.rpc.js index 1e636dc..a71fd03 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 _0x9136=['code','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x160cd7,_0x315362){var _0x4c34f2=function(_0x55c3c6){while(--_0x55c3c6){_0x160cd7['push'](_0x160cd7['shift']());}};_0x4c34f2(++_0x315362);}(_0x9136,0x147));var _0x6913=function(_0xf13b1b,_0x2fc837){_0xf13b1b=_0xf13b1b-0x0;var _0x28286f=_0x9136[_0xf13b1b];return _0x28286f;};'use strict';var _=require('lodash');var util=require(_0x6913('0x0'));var moment=require(_0x6913('0x1'));var BPromise=require('bluebird');var rs=require(_0x6913('0x2'));var fs=require('fs');var Redis=require(_0x6913('0x3'));var db=require(_0x6913('0x4'))['db'];var utils=require(_0x6913('0x5'));var logger=require(_0x6913('0x6'))(_0x6913('0x7'));var config=require(_0x6913('0x8'));var jayson=require(_0x6913('0x9'));var client=jayson['client'][_0x6913('0xa')]({'port':0x232a});config[_0x6913('0xb')]=_[_0x6913('0xc')](config[_0x6913('0xb')],{'host':_0x6913('0xd'),'port':0x18eb});var socket=require(_0x6913('0xe'))(new Redis(config[_0x6913('0xb')]));require(_0x6913('0xf'))['register'](socket);function respondWithRpcPromise(_0x59fa4a,_0xc66438,_0x1ba5b3){return new BPromise(function(_0x539082,_0x149128){return client[_0x6913('0x10')](_0x59fa4a,_0x1ba5b3)['then'](function(_0x3dbfe2){logger[_0x6913('0x11')](_0x6913('0x12'),_0xc66438,_0x6913('0x13'));logger[_0x6913('0x14')](_0x6913('0x15'),_0xc66438,_0x6913('0x13'),JSON[_0x6913('0x16')](_0x3dbfe2));if(_0x3dbfe2[_0x6913('0x17')]){if(_0x3dbfe2['error'][_0x6913('0x18')]===0x1f4){logger[_0x6913('0x17')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc66438,_0x3dbfe2[_0x6913('0x17')][_0x6913('0x19')]);return _0x149128(_0x3dbfe2['error'][_0x6913('0x19')]);}logger['error'](_0x6913('0x12'),_0xc66438,_0x3dbfe2[_0x6913('0x17')][_0x6913('0x19')]);return _0x539082(_0x3dbfe2[_0x6913('0x17')][_0x6913('0x19')]);}else{logger[_0x6913('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0xc66438,'request\x20sent');_0x539082(_0x3dbfe2[_0x6913('0x1a')][_0x6913('0x19')]);}})[_0x6913('0x1b')](function(_0x1a9b9b){logger[_0x6913('0x17')](_0x6913('0x12'),_0xc66438,_0x1a9b9b);_0x149128(_0x1a9b9b);});});}exports[_0x6913('0x1c')]=function(_0x403ccc){var _0x544a8d=this;return new Promise(function(_0x1313bd,_0x5d25f1){return db[_0x6913('0x1d')][_0x6913('0x1e')]({'raw':_0x403ccc[_0x6913('0x1f')]?_0x403ccc['options'][_0x6913('0x20')]===undefined?!![]:![]:!![],'where':_0x403ccc[_0x6913('0x1f')]?_0x403ccc['options']['where']||null:null,'attributes':[[db[_0x6913('0x21')]['fn'](_0x6913('0x22'),db[_0x6913('0x21')]['fn']('IF',db['sequelize'][_0x6913('0x23')](_0x6913('0x24')))),_0x6913('0x25')]]})[_0x6913('0x26')](function(_0x3ac920){logger[_0x6913('0x11')]('GetVoiceQueueRtPauses',_0x403ccc);logger[_0x6913('0x14')](_0x6913('0x1c'),_0x403ccc,JSON[_0x6913('0x16')](_0x3ac920));_0x1313bd(_0x3ac920);})[_0x6913('0x1b')](function(_0x24eeff){logger[_0x6913('0x17')](_0x6913('0x1c'),_0x24eeff[_0x6913('0x19')],_0x403ccc);_0x5d25f1(_0x544a8d[_0x6913('0x17')](0x1f4,_0x24eeff[_0x6913('0x19')]));});});}; \ No newline at end of file +var _0x32c7=['register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','debug','GetVoiceQueueRtPauses','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket'];(function(_0x3448a9,_0x5b9e5d){var _0x153f30=function(_0x2511c6){while(--_0x2511c6){_0x3448a9['push'](_0x3448a9['shift']());}};_0x153f30(++_0x5b9e5d);}(_0x32c7,0xc8));var _0x732c=function(_0x113c6e,_0xe82fc9){_0x113c6e=_0x113c6e-0x0;var _0x34eaa5=_0x32c7[_0x113c6e];return _0x34eaa5;};'use strict';var _=require(_0x732c('0x0'));var util=require(_0x732c('0x1'));var moment=require(_0x732c('0x2'));var BPromise=require(_0x732c('0x3'));var rs=require(_0x732c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x732c('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x732c('0x6'));var config=require(_0x732c('0x7'));var jayson=require(_0x732c('0x8'));var client=jayson[_0x732c('0x9')][_0x732c('0xa')]({'port':0x232a});config[_0x732c('0xb')]=_[_0x732c('0xc')](config[_0x732c('0xb')],{'host':_0x732c('0xd'),'port':0x18eb});var socket=require(_0x732c('0xe'))(new Redis(config[_0x732c('0xb')]));require(_0x732c('0xf'))[_0x732c('0x10')](socket);function respondWithRpcPromise(_0x93d9cd,_0x2a9d68,_0x3ee580){return new BPromise(function(_0x300018,_0x3d5136){return client[_0x732c('0x11')](_0x93d9cd,_0x3ee580)[_0x732c('0x12')](function(_0x457f67){logger[_0x732c('0x13')](_0x732c('0x14'),_0x2a9d68,'request\x20sent');logger['debug'](_0x732c('0x15'),_0x2a9d68,_0x732c('0x16'),JSON[_0x732c('0x17')](_0x457f67));if(_0x457f67[_0x732c('0x18')]){if(_0x457f67['error'][_0x732c('0x19')]===0x1f4){logger[_0x732c('0x18')](_0x732c('0x14'),_0x2a9d68,_0x457f67[_0x732c('0x18')][_0x732c('0x1a')]);return _0x3d5136(_0x457f67['error'][_0x732c('0x1a')]);}logger[_0x732c('0x18')](_0x732c('0x14'),_0x2a9d68,_0x457f67[_0x732c('0x18')][_0x732c('0x1a')]);return _0x300018(_0x457f67[_0x732c('0x18')][_0x732c('0x1a')]);}else{logger[_0x732c('0x13')](_0x732c('0x14'),_0x2a9d68,_0x732c('0x16'));_0x300018(_0x457f67['result'][_0x732c('0x1a')]);}})[_0x732c('0x1b')](function(_0x6dd557){logger[_0x732c('0x18')](_0x732c('0x14'),_0x2a9d68,_0x6dd557);_0x3d5136(_0x6dd557);});});}exports['GetVoiceQueueRtPauses']=function(_0x5931b7){var _0x1a1b58=this;return new Promise(function(_0x37d9c7,_0x17f21b){return db['UserVoiceQueueRt']['findAll']({'raw':_0x5931b7[_0x732c('0x1c')]?_0x5931b7['options'][_0x732c('0x1d')]===undefined?!![]:![]:!![],'where':_0x5931b7[_0x732c('0x1c')]?_0x5931b7[_0x732c('0x1c')][_0x732c('0x1e')]||null:null,'attributes':[[db[_0x732c('0x1f')]['fn']('COUNT',db[_0x732c('0x1f')]['fn']('IF',db[_0x732c('0x1f')][_0x732c('0x20')](_0x732c('0x21')))),'outboundQueuePauses']]})[_0x732c('0x12')](function(_0x47c9b6){logger['info']('GetVoiceQueueRtPauses',_0x5931b7);logger[_0x732c('0x22')](_0x732c('0x23'),_0x5931b7,JSON[_0x732c('0x17')](_0x47c9b6));_0x37d9c7(_0x47c9b6);})[_0x732c('0x1b')](function(_0x58606b){logger[_0x732c('0x18')](_0x732c('0x23'),_0x58606b[_0x732c('0x1a')],_0x5931b7);_0x17f21b(_0x1a1b58[_0x732c('0x18')](0x1f4,_0x58606b[_0x732c('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e679631..8fb3a3b 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 _0xb76d=['userVoiceQueueRt:','./userVoiceQueueRt.events','remove','update','emit','removeListener','register','length'];(function(_0x149cf1,_0x29fbc7){var _0x50d71b=function(_0x36df13){while(--_0x36df13){_0x149cf1['push'](_0x149cf1['shift']());}};_0x50d71b(++_0x29fbc7);}(_0xb76d,0x119));var _0xdb76=function(_0xbf755e,_0x24ae8f){_0xbf755e=_0xbf755e-0x0;var _0x4113f8=_0xb76d[_0xbf755e];return _0x4113f8;};'use strict';var UserVoiceQueueRtEvents=require(_0xdb76('0x0'));var events=['save',_0xdb76('0x1'),_0xdb76('0x2')];function createListener(_0x3cd15e,_0x5376b1){return function(_0x2dca57){_0x5376b1[_0xdb76('0x3')](_0x3cd15e,_0x2dca57);};}function removeListener(_0x281c24,_0x371360){return function(){UserVoiceQueueRtEvents[_0xdb76('0x4')](_0x281c24,_0x371360);};}exports[_0xdb76('0x5')]=function(_0x5d80df){for(var _0xf1a18d=0x0,_0x39c442=events[_0xdb76('0x6')];_0xf1a18d<_0x39c442;_0xf1a18d++){var _0x3d80a0=events[_0xf1a18d];var _0x4e60dc=createListener(_0xdb76('0x7')+_0x3d80a0,_0x5d80df);UserVoiceQueueRtEvents['on'](_0x3d80a0,_0x4e60dc);}}; \ No newline at end of file +var _0x94ba=['remove','update','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x1c7764,_0x333b13){var _0x59aa51=function(_0x3f6707){while(--_0x3f6707){_0x1c7764['push'](_0x1c7764['shift']());}};_0x59aa51(++_0x333b13);}(_0x94ba,0xbe));var _0xa94b=function(_0x1b8b95,_0x3ea343){_0x1b8b95=_0x1b8b95-0x0;var _0x3657ae=_0x94ba[_0x1b8b95];return _0x3657ae;};'use strict';var UserVoiceQueueRtEvents=require(_0xa94b('0x0'));var events=[_0xa94b('0x1'),_0xa94b('0x2'),_0xa94b('0x3')];function createListener(_0x2275a0,_0x552bca){return function(_0xf515c0){_0x552bca['emit'](_0x2275a0,_0xf515c0);};}function removeListener(_0x3041fd,_0xd72e72){return function(){UserVoiceQueueRtEvents['removeListener'](_0x3041fd,_0xd72e72);};}exports['register']=function(_0x76f30f){for(var _0x2daeef=0x0,_0x363129=events[_0xa94b('0x4')];_0x2daeef<_0x363129;_0x2daeef++){var _0x54c158=events[_0x2daeef];var _0x41aca1=createListener(_0xa94b('0x5')+_0x54c158,_0x76f30f);UserVoiceQueueRtEvents['on'](_0x54c158,_0x41aca1);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index e2690b8..17e5344 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1a459b,_0x4e4c56){var _0x5118ca=function(_0x4ff461){while(--_0x4ff461){_0x1a459b['push'](_0x1a459b['shift']());}};_0x5118ca(++_0x4e4c56);}(_0xe706,0xa3));var _0x6e70=function(_0x41d02a,_0x355e19){_0x41d02a=_0x41d02a-0x0;var _0x4c3983=_0xe706[_0x41d02a];return _0x4c3983;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4cd579,_0x3311b4){var _0x5802f8=function(_0xe3d051){while(--_0xe3d051){_0x4cd579['push'](_0x4cd579['shift']());}};_0x5802f8(++_0x3311b4);}(_0x70e0,0x17b));var _0x070e=function(_0x21afa4,_0x57ef43){_0x21afa4=_0x21afa4-0x0;var _0x1737b5=_0x70e0[_0x21afa4];return _0x1737b5;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 6784af4..bf4a820 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 _0x9425=['exports','sequelize'];(function(_0x5b9ee0,_0x41f4d2){var _0x2e7593=function(_0x10310f){while(--_0x10310f){_0x5b9ee0['push'](_0x5b9ee0['shift']());}};_0x2e7593(++_0x41f4d2);}(_0x9425,0x1cb));var _0x5942=function(_0x31f2f8,_0x305aea){_0x31f2f8=_0x31f2f8-0x0;var _0x506ac9=_0x9425[_0x31f2f8];return _0x506ac9;};'use strict';var Sequelize=require(_0x5942('0x0'));module[_0x5942('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x73f2=['sequelize','exports','INTEGER'];(function(_0x21d73a,_0x21558c){var _0x4bee35=function(_0x592487){while(--_0x592487){_0x21d73a['push'](_0x21d73a['shift']());}};_0x4bee35(++_0x21558c);}(_0x73f2,0x11a));var _0x273f=function(_0x2d7934,_0x30e157){_0x2d7934=_0x2d7934-0x0;var _0x4f91eb=_0x73f2[_0x2d7934];return _0x4f91eb;};'use strict';var Sequelize=require(_0x273f('0x0'));module[_0x273f('0x1')]={'penalty':{'type':Sequelize[_0x273f('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 a84e1b3..9ea31dc 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 _0xe4ce=['rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','util','api','moment','bluebird'];(function(_0x14ef5e,_0x220cab){var _0x2be983=function(_0x5b1b23){while(--_0x5b1b23){_0x14ef5e['push'](_0x14ef5e['shift']());}};_0x2be983(++_0x220cab);}(_0xe4ce,0xc4));var _0xee4c=function(_0x2d8014,_0x3fcecc){_0x2d8014=_0x2d8014-0x0;var _0x2b6727=_0xe4ce[_0x2d8014];return _0x2b6727;};'use strict';var _=require('lodash');var util=require(_0xee4c('0x0'));var logger=require('../../config/logger')(_0xee4c('0x1'));var moment=require(_0xee4c('0x2'));var BPromise=require(_0xee4c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xee4c('0x4'));var config=require(_0xee4c('0x5'));var attributes=require(_0xee4c('0x6'));module[_0xee4c('0x7')]=function(_0x371924,_0x1239d9){return _0x371924[_0xee4c('0x8')](_0xee4c('0x9'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf700=['./userWhatsappQueue.attributes','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf700,0x10f));var _0x0f70=function(_0x367c0e,_0x1332d8){_0x367c0e=_0x367c0e-0x0;var _0x33509c=_0xf700[_0x367c0e];return _0x33509c;};'use strict';var _=require(_0x0f70('0x0'));var util=require('util');var logger=require(_0x0f70('0x1'))(_0x0f70('0x2'));var moment=require(_0x0f70('0x3'));var BPromise=require(_0x0f70('0x4'));var rp=require(_0x0f70('0x5'));var fs=require('fs');var path=require(_0x0f70('0x6'));var rimraf=require(_0x0f70('0x7'));var config=require(_0x0f70('0x8'));var attributes=require(_0x0f70('0x9'));module[_0x0f70('0xa')]=function(_0x4dbeec,_0x521b6a){return _0x4dbeec[_0x0f70('0xb')](_0x0f70('0xc'),attributes,{'tableName':_0x0f70('0xd'),'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 975ad24..4c32a69 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 _0x0102=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x290eef,_0x4635a3){var _0x21c635=function(_0x43957a){while(--_0x43957a){_0x290eef['push'](_0x290eef['shift']());}};_0x21c635(++_0x4635a3);}(_0x0102,0x1b6));var _0x2010=function(_0x197e67,_0x40c02d){_0x197e67=_0x197e67-0x0;var _0x4cb246=_0x0102[_0x197e67];return _0x4cb246;};'use strict';var _=require(_0x2010('0x0'));var util=require(_0x2010('0x1'));var moment=require(_0x2010('0x2'));var BPromise=require('bluebird');var rs=require(_0x2010('0x3'));var fs=require('fs');var Redis=require(_0x2010('0x4'));var db=require(_0x2010('0x5'))['db'];var utils=require(_0x2010('0x6'));var logger=require(_0x2010('0x7'))(_0x2010('0x8'));var config=require('../../config/environment');var jayson=require(_0x2010('0x9'));var client=jayson[_0x2010('0xa')][_0x2010('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x391c67,_0x17027f,_0x3c9b96){return new BPromise(function(_0x233fcb,_0x1e3864){return client[_0x2010('0xc')](_0x391c67,_0x3c9b96)['then'](function(_0x302b90){logger['info'](_0x2010('0xd'),_0x17027f,_0x2010('0xe'));logger[_0x2010('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x17027f,_0x2010('0xe'),JSON[_0x2010('0x10')](_0x302b90));if(_0x302b90[_0x2010('0x11')]){if(_0x302b90[_0x2010('0x11')][_0x2010('0x12')]===0x1f4){logger[_0x2010('0x11')](_0x2010('0xd'),_0x17027f,_0x302b90[_0x2010('0x11')]['message']);return _0x1e3864(_0x302b90['error'][_0x2010('0x13')]);}logger[_0x2010('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x17027f,_0x302b90[_0x2010('0x11')][_0x2010('0x13')]);return _0x233fcb(_0x302b90['error']['message']);}else{logger[_0x2010('0x14')]('UserWhatsappQueue,\x20%s,\x20%s',_0x17027f,_0x2010('0xe'));_0x233fcb(_0x302b90['result']['message']);}})[_0x2010('0x15')](function(_0x119e93){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x17027f,_0x119e93);_0x1e3864(_0x119e93);});});} \ No newline at end of file +var _0xb102=['UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','then'];(function(_0x17a6cd,_0x16fb12){var _0x44d4ff=function(_0x461b5a){while(--_0x461b5a){_0x17a6cd['push'](_0x17a6cd['shift']());}};_0x44d4ff(++_0x16fb12);}(_0xb102,0x97));var _0x2b10=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xb102[_0x218972];return _0x1bb1a8;};'use strict';var _=require(_0x2b10('0x0'));var util=require(_0x2b10('0x1'));var moment=require('moment');var BPromise=require(_0x2b10('0x2'));var rs=require(_0x2b10('0x3'));var fs=require('fs');var Redis=require(_0x2b10('0x4'));var db=require(_0x2b10('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x2b10('0x6'));var client=jayson['client'][_0x2b10('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x113112,_0x23a474,_0x3d604c){return new BPromise(function(_0x447b4b,_0x322089){return client['request'](_0x113112,_0x3d604c)[_0x2b10('0x8')](function(_0x2a4391){logger['info'](_0x2b10('0x9'),_0x23a474,'request\x20sent');logger[_0x2b10('0xa')](_0x2b10('0xb'),_0x23a474,'request\x20sent',JSON[_0x2b10('0xc')](_0x2a4391));if(_0x2a4391[_0x2b10('0xd')]){if(_0x2a4391['error'][_0x2b10('0xe')]===0x1f4){logger[_0x2b10('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x23a474,_0x2a4391[_0x2b10('0xd')][_0x2b10('0xf')]);return _0x322089(_0x2a4391[_0x2b10('0xd')][_0x2b10('0xf')]);}logger[_0x2b10('0xd')](_0x2b10('0x9'),_0x23a474,_0x2a4391[_0x2b10('0xd')]['message']);return _0x447b4b(_0x2a4391[_0x2b10('0xd')][_0x2b10('0xf')]);}else{logger[_0x2b10('0x10')](_0x2b10('0x9'),_0x23a474,_0x2b10('0x11'));_0x447b4b(_0x2a4391[_0x2b10('0x12')][_0x2b10('0xf')]);}})[_0x2b10('0x13')](function(_0x1f9bfd){logger[_0x2b10('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x23a474,_0x1f9bfd);_0x322089(_0x1f9bfd);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 7716683..ecd1eb3 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 _0xb377=['update','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','show','post','isAuthenticated','create','put','/:id'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xb377,0x1b6));var _0x7b37=function(_0x987717,_0x4dfeaa){_0x987717=_0x987717-0x0;var _0x322fda=_0xb377[_0x987717];return _0x322fda;};'use strict';var multer=require(_0x7b37('0x0'));var util=require(_0x7b37('0x1'));var path=require(_0x7b37('0x2'));var timeout=require(_0x7b37('0x3'));var express=require(_0x7b37('0x4'));var router=express[_0x7b37('0x5')]();var fs_extra=require(_0x7b37('0x6'));var auth=require(_0x7b37('0x7'));var interaction=require(_0x7b37('0x8'));var config=require(_0x7b37('0x9'));var controller=require(_0x7b37('0xa'));router[_0x7b37('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7b37('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x7b37('0xc')]);router[_0x7b37('0xd')]('/',auth[_0x7b37('0xe')](),controller[_0x7b37('0xf')]);router[_0x7b37('0x10')](_0x7b37('0x11'),auth[_0x7b37('0xe')](),controller[_0x7b37('0x12')]);router['delete'](_0x7b37('0x11'),auth[_0x7b37('0xe')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xa8eb=['get','index','/:id','isAuthenticated','create','put','update','delete','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x25b815,_0x2245b6){var _0x57748b=function(_0x568b4f){while(--_0x568b4f){_0x25b815['push'](_0x25b815['shift']());}};_0x57748b(++_0x2245b6);}(_0xa8eb,0x179));var _0xba8e=function(_0xf356,_0xa86dce){_0xf356=_0xf356-0x0;var _0x2b7003=_0xa8eb[_0xf356];return _0x2b7003;};'use strict';var multer=require(_0xba8e('0x0'));var util=require('util');var path=require(_0xba8e('0x1'));var timeout=require('connect-timeout');var express=require(_0xba8e('0x2'));var router=express[_0xba8e('0x3')]();var fs_extra=require(_0xba8e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xba8e('0x5'));var config=require(_0xba8e('0x6'));var controller=require('./variable.controller');router[_0xba8e('0x7')]('/',auth['isAuthenticated'](),controller[_0xba8e('0x8')]);router['get'](_0xba8e('0x9'),auth[_0xba8e('0xa')](),controller['show']);router['post']('/',auth[_0xba8e('0xa')](),controller[_0xba8e('0xb')]);router[_0xba8e('0xc')](_0xba8e('0x9'),auth[_0xba8e('0xa')](),controller[_0xba8e('0xd')]);router[_0xba8e('0xe')](_0xba8e('0x9'),auth[_0xba8e('0xa')](),controller['destroy']);module[_0xba8e('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 9a4839b..d94149c 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 _0x5b93=['STRING'];(function(_0x3a607e,_0x54d530){var _0x37b106=function(_0x1becae){while(--_0x1becae){_0x3a607e['push'](_0x3a607e['shift']());}};_0x37b106(++_0x54d530);}(_0x5b93,0x152));var _0x35b9=function(_0x289c06,_0x576e58){_0x289c06=_0x289c06-0x0;var _0x49a514=_0x5b93[_0x289c06];return _0x49a514;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x35b9('0x0')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x35b9('0x0')]}}; \ No newline at end of file +var _0xa906=['STRING','sequelize'];(function(_0x180c9b,_0x13d173){var _0x3ff116=function(_0x241982){while(--_0x241982){_0x180c9b['push'](_0x180c9b['shift']());}};_0x3ff116(++_0x13d173);}(_0xa906,0x1e3));var _0x6a90=function(_0x4f7b7a,_0x6af207){_0x4f7b7a=_0x4f7b7a-0x0;var _0x2a8b2d=_0xa906[_0x4f7b7a];return _0x2a8b2d;};'use strict';var Sequelize=require(_0x6a90('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a90('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index fe694e5..9b9326d 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 _0xdaf8=['to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Variables','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','Variable','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','rows','show','rawAttributes','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','catch','error','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x17c35f,_0x4d4be0){var _0x374403=function(_0x2e9e85){while(--_0x2e9e85){_0x17c35f['push'](_0x17c35f['shift']());}};_0x374403(++_0x4d4be0);}(_0xdaf8,0x19b));var _0x8daf=function(_0x33ede9,_0x24b0a4){_0x33ede9=_0x33ede9-0x0;var _0x5152a5=_0xdaf8[_0x33ede9];return _0x5152a5;};'use strict';var emlformat=require(_0x8daf('0x0'));var rimraf=require(_0x8daf('0x1'));var zipdir=require(_0x8daf('0x2'));var jsonpatch=require(_0x8daf('0x3'));var rp=require(_0x8daf('0x4'));var moment=require(_0x8daf('0x5'));var BPromise=require(_0x8daf('0x6'));var Mustache=require(_0x8daf('0x7'));var util=require(_0x8daf('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x8daf('0x9'));var ejs=require(_0x8daf('0xa'));var fs=require('fs');var fs_extra=require(_0x8daf('0xb'));var _=require(_0x8daf('0xc'));var squel=require(_0x8daf('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x8daf('0xe'));var toCsv=require(_0x8daf('0x9'));var querystring=require(_0x8daf('0xf'));var Papa=require('papaparse');var Redis=require(_0x8daf('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x8daf('0x11'));var as=require(_0x8daf('0x12'));var hardwareService=require(_0x8daf('0x13'));var logger=require('../../config/logger')(_0x8daf('0x14'));var utils=require('../../config/utils');var config=require(_0x8daf('0x15'));var licenseUtil=require(_0x8daf('0x16'));var db=require(_0x8daf('0x17'))['db'];function respondWithStatusCode(_0x1e0805,_0x51208e){_0x51208e=_0x51208e||0xcc;return function(_0x333a25){if(_0x333a25){return _0x1e0805['sendStatus'](_0x51208e);}return _0x1e0805[_0x8daf('0x18')](_0x51208e)[_0x8daf('0x19')]();};}function respondWithResult(_0x4c325c,_0x49a506){_0x49a506=_0x49a506||0xc8;return function(_0x4dad8f){if(_0x4dad8f){return _0x4c325c['status'](_0x49a506)['json'](_0x4dad8f);}};}function respondWithFilteredResult(_0x51e2b1,_0x10454a){return function(_0x4cc5cb){if(_0x4cc5cb){var _0x1f2e9e=typeof _0x10454a[_0x8daf('0x1a')]===_0x8daf('0x1b')&&typeof _0x10454a[_0x8daf('0x1c')]===_0x8daf('0x1b');var _0x5f2d59=_0x4cc5cb[_0x8daf('0x1d')];var _0x26d38f=_0x1f2e9e?0x0:_0x10454a[_0x8daf('0x1a')];var _0x4e2b82=_0x1f2e9e?_0x4cc5cb['count']:_0x10454a[_0x8daf('0x1a')]+_0x10454a[_0x8daf('0x1c')];var _0x2fe271;if(_0x4e2b82>=_0x5f2d59){_0x4e2b82=_0x5f2d59;_0x2fe271=0xc8;}else{_0x2fe271=0xce;}_0x51e2b1[_0x8daf('0x18')](_0x2fe271);return _0x51e2b1[_0x8daf('0x1e')](_0x8daf('0x1f'),_0x26d38f+'-'+_0x4e2b82+'/'+_0x5f2d59)['json'](_0x4cc5cb);}return null;};}function patchUpdates(_0x5d4ae6){return function(_0x45a650){try{jsonpatch[_0x8daf('0x20')](_0x45a650,_0x5d4ae6,!![]);}catch(_0x452831){return BPromise[_0x8daf('0x21')](_0x452831);}return _0x45a650[_0x8daf('0x22')]();};}function saveUpdates(_0x27b3ed,_0x41452){return function(_0x7fbdc1){if(_0x7fbdc1){return _0x7fbdc1[_0x8daf('0x23')](_0x27b3ed)[_0x8daf('0x24')](function(_0x672fa6){return _0x672fa6;});}return null;};}function removeEntity(_0x1df529,_0xaf842a){return function(_0x3cfd3c){if(_0x3cfd3c){return _0x3cfd3c['destroy']()['then'](function(){var _0x33cf2b=_0x3cfd3c[_0x8daf('0x25')]({'plain':!![]});var _0x5799b9=_0x8daf('0x26');return db[_0x8daf('0x27')][_0x8daf('0x28')]({'where':{'type':_0x5799b9,'resourceId':_0x33cf2b['id']}})[_0x8daf('0x24')](function(){return _0x3cfd3c;});})['then'](function(){_0x1df529[_0x8daf('0x18')](0xcc)[_0x8daf('0x19')]();});}};}function handleEntityNotFound(_0x5179dc,_0x2efeec){return function(_0x9020ed){if(!_0x9020ed){_0x5179dc[_0x8daf('0x29')](0x194);}return _0x9020ed;};}function handleError(_0x6c6581,_0x32cfd3){_0x32cfd3=_0x32cfd3||0x1f4;return function(_0x57fee4){logger['error'](_0x57fee4[_0x8daf('0x2a')]);if(_0x57fee4['name']){delete _0x57fee4[_0x8daf('0x2b')];}_0x6c6581[_0x8daf('0x18')](_0x32cfd3)[_0x8daf('0x2c')](_0x57fee4);};}exports[_0x8daf('0x2d')]=function(_0xd4fbca,_0x1c34aa){var _0x45c4c5={},_0x4b2c0c={},_0x6f63f3={'count':0x0,'rows':[]};var _0x1699dd=_[_0x8daf('0x2e')](db[_0x8daf('0x2f')]['rawAttributes'],function(_0x594a3d){return{'name':_0x594a3d[_0x8daf('0x30')],'type':_0x594a3d['type'][_0x8daf('0x31')]};});_0x4b2c0c['model']=_[_0x8daf('0x2e')](_0x1699dd,_0x8daf('0x2b'));_0x4b2c0c[_0x8daf('0x32')]=_[_0x8daf('0x33')](_0xd4fbca[_0x8daf('0x32')]);_0x4b2c0c[_0x8daf('0x34')]=_[_0x8daf('0x35')](_0x4b2c0c['model'],_0x4b2c0c[_0x8daf('0x32')]);_0x45c4c5[_0x8daf('0x36')]=_[_0x8daf('0x35')](_0x4b2c0c[_0x8daf('0x37')],qs[_0x8daf('0x38')](_0xd4fbca[_0x8daf('0x32')]['fields']));_0x45c4c5[_0x8daf('0x36')]=_0x45c4c5[_0x8daf('0x36')][_0x8daf('0x39')]?_0x45c4c5[_0x8daf('0x36')]:_0x4b2c0c[_0x8daf('0x37')];if(!_0xd4fbca['query'][_0x8daf('0x3a')]('nolimit')){_0x45c4c5[_0x8daf('0x1c')]=qs[_0x8daf('0x1c')](_0xd4fbca[_0x8daf('0x32')][_0x8daf('0x1c')]);_0x45c4c5['offset']=qs[_0x8daf('0x1a')](_0xd4fbca['query'][_0x8daf('0x1a')]);}_0x45c4c5[_0x8daf('0x3b')]=qs[_0x8daf('0x3c')](_0xd4fbca[_0x8daf('0x32')][_0x8daf('0x3c')]);_0x45c4c5[_0x8daf('0x3d')]=qs[_0x8daf('0x34')](_[_0x8daf('0x3e')](_0xd4fbca['query'],_0x4b2c0c[_0x8daf('0x34')]),_0x1699dd);if(_0xd4fbca['query']['filter']){_0x45c4c5[_0x8daf('0x3d')]=_[_0x8daf('0x3f')](_0x45c4c5[_0x8daf('0x3d')],{'$or':_[_0x8daf('0x2e')](_0x1699dd,function(_0x37506c){if(_0x37506c[_0x8daf('0x40')]!==_0x8daf('0x41')){var _0x1f7ff0={};_0x1f7ff0[_0x37506c[_0x8daf('0x2b')]]={'$like':'%'+_0xd4fbca['query'][_0x8daf('0x42')]+'%'};return _0x1f7ff0;}})});}_0x45c4c5=_['merge']({},_0x45c4c5,_0xd4fbca[_0x8daf('0x43')]);var _0x3f7f4a={'where':_0x45c4c5[_0x8daf('0x3d')]};return db[_0x8daf('0x2f')][_0x8daf('0x1d')](_0x3f7f4a)[_0x8daf('0x24')](function(_0xada139){_0x6f63f3[_0x8daf('0x1d')]=_0xada139;if(_0xd4fbca[_0x8daf('0x32')][_0x8daf('0x44')]){_0x45c4c5['include']=[{'all':!![]}];}return db[_0x8daf('0x2f')]['findAll'](_0x45c4c5);})['then'](function(_0xf40200){_0x6f63f3[_0x8daf('0x45')]=_0xf40200;return _0x6f63f3;})[_0x8daf('0x24')](respondWithFilteredResult(_0x1c34aa,_0x45c4c5))['catch'](handleError(_0x1c34aa,null));};exports[_0x8daf('0x46')]=function(_0x2c6a30,_0x579cae){var _0x21683e={'raw':!![],'where':{'id':_0x2c6a30['params']['id']}},_0x1ae35a={};_0x1ae35a[_0x8daf('0x37')]=_[_0x8daf('0x33')](db['Variable'][_0x8daf('0x47')]);_0x1ae35a[_0x8daf('0x32')]=_[_0x8daf('0x33')](_0x2c6a30['query']);_0x1ae35a['filters']=_[_0x8daf('0x35')](_0x1ae35a[_0x8daf('0x37')],_0x1ae35a[_0x8daf('0x32')]);_0x21683e['attributes']=_[_0x8daf('0x35')](_0x1ae35a[_0x8daf('0x37')],qs[_0x8daf('0x38')](_0x2c6a30[_0x8daf('0x32')][_0x8daf('0x38')]));_0x21683e[_0x8daf('0x36')]=_0x21683e['attributes'][_0x8daf('0x39')]?_0x21683e[_0x8daf('0x36')]:_0x1ae35a['model'];if(_0x2c6a30[_0x8daf('0x32')]['includeAll']){_0x21683e[_0x8daf('0x48')]=[{'all':!![]}];}_0x21683e=_[_0x8daf('0x3f')]({},_0x21683e,_0x2c6a30[_0x8daf('0x43')]);return db[_0x8daf('0x2f')]['find'](_0x21683e)[_0x8daf('0x24')](handleEntityNotFound(_0x579cae,null))[_0x8daf('0x24')](respondWithResult(_0x579cae,null))['catch'](handleError(_0x579cae,null));};exports[_0x8daf('0x49')]=function(_0x1fd713,_0x34376e){return db['Variable'][_0x8daf('0x49')](_0x1fd713['body'],{})['then'](function(_0x26d2bb){var _0x4eecc8=_0x1fd713['user']['get']({'plain':!![]});if(!_0x4eecc8)throw new Error(_0x8daf('0x4a'));if(_0x4eecc8[_0x8daf('0x4b')]===_0x8daf('0x4c')){var _0x2132cd=_0x26d2bb[_0x8daf('0x25')]({'plain':!![]});var _0x4f1d71=_0x8daf('0x26');return db[_0x8daf('0x4d')][_0x8daf('0x4e')]({'where':{'name':_0x4f1d71,'userProfileId':_0x4eecc8['userProfileId']},'raw':!![]})['then'](function(_0x127605){if(_0x127605&&_0x127605[_0x8daf('0x4f')]===0x0){return db[_0x8daf('0x27')]['create']({'name':_0x2132cd['name'],'resourceId':_0x2132cd['id'],'type':_0x127605[_0x8daf('0x2b')],'sectionId':_0x127605['id']},{})[_0x8daf('0x24')](function(){return _0x26d2bb;});}else{return _0x26d2bb;}})[_0x8daf('0x50')](function(_0x424ac1){logger[_0x8daf('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x424ac1);throw _0x424ac1;});}return _0x26d2bb;})[_0x8daf('0x24')](respondWithResult(_0x34376e,0xc9))[_0x8daf('0x50')](handleError(_0x34376e,null));};exports[_0x8daf('0x23')]=function(_0xe59c14,_0x4f47dd){if(_0xe59c14[_0x8daf('0x52')]['id']){delete _0xe59c14['body']['id'];}return db['Variable'][_0x8daf('0x4e')]({'where':{'id':_0xe59c14[_0x8daf('0x53')]['id']}})[_0x8daf('0x24')](handleEntityNotFound(_0x4f47dd,null))['then'](saveUpdates(_0xe59c14[_0x8daf('0x52')],null))[_0x8daf('0x24')](respondWithResult(_0x4f47dd,null))[_0x8daf('0x50')](handleError(_0x4f47dd,null));};exports[_0x8daf('0x28')]=function(_0x21abe0,_0x1533f2){return db['Variable']['find']({'where':{'id':_0x21abe0['params']['id']}})['then'](handleEntityNotFound(_0x1533f2,null))['then'](removeEntity(_0x1533f2,null))['catch'](handleError(_0x1533f2,null));}; \ No newline at end of file +var _0x50fb=['UserProfileResource','error','stack','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','options','Variable','includeAll','include','findAll','rows','show','params','find','create','body','user','role','UserProfileSection','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','get','Variables'];(function(_0x51fe5f,_0x1d8632){var _0x4abce9=function(_0x34afb7){while(--_0x34afb7){_0x51fe5f['push'](_0x51fe5f['shift']());}};_0x4abce9(++_0x1d8632);}(_0x50fb,0x1be));var _0xb50f=function(_0x2bbe40,_0x437411){_0x2bbe40=_0x2bbe40-0x0;var _0x13d050=_0x50fb[_0x2bbe40];return _0x13d050;};'use strict';var emlformat=require(_0xb50f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb50f('0x1'));var jsonpatch=require(_0xb50f('0x2'));var rp=require(_0xb50f('0x3'));var moment=require(_0xb50f('0x4'));var BPromise=require(_0xb50f('0x5'));var Mustache=require('mustache');var util=require(_0xb50f('0x6'));var path=require(_0xb50f('0x7'));var sox=require(_0xb50f('0x8'));var csv=require(_0xb50f('0x9'));var ejs=require(_0xb50f('0xa'));var fs=require('fs');var fs_extra=require(_0xb50f('0xb'));var _=require(_0xb50f('0xc'));var squel=require('squel');var crypto=require(_0xb50f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb50f('0xe'));var toCsv=require(_0xb50f('0x9'));var querystring=require(_0xb50f('0xf'));var Papa=require(_0xb50f('0x10'));var Redis=require(_0xb50f('0x11'));var authService=require(_0xb50f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb50f('0x13'));var logger=require(_0xb50f('0x14'))(_0xb50f('0x15'));var utils=require(_0xb50f('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb50f('0x17'))['db'];function respondWithStatusCode(_0x242f50,_0x4bdc0e){_0x4bdc0e=_0x4bdc0e||0xcc;return function(_0x38b1e3){if(_0x38b1e3){return _0x242f50[_0xb50f('0x18')](_0x4bdc0e);}return _0x242f50[_0xb50f('0x19')](_0x4bdc0e)[_0xb50f('0x1a')]();};}function respondWithResult(_0x35117a,_0x5a0610){_0x5a0610=_0x5a0610||0xc8;return function(_0xee0f47){if(_0xee0f47){return _0x35117a[_0xb50f('0x19')](_0x5a0610)['json'](_0xee0f47);}};}function respondWithFilteredResult(_0x298ba8,_0x3ef2bc){return function(_0x5d9149){if(_0x5d9149){var _0xb8f9c8=typeof _0x3ef2bc['offset']===_0xb50f('0x1b')&&typeof _0x3ef2bc[_0xb50f('0x1c')]==='undefined';var _0x49d85a=_0x5d9149[_0xb50f('0x1d')];var _0x45e026=_0xb8f9c8?0x0:_0x3ef2bc['offset'];var _0x5dea01=_0xb8f9c8?_0x5d9149[_0xb50f('0x1d')]:_0x3ef2bc['offset']+_0x3ef2bc[_0xb50f('0x1c')];var _0x49b75a;if(_0x5dea01>=_0x49d85a){_0x5dea01=_0x49d85a;_0x49b75a=0xc8;}else{_0x49b75a=0xce;}_0x298ba8[_0xb50f('0x19')](_0x49b75a);return _0x298ba8[_0xb50f('0x1e')]('Content-Range',_0x45e026+'-'+_0x5dea01+'/'+_0x49d85a)[_0xb50f('0x1f')](_0x5d9149);}return null;};}function patchUpdates(_0x20fa1d){return function(_0x43a2db){try{jsonpatch[_0xb50f('0x20')](_0x43a2db,_0x20fa1d,!![]);}catch(_0x3129ca){return BPromise[_0xb50f('0x21')](_0x3129ca);}return _0x43a2db[_0xb50f('0x22')]();};}function saveUpdates(_0x1f086c,_0x40a058){return function(_0x5014c1){if(_0x5014c1){return _0x5014c1[_0xb50f('0x23')](_0x1f086c)[_0xb50f('0x24')](function(_0x2fb02f){return _0x2fb02f;});}return null;};}function removeEntity(_0x22d854,_0x27aa11){return function(_0x33ec06){if(_0x33ec06){return _0x33ec06[_0xb50f('0x25')]()[_0xb50f('0x24')](function(){var _0x53d266=_0x33ec06[_0xb50f('0x26')]({'plain':!![]});var _0x8ab890=_0xb50f('0x27');return db[_0xb50f('0x28')][_0xb50f('0x25')]({'where':{'type':_0x8ab890,'resourceId':_0x53d266['id']}})[_0xb50f('0x24')](function(){return _0x33ec06;});})['then'](function(){_0x22d854[_0xb50f('0x19')](0xcc)[_0xb50f('0x1a')]();});}};}function handleEntityNotFound(_0x4cabc3,_0x3ea99d){return function(_0x55db9e){if(!_0x55db9e){_0x4cabc3[_0xb50f('0x18')](0x194);}return _0x55db9e;};}function handleError(_0x1756a3,_0x1acf00){_0x1acf00=_0x1acf00||0x1f4;return function(_0x3237e7){logger[_0xb50f('0x29')](_0x3237e7[_0xb50f('0x2a')]);if(_0x3237e7['name']){delete _0x3237e7[_0xb50f('0x2b')];}_0x1756a3[_0xb50f('0x19')](_0x1acf00)[_0xb50f('0x2c')](_0x3237e7);};}exports[_0xb50f('0x2d')]=function(_0x25ce0a,_0x9dcaff){var _0x2d2784={},_0x288ca1={},_0x388445={'count':0x0,'rows':[]};var _0x5a32ae=_[_0xb50f('0x2e')](db['Variable'][_0xb50f('0x2f')],function(_0x449328){return{'name':_0x449328['fieldName'],'type':_0x449328[_0xb50f('0x30')][_0xb50f('0x31')]};});_0x288ca1[_0xb50f('0x32')]=_[_0xb50f('0x2e')](_0x5a32ae,_0xb50f('0x2b'));_0x288ca1[_0xb50f('0x33')]=_[_0xb50f('0x34')](_0x25ce0a['query']);_0x288ca1[_0xb50f('0x35')]=_[_0xb50f('0x36')](_0x288ca1[_0xb50f('0x32')],_0x288ca1[_0xb50f('0x33')]);_0x2d2784[_0xb50f('0x37')]=_[_0xb50f('0x36')](_0x288ca1['model'],qs[_0xb50f('0x38')](_0x25ce0a[_0xb50f('0x33')]['fields']));_0x2d2784[_0xb50f('0x37')]=_0x2d2784[_0xb50f('0x37')]['length']?_0x2d2784[_0xb50f('0x37')]:_0x288ca1[_0xb50f('0x32')];if(!_0x25ce0a[_0xb50f('0x33')][_0xb50f('0x39')](_0xb50f('0x3a'))){_0x2d2784['limit']=qs[_0xb50f('0x1c')](_0x25ce0a['query'][_0xb50f('0x1c')]);_0x2d2784['offset']=qs[_0xb50f('0x3b')](_0x25ce0a['query'][_0xb50f('0x3b')]);}_0x2d2784[_0xb50f('0x3c')]=qs[_0xb50f('0x3d')](_0x25ce0a[_0xb50f('0x33')][_0xb50f('0x3d')]);_0x2d2784[_0xb50f('0x3e')]=qs[_0xb50f('0x35')](_['pick'](_0x25ce0a['query'],_0x288ca1[_0xb50f('0x35')]),_0x5a32ae);if(_0x25ce0a[_0xb50f('0x33')][_0xb50f('0x3f')]){_0x2d2784[_0xb50f('0x3e')]=_[_0xb50f('0x40')](_0x2d2784[_0xb50f('0x3e')],{'$or':_[_0xb50f('0x2e')](_0x5a32ae,function(_0x2124ce){if(_0x2124ce[_0xb50f('0x30')]!=='VIRTUAL'){var _0x255c27={};_0x255c27[_0x2124ce[_0xb50f('0x2b')]]={'$like':'%'+_0x25ce0a[_0xb50f('0x33')][_0xb50f('0x3f')]+'%'};return _0x255c27;}})});}_0x2d2784=_['merge']({},_0x2d2784,_0x25ce0a[_0xb50f('0x41')]);var _0x3dfe8c={'where':_0x2d2784['where']};return db[_0xb50f('0x42')][_0xb50f('0x1d')](_0x3dfe8c)[_0xb50f('0x24')](function(_0x4904a3){_0x388445[_0xb50f('0x1d')]=_0x4904a3;if(_0x25ce0a['query'][_0xb50f('0x43')]){_0x2d2784[_0xb50f('0x44')]=[{'all':!![]}];}return db[_0xb50f('0x42')][_0xb50f('0x45')](_0x2d2784);})[_0xb50f('0x24')](function(_0xc50682){_0x388445[_0xb50f('0x46')]=_0xc50682;return _0x388445;})['then'](respondWithFilteredResult(_0x9dcaff,_0x2d2784))['catch'](handleError(_0x9dcaff,null));};exports[_0xb50f('0x47')]=function(_0xf2e730,_0x1292b6){var _0x29f146={'raw':!![],'where':{'id':_0xf2e730[_0xb50f('0x48')]['id']}},_0x5eec87={};_0x5eec87[_0xb50f('0x32')]=_[_0xb50f('0x34')](db[_0xb50f('0x42')]['rawAttributes']);_0x5eec87['query']=_['keys'](_0xf2e730[_0xb50f('0x33')]);_0x5eec87['filters']=_[_0xb50f('0x36')](_0x5eec87[_0xb50f('0x32')],_0x5eec87[_0xb50f('0x33')]);_0x29f146['attributes']=_[_0xb50f('0x36')](_0x5eec87[_0xb50f('0x32')],qs['fields'](_0xf2e730[_0xb50f('0x33')][_0xb50f('0x38')]));_0x29f146[_0xb50f('0x37')]=_0x29f146[_0xb50f('0x37')]['length']?_0x29f146['attributes']:_0x5eec87['model'];if(_0xf2e730['query'][_0xb50f('0x43')]){_0x29f146[_0xb50f('0x44')]=[{'all':!![]}];}_0x29f146=_[_0xb50f('0x40')]({},_0x29f146,_0xf2e730[_0xb50f('0x41')]);return db['Variable'][_0xb50f('0x49')](_0x29f146)['then'](handleEntityNotFound(_0x1292b6,null))[_0xb50f('0x24')](respondWithResult(_0x1292b6,null))['catch'](handleError(_0x1292b6,null));};exports[_0xb50f('0x4a')]=function(_0x3b7495,_0xbc4b21){return db[_0xb50f('0x42')][_0xb50f('0x4a')](_0x3b7495[_0xb50f('0x4b')],{})[_0xb50f('0x24')](function(_0x2492f5){var _0x114e18=_0x3b7495[_0xb50f('0x4c')][_0xb50f('0x26')]({'plain':!![]});if(!_0x114e18)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x114e18[_0xb50f('0x4d')]===_0xb50f('0x4c')){var _0x35b9c0=_0x2492f5['get']({'plain':!![]});var _0x3fcd5d='Variables';return db[_0xb50f('0x4e')][_0xb50f('0x49')]({'where':{'name':_0x3fcd5d,'userProfileId':_0x114e18['userProfileId']},'raw':!![]})[_0xb50f('0x24')](function(_0x2ba8dd){if(_0x2ba8dd&&_0x2ba8dd['autoAssociation']===0x0){return db[_0xb50f('0x28')][_0xb50f('0x4a')]({'name':_0x35b9c0[_0xb50f('0x2b')],'resourceId':_0x35b9c0['id'],'type':_0x2ba8dd[_0xb50f('0x2b')],'sectionId':_0x2ba8dd['id']},{})[_0xb50f('0x24')](function(){return _0x2492f5;});}else{return _0x2492f5;}})[_0xb50f('0x4f')](function(_0x5ff21c){logger[_0xb50f('0x29')](_0xb50f('0x50'),_0x5ff21c);throw _0x5ff21c;});}return _0x2492f5;})[_0xb50f('0x24')](respondWithResult(_0xbc4b21,0xc9))['catch'](handleError(_0xbc4b21,null));};exports[_0xb50f('0x23')]=function(_0x45156d,_0x2dcc37){if(_0x45156d[_0xb50f('0x4b')]['id']){delete _0x45156d['body']['id'];}return db[_0xb50f('0x42')]['find']({'where':{'id':_0x45156d[_0xb50f('0x48')]['id']}})[_0xb50f('0x24')](handleEntityNotFound(_0x2dcc37,null))[_0xb50f('0x24')](saveUpdates(_0x45156d[_0xb50f('0x4b')],null))[_0xb50f('0x24')](respondWithResult(_0x2dcc37,null))[_0xb50f('0x4f')](handleError(_0x2dcc37,null));};exports[_0xb50f('0x25')]=function(_0xb18def,_0x586d54){return db[_0xb50f('0x42')]['find']({'where':{'id':_0xb18def[_0xb50f('0x48')]['id']}})['then'](handleEntityNotFound(_0x586d54,null))[_0xb50f('0x24')](removeEntity(_0x586d54,null))[_0xb50f('0x4f')](handleError(_0x586d54,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 5d80ee6..4aab120 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 _0xddee=['Variable','tools_variables','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports'];(function(_0x21d296,_0x434d64){var _0x1e4bff=function(_0x544a4d){while(--_0x544a4d){_0x21d296['push'](_0x21d296['shift']());}};_0x1e4bff(++_0x434d64);}(_0xddee,0x156));var _0xedde=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0xddee[_0x3718b7];return _0xf8c91e;};'use strict';var _=require(_0xedde('0x0'));var util=require(_0xedde('0x1'));var logger=require(_0xedde('0x2'))(_0xedde('0x3'));var moment=require('moment');var BPromise=require(_0xedde('0x4'));var rp=require(_0xedde('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xedde('0x6'));var attributes=require('./variable.attributes');module[_0xedde('0x7')]=function(_0xcc65d4,_0x39060e){return _0xcc65d4['define'](_0xedde('0x8'),attributes,{'tableName':_0xedde('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xac59=['moment','bluebird','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','api'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xac59,0x18f));var _0x9ac5=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac59[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x9ac5('0x0'));var util=require(_0x9ac5('0x1'));var logger=require(_0x9ac5('0x2'))(_0x9ac5('0x3'));var moment=require(_0x9ac5('0x4'));var BPromise=require(_0x9ac5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ac5('0x6'));var rimraf=require(_0x9ac5('0x7'));var config=require(_0x9ac5('0x8'));var attributes=require(_0x9ac5('0x9'));module[_0x9ac5('0xa')]=function(_0x158c64,_0x1bc7ea){return _0x158c64[_0x9ac5('0xb')](_0x9ac5('0xc'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 87f7bd3..2bc9f78 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['include','map','model','then','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowVariable','Variable','options','attributes'];(function(_0x2ae8c2,_0x4144d2){var _0x18dd69=function(_0x2f4805){while(--_0x2f4805){_0x2ae8c2['push'](_0x2ae8c2['shift']());}};_0x18dd69(++_0x4144d2);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1c7dbf,_0x5e8f60){_0x1c7dbf=_0x1c7dbf-0x0;var _0x451ff0=_0x1cb9[_0x1c7dbf];return _0x451ff0;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Variable,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});}exports[_0x91cb('0x16')]=function(_0x1cd34b){var _0xcd1a78=this;return new Promise(function(_0x5cc1c3,_0x3fba4f){return db[_0x91cb('0x17')]['find']({'raw':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b['options']['raw']===undefined?!![]:![]:!![],'where':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')]['where']||null:null,'attributes':_0x1cd34b['options']?_0x1cd34b['options'][_0x91cb('0x19')]||null:null,'include':_0x1cd34b[_0x91cb('0x18')]?_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')]?_['map'](_0x1cd34b[_0x91cb('0x18')][_0x91cb('0x1a')],function(_0x1fa837){return{'model':db[_0x1fa837['model']],'as':_0x1fa837['as'],'attributes':_0x1fa837[_0x91cb('0x19')],'include':_0x1fa837[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x1fa837[_0x91cb('0x1a')],function(_0x3ca500){return{'model':db[_0x3ca500[_0x91cb('0x1c')]],'as':_0x3ca500['as'],'attributes':_0x3ca500[_0x91cb('0x19')],'include':_0x3ca500[_0x91cb('0x1a')]?_[_0x91cb('0x1b')](_0x3ca500['include'],function(_0x59bf3a){return{'model':db[_0x59bf3a[_0x91cb('0x1c')]],'as':_0x59bf3a['as'],'attributes':_0x59bf3a['attributes']};}):[]};}):[]};}):[]:[]})[_0x91cb('0x1d')](function(_0x34d372){logger[_0x91cb('0xc')]('ShowVariable',_0x1cd34b);logger[_0x91cb('0xf')]('ShowVariable',_0x1cd34b,JSON[_0x91cb('0x11')](_0x34d372));_0x5cc1c3(_0x34d372);})[_0x91cb('0x15')](function(_0x3b3ee6){logger[_0x91cb('0x12')](_0x91cb('0x16'),_0x3b3ee6['message'],_0x1cd34b);_0x3fba4f(_0xcd1a78[_0x91cb('0x12')](0x1f4,_0x3b3ee6['message']));});});}; \ No newline at end of file +var _0x814b=['model','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','ShowVariable','options','where','include','map','attributes'];(function(_0x317105,_0x2cbdc1){var _0x186f44=function(_0x4d0fb9){while(--_0x4d0fb9){_0x317105['push'](_0x317105['shift']());}};_0x186f44(++_0x2cbdc1);}(_0x814b,0x1a2));var _0xb814=function(_0x80bea0,_0x4c30f4){_0x80bea0=_0x80bea0-0x0;var _0x50fb90=_0x814b[_0x80bea0];return _0x50fb90;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('Variable,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});}exports[_0xb814('0x18')]=function(_0x55ba16){var _0x270598=this;return new Promise(function(_0xfac75b,_0x4c3007){return db['Variable']['find']({'raw':_0x55ba16[_0xb814('0x19')]?_0x55ba16['options']['raw']===undefined?!![]:![]:!![],'where':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1a')]||null:null,'attributes':_0x55ba16['options']?_0x55ba16[_0xb814('0x19')]['attributes']||null:null,'include':_0x55ba16[_0xb814('0x19')]?_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x55ba16[_0xb814('0x19')][_0xb814('0x1b')],function(_0x1f5d40){return{'model':db[_0x1f5d40['model']],'as':_0x1f5d40['as'],'attributes':_0x1f5d40[_0xb814('0x1d')],'include':_0x1f5d40['include']?_[_0xb814('0x1c')](_0x1f5d40[_0xb814('0x1b')],function(_0x31c7ec){return{'model':db[_0x31c7ec[_0xb814('0x1e')]],'as':_0x31c7ec['as'],'attributes':_0x31c7ec[_0xb814('0x1d')],'include':_0x31c7ec[_0xb814('0x1b')]?_[_0xb814('0x1c')](_0x31c7ec['include'],function(_0x392222){return{'model':db[_0x392222[_0xb814('0x1e')]],'as':_0x392222['as'],'attributes':_0x392222[_0xb814('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb814('0xd')](function(_0x32ed56){logger[_0xb814('0xe')](_0xb814('0x18'),_0x55ba16);logger[_0xb814('0x11')]('ShowVariable',_0x55ba16,JSON[_0xb814('0x1f')](_0x32ed56));_0xfac75b(_0x32ed56);})[_0xb814('0x17')](function(_0x52ed64){logger[_0xb814('0x13')](_0xb814('0x18'),_0x52ed64[_0xb814('0x15')],_0x55ba16);_0x4c3007(_0x270598['error'](0x1f4,_0x52ed64[_0xb814('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 8bed50e..91d6a56 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 _0x8e5b=['express','Router','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','/pull','pull','/restart','restart','migrations'];(function(_0x1c96ae,_0x4bb028){var _0x20e299=function(_0x2e11f1){while(--_0x2e11f1){_0x1c96ae['push'](_0x1c96ae['shift']());}};_0x20e299(++_0x4bb028);}(_0x8e5b,0x1dc));var _0xb8e5=function(_0x5d7087,_0x2143f4){_0x5d7087=_0x5d7087-0x0;var _0x133447=_0x8e5b[_0x5d7087];return _0x133447;};'use strict';var express=require(_0xb8e5('0x0'));var router=express[_0xb8e5('0x1')]();var auth=require('../../components/auth/service');var controller=require('./version.controller');router[_0xb8e5('0x2')]('/',controller[_0xb8e5('0x3')]);router[_0xb8e5('0x2')](_0xb8e5('0x4'),auth['isAuthenticated'](),auth[_0xb8e5('0x5')](),controller[_0xb8e5('0x6')]);router[_0xb8e5('0x2')](_0xb8e5('0x7'),auth[_0xb8e5('0x8')](),auth['canUpdate'](),controller['reset']);router['get'](_0xb8e5('0x9'),auth[_0xb8e5('0x8')](),auth[_0xb8e5('0x5')](),controller[_0xb8e5('0xa')]);router[_0xb8e5('0x2')](_0xb8e5('0xb'),auth['isAuthenticated'](),controller[_0xb8e5('0xc')]);router[_0xb8e5('0x2')]('/migrations',controller[_0xb8e5('0xd')]);module['exports']=router; \ No newline at end of file +var _0xacad=['./version.controller','get','/fetch','isAuthenticated','/restart','/migrations','exports','express','Router'];(function(_0x54f440,_0x2b4796){var _0x45abd8=function(_0x464e53){while(--_0x464e53){_0x54f440['push'](_0x54f440['shift']());}};_0x45abd8(++_0x2b4796);}(_0xacad,0xdf));var _0xdaca=function(_0x4712c5,_0x54a5ca){_0x4712c5=_0x4712c5-0x0;var _0x458127=_0xacad[_0x4712c5];return _0x458127;};'use strict';var express=require(_0xdaca('0x0'));var router=express[_0xdaca('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xdaca('0x2'));router[_0xdaca('0x3')]('/',controller['index']);router[_0xdaca('0x3')](_0xdaca('0x4'),auth[_0xdaca('0x5')](),auth['canUpdate'](),controller['fetch']);router[_0xdaca('0x3')]('/reset',auth['isAuthenticated'](),auth['canUpdate'](),controller['reset']);router['get']('/pull',auth[_0xdaca('0x5')](),auth['canUpdate'](),controller['pull']);router[_0xdaca('0x3')](_0xdaca('0x6'),auth[_0xdaca('0x5')](),controller['restart']);router[_0xdaca('0x3')](_0xdaca('0x7'),controller['migrations']);module[_0xdaca('0x8')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 96b2186..c8b7918 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 _0x702b=['migrations','length','.js','push','Migration','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','map','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','latest','tags','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server'];(function(_0x490be3,_0xf0fca3){var _0x3f5140=function(_0x15fa80){while(--_0x15fa80){_0x490be3['push'](_0x490be3['shift']());}};_0x3f5140(++_0xf0fca3);}(_0x702b,0x75));var _0xb702=function(_0x2cbf63,_0x5d5757){_0x2cbf63=_0x2cbf63-0x0;var _0x51ce51=_0x702b[_0x2cbf63];return _0x51ce51;};'use strict';var Umzug=require('umzug');var path=require(_0xb702('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xb702('0x1'))(module,_0xb702('0x2'));var compareVersions=require(_0xb702('0x3'));var exec=require('child_process')[_0xb702('0x4')];var db=require(_0xb702('0x5'))['db'];var config=require(_0xb702('0x6'));var pm2=require(_0xb702('0x7'));var logger=require(_0xb702('0x8'))(_0xb702('0x9'));var git=require(_0xb702('0xa'))(config[_0xb702('0xb')]);exports[_0xb702('0xc')]=function(_0x3dfec8,_0x3c2cdf){var _0x14f70c={'current':module[_0xb702('0xd')][_0xb702('0x2')],'phonebar':0x2};if(_0x3dfec8['query']&&_0x3dfec8['query'][_0xb702('0xe')]){return git['fetch']()[_0xb702('0xf')](function(_0x3cc1a7,_0x147cb4){_0x14f70c['latest']=(_0x3cc1a7?module['exports'][_0xb702('0x2')]:_0x147cb4[_0xb702('0xe')])||_0xb702('0x10');return _0x3c2cdf[_0xb702('0x11')](0xc8)[_0xb702('0x12')](_0x14f70c);});}else{return _0x3c2cdf[_0xb702('0x11')](0xc8)['json'](_0x14f70c);}};exports[_0xb702('0x13')]=function(_0x475272,_0x469458){return git[_0xb702('0x13')]([_0xb702('0x14'),_0xb702('0x15')],function(_0x19614c){if(_0x19614c){logger[_0xb702('0x16')](_0x19614c);return _0x469458[_0xb702('0x11')](0x1f4)['json'](_0x19614c);}logger[_0xb702('0x17')](_0xb702('0x18'));return _0x469458[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x19')});});};exports[_0xb702('0x1a')]=function(_0x51726d,_0x5e8c50){return git[_0xb702('0x1a')]([_0xb702('0x1b'),_0xb702('0x1c')],function(_0x551478){if(_0x551478){logger['error'](_0x551478);return _0x5e8c50['status'](0x1f4)[_0xb702('0x12')](_0x551478);}logger[_0xb702('0x17')](_0xb702('0x1d'));return _0x5e8c50[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':'git\x20reset\x20--hard'});});};exports[_0xb702('0x1e')]=function(_0x629c6a,_0x18172c){exec('npm\x20install\x20--production',function(_0x5c723c,_0x290c98,_0x5344d6){logger['info'](_0x290c98);logger[_0xb702('0x17')](_0x5344d6);if(_0x5c723c){logger[_0xb702('0x16')](_0x5c723c);return _0x18172c[_0xb702('0x11')](0x1f4)[_0xb702('0x12')](_0x5c723c);}return _0x18172c[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0x290c98});});};exports[_0xb702('0x1f')]=function(_0x2929ac,_0x47a511){return pm2[_0xb702('0x1f')]('motion2')[_0xb702('0x20')](function(_0x277e46){logger[_0xb702('0x17')](_0xb702('0x21'),_0x277e46);return _0x47a511['status'](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x22')});})[_0xb702('0x23')](function(_0x4386bf){logger['error'](_0x4386bf);return _0x47a511[_0xb702('0x11')](0x1f4)['json'](_0x4386bf);});};exports['migrations']=function(_0x313abd,_0x1d04da){var _0x3241a8=fs[_0xb702('0x24')](path[_0xb702('0x25')](config['root'],_0xb702('0x26'),_0xb702('0x27')));var _0x1e51fb=[];for(var _0x41f7c3=0x0;_0x41f7c3<_0x3241a8[_0xb702('0x28')];_0x41f7c3++){var _0x59e216=_0x3241a8[_0x41f7c3]['replace'](_0xb702('0x29'),'');if(compareVersions(module[_0xb702('0xd')][_0xb702('0x2')],_0x59e216)===-0x1){_0x1e51fb[_0xb702('0x2a')](_0x59e216);}}if(_0x1e51fb['length']){var _0x42e41d=_0x1e51fb['sort'](compareVersions);var _0x201a77=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xb702('0x2b')],'modelName':_0xb702('0x2b'),'columnName':'version'},'migrations':{'params':[db[_0xb702('0x2c')]['getQueryInterface'](),db[_0xb702('0x2c')][_0xb702('0x2d')],function(){throw new Error(_0xb702('0x2e'));}],'path':path[_0xb702('0x25')](config[_0xb702('0xb')],_0xb702('0x26'),'migrations'),'pattern':/\.js$/}});_0x201a77['up']({'migrations':_[_0xb702('0x2f')](_0x42e41d,function(_0x196b76){return _0x196b76+'.js';})})[_0xb702('0x20')](function(){return _0x1d04da[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x30')+module[_0xb702('0xd')][_0xb702('0x2')]+'\x20to\x20'+_[_0xb702('0x31')](_0x42e41d),'migrations':_[_0xb702('0x25')](_0x42e41d)});})[_0xb702('0x23')](function(_0x3d6290){if(_0x3d6290 instanceof db['sequelize'][_0xb702('0x32')]){return _0x1d04da[_0xb702('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x1d04da[_0xb702('0x11')](0x1f4)[_0xb702('0x12')](_0x3d6290);}});}else{return _0x1d04da[_0xb702('0x11')](0xc8)[_0xb702('0x12')]({'output':_0xb702('0x33')});}}; \ No newline at end of file +var _0xeaeb=['join','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','version','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','exports','query','latest','fetch','tags','2.0.0','status','json','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','server','migrations','length','replace','.js','push','sequelize','Migration','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xeaeb,0x15d));var _0xbeae=function(_0x5cd2a0,_0x284c78){_0x5cd2a0=_0x5cd2a0-0x0;var _0x260959=_0xeaeb[_0x5cd2a0];return _0x260959;};'use strict';var Umzug=require(_0xbeae('0x0'));var path=require(_0xbeae('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require('pkginfo')(module,_0xbeae('0x2'));var compareVersions=require(_0xbeae('0x3'));var exec=require(_0xbeae('0x4'))[_0xbeae('0x5')];var db=require(_0xbeae('0x6'))['db'];var config=require(_0xbeae('0x7'));var pm2=require(_0xbeae('0x8'));var logger=require(_0xbeae('0x9'))('update');var git=require(_0xbeae('0xa'))(config[_0xbeae('0xb')]);exports[_0xbeae('0xc')]=function(_0x40d3a3,_0x437fee){var _0x57e1ab={'current':module[_0xbeae('0xd')][_0xbeae('0x2')],'phonebar':0x2};if(_0x40d3a3[_0xbeae('0xe')]&&_0x40d3a3[_0xbeae('0xe')][_0xbeae('0xf')]){return git[_0xbeae('0x10')]()[_0xbeae('0x11')](function(_0x1fae1f,_0x327266){_0x57e1ab[_0xbeae('0xf')]=(_0x1fae1f?module[_0xbeae('0xd')][_0xbeae('0x2')]:_0x327266['latest'])||_0xbeae('0x12');return _0x437fee[_0xbeae('0x13')](0xc8)[_0xbeae('0x14')](_0x57e1ab);});}else{return _0x437fee[_0xbeae('0x13')](0xc8)['json'](_0x57e1ab);}};exports[_0xbeae('0x10')]=function(_0x17e438,_0x37f52b){return git['fetch'](['origin',_0xbeae('0x15')],function(_0x2eef7b){if(_0x2eef7b){logger[_0xbeae('0x16')](_0x2eef7b);return _0x37f52b['status'](0x1f4)['json'](_0x2eef7b);}logger[_0xbeae('0x17')](_0xbeae('0x18'));return _0x37f52b[_0xbeae('0x13')](0xc8)['json']({'output':_0xbeae('0x19')});});};exports[_0xbeae('0x1a')]=function(_0x5ecb81,_0x5652bf){return git[_0xbeae('0x1a')]([_0xbeae('0x1b'),_0xbeae('0x1c')],function(_0x1d6e27){if(_0x1d6e27){logger['error'](_0x1d6e27);return _0x5652bf[_0xbeae('0x13')](0x1f4)[_0xbeae('0x14')](_0x1d6e27);}logger['info'](_0xbeae('0x1d'));return _0x5652bf[_0xbeae('0x13')](0xc8)[_0xbeae('0x14')]({'output':_0xbeae('0x1e')});});};exports[_0xbeae('0x1f')]=function(_0x26c9ab,_0xea7966){exec(_0xbeae('0x20'),function(_0x4907fa,_0x39f079,_0x15b227){logger[_0xbeae('0x17')](_0x39f079);logger[_0xbeae('0x17')](_0x15b227);if(_0x4907fa){logger['error'](_0x4907fa);return _0xea7966[_0xbeae('0x13')](0x1f4)[_0xbeae('0x14')](_0x4907fa);}return _0xea7966[_0xbeae('0x13')](0xc8)[_0xbeae('0x14')]({'output':_0x39f079});});};exports[_0xbeae('0x21')]=function(_0x3f66af,_0x5746e9){return pm2[_0xbeae('0x21')](_0xbeae('0x22'))[_0xbeae('0x23')](function(_0x42040e){logger[_0xbeae('0x17')](_0xbeae('0x24'),_0x42040e);return _0x5746e9[_0xbeae('0x13')](0xc8)['json']({'output':_0xbeae('0x25')});})[_0xbeae('0x26')](function(_0x21b094){logger[_0xbeae('0x16')](_0x21b094);return _0x5746e9['status'](0x1f4)[_0xbeae('0x14')](_0x21b094);});};exports['migrations']=function(_0x3da6f4,_0x4817d7){var _0x2a53e5=fs[_0xbeae('0x27')](path['join'](config['root'],_0xbeae('0x28'),_0xbeae('0x29')));var _0x42124d=[];for(var _0x20022b=0x0;_0x20022b<_0x2a53e5[_0xbeae('0x2a')];_0x20022b++){var _0x126bd4=_0x2a53e5[_0x20022b][_0xbeae('0x2b')](_0xbeae('0x2c'),'');if(compareVersions(module[_0xbeae('0xd')][_0xbeae('0x2')],_0x126bd4)===-0x1){_0x42124d[_0xbeae('0x2d')](_0x126bd4);}}if(_0x42124d['length']){var _0x4f8a3e=_0x42124d['sort'](compareVersions);var _0x1d8907=new Umzug({'storage':_0xbeae('0x2e'),'storageOptions':{'model':db[_0xbeae('0x2f')],'modelName':_0xbeae('0x2f'),'columnName':'version'},'migrations':{'params':[db[_0xbeae('0x2e')]['getQueryInterface'](),db[_0xbeae('0x2e')][_0xbeae('0x30')],function(){throw new Error(_0xbeae('0x31'));}],'path':path[_0xbeae('0x32')](config[_0xbeae('0xb')],'server','migrations'),'pattern':/\.js$/}});_0x1d8907['up']({'migrations':_[_0xbeae('0x33')](_0x4f8a3e,function(_0x3a42d7){return _0x3a42d7+'.js';})})[_0xbeae('0x23')](function(){return _0x4817d7['status'](0xc8)[_0xbeae('0x14')]({'output':_0xbeae('0x34')+module['exports'][_0xbeae('0x2')]+_0xbeae('0x35')+_[_0xbeae('0x36')](_0x4f8a3e),'migrations':_[_0xbeae('0x32')](_0x4f8a3e)});})[_0xbeae('0x26')](function(_0x24ae0d){if(_0x24ae0d instanceof db[_0xbeae('0x2e')][_0xbeae('0x37')]){return _0x4817d7[_0xbeae('0x13')](0xc8)[_0xbeae('0x14')]({'output':_0xbeae('0x38')});}else{return _0x4817d7['status'](0x1f4)[_0xbeae('0x14')](_0x24ae0d);}});}else{return _0x4817d7['status'](0xc8)[_0xbeae('0x14')]({'output':_0xbeae('0x38')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 40bb797..d849196 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 _0xfe3c=['util','path','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer'];(function(_0x42c853,_0x4460c0){var _0x1ad3d7=function(_0x2b6d76){while(--_0x2b6d76){_0x42c853['push'](_0x42c853['shift']());}};_0x1ad3d7(++_0x4460c0);}(_0xfe3c,0x1af));var _0xcfe3=function(_0x14c07f,_0x14fd24){_0x14c07f=_0x14c07f-0x0;var _0x5f114e=_0xfe3c[_0x14c07f];return _0x5f114e;};'use strict';var multer=require(_0xcfe3('0x0'));var util=require(_0xcfe3('0x1'));var path=require(_0xcfe3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcfe3('0x3'));var interaction=require(_0xcfe3('0x4'));var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0xcfe3('0x5')]('/',auth[_0xcfe3('0x6')](),controller[_0xcfe3('0x7')]);router[_0xcfe3('0x5')](_0xcfe3('0x8'),auth['isAuthenticated'](),controller[_0xcfe3('0x9')]);router['get'](_0xcfe3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xcfe3('0xb')]('/',auth['isAuthenticated'](),controller[_0xcfe3('0xc')]);router[_0xcfe3('0xd')](_0xcfe3('0xa'),auth['isAuthenticated'](),controller[_0xcfe3('0xe')]);router[_0xcfe3('0xf')](_0xcfe3('0xa'),auth['isAuthenticated'](),controller[_0xcfe3('0x10')]);module[_0xcfe3('0x11')]=router; \ No newline at end of file +var _0xf293=['./voiceAgentReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd578cb,_0x2167a3){var _0x775533=function(_0x1c340d){while(--_0x1c340d){_0xd578cb['push'](_0xd578cb['shift']());}};_0x775533(++_0x2167a3);}(_0xf293,0x186));var _0x3f29=function(_0x15206b,_0x3bbf56){_0x15206b=_0x15206b-0x0;var _0xf3f229=_0xf293[_0x15206b];return _0xf3f229;};'use strict';var multer=require('multer');var util=require(_0x3f29('0x0'));var path=require(_0x3f29('0x1'));var timeout=require(_0x3f29('0x2'));var express=require(_0x3f29('0x3'));var router=express[_0x3f29('0x4')]();var fs_extra=require(_0x3f29('0x5'));var auth=require(_0x3f29('0x6'));var interaction=require(_0x3f29('0x7'));var config=require(_0x3f29('0x8'));var controller=require(_0x3f29('0x9'));router[_0x3f29('0xa')]('/',auth[_0x3f29('0xb')](),controller[_0x3f29('0xc')]);router[_0x3f29('0xa')](_0x3f29('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0x3f29('0xa')](_0x3f29('0xe'),auth[_0x3f29('0xb')](),controller[_0x3f29('0xf')]);router[_0x3f29('0x10')]('/',auth['isAuthenticated'](),controller[_0x3f29('0x11')]);router[_0x3f29('0x12')](_0x3f29('0xe'),auth[_0x3f29('0xb')](),controller['update']);router[_0x3f29('0x13')](_0x3f29('0xe'),auth[_0x3f29('0xb')](),controller[_0x3f29('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 78dc134..7312ab2 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 _0xc2da=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x51a0a2,_0x31f10a){var _0x5286af=function(_0x1f30a6){while(--_0x1f30a6){_0x51a0a2['push'](_0x51a0a2['shift']());}};_0x5286af(++_0x31f10a);}(_0xc2da,0x124));var _0xac2d=function(_0x2b7248,_0x17b24e){_0x2b7248=_0x2b7248-0x0;var _0x418838=_0xc2da[_0x2b7248];return _0x418838;};'use strict';var Sequelize=require(_0xac2d('0x0'));module['exports']={'type':{'type':Sequelize[_0xac2d('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xac2d('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xac2d('0x1')]},'interface':{'type':Sequelize[_0xac2d('0x1')]},'membername':{'type':Sequelize[_0xac2d('0x1')]},'agentcalledAt':{'type':Sequelize[_0xac2d('0x2')]},'agentconnectAt':{'type':Sequelize[_0xac2d('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xac2d('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xac2d('0x2')]},'agentdumpAt':{'type':Sequelize[_0xac2d('0x2')]},'holdtime':{'type':Sequelize[_0xac2d('0x3')]},'agentcomplete':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xac2d('0x1')]},'lastevent':{'type':Sequelize[_0xac2d('0x1')]},'channel':{'type':Sequelize[_0xac2d('0x1')]},'channelstate':{'type':Sequelize[_0xac2d('0x3')]},'channelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xac2d('0x1')]},'context':{'type':Sequelize[_0xac2d('0x1')]},'exten':{'type':Sequelize[_0xac2d('0x1')]},'priority':{'type':Sequelize[_0xac2d('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xac2d('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridnum':{'type':Sequelize[_0xac2d('0x1')]},'destcalleridname':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xac2d('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xac2d('0x1')]},'destlanguage':{'type':Sequelize[_0xac2d('0x1')]},'destaccountcode':{'type':Sequelize[_0xac2d('0x1')]},'destcontext':{'type':Sequelize[_0xac2d('0x1')]},'destexten':{'type':Sequelize[_0xac2d('0x1')]},'destpriority':{'type':Sequelize[_0xac2d('0x1')]},'destuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac2d('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xac2d('0x1')]},'transfer':{'type':Sequelize[_0xac2d('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xac2d('0x5')},'transferexten':{'type':Sequelize[_0xac2d('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xac2d('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb10b=['DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING'];(function(_0x374cb0,_0x10e746){var _0x4ac25c=function(_0x562d53){while(--_0x562d53){_0x374cb0['push'](_0x374cb0['shift']());}};_0x4ac25c(++_0x10e746);}(_0xb10b,0x12a));var _0xbb10=function(_0x44e827,_0x145ed8){_0x44e827=_0x44e827-0x0;var _0xa19d97=_0xb10b[_0x44e827];return _0xa19d97;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'type':{'type':Sequelize[_0xbb10('0x1')]},'uniqueid':{'type':Sequelize[_0xbb10('0x1')]},'calleridnum':{'type':Sequelize[_0xbb10('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xbb10('0x1')]},'interface':{'type':Sequelize[_0xbb10('0x1')]},'membername':{'type':Sequelize[_0xbb10('0x1')]},'agentcalledAt':{'type':Sequelize[_0xbb10('0x2')]},'agentconnectAt':{'type':Sequelize[_0xbb10('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xbb10('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize[_0xbb10('0x2')]},'holdtime':{'type':Sequelize[_0xbb10('0x3')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xbb10('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xbb10('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xbb10('0x3')]},'agentacw':{'type':Sequelize[_0xbb10('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xbb10('0x3')]},'reason':{'type':Sequelize[_0xbb10('0x1')]},'lastevent':{'type':Sequelize[_0xbb10('0x1')]},'channel':{'type':Sequelize[_0xbb10('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xbb10('0x1')]},'connectedlinename':{'type':Sequelize[_0xbb10('0x1')]},'language':{'type':Sequelize[_0xbb10('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbb10('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xbb10('0x1')]},'destchannel':{'type':Sequelize[_0xbb10('0x1')]},'destchannelstate':{'type':Sequelize[_0xbb10('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xbb10('0x1')]},'destcalleridnum':{'type':Sequelize[_0xbb10('0x1')]},'destcalleridname':{'type':Sequelize[_0xbb10('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xbb10('0x1')]},'destlanguage':{'type':Sequelize[_0xbb10('0x1')]},'destaccountcode':{'type':Sequelize[_0xbb10('0x1')]},'destcontext':{'type':Sequelize[_0xbb10('0x1')]},'destexten':{'type':Sequelize[_0xbb10('0x1')]},'destpriority':{'type':Sequelize[_0xbb10('0x1')]},'destuniqueid':{'type':Sequelize[_0xbb10('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xbb10('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xbb10('0x1')]},'transfer':{'type':Sequelize[_0xbb10('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xbb10('0x5')},'transferexten':{'type':Sequelize[_0xbb10('0x1')]},'transferuniqueid':{'type':Sequelize[_0xbb10('0x1')]},'agententerreason':{'type':Sequelize[_0xbb10('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.controller.js b/server/api/voiceAgentReport/voiceAgentReport.controller.js index 29cae4b..7a0b833 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(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 2138d9c..34a291f 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 _0x1354=['rimraf','../../config/environment','./voiceAgentReport.attributes','VoiceAgentReport','report_agent','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0x1354,0x95));var _0x4135=function(_0x2ccd5e,_0x3deb44){_0x2ccd5e=_0x2ccd5e-0x0;var _0x1a758e=_0x1354[_0x2ccd5e];return _0x1a758e;};'use strict';var _=require(_0x4135('0x0'));var util=require(_0x4135('0x1'));var logger=require(_0x4135('0x2'))(_0x4135('0x3'));var moment=require(_0x4135('0x4'));var BPromise=require(_0x4135('0x5'));var rp=require(_0x4135('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4135('0x7'));var config=require(_0x4135('0x8'));var attributes=require(_0x4135('0x9'));module['exports']=function(_0x14ff47,_0x2bcd68){return _0x14ff47['define'](_0x4135('0xa'),attributes,{'tableName':_0x4135('0xb'),'paranoid':![],'indexes':[{'fields':[_0x4135('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x383d=['define','VoiceAgentReport','report_agent','uniqueid','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x744182,_0x5dbbeb){var _0x373526=function(_0x6b8344){while(--_0x6b8344){_0x744182['push'](_0x744182['shift']());}};_0x373526(++_0x5dbbeb);}(_0x383d,0x86));var _0xd383=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x383d[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd383('0x0'))(_0xd383('0x1'));var moment=require(_0xd383('0x2'));var BPromise=require('bluebird');var rp=require(_0xd383('0x3'));var fs=require('fs');var path=require(_0xd383('0x4'));var rimraf=require(_0xd383('0x5'));var config=require(_0xd383('0x6'));var attributes=require(_0xd383('0x7'));module[_0xd383('0x8')]=function(_0x5a0b1d,_0xc64e9b){return _0x5a0b1d[_0xd383('0x9')](_0xd383('0xa'),attributes,{'tableName':_0xd383('0xb'),'paranoid':![],'indexes':[{'fields':[_0xd383('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 6a5b007..29face7 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 _0xf87c=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','VoiceAgentReport','body','options','raw','CreateVoiceAgentReport','UpdateVoiceAgentReport','where','attributes','limit','debug','lodash','util','bluebird','randomstring'];(function(_0x2ca2f1,_0x4fd3db){var _0x3233b2=function(_0x22b1e2){while(--_0x22b1e2){_0x2ca2f1['push'](_0x2ca2f1['shift']());}};_0x3233b2(++_0x4fd3db);}(_0xf87c,0x78));var _0xcf87=function(_0x38854e,_0x23cbc9){_0x38854e=_0x38854e-0x0;var _0x3f8415=_0xf87c[_0x38854e];return _0x3f8415;};'use strict';var _=require(_0xcf87('0x0'));var util=require(_0xcf87('0x1'));var moment=require('moment');var BPromise=require(_0xcf87('0x2'));var rs=require(_0xcf87('0x3'));var fs=require('fs');var Redis=require(_0xcf87('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcf87('0x5'));var logger=require(_0xcf87('0x6'))(_0xcf87('0x7'));var config=require(_0xcf87('0x8'));var jayson=require(_0xcf87('0x9'));var client=jayson['client'][_0xcf87('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1378d3,_0x1d4019,_0x28f046){return new BPromise(function(_0x4a8b85,_0x4ba206){return client[_0xcf87('0xb')](_0x1378d3,_0x28f046)[_0xcf87('0xc')](function(_0x19afe7){logger[_0xcf87('0xd')](_0xcf87('0xe'),_0x1d4019,_0xcf87('0xf'));logger['debug']('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x1d4019,_0xcf87('0xf'),JSON[_0xcf87('0x10')](_0x19afe7));if(_0x19afe7[_0xcf87('0x11')]){if(_0x19afe7[_0xcf87('0x11')][_0xcf87('0x12')]===0x1f4){logger[_0xcf87('0x11')](_0xcf87('0xe'),_0x1d4019,_0x19afe7['error'][_0xcf87('0x13')]);return _0x4ba206(_0x19afe7['error'][_0xcf87('0x13')]);}logger[_0xcf87('0x11')](_0xcf87('0xe'),_0x1d4019,_0x19afe7[_0xcf87('0x11')]['message']);return _0x4a8b85(_0x19afe7[_0xcf87('0x11')]['message']);}else{logger['info'](_0xcf87('0xe'),_0x1d4019,_0xcf87('0xf'));_0x4a8b85(_0x19afe7['result'][_0xcf87('0x13')]);}})[_0xcf87('0x14')](function(_0x1238e1){logger['error'](_0xcf87('0xe'),_0x1d4019,_0x1238e1);_0x4ba206(_0x1238e1);});});}exports['CreateVoiceAgentReport']=function(_0x1a0b1f){var _0x377735=this;return new Promise(function(_0x34d298,_0x5d0f5c){return db[_0xcf87('0x15')]['create'](_0x1a0b1f[_0xcf87('0x16')],{'raw':_0x1a0b1f[_0xcf87('0x17')]?_0x1a0b1f[_0xcf87('0x17')][_0xcf87('0x18')]===undefined?!![]:![]:!![]})[_0xcf87('0xc')](function(_0x27c10c){logger[_0xcf87('0xd')](_0xcf87('0x19'),_0x1a0b1f);logger['debug'](_0xcf87('0x19'),_0x1a0b1f,JSON['stringify'](_0x27c10c));_0x34d298(_0x27c10c);})['catch'](function(_0x27c68f){logger[_0xcf87('0x11')](_0xcf87('0x19'),_0x27c68f[_0xcf87('0x13')],_0x1a0b1f);_0x5d0f5c(_0x377735[_0xcf87('0x11')](0x1f4,_0x27c68f[_0xcf87('0x13')]));});});};exports[_0xcf87('0x1a')]=function(_0xbd1f89){var _0x19c653=this;return new Promise(function(_0x3ad984,_0x46c048){return db[_0xcf87('0x15')]['update'](_0xbd1f89[_0xcf87('0x16')],{'raw':_0xbd1f89['options']?_0xbd1f89['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbd1f89[_0xcf87('0x17')]?_0xbd1f89[_0xcf87('0x17')][_0xcf87('0x1b')]||null:null,'attributes':_0xbd1f89['options']?_0xbd1f89['options'][_0xcf87('0x1c')]||null:null,'limit':_0xbd1f89[_0xcf87('0x17')]?_0xbd1f89[_0xcf87('0x17')][_0xcf87('0x1d')]||null:null})[_0xcf87('0xc')](function(_0x56a15b){logger[_0xcf87('0xd')](_0xcf87('0x1a'),_0xbd1f89);logger[_0xcf87('0x1e')](_0xcf87('0x1a'),_0xbd1f89,JSON['stringify'](_0x56a15b));_0x3ad984(_0x56a15b);})[_0xcf87('0x14')](function(_0x4ba9d3){logger['error']('UpdateVoiceAgentReport',_0x4ba9d3[_0xcf87('0x13')],_0xbd1f89);_0x46c048(_0x19c653[_0xcf87('0x11')](0x1f4,_0x4ba9d3[_0xcf87('0x13')]));});});}; \ No newline at end of file +var _0xb442=['raw','where','attributes','limit','lodash','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','VoiceAgentReport','options','then','CreateVoiceAgentReport','UpdateVoiceAgentReport','update'];(function(_0x3c1591,_0x516caa){var _0x2e3603=function(_0x11dc39){while(--_0x11dc39){_0x3c1591['push'](_0x3c1591['shift']());}};_0x2e3603(++_0x516caa);}(_0xb442,0x143));var _0x2b44=function(_0xa650fb,_0x104a00){_0xa650fb=_0xa650fb-0x0;var _0x99f4de=_0xb442[_0xa650fb];return _0x99f4de;};'use strict';var _=require(_0x2b44('0x0'));var util=require('util');var moment=require(_0x2b44('0x1'));var BPromise=require('bluebird');var rs=require(_0x2b44('0x2'));var fs=require('fs');var Redis=require(_0x2b44('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2b44('0x4'))(_0x2b44('0x5'));var config=require(_0x2b44('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2b44('0x7')][_0x2b44('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3110e2,_0x550159,_0x25e5ea){return new BPromise(function(_0x5878a7,_0x20ecdc){return client['request'](_0x3110e2,_0x25e5ea)['then'](function(_0x4ea855){logger[_0x2b44('0x9')]('VoiceAgentReport,\x20%s,\x20%s',_0x550159,_0x2b44('0xa'));logger[_0x2b44('0xb')](_0x2b44('0xc'),_0x550159,_0x2b44('0xa'),JSON[_0x2b44('0xd')](_0x4ea855));if(_0x4ea855[_0x2b44('0xe')]){if(_0x4ea855[_0x2b44('0xe')][_0x2b44('0xf')]===0x1f4){logger[_0x2b44('0xe')](_0x2b44('0x10'),_0x550159,_0x4ea855[_0x2b44('0xe')]['message']);return _0x20ecdc(_0x4ea855['error'][_0x2b44('0x11')]);}logger[_0x2b44('0xe')](_0x2b44('0x10'),_0x550159,_0x4ea855[_0x2b44('0xe')][_0x2b44('0x11')]);return _0x5878a7(_0x4ea855[_0x2b44('0xe')][_0x2b44('0x11')]);}else{logger[_0x2b44('0x9')](_0x2b44('0x10'),_0x550159,_0x2b44('0xa'));_0x5878a7(_0x4ea855['result'][_0x2b44('0x11')]);}})[_0x2b44('0x12')](function(_0x423266){logger[_0x2b44('0xe')](_0x2b44('0x10'),_0x550159,_0x423266);_0x20ecdc(_0x423266);});});}exports['CreateVoiceAgentReport']=function(_0x4bc402){var _0x563c82=this;return new Promise(function(_0x337b35,_0x546b15){return db[_0x2b44('0x13')]['create'](_0x4bc402['body'],{'raw':_0x4bc402[_0x2b44('0x14')]?_0x4bc402[_0x2b44('0x14')]['raw']===undefined?!![]:![]:!![]})[_0x2b44('0x15')](function(_0x71dd9b){logger[_0x2b44('0x9')]('CreateVoiceAgentReport',_0x4bc402);logger[_0x2b44('0xb')](_0x2b44('0x16'),_0x4bc402,JSON[_0x2b44('0xd')](_0x71dd9b));_0x337b35(_0x71dd9b);})[_0x2b44('0x12')](function(_0x5b6dd2){logger[_0x2b44('0xe')](_0x2b44('0x16'),_0x5b6dd2[_0x2b44('0x11')],_0x4bc402);_0x546b15(_0x563c82[_0x2b44('0xe')](0x1f4,_0x5b6dd2[_0x2b44('0x11')]));});});};exports[_0x2b44('0x17')]=function(_0x5afe1f){var _0x274de6=this;return new Promise(function(_0x510393,_0x27cd33){return db[_0x2b44('0x13')][_0x2b44('0x18')](_0x5afe1f['body'],{'raw':_0x5afe1f[_0x2b44('0x14')]?_0x5afe1f[_0x2b44('0x14')][_0x2b44('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5afe1f['options']?_0x5afe1f['options'][_0x2b44('0x1a')]||null:null,'attributes':_0x5afe1f[_0x2b44('0x14')]?_0x5afe1f[_0x2b44('0x14')][_0x2b44('0x1b')]||null:null,'limit':_0x5afe1f[_0x2b44('0x14')]?_0x5afe1f[_0x2b44('0x14')][_0x2b44('0x1c')]||null:null})['then'](function(_0x9a8e4d){logger[_0x2b44('0x9')](_0x2b44('0x17'),_0x5afe1f);logger[_0x2b44('0xb')](_0x2b44('0x17'),_0x5afe1f,JSON[_0x2b44('0xd')](_0x9a8e4d));_0x510393(_0x9a8e4d);})[_0x2b44('0x12')](function(_0x47712c){logger['error'](_0x2b44('0x17'),_0x47712c[_0x2b44('0x11')],_0x5afe1f);_0x27cd33(_0x274de6['error'](0x1f4,_0x47712c[_0x2b44('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 07a10c9..44241a7 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 _0x199a=['Router','../../components/auth/service','./voiceCallReport.controller','isAuthenticated','index','get','/describe','create','put','/:id','/with-retry/:id','delete','destroy'];(function(_0x315a7e,_0x6df2bc){var _0x30efbf=function(_0x33236b){while(--_0x33236b){_0x315a7e['push'](_0x315a7e['shift']());}};_0x30efbf(++_0x6df2bc);}(_0x199a,0x193));var _0xa199=function(_0x3a6778,_0x289fcb){_0x3a6778=_0x3a6778-0x0;var _0x516032=_0x199a[_0x3a6778];return _0x516032;};'use strict';var express=require('express');var router=express[_0xa199('0x0')]();var auth=require(_0xa199('0x1'));var controller=require(_0xa199('0x2'));router['get']('/',auth[_0xa199('0x3')](),controller[_0xa199('0x4')]);router[_0xa199('0x5')](_0xa199('0x6'),auth[_0xa199('0x3')](),controller['describe']);router[_0xa199('0x5')]('/:id',auth[_0xa199('0x3')](),controller['show']);router['post']('/',auth[_0xa199('0x3')](),controller[_0xa199('0x7')]);router[_0xa199('0x8')](_0xa199('0x9'),auth[_0xa199('0x3')](),controller['update']);router[_0xa199('0x8')](_0xa199('0xa'),auth[_0xa199('0x3')](),controller['updateWithRetry']);router[_0xa199('0xb')](_0xa199('0x9'),auth[_0xa199('0x3')](),controller[_0xa199('0xc')]);module['exports']=router; \ No newline at end of file +var _0x7eee=['show','update','put','/with-retry/:id','updateWithRetry','delete','express','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x7eee,0xba));var _0xe7ee=function(_0x42de07,_0x1d9d75){_0x42de07=_0x42de07-0x0;var _0xa15718=_0x7eee[_0x42de07];return _0xa15718;};'use strict';var express=require(_0xe7ee('0x0'));var router=express['Router']();var auth=require(_0xe7ee('0x1'));var controller=require(_0xe7ee('0x2'));router[_0xe7ee('0x3')]('/',auth[_0xe7ee('0x4')](),controller[_0xe7ee('0x5')]);router['get'](_0xe7ee('0x6'),auth[_0xe7ee('0x4')](),controller[_0xe7ee('0x7')]);router[_0xe7ee('0x3')](_0xe7ee('0x8'),auth[_0xe7ee('0x4')](),controller[_0xe7ee('0x9')]);router['post']('/',auth[_0xe7ee('0x4')](),controller['create']);router['put'](_0xe7ee('0x8'),auth['isAuthenticated'](),controller[_0xe7ee('0xa')]);router[_0xe7ee('0xb')](_0xe7ee('0xc'),auth[_0xe7ee('0x4')](),controller[_0xe7ee('0xd')]);router[_0xe7ee('0xe')](_0xe7ee('0x8'),auth[_0xe7ee('0x4')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 0ac617b..2c87dc0 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 _0xf496=['dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','outbound','inbound-fax'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0xf496,0x1c7));var _0x6f49=function(_0x4d01f1,_0x48b783){_0x4d01f1=_0x4d01f1-0x0;var _0x29a7cb=_0xf496[_0x4d01f1];return _0x29a7cb;};'use strict';var Sequelize=require(_0x6f49('0x0'));module[_0x6f49('0x1')]={'uniqueid':{'type':Sequelize[_0x6f49('0x2')]},'type':{'type':Sequelize[_0x6f49('0x3')](_0x6f49('0x4'),'internal',_0x6f49('0x5'),_0x6f49('0x6'),'outbound-fax',_0x6f49('0x7'))},'tag':{'type':Sequelize[_0x6f49('0x2')]},'accountcode':{'type':Sequelize[_0x6f49('0x2')]},'source':{'type':Sequelize[_0x6f49('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x6f49('0x2')]},'callerid':{'type':Sequelize[_0x6f49('0x2')]},'channel':{'type':Sequelize[_0x6f49('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6f49('0x8')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize[_0x6f49('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x6f49('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6f49('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x6f49('0x2')]},'userDisposition':{'type':Sequelize[_0x6f49('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x6f49('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x6f49('0x2')]},'note':{'type':Sequelize[_0x6f49('0x2')]},'prefix':{'type':Sequelize[_0x6f49('0x2')]},'routeid':{'type':Sequelize[_0x6f49('0xa')]},'sipcallid':{'type':Sequelize[_0x6f49('0x2')]}}; \ No newline at end of file +var _0xbac6=['outbound','outbound-fax','dialer','DATE','sequelize','exports','STRING','inbound'];(function(_0x1f90f7,_0x537e14){var _0x18af35=function(_0x11441f){while(--_0x11441f){_0x1f90f7['push'](_0x1f90f7['shift']());}};_0x18af35(++_0x537e14);}(_0xbac6,0x1ec));var _0x6bac=function(_0x513e5f,_0x444f07){_0x513e5f=_0x513e5f-0x0;var _0x41ce55=_0xbac6[_0x513e5f];return _0x41ce55;};'use strict';var Sequelize=require(_0x6bac('0x0'));module[_0x6bac('0x1')]={'uniqueid':{'type':Sequelize[_0x6bac('0x2')]},'type':{'type':Sequelize['ENUM'](_0x6bac('0x3'),'internal',_0x6bac('0x4'),'inbound-fax',_0x6bac('0x5'),_0x6bac('0x6'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x6bac('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0x6bac('0x2')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x6bac('0x2')]},'channel':{'type':Sequelize[_0x6bac('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x6bac('0x7')]},'endtime':{'type':Sequelize[_0x6bac('0x7')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6bac('0x2')]},'amaflags':{'type':Sequelize[_0x6bac('0x2')]},'userfield':{'type':Sequelize[_0x6bac('0x2')]},'userDisposition':{'type':Sequelize[_0x6bac('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x6bac('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x6bac('0x2')]},'prefix':{'type':Sequelize[_0x6bac('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x6bac('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index b2c1c11..bd4ade3 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 _0x2581=['VIRTUAL','filter','merge','options','fullname','alias','User','findAll','catch','params','includeAll','include','find','create','body','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x2581,0xcb));var _0x1258=function(_0x2ba58,_0x2eaf8c){_0x2ba58=_0x2ba58-0x0;var _0x35e4b5=_0x2581[_0x2ba58];return _0x35e4b5;};'use strict';var _=require(_0x1258('0x0'));var qs=require(_0x1258('0x1'));var logger=require(_0x1258('0x2'))(_0x1258('0x3'));var db=require(_0x1258('0x4'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x37572e,_0x1235e5){_0x1235e5=_0x1235e5||0xc8;return function(_0x339891){if(_0x339891){return _0x37572e[_0x1258('0x5')](_0x1235e5)[_0x1258('0x6')](_0x339891);}};}function respondWithFilteredResult(_0x1a5749,_0x16c926){return function(_0x2aeafc){if(_0x2aeafc){var _0x582ed7=typeof _0x16c926[_0x1258('0x7')]===_0x1258('0x8')&&typeof _0x16c926[_0x1258('0x9')]===_0x1258('0x8');var _0x44be2b=_0x2aeafc[_0x1258('0xa')];var _0x429efc=_0x582ed7?0x0:_0x16c926['offset'];var _0x4c35f9=_0x582ed7?_0x2aeafc[_0x1258('0xa')]:_0x16c926[_0x1258('0x7')]+_0x16c926[_0x1258('0x9')];var _0x1fe32a;if(_0x4c35f9>=_0x44be2b){_0x4c35f9=_0x44be2b;_0x1fe32a=0xc8;}else{_0x1fe32a=0xce;}_0x1a5749['status'](_0x1fe32a);return _0x1a5749[_0x1258('0xb')](_0x1258('0xc'),_0x429efc+'-'+_0x4c35f9+'/'+_0x44be2b)[_0x1258('0x6')](_0x2aeafc);}return null;};}function saveUpdates(_0x241bad){return function(_0x57ad9f){if(_0x57ad9f){return _0x57ad9f[_0x1258('0xd')](_0x241bad)[_0x1258('0xe')](function(_0x37fee3){return _0x37fee3;});}return null;};}function removeEntity(_0x41b891){return function(_0x2f9cd6){if(_0x2f9cd6){return _0x2f9cd6[_0x1258('0xf')]()[_0x1258('0xe')](function(){_0x41b891['status'](0xcc)[_0x1258('0x10')]();});}};}function handleEntityNotFound(_0x56bd82){return function(_0x477502){if(!_0x477502){_0x56bd82[_0x1258('0x11')](0x194);}return _0x477502;};}function handleError(_0x3e662d,_0x26e676){_0x26e676=_0x26e676||0x1f4;return function(_0x313717){logger['error'](_0x313717[_0x1258('0x12')]);if(_0x313717[_0x1258('0x13')]){delete _0x313717[_0x1258('0x13')];}_0x3e662d['status'](_0x26e676)[_0x1258('0x14')](_0x313717);};}exports[_0x1258('0x15')]=function(_0x55c458,_0x2dd7fd){var _0x2432b2={},_0x2d3327={},_0xb0b379={'count':0x0,'rows':[]};var _0x24074b=_[_0x1258('0x16')](db[_0x1258('0x17')][_0x1258('0x18')],function(_0x3dade8){return{'name':_0x3dade8[_0x1258('0x19')],'type':_0x3dade8[_0x1258('0x1a')][_0x1258('0x1b')]};});_0x2d3327[_0x1258('0x1c')]=_[_0x1258('0x16')](_0x24074b,_0x1258('0x13'));_0x2d3327['query']=_[_0x1258('0x1d')](_0x55c458['query']);_0x2d3327['filters']=_[_0x1258('0x1e')](_0x2d3327[_0x1258('0x1c')],_0x2d3327[_0x1258('0x1f')]);_0x2432b2[_0x1258('0x20')]=_[_0x1258('0x1e')](_0x2d3327[_0x1258('0x1c')],qs[_0x1258('0x21')](_0x55c458['query'][_0x1258('0x21')]));_0x2432b2[_0x1258('0x20')]=_0x2432b2[_0x1258('0x20')][_0x1258('0x22')]?_0x2432b2[_0x1258('0x20')]:_0x2d3327[_0x1258('0x1c')];if(!_0x55c458[_0x1258('0x1f')][_0x1258('0x23')](_0x1258('0x24'))){_0x2432b2[_0x1258('0x9')]=qs[_0x1258('0x9')](_0x55c458[_0x1258('0x1f')][_0x1258('0x9')]);_0x2432b2['offset']=qs['offset'](_0x55c458[_0x1258('0x1f')]['offset']);}_0x2432b2[_0x1258('0x25')]=qs[_0x1258('0x26')](_0x55c458['query'][_0x1258('0x26')]);_0x2432b2[_0x1258('0x27')]=qs[_0x1258('0x28')](_['pick'](_0x55c458['query'],_0x2d3327[_0x1258('0x28')]),_0x24074b);if(_0x55c458[_0x1258('0x1f')]['filter']){_0x2432b2[_0x1258('0x27')]=_['merge'](_0x2432b2[_0x1258('0x27')],{'$or':_[_0x1258('0x16')](_0x24074b,function(_0x27d072){if(_0x27d072[_0x1258('0x1a')]!==_0x1258('0x29')){var _0x563a28={};_0x563a28[_0x27d072['name']]={'$like':'%'+_0x55c458[_0x1258('0x1f')][_0x1258('0x2a')]+'%'};return _0x563a28;}})});}_0x2432b2=_[_0x1258('0x2b')]({},_0x2432b2,_0x55c458[_0x1258('0x2c')]);var _0x3dac88={'where':_0x2432b2[_0x1258('0x27')]};return db['VoiceCallReport']['count'](_0x3dac88)[_0x1258('0xe')](function(_0x38057e){_0xb0b379['count']=_0x38057e;if(_0x55c458['query']['includeAll']){_0x2432b2['include']=[{'attributes':['id',_0x1258('0x13'),_0x1258('0x2d'),_0x1258('0x2e')],'model':db[_0x1258('0x2f')],'as':_0x1258('0x2f')}];}return db[_0x1258('0x17')][_0x1258('0x30')](_0x2432b2);})[_0x1258('0xe')](function(_0x32aed5){_0xb0b379['rows']=_0x32aed5;return _0xb0b379;})['then'](respondWithFilteredResult(_0x2dd7fd,_0x2432b2))[_0x1258('0x31')](handleError(_0x2dd7fd,null));};exports['show']=function(_0x2d2183,_0x5b777f){var _0x36c36e={'raw':!![],'where':{'id':_0x2d2183[_0x1258('0x32')]['id']}},_0x2edb1b={};_0x2edb1b[_0x1258('0x1c')]=_[_0x1258('0x1d')](db[_0x1258('0x17')][_0x1258('0x18')]);_0x2edb1b[_0x1258('0x1f')]=_['keys'](_0x2d2183[_0x1258('0x1f')]);_0x2edb1b[_0x1258('0x28')]=_[_0x1258('0x1e')](_0x2edb1b[_0x1258('0x1c')],_0x2edb1b[_0x1258('0x1f')]);_0x36c36e[_0x1258('0x20')]=_['intersection'](_0x2edb1b['model'],qs[_0x1258('0x21')](_0x2d2183[_0x1258('0x1f')][_0x1258('0x21')]));_0x36c36e['attributes']=_0x36c36e[_0x1258('0x20')]['length']?_0x36c36e['attributes']:_0x2edb1b[_0x1258('0x1c')];if(_0x2d2183[_0x1258('0x1f')][_0x1258('0x33')]){_0x36c36e[_0x1258('0x34')]=[{'all':!![]}];}_0x36c36e=_[_0x1258('0x2b')]({},_0x36c36e,_0x2d2183[_0x1258('0x2c')]);return db[_0x1258('0x17')][_0x1258('0x35')](_0x36c36e)[_0x1258('0xe')](handleEntityNotFound(_0x5b777f,null))[_0x1258('0xe')](respondWithResult(_0x5b777f,null))[_0x1258('0x31')](handleError(_0x5b777f,null));};exports[_0x1258('0x36')]=function(_0x24b415,_0x365344){return db['VoiceCallReport'][_0x1258('0x36')](_0x24b415[_0x1258('0x37')],{})[_0x1258('0xe')](respondWithResult(_0x365344,0xc9))[_0x1258('0x31')](handleError(_0x365344,null));};exports[_0x1258('0xf')]=function(_0x2f2e08,_0x1d11c5){return db['VoiceCallReport'][_0x1258('0x35')]({'where':{'id':_0x2f2e08[_0x1258('0x32')]['id']}})[_0x1258('0xe')](handleEntityNotFound(_0x1d11c5,null))[_0x1258('0xe')](removeEntity(_0x1d11c5,null))[_0x1258('0x31')](handleError(_0x1d11c5,null));};exports[_0x1258('0x38')]=function(_0x2f3be4,_0x10addc){return db[_0x1258('0x17')][_0x1258('0x38')]()[_0x1258('0xe')](respondWithResult(_0x10addc,null))[_0x1258('0x31')](handleError(_0x10addc,null));};function findForUpdate(_0x119fca){return db[_0x1258('0x17')][_0x1258('0x35')]({'where':{'uniqueid':_0x119fca[_0x1258('0x32')]['id'],'UserId':{'$or':[null,_0x119fca[_0x1258('0x39')]['id']]}}});}exports[_0x1258('0xd')]=function(_0x455415,_0x5e4ff4){if(_0x455415[_0x1258('0x37')][_0x1258('0x3a')]){delete _0x455415['body']['uniqueid'];}return findForUpdate(_0x455415)[_0x1258('0xe')](handleEntityNotFound(_0x5e4ff4,null))[_0x1258('0xe')](saveUpdates(_0x455415[_0x1258('0x37')],null))['then'](respondWithResult(_0x5e4ff4,null))[_0x1258('0x31')](handleError(_0x5e4ff4,null));};exports[_0x1258('0x3b')]=function(_0x4631a2,_0x55d6f7,_0x3ca592){if(_0x4631a2[_0x1258('0x37')][_0x1258('0x3a')]){delete _0x4631a2[_0x1258('0x37')]['uniqueid'];}promiseRetry(function(_0x579662){return findForUpdate(_0x4631a2)['then'](function(_0x3fcff8){if(_0x3fcff8!==null){return _0x3fcff8;}else{_0x579662(new Error(_0x1258('0x3c')));}});},{'retries':0x4,'minTimeout':0xfa})['then'](function(_0x73c23a){if(!_0x73c23a){return new Promise(function(_0x39b4d0){_0x39b4d0(handleEntityNotFound(_0x55d6f7)());});}else{return _0x73c23a[_0x1258('0xd')](_0x4631a2[_0x1258('0x37')])['then'](function(_0x3d7327){return respondWithResult(_0x55d6f7)(_0x3d7327);});}},function(){handleEntityNotFound(_0x55d6f7)();});}; \ No newline at end of file +var _0x2aa3=['User','findAll','rows','show','params','find','catch','create','describe','body','uniqueid','updateWithRetry','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','map','VoiceCallReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','fullname','alias'];(function(_0xd3234,_0x4cb3e5){var _0xc3ce5=function(_0x250f3){while(--_0x250f3){_0xd3234['push'](_0xd3234['shift']());}};_0xc3ce5(++_0x4cb3e5);}(_0x2aa3,0x83));var _0x32aa=function(_0x2ae74b,_0x555158){_0x2ae74b=_0x2ae74b-0x0;var _0x5246ed=_0x2aa3[_0x2ae74b];return _0x5246ed;};'use strict';var _=require(_0x32aa('0x0'));var qs=require(_0x32aa('0x1'));var logger=require(_0x32aa('0x2'))(_0x32aa('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x18a101,_0x2b754c){_0x2b754c=_0x2b754c||0xc8;return function(_0x13843c){if(_0x13843c){return _0x18a101[_0x32aa('0x4')](_0x2b754c)[_0x32aa('0x5')](_0x13843c);}};}function respondWithFilteredResult(_0x3d7c94,_0x53ab98){return function(_0x17346a){if(_0x17346a){var _0x112396=typeof _0x53ab98[_0x32aa('0x6')]===_0x32aa('0x7')&&typeof _0x53ab98[_0x32aa('0x8')]===_0x32aa('0x7');var _0x2fe991=_0x17346a[_0x32aa('0x9')];var _0x5d280e=_0x112396?0x0:_0x53ab98[_0x32aa('0x6')];var _0x56992d=_0x112396?_0x17346a[_0x32aa('0x9')]:_0x53ab98[_0x32aa('0x6')]+_0x53ab98[_0x32aa('0x8')];var _0x24fde2;if(_0x56992d>=_0x2fe991){_0x56992d=_0x2fe991;_0x24fde2=0xc8;}else{_0x24fde2=0xce;}_0x3d7c94['status'](_0x24fde2);return _0x3d7c94[_0x32aa('0xa')](_0x32aa('0xb'),_0x5d280e+'-'+_0x56992d+'/'+_0x2fe991)[_0x32aa('0x5')](_0x17346a);}return null;};}function saveUpdates(_0x59b0f6){return function(_0x3d341f){if(_0x3d341f){return _0x3d341f[_0x32aa('0xc')](_0x59b0f6)[_0x32aa('0xd')](function(_0x22c07a){return _0x22c07a;});}return null;};}function removeEntity(_0x2329c3){return function(_0x6f6888){if(_0x6f6888){return _0x6f6888[_0x32aa('0xe')]()[_0x32aa('0xd')](function(){_0x2329c3['status'](0xcc)[_0x32aa('0xf')]();});}};}function handleEntityNotFound(_0x230d19){return function(_0x1140a6){if(!_0x1140a6){_0x230d19[_0x32aa('0x10')](0x194);}return _0x1140a6;};}function handleError(_0x211278,_0x47eadd){_0x47eadd=_0x47eadd||0x1f4;return function(_0x2b1704){logger[_0x32aa('0x11')](_0x2b1704[_0x32aa('0x12')]);if(_0x2b1704[_0x32aa('0x13')]){delete _0x2b1704[_0x32aa('0x13')];}_0x211278['status'](_0x47eadd)['send'](_0x2b1704);};}exports[_0x32aa('0x14')]=function(_0x34dcaf,_0x257be0){var _0x52a182={},_0x5b48ee={},_0x1a0262={'count':0x0,'rows':[]};var _0x148255=_[_0x32aa('0x15')](db[_0x32aa('0x16')][_0x32aa('0x17')],function(_0x1cb0eb){return{'name':_0x1cb0eb['fieldName'],'type':_0x1cb0eb[_0x32aa('0x18')][_0x32aa('0x19')]};});_0x5b48ee[_0x32aa('0x1a')]=_[_0x32aa('0x15')](_0x148255,_0x32aa('0x13'));_0x5b48ee[_0x32aa('0x1b')]=_[_0x32aa('0x1c')](_0x34dcaf[_0x32aa('0x1b')]);_0x5b48ee[_0x32aa('0x1d')]=_['intersection'](_0x5b48ee[_0x32aa('0x1a')],_0x5b48ee['query']);_0x52a182[_0x32aa('0x1e')]=_[_0x32aa('0x1f')](_0x5b48ee['model'],qs['fields'](_0x34dcaf[_0x32aa('0x1b')][_0x32aa('0x20')]));_0x52a182[_0x32aa('0x1e')]=_0x52a182[_0x32aa('0x1e')][_0x32aa('0x21')]?_0x52a182[_0x32aa('0x1e')]:_0x5b48ee[_0x32aa('0x1a')];if(!_0x34dcaf[_0x32aa('0x1b')][_0x32aa('0x22')]('nolimit')){_0x52a182[_0x32aa('0x8')]=qs[_0x32aa('0x8')](_0x34dcaf['query'][_0x32aa('0x8')]);_0x52a182['offset']=qs['offset'](_0x34dcaf[_0x32aa('0x1b')][_0x32aa('0x6')]);}_0x52a182[_0x32aa('0x23')]=qs[_0x32aa('0x24')](_0x34dcaf['query'][_0x32aa('0x24')]);_0x52a182[_0x32aa('0x25')]=qs[_0x32aa('0x1d')](_[_0x32aa('0x26')](_0x34dcaf[_0x32aa('0x1b')],_0x5b48ee[_0x32aa('0x1d')]),_0x148255);if(_0x34dcaf['query']['filter']){_0x52a182[_0x32aa('0x25')]=_[_0x32aa('0x27')](_0x52a182[_0x32aa('0x25')],{'$or':_[_0x32aa('0x15')](_0x148255,function(_0x4d09db){if(_0x4d09db['type']!==_0x32aa('0x28')){var _0x4eb646={};_0x4eb646[_0x4d09db[_0x32aa('0x13')]]={'$like':'%'+_0x34dcaf[_0x32aa('0x1b')]['filter']+'%'};return _0x4eb646;}})});}_0x52a182=_[_0x32aa('0x27')]({},_0x52a182,_0x34dcaf[_0x32aa('0x29')]);var _0x5da0b6={'where':_0x52a182[_0x32aa('0x25')]};return db[_0x32aa('0x16')][_0x32aa('0x9')](_0x5da0b6)[_0x32aa('0xd')](function(_0x28960b){_0x1a0262[_0x32aa('0x9')]=_0x28960b;if(_0x34dcaf[_0x32aa('0x1b')][_0x32aa('0x2a')]){_0x52a182[_0x32aa('0x2b')]=[{'attributes':['id',_0x32aa('0x13'),_0x32aa('0x2c'),_0x32aa('0x2d')],'model':db[_0x32aa('0x2e')],'as':_0x32aa('0x2e')}];}return db['VoiceCallReport'][_0x32aa('0x2f')](_0x52a182);})[_0x32aa('0xd')](function(_0x2aaa10){_0x1a0262[_0x32aa('0x30')]=_0x2aaa10;return _0x1a0262;})[_0x32aa('0xd')](respondWithFilteredResult(_0x257be0,_0x52a182))['catch'](handleError(_0x257be0,null));};exports[_0x32aa('0x31')]=function(_0x6ee484,_0x35ee5f){var _0x106279={'raw':!![],'where':{'id':_0x6ee484[_0x32aa('0x32')]['id']}},_0x255da6={};_0x255da6[_0x32aa('0x1a')]=_[_0x32aa('0x1c')](db[_0x32aa('0x16')][_0x32aa('0x17')]);_0x255da6[_0x32aa('0x1b')]=_['keys'](_0x6ee484['query']);_0x255da6[_0x32aa('0x1d')]=_[_0x32aa('0x1f')](_0x255da6[_0x32aa('0x1a')],_0x255da6[_0x32aa('0x1b')]);_0x106279[_0x32aa('0x1e')]=_[_0x32aa('0x1f')](_0x255da6[_0x32aa('0x1a')],qs['fields'](_0x6ee484[_0x32aa('0x1b')][_0x32aa('0x20')]));_0x106279[_0x32aa('0x1e')]=_0x106279[_0x32aa('0x1e')]['length']?_0x106279[_0x32aa('0x1e')]:_0x255da6['model'];if(_0x6ee484[_0x32aa('0x1b')][_0x32aa('0x2a')]){_0x106279[_0x32aa('0x2b')]=[{'all':!![]}];}_0x106279=_[_0x32aa('0x27')]({},_0x106279,_0x6ee484[_0x32aa('0x29')]);return db['VoiceCallReport'][_0x32aa('0x33')](_0x106279)[_0x32aa('0xd')](handleEntityNotFound(_0x35ee5f,null))[_0x32aa('0xd')](respondWithResult(_0x35ee5f,null))[_0x32aa('0x34')](handleError(_0x35ee5f,null));};exports['create']=function(_0x142572,_0x483a04){return db[_0x32aa('0x16')][_0x32aa('0x35')](_0x142572['body'],{})[_0x32aa('0xd')](respondWithResult(_0x483a04,0xc9))[_0x32aa('0x34')](handleError(_0x483a04,null));};exports[_0x32aa('0xe')]=function(_0x51de96,_0x11afd5){return db[_0x32aa('0x16')][_0x32aa('0x33')]({'where':{'id':_0x51de96[_0x32aa('0x32')]['id']}})['then'](handleEntityNotFound(_0x11afd5,null))['then'](removeEntity(_0x11afd5,null))[_0x32aa('0x34')](handleError(_0x11afd5,null));};exports[_0x32aa('0x36')]=function(_0x250159,_0x3d99ff){return db[_0x32aa('0x16')]['describe']()[_0x32aa('0xd')](respondWithResult(_0x3d99ff,null))[_0x32aa('0x34')](handleError(_0x3d99ff,null));};function findForUpdate(_0x2a09f8){return db['VoiceCallReport'][_0x32aa('0x33')]({'where':{'uniqueid':_0x2a09f8['params']['id'],'UserId':{'$or':[null,_0x2a09f8['user']['id']]}}});}exports[_0x32aa('0xc')]=function(_0x3907fe,_0x9fe46b){if(_0x3907fe['body']['uniqueid']){delete _0x3907fe[_0x32aa('0x37')][_0x32aa('0x38')];}return findForUpdate(_0x3907fe)[_0x32aa('0xd')](handleEntityNotFound(_0x9fe46b,null))[_0x32aa('0xd')](saveUpdates(_0x3907fe[_0x32aa('0x37')],null))[_0x32aa('0xd')](respondWithResult(_0x9fe46b,null))[_0x32aa('0x34')](handleError(_0x9fe46b,null));};exports[_0x32aa('0x39')]=function(_0x3076af,_0x43c997,_0x20b399){if(_0x3076af[_0x32aa('0x37')][_0x32aa('0x38')]){delete _0x3076af[_0x32aa('0x37')]['uniqueid'];}promiseRetry(function(_0x5371b4){return findForUpdate(_0x3076af)[_0x32aa('0xd')](function(_0x3aca21){if(_0x3aca21!==null){return _0x3aca21;}else{_0x5371b4(new Error(_0x32aa('0x3a')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x32aa('0xd')](function(_0x1706d2){if(!_0x1706d2){return new Promise(function(_0x1cd98d){_0x1cd98d(handleEntityNotFound(_0x43c997)());});}else{return _0x1706d2[_0x32aa('0xc')](_0x3076af[_0x32aa('0x37')])['then'](function(_0x5573f7){return respondWithResult(_0x43c997)(_0x5573f7);});}},function(){handleEntityNotFound(_0x43c997)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 6c7e975..3d50007 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 _0xc9b7=['../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x25e9d3,_0x4ece1a){var _0x34e2c6=function(_0x28f48b){while(--_0x28f48b){_0x25e9d3['push'](_0x25e9d3['shift']());}};_0x34e2c6(++_0x4ece1a);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x369f62,_0x17a354){_0x369f62=_0x369f62-0x0;var _0x323a6d=_0xc9b7[_0x369f62];return _0x323a6d;};'use strict';var _=require(_0x7c9b('0x0'));var util=require(_0x7c9b('0x1'));var logger=require(_0x7c9b('0x2'))(_0x7c9b('0x3'));var moment=require('moment');var BPromise=require(_0x7c9b('0x4'));var rp=require(_0x7c9b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c9b('0x6'));var config=require(_0x7c9b('0x7'));var attributes=require(_0x7c9b('0x8'));module[_0x7c9b('0x9')]=function(_0x3d19d7,_0x4714e0){return _0x3d19d7[_0x7c9b('0xa')](_0x7c9b('0xb'),attributes,{'tableName':_0x7c9b('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7c9b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9637=['exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0x5f5795,_0x48d8fb){var _0xcc0f3a=function(_0x1c83b2){while(--_0x1c83b2){_0x5f5795['push'](_0x5f5795['shift']());}};_0xcc0f3a(++_0x48d8fb);}(_0x9637,0x91));var _0x7963=function(_0x5c3567,_0x5a5f3c){_0x5c3567=_0x5c3567-0x0;var _0x531917=_0x9637[_0x5c3567];return _0x531917;};'use strict';var _=require(_0x7963('0x0'));var util=require(_0x7963('0x1'));var logger=require(_0x7963('0x2'))(_0x7963('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7963('0x4'));var fs=require('fs');var path=require(_0x7963('0x5'));var rimraf=require(_0x7963('0x6'));var config=require(_0x7963('0x7'));var attributes=require(_0x7963('0x8'));module[_0x7963('0x9')]=function(_0x229d9d,_0x6a2885){return _0x229d9d[_0x7963('0xa')](_0x7963('0xb'),attributes,{'tableName':_0x7963('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7963('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 85d9a86..ac393d2 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 _0x7130=['catch','CreateVoiceCallReport','UpdateVoiceCallReport','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map','GetVoiceCallReport'];(function(_0x534fe9,_0x19dd75){var _0x48592c=function(_0x26a7c3){while(--_0x26a7c3){_0x534fe9['push'](_0x534fe9['shift']());}};_0x48592c(++_0x19dd75);}(_0x7130,0x72));var _0x0713=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x7130[_0x46698a];return _0x356db0;};'use strict';var _=require(_0x0713('0x0'));var util=require(_0x0713('0x1'));var moment=require(_0x0713('0x2'));var BPromise=require('bluebird');var rs=require(_0x0713('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0713('0x4'))['db'];var utils=require(_0x0713('0x5'));var logger=require(_0x0713('0x6'))(_0x0713('0x7'));var config=require(_0x0713('0x8'));var jayson=require(_0x0713('0x9'));var client=jayson[_0x0713('0xa')][_0x0713('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c6335,_0x358236,_0x259e6d){return new BPromise(function(_0x2d1897,_0x59cefa){return client['request'](_0x1c6335,_0x259e6d)[_0x0713('0xc')](function(_0x3f0082){logger[_0x0713('0xd')](_0x0713('0xe'),_0x358236,_0x0713('0xf'));logger[_0x0713('0x10')](_0x0713('0x11'),_0x358236,_0x0713('0xf'),JSON[_0x0713('0x12')](_0x3f0082));if(_0x3f0082['error']){if(_0x3f0082[_0x0713('0x13')][_0x0713('0x14')]===0x1f4){logger['error'](_0x0713('0xe'),_0x358236,_0x3f0082[_0x0713('0x13')][_0x0713('0x15')]);return _0x59cefa(_0x3f0082[_0x0713('0x13')][_0x0713('0x15')]);}logger['error'](_0x0713('0xe'),_0x358236,_0x3f0082[_0x0713('0x13')][_0x0713('0x15')]);return _0x2d1897(_0x3f0082[_0x0713('0x13')]['message']);}else{logger['info'](_0x0713('0xe'),_0x358236,_0x0713('0xf'));_0x2d1897(_0x3f0082[_0x0713('0x16')]['message']);}})['catch'](function(_0xbcfc20){logger[_0x0713('0x13')](_0x0713('0xe'),_0x358236,_0xbcfc20);_0x59cefa(_0xbcfc20);});});}exports['GetVoiceCallReport']=function(_0x520d70){var _0x3873ee=this;return new Promise(function(_0x5078b3,_0x265509){return db[_0x0713('0x17')][_0x0713('0x18')]({'raw':_0x520d70['options']?_0x520d70[_0x0713('0x19')][_0x0713('0x1a')]===undefined?!![]:![]:!![],'where':_0x520d70[_0x0713('0x19')]?_0x520d70[_0x0713('0x19')][_0x0713('0x1b')]||null:null,'attributes':_0x520d70['options']?_0x520d70[_0x0713('0x19')][_0x0713('0x1c')]||null:null,'limit':_0x520d70[_0x0713('0x19')]?_0x520d70[_0x0713('0x19')][_0x0713('0x1d')]||null:null,'include':_0x520d70[_0x0713('0x19')]?_0x520d70[_0x0713('0x19')][_0x0713('0x1e')]?_['map'](_0x520d70['options'][_0x0713('0x1e')],function(_0x45348a){return{'model':db[_0x45348a[_0x0713('0x1f')]],'as':_0x45348a['as'],'attributes':_0x45348a[_0x0713('0x1c')],'include':_0x45348a[_0x0713('0x1e')]?_[_0x0713('0x20')](_0x45348a[_0x0713('0x1e')],function(_0x5527e7){return{'model':db[_0x5527e7['model']],'as':_0x5527e7['as'],'attributes':_0x5527e7['attributes'],'include':_0x5527e7[_0x0713('0x1e')]?_[_0x0713('0x20')](_0x5527e7[_0x0713('0x1e')],function(_0x3f4f74){return{'model':db[_0x3f4f74[_0x0713('0x1f')]],'as':_0x3f4f74['as'],'attributes':_0x3f4f74[_0x0713('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0713('0xc')](function(_0x2bdd13){logger['info'](_0x0713('0x21'),_0x520d70);logger['debug']('GetVoiceCallReport',_0x520d70,JSON[_0x0713('0x12')](_0x2bdd13));_0x5078b3(_0x2bdd13);})[_0x0713('0x22')](function(_0x1df5f6){logger[_0x0713('0x13')]('GetVoiceCallReport',_0x1df5f6[_0x0713('0x15')],_0x520d70);_0x265509(_0x3873ee[_0x0713('0x13')](0x1f4,_0x1df5f6['message']));});});};exports['CreateVoiceCallReport']=function(_0x4d4030){var _0x1af4ac=this;return new Promise(function(_0x3905a0,_0x4666ca){return db['VoiceCallReport']['create'](_0x4d4030['body'],{'raw':_0x4d4030[_0x0713('0x19')]?_0x4d4030[_0x0713('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x0713('0xc')](function(_0x933a93){logger[_0x0713('0xd')](_0x0713('0x23'),_0x4d4030);logger[_0x0713('0x10')](_0x0713('0x23'),_0x4d4030,JSON[_0x0713('0x12')](_0x933a93));_0x3905a0(_0x933a93);})['catch'](function(_0x441b20){logger['error'](_0x0713('0x23'),_0x441b20[_0x0713('0x15')],_0x4d4030);_0x4666ca(_0x1af4ac[_0x0713('0x13')](0x1f4,_0x441b20[_0x0713('0x15')]));});});};exports['UpdateVoiceCallReport']=function(_0x3edd3e){var _0x3d257f=this;return new Promise(function(_0x4dbc73,_0x13e654){return db[_0x0713('0x17')]['update'](_0x3edd3e['body'],{'raw':_0x3edd3e['options']?_0x3edd3e['options'][_0x0713('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3edd3e['options']?_0x3edd3e['options'][_0x0713('0x1b')]||null:null,'attributes':_0x3edd3e[_0x0713('0x19')]?_0x3edd3e[_0x0713('0x19')][_0x0713('0x1c')]||null:null,'limit':_0x3edd3e['options']?_0x3edd3e[_0x0713('0x19')][_0x0713('0x1d')]||null:null})['then'](function(_0xa9a6d9){logger[_0x0713('0xd')](_0x0713('0x24'),_0x3edd3e);logger[_0x0713('0x10')](_0x0713('0x24'),_0x3edd3e,JSON[_0x0713('0x12')](_0xa9a6d9));_0x4dbc73(_0xa9a6d9);})[_0x0713('0x22')](function(_0x1375bc){logger['error'](_0x0713('0x24'),_0x1375bc[_0x0713('0x15')],_0x3edd3e);_0x13e654(_0x3d257f[_0x0713('0x13')](0x1f4,_0x1375bc[_0x0713('0x15')]));});});}; \ No newline at end of file +var _0x0948=['model','then','catch','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','GetVoiceCallReport','VoiceCallReport','raw','options','where','attributes','limit','include','map'];(function(_0x4f3d81,_0x6a323){var _0xaac319=function(_0x2bcf4c){while(--_0x2bcf4c){_0x4f3d81['push'](_0x4f3d81['shift']());}};_0xaac319(++_0x6a323);}(_0x0948,0x119));var _0x8094=function(_0x547add,_0x387042){_0x547add=_0x547add-0x0;var _0x2ed1f3=_0x0948[_0x547add];return _0x2ed1f3;};'use strict';var _=require(_0x8094('0x0'));var util=require(_0x8094('0x1'));var moment=require(_0x8094('0x2'));var BPromise=require(_0x8094('0x3'));var rs=require(_0x8094('0x4'));var fs=require('fs');var Redis=require(_0x8094('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8094('0x6'));var logger=require(_0x8094('0x7'))(_0x8094('0x8'));var config=require(_0x8094('0x9'));var jayson=require(_0x8094('0xa'));var client=jayson[_0x8094('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32d1cd,_0x14cf2a,_0x4955f3){return new BPromise(function(_0x2829cf,_0x59c4cc){return client[_0x8094('0xc')](_0x32d1cd,_0x4955f3)['then'](function(_0x49c8cf){logger['info'](_0x8094('0xd'),_0x14cf2a,_0x8094('0xe'));logger[_0x8094('0xf')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x14cf2a,_0x8094('0xe'),JSON[_0x8094('0x10')](_0x49c8cf));if(_0x49c8cf[_0x8094('0x11')]){if(_0x49c8cf[_0x8094('0x11')][_0x8094('0x12')]===0x1f4){logger[_0x8094('0x11')](_0x8094('0xd'),_0x14cf2a,_0x49c8cf[_0x8094('0x11')][_0x8094('0x13')]);return _0x59c4cc(_0x49c8cf[_0x8094('0x11')]['message']);}logger['error'](_0x8094('0xd'),_0x14cf2a,_0x49c8cf[_0x8094('0x11')][_0x8094('0x13')]);return _0x2829cf(_0x49c8cf[_0x8094('0x11')]['message']);}else{logger[_0x8094('0x14')](_0x8094('0xd'),_0x14cf2a,_0x8094('0xe'));_0x2829cf(_0x49c8cf[_0x8094('0x15')][_0x8094('0x13')]);}})['catch'](function(_0x779163){logger[_0x8094('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x14cf2a,_0x779163);_0x59c4cc(_0x779163);});});}exports[_0x8094('0x16')]=function(_0xf74258){var _0x32d716=this;return new Promise(function(_0x4cf638,_0x5d7e91){return db[_0x8094('0x17')]['findAll']({'raw':_0xf74258['options']?_0xf74258['options'][_0x8094('0x18')]===undefined?!![]:![]:!![],'where':_0xf74258[_0x8094('0x19')]?_0xf74258['options'][_0x8094('0x1a')]||null:null,'attributes':_0xf74258[_0x8094('0x19')]?_0xf74258[_0x8094('0x19')][_0x8094('0x1b')]||null:null,'limit':_0xf74258[_0x8094('0x19')]?_0xf74258[_0x8094('0x19')][_0x8094('0x1c')]||null:null,'include':_0xf74258[_0x8094('0x19')]?_0xf74258['options'][_0x8094('0x1d')]?_[_0x8094('0x1e')](_0xf74258[_0x8094('0x19')][_0x8094('0x1d')],function(_0x1958c7){return{'model':db[_0x1958c7[_0x8094('0x1f')]],'as':_0x1958c7['as'],'attributes':_0x1958c7[_0x8094('0x1b')],'include':_0x1958c7['include']?_['map'](_0x1958c7[_0x8094('0x1d')],function(_0x4e5444){return{'model':db[_0x4e5444['model']],'as':_0x4e5444['as'],'attributes':_0x4e5444[_0x8094('0x1b')],'include':_0x4e5444['include']?_[_0x8094('0x1e')](_0x4e5444[_0x8094('0x1d')],function(_0x2d5b01){return{'model':db[_0x2d5b01[_0x8094('0x1f')]],'as':_0x2d5b01['as'],'attributes':_0x2d5b01[_0x8094('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8094('0x20')](function(_0x10f032){logger['info'](_0x8094('0x16'),_0xf74258);logger['debug'](_0x8094('0x16'),_0xf74258,JSON['stringify'](_0x10f032));_0x4cf638(_0x10f032);})[_0x8094('0x21')](function(_0x46ac32){logger[_0x8094('0x11')]('GetVoiceCallReport',_0x46ac32['message'],_0xf74258);_0x5d7e91(_0x32d716[_0x8094('0x11')](0x1f4,_0x46ac32[_0x8094('0x13')]));});});};exports[_0x8094('0x22')]=function(_0x2a798d){var _0x4cc6e7=this;return new Promise(function(_0x54bb68,_0x1e2761){return db['VoiceCallReport'][_0x8094('0x23')](_0x2a798d[_0x8094('0x24')],{'raw':_0x2a798d['options']?_0x2a798d['options'][_0x8094('0x18')]===undefined?!![]:![]:!![]})[_0x8094('0x20')](function(_0x36c8f4){logger['info'](_0x8094('0x22'),_0x2a798d);logger['debug'](_0x8094('0x22'),_0x2a798d,JSON[_0x8094('0x10')](_0x36c8f4));_0x54bb68(_0x36c8f4);})[_0x8094('0x21')](function(_0x365548){logger[_0x8094('0x11')]('CreateVoiceCallReport',_0x365548[_0x8094('0x13')],_0x2a798d);_0x1e2761(_0x4cc6e7[_0x8094('0x11')](0x1f4,_0x365548['message']));});});};exports[_0x8094('0x25')]=function(_0x5657c7){var _0x538719=this;return new Promise(function(_0x1c27e2,_0x8cd45f){return db['VoiceCallReport'][_0x8094('0x26')](_0x5657c7['body'],{'raw':_0x5657c7[_0x8094('0x19')]?_0x5657c7[_0x8094('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5657c7[_0x8094('0x19')]?_0x5657c7['options'][_0x8094('0x1a')]||null:null,'attributes':_0x5657c7[_0x8094('0x19')]?_0x5657c7[_0x8094('0x19')][_0x8094('0x1b')]||null:null,'limit':_0x5657c7[_0x8094('0x19')]?_0x5657c7[_0x8094('0x19')][_0x8094('0x1c')]||null:null})[_0x8094('0x20')](function(_0x4f9015){logger[_0x8094('0x14')]('UpdateVoiceCallReport',_0x5657c7);logger[_0x8094('0xf')]('UpdateVoiceCallReport',_0x5657c7,JSON[_0x8094('0x10')](_0x4f9015));_0x1c27e2(_0x4f9015);})[_0x8094('0x21')](function(_0x167751){logger['error'](_0x8094('0x25'),_0x167751['message'],_0x5657c7);_0x8cd45f(_0x538719['error'](0x1f4,_0x167751['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index ebc8cee..af94a7b 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 _0x4a0f=['../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x38dca6,_0x471cb7){var _0x29bcd7=function(_0x174c5d){while(--_0x174c5d){_0x38dca6['push'](_0x38dca6['shift']());}};_0x29bcd7(++_0x471cb7);}(_0x4a0f,0x15e));var _0xf4a0=function(_0x4995af,_0x4807b7){_0x4995af=_0x4995af-0x0;var _0x331c97=_0x4a0f[_0x4995af];return _0x331c97;};'use strict';var multer=require(_0xf4a0('0x0'));var util=require(_0xf4a0('0x1'));var path=require(_0xf4a0('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4a0('0x3'));var router=express[_0xf4a0('0x4')]();var fs_extra=require(_0xf4a0('0x5'));var auth=require(_0xf4a0('0x6'));var interaction=require(_0xf4a0('0x7'));var config=require(_0xf4a0('0x8'));var controller=require(_0xf4a0('0x9'));router[_0xf4a0('0xa')]('/',auth[_0xf4a0('0xb')](),controller[_0xf4a0('0xc')]);router['get'](_0xf4a0('0xd'),auth[_0xf4a0('0xb')](),controller[_0xf4a0('0xe')]);router[_0xf4a0('0xf')]('/',auth[_0xf4a0('0xb')](),controller[_0xf4a0('0x10')]);router[_0xf4a0('0x11')](_0xf4a0('0xd'),auth[_0xf4a0('0xb')](),controller[_0xf4a0('0x12')]);router[_0xf4a0('0x13')](_0xf4a0('0xd'),auth[_0xf4a0('0xb')](),controller[_0xf4a0('0x14')]);module['exports']=router; \ No newline at end of file +var _0x8f24=['index','/:id','post','create','update','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated'];(function(_0x2ee0b5,_0x49cc76){var _0x18b1f5=function(_0x3566ec){while(--_0x3566ec){_0x2ee0b5['push'](_0x2ee0b5['shift']());}};_0x18b1f5(++_0x49cc76);}(_0x8f24,0x128));var _0x48f2=function(_0x57d078,_0x41b5b4){_0x57d078=_0x57d078-0x0;var _0x5ef64d=_0x8f24[_0x57d078];return _0x5ef64d;};'use strict';var multer=require('multer');var util=require(_0x48f2('0x0'));var path=require('path');var timeout=require(_0x48f2('0x1'));var express=require('express');var router=express[_0x48f2('0x2')]();var fs_extra=require(_0x48f2('0x3'));var auth=require(_0x48f2('0x4'));var interaction=require(_0x48f2('0x5'));var config=require(_0x48f2('0x6'));var controller=require(_0x48f2('0x7'));router[_0x48f2('0x8')]('/',auth[_0x48f2('0x9')](),controller[_0x48f2('0xa')]);router['get'](_0x48f2('0xb'),auth[_0x48f2('0x9')](),controller['show']);router[_0x48f2('0xc')]('/',auth['isAuthenticated'](),controller[_0x48f2('0xd')]);router['put'](_0x48f2('0xb'),auth[_0x48f2('0x9')](),controller[_0x48f2('0xe')]);router[_0x48f2('0xf')](_0x48f2('0xb'),auth[_0x48f2('0x9')](),controller[_0x48f2('0x10')]);module[_0x48f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 9e5c5ef..5e150b7 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 _0xfecb=['sequelize','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN'];(function(_0xb24fad,_0xd58756){var _0x173226=function(_0x33b4d6){while(--_0x33b4d6){_0xb24fad['push'](_0xb24fad['shift']());}};_0x173226(++_0xd58756);}(_0xfecb,0x130));var _0xbfec=function(_0x69f39b,_0x1993c3){_0x69f39b=_0x69f39b-0x0;var _0x477505=_0xfecb[_0x69f39b];return _0x477505;};'use strict';var Sequelize=require(_0xbfec('0x0'));module['exports']={'name':{'type':Sequelize[_0xbfec('0x1')]},'prefix':{'type':Sequelize[_0xbfec('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x23d10d){this[_0xbfec('0x2')](_0xbfec('0x3'),_0x23d10d?_0x23d10d[_0xbfec('0x4')](''):[]);},'get':function(){return this[_0xbfec('0x5')](_0xbfec('0x3'))?this[_0xbfec('0x5')](_0xbfec('0x3'))[_0xbfec('0x6')](''):[];}},'auth':{'type':Sequelize[_0xbfec('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xbfec('0x1')]},'record':{'type':Sequelize[_0xbfec('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbfec('0x1')]},'description':{'type':Sequelize[_0xbfec('0x1')]}}; \ No newline at end of file +var _0x5b28=['BOOLEAN','sequelize','exports','STRING','name','setDataValue','join','getDataValue','options','split'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0x5b28,0x10f));var _0x85b2=function(_0x2e9076,_0x5db0fa){_0x2e9076=_0x2e9076-0x0;var _0x308431=_0x5b28[_0x2e9076];return _0x308431;};'use strict';var Sequelize=require(_0x85b2('0x0'));module[_0x85b2('0x1')]={'name':{'type':Sequelize[_0x85b2('0x2')]},'prefix':{'type':Sequelize[_0x85b2('0x2')],'unique':_0x85b2('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x164264){this[_0x85b2('0x4')]('options',_0x164264?_0x164264[_0x85b2('0x5')](''):[]);},'get':function(){return this[_0x85b2('0x6')]('options')?this[_0x85b2('0x6')](_0x85b2('0x7'))[_0x85b2('0x8')](''):[];}},'auth':{'type':Sequelize[_0x85b2('0x9')],'defaultValue':![]},'password':{'type':Sequelize['STRING']},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x85b2('0x2')]},'description':{'type':Sequelize[_0x85b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 863b444..1b4503a 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 _0xf2c7=['destroy','then','get','ChanSpies','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','keys','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update'];(function(_0x3486e0,_0x3b80ac){var _0x1a6dab=function(_0x423608){while(--_0x423608){_0x3486e0['push'](_0x3486e0['shift']());}};_0x1a6dab(++_0x3b80ac);}(_0xf2c7,0x1d8));var _0x7f2c=function(_0x36909d,_0x2795f1){_0x36909d=_0x36909d-0x0;var _0x1fd29d=_0xf2c7[_0x36909d];return _0x1fd29d;};'use strict';var emlformat=require(_0x7f2c('0x0'));var rimraf=require(_0x7f2c('0x1'));var zipdir=require(_0x7f2c('0x2'));var jsonpatch=require(_0x7f2c('0x3'));var rp=require('request-promise');var moment=require(_0x7f2c('0x4'));var BPromise=require(_0x7f2c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7f2c('0x6'));var sox=require('sox');var csv=require(_0x7f2c('0x7'));var ejs=require(_0x7f2c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f2c('0x9'));var squel=require(_0x7f2c('0xa'));var crypto=require(_0x7f2c('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7f2c('0xc'));var toCsv=require(_0x7f2c('0x7'));var querystring=require(_0x7f2c('0xd'));var Papa=require(_0x7f2c('0xe'));var Redis=require(_0x7f2c('0xf'));var authService=require(_0x7f2c('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7f2c('0x11'));var hardwareService=require(_0x7f2c('0x12'));var logger=require(_0x7f2c('0x13'))(_0x7f2c('0x14'));var utils=require(_0x7f2c('0x15'));var config=require(_0x7f2c('0x16'));var licenseUtil=require(_0x7f2c('0x17'));var db=require(_0x7f2c('0x18'))['db'];function respondWithStatusCode(_0x1c280d,_0x53309e){_0x53309e=_0x53309e||0xcc;return function(_0x2af83c){if(_0x2af83c){return _0x1c280d['sendStatus'](_0x53309e);}return _0x1c280d[_0x7f2c('0x19')](_0x53309e)[_0x7f2c('0x1a')]();};}function respondWithResult(_0x4e83ee,_0x51186f){_0x51186f=_0x51186f||0xc8;return function(_0x2a3409){if(_0x2a3409){return _0x4e83ee[_0x7f2c('0x19')](_0x51186f)['json'](_0x2a3409);}};}function respondWithFilteredResult(_0x3282f9,_0x153c8c){return function(_0x5d9aa2){if(_0x5d9aa2){var _0x1846c6=typeof _0x153c8c[_0x7f2c('0x1b')]===_0x7f2c('0x1c')&&typeof _0x153c8c[_0x7f2c('0x1d')]===_0x7f2c('0x1c');var _0x31858f=_0x5d9aa2[_0x7f2c('0x1e')];var _0xd8eb94=_0x1846c6?0x0:_0x153c8c[_0x7f2c('0x1b')];var _0x1d4ec4=_0x1846c6?_0x5d9aa2['count']:_0x153c8c['offset']+_0x153c8c[_0x7f2c('0x1d')];var _0x45b3e3;if(_0x1d4ec4>=_0x31858f){_0x1d4ec4=_0x31858f;_0x45b3e3=0xc8;}else{_0x45b3e3=0xce;}_0x3282f9[_0x7f2c('0x19')](_0x45b3e3);return _0x3282f9[_0x7f2c('0x1f')](_0x7f2c('0x20'),_0xd8eb94+'-'+_0x1d4ec4+'/'+_0x31858f)[_0x7f2c('0x21')](_0x5d9aa2);}return null;};}function patchUpdates(_0x130e51){return function(_0x13d338){try{jsonpatch[_0x7f2c('0x22')](_0x13d338,_0x130e51,!![]);}catch(_0x196651){return BPromise[_0x7f2c('0x23')](_0x196651);}return _0x13d338[_0x7f2c('0x24')]();};}function saveUpdates(_0x22399d,_0x13fcaf){return function(_0x1a1ee9){if(_0x1a1ee9){return _0x1a1ee9[_0x7f2c('0x25')](_0x22399d)['then'](function(_0x3e711c){return _0x3e711c;});}return null;};}function removeEntity(_0x8a9710,_0x4856b3){return function(_0x38f472){if(_0x38f472){return _0x38f472[_0x7f2c('0x26')]()[_0x7f2c('0x27')](function(){var _0x5a8f64=_0x38f472[_0x7f2c('0x28')]({'plain':!![]});var _0x2386bf=_0x7f2c('0x29');return db['UserProfileResource'][_0x7f2c('0x26')]({'where':{'type':_0x2386bf,'resourceId':_0x5a8f64['id']}})[_0x7f2c('0x27')](function(){return _0x38f472;});})[_0x7f2c('0x27')](function(){_0x8a9710['status'](0xcc)[_0x7f2c('0x1a')]();});}};}function handleEntityNotFound(_0x4f5059,_0x26c149){return function(_0x544fdf){if(!_0x544fdf){_0x4f5059[_0x7f2c('0x2a')](0x194);}return _0x544fdf;};}function handleError(_0xb37dc6,_0x209cf9){_0x209cf9=_0x209cf9||0x1f4;return function(_0x50ad96){logger[_0x7f2c('0x2b')](_0x50ad96[_0x7f2c('0x2c')]);if(_0x50ad96['name']){delete _0x50ad96[_0x7f2c('0x2d')];}_0xb37dc6[_0x7f2c('0x19')](_0x209cf9)[_0x7f2c('0x2e')](_0x50ad96);};}exports[_0x7f2c('0x2f')]=function(_0x2bd69a,_0x198434){var _0x8fb1e={},_0x241a68={},_0x4b3175={'count':0x0,'rows':[]};var _0x3119e3=_[_0x7f2c('0x30')](db[_0x7f2c('0x31')][_0x7f2c('0x32')],function(_0x4de0fd){return{'name':_0x4de0fd[_0x7f2c('0x33')],'type':_0x4de0fd['type'][_0x7f2c('0x34')]};});_0x241a68[_0x7f2c('0x35')]=_[_0x7f2c('0x30')](_0x3119e3,_0x7f2c('0x2d'));_0x241a68['query']=_['keys'](_0x2bd69a[_0x7f2c('0x36')]);_0x241a68[_0x7f2c('0x37')]=_[_0x7f2c('0x38')](_0x241a68[_0x7f2c('0x35')],_0x241a68[_0x7f2c('0x36')]);_0x8fb1e[_0x7f2c('0x39')]=_[_0x7f2c('0x38')](_0x241a68['model'],qs[_0x7f2c('0x3a')](_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x3a')]));_0x8fb1e[_0x7f2c('0x39')]=_0x8fb1e[_0x7f2c('0x39')]['length']?_0x8fb1e[_0x7f2c('0x39')]:_0x241a68[_0x7f2c('0x35')];if(!_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x3b')](_0x7f2c('0x3c'))){_0x8fb1e[_0x7f2c('0x1d')]=qs[_0x7f2c('0x1d')](_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x1d')]);_0x8fb1e[_0x7f2c('0x1b')]=qs['offset'](_0x2bd69a['query'][_0x7f2c('0x1b')]);}_0x8fb1e['order']=qs[_0x7f2c('0x3d')](_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x3d')]);_0x8fb1e[_0x7f2c('0x3e')]=qs['filters'](_[_0x7f2c('0x3f')](_0x2bd69a['query'],_0x241a68[_0x7f2c('0x37')]),_0x3119e3);if(_0x2bd69a[_0x7f2c('0x36')][_0x7f2c('0x40')]){_0x8fb1e[_0x7f2c('0x3e')]=_[_0x7f2c('0x41')](_0x8fb1e[_0x7f2c('0x3e')],{'$or':_['map'](_0x3119e3,function(_0x3861e8){if(_0x3861e8['type']!=='VIRTUAL'){var _0x292e45={};_0x292e45[_0x3861e8[_0x7f2c('0x2d')]]={'$like':'%'+_0x2bd69a['query'][_0x7f2c('0x40')]+'%'};return _0x292e45;}})});}_0x8fb1e=_['merge']({},_0x8fb1e,_0x2bd69a[_0x7f2c('0x42')]);var _0x180f39={'where':_0x8fb1e['where']};return db[_0x7f2c('0x31')][_0x7f2c('0x1e')](_0x180f39)[_0x7f2c('0x27')](function(_0x31e467){_0x4b3175['count']=_0x31e467;if(_0x2bd69a['query']['includeAll']){_0x8fb1e[_0x7f2c('0x43')]=[{'all':!![]}];}return db[_0x7f2c('0x31')][_0x7f2c('0x44')](_0x8fb1e);})[_0x7f2c('0x27')](function(_0x456a9e){_0x4b3175['rows']=_0x456a9e;return _0x4b3175;})['then'](respondWithFilteredResult(_0x198434,_0x8fb1e))[_0x7f2c('0x45')](handleError(_0x198434,null));};exports[_0x7f2c('0x46')]=function(_0x5b9ef4,_0x57905e){var _0x9b4209={'raw':![],'where':{'id':_0x5b9ef4[_0x7f2c('0x47')]['id']}},_0x1596e4={};_0x1596e4[_0x7f2c('0x35')]=_[_0x7f2c('0x48')](db[_0x7f2c('0x31')][_0x7f2c('0x32')]);_0x1596e4[_0x7f2c('0x36')]=_[_0x7f2c('0x48')](_0x5b9ef4[_0x7f2c('0x36')]);_0x1596e4['filters']=_['intersection'](_0x1596e4[_0x7f2c('0x35')],_0x1596e4['query']);_0x9b4209[_0x7f2c('0x39')]=_['intersection'](_0x1596e4[_0x7f2c('0x35')],qs[_0x7f2c('0x3a')](_0x5b9ef4[_0x7f2c('0x36')]['fields']));_0x9b4209[_0x7f2c('0x39')]=_0x9b4209[_0x7f2c('0x39')][_0x7f2c('0x49')]?_0x9b4209['attributes']:_0x1596e4['model'];if(_0x5b9ef4[_0x7f2c('0x36')][_0x7f2c('0x4a')]){_0x9b4209[_0x7f2c('0x43')]=[{'all':!![]}];}_0x9b4209=_[_0x7f2c('0x41')]({},_0x9b4209,_0x5b9ef4['options']);return db[_0x7f2c('0x31')][_0x7f2c('0x4b')](_0x9b4209)[_0x7f2c('0x27')](handleEntityNotFound(_0x57905e,null))[_0x7f2c('0x27')](respondWithResult(_0x57905e,null))[_0x7f2c('0x45')](handleError(_0x57905e,null));};exports['create']=function(_0x276004,_0x3ff774){return db[_0x7f2c('0x31')][_0x7f2c('0x4c')](_0x276004[_0x7f2c('0x4d')],{})[_0x7f2c('0x27')](function(_0x3ae7b1){var _0x4614a0=_0x276004['user'][_0x7f2c('0x28')]({'plain':!![]});if(!_0x4614a0)throw new Error(_0x7f2c('0x4e'));if(_0x4614a0[_0x7f2c('0x4f')]===_0x7f2c('0x50')){var _0x4436e2=_0x3ae7b1[_0x7f2c('0x28')]({'plain':!![]});var _0x4a2153='ChanSpies';return db[_0x7f2c('0x51')][_0x7f2c('0x4b')]({'where':{'name':_0x4a2153,'userProfileId':_0x4614a0[_0x7f2c('0x52')]},'raw':!![]})[_0x7f2c('0x27')](function(_0x39378b){if(_0x39378b&&_0x39378b['autoAssociation']===0x0){return db[_0x7f2c('0x53')]['create']({'name':_0x4436e2[_0x7f2c('0x2d')],'resourceId':_0x4436e2['id'],'type':_0x39378b[_0x7f2c('0x2d')],'sectionId':_0x39378b['id']},{})[_0x7f2c('0x27')](function(){return _0x3ae7b1;});}else{return _0x3ae7b1;}})[_0x7f2c('0x45')](function(_0x31a814){logger['error'](_0x7f2c('0x54'),_0x31a814);throw _0x31a814;});}return _0x3ae7b1;})[_0x7f2c('0x27')](respondWithResult(_0x3ff774,0xc9))[_0x7f2c('0x45')](handleError(_0x3ff774,null));};exports['update']=function(_0x1ee043,_0x4d163a){if(_0x1ee043[_0x7f2c('0x4d')]['id']){delete _0x1ee043['body']['id'];}return db[_0x7f2c('0x31')]['find']({'where':{'id':_0x1ee043[_0x7f2c('0x47')]['id']}})[_0x7f2c('0x27')](handleEntityNotFound(_0x4d163a,null))[_0x7f2c('0x27')](saveUpdates(_0x1ee043[_0x7f2c('0x4d')],null))[_0x7f2c('0x27')](respondWithResult(_0x4d163a,null))['catch'](handleError(_0x4d163a,null));};exports[_0x7f2c('0x26')]=function(_0x41a733,_0x43633b){return db[_0x7f2c('0x31')]['find']({'where':{'id':_0x41a733[_0x7f2c('0x47')]['id']}})['then'](handleEntityNotFound(_0x43633b,null))[_0x7f2c('0x27')](removeEntity(_0x43633b,null))[_0x7f2c('0x45')](handleError(_0x43633b,null));}; \ No newline at end of file +var _0x2547=['../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','ChanSpies','error','stack','name','send','VoiceChanSpy','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','options','includeAll','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x2314eb,_0xf257e5){var _0x5dade0=function(_0x379eda){while(--_0x379eda){_0x2314eb['push'](_0x2314eb['shift']());}};_0x5dade0(++_0xf257e5);}(_0x2547,0x1cd));var _0x7254=function(_0x2472a8,_0x33ac01){_0x2472a8=_0x2472a8-0x0;var _0x1c8d76=_0x2547[_0x2472a8];return _0x1c8d76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){var _0x54dace=_0x136ea3[_0x7254('0x27')]({'plain':!![]});var _0x36b5d5=_0x7254('0x28');return db['UserProfileResource'][_0x7254('0x26')]({'where':{'type':_0x36b5d5,'resourceId':_0x54dace['id']}})[_0x7254('0x25')](function(){return _0x136ea3;});})[_0x7254('0x25')](function(){_0x50c34b['status'](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x594a63,_0x1bb6a7){return function(_0x134a9e){if(!_0x134a9e){_0x594a63['sendStatus'](0x194);}return _0x134a9e;};}function handleError(_0x17bb46,_0x158356){_0x158356=_0x158356||0x1f4;return function(_0x4f684c){logger[_0x7254('0x29')](_0x4f684c[_0x7254('0x2a')]);if(_0x4f684c[_0x7254('0x2b')]){delete _0x4f684c[_0x7254('0x2b')];}_0x17bb46[_0x7254('0x18')](_0x158356)[_0x7254('0x2c')](_0x4f684c);};}exports['index']=function(_0x146028,_0x2dba3f){var _0x5569be={},_0x2f75ea={},_0x1279cd={'count':0x0,'rows':[]};var _0x2be5fc=_['map'](db[_0x7254('0x2d')][_0x7254('0x2e')],function(_0x354305){return{'name':_0x354305[_0x7254('0x2f')],'type':_0x354305[_0x7254('0x30')][_0x7254('0x31')]};});_0x2f75ea[_0x7254('0x32')]=_['map'](_0x2be5fc,_0x7254('0x2b'));_0x2f75ea['query']=_['keys'](_0x146028[_0x7254('0x33')]);_0x2f75ea[_0x7254('0x34')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],_0x2f75ea[_0x7254('0x33')]);_0x5569be[_0x7254('0x36')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],qs[_0x7254('0x37')](_0x146028[_0x7254('0x33')][_0x7254('0x37')]));_0x5569be[_0x7254('0x36')]=_0x5569be[_0x7254('0x36')][_0x7254('0x38')]?_0x5569be['attributes']:_0x2f75ea[_0x7254('0x32')];if(!_0x146028[_0x7254('0x33')][_0x7254('0x39')](_0x7254('0x3a'))){_0x5569be[_0x7254('0x1d')]=qs['limit'](_0x146028[_0x7254('0x33')]['limit']);_0x5569be[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x146028[_0x7254('0x33')][_0x7254('0x1b')]);}_0x5569be[_0x7254('0x3b')]=qs['sort'](_0x146028[_0x7254('0x33')]['sort']);_0x5569be[_0x7254('0x3c')]=qs[_0x7254('0x34')](_['pick'](_0x146028[_0x7254('0x33')],_0x2f75ea[_0x7254('0x34')]),_0x2be5fc);if(_0x146028[_0x7254('0x33')][_0x7254('0x3d')]){_0x5569be[_0x7254('0x3c')]=_[_0x7254('0x3e')](_0x5569be['where'],{'$or':_[_0x7254('0x3f')](_0x2be5fc,function(_0x102d87){if(_0x102d87[_0x7254('0x30')]!=='VIRTUAL'){var _0x3fbad7={};_0x3fbad7[_0x102d87[_0x7254('0x2b')]]={'$like':'%'+_0x146028[_0x7254('0x33')]['filter']+'%'};return _0x3fbad7;}})});}_0x5569be=_[_0x7254('0x3e')]({},_0x5569be,_0x146028[_0x7254('0x40')]);var _0x18a918={'where':_0x5569be[_0x7254('0x3c')]};return db[_0x7254('0x2d')]['count'](_0x18a918)['then'](function(_0x25004f){_0x1279cd[_0x7254('0x1e')]=_0x25004f;if(_0x146028[_0x7254('0x33')][_0x7254('0x41')]){_0x5569be['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x7254('0x42')](_0x5569be);})['then'](function(_0x2ae22e){_0x1279cd[_0x7254('0x43')]=_0x2ae22e;return _0x1279cd;})[_0x7254('0x25')](respondWithFilteredResult(_0x2dba3f,_0x5569be))[_0x7254('0x44')](handleError(_0x2dba3f,null));};exports['show']=function(_0x4adf34,_0x467f31){var _0x3f6ead={'raw':![],'where':{'id':_0x4adf34[_0x7254('0x45')]['id']}},_0x29b90c={};_0x29b90c[_0x7254('0x32')]=_['keys'](db['VoiceChanSpy'][_0x7254('0x2e')]);_0x29b90c[_0x7254('0x33')]=_[_0x7254('0x46')](_0x4adf34['query']);_0x29b90c[_0x7254('0x34')]=_[_0x7254('0x35')](_0x29b90c['model'],_0x29b90c[_0x7254('0x33')]);_0x3f6ead[_0x7254('0x36')]=_[_0x7254('0x35')](_0x29b90c[_0x7254('0x32')],qs['fields'](_0x4adf34[_0x7254('0x33')][_0x7254('0x37')]));_0x3f6ead['attributes']=_0x3f6ead[_0x7254('0x36')][_0x7254('0x38')]?_0x3f6ead[_0x7254('0x36')]:_0x29b90c['model'];if(_0x4adf34[_0x7254('0x33')][_0x7254('0x41')]){_0x3f6ead['include']=[{'all':!![]}];}_0x3f6ead=_['merge']({},_0x3f6ead,_0x4adf34[_0x7254('0x40')]);return db['VoiceChanSpy'][_0x7254('0x47')](_0x3f6ead)[_0x7254('0x25')](handleEntityNotFound(_0x467f31,null))['then'](respondWithResult(_0x467f31,null))['catch'](handleError(_0x467f31,null));};exports[_0x7254('0x48')]=function(_0xc40bc5,_0x38bcd5){return db[_0x7254('0x2d')][_0x7254('0x48')](_0xc40bc5[_0x7254('0x49')],{})['then'](function(_0x245213){var _0x5ef7f9=_0xc40bc5[_0x7254('0x4a')][_0x7254('0x27')]({'plain':!![]});if(!_0x5ef7f9)throw new Error(_0x7254('0x4b'));if(_0x5ef7f9['role']===_0x7254('0x4a')){var _0x1c1a0e=_0x245213[_0x7254('0x27')]({'plain':!![]});var _0x5b3b6e=_0x7254('0x28');return db[_0x7254('0x4c')][_0x7254('0x47')]({'where':{'name':_0x5b3b6e,'userProfileId':_0x5ef7f9[_0x7254('0x4d')]},'raw':!![]})[_0x7254('0x25')](function(_0x4e1e38){if(_0x4e1e38&&_0x4e1e38['autoAssociation']===0x0){return db[_0x7254('0x4e')][_0x7254('0x48')]({'name':_0x1c1a0e[_0x7254('0x2b')],'resourceId':_0x1c1a0e['id'],'type':_0x4e1e38[_0x7254('0x2b')],'sectionId':_0x4e1e38['id']},{})[_0x7254('0x25')](function(){return _0x245213;});}else{return _0x245213;}})['catch'](function(_0x5a44fb){logger[_0x7254('0x29')](_0x7254('0x4f'),_0x5a44fb);throw _0x5a44fb;});}return _0x245213;})[_0x7254('0x25')](respondWithResult(_0x38bcd5,0xc9))[_0x7254('0x44')](handleError(_0x38bcd5,null));};exports['update']=function(_0xaf6d3d,_0x3e3d09){if(_0xaf6d3d['body']['id']){delete _0xaf6d3d[_0x7254('0x49')]['id'];}return db['VoiceChanSpy'][_0x7254('0x47')]({'where':{'id':_0xaf6d3d['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x3e3d09,null))['then'](saveUpdates(_0xaf6d3d['body'],null))[_0x7254('0x25')](respondWithResult(_0x3e3d09,null))[_0x7254('0x44')](handleError(_0x3e3d09,null));};exports[_0x7254('0x26')]=function(_0x1122e8,_0x4f6c9f){return db[_0x7254('0x2d')]['find']({'where':{'id':_0x1122e8[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x4f6c9f,null))[_0x7254('0x25')](removeEntity(_0x4f6c9f,null))[_0x7254('0x44')](handleError(_0x4f6c9f,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 6ab9d66..5cfee2e 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 _0x5a08=['User','findAll','agent','then','exports','models','voice_chanspy','VoiceExtension','catch','bulkCreate','destroy','util','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate','password','SIP/%s,%s','name','options','StopMixMonitor','length','concat','internal'];(function(_0x25680f,_0x49646a){var _0x135948=function(_0x4b6ebe){while(--_0x4b6ebe){_0x25680f['push'](_0x25680f['shift']());}};_0x135948(++_0x49646a);}(_0x5a08,0x93));var _0x85a0=function(_0x409714,_0x4a9f2d){_0x409714=_0x409714-0x0;var _0xc6d164=_0x5a08[_0x409714];return _0xc6d164;};'use strict';var _=require('lodash');var util=require(_0x85a0('0x0'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x139bfa,_0x386aee,_0x3f849a){var _0x2bc11e=0x1;var _0x20178d=[];var _0x9284b={'context':_0x386aee['context']||'from-sip','exten':util[_0x85a0('0x1')](_0x85a0('0x2'),_0x139bfa[_0x85a0('0x3')],_0x3f849a),'type':_0x85a0('0x4'),'isApp':![],'ChanSpyId':_0x139bfa['id'],'UserId':_0x386aee['id']};_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':_0x85a0('0x7'),'appdata':util[_0x85a0('0x1')](_0x85a0('0x8'),_0x85a0('0x9')),'priority':_0x2bc11e++},_0x9284b));if(_0x139bfa[_0x85a0('0xa')]){_0x20178d[_0x85a0('0x5')](_['merge']({'app':_0x85a0('0xb'),'appdata':util['format'](_0x85a0('0xc'),_0x139bfa[_0x85a0('0xd')]),'priority':_0x2bc11e++},_0x9284b));}if(_0x139bfa['auth']){_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':_0x85a0('0xe'),'appdata':_0x139bfa[_0x85a0('0xf')],'priority':_0x2bc11e++},_0x9284b));}_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':'ChanSpy','appdata':util[_0x85a0('0x1')](_0x85a0('0x10'),_0x386aee[_0x85a0('0x11')],_0x139bfa[_0x85a0('0x12')]?_0x139bfa[_0x85a0('0x12')]['join'](''):''),'priority':_0x2bc11e++},_0x9284b));if(_0x139bfa[_0x85a0('0xa')]){_0x20178d[_0x85a0('0x5')](_[_0x85a0('0x6')]({'app':_0x85a0('0x13'),'priority':_0x2bc11e++},_0x9284b));}return _0x20178d;};var getChanSpyApplications=function(_0x10b64d,_0x38b300){var _0x9803ec=[];for(var _0x53107c=0x0,_0x4c4056=0x1;_0x53107c<_0x38b300[_0x85a0('0x14')];_0x53107c++,_0x4c4056=0x1){_0x9803ec=_0x9803ec[_0x85a0('0x15')](getUserApplications(_0x10b64d,_0x38b300[_0x53107c],_0x38b300[_0x53107c]['internal']));if(_0x38b300[_0x53107c][_0x85a0('0x16')]!=_0x38b300[_0x53107c]['name']){_0x9803ec=_0x9803ec[_0x85a0('0x15')](getUserApplications(_0x10b64d,_0x38b300[_0x53107c],_0x38b300[_0x53107c]['name']));}}return _0x9803ec;};var getChanSpyPromise=function(_0x53ff08,_0x5e133d){return new BPromise(function(_0x15a859,_0x10e23){return _0x53ff08[_0x85a0('0x17')][_0x85a0('0x18')]({'attributes':['id',_0x85a0('0x11'),_0x85a0('0x16')],'where':{'role':_0x85a0('0x19'),'chanspy':!![]},'raw':!![]})[_0x85a0('0x1a')](function(_0x2a5870){if(_0x2a5870){return _0x15a859(getChanSpyApplications(_0x5e133d,_0x2a5870));}return _0x15a859([]);})['catch'](function(_0x2195e5){_0x10e23(_0x2195e5);});});};module[_0x85a0('0x1b')]=function(_0x51fde4,_0x54d378){var _0x385594=_0x51fde4[_0x85a0('0x1c')];return _0x51fde4['define']('VoiceChanSpy',attributes,{'tableName':_0x85a0('0x1d'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xa938d4,_0x512689,_0xdf7f29){return getChanSpyPromise(_0x385594,_0xa938d4)[_0x85a0('0x1a')](function(_0x32af9e){if(_0x32af9e&&_0x32af9e[_0x85a0('0x14')]){return _0x385594[_0x85a0('0x1e')]['bulkCreate'](_0x32af9e);}})[_0x85a0('0x1a')](function(){_0xdf7f29();})[_0x85a0('0x1f')](function(_0x34962d){_0xdf7f29(_0x34962d);});},'afterUpdate':function(_0x5c3a44,_0x481207,_0x3f84c9){return _0x385594[_0x85a0('0x1e')]['destroy']({'where':{'ChanSpyId':_0x5c3a44['id']}})['then'](function(){return getChanSpyPromise(_0x385594,_0x5c3a44);})[_0x85a0('0x1a')](function(_0x3702fc){if(_0x3702fc&&_0x3702fc[_0x85a0('0x14')]){return _0x385594[_0x85a0('0x1e')][_0x85a0('0x20')](_0x3702fc);}})[_0x85a0('0x1a')](function(){_0x3f84c9();})[_0x85a0('0x1f')](function(_0x15c6a4){_0x3f84c9(_0x15c6a4);});},'afterDestroy':function(_0x1add8d,_0x3a7899,_0x58e123){return _0x385594[_0x85a0('0x1e')][_0x85a0('0x21')]({'where':{'ChanSpyId':_0x1add8d['id']}})[_0x85a0('0x1a')](function(){_0x58e123();})[_0x85a0('0x1f')](function(_0x5bf3c8){_0x58e123(_0x5bf3c8);});}}});}; \ No newline at end of file +var _0x81ca=['then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','CDR(type)=%s','chanspy','record','push','merge','MixMonitor','${UNIQUEID}.%s,a','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','join','length','concat','User','findAll','internal','agent','catch','exports','models','define','VoiceChanSpy','voice_chanspy'];(function(_0x388550,_0x3fd74b){var _0x735860=function(_0x50783c){while(--_0x50783c){_0x388550['push'](_0x388550['shift']());}};_0x735860(++_0x3fd74b);}(_0x81ca,0x1e4));var _0xa81c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x81ca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa81c('0x0'));var util=require(_0xa81c('0x1'));var BPromise=require(_0xa81c('0x2'));var attributes=require(_0xa81c('0x3'));var getUserApplications=function(_0x1171a2,_0x10ae48,_0x1c8085){var _0x16f9ad=0x1;var _0x48045c=[];var _0x5aab70={'context':_0x10ae48[_0xa81c('0x4')]||_0xa81c('0x5'),'exten':util[_0xa81c('0x6')](_0xa81c('0x7'),_0x1171a2[_0xa81c('0x8')],_0x1c8085),'type':_0xa81c('0x9'),'isApp':![],'ChanSpyId':_0x1171a2['id'],'UserId':_0x10ae48['id']};_0x48045c['push'](_['merge']({'app':'Set','appdata':util[_0xa81c('0x6')](_0xa81c('0xa'),_0xa81c('0xb')),'priority':_0x16f9ad++},_0x5aab70));if(_0x1171a2[_0xa81c('0xc')]){_0x48045c[_0xa81c('0xd')](_[_0xa81c('0xe')]({'app':_0xa81c('0xf'),'appdata':util[_0xa81c('0x6')](_0xa81c('0x10'),_0x1171a2['recordingFormat']),'priority':_0x16f9ad++},_0x5aab70));}if(_0x1171a2['auth']){_0x48045c['push'](_[_0xa81c('0xe')]({'app':_0xa81c('0x11'),'appdata':_0x1171a2[_0xa81c('0x12')],'priority':_0x16f9ad++},_0x5aab70));}_0x48045c[_0xa81c('0xd')](_['merge']({'app':_0xa81c('0x13'),'appdata':util[_0xa81c('0x6')](_0xa81c('0x14'),_0x10ae48[_0xa81c('0x15')],_0x1171a2[_0xa81c('0x16')]?_0x1171a2[_0xa81c('0x16')][_0xa81c('0x17')](''):''),'priority':_0x16f9ad++},_0x5aab70));if(_0x1171a2['record']){_0x48045c[_0xa81c('0xd')](_[_0xa81c('0xe')]({'app':'StopMixMonitor','priority':_0x16f9ad++},_0x5aab70));}return _0x48045c;};var getChanSpyApplications=function(_0x4c8dc4,_0x2ff7f7){var _0x3b5096=[];for(var _0x3c1ca9=0x0,_0x1139d9=0x1;_0x3c1ca9<_0x2ff7f7[_0xa81c('0x18')];_0x3c1ca9++,_0x1139d9=0x1){_0x3b5096=_0x3b5096[_0xa81c('0x19')](getUserApplications(_0x4c8dc4,_0x2ff7f7[_0x3c1ca9],_0x2ff7f7[_0x3c1ca9]['internal']));if(_0x2ff7f7[_0x3c1ca9]['internal']!=_0x2ff7f7[_0x3c1ca9]['name']){_0x3b5096=_0x3b5096['concat'](getUserApplications(_0x4c8dc4,_0x2ff7f7[_0x3c1ca9],_0x2ff7f7[_0x3c1ca9][_0xa81c('0x15')]));}}return _0x3b5096;};var getChanSpyPromise=function(_0x396b1d,_0x255943){return new BPromise(function(_0x59a9f4,_0x4c73f1){return _0x396b1d[_0xa81c('0x1a')][_0xa81c('0x1b')]({'attributes':['id',_0xa81c('0x15'),_0xa81c('0x1c')],'where':{'role':_0xa81c('0x1d'),'chanspy':!![]},'raw':!![]})['then'](function(_0x488733){if(_0x488733){return _0x59a9f4(getChanSpyApplications(_0x255943,_0x488733));}return _0x59a9f4([]);})[_0xa81c('0x1e')](function(_0x371011){_0x4c73f1(_0x371011);});});};module[_0xa81c('0x1f')]=function(_0xf58886,_0x22242a){var _0x2f6bbc=_0xf58886[_0xa81c('0x20')];return _0xf58886[_0xa81c('0x21')](_0xa81c('0x22'),attributes,{'tableName':_0xa81c('0x23'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xe39061,_0x2db6d9,_0x449044){return getChanSpyPromise(_0x2f6bbc,_0xe39061)[_0xa81c('0x24')](function(_0xdd2252){if(_0xdd2252&&_0xdd2252[_0xa81c('0x18')]){return _0x2f6bbc[_0xa81c('0x25')][_0xa81c('0x26')](_0xdd2252);}})['then'](function(){_0x449044();})[_0xa81c('0x1e')](function(_0x22940f){_0x449044(_0x22940f);});},'afterUpdate':function(_0x1488d1,_0x178116,_0x70bf74){return _0x2f6bbc[_0xa81c('0x25')][_0xa81c('0x27')]({'where':{'ChanSpyId':_0x1488d1['id']}})[_0xa81c('0x24')](function(){return getChanSpyPromise(_0x2f6bbc,_0x1488d1);})[_0xa81c('0x24')](function(_0xd93289){if(_0xd93289&&_0xd93289[_0xa81c('0x18')]){return _0x2f6bbc[_0xa81c('0x25')][_0xa81c('0x26')](_0xd93289);}})[_0xa81c('0x24')](function(){_0x70bf74();})['catch'](function(_0x10a591){_0x70bf74(_0x10a591);});},'afterDestroy':function(_0x5e746c,_0xfbc6e8,_0x123d82){return _0x2f6bbc[_0xa81c('0x25')][_0xa81c('0x27')]({'where':{'ChanSpyId':_0x5e746c['id']}})[_0xa81c('0x24')](function(){_0x123d82();})[_0xa81c('0x1e')](function(_0x2dd3ce){_0x123d82(_0x2dd3ce);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index e4691e8..061b25e 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 _0x70e0=['code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5b526e,_0x4ef7a2){var _0x3bad42=function(_0x297af9){while(--_0x297af9){_0x5b526e['push'](_0x5b526e['shift']());}};_0x3bad42(++_0x4ef7a2);}(_0x70e0,0x17b));var _0x070e=function(_0xdc2622,_0x309623){_0xdc2622=_0xdc2622-0x0;var _0x54f4cf=_0x70e0[_0xdc2622];return _0x54f4cf;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file +var _0x4746=['request\x20sent','debug','error','code','message','VoiceChanSpy,\x20%s,\x20%s','info','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x335d26,_0x1021df){var _0x163517=function(_0x46e716){while(--_0x46e716){_0x335d26['push'](_0x335d26['shift']());}};_0x163517(++_0x1021df);}(_0x4746,0xc6));var _0x6474=function(_0x59ef83,_0x1616f4){_0x59ef83=_0x59ef83-0x0;var _0x404afa=_0x4746[_0x59ef83];return _0x404afa;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require('moment');var BPromise=require(_0x6474('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6474('0x3'));var db=require(_0x6474('0x4'))['db'];var utils=require(_0x6474('0x5'));var logger=require(_0x6474('0x6'))(_0x6474('0x7'));var config=require('../../config/environment');var jayson=require(_0x6474('0x8'));var client=jayson[_0x6474('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x433af9,_0x427f79,_0xcd065e){return new BPromise(function(_0xec3cda,_0x15d4c2){return client[_0x6474('0xa')](_0x433af9,_0xcd065e)['then'](function(_0x1bc38b){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,_0x6474('0xb'));logger[_0x6474('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x427f79,_0x6474('0xb'),JSON['stringify'](_0x1bc38b));if(_0x1bc38b[_0x6474('0xd')]){if(_0x1bc38b['error'][_0x6474('0xe')]===0x1f4){logger[_0x6474('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,_0x1bc38b['error']['message']);return _0x15d4c2(_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);}logger[_0x6474('0xd')](_0x6474('0x10'),_0x427f79,_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);return _0xec3cda(_0x1bc38b[_0x6474('0xd')][_0x6474('0xf')]);}else{logger[_0x6474('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x427f79,'request\x20sent');_0xec3cda(_0x1bc38b['result'][_0x6474('0xf')]);}})[_0x6474('0x12')](function(_0x29c19b){logger[_0x6474('0xd')](_0x6474('0x10'),_0x427f79,_0x29c19b);_0x15d4c2(_0x29c19b);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index f0316ad..c2dc5ed 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 _0x73e2=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','path'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x73e2,0x1c0));var _0x273e=function(_0xad33f0,_0x428ba6){_0xad33f0=_0xad33f0-0x0;var _0x1ad40a=_0x73e2[_0xad33f0];return _0x1ad40a;};'use strict';var multer=require(_0x273e('0x0'));var util=require('util');var path=require(_0x273e('0x1'));var timeout=require(_0x273e('0x2'));var express=require('express');var router=express[_0x273e('0x3')]();var fs_extra=require(_0x273e('0x4'));var auth=require(_0x273e('0x5'));var interaction=require(_0x273e('0x6'));var config=require('../../config/environment');var controller=require('./voiceContext.controller');router[_0x273e('0x7')]('/',auth[_0x273e('0x8')](),controller[_0x273e('0x9')]);router[_0x273e('0x7')](_0x273e('0xa'),auth['isAuthenticated'](),controller[_0x273e('0xb')]);router[_0x273e('0xc')]('/',auth[_0x273e('0x8')](),controller['create']);router[_0x273e('0xd')](_0x273e('0xa'),auth['isAuthenticated'](),controller[_0x273e('0xe')]);router[_0x273e('0xf')](_0x273e('0xa'),auth[_0x273e('0x8')](),controller[_0x273e('0x10')]);module[_0x273e('0x11')]=router; \ No newline at end of file +var _0x5da2=['isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller'];(function(_0x5cfe0a,_0x4b14ac){var _0x8da0d4=function(_0x42d480){while(--_0x42d480){_0x5cfe0a['push'](_0x5cfe0a['shift']());}};_0x8da0d4(++_0x4b14ac);}(_0x5da2,0x14d));var _0x25da=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5da2[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x25da('0x0'));var timeout=require(_0x25da('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25da('0x2'));var auth=require(_0x25da('0x3'));var interaction=require(_0x25da('0x4'));var config=require(_0x25da('0x5'));var controller=require(_0x25da('0x6'));router['get']('/',auth[_0x25da('0x7')](),controller['index']);router[_0x25da('0x8')](_0x25da('0x9'),auth[_0x25da('0x7')](),controller['show']);router[_0x25da('0xa')]('/',auth[_0x25da('0x7')](),controller[_0x25da('0xb')]);router[_0x25da('0xc')](_0x25da('0x9'),auth[_0x25da('0x7')](),controller[_0x25da('0xd')]);router[_0x25da('0xe')](_0x25da('0x9'),auth[_0x25da('0x7')](),controller[_0x25da('0xf')]);module[_0x25da('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index d0a8cfe..ab9943b 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 _0x6d0f=['exports','STRING','name','BOOLEAN','sequelize'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x6d0f,0x1df));var _0xf6d0=function(_0x29e0a5,_0x3befba){_0x29e0a5=_0x29e0a5-0x0;var _0x3d020a=_0x6d0f[_0x29e0a5];return _0x3d020a;};'use strict';var Sequelize=require(_0xf6d0('0x0'));module[_0xf6d0('0x1')]={'name':{'type':Sequelize[_0xf6d0('0x2')],'unique':_0xf6d0('0x3')},'description':{'type':Sequelize[_0xf6d0('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xf6d0('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x901e=['STRING','name','sequelize','exports'];(function(_0x256c8c,_0x59ff91){var _0x11dec5=function(_0x7a453d){while(--_0x7a453d){_0x256c8c['push'](_0x256c8c['shift']());}};_0x11dec5(++_0x59ff91);}(_0x901e,0xf6));var _0xe901=function(_0x3aac12,_0x5ce4a3){_0x3aac12=_0x3aac12-0x0;var _0x283857=_0x901e[_0x3aac12];return _0x283857;};'use strict';var Sequelize=require(_0xe901('0x0'));module[_0xe901('0x1')]={'name':{'type':Sequelize[_0xe901('0x2')],'unique':_0xe901('0x3')},'description':{'type':Sequelize[_0xe901('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 58e1957..0ec72b0 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 _0x7712=['debug','stringify','error','VoiceContext,\x20%s,\x20%s','message','info','result','catch','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','sendStatus','stack','name','send','index','map','VoiceContext','fieldName','key','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','includeAll','findAll','rows','show','model','options','find','create','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','request','then','request\x20sent'];(function(_0x51b88d,_0x249143){var _0x28ab06=function(_0x102bb){while(--_0x102bb){_0x51b88d['push'](_0x51b88d['shift']());}};_0x28ab06(++_0x249143);}(_0x7712,0x119));var _0x2771=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7712[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require(_0x2771('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2771('0x1'));var jsonpatch=require(_0x2771('0x2'));var rp=require(_0x2771('0x3'));var moment=require('moment');var BPromise=require(_0x2771('0x4'));var Mustache=require(_0x2771('0x5'));var util=require('util');var path=require(_0x2771('0x6'));var sox=require(_0x2771('0x7'));var csv=require(_0x2771('0x8'));var ejs=require(_0x2771('0x9'));var fs=require('fs');var fs_extra=require(_0x2771('0xa'));var _=require(_0x2771('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2771('0xc'));var deskjs=require(_0x2771('0xd'));var toCsv=require(_0x2771('0x8'));var querystring=require(_0x2771('0xe'));var Papa=require(_0x2771('0xf'));var Redis=require(_0x2771('0x10'));var authService=require(_0x2771('0x11'));var qs=require(_0x2771('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x2771('0x13'))('api');var utils=require(_0x2771('0x14'));var config=require(_0x2771('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2771('0x16'))['db'];var jayson=require(_0x2771('0x17'));var client=jayson[_0x2771('0x18')]['http']({'port':0x232a});function respondWithRpcPromise(_0x222710,_0x3bce3a,_0x56b90c,_0x535f55){return new BPromise(function(_0x4efb4a,_0x1f61a0){var _0x3ae868=_0x535f55||client;return _0x3ae868[_0x2771('0x19')](_0x222710,_0x56b90c)[_0x2771('0x1a')](function(_0x1990bb){logger['info']('VoiceContext,\x20%s,\x20%s',_0x3bce3a,_0x2771('0x1b'));logger[_0x2771('0x1c')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x3bce3a,'request\x20sent',JSON[_0x2771('0x1d')](_0x1990bb));if(_0x1990bb[_0x2771('0x1e')]){if(_0x1990bb['error']['code']===0x1f4){logger[_0x2771('0x1e')](_0x2771('0x1f'),_0x3bce3a,_0x1990bb[_0x2771('0x1e')]['message']);return _0x1f61a0(_0x1990bb['error']['message']);}logger[_0x2771('0x1e')](_0x2771('0x1f'),_0x3bce3a,_0x1990bb[_0x2771('0x1e')][_0x2771('0x20')]);return _0x4efb4a(_0x1990bb[_0x2771('0x1e')][_0x2771('0x20')]);}else{logger[_0x2771('0x21')](_0x2771('0x1f'),_0x3bce3a,_0x2771('0x1b'));_0x4efb4a(_0x1990bb[_0x2771('0x22')][_0x2771('0x20')]);}})[_0x2771('0x23')](function(_0x57c967){logger[_0x2771('0x1e')]('VoiceContext,\x20%s,\x20%s',_0x3bce3a,_0x57c967);_0x1f61a0(_0x57c967);});});}function respondWithStatusCode(_0x40b3a6,_0x3ce954){_0x3ce954=_0x3ce954||0xcc;return function(_0x9fcd5d){if(_0x9fcd5d){return _0x40b3a6['sendStatus'](_0x3ce954);}return _0x40b3a6['status'](_0x3ce954)[_0x2771('0x24')]();};}function respondWithResult(_0x34b7f7,_0xb49f8){_0xb49f8=_0xb49f8||0xc8;return function(_0x400c61){if(_0x400c61){return _0x34b7f7[_0x2771('0x25')](_0xb49f8)[_0x2771('0x26')](_0x400c61);}};}function respondWithFilteredResult(_0xefc86d,_0x32d6bd){return function(_0x2183b4){if(_0x2183b4){var _0x451da5=typeof _0x32d6bd[_0x2771('0x27')]===_0x2771('0x28')&&typeof _0x32d6bd[_0x2771('0x29')]===_0x2771('0x28');var _0x28cd5d=_0x2183b4[_0x2771('0x2a')];var _0x2a0f7b=_0x451da5?0x0:_0x32d6bd['offset'];var _0x390717=_0x451da5?_0x2183b4[_0x2771('0x2a')]:_0x32d6bd['offset']+_0x32d6bd['limit'];var _0x314d94;if(_0x390717>=_0x28cd5d){_0x390717=_0x28cd5d;_0x314d94=0xc8;}else{_0x314d94=0xce;}_0xefc86d[_0x2771('0x25')](_0x314d94);return _0xefc86d[_0x2771('0x2b')](_0x2771('0x2c'),_0x2a0f7b+'-'+_0x390717+'/'+_0x28cd5d)['json'](_0x2183b4);}return null;};}function patchUpdates(_0x48f5b7){return function(_0x35d52a){try{jsonpatch[_0x2771('0x2d')](_0x35d52a,_0x48f5b7,!![]);}catch(_0x262fa7){return BPromise[_0x2771('0x2e')](_0x262fa7);}return _0x35d52a[_0x2771('0x2f')]();};}function saveUpdates(_0x8109a7,_0x19ad24){return function(_0x4231f8){if(_0x4231f8){return _0x4231f8['update'](_0x8109a7)[_0x2771('0x1a')](function(_0x69ce2a){return _0x69ce2a;});}return null;};}function removeEntity(_0x162069,_0x4722b4){return function(_0x5af947){if(_0x5af947){return _0x5af947[_0x2771('0x30')]()[_0x2771('0x1a')](function(){var _0xd3d91d=_0x5af947[_0x2771('0x31')]({'plain':!![]});var _0x11cf0b=_0x2771('0x32');return db[_0x2771('0x33')][_0x2771('0x30')]({'where':{'type':_0x11cf0b,'resourceId':_0xd3d91d['id']}})['then'](function(){return _0x5af947;});})[_0x2771('0x1a')](function(){_0x162069[_0x2771('0x25')](0xcc)[_0x2771('0x24')]();});}};}function handleEntityNotFound(_0x5c472d,_0x14ec82){return function(_0xc28e23){if(!_0xc28e23){_0x5c472d[_0x2771('0x34')](0x194);}return _0xc28e23;};}function handleError(_0xd8bd00,_0xf33c79){_0xf33c79=_0xf33c79||0x1f4;return function(_0x463dee){logger[_0x2771('0x1e')](_0x463dee[_0x2771('0x35')]);if(_0x463dee[_0x2771('0x36')]){delete _0x463dee[_0x2771('0x36')];}_0xd8bd00[_0x2771('0x25')](_0xf33c79)[_0x2771('0x37')](_0x463dee);};}exports[_0x2771('0x38')]=function(_0xda0336,_0x207700){var _0x423705={},_0x221680={},_0x1d4647={'count':0x0,'rows':[]};var _0x5dfd5a=_[_0x2771('0x39')](db[_0x2771('0x3a')]['rawAttributes'],function(_0x311ce6){return{'name':_0x311ce6[_0x2771('0x3b')],'type':_0x311ce6['type'][_0x2771('0x3c')]};});_0x221680['model']=_[_0x2771('0x39')](_0x5dfd5a,_0x2771('0x36'));_0x221680[_0x2771('0x3d')]=_[_0x2771('0x3e')](_0xda0336[_0x2771('0x3d')]);_0x221680[_0x2771('0x3f')]=_['intersection'](_0x221680['model'],_0x221680[_0x2771('0x3d')]);_0x423705['attributes']=_[_0x2771('0x40')](_0x221680['model'],qs[_0x2771('0x41')](_0xda0336[_0x2771('0x3d')][_0x2771('0x41')]));_0x423705[_0x2771('0x42')]=_0x423705['attributes'][_0x2771('0x43')]?_0x423705[_0x2771('0x42')]:_0x221680['model'];if(!_0xda0336[_0x2771('0x3d')][_0x2771('0x44')](_0x2771('0x45'))){_0x423705[_0x2771('0x29')]=qs[_0x2771('0x29')](_0xda0336[_0x2771('0x3d')][_0x2771('0x29')]);_0x423705[_0x2771('0x27')]=qs['offset'](_0xda0336[_0x2771('0x3d')][_0x2771('0x27')]);}_0x423705[_0x2771('0x46')]=qs[_0x2771('0x47')](_0xda0336[_0x2771('0x3d')]['sort']);_0x423705[_0x2771('0x48')]=qs['filters'](_[_0x2771('0x49')](_0xda0336['query'],_0x221680[_0x2771('0x3f')]),_0x5dfd5a);if(_0xda0336['query'][_0x2771('0x4a')]){_0x423705[_0x2771('0x48')]=_['merge'](_0x423705[_0x2771('0x48')],{'$or':_['map'](_0x5dfd5a,function(_0x7a8d7c){if(_0x7a8d7c[_0x2771('0x4b')]!==_0x2771('0x4c')){var _0x3b4dd9={};_0x3b4dd9[_0x7a8d7c[_0x2771('0x36')]]={'$like':'%'+_0xda0336[_0x2771('0x3d')][_0x2771('0x4a')]+'%'};return _0x3b4dd9;}})});}_0x423705=_[_0x2771('0x4d')]({},_0x423705,_0xda0336['options']);var _0x23bbe2={'where':_0x423705[_0x2771('0x48')]};return db[_0x2771('0x3a')]['count'](_0x23bbe2)[_0x2771('0x1a')](function(_0x23ef81){_0x1d4647[_0x2771('0x2a')]=_0x23ef81;if(_0xda0336[_0x2771('0x3d')][_0x2771('0x4e')]){_0x423705['include']=[{'all':!![]}];}return db[_0x2771('0x3a')][_0x2771('0x4f')](_0x423705);})[_0x2771('0x1a')](function(_0x3c451e){_0x1d4647[_0x2771('0x50')]=_0x3c451e;return _0x1d4647;})[_0x2771('0x1a')](respondWithFilteredResult(_0x207700,_0x423705))[_0x2771('0x23')](handleError(_0x207700,null));};exports[_0x2771('0x51')]=function(_0x46f091,_0x2829c1){var _0x14b5fd={'raw':![],'where':{'id':_0x46f091['params']['id']}},_0x81030d={};_0x81030d[_0x2771('0x52')]=_[_0x2771('0x3e')](db['VoiceContext']['rawAttributes']);_0x81030d[_0x2771('0x3d')]=_[_0x2771('0x3e')](_0x46f091[_0x2771('0x3d')]);_0x81030d['filters']=_[_0x2771('0x40')](_0x81030d[_0x2771('0x52')],_0x81030d[_0x2771('0x3d')]);_0x14b5fd[_0x2771('0x42')]=_[_0x2771('0x40')](_0x81030d['model'],qs[_0x2771('0x41')](_0x46f091[_0x2771('0x3d')][_0x2771('0x41')]));_0x14b5fd['attributes']=_0x14b5fd[_0x2771('0x42')][_0x2771('0x43')]?_0x14b5fd[_0x2771('0x42')]:_0x81030d['model'];if(_0x46f091[_0x2771('0x3d')][_0x2771('0x4e')]){_0x14b5fd['include']=[{'all':!![]}];}_0x14b5fd=_['merge']({},_0x14b5fd,_0x46f091[_0x2771('0x53')]);return db['VoiceContext'][_0x2771('0x54')](_0x14b5fd)[_0x2771('0x1a')](handleEntityNotFound(_0x2829c1,null))[_0x2771('0x1a')](respondWithResult(_0x2829c1,null))[_0x2771('0x23')](handleError(_0x2829c1,null));};exports[_0x2771('0x55')]=function(_0x4cc77b,_0x1a6986,_0x34c0d1){var _0x358691;return db[_0x2771('0x3a')][_0x2771('0x55')](_0x4cc77b['body'],{'raw':!![]})[_0x2771('0x1a')](function(_0x57b6bd){_0x358691=_0x57b6bd;return db[_0x2771('0x3a')][_0x2771('0x4f')]({'raw':!![]});})[_0x2771('0x1a')](function(_0x345d78){var _0x4f9ac7=fs[_0x2771('0x56')](path[_0x2771('0x57')](config[_0x2771('0x58')],_0x2771('0x59')),_0x2771('0x5a'));var _0x2b23f6=ejs[_0x2771('0x5b')](_0x4f9ac7,{'contexts':_0x345d78||[]});fs['writeFileSync'](_0x2771('0x5c'),_0x2b23f6);})[_0x2771('0x1a')](function(){return respondWithRpcPromise(_0x2771('0x5d'),'create',{'module':_0x2771('0x5e')});})[_0x2771('0x1a')](function(){var _0x11558a=_0x4cc77b[_0x2771('0x5f')]['get']({'plain':!![]});if(!_0x11558a)throw new Error(_0x2771('0x60'));if(_0x11558a[_0x2771('0x61')]===_0x2771('0x5f')){var _0x3aa2a0=_0x358691['get']({'plain':!![]});return db[_0x2771('0x62')][_0x2771('0x54')]({'where':{'name':'Contexts','userProfileId':_0x11558a['userProfileId']},'raw':!![]})[_0x2771('0x1a')](function(_0x5bb53a){if(_0x5bb53a&&_0x5bb53a['autoAssociation']===0x0){return db['UserProfileResource'][_0x2771('0x55')]({'name':_0x3aa2a0['name'],'resourceId':_0x3aa2a0['id'],'type':_0x5bb53a[_0x2771('0x36')],'sectionId':_0x5bb53a['id']},{})[_0x2771('0x1a')](function(){return _0x358691;});}else{return _0x358691;}})[_0x2771('0x23')](function(_0x86e660){logger[_0x2771('0x1e')](_0x2771('0x63'),_0x86e660);throw _0x86e660;});}return _0x358691;})[_0x2771('0x1a')](respondWithResult(_0x1a6986,0xc9))[_0x2771('0x23')](handleError(_0x1a6986,null));};exports[_0x2771('0x64')]=function(_0x50a319,_0x423933,_0x4d1bea){var _0x3d2351;return db['VoiceContext'][_0x2771('0x54')]({'where':{'id':_0x50a319[_0x2771('0x65')]['id']}})[_0x2771('0x1a')](handleEntityNotFound(_0x423933,null))[_0x2771('0x1a')](saveUpdates(_0x50a319['body'],null))[_0x2771('0x1a')](function(_0x3e5ccf){if(_0x3e5ccf){_0x3d2351=_0x3e5ccf;return db[_0x2771('0x3a')]['findAll']({'raw':!![]});}})[_0x2771('0x1a')](function(_0x2d645d){var _0x441d1f=fs[_0x2771('0x56')](path[_0x2771('0x57')](config[_0x2771('0x58')],'server/files/templates/context.ejs'),_0x2771('0x5a'));var _0x12ee2f=ejs['render'](_0x441d1f,{'contexts':_0x2d645d||[]});fs[_0x2771('0x66')](_0x2771('0x5c'),_0x12ee2f);})[_0x2771('0x1a')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x2771('0x5e')});})[_0x2771('0x1a')](function(){return _0x3d2351;})[_0x2771('0x1a')](respondWithResult(_0x423933,null))[_0x2771('0x23')](handleError(_0x423933,null));};exports[_0x2771('0x30')]=function(_0x22fe81,_0x14a115,_0x1943ce){var _0x596b41;return db[_0x2771('0x3a')][_0x2771('0x54')]({'where':{'id':_0x22fe81['params']['id']}})[_0x2771('0x1a')](handleEntityNotFound(_0x14a115,null))[_0x2771('0x1a')](removeEntity(_0x14a115,null))['then'](function(){return db[_0x2771('0x3a')][_0x2771('0x4f')]({'raw':!![]});})[_0x2771('0x1a')](function(_0x1eca61){var _0x5d1761=fs['readFileSync'](path[_0x2771('0x57')](config[_0x2771('0x58')],_0x2771('0x59')),_0x2771('0x5a'));var _0x5d7740=ejs['render'](_0x5d1761,{'contexts':_0x1eca61});fs[_0x2771('0x66')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x5d7740);return respondWithRpcPromise(_0x2771('0x5d'),_0x2771('0x30'),{'module':'chan_sip.so'});})[_0x2771('0x23')](handleError(_0x14a115,null));}; \ No newline at end of file +var _0x37d2=['mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','http','then','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','info','request\x20sent','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','Contexts','UserProfileResource','end','stack','name','VoiceContext','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','rows','show','params','include','find','readFileSync','root','server/files/templates/context.ejs','render','writeFileSync','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','findAll','join','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x54f039,_0x3e9736){var _0x57a58d=function(_0x12c422){while(--_0x12c422){_0x54f039['push'](_0x54f039['shift']());}};_0x57a58d(++_0x3e9736);}(_0x37d2,0xcd));var _0x237d=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x37d2[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0x237d('0x0'));var rimraf=require(_0x237d('0x1'));var zipdir=require(_0x237d('0x2'));var jsonpatch=require(_0x237d('0x3'));var rp=require(_0x237d('0x4'));var moment=require(_0x237d('0x5'));var BPromise=require(_0x237d('0x6'));var Mustache=require(_0x237d('0x7'));var util=require(_0x237d('0x8'));var path=require(_0x237d('0x9'));var sox=require('sox');var csv=require(_0x237d('0xa'));var ejs=require(_0x237d('0xb'));var fs=require('fs');var fs_extra=require(_0x237d('0xc'));var _=require(_0x237d('0xd'));var squel=require(_0x237d('0xe'));var crypto=require(_0x237d('0xf'));var jsforce=require(_0x237d('0x10'));var deskjs=require(_0x237d('0x11'));var toCsv=require(_0x237d('0xa'));var querystring=require('querystring');var Papa=require(_0x237d('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x237d('0x13'));var as=require(_0x237d('0x14'));var hardwareService=require(_0x237d('0x15'));var logger=require(_0x237d('0x16'))(_0x237d('0x17'));var utils=require(_0x237d('0x18'));var config=require(_0x237d('0x19'));var licenseUtil=require(_0x237d('0x1a'));var db=require(_0x237d('0x1b'))['db'];var jayson=require(_0x237d('0x1c'));var client=jayson['client'][_0x237d('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5647ec,_0x32e4ef,_0x2fb52d,_0x2765b2){return new BPromise(function(_0x55266c,_0x48608e){var _0x401470=_0x2765b2||client;return _0x401470['request'](_0x5647ec,_0x2fb52d)[_0x237d('0x1e')](function(_0x190ad5){logger['info']('VoiceContext,\x20%s,\x20%s',_0x32e4ef,'request\x20sent');logger[_0x237d('0x1f')](_0x237d('0x20'),_0x32e4ef,'request\x20sent',JSON[_0x237d('0x21')](_0x190ad5));if(_0x190ad5[_0x237d('0x22')]){if(_0x190ad5[_0x237d('0x22')][_0x237d('0x23')]===0x1f4){logger[_0x237d('0x22')]('VoiceContext,\x20%s,\x20%s',_0x32e4ef,_0x190ad5[_0x237d('0x22')][_0x237d('0x24')]);return _0x48608e(_0x190ad5[_0x237d('0x22')]['message']);}logger[_0x237d('0x22')](_0x237d('0x25'),_0x32e4ef,_0x190ad5[_0x237d('0x22')]['message']);return _0x55266c(_0x190ad5[_0x237d('0x22')][_0x237d('0x24')]);}else{logger[_0x237d('0x26')]('VoiceContext,\x20%s,\x20%s',_0x32e4ef,_0x237d('0x27'));_0x55266c(_0x190ad5[_0x237d('0x28')][_0x237d('0x24')]);}})[_0x237d('0x29')](function(_0x152c4b){logger[_0x237d('0x22')]('VoiceContext,\x20%s,\x20%s',_0x32e4ef,_0x152c4b);_0x48608e(_0x152c4b);});});}function respondWithStatusCode(_0x551c4e,_0x3c5e41){_0x3c5e41=_0x3c5e41||0xcc;return function(_0x31e085){if(_0x31e085){return _0x551c4e[_0x237d('0x2a')](_0x3c5e41);}return _0x551c4e[_0x237d('0x2b')](_0x3c5e41)['end']();};}function respondWithResult(_0x46f0c5,_0x4ee291){_0x4ee291=_0x4ee291||0xc8;return function(_0x2a1890){if(_0x2a1890){return _0x46f0c5[_0x237d('0x2b')](_0x4ee291)[_0x237d('0x2c')](_0x2a1890);}};}function respondWithFilteredResult(_0x37ebac,_0x56de8e){return function(_0x507ac0){if(_0x507ac0){var _0x573b96=typeof _0x56de8e[_0x237d('0x2d')]===_0x237d('0x2e')&&typeof _0x56de8e[_0x237d('0x2f')]===_0x237d('0x2e');var _0x411528=_0x507ac0[_0x237d('0x30')];var _0xc0b20f=_0x573b96?0x0:_0x56de8e['offset'];var _0x16ad7d=_0x573b96?_0x507ac0['count']:_0x56de8e['offset']+_0x56de8e[_0x237d('0x2f')];var _0x5598d0;if(_0x16ad7d>=_0x411528){_0x16ad7d=_0x411528;_0x5598d0=0xc8;}else{_0x5598d0=0xce;}_0x37ebac[_0x237d('0x2b')](_0x5598d0);return _0x37ebac[_0x237d('0x31')](_0x237d('0x32'),_0xc0b20f+'-'+_0x16ad7d+'/'+_0x411528)[_0x237d('0x2c')](_0x507ac0);}return null;};}function patchUpdates(_0x2370d7){return function(_0x5a02da){try{jsonpatch[_0x237d('0x33')](_0x5a02da,_0x2370d7,!![]);}catch(_0x554c25){return BPromise[_0x237d('0x34')](_0x554c25);}return _0x5a02da['save']();};}function saveUpdates(_0x295a72,_0x5c7429){return function(_0x2f2693){if(_0x2f2693){return _0x2f2693[_0x237d('0x35')](_0x295a72)[_0x237d('0x1e')](function(_0x13ab15){return _0x13ab15;});}return null;};}function removeEntity(_0x561460,_0x417996){return function(_0x224832){if(_0x224832){return _0x224832[_0x237d('0x36')]()[_0x237d('0x1e')](function(){var _0x569c8a=_0x224832['get']({'plain':!![]});var _0x5a61c2=_0x237d('0x37');return db[_0x237d('0x38')][_0x237d('0x36')]({'where':{'type':_0x5a61c2,'resourceId':_0x569c8a['id']}})['then'](function(){return _0x224832;});})[_0x237d('0x1e')](function(){_0x561460[_0x237d('0x2b')](0xcc)[_0x237d('0x39')]();});}};}function handleEntityNotFound(_0x5b5ac0,_0x2619e2){return function(_0x3283f9){if(!_0x3283f9){_0x5b5ac0['sendStatus'](0x194);}return _0x3283f9;};}function handleError(_0x544b3c,_0x28d951){_0x28d951=_0x28d951||0x1f4;return function(_0x412b04){logger[_0x237d('0x22')](_0x412b04[_0x237d('0x3a')]);if(_0x412b04['name']){delete _0x412b04[_0x237d('0x3b')];}_0x544b3c[_0x237d('0x2b')](_0x28d951)['send'](_0x412b04);};}exports['index']=function(_0x21eafd,_0x34ef98){var _0x1b2028={},_0xf0b01b={},_0x1e7704={'count':0x0,'rows':[]};var _0x1727c1=_['map'](db[_0x237d('0x3c')]['rawAttributes'],function(_0x3c65c4){return{'name':_0x3c65c4[_0x237d('0x3d')],'type':_0x3c65c4['type'][_0x237d('0x3e')]};});_0xf0b01b[_0x237d('0x3f')]=_[_0x237d('0x40')](_0x1727c1,_0x237d('0x3b'));_0xf0b01b[_0x237d('0x41')]=_[_0x237d('0x42')](_0x21eafd[_0x237d('0x41')]);_0xf0b01b[_0x237d('0x43')]=_[_0x237d('0x44')](_0xf0b01b[_0x237d('0x3f')],_0xf0b01b[_0x237d('0x41')]);_0x1b2028[_0x237d('0x45')]=_[_0x237d('0x44')](_0xf0b01b[_0x237d('0x3f')],qs['fields'](_0x21eafd['query'][_0x237d('0x46')]));_0x1b2028[_0x237d('0x45')]=_0x1b2028[_0x237d('0x45')][_0x237d('0x47')]?_0x1b2028[_0x237d('0x45')]:_0xf0b01b[_0x237d('0x3f')];if(!_0x21eafd[_0x237d('0x41')][_0x237d('0x48')](_0x237d('0x49'))){_0x1b2028[_0x237d('0x2f')]=qs[_0x237d('0x2f')](_0x21eafd['query']['limit']);_0x1b2028[_0x237d('0x2d')]=qs['offset'](_0x21eafd['query'][_0x237d('0x2d')]);}_0x1b2028[_0x237d('0x4a')]=qs[_0x237d('0x4b')](_0x21eafd['query'][_0x237d('0x4b')]);_0x1b2028[_0x237d('0x4c')]=qs['filters'](_[_0x237d('0x4d')](_0x21eafd['query'],_0xf0b01b[_0x237d('0x43')]),_0x1727c1);if(_0x21eafd[_0x237d('0x41')]['filter']){_0x1b2028[_0x237d('0x4c')]=_[_0x237d('0x4e')](_0x1b2028[_0x237d('0x4c')],{'$or':_[_0x237d('0x40')](_0x1727c1,function(_0xe7da1a){if(_0xe7da1a[_0x237d('0x4f')]!=='VIRTUAL'){var _0x130335={};_0x130335[_0xe7da1a[_0x237d('0x3b')]]={'$like':'%'+_0x21eafd[_0x237d('0x41')][_0x237d('0x50')]+'%'};return _0x130335;}})});}_0x1b2028=_[_0x237d('0x4e')]({},_0x1b2028,_0x21eafd[_0x237d('0x51')]);var _0x1338ff={'where':_0x1b2028[_0x237d('0x4c')]};return db[_0x237d('0x3c')][_0x237d('0x30')](_0x1338ff)['then'](function(_0x355b96){_0x1e7704[_0x237d('0x30')]=_0x355b96;if(_0x21eafd[_0x237d('0x41')][_0x237d('0x52')]){_0x1b2028['include']=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x1b2028);})[_0x237d('0x1e')](function(_0x1eb5fd){_0x1e7704[_0x237d('0x53')]=_0x1eb5fd;return _0x1e7704;})[_0x237d('0x1e')](respondWithFilteredResult(_0x34ef98,_0x1b2028))[_0x237d('0x29')](handleError(_0x34ef98,null));};exports[_0x237d('0x54')]=function(_0x2d0018,_0x596675){var _0x83482d={'raw':![],'where':{'id':_0x2d0018[_0x237d('0x55')]['id']}},_0x1829fd={};_0x1829fd[_0x237d('0x3f')]=_['keys'](db['VoiceContext']['rawAttributes']);_0x1829fd[_0x237d('0x41')]=_[_0x237d('0x42')](_0x2d0018['query']);_0x1829fd[_0x237d('0x43')]=_[_0x237d('0x44')](_0x1829fd['model'],_0x1829fd['query']);_0x83482d[_0x237d('0x45')]=_[_0x237d('0x44')](_0x1829fd[_0x237d('0x3f')],qs['fields'](_0x2d0018[_0x237d('0x41')][_0x237d('0x46')]));_0x83482d[_0x237d('0x45')]=_0x83482d[_0x237d('0x45')]['length']?_0x83482d[_0x237d('0x45')]:_0x1829fd[_0x237d('0x3f')];if(_0x2d0018['query'][_0x237d('0x52')]){_0x83482d[_0x237d('0x56')]=[{'all':!![]}];}_0x83482d=_[_0x237d('0x4e')]({},_0x83482d,_0x2d0018['options']);return db['VoiceContext'][_0x237d('0x57')](_0x83482d)['then'](handleEntityNotFound(_0x596675,null))[_0x237d('0x1e')](respondWithResult(_0x596675,null))['catch'](handleError(_0x596675,null));};exports['create']=function(_0x14365b,_0xcffd1d,_0x3eb76c){var _0x22ef77;return db[_0x237d('0x3c')]['create'](_0x14365b['body'],{'raw':!![]})[_0x237d('0x1e')](function(_0x2ee0a7){_0x22ef77=_0x2ee0a7;return db[_0x237d('0x3c')]['findAll']({'raw':!![]});})['then'](function(_0x2c7943){var _0x285765=fs[_0x237d('0x58')](path['join'](config[_0x237d('0x59')],_0x237d('0x5a')),'utf8');var _0x548fdd=ejs[_0x237d('0x5b')](_0x285765,{'contexts':_0x2c7943||[]});fs[_0x237d('0x5c')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x548fdd);})['then'](function(){return respondWithRpcPromise('Reload',_0x237d('0x5d'),{'module':'chan_sip.so'});})['then'](function(){var _0x3c9e88=_0x14365b['user'][_0x237d('0x5e')]({'plain':!![]});if(!_0x3c9e88)throw new Error(_0x237d('0x5f'));if(_0x3c9e88[_0x237d('0x60')]==='user'){var _0x5a7cff=_0x22ef77[_0x237d('0x5e')]({'plain':!![]});return db[_0x237d('0x61')][_0x237d('0x57')]({'where':{'name':'Contexts','userProfileId':_0x3c9e88['userProfileId']},'raw':!![]})[_0x237d('0x1e')](function(_0x4a5228){if(_0x4a5228&&_0x4a5228[_0x237d('0x62')]===0x0){return db[_0x237d('0x38')][_0x237d('0x5d')]({'name':_0x5a7cff[_0x237d('0x3b')],'resourceId':_0x5a7cff['id'],'type':_0x4a5228['name'],'sectionId':_0x4a5228['id']},{})[_0x237d('0x1e')](function(){return _0x22ef77;});}else{return _0x22ef77;}})[_0x237d('0x29')](function(_0x1b8d42){logger[_0x237d('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b8d42);throw _0x1b8d42;});}return _0x22ef77;})[_0x237d('0x1e')](respondWithResult(_0xcffd1d,0xc9))[_0x237d('0x29')](handleError(_0xcffd1d,null));};exports[_0x237d('0x35')]=function(_0x213558,_0x79e8c5,_0x7cc292){var _0x57fa7e;return db['VoiceContext'][_0x237d('0x57')]({'where':{'id':_0x213558[_0x237d('0x55')]['id']}})['then'](handleEntityNotFound(_0x79e8c5,null))[_0x237d('0x1e')](saveUpdates(_0x213558[_0x237d('0x63')],null))['then'](function(_0x290049){if(_0x290049){_0x57fa7e=_0x290049;return db[_0x237d('0x3c')][_0x237d('0x64')]({'raw':!![]});}})[_0x237d('0x1e')](function(_0x2b6516){var _0x595bd9=fs['readFileSync'](path[_0x237d('0x65')](config[_0x237d('0x59')],_0x237d('0x5a')),'utf8');var _0x3dce8e=ejs[_0x237d('0x5b')](_0x595bd9,{'contexts':_0x2b6516||[]});fs[_0x237d('0x5c')](_0x237d('0x66'),_0x3dce8e);})[_0x237d('0x1e')](function(){return respondWithRpcPromise(_0x237d('0x67'),'update',{'module':_0x237d('0x68')});})['then'](function(){return _0x57fa7e;})[_0x237d('0x1e')](respondWithResult(_0x79e8c5,null))[_0x237d('0x29')](handleError(_0x79e8c5,null));};exports[_0x237d('0x36')]=function(_0x2a4cd5,_0x32c787,_0x270bd8){var _0x80d7c6;return db[_0x237d('0x3c')][_0x237d('0x57')]({'where':{'id':_0x2a4cd5[_0x237d('0x55')]['id']}})[_0x237d('0x1e')](handleEntityNotFound(_0x32c787,null))['then'](removeEntity(_0x32c787,null))[_0x237d('0x1e')](function(){return db[_0x237d('0x3c')][_0x237d('0x64')]({'raw':!![]});})['then'](function(_0xb04ad4){var _0x51ff0c=fs['readFileSync'](path['join'](config[_0x237d('0x59')],_0x237d('0x5a')),_0x237d('0x69'));var _0x43a0cd=ejs[_0x237d('0x5b')](_0x51ff0c,{'contexts':_0xb04ad4});fs['writeFileSync'](_0x237d('0x66'),_0x43a0cd);return respondWithRpcPromise(_0x237d('0x67'),_0x237d('0x36'),{'module':_0x237d('0x68')});})[_0x237d('0x29')](handleError(_0x32c787,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 35797ac..dc41118 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 _0xaf55=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x3a2e4b,_0x1fc1f7){var _0x3697d9=function(_0x45a4fa){while(--_0x45a4fa){_0x3a2e4b['push'](_0x3a2e4b['shift']());}};_0x3697d9(++_0x1fc1f7);}(_0xaf55,0x1e0));var _0x5af5=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xaf55[_0x101e7b];return _0x4995c0;};'use strict';var _=require(_0x5af5('0x0'));var util=require(_0x5af5('0x1'));var logger=require(_0x5af5('0x2'))(_0x5af5('0x3'));var moment=require(_0x5af5('0x4'));var BPromise=require(_0x5af5('0x5'));var rp=require(_0x5af5('0x6'));var fs=require('fs');var path=require(_0x5af5('0x7'));var rimraf=require(_0x5af5('0x8'));var config=require(_0x5af5('0x9'));var attributes=require(_0x5af5('0xa'));module[_0x5af5('0xb')]=function(_0x16b6a0,_0x872cb0){return _0x16b6a0[_0x5af5('0xc')](_0x5af5('0xd'),attributes,{'tableName':_0x5af5('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcd6f=['bluebird','path','rimraf','../../config/environment','./voiceContext.attributes','define','voice_contexts','lodash','util','../../config/logger','api','moment'];(function(_0x326e3c,_0x53dc2){var _0x362c76=function(_0x2f5e2e){while(--_0x2f5e2e){_0x326e3c['push'](_0x326e3c['shift']());}};_0x362c76(++_0x53dc2);}(_0xcd6f,0x17b));var _0xfcd6=function(_0x1a3bba,_0x3e5604){_0x1a3bba=_0x1a3bba-0x0;var _0x44c58f=_0xcd6f[_0x1a3bba];return _0x44c58f;};'use strict';var _=require(_0xfcd6('0x0'));var util=require(_0xfcd6('0x1'));var logger=require(_0xfcd6('0x2'))(_0xfcd6('0x3'));var moment=require(_0xfcd6('0x4'));var BPromise=require(_0xfcd6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfcd6('0x6'));var rimraf=require(_0xfcd6('0x7'));var config=require(_0xfcd6('0x8'));var attributes=require(_0xfcd6('0x9'));module['exports']=function(_0x124ba8,_0x5494f3){return _0x124ba8[_0xfcd6('0xa')]('VoiceContext',attributes,{'tableName':_0xfcd6('0xb'),'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 80217d2..55f82c0 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 _0xb12d=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceContext,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0xc88845,_0x38bd20){var _0x82346=function(_0x6cc22a){while(--_0x6cc22a){_0xc88845['push'](_0xc88845['shift']());}};_0x82346(++_0x38bd20);}(_0xb12d,0x124));var _0xdb12=function(_0x45783c,_0x49c56d){_0x45783c=_0x45783c-0x0;var _0x1161da=_0xb12d[_0x45783c];return _0x1161da;};'use strict';var _=require(_0xdb12('0x0'));var util=require(_0xdb12('0x1'));var moment=require(_0xdb12('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb12('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdb12('0x4'))['db'];var utils=require(_0xdb12('0x5'));var logger=require(_0xdb12('0x6'))(_0xdb12('0x7'));var config=require(_0xdb12('0x8'));var jayson=require(_0xdb12('0x9'));var client=jayson['client'][_0xdb12('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19e73f,_0x27eb31,_0x3872c3){return new BPromise(function(_0x11385d,_0x11d97c){return client[_0xdb12('0xb')](_0x19e73f,_0x3872c3)[_0xdb12('0xc')](function(_0x54eb5b){logger[_0xdb12('0xd')]('VoiceContext,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));logger[_0xdb12('0xf')](_0xdb12('0x10'),_0x27eb31,'request\x20sent',JSON[_0xdb12('0x11')](_0x54eb5b));if(_0x54eb5b[_0xdb12('0x12')]){if(_0x54eb5b[_0xdb12('0x12')]['code']===0x1f4){logger[_0xdb12('0x12')]('VoiceContext,\x20%s,\x20%s',_0x27eb31,_0x54eb5b[_0xdb12('0x12')][_0xdb12('0x13')]);return _0x11d97c(_0x54eb5b[_0xdb12('0x12')]['message']);}logger[_0xdb12('0x12')](_0xdb12('0x14'),_0x27eb31,_0x54eb5b['error'][_0xdb12('0x13')]);return _0x11385d(_0x54eb5b['error'][_0xdb12('0x13')]);}else{logger[_0xdb12('0xd')]('VoiceContext,\x20%s,\x20%s',_0x27eb31,_0xdb12('0xe'));_0x11385d(_0x54eb5b[_0xdb12('0x15')][_0xdb12('0x13')]);}})[_0xdb12('0x16')](function(_0x504cf5){logger['error'](_0xdb12('0x14'),_0x27eb31,_0x504cf5);_0x11d97c(_0x504cf5);});});} \ No newline at end of file +var _0xc5c0=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0xeed3de,_0x14b92f){var _0x5d22a8=function(_0x11fd66){while(--_0x11fd66){_0xeed3de['push'](_0xeed3de['shift']());}};_0x5d22a8(++_0x14b92f);}(_0xc5c0,0x6c));var _0x0c5c=function(_0x14c5c2,_0x44060b){_0x14c5c2=_0x14c5c2-0x0;var _0x3dbd1f=_0xc5c0[_0x14c5c2];return _0x3dbd1f;};'use strict';var _=require(_0x0c5c('0x0'));var util=require(_0x0c5c('0x1'));var moment=require(_0x0c5c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c5c('0x3'));var db=require(_0x0c5c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0c5c('0x5'))(_0x0c5c('0x6'));var config=require(_0x0c5c('0x7'));var jayson=require(_0x0c5c('0x8'));var client=jayson[_0x0c5c('0x9')][_0x0c5c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x465ff0,_0x58e41c,_0x1709fd){return new BPromise(function(_0x1d1386,_0x52592e){return client[_0x0c5c('0xb')](_0x465ff0,_0x1709fd)[_0x0c5c('0xc')](function(_0x4145aa){logger[_0x0c5c('0xd')]('VoiceContext,\x20%s,\x20%s',_0x58e41c,_0x0c5c('0xe'));logger[_0x0c5c('0xf')](_0x0c5c('0x10'),_0x58e41c,_0x0c5c('0xe'),JSON[_0x0c5c('0x11')](_0x4145aa));if(_0x4145aa['error']){if(_0x4145aa[_0x0c5c('0x12')]['code']===0x1f4){logger[_0x0c5c('0x12')](_0x0c5c('0x13'),_0x58e41c,_0x4145aa[_0x0c5c('0x12')][_0x0c5c('0x14')]);return _0x52592e(_0x4145aa[_0x0c5c('0x12')][_0x0c5c('0x14')]);}logger[_0x0c5c('0x12')](_0x0c5c('0x13'),_0x58e41c,_0x4145aa[_0x0c5c('0x12')][_0x0c5c('0x14')]);return _0x1d1386(_0x4145aa['error'][_0x0c5c('0x14')]);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x58e41c,_0x0c5c('0xe'));_0x1d1386(_0x4145aa[_0x0c5c('0x15')]['message']);}})[_0x0c5c('0x16')](function(_0x5c0be8){logger[_0x0c5c('0x12')](_0x0c5c('0x13'),_0x58e41c,_0x5c0be8);_0x52592e(_0x5c0be8);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 391af64..b7d0358 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 _0xfbb0=['isAuthenticated','describe','/:id','show','post','create','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x37daa8,_0x775188){var _0x6dbe8d=function(_0xa2dd29){while(--_0xa2dd29){_0x37daa8['push'](_0x37daa8['shift']());}};_0x6dbe8d(++_0x775188);}(_0xfbb0,0x1d1));var _0x0fbb=function(_0x347dde,_0x161a05){_0x347dde=_0x347dde-0x0;var _0x1c0739=_0xfbb0[_0x347dde];return _0x1c0739;};'use strict';var multer=require(_0x0fbb('0x0'));var util=require(_0x0fbb('0x1'));var path=require('path');var timeout=require(_0x0fbb('0x2'));var express=require(_0x0fbb('0x3'));var router=express[_0x0fbb('0x4')]();var fs_extra=require(_0x0fbb('0x5'));var auth=require(_0x0fbb('0x6'));var interaction=require(_0x0fbb('0x7'));var config=require(_0x0fbb('0x8'));var controller=require('./voiceDialReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x0fbb('0x9')]('/describe',auth[_0x0fbb('0xa')](),controller[_0x0fbb('0xb')]);router[_0x0fbb('0x9')](_0x0fbb('0xc'),auth[_0x0fbb('0xa')](),controller[_0x0fbb('0xd')]);router[_0x0fbb('0xe')]('/',auth[_0x0fbb('0xa')](),controller[_0x0fbb('0xf')]);router['put'](_0x0fbb('0xc'),auth['isAuthenticated'](),controller[_0x0fbb('0x10')]);router[_0x0fbb('0x11')](_0x0fbb('0xc'),auth[_0x0fbb('0xa')](),controller[_0x0fbb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x13a2=['../../config/environment','./voiceDialReport.controller','get','index','/describe','isAuthenticated','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x411449,_0x4b3947){var _0x19da12=function(_0x3bef4){while(--_0x3bef4){_0x411449['push'](_0x411449['shift']());}};_0x19da12(++_0x4b3947);}(_0x13a2,0x175));var _0x213a=function(_0xb1c5c1,_0x17c562){_0xb1c5c1=_0xb1c5c1-0x0;var _0x3ddda6=_0x13a2[_0xb1c5c1];return _0x3ddda6;};'use strict';var multer=require(_0x213a('0x0'));var util=require(_0x213a('0x1'));var path=require(_0x213a('0x2'));var timeout=require('connect-timeout');var express=require(_0x213a('0x3'));var router=express[_0x213a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x213a('0x5'));var controller=require(_0x213a('0x6'));router[_0x213a('0x7')]('/',auth['isAuthenticated'](),controller[_0x213a('0x8')]);router[_0x213a('0x7')](_0x213a('0x9'),auth[_0x213a('0xa')](),controller['describe']);router[_0x213a('0x7')]('/:id',auth[_0x213a('0xa')](),controller[_0x213a('0xb')]);router[_0x213a('0xc')]('/',auth[_0x213a('0xa')](),controller[_0x213a('0xd')]);router[_0x213a('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x213a('0xf')]('/:id',auth[_0x213a('0xa')](),controller[_0x213a('0x10')]);module[_0x213a('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6a3b133..b6efb6f 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 _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x1630c0,_0x4b0ad2){var _0x116d2e=function(_0x46868a){while(--_0x46868a){_0x1630c0['push'](_0x1630c0['shift']());}};_0x116d2e(++_0x4b0ad2);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x5d6bb7,_0x101286){var _0x5052b5=function(_0x3648e8){while(--_0x3648e8){_0x5d6bb7['push'](_0x5d6bb7['shift']());}};_0x5052b5(++_0x101286);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2ef291,_0x11d6f5){_0x2ef291=_0x2ef291-0x0;var _0x2c374b=_0xe5b3[_0x2ef291];return _0x2c374b;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index db95b0d..b42b85d 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 _0x4df8=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x2c4787,_0x3d31f9){var _0x23ef9e=function(_0x488332){while(--_0x488332){_0x2c4787['push'](_0x2c4787['shift']());}};_0x23ef9e(++_0x3d31f9);}(_0x4df8,0x77));var _0x84df=function(_0xd3f578,_0x260ebe){_0xd3f578=_0xd3f578-0x0;var _0x14b758=_0x4df8[_0xd3f578];return _0x14b758;};'use strict';var emlformat=require(_0x84df('0x0'));var rimraf=require(_0x84df('0x1'));var zipdir=require(_0x84df('0x2'));var jsonpatch=require(_0x84df('0x3'));var rp=require(_0x84df('0x4'));var moment=require('moment');var BPromise=require(_0x84df('0x5'));var Mustache=require(_0x84df('0x6'));var util=require(_0x84df('0x7'));var path=require(_0x84df('0x8'));var sox=require(_0x84df('0x9'));var csv=require(_0x84df('0xa'));var ejs=require(_0x84df('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84df('0xc'));var squel=require(_0x84df('0xd'));var crypto=require(_0x84df('0xe'));var jsforce=require(_0x84df('0xf'));var deskjs=require(_0x84df('0x10'));var toCsv=require(_0x84df('0xa'));var querystring=require(_0x84df('0x11'));var Papa=require('papaparse');var Redis=require(_0x84df('0x12'));var authService=require(_0x84df('0x13'));var qs=require(_0x84df('0x14'));var as=require(_0x84df('0x15'));var hardwareService=require(_0x84df('0x16'));var logger=require('../../config/logger')(_0x84df('0x17'));var utils=require(_0x84df('0x18'));var config=require(_0x84df('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x84df('0x1a'))['db'];function respondWithStatusCode(_0x4f5ce2,_0x20a516){_0x20a516=_0x20a516||0xcc;return function(_0x3134f1){if(_0x3134f1){return _0x4f5ce2[_0x84df('0x1b')](_0x20a516);}return _0x4f5ce2['status'](_0x20a516)[_0x84df('0x1c')]();};}function respondWithResult(_0xf1d852,_0x1ebfcf){_0x1ebfcf=_0x1ebfcf||0xc8;return function(_0x27fa79){if(_0x27fa79){return _0xf1d852[_0x84df('0x1d')](_0x1ebfcf)[_0x84df('0x1e')](_0x27fa79);}};}function respondWithFilteredResult(_0x5b8efd,_0x311bd3){return function(_0x358c1c){if(_0x358c1c){var _0x27024c=typeof _0x311bd3[_0x84df('0x1f')]===_0x84df('0x20')&&typeof _0x311bd3['limit']===_0x84df('0x20');var _0x1129a9=_0x358c1c[_0x84df('0x21')];var _0x5c20f1=_0x27024c?0x0:_0x311bd3[_0x84df('0x1f')];var _0x3b6bcc=_0x27024c?_0x358c1c['count']:_0x311bd3['offset']+_0x311bd3['limit'];var _0x217510;if(_0x3b6bcc>=_0x1129a9){_0x3b6bcc=_0x1129a9;_0x217510=0xc8;}else{_0x217510=0xce;}_0x5b8efd[_0x84df('0x1d')](_0x217510);return _0x5b8efd[_0x84df('0x22')](_0x84df('0x23'),_0x5c20f1+'-'+_0x3b6bcc+'/'+_0x1129a9)['json'](_0x358c1c);}return null;};}function patchUpdates(_0x2d3bb9){return function(_0x5edcc6){try{jsonpatch[_0x84df('0x24')](_0x5edcc6,_0x2d3bb9,!![]);}catch(_0x15d2fc){return BPromise[_0x84df('0x25')](_0x15d2fc);}return _0x5edcc6[_0x84df('0x26')]();};}function saveUpdates(_0x275342,_0x45df14){return function(_0x4240ef){if(_0x4240ef){return _0x4240ef[_0x84df('0x27')](_0x275342)['then'](function(_0x127cf9){return _0x127cf9;});}return null;};}function removeEntity(_0x14f332,_0x2a8dbf){return function(_0x5baa2d){if(_0x5baa2d){return _0x5baa2d[_0x84df('0x28')]()[_0x84df('0x29')](function(){_0x14f332[_0x84df('0x1d')](0xcc)[_0x84df('0x1c')]();});}};}function handleEntityNotFound(_0x8b2d61,_0x41d8f3){return function(_0x40de34){if(!_0x40de34){_0x8b2d61[_0x84df('0x1b')](0x194);}return _0x40de34;};}function handleError(_0x37621a,_0x14ec83){_0x14ec83=_0x14ec83||0x1f4;return function(_0x5c9db7){logger[_0x84df('0x2a')](_0x5c9db7[_0x84df('0x2b')]);if(_0x5c9db7[_0x84df('0x2c')]){delete _0x5c9db7[_0x84df('0x2c')];}_0x37621a[_0x84df('0x1d')](_0x14ec83)['send'](_0x5c9db7);};}exports[_0x84df('0x2d')]=function(_0x155f8a,_0x5a28ed){var _0x4b5925={},_0xce423b={},_0x2d9c2={'count':0x0,'rows':[]};var _0x1e6302=_[_0x84df('0x2e')](db[_0x84df('0x2f')][_0x84df('0x30')],function(_0x218947){return{'name':_0x218947[_0x84df('0x31')],'type':_0x218947['type'][_0x84df('0x32')]};});_0xce423b[_0x84df('0x33')]=_[_0x84df('0x2e')](_0x1e6302,_0x84df('0x2c'));_0xce423b[_0x84df('0x34')]=_['keys'](_0x155f8a[_0x84df('0x34')]);_0xce423b[_0x84df('0x35')]=_[_0x84df('0x36')](_0xce423b[_0x84df('0x33')],_0xce423b['query']);_0x4b5925[_0x84df('0x37')]=_[_0x84df('0x36')](_0xce423b[_0x84df('0x33')],qs[_0x84df('0x38')](_0x155f8a[_0x84df('0x34')]['fields']));_0x4b5925[_0x84df('0x37')]=_0x4b5925[_0x84df('0x37')]['length']?_0x4b5925['attributes']:_0xce423b[_0x84df('0x33')];if(!_0x155f8a[_0x84df('0x34')][_0x84df('0x39')]('nolimit')){_0x4b5925[_0x84df('0x3a')]=qs['limit'](_0x155f8a[_0x84df('0x34')][_0x84df('0x3a')]);_0x4b5925[_0x84df('0x1f')]=qs[_0x84df('0x1f')](_0x155f8a[_0x84df('0x34')][_0x84df('0x1f')]);}_0x4b5925['order']=qs[_0x84df('0x3b')](_0x155f8a[_0x84df('0x34')][_0x84df('0x3b')]);_0x4b5925[_0x84df('0x3c')]=qs[_0x84df('0x35')](_[_0x84df('0x3d')](_0x155f8a[_0x84df('0x34')],_0xce423b[_0x84df('0x35')]),_0x1e6302);if(_0x155f8a[_0x84df('0x34')][_0x84df('0x3e')]){_0x4b5925[_0x84df('0x3c')]=_[_0x84df('0x3f')](_0x4b5925[_0x84df('0x3c')],{'$or':_['map'](_0x1e6302,function(_0x34a587){if(_0x34a587['type']!==_0x84df('0x40')){var _0x2aef7b={};_0x2aef7b[_0x34a587['name']]={'$like':'%'+_0x155f8a[_0x84df('0x34')][_0x84df('0x3e')]+'%'};return _0x2aef7b;}})});}_0x4b5925=_[_0x84df('0x3f')]({},_0x4b5925,_0x155f8a[_0x84df('0x41')]);var _0x4b261b={'where':_0x4b5925[_0x84df('0x3c')]};return db[_0x84df('0x2f')][_0x84df('0x21')](_0x4b261b)[_0x84df('0x29')](function(_0x56a8e0){_0x2d9c2[_0x84df('0x21')]=_0x56a8e0;if(_0x155f8a[_0x84df('0x34')][_0x84df('0x42')]){_0x4b5925['include']=[{'all':!![]}];}return db[_0x84df('0x2f')][_0x84df('0x43')](_0x4b5925);})['then'](function(_0x27f02c){_0x2d9c2[_0x84df('0x44')]=_0x27f02c;return _0x2d9c2;})[_0x84df('0x29')](respondWithFilteredResult(_0x5a28ed,_0x4b5925))[_0x84df('0x45')](handleError(_0x5a28ed,null));};exports['show']=function(_0x457001,_0x2af172){var _0x4802a8={'raw':!![],'where':{'id':_0x457001[_0x84df('0x46')]['id']}},_0x52c83c={};_0x52c83c['model']=_[_0x84df('0x47')](db[_0x84df('0x2f')][_0x84df('0x30')]);_0x52c83c['query']=_[_0x84df('0x47')](_0x457001[_0x84df('0x34')]);_0x52c83c[_0x84df('0x35')]=_[_0x84df('0x36')](_0x52c83c[_0x84df('0x33')],_0x52c83c[_0x84df('0x34')]);_0x4802a8[_0x84df('0x37')]=_['intersection'](_0x52c83c[_0x84df('0x33')],qs[_0x84df('0x38')](_0x457001[_0x84df('0x34')][_0x84df('0x38')]));_0x4802a8[_0x84df('0x37')]=_0x4802a8[_0x84df('0x37')][_0x84df('0x48')]?_0x4802a8[_0x84df('0x37')]:_0x52c83c['model'];if(_0x457001[_0x84df('0x34')][_0x84df('0x42')]){_0x4802a8['include']=[{'all':!![]}];}_0x4802a8=_[_0x84df('0x3f')]({},_0x4802a8,_0x457001['options']);return db['VoiceDialReport'][_0x84df('0x49')](_0x4802a8)[_0x84df('0x29')](handleEntityNotFound(_0x2af172,null))[_0x84df('0x29')](respondWithResult(_0x2af172,null))[_0x84df('0x45')](handleError(_0x2af172,null));};exports[_0x84df('0x4a')]=function(_0x314a41,_0x1e47a9){return db[_0x84df('0x2f')][_0x84df('0x4a')](_0x314a41['body'],{})[_0x84df('0x29')](respondWithResult(_0x1e47a9,0xc9))[_0x84df('0x45')](handleError(_0x1e47a9,null));};exports[_0x84df('0x27')]=function(_0x5c8696,_0x3bc194){if(_0x5c8696[_0x84df('0x4b')]['id']){delete _0x5c8696['body']['id'];}return db[_0x84df('0x2f')][_0x84df('0x49')]({'where':{'id':_0x5c8696[_0x84df('0x46')]['id']}})[_0x84df('0x29')](handleEntityNotFound(_0x3bc194,null))['then'](saveUpdates(_0x5c8696[_0x84df('0x4b')],null))['then'](respondWithResult(_0x3bc194,null))[_0x84df('0x45')](handleError(_0x3bc194,null));};exports[_0x84df('0x28')]=function(_0x32e209,_0x5d7cd2){return db[_0x84df('0x2f')][_0x84df('0x49')]({'where':{'id':_0x32e209[_0x84df('0x46')]['id']}})['then'](handleEntityNotFound(_0x5d7cd2,null))[_0x84df('0x29')](removeEntity(_0x5d7cd2,null))[_0x84df('0x45')](handleError(_0x5d7cd2,null));};exports[_0x84df('0x4c')]=function(_0x14cddc,_0xf418b6){return db['VoiceDialReport'][_0x84df('0x4c')]()[_0x84df('0x29')](respondWithResult(_0xf418b6,null))[_0x84df('0x45')](handleError(_0xf418b6,null));}; \ No newline at end of file +var _0x5345=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','stack','name','send','VoiceDialReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x3efe7c,_0x5227f3){var _0x45d293=function(_0x4a5158){while(--_0x4a5158){_0x3efe7c['push'](_0x3efe7c['shift']());}};_0x45d293(++_0x5227f3);}(_0x5345,0xf1));var _0x5534=function(_0x5bf721,_0x593494){_0x5bf721=_0x5bf721-0x0;var _0x32f1c4=_0x5345[_0x5bf721];return _0x32f1c4;};'use strict';var emlformat=require(_0x5534('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5534('0x1'));var jsonpatch=require(_0x5534('0x2'));var rp=require(_0x5534('0x3'));var moment=require(_0x5534('0x4'));var BPromise=require(_0x5534('0x5'));var Mustache=require(_0x5534('0x6'));var util=require(_0x5534('0x7'));var path=require(_0x5534('0x8'));var sox=require(_0x5534('0x9'));var csv=require('to-csv');var ejs=require(_0x5534('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5534('0xb'));var squel=require('squel');var crypto=require(_0x5534('0xc'));var jsforce=require(_0x5534('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5534('0xe'));var querystring=require(_0x5534('0xf'));var Papa=require(_0x5534('0x10'));var Redis=require(_0x5534('0x11'));var authService=require(_0x5534('0x12'));var qs=require(_0x5534('0x13'));var as=require(_0x5534('0x14'));var hardwareService=require(_0x5534('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5534('0x16'));var db=require(_0x5534('0x17'))['db'];function respondWithStatusCode(_0x2687d1,_0x336ff5){_0x336ff5=_0x336ff5||0xcc;return function(_0x127e33){if(_0x127e33){return _0x2687d1[_0x5534('0x18')](_0x336ff5);}return _0x2687d1['status'](_0x336ff5)['end']();};}function respondWithResult(_0x21b098,_0x25cfd4){_0x25cfd4=_0x25cfd4||0xc8;return function(_0xffe476){if(_0xffe476){return _0x21b098['status'](_0x25cfd4)['json'](_0xffe476);}};}function respondWithFilteredResult(_0x44a4f4,_0x5c6f4d){return function(_0x1caad1){if(_0x1caad1){var _0x36a7a7=typeof _0x5c6f4d[_0x5534('0x19')]===_0x5534('0x1a')&&typeof _0x5c6f4d[_0x5534('0x1b')]===_0x5534('0x1a');var _0x4460c3=_0x1caad1[_0x5534('0x1c')];var _0x59835a=_0x36a7a7?0x0:_0x5c6f4d[_0x5534('0x19')];var _0x2ec267=_0x36a7a7?_0x1caad1[_0x5534('0x1c')]:_0x5c6f4d[_0x5534('0x19')]+_0x5c6f4d[_0x5534('0x1b')];var _0xa51ae9;if(_0x2ec267>=_0x4460c3){_0x2ec267=_0x4460c3;_0xa51ae9=0xc8;}else{_0xa51ae9=0xce;}_0x44a4f4[_0x5534('0x1d')](_0xa51ae9);return _0x44a4f4[_0x5534('0x1e')](_0x5534('0x1f'),_0x59835a+'-'+_0x2ec267+'/'+_0x4460c3)[_0x5534('0x20')](_0x1caad1);}return null;};}function patchUpdates(_0x4fab7f){return function(_0x51873e){try{jsonpatch[_0x5534('0x21')](_0x51873e,_0x4fab7f,!![]);}catch(_0x3c2762){return BPromise['reject'](_0x3c2762);}return _0x51873e[_0x5534('0x22')]();};}function saveUpdates(_0x137aca,_0x1bc525){return function(_0x48be54){if(_0x48be54){return _0x48be54[_0x5534('0x23')](_0x137aca)[_0x5534('0x24')](function(_0x3d6f79){return _0x3d6f79;});}return null;};}function removeEntity(_0x595927,_0x782c23){return function(_0x3fdb04){if(_0x3fdb04){return _0x3fdb04[_0x5534('0x25')]()[_0x5534('0x24')](function(){_0x595927['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d2a35,_0x19d541){return function(_0x1eeefb){if(!_0x1eeefb){_0x3d2a35[_0x5534('0x18')](0x194);}return _0x1eeefb;};}function handleError(_0xb3bc67,_0x39a48e){_0x39a48e=_0x39a48e||0x1f4;return function(_0x3d4f49){logger['error'](_0x3d4f49[_0x5534('0x26')]);if(_0x3d4f49['name']){delete _0x3d4f49[_0x5534('0x27')];}_0xb3bc67['status'](_0x39a48e)[_0x5534('0x28')](_0x3d4f49);};}exports['index']=function(_0x33e4d2,_0xcc23f8){var _0x17c541={},_0x4a4623={},_0x2cd181={'count':0x0,'rows':[]};var _0x3f23d2=_['map'](db[_0x5534('0x29')][_0x5534('0x2a')],function(_0x688984){return{'name':_0x688984[_0x5534('0x2b')],'type':_0x688984[_0x5534('0x2c')][_0x5534('0x2d')]};});_0x4a4623['model']=_[_0x5534('0x2e')](_0x3f23d2,_0x5534('0x27'));_0x4a4623[_0x5534('0x2f')]=_[_0x5534('0x30')](_0x33e4d2['query']);_0x4a4623[_0x5534('0x31')]=_[_0x5534('0x32')](_0x4a4623['model'],_0x4a4623['query']);_0x17c541[_0x5534('0x33')]=_[_0x5534('0x32')](_0x4a4623[_0x5534('0x34')],qs[_0x5534('0x35')](_0x33e4d2['query'][_0x5534('0x35')]));_0x17c541[_0x5534('0x33')]=_0x17c541[_0x5534('0x33')][_0x5534('0x36')]?_0x17c541[_0x5534('0x33')]:_0x4a4623[_0x5534('0x34')];if(!_0x33e4d2[_0x5534('0x2f')][_0x5534('0x37')](_0x5534('0x38'))){_0x17c541['limit']=qs[_0x5534('0x1b')](_0x33e4d2[_0x5534('0x2f')][_0x5534('0x1b')]);_0x17c541[_0x5534('0x19')]=qs[_0x5534('0x19')](_0x33e4d2[_0x5534('0x2f')][_0x5534('0x19')]);}_0x17c541[_0x5534('0x39')]=qs[_0x5534('0x3a')](_0x33e4d2[_0x5534('0x2f')][_0x5534('0x3a')]);_0x17c541[_0x5534('0x3b')]=qs[_0x5534('0x31')](_[_0x5534('0x3c')](_0x33e4d2[_0x5534('0x2f')],_0x4a4623[_0x5534('0x31')]),_0x3f23d2);if(_0x33e4d2[_0x5534('0x2f')][_0x5534('0x3d')]){_0x17c541['where']=_[_0x5534('0x3e')](_0x17c541[_0x5534('0x3b')],{'$or':_[_0x5534('0x2e')](_0x3f23d2,function(_0x8162df){if(_0x8162df[_0x5534('0x2c')]!==_0x5534('0x3f')){var _0x157d6e={};_0x157d6e[_0x8162df[_0x5534('0x27')]]={'$like':'%'+_0x33e4d2['query']['filter']+'%'};return _0x157d6e;}})});}_0x17c541=_[_0x5534('0x3e')]({},_0x17c541,_0x33e4d2[_0x5534('0x40')]);var _0x2ec6ce={'where':_0x17c541['where']};return db[_0x5534('0x29')]['count'](_0x2ec6ce)[_0x5534('0x24')](function(_0x1df97c){_0x2cd181[_0x5534('0x1c')]=_0x1df97c;if(_0x33e4d2[_0x5534('0x2f')][_0x5534('0x41')]){_0x17c541['include']=[{'all':!![]}];}return db[_0x5534('0x29')][_0x5534('0x42')](_0x17c541);})[_0x5534('0x24')](function(_0x39d60d){_0x2cd181[_0x5534('0x43')]=_0x39d60d;return _0x2cd181;})[_0x5534('0x24')](respondWithFilteredResult(_0xcc23f8,_0x17c541))[_0x5534('0x44')](handleError(_0xcc23f8,null));};exports[_0x5534('0x45')]=function(_0xa4f590,_0x431241){var _0x1e0637={'raw':!![],'where':{'id':_0xa4f590['params']['id']}},_0x2162a4={};_0x2162a4[_0x5534('0x34')]=_[_0x5534('0x30')](db[_0x5534('0x29')][_0x5534('0x2a')]);_0x2162a4[_0x5534('0x2f')]=_[_0x5534('0x30')](_0xa4f590[_0x5534('0x2f')]);_0x2162a4['filters']=_['intersection'](_0x2162a4[_0x5534('0x34')],_0x2162a4[_0x5534('0x2f')]);_0x1e0637[_0x5534('0x33')]=_[_0x5534('0x32')](_0x2162a4[_0x5534('0x34')],qs[_0x5534('0x35')](_0xa4f590[_0x5534('0x2f')][_0x5534('0x35')]));_0x1e0637[_0x5534('0x33')]=_0x1e0637[_0x5534('0x33')][_0x5534('0x36')]?_0x1e0637['attributes']:_0x2162a4[_0x5534('0x34')];if(_0xa4f590[_0x5534('0x2f')][_0x5534('0x41')]){_0x1e0637['include']=[{'all':!![]}];}_0x1e0637=_[_0x5534('0x3e')]({},_0x1e0637,_0xa4f590[_0x5534('0x40')]);return db[_0x5534('0x29')][_0x5534('0x46')](_0x1e0637)['then'](handleEntityNotFound(_0x431241,null))[_0x5534('0x24')](respondWithResult(_0x431241,null))[_0x5534('0x44')](handleError(_0x431241,null));};exports[_0x5534('0x47')]=function(_0x37d522,_0x56114b){return db['VoiceDialReport']['create'](_0x37d522[_0x5534('0x48')],{})[_0x5534('0x24')](respondWithResult(_0x56114b,0xc9))[_0x5534('0x44')](handleError(_0x56114b,null));};exports[_0x5534('0x23')]=function(_0x1011c3,_0x3f0755){if(_0x1011c3['body']['id']){delete _0x1011c3[_0x5534('0x48')]['id'];}return db[_0x5534('0x29')][_0x5534('0x46')]({'where':{'id':_0x1011c3[_0x5534('0x49')]['id']}})[_0x5534('0x24')](handleEntityNotFound(_0x3f0755,null))['then'](saveUpdates(_0x1011c3[_0x5534('0x48')],null))[_0x5534('0x24')](respondWithResult(_0x3f0755,null))['catch'](handleError(_0x3f0755,null));};exports['destroy']=function(_0x40a15e,_0x129ab8){return db['VoiceDialReport'][_0x5534('0x46')]({'where':{'id':_0x40a15e['params']['id']}})['then'](handleEntityNotFound(_0x129ab8,null))[_0x5534('0x24')](removeEntity(_0x129ab8,null))[_0x5534('0x44')](handleError(_0x129ab8,null));};exports[_0x5534('0x4a')]=function(_0x1fd6c5,_0x859822){return db['VoiceDialReport'][_0x5534('0x4a')]()[_0x5534('0x24')](respondWithResult(_0x859822,null))[_0x5534('0x44')](handleError(_0x859822,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index f0cd3fb..f593586 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 _0x88ac=['./voiceDialReport.attributes','define','report_dial','uniqueid','lodash','api','bluebird','request-promise','path'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x88ac,0x12d));var _0xc88a=function(_0x592eaa,_0x26d920){_0x592eaa=_0x592eaa-0x0;var _0x502849=_0x88ac[_0x592eaa];return _0x502849;};'use strict';var _=require(_0xc88a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc88a('0x1'));var moment=require('moment');var BPromise=require(_0xc88a('0x2'));var rp=require(_0xc88a('0x3'));var fs=require('fs');var path=require(_0xc88a('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc88a('0x5'));module['exports']=function(_0x86cb2d,_0x47d938){return _0x86cb2d[_0xc88a('0x6')]('VoiceDialReport',attributes,{'tableName':_0xc88a('0x7'),'paranoid':![],'indexes':[{'fields':[_0xc88a('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1793=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','report_dial','uniqueid'];(function(_0x356e00,_0x278c5a){var _0x21fded=function(_0x396861){while(--_0x396861){_0x356e00['push'](_0x356e00['shift']());}};_0x21fded(++_0x278c5a);}(_0x1793,0x1ce));var _0x3179=function(_0x475a2b,_0x986995){_0x475a2b=_0x475a2b-0x0;var _0xd1b89=_0x1793[_0x475a2b];return _0xd1b89;};'use strict';var _=require(_0x3179('0x0'));var util=require(_0x3179('0x1'));var logger=require(_0x3179('0x2'))(_0x3179('0x3'));var moment=require('moment');var BPromise=require(_0x3179('0x4'));var rp=require(_0x3179('0x5'));var fs=require('fs');var path=require(_0x3179('0x6'));var rimraf=require(_0x3179('0x7'));var config=require(_0x3179('0x8'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x43ee6e,_0x2e6158){return _0x43ee6e['define']('VoiceDialReport',attributes,{'tableName':_0x3179('0x9'),'paranoid':![],'indexes':[{'fields':[_0x3179('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index b4c07f4..79b4743 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 _0x2d5d=['then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceDialReport,\x20%s,\x20%s','result','VoiceDialReport','create','body','options','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','update','where','limit','lodash','util','randomstring','ioredis','rpc','../../config/environment','client','http'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x2d5d,0xfd));var _0xd2d5=function(_0x2f458a,_0x44b0f0){_0x2f458a=_0x2f458a-0x0;var _0x56ac31=_0x2d5d[_0x2f458a];return _0x56ac31;};'use strict';var _=require(_0xd2d5('0x0'));var util=require(_0xd2d5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd2d5('0x2'));var fs=require('fs');var Redis=require(_0xd2d5('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd2d5('0x4'));var config=require(_0xd2d5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xd2d5('0x6')][_0xd2d5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe90d9f,_0x414c84,_0x24cd7c){return new BPromise(function(_0x2b041c,_0x3549d1){return client['request'](_0xe90d9f,_0x24cd7c)[_0xd2d5('0x8')](function(_0x111fe1){logger[_0xd2d5('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0x414c84,_0xd2d5('0xa'));logger[_0xd2d5('0xb')](_0xd2d5('0xc'),_0x414c84,_0xd2d5('0xa'),JSON[_0xd2d5('0xd')](_0x111fe1));if(_0x111fe1['error']){if(_0x111fe1[_0xd2d5('0xe')]['code']===0x1f4){logger[_0xd2d5('0xe')]('VoiceDialReport,\x20%s,\x20%s',_0x414c84,_0x111fe1[_0xd2d5('0xe')][_0xd2d5('0xf')]);return _0x3549d1(_0x111fe1[_0xd2d5('0xe')]['message']);}logger[_0xd2d5('0xe')](_0xd2d5('0x10'),_0x414c84,_0x111fe1[_0xd2d5('0xe')][_0xd2d5('0xf')]);return _0x2b041c(_0x111fe1[_0xd2d5('0xe')]['message']);}else{logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x414c84,'request\x20sent');_0x2b041c(_0x111fe1[_0xd2d5('0x11')]['message']);}})['catch'](function(_0xd37c03){logger[_0xd2d5('0xe')](_0xd2d5('0x10'),_0x414c84,_0xd37c03);_0x3549d1(_0xd37c03);});});}exports['CreateVoiceDialReport']=function(_0x4190ed){var _0x5c201d=this;return new Promise(function(_0x4d32bc,_0x1e1ec6){return db[_0xd2d5('0x12')][_0xd2d5('0x13')](_0x4190ed[_0xd2d5('0x14')],{'raw':_0x4190ed[_0xd2d5('0x15')]?_0x4190ed[_0xd2d5('0x15')][_0xd2d5('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x310b0b){logger[_0xd2d5('0x9')]('CreateVoiceDialReport',_0x4190ed);logger[_0xd2d5('0xb')](_0xd2d5('0x17'),_0x4190ed,JSON[_0xd2d5('0xd')](_0x310b0b));_0x4d32bc(_0x310b0b);})[_0xd2d5('0x18')](function(_0x34dab5){logger[_0xd2d5('0xe')](_0xd2d5('0x17'),_0x34dab5['message'],_0x4190ed);_0x1e1ec6(_0x5c201d[_0xd2d5('0xe')](0x1f4,_0x34dab5[_0xd2d5('0xf')]));});});};exports[_0xd2d5('0x19')]=function(_0xf8f588){var _0x5cc642=this;return new Promise(function(_0x37c0c6,_0x114522){return db[_0xd2d5('0x12')][_0xd2d5('0x1a')](_0xf8f588[_0xd2d5('0x14')],{'raw':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588['options'][_0xd2d5('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588[_0xd2d5('0x15')][_0xd2d5('0x1b')]||null:null,'attributes':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588['options']['attributes']||null:null,'limit':_0xf8f588[_0xd2d5('0x15')]?_0xf8f588[_0xd2d5('0x15')][_0xd2d5('0x1c')]||null:null})['then'](function(_0x1b2582){logger[_0xd2d5('0x9')]('UpdateVoiceDialReport',_0xf8f588);logger[_0xd2d5('0xb')](_0xd2d5('0x19'),_0xf8f588,JSON['stringify'](_0x1b2582));_0x37c0c6(_0x1b2582);})[_0xd2d5('0x18')](function(_0x2eeb2a){logger[_0xd2d5('0xe')]('UpdateVoiceDialReport',_0x2eeb2a[_0xd2d5('0xf')],_0xf8f588);_0x114522(_0x5cc642['error'](0x1f4,_0x2eeb2a[_0xd2d5('0xf')]));});});}; \ No newline at end of file +var _0xed2d=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','CreateVoiceDialReport','VoiceDialReport','create','options','raw','then','catch','UpdateVoiceDialReport','update','body','where','attributes','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed2d,0x1c5));var _0xded2=function(_0x149f64,_0x5438e4){_0x149f64=_0x149f64-0x0;var _0x5da58c=_0xed2d[_0x149f64];return _0x5da58c;};'use strict';var _=require(_0xded2('0x0'));var util=require(_0xded2('0x1'));var moment=require(_0xded2('0x2'));var BPromise=require(_0xded2('0x3'));var rs=require(_0xded2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xded2('0x5'))['db'];var utils=require(_0xded2('0x6'));var logger=require(_0xded2('0x7'))('rpc');var config=require(_0xded2('0x8'));var jayson=require(_0xded2('0x9'));var client=jayson[_0xded2('0xa')][_0xded2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9c204,_0x1d77ed,_0x370bac){return new BPromise(function(_0x2e5f8c,_0xcde73b){return client[_0xded2('0xc')](_0x9c204,_0x370bac)['then'](function(_0x109a33){logger[_0xded2('0xd')]('VoiceDialReport,\x20%s,\x20%s',_0x1d77ed,_0xded2('0xe'));logger[_0xded2('0xf')](_0xded2('0x10'),_0x1d77ed,_0xded2('0xe'),JSON[_0xded2('0x11')](_0x109a33));if(_0x109a33[_0xded2('0x12')]){if(_0x109a33['error'][_0xded2('0x13')]===0x1f4){logger[_0xded2('0x12')](_0xded2('0x14'),_0x1d77ed,_0x109a33[_0xded2('0x12')][_0xded2('0x15')]);return _0xcde73b(_0x109a33[_0xded2('0x12')][_0xded2('0x15')]);}logger['error'](_0xded2('0x14'),_0x1d77ed,_0x109a33[_0xded2('0x12')][_0xded2('0x15')]);return _0x2e5f8c(_0x109a33[_0xded2('0x12')][_0xded2('0x15')]);}else{logger[_0xded2('0xd')](_0xded2('0x14'),_0x1d77ed,'request\x20sent');_0x2e5f8c(_0x109a33[_0xded2('0x16')]['message']);}})['catch'](function(_0x4396ba){logger[_0xded2('0x12')](_0xded2('0x14'),_0x1d77ed,_0x4396ba);_0xcde73b(_0x4396ba);});});}exports[_0xded2('0x17')]=function(_0x19862e){var _0x5ce6be=this;return new Promise(function(_0x22ff5f,_0xcccba8){return db[_0xded2('0x18')][_0xded2('0x19')](_0x19862e['body'],{'raw':_0x19862e[_0xded2('0x1a')]?_0x19862e['options'][_0xded2('0x1b')]===undefined?!![]:![]:!![]})[_0xded2('0x1c')](function(_0x288bc9){logger['info'](_0xded2('0x17'),_0x19862e);logger[_0xded2('0xf')](_0xded2('0x17'),_0x19862e,JSON[_0xded2('0x11')](_0x288bc9));_0x22ff5f(_0x288bc9);})[_0xded2('0x1d')](function(_0x3b04b5){logger[_0xded2('0x12')](_0xded2('0x17'),_0x3b04b5[_0xded2('0x15')],_0x19862e);_0xcccba8(_0x5ce6be[_0xded2('0x12')](0x1f4,_0x3b04b5['message']));});});};exports[_0xded2('0x1e')]=function(_0x3dfcc6){var _0x22d94d=this;return new Promise(function(_0x22ce8d,_0x56f5f1){return db['VoiceDialReport'][_0xded2('0x1f')](_0x3dfcc6[_0xded2('0x20')],{'raw':_0x3dfcc6[_0xded2('0x1a')]?_0x3dfcc6[_0xded2('0x1a')][_0xded2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3dfcc6[_0xded2('0x1a')]?_0x3dfcc6[_0xded2('0x1a')][_0xded2('0x21')]||null:null,'attributes':_0x3dfcc6[_0xded2('0x1a')]?_0x3dfcc6[_0xded2('0x1a')][_0xded2('0x22')]||null:null,'limit':_0x3dfcc6[_0xded2('0x1a')]?_0x3dfcc6[_0xded2('0x1a')]['limit']||null:null})[_0xded2('0x1c')](function(_0x4ff955){logger[_0xded2('0xd')]('UpdateVoiceDialReport',_0x3dfcc6);logger[_0xded2('0xf')](_0xded2('0x1e'),_0x3dfcc6,JSON['stringify'](_0x4ff955));_0x22ce8d(_0x4ff955);})[_0xded2('0x1d')](function(_0x1f69f2){logger['error'](_0xded2('0x1e'),_0x1f69f2['message'],_0x3dfcc6);_0x56f5f1(_0x22d94d[_0xded2('0x12')](0x1f4,_0x1f69f2[_0xded2('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index bf48d99..80dbe5c 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 _0xa4b2=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','put','update','delete'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xa4b2,0x79));var _0x2a4b=function(_0x2f8c42,_0x2ba36d){_0x2f8c42=_0x2f8c42-0x0;var _0x500823=_0xa4b2[_0x2f8c42];return _0x500823;};'use strict';var multer=require(_0x2a4b('0x0'));var util=require(_0x2a4b('0x1'));var path=require(_0x2a4b('0x2'));var timeout=require(_0x2a4b('0x3'));var express=require(_0x2a4b('0x4'));var router=express[_0x2a4b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x2a4b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2a4b('0x7'));var controller=require(_0x2a4b('0x8'));router[_0x2a4b('0x9')]('/',auth[_0x2a4b('0xa')](),controller['index']);router[_0x2a4b('0x9')](_0x2a4b('0xb'),auth[_0x2a4b('0xa')](),controller[_0x2a4b('0xc')]);router[_0x2a4b('0xd')]('/',auth[_0x2a4b('0xa')](),controller[_0x2a4b('0xe')]);router[_0x2a4b('0xd')](_0x2a4b('0xf'),auth[_0x2a4b('0xa')](),controller['addApplications']);router[_0x2a4b('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x2a4b('0x11')]);router[_0x2a4b('0x12')](_0x2a4b('0xb'),auth[_0x2a4b('0xa')](),controller[_0x2a4b('0x13')]);module['exports']=router; \ No newline at end of file +var _0x6924=['get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller'];(function(_0x4d2a43,_0x5044a7){var _0x4eae68=function(_0x5ad3a3){while(--_0x5ad3a3){_0x4d2a43['push'](_0x4d2a43['shift']());}};_0x4eae68(++_0x5044a7);}(_0x6924,0x1c7));var _0x4692=function(_0xc49b0a,_0x66b15){_0xc49b0a=_0xc49b0a-0x0;var _0x2c36d8=_0x6924[_0xc49b0a];return _0x2c36d8;};'use strict';var multer=require(_0x4692('0x0'));var util=require(_0x4692('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4692('0x2')]();var fs_extra=require(_0x4692('0x3'));var auth=require(_0x4692('0x4'));var interaction=require(_0x4692('0x5'));var config=require('../../config/environment');var controller=require(_0x4692('0x6'));router[_0x4692('0x7')]('/',auth[_0x4692('0x8')](),controller[_0x4692('0x9')]);router[_0x4692('0x7')](_0x4692('0xa'),auth['isAuthenticated'](),controller[_0x4692('0xb')]);router[_0x4692('0xc')]('/',auth[_0x4692('0x8')](),controller[_0x4692('0xd')]);router[_0x4692('0xc')](_0x4692('0xe'),auth[_0x4692('0x8')](),controller[_0x4692('0xf')]);router[_0x4692('0x10')]('/:id',auth[_0x4692('0x8')](),controller[_0x4692('0x11')]);router[_0x4692('0x12')](_0x4692('0xa'),auth[_0x4692('0x8')](),controller[_0x4692('0x13')]);module[_0x4692('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7135c6e..01b4a09 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 _0x0713=['internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','STRING','compositeIndex','NoOp','ENUM','inbound','outbound'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(){return this['getDataValue']('exten');}}}; \ No newline at end of file +var _0x70e0=['INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0x70e0,0x17b));var _0x070e=function(_0x3e6f16,_0x20314d){_0x3e6f16=_0x3e6f16-0x0;var _0x351f0d=_0x70e0[_0x3e6f16];return _0x351f0d;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'context':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0x3')},'priority':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x070e('0x3')},'tag':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x070e('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x070e('0x5')]('inbound','outbound','internal',_0x070e('0x6'),_0x070e('0x7'),_0x070e('0x8'),_0x070e('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x070e('0x2')]},'interval':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':_0x070e('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x070e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x070e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x070e('0xc')]},'recordingFormat':{'type':Sequelize[_0x070e('0x2')],'defaultValue':_0x070e('0xd')},'answer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x070e('0xe')],'get':function(){return this[_0x070e('0xf')](_0x070e('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index fcc2bcc..75629f6 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 _0xeba1=['role','internal','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceExtension.socket','register','end','status','json','offset','undefined','limit','count','set','destroy','InboundRoutes','inbound','outbound','InternalRoutes','filter','ignore','value','includes','type','name','UserProfileResource','then','sendStatus','send','map','VoiceExtension','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','find','params','create','body','exten','concat','user','get'];(function(_0x35e6b0,_0x42a3c9){var _0x561f06=function(_0x265fda){while(--_0x265fda){_0x35e6b0['push'](_0x35e6b0['shift']());}};_0x561f06(++_0x42a3c9);}(_0xeba1,0x187));var _0x1eba=function(_0x3cc47c,_0x1e59e2){_0x3cc47c=_0x3cc47c-0x0;var _0x1fe90f=_0xeba1[_0x3cc47c];return _0x1fe90f;};'use strict';var _=require(_0x1eba('0x0'));var Redis=require(_0x1eba('0x1'));var qs=require(_0x1eba('0x2'));var logger=require(_0x1eba('0x3'))(_0x1eba('0x4'));var config=require(_0x1eba('0x5'));var db=require(_0x1eba('0x6'))['db'];config[_0x1eba('0x7')]=_[_0x1eba('0x8')](config['redis'],{'host':_0x1eba('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1eba('0x7')]));require(_0x1eba('0xa'))[_0x1eba('0xb')](socket);function respondWithStatusCode(_0x351837,_0x8fa56d){_0x8fa56d=_0x8fa56d||0xcc;return function(_0x242bfb){if(_0x242bfb){return _0x351837['sendStatus'](_0x8fa56d);}return _0x351837['status'](_0x8fa56d)[_0x1eba('0xc')]();};}function respondWithResult(_0x3660bb,_0x217dc5){_0x217dc5=_0x217dc5||0xc8;return function(_0x33bddc){if(_0x33bddc){return _0x3660bb[_0x1eba('0xd')](_0x217dc5)[_0x1eba('0xe')](_0x33bddc);}};}function respondWithFilteredResult(_0x5e4c05,_0x128cd1){return function(_0x28e29b){if(_0x28e29b){var _0x2d0dfc=typeof _0x128cd1[_0x1eba('0xf')]===_0x1eba('0x10')&&typeof _0x128cd1[_0x1eba('0x11')]===_0x1eba('0x10');var _0x366078=_0x28e29b[_0x1eba('0x12')];var _0xfd865e=_0x2d0dfc?0x0:_0x128cd1[_0x1eba('0xf')];var _0x110e8b=_0x2d0dfc?_0x28e29b[_0x1eba('0x12')]:_0x128cd1[_0x1eba('0xf')]+_0x128cd1[_0x1eba('0x11')];var _0x5cc387;if(_0x110e8b>=_0x366078){_0x110e8b=_0x366078;_0x5cc387=0xc8;}else{_0x5cc387=0xce;}_0x5e4c05['status'](_0x5cc387);return _0x5e4c05[_0x1eba('0x13')]('Content-Range',_0xfd865e+'-'+_0x110e8b+'/'+_0x366078)[_0x1eba('0xe')](_0x28e29b);}return null;};}function removeEntity(_0x22e5f4){return function(_0x2ec3c2){if(_0x2ec3c2){return _0x2ec3c2[_0x1eba('0x14')]()['then'](function(){var _0x14b411=_0x2ec3c2['get']({'plain':!![]});var _0x4fce05=[{'name':_0x1eba('0x15'),'value':_0x1eba('0x16'),'ignore':![]},{'name':'OutboundRoutes','value':_0x1eba('0x17'),'ignore':![]},{'name':_0x1eba('0x18'),'value':'internal','ignore':![]}];var _0xcf4a87=_(_0x4fce05)[_0x1eba('0x19')](_0x1eba('0x1a'))['map'](_0x1eba('0x1b'))['value']();if(_[_0x1eba('0x1c')](_0xcf4a87,_0x14b411['type'])){return;}var _0xb901c8=_['find'](_0x4fce05,['value',_0x14b411[_0x1eba('0x1d')]])[_0x1eba('0x1e')];return db[_0x1eba('0x1f')][_0x1eba('0x14')]({'where':{'type':_0xb901c8,'resourceId':_0x14b411['id']}})[_0x1eba('0x20')](function(){return _0x2ec3c2;});})[_0x1eba('0x20')](function(){_0x22e5f4['status'](0xcc)[_0x1eba('0xc')]();});}};}function handleEntityNotFound(_0x517f71){return function(_0xa58b4b){if(!_0xa58b4b){_0x517f71[_0x1eba('0x21')](0x194);}return _0xa58b4b;};}function handleError(_0x125a92,_0x5535fb){_0x5535fb=_0x5535fb||0x1f4;return function(_0x5ae886){logger['error'](_0x5ae886['stack']);if(_0x5ae886['name']){delete _0x5ae886[_0x1eba('0x1e')];}_0x125a92[_0x1eba('0xd')](_0x5535fb)[_0x1eba('0x22')](_0x5ae886);};}exports['index']=function(_0x5d9097,_0x39f0cd){var _0x82afc3={},_0x139a2f={},_0x3ffc5b={'count':0x0,'rows':[]};var _0x31c0c3=_[_0x1eba('0x23')](db[_0x1eba('0x24')][_0x1eba('0x25')],function(_0x14035d){return{'name':_0x14035d[_0x1eba('0x26')],'type':_0x14035d[_0x1eba('0x1d')][_0x1eba('0x27')]};});_0x139a2f[_0x1eba('0x28')]=_['map'](_0x31c0c3,_0x1eba('0x1e'));_0x139a2f['query']=_[_0x1eba('0x29')](_0x5d9097[_0x1eba('0x2a')]);_0x139a2f[_0x1eba('0x2b')]=_[_0x1eba('0x2c')](_0x139a2f[_0x1eba('0x28')],_0x139a2f[_0x1eba('0x2a')]);_0x82afc3['attributes']=_[_0x1eba('0x2c')](_0x139a2f['model'],qs[_0x1eba('0x2d')](_0x5d9097['query'][_0x1eba('0x2d')]));_0x82afc3['attributes']=_0x82afc3[_0x1eba('0x2e')][_0x1eba('0x2f')]?_0x82afc3[_0x1eba('0x2e')]:_0x139a2f[_0x1eba('0x28')];if(!_0x5d9097[_0x1eba('0x2a')][_0x1eba('0x30')](_0x1eba('0x31'))){_0x82afc3[_0x1eba('0x11')]=qs[_0x1eba('0x11')](_0x5d9097[_0x1eba('0x2a')]['limit']);_0x82afc3[_0x1eba('0xf')]=qs[_0x1eba('0xf')](_0x5d9097['query'][_0x1eba('0xf')]);}_0x82afc3[_0x1eba('0x32')]=qs['sort'](_0x5d9097['query']['sort']);_0x82afc3[_0x1eba('0x33')]=qs[_0x1eba('0x2b')](_[_0x1eba('0x34')](_0x5d9097[_0x1eba('0x2a')],_0x139a2f[_0x1eba('0x2b')]),_0x31c0c3);if(_0x5d9097['query'][_0x1eba('0x19')]){_0x82afc3[_0x1eba('0x33')]=_['merge'](_0x82afc3['where'],{'$or':_['map'](_0x31c0c3,function(_0x559596){if(_0x559596[_0x1eba('0x1d')]!=='VIRTUAL'){var _0x476793={};_0x476793[_0x559596['name']]={'$like':'%'+_0x5d9097[_0x1eba('0x2a')][_0x1eba('0x19')]+'%'};return _0x476793;}})});}_0x82afc3=_[_0x1eba('0x35')]({},_0x82afc3,_0x5d9097[_0x1eba('0x36')]);var _0x2f428f={'where':_0x82afc3[_0x1eba('0x33')]};return db[_0x1eba('0x24')][_0x1eba('0x12')](_0x2f428f)['then'](function(_0x594cc8){_0x3ffc5b[_0x1eba('0x12')]=_0x594cc8;if(_0x5d9097[_0x1eba('0x2a')][_0x1eba('0x37')]){_0x82afc3[_0x1eba('0x38')]=[{'all':!![]}];}return db[_0x1eba('0x24')][_0x1eba('0x39')](_0x82afc3);})[_0x1eba('0x20')](function(_0x3ee605){_0x3ffc5b[_0x1eba('0x3a')]=_0x3ee605;return _0x3ffc5b;})[_0x1eba('0x20')](respondWithFilteredResult(_0x39f0cd,_0x82afc3))[_0x1eba('0x3b')](handleError(_0x39f0cd,null));};exports[_0x1eba('0x3c')]=function(_0x2b925b,_0x5ef2b3){var _0xca8424={'raw':![],'where':{'id':_0x2b925b['params']['id']}},_0x5e6987={};_0x5e6987[_0x1eba('0x28')]=_['keys'](db[_0x1eba('0x24')]['rawAttributes']);_0x5e6987['query']=_[_0x1eba('0x29')](_0x2b925b[_0x1eba('0x2a')]);_0x5e6987[_0x1eba('0x2b')]=_[_0x1eba('0x2c')](_0x5e6987[_0x1eba('0x28')],_0x5e6987[_0x1eba('0x2a')]);_0xca8424['attributes']=_[_0x1eba('0x2c')](_0x5e6987[_0x1eba('0x28')],qs[_0x1eba('0x2d')](_0x2b925b[_0x1eba('0x2a')][_0x1eba('0x2d')]));_0xca8424['attributes']=_0xca8424[_0x1eba('0x2e')][_0x1eba('0x2f')]?_0xca8424[_0x1eba('0x2e')]:_0x5e6987[_0x1eba('0x28')];if(_0x2b925b['query'][_0x1eba('0x37')]){_0xca8424[_0x1eba('0x38')]=[{'all':!![]}];}_0xca8424=_[_0x1eba('0x35')]({},_0xca8424,_0x2b925b[_0x1eba('0x36')]);return db[_0x1eba('0x24')]['find'](_0xca8424)[_0x1eba('0x20')](handleEntityNotFound(_0x5ef2b3,null))[_0x1eba('0x20')](respondWithResult(_0x5ef2b3,null))[_0x1eba('0x3b')](handleError(_0x5ef2b3,null));};exports['destroy']=function(_0x26da94,_0xfbf3ae){return db[_0x1eba('0x24')][_0x1eba('0x3d')]({'where':{'id':_0x26da94[_0x1eba('0x3e')]['id']}})[_0x1eba('0x20')](handleEntityNotFound(_0xfbf3ae,null))[_0x1eba('0x20')](removeEntity(_0xfbf3ae,null))[_0x1eba('0x3b')](handleError(_0xfbf3ae,null));};exports[_0x1eba('0x3f')]=function(_0x27a83b,_0x318bec){if(_0x27a83b[_0x1eba('0x40')]['type']===_0x1eba('0x17')&&!_['startsWith'](_0x27a83b['body'][_0x1eba('0x41')],'_')){_0x27a83b[_0x1eba('0x40')][_0x1eba('0x41')]='_'[_0x1eba('0x42')](_0x27a83b[_0x1eba('0x40')][_0x1eba('0x41')]);}return db[_0x1eba('0x24')]['create'](_0x27a83b[_0x1eba('0x40')],{'raw':![]})[_0x1eba('0x20')](function(_0x47d3ba){var _0x3b5398=_0x27a83b[_0x1eba('0x43')][_0x1eba('0x44')]({'plain':!![]});if(!_0x3b5398)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b5398[_0x1eba('0x45')]===_0x1eba('0x43')){var _0x57a4da=_0x47d3ba[_0x1eba('0x44')]({'plain':!![]});var _0x485db9=[{'name':_0x1eba('0x15'),'value':_0x1eba('0x16')},{'name':'OutboundRoutes','value':'outbound'},{'name':_0x1eba('0x18'),'value':_0x1eba('0x46')}];var _0x345ac3=_[_0x1eba('0x3d')](_0x485db9,[_0x1eba('0x1b'),_0x57a4da['type']])[_0x1eba('0x1e')];return db['UserProfileSection'][_0x1eba('0x3d')]({'where':{'name':_0x345ac3,'userProfileId':_0x3b5398[_0x1eba('0x47')]},'raw':!![]})[_0x1eba('0x20')](function(_0x54c3f3){if(_0x54c3f3&&_0x54c3f3[_0x1eba('0x48')]===0x0){return db[_0x1eba('0x1f')]['create']({'name':_0x57a4da[_0x1eba('0x1e')],'resourceId':_0x57a4da['id'],'type':_0x54c3f3[_0x1eba('0x1e')],'sectionId':_0x54c3f3['id']},{})['then'](function(){return _0x47d3ba;});}else{return _0x47d3ba;}})[_0x1eba('0x3b')](function(_0x2073d1){logger[_0x1eba('0x49')](_0x1eba('0x4a'),_0x2073d1);throw _0x2073d1;});}return _0x47d3ba;})[_0x1eba('0x20')](respondWithResult(_0x318bec,0xc9))['catch'](handleError(_0x318bec,null));};exports[_0x1eba('0x4b')]=function(_0x29e87f,_0x30ab35){if(_0x29e87f[_0x1eba('0x40')]['id']){delete _0x29e87f[_0x1eba('0x40')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x29e87f[_0x1eba('0x3e')]['id']}})['then'](handleEntityNotFound(_0x30ab35,null))[_0x1eba('0x20')](function(_0x4cafe1){if(_0x4cafe1){return db['VoiceExtension'][_0x1eba('0x4b')](_[_0x1eba('0x34')](_0x29e87f[_0x1eba('0x40')],[_0x1eba('0x41'),_0x1eba('0x4c'),_0x1eba('0x4d'),'recordingFormat','cutdigits','mandatoryDisposition',_0x1eba('0x4e')]),{'where':{'context':_0x4cafe1['context'],'exten':_0x4cafe1[_0x1eba('0x41')]},'individualHooks':!![]})['then'](function(_0x514222){return _0x514222;});}return null;})[_0x1eba('0x20')](respondWithStatusCode(_0x30ab35,null))[_0x1eba('0x3b')](handleError(_0x30ab35,null));};exports[_0x1eba('0x4f')]=function(_0x2827eb,_0x2ffcad){var _0x5e08b4=_0x2827eb[_0x1eba('0x3e')]['id'];var _0x7899b3=_0x2827eb[_0x1eba('0x40')];var _0x46cbd5=0xc8;var _0x1dbd86=null;return db[_0x1eba('0x50')][_0x1eba('0x51')]({'isolationLevel':db['sequelize'][_0x1eba('0x52')][_0x1eba('0x53')][_0x1eba('0x54')]},function(_0x624e44){return db[_0x1eba('0x24')][_0x1eba('0x55')]({'where':{'id':_0x5e08b4},'transaction':_0x624e44})[_0x1eba('0x20')](function(_0x53f323){if(_0x53f323){return db[_0x1eba('0x24')][_0x1eba('0x14')]({'where':{'VoiceExtensionId':_0x5e08b4},'transaction':_0x624e44})['then'](function(){var _0x42c117=_[_0x1eba('0x23')](_0x7899b3,function(_0x3002ac){_0x3002ac['VoiceExtensionId']=_0x5e08b4;_0x3002ac[_0x1eba('0x56')]=!![];return _0x3002ac;});return _0x53f323['createRouting'](_0x42c117);})['then'](function(_0x370dc){return db['VoiceExtension'][_0x1eba('0x57')](_0x370dc,{'transaction':_0x624e44});});}else{_0x46cbd5=0x194;_0x1dbd86=[];}});})['then'](function(){if(_0x46cbd5!==0x194){return db[_0x1eba('0x24')][_0x1eba('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5e08b4},'order':_0x1eba('0x59')})[_0x1eba('0x20')](function(_0x21a68a){_0x1dbd86=_0x21a68a;});}})[_0x1eba('0x3b')](function(_0x54c38e){_0x46cbd5=0x1f4;logger[_0x1eba('0x49')](_0x54c38e[_0x1eba('0x5a')]);if(_0x54c38e[_0x1eba('0x1e')]){delete _0x54c38e[_0x1eba('0x1e')];}_0x1dbd86=_0x54c38e;})[_0x1eba('0x5b')](function(){if(_0x1dbd86===null){_0x2ffcad[_0x1eba('0x21')](_0x46cbd5);}else{if(_0x46cbd5===0x1f4){_0x2ffcad[_0x1eba('0xd')](_0x46cbd5)[_0x1eba('0x22')](_0x1dbd86);}else{_0x2ffcad[_0x1eba('0xd')](_0x46cbd5)['json'](_0x1dbd86);}}});}; \ No newline at end of file +var _0x19a7=['end','error','stack','send','index','rawAttributes','fieldName','key','model','keys','filters','attributes','intersection','query','fields','hasOwnProperty','sort','where','options','VoiceExtension','includeAll','include','show','length','merge','find','catch','params','create','body','startsWith','exten','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','Transaction','ISOLATION_LEVELS','findOne','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','sendStatus','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','destroy','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','includes','type','name','UserProfileResource','then'];(function(_0x1cccea,_0x27acc2){var _0x571972=function(_0x59328b){while(--_0x59328b){_0x1cccea['push'](_0x1cccea['shift']());}};_0x571972(++_0x27acc2);}(_0x19a7,0x95));var _0x719a=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x19a7[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x719a('0x0'));var Redis=require(_0x719a('0x1'));var qs=require(_0x719a('0x2'));var logger=require(_0x719a('0x3'))(_0x719a('0x4'));var config=require(_0x719a('0x5'));var db=require(_0x719a('0x6'))['db'];config[_0x719a('0x7')]=_['defaults'](config[_0x719a('0x7')],{'host':_0x719a('0x8'),'port':0x18eb});var socket=require(_0x719a('0x9'))(new Redis(config['redis']));require(_0x719a('0xa'))[_0x719a('0xb')](socket);function respondWithStatusCode(_0x3f2554,_0xb64b58){_0xb64b58=_0xb64b58||0xcc;return function(_0x46ec68){if(_0x46ec68){return _0x3f2554['sendStatus'](_0xb64b58);}return _0x3f2554[_0x719a('0xc')](_0xb64b58)['end']();};}function respondWithResult(_0x22ced4,_0x5086fc){_0x5086fc=_0x5086fc||0xc8;return function(_0x54be80){if(_0x54be80){return _0x22ced4[_0x719a('0xc')](_0x5086fc)[_0x719a('0xd')](_0x54be80);}};}function respondWithFilteredResult(_0x841fdc,_0x29444f){return function(_0xf6601c){if(_0xf6601c){var _0x30d2f0=typeof _0x29444f[_0x719a('0xe')]===_0x719a('0xf')&&typeof _0x29444f[_0x719a('0x10')]==='undefined';var _0x30f128=_0xf6601c[_0x719a('0x11')];var _0xc401d8=_0x30d2f0?0x0:_0x29444f[_0x719a('0xe')];var _0x5ee167=_0x30d2f0?_0xf6601c[_0x719a('0x11')]:_0x29444f['offset']+_0x29444f[_0x719a('0x10')];var _0x43ca7a;if(_0x5ee167>=_0x30f128){_0x5ee167=_0x30f128;_0x43ca7a=0xc8;}else{_0x43ca7a=0xce;}_0x841fdc['status'](_0x43ca7a);return _0x841fdc[_0x719a('0x12')](_0x719a('0x13'),_0xc401d8+'-'+_0x5ee167+'/'+_0x30f128)[_0x719a('0xd')](_0xf6601c);}return null;};}function removeEntity(_0x46f5b8){return function(_0x39312b){if(_0x39312b){return _0x39312b[_0x719a('0x14')]()['then'](function(){var _0x4db9f8=_0x39312b['get']({'plain':!![]});var _0x2cf6e7=[{'name':_0x719a('0x15'),'value':_0x719a('0x16'),'ignore':![]},{'name':_0x719a('0x17'),'value':_0x719a('0x18'),'ignore':![]},{'name':_0x719a('0x19'),'value':_0x719a('0x1a'),'ignore':![]}];var _0x114058=_(_0x2cf6e7)[_0x719a('0x1b')]('ignore')[_0x719a('0x1c')](_0x719a('0x1d'))[_0x719a('0x1d')]();if(_[_0x719a('0x1e')](_0x114058,_0x4db9f8[_0x719a('0x1f')])){return;}var _0x112229=_['find'](_0x2cf6e7,[_0x719a('0x1d'),_0x4db9f8[_0x719a('0x1f')]])[_0x719a('0x20')];return db[_0x719a('0x21')][_0x719a('0x14')]({'where':{'type':_0x112229,'resourceId':_0x4db9f8['id']}})[_0x719a('0x22')](function(){return _0x39312b;});})['then'](function(){_0x46f5b8[_0x719a('0xc')](0xcc)[_0x719a('0x23')]();});}};}function handleEntityNotFound(_0x538dde){return function(_0x4527cf){if(!_0x4527cf){_0x538dde['sendStatus'](0x194);}return _0x4527cf;};}function handleError(_0x5eb8b4,_0x3b4b1b){_0x3b4b1b=_0x3b4b1b||0x1f4;return function(_0x352aad){logger[_0x719a('0x24')](_0x352aad[_0x719a('0x25')]);if(_0x352aad[_0x719a('0x20')]){delete _0x352aad['name'];}_0x5eb8b4[_0x719a('0xc')](_0x3b4b1b)[_0x719a('0x26')](_0x352aad);};}exports[_0x719a('0x27')]=function(_0x598e36,_0x461ab0){var _0x3b99fc={},_0x3b3ee2={},_0xbd41f3={'count':0x0,'rows':[]};var _0x4c8225=_['map'](db['VoiceExtension'][_0x719a('0x28')],function(_0x37ec2c){return{'name':_0x37ec2c[_0x719a('0x29')],'type':_0x37ec2c[_0x719a('0x1f')][_0x719a('0x2a')]};});_0x3b3ee2[_0x719a('0x2b')]=_['map'](_0x4c8225,_0x719a('0x20'));_0x3b3ee2['query']=_[_0x719a('0x2c')](_0x598e36['query']);_0x3b3ee2[_0x719a('0x2d')]=_['intersection'](_0x3b3ee2['model'],_0x3b3ee2['query']);_0x3b99fc[_0x719a('0x2e')]=_[_0x719a('0x2f')](_0x3b3ee2[_0x719a('0x2b')],qs['fields'](_0x598e36[_0x719a('0x30')][_0x719a('0x31')]));_0x3b99fc['attributes']=_0x3b99fc['attributes']['length']?_0x3b99fc[_0x719a('0x2e')]:_0x3b3ee2[_0x719a('0x2b')];if(!_0x598e36[_0x719a('0x30')][_0x719a('0x32')]('nolimit')){_0x3b99fc[_0x719a('0x10')]=qs['limit'](_0x598e36[_0x719a('0x30')][_0x719a('0x10')]);_0x3b99fc[_0x719a('0xe')]=qs[_0x719a('0xe')](_0x598e36[_0x719a('0x30')]['offset']);}_0x3b99fc['order']=qs[_0x719a('0x33')](_0x598e36[_0x719a('0x30')][_0x719a('0x33')]);_0x3b99fc[_0x719a('0x34')]=qs['filters'](_['pick'](_0x598e36['query'],_0x3b3ee2[_0x719a('0x2d')]),_0x4c8225);if(_0x598e36['query'][_0x719a('0x1b')]){_0x3b99fc[_0x719a('0x34')]=_['merge'](_0x3b99fc[_0x719a('0x34')],{'$or':_['map'](_0x4c8225,function(_0x52235e){if(_0x52235e[_0x719a('0x1f')]!=='VIRTUAL'){var _0x480ed1={};_0x480ed1[_0x52235e['name']]={'$like':'%'+_0x598e36[_0x719a('0x30')][_0x719a('0x1b')]+'%'};return _0x480ed1;}})});}_0x3b99fc=_['merge']({},_0x3b99fc,_0x598e36[_0x719a('0x35')]);var _0x4584e1={'where':_0x3b99fc['where']};return db[_0x719a('0x36')][_0x719a('0x11')](_0x4584e1)[_0x719a('0x22')](function(_0x2b6118){_0xbd41f3[_0x719a('0x11')]=_0x2b6118;if(_0x598e36[_0x719a('0x30')][_0x719a('0x37')]){_0x3b99fc[_0x719a('0x38')]=[{'all':!![]}];}return db[_0x719a('0x36')]['findAll'](_0x3b99fc);})[_0x719a('0x22')](function(_0x215ef3){_0xbd41f3['rows']=_0x215ef3;return _0xbd41f3;})[_0x719a('0x22')](respondWithFilteredResult(_0x461ab0,_0x3b99fc))['catch'](handleError(_0x461ab0,null));};exports[_0x719a('0x39')]=function(_0x42b43a,_0x454714){var _0x3c1ddd={'raw':![],'where':{'id':_0x42b43a['params']['id']}},_0x2559e2={};_0x2559e2[_0x719a('0x2b')]=_[_0x719a('0x2c')](db['VoiceExtension'][_0x719a('0x28')]);_0x2559e2[_0x719a('0x30')]=_[_0x719a('0x2c')](_0x42b43a['query']);_0x2559e2[_0x719a('0x2d')]=_[_0x719a('0x2f')](_0x2559e2[_0x719a('0x2b')],_0x2559e2[_0x719a('0x30')]);_0x3c1ddd[_0x719a('0x2e')]=_['intersection'](_0x2559e2['model'],qs[_0x719a('0x31')](_0x42b43a[_0x719a('0x30')][_0x719a('0x31')]));_0x3c1ddd[_0x719a('0x2e')]=_0x3c1ddd[_0x719a('0x2e')][_0x719a('0x3a')]?_0x3c1ddd['attributes']:_0x2559e2['model'];if(_0x42b43a[_0x719a('0x30')][_0x719a('0x37')]){_0x3c1ddd[_0x719a('0x38')]=[{'all':!![]}];}_0x3c1ddd=_[_0x719a('0x3b')]({},_0x3c1ddd,_0x42b43a[_0x719a('0x35')]);return db[_0x719a('0x36')][_0x719a('0x3c')](_0x3c1ddd)[_0x719a('0x22')](handleEntityNotFound(_0x454714,null))[_0x719a('0x22')](respondWithResult(_0x454714,null))[_0x719a('0x3d')](handleError(_0x454714,null));};exports[_0x719a('0x14')]=function(_0x3f1e0c,_0x1f8c17){return db[_0x719a('0x36')][_0x719a('0x3c')]({'where':{'id':_0x3f1e0c[_0x719a('0x3e')]['id']}})[_0x719a('0x22')](handleEntityNotFound(_0x1f8c17,null))['then'](removeEntity(_0x1f8c17,null))[_0x719a('0x3d')](handleError(_0x1f8c17,null));};exports[_0x719a('0x3f')]=function(_0x485416,_0x29a9fa){if(_0x485416[_0x719a('0x40')]['type']===_0x719a('0x18')&&!_[_0x719a('0x41')](_0x485416['body'][_0x719a('0x42')],'_')){_0x485416[_0x719a('0x40')]['exten']='_'['concat'](_0x485416[_0x719a('0x40')][_0x719a('0x42')]);}return db[_0x719a('0x36')]['create'](_0x485416[_0x719a('0x40')],{'raw':![]})[_0x719a('0x22')](function(_0xccf97d){var _0x12697e=_0x485416['user']['get']({'plain':!![]});if(!_0x12697e)throw new Error(_0x719a('0x43'));if(_0x12697e[_0x719a('0x44')]==='user'){var _0x34a45b=_0xccf97d[_0x719a('0x45')]({'plain':!![]});var _0x4f2020=[{'name':_0x719a('0x15'),'value':'inbound'},{'name':'OutboundRoutes','value':_0x719a('0x18')},{'name':_0x719a('0x19'),'value':'internal'}];var _0x40cd58=_[_0x719a('0x3c')](_0x4f2020,['value',_0x34a45b[_0x719a('0x1f')]])[_0x719a('0x20')];return db[_0x719a('0x46')][_0x719a('0x3c')]({'where':{'name':_0x40cd58,'userProfileId':_0x12697e['userProfileId']},'raw':!![]})[_0x719a('0x22')](function(_0x3d50b3){if(_0x3d50b3&&_0x3d50b3[_0x719a('0x47')]===0x0){return db[_0x719a('0x21')][_0x719a('0x3f')]({'name':_0x34a45b[_0x719a('0x20')],'resourceId':_0x34a45b['id'],'type':_0x3d50b3['name'],'sectionId':_0x3d50b3['id']},{})[_0x719a('0x22')](function(){return _0xccf97d;});}else{return _0xccf97d;}})[_0x719a('0x3d')](function(_0x85a905){logger[_0x719a('0x24')](_0x719a('0x48'),_0x85a905);throw _0x85a905;});}return _0xccf97d;})[_0x719a('0x22')](respondWithResult(_0x29a9fa,0xc9))[_0x719a('0x3d')](handleError(_0x29a9fa,null));};exports['update']=function(_0x520ec1,_0x54bb7f){if(_0x520ec1['body']['id']){delete _0x520ec1['body']['id'];}return db[_0x719a('0x36')][_0x719a('0x3c')]({'where':{'id':_0x520ec1[_0x719a('0x3e')]['id']}})[_0x719a('0x22')](handleEntityNotFound(_0x54bb7f,null))[_0x719a('0x22')](function(_0x376e9c){if(_0x376e9c){return db[_0x719a('0x36')][_0x719a('0x49')](_[_0x719a('0x4a')](_0x520ec1[_0x719a('0x40')],[_0x719a('0x42'),_0x719a('0x4b'),_0x719a('0x4c'),'recordingFormat',_0x719a('0x4d'),_0x719a('0x4e'),_0x719a('0x4f')]),{'where':{'context':_0x376e9c[_0x719a('0x4b')],'exten':_0x376e9c[_0x719a('0x42')]},'individualHooks':!![]})[_0x719a('0x22')](function(_0x530b0e){return _0x530b0e;});}return null;})[_0x719a('0x22')](respondWithStatusCode(_0x54bb7f,null))[_0x719a('0x3d')](handleError(_0x54bb7f,null));};exports[_0x719a('0x50')]=function(_0x5491d5,_0x518741){var _0xc20eaf=_0x5491d5[_0x719a('0x3e')]['id'];var _0x31e5b0=_0x5491d5['body'];var _0x139479=0xc8;var _0x15aae4=null;return db[_0x719a('0x51')]['transaction']({'isolationLevel':db[_0x719a('0x51')][_0x719a('0x52')][_0x719a('0x53')]['READ_COMMITTED']},function(_0x16a6d5){return db[_0x719a('0x36')][_0x719a('0x54')]({'where':{'id':_0xc20eaf},'transaction':_0x16a6d5})[_0x719a('0x22')](function(_0x199e21){if(_0x199e21){return db[_0x719a('0x36')]['destroy']({'where':{'VoiceExtensionId':_0xc20eaf},'transaction':_0x16a6d5})[_0x719a('0x22')](function(){var _0x313b4b=_[_0x719a('0x1c')](_0x31e5b0,function(_0x48c4d4){_0x48c4d4['VoiceExtensionId']=_0xc20eaf;_0x48c4d4[_0x719a('0x55')]=!![];return _0x48c4d4;});return _0x199e21[_0x719a('0x56')](_0x313b4b);})[_0x719a('0x22')](function(_0x342a47){return db['VoiceExtension'][_0x719a('0x57')](_0x342a47,{'transaction':_0x16a6d5});});}else{_0x139479=0x194;_0x15aae4=[];}});})[_0x719a('0x22')](function(){if(_0x139479!==0x194){return db[_0x719a('0x36')][_0x719a('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0xc20eaf},'order':_0x719a('0x59')})['then'](function(_0x2a4eb7){_0x15aae4=_0x2a4eb7;});}})[_0x719a('0x3d')](function(_0x3e57f6){_0x139479=0x1f4;logger['error'](_0x3e57f6[_0x719a('0x25')]);if(_0x3e57f6[_0x719a('0x20')]){delete _0x3e57f6[_0x719a('0x20')];}_0x15aae4=_0x3e57f6;})[_0x719a('0x5a')](function(){if(_0x15aae4===null){_0x518741[_0x719a('0x5b')](_0x139479);}else{if(_0x139479===0x1f4){_0x518741[_0x719a('0xc')](_0x139479)[_0x719a('0x26')](_0x15aae4);}else{_0x518741[_0x719a('0xc')](_0x139479)['json'](_0x15aae4);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index f35dc78..c09e6ea 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 _0xfd79=['../../mysqldb','VoiceExtension','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4da0e8,_0xe9995){var _0x579a56=function(_0x1e1f8c){while(--_0x1e1f8c){_0x4da0e8['push'](_0x4da0e8['shift']());}};_0x579a56(++_0xe9995);}(_0xfd79,0x15d));var _0x9fd7=function(_0x3b28cd,_0x3c89df){_0x3b28cd=_0x3b28cd-0x0;var _0x492596=_0xfd79[_0x3b28cd];return _0x492596;};'use strict';var EventEmitter=require(_0x9fd7('0x0'));var VoiceExtension=require(_0x9fd7('0x1'))['db'][_0x9fd7('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x9fd7('0x3')](0x0);var events={'afterCreate':_0x9fd7('0x4'),'afterUpdate':_0x9fd7('0x5'),'afterDestroy':_0x9fd7('0x6')};function emitEvent(_0x1167e7){return function(_0x4af09f,_0x382d86,_0x5a0792){VoiceExtensionEvents[_0x9fd7('0x7')](_0x1167e7+':'+_0x4af09f['id'],_0x4af09f);VoiceExtensionEvents[_0x9fd7('0x7')](_0x1167e7,_0x4af09f);_0x5a0792(null);};}for(var e in events){if(events[_0x9fd7('0x8')](e)){var event=events[e];VoiceExtension[_0x9fd7('0x9')](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x24d3=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','update','remove'];(function(_0x2c1ebd,_0x55bfd8){var _0xdcddfd=function(_0x3d2d01){while(--_0x3d2d01){_0x2c1ebd['push'](_0x2c1ebd['shift']());}};_0xdcddfd(++_0x55bfd8);}(_0x24d3,0xe0));var _0x324d=function(_0x20b626,_0x3e02f4){_0x20b626=_0x20b626-0x0;var _0x21d0e0=_0x24d3[_0x20b626];return _0x21d0e0;};'use strict';var EventEmitter=require(_0x324d('0x0'));var VoiceExtension=require(_0x324d('0x1'))['db'][_0x324d('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x324d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x324d('0x4'),'afterDestroy':_0x324d('0x5')};function emitEvent(_0x5a2dc4){return function(_0x44cfa9,_0x53321d,_0x153eca){VoiceExtensionEvents[_0x324d('0x6')](_0x5a2dc4+':'+_0x44cfa9['id'],_0x44cfa9);VoiceExtensionEvents[_0x324d('0x6')](_0x5a2dc4,_0x44cfa9);_0x153eca(null);};}for(var e in events){if(events[_0x324d('0x7')](e)){var event=events[e];VoiceExtension[_0x324d('0x8')](e,emitEvent(event));}}module[_0x324d('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 29261e1..8e77d4b 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 _0xe52c=['last','catch','define','VoiceExtension','voice_extensions','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','trunk','options','url','split','param','prefix','phone','SIP','join','indexOf','U(xcally-mixmonitor-context)','Interval','findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','queue','playback','custom','answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','appType','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority'];(function(_0x59d954,_0x2b0247){var _0x4041eb=function(_0x12defc){while(--_0x12defc){_0x59d954['push'](_0x59d954['shift']());}};_0x4041eb(++_0x2b0247);}(_0xe52c,0x97));var _0xce52=function(_0x46f463,_0x4602af){_0x46f463=_0x46f463-0x0;var _0xebdcf6=_0xe52c[_0x46f463];return _0xebdcf6;};'use strict';var _=require(_0xce52('0x0'));var attributes=require(_0xce52('0x1'));module[_0xce52('0x2')]=function(_0x1b87c4){var _0x4e68fb=_0x1b87c4[_0xce52('0x3')];function _0x2ec08f(_0x25d67d){var _0x5075b5=0x2;var _0x13e0fb=[{'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':_0xce52('0x6')+_0x25d67d['type'],'context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']}];if(_0x25d67d[_0xce52('0x4')]===_0xce52('0x9')){_0x13e0fb[_0xce52('0xa')]({'type':_0xce52('0x9'),'app':'Set','appdata':'CDR(routeid)='+_0x25d67d['id'],'context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']});}_0x13e0fb[_0xce52('0xa')]({'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']},{'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':_0xce52('0xb'),'context':_0x25d67d['context'],'exten':_0x25d67d['exten'],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']},{'type':_0x25d67d[_0xce52('0x4')],'app':_0xce52('0x5'),'appdata':_0xce52('0xc'),'context':_0x25d67d[_0xce52('0x7')],'exten':_0x25d67d[_0xce52('0x8')],'priority':_0x5075b5++,'VoiceExtensionId':_0x25d67d['id']});return _0x13e0fb;}function _0x5723e8(_0x2a4e88){var _0x5b992a=0x2;var _0x3f1399=[{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0xe'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':'CDR(destination)='+(_0x2a4e88[_0xce52('0xf')]?_0xce52('0x10')+_0x2a4e88[_0xce52('0xf')]+'}':_0xce52('0x11')),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88['exten'],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x12')+_0x2a4e88['id'],'context':_0x2a4e88['context'],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x13'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5b992a+0x2)+_0xce52('0x14')+(_0x5b992a+0x1)+')','context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0x2a4e88['cutdigits']?'CDR(prefix)=${EXTEN:0:'+_0x2a4e88[_0xce52('0xf')]+'}':_0xce52('0x15'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x16'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0xb'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':'Set','appdata':'outboundrouteid='+_0x2a4e88['id'],'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']}];if(_0x2a4e88[_0xce52('0x17')](_0xce52('0x18'))&&_0x2a4e88[_0xce52('0x18')]!==_0xce52('0x19')){_0x3f1399[_0xce52('0xa')]({'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x1a'),'context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']},{'type':_0xce52('0xd'),'app':_0xce52('0x5'),'appdata':_0xce52('0x1b')+_0x2a4e88[_0xce52('0x18')]||'wav','context':_0x2a4e88[_0xce52('0x7')],'exten':_0x2a4e88[_0xce52('0x8')],'priority':_0x5b992a++,'VoiceExtensionId':_0x2a4e88['id']});}return _0x3f1399;}function _0x851d46(_0x1ce077,_0x80029d){var _0xb58495=[{'name':_0xce52('0x1c'),'param':0x0},{'name':'timeout','param':0x1},{'name':_0xce52('0x1d'),'param':0x2},{'name':_0xce52('0x1e'),'param':0x3}];var _0x4b88a4={};var _0xbdb912=_0x80029d['split'](',');var _0x259e36=[];for(var _0x5ce1a2=0x0;_0x5ce1a2<_0xb58495['length'];_0x5ce1a2++){switch(_0xb58495[_0x5ce1a2]['name']){case _0xce52('0x1c'):_0x4b88a4['trunk']=_0xbdb912[_0xb58495[_0x5ce1a2]['param']][_0xce52('0x1f')]('/')[0x1];_0x4b88a4['phone']=_0xbdb912[_0xb58495[_0x5ce1a2][_0xce52('0x20')]][_0xce52('0x1f')]('/')[0x2];_0x4b88a4[_0xce52('0x21')]=_0x4b88a4[_0xce52('0x22')]?_0x4b88a4[_0xce52('0x22')][_0xce52('0x1f')]('$')[0x0]:undefined;_0x4b88a4['phone']=_0x1ce077['cutdigits']?(_0x4b88a4[_0xce52('0x21')]||'')+_0xce52('0x10')+_0x1ce077[_0xce52('0xf')]+'}':(_0x4b88a4['prefix']||'')+'${EXTEN}';_0x259e36[_0xb58495[_0x5ce1a2][_0xce52('0x20')]]=[_0xce52('0x23'),_0x4b88a4['trunk'],_0x4b88a4['phone']][_0xce52('0x24')]('/');break;case _0xce52('0x1d'):_0x4b88a4[_0xce52('0x1d')]=_0xbdb912[_0xb58495[_0x5ce1a2][_0xce52('0x20')]];if(_0x1ce077[_0xce52('0x18')]!==_0xce52('0x19')){if(_0x4b88a4[_0xce52('0x1d')][_0xce52('0x25')](_0xce52('0x26'))<0x0){_0x4b88a4[_0xce52('0x1d')]+=_0xce52('0x26');}}else{_0x4b88a4[_0xce52('0x1d')]=_0x4b88a4[_0xce52('0x1d')]['replace'](_0xce52('0x26'),'');}_0x259e36[_0xb58495[_0x5ce1a2][_0xce52('0x20')]]=_0x4b88a4['options'];break;default:_0x259e36[_0xb58495[_0x5ce1a2][_0xce52('0x20')]]=_0xbdb912[_0xb58495[_0x5ce1a2]['param']];}}return _0x259e36[_0xce52('0x24')](',');}function _0x58c0b3(_0xefab5e,_0x9e9b42,_0x332565){return new Promise(function(_0x5c9f36,_0x275122){var _0x9caa0=[];if(_['isEmpty'](_0x9e9b42))return _0x5c9f36(_0x9caa0);_0x4e68fb[_0xce52('0x27')][_0xce52('0x28')]({'attributes':['id',_0xce52('0x29'),_0xce52('0x2a')],'raw':!![]})[_0xce52('0x2b')](function(_0x48e03a){for(var _0x5627ed=0x0,_0x557926=0x0;_0x5627ed<_0x9e9b42[_0xce52('0x2c')];_0x5627ed++,_0x557926=0x0){var _0x20bb69=_0x9e9b42[_0x5627ed];var _0xa057d=[];var _0x19a75a=[];delete _0x20bb69['id'];if(_0x20bb69[_0xce52('0x29')]!==_0xce52('0x2d')){_0x20bb69[_0xce52('0x2e')]=[_0x20bb69[_0xce52('0x29')]];}else{_0x20bb69[_0xce52('0x2e')]=_0x20bb69['IntervalId']?_[_0xce52('0x2f')](_['filter'](_0x48e03a,{'IntervalId':_0x20bb69[_0xce52('0x2a')]}),_0xce52('0x29')):[];}_0x20bb69[_0xce52('0x7')]=_0xefab5e[_0xce52('0x7')];_0x20bb69[_0xce52('0x8')]=_0xefab5e['exten'];if(_0x20bb69[_0xce52('0x4')])_0x20bb69[_0xce52('0x4')]=_0x20bb69[_0xce52('0x4')][_0xce52('0x30')]();if(_0xefab5e['type']===_0xce52('0xd')){if(_0x20bb69['hasOwnProperty']('tag')&&_0x20bb69['tag']&&_0x20bb69[_0xce52('0x31')]!=='--'){_0xa057d['push']({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':'CDR(tag)='+_0x20bb69[_0xce52('0x31')],'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69[_0xce52('0x2e')]['length']+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':'ExecIf','appdata':_0xce52('0x32')+(_0x20bb69[_0xce52('0x33')]?_0xce52('0x34')+_0x20bb69[_0xce52('0x33')]+')':_0xce52('0x35')),'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69['intervals'][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}else{if(_0x20bb69['hasOwnProperty']('answer')){if([_0xce52('0x36'),_0xce52('0x37')]['includes'](_0x20bb69['app']['toLowerCase']())&&_0x20bb69['appType']!==_0xce52('0x38')){if(_0x20bb69[_0xce52('0x39')]){_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x13'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e['exten'],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':_0xce52('0x3a'),'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e['exten'],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}else{_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')]['toLowerCase'](),'app':_0xce52('0x13'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e['exten'],'priority':_0x20bb69[_0xce52('0x2e')]['length']+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});_0xa057d[_0xce52('0xa')]({'type':_0x20bb69[_0xce52('0x4')][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':_0xce52('0x3b'),'context':_0xefab5e[_0xce52('0x7')],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}}}}for(var _0x8870bd=0x0;_0x8870bd<_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')];_0x8870bd++){var _0x1f8357=_0x332565+_0x20bb69['intervals']['length'];var _0x5ba8c6=_0x8870bd===_0x20bb69[_0xce52('0x2e')]['length']-0x1?_0x332565+_0xa057d[_0xce52('0x2c')]+_0x19a75a[_0xce52('0x2c')]+0x2:_0x332565+_0x8870bd+0x1;_0xa057d[_0xce52('0x3c')](_0x8870bd,0x0,{'type':_0xefab5e[_0xce52('0x4')],'app':'GotoIfTime','appdata':_0x20bb69[_0xce52('0x2e')][_0x8870bd]+'?'+_0xefab5e['context']+_0xce52('0x3d')+_0x1f8357+':'+_0xefab5e[_0xce52('0x7')]+_0xce52('0x3d')+_0x5ba8c6,'exten':_0xefab5e[_0xce52('0x8')],'context':_0xefab5e[_0xce52('0x7')],'priority':_0x332565+_0x8870bd,'VoiceExtensionId':_0xefab5e['id']});}if(_0x20bb69[_0xce52('0x3e')]===_0xce52('0x3f')){_0x20bb69[_0xce52('0x40')]=_0x851d46(_0xefab5e,_0x20bb69['appdata']);}if(_0x20bb69[_0xce52('0x3e')]===_0xce52('0x41')){_0xa057d[_0xce52('0xa')]({'type':_0x20bb69['type'][_0xce52('0x30')](),'app':_0xce52('0x5'),'appdata':_0xce52('0x42'),'context':_0xefab5e['context'],'exten':_0xefab5e[_0xce52('0x8')],'priority':_0x20bb69[_0xce52('0x2e')][_0xce52('0x2c')]+_0x332565+_0x557926++,'VoiceExtensionId':_0xefab5e['id']});}_0x20bb69[_0xce52('0x43')]=_0xa057d[_0xce52('0x2c')]?_[_0xce52('0x44')](_0xa057d)[_0xce52('0x43')]+0x1:_0x332565;_0x9caa0=_['concat'](_0x9caa0,_0xa057d,[_0x20bb69],_0x19a75a);_0x332565=_[_0xce52('0x44')](_0x9caa0)['priority']+0x1;}return _0x5c9f36(_0x9caa0);})[_0xce52('0x45')](function(_0x2d03b8){_0x275122(_0x2d03b8);});});}return _0x1b87c4[_0xce52('0x46')](_0xce52('0x47'),attributes,{'tableName':_0xce52('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x194ff2){var _0x2d3ded=this['get']({'plain':!![]});var _0x418e96=_0x2d3ded['type']===_0xce52('0xd')?_0x5723e8(_0x2d3ded):_0x2ec08f(_0x2d3ded);return _0x58c0b3(_0x2d3ded,_0x194ff2,_[_0xce52('0x44')](_0x418e96)[_0xce52('0x43')]+0x1)[_0xce52('0x2b')](function(_0x3db110){var _0x2339a5=_['concat'](_0x418e96,_0x3db110);_0x2339a5[_0xce52('0xa')]({'type':_0x2d3ded[_0xce52('0x4')],'app':'Hangup','exten':_0x2d3ded[_0xce52('0x8')],'context':_0x2d3ded['context'],'priority':_[_0xce52('0x44')](_0x2339a5)[_0xce52('0x43')]+0x1,'VoiceExtensionId':_0x2d3ded['id']});return _0x2339a5;});}}});}; \ No newline at end of file +var _0x6ed9=['phone','prefix','split','${EXTEN}','join','U(xcally-mixmonitor-context)','replace','isEmpty','findAll','interval','then','IntervalId','map','toLowerCase','tag','CDR(tag)=','intervals','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','GotoIfTime',',${EXTEN},','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','VoiceExtension','voice_extensions','get','Hangup','exports','models','type','Set','CDR(type)=','context','exten','push','inbound','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','cutdigits','CDR(routeid)=','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','length','name','param'];(function(_0x3b13a1,_0x2d7f26){var _0x26faff=function(_0x58516e){while(--_0x58516e){_0x3b13a1['push'](_0x3b13a1['shift']());}};_0x26faff(++_0x2d7f26);}(_0x6ed9,0xc5));var _0x96ed=function(_0x533ddf,_0x17aace){_0x533ddf=_0x533ddf-0x0;var _0x26c349=_0x6ed9[_0x533ddf];return _0x26c349;};'use strict';var _=require('lodash');var attributes=require('./voiceExtension.attributes');module[_0x96ed('0x0')]=function(_0x3b7456){var _0x2765a9=_0x3b7456[_0x96ed('0x1')];function _0x4ddc61(_0x3d77c2){var _0x5004f1=0x2;var _0x5f1c5d=[{'type':_0x3d77c2[_0x96ed('0x2')],'app':_0x96ed('0x3'),'appdata':_0x96ed('0x4')+_0x3d77c2['type'],'context':_0x3d77c2[_0x96ed('0x5')],'exten':_0x3d77c2[_0x96ed('0x6')],'priority':_0x5004f1++,'VoiceExtensionId':_0x3d77c2['id']}];if(_0x3d77c2[_0x96ed('0x2')]==='inbound'){_0x5f1c5d[_0x96ed('0x7')]({'type':_0x96ed('0x8'),'app':_0x96ed('0x3'),'appdata':'CDR(routeid)='+_0x3d77c2['id'],'context':_0x3d77c2['context'],'exten':_0x3d77c2['exten'],'priority':_0x5004f1++,'VoiceExtensionId':_0x3d77c2['id']});}_0x5f1c5d[_0x96ed('0x7')]({'type':_0x3d77c2['type'],'app':_0x96ed('0x3'),'appdata':_0x96ed('0x9'),'context':_0x3d77c2[_0x96ed('0x5')],'exten':_0x3d77c2[_0x96ed('0x6')],'priority':_0x5004f1++,'VoiceExtensionId':_0x3d77c2['id']},{'type':_0x3d77c2[_0x96ed('0x2')],'app':_0x96ed('0x3'),'appdata':_0x96ed('0xa'),'context':_0x3d77c2['context'],'exten':_0x3d77c2['exten'],'priority':_0x5004f1++,'VoiceExtensionId':_0x3d77c2['id']},{'type':_0x3d77c2[_0x96ed('0x2')],'app':_0x96ed('0x3'),'appdata':_0x96ed('0xb'),'context':_0x3d77c2['context'],'exten':_0x3d77c2[_0x96ed('0x6')],'priority':_0x5004f1++,'VoiceExtensionId':_0x3d77c2['id']});return _0x5f1c5d;}function _0x1e8d8f(_0x59c78d){var _0x594b89=0x2;var _0x2ce4f9=[{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x96ed('0xd'),'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d['exten'],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':'Set','appdata':'CDR(destination)='+(_0x59c78d['cutdigits']?_0x96ed('0xe')+_0x59c78d[_0x96ed('0xf')]+'}':'${EXTEN}'),'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x10')+_0x59c78d['id'],'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x11'),'appdata':_0x96ed('0x12')+(_0x594b89+0x2)+'):Goto('+(_0x594b89+0x1)+')','context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x59c78d[_0x96ed('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0x59c78d['cutdigits']+'}':_0x96ed('0x13'),'context':_0x59c78d['context'],'exten':_0x59c78d['exten'],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x9'),'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x96ed('0xb'),'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x14')+_0x59c78d['id'],'context':_0x59c78d['context'],'exten':_0x59c78d['exten'],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']}];if(_0x59c78d[_0x96ed('0x15')](_0x96ed('0x16'))&&_0x59c78d[_0x96ed('0x16')]!==_0x96ed('0x17')){_0x2ce4f9['push']({'type':_0x96ed('0xc'),'app':'Set','appdata':_0x96ed('0x18'),'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']},{'type':_0x96ed('0xc'),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x19')+_0x59c78d[_0x96ed('0x16')]||_0x96ed('0x1a'),'context':_0x59c78d[_0x96ed('0x5')],'exten':_0x59c78d[_0x96ed('0x6')],'priority':_0x594b89++,'VoiceExtensionId':_0x59c78d['id']});}return _0x2ce4f9;}function _0x224c81(_0x4d63ae,_0x485284){var _0x4d3d12=[{'name':_0x96ed('0x1b'),'param':0x0},{'name':_0x96ed('0x1c'),'param':0x1},{'name':_0x96ed('0x1d'),'param':0x2},{'name':_0x96ed('0x1e'),'param':0x3}];var _0x2b765e={};var _0x7c983a=_0x485284['split'](',');var _0x5a28d0=[];for(var _0x28a985=0x0;_0x28a985<_0x4d3d12[_0x96ed('0x1f')];_0x28a985++){switch(_0x4d3d12[_0x28a985][_0x96ed('0x20')]){case'trunk':_0x2b765e[_0x96ed('0x1b')]=_0x7c983a[_0x4d3d12[_0x28a985][_0x96ed('0x21')]]['split']('/')[0x1];_0x2b765e[_0x96ed('0x22')]=_0x7c983a[_0x4d3d12[_0x28a985][_0x96ed('0x21')]]['split']('/')[0x2];_0x2b765e[_0x96ed('0x23')]=_0x2b765e[_0x96ed('0x22')]?_0x2b765e[_0x96ed('0x22')][_0x96ed('0x24')]('$')[0x0]:undefined;_0x2b765e['phone']=_0x4d63ae[_0x96ed('0xf')]?(_0x2b765e[_0x96ed('0x23')]||'')+_0x96ed('0xe')+_0x4d63ae[_0x96ed('0xf')]+'}':(_0x2b765e[_0x96ed('0x23')]||'')+_0x96ed('0x25');_0x5a28d0[_0x4d3d12[_0x28a985][_0x96ed('0x21')]]=['SIP',_0x2b765e[_0x96ed('0x1b')],_0x2b765e[_0x96ed('0x22')]][_0x96ed('0x26')]('/');break;case _0x96ed('0x1d'):_0x2b765e[_0x96ed('0x1d')]=_0x7c983a[_0x4d3d12[_0x28a985][_0x96ed('0x21')]];if(_0x4d63ae[_0x96ed('0x16')]!==_0x96ed('0x17')){if(_0x2b765e[_0x96ed('0x1d')]['indexOf']('U(xcally-mixmonitor-context)')<0x0){_0x2b765e[_0x96ed('0x1d')]+=_0x96ed('0x27');}}else{_0x2b765e['options']=_0x2b765e[_0x96ed('0x1d')][_0x96ed('0x28')](_0x96ed('0x27'),'');}_0x5a28d0[_0x4d3d12[_0x28a985][_0x96ed('0x21')]]=_0x2b765e[_0x96ed('0x1d')];break;default:_0x5a28d0[_0x4d3d12[_0x28a985][_0x96ed('0x21')]]=_0x7c983a[_0x4d3d12[_0x28a985]['param']];}}return _0x5a28d0[_0x96ed('0x26')](',');}function _0x5cd2e0(_0x5ca2d7,_0x256c8e,_0x1d0bbd){return new Promise(function(_0x4c1eb0,_0x37e859){var _0x2f6908=[];if(_[_0x96ed('0x29')](_0x256c8e))return _0x4c1eb0(_0x2f6908);_0x2765a9['Interval'][_0x96ed('0x2a')]({'attributes':['id',_0x96ed('0x2b'),'IntervalId'],'raw':!![]})[_0x96ed('0x2c')](function(_0x4a74aa){for(var _0x22066d=0x0,_0x3c367c=0x0;_0x22066d<_0x256c8e['length'];_0x22066d++,_0x3c367c=0x0){var _0x30ce6b=_0x256c8e[_0x22066d];var _0x2ea94d=[];var _0x4d5626=[];delete _0x30ce6b['id'];if(_0x30ce6b[_0x96ed('0x2b')]!=='*,*,*,*'){_0x30ce6b['intervals']=[_0x30ce6b[_0x96ed('0x2b')]];}else{_0x30ce6b['intervals']=_0x30ce6b[_0x96ed('0x2d')]?_[_0x96ed('0x2e')](_['filter'](_0x4a74aa,{'IntervalId':_0x30ce6b[_0x96ed('0x2d')]}),_0x96ed('0x2b')):[];}_0x30ce6b[_0x96ed('0x5')]=_0x5ca2d7[_0x96ed('0x5')];_0x30ce6b['exten']=_0x5ca2d7[_0x96ed('0x6')];if(_0x30ce6b['type'])_0x30ce6b[_0x96ed('0x2')]=_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')]();if(_0x5ca2d7[_0x96ed('0x2')]===_0x96ed('0xc')){if(_0x30ce6b[_0x96ed('0x15')](_0x96ed('0x30'))&&_0x30ce6b[_0x96ed('0x30')]&&_0x30ce6b[_0x96ed('0x30')]!=='--'){_0x2ea94d[_0x96ed('0x7')]({'type':_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')](),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x31')+_0x30ce6b[_0x96ed('0x30')],'context':_0x5ca2d7[_0x96ed('0x5')],'exten':_0x5ca2d7[_0x96ed('0x6')],'priority':_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});}_0x2ea94d[_0x96ed('0x7')]({'type':_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')](),'app':_0x96ed('0x11'),'appdata':_0x96ed('0x33')+(_0x30ce6b[_0x96ed('0x34')]?_0x96ed('0x35')+_0x30ce6b['callerID']+')':'NoOp(No\x20number\x20available)'),'context':_0x5ca2d7['context'],'exten':_0x5ca2d7[_0x96ed('0x6')],'priority':_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});}else{if(_0x30ce6b[_0x96ed('0x15')](_0x96ed('0x36'))){if([_0x96ed('0x37'),_0x96ed('0x38')][_0x96ed('0x39')](_0x30ce6b[_0x96ed('0x3a')]['toLowerCase']())&&_0x30ce6b[_0x96ed('0x3b')]!==_0x96ed('0x3c')){if(_0x30ce6b[_0x96ed('0x36')]){_0x2ea94d[_0x96ed('0x7')]({'type':_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')](),'app':_0x96ed('0x11'),'appdata':_0x96ed('0x3d'),'context':_0x5ca2d7[_0x96ed('0x5')],'exten':_0x5ca2d7[_0x96ed('0x6')],'priority':_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});_0x2ea94d['push']({'type':_0x30ce6b[_0x96ed('0x2')]['toLowerCase'](),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x3e'),'context':_0x5ca2d7[_0x96ed('0x5')],'exten':_0x5ca2d7['exten'],'priority':_0x30ce6b['intervals'][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});}else{_0x2ea94d['push']({'type':_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')](),'app':'ExecIf','appdata':_0x96ed('0x3f'),'context':_0x5ca2d7['context'],'exten':_0x5ca2d7[_0x96ed('0x6')],'priority':_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});_0x2ea94d[_0x96ed('0x7')]({'type':_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')](),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x40'),'context':_0x5ca2d7[_0x96ed('0x5')],'exten':_0x5ca2d7['exten'],'priority':_0x30ce6b['intervals'][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});}}}}for(var _0x43e93b=0x0;_0x43e93b<_0x30ce6b['intervals']['length'];_0x43e93b++){var _0x2dfc1b=_0x1d0bbd+_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')];var _0x18b446=_0x43e93b===_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')]-0x1?_0x1d0bbd+_0x2ea94d['length']+_0x4d5626['length']+0x2:_0x1d0bbd+_0x43e93b+0x1;_0x2ea94d['splice'](_0x43e93b,0x0,{'type':_0x5ca2d7[_0x96ed('0x2')],'app':_0x96ed('0x41'),'appdata':_0x30ce6b[_0x96ed('0x32')][_0x43e93b]+'?'+_0x5ca2d7[_0x96ed('0x5')]+_0x96ed('0x42')+_0x2dfc1b+':'+_0x5ca2d7['context']+_0x96ed('0x42')+_0x18b446,'exten':_0x5ca2d7[_0x96ed('0x6')],'context':_0x5ca2d7[_0x96ed('0x5')],'priority':_0x1d0bbd+_0x43e93b,'VoiceExtensionId':_0x5ca2d7['id']});}if(_0x30ce6b[_0x96ed('0x3b')]==='outboundDial'){_0x30ce6b[_0x96ed('0x43')]=_0x224c81(_0x5ca2d7,_0x30ce6b['appdata']);}if(_0x30ce6b[_0x96ed('0x3b')]===_0x96ed('0x44')){_0x2ea94d[_0x96ed('0x7')]({'type':_0x30ce6b[_0x96ed('0x2')][_0x96ed('0x2f')](),'app':_0x96ed('0x3'),'appdata':_0x96ed('0x45'),'context':_0x5ca2d7['context'],'exten':_0x5ca2d7[_0x96ed('0x6')],'priority':_0x30ce6b[_0x96ed('0x32')][_0x96ed('0x1f')]+_0x1d0bbd+_0x3c367c++,'VoiceExtensionId':_0x5ca2d7['id']});}_0x30ce6b[_0x96ed('0x46')]=_0x2ea94d[_0x96ed('0x1f')]?_['last'](_0x2ea94d)[_0x96ed('0x46')]+0x1:_0x1d0bbd;_0x2f6908=_['concat'](_0x2f6908,_0x2ea94d,[_0x30ce6b],_0x4d5626);_0x1d0bbd=_[_0x96ed('0x47')](_0x2f6908)[_0x96ed('0x46')]+0x1;}return _0x4c1eb0(_0x2f6908);})[_0x96ed('0x48')](function(_0x1e7beb){_0x37e859(_0x1e7beb);});});}return _0x3b7456['define'](_0x96ed('0x49'),attributes,{'tableName':_0x96ed('0x4a'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x46422d){var _0x1c3ef8=this[_0x96ed('0x4b')]({'plain':!![]});var _0x455a97=_0x1c3ef8[_0x96ed('0x2')]===_0x96ed('0xc')?_0x1e8d8f(_0x1c3ef8):_0x4ddc61(_0x1c3ef8);return _0x5cd2e0(_0x1c3ef8,_0x46422d,_[_0x96ed('0x47')](_0x455a97)[_0x96ed('0x46')]+0x1)[_0x96ed('0x2c')](function(_0x8b2294){var _0x43af8c=_['concat'](_0x455a97,_0x8b2294);_0x43af8c['push']({'type':_0x1c3ef8[_0x96ed('0x2')],'app':_0x96ed('0x4c'),'exten':_0x1c3ef8[_0x96ed('0x6')],'context':_0x1c3ef8[_0x96ed('0x5')],'priority':_[_0x96ed('0x47')](_0x43af8c)[_0x96ed('0x46')]+0x1,'VoiceExtensionId':_0x1c3ef8['id']});return _0x43af8c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 2d319bf..b96cf48 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 _0xba34=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','then','VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceExtension','findAll','options','raw','limit','include','map','model','attributes','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc'];(function(_0xa2049b,_0x7eeb1e){var _0x2fd615=function(_0x7dbb84){while(--_0x7dbb84){_0xa2049b['push'](_0xa2049b['shift']());}};_0x2fd615(++_0x7eeb1e);}(_0xba34,0x119));var _0x4ba3=function(_0xfc29d9,_0x256414){_0xfc29d9=_0xfc29d9-0x0;var _0x50b39b=_0xba34[_0xfc29d9];return _0x50b39b;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var moment=require(_0x4ba3('0x2'));var BPromise=require(_0x4ba3('0x3'));var rs=require(_0x4ba3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ba3('0x5'))(_0x4ba3('0x6'));var config=require(_0x4ba3('0x7'));var jayson=require(_0x4ba3('0x8'));var client=jayson[_0x4ba3('0x9')][_0x4ba3('0xa')]({'port':0x232a});config[_0x4ba3('0xb')]=_['defaults'](config[_0x4ba3('0xb')],{'host':_0x4ba3('0xc'),'port':0x18eb});var socket=require(_0x4ba3('0xd'))(new Redis(config[_0x4ba3('0xb')]));require(_0x4ba3('0xe'))[_0x4ba3('0xf')](socket);function respondWithRpcPromise(_0x292f58,_0x3f653c,_0x2ed106){return new BPromise(function(_0x14ebf2,_0x2d215b){return client['request'](_0x292f58,_0x2ed106)[_0x4ba3('0x10')](function(_0x9071){logger['info'](_0x4ba3('0x11'),_0x3f653c,'request\x20sent');logger[_0x4ba3('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3f653c,_0x4ba3('0x13'),JSON[_0x4ba3('0x14')](_0x9071));if(_0x9071[_0x4ba3('0x15')]){if(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x16')]===0x1f4){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x2d215b(_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);}logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0x9071[_0x4ba3('0x15')][_0x4ba3('0x17')]);return _0x14ebf2(_0x9071[_0x4ba3('0x15')]['message']);}else{logger[_0x4ba3('0x18')](_0x4ba3('0x11'),_0x3f653c,_0x4ba3('0x13'));_0x14ebf2(_0x9071[_0x4ba3('0x19')]['message']);}})[_0x4ba3('0x1a')](function(_0xe4eff9){logger[_0x4ba3('0x15')](_0x4ba3('0x11'),_0x3f653c,_0xe4eff9);_0x2d215b(_0xe4eff9);});});}exports[_0x4ba3('0x1b')]=function(_0x125944){var _0x4b2791=this;return new Promise(function(_0x57de6a,_0x2278b0){return db['VoiceExtension'][_0x4ba3('0x1c')]({'raw':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')][_0x4ba3('0x1e')]===undefined?!![]:![]:!![],'where':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')]['where']||null:null,'attributes':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')]['attributes']||null:null,'limit':_0x125944[_0x4ba3('0x1d')]?_0x125944['options'][_0x4ba3('0x1f')]||null:null,'include':_0x125944[_0x4ba3('0x1d')]?_0x125944[_0x4ba3('0x1d')][_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x125944[_0x4ba3('0x1d')][_0x4ba3('0x20')],function(_0xe1f7d2){return{'model':db[_0xe1f7d2[_0x4ba3('0x22')]],'as':_0xe1f7d2['as'],'attributes':_0xe1f7d2[_0x4ba3('0x23')],'include':_0xe1f7d2['include']?_[_0x4ba3('0x21')](_0xe1f7d2[_0x4ba3('0x20')],function(_0x2311ed){return{'model':db[_0x2311ed['model']],'as':_0x2311ed['as'],'attributes':_0x2311ed[_0x4ba3('0x23')],'include':_0x2311ed[_0x4ba3('0x20')]?_[_0x4ba3('0x21')](_0x2311ed['include'],function(_0x10cae6){return{'model':db[_0x10cae6[_0x4ba3('0x22')]],'as':_0x10cae6['as'],'attributes':_0x10cae6[_0x4ba3('0x23')]};}):[]};}):[]};}):[]:[]})[_0x4ba3('0x10')](function(_0x4a339e){logger['info'](_0x4ba3('0x1b'),_0x125944);logger[_0x4ba3('0x12')](_0x4ba3('0x1b'),_0x125944,JSON[_0x4ba3('0x14')](_0x4a339e));_0x57de6a(_0x4a339e);})[_0x4ba3('0x1a')](function(_0x11f88f){logger['error'](_0x4ba3('0x1b'),_0x11f88f[_0x4ba3('0x17')],_0x125944);_0x2278b0(_0x4b2791[_0x4ba3('0x15')](0x1f4,_0x11f88f[_0x4ba3('0x17')]));});});}; \ No newline at end of file +var _0xbcc7=['code','message','result','GetVoiceExtension','VoiceExtension','options','raw','where','attributes','limit','include','map','model','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x33f34e,_0x4fde5b){var _0x58dc01=function(_0x36e155){while(--_0x36e155){_0x33f34e['push'](_0x33f34e['shift']());}};_0x58dc01(++_0x4fde5b);}(_0xbcc7,0x19a));var _0x7bcc=function(_0x2a02b5,_0x2f71fd){_0x2a02b5=_0x2a02b5-0x0;var _0x5ebed7=_0xbcc7[_0x2a02b5];return _0x5ebed7;};'use strict';var _=require(_0x7bcc('0x0'));var util=require(_0x7bcc('0x1'));var moment=require('moment');var BPromise=require(_0x7bcc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7bcc('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7bcc('0x4'))(_0x7bcc('0x5'));var config=require('../../config/environment');var jayson=require(_0x7bcc('0x6'));var client=jayson[_0x7bcc('0x7')][_0x7bcc('0x8')]({'port':0x232a});config[_0x7bcc('0x9')]=_[_0x7bcc('0xa')](config[_0x7bcc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7bcc('0xb'))(new Redis(config['redis']));require(_0x7bcc('0xc'))[_0x7bcc('0xd')](socket);function respondWithRpcPromise(_0x4c38fa,_0x225f39,_0x54fa3d){return new BPromise(function(_0x58e035,_0x5c4a28){return client[_0x7bcc('0xe')](_0x4c38fa,_0x54fa3d)[_0x7bcc('0xf')](function(_0xb3207){logger[_0x7bcc('0x10')](_0x7bcc('0x11'),_0x225f39,_0x7bcc('0x12'));logger[_0x7bcc('0x13')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x225f39,_0x7bcc('0x12'),JSON[_0x7bcc('0x14')](_0xb3207));if(_0xb3207[_0x7bcc('0x15')]){if(_0xb3207[_0x7bcc('0x15')][_0x7bcc('0x16')]===0x1f4){logger[_0x7bcc('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x225f39,_0xb3207[_0x7bcc('0x15')][_0x7bcc('0x17')]);return _0x5c4a28(_0xb3207[_0x7bcc('0x15')][_0x7bcc('0x17')]);}logger[_0x7bcc('0x15')](_0x7bcc('0x11'),_0x225f39,_0xb3207[_0x7bcc('0x15')]['message']);return _0x58e035(_0xb3207[_0x7bcc('0x15')]['message']);}else{logger[_0x7bcc('0x10')](_0x7bcc('0x11'),_0x225f39,_0x7bcc('0x12'));_0x58e035(_0xb3207[_0x7bcc('0x18')]['message']);}})['catch'](function(_0xbab5b6){logger[_0x7bcc('0x15')](_0x7bcc('0x11'),_0x225f39,_0xbab5b6);_0x5c4a28(_0xbab5b6);});});}exports[_0x7bcc('0x19')]=function(_0x1df8ad){var _0x32bb73=this;return new Promise(function(_0x3e8d47,_0x3d0719){return db[_0x7bcc('0x1a')]['findAll']({'raw':_0x1df8ad['options']?_0x1df8ad[_0x7bcc('0x1b')][_0x7bcc('0x1c')]===undefined?!![]:![]:!![],'where':_0x1df8ad[_0x7bcc('0x1b')]?_0x1df8ad[_0x7bcc('0x1b')][_0x7bcc('0x1d')]||null:null,'attributes':_0x1df8ad[_0x7bcc('0x1b')]?_0x1df8ad[_0x7bcc('0x1b')][_0x7bcc('0x1e')]||null:null,'limit':_0x1df8ad[_0x7bcc('0x1b')]?_0x1df8ad['options'][_0x7bcc('0x1f')]||null:null,'include':_0x1df8ad[_0x7bcc('0x1b')]?_0x1df8ad[_0x7bcc('0x1b')][_0x7bcc('0x20')]?_[_0x7bcc('0x21')](_0x1df8ad[_0x7bcc('0x1b')]['include'],function(_0x48b296){return{'model':db[_0x48b296[_0x7bcc('0x22')]],'as':_0x48b296['as'],'attributes':_0x48b296['attributes'],'include':_0x48b296['include']?_[_0x7bcc('0x21')](_0x48b296['include'],function(_0x3f79a0){return{'model':db[_0x3f79a0[_0x7bcc('0x22')]],'as':_0x3f79a0['as'],'attributes':_0x3f79a0[_0x7bcc('0x1e')],'include':_0x3f79a0['include']?_[_0x7bcc('0x21')](_0x3f79a0[_0x7bcc('0x20')],function(_0x2e92e1){return{'model':db[_0x2e92e1[_0x7bcc('0x22')]],'as':_0x2e92e1['as'],'attributes':_0x2e92e1[_0x7bcc('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x7bcc('0xf')](function(_0x9fdacf){logger['info'](_0x7bcc('0x19'),_0x1df8ad);logger[_0x7bcc('0x13')]('GetVoiceExtension',_0x1df8ad,JSON['stringify'](_0x9fdacf));_0x3e8d47(_0x9fdacf);})[_0x7bcc('0x23')](function(_0x5010ab){logger[_0x7bcc('0x15')](_0x7bcc('0x19'),_0x5010ab[_0x7bcc('0x17')],_0x1df8ad);_0x3d0719(_0x32bb73[_0x7bcc('0x15')](0x1f4,_0x5010ab['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 1f5ef48..498ec51 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(_0x67f164,_0x47f390){var _0x300978=function(_0x134e07){while(--_0x134e07){_0x67f164['push'](_0x67f164['shift']());}};_0x300978(++_0x47f390);}(_0xabce,0x103));var _0xeabc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xabce[_0x5ddb1c];return _0x354adc;};'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 _0x53ec=['length','voiceExtension:','./voiceExtension.events','save','remove','update','emit','removeListener'];(function(_0x1aec3b,_0x3e45fe){var _0x13397d=function(_0x418c88){while(--_0x418c88){_0x1aec3b['push'](_0x1aec3b['shift']());}};_0x13397d(++_0x3e45fe);}(_0x53ec,0x192));var _0xc53e=function(_0x349ac1,_0x443243){_0x349ac1=_0x349ac1-0x0;var _0x77840a=_0x53ec[_0x349ac1];return _0x77840a;};'use strict';var VoiceExtensionEvents=require(_0xc53e('0x0'));var events=[_0xc53e('0x1'),_0xc53e('0x2'),_0xc53e('0x3')];function createListener(_0x1b04cc,_0xe45c6d){return function(_0x51c435){_0xe45c6d[_0xc53e('0x4')](_0x1b04cc,_0x51c435);};}function removeListener(_0x4e954a,_0x2b90f6){return function(){VoiceExtensionEvents[_0xc53e('0x5')](_0x4e954a,_0x2b90f6);};}exports['register']=function(_0x2f1414){for(var _0x4f989b=0x0,_0x41a9e8=events[_0xc53e('0x6')];_0x4f989b<_0x41a9e8;_0x4f989b++){var _0x5d3b28=events[_0x4f989b];var _0x1616ac=createListener(_0xc53e('0x7')+_0x5d3b28,_0x2f1414);VoiceExtensionEvents['on'](_0x5d3b28,_0x1616ac);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 7300bcb..f656c56 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 _0x4325=['get','/:id/messages','getMessages','put','update','destroy','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','/:id','show'];(function(_0x3eabdb,_0x2cb3af){var _0x5cfffa=function(_0x16ee41){while(--_0x16ee41){_0x3eabdb['push'](_0x3eabdb['shift']());}};_0x5cfffa(++_0x2cb3af);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var multer=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var path=require('path');var timeout=require(_0x5432('0x2'));var express=require(_0x5432('0x3'));var router=express[_0x5432('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5432('0x5'));var config=require(_0x5432('0x6'));var controller=require(_0x5432('0x7'));router['get']('/',auth[_0x5432('0x8')](),controller[_0x5432('0x9')]);router['get'](_0x5432('0xa'),auth['isAuthenticated'](),controller[_0x5432('0xb')]);router[_0x5432('0xc')](_0x5432('0xd'),auth[_0x5432('0x8')](),controller[_0x5432('0xe')]);router['post']('/',auth[_0x5432('0x8')](),controller['create']);router[_0x5432('0xf')](_0x5432('0xa'),auth[_0x5432('0x8')](),controller[_0x5432('0x10')]);router['delete']('/:id',auth[_0x5432('0x8')](),controller[_0x5432('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7bd0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x192a8d,_0xaa0cc6){var _0x322274=function(_0x5c7e06){while(--_0x5c7e06){_0x192a8d['push'](_0x192a8d['shift']());}};_0x322274(++_0xaa0cc6);}(_0x7bd0,0x111));var _0x07bd=function(_0x1dd82f,_0x52acb7){_0x1dd82f=_0x1dd82f-0x0;var _0x353ca4=_0x7bd0[_0x1dd82f];return _0x353ca4;};'use strict';var multer=require(_0x07bd('0x0'));var util=require(_0x07bd('0x1'));var path=require(_0x07bd('0x2'));var timeout=require(_0x07bd('0x3'));var express=require(_0x07bd('0x4'));var router=express[_0x07bd('0x5')]();var fs_extra=require(_0x07bd('0x6'));var auth=require(_0x07bd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x07bd('0x8'));var controller=require(_0x07bd('0x9'));router[_0x07bd('0xa')]('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0xc')]);router[_0x07bd('0xa')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0xe')]);router['get'](_0x07bd('0xf'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x10')]);router['post']('/',auth[_0x07bd('0xb')](),controller[_0x07bd('0x11')]);router[_0x07bd('0x12')](_0x07bd('0xd'),auth['isAuthenticated'](),controller[_0x07bd('0x13')]);router[_0x07bd('0x14')](_0x07bd('0xd'),auth[_0x07bd('0xb')](),controller[_0x07bd('0x15')]);module[_0x07bd('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 58f2b9a..1c3197a 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 _0x7918=['mailbox','sequelize','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue'];(function(_0x275cef,_0x42637a){var _0x4a2c47=function(_0x4a39a6){while(--_0x4a39a6){_0x275cef['push'](_0x275cef['shift']());}};_0x4a2c47(++_0x42637a);}(_0x7918,0x7f));var _0x8791=function(_0x24d090,_0x59ff9a){_0x24d090=_0x24d090-0x0;var _0x3788e3=_0x7918[_0x24d090];return _0x3788e3;};'use strict';var Sequelize=require(_0x8791('0x0'));module[_0x8791('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8791('0x2')],'defaultValue':_0x8791('0x3'),'unique':_0x8791('0x4')},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x8791('0x4')},'password':{'type':Sequelize[_0x8791('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8791('0x2')],'validate':{'isEmail':!![]},'set':function(_0x24ff9e){this[_0x8791('0x5')](_0x8791('0x6'),typeof _0x24ff9e==='string'&&_0x24ff9e[_0x8791('0x7')]()?_0x24ff9e['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x8791('0x2')],'defaultValue':_0x8791('0x8')},'attach':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':_0x8791('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x8791('0x2')]},'callback':{'type':Sequelize[_0x8791('0x2')]},'review':{'type':Sequelize[_0x8791('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8791('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x8791('0x9')](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x8791('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x8791('0x9')]('yes','no'),'defaultValue':_0x8791('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0x8791('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0x8791('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x8791('0xd')],'get':function(){return this['getDataValue'](_0x8791('0xe'))+_0x8791('0xf')+this[_0x8791('0x10')](_0x8791('0x11'));}}}; \ No newline at end of file +var _0xf907=['contest_mailbox','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','sequelize','exports','STRING','from-voicemail'];(function(_0x17023b,_0x2a2c03){var _0x143a27=function(_0x9979fc){while(--_0x9979fc){_0x17023b['push'](_0x17023b['shift']());}};_0x143a27(++_0x2a2c03);}(_0xf907,0xe6));var _0x7f90=function(_0x50745e,_0x4722a9){_0x50745e=_0x50745e-0x0;var _0x17886c=_0xf907[_0x50745e];return _0x17886c;};'use strict';var Sequelize=require(_0x7f90('0x0'));module[_0x7f90('0x1')]={'customer_id':{'type':Sequelize[_0x7f90('0x2')]},'context':{'type':Sequelize[_0x7f90('0x2')],'defaultValue':_0x7f90('0x3'),'unique':_0x7f90('0x4')},'mailbox':{'type':Sequelize[_0x7f90('0x2')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x7f90('0x2')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x10c9cf){this['setDataValue'](_0x7f90('0x5'),typeof _0x10c9cf===_0x7f90('0x6')&&_0x10c9cf['trim']()?_0x10c9cf[_0x7f90('0x7')]():null);}},'pager':{'type':Sequelize[_0x7f90('0x2')]},'tz':{'type':Sequelize[_0x7f90('0x2')],'defaultValue':_0x7f90('0x8')},'attach':{'type':Sequelize[_0x7f90('0x9')]('yes','no'),'defaultValue':_0x7f90('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x7f90('0x9')](_0x7f90('0xa'),'no'),'defaultValue':_0x7f90('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x7f90('0x2')]},'callback':{'type':Sequelize[_0x7f90('0x2')]},'review':{'type':Sequelize[_0x7f90('0x9')](_0x7f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x7f90('0x9')](_0x7f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x7f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x7f90('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x7f90('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0x7f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x7f90('0x9')](_0x7f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x7f90('0x9')](_0x7f90('0xa'),'no'),'defaultValue':_0x7f90('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x7f90('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x7f90('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x7f90('0xa'),'allowNull':![]},'stamp':{'type':_0x7f90('0xc')},'emailsubject':{'type':Sequelize[_0x7f90('0x2')]},'emailbody':{'type':Sequelize[_0x7f90('0x2')]},'maxsecs':{'type':Sequelize[_0x7f90('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x7f90('0xe')],'get':function(){return this['getDataValue'](_0x7f90('0xf'))+_0x7f90('0x10')+this[_0x7f90('0x11')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 23da472..00a1403 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 _0x0565=['lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','then','destroy','Voicemails','sendStatus','stack','name','map','VoiceMail','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','show','params','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','error','update','findOne','VoiceMailMessage','mailbox','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x547587,_0x48cbd9){var _0x3d7777=function(_0x3e5075){while(--_0x3e5075){_0x547587['push'](_0x547587['shift']());}};_0x3d7777(++_0x48cbd9);}(_0x0565,0xf2));var _0x5056=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x0565[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0x5056('0x0'));var rimraf=require(_0x5056('0x1'));var zipdir=require(_0x5056('0x2'));var jsonpatch=require(_0x5056('0x3'));var rp=require(_0x5056('0x4'));var moment=require(_0x5056('0x5'));var BPromise=require(_0x5056('0x6'));var Mustache=require(_0x5056('0x7'));var util=require(_0x5056('0x8'));var path=require(_0x5056('0x9'));var sox=require('sox');var csv=require(_0x5056('0xa'));var ejs=require(_0x5056('0xb'));var fs=require('fs');var fs_extra=require(_0x5056('0xc'));var _=require(_0x5056('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5056('0xe'));var deskjs=require(_0x5056('0xf'));var toCsv=require(_0x5056('0xa'));var querystring=require(_0x5056('0x10'));var Papa=require(_0x5056('0x11'));var Redis=require(_0x5056('0x12'));var authService=require(_0x5056('0x13'));var qs=require(_0x5056('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5056('0x15'));var logger=require(_0x5056('0x16'))(_0x5056('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5056('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x548bcf,_0x53e98a){_0x53e98a=_0x53e98a||0xcc;return function(_0x2d44fb){if(_0x2d44fb){return _0x548bcf['sendStatus'](_0x53e98a);}return _0x548bcf[_0x5056('0x19')](_0x53e98a)[_0x5056('0x1a')]();};}function respondWithResult(_0x7af76b,_0x543cee){_0x543cee=_0x543cee||0xc8;return function(_0x1e8b64){if(_0x1e8b64){return _0x7af76b[_0x5056('0x19')](_0x543cee)[_0x5056('0x1b')](_0x1e8b64);}};}function respondWithFilteredResult(_0x56c3ef,_0x21561d){return function(_0x6a044a){if(_0x6a044a){var _0x4ac332=typeof _0x21561d[_0x5056('0x1c')]==='undefined'&&typeof _0x21561d[_0x5056('0x1d')]===_0x5056('0x1e');var _0x1c0ee9=_0x6a044a[_0x5056('0x1f')];var _0x4056ce=_0x4ac332?0x0:_0x21561d['offset'];var _0x9ea88=_0x4ac332?_0x6a044a[_0x5056('0x1f')]:_0x21561d['offset']+_0x21561d['limit'];var _0x20776c;if(_0x9ea88>=_0x1c0ee9){_0x9ea88=_0x1c0ee9;_0x20776c=0xc8;}else{_0x20776c=0xce;}_0x56c3ef[_0x5056('0x19')](_0x20776c);return _0x56c3ef[_0x5056('0x20')](_0x5056('0x21'),_0x4056ce+'-'+_0x9ea88+'/'+_0x1c0ee9)[_0x5056('0x1b')](_0x6a044a);}return null;};}function patchUpdates(_0xf04e08){return function(_0x33035c){try{jsonpatch['apply'](_0x33035c,_0xf04e08,!![]);}catch(_0x13b363){return BPromise[_0x5056('0x22')](_0x13b363);}return _0x33035c['save']();};}function saveUpdates(_0x271efc,_0x1bccef){return function(_0x2564d0){if(_0x2564d0){return _0x2564d0['update'](_0x271efc)[_0x5056('0x23')](function(_0x26a3c2){return _0x26a3c2;});}return null;};}function removeEntity(_0x5afbfe,_0x4a64be){return function(_0x29e166){if(_0x29e166){return _0x29e166[_0x5056('0x24')]()[_0x5056('0x23')](function(){var _0x37f7b5=_0x29e166['get']({'plain':!![]});var _0x267048=_0x5056('0x25');return db['UserProfileResource'][_0x5056('0x24')]({'where':{'type':_0x267048,'resourceId':_0x37f7b5['id']}})['then'](function(){return _0x29e166;});})[_0x5056('0x23')](function(){_0x5afbfe[_0x5056('0x19')](0xcc)[_0x5056('0x1a')]();});}};}function handleEntityNotFound(_0x2b8fab,_0x45f600){return function(_0x50f2a8){if(!_0x50f2a8){_0x2b8fab[_0x5056('0x26')](0x194);}return _0x50f2a8;};}function handleError(_0x346e9e,_0x14cb84){_0x14cb84=_0x14cb84||0x1f4;return function(_0x2ac79a){logger['error'](_0x2ac79a[_0x5056('0x27')]);if(_0x2ac79a['name']){delete _0x2ac79a[_0x5056('0x28')];}_0x346e9e['status'](_0x14cb84)['send'](_0x2ac79a);};}exports['index']=function(_0x113be0,_0x252f75){var _0x482939={},_0x27f4be={},_0x2c5728={'count':0x0,'rows':[]};var _0x9e2986=_[_0x5056('0x29')](db[_0x5056('0x2a')][_0x5056('0x2b')],function(_0x173fac){return{'name':_0x173fac[_0x5056('0x2c')],'type':_0x173fac[_0x5056('0x2d')][_0x5056('0x2e')]};});_0x27f4be[_0x5056('0x2f')]=_['map'](_0x9e2986,'name');_0x27f4be[_0x5056('0x30')]=_[_0x5056('0x31')](_0x113be0['query']);_0x27f4be[_0x5056('0x32')]=_[_0x5056('0x33')](_0x27f4be['model'],_0x27f4be[_0x5056('0x30')]);_0x482939[_0x5056('0x34')]=_[_0x5056('0x33')](_0x27f4be[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x113be0[_0x5056('0x30')][_0x5056('0x35')]));_0x482939[_0x5056('0x34')]=_0x482939[_0x5056('0x34')][_0x5056('0x36')]?_0x482939[_0x5056('0x34')]:_0x27f4be[_0x5056('0x2f')];if(!_0x113be0[_0x5056('0x30')][_0x5056('0x37')](_0x5056('0x38'))){_0x482939['limit']=qs[_0x5056('0x1d')](_0x113be0['query'][_0x5056('0x1d')]);_0x482939[_0x5056('0x1c')]=qs[_0x5056('0x1c')](_0x113be0[_0x5056('0x30')]['offset']);}_0x482939[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x113be0['query'][_0x5056('0x3a')]);_0x482939['where']=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x113be0[_0x5056('0x30')],_0x27f4be['filters']),_0x9e2986);if(_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]){_0x482939[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x482939[_0x5056('0x3d')],{'$or':_[_0x5056('0x29')](_0x9e2986,function(_0x1aa311){if(_0x1aa311[_0x5056('0x2d')]!==_0x5056('0x3f')){var _0x430db0={};_0x430db0[_0x1aa311[_0x5056('0x28')]]={'$like':'%'+_0x113be0[_0x5056('0x30')][_0x5056('0x3c')]+'%'};return _0x430db0;}})});}_0x482939=_[_0x5056('0x3e')]({},_0x482939,_0x113be0[_0x5056('0x40')]);var _0x351ebd={'where':_0x482939['where']};return db['VoiceMail'][_0x5056('0x1f')](_0x351ebd)[_0x5056('0x23')](function(_0x6946b4){_0x2c5728[_0x5056('0x1f')]=_0x6946b4;if(_0x113be0[_0x5056('0x30')][_0x5056('0x41')]){_0x482939[_0x5056('0x42')]=[{'all':!![]}];}return db[_0x5056('0x2a')]['findAll'](_0x482939);})['then'](function(_0x68a385){_0x2c5728[_0x5056('0x43')]=_0x68a385;return _0x2c5728;})[_0x5056('0x23')](respondWithFilteredResult(_0x252f75,_0x482939))['catch'](handleError(_0x252f75,null));};exports[_0x5056('0x44')]=function(_0x5b99e9,_0x285fee){var _0x40375b={'raw':!![],'where':{'id':_0x5b99e9[_0x5056('0x45')]['id']}},_0x2ef93e={};_0x2ef93e[_0x5056('0x2f')]=_[_0x5056('0x31')](db['VoiceMail'][_0x5056('0x2b')]);_0x2ef93e[_0x5056('0x30')]=_[_0x5056('0x31')](_0x5b99e9['query']);_0x2ef93e['filters']=_['intersection'](_0x2ef93e['model'],_0x2ef93e[_0x5056('0x30')]);_0x40375b[_0x5056('0x34')]=_[_0x5056('0x33')](_0x2ef93e[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x5b99e9['query']['fields']));_0x40375b[_0x5056('0x34')]=_0x40375b[_0x5056('0x34')][_0x5056('0x36')]?_0x40375b[_0x5056('0x34')]:_0x2ef93e[_0x5056('0x2f')];if(_0x5b99e9[_0x5056('0x30')][_0x5056('0x41')]){_0x40375b['include']=[{'all':!![]}];}_0x40375b=_['merge']({},_0x40375b,_0x5b99e9[_0x5056('0x40')]);return db[_0x5056('0x2a')]['find'](_0x40375b)[_0x5056('0x23')](handleEntityNotFound(_0x285fee,null))[_0x5056('0x23')](respondWithResult(_0x285fee,null))['catch'](handleError(_0x285fee,null));};exports['create']=function(_0x83d8e4,_0x1ab1a9){return db['VoiceMail']['create'](_0x83d8e4[_0x5056('0x46')],{})[_0x5056('0x23')](function(_0x528575){var _0x5c3f73=_0x83d8e4[_0x5056('0x47')][_0x5056('0x48')]({'plain':!![]});if(!_0x5c3f73)throw new Error(_0x5056('0x49'));if(_0x5c3f73[_0x5056('0x4a')]===_0x5056('0x47')){var _0xdf427c=_0x528575[_0x5056('0x48')]({'plain':!![]});var _0x366ba2=_0x5056('0x25');return db[_0x5056('0x4b')][_0x5056('0x4c')]({'where':{'name':_0x366ba2,'userProfileId':_0x5c3f73[_0x5056('0x4d')]},'raw':!![]})[_0x5056('0x23')](function(_0x327821){if(_0x327821&&_0x327821[_0x5056('0x4e')]===0x0){return db['UserProfileResource']['create']({'name':_0xdf427c[_0x5056('0x28')],'resourceId':_0xdf427c['id'],'type':_0x327821[_0x5056('0x28')],'sectionId':_0x327821['id']},{})[_0x5056('0x23')](function(){return _0x528575;});}else{return _0x528575;}})[_0x5056('0x4f')](function(_0x35776b){logger[_0x5056('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x35776b);throw _0x35776b;});}return _0x528575;})[_0x5056('0x23')](respondWithResult(_0x1ab1a9,0xc9))[_0x5056('0x4f')](handleError(_0x1ab1a9,null));};exports[_0x5056('0x51')]=function(_0x3d22cc,_0x1ff74a){if(_0x3d22cc[_0x5056('0x46')]['id']){delete _0x3d22cc[_0x5056('0x46')]['id'];}return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x3d22cc[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x1ff74a,null))[_0x5056('0x23')](saveUpdates(_0x3d22cc[_0x5056('0x46')],null))['then'](respondWithResult(_0x1ff74a,null))[_0x5056('0x4f')](handleError(_0x1ff74a,null));};exports[_0x5056('0x24')]=function(_0x2df8e8,_0x5363fd){return db[_0x5056('0x2a')][_0x5056('0x4c')]({'where':{'id':_0x2df8e8[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x5363fd,null))['then'](removeEntity(_0x5363fd,null))['catch'](handleError(_0x5363fd,null));};exports['getMessages']=function(_0x427007,_0x55ae24,_0x1934e1){return db[_0x5056('0x2a')][_0x5056('0x52')]({'where':{'id':_0x427007[_0x5056('0x45')]['id']}})[_0x5056('0x23')](handleEntityNotFound(_0x55ae24,null))[_0x5056('0x23')](function(_0x5330b4){var _0x48568b;var _0x25da13={},_0x333d22={};_0x333d22['model']=_[_0x5056('0x31')](db[_0x5056('0x53')][_0x5056('0x2b')]);_0x333d22[_0x5056('0x30')]=_[_0x5056('0x31')](_0x427007['query']);_0x333d22[_0x5056('0x32')]=_[_0x5056('0x33')](_0x333d22['model'],_0x333d22[_0x5056('0x30')]);_0x25da13[_0x5056('0x34')]=_[_0x5056('0x33')](_0x333d22[_0x5056('0x2f')],qs[_0x5056('0x35')](_0x427007[_0x5056('0x30')][_0x5056('0x35')]));_0x25da13[_0x5056('0x34')]=_0x25da13[_0x5056('0x34')][_0x5056('0x36')]?_0x25da13[_0x5056('0x34')]:_0x333d22[_0x5056('0x2f')];if(!_0x427007[_0x5056('0x30')]['hasOwnProperty'](_0x5056('0x38'))){_0x25da13[_0x5056('0x1d')]=qs[_0x5056('0x1d')](_0x427007[_0x5056('0x30')][_0x5056('0x1d')]);_0x25da13[_0x5056('0x1c')]=qs['offset'](_0x427007[_0x5056('0x30')]['offset']);}_0x25da13[_0x5056('0x39')]=qs[_0x5056('0x3a')](_0x427007['query']['sort']);_0x25da13[_0x5056('0x3d')]=qs[_0x5056('0x32')](_[_0x5056('0x3b')](_0x427007[_0x5056('0x30')],_0x333d22['filters']));if(_0x427007['query'][_0x5056('0x3c')]){_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13['where'],{'$or':_[_0x5056('0x29')](_0x25da13['attributes'],function(_0x57cb62){var _0x1bfae9={};_0x1bfae9[_0x57cb62]={'$like':'%'+_0x427007[_0x5056('0x30')]['filter']+'%'};return _0x1bfae9;})});}_0x25da13[_0x5056('0x3d')]=_[_0x5056('0x3e')](_0x25da13[_0x5056('0x3d')],{'mailboxuser':_0x5330b4[_0x5056('0x54')]});_0x25da13=_[_0x5056('0x3e')]({},_0x25da13,_0x427007[_0x5056('0x40')]);return db[_0x5056('0x53')]['findAndCountAll'](_0x25da13)[_0x5056('0x23')](respondWithFilteredResult(_0x55ae24,_0x25da13));})[_0x5056('0x4f')](handleError(_0x55ae24,null));}; \ No newline at end of file +var _0x0713=['userProfileId','autoAssociation','getMessages','VoiceMailMessage','rawAttributes','mailbox','findAndCountAll','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','index','map','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VoiceMail','rows','catch','show','params','keys','fields','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){var _0x2793ef=_0xb05b1d[_0x3071('0x29')]({'plain':!![]});var _0x7a4cb4=_0x3071('0x2a');return db[_0x3071('0x2b')]['destroy']({'where':{'type':_0x7a4cb4,'resourceId':_0x2793ef['id']}})[_0x3071('0x27')](function(){return _0xb05b1d;});})[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fb1ca,_0x28792d){return function(_0x163604){if(!_0x163604){_0x4fb1ca[_0x3071('0x2c')](0x194);}return _0x163604;};}function handleError(_0x3fa3b8,_0x25b96b){_0x25b96b=_0x25b96b||0x1f4;return function(_0x177b5f){logger[_0x3071('0x2d')](_0x177b5f[_0x3071('0x2e')]);if(_0x177b5f[_0x3071('0x2f')]){delete _0x177b5f[_0x3071('0x2f')];}_0x3fa3b8['status'](_0x25b96b)['send'](_0x177b5f);};}exports[_0x3071('0x30')]=function(_0x149e0d,_0x6ddf96){var _0x40be95={},_0x3f6d90={},_0x29538c={'count':0x0,'rows':[]};var _0x32b6b1=_[_0x3071('0x31')](db['VoiceMail']['rawAttributes'],function(_0x4ab983){return{'name':_0x4ab983[_0x3071('0x32')],'type':_0x4ab983[_0x3071('0x33')]['key']};});_0x3f6d90[_0x3071('0x34')]=_[_0x3071('0x31')](_0x32b6b1,_0x3071('0x2f'));_0x3f6d90[_0x3071('0x35')]=_['keys'](_0x149e0d[_0x3071('0x35')]);_0x3f6d90[_0x3071('0x36')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],_0x3f6d90[_0x3071('0x35')]);_0x40be95[_0x3071('0x38')]=_[_0x3071('0x37')](_0x3f6d90[_0x3071('0x34')],qs['fields'](_0x149e0d[_0x3071('0x35')]['fields']));_0x40be95['attributes']=_0x40be95[_0x3071('0x38')][_0x3071('0x39')]?_0x40be95['attributes']:_0x3f6d90[_0x3071('0x34')];if(!_0x149e0d[_0x3071('0x35')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x40be95[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x149e0d['query'][_0x3071('0x20')]);_0x40be95[_0x3071('0x1e')]=qs['offset'](_0x149e0d[_0x3071('0x35')]['offset']);}_0x40be95[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x149e0d['query']['sort']);_0x40be95[_0x3071('0x3e')]=qs[_0x3071('0x36')](_[_0x3071('0x3f')](_0x149e0d['query'],_0x3f6d90[_0x3071('0x36')]),_0x32b6b1);if(_0x149e0d['query'][_0x3071('0x40')]){_0x40be95['where']=_[_0x3071('0x41')](_0x40be95[_0x3071('0x3e')],{'$or':_[_0x3071('0x31')](_0x32b6b1,function(_0x3113ef){if(_0x3113ef[_0x3071('0x33')]!=='VIRTUAL'){var _0x53ed25={};_0x53ed25[_0x3113ef[_0x3071('0x2f')]]={'$like':'%'+_0x149e0d[_0x3071('0x35')][_0x3071('0x40')]+'%'};return _0x53ed25;}})});}_0x40be95=_[_0x3071('0x41')]({},_0x40be95,_0x149e0d['options']);var _0x3cfc05={'where':_0x40be95[_0x3071('0x3e')]};return db[_0x3071('0x42')][_0x3071('0x21')](_0x3cfc05)[_0x3071('0x27')](function(_0xb9a4b8){_0x29538c['count']=_0xb9a4b8;if(_0x149e0d[_0x3071('0x35')]['includeAll']){_0x40be95['include']=[{'all':!![]}];}return db['VoiceMail']['findAll'](_0x40be95);})[_0x3071('0x27')](function(_0x1be8b6){_0x29538c[_0x3071('0x43')]=_0x1be8b6;return _0x29538c;})[_0x3071('0x27')](respondWithFilteredResult(_0x6ddf96,_0x40be95))[_0x3071('0x44')](handleError(_0x6ddf96,null));};exports[_0x3071('0x45')]=function(_0xa711b5,_0x2e6c70){var _0x56589e={'raw':!![],'where':{'id':_0xa711b5[_0x3071('0x46')]['id']}},_0x1e8222={};_0x1e8222[_0x3071('0x34')]=_[_0x3071('0x47')](db[_0x3071('0x42')]['rawAttributes']);_0x1e8222['query']=_[_0x3071('0x47')](_0xa711b5[_0x3071('0x35')]);_0x1e8222[_0x3071('0x36')]=_[_0x3071('0x37')](_0x1e8222[_0x3071('0x34')],_0x1e8222['query']);_0x56589e[_0x3071('0x38')]=_['intersection'](_0x1e8222[_0x3071('0x34')],qs['fields'](_0xa711b5['query'][_0x3071('0x48')]));_0x56589e['attributes']=_0x56589e[_0x3071('0x38')]['length']?_0x56589e[_0x3071('0x38')]:_0x1e8222[_0x3071('0x34')];if(_0xa711b5[_0x3071('0x35')][_0x3071('0x49')]){_0x56589e['include']=[{'all':!![]}];}_0x56589e=_[_0x3071('0x41')]({},_0x56589e,_0xa711b5['options']);return db[_0x3071('0x42')]['find'](_0x56589e)[_0x3071('0x27')](handleEntityNotFound(_0x2e6c70,null))[_0x3071('0x27')](respondWithResult(_0x2e6c70,null))['catch'](handleError(_0x2e6c70,null));};exports[_0x3071('0x4a')]=function(_0x117e73,_0x224a70){return db[_0x3071('0x42')][_0x3071('0x4a')](_0x117e73[_0x3071('0x4b')],{})[_0x3071('0x27')](function(_0x577060){var _0x2c6e4c=_0x117e73[_0x3071('0x4c')][_0x3071('0x29')]({'plain':!![]});if(!_0x2c6e4c)throw new Error(_0x3071('0x4d'));if(_0x2c6e4c['role']===_0x3071('0x4c')){var _0x2aea37=_0x577060[_0x3071('0x29')]({'plain':!![]});var _0x2307dd=_0x3071('0x2a');return db[_0x3071('0x4e')][_0x3071('0x4f')]({'where':{'name':_0x2307dd,'userProfileId':_0x2c6e4c[_0x3071('0x50')]},'raw':!![]})[_0x3071('0x27')](function(_0x886f7){if(_0x886f7&&_0x886f7[_0x3071('0x51')]===0x0){return db[_0x3071('0x2b')][_0x3071('0x4a')]({'name':_0x2aea37[_0x3071('0x2f')],'resourceId':_0x2aea37['id'],'type':_0x886f7[_0x3071('0x2f')],'sectionId':_0x886f7['id']},{})[_0x3071('0x27')](function(){return _0x577060;});}else{return _0x577060;}})['catch'](function(_0x47a438){logger[_0x3071('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a438);throw _0x47a438;});}return _0x577060;})[_0x3071('0x27')](respondWithResult(_0x224a70,0xc9))[_0x3071('0x44')](handleError(_0x224a70,null));};exports[_0x3071('0x26')]=function(_0x514821,_0x1ec428){if(_0x514821[_0x3071('0x4b')]['id']){delete _0x514821['body']['id'];}return db['VoiceMail'][_0x3071('0x4f')]({'where':{'id':_0x514821[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x1ec428,null))[_0x3071('0x27')](saveUpdates(_0x514821['body'],null))[_0x3071('0x27')](respondWithResult(_0x1ec428,null))[_0x3071('0x44')](handleError(_0x1ec428,null));};exports[_0x3071('0x28')]=function(_0x41f02a,_0x123323){return db['VoiceMail'][_0x3071('0x4f')]({'where':{'id':_0x41f02a[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x123323,null))[_0x3071('0x27')](removeEntity(_0x123323,null))[_0x3071('0x44')](handleError(_0x123323,null));};exports[_0x3071('0x52')]=function(_0x71d921,_0x4bea5d,_0x4d6ed0){return db[_0x3071('0x42')]['findOne']({'where':{'id':_0x71d921[_0x3071('0x46')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0x4bea5d,null))['then'](function(_0x19dc95){var _0x1bf911;var _0x4d3886={},_0x108b14={};_0x108b14[_0x3071('0x34')]=_[_0x3071('0x47')](db[_0x3071('0x53')][_0x3071('0x54')]);_0x108b14['query']=_[_0x3071('0x47')](_0x71d921[_0x3071('0x35')]);_0x108b14[_0x3071('0x36')]=_['intersection'](_0x108b14[_0x3071('0x34')],_0x108b14[_0x3071('0x35')]);_0x4d3886[_0x3071('0x38')]=_[_0x3071('0x37')](_0x108b14[_0x3071('0x34')],qs[_0x3071('0x48')](_0x71d921[_0x3071('0x35')][_0x3071('0x48')]));_0x4d3886[_0x3071('0x38')]=_0x4d3886['attributes'][_0x3071('0x39')]?_0x4d3886[_0x3071('0x38')]:_0x108b14[_0x3071('0x34')];if(!_0x71d921[_0x3071('0x35')][_0x3071('0x3a')](_0x3071('0x3b'))){_0x4d3886[_0x3071('0x20')]=qs[_0x3071('0x20')](_0x71d921[_0x3071('0x35')][_0x3071('0x20')]);_0x4d3886[_0x3071('0x1e')]=qs['offset'](_0x71d921[_0x3071('0x35')][_0x3071('0x1e')]);}_0x4d3886[_0x3071('0x3c')]=qs[_0x3071('0x3d')](_0x71d921[_0x3071('0x35')][_0x3071('0x3d')]);_0x4d3886[_0x3071('0x3e')]=qs[_0x3071('0x36')](_['pick'](_0x71d921[_0x3071('0x35')],_0x108b14[_0x3071('0x36')]));if(_0x71d921['query']['filter']){_0x4d3886[_0x3071('0x3e')]=_[_0x3071('0x41')](_0x4d3886[_0x3071('0x3e')],{'$or':_[_0x3071('0x31')](_0x4d3886['attributes'],function(_0x52955a){var _0x33c39a={};_0x33c39a[_0x52955a]={'$like':'%'+_0x71d921['query']['filter']+'%'};return _0x33c39a;})});}_0x4d3886['where']=_['merge'](_0x4d3886[_0x3071('0x3e')],{'mailboxuser':_0x19dc95[_0x3071('0x55')]});_0x4d3886=_[_0x3071('0x41')]({},_0x4d3886,_0x71d921['options']);return db[_0x3071('0x53')][_0x3071('0x56')](_0x4d3886)[_0x3071('0x27')](respondWithFilteredResult(_0x4bea5d,_0x4d3886));})[_0x3071('0x44')](handleError(_0x4bea5d,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index c45948b..2b18794 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 _0xcf44=['../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox','context','lodash','util','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x334fea,_0x1f1e18){var _0x3c5829=function(_0x4fd6ac){while(--_0x4fd6ac){_0x334fea['push'](_0x334fea['shift']());}};_0x3c5829(++_0x1f1e18);}(_0xcf44,0xda));var _0x4cf4=function(_0x5b7218,_0x51cb1f){_0x5b7218=_0x5b7218-0x0;var _0x424010=_0xcf44[_0x5b7218];return _0x424010;};'use strict';var _=require(_0x4cf4('0x0'));var util=require(_0x4cf4('0x1'));var logger=require(_0x4cf4('0x2'))(_0x4cf4('0x3'));var moment=require(_0x4cf4('0x4'));var BPromise=require('bluebird');var rp=require(_0x4cf4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4cf4('0x6'));var config=require(_0x4cf4('0x7'));var attributes=require(_0x4cf4('0x8'));module[_0x4cf4('0x9')]=function(_0x673d1f,_0x53b902){return _0x673d1f[_0x4cf4('0xa')](_0x4cf4('0xb'),attributes,{'tableName':_0x4cf4('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x4cf4('0xd'),_0x4cf4('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6867=['voice_voicemail','context','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','VoiceMail'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x6867,0x17b));var _0x7686=function(_0x131a03,_0xa87723){_0x131a03=_0x131a03-0x0;var _0x52953f=_0x6867[_0x131a03];return _0x52953f;};'use strict';var _=require('lodash');var util=require(_0x7686('0x0'));var logger=require(_0x7686('0x1'))(_0x7686('0x2'));var moment=require(_0x7686('0x3'));var BPromise=require(_0x7686('0x4'));var rp=require(_0x7686('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7686('0x6'));var config=require(_0x7686('0x7'));var attributes=require('./voiceMail.attributes');module[_0x7686('0x8')]=function(_0x20d8ab,_0x2d16a2){return _0x20d8ab[_0x7686('0x9')](_0x7686('0xa'),attributes,{'tableName':_0x7686('0xb'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':['mailbox',_0x7686('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 24ac583..00b73bf 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 _0x1d4c=['../../config/environment','jayson/promise','http','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','randomstring','../../config/utils','../../config/logger'];(function(_0xa40210,_0x51c664){var _0xae0140=function(_0x259735){while(--_0x259735){_0xa40210['push'](_0xa40210['shift']());}};_0xae0140(++_0x51c664);}(_0x1d4c,0xa6));var _0xc1d4=function(_0x1a4c39,_0x22b9be){_0x1a4c39=_0x1a4c39-0x0;var _0x174630=_0x1d4c[_0x1a4c39];return _0x174630;};'use strict';var _=require(_0xc1d4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc1d4('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc1d4('0x2'));var logger=require(_0xc1d4('0x3'))('rpc');var config=require(_0xc1d4('0x4'));var jayson=require(_0xc1d4('0x5'));var client=jayson['client'][_0xc1d4('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a9b33,_0x21a0a2,_0x8e7351){return new BPromise(function(_0x301473,_0x3c24ca){return client[_0xc1d4('0x7')](_0x2a9b33,_0x8e7351)['then'](function(_0x1564ca){logger[_0xc1d4('0x8')](_0xc1d4('0x9'),_0x21a0a2,_0xc1d4('0xa'));logger[_0xc1d4('0xb')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x21a0a2,'request\x20sent',JSON[_0xc1d4('0xc')](_0x1564ca));if(_0x1564ca[_0xc1d4('0xd')]){if(_0x1564ca['error'][_0xc1d4('0xe')]===0x1f4){logger[_0xc1d4('0xd')](_0xc1d4('0x9'),_0x21a0a2,_0x1564ca[_0xc1d4('0xd')][_0xc1d4('0xf')]);return _0x3c24ca(_0x1564ca['error'][_0xc1d4('0xf')]);}logger[_0xc1d4('0xd')](_0xc1d4('0x9'),_0x21a0a2,_0x1564ca[_0xc1d4('0xd')][_0xc1d4('0xf')]);return _0x301473(_0x1564ca['error']['message']);}else{logger['info'](_0xc1d4('0x9'),_0x21a0a2,_0xc1d4('0xa'));_0x301473(_0x1564ca[_0xc1d4('0x10')][_0xc1d4('0xf')]);}})['catch'](function(_0x53c022){logger['error'](_0xc1d4('0x9'),_0x21a0a2,_0x53c022);_0x3c24ca(_0x53c022);});});} \ No newline at end of file +var _0x6b04=['debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VoiceMail,\x20%s,\x20%s'];(function(_0xdcb525,_0x1520e8){var _0x4e4778=function(_0x5bb920){while(--_0x5bb920){_0xdcb525['push'](_0xdcb525['shift']());}};_0x4e4778(++_0x1520e8);}(_0x6b04,0x1c0));var _0x46b0=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6b04[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x46b0('0x0'));var moment=require(_0x46b0('0x1'));var BPromise=require(_0x46b0('0x2'));var rs=require(_0x46b0('0x3'));var fs=require('fs');var Redis=require(_0x46b0('0x4'));var db=require(_0x46b0('0x5'))['db'];var utils=require(_0x46b0('0x6'));var logger=require(_0x46b0('0x7'))(_0x46b0('0x8'));var config=require(_0x46b0('0x9'));var jayson=require(_0x46b0('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x11d19d,_0x51d157,_0x1e5783){return new BPromise(function(_0x105da6,_0x4fbed1){return client['request'](_0x11d19d,_0x1e5783)[_0x46b0('0xb')](function(_0x22efe2){logger[_0x46b0('0xc')](_0x46b0('0xd'),_0x51d157,'request\x20sent');logger[_0x46b0('0xe')](_0x46b0('0xf'),_0x51d157,_0x46b0('0x10'),JSON[_0x46b0('0x11')](_0x22efe2));if(_0x22efe2[_0x46b0('0x12')]){if(_0x22efe2[_0x46b0('0x12')]['code']===0x1f4){logger[_0x46b0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x51d157,_0x22efe2[_0x46b0('0x12')]['message']);return _0x4fbed1(_0x22efe2[_0x46b0('0x12')][_0x46b0('0x13')]);}logger[_0x46b0('0x12')](_0x46b0('0xd'),_0x51d157,_0x22efe2[_0x46b0('0x12')][_0x46b0('0x13')]);return _0x105da6(_0x22efe2[_0x46b0('0x12')][_0x46b0('0x13')]);}else{logger[_0x46b0('0xc')](_0x46b0('0xd'),_0x51d157,_0x46b0('0x10'));_0x105da6(_0x22efe2[_0x46b0('0x14')]['message']);}})['catch'](function(_0x50329d){logger[_0x46b0('0x12')]('VoiceMail,\x20%s,\x20%s',_0x51d157,_0x50329d);_0x4fbed1(_0x50329d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ba1b11e..b59c4b1 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 _0xf286=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','download','post','/:id','delete','destroy','exports','util','path'];(function(_0x81dec8,_0x215d03){var _0x2eeb1b=function(_0x34a8ff){while(--_0x34a8ff){_0x81dec8['push'](_0x81dec8['shift']());}};_0x2eeb1b(++_0x215d03);}(_0xf286,0x1c6));var _0x6f28=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xf286[_0x9d1e6b];return _0x2b3070;};'use strict';var multer=require('multer');var util=require(_0x6f28('0x0'));var path=require(_0x6f28('0x1'));var timeout=require('connect-timeout');var express=require(_0x6f28('0x2'));var router=express[_0x6f28('0x3')]();var fs_extra=require(_0x6f28('0x4'));var auth=require(_0x6f28('0x5'));var interaction=require(_0x6f28('0x6'));var config=require('../../config/environment');var controller=require(_0x6f28('0x7'));router[_0x6f28('0x8')]('/',auth[_0x6f28('0x9')](),controller[_0x6f28('0xa')]);router[_0x6f28('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x6f28('0xb')]);router[_0x6f28('0x8')](_0x6f28('0xc'),auth[_0x6f28('0x9')](),controller[_0x6f28('0xd')]);router[_0x6f28('0xe')]('/',auth[_0x6f28('0x9')](),controller['create']);router['put'](_0x6f28('0xf'),auth[_0x6f28('0x9')](),controller['update']);router[_0x6f28('0x10')](_0x6f28('0xf'),auth[_0x6f28('0x9')](),controller[_0x6f28('0x11')]);module[_0x6f28('0x12')]=router; \ No newline at end of file +var _0x119d=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','download','create','update'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x119d,0x1b1));var _0xd119=function(_0x5a3c49,_0x48c249){_0x5a3c49=_0x5a3c49-0x0;var _0x54a3fb=_0x119d[_0x5a3c49];return _0x54a3fb;};'use strict';var multer=require(_0xd119('0x0'));var util=require(_0xd119('0x1'));var path=require(_0xd119('0x2'));var timeout=require(_0xd119('0x3'));var express=require(_0xd119('0x4'));var router=express[_0xd119('0x5')]();var fs_extra=require(_0xd119('0x6'));var auth=require(_0xd119('0x7'));var interaction=require(_0xd119('0x8'));var config=require(_0xd119('0x9'));var controller=require(_0xd119('0xa'));router[_0xd119('0xb')]('/',auth[_0xd119('0xc')](),controller['index']);router[_0xd119('0xb')](_0xd119('0xd'),auth[_0xd119('0xc')](),controller['show']);router['get']('/:id/download',auth[_0xd119('0xc')](),controller[_0xd119('0xe')]);router['post']('/',auth[_0xd119('0xc')](),controller[_0xd119('0xf')]);router['put'](_0xd119('0xd'),auth[_0xd119('0xc')](),controller[_0xd119('0x10')]);router['delete'](_0xd119('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xd119('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index efe162b..f30c998 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 _0xb866=['VIRTUAL','getDataValue','INTEGER','STRING','TIMESTAMP','literal','sequelize','exports'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0xb866,0x7e));var _0x6b86=function(_0x12887f,_0xa12862){_0x12887f=_0x12887f-0x0;var _0x37668a=_0xb866[_0x12887f];return _0x37668a;};'use strict';var Sequelize=require(_0x6b86('0x0'));module[_0x6b86('0x1')]={'name':{'type':Sequelize[_0x6b86('0x2')],'get':function(_0x4e56f9){return this[_0x6b86('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x6b86('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'callerid':{'type':Sequelize['STRING'],'defaultValue':''},'origtime':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize['BLOB']('long'),'defaultValue':null},'flag':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x6b86('0x5')],'defaultValue':''},'stamp':{'type':_0x6b86('0x6'),'defaultValue':Sequelize[_0x6b86('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xe2c1=['long','TIMESTAMP','exports','VIRTUAL','INTEGER','STRING'];(function(_0x296923,_0x4adaed){var _0x29af70=function(_0x4eeedb){while(--_0x4eeedb){_0x296923['push'](_0x296923['shift']());}};_0x29af70(++_0x4adaed);}(_0xe2c1,0x1ca));var _0x1e2c=function(_0x5c7e5e,_0x5e59f8){_0x5c7e5e=_0x5c7e5e-0x0;var _0x2d40cf=_0xe2c1[_0x5c7e5e];return _0x2d40cf;};'use strict';var Sequelize=require('sequelize');module[_0x1e2c('0x0')]={'name':{'type':Sequelize[_0x1e2c('0x1')],'get':function(_0xf78ba6){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0x1e2c('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x1e2c('0x4')),'defaultValue':null},'flag':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x1e2c('0x3')],'defaultValue':''},'stamp':{'type':_0x1e2c('0x5'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 6ceacf6..1c571b1 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 _0xa492=['../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','download','recording','msg_id','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x103d4a,_0x48ef14){var _0x4a15dc=function(_0x1de9f4){while(--_0x1de9f4){_0x103d4a['push'](_0x103d4a['shift']());}};_0x4a15dc(++_0x48ef14);}(_0xa492,0x8f));var _0x2a49=function(_0x25763a,_0x4e1c00){_0x25763a=_0x25763a-0x0;var _0x4df5a7=_0xa492[_0x25763a];return _0x4df5a7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a49('0x0'));var zipdir=require(_0x2a49('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2a49('0x2'));var Mustache=require(_0x2a49('0x3'));var util=require(_0x2a49('0x4'));var path=require(_0x2a49('0x5'));var sox=require('sox');var csv=require(_0x2a49('0x6'));var ejs=require(_0x2a49('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a49('0x8'));var squel=require(_0x2a49('0x9'));var crypto=require(_0x2a49('0xa'));var jsforce=require(_0x2a49('0xb'));var deskjs=require(_0x2a49('0xc'));var toCsv=require(_0x2a49('0x6'));var querystring=require(_0x2a49('0xd'));var Papa=require(_0x2a49('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2a49('0xf'));var as=require(_0x2a49('0x10'));var hardwareService=require(_0x2a49('0x11'));var logger=require(_0x2a49('0x12'))('api');var utils=require(_0x2a49('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2a49('0x14'));var db=require(_0x2a49('0x15'))['db'];function respondWithStatusCode(_0x22f62e,_0x5ed672){_0x5ed672=_0x5ed672||0xcc;return function(_0x1c5d65){if(_0x1c5d65){return _0x22f62e[_0x2a49('0x16')](_0x5ed672);}return _0x22f62e[_0x2a49('0x17')](_0x5ed672)['end']();};}function respondWithResult(_0xd6e899,_0x496ef5){_0x496ef5=_0x496ef5||0xc8;return function(_0x13470f){if(_0x13470f){return _0xd6e899[_0x2a49('0x17')](_0x496ef5)[_0x2a49('0x18')](_0x13470f);}};}function respondWithFilteredResult(_0x27ab76,_0x156c6a){return function(_0x89d6df){if(_0x89d6df){var _0x50c346=typeof _0x156c6a[_0x2a49('0x19')]===_0x2a49('0x1a')&&typeof _0x156c6a[_0x2a49('0x1b')]===_0x2a49('0x1a');var _0x4d2728=_0x89d6df[_0x2a49('0x1c')];var _0x5dbf48=_0x50c346?0x0:_0x156c6a['offset'];var _0x2a4c38=_0x50c346?_0x89d6df['count']:_0x156c6a[_0x2a49('0x19')]+_0x156c6a[_0x2a49('0x1b')];var _0x266c65;if(_0x2a4c38>=_0x4d2728){_0x2a4c38=_0x4d2728;_0x266c65=0xc8;}else{_0x266c65=0xce;}_0x27ab76[_0x2a49('0x17')](_0x266c65);return _0x27ab76[_0x2a49('0x1d')](_0x2a49('0x1e'),_0x5dbf48+'-'+_0x2a4c38+'/'+_0x4d2728)[_0x2a49('0x18')](_0x89d6df);}return null;};}function patchUpdates(_0x20997e){return function(_0x4cc46b){try{jsonpatch['apply'](_0x4cc46b,_0x20997e,!![]);}catch(_0x25999e){return BPromise[_0x2a49('0x1f')](_0x25999e);}return _0x4cc46b[_0x2a49('0x20')]();};}function saveUpdates(_0x28ae50,_0xb72e71){return function(_0x3efc0e){if(_0x3efc0e){return _0x3efc0e[_0x2a49('0x21')](_0x28ae50)[_0x2a49('0x22')](function(_0x1fe469){return _0x1fe469;});}return null;};}function removeEntity(_0x19fe98,_0x4ef51c){return function(_0x599fcd){if(_0x599fcd){return _0x599fcd[_0x2a49('0x23')]()[_0x2a49('0x22')](function(){_0x19fe98[_0x2a49('0x17')](0xcc)[_0x2a49('0x24')]();});}};}function handleEntityNotFound(_0x49f87b,_0x56ef89){return function(_0x466f94){if(!_0x466f94){_0x49f87b[_0x2a49('0x16')](0x194);}return _0x466f94;};}function handleError(_0xd89bf8,_0x42b339){_0x42b339=_0x42b339||0x1f4;return function(_0x87d367){logger['error'](_0x87d367[_0x2a49('0x25')]);if(_0x87d367[_0x2a49('0x26')]){delete _0x87d367[_0x2a49('0x26')];}_0xd89bf8['status'](_0x42b339)[_0x2a49('0x27')](_0x87d367);};}exports[_0x2a49('0x28')]=function(_0x4348ce,_0x25fd0d){var _0x17a3f8={},_0x343b37={},_0x4fbea6={'count':0x0,'rows':[]};var _0x50281c=_[_0x2a49('0x29')](db[_0x2a49('0x2a')][_0x2a49('0x2b')],function(_0x5296dc){return{'name':_0x5296dc[_0x2a49('0x2c')],'type':_0x5296dc[_0x2a49('0x2d')][_0x2a49('0x2e')]};});_0x343b37['model']=_['differenceBy'](_['map'](_0x50281c,_0x2a49('0x26')),['name']);_0x343b37['query']=_['keys'](_0x4348ce[_0x2a49('0x2f')]);_0x343b37[_0x2a49('0x30')]=_['intersection'](_0x343b37[_0x2a49('0x31')],_0x343b37[_0x2a49('0x2f')]);_0x17a3f8['attributes']=_[_0x2a49('0x32')](_0x343b37[_0x2a49('0x31')],qs[_0x2a49('0x33')](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x33')]));_0x17a3f8[_0x2a49('0x34')]=_0x17a3f8[_0x2a49('0x34')][_0x2a49('0x35')]?_0x17a3f8[_0x2a49('0x34')]:_0x343b37[_0x2a49('0x31')];if(!_0x4348ce[_0x2a49('0x2f')]['hasOwnProperty']('nolimit')){_0x17a3f8[_0x2a49('0x1b')]=qs[_0x2a49('0x1b')](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x1b')]);_0x17a3f8[_0x2a49('0x19')]=qs[_0x2a49('0x19')](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x19')]);}_0x17a3f8['order']=qs['sort'](_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x36')]);_0x17a3f8[_0x2a49('0x37')]=qs[_0x2a49('0x30')](_[_0x2a49('0x38')](_0x4348ce[_0x2a49('0x2f')],_0x343b37['filters']),_0x50281c);if(_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x39')]){_0x17a3f8[_0x2a49('0x37')]=_[_0x2a49('0x3a')](_0x17a3f8[_0x2a49('0x37')],{'$or':_[_0x2a49('0x29')](_0x50281c,function(_0x23c896){if(_0x23c896[_0x2a49('0x2d')]!==_0x2a49('0x3b')){var _0x1032d8={};_0x1032d8[_0x23c896[_0x2a49('0x26')]]={'$like':'%'+_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x39')]+'%'};return _0x1032d8;}})});}_0x17a3f8=_[_0x2a49('0x3a')]({},_0x17a3f8,_0x4348ce[_0x2a49('0x3c')]);var _0x39b71b={'where':_0x17a3f8[_0x2a49('0x37')]};return db[_0x2a49('0x2a')][_0x2a49('0x1c')](_0x39b71b)[_0x2a49('0x22')](function(_0x27e83){_0x4fbea6[_0x2a49('0x1c')]=_0x27e83;if(_0x4348ce[_0x2a49('0x2f')][_0x2a49('0x3d')]){_0x17a3f8[_0x2a49('0x3e')]=[{'all':!![]}];}return db[_0x2a49('0x2a')][_0x2a49('0x3f')](_0x17a3f8);})[_0x2a49('0x22')](function(_0x370e35){_0x4fbea6[_0x2a49('0x40')]=_0x370e35;return _0x4fbea6;})[_0x2a49('0x22')](respondWithFilteredResult(_0x25fd0d,_0x17a3f8))[_0x2a49('0x41')](handleError(_0x25fd0d,null));};exports[_0x2a49('0x42')]=function(_0x34c2dc,_0x30228a){var _0x17f028={'raw':!![],'where':{'id':_0x34c2dc[_0x2a49('0x43')]['id']}},_0x144c19={};_0x144c19[_0x2a49('0x31')]=_[_0x2a49('0x44')](db[_0x2a49('0x2a')][_0x2a49('0x2b')]);_0x144c19['query']=_[_0x2a49('0x44')](_0x34c2dc['query']);_0x144c19[_0x2a49('0x30')]=_[_0x2a49('0x32')](_0x144c19[_0x2a49('0x31')],_0x144c19['query']);_0x17f028[_0x2a49('0x34')]=_[_0x2a49('0x32')](_0x144c19['model'],qs[_0x2a49('0x33')](_0x34c2dc['query'][_0x2a49('0x33')]));_0x17f028['attributes']=_0x17f028[_0x2a49('0x34')][_0x2a49('0x35')]?_0x17f028[_0x2a49('0x34')]:_0x144c19[_0x2a49('0x31')];if(_0x34c2dc[_0x2a49('0x2f')][_0x2a49('0x3d')]){_0x17f028[_0x2a49('0x3e')]=[{'all':!![]}];}_0x17f028=_[_0x2a49('0x3a')]({},_0x17f028,_0x34c2dc[_0x2a49('0x3c')]);return db['VoiceMailMessage'][_0x2a49('0x45')](_0x17f028)[_0x2a49('0x22')](handleEntityNotFound(_0x30228a,null))[_0x2a49('0x22')](respondWithResult(_0x30228a,null))[_0x2a49('0x41')](handleError(_0x30228a,null));};exports[_0x2a49('0x46')]=function(_0x5ae078,_0x12dcea){return db[_0x2a49('0x2a')][_0x2a49('0x46')](_0x5ae078[_0x2a49('0x47')],{})[_0x2a49('0x22')](respondWithResult(_0x12dcea,0xc9))[_0x2a49('0x41')](handleError(_0x12dcea,null));};exports[_0x2a49('0x21')]=function(_0x5dbb28,_0xb93d15){if(_0x5dbb28['body']['id']){delete _0x5dbb28[_0x2a49('0x47')]['id'];}return db[_0x2a49('0x2a')][_0x2a49('0x45')]({'where':{'id':_0x5dbb28[_0x2a49('0x43')]['id']}})['then'](handleEntityNotFound(_0xb93d15,null))[_0x2a49('0x22')](saveUpdates(_0x5dbb28[_0x2a49('0x47')],null))[_0x2a49('0x22')](respondWithResult(_0xb93d15,null))['catch'](handleError(_0xb93d15,null));};exports[_0x2a49('0x23')]=function(_0x4b9fef,_0x563888){return db[_0x2a49('0x2a')]['find']({'where':{'id':_0x4b9fef[_0x2a49('0x43')]['id']}})['then'](handleEntityNotFound(_0x563888,null))['then'](removeEntity(_0x563888,null))['catch'](handleError(_0x563888,null));};exports[_0x2a49('0x48')]=function(_0x446505,_0x21a2b4,_0x58cc68){return db['VoiceMailMessage'][_0x2a49('0x45')]({'where':{'id':_0x446505[_0x2a49('0x43')]['id']},'attributes':['id',_0x2a49('0x49'),_0x2a49('0x4a')]})[_0x2a49('0x22')](handleEntityNotFound(_0x21a2b4,null))[_0x2a49('0x22')](function(_0x38dc41){if(_0x38dc41){if(!_0x38dc41['recording']){throw new db['Sequelize']['ValidationError'](_0x2a49('0x4b'));}var _0x5d027e={'Content-Type':'audio/wav','Content-Disposition':_0x2a49('0x4c')};if(_0x38dc41[_0x2a49('0x4a')]){_0x5d027e[_0x2a49('0x4d')]=_0x2a49('0x4e')+_0x38dc41[_0x2a49('0x4a')]+_0x2a49('0x4f');}_0x21a2b4[_0x2a49('0x1d')](_0x5d027e);return _0x21a2b4[_0x2a49('0x27')](new Buffer(_0x38dc41[_0x2a49('0x49')]));}})[_0x2a49('0x41')](handleError(_0x21a2b4,null));}; \ No newline at end of file +var _0xabf4=['stack','name','index','map','VoiceMailMessage','rawAttributes','type','key','model','differenceBy','keys','filters','query','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','create','body','catch','update','find','download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xabf4,0xe3));var _0x4abf=function(_0x4a795d,_0x3e5ba9){_0x4a795d=_0x4a795d-0x0;var _0x802826=_0xabf4[_0x4a795d];return _0x802826;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4abf('0x0'));var zipdir=require(_0x4abf('0x1'));var jsonpatch=require(_0x4abf('0x2'));var rp=require(_0x4abf('0x3'));var moment=require(_0x4abf('0x4'));var BPromise=require(_0x4abf('0x5'));var Mustache=require(_0x4abf('0x6'));var util=require('util');var path=require(_0x4abf('0x7'));var sox=require(_0x4abf('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4abf('0x9'));var squel=require(_0x4abf('0xa'));var crypto=require(_0x4abf('0xb'));var jsforce=require(_0x4abf('0xc'));var deskjs=require(_0x4abf('0xd'));var toCsv=require(_0x4abf('0xe'));var querystring=require(_0x4abf('0xf'));var Papa=require('papaparse');var Redis=require(_0x4abf('0x10'));var authService=require(_0x4abf('0x11'));var qs=require(_0x4abf('0x12'));var as=require(_0x4abf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4abf('0x14'))(_0x4abf('0x15'));var utils=require(_0x4abf('0x16'));var config=require(_0x4abf('0x17'));var licenseUtil=require(_0x4abf('0x18'));var db=require(_0x4abf('0x19'))['db'];function respondWithStatusCode(_0xe15e79,_0x27c6ff){_0x27c6ff=_0x27c6ff||0xcc;return function(_0x109499){if(_0x109499){return _0xe15e79[_0x4abf('0x1a')](_0x27c6ff);}return _0xe15e79[_0x4abf('0x1b')](_0x27c6ff)['end']();};}function respondWithResult(_0x5ca214,_0xf0d042){_0xf0d042=_0xf0d042||0xc8;return function(_0x1d70bb){if(_0x1d70bb){return _0x5ca214['status'](_0xf0d042)[_0x4abf('0x1c')](_0x1d70bb);}};}function respondWithFilteredResult(_0x184fd4,_0x593a21){return function(_0xdf8712){if(_0xdf8712){var _0x571281=typeof _0x593a21[_0x4abf('0x1d')]===_0x4abf('0x1e')&&typeof _0x593a21[_0x4abf('0x1f')]==='undefined';var _0x54039c=_0xdf8712[_0x4abf('0x20')];var _0x115fc8=_0x571281?0x0:_0x593a21[_0x4abf('0x1d')];var _0x2b2706=_0x571281?_0xdf8712[_0x4abf('0x20')]:_0x593a21[_0x4abf('0x1d')]+_0x593a21['limit'];var _0x446c08;if(_0x2b2706>=_0x54039c){_0x2b2706=_0x54039c;_0x446c08=0xc8;}else{_0x446c08=0xce;}_0x184fd4[_0x4abf('0x1b')](_0x446c08);return _0x184fd4[_0x4abf('0x21')](_0x4abf('0x22'),_0x115fc8+'-'+_0x2b2706+'/'+_0x54039c)[_0x4abf('0x1c')](_0xdf8712);}return null;};}function patchUpdates(_0xb32300){return function(_0x31b711){try{jsonpatch[_0x4abf('0x23')](_0x31b711,_0xb32300,!![]);}catch(_0x48c086){return BPromise['reject'](_0x48c086);}return _0x31b711[_0x4abf('0x24')]();};}function saveUpdates(_0x464fa3,_0x59da4e){return function(_0x5973bc){if(_0x5973bc){return _0x5973bc['update'](_0x464fa3)[_0x4abf('0x25')](function(_0x378351){return _0x378351;});}return null;};}function removeEntity(_0x5423c5,_0x1d2f96){return function(_0x49e628){if(_0x49e628){return _0x49e628[_0x4abf('0x26')]()[_0x4abf('0x25')](function(){_0x5423c5[_0x4abf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4630e5,_0x1bd771){return function(_0x541fe8){if(!_0x541fe8){_0x4630e5[_0x4abf('0x1a')](0x194);}return _0x541fe8;};}function handleError(_0xc7d17c,_0x17e958){_0x17e958=_0x17e958||0x1f4;return function(_0x11ed19){logger[_0x4abf('0x27')](_0x11ed19[_0x4abf('0x28')]);if(_0x11ed19[_0x4abf('0x29')]){delete _0x11ed19[_0x4abf('0x29')];}_0xc7d17c['status'](_0x17e958)['send'](_0x11ed19);};}exports[_0x4abf('0x2a')]=function(_0x5111d4,_0x4659a8){var _0x5dabb1={},_0x6f0aec={},_0x2ac820={'count':0x0,'rows':[]};var _0x8eaf21=_[_0x4abf('0x2b')](db[_0x4abf('0x2c')][_0x4abf('0x2d')],function(_0xbb641b){return{'name':_0xbb641b['fieldName'],'type':_0xbb641b[_0x4abf('0x2e')][_0x4abf('0x2f')]};});_0x6f0aec[_0x4abf('0x30')]=_[_0x4abf('0x31')](_[_0x4abf('0x2b')](_0x8eaf21,_0x4abf('0x29')),[_0x4abf('0x29')]);_0x6f0aec['query']=_[_0x4abf('0x32')](_0x5111d4['query']);_0x6f0aec[_0x4abf('0x33')]=_['intersection'](_0x6f0aec[_0x4abf('0x30')],_0x6f0aec[_0x4abf('0x34')]);_0x5dabb1['attributes']=_[_0x4abf('0x35')](_0x6f0aec[_0x4abf('0x30')],qs[_0x4abf('0x36')](_0x5111d4[_0x4abf('0x34')][_0x4abf('0x36')]));_0x5dabb1['attributes']=_0x5dabb1['attributes'][_0x4abf('0x37')]?_0x5dabb1[_0x4abf('0x38')]:_0x6f0aec[_0x4abf('0x30')];if(!_0x5111d4['query'][_0x4abf('0x39')](_0x4abf('0x3a'))){_0x5dabb1['limit']=qs[_0x4abf('0x1f')](_0x5111d4[_0x4abf('0x34')][_0x4abf('0x1f')]);_0x5dabb1[_0x4abf('0x1d')]=qs[_0x4abf('0x1d')](_0x5111d4['query'][_0x4abf('0x1d')]);}_0x5dabb1[_0x4abf('0x3b')]=qs['sort'](_0x5111d4['query']['sort']);_0x5dabb1[_0x4abf('0x3c')]=qs[_0x4abf('0x33')](_[_0x4abf('0x3d')](_0x5111d4[_0x4abf('0x34')],_0x6f0aec[_0x4abf('0x33')]),_0x8eaf21);if(_0x5111d4[_0x4abf('0x34')][_0x4abf('0x3e')]){_0x5dabb1[_0x4abf('0x3c')]=_[_0x4abf('0x3f')](_0x5dabb1['where'],{'$or':_['map'](_0x8eaf21,function(_0x53058e){if(_0x53058e['type']!==_0x4abf('0x40')){var _0x6f2f70={};_0x6f2f70[_0x53058e[_0x4abf('0x29')]]={'$like':'%'+_0x5111d4['query']['filter']+'%'};return _0x6f2f70;}})});}_0x5dabb1=_[_0x4abf('0x3f')]({},_0x5dabb1,_0x5111d4[_0x4abf('0x41')]);var _0x3c02db={'where':_0x5dabb1['where']};return db['VoiceMailMessage'][_0x4abf('0x20')](_0x3c02db)[_0x4abf('0x25')](function(_0x59438b){_0x2ac820[_0x4abf('0x20')]=_0x59438b;if(_0x5111d4[_0x4abf('0x34')][_0x4abf('0x42')]){_0x5dabb1[_0x4abf('0x43')]=[{'all':!![]}];}return db[_0x4abf('0x2c')][_0x4abf('0x44')](_0x5dabb1);})[_0x4abf('0x25')](function(_0xc124ae){_0x2ac820[_0x4abf('0x45')]=_0xc124ae;return _0x2ac820;})[_0x4abf('0x25')](respondWithFilteredResult(_0x4659a8,_0x5dabb1))['catch'](handleError(_0x4659a8,null));};exports[_0x4abf('0x46')]=function(_0x256440,_0x35e5c0){var _0x31cda9={'raw':!![],'where':{'id':_0x256440[_0x4abf('0x47')]['id']}},_0x3f252a={};_0x3f252a[_0x4abf('0x30')]=_['keys'](db[_0x4abf('0x2c')][_0x4abf('0x2d')]);_0x3f252a['query']=_['keys'](_0x256440[_0x4abf('0x34')]);_0x3f252a['filters']=_[_0x4abf('0x35')](_0x3f252a[_0x4abf('0x30')],_0x3f252a['query']);_0x31cda9[_0x4abf('0x38')]=_['intersection'](_0x3f252a[_0x4abf('0x30')],qs[_0x4abf('0x36')](_0x256440['query'][_0x4abf('0x36')]));_0x31cda9['attributes']=_0x31cda9[_0x4abf('0x38')][_0x4abf('0x37')]?_0x31cda9[_0x4abf('0x38')]:_0x3f252a[_0x4abf('0x30')];if(_0x256440[_0x4abf('0x34')][_0x4abf('0x42')]){_0x31cda9[_0x4abf('0x43')]=[{'all':!![]}];}_0x31cda9=_[_0x4abf('0x3f')]({},_0x31cda9,_0x256440[_0x4abf('0x41')]);return db[_0x4abf('0x2c')]['find'](_0x31cda9)[_0x4abf('0x25')](handleEntityNotFound(_0x35e5c0,null))[_0x4abf('0x25')](respondWithResult(_0x35e5c0,null))['catch'](handleError(_0x35e5c0,null));};exports[_0x4abf('0x48')]=function(_0x53e62e,_0x5310d0){return db[_0x4abf('0x2c')][_0x4abf('0x48')](_0x53e62e[_0x4abf('0x49')],{})[_0x4abf('0x25')](respondWithResult(_0x5310d0,0xc9))[_0x4abf('0x4a')](handleError(_0x5310d0,null));};exports[_0x4abf('0x4b')]=function(_0x5ed958,_0x40b349){if(_0x5ed958['body']['id']){delete _0x5ed958[_0x4abf('0x49')]['id'];}return db[_0x4abf('0x2c')][_0x4abf('0x4c')]({'where':{'id':_0x5ed958[_0x4abf('0x47')]['id']}})['then'](handleEntityNotFound(_0x40b349,null))[_0x4abf('0x25')](saveUpdates(_0x5ed958[_0x4abf('0x49')],null))['then'](respondWithResult(_0x40b349,null))[_0x4abf('0x4a')](handleError(_0x40b349,null));};exports['destroy']=function(_0x30ecdc,_0x1d075e){return db[_0x4abf('0x2c')]['find']({'where':{'id':_0x30ecdc[_0x4abf('0x47')]['id']}})[_0x4abf('0x25')](handleEntityNotFound(_0x1d075e,null))[_0x4abf('0x25')](removeEntity(_0x1d075e,null))['catch'](handleError(_0x1d075e,null));};exports[_0x4abf('0x4d')]=function(_0x184191,_0x4c1672,_0x2eecad){return db['VoiceMailMessage']['find']({'where':{'id':_0x184191['params']['id']},'attributes':['id','recording',_0x4abf('0x4e')]})['then'](handleEntityNotFound(_0x4c1672,null))[_0x4abf('0x25')](function(_0x37a6d5){if(_0x37a6d5){if(!_0x37a6d5[_0x4abf('0x4f')]){throw new db[(_0x4abf('0x50'))][(_0x4abf('0x51'))](_0x4abf('0x52'));}var _0x43bc04={'Content-Type':_0x4abf('0x53'),'Content-Disposition':_0x4abf('0x54')};if(_0x37a6d5['msg_id']){_0x43bc04[_0x4abf('0x55')]=_0x4abf('0x56')+_0x37a6d5[_0x4abf('0x4e')]+_0x4abf('0x57');}_0x4c1672[_0x4abf('0x21')](_0x43bc04);return _0x4c1672[_0x4abf('0x58')](new Buffer(_0x37a6d5[_0x4abf('0x4f')]));}})[_0x4abf('0x4a')](handleError(_0x4c1672,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index e93be03..a1d9983 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 _0xce85=['../../config/logger','moment','bluebird','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util'];(function(_0x2f8fbe,_0x194628){var _0x4aa12a=function(_0x5d2797){while(--_0x5d2797){_0x2f8fbe['push'](_0x2f8fbe['shift']());}};_0x4aa12a(++_0x194628);}(_0xce85,0x80));var _0x5ce8=function(_0x53a2e6,_0xcaff5c){_0x53a2e6=_0x53a2e6-0x0;var _0x4f13ac=_0xce85[_0x53a2e6];return _0x4f13ac;};'use strict';var _=require(_0x5ce8('0x0'));var util=require(_0x5ce8('0x1'));var logger=require(_0x5ce8('0x2'))('api');var moment=require(_0x5ce8('0x3'));var BPromise=require(_0x5ce8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce8('0x5'));var rimraf=require('rimraf');var config=require(_0x5ce8('0x6'));var attributes=require(_0x5ce8('0x7'));module[_0x5ce8('0x8')]=function(_0x1a5572,_0xd6f84){return _0x1a5572[_0x5ce8('0x9')](_0x5ce8('0xa'),attributes,{'tableName':_0x5ce8('0xb'),'paranoid':![],'indexes':[{'name':_0x5ce8('0xc'),'fields':[_0x5ce8('0xc')]}],'timestamps':![]});}; \ No newline at end of file +var _0x60a5=['dir','lodash','util','../../config/logger','bluebird','request-promise','exports','VoiceMailMessage','voice_voicemail_messages'];(function(_0xa4ffd6,_0x52a60e){var _0x286905=function(_0xf9947f){while(--_0xf9947f){_0xa4ffd6['push'](_0xa4ffd6['shift']());}};_0x286905(++_0x52a60e);}(_0x60a5,0x12a));var _0x560a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x60a5[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x560a('0x0'));var util=require(_0x560a('0x1'));var logger=require(_0x560a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x560a('0x3'));var rp=require(_0x560a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x560a('0x5')]=function(_0xed091d,_0x41f9d8){return _0xed091d['define'](_0x560a('0x6'),attributes,{'tableName':_0x560a('0x7'),'paranoid':![],'indexes':[{'name':_0x560a('0x8'),'fields':[_0x560a('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d536dc4..8b6d9c2 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 _0x39cf=['then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x39cf,0x1ee));var _0xf39c=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x39cf[_0x5550b3];return _0x4b8fc4;};'use strict';var _=require(_0xf39c('0x0'));var util=require(_0xf39c('0x1'));var moment=require(_0xf39c('0x2'));var BPromise=require('bluebird');var rs=require(_0xf39c('0x3'));var fs=require('fs');var Redis=require(_0xf39c('0x4'));var db=require(_0xf39c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf39c('0x6'))(_0xf39c('0x7'));var config=require(_0xf39c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xf39c('0x9')][_0xf39c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ab2ec,_0x3ce740,_0x33977f){return new BPromise(function(_0x3626ac,_0x3acc0e){return client[_0xf39c('0xb')](_0x5ab2ec,_0x33977f)[_0xf39c('0xc')](function(_0x254a35){logger[_0xf39c('0xd')](_0xf39c('0xe'),_0x3ce740,_0xf39c('0xf'));logger[_0xf39c('0x10')](_0xf39c('0x11'),_0x3ce740,'request\x20sent',JSON[_0xf39c('0x12')](_0x254a35));if(_0x254a35[_0xf39c('0x13')]){if(_0x254a35['error'][_0xf39c('0x14')]===0x1f4){logger[_0xf39c('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x3ce740,_0x254a35['error']['message']);return _0x3acc0e(_0x254a35[_0xf39c('0x13')][_0xf39c('0x15')]);}logger[_0xf39c('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x3ce740,_0x254a35['error'][_0xf39c('0x15')]);return _0x3626ac(_0x254a35['error'][_0xf39c('0x15')]);}else{logger['info'](_0xf39c('0xe'),_0x3ce740,'request\x20sent');_0x3626ac(_0x254a35['result']['message']);}})['catch'](function(_0x38318c){logger['error'](_0xf39c('0xe'),_0x3ce740,_0x38318c);_0x3acc0e(_0x38318c);});});} \ No newline at end of file +var _0xe50a=['then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xe50a,0x1d9));var _0xae50=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0xe50a[_0x333fc8];return _0x432439;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xae50('0x0'))['db'];var utils=require('../../config/utils');var logger=require(_0xae50('0x1'))(_0xae50('0x2'));var config=require(_0xae50('0x3'));var jayson=require(_0xae50('0x4'));var client=jayson['client'][_0xae50('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1c69d8,_0x2a179e,_0x27ac46){return new BPromise(function(_0x21fe8f,_0x4b9fe4){return client[_0xae50('0x6')](_0x1c69d8,_0x27ac46)[_0xae50('0x7')](function(_0x3a9992){logger[_0xae50('0x8')](_0xae50('0x9'),_0x2a179e,_0xae50('0xa'));logger['debug'](_0xae50('0xb'),_0x2a179e,_0xae50('0xa'),JSON['stringify'](_0x3a9992));if(_0x3a9992[_0xae50('0xc')]){if(_0x3a9992['error']['code']===0x1f4){logger['error'](_0xae50('0x9'),_0x2a179e,_0x3a9992['error']['message']);return _0x4b9fe4(_0x3a9992[_0xae50('0xc')][_0xae50('0xd')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x2a179e,_0x3a9992['error'][_0xae50('0xd')]);return _0x21fe8f(_0x3a9992[_0xae50('0xc')][_0xae50('0xd')]);}else{logger[_0xae50('0x8')](_0xae50('0x9'),_0x2a179e,'request\x20sent');_0x21fe8f(_0x3a9992[_0xae50('0xe')]['message']);}})[_0xae50('0xf')](function(_0x1d51a4){logger[_0xae50('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x2a179e,_0x1d51a4);_0x4b9fe4(_0x1d51a4);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 76fd34d..7e61444 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 _0x0ee9=['index','/:id','show','/:id/sounds','create','addSound','put','destroy','delete','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated'];(function(_0xff7c05,_0x2456ca){var _0x1c1ab9=function(_0x187d56){while(--_0x187d56){_0xff7c05['push'](_0xff7c05['shift']());}};_0x1c1ab9(++_0x2456ca);}(_0x0ee9,0x165));var _0x90ee=function(_0x37038e,_0x40809f){_0x37038e=_0x37038e-0x0;var _0xa28216=_0x0ee9[_0x37038e];return _0xa28216;};'use strict';var multer=require(_0x90ee('0x0'));var util=require(_0x90ee('0x1'));var path=require(_0x90ee('0x2'));var timeout=require('connect-timeout');var express=require(_0x90ee('0x3'));var router=express[_0x90ee('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x90ee('0x5'));var interaction=require(_0x90ee('0x6'));var config=require(_0x90ee('0x7'));var controller=require(_0x90ee('0x8'));router[_0x90ee('0x9')]('/',auth[_0x90ee('0xa')](),controller[_0x90ee('0xb')]);router['get'](_0x90ee('0xc'),auth[_0x90ee('0xa')](),controller[_0x90ee('0xd')]);router['get'](_0x90ee('0xe'),auth[_0x90ee('0xa')](),controller['getSounds']);router['post']('/',auth[_0x90ee('0xa')](),controller[_0x90ee('0xf')]);router['post']('/:id/sounds',auth[_0x90ee('0xa')](),controller[_0x90ee('0x10')]);router[_0x90ee('0x11')](_0x90ee('0xc'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x90ee('0xa')](),controller[_0x90ee('0x12')]);router[_0x90ee('0x13')](_0x90ee('0x14'),auth['isAuthenticated'](),controller[_0x90ee('0x15')]);module[_0x90ee('0x16')]=router; \ No newline at end of file +var _0xc334=['index','get','show','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','isAuthenticated'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xc334,0xc7));var _0x4c33=function(_0x2fb932,_0x2b0044){_0x2fb932=_0x2fb932-0x0;var _0x438dd4=_0xc334[_0x2fb932];return _0x438dd4;};'use strict';var multer=require(_0x4c33('0x0'));var util=require('util');var path=require(_0x4c33('0x1'));var timeout=require(_0x4c33('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c33('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4c33('0x4'));var config=require(_0x4c33('0x5'));var controller=require(_0x4c33('0x6'));router['get']('/',auth[_0x4c33('0x7')](),controller[_0x4c33('0x8')]);router[_0x4c33('0x9')]('/:id',auth[_0x4c33('0x7')](),controller[_0x4c33('0xa')]);router[_0x4c33('0x9')](_0x4c33('0xb'),auth[_0x4c33('0x7')](),controller[_0x4c33('0xc')]);router[_0x4c33('0xd')]('/',auth[_0x4c33('0x7')](),controller[_0x4c33('0xe')]);router['post'](_0x4c33('0xb'),auth[_0x4c33('0x7')](),controller[_0x4c33('0xf')]);router[_0x4c33('0x10')](_0x4c33('0x11'),auth[_0x4c33('0x7')](),controller[_0x4c33('0x12')]);router[_0x4c33('0x13')]('/:id',auth[_0x4c33('0x7')](),controller[_0x4c33('0x14')]);router[_0x4c33('0x13')](_0x4c33('0x15'),auth['isAuthenticated'](),controller[_0x4c33('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index d63ae2b..96a14cc 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 _0xc009=['custom','quietmp3nb','quietmp3','files','STRING','TIMESTAMP','BOOLEAN','sequelize','exports','name'];(function(_0x4f920d,_0x221271){var _0x2120e0=function(_0x468736){while(--_0x468736){_0x4f920d['push'](_0x4f920d['shift']());}};_0x2120e0(++_0x221271);}(_0xc009,0x179));var _0x9c00=function(_0x480e7f,_0x199e38){_0x480e7f=_0x480e7f-0x0;var _0x4b432a=_0xc009[_0x480e7f];return _0x4b432a;};'use strict';var Sequelize=require(_0x9c00('0x0'));module[_0x9c00('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9c00('0x2')},'mode':{'type':Sequelize['ENUM'](_0x9c00('0x3'),'files','mp3nb',_0x9c00('0x4'),_0x9c00('0x5'),'mp3'),'allowNull':!![],'defaultValue':_0x9c00('0x6')},'directory':{'type':Sequelize[_0x9c00('0x7')],'allowNull':!![]},'application':{'type':Sequelize[_0x9c00('0x7')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x9c00('0x7')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x9c00('0x8')},'defaultEntry':{'type':Sequelize[_0x9c00('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x14b3=['custom','quietmp3nb','mp3','files','alpha','TIMESTAMP','BOOLEAN','sequelize','exports','STRING','ENUM'];(function(_0x46da4e,_0x551764){var _0x193f69=function(_0x5e3327){while(--_0x5e3327){_0x46da4e['push'](_0x46da4e['shift']());}};_0x193f69(++_0x551764);}(_0x14b3,0xcd));var _0x314b=function(_0x15d9bc,_0x513b46){_0x15d9bc=_0x15d9bc-0x0;var _0x5868fe=_0x14b3[_0x15d9bc];return _0x5868fe;};'use strict';var Sequelize=require(_0x314b('0x0'));module[_0x314b('0x1')]={'name':{'type':Sequelize[_0x314b('0x2')],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x314b('0x3')](_0x314b('0x4'),'files','mp3nb',_0x314b('0x5'),'quietmp3',_0x314b('0x6')),'allowNull':!![],'defaultValue':_0x314b('0x7')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x314b('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x314b('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0x314b('0x2')],'allowNull':!![],'defaultValue':_0x314b('0x8')},'format':{'type':Sequelize[_0x314b('0x2')],'allowNull':!![]},'stamp':{'type':_0x314b('0x9')},'defaultEntry':{'type':Sequelize[_0x314b('0xa')],'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 b6ccf38..f582016 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 _0x69f3=['sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','then','MusicOnHolds','UserProfileResource','destroy','error','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','rows','show','params','include','catch','update','body','find','create','mode','files','join','root','server/files/moh','mkdirSync','directory','0777','user','get','role','UserProfileSection','userProfileId','autoAssociation','sequelize','transaction','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','basename','extname','symlinkSync','message','removeSound','id2','Sound','getSounds','keys','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x11e82b,_0x390817){var _0xe826f1=function(_0x41f463){while(--_0x41f463){_0x11e82b['push'](_0x11e82b['shift']());}};_0xe826f1(++_0x390817);}(_0x69f3,0x142));var _0x369f=function(_0x4308a2,_0x558b21){_0x4308a2=_0x4308a2-0x0;var _0x106fcc=_0x69f3[_0x4308a2];return _0x106fcc;};'use strict';var emlformat=require(_0x369f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x369f('0x1'));var jsonpatch=require(_0x369f('0x2'));var rp=require(_0x369f('0x3'));var moment=require(_0x369f('0x4'));var BPromise=require(_0x369f('0x5'));var Mustache=require(_0x369f('0x6'));var util=require(_0x369f('0x7'));var path=require(_0x369f('0x8'));var sox=require(_0x369f('0x9'));var csv=require(_0x369f('0xa'));var ejs=require(_0x369f('0xb'));var fs=require('fs');var fs_extra=require(_0x369f('0xc'));var _=require(_0x369f('0xd'));var squel=require(_0x369f('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x369f('0xf'));var toCsv=require(_0x369f('0xa'));var querystring=require(_0x369f('0x10'));var Papa=require(_0x369f('0x11'));var Redis=require('ioredis');var authService=require(_0x369f('0x12'));var qs=require(_0x369f('0x13'));var as=require(_0x369f('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x369f('0x15'))(_0x369f('0x16'));var utils=require(_0x369f('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x369f('0x18'));var db=require(_0x369f('0x19'))['db'];function respondWithStatusCode(_0x43e899,_0xb6b9e1){_0xb6b9e1=_0xb6b9e1||0xcc;return function(_0x305316){if(_0x305316){return _0x43e899[_0x369f('0x1a')](_0xb6b9e1);}return _0x43e899[_0x369f('0x1b')](_0xb6b9e1)[_0x369f('0x1c')]();};}function respondWithResult(_0x3084c5,_0x3c1cd5){_0x3c1cd5=_0x3c1cd5||0xc8;return function(_0x10e4b5){if(_0x10e4b5){return _0x3084c5['status'](_0x3c1cd5)[_0x369f('0x1d')](_0x10e4b5);}};}function respondWithFilteredResult(_0x39ce92,_0x4e30b5){return function(_0x13447e){if(_0x13447e){var _0x4162af=typeof _0x4e30b5[_0x369f('0x1e')]===_0x369f('0x1f')&&typeof _0x4e30b5['limit']===_0x369f('0x1f');var _0x58ad24=_0x13447e['count'];var _0x14c658=_0x4162af?0x0:_0x4e30b5[_0x369f('0x1e')];var _0x31e95c=_0x4162af?_0x13447e[_0x369f('0x20')]:_0x4e30b5[_0x369f('0x1e')]+_0x4e30b5[_0x369f('0x21')];var _0x3843ff;if(_0x31e95c>=_0x58ad24){_0x31e95c=_0x58ad24;_0x3843ff=0xc8;}else{_0x3843ff=0xce;}_0x39ce92[_0x369f('0x1b')](_0x3843ff);return _0x39ce92[_0x369f('0x22')]('Content-Range',_0x14c658+'-'+_0x31e95c+'/'+_0x58ad24)[_0x369f('0x1d')](_0x13447e);}return null;};}function patchUpdates(_0x191bed){return function(_0x2a513d){try{jsonpatch['apply'](_0x2a513d,_0x191bed,!![]);}catch(_0x4e3dbe){return BPromise[_0x369f('0x23')](_0x4e3dbe);}return _0x2a513d[_0x369f('0x24')]();};}function saveUpdates(_0x293d76,_0x465f3f){return function(_0x1f4214){if(_0x1f4214){return _0x1f4214['update'](_0x293d76)['then'](function(_0x2ac875){return _0x2ac875;});}return null;};}function removeEntity(_0x9b04b6,_0x32ef89){return function(_0x1221d8){if(_0x1221d8){return _0x1221d8['destroy']()[_0x369f('0x25')](function(){var _0x3b48a8=_0x1221d8['get']({'plain':!![]});var _0x4399e8=_0x369f('0x26');return db[_0x369f('0x27')][_0x369f('0x28')]({'where':{'type':_0x4399e8,'resourceId':_0x3b48a8['id']}})[_0x369f('0x25')](function(){return _0x1221d8;});})[_0x369f('0x25')](function(){_0x9b04b6[_0x369f('0x1b')](0xcc)[_0x369f('0x1c')]();});}};}function handleEntityNotFound(_0x2b5346,_0x17e0a6){return function(_0x5bf138){if(!_0x5bf138){_0x2b5346[_0x369f('0x1a')](0x194);}return _0x5bf138;};}function handleError(_0x30c19d,_0x403786){_0x403786=_0x403786||0x1f4;return function(_0x116036){logger[_0x369f('0x29')](_0x116036['stack']);if(_0x116036[_0x369f('0x2a')]){delete _0x116036[_0x369f('0x2a')];}_0x30c19d[_0x369f('0x1b')](_0x403786)[_0x369f('0x2b')](_0x116036);};}exports[_0x369f('0x2c')]=function(_0x40a41e,_0x38b50b){var _0x349bdf={},_0x5a42b0={},_0x1b8669={'count':0x0,'rows':[]};var _0x1e4270=_[_0x369f('0x2d')](db[_0x369f('0x2e')][_0x369f('0x2f')],function(_0x11ec14){return{'name':_0x11ec14[_0x369f('0x30')],'type':_0x11ec14[_0x369f('0x31')][_0x369f('0x32')]};});_0x5a42b0[_0x369f('0x33')]=_[_0x369f('0x2d')](_0x1e4270,_0x369f('0x2a'));_0x5a42b0[_0x369f('0x34')]=_['keys'](_0x40a41e['query']);_0x5a42b0['filters']=_[_0x369f('0x35')](_0x5a42b0['model'],_0x5a42b0[_0x369f('0x34')]);_0x349bdf[_0x369f('0x36')]=_[_0x369f('0x35')](_0x5a42b0[_0x369f('0x33')],qs[_0x369f('0x37')](_0x40a41e['query'][_0x369f('0x37')]));_0x349bdf[_0x369f('0x36')]=_0x349bdf[_0x369f('0x36')][_0x369f('0x38')]?_0x349bdf[_0x369f('0x36')]:_0x5a42b0[_0x369f('0x33')];if(!_0x40a41e[_0x369f('0x34')][_0x369f('0x39')](_0x369f('0x3a'))){_0x349bdf[_0x369f('0x21')]=qs[_0x369f('0x21')](_0x40a41e[_0x369f('0x34')][_0x369f('0x21')]);_0x349bdf[_0x369f('0x1e')]=qs[_0x369f('0x1e')](_0x40a41e['query'][_0x369f('0x1e')]);}_0x349bdf[_0x369f('0x3b')]=qs[_0x369f('0x3c')](_0x40a41e['query'][_0x369f('0x3c')]);delete _0x40a41e['query'][_0x369f('0x3c')];_0x349bdf[_0x369f('0x3d')]=qs[_0x369f('0x3e')](_[_0x369f('0x3f')](_0x40a41e[_0x369f('0x34')],_0x5a42b0[_0x369f('0x3e')]),_0x1e4270);if(_0x40a41e['query']['filter']){_0x349bdf[_0x369f('0x3d')]=_[_0x369f('0x40')](_0x349bdf[_0x369f('0x3d')],{'$or':_[_0x369f('0x2d')](_0x1e4270,function(_0x90749b){if(_0x90749b['type']!==_0x369f('0x41')){var _0x32706c={};_0x32706c[_0x90749b['name']]={'$like':'%'+_0x40a41e[_0x369f('0x34')][_0x369f('0x42')]+'%'};return _0x32706c;}})});}_0x349bdf=_[_0x369f('0x40')]({},_0x349bdf,_0x40a41e[_0x369f('0x43')]);var _0x59a8ec={'where':_0x349bdf[_0x369f('0x3d')]};return db[_0x369f('0x2e')][_0x369f('0x20')](_0x59a8ec)[_0x369f('0x25')](function(_0x52cb7d){_0x1b8669[_0x369f('0x20')]=_0x52cb7d;if(_0x40a41e['query'][_0x369f('0x44')]){_0x349bdf['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x349bdf);})['then'](function(_0x48e653){_0x1b8669[_0x369f('0x45')]=_0x48e653;return _0x1b8669;})[_0x369f('0x25')](respondWithFilteredResult(_0x38b50b,_0x349bdf))['catch'](handleError(_0x38b50b,null));};exports[_0x369f('0x46')]=function(_0x262698,_0x3bedd4){var _0xa9a463={'raw':![],'where':{'id':_0x262698[_0x369f('0x47')]['id']}},_0x50f991={};_0x50f991['model']=_['keys'](db[_0x369f('0x2e')][_0x369f('0x2f')]);_0x50f991['query']=_['keys'](_0x262698[_0x369f('0x34')]);_0x50f991['filters']=_[_0x369f('0x35')](_0x50f991[_0x369f('0x33')],_0x50f991[_0x369f('0x34')]);_0xa9a463[_0x369f('0x36')]=_[_0x369f('0x35')](_0x50f991[_0x369f('0x33')],qs[_0x369f('0x37')](_0x262698[_0x369f('0x34')][_0x369f('0x37')]));_0xa9a463[_0x369f('0x36')]=_0xa9a463[_0x369f('0x36')][_0x369f('0x38')]?_0xa9a463['attributes']:_0x50f991[_0x369f('0x33')];if(_0x262698[_0x369f('0x34')]['includeAll']){_0xa9a463[_0x369f('0x48')]=[{'all':!![]}];}_0xa9a463=_[_0x369f('0x40')]({},_0xa9a463,_0x262698[_0x369f('0x43')]);return db[_0x369f('0x2e')]['find'](_0xa9a463)[_0x369f('0x25')](handleEntityNotFound(_0x3bedd4,null))[_0x369f('0x25')](respondWithResult(_0x3bedd4,null))[_0x369f('0x49')](handleError(_0x3bedd4,null));};exports[_0x369f('0x4a')]=function(_0x363417,_0x36531e){if(_0x363417[_0x369f('0x4b')]['id']){delete _0x363417[_0x369f('0x4b')]['id'];}return db[_0x369f('0x2e')][_0x369f('0x4c')]({'where':{'id':_0x363417[_0x369f('0x47')]['id']}})[_0x369f('0x25')](handleEntityNotFound(_0x36531e,null))[_0x369f('0x25')](saveUpdates(_0x363417[_0x369f('0x4b')],null))[_0x369f('0x25')](respondWithResult(_0x36531e,null))['catch'](handleError(_0x36531e,null));};exports[_0x369f('0x4d')]=function(_0x166a99,_0xe5c2bf,_0x272974){return db['sequelize']['transaction'](function(_0x23c85f){if(_0x166a99[_0x369f('0x4b')][_0x369f('0x4e')]===_0x369f('0x4f')){_0x166a99[_0x369f('0x4b')]['directory']=path[_0x369f('0x50')](config[_0x369f('0x51')],_0x369f('0x52'),_0x166a99[_0x369f('0x4b')]['name']);}return db[_0x369f('0x2e')][_0x369f('0x4d')](_0x166a99['body'],{'transaction':_0x23c85f})['then'](function(_0x520507){if(_0x166a99[_0x369f('0x4b')]['mode']===_0x369f('0x4f')){fs[_0x369f('0x53')](_0x520507[_0x369f('0x54')],parseInt(_0x369f('0x55'),0x8));}var _0x3ed125=_0x166a99[_0x369f('0x56')][_0x369f('0x57')]({'plain':!![]});if(!_0x3ed125)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ed125[_0x369f('0x58')]===_0x369f('0x56')){var _0x2a7ab6=_0x520507[_0x369f('0x57')]({'plain':!![]});return db[_0x369f('0x59')][_0x369f('0x4c')]({'where':{'name':_0x369f('0x26'),'userProfileId':_0x3ed125[_0x369f('0x5a')]},'raw':!![]})[_0x369f('0x25')](function(_0x6e345d){if(_0x6e345d&&_0x6e345d[_0x369f('0x5b')]===0x0){return db[_0x369f('0x27')][_0x369f('0x4d')]({'name':_0x2a7ab6[_0x369f('0x2a')],'resourceId':_0x2a7ab6['id'],'type':_0x6e345d[_0x369f('0x2a')],'sectionId':_0x6e345d['id']},{})[_0x369f('0x25')](function(){return _0x520507;});}else{return _0x520507;}})[_0x369f('0x49')](function(_0x2c0877){logger[_0x369f('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c0877);});}return _0x520507;});})[_0x369f('0x25')](respondWithResult(_0xe5c2bf,0xc9))[_0x369f('0x49')](handleError(_0xe5c2bf,null));};exports[_0x369f('0x28')]=function(_0x174b2a,_0x5a932d,_0x1d21a5){var _0x33f871;return db[_0x369f('0x2e')][_0x369f('0x4c')]({'where':{'id':_0x174b2a['params']['id']}})[_0x369f('0x25')](function(_0x265d4e){if(_0x265d4e){return db[_0x369f('0x5c')][_0x369f('0x5d')](function(_0x3ad594){return _0x265d4e[_0x369f('0x28')]({'transaction':_0x3ad594,'raw':!![]})[_0x369f('0x25')](function(_0x4768fb){if(_0x4768fb[_0x369f('0x54')]){fs[_0x369f('0x5e')](_0x4768fb[_0x369f('0x54')])[_0x369f('0x5f')](function(_0x19e5bb){fs[_0x369f('0x60')](path[_0x369f('0x50')](_0x4768fb[_0x369f('0x54')],_0x19e5bb));});fs[_0x369f('0x61')](_0x4768fb[_0x369f('0x54')]);}return _0x4768fb;});})[_0x369f('0x49')](function(_0x215d7f){throw new db[(_0x369f('0x62'))][(_0x369f('0x63'))](_0x215d7f['message']);});}})[_0x369f('0x25')](handleEntityNotFound(_0x5a932d,null))[_0x369f('0x25')](removeEntity(_0x5a932d,null))[_0x369f('0x49')](handleError(_0x5a932d,null));};exports['addSound']=function(_0x126a43,_0x3aad1a,_0x5e5fb3){return db[_0x369f('0x5c')][_0x369f('0x5d')](function(_0x1b09c5){var _0x183c94;return db['VoiceMusicOnHold'][_0x369f('0x4c')]({'where':{'id':_0x126a43[_0x369f('0x47')]['id']}})[_0x369f('0x25')](function(_0x457bc7){if(_0x457bc7){_0x183c94=_0x457bc7;return _0x457bc7[_0x369f('0x64')](_0x126a43['body']['id'],{'transaction':_0x1b09c5});}})[_0x369f('0x25')](function(_0xafad9){if(_0xafad9){return db['Sound'][_0x369f('0x65')]({'where':{'id':_0x126a43[_0x369f('0x4b')]['id']},'attributes':['id','name',_0x369f('0x66'),_0x369f('0x67'),_0x369f('0x68')],'raw':!![]});}})['then'](function(_0x4c244a){if(_0x4c244a){var _0x2dfb0f=path[_0x369f('0x50')](config[_0x369f('0x51')],'server/files/sounds/converted',util[_0x369f('0x69')](_0x369f('0x6a'),path[_0x369f('0x6b')](_0x4c244a['save_name'],path[_0x369f('0x6c')](_0x4c244a[_0x369f('0x66')])),_0x4c244a[_0x369f('0x67')]));var _0x19b0c1=path[_0x369f('0x50')](config[_0x369f('0x51')],_0x369f('0x52'),_0x183c94['name'],util[_0x369f('0x69')](_0x369f('0x6a'),_0x4c244a['name'],_0x4c244a[_0x369f('0x67')]));fs[_0x369f('0x6d')](_0x2dfb0f,_0x19b0c1);return _0x4c244a;}})[_0x369f('0x49')](function(_0x48271b){throw new db['Sequelize'][(_0x369f('0x63'))](_0x48271b[_0x369f('0x6e')]);});})[_0x369f('0x25')](handleEntityNotFound(_0x3aad1a,null))[_0x369f('0x25')](respondWithResult(_0x3aad1a,0xc9))['catch'](handleError(_0x3aad1a,null));};exports[_0x369f('0x6f')]=function(_0x383f15,_0x51c801,_0x186e34){return db[_0x369f('0x5c')][_0x369f('0x5d')](function(_0x1bdd3f){var _0x2722cd;return db['VoiceMusicOnHold'][_0x369f('0x65')]({'where':{'id':_0x383f15[_0x369f('0x47')]['id']}})[_0x369f('0x25')](handleEntityNotFound(_0x51c801,null))['then'](function(_0x210b08){if(_0x210b08){_0x2722cd=_0x210b08;return _0x210b08[_0x369f('0x6f')](_0x383f15['params'][_0x369f('0x70')]);}})[_0x369f('0x25')](function(_0x23562d){if(_0x23562d){return db[_0x369f('0x71')]['findOne']({'where':{'id':_0x383f15['params']['id2']},'attributes':['id',_0x369f('0x2a'),_0x369f('0x66'),_0x369f('0x67'),_0x369f('0x68')],'raw':!![]});}})[_0x369f('0x25')](function(_0x49545b){if(_0x49545b){fs[_0x369f('0x60')](path[_0x369f('0x50')](_0x2722cd[_0x369f('0x54')],util['format'](_0x369f('0x6a'),_0x49545b[_0x369f('0x2a')],_0x49545b[_0x369f('0x67')])));return _0x49545b;}})[_0x369f('0x49')](function(_0x22663d){throw new db[(_0x369f('0x62'))][(_0x369f('0x63'))](_0x22663d[_0x369f('0x6e')]);});})['then'](handleEntityNotFound(_0x51c801,null))[_0x369f('0x25')](respondWithStatusCode(_0x51c801,0xcc))['catch'](handleError(_0x51c801,null));};exports[_0x369f('0x72')]=function(_0x3dbede,_0x337d05,_0x45de3a){var _0x2332da={};var _0x4c2698={};var _0x54de43;var _0x1d29ec;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x3dbede['params']['id']}})[_0x369f('0x25')](handleEntityNotFound(_0x337d05,null))[_0x369f('0x25')](function(_0x495a44){if(_0x495a44){_0x54de43=_0x495a44;_0x4c2698[_0x369f('0x33')]=_[_0x369f('0x73')](db['Sound'][_0x369f('0x2f')]);_0x4c2698['query']=_[_0x369f('0x73')](_0x3dbede['query']);_0x4c2698[_0x369f('0x3e')]=_[_0x369f('0x35')](_0x4c2698['model'],_0x4c2698[_0x369f('0x34')]);_0x2332da['attributes']=_[_0x369f('0x35')](_0x4c2698[_0x369f('0x33')],qs[_0x369f('0x37')](_0x3dbede[_0x369f('0x34')][_0x369f('0x37')]));_0x2332da[_0x369f('0x36')]=_0x2332da[_0x369f('0x36')][_0x369f('0x38')]?_0x2332da[_0x369f('0x36')]:_0x4c2698['model'];_0x2332da[_0x369f('0x3b')]=qs['sort'](_0x3dbede[_0x369f('0x34')][_0x369f('0x3c')]);_0x2332da[_0x369f('0x3d')]=qs['filters'](_['pick'](_0x3dbede['query'],_0x4c2698[_0x369f('0x3e')]));if(_0x3dbede[_0x369f('0x34')][_0x369f('0x42')]){_0x2332da[_0x369f('0x3d')]=_[_0x369f('0x40')](_0x2332da['where'],{'$or':_[_0x369f('0x2d')](_0x2332da[_0x369f('0x36')],function(_0x4dd23c){var _0x5e3d8a={};_0x5e3d8a[_0x4dd23c]={'$like':'%'+_0x3dbede[_0x369f('0x34')][_0x369f('0x42')]+'%'};return _0x5e3d8a;})});}_0x2332da=_[_0x369f('0x40')]({},_0x2332da,_0x3dbede['options']);return _0x54de43['getSounds'](_0x2332da);}})[_0x369f('0x25')](function(_0x5e8dbe){if(_0x5e8dbe){_0x1d29ec=_0x5e8dbe[_0x369f('0x38')];if(!_0x3dbede['query'][_0x369f('0x39')]('nolimit')){_0x2332da[_0x369f('0x21')]=qs[_0x369f('0x21')](_0x3dbede[_0x369f('0x34')][_0x369f('0x21')]);_0x2332da[_0x369f('0x1e')]=qs[_0x369f('0x1e')](_0x3dbede[_0x369f('0x34')][_0x369f('0x1e')]);}return _0x54de43[_0x369f('0x72')](_0x2332da);}})[_0x369f('0x25')](function(_0x24e8d7){if(_0x24e8d7){return _0x24e8d7?{'count':_0x1d29ec,'rows':_0x24e8d7}:null;}})[_0x369f('0x25')](respondWithResult(_0x337d05,null))['catch'](handleError(_0x337d05,null));}; \ No newline at end of file +var _0x5809=['crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','send','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','body','create','sequelize','root','server/files/moh','mode','files','directory','user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','transaction','readdirSync','forEach','unlinkSync','join','Sequelize','ValidationError','message','addSound','findOne','save_name','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','Sound','converted_format','getSounds','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x4f2cef,_0x24373a){var _0x2e0186=function(_0x46db9b){while(--_0x46db9b){_0x4f2cef['push'](_0x4f2cef['shift']());}};_0x2e0186(++_0x24373a);}(_0x5809,0xd3));var _0x9580=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5809[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9580('0x0'));var rimraf=require(_0x9580('0x1'));var zipdir=require(_0x9580('0x2'));var jsonpatch=require(_0x9580('0x3'));var rp=require(_0x9580('0x4'));var moment=require(_0x9580('0x5'));var BPromise=require(_0x9580('0x6'));var Mustache=require(_0x9580('0x7'));var util=require(_0x9580('0x8'));var path=require(_0x9580('0x9'));var sox=require(_0x9580('0xa'));var csv=require(_0x9580('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9580('0xc'));var _=require(_0x9580('0xd'));var squel=require(_0x9580('0xe'));var crypto=require(_0x9580('0xf'));var jsforce=require(_0x9580('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x9580('0xb'));var querystring=require(_0x9580('0x11'));var Papa=require('papaparse');var Redis=require(_0x9580('0x12'));var authService=require(_0x9580('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9580('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9580('0x15'));var db=require(_0x9580('0x16'))['db'];function respondWithStatusCode(_0xfc6465,_0x1b3a9b){_0x1b3a9b=_0x1b3a9b||0xcc;return function(_0x426521){if(_0x426521){return _0xfc6465[_0x9580('0x17')](_0x1b3a9b);}return _0xfc6465[_0x9580('0x18')](_0x1b3a9b)[_0x9580('0x19')]();};}function respondWithResult(_0x46173e,_0x5f43d7){_0x5f43d7=_0x5f43d7||0xc8;return function(_0x4b34b6){if(_0x4b34b6){return _0x46173e[_0x9580('0x18')](_0x5f43d7)[_0x9580('0x1a')](_0x4b34b6);}};}function respondWithFilteredResult(_0x28d167,_0xa4c26a){return function(_0x5072cb){if(_0x5072cb){var _0x1e75ad=typeof _0xa4c26a[_0x9580('0x1b')]===_0x9580('0x1c')&&typeof _0xa4c26a['limit']==='undefined';var _0x1cac09=_0x5072cb['count'];var _0x151687=_0x1e75ad?0x0:_0xa4c26a[_0x9580('0x1b')];var _0x44de95=_0x1e75ad?_0x5072cb[_0x9580('0x1d')]:_0xa4c26a[_0x9580('0x1b')]+_0xa4c26a['limit'];var _0x94a252;if(_0x44de95>=_0x1cac09){_0x44de95=_0x1cac09;_0x94a252=0xc8;}else{_0x94a252=0xce;}_0x28d167[_0x9580('0x18')](_0x94a252);return _0x28d167['set'](_0x9580('0x1e'),_0x151687+'-'+_0x44de95+'/'+_0x1cac09)[_0x9580('0x1a')](_0x5072cb);}return null;};}function patchUpdates(_0x37aeb3){return function(_0x2a1ac0){try{jsonpatch[_0x9580('0x1f')](_0x2a1ac0,_0x37aeb3,!![]);}catch(_0x133f68){return BPromise[_0x9580('0x20')](_0x133f68);}return _0x2a1ac0[_0x9580('0x21')]();};}function saveUpdates(_0x5bfd49,_0x229d39){return function(_0x505bc9){if(_0x505bc9){return _0x505bc9[_0x9580('0x22')](_0x5bfd49)[_0x9580('0x23')](function(_0x491c8f){return _0x491c8f;});}return null;};}function removeEntity(_0x55f129,_0x4e9b41){return function(_0x23d2c4){if(_0x23d2c4){return _0x23d2c4[_0x9580('0x24')]()[_0x9580('0x23')](function(){var _0x4d2dae=_0x23d2c4[_0x9580('0x25')]({'plain':!![]});var _0x179ca7=_0x9580('0x26');return db[_0x9580('0x27')]['destroy']({'where':{'type':_0x179ca7,'resourceId':_0x4d2dae['id']}})[_0x9580('0x23')](function(){return _0x23d2c4;});})[_0x9580('0x23')](function(){_0x55f129['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10cf2f,_0x333e79){return function(_0x126ed6){if(!_0x126ed6){_0x10cf2f['sendStatus'](0x194);}return _0x126ed6;};}function handleError(_0xd0398d,_0x480cd5){_0x480cd5=_0x480cd5||0x1f4;return function(_0x250908){logger[_0x9580('0x28')](_0x250908[_0x9580('0x29')]);if(_0x250908['name']){delete _0x250908['name'];}_0xd0398d[_0x9580('0x18')](_0x480cd5)[_0x9580('0x2a')](_0x250908);};}exports['index']=function(_0xd0d8a8,_0x2dfe1d){var _0x50e9bd={},_0x4abd7c={},_0x44a30c={'count':0x0,'rows':[]};var _0x34a178=_[_0x9580('0x2b')](db[_0x9580('0x2c')][_0x9580('0x2d')],function(_0x2479b7){return{'name':_0x2479b7[_0x9580('0x2e')],'type':_0x2479b7[_0x9580('0x2f')][_0x9580('0x30')]};});_0x4abd7c[_0x9580('0x31')]=_['map'](_0x34a178,_0x9580('0x32'));_0x4abd7c['query']=_[_0x9580('0x33')](_0xd0d8a8[_0x9580('0x34')]);_0x4abd7c[_0x9580('0x35')]=_[_0x9580('0x36')](_0x4abd7c['model'],_0x4abd7c[_0x9580('0x34')]);_0x50e9bd[_0x9580('0x37')]=_[_0x9580('0x36')](_0x4abd7c[_0x9580('0x31')],qs[_0x9580('0x38')](_0xd0d8a8[_0x9580('0x34')][_0x9580('0x38')]));_0x50e9bd[_0x9580('0x37')]=_0x50e9bd[_0x9580('0x37')][_0x9580('0x39')]?_0x50e9bd['attributes']:_0x4abd7c[_0x9580('0x31')];if(!_0xd0d8a8[_0x9580('0x34')][_0x9580('0x3a')](_0x9580('0x3b'))){_0x50e9bd[_0x9580('0x3c')]=qs[_0x9580('0x3c')](_0xd0d8a8[_0x9580('0x34')][_0x9580('0x3c')]);_0x50e9bd[_0x9580('0x1b')]=qs[_0x9580('0x1b')](_0xd0d8a8[_0x9580('0x34')][_0x9580('0x1b')]);}_0x50e9bd[_0x9580('0x3d')]=qs[_0x9580('0x3e')](_0xd0d8a8[_0x9580('0x34')][_0x9580('0x3e')]);delete _0xd0d8a8[_0x9580('0x34')]['sort'];_0x50e9bd[_0x9580('0x3f')]=qs[_0x9580('0x35')](_[_0x9580('0x40')](_0xd0d8a8[_0x9580('0x34')],_0x4abd7c['filters']),_0x34a178);if(_0xd0d8a8[_0x9580('0x34')][_0x9580('0x41')]){_0x50e9bd['where']=_[_0x9580('0x42')](_0x50e9bd[_0x9580('0x3f')],{'$or':_['map'](_0x34a178,function(_0x3b9a79){if(_0x3b9a79[_0x9580('0x2f')]!==_0x9580('0x43')){var _0x358cfb={};_0x358cfb[_0x3b9a79[_0x9580('0x32')]]={'$like':'%'+_0xd0d8a8['query'][_0x9580('0x41')]+'%'};return _0x358cfb;}})});}_0x50e9bd=_[_0x9580('0x42')]({},_0x50e9bd,_0xd0d8a8[_0x9580('0x44')]);var _0xc93f3d={'where':_0x50e9bd['where']};return db['VoiceMusicOnHold'][_0x9580('0x1d')](_0xc93f3d)['then'](function(_0x10a2d9){_0x44a30c[_0x9580('0x1d')]=_0x10a2d9;if(_0xd0d8a8[_0x9580('0x34')][_0x9580('0x45')]){_0x50e9bd['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x9580('0x46')](_0x50e9bd);})['then'](function(_0x3236f7){_0x44a30c[_0x9580('0x47')]=_0x3236f7;return _0x44a30c;})[_0x9580('0x23')](respondWithFilteredResult(_0x2dfe1d,_0x50e9bd))['catch'](handleError(_0x2dfe1d,null));};exports['show']=function(_0x370c38,_0x5b82e7){var _0x400942={'raw':![],'where':{'id':_0x370c38[_0x9580('0x48')]['id']}},_0x331236={};_0x331236[_0x9580('0x31')]=_[_0x9580('0x33')](db['VoiceMusicOnHold'][_0x9580('0x2d')]);_0x331236[_0x9580('0x34')]=_[_0x9580('0x33')](_0x370c38[_0x9580('0x34')]);_0x331236[_0x9580('0x35')]=_[_0x9580('0x36')](_0x331236[_0x9580('0x31')],_0x331236[_0x9580('0x34')]);_0x400942[_0x9580('0x37')]=_[_0x9580('0x36')](_0x331236[_0x9580('0x31')],qs[_0x9580('0x38')](_0x370c38[_0x9580('0x34')]['fields']));_0x400942['attributes']=_0x400942[_0x9580('0x37')][_0x9580('0x39')]?_0x400942[_0x9580('0x37')]:_0x331236[_0x9580('0x31')];if(_0x370c38['query'][_0x9580('0x45')]){_0x400942[_0x9580('0x49')]=[{'all':!![]}];}_0x400942=_[_0x9580('0x42')]({},_0x400942,_0x370c38['options']);return db['VoiceMusicOnHold'][_0x9580('0x4a')](_0x400942)[_0x9580('0x23')](handleEntityNotFound(_0x5b82e7,null))[_0x9580('0x23')](respondWithResult(_0x5b82e7,null))['catch'](handleError(_0x5b82e7,null));};exports[_0x9580('0x22')]=function(_0x1568bf,_0x25c111){if(_0x1568bf[_0x9580('0x4b')]['id']){delete _0x1568bf[_0x9580('0x4b')]['id'];}return db['VoiceMusicOnHold'][_0x9580('0x4a')]({'where':{'id':_0x1568bf['params']['id']}})[_0x9580('0x23')](handleEntityNotFound(_0x25c111,null))[_0x9580('0x23')](saveUpdates(_0x1568bf[_0x9580('0x4b')],null))[_0x9580('0x23')](respondWithResult(_0x25c111,null))['catch'](handleError(_0x25c111,null));};exports[_0x9580('0x4c')]=function(_0x532994,_0x3978c1,_0x46afea){return db[_0x9580('0x4d')]['transaction'](function(_0xf8f671){if(_0x532994['body']['mode']==='files'){_0x532994[_0x9580('0x4b')]['directory']=path['join'](config[_0x9580('0x4e')],_0x9580('0x4f'),_0x532994[_0x9580('0x4b')]['name']);}return db[_0x9580('0x2c')][_0x9580('0x4c')](_0x532994['body'],{'transaction':_0xf8f671})[_0x9580('0x23')](function(_0x17c95c){if(_0x532994[_0x9580('0x4b')][_0x9580('0x50')]===_0x9580('0x51')){fs['mkdirSync'](_0x17c95c[_0x9580('0x52')],parseInt('0777',0x8));}var _0x1bf4a5=_0x532994[_0x9580('0x53')][_0x9580('0x25')]({'plain':!![]});if(!_0x1bf4a5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bf4a5[_0x9580('0x54')]===_0x9580('0x53')){var _0x3920f5=_0x17c95c[_0x9580('0x25')]({'plain':!![]});return db[_0x9580('0x55')][_0x9580('0x4a')]({'where':{'name':_0x9580('0x26'),'userProfileId':_0x1bf4a5[_0x9580('0x56')]},'raw':!![]})[_0x9580('0x23')](function(_0xfd5318){if(_0xfd5318&&_0xfd5318[_0x9580('0x57')]===0x0){return db[_0x9580('0x27')][_0x9580('0x4c')]({'name':_0x3920f5[_0x9580('0x32')],'resourceId':_0x3920f5['id'],'type':_0xfd5318[_0x9580('0x32')],'sectionId':_0xfd5318['id']},{})[_0x9580('0x23')](function(){return _0x17c95c;});}else{return _0x17c95c;}})[_0x9580('0x58')](function(_0x406134){logger[_0x9580('0x28')](_0x9580('0x59'),_0x406134);});}return _0x17c95c;});})[_0x9580('0x23')](respondWithResult(_0x3978c1,0xc9))[_0x9580('0x58')](handleError(_0x3978c1,null));};exports[_0x9580('0x24')]=function(_0x1d3083,_0x4c2200,_0x53a170){var _0xf34304;return db[_0x9580('0x2c')]['find']({'where':{'id':_0x1d3083[_0x9580('0x48')]['id']}})[_0x9580('0x23')](function(_0x122727){if(_0x122727){return db[_0x9580('0x4d')][_0x9580('0x5a')](function(_0x2745eb){return _0x122727[_0x9580('0x24')]({'transaction':_0x2745eb,'raw':!![]})[_0x9580('0x23')](function(_0x513ce7){if(_0x513ce7[_0x9580('0x52')]){fs[_0x9580('0x5b')](_0x513ce7['directory'])[_0x9580('0x5c')](function(_0x3b9486){fs[_0x9580('0x5d')](path[_0x9580('0x5e')](_0x513ce7[_0x9580('0x52')],_0x3b9486));});fs['rmdirSync'](_0x513ce7['directory']);}return _0x513ce7;});})[_0x9580('0x58')](function(_0x203711){throw new db[(_0x9580('0x5f'))][(_0x9580('0x60'))](_0x203711[_0x9580('0x61')]);});}})[_0x9580('0x23')](handleEntityNotFound(_0x4c2200,null))[_0x9580('0x23')](removeEntity(_0x4c2200,null))[_0x9580('0x58')](handleError(_0x4c2200,null));};exports[_0x9580('0x62')]=function(_0x4fece7,_0x3ca472,_0x529c8e){return db[_0x9580('0x4d')]['transaction'](function(_0x4da5eb){var _0x3b12a1;return db[_0x9580('0x2c')]['find']({'where':{'id':_0x4fece7[_0x9580('0x48')]['id']}})[_0x9580('0x23')](function(_0x9fc967){if(_0x9fc967){_0x3b12a1=_0x9fc967;return _0x9fc967[_0x9580('0x62')](_0x4fece7['body']['id'],{'transaction':_0x4da5eb});}})[_0x9580('0x23')](function(_0x5d731d){if(_0x5d731d){return db['Sound'][_0x9580('0x63')]({'where':{'id':_0x4fece7[_0x9580('0x4b')]['id']},'attributes':['id',_0x9580('0x32'),_0x9580('0x64'),'converted_format',_0x9580('0x65')],'raw':!![]});}})[_0x9580('0x23')](function(_0x5026cd){if(_0x5026cd){var _0x3a3918=path[_0x9580('0x5e')](config[_0x9580('0x4e')],_0x9580('0x66'),util[_0x9580('0x67')](_0x9580('0x68'),path[_0x9580('0x69')](_0x5026cd[_0x9580('0x64')],path[_0x9580('0x6a')](_0x5026cd[_0x9580('0x64')])),_0x5026cd['converted_format']));var _0x5e2663=path[_0x9580('0x5e')](config['root'],'server/files/moh',_0x3b12a1[_0x9580('0x32')],util['format'](_0x9580('0x68'),_0x5026cd['name'],_0x5026cd['converted_format']));fs[_0x9580('0x6b')](_0x3a3918,_0x5e2663);return _0x5026cd;}})[_0x9580('0x58')](function(_0x3ba571){throw new db['Sequelize'][(_0x9580('0x60'))](_0x3ba571[_0x9580('0x61')]);});})[_0x9580('0x23')](handleEntityNotFound(_0x3ca472,null))['then'](respondWithResult(_0x3ca472,0xc9))[_0x9580('0x58')](handleError(_0x3ca472,null));};exports[_0x9580('0x6c')]=function(_0x23e431,_0x29ba14,_0x373373){return db['sequelize'][_0x9580('0x5a')](function(_0x3aa466){var _0x46412a;return db[_0x9580('0x2c')][_0x9580('0x63')]({'where':{'id':_0x23e431[_0x9580('0x48')]['id']}})[_0x9580('0x23')](handleEntityNotFound(_0x29ba14,null))['then'](function(_0x5eb7e4){if(_0x5eb7e4){_0x46412a=_0x5eb7e4;return _0x5eb7e4['removeSound'](_0x23e431[_0x9580('0x48')][_0x9580('0x6d')]);}})[_0x9580('0x23')](function(_0x217769){if(_0x217769){return db[_0x9580('0x6e')][_0x9580('0x63')]({'where':{'id':_0x23e431[_0x9580('0x48')]['id2']},'attributes':['id','name',_0x9580('0x64'),_0x9580('0x6f'),'createdAt'],'raw':!![]});}})[_0x9580('0x23')](function(_0x21752c){if(_0x21752c){fs[_0x9580('0x5d')](path['join'](_0x46412a[_0x9580('0x52')],util[_0x9580('0x67')](_0x9580('0x68'),_0x21752c[_0x9580('0x32')],_0x21752c[_0x9580('0x6f')])));return _0x21752c;}})[_0x9580('0x58')](function(_0x4089b8){throw new db[(_0x9580('0x5f'))][(_0x9580('0x60'))](_0x4089b8[_0x9580('0x61')]);});})[_0x9580('0x23')](handleEntityNotFound(_0x29ba14,null))[_0x9580('0x23')](respondWithStatusCode(_0x29ba14,0xcc))[_0x9580('0x58')](handleError(_0x29ba14,null));};exports[_0x9580('0x70')]=function(_0x5d2e63,_0xcf7bf7,_0x3a5d3a){var _0x228a16={};var _0x595f01={};var _0x779e75;var _0x19ddcd;return db[_0x9580('0x2c')]['findOne']({'where':{'id':_0x5d2e63[_0x9580('0x48')]['id']}})[_0x9580('0x23')](handleEntityNotFound(_0xcf7bf7,null))[_0x9580('0x23')](function(_0x336bfe){if(_0x336bfe){_0x779e75=_0x336bfe;_0x595f01[_0x9580('0x31')]=_[_0x9580('0x33')](db['Sound'][_0x9580('0x2d')]);_0x595f01[_0x9580('0x34')]=_[_0x9580('0x33')](_0x5d2e63[_0x9580('0x34')]);_0x595f01[_0x9580('0x35')]=_[_0x9580('0x36')](_0x595f01['model'],_0x595f01[_0x9580('0x34')]);_0x228a16['attributes']=_['intersection'](_0x595f01[_0x9580('0x31')],qs[_0x9580('0x38')](_0x5d2e63[_0x9580('0x34')][_0x9580('0x38')]));_0x228a16[_0x9580('0x37')]=_0x228a16[_0x9580('0x37')][_0x9580('0x39')]?_0x228a16[_0x9580('0x37')]:_0x595f01[_0x9580('0x31')];_0x228a16[_0x9580('0x3d')]=qs[_0x9580('0x3e')](_0x5d2e63['query']['sort']);_0x228a16[_0x9580('0x3f')]=qs['filters'](_[_0x9580('0x40')](_0x5d2e63[_0x9580('0x34')],_0x595f01[_0x9580('0x35')]));if(_0x5d2e63[_0x9580('0x34')][_0x9580('0x41')]){_0x228a16['where']=_['merge'](_0x228a16['where'],{'$or':_[_0x9580('0x2b')](_0x228a16['attributes'],function(_0x42f8c2){var _0x33ee53={};_0x33ee53[_0x42f8c2]={'$like':'%'+_0x5d2e63['query']['filter']+'%'};return _0x33ee53;})});}_0x228a16=_[_0x9580('0x42')]({},_0x228a16,_0x5d2e63[_0x9580('0x44')]);return _0x779e75[_0x9580('0x70')](_0x228a16);}})[_0x9580('0x23')](function(_0x5e8d8a){if(_0x5e8d8a){_0x19ddcd=_0x5e8d8a[_0x9580('0x39')];if(!_0x5d2e63['query'][_0x9580('0x3a')](_0x9580('0x3b'))){_0x228a16['limit']=qs[_0x9580('0x3c')](_0x5d2e63['query'][_0x9580('0x3c')]);_0x228a16[_0x9580('0x1b')]=qs['offset'](_0x5d2e63[_0x9580('0x34')][_0x9580('0x1b')]);}return _0x779e75[_0x9580('0x70')](_0x228a16);}})['then'](function(_0x476f11){if(_0x476f11){return _0x476f11?{'count':_0x19ddcd,'rows':_0x476f11}:null;}})[_0x9580('0x23')](respondWithResult(_0xcf7bf7,null))[_0x9580('0x58')](handleError(_0xcf7bf7,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 96222e5..9a9395e 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 _0x0749=['../../config/environment','./voiceMusicOnHold.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x263a08,_0x53279e){var _0x32d03b=function(_0x27d18d){while(--_0x27d18d){_0x263a08['push'](_0x263a08['shift']());}};_0x32d03b(++_0x53279e);}(_0x0749,0x16c));var _0x9074=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x0749[_0x27af45];return _0x18df21;};'use strict';var _=require('lodash');var util=require(_0x9074('0x0'));var logger=require(_0x9074('0x1'))(_0x9074('0x2'));var moment=require(_0x9074('0x3'));var BPromise=require(_0x9074('0x4'));var rp=require(_0x9074('0x5'));var fs=require('fs');var path=require(_0x9074('0x6'));var rimraf=require(_0x9074('0x7'));var config=require(_0x9074('0x8'));var attributes=require(_0x9074('0x9'));module[_0x9074('0xa')]=function(_0x5b9fb3,_0xcc5847){return _0x5b9fb3[_0x9074('0xb')]('VoiceMusicOnHold',attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf2cf=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','util'];(function(_0x45b17f,_0x1cbd38){var _0x2ada7e=function(_0x4dff6d){while(--_0x4dff6d){_0x45b17f['push'](_0x45b17f['shift']());}};_0x2ada7e(++_0x1cbd38);}(_0xf2cf,0x178));var _0xff2c=function(_0x532153,_0x21f296){_0x532153=_0x532153-0x0;var _0x50443a=_0xf2cf[_0x532153];return _0x50443a;};'use strict';var _=require('lodash');var util=require(_0xff2c('0x0'));var logger=require(_0xff2c('0x1'))('api');var moment=require(_0xff2c('0x2'));var BPromise=require(_0xff2c('0x3'));var rp=require(_0xff2c('0x4'));var fs=require('fs');var path=require(_0xff2c('0x5'));var rimraf=require(_0xff2c('0x6'));var config=require(_0xff2c('0x7'));var attributes=require(_0xff2c('0x8'));module[_0xff2c('0x9')]=function(_0x578e9d,_0x347d5b){return _0x578e9d[_0xff2c('0xa')](_0xff2c('0xb'),attributes,{'tableName':_0xff2c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index a6e8065..296721a 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 _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xb54647,_0x44cf20){var _0x34afbb=function(_0x2e5fa0){while(--_0x2e5fa0){_0xb54647['push'](_0xb54647['shift']());}};_0x34afbb(++_0x44cf20);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ 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(_0x2315b0,_0x5086b4){var _0x3abd07=function(_0xea7317){while(--_0xea7317){_0x2315b0['push'](_0x2315b0['shift']());}};_0x3abd07(++_0x5086b4);}(_0xedd9,0xfc));var _0x9edd=function(_0x361941,_0x46a6db){_0x361941=_0x361941-0x0;var _0x1708f6=_0xedd9[_0x361941];return _0x1708f6;};'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 ae36131..92ad1ed 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 _0xe132=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','create','post','addAgents','addTeams','put','update','delete','destroy','removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe132,0x162));var _0x2e13=function(_0x2c8856,_0x4002ad){_0x2c8856=_0x2c8856-0x0;var _0x5a0d14=_0xe132[_0x2c8856];return _0x5a0d14;};'use strict';var multer=require(_0x2e13('0x0'));var util=require('util');var path=require(_0x2e13('0x1'));var timeout=require(_0x2e13('0x2'));var express=require(_0x2e13('0x3'));var router=express[_0x2e13('0x4')]();var fs_extra=require(_0x2e13('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2e13('0x6'));var config=require(_0x2e13('0x7'));var controller=require('./voicePrefix.controller');router['get']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x9')]);router[_0x2e13('0xa')](_0x2e13('0xb'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xc')]);router[_0x2e13('0xa')](_0x2e13('0xd'),auth[_0x2e13('0x8')](),controller[_0x2e13('0xe')]);router['get'](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x10')]);router[_0x2e13('0xa')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x12')]);router['post']('/',auth[_0x2e13('0x8')](),controller[_0x2e13('0x13')]);router[_0x2e13('0x14')](_0x2e13('0xf'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x15')]);router[_0x2e13('0x14')]('/:id/teams',auth[_0x2e13('0x8')](),controller[_0x2e13('0x16')]);router[_0x2e13('0x17')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x18')]);router[_0x2e13('0x19')]('/:id',auth[_0x2e13('0x8')](),controller[_0x2e13('0x1a')]);router[_0x2e13('0x19')]('/:id/users',auth['isAuthenticated'](),controller[_0x2e13('0x1b')]);router[_0x2e13('0x19')](_0x2e13('0x11'),auth[_0x2e13('0x8')](),controller[_0x2e13('0x1c')]);module[_0x2e13('0x1d')]=router; \ No newline at end of file +var _0xf2cb=['/:id/teams','getTeams','post','create','addAgents','/:id','delete','destroy','removeTeams','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/users','getAgents'];(function(_0x420d8a,_0x2b547e){var _0x4735a0=function(_0x3007c0){while(--_0x3007c0){_0x420d8a['push'](_0x420d8a['shift']());}};_0x4735a0(++_0x2b547e);}(_0xf2cb,0x130));var _0xbf2c=function(_0x56fd29,_0x410ac3){_0x56fd29=_0x56fd29-0x0;var _0x3ee16f=_0xf2cb[_0x56fd29];return _0x3ee16f;};'use strict';var multer=require('multer');var util=require(_0xbf2c('0x0'));var path=require('path');var timeout=require(_0xbf2c('0x1'));var express=require('express');var router=express[_0xbf2c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xbf2c('0x3'));var interaction=require(_0xbf2c('0x4'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0xbf2c('0x5')]('/',auth[_0xbf2c('0x6')](),controller[_0xbf2c('0x7')]);router[_0xbf2c('0x5')]('/describe',auth[_0xbf2c('0x6')](),controller['describe']);router[_0xbf2c('0x5')]('/:id',auth['isAuthenticated'](),controller[_0xbf2c('0x8')]);router[_0xbf2c('0x5')](_0xbf2c('0x9'),auth['isAuthenticated'](),controller[_0xbf2c('0xa')]);router[_0xbf2c('0x5')](_0xbf2c('0xb'),auth[_0xbf2c('0x6')](),controller[_0xbf2c('0xc')]);router[_0xbf2c('0xd')]('/',auth[_0xbf2c('0x6')](),controller[_0xbf2c('0xe')]);router['post'](_0xbf2c('0x9'),auth[_0xbf2c('0x6')](),controller[_0xbf2c('0xf')]);router[_0xbf2c('0xd')]('/:id/teams',auth[_0xbf2c('0x6')](),controller['addTeams']);router['put'](_0xbf2c('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xbf2c('0x11')](_0xbf2c('0x10'),auth[_0xbf2c('0x6')](),controller[_0xbf2c('0x12')]);router[_0xbf2c('0x11')]('/:id/users',auth[_0xbf2c('0x6')](),controller['removeAgents']);router[_0xbf2c('0x11')](_0xbf2c('0xb'),auth[_0xbf2c('0x6')](),controller[_0xbf2c('0x13')]);module[_0xbf2c('0x14')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 88aafd4..3176661 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 _0x0d94=['getDataValue','INTEGER','sequelize','STRING','name','system-'];(function(_0x1fb7c1,_0x14a6f7){var _0x5659ec=function(_0xea6c0d){while(--_0xea6c0d){_0x1fb7c1['push'](_0x1fb7c1['shift']());}};_0x5659ec(++_0x14a6f7);}(_0x0d94,0x18e));var _0x40d9=function(_0x191618,_0x493f39){_0x191618=_0x191618-0x0;var _0x361ae1=_0x0d94[_0x191618];return _0x361ae1;};'use strict';var Sequelize=require(_0x40d9('0x0'));module['exports']={'name':{'type':Sequelize[_0x40d9('0x1')],'allowNull':![],'unique':_0x40d9('0x2')},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x127e3f){return _0x40d9('0x3')+this[_0x40d9('0x4')]('name')+'-';}},'description':{'type':Sequelize[_0x40d9('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x40d9('0x5')]}}; \ No newline at end of file +var _0xe71e=['system-','getDataValue','INTEGER','exports','STRING','name','VIRTUAL'];(function(_0x4cf77c,_0x1822c9){var _0x10ba7e=function(_0x4faade){while(--_0x4faade){_0x4cf77c['push'](_0x4cf77c['shift']());}};_0x10ba7e(++_0x1822c9);}(_0xe71e,0x153));var _0xee71=function(_0x473b3a,_0x4889de){_0x473b3a=_0x473b3a-0x0;var _0x557b97=_0xe71e[_0x473b3a];return _0x557b97;};'use strict';var Sequelize=require('sequelize');module[_0xee71('0x0')]={'name':{'type':Sequelize[_0xee71('0x1')],'allowNull':![],'unique':_0xee71('0x2')},'prefix':{'type':Sequelize[_0xee71('0x3')],'get':function(_0x3f0884){return _0xee71('0x4')+this[_0xee71('0x5')](_0xee71('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xee71('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xee71('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 9b8c88c..e09e0fd 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 _0xd914=['Voice\x20Prefix\x20Extension','priority','appdata','prefix','Voice\x20Prefix','VoicePrefixId','bulkCreate','push','Set','PREFIX-CALLERIDALL=','callerIdAll','NoOp','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','sequelize','findById','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','pick','getAgents','hasOwnProperty','nolimit','getTeams','Team','addTeams','Agents','online','voicePause','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','userVoicePrefix:save','removeTeams','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','union','compact','value','isEmpty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','destroy','then','VoicePrefixes','UserProfileResource','sendStatus','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','describe','create','transaction','body','get','VoiceExtension','VoiceExtensionId','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','type','system','description'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd914,0x17f));var _0x4d91=function(_0x25b24a,_0x1c0163){_0x25b24a=_0x25b24a-0x0;var _0x224e68=_0xd914[_0x25b24a];return _0x224e68;};'use strict';var emlformat=require(_0x4d91('0x0'));var rimraf=require(_0x4d91('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4d91('0x2'));var rp=require(_0x4d91('0x3'));var moment=require(_0x4d91('0x4'));var BPromise=require(_0x4d91('0x5'));var Mustache=require(_0x4d91('0x6'));var util=require(_0x4d91('0x7'));var path=require('path');var sox=require(_0x4d91('0x8'));var csv=require('to-csv');var ejs=require(_0x4d91('0x9'));var fs=require('fs');var fs_extra=require(_0x4d91('0xa'));var _=require(_0x4d91('0xb'));var squel=require(_0x4d91('0xc'));var crypto=require(_0x4d91('0xd'));var jsforce=require(_0x4d91('0xe'));var deskjs=require(_0x4d91('0xf'));var toCsv=require(_0x4d91('0x10'));var querystring=require('querystring');var Papa=require(_0x4d91('0x11'));var Redis=require(_0x4d91('0x12'));var authService=require(_0x4d91('0x13'));var qs=require(_0x4d91('0x14'));var as=require(_0x4d91('0x15'));var hardwareService=require(_0x4d91('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x4d91('0x17'));var config=require(_0x4d91('0x18'));var licenseUtil=require(_0x4d91('0x19'));var db=require(_0x4d91('0x1a'))['db'];config[_0x4d91('0x1b')]=_[_0x4d91('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4d91('0x1d'))(new Redis(config[_0x4d91('0x1b')]));require(_0x4d91('0x1e'))[_0x4d91('0x1f')](socket);function respondWithStatusCode(_0x33fbd4,_0x25bafc){_0x25bafc=_0x25bafc||0xcc;return function(_0x36f606){if(_0x36f606){return _0x33fbd4['sendStatus'](_0x25bafc);}return _0x33fbd4[_0x4d91('0x20')](_0x25bafc)[_0x4d91('0x21')]();};}function respondWithResult(_0x1e2ef7,_0xb92681){_0xb92681=_0xb92681||0xc8;return function(_0x280e80){if(_0x280e80){return _0x1e2ef7['status'](_0xb92681)[_0x4d91('0x22')](_0x280e80);}};}function respondWithFilteredResult(_0xb75abf,_0x241564){return function(_0x44b9a7){if(_0x44b9a7){var _0x4cfa40=typeof _0x241564[_0x4d91('0x23')]===_0x4d91('0x24')&&typeof _0x241564[_0x4d91('0x25')]==='undefined';var _0x13ef2c=_0x44b9a7[_0x4d91('0x26')];var _0x351388=_0x4cfa40?0x0:_0x241564[_0x4d91('0x23')];var _0x10b767=_0x4cfa40?_0x44b9a7[_0x4d91('0x26')]:_0x241564[_0x4d91('0x23')]+_0x241564[_0x4d91('0x25')];var _0x30d911;if(_0x10b767>=_0x13ef2c){_0x10b767=_0x13ef2c;_0x30d911=0xc8;}else{_0x30d911=0xce;}_0xb75abf[_0x4d91('0x20')](_0x30d911);return _0xb75abf['set'](_0x4d91('0x27'),_0x351388+'-'+_0x10b767+'/'+_0x13ef2c)['json'](_0x44b9a7);}return null;};}function patchUpdates(_0x57913e){return function(_0x74a697){try{jsonpatch[_0x4d91('0x28')](_0x74a697,_0x57913e,!![]);}catch(_0x341d18){return BPromise[_0x4d91('0x29')](_0x341d18);}return _0x74a697[_0x4d91('0x2a')]();};}function saveUpdates(_0x12b722,_0x100cd4){return function(_0x123606){if(_0x123606){return _0x123606['update'](_0x12b722)['then'](function(_0x1ee6b3){return _0x1ee6b3;});}return null;};}function removeEntity(_0x112923,_0x3bed98){return function(_0x45fc91){if(_0x45fc91){return _0x45fc91[_0x4d91('0x2b')]()[_0x4d91('0x2c')](function(){var _0x14bdb4=_0x45fc91['get']({'plain':!![]});var _0x3dc353=_0x4d91('0x2d');return db[_0x4d91('0x2e')]['destroy']({'where':{'type':_0x3dc353,'resourceId':_0x14bdb4['id']}})['then'](function(){return _0x45fc91;});})[_0x4d91('0x2c')](function(){_0x112923[_0x4d91('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50fe76,_0x42d5a0){return function(_0x2d6981){if(!_0x2d6981){_0x50fe76[_0x4d91('0x2f')](0x194);}return _0x2d6981;};}function handleError(_0x17c7bc,_0x4f23dd){_0x4f23dd=_0x4f23dd||0x1f4;return function(_0x2587a1){logger[_0x4d91('0x30')](_0x2587a1[_0x4d91('0x31')]);if(_0x2587a1[_0x4d91('0x32')]){delete _0x2587a1[_0x4d91('0x32')];}_0x17c7bc[_0x4d91('0x20')](_0x4f23dd)[_0x4d91('0x33')](_0x2587a1);};}exports['index']=function(_0x82f585,_0x4f44ff){var _0x4ad7bf={},_0x292808={},_0x3a2780={'count':0x0,'rows':[]};var _0x4f95f0=_[_0x4d91('0x34')](db[_0x4d91('0x35')][_0x4d91('0x36')],function(_0x2be3f5){return{'name':_0x2be3f5[_0x4d91('0x37')],'type':_0x2be3f5['type'][_0x4d91('0x38')]};});_0x292808[_0x4d91('0x39')]=_[_0x4d91('0x34')](_0x4f95f0,_0x4d91('0x32'));_0x292808[_0x4d91('0x3a')]=_[_0x4d91('0x3b')](_0x82f585['query']);_0x292808[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x292808['model'],_0x292808[_0x4d91('0x3a')]);_0x4ad7bf[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x292808['model'],qs[_0x4d91('0x3f')](_0x82f585[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x4ad7bf[_0x4d91('0x3e')]=_0x4ad7bf['attributes'][_0x4d91('0x40')]?_0x4ad7bf[_0x4d91('0x3e')]:_0x292808[_0x4d91('0x39')];if(!_0x82f585[_0x4d91('0x3a')]['hasOwnProperty']('nolimit')){_0x4ad7bf[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x82f585['query'][_0x4d91('0x25')]);_0x4ad7bf[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x82f585[_0x4d91('0x3a')]['offset']);}_0x4ad7bf[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x82f585['query'][_0x4d91('0x42')]);_0x4ad7bf['where']=qs[_0x4d91('0x3c')](_['pick'](_0x82f585[_0x4d91('0x3a')],_0x292808['filters']),_0x4f95f0);if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x4ad7bf[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x4ad7bf['where'],{'$or':_['map'](_0x4f95f0,function(_0x25e0f5){if(_0x25e0f5['type']!==_0x4d91('0x46')){var _0x282d64={};_0x282d64[_0x25e0f5['name']]={'$like':'%'+_0x82f585[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x282d64;}})});}_0x4ad7bf=_[_0x4d91('0x45')]({},_0x4ad7bf,_0x82f585[_0x4d91('0x47')]);var _0x1c6d0b={'where':_0x4ad7bf[_0x4d91('0x44')]};return db[_0x4d91('0x35')]['count'](_0x1c6d0b)[_0x4d91('0x2c')](function(_0x4c70af){_0x3a2780[_0x4d91('0x26')]=_0x4c70af;if(_0x82f585[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x4ad7bf[_0x4d91('0x49')]=[{'all':!![]}];}return db[_0x4d91('0x35')][_0x4d91('0x4a')](_0x4ad7bf);})['then'](function(_0x4ffc08){_0x3a2780[_0x4d91('0x4b')]=_0x4ffc08;return _0x3a2780;})[_0x4d91('0x2c')](respondWithFilteredResult(_0x4f44ff,_0x4ad7bf))['catch'](handleError(_0x4f44ff,null));};exports[_0x4d91('0x4c')]=function(_0x164658,_0x342de1){var _0x3f8659={'raw':![],'where':{'id':_0x164658[_0x4d91('0x4d')]['id']}},_0x31f21a={};_0x31f21a[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x35')]['rawAttributes']);_0x31f21a['query']=_[_0x4d91('0x3b')](_0x164658['query']);_0x31f21a[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x31f21a[_0x4d91('0x39')],_0x31f21a[_0x4d91('0x3a')]);_0x3f8659['attributes']=_[_0x4d91('0x3d')](_0x31f21a['model'],qs['fields'](_0x164658[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x3f8659[_0x4d91('0x3e')]=_0x3f8659[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x3f8659[_0x4d91('0x3e')]:_0x31f21a['model'];if(_0x164658[_0x4d91('0x3a')][_0x4d91('0x48')]){_0x3f8659[_0x4d91('0x49')]=[{'all':!![]}];}_0x3f8659=_[_0x4d91('0x45')]({},_0x3f8659,_0x164658[_0x4d91('0x47')]);return db[_0x4d91('0x35')][_0x4d91('0x4e')](_0x3f8659)[_0x4d91('0x2c')](handleEntityNotFound(_0x342de1,null))[_0x4d91('0x2c')](respondWithResult(_0x342de1,null))[_0x4d91('0x4f')](handleError(_0x342de1,null));};exports[_0x4d91('0x2b')]=function(_0x5a67fa,_0xa5c630){return db['VoicePrefix'][_0x4d91('0x4e')]({'where':{'id':_0x5a67fa[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0xa5c630,null))[_0x4d91('0x2c')](removeEntity(_0xa5c630,null))[_0x4d91('0x4f')](handleError(_0xa5c630,null));};exports[_0x4d91('0x50')]=function(_0x3028b1,_0x22b341){return db['VoicePrefix'][_0x4d91('0x50')]()[_0x4d91('0x2c')](respondWithResult(_0x22b341,null))[_0x4d91('0x4f')](handleError(_0x22b341,null));};exports[_0x4d91('0x51')]=function(_0x26ecd7,_0x19e57e){var _0x5765ce;return db['sequelize'][_0x4d91('0x52')](function(_0x2159e4){return db[_0x4d91('0x35')][_0x4d91('0x51')](_0x26ecd7[_0x4d91('0x53')],{'transaction':_0x2159e4})[_0x4d91('0x2c')](function(_0x2875f4){_0x5765ce=_0x2875f4[_0x4d91('0x54')]({'plain':!![]});return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5765ce[_0x4d91('0x56')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x280c41){return createVoicePrefixExtensions(_0x5765ce,_0x280c41,_0x2159e4);});});})[_0x4d91('0x2c')](function(){var _0x3e9154=_0x26ecd7[_0x4d91('0x57')][_0x4d91('0x54')]({'plain':!![]});if(!_0x3e9154)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9154['role']==='user'){var _0x45cf4e=_0x5765ce;return db[_0x4d91('0x58')][_0x4d91('0x4e')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3e9154[_0x4d91('0x59')]},'raw':!![]})[_0x4d91('0x2c')](function(_0x3985f3){if(_0x3985f3&&_0x3985f3['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x45cf4e[_0x4d91('0x32')],'resourceId':_0x45cf4e['id'],'type':_0x3985f3[_0x4d91('0x32')],'sectionId':_0x3985f3['id']},{})[_0x4d91('0x2c')](function(){return _0x5765ce;});}else{return _0x5765ce;}})[_0x4d91('0x4f')](function(_0x31d6e5){logger['error'](_0x4d91('0x5a'),_0x31d6e5);throw _0x31d6e5;});}return _0x5765ce;})[_0x4d91('0x2c')](respondWithResult(_0x19e57e,null))['catch'](handleError(_0x19e57e,null));};function Extension(_0x563558,_0x3f4f24,_0x544711,_0x3fda50){this[_0x4d91('0x5b')]=_0x4d91('0x5c');this['exten']=_0x563558;this[_0x4d91('0x5d')]=_0x544711;this[_0x4d91('0x5e')]=_0x4d91('0x5f');this[_0x4d91('0x60')]=_0x4d91('0x61');this[_0x4d91('0x62')]=_0x3f4f24;this[_0x4d91('0x63')]=_0x3fda50;}function createVoicePrefixExtensions(_0x524b4f,_0x533572,_0x5eeba8){return new BPromise(function(_0x4bd66d,_0x83395){var _0x8d6db2=new Extension(formatPrefixName(_0x524b4f[_0x4d91('0x64')]),0x1,'NoOp',_0x4d91('0x65'));_0x8d6db2['VoicePrefixId']=_0x524b4f['id'];return db[_0x4d91('0x55')][_0x4d91('0x51')](_0x8d6db2,{'transaction':_0x5eeba8})['then'](function(_0x51a594){var _0x1a707f=_0x51a594[_0x4d91('0x54')]({'plain':!![]});var _0x31150f=_[_0x4d91('0x34')](addVoicePrefixExtensions(_0x524b4f,_0x533572),function(_0x24661a){_0x24661a[_0x4d91('0x56')]=_0x1a707f['id'];_0x24661a[_0x4d91('0x66')]=_0x524b4f['id'];return _0x24661a;});return db[_0x4d91('0x55')][_0x4d91('0x67')](_0x31150f,{'transaction':_0x5eeba8})[_0x4d91('0x2c')](function(_0x5bfb08){if(!_0x5bfb08){return _0x83395('Extensions\x20creation\x20failed');}else{return _0x4bd66d(_0x5bfb08);}})[_0x4d91('0x4f')](function(_0x7e26c2){return _0x83395(_0x7e26c2);});});;});};function addVoicePrefixExtensions(_0x2049ca,_0x13281d){var _0x16ba26=[];var _0x16d384=formatPrefixName(_0x2049ca[_0x4d91('0x64')]);_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x2,_0x4d91('0x69'),'CDR(prefix)='+_0x2049ca['name']));if(_0x2049ca['callerIdAll']){_0x16ba26['push'](new Extension(_0x16d384,0x3,_0x4d91('0x69'),_0x4d91('0x6a')+_0x2049ca[_0x4d91('0x6b')]));}else{_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x3,_0x4d91('0x6c'),_0x4d91('0x6d')));}_0x16ba26[_0x4d91('0x68')](new Extension(_0x16d384,0x4,_0x4d91('0x6e'),_0x13281d[_0x4d91('0x5b')]+','+_0x4d91('0x6f')+(0x8+_0x2049ca[_0x4d91('0x32')][_0x4d91('0x40')])+'}'+','+0x1));return _0x16ba26;}function formatPrefixName(_0x4444a2){var _0xef787='_';for(var _0x3bc828=0x0;_0x3bc828<_0x4444a2[_0x4d91('0x40')];_0x3bc828++){if(_0x4444a2[_0x4d91('0x70')](_0x3bc828)=='-'){_0xef787+=_0x4444a2['charAt'](_0x3bc828);}else{_0xef787+='['+_0x4444a2[_0x4d91('0x70')](_0x3bc828)+']';}}_0xef787+='.';return _0xef787;}exports[_0x4d91('0x71')]=function(_0xc4ef10,_0x2e2105,_0x1cad5b){var _0x5ab447=_0xc4ef10[_0x4d91('0x53')];_0x5ab447[_0x4d91('0x64')]='system-'+_0x5ab447[_0x4d91('0x32')]+'-';return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0xa469a4){return db[_0x4d91('0x35')]['update'](_0x5ab447,{'where':{'id':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')]['destroy']({'where':{'VoicePrefixId':_0x5ab447['id']},'transaction':_0xa469a4})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x55')][_0x4d91('0x4e')]({'where':{'id':_0x5ab447['VoiceExtensionId']},'raw':!![]})[_0x4d91('0x2c')](function(_0x403e0c){return createVoicePrefixExtensions(_0x5ab447,_0x403e0c,_0xa469a4);});});});})[_0x4d91('0x2c')](function(){return db[_0x4d91('0x35')][_0x4d91('0x73')](_0x5ab447['id']);})[_0x4d91('0x2c')](respondWithResult(_0x2e2105,null))[_0x4d91('0x4f')](handleError(_0x2e2105,null));};exports['addAgents']=function(_0xdbb484,_0x2e014b,_0x4e7994){return db[_0x4d91('0x35')]['find']({'where':{'id':_0xdbb484['params']['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x2e014b,null))['then'](function(_0x1a5376){if(_0x1a5376){return _0x1a5376[_0x4d91('0x74')](_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')],_[_0x4d91('0x76')](_0xdbb484[_0x4d91('0x53')],[_0x4d91('0x75'),'id'])||{})['spread'](function(_0x485da1){for(var _0x1c27e7=0x0;_0x1c27e7<_0xdbb484[_0x4d91('0x53')][_0x4d91('0x75')][_0x4d91('0x40')];_0x1c27e7+=0x1){socket[_0x4d91('0x77')]('userVoicePrefix:save',{'UserId':Number(_0xdbb484['body'][_0x4d91('0x75')][_0x1c27e7]),'VoicePrefixId':Number(_0xdbb484['params']['id'])});}return _0x485da1;});}})['then'](respondWithResult(_0x2e014b,null))[_0x4d91('0x4f')](handleError(_0x2e014b,null));};exports['removeAgents']=function(_0x585a8d,_0x216c33,_0x1b813c){return db[_0x4d91('0x35')]['find']({'where':{'id':_0x585a8d['params']['id']}})['then'](handleEntityNotFound(_0x216c33,null))[_0x4d91('0x2c')](function(_0x8d84f3){if(_0x8d84f3){return _0x8d84f3[_0x4d91('0x78')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])[_0x4d91('0x2c')](function(){if(_[_0x4d91('0x79')](_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')])){for(var _0x542f58=0x0;_0x542f58<_0x585a8d[_0x4d91('0x3a')]['ids']['length'];_0x542f58+=0x1){socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')][_0x542f58]),'VoicePrefixId':Number(_0x585a8d['params']['id'])});}}else{socket[_0x4d91('0x77')](_0x4d91('0x7a'),{'UserId':Number(_0x585a8d[_0x4d91('0x3a')][_0x4d91('0x75')]),'VoicePrefixId':Number(_0x585a8d[_0x4d91('0x4d')]['id'])});}});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x216c33,null))[_0x4d91('0x4f')](handleError(_0x216c33,null));};exports['getAgents']=function(_0x28322e,_0x24376e,_0x7bc606){var _0x49d81c={};var _0xc37e2e={};var _0x45a628;var _0x2cf518;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x28322e[_0x4d91('0x4d')]['id']}})['then'](handleEntityNotFound(_0x24376e,null))[_0x4d91('0x2c')](function(_0x582bee){if(_0x582bee){_0x45a628=_0x582bee;_0xc37e2e[_0x4d91('0x39')]=_['keys'](db[_0x4d91('0x7c')][_0x4d91('0x36')]);_0xc37e2e['query']=_['keys'](_0x28322e['query']);_0xc37e2e[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0xc37e2e[_0x4d91('0x39')],_0xc37e2e[_0x4d91('0x3a')]);_0x49d81c[_0x4d91('0x3e')]=_['intersection'](_0xc37e2e['model'],qs[_0x4d91('0x3f')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x49d81c[_0x4d91('0x3e')]=_0x49d81c[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x49d81c[_0x4d91('0x3e')]:_0xc37e2e['model'];_0x49d81c[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x49d81c[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x28322e[_0x4d91('0x3a')],_0xc37e2e[_0x4d91('0x3c')]));if(_0x28322e['query'][_0x4d91('0x43')]){_0x49d81c[_0x4d91('0x44')]=_[_0x4d91('0x45')](_0x49d81c[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x49d81c[_0x4d91('0x3e')],function(_0x4682a8){var _0x51a30d={};_0x51a30d[_0x4682a8]={'$like':'%'+_0x28322e[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x51a30d;})});}_0x49d81c=_['merge']({},_0x49d81c,_0x28322e[_0x4d91('0x47')]);return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})['then'](function(_0x22cd5a){if(_0x22cd5a){_0x2cf518=_0x22cd5a[_0x4d91('0x40')];if(!_0x28322e[_0x4d91('0x3a')][_0x4d91('0x7f')](_0x4d91('0x80'))){_0x49d81c[_0x4d91('0x25')]=qs['limit'](_0x28322e[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x49d81c[_0x4d91('0x23')]=qs[_0x4d91('0x23')](_0x28322e[_0x4d91('0x3a')]['offset']);}return _0x45a628[_0x4d91('0x7e')](_0x49d81c);}})[_0x4d91('0x2c')](function(_0x3b0ab3){if(_0x3b0ab3){return _0x3b0ab3?{'count':_0x2cf518,'rows':_0x3b0ab3}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x24376e,null))[_0x4d91('0x4f')](handleError(_0x24376e,null));};exports[_0x4d91('0x81')]=function(_0x18f844,_0x3e93d0,_0x53d973){var _0x367c30={};var _0x28b505={};var _0x451e14;var _0x37fe62;return db[_0x4d91('0x35')][_0x4d91('0x7b')]({'where':{'id':_0x18f844[_0x4d91('0x4d')]['id']}})[_0x4d91('0x2c')](handleEntityNotFound(_0x3e93d0,null))[_0x4d91('0x2c')](function(_0x5abc1d){if(_0x5abc1d){_0x451e14=_0x5abc1d;_0x28b505[_0x4d91('0x39')]=_[_0x4d91('0x3b')](db[_0x4d91('0x82')][_0x4d91('0x36')]);_0x28b505['query']=_['keys'](_0x18f844[_0x4d91('0x3a')]);_0x28b505[_0x4d91('0x3c')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],_0x28b505['query']);_0x367c30[_0x4d91('0x3e')]=_[_0x4d91('0x3d')](_0x28b505[_0x4d91('0x39')],qs[_0x4d91('0x3f')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x3f')]));_0x367c30[_0x4d91('0x3e')]=_0x367c30[_0x4d91('0x3e')][_0x4d91('0x40')]?_0x367c30['attributes']:_0x28b505[_0x4d91('0x39')];_0x367c30[_0x4d91('0x41')]=qs[_0x4d91('0x42')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x42')]);_0x367c30[_0x4d91('0x44')]=qs[_0x4d91('0x3c')](_[_0x4d91('0x7d')](_0x18f844[_0x4d91('0x3a')],_0x28b505[_0x4d91('0x3c')]));if(_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]){_0x367c30['where']=_[_0x4d91('0x45')](_0x367c30[_0x4d91('0x44')],{'$or':_[_0x4d91('0x34')](_0x367c30[_0x4d91('0x3e')],function(_0x3e57a1){var _0x41fbc7={};_0x41fbc7[_0x3e57a1]={'$like':'%'+_0x18f844[_0x4d91('0x3a')][_0x4d91('0x43')]+'%'};return _0x41fbc7;})});}_0x367c30=_[_0x4d91('0x45')]({},_0x367c30,_0x18f844[_0x4d91('0x47')]);return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x5a241a){if(_0x5a241a){_0x37fe62=_0x5a241a['length'];if(!_0x18f844[_0x4d91('0x3a')]['hasOwnProperty'](_0x4d91('0x80'))){_0x367c30[_0x4d91('0x25')]=qs[_0x4d91('0x25')](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x25')]);_0x367c30[_0x4d91('0x23')]=qs['offset'](_0x18f844[_0x4d91('0x3a')][_0x4d91('0x23')]);}return _0x451e14[_0x4d91('0x81')](_0x367c30);}})[_0x4d91('0x2c')](function(_0x1419c5){if(_0x1419c5){return _0x1419c5?{'count':_0x37fe62,'rows':_0x1419c5}:null;}})[_0x4d91('0x2c')](respondWithResult(_0x3e93d0,null))[_0x4d91('0x4f')](handleError(_0x3e93d0,null));};exports[_0x4d91('0x83')]=function(_0x47cbca,_0x1df276,_0x3e2771){var _0x15d270=_0x47cbca[_0x4d91('0x53')][_0x4d91('0x75')];var _0x17e3bc;return db[_0x4d91('0x82')][_0x4d91('0x4a')]({'where':{'id':_0x15d270},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id','name',_0x4d91('0x85'),_0x4d91('0x86'),'interface'],'raw':!![]}]})[_0x4d91('0x2c')](function(_0x1f836b){if(_0x1f836b){_0x17e3bc=_0x1f836b;var _0x455dd6=_['flatMap'](_0x1f836b,function(_0x46ccf4){var _0xcc22a2=_0x46ccf4['get']({'plain':!![]});return _0xcc22a2['Agents'];});return db[_0x4d91('0x35')][_0x4d91('0x4e')]({'where':{'id':_0x47cbca[_0x4d91('0x4d')]['id']}})['then'](function(_0x352e84){return db[_0x4d91('0x72')][_0x4d91('0x52')](function(_0x3b2e36){return _0x352e84[_0x4d91('0x83')](_0x15d270,{'transaction':_0x3b2e36})[_0x4d91('0x2c')](function(){return BPromise[_0x4d91('0x87')](_0x17e3bc,function(_0x185ded){return db[_0x4d91('0x88')][_0x4d91('0x89')]({'TeamId':_0x185ded['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},{'transaction':_0x3b2e36});});})['then'](function(){return BPromise[_0x4d91('0x87')](_0x455dd6,function(_0x2a9069){return db[_0x4d91('0x8a')][_0x4d91('0x8b')]({'where':{'UserId':_0x2a9069['id'],'VoicePrefixId':_0x47cbca[_0x4d91('0x4d')]['id']},'transaction':_0x3b2e36});});})[_0x4d91('0x2c')](function(){_0x455dd6[_0x4d91('0x8c')](function(_0xb67bd3){socket[_0x4d91('0x77')](_0x4d91('0x8d'),{'UserId':_0xb67bd3['id'],'VoicePrefixId':_0x352e84['id']});});});});});}})[_0x4d91('0x2c')](respondWithStatusCode(_0x1df276,null))[_0x4d91('0x4f')](handleError(_0x1df276,null));};exports[_0x4d91('0x8e')]=function(_0xbadba4,_0xe88619,_0x44f21b){return db[_0x4d91('0x82')]['findAll']({'where':{'id':_0xbadba4['query'][_0x4d91('0x75')]},'attributes':['id'],'include':[{'model':db[_0x4d91('0x7c')],'as':_0x4d91('0x84'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xe88619,null))[_0x4d91('0x2c')](function(_0x2882d5){var _0x2678e7=_[_0x4d91('0x34')](_0x2882d5,'id');var _0x236a61=[];var _0x54f720=[];var _0x5f2ce4=squel['select']();_0x5f2ce4['field'](_0x4d91('0x8f'))[_0x4d91('0x90')]('team_has_voice_prefixes','tq')[_0x4d91('0x91')](_0x4d91('0x92'),'ut',_0x4d91('0x93'))['where'](_0x4d91('0x94'),_0xbadba4[_0x4d91('0x4d')]['id']);for(var _0x237074=0x0;_0x237074<_0x2882d5['length'];_0x237074+=0x1){let _0x3b4804=_0x2882d5[_0x237074];for(var _0x20212f=0x0;_0x20212f<_0x3b4804[_0x4d91('0x84')][_0x4d91('0x40')];_0x20212f+=0x1){let _0x39de93=_0x3b4804['Agents'][_0x20212f];var _0xe60b6=_0x5f2ce4[_0x4d91('0x95')]();_0xe60b6[_0x4d91('0x44')](_0x4d91('0x96'),_0x39de93['id']);_0x54f720['push'](db[_0x4d91('0x72')][_0x4d91('0x3a')](_0xe60b6[_0x4d91('0x97')](),{'type':db[_0x4d91('0x72')][_0x4d91('0x98')][_0x4d91('0x99')]})['then'](function(_0x12e226){if(_0x12e226[_0x4d91('0x40')]===0x1){return _0x39de93['id'];}else{var _0x448a12=_[_0x4d91('0x9a')](_[_0x4d91('0x34')](_0x12e226,_0x4d91('0x9b')),function(_0x2c5ccc){return _['includes'](_0x2678e7,_0x2c5ccc);});if(_0x448a12){return _0x39de93['id'];}}}));}}return BPromise['all'](_0x54f720)[_0x4d91('0x2c')](function(_0x4026b3){_0x236a61=_(_0x236a61)[_0x4d91('0x9c')](_0x4026b3)[_0x4d91('0x9d')]()[_0x4d91('0x9e')]();return db[_0x4d91('0x35')]['find']({'where':{'id':_0xbadba4[_0x4d91('0x4d')]['id']}})['then'](function(_0x3e23df){return db[_0x4d91('0x72')]['transaction'](function(_0x9d7ff1){return _0x3e23df[_0x4d91('0x8e')](_0xbadba4['query']['ids'],{'transaction':_0x9d7ff1})['then'](function(){if(!_[_0x4d91('0x9f')](_0x236a61)){return _0x3e23df['removeAgents'](_0x236a61,{'transaction':_0x9d7ff1});}})[_0x4d91('0x2c')](function(){_0x236a61[_0x4d91('0x8c')](function(_0x4da3b1){socket['emit'](_0x4d91('0x7a'),{'UserId':_0x4da3b1,'VoicePrefixId':_0x3e23df['id']});});});});});});})[_0x4d91('0x2c')](respondWithStatusCode(_0xe88619,null))[_0x4d91('0x4f')](handleError(_0xe88619,null));}; \ No newline at end of file +var _0x0972=['filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','get','Extensions\x20creation\x20failed','prefix','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','length','charAt','system-','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','rimraf','fast-json-patch','moment','bluebird','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query'];(function(_0x478164,_0x4e8b85){var _0x185ba3=function(_0x542f7f){while(--_0x542f7f){_0x478164['push'](_0x478164['shift']());}};_0x185ba3(++_0x4e8b85);}(_0x0972,0x64));var _0x2097=function(_0x37332c,_0x3048e5){_0x37332c=_0x37332c-0x0;var _0x4dd17e=_0x0972[_0x37332c];return _0x4dd17e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];config[_0x2097('0x1a')]=_[_0x2097('0x1b')](config[_0x2097('0x1a')],{'host':_0x2097('0x1c'),'port':0x18eb});var socket=require(_0x2097('0x1d'))(new Redis(config[_0x2097('0x1a')]));require(_0x2097('0x1e'))[_0x2097('0x1f')](socket);function respondWithStatusCode(_0x354387,_0x5d0a43){_0x5d0a43=_0x5d0a43||0xcc;return function(_0x639c14){if(_0x639c14){return _0x354387[_0x2097('0x20')](_0x5d0a43);}return _0x354387['status'](_0x5d0a43)['end']();};}function respondWithResult(_0x4fc8c5,_0x409deb){_0x409deb=_0x409deb||0xc8;return function(_0x588396){if(_0x588396){return _0x4fc8c5[_0x2097('0x21')](_0x409deb)[_0x2097('0x22')](_0x588396);}};}function respondWithFilteredResult(_0x43fec9,_0x1347e4){return function(_0x44c584){if(_0x44c584){var _0x53e2b4=typeof _0x1347e4[_0x2097('0x23')]===_0x2097('0x24')&&typeof _0x1347e4[_0x2097('0x25')]===_0x2097('0x24');var _0x1d3804=_0x44c584[_0x2097('0x26')];var _0x253f5d=_0x53e2b4?0x0:_0x1347e4[_0x2097('0x23')];var _0x5d8b9e=_0x53e2b4?_0x44c584['count']:_0x1347e4[_0x2097('0x23')]+_0x1347e4['limit'];var _0x227c00;if(_0x5d8b9e>=_0x1d3804){_0x5d8b9e=_0x1d3804;_0x227c00=0xc8;}else{_0x227c00=0xce;}_0x43fec9[_0x2097('0x21')](_0x227c00);return _0x43fec9['set'](_0x2097('0x27'),_0x253f5d+'-'+_0x5d8b9e+'/'+_0x1d3804)['json'](_0x44c584);}return null;};}function patchUpdates(_0x2e17c8){return function(_0xf32d3f){try{jsonpatch[_0x2097('0x28')](_0xf32d3f,_0x2e17c8,!![]);}catch(_0x20b93a){return BPromise[_0x2097('0x29')](_0x20b93a);}return _0xf32d3f[_0x2097('0x2a')]();};}function saveUpdates(_0x56390a,_0xae5f9){return function(_0x500234){if(_0x500234){return _0x500234[_0x2097('0x2b')](_0x56390a)[_0x2097('0x2c')](function(_0x345875){return _0x345875;});}return null;};}function removeEntity(_0x9f59bc,_0x499988){return function(_0x2d683a){if(_0x2d683a){return _0x2d683a[_0x2097('0x2d')]()['then'](function(){var _0x1229fc=_0x2d683a['get']({'plain':!![]});var _0x29b879='VoicePrefixes';return db[_0x2097('0x2e')][_0x2097('0x2d')]({'where':{'type':_0x29b879,'resourceId':_0x1229fc['id']}})[_0x2097('0x2c')](function(){return _0x2d683a;});})[_0x2097('0x2c')](function(){_0x9f59bc[_0x2097('0x21')](0xcc)[_0x2097('0x2f')]();});}};}function handleEntityNotFound(_0x450e0b,_0x4b443d){return function(_0x11242f){if(!_0x11242f){_0x450e0b[_0x2097('0x20')](0x194);}return _0x11242f;};}function handleError(_0x5cce55,_0x1398d0){_0x1398d0=_0x1398d0||0x1f4;return function(_0x41487d){logger['error'](_0x41487d['stack']);if(_0x41487d[_0x2097('0x30')]){delete _0x41487d[_0x2097('0x30')];}_0x5cce55[_0x2097('0x21')](_0x1398d0)[_0x2097('0x31')](_0x41487d);};}exports[_0x2097('0x32')]=function(_0x180654,_0x56c538){var _0xe1a381={},_0x56bb42={},_0x193160={'count':0x0,'rows':[]};var _0x3c36d3=_[_0x2097('0x33')](db[_0x2097('0x34')][_0x2097('0x35')],function(_0x395d9f){return{'name':_0x395d9f[_0x2097('0x36')],'type':_0x395d9f[_0x2097('0x37')][_0x2097('0x38')]};});_0x56bb42['model']=_[_0x2097('0x33')](_0x3c36d3,_0x2097('0x30'));_0x56bb42[_0x2097('0x39')]=_['keys'](_0x180654[_0x2097('0x39')]);_0x56bb42[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x56bb42[_0x2097('0x3c')],_0x56bb42['query']);_0xe1a381['attributes']=_['intersection'](_0x56bb42[_0x2097('0x3c')],qs[_0x2097('0x3d')](_0x180654[_0x2097('0x39')][_0x2097('0x3d')]));_0xe1a381[_0x2097('0x3e')]=_0xe1a381[_0x2097('0x3e')]['length']?_0xe1a381[_0x2097('0x3e')]:_0x56bb42[_0x2097('0x3c')];if(!_0x180654[_0x2097('0x39')][_0x2097('0x3f')](_0x2097('0x40'))){_0xe1a381[_0x2097('0x25')]=qs['limit'](_0x180654[_0x2097('0x39')][_0x2097('0x25')]);_0xe1a381[_0x2097('0x23')]=qs['offset'](_0x180654['query'][_0x2097('0x23')]);}_0xe1a381[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x180654[_0x2097('0x39')][_0x2097('0x42')]);_0xe1a381[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x180654[_0x2097('0x39')],_0x56bb42[_0x2097('0x3a')]),_0x3c36d3);if(_0x180654[_0x2097('0x39')][_0x2097('0x45')]){_0xe1a381['where']=_[_0x2097('0x46')](_0xe1a381[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x3c36d3,function(_0x483900){if(_0x483900[_0x2097('0x37')]!==_0x2097('0x47')){var _0x26d448={};_0x26d448[_0x483900[_0x2097('0x30')]]={'$like':'%'+_0x180654[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x26d448;}})});}_0xe1a381=_[_0x2097('0x46')]({},_0xe1a381,_0x180654[_0x2097('0x48')]);var _0x5ab893={'where':_0xe1a381[_0x2097('0x43')]};return db[_0x2097('0x34')][_0x2097('0x26')](_0x5ab893)[_0x2097('0x2c')](function(_0x12e0e2){_0x193160[_0x2097('0x26')]=_0x12e0e2;if(_0x180654[_0x2097('0x39')][_0x2097('0x49')]){_0xe1a381['include']=[{'all':!![]}];}return db[_0x2097('0x34')]['findAll'](_0xe1a381);})[_0x2097('0x2c')](function(_0x298e49){_0x193160[_0x2097('0x4a')]=_0x298e49;return _0x193160;})[_0x2097('0x2c')](respondWithFilteredResult(_0x56c538,_0xe1a381))[_0x2097('0x4b')](handleError(_0x56c538,null));};exports['show']=function(_0x2cf34e,_0x46ccbb){var _0x113c3b={'raw':![],'where':{'id':_0x2cf34e[_0x2097('0x4c')]['id']}},_0x39e0a4={};_0x39e0a4['model']=_[_0x2097('0x4d')](db[_0x2097('0x34')][_0x2097('0x35')]);_0x39e0a4[_0x2097('0x39')]=_[_0x2097('0x4d')](_0x2cf34e[_0x2097('0x39')]);_0x39e0a4[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x39e0a4['model'],_0x39e0a4[_0x2097('0x39')]);_0x113c3b[_0x2097('0x3e')]=_[_0x2097('0x3b')](_0x39e0a4[_0x2097('0x3c')],qs['fields'](_0x2cf34e['query']['fields']));_0x113c3b[_0x2097('0x3e')]=_0x113c3b[_0x2097('0x3e')]['length']?_0x113c3b[_0x2097('0x3e')]:_0x39e0a4[_0x2097('0x3c')];if(_0x2cf34e['query']['includeAll']){_0x113c3b[_0x2097('0x4e')]=[{'all':!![]}];}_0x113c3b=_[_0x2097('0x46')]({},_0x113c3b,_0x2cf34e[_0x2097('0x48')]);return db['VoicePrefix'][_0x2097('0x4f')](_0x113c3b)[_0x2097('0x2c')](handleEntityNotFound(_0x46ccbb,null))['then'](respondWithResult(_0x46ccbb,null))[_0x2097('0x4b')](handleError(_0x46ccbb,null));};exports[_0x2097('0x2d')]=function(_0xdfea21,_0xba6ef0){return db[_0x2097('0x34')]['find']({'where':{'id':_0xdfea21['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0xba6ef0,null))[_0x2097('0x2c')](removeEntity(_0xba6ef0,null))[_0x2097('0x4b')](handleError(_0xba6ef0,null));};exports['describe']=function(_0x5c1739,_0x144719){return db[_0x2097('0x34')]['describe']()[_0x2097('0x2c')](respondWithResult(_0x144719,null))[_0x2097('0x4b')](handleError(_0x144719,null));};exports[_0x2097('0x50')]=function(_0x33490e,_0x390a52){var _0x4a709a;return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x190859){return db['VoicePrefix'][_0x2097('0x50')](_0x33490e[_0x2097('0x53')],{'transaction':_0x190859})['then'](function(_0x12ba76){_0x4a709a=_0x12ba76['get']({'plain':!![]});return db[_0x2097('0x54')]['find']({'where':{'id':_0x4a709a['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40cbe1){return createVoicePrefixExtensions(_0x4a709a,_0x40cbe1,_0x190859);});});})['then'](function(){var _0x54bea1=_0x33490e[_0x2097('0x55')]['get']({'plain':!![]});if(!_0x54bea1)throw new Error(_0x2097('0x56'));if(_0x54bea1[_0x2097('0x57')]==='user'){var _0x3e799f=_0x4a709a;return db[_0x2097('0x58')][_0x2097('0x4f')]({'where':{'name':_0x2097('0x59'),'userProfileId':_0x54bea1[_0x2097('0x5a')]},'raw':!![]})['then'](function(_0x2117e3){if(_0x2117e3&&_0x2117e3['autoAssociation']===0x0){return db[_0x2097('0x2e')][_0x2097('0x50')]({'name':_0x3e799f[_0x2097('0x30')],'resourceId':_0x3e799f['id'],'type':_0x2117e3['name'],'sectionId':_0x2117e3['id']},{})[_0x2097('0x2c')](function(){return _0x4a709a;});}else{return _0x4a709a;}})[_0x2097('0x4b')](function(_0x2f5016){logger[_0x2097('0x5b')](_0x2097('0x5c'),_0x2f5016);throw _0x2f5016;});}return _0x4a709a;})['then'](respondWithResult(_0x390a52,null))['catch'](handleError(_0x390a52,null));};function Extension(_0x265eac,_0x275578,_0x4cc782,_0x4ddb4b){this['context']='from-sip';this[_0x2097('0x5d')]=_0x265eac;this['app']=_0x4cc782;this[_0x2097('0x37')]=_0x2097('0x5e');this['description']=_0x2097('0x5f');this[_0x2097('0x60')]=_0x275578;this[_0x2097('0x61')]=_0x4ddb4b;}function createVoicePrefixExtensions(_0x103756,_0x2a2673,_0x60332a){return new BPromise(function(_0x15aa91,_0x8f7aaa){var _0x2ec365=new Extension(formatPrefixName(_0x103756['prefix']),0x1,_0x2097('0x62'),_0x2097('0x63'));_0x2ec365[_0x2097('0x64')]=_0x103756['id'];return db[_0x2097('0x54')][_0x2097('0x50')](_0x2ec365,{'transaction':_0x60332a})[_0x2097('0x2c')](function(_0x4befa9){var _0x43071d=_0x4befa9[_0x2097('0x65')]({'plain':!![]});var _0xcabda7=_[_0x2097('0x33')](addVoicePrefixExtensions(_0x103756,_0x2a2673),function(_0x1c4156){_0x1c4156['VoiceExtensionId']=_0x43071d['id'];_0x1c4156[_0x2097('0x64')]=_0x103756['id'];return _0x1c4156;});return db[_0x2097('0x54')]['bulkCreate'](_0xcabda7,{'transaction':_0x60332a})['then'](function(_0x580c1e){if(!_0x580c1e){return _0x8f7aaa(_0x2097('0x66'));}else{return _0x15aa91(_0x580c1e);}})[_0x2097('0x4b')](function(_0x319d3b){return _0x8f7aaa(_0x319d3b);});});;});};function addVoicePrefixExtensions(_0x3edb3e,_0x168703){var _0x18d90a=[];var _0x2e287b=formatPrefixName(_0x3edb3e[_0x2097('0x67')]);_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x2,'Set','CDR(prefix)='+_0x3edb3e[_0x2097('0x30')]));if(_0x3edb3e[_0x2097('0x69')]){_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x3,_0x2097('0x6a'),_0x2097('0x6b')+_0x3edb3e[_0x2097('0x69')]));}else{_0x18d90a['push'](new Extension(_0x2e287b,0x3,_0x2097('0x62'),_0x2097('0x6c')));}_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x4,_0x2097('0x6d'),_0x168703['context']+','+'${EXTEN:'+(0x8+_0x3edb3e[_0x2097('0x30')][_0x2097('0x6e')])+'}'+','+0x1));return _0x18d90a;}function formatPrefixName(_0x487f1f){var _0x3707da='_';for(var _0x426290=0x0;_0x426290<_0x487f1f[_0x2097('0x6e')];_0x426290++){if(_0x487f1f[_0x2097('0x6f')](_0x426290)=='-'){_0x3707da+=_0x487f1f[_0x2097('0x6f')](_0x426290);}else{_0x3707da+='['+_0x487f1f[_0x2097('0x6f')](_0x426290)+']';}}_0x3707da+='.';return _0x3707da;}exports[_0x2097('0x2b')]=function(_0x2c6f24,_0x54159e,_0x4533fd){var _0x283e2b=_0x2c6f24['body'];_0x283e2b[_0x2097('0x67')]=_0x2097('0x70')+_0x283e2b[_0x2097('0x30')]+'-';return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x46d6b5){return db[_0x2097('0x34')][_0x2097('0x2b')](_0x283e2b,{'where':{'id':_0x283e2b['id']},'transaction':_0x46d6b5})[_0x2097('0x2c')](function(){return db[_0x2097('0x54')][_0x2097('0x2d')]({'where':{'VoicePrefixId':_0x283e2b['id']},'transaction':_0x46d6b5})['then'](function(){return db[_0x2097('0x54')][_0x2097('0x4f')]({'where':{'id':_0x283e2b[_0x2097('0x71')]},'raw':!![]})[_0x2097('0x2c')](function(_0x3c9e03){return createVoicePrefixExtensions(_0x283e2b,_0x3c9e03,_0x46d6b5);});});});})['then'](function(){return db[_0x2097('0x34')][_0x2097('0x72')](_0x283e2b['id']);})[_0x2097('0x2c')](respondWithResult(_0x54159e,null))['catch'](handleError(_0x54159e,null));};exports[_0x2097('0x73')]=function(_0x545cd9,_0x364d3a,_0x4dcd9c){return db[_0x2097('0x34')]['find']({'where':{'id':_0x545cd9[_0x2097('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364d3a,null))[_0x2097('0x2c')](function(_0x3dba80){if(_0x3dba80){return _0x3dba80[_0x2097('0x73')](_0x545cd9[_0x2097('0x53')][_0x2097('0x74')],_['omit'](_0x545cd9[_0x2097('0x53')],[_0x2097('0x74'),'id'])||{})[_0x2097('0x75')](function(_0x1f733c){for(var _0xa8416a=0x0;_0xa8416a<_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0x2097('0x6e')];_0xa8416a+=0x1){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':Number(_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0xa8416a]),'VoicePrefixId':Number(_0x545cd9[_0x2097('0x4c')]['id'])});}return _0x1f733c;});}})[_0x2097('0x2c')](respondWithResult(_0x364d3a,null))[_0x2097('0x4b')](handleError(_0x364d3a,null));};exports[_0x2097('0x78')]=function(_0x57a31e,_0x1a81de,_0x4bd44d){return db['VoicePrefix'][_0x2097('0x4f')]({'where':{'id':_0x57a31e[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x1a81de,null))['then'](function(_0x34b687){if(_0x34b687){return _0x34b687[_0x2097('0x78')](_0x57a31e[_0x2097('0x39')][_0x2097('0x74')])['then'](function(){if(_[_0x2097('0x79')](_0x57a31e['query'][_0x2097('0x74')])){for(var _0x385551=0x0;_0x385551<_0x57a31e[_0x2097('0x39')][_0x2097('0x74')]['length'];_0x385551+=0x1){socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e[_0x2097('0x39')]['ids'][_0x385551]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}}else{socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e['query'][_0x2097('0x74')]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}});}})[_0x2097('0x2c')](respondWithStatusCode(_0x1a81de,null))[_0x2097('0x4b')](handleError(_0x1a81de,null));};exports[_0x2097('0x7b')]=function(_0x5efe1e,_0x5d181f,_0x56d4c0){var _0xc7481d={};var _0x3f510d={};var _0x4213d0;var _0x16451c;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x5efe1e['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x5d181f,null))[_0x2097('0x2c')](function(_0x164ad3){if(_0x164ad3){_0x4213d0=_0x164ad3;_0x3f510d[_0x2097('0x3c')]=_[_0x2097('0x4d')](db[_0x2097('0x7d')][_0x2097('0x35')]);_0x3f510d['query']=_[_0x2097('0x4d')](_0x5efe1e[_0x2097('0x39')]);_0x3f510d[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x3f510d[_0x2097('0x3c')],_0x3f510d[_0x2097('0x39')]);_0xc7481d['attributes']=_['intersection'](_0x3f510d[_0x2097('0x3c')],qs['fields'](_0x5efe1e['query'][_0x2097('0x3d')]));_0xc7481d[_0x2097('0x3e')]=_0xc7481d[_0x2097('0x3e')][_0x2097('0x6e')]?_0xc7481d[_0x2097('0x3e')]:_0x3f510d[_0x2097('0x3c')];_0xc7481d[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x5efe1e['query'][_0x2097('0x42')]);_0xc7481d[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x5efe1e[_0x2097('0x39')],_0x3f510d['filters']));if(_0x5efe1e[_0x2097('0x39')][_0x2097('0x45')]){_0xc7481d[_0x2097('0x43')]=_[_0x2097('0x46')](_0xc7481d[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0xc7481d['attributes'],function(_0x33b0c0){var _0x79f858={};_0x79f858[_0x33b0c0]={'$like':'%'+_0x5efe1e['query']['filter']+'%'};return _0x79f858;})});}_0xc7481d=_['merge']({},_0xc7481d,_0x5efe1e['options']);return _0x4213d0[_0x2097('0x7b')](_0xc7481d);}})[_0x2097('0x2c')](function(_0x3fe29e){if(_0x3fe29e){_0x16451c=_0x3fe29e[_0x2097('0x6e')];if(!_0x5efe1e[_0x2097('0x39')]['hasOwnProperty'](_0x2097('0x40'))){_0xc7481d[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x5efe1e[_0x2097('0x39')][_0x2097('0x25')]);_0xc7481d[_0x2097('0x23')]=qs['offset'](_0x5efe1e[_0x2097('0x39')][_0x2097('0x23')]);}return _0x4213d0['getAgents'](_0xc7481d);}})[_0x2097('0x2c')](function(_0x358bc3){if(_0x358bc3){return _0x358bc3?{'count':_0x16451c,'rows':_0x358bc3}:null;}})[_0x2097('0x2c')](respondWithResult(_0x5d181f,null))[_0x2097('0x4b')](handleError(_0x5d181f,null));};exports[_0x2097('0x7e')]=function(_0x498a91,_0x3a7959,_0x35570d){var _0x86f89={};var _0x26a3e5={};var _0x25bb03;var _0x429c9e;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x498a91[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x3a7959,null))[_0x2097('0x2c')](function(_0x299a3e){if(_0x299a3e){_0x25bb03=_0x299a3e;_0x26a3e5[_0x2097('0x3c')]=_['keys'](db['Team'][_0x2097('0x35')]);_0x26a3e5['query']=_['keys'](_0x498a91[_0x2097('0x39')]);_0x26a3e5[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x26a3e5[_0x2097('0x3c')],_0x26a3e5[_0x2097('0x39')]);_0x86f89['attributes']=_['intersection'](_0x26a3e5[_0x2097('0x3c')],qs['fields'](_0x498a91[_0x2097('0x39')]['fields']));_0x86f89['attributes']=_0x86f89['attributes']['length']?_0x86f89['attributes']:_0x26a3e5[_0x2097('0x3c')];_0x86f89[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x498a91[_0x2097('0x39')][_0x2097('0x42')]);_0x86f89[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x498a91[_0x2097('0x39')],_0x26a3e5[_0x2097('0x3a')]));if(_0x498a91[_0x2097('0x39')][_0x2097('0x45')]){_0x86f89[_0x2097('0x43')]=_[_0x2097('0x46')](_0x86f89[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x86f89[_0x2097('0x3e')],function(_0x5e49bc){var _0x1e30c5={};_0x1e30c5[_0x5e49bc]={'$like':'%'+_0x498a91[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x1e30c5;})});}_0x86f89=_[_0x2097('0x46')]({},_0x86f89,_0x498a91[_0x2097('0x48')]);return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x1c5ec7){if(_0x1c5ec7){_0x429c9e=_0x1c5ec7[_0x2097('0x6e')];if(!_0x498a91[_0x2097('0x39')][_0x2097('0x3f')]('nolimit')){_0x86f89[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x498a91[_0x2097('0x39')][_0x2097('0x25')]);_0x86f89[_0x2097('0x23')]=qs[_0x2097('0x23')](_0x498a91['query']['offset']);}return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x2beb7a){if(_0x2beb7a){return _0x2beb7a?{'count':_0x429c9e,'rows':_0x2beb7a}:null;}})['then'](respondWithResult(_0x3a7959,null))[_0x2097('0x4b')](handleError(_0x3a7959,null));};exports[_0x2097('0x7f')]=function(_0x4eeac1,_0x459585,_0x436533){var _0x16405f=_0x4eeac1[_0x2097('0x53')][_0x2097('0x74')];var _0x41f718;return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x16405f},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id',_0x2097('0x30'),_0x2097('0x83'),_0x2097('0x84'),_0x2097('0x85')],'raw':!![]}]})[_0x2097('0x2c')](function(_0x44661a){if(_0x44661a){_0x41f718=_0x44661a;var _0x39e21f=_['flatMap'](_0x44661a,function(_0x2d211b){var _0x1ab39a=_0x2d211b[_0x2097('0x65')]({'plain':!![]});return _0x1ab39a[_0x2097('0x82')];});return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x4eeac1[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](function(_0xecd4fc){return db[_0x2097('0x51')]['transaction'](function(_0x2fb539){return _0xecd4fc[_0x2097('0x7f')](_0x16405f,{'transaction':_0x2fb539})[_0x2097('0x2c')](function(){return BPromise[_0x2097('0x86')](_0x41f718,function(_0x17c494){return db[_0x2097('0x87')][_0x2097('0x88')]({'TeamId':_0x17c494['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},{'transaction':_0x2fb539});});})['then'](function(){return BPromise[_0x2097('0x86')](_0x39e21f,function(_0x239570){return db[_0x2097('0x89')][_0x2097('0x8a')]({'where':{'UserId':_0x239570['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},'transaction':_0x2fb539});});})[_0x2097('0x2c')](function(){_0x39e21f[_0x2097('0x8b')](function(_0x51bb2f){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':_0x51bb2f['id'],'VoicePrefixId':_0xecd4fc['id']});});});});});}})['then'](respondWithStatusCode(_0x459585,null))[_0x2097('0x4b')](handleError(_0x459585,null));};exports[_0x2097('0x8c')]=function(_0x568de5,_0x473a54,_0x53a5ed){return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x568de5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id'],'raw':!![]}]})[_0x2097('0x2c')](handleEntityNotFound(_0x473a54,null))[_0x2097('0x2c')](function(_0x1909d8){var _0x2de4=_[_0x2097('0x33')](_0x1909d8,'id');var _0x43a1f8=[];var _0xb53629=[];var _0x516ed6=squel[_0x2097('0x8d')]();_0x516ed6[_0x2097('0x8e')]('tq.TeamId')['from'](_0x2097('0x8f'),'tq')[_0x2097('0x90')](_0x2097('0x91'),'ut',_0x2097('0x92'))[_0x2097('0x43')](_0x2097('0x93'),_0x568de5[_0x2097('0x4c')]['id']);for(var _0x5626f0=0x0;_0x5626f0<_0x1909d8[_0x2097('0x6e')];_0x5626f0+=0x1){let _0x45bbca=_0x1909d8[_0x5626f0];for(var _0x46fc92=0x0;_0x46fc92<_0x45bbca[_0x2097('0x82')][_0x2097('0x6e')];_0x46fc92+=0x1){let _0x357a5b=_0x45bbca[_0x2097('0x82')][_0x46fc92];var _0x3fcedc=_0x516ed6[_0x2097('0x94')]();_0x3fcedc[_0x2097('0x43')](_0x2097('0x95'),_0x357a5b['id']);_0xb53629['push'](db[_0x2097('0x51')][_0x2097('0x39')](_0x3fcedc['toString'](),{'type':db[_0x2097('0x51')][_0x2097('0x96')]['SELECT']})[_0x2097('0x2c')](function(_0xbe052f){if(_0xbe052f['length']===0x1){return _0x357a5b['id'];}else{var _0x32c5f1=_[_0x2097('0x97')](_[_0x2097('0x33')](_0xbe052f,_0x2097('0x98')),function(_0x456633){return _[_0x2097('0x99')](_0x2de4,_0x456633);});if(_0x32c5f1){return _0x357a5b['id'];}}}));}}return BPromise[_0x2097('0x9a')](_0xb53629)[_0x2097('0x2c')](function(_0x124d8f){_0x43a1f8=_(_0x43a1f8)[_0x2097('0x9b')](_0x124d8f)['compact']()[_0x2097('0x9c')]();return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x568de5[_0x2097('0x4c')]['id']}})['then'](function(_0x1b555e){return db['sequelize'][_0x2097('0x52')](function(_0x1ab515){return _0x1b555e[_0x2097('0x8c')](_0x568de5[_0x2097('0x39')][_0x2097('0x74')],{'transaction':_0x1ab515})[_0x2097('0x2c')](function(){if(!_[_0x2097('0x9d')](_0x43a1f8)){return _0x1b555e[_0x2097('0x78')](_0x43a1f8,{'transaction':_0x1ab515});}})[_0x2097('0x2c')](function(){_0x43a1f8['forEach'](function(_0x22fa5d){socket['emit']('userVoicePrefix:remove',{'UserId':_0x22fa5d,'VoicePrefixId':_0x1b555e['id']});});});});});});})['then'](respondWithStatusCode(_0x473a54,null))['catch'](handleError(_0x473a54,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index b266ee7..9a0f6bd 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 _0xef2b=['emit','hasOwnProperty','hook','exports','events','VoicePrefix','save','update'];(function(_0x557404,_0x1f162){var _0x2fdec8=function(_0x3f4ef2){while(--_0x3f4ef2){_0x557404['push'](_0x557404['shift']());}};_0x2fdec8(++_0x1f162);}(_0xef2b,0x1b4));var _0xbef2=function(_0x206a0d,_0x5e70d6){_0x206a0d=_0x206a0d-0x0;var _0x1a38d8=_0xef2b[_0x206a0d];return _0x1a38d8;};'use strict';var EventEmitter=require(_0xbef2('0x0'));var VoicePrefix=require('../../mysqldb')['db'][_0xbef2('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbef2('0x2'),'afterUpdate':_0xbef2('0x3'),'afterDestroy':'remove'};function emitEvent(_0x54b55e){return function(_0x45b722,_0x9e291f,_0xac269){VoicePrefixEvents[_0xbef2('0x4')](_0x54b55e+':'+_0x45b722['id'],_0x45b722);VoicePrefixEvents[_0xbef2('0x4')](_0x54b55e,_0x45b722);_0xac269(null);};}for(var e in events){if(events[_0xbef2('0x5')](e)){var event=events[e];VoicePrefix[_0xbef2('0x6')](e,emitEvent(event));}}module[_0xbef2('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xe2ef=['emit','hasOwnProperty','../../mysqldb','VoicePrefix','setMaxListeners','save'];(function(_0x427ddd,_0x29c346){var _0x76aa06=function(_0x1e424b){while(--_0x1e424b){_0x427ddd['push'](_0x427ddd['shift']());}};_0x76aa06(++_0x29c346);}(_0xe2ef,0x68));var _0xfe2e=function(_0xb9ae49,_0x5880c0){_0xb9ae49=_0xb9ae49-0x0;var _0x2a7c6c=_0xe2ef[_0xb9ae49];return _0x2a7c6c;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xfe2e('0x0'))['db'][_0xfe2e('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xfe2e('0x2')](0x0);var events={'afterCreate':_0xfe2e('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54f2db){return function(_0x19fbc9,_0x24bb9a,_0x4248b8){VoicePrefixEvents[_0xfe2e('0x4')](_0x54f2db+':'+_0x19fbc9['id'],_0x19fbc9);VoicePrefixEvents[_0xfe2e('0x4')](_0x54f2db,_0x19fbc9);_0x4248b8(null);};}for(var e in events){if(events[_0xfe2e('0x5')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 8f8c20c..8f83faf 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 _0x4a0b=['lodash','util','api','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','VoicePrefix','voice_prefixes'];(function(_0xb61e1b,_0x9f371a){var _0x482007=function(_0x4832f5){while(--_0x4832f5){_0xb61e1b['push'](_0xb61e1b['shift']());}};_0x482007(++_0x9f371a);}(_0x4a0b,0x1e0));var _0xb4a0=function(_0x3116c9,_0x1db034){_0x3116c9=_0x3116c9-0x0;var _0x2ca671=_0x4a0b[_0x3116c9];return _0x2ca671;};'use strict';var _=require(_0xb4a0('0x0'));var util=require(_0xb4a0('0x1'));var logger=require('../../config/logger')(_0xb4a0('0x2'));var moment=require('moment');var BPromise=require(_0xb4a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb4a0('0x4'));var config=require(_0xb4a0('0x5'));var attributes=require(_0xb4a0('0x6'));module[_0xb4a0('0x7')]=function(_0x56540f,_0x538297){return _0x56540f['define'](_0xb4a0('0x8'),attributes,{'tableName':_0xb4a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc330=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoicePrefix','voice_prefixes','lodash'];(function(_0x205ba7,_0x7573fe){var _0x70a07e=function(_0x24212a){while(--_0x24212a){_0x205ba7['push'](_0x205ba7['shift']());}};_0x70a07e(++_0x7573fe);}(_0xc330,0xdc));var _0x0c33=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc330[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x0c33('0x0'));var util=require(_0x0c33('0x1'));var logger=require(_0x0c33('0x2'))(_0x0c33('0x3'));var moment=require(_0x0c33('0x4'));var BPromise=require(_0x0c33('0x5'));var rp=require(_0x0c33('0x6'));var fs=require('fs');var path=require(_0x0c33('0x7'));var rimraf=require(_0x0c33('0x8'));var config=require(_0x0c33('0x9'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x4465a8,_0x16e0bc){return _0x4465a8[_0x0c33('0xa')](_0x0c33('0xb'),attributes,{'tableName':_0x0c33('0xc'),'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 0d4f8e2..625520c 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 _0x6209=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x5b32b6,_0x415042){var _0x436536=function(_0x4c9772){while(--_0x4c9772){_0x5b32b6['push'](_0x5b32b6['shift']());}};_0x436536(++_0x415042);}(_0x6209,0x1e8));var _0x9620=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x6209[_0x2b10c6];return _0x3789d2;};'use strict';var _=require(_0x9620('0x0'));var util=require(_0x9620('0x1'));var moment=require(_0x9620('0x2'));var BPromise=require(_0x9620('0x3'));var rs=require(_0x9620('0x4'));var fs=require('fs');var Redis=require(_0x9620('0x5'));var db=require(_0x9620('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9620('0x7'))(_0x9620('0x8'));var config=require(_0x9620('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9620('0xa')][_0x9620('0xb')]({'port':0x232a});config[_0x9620('0xc')]=_[_0x9620('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9620('0xe'))(new Redis(config['redis']));require(_0x9620('0xf'))[_0x9620('0x10')](socket);function respondWithRpcPromise(_0x186b36,_0x10e8c3,_0x4764e6){return new BPromise(function(_0xec897,_0x30fa46){return client['request'](_0x186b36,_0x4764e6)[_0x9620('0x11')](function(_0x52bb7c){logger[_0x9620('0x12')](_0x9620('0x13'),_0x10e8c3,_0x9620('0x14'));logger[_0x9620('0x15')](_0x9620('0x16'),_0x10e8c3,_0x9620('0x14'),JSON[_0x9620('0x17')](_0x52bb7c));if(_0x52bb7c[_0x9620('0x18')]){if(_0x52bb7c[_0x9620('0x18')][_0x9620('0x19')]===0x1f4){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x10e8c3,_0x52bb7c[_0x9620('0x18')][_0x9620('0x1a')]);return _0x30fa46(_0x52bb7c['error'][_0x9620('0x1a')]);}logger[_0x9620('0x18')](_0x9620('0x13'),_0x10e8c3,_0x52bb7c[_0x9620('0x18')]['message']);return _0xec897(_0x52bb7c[_0x9620('0x18')][_0x9620('0x1a')]);}else{logger['info'](_0x9620('0x13'),_0x10e8c3,'request\x20sent');_0xec897(_0x52bb7c[_0x9620('0x1b')][_0x9620('0x1a')]);}})[_0x9620('0x1c')](function(_0x3a7a3a){logger[_0x9620('0x18')]('VoicePrefix,\x20%s,\x20%s',_0x10e8c3,_0x3a7a3a);_0x30fa46(_0x3a7a3a);});});} \ No newline at end of file +var _0x9ab8=['defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x42e8bf,_0x2eaf0a){var _0x325b5d=function(_0x1398cc){while(--_0x1398cc){_0x42e8bf['push'](_0x42e8bf['shift']());}};_0x325b5d(++_0x2eaf0a);}(_0x9ab8,0x81));var _0x89ab=function(_0x59a244,_0x22898a){_0x59a244=_0x59a244-0x0;var _0x3bc2ed=_0x9ab8[_0x59a244];return _0x3bc2ed;};'use strict';var _=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var moment=require(_0x89ab('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x89ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x89ab('0x4'));var logger=require(_0x89ab('0x5'))('rpc');var config=require(_0x89ab('0x6'));var jayson=require(_0x89ab('0x7'));var client=jayson[_0x89ab('0x8')][_0x89ab('0x9')]({'port':0x232a});config[_0x89ab('0xa')]=_[_0x89ab('0xb')](config[_0x89ab('0xa')],{'host':_0x89ab('0xc'),'port':0x18eb});var socket=require(_0x89ab('0xd'))(new Redis(config[_0x89ab('0xa')]));require(_0x89ab('0xe'))[_0x89ab('0xf')](socket);function respondWithRpcPromise(_0x4c1dcc,_0x539391,_0x4f0d68){return new BPromise(function(_0x551f06,_0x4ef4a8){return client[_0x89ab('0x10')](_0x4c1dcc,_0x4f0d68)[_0x89ab('0x11')](function(_0x6b8ccb){logger[_0x89ab('0x12')](_0x89ab('0x13'),_0x539391,_0x89ab('0x14'));logger[_0x89ab('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x539391,_0x89ab('0x14'),JSON[_0x89ab('0x16')](_0x6b8ccb));if(_0x6b8ccb[_0x89ab('0x17')]){if(_0x6b8ccb[_0x89ab('0x17')][_0x89ab('0x18')]===0x1f4){logger['error'](_0x89ab('0x13'),_0x539391,_0x6b8ccb[_0x89ab('0x17')]['message']);return _0x4ef4a8(_0x6b8ccb['error']['message']);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x539391,_0x6b8ccb['error'][_0x89ab('0x19')]);return _0x551f06(_0x6b8ccb[_0x89ab('0x17')][_0x89ab('0x19')]);}else{logger[_0x89ab('0x12')](_0x89ab('0x13'),_0x539391,_0x89ab('0x14'));_0x551f06(_0x6b8ccb[_0x89ab('0x1a')][_0x89ab('0x19')]);}})[_0x89ab('0x1b')](function(_0x5736f7){logger[_0x89ab('0x17')](_0x89ab('0x13'),_0x539391,_0x5736f7);_0x4ef4a8(_0x5736f7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index a385fbf..e0a986d 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 _0xb945=['length','./voicePrefix.events','remove','emit','removeListener','register'];(function(_0x1cb5a7,_0x153234){var _0x20deba=function(_0x2ea303){while(--_0x2ea303){_0x1cb5a7['push'](_0x1cb5a7['shift']());}};_0x20deba(++_0x153234);}(_0xb945,0x97));var _0x5b94=function(_0x371c6d,_0xb66639){_0x371c6d=_0x371c6d-0x0;var _0x40e38f=_0xb945[_0x371c6d];return _0x40e38f;};'use strict';var VoicePrefixEvents=require(_0x5b94('0x0'));var events=['save',_0x5b94('0x1'),'update'];function createListener(_0x2b814e,_0x4cc83f){return function(_0x488e8d){_0x4cc83f[_0x5b94('0x2')](_0x2b814e,_0x488e8d);};}function removeListener(_0x3f7199,_0x30d552){return function(){VoicePrefixEvents[_0x5b94('0x3')](_0x3f7199,_0x30d552);};}exports[_0x5b94('0x4')]=function(_0x4bef06){for(var _0x492388=0x0,_0x2db8d8=events[_0x5b94('0x5')];_0x492388<_0x2db8d8;_0x492388++){var _0x42bd69=events[_0x492388];var _0x186d22=createListener('voicePrefix:'+_0x42bd69,_0x4bef06);VoicePrefixEvents['on'](_0x42bd69,_0x186d22);}}; \ No newline at end of file +var _0x65d2=['length','voicePrefix:','./voicePrefix.events','save','update','emit','register'];(function(_0x1895b9,_0x418750){var _0x16ab09=function(_0x1ba805){while(--_0x1ba805){_0x1895b9['push'](_0x1895b9['shift']());}};_0x16ab09(++_0x418750);}(_0x65d2,0xb8));var _0x265d=function(_0x74e8c2,_0xdb50b3){_0x74e8c2=_0x74e8c2-0x0;var _0x233472=_0x65d2[_0x74e8c2];return _0x233472;};'use strict';var VoicePrefixEvents=require(_0x265d('0x0'));var events=[_0x265d('0x1'),'remove',_0x265d('0x2')];function createListener(_0x12fc9b,_0x3a315b){return function(_0x59c81e){_0x3a315b[_0x265d('0x3')](_0x12fc9b,_0x59c81e);};}function removeListener(_0x233dd9,_0x2f91bf){return function(){VoicePrefixEvents['removeListener'](_0x233dd9,_0x2f91bf);};}exports[_0x265d('0x4')]=function(_0xd49e24){for(var _0x27dc2d=0x0,_0x1020fa=events[_0x265d('0x5')];_0x27dc2d<_0x1020fa;_0x27dc2d++){var _0x5ca577=events[_0x27dc2d];var _0x36bf91=createListener(_0x265d('0x6')+_0x5ca577,_0xd49e24);VoicePrefixEvents['on'](_0x5ca577,_0x36bf91);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 53b08ce..f05cfb0 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(_0x86ca1,_0x40c492){var _0x55ad17=function(_0x377977){while(--_0x377977){_0x86ca1['push'](_0x86ca1['shift']());}};_0x55ad17(++_0x40c492);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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(_0x4fffcf,_0x49b324){var _0x544752=function(_0x25b6f6){while(--_0x25b6f6){_0x4fffcf['push'](_0x4fffcf['shift']());}};_0x544752(++_0x49b324);}(_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 53bccf0..e746c72 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 _0xc017=['#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','type','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','progressive','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#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','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(_0x101f53,_0x227e4e){var _0x4ffee3=function(_0xf06790){while(--_0xf06790){_0x101f53['push'](_0x101f53['shift']());}};_0x4ffee3(++_0x227e4e);}(_0xc017,0x1f2));var _0x7c01=function(_0x150b05,_0x4b83a2){_0x150b05=_0x150b05-0x0;var _0x10570d=_0xc017[_0x150b05];return _0x10570d;};'use strict';var Sequelize=require(_0x7c01('0x0'));module[_0x7c01('0x1')]={'name':{'type':Sequelize[_0x7c01('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x4'),_0x7c01('0x5')),'allowNull':![],'defaultValue':_0x7c01('0x4')},'musiconhold':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':_0x7c01('0x6')},'announce':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x7c01('0x7'),_0x7c01('0x8'),_0x7c01('0x9'),'random',_0x7c01('0xa'),_0x7c01('0xb'),_0x7c01('0xc'),_0x7c01('0xd')),'allowNull':![],'defaultValue':_0x7c01('0x7'),'set':function(_0x10a92c){this[_0x7c01('0xe')](_0x7c01('0xf'),_0x10a92c?_0x10a92c:_0x7c01('0xa'));},'get':function(){var _0x2ad43c=this[_0x7c01('0x10')](_0x7c01('0x11'));var _0x163650=this['getDataValue']('dialMethod');var _0x3163a7=this['getDataValue'](_0x7c01('0xf'));if(_0x2ad43c===_0x7c01('0x5')){if(_0x163650===_0x7c01('0x12')){return null;}if(_0x163650===_0x7c01('0x13')&&!['rrmemory',_0x7c01('0x14')][_0x7c01('0x15')](_0x3163a7)){this[_0x7c01('0xe')](_0x7c01('0xf'),_0x7c01('0xa'));}}return _0x3163a7;}},'servicelevel':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x7c01('0x2')]},'weight':{'type':Sequelize[_0x7c01('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':_0x7c01('0x17')},'autopause':{'type':Sequelize['ENUM'](_0x7c01('0x17'),'no',_0x7c01('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x7c01('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x7c01('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x7c01('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x7c01('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x7c01('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':_0x7c01('0x17')},'announce_holdtime':{'type':Sequelize[_0x7c01('0x3')]('yes','no',_0x7c01('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x7c01('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x7c01('0x2')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x7c01('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x7c01('0x2')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x7c01('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x7c01('0x2')]},'queue_less_than':{'type':Sequelize[_0x7c01('0x2')]},'periodic_announce':{'type':Sequelize[_0x7c01('0x1a')],'set':function(_0x2f993a){this[_0x7c01('0xe')](_0x7c01('0x1b'),_0x2f993a?_0x2f993a[_0x7c01('0x1c')](','):[]);},'get':function(){return this[_0x7c01('0x10')](_0x7c01('0x1b'))?this[_0x7c01('0x10')]('periodic_announce')[_0x7c01('0x1d')](','):[];}},'joinempty':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':_0x7c01('0x17'),'set':function(_0x32fae7){this[_0x7c01('0xe')](_0x7c01('0x1e'),_0x32fae7?_0x32fae7[_0x7c01('0x1c')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0x7c01('0x1e'))[_0x7c01('0x1d')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':'no','set':function(_0x525e45){this[_0x7c01('0xe')](_0x7c01('0x1f'),_0x525e45?_0x525e45[_0x7c01('0x1c')](','):undefined);},'get':function(){return this[_0x7c01('0x10')](_0x7c01('0x1f'))?this[_0x7c01('0x10')](_0x7c01('0x1f'))[_0x7c01('0x1d')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x7c01('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM'](_0x7c01('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x7c01('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x7c01('0x2')]},'description':{'type':Sequelize[_0x7c01('0x2')]},'acw':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'set':function(_0x4c9b10){this[_0x7c01('0xe')](_0x7c01('0x21'),_0x4c9b10);if(_0x4c9b10){if(this[_0x7c01('0x10')](_0x7c01('0x22'))<0x2){this[_0x7c01('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x7c01('0x3')]('preview',_0x7c01('0x23'),'power',_0x7c01('0x24'),_0x7c01('0x13')),'defaultValue':_0x7c01('0x23'),'comment':_0x7c01('0x25')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x7c01('0x26')},'dialLimitQueue':{'type':Sequelize[_0x7c01('0x16')](0x4)[_0x7c01('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x7c01('0x28')](0x2)[_0x7c01('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x7c01('0x29')},'dialPredictiveOptimization':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x2a'),_0x7c01('0x2b')),'defaultValue':_0x7c01('0x2b'),'comment':_0x7c01('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x7c01('0x28')](0x2)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x7c01('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':_0x7c01('0x2e'),'comment':_0x7c01('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x7c01('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x30')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x32')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x33')},'dialGlobalMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x7c01('0x34')},'dialTimezone':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x7c01('0x35')},'dialPrefix':{'type':Sequelize[_0x7c01('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x7c01('0x3')](_0x7c01('0x36'),_0x7c01('0x37'),'onlyIfOpen'),'defaultValue':_0x7c01('0x36')},'dialAMDActive':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x7c01('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x7c01('0x38')},'dialAMDGreeting':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x7c01('0x39')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x7c01('0x3a')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x7c01('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c01('0x3b')},'dialAMDMinWordLength':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x7c01('0x3c')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x7c01('0x3d')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x7c01('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x7c01('0x16')](0x9)[_0x7c01('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x7c01('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x7c01('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':0x0,'comment':_0x7c01('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x7c01('0x3')]('DESC',_0x7c01('0x42')),'defaultValue':_0x7c01('0x43')},'dialQueueProject2':{'type':Sequelize[_0x7c01('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c01('0x44')},'dialCutDigit':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x7c01('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x48')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x4a')},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x7c01('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x7c01('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x7c01('0x16')](0x5)[_0x7c01('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7c01('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x7c01('0x4f'),'set':function(_0x4a347f){if(!_0x4a347f)this[_0x7c01('0xe')](_0x7c01('0x50'),null);this[_0x7c01('0xe')](_0x7c01('0x51'),_0x4a347f);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x7c01('0x16')](0x3)[_0x7c01('0x27')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x7c01('0x20')],'defaultValue':![]}}; \ No newline at end of file +var _0x6089=['dropRate','Only\x20for\x20predictive\x20method.','FLOAT','tTxX','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)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','always','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','sequelize','name','ENUM','inbound','outbound','STRING','default','leastrecent','random','rrmemory','linear','wrandom','rrordered','strategy','getDataValue','type','dialMethod','preview','booked','roundrobin','includes','setDataValue','INTEGER','yes','all','once','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','power','predictive','progressive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0x6089,0x1a3));var _0x9608=function(_0x3e59b3,_0x398252){_0x3e59b3=_0x3e59b3-0x0;var _0x2a7157=_0x6089[_0x3e59b3];return _0x2a7157;};'use strict';var Sequelize=require(_0x9608('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9608('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x3'),_0x9608('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x9608('0x5')],'defaultValue':_0x9608('0x6')},'announce':{'type':Sequelize[_0x9608('0x5')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr','ringall',_0x9608('0x7'),'fewestcalls',_0x9608('0x8'),_0x9608('0x9'),_0x9608('0xa'),_0x9608('0xb'),_0x9608('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x417dd1){this['setDataValue'](_0x9608('0xd'),_0x417dd1?_0x417dd1:'rrmemory');},'get':function(){var _0x12fee7=this[_0x9608('0xe')](_0x9608('0xf'));var _0xca9cf1=this[_0x9608('0xe')](_0x9608('0x10'));var _0x2acc17=this[_0x9608('0xe')](_0x9608('0xd'));if(_0x12fee7===_0x9608('0x4')){if(_0xca9cf1===_0x9608('0x11')){return null;}if(_0xca9cf1===_0x9608('0x12')&&!['rrmemory',_0x9608('0x13')][_0x9608('0x14')](_0x2acc17)){this[_0x9608('0x15')](_0x9608('0xd'),_0x9608('0x9'));}}return _0x2acc17;}},'servicelevel':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9608('0x5')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9608('0x16')](0xb)},'timeout':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9608('0x5')]},'weight':{'type':Sequelize[_0x9608('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no',_0x9608('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9608('0x16')](0xb)},'autopausebusy':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x9608('0x2')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9608('0x2')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9608('0x2')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9608('0x2')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x9608('0x5')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x9608('0x5')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defaultValue':_0x9608('0x17')},'announce_holdtime':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no',_0x9608('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9608('0x5')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x9608('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x9608('0x5')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9608('0x5')]},'queue_youarenext':{'type':Sequelize[_0x9608('0x5')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9608('0x5')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9608('0x5')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x9608('0x5')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9608('0x5')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize['STRING'],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9608('0x5')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x9608('0x5')]},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x9608('0x5')]},'queue_periodic_announce':{'type':Sequelize[_0x9608('0x5')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x577f75){this[_0x9608('0x15')](_0x9608('0x1a'),_0x577f75?_0x577f75[_0x9608('0x1b')](','):[]);},'get':function(){return this[_0x9608('0xe')](_0x9608('0x1a'))?this[_0x9608('0xe')](_0x9608('0x1a'))[_0x9608('0x1c')](','):[];}},'joinempty':{'type':Sequelize[_0x9608('0x5')],'defaultValue':_0x9608('0x17'),'set':function(_0x29f6b6){this[_0x9608('0x15')](_0x9608('0x1d'),_0x29f6b6?_0x29f6b6[_0x9608('0x1b')](','):undefined);},'get':function(){return this[_0x9608('0xe')](_0x9608('0x1d'))?this[_0x9608('0xe')]('joinempty')[_0x9608('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9608('0x5')],'defaultValue':'no','set':function(_0x51694f){this[_0x9608('0x15')](_0x9608('0x1e'),_0x51694f?_0x51694f['join'](','):undefined);},'get':function(){return this[_0x9608('0xe')]('leavewhenempty')?this['getDataValue'](_0x9608('0x1e'))[_0x9608('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9608('0x5')]},'description':{'type':Sequelize[_0x9608('0x5')]},'acw':{'type':Sequelize[_0x9608('0x1f')],'defaultValue':0x0,'set':function(_0x4c480f){this[_0x9608('0x15')](_0x9608('0x20'),_0x4c480f);if(_0x4c480f){if(this[_0x9608('0xe')](_0x9608('0x21'))<0x2){this[_0x9608('0x15')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9608('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9608('0x1f')],'defaultValue':0x0,'comment':_0x9608('0x22')},'dialMethod':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x11'),'progressive',_0x9608('0x23'),_0x9608('0x24'),'booked'),'defaultValue':_0x9608('0x25'),'comment':_0x9608('0x26')},'dialLimitChannel':{'type':Sequelize[_0x9608('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9608('0x27')},'dialLimitQueue':{'type':Sequelize[_0x9608('0x16')](0x4)[_0x9608('0x28')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9608('0x29')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9608('0x2a')},'dialPredictiveOptimization':{'type':Sequelize['ENUM']('agentBusyFactor',_0x9608('0x2b')),'defaultValue':_0x9608('0x2b'),'comment':_0x9608('0x2c')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x9608('0x2d')](0x2)[_0x9608('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':'Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)'},'dialPredictiveInterval':{'type':Sequelize['INTEGER'](0x3)[_0x9608('0x28')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x9608('0x5')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9608('0x5')]},'dialOriginateTimeout':{'type':Sequelize[_0x9608('0x16')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x9608('0x2e'),'comment':_0x9608('0x2f')},'dialQueueTimeout':{'type':Sequelize[_0x9608('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x30')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x31')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9608('0x33')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9608('0x34')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x9608('0x5')],'defaultValue':_0x9608('0x35')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9608('0x2')]('always',_0x9608('0x36'),_0x9608('0x37')),'defaultValue':_0x9608('0x38')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9608('0x16')](0x9)[_0x9608('0x28')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x9608('0x28')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x9608('0x28')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9608('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9608('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9608('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x9608('0x16')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9608('0x16')](0x9)[_0x9608('0x28')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x9608('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9608('0x16')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9608('0x16')](0x9)[_0x9608('0x28')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9608('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x9608('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x9608('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x9608('0x2')](_0x9608('0x3f'),_0x9608('0x40')),'defaultValue':_0x9608('0x3f')},'dialQueueProject2':{'type':Sequelize[_0x9608('0x5')],'comment':_0x9608('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x9608('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x9608('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9608('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x43')},'dialDropRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9608('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9608('0x46')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9608('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)[_0x9608('0x28')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9608('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9608('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9608('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9608('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9608('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9608('0x1f')],'defaultValue':![],'comment':_0x9608('0x4b'),'set':function(_0x5b8b76){if(!_0x5b8b76)this['setDataValue'](_0x9608('0x4c'),null);this[_0x9608('0x15')]('mandatoryDisposition',_0x5b8b76);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x9608('0x16')](0x3)[_0x9608('0x28')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x9608('0x1f')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize['INTEGER'](0x3)[_0x9608('0x28')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x9608('0x1f')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 914708e..3af3f65 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 _0xf3cd=['CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','forEach','emit','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','name','UserProfileResource','VoiceQueue','fieldName','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','options','find','create','body','user','role','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','merge','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','order','sort','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x53ccc2,_0x22bc3a){var _0x3a620d=function(_0x1d7ba1){while(--_0x1d7ba1){_0x53ccc2['push'](_0x53ccc2['shift']());}};_0x3a620d(++_0x22bc3a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1dd532,_0x36e81c){_0x1dd532=_0x1dd532-0x0;var _0x3732aa=_0xf3cd[_0x1dd532];return _0x3732aa;};'use strict';var moment=require(_0xdf3c('0x0'));var BPromise=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var _=require(_0xdf3c('0x3'));var squel=require(_0xdf3c('0x4'));var Redis=require(_0xdf3c('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x6'))(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x9')]=_[_0xdf3c('0xa')](config[_0xdf3c('0x9')],{'host':_0xdf3c('0xb'),'port':0x18eb});var socket=require(_0xdf3c('0xc'))(new Redis(config[_0xdf3c('0x9')]));require('./voiceQueue.socket')[_0xdf3c('0xd')](socket);function respondWithStatusCode(_0x52cf30,_0x52f855){_0x52f855=_0x52f855||0xcc;return function(_0x22d8ae){if(_0x22d8ae){return _0x52cf30[_0xdf3c('0xe')](_0x52f855);}return _0x52cf30['status'](_0x52f855)[_0xdf3c('0xf')]();};}function respondWithResult(_0x205f33,_0x2d420c){_0x2d420c=_0x2d420c||0xc8;return function(_0x21a6e5){if(_0x21a6e5){return _0x205f33[_0xdf3c('0x10')](_0x2d420c)[_0xdf3c('0x11')](_0x21a6e5);}};}function respondWithFilteredResult(_0xf7da9d,_0x32d2db){return function(_0x5e8925){if(_0x5e8925){var _0x1d483c=typeof _0x32d2db[_0xdf3c('0x12')]===_0xdf3c('0x13')&&typeof _0x32d2db[_0xdf3c('0x14')]==='undefined';var _0x2ae4ad=_0x5e8925[_0xdf3c('0x15')];var _0x13ea5f=_0x1d483c?0x0:_0x32d2db['offset'];var _0x18aafa=_0x1d483c?_0x5e8925[_0xdf3c('0x15')]:_0x32d2db[_0xdf3c('0x12')]+_0x32d2db[_0xdf3c('0x14')];var _0x21e587;if(_0x18aafa>=_0x2ae4ad){_0x18aafa=_0x2ae4ad;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0xf7da9d[_0xdf3c('0x10')](_0x21e587);return _0xf7da9d[_0xdf3c('0x16')](_0xdf3c('0x17'),_0x13ea5f+'-'+_0x18aafa+'/'+_0x2ae4ad)[_0xdf3c('0x11')](_0x5e8925);}return null;};}function saveUpdates(_0x5d3991){return function(_0x54cdd4){if(_0x54cdd4){return _0x54cdd4[_0xdf3c('0x18')](_0x5d3991)[_0xdf3c('0x19')](function(_0xf1da1f){return _0xf1da1f;});}return null;};}function removeEntity(_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){return _0x1e2690[_0xdf3c('0x1a')]()[_0xdf3c('0x19')](function(){var _0x3ee0af=_0x1e2690[_0xdf3c('0x1b')]({'plain':!![]});var _0x18fb5f=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d'),'ignore':![]},{'name':_0xdf3c('0x1e'),'value':'outbound','ignore':![]}];var _0x4d620f=_(_0x18fb5f)[_0xdf3c('0x1f')]('ignore')[_0xdf3c('0x20')](_0xdf3c('0x21'))[_0xdf3c('0x21')]();if(_[_0xdf3c('0x22')](_0x4d620f,_0x3ee0af[_0xdf3c('0x23')])){return;}var _0x36ba1c=_['find'](_0x18fb5f,[_0xdf3c('0x21'),_0x3ee0af[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x25')][_0xdf3c('0x1a')]({'where':{'type':_0x36ba1c,'resourceId':_0x3ee0af['id']}})[_0xdf3c('0x19')](function(){return _0x1e2690;});})[_0xdf3c('0x19')](function(){_0x18d4ec[_0xdf3c('0x10')](0xcc)[_0xdf3c('0xf')]();});}};}function handleEntityNotFound(_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x1adee4[_0xdf3c('0xe')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x24')];}_0x153daa[_0xdf3c('0x10')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={};var _0x1ccdd4={'count':0x0,'rows':[]};var _0x5c98a2=_[_0xdf3c('0x20')](db[_0xdf3c('0x26')]['rawAttributes'],function(_0x51e0a4){return{'name':_0x51e0a4[_0xdf3c('0x27')],'type':_0x51e0a4[_0xdf3c('0x23')][_0xdf3c('0x28')]};});_0xd3cfcb=qs['getOptions'](_0x5c98a2,_0x37ecfd);var _0x2355f6={'where':_0xd3cfcb[_0xdf3c('0x29')]};return db[_0xdf3c('0x26')][_0xdf3c('0x15')](_0x2355f6)['then'](function(_0xda0de0){_0x1ccdd4[_0xdf3c('0x15')]=_0xda0de0;_0xd3cfcb['include']=qs[_0xdf3c('0x2a')](_0x37ecfd[_0xdf3c('0x2b')]);return db[_0xdf3c('0x26')][_0xdf3c('0x2c')](_0xd3cfcb);})['then'](function(_0x33632f){_0x1ccdd4[_0xdf3c('0x2d')]=_0x33632f;return _0x1ccdd4;})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x2e')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x474564,_0x3e7a4b){var _0x5ddd21={'raw':![],'where':{'id':_0x474564[_0xdf3c('0x2f')]['id']}},_0x4f68f9={};_0x4f68f9['model']=_[_0xdf3c('0x30')](db['VoiceQueue']['rawAttributes']);_0x4f68f9['query']=_[_0xdf3c('0x30')](_0x474564[_0xdf3c('0x2b')]);_0x4f68f9[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4f68f9['model'],_0x4f68f9['query']);_0x5ddd21[_0xdf3c('0x33')]=_['intersection'](_0x4f68f9[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x474564[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5ddd21[_0xdf3c('0x33')]=_0x5ddd21[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5ddd21[_0xdf3c('0x33')]:_0x4f68f9[_0xdf3c('0x34')];if(_0x474564['query'][_0xdf3c('0x37')]){_0x5ddd21['include']=[{'all':!![]}];}_0x5ddd21=_['merge']({},_0x5ddd21,_0x474564[_0xdf3c('0x38')]);return db['VoiceQueue'][_0xdf3c('0x39')](_0x5ddd21)['then'](handleEntityNotFound(_0x3e7a4b,null))[_0xdf3c('0x19')](respondWithResult(_0x3e7a4b,null))[_0xdf3c('0x2e')](handleError(_0x3e7a4b,null));};exports[_0xdf3c('0x3a')]=function(_0x1349a4,_0x3098cb){return db[_0xdf3c('0x26')][_0xdf3c('0x3a')](_0x1349a4[_0xdf3c('0x3b')],{})[_0xdf3c('0x19')](function(_0xa65478){var _0x424acf=_0x1349a4[_0xdf3c('0x3c')]['get']({'plain':!![]});if(!_0x424acf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424acf[_0xdf3c('0x3d')]==='user'){var _0x3a6527=_0xa65478[_0xdf3c('0x1b')]({'plain':!![]});var _0x46194d=[{'name':_0xdf3c('0x1c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdf3c('0x3e')}];var _0x33edab=_[_0xdf3c('0x39')](_0x46194d,['value',_0x3a6527[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x3f')][_0xdf3c('0x39')]({'where':{'name':_0x33edab,'userProfileId':_0x424acf['userProfileId']},'raw':!![]})[_0xdf3c('0x19')](function(_0x3e9be9){if(_0x3e9be9&&_0x3e9be9[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')][_0xdf3c('0x3a')]({'name':_0x3a6527['name'],'resourceId':_0x3a6527['id'],'type':_0x3e9be9[_0xdf3c('0x24')],'sectionId':_0x3e9be9['id']},{})[_0xdf3c('0x19')](function(){return _0xa65478;});}else{return _0xa65478;}})[_0xdf3c('0x2e')](function(_0x2456cf){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x2456cf);throw _0x2456cf;});}return _0xa65478;})['then'](respondWithResult(_0x3098cb,0xc9))['catch'](handleError(_0x3098cb,null));};exports[_0xdf3c('0x43')]=function(_0x2be86d,_0x5a4443){var _0x5c9885={'where':{'id':_0x2be86d[_0xdf3c('0x2f')]['id']}},_0x269723={};_0x269723[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x26')][_0xdf3c('0x44')]);_0x5c9885[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x269723[_0xdf3c('0x34')],qs['fields'](_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5c9885[_0xdf3c('0x33')]=_0x5c9885[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5c9885[_0xdf3c('0x33')]:_0x269723[_0xdf3c('0x34')];if(_0x2be86d['query'][_0xdf3c('0x37')]){_0x5c9885['include']=[{'all':!![]}];}_0x5c9885=_[_0xdf3c('0x45')]({},_0x5c9885,_0x2be86d['options']);return db[_0xdf3c('0x26')][_0xdf3c('0x39')](_0x5c9885)[_0xdf3c('0x19')](handleEntityNotFound(_0x5a4443,null))[_0xdf3c('0x19')](function(_0x5eef94){if(_0x5eef94){var _0x55da0f=_0x5eef94['get']({'plain':!![]});_0x55da0f=qs[_0xdf3c('0x46')](_0x55da0f,['id','createdAt',_0xdf3c('0x47')]);_0x2be86d[_0xdf3c('0x3b')]=_[_0xdf3c('0x46')](_0x2be86d[_0xdf3c('0x3b')],['id',_0xdf3c('0x48'),'updatedAt']);return db['VoiceQueue'][_0xdf3c('0x3a')](_[_0xdf3c('0x45')](_0x55da0f,_0x2be86d['body']),{'include':_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x37')]?[{'all':!![]}]:undefined})[_0xdf3c('0x19')](function(_0x3fda0a){var _0x38de63=_0x2be86d[_0xdf3c('0x3c')][_0xdf3c('0x1b')]({'plain':!![]});if(!_0x38de63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38de63['role']===_0xdf3c('0x3c')){var _0x28030e=_0x3fda0a[_0xdf3c('0x1b')]({'plain':!![]});var _0x1ad771=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d')},{'name':_0xdf3c('0x1e'),'value':_0xdf3c('0x3e')}];var _0x143d01=_[_0xdf3c('0x39')](_0x1ad771,[_0xdf3c('0x21'),_0x28030e['type']])[_0xdf3c('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x143d01,'userProfileId':_0x38de63['userProfileId']},'raw':!![]})['then'](function(_0x541c57){if(_0x541c57&&_0x541c57[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')]['create']({'name':_0x28030e[_0xdf3c('0x24')],'resourceId':_0x28030e['id'],'type':_0x541c57[_0xdf3c('0x24')],'sectionId':_0x541c57['id']},{})['then'](function(){return _0x3fda0a;});}else{return _0x3fda0a;}})[_0xdf3c('0x2e')](function(_0x28f935){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x28f935);throw _0x28f935;});}return _0x3fda0a;});}})[_0xdf3c('0x19')](respondWithResult(_0x5a4443,0xc9))[_0xdf3c('0x2e')](handleError(_0x5a4443,null));};exports[_0xdf3c('0x18')]=function(_0xdc859,_0x42efa2){if(_0xdc859[_0xdf3c('0x3b')]['id']){delete _0xdc859[_0xdf3c('0x3b')]['id'];}return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xdc859[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x42efa2,null))['then'](saveUpdates(_0xdc859[_0xdf3c('0x3b')],null))[_0xdf3c('0x19')](respondWithResult(_0x42efa2,null))[_0xdf3c('0x2e')](handleError(_0x42efa2,null));};exports['destroy']=function(_0x1effdb,_0x13bf69){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x1effdb['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x13bf69,null))[_0xdf3c('0x19')](removeEntity(_0x13bf69,null))[_0xdf3c('0x2e')](handleError(_0x13bf69,null));};exports[_0xdf3c('0x49')]=function(_0xed2a78,_0x30e6e1){var _0x3fca95={'raw':![],'where':{}};var _0x2a1559={};var _0x2922d8={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xed2a78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30e6e1,null))[_0xdf3c('0x19')](function(_0x204110){if(_0x204110){_0x2a1559[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmHopper']['rawAttributes']);_0x2a1559[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0xed2a78[_0xdf3c('0x2b')]);_0x2a1559['filters']=_[_0xdf3c('0x32')](_0x2a1559['model'],_0x2a1559['query']);_0x3fca95[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x2a1559[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x3fca95[_0xdf3c('0x33')]=_0x3fca95[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x3fca95[_0xdf3c('0x33')]:_0x2a1559[_0xdf3c('0x34')];if(!_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4b')]('nolimit')){_0x3fca95[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x3fca95[_0xdf3c('0x12')]=qs['offset'](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x3fca95[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x3fca95[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xed2a78[_0xdf3c('0x2b')],_0x2a1559['filters']));_0x3fca95[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x204110['id'];if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x3fca95[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x3fca95[_0xdf3c('0x29')],{'$or':_['map'](_0x3fca95[_0xdf3c('0x33')],function(_0x662fd5){var _0x4e1b77={};_0x4e1b77[_0x662fd5]={'$like':'%'+_0xed2a78['query'][_0xdf3c('0x1f')]+'%'};return _0x4e1b77;})});}_0x3fca95=_[_0xdf3c('0x45')]({},_0x3fca95,_0xed2a78[_0xdf3c('0x38')]);return db[_0xdf3c('0x50')][_0xdf3c('0x15')]({'where':_0x3fca95[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x38af90){_0x2922d8['count']=_0x38af90;if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x3fca95[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopper'][_0xdf3c('0x2c')](_0x3fca95);})[_0xdf3c('0x19')](function(_0x43d299){_0x2922d8['rows']=_0x43d299;return _0x2922d8;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x30e6e1,_0x3fca95))[_0xdf3c('0x2e')](handleError(_0x30e6e1,null));};exports[_0xdf3c('0x51')]=function(_0x1b279f,_0xe01538){var _0x12f737={'raw':!![],'where':{}};var _0x560348={};var _0x50753f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1b279f['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xe01538,null))[_0xdf3c('0x19')](function(_0xf66fae){if(_0xf66fae){_0x560348['model']=_[_0xdf3c('0x30')](db[_0xdf3c('0x52')][_0xdf3c('0x44')]);_0x560348['query']=_['keys'](_0x1b279f[_0xdf3c('0x2b')]);_0x560348['filters']=_[_0xdf3c('0x32')](_0x560348['model'],_0x560348[_0xdf3c('0x2b')]);_0x12f737[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x560348[_0xdf3c('0x34')],qs['fields'](_0x1b279f['query'][_0xdf3c('0x35')]));_0x12f737[_0xdf3c('0x33')]=_0x12f737[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x12f737[_0xdf3c('0x33')]:_0x560348[_0xdf3c('0x34')];if(!_0x1b279f['query'][_0xdf3c('0x4b')]('nolimit')){_0x12f737[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x12f737[_0xdf3c('0x12')]=qs['offset'](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x12f737[_0xdf3c('0x4c')]=qs['sort'](_0x1b279f['query']['sort']);_0x12f737['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1b279f[_0xdf3c('0x2b')],_0x560348[_0xdf3c('0x31')]));_0x12f737[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0xf66fae['id'];if(_0x1b279f['query'][_0xdf3c('0x1f')]){_0x12f737['where']=_[_0xdf3c('0x45')](_0x12f737[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x12f737[_0xdf3c('0x33')],function(_0x320452){var _0x3a221d={};_0x3a221d[_0x320452]={'$like':'%'+_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x3a221d;})});}_0x12f737=_[_0xdf3c('0x45')]({},_0x12f737,_0x1b279f[_0xdf3c('0x38')]);return db[_0xdf3c('0x52')][_0xdf3c('0x15')]({'where':_0x12f737[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x55fd73){_0x50753f[_0xdf3c('0x15')]=_0x55fd73;if(_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x12f737[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf3c('0x2c')](_0x12f737);})[_0xdf3c('0x19')](function(_0x54b7b8){_0x50753f['rows']=_0x54b7b8;return _0x50753f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0xe01538,_0x12f737))[_0xdf3c('0x2e')](handleError(_0xe01538,null));};exports[_0xdf3c('0x53')]=function(_0x1aaf8b,_0x44dd2a){var _0x56fc77={'raw':!![],'where':{}};var _0x50105b={};var _0x471d8f={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1aaf8b[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x44dd2a,null))['then'](function(_0x30235e){if(_0x30235e){_0x50105b[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x54')][_0xdf3c('0x44')]);_0x50105b['query']=_['keys'](_0x1aaf8b['query']);_0x50105b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],_0x50105b[_0xdf3c('0x2b')]);_0x56fc77[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1aaf8b['query'][_0xdf3c('0x35')]));_0x56fc77[_0xdf3c('0x33')]=_0x56fc77[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x56fc77[_0xdf3c('0x33')]:_0x50105b[_0xdf3c('0x34')];if(!_0x1aaf8b['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x56fc77['limit']=qs['limit'](_0x1aaf8b[_0xdf3c('0x2b')]['limit']);_0x56fc77[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1aaf8b['query'][_0xdf3c('0x12')]);}_0x56fc77[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x56fc77[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x1aaf8b[_0xdf3c('0x2b')],_0x50105b[_0xdf3c('0x31')]));_0x56fc77[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x30235e['id'];if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x56fc77['where']=_['merge'](_0x56fc77[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x56fc77[_0xdf3c('0x33')],function(_0x5b6419){var _0x38c374={};_0x38c374[_0x5b6419]={'$like':'%'+_0x1aaf8b['query']['filter']+'%'};return _0x38c374;})});}_0x56fc77=_[_0xdf3c('0x45')]({},_0x56fc77,_0x1aaf8b[_0xdf3c('0x38')]);return db['CmHopperFinal'][_0xdf3c('0x15')]({'where':_0x56fc77['where']})[_0xdf3c('0x19')](function(_0x4b35ff){_0x471d8f[_0xdf3c('0x15')]=_0x4b35ff;if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x56fc77[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x54')][_0xdf3c('0x2c')](_0x56fc77);})[_0xdf3c('0x19')](function(_0x2dc0d2){_0x471d8f[_0xdf3c('0x2d')]=_0x2dc0d2;return _0x471d8f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x44dd2a,_0x56fc77))[_0xdf3c('0x2e')](handleError(_0x44dd2a,null));};exports[_0xdf3c('0x56')]=function(_0x10528d,_0x1acc47){var _0x5b3aa5={'raw':!![],'where':{}};var _0x3cf465={};var _0x22bacf={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x10528d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x1acc47,null))[_0xdf3c('0x19')](function(_0x6e1899){if(_0x6e1899){_0x3cf465[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x57')][_0xdf3c('0x44')]);_0x3cf465[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x10528d[_0xdf3c('0x2b')]);_0x3cf465['filters']=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],_0x3cf465[_0xdf3c('0x2b')]);_0x5b3aa5[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5b3aa5[_0xdf3c('0x33')]=_0x5b3aa5[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5b3aa5['attributes']:_0x3cf465[_0xdf3c('0x34')];if(!_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x5b3aa5[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x10528d[_0xdf3c('0x2b')]['limit']);_0x5b3aa5[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x5b3aa5['order']=qs[_0xdf3c('0x4d')](_0x10528d[_0xdf3c('0x2b')]['sort']);_0x5b3aa5[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x10528d[_0xdf3c('0x2b')],_0x3cf465['filters']));_0x5b3aa5[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x6e1899['id'];if(_0x10528d[_0xdf3c('0x2b')]['filter']){_0x5b3aa5['where']=_[_0xdf3c('0x45')](_0x5b3aa5['where'],{'$or':_[_0xdf3c('0x20')](_0x5b3aa5[_0xdf3c('0x33')],function(_0x161604){var _0x91dd6e={};_0x91dd6e[_0x161604]={'$like':'%'+_0x10528d['query'][_0xdf3c('0x1f')]+'%'};return _0x91dd6e;})});}_0x5b3aa5=_[_0xdf3c('0x45')]({},_0x5b3aa5,_0x10528d['options']);return db[_0xdf3c('0x57')]['count']({'where':_0x5b3aa5[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x5429b6){_0x22bacf['count']=_0x5429b6;if(_0x10528d[_0xdf3c('0x2b')]['includeAll']){_0x5b3aa5[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x57')][_0xdf3c('0x2c')](_0x5b3aa5);})[_0xdf3c('0x19')](function(_0x19a723){_0x22bacf[_0xdf3c('0x2d')]=_0x19a723;return _0x22bacf;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1acc47,_0x5b3aa5))[_0xdf3c('0x2e')](handleError(_0x1acc47,null));};exports[_0xdf3c('0x58')]=function(_0x3d8ff0,_0x2a2f03){var _0x55975e={};var _0x4299d1={};var _0x132c27;var _0x52a641;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x3d8ff0[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2a2f03,null))[_0xdf3c('0x19')](function(_0x12576e){if(_0x12576e){_0x132c27=_0x12576e;_0x4299d1['model']=_[_0xdf3c('0x30')](db['Team'][_0xdf3c('0x44')]);_0x4299d1[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x3d8ff0[_0xdf3c('0x2b')]);_0x4299d1[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4299d1['model'],_0x4299d1[_0xdf3c('0x2b')]);_0x55975e[_0xdf3c('0x33')]=_['intersection'](_0x4299d1[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x55975e[_0xdf3c('0x33')]=_0x55975e[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x55975e[_0xdf3c('0x33')]:_0x4299d1['model'];_0x55975e['order']=qs[_0xdf3c('0x4d')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x55975e[_0xdf3c('0x29')]=qs['filters'](_['pick'](_0x3d8ff0[_0xdf3c('0x2b')],_0x4299d1['filters']));if(_0x3d8ff0[_0xdf3c('0x2b')]['filter']){_0x55975e[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x55975e[_0xdf3c('0x29')],{'$or':_['map'](_0x55975e[_0xdf3c('0x33')],function(_0x142cd0){var _0x5bf9a9={};_0x5bf9a9[_0x142cd0]={'$like':'%'+_0x3d8ff0['query'][_0xdf3c('0x1f')]+'%'};return _0x5bf9a9;})});}_0x55975e=_[_0xdf3c('0x45')]({},_0x55975e,_0x3d8ff0[_0xdf3c('0x38')]);return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x294682){if(_0x294682){_0x52a641=_0x294682[_0xdf3c('0x36')];if(!_0x3d8ff0['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x55975e[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x55975e[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x322cf5){if(_0x322cf5){return _0x322cf5?{'count':_0x52a641,'rows':_0x322cf5}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x2a2f03,null))[_0xdf3c('0x2e')](handleError(_0x2a2f03,null));};exports[_0xdf3c('0x59')]=function(_0x199ff0,_0x244bf0){var _0x1a0d61=_0x199ff0[_0xdf3c('0x3b')]['teams'];var _0x4c6615=_[_0xdf3c('0x20')](_0x1a0d61,'id');return db['Team']['findAll']({'where':{'id':_0x4c6615},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':'Agents','attributes':['id',_0xdf3c('0x24'),_0xdf3c('0x5b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c7b50){if(_0x1c7b50){var _0x3e0a0f=_[_0xdf3c('0x5c')](_0x1c7b50,function(_0x4d5216){var _0x197b8a=_0x4d5216['get']({'plain':!![]});_0x197b8a[_0xdf3c('0x5d')]['forEach'](function(_0x5b0101){_0x5b0101[_0xdf3c('0x5e')]=_[_0xdf3c('0x39')](_0x1a0d61,{'id':_0x197b8a['id']})[_0xdf3c('0x5e')];});return _0x197b8a[_0xdf3c('0x5d')];});return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x199ff0['params']['id']}})['then'](function(_0x128a4e){return db['sequelize'][_0xdf3c('0x5f')](function(_0x14244a){return _0x128a4e[_0xdf3c('0x59')](_0x4c6615,{'transaction':_0x14244a})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x1a0d61,function(_0x619c66){return db[_0xdf3c('0x61')]['upsert']({'TeamId':_0x619c66['id'],'VoiceQueueId':_0x199ff0['params']['id'],'penalty':_0x619c66[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x3e0a0f,function(_0x13a882){return db['UserVoiceQueue'][_0xdf3c('0x62')]({'where':{'UserId':_0x13a882['id'],'VoiceQueueId':_0x199ff0[_0xdf3c('0x2f')]['id']},'defaults':{'penalty':_0x13a882[_0xdf3c('0x5e')]},'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_[_0xdf3c('0x1f')](_0x3e0a0f,{'online':!![]}),function(_0x524482){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x524482['name'],'UserId':_0x524482['id'],'queue_name':_0x128a4e[_0xdf3c('0x24')],'VoiceQueueId':_0x128a4e['id'],'interface':_[_0xdf3c('0x65')](_0x524482[_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x524482[_0xdf3c('0x24')]):_0x524482[_0xdf3c('0x66')],'paused':_0x524482[_0xdf3c('0x68')]||![],'penalty':_0x524482[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){_0x3e0a0f[_0xdf3c('0x69')](function(_0x12ffd3){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':_0x12ffd3['id'],'VoiceQueueId':_0x128a4e['id']});});});});});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x244bf0,null))['catch'](handleError(_0x244bf0,null));};exports[_0xdf3c('0x6b')]=function(_0x160568,_0xfcf42f){return db[_0xdf3c('0x6c')][_0xdf3c('0x2c')]({'where':{'id':_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':_0xdf3c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xdf3c('0x19')](handleEntityNotFound(_0xfcf42f,null))[_0xdf3c('0x19')](function(_0x5f09a0){var _0x379996=_[_0xdf3c('0x20')](_0x5f09a0,'id');var _0x5f1b51=[];var _0x323058=[];var _0x8fd9e4=squel[_0xdf3c('0x6e')]();_0x8fd9e4[_0xdf3c('0x6f')]('tq.TeamId')[_0xdf3c('0x70')](_0xdf3c('0x71'),'tq')[_0xdf3c('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdf3c('0x73'),_0x160568[_0xdf3c('0x2f')]['id']);for(var _0x403ac5=0x0;_0x403ac5<_0x5f09a0[_0xdf3c('0x36')];_0x403ac5+=0x1){let _0x44d862=_0x5f09a0[_0x403ac5];for(var _0x33132b=0x0;_0x33132b<_0x44d862[_0xdf3c('0x5d')][_0xdf3c('0x36')];_0x33132b+=0x1){let _0x49c29e=_0x44d862[_0xdf3c('0x5d')][_0x33132b];var _0x5e868a=_0x8fd9e4[_0xdf3c('0x43')]();_0x5e868a[_0xdf3c('0x29')](_0xdf3c('0x74'),_0x49c29e['id']);_0x323058[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x5e868a['toString'](),{'type':db[_0xdf3c('0x76')][_0xdf3c('0x77')]['SELECT']})[_0xdf3c('0x19')](function(_0x270353){if(_0x270353[_0xdf3c('0x36')]===0x1){return _0x49c29e['id'];}else{var _0x3f6df9=_['every'](_[_0xdf3c('0x20')](_0x270353,'TeamId'),function(_0x7d9a0f){return _[_0xdf3c('0x22')](_0x379996,_0x7d9a0f);});if(_0x3f6df9){return _0x49c29e['id'];}}}));}}return BPromise[_0xdf3c('0x78')](_0x323058)[_0xdf3c('0x19')](function(_0x17669f){_0x5f1b51=_(_0x5f1b51)[_0xdf3c('0x79')](_0x17669f)['compact']()['value']();return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x160568[_0xdf3c('0x2f')]['id']}})['then'](function(_0x528c97){return db[_0xdf3c('0x76')]['transaction'](function(_0x58a2d8){return _0x528c97['removeTeams'](_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')],{'transaction':_0x58a2d8})[_0xdf3c('0x19')](function(){if(!_['isEmpty'](_0x5f1b51)){return _0x528c97[_0xdf3c('0x7a')](_0x5f1b51,{'transaction':_0x58a2d8})['then'](function(){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x160568[_0xdf3c('0x2f')]['id'],'UserId':_0x5f1b51},'transaction':_0x58a2d8});});}})[_0xdf3c('0x19')](function(){_0x5f1b51[_0xdf3c('0x69')](function(_0x467090){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':_0x467090,'VoiceQueueId':_0x528c97['id']});});});});});});})[_0xdf3c('0x19')](respondWithStatusCode(_0xfcf42f,null))['catch'](handleError(_0xfcf42f,null));};exports[_0xdf3c('0x7c')]=function(_0x4652af,_0x5e08bc){var _0x2702ca,_0x1e8646;return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x4652af['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x5e08bc,null))[_0xdf3c('0x19')](function(_0x3ea47d){if(_0x3ea47d){_0x1e8646=_0x3ea47d;return _0x3ea47d[_0xdf3c('0x7c')](_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x4652af[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{})[_0xdf3c('0x7d')](function(_0xfdb4e2){for(var _0x1c31ee=0x0;_0x1c31ee<_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x1c31ee+=0x1){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':Number(_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0x1c31ee]),'VoiceQueueId':Number(_0x4652af['params']['id'])});}return _0xfdb4e2;});}})[_0xdf3c('0x19')](function(_0xf39067){_0x2702ca=_0xf39067||[];if(_0x1e8646){return db[_0xdf3c('0x5a')][_0xdf3c('0x2c')]({'where':{'id':_0x4652af['body'][_0xdf3c('0x6d')]},'attributes':['id',_0xdf3c('0x24'),'online',_0xdf3c('0x68'),_0xdf3c('0x66')],'raw':!![]});}})['then'](function(_0x59c8f9){if(!_[_0xdf3c('0x7e')](_0x59c8f9)){var _0x388f8d=[];for(var _0x1c4964=0x0;_0x1c4964<_0x59c8f9['length'];_0x1c4964++){if(_0x59c8f9[_0x1c4964][_0xdf3c('0x5b')]){_0x388f8d['push'](db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x59c8f9[_0x1c4964][_0xdf3c('0x24')],'UserId':_0x59c8f9[_0x1c4964]['id'],'queue_name':_0x1e8646[_0xdf3c('0x24')],'VoiceQueueId':_0x1e8646['id'],'interface':_[_0xdf3c('0x65')](_0x59c8f9[_0x1c4964][_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x59c8f9[_0x1c4964]['name']):_0x59c8f9[_0x1c4964][_0xdf3c('0x66')],'paused':_0x59c8f9[_0x1c4964][_0xdf3c('0x68')]||![],'penalty':_0x4652af[_0xdf3c('0x3b')]['penalty']||0x0}));}}return BPromise[_0xdf3c('0x78')](_0x388f8d);}})['then'](function(){return _0x2702ca;})[_0xdf3c('0x19')](respondWithResult(_0x5e08bc,null))[_0xdf3c('0x2e')](handleError(_0x5e08bc,null));};exports['removeAgents']=function(_0x153bce,_0x4185f0){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x153bce['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4185f0,null))[_0xdf3c('0x19')](function(_0xa61c3f){if(_0xa61c3f){return _0xa61c3f[_0xdf3c('0x7a')](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])[_0xdf3c('0x19')](function(){if(_['isArray'](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])){for(var _0x26251d=0x0;_0x26251d<_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x26251d+=0x1){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0x26251d]),'VoiceQueueId':Number(_0x153bce[_0xdf3c('0x2f')]['id'])});}}else{socket['emit'](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')]),'VoiceQueueId':Number(_0x153bce['params']['id'])});}});}})[_0xdf3c('0x19')](function(_0x109153){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x153bce[_0xdf3c('0x2f')]['id'],'UserId':_0x153bce['query'][_0xdf3c('0x6d')]}})[_0xdf3c('0x19')](function(){return _0x109153;});})['then'](respondWithStatusCode(_0x4185f0,null))[_0xdf3c('0x2e')](handleError(_0x4185f0,null));};exports[_0xdf3c('0x7f')]=function(_0x38c6f3,_0xb39cc){var _0xcc2f18={};var _0x13ee9b={};var _0x8d7c0c;var _0x3d9041;return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x38c6f3[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xb39cc,null))['then'](function(_0x39bc51){if(_0x39bc51){_0x8d7c0c=_0x39bc51;_0x13ee9b[_0xdf3c('0x34')]=_['keys'](db['User'][_0xdf3c('0x44')]);_0x13ee9b[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x38c6f3[_0xdf3c('0x2b')]);_0x13ee9b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],_0x13ee9b[_0xdf3c('0x2b')]);_0xcc2f18['attributes']=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x38c6f3[_0xdf3c('0x2b')]['fields']));_0xcc2f18[_0xdf3c('0x33')]=_0xcc2f18[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0xcc2f18[_0xdf3c('0x33')]:_0x13ee9b['model'];_0xcc2f18[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x38c6f3[_0xdf3c('0x2b')]['sort']);_0xcc2f18['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x38c6f3[_0xdf3c('0x2b')],_0x13ee9b['filters']));if(_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0xcc2f18[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0xcc2f18[_0xdf3c('0x29')],{'$or':_['map'](_0xcc2f18['attributes'],function(_0x1cd1a7){var _0x48141c={};_0x48141c[_0x1cd1a7]={'$like':'%'+_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x48141c;})});}_0xcc2f18=_[_0xdf3c('0x45')]({},_0xcc2f18,_0x38c6f3[_0xdf3c('0x38')]);return _0x8d7c0c[_0xdf3c('0x7f')](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5a56b5){if(_0x5a56b5){_0x3d9041=_0x5a56b5[_0xdf3c('0x36')];if(!_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0xcc2f18['limit']=qs[_0xdf3c('0x14')](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0xcc2f18['offset']=qs['offset'](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x8d7c0c['getAgents'](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5eebe3){if(_0x5eebe3){return _0x5eebe3?{'count':_0x3d9041,'rows':_0x5eebe3}:null;}})[_0xdf3c('0x19')](respondWithResult(_0xb39cc,null))[_0xdf3c('0x2e')](handleError(_0xb39cc,null));};exports[_0xdf3c('0x80')]=function(_0x1961cd,_0x30659d){var _0x27f25a={};var _0x5e5dad={};var _0x19ce27;var _0x2c24b7;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1961cd[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30659d,null))[_0xdf3c('0x19')](function(_0x1dee13){if(_0x1dee13){_0x19ce27=_0x1dee13;_0x5e5dad[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x63')]['rawAttributes']);_0x5e5dad[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x1961cd['query']);_0x5e5dad[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x5e5dad[_0xdf3c('0x34')],_0x5e5dad[_0xdf3c('0x2b')]);_0x27f25a[_0xdf3c('0x33')]=_['intersection'](_0x5e5dad[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x27f25a[_0xdf3c('0x33')]=_0x27f25a[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x27f25a[_0xdf3c('0x33')]:_0x5e5dad[_0xdf3c('0x34')];_0x27f25a[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x27f25a['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1961cd['query'],_0x5e5dad[_0xdf3c('0x31')]));if(_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x27f25a[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x27f25a[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x27f25a[_0xdf3c('0x33')],function(_0xc3b6a1){var _0x3d9a1e={};_0x3d9a1e[_0xc3b6a1]={'$like':'%'+_0x1961cd['query'][_0xdf3c('0x1f')]+'%'};return _0x3d9a1e;})});}_0x27f25a=_[_0xdf3c('0x45')]({},_0x27f25a,_0x1961cd['options']);return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})['then'](function(_0x330ee0){if(_0x330ee0){_0x2c24b7=_0x330ee0['length'];if(!_0x1961cd[_0xdf3c('0x2b')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x27f25a[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x27f25a[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1961cd[_0xdf3c('0x2b')]['offset']);}return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})[_0xdf3c('0x19')](function(_0x1b3daa){return _0x1b3daa?{'count':_0x2c24b7,'rows':_0x1b3daa}:null;})['then'](respondWithResult(_0x30659d,null))[_0xdf3c('0x2e')](handleError(_0x30659d,null));};exports[_0xdf3c('0x81')]=function(_0x30e5ab,_0x465c59){var _0x571f14={};var _0x55a4fa={};var _0x4f7b39;var _0x5e5af3;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x30e5ab[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x465c59,null))[_0xdf3c('0x19')](function(_0x323d9b){if(_0x323d9b){_0x4f7b39=_0x323d9b;_0x55a4fa[_0xdf3c('0x34')]=_['keys'](db[_0xdf3c('0x82')]['rawAttributes']);_0x55a4fa[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x30e5ab[_0xdf3c('0x2b')]);_0x55a4fa[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x55a4fa[_0xdf3c('0x34')],_0x55a4fa[_0xdf3c('0x2b')]);_0x571f14[_0xdf3c('0x33')]=_['intersection'](_0x55a4fa[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x571f14[_0xdf3c('0x33')]=_0x571f14['attributes']['length']?_0x571f14[_0xdf3c('0x33')]:_0x55a4fa[_0xdf3c('0x34')];_0x571f14[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x571f14[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x30e5ab[_0xdf3c('0x2b')],_0x55a4fa[_0xdf3c('0x31')]));if(_0x30e5ab['query'][_0xdf3c('0x1f')]){_0x571f14[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x571f14[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x571f14[_0xdf3c('0x33')],function(_0x184a55){var _0x4e8ad8={};_0x4e8ad8[_0x184a55]={'$like':'%'+_0x30e5ab[_0xdf3c('0x2b')]['filter']+'%'};return _0x4e8ad8;})});}_0x571f14=_[_0xdf3c('0x45')]({},_0x571f14,_0x30e5ab['options']);return _0x4f7b39[_0xdf3c('0x81')](_0x571f14);}})[_0xdf3c('0x19')](function(_0x54d975){if(_0x54d975){_0x5e5af3=_0x54d975['length'];if(!_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x571f14[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x30e5ab['query'][_0xdf3c('0x14')]);_0x571f14[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x4f7b39['getLists'](_0x571f14);}})[_0xdf3c('0x19')](function(_0x55a593){if(_0x55a593){return _0x55a593?{'count':_0x5e5af3,'rows':_0x55a593}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x465c59,null))['catch'](handleError(_0x465c59,null));};exports['addLists']=function(_0x42d720,_0x2da908){var _0x3e2a89=moment()[_0xdf3c('0x83')](_0xdf3c('0x84'));var _0x4f4afd,_0xd3d760;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x42d720[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2da908,null))[_0xdf3c('0x19')](function(_0x386a3b){if(_0x386a3b){_0xd3d760=_0x386a3b;return _0x386a3b[_0xdf3c('0x85')](_0x42d720['body'][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x42d720[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x511630){var _0x2cf46;_0x4f4afd=_0x511630||[];var _0x43fc55=[];if(_0x511630){for(var _0x81b8dd=0x0;_0x81b8dd<_0x511630[_0xdf3c('0x36')];_0x81b8dd+=0x1){var _0xb852c5=_0x511630[_0x81b8dd][_0xdf3c('0x1b')]({'plain':!![]});_0xd3d760[_0xdf3c('0x86')]=_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]?_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]:_0xd3d760[_0xdf3c('0x86')];switch(_0xd3d760[_0xdf3c('0x86')]){case _0xdf3c('0x87'):_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0x8a'))[_0xdf3c('0x8b')](['phone',_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),'updatedAt'],squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))['field']('\x27'+_0x3e2a89+'\x27','createdAt')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))['where'](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')]())['where'](_0xdf3c('0x94'))[_0xdf3c('0x29')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xdf3c('0x70')](_0xdf3c('0x95'))[_0xdf3c('0x29')](_0xdf3c('0x73'),_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))[_0xdf3c('0x70')](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]())))[_0xdf3c('0x91')]();break;case _0xdf3c('0x97'):_0x2cf46=squel['insert']()[_0xdf3c('0x89')](_0xdf3c('0x8a'))['fromQuery']([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('phone','phone')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),_0xdf3c('0x8e'))['field'](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),'VoiceQueueId')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))['from'](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')]('ListId\x20=\x20?',_0xb852c5['CmListId']['toString']())[_0xdf3c('0x29')](_0xdf3c('0x94'))[_0xdf3c('0x29')](_0xdf3c('0x98'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))['from'](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id']['toString']())))[_0xdf3c('0x91')]();break;default:_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')]('cm_hopper')[_0xdf3c('0x8b')]([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27','scheduledAt')[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5['CmListId'][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id']['toString'](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')](_0xdf3c('0x99'),_0xb852c5[_0xdf3c('0x90')]['toString']())[_0xdf3c('0x29')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x43fc55['push'](db['sequelize'][_0xdf3c('0x2b')](_0x2cf46));}return BPromise[_0xdf3c('0x78')](_0x43fc55);}})[_0xdf3c('0x19')](function(){var _0x1eb736=[];var _0x321ff1=squel[_0xdf3c('0x88')]()['into'](_0xdf3c('0x9a'))['fromQuery']([_0xdf3c('0x9b'),_0xdf3c('0x8f'),_0xdf3c('0x9c'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x9d'))[_0xdf3c('0x6f')]('ci.item')[_0xdf3c('0x6f')](_0xdf3c('0x9e'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27','updatedAt')[_0xdf3c('0x70')](_0xdf3c('0x9f'),'ci')[_0xdf3c('0x72')](_0xdf3c('0x8a'),'h','h.ContactId=ci.CmContactId')[_0xdf3c('0x29')](_0xdf3c('0xa0'),_0x3e2a89)[_0xdf3c('0x29')](_0xdf3c('0xa1'),_0xdf3c('0xa2')))[_0xdf3c('0x91')]();_0x1eb736[_0xdf3c('0x75')](db['sequelize'][_0xdf3c('0x2b')](_0x321ff1));return BPromise[_0xdf3c('0x78')](_0x1eb736);})[_0xdf3c('0x19')](function(){return _0x4f4afd;})[_0xdf3c('0x19')](respondWithResult(_0x2da908,null))[_0xdf3c('0x2e')](handleError(_0x2da908,null));};exports[_0xdf3c('0xa3')]=function(_0x51404d,_0x4cfc67){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x51404d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4cfc67,null))[_0xdf3c('0x19')](function(_0x5e06a2){if(_0x5e06a2){return _0x5e06a2[_0xdf3c('0xa3')](_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})[_0xdf3c('0x19')](function(_0x2cab31){if(_0x2cab31){return db[_0xdf3c('0x50')]['destroy']({'where':{'ListId':_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0x51404d['params']['id']}})[_0xdf3c('0x19')](function(){return _0x2cab31;});}})['then'](respondWithStatusCode(_0x4cfc67,null))[_0xdf3c('0x2e')](handleError(_0x4cfc67,null));};exports[_0xdf3c('0xa4')]=function(_0xa6fa19,_0x16b173){var _0x578e41={};var _0x4815ee={};var _0xa523c8;var _0x52ae27;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xa6fa19[_0xdf3c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x16b173,null))[_0xdf3c('0x19')](function(_0x148785){if(_0x148785){_0xa523c8=_0x148785;_0x4815ee[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmList']['rawAttributes']);_0x4815ee[_0xdf3c('0x2b')]=_['keys'](_0xa6fa19[_0xdf3c('0x2b')]);_0x4815ee[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],_0x4815ee[_0xdf3c('0x2b')]);_0x578e41['attributes']=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xa6fa19['query'][_0xdf3c('0x35')]));_0x578e41[_0xdf3c('0x33')]=_0x578e41[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x578e41[_0xdf3c('0x33')]:_0x4815ee[_0xdf3c('0x34')];_0x578e41[_0xdf3c('0x4c')]=qs['sort'](_0xa6fa19['query'][_0xdf3c('0x4d')]);_0x578e41['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xa6fa19[_0xdf3c('0x2b')],_0x4815ee[_0xdf3c('0x31')]));if(_0xa6fa19['query'][_0xdf3c('0x1f')]){_0x578e41['where']=_[_0xdf3c('0x45')](_0x578e41['where'],{'$or':_[_0xdf3c('0x20')](_0x578e41[_0xdf3c('0x33')],function(_0x36fb96){var _0x2ac2ca={};_0x2ac2ca[_0x36fb96]={'$like':'%'+_0xa6fa19[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x2ac2ca;})});}_0x578e41=_[_0xdf3c('0x45')]({},_0x578e41,_0xa6fa19['options']);return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})[_0xdf3c('0x19')](function(_0x25d312){if(_0x25d312){_0x52ae27=_0x25d312[_0xdf3c('0x36')];if(!_0xa6fa19['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x578e41[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xa6fa19[_0xdf3c('0x2b')]['limit']);_0x578e41['offset']=qs['offset'](_0xa6fa19[_0xdf3c('0x2b')]['offset']);}return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})['then'](function(_0xbbc217){if(_0xbbc217){return _0xbbc217?{'count':_0x52ae27,'rows':_0xbbc217}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x16b173,null))[_0xdf3c('0x2e')](handleError(_0x16b173,null));};exports['addBlackLists']=function(_0x47d44e,_0x4dd133){var _0x2b8425;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x47d44e[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4dd133,null))[_0xdf3c('0x19')](function(_0x4009e0){if(_0x4009e0){return _0x4009e0[_0xdf3c('0xa5')](_0x47d44e[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x47d44e['body'],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x37e578){var _0x11436f;_0x2b8425=_0x37e578||[];var _0x1d66b6=[];if(_0x37e578){for(var _0x4b4bab=0x0;_0x4b4bab<_0x37e578[_0xdf3c('0x36')];_0x4b4bab+=0x1){var _0x290778=_0x37e578[_0x4b4bab][_0xdf3c('0x1b')]({'plain':!![]});_0x11436f=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0xa6'))['fromQuery']([_0xdf3c('0x8f'),'ContactId',_0xdf3c('0x8e'),_0xdf3c('0x4f'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('id','ContactId')[_0xdf3c('0x6f')](_0x290778[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x47d44e['params']['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x48'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0x290778['CmListId'][_0xdf3c('0x91')]())[_0xdf3c('0x29')](_0xdf3c('0x94')))[_0xdf3c('0x91')]();_0x1d66b6[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x11436f));}return BPromise[_0xdf3c('0x78')](_0x1d66b6);}})[_0xdf3c('0x19')](function(){return _0x2b8425;})[_0xdf3c('0x19')](respondWithResult(_0x4dd133,null))[_0xdf3c('0x2e')](handleError(_0x4dd133,null));};exports[_0xdf3c('0xa8')]=function(_0xc5ac78,_0x567748){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x567748,null))['then'](function(_0x290a39){if(_0x290a39){return _0x290a39['removeBlackLists'](_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})['then'](function(_0xabf05c){if(_0xabf05c){return db[_0xdf3c('0x57')][_0xdf3c('0x1a')]({'where':{'ListId':_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](function(){return _0xabf05c;});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x567748,null))['catch'](handleError(_0x567748,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x4b84[_0x311c35];return _0x5cc50c;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index ca08ca2..daa4417 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 _0xac5c=['emit','hasOwnProperty','hook','exports','VoiceQueue','setMaxListeners','save','update','remove'];(function(_0x4ea046,_0x23765f){var _0x4d4c5d=function(_0x5e1c55){while(--_0x5e1c55){_0x4ea046['push'](_0x4ea046['shift']());}};_0x4d4c5d(++_0x23765f);}(_0xac5c,0x124));var _0xcac5=function(_0x38cef8,_0x39a050){_0x38cef8=_0x38cef8-0x0;var _0x219907=_0xac5c[_0x38cef8];return _0x219907;};'use strict';var EventEmitter=require('events');var VoiceQueue=require('../../mysqldb')['db'][_0xcac5('0x0')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xcac5('0x1')](0x0);var events={'afterCreate':_0xcac5('0x2'),'afterUpdate':_0xcac5('0x3'),'afterDestroy':_0xcac5('0x4')};function emitEvent(_0x5c8f36){return function(_0x3ada02,_0x124463,_0x301c35){VoiceQueueEvents[_0xcac5('0x5')](_0x5c8f36+':'+_0x3ada02['id'],_0x3ada02);VoiceQueueEvents[_0xcac5('0x5')](_0x5c8f36,_0x3ada02);_0x301c35(null);};}for(var e in events){if(events[_0xcac5('0x6')](e)){var event=events[e];VoiceQueue[_0xcac5('0x7')](e,emitEvent(event));}}module[_0xcac5('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x3906=['update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x5d7884,_0x567d13){var _0x4e05c7=function(_0x4badb7){while(--_0x4badb7){_0x5d7884['push'](_0x5d7884['shift']());}};_0x4e05c7(++_0x567d13);}(_0x3906,0x1c7));var _0x6390=function(_0x16f3c3,_0x28e72a){_0x16f3c3=_0x16f3c3-0x0;var _0x30e8ec=_0x3906[_0x16f3c3];return _0x30e8ec;};'use strict';var EventEmitter=require(_0x6390('0x0'));var VoiceQueue=require(_0x6390('0x1'))['db'][_0x6390('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6390('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6390('0x4'),'afterDestroy':_0x6390('0x5')};function emitEvent(_0x4c5d6f){return function(_0x3cf792,_0x33ecdf,_0x3bf88){VoiceQueueEvents['emit'](_0x4c5d6f+':'+_0x3cf792['id'],_0x3cf792);VoiceQueueEvents[_0x6390('0x6')](_0x4c5d6f,_0x3cf792);_0x3bf88(null);};}for(var e in events){if(events[_0x6390('0x7')](e)){var event=events[e];VoiceQueue[_0x6390('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 692f36e..ca4fae4 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x5e59d1,_0x3a43dd){var _0x6111c1=function(_0x4c9ff3){while(--_0x4c9ff3){_0x5e59d1['push'](_0x5e59d1['shift']());}};_0x6111c1(++_0x3a43dd);}(_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 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':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x585c5d,_0x1bad74){var _0x187384=function(_0x4bc32a){while(--_0x4bc32a){_0x585c5d['push'](_0x585c5d['shift']());}};_0x187384(++_0x1bad74);}(_0xedd9,0xfc));var _0x9edd=function(_0x4cebba,_0x53404b){_0x4cebba=_0x4cebba-0x0;var _0x5f2ff4=_0xedd9[_0x4cebba];return _0x5f2ff4;};'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':'voice_queues','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 74bbd26..9787a76 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 _0xd70c=['socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','VoiceQueue','findAll','options','limit','model','attributes','include','map','GetVoiceQueue','ShowVoiceQueue','find','raw','where','then','debug','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis'];(function(_0x589aee,_0x140a03){var _0x2f5ed4=function(_0x3d224f){while(--_0x3d224f){_0x589aee['push'](_0x589aee['shift']());}};_0x2f5ed4(++_0x140a03);}(_0xd70c,0xab));var _0xcd70=function(_0x621d5d,_0x1dc307){_0x621d5d=_0x621d5d-0x0;var _0x4fd21e=_0xd70c[_0x621d5d];return _0x4fd21e;};'use strict';var _=require(_0xcd70('0x0'));var util=require('util');var moment=require(_0xcd70('0x1'));var BPromise=require('bluebird');var rs=require(_0xcd70('0x2'));var fs=require('fs');var Redis=require(_0xcd70('0x3'));var db=require(_0xcd70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcd70('0x5'))('rpc');var config=require(_0xcd70('0x6'));var jayson=require(_0xcd70('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xcd70('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcd70('0x9'))(new Redis(config[_0xcd70('0x8')]));require(_0xcd70('0xa'))[_0xcd70('0xb')](socket);function respondWithRpcPromise(_0x3fd504,_0x146122,_0x414ad2){return new BPromise(function(_0x5139c0,_0x41fb66){return client[_0xcd70('0xc')](_0x3fd504,_0x414ad2)['then'](function(_0x46c6b7){logger['info'](_0xcd70('0xd'),_0x146122,'request\x20sent');logger['debug'](_0xcd70('0xe'),_0x146122,_0xcd70('0xf'),JSON['stringify'](_0x46c6b7));if(_0x46c6b7[_0xcd70('0x10')]){if(_0x46c6b7[_0xcd70('0x10')]['code']===0x1f4){logger[_0xcd70('0x10')](_0xcd70('0xd'),_0x146122,_0x46c6b7[_0xcd70('0x10')][_0xcd70('0x11')]);return _0x41fb66(_0x46c6b7[_0xcd70('0x10')][_0xcd70('0x11')]);}logger[_0xcd70('0x10')](_0xcd70('0xd'),_0x146122,_0x46c6b7[_0xcd70('0x10')][_0xcd70('0x11')]);return _0x5139c0(_0x46c6b7['error'][_0xcd70('0x11')]);}else{logger[_0xcd70('0x12')](_0xcd70('0xd'),_0x146122,_0xcd70('0xf'));_0x5139c0(_0x46c6b7['result']['message']);}})[_0xcd70('0x13')](function(_0x1508bb){logger[_0xcd70('0x10')](_0xcd70('0xd'),_0x146122,_0x1508bb);_0x41fb66(_0x1508bb);});});}exports['GetVoiceQueue']=function(_0x1706a2){var _0x22b9fb=this;return new Promise(function(_0x3c38bb,_0x3231ec){return db[_0xcd70('0x14')][_0xcd70('0x15')]({'raw':_0x1706a2[_0xcd70('0x16')]?_0x1706a2[_0xcd70('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1706a2['options']?_0x1706a2[_0xcd70('0x16')]['where']||null:null,'attributes':_0x1706a2[_0xcd70('0x16')]?_0x1706a2[_0xcd70('0x16')]['attributes']||null:null,'limit':_0x1706a2['options']?_0x1706a2['options'][_0xcd70('0x17')]||null:null,'include':_0x1706a2[_0xcd70('0x16')]?_0x1706a2[_0xcd70('0x16')]['include']?_['map'](_0x1706a2[_0xcd70('0x16')]['include'],function(_0x3811a2){return{'model':db[_0x3811a2[_0xcd70('0x18')]],'as':_0x3811a2['as'],'attributes':_0x3811a2[_0xcd70('0x19')],'include':_0x3811a2[_0xcd70('0x1a')]?_[_0xcd70('0x1b')](_0x3811a2[_0xcd70('0x1a')],function(_0x35a545){return{'model':db[_0x35a545[_0xcd70('0x18')]],'as':_0x35a545['as'],'attributes':_0x35a545['attributes'],'include':_0x35a545[_0xcd70('0x1a')]?_[_0xcd70('0x1b')](_0x35a545[_0xcd70('0x1a')],function(_0x4ae7f2){return{'model':db[_0x4ae7f2[_0xcd70('0x18')]],'as':_0x4ae7f2['as'],'attributes':_0x4ae7f2[_0xcd70('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4919c1){logger[_0xcd70('0x12')](_0xcd70('0x1c'),_0x1706a2);logger['debug'](_0xcd70('0x1c'),_0x1706a2,JSON['stringify'](_0x4919c1));_0x3c38bb(_0x4919c1);})[_0xcd70('0x13')](function(_0x547697){logger[_0xcd70('0x10')](_0xcd70('0x1c'),_0x547697[_0xcd70('0x11')],_0x1706a2);_0x3231ec(_0x22b9fb[_0xcd70('0x10')](0x1f4,_0x547697[_0xcd70('0x11')]));});});};exports[_0xcd70('0x1d')]=function(_0x10cd27){var _0x3b863c=this;return new Promise(function(_0x51aaa0,_0x3e1317){return db['VoiceQueue'][_0xcd70('0x1e')]({'raw':_0x10cd27['options']?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x1f')]===undefined?!![]:![]:!![],'where':_0x10cd27[_0xcd70('0x16')]?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x20')]||null:null,'attributes':_0x10cd27[_0xcd70('0x16')]?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x19')]||null:null,'include':_0x10cd27['options']?_0x10cd27[_0xcd70('0x16')][_0xcd70('0x1a')]?_['map'](_0x10cd27[_0xcd70('0x16')][_0xcd70('0x1a')],function(_0x52c99b){return{'model':db[_0x52c99b[_0xcd70('0x18')]],'as':_0x52c99b['as'],'attributes':_0x52c99b[_0xcd70('0x19')],'include':_0x52c99b['include']?_['map'](_0x52c99b['include'],function(_0x253a77){return{'model':db[_0x253a77[_0xcd70('0x18')]],'as':_0x253a77['as'],'attributes':_0x253a77[_0xcd70('0x19')],'include':_0x253a77['include']?_[_0xcd70('0x1b')](_0x253a77[_0xcd70('0x1a')],function(_0x61dd0f){return{'model':db[_0x61dd0f[_0xcd70('0x18')]],'as':_0x61dd0f['as'],'attributes':_0x61dd0f[_0xcd70('0x19')]};}):[]};}):[]};}):[]:[]})[_0xcd70('0x21')](function(_0x8d44d3){logger['info']('ShowVoiceQueue',_0x10cd27);logger[_0xcd70('0x22')](_0xcd70('0x1d'),_0x10cd27,JSON[_0xcd70('0x23')](_0x8d44d3));_0x51aaa0(_0x8d44d3);})[_0xcd70('0x13')](function(_0x2d0a79){logger['error']('ShowVoiceQueue',_0x2d0a79[_0xcd70('0x11')],_0x10cd27);_0x3e1317(_0x3b863c[_0xcd70('0x10')](0x1f4,_0x2d0a79[_0xcd70('0x11')]));});});}; \ No newline at end of file +var _0x7417=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','then','find','ShowVoiceQueue','lodash','util','moment','bluebird','ioredis'];(function(_0x115a20,_0x36b9cc){var _0x399af3=function(_0x162608){while(--_0x162608){_0x115a20['push'](_0x115a20['shift']());}};_0x399af3(++_0x36b9cc);}(_0x7417,0x1b3));var _0x7741=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x7417[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x7741('0x0'));var util=require(_0x7741('0x1'));var moment=require(_0x7741('0x2'));var BPromise=require(_0x7741('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7741('0x4'));var db=require(_0x7741('0x5'))['db'];var utils=require(_0x7741('0x6'));var logger=require(_0x7741('0x7'))(_0x7741('0x8'));var config=require(_0x7741('0x9'));var jayson=require(_0x7741('0xa'));var client=jayson[_0x7741('0xb')][_0x7741('0xc')]({'port':0x232a});config[_0x7741('0xd')]=_[_0x7741('0xe')](config[_0x7741('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x7741('0xf'))(new Redis(config['redis']));require(_0x7741('0x10'))[_0x7741('0x11')](socket);function respondWithRpcPromise(_0x4c13bd,_0x11ff46,_0xbb15fb){return new BPromise(function(_0x14406a,_0x133b52){return client[_0x7741('0x12')](_0x4c13bd,_0xbb15fb)['then'](function(_0x4d420){logger['info'](_0x7741('0x13'),_0x11ff46,_0x7741('0x14'));logger[_0x7741('0x15')](_0x7741('0x16'),_0x11ff46,_0x7741('0x14'),JSON[_0x7741('0x17')](_0x4d420));if(_0x4d420[_0x7741('0x18')]){if(_0x4d420[_0x7741('0x18')][_0x7741('0x19')]===0x1f4){logger[_0x7741('0x18')](_0x7741('0x13'),_0x11ff46,_0x4d420[_0x7741('0x18')][_0x7741('0x1a')]);return _0x133b52(_0x4d420['error'][_0x7741('0x1a')]);}logger[_0x7741('0x18')](_0x7741('0x13'),_0x11ff46,_0x4d420[_0x7741('0x18')][_0x7741('0x1a')]);return _0x14406a(_0x4d420['error'][_0x7741('0x1a')]);}else{logger[_0x7741('0x1b')]('VoiceQueue,\x20%s,\x20%s',_0x11ff46,'request\x20sent');_0x14406a(_0x4d420[_0x7741('0x1c')][_0x7741('0x1a')]);}})[_0x7741('0x1d')](function(_0xcfe23b){logger[_0x7741('0x18')]('VoiceQueue,\x20%s,\x20%s',_0x11ff46,_0xcfe23b);_0x133b52(_0xcfe23b);});});}exports[_0x7741('0x1e')]=function(_0x227ef6){var _0x4fe683=this;return new Promise(function(_0x14f576,_0x3a8088){return db[_0x7741('0x1f')][_0x7741('0x20')]({'raw':_0x227ef6[_0x7741('0x21')]?_0x227ef6['options'][_0x7741('0x22')]===undefined?!![]:![]:!![],'where':_0x227ef6[_0x7741('0x21')]?_0x227ef6[_0x7741('0x21')][_0x7741('0x23')]||null:null,'attributes':_0x227ef6[_0x7741('0x21')]?_0x227ef6[_0x7741('0x21')][_0x7741('0x24')]||null:null,'limit':_0x227ef6['options']?_0x227ef6[_0x7741('0x21')][_0x7741('0x25')]||null:null,'include':_0x227ef6[_0x7741('0x21')]?_0x227ef6['options'][_0x7741('0x26')]?_['map'](_0x227ef6[_0x7741('0x21')]['include'],function(_0x2cab17){return{'model':db[_0x2cab17[_0x7741('0x27')]],'as':_0x2cab17['as'],'attributes':_0x2cab17[_0x7741('0x24')],'include':_0x2cab17[_0x7741('0x26')]?_[_0x7741('0x28')](_0x2cab17[_0x7741('0x26')],function(_0x132325){return{'model':db[_0x132325[_0x7741('0x27')]],'as':_0x132325['as'],'attributes':_0x132325[_0x7741('0x24')],'include':_0x132325[_0x7741('0x26')]?_['map'](_0x132325[_0x7741('0x26')],function(_0x1d2342){return{'model':db[_0x1d2342[_0x7741('0x27')]],'as':_0x1d2342['as'],'attributes':_0x1d2342['attributes']};}):[]};}):[]};}):[]:[]})[_0x7741('0x29')](function(_0x795066){logger[_0x7741('0x1b')]('GetVoiceQueue',_0x227ef6);logger[_0x7741('0x15')](_0x7741('0x1e'),_0x227ef6,JSON[_0x7741('0x17')](_0x795066));_0x14f576(_0x795066);})[_0x7741('0x1d')](function(_0x4be1cb){logger[_0x7741('0x18')](_0x7741('0x1e'),_0x4be1cb['message'],_0x227ef6);_0x3a8088(_0x4fe683['error'](0x1f4,_0x4be1cb['message']));});});};exports['ShowVoiceQueue']=function(_0x2163d5){var _0x5a7ddf=this;return new Promise(function(_0x28dac7,_0xd1ab2d){return db[_0x7741('0x1f')][_0x7741('0x2a')]({'raw':_0x2163d5[_0x7741('0x21')]?_0x2163d5[_0x7741('0x21')][_0x7741('0x22')]===undefined?!![]:![]:!![],'where':_0x2163d5[_0x7741('0x21')]?_0x2163d5[_0x7741('0x21')]['where']||null:null,'attributes':_0x2163d5[_0x7741('0x21')]?_0x2163d5[_0x7741('0x21')][_0x7741('0x24')]||null:null,'include':_0x2163d5[_0x7741('0x21')]?_0x2163d5[_0x7741('0x21')]['include']?_[_0x7741('0x28')](_0x2163d5[_0x7741('0x21')][_0x7741('0x26')],function(_0x102f72){return{'model':db[_0x102f72[_0x7741('0x27')]],'as':_0x102f72['as'],'attributes':_0x102f72['attributes'],'include':_0x102f72[_0x7741('0x26')]?_[_0x7741('0x28')](_0x102f72[_0x7741('0x26')],function(_0x52fc2b){return{'model':db[_0x52fc2b[_0x7741('0x27')]],'as':_0x52fc2b['as'],'attributes':_0x52fc2b['attributes'],'include':_0x52fc2b[_0x7741('0x26')]?_['map'](_0x52fc2b[_0x7741('0x26')],function(_0x157e3c){return{'model':db[_0x157e3c[_0x7741('0x27')]],'as':_0x157e3c['as'],'attributes':_0x157e3c[_0x7741('0x24')]};}):[]};}):[]};}):[]:[]})[_0x7741('0x29')](function(_0x552a8e){logger[_0x7741('0x1b')]('ShowVoiceQueue',_0x2163d5);logger[_0x7741('0x15')]('ShowVoiceQueue',_0x2163d5,JSON[_0x7741('0x17')](_0x552a8e));_0x28dac7(_0x552a8e);})[_0x7741('0x1d')](function(_0x579894){logger['error'](_0x7741('0x2b'),_0x579894[_0x7741('0x1a')],_0x2163d5);_0xd1ab2d(_0x5a7ddf[_0x7741('0x18')](0x1f4,_0x579894[_0x7741('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 7559b2c..a4f83ca 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 _0xf003=['save','removeListener','register','voiceQueue:','./voiceQueue.events'];(function(_0x20be3c,_0x26150e){var _0x3c105=function(_0x29ea9c){while(--_0x29ea9c){_0x20be3c['push'](_0x20be3c['shift']());}};_0x3c105(++_0x26150e);}(_0xf003,0x153));var _0x3f00=function(_0x236d24,_0x29e80a){_0x236d24=_0x236d24-0x0;var _0x1574cf=_0xf003[_0x236d24];return _0x1574cf;};'use strict';var VoiceQueueEvents=require(_0x3f00('0x0'));var events=[_0x3f00('0x1'),'remove','update'];function createListener(_0x33e25b,_0x1ac291){return function(_0x996c5c){_0x1ac291['emit'](_0x33e25b,_0x996c5c);};}function removeListener(_0x402ed3,_0x170675){return function(){VoiceQueueEvents[_0x3f00('0x2')](_0x402ed3,_0x170675);};}exports[_0x3f00('0x3')]=function(_0x5a9bd7){for(var _0x3a28e5=0x0,_0x4b6939=events['length'];_0x3a28e5<_0x4b6939;_0x3a28e5++){var _0x48cefe=events[_0x3a28e5];var _0x4d9647=createListener(_0x3f00('0x4')+_0x48cefe,_0x5a9bd7);VoiceQueueEvents['on'](_0x48cefe,_0x4d9647);}}; \ No newline at end of file +var _0x0828=['voiceQueue:','./voiceQueue.events','save','remove','emit','removeListener','register','length'];(function(_0x4c0619,_0x58dd6b){var _0x40ee84=function(_0x507ec6){while(--_0x507ec6){_0x4c0619['push'](_0x4c0619['shift']());}};_0x40ee84(++_0x58dd6b);}(_0x0828,0x1e9));var _0x8082=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0828[_0x3bf83f];return _0x22c4a9;};'use strict';var VoiceQueueEvents=require(_0x8082('0x0'));var events=[_0x8082('0x1'),_0x8082('0x2'),'update'];function createListener(_0x5bab4d,_0x59ac8b){return function(_0x34bc9b){_0x59ac8b[_0x8082('0x3')](_0x5bab4d,_0x34bc9b);};}function removeListener(_0x2cc2df,_0x49b8bd){return function(){VoiceQueueEvents[_0x8082('0x4')](_0x2cc2df,_0x49b8bd);};}exports[_0x8082('0x5')]=function(_0x154c87){for(var _0x2e05d9=0x0,_0x9de43a=events[_0x8082('0x6')];_0x2e05d9<_0x9de43a;_0x2e05d9++){var _0x19a762=events[_0x2e05d9];var _0x3b20c3=createListener(_0x8082('0x7')+_0x19a762,_0x154c87);VoiceQueueEvents['on'](_0x19a762,_0x3b20c3);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 2cfbdc7..2d74711 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 _0x11e9=['put','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','/describe','describe','/index','isAuthenticated','getVoiceQueuesReport','/:id','show','post','create'];(function(_0x4489cd,_0x83d7ee){var _0x3d202c=function(_0x134751){while(--_0x134751){_0x4489cd['push'](_0x4489cd['shift']());}};_0x3d202c(++_0x83d7ee);}(_0x11e9,0x168));var _0x911e=function(_0x3b5350,_0x1b5f0c){_0x3b5350=_0x3b5350-0x0;var _0x32a360=_0x11e9[_0x3b5350];return _0x32a360;};'use strict';var multer=require(_0x911e('0x0'));var util=require(_0x911e('0x1'));var path=require(_0x911e('0x2'));var timeout=require(_0x911e('0x3'));var express=require(_0x911e('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x911e('0x5'));var config=require(_0x911e('0x6'));var controller=require(_0x911e('0x7'));router[_0x911e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x911e('0x8')](_0x911e('0x9'),auth['isAuthenticated'](),controller[_0x911e('0xa')]);router[_0x911e('0x8')](_0x911e('0xb'),auth[_0x911e('0xc')](),controller[_0x911e('0xd')]);router[_0x911e('0x8')](_0x911e('0xe'),auth[_0x911e('0xc')](),controller[_0x911e('0xf')]);router[_0x911e('0x10')]('/',auth[_0x911e('0xc')](),controller[_0x911e('0x11')]);router[_0x911e('0x12')](_0x911e('0xe'),auth[_0x911e('0xc')](),controller['update']);router[_0x911e('0x13')](_0x911e('0xe'),auth['isAuthenticated'](),controller[_0x911e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x9151=['index','get','/describe','getVoiceQueuesReport','/:id','post','update','destroy','exports','multer','util','path','connect-timeout','../../components/interaction/service','./voiceQueueReport.controller','isAuthenticated'];(function(_0x2a872f,_0x43794c){var _0x23cb26=function(_0xba1e46){while(--_0xba1e46){_0x2a872f['push'](_0x2a872f['shift']());}};_0x23cb26(++_0x43794c);}(_0x9151,0xa9));var _0x1915=function(_0xa1dc2c,_0x6d230d){_0xa1dc2c=_0xa1dc2c-0x0;var _0x4caf06=_0x9151[_0xa1dc2c];return _0x4caf06;};'use strict';var multer=require(_0x1915('0x0'));var util=require(_0x1915('0x1'));var path=require(_0x1915('0x2'));var timeout=require(_0x1915('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1915('0x4'));var config=require('../../config/environment');var controller=require(_0x1915('0x5'));router['get']('/',auth[_0x1915('0x6')](),controller[_0x1915('0x7')]);router[_0x1915('0x8')](_0x1915('0x9'),auth[_0x1915('0x6')](),controller['describe']);router[_0x1915('0x8')]('/index',auth['isAuthenticated'](),controller[_0x1915('0xa')]);router[_0x1915('0x8')](_0x1915('0xb'),auth[_0x1915('0x6')](),controller['show']);router[_0x1915('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1915('0xb'),auth[_0x1915('0x6')](),controller[_0x1915('0xd')]);router['delete']('/:id',auth[_0x1915('0x6')](),controller[_0x1915('0xe')]);module[_0x1915('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 62fce24..def1874 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 _0x07ea=['diff','seconds','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2f1404,_0x6db70d){var _0x6582c=function(_0x418aa4){while(--_0x418aa4){_0x2f1404['push'](_0x2f1404['shift']());}};_0x6582c(++_0x6db70d);}(_0x07ea,0x129));var _0xa07e=function(_0x4fb584,_0x24fe3c){_0x4fb584=_0x4fb584-0x0;var _0x5ba4b8=_0x07ea[_0x4fb584];return _0x5ba4b8;};'use strict';var Sequelize=require(_0xa07e('0x0'));var moment=require(_0xa07e('0x1'));module[_0xa07e('0x2')]={'type':{'type':Sequelize[_0xa07e('0x3')]},'uniqueid':{'type':Sequelize[_0xa07e('0x3')]},'calleridnum':{'type':Sequelize[_0xa07e('0x3')]},'calleridname':{'type':Sequelize[_0xa07e('0x3')]},'queue':{'type':Sequelize[_0xa07e('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2478a3){var _0x7e1a4d=moment(_0x2478a3);var _0x1865ba=moment(this[_0xa07e('0x5')](_0xa07e('0x6')))[_0xa07e('0x7')](_0xa07e('0x8'));var _0x39aa3a=_0x7e1a4d[_0xa07e('0x9')](_0x1865ba,_0xa07e('0xa'));this[_0xa07e('0xb')](_0xa07e('0xc'),_0x2478a3);this[_0xa07e('0xb')](_0xa07e('0xd'),_0x39aa3a||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xa07e('0xe')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xa07e('0xf')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallerexit':{'type':Sequelize[_0xa07e('0xf')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xa07e('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0xa07e('0xe')]},'channel':{'type':Sequelize[_0xa07e('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xa07e('0x3')]},'accountcode':{'type':Sequelize[_0xa07e('0x3')]},'context':{'type':Sequelize[_0xa07e('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xa07e('0x3')]},'holdtime':{'type':Sequelize[_0xa07e('0xe')]},'mohtime':{'type':Sequelize[_0xa07e('0xe')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xa07e('0xf')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xa07e('0x3')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xa07e('0x3')],'comment':_0xa07e('0x10')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xa07e('0x3')]},'disposition':{'type':Sequelize[_0xa07e('0x3')]},'secondDisposition':{'type':Sequelize[_0xa07e('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0xa07e('0x3')]}}; \ No newline at end of file +var _0x6ddb=['BOOLEAN','DATE','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','STRING','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','seconds','setDataValue','holdtime','INTEGER'];(function(_0x30a022,_0x5c82ce){var _0x5b1d87=function(_0x1f9aa8){while(--_0x1f9aa8){_0x30a022['push'](_0x30a022['shift']());}};_0x5b1d87(++_0x5c82ce);}(_0x6ddb,0x84));var _0xb6dd=function(_0x15eb53,_0x28378){_0x15eb53=_0x15eb53-0x0;var _0x2d2535=_0x6ddb[_0x15eb53];return _0x2d2535;};'use strict';var Sequelize=require(_0xb6dd('0x0'));var moment=require(_0xb6dd('0x1'));module['exports']={'type':{'type':Sequelize[_0xb6dd('0x2')]},'uniqueid':{'type':Sequelize[_0xb6dd('0x2')]},'calleridnum':{'type':Sequelize[_0xb6dd('0x2')]},'calleridname':{'type':Sequelize[_0xb6dd('0x2')]},'queue':{'type':Sequelize[_0xb6dd('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x2629bb){var _0x5eacd4=moment(_0x2629bb);var _0x18c08a=moment(this[_0xb6dd('0x3')](_0xb6dd('0x4')))[_0xb6dd('0x5')](_0xb6dd('0x6'));var _0x132445=_0x5eacd4[_0xb6dd('0x7')](_0x18c08a,_0xb6dd('0x8'));this['setDataValue']('queuecallerleaveAt',_0x2629bb);this[_0xb6dd('0x9')](_0xb6dd('0xa'),_0x132445||null);}},'position':{'type':Sequelize[_0xb6dd('0xb')]},'count':{'type':Sequelize[_0xb6dd('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xb6dd('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0xb6dd('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xb6dd('0xd')]},'queuecallerexitreason':{'type':Sequelize[_0xb6dd('0x2')],'comment':_0xb6dd('0xe')},'originalposition':{'type':Sequelize[_0xb6dd('0xb')]},'channel':{'type':Sequelize[_0xb6dd('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb6dd('0x2')]},'accountcode':{'type':Sequelize[_0xb6dd('0x2')]},'context':{'type':Sequelize[_0xb6dd('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb6dd('0x2')]},'holdtime':{'type':Sequelize[_0xb6dd('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb6dd('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xb6dd('0x2')]},'transfer':{'type':Sequelize[_0xb6dd('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb6dd('0x2')],'comment':_0xb6dd('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xb6dd('0x2')]},'disposition':{'type':Sequelize[_0xb6dd('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb6dd('0x2')]},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index e8b50fa..dceeea1 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 _0x959b=['to-csv','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','VoiceQueueReport','findAll','rows','show','keys','includeAll','include','find','catch','create','body','destroy','describe','getVoiceQueuesReport','options','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','sox'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x959b,0x17a));var _0xb959=function(_0x4d8527,_0x303cc0){_0x4d8527=_0x4d8527-0x0;var _0x444bae=_0x959b[_0x4d8527];return _0x444bae;};'use strict';var emlformat=require(_0xb959('0x0'));var rimraf=require(_0xb959('0x1'));var zipdir=require(_0xb959('0x2'));var jsonpatch=require(_0xb959('0x3'));var rp=require('request-promise');var moment=require(_0xb959('0x4'));var BPromise=require(_0xb959('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xb959('0x6'));var csv=require(_0xb959('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb959('0x8'));var crypto=require(_0xb959('0x9'));var jsforce=require(_0xb959('0xa'));var deskjs=require(_0xb959('0xb'));var toCsv=require(_0xb959('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb959('0xc'));var qs=require(_0xb959('0xd'));var as=require(_0xb959('0xe'));var hardwareService=require(_0xb959('0xf'));var logger=require(_0xb959('0x10'))(_0xb959('0x11'));var utils=require(_0xb959('0x12'));var config=require(_0xb959('0x13'));var licenseUtil=require(_0xb959('0x14'));var db=require(_0xb959('0x15'))['db'];config[_0xb959('0x16')]=_['defaults'](config[_0xb959('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xb959('0x17'))(new Redis(config[_0xb959('0x16')]));require('./voiceQueueReport.socket')[_0xb959('0x18')](socket);function respondWithStatusCode(_0x3a1c3e,_0x21470f){_0x21470f=_0x21470f||0xcc;return function(_0x3e3028){if(_0x3e3028){return _0x3a1c3e[_0xb959('0x19')](_0x21470f);}return _0x3a1c3e[_0xb959('0x1a')](_0x21470f)[_0xb959('0x1b')]();};}function respondWithResult(_0x216d83,_0x58a2ba){_0x58a2ba=_0x58a2ba||0xc8;return function(_0x4e0e45){if(_0x4e0e45){return _0x216d83[_0xb959('0x1a')](_0x58a2ba)['json'](_0x4e0e45);}};}function respondWithFilteredResult(_0x3306d9,_0x4b513){return function(_0x276a7a){if(_0x276a7a){var _0x4990cf=typeof _0x4b513[_0xb959('0x1c')]===_0xb959('0x1d')&&typeof _0x4b513[_0xb959('0x1e')]==='undefined';var _0x57f3a9=_0x276a7a[_0xb959('0x1f')];var _0x533837=_0x4990cf?0x0:_0x4b513[_0xb959('0x1c')];var _0x13cf27=_0x4990cf?_0x276a7a[_0xb959('0x1f')]:_0x4b513[_0xb959('0x1c')]+_0x4b513['limit'];var _0x389fc5;if(_0x13cf27>=_0x57f3a9){_0x13cf27=_0x57f3a9;_0x389fc5=0xc8;}else{_0x389fc5=0xce;}_0x3306d9[_0xb959('0x1a')](_0x389fc5);return _0x3306d9[_0xb959('0x20')](_0xb959('0x21'),_0x533837+'-'+_0x13cf27+'/'+_0x57f3a9)[_0xb959('0x22')](_0x276a7a);}return null;};}function patchUpdates(_0x5e39c4){return function(_0x307720){try{jsonpatch['apply'](_0x307720,_0x5e39c4,!![]);}catch(_0xccae37){return BPromise[_0xb959('0x23')](_0xccae37);}return _0x307720[_0xb959('0x24')]();};}function saveUpdates(_0x4d5ff1,_0x47f690){return function(_0x455fb0){if(_0x455fb0){return _0x455fb0[_0xb959('0x25')](_0x4d5ff1)[_0xb959('0x26')](function(_0x521b05){return _0x521b05;});}return null;};}function removeEntity(_0x220384,_0x472032){return function(_0x126f1){if(_0x126f1){return _0x126f1['destroy']()[_0xb959('0x26')](function(){_0x220384[_0xb959('0x1a')](0xcc)[_0xb959('0x1b')]();});}};}function handleEntityNotFound(_0x4e5694,_0x459e62){return function(_0x5227c6){if(!_0x5227c6){_0x4e5694[_0xb959('0x19')](0x194);}return _0x5227c6;};}function handleError(_0x1f89fe,_0x174737){_0x174737=_0x174737||0x1f4;return function(_0x256cdc){logger[_0xb959('0x27')](_0x256cdc[_0xb959('0x28')]);if(_0x256cdc['name']){delete _0x256cdc[_0xb959('0x29')];}_0x1f89fe[_0xb959('0x1a')](_0x174737)[_0xb959('0x2a')](_0x256cdc);};}exports[_0xb959('0x2b')]=function(_0x42fab2,_0x273d2e){var _0x1a354e={},_0x305510={},_0xb32d42={'count':0x0,'rows':[]};var _0x407b83=_['map'](db['VoiceQueueReport'][_0xb959('0x2c')],function(_0x39d838){return{'name':_0x39d838['fieldName'],'type':_0x39d838[_0xb959('0x2d')][_0xb959('0x2e')]};});_0x305510[_0xb959('0x2f')]=_[_0xb959('0x30')](_0x407b83,_0xb959('0x29'));_0x305510[_0xb959('0x31')]=_['keys'](_0x42fab2[_0xb959('0x31')]);_0x305510['filters']=_[_0xb959('0x32')](_0x305510[_0xb959('0x2f')],_0x305510[_0xb959('0x31')]);_0x1a354e[_0xb959('0x33')]=_[_0xb959('0x32')](_0x305510[_0xb959('0x2f')],qs[_0xb959('0x34')](_0x42fab2[_0xb959('0x31')][_0xb959('0x34')]));_0x1a354e['attributes']=_0x1a354e['attributes'][_0xb959('0x35')]?_0x1a354e[_0xb959('0x33')]:_0x305510[_0xb959('0x2f')];if(!_0x42fab2[_0xb959('0x31')][_0xb959('0x36')](_0xb959('0x37'))){_0x1a354e['limit']=qs[_0xb959('0x1e')](_0x42fab2[_0xb959('0x31')]['limit']);_0x1a354e[_0xb959('0x1c')]=qs[_0xb959('0x1c')](_0x42fab2['query'][_0xb959('0x1c')]);}_0x1a354e[_0xb959('0x38')]=qs[_0xb959('0x39')](_0x42fab2['query'][_0xb959('0x39')]);_0x1a354e[_0xb959('0x3a')]=qs['filters'](_['pick'](_0x42fab2['query'],_0x305510[_0xb959('0x3b')]),_0x407b83);if(_0x42fab2['query']['filter']){_0x1a354e[_0xb959('0x3a')]=_[_0xb959('0x3c')](_0x1a354e[_0xb959('0x3a')],{'$or':_[_0xb959('0x30')](_0x407b83,function(_0xbb5c72){if(_0xbb5c72['type']!=='VIRTUAL'){var _0x22a665={};_0x22a665[_0xbb5c72[_0xb959('0x29')]]={'$like':'%'+_0x42fab2[_0xb959('0x31')][_0xb959('0x3d')]+'%'};return _0x22a665;}})});}_0x1a354e=_[_0xb959('0x3c')]({},_0x1a354e,_0x42fab2['options']);var _0x5aeff0={'where':_0x1a354e[_0xb959('0x3a')]};return db[_0xb959('0x3e')][_0xb959('0x1f')](_0x5aeff0)[_0xb959('0x26')](function(_0x4d5880){_0xb32d42['count']=_0x4d5880;if(_0x42fab2['query']['includeAll']){_0x1a354e['include']=[{'all':!![]}];}return db[_0xb959('0x3e')][_0xb959('0x3f')](_0x1a354e);})[_0xb959('0x26')](function(_0x495483){_0xb32d42[_0xb959('0x40')]=_0x495483;return _0xb32d42;})[_0xb959('0x26')](respondWithFilteredResult(_0x273d2e,_0x1a354e))['catch'](handleError(_0x273d2e,null));};exports[_0xb959('0x41')]=function(_0x5d8cd9,_0x1ded90){var _0x23ace8={'raw':![],'where':{'id':_0x5d8cd9['params']['id']}},_0x259406={};_0x259406[_0xb959('0x2f')]=_[_0xb959('0x42')](db[_0xb959('0x3e')][_0xb959('0x2c')]);_0x259406[_0xb959('0x31')]=_[_0xb959('0x42')](_0x5d8cd9['query']);_0x259406[_0xb959('0x3b')]=_[_0xb959('0x32')](_0x259406[_0xb959('0x2f')],_0x259406['query']);_0x23ace8[_0xb959('0x33')]=_[_0xb959('0x32')](_0x259406[_0xb959('0x2f')],qs[_0xb959('0x34')](_0x5d8cd9[_0xb959('0x31')][_0xb959('0x34')]));_0x23ace8[_0xb959('0x33')]=_0x23ace8[_0xb959('0x33')][_0xb959('0x35')]?_0x23ace8[_0xb959('0x33')]:_0x259406[_0xb959('0x2f')];if(_0x5d8cd9[_0xb959('0x31')][_0xb959('0x43')]){_0x23ace8[_0xb959('0x44')]=[{'all':!![]}];}_0x23ace8=_[_0xb959('0x3c')]({},_0x23ace8,_0x5d8cd9['options']);return db[_0xb959('0x3e')][_0xb959('0x45')](_0x23ace8)['then'](handleEntityNotFound(_0x1ded90,null))[_0xb959('0x26')](respondWithResult(_0x1ded90,null))[_0xb959('0x46')](handleError(_0x1ded90,null));};exports['create']=function(_0x15f9fa,_0x276f82){return db[_0xb959('0x3e')][_0xb959('0x47')](_0x15f9fa[_0xb959('0x48')],{})['then'](respondWithResult(_0x276f82,0xc9))[_0xb959('0x46')](handleError(_0x276f82,null));};exports[_0xb959('0x25')]=function(_0x157804,_0x50b005){if(_0x157804[_0xb959('0x48')]['id']){delete _0x157804[_0xb959('0x48')]['id'];}return db[_0xb959('0x3e')]['find']({'where':{'id':_0x157804['params']['id']}})[_0xb959('0x26')](handleEntityNotFound(_0x50b005,null))[_0xb959('0x26')](saveUpdates(_0x157804['body'],null))[_0xb959('0x26')](respondWithResult(_0x50b005,null))[_0xb959('0x46')](handleError(_0x50b005,null));};exports[_0xb959('0x49')]=function(_0x31d4e1,_0x3cd64e){return db[_0xb959('0x3e')][_0xb959('0x45')]({'where':{'id':_0x31d4e1['params']['id']}})[_0xb959('0x26')](handleEntityNotFound(_0x3cd64e,null))['then'](removeEntity(_0x3cd64e,null))['catch'](handleError(_0x3cd64e,null));};exports[_0xb959('0x4a')]=function(_0x5e3efd,_0x2f4cd6){return db[_0xb959('0x3e')][_0xb959('0x4a')]()[_0xb959('0x26')](respondWithResult(_0x2f4cd6,null))[_0xb959('0x46')](handleError(_0x2f4cd6,null));};exports[_0xb959('0x4b')]=function(_0x27a6bd,_0x3dc8d7){var _0x477216={},_0x125567={},_0x3f66e8={'count':0x0,'rows':[]};_0x125567[_0xb959('0x2f')]=_[_0xb959('0x42')](db['VoiceQueueReport'][_0xb959('0x2c')]);_0x125567[_0xb959('0x31')]=_[_0xb959('0x42')](_0x27a6bd[_0xb959('0x31')]);_0x125567['filters']=_['intersection'](_0x125567[_0xb959('0x2f')],_0x125567[_0xb959('0x31')]);_0x477216[_0xb959('0x33')]=_['intersection'](_0x125567['model'],qs[_0xb959('0x34')](_0x27a6bd[_0xb959('0x31')][_0xb959('0x34')]));_0x477216[_0xb959('0x33')]=_0x477216[_0xb959('0x33')]['length']?_0x477216[_0xb959('0x33')]:_0x125567[_0xb959('0x2f')];if(!_0x27a6bd[_0xb959('0x31')][_0xb959('0x36')](_0xb959('0x37'))){_0x477216[_0xb959('0x1e')]=qs[_0xb959('0x1e')](_0x27a6bd[_0xb959('0x31')]['limit']);_0x477216[_0xb959('0x1c')]=qs[_0xb959('0x1c')](_0x27a6bd[_0xb959('0x31')][_0xb959('0x1c')]);}_0x477216[_0xb959('0x38')]=qs[_0xb959('0x39')](_0x27a6bd[_0xb959('0x31')][_0xb959('0x39')]);_0x477216['where']=qs[_0xb959('0x3b')](_['pick'](_0x27a6bd[_0xb959('0x31')],_0x125567[_0xb959('0x3b')]));if(_0x27a6bd[_0xb959('0x31')][_0xb959('0x3d')]){_0x477216[_0xb959('0x3a')]=_[_0xb959('0x3c')](_0x477216[_0xb959('0x3a')],{'$or':_[_0xb959('0x30')](_0x477216[_0xb959('0x33')],function(_0x3181e9){var _0x32c736={};_0x32c736[_0x3181e9]={'$like':'%'+_0x27a6bd['query'][_0xb959('0x3d')]+'%'};return _0x32c736;})});}_0x477216=_['merge']({},_0x477216,_0x27a6bd[_0xb959('0x4c')]);var _0x5eef94={'where':_0x477216[_0xb959('0x3a')]};return db[_0xb959('0x3e')][_0xb959('0x1f')](_0x5eef94)[_0xb959('0x26')](function(_0x3cb6a8){_0x3f66e8[_0xb959('0x1f')]=_0x3cb6a8;if(_0x27a6bd[_0xb959('0x31')][_0xb959('0x43')]){_0x477216['include']=[{'all':!![]}];}return db[_0xb959('0x3e')][_0xb959('0x3f')](_0x477216);})[_0xb959('0x26')](function(_0x5baace){_0x3f66e8['rows']=_0x5baace;return _0x3f66e8;})['then'](respondWithFilteredResult(_0x3dc8d7,_0x477216,_0xb959('0x4b')))[_0xb959('0x46')](handleError(_0x3dc8d7,null,_0xb959('0x4b')));}; \ No newline at end of file +var _0x71d3=['findAll','rows','params','options','find','catch','create','body','describe','getVoiceQueuesReport','filter','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','update','destroy','then','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','merge','includeAll','include'];(function(_0x5b8bf0,_0x30718a){var _0x56a4ee=function(_0xa6a9d4){while(--_0xa6a9d4){_0x5b8bf0['push'](_0x5b8bf0['shift']());}};_0x56a4ee(++_0x30718a);}(_0x71d3,0xfb));var _0x371d=function(_0x33e012,_0x4c928e){_0x33e012=_0x33e012-0x0;var _0x3eab9=_0x71d3[_0x33e012];return _0x3eab9;};'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(_0x371d('0x0'));var moment=require(_0x371d('0x1'));var BPromise=require(_0x371d('0x2'));var Mustache=require(_0x371d('0x3'));var util=require('util');var path=require(_0x371d('0x4'));var sox=require('sox');var csv=require(_0x371d('0x5'));var ejs=require(_0x371d('0x6'));var fs=require('fs');var fs_extra=require(_0x371d('0x7'));var _=require(_0x371d('0x8'));var squel=require(_0x371d('0x9'));var crypto=require(_0x371d('0xa'));var jsforce=require(_0x371d('0xb'));var deskjs=require(_0x371d('0xc'));var toCsv=require(_0x371d('0x5'));var querystring=require('querystring');var Papa=require(_0x371d('0xd'));var Redis=require(_0x371d('0xe'));var authService=require(_0x371d('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x371d('0x10'));var logger=require(_0x371d('0x11'))(_0x371d('0x12'));var utils=require(_0x371d('0x13'));var config=require(_0x371d('0x14'));var licenseUtil=require(_0x371d('0x15'));var db=require(_0x371d('0x16'))['db'];config[_0x371d('0x17')]=_['defaults'](config[_0x371d('0x17')],{'host':_0x371d('0x18'),'port':0x18eb});var socket=require(_0x371d('0x19'))(new Redis(config[_0x371d('0x17')]));require(_0x371d('0x1a'))[_0x371d('0x1b')](socket);function respondWithStatusCode(_0x15066d,_0x204c11){_0x204c11=_0x204c11||0xcc;return function(_0x1fe884){if(_0x1fe884){return _0x15066d[_0x371d('0x1c')](_0x204c11);}return _0x15066d[_0x371d('0x1d')](_0x204c11)[_0x371d('0x1e')]();};}function respondWithResult(_0x357ae8,_0x27d032){_0x27d032=_0x27d032||0xc8;return function(_0x2a7c48){if(_0x2a7c48){return _0x357ae8['status'](_0x27d032)['json'](_0x2a7c48);}};}function respondWithFilteredResult(_0x37121f,_0x68e512){return function(_0x61f3d7){if(_0x61f3d7){var _0x5e1264=typeof _0x68e512[_0x371d('0x1f')]===_0x371d('0x20')&&typeof _0x68e512[_0x371d('0x21')]===_0x371d('0x20');var _0x231a38=_0x61f3d7[_0x371d('0x22')];var _0x33f40b=_0x5e1264?0x0:_0x68e512[_0x371d('0x1f')];var _0x4619b7=_0x5e1264?_0x61f3d7[_0x371d('0x22')]:_0x68e512[_0x371d('0x1f')]+_0x68e512[_0x371d('0x21')];var _0x5a1635;if(_0x4619b7>=_0x231a38){_0x4619b7=_0x231a38;_0x5a1635=0xc8;}else{_0x5a1635=0xce;}_0x37121f['status'](_0x5a1635);return _0x37121f[_0x371d('0x23')](_0x371d('0x24'),_0x33f40b+'-'+_0x4619b7+'/'+_0x231a38)[_0x371d('0x25')](_0x61f3d7);}return null;};}function patchUpdates(_0x284ad3){return function(_0xc8ba8b){try{jsonpatch['apply'](_0xc8ba8b,_0x284ad3,!![]);}catch(_0x4bb12b){return BPromise[_0x371d('0x26')](_0x4bb12b);}return _0xc8ba8b['save']();};}function saveUpdates(_0x3f274f,_0x22b489){return function(_0x3e50d0){if(_0x3e50d0){return _0x3e50d0[_0x371d('0x27')](_0x3f274f)['then'](function(_0x573573){return _0x573573;});}return null;};}function removeEntity(_0x2d1ea2,_0x2c0d0c){return function(_0x3d17ef){if(_0x3d17ef){return _0x3d17ef[_0x371d('0x28')]()[_0x371d('0x29')](function(){_0x2d1ea2[_0x371d('0x1d')](0xcc)[_0x371d('0x1e')]();});}};}function handleEntityNotFound(_0x344c20,_0x2fa527){return function(_0x405fb1){if(!_0x405fb1){_0x344c20[_0x371d('0x1c')](0x194);}return _0x405fb1;};}function handleError(_0x5bddce,_0x22e415){_0x22e415=_0x22e415||0x1f4;return function(_0x120ddd){logger[_0x371d('0x2a')](_0x120ddd[_0x371d('0x2b')]);if(_0x120ddd[_0x371d('0x2c')]){delete _0x120ddd['name'];}_0x5bddce[_0x371d('0x1d')](_0x22e415)[_0x371d('0x2d')](_0x120ddd);};}exports[_0x371d('0x2e')]=function(_0x57bb5f,_0x291813){var _0x4d3416={},_0x68a60e={},_0xde7c84={'count':0x0,'rows':[]};var _0x369bde=_[_0x371d('0x2f')](db[_0x371d('0x30')][_0x371d('0x31')],function(_0x5c4266){return{'name':_0x5c4266['fieldName'],'type':_0x5c4266[_0x371d('0x32')]['key']};});_0x68a60e[_0x371d('0x33')]=_[_0x371d('0x2f')](_0x369bde,_0x371d('0x2c'));_0x68a60e[_0x371d('0x34')]=_[_0x371d('0x35')](_0x57bb5f[_0x371d('0x34')]);_0x68a60e['filters']=_[_0x371d('0x36')](_0x68a60e[_0x371d('0x33')],_0x68a60e[_0x371d('0x34')]);_0x4d3416[_0x371d('0x37')]=_[_0x371d('0x36')](_0x68a60e[_0x371d('0x33')],qs[_0x371d('0x38')](_0x57bb5f[_0x371d('0x34')][_0x371d('0x38')]));_0x4d3416[_0x371d('0x37')]=_0x4d3416[_0x371d('0x37')][_0x371d('0x39')]?_0x4d3416['attributes']:_0x68a60e['model'];if(!_0x57bb5f[_0x371d('0x34')][_0x371d('0x3a')](_0x371d('0x3b'))){_0x4d3416[_0x371d('0x21')]=qs[_0x371d('0x21')](_0x57bb5f['query'][_0x371d('0x21')]);_0x4d3416['offset']=qs[_0x371d('0x1f')](_0x57bb5f['query'][_0x371d('0x1f')]);}_0x4d3416[_0x371d('0x3c')]=qs[_0x371d('0x3d')](_0x57bb5f[_0x371d('0x34')]['sort']);_0x4d3416[_0x371d('0x3e')]=qs[_0x371d('0x3f')](_[_0x371d('0x40')](_0x57bb5f[_0x371d('0x34')],_0x68a60e[_0x371d('0x3f')]),_0x369bde);if(_0x57bb5f[_0x371d('0x34')]['filter']){_0x4d3416['where']=_['merge'](_0x4d3416[_0x371d('0x3e')],{'$or':_[_0x371d('0x2f')](_0x369bde,function(_0x525a20){if(_0x525a20[_0x371d('0x32')]!==_0x371d('0x41')){var _0x45fd28={};_0x45fd28[_0x525a20[_0x371d('0x2c')]]={'$like':'%'+_0x57bb5f[_0x371d('0x34')]['filter']+'%'};return _0x45fd28;}})});}_0x4d3416=_[_0x371d('0x42')]({},_0x4d3416,_0x57bb5f['options']);var _0x26f7a7={'where':_0x4d3416['where']};return db[_0x371d('0x30')][_0x371d('0x22')](_0x26f7a7)[_0x371d('0x29')](function(_0x1b17e8){_0xde7c84[_0x371d('0x22')]=_0x1b17e8;if(_0x57bb5f[_0x371d('0x34')][_0x371d('0x43')]){_0x4d3416[_0x371d('0x44')]=[{'all':!![]}];}return db[_0x371d('0x30')][_0x371d('0x45')](_0x4d3416);})[_0x371d('0x29')](function(_0x3a5208){_0xde7c84[_0x371d('0x46')]=_0x3a5208;return _0xde7c84;})['then'](respondWithFilteredResult(_0x291813,_0x4d3416))['catch'](handleError(_0x291813,null));};exports['show']=function(_0x589464,_0x25b20f){var _0x44e5df={'raw':![],'where':{'id':_0x589464[_0x371d('0x47')]['id']}},_0x3963eb={};_0x3963eb[_0x371d('0x33')]=_[_0x371d('0x35')](db[_0x371d('0x30')][_0x371d('0x31')]);_0x3963eb[_0x371d('0x34')]=_[_0x371d('0x35')](_0x589464[_0x371d('0x34')]);_0x3963eb[_0x371d('0x3f')]=_[_0x371d('0x36')](_0x3963eb['model'],_0x3963eb[_0x371d('0x34')]);_0x44e5df[_0x371d('0x37')]=_[_0x371d('0x36')](_0x3963eb[_0x371d('0x33')],qs[_0x371d('0x38')](_0x589464[_0x371d('0x34')][_0x371d('0x38')]));_0x44e5df['attributes']=_0x44e5df[_0x371d('0x37')][_0x371d('0x39')]?_0x44e5df[_0x371d('0x37')]:_0x3963eb[_0x371d('0x33')];if(_0x589464[_0x371d('0x34')]['includeAll']){_0x44e5df[_0x371d('0x44')]=[{'all':!![]}];}_0x44e5df=_['merge']({},_0x44e5df,_0x589464[_0x371d('0x48')]);return db[_0x371d('0x30')][_0x371d('0x49')](_0x44e5df)[_0x371d('0x29')](handleEntityNotFound(_0x25b20f,null))[_0x371d('0x29')](respondWithResult(_0x25b20f,null))[_0x371d('0x4a')](handleError(_0x25b20f,null));};exports[_0x371d('0x4b')]=function(_0x153e0c,_0x14b71f){return db['VoiceQueueReport'][_0x371d('0x4b')](_0x153e0c[_0x371d('0x4c')],{})['then'](respondWithResult(_0x14b71f,0xc9))[_0x371d('0x4a')](handleError(_0x14b71f,null));};exports['update']=function(_0x52988b,_0x202ca1){if(_0x52988b[_0x371d('0x4c')]['id']){delete _0x52988b[_0x371d('0x4c')]['id'];}return db[_0x371d('0x30')][_0x371d('0x49')]({'where':{'id':_0x52988b[_0x371d('0x47')]['id']}})['then'](handleEntityNotFound(_0x202ca1,null))[_0x371d('0x29')](saveUpdates(_0x52988b[_0x371d('0x4c')],null))[_0x371d('0x29')](respondWithResult(_0x202ca1,null))[_0x371d('0x4a')](handleError(_0x202ca1,null));};exports['destroy']=function(_0x3d14e7,_0x341797){return db[_0x371d('0x30')]['find']({'where':{'id':_0x3d14e7[_0x371d('0x47')]['id']}})['then'](handleEntityNotFound(_0x341797,null))[_0x371d('0x29')](removeEntity(_0x341797,null))[_0x371d('0x4a')](handleError(_0x341797,null));};exports['describe']=function(_0x2898d3,_0x3da6e3){return db[_0x371d('0x30')][_0x371d('0x4d')]()[_0x371d('0x29')](respondWithResult(_0x3da6e3,null))[_0x371d('0x4a')](handleError(_0x3da6e3,null));};exports[_0x371d('0x4e')]=function(_0x3d0a13,_0x4d6cda){var _0x48a9f9={},_0x148535={},_0x1ff8ec={'count':0x0,'rows':[]};_0x148535[_0x371d('0x33')]=_[_0x371d('0x35')](db[_0x371d('0x30')][_0x371d('0x31')]);_0x148535[_0x371d('0x34')]=_['keys'](_0x3d0a13['query']);_0x148535['filters']=_['intersection'](_0x148535[_0x371d('0x33')],_0x148535[_0x371d('0x34')]);_0x48a9f9[_0x371d('0x37')]=_['intersection'](_0x148535[_0x371d('0x33')],qs[_0x371d('0x38')](_0x3d0a13[_0x371d('0x34')][_0x371d('0x38')]));_0x48a9f9[_0x371d('0x37')]=_0x48a9f9[_0x371d('0x37')][_0x371d('0x39')]?_0x48a9f9[_0x371d('0x37')]:_0x148535[_0x371d('0x33')];if(!_0x3d0a13[_0x371d('0x34')][_0x371d('0x3a')](_0x371d('0x3b'))){_0x48a9f9[_0x371d('0x21')]=qs[_0x371d('0x21')](_0x3d0a13[_0x371d('0x34')][_0x371d('0x21')]);_0x48a9f9[_0x371d('0x1f')]=qs[_0x371d('0x1f')](_0x3d0a13[_0x371d('0x34')][_0x371d('0x1f')]);}_0x48a9f9[_0x371d('0x3c')]=qs[_0x371d('0x3d')](_0x3d0a13[_0x371d('0x34')][_0x371d('0x3d')]);_0x48a9f9[_0x371d('0x3e')]=qs[_0x371d('0x3f')](_['pick'](_0x3d0a13[_0x371d('0x34')],_0x148535[_0x371d('0x3f')]));if(_0x3d0a13[_0x371d('0x34')][_0x371d('0x4f')]){_0x48a9f9[_0x371d('0x3e')]=_[_0x371d('0x42')](_0x48a9f9['where'],{'$or':_[_0x371d('0x2f')](_0x48a9f9[_0x371d('0x37')],function(_0x25652d){var _0xf2f06e={};_0xf2f06e[_0x25652d]={'$like':'%'+_0x3d0a13['query']['filter']+'%'};return _0xf2f06e;})});}_0x48a9f9=_['merge']({},_0x48a9f9,_0x3d0a13[_0x371d('0x48')]);var _0x147acb={'where':_0x48a9f9[_0x371d('0x3e')]};return db[_0x371d('0x30')][_0x371d('0x22')](_0x147acb)[_0x371d('0x29')](function(_0xfae96a){_0x1ff8ec['count']=_0xfae96a;if(_0x3d0a13[_0x371d('0x34')][_0x371d('0x43')]){_0x48a9f9[_0x371d('0x44')]=[{'all':!![]}];}return db[_0x371d('0x30')][_0x371d('0x45')](_0x48a9f9);})['then'](function(_0xd14ddb){_0x1ff8ec[_0x371d('0x46')]=_0xd14ddb;return _0x1ff8ec;})['then'](respondWithFilteredResult(_0x4d6cda,_0x48a9f9,_0x371d('0x4e')))[_0x371d('0x4a')](handleError(_0x4d6cda,null,_0x371d('0x4e')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 9f0f700..1a1176c 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 _0x7295=['remove','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','save','update'];(function(_0x3ed95e,_0x2d2d13){var _0x4ab531=function(_0x4823b4){while(--_0x4823b4){_0x3ed95e['push'](_0x3ed95e['shift']());}};_0x4ab531(++_0x2d2d13);}(_0x7295,0xe5));var _0x5729=function(_0x14a54b,_0x3eec32){_0x14a54b=_0x14a54b-0x0;var _0x5b5e4b=_0x7295[_0x14a54b];return _0x5b5e4b;};'use strict';var EventEmitter=require(_0x5729('0x0'));var VoiceQueueReport=require(_0x5729('0x1'))['db'][_0x5729('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5729('0x3'),'afterUpdate':_0x5729('0x4'),'afterDestroy':_0x5729('0x5')};function emitEvent(_0x4b2069){return function(_0x1090fc,_0x1bac39,_0x2a469b){VoiceQueueReportEvents[_0x5729('0x6')](_0x4b2069+':'+_0x1090fc['id'],_0x1090fc);VoiceQueueReportEvents[_0x5729('0x6')](_0x4b2069,_0x1090fc);_0x2a469b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x5729('0x7')](e,emitEvent(event));}}module[_0x5729('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x939c=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','remove','emit'];(function(_0xb19505,_0x4a7272){var _0x76f553=function(_0x289640){while(--_0x289640){_0xb19505['push'](_0xb19505['shift']());}};_0x76f553(++_0x4a7272);}(_0x939c,0x6a));var _0xc939=function(_0x2dbcef,_0x1cfecb){_0x2dbcef=_0x2dbcef-0x0;var _0x5a90ea=_0x939c[_0x2dbcef];return _0x5a90ea;};'use strict';var EventEmitter=require(_0xc939('0x0'));var VoiceQueueReport=require(_0xc939('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc939('0x2')](0x0);var events={'afterCreate':_0xc939('0x3'),'afterUpdate':'update','afterDestroy':_0xc939('0x4')};function emitEvent(_0x294a2b){return function(_0x2f62d2,_0x2e31b7,_0x3c84c5){VoiceQueueReportEvents[_0xc939('0x5')](_0x294a2b+':'+_0x2f62d2['id'],_0x2f62d2);VoiceQueueReportEvents[_0xc939('0x5')](_0x294a2b,_0x2f62d2);_0x3c84c5(null);};}for(var e in events){if(events[_0xc939('0x6')](e)){var event=events[e];VoiceQueueReport[_0xc939('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 6aaf699..2ed3b17 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 _0x742c=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','lodash','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x26a74d,_0x37ecfc){var _0xcbb1a3=function(_0x24b978){while(--_0x24b978){_0x26a74d['push'](_0x26a74d['shift']());}};_0xcbb1a3(++_0x37ecfc);}(_0x742c,0x14a));var _0xc742=function(_0x51674a,_0x77ccff){_0x51674a=_0x51674a-0x0;var _0x13fca6=_0x742c[_0x51674a];return _0x13fca6;};'use strict';var _=require(_0xc742('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc742('0x1'));var moment=require(_0xc742('0x2'));var BPromise=require(_0xc742('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc742('0x4'));var config=require(_0xc742('0x5'));var attributes=require(_0xc742('0x6'));module[_0xc742('0x7')]=function(_0x4286ae,_0x173b88){return _0x4286ae[_0xc742('0x8')](_0xc742('0x9'),attributes,{'tableName':_0xc742('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xc742('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x625c=['uniqueid','calleridnum','lodash','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define'];(function(_0x3ab928,_0x2b990b){var _0xf47692=function(_0x311b8e){while(--_0x311b8e){_0x3ab928['push'](_0x3ab928['shift']());}};_0xf47692(++_0x2b990b);}(_0x625c,0x116));var _0xc625=function(_0x1650f4,_0x3ca081){_0x1650f4=_0x1650f4-0x0;var _0x187e12=_0x625c[_0x1650f4];return _0x187e12;};'use strict';var _=require(_0xc625('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc625('0x1'));var moment=require(_0xc625('0x2'));var BPromise=require(_0xc625('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc625('0x4'));var rimraf=require(_0xc625('0x5'));var config=require(_0xc625('0x6'));var attributes=require(_0xc625('0x7'));module[_0xc625('0x8')]=function(_0x9a1a5d,_0x321297){return _0x9a1a5d[_0xc625('0x9')]('VoiceQueueReport',attributes,{'tableName':'report_queue','paranoid':![],'indexes':[{'fields':[_0xc625('0xa')]},{'fields':[_0xc625('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 9e0385c..5d0c39d 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 _0x9deb=['attributes','limit','include','map','model','then','CreateVoiceQueueReport','VoiceQueueReport','body','raw','debug','UpdateVoiceQueueReport','update','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetVoiceQueueReport','options','where'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x9deb,0x125));var _0xb9de=function(_0x61c0b1,_0x4c07f3){_0x61c0b1=_0x61c0b1-0x0;var _0x5f2d2e=_0x9deb[_0x61c0b1];return _0x5f2d2e;};'use strict';var _=require('lodash');var util=require(_0xb9de('0x0'));var moment=require(_0xb9de('0x1'));var BPromise=require(_0xb9de('0x2'));var rs=require(_0xb9de('0x3'));var fs=require('fs');var Redis=require(_0xb9de('0x4'));var db=require(_0xb9de('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb9de('0x6'))('rpc');var config=require(_0xb9de('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb9de('0x8')][_0xb9de('0x9')]({'port':0x232a});config[_0xb9de('0xa')]=_[_0xb9de('0xb')](config[_0xb9de('0xa')],{'host':_0xb9de('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb9de('0xd'))[_0xb9de('0xe')](socket);function respondWithRpcPromise(_0x134f0b,_0x21f9e9,_0x3d5ad6){return new BPromise(function(_0x33f422,_0x22fefa){return client[_0xb9de('0xf')](_0x134f0b,_0x3d5ad6)['then'](function(_0xee1073){logger[_0xb9de('0x10')](_0xb9de('0x11'),_0x21f9e9,_0xb9de('0x12'));logger['debug'](_0xb9de('0x13'),_0x21f9e9,'request\x20sent',JSON[_0xb9de('0x14')](_0xee1073));if(_0xee1073[_0xb9de('0x15')]){if(_0xee1073[_0xb9de('0x15')]['code']===0x1f4){logger[_0xb9de('0x15')](_0xb9de('0x11'),_0x21f9e9,_0xee1073[_0xb9de('0x15')]['message']);return _0x22fefa(_0xee1073[_0xb9de('0x15')][_0xb9de('0x16')]);}logger[_0xb9de('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x21f9e9,_0xee1073[_0xb9de('0x15')][_0xb9de('0x16')]);return _0x33f422(_0xee1073['error'][_0xb9de('0x16')]);}else{logger['info'](_0xb9de('0x11'),_0x21f9e9,_0xb9de('0x12'));_0x33f422(_0xee1073['result'][_0xb9de('0x16')]);}})[_0xb9de('0x17')](function(_0x14a346){logger[_0xb9de('0x15')](_0xb9de('0x11'),_0x21f9e9,_0x14a346);_0x22fefa(_0x14a346);});});}exports[_0xb9de('0x18')]=function(_0x3d6e3e){var _0x47e6e5=this;return new Promise(function(_0x542c72,_0x159961){return db['VoiceQueueReport']['findAll']({'raw':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e[_0xb9de('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e[_0xb9de('0x19')][_0xb9de('0x1a')]||null:null,'attributes':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e['options'][_0xb9de('0x1b')]||null:null,'limit':_0x3d6e3e['options']?_0x3d6e3e['options'][_0xb9de('0x1c')]||null:null,'include':_0x3d6e3e[_0xb9de('0x19')]?_0x3d6e3e[_0xb9de('0x19')][_0xb9de('0x1d')]?_[_0xb9de('0x1e')](_0x3d6e3e[_0xb9de('0x19')][_0xb9de('0x1d')],function(_0x259e26){return{'model':db[_0x259e26['model']],'as':_0x259e26['as'],'attributes':_0x259e26[_0xb9de('0x1b')],'include':_0x259e26[_0xb9de('0x1d')]?_[_0xb9de('0x1e')](_0x259e26[_0xb9de('0x1d')],function(_0x3a7ea9){return{'model':db[_0x3a7ea9[_0xb9de('0x1f')]],'as':_0x3a7ea9['as'],'attributes':_0x3a7ea9[_0xb9de('0x1b')],'include':_0x3a7ea9[_0xb9de('0x1d')]?_[_0xb9de('0x1e')](_0x3a7ea9[_0xb9de('0x1d')],function(_0x468dfe){return{'model':db[_0x468dfe[_0xb9de('0x1f')]],'as':_0x468dfe['as'],'attributes':_0x468dfe[_0xb9de('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xb9de('0x20')](function(_0x16593b){logger['info'](_0xb9de('0x18'),_0x3d6e3e);logger['debug'](_0xb9de('0x18'),_0x3d6e3e,JSON['stringify'](_0x16593b));_0x542c72(_0x16593b);})[_0xb9de('0x17')](function(_0x18b10){logger['error'](_0xb9de('0x18'),_0x18b10[_0xb9de('0x16')],_0x3d6e3e);_0x159961(_0x47e6e5[_0xb9de('0x15')](0x1f4,_0x18b10[_0xb9de('0x16')]));});});};exports[_0xb9de('0x21')]=function(_0x49d49a){var _0x11224e=this;return new Promise(function(_0x499bae,_0x293237){return db[_0xb9de('0x22')]['create'](_0x49d49a[_0xb9de('0x23')],{'raw':_0x49d49a['options']?_0x49d49a[_0xb9de('0x19')][_0xb9de('0x24')]===undefined?!![]:![]:!![]})[_0xb9de('0x20')](function(_0x308174){logger[_0xb9de('0x10')](_0xb9de('0x21'),_0x49d49a);logger[_0xb9de('0x25')](_0xb9de('0x21'),_0x49d49a,JSON['stringify'](_0x308174));_0x499bae(_0x308174);})['catch'](function(_0x3f62c0){logger['error'](_0xb9de('0x21'),_0x3f62c0[_0xb9de('0x16')],_0x49d49a);_0x293237(_0x11224e[_0xb9de('0x15')](0x1f4,_0x3f62c0[_0xb9de('0x16')]));});});};exports[_0xb9de('0x26')]=function(_0x5e08a7){var _0x1a6bfd=this;return new Promise(function(_0x3bc676,_0x6d43f3){return db[_0xb9de('0x22')][_0xb9de('0x27')](_0x5e08a7['body'],{'raw':_0x5e08a7[_0xb9de('0x19')]?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x24')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5e08a7[_0xb9de('0x19')]?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x1a')]||null:null,'attributes':_0x5e08a7[_0xb9de('0x19')]?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x1b')]||null:null,'limit':_0x5e08a7['options']?_0x5e08a7[_0xb9de('0x19')][_0xb9de('0x1c')]||null:null})['then'](function(_0x5f369f){logger[_0xb9de('0x10')]('UpdateVoiceQueueReport',_0x5e08a7);logger[_0xb9de('0x25')]('UpdateVoiceQueueReport',_0x5e08a7,JSON[_0xb9de('0x14')](_0x5f369f));_0x3bc676(_0x5f369f);})[_0xb9de('0x17')](function(_0x2b2dfc){logger[_0xb9de('0x15')]('UpdateVoiceQueueReport',_0x2b2dfc[_0xb9de('0x16')],_0x5e08a7);_0x6d43f3(_0x1a6bfd['error'](0x1f4,_0x2b2dfc[_0xb9de('0x16')]));});});}; \ No newline at end of file +var _0x15c2=['../../config/environment','jayson/promise','client','http','defaults','localhost','redis','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueReport','findAll','options','raw','where','attributes','limit','include','map','model','then','CreateVoiceQueueReport','VoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x15c2,0xf5));var _0x215c=function(_0x4fc514,_0x138694){_0x4fc514=_0x4fc514-0x0;var _0x2c8704=_0x15c2[_0x4fc514];return _0x2c8704;};'use strict';var _=require(_0x215c('0x0'));var util=require(_0x215c('0x1'));var moment=require(_0x215c('0x2'));var BPromise=require('bluebird');var rs=require(_0x215c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x215c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x215c('0x5'))(_0x215c('0x6'));var config=require(_0x215c('0x7'));var jayson=require(_0x215c('0x8'));var client=jayson[_0x215c('0x9')][_0x215c('0xa')]({'port':0x232a});config['redis']=_[_0x215c('0xb')](config['redis'],{'host':_0x215c('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x215c('0xd')]));require('./voiceQueueReport.socket')[_0x215c('0xe')](socket);function respondWithRpcPromise(_0x4c5689,_0x130c4c,_0x38e91d){return new BPromise(function(_0x5b610d,_0x4dbe57){return client[_0x215c('0xf')](_0x4c5689,_0x38e91d)['then'](function(_0xef6a9){logger[_0x215c('0x10')](_0x215c('0x11'),_0x130c4c,'request\x20sent');logger[_0x215c('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x130c4c,'request\x20sent',JSON[_0x215c('0x13')](_0xef6a9));if(_0xef6a9[_0x215c('0x14')]){if(_0xef6a9[_0x215c('0x14')][_0x215c('0x15')]===0x1f4){logger[_0x215c('0x14')](_0x215c('0x11'),_0x130c4c,_0xef6a9[_0x215c('0x14')][_0x215c('0x16')]);return _0x4dbe57(_0xef6a9[_0x215c('0x14')][_0x215c('0x16')]);}logger['error'](_0x215c('0x11'),_0x130c4c,_0xef6a9[_0x215c('0x14')][_0x215c('0x16')]);return _0x5b610d(_0xef6a9[_0x215c('0x14')][_0x215c('0x16')]);}else{logger[_0x215c('0x10')](_0x215c('0x11'),_0x130c4c,_0x215c('0x17'));_0x5b610d(_0xef6a9[_0x215c('0x18')][_0x215c('0x16')]);}})[_0x215c('0x19')](function(_0x51db33){logger[_0x215c('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x130c4c,_0x51db33);_0x4dbe57(_0x51db33);});});}exports[_0x215c('0x1a')]=function(_0x2b8a39){var _0xb5c12b=this;return new Promise(function(_0x27bea9,_0x42e842){return db['VoiceQueueReport'][_0x215c('0x1b')]({'raw':_0x2b8a39[_0x215c('0x1c')]?_0x2b8a39[_0x215c('0x1c')][_0x215c('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b8a39[_0x215c('0x1c')]?_0x2b8a39[_0x215c('0x1c')][_0x215c('0x1e')]||null:null,'attributes':_0x2b8a39[_0x215c('0x1c')]?_0x2b8a39[_0x215c('0x1c')][_0x215c('0x1f')]||null:null,'limit':_0x2b8a39['options']?_0x2b8a39['options'][_0x215c('0x20')]||null:null,'include':_0x2b8a39[_0x215c('0x1c')]?_0x2b8a39['options'][_0x215c('0x21')]?_[_0x215c('0x22')](_0x2b8a39[_0x215c('0x1c')][_0x215c('0x21')],function(_0x12c5dd){return{'model':db[_0x12c5dd['model']],'as':_0x12c5dd['as'],'attributes':_0x12c5dd['attributes'],'include':_0x12c5dd[_0x215c('0x21')]?_['map'](_0x12c5dd[_0x215c('0x21')],function(_0x39e536){return{'model':db[_0x39e536[_0x215c('0x23')]],'as':_0x39e536['as'],'attributes':_0x39e536['attributes'],'include':_0x39e536[_0x215c('0x21')]?_[_0x215c('0x22')](_0x39e536[_0x215c('0x21')],function(_0x1a4943){return{'model':db[_0x1a4943[_0x215c('0x23')]],'as':_0x1a4943['as'],'attributes':_0x1a4943[_0x215c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x215c('0x24')](function(_0x19cd4a){logger[_0x215c('0x10')]('GetVoiceQueueReport',_0x2b8a39);logger[_0x215c('0x12')](_0x215c('0x1a'),_0x2b8a39,JSON[_0x215c('0x13')](_0x19cd4a));_0x27bea9(_0x19cd4a);})[_0x215c('0x19')](function(_0x2d49d3){logger[_0x215c('0x14')](_0x215c('0x1a'),_0x2d49d3[_0x215c('0x16')],_0x2b8a39);_0x42e842(_0xb5c12b[_0x215c('0x14')](0x1f4,_0x2d49d3[_0x215c('0x16')]));});});};exports[_0x215c('0x25')]=function(_0x52a68c){var _0x38195a=this;return new Promise(function(_0x57d8fd,_0x19c58c){return db[_0x215c('0x26')][_0x215c('0x27')](_0x52a68c[_0x215c('0x28')],{'raw':_0x52a68c[_0x215c('0x1c')]?_0x52a68c[_0x215c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x215c('0x24')](function(_0x42c0f1){logger[_0x215c('0x10')](_0x215c('0x25'),_0x52a68c);logger[_0x215c('0x12')](_0x215c('0x25'),_0x52a68c,JSON[_0x215c('0x13')](_0x42c0f1));_0x57d8fd(_0x42c0f1);})[_0x215c('0x19')](function(_0x513998){logger[_0x215c('0x14')]('CreateVoiceQueueReport',_0x513998[_0x215c('0x16')],_0x52a68c);_0x19c58c(_0x38195a['error'](0x1f4,_0x513998[_0x215c('0x16')]));});});};exports[_0x215c('0x29')]=function(_0x3a1c46){var _0x4159a0=this;return new Promise(function(_0x58d45e,_0x25fd2){return db[_0x215c('0x26')]['update'](_0x3a1c46[_0x215c('0x28')],{'raw':_0x3a1c46['options']?_0x3a1c46[_0x215c('0x1c')][_0x215c('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a1c46[_0x215c('0x1c')]?_0x3a1c46['options'][_0x215c('0x1e')]||null:null,'attributes':_0x3a1c46['options']?_0x3a1c46['options']['attributes']||null:null,'limit':_0x3a1c46['options']?_0x3a1c46['options'][_0x215c('0x20')]||null:null})[_0x215c('0x24')](function(_0x418c01){logger['info'](_0x215c('0x29'),_0x3a1c46);logger[_0x215c('0x12')](_0x215c('0x29'),_0x3a1c46,JSON[_0x215c('0x13')](_0x418c01));_0x58d45e(_0x418c01);})[_0x215c('0x19')](function(_0x23b1db){logger[_0x215c('0x14')](_0x215c('0x29'),_0x23b1db[_0x215c('0x16')],_0x3a1c46);_0x25fd2(_0x4159a0['error'](0x1f4,_0x23b1db[_0x215c('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index ac86ad5..8581796 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 _0x008c=['./voiceQueueReport.events','save','remove','update','emit','removeListener','register','voiceQueueReport:'];(function(_0x13f2d6,_0x1cbf18){var _0x4a8b4f=function(_0x43753a){while(--_0x43753a){_0x13f2d6['push'](_0x13f2d6['shift']());}};_0x4a8b4f(++_0x1cbf18);}(_0x008c,0x188));var _0xc008=function(_0x263b1f,_0x3f2376){_0x263b1f=_0x263b1f-0x0;var _0x4aa612=_0x008c[_0x263b1f];return _0x4aa612;};'use strict';var VoiceQueueReportEvents=require(_0xc008('0x0'));var events=[_0xc008('0x1'),_0xc008('0x2'),_0xc008('0x3')];function createListener(_0x1d119a,_0x544fdf){return function(_0x3641af){_0x544fdf[_0xc008('0x4')](_0x1d119a,_0x3641af);};}function removeListener(_0x10b33c,_0x163bd9){return function(){VoiceQueueReportEvents[_0xc008('0x5')](_0x10b33c,_0x163bd9);};}exports[_0xc008('0x6')]=function(_0x13aa7){for(var _0x39bb5e=0x0,_0x9c8cb2=events['length'];_0x39bb5e<_0x9c8cb2;_0x39bb5e++){var _0x428fa9=events[_0x39bb5e];var _0x5aa09b=createListener(_0xc008('0x7')+_0x428fa9,_0x13aa7);VoiceQueueReportEvents['on'](_0x428fa9,_0x5aa09b);}}; \ No newline at end of file +var _0x4a3f=['save','remove','update','emit','register','voiceQueueReport:'];(function(_0x4e88f7,_0x3169d2){var _0x3662ec=function(_0x4b5bdf){while(--_0x4b5bdf){_0x4e88f7['push'](_0x4e88f7['shift']());}};_0x3662ec(++_0x3169d2);}(_0x4a3f,0x1b0));var _0xf4a3=function(_0x2b47ad,_0x55c7cc){_0x2b47ad=_0x2b47ad-0x0;var _0x1a2426=_0x4a3f[_0x2b47ad];return _0x1a2426;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0xf4a3('0x0'),_0xf4a3('0x1'),_0xf4a3('0x2')];function createListener(_0x37f9c9,_0x23d203){return function(_0x32c209){_0x23d203[_0xf4a3('0x3')](_0x37f9c9,_0x32c209);};}function removeListener(_0x216780,_0x435184){return function(){VoiceQueueReportEvents['removeListener'](_0x216780,_0x435184);};}exports[_0xf4a3('0x4')]=function(_0x4c8568){for(var _0x5685e4=0x0,_0x32a218=events['length'];_0x5685e4<_0x32a218;_0x5685e4++){var _0x5d3c57=events[_0x5685e4];var _0xabd77=createListener(_0xf4a3('0x5')+_0x5d3c57,_0x4c8568);VoiceQueueReportEvents['on'](_0x5d3c57,_0xabd77);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index ed84f1f..2b9dbda 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 _0x88ea=['post','create','put','update','delete','destroy','util','express','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','/:id'];(function(_0x4f0637,_0x321cde){var _0x43d41d=function(_0x4cde39){while(--_0x4cde39){_0x4f0637['push'](_0x4f0637['shift']());}};_0x43d41d(++_0x321cde);}(_0x88ea,0x110));var _0xa88e=function(_0x87bed7,_0x509ffc){_0x87bed7=_0x87bed7-0x0;var _0x57bf7d=_0x88ea[_0x87bed7];return _0x57bf7d;};'use strict';var multer=require('multer');var util=require(_0xa88e('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa88e('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa88e('0x2'));var config=require(_0xa88e('0x3'));var controller=require(_0xa88e('0x4'));router[_0xa88e('0x5')]('/',auth[_0xa88e('0x6')](),controller['index']);router[_0xa88e('0x5')](_0xa88e('0x7'),auth[_0xa88e('0x6')](),controller['show']);router[_0xa88e('0x8')]('/',auth[_0xa88e('0x6')](),controller[_0xa88e('0x9')]);router[_0xa88e('0xa')](_0xa88e('0x7'),auth['isAuthenticated'](),controller[_0xa88e('0xb')]);router[_0xa88e('0xc')](_0xa88e('0x7'),auth['isAuthenticated'](),controller[_0xa88e('0xd')]);module['exports']=router; \ No newline at end of file +var _0x7edc=['/:id','post','create','put','update','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7edc,0x7e));var _0xc7ed=function(_0x364cf8,_0x146b9b){_0x364cf8=_0x364cf8-0x0;var _0x6a59ee=_0x7edc[_0x364cf8];return _0x6a59ee;};'use strict';var multer=require(_0xc7ed('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc7ed('0x1'));var express=require(_0xc7ed('0x2'));var router=express[_0xc7ed('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc7ed('0x4'));var config=require(_0xc7ed('0x5'));var controller=require(_0xc7ed('0x6'));router[_0xc7ed('0x7')]('/',auth[_0xc7ed('0x8')](),controller[_0xc7ed('0x9')]);router[_0xc7ed('0x7')](_0xc7ed('0xa'),auth[_0xc7ed('0x8')](),controller['show']);router[_0xc7ed('0xb')]('/',auth[_0xc7ed('0x8')](),controller[_0xc7ed('0xc')]);router[_0xc7ed('0xd')](_0xc7ed('0xa'),auth['isAuthenticated'](),controller[_0xc7ed('0xe')]);router['delete'](_0xc7ed('0xa'),auth['isAuthenticated'](),controller[_0xc7ed('0xf')]);module[_0xc7ed('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 8eca98d..5ba61d8 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 _0x87b9=['sequelize','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x487a42,_0x5bebe9){var _0x4c9510=function(_0xf266d3){while(--_0xf266d3){_0x487a42['push'](_0x487a42['shift']());}};_0x4c9510(++_0x5bebe9);}(_0x87b9,0xf5));var _0x987b=function(_0x27fad0,_0x2168d6){_0x27fad0=_0x27fad0-0x0;var _0x4d373a=_0x87b9[_0x27fad0];return _0x4d373a;};'use strict';var Sequelize=require(_0x987b('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0x987b('0x1')]},'callid':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x987b('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x987b('0x2')],'allowNull':![],'defaultValue':Sequelize[_0x987b('0x3')](_0x987b('0x4'))}}; \ No newline at end of file +var _0xa2f1=['sequelize','moment','exports','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x265181,_0x50f3da){var _0x1ca6a8=function(_0x17ff3f){while(--_0x17ff3f){_0x265181['push'](_0x265181['shift']());}};_0x1ca6a8(++_0x50f3da);}(_0xa2f1,0x1ef));var _0x1a2f=function(_0x5e2b84,_0x53c1ad){_0x5e2b84=_0x5e2b84-0x0;var _0x1732e0=_0xa2f1[_0x5e2b84];return _0x1732e0;};'use strict';var Sequelize=require(_0x1a2f('0x0'));var moment=require(_0x1a2f('0x1'));module[_0x1a2f('0x2')]={'time':{'type':Sequelize[_0x1a2f('0x3')]},'callid':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x1a2f('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x1a2f('0x4'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index d26d0dc..a681b23 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 _0x4ed8=['pick','filter','VIRTUAL','options','VoiceQueuesLog','includeAll','include','rows','catch','show','params','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','end','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0x37a4d7,_0x2357c7){var _0x307048=function(_0x2c34f9){while(--_0x2c34f9){_0x37a4d7['push'](_0x37a4d7['shift']());}};_0x307048(++_0x2357c7);}(_0x4ed8,0x17c));var _0x84ed=function(_0x213cb4,_0xbe7f1){_0x213cb4=_0x213cb4-0x0;var _0x3bb951=_0x4ed8[_0x213cb4];return _0x3bb951;};'use strict';var emlformat=require(_0x84ed('0x0'));var rimraf=require(_0x84ed('0x1'));var zipdir=require(_0x84ed('0x2'));var jsonpatch=require(_0x84ed('0x3'));var rp=require(_0x84ed('0x4'));var moment=require('moment');var BPromise=require(_0x84ed('0x5'));var Mustache=require('mustache');var util=require(_0x84ed('0x6'));var path=require('path');var sox=require(_0x84ed('0x7'));var csv=require(_0x84ed('0x8'));var ejs=require(_0x84ed('0x9'));var fs=require('fs');var fs_extra=require(_0x84ed('0xa'));var _=require(_0x84ed('0xb'));var squel=require(_0x84ed('0xc'));var crypto=require('crypto');var jsforce=require(_0x84ed('0xd'));var deskjs=require(_0x84ed('0xe'));var toCsv=require(_0x84ed('0x8'));var querystring=require('querystring');var Papa=require(_0x84ed('0xf'));var Redis=require('ioredis');var authService=require(_0x84ed('0x10'));var qs=require(_0x84ed('0x11'));var as=require(_0x84ed('0x12'));var hardwareService=require(_0x84ed('0x13'));var logger=require(_0x84ed('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x84ed('0x15'));var licenseUtil=require(_0x84ed('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x390fa8,_0xc01d59){_0xc01d59=_0xc01d59||0xcc;return function(_0x59b7a4){if(_0x59b7a4){return _0x390fa8[_0x84ed('0x17')](_0xc01d59);}return _0x390fa8['status'](_0xc01d59)['end']();};}function respondWithResult(_0x4fa9ad,_0x93d700){_0x93d700=_0x93d700||0xc8;return function(_0x217708){if(_0x217708){return _0x4fa9ad[_0x84ed('0x18')](_0x93d700)[_0x84ed('0x19')](_0x217708);}};}function respondWithFilteredResult(_0x2d0e66,_0x33df6c){return function(_0x98d7f7){if(_0x98d7f7){var _0x4ff127=typeof _0x33df6c[_0x84ed('0x1a')]===_0x84ed('0x1b')&&typeof _0x33df6c[_0x84ed('0x1c')]===_0x84ed('0x1b');var _0x2f008f=_0x98d7f7['count'];var _0x290526=_0x4ff127?0x0:_0x33df6c[_0x84ed('0x1a')];var _0x789d65=_0x4ff127?_0x98d7f7[_0x84ed('0x1d')]:_0x33df6c[_0x84ed('0x1a')]+_0x33df6c[_0x84ed('0x1c')];var _0x14f398;if(_0x789d65>=_0x2f008f){_0x789d65=_0x2f008f;_0x14f398=0xc8;}else{_0x14f398=0xce;}_0x2d0e66[_0x84ed('0x18')](_0x14f398);return _0x2d0e66[_0x84ed('0x1e')](_0x84ed('0x1f'),_0x290526+'-'+_0x789d65+'/'+_0x2f008f)[_0x84ed('0x19')](_0x98d7f7);}return null;};}function patchUpdates(_0x523842){return function(_0x3f1693){try{jsonpatch[_0x84ed('0x20')](_0x3f1693,_0x523842,!![]);}catch(_0x11c0f1){return BPromise[_0x84ed('0x21')](_0x11c0f1);}return _0x3f1693['save']();};}function saveUpdates(_0x7ae13b,_0x1286b6){return function(_0x456003){if(_0x456003){return _0x456003['update'](_0x7ae13b)[_0x84ed('0x22')](function(_0x48d7a7){return _0x48d7a7;});}return null;};}function removeEntity(_0x2f4828,_0x12136a){return function(_0x1452e0){if(_0x1452e0){return _0x1452e0[_0x84ed('0x23')]()['then'](function(){_0x2f4828['status'](0xcc)[_0x84ed('0x24')]();});}};}function handleEntityNotFound(_0x202490,_0xdb8acb){return function(_0x3ab72b){if(!_0x3ab72b){_0x202490[_0x84ed('0x17')](0x194);}return _0x3ab72b;};}function handleError(_0x2c088d,_0x4860b0){_0x4860b0=_0x4860b0||0x1f4;return function(_0x481547){logger[_0x84ed('0x25')](_0x481547[_0x84ed('0x26')]);if(_0x481547[_0x84ed('0x27')]){delete _0x481547[_0x84ed('0x27')];}_0x2c088d[_0x84ed('0x18')](_0x4860b0)['send'](_0x481547);};}exports[_0x84ed('0x28')]=function(_0x29c8d8,_0xb7939f){var _0x51ffa7={},_0x335f51={},_0x5d478e={'count':0x0,'rows':[]};var _0x1e86d1=_['map'](db['VoiceQueuesLog'][_0x84ed('0x29')],function(_0x5835e6){return{'name':_0x5835e6[_0x84ed('0x2a')],'type':_0x5835e6[_0x84ed('0x2b')][_0x84ed('0x2c')]};});_0x335f51[_0x84ed('0x2d')]=_[_0x84ed('0x2e')](_0x1e86d1,'name');_0x335f51[_0x84ed('0x2f')]=_[_0x84ed('0x30')](_0x29c8d8[_0x84ed('0x2f')]);_0x335f51[_0x84ed('0x31')]=_[_0x84ed('0x32')](_0x335f51[_0x84ed('0x2d')],_0x335f51[_0x84ed('0x2f')]);_0x51ffa7[_0x84ed('0x33')]=_[_0x84ed('0x32')](_0x335f51['model'],qs[_0x84ed('0x34')](_0x29c8d8['query'][_0x84ed('0x34')]));_0x51ffa7[_0x84ed('0x33')]=_0x51ffa7[_0x84ed('0x33')][_0x84ed('0x35')]?_0x51ffa7['attributes']:_0x335f51['model'];if(!_0x29c8d8['query'][_0x84ed('0x36')]('nolimit')){_0x51ffa7[_0x84ed('0x1c')]=qs[_0x84ed('0x1c')](_0x29c8d8['query'][_0x84ed('0x1c')]);_0x51ffa7[_0x84ed('0x1a')]=qs[_0x84ed('0x1a')](_0x29c8d8[_0x84ed('0x2f')]['offset']);}_0x51ffa7[_0x84ed('0x37')]=qs[_0x84ed('0x38')](_0x29c8d8[_0x84ed('0x2f')][_0x84ed('0x38')]);_0x51ffa7[_0x84ed('0x39')]=qs[_0x84ed('0x31')](_[_0x84ed('0x3a')](_0x29c8d8['query'],_0x335f51[_0x84ed('0x31')]),_0x1e86d1);if(_0x29c8d8[_0x84ed('0x2f')][_0x84ed('0x3b')]){_0x51ffa7['where']=_['merge'](_0x51ffa7['where'],{'$or':_[_0x84ed('0x2e')](_0x1e86d1,function(_0x19ab54){if(_0x19ab54[_0x84ed('0x2b')]!==_0x84ed('0x3c')){var _0x27f988={};_0x27f988[_0x19ab54[_0x84ed('0x27')]]={'$like':'%'+_0x29c8d8['query'][_0x84ed('0x3b')]+'%'};return _0x27f988;}})});}_0x51ffa7=_['merge']({},_0x51ffa7,_0x29c8d8[_0x84ed('0x3d')]);var _0x3c6e33={'where':_0x51ffa7[_0x84ed('0x39')]};return db[_0x84ed('0x3e')]['count'](_0x3c6e33)[_0x84ed('0x22')](function(_0x54f2cf){_0x5d478e[_0x84ed('0x1d')]=_0x54f2cf;if(_0x29c8d8[_0x84ed('0x2f')][_0x84ed('0x3f')]){_0x51ffa7[_0x84ed('0x40')]=[{'all':!![]}];}return db['VoiceQueuesLog']['findAll'](_0x51ffa7);})[_0x84ed('0x22')](function(_0x4a957e){_0x5d478e[_0x84ed('0x41')]=_0x4a957e;return _0x5d478e;})[_0x84ed('0x22')](respondWithFilteredResult(_0xb7939f,_0x51ffa7))[_0x84ed('0x42')](handleError(_0xb7939f,null));};exports[_0x84ed('0x43')]=function(_0x372e43,_0x3cadc2){var _0x1b7b92={'raw':!![],'where':{'id':_0x372e43[_0x84ed('0x44')]['id']}},_0x4761e1={};_0x4761e1[_0x84ed('0x2d')]=_[_0x84ed('0x30')](db[_0x84ed('0x3e')][_0x84ed('0x29')]);_0x4761e1['query']=_[_0x84ed('0x30')](_0x372e43[_0x84ed('0x2f')]);_0x4761e1[_0x84ed('0x31')]=_['intersection'](_0x4761e1['model'],_0x4761e1['query']);_0x1b7b92[_0x84ed('0x33')]=_['intersection'](_0x4761e1[_0x84ed('0x2d')],qs[_0x84ed('0x34')](_0x372e43[_0x84ed('0x2f')][_0x84ed('0x34')]));_0x1b7b92[_0x84ed('0x33')]=_0x1b7b92['attributes']['length']?_0x1b7b92['attributes']:_0x4761e1['model'];if(_0x372e43[_0x84ed('0x2f')]['includeAll']){_0x1b7b92[_0x84ed('0x40')]=[{'all':!![]}];}_0x1b7b92=_['merge']({},_0x1b7b92,_0x372e43['options']);return db['VoiceQueuesLog'][_0x84ed('0x45')](_0x1b7b92)['then'](handleEntityNotFound(_0x3cadc2,null))[_0x84ed('0x22')](respondWithResult(_0x3cadc2,null))['catch'](handleError(_0x3cadc2,null));};exports[_0x84ed('0x46')]=function(_0x640e21,_0x342ef5){return db['VoiceQueuesLog'][_0x84ed('0x46')](_0x640e21[_0x84ed('0x47')],{})[_0x84ed('0x22')](respondWithResult(_0x342ef5,0xc9))[_0x84ed('0x42')](handleError(_0x342ef5,null));};exports[_0x84ed('0x48')]=function(_0x5a5fce,_0x605dab){if(_0x5a5fce[_0x84ed('0x47')]['id']){delete _0x5a5fce[_0x84ed('0x47')]['id'];}return db[_0x84ed('0x3e')][_0x84ed('0x45')]({'where':{'id':_0x5a5fce[_0x84ed('0x44')]['id']}})[_0x84ed('0x22')](handleEntityNotFound(_0x605dab,null))[_0x84ed('0x22')](saveUpdates(_0x5a5fce[_0x84ed('0x47')],null))['then'](respondWithResult(_0x605dab,null))['catch'](handleError(_0x605dab,null));};exports[_0x84ed('0x23')]=function(_0x4de774,_0x2bb3a8){return db[_0x84ed('0x3e')][_0x84ed('0x45')]({'where':{'id':_0x4de774['params']['id']}})[_0x84ed('0x22')](handleEntityNotFound(_0x2bb3a8,null))['then'](removeEntity(_0x2bb3a8,null))['catch'](handleError(_0x2bb3a8,null));}; \ No newline at end of file +var _0x4808=['../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x341e0f,_0x4a09d0){var _0x59555a=function(_0x4343a8){while(--_0x4343a8){_0x341e0f['push'](_0x341e0f['shift']());}};_0x59555a(++_0x4a09d0);}(_0x4808,0x1ba));var _0x8480=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x4808[_0x160c73];return _0xd9302;};'use strict';var emlformat=require(_0x8480('0x0'));var rimraf=require(_0x8480('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8480('0x2'));var rp=require(_0x8480('0x3'));var moment=require('moment');var BPromise=require(_0x8480('0x4'));var Mustache=require(_0x8480('0x5'));var util=require(_0x8480('0x6'));var path=require(_0x8480('0x7'));var sox=require(_0x8480('0x8'));var csv=require(_0x8480('0x9'));var ejs=require(_0x8480('0xa'));var fs=require('fs');var fs_extra=require(_0x8480('0xb'));var _=require(_0x8480('0xc'));var squel=require(_0x8480('0xd'));var crypto=require(_0x8480('0xe'));var jsforce=require(_0x8480('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x8480('0x9'));var querystring=require(_0x8480('0x10'));var Papa=require(_0x8480('0x11'));var Redis=require(_0x8480('0x12'));var authService=require(_0x8480('0x13'));var qs=require(_0x8480('0x14'));var as=require(_0x8480('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8480('0x16'));var utils=require(_0x8480('0x17'));var config=require(_0x8480('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x8480('0x19'))['db'];function respondWithStatusCode(_0x4c5082,_0x1d65cc){_0x1d65cc=_0x1d65cc||0xcc;return function(_0x4fc3db){if(_0x4fc3db){return _0x4c5082[_0x8480('0x1a')](_0x1d65cc);}return _0x4c5082[_0x8480('0x1b')](_0x1d65cc)[_0x8480('0x1c')]();};}function respondWithResult(_0x55a63c,_0x5c3cf8){_0x5c3cf8=_0x5c3cf8||0xc8;return function(_0x319c78){if(_0x319c78){return _0x55a63c[_0x8480('0x1b')](_0x5c3cf8)['json'](_0x319c78);}};}function respondWithFilteredResult(_0x5bc29c,_0x411a77){return function(_0x377bb3){if(_0x377bb3){var _0x5e229c=typeof _0x411a77[_0x8480('0x1d')]===_0x8480('0x1e')&&typeof _0x411a77[_0x8480('0x1f')]==='undefined';var _0x4ecf4d=_0x377bb3['count'];var _0x23961c=_0x5e229c?0x0:_0x411a77[_0x8480('0x1d')];var _0x146a11=_0x5e229c?_0x377bb3[_0x8480('0x20')]:_0x411a77['offset']+_0x411a77[_0x8480('0x1f')];var _0xfc1732;if(_0x146a11>=_0x4ecf4d){_0x146a11=_0x4ecf4d;_0xfc1732=0xc8;}else{_0xfc1732=0xce;}_0x5bc29c[_0x8480('0x1b')](_0xfc1732);return _0x5bc29c[_0x8480('0x21')](_0x8480('0x22'),_0x23961c+'-'+_0x146a11+'/'+_0x4ecf4d)['json'](_0x377bb3);}return null;};}function patchUpdates(_0x447e22){return function(_0x31affd){try{jsonpatch[_0x8480('0x23')](_0x31affd,_0x447e22,!![]);}catch(_0x351d22){return BPromise[_0x8480('0x24')](_0x351d22);}return _0x31affd[_0x8480('0x25')]();};}function saveUpdates(_0x4fc48e,_0xb9f202){return function(_0x1c9994){if(_0x1c9994){return _0x1c9994[_0x8480('0x26')](_0x4fc48e)[_0x8480('0x27')](function(_0x5a65bf){return _0x5a65bf;});}return null;};}function removeEntity(_0x3d0f85,_0x239cd8){return function(_0x1a4846){if(_0x1a4846){return _0x1a4846[_0x8480('0x28')]()[_0x8480('0x27')](function(){_0x3d0f85[_0x8480('0x1b')](0xcc)[_0x8480('0x1c')]();});}};}function handleEntityNotFound(_0x2a7ee1,_0x4c7cb1){return function(_0x554525){if(!_0x554525){_0x2a7ee1['sendStatus'](0x194);}return _0x554525;};}function handleError(_0x2ba755,_0x5caf69){_0x5caf69=_0x5caf69||0x1f4;return function(_0x22307c){logger['error'](_0x22307c[_0x8480('0x29')]);if(_0x22307c[_0x8480('0x2a')]){delete _0x22307c['name'];}_0x2ba755[_0x8480('0x1b')](_0x5caf69)[_0x8480('0x2b')](_0x22307c);};}exports[_0x8480('0x2c')]=function(_0x238133,_0x129b40){var _0x55a308={},_0x3792bc={},_0x2278f1={'count':0x0,'rows':[]};var _0x422593=_[_0x8480('0x2d')](db[_0x8480('0x2e')][_0x8480('0x2f')],function(_0xe8da6c){return{'name':_0xe8da6c[_0x8480('0x30')],'type':_0xe8da6c['type'][_0x8480('0x31')]};});_0x3792bc[_0x8480('0x32')]=_[_0x8480('0x2d')](_0x422593,'name');_0x3792bc[_0x8480('0x33')]=_['keys'](_0x238133[_0x8480('0x33')]);_0x3792bc[_0x8480('0x34')]=_['intersection'](_0x3792bc[_0x8480('0x32')],_0x3792bc[_0x8480('0x33')]);_0x55a308[_0x8480('0x35')]=_[_0x8480('0x36')](_0x3792bc[_0x8480('0x32')],qs[_0x8480('0x37')](_0x238133[_0x8480('0x33')][_0x8480('0x37')]));_0x55a308[_0x8480('0x35')]=_0x55a308[_0x8480('0x35')][_0x8480('0x38')]?_0x55a308[_0x8480('0x35')]:_0x3792bc[_0x8480('0x32')];if(!_0x238133['query'][_0x8480('0x39')]('nolimit')){_0x55a308[_0x8480('0x1f')]=qs[_0x8480('0x1f')](_0x238133[_0x8480('0x33')][_0x8480('0x1f')]);_0x55a308[_0x8480('0x1d')]=qs[_0x8480('0x1d')](_0x238133[_0x8480('0x33')][_0x8480('0x1d')]);}_0x55a308[_0x8480('0x3a')]=qs['sort'](_0x238133[_0x8480('0x33')]['sort']);_0x55a308[_0x8480('0x3b')]=qs['filters'](_[_0x8480('0x3c')](_0x238133[_0x8480('0x33')],_0x3792bc[_0x8480('0x34')]),_0x422593);if(_0x238133[_0x8480('0x33')]['filter']){_0x55a308[_0x8480('0x3b')]=_[_0x8480('0x3d')](_0x55a308[_0x8480('0x3b')],{'$or':_[_0x8480('0x2d')](_0x422593,function(_0x4271aa){if(_0x4271aa[_0x8480('0x3e')]!==_0x8480('0x3f')){var _0x27320f={};_0x27320f[_0x4271aa['name']]={'$like':'%'+_0x238133[_0x8480('0x33')][_0x8480('0x40')]+'%'};return _0x27320f;}})});}_0x55a308=_[_0x8480('0x3d')]({},_0x55a308,_0x238133[_0x8480('0x41')]);var _0x4c84f1={'where':_0x55a308['where']};return db[_0x8480('0x2e')]['count'](_0x4c84f1)[_0x8480('0x27')](function(_0x2e4b41){_0x2278f1['count']=_0x2e4b41;if(_0x238133[_0x8480('0x33')][_0x8480('0x42')]){_0x55a308[_0x8480('0x43')]=[{'all':!![]}];}return db[_0x8480('0x2e')][_0x8480('0x44')](_0x55a308);})[_0x8480('0x27')](function(_0x7ac8de){_0x2278f1[_0x8480('0x45')]=_0x7ac8de;return _0x2278f1;})[_0x8480('0x27')](respondWithFilteredResult(_0x129b40,_0x55a308))[_0x8480('0x46')](handleError(_0x129b40,null));};exports[_0x8480('0x47')]=function(_0x3cfb50,_0x5e795e){var _0x3820a0={'raw':!![],'where':{'id':_0x3cfb50[_0x8480('0x48')]['id']}},_0x59e946={};_0x59e946[_0x8480('0x32')]=_[_0x8480('0x49')](db['VoiceQueuesLog'][_0x8480('0x2f')]);_0x59e946[_0x8480('0x33')]=_[_0x8480('0x49')](_0x3cfb50[_0x8480('0x33')]);_0x59e946[_0x8480('0x34')]=_[_0x8480('0x36')](_0x59e946['model'],_0x59e946[_0x8480('0x33')]);_0x3820a0[_0x8480('0x35')]=_[_0x8480('0x36')](_0x59e946[_0x8480('0x32')],qs[_0x8480('0x37')](_0x3cfb50[_0x8480('0x33')][_0x8480('0x37')]));_0x3820a0[_0x8480('0x35')]=_0x3820a0[_0x8480('0x35')][_0x8480('0x38')]?_0x3820a0[_0x8480('0x35')]:_0x59e946['model'];if(_0x3cfb50[_0x8480('0x33')]['includeAll']){_0x3820a0[_0x8480('0x43')]=[{'all':!![]}];}_0x3820a0=_[_0x8480('0x3d')]({},_0x3820a0,_0x3cfb50['options']);return db['VoiceQueuesLog'][_0x8480('0x4a')](_0x3820a0)[_0x8480('0x27')](handleEntityNotFound(_0x5e795e,null))[_0x8480('0x27')](respondWithResult(_0x5e795e,null))['catch'](handleError(_0x5e795e,null));};exports[_0x8480('0x4b')]=function(_0x4e74e7,_0xdeebd2){return db['VoiceQueuesLog'][_0x8480('0x4b')](_0x4e74e7[_0x8480('0x4c')],{})[_0x8480('0x27')](respondWithResult(_0xdeebd2,0xc9))['catch'](handleError(_0xdeebd2,null));};exports['update']=function(_0x19a42,_0x280f80){if(_0x19a42[_0x8480('0x4c')]['id']){delete _0x19a42[_0x8480('0x4c')]['id'];}return db[_0x8480('0x2e')][_0x8480('0x4a')]({'where':{'id':_0x19a42[_0x8480('0x48')]['id']}})[_0x8480('0x27')](handleEntityNotFound(_0x280f80,null))[_0x8480('0x27')](saveUpdates(_0x19a42['body'],null))['then'](respondWithResult(_0x280f80,null))[_0x8480('0x46')](handleError(_0x280f80,null));};exports[_0x8480('0x28')]=function(_0x57fc26,_0x4c2f15){return db[_0x8480('0x2e')]['find']({'where':{'id':_0x57fc26[_0x8480('0x48')]['id']}})[_0x8480('0x27')](handleEntityNotFound(_0x4c2f15,null))['then'](removeEntity(_0x4c2f15,null))[_0x8480('0x46')](handleError(_0x4c2f15,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index d51884a..52233c1 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 _0x34c6=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash'];(function(_0x185ef5,_0x2589c9){var _0x34e906=function(_0x1b30ee){while(--_0x1b30ee){_0x185ef5['push'](_0x185ef5['shift']());}};_0x34e906(++_0x2589c9);}(_0x34c6,0x1cd));var _0x634c=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x34c6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x634c('0x0'));var util=require('util');var logger=require(_0x634c('0x1'))(_0x634c('0x2'));var moment=require(_0x634c('0x3'));var BPromise=require(_0x634c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x634c('0x5'));var config=require(_0x634c('0x6'));var attributes=require(_0x634c('0x7'));module['exports']=function(_0x2aab37,_0x550409){return _0x2aab37[_0x634c('0x8')](_0x634c('0x9'),attributes,{'tableName':_0x634c('0xa'),'paranoid':![],'indexes':[{'name':_0x634c('0xb'),'fields':[_0x634c('0xc'),_0x634c('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0xb162=['../../config/environment','./voiceQueuesLog.attributes','exports','voice_queues_log','event_dtm','event','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3adbc2,_0x528bf8){var _0x25d4a4=function(_0x215f8b){while(--_0x215f8b){_0x3adbc2['push'](_0x3adbc2['shift']());}};_0x25d4a4(++_0x528bf8);}(_0xb162,0x110));var _0x2b16=function(_0xb63d45,_0x23cee8){_0xb63d45=_0xb63d45-0x0;var _0x5ebbc1=_0xb162[_0xb63d45];return _0x5ebbc1;};'use strict';var _=require(_0x2b16('0x0'));var util=require(_0x2b16('0x1'));var logger=require('../../config/logger')(_0x2b16('0x2'));var moment=require(_0x2b16('0x3'));var BPromise=require(_0x2b16('0x4'));var rp=require(_0x2b16('0x5'));var fs=require('fs');var path=require(_0x2b16('0x6'));var rimraf=require(_0x2b16('0x7'));var config=require(_0x2b16('0x8'));var attributes=require(_0x2b16('0x9'));module[_0x2b16('0xa')]=function(_0x57cb92,_0x260c7b){return _0x57cb92['define']('VoiceQueuesLog',attributes,{'tableName':_0x2b16('0xb'),'paranoid':![],'indexes':[{'name':_0x2b16('0xc'),'fields':[_0x2b16('0xd'),'dtm']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 664eb0c..9f0562c 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 _0x2f14=['http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x35c324,_0x1d544f){var _0x11e905=function(_0x4d1956){while(--_0x4d1956){_0x35c324['push'](_0x35c324['shift']());}};_0x11e905(++_0x1d544f);}(_0x2f14,0x199));var _0x42f1=function(_0x53b19b,_0x5b8e4e){_0x53b19b=_0x53b19b-0x0;var _0x34ab5d=_0x2f14[_0x53b19b];return _0x34ab5d;};'use strict';var _=require('lodash');var util=require(_0x42f1('0x0'));var moment=require(_0x42f1('0x1'));var BPromise=require('bluebird');var rs=require(_0x42f1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42f1('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x42f1('0x4'))(_0x42f1('0x5'));var config=require(_0x42f1('0x6'));var jayson=require(_0x42f1('0x7'));var client=jayson[_0x42f1('0x8')][_0x42f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x230d3b,_0x1b0c67,_0x28748c){return new BPromise(function(_0x516359,_0x2a77a6){return client[_0x42f1('0xa')](_0x230d3b,_0x28748c)[_0x42f1('0xb')](function(_0x34bd74){logger[_0x42f1('0xc')](_0x42f1('0xd'),_0x1b0c67,'request\x20sent');logger[_0x42f1('0xe')](_0x42f1('0xf'),_0x1b0c67,_0x42f1('0x10'),JSON[_0x42f1('0x11')](_0x34bd74));if(_0x34bd74[_0x42f1('0x12')]){if(_0x34bd74[_0x42f1('0x12')][_0x42f1('0x13')]===0x1f4){logger['error'](_0x42f1('0xd'),_0x1b0c67,_0x34bd74['error'][_0x42f1('0x14')]);return _0x2a77a6(_0x34bd74['error']['message']);}logger['error'](_0x42f1('0xd'),_0x1b0c67,_0x34bd74[_0x42f1('0x12')]['message']);return _0x516359(_0x34bd74[_0x42f1('0x12')]['message']);}else{logger[_0x42f1('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x1b0c67,_0x42f1('0x10'));_0x516359(_0x34bd74['result'][_0x42f1('0x14')]);}})[_0x42f1('0x15')](function(_0x3e2606){logger['error'](_0x42f1('0xd'),_0x1b0c67,_0x3e2606);_0x2a77a6(_0x3e2606);});});} \ No newline at end of file +var _0xeffd=['stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s'];(function(_0x3a448a,_0x3c6934){var _0x4648a9=function(_0x109278){while(--_0x109278){_0x3a448a['push'](_0x3a448a['shift']());}};_0x4648a9(++_0x3c6934);}(_0xeffd,0x6b));var _0xdeff=function(_0x39930a,_0x411a9a){_0x39930a=_0x39930a-0x0;var _0x166bb2=_0xeffd[_0x39930a];return _0x166bb2;};'use strict';var _=require(_0xdeff('0x0'));var util=require('util');var moment=require(_0xdeff('0x1'));var BPromise=require(_0xdeff('0x2'));var rs=require(_0xdeff('0x3'));var fs=require('fs');var Redis=require(_0xdeff('0x4'));var db=require(_0xdeff('0x5'))['db'];var utils=require(_0xdeff('0x6'));var logger=require(_0xdeff('0x7'))(_0xdeff('0x8'));var config=require(_0xdeff('0x9'));var jayson=require(_0xdeff('0xa'));var client=jayson[_0xdeff('0xb')][_0xdeff('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x281ad7,_0x256323,_0x39878e){return new BPromise(function(_0x12e953,_0x24897a){return client['request'](_0x281ad7,_0x39878e)[_0xdeff('0xd')](function(_0x45a8a6){logger[_0xdeff('0xe')]('VoiceQueuesLog,\x20%s,\x20%s',_0x256323,_0xdeff('0xf'));logger[_0xdeff('0x10')](_0xdeff('0x11'),_0x256323,_0xdeff('0xf'),JSON[_0xdeff('0x12')](_0x45a8a6));if(_0x45a8a6[_0xdeff('0x13')]){if(_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x14')]===0x1f4){logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')]['message']);return _0x24897a(_0x45a8a6[_0xdeff('0x13')]['message']);}logger['error'](_0xdeff('0x15'),_0x256323,_0x45a8a6[_0xdeff('0x13')][_0xdeff('0x16')]);return _0x12e953(_0x45a8a6[_0xdeff('0x13')]['message']);}else{logger[_0xdeff('0xe')](_0xdeff('0x15'),_0x256323,_0xdeff('0xf'));_0x12e953(_0x45a8a6[_0xdeff('0x17')][_0xdeff('0x16')]);}})[_0xdeff('0x18')](function(_0x577244){logger['error'](_0xdeff('0x15'),_0x256323,_0x577244);_0x24897a(_0x577244);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index a119459..261c5d2 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 _0x81f5=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','index','get','/describe','show','/:id/download','download','/:id/downloads','downloadTranscribe','create','post','/:id/transcribe','runTranscribe','/:id','update'];(function(_0x3edadf,_0x29b0cb){var _0x38094b=function(_0x10e9fd){while(--_0x10e9fd){_0x3edadf['push'](_0x3edadf['shift']());}};_0x38094b(++_0x29b0cb);}(_0x81f5,0x9e));var _0x581f=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x81f5[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x581f('0x0'));var util=require(_0x581f('0x1'));var path=require(_0x581f('0x2'));var timeout=require(_0x581f('0x3'));var express=require(_0x581f('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x581f('0x5'));var interaction=require(_0x581f('0x6'));var config=require(_0x581f('0x7'));var controller=require(_0x581f('0x8'));router['get']('/',auth[_0x581f('0x9')](),controller[_0x581f('0xa')]);router[_0x581f('0xb')](_0x581f('0xc'),auth[_0x581f('0x9')](),controller['describe']);router[_0x581f('0xb')]('/:id',auth[_0x581f('0x9')](),controller[_0x581f('0xd')]);router[_0x581f('0xb')](_0x581f('0xe'),auth[_0x581f('0x9')](),controller[_0x581f('0xf')]);router[_0x581f('0xb')](_0x581f('0x10'),controller['downloads']);router[_0x581f('0xb')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x581f('0x11')]);router['post']('/',auth[_0x581f('0x9')](),controller[_0x581f('0x12')]);router[_0x581f('0x13')](_0x581f('0x14'),auth[_0x581f('0x9')](),controller[_0x581f('0x15')]);router['put'](_0x581f('0x16'),auth[_0x581f('0x9')](),controller[_0x581f('0x17')]);router['delete'](_0x581f('0x16'),auth['isAuthenticated'](),controller[_0x581f('0x18')]);module[_0x581f('0x19')]=router; \ No newline at end of file +var _0x2021=['Router','fs-extra','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/download','/:id/downloads','/:id/transcribe','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x1526e1,_0x5ed5a5){var _0x249a1e=function(_0x4a7c12){while(--_0x4a7c12){_0x1526e1['push'](_0x1526e1['shift']());}};_0x249a1e(++_0x5ed5a5);}(_0x2021,0x173));var _0x1202=function(_0x3b7f2d,_0x328b55){_0x3b7f2d=_0x3b7f2d-0x0;var _0x2b307b=_0x2021[_0x3b7f2d];return _0x2b307b;};'use strict';var multer=require(_0x1202('0x0'));var util=require('util');var path=require(_0x1202('0x1'));var timeout=require(_0x1202('0x2'));var express=require(_0x1202('0x3'));var router=express[_0x1202('0x4')]();var fs_extra=require(_0x1202('0x5'));var auth=require(_0x1202('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1202('0x7'));var controller=require(_0x1202('0x8'));router[_0x1202('0x9')]('/',auth['isAuthenticated'](),controller[_0x1202('0xa')]);router[_0x1202('0x9')](_0x1202('0xb'),auth[_0x1202('0xc')](),controller[_0x1202('0xd')]);router[_0x1202('0x9')](_0x1202('0xe'),auth[_0x1202('0xc')](),controller['show']);router[_0x1202('0x9')](_0x1202('0xf'),auth[_0x1202('0xc')](),controller['download']);router[_0x1202('0x9')](_0x1202('0x10'),controller['downloads']);router['get'](_0x1202('0x11'),auth[_0x1202('0xc')](),controller['downloadTranscribe']);router[_0x1202('0x12')]('/',auth['isAuthenticated'](),controller[_0x1202('0x13')]);router['post'](_0x1202('0x11'),auth['isAuthenticated'](),controller['runTranscribe']);router[_0x1202('0x14')](_0x1202('0xe'),auth[_0x1202('0xc')](),controller[_0x1202('0x15')]);router[_0x1202('0x16')](_0x1202('0xe'),auth[_0x1202('0xc')](),controller[_0x1202('0x17')]);module[_0x1202('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 3f66de3..96a23b1 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(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_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 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(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 ff1d4c7..bbf98e7 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 _0x3a08=['status','end','json','offset','limit','undefined','count','set','reject','update','then','destroy','error','name','send','index','map','VoiceRecording','rawAttributes','fieldName','type','key','format','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows','find','catch','body','params','describe','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','VoiceRecording\x20not\x20found','filename','extname','unlink','download','Not\x20found','sequelize','col','token','$and','push','decryptFile','ValidationError','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','language','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','downloadTranscribe','fileText','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','moment','path','to-csv','fs-extra','squel','crypto','jsforce','papaparse','aws-sdk','uuid/v4','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x2777df,_0x5e764f){var _0x51e04d=function(_0x1843e0){while(--_0x1843e0){_0x2777df['push'](_0x2777df['shift']());}};_0x51e04d(++_0x5e764f);}(_0x3a08,0x7a));var _0x83a0=function(_0x8be80e,_0x500faa){_0x8be80e=_0x8be80e-0x0;var _0x11e04b=_0x3a08[_0x8be80e];return _0x11e04b;};'use strict';var emlformat=require(_0x83a0('0x0'));var rimraf=require(_0x83a0('0x1'));var zipdir=require(_0x83a0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x83a0('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x83a0('0x4'));var sox=require('sox');var csv=require(_0x83a0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x83a0('0x6'));var _=require('lodash');var squel=require(_0x83a0('0x7'));var crypto=require(_0x83a0('0x8'));var jsforce=require(_0x83a0('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x83a0('0xa'));var AWS=require(_0x83a0('0xb'));var uuidv4=require(_0x83a0('0xc'));var Redis=require(_0x83a0('0xd'));var authService=require(_0x83a0('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83a0('0xf'));var logger=require(_0x83a0('0x10'))(_0x83a0('0x11'));var utils=require('../../config/utils');var config=require(_0x83a0('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x83a0('0x13'))['db'];function respondWithStatusCode(_0x1e8814,_0x136def){_0x136def=_0x136def||0xcc;return function(_0x1c8182){if(_0x1c8182){return _0x1e8814[_0x83a0('0x14')](_0x136def);}return _0x1e8814[_0x83a0('0x15')](_0x136def)[_0x83a0('0x16')]();};}function respondWithResult(_0x1f6a0d,_0x290fed){_0x290fed=_0x290fed||0xc8;return function(_0x3eb40b){if(_0x3eb40b){return _0x1f6a0d[_0x83a0('0x15')](_0x290fed)[_0x83a0('0x17')](_0x3eb40b);}};}function respondWithFilteredResult(_0x185f1e,_0x1eb4c7){return function(_0x4d9e23){if(_0x4d9e23){var _0x3cb708=typeof _0x1eb4c7[_0x83a0('0x18')]==='undefined'&&typeof _0x1eb4c7[_0x83a0('0x19')]===_0x83a0('0x1a');var _0x4f62c6=_0x4d9e23[_0x83a0('0x1b')];var _0x107fe0=_0x3cb708?0x0:_0x1eb4c7[_0x83a0('0x18')];var _0xda80ce=_0x3cb708?_0x4d9e23['count']:_0x1eb4c7['offset']+_0x1eb4c7[_0x83a0('0x19')];var _0x300a5a;if(_0xda80ce>=_0x4f62c6){_0xda80ce=_0x4f62c6;_0x300a5a=0xc8;}else{_0x300a5a=0xce;}_0x185f1e[_0x83a0('0x15')](_0x300a5a);return _0x185f1e[_0x83a0('0x1c')]('Content-Range',_0x107fe0+'-'+_0xda80ce+'/'+_0x4f62c6)[_0x83a0('0x17')](_0x4d9e23);}return null;};}function patchUpdates(_0x2d3332){return function(_0x58d198){try{jsonpatch['apply'](_0x58d198,_0x2d3332,!![]);}catch(_0x3b5e23){return BPromise[_0x83a0('0x1d')](_0x3b5e23);}return _0x58d198['save']();};}function saveUpdates(_0x2eb5a0,_0x659e5b){return function(_0x3fba32){if(_0x3fba32){return _0x3fba32[_0x83a0('0x1e')](_0x2eb5a0)[_0x83a0('0x1f')](function(_0x4cb518){return _0x4cb518;});}return null;};}function removeEntity(_0x157e1e,_0x59f736){return function(_0x4146cf){if(_0x4146cf){return _0x4146cf[_0x83a0('0x20')]()[_0x83a0('0x1f')](function(){_0x157e1e[_0x83a0('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15d22e,_0x59c7c8){return function(_0x4df556){if(!_0x4df556){_0x15d22e[_0x83a0('0x14')](0x194);}return _0x4df556;};}function handleError(_0x159b3b,_0x4be20e){_0x4be20e=_0x4be20e||0x1f4;return function(_0x5b746e){logger[_0x83a0('0x21')](_0x5b746e['stack']);if(_0x5b746e[_0x83a0('0x22')]){delete _0x5b746e[_0x83a0('0x22')];}_0x159b3b[_0x83a0('0x15')](_0x4be20e)[_0x83a0('0x23')](_0x5b746e);};}exports[_0x83a0('0x24')]=function(_0xc0ab6f,_0x3958a4){var _0x2a8b0b={},_0x2ef6e5={},_0x111428={'count':0x0,'rows':[]};var _0x3c2cfa=_[_0x83a0('0x25')](db[_0x83a0('0x26')][_0x83a0('0x27')],function(_0x2d1f27){return{'name':_0x2d1f27[_0x83a0('0x28')],'type':_0x2d1f27[_0x83a0('0x29')][_0x83a0('0x2a')]};});_0x2ef6e5['model']=_['differenceBy'](_[_0x83a0('0x25')](_0x3c2cfa,_0x83a0('0x22')),[_0x83a0('0x2b')]);_0x2ef6e5['query']=_[_0x83a0('0x2c')](_0xc0ab6f['query']);_0x2ef6e5[_0x83a0('0x2d')]=_[_0x83a0('0x2e')](_0x2ef6e5[_0x83a0('0x2f')],_0x2ef6e5[_0x83a0('0x30')]);_0x2a8b0b[_0x83a0('0x31')]=_[_0x83a0('0x2e')](_0x2ef6e5[_0x83a0('0x2f')],qs[_0x83a0('0x32')](_0xc0ab6f[_0x83a0('0x30')][_0x83a0('0x32')]));_0x2a8b0b[_0x83a0('0x31')]=_0x2a8b0b[_0x83a0('0x31')][_0x83a0('0x33')]?_0x2a8b0b['attributes']:_0x2ef6e5[_0x83a0('0x2f')];if(!_0xc0ab6f['query']['hasOwnProperty'](_0x83a0('0x34'))){_0x2a8b0b[_0x83a0('0x19')]=qs['limit'](_0xc0ab6f['query'][_0x83a0('0x19')]);_0x2a8b0b['offset']=qs[_0x83a0('0x18')](_0xc0ab6f[_0x83a0('0x30')]['offset']);}_0x2a8b0b[_0x83a0('0x35')]=qs[_0x83a0('0x36')](_0xc0ab6f[_0x83a0('0x30')]['sort']);_0x2a8b0b['where']=qs[_0x83a0('0x2d')](_[_0x83a0('0x37')](_0xc0ab6f[_0x83a0('0x30')],_0x2ef6e5[_0x83a0('0x2d')]),_0x3c2cfa);if(_0xc0ab6f[_0x83a0('0x30')][_0x83a0('0x38')]){_0x2a8b0b[_0x83a0('0x39')]=_[_0x83a0('0x3a')](_0x2a8b0b['where'],{'$or':_[_0x83a0('0x25')](_0x3c2cfa,function(_0x4acb47){if(_0x4acb47['type']!==_0x83a0('0x3b')){var _0x4a52ee={};_0x4a52ee[_0x4acb47[_0x83a0('0x22')]]={'$like':'%'+_0xc0ab6f[_0x83a0('0x30')]['filter']+'%'};return _0x4a52ee;}})});}_0x2a8b0b=_[_0x83a0('0x3a')]({},_0x2a8b0b,_0xc0ab6f[_0x83a0('0x3c')]);var _0x5dac35={'where':_0x2a8b0b[_0x83a0('0x39')]};return db[_0x83a0('0x26')][_0x83a0('0x1b')](_0x5dac35)['then'](function(_0xa0186b){_0x111428[_0x83a0('0x1b')]=_0xa0186b;if(_0xc0ab6f[_0x83a0('0x30')][_0x83a0('0x3d')]){_0x2a8b0b[_0x83a0('0x3e')]=[{'all':!![]}];}return db[_0x83a0('0x26')]['findAll'](_0x2a8b0b);})['then'](function(_0x11068d){_0x111428[_0x83a0('0x3f')]=_0x11068d;return _0x111428;})['then'](respondWithFilteredResult(_0x3958a4,_0x2a8b0b))['catch'](handleError(_0x3958a4,null));};exports['show']=function(_0x511083,_0x12f605){var _0x55555f={'raw':![],'where':{'id':_0x511083['params']['id']}},_0x14882f={};_0x14882f[_0x83a0('0x2f')]=_[_0x83a0('0x2c')](db[_0x83a0('0x26')][_0x83a0('0x27')]);_0x14882f[_0x83a0('0x30')]=_[_0x83a0('0x2c')](_0x511083['query']);_0x14882f[_0x83a0('0x2d')]=_['intersection'](_0x14882f['model'],_0x14882f[_0x83a0('0x30')]);_0x55555f[_0x83a0('0x31')]=_['intersection'](_0x14882f['model'],qs[_0x83a0('0x32')](_0x511083['query'][_0x83a0('0x32')]));_0x55555f[_0x83a0('0x31')]=_0x55555f[_0x83a0('0x31')]['length']?_0x55555f[_0x83a0('0x31')]:_0x14882f[_0x83a0('0x2f')];if(_0x511083[_0x83a0('0x30')]['includeAll']){_0x55555f[_0x83a0('0x3e')]=[{'all':!![]}];}_0x55555f=_['merge']({},_0x55555f,_0x511083[_0x83a0('0x3c')]);return db[_0x83a0('0x26')][_0x83a0('0x40')](_0x55555f)['then'](handleEntityNotFound(_0x12f605,null))[_0x83a0('0x1f')](respondWithResult(_0x12f605,null))[_0x83a0('0x41')](handleError(_0x12f605,null));};exports['create']=function(_0x35666b,_0x1dc2d5){return db[_0x83a0('0x26')]['create'](_0x35666b[_0x83a0('0x42')],{})[_0x83a0('0x1f')](respondWithResult(_0x1dc2d5,0xc9))[_0x83a0('0x41')](handleError(_0x1dc2d5,null));};exports['update']=function(_0x4c3565,_0x12abdf){if(_0x4c3565['body']['id']){delete _0x4c3565[_0x83a0('0x42')]['id'];}return db['VoiceRecording'][_0x83a0('0x40')]({'where':{'id':_0x4c3565[_0x83a0('0x43')]['id']}})[_0x83a0('0x1f')](handleEntityNotFound(_0x12abdf,null))[_0x83a0('0x1f')](saveUpdates(_0x4c3565[_0x83a0('0x42')],null))[_0x83a0('0x1f')](respondWithResult(_0x12abdf,null))['catch'](handleError(_0x12abdf,null));};exports[_0x83a0('0x44')]=function(_0x2e39ba,_0x10f4e7){return db['VoiceRecording'][_0x83a0('0x44')]()[_0x83a0('0x1f')](respondWithResult(_0x10f4e7,null))[_0x83a0('0x41')](handleError(_0x10f4e7,null));};exports['download']=function(_0x227eb8,_0x5a02d4,_0xf6de87){var _0x5cd9ab=require(_0x83a0('0x45'));var _0x4b5104=![];var _0xf239fd={};if(_0x227eb8[_0x83a0('0x30')]['type']&&_0x227eb8[_0x83a0('0x30')][_0x83a0('0x29')]===_0x83a0('0x46')){_0xf239fd[_0x83a0('0x46')]=_0x227eb8[_0x83a0('0x43')]['id'];}else{_0xf239fd['id']=_0x227eb8['params']['id'];}return db['VoiceRecording'][_0x83a0('0x40')]({'where':_0xf239fd,'attributes':['id','value'],'raw':!![]})[_0x83a0('0x1f')](handleEntityNotFound(_0x5a02d4,null))[_0x83a0('0x1f')](function(_0x46f876){if(_0x46f876){var _0x291b1c=_0x46f876[_0x83a0('0x47')];var _0x13b8d7=util['format'](_0x83a0('0x48'),_0x291b1c);if(fs[_0x83a0('0x49')](_0x13b8d7)){_0x4b5104=!![];return _0x5cd9ab['decryptFile'](_0x13b8d7,_0x291b1c,config[_0x83a0('0x4a')][_0x83a0('0x4b')])['then'](function(){return _0x46f876;});}return _0x46f876;}})[_0x83a0('0x1f')](function(_0x311c2c){if(_0x311c2c){var _0xfac7d5=_0x311c2c['value'];if(!fs['existsSync'](_0xfac7d5)){throw new db[(_0x83a0('0x4c'))]['ValidationError'](_0x83a0('0x4d'));}if(_0x311c2c['filename']){return _0x5a02d4['download'](_0xfac7d5,_0x311c2c[_0x83a0('0x4e')]+path[_0x83a0('0x4f')](_0xfac7d5),function(){if(_0x4b5104){fs[_0x83a0('0x50')](_0xfac7d5);}});}else{return _0x5a02d4[_0x83a0('0x51')](_0xfac7d5,function(_0xab8f39){if(_0x4b5104){fs[_0x83a0('0x50')](_0xfac7d5);}});}}})[_0x83a0('0x41')](function(_0x513d78){if(_0x513d78['message']===_0x83a0('0x4d')){_0x5a02d4[_0x83a0('0x15')](0x194)[_0x83a0('0x23')](_0x83a0('0x52'));}else{return handleError(_0x5a02d4,null);}});};exports['downloads']=function(_0x4f2fb7,_0x51fdec,_0x1cb95d){var _0x192436=require(_0x83a0('0x45'));var _0x335a71=![];var _0x14a37d={'$and':[db[_0x83a0('0x53')][_0x83a0('0x39')](db[_0x83a0('0x53')]['fn']('MD5',db[_0x83a0('0x53')][_0x83a0('0x54')]('uniqueid')),_0x4f2fb7['query'][_0x83a0('0x55')])]};if(_0x4f2fb7[_0x83a0('0x30')][_0x83a0('0x29')]&&_0x4f2fb7[_0x83a0('0x30')][_0x83a0('0x29')]===_0x83a0('0x46')){_0x14a37d[_0x83a0('0x56')][_0x83a0('0x57')]({'uniqueid':_0x4f2fb7[_0x83a0('0x43')]['id']});}else{_0x14a37d[_0x83a0('0x56')][_0x83a0('0x57')]({'id':_0x4f2fb7[_0x83a0('0x43')]['id']});}return db[_0x83a0('0x26')]['find']({'where':_0x14a37d,'attributes':['id',_0x83a0('0x47')],'raw':!![]})[_0x83a0('0x1f')](handleEntityNotFound(_0x51fdec,null))['then'](function(_0x5b78d5){if(_0x5b78d5){var _0x2f0195=util['format'](_0x83a0('0x48'),_0x5b78d5[_0x83a0('0x47')]);if(fs[_0x83a0('0x49')](_0x2f0195)){_0x335a71=!![];return _0x192436[_0x83a0('0x58')](_0x2f0195,_0x5b78d5[_0x83a0('0x47')],config[_0x83a0('0x4a')][_0x83a0('0x4b')])[_0x83a0('0x1f')](function(){return _0x5b78d5;});}return _0x5b78d5;}})[_0x83a0('0x1f')](function(_0xb157e3){if(_0xb157e3){if(!fs[_0x83a0('0x49')](_0xb157e3[_0x83a0('0x47')])){throw new db[(_0x83a0('0x4c'))][(_0x83a0('0x59'))](_0x83a0('0x4d'));}if(_0xb157e3[_0x83a0('0x4e')]){return _0x51fdec[_0x83a0('0x51')](_0xb157e3[_0x83a0('0x47')],_0xb157e3[_0x83a0('0x4e')]+path[_0x83a0('0x4f')](_0xb157e3[_0x83a0('0x47')]),function(){if(_0x335a71){fs[_0x83a0('0x50')](_0xb157e3['value']);}});}else{return _0x51fdec[_0x83a0('0x51')](_0xb157e3['value'],function(_0x2fba78){if(_0x335a71){fs[_0x83a0('0x50')](_0xb157e3[_0x83a0('0x47')]);}});}}})[_0x83a0('0x41')](handleError(_0x51fdec,null));};exports[_0x83a0('0x20')]=function(_0x391e43,_0x2abb3e){return db[_0x83a0('0x26')][_0x83a0('0x40')]({'where':{'id':_0x391e43[_0x83a0('0x43')]['id']}})[_0x83a0('0x1f')](function(_0x2da7b4){if(_[_0x83a0('0x5a')](_0x2da7b4)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2da7b4;})['then'](function(_0x12f6d6){var _0xbf2fd8=_0x12f6d6['value'];logger[_0x83a0('0x5b')](_0x83a0('0x5c'),_0xbf2fd8);if(!_[_0x83a0('0x5a')](_0x12f6d6[_0x83a0('0x47')])&&fs[_0x83a0('0x49')](_0xbf2fd8)){logger[_0x83a0('0x5b')](_0x83a0('0x5d')+_0xbf2fd8+_0x83a0('0x5e'));fs[_0x83a0('0x5f')](_0xbf2fd8);}_0xbf2fd8=_0xbf2fd8+_0x83a0('0x60');if(!_[_0x83a0('0x5a')](_0x12f6d6[_0x83a0('0x47')])&&fs[_0x83a0('0x49')](_0xbf2fd8)){logger[_0x83a0('0x5b')]('File:\x20\x22'+_0xbf2fd8+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0xbf2fd8);}return _0x12f6d6;})[_0x83a0('0x1f')](function(_0x6ca1d5){if(!_0x6ca1d5)throw new InternalError();return _0x6ca1d5[_0x83a0('0x20')]();})[_0x83a0('0x1f')](function(){_0x2abb3e[_0x83a0('0x15')](0xcc)[_0x83a0('0x16')]();})[_0x83a0('0x41')](handleError(_0x2abb3e,null));};function getBucketslist(_0x53a3f2,_0x3df0dd,_0x22463f){return new Promise(function(_0x453e07,_0x1f6867){var _0x22d78a=new AWS['S3']({'accessKeyId':_0x3df0dd,'secretAccessKey':_0x53a3f2,'region':_0x22463f});_0x22d78a[_0x83a0('0x61')]({},function(_0xa08fe0,_0x1fa80a){if(_0xa08fe0){return _0x1f6867(_0xa08fe0);}else{return _0x453e07(_0x1fa80a);}});});}function createBucket(_0x1fe7d0,_0xc8b7f7,_0x57c301,_0x46c212){return new Promise(function(_0xa45094,_0xf2ce08){var _0x41f859=new AWS['S3']({'accessKeyId':_0xc8b7f7,'secretAccessKey':_0x1fe7d0,'region':_0x57c301});_0x41f859[_0x83a0('0x62')]({'Bucket':_0x46c212},function(_0x389e2e,_0x13136b){if(_0x389e2e){return _0xf2ce08(_0x389e2e);}else{return _0xa45094(_0x13136b);}});});}function uploadFile(_0x4c0783,_0x262e4d,_0x359f7c,_0x20a2b4,_0x202025,_0x4bd76b){return new Promise(function(_0x55b814,_0x40cea1){var _0x593783=new AWS['S3']({'accessKeyId':_0x262e4d,'secretAccessKey':_0x4c0783,'region':_0x359f7c});_0x593783['upload']({'Bucket':_0x20a2b4,'Key':_0x202025,'Body':_0x4bd76b},function(_0x4d7cc2,_0x48ef40){if(_0x4d7cc2){return _0x40cea1(_0x4d7cc2);}else{return _0x55b814(_0x48ef40);}});});}function startTranscribe(_0xce586,_0x3559db,_0x4d89fc,_0x3012fd,_0x4b48a9,_0xf6b4bf){return new Promise(function(_0x34470a,_0x51ce0a){var _0x3ed6d6=new AWS[(_0x83a0('0x63'))]({'accessKeyId':_0x3559db,'secretAccessKey':_0xce586,'region':_0x4d89fc});_0x3ed6d6[_0x83a0('0x64')]({'TranscriptionJobName':_0x3012fd,'LanguageCode':_0x4b48a9,'Media':{'MediaFileUri':_0xf6b4bf}},function(_0x12c573,_0x5544f2){if(_0x12c573){return _0x51ce0a(_0x12c573);}else{return _0x34470a(_0x5544f2);}});});}function transcribe(_0x1dcff5,_0x14cf63,_0x198828,_0x4e7ff6,_0x19d91a,_0x5cbfab,_0x19a59b){return new Promise(function(_0x2987b5,_0x27ee74){var _0x29ee92={};logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x65'),_0x1dcff5,_0x19d91a));return uploadFile(_0x14cf63,_0x198828,_0x4e7ff6,_0x19d91a,path[_0x83a0('0x66')](_0x5cbfab),fs[_0x83a0('0x67')](_0x5cbfab))[_0x83a0('0x1f')](function(_0x15424d){logger[_0x83a0('0x5b')](util['format'](_0x83a0('0x68'),_0x1dcff5,_0x19d91a,_0x15424d[_0x83a0('0x69')]));_0x29ee92[_0x83a0('0x6a')]=_0x15424d[_0x83a0('0x6b')];_0x29ee92[_0x83a0('0x6c')]=_0x15424d[_0x83a0('0x69')];logger[_0x83a0('0x5b')](util['format']('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x1dcff5));return startTranscribe(_0x14cf63,_0x198828,_0x4e7ff6,uuidv4(),_0x19a59b,_0x15424d['Location']);})[_0x83a0('0x1f')](function(_0x3c4e99){logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x6d'),_0x1dcff5,_0x3c4e99[_0x83a0('0x6e')]['TranscriptionJobName']));_0x29ee92[_0x83a0('0x6f')]=_0x3c4e99['TranscriptionJob'][_0x83a0('0x70')];_0x29ee92[_0x83a0('0x71')]=_0x3c4e99[_0x83a0('0x6e')][_0x83a0('0x72')];return _0x2987b5(_0x29ee92);})[_0x83a0('0x41')](function(_0x52d358){return _0x27ee74(_0x52d358);});});}exports['runTranscribe']=function(_0x50d4d1,_0x4d0bb2,_0xcc00ef){var _0x4d893f;var _0x4c1ed4;var _0x18980a;var _0x52f45d=require('../../components/encryptor');return db[_0x83a0('0x26')]['findOne']({'where':{'id':_0x50d4d1['params']['id']}})[_0x83a0('0x1f')](function(_0x32fcd4){if(_0x32fcd4){var _0x4ebb72=util[_0x83a0('0x2b')](_0x83a0('0x48'),_0x32fcd4['value']);if(fs[_0x83a0('0x49')](_0x4ebb72)){cypher=!![];return _0x52f45d[_0x83a0('0x58')](_0x4ebb72,_0x32fcd4[_0x83a0('0x47')],config[_0x83a0('0x4a')]['recording'])[_0x83a0('0x1f')](function(){return _0x32fcd4;});}return _0x32fcd4;}})[_0x83a0('0x1f')](function(_0x169dae){if(!_0x169dae){throw new db[(_0x83a0('0x4c'))]['ValidationError'](_0x83a0('0x73'));}_0x4c1ed4=_0x169dae;return db[_0x83a0('0x74')][_0x83a0('0x75')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x4d0bb2,null))[_0x83a0('0x1f')](function(_0x500d43){if(_0x500d43){_0x4d893f=_0x500d43;if(!_0x4d893f[_0x83a0('0x76')]||!_0x4d893f['transcribeAccountId']||!_0x4d893f['transcribeRegion']||!_0x4d893f['language']||!_0x4d893f[_0x83a0('0x6a')]){throw new db[(_0x83a0('0x4c'))][(_0x83a0('0x59'))](_0x83a0('0x77'));}if(_0x50d4d1['body'][_0x83a0('0x78')]&&(!_0x4d893f[_0x83a0('0x79')]||!_0x4d893f[_0x83a0('0x7a')]||!_0x4d893f['sentimentRegion']||!_0x4d893f['language']||!_0x4d893f[_0x83a0('0x6a')])){throw new db['Sequelize']['ValidationError']('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x83a0('0x7b')][_0x83a0('0x75')]({'where':{'id':_0x4d893f[_0x83a0('0x7c')]}});}})[_0x83a0('0x1f')](function(_0x241699){if(!_0x241699){throw new db[(_0x83a0('0x4c'))][(_0x83a0('0x59'))](_0x83a0('0x7d'));}if(!_0x241699[_0x83a0('0x7e')]||!_0x241699[_0x83a0('0x7f')]){throw new db['Sequelize'][(_0x83a0('0x59'))](_0x83a0('0x80'));}_0x18980a=_0x241699;return getBucketslist(_0x18980a['data1'],_0x18980a['data2'],_0x4d893f[_0x83a0('0x81')]);})[_0x83a0('0x1f')](function(_0x95cfdc){if(_0x95cfdc&&_0x95cfdc['Buckets']){var _0x488ec9=_['find'](_0x95cfdc['Buckets'],function(_0x1c4598){return _0x1c4598[_0x83a0('0x82')]===_0x4d893f[_0x83a0('0x6a')];});if(!_0x488ec9){logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x83'),_0x50d4d1['params']['id'],_0x4d893f[_0x83a0('0x6a')]));return createBucket(_0x18980a['data1'],_0x18980a[_0x83a0('0x7f')],_0x4d893f['transcribeRegion'],_0x4d893f['bucket']);}logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x84'),_0x50d4d1[_0x83a0('0x43')]['id'],_0x4d893f[_0x83a0('0x6a')]));return;}})['then'](function(_0xb9e8f3){if(_0x4c1ed4[_0x83a0('0x71')]===_0x83a0('0x85')){return transcribe(_0x50d4d1[_0x83a0('0x43')]['id'],_0x18980a[_0x83a0('0x7e')],_0x18980a['data2'],_0x4d893f[_0x83a0('0x81')],_0x4d893f[_0x83a0('0x6a')],_0x4c1ed4[_0x83a0('0x47')],_0x4d893f[_0x83a0('0x86')]);}else{logger[_0x83a0('0x5b')](util[_0x83a0('0x2b')](_0x83a0('0x87'),_0x50d4d1[_0x83a0('0x43')]['id']));return{'transcribeStatus':_0x83a0('0x88')};}})[_0x83a0('0x1f')](function(_0x25efa8){if(_0x25efa8){_0x25efa8['tempSentiment']=_0x50d4d1['body'][_0x83a0('0x78')];return _0x4c1ed4[_0x83a0('0x89')](_0x25efa8);}})[_0x83a0('0x1f')](respondWithResult(_0x4d0bb2,null))[_0x83a0('0x41')](handleError(_0x4d0bb2,null));};function writeFile(_0x3c431a,_0x4575fc){return new Promise(function(_0x83641b,_0x111901){fs[_0x83a0('0x8a')](_0x4575fc,_0x3c431a,function(_0x448c27,_0x4f5b75){if(_0x448c27){return _0x111901(_0x448c27);}else{return _0x83641b(_0x4f5b75);}});});}exports[_0x83a0('0x8b')]=function(_0x89333d,_0x17786a,_0x44c516){return db[_0x83a0('0x26')][_0x83a0('0x75')]({'where':{'id':_0x89333d[_0x83a0('0x43')]['id']}})['then'](handleEntityNotFound(_0x17786a))[_0x83a0('0x1f')](function(_0x3553c0){if(_0x3553c0&&_0x3553c0[_0x83a0('0x8c')]){var _0x354337=_0x3553c0[_0x83a0('0x8c')];var _0xb5854e=config['root']+_0x83a0('0x8d')+_0x3553c0['id']+'.txt';if(fs[_0x83a0('0x49')](_0xb5854e)){return _0xb5854e;}return writeFile(_0x354337,_0xb5854e)['then'](function(){return _0xb5854e;});}else{throw new db[(_0x83a0('0x4c'))]['ValidationError'](_0x83a0('0x8e'));}})[_0x83a0('0x1f')](function(_0x533be5){return _0x17786a['download'](_0x533be5);})[_0x83a0('0x41')](handleError(_0x17786a));}; \ No newline at end of file +var _0x5736=['Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','bucket','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribe','transcribeAccountId','language','Transcribe\x20not\x20configured','sentimentAccountId','sentimentRegion','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','sendStatus','error','stack','name','index','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','rows','catch','show','params','fields','create','body','describe','download','../../components/encryptor','uniqueid','find','value','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','$and','push','secrets'];(function(_0x47cc74,_0x4598df){var _0xdfe813=function(_0x291ca6){while(--_0x291ca6){_0x47cc74['push'](_0x47cc74['shift']());}};_0xdfe813(++_0x4598df);}(_0x5736,0x15b));var _0x6573=function(_0x141844,_0x15ea0d){_0x141844=_0x141844-0x0;var _0x5035b9=_0x5736[_0x141844];return _0x5035b9;};'use strict';var emlformat=require(_0x6573('0x0'));var rimraf=require(_0x6573('0x1'));var zipdir=require(_0x6573('0x2'));var jsonpatch=require(_0x6573('0x3'));var rp=require(_0x6573('0x4'));var moment=require(_0x6573('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6573('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6573('0x7'));var ejs=require(_0x6573('0x8'));var fs=require('fs');var fs_extra=require(_0x6573('0x9'));var _=require(_0x6573('0xa'));var squel=require(_0x6573('0xb'));var crypto=require('crypto');var jsforce=require(_0x6573('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x6573('0x7'));var querystring=require(_0x6573('0xd'));var Papa=require(_0x6573('0xe'));var AWS=require(_0x6573('0xf'));var uuidv4=require(_0x6573('0x10'));var Redis=require('ioredis');var authService=require(_0x6573('0x11'));var qs=require(_0x6573('0x12'));var as=require(_0x6573('0x13'));var hardwareService=require(_0x6573('0x14'));var logger=require(_0x6573('0x15'))(_0x6573('0x16'));var utils=require('../../config/utils');var config=require(_0x6573('0x17'));var licenseUtil=require(_0x6573('0x18'));var db=require(_0x6573('0x19'))['db'];function respondWithStatusCode(_0x3b3863,_0x206f1b){_0x206f1b=_0x206f1b||0xcc;return function(_0x5004ba){if(_0x5004ba){return _0x3b3863['sendStatus'](_0x206f1b);}return _0x3b3863[_0x6573('0x1a')](_0x206f1b)[_0x6573('0x1b')]();};}function respondWithResult(_0x2d4b3e,_0x18aa12){_0x18aa12=_0x18aa12||0xc8;return function(_0x38ca67){if(_0x38ca67){return _0x2d4b3e[_0x6573('0x1a')](_0x18aa12)[_0x6573('0x1c')](_0x38ca67);}};}function respondWithFilteredResult(_0x1bbf97,_0x78de04){return function(_0x32e48d){if(_0x32e48d){var _0xe7099d=typeof _0x78de04[_0x6573('0x1d')]===_0x6573('0x1e')&&typeof _0x78de04[_0x6573('0x1f')]===_0x6573('0x1e');var _0x2e420c=_0x32e48d[_0x6573('0x20')];var _0x3f3d5b=_0xe7099d?0x0:_0x78de04[_0x6573('0x1d')];var _0x22b652=_0xe7099d?_0x32e48d[_0x6573('0x20')]:_0x78de04[_0x6573('0x1d')]+_0x78de04['limit'];var _0x13d257;if(_0x22b652>=_0x2e420c){_0x22b652=_0x2e420c;_0x13d257=0xc8;}else{_0x13d257=0xce;}_0x1bbf97[_0x6573('0x1a')](_0x13d257);return _0x1bbf97[_0x6573('0x21')](_0x6573('0x22'),_0x3f3d5b+'-'+_0x22b652+'/'+_0x2e420c)[_0x6573('0x1c')](_0x32e48d);}return null;};}function patchUpdates(_0x27529b){return function(_0x41914f){try{jsonpatch['apply'](_0x41914f,_0x27529b,!![]);}catch(_0x1c93f1){return BPromise[_0x6573('0x23')](_0x1c93f1);}return _0x41914f[_0x6573('0x24')]();};}function saveUpdates(_0x3e52bb,_0x337d00){return function(_0x50e468){if(_0x50e468){return _0x50e468[_0x6573('0x25')](_0x3e52bb)['then'](function(_0x18e7a3){return _0x18e7a3;});}return null;};}function removeEntity(_0xe7541f,_0x56dbe9){return function(_0x2dabad){if(_0x2dabad){return _0x2dabad[_0x6573('0x26')]()[_0x6573('0x27')](function(){_0xe7541f[_0x6573('0x1a')](0xcc)[_0x6573('0x1b')]();});}};}function handleEntityNotFound(_0x1000fc,_0x1ead04){return function(_0x102896){if(!_0x102896){_0x1000fc[_0x6573('0x28')](0x194);}return _0x102896;};}function handleError(_0x5af958,_0x27cdab){_0x27cdab=_0x27cdab||0x1f4;return function(_0x9f89ef){logger[_0x6573('0x29')](_0x9f89ef[_0x6573('0x2a')]);if(_0x9f89ef['name']){delete _0x9f89ef[_0x6573('0x2b')];}_0x5af958[_0x6573('0x1a')](_0x27cdab)['send'](_0x9f89ef);};}exports[_0x6573('0x2c')]=function(_0x133eed,_0x2cbaaf){var _0x5d844a={},_0x561782={},_0x5072c8={'count':0x0,'rows':[]};var _0x4262f0=_['map'](db[_0x6573('0x2d')][_0x6573('0x2e')],function(_0x9d44e7){return{'name':_0x9d44e7[_0x6573('0x2f')],'type':_0x9d44e7[_0x6573('0x30')][_0x6573('0x31')]};});_0x561782[_0x6573('0x32')]=_[_0x6573('0x33')](_['map'](_0x4262f0,_0x6573('0x2b')),[_0x6573('0x34')]);_0x561782[_0x6573('0x35')]=_[_0x6573('0x36')](_0x133eed[_0x6573('0x35')]);_0x561782['filters']=_[_0x6573('0x37')](_0x561782[_0x6573('0x32')],_0x561782[_0x6573('0x35')]);_0x5d844a[_0x6573('0x38')]=_[_0x6573('0x37')](_0x561782['model'],qs['fields'](_0x133eed['query']['fields']));_0x5d844a['attributes']=_0x5d844a['attributes'][_0x6573('0x39')]?_0x5d844a['attributes']:_0x561782[_0x6573('0x32')];if(!_0x133eed[_0x6573('0x35')][_0x6573('0x3a')](_0x6573('0x3b'))){_0x5d844a['limit']=qs['limit'](_0x133eed[_0x6573('0x35')][_0x6573('0x1f')]);_0x5d844a['offset']=qs[_0x6573('0x1d')](_0x133eed[_0x6573('0x35')][_0x6573('0x1d')]);}_0x5d844a[_0x6573('0x3c')]=qs[_0x6573('0x3d')](_0x133eed[_0x6573('0x35')][_0x6573('0x3d')]);_0x5d844a[_0x6573('0x3e')]=qs[_0x6573('0x3f')](_['pick'](_0x133eed['query'],_0x561782[_0x6573('0x3f')]),_0x4262f0);if(_0x133eed[_0x6573('0x35')][_0x6573('0x40')]){_0x5d844a[_0x6573('0x3e')]=_[_0x6573('0x41')](_0x5d844a[_0x6573('0x3e')],{'$or':_[_0x6573('0x42')](_0x4262f0,function(_0x1812e5){if(_0x1812e5[_0x6573('0x30')]!==_0x6573('0x43')){var _0x211b62={};_0x211b62[_0x1812e5[_0x6573('0x2b')]]={'$like':'%'+_0x133eed['query'][_0x6573('0x40')]+'%'};return _0x211b62;}})});}_0x5d844a=_['merge']({},_0x5d844a,_0x133eed[_0x6573('0x44')]);var _0x2b1839={'where':_0x5d844a[_0x6573('0x3e')]};return db['VoiceRecording'][_0x6573('0x20')](_0x2b1839)[_0x6573('0x27')](function(_0x5df640){_0x5072c8['count']=_0x5df640;if(_0x133eed[_0x6573('0x35')][_0x6573('0x45')]){_0x5d844a[_0x6573('0x46')]=[{'all':!![]}];}return db[_0x6573('0x2d')]['findAll'](_0x5d844a);})[_0x6573('0x27')](function(_0x4044fb){_0x5072c8[_0x6573('0x47')]=_0x4044fb;return _0x5072c8;})[_0x6573('0x27')](respondWithFilteredResult(_0x2cbaaf,_0x5d844a))[_0x6573('0x48')](handleError(_0x2cbaaf,null));};exports[_0x6573('0x49')]=function(_0x5ec079,_0x44d44d){var _0x1b498c={'raw':![],'where':{'id':_0x5ec079[_0x6573('0x4a')]['id']}},_0x48170a={};_0x48170a[_0x6573('0x32')]=_[_0x6573('0x36')](db[_0x6573('0x2d')]['rawAttributes']);_0x48170a[_0x6573('0x35')]=_[_0x6573('0x36')](_0x5ec079[_0x6573('0x35')]);_0x48170a[_0x6573('0x3f')]=_[_0x6573('0x37')](_0x48170a['model'],_0x48170a[_0x6573('0x35')]);_0x1b498c[_0x6573('0x38')]=_[_0x6573('0x37')](_0x48170a[_0x6573('0x32')],qs[_0x6573('0x4b')](_0x5ec079[_0x6573('0x35')][_0x6573('0x4b')]));_0x1b498c['attributes']=_0x1b498c['attributes'][_0x6573('0x39')]?_0x1b498c['attributes']:_0x48170a['model'];if(_0x5ec079[_0x6573('0x35')]['includeAll']){_0x1b498c[_0x6573('0x46')]=[{'all':!![]}];}_0x1b498c=_[_0x6573('0x41')]({},_0x1b498c,_0x5ec079[_0x6573('0x44')]);return db[_0x6573('0x2d')]['find'](_0x1b498c)[_0x6573('0x27')](handleEntityNotFound(_0x44d44d,null))[_0x6573('0x27')](respondWithResult(_0x44d44d,null))[_0x6573('0x48')](handleError(_0x44d44d,null));};exports[_0x6573('0x4c')]=function(_0x529d51,_0x213e1d){return db[_0x6573('0x2d')][_0x6573('0x4c')](_0x529d51[_0x6573('0x4d')],{})[_0x6573('0x27')](respondWithResult(_0x213e1d,0xc9))[_0x6573('0x48')](handleError(_0x213e1d,null));};exports[_0x6573('0x25')]=function(_0x10114a,_0x42ce59){if(_0x10114a['body']['id']){delete _0x10114a['body']['id'];}return db['VoiceRecording']['find']({'where':{'id':_0x10114a[_0x6573('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42ce59,null))['then'](saveUpdates(_0x10114a[_0x6573('0x4d')],null))[_0x6573('0x27')](respondWithResult(_0x42ce59,null))['catch'](handleError(_0x42ce59,null));};exports[_0x6573('0x4e')]=function(_0x20f9b6,_0x25b12e){return db[_0x6573('0x2d')][_0x6573('0x4e')]()['then'](respondWithResult(_0x25b12e,null))[_0x6573('0x48')](handleError(_0x25b12e,null));};exports[_0x6573('0x4f')]=function(_0x152ece,_0x114175,_0x477cb1){var _0xe74149=require(_0x6573('0x50'));var _0xe2e68a=![];var _0x355794={};if(_0x152ece[_0x6573('0x35')][_0x6573('0x30')]&&_0x152ece[_0x6573('0x35')][_0x6573('0x30')]===_0x6573('0x51')){_0x355794['uniqueid']=_0x152ece[_0x6573('0x4a')]['id'];}else{_0x355794['id']=_0x152ece[_0x6573('0x4a')]['id'];}return db[_0x6573('0x2d')][_0x6573('0x52')]({'where':_0x355794,'attributes':['id','value'],'raw':!![]})[_0x6573('0x27')](handleEntityNotFound(_0x114175,null))['then'](function(_0x6c9a6e){if(_0x6c9a6e){var _0x5bcd8e=_0x6c9a6e[_0x6573('0x53')];var _0x488af8=util['format'](_0x6573('0x54'),_0x5bcd8e);if(fs[_0x6573('0x55')](_0x488af8)){_0xe2e68a=!![];return _0xe74149[_0x6573('0x56')](_0x488af8,_0x5bcd8e,config['secrets'][_0x6573('0x57')])[_0x6573('0x27')](function(){return _0x6c9a6e;});}return _0x6c9a6e;}})[_0x6573('0x27')](function(_0x22fad0){if(_0x22fad0){var _0x4b2e11=_0x22fad0[_0x6573('0x53')];if(!fs['existsSync'](_0x4b2e11)){throw new db[(_0x6573('0x58'))][(_0x6573('0x59'))](_0x6573('0x5a'));}if(_0x22fad0[_0x6573('0x5b')]){return _0x114175[_0x6573('0x4f')](_0x4b2e11,_0x22fad0[_0x6573('0x5b')]+path[_0x6573('0x5c')](_0x4b2e11),function(){if(_0xe2e68a){fs['unlink'](_0x4b2e11);}});}else{return _0x114175[_0x6573('0x4f')](_0x4b2e11,function(_0x488ac9){if(_0xe2e68a){fs[_0x6573('0x5d')](_0x4b2e11);}});}}})[_0x6573('0x48')](function(_0x457a08){if(_0x457a08[_0x6573('0x5e')]===_0x6573('0x5a')){_0x114175[_0x6573('0x1a')](0x194)['send'](_0x6573('0x5f'));}else{return handleError(_0x114175,null);}});};exports[_0x6573('0x60')]=function(_0x409982,_0x37b500,_0x3013e5){var _0x119421=require('../../components/encryptor');var _0x3086c3=![];var _0x54a3d1={'$and':[db[_0x6573('0x61')][_0x6573('0x3e')](db['sequelize']['fn'](_0x6573('0x62'),db[_0x6573('0x61')]['col'](_0x6573('0x51'))),_0x409982[_0x6573('0x35')][_0x6573('0x63')])]};if(_0x409982['query']['type']&&_0x409982[_0x6573('0x35')]['type']===_0x6573('0x51')){_0x54a3d1[_0x6573('0x64')][_0x6573('0x65')]({'uniqueid':_0x409982['params']['id']});}else{_0x54a3d1[_0x6573('0x64')]['push']({'id':_0x409982[_0x6573('0x4a')]['id']});}return db['VoiceRecording'][_0x6573('0x52')]({'where':_0x54a3d1,'attributes':['id',_0x6573('0x53')],'raw':!![]})['then'](handleEntityNotFound(_0x37b500,null))[_0x6573('0x27')](function(_0x5ce7c8){if(_0x5ce7c8){var _0x370309=util[_0x6573('0x34')](_0x6573('0x54'),_0x5ce7c8[_0x6573('0x53')]);if(fs[_0x6573('0x55')](_0x370309)){_0x3086c3=!![];return _0x119421[_0x6573('0x56')](_0x370309,_0x5ce7c8[_0x6573('0x53')],config[_0x6573('0x66')][_0x6573('0x57')])[_0x6573('0x27')](function(){return _0x5ce7c8;});}return _0x5ce7c8;}})[_0x6573('0x27')](function(_0xc2d1b4){if(_0xc2d1b4){if(!fs['existsSync'](_0xc2d1b4['value'])){throw new db[(_0x6573('0x58'))][(_0x6573('0x59'))](_0x6573('0x5a'));}if(_0xc2d1b4[_0x6573('0x5b')]){return _0x37b500[_0x6573('0x4f')](_0xc2d1b4[_0x6573('0x53')],_0xc2d1b4[_0x6573('0x5b')]+path[_0x6573('0x5c')](_0xc2d1b4['value']),function(){if(_0x3086c3){fs['unlink'](_0xc2d1b4['value']);}});}else{return _0x37b500[_0x6573('0x4f')](_0xc2d1b4['value'],function(_0x2c44ff){if(_0x3086c3){fs[_0x6573('0x5d')](_0xc2d1b4[_0x6573('0x53')]);}});}}})[_0x6573('0x48')](handleError(_0x37b500,null));};exports['destroy']=function(_0x21f236,_0xc5e3c6){return db[_0x6573('0x2d')][_0x6573('0x52')]({'where':{'id':_0x21f236[_0x6573('0x4a')]['id']}})[_0x6573('0x27')](function(_0x27a56f){if(_['isNil'](_0x27a56f)){throw new ReferenceError(_0x6573('0x67'));}return _0x27a56f;})[_0x6573('0x27')](function(_0x1ace22){var _0x310a30=_0x1ace22['value'];logger[_0x6573('0x68')](_0x6573('0x69'),_0x310a30);if(!_[_0x6573('0x6a')](_0x1ace22[_0x6573('0x53')])&&fs[_0x6573('0x55')](_0x310a30)){logger[_0x6573('0x68')](_0x6573('0x6b')+_0x310a30+_0x6573('0x6c'));fs[_0x6573('0x6d')](_0x310a30);}_0x310a30=_0x310a30+'.cypher';if(!_[_0x6573('0x6a')](_0x1ace22[_0x6573('0x53')])&&fs['existsSync'](_0x310a30)){logger[_0x6573('0x68')](_0x6573('0x6b')+_0x310a30+_0x6573('0x6c'));fs[_0x6573('0x6d')](_0x310a30);}return _0x1ace22;})[_0x6573('0x27')](function(_0x3e0fa5){if(!_0x3e0fa5)throw new InternalError();return _0x3e0fa5['destroy']();})['then'](function(){_0xc5e3c6[_0x6573('0x1a')](0xcc)[_0x6573('0x1b')]();})[_0x6573('0x48')](handleError(_0xc5e3c6,null));};function getBucketslist(_0x37a52a,_0x3a1c73,_0x45ad20){return new Promise(function(_0x391090,_0x519a74){var _0x326bd4=new AWS['S3']({'accessKeyId':_0x3a1c73,'secretAccessKey':_0x37a52a,'region':_0x45ad20});_0x326bd4[_0x6573('0x6e')]({},function(_0x45c2c8,_0x513b7f){if(_0x45c2c8){return _0x519a74(_0x45c2c8);}else{return _0x391090(_0x513b7f);}});});}function createBucket(_0x5b92aa,_0x19362f,_0x295739,_0x463b9e){return new Promise(function(_0xbe2af1,_0x216992){var _0x2ad1d6=new AWS['S3']({'accessKeyId':_0x19362f,'secretAccessKey':_0x5b92aa,'region':_0x295739});_0x2ad1d6[_0x6573('0x6f')]({'Bucket':_0x463b9e},function(_0x3b47c5,_0x548789){if(_0x3b47c5){return _0x216992(_0x3b47c5);}else{return _0xbe2af1(_0x548789);}});});}function uploadFile(_0x164066,_0x1d7ac9,_0x20b7de,_0x627285,_0x2c28f4,_0x19733c){return new Promise(function(_0x2335df,_0x3b4c6a){var _0x2cfb65=new AWS['S3']({'accessKeyId':_0x1d7ac9,'secretAccessKey':_0x164066,'region':_0x20b7de});_0x2cfb65[_0x6573('0x70')]({'Bucket':_0x627285,'Key':_0x2c28f4,'Body':_0x19733c},function(_0x1d06f5,_0x1c5ced){if(_0x1d06f5){return _0x3b4c6a(_0x1d06f5);}else{return _0x2335df(_0x1c5ced);}});});}function startTranscribe(_0x29ef27,_0xc46f59,_0x5dbbf2,_0xf9a52c,_0x75b0a6,_0x158961){return new Promise(function(_0x4db2de,_0xa5567){var _0x3f5443=new AWS['TranscribeService']({'accessKeyId':_0xc46f59,'secretAccessKey':_0x29ef27,'region':_0x5dbbf2});_0x3f5443[_0x6573('0x71')]({'TranscriptionJobName':_0xf9a52c,'LanguageCode':_0x75b0a6,'Media':{'MediaFileUri':_0x158961}},function(_0x3f005a,_0xa4f444){if(_0x3f005a){return _0xa5567(_0x3f005a);}else{return _0x4db2de(_0xa4f444);}});});}function transcribe(_0x4add92,_0x35959d,_0x2e0521,_0x257e3a,_0x26c643,_0x37aa1e,_0x139323){return new Promise(function(_0x34b637,_0x3ad90f){var _0x1a178a={};logger['info'](util['format'](_0x6573('0x72'),_0x4add92,_0x26c643));return uploadFile(_0x35959d,_0x2e0521,_0x257e3a,_0x26c643,path[_0x6573('0x73')](_0x37aa1e),fs[_0x6573('0x74')](_0x37aa1e))['then'](function(_0x566e80){logger[_0x6573('0x68')](util[_0x6573('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x4add92,_0x26c643,_0x566e80['Location']));_0x1a178a[_0x6573('0x75')]=_0x566e80['Bucket'];_0x1a178a['location']=_0x566e80[_0x6573('0x76')];logger[_0x6573('0x68')](util[_0x6573('0x34')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x4add92));return startTranscribe(_0x35959d,_0x2e0521,_0x257e3a,uuidv4(),_0x139323,_0x566e80[_0x6573('0x76')]);})[_0x6573('0x27')](function(_0x4fec84){logger[_0x6573('0x68')](util[_0x6573('0x34')](_0x6573('0x77'),_0x4add92,_0x4fec84[_0x6573('0x78')][_0x6573('0x79')]));_0x1a178a[_0x6573('0x7a')]=_0x4fec84[_0x6573('0x78')][_0x6573('0x79')];_0x1a178a[_0x6573('0x7b')]=_0x4fec84['TranscriptionJob']['TranscriptionJobStatus'];return _0x34b637(_0x1a178a);})[_0x6573('0x48')](function(_0x4158d2){return _0x3ad90f(_0x4158d2);});});}exports['runTranscribe']=function(_0x31370d,_0x45839f,_0x5f5546){var _0x163c87;var _0x26b483;var _0x1f5acd;var _0x392aaf=require(_0x6573('0x50'));return db[_0x6573('0x2d')]['findOne']({'where':{'id':_0x31370d[_0x6573('0x4a')]['id']}})[_0x6573('0x27')](function(_0x3dbb46){if(_0x3dbb46){var _0xf0960f=util[_0x6573('0x34')](_0x6573('0x54'),_0x3dbb46['value']);if(fs['existsSync'](_0xf0960f)){cypher=!![];return _0x392aaf[_0x6573('0x56')](_0xf0960f,_0x3dbb46['value'],config[_0x6573('0x66')][_0x6573('0x57')])[_0x6573('0x27')](function(){return _0x3dbb46;});}return _0x3dbb46;}})[_0x6573('0x27')](function(_0x5e5221){if(!_0x5e5221){throw new db[(_0x6573('0x58'))]['ValidationError'](_0x6573('0x7c'));}_0x26b483=_0x5e5221;return db[_0x6573('0x7d')][_0x6573('0x7e')]({'where':{'id':0x1}});})[_0x6573('0x27')](handleEntityNotFound(_0x45839f,null))[_0x6573('0x27')](function(_0x43ac0d){if(_0x43ac0d){_0x163c87=_0x43ac0d;if(!_0x163c87[_0x6573('0x7f')]||!_0x163c87[_0x6573('0x80')]||!_0x163c87['transcribeRegion']||!_0x163c87[_0x6573('0x81')]||!_0x163c87[_0x6573('0x75')]){throw new db[(_0x6573('0x58'))][(_0x6573('0x59'))](_0x6573('0x82'));}if(_0x31370d[_0x6573('0x4d')]['runSentiment']&&(!_0x163c87['sentiment']||!_0x163c87[_0x6573('0x83')]||!_0x163c87[_0x6573('0x84')]||!_0x163c87[_0x6573('0x81')]||!_0x163c87[_0x6573('0x75')])){throw new db[(_0x6573('0x58'))][(_0x6573('0x59'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0x6573('0x85')]['findOne']({'where':{'id':_0x163c87[_0x6573('0x80')]}});}})[_0x6573('0x27')](function(_0x379f71){if(!_0x379f71){throw new db[(_0x6573('0x58'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x379f71[_0x6573('0x86')]||!_0x379f71[_0x6573('0x87')]){throw new db['Sequelize'][(_0x6573('0x59'))](_0x6573('0x88'));}_0x1f5acd=_0x379f71;return getBucketslist(_0x1f5acd['data1'],_0x1f5acd[_0x6573('0x87')],_0x163c87[_0x6573('0x89')]);})['then'](function(_0x5ef42b){if(_0x5ef42b&&_0x5ef42b[_0x6573('0x8a')]){var _0x21efd7=_[_0x6573('0x52')](_0x5ef42b[_0x6573('0x8a')],function(_0x393a51){return _0x393a51[_0x6573('0x8b')]===_0x163c87[_0x6573('0x75')];});if(!_0x21efd7){logger[_0x6573('0x68')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x31370d[_0x6573('0x4a')]['id'],_0x163c87[_0x6573('0x75')]));return createBucket(_0x1f5acd[_0x6573('0x86')],_0x1f5acd[_0x6573('0x87')],_0x163c87[_0x6573('0x89')],_0x163c87[_0x6573('0x75')]);}logger[_0x6573('0x68')](util[_0x6573('0x34')](_0x6573('0x8c'),_0x31370d[_0x6573('0x4a')]['id'],_0x163c87[_0x6573('0x75')]));return;}})['then'](function(_0x58b536){if(_0x26b483['transcribeStatus']==='NEW'){return transcribe(_0x31370d[_0x6573('0x4a')]['id'],_0x1f5acd[_0x6573('0x86')],_0x1f5acd[_0x6573('0x87')],_0x163c87[_0x6573('0x89')],_0x163c87[_0x6573('0x75')],_0x26b483[_0x6573('0x53')],_0x163c87['language']);}else{logger[_0x6573('0x68')](util[_0x6573('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x31370d[_0x6573('0x4a')]['id']));return{'transcribeStatus':_0x6573('0x8d')};}})[_0x6573('0x27')](function(_0x470512){if(_0x470512){_0x470512[_0x6573('0x8e')]=_0x31370d[_0x6573('0x4d')]['runSentiment'];return _0x26b483[_0x6573('0x8f')](_0x470512);}})['then'](respondWithResult(_0x45839f,null))['catch'](handleError(_0x45839f,null));};function writeFile(_0x21178a,_0x4f0ce0){return new Promise(function(_0x1f08a9,_0x224a90){fs[_0x6573('0x90')](_0x4f0ce0,_0x21178a,function(_0x2ec3a7,_0x47d43a){if(_0x2ec3a7){return _0x224a90(_0x2ec3a7);}else{return _0x1f08a9(_0x47d43a);}});});}exports['downloadTranscribe']=function(_0x49c183,_0x32a326,_0x460084){return db[_0x6573('0x2d')][_0x6573('0x7e')]({'where':{'id':_0x49c183[_0x6573('0x4a')]['id']}})['then'](handleEntityNotFound(_0x32a326))[_0x6573('0x27')](function(_0x30b66a){if(_0x30b66a&&_0x30b66a[_0x6573('0x91')]){var _0x59dbec=_0x30b66a[_0x6573('0x91')];var _0x4e2d45=config[_0x6573('0x92')]+_0x6573('0x93')+_0x30b66a['id']+_0x6573('0x94');if(fs[_0x6573('0x55')](_0x4e2d45)){return _0x4e2d45;}return writeFile(_0x59dbec,_0x4e2d45)[_0x6573('0x27')](function(){return _0x4e2d45;});}else{throw new db['Sequelize'][(_0x6573('0x59'))](_0x6573('0x95'));}})[_0x6573('0x27')](function(_0x31515a){return _0x32a326[_0x6573('0x4f')](_0x31515a);})[_0x6573('0x48')](handleError(_0x32a326));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 4009d33..3e8437d 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 _0x3fec=['voice_recordings','transcribeStatus','./voiceRecording.attributes','define'];(function(_0x5e9054,_0x496c02){var _0x1dd43f=function(_0x4c393e){while(--_0x4c393e){_0x5e9054['push'](_0x5e9054['shift']());}};_0x1dd43f(++_0x496c02);}(_0x3fec,0x1ba));var _0xc3fe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3fec[_0x20a584];return _0x4b41a8;};'use strict';var attributes=require(_0xc3fe('0x0'));module['exports']=function(_0x502342,_0x3096c1){return _0x502342[_0xc3fe('0x1')]('VoiceRecording',attributes,{'tableName':_0xc3fe('0x2'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']},{'name':_0xc3fe('0x3'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1280=['VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define'];(function(_0x12a9b5,_0x3ffe87){var _0xb038=function(_0x27bd44){while(--_0x27bd44){_0x12a9b5['push'](_0x12a9b5['shift']());}};_0xb038(++_0x3ffe87);}(_0x1280,0xba));var _0x0128=function(_0x234577,_0x3b9004){_0x234577=_0x234577-0x0;var _0x28fea6=_0x1280[_0x234577];return _0x28fea6;};'use strict';var attributes=require(_0x0128('0x0'));module[_0x0128('0x1')]=function(_0xf27e34,_0x869975){return _0xf27e34[_0x0128('0x2')](_0x0128('0x3'),attributes,{'tableName':_0x0128('0x4'),'paranoid':![],'indexes':[{'name':_0x0128('0x5'),'fields':[_0x0128('0x5')]},{'name':'transcribeStatus','fields':[_0x0128('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index f8799cb..50932b1 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 _0x5c3c=['../../config/environment','jayson/promise','client','http','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','findOne','callRecordingEncryption','create','existsSync','value','%s.cypher','encryptFile','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','debug','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x56c1a4,_0x4f8746){var _0x5d7341=function(_0xd890ab){while(--_0xd890ab){_0x56c1a4['push'](_0x56c1a4['shift']());}};_0x5d7341(++_0x4f8746);}(_0x5c3c,0x132));var _0xc5c3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c3c[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require(_0xc5c3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require(_0xc5c3('0x6'));var logger=require(_0xc5c3('0x7'))(_0xc5c3('0x8'));var config=require(_0xc5c3('0x9'));var jayson=require(_0xc5c3('0xa'));var client=jayson[_0xc5c3('0xb')][_0xc5c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a392b,_0x4b8404,_0x591f7d){return new BPromise(function(_0x723c31,_0x522be1){return client['request'](_0x5a392b,_0x591f7d)[_0xc5c3('0xd')](function(_0x46e2c1){logger['info'](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));logger['debug'](_0xc5c3('0x10'),_0x4b8404,_0xc5c3('0xf'),JSON[_0xc5c3('0x11')](_0x46e2c1));if(_0x46e2c1['error']){if(_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x522be1(_0x46e2c1['error'][_0xc5c3('0x14')]);}logger[_0xc5c3('0x12')](_0xc5c3('0xe'),_0x4b8404,_0x46e2c1[_0xc5c3('0x12')][_0xc5c3('0x14')]);return _0x723c31(_0x46e2c1['error']['message']);}else{logger[_0xc5c3('0x15')](_0xc5c3('0xe'),_0x4b8404,_0xc5c3('0xf'));_0x723c31(_0x46e2c1[_0xc5c3('0x16')]['message']);}})['catch'](function(_0x467ba9){logger['error'](_0xc5c3('0xe'),_0x4b8404,_0x467ba9);_0x522be1(_0x467ba9);});});}exports[_0xc5c3('0x17')]=function(_0x2ff158){var _0x13c867=this;return new Promise(function(_0x28bae6,_0x5e11d5){return db[_0xc5c3('0x18')][_0xc5c3('0x19')](_0x2ff158[_0xc5c3('0x1a')],{'raw':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1d')]||null:null,'attributes':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158['options'][_0xc5c3('0x1e')]||null:null,'limit':_0x2ff158[_0xc5c3('0x1b')]?_0x2ff158[_0xc5c3('0x1b')][_0xc5c3('0x1f')]||null:null})[_0xc5c3('0xd')](function(_0x67445){logger[_0xc5c3('0x15')]('UpdateVoiceRecording',_0x2ff158);logger['debug'](_0xc5c3('0x17'),_0x2ff158,JSON[_0xc5c3('0x11')](_0x67445));_0x28bae6(_0x67445);})['catch'](function(_0x5c7329){logger[_0xc5c3('0x12')](_0xc5c3('0x17'),_0x5c7329[_0xc5c3('0x14')],_0x2ff158);_0x5e11d5(_0x13c867['error'](0x1f4,_0x5c7329['message']));});});};exports[_0xc5c3('0x20')]=function(_0x22f607){var _0x20c506=this;return new Promise(function(_0x29791c,_0x5caf85){var _0x21efd6=require('../../components/encryptor');var _0x2eacec;return db['Setting'][_0xc5c3('0x21')]({'attributes':['id',_0xc5c3('0x22')],'where':{'id':0x1},'raw':!![]})[_0xc5c3('0xd')](function(_0x4773c5){_0x2eacec=_0x4773c5;return db[_0xc5c3('0x18')][_0xc5c3('0x23')](_0x22f607[_0xc5c3('0x1a')]);})['then'](function(_0xbcafd6){if(_0x2eacec['callRecordingEncryption']&&fs[_0xc5c3('0x24')](_0xbcafd6[_0xc5c3('0x25')])){var _0x5b26e9=util['format'](_0xc5c3('0x26'),_0xbcafd6[_0xc5c3('0x25')]);return _0x21efd6[_0xc5c3('0x27')](_0xbcafd6[_0xc5c3('0x25')],_0x5b26e9,config['secrets'][_0xc5c3('0x28')])[_0xc5c3('0xd')](function(){fs[_0xc5c3('0x29')](_0xbcafd6[_0xc5c3('0x25')]);logger[_0xc5c3('0x15')](_0xc5c3('0x2a'));return _0xbcafd6;});}return _0xbcafd6;})[_0xc5c3('0xd')](function(_0x1e6749){logger[_0xc5c3('0x15')]('CreateVoiceRecording',_0x22f607);logger[_0xc5c3('0x2b')](_0xc5c3('0x20'),_0x22f607,JSON[_0xc5c3('0x11')](_0x1e6749));_0x29791c(_0x1e6749);})[_0xc5c3('0x2c')](function(_0x330391){logger[_0xc5c3('0x12')](_0xc5c3('0x20'),_0x330391['message'],_0x22f607);_0x5caf85(_0x20c506['error'](0x1f4,_0x330391[_0xc5c3('0x14')]));});});}; \ No newline at end of file +var _0xaebd=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','VoiceRecording,\x20%s,\x20%s','catch','UpdateVoiceRecording','update','options','raw','where','attributes','debug','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','VoiceRecording','create','body','value','format','%s.cypher','encryptFile','recording','unlink','lodash','moment','bluebird'];(function(_0x508685,_0x9f94af){var _0x976a76=function(_0x1bcb05){while(--_0x1bcb05){_0x508685['push'](_0x508685['shift']());}};_0x976a76(++_0x9f94af);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3e9aae,_0x594989){_0x3e9aae=_0x3e9aae-0x0;var _0x542090=_0xaebd[_0x3e9aae];return _0x542090;};'use strict';var _=require(_0xdaeb('0x0'));var util=require('util');var moment=require(_0xdaeb('0x1'));var BPromise=require(_0xdaeb('0x2'));var rs=require(_0xdaeb('0x3'));var fs=require('fs');var Redis=require(_0xdaeb('0x4'));var db=require(_0xdaeb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdaeb('0x6'))(_0xdaeb('0x7'));var config=require(_0xdaeb('0x8'));var jayson=require(_0xdaeb('0x9'));var client=jayson[_0xdaeb('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ea090,_0x3f7ba1,_0x52c717){return new BPromise(function(_0x550bd9,_0x1b9d37){return client[_0xdaeb('0xb')](_0x3ea090,_0x52c717)[_0xdaeb('0xc')](function(_0x5e0ae9){logger[_0xdaeb('0xd')]('VoiceRecording,\x20%s,\x20%s',_0x3f7ba1,_0xdaeb('0xe'));logger['debug'](_0xdaeb('0xf'),_0x3f7ba1,'request\x20sent',JSON[_0xdaeb('0x10')](_0x5e0ae9));if(_0x5e0ae9[_0xdaeb('0x11')]){if(_0x5e0ae9['error']['code']===0x1f4){logger[_0xdaeb('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);return _0x1b9d37(_0x5e0ae9[_0xdaeb('0x11')][_0xdaeb('0x12')]);}logger[_0xdaeb('0x11')](_0xdaeb('0x13'),_0x3f7ba1,_0x5e0ae9[_0xdaeb('0x11')]['message']);return _0x550bd9(_0x5e0ae9['error'][_0xdaeb('0x12')]);}else{logger[_0xdaeb('0xd')](_0xdaeb('0x13'),_0x3f7ba1,_0xdaeb('0xe'));_0x550bd9(_0x5e0ae9['result']['message']);}})[_0xdaeb('0x14')](function(_0x4dd803){logger['error'](_0xdaeb('0x13'),_0x3f7ba1,_0x4dd803);_0x1b9d37(_0x4dd803);});});}exports[_0xdaeb('0x15')]=function(_0x1b5243){var _0x1fe84e=this;return new Promise(function(_0x2d8f11,_0x36f9ac){return db['VoiceRecording'][_0xdaeb('0x16')](_0x1b5243['body'],{'raw':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5243['options']?_0x1b5243['options'][_0xdaeb('0x19')]||null:null,'attributes':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243[_0xdaeb('0x17')][_0xdaeb('0x1a')]||null:null,'limit':_0x1b5243[_0xdaeb('0x17')]?_0x1b5243['options']['limit']||null:null})[_0xdaeb('0xc')](function(_0x3cfcaf){logger[_0xdaeb('0xd')](_0xdaeb('0x15'),_0x1b5243);logger[_0xdaeb('0x1b')]('UpdateVoiceRecording',_0x1b5243,JSON[_0xdaeb('0x10')](_0x3cfcaf));_0x2d8f11(_0x3cfcaf);})['catch'](function(_0x130c35){logger[_0xdaeb('0x11')](_0xdaeb('0x15'),_0x130c35[_0xdaeb('0x12')],_0x1b5243);_0x36f9ac(_0x1fe84e[_0xdaeb('0x11')](0x1f4,_0x130c35['message']));});});};exports[_0xdaeb('0x1c')]=function(_0x34fa21){var _0x338687=this;return new Promise(function(_0x4eb719,_0x57c2c4){var _0x43095f=require('../../components/encryptor');var _0x5045f8;return db[_0xdaeb('0x1d')][_0xdaeb('0x1e')]({'attributes':['id',_0xdaeb('0x1f')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x5e6f97){_0x5045f8=_0x5e6f97;return db[_0xdaeb('0x20')][_0xdaeb('0x21')](_0x34fa21[_0xdaeb('0x22')]);})['then'](function(_0x36c933){if(_0x5045f8['callRecordingEncryption']&&fs['existsSync'](_0x36c933[_0xdaeb('0x23')])){var _0x21f6cf=util[_0xdaeb('0x24')](_0xdaeb('0x25'),_0x36c933[_0xdaeb('0x23')]);return _0x43095f[_0xdaeb('0x26')](_0x36c933[_0xdaeb('0x23')],_0x21f6cf,config['secrets'][_0xdaeb('0x27')])[_0xdaeb('0xc')](function(){fs[_0xdaeb('0x28')](_0x36c933[_0xdaeb('0x23')]);logger[_0xdaeb('0xd')]('CreateVoiceRecording\x20file\x20encrypted');return _0x36c933;});}return _0x36c933;})[_0xdaeb('0xc')](function(_0x3de2bd){logger['info'](_0xdaeb('0x1c'),_0x34fa21);logger[_0xdaeb('0x1b')](_0xdaeb('0x1c'),_0x34fa21,JSON[_0xdaeb('0x10')](_0x3de2bd));_0x4eb719(_0x3de2bd);})[_0xdaeb('0x14')](function(_0x1628b8){logger[_0xdaeb('0x11')](_0xdaeb('0x1c'),_0x1628b8[_0xdaeb('0x12')],_0x34fa21);_0x57c2c4(_0x338687[_0xdaeb('0x11')](0x1f4,_0x1628b8['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index a2676c0..993c924 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 _0xae39=['index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','express','Router','./voiceTransferReport.controller'];(function(_0x18e1eb,_0x531b8e){var _0x2f506e=function(_0xf05899){while(--_0xf05899){_0x18e1eb['push'](_0x18e1eb['shift']());}};_0x2f506e(++_0x531b8e);}(_0xae39,0x11b));var _0x9ae3=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xae39[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require(_0x9ae3('0x0'));var util=require(_0x9ae3('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9ae3('0x2'));var router=express[_0x9ae3('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(_0x9ae3('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0x9ae3('0x5')]);router[_0x9ae3('0x6')](_0x9ae3('0x7'),auth[_0x9ae3('0x8')](),controller[_0x9ae3('0x9')]);router[_0x9ae3('0x6')](_0x9ae3('0xa'),auth[_0x9ae3('0x8')](),controller[_0x9ae3('0xb')]);router[_0x9ae3('0xc')]('/',auth['isAuthenticated'](),controller[_0x9ae3('0xd')]);router[_0x9ae3('0xe')](_0x9ae3('0xa'),auth[_0x9ae3('0x8')](),controller[_0x9ae3('0xf')]);router[_0x9ae3('0x10')]('/:id',auth[_0x9ae3('0x8')](),controller[_0x9ae3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe63a=['describe','get','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','/describe'];(function(_0x1e9c15,_0x446c65){var _0xcfb0a9=function(_0x551fba){while(--_0x551fba){_0x1e9c15['push'](_0x1e9c15['shift']());}};_0xcfb0a9(++_0x446c65);}(_0xe63a,0x1e9));var _0xae63=function(_0x1287d8,_0x243ad3){_0x1287d8=_0x1287d8-0x0;var _0x3b5a20=_0xe63a[_0x1287d8];return _0x3b5a20;};'use strict';var multer=require(_0xae63('0x0'));var util=require(_0xae63('0x1'));var path=require('path');var timeout=require(_0xae63('0x2'));var express=require(_0xae63('0x3'));var router=express[_0xae63('0x4')]();var fs_extra=require(_0xae63('0x5'));var auth=require(_0xae63('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae63('0x7'));var controller=require(_0xae63('0x8'));router['get']('/',auth[_0xae63('0x9')](),controller['index']);router['get'](_0xae63('0xa'),auth[_0xae63('0x9')](),controller[_0xae63('0xb')]);router[_0xae63('0xc')]('/:id',auth[_0xae63('0x9')](),controller['show']);router[_0xae63('0xd')]('/',auth[_0xae63('0x9')](),controller[_0xae63('0xe')]);router[_0xae63('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xae63('0x10')]);router[_0xae63('0x11')]('/:id',auth[_0xae63('0x9')](),controller[_0xae63('0x12')]);module[_0xae63('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 1483dfe..0a317bc 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 _0x0f43=['exports','blind','STRING','ENUM','Yes','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0f43,0x8f));var _0x30f4=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x0f43[_0x4a53d];return _0x27410e;};'use strict';var Sequelize=require(_0x30f4('0x0'));var moment=require('moment');module[_0x30f4('0x1')]={'type':{'type':Sequelize['ENUM'](_0x30f4('0x2'),'attended')},'result':{'type':Sequelize[_0x30f4('0x3')]},'transfererchannel':{'type':Sequelize[_0x30f4('0x3')]},'transferercalleridnum':{'type':Sequelize[_0x30f4('0x3')]},'transferercalleridname':{'type':Sequelize[_0x30f4('0x3')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x30f4('0x3')]},'transfereraccountcode':{'type':Sequelize[_0x30f4('0x3')]},'transferercontext':{'type':Sequelize[_0x30f4('0x3')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize[_0x30f4('0x3')]},'transfereechannel':{'type':Sequelize[_0x30f4('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x30f4('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x30f4('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x30f4('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0x30f4('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x30f4('0x3')]},'transfereeexten':{'type':Sequelize[_0x30f4('0x3')]},'transfereelinkedid':{'type':Sequelize[_0x30f4('0x3')]},'isexternal':{'type':Sequelize[_0x30f4('0x4')](_0x30f4('0x5'),'No')},'context':{'type':Sequelize[_0x30f4('0x3')]},'extension':{'type':Sequelize[_0x30f4('0x3')]}}; \ No newline at end of file +var _0x4c1d=['exports','ENUM','blind','attended','STRING','Yes','sequelize','moment'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x4c1d,0x126));var _0xd4c1=function(_0x27d4bc,_0x2becaf){_0x27d4bc=_0x27d4bc-0x0;var _0x3cf262=_0x4c1d[_0x27d4bc];return _0x3cf262;};'use strict';var Sequelize=require(_0xd4c1('0x0'));var moment=require(_0xd4c1('0x1'));module[_0xd4c1('0x2')]={'type':{'type':Sequelize[_0xd4c1('0x3')](_0xd4c1('0x4'),_0xd4c1('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xd4c1('0x6')]},'transferercalleridnum':{'type':Sequelize[_0xd4c1('0x6')]},'transferercalleridname':{'type':Sequelize[_0xd4c1('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0xd4c1('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0xd4c1('0x6')]},'transfereraccountcode':{'type':Sequelize[_0xd4c1('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0xd4c1('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xd4c1('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0xd4c1('0x6')]},'transfereecalleridname':{'type':Sequelize[_0xd4c1('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xd4c1('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0xd4c1('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0xd4c1('0x6')]},'transfereecontext':{'type':Sequelize[_0xd4c1('0x6')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0xd4c1('0x6')]},'isexternal':{'type':Sequelize[_0xd4c1('0x3')](_0xd4c1('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 88e975e..b53e04b 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 _0xb1c3=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','name','send','map','rawAttributes','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','merge','options','VoiceTransferReport','includeAll','include','findAll','catch','params','keys','length','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x164e6c,_0xb23c7e){var _0x604034=function(_0x4707f7){while(--_0x4707f7){_0x164e6c['push'](_0x164e6c['shift']());}};_0x604034(++_0xb23c7e);}(_0xb1c3,0x105));var _0x3b1c=function(_0x97cb9a,_0x58a3d4){_0x97cb9a=_0x97cb9a-0x0;var _0x49f9b4=_0xb1c3[_0x97cb9a];return _0x49f9b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3b1c('0x0'));var jsonpatch=require(_0x3b1c('0x1'));var rp=require(_0x3b1c('0x2'));var moment=require(_0x3b1c('0x3'));var BPromise=require(_0x3b1c('0x4'));var Mustache=require(_0x3b1c('0x5'));var util=require(_0x3b1c('0x6'));var path=require(_0x3b1c('0x7'));var sox=require('sox');var csv=require(_0x3b1c('0x8'));var ejs=require(_0x3b1c('0x9'));var fs=require('fs');var fs_extra=require(_0x3b1c('0xa'));var _=require(_0x3b1c('0xb'));var squel=require(_0x3b1c('0xc'));var crypto=require(_0x3b1c('0xd'));var jsforce=require(_0x3b1c('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3b1c('0xf'));var Redis=require(_0x3b1c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3b1c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3b1c('0x12'))(_0x3b1c('0x13'));var utils=require(_0x3b1c('0x14'));var config=require(_0x3b1c('0x15'));var licenseUtil=require(_0x3b1c('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4fb7cd,_0x38d193){_0x38d193=_0x38d193||0xcc;return function(_0x384f9d){if(_0x384f9d){return _0x4fb7cd[_0x3b1c('0x17')](_0x38d193);}return _0x4fb7cd['status'](_0x38d193)[_0x3b1c('0x18')]();};}function respondWithResult(_0x59e110,_0x5ef352){_0x5ef352=_0x5ef352||0xc8;return function(_0x13c49d){if(_0x13c49d){return _0x59e110[_0x3b1c('0x19')](_0x5ef352)[_0x3b1c('0x1a')](_0x13c49d);}};}function respondWithFilteredResult(_0x2f4617,_0x5d69d5){return function(_0x57d13d){if(_0x57d13d){var _0x5bc1de=typeof _0x5d69d5[_0x3b1c('0x1b')]===_0x3b1c('0x1c')&&typeof _0x5d69d5[_0x3b1c('0x1d')]===_0x3b1c('0x1c');var _0x582349=_0x57d13d[_0x3b1c('0x1e')];var _0x3a3525=_0x5bc1de?0x0:_0x5d69d5['offset'];var _0x52e57b=_0x5bc1de?_0x57d13d[_0x3b1c('0x1e')]:_0x5d69d5[_0x3b1c('0x1b')]+_0x5d69d5[_0x3b1c('0x1d')];var _0x4cfaca;if(_0x52e57b>=_0x582349){_0x52e57b=_0x582349;_0x4cfaca=0xc8;}else{_0x4cfaca=0xce;}_0x2f4617['status'](_0x4cfaca);return _0x2f4617[_0x3b1c('0x1f')](_0x3b1c('0x20'),_0x3a3525+'-'+_0x52e57b+'/'+_0x582349)[_0x3b1c('0x1a')](_0x57d13d);}return null;};}function patchUpdates(_0x240273){return function(_0x2f6cd6){try{jsonpatch[_0x3b1c('0x21')](_0x2f6cd6,_0x240273,!![]);}catch(_0x40e74a){return BPromise[_0x3b1c('0x22')](_0x40e74a);}return _0x2f6cd6[_0x3b1c('0x23')]();};}function saveUpdates(_0x16c041,_0x591287){return function(_0x25f5e6){if(_0x25f5e6){return _0x25f5e6[_0x3b1c('0x24')](_0x16c041)[_0x3b1c('0x25')](function(_0xe010f7){return _0xe010f7;});}return null;};}function removeEntity(_0x574a1a,_0x3c7c5f){return function(_0x250c9e){if(_0x250c9e){return _0x250c9e['destroy']()[_0x3b1c('0x25')](function(){_0x574a1a[_0x3b1c('0x19')](0xcc)[_0x3b1c('0x18')]();});}};}function handleEntityNotFound(_0x178c9c,_0x28c8f8){return function(_0x6953b2){if(!_0x6953b2){_0x178c9c['sendStatus'](0x194);}return _0x6953b2;};}function handleError(_0x3c7382,_0x576d9e){_0x576d9e=_0x576d9e||0x1f4;return function(_0x2c9a36){logger['error'](_0x2c9a36['stack']);if(_0x2c9a36[_0x3b1c('0x26')]){delete _0x2c9a36[_0x3b1c('0x26')];}_0x3c7382[_0x3b1c('0x19')](_0x576d9e)[_0x3b1c('0x27')](_0x2c9a36);};}exports['index']=function(_0x5ef77f,_0x29e7d8){var _0x472b6b={},_0x3dbab5={},_0x38554f={'count':0x0,'rows':[]};var _0x152cfe=_[_0x3b1c('0x28')](db['VoiceTransferReport'][_0x3b1c('0x29')],function(_0x57bad2){return{'name':_0x57bad2['fieldName'],'type':_0x57bad2['type'][_0x3b1c('0x2a')]};});_0x3dbab5[_0x3b1c('0x2b')]=_[_0x3b1c('0x28')](_0x152cfe,_0x3b1c('0x26'));_0x3dbab5[_0x3b1c('0x2c')]=_['keys'](_0x5ef77f['query']);_0x3dbab5[_0x3b1c('0x2d')]=_[_0x3b1c('0x2e')](_0x3dbab5[_0x3b1c('0x2b')],_0x3dbab5['query']);_0x472b6b['attributes']=_[_0x3b1c('0x2e')](_0x3dbab5[_0x3b1c('0x2b')],qs[_0x3b1c('0x2f')](_0x5ef77f['query'][_0x3b1c('0x2f')]));_0x472b6b[_0x3b1c('0x30')]=_0x472b6b[_0x3b1c('0x30')]['length']?_0x472b6b['attributes']:_0x3dbab5[_0x3b1c('0x2b')];if(!_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x31')](_0x3b1c('0x32'))){_0x472b6b[_0x3b1c('0x1d')]=qs['limit'](_0x5ef77f[_0x3b1c('0x2c')]['limit']);_0x472b6b[_0x3b1c('0x1b')]=qs[_0x3b1c('0x1b')](_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x1b')]);}_0x472b6b[_0x3b1c('0x33')]=qs[_0x3b1c('0x34')](_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x34')]);_0x472b6b[_0x3b1c('0x35')]=qs[_0x3b1c('0x2d')](_[_0x3b1c('0x36')](_0x5ef77f[_0x3b1c('0x2c')],_0x3dbab5[_0x3b1c('0x2d')]),_0x152cfe);if(_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x37')]){_0x472b6b[_0x3b1c('0x35')]=_['merge'](_0x472b6b[_0x3b1c('0x35')],{'$or':_[_0x3b1c('0x28')](_0x152cfe,function(_0x13f42b){if(_0x13f42b[_0x3b1c('0x38')]!=='VIRTUAL'){var _0x124a7e={};_0x124a7e[_0x13f42b[_0x3b1c('0x26')]]={'$like':'%'+_0x5ef77f[_0x3b1c('0x2c')][_0x3b1c('0x37')]+'%'};return _0x124a7e;}})});}_0x472b6b=_[_0x3b1c('0x39')]({},_0x472b6b,_0x5ef77f[_0x3b1c('0x3a')]);var _0x73990a={'where':_0x472b6b[_0x3b1c('0x35')]};return db[_0x3b1c('0x3b')][_0x3b1c('0x1e')](_0x73990a)[_0x3b1c('0x25')](function(_0x46d952){_0x38554f[_0x3b1c('0x1e')]=_0x46d952;if(_0x5ef77f['query'][_0x3b1c('0x3c')]){_0x472b6b[_0x3b1c('0x3d')]=[{'all':!![]}];}return db[_0x3b1c('0x3b')][_0x3b1c('0x3e')](_0x472b6b);})['then'](function(_0x274f1d){_0x38554f['rows']=_0x274f1d;return _0x38554f;})['then'](respondWithFilteredResult(_0x29e7d8,_0x472b6b))[_0x3b1c('0x3f')](handleError(_0x29e7d8,null));};exports['show']=function(_0x1a227f,_0x4dc223){var _0x4774f9={'raw':!![],'where':{'id':_0x1a227f[_0x3b1c('0x40')]['id']}},_0xa4b845={};_0xa4b845[_0x3b1c('0x2b')]=_[_0x3b1c('0x41')](db['VoiceTransferReport']['rawAttributes']);_0xa4b845['query']=_[_0x3b1c('0x41')](_0x1a227f[_0x3b1c('0x2c')]);_0xa4b845[_0x3b1c('0x2d')]=_[_0x3b1c('0x2e')](_0xa4b845[_0x3b1c('0x2b')],_0xa4b845[_0x3b1c('0x2c')]);_0x4774f9['attributes']=_[_0x3b1c('0x2e')](_0xa4b845[_0x3b1c('0x2b')],qs[_0x3b1c('0x2f')](_0x1a227f[_0x3b1c('0x2c')][_0x3b1c('0x2f')]));_0x4774f9[_0x3b1c('0x30')]=_0x4774f9[_0x3b1c('0x30')][_0x3b1c('0x42')]?_0x4774f9[_0x3b1c('0x30')]:_0xa4b845[_0x3b1c('0x2b')];if(_0x1a227f[_0x3b1c('0x2c')][_0x3b1c('0x3c')]){_0x4774f9[_0x3b1c('0x3d')]=[{'all':!![]}];}_0x4774f9=_['merge']({},_0x4774f9,_0x1a227f[_0x3b1c('0x3a')]);return db[_0x3b1c('0x3b')][_0x3b1c('0x43')](_0x4774f9)['then'](handleEntityNotFound(_0x4dc223,null))[_0x3b1c('0x25')](respondWithResult(_0x4dc223,null))[_0x3b1c('0x3f')](handleError(_0x4dc223,null));};exports[_0x3b1c('0x44')]=function(_0x51badf,_0x1d99eb){return db[_0x3b1c('0x3b')][_0x3b1c('0x44')](_0x51badf[_0x3b1c('0x45')],{})['then'](respondWithResult(_0x1d99eb,0xc9))[_0x3b1c('0x3f')](handleError(_0x1d99eb,null));};exports[_0x3b1c('0x24')]=function(_0x3762e3,_0x18dea5){if(_0x3762e3[_0x3b1c('0x45')]['id']){delete _0x3762e3[_0x3b1c('0x45')]['id'];}return db['VoiceTransferReport'][_0x3b1c('0x43')]({'where':{'id':_0x3762e3[_0x3b1c('0x40')]['id']}})['then'](handleEntityNotFound(_0x18dea5,null))[_0x3b1c('0x25')](saveUpdates(_0x3762e3['body'],null))['then'](respondWithResult(_0x18dea5,null))['catch'](handleError(_0x18dea5,null));};exports[_0x3b1c('0x46')]=function(_0x1a2049,_0x2c4385){return db[_0x3b1c('0x3b')][_0x3b1c('0x43')]({'where':{'id':_0x1a2049[_0x3b1c('0x40')]['id']}})[_0x3b1c('0x25')](handleEntityNotFound(_0x2c4385,null))[_0x3b1c('0x25')](removeEntity(_0x2c4385,null))['catch'](handleError(_0x2c4385,null));};exports['describe']=function(_0x5eaab4,_0x160176){return db[_0x3b1c('0x3b')][_0x3b1c('0x47')]()[_0x3b1c('0x25')](respondWithResult(_0x160176,null))[_0x3b1c('0x3f')](handleError(_0x160176,null));}; \ No newline at end of file +var _0x5852=['lodash','squel','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','json','limit','undefined','offset','count','status','apply','reject','save','update','then','end','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','sort','pick','filter','VIRTUAL','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','merge','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x27031e,_0x1eb8cd){var _0xfd46b3=function(_0x9fdcf8){while(--_0x9fdcf8){_0x27031e['push'](_0x27031e['shift']());}};_0xfd46b3(++_0x1eb8cd);}(_0x5852,0xd4));var _0x2585=function(_0x3efc2b,_0x30e89e){_0x3efc2b=_0x3efc2b-0x0;var _0x143578=_0x5852[_0x3efc2b];return _0x143578;};'use strict';var emlformat=require(_0x2585('0x0'));var rimraf=require(_0x2585('0x1'));var zipdir=require(_0x2585('0x2'));var jsonpatch=require(_0x2585('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2585('0x4'));var util=require(_0x2585('0x5'));var path=require('path');var sox=require(_0x2585('0x6'));var csv=require(_0x2585('0x7'));var ejs=require(_0x2585('0x8'));var fs=require('fs');var fs_extra=require(_0x2585('0x9'));var _=require(_0x2585('0xa'));var squel=require(_0x2585('0xb'));var crypto=require('crypto');var jsforce=require(_0x2585('0xc'));var deskjs=require(_0x2585('0xd'));var toCsv=require(_0x2585('0x7'));var querystring=require('querystring');var Papa=require(_0x2585('0xe'));var Redis=require(_0x2585('0xf'));var authService=require(_0x2585('0x10'));var qs=require(_0x2585('0x11'));var as=require(_0x2585('0x12'));var hardwareService=require(_0x2585('0x13'));var logger=require(_0x2585('0x14'))(_0x2585('0x15'));var utils=require(_0x2585('0x16'));var config=require(_0x2585('0x17'));var licenseUtil=require(_0x2585('0x18'));var db=require(_0x2585('0x19'))['db'];function respondWithStatusCode(_0x31b685,_0x2467fa){_0x2467fa=_0x2467fa||0xcc;return function(_0x12539f){if(_0x12539f){return _0x31b685['sendStatus'](_0x2467fa);}return _0x31b685['status'](_0x2467fa)['end']();};}function respondWithResult(_0x2e326c,_0xff0335){_0xff0335=_0xff0335||0xc8;return function(_0x5901bc){if(_0x5901bc){return _0x2e326c['status'](_0xff0335)[_0x2585('0x1a')](_0x5901bc);}};}function respondWithFilteredResult(_0x426c3a,_0x1cefa2){return function(_0x3dbe0c){if(_0x3dbe0c){var _0x5183bf=typeof _0x1cefa2['offset']==='undefined'&&typeof _0x1cefa2[_0x2585('0x1b')]===_0x2585('0x1c');var _0x274ba1=_0x3dbe0c['count'];var _0x3f4920=_0x5183bf?0x0:_0x1cefa2[_0x2585('0x1d')];var _0xec8582=_0x5183bf?_0x3dbe0c[_0x2585('0x1e')]:_0x1cefa2[_0x2585('0x1d')]+_0x1cefa2[_0x2585('0x1b')];var _0x1dfef0;if(_0xec8582>=_0x274ba1){_0xec8582=_0x274ba1;_0x1dfef0=0xc8;}else{_0x1dfef0=0xce;}_0x426c3a[_0x2585('0x1f')](_0x1dfef0);return _0x426c3a['set']('Content-Range',_0x3f4920+'-'+_0xec8582+'/'+_0x274ba1)[_0x2585('0x1a')](_0x3dbe0c);}return null;};}function patchUpdates(_0x14a7ed){return function(_0x55c9d4){try{jsonpatch[_0x2585('0x20')](_0x55c9d4,_0x14a7ed,!![]);}catch(_0x57dae9){return BPromise[_0x2585('0x21')](_0x57dae9);}return _0x55c9d4[_0x2585('0x22')]();};}function saveUpdates(_0xb29003,_0x4cde85){return function(_0x51e2ae){if(_0x51e2ae){return _0x51e2ae[_0x2585('0x23')](_0xb29003)[_0x2585('0x24')](function(_0xde6774){return _0xde6774;});}return null;};}function removeEntity(_0x4c7e77,_0x47cbd0){return function(_0xe5ab75){if(_0xe5ab75){return _0xe5ab75['destroy']()[_0x2585('0x24')](function(){_0x4c7e77[_0x2585('0x1f')](0xcc)[_0x2585('0x25')]();});}};}function handleEntityNotFound(_0x6dfdfc,_0x129bda){return function(_0x40c014){if(!_0x40c014){_0x6dfdfc['sendStatus'](0x194);}return _0x40c014;};}function handleError(_0x39e518,_0x1d7719){_0x1d7719=_0x1d7719||0x1f4;return function(_0x5186f3){logger['error'](_0x5186f3[_0x2585('0x26')]);if(_0x5186f3[_0x2585('0x27')]){delete _0x5186f3[_0x2585('0x27')];}_0x39e518[_0x2585('0x1f')](_0x1d7719)['send'](_0x5186f3);};}exports[_0x2585('0x28')]=function(_0x2196e5,_0x56a77c){var _0x108f1f={},_0xb9a514={},_0x32e488={'count':0x0,'rows':[]};var _0x149ac8=_[_0x2585('0x29')](db['VoiceTransferReport'][_0x2585('0x2a')],function(_0x4091a1){return{'name':_0x4091a1[_0x2585('0x2b')],'type':_0x4091a1[_0x2585('0x2c')][_0x2585('0x2d')]};});_0xb9a514[_0x2585('0x2e')]=_['map'](_0x149ac8,'name');_0xb9a514[_0x2585('0x2f')]=_[_0x2585('0x30')](_0x2196e5[_0x2585('0x2f')]);_0xb9a514[_0x2585('0x31')]=_[_0x2585('0x32')](_0xb9a514[_0x2585('0x2e')],_0xb9a514['query']);_0x108f1f['attributes']=_[_0x2585('0x32')](_0xb9a514[_0x2585('0x2e')],qs[_0x2585('0x33')](_0x2196e5[_0x2585('0x2f')]['fields']));_0x108f1f[_0x2585('0x34')]=_0x108f1f[_0x2585('0x34')][_0x2585('0x35')]?_0x108f1f['attributes']:_0xb9a514[_0x2585('0x2e')];if(!_0x2196e5[_0x2585('0x2f')]['hasOwnProperty'](_0x2585('0x36'))){_0x108f1f[_0x2585('0x1b')]=qs[_0x2585('0x1b')](_0x2196e5[_0x2585('0x2f')]['limit']);_0x108f1f['offset']=qs[_0x2585('0x1d')](_0x2196e5[_0x2585('0x2f')][_0x2585('0x1d')]);}_0x108f1f['order']=qs['sort'](_0x2196e5['query'][_0x2585('0x37')]);_0x108f1f['where']=qs['filters'](_[_0x2585('0x38')](_0x2196e5[_0x2585('0x2f')],_0xb9a514[_0x2585('0x31')]),_0x149ac8);if(_0x2196e5['query'][_0x2585('0x39')]){_0x108f1f['where']=_['merge'](_0x108f1f['where'],{'$or':_[_0x2585('0x29')](_0x149ac8,function(_0xbf2f77){if(_0xbf2f77['type']!==_0x2585('0x3a')){var _0x41abe0={};_0x41abe0[_0xbf2f77[_0x2585('0x27')]]={'$like':'%'+_0x2196e5[_0x2585('0x2f')][_0x2585('0x39')]+'%'};return _0x41abe0;}})});}_0x108f1f=_['merge']({},_0x108f1f,_0x2196e5[_0x2585('0x3b')]);var _0x450592={'where':_0x108f1f['where']};return db[_0x2585('0x3c')][_0x2585('0x1e')](_0x450592)[_0x2585('0x24')](function(_0x45da09){_0x32e488['count']=_0x45da09;if(_0x2196e5['query'][_0x2585('0x3d')]){_0x108f1f[_0x2585('0x3e')]=[{'all':!![]}];}return db[_0x2585('0x3c')][_0x2585('0x3f')](_0x108f1f);})[_0x2585('0x24')](function(_0x573d9f){_0x32e488[_0x2585('0x40')]=_0x573d9f;return _0x32e488;})['then'](respondWithFilteredResult(_0x56a77c,_0x108f1f))[_0x2585('0x41')](handleError(_0x56a77c,null));};exports[_0x2585('0x42')]=function(_0x176c26,_0x3e9847){var _0x4ac073={'raw':!![],'where':{'id':_0x176c26['params']['id']}},_0x2eec85={};_0x2eec85[_0x2585('0x2e')]=_[_0x2585('0x30')](db['VoiceTransferReport']['rawAttributes']);_0x2eec85[_0x2585('0x2f')]=_['keys'](_0x176c26['query']);_0x2eec85[_0x2585('0x31')]=_[_0x2585('0x32')](_0x2eec85['model'],_0x2eec85[_0x2585('0x2f')]);_0x4ac073['attributes']=_[_0x2585('0x32')](_0x2eec85['model'],qs[_0x2585('0x33')](_0x176c26['query'][_0x2585('0x33')]));_0x4ac073['attributes']=_0x4ac073[_0x2585('0x34')]['length']?_0x4ac073[_0x2585('0x34')]:_0x2eec85[_0x2585('0x2e')];if(_0x176c26['query']['includeAll']){_0x4ac073['include']=[{'all':!![]}];}_0x4ac073=_[_0x2585('0x43')]({},_0x4ac073,_0x176c26[_0x2585('0x3b')]);return db[_0x2585('0x3c')][_0x2585('0x44')](_0x4ac073)['then'](handleEntityNotFound(_0x3e9847,null))[_0x2585('0x24')](respondWithResult(_0x3e9847,null))[_0x2585('0x41')](handleError(_0x3e9847,null));};exports['create']=function(_0x267e9c,_0x42c909){return db[_0x2585('0x3c')][_0x2585('0x45')](_0x267e9c[_0x2585('0x46')],{})[_0x2585('0x24')](respondWithResult(_0x42c909,0xc9))[_0x2585('0x41')](handleError(_0x42c909,null));};exports['update']=function(_0x44d0ad,_0x1d639a){if(_0x44d0ad[_0x2585('0x46')]['id']){delete _0x44d0ad[_0x2585('0x46')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x44d0ad[_0x2585('0x47')]['id']}})['then'](handleEntityNotFound(_0x1d639a,null))[_0x2585('0x24')](saveUpdates(_0x44d0ad[_0x2585('0x46')],null))[_0x2585('0x24')](respondWithResult(_0x1d639a,null))[_0x2585('0x41')](handleError(_0x1d639a,null));};exports[_0x2585('0x48')]=function(_0x73f0c6,_0x381bf6){return db[_0x2585('0x3c')]['find']({'where':{'id':_0x73f0c6[_0x2585('0x47')]['id']}})[_0x2585('0x24')](handleEntityNotFound(_0x381bf6,null))[_0x2585('0x24')](removeEntity(_0x381bf6,null))[_0x2585('0x41')](handleError(_0x381bf6,null));};exports['describe']=function(_0x2715e6,_0x1d92bc){return db[_0x2585('0x3c')][_0x2585('0x49')]()[_0x2585('0x24')](respondWithResult(_0x1d92bc,null))[_0x2585('0x41')](handleError(_0x1d92bc,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index b09890e..5cd1ac8 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 _0xeb49=['report_call_transfer','lodash','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xeb49,0x88));var _0x9eb4=function(_0x16ddf2,_0x250bd9){_0x16ddf2=_0x16ddf2-0x0;var _0x36b330=_0xeb49[_0x16ddf2];return _0x36b330;};'use strict';var _=require(_0x9eb4('0x0'));var util=require('util');var logger=require(_0x9eb4('0x1'))('api');var moment=require(_0x9eb4('0x2'));var BPromise=require('bluebird');var rp=require(_0x9eb4('0x3'));var fs=require('fs');var path=require(_0x9eb4('0x4'));var rimraf=require(_0x9eb4('0x5'));var config=require(_0x9eb4('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x46296f,_0x23eadf){return _0x46296f[_0x9eb4('0x7')]('VoiceTransferReport',attributes,{'tableName':_0x9eb4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa758=['request-promise','rimraf','../../config/environment','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger','api','bluebird'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0xa758,0xaf));var _0x8a75=function(_0x25f1de,_0x5e7881){_0x25f1de=_0x25f1de-0x0;var _0x2b5148=_0xa758[_0x25f1de];return _0x2b5148;};'use strict';var _=require(_0x8a75('0x0'));var util=require(_0x8a75('0x1'));var logger=require(_0x8a75('0x2'))(_0x8a75('0x3'));var moment=require('moment');var BPromise=require(_0x8a75('0x4'));var rp=require(_0x8a75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8a75('0x6'));var config=require(_0x8a75('0x7'));var attributes=require(_0x8a75('0x8'));module['exports']=function(_0xb11544,_0x4ae92e){return _0xb11544[_0x8a75('0x9')](_0x8a75('0xa'),attributes,{'tableName':_0x8a75('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 1f49587..3d874ba 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 _0x97fd=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','stringify','lodash','util','ioredis'];(function(_0xab126d,_0x5645f0){var _0x284a65=function(_0x14cd1b){while(--_0x14cd1b){_0xab126d['push'](_0xab126d['shift']());}};_0x284a65(++_0x5645f0);}(_0x97fd,0x192));var _0xd97f=function(_0x3e8e0c,_0x32561b){_0x3e8e0c=_0x3e8e0c-0x0;var _0x4793f3=_0x97fd[_0x3e8e0c];return _0x4793f3;};'use strict';var _=require(_0xd97f('0x0'));var util=require(_0xd97f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd97f('0x2'));var db=require(_0xd97f('0x3'))['db'];var utils=require(_0xd97f('0x4'));var logger=require(_0xd97f('0x5'))(_0xd97f('0x6'));var config=require(_0xd97f('0x7'));var jayson=require(_0xd97f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3be433,_0x6e2f2d,_0x5f5381){return new BPromise(function(_0x5676b3,_0x31388b){return client[_0xd97f('0x9')](_0x3be433,_0x5f5381)[_0xd97f('0xa')](function(_0x554025){logger['info'](_0xd97f('0xb'),_0x6e2f2d,_0xd97f('0xc'));logger[_0xd97f('0xd')](_0xd97f('0xe'),_0x6e2f2d,'request\x20sent',JSON['stringify'](_0x554025));if(_0x554025[_0xd97f('0xf')]){if(_0x554025[_0xd97f('0xf')][_0xd97f('0x10')]===0x1f4){logger['error'](_0xd97f('0xb'),_0x6e2f2d,_0x554025['error'][_0xd97f('0x11')]);return _0x31388b(_0x554025[_0xd97f('0xf')][_0xd97f('0x11')]);}logger[_0xd97f('0xf')](_0xd97f('0xb'),_0x6e2f2d,_0x554025[_0xd97f('0xf')][_0xd97f('0x11')]);return _0x5676b3(_0x554025[_0xd97f('0xf')][_0xd97f('0x11')]);}else{logger[_0xd97f('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x6e2f2d,'request\x20sent');_0x5676b3(_0x554025[_0xd97f('0x13')][_0xd97f('0x11')]);}})[_0xd97f('0x14')](function(_0x5c1705){logger[_0xd97f('0xf')](_0xd97f('0xb'),_0x6e2f2d,_0x5c1705);_0x31388b(_0x5c1705);});});}exports[_0xd97f('0x15')]=function(_0x24c574){var _0x39da38=this;return new Promise(function(_0x133021,_0xe5aea5){return db[_0xd97f('0x16')]['create'](_0x24c574[_0xd97f('0x17')],{'raw':_0x24c574['options']?_0x24c574[_0xd97f('0x18')][_0xd97f('0x19')]===undefined?!![]:![]:!![]})[_0xd97f('0xa')](function(_0x24cadc){logger[_0xd97f('0x12')](_0xd97f('0x15'),_0x24c574);logger[_0xd97f('0xd')](_0xd97f('0x15'),_0x24c574,JSON[_0xd97f('0x1a')](_0x24cadc));_0x133021(_0x24cadc);})[_0xd97f('0x14')](function(_0x1f502f){logger[_0xd97f('0xf')]('CreateVoiceTransferReport',_0x1f502f[_0xd97f('0x11')],_0x24c574);_0xe5aea5(_0x39da38[_0xd97f('0xf')](0x1f4,_0x1f502f['message']));});});}; \ No newline at end of file +var _0x670d=['stringify','error','code','VoiceTransferReport,\x20%s,\x20%s','message','result','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body','options','raw','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x670d,0x16c));var _0xd670=function(_0x18be40,_0x5a68b1){_0x18be40=_0x18be40-0x0;var _0xf75840=_0x670d[_0x18be40];return _0xf75840;};'use strict';var _=require(_0xd670('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd670('0x1'));var fs=require('fs');var Redis=require(_0xd670('0x2'));var db=require(_0xd670('0x3'))['db'];var utils=require(_0xd670('0x4'));var logger=require('../../config/logger')(_0xd670('0x5'));var config=require(_0xd670('0x6'));var jayson=require(_0xd670('0x7'));var client=jayson['client'][_0xd670('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x312129,_0x33d43d,_0x1c2ecd){return new BPromise(function(_0x109a0f,_0x567190){return client['request'](_0x312129,_0x1c2ecd)[_0xd670('0x9')](function(_0xdbb18f){logger[_0xd670('0xa')]('VoiceTransferReport,\x20%s,\x20%s',_0x33d43d,'request\x20sent');logger[_0xd670('0xb')](_0xd670('0xc'),_0x33d43d,_0xd670('0xd'),JSON[_0xd670('0xe')](_0xdbb18f));if(_0xdbb18f['error']){if(_0xdbb18f[_0xd670('0xf')][_0xd670('0x10')]===0x1f4){logger[_0xd670('0xf')](_0xd670('0x11'),_0x33d43d,_0xdbb18f[_0xd670('0xf')][_0xd670('0x12')]);return _0x567190(_0xdbb18f[_0xd670('0xf')][_0xd670('0x12')]);}logger[_0xd670('0xf')](_0xd670('0x11'),_0x33d43d,_0xdbb18f['error'][_0xd670('0x12')]);return _0x109a0f(_0xdbb18f['error'][_0xd670('0x12')]);}else{logger[_0xd670('0xa')](_0xd670('0x11'),_0x33d43d,_0xd670('0xd'));_0x109a0f(_0xdbb18f[_0xd670('0x13')]['message']);}})[_0xd670('0x14')](function(_0x5d97cc){logger['error'](_0xd670('0x11'),_0x33d43d,_0x5d97cc);_0x567190(_0x5d97cc);});});}exports[_0xd670('0x15')]=function(_0x56529f){var _0x5c4ecb=this;return new Promise(function(_0x695ef9,_0x420ec3){return db[_0xd670('0x16')][_0xd670('0x17')](_0x56529f[_0xd670('0x18')],{'raw':_0x56529f[_0xd670('0x19')]?_0x56529f[_0xd670('0x19')][_0xd670('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2c3306){logger[_0xd670('0xa')](_0xd670('0x15'),_0x56529f);logger[_0xd670('0xb')](_0xd670('0x15'),_0x56529f,JSON[_0xd670('0xe')](_0x2c3306));_0x695ef9(_0x2c3306);})[_0xd670('0x14')](function(_0x3c799a){logger[_0xd670('0xf')](_0xd670('0x15'),_0x3c799a[_0xd670('0x12')],_0x56529f);_0x420ec3(_0x5c4ecb[_0xd670('0xf')](0x1f4,_0x3c799a[_0xd670('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index a236384..9ffd9a9 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 _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0x17ec16,_0x2436e3){var _0x1f59f5=function(_0x165b75){while(--_0x165b75){_0x17ec16['push'](_0x17ec16['shift']());}};_0x1f59f5(++_0x2436e3);}(_0xe14d,0x1ee));var _0xde14=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xe14d[_0x47b58b];return _0x46bebe;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file +var _0xe14d=['hangup','answer','/hold','hold','/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','/originate','isAuthenticated','originate','post','/hangup','isWebrtcLicence'];(function(_0xe2e5a7,_0x213d71){var _0x1658e5=function(_0x12eb35){while(--_0x12eb35){_0xe2e5a7['push'](_0xe2e5a7['shift']());}};_0x1658e5(++_0x213d71);}(_0xe14d,0x1ee));var _0xde14=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe14d[_0x4ae625];return _0x31accf;};'use strict';var express=require(_0xde14('0x0'));var router=express[_0xde14('0x1')]();var auth=require(_0xde14('0x2'));var controller=require(_0xde14('0x3'));router['post'](_0xde14('0x4'),auth[_0xde14('0x5')](),auth['isWebrtcLicence'](),controller[_0xde14('0x6')]);router[_0xde14('0x7')](_0xde14('0x8'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xa')]);router['post']('/answer',auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xb')]);router[_0xde14('0x7')](_0xde14('0xc'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xd')]);router['post'](_0xde14('0xe'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0xf')]);router[_0xde14('0x7')](_0xde14('0x10'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x11')]);router[_0xde14('0x7')](_0xde14('0x12'),auth[_0xde14('0x5')](),auth[_0xde14('0x9')](),controller[_0xde14('0x13')]);module[_0xde14('0x14')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 0d225b0..8382ed1 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 _0x385e=['client','http','../../config/logger','ioredis','defaults','localhost','socket.io-emitter','redis','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','error','stack','name','send','status','NotFound','then','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','sessionId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','validate','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','originate\x20executed!','hangup\x20executed!','answer','answer\x20fired:','entityFound:','answer\x20executed!','hold','webbar:hold','unhold','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x385e,0x185));var _0xe385=function(_0x95411e,_0x38b4c3){_0x95411e=_0x95411e-0x0;var _0x2c8718=_0x385e[_0x95411e];return _0x2c8718;};'use strict';var path=require(_0xe385('0x0'));var fs=require('fs');var _=require(_0xe385('0x1'));var db=require(_0xe385('0x2'))['db'];var config=require(_0xe385('0x3'));var util=require('util');var BPromise=require(_0xe385('0x4'));var jayson=require(_0xe385('0x5'));var amiClient=jayson[_0xe385('0x6')][_0xe385('0x7')]({'port':0x232a});var logger=require(_0xe385('0x8'))('webbarapi');var Redis=require(_0xe385('0x9'));config['redis']=_[_0xe385('0xa')](config['redis'],{'host':_0xe385('0xb'),'port':0x18eb});var io=require(_0xe385('0xc'))(new Redis(config[_0xe385('0xd')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'callNumber':{'type':_0xe385('0x10'),'required':[!![],_0xe385('0x11')]},'callerId':{'type':'string'},'callbackUrl':{'type':_0xe385('0x10')}});var hangupValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xe385('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':_0xe385('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':_0xe385('0x10'),'required':[!![],_0xe385('0x12')]},'transferNumber':{'type':'string','required':[!![],_0xe385('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]},'sessionId':{'type':_0xe385('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xe385('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xe385('0xe'),'required':[!![],_0xe385('0xf')]}});function emit(_0x33fc67,_0x1f4f79,_0x168825){logger[_0xe385('0x14')](_0x33fc67,_0x1f4f79,JSON[_0xe385('0x15')](_0x168825));io['to'](_0x33fc67)[_0xe385('0x16')](_0x1f4f79,_0x168825);}function handleError(_0x817483){return function(_0x2e4210){console['log']('handleError:',_0x2e4210,_0x2e4210 instanceof RangeError);logger[_0xe385('0x17')](_0x2e4210[_0xe385('0x18')]);if(_0x2e4210 instanceof RangeError){if(_0x2e4210[_0xe385('0x19')]){delete _0x2e4210[_0xe385('0x19')];}_0x817483['status'](0x194)[_0xe385('0x1a')](_0x2e4210);}else{if(_0x2e4210[_0xe385('0x19')]){delete _0x2e4210[_0xe385('0x19')];}_0x817483[_0xe385('0x1b')](0x1f4)[_0xe385('0x1a')](_0x2e4210);}};}function checkError(){return function(_0x5ce257){if(!_0x5ce257){throw new RangeError(_0xe385('0x1c'));}return _0x5ce257;};}function respondWithRpcPromise(_0x64a61f,_0x4a79a6){return new BPromise(function(_0x30b1a2,_0x3342c3){var _0x38371c=amiClient;return _0x38371c['request'](_0x64a61f,_0x4a79a6)[_0xe385('0x1d')](function(_0x3a863a){if(_0x3a863a[_0xe385('0x17')]){if(_0x3a863a[_0xe385('0x17')]['code']===0x1f4){return _0x3342c3(_0x3a863a[_0xe385('0x17')][_0xe385('0x1e')]);}return _0x30b1a2(_0x3a863a[_0xe385('0x17')]['message']);}else{_0x30b1a2(_0x3a863a[_0xe385('0x1f')]);}})[_0xe385('0x20')](function(_0x8f6012){_0x3342c3(_0x8f6012);});});}function getAgent(_0x93363e){return db[_0xe385('0x21')][_0xe385('0x22')]({'where':{'id':_0x93363e,'role':_0xe385('0x23')}})['then'](checkError());}function getAgentCheckSession(_0x328a07,_0x1831d4){return new BPromise(function(_0x4200bb,_0x164faa){var _0x286d2e=respondWithRpcPromise(_0xe385('0x24'));var _0x45cec9=getAgent(_0x328a07);Promise[_0xe385('0x25')]([_0x286d2e,_0x45cec9])[_0xe385('0x1d')](function(_0x5db4a5){var _0x1667f7=_0x5db4a5[0x0];var _0x2e66c0=_0x5db4a5[0x1];var _0x279c9e=_[_0xe385('0x26')](_0x1667f7[_0xe385('0x27')],function(_0x83bacb){return _0x83bacb['UserId']==_0x2e66c0['id']&&_0x83bacb[_0xe385('0x28')]==_0x1831d4;});if(_0x279c9e[_0xe385('0x29')]==0x1){_0x4200bb(_0x2e66c0);}else{_0x164faa(new RangeError(_0xe385('0x2a')+_0x1831d4+_0xe385('0x2b')));}});});}exports[_0xe385('0x2c')]=function(_0x213c4c,_0x55cf7f){logger[_0xe385('0x14')](_0xe385('0x2d'),_0x213c4c['body']);var _0x380d9d=originateValidation[_0xe385('0x2e')](_0x213c4c[_0xe385('0x2f')]);if(_0x380d9d[_0xe385('0x29')]>0x0){return _0x55cf7f[_0xe385('0x1b')](0x190)[_0xe385('0x30')](_0x380d9d);}var _0x135338=_0x213c4c[_0xe385('0x2f')][_0xe385('0x31')];var _0x5654b5=_0x213c4c[_0xe385('0x2f')][_0xe385('0x32')];var _0x10ba44=_0x213c4c[_0xe385('0x2f')][_0xe385('0x33')];var _0x1139bb=_0x213c4c[_0xe385('0x2f')][_0xe385('0x34')];return getAgent(_0x135338)[_0xe385('0x1d')](function(_0x2cc80f){logger[_0xe385('0x14')]('entityFound:',_0x2cc80f[_0xe385('0x19')]);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x2cc80f[_0xe385('0x19')]),_0xe385('0x37'),{'callNumber':_0x5654b5,'callerId':_0x10ba44,'callbackUrl':_0x1139bb});return _0x55cf7f['status'](0xc8)['json']({'error':![],'message':_0xe385('0x38')});})[_0xe385('0x20')](handleError(_0x55cf7f));};exports['hangup']=function(_0x3c37d2,_0x3978a7){logger[_0xe385('0x14')]('hangup\x20fired:',_0x3c37d2['body']);var _0x526937=hangupValidation[_0xe385('0x2e')](_0x3c37d2[_0xe385('0x2f')]);if(_0x526937[_0xe385('0x29')]>0x0){return _0x3978a7[_0xe385('0x1b')](0x190)['json'](_0x526937);}var _0x11c8f6=_0x3c37d2[_0xe385('0x2f')][_0xe385('0x31')];var _0xf7478e=_0x3c37d2[_0xe385('0x2f')]['sessionId'];return getAgent(_0x11c8f6)[_0xe385('0x1d')](function(_0x462b0f){logger[_0xe385('0x14')]('entityFound:',_0x462b0f[_0xe385('0x19')]);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x462b0f[_0xe385('0x19')]),'webbar:hangup',{'sessionId':_0xf7478e});return _0x3978a7[_0xe385('0x1b')](0xc8)['json']({'error':![],'message':_0xe385('0x39')});})['catch'](handleError(_0x3978a7));};exports[_0xe385('0x3a')]=function(_0x1c3ddc,_0x1f2364){logger[_0xe385('0x14')](_0xe385('0x3b'),_0x1c3ddc[_0xe385('0x2f')]);var _0x1a34b1=answerValidation[_0xe385('0x2e')](_0x1c3ddc['body']);if(_0x1a34b1[_0xe385('0x29')]>0x0){return _0x1f2364[_0xe385('0x1b')](0x190)[_0xe385('0x30')](_0x1a34b1);}var _0x426965=_0x1c3ddc[_0xe385('0x2f')][_0xe385('0x31')];var _0x58273f=_0x1c3ddc['body'][_0xe385('0x28')];return getAgent(_0x426965)[_0xe385('0x1d')](function(_0x8cdec2){logger['info'](_0xe385('0x3c'),_0x8cdec2['name']);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x8cdec2[_0xe385('0x19')]),'webbar:answer',{'sessionId':_0x58273f});return _0x1f2364[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'error':![],'message':_0xe385('0x3d')});})[_0xe385('0x20')](handleError(_0x1f2364));};exports[_0xe385('0x3e')]=function(_0x1ae5c0,_0x1691c9){logger[_0xe385('0x14')]('hold\x20fired:',_0x1ae5c0[_0xe385('0x2f')]);var _0x49449a=holdValidation['validate'](_0x1ae5c0[_0xe385('0x2f')]);if(_0x49449a['length']>0x0){return _0x1691c9['status'](0x190)['json'](_0x49449a);}var _0x436564=_0x1ae5c0['body'][_0xe385('0x31')];var _0x3ade60=_0x1ae5c0['body'][_0xe385('0x28')];return getAgent(_0x436564)[_0xe385('0x1d')](function(_0x599deb){logger[_0xe385('0x14')](_0xe385('0x3c'),_0x599deb[_0xe385('0x19')]);emit(util['format'](_0xe385('0x36'),_0x599deb[_0xe385('0x19')]),_0xe385('0x3f'),{'sessionId':_0x3ade60});return _0x1691c9['status'](0xc8)[_0xe385('0x30')]({'error':![],'message':'hold\x20executed!'});})[_0xe385('0x20')](handleError(_0x1691c9));};exports[_0xe385('0x40')]=function(_0x39dd5f,_0x39cb03){logger['info']('unhold\x20fired:',_0x39dd5f[_0xe385('0x2f')]);var _0x926475=unholdValidation[_0xe385('0x2e')](_0x39dd5f[_0xe385('0x2f')]);if(_0x926475[_0xe385('0x29')]>0x0){return _0x39cb03[_0xe385('0x1b')](0x190)['json'](_0x926475);}var _0x41a2cf=_0x39dd5f[_0xe385('0x2f')]['userId'];var _0x3654f6=_0x39dd5f[_0xe385('0x2f')][_0xe385('0x28')];return getAgent(_0x41a2cf)['then'](function(_0xd366a3){logger[_0xe385('0x14')](_0xe385('0x3c'),_0xd366a3['name']);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0xd366a3[_0xe385('0x19')]),_0xe385('0x41'),{'sessionId':_0x3654f6});return _0x39cb03['status'](0xc8)['json']({'error':![],'message':_0xe385('0x42')});})[_0xe385('0x20')](handleError(_0x39cb03));};exports[_0xe385('0x43')]=function(_0x54654f,_0x4eb199){logger['info'](_0xe385('0x44'),_0x4eb199[_0xe385('0x2f')]);var _0x437b71=callsValidation['validate'](_0x54654f[_0xe385('0x2f')]);if(_0x437b71[_0xe385('0x29')]>0x0){return _0x4eb199['status'](0x190)['json'](_0x437b71);}var _0x2473ef=_0x54654f[_0xe385('0x2f')][_0xe385('0x31')];var _0x95ab36=respondWithRpcPromise(_0xe385('0x24'));var _0x2c7a86=getAgent(_0x2473ef);return Promise[_0xe385('0x25')]([_0x95ab36,_0x2c7a86])['then'](function(_0x46ed8b){var _0x55db13=_0x46ed8b[0x0];var _0x53440f=_0x46ed8b[0x1];var _0x4b4513=_[_0xe385('0x26')](_0x55db13[_0xe385('0x27')],function(_0x685487){return _0x685487[_0xe385('0x45')]==_0x53440f['id'];});return _0x4eb199[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'count':_0x4b4513['length'],'rows':_0x4b4513});})[_0xe385('0x20')](handleError(_0x4eb199));};exports[_0xe385('0x46')]=function(_0x24ee0e,_0x33ba6a){logger[_0xe385('0x14')](_0xe385('0x47'),_0x24ee0e['body']);var _0x5841d1=conferenceValidation[_0xe385('0x2e')](_0x24ee0e['body']);if(_0x5841d1[_0xe385('0x29')]>0x0){return _0x33ba6a[_0xe385('0x1b')](0x190)[_0xe385('0x30')](_0x5841d1);}var _0x48554b=_0x24ee0e[_0xe385('0x2f')]['userId'];return getAgent(_0x48554b)[_0xe385('0x1d')](function(_0x1918ad){logger[_0xe385('0x14')](_0xe385('0x3c'),_0x1918ad[_0xe385('0x19')]);emit(util['format'](_0xe385('0x36'),_0x1918ad['name']),_0xe385('0x48'));return _0x33ba6a[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'error':![],'message':_0xe385('0x49')});})[_0xe385('0x20')](handleError(_0x33ba6a));};exports[_0xe385('0x4a')]=function(_0x2c7860,_0x68750){logger[_0xe385('0x14')](_0xe385('0x4b'),_0x2c7860['body']);var _0x157dd5=transferValidation[_0xe385('0x2e')](_0x2c7860[_0xe385('0x2f')]);if(_0x157dd5[_0xe385('0x29')]>0x0){return _0x68750['status'](0x190)[_0xe385('0x30')](_0x157dd5);}var _0x16f1c7=_0x2c7860[_0xe385('0x2f')][_0xe385('0x31')];var _0x5be7e7=_0x2c7860['body']['sessionId'];var _0x4dceb3=_0x2c7860[_0xe385('0x2f')][_0xe385('0x4c')];return getAgent(_0x16f1c7)[_0xe385('0x1d')](function(_0x14e90b){logger[_0xe385('0x14')]('entityFound:',_0x14e90b[_0xe385('0x19')]);emit(util[_0xe385('0x35')](_0xe385('0x36'),_0x14e90b['name']),_0xe385('0x4d'),{'sessionId':_0x5be7e7,'transferNumber':_0x4dceb3});return _0x68750[_0xe385('0x1b')](0xc8)[_0xe385('0x30')]({'error':![],'message':_0xe385('0x4e')});})['catch'](handleError(_0x68750));}; \ No newline at end of file +var _0x3b3c=['webbar:conference','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','../../config/logger','webbarapi','ioredis','redis','defaults','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','emit','log','handleError:','error','stack','name','status','send','NotFound','then','code','message','findOne','agent','VoiceChannels','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','length','json','userId','callNumber','callerId','callbackUrl','user:%s','webbar:originate','originate\x20executed!','catch','hangup','hangup\x20fired:','entityFound:','format','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','calls','all','conference','conference\x20fired:'];(function(_0x5f0323,_0x44a8e3){var _0x3ff840=function(_0x3d9a27){while(--_0x3d9a27){_0x5f0323['push'](_0x5f0323['shift']());}};_0x3ff840(++_0x44a8e3);}(_0x3b3c,0x134));var _0xc3b3=function(_0x421791,_0x3625d8){_0x421791=_0x421791-0x0;var _0x495838=_0x3b3c[_0x421791];return _0x495838;};'use strict';var path=require(_0xc3b3('0x0'));var fs=require('fs');var _=require(_0xc3b3('0x1'));var db=require(_0xc3b3('0x2'))['db'];var config=require(_0xc3b3('0x3'));var util=require(_0xc3b3('0x4'));var BPromise=require(_0xc3b3('0x5'));var jayson=require(_0xc3b3('0x6'));var amiClient=jayson['client']['http']({'port':0x232a});var logger=require(_0xc3b3('0x7'))(_0xc3b3('0x8'));var Redis=require(_0xc3b3('0x9'));config[_0xc3b3('0xa')]=_[_0xc3b3('0xb')](config[_0xc3b3('0xa')],{'host':_0xc3b3('0xc'),'port':0x18eb});var io=require(_0xc3b3('0xd'))(new Redis(config['redis']));var Schema=require(_0xc3b3('0xe'));var originateValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],_0xc3b3('0x10')]},'callNumber':{'type':_0xc3b3('0x11'),'required':[!![],_0xc3b3('0x12')]},'callerId':{'type':'string'},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],_0xc3b3('0x10')]},'sessionId':{'type':_0xc3b3('0x11'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],_0xc3b3('0x10')]},'sessionId':{'type':_0xc3b3('0x11'),'required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0xc3b3('0x10')]},'sessionId':{'type':_0xc3b3('0x11'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc3b3('0x11'),'required':[!![],_0xc3b3('0x13')]}});var holdValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],_0xc3b3('0x10')]},'sessionId':{'type':'string','required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],_0xc3b3('0x10')]},'sessionId':{'type':_0xc3b3('0x11'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xc3b3('0xf'),'required':[!![],_0xc3b3('0x10')]}});function emit(_0x96cac4,_0x10872a,_0x494131){logger[_0xc3b3('0x14')](_0x96cac4,_0x10872a,JSON['stringify'](_0x494131));io['to'](_0x96cac4)[_0xc3b3('0x15')](_0x10872a,_0x494131);}function handleError(_0x199c9c){return function(_0x4d12d9){console[_0xc3b3('0x16')](_0xc3b3('0x17'),_0x4d12d9,_0x4d12d9 instanceof RangeError);logger[_0xc3b3('0x18')](_0x4d12d9[_0xc3b3('0x19')]);if(_0x4d12d9 instanceof RangeError){if(_0x4d12d9[_0xc3b3('0x1a')]){delete _0x4d12d9[_0xc3b3('0x1a')];}_0x199c9c[_0xc3b3('0x1b')](0x194)[_0xc3b3('0x1c')](_0x4d12d9);}else{if(_0x4d12d9[_0xc3b3('0x1a')]){delete _0x4d12d9[_0xc3b3('0x1a')];}_0x199c9c[_0xc3b3('0x1b')](0x1f4)[_0xc3b3('0x1c')](_0x4d12d9);}};}function checkError(){return function(_0x2fe69f){if(!_0x2fe69f){throw new RangeError(_0xc3b3('0x1d'));}return _0x2fe69f;};}function respondWithRpcPromise(_0x202140,_0x54e599){return new BPromise(function(_0x180f4c,_0x139a7b){var _0x1cf6bf=amiClient;return _0x1cf6bf['request'](_0x202140,_0x54e599)[_0xc3b3('0x1e')](function(_0x226adb){if(_0x226adb[_0xc3b3('0x18')]){if(_0x226adb['error'][_0xc3b3('0x1f')]===0x1f4){return _0x139a7b(_0x226adb[_0xc3b3('0x18')][_0xc3b3('0x20')]);}return _0x180f4c(_0x226adb['error'][_0xc3b3('0x20')]);}else{_0x180f4c(_0x226adb['result']);}})['catch'](function(_0xcdffb1){_0x139a7b(_0xcdffb1);});});}function getAgent(_0x25834c){return db['User'][_0xc3b3('0x21')]({'where':{'id':_0x25834c,'role':_0xc3b3('0x22')}})['then'](checkError());}function getAgentCheckSession(_0x54214a,_0x45d8d2){return new BPromise(function(_0x47845c,_0xbd8e37){var _0x504c80=respondWithRpcPromise(_0xc3b3('0x23'));var _0x151df1=getAgent(_0x54214a);Promise['all']([_0x504c80,_0x151df1])[_0xc3b3('0x1e')](function(_0xc20770){var _0xf6f28f=_0xc20770[0x0];var _0x540153=_0xc20770[0x1];var _0x1cc213=_['filter'](_0xf6f28f[_0xc3b3('0x24')],function(_0x2d4a7a){return _0x2d4a7a[_0xc3b3('0x25')]==_0x540153['id']&&_0x2d4a7a[_0xc3b3('0x26')]==_0x45d8d2;});if(_0x1cc213['length']==0x1){_0x47845c(_0x540153);}else{_0xbd8e37(new RangeError(_0xc3b3('0x27')+_0x45d8d2+_0xc3b3('0x28')));}});});}exports[_0xc3b3('0x29')]=function(_0x1030b7,_0x1da6b2){logger['info'](_0xc3b3('0x2a'),_0x1030b7[_0xc3b3('0x2b')]);var _0x50df96=originateValidation[_0xc3b3('0xe')](_0x1030b7['body']);if(_0x50df96[_0xc3b3('0x2c')]>0x0){return _0x1da6b2[_0xc3b3('0x1b')](0x190)[_0xc3b3('0x2d')](_0x50df96);}var _0x59ab3d=_0x1030b7[_0xc3b3('0x2b')][_0xc3b3('0x2e')];var _0x1d707a=_0x1030b7[_0xc3b3('0x2b')][_0xc3b3('0x2f')];var _0x257eba=_0x1030b7['body'][_0xc3b3('0x30')];var _0x4c18bf=_0x1030b7[_0xc3b3('0x2b')][_0xc3b3('0x31')];return getAgent(_0x59ab3d)[_0xc3b3('0x1e')](function(_0x3a390e){logger['info']('entityFound:',_0x3a390e[_0xc3b3('0x1a')]);emit(util['format'](_0xc3b3('0x32'),_0x3a390e[_0xc3b3('0x1a')]),_0xc3b3('0x33'),{'callNumber':_0x1d707a,'callerId':_0x257eba,'callbackUrl':_0x4c18bf});return _0x1da6b2[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'error':![],'message':_0xc3b3('0x34')});})[_0xc3b3('0x35')](handleError(_0x1da6b2));};exports[_0xc3b3('0x36')]=function(_0x133729,_0x218feb){logger[_0xc3b3('0x14')](_0xc3b3('0x37'),_0x133729['body']);var _0x2bb510=hangupValidation[_0xc3b3('0xe')](_0x133729[_0xc3b3('0x2b')]);if(_0x2bb510[_0xc3b3('0x2c')]>0x0){return _0x218feb[_0xc3b3('0x1b')](0x190)['json'](_0x2bb510);}var _0x43b6fb=_0x133729['body']['userId'];var _0x3d1191=_0x133729[_0xc3b3('0x2b')]['sessionId'];return getAgent(_0x43b6fb)[_0xc3b3('0x1e')](function(_0x5539b2){logger['info'](_0xc3b3('0x38'),_0x5539b2[_0xc3b3('0x1a')]);emit(util[_0xc3b3('0x39')](_0xc3b3('0x32'),_0x5539b2['name']),_0xc3b3('0x3a'),{'sessionId':_0x3d1191});return _0x218feb[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'error':![],'message':_0xc3b3('0x3b')});})[_0xc3b3('0x35')](handleError(_0x218feb));};exports[_0xc3b3('0x3c')]=function(_0x4633ad,_0x5f12bd){logger[_0xc3b3('0x14')]('answer\x20fired:',_0x4633ad['body']);var _0xba8f1d=answerValidation[_0xc3b3('0xe')](_0x4633ad[_0xc3b3('0x2b')]);if(_0xba8f1d[_0xc3b3('0x2c')]>0x0){return _0x5f12bd[_0xc3b3('0x1b')](0x190)[_0xc3b3('0x2d')](_0xba8f1d);}var _0x4e1a74=_0x4633ad[_0xc3b3('0x2b')][_0xc3b3('0x2e')];var _0x71b4ea=_0x4633ad['body']['sessionId'];return getAgent(_0x4e1a74)[_0xc3b3('0x1e')](function(_0x2aa725){logger[_0xc3b3('0x14')]('entityFound:',_0x2aa725[_0xc3b3('0x1a')]);emit(util[_0xc3b3('0x39')](_0xc3b3('0x32'),_0x2aa725['name']),_0xc3b3('0x3d'),{'sessionId':_0x71b4ea});return _0x5f12bd[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'error':![],'message':_0xc3b3('0x3e')});})[_0xc3b3('0x35')](handleError(_0x5f12bd));};exports[_0xc3b3('0x3f')]=function(_0x5ea45e,_0x432e89){logger[_0xc3b3('0x14')](_0xc3b3('0x40'),_0x5ea45e[_0xc3b3('0x2b')]);var _0x45008e=holdValidation[_0xc3b3('0xe')](_0x5ea45e['body']);if(_0x45008e[_0xc3b3('0x2c')]>0x0){return _0x432e89['status'](0x190)[_0xc3b3('0x2d')](_0x45008e);}var _0x23f025=_0x5ea45e[_0xc3b3('0x2b')][_0xc3b3('0x2e')];var _0x1b98d1=_0x5ea45e[_0xc3b3('0x2b')][_0xc3b3('0x26')];return getAgent(_0x23f025)[_0xc3b3('0x1e')](function(_0x29c657){logger['info'](_0xc3b3('0x38'),_0x29c657[_0xc3b3('0x1a')]);emit(util['format'](_0xc3b3('0x32'),_0x29c657[_0xc3b3('0x1a')]),_0xc3b3('0x41'),{'sessionId':_0x1b98d1});return _0x432e89[_0xc3b3('0x1b')](0xc8)['json']({'error':![],'message':_0xc3b3('0x42')});})['catch'](handleError(_0x432e89));};exports['unhold']=function(_0x3e87a8,_0x2b178d){logger['info']('unhold\x20fired:',_0x3e87a8['body']);var _0x4ae11c=unholdValidation[_0xc3b3('0xe')](_0x3e87a8[_0xc3b3('0x2b')]);if(_0x4ae11c[_0xc3b3('0x2c')]>0x0){return _0x2b178d['status'](0x190)[_0xc3b3('0x2d')](_0x4ae11c);}var _0x35b68b=_0x3e87a8[_0xc3b3('0x2b')][_0xc3b3('0x2e')];var _0x260225=_0x3e87a8['body'][_0xc3b3('0x26')];return getAgent(_0x35b68b)[_0xc3b3('0x1e')](function(_0x1d9d90){logger['info'](_0xc3b3('0x38'),_0x1d9d90[_0xc3b3('0x1a')]);emit(util[_0xc3b3('0x39')](_0xc3b3('0x32'),_0x1d9d90[_0xc3b3('0x1a')]),_0xc3b3('0x43'),{'sessionId':_0x260225});return _0x2b178d[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0xc3b3('0x35')](handleError(_0x2b178d));};exports[_0xc3b3('0x44')]=function(_0x1d09b0,_0x3f8bef){logger['info']('calls\x20fired:',_0x3f8bef[_0xc3b3('0x2b')]);var _0x101a9b=callsValidation[_0xc3b3('0xe')](_0x1d09b0[_0xc3b3('0x2b')]);if(_0x101a9b[_0xc3b3('0x2c')]>0x0){return _0x3f8bef['status'](0x190)['json'](_0x101a9b);}var _0x3666d3=_0x1d09b0[_0xc3b3('0x2b')][_0xc3b3('0x2e')];var _0x1963d9=respondWithRpcPromise(_0xc3b3('0x23'));var _0x26925b=getAgent(_0x3666d3);return Promise[_0xc3b3('0x45')]([_0x1963d9,_0x26925b])['then'](function(_0x31e570){var _0x2884f3=_0x31e570[0x0];var _0x2435b5=_0x31e570[0x1];var _0x96ccee=_['filter'](_0x2884f3[_0xc3b3('0x24')],function(_0x3d504f){return _0x3d504f[_0xc3b3('0x25')]==_0x2435b5['id'];});return _0x3f8bef[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'count':_0x96ccee['length'],'rows':_0x96ccee});})[_0xc3b3('0x35')](handleError(_0x3f8bef));};exports[_0xc3b3('0x46')]=function(_0x5b6bd3,_0x297cee){logger[_0xc3b3('0x14')](_0xc3b3('0x47'),_0x5b6bd3[_0xc3b3('0x2b')]);var _0x420894=conferenceValidation[_0xc3b3('0xe')](_0x5b6bd3[_0xc3b3('0x2b')]);if(_0x420894['length']>0x0){return _0x297cee[_0xc3b3('0x1b')](0x190)[_0xc3b3('0x2d')](_0x420894);}var _0x2e3a59=_0x5b6bd3[_0xc3b3('0x2b')]['userId'];return getAgent(_0x2e3a59)[_0xc3b3('0x1e')](function(_0x293d3c){logger[_0xc3b3('0x14')](_0xc3b3('0x38'),_0x293d3c[_0xc3b3('0x1a')]);emit(util[_0xc3b3('0x39')](_0xc3b3('0x32'),_0x293d3c['name']),_0xc3b3('0x48'));return _0x297cee[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'error':![],'message':'conference\x20executed!'});})['catch'](handleError(_0x297cee));};exports['transfer']=function(_0x2f487b,_0x49856e){logger[_0xc3b3('0x14')]('transfer\x20fired:',_0x2f487b[_0xc3b3('0x2b')]);var _0x44afc8=transferValidation[_0xc3b3('0xe')](_0x2f487b[_0xc3b3('0x2b')]);if(_0x44afc8['length']>0x0){return _0x49856e[_0xc3b3('0x1b')](0x190)['json'](_0x44afc8);}var _0x41d556=_0x2f487b[_0xc3b3('0x2b')][_0xc3b3('0x2e')];var _0x4bd7ec=_0x2f487b[_0xc3b3('0x2b')]['sessionId'];var _0x5753d0=_0x2f487b['body'][_0xc3b3('0x49')];return getAgent(_0x41d556)[_0xc3b3('0x1e')](function(_0x29a354){logger[_0xc3b3('0x14')](_0xc3b3('0x38'),_0x29a354['name']);emit(util['format'](_0xc3b3('0x32'),_0x29a354[_0xc3b3('0x1a')]),_0xc3b3('0x4a'),{'sessionId':_0x4bd7ec,'transferNumber':_0x5753d0});return _0x49856e[_0xc3b3('0x1b')](0xc8)[_0xc3b3('0x2d')]({'error':![],'message':_0xc3b3('0x4b')});})['catch'](handleError(_0x49856e));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 7ab9905..103d4e7 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 _0x13a6=['post','create','addDisposition','/:id/canned_answers','/:id/notify','notify','/:id/send','send','put','/:id','update','destroy','removeAnswers','delete','removeAgents','exports','multer','util','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','getAnswers','/:id/users','/:id/applications','getApplications'];(function(_0x3dc1e9,_0x20484c){var _0x1a8e32=function(_0x3248a1){while(--_0x3248a1){_0x3dc1e9['push'](_0x3dc1e9['shift']());}};_0x1a8e32(++_0x20484c);}(_0x13a6,0x140));var _0x613a=function(_0x4677ee,_0x5d58dd){_0x4677ee=_0x4677ee-0x0;var _0x3dda22=_0x13a6[_0x4677ee];return _0x3dda22;};'use strict';var multer=require(_0x613a('0x0'));var util=require(_0x613a('0x1'));var path=require('path');var timeout=require(_0x613a('0x2'));var express=require(_0x613a('0x3'));var router=express[_0x613a('0x4')]();var fs_extra=require(_0x613a('0x5'));var auth=require(_0x613a('0x6'));var interaction=require(_0x613a('0x7'));var config=require(_0x613a('0x8'));var controller=require(_0x613a('0x9'));router[_0x613a('0xa')]('/',auth[_0x613a('0xb')](),controller[_0x613a('0xc')]);router[_0x613a('0xa')](_0x613a('0xd'),auth[_0x613a('0xb')](),controller[_0x613a('0xe')]);router['get']('/:id',auth[_0x613a('0xb')](),controller[_0x613a('0xf')]);router[_0x613a('0xa')](_0x613a('0x10'),auth[_0x613a('0xb')](),controller[_0x613a('0x11')]);router[_0x613a('0xa')]('/:id/canned_answers',auth[_0x613a('0xb')](),controller[_0x613a('0x12')]);router['get'](_0x613a('0x13'),auth[_0x613a('0xb')](),controller['getAgents']);router[_0x613a('0xa')](_0x613a('0x14'),auth[_0x613a('0xb')](),controller[_0x613a('0x15')]);router[_0x613a('0x16')]('/',auth['isAuthenticated'](),controller[_0x613a('0x17')]);router['post'](_0x613a('0x10'),auth[_0x613a('0xb')](),controller[_0x613a('0x18')]);router[_0x613a('0x16')](_0x613a('0x19'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x613a('0x16')]('/:id/users',auth[_0x613a('0xb')](),controller['addAgents']);router['post'](_0x613a('0x14'),auth[_0x613a('0xb')](),controller['addApplications']);router[_0x613a('0x16')](_0x613a('0x1a'),controller[_0x613a('0x1b')]);router['post'](_0x613a('0x1c'),auth[_0x613a('0xb')](),controller[_0x613a('0x1d')]);router[_0x613a('0x1e')](_0x613a('0x1f'),auth['isAuthenticated'](),controller[_0x613a('0x20')]);router['delete'](_0x613a('0x1f'),auth[_0x613a('0xb')](),controller[_0x613a('0x21')]);router['delete']('/:id/dispositions',auth[_0x613a('0xb')](),controller['removeDispositions']);router['delete'](_0x613a('0x19'),auth['isAuthenticated'](),controller[_0x613a('0x22')]);router[_0x613a('0x23')](_0x613a('0x13'),auth[_0x613a('0xb')](),controller[_0x613a('0x24')]);module[_0x613a('0x25')]=router; \ No newline at end of file +var _0xe261=['/:id/canned_answers','getAnswers','/:id/users','getApplications','post','create','/:id/dispositions','addAnswer','addAgents','/:id/applications','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show','getDispositions'];(function(_0x289c1e,_0x1b3421){var _0x58555c=function(_0x581655){while(--_0x581655){_0x289c1e['push'](_0x289c1e['shift']());}};_0x58555c(++_0x1b3421);}(_0xe261,0x135));var _0x1e26=function(_0x103146,_0x197f95){_0x103146=_0x103146-0x0;var _0x499d01=_0xe261[_0x103146];return _0x499d01;};'use strict';var multer=require(_0x1e26('0x0'));var util=require(_0x1e26('0x1'));var path=require(_0x1e26('0x2'));var timeout=require(_0x1e26('0x3'));var express=require('express');var router=express[_0x1e26('0x4')]();var fs_extra=require(_0x1e26('0x5'));var auth=require(_0x1e26('0x6'));var interaction=require(_0x1e26('0x7'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x1e26('0x8')]('/',auth[_0x1e26('0x9')](),controller[_0x1e26('0xa')]);router[_0x1e26('0x8')]('/describe',auth[_0x1e26('0x9')](),controller[_0x1e26('0xb')]);router['get'](_0x1e26('0xc'),auth[_0x1e26('0x9')](),controller[_0x1e26('0xd')]);router[_0x1e26('0x8')]('/:id/dispositions',auth[_0x1e26('0x9')](),controller[_0x1e26('0xe')]);router['get'](_0x1e26('0xf'),auth[_0x1e26('0x9')](),controller[_0x1e26('0x10')]);router[_0x1e26('0x8')](_0x1e26('0x11'),auth[_0x1e26('0x9')](),controller['getAgents']);router[_0x1e26('0x8')]('/:id/applications',auth[_0x1e26('0x9')](),controller[_0x1e26('0x12')]);router[_0x1e26('0x13')]('/',auth['isAuthenticated'](),controller[_0x1e26('0x14')]);router['post'](_0x1e26('0x15'),auth[_0x1e26('0x9')](),controller['addDisposition']);router[_0x1e26('0x13')](_0x1e26('0xf'),auth[_0x1e26('0x9')](),controller[_0x1e26('0x16')]);router[_0x1e26('0x13')](_0x1e26('0x11'),auth[_0x1e26('0x9')](),controller[_0x1e26('0x17')]);router[_0x1e26('0x13')](_0x1e26('0x18'),auth[_0x1e26('0x9')](),controller[_0x1e26('0x19')]);router[_0x1e26('0x13')](_0x1e26('0x1a'),controller[_0x1e26('0x1b')]);router[_0x1e26('0x13')](_0x1e26('0x1c'),auth[_0x1e26('0x9')](),controller[_0x1e26('0x1d')]);router[_0x1e26('0x1e')](_0x1e26('0xc'),auth[_0x1e26('0x9')](),controller[_0x1e26('0x1f')]);router[_0x1e26('0x20')](_0x1e26('0xc'),auth['isAuthenticated'](),controller['destroy']);router[_0x1e26('0x20')]('/:id/dispositions',auth[_0x1e26('0x9')](),controller[_0x1e26('0x21')]);router[_0x1e26('0x20')](_0x1e26('0xf'),auth[_0x1e26('0x9')](),controller['removeAnswers']);router[_0x1e26('0x20')]('/:id/users',auth[_0x1e26('0x9')](),controller[_0x1e26('0x22')]);module[_0x1e26('0x23')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 66cd134..6f77742 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 _0xb410=['sequelize','randomstring','STRING','name','generate','twilio','sinch','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition'];(function(_0xff9cb,_0x1b45d7){var _0x455a53=function(_0x50cd1b){while(--_0x50cd1b){_0xff9cb['push'](_0xff9cb['shift']());}};_0x455a53(++_0x1b45d7);}(_0xb410,0x96));var _0x0b41=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xb410[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require(_0x0b41('0x0'));var rs=require(_0x0b41('0x1'));module['exports']={'name':{'type':Sequelize[_0x0b41('0x2')],'unique':_0x0b41('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x0b41('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x0b41('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x0b41('0x2')],'defaultValue':function(){return rs[_0x0b41('0x4')]();}},'phone':{'type':Sequelize[_0x0b41('0x2')]},'type':{'type':Sequelize['ENUM'](_0x0b41('0x5'),_0x0b41('0x6'))},'accountSid':{'type':Sequelize[_0x0b41('0x2')]},'baseUrl':{'type':Sequelize[_0x0b41('0x2')]},'authToken':{'type':Sequelize[_0x0b41('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x0b41('0x7');}},'notificationSound':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0b41('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x0b41('0xa')},'mandatoryDisposition':{'type':Sequelize[_0x0b41('0x8')],'defaultValue':![],'comment':_0x0b41('0xb'),'set':function(_0x5cff8e){if(!_0x5cff8e){this[_0x0b41('0xc')](_0x0b41('0xd'),null);}this['setDataValue'](_0x0b41('0xe'),_0x5cff8e);}},'description':{'type':Sequelize[_0x0b41('0x2')]}}; \ No newline at end of file +var _0x9f1c=['INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN'];(function(_0x58a501,_0x529159){var _0x1d48a8=function(_0x44fe5b){while(--_0x44fe5b){_0x58a501['push'](_0x58a501['shift']());}};_0x1d48a8(++_0x529159);}(_0x9f1c,0x106));var _0xc9f1=function(_0x146dc3,_0x55a2f9){_0x146dc3=_0x146dc3-0x0;var _0x1e236c=_0x9f1c[_0x146dc3];return _0x1e236c;};'use strict';var Sequelize=require(_0xc9f1('0x0'));var rs=require(_0xc9f1('0x1'));module['exports']={'name':{'type':Sequelize[_0xc9f1('0x2')],'unique':_0xc9f1('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0xc9f1('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0xc9f1('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0xc9f1('0x2')],'defaultValue':function(){return rs[_0xc9f1('0x4')]();}},'phone':{'type':Sequelize[_0xc9f1('0x2')]},'type':{'type':Sequelize[_0xc9f1('0x5')]('twilio',_0xc9f1('0x6'))},'accountSid':{'type':Sequelize[_0xc9f1('0x2')]},'baseUrl':{'type':Sequelize[_0xc9f1('0x2')]},'authToken':{'type':Sequelize[_0xc9f1('0x2')]},'notificationTemplate':{'type':Sequelize[_0xc9f1('0x7')],'defaultValue':function(){return _0xc9f1('0x8');}},'notificationSound':{'type':Sequelize[_0xc9f1('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xc9f1('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xc9f1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc9f1('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc9f1('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc9f1('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc9f1('0xa')],'comment':_0xc9f1('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xc9f1('0x9')],'defaultValue':![],'comment':_0xc9f1('0xc'),'set':function(_0x250595){if(!_0x250595){this[_0xc9f1('0xd')](_0xc9f1('0xe'),null);}this['setDataValue'](_0xc9f1('0xf'),_0x250595);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 2670153..2e4b44d 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 _0xc7d5=['rawAttributes','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','User','getAgents','transaction','sequelize','Transaction','ISOLATION_LEVELS','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','mobile','twilio','from','From','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','CmContact','Contacts','DESC','omit','contact','WhatsappInteraction','autoclose','push','close','unmanaged','*,*,*,*','created','ContactId','interaction','UserId','unshift','agent','queueId','queue','Start','startRouting','receiveMessage','info','entity\x20found','stringify','Content-Type','text/xml','\x0a','List','user','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','request','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','get','WhatsappAccounts','UserProfileResource','end','stack','name','index','Pause','mandatoryDispositionPause','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','WhatsappAccount','includeAll','include','rows','show','params','keys'];(function(_0x25fc41,_0x250864){var _0x1371d1=function(_0x8ab2e3){while(--_0x8ab2e3){_0x25fc41['push'](_0x25fc41['shift']());}};_0x1371d1(++_0x250864);}(_0xc7d5,0x6b));var _0x5c7d=function(_0x59bdf1,_0x4e41af){_0x59bdf1=_0x59bdf1-0x0;var _0x8f49=_0xc7d5[_0x59bdf1];return _0x8f49;};'use strict';var emlformat=require(_0x5c7d('0x0'));var rimraf=require(_0x5c7d('0x1'));var zipdir=require(_0x5c7d('0x2'));var jsonpatch=require(_0x5c7d('0x3'));var rp=require(_0x5c7d('0x4'));var moment=require(_0x5c7d('0x5'));var BPromise=require(_0x5c7d('0x6'));var Mustache=require('mustache');var util=require(_0x5c7d('0x7'));var path=require(_0x5c7d('0x8'));var sox=require(_0x5c7d('0x9'));var csv=require(_0x5c7d('0xa'));var ejs=require(_0x5c7d('0xb'));var fs=require('fs');var fs_extra=require(_0x5c7d('0xc'));var _=require(_0x5c7d('0xd'));var squel=require(_0x5c7d('0xe'));var crypto=require(_0x5c7d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x5c7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x5c7d('0x11'));var Papa=require(_0x5c7d('0x12'));var Redis=require(_0x5c7d('0x13'));var authService=require(_0x5c7d('0x14'));var qs=require(_0x5c7d('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c7d('0x16'));var logger=require(_0x5c7d('0x17'))('api');var utils=require(_0x5c7d('0x18'));var config=require(_0x5c7d('0x19'));var licenseUtil=require(_0x5c7d('0x1a'));var db=require(_0x5c7d('0x1b'))['db'];config[_0x5c7d('0x1c')]=_[_0x5c7d('0x1d')](config[_0x5c7d('0x1c')],{'host':_0x5c7d('0x1e'),'port':0x18eb});var socket=require(_0x5c7d('0x1f'))(new Redis(config[_0x5c7d('0x1c')]));require(_0x5c7d('0x20'))[_0x5c7d('0x21')](socket);var jayson=require(_0x5c7d('0x22'));var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x1deffa,_0x382ffb,_0x406154,_0x3052a7){return new BPromise(function(_0x662a7e,_0x5911f7){var _0xe6a845=_0x3052a7||client;return _0xe6a845[_0x5c7d('0x23')](_0x1deffa,_0x406154)['then'](function(_0x19c8b0){logger['info'](_0x5c7d('0x24'),_0x382ffb,'request\x20sent');logger[_0x5c7d('0x25')](_0x5c7d('0x26'),_0x382ffb,_0x5c7d('0x27'),JSON['stringify'](_0x19c8b0));if(_0x19c8b0[_0x5c7d('0x28')]){if(_0x19c8b0[_0x5c7d('0x28')][_0x5c7d('0x29')]===0x1f4){logger['error'](_0x5c7d('0x24'),_0x382ffb,_0x19c8b0[_0x5c7d('0x28')][_0x5c7d('0x2a')]);return _0x5911f7(_0x19c8b0[_0x5c7d('0x28')]['message']);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x382ffb,_0x19c8b0[_0x5c7d('0x28')][_0x5c7d('0x2a')]);return _0x662a7e(_0x19c8b0[_0x5c7d('0x28')]['message']);}else{logger['info'](_0x5c7d('0x24'),_0x382ffb,_0x5c7d('0x27'));_0x662a7e(_0x19c8b0[_0x5c7d('0x2b')][_0x5c7d('0x2a')]);}})[_0x5c7d('0x2c')](function(_0x312a07){logger['error'](_0x5c7d('0x24'),_0x382ffb,_0x312a07);_0x5911f7(_0x312a07);});});}function respondWithStatusCode(_0x15f4ff,_0x1355ee){_0x1355ee=_0x1355ee||0xcc;return function(_0xc8cd58){if(_0xc8cd58){return _0x15f4ff['sendStatus'](_0x1355ee);}return _0x15f4ff[_0x5c7d('0x2d')](_0x1355ee)['end']();};}function respondWithResult(_0x4a62e5,_0x23d19f){_0x23d19f=_0x23d19f||0xc8;return function(_0x4a9b27){if(_0x4a9b27){return _0x4a62e5[_0x5c7d('0x2d')](_0x23d19f)['json'](_0x4a9b27);}};}function respondWithFilteredResult(_0x4c5bdf,_0x5828ae){return function(_0x307480){if(_0x307480){var _0x4b85bd=typeof _0x5828ae[_0x5c7d('0x2e')]===_0x5c7d('0x2f')&&typeof _0x5828ae[_0x5c7d('0x30')]===_0x5c7d('0x2f');var _0x56e90a=_0x307480[_0x5c7d('0x31')];var _0x30d733=_0x4b85bd?0x0:_0x5828ae[_0x5c7d('0x2e')];var _0x372d83=_0x4b85bd?_0x307480[_0x5c7d('0x31')]:_0x5828ae[_0x5c7d('0x2e')]+_0x5828ae['limit'];var _0x4e24ad;if(_0x372d83>=_0x56e90a){_0x372d83=_0x56e90a;_0x4e24ad=0xc8;}else{_0x4e24ad=0xce;}_0x4c5bdf[_0x5c7d('0x2d')](_0x4e24ad);return _0x4c5bdf[_0x5c7d('0x32')](_0x5c7d('0x33'),_0x30d733+'-'+_0x372d83+'/'+_0x56e90a)[_0x5c7d('0x34')](_0x307480);}return null;};}function patchUpdates(_0x3278c8){return function(_0x59aa6f){try{jsonpatch[_0x5c7d('0x35')](_0x59aa6f,_0x3278c8,!![]);}catch(_0x44357e){return BPromise['reject'](_0x44357e);}return _0x59aa6f[_0x5c7d('0x36')]();};}function saveUpdates(_0x4701ed,_0x537323){return function(_0x442a03){if(_0x442a03){return _0x442a03['update'](_0x4701ed)[_0x5c7d('0x37')](function(_0x2aaa4d){return _0x2aaa4d;});}return null;};}function removeEntity(_0x32964d,_0x18a20e){return function(_0x42b816){if(_0x42b816){return _0x42b816[_0x5c7d('0x38')]()[_0x5c7d('0x37')](function(){var _0x5a8968=_0x42b816[_0x5c7d('0x39')]({'plain':!![]});var _0x330963=_0x5c7d('0x3a');return db[_0x5c7d('0x3b')]['destroy']({'where':{'type':_0x330963,'resourceId':_0x5a8968['id']}})['then'](function(){return _0x42b816;});})[_0x5c7d('0x37')](function(){_0x32964d[_0x5c7d('0x2d')](0xcc)[_0x5c7d('0x3c')]();});}};}function handleEntityNotFound(_0x4a3e69,_0x530793){return function(_0x379f94){if(!_0x379f94){_0x4a3e69['sendStatus'](0x194);}return _0x379f94;};}function handleError(_0x6f571b,_0x10de4d){_0x10de4d=_0x10de4d||0x1f4;return function(_0x3f6cdb){logger[_0x5c7d('0x28')](_0x3f6cdb[_0x5c7d('0x3d')]);if(_0x3f6cdb[_0x5c7d('0x3e')]){delete _0x3f6cdb[_0x5c7d('0x3e')];}_0x6f571b[_0x5c7d('0x2d')](_0x10de4d)['send'](_0x3f6cdb);};}exports[_0x5c7d('0x3f')]=function(_0x3719f5,_0x28f859){var _0x4e7b02={'include':[{'model':db[_0x5c7d('0x40')],'as':_0x5c7d('0x41')}]},_0x4881e6={},_0x2fc98a={'count':0x0,'rows':[]};var _0x5b0ac2=_[_0x5c7d('0x42')](db['WhatsappAccount']['rawAttributes'],function(_0x11236a){return{'name':_0x11236a[_0x5c7d('0x43')],'type':_0x11236a[_0x5c7d('0x44')][_0x5c7d('0x45')]};});_0x4881e6[_0x5c7d('0x46')]=_[_0x5c7d('0x42')](_0x5b0ac2,'name');_0x4881e6[_0x5c7d('0x47')]=_['keys'](_0x3719f5[_0x5c7d('0x47')]);_0x4881e6[_0x5c7d('0x48')]=_[_0x5c7d('0x49')](_0x4881e6['model'],_0x4881e6[_0x5c7d('0x47')]);_0x4e7b02[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x4881e6[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x3719f5[_0x5c7d('0x47')][_0x5c7d('0x4b')]));_0x4e7b02[_0x5c7d('0x4a')]=_0x4e7b02[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x4e7b02['attributes']:_0x4881e6[_0x5c7d('0x46')];if(!_0x3719f5['query'][_0x5c7d('0x4d')]('nolimit')){_0x4e7b02['limit']=qs[_0x5c7d('0x30')](_0x3719f5[_0x5c7d('0x47')]['limit']);_0x4e7b02[_0x5c7d('0x2e')]=qs[_0x5c7d('0x2e')](_0x3719f5[_0x5c7d('0x47')]['offset']);}_0x4e7b02[_0x5c7d('0x4e')]=qs['sort'](_0x3719f5[_0x5c7d('0x47')][_0x5c7d('0x4f')]);_0x4e7b02[_0x5c7d('0x50')]=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x3719f5[_0x5c7d('0x47')],_0x4881e6[_0x5c7d('0x48')]),_0x5b0ac2);if(_0x3719f5[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x4e7b02[_0x5c7d('0x50')]=_[_0x5c7d('0x53')](_0x4e7b02['where'],{'$or':_[_0x5c7d('0x42')](_0x5b0ac2,function(_0x49e241){if(_0x49e241[_0x5c7d('0x44')]!=='VIRTUAL'){var _0x4d3a46={};_0x4d3a46[_0x49e241[_0x5c7d('0x3e')]]={'$like':'%'+_0x3719f5[_0x5c7d('0x47')]['filter']+'%'};return _0x4d3a46;}})});}_0x4e7b02=_[_0x5c7d('0x53')]({},_0x4e7b02,_0x3719f5[_0x5c7d('0x54')]);var _0x5526d2={'where':_0x4e7b02[_0x5c7d('0x50')]};return db[_0x5c7d('0x55')][_0x5c7d('0x31')](_0x5526d2)[_0x5c7d('0x37')](function(_0x1961aa){_0x2fc98a[_0x5c7d('0x31')]=_0x1961aa;if(_0x3719f5['query'][_0x5c7d('0x56')]){_0x4e7b02[_0x5c7d('0x57')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x4e7b02);})[_0x5c7d('0x37')](function(_0x4b2710){_0x2fc98a[_0x5c7d('0x58')]=_0x4b2710;return _0x2fc98a;})[_0x5c7d('0x37')](respondWithFilteredResult(_0x28f859,_0x4e7b02))[_0x5c7d('0x2c')](handleError(_0x28f859,null));};exports[_0x5c7d('0x59')]=function(_0x503325,_0x3b19ed){var _0x5b1207={'raw':![],'where':{'id':_0x503325[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0x40')],'as':_0x5c7d('0x41')}]},_0x28f687={};_0x28f687[_0x5c7d('0x46')]=_[_0x5c7d('0x5b')](db[_0x5c7d('0x55')][_0x5c7d('0x5c')]);_0x28f687[_0x5c7d('0x47')]=_['keys'](_0x503325['query']);_0x28f687[_0x5c7d('0x48')]=_['intersection'](_0x28f687[_0x5c7d('0x46')],_0x28f687['query']);_0x5b1207[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x28f687[_0x5c7d('0x46')],qs['fields'](_0x503325[_0x5c7d('0x47')]['fields']));_0x5b1207[_0x5c7d('0x4a')]=_0x5b1207[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x5b1207[_0x5c7d('0x4a')]:_0x28f687[_0x5c7d('0x46')];if(_0x503325[_0x5c7d('0x47')][_0x5c7d('0x56')]){_0x5b1207['include']=[{'all':!![]}];}_0x5b1207=_['merge']({},_0x5b1207,_0x503325[_0x5c7d('0x54')]);return db['WhatsappAccount'][_0x5c7d('0x5d')](_0x5b1207)[_0x5c7d('0x37')](handleEntityNotFound(_0x3b19ed,null))['then'](respondWithResult(_0x3b19ed,null))[_0x5c7d('0x2c')](handleError(_0x3b19ed,null));};exports[_0x5c7d('0x5e')]=function(_0x211220,_0x25d653){return db[_0x5c7d('0x55')][_0x5c7d('0x5e')](_0x211220['body'],{})[_0x5c7d('0x37')](function(_0x40924d){var _0x502949=_0x211220['user'][_0x5c7d('0x39')]({'plain':!![]});if(!_0x502949)throw new Error(_0x5c7d('0x5f'));if(_0x502949['role']==='user'){var _0x2bbd1d=_0x40924d[_0x5c7d('0x39')]({'plain':!![]});var _0x4e2657=_0x5c7d('0x3a');return db['UserProfileSection'][_0x5c7d('0x5d')]({'where':{'name':_0x4e2657,'userProfileId':_0x502949['userProfileId']},'raw':!![]})[_0x5c7d('0x37')](function(_0x5038f3){if(_0x5038f3&&_0x5038f3['autoAssociation']===0x0){return db[_0x5c7d('0x3b')]['create']({'name':_0x2bbd1d[_0x5c7d('0x3e')],'resourceId':_0x2bbd1d['id'],'type':_0x5038f3['name'],'sectionId':_0x5038f3['id']},{})[_0x5c7d('0x37')](function(){return _0x40924d;});}else{return _0x40924d;}})[_0x5c7d('0x2c')](function(_0x5703d0){logger[_0x5c7d('0x28')](_0x5c7d('0x60'),_0x5703d0);throw _0x5703d0;});}return _0x40924d;})['then'](respondWithResult(_0x25d653,0xc9))['catch'](handleError(_0x25d653,null));};exports[_0x5c7d('0x61')]=function(_0x2daca5,_0x130d8f){if(_0x2daca5[_0x5c7d('0x62')]['id']){delete _0x2daca5[_0x5c7d('0x62')]['id'];}return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x2daca5[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0x40')],'as':_0x5c7d('0x41')}]})[_0x5c7d('0x37')](handleEntityNotFound(_0x130d8f,null))['then'](saveUpdates(_0x2daca5[_0x5c7d('0x62')],null))[_0x5c7d('0x37')](respondWithResult(_0x130d8f,null))[_0x5c7d('0x2c')](handleError(_0x130d8f,null));};exports[_0x5c7d('0x38')]=function(_0x5389e0,_0xbf28a3){return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x5389e0[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0xbf28a3,null))[_0x5c7d('0x37')](removeEntity(_0xbf28a3,null))[_0x5c7d('0x2c')](handleError(_0xbf28a3,null));};exports[_0x5c7d('0x63')]=function(_0x3bf654,_0x46ed3a){return db[_0x5c7d('0x55')][_0x5c7d('0x63')]()[_0x5c7d('0x37')](respondWithResult(_0x46ed3a,null))[_0x5c7d('0x2c')](handleError(_0x46ed3a,null));};exports[_0x5c7d('0x64')]=function(_0x51bf49,_0x424e40,_0x10f74e){if(_0x51bf49[_0x5c7d('0x62')]['id']){delete _0x51bf49['body']['id'];}return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x51bf49[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x424e40,null))[_0x5c7d('0x37')](function(_0x76ea89){if(_0x76ea89){_0x51bf49[_0x5c7d('0x62')][_0x5c7d('0x65')]=_0x76ea89['id'];return db[_0x5c7d('0x66')]['create'](_0x51bf49[_0x5c7d('0x62')]);}})[_0x5c7d('0x37')](respondWithResult(_0x424e40,null))[_0x5c7d('0x2c')](handleError(_0x424e40,null));};exports[_0x5c7d('0x67')]=function(_0x3b95da,_0x629345,_0x9f2ac1){var _0x1c3c25={'raw':![],'where':{}};var _0x51858e={};var _0xf0ddfc={'count':0x0,'rows':[]};return db[_0x5c7d('0x55')][_0x5c7d('0x68')]({'where':{'id':_0x3b95da[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x629345,null))[_0x5c7d('0x37')](function(_0x40fcd5){if(_0x40fcd5){_0x51858e[_0x5c7d('0x46')]=_[_0x5c7d('0x5b')](db[_0x5c7d('0x66')][_0x5c7d('0x5c')]);_0x51858e[_0x5c7d('0x47')]=_[_0x5c7d('0x5b')](_0x3b95da['query']);_0x51858e[_0x5c7d('0x48')]=_[_0x5c7d('0x49')](_0x51858e[_0x5c7d('0x46')],_0x51858e[_0x5c7d('0x47')]);_0x1c3c25[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x51858e[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x3b95da[_0x5c7d('0x47')][_0x5c7d('0x4b')]));_0x1c3c25[_0x5c7d('0x4a')]=_0x1c3c25['attributes'][_0x5c7d('0x4c')]?_0x1c3c25[_0x5c7d('0x4a')]:_0x51858e['model'];if(!_0x3b95da[_0x5c7d('0x47')]['hasOwnProperty'](_0x5c7d('0x69'))){_0x1c3c25[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x3b95da[_0x5c7d('0x47')]['limit']);_0x1c3c25[_0x5c7d('0x2e')]=qs[_0x5c7d('0x2e')](_0x3b95da[_0x5c7d('0x47')][_0x5c7d('0x2e')]);}_0x1c3c25[_0x5c7d('0x4e')]=qs[_0x5c7d('0x4f')](_0x3b95da[_0x5c7d('0x47')]['sort']);_0x1c3c25[_0x5c7d('0x50')]=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x3b95da[_0x5c7d('0x47')],_0x51858e[_0x5c7d('0x48')]));_0x1c3c25[_0x5c7d('0x50')]['WhatsappAccountId']=_0x40fcd5['id'];if(_0x3b95da['query'][_0x5c7d('0x52')]){_0x1c3c25['where']=_[_0x5c7d('0x53')](_0x1c3c25['where'],{'$or':_[_0x5c7d('0x42')](_0x1c3c25[_0x5c7d('0x4a')],function(_0x2bea61){var _0x1c4b2b={};_0x1c4b2b[_0x2bea61]={'$like':'%'+_0x3b95da[_0x5c7d('0x47')][_0x5c7d('0x52')]+'%'};return _0x1c4b2b;})});}_0x1c3c25=_[_0x5c7d('0x53')]({},_0x1c3c25,_0x3b95da[_0x5c7d('0x54')]);return db[_0x5c7d('0x66')][_0x5c7d('0x31')]({'where':_0x1c3c25[_0x5c7d('0x50')]})[_0x5c7d('0x37')](function(_0xc4b622){_0xf0ddfc['count']=_0xc4b622;if(_0x3b95da['query']['includeAll']){_0x1c3c25[_0x5c7d('0x57')]=[{'all':!![]}];}return db['Disposition'][_0x5c7d('0x6a')](_0x1c3c25);})[_0x5c7d('0x37')](function(_0x4a7cf7){_0xf0ddfc['rows']=_0x4a7cf7;return _0xf0ddfc;});}})[_0x5c7d('0x37')](respondWithFilteredResult(_0x629345,_0x1c3c25))[_0x5c7d('0x2c')](handleError(_0x629345,null));};exports['removeDispositions']=function(_0x425213,_0x3bfa5a,_0x5e8fe1){return db['WhatsappAccount'][_0x5c7d('0x5d')]({'where':{'id':_0x425213[_0x5c7d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3bfa5a,null))[_0x5c7d('0x37')](function(_0x48f73b){if(_0x48f73b){return _0x48f73b[_0x5c7d('0x6b')](_0x425213[_0x5c7d('0x47')][_0x5c7d('0x6c')]);}})[_0x5c7d('0x37')](respondWithStatusCode(_0x3bfa5a,null))['catch'](handleError(_0x3bfa5a,null));};exports[_0x5c7d('0x6d')]=function(_0x5494b0,_0x4c7020,_0x233113){if(_0x5494b0[_0x5c7d('0x62')]['id']){delete _0x5494b0[_0x5c7d('0x62')]['id'];}return db[_0x5c7d('0x55')][_0x5c7d('0x5d')]({'where':{'id':_0x5494b0[_0x5c7d('0x5a')]['id']}})['then'](handleEntityNotFound(_0x4c7020,null))['then'](function(_0x214959){if(_0x214959){_0x5494b0[_0x5c7d('0x62')][_0x5c7d('0x65')]=_0x214959['id'];return db['CannedAnswer'][_0x5c7d('0x5e')](_0x5494b0[_0x5c7d('0x62')]);}})['then'](respondWithResult(_0x4c7020,null))[_0x5c7d('0x2c')](handleError(_0x4c7020,null));};exports[_0x5c7d('0x6e')]=function(_0x193e89,_0x3c568a,_0x527ea5){var _0x15231d={'raw':![],'where':{}};var _0x15b54c={};var _0x14442e={'count':0x0,'rows':[]};return db[_0x5c7d('0x55')][_0x5c7d('0x68')]({'where':{'id':_0x193e89['params']['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x3c568a,null))[_0x5c7d('0x37')](function(_0x3989f3){if(_0x3989f3){_0x15b54c[_0x5c7d('0x46')]=_['keys'](db[_0x5c7d('0x6f')][_0x5c7d('0x5c')]);_0x15b54c[_0x5c7d('0x47')]=_[_0x5c7d('0x5b')](_0x193e89[_0x5c7d('0x47')]);_0x15b54c[_0x5c7d('0x48')]=_['intersection'](_0x15b54c['model'],_0x15b54c['query']);_0x15231d[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x15b54c[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x193e89['query'][_0x5c7d('0x4b')]));_0x15231d[_0x5c7d('0x4a')]=_0x15231d['attributes'][_0x5c7d('0x4c')]?_0x15231d[_0x5c7d('0x4a')]:_0x15b54c[_0x5c7d('0x46')];if(!_0x193e89['query'][_0x5c7d('0x4d')]('nolimit')){_0x15231d[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x193e89[_0x5c7d('0x47')][_0x5c7d('0x30')]);_0x15231d[_0x5c7d('0x2e')]=qs[_0x5c7d('0x2e')](_0x193e89['query'][_0x5c7d('0x2e')]);}_0x15231d[_0x5c7d('0x4e')]=qs[_0x5c7d('0x4f')](_0x193e89['query'][_0x5c7d('0x4f')]);_0x15231d[_0x5c7d('0x50')]=qs['filters'](_[_0x5c7d('0x51')](_0x193e89[_0x5c7d('0x47')],_0x15b54c[_0x5c7d('0x48')]));_0x15231d[_0x5c7d('0x50')][_0x5c7d('0x65')]=_0x3989f3['id'];if(_0x193e89[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x15231d['where']=_[_0x5c7d('0x53')](_0x15231d[_0x5c7d('0x50')],{'$or':_[_0x5c7d('0x42')](_0x15231d[_0x5c7d('0x4a')],function(_0x4a9b78){var _0x5e7cc3={};_0x5e7cc3[_0x4a9b78]={'$like':'%'+_0x193e89['query']['filter']+'%'};return _0x5e7cc3;})});}_0x15231d=_[_0x5c7d('0x53')]({},_0x15231d,_0x193e89[_0x5c7d('0x54')]);return db[_0x5c7d('0x6f')][_0x5c7d('0x31')]({'where':_0x15231d[_0x5c7d('0x50')]})[_0x5c7d('0x37')](function(_0x1b362b){_0x14442e['count']=_0x1b362b;if(_0x193e89['query'][_0x5c7d('0x56')]){_0x15231d[_0x5c7d('0x57')]=[{'all':!![]}];}return db[_0x5c7d('0x6f')][_0x5c7d('0x6a')](_0x15231d);})[_0x5c7d('0x37')](function(_0x5c28c1){_0x14442e['rows']=_0x5c28c1;return _0x14442e;});}})['then'](respondWithFilteredResult(_0x3c568a,_0x15231d))[_0x5c7d('0x2c')](handleError(_0x3c568a,null));};exports[_0x5c7d('0x70')]=function(_0x488084,_0x697311,_0x5c9c3f){return db[_0x5c7d('0x55')][_0x5c7d('0x5d')]({'where':{'id':_0x488084[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x697311,null))[_0x5c7d('0x37')](function(_0x5ba8a1){if(_0x5ba8a1){return _0x5ba8a1[_0x5c7d('0x70')](_0x488084[_0x5c7d('0x47')]['ids']);}})[_0x5c7d('0x37')](respondWithStatusCode(_0x697311,null))[_0x5c7d('0x2c')](handleError(_0x697311,null));};exports['addAgents']=function(_0x4bf1bc,_0x3caa74,_0x4f6adb){return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x4bf1bc['params']['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x3caa74,null))[_0x5c7d('0x37')](function(_0x5e2c21){if(_0x5e2c21){return _0x5e2c21[_0x5c7d('0x71')](_0x4bf1bc[_0x5c7d('0x62')]['ids'],_['omit'](_0x4bf1bc[_0x5c7d('0x62')],[_0x5c7d('0x6c'),'id'])||{})[_0x5c7d('0x72')](function(_0x56f3f5){for(var _0x1f700c=0x0;_0x1f700c<_0x4bf1bc[_0x5c7d('0x62')]['ids'][_0x5c7d('0x4c')];_0x1f700c+=0x1){socket[_0x5c7d('0x73')](_0x5c7d('0x74'),{'UserId':Number(_0x4bf1bc[_0x5c7d('0x62')][_0x5c7d('0x6c')][_0x1f700c]),'WhatsappAccountId':Number(_0x4bf1bc['params']['id'])});}return _0x56f3f5;});}})[_0x5c7d('0x37')](respondWithResult(_0x3caa74,null))[_0x5c7d('0x2c')](handleError(_0x3caa74,null));};exports['removeAgents']=function(_0x21a4d2,_0x58fee2,_0x130fc4){return db[_0x5c7d('0x55')]['find']({'where':{'id':_0x21a4d2['params']['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x58fee2,null))[_0x5c7d('0x37')](function(_0x395331){if(_0x395331){return _0x395331[_0x5c7d('0x75')](_0x21a4d2[_0x5c7d('0x47')][_0x5c7d('0x6c')])[_0x5c7d('0x37')](function(){if(_[_0x5c7d('0x76')](_0x21a4d2[_0x5c7d('0x47')][_0x5c7d('0x6c')])){for(var _0x22bf7a=0x0;_0x22bf7a<_0x21a4d2[_0x5c7d('0x47')]['ids']['length'];_0x22bf7a+=0x1){socket[_0x5c7d('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x21a4d2[_0x5c7d('0x47')][_0x5c7d('0x6c')][_0x22bf7a]),'WhatsappAccountId':Number(_0x21a4d2[_0x5c7d('0x5a')]['id'])});}}else{socket[_0x5c7d('0x73')](_0x5c7d('0x77'),{'UserId':Number(_0x21a4d2['query'][_0x5c7d('0x6c')]),'WhatsappAccountId':Number(_0x21a4d2[_0x5c7d('0x5a')]['id'])});}});}})[_0x5c7d('0x37')](respondWithStatusCode(_0x58fee2,null))[_0x5c7d('0x2c')](handleError(_0x58fee2,null));};exports['getAgents']=function(_0x527403,_0x10ddba,_0x4c1ce4){var _0x1863e9={};var _0x1a098a={};var _0x304501;var _0x25e38a;return db['WhatsappAccount'][_0x5c7d('0x68')]({'where':{'id':_0x527403[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x10ddba,null))[_0x5c7d('0x37')](function(_0x5af6b4){if(_0x5af6b4){_0x304501=_0x5af6b4;_0x1a098a[_0x5c7d('0x46')]=_[_0x5c7d('0x5b')](db[_0x5c7d('0x78')]['rawAttributes']);_0x1a098a[_0x5c7d('0x47')]=_[_0x5c7d('0x5b')](_0x527403[_0x5c7d('0x47')]);_0x1a098a[_0x5c7d('0x48')]=_[_0x5c7d('0x49')](_0x1a098a['model'],_0x1a098a[_0x5c7d('0x47')]);_0x1863e9[_0x5c7d('0x4a')]=_[_0x5c7d('0x49')](_0x1a098a['model'],qs[_0x5c7d('0x4b')](_0x527403[_0x5c7d('0x47')]['fields']));_0x1863e9[_0x5c7d('0x4a')]=_0x1863e9[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x1863e9[_0x5c7d('0x4a')]:_0x1a098a['model'];_0x1863e9['order']=qs[_0x5c7d('0x4f')](_0x527403[_0x5c7d('0x47')]['sort']);_0x1863e9['where']=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x527403[_0x5c7d('0x47')],_0x1a098a[_0x5c7d('0x48')]));if(_0x527403[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x1863e9['where']=_[_0x5c7d('0x53')](_0x1863e9[_0x5c7d('0x50')],{'$or':_[_0x5c7d('0x42')](_0x1863e9[_0x5c7d('0x4a')],function(_0x46de34){var _0x5551d={};_0x5551d[_0x46de34]={'$like':'%'+_0x527403[_0x5c7d('0x47')][_0x5c7d('0x52')]+'%'};return _0x5551d;})});}_0x1863e9=_[_0x5c7d('0x53')]({},_0x1863e9,_0x527403[_0x5c7d('0x54')]);return _0x304501['getAgents'](_0x1863e9);}})[_0x5c7d('0x37')](function(_0x44d44e){if(_0x44d44e){_0x25e38a=_0x44d44e['length'];if(!_0x527403[_0x5c7d('0x47')][_0x5c7d('0x4d')](_0x5c7d('0x69'))){_0x1863e9[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x527403[_0x5c7d('0x47')][_0x5c7d('0x30')]);_0x1863e9['offset']=qs[_0x5c7d('0x2e')](_0x527403[_0x5c7d('0x47')][_0x5c7d('0x2e')]);}return _0x304501[_0x5c7d('0x79')](_0x1863e9);}})[_0x5c7d('0x37')](function(_0x2c7ec7){if(_0x2c7ec7){return _0x2c7ec7?{'count':_0x25e38a,'rows':_0x2c7ec7}:null;}})[_0x5c7d('0x37')](respondWithResult(_0x10ddba,null))[_0x5c7d('0x2c')](handleError(_0x10ddba,null));};exports['addApplications']=function(_0x13b8a3,_0x3b2d9d){var _0x365381=_0x13b8a3[_0x5c7d('0x5a')]['id'];var _0x3f8bfc=_0x13b8a3[_0x5c7d('0x62')];var _0x1019ef=0xc8;var _0x2b376c=null;return db['sequelize'][_0x5c7d('0x7a')]({'isolationLevel':db[_0x5c7d('0x7b')][_0x5c7d('0x7c')][_0x5c7d('0x7d')]['READ_COMMITTED']},function(_0x56f00d){return db[_0x5c7d('0x55')]['findOne']({'where':{'id':_0x365381},'transaction':_0x56f00d})[_0x5c7d('0x37')](function(_0x1c5d08){if(_0x1c5d08){return db[_0x5c7d('0x7e')][_0x5c7d('0x38')]({'where':{'WhatsappAccountId':_0x365381},'transaction':_0x56f00d})[_0x5c7d('0x37')](function(){var _0x2271c2=_[_0x5c7d('0x42')](_0x3f8bfc,function(_0x32888a){_0x32888a['WhatsappAccountId']=_0x365381;return _0x32888a;});return db[_0x5c7d('0x7e')]['bulkCreate'](_0x2271c2,{'transaction':_0x56f00d});});}else{_0x1019ef=0x194;_0x2b376c=[];}});})['then'](function(){if(_0x1019ef!==0x194){return db[_0x5c7d('0x7e')][_0x5c7d('0x7f')]({'where':{'WhatsappAccountId':_0x365381},'order':_0x5c7d('0x80')})[_0x5c7d('0x37')](function(_0x1e9087){_0x2b376c=_0x1e9087;});}})[_0x5c7d('0x2c')](function(_0x2e1f8a){_0x1019ef=0x1f4;logger[_0x5c7d('0x28')](_0x2e1f8a['stack']);if(_0x2e1f8a['name']){delete _0x2e1f8a[_0x5c7d('0x3e')];}_0x2b376c=_0x2e1f8a;})[_0x5c7d('0x81')](function(){if(_0x2b376c===null){_0x3b2d9d['sendStatus'](_0x1019ef);}else{if(_0x1019ef===0x1f4){_0x3b2d9d['status'](_0x1019ef)[_0x5c7d('0x82')](_0x2b376c);}else{_0x3b2d9d[_0x5c7d('0x2d')](_0x1019ef)[_0x5c7d('0x34')](_0x2b376c);}}});};exports['getApplications']=function(_0x3249a2,_0x45df82,_0x3f9b2e){var _0x21bca5={};var _0x2ceff4={};var _0x2175c6;var _0x365111;return db[_0x5c7d('0x55')][_0x5c7d('0x68')]({'where':{'id':_0x3249a2[_0x5c7d('0x5a')]['id']}})[_0x5c7d('0x37')](handleEntityNotFound(_0x45df82,null))[_0x5c7d('0x37')](function(_0x31afd8){if(_0x31afd8){_0x2175c6=_0x31afd8;_0x2ceff4['model']=_[_0x5c7d('0x5b')](db[_0x5c7d('0x7e')][_0x5c7d('0x5c')]);_0x2ceff4[_0x5c7d('0x47')]=_['keys'](_0x3249a2[_0x5c7d('0x47')]);_0x2ceff4['filters']=_['intersection'](_0x2ceff4['model'],_0x2ceff4[_0x5c7d('0x47')]);_0x21bca5['attributes']=_[_0x5c7d('0x49')](_0x2ceff4[_0x5c7d('0x46')],qs[_0x5c7d('0x4b')](_0x3249a2[_0x5c7d('0x47')]['fields']));_0x21bca5['attributes']=_0x21bca5[_0x5c7d('0x4a')][_0x5c7d('0x4c')]?_0x21bca5['attributes']:_0x2ceff4['model'];_0x21bca5[_0x5c7d('0x4e')]=qs[_0x5c7d('0x4f')](_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x4f')]);_0x21bca5[_0x5c7d('0x50')]=qs[_0x5c7d('0x48')](_[_0x5c7d('0x51')](_0x3249a2[_0x5c7d('0x47')],_0x2ceff4[_0x5c7d('0x48')]));if(_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x52')]){_0x21bca5['where']=_['merge'](_0x21bca5[_0x5c7d('0x50')],{'$or':_['map'](_0x21bca5['attributes'],function(_0x15226b){var _0x5601b7={};_0x5601b7[_0x15226b]={'$like':'%'+_0x3249a2['query']['filter']+'%'};return _0x5601b7;})});}_0x21bca5=_[_0x5c7d('0x53')]({},_0x21bca5,_0x3249a2[_0x5c7d('0x54')]);return _0x2175c6['getApplications'](_0x21bca5);}})[_0x5c7d('0x37')](function(_0x50ba4c){if(_0x50ba4c){_0x365111=_0x50ba4c[_0x5c7d('0x4c')];if(!_0x3249a2['query'][_0x5c7d('0x4d')](_0x5c7d('0x69'))){_0x21bca5[_0x5c7d('0x30')]=qs[_0x5c7d('0x30')](_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x30')]);_0x21bca5['offset']=qs[_0x5c7d('0x2e')](_0x3249a2[_0x5c7d('0x47')][_0x5c7d('0x2e')]);}return _0x2175c6[_0x5c7d('0x83')](_0x21bca5);}})[_0x5c7d('0x37')](function(_0x2b2c68){if(_0x2b2c68){return _0x2b2c68?{'count':_0x365111,'rows':_0x2b2c68}:null;}})[_0x5c7d('0x37')](respondWithResult(_0x45df82,null))[_0x5c7d('0x2c')](handleError(_0x45df82,null));};exports[_0x5c7d('0x84')]=function(_0x3c7799,_0x4519cb,_0x5e4e4b){var _0xcbc15={'channel':_0x5c7d('0x85')};var _0x4af412=[];var _0x4a3a0c=[];var _0x36a656={};return db['WhatsappAccount'][_0x5c7d('0x5d')]({'where':{'id':_0x3c7799[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0x7e')],'as':_0x5c7d('0x86')}]})[_0x5c7d('0x37')](handleEntityNotFound(_0x4519cb,null))['then'](function(_0x416459){_0xcbc15[_0x5c7d('0x87')]=_0x416459;if(_0xcbc15[_0x5c7d('0x87')]&&_0xcbc15['account'][_0x5c7d('0x44')]==='sinch'&&_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')]){if(_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][_0x5c7d('0x4c')]===0x0)return;if(_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][0x0][_0x5c7d('0x89')]!==_0x5c7d('0x8a'))return;return db[_0x5c7d('0x8b')]['update']({'read':!![],'readAt':_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][0x0][_0x5c7d('0x8c')]},{'where':{'messageId':_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x88')][0x0]['message_id']},'individualHooks':!![]})[_0x5c7d('0x37')](function(_0x52d295){return _0x4519cb[_0x5c7d('0x2d')](0xc8)['json'](_0x52d295);});}_0xcbc15[_0x5c7d('0x8d')]=_[_0x5c7d('0x8e')](_0x416459[_0x5c7d('0x86')],[_0x5c7d('0x80')],['asc']);if(_0xcbc15[_0x5c7d('0x87')]['Applications']){delete _0xcbc15['account'][_0x5c7d('0x86')];}return db['CmContact'][_0x5c7d('0x63')]()[_0x5c7d('0x37')](function(_0x9f956){if(!_0x9f956){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))](_0x5c7d('0x91'));}_0x4af412=_[_0x5c7d('0x92')](_['keys'](_0x9f956),[_0x5c7d('0x93'),_0x5c7d('0x94')]);_0x4a3a0c=_[_0x5c7d('0x92')](_[_0x5c7d('0x5b')](_0x9f956),[_0x5c7d('0x93'),_0x5c7d('0x94'),_0x5c7d('0x95'),'ListId']);_0xcbc15[_0x5c7d('0x62')]={'mapKey':_0x5c7d('0x96')};if(_0xcbc15[_0x5c7d('0x87')]&&_0xcbc15[_0x5c7d('0x87')][_0x5c7d('0x44')]===_0x5c7d('0x97')){_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')]=_0x3c7799['body'][_0x5c7d('0x99')]['replace']('whatsapp:','');_0xcbc15[_0x5c7d('0x62')]['body']=_0x3c7799['body']['Body'];_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x9a')]=_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x9b')];}if(_0xcbc15[_0x5c7d('0x87')]&&_0xcbc15['account'][_0x5c7d('0x44')]==='sinch'){_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')]=_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x9c')][0x0][_0x5c7d('0x98')];_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x62')]=_0x3c7799[_0x5c7d('0x62')][_0x5c7d('0x9c')][0x0][_0x5c7d('0x2a')]['body'];_0xcbc15[_0x5c7d('0x62')]['messageId']=_0x3c7799['body']['notifications'][0x0][_0x5c7d('0x9d')];}if(_0xcbc15[_0x5c7d('0x62')]['id']){delete _0xcbc15[_0x5c7d('0x62')]['id'];}if(_[_0x5c7d('0x9e')](_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')])){throw new db[(_0x5c7d('0x8f'))]['ValidationError'](_0x5c7d('0x9f'));}if(_['isNil'](_0xcbc15['body'][_0x5c7d('0x62')])||_0xcbc15['body']['body']===''){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))](_0x5c7d('0xa0'));}if(_['isNil'](_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0xa1')])){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))](_0x5c7d('0xa2')+_0x4a3a0c);}if(!_[_0x5c7d('0xa3')](_0x4a3a0c,_0xcbc15['body'][_0x5c7d('0xa1')])){throw new db[(_0x5c7d('0x8f'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4a3a0c);}_0x36a656[_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0xa1')]]=_0xcbc15['body'][_0x5c7d('0x98')];return db[_0x5c7d('0xa4')][_0x5c7d('0x5d')]({'where':{'id':_0xcbc15[_0x5c7d('0x87')][_0x5c7d('0xa5')]},'include':[{'model':db[_0x5c7d('0xa6')],'as':_0x5c7d('0xa7'),'where':_0x36a656,'limit':0x1,'order':[[_0x5c7d('0x94'),_0x5c7d('0xa8')]]}]});})[_0x5c7d('0x37')](handleEntityNotFound(_0x4519cb,null))[_0x5c7d('0x37')](function(_0x105562){if(_0x105562){_0xcbc15['list']=_[_0x5c7d('0xa9')](_0x105562,[_0x5c7d('0xa7')]);if(_0x105562[_0x5c7d('0xa7')][_0x5c7d('0x4c')]){return _0x105562[_0x5c7d('0xa7')][0x0];}var _0x1720b6=_[_0x5c7d('0x1d')](_0xcbc15[_0x5c7d('0x62')],{'firstName':_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')],'ListId':_0x105562['id']});_0x1720b6[_0xcbc15['body'][_0x5c7d('0xa1')]]=_0xcbc15['body'][_0x5c7d('0x98')];return db[_0x5c7d('0xa6')][_0x5c7d('0x5e')](_0x1720b6,{'fields':_0x4af412,'raw':!![]});}})['then'](handleEntityNotFound(_0x4519cb,null))[_0x5c7d('0x37')](function(_0x441c22){if(_0x441c22){_0xcbc15[_0x5c7d('0xaa')]=_0x441c22;var _0x1276f9={'ContactId':_0x441c22['id'],'phone':_0xcbc15[_0x5c7d('0x62')][_0x5c7d('0x98')],'WhatsappAccountId':_0x3c7799[_0x5c7d('0x5a')]['id']};var _0x1081ad={'ContactId':_0x441c22['id'],'WhatsappAccountId':_0x3c7799[_0x5c7d('0x5a')]['id'],'closed':![]};return db[_0x5c7d('0xab')][_0x5c7d('0x5d')]({'where':_0x1081ad})['then'](function(_0x581bc4){if(_0x581bc4){return[_0x581bc4,![]];}return db['WhatsappInteraction'][_0x5c7d('0x5e')](_0x1276f9)[_0x5c7d('0x37')](function(_0x19d833){return[_0x19d833,!![]];});});}})[_0x5c7d('0x72')](function(_0x41945a,_0x11590a){_0xcbc15['interaction']=_0x41945a[_0x5c7d('0x39')]({'plain':!![]});_0xcbc15['interaction']['created']=![];if(_0x11590a){if(_0xcbc15[_0x5c7d('0x87')][_0x5c7d('0xac')]){_0xcbc15[_0x5c7d('0x8d')][_0x5c7d('0xad')]({'id':0x0,'priority':_0xcbc15[_0x5c7d('0x8d')]['length']+0x1,'app':_0x5c7d('0xae'),'appdata':_0x5c7d('0xaf'),'interval':_0x5c7d('0xb0')});}_0xcbc15['interaction'][_0x5c7d('0xb1')]=!![];}return db[_0x5c7d('0x8b')][_0x5c7d('0x5e')]({'phone':_0xcbc15['body'][_0x5c7d('0x98')],'messageId':_0xcbc15['body'][_0x5c7d('0x9a')],'body':_0xcbc15['body']['body'],'WhatsappAccountId':_0x3c7799[_0x5c7d('0x5a')]['id'],'WhatsappInteractionId':_0x41945a['id'],'direction':'in','ContactId':_0x41945a[_0x5c7d('0xb2')],'AttachmentId':_0xcbc15[_0x5c7d('0x62')]['AttachmentId']});})[_0x5c7d('0x37')](function(_0x1c3b38){_0xcbc15['message']=_0x1c3b38;if(!_0xcbc15[_0x5c7d('0xb3')][_0x5c7d('0xb4')])return;return db['User'][_0x5c7d('0x5d')]({'attributes':['id',_0x5c7d('0x3e')],'where':{'id':_0xcbc15[_0x5c7d('0xb3')][_0x5c7d('0xb4')]}});})[_0x5c7d('0x37')](function(_0x3a4e3a){if(_0x3a4e3a){_0xcbc15[_0x5c7d('0x8d')][_0x5c7d('0xb5')]({'id':0x0,'priority':0x0,'app':_0x5c7d('0xb6'),'appdata':_0x3a4e3a['name']+','+(_0xcbc15[_0x5c7d('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x5c7d('0xb0')});}if(!_0xcbc15[_0x5c7d('0xb3')]['queueId'])return;return db['WhatsappQueue'][_0x5c7d('0x5d')]({'attributes':['id',_0x5c7d('0x3e')],'where':{'id':_0xcbc15[_0x5c7d('0xb3')][_0x5c7d('0xb7')]}});})[_0x5c7d('0x37')](function(_0x59e074){if(_0x59e074){_0xcbc15[_0x5c7d('0x8d')][_0x5c7d('0xb5')]({'id':0x0,'priority':0x1,'app':_0x5c7d('0xb8'),'appdata':_0x59e074['name']+','+(_0xcbc15[_0x5c7d('0x87')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5c7d('0xb0')});}return respondWithRpcPromise(_0x5c7d('0xb9'),_0x5c7d('0xba'),_0xcbc15);})[_0x5c7d('0x37')](function(_0x206067){if(_0x206067){var _0x55a7f7=0xc8;var _0x2f9f05=_0x5c7d('0xbb');logger[_0x5c7d('0xbc')](_0x5c7d('0x26'),_0x2f9f05,_0x55a7f7,_0x5c7d('0xbd'));logger[_0x5c7d('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f9f05,_0x55a7f7,_0x5c7d('0xbd'),JSON[_0x5c7d('0xbe')](_0x206067));if(_0xcbc15['account'][_0x5c7d('0x44')]===_0x5c7d('0x97')){return _0x4519cb[_0x5c7d('0x2d')](_0x55a7f7)[_0x5c7d('0x32')](_0x5c7d('0xbf'),_0x5c7d('0xc0'))['send'](_0x5c7d('0xc1'));}else{return _0x4519cb[_0x5c7d('0x2d')](_0x55a7f7)[_0x5c7d('0x34')](_0x206067);}}});})[_0x5c7d('0x2c')](handleError(_0x4519cb,null));};exports[_0x5c7d('0x82')]=function(_0x2e63db,_0x4404a4,_0x41b4c6){var _0x11ba0a,_0x1a3ede,_0x3f8724;if(_['isNil'](_0x2e63db[_0x5c7d('0x62')]['body'])||_0x2e63db[_0x5c7d('0x62')][_0x5c7d('0x62')]===''){throw new db[(_0x5c7d('0x8f'))][(_0x5c7d('0x90'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x5c7d('0x9e')](_0x2e63db[_0x5c7d('0x62')]['to'])){throw new db[(_0x5c7d('0x8f'))]['ValidationError']('to\x20is\x20mandatory');}_0x11ba0a=_0x2e63db[_0x5c7d('0x62')]['to'];return db[_0x5c7d('0x55')][_0x5c7d('0x5d')]({'where':{'id':_0x2e63db[_0x5c7d('0x5a')]['id']},'include':[{'model':db[_0x5c7d('0xa4')],'as':_0x5c7d('0xc2'),'include':[{'model':db[_0x5c7d('0xa6')],'as':_0x5c7d('0xa7'),'where':{'mobile':_0x11ba0a},'limit':0x1,'order':[[_0x5c7d('0x94'),_0x5c7d('0xa8')]]}]}]})[_0x5c7d('0x37')](handleEntityNotFound(_0x4404a4,null))[_0x5c7d('0x37')](function(_0x238636){if(_0x238636&&_0x238636[_0x5c7d('0xc2')]){_0x1a3ede=_0x238636[_0x5c7d('0x39')]({'plain':!![]});if(_0x1a3ede[_0x5c7d('0xc2')]&&_0x1a3ede['List']['Contacts']['length']){return _0x1a3ede[_0x5c7d('0xc2')]['Contacts'][0x0];}return db[_0x5c7d('0xa6')][_0x5c7d('0x5e')](_['defaults'](_0x2e63db[_0x5c7d('0x62')],{'firstName':_0x11ba0a,'mobile':_0x11ba0a,'phone':_0x11ba0a,'ListId':_0x1a3ede[_0x5c7d('0xa5')]}));}})[_0x5c7d('0x37')](handleEntityNotFound(_0x4404a4,null))[_0x5c7d('0x37')](function(_0x43651f){if(_0x43651f){_0x3f8724=_0x43651f;return db[_0x5c7d('0xab')]['find']({'where':{'ContactId':_0x3f8724['id'],'closed':![],'WhatsappAccountId':_0x1a3ede['id']}})[_0x5c7d('0x37')](function(_0x37409c){if(_0x37409c){return[_0x37409c,![]];}return db[_0x5c7d('0xab')]['create']({'UserId':_0x2e63db[_0x5c7d('0xc3')]['id'],'ContactId':_0x3f8724['id'],'WhatsappAccountId':_0x1a3ede['id'],'phone':_0x11ba0a,'firstMsgDirection':_0x5c7d('0xc4'),'Messages':[_[_0x5c7d('0x53')](_0x2e63db['body'],{'read':![],'body':_0x2e63db[_0x5c7d('0x62')][_0x5c7d('0x62')],'phone':_0x11ba0a,'WhatsappAccountId':_0x1a3ede['id'],'UserId':_0x2e63db[_0x5c7d('0xc3')]['id'],'ContactId':_0x3f8724['id']})]},{'include':[{'model':db[_0x5c7d('0x8b')],'as':_0x5c7d('0xc5')}]})[_0x5c7d('0x37')](function(_0x592347){return[_0x592347,!![]];});});}})[_0x5c7d('0x72')](function(_0x5c9fdb,_0x37370e){if(_0x37370e){return _0x5c9fdb;}return db[_0x5c7d('0x8b')][_0x5c7d('0x5e')](_[_0x5c7d('0x53')](_0x2e63db[_0x5c7d('0x62')],{'read':![],'body':_0x2e63db['body'][_0x5c7d('0x62')],'phone':_0x11ba0a,'WhatsappAccountId':_0x1a3ede['id'],'WhatsappInteractionId':_0x5c9fdb['id'],'UserId':_0x2e63db[_0x5c7d('0xc3')]['id'],'ContactId':_0x3f8724['id']}))[_0x5c7d('0x37')](function(_0x4571d6){_0x5c9fdb[_0x5c7d('0xc6')]['Messages']=[];_0x5c9fdb[_0x5c7d('0xc6')][_0x5c7d('0xc5')][_0x5c7d('0xad')](_0x4571d6[_0x5c7d('0xc6')]);return _0x5c9fdb;});})[_0x5c7d('0x37')](respondWithResult(_0x4404a4,null))['catch'](handleError(_0x4404a4,null));}; \ No newline at end of file +var _0x06fc=['replace','whatsapp:','Body','messageId','MessageSid','from','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','ListId','DESC','Contacts','CmContact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','WhatsappQueue','queueId','*,*,*,*','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','Content-Type','text/xml','to\x20is\x20mandatory','List','Messages','dataValues','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','crypto','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','destroy','UserProfileResource','stack','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','intersection','fields','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappAccount','include','findAll','rows','show','length','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','WhatsappAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','order','removeAnswers','ids','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','getApplications','notify','whatsapp','Applications','account','statuses','read','WhatsappMessage','timestamp','applications','orderBy','asc','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','mobile','twilio'];(function(_0x3bec98,_0x27367f){var _0x11305c=function(_0x1b0fe1){while(--_0x1b0fe1){_0x3bec98['push'](_0x3bec98['shift']());}};_0x11305c(++_0x27367f);}(_0x06fc,0x1b2));var _0xc06f=function(_0x472acf,_0x167841){_0x472acf=_0x472acf-0x0;var _0x104ff7=_0x06fc[_0x472acf];return _0x104ff7;};'use strict';var emlformat=require(_0xc06f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc06f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc06f('0x2'));var moment=require(_0xc06f('0x3'));var BPromise=require(_0xc06f('0x4'));var Mustache=require(_0xc06f('0x5'));var util=require('util');var path=require(_0xc06f('0x6'));var sox=require(_0xc06f('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc06f('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc06f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0xc06f('0xa'));var toCsv=require('to-csv');var querystring=require(_0xc06f('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc06f('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc06f('0xd'));var logger=require(_0xc06f('0xe'))(_0xc06f('0xf'));var utils=require(_0xc06f('0x10'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc06f('0x11'))['db'];config['redis']=_[_0xc06f('0x12')](config[_0xc06f('0x13')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc06f('0x14'))[_0xc06f('0x15')](socket);var jayson=require(_0xc06f('0x16'));var client=jayson[_0xc06f('0x17')][_0xc06f('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x2fa050,_0x56864b,_0x180f7c,_0x32b1e9){return new BPromise(function(_0x468c7,_0x32eeef){var _0x25157a=_0x32b1e9||client;return _0x25157a[_0xc06f('0x19')](_0x2fa050,_0x180f7c)[_0xc06f('0x1a')](function(_0x137e13){logger[_0xc06f('0x1b')](_0xc06f('0x1c'),_0x56864b,'request\x20sent');logger[_0xc06f('0x1d')](_0xc06f('0x1e'),_0x56864b,_0xc06f('0x1f'),JSON['stringify'](_0x137e13));if(_0x137e13[_0xc06f('0x20')]){if(_0x137e13[_0xc06f('0x20')][_0xc06f('0x21')]===0x1f4){logger['error'](_0xc06f('0x1c'),_0x56864b,_0x137e13[_0xc06f('0x20')]['message']);return _0x32eeef(_0x137e13[_0xc06f('0x20')][_0xc06f('0x22')]);}logger[_0xc06f('0x20')](_0xc06f('0x1c'),_0x56864b,_0x137e13[_0xc06f('0x20')][_0xc06f('0x22')]);return _0x468c7(_0x137e13[_0xc06f('0x20')][_0xc06f('0x22')]);}else{logger[_0xc06f('0x1b')]('WhatsappAccount,\x20%s,\x20%s',_0x56864b,_0xc06f('0x1f'));_0x468c7(_0x137e13['result']['message']);}})[_0xc06f('0x23')](function(_0x390c14){logger[_0xc06f('0x20')](_0xc06f('0x1c'),_0x56864b,_0x390c14);_0x32eeef(_0x390c14);});});}function respondWithStatusCode(_0x4f4b40,_0x3d21c5){_0x3d21c5=_0x3d21c5||0xcc;return function(_0x4ed36b){if(_0x4ed36b){return _0x4f4b40[_0xc06f('0x24')](_0x3d21c5);}return _0x4f4b40[_0xc06f('0x25')](_0x3d21c5)[_0xc06f('0x26')]();};}function respondWithResult(_0x50941f,_0x234595){_0x234595=_0x234595||0xc8;return function(_0x3da992){if(_0x3da992){return _0x50941f[_0xc06f('0x25')](_0x234595)[_0xc06f('0x27')](_0x3da992);}};}function respondWithFilteredResult(_0x55f24c,_0x4868c0){return function(_0x3e55eb){if(_0x3e55eb){var _0x30c979=typeof _0x4868c0['offset']===_0xc06f('0x28')&&typeof _0x4868c0[_0xc06f('0x29')]===_0xc06f('0x28');var _0x45eb54=_0x3e55eb['count'];var _0x424bb8=_0x30c979?0x0:_0x4868c0[_0xc06f('0x2a')];var _0x39729a=_0x30c979?_0x3e55eb[_0xc06f('0x2b')]:_0x4868c0[_0xc06f('0x2a')]+_0x4868c0[_0xc06f('0x29')];var _0x5b9a52;if(_0x39729a>=_0x45eb54){_0x39729a=_0x45eb54;_0x5b9a52=0xc8;}else{_0x5b9a52=0xce;}_0x55f24c['status'](_0x5b9a52);return _0x55f24c[_0xc06f('0x2c')](_0xc06f('0x2d'),_0x424bb8+'-'+_0x39729a+'/'+_0x45eb54)[_0xc06f('0x27')](_0x3e55eb);}return null;};}function patchUpdates(_0x49340a){return function(_0x478995){try{jsonpatch['apply'](_0x478995,_0x49340a,!![]);}catch(_0xc81b1b){return BPromise[_0xc06f('0x2e')](_0xc81b1b);}return _0x478995[_0xc06f('0x2f')]();};}function saveUpdates(_0x3acf4a,_0x2bac08){return function(_0x45db69){if(_0x45db69){return _0x45db69[_0xc06f('0x30')](_0x3acf4a)['then'](function(_0x39c9de){return _0x39c9de;});}return null;};}function removeEntity(_0x24a62f,_0x42b8cf){return function(_0x3bab58){if(_0x3bab58){return _0x3bab58[_0xc06f('0x31')]()['then'](function(){var _0x1bb841=_0x3bab58['get']({'plain':!![]});var _0x27e5eb='WhatsappAccounts';return db[_0xc06f('0x32')]['destroy']({'where':{'type':_0x27e5eb,'resourceId':_0x1bb841['id']}})[_0xc06f('0x1a')](function(){return _0x3bab58;});})[_0xc06f('0x1a')](function(){_0x24a62f[_0xc06f('0x25')](0xcc)[_0xc06f('0x26')]();});}};}function handleEntityNotFound(_0x30f0a4,_0x44ae7d){return function(_0x50d8fc){if(!_0x50d8fc){_0x30f0a4[_0xc06f('0x24')](0x194);}return _0x50d8fc;};}function handleError(_0x69748,_0x4f1483){_0x4f1483=_0x4f1483||0x1f4;return function(_0x4e9513){logger[_0xc06f('0x20')](_0x4e9513[_0xc06f('0x33')]);if(_0x4e9513['name']){delete _0x4e9513['name'];}_0x69748[_0xc06f('0x25')](_0x4f1483)[_0xc06f('0x34')](_0x4e9513);};}exports[_0xc06f('0x35')]=function(_0x1f6c7b,_0x2d88e1){var _0xd5d373={'include':[{'model':db[_0xc06f('0x36')],'as':_0xc06f('0x37')}]},_0x54d9bb={},_0x4e23ee={'count':0x0,'rows':[]};var _0x337219=_[_0xc06f('0x38')](db['WhatsappAccount'][_0xc06f('0x39')],function(_0x3f723d){return{'name':_0x3f723d[_0xc06f('0x3a')],'type':_0x3f723d[_0xc06f('0x3b')][_0xc06f('0x3c')]};});_0x54d9bb[_0xc06f('0x3d')]=_[_0xc06f('0x38')](_0x337219,_0xc06f('0x3e'));_0x54d9bb[_0xc06f('0x3f')]=_[_0xc06f('0x40')](_0x1f6c7b[_0xc06f('0x3f')]);_0x54d9bb[_0xc06f('0x41')]=_['intersection'](_0x54d9bb[_0xc06f('0x3d')],_0x54d9bb['query']);_0xd5d373[_0xc06f('0x42')]=_[_0xc06f('0x43')](_0x54d9bb['model'],qs[_0xc06f('0x44')](_0x1f6c7b[_0xc06f('0x3f')]['fields']));_0xd5d373[_0xc06f('0x42')]=_0xd5d373['attributes']['length']?_0xd5d373[_0xc06f('0x42')]:_0x54d9bb['model'];if(!_0x1f6c7b['query']['hasOwnProperty']('nolimit')){_0xd5d373[_0xc06f('0x29')]=qs[_0xc06f('0x29')](_0x1f6c7b[_0xc06f('0x3f')]['limit']);_0xd5d373['offset']=qs['offset'](_0x1f6c7b[_0xc06f('0x3f')][_0xc06f('0x2a')]);}_0xd5d373['order']=qs[_0xc06f('0x45')](_0x1f6c7b[_0xc06f('0x3f')]['sort']);_0xd5d373[_0xc06f('0x46')]=qs[_0xc06f('0x41')](_[_0xc06f('0x47')](_0x1f6c7b['query'],_0x54d9bb[_0xc06f('0x41')]),_0x337219);if(_0x1f6c7b[_0xc06f('0x3f')][_0xc06f('0x48')]){_0xd5d373[_0xc06f('0x46')]=_[_0xc06f('0x49')](_0xd5d373[_0xc06f('0x46')],{'$or':_[_0xc06f('0x38')](_0x337219,function(_0x59f7ff){if(_0x59f7ff[_0xc06f('0x3b')]!==_0xc06f('0x4a')){var _0x3cc9fb={};_0x3cc9fb[_0x59f7ff['name']]={'$like':'%'+_0x1f6c7b[_0xc06f('0x3f')][_0xc06f('0x48')]+'%'};return _0x3cc9fb;}})});}_0xd5d373=_[_0xc06f('0x49')]({},_0xd5d373,_0x1f6c7b[_0xc06f('0x4b')]);var _0x133988={'where':_0xd5d373['where']};return db[_0xc06f('0x4c')]['count'](_0x133988)[_0xc06f('0x1a')](function(_0x173294){_0x4e23ee[_0xc06f('0x2b')]=_0x173294;if(_0x1f6c7b[_0xc06f('0x3f')]['includeAll']){_0xd5d373[_0xc06f('0x4d')]=[{'all':!![]}];}return db[_0xc06f('0x4c')][_0xc06f('0x4e')](_0xd5d373);})[_0xc06f('0x1a')](function(_0x4519dd){_0x4e23ee[_0xc06f('0x4f')]=_0x4519dd;return _0x4e23ee;})[_0xc06f('0x1a')](respondWithFilteredResult(_0x2d88e1,_0xd5d373))[_0xc06f('0x23')](handleError(_0x2d88e1,null));};exports[_0xc06f('0x50')]=function(_0x52782a,_0x436b5e){var _0xe64e84={'raw':![],'where':{'id':_0x52782a['params']['id']},'include':[{'model':db[_0xc06f('0x36')],'as':'mandatoryDispositionPause'}]},_0xbe9248={};_0xbe9248[_0xc06f('0x3d')]=_[_0xc06f('0x40')](db['WhatsappAccount'][_0xc06f('0x39')]);_0xbe9248[_0xc06f('0x3f')]=_[_0xc06f('0x40')](_0x52782a[_0xc06f('0x3f')]);_0xbe9248[_0xc06f('0x41')]=_[_0xc06f('0x43')](_0xbe9248[_0xc06f('0x3d')],_0xbe9248[_0xc06f('0x3f')]);_0xe64e84['attributes']=_[_0xc06f('0x43')](_0xbe9248[_0xc06f('0x3d')],qs[_0xc06f('0x44')](_0x52782a[_0xc06f('0x3f')][_0xc06f('0x44')]));_0xe64e84[_0xc06f('0x42')]=_0xe64e84[_0xc06f('0x42')][_0xc06f('0x51')]?_0xe64e84[_0xc06f('0x42')]:_0xbe9248['model'];if(_0x52782a['query'][_0xc06f('0x52')]){_0xe64e84[_0xc06f('0x4d')]=[{'all':!![]}];}_0xe64e84=_['merge']({},_0xe64e84,_0x52782a[_0xc06f('0x4b')]);return db[_0xc06f('0x4c')][_0xc06f('0x53')](_0xe64e84)[_0xc06f('0x1a')](handleEntityNotFound(_0x436b5e,null))['then'](respondWithResult(_0x436b5e,null))[_0xc06f('0x23')](handleError(_0x436b5e,null));};exports[_0xc06f('0x54')]=function(_0x536fde,_0x5e96a3){return db[_0xc06f('0x4c')][_0xc06f('0x54')](_0x536fde['body'],{})[_0xc06f('0x1a')](function(_0x6bc319){var _0x296d16=_0x536fde[_0xc06f('0x55')][_0xc06f('0x56')]({'plain':!![]});if(!_0x296d16)throw new Error(_0xc06f('0x57'));if(_0x296d16['role']===_0xc06f('0x55')){var _0x498dd2=_0x6bc319['get']({'plain':!![]});var _0x19cf53=_0xc06f('0x58');return db[_0xc06f('0x59')][_0xc06f('0x53')]({'where':{'name':_0x19cf53,'userProfileId':_0x296d16[_0xc06f('0x5a')]},'raw':!![]})[_0xc06f('0x1a')](function(_0x162439){if(_0x162439&&_0x162439[_0xc06f('0x5b')]===0x0){return db[_0xc06f('0x32')][_0xc06f('0x54')]({'name':_0x498dd2[_0xc06f('0x3e')],'resourceId':_0x498dd2['id'],'type':_0x162439[_0xc06f('0x3e')],'sectionId':_0x162439['id']},{})[_0xc06f('0x1a')](function(){return _0x6bc319;});}else{return _0x6bc319;}})[_0xc06f('0x23')](function(_0x4ae169){logger[_0xc06f('0x20')](_0xc06f('0x5c'),_0x4ae169);throw _0x4ae169;});}return _0x6bc319;})[_0xc06f('0x1a')](respondWithResult(_0x5e96a3,0xc9))[_0xc06f('0x23')](handleError(_0x5e96a3,null));};exports[_0xc06f('0x30')]=function(_0x1c1ac3,_0x2aa79e){if(_0x1c1ac3[_0xc06f('0x5d')]['id']){delete _0x1c1ac3[_0xc06f('0x5d')]['id'];}return db['WhatsappAccount'][_0xc06f('0x53')]({'where':{'id':_0x1c1ac3[_0xc06f('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0xc06f('0x37')}]})['then'](handleEntityNotFound(_0x2aa79e,null))['then'](saveUpdates(_0x1c1ac3[_0xc06f('0x5d')],null))[_0xc06f('0x1a')](respondWithResult(_0x2aa79e,null))['catch'](handleError(_0x2aa79e,null));};exports[_0xc06f('0x31')]=function(_0x2c178e,_0x3b3a0e){return db[_0xc06f('0x4c')][_0xc06f('0x53')]({'where':{'id':_0x2c178e[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x3b3a0e,null))['then'](removeEntity(_0x3b3a0e,null))[_0xc06f('0x23')](handleError(_0x3b3a0e,null));};exports[_0xc06f('0x5f')]=function(_0x3228d8,_0x4f763d){return db[_0xc06f('0x4c')][_0xc06f('0x5f')]()['then'](respondWithResult(_0x4f763d,null))[_0xc06f('0x23')](handleError(_0x4f763d,null));};exports[_0xc06f('0x60')]=function(_0x45efe4,_0x504b2a,_0x9660e4){if(_0x45efe4[_0xc06f('0x5d')]['id']){delete _0x45efe4[_0xc06f('0x5d')]['id'];}return db[_0xc06f('0x4c')]['find']({'where':{'id':_0x45efe4[_0xc06f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x504b2a,null))['then'](function(_0xfc6813){if(_0xfc6813){_0x45efe4['body'][_0xc06f('0x61')]=_0xfc6813['id'];return db[_0xc06f('0x62')]['create'](_0x45efe4[_0xc06f('0x5d')]);}})['then'](respondWithResult(_0x504b2a,null))[_0xc06f('0x23')](handleError(_0x504b2a,null));};exports[_0xc06f('0x63')]=function(_0xaa9d78,_0x3d01d4,_0x286853){var _0x3698e2={'raw':![],'where':{}};var _0x371f0={};var _0x4d650a={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc06f('0x64')]({'where':{'id':_0xaa9d78[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x3d01d4,null))['then'](function(_0x2e4ae7){if(_0x2e4ae7){_0x371f0[_0xc06f('0x3d')]=_['keys'](db[_0xc06f('0x62')][_0xc06f('0x39')]);_0x371f0[_0xc06f('0x3f')]=_['keys'](_0xaa9d78['query']);_0x371f0['filters']=_['intersection'](_0x371f0[_0xc06f('0x3d')],_0x371f0['query']);_0x3698e2[_0xc06f('0x42')]=_[_0xc06f('0x43')](_0x371f0[_0xc06f('0x3d')],qs[_0xc06f('0x44')](_0xaa9d78['query']['fields']));_0x3698e2['attributes']=_0x3698e2[_0xc06f('0x42')]['length']?_0x3698e2[_0xc06f('0x42')]:_0x371f0[_0xc06f('0x3d')];if(!_0xaa9d78[_0xc06f('0x3f')]['hasOwnProperty'](_0xc06f('0x65'))){_0x3698e2[_0xc06f('0x29')]=qs[_0xc06f('0x29')](_0xaa9d78['query'][_0xc06f('0x29')]);_0x3698e2[_0xc06f('0x2a')]=qs[_0xc06f('0x2a')](_0xaa9d78[_0xc06f('0x3f')][_0xc06f('0x2a')]);}_0x3698e2['order']=qs[_0xc06f('0x45')](_0xaa9d78['query']['sort']);_0x3698e2[_0xc06f('0x46')]=qs['filters'](_[_0xc06f('0x47')](_0xaa9d78[_0xc06f('0x3f')],_0x371f0[_0xc06f('0x41')]));_0x3698e2[_0xc06f('0x46')]['WhatsappAccountId']=_0x2e4ae7['id'];if(_0xaa9d78['query'][_0xc06f('0x48')]){_0x3698e2[_0xc06f('0x46')]=_[_0xc06f('0x49')](_0x3698e2[_0xc06f('0x46')],{'$or':_[_0xc06f('0x38')](_0x3698e2[_0xc06f('0x42')],function(_0x39d7a6){var _0x25b17a={};_0x25b17a[_0x39d7a6]={'$like':'%'+_0xaa9d78['query'][_0xc06f('0x48')]+'%'};return _0x25b17a;})});}_0x3698e2=_[_0xc06f('0x49')]({},_0x3698e2,_0xaa9d78[_0xc06f('0x4b')]);return db['Disposition'][_0xc06f('0x2b')]({'where':_0x3698e2[_0xc06f('0x46')]})[_0xc06f('0x1a')](function(_0x383f0c){_0x4d650a[_0xc06f('0x2b')]=_0x383f0c;if(_0xaa9d78[_0xc06f('0x3f')][_0xc06f('0x52')]){_0x3698e2[_0xc06f('0x4d')]=[{'all':!![]}];}return db[_0xc06f('0x62')]['findAll'](_0x3698e2);})[_0xc06f('0x1a')](function(_0x913a1c){_0x4d650a[_0xc06f('0x4f')]=_0x913a1c;return _0x4d650a;});}})[_0xc06f('0x1a')](respondWithFilteredResult(_0x3d01d4,_0x3698e2))[_0xc06f('0x23')](handleError(_0x3d01d4,null));};exports[_0xc06f('0x66')]=function(_0x4cd972,_0x14e76f,_0x3e82f5){return db[_0xc06f('0x4c')][_0xc06f('0x53')]({'where':{'id':_0x4cd972[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x14e76f,null))[_0xc06f('0x1a')](function(_0x23e7fc){if(_0x23e7fc){return _0x23e7fc[_0xc06f('0x66')](_0x4cd972[_0xc06f('0x3f')]['ids']);}})['then'](respondWithStatusCode(_0x14e76f,null))['catch'](handleError(_0x14e76f,null));};exports[_0xc06f('0x67')]=function(_0x5e7c65,_0x1f6883,_0x41782b){if(_0x5e7c65[_0xc06f('0x5d')]['id']){delete _0x5e7c65['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x5e7c65[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x1f6883,null))['then'](function(_0x1f975d){if(_0x1f975d){_0x5e7c65['body'][_0xc06f('0x61')]=_0x1f975d['id'];return db[_0xc06f('0x68')][_0xc06f('0x54')](_0x5e7c65[_0xc06f('0x5d')]);}})[_0xc06f('0x1a')](respondWithResult(_0x1f6883,null))['catch'](handleError(_0x1f6883,null));};exports[_0xc06f('0x69')]=function(_0xad1fdb,_0x5b8344,_0x5f9d65){var _0x19d323={'raw':![],'where':{}};var _0x34321e={};var _0x2ae85b={'count':0x0,'rows':[]};return db[_0xc06f('0x4c')][_0xc06f('0x64')]({'where':{'id':_0xad1fdb[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x5b8344,null))[_0xc06f('0x1a')](function(_0x3ce52b){if(_0x3ce52b){_0x34321e['model']=_[_0xc06f('0x40')](db[_0xc06f('0x68')][_0xc06f('0x39')]);_0x34321e[_0xc06f('0x3f')]=_[_0xc06f('0x40')](_0xad1fdb[_0xc06f('0x3f')]);_0x34321e[_0xc06f('0x41')]=_[_0xc06f('0x43')](_0x34321e[_0xc06f('0x3d')],_0x34321e[_0xc06f('0x3f')]);_0x19d323[_0xc06f('0x42')]=_[_0xc06f('0x43')](_0x34321e['model'],qs[_0xc06f('0x44')](_0xad1fdb[_0xc06f('0x3f')][_0xc06f('0x44')]));_0x19d323['attributes']=_0x19d323[_0xc06f('0x42')][_0xc06f('0x51')]?_0x19d323[_0xc06f('0x42')]:_0x34321e[_0xc06f('0x3d')];if(!_0xad1fdb['query'][_0xc06f('0x6a')](_0xc06f('0x65'))){_0x19d323[_0xc06f('0x29')]=qs[_0xc06f('0x29')](_0xad1fdb[_0xc06f('0x3f')][_0xc06f('0x29')]);_0x19d323['offset']=qs[_0xc06f('0x2a')](_0xad1fdb[_0xc06f('0x3f')][_0xc06f('0x2a')]);}_0x19d323[_0xc06f('0x6b')]=qs[_0xc06f('0x45')](_0xad1fdb[_0xc06f('0x3f')][_0xc06f('0x45')]);_0x19d323[_0xc06f('0x46')]=qs['filters'](_[_0xc06f('0x47')](_0xad1fdb[_0xc06f('0x3f')],_0x34321e[_0xc06f('0x41')]));_0x19d323[_0xc06f('0x46')][_0xc06f('0x61')]=_0x3ce52b['id'];if(_0xad1fdb[_0xc06f('0x3f')][_0xc06f('0x48')]){_0x19d323[_0xc06f('0x46')]=_[_0xc06f('0x49')](_0x19d323[_0xc06f('0x46')],{'$or':_[_0xc06f('0x38')](_0x19d323[_0xc06f('0x42')],function(_0x31e146){var _0x2b49ec={};_0x2b49ec[_0x31e146]={'$like':'%'+_0xad1fdb[_0xc06f('0x3f')][_0xc06f('0x48')]+'%'};return _0x2b49ec;})});}_0x19d323=_['merge']({},_0x19d323,_0xad1fdb['options']);return db[_0xc06f('0x68')][_0xc06f('0x2b')]({'where':_0x19d323[_0xc06f('0x46')]})[_0xc06f('0x1a')](function(_0x47ab34){_0x2ae85b['count']=_0x47ab34;if(_0xad1fdb[_0xc06f('0x3f')]['includeAll']){_0x19d323['include']=[{'all':!![]}];}return db[_0xc06f('0x68')][_0xc06f('0x4e')](_0x19d323);})[_0xc06f('0x1a')](function(_0x4d3d39){_0x2ae85b[_0xc06f('0x4f')]=_0x4d3d39;return _0x2ae85b;});}})[_0xc06f('0x1a')](respondWithFilteredResult(_0x5b8344,_0x19d323))[_0xc06f('0x23')](handleError(_0x5b8344,null));};exports[_0xc06f('0x6c')]=function(_0x2d66c0,_0x5aa6fd,_0x36825e){return db[_0xc06f('0x4c')][_0xc06f('0x53')]({'where':{'id':_0x2d66c0[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x5aa6fd,null))[_0xc06f('0x1a')](function(_0x1df0dc){if(_0x1df0dc){return _0x1df0dc[_0xc06f('0x6c')](_0x2d66c0[_0xc06f('0x3f')][_0xc06f('0x6d')]);}})['then'](respondWithStatusCode(_0x5aa6fd,null))[_0xc06f('0x23')](handleError(_0x5aa6fd,null));};exports['addAgents']=function(_0x2df318,_0x1687e3,_0x337906){return db[_0xc06f('0x4c')][_0xc06f('0x53')]({'where':{'id':_0x2df318['params']['id']}})['then'](handleEntityNotFound(_0x1687e3,null))[_0xc06f('0x1a')](function(_0xd2384){if(_0xd2384){return _0xd2384['addAgents'](_0x2df318[_0xc06f('0x5d')]['ids'],_[_0xc06f('0x6e')](_0x2df318[_0xc06f('0x5d')],[_0xc06f('0x6d'),'id'])||{})[_0xc06f('0x6f')](function(_0x309ebc){for(var _0x12e232=0x0;_0x12e232<_0x2df318[_0xc06f('0x5d')][_0xc06f('0x6d')]['length'];_0x12e232+=0x1){socket['emit'](_0xc06f('0x70'),{'UserId':Number(_0x2df318['body'][_0xc06f('0x6d')][_0x12e232]),'WhatsappAccountId':Number(_0x2df318[_0xc06f('0x5e')]['id'])});}return _0x309ebc;});}})[_0xc06f('0x1a')](respondWithResult(_0x1687e3,null))[_0xc06f('0x23')](handleError(_0x1687e3,null));};exports[_0xc06f('0x71')]=function(_0x285f0d,_0x40bc96,_0x8a7a2){return db['WhatsappAccount'][_0xc06f('0x53')]({'where':{'id':_0x285f0d[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x40bc96,null))[_0xc06f('0x1a')](function(_0x1ce721){if(_0x1ce721){return _0x1ce721['removeAgents'](_0x285f0d[_0xc06f('0x3f')][_0xc06f('0x6d')])[_0xc06f('0x1a')](function(){if(_[_0xc06f('0x72')](_0x285f0d[_0xc06f('0x3f')]['ids'])){for(var _0x191838=0x0;_0x191838<_0x285f0d[_0xc06f('0x3f')]['ids']['length'];_0x191838+=0x1){socket[_0xc06f('0x73')](_0xc06f('0x74'),{'UserId':Number(_0x285f0d[_0xc06f('0x3f')][_0xc06f('0x6d')][_0x191838]),'WhatsappAccountId':Number(_0x285f0d['params']['id'])});}}else{socket[_0xc06f('0x73')]('userWhatsappAccount:remove',{'UserId':Number(_0x285f0d[_0xc06f('0x3f')][_0xc06f('0x6d')]),'WhatsappAccountId':Number(_0x285f0d[_0xc06f('0x5e')]['id'])});}});}})['then'](respondWithStatusCode(_0x40bc96,null))[_0xc06f('0x23')](handleError(_0x40bc96,null));};exports[_0xc06f('0x75')]=function(_0xfae0cf,_0x29213e,_0xa3f148){var _0x1774e6={};var _0xd225b1={};var _0x2d3f95;var _0x9e0a75;return db[_0xc06f('0x4c')][_0xc06f('0x64')]({'where':{'id':_0xfae0cf[_0xc06f('0x5e')]['id']}})[_0xc06f('0x1a')](handleEntityNotFound(_0x29213e,null))[_0xc06f('0x1a')](function(_0x355efc){if(_0x355efc){_0x2d3f95=_0x355efc;_0xd225b1[_0xc06f('0x3d')]=_[_0xc06f('0x40')](db[_0xc06f('0x76')]['rawAttributes']);_0xd225b1['query']=_[_0xc06f('0x40')](_0xfae0cf['query']);_0xd225b1[_0xc06f('0x41')]=_[_0xc06f('0x43')](_0xd225b1[_0xc06f('0x3d')],_0xd225b1[_0xc06f('0x3f')]);_0x1774e6['attributes']=_[_0xc06f('0x43')](_0xd225b1['model'],qs[_0xc06f('0x44')](_0xfae0cf['query'][_0xc06f('0x44')]));_0x1774e6[_0xc06f('0x42')]=_0x1774e6[_0xc06f('0x42')][_0xc06f('0x51')]?_0x1774e6['attributes']:_0xd225b1[_0xc06f('0x3d')];_0x1774e6[_0xc06f('0x6b')]=qs[_0xc06f('0x45')](_0xfae0cf[_0xc06f('0x3f')]['sort']);_0x1774e6['where']=qs[_0xc06f('0x41')](_['pick'](_0xfae0cf[_0xc06f('0x3f')],_0xd225b1[_0xc06f('0x41')]));if(_0xfae0cf[_0xc06f('0x3f')][_0xc06f('0x48')]){_0x1774e6[_0xc06f('0x46')]=_['merge'](_0x1774e6[_0xc06f('0x46')],{'$or':_['map'](_0x1774e6['attributes'],function(_0x2f3903){var _0x56e30c={};_0x56e30c[_0x2f3903]={'$like':'%'+_0xfae0cf[_0xc06f('0x3f')][_0xc06f('0x48')]+'%'};return _0x56e30c;})});}_0x1774e6=_[_0xc06f('0x49')]({},_0x1774e6,_0xfae0cf[_0xc06f('0x4b')]);return _0x2d3f95['getAgents'](_0x1774e6);}})[_0xc06f('0x1a')](function(_0x57581e){if(_0x57581e){_0x9e0a75=_0x57581e[_0xc06f('0x51')];if(!_0xfae0cf['query'][_0xc06f('0x6a')](_0xc06f('0x65'))){_0x1774e6[_0xc06f('0x29')]=qs[_0xc06f('0x29')](_0xfae0cf['query']['limit']);_0x1774e6[_0xc06f('0x2a')]=qs[_0xc06f('0x2a')](_0xfae0cf[_0xc06f('0x3f')][_0xc06f('0x2a')]);}return _0x2d3f95[_0xc06f('0x75')](_0x1774e6);}})['then'](function(_0x452806){if(_0x452806){return _0x452806?{'count':_0x9e0a75,'rows':_0x452806}:null;}})[_0xc06f('0x1a')](respondWithResult(_0x29213e,null))[_0xc06f('0x23')](handleError(_0x29213e,null));};exports['addApplications']=function(_0x401005,_0x2df9a0){var _0x38c803=_0x401005[_0xc06f('0x5e')]['id'];var _0x582991=_0x401005[_0xc06f('0x5d')];var _0x4980c7=0xc8;var _0x28bd0b=null;return db[_0xc06f('0x77')][_0xc06f('0x78')]({'isolationLevel':db[_0xc06f('0x77')][_0xc06f('0x79')][_0xc06f('0x7a')][_0xc06f('0x7b')]},function(_0x2870cd){return db['WhatsappAccount'][_0xc06f('0x64')]({'where':{'id':_0x38c803},'transaction':_0x2870cd})[_0xc06f('0x1a')](function(_0x45ef6c){if(_0x45ef6c){return db[_0xc06f('0x7c')][_0xc06f('0x31')]({'where':{'WhatsappAccountId':_0x38c803},'transaction':_0x2870cd})[_0xc06f('0x1a')](function(){var _0x18d7b3=_[_0xc06f('0x38')](_0x582991,function(_0xc8966f){_0xc8966f[_0xc06f('0x61')]=_0x38c803;return _0xc8966f;});return db[_0xc06f('0x7c')]['bulkCreate'](_0x18d7b3,{'transaction':_0x2870cd});});}else{_0x4980c7=0x194;_0x28bd0b=[];}});})['then'](function(){if(_0x4980c7!==0x194){return db[_0xc06f('0x7c')][_0xc06f('0x7d')]({'where':{'WhatsappAccountId':_0x38c803},'order':_0xc06f('0x7e')})[_0xc06f('0x1a')](function(_0x3b902d){_0x28bd0b=_0x3b902d;});}})['catch'](function(_0x1b6c06){_0x4980c7=0x1f4;logger[_0xc06f('0x20')](_0x1b6c06[_0xc06f('0x33')]);if(_0x1b6c06[_0xc06f('0x3e')]){delete _0x1b6c06[_0xc06f('0x3e')];}_0x28bd0b=_0x1b6c06;})[_0xc06f('0x7f')](function(){if(_0x28bd0b===null){_0x2df9a0[_0xc06f('0x24')](_0x4980c7);}else{if(_0x4980c7===0x1f4){_0x2df9a0[_0xc06f('0x25')](_0x4980c7)[_0xc06f('0x34')](_0x28bd0b);}else{_0x2df9a0[_0xc06f('0x25')](_0x4980c7)['json'](_0x28bd0b);}}});};exports[_0xc06f('0x80')]=function(_0x40ff11,_0x30d945,_0x1af2f8){var _0x4ab319={};var _0x3dc3fb={};var _0xae0ae8;var _0x20f01f;return db[_0xc06f('0x4c')][_0xc06f('0x64')]({'where':{'id':_0x40ff11[_0xc06f('0x5e')]['id']}})['then'](handleEntityNotFound(_0x30d945,null))['then'](function(_0x46979e){if(_0x46979e){_0xae0ae8=_0x46979e;_0x3dc3fb[_0xc06f('0x3d')]=_[_0xc06f('0x40')](db[_0xc06f('0x7c')][_0xc06f('0x39')]);_0x3dc3fb[_0xc06f('0x3f')]=_['keys'](_0x40ff11[_0xc06f('0x3f')]);_0x3dc3fb['filters']=_[_0xc06f('0x43')](_0x3dc3fb[_0xc06f('0x3d')],_0x3dc3fb['query']);_0x4ab319[_0xc06f('0x42')]=_['intersection'](_0x3dc3fb[_0xc06f('0x3d')],qs[_0xc06f('0x44')](_0x40ff11[_0xc06f('0x3f')][_0xc06f('0x44')]));_0x4ab319[_0xc06f('0x42')]=_0x4ab319['attributes'][_0xc06f('0x51')]?_0x4ab319[_0xc06f('0x42')]:_0x3dc3fb[_0xc06f('0x3d')];_0x4ab319[_0xc06f('0x6b')]=qs[_0xc06f('0x45')](_0x40ff11[_0xc06f('0x3f')][_0xc06f('0x45')]);_0x4ab319[_0xc06f('0x46')]=qs[_0xc06f('0x41')](_['pick'](_0x40ff11['query'],_0x3dc3fb['filters']));if(_0x40ff11[_0xc06f('0x3f')]['filter']){_0x4ab319[_0xc06f('0x46')]=_[_0xc06f('0x49')](_0x4ab319[_0xc06f('0x46')],{'$or':_[_0xc06f('0x38')](_0x4ab319[_0xc06f('0x42')],function(_0x56c3b1){var _0x22c6b2={};_0x22c6b2[_0x56c3b1]={'$like':'%'+_0x40ff11[_0xc06f('0x3f')]['filter']+'%'};return _0x22c6b2;})});}_0x4ab319=_[_0xc06f('0x49')]({},_0x4ab319,_0x40ff11['options']);return _0xae0ae8[_0xc06f('0x80')](_0x4ab319);}})[_0xc06f('0x1a')](function(_0x3131d2){if(_0x3131d2){_0x20f01f=_0x3131d2[_0xc06f('0x51')];if(!_0x40ff11[_0xc06f('0x3f')][_0xc06f('0x6a')](_0xc06f('0x65'))){_0x4ab319[_0xc06f('0x29')]=qs[_0xc06f('0x29')](_0x40ff11[_0xc06f('0x3f')][_0xc06f('0x29')]);_0x4ab319['offset']=qs[_0xc06f('0x2a')](_0x40ff11[_0xc06f('0x3f')][_0xc06f('0x2a')]);}return _0xae0ae8[_0xc06f('0x80')](_0x4ab319);}})[_0xc06f('0x1a')](function(_0x219ccc){if(_0x219ccc){return _0x219ccc?{'count':_0x20f01f,'rows':_0x219ccc}:null;}})['then'](respondWithResult(_0x30d945,null))['catch'](handleError(_0x30d945,null));};exports[_0xc06f('0x81')]=function(_0x193418,_0x5173ad,_0x51471e){var _0xc8e044={'channel':_0xc06f('0x82')};var _0x3a62e2=[];var _0x2e9a29=[];var _0x13e5a0={};return db['WhatsappAccount']['find']({'where':{'id':_0x193418[_0xc06f('0x5e')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xc06f('0x83')}]})[_0xc06f('0x1a')](handleEntityNotFound(_0x5173ad,null))['then'](function(_0x583e68){_0xc8e044[_0xc06f('0x84')]=_0x583e68;if(_0xc8e044[_0xc06f('0x84')]&&_0xc8e044[_0xc06f('0x84')][_0xc06f('0x3b')]==='sinch'&&_0x193418[_0xc06f('0x5d')][_0xc06f('0x85')]){if(_0x193418[_0xc06f('0x5d')][_0xc06f('0x85')][_0xc06f('0x51')]===0x0)return;if(_0x193418[_0xc06f('0x5d')][_0xc06f('0x85')][0x0]['state']!==_0xc06f('0x86'))return;return db[_0xc06f('0x87')][_0xc06f('0x30')]({'read':!![],'readAt':_0x193418[_0xc06f('0x5d')][_0xc06f('0x85')][0x0][_0xc06f('0x88')]},{'where':{'messageId':_0x193418[_0xc06f('0x5d')]['statuses'][0x0]['message_id']},'individualHooks':!![]})[_0xc06f('0x1a')](function(_0x1aa258){return _0x5173ad['status'](0xc8)[_0xc06f('0x27')](_0x1aa258);});}_0xc8e044[_0xc06f('0x89')]=_[_0xc06f('0x8a')](_0x583e68[_0xc06f('0x83')],['priority'],[_0xc06f('0x8b')]);if(_0xc8e044['account'][_0xc06f('0x83')]){delete _0xc8e044[_0xc06f('0x84')][_0xc06f('0x83')];}return db['CmContact']['describe']()['then'](function(_0x335f1a){if(!_0x335f1a){throw new db[(_0xc06f('0x8c'))][(_0xc06f('0x8d'))](_0xc06f('0x8e'));}_0x3a62e2=_[_0xc06f('0x8f')](_[_0xc06f('0x40')](_0x335f1a),['createdAt',_0xc06f('0x90')]);_0x2e9a29=_[_0xc06f('0x8f')](_[_0xc06f('0x40')](_0x335f1a),[_0xc06f('0x91'),_0xc06f('0x90'),'CompanyId','ListId']);_0xc8e044[_0xc06f('0x5d')]={'mapKey':_0xc06f('0x92')};if(_0xc8e044[_0xc06f('0x84')]&&_0xc8e044[_0xc06f('0x84')][_0xc06f('0x3b')]===_0xc06f('0x93')){_0xc8e044['body']['from']=_0x193418[_0xc06f('0x5d')]['From'][_0xc06f('0x94')](_0xc06f('0x95'),'');_0xc8e044['body'][_0xc06f('0x5d')]=_0x193418[_0xc06f('0x5d')][_0xc06f('0x96')];_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x97')]=_0x193418[_0xc06f('0x5d')][_0xc06f('0x98')];}if(_0xc8e044['account']&&_0xc8e044[_0xc06f('0x84')]['type']==='sinch'){_0xc8e044['body'][_0xc06f('0x99')]=_0x193418[_0xc06f('0x5d')][_0xc06f('0x9a')][0x0][_0xc06f('0x99')];_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x5d')]=_0x193418[_0xc06f('0x5d')][_0xc06f('0x9a')][0x0][_0xc06f('0x22')]['body'];_0xc8e044[_0xc06f('0x5d')]['messageId']=_0x193418[_0xc06f('0x5d')][_0xc06f('0x9a')][0x0][_0xc06f('0x9b')];}if(_0xc8e044[_0xc06f('0x5d')]['id']){delete _0xc8e044['body']['id'];}if(_[_0xc06f('0x9c')](_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x99')])){throw new db[(_0xc06f('0x8c'))][(_0xc06f('0x8d'))](_0xc06f('0x9d'));}if(_[_0xc06f('0x9c')](_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x5d')])||_0xc8e044['body'][_0xc06f('0x5d')]===''){throw new db[(_0xc06f('0x8c'))]['ValidationError'](_0xc06f('0x9e'));}if(_[_0xc06f('0x9c')](_0xc8e044[_0xc06f('0x5d')]['mapKey'])){throw new db[(_0xc06f('0x8c'))][(_0xc06f('0x8d'))](_0xc06f('0x9f')+_0x2e9a29);}if(!_[_0xc06f('0xa0')](_0x2e9a29,_0xc8e044[_0xc06f('0x5d')]['mapKey'])){throw new db[(_0xc06f('0x8c'))][(_0xc06f('0x8d'))](_0xc06f('0xa1')+_0x2e9a29);}_0x13e5a0[_0xc8e044[_0xc06f('0x5d')][_0xc06f('0xa2')]]=_0xc8e044[_0xc06f('0x5d')]['from'];return db[_0xc06f('0xa3')][_0xc06f('0x53')]({'where':{'id':_0xc8e044[_0xc06f('0x84')][_0xc06f('0xa4')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x13e5a0,'limit':0x1,'order':[[_0xc06f('0x90'),_0xc06f('0xa5')]]}]});})[_0xc06f('0x1a')](handleEntityNotFound(_0x5173ad,null))[_0xc06f('0x1a')](function(_0x3678c1){if(_0x3678c1){_0xc8e044['list']=_[_0xc06f('0x6e')](_0x3678c1,[_0xc06f('0xa6')]);if(_0x3678c1[_0xc06f('0xa6')][_0xc06f('0x51')]){return _0x3678c1['Contacts'][0x0];}var _0x5ab697=_[_0xc06f('0x12')](_0xc8e044[_0xc06f('0x5d')],{'firstName':_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x99')],'ListId':_0x3678c1['id']});_0x5ab697[_0xc8e044[_0xc06f('0x5d')][_0xc06f('0xa2')]]=_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x99')];return db[_0xc06f('0xa7')][_0xc06f('0x54')](_0x5ab697,{'fields':_0x3a62e2,'raw':!![]});}})[_0xc06f('0x1a')](handleEntityNotFound(_0x5173ad,null))['then'](function(_0x217177){if(_0x217177){_0xc8e044['contact']=_0x217177;var _0x4d8e78={'ContactId':_0x217177['id'],'phone':_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x99')],'WhatsappAccountId':_0x193418[_0xc06f('0x5e')]['id']};var _0x1397c6={'ContactId':_0x217177['id'],'WhatsappAccountId':_0x193418[_0xc06f('0x5e')]['id'],'closed':![]};return db[_0xc06f('0xa8')][_0xc06f('0x53')]({'where':_0x1397c6})['then'](function(_0x4a5c9f){if(_0x4a5c9f){return[_0x4a5c9f,![]];}return db[_0xc06f('0xa8')]['create'](_0x4d8e78)[_0xc06f('0x1a')](function(_0x14a842){return[_0x14a842,!![]];});});}})['spread'](function(_0xb13c9a,_0x36e617){_0xc8e044[_0xc06f('0xa9')]=_0xb13c9a[_0xc06f('0x56')]({'plain':!![]});_0xc8e044[_0xc06f('0xa9')][_0xc06f('0xaa')]=![];if(_0x36e617){if(_0xc8e044[_0xc06f('0x84')][_0xc06f('0xab')]){_0xc8e044[_0xc06f('0x89')][_0xc06f('0xac')]({'id':0x0,'priority':_0xc8e044['applications'][_0xc06f('0x51')]+0x1,'app':'close','appdata':_0xc06f('0xad'),'interval':'*,*,*,*'});}_0xc8e044[_0xc06f('0xa9')][_0xc06f('0xaa')]=!![];}return db[_0xc06f('0x87')]['create']({'phone':_0xc8e044[_0xc06f('0x5d')][_0xc06f('0x99')],'messageId':_0xc8e044['body'][_0xc06f('0x97')],'body':_0xc8e044['body'][_0xc06f('0x5d')],'WhatsappAccountId':_0x193418[_0xc06f('0x5e')]['id'],'WhatsappInteractionId':_0xb13c9a['id'],'direction':'in','ContactId':_0xb13c9a[_0xc06f('0xae')],'AttachmentId':_0xc8e044[_0xc06f('0x5d')][_0xc06f('0xaf')]});})[_0xc06f('0x1a')](function(_0x98c869){_0xc8e044['message']=_0x98c869;if(!_0xc8e044[_0xc06f('0xa9')][_0xc06f('0xb0')])return;return db[_0xc06f('0x76')][_0xc06f('0x53')]({'attributes':['id','name'],'where':{'id':_0xc8e044[_0xc06f('0xa9')][_0xc06f('0xb0')]}});})[_0xc06f('0x1a')](function(_0x526837){if(_0x526837){_0xc8e044[_0xc06f('0x89')][_0xc06f('0xb1')]({'id':0x0,'priority':0x0,'app':_0xc06f('0xb2'),'appdata':_0x526837[_0xc06f('0x3e')]+','+(_0xc8e044[_0xc06f('0x84')][_0xc06f('0xb3')]||0xa),'interval':'*,*,*,*'});}if(!_0xc8e044[_0xc06f('0xa9')]['queueId'])return;return db[_0xc06f('0xb4')]['find']({'attributes':['id',_0xc06f('0x3e')],'where':{'id':_0xc8e044['interaction'][_0xc06f('0xb5')]}});})[_0xc06f('0x1a')](function(_0x4e429e){if(_0x4e429e){_0xc8e044[_0xc06f('0x89')][_0xc06f('0xb1')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4e429e[_0xc06f('0x3e')]+','+(_0xc8e044[_0xc06f('0x84')]['waitForTheAssignedQueue']||0x12c),'interval':_0xc06f('0xb6')});}return respondWithRpcPromise(_0xc06f('0xb7'),_0xc06f('0xb8'),_0xc8e044);})[_0xc06f('0x1a')](function(_0x3e7990){if(_0x3e7990){var _0x12b71c=0xc8;var _0x11c46d='receiveMessage';logger['info']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x11c46d,_0x12b71c,_0xc06f('0xb9'));logger[_0xc06f('0x1d')](_0xc06f('0xba'),_0x11c46d,_0x12b71c,_0xc06f('0xb9'),JSON[_0xc06f('0xbb')](_0x3e7990));if(_0xc8e044[_0xc06f('0x84')][_0xc06f('0x3b')]===_0xc06f('0x93')){return _0x5173ad[_0xc06f('0x25')](_0x12b71c)['set'](_0xc06f('0xbc'),_0xc06f('0xbd'))[_0xc06f('0x34')]('\x0a');}else{return _0x5173ad[_0xc06f('0x25')](_0x12b71c)[_0xc06f('0x27')](_0x3e7990);}}});})['catch'](handleError(_0x5173ad,null));};exports[_0xc06f('0x34')]=function(_0x5c2eb,_0x15bdf1,_0x3a5427){var _0x4814ef,_0x118d44,_0x3800cc;if(_[_0xc06f('0x9c')](_0x5c2eb[_0xc06f('0x5d')]['body'])||_0x5c2eb[_0xc06f('0x5d')]['body']===''){throw new db[(_0xc06f('0x8c'))][(_0xc06f('0x8d'))](_0xc06f('0x9e'));}if(_[_0xc06f('0x9c')](_0x5c2eb[_0xc06f('0x5d')]['to'])){throw new db[(_0xc06f('0x8c'))]['ValidationError'](_0xc06f('0xbe'));}_0x4814ef=_0x5c2eb[_0xc06f('0x5d')]['to'];return db[_0xc06f('0x4c')][_0xc06f('0x53')]({'where':{'id':_0x5c2eb[_0xc06f('0x5e')]['id']},'include':[{'model':db[_0xc06f('0xa3')],'as':_0xc06f('0xbf'),'include':[{'model':db['CmContact'],'as':_0xc06f('0xa6'),'where':{'mobile':_0x4814ef},'limit':0x1,'order':[[_0xc06f('0x90'),'DESC']]}]}]})[_0xc06f('0x1a')](handleEntityNotFound(_0x15bdf1,null))['then'](function(_0x396d6d){if(_0x396d6d&&_0x396d6d['List']){_0x118d44=_0x396d6d['get']({'plain':!![]});if(_0x118d44['List']&&_0x118d44[_0xc06f('0xbf')]['Contacts'][_0xc06f('0x51')]){return _0x118d44[_0xc06f('0xbf')][_0xc06f('0xa6')][0x0];}return db[_0xc06f('0xa7')]['create'](_['defaults'](_0x5c2eb[_0xc06f('0x5d')],{'firstName':_0x4814ef,'mobile':_0x4814ef,'phone':_0x4814ef,'ListId':_0x118d44[_0xc06f('0xa4')]}));}})[_0xc06f('0x1a')](handleEntityNotFound(_0x15bdf1,null))['then'](function(_0x51017c){if(_0x51017c){_0x3800cc=_0x51017c;return db[_0xc06f('0xa8')]['find']({'where':{'ContactId':_0x3800cc['id'],'closed':![],'WhatsappAccountId':_0x118d44['id']}})[_0xc06f('0x1a')](function(_0x55e4e7){if(_0x55e4e7){return[_0x55e4e7,![]];}return db[_0xc06f('0xa8')]['create']({'UserId':_0x5c2eb['user']['id'],'ContactId':_0x3800cc['id'],'WhatsappAccountId':_0x118d44['id'],'phone':_0x4814ef,'firstMsgDirection':'out','Messages':[_[_0xc06f('0x49')](_0x5c2eb[_0xc06f('0x5d')],{'read':![],'body':_0x5c2eb[_0xc06f('0x5d')][_0xc06f('0x5d')],'phone':_0x4814ef,'WhatsappAccountId':_0x118d44['id'],'UserId':_0x5c2eb['user']['id'],'ContactId':_0x3800cc['id']})]},{'include':[{'model':db[_0xc06f('0x87')],'as':_0xc06f('0xc0')}]})[_0xc06f('0x1a')](function(_0x375047){return[_0x375047,!![]];});});}})[_0xc06f('0x6f')](function(_0x2958d2,_0x3f0e6b){if(_0x3f0e6b){return _0x2958d2;}return db[_0xc06f('0x87')][_0xc06f('0x54')](_[_0xc06f('0x49')](_0x5c2eb[_0xc06f('0x5d')],{'read':![],'body':_0x5c2eb[_0xc06f('0x5d')]['body'],'phone':_0x4814ef,'WhatsappAccountId':_0x118d44['id'],'WhatsappInteractionId':_0x2958d2['id'],'UserId':_0x5c2eb[_0xc06f('0x55')]['id'],'ContactId':_0x3800cc['id']}))['then'](function(_0x4abe0c){_0x2958d2[_0xc06f('0xc1')][_0xc06f('0xc0')]=[];_0x2958d2['dataValues'][_0xc06f('0xc0')][_0xc06f('0xac')](_0x4abe0c[_0xc06f('0xc1')]);return _0x2958d2;});})[_0xc06f('0x1a')](respondWithResult(_0x15bdf1,null))[_0xc06f('0x23')](handleError(_0x15bdf1,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 6ac5951..f6852e3 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 _0xea69=['WhatsappAccount','setMaxListeners','save','update','emit','hook','../../mysqldb'];(function(_0x555b2f,_0x43b622){var _0x81c0a6=function(_0x4629e6){while(--_0x4629e6){_0x555b2f['push'](_0x555b2f['shift']());}};_0x81c0a6(++_0x43b622);}(_0xea69,0x8b));var _0x9ea6=function(_0x397706,_0x32a840){_0x397706=_0x397706-0x0;var _0x4ffa44=_0xea69[_0x397706];return _0x4ffa44;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x9ea6('0x0'))['db'][_0x9ea6('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x9ea6('0x2')](0x0);var events={'afterCreate':_0x9ea6('0x3'),'afterUpdate':_0x9ea6('0x4'),'afterDestroy':'remove'};function emitEvent(_0x51ebfa){return function(_0x38df7f,_0x12c2d1,_0x1c05b9){WhatsappAccountEvents[_0x9ea6('0x5')](_0x51ebfa+':'+_0x38df7f['id'],_0x38df7f);WhatsappAccountEvents['emit'](_0x51ebfa,_0x38df7f);_0x1c05b9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x9ea6('0x6')](e,emitEvent(event));}}module['exports']=WhatsappAccountEvents; \ No newline at end of file +var _0xdb1f=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','save','update'];(function(_0x2aa57b,_0x4c128f){var _0x56164f=function(_0x63ada2){while(--_0x63ada2){_0x2aa57b['push'](_0x2aa57b['shift']());}};_0x56164f(++_0x4c128f);}(_0xdb1f,0x94));var _0xfdb1=function(_0x35d60f,_0x1995b7){_0x35d60f=_0x35d60f-0x0;var _0x2a43db=_0xdb1f[_0x35d60f];return _0x2a43db;};'use strict';var EventEmitter=require(_0xfdb1('0x0'));var WhatsappAccount=require(_0xfdb1('0x1'))['db'][_0xfdb1('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfdb1('0x3'),'afterUpdate':_0xfdb1('0x4'),'afterDestroy':_0xfdb1('0x5')};function emitEvent(_0x4cc860){return function(_0x55fc0a,_0xacfdb7,_0xaa3a52){WhatsappAccountEvents[_0xfdb1('0x6')](_0x4cc860+':'+_0x55fc0a['id'],_0x55fc0a);WhatsappAccountEvents['emit'](_0x4cc860,_0x55fc0a);_0xaa3a52(null);};}for(var e in events){if(events[_0xfdb1('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xfdb1('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index a81c446..6a82627 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 _0xbbfa=['bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api'];(function(_0x207140,_0x4c6556){var _0x39e8cf=function(_0x16b730){while(--_0x16b730){_0x207140['push'](_0x207140['shift']());}};_0x39e8cf(++_0x4c6556);}(_0xbbfa,0xcc));var _0xabbf=function(_0x44ff66,_0x27f548){_0x44ff66=_0x44ff66-0x0;var _0x136331=_0xbbfa[_0x44ff66];return _0x136331;};'use strict';var _=require(_0xabbf('0x0'));var util=require(_0xabbf('0x1'));var logger=require(_0xabbf('0x2'))(_0xabbf('0x3'));var moment=require('moment');var BPromise=require(_0xabbf('0x4'));var rp=require(_0xabbf('0x5'));var fs=require('fs');var path=require(_0xabbf('0x6'));var rimraf=require(_0xabbf('0x7'));var config=require('../../config/environment');var attributes=require(_0xabbf('0x8'));module[_0xabbf('0x9')]=function(_0x1d3da5,_0xd5542b){return _0x1d3da5[_0xabbf('0xa')](_0xabbf('0xb'),attributes,{'tableName':_0xabbf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd4aa=['whatsapp_accounts','api','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd4aa,0x65));var _0xad4a=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xd4aa[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xad4a('0x0'));var moment=require('moment');var BPromise=require(_0xad4a('0x1'));var rp=require(_0xad4a('0x2'));var fs=require('fs');var path=require(_0xad4a('0x3'));var rimraf=require(_0xad4a('0x4'));var config=require(_0xad4a('0x5'));var attributes=require(_0xad4a('0x6'));module[_0xad4a('0x7')]=function(_0x2db59a,_0x5dfffd){return _0x2db59a['define'](_0xad4a('0x8'),attributes,{'tableName':_0xad4a('0x9'),'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 0dac0a1..323d7af 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 _0xeefe=['defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','map','model','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis'];(function(_0xe3042e,_0x3b370a){var _0x254cb5=function(_0xcf70ee){while(--_0xcf70ee){_0xe3042e['push'](_0xe3042e['shift']());}};_0x254cb5(++_0x3b370a);}(_0xeefe,0xf2));var _0xeeef=function(_0x2aead5,_0x31abc2){_0x2aead5=_0x2aead5-0x0;var _0x21dac5=_0xeefe[_0x2aead5];return _0x21dac5;};'use strict';var _=require(_0xeeef('0x0'));var util=require('util');var moment=require(_0xeeef('0x1'));var BPromise=require('bluebird');var rs=require(_0xeeef('0x2'));var fs=require('fs');var Redis=require(_0xeeef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xeeef('0x4'));var logger=require('../../config/logger')(_0xeeef('0x5'));var config=require(_0xeeef('0x6'));var jayson=require(_0xeeef('0x7'));var client=jayson[_0xeeef('0x8')]['http']({'port':0x232a});config[_0xeeef('0x9')]=_[_0xeeef('0xa')](config[_0xeeef('0x9')],{'host':_0xeeef('0xb'),'port':0x18eb});var socket=require(_0xeeef('0xc'))(new Redis(config[_0xeeef('0x9')]));require(_0xeeef('0xd'))[_0xeeef('0xe')](socket);function respondWithRpcPromise(_0x3257f7,_0x3a7729,_0x5b5ccd){return new BPromise(function(_0x45f63b,_0x3d3d53){return client[_0xeeef('0xf')](_0x3257f7,_0x5b5ccd)[_0xeeef('0x10')](function(_0xc3daf7){logger['info'](_0xeeef('0x11'),_0x3a7729,_0xeeef('0x12'));logger[_0xeeef('0x13')](_0xeeef('0x14'),_0x3a7729,_0xeeef('0x12'),JSON['stringify'](_0xc3daf7));if(_0xc3daf7['error']){if(_0xc3daf7[_0xeeef('0x15')]['code']===0x1f4){logger[_0xeeef('0x15')](_0xeeef('0x11'),_0x3a7729,_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);return _0x3d3d53(_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);}logger[_0xeeef('0x15')](_0xeeef('0x11'),_0x3a7729,_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);return _0x45f63b(_0xc3daf7[_0xeeef('0x15')][_0xeeef('0x16')]);}else{logger[_0xeeef('0x17')](_0xeeef('0x11'),_0x3a7729,_0xeeef('0x12'));_0x45f63b(_0xc3daf7[_0xeeef('0x18')][_0xeeef('0x16')]);}})[_0xeeef('0x19')](function(_0x341249){logger[_0xeeef('0x15')](_0xeeef('0x11'),_0x3a7729,_0x341249);_0x3d3d53(_0x341249);});});}exports[_0xeeef('0x1a')]=function(_0x1ff712){var _0x56c454=this;return new Promise(function(_0x5b4be8,_0x4ef8c6){return db[_0xeeef('0x1b')][_0xeeef('0x1c')]({'raw':_0x1ff712[_0xeeef('0x1d')]?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x1e')]===undefined?!![]:![]:!![],'where':_0x1ff712[_0xeeef('0x1d')]?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x1f')]||null:null,'attributes':_0x1ff712[_0xeeef('0x1d')]?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x20')]||null:null,'include':_0x1ff712['options']?_0x1ff712[_0xeeef('0x1d')][_0xeeef('0x21')]?_[_0xeeef('0x22')](_0x1ff712[_0xeeef('0x1d')]['include'],function(_0x2f40be){return{'model':db[_0x2f40be['model']],'as':_0x2f40be['as'],'attributes':_0x2f40be[_0xeeef('0x20')],'include':_0x2f40be[_0xeeef('0x21')]?_[_0xeeef('0x22')](_0x2f40be[_0xeeef('0x21')],function(_0x2a6552){return{'model':db[_0x2a6552[_0xeeef('0x23')]],'as':_0x2a6552['as'],'attributes':_0x2a6552['attributes'],'include':_0x2a6552[_0xeeef('0x21')]?_[_0xeeef('0x22')](_0x2a6552[_0xeeef('0x21')],function(_0x5e85e9){return{'model':db[_0x5e85e9['model']],'as':_0x5e85e9['as'],'attributes':_0x5e85e9['attributes']};}):[]};}):[]};}):[]:[]})[_0xeeef('0x10')](function(_0x287af7){logger[_0xeeef('0x17')]('ShowWhatsappAccount',_0x1ff712);logger[_0xeeef('0x13')](_0xeeef('0x1a'),_0x1ff712,JSON['stringify'](_0x287af7));_0x5b4be8(_0x287af7);})[_0xeeef('0x19')](function(_0x1d96c2){logger[_0xeeef('0x15')](_0xeeef('0x1a'),_0x1d96c2[_0xeeef('0x16')],_0x1ff712);_0x4ef8c6(_0x56c454[_0xeeef('0x15')](0x1f4,_0x1d96c2[_0xeeef('0x16')]));});});}; \ No newline at end of file +var _0xd06f=['info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','result','message','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./whatsappAccount.socket','register','request'];(function(_0x4ea31e,_0x45cc3d){var _0x151f45=function(_0x3283ff){while(--_0x3283ff){_0x4ea31e['push'](_0x4ea31e['shift']());}};_0x151f45(++_0x45cc3d);}(_0xd06f,0x13c));var _0xfd06=function(_0x507fd2,_0x3c7dd5){_0x507fd2=_0x507fd2-0x0;var _0x1721d3=_0xd06f[_0x507fd2];return _0x1721d3;};'use strict';var _=require(_0xfd06('0x0'));var util=require(_0xfd06('0x1'));var moment=require('moment');var BPromise=require(_0xfd06('0x2'));var rs=require(_0xfd06('0x3'));var fs=require('fs');var Redis=require(_0xfd06('0x4'));var db=require(_0xfd06('0x5'))['db'];var utils=require(_0xfd06('0x6'));var logger=require(_0xfd06('0x7'))(_0xfd06('0x8'));var config=require('../../config/environment');var jayson=require(_0xfd06('0x9'));var client=jayson[_0xfd06('0xa')][_0xfd06('0xb')]({'port':0x232a});config[_0xfd06('0xc')]=_[_0xfd06('0xd')](config[_0xfd06('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfd06('0xc')]));require(_0xfd06('0xe'))[_0xfd06('0xf')](socket);function respondWithRpcPromise(_0x50327f,_0x1c5bd0,_0x1a83be){return new BPromise(function(_0x1c4317,_0x12a649){return client[_0xfd06('0x10')](_0x50327f,_0x1a83be)['then'](function(_0x2c1528){logger[_0xfd06('0x11')](_0xfd06('0x12'),_0x1c5bd0,_0xfd06('0x13'));logger[_0xfd06('0x14')](_0xfd06('0x15'),_0x1c5bd0,_0xfd06('0x13'),JSON[_0xfd06('0x16')](_0x2c1528));if(_0x2c1528[_0xfd06('0x17')]){if(_0x2c1528[_0xfd06('0x17')][_0xfd06('0x18')]===0x1f4){logger['error'](_0xfd06('0x12'),_0x1c5bd0,_0x2c1528[_0xfd06('0x17')]['message']);return _0x12a649(_0x2c1528[_0xfd06('0x17')]['message']);}logger[_0xfd06('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x1c5bd0,_0x2c1528[_0xfd06('0x17')]['message']);return _0x1c4317(_0x2c1528[_0xfd06('0x17')]['message']);}else{logger[_0xfd06('0x11')](_0xfd06('0x12'),_0x1c5bd0,_0xfd06('0x13'));_0x1c4317(_0x2c1528[_0xfd06('0x19')][_0xfd06('0x1a')]);}})[_0xfd06('0x1b')](function(_0x2f86b3){logger[_0xfd06('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x1c5bd0,_0x2f86b3);_0x12a649(_0x2f86b3);});});}exports[_0xfd06('0x1c')]=function(_0x5eda75){var _0x20fb08=this;return new Promise(function(_0x157c54,_0xaf9911){return db[_0xfd06('0x1d')][_0xfd06('0x1e')]({'raw':_0x5eda75[_0xfd06('0x1f')]?_0x5eda75[_0xfd06('0x1f')][_0xfd06('0x20')]===undefined?!![]:![]:!![],'where':_0x5eda75[_0xfd06('0x1f')]?_0x5eda75[_0xfd06('0x1f')]['where']||null:null,'attributes':_0x5eda75[_0xfd06('0x1f')]?_0x5eda75[_0xfd06('0x1f')][_0xfd06('0x21')]||null:null,'include':_0x5eda75[_0xfd06('0x1f')]?_0x5eda75['options'][_0xfd06('0x22')]?_[_0xfd06('0x23')](_0x5eda75['options']['include'],function(_0x1d53c4){return{'model':db[_0x1d53c4[_0xfd06('0x24')]],'as':_0x1d53c4['as'],'attributes':_0x1d53c4[_0xfd06('0x21')],'include':_0x1d53c4[_0xfd06('0x22')]?_[_0xfd06('0x23')](_0x1d53c4[_0xfd06('0x22')],function(_0x9c8450){return{'model':db[_0x9c8450[_0xfd06('0x24')]],'as':_0x9c8450['as'],'attributes':_0x9c8450[_0xfd06('0x21')],'include':_0x9c8450[_0xfd06('0x22')]?_['map'](_0x9c8450[_0xfd06('0x22')],function(_0x4717fd){return{'model':db[_0x4717fd['model']],'as':_0x4717fd['as'],'attributes':_0x4717fd[_0xfd06('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4ba929){logger[_0xfd06('0x11')](_0xfd06('0x1c'),_0x5eda75);logger[_0xfd06('0x14')](_0xfd06('0x1c'),_0x5eda75,JSON['stringify'](_0x4ba929));_0x157c54(_0x4ba929);})[_0xfd06('0x1b')](function(_0x5def95){logger[_0xfd06('0x17')](_0xfd06('0x1c'),_0x5def95[_0xfd06('0x1a')],_0x5eda75);_0xaf9911(_0x20fb08[_0xfd06('0x17')](0x1f4,_0x5def95[_0xfd06('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index cc38853..301b0bd 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 _0xd09c=['update','removeListener','register','length','./whatsappAccount.events','remove'];(function(_0x5be581,_0xa69d1a){var _0x2b9297=function(_0x304b8f){while(--_0x304b8f){_0x5be581['push'](_0x5be581['shift']());}};_0x2b9297(++_0xa69d1a);}(_0xd09c,0x11e));var _0xcd09=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd09c[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappAccountEvents=require(_0xcd09('0x0'));var events=['save',_0xcd09('0x1'),_0xcd09('0x2')];function createListener(_0x5b363e,_0x26b8eb){return function(_0x223caf){_0x26b8eb['emit'](_0x5b363e,_0x223caf);};}function removeListener(_0x514a47,_0x5ad07d){return function(){WhatsappAccountEvents[_0xcd09('0x3')](_0x514a47,_0x5ad07d);};}exports[_0xcd09('0x4')]=function(_0xafc297){for(var _0x3d011d=0x0,_0x2d204e=events[_0xcd09('0x5')];_0x3d011d<_0x2d204e;_0x3d011d++){var _0x56fba4=events[_0x3d011d];var _0x1a721c=createListener('whatsappAccount:'+_0x56fba4,_0xafc297);WhatsappAccountEvents['on'](_0x56fba4,_0x1a721c);}}; \ No newline at end of file +var _0xfa0a=['length','whatsappAccount:','./whatsappAccount.events','update','emit','register'];(function(_0xa46951,_0x38a4ee){var _0x28e29f=function(_0x4220f1){while(--_0x4220f1){_0xa46951['push'](_0xa46951['shift']());}};_0x28e29f(++_0x38a4ee);}(_0xfa0a,0xb6));var _0xafa0=function(_0x198f7b,_0x2acdb8){_0x198f7b=_0x198f7b-0x0;var _0x48b989=_0xfa0a[_0x198f7b];return _0x48b989;};'use strict';var WhatsappAccountEvents=require(_0xafa0('0x0'));var events=['save','remove',_0xafa0('0x1')];function createListener(_0x1daa76,_0x16f085){return function(_0x2ed20e){_0x16f085[_0xafa0('0x2')](_0x1daa76,_0x2ed20e);};}function removeListener(_0x45d987,_0x7c26eb){return function(){WhatsappAccountEvents['removeListener'](_0x45d987,_0x7c26eb);};}exports[_0xafa0('0x3')]=function(_0x59e1bb){for(var _0x3548a1=0x0,_0x251861=events[_0xafa0('0x4')];_0x3548a1<_0x251861;_0x3548a1++){var _0x397a70=events[_0x3548a1];var _0x7dfc3a=createListener(_0xafa0('0x5')+_0x397a70,_0x59e1bb);WhatsappAccountEvents['on'](_0x397a70,_0x7dfc3a);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index a69ade5..cc16fc5 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 _0x502b=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappApplication.controller','get','/:id','isAuthenticated','show','create','put','update','delete','destroy','exports','multer'];(function(_0x49365d,_0x227a7c){var _0x508eaa=function(_0x4c4464){while(--_0x4c4464){_0x49365d['push'](_0x49365d['shift']());}};_0x508eaa(++_0x227a7c);}(_0x502b,0x1b7));var _0xb502=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x502b[_0x3513a0];return _0x2bdeb9;};'use strict';var multer=require(_0xb502('0x0'));var util=require(_0xb502('0x1'));var path=require(_0xb502('0x2'));var timeout=require(_0xb502('0x3'));var express=require(_0xb502('0x4'));var router=express[_0xb502('0x5')]();var fs_extra=require(_0xb502('0x6'));var auth=require(_0xb502('0x7'));var interaction=require(_0xb502('0x8'));var config=require('../../config/environment');var controller=require(_0xb502('0x9'));router[_0xb502('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb502('0xa')](_0xb502('0xb'),auth[_0xb502('0xc')](),controller[_0xb502('0xd')]);router['post']('/',auth[_0xb502('0xc')](),controller[_0xb502('0xe')]);router[_0xb502('0xf')]('/:id',auth[_0xb502('0xc')](),controller[_0xb502('0x10')]);router[_0xb502('0x11')]('/:id',auth[_0xb502('0xc')](),controller[_0xb502('0x12')]);module[_0xb502('0x13')]=router; \ No newline at end of file +var _0x239d=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','index','get','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x18b191,_0x4e0684){var _0x43e146=function(_0x4b464e){while(--_0x4b464e){_0x18b191['push'](_0x18b191['shift']());}};_0x43e146(++_0x4e0684);}(_0x239d,0x1e2));var _0xd239=function(_0x3771d4,_0x38a3de){_0x3771d4=_0x3771d4-0x0;var _0xb40f4c=_0x239d[_0x3771d4];return _0xb40f4c;};'use strict';var multer=require(_0xd239('0x0'));var util=require(_0xd239('0x1'));var path=require(_0xd239('0x2'));var timeout=require(_0xd239('0x3'));var express=require(_0xd239('0x4'));var router=express[_0xd239('0x5')]();var fs_extra=require(_0xd239('0x6'));var auth=require(_0xd239('0x7'));var interaction=require(_0xd239('0x8'));var config=require(_0xd239('0x9'));var controller=require(_0xd239('0xa'));router['get']('/',auth['isAuthenticated'](),controller[_0xd239('0xb')]);router[_0xd239('0xc')](_0xd239('0xd'),auth[_0xd239('0xe')](),controller[_0xd239('0xf')]);router[_0xd239('0x10')]('/',auth[_0xd239('0xe')](),controller['create']);router[_0xd239('0x11')](_0xd239('0xd'),auth[_0xd239('0xe')](),controller[_0xd239('0x12')]);router[_0xd239('0x13')](_0xd239('0xd'),auth['isAuthenticated'](),controller[_0xd239('0x14')]);module[_0xd239('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 77d249d..81e23a9 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 _0xc550=['*,*,*,*','exports','STRING','noop','TEXT'];(function(_0x12d72c,_0x37b2f9){var _0x367399=function(_0x30f7a0){while(--_0x30f7a0){_0x12d72c['push'](_0x12d72c['shift']());}};_0x367399(++_0x37b2f9);}(_0xc550,0x15a));var _0x0c55=function(_0x10baeb,_0x1f83cf){_0x10baeb=_0x10baeb-0x0;var _0x54493e=_0xc550[_0x10baeb];return _0x54493e;};'use strict';var Sequelize=require('sequelize');module[_0x0c55('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0c55('0x1')],'allowNull':![],'defaultValue':_0x0c55('0x2')},'appdata':{'type':Sequelize[_0x0c55('0x3')]()},'description':{'type':Sequelize[_0x0c55('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x0c55('0x4')}}; \ No newline at end of file +var _0xa31c=['noop','TEXT','sequelize','exports','INTEGER','STRING'];(function(_0x3a9813,_0x30b33d){var _0x11887b=function(_0x3548c1){while(--_0x3548c1){_0x3a9813['push'](_0x3a9813['shift']());}};_0x11887b(++_0x30b33d);}(_0xa31c,0x104));var _0xca31=function(_0x5125cd,_0x1acb11){_0x5125cd=_0x5125cd-0x0;var _0x25777e=_0xa31c[_0x5125cd];return _0x25777e;};'use strict';var Sequelize=require(_0xca31('0x0'));module[_0xca31('0x1')]={'priority':{'type':Sequelize[_0xca31('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xca31('0x3')],'allowNull':![],'defaultValue':_0xca31('0x4')},'appdata':{'type':Sequelize[_0xca31('0x5')]()},'description':{'type':Sequelize[_0xca31('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 465ab15..0ec8428 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 _0xdbb9=['destroy','stack','name','index','map','WhatsappApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','save','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdbb9,0xf9));var _0x9dbb=function(_0x55e2b2,_0x1a57ac){_0x55e2b2=_0x55e2b2-0x0;var _0x28bdc4=_0xdbb9[_0x55e2b2];return _0x28bdc4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9dbb('0x0'));var zipdir=require(_0x9dbb('0x1'));var jsonpatch=require(_0x9dbb('0x2'));var rp=require(_0x9dbb('0x3'));var moment=require('moment');var BPromise=require(_0x9dbb('0x4'));var Mustache=require(_0x9dbb('0x5'));var util=require(_0x9dbb('0x6'));var path=require(_0x9dbb('0x7'));var sox=require(_0x9dbb('0x8'));var csv=require(_0x9dbb('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9dbb('0xa'));var crypto=require(_0x9dbb('0xb'));var jsforce=require(_0x9dbb('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9dbb('0xd'));var Papa=require(_0x9dbb('0xe'));var Redis=require(_0x9dbb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9dbb('0x10'));var as=require(_0x9dbb('0x11'));var hardwareService=require(_0x9dbb('0x12'));var logger=require(_0x9dbb('0x13'))('api');var utils=require(_0x9dbb('0x14'));var config=require(_0x9dbb('0x15'));var licenseUtil=require(_0x9dbb('0x16'));var db=require(_0x9dbb('0x17'))['db'];function respondWithStatusCode(_0x3fe0bd,_0x4468e8){_0x4468e8=_0x4468e8||0xcc;return function(_0x382cc6){if(_0x382cc6){return _0x3fe0bd[_0x9dbb('0x18')](_0x4468e8);}return _0x3fe0bd[_0x9dbb('0x19')](_0x4468e8)[_0x9dbb('0x1a')]();};}function respondWithResult(_0x293028,_0x2c36d3){_0x2c36d3=_0x2c36d3||0xc8;return function(_0x24b20b){if(_0x24b20b){return _0x293028[_0x9dbb('0x19')](_0x2c36d3)[_0x9dbb('0x1b')](_0x24b20b);}};}function respondWithFilteredResult(_0x464df5,_0x528110){return function(_0x1366b2){if(_0x1366b2){var _0x30add1=typeof _0x528110[_0x9dbb('0x1c')]===_0x9dbb('0x1d')&&typeof _0x528110[_0x9dbb('0x1e')]==='undefined';var _0x382d61=_0x1366b2[_0x9dbb('0x1f')];var _0x2383cf=_0x30add1?0x0:_0x528110[_0x9dbb('0x1c')];var _0x45c6f5=_0x30add1?_0x1366b2['count']:_0x528110[_0x9dbb('0x1c')]+_0x528110['limit'];var _0x3de435;if(_0x45c6f5>=_0x382d61){_0x45c6f5=_0x382d61;_0x3de435=0xc8;}else{_0x3de435=0xce;}_0x464df5['status'](_0x3de435);return _0x464df5[_0x9dbb('0x20')]('Content-Range',_0x2383cf+'-'+_0x45c6f5+'/'+_0x382d61)[_0x9dbb('0x1b')](_0x1366b2);}return null;};}function patchUpdates(_0x192eb5){return function(_0x188c75){try{jsonpatch['apply'](_0x188c75,_0x192eb5,!![]);}catch(_0x50e5e3){return BPromise['reject'](_0x50e5e3);}return _0x188c75[_0x9dbb('0x21')]();};}function saveUpdates(_0x35c136,_0x48bb65){return function(_0x4a07ef){if(_0x4a07ef){return _0x4a07ef['update'](_0x35c136)[_0x9dbb('0x22')](function(_0x245d12){return _0x245d12;});}return null;};}function removeEntity(_0x10c06a,_0x55e2ef){return function(_0x1f30ec){if(_0x1f30ec){return _0x1f30ec[_0x9dbb('0x23')]()[_0x9dbb('0x22')](function(){_0x10c06a[_0x9dbb('0x19')](0xcc)[_0x9dbb('0x1a')]();});}};}function handleEntityNotFound(_0x3e51ca,_0x668f7b){return function(_0x187486){if(!_0x187486){_0x3e51ca[_0x9dbb('0x18')](0x194);}return _0x187486;};}function handleError(_0x127742,_0x25614a){_0x25614a=_0x25614a||0x1f4;return function(_0x27a6f6){logger['error'](_0x27a6f6[_0x9dbb('0x24')]);if(_0x27a6f6['name']){delete _0x27a6f6[_0x9dbb('0x25')];}_0x127742[_0x9dbb('0x19')](_0x25614a)['send'](_0x27a6f6);};}exports[_0x9dbb('0x26')]=function(_0x4ebd57,_0x4b5ce1){var _0x589f63={},_0x25555c={},_0x3578b3={'count':0x0,'rows':[]};var _0x491324=_[_0x9dbb('0x27')](db[_0x9dbb('0x28')]['rawAttributes'],function(_0x71692a){return{'name':_0x71692a[_0x9dbb('0x29')],'type':_0x71692a[_0x9dbb('0x2a')]['key']};});_0x25555c[_0x9dbb('0x2b')]=_['map'](_0x491324,_0x9dbb('0x25'));_0x25555c[_0x9dbb('0x2c')]=_[_0x9dbb('0x2d')](_0x4ebd57[_0x9dbb('0x2c')]);_0x25555c[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],_0x25555c[_0x9dbb('0x2c')]);_0x589f63[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x25555c[_0x9dbb('0x2b')],qs['fields'](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x31')]));_0x589f63[_0x9dbb('0x30')]=_0x589f63[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x589f63[_0x9dbb('0x30')]:_0x25555c[_0x9dbb('0x2b')];if(!_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x33')](_0x9dbb('0x34'))){_0x589f63[_0x9dbb('0x1e')]=qs[_0x9dbb('0x1e')](_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x1e')]);_0x589f63[_0x9dbb('0x1c')]=qs[_0x9dbb('0x1c')](_0x4ebd57[_0x9dbb('0x2c')]['offset']);}_0x589f63[_0x9dbb('0x35')]=qs[_0x9dbb('0x36')](_0x4ebd57[_0x9dbb('0x2c')]['sort']);_0x589f63[_0x9dbb('0x37')]=qs[_0x9dbb('0x2e')](_[_0x9dbb('0x38')](_0x4ebd57[_0x9dbb('0x2c')],_0x25555c[_0x9dbb('0x2e')]),_0x491324);if(_0x4ebd57[_0x9dbb('0x2c')]['filter']){_0x589f63[_0x9dbb('0x37')]=_['merge'](_0x589f63[_0x9dbb('0x37')],{'$or':_[_0x9dbb('0x27')](_0x491324,function(_0xa3bc3){if(_0xa3bc3[_0x9dbb('0x2a')]!=='VIRTUAL'){var _0x1a5eeb={};_0x1a5eeb[_0xa3bc3['name']]={'$like':'%'+_0x4ebd57[_0x9dbb('0x2c')]['filter']+'%'};return _0x1a5eeb;}})});}_0x589f63=_[_0x9dbb('0x39')]({},_0x589f63,_0x4ebd57[_0x9dbb('0x3a')]);var _0x34524e={'where':_0x589f63[_0x9dbb('0x37')]};return db[_0x9dbb('0x28')]['count'](_0x34524e)[_0x9dbb('0x22')](function(_0x59eea1){_0x3578b3[_0x9dbb('0x1f')]=_0x59eea1;if(_0x4ebd57[_0x9dbb('0x2c')][_0x9dbb('0x3b')]){_0x589f63[_0x9dbb('0x3c')]=[{'all':!![]}];}return db[_0x9dbb('0x28')][_0x9dbb('0x3d')](_0x589f63);})[_0x9dbb('0x22')](function(_0x49e63f){_0x3578b3[_0x9dbb('0x3e')]=_0x49e63f;return _0x3578b3;})['then'](respondWithFilteredResult(_0x4b5ce1,_0x589f63))[_0x9dbb('0x3f')](handleError(_0x4b5ce1,null));};exports[_0x9dbb('0x40')]=function(_0x34c114,_0x104ec5){var _0x490833={'raw':!![],'where':{'id':_0x34c114['params']['id']}},_0x2f99ed={};_0x2f99ed[_0x9dbb('0x2b')]=_['keys'](db[_0x9dbb('0x28')][_0x9dbb('0x41')]);_0x2f99ed['query']=_['keys'](_0x34c114[_0x9dbb('0x2c')]);_0x2f99ed[_0x9dbb('0x2e')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],_0x2f99ed[_0x9dbb('0x2c')]);_0x490833[_0x9dbb('0x30')]=_[_0x9dbb('0x2f')](_0x2f99ed[_0x9dbb('0x2b')],qs[_0x9dbb('0x31')](_0x34c114['query'][_0x9dbb('0x31')]));_0x490833['attributes']=_0x490833[_0x9dbb('0x30')][_0x9dbb('0x32')]?_0x490833[_0x9dbb('0x30')]:_0x2f99ed[_0x9dbb('0x2b')];if(_0x34c114['query'][_0x9dbb('0x3b')]){_0x490833['include']=[{'all':!![]}];}_0x490833=_['merge']({},_0x490833,_0x34c114[_0x9dbb('0x3a')]);return db[_0x9dbb('0x28')][_0x9dbb('0x42')](_0x490833)[_0x9dbb('0x22')](handleEntityNotFound(_0x104ec5,null))[_0x9dbb('0x22')](respondWithResult(_0x104ec5,null))[_0x9dbb('0x3f')](handleError(_0x104ec5,null));};exports['create']=function(_0x202235,_0x56d319){return db[_0x9dbb('0x28')][_0x9dbb('0x43')](_0x202235[_0x9dbb('0x44')],{})[_0x9dbb('0x22')](respondWithResult(_0x56d319,0xc9))[_0x9dbb('0x3f')](handleError(_0x56d319,null));};exports[_0x9dbb('0x45')]=function(_0x34304a,_0x31c532){if(_0x34304a['body']['id']){delete _0x34304a[_0x9dbb('0x44')]['id'];}return db['WhatsappApplication'][_0x9dbb('0x42')]({'where':{'id':_0x34304a[_0x9dbb('0x46')]['id']}})['then'](handleEntityNotFound(_0x31c532,null))[_0x9dbb('0x22')](saveUpdates(_0x34304a['body'],null))['then'](respondWithResult(_0x31c532,null))['catch'](handleError(_0x31c532,null));};exports[_0x9dbb('0x23')]=function(_0x3c19bb,_0x5c398b){return db[_0x9dbb('0x28')]['find']({'where':{'id':_0x3c19bb[_0x9dbb('0x46')]['id']}})[_0x9dbb('0x22')](handleEntityNotFound(_0x5c398b,null))[_0x9dbb('0x22')](removeEntity(_0x5c398b,null))[_0x9dbb('0x3f')](handleError(_0x5c398b,null));}; \ No newline at end of file +var _0x8952=['hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','rows','show','params','keys','includeAll','include','catch','create','body','destroy','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8952,0x17e));var _0x2895=function(_0x4e40a6,_0x1961d6){_0x4e40a6=_0x4e40a6-0x0;var _0x4cbe76=_0x8952[_0x4e40a6];return _0x4cbe76;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2895('0x0'));var zipdir=require(_0x2895('0x1'));var jsonpatch=require(_0x2895('0x2'));var rp=require(_0x2895('0x3'));var moment=require(_0x2895('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2895('0x5'));var util=require(_0x2895('0x6'));var path=require(_0x2895('0x7'));var sox=require('sox');var csv=require(_0x2895('0x8'));var ejs=require(_0x2895('0x9'));var fs=require('fs');var fs_extra=require(_0x2895('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2895('0xb'));var jsforce=require(_0x2895('0xc'));var deskjs=require(_0x2895('0xd'));var toCsv=require(_0x2895('0x8'));var querystring=require(_0x2895('0xe'));var Papa=require('papaparse');var Redis=require(_0x2895('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2895('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2895('0x11'));var utils=require(_0x2895('0x12'));var config=require(_0x2895('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x2895('0x14'))['db'];function respondWithStatusCode(_0x3924be,_0x4b1342){_0x4b1342=_0x4b1342||0xcc;return function(_0x32574c){if(_0x32574c){return _0x3924be[_0x2895('0x15')](_0x4b1342);}return _0x3924be['status'](_0x4b1342)['end']();};}function respondWithResult(_0x1d1493,_0x2ca2ac){_0x2ca2ac=_0x2ca2ac||0xc8;return function(_0x5777a0){if(_0x5777a0){return _0x1d1493[_0x2895('0x16')](_0x2ca2ac)[_0x2895('0x17')](_0x5777a0);}};}function respondWithFilteredResult(_0x27b50e,_0x1ae013){return function(_0x1d3659){if(_0x1d3659){var _0x2627e6=typeof _0x1ae013[_0x2895('0x18')]===_0x2895('0x19')&&typeof _0x1ae013[_0x2895('0x1a')]===_0x2895('0x19');var _0x10a1bf=_0x1d3659[_0x2895('0x1b')];var _0xbf8b63=_0x2627e6?0x0:_0x1ae013[_0x2895('0x18')];var _0x155124=_0x2627e6?_0x1d3659[_0x2895('0x1b')]:_0x1ae013[_0x2895('0x18')]+_0x1ae013[_0x2895('0x1a')];var _0x5a8eab;if(_0x155124>=_0x10a1bf){_0x155124=_0x10a1bf;_0x5a8eab=0xc8;}else{_0x5a8eab=0xce;}_0x27b50e['status'](_0x5a8eab);return _0x27b50e['set'](_0x2895('0x1c'),_0xbf8b63+'-'+_0x155124+'/'+_0x10a1bf)[_0x2895('0x17')](_0x1d3659);}return null;};}function patchUpdates(_0x3ec4da){return function(_0x593e47){try{jsonpatch[_0x2895('0x1d')](_0x593e47,_0x3ec4da,!![]);}catch(_0x190b79){return BPromise[_0x2895('0x1e')](_0x190b79);}return _0x593e47[_0x2895('0x1f')]();};}function saveUpdates(_0x8b75e0,_0x5dbbfe){return function(_0x30c6c3){if(_0x30c6c3){return _0x30c6c3[_0x2895('0x20')](_0x8b75e0)['then'](function(_0x142e58){return _0x142e58;});}return null;};}function removeEntity(_0x384357,_0x6f8ad4){return function(_0x511286){if(_0x511286){return _0x511286['destroy']()[_0x2895('0x21')](function(){_0x384357[_0x2895('0x16')](0xcc)[_0x2895('0x22')]();});}};}function handleEntityNotFound(_0x4a21cf,_0x3d3320){return function(_0x3690ce){if(!_0x3690ce){_0x4a21cf['sendStatus'](0x194);}return _0x3690ce;};}function handleError(_0x293ad3,_0x127540){_0x127540=_0x127540||0x1f4;return function(_0x2cd4df){logger['error'](_0x2cd4df[_0x2895('0x23')]);if(_0x2cd4df[_0x2895('0x24')]){delete _0x2cd4df['name'];}_0x293ad3[_0x2895('0x16')](_0x127540)['send'](_0x2cd4df);};}exports['index']=function(_0x18a935,_0x4ee2cc){var _0xfa4f85={},_0x381538={},_0x4fdd94={'count':0x0,'rows':[]};var _0x5574bf=_[_0x2895('0x25')](db[_0x2895('0x26')][_0x2895('0x27')],function(_0x14e343){return{'name':_0x14e343[_0x2895('0x28')],'type':_0x14e343[_0x2895('0x29')][_0x2895('0x2a')]};});_0x381538['model']=_[_0x2895('0x25')](_0x5574bf,_0x2895('0x24'));_0x381538[_0x2895('0x2b')]=_['keys'](_0x18a935[_0x2895('0x2b')]);_0x381538[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],_0x381538['query']);_0xfa4f85[_0x2895('0x2f')]=_[_0x2895('0x2d')](_0x381538[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x18a935[_0x2895('0x2b')]['fields']));_0xfa4f85['attributes']=_0xfa4f85[_0x2895('0x2f')][_0x2895('0x31')]?_0xfa4f85['attributes']:_0x381538[_0x2895('0x2e')];if(!_0x18a935['query'][_0x2895('0x32')](_0x2895('0x33'))){_0xfa4f85['limit']=qs[_0x2895('0x1a')](_0x18a935['query'][_0x2895('0x1a')]);_0xfa4f85['offset']=qs['offset'](_0x18a935[_0x2895('0x2b')][_0x2895('0x18')]);}_0xfa4f85[_0x2895('0x34')]=qs['sort'](_0x18a935[_0x2895('0x2b')][_0x2895('0x35')]);_0xfa4f85[_0x2895('0x36')]=qs[_0x2895('0x2c')](_[_0x2895('0x37')](_0x18a935[_0x2895('0x2b')],_0x381538[_0x2895('0x2c')]),_0x5574bf);if(_0x18a935[_0x2895('0x2b')][_0x2895('0x38')]){_0xfa4f85[_0x2895('0x36')]=_['merge'](_0xfa4f85[_0x2895('0x36')],{'$or':_[_0x2895('0x25')](_0x5574bf,function(_0x47413d){if(_0x47413d[_0x2895('0x29')]!==_0x2895('0x39')){var _0x12d7d8={};_0x12d7d8[_0x47413d[_0x2895('0x24')]]={'$like':'%'+_0x18a935['query']['filter']+'%'};return _0x12d7d8;}})});}_0xfa4f85=_[_0x2895('0x3a')]({},_0xfa4f85,_0x18a935[_0x2895('0x3b')]);var _0x24b9e0={'where':_0xfa4f85[_0x2895('0x36')]};return db[_0x2895('0x26')][_0x2895('0x1b')](_0x24b9e0)['then'](function(_0x5d18ef){_0x4fdd94[_0x2895('0x1b')]=_0x5d18ef;if(_0x18a935[_0x2895('0x2b')]['includeAll']){_0xfa4f85['include']=[{'all':!![]}];}return db[_0x2895('0x26')][_0x2895('0x3c')](_0xfa4f85);})[_0x2895('0x21')](function(_0x28967f){_0x4fdd94[_0x2895('0x3d')]=_0x28967f;return _0x4fdd94;})[_0x2895('0x21')](respondWithFilteredResult(_0x4ee2cc,_0xfa4f85))['catch'](handleError(_0x4ee2cc,null));};exports[_0x2895('0x3e')]=function(_0x2cfb24,_0x18ca24){var _0x1537fd={'raw':!![],'where':{'id':_0x2cfb24[_0x2895('0x3f')]['id']}},_0x4af6d6={};_0x4af6d6[_0x2895('0x2e')]=_[_0x2895('0x40')](db[_0x2895('0x26')]['rawAttributes']);_0x4af6d6['query']=_[_0x2895('0x40')](_0x2cfb24[_0x2895('0x2b')]);_0x4af6d6[_0x2895('0x2c')]=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],_0x4af6d6['query']);_0x1537fd['attributes']=_[_0x2895('0x2d')](_0x4af6d6[_0x2895('0x2e')],qs[_0x2895('0x30')](_0x2cfb24[_0x2895('0x2b')][_0x2895('0x30')]));_0x1537fd[_0x2895('0x2f')]=_0x1537fd[_0x2895('0x2f')]['length']?_0x1537fd[_0x2895('0x2f')]:_0x4af6d6[_0x2895('0x2e')];if(_0x2cfb24[_0x2895('0x2b')][_0x2895('0x41')]){_0x1537fd[_0x2895('0x42')]=[{'all':!![]}];}_0x1537fd=_[_0x2895('0x3a')]({},_0x1537fd,_0x2cfb24[_0x2895('0x3b')]);return db[_0x2895('0x26')]['find'](_0x1537fd)[_0x2895('0x21')](handleEntityNotFound(_0x18ca24,null))[_0x2895('0x21')](respondWithResult(_0x18ca24,null))[_0x2895('0x43')](handleError(_0x18ca24,null));};exports['create']=function(_0xc85aa1,_0x5307a9){return db['WhatsappApplication'][_0x2895('0x44')](_0xc85aa1[_0x2895('0x45')],{})[_0x2895('0x21')](respondWithResult(_0x5307a9,0xc9))[_0x2895('0x43')](handleError(_0x5307a9,null));};exports[_0x2895('0x20')]=function(_0x3cc331,_0x11e53a){if(_0x3cc331['body']['id']){delete _0x3cc331[_0x2895('0x45')]['id'];}return db[_0x2895('0x26')]['find']({'where':{'id':_0x3cc331['params']['id']}})['then'](handleEntityNotFound(_0x11e53a,null))[_0x2895('0x21')](saveUpdates(_0x3cc331[_0x2895('0x45')],null))[_0x2895('0x21')](respondWithResult(_0x11e53a,null))[_0x2895('0x43')](handleError(_0x11e53a,null));};exports[_0x2895('0x46')]=function(_0x3c5261,_0xaca46c){return db[_0x2895('0x26')][_0x2895('0x47')]({'where':{'id':_0x3c5261[_0x2895('0x3f')]['id']}})[_0x2895('0x21')](handleEntityNotFound(_0xaca46c,null))[_0x2895('0x21')](removeEntity(_0xaca46c,null))[_0x2895('0x43')](handleError(_0xaca46c,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 2b87073..ea02abf 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 _0x24ca=['request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x16ed87,_0x1be1a2){var _0xc1a1d8=function(_0x3c0fcf){while(--_0x3c0fcf){_0x16ed87['push'](_0x16ed87['shift']());}};_0xc1a1d8(++_0x1be1a2);}(_0x24ca,0x1bc));var _0xa24c=function(_0x420b24,_0x382adc){_0x420b24=_0x420b24-0x0;var _0x4da552=_0x24ca[_0x420b24];return _0x4da552;};'use strict';var _=require(_0xa24c('0x0'));var util=require('util');var logger=require(_0xa24c('0x1'))(_0xa24c('0x2'));var moment=require(_0xa24c('0x3'));var BPromise=require('bluebird');var rp=require(_0xa24c('0x4'));var fs=require('fs');var path=require(_0xa24c('0x5'));var rimraf=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var attributes=require(_0xa24c('0x8'));module[_0xa24c('0x9')]=function(_0xf0511,_0x3c0aaa){return _0xf0511[_0xa24c('0xa')](_0xa24c('0xb'),attributes,{'tableName':_0xa24c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa24c('0xd')});}; \ No newline at end of file +var _0xe0c3=['path','rimraf','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0xe0c3,0xea));var _0x3e0c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe0c3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3e0c('0xd'),'collate':_0x3e0c('0xe')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index b3f2304..028aa11 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 _0x0e85=['bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util'];(function(_0x355515,_0x1e9fa1){var _0x3216c7=function(_0x2153ae){while(--_0x2153ae){_0x355515['push'](_0x355515['shift']());}};_0x3216c7(++_0x1e9fa1);}(_0x0e85,0x7c));var _0x50e8=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x0e85[_0x525c7b];return _0x27b33e;};'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']('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x50e8('0xd'));_0x42665e(_0x5825f5[_0x50e8('0x13')][_0x50e8('0x12')]);}})[_0x50e8('0x14')](function(_0x211731){logger[_0x50e8('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x3ce904,_0x211731);_0x988da0(_0x211731);});});} \ No newline at end of file +var _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3f0b30,_0x159bc8){var _0x2748a5=function(_0x3b42cc){while(--_0x3b42cc){_0x3f0b30['push'](_0x3f0b30['shift']());}};_0x2748a5(++_0x159bc8);}(_0xdace,0xc5));var _0xedac=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0xdace[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 3f09328..c960f6d 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 _0x25fa=['update','delete','whatsappinteraction:destroy','removeTags','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update'];(function(_0x56323a,_0x36b29c){var _0x2606af=function(_0x55e103){while(--_0x55e103){_0x56323a['push'](_0x56323a['shift']());}};_0x2606af(++_0x36b29c);}(_0x25fa,0x109));var _0xa25f=function(_0x254a99,_0x90ae06){_0x254a99=_0x254a99-0x0;var _0x52882f=_0x25fa[_0x254a99];return _0x52882f;};'use strict';var multer=require(_0xa25f('0x0'));var util=require('util');var path=require(_0xa25f('0x1'));var timeout=require(_0xa25f('0x2'));var express=require('express');var router=express[_0xa25f('0x3')]();var fs_extra=require(_0xa25f('0x4'));var auth=require(_0xa25f('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa25f('0x6'));router['get']('/',auth[_0xa25f('0x7')](),controller[_0xa25f('0x8')]);router[_0xa25f('0x9')](_0xa25f('0xa'),auth[_0xa25f('0x7')](),controller[_0xa25f('0xb')]);router[_0xa25f('0x9')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),controller['show']);router[_0xa25f('0x9')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0xe')]);router[_0xa25f('0x9')](_0xa25f('0xf'),auth[_0xa25f('0x7')](),controller['download']);router[_0xa25f('0x10')]('/',auth[_0xa25f('0x7')](),controller['create']);router[_0xa25f('0x10')](_0xa25f('0xd'),auth['isAuthenticated'](),controller[_0xa25f('0x11')]);router[_0xa25f('0x10')](_0xa25f('0x12'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')](_0xa25f('0x14'),_0xa25f('0x15')),controller[_0xa25f('0x16')]);router[_0xa25f('0x17')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x18')),controller[_0xa25f('0x19')]);router[_0xa25f('0x1a')](_0xa25f('0xc'),auth[_0xa25f('0x7')](),interaction[_0xa25f('0x13')]('whatsapp',_0xa25f('0x1b')),controller['destroy']);router[_0xa25f('0x1a')]('/:id/tags',auth['isAuthenticated'](),controller[_0xa25f('0x1c')]);module['exports']=router; \ No newline at end of file +var _0xaa3f=['/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create','/:id/messages','addMessage'];(function(_0x5adcb7,_0x22f8b3){var _0x4c2d3e=function(_0x4ac02f){while(--_0x4ac02f){_0x5adcb7['push'](_0x5adcb7['shift']());}};_0x4c2d3e(++_0x22f8b3);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x192b7e,_0x5b7f1c){_0x192b7e=_0x192b7e-0x0;var _0x1846b1=_0xaa3f[_0x192b7e];return _0x1846b1;};'use strict';var multer=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var path=require(_0xfaa3('0x2'));var timeout=require(_0xfaa3('0x3'));var express=require(_0xfaa3('0x4'));var router=express[_0xfaa3('0x5')]();var fs_extra=require(_0xfaa3('0x6'));var auth=require(_0xfaa3('0x7'));var interaction=require(_0xfaa3('0x8'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0xfaa3('0x9')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0xa')]);router[_0xfaa3('0x9')](_0xfaa3('0xb'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0xd')]);router[_0xfaa3('0x9')](_0xfaa3('0xe'),auth['isAuthenticated'](),controller[_0xfaa3('0xf')]);router[_0xfaa3('0x9')]('/:id/messages',auth['isAuthenticated'](),controller[_0xfaa3('0x10')]);router[_0xfaa3('0x9')](_0xfaa3('0x11'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x12')]);router[_0xfaa3('0x13')]('/',auth['isAuthenticated'](),controller[_0xfaa3('0x14')]);router['post'](_0xfaa3('0x15'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x16')]);router['post'](_0xfaa3('0x17'),auth['isAuthenticated'](),interaction[_0xfaa3('0x18')](_0xfaa3('0x19'),_0xfaa3('0x1a')),controller[_0xfaa3('0x1b')]);router[_0xfaa3('0x1c')](_0xfaa3('0xe'),auth['isAuthenticated'](),interaction['tracked'](_0xfaa3('0x19'),_0xfaa3('0x1d')),controller[_0xfaa3('0x1e')]);router[_0xfaa3('0x1f')]('/:id',auth['isAuthenticated'](),interaction['tracked']('whatsapp','whatsappinteraction:destroy'),controller[_0xfaa3('0x20')]);router['delete'](_0xfaa3('0x17'),auth[_0xfaa3('0xc')](),controller[_0xfaa3('0x21')]);module[_0xfaa3('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 4d96457..fbfd7c5 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 _0xaf6e=['sequelize','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x747086,_0x34241f){var _0x2dc2c9=function(_0x5b3c76){while(--_0x5b3c76){_0x747086['push'](_0x747086['shift']());}};_0x2dc2c9(++_0x34241f);}(_0xaf6e,0x16e));var _0xeaf6=function(_0x3eae87,_0x3a0f7c){_0x3eae87=_0x3eae87-0x0;var _0x14db70=_0xaf6e[_0x3eae87];return _0x14db70;};'use strict';var Sequelize=require(_0xeaf6('0x0'));var moment=require('moment');module['exports']={'closed':{'type':Sequelize[_0xeaf6('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xeaf6('0x2')]},'disposition':{'type':Sequelize[_0xeaf6('0x3')]},'secondDisposition':{'type':Sequelize[_0xeaf6('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xeaf6('0x3')]},'phone':{'type':Sequelize[_0xeaf6('0x3')]},'read1stAt':{'type':Sequelize[_0xeaf6('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xeaf6('0x4')]('in',_0xeaf6('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xeaf6('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x9805=['DATE','ENUM','INTEGER','sequelize','moment','exports','BOOLEAN','STRING','out'];(function(_0x4fb5ce,_0x3a79f9){var _0x3c07b5=function(_0x5aed51){while(--_0x5aed51){_0x4fb5ce['push'](_0x4fb5ce['shift']());}};_0x3c07b5(++_0x3a79f9);}(_0x9805,0x18f));var _0x5980=function(_0xa6d252,_0xf664a8){_0xa6d252=_0xa6d252-0x0;var _0x498d25=_0x9805[_0xa6d252];return _0x498d25;};'use strict';var Sequelize=require(_0x5980('0x0'));var moment=require(_0x5980('0x1'));module[_0x5980('0x2')]={'closed':{'type':Sequelize[_0x5980('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5980('0x4')]},'thirdDisposition':{'type':Sequelize[_0x5980('0x4')]},'note':{'type':Sequelize[_0x5980('0x4')]},'phone':{'type':Sequelize[_0x5980('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x5980('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5980('0x6')]},'lastMsgDirection':{'type':Sequelize[_0x5980('0x7')]('in',_0x5980('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5980('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5980('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 50e336d..1a0e97b 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 _0x666b=['basename','out','System','lastName','value','renderFile','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','error','stack','name','send','index','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','query','user','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','catch','describe','WhatsappMessage','addMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','tmp','server','files','transcript-%d-%s.zip','User','fullname','push','Contact','firstName','Attachment','Messages','createdAt','direction','secret','read','Account','get','mkdirSync','Whatsapp','Owner','N.A.','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x666b,0x107));var _0xb666=function(_0x4d3599,_0x57e308){_0x4d3599=_0x4d3599-0x0;var _0x3d77b5=_0x666b[_0x4d3599];return _0x3d77b5;};'use strict';var rimraf=require(_0xb666('0x0'));var zipdir=require(_0xb666('0x1'));var moment=require(_0xb666('0x2'));var BPromise=require(_0xb666('0x3'));var util=require(_0xb666('0x4'));var path=require(_0xb666('0x5'));var ejs=require(_0xb666('0x6'));var fs=require('fs');var _=require(_0xb666('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xb666('0x8'));var pdf=require(_0xb666('0x9'));var logger=require(_0xb666('0xa'))('api');var config=require(_0xb666('0xb'));var db=require(_0xb666('0xc'))['db'];config[_0xb666('0xd')]=_[_0xb666('0xe')](config['redis'],{'host':_0xb666('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb666('0xd')]));require('./whatsappInteraction.socket')[_0xb666('0x10')](socket);function respondWithStatusCode(_0x34856e,_0x177e5c){_0x177e5c=_0x177e5c||0xcc;return function(_0x1f84fb){if(_0x1f84fb){return _0x34856e[_0xb666('0x11')](_0x177e5c);}return _0x34856e[_0xb666('0x12')](_0x177e5c)[_0xb666('0x13')]();};}function respondWithResult(_0x27e91b,_0x48d715){_0x48d715=_0x48d715||0xc8;return function(_0x2032c3){if(_0x2032c3){return _0x27e91b[_0xb666('0x12')](_0x48d715)[_0xb666('0x14')](_0x2032c3);}};}function respondWithFilteredResult(_0x36e542,_0x35b1aa){return function(_0x3968c3){if(_0x3968c3){var _0x2529da=typeof _0x35b1aa[_0xb666('0x15')]===_0xb666('0x16')&&typeof _0x35b1aa['limit']===_0xb666('0x16');var _0x33ec4a=_0x3968c3[_0xb666('0x17')];var _0xebfea=_0x2529da?0x0:_0x35b1aa[_0xb666('0x15')];var _0x46b188=_0x2529da?_0x3968c3[_0xb666('0x17')]:_0x35b1aa['offset']+_0x35b1aa[_0xb666('0x18')];var _0xa42fd0;if(_0x46b188>=_0x33ec4a){_0x46b188=_0x33ec4a;_0xa42fd0=0xc8;}else{_0xa42fd0=0xce;}_0x36e542['status'](_0xa42fd0);return _0x36e542['set'](_0xb666('0x19'),_0xebfea+'-'+_0x46b188+'/'+_0x33ec4a)[_0xb666('0x14')](_0x3968c3);}return null;};}function saveUpdates(_0x2be423){return function(_0x4fa8bd){if(_0x4fa8bd){return _0x4fa8bd[_0xb666('0x1a')](_0x2be423)[_0xb666('0x1b')](function(_0x4727de){return _0x4727de;});}return null;};}function removeEntity(_0x324e5b){return function(_0x8ebf68){if(_0x8ebf68){return _0x8ebf68[_0xb666('0x1c')]()[_0xb666('0x1b')](function(){_0x324e5b['status'](0xcc)[_0xb666('0x13')]();});}};}function handleEntityNotFound(_0x582457){return function(_0x406748){if(!_0x406748){_0x582457[_0xb666('0x11')](0x194);}return _0x406748;};}function handleError(_0x4787cb,_0x28465e){_0x28465e=_0x28465e||0x1f4;return function(_0x1d8633){logger[_0xb666('0x1d')](_0x1d8633[_0xb666('0x1e')]);if(_0x1d8633[_0xb666('0x1f')]){delete _0x1d8633[_0xb666('0x1f')];}_0x4787cb[_0xb666('0x12')](_0x28465e)[_0xb666('0x20')](_0x1d8633);};}exports[_0xb666('0x21')]=function(_0x16af7d,_0x1140d7){var _0x2df123={};var _0x1c9e63=_['map'](db[_0xb666('0x22')][_0xb666('0x23')],function(_0x151986){return{'name':_0x151986[_0xb666('0x24')],'type':_0x151986['type'][_0xb666('0x25')]};});_0x2df123=qs[_0xb666('0x26')](_0x1c9e63,_0x16af7d);return interaction[_0xb666('0x27')]('whatsapp',_0x16af7d[_0xb666('0x28')],_0x16af7d[_0xb666('0x29')],_0x2df123,_0x1c9e63)[_0xb666('0x1b')](respondWithFilteredResult(_0x1140d7,_0x2df123))['catch'](handleError(_0x1140d7,null));};exports[_0xb666('0x2a')]=function(_0x1fd73f,_0x4d9e21){var _0x56f16={'raw':![],'where':{'id':_0x1fd73f[_0xb666('0x2b')]['id']}},_0x966f69={};_0x966f69[_0xb666('0x2c')]=_[_0xb666('0x2d')](db[_0xb666('0x22')][_0xb666('0x23')]);_0x966f69[_0xb666('0x28')]=_[_0xb666('0x2d')](_0x1fd73f['query']);_0x966f69[_0xb666('0x2e')]=_[_0xb666('0x2f')](_0x966f69[_0xb666('0x2c')],_0x966f69[_0xb666('0x28')]);_0x56f16[_0xb666('0x30')]=_[_0xb666('0x2f')](_0x966f69[_0xb666('0x2c')],qs[_0xb666('0x31')](_0x1fd73f[_0xb666('0x28')][_0xb666('0x31')]));_0x56f16[_0xb666('0x30')]=_0x56f16[_0xb666('0x30')][_0xb666('0x32')]?_0x56f16[_0xb666('0x30')]:_0x966f69[_0xb666('0x2c')];if(_0x1fd73f['query'][_0xb666('0x33')]){_0x56f16[_0xb666('0x34')]=[{'all':!![]}];}_0x56f16=_['merge']({},_0x56f16,_0x1fd73f[_0xb666('0x35')]);return db[_0xb666('0x22')][_0xb666('0x36')](_0x56f16)[_0xb666('0x1b')](handleEntityNotFound(_0x4d9e21,null))[_0xb666('0x1b')](respondWithResult(_0x4d9e21,null))['catch'](handleError(_0x4d9e21,null));};exports['create']=function(_0x4edddb,_0x31583d){return db[_0xb666('0x22')][_0xb666('0x37')](_0x4edddb[_0xb666('0x38')],{})[_0xb666('0x1b')](respondWithResult(_0x31583d,0xc9))[_0xb666('0x39')](handleError(_0x31583d,null));};exports[_0xb666('0x1a')]=function(_0x220785,_0x4a7c49){if(_0x220785[_0xb666('0x38')]['id']){delete _0x220785[_0xb666('0x38')]['id'];}return db[_0xb666('0x22')]['find']({'where':{'id':_0x220785[_0xb666('0x2b')]['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x4a7c49,null))[_0xb666('0x1b')](saveUpdates(_0x220785[_0xb666('0x38')],null))[_0xb666('0x1b')](respondWithResult(_0x4a7c49,null))['catch'](handleError(_0x4a7c49,null));};exports[_0xb666('0x1c')]=function(_0x24079f,_0xa35248){return db[_0xb666('0x22')][_0xb666('0x36')]({'where':{'id':_0x24079f[_0xb666('0x2b')]['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0xa35248,null))['then'](removeEntity(_0xa35248,null))[_0xb666('0x39')](handleError(_0xa35248,null));};exports[_0xb666('0x3a')]=function(_0x278965,_0x3edfb3){return db[_0xb666('0x22')][_0xb666('0x3a')]()[_0xb666('0x1b')](respondWithResult(_0x3edfb3,null))[_0xb666('0x39')](handleError(_0x3edfb3,null));};exports['addMessage']=function(_0x304e3a,_0x5889ad){return db[_0xb666('0x3b')]['find']({'where':{'id':_0x304e3a['params']['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x5889ad,null))[_0xb666('0x1b')](function(_0x3ee667){if(_0x3ee667){return _0x3ee667[_0xb666('0x3c')](_0x304e3a['body']['ids'],_[_0xb666('0x3d')](_0x304e3a[_0xb666('0x38')],[_0xb666('0x3e'),'id'])||{});}})['then'](respondWithResult(_0x5889ad,null))['catch'](handleError(_0x5889ad,null));};exports[_0xb666('0x3f')]=function(_0x344632,_0x5b0d57){var _0x17892c={'raw':![],'where':{}};var _0x20bfac={};var _0x2bba30={'count':0x0,'rows':[]};return db['WhatsappInteraction'][_0xb666('0x40')]({'where':{'id':_0x344632['params']['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x5b0d57,null))[_0xb666('0x1b')](function(_0x205ae9){if(_0x205ae9){_0x20bfac[_0xb666('0x2c')]=_['keys'](db['WhatsappMessage']['rawAttributes']);_0x20bfac['query']=_['keys'](_0x344632[_0xb666('0x28')]);_0x20bfac[_0xb666('0x2e')]=_[_0xb666('0x2f')](_0x20bfac[_0xb666('0x2c')],_0x20bfac[_0xb666('0x28')]);_0x17892c[_0xb666('0x30')]=_[_0xb666('0x2f')](_0x20bfac[_0xb666('0x2c')],qs[_0xb666('0x31')](_0x344632[_0xb666('0x28')][_0xb666('0x31')]));_0x17892c[_0xb666('0x30')]=_0x17892c[_0xb666('0x30')][_0xb666('0x32')]?_0x17892c['attributes']:_0x20bfac['model'];if(!_0x344632['query'][_0xb666('0x41')](_0xb666('0x42'))){_0x17892c[_0xb666('0x18')]=qs[_0xb666('0x18')](_0x344632[_0xb666('0x28')]['limit']);_0x17892c[_0xb666('0x15')]=qs[_0xb666('0x15')](_0x344632[_0xb666('0x28')][_0xb666('0x15')]);}_0x17892c[_0xb666('0x43')]=qs[_0xb666('0x44')](_0x344632[_0xb666('0x28')]['sort']);_0x17892c['where']=qs[_0xb666('0x2e')](_['pick'](_0x344632[_0xb666('0x28')],_0x20bfac[_0xb666('0x2e')]));_0x17892c[_0xb666('0x45')][_0xb666('0x46')]=_0x205ae9['id'];if(_0x344632[_0xb666('0x28')][_0xb666('0x47')]){_0x17892c[_0xb666('0x45')]=_[_0xb666('0x48')](_0x17892c[_0xb666('0x45')],{'$or':_[_0xb666('0x49')](_0x17892c[_0xb666('0x30')],function(_0xe29e3c){var _0x4e2663={};_0x4e2663[_0xe29e3c]={'$like':'%'+_0x344632['query'][_0xb666('0x47')]+'%'};return _0x4e2663;})});}if(_0x344632[_0xb666('0x28')][_0xb666('0x4a')]){var _0x1e0b30=_0x344632[_0xb666('0x28')][_0xb666('0x4a')][_0xb666('0x4b')](',');var _0x289475={};_0x289475[_0x1e0b30[0x0]]={'$gte':moment(_0x1e0b30[0x1])[_0xb666('0x4c')](_0xb666('0x4d'))};_0x17892c[_0xb666('0x45')]=_[_0xb666('0x48')](_0x17892c[_0xb666('0x45')],_0x289475);}_0x17892c=_[_0xb666('0x48')]({},_0x17892c,_0x344632[_0xb666('0x35')]);return db['WhatsappMessage'][_0xb666('0x17')]({'where':_0x17892c['where']})[_0xb666('0x1b')](function(_0x367c6e){_0x2bba30['count']=_0x367c6e;if(_0x344632['query'][_0xb666('0x33')]){_0x17892c[_0xb666('0x34')]=[{'all':!![]}];}return db[_0xb666('0x3b')][_0xb666('0x27')](_0x17892c);})[_0xb666('0x1b')](function(_0x4af3c0){_0x2bba30[_0xb666('0x4e')]=_0x4af3c0;return _0x2bba30;});}})[_0xb666('0x1b')](respondWithFilteredResult(_0x5b0d57,_0x17892c))[_0xb666('0x39')](handleError(_0x5b0d57,null));};exports['addTags']=function(_0x1a052c,_0x5d6e4d){return db[_0xb666('0x22')]['find']({'where':{'id':_0x1a052c[_0xb666('0x2b')]['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x5d6e4d,null))[_0xb666('0x1b')](function(_0x40b374){if(_0x40b374){return _0x40b374[_0xb666('0x4f')](_0x1a052c[_0xb666('0x38')]['ids'],_[_0xb666('0x3d')](_0x1a052c[_0xb666('0x38')],[_0xb666('0x3e'),'id'])||{})['spread'](function(){return db['Tag'][_0xb666('0x27')]({'attributes':['id',_0xb666('0x1f'),_0xb666('0x50')],'where':{'id':_0x1a052c[_0xb666('0x38')][_0xb666('0x3e')]}});})['then'](function(_0x55340b){socket[_0xb666('0x51')](_0xb666('0x52'),{'id':Number(_0x1a052c[_0xb666('0x2b')]['id']),'tags':_0x55340b||[]});return{'id':Number(_0x1a052c[_0xb666('0x2b')]['id']),'tags':_0x55340b||[]};});}})[_0xb666('0x1b')](respondWithResult(_0x5d6e4d,null))[_0xb666('0x39')](handleError(_0x5d6e4d,null));};exports[_0xb666('0x53')]=function(_0x32b0d3,_0x475a5a){return db[_0xb666('0x22')][_0xb666('0x36')]({'where':{'id':_0x32b0d3['params']['id']}})[_0xb666('0x1b')](handleEntityNotFound(_0x475a5a,null))[_0xb666('0x1b')](function(_0x153e9f){if(_0x153e9f){return _0x153e9f[_0xb666('0x53')](_0x32b0d3[_0xb666('0x28')]['ids']);}})['then'](respondWithStatusCode(_0x475a5a,null))['catch'](handleError(_0x475a5a,null));};exports['download']=function(_0x4ef729,_0x4a116b){var _0x5bf747=moment()[_0xb666('0x54')]()[_0xb666('0x55')]();var _0x4357ff=path[_0xb666('0x56')](config[_0xb666('0x57')],'server','files',_0xb666('0x58'));var _0x57c21e=path[_0xb666('0x56')](config['root'],_0xb666('0x59'),_0xb666('0x5a'),'attachments');var _0x39c2c3=path[_0xb666('0x56')](_0x4357ff,_0x5bf747);var _0x2e0a61=util['format'](_0xb666('0x5b'),_0x4ef729[_0xb666('0x2b')]['id'],_0x5bf747);var _0x1ee6c4=path['join'](_0x4357ff,_0x2e0a61);var _0x57bc08=[];_0x57bc08['push']({'model':db[_0xb666('0x5c')],'as':_0xb666('0x5c'),'attributes':['id',_0xb666('0x5d')],'raw':!![]});_0x57bc08[_0xb666('0x5e')]({'model':db['CmContact'],'as':_0xb666('0x5f'),'attributes':['id',_0xb666('0x60'),'lastName'],'raw':!![]});if(_0x4ef729[_0xb666('0x28')]['attachments']){_0x57bc08[_0xb666('0x5e')]({'model':db[_0xb666('0x61')],'as':'Attachment','raw':!![]});}var _0x211b5d=[{'model':db[_0xb666('0x3b')],'as':_0xb666('0x62'),'attributes':['id',_0xb666('0x38'),_0xb666('0x63'),_0xb666('0x64'),_0xb666('0x65'),_0xb666('0x66')],'include':_0x57bc08}];_0x211b5d[_0xb666('0x5e')]({'model':db['WhatsappAccount'],'as':_0xb666('0x67'),'attributes':['id','name']});_0x211b5d[_0xb666('0x5e')]({'model':db[_0xb666('0x5c')],'as':'Owner','attributes':['id','fullname']});return db[_0xb666('0x22')][_0xb666('0x36')]({'where':{'id':_0x4ef729[_0xb666('0x2b')]['id']},'include':_0x211b5d})[_0xb666('0x1b')](handleEntityNotFound(_0x4a116b,null))['then'](function(_0x66dcb){if(_0x66dcb){var _0x203dce=_0x66dcb[_0xb666('0x68')]({'plain':!![]});fs[_0xb666('0x69')](_0x39c2c3);var _0x42018b={'channel':_0xb666('0x6a'),'account':_0x203dce[_0xb666('0x67')]['name'],'agent':_0x203dce[_0xb666('0x6b')]?_0x203dce[_0xb666('0x6b')]['fullname']:_0xb666('0x6c'),'createdAt':moment(_0x203dce[_0xb666('0x63')])[_0xb666('0x4c')](_0xb666('0x4d'))[_0xb666('0x55')](),'closedAt':_0x203dce['closed']?moment(_0x203dce[_0xb666('0x6d')])[_0xb666('0x4c')](_0xb666('0x4d'))['toString']():'','disposition':_0x203dce[_0xb666('0x6e')],'messages':_(_0x203dce[_0xb666('0x62')])[_0xb666('0x47')]({'secret':![]})['map'](function(_0x406712){if(_0x406712[_0xb666('0x61')]){var _0x575c30=path[_0xb666('0x56')](_0x57c21e,_0x406712[_0xb666('0x61')]['basename']);if(fs[_0xb666('0x6f')](_0x575c30)){fs[_0xb666('0x70')](_0x575c30)[_0xb666('0x71')](fs[_0xb666('0x72')](path[_0xb666('0x56')](_0x39c2c3,_0x406712[_0xb666('0x61')][_0xb666('0x73')])));}}return{'date':moment(_0x406712[_0xb666('0x63')])[_0xb666('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb666('0x55')](),'sender':_0x406712[_0xb666('0x64')]===_0xb666('0x74')?_0x406712['User']?_0x406712[_0xb666('0x5c')][_0xb666('0x5d')]:_0xb666('0x75'):_0x406712[_0xb666('0x5f')][_0xb666('0x60')]+(_0x406712['Contact'][_0xb666('0x76')]?'\x20'+_0x406712[_0xb666('0x5f')]['lastName']:''),'body':_0x406712[_0xb666('0x61')]?_0x406712[_0xb666('0x61')][_0xb666('0x73')]:_0x406712[_0xb666('0x38')],'direction':_0x406712['direction']===_0xb666('0x74')?'A':'C','secret':_0x406712[_0xb666('0x65')],'read':_0x406712[_0xb666('0x66')],'attachment':_0x406712[_0xb666('0x61')]};})[_0xb666('0x77')]()};return ejs[_0xb666('0x78')](path[_0xb666('0x56')](config['root'],_0xb666('0x59'),'views','downloadInteraction.ejs'),{'interaction':_0x42018b})['then'](function(_0x599fd7){var _0x1ac0c5=path[_0xb666('0x56')](_0x39c2c3,_0xb666('0x79')+_0x203dce['id']+'-'+_0x5bf747+_0xb666('0x7a'));var _0x4a3a5a={'path':_0x1ac0c5,'channel':_0xb666('0x6a'),'interactionId':_0x203dce['id']};return pdf[_0xb666('0x7b')](_0x599fd7,_0x4a3a5a);})['then'](function(){return new BPromise(function(_0x437f2b,_0x22a293){zipdir(_0x39c2c3,{'saveTo':_0x1ee6c4},function(_0x314928,_0x45408e){if(_0x314928)return _0x22a293(_0x314928);return _0x437f2b(_0x45408e);});})[_0xb666('0x1b')](function(){return new BPromise(function(_0xd0428e,_0x3e34d1){rimraf(_0x39c2c3,function(_0x12cd69){if(_0x12cd69)_0x3e34d1(_0x12cd69);return _0xd0428e();});});})['then'](function(){return _0x4a116b['download'](_0x1ee6c4,_0x2e0a61,function(_0x4e6edd){if(_0x4e6edd){console[_0xb666('0x7c')](_0xb666('0x7d'),_0x4e6edd);}else{fs['unlinkSync'](_0x1ee6c4);}});});});}else{return _0x4a116b[_0xb666('0x11')](0xc8);}})[_0xb666('0x39')](handleError(_0x4a116b,null));}; \ No newline at end of file +var _0x6334=['../../config/environment','../../mysqldb','redis','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','findAll','whatsapp','query','catch','show','params','model','keys','intersection','fields','attributes','includeAll','include','merge','options','find','create','body','update','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','filters','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','color','emit','removeTags','download','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','Attachment','Messages','createdAt','direction','read','WhatsappAccount','Account','Owner','fullname','get','mkdirSync','N.A.','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','lastName','secret','value','renderFile','views','.pdf','Whatsapp','createPdfFromHTML','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api'];(function(_0x359b9f,_0x1b897a){var _0x11d423=function(_0x109619){while(--_0x109619){_0x359b9f['push'](_0x359b9f['shift']());}};_0x11d423(++_0x1b897a);}(_0x6334,0x168));var _0x4633=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x6334[_0x393d69];return _0x3cee37;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x4633('0x0'));var moment=require(_0x4633('0x1'));var BPromise=require(_0x4633('0x2'));var util=require(_0x4633('0x3'));var path=require(_0x4633('0x4'));var ejs=require(_0x4633('0x5'));var fs=require('fs');var _=require(_0x4633('0x6'));var Redis=require(_0x4633('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x4633('0x8'));var pdf=require(_0x4633('0x9'));var logger=require(_0x4633('0xa'))(_0x4633('0xb'));var config=require(_0x4633('0xc'));var db=require(_0x4633('0xd'))['db'];config[_0x4633('0xe')]=_['defaults'](config[_0x4633('0xe')],{'host':_0x4633('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4633('0xe')]));require(_0x4633('0x10'))[_0x4633('0x11')](socket);function respondWithStatusCode(_0x5778f9,_0x55c622){_0x55c622=_0x55c622||0xcc;return function(_0x224f3b){if(_0x224f3b){return _0x5778f9[_0x4633('0x12')](_0x55c622);}return _0x5778f9[_0x4633('0x13')](_0x55c622)[_0x4633('0x14')]();};}function respondWithResult(_0x196054,_0x2340b3){_0x2340b3=_0x2340b3||0xc8;return function(_0x25f426){if(_0x25f426){return _0x196054[_0x4633('0x13')](_0x2340b3)[_0x4633('0x15')](_0x25f426);}};}function respondWithFilteredResult(_0x587c17,_0x19a89c){return function(_0x32a8d4){if(_0x32a8d4){var _0x35d1bd=typeof _0x19a89c[_0x4633('0x16')]===_0x4633('0x17')&&typeof _0x19a89c[_0x4633('0x18')]===_0x4633('0x17');var _0x43365e=_0x32a8d4[_0x4633('0x19')];var _0xac7758=_0x35d1bd?0x0:_0x19a89c[_0x4633('0x16')];var _0x16eb01=_0x35d1bd?_0x32a8d4['count']:_0x19a89c[_0x4633('0x16')]+_0x19a89c[_0x4633('0x18')];var _0x114960;if(_0x16eb01>=_0x43365e){_0x16eb01=_0x43365e;_0x114960=0xc8;}else{_0x114960=0xce;}_0x587c17[_0x4633('0x13')](_0x114960);return _0x587c17[_0x4633('0x1a')](_0x4633('0x1b'),_0xac7758+'-'+_0x16eb01+'/'+_0x43365e)[_0x4633('0x15')](_0x32a8d4);}return null;};}function saveUpdates(_0x495bf3){return function(_0x131f88){if(_0x131f88){return _0x131f88['update'](_0x495bf3)[_0x4633('0x1c')](function(_0x686372){return _0x686372;});}return null;};}function removeEntity(_0x53a7ad){return function(_0x548739){if(_0x548739){return _0x548739[_0x4633('0x1d')]()['then'](function(){_0x53a7ad['status'](0xcc)[_0x4633('0x14')]();});}};}function handleEntityNotFound(_0x5ef00f){return function(_0x3868c1){if(!_0x3868c1){_0x5ef00f[_0x4633('0x12')](0x194);}return _0x3868c1;};}function handleError(_0xc40abb,_0x2e4b3b){_0x2e4b3b=_0x2e4b3b||0x1f4;return function(_0x19e75d){logger[_0x4633('0x1e')](_0x19e75d[_0x4633('0x1f')]);if(_0x19e75d[_0x4633('0x20')]){delete _0x19e75d[_0x4633('0x20')];}_0xc40abb['status'](_0x2e4b3b)[_0x4633('0x21')](_0x19e75d);};}exports[_0x4633('0x22')]=function(_0x17d319,_0x5ede9a){var _0x382d71={};var _0x562939=_[_0x4633('0x23')](db[_0x4633('0x24')][_0x4633('0x25')],function(_0x348f21){return{'name':_0x348f21[_0x4633('0x26')],'type':_0x348f21['type'][_0x4633('0x27')]};});_0x382d71=qs['getOptions'](_0x562939,_0x17d319);return interaction[_0x4633('0x28')](_0x4633('0x29'),_0x17d319[_0x4633('0x2a')],_0x17d319['user'],_0x382d71,_0x562939)[_0x4633('0x1c')](respondWithFilteredResult(_0x5ede9a,_0x382d71))[_0x4633('0x2b')](handleError(_0x5ede9a,null));};exports[_0x4633('0x2c')]=function(_0x88801a,_0x476908){var _0x3dac85={'raw':![],'where':{'id':_0x88801a[_0x4633('0x2d')]['id']}},_0x2f25b2={};_0x2f25b2[_0x4633('0x2e')]=_[_0x4633('0x2f')](db[_0x4633('0x24')][_0x4633('0x25')]);_0x2f25b2[_0x4633('0x2a')]=_[_0x4633('0x2f')](_0x88801a[_0x4633('0x2a')]);_0x2f25b2['filters']=_[_0x4633('0x30')](_0x2f25b2[_0x4633('0x2e')],_0x2f25b2[_0x4633('0x2a')]);_0x3dac85['attributes']=_[_0x4633('0x30')](_0x2f25b2['model'],qs[_0x4633('0x31')](_0x88801a[_0x4633('0x2a')][_0x4633('0x31')]));_0x3dac85[_0x4633('0x32')]=_0x3dac85[_0x4633('0x32')]['length']?_0x3dac85[_0x4633('0x32')]:_0x2f25b2[_0x4633('0x2e')];if(_0x88801a[_0x4633('0x2a')][_0x4633('0x33')]){_0x3dac85[_0x4633('0x34')]=[{'all':!![]}];}_0x3dac85=_[_0x4633('0x35')]({},_0x3dac85,_0x88801a[_0x4633('0x36')]);return db[_0x4633('0x24')][_0x4633('0x37')](_0x3dac85)[_0x4633('0x1c')](handleEntityNotFound(_0x476908,null))['then'](respondWithResult(_0x476908,null))['catch'](handleError(_0x476908,null));};exports[_0x4633('0x38')]=function(_0x209bf7,_0x23ebc3){return db[_0x4633('0x24')][_0x4633('0x38')](_0x209bf7[_0x4633('0x39')],{})['then'](respondWithResult(_0x23ebc3,0xc9))[_0x4633('0x2b')](handleError(_0x23ebc3,null));};exports[_0x4633('0x3a')]=function(_0x3ceac4,_0x4df5c3){if(_0x3ceac4[_0x4633('0x39')]['id']){delete _0x3ceac4[_0x4633('0x39')]['id'];}return db['WhatsappInteraction'][_0x4633('0x37')]({'where':{'id':_0x3ceac4[_0x4633('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4df5c3,null))[_0x4633('0x1c')](saveUpdates(_0x3ceac4[_0x4633('0x39')],null))['then'](respondWithResult(_0x4df5c3,null))[_0x4633('0x2b')](handleError(_0x4df5c3,null));};exports['destroy']=function(_0x3d46b0,_0x472273){return db[_0x4633('0x24')][_0x4633('0x37')]({'where':{'id':_0x3d46b0[_0x4633('0x2d')]['id']}})[_0x4633('0x1c')](handleEntityNotFound(_0x472273,null))[_0x4633('0x1c')](removeEntity(_0x472273,null))[_0x4633('0x2b')](handleError(_0x472273,null));};exports['describe']=function(_0x9ffaf3,_0x3a7898){return db[_0x4633('0x24')]['describe']()[_0x4633('0x1c')](respondWithResult(_0x3a7898,null))[_0x4633('0x2b')](handleError(_0x3a7898,null));};exports[_0x4633('0x3b')]=function(_0x519259,_0x5a2411){return db[_0x4633('0x3c')][_0x4633('0x37')]({'where':{'id':_0x519259[_0x4633('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5a2411,null))['then'](function(_0x36dc48){if(_0x36dc48){return _0x36dc48[_0x4633('0x3b')](_0x519259[_0x4633('0x39')][_0x4633('0x3d')],_[_0x4633('0x3e')](_0x519259[_0x4633('0x39')],[_0x4633('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x5a2411,null))[_0x4633('0x2b')](handleError(_0x5a2411,null));};exports[_0x4633('0x3f')]=function(_0xd1f6c9,_0x27737b){var _0x18545a={'raw':![],'where':{}};var _0x17318b={};var _0x3e0dcd={'count':0x0,'rows':[]};return db[_0x4633('0x24')][_0x4633('0x40')]({'where':{'id':_0xd1f6c9['params']['id']}})[_0x4633('0x1c')](handleEntityNotFound(_0x27737b,null))[_0x4633('0x1c')](function(_0x30b707){if(_0x30b707){_0x17318b['model']=_[_0x4633('0x2f')](db[_0x4633('0x3c')][_0x4633('0x25')]);_0x17318b[_0x4633('0x2a')]=_[_0x4633('0x2f')](_0xd1f6c9[_0x4633('0x2a')]);_0x17318b['filters']=_[_0x4633('0x30')](_0x17318b[_0x4633('0x2e')],_0x17318b['query']);_0x18545a['attributes']=_[_0x4633('0x30')](_0x17318b[_0x4633('0x2e')],qs[_0x4633('0x31')](_0xd1f6c9[_0x4633('0x2a')][_0x4633('0x31')]));_0x18545a[_0x4633('0x32')]=_0x18545a[_0x4633('0x32')]['length']?_0x18545a[_0x4633('0x32')]:_0x17318b[_0x4633('0x2e')];if(!_0xd1f6c9[_0x4633('0x2a')][_0x4633('0x41')](_0x4633('0x42'))){_0x18545a['limit']=qs[_0x4633('0x18')](_0xd1f6c9['query'][_0x4633('0x18')]);_0x18545a[_0x4633('0x16')]=qs[_0x4633('0x16')](_0xd1f6c9[_0x4633('0x2a')][_0x4633('0x16')]);}_0x18545a['order']=qs['sort'](_0xd1f6c9['query']['sort']);_0x18545a['where']=qs[_0x4633('0x43')](_[_0x4633('0x44')](_0xd1f6c9[_0x4633('0x2a')],_0x17318b[_0x4633('0x43')]));_0x18545a[_0x4633('0x45')][_0x4633('0x46')]=_0x30b707['id'];if(_0xd1f6c9['query'][_0x4633('0x47')]){_0x18545a[_0x4633('0x45')]=_[_0x4633('0x35')](_0x18545a[_0x4633('0x45')],{'$or':_[_0x4633('0x23')](_0x18545a[_0x4633('0x32')],function(_0x3bea1b){var _0x4e3556={};_0x4e3556[_0x3bea1b]={'$like':'%'+_0xd1f6c9[_0x4633('0x2a')][_0x4633('0x47')]+'%'};return _0x4e3556;})});}if(_0xd1f6c9[_0x4633('0x2a')]['$gte']){var _0x266d39=_0xd1f6c9[_0x4633('0x2a')][_0x4633('0x48')][_0x4633('0x49')](',');var _0x31d237={};_0x31d237[_0x266d39[0x0]]={'$gte':moment(_0x266d39[0x1])[_0x4633('0x4a')](_0x4633('0x4b'))};_0x18545a[_0x4633('0x45')]=_[_0x4633('0x35')](_0x18545a[_0x4633('0x45')],_0x31d237);}_0x18545a=_['merge']({},_0x18545a,_0xd1f6c9['options']);return db[_0x4633('0x3c')][_0x4633('0x19')]({'where':_0x18545a[_0x4633('0x45')]})[_0x4633('0x1c')](function(_0x11827b){_0x3e0dcd[_0x4633('0x19')]=_0x11827b;if(_0xd1f6c9['query'][_0x4633('0x33')]){_0x18545a[_0x4633('0x34')]=[{'all':!![]}];}return db[_0x4633('0x3c')]['findAll'](_0x18545a);})[_0x4633('0x1c')](function(_0x5e7fcd){_0x3e0dcd['rows']=_0x5e7fcd;return _0x3e0dcd;});}})[_0x4633('0x1c')](respondWithFilteredResult(_0x27737b,_0x18545a))['catch'](handleError(_0x27737b,null));};exports[_0x4633('0x4c')]=function(_0x347b49,_0x1b36e3){return db[_0x4633('0x24')][_0x4633('0x37')]({'where':{'id':_0x347b49[_0x4633('0x2d')]['id']}})[_0x4633('0x1c')](handleEntityNotFound(_0x1b36e3,null))[_0x4633('0x1c')](function(_0x5d9739){if(_0x5d9739){return _0x5d9739['setTags'](_0x347b49[_0x4633('0x39')]['ids'],_[_0x4633('0x3e')](_0x347b49['body'],[_0x4633('0x3d'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x4633('0x20'),_0x4633('0x4d')],'where':{'id':_0x347b49[_0x4633('0x39')][_0x4633('0x3d')]}});})[_0x4633('0x1c')](function(_0x29aa73){socket[_0x4633('0x4e')]('whatsappInteractionTags:save',{'id':Number(_0x347b49[_0x4633('0x2d')]['id']),'tags':_0x29aa73||[]});return{'id':Number(_0x347b49[_0x4633('0x2d')]['id']),'tags':_0x29aa73||[]};});}})[_0x4633('0x1c')](respondWithResult(_0x1b36e3,null))['catch'](handleError(_0x1b36e3,null));};exports[_0x4633('0x4f')]=function(_0x30ea67,_0x412446){return db[_0x4633('0x24')][_0x4633('0x37')]({'where':{'id':_0x30ea67['params']['id']}})['then'](handleEntityNotFound(_0x412446,null))[_0x4633('0x1c')](function(_0x22bec3){if(_0x22bec3){return _0x22bec3[_0x4633('0x4f')](_0x30ea67[_0x4633('0x2a')][_0x4633('0x3d')]);}})['then'](respondWithStatusCode(_0x412446,null))[_0x4633('0x2b')](handleError(_0x412446,null));};exports[_0x4633('0x50')]=function(_0x1b4282,_0x5e4dce){var _0xa76d25=moment()['unix']()[_0x4633('0x51')]();var _0x4c58e0=path[_0x4633('0x52')](config[_0x4633('0x53')],_0x4633('0x54'),_0x4633('0x55'),'tmp');var _0x15bbf5=path[_0x4633('0x52')](config['root'],_0x4633('0x54'),_0x4633('0x55'),_0x4633('0x56'));var _0x4a65aa=path[_0x4633('0x52')](_0x4c58e0,_0xa76d25);var _0x2b977e=util[_0x4633('0x4a')](_0x4633('0x57'),_0x1b4282[_0x4633('0x2d')]['id'],_0xa76d25);var _0x1bef31=path[_0x4633('0x52')](_0x4c58e0,_0x2b977e);var _0x21f971=[];_0x21f971[_0x4633('0x58')]({'model':db[_0x4633('0x59')],'as':_0x4633('0x59'),'attributes':['id','fullname'],'raw':!![]});_0x21f971[_0x4633('0x58')]({'model':db[_0x4633('0x5a')],'as':_0x4633('0x5b'),'attributes':['id',_0x4633('0x5c'),'lastName'],'raw':!![]});if(_0x1b4282['query']['attachments']){_0x21f971[_0x4633('0x58')]({'model':db[_0x4633('0x5d')],'as':_0x4633('0x5d'),'raw':!![]});}var _0x46d557=[{'model':db['WhatsappMessage'],'as':_0x4633('0x5e'),'attributes':['id',_0x4633('0x39'),_0x4633('0x5f'),_0x4633('0x60'),'secret',_0x4633('0x61')],'include':_0x21f971}];_0x46d557[_0x4633('0x58')]({'model':db[_0x4633('0x62')],'as':_0x4633('0x63'),'attributes':['id',_0x4633('0x20')]});_0x46d557['push']({'model':db[_0x4633('0x59')],'as':_0x4633('0x64'),'attributes':['id',_0x4633('0x65')]});return db['WhatsappInteraction'][_0x4633('0x37')]({'where':{'id':_0x1b4282[_0x4633('0x2d')]['id']},'include':_0x46d557})[_0x4633('0x1c')](handleEntityNotFound(_0x5e4dce,null))[_0x4633('0x1c')](function(_0x49d1d3){if(_0x49d1d3){var _0x5dcf31=_0x49d1d3[_0x4633('0x66')]({'plain':!![]});fs[_0x4633('0x67')](_0x4a65aa);var _0x82ec88={'channel':'Whatsapp','account':_0x5dcf31[_0x4633('0x63')]['name'],'agent':_0x5dcf31[_0x4633('0x64')]?_0x5dcf31[_0x4633('0x64')]['fullname']:_0x4633('0x68'),'createdAt':moment(_0x5dcf31[_0x4633('0x5f')])['format'](_0x4633('0x4b'))[_0x4633('0x51')](),'closedAt':_0x5dcf31['closed']?moment(_0x5dcf31[_0x4633('0x69')])[_0x4633('0x4a')](_0x4633('0x4b'))[_0x4633('0x51')]():'','disposition':_0x5dcf31['disposition'],'messages':_(_0x5dcf31[_0x4633('0x5e')])[_0x4633('0x47')]({'secret':![]})[_0x4633('0x23')](function(_0x5bed3d){if(_0x5bed3d[_0x4633('0x5d')]){var _0x1bd452=path[_0x4633('0x52')](_0x15bbf5,_0x5bed3d[_0x4633('0x5d')][_0x4633('0x6a')]);if(fs[_0x4633('0x6b')](_0x1bd452)){fs[_0x4633('0x6c')](_0x1bd452)[_0x4633('0x6d')](fs[_0x4633('0x6e')](path[_0x4633('0x52')](_0x4a65aa,_0x5bed3d['Attachment']['basename'])));}}return{'date':moment(_0x5bed3d[_0x4633('0x5f')])[_0x4633('0x4a')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x5bed3d['direction']===_0x4633('0x6f')?_0x5bed3d[_0x4633('0x59')]?_0x5bed3d[_0x4633('0x59')][_0x4633('0x65')]:_0x4633('0x70'):_0x5bed3d[_0x4633('0x5b')]['firstName']+(_0x5bed3d[_0x4633('0x5b')]['lastName']?'\x20'+_0x5bed3d[_0x4633('0x5b')][_0x4633('0x71')]:''),'body':_0x5bed3d[_0x4633('0x5d')]?_0x5bed3d[_0x4633('0x5d')]['basename']:_0x5bed3d[_0x4633('0x39')],'direction':_0x5bed3d[_0x4633('0x60')]==='out'?'A':'C','secret':_0x5bed3d[_0x4633('0x72')],'read':_0x5bed3d[_0x4633('0x61')],'attachment':_0x5bed3d[_0x4633('0x5d')]};})[_0x4633('0x73')]()};return ejs[_0x4633('0x74')](path[_0x4633('0x52')](config[_0x4633('0x53')],_0x4633('0x54'),_0x4633('0x75'),'downloadInteraction.ejs'),{'interaction':_0x82ec88})[_0x4633('0x1c')](function(_0x50919a){var _0x10c719=path[_0x4633('0x52')](_0x4a65aa,'transcript-'+_0x5dcf31['id']+'-'+_0xa76d25+_0x4633('0x76'));var _0x23d7a9={'path':_0x10c719,'channel':_0x4633('0x77'),'interactionId':_0x5dcf31['id']};return pdf[_0x4633('0x78')](_0x50919a,_0x23d7a9);})[_0x4633('0x1c')](function(){return new BPromise(function(_0x5aec8d,_0x27714c){zipdir(_0x4a65aa,{'saveTo':_0x1bef31},function(_0x2c150c,_0x1bf46f){if(_0x2c150c)return _0x27714c(_0x2c150c);return _0x5aec8d(_0x1bf46f);});})[_0x4633('0x1c')](function(){return new BPromise(function(_0x7fed8d,_0x60b69d){rimraf(_0x4a65aa,function(_0x10883f){if(_0x10883f)_0x60b69d(_0x10883f);return _0x7fed8d();});});})['then'](function(){return _0x5e4dce['download'](_0x1bef31,_0x2b977e,function(_0x431386){if(_0x431386){console[_0x4633('0x79')](_0x4633('0x7a'),_0x431386);}else{fs[_0x4633('0x7b')](_0x1bef31);}});});});}else{return _0x5e4dce['sendStatus'](0xc8);}})[_0x4633('0x2b')](handleError(_0x5e4dce,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 3abf9f4..f7ff1ec 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 _0x4065=['then','setDataValue','Users','findAll','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save','update','getUsers'];(function(_0x50f99a,_0x4ed44f){var _0x2d38e6=function(_0x23ca9a){while(--_0x23ca9a){_0x50f99a['push'](_0x50f99a['shift']());}};_0x2d38e6(++_0x4ed44f);}(_0x4065,0xdc));var _0x5406=function(_0x3c9f72,_0x206fd9){_0x3c9f72=_0x3c9f72-0x0;var _0x64dd5f=_0x4065[_0x3c9f72];return _0x64dd5f;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x5406('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x5406('0x1')](0x0);var events={'afterCreate':_0x5406('0x2'),'afterUpdate':_0x5406('0x3'),'afterDestroy':'remove'};function emitEvent(_0xc5c0b5){return function(_0x281baf,_0x5f5cb7,_0x1d2a1c){_0x281baf[_0x5406('0x4')]({'attributes':['id'],'raw':!![]})[_0x5406('0x5')](function(_0x132fc5){_0x281baf[_0x5406('0x6')](_0x5406('0x7'),_0x132fc5['map'](function(_0x476d17){return{'id':_0x476d17['id']};}));return WhatsappMessage[_0x5406('0x8')]({'where':{'WhatsappInteractionId':_0x281baf['id'],'direction':'in','read':![]},'raw':!![]});})[_0x5406('0x5')](function(_0x266399){_0x281baf[_0x5406('0x6')](_0x5406('0x9'),_0x266399['length']);WhatsappInteractionEvents[_0x5406('0xa')](_0xc5c0b5+':'+_0x281baf['id'],_0x281baf);WhatsappInteractionEvents[_0x5406('0xa')](_0xc5c0b5,_0x281baf);_0x1d2a1c(null);})[_0x5406('0xb')](_0x1d2a1c(null));};}for(var e in events){if(events[_0x5406('0xc')](e)){var event=events[e];WhatsappInteraction[_0x5406('0xd')](e,emitEvent(event));}}module[_0x5406('0xe')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x593e=['length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x33fe86,_0x577ba1){var _0xe27c3a=function(_0x592a64){while(--_0x592a64){_0x33fe86['push'](_0x33fe86['shift']());}};_0xe27c3a(++_0x577ba1);}(_0x593e,0xcb));var _0xe593=function(_0x27a8a7,_0x5b2722){_0x27a8a7=_0x27a8a7-0x0;var _0x180671=_0x593e[_0x27a8a7];return _0x180671;};'use strict';var EventEmitter=require(_0xe593('0x0'));var WhatsappInteraction=require(_0xe593('0x1'))['db'][_0xe593('0x2')];var WhatsappMessage=require(_0xe593('0x1'))['db'][_0xe593('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xe593('0x4')](0x0);var events={'afterCreate':_0xe593('0x5'),'afterUpdate':_0xe593('0x6'),'afterDestroy':'remove'};function emitEvent(_0x8a87e8){return function(_0x2475f5,_0x404e3a,_0x1e50d3){_0x2475f5[_0xe593('0x7')]({'attributes':['id'],'raw':!![]})[_0xe593('0x8')](function(_0x1cda29){_0x2475f5[_0xe593('0x9')](_0xe593('0xa'),_0x1cda29[_0xe593('0xb')](function(_0x51b862){return{'id':_0x51b862['id']};}));return WhatsappMessage[_0xe593('0xc')]({'where':{'WhatsappInteractionId':_0x2475f5['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe593('0x8')](function(_0x38d977){_0x2475f5['setDataValue']('unreadMessages',_0x38d977[_0xe593('0xd')]);WhatsappInteractionEvents[_0xe593('0xe')](_0x8a87e8+':'+_0x2475f5['id'],_0x2475f5);WhatsappInteractionEvents[_0xe593('0xe')](_0x8a87e8,_0x2475f5);_0x1e50d3(null);})['catch'](_0x1e50d3(null));};}for(var e in events){if(events[_0xe593('0xf')](e)){var event=events[e];WhatsappInteraction[_0xe593('0x10')](e,emitEvent(event));}}module[_0xe593('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 3f8339d..83ef298 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 _0x7a66=['path','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x1e0245,_0x154010){var _0x53bea7=function(_0x5d6b09){while(--_0x5d6b09){_0x1e0245['push'](_0x1e0245['shift']());}};_0x53bea7(++_0x154010);}(_0x7a66,0x1ae));var _0x67a6=function(_0xf56751,_0x3c05e0){_0xf56751=_0xf56751-0x0;var _0x443b2a=_0x7a66[_0xf56751];return _0x443b2a;};'use strict';var _=require(_0x67a6('0x0'));var util=require('util');var logger=require(_0x67a6('0x1'))(_0x67a6('0x2'));var moment=require('moment');var BPromise=require(_0x67a6('0x3'));var rp=require(_0x67a6('0x4'));var fs=require('fs');var path=require(_0x67a6('0x5'));var rimraf=require('rimraf');var config=require(_0x67a6('0x6'));var attributes=require(_0x67a6('0x7'));module[_0x67a6('0x8')]=function(_0x4c2c64,_0x45748f){return _0x4c2c64[_0x67a6('0x9')](_0x67a6('0xa'),attributes,{'tableName':_0x67a6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x497e8f,_0x43f981,_0x182e23){if(_0x497e8f[_0x67a6('0xc')](_0x67a6('0xd'))){_0x497e8f['closedAt']=moment()[_0x67a6('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}_0x182e23(null,_0x497e8f);}}});}; \ No newline at end of file +var _0x86af=['define','WhatsappInteraction','whatsapp_interactions','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports'];(function(_0x50d107,_0x16eb08){var _0x44a5de=function(_0x1a0b0d){while(--_0x1a0b0d){_0x50d107['push'](_0x50d107['shift']());}};_0x44a5de(++_0x16eb08);}(_0x86af,0x156));var _0xf86a=function(_0x20b85e,_0x50d027){_0x20b85e=_0x20b85e-0x0;var _0x35ebc6=_0x86af[_0x20b85e];return _0x35ebc6;};'use strict';var _=require('lodash');var util=require(_0xf86a('0x0'));var logger=require('../../config/logger')(_0xf86a('0x1'));var moment=require(_0xf86a('0x2'));var BPromise=require(_0xf86a('0x3'));var rp=require(_0xf86a('0x4'));var fs=require('fs');var path=require(_0xf86a('0x5'));var rimraf=require(_0xf86a('0x6'));var config=require(_0xf86a('0x7'));var attributes=require(_0xf86a('0x8'));module[_0xf86a('0x9')]=function(_0x53451e,_0x3522d8){return _0x53451e[_0xf86a('0xa')](_0xf86a('0xb'),attributes,{'tableName':_0xf86a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x115c19,_0x3f84af,_0x526e46){if(_0x115c19['changed']('closed')){_0x115c19[_0xf86a('0xd')]=moment()[_0xf86a('0xe')](_0xf86a('0xf'));}_0x526e46(null,_0x115c19);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index a9e1926..b2c9ebb 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 _0xacb5=['stringify','error','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','options','raw','attributes','then','AddTagsToWhatsappInteraction','find','where','addTags','body','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x2043c5,_0x4ed48d){var _0x1a1f73=function(_0x3224c2){while(--_0x3224c2){_0x2043c5['push'](_0x2043c5['shift']());}};_0x1a1f73(++_0x4ed48d);}(_0xacb5,0x13b));var _0x5acb=function(_0x3439b4,_0x3c235c){_0x3439b4=_0x3439b4-0x0;var _0x38d9f8=_0xacb5[_0x3439b4];return _0x38d9f8;};'use strict';var _=require(_0x5acb('0x0'));var util=require(_0x5acb('0x1'));var moment=require('moment');var BPromise=require(_0x5acb('0x2'));var rs=require(_0x5acb('0x3'));var fs=require('fs');var Redis=require(_0x5acb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5acb('0x5'));var logger=require(_0x5acb('0x6'))('rpc');var config=require(_0x5acb('0x7'));var jayson=require(_0x5acb('0x8'));var client=jayson[_0x5acb('0x9')][_0x5acb('0xa')]({'port':0x232a});config[_0x5acb('0xb')]=_[_0x5acb('0xc')](config[_0x5acb('0xb')],{'host':_0x5acb('0xd'),'port':0x18eb});var socket=require(_0x5acb('0xe'))(new Redis(config[_0x5acb('0xb')]));require('./whatsappInteraction.socket')[_0x5acb('0xf')](socket);function respondWithRpcPromise(_0x20ec4e,_0x2b15f6,_0x252ce6){return new BPromise(function(_0x376f2e,_0x359971){return client['request'](_0x20ec4e,_0x252ce6)['then'](function(_0xe078e9){logger[_0x5acb('0x10')](_0x5acb('0x11'),_0x2b15f6,_0x5acb('0x12'));logger[_0x5acb('0x13')](_0x5acb('0x14'),_0x2b15f6,_0x5acb('0x12'),JSON[_0x5acb('0x15')](_0xe078e9));if(_0xe078e9[_0x5acb('0x16')]){if(_0xe078e9['error']['code']===0x1f4){logger[_0x5acb('0x16')](_0x5acb('0x11'),_0x2b15f6,_0xe078e9['error']['message']);return _0x359971(_0xe078e9[_0x5acb('0x16')]['message']);}logger[_0x5acb('0x16')](_0x5acb('0x11'),_0x2b15f6,_0xe078e9[_0x5acb('0x16')][_0x5acb('0x17')]);return _0x376f2e(_0xe078e9[_0x5acb('0x16')]['message']);}else{logger[_0x5acb('0x10')](_0x5acb('0x11'),_0x2b15f6,_0x5acb('0x12'));_0x376f2e(_0xe078e9[_0x5acb('0x18')]['message']);}})[_0x5acb('0x19')](function(_0x7b0f7b){logger[_0x5acb('0x16')](_0x5acb('0x11'),_0x2b15f6,_0x7b0f7b);_0x359971(_0x7b0f7b);});});}exports[_0x5acb('0x1a')]=function(_0x529295){var _0x2dcf1b=this;return new Promise(function(_0x5c2040,_0x31561f){return db[_0x5acb('0x1b')][_0x5acb('0x1c')](_0x529295['body'],{'raw':_0x529295[_0x5acb('0x1d')]?_0x529295[_0x5acb('0x1d')][_0x5acb('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529295[_0x5acb('0x1d')]?_0x529295['options']['where']||null:null,'attributes':_0x529295['options']?_0x529295[_0x5acb('0x1d')][_0x5acb('0x1f')]||null:null,'limit':_0x529295[_0x5acb('0x1d')]?_0x529295[_0x5acb('0x1d')]['limit']||null:null})[_0x5acb('0x20')](function(_0x693b4){logger[_0x5acb('0x10')](_0x5acb('0x1a'),_0x529295);logger[_0x5acb('0x13')](_0x5acb('0x1a'),_0x529295,JSON[_0x5acb('0x15')](_0x693b4));_0x5c2040(_0x693b4);})['catch'](function(_0x438d19){logger['error'](_0x5acb('0x1a'),_0x438d19[_0x5acb('0x17')],_0x529295);_0x31561f(_0x2dcf1b[_0x5acb('0x16')](0x1f4,_0x438d19['message']));});});};exports[_0x5acb('0x21')]=function(_0x4e6afa){return new Promise(function(_0x56757f,_0x3232b6){return db[_0x5acb('0x1b')][_0x5acb('0x22')]({'where':_0x4e6afa[_0x5acb('0x1d')]?_0x4e6afa['options'][_0x5acb('0x23')]||null:null})['then'](function(_0x45aa89){if(_0x45aa89){return _0x45aa89[_0x5acb('0x24')](_0x4e6afa[_0x5acb('0x25')][_0x5acb('0x26')],_[_0x5acb('0x27')](_0x4e6afa[_0x5acb('0x25')],[_0x5acb('0x26'),'id'])||{});}})[_0x5acb('0x28')](function(_0x32fcc8){logger[_0x5acb('0x10')]('AddTags',_0x4e6afa);logger['debug'](_0x5acb('0x29'),_0x4e6afa,JSON[_0x5acb('0x15')](_0x32fcc8));_0x56757f(_0x32fcc8);})[_0x5acb('0x19')](function(_0x331aac){logger['error']('AddTags',_0x331aac[_0x5acb('0x17')],_0x4e6afa);_0x3232b6(_this[_0x5acb('0x16')](0x1f4,_0x331aac[_0x5acb('0x17')]));});});}; \ No newline at end of file +var _0xf8d7=['request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./whatsappInteraction.socket','register'];(function(_0x55dd9e,_0x48830a){var _0x233bb1=function(_0x5adc9a){while(--_0x5adc9a){_0x55dd9e['push'](_0x55dd9e['shift']());}};_0x233bb1(++_0x48830a);}(_0xf8d7,0x124));var _0x7f8d=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0xf8d7[_0x35d8af];return _0x1d08b0;};'use strict';var _=require(_0x7f8d('0x0'));var util=require(_0x7f8d('0x1'));var moment=require(_0x7f8d('0x2'));var BPromise=require('bluebird');var rs=require(_0x7f8d('0x3'));var fs=require('fs');var Redis=require(_0x7f8d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7f8d('0x5'));var logger=require(_0x7f8d('0x6'))(_0x7f8d('0x7'));var config=require('../../config/environment');var jayson=require(_0x7f8d('0x8'));var client=jayson[_0x7f8d('0x9')][_0x7f8d('0xa')]({'port':0x232a});config[_0x7f8d('0xb')]=_[_0x7f8d('0xc')](config[_0x7f8d('0xb')],{'host':_0x7f8d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7f8d('0xe'))[_0x7f8d('0xf')](socket);function respondWithRpcPromise(_0x10e739,_0x2aa944,_0x1e83c2){return new BPromise(function(_0x1664f9,_0x188bde){return client[_0x7f8d('0x10')](_0x10e739,_0x1e83c2)[_0x7f8d('0x11')](function(_0xe04a2a){logger['info'](_0x7f8d('0x12'),_0x2aa944,_0x7f8d('0x13'));logger[_0x7f8d('0x14')](_0x7f8d('0x15'),_0x2aa944,'request\x20sent',JSON[_0x7f8d('0x16')](_0xe04a2a));if(_0xe04a2a['error']){if(_0xe04a2a[_0x7f8d('0x17')][_0x7f8d('0x18')]===0x1f4){logger[_0x7f8d('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2aa944,_0xe04a2a[_0x7f8d('0x17')]['message']);return _0x188bde(_0xe04a2a[_0x7f8d('0x17')][_0x7f8d('0x19')]);}logger[_0x7f8d('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x2aa944,_0xe04a2a['error']['message']);return _0x1664f9(_0xe04a2a[_0x7f8d('0x17')][_0x7f8d('0x19')]);}else{logger[_0x7f8d('0x1a')](_0x7f8d('0x12'),_0x2aa944,_0x7f8d('0x13'));_0x1664f9(_0xe04a2a[_0x7f8d('0x1b')][_0x7f8d('0x19')]);}})[_0x7f8d('0x1c')](function(_0x456807){logger[_0x7f8d('0x17')](_0x7f8d('0x12'),_0x2aa944,_0x456807);_0x188bde(_0x456807);});});}exports[_0x7f8d('0x1d')]=function(_0x185b7b){var _0x5707dc=this;return new Promise(function(_0x144216,_0x2625b0){return db[_0x7f8d('0x1e')][_0x7f8d('0x1f')](_0x185b7b[_0x7f8d('0x20')],{'raw':_0x185b7b[_0x7f8d('0x21')]?_0x185b7b[_0x7f8d('0x21')][_0x7f8d('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x185b7b[_0x7f8d('0x21')]?_0x185b7b[_0x7f8d('0x21')][_0x7f8d('0x23')]||null:null,'attributes':_0x185b7b['options']?_0x185b7b[_0x7f8d('0x21')][_0x7f8d('0x24')]||null:null,'limit':_0x185b7b[_0x7f8d('0x21')]?_0x185b7b[_0x7f8d('0x21')][_0x7f8d('0x25')]||null:null})[_0x7f8d('0x11')](function(_0xd48c0b){logger[_0x7f8d('0x1a')](_0x7f8d('0x1d'),_0x185b7b);logger[_0x7f8d('0x14')](_0x7f8d('0x1d'),_0x185b7b,JSON['stringify'](_0xd48c0b));_0x144216(_0xd48c0b);})['catch'](function(_0x1d4c6b){logger['error']('UpdateWhatsappInteraction',_0x1d4c6b[_0x7f8d('0x19')],_0x185b7b);_0x2625b0(_0x5707dc['error'](0x1f4,_0x1d4c6b['message']));});});};exports[_0x7f8d('0x26')]=function(_0x2f5a3c){return new Promise(function(_0x35faf0,_0x2b25f2){return db['WhatsappInteraction'][_0x7f8d('0x27')]({'where':_0x2f5a3c[_0x7f8d('0x21')]?_0x2f5a3c['options'][_0x7f8d('0x23')]||null:null})[_0x7f8d('0x11')](function(_0x597fbf){if(_0x597fbf){return _0x597fbf['addTags'](_0x2f5a3c['body'][_0x7f8d('0x28')],_[_0x7f8d('0x29')](_0x2f5a3c['body'],[_0x7f8d('0x28'),'id'])||{});}})[_0x7f8d('0x2a')](function(_0x2aebb7){logger['info'](_0x7f8d('0x2b'),_0x2f5a3c);logger[_0x7f8d('0x14')](_0x7f8d('0x2b'),_0x2f5a3c,JSON[_0x7f8d('0x16')](_0x2aebb7));_0x35faf0(_0x2aebb7);})[_0x7f8d('0x1c')](function(_0x5f34e3){logger[_0x7f8d('0x17')]('AddTags',_0x5f34e3['message'],_0x2f5a3c);_0x2b25f2(_this[_0x7f8d('0x17')](0x1f4,_0x5f34e3[_0x7f8d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 0986741..e7df47a 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 _0x1084=['remove','emit','length','./whatsappInteraction.events','save'];(function(_0x581f39,_0xb0a5c6){var _0x3ecf4f=function(_0x195a49){while(--_0x195a49){_0x581f39['push'](_0x581f39['shift']());}};_0x3ecf4f(++_0xb0a5c6);}(_0x1084,0x11b));var _0x4108=function(_0x5dcb33,_0x11bee1){_0x5dcb33=_0x5dcb33-0x0;var _0x590843=_0x1084[_0x5dcb33];return _0x590843;};'use strict';var WhatsappInteractionEvents=require(_0x4108('0x0'));var events=[_0x4108('0x1'),_0x4108('0x2'),'update'];function createListener(_0x31ef10,_0x152184){return function(_0x46e089){_0x152184[_0x4108('0x3')](_0x31ef10,_0x46e089);};}function removeListener(_0x545632,_0x267bea){return function(){WhatsappInteractionEvents['removeListener'](_0x545632,_0x267bea);};}exports['register']=function(_0x2c4205){for(var _0x3ab202=0x0,_0x288a38=events[_0x4108('0x4')];_0x3ab202<_0x288a38;_0x3ab202++){var _0x3cd4f7=events[_0x3ab202];var _0x20fed1=createListener('whatsappInteraction:'+_0x3cd4f7,_0x2c4205);WhatsappInteractionEvents['on'](_0x3cd4f7,_0x20fed1);}}; \ No newline at end of file +var _0xf31c=['save','remove','update','emit','removeListener','register','whatsappInteraction:','./whatsappInteraction.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf31c,0xcf));var _0xcf31=function(_0x264545,_0x214037){_0x264545=_0x264545-0x0;var _0x114d10=_0xf31c[_0x264545];return _0x114d10;};'use strict';var WhatsappInteractionEvents=require(_0xcf31('0x0'));var events=[_0xcf31('0x1'),_0xcf31('0x2'),_0xcf31('0x3')];function createListener(_0x2e00e3,_0x34d412){return function(_0x50d3a6){_0x34d412[_0xcf31('0x4')](_0x2e00e3,_0x50d3a6);};}function removeListener(_0x2624bc,_0x282199){return function(){WhatsappInteractionEvents[_0xcf31('0x5')](_0x2624bc,_0x282199);};}exports[_0xcf31('0x6')]=function(_0x436538){for(var _0x3fb1c6=0x0,_0x298312=events['length'];_0x3fb1c6<_0x298312;_0x3fb1c6++){var _0x3df9dd=events[_0x3fb1c6];var _0x53064d=createListener(_0xcf31('0x7')+_0x3df9dd,_0x436538);WhatsappInteractionEvents['on'](_0x3df9dd,_0x53064d);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index cca6996..8b35982 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 _0x15f7=['create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','post','whatsapp'];(function(_0x4346c4,_0x53ac29){var _0x304289=function(_0x3daddb){while(--_0x3daddb){_0x4346c4['push'](_0x4346c4['shift']());}};_0x304289(++_0x53ac29);}(_0x15f7,0xd7));var _0x715f=function(_0x459335,_0x2e95dd){_0x459335=_0x459335-0x0;var _0x50f00b=_0x15f7[_0x459335];return _0x50f00b;};'use strict';var multer=require(_0x715f('0x0'));var util=require(_0x715f('0x1'));var path=require(_0x715f('0x2'));var timeout=require(_0x715f('0x3'));var express=require(_0x715f('0x4'));var router=express[_0x715f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x715f('0x6'));var interaction=require(_0x715f('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router['get']('/',auth[_0x715f('0x8')](),controller[_0x715f('0x9')]);router[_0x715f('0xa')](_0x715f('0xb'),auth[_0x715f('0x8')](),controller[_0x715f('0xc')]);router['get'](_0x715f('0xd'),auth[_0x715f('0x8')](),controller[_0x715f('0xe')]);router[_0x715f('0xf')]('/',auth[_0x715f('0x8')](),interaction['tracked'](_0x715f('0x10'),'whatsappmessage:create'),controller[_0x715f('0x11')]);router[_0x715f('0xf')](_0x715f('0x12'),controller[_0x715f('0x13')]);router[_0x715f('0x14')](_0x715f('0xd'),auth[_0x715f('0x8')](),controller[_0x715f('0x15')]);router[_0x715f('0x14')](_0x715f('0x16'),auth[_0x715f('0x8')](),controller[_0x715f('0x17')]);router[_0x715f('0x14')](_0x715f('0x18'),auth[_0x715f('0x8')](),controller[_0x715f('0x19')]);router[_0x715f('0x1a')](_0x715f('0xd'),auth[_0x715f('0x8')](),controller[_0x715f('0x1b')]);module[_0x715f('0x1c')]=router; \ No newline at end of file +var _0x102c=['whatsapp','whatsappmessage:create','create','/:id/status','put','update','accept','/:id/reject','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','post'];(function(_0x8a9980,_0x3a5f0d){var _0x3cb8c5=function(_0x28a603){while(--_0x28a603){_0x8a9980['push'](_0x8a9980['shift']());}};_0x3cb8c5(++_0x3a5f0d);}(_0x102c,0x107));var _0xc102=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x102c[_0x31cb5f];return _0x586042;};'use strict';var multer=require(_0xc102('0x0'));var util=require(_0xc102('0x1'));var path=require(_0xc102('0x2'));var timeout=require(_0xc102('0x3'));var express=require(_0xc102('0x4'));var router=express[_0xc102('0x5')]();var fs_extra=require(_0xc102('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc102('0x7'));var config=require(_0xc102('0x8'));var controller=require(_0xc102('0x9'));router[_0xc102('0xa')]('/',auth[_0xc102('0xb')](),controller[_0xc102('0xc')]);router[_0xc102('0xa')](_0xc102('0xd'),auth[_0xc102('0xb')](),controller[_0xc102('0xe')]);router[_0xc102('0xa')](_0xc102('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xc102('0x10')]('/',auth[_0xc102('0xb')](),interaction['tracked'](_0xc102('0x11'),_0xc102('0x12')),controller[_0xc102('0x13')]);router[_0xc102('0x10')](_0xc102('0x14'),controller['status']);router[_0xc102('0x15')](_0xc102('0xf'),auth['isAuthenticated'](),controller[_0xc102('0x16')]);router[_0xc102('0x15')]('/:id/accept',auth[_0xc102('0xb')](),controller[_0xc102('0x17')]);router['put'](_0xc102('0x18'),auth[_0xc102('0xb')](),controller[_0xc102('0x19')]);router[_0xc102('0x1a')](_0xc102('0xf'),auth[_0xc102('0xb')](),controller['destroy']);module[_0xc102('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 5bb2c28..1af8f3d 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 _0xaa19=['out','STRING','DATE','BOOLEAN','sequelize','exports','TEXT','medium','ENUM'];(function(_0x5a24de,_0x542232){var _0x388e2e=function(_0x438603){while(--_0x438603){_0x5a24de['push'](_0x5a24de['shift']());}};_0x388e2e(++_0x542232);}(_0xaa19,0x79));var _0x9aa1=function(_0x31f0dc,_0x36b8fd){_0x31f0dc=_0x31f0dc-0x0;var _0x4ea2cc=_0xaa19[_0x31f0dc];return _0x4ea2cc;};'use strict';var Sequelize=require(_0x9aa1('0x0'));module[_0x9aa1('0x1')]={'body':{'type':Sequelize[_0x9aa1('0x2')](_0x9aa1('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9aa1('0x4')]('in','out'),'defaultValue':_0x9aa1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9aa1('0x6')]},'readAt':{'type':Sequelize[_0x9aa1('0x7')]},'secret':{'type':Sequelize[_0x9aa1('0x8')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9aa1('0x2')]}}; \ No newline at end of file +var _0xbce8=['TEXT','BOOLEAN','ENUM','out','STRING','DATE','sequelize','exports'];(function(_0x4d9f63,_0x115c88){var _0xa6dcfe=function(_0x5ac493){while(--_0x5ac493){_0x4d9f63['push'](_0x4d9f63['shift']());}};_0xa6dcfe(++_0x115c88);}(_0xbce8,0x1ee));var _0x8bce=function(_0x18d631,_0x4376d2){_0x18d631=_0x18d631-0x0;var _0x50d708=_0xbce8[_0x18d631];return _0x50d708;};'use strict';var Sequelize=require(_0x8bce('0x0'));module[_0x8bce('0x1')]={'body':{'type':Sequelize[_0x8bce('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x8bce('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8bce('0x4')]('in',_0x8bce('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x8bce('0x6')](0xbe)},'phone':{'type':Sequelize[_0x8bce('0x6')]},'readAt':{'type':Sequelize[_0x8bce('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8bce('0x6')]},'providerResponse':{'type':Sequelize[_0x8bce('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index a9700df..6ed5f1a 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 _0x490a=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','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','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','options','WhatsappMessage','includeAll','findAll','rows','show','keys','fields','length','include','create','body','find','params','describe','../../config/logger','whatsapp-interactions','read','readAt','format','UserId','user','get','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','email','internal','agent','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','fullname','rejectmessage','WhatsappAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x3c38c7,_0x39c81f){var _0x11b128=function(_0x688ff8){while(--_0x688ff8){_0x3c38c7['push'](_0x3c38c7['shift']());}};_0x11b128(++_0x39c81f);}(_0x490a,0x1ad));var _0xa490=function(_0x3d0eb1,_0x21ae79){_0x3d0eb1=_0x3d0eb1-0x0;var _0x3d0018=_0x490a[_0x3d0eb1];return _0x3d0018;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa490('0x0'));var zipdir=require(_0xa490('0x1'));var jsonpatch=require(_0xa490('0x2'));var rp=require(_0xa490('0x3'));var moment=require(_0xa490('0x4'));var BPromise=require(_0xa490('0x5'));var Mustache=require('mustache');var util=require(_0xa490('0x6'));var path=require(_0xa490('0x7'));var sox=require(_0xa490('0x8'));var csv=require('to-csv');var ejs=require(_0xa490('0x9'));var fs=require('fs');var fs_extra=require(_0xa490('0xa'));var _=require(_0xa490('0xb'));var squel=require(_0xa490('0xc'));var crypto=require(_0xa490('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa490('0xe'));var toCsv=require(_0xa490('0xf'));var querystring=require(_0xa490('0x10'));var Papa=require(_0xa490('0x11'));var Redis=require(_0xa490('0x12'));var authService=require(_0xa490('0x13'));var qs=require(_0xa490('0x14'));var as=require(_0xa490('0x15'));var hardwareService=require(_0xa490('0x16'));var logger=require('../../config/logger')(_0xa490('0x17'));var utils=require(_0xa490('0x18'));var config=require(_0xa490('0x19'));var licenseUtil=require(_0xa490('0x1a'));var db=require(_0xa490('0x1b'))['db'];config[_0xa490('0x1c')]=_[_0xa490('0x1d')](config['redis'],{'host':_0xa490('0x1e'),'port':0x18eb});var socket=require(_0xa490('0x1f'))(new Redis(config[_0xa490('0x1c')]));require('./whatsappMessage.socket')[_0xa490('0x20')](socket);var jayson=require(_0xa490('0x21'));var client=jayson[_0xa490('0x22')]['http']({'port':0x232c});var client9002=jayson[_0xa490('0x22')][_0xa490('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x32150d,_0x39d3f8,_0x4dd8e3,_0x5cf6aa){return new BPromise(function(_0x26206d,_0x5d09a6){var _0x564f55=_0x5cf6aa||client;return _0x564f55[_0xa490('0x24')](_0x32150d,_0x4dd8e3)['then'](function(_0xb551cb){logger['info'](_0xa490('0x25'),_0x39d3f8,_0xa490('0x26'));logger[_0xa490('0x27')](_0xa490('0x28'),_0x39d3f8,'request\x20sent',JSON[_0xa490('0x29')](_0xb551cb));if(_0xb551cb[_0xa490('0x2a')]){if(_0xb551cb[_0xa490('0x2a')][_0xa490('0x2b')]===0x1f4){logger['error'](_0xa490('0x25'),_0x39d3f8,_0xb551cb[_0xa490('0x2a')]['message']);return _0x5d09a6(_0xb551cb['error']['message']);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x39d3f8,_0xb551cb['error'][_0xa490('0x2c')]);return _0x26206d(_0xb551cb[_0xa490('0x2a')]['message']);}else{logger[_0xa490('0x2d')](_0xa490('0x25'),_0x39d3f8,_0xa490('0x26'));_0x26206d(_0xb551cb[_0xa490('0x2e')][_0xa490('0x2c')]);}})[_0xa490('0x2f')](function(_0x356ca8){logger[_0xa490('0x2a')]('WhatsappMessage,\x20%s,\x20%s',_0x39d3f8,_0x356ca8);_0x5d09a6(_0x356ca8);});});}function respondWithStatusCode(_0x5aafdb,_0x1683c7){_0x1683c7=_0x1683c7||0xcc;return function(_0x4f7bd7){if(_0x4f7bd7){return _0x5aafdb[_0xa490('0x30')](_0x1683c7);}return _0x5aafdb[_0xa490('0x31')](_0x1683c7)[_0xa490('0x32')]();};}function respondWithResult(_0x1925b4,_0xc4a4c6){_0xc4a4c6=_0xc4a4c6||0xc8;return function(_0x2f4502){if(_0x2f4502){return _0x1925b4[_0xa490('0x31')](_0xc4a4c6)['json'](_0x2f4502);}};}function respondWithFilteredResult(_0x2f63b9,_0x3de42c){return function(_0x5b726a){if(_0x5b726a){var _0x3960c6=typeof _0x3de42c[_0xa490('0x33')]===_0xa490('0x34')&&typeof _0x3de42c['limit']===_0xa490('0x34');var _0x6185a9=_0x5b726a[_0xa490('0x35')];var _0x3c85fc=_0x3960c6?0x0:_0x3de42c['offset'];var _0x5049f0=_0x3960c6?_0x5b726a[_0xa490('0x35')]:_0x3de42c['offset']+_0x3de42c[_0xa490('0x36')];var _0x361707;if(_0x5049f0>=_0x6185a9){_0x5049f0=_0x6185a9;_0x361707=0xc8;}else{_0x361707=0xce;}_0x2f63b9['status'](_0x361707);return _0x2f63b9[_0xa490('0x37')](_0xa490('0x38'),_0x3c85fc+'-'+_0x5049f0+'/'+_0x6185a9)[_0xa490('0x39')](_0x5b726a);}return null;};}function patchUpdates(_0x570c37){return function(_0x2b68c8){try{jsonpatch[_0xa490('0x3a')](_0x2b68c8,_0x570c37,!![]);}catch(_0x12890c){return BPromise[_0xa490('0x3b')](_0x12890c);}return _0x2b68c8[_0xa490('0x3c')]();};}function saveUpdates(_0x2ebc93,_0x3dbdd8){return function(_0x301948){if(_0x301948){return _0x301948[_0xa490('0x3d')](_0x2ebc93)['then'](function(_0x3e4e03){return _0x3e4e03;});}return null;};}function removeEntity(_0x57700a,_0x564af7){return function(_0x2e3bd7){if(_0x2e3bd7){return _0x2e3bd7[_0xa490('0x3e')]()[_0xa490('0x3f')](function(){_0x57700a[_0xa490('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1eed8d,_0x7344c5){return function(_0x3d2544){if(!_0x3d2544){_0x1eed8d['sendStatus'](0x194);}return _0x3d2544;};}function handleError(_0x10f636,_0x7726d){_0x7726d=_0x7726d||0x1f4;return function(_0x5caabc){logger[_0xa490('0x2a')](_0x5caabc[_0xa490('0x40')]);if(_0x5caabc[_0xa490('0x41')]){delete _0x5caabc[_0xa490('0x41')];}_0x10f636[_0xa490('0x31')](_0x7726d)[_0xa490('0x42')](_0x5caabc);};}exports[_0xa490('0x43')]=function(_0x5a1ce2,_0xba078b){var _0xec9f60={},_0x339346={},_0x33abf9={'count':0x0,'rows':[]};var _0x1156bb=_['map'](db['WhatsappMessage'][_0xa490('0x44')],function(_0x29adbd){return{'name':_0x29adbd[_0xa490('0x45')],'type':_0x29adbd[_0xa490('0x46')][_0xa490('0x47')]};});_0x339346['model']=_['map'](_0x1156bb,_0xa490('0x41'));_0x339346[_0xa490('0x48')]=_['keys'](_0x5a1ce2['query']);_0x339346[_0xa490('0x49')]=_[_0xa490('0x4a')](_0x339346[_0xa490('0x4b')],_0x339346[_0xa490('0x48')]);_0xec9f60['attributes']=_[_0xa490('0x4a')](_0x339346[_0xa490('0x4b')],qs['fields'](_0x5a1ce2[_0xa490('0x48')]['fields']));_0xec9f60[_0xa490('0x4c')]=_0xec9f60[_0xa490('0x4c')]['length']?_0xec9f60[_0xa490('0x4c')]:_0x339346[_0xa490('0x4b')];if(!_0x5a1ce2['query'][_0xa490('0x4d')](_0xa490('0x4e'))){_0xec9f60[_0xa490('0x36')]=qs[_0xa490('0x36')](_0x5a1ce2[_0xa490('0x48')][_0xa490('0x36')]);_0xec9f60['offset']=qs['offset'](_0x5a1ce2['query']['offset']);}_0xec9f60[_0xa490('0x4f')]=qs['sort'](_0x5a1ce2[_0xa490('0x48')][_0xa490('0x50')]);_0xec9f60[_0xa490('0x51')]=qs['filters'](_[_0xa490('0x52')](_0x5a1ce2[_0xa490('0x48')],_0x339346[_0xa490('0x49')]),_0x1156bb);if(_0x5a1ce2[_0xa490('0x48')]['filter']){_0xec9f60[_0xa490('0x51')]=_['merge'](_0xec9f60['where'],{'$or':_[_0xa490('0x53')](_0x1156bb,function(_0x42b340){if(_0x42b340['type']!==_0xa490('0x54')){var _0xb589b1={};_0xb589b1[_0x42b340[_0xa490('0x41')]]={'$like':'%'+_0x5a1ce2[_0xa490('0x48')][_0xa490('0x55')]+'%'};return _0xb589b1;}})});}_0xec9f60=_[_0xa490('0x56')]({},_0xec9f60,_0x5a1ce2[_0xa490('0x57')]);var _0x394c0b={'where':_0xec9f60[_0xa490('0x51')]};return db[_0xa490('0x58')][_0xa490('0x35')](_0x394c0b)[_0xa490('0x3f')](function(_0x4e032c){_0x33abf9[_0xa490('0x35')]=_0x4e032c;if(_0x5a1ce2['query'][_0xa490('0x59')]){_0xec9f60['include']=[{'all':!![]}];}return db[_0xa490('0x58')][_0xa490('0x5a')](_0xec9f60);})[_0xa490('0x3f')](function(_0x292220){_0x33abf9[_0xa490('0x5b')]=_0x292220;return _0x33abf9;})['then'](respondWithFilteredResult(_0xba078b,_0xec9f60))[_0xa490('0x2f')](handleError(_0xba078b,null));};exports[_0xa490('0x5c')]=function(_0xc44e82,_0x323f75){var _0x57c632={'raw':!![],'where':{'id':_0xc44e82['params']['id']}},_0x338609={};_0x338609[_0xa490('0x4b')]=_[_0xa490('0x5d')](db[_0xa490('0x58')][_0xa490('0x44')]);_0x338609[_0xa490('0x48')]=_[_0xa490('0x5d')](_0xc44e82[_0xa490('0x48')]);_0x338609['filters']=_[_0xa490('0x4a')](_0x338609[_0xa490('0x4b')],_0x338609[_0xa490('0x48')]);_0x57c632[_0xa490('0x4c')]=_[_0xa490('0x4a')](_0x338609['model'],qs[_0xa490('0x5e')](_0xc44e82[_0xa490('0x48')][_0xa490('0x5e')]));_0x57c632[_0xa490('0x4c')]=_0x57c632[_0xa490('0x4c')][_0xa490('0x5f')]?_0x57c632[_0xa490('0x4c')]:_0x338609[_0xa490('0x4b')];if(_0xc44e82['query'][_0xa490('0x59')]){_0x57c632[_0xa490('0x60')]=[{'all':!![]}];}_0x57c632=_[_0xa490('0x56')]({},_0x57c632,_0xc44e82[_0xa490('0x57')]);return db[_0xa490('0x58')]['find'](_0x57c632)['then'](handleEntityNotFound(_0x323f75,null))[_0xa490('0x3f')](respondWithResult(_0x323f75,null))['catch'](handleError(_0x323f75,null));};exports[_0xa490('0x61')]=function(_0x31b152,_0x1fdcd1){return db['WhatsappMessage'][_0xa490('0x61')](_0x31b152['body'],{})[_0xa490('0x3f')](respondWithResult(_0x1fdcd1,0xc9))[_0xa490('0x2f')](handleError(_0x1fdcd1,null));};exports[_0xa490('0x3d')]=function(_0x88ce52,_0x10aa73){if(_0x88ce52[_0xa490('0x62')]['id']){delete _0x88ce52['body']['id'];}return db['WhatsappMessage'][_0xa490('0x63')]({'where':{'id':_0x88ce52[_0xa490('0x64')]['id']}})[_0xa490('0x3f')](handleEntityNotFound(_0x10aa73,null))['then'](saveUpdates(_0x88ce52[_0xa490('0x62')],null))[_0xa490('0x3f')](respondWithResult(_0x10aa73,null))[_0xa490('0x2f')](handleError(_0x10aa73,null));};exports[_0xa490('0x3e')]=function(_0x4d4174,_0x28fad0){return db[_0xa490('0x58')][_0xa490('0x63')]({'where':{'id':_0x4d4174['params']['id']}})[_0xa490('0x3f')](handleEntityNotFound(_0x28fad0,null))['then'](removeEntity(_0x28fad0,null))[_0xa490('0x2f')](handleError(_0x28fad0,null));};exports[_0xa490('0x65')]=function(_0x572d5b,_0xbeb9d3){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0xbeb9d3,null))[_0xa490('0x2f')](handleError(_0xbeb9d3,null));};var interaction_log=require(_0xa490('0x66'))(_0xa490('0x67'));exports['accept']=function(_0x3bf298,_0x5ba723,_0x218b70){var _0x206008={'agent':{},'channel':'whatsapp'};if(_0x3bf298[_0xa490('0x62')]['id']){delete _0x3bf298[_0xa490('0x62')]['id'];}_0x3bf298[_0xa490('0x62')][_0xa490('0x68')]=!![];_0x3bf298[_0xa490('0x62')][_0xa490('0x69')]=moment()[_0xa490('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');_0x3bf298['body'][_0xa490('0x6b')]=_0x3bf298[_0xa490('0x62')][_0xa490('0x6b')]||_0x3bf298[_0xa490('0x6c')]['id'];_0x206008['agent']['id']=_0x3bf298[_0xa490('0x62')][_0xa490('0x6b')];return db[_0xa490('0x58')][_0xa490('0x63')]({'where':{'id':_0x3bf298[_0xa490('0x64')]['id'],'UserId':null}})[_0xa490('0x3f')](handleEntityNotFound(_0x5ba723,null))[_0xa490('0x3f')](saveUpdates(_0x3bf298[_0xa490('0x62')],null))['then'](function(_0x4bd63a){if(_0x4bd63a){_0x206008[_0xa490('0x2c')]=_0x4bd63a[_0xa490('0x6d')]({'plain':!![]});return db['WhatsappInteraction'][_0xa490('0x63')]({'where':{'id':_0x4bd63a[_0xa490('0x6e')]}});}return null;})[_0xa490('0x3f')](handleEntityNotFound(_0x5ba723,null))[_0xa490('0x3f')](function(_0x19a8db){if(_0x19a8db){return _0x19a8db['update']({'UserId':_0x3bf298[_0xa490('0x62')][_0xa490('0x6b')],'read1stAt':_[_0xa490('0x6f')](_0x19a8db[_0xa490('0x70')])?moment()[_0xa490('0x6a')](_0xa490('0x71')):undefined});}return null;})['then'](function(_0x3e85af){if(_0x3e85af){_0x206008[_0xa490('0x72')]=_0x3e85af['get']({'plain':!![]});interaction_log[_0xa490('0x2d')](_0xa490('0x73'),_0x3bf298[_0xa490('0x6c')]['id'],_0x3bf298[_0xa490('0x6c')][_0xa490('0x41')],_0x3bf298[_0xa490('0x6c')][_0xa490('0x74')],_0x206008[_0xa490('0x72')]['id'],_0x3bf298[_0xa490('0x62')]?JSON[_0xa490('0x29')](_0x3bf298[_0xa490('0x62')]):_0xa490('0x75'));return respondWithRpcPromise(_0xa490('0x76'),_0xa490('0x77'),_0x206008);}return null;})[_0xa490('0x3f')](function(_0x258117){var _0x1de5c1=_0xa490('0x78')+_0x258117[_0xa490('0x2c')][_0xa490('0x79')];return db[_0xa490('0x7a')][_0xa490('0x48')](_0x1de5c1,{'type':db[_0xa490('0x7b')][_0xa490('0x7c')][_0xa490('0x7d')],'raw':!![]})[_0xa490('0x3f')](function(_0x9ace45){return _0x9ace45;});})[_0xa490('0x3f')](function(_0x4e6898){if(_0x4e6898){_0x206008[_0xa490('0x2c')][_0xa490('0x7e')]=_0x4e6898[0x0];if(!_0x3bf298[_0xa490('0x62')]['UserId'])return;return db[_0xa490('0x7f')][_0xa490('0x63')]({'where':{'id':_0x3bf298[_0xa490('0x62')]['UserId'],'role':'agent'},'attributes':['id',_0xa490('0x41'),'fullname',_0xa490('0x80'),_0xa490('0x81')],'raw':!![]});}return null;})[_0xa490('0x3f')](function(_0x58d6c0){if(!_0x58d6c0)return null;_0x206008['message'][_0xa490('0x82')]=_0x58d6c0;return _0x206008;})[_0xa490('0x3f')](function(_0x5366ab){if(_0x5366ab){if(_0x3bf298[_0xa490('0x62')][_0xa490('0x83')]){_0x206008[_0xa490('0x2c')][_0xa490('0x84')]=util[_0xa490('0x6a')](_0xa490('0x85'),_0x3bf298[_0xa490('0x6c')][_0xa490('0x41')]);_0x206008[_0xa490('0x2c')][_0xa490('0x86')]=_0x206008['channel'];_0x206008[_0xa490('0x2c')][_0xa490('0x87')]=_0x206008[_0xa490('0x86')];_0x206008['message'][_0xa490('0x88')]='accept';return respondWithRpcPromise(_0xa490('0x89'),_0xa490('0x89'),{'event':'acceptmessage','message':_0x206008[_0xa490('0x2c')]},client9002)[_0xa490('0x3f')](function(){return _0x206008;});}return _0x206008;}return null;})[_0xa490('0x3f')](respondWithResult(_0x5ba723,null))[_0xa490('0x2f')](handleError(_0x5ba723,null));};var interaction_log=require(_0xa490('0x66'))('whatsapp-interactions');exports[_0xa490('0x3b')]=function(_0x126312,_0x5bcccd,_0x2c81f0){var _0x3244a0={'agent':{},'channel':'whatsapp'};if(_0x126312[_0xa490('0x62')]['id']){delete _0x126312[_0xa490('0x62')]['id'];}_0x126312[_0xa490('0x62')][_0xa490('0x6b')]=_0x126312[_0xa490('0x62')][_0xa490('0x6b')]||_0x126312[_0xa490('0x6c')]['id'];_0x3244a0['agent']['id']=_0x126312[_0xa490('0x62')][_0xa490('0x6b')];return db['WhatsappMessage'][_0xa490('0x63')]({'where':{'id':_0x126312['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5bcccd,null))[_0xa490('0x3f')](function(_0x49ad3e){if(_0x49ad3e){_0x3244a0[_0xa490('0x2c')]=_0x49ad3e['get']({'plain':!![]});return db['WhatsappInteraction'][_0xa490('0x63')]({'where':{'id':_0x49ad3e[_0xa490('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x5bcccd,null))[_0xa490('0x3f')](function(_0x3a215c){if(_0x3a215c){_0x3244a0[_0xa490('0x72')]=_0x3a215c['get']({'plain':!![]});interaction_log[_0xa490('0x2d')](_0xa490('0x8a'),_0x126312[_0xa490('0x6c')]['id'],_0x126312['user']['name'],_0x126312['user'][_0xa490('0x74')],_0x3244a0[_0xa490('0x72')]['id'],_0x126312['body']?JSON['stringify'](_0x126312[_0xa490('0x62')]):_0xa490('0x75'));return respondWithRpcPromise(_0xa490('0x8b'),_0xa490('0x8c'),_0x3244a0);}return null;})[_0xa490('0x3f')](function(_0x498e5e){var _0x383d07=_0xa490('0x78')+_0x498e5e['message'][_0xa490('0x79')];return db['sequelize']['query'](_0x383d07,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})['then'](function(_0x40c8d8){return _0x40c8d8;});})[_0xa490('0x3f')](function(_0x406536){if(_0x406536){_0x3244a0[_0xa490('0x2c')][_0xa490('0x7e')]=_0x406536[0x0];if(!_0x126312['body'][_0xa490('0x6b')])return;return db[_0xa490('0x7f')][_0xa490('0x63')]({'where':{'id':_0x126312[_0xa490('0x62')]['UserId'],'role':_0xa490('0x82')},'attributes':['id',_0xa490('0x41'),_0xa490('0x8d'),_0xa490('0x80'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4f6f84){if(!_0x4f6f84)return null;_0x3244a0[_0xa490('0x2c')]['agent']=_0x4f6f84;return _0x3244a0;})['then'](function(_0x5dfa19){if(_0x5dfa19){_0x5dfa19[_0xa490('0x2c')][_0xa490('0x84')]=util[_0xa490('0x6a')](_0xa490('0x85'),_0x126312[_0xa490('0x6c')][_0xa490('0x41')]);_0x5dfa19[_0xa490('0x2c')][_0xa490('0x86')]=_0x3244a0[_0xa490('0x86')];_0x5dfa19[_0xa490('0x2c')]['motionChannel']=_0x3244a0[_0xa490('0x86')];_0x5dfa19['message'][_0xa490('0x88')]=_0xa490('0x3b');respondWithRpcPromise(_0xa490('0x89'),_0xa490('0x89'),{'event':_0xa490('0x8e'),'message':_0x5dfa19[_0xa490('0x2c')]},client9002);return _0x3244a0;}return null;})['then'](respondWithResult(_0x5bcccd,null))[_0xa490('0x2f')](handleError(_0x5bcccd,null));};exports[_0xa490('0x31')]=function(_0x19bab3,_0x2d111a,_0x3570a3){if(_0x19bab3['body']['id']){delete _0x19bab3[_0xa490('0x62')]['id'];}var _0x5759a9;return db[_0xa490('0x58')][_0xa490('0x63')]({'where':{'id':_0x19bab3[_0xa490('0x64')]['id']}})['then'](handleEntityNotFound(_0x2d111a,null))['then'](function(_0x2809b2){if(_0x2809b2){_0x5759a9=_0x2809b2;return db['WhatsappAccount'][_0xa490('0x63')]({'where':{'id':_0x2809b2[_0xa490('0x8f')]}});}})[_0xa490('0x3f')](handleEntityNotFound(_0x2d111a,null))[_0xa490('0x3f')](function(_0x1cf6b0){if(_0x1cf6b0){logger[_0xa490('0x27')]('WhatsppMessage,\x20%s,\x20%s,\x20%s',_0xa490('0x31'),_0xa490('0x90'),_0x1cf6b0[_0xa490('0x46')],util[_0xa490('0x91')](_0x19bab3[_0xa490('0x62')],{'showHidden':![],'depth':null}));switch(_0x1cf6b0[_0xa490('0x46')]){case _0xa490('0x92'):if(_0x19bab3['body'][_0xa490('0x93')]&&_0x19bab3[_0xa490('0x62')][_0xa490('0x93')]===_0x5759a9[_0xa490('0x94')]&&_0x19bab3[_0xa490('0x62')][_0xa490('0x95')]&&_0x19bab3[_0xa490('0x62')][_0xa490('0x95')]===_0xa490('0x68')){return _0x5759a9['update']({'read':!![]});}else{logger[_0xa490('0x2a')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xa490('0x31'),_0xa490('0x92'),util[_0xa490('0x91')](_0x19bab3[_0xa490('0x62')],{'showHidden':![],'depth':null}));}break;}return _0x5759a9;}})['then'](respondWithResult(_0x2d111a,null))[_0xa490('0x2f')](handleError(_0x2d111a,null));}; \ No newline at end of file +var _0x057a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','name','send','index','map','WhatsappMessage','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','merge','body','destroy','find','describe','accept','whatsapp','readAt','UserId','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','internal','manual','interface','format','channel','motionChannel','event','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','User','SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','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','ioredis'];(function(_0x461d83,_0x7c5e69){var _0x139952=function(_0x467562){while(--_0x467562){_0x461d83['push'](_0x461d83['shift']());}};_0x139952(++_0x7c5e69);}(_0x057a,0x7e));var _0xa057=function(_0x35062d,_0x2de55a){_0x35062d=_0x35062d-0x0;var _0x1bc9e8=_0x057a[_0x35062d];return _0x1bc9e8;};'use strict';var emlformat=require(_0xa057('0x0'));var rimraf=require(_0xa057('0x1'));var zipdir=require(_0xa057('0x2'));var jsonpatch=require(_0xa057('0x3'));var rp=require(_0xa057('0x4'));var moment=require(_0xa057('0x5'));var BPromise=require(_0xa057('0x6'));var Mustache=require(_0xa057('0x7'));var util=require(_0xa057('0x8'));var path=require(_0xa057('0x9'));var sox=require('sox');var csv=require(_0xa057('0xa'));var ejs=require(_0xa057('0xb'));var fs=require('fs');var fs_extra=require(_0xa057('0xc'));var _=require(_0xa057('0xd'));var squel=require(_0xa057('0xe'));var crypto=require(_0xa057('0xf'));var jsforce=require(_0xa057('0x10'));var deskjs=require(_0xa057('0x11'));var toCsv=require(_0xa057('0xa'));var querystring=require(_0xa057('0x12'));var Papa=require('papaparse');var Redis=require(_0xa057('0x13'));var authService=require(_0xa057('0x14'));var qs=require(_0xa057('0x15'));var as=require(_0xa057('0x16'));var hardwareService=require(_0xa057('0x17'));var logger=require('../../config/logger')(_0xa057('0x18'));var utils=require(_0xa057('0x19'));var config=require(_0xa057('0x1a'));var licenseUtil=require(_0xa057('0x1b'));var db=require(_0xa057('0x1c'))['db'];config[_0xa057('0x1d')]=_[_0xa057('0x1e')](config[_0xa057('0x1d')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa057('0x1f'))[_0xa057('0x20')](socket);var jayson=require(_0xa057('0x21'));var client=jayson[_0xa057('0x22')][_0xa057('0x23')]({'port':0x232c});var client9002=jayson[_0xa057('0x22')][_0xa057('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x118268,_0x16ee91,_0x13d1c3,_0x10c178){return new BPromise(function(_0xc8ee51,_0x561147){var _0x4ca595=_0x10c178||client;return _0x4ca595[_0xa057('0x24')](_0x118268,_0x13d1c3)[_0xa057('0x25')](function(_0x5578d1){logger[_0xa057('0x26')](_0xa057('0x27'),_0x16ee91,_0xa057('0x28'));logger[_0xa057('0x29')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x16ee91,_0xa057('0x28'),JSON[_0xa057('0x2a')](_0x5578d1));if(_0x5578d1[_0xa057('0x2b')]){if(_0x5578d1[_0xa057('0x2b')][_0xa057('0x2c')]===0x1f4){logger[_0xa057('0x2b')]('WhatsappMessage,\x20%s,\x20%s',_0x16ee91,_0x5578d1[_0xa057('0x2b')][_0xa057('0x2d')]);return _0x561147(_0x5578d1['error'][_0xa057('0x2d')]);}logger['error'](_0xa057('0x27'),_0x16ee91,_0x5578d1[_0xa057('0x2b')][_0xa057('0x2d')]);return _0xc8ee51(_0x5578d1[_0xa057('0x2b')][_0xa057('0x2d')]);}else{logger[_0xa057('0x26')]('WhatsappMessage,\x20%s,\x20%s',_0x16ee91,_0xa057('0x28'));_0xc8ee51(_0x5578d1[_0xa057('0x2e')]['message']);}})['catch'](function(_0x29e43b){logger[_0xa057('0x2b')](_0xa057('0x27'),_0x16ee91,_0x29e43b);_0x561147(_0x29e43b);});});}function respondWithStatusCode(_0x518bf7,_0x1a7bed){_0x1a7bed=_0x1a7bed||0xcc;return function(_0x46817c){if(_0x46817c){return _0x518bf7[_0xa057('0x2f')](_0x1a7bed);}return _0x518bf7[_0xa057('0x30')](_0x1a7bed)[_0xa057('0x31')]();};}function respondWithResult(_0x1899d7,_0x17bd76){_0x17bd76=_0x17bd76||0xc8;return function(_0x3a362c){if(_0x3a362c){return _0x1899d7['status'](_0x17bd76)[_0xa057('0x32')](_0x3a362c);}};}function respondWithFilteredResult(_0x1265fb,_0x226459){return function(_0x7e8959){if(_0x7e8959){var _0x2982b9=typeof _0x226459[_0xa057('0x33')]===_0xa057('0x34')&&typeof _0x226459['limit']===_0xa057('0x34');var _0x4c7ca4=_0x7e8959[_0xa057('0x35')];var _0x38c276=_0x2982b9?0x0:_0x226459[_0xa057('0x33')];var _0x390c9a=_0x2982b9?_0x7e8959[_0xa057('0x35')]:_0x226459[_0xa057('0x33')]+_0x226459[_0xa057('0x36')];var _0x3fd503;if(_0x390c9a>=_0x4c7ca4){_0x390c9a=_0x4c7ca4;_0x3fd503=0xc8;}else{_0x3fd503=0xce;}_0x1265fb[_0xa057('0x30')](_0x3fd503);return _0x1265fb[_0xa057('0x37')](_0xa057('0x38'),_0x38c276+'-'+_0x390c9a+'/'+_0x4c7ca4)[_0xa057('0x32')](_0x7e8959);}return null;};}function patchUpdates(_0x1a97a6){return function(_0x225815){try{jsonpatch[_0xa057('0x39')](_0x225815,_0x1a97a6,!![]);}catch(_0x207cea){return BPromise[_0xa057('0x3a')](_0x207cea);}return _0x225815['save']();};}function saveUpdates(_0x5bebf7,_0x44c0a8){return function(_0x209add){if(_0x209add){return _0x209add[_0xa057('0x3b')](_0x5bebf7)[_0xa057('0x25')](function(_0x10dd78){return _0x10dd78;});}return null;};}function removeEntity(_0x2e43b4,_0x199c46){return function(_0x482a98){if(_0x482a98){return _0x482a98['destroy']()[_0xa057('0x25')](function(){_0x2e43b4[_0xa057('0x30')](0xcc)[_0xa057('0x31')]();});}};}function handleEntityNotFound(_0x36446b,_0xfd3f09){return function(_0x34ee55){if(!_0x34ee55){_0x36446b['sendStatus'](0x194);}return _0x34ee55;};}function handleError(_0x50ce82,_0x3e5b3b){_0x3e5b3b=_0x3e5b3b||0x1f4;return function(_0x277bfe){logger['error'](_0x277bfe['stack']);if(_0x277bfe[_0xa057('0x3c')]){delete _0x277bfe[_0xa057('0x3c')];}_0x50ce82[_0xa057('0x30')](_0x3e5b3b)[_0xa057('0x3d')](_0x277bfe);};}exports[_0xa057('0x3e')]=function(_0x455cf7,_0x8b910){var _0x1f6d16={},_0x3fe916={},_0x48ae4a={'count':0x0,'rows':[]};var _0x231feb=_[_0xa057('0x3f')](db[_0xa057('0x40')]['rawAttributes'],function(_0x1bb578){return{'name':_0x1bb578[_0xa057('0x41')],'type':_0x1bb578[_0xa057('0x42')][_0xa057('0x43')]};});_0x3fe916['model']=_[_0xa057('0x3f')](_0x231feb,_0xa057('0x3c'));_0x3fe916[_0xa057('0x44')]=_[_0xa057('0x45')](_0x455cf7['query']);_0x3fe916[_0xa057('0x46')]=_[_0xa057('0x47')](_0x3fe916[_0xa057('0x48')],_0x3fe916[_0xa057('0x44')]);_0x1f6d16[_0xa057('0x49')]=_[_0xa057('0x47')](_0x3fe916[_0xa057('0x48')],qs['fields'](_0x455cf7[_0xa057('0x44')]['fields']));_0x1f6d16[_0xa057('0x49')]=_0x1f6d16[_0xa057('0x49')][_0xa057('0x4a')]?_0x1f6d16['attributes']:_0x3fe916['model'];if(!_0x455cf7['query'][_0xa057('0x4b')](_0xa057('0x4c'))){_0x1f6d16[_0xa057('0x36')]=qs[_0xa057('0x36')](_0x455cf7['query'][_0xa057('0x36')]);_0x1f6d16['offset']=qs[_0xa057('0x33')](_0x455cf7['query']['offset']);}_0x1f6d16[_0xa057('0x4d')]=qs['sort'](_0x455cf7[_0xa057('0x44')][_0xa057('0x4e')]);_0x1f6d16[_0xa057('0x4f')]=qs['filters'](_[_0xa057('0x50')](_0x455cf7['query'],_0x3fe916['filters']),_0x231feb);if(_0x455cf7[_0xa057('0x44')][_0xa057('0x51')]){_0x1f6d16[_0xa057('0x4f')]=_['merge'](_0x1f6d16[_0xa057('0x4f')],{'$or':_[_0xa057('0x3f')](_0x231feb,function(_0x42e0ad){if(_0x42e0ad[_0xa057('0x42')]!==_0xa057('0x52')){var _0x573c7f={};_0x573c7f[_0x42e0ad['name']]={'$like':'%'+_0x455cf7[_0xa057('0x44')]['filter']+'%'};return _0x573c7f;}})});}_0x1f6d16=_['merge']({},_0x1f6d16,_0x455cf7[_0xa057('0x53')]);var _0x992288={'where':_0x1f6d16[_0xa057('0x4f')]};return db[_0xa057('0x40')]['count'](_0x992288)[_0xa057('0x25')](function(_0x23eeaf){_0x48ae4a[_0xa057('0x35')]=_0x23eeaf;if(_0x455cf7[_0xa057('0x44')][_0xa057('0x54')]){_0x1f6d16[_0xa057('0x55')]=[{'all':!![]}];}return db[_0xa057('0x40')][_0xa057('0x56')](_0x1f6d16);})[_0xa057('0x25')](function(_0x2dcc95){_0x48ae4a['rows']=_0x2dcc95;return _0x48ae4a;})[_0xa057('0x25')](respondWithFilteredResult(_0x8b910,_0x1f6d16))[_0xa057('0x57')](handleError(_0x8b910,null));};exports[_0xa057('0x58')]=function(_0x5ff0ad,_0x274e42){var _0x5a575f={'raw':!![],'where':{'id':_0x5ff0ad[_0xa057('0x59')]['id']}},_0x51439c={};_0x51439c['model']=_[_0xa057('0x45')](db['WhatsappMessage'][_0xa057('0x5a')]);_0x51439c['query']=_[_0xa057('0x45')](_0x5ff0ad['query']);_0x51439c[_0xa057('0x46')]=_['intersection'](_0x51439c[_0xa057('0x48')],_0x51439c['query']);_0x5a575f['attributes']=_[_0xa057('0x47')](_0x51439c[_0xa057('0x48')],qs[_0xa057('0x5b')](_0x5ff0ad[_0xa057('0x44')]['fields']));_0x5a575f[_0xa057('0x49')]=_0x5a575f['attributes'][_0xa057('0x4a')]?_0x5a575f['attributes']:_0x51439c['model'];if(_0x5ff0ad['query']['includeAll']){_0x5a575f[_0xa057('0x55')]=[{'all':!![]}];}_0x5a575f=_[_0xa057('0x5c')]({},_0x5a575f,_0x5ff0ad[_0xa057('0x53')]);return db['WhatsappMessage']['find'](_0x5a575f)[_0xa057('0x25')](handleEntityNotFound(_0x274e42,null))[_0xa057('0x25')](respondWithResult(_0x274e42,null))[_0xa057('0x57')](handleError(_0x274e42,null));};exports['create']=function(_0x18e54e,_0x4f7768){return db[_0xa057('0x40')]['create'](_0x18e54e[_0xa057('0x5d')],{})[_0xa057('0x25')](respondWithResult(_0x4f7768,0xc9))['catch'](handleError(_0x4f7768,null));};exports[_0xa057('0x3b')]=function(_0x9389ad,_0x11acbe){if(_0x9389ad[_0xa057('0x5d')]['id']){delete _0x9389ad['body']['id'];}return db['WhatsappMessage']['find']({'where':{'id':_0x9389ad['params']['id']}})[_0xa057('0x25')](handleEntityNotFound(_0x11acbe,null))[_0xa057('0x25')](saveUpdates(_0x9389ad['body'],null))[_0xa057('0x25')](respondWithResult(_0x11acbe,null))[_0xa057('0x57')](handleError(_0x11acbe,null));};exports[_0xa057('0x5e')]=function(_0x1175a2,_0x40812c){return db[_0xa057('0x40')][_0xa057('0x5f')]({'where':{'id':_0x1175a2[_0xa057('0x59')]['id']}})[_0xa057('0x25')](handleEntityNotFound(_0x40812c,null))[_0xa057('0x25')](removeEntity(_0x40812c,null))[_0xa057('0x57')](handleError(_0x40812c,null));};exports[_0xa057('0x60')]=function(_0x54f1bf,_0x15d1f1){return db['WhatsappMessage'][_0xa057('0x60')]()[_0xa057('0x25')](respondWithResult(_0x15d1f1,null))[_0xa057('0x57')](handleError(_0x15d1f1,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xa057('0x61')]=function(_0x588dad,_0x32146b,_0x1b0545){var _0x26fa2b={'agent':{},'channel':_0xa057('0x62')};if(_0x588dad[_0xa057('0x5d')]['id']){delete _0x588dad[_0xa057('0x5d')]['id'];}_0x588dad[_0xa057('0x5d')]['read']=!![];_0x588dad['body'][_0xa057('0x63')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x588dad[_0xa057('0x5d')][_0xa057('0x64')]=_0x588dad[_0xa057('0x5d')]['UserId']||_0x588dad['user']['id'];_0x26fa2b['agent']['id']=_0x588dad[_0xa057('0x5d')][_0xa057('0x64')];return db[_0xa057('0x40')]['find']({'where':{'id':_0x588dad[_0xa057('0x59')]['id'],'UserId':null}})[_0xa057('0x25')](handleEntityNotFound(_0x32146b,null))[_0xa057('0x25')](saveUpdates(_0x588dad[_0xa057('0x5d')],null))['then'](function(_0xb371ee){if(_0xb371ee){_0x26fa2b[_0xa057('0x2d')]=_0xb371ee[_0xa057('0x65')]({'plain':!![]});return db[_0xa057('0x66')]['find']({'where':{'id':_0xb371ee[_0xa057('0x67')]}});}return null;})[_0xa057('0x25')](handleEntityNotFound(_0x32146b,null))['then'](function(_0x1f94f0){if(_0x1f94f0){return _0x1f94f0[_0xa057('0x3b')]({'UserId':_0x588dad[_0xa057('0x5d')][_0xa057('0x64')],'read1stAt':_[_0xa057('0x68')](_0x1f94f0[_0xa057('0x69')])?moment()['format'](_0xa057('0x6a')):undefined});}return null;})[_0xa057('0x25')](function(_0x56211e){if(_0x56211e){_0x26fa2b['interaction']=_0x56211e[_0xa057('0x65')]({'plain':!![]});interaction_log[_0xa057('0x26')](_0xa057('0x6b'),_0x588dad[_0xa057('0x6c')]['id'],_0x588dad[_0xa057('0x6c')]['name'],_0x588dad[_0xa057('0x6c')][_0xa057('0x6d')],_0x26fa2b[_0xa057('0x6e')]['id'],_0x588dad[_0xa057('0x5d')]?JSON[_0xa057('0x2a')](_0x588dad[_0xa057('0x5d')]):_0xa057('0x6f'));return respondWithRpcPromise(_0xa057('0x70'),'acceptMessage',_0x26fa2b);}return null;})[_0xa057('0x25')](function(_0x7fa42e){var _0x4230e2=_0xa057('0x71')+_0x7fa42e[_0xa057('0x2d')][_0xa057('0x72')];return db[_0xa057('0x73')][_0xa057('0x44')](_0x4230e2,{'type':db[_0xa057('0x74')][_0xa057('0x75')][_0xa057('0x76')],'raw':!![]})[_0xa057('0x25')](function(_0x2265c9){return _0x2265c9;});})[_0xa057('0x25')](function(_0x142b44){if(_0x142b44){_0x26fa2b[_0xa057('0x2d')][_0xa057('0x77')]=_0x142b44[0x0];if(!_0x588dad[_0xa057('0x5d')][_0xa057('0x64')])return;return db['User'][_0xa057('0x5f')]({'where':{'id':_0x588dad[_0xa057('0x5d')][_0xa057('0x64')],'role':_0xa057('0x78')},'attributes':['id',_0xa057('0x3c'),_0xa057('0x79'),_0xa057('0x7a'),_0xa057('0x7b')],'raw':!![]});}return null;})['then'](function(_0x21e8df){if(!_0x21e8df)return null;_0x26fa2b[_0xa057('0x2d')]['agent']=_0x21e8df;return _0x26fa2b;})[_0xa057('0x25')](function(_0xfe769e){if(_0xfe769e){if(_0x588dad[_0xa057('0x5d')][_0xa057('0x7c')]){_0x26fa2b['message'][_0xa057('0x7d')]=util[_0xa057('0x7e')]('SIP/%s',_0x588dad[_0xa057('0x6c')][_0xa057('0x3c')]);_0x26fa2b['message'][_0xa057('0x7f')]=_0x26fa2b['channel'];_0x26fa2b[_0xa057('0x2d')][_0xa057('0x80')]=_0x26fa2b[_0xa057('0x7f')];_0x26fa2b[_0xa057('0x2d')][_0xa057('0x81')]=_0xa057('0x61');return respondWithRpcPromise(_0xa057('0x82'),_0xa057('0x82'),{'event':_0xa057('0x83'),'message':_0x26fa2b[_0xa057('0x2d')]},client9002)[_0xa057('0x25')](function(){return _0x26fa2b;});}return _0x26fa2b;}return null;})[_0xa057('0x25')](respondWithResult(_0x32146b,null))[_0xa057('0x57')](handleError(_0x32146b,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0xa057('0x3a')]=function(_0x26aa8c,_0x30f02a,_0x35cabd){var _0x57c7f6={'agent':{},'channel':_0xa057('0x62')};if(_0x26aa8c['body']['id']){delete _0x26aa8c[_0xa057('0x5d')]['id'];}_0x26aa8c['body'][_0xa057('0x64')]=_0x26aa8c['body']['UserId']||_0x26aa8c[_0xa057('0x6c')]['id'];_0x57c7f6[_0xa057('0x78')]['id']=_0x26aa8c[_0xa057('0x5d')]['UserId'];return db[_0xa057('0x40')][_0xa057('0x5f')]({'where':{'id':_0x26aa8c[_0xa057('0x59')]['id'],'UserId':null}})[_0xa057('0x25')](handleEntityNotFound(_0x30f02a,null))['then'](function(_0x2ff599){if(_0x2ff599){_0x57c7f6[_0xa057('0x2d')]=_0x2ff599[_0xa057('0x65')]({'plain':!![]});return db[_0xa057('0x66')][_0xa057('0x5f')]({'where':{'id':_0x2ff599[_0xa057('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x30f02a,null))[_0xa057('0x25')](function(_0x1fddfa){if(_0x1fddfa){_0x57c7f6['interaction']=_0x1fddfa[_0xa057('0x65')]({'plain':!![]});interaction_log[_0xa057('0x26')](_0xa057('0x84'),_0x26aa8c[_0xa057('0x6c')]['id'],_0x26aa8c['user'][_0xa057('0x3c')],_0x26aa8c[_0xa057('0x6c')][_0xa057('0x6d')],_0x57c7f6['interaction']['id'],_0x26aa8c[_0xa057('0x5d')]?JSON[_0xa057('0x2a')](_0x26aa8c[_0xa057('0x5d')]):_0xa057('0x6f'));return respondWithRpcPromise(_0xa057('0x85'),'rejectMessage',_0x57c7f6);}return null;})[_0xa057('0x25')](function(_0x3ce213){var _0x50529f=_0xa057('0x71')+_0x3ce213[_0xa057('0x2d')][_0xa057('0x72')];return db['sequelize']['query'](_0x50529f,{'type':db[_0xa057('0x74')][_0xa057('0x75')][_0xa057('0x76')],'raw':!![]})[_0xa057('0x25')](function(_0x519319){return _0x519319;});})[_0xa057('0x25')](function(_0x585451){if(_0x585451){_0x57c7f6['message'][_0xa057('0x77')]=_0x585451[0x0];if(!_0x26aa8c[_0xa057('0x5d')][_0xa057('0x64')])return;return db[_0xa057('0x86')][_0xa057('0x5f')]({'where':{'id':_0x26aa8c['body'][_0xa057('0x64')],'role':_0xa057('0x78')},'attributes':['id',_0xa057('0x3c'),_0xa057('0x79'),_0xa057('0x7a'),_0xa057('0x7b')],'raw':!![]});}return null;})[_0xa057('0x25')](function(_0x3d2d5d){if(!_0x3d2d5d)return null;_0x57c7f6[_0xa057('0x2d')][_0xa057('0x78')]=_0x3d2d5d;return _0x57c7f6;})[_0xa057('0x25')](function(_0x234d9f){if(_0x234d9f){_0x234d9f[_0xa057('0x2d')][_0xa057('0x7d')]=util[_0xa057('0x7e')](_0xa057('0x87'),_0x26aa8c['user'][_0xa057('0x3c')]);_0x234d9f[_0xa057('0x2d')][_0xa057('0x7f')]=_0x57c7f6['channel'];_0x234d9f['message'][_0xa057('0x80')]=_0x57c7f6[_0xa057('0x7f')];_0x234d9f[_0xa057('0x2d')][_0xa057('0x81')]=_0xa057('0x3a');respondWithRpcPromise('EventManager',_0xa057('0x82'),{'event':_0xa057('0x88'),'message':_0x234d9f[_0xa057('0x2d')]},client9002);return _0x57c7f6;}return null;})[_0xa057('0x25')](respondWithResult(_0x30f02a,null))[_0xa057('0x57')](handleError(_0x30f02a,null));};exports['status']=function(_0x1b720f,_0x1c1373,_0x47ce04){if(_0x1b720f[_0xa057('0x5d')]['id']){delete _0x1b720f[_0xa057('0x5d')]['id'];}var _0x4e2280;return db[_0xa057('0x40')][_0xa057('0x5f')]({'where':{'id':_0x1b720f[_0xa057('0x59')]['id']}})[_0xa057('0x25')](handleEntityNotFound(_0x1c1373,null))[_0xa057('0x25')](function(_0x5a455a){if(_0x5a455a){_0x4e2280=_0x5a455a;return db[_0xa057('0x89')][_0xa057('0x5f')]({'where':{'id':_0x5a455a[_0xa057('0x8a')]}});}})[_0xa057('0x25')](handleEntityNotFound(_0x1c1373,null))[_0xa057('0x25')](function(_0x55d75f){if(_0x55d75f){logger[_0xa057('0x29')](_0xa057('0x8b'),_0xa057('0x30'),_0xa057('0x8c'),_0x55d75f[_0xa057('0x42')],util[_0xa057('0x8d')](_0x1b720f[_0xa057('0x5d')],{'showHidden':![],'depth':null}));switch(_0x55d75f[_0xa057('0x42')]){case _0xa057('0x8e'):if(_0x1b720f['body'][_0xa057('0x8f')]&&_0x1b720f['body'][_0xa057('0x8f')]===_0x4e2280['messageId']&&_0x1b720f[_0xa057('0x5d')]['MessageStatus']&&_0x1b720f[_0xa057('0x5d')]['MessageStatus']===_0xa057('0x90')){return _0x4e2280[_0xa057('0x3b')]({'read':!![]});}else{logger[_0xa057('0x2b')](_0xa057('0x91'),'status',_0xa057('0x8e'),util[_0xa057('0x8d')](_0x1b720f[_0xa057('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x4e2280;}})[_0xa057('0x25')](respondWithResult(_0x1c1373,null))[_0xa057('0x57')](handleError(_0x1c1373,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 1010012..440b3a2 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 _0x236c=['WhatsappMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x49c699,_0x314403){var _0x2853ea=function(_0x68ceb9){while(--_0x68ceb9){_0x49c699['push'](_0x49c699['shift']());}};_0x2853ea(++_0x314403);}(_0x236c,0x155));var _0xc236=function(_0x40d843,_0x3a4115){_0x40d843=_0x40d843-0x0;var _0x3d83a4=_0x236c[_0x40d843];return _0x3d83a4;};'use strict';var EventEmitter=require(_0xc236('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xc236('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xc236('0x2')](0x0);var events={'afterCreate':_0xc236('0x3'),'afterUpdate':_0xc236('0x4'),'afterDestroy':_0xc236('0x5')};function emitEvent(_0x518d6a){return function(_0x3adce9,_0x36e87d,_0x33bc57){WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a+':'+_0x3adce9['id'],_0x3adce9);WhatsappMessageEvents[_0xc236('0x6')](_0x518d6a,_0x3adce9);_0x33bc57(null);};}for(var e in events){if(events[_0xc236('0x7')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xc236('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0x0972=['hasOwnProperty','hook','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x378b69,_0x1b769c){var _0x50bb46=function(_0x39f1ee){while(--_0x39f1ee){_0x378b69['push'](_0x378b69['shift']());}};_0x50bb46(++_0x1b769c);}(_0x0972,0x64));var _0x2097=function(_0x2f3f14,_0x5936a4){_0x2f3f14=_0x2f3f14-0x0;var _0x3e0c9f=_0x0972[_0x2f3f14];return _0x3e0c9f;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x2097('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x2097('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2097('0x2'),'afterDestroy':_0x2097('0x3')};function emitEvent(_0x5b16c0){return function(_0x348ad8,_0x431d1c,_0xe6fbae){WhatsappMessageEvents[_0x2097('0x4')](_0x5b16c0+':'+_0x348ad8['id'],_0x348ad8);WhatsappMessageEvents[_0x2097('0x4')](_0x5b16c0,_0x348ad8);_0xe6fbae(null);};}for(var e in events){if(events[_0x2097('0x5')](e)){var event=events[e];WhatsappMessage[_0x2097('0x6')](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 9dbec13..c588809 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 _0x5cad=['/whatsapp/v1/','text','POST','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt','catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','accountSid','messages','create','body','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x5cad,0x8c));var _0xd5ca=function(_0x4b9e80,_0x2b3179){_0x4b9e80=_0x4b9e80-0x0;var _0xc73b33=_0x5cad[_0x4b9e80];return _0xc73b33;};'use strict';var _=require(_0xd5ca('0x0'));var util=require(_0xd5ca('0x1'));var logger=require(_0xd5ca('0x2'))(_0xd5ca('0x3'));var moment=require(_0xd5ca('0x4'));var BPromise=require(_0xd5ca('0x5'));var rp=require(_0xd5ca('0x6'));var fetch=require(_0xd5ca('0x7'));var fs=require('fs');var path=require(_0xd5ca('0x8'));var rimraf=require(_0xd5ca('0x9'));var config=require(_0xd5ca('0xa'));var attributes=require(_0xd5ca('0xb'));module[_0xd5ca('0xc')]=function(_0x462093,_0x33574c){return _0x462093[_0xd5ca('0xd')](_0xd5ca('0xe'),attributes,{'tableName':_0xd5ca('0xf'),'paranoid':![],'indexes':[{'name':_0xd5ca('0x10'),'fields':[_0xd5ca('0x10')]},{'name':_0xd5ca('0x11'),'fields':['body'],'type':_0xd5ca('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a3ae4,_0x1fbc1f,_0x5c8a51){var _0x3fcef8=_0x462093['models'];var _0x26eaf0=_0x5a3ae4[_0xd5ca('0x13')]({'plain':!![]});if(_0x26eaf0[_0xd5ca('0x14')][_0xd5ca('0x15')]()==='in'||_0x26eaf0[_0xd5ca('0x14')][_0xd5ca('0x15')]()===_0xd5ca('0x16')&&!_0x26eaf0['secret']&&!_[_0xd5ca('0x17')](_0x26eaf0[_0xd5ca('0x18')])){_0x3fcef8[_0xd5ca('0x19')][_0xd5ca('0x1a')]({'where':{'id':_0x26eaf0['WhatsappInteractionId']}})[_0xd5ca('0x1b')](function(_0x31ae9d){if(_0x31ae9d){_0x31ae9d[_0xd5ca('0x1c')]({'lastMsgAt':_0x26eaf0[_0xd5ca('0x1d')],'lastMsgDirection':_0x26eaf0[_0xd5ca('0x14')][_0xd5ca('0x15')]()});}})[_0xd5ca('0x1e')](function(_0x1677a8){console['error'](_0x1677a8);});}if(_0x26eaf0[_0xd5ca('0x14')]===_0xd5ca('0x16')&&!_0x26eaf0['secret']){var _0x3f3524;_0x3fcef8[_0xd5ca('0x1f')][_0xd5ca('0x20')]({'where':{'id':_0x26eaf0[_0xd5ca('0x21')]},'raw':!![]})[_0xd5ca('0x1b')](function(_0x191b39){_0x3f3524=_0x191b39;if(_0x3f3524&&_0x3f3524[_0xd5ca('0x22')]){switch(_0x3f3524[_0xd5ca('0x22')]){case _0xd5ca('0x23'):var _0x11ec20=require(_0xd5ca('0x23'));if(_0x3f3524['accountSid']&&_0x3f3524[_0xd5ca('0x24')]&&_0x3f3524['phone']){var _0x438a74=new _0x11ec20(_0x3f3524[_0xd5ca('0x25')],_0x3f3524[_0xd5ca('0x24')]);_0x438a74[_0xd5ca('0x26')][_0xd5ca('0x27')]({'body':_0x26eaf0[_0xd5ca('0x28')],'to':'whatsapp:'+_0x26eaf0['phone'],'from':_0xd5ca('0x29')+_0x3f3524[_0xd5ca('0x2a')],'statusCallback':_0x3f3524[_0xd5ca('0x2b')]+_0xd5ca('0x2c')+_0x26eaf0['id']+_0xd5ca('0x2d')+_0x3f3524[_0xd5ca('0x2e')]})['then'](function(_0x4e6090){if(_0x4e6090['sid']){return _0x5a3ae4[_0xd5ca('0x1c')]({'messageId':_0x4e6090[_0xd5ca('0x2f')]});}})[_0xd5ca('0x1e')](function(_0x168881){logger[_0xd5ca('0x30')](_0xd5ca('0x31'),_0xd5ca('0x32'),_0xd5ca('0x23'),util[_0xd5ca('0x33')](_0x168881,{'showHidden':![],'depth':null}));});}else{logger[_0xd5ca('0x30')](_0xd5ca('0x31'),_0xd5ca('0x32'),_0xd5ca('0x23'),_0xd5ca('0x34'));}break;case _0xd5ca('0x35'):var _0x3bfa35=_0x3f3524[_0xd5ca('0x25')];var _0x5f5d5c=_0x3f3524[_0xd5ca('0x24')];var _0x46e8c5=_0x3f3524[_0xd5ca('0x36')]+_0xd5ca('0x37')+_0x3bfa35+'/messages/';var _0x231c09={'to':[_0x26eaf0[_0xd5ca('0x2a')]],'message':{'type':_0xd5ca('0x38'),'text':_0x26eaf0['body']}};var _0x261cba={'method':_0xd5ca('0x39'),'uri':_0x46e8c5,'headers':{'Authorization':_0xd5ca('0x3a')+_0x5f5d5c,'Content-Type':'application/json'},'body':_0x231c09,'json':!![]};rp(_0x261cba)[_0xd5ca('0x1b')](function(_0x3eb080){if(_0x3eb080[_0xd5ca('0x3b')][0x0][_0xd5ca('0x3c')]){return _0x5a3ae4[_0xd5ca('0x1c')]({'messageId':_0x3eb080[_0xd5ca('0x3b')][0x0][_0xd5ca('0x3c')]});}})[_0xd5ca('0x1e')](function(_0x4e67a1){logger[_0xd5ca('0x3d')](_0xd5ca('0x3e'),_0x4e67a1);});break;}}})[_0xd5ca('0x3f')](function(){_0x5c8a51();});}else{_0x5c8a51();}}},'charset':'utf8mb4','collate':_0xd5ca('0x40')});}; \ No newline at end of file +var _0xd50e=['update','error','WhatsappAccountId','then','type','twilio','authToken','phone','accountSid','messages','remote','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','text','Bearer\x20','statuses','message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','WhatsappInteraction','findOne','WhatsappInteractionId'];(function(_0x186872,_0x50a406){var _0x2f440d=function(_0x41691d){while(--_0x41691d){_0x186872['push'](_0x186872['shift']());}};_0x2f440d(++_0x50a406);}(_0xd50e,0x13c));var _0xed50=function(_0x102ad8,_0x252128){_0x102ad8=_0x102ad8-0x0;var _0x501846=_0xd50e[_0x102ad8];return _0x501846;};'use strict';var _=require(_0xed50('0x0'));var util=require(_0xed50('0x1'));var logger=require('../../config/logger')(_0xed50('0x2'));var moment=require(_0xed50('0x3'));var BPromise=require(_0xed50('0x4'));var rp=require(_0xed50('0x5'));var fetch=require(_0xed50('0x6'));var fs=require('fs');var path=require(_0xed50('0x7'));var rimraf=require(_0xed50('0x8'));var config=require(_0xed50('0x9'));var attributes=require(_0xed50('0xa'));module['exports']=function(_0x2bf6e9,_0x2dd58d){return _0x2bf6e9[_0xed50('0xb')](_0xed50('0xc'),attributes,{'tableName':_0xed50('0xd'),'paranoid':![],'indexes':[{'name':_0xed50('0xe'),'fields':[_0xed50('0xe')]},{'name':_0xed50('0xf'),'fields':[_0xed50('0x10')],'type':_0xed50('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x136d74,_0x442af8,_0x36a1d7){var _0x37e7d7=_0x2bf6e9[_0xed50('0x12')];var _0x2d5a82=_0x136d74['get']({'plain':!![]});if(_0x2d5a82[_0xed50('0x13')][_0xed50('0x14')]()==='in'||_0x2d5a82[_0xed50('0x13')][_0xed50('0x14')]()===_0xed50('0x15')&&!_0x2d5a82[_0xed50('0x16')]&&!_['isNil'](_0x2d5a82['UserId'])){_0x37e7d7[_0xed50('0x17')][_0xed50('0x18')]({'where':{'id':_0x2d5a82[_0xed50('0x19')]}})['then'](function(_0x15e1b9){if(_0x15e1b9){_0x15e1b9[_0xed50('0x1a')]({'lastMsgAt':_0x2d5a82['createdAt'],'lastMsgDirection':_0x2d5a82['direction']['toLowerCase']()});}})['catch'](function(_0x35d596){console[_0xed50('0x1b')](_0x35d596);});}if(_0x2d5a82[_0xed50('0x13')]===_0xed50('0x15')&&!_0x2d5a82[_0xed50('0x16')]){var _0x976c1;_0x37e7d7['WhatsappAccount']['find']({'where':{'id':_0x2d5a82[_0xed50('0x1c')]},'raw':!![]})[_0xed50('0x1d')](function(_0xfa8d6a){_0x976c1=_0xfa8d6a;if(_0x976c1&&_0x976c1[_0xed50('0x1e')]){switch(_0x976c1['type']){case _0xed50('0x1f'):var _0x2eef1e=require(_0xed50('0x1f'));if(_0x976c1['accountSid']&&_0x976c1[_0xed50('0x20')]&&_0x976c1[_0xed50('0x21')]){var _0x423e82=new _0x2eef1e(_0x976c1[_0xed50('0x22')],_0x976c1[_0xed50('0x20')]);_0x423e82[_0xed50('0x23')]['create']({'body':_0x2d5a82['body'],'to':'whatsapp:'+_0x2d5a82[_0xed50('0x21')],'from':'whatsapp:'+_0x976c1[_0xed50('0x21')],'statusCallback':_0x976c1[_0xed50('0x24')]+'/api/whatsapp/messages/'+_0x2d5a82['id']+_0xed50('0x25')+_0x976c1[_0xed50('0x26')]})[_0xed50('0x1d')](function(_0x4fe1a6){if(_0x4fe1a6[_0xed50('0x27')]){return _0x136d74[_0xed50('0x1a')]({'messageId':_0x4fe1a6['sid']});}})[_0xed50('0x28')](function(_0x535b74){logger[_0xed50('0x1b')](_0xed50('0x29'),_0xed50('0x2a'),_0xed50('0x1f'),util[_0xed50('0x2b')](_0x535b74,{'showHidden':![],'depth':null}));});}else{logger[_0xed50('0x1b')](_0xed50('0x29'),_0xed50('0x2a'),_0xed50('0x1f'),_0xed50('0x2c'));}break;case _0xed50('0x2d'):var _0xf13924=_0x976c1['accountSid'];var _0x59c564=_0x976c1['authToken'];var _0x4796c1=_0x976c1[_0xed50('0x2e')]+_0xed50('0x2f')+_0xf13924+'/messages/';var _0x585011={'to':[_0x2d5a82[_0xed50('0x21')]],'message':{'type':_0xed50('0x30'),'text':_0x2d5a82[_0xed50('0x10')]}};var _0x224c1a={'method':'POST','uri':_0x4796c1,'headers':{'Authorization':_0xed50('0x31')+_0x59c564,'Content-Type':'application/json'},'body':_0x585011,'json':!![]};rp(_0x224c1a)[_0xed50('0x1d')](function(_0x265375){if(_0x265375[_0xed50('0x32')][0x0]['message_id']){return _0x136d74['update']({'messageId':_0x265375[_0xed50('0x32')][0x0][_0xed50('0x33')]});}})[_0xed50('0x28')](function(_0x1f9980){logger[_0xed50('0x34')](_0xed50('0x35'),_0x1f9980);});break;}}})[_0xed50('0x36')](function(){_0x36a1d7();});}else{_0x36a1d7();}}},'charset':_0xed50('0x37'),'collate':_0xed50('0x38')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index de5686b..b8560e7 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 _0x5a7a=['register','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','CreateWhatsappMessage','create','options','raw','stringify','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0x2a1fa6,_0x2772a9){var _0x45d07b=function(_0x42e442){while(--_0x42e442){_0x2a1fa6['push'](_0x2a1fa6['shift']());}};_0x45d07b(++_0x2772a9);}(_0x5a7a,0x109));var _0xa5a7=function(_0x4f5557,_0xde8b4f){_0x4f5557=_0x4f5557-0x0;var _0x352055=_0x5a7a[_0x4f5557];return _0x352055;};'use strict';var _=require(_0xa5a7('0x0'));var util=require(_0xa5a7('0x1'));var moment=require('moment');var BPromise=require(_0xa5a7('0x2'));var rs=require(_0xa5a7('0x3'));var fs=require('fs');var Redis=require(_0xa5a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5a7('0x5'));var logger=require(_0xa5a7('0x6'))('rpc');var config=require(_0xa5a7('0x7'));var jayson=require(_0xa5a7('0x8'));var client=jayson[_0xa5a7('0x9')]['http']({'port':0x232a});config[_0xa5a7('0xa')]=_['defaults'](config[_0xa5a7('0xa')],{'host':_0xa5a7('0xb'),'port':0x18eb});var socket=require(_0xa5a7('0xc'))(new Redis(config['redis']));require(_0xa5a7('0xd'))[_0xa5a7('0xe')](socket);function respondWithRpcPromise(_0xb837fd,_0x1797fe,_0x29772f){return new BPromise(function(_0x412364,_0x3b886d){return client[_0xa5a7('0xf')](_0xb837fd,_0x29772f)[_0xa5a7('0x10')](function(_0x447c2d){logger[_0xa5a7('0x11')](_0xa5a7('0x12'),_0x1797fe,'request\x20sent');logger[_0xa5a7('0x13')](_0xa5a7('0x14'),_0x1797fe,'request\x20sent',JSON['stringify'](_0x447c2d));if(_0x447c2d['error']){if(_0x447c2d[_0xa5a7('0x15')][_0xa5a7('0x16')]===0x1f4){logger[_0xa5a7('0x15')](_0xa5a7('0x12'),_0x1797fe,_0x447c2d['error']['message']);return _0x3b886d(_0x447c2d['error'][_0xa5a7('0x17')]);}logger[_0xa5a7('0x15')](_0xa5a7('0x12'),_0x1797fe,_0x447c2d['error'][_0xa5a7('0x17')]);return _0x412364(_0x447c2d[_0xa5a7('0x15')][_0xa5a7('0x17')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x1797fe,_0xa5a7('0x18'));_0x412364(_0x447c2d['result']['message']);}})[_0xa5a7('0x19')](function(_0x224421){logger[_0xa5a7('0x15')](_0xa5a7('0x12'),_0x1797fe,_0x224421);_0x3b886d(_0x224421);});});}exports[_0xa5a7('0x1a')]=function(_0xe641b4){var _0x296317=this;return new Promise(function(_0x8a88cc,_0x4dcfd6){return db['WhatsappMessage'][_0xa5a7('0x1b')](_0xe641b4['body'],{'raw':_0xe641b4['options']?_0xe641b4[_0xa5a7('0x1c')][_0xa5a7('0x1d')]===undefined?!![]:![]:!![]})[_0xa5a7('0x10')](function(_0x4e7a11){logger[_0xa5a7('0x11')]('CreateWhatsappMessage',_0xe641b4);logger['debug'](_0xa5a7('0x1a'),_0xe641b4,JSON[_0xa5a7('0x1e')](_0x4e7a11));_0x8a88cc(_0x4e7a11);})[_0xa5a7('0x19')](function(_0x638e58){logger[_0xa5a7('0x15')](_0xa5a7('0x1a'),_0x638e58[_0xa5a7('0x17')],_0xe641b4);_0x4dcfd6(_0x296317['error'](0x1f4,_0x638e58['message']));});});}; \ No newline at end of file +var _0x30fc=['register','then','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','WhatsappMessage,\x20%s,\x20%s','CreateWhatsappMessage','WhatsappMessage','create','body','options','debug','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket'];(function(_0xbe66c9,_0x25a32d){var _0x113418=function(_0x3f50c1){while(--_0x3f50c1){_0xbe66c9['push'](_0xbe66c9['shift']());}};_0x113418(++_0x25a32d);}(_0x30fc,0x108));var _0xc30f=function(_0x3e8b89,_0x167445){_0x3e8b89=_0x3e8b89-0x0;var _0xdb5cac=_0x30fc[_0x3e8b89];return _0xdb5cac;};'use strict';var _=require(_0xc30f('0x0'));var util=require(_0xc30f('0x1'));var moment=require(_0xc30f('0x2'));var BPromise=require(_0xc30f('0x3'));var rs=require(_0xc30f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc30f('0x5'));var logger=require('../../config/logger')(_0xc30f('0x6'));var config=require(_0xc30f('0x7'));var jayson=require(_0xc30f('0x8'));var client=jayson[_0xc30f('0x9')][_0xc30f('0xa')]({'port':0x232a});config[_0xc30f('0xb')]=_['defaults'](config[_0xc30f('0xb')],{'host':_0xc30f('0xc'),'port':0x18eb});var socket=require(_0xc30f('0xd'))(new Redis(config['redis']));require(_0xc30f('0xe'))[_0xc30f('0xf')](socket);function respondWithRpcPromise(_0x1bf08d,_0x305714,_0x59a708){return new BPromise(function(_0x11ba65,_0x535121){return client['request'](_0x1bf08d,_0x59a708)[_0xc30f('0x10')](function(_0x464d69){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x305714,_0xc30f('0x11'));logger['debug'](_0xc30f('0x12'),_0x305714,_0xc30f('0x11'),JSON[_0xc30f('0x13')](_0x464d69));if(_0x464d69[_0xc30f('0x14')]){if(_0x464d69[_0xc30f('0x14')]['code']===0x1f4){logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x305714,_0x464d69['error'][_0xc30f('0x15')]);return _0x535121(_0x464d69['error'][_0xc30f('0x15')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x305714,_0x464d69[_0xc30f('0x14')][_0xc30f('0x15')]);return _0x11ba65(_0x464d69[_0xc30f('0x14')][_0xc30f('0x15')]);}else{logger[_0xc30f('0x16')](_0xc30f('0x17'),_0x305714,_0xc30f('0x11'));_0x11ba65(_0x464d69['result'][_0xc30f('0x15')]);}})['catch'](function(_0x90461a){logger[_0xc30f('0x14')](_0xc30f('0x17'),_0x305714,_0x90461a);_0x535121(_0x90461a);});});}exports[_0xc30f('0x18')]=function(_0x3c3fa1){var _0x59f8c4=this;return new Promise(function(_0x1a2036,_0x103ebe){return db[_0xc30f('0x19')][_0xc30f('0x1a')](_0x3c3fa1[_0xc30f('0x1b')],{'raw':_0x3c3fa1['options']?_0x3c3fa1[_0xc30f('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x158f2a){logger['info'](_0xc30f('0x18'),_0x3c3fa1);logger[_0xc30f('0x1d')](_0xc30f('0x18'),_0x3c3fa1,JSON[_0xc30f('0x13')](_0x158f2a));_0x1a2036(_0x158f2a);})[_0xc30f('0x1e')](function(_0xc2e60c){logger['error'](_0xc30f('0x18'),_0xc2e60c[_0xc30f('0x15')],_0x3c3fa1);_0x103ebe(_0x59f8c4[_0xc30f('0x14')](0x1f4,_0xc2e60c[_0xc30f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 14f9e36..e707e6b 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 _0x2fd4=['./whatsappMessage.events','save','remove','update','emit','register','length','whatsappMessage:'];(function(_0x49693f,_0x4d994f){var _0x1b0f6e=function(_0x4b2c16){while(--_0x4b2c16){_0x49693f['push'](_0x49693f['shift']());}};_0x1b0f6e(++_0x4d994f);}(_0x2fd4,0x78));var _0x42fd=function(_0x47e27c,_0x84b659){_0x47e27c=_0x47e27c-0x0;var _0x1a8635=_0x2fd4[_0x47e27c];return _0x1a8635;};'use strict';var WhatsappMessageEvents=require(_0x42fd('0x0'));var events=[_0x42fd('0x1'),_0x42fd('0x2'),_0x42fd('0x3')];function createListener(_0x1eb4e1,_0x2514ec){return function(_0x1a6e97){_0x2514ec[_0x42fd('0x4')](_0x1eb4e1,_0x1a6e97);};}function removeListener(_0x2e3992,_0x7aab9f){return function(){WhatsappMessageEvents['removeListener'](_0x2e3992,_0x7aab9f);};}exports[_0x42fd('0x5')]=function(_0x425f17){for(var _0x2c52fd=0x0,_0x32469d=events[_0x42fd('0x6')];_0x2c52fd<_0x32469d;_0x2c52fd++){var _0x55976a=events[_0x2c52fd];var _0x42918e=createListener(_0x42fd('0x7')+_0x55976a,_0x425f17);WhatsappMessageEvents['on'](_0x55976a,_0x42918e);}}; \ No newline at end of file +var _0xf92a=['emit','removeListener','register','length','whatsappMessage:','./whatsappMessage.events','remove','update'];(function(_0x5d225a,_0x2debe9){var _0x1e7761=function(_0x491dc2){while(--_0x491dc2){_0x5d225a['push'](_0x5d225a['shift']());}};_0x1e7761(++_0x2debe9);}(_0xf92a,0x10d));var _0xaf92=function(_0x3a9492,_0x480040){_0x3a9492=_0x3a9492-0x0;var _0x19ec65=_0xf92a[_0x3a9492];return _0x19ec65;};'use strict';var WhatsappMessageEvents=require(_0xaf92('0x0'));var events=['save',_0xaf92('0x1'),_0xaf92('0x2')];function createListener(_0x162a4e,_0x50ac14){return function(_0x168264){_0x50ac14[_0xaf92('0x3')](_0x162a4e,_0x168264);};}function removeListener(_0x1ffdb7,_0x5a845f){return function(){WhatsappMessageEvents[_0xaf92('0x4')](_0x1ffdb7,_0x5a845f);};}exports[_0xaf92('0x5')]=function(_0x442d86){for(var _0x232dd1=0x0,_0x27122a=events[_0xaf92('0x6')];_0x232dd1<_0x27122a;_0x232dd1++){var _0xfd894=events[_0x232dd1];var _0x2e4c59=createListener(_0xaf92('0x7')+_0xfd894,_0x442d86);WhatsappMessageEvents['on'](_0xfd894,_0x2e4c59);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7135cb5..10cde9f 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 _0x8475=['../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','destroy','delete','removeAgents','multer','util','path','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8475,0x64));var _0x5847=function(_0x1e1c91,_0x18aaf8){_0x1e1c91=_0x1e1c91-0x0;var _0x395517=_0x8475[_0x1e1c91];return _0x395517;};'use strict';var multer=require(_0x5847('0x0'));var util=require(_0x5847('0x1'));var path=require(_0x5847('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5847('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5847('0x4'));var interaction=require(_0x5847('0x5'));var config=require('../../config/environment');var controller=require(_0x5847('0x6'));router[_0x5847('0x7')]('/',auth[_0x5847('0x8')](),controller[_0x5847('0x9')]);router[_0x5847('0x7')](_0x5847('0xa'),auth[_0x5847('0x8')](),controller[_0x5847('0xb')]);router[_0x5847('0x7')](_0x5847('0xc'),auth[_0x5847('0x8')](),controller['show']);router[_0x5847('0x7')]('/:id/members',auth[_0x5847('0x8')](),controller[_0x5847('0xd')]);router[_0x5847('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5847('0xe')]);router['get'](_0x5847('0xf'),auth['isAuthenticated'](),controller[_0x5847('0x10')]);router[_0x5847('0x11')]('/',auth[_0x5847('0x8')](),controller[_0x5847('0x12')]);router[_0x5847('0x11')](_0x5847('0x13'),auth['isAuthenticated'](),controller[_0x5847('0x14')]);router[_0x5847('0x11')](_0x5847('0xf'),auth[_0x5847('0x8')](),controller[_0x5847('0x15')]);router['put'](_0x5847('0xc'),auth['isAuthenticated'](),controller[_0x5847('0x16')]);router['delete'](_0x5847('0xc'),auth[_0x5847('0x8')](),controller[_0x5847('0x17')]);router[_0x5847('0x18')]('/:id/teams',auth[_0x5847('0x8')](),controller['removeTeams']);router[_0x5847('0x18')](_0x5847('0xf'),auth[_0x5847('0x8')](),controller[_0x5847('0x19')]);module['exports']=router; \ No newline at end of file +var _0xd3df=['fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','getMembers','/:id/teams','/:id/users','getAgents','post','addTeams','put','update','destroy','delete','removeAgents','multer','util','path','connect-timeout','Router'];(function(_0x5014af,_0x4161ec){var _0x126d19=function(_0x5730d3){while(--_0x5730d3){_0x5014af['push'](_0x5014af['shift']());}};_0x126d19(++_0x4161ec);}(_0xd3df,0x1ab));var _0xfd3d=function(_0x24ef98,_0x1219e3){_0x24ef98=_0x24ef98-0x0;var _0x2c8ef2=_0xd3df[_0x24ef98];return _0x2c8ef2;};'use strict';var multer=require(_0xfd3d('0x0'));var util=require(_0xfd3d('0x1'));var path=require(_0xfd3d('0x2'));var timeout=require(_0xfd3d('0x3'));var express=require('express');var router=express[_0xfd3d('0x4')]();var fs_extra=require(_0xfd3d('0x5'));var auth=require(_0xfd3d('0x6'));var interaction=require(_0xfd3d('0x7'));var config=require('../../config/environment');var controller=require(_0xfd3d('0x8'));router[_0xfd3d('0x9')]('/',auth[_0xfd3d('0xa')](),controller['index']);router[_0xfd3d('0x9')](_0xfd3d('0xb'),auth[_0xfd3d('0xa')](),controller['describe']);router[_0xfd3d('0x9')](_0xfd3d('0xc'),auth[_0xfd3d('0xa')](),controller['show']);router[_0xfd3d('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xfd3d('0xd')]);router['get'](_0xfd3d('0xe'),auth[_0xfd3d('0xa')](),controller['getTeams']);router[_0xfd3d('0x9')](_0xfd3d('0xf'),auth[_0xfd3d('0xa')](),controller[_0xfd3d('0x10')]);router[_0xfd3d('0x11')]('/',auth[_0xfd3d('0xa')](),controller['create']);router[_0xfd3d('0x11')](_0xfd3d('0xe'),auth[_0xfd3d('0xa')](),controller[_0xfd3d('0x12')]);router[_0xfd3d('0x11')](_0xfd3d('0xf'),auth[_0xfd3d('0xa')](),controller['addAgents']);router[_0xfd3d('0x13')](_0xfd3d('0xc'),auth[_0xfd3d('0xa')](),controller[_0xfd3d('0x14')]);router['delete'](_0xfd3d('0xc'),auth[_0xfd3d('0xa')](),controller[_0xfd3d('0x15')]);router[_0xfd3d('0x16')](_0xfd3d('0xe'),auth['isAuthenticated'](),controller['removeTeams']);router['delete'](_0xfd3d('0xf'),auth['isAuthenticated'](),controller[_0xfd3d('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index df87aab..642339a 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 _0x9086=['rrmemory','beepall','roundrobin','sequelize','exports','name','INTEGER','ENUM'];(function(_0x172659,_0x2d706b){var _0x23a612=function(_0x4b0e0c){while(--_0x4b0e0c){_0x172659['push'](_0x172659['shift']());}};_0x23a612(++_0x2d706b);}(_0x9086,0x10b));var _0x6908=function(_0x42f6d1,_0x52c740){_0x42f6d1=_0x42f6d1-0x0;var _0x50ae08=_0x9086[_0x42f6d1];return _0x50ae08;};'use strict';var Sequelize=require(_0x6908('0x0'));module[_0x6908('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x6908('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6908('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6908('0x4')](_0x6908('0x5'),_0x6908('0x6'),_0x6908('0x7'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe9ad=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x35ab0a,_0x2aef73){var _0x154798=function(_0x32b89f){while(--_0x32b89f){_0x35ab0a['push'](_0x35ab0a['shift']());}};_0x154798(++_0x2aef73);}(_0xe9ad,0x82));var _0xde9a=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0xe9ad[_0x5805d7];return _0x170fe4;};'use strict';var Sequelize=require(_0xde9a('0x0'));module[_0xde9a('0x1')]={'name':{'type':Sequelize[_0xde9a('0x2')],'unique':_0xde9a('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xde9a('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xde9a('0x5')](_0xde9a('0x6'),'beepall',_0xde9a('0x7'))},'description':{'type':Sequelize[_0xde9a('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index ecac384..71304aa 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 _0x108d=['spread','userWhatsappQueue:save','removeAgents','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','status','end','json','offset','undefined','limit','count','set','Content-Range','then','WhatsappQueues','UserProfileResource','destroy','sendStatus','error','name','index','map','key','getOptions','where','WhatsappQueue','include','query','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','describe','get','hasOwnProperty','sort','pick','WhatsappQueueId','filter','UserWhatsappQueue','findAll','User','UserId','whatsappPause','createdAt','%s/%s','SIP','updatedAt','getTeams','findOne','Team','order','nolimit','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','emit','userWhatsappQueue:remove','addAgents','omit'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x108d,0x175));var _0xd108=function(_0x65d6d0,_0x57bc76){_0x65d6d0=_0x65d6d0-0x0;var _0x315e6f=_0x108d[_0x65d6d0];return _0x315e6f;};'use strict';var BPromise=require(_0xd108('0x0'));var util=require(_0xd108('0x1'));var _=require(_0xd108('0x2'));var squel=require(_0xd108('0x3'));var Redis=require(_0xd108('0x4'));var qs=require(_0xd108('0x5'));var logger=require(_0xd108('0x6'))(_0xd108('0x7'));var config=require(_0xd108('0x8'));var db=require(_0xd108('0x9'))['db'];config[_0xd108('0xa')]=_[_0xd108('0xb')](config[_0xd108('0xa')],{'host':_0xd108('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd108('0xa')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x1081fa,_0x4e7356){_0x4e7356=_0x4e7356||0xcc;return function(_0x398ae8){if(_0x398ae8){return _0x1081fa['sendStatus'](_0x4e7356);}return _0x1081fa[_0xd108('0xd')](_0x4e7356)[_0xd108('0xe')]();};}function respondWithResult(_0x236913,_0x17dcb0){_0x17dcb0=_0x17dcb0||0xc8;return function(_0x2aaa96){if(_0x2aaa96){return _0x236913[_0xd108('0xd')](_0x17dcb0)[_0xd108('0xf')](_0x2aaa96);}};}function respondWithFilteredResult(_0x53704e,_0x55df63){return function(_0x4529e5){if(_0x4529e5){var _0x212243=typeof _0x55df63[_0xd108('0x10')]===_0xd108('0x11')&&typeof _0x55df63[_0xd108('0x12')]==='undefined';var _0x2f06b7=_0x4529e5[_0xd108('0x13')];var _0x1a0a95=_0x212243?0x0:_0x55df63[_0xd108('0x10')];var _0x4abbd1=_0x212243?_0x4529e5['count']:_0x55df63[_0xd108('0x10')]+_0x55df63[_0xd108('0x12')];var _0x585191;if(_0x4abbd1>=_0x2f06b7){_0x4abbd1=_0x2f06b7;_0x585191=0xc8;}else{_0x585191=0xce;}_0x53704e[_0xd108('0xd')](_0x585191);return _0x53704e[_0xd108('0x14')](_0xd108('0x15'),_0x1a0a95+'-'+_0x4abbd1+'/'+_0x2f06b7)[_0xd108('0xf')](_0x4529e5);}return null;};}function saveUpdates(_0x2c06f9){return function(_0x271106){if(_0x271106){return _0x271106['update'](_0x2c06f9)[_0xd108('0x16')](function(_0x2a7124){return _0x2a7124;});}return null;};}function removeEntity(_0x38636b){return function(_0x3d2eeb){if(_0x3d2eeb){return _0x3d2eeb['destroy']()['then'](function(){var _0x4882c0=_0x3d2eeb['get']({'plain':!![]});var _0x3da96b=_0xd108('0x17');return db[_0xd108('0x18')][_0xd108('0x19')]({'where':{'type':_0x3da96b,'resourceId':_0x4882c0['id']}})[_0xd108('0x16')](function(){return _0x3d2eeb;});})[_0xd108('0x16')](function(){_0x38636b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xec8aed){return function(_0x2f916c){if(!_0x2f916c){_0xec8aed[_0xd108('0x1a')](0x194);}return _0x2f916c;};}function handleError(_0x20a9be,_0x3cd1fb){_0x3cd1fb=_0x3cd1fb||0x1f4;return function(_0x367ca9){logger[_0xd108('0x1b')](_0x367ca9['stack']);if(_0x367ca9[_0xd108('0x1c')]){delete _0x367ca9[_0xd108('0x1c')];}_0x20a9be['status'](_0x3cd1fb)['send'](_0x367ca9);};}exports[_0xd108('0x1d')]=function(_0xe20bb3,_0x1b3255){var _0x5a0cf6={};var _0x38704a={'count':0x0,'rows':[]};var _0x234e3b=_[_0xd108('0x1e')](db['WhatsappQueue']['rawAttributes'],function(_0x2947d8){return{'name':_0x2947d8['fieldName'],'type':_0x2947d8['type'][_0xd108('0x1f')]};});_0x5a0cf6=qs[_0xd108('0x20')](_0x234e3b,_0xe20bb3);var _0x5067c3={'where':_0x5a0cf6[_0xd108('0x21')]};return db[_0xd108('0x22')][_0xd108('0x13')](_0x5067c3)[_0xd108('0x16')](function(_0x6470be){_0x38704a['count']=_0x6470be;_0x5a0cf6[_0xd108('0x23')]=qs['include'](_0xe20bb3[_0xd108('0x24')]);return db[_0xd108('0x22')]['findAll'](_0x5a0cf6);})[_0xd108('0x16')](function(_0x542706){_0x38704a[_0xd108('0x25')]=_0x542706;return _0x38704a;})[_0xd108('0x16')](respondWithFilteredResult(_0x1b3255,_0x5a0cf6))[_0xd108('0x26')](handleError(_0x1b3255,null));};exports[_0xd108('0x27')]=function(_0x448a6d,_0x2cb740){var _0x2b4667={'raw':!![],'where':{'id':_0x448a6d[_0xd108('0x28')]['id']}},_0x4424d0={};_0x4424d0[_0xd108('0x29')]=_[_0xd108('0x2a')](db['WhatsappQueue'][_0xd108('0x2b')]);_0x4424d0['query']=_[_0xd108('0x2a')](_0x448a6d[_0xd108('0x24')]);_0x4424d0[_0xd108('0x2c')]=_[_0xd108('0x2d')](_0x4424d0['model'],_0x4424d0[_0xd108('0x24')]);_0x2b4667[_0xd108('0x2e')]=_[_0xd108('0x2d')](_0x4424d0['model'],qs[_0xd108('0x2f')](_0x448a6d[_0xd108('0x24')][_0xd108('0x2f')]));_0x2b4667[_0xd108('0x2e')]=_0x2b4667['attributes'][_0xd108('0x30')]?_0x2b4667['attributes']:_0x4424d0[_0xd108('0x29')];if(_0x448a6d['query'][_0xd108('0x31')]){_0x2b4667['include']=[{'all':!![]}];}_0x2b4667=_[_0xd108('0x32')]({},_0x2b4667,_0x448a6d[_0xd108('0x33')]);return db['WhatsappQueue'][_0xd108('0x34')](_0x2b4667)['then'](handleEntityNotFound(_0x2cb740,null))[_0xd108('0x16')](respondWithResult(_0x2cb740,null))[_0xd108('0x26')](handleError(_0x2cb740,null));};exports[_0xd108('0x35')]=function(_0x1944b0,_0xb5ac0b){return db[_0xd108('0x22')]['create'](_0x1944b0[_0xd108('0x36')],{})[_0xd108('0x16')](function(_0x1d094e){var _0x4b7cc8=_0x1944b0[_0xd108('0x37')]['get']({'plain':!![]});if(!_0x4b7cc8)throw new Error(_0xd108('0x38'));if(_0x4b7cc8['role']===_0xd108('0x37')){var _0x4fa135=_0x1d094e['get']({'plain':!![]});var _0x177c19='WhatsappQueues';return db[_0xd108('0x39')][_0xd108('0x34')]({'where':{'name':_0x177c19,'userProfileId':_0x4b7cc8[_0xd108('0x3a')]},'raw':!![]})[_0xd108('0x16')](function(_0x55f199){if(_0x55f199&&_0x55f199[_0xd108('0x3b')]===0x0){return db[_0xd108('0x18')][_0xd108('0x35')]({'name':_0x4fa135['name'],'resourceId':_0x4fa135['id'],'type':_0x55f199[_0xd108('0x1c')],'sectionId':_0x55f199['id']},{})[_0xd108('0x16')](function(){return _0x1d094e;});}else{return _0x1d094e;}})['catch'](function(_0x553c21){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x553c21);throw _0x553c21;});}return _0x1d094e;})['then'](respondWithResult(_0xb5ac0b,0xc9))[_0xd108('0x26')](handleError(_0xb5ac0b,null));};exports[_0xd108('0x3c')]=function(_0x49b30b,_0x1ab2c0){if(_0x49b30b['body']['id']){delete _0x49b30b[_0xd108('0x36')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x49b30b[_0xd108('0x28')]['id']}})['then'](handleEntityNotFound(_0x1ab2c0,null))[_0xd108('0x16')](saveUpdates(_0x49b30b[_0xd108('0x36')],null))[_0xd108('0x16')](respondWithResult(_0x1ab2c0,null))[_0xd108('0x26')](handleError(_0x1ab2c0,null));};exports['destroy']=function(_0x2db5d6,_0xd3bf6d){return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x2db5d6[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0xd3bf6d,null))[_0xd108('0x16')](removeEntity(_0xd3bf6d,null))['catch'](handleError(_0xd3bf6d,null));};exports[_0xd108('0x3d')]=function(_0x3f9415,_0x55f413){return db[_0xd108('0x22')][_0xd108('0x3d')]()[_0xd108('0x16')](respondWithResult(_0x55f413,null))[_0xd108('0x26')](handleError(_0x55f413,null));};exports['getMembers']=function(_0x3f1d5f,_0x41196f){var _0x56b4cd={'raw':!![],'where':{}},_0x3fbf33={},_0x3e455c;return db[_0xd108('0x22')]['findOne']({'where':{'id':_0x3f1d5f[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x41196f,null))[_0xd108('0x16')](function(_0x4f5209){if(_0x4f5209){_0x3e455c=_0x4f5209[_0xd108('0x3e')]({'plain':!![]});_0x3fbf33[_0xd108('0x29')]=_['keys'](db['UserWhatsappQueue'][_0xd108('0x2b')]);_0x3fbf33[_0xd108('0x24')]=_[_0xd108('0x2a')](_0x3f1d5f['query']);_0x3fbf33[_0xd108('0x2c')]=_['intersection'](_0x3fbf33[_0xd108('0x29')],_0x3fbf33[_0xd108('0x24')]);_0x56b4cd['attributes']=_[_0xd108('0x2d')](_0x3fbf33[_0xd108('0x29')],qs[_0xd108('0x2f')](_0x3f1d5f[_0xd108('0x24')][_0xd108('0x2f')]));_0x56b4cd[_0xd108('0x2e')]=_0x56b4cd[_0xd108('0x2e')][_0xd108('0x30')]?_0x56b4cd['attributes']:_0x3fbf33[_0xd108('0x29')];if(!_0x3f1d5f[_0xd108('0x24')][_0xd108('0x3f')]('nolimit')){_0x56b4cd[_0xd108('0x12')]=qs['limit'](_0x3f1d5f[_0xd108('0x24')][_0xd108('0x12')]);_0x56b4cd[_0xd108('0x10')]=qs['offset'](_0x3f1d5f[_0xd108('0x24')]['offset']);}_0x56b4cd['order']=qs[_0xd108('0x40')](_0x3f1d5f[_0xd108('0x24')][_0xd108('0x40')]);_0x56b4cd[_0xd108('0x21')]=qs[_0xd108('0x2c')](_[_0xd108('0x41')](_0x3f1d5f[_0xd108('0x24')],_0x3fbf33['filters']));_0x56b4cd['where'][_0xd108('0x42')]=_0x4f5209['id'];if(_0x3f1d5f['query'][_0xd108('0x43')]){_0x56b4cd[_0xd108('0x21')]=_['merge'](_0x56b4cd[_0xd108('0x21')],{'$or':_[_0xd108('0x1e')](_0x56b4cd[_0xd108('0x2e')],function(_0x436485){var _0x5bbb63={};_0x5bbb63[_0x436485]={'$like':'%'+_0x3f1d5f[_0xd108('0x24')]['filter']+'%'};return _0x5bbb63;})});}_0x56b4cd=_[_0xd108('0x32')]({},_0x56b4cd,_0x3f1d5f[_0xd108('0x33')]);return db[_0xd108('0x44')][_0xd108('0x45')](_0x56b4cd);}})[_0xd108('0x16')](function(_0x49e211){if(_0x49e211){return db[_0xd108('0x46')]['findAndCountAll']({'where':{'id':_[_0xd108('0x1e')](_0x49e211,_0xd108('0x47')),'role':'agent'},'attributes':['id',_0xd108('0x1c'),_0xd108('0x48'),'updatedAt',_0xd108('0x49')]});}})[_0xd108('0x16')](function(_0x54bfaf){if(_0x54bfaf){return{'count':_0x54bfaf[_0xd108('0x13')],'rows':_[_0xd108('0x1e')](_0x54bfaf[_0xd108('0x25')],function(_0x596168){return{'membername':_0x596168[_0xd108('0x1c')],'UserId':_0x596168['id'],'queue_name':_0x3e455c[_0xd108('0x1c')],'WhatsappQueueId':_0x3e455c['id'],'interface':util['format'](_0xd108('0x4a'),_0xd108('0x4b'),_0x596168['name']),'penalty':0x0,'paused':_0x596168[_0xd108('0x48')],'createdAt':_0x596168[_0xd108('0x49')],'updatedAt':_0x596168[_0xd108('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x41196f,_0x56b4cd))[_0xd108('0x26')](handleError(_0x41196f,null));};exports[_0xd108('0x4d')]=function(_0x2cf980,_0xb5e968){var _0x4f5f78={};var _0x63016f={};var _0x31a2e9;var _0x4abb51;return db['WhatsappQueue'][_0xd108('0x4e')]({'where':{'id':_0x2cf980[_0xd108('0x28')]['id']}})['then'](handleEntityNotFound(_0xb5e968,null))[_0xd108('0x16')](function(_0x643eaf){if(_0x643eaf){_0x31a2e9=_0x643eaf;_0x63016f[_0xd108('0x29')]=_[_0xd108('0x2a')](db[_0xd108('0x4f')][_0xd108('0x2b')]);_0x63016f['query']=_[_0xd108('0x2a')](_0x2cf980[_0xd108('0x24')]);_0x63016f[_0xd108('0x2c')]=_['intersection'](_0x63016f[_0xd108('0x29')],_0x63016f['query']);_0x4f5f78[_0xd108('0x2e')]=_[_0xd108('0x2d')](_0x63016f[_0xd108('0x29')],qs[_0xd108('0x2f')](_0x2cf980[_0xd108('0x24')]['fields']));_0x4f5f78[_0xd108('0x2e')]=_0x4f5f78['attributes'][_0xd108('0x30')]?_0x4f5f78['attributes']:_0x63016f['model'];_0x4f5f78[_0xd108('0x50')]=qs['sort'](_0x2cf980['query'][_0xd108('0x40')]);_0x4f5f78['where']=qs[_0xd108('0x2c')](_[_0xd108('0x41')](_0x2cf980[_0xd108('0x24')],_0x63016f[_0xd108('0x2c')]));if(_0x2cf980[_0xd108('0x24')][_0xd108('0x43')]){_0x4f5f78[_0xd108('0x21')]=_[_0xd108('0x32')](_0x4f5f78[_0xd108('0x21')],{'$or':_['map'](_0x4f5f78[_0xd108('0x2e')],function(_0x33c150){var _0x342d96={};_0x342d96[_0x33c150]={'$like':'%'+_0x2cf980['query'][_0xd108('0x43')]+'%'};return _0x342d96;})});}_0x4f5f78=_[_0xd108('0x32')]({},_0x4f5f78,_0x2cf980['options']);return _0x31a2e9[_0xd108('0x4d')](_0x4f5f78);}})[_0xd108('0x16')](function(_0xd4c0ec){if(_0xd4c0ec){_0x4abb51=_0xd4c0ec[_0xd108('0x30')];if(!_0x2cf980['query'][_0xd108('0x3f')](_0xd108('0x51'))){_0x4f5f78[_0xd108('0x12')]=qs[_0xd108('0x12')](_0x2cf980[_0xd108('0x24')][_0xd108('0x12')]);_0x4f5f78[_0xd108('0x10')]=qs['offset'](_0x2cf980[_0xd108('0x24')][_0xd108('0x10')]);}return _0x31a2e9['getTeams'](_0x4f5f78);}})[_0xd108('0x16')](function(_0x1a6252){if(_0x1a6252){return _0x1a6252?{'count':_0x4abb51,'rows':_0x1a6252}:null;}})[_0xd108('0x16')](respondWithResult(_0xb5e968,null))[_0xd108('0x26')](handleError(_0xb5e968,null));};exports[_0xd108('0x52')]=function(_0x4a0d80,_0x2837e8){var _0x755626=_0x4a0d80[_0xd108('0x36')][_0xd108('0x53')];return db[_0xd108('0x4f')][_0xd108('0x45')]({'where':{'id':_0x755626},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd108('0x54'),'attributes':['id',_0xd108('0x1c'),_0xd108('0x55'),_0xd108('0x56'),'interface'],'raw':!![]}]})[_0xd108('0x16')](function(_0x34d88a){if(_0x34d88a){var _0x222f28=_[_0xd108('0x57')](_0x34d88a,function(_0x2bbf55){var _0x3dcda4=_0x2bbf55[_0xd108('0x3e')]({'plain':!![]});return _0x3dcda4[_0xd108('0x54')];});return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x4a0d80[_0xd108('0x28')]['id']}})[_0xd108('0x16')](function(_0x1c328f){return db[_0xd108('0x58')]['transaction'](function(_0x4a759c){return _0x1c328f[_0xd108('0x52')](_0x755626,{'transaction':_0x4a759c})[_0xd108('0x16')](function(){return BPromise[_0xd108('0x59')](_0x222f28,function(_0xcc145f){return db[_0xd108('0x44')][_0xd108('0x5a')]({'where':{'UserId':_0xcc145f['id'],'WhatsappQueueId':_0x4a0d80[_0xd108('0x28')]['id']},'transaction':_0x4a759c});});})['then'](function(){_0x222f28[_0xd108('0x5b')](function(_0x5eb828){socket['emit']('userWhatsappQueue:save',{'UserId':_0x5eb828['id'],'WhatsappQueueId':_0x1c328f['id']});});});});});}})[_0xd108('0x16')](respondWithStatusCode(_0x2837e8,null))[_0xd108('0x26')](handleError(_0x2837e8,null));};exports[_0xd108('0x5c')]=function(_0x3938c5,_0x4d8705){return db[_0xd108('0x4f')][_0xd108('0x45')]({'where':{'id':_0x3938c5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xd108('0x46')],'as':_0xd108('0x54'),'attributes':['id'],'raw':!![]}]})[_0xd108('0x16')](handleEntityNotFound(_0x4d8705,null))[_0xd108('0x16')](function(_0x4969d1){var _0xd19c6d=_[_0xd108('0x1e')](_0x4969d1,'id');var _0x121234=[];var _0x19c987=[];var _0x548610=squel[_0xd108('0x5d')]();_0x548610[_0xd108('0x5e')](_0xd108('0x5f'))[_0xd108('0x60')](_0xd108('0x61'),'tq')[_0xd108('0x62')](_0xd108('0x63'),'ut',_0xd108('0x64'))[_0xd108('0x21')]('WhatsappQueueId\x20=\x20?',_0x3938c5[_0xd108('0x28')]['id']);for(var _0x2d97b2=0x0;_0x2d97b2<_0x4969d1[_0xd108('0x30')];_0x2d97b2+=0x1){let _0x176926=_0x4969d1[_0x2d97b2];for(var _0x2602dc=0x0;_0x2602dc<_0x176926[_0xd108('0x54')]['length'];_0x2602dc+=0x1){let _0x1f3267=_0x176926[_0xd108('0x54')][_0x2602dc];var _0xb17c53=_0x548610[_0xd108('0x65')]();_0xb17c53[_0xd108('0x21')](_0xd108('0x66'),_0x1f3267['id']);_0x19c987[_0xd108('0x67')](db[_0xd108('0x58')][_0xd108('0x24')](_0xb17c53[_0xd108('0x68')](),{'type':db[_0xd108('0x58')][_0xd108('0x69')][_0xd108('0x6a')]})['then'](function(_0x3bb40f){if(_0x3bb40f['length']===0x1){return _0x1f3267['id'];}else{var _0x5a6e1c=_[_0xd108('0x6b')](_[_0xd108('0x1e')](_0x3bb40f,_0xd108('0x6c')),function(_0x5f3ccd){return _[_0xd108('0x6d')](_0xd19c6d,_0x5f3ccd);});if(_0x5a6e1c){return _0x1f3267['id'];}}}));}}return BPromise[_0xd108('0x6e')](_0x19c987)[_0xd108('0x16')](function(_0x485573){_0x121234=_(_0x121234)[_0xd108('0x6f')](_0x485573)[_0xd108('0x70')]()[_0xd108('0x71')]();return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x3938c5[_0xd108('0x28')]['id']}})[_0xd108('0x16')](function(_0x336d13){return db[_0xd108('0x58')][_0xd108('0x72')](function(_0x365aa6){return _0x336d13['removeTeams'](_0x3938c5[_0xd108('0x24')][_0xd108('0x53')],{'transaction':_0x365aa6})[_0xd108('0x16')](function(){if(!_['isEmpty'](_0x121234)){return _0x336d13['removeAgents'](_0x121234,{'transaction':_0x365aa6});}})['then'](function(){_0x121234[_0xd108('0x5b')](function(_0xefb41f){socket[_0xd108('0x73')](_0xd108('0x74'),{'UserId':_0xefb41f,'WhatsappQueueId':_0x336d13['id']});});});});});});})[_0xd108('0x16')](respondWithStatusCode(_0x4d8705,null))[_0xd108('0x26')](handleError(_0x4d8705,null));};exports[_0xd108('0x75')]=function(_0x2c94c2,_0x232d2c){return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x2c94c2[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x232d2c,null))[_0xd108('0x16')](function(_0x22f9b7){if(_0x22f9b7){return _0x22f9b7[_0xd108('0x75')](_0x2c94c2['body']['ids'],_[_0xd108('0x76')](_0x2c94c2[_0xd108('0x36')],[_0xd108('0x53'),'id'])||{})[_0xd108('0x77')](function(_0x18a4f7){for(var _0x1d6e5a=0x0;_0x1d6e5a<_0x2c94c2[_0xd108('0x36')][_0xd108('0x53')]['length'];_0x1d6e5a+=0x1){socket[_0xd108('0x73')](_0xd108('0x78'),{'UserId':Number(_0x2c94c2[_0xd108('0x36')][_0xd108('0x53')][_0x1d6e5a]),'WhatsappQueueId':Number(_0x2c94c2['params']['id'])});}return _0x18a4f7;});}})[_0xd108('0x16')](respondWithResult(_0x232d2c,null))[_0xd108('0x26')](handleError(_0x232d2c,null));};exports[_0xd108('0x79')]=function(_0x689bfe,_0x19e3bb){return db[_0xd108('0x22')][_0xd108('0x34')]({'where':{'id':_0x689bfe[_0xd108('0x28')]['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x19e3bb,null))[_0xd108('0x16')](function(_0x518232){if(_0x518232){return _0x518232[_0xd108('0x79')](_0x689bfe[_0xd108('0x24')][_0xd108('0x53')])['then'](function(){if(_['isArray'](_0x689bfe['query'][_0xd108('0x53')])){for(var _0x2e313d=0x0;_0x2e313d<_0x689bfe['query'][_0xd108('0x53')][_0xd108('0x30')];_0x2e313d+=0x1){socket['emit'](_0xd108('0x74'),{'UserId':Number(_0x689bfe[_0xd108('0x24')]['ids'][_0x2e313d]),'WhatsappQueueId':Number(_0x689bfe[_0xd108('0x28')]['id'])});}}else{socket['emit'](_0xd108('0x74'),{'UserId':Number(_0x689bfe[_0xd108('0x24')][_0xd108('0x53')]),'WhatsappQueueId':Number(_0x689bfe[_0xd108('0x28')]['id'])});}});}})[_0xd108('0x16')](respondWithStatusCode(_0x19e3bb,null))['catch'](handleError(_0x19e3bb,null));};exports[_0xd108('0x7a')]=function(_0xe003ba,_0x4a3ba9){var _0x4361eb={};var _0x1bd84e={};var _0x12ba82;var _0x2d37ab;return db['WhatsappQueue'][_0xd108('0x4e')]({'where':{'id':_0xe003ba['params']['id']}})[_0xd108('0x16')](handleEntityNotFound(_0x4a3ba9,null))['then'](function(_0xc88780){if(_0xc88780){_0x12ba82=_0xc88780;_0x1bd84e[_0xd108('0x29')]=_['keys'](db[_0xd108('0x46')][_0xd108('0x2b')]);_0x1bd84e[_0xd108('0x24')]=_[_0xd108('0x2a')](_0xe003ba[_0xd108('0x24')]);_0x1bd84e[_0xd108('0x2c')]=_[_0xd108('0x2d')](_0x1bd84e['model'],_0x1bd84e[_0xd108('0x24')]);_0x4361eb[_0xd108('0x2e')]=_[_0xd108('0x2d')](_0x1bd84e[_0xd108('0x29')],qs[_0xd108('0x2f')](_0xe003ba['query']['fields']));_0x4361eb[_0xd108('0x2e')]=_0x4361eb[_0xd108('0x2e')][_0xd108('0x30')]?_0x4361eb[_0xd108('0x2e')]:_0x1bd84e['model'];_0x4361eb['order']=qs['sort'](_0xe003ba[_0xd108('0x24')][_0xd108('0x40')]);_0x4361eb[_0xd108('0x21')]=qs[_0xd108('0x2c')](_[_0xd108('0x41')](_0xe003ba[_0xd108('0x24')],_0x1bd84e[_0xd108('0x2c')]));if(_0xe003ba[_0xd108('0x24')][_0xd108('0x43')]){_0x4361eb['where']=_[_0xd108('0x32')](_0x4361eb[_0xd108('0x21')],{'$or':_[_0xd108('0x1e')](_0x4361eb['attributes'],function(_0x145de8){var _0x4663ca={};_0x4663ca[_0x145de8]={'$like':'%'+_0xe003ba['query']['filter']+'%'};return _0x4663ca;})});}_0x4361eb=_[_0xd108('0x32')]({},_0x4361eb,_0xe003ba['options']);return _0x12ba82[_0xd108('0x7a')](_0x4361eb);}})[_0xd108('0x16')](function(_0x3b5927){if(_0x3b5927){_0x2d37ab=_0x3b5927['length'];if(!_0xe003ba[_0xd108('0x24')][_0xd108('0x3f')](_0xd108('0x51'))){_0x4361eb[_0xd108('0x12')]=qs[_0xd108('0x12')](_0xe003ba['query'][_0xd108('0x12')]);_0x4361eb[_0xd108('0x10')]=qs[_0xd108('0x10')](_0xe003ba[_0xd108('0x24')]['offset']);}return _0x12ba82[_0xd108('0x7a')](_0x4361eb);}})[_0xd108('0x16')](function(_0x3faa8f){if(_0x3faa8f){return _0x3faa8f?{'count':_0x2d37ab,'rows':_0x3faa8f}:null;}})[_0xd108('0x16')](respondWithResult(_0x4a3ba9,null))[_0xd108('0x26')](handleError(_0x4a3ba9,null));}; \ No newline at end of file +var _0x89c4=['each','findOrCreate','forEach','userWhatsappQueue:save','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','includes','all','union','value','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','getAgents','bluebird','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','offset','limit','undefined','count','set','json','update','then','destroy','end','error','stack','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','getOptions','where','include','query','findAll','catch','show','params','keys','filters','intersection','model','fields','attributes','length','includeAll','merge','options','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','nolimit','order','sort','pick','filter','UserWhatsappQueue','findAndCountAll','UserId','agent','whatsappPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','hasOwnProperty','addTeams','ids','Team','User','Agents','interface','sequelize','transaction'];(function(_0x3765de,_0x586211){var _0x275b9d=function(_0x1a2c37){while(--_0x1a2c37){_0x3765de['push'](_0x3765de['shift']());}};_0x275b9d(++_0x586211);}(_0x89c4,0x103));var _0x489c=function(_0x466019,_0xa6ba59){_0x466019=_0x466019-0x0;var _0x157e17=_0x89c4[_0x466019];return _0x157e17;};'use strict';var BPromise=require(_0x489c('0x0'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0x489c('0x1'));var qs=require(_0x489c('0x2'));var logger=require(_0x489c('0x3'))(_0x489c('0x4'));var config=require('../../config/environment');var db=require(_0x489c('0x5'))['db'];config['redis']=_[_0x489c('0x6')](config[_0x489c('0x7')],{'host':_0x489c('0x8'),'port':0x18eb});var socket=require(_0x489c('0x9'))(new Redis(config[_0x489c('0x7')]));require(_0x489c('0xa'))[_0x489c('0xb')](socket);function respondWithStatusCode(_0x894b94,_0x47d3f5){_0x47d3f5=_0x47d3f5||0xcc;return function(_0x176b3c){if(_0x176b3c){return _0x894b94[_0x489c('0xc')](_0x47d3f5);}return _0x894b94[_0x489c('0xd')](_0x47d3f5)['end']();};}function respondWithResult(_0x2c269c,_0x1b479f){_0x1b479f=_0x1b479f||0xc8;return function(_0x379bd6){if(_0x379bd6){return _0x2c269c[_0x489c('0xd')](_0x1b479f)['json'](_0x379bd6);}};}function respondWithFilteredResult(_0x2f2ad4,_0x15f775){return function(_0x40bd70){if(_0x40bd70){var _0x493612=typeof _0x15f775[_0x489c('0xe')]==='undefined'&&typeof _0x15f775[_0x489c('0xf')]===_0x489c('0x10');var _0x333d19=_0x40bd70[_0x489c('0x11')];var _0x430da3=_0x493612?0x0:_0x15f775[_0x489c('0xe')];var _0x31cddd=_0x493612?_0x40bd70[_0x489c('0x11')]:_0x15f775[_0x489c('0xe')]+_0x15f775[_0x489c('0xf')];var _0x5d4340;if(_0x31cddd>=_0x333d19){_0x31cddd=_0x333d19;_0x5d4340=0xc8;}else{_0x5d4340=0xce;}_0x2f2ad4[_0x489c('0xd')](_0x5d4340);return _0x2f2ad4[_0x489c('0x12')]('Content-Range',_0x430da3+'-'+_0x31cddd+'/'+_0x333d19)[_0x489c('0x13')](_0x40bd70);}return null;};}function saveUpdates(_0x3ea9d5){return function(_0x1410c0){if(_0x1410c0){return _0x1410c0[_0x489c('0x14')](_0x3ea9d5)[_0x489c('0x15')](function(_0x50543a){return _0x50543a;});}return null;};}function removeEntity(_0xd012e5){return function(_0x1d161b){if(_0x1d161b){return _0x1d161b[_0x489c('0x16')]()[_0x489c('0x15')](function(){var _0x29ded7=_0x1d161b['get']({'plain':!![]});var _0x3579b9='WhatsappQueues';return db['UserProfileResource'][_0x489c('0x16')]({'where':{'type':_0x3579b9,'resourceId':_0x29ded7['id']}})[_0x489c('0x15')](function(){return _0x1d161b;});})[_0x489c('0x15')](function(){_0xd012e5[_0x489c('0xd')](0xcc)[_0x489c('0x17')]();});}};}function handleEntityNotFound(_0x473484){return function(_0x1211cf){if(!_0x1211cf){_0x473484['sendStatus'](0x194);}return _0x1211cf;};}function handleError(_0xe6f7d,_0x5f1a92){_0x5f1a92=_0x5f1a92||0x1f4;return function(_0x1678d1){logger[_0x489c('0x18')](_0x1678d1[_0x489c('0x19')]);if(_0x1678d1['name']){delete _0x1678d1[_0x489c('0x1a')];}_0xe6f7d[_0x489c('0xd')](_0x5f1a92)[_0x489c('0x1b')](_0x1678d1);};}exports[_0x489c('0x1c')]=function(_0x32ee31,_0x134484){var _0x7893ac={};var _0x215437={'count':0x0,'rows':[]};var _0x3e94d3=_[_0x489c('0x1d')](db[_0x489c('0x1e')][_0x489c('0x1f')],function(_0x538bf1){return{'name':_0x538bf1[_0x489c('0x20')],'type':_0x538bf1['type'][_0x489c('0x21')]};});_0x7893ac=qs[_0x489c('0x22')](_0x3e94d3,_0x32ee31);var _0x47986a={'where':_0x7893ac[_0x489c('0x23')]};return db[_0x489c('0x1e')][_0x489c('0x11')](_0x47986a)[_0x489c('0x15')](function(_0x232ed2){_0x215437[_0x489c('0x11')]=_0x232ed2;_0x7893ac[_0x489c('0x24')]=qs[_0x489c('0x24')](_0x32ee31[_0x489c('0x25')]);return db['WhatsappQueue'][_0x489c('0x26')](_0x7893ac);})[_0x489c('0x15')](function(_0x526162){_0x215437['rows']=_0x526162;return _0x215437;})['then'](respondWithFilteredResult(_0x134484,_0x7893ac))[_0x489c('0x27')](handleError(_0x134484,null));};exports[_0x489c('0x28')]=function(_0x288d23,_0x2937bd){var _0x2f036f={'raw':!![],'where':{'id':_0x288d23[_0x489c('0x29')]['id']}},_0x110209={};_0x110209['model']=_[_0x489c('0x2a')](db['WhatsappQueue'][_0x489c('0x1f')]);_0x110209[_0x489c('0x25')]=_[_0x489c('0x2a')](_0x288d23['query']);_0x110209[_0x489c('0x2b')]=_[_0x489c('0x2c')](_0x110209[_0x489c('0x2d')],_0x110209['query']);_0x2f036f['attributes']=_[_0x489c('0x2c')](_0x110209[_0x489c('0x2d')],qs[_0x489c('0x2e')](_0x288d23[_0x489c('0x25')][_0x489c('0x2e')]));_0x2f036f[_0x489c('0x2f')]=_0x2f036f[_0x489c('0x2f')][_0x489c('0x30')]?_0x2f036f[_0x489c('0x2f')]:_0x110209[_0x489c('0x2d')];if(_0x288d23[_0x489c('0x25')][_0x489c('0x31')]){_0x2f036f['include']=[{'all':!![]}];}_0x2f036f=_[_0x489c('0x32')]({},_0x2f036f,_0x288d23[_0x489c('0x33')]);return db[_0x489c('0x1e')][_0x489c('0x34')](_0x2f036f)[_0x489c('0x15')](handleEntityNotFound(_0x2937bd,null))[_0x489c('0x15')](respondWithResult(_0x2937bd,null))[_0x489c('0x27')](handleError(_0x2937bd,null));};exports[_0x489c('0x35')]=function(_0x5246c9,_0x2ed1f5){return db['WhatsappQueue']['create'](_0x5246c9['body'],{})[_0x489c('0x15')](function(_0x31e4e8){var _0x2d717e=_0x5246c9[_0x489c('0x36')][_0x489c('0x37')]({'plain':!![]});if(!_0x2d717e)throw new Error(_0x489c('0x38'));if(_0x2d717e[_0x489c('0x39')]==='user'){var _0x473017=_0x31e4e8[_0x489c('0x37')]({'plain':!![]});var _0x3ad25c='WhatsappQueues';return db[_0x489c('0x3a')][_0x489c('0x34')]({'where':{'name':_0x3ad25c,'userProfileId':_0x2d717e[_0x489c('0x3b')]},'raw':!![]})['then'](function(_0x1db12e){if(_0x1db12e&&_0x1db12e[_0x489c('0x3c')]===0x0){return db[_0x489c('0x3d')][_0x489c('0x35')]({'name':_0x473017[_0x489c('0x1a')],'resourceId':_0x473017['id'],'type':_0x1db12e[_0x489c('0x1a')],'sectionId':_0x1db12e['id']},{})[_0x489c('0x15')](function(){return _0x31e4e8;});}else{return _0x31e4e8;}})[_0x489c('0x27')](function(_0x2babf1){logger[_0x489c('0x18')](_0x489c('0x3e'),_0x2babf1);throw _0x2babf1;});}return _0x31e4e8;})[_0x489c('0x15')](respondWithResult(_0x2ed1f5,0xc9))[_0x489c('0x27')](handleError(_0x2ed1f5,null));};exports[_0x489c('0x14')]=function(_0x3b7ef8,_0x2ffe01){if(_0x3b7ef8[_0x489c('0x3f')]['id']){delete _0x3b7ef8['body']['id'];}return db[_0x489c('0x1e')][_0x489c('0x34')]({'where':{'id':_0x3b7ef8[_0x489c('0x29')]['id']}})[_0x489c('0x15')](handleEntityNotFound(_0x2ffe01,null))['then'](saveUpdates(_0x3b7ef8[_0x489c('0x3f')],null))[_0x489c('0x15')](respondWithResult(_0x2ffe01,null))[_0x489c('0x27')](handleError(_0x2ffe01,null));};exports[_0x489c('0x16')]=function(_0x2b5688,_0x562c8e){return db[_0x489c('0x1e')][_0x489c('0x34')]({'where':{'id':_0x2b5688[_0x489c('0x29')]['id']}})[_0x489c('0x15')](handleEntityNotFound(_0x562c8e,null))[_0x489c('0x15')](removeEntity(_0x562c8e,null))['catch'](handleError(_0x562c8e,null));};exports[_0x489c('0x40')]=function(_0x334716,_0x4a053a){return db[_0x489c('0x1e')]['describe']()[_0x489c('0x15')](respondWithResult(_0x4a053a,null))[_0x489c('0x27')](handleError(_0x4a053a,null));};exports[_0x489c('0x41')]=function(_0x85d001,_0x39e6d2){var _0x446538={'raw':!![],'where':{}},_0x380443={},_0x330450;return db[_0x489c('0x1e')][_0x489c('0x42')]({'where':{'id':_0x85d001['params']['id']}})[_0x489c('0x15')](handleEntityNotFound(_0x39e6d2,null))['then'](function(_0x21ba14){if(_0x21ba14){_0x330450=_0x21ba14[_0x489c('0x37')]({'plain':!![]});_0x380443[_0x489c('0x2d')]=_['keys'](db['UserWhatsappQueue'][_0x489c('0x1f')]);_0x380443['query']=_['keys'](_0x85d001[_0x489c('0x25')]);_0x380443[_0x489c('0x2b')]=_[_0x489c('0x2c')](_0x380443['model'],_0x380443[_0x489c('0x25')]);_0x446538[_0x489c('0x2f')]=_['intersection'](_0x380443['model'],qs[_0x489c('0x2e')](_0x85d001['query']['fields']));_0x446538['attributes']=_0x446538[_0x489c('0x2f')][_0x489c('0x30')]?_0x446538[_0x489c('0x2f')]:_0x380443[_0x489c('0x2d')];if(!_0x85d001['query']['hasOwnProperty'](_0x489c('0x43'))){_0x446538[_0x489c('0xf')]=qs['limit'](_0x85d001[_0x489c('0x25')][_0x489c('0xf')]);_0x446538[_0x489c('0xe')]=qs[_0x489c('0xe')](_0x85d001[_0x489c('0x25')][_0x489c('0xe')]);}_0x446538[_0x489c('0x44')]=qs['sort'](_0x85d001[_0x489c('0x25')][_0x489c('0x45')]);_0x446538[_0x489c('0x23')]=qs[_0x489c('0x2b')](_[_0x489c('0x46')](_0x85d001[_0x489c('0x25')],_0x380443[_0x489c('0x2b')]));_0x446538[_0x489c('0x23')]['WhatsappQueueId']=_0x21ba14['id'];if(_0x85d001[_0x489c('0x25')][_0x489c('0x47')]){_0x446538[_0x489c('0x23')]=_[_0x489c('0x32')](_0x446538[_0x489c('0x23')],{'$or':_['map'](_0x446538['attributes'],function(_0x4d20d8){var _0x4e51d8={};_0x4e51d8[_0x4d20d8]={'$like':'%'+_0x85d001[_0x489c('0x25')]['filter']+'%'};return _0x4e51d8;})});}_0x446538=_[_0x489c('0x32')]({},_0x446538,_0x85d001[_0x489c('0x33')]);return db[_0x489c('0x48')][_0x489c('0x26')](_0x446538);}})[_0x489c('0x15')](function(_0x235232){if(_0x235232){return db['User'][_0x489c('0x49')]({'where':{'id':_[_0x489c('0x1d')](_0x235232,_0x489c('0x4a')),'role':_0x489c('0x4b')},'attributes':['id',_0x489c('0x1a'),_0x489c('0x4c'),'updatedAt','createdAt']});}})['then'](function(_0x242455){if(_0x242455){return{'count':_0x242455['count'],'rows':_[_0x489c('0x1d')](_0x242455['rows'],function(_0x5f2d22){return{'membername':_0x5f2d22[_0x489c('0x1a')],'UserId':_0x5f2d22['id'],'queue_name':_0x330450[_0x489c('0x1a')],'WhatsappQueueId':_0x330450['id'],'interface':util[_0x489c('0x4d')](_0x489c('0x4e'),_0x489c('0x4f'),_0x5f2d22[_0x489c('0x1a')]),'penalty':0x0,'paused':_0x5f2d22[_0x489c('0x4c')],'createdAt':_0x5f2d22[_0x489c('0x50')],'updatedAt':_0x5f2d22[_0x489c('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x489c('0x15')](respondWithFilteredResult(_0x39e6d2,_0x446538))[_0x489c('0x27')](handleError(_0x39e6d2,null));};exports[_0x489c('0x52')]=function(_0x123fcd,_0x2e95fd){var _0x5df1fa={};var _0x126ec9={};var _0x4b3bda;var _0x1f737e;return db[_0x489c('0x1e')][_0x489c('0x42')]({'where':{'id':_0x123fcd['params']['id']}})['then'](handleEntityNotFound(_0x2e95fd,null))['then'](function(_0x56d7d8){if(_0x56d7d8){_0x4b3bda=_0x56d7d8;_0x126ec9['model']=_[_0x489c('0x2a')](db['Team'][_0x489c('0x1f')]);_0x126ec9[_0x489c('0x25')]=_['keys'](_0x123fcd[_0x489c('0x25')]);_0x126ec9[_0x489c('0x2b')]=_[_0x489c('0x2c')](_0x126ec9['model'],_0x126ec9[_0x489c('0x25')]);_0x5df1fa['attributes']=_[_0x489c('0x2c')](_0x126ec9[_0x489c('0x2d')],qs[_0x489c('0x2e')](_0x123fcd[_0x489c('0x25')]['fields']));_0x5df1fa['attributes']=_0x5df1fa[_0x489c('0x2f')][_0x489c('0x30')]?_0x5df1fa['attributes']:_0x126ec9[_0x489c('0x2d')];_0x5df1fa['order']=qs[_0x489c('0x45')](_0x123fcd[_0x489c('0x25')][_0x489c('0x45')]);_0x5df1fa['where']=qs[_0x489c('0x2b')](_[_0x489c('0x46')](_0x123fcd[_0x489c('0x25')],_0x126ec9[_0x489c('0x2b')]));if(_0x123fcd[_0x489c('0x25')]['filter']){_0x5df1fa[_0x489c('0x23')]=_['merge'](_0x5df1fa[_0x489c('0x23')],{'$or':_[_0x489c('0x1d')](_0x5df1fa[_0x489c('0x2f')],function(_0x12a467){var _0xa2b3b8={};_0xa2b3b8[_0x12a467]={'$like':'%'+_0x123fcd[_0x489c('0x25')][_0x489c('0x47')]+'%'};return _0xa2b3b8;})});}_0x5df1fa=_[_0x489c('0x32')]({},_0x5df1fa,_0x123fcd['options']);return _0x4b3bda[_0x489c('0x52')](_0x5df1fa);}})[_0x489c('0x15')](function(_0x21d5db){if(_0x21d5db){_0x1f737e=_0x21d5db[_0x489c('0x30')];if(!_0x123fcd[_0x489c('0x25')][_0x489c('0x53')](_0x489c('0x43'))){_0x5df1fa[_0x489c('0xf')]=qs[_0x489c('0xf')](_0x123fcd[_0x489c('0x25')][_0x489c('0xf')]);_0x5df1fa[_0x489c('0xe')]=qs[_0x489c('0xe')](_0x123fcd[_0x489c('0x25')][_0x489c('0xe')]);}return _0x4b3bda[_0x489c('0x52')](_0x5df1fa);}})['then'](function(_0xa992b5){if(_0xa992b5){return _0xa992b5?{'count':_0x1f737e,'rows':_0xa992b5}:null;}})[_0x489c('0x15')](respondWithResult(_0x2e95fd,null))['catch'](handleError(_0x2e95fd,null));};exports[_0x489c('0x54')]=function(_0x3e4704,_0x37fb85){var _0x318599=_0x3e4704[_0x489c('0x3f')][_0x489c('0x55')];return db[_0x489c('0x56')][_0x489c('0x26')]({'where':{'id':_0x318599},'attributes':['id'],'include':[{'model':db[_0x489c('0x57')],'as':_0x489c('0x58'),'attributes':['id',_0x489c('0x1a'),'online','voicePause',_0x489c('0x59')],'raw':!![]}]})[_0x489c('0x15')](function(_0x85096b){if(_0x85096b){var _0x4509f2=_['flatMap'](_0x85096b,function(_0x42d3d1){var _0x130d8a=_0x42d3d1[_0x489c('0x37')]({'plain':!![]});return _0x130d8a['Agents'];});return db[_0x489c('0x1e')][_0x489c('0x34')]({'where':{'id':_0x3e4704[_0x489c('0x29')]['id']}})[_0x489c('0x15')](function(_0x5e2cef){return db[_0x489c('0x5a')][_0x489c('0x5b')](function(_0x2bd10e){return _0x5e2cef[_0x489c('0x54')](_0x318599,{'transaction':_0x2bd10e})[_0x489c('0x15')](function(){return BPromise[_0x489c('0x5c')](_0x4509f2,function(_0x2f287f){return db[_0x489c('0x48')][_0x489c('0x5d')]({'where':{'UserId':_0x2f287f['id'],'WhatsappQueueId':_0x3e4704['params']['id']},'transaction':_0x2bd10e});});})['then'](function(){_0x4509f2[_0x489c('0x5e')](function(_0x135afd){socket['emit'](_0x489c('0x5f'),{'UserId':_0x135afd['id'],'WhatsappQueueId':_0x5e2cef['id']});});});});});}})[_0x489c('0x15')](respondWithStatusCode(_0x37fb85,null))[_0x489c('0x27')](handleError(_0x37fb85,null));};exports['removeTeams']=function(_0x3f8cb3,_0xced7dd){return db[_0x489c('0x56')]['findAll']({'where':{'id':_0x3f8cb3['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x489c('0x15')](handleEntityNotFound(_0xced7dd,null))['then'](function(_0x325ee6){var _0x8856ab=_['map'](_0x325ee6,'id');var _0x181843=[];var _0x2d47cb=[];var _0x5eb116=squel['select']();_0x5eb116['field'](_0x489c('0x60'))['from'](_0x489c('0x61'),'tq')[_0x489c('0x62')](_0x489c('0x63'),'ut',_0x489c('0x64'))[_0x489c('0x23')]('WhatsappQueueId\x20=\x20?',_0x3f8cb3['params']['id']);for(var _0x30262b=0x0;_0x30262b<_0x325ee6[_0x489c('0x30')];_0x30262b+=0x1){let _0x364292=_0x325ee6[_0x30262b];for(var _0x48d63f=0x0;_0x48d63f<_0x364292[_0x489c('0x58')]['length'];_0x48d63f+=0x1){let _0xec00d5=_0x364292[_0x489c('0x58')][_0x48d63f];var _0x7f582d=_0x5eb116[_0x489c('0x65')]();_0x7f582d[_0x489c('0x23')](_0x489c('0x66'),_0xec00d5['id']);_0x2d47cb[_0x489c('0x67')](db[_0x489c('0x5a')][_0x489c('0x25')](_0x7f582d['toString'](),{'type':db['sequelize'][_0x489c('0x68')][_0x489c('0x69')]})['then'](function(_0x4dbf2b){if(_0x4dbf2b[_0x489c('0x30')]===0x1){return _0xec00d5['id'];}else{var _0x146cd6=_['every'](_['map'](_0x4dbf2b,_0x489c('0x6a')),function(_0x40bf95){return _[_0x489c('0x6b')](_0x8856ab,_0x40bf95);});if(_0x146cd6){return _0xec00d5['id'];}}}));}}return BPromise[_0x489c('0x6c')](_0x2d47cb)[_0x489c('0x15')](function(_0x31ecf5){_0x181843=_(_0x181843)[_0x489c('0x6d')](_0x31ecf5)['compact']()[_0x489c('0x6e')]();return db[_0x489c('0x1e')][_0x489c('0x34')]({'where':{'id':_0x3f8cb3[_0x489c('0x29')]['id']}})['then'](function(_0x23f10d){return db[_0x489c('0x5a')][_0x489c('0x5b')](function(_0x1abe96){return _0x23f10d['removeTeams'](_0x3f8cb3[_0x489c('0x25')][_0x489c('0x55')],{'transaction':_0x1abe96})[_0x489c('0x15')](function(){if(!_[_0x489c('0x6f')](_0x181843)){return _0x23f10d[_0x489c('0x70')](_0x181843,{'transaction':_0x1abe96});}})[_0x489c('0x15')](function(){_0x181843['forEach'](function(_0x1805cc){socket[_0x489c('0x71')](_0x489c('0x72'),{'UserId':_0x1805cc,'WhatsappQueueId':_0x23f10d['id']});});});});});});})[_0x489c('0x15')](respondWithStatusCode(_0xced7dd,null))['catch'](handleError(_0xced7dd,null));};exports[_0x489c('0x73')]=function(_0x482de2,_0x38b03d){return db[_0x489c('0x1e')][_0x489c('0x34')]({'where':{'id':_0x482de2[_0x489c('0x29')]['id']}})[_0x489c('0x15')](handleEntityNotFound(_0x38b03d,null))['then'](function(_0x5e3421){if(_0x5e3421){return _0x5e3421['addAgents'](_0x482de2[_0x489c('0x3f')]['ids'],_['omit'](_0x482de2[_0x489c('0x3f')],[_0x489c('0x55'),'id'])||{})['spread'](function(_0x287097){for(var _0x47b0f1=0x0;_0x47b0f1<_0x482de2['body'][_0x489c('0x55')][_0x489c('0x30')];_0x47b0f1+=0x1){socket[_0x489c('0x71')](_0x489c('0x5f'),{'UserId':Number(_0x482de2[_0x489c('0x3f')][_0x489c('0x55')][_0x47b0f1]),'WhatsappQueueId':Number(_0x482de2[_0x489c('0x29')]['id'])});}return _0x287097;});}})[_0x489c('0x15')](respondWithResult(_0x38b03d,null))['catch'](handleError(_0x38b03d,null));};exports[_0x489c('0x70')]=function(_0x4b95be,_0x45bbcf){return db[_0x489c('0x1e')][_0x489c('0x34')]({'where':{'id':_0x4b95be[_0x489c('0x29')]['id']}})[_0x489c('0x15')](handleEntityNotFound(_0x45bbcf,null))[_0x489c('0x15')](function(_0x515fc1){if(_0x515fc1){return _0x515fc1[_0x489c('0x70')](_0x4b95be[_0x489c('0x25')][_0x489c('0x55')])['then'](function(){if(_['isArray'](_0x4b95be[_0x489c('0x25')]['ids'])){for(var _0x2f4ec2=0x0;_0x2f4ec2<_0x4b95be[_0x489c('0x25')][_0x489c('0x55')][_0x489c('0x30')];_0x2f4ec2+=0x1){socket[_0x489c('0x71')](_0x489c('0x72'),{'UserId':Number(_0x4b95be['query'][_0x489c('0x55')][_0x2f4ec2]),'WhatsappQueueId':Number(_0x4b95be[_0x489c('0x29')]['id'])});}}else{socket[_0x489c('0x71')](_0x489c('0x72'),{'UserId':Number(_0x4b95be[_0x489c('0x25')][_0x489c('0x55')]),'WhatsappQueueId':Number(_0x4b95be['params']['id'])});}});}})[_0x489c('0x15')](respondWithStatusCode(_0x45bbcf,null))[_0x489c('0x27')](handleError(_0x45bbcf,null));};exports[_0x489c('0x74')]=function(_0x39e0a9,_0xbf5946){var _0x2c0914={};var _0x24bbac={};var _0x91a4e9;var _0x5e3ae1;return db['WhatsappQueue']['findOne']({'where':{'id':_0x39e0a9[_0x489c('0x29')]['id']}})[_0x489c('0x15')](handleEntityNotFound(_0xbf5946,null))['then'](function(_0x38552f){if(_0x38552f){_0x91a4e9=_0x38552f;_0x24bbac[_0x489c('0x2d')]=_[_0x489c('0x2a')](db[_0x489c('0x57')][_0x489c('0x1f')]);_0x24bbac['query']=_['keys'](_0x39e0a9[_0x489c('0x25')]);_0x24bbac[_0x489c('0x2b')]=_[_0x489c('0x2c')](_0x24bbac['model'],_0x24bbac[_0x489c('0x25')]);_0x2c0914[_0x489c('0x2f')]=_[_0x489c('0x2c')](_0x24bbac[_0x489c('0x2d')],qs[_0x489c('0x2e')](_0x39e0a9[_0x489c('0x25')][_0x489c('0x2e')]));_0x2c0914[_0x489c('0x2f')]=_0x2c0914[_0x489c('0x2f')][_0x489c('0x30')]?_0x2c0914[_0x489c('0x2f')]:_0x24bbac[_0x489c('0x2d')];_0x2c0914[_0x489c('0x44')]=qs['sort'](_0x39e0a9[_0x489c('0x25')][_0x489c('0x45')]);_0x2c0914[_0x489c('0x23')]=qs[_0x489c('0x2b')](_[_0x489c('0x46')](_0x39e0a9[_0x489c('0x25')],_0x24bbac[_0x489c('0x2b')]));if(_0x39e0a9['query'][_0x489c('0x47')]){_0x2c0914['where']=_[_0x489c('0x32')](_0x2c0914[_0x489c('0x23')],{'$or':_['map'](_0x2c0914['attributes'],function(_0x55cd95){var _0x3c2902={};_0x3c2902[_0x55cd95]={'$like':'%'+_0x39e0a9[_0x489c('0x25')][_0x489c('0x47')]+'%'};return _0x3c2902;})});}_0x2c0914=_[_0x489c('0x32')]({},_0x2c0914,_0x39e0a9['options']);return _0x91a4e9['getAgents'](_0x2c0914);}})[_0x489c('0x15')](function(_0x140bcb){if(_0x140bcb){_0x5e3ae1=_0x140bcb['length'];if(!_0x39e0a9['query'][_0x489c('0x53')]('nolimit')){_0x2c0914[_0x489c('0xf')]=qs[_0x489c('0xf')](_0x39e0a9['query']['limit']);_0x2c0914['offset']=qs['offset'](_0x39e0a9[_0x489c('0x25')][_0x489c('0xe')]);}return _0x91a4e9['getAgents'](_0x2c0914);}})[_0x489c('0x15')](function(_0x24766f){if(_0x24766f){return _0x24766f?{'count':_0x5e3ae1,'rows':_0x24766f}:null;}})['then'](respondWithResult(_0xbf5946,null))[_0x489c('0x27')](handleError(_0xbf5946,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index a242bf6..2e227ca 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 _0xef4d=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef4d,0x100));var _0xdef4=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xef4d[_0xbd08b4];return _0x314f1e;};'use strict';var EventEmitter=require(_0xdef4('0x0'));var WhatsappQueue=require(_0xdef4('0x1'))['db'][_0xdef4('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xdef4('0x3')](0x0);var events={'afterCreate':_0xdef4('0x4'),'afterUpdate':'update','afterDestroy':_0xdef4('0x5')};function emitEvent(_0x46d7b5){return function(_0x438ab5,_0x482ec7,_0x17af65){WhatsappQueueEvents[_0xdef4('0x6')](_0x46d7b5+':'+_0x438ab5['id'],_0x438ab5);WhatsappQueueEvents[_0xdef4('0x6')](_0x46d7b5,_0x438ab5);_0x17af65(null);};}for(var e in events){if(events[_0xdef4('0x7')](e)){var event=events[e];WhatsappQueue[_0xdef4('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0xad72=['../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xad72,0x95));var _0x2ad7=function(_0x106d38,_0x5b149d){_0x106d38=_0x106d38-0x0;var _0x3d89fb=_0xad72[_0x106d38];return _0x3d89fb;};'use strict';var EventEmitter=require(_0x2ad7('0x0'));var WhatsappQueue=require(_0x2ad7('0x1'))['db'][_0x2ad7('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x2ad7('0x3')](0x0);var events={'afterCreate':_0x2ad7('0x4'),'afterUpdate':_0x2ad7('0x5'),'afterDestroy':_0x2ad7('0x6')};function emitEvent(_0x56be6e){return function(_0x60b9e7,_0x56eb80,_0x47826d){WhatsappQueueEvents[_0x2ad7('0x7')](_0x56be6e+':'+_0x60b9e7['id'],_0x60b9e7);WhatsappQueueEvents[_0x2ad7('0x7')](_0x56be6e,_0x60b9e7);_0x47826d(null);};}for(var e in events){if(events[_0x2ad7('0x8')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x2ad7('0x9')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index e2f7604..eeae7b0 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 _0xafa4=['bluebird','path','rimraf','../../config/environment','exports','whatsapp_queues','lodash','util','../../config/logger','api'];(function(_0x72699,_0x2db3f6){var _0x183e18=function(_0x263e9f){while(--_0x263e9f){_0x72699['push'](_0x72699['shift']());}};_0x183e18(++_0x2db3f6);}(_0xafa4,0x132));var _0x4afa=function(_0x53a2c9,_0x5bcc2e){_0x53a2c9=_0x53a2c9-0x0;var _0x3b1949=_0xafa4[_0x53a2c9];return _0x3b1949;};'use strict';var _=require(_0x4afa('0x0'));var util=require(_0x4afa('0x1'));var logger=require(_0x4afa('0x2'))(_0x4afa('0x3'));var moment=require('moment');var BPromise=require(_0x4afa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4afa('0x5'));var rimraf=require(_0x4afa('0x6'));var config=require(_0x4afa('0x7'));var attributes=require('./whatsappQueue.attributes');module[_0x4afa('0x8')]=function(_0x3cef4a,_0x332deb){return _0x3cef4a['define']('WhatsappQueue',attributes,{'tableName':_0x4afa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1da=['exports','define','WhatsappQueue','whatsapp_queues','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./whatsappQueue.attributes'];(function(_0x5e2541,_0x55412c){var _0x965285=function(_0x3c5144){while(--_0x3c5144){_0x5e2541['push'](_0x5e2541['shift']());}};_0x965285(++_0x55412c);}(_0xf1da,0xb8));var _0xaf1d=function(_0x4b1643,_0x270da2){_0x4b1643=_0x4b1643-0x0;var _0x412a67=_0xf1da[_0x4b1643];return _0x412a67;};'use strict';var _=require('lodash');var util=require(_0xaf1d('0x0'));var logger=require(_0xaf1d('0x1'))('api');var moment=require(_0xaf1d('0x2'));var BPromise=require(_0xaf1d('0x3'));var rp=require(_0xaf1d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaf1d('0x5'));var config=require(_0xaf1d('0x6'));var attributes=require(_0xaf1d('0x7'));module[_0xaf1d('0x8')]=function(_0x3011c2,_0x4e543b){return _0x3011c2[_0xaf1d('0x9')](_0xaf1d('0xa'),attributes,{'tableName':_0xaf1d('0xb'),'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 e306e75..1cf1d38 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 _0xabdc=['ShowWhatsappQueue','find','lodash','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','request\x20sent','debug','stringify','error','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x5b8a03,_0x28363f){var _0x1fdc8b=function(_0x538659){while(--_0x538659){_0x5b8a03['push'](_0x5b8a03['shift']());}};_0x1fdc8b(++_0x28363f);}(_0xabdc,0x174));var _0xcabd=function(_0x11154a,_0x295767){_0x11154a=_0x11154a-0x0;var _0x5039ca=_0xabdc[_0x11154a];return _0x5039ca;};'use strict';var _=require(_0xcabd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcabd('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcabd('0x2'));var logger=require('../../config/logger')(_0xcabd('0x3'));var config=require(_0xcabd('0x4'));var jayson=require(_0xcabd('0x5'));var client=jayson[_0xcabd('0x6')][_0xcabd('0x7')]({'port':0x232a});config[_0xcabd('0x8')]=_[_0xcabd('0x9')](config[_0xcabd('0x8')],{'host':_0xcabd('0xa'),'port':0x18eb});var socket=require(_0xcabd('0xb'))(new Redis(config[_0xcabd('0x8')]));require(_0xcabd('0xc'))['register'](socket);function respondWithRpcPromise(_0x29f3a4,_0x3f3688,_0x498bb3){return new BPromise(function(_0x4693ea,_0x4bdbef){return client[_0xcabd('0xd')](_0x29f3a4,_0x498bb3)[_0xcabd('0xe')](function(_0xf5ca00){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x3f3688,_0xcabd('0xf'));logger[_0xcabd('0x10')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x3f3688,'request\x20sent',JSON[_0xcabd('0x11')](_0xf5ca00));if(_0xf5ca00[_0xcabd('0x12')]){if(_0xf5ca00['error']['code']===0x1f4){logger['error'](_0xcabd('0x13'),_0x3f3688,_0xf5ca00[_0xcabd('0x12')][_0xcabd('0x14')]);return _0x4bdbef(_0xf5ca00[_0xcabd('0x12')][_0xcabd('0x14')]);}logger[_0xcabd('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x3f3688,_0xf5ca00[_0xcabd('0x12')][_0xcabd('0x14')]);return _0x4693ea(_0xf5ca00[_0xcabd('0x12')]['message']);}else{logger[_0xcabd('0x15')](_0xcabd('0x13'),_0x3f3688,'request\x20sent');_0x4693ea(_0xf5ca00[_0xcabd('0x16')]['message']);}})[_0xcabd('0x17')](function(_0x3952d0){logger['error'](_0xcabd('0x13'),_0x3f3688,_0x3952d0);_0x4bdbef(_0x3952d0);});});}exports[_0xcabd('0x18')]=function(_0xa97d39){var _0x4b8311=this;return new Promise(function(_0x50e6ea,_0x17364f){return db[_0xcabd('0x19')][_0xcabd('0x1a')]({'raw':_0xa97d39[_0xcabd('0x1b')]?_0xa97d39['options'][_0xcabd('0x1c')]===undefined?!![]:![]:!![],'where':_0xa97d39['options']?_0xa97d39['options'][_0xcabd('0x1d')]||null:null,'attributes':_0xa97d39['options']?_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x1e')]||null:null,'limit':_0xa97d39['options']?_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x1f')]||null:null,'include':_0xa97d39[_0xcabd('0x1b')]?_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x20')]?_[_0xcabd('0x21')](_0xa97d39[_0xcabd('0x1b')][_0xcabd('0x20')],function(_0x1a5843){return{'model':db[_0x1a5843[_0xcabd('0x22')]],'as':_0x1a5843['as'],'attributes':_0x1a5843[_0xcabd('0x1e')],'include':_0x1a5843[_0xcabd('0x20')]?_['map'](_0x1a5843['include'],function(_0x3250a7){return{'model':db[_0x3250a7[_0xcabd('0x22')]],'as':_0x3250a7['as'],'attributes':_0x3250a7['attributes'],'include':_0x3250a7['include']?_[_0xcabd('0x21')](_0x3250a7[_0xcabd('0x20')],function(_0x25a446){return{'model':db[_0x25a446[_0xcabd('0x22')]],'as':_0x25a446['as'],'attributes':_0x25a446[_0xcabd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcabd('0xe')](function(_0x375c40){logger[_0xcabd('0x15')]('GetWhatsappQueue',_0xa97d39);logger[_0xcabd('0x10')](_0xcabd('0x18'),_0xa97d39,JSON[_0xcabd('0x11')](_0x375c40));_0x50e6ea(_0x375c40);})[_0xcabd('0x17')](function(_0x2d0b8c){logger[_0xcabd('0x12')](_0xcabd('0x18'),_0x2d0b8c[_0xcabd('0x14')],_0xa97d39);_0x17364f(_0x4b8311['error'](0x1f4,_0x2d0b8c[_0xcabd('0x14')]));});});};exports[_0xcabd('0x23')]=function(_0x42779a){var _0xe42676=this;return new Promise(function(_0x3d7a46,_0x36cf20){return db[_0xcabd('0x19')][_0xcabd('0x24')]({'raw':_0x42779a['options']?_0x42779a[_0xcabd('0x1b')][_0xcabd('0x1c')]===undefined?!![]:![]:!![],'where':_0x42779a[_0xcabd('0x1b')]?_0x42779a['options'][_0xcabd('0x1d')]||null:null,'attributes':_0x42779a['options']?_0x42779a['options'][_0xcabd('0x1e')]||null:null,'include':_0x42779a[_0xcabd('0x1b')]?_0x42779a[_0xcabd('0x1b')][_0xcabd('0x20')]?_[_0xcabd('0x21')](_0x42779a[_0xcabd('0x1b')][_0xcabd('0x20')],function(_0x1876ce){return{'model':db[_0x1876ce[_0xcabd('0x22')]],'as':_0x1876ce['as'],'attributes':_0x1876ce[_0xcabd('0x1e')],'include':_0x1876ce[_0xcabd('0x20')]?_[_0xcabd('0x21')](_0x1876ce[_0xcabd('0x20')],function(_0x1cad50){return{'model':db[_0x1cad50[_0xcabd('0x22')]],'as':_0x1cad50['as'],'attributes':_0x1cad50[_0xcabd('0x1e')],'include':_0x1cad50['include']?_['map'](_0x1cad50[_0xcabd('0x20')],function(_0x3f1139){return{'model':db[_0x3f1139[_0xcabd('0x22')]],'as':_0x3f1139['as'],'attributes':_0x3f1139[_0xcabd('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xcabd('0xe')](function(_0xfa6c60){logger[_0xcabd('0x15')](_0xcabd('0x23'),_0x42779a);logger[_0xcabd('0x10')]('ShowWhatsappQueue',_0x42779a,JSON['stringify'](_0xfa6c60));_0x3d7a46(_0xfa6c60);})[_0xcabd('0x17')](function(_0x484d77){logger[_0xcabd('0x12')](_0xcabd('0x23'),_0x484d77[_0xcabd('0x14')],_0x42779a);_0x36cf20(_0xe42676['error'](0x1f4,_0x484d77[_0xcabd('0x14')]));});});}; \ No newline at end of file +var _0x8482=['catch','GetWhatsappQueue','WhatsappQueue','findAll','options','raw','where','include','model','map','attributes','stringify','ShowWhatsappQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','register','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','error','message','WhatsappQueue,\x20%s,\x20%s'];(function(_0x3fa1c7,_0x13d816){var _0x21e45d=function(_0x390c64){while(--_0x390c64){_0x3fa1c7['push'](_0x3fa1c7['shift']());}};_0x21e45d(++_0x13d816);}(_0x8482,0x1b2));var _0x2848=function(_0x3a222f,_0x5d14d9){_0x3a222f=_0x3a222f-0x0;var _0x1dc9fd=_0x8482[_0x3a222f];return _0x1dc9fd;};'use strict';var _=require(_0x2848('0x0'));var util=require('util');var moment=require(_0x2848('0x1'));var BPromise=require(_0x2848('0x2'));var rs=require(_0x2848('0x3'));var fs=require('fs');var Redis=require(_0x2848('0x4'));var db=require(_0x2848('0x5'))['db'];var utils=require(_0x2848('0x6'));var logger=require(_0x2848('0x7'))('rpc');var config=require(_0x2848('0x8'));var jayson=require(_0x2848('0x9'));var client=jayson['client'][_0x2848('0xa')]({'port':0x232a});config[_0x2848('0xb')]=_['defaults'](config[_0x2848('0xb')],{'host':_0x2848('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x2848('0xd')](socket);function respondWithRpcPromise(_0x534b61,_0x53809e,_0x3836a8){return new BPromise(function(_0x277462,_0x45e9b9){return client['request'](_0x534b61,_0x3836a8)[_0x2848('0xe')](function(_0x3e6d81){logger[_0x2848('0xf')]('WhatsappQueue,\x20%s,\x20%s',_0x53809e,'request\x20sent');logger[_0x2848('0x10')](_0x2848('0x11'),_0x53809e,'request\x20sent',JSON['stringify'](_0x3e6d81));if(_0x3e6d81[_0x2848('0x12')]){if(_0x3e6d81[_0x2848('0x12')]['code']===0x1f4){logger[_0x2848('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x53809e,_0x3e6d81[_0x2848('0x12')]['message']);return _0x45e9b9(_0x3e6d81[_0x2848('0x12')][_0x2848('0x13')]);}logger['error'](_0x2848('0x14'),_0x53809e,_0x3e6d81[_0x2848('0x12')][_0x2848('0x13')]);return _0x277462(_0x3e6d81[_0x2848('0x12')][_0x2848('0x13')]);}else{logger[_0x2848('0xf')](_0x2848('0x14'),_0x53809e,'request\x20sent');_0x277462(_0x3e6d81['result'][_0x2848('0x13')]);}})[_0x2848('0x15')](function(_0x1e7aa6){logger[_0x2848('0x12')](_0x2848('0x14'),_0x53809e,_0x1e7aa6);_0x45e9b9(_0x1e7aa6);});});}exports[_0x2848('0x16')]=function(_0x455800){var _0x17b68f=this;return new Promise(function(_0x38e82c,_0x36979d){return db[_0x2848('0x17')][_0x2848('0x18')]({'raw':_0x455800[_0x2848('0x19')]?_0x455800[_0x2848('0x19')][_0x2848('0x1a')]===undefined?!![]:![]:!![],'where':_0x455800[_0x2848('0x19')]?_0x455800[_0x2848('0x19')][_0x2848('0x1b')]||null:null,'attributes':_0x455800[_0x2848('0x19')]?_0x455800[_0x2848('0x19')]['attributes']||null:null,'limit':_0x455800[_0x2848('0x19')]?_0x455800['options']['limit']||null:null,'include':_0x455800['options']?_0x455800['options'][_0x2848('0x1c')]?_['map'](_0x455800[_0x2848('0x19')]['include'],function(_0x51ce9e){return{'model':db[_0x51ce9e[_0x2848('0x1d')]],'as':_0x51ce9e['as'],'attributes':_0x51ce9e['attributes'],'include':_0x51ce9e[_0x2848('0x1c')]?_[_0x2848('0x1e')](_0x51ce9e[_0x2848('0x1c')],function(_0x2893cd){return{'model':db[_0x2893cd[_0x2848('0x1d')]],'as':_0x2893cd['as'],'attributes':_0x2893cd[_0x2848('0x1f')],'include':_0x2893cd[_0x2848('0x1c')]?_[_0x2848('0x1e')](_0x2893cd[_0x2848('0x1c')],function(_0x359235){return{'model':db[_0x359235['model']],'as':_0x359235['as'],'attributes':_0x359235[_0x2848('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2848('0xe')](function(_0x120cce){logger['info']('GetWhatsappQueue',_0x455800);logger[_0x2848('0x10')](_0x2848('0x16'),_0x455800,JSON[_0x2848('0x20')](_0x120cce));_0x38e82c(_0x120cce);})[_0x2848('0x15')](function(_0xcfc2a4){logger[_0x2848('0x12')](_0x2848('0x16'),_0xcfc2a4[_0x2848('0x13')],_0x455800);_0x36979d(_0x17b68f[_0x2848('0x12')](0x1f4,_0xcfc2a4[_0x2848('0x13')]));});});};exports[_0x2848('0x21')]=function(_0x34f61b){var _0x1b7d9d=this;return new Promise(function(_0x1555df,_0x24a252){return db[_0x2848('0x17')][_0x2848('0x22')]({'raw':_0x34f61b[_0x2848('0x19')]?_0x34f61b[_0x2848('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x34f61b[_0x2848('0x19')]?_0x34f61b[_0x2848('0x19')][_0x2848('0x1b')]||null:null,'attributes':_0x34f61b['options']?_0x34f61b[_0x2848('0x19')]['attributes']||null:null,'include':_0x34f61b[_0x2848('0x19')]?_0x34f61b[_0x2848('0x19')][_0x2848('0x1c')]?_[_0x2848('0x1e')](_0x34f61b['options'][_0x2848('0x1c')],function(_0x502c6e){return{'model':db[_0x502c6e[_0x2848('0x1d')]],'as':_0x502c6e['as'],'attributes':_0x502c6e['attributes'],'include':_0x502c6e[_0x2848('0x1c')]?_[_0x2848('0x1e')](_0x502c6e[_0x2848('0x1c')],function(_0x243327){return{'model':db[_0x243327[_0x2848('0x1d')]],'as':_0x243327['as'],'attributes':_0x243327['attributes'],'include':_0x243327[_0x2848('0x1c')]?_[_0x2848('0x1e')](_0x243327['include'],function(_0x3b1494){return{'model':db[_0x3b1494[_0x2848('0x1d')]],'as':_0x3b1494['as'],'attributes':_0x3b1494[_0x2848('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x2848('0xe')](function(_0x31f7b3){logger['info'](_0x2848('0x21'),_0x34f61b);logger[_0x2848('0x10')](_0x2848('0x21'),_0x34f61b,JSON[_0x2848('0x20')](_0x31f7b3));_0x1555df(_0x31f7b3);})[_0x2848('0x15')](function(_0x6c8fb6){logger['error']('ShowWhatsappQueue',_0x6c8fb6[_0x2848('0x13')],_0x34f61b);_0x24a252(_0x1b7d9d[_0x2848('0x12')](0x1f4,_0x6c8fb6[_0x2848('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e08a146..fac9983 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 _0x6e2a=['emit','removeListener','register','length','whatsappQueue:','./whatsappQueue.events','save','remove','update'];(function(_0x57eebd,_0x561057){var _0x343a79=function(_0x5e2cb4){while(--_0x5e2cb4){_0x57eebd['push'](_0x57eebd['shift']());}};_0x343a79(++_0x561057);}(_0x6e2a,0x1e2));var _0xa6e2=function(_0x2d6630,_0x45fb62){_0x2d6630=_0x2d6630-0x0;var _0x33acb2=_0x6e2a[_0x2d6630];return _0x33acb2;};'use strict';var WhatsappQueueEvents=require(_0xa6e2('0x0'));var events=[_0xa6e2('0x1'),_0xa6e2('0x2'),_0xa6e2('0x3')];function createListener(_0xb8c7a,_0x17a47b){return function(_0x36e894){_0x17a47b[_0xa6e2('0x4')](_0xb8c7a,_0x36e894);};}function removeListener(_0x1a29c7,_0x46e06c){return function(){WhatsappQueueEvents[_0xa6e2('0x5')](_0x1a29c7,_0x46e06c);};}exports[_0xa6e2('0x6')]=function(_0xe9eac8){for(var _0x5de2e6=0x0,_0x4ed51d=events[_0xa6e2('0x7')];_0x5de2e6<_0x4ed51d;_0x5de2e6++){var _0x1c21b9=events[_0x5de2e6];var _0x58cce3=createListener(_0xa6e2('0x8')+_0x1c21b9,_0xe9eac8);WhatsappQueueEvents['on'](_0x1c21b9,_0x58cce3);}}; \ No newline at end of file +var _0xdbdf=['removeListener','register','length','./whatsappQueue.events','save'];(function(_0x49b950,_0x5be899){var _0x321d95=function(_0x3c79dc){while(--_0x3c79dc){_0x49b950['push'](_0x49b950['shift']());}};_0x321d95(++_0x5be899);}(_0xdbdf,0x166));var _0xfdbd=function(_0x11a1e4,_0x4c43ac){_0x11a1e4=_0x11a1e4-0x0;var _0x547c63=_0xdbdf[_0x11a1e4];return _0x547c63;};'use strict';var WhatsappQueueEvents=require(_0xfdbd('0x0'));var events=[_0xfdbd('0x1'),'remove','update'];function createListener(_0x209c91,_0x5b5736){return function(_0x47e418){_0x5b5736['emit'](_0x209c91,_0x47e418);};}function removeListener(_0x59ad24,_0x256cde){return function(){WhatsappQueueEvents[_0xfdbd('0x2')](_0x59ad24,_0x256cde);};}exports[_0xfdbd('0x3')]=function(_0x55ecf0){for(var _0x2e282e=0x0,_0x533b8b=events[_0xfdbd('0x4')];_0x2e282e<_0x533b8b;_0x2e282e++){var _0x1c4059=events[_0x2e282e];var _0x793236=createListener('whatsappQueue:'+_0x1c4059,_0x55ecf0);WhatsappQueueEvents['on'](_0x1c4059,_0x793236);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index ab221df..090855b 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 _0x8891=['get','describe','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index'];(function(_0x456c4f,_0x4ea98e){var _0x496d2c=function(_0x12e7d4){while(--_0x12e7d4){_0x456c4f['push'](_0x456c4f['shift']());}};_0x496d2c(++_0x4ea98e);}(_0x8891,0x119));var _0x1889=function(_0x540f3c,_0xc117d8){_0x540f3c=_0x540f3c-0x0;var _0x2c3ad3=_0x8891[_0x540f3c];return _0x2c3ad3;};'use strict';var multer=require(_0x1889('0x0'));var util=require(_0x1889('0x1'));var path=require('path');var timeout=require(_0x1889('0x2'));var express=require(_0x1889('0x3'));var router=express['Router']();var fs_extra=require(_0x1889('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1889('0x5'));var config=require('../../config/environment');var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1889('0x6')](),controller[_0x1889('0x7')]);router[_0x1889('0x8')]('/describe',auth[_0x1889('0x6')](),controller[_0x1889('0x9')]);router[_0x1889('0x8')](_0x1889('0xa'),auth[_0x1889('0x6')](),controller[_0x1889('0xb')]);router[_0x1889('0xc')]('/',auth[_0x1889('0x6')](),controller['create']);router[_0x1889('0xd')](_0x1889('0xa'),auth[_0x1889('0x6')](),controller[_0x1889('0xe')]);router[_0x1889('0xf')]('/:id',auth[_0x1889('0x6')](),controller[_0x1889('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f9d=['delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','put','/:id','update'];(function(_0x22c99a,_0x52f26a){var _0xa94e9b=function(_0x14ae50){while(--_0x14ae50){_0x22c99a['push'](_0x22c99a['shift']());}};_0xa94e9b(++_0x52f26a);}(_0x9f9d,0x81));var _0xd9f9=function(_0x4fbdd5,_0x4a7e9f){_0x4fbdd5=_0x4fbdd5-0x0;var _0x3eeb76=_0x9f9d[_0x4fbdd5];return _0x3eeb76;};'use strict';var multer=require('multer');var util=require(_0xd9f9('0x0'));var path=require(_0xd9f9('0x1'));var timeout=require(_0xd9f9('0x2'));var express=require('express');var router=express[_0xd9f9('0x3')]();var fs_extra=require(_0xd9f9('0x4'));var auth=require(_0xd9f9('0x5'));var interaction=require(_0xd9f9('0x6'));var config=require(_0xd9f9('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0xd9f9('0x8')]('/',auth[_0xd9f9('0x9')](),controller['index']);router[_0xd9f9('0x8')](_0xd9f9('0xa'),auth[_0xd9f9('0x9')](),controller[_0xd9f9('0xb')]);router[_0xd9f9('0x8')]('/:id',auth[_0xd9f9('0x9')](),controller[_0xd9f9('0xc')]);router[_0xd9f9('0xd')]('/',auth[_0xd9f9('0x9')](),controller[_0xd9f9('0xe')]);router[_0xd9f9('0xf')](_0xd9f9('0x10'),auth['isAuthenticated'](),controller[_0xd9f9('0x11')]);router[_0xd9f9('0x12')](_0xd9f9('0x10'),auth[_0xd9f9('0x9')](),controller[_0xd9f9('0x13')]);module[_0xd9f9('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index b5b1bd5..51755db 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(_0x1f7d5f,_0x28d25a){var _0xb36080=function(_0x13928b){while(--_0x13928b){_0x1f7d5f['push'](_0x1f7d5f['shift']());}};_0xb36080(++_0x28d25a);}(_0x7a54,0x106));var _0x47a5=function(_0x4f28fc,_0x1e76dc){_0x4f28fc=_0x4f28fc-0x0;var _0x184737=_0x7a54[_0x4f28fc];return _0x184737;};'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(_0x403b6e,_0x45453f){var _0x385ad7=function(_0x415e26){while(--_0x415e26){_0x403b6e['push'](_0x403b6e['shift']());}};_0x385ad7(++_0x45453f);}(_0x7a54,0x106));var _0x47a5=function(_0x28a68d,_0xc5f7f2){_0x28a68d=_0x28a68d-0x0;var _0xb58050=_0x7a54[_0x28a68d];return _0xb58050;};'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 a4ddc54..3ae0c08 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 _0x1d2d=['options','WhatsappQueueReport','includeAll','findAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x459f0f,_0xfd5405){var _0x2f5992=function(_0x31948f){while(--_0x31948f){_0x459f0f['push'](_0x459f0f['shift']());}};_0x2f5992(++_0xfd5405);}(_0x1d2d,0xf0));var _0xd1d2=function(_0x4874ef,_0x597486){_0x4874ef=_0x4874ef-0x0;var _0x28b1f0=_0x1d2d[_0x4874ef];return _0x28b1f0;};'use strict';var emlformat=require(_0xd1d2('0x0'));var rimraf=require(_0xd1d2('0x1'));var zipdir=require(_0xd1d2('0x2'));var jsonpatch=require(_0xd1d2('0x3'));var rp=require(_0xd1d2('0x4'));var moment=require('moment');var BPromise=require(_0xd1d2('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd1d2('0x6'));var sox=require(_0xd1d2('0x7'));var csv=require(_0xd1d2('0x8'));var ejs=require(_0xd1d2('0x9'));var fs=require('fs');var fs_extra=require(_0xd1d2('0xa'));var _=require(_0xd1d2('0xb'));var squel=require('squel');var crypto=require(_0xd1d2('0xc'));var jsforce=require(_0xd1d2('0xd'));var deskjs=require(_0xd1d2('0xe'));var toCsv=require(_0xd1d2('0x8'));var querystring=require(_0xd1d2('0xf'));var Papa=require(_0xd1d2('0x10'));var Redis=require(_0xd1d2('0x11'));var authService=require(_0xd1d2('0x12'));var qs=require(_0xd1d2('0x13'));var as=require(_0xd1d2('0x14'));var hardwareService=require(_0xd1d2('0x15'));var logger=require(_0xd1d2('0x16'))(_0xd1d2('0x17'));var utils=require('../../config/utils');var config=require(_0xd1d2('0x18'));var licenseUtil=require(_0xd1d2('0x19'));var db=require(_0xd1d2('0x1a'))['db'];function respondWithStatusCode(_0x33f088,_0x129d8f){_0x129d8f=_0x129d8f||0xcc;return function(_0xc3ee82){if(_0xc3ee82){return _0x33f088[_0xd1d2('0x1b')](_0x129d8f);}return _0x33f088[_0xd1d2('0x1c')](_0x129d8f)[_0xd1d2('0x1d')]();};}function respondWithResult(_0x3f670f,_0x4cf702){_0x4cf702=_0x4cf702||0xc8;return function(_0x2e7fec){if(_0x2e7fec){return _0x3f670f[_0xd1d2('0x1c')](_0x4cf702)[_0xd1d2('0x1e')](_0x2e7fec);}};}function respondWithFilteredResult(_0x56de25,_0x35381b){return function(_0xc36ce){if(_0xc36ce){var _0x208425=typeof _0x35381b[_0xd1d2('0x1f')]===_0xd1d2('0x20')&&typeof _0x35381b[_0xd1d2('0x21')]===_0xd1d2('0x20');var _0x57f2f9=_0xc36ce['count'];var _0x3be186=_0x208425?0x0:_0x35381b['offset'];var _0x247b3a=_0x208425?_0xc36ce[_0xd1d2('0x22')]:_0x35381b[_0xd1d2('0x1f')]+_0x35381b[_0xd1d2('0x21')];var _0x4ab386;if(_0x247b3a>=_0x57f2f9){_0x247b3a=_0x57f2f9;_0x4ab386=0xc8;}else{_0x4ab386=0xce;}_0x56de25['status'](_0x4ab386);return _0x56de25[_0xd1d2('0x23')]('Content-Range',_0x3be186+'-'+_0x247b3a+'/'+_0x57f2f9)['json'](_0xc36ce);}return null;};}function patchUpdates(_0x1ab67c){return function(_0x27e26b){try{jsonpatch[_0xd1d2('0x24')](_0x27e26b,_0x1ab67c,!![]);}catch(_0x40170b){return BPromise['reject'](_0x40170b);}return _0x27e26b[_0xd1d2('0x25')]();};}function saveUpdates(_0xbb4d27,_0x24b8db){return function(_0x4eb082){if(_0x4eb082){return _0x4eb082['update'](_0xbb4d27)[_0xd1d2('0x26')](function(_0x3a1078){return _0x3a1078;});}return null;};}function removeEntity(_0x19d535,_0x2f92ee){return function(_0x3f229c){if(_0x3f229c){return _0x3f229c[_0xd1d2('0x27')]()[_0xd1d2('0x26')](function(){_0x19d535['status'](0xcc)[_0xd1d2('0x1d')]();});}};}function handleEntityNotFound(_0x42da6d,_0x41330f){return function(_0x2e1709){if(!_0x2e1709){_0x42da6d[_0xd1d2('0x1b')](0x194);}return _0x2e1709;};}function handleError(_0x39e991,_0x28b8be){_0x28b8be=_0x28b8be||0x1f4;return function(_0x34faf7){logger[_0xd1d2('0x28')](_0x34faf7[_0xd1d2('0x29')]);if(_0x34faf7[_0xd1d2('0x2a')]){delete _0x34faf7['name'];}_0x39e991['status'](_0x28b8be)[_0xd1d2('0x2b')](_0x34faf7);};}exports[_0xd1d2('0x2c')]=function(_0x1e6072,_0x2b4c1f){var _0xc815ea={},_0x48ade1={},_0x39d694={'count':0x0,'rows':[]};var _0x41171c=_[_0xd1d2('0x2d')](db['WhatsappQueueReport'][_0xd1d2('0x2e')],function(_0x1db17f){return{'name':_0x1db17f[_0xd1d2('0x2f')],'type':_0x1db17f['type'][_0xd1d2('0x30')]};});_0x48ade1[_0xd1d2('0x31')]=_[_0xd1d2('0x2d')](_0x41171c,_0xd1d2('0x2a'));_0x48ade1[_0xd1d2('0x32')]=_[_0xd1d2('0x33')](_0x1e6072[_0xd1d2('0x32')]);_0x48ade1[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],_0x48ade1[_0xd1d2('0x32')]);_0xc815ea[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x48ade1[_0xd1d2('0x31')],qs[_0xd1d2('0x37')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x37')]));_0xc815ea[_0xd1d2('0x36')]=_0xc815ea['attributes'][_0xd1d2('0x38')]?_0xc815ea[_0xd1d2('0x36')]:_0x48ade1[_0xd1d2('0x31')];if(!_0x1e6072['query'][_0xd1d2('0x39')]('nolimit')){_0xc815ea['limit']=qs[_0xd1d2('0x21')](_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x21')]);_0xc815ea[_0xd1d2('0x1f')]=qs[_0xd1d2('0x1f')](_0x1e6072[_0xd1d2('0x32')]['offset']);}_0xc815ea[_0xd1d2('0x3a')]=qs[_0xd1d2('0x3b')](_0x1e6072['query'][_0xd1d2('0x3b')]);_0xc815ea[_0xd1d2('0x3c')]=qs[_0xd1d2('0x34')](_[_0xd1d2('0x3d')](_0x1e6072['query'],_0x48ade1['filters']),_0x41171c);if(_0x1e6072[_0xd1d2('0x32')]['filter']){_0xc815ea['where']=_['merge'](_0xc815ea[_0xd1d2('0x3c')],{'$or':_['map'](_0x41171c,function(_0x3f4fd7){if(_0x3f4fd7['type']!=='VIRTUAL'){var _0x4bcea4={};_0x4bcea4[_0x3f4fd7[_0xd1d2('0x2a')]]={'$like':'%'+_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x3e')]+'%'};return _0x4bcea4;}})});}_0xc815ea=_[_0xd1d2('0x3f')]({},_0xc815ea,_0x1e6072[_0xd1d2('0x40')]);var _0xb5bec2={'where':_0xc815ea[_0xd1d2('0x3c')]};return db[_0xd1d2('0x41')][_0xd1d2('0x22')](_0xb5bec2)[_0xd1d2('0x26')](function(_0x2cedb4){_0x39d694[_0xd1d2('0x22')]=_0x2cedb4;if(_0x1e6072[_0xd1d2('0x32')][_0xd1d2('0x42')]){_0xc815ea['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0xd1d2('0x43')](_0xc815ea);})[_0xd1d2('0x26')](function(_0x24fc93){_0x39d694['rows']=_0x24fc93;return _0x39d694;})['then'](respondWithFilteredResult(_0x2b4c1f,_0xc815ea))[_0xd1d2('0x44')](handleError(_0x2b4c1f,null));};exports[_0xd1d2('0x45')]=function(_0x4dc730,_0x2fe92a){var _0x4c5d49={'raw':!![],'where':{'id':_0x4dc730[_0xd1d2('0x46')]['id']}},_0x5a3790={};_0x5a3790['model']=_['keys'](db[_0xd1d2('0x41')][_0xd1d2('0x2e')]);_0x5a3790[_0xd1d2('0x32')]=_['keys'](_0x4dc730[_0xd1d2('0x32')]);_0x5a3790[_0xd1d2('0x34')]=_[_0xd1d2('0x35')](_0x5a3790[_0xd1d2('0x31')],_0x5a3790['query']);_0x4c5d49[_0xd1d2('0x36')]=_[_0xd1d2('0x35')](_0x5a3790['model'],qs[_0xd1d2('0x37')](_0x4dc730['query'][_0xd1d2('0x37')]));_0x4c5d49[_0xd1d2('0x36')]=_0x4c5d49[_0xd1d2('0x36')][_0xd1d2('0x38')]?_0x4c5d49[_0xd1d2('0x36')]:_0x5a3790['model'];if(_0x4dc730['query'][_0xd1d2('0x42')]){_0x4c5d49[_0xd1d2('0x47')]=[{'all':!![]}];}_0x4c5d49=_['merge']({},_0x4c5d49,_0x4dc730[_0xd1d2('0x40')]);return db[_0xd1d2('0x41')][_0xd1d2('0x48')](_0x4c5d49)[_0xd1d2('0x26')](handleEntityNotFound(_0x2fe92a,null))[_0xd1d2('0x26')](respondWithResult(_0x2fe92a,null))[_0xd1d2('0x44')](handleError(_0x2fe92a,null));};exports[_0xd1d2('0x49')]=function(_0x57c668,_0xed9e9){return db[_0xd1d2('0x41')]['create'](_0x57c668[_0xd1d2('0x4a')],{})[_0xd1d2('0x26')](respondWithResult(_0xed9e9,0xc9))['catch'](handleError(_0xed9e9,null));};exports['update']=function(_0x3d4fe3,_0x182ea8){if(_0x3d4fe3['body']['id']){delete _0x3d4fe3[_0xd1d2('0x4a')]['id'];}return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0x3d4fe3[_0xd1d2('0x46')]['id']}})[_0xd1d2('0x26')](handleEntityNotFound(_0x182ea8,null))['then'](saveUpdates(_0x3d4fe3['body'],null))[_0xd1d2('0x26')](respondWithResult(_0x182ea8,null))['catch'](handleError(_0x182ea8,null));};exports[_0xd1d2('0x27')]=function(_0xcd4b70,_0x4f4cb9){return db[_0xd1d2('0x41')][_0xd1d2('0x48')]({'where':{'id':_0xcd4b70['params']['id']}})['then'](handleEntityNotFound(_0x4f4cb9,null))[_0xd1d2('0x26')](removeEntity(_0x4f4cb9,null))[_0xd1d2('0x44')](handleError(_0x4f4cb9,null));};exports[_0xd1d2('0x4b')]=function(_0xfd8024,_0xa013ce){return db[_0xd1d2('0x41')][_0xd1d2('0x4b')]()[_0xd1d2('0x26')](respondWithResult(_0xa013ce,null))[_0xd1d2('0x44')](handleError(_0xa013ce,null));}; \ No newline at end of file +var _0xb62e=['length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','findAll','show','find','catch','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','fields'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb62e,0x1de));var _0xeb62=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xb62e[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xeb62('0x0'));var rimraf=require(_0xeb62('0x1'));var zipdir=require(_0xeb62('0x2'));var jsonpatch=require(_0xeb62('0x3'));var rp=require('request-promise');var moment=require(_0xeb62('0x4'));var BPromise=require(_0xeb62('0x5'));var Mustache=require(_0xeb62('0x6'));var util=require(_0xeb62('0x7'));var path=require(_0xeb62('0x8'));var sox=require(_0xeb62('0x9'));var csv=require('to-csv');var ejs=require(_0xeb62('0xa'));var fs=require('fs');var fs_extra=require(_0xeb62('0xb'));var _=require(_0xeb62('0xc'));var squel=require('squel');var crypto=require(_0xeb62('0xd'));var jsforce=require(_0xeb62('0xe'));var deskjs=require(_0xeb62('0xf'));var toCsv=require(_0xeb62('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb62('0x11'));var authService=require(_0xeb62('0x12'));var qs=require(_0xeb62('0x13'));var as=require(_0xeb62('0x14'));var hardwareService=require(_0xeb62('0x15'));var logger=require(_0xeb62('0x16'))(_0xeb62('0x17'));var utils=require(_0xeb62('0x18'));var config=require(_0xeb62('0x19'));var licenseUtil=require(_0xeb62('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x422daf,_0xcc11c4){_0xcc11c4=_0xcc11c4||0xcc;return function(_0x27671e){if(_0x27671e){return _0x422daf[_0xeb62('0x1b')](_0xcc11c4);}return _0x422daf['status'](_0xcc11c4)[_0xeb62('0x1c')]();};}function respondWithResult(_0x2fbad2,_0x23fb15){_0x23fb15=_0x23fb15||0xc8;return function(_0x4da178){if(_0x4da178){return _0x2fbad2[_0xeb62('0x1d')](_0x23fb15)[_0xeb62('0x1e')](_0x4da178);}};}function respondWithFilteredResult(_0x2fd4c7,_0x4ce9fa){return function(_0x1f6a1f){if(_0x1f6a1f){var _0x15b3e8=typeof _0x4ce9fa[_0xeb62('0x1f')]===_0xeb62('0x20')&&typeof _0x4ce9fa[_0xeb62('0x21')]===_0xeb62('0x20');var _0x1fb460=_0x1f6a1f[_0xeb62('0x22')];var _0x39b138=_0x15b3e8?0x0:_0x4ce9fa[_0xeb62('0x1f')];var _0x27efc8=_0x15b3e8?_0x1f6a1f[_0xeb62('0x22')]:_0x4ce9fa[_0xeb62('0x1f')]+_0x4ce9fa['limit'];var _0x38c5e4;if(_0x27efc8>=_0x1fb460){_0x27efc8=_0x1fb460;_0x38c5e4=0xc8;}else{_0x38c5e4=0xce;}_0x2fd4c7[_0xeb62('0x1d')](_0x38c5e4);return _0x2fd4c7[_0xeb62('0x23')](_0xeb62('0x24'),_0x39b138+'-'+_0x27efc8+'/'+_0x1fb460)[_0xeb62('0x1e')](_0x1f6a1f);}return null;};}function patchUpdates(_0x24cbf3){return function(_0x2ed96d){try{jsonpatch['apply'](_0x2ed96d,_0x24cbf3,!![]);}catch(_0x599d0b){return BPromise[_0xeb62('0x25')](_0x599d0b);}return _0x2ed96d[_0xeb62('0x26')]();};}function saveUpdates(_0x11ed9c,_0x13243f){return function(_0x122b15){if(_0x122b15){return _0x122b15['update'](_0x11ed9c)['then'](function(_0x4664ce){return _0x4664ce;});}return null;};}function removeEntity(_0x132861,_0x182781){return function(_0x395b70){if(_0x395b70){return _0x395b70['destroy']()['then'](function(){_0x132861[_0xeb62('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x448327,_0x4b0f46){return function(_0xfe3e16){if(!_0xfe3e16){_0x448327['sendStatus'](0x194);}return _0xfe3e16;};}function handleError(_0x3ac28c,_0x6bfbbc){_0x6bfbbc=_0x6bfbbc||0x1f4;return function(_0x46d1bb){logger['error'](_0x46d1bb[_0xeb62('0x27')]);if(_0x46d1bb[_0xeb62('0x28')]){delete _0x46d1bb[_0xeb62('0x28')];}_0x3ac28c[_0xeb62('0x1d')](_0x6bfbbc)[_0xeb62('0x29')](_0x46d1bb);};}exports[_0xeb62('0x2a')]=function(_0x511202,_0x192517){var _0x1616ee={},_0x57169a={},_0x157474={'count':0x0,'rows':[]};var _0x2b51b2=_[_0xeb62('0x2b')](db[_0xeb62('0x2c')][_0xeb62('0x2d')],function(_0x5195bf){return{'name':_0x5195bf['fieldName'],'type':_0x5195bf[_0xeb62('0x2e')][_0xeb62('0x2f')]};});_0x57169a[_0xeb62('0x30')]=_[_0xeb62('0x2b')](_0x2b51b2,_0xeb62('0x28'));_0x57169a[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x511202['query']);_0x57169a[_0xeb62('0x33')]=_['intersection'](_0x57169a['model'],_0x57169a[_0xeb62('0x31')]);_0x1616ee[_0xeb62('0x34')]=_['intersection'](_0x57169a[_0xeb62('0x30')],qs['fields'](_0x511202[_0xeb62('0x31')][_0xeb62('0x35')]));_0x1616ee['attributes']=_0x1616ee[_0xeb62('0x34')][_0xeb62('0x36')]?_0x1616ee['attributes']:_0x57169a[_0xeb62('0x30')];if(!_0x511202[_0xeb62('0x31')][_0xeb62('0x37')](_0xeb62('0x38'))){_0x1616ee['limit']=qs[_0xeb62('0x21')](_0x511202[_0xeb62('0x31')]['limit']);_0x1616ee['offset']=qs[_0xeb62('0x1f')](_0x511202[_0xeb62('0x31')]['offset']);}_0x1616ee[_0xeb62('0x39')]=qs[_0xeb62('0x3a')](_0x511202[_0xeb62('0x31')][_0xeb62('0x3a')]);_0x1616ee[_0xeb62('0x3b')]=qs[_0xeb62('0x33')](_[_0xeb62('0x3c')](_0x511202['query'],_0x57169a['filters']),_0x2b51b2);if(_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]){_0x1616ee[_0xeb62('0x3b')]=_[_0xeb62('0x3e')](_0x1616ee['where'],{'$or':_[_0xeb62('0x2b')](_0x2b51b2,function(_0x510c7d){if(_0x510c7d[_0xeb62('0x2e')]!==_0xeb62('0x3f')){var _0x2dac2f={};_0x2dac2f[_0x510c7d[_0xeb62('0x28')]]={'$like':'%'+_0x511202[_0xeb62('0x31')][_0xeb62('0x3d')]+'%'};return _0x2dac2f;}})});}_0x1616ee=_[_0xeb62('0x3e')]({},_0x1616ee,_0x511202[_0xeb62('0x40')]);var _0x5e8ef8={'where':_0x1616ee[_0xeb62('0x3b')]};return db[_0xeb62('0x2c')][_0xeb62('0x22')](_0x5e8ef8)[_0xeb62('0x41')](function(_0x5dd0e3){_0x157474['count']=_0x5dd0e3;if(_0x511202[_0xeb62('0x31')][_0xeb62('0x42')]){_0x1616ee['include']=[{'all':!![]}];}return db[_0xeb62('0x2c')][_0xeb62('0x43')](_0x1616ee);})['then'](function(_0x25e9f0){_0x157474['rows']=_0x25e9f0;return _0x157474;})[_0xeb62('0x41')](respondWithFilteredResult(_0x192517,_0x1616ee))['catch'](handleError(_0x192517,null));};exports[_0xeb62('0x44')]=function(_0x5dde1d,_0x2bf77f){var _0x609b2d={'raw':!![],'where':{'id':_0x5dde1d['params']['id']}},_0x317f50={};_0x317f50['model']=_[_0xeb62('0x32')](db[_0xeb62('0x2c')][_0xeb62('0x2d')]);_0x317f50[_0xeb62('0x31')]=_[_0xeb62('0x32')](_0x5dde1d['query']);_0x317f50[_0xeb62('0x33')]=_['intersection'](_0x317f50[_0xeb62('0x30')],_0x317f50['query']);_0x609b2d[_0xeb62('0x34')]=_['intersection'](_0x317f50[_0xeb62('0x30')],qs['fields'](_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x35')]));_0x609b2d[_0xeb62('0x34')]=_0x609b2d[_0xeb62('0x34')][_0xeb62('0x36')]?_0x609b2d[_0xeb62('0x34')]:_0x317f50['model'];if(_0x5dde1d[_0xeb62('0x31')][_0xeb62('0x42')]){_0x609b2d['include']=[{'all':!![]}];}_0x609b2d=_['merge']({},_0x609b2d,_0x5dde1d['options']);return db['WhatsappQueueReport'][_0xeb62('0x45')](_0x609b2d)[_0xeb62('0x41')](handleEntityNotFound(_0x2bf77f,null))['then'](respondWithResult(_0x2bf77f,null))[_0xeb62('0x46')](handleError(_0x2bf77f,null));};exports[_0xeb62('0x47')]=function(_0x412e93,_0x16e262){return db[_0xeb62('0x2c')]['create'](_0x412e93[_0xeb62('0x48')],{})['then'](respondWithResult(_0x16e262,0xc9))[_0xeb62('0x46')](handleError(_0x16e262,null));};exports[_0xeb62('0x49')]=function(_0x7fb53f,_0x18c40d){if(_0x7fb53f[_0xeb62('0x48')]['id']){delete _0x7fb53f[_0xeb62('0x48')]['id'];}return db[_0xeb62('0x2c')][_0xeb62('0x45')]({'where':{'id':_0x7fb53f[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x18c40d,null))[_0xeb62('0x41')](saveUpdates(_0x7fb53f[_0xeb62('0x48')],null))['then'](respondWithResult(_0x18c40d,null))[_0xeb62('0x46')](handleError(_0x18c40d,null));};exports['destroy']=function(_0x4edd8c,_0x2dcb2d){return db[_0xeb62('0x2c')]['find']({'where':{'id':_0x4edd8c[_0xeb62('0x4a')]['id']}})[_0xeb62('0x41')](handleEntityNotFound(_0x2dcb2d,null))['then'](removeEntity(_0x2dcb2d,null))[_0xeb62('0x46')](handleError(_0x2dcb2d,null));};exports[_0xeb62('0x4b')]=function(_0x20b73b,_0x60617){return db[_0xeb62('0x2c')][_0xeb62('0x4b')]()[_0xeb62('0x41')](respondWithResult(_0x60617,null))[_0xeb62('0x46')](handleError(_0x60617,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1b0d989..332e1bb 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 _0x3b5c=['define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','api','moment','rimraf','./whatsappQueueReport.attributes','exports'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3b5c,0x1ee));var _0xc3b5=function(_0x213a7d,_0x5367d7){_0x213a7d=_0x213a7d-0x0;var _0x30400b=_0x3b5c[_0x213a7d];return _0x30400b;};'use strict';var _=require(_0xc3b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc3b5('0x1'));var moment=require(_0xc3b5('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc3b5('0x3'));var config=require('../../config/environment');var attributes=require(_0xc3b5('0x4'));module[_0xc3b5('0x5')]=function(_0x282b15,_0x4939db){return _0x282b15[_0xc3b5('0x6')](_0xc3b5('0x7'),attributes,{'tableName':_0xc3b5('0x8'),'paranoid':![],'indexes':[{'name':_0xc3b5('0x9'),'fields':[_0xc3b5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1cc4=['moment','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api'];(function(_0x1678c8,_0x1c32f4){var _0x387aa9=function(_0x2803bd){while(--_0x2803bd){_0x1678c8['push'](_0x1678c8['shift']());}};_0x387aa9(++_0x1c32f4);}(_0x1cc4,0xb2));var _0x41cc=function(_0x34b1b8,_0x54c9bf){_0x34b1b8=_0x34b1b8-0x0;var _0x542dd8=_0x1cc4[_0x34b1b8];return _0x542dd8;};'use strict';var _=require(_0x41cc('0x0'));var util=require(_0x41cc('0x1'));var logger=require(_0x41cc('0x2'))(_0x41cc('0x3'));var moment=require(_0x41cc('0x4'));var BPromise=require('bluebird');var rp=require(_0x41cc('0x5'));var fs=require('fs');var path=require(_0x41cc('0x6'));var rimraf=require(_0x41cc('0x7'));var config=require(_0x41cc('0x8'));var attributes=require('./whatsappQueueReport.attributes');module[_0x41cc('0x9')]=function(_0x5b8a47,_0x478c72){return _0x5b8a47[_0x41cc('0xa')](_0x41cc('0xb'),attributes,{'tableName':_0x41cc('0xc'),'paranoid':![],'indexes':[{'name':_0x41cc('0xd'),'fields':[_0x41cc('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 9c878af..607a47f 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 _0xb708=['where','attributes','limit','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','raw','then','debug','stringify','UpdateWhatsappQueueReport','update','options'];(function(_0x2bed49,_0x227cc7){var _0x1d00fc=function(_0x373c75){while(--_0x373c75){_0x2bed49['push'](_0x2bed49['shift']());}};_0x1d00fc(++_0x227cc7);}(_0xb708,0x9e));var _0x8b70=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0xb708[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x8b70('0x0'));var moment=require(_0x8b70('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b70('0x2'));var fs=require('fs');var Redis=require(_0x8b70('0x3'));var db=require(_0x8b70('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b70('0x5'))(_0x8b70('0x6'));var config=require('../../config/environment');var jayson=require(_0x8b70('0x7'));var client=jayson['client'][_0x8b70('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c0e91,_0x4ed29e,_0x5992c0){return new BPromise(function(_0xce6ff4,_0x1df2b2){return client[_0x8b70('0x9')](_0x4c0e91,_0x5992c0)['then'](function(_0x1d759e){logger[_0x8b70('0xa')](_0x8b70('0xb'),_0x4ed29e,_0x8b70('0xc'));logger['debug'](_0x8b70('0xd'),_0x4ed29e,_0x8b70('0xc'),JSON['stringify'](_0x1d759e));if(_0x1d759e[_0x8b70('0xe')]){if(_0x1d759e[_0x8b70('0xe')]['code']===0x1f4){logger[_0x8b70('0xe')](_0x8b70('0xb'),_0x4ed29e,_0x1d759e[_0x8b70('0xe')]['message']);return _0x1df2b2(_0x1d759e[_0x8b70('0xe')][_0x8b70('0xf')]);}logger[_0x8b70('0xe')](_0x8b70('0xb'),_0x4ed29e,_0x1d759e[_0x8b70('0xe')][_0x8b70('0xf')]);return _0xce6ff4(_0x1d759e[_0x8b70('0xe')][_0x8b70('0xf')]);}else{logger[_0x8b70('0xa')](_0x8b70('0xb'),_0x4ed29e,_0x8b70('0xc'));_0xce6ff4(_0x1d759e['result']['message']);}})[_0x8b70('0x10')](function(_0x1556e8){logger[_0x8b70('0xe')]('WhatsappQueueReport,\x20%s,\x20%s',_0x4ed29e,_0x1556e8);_0x1df2b2(_0x1556e8);});});}exports[_0x8b70('0x11')]=function(_0x3bf25e){var _0x5157b7=this;return new Promise(function(_0x5f347c,_0x51ee75){return db[_0x8b70('0x12')][_0x8b70('0x13')](_0x3bf25e[_0x8b70('0x14')],{'raw':_0x3bf25e['options']?_0x3bf25e['options'][_0x8b70('0x15')]===undefined?!![]:![]:!![]})[_0x8b70('0x16')](function(_0x26aaa4){logger[_0x8b70('0xa')](_0x8b70('0x11'),_0x3bf25e);logger[_0x8b70('0x17')]('CreateWhatsappQueueReport',_0x3bf25e,JSON[_0x8b70('0x18')](_0x26aaa4));_0x5f347c(_0x26aaa4);})[_0x8b70('0x10')](function(_0x2eb2d0){logger['error']('CreateWhatsappQueueReport',_0x2eb2d0[_0x8b70('0xf')],_0x3bf25e);_0x51ee75(_0x5157b7[_0x8b70('0xe')](0x1f4,_0x2eb2d0[_0x8b70('0xf')]));});});};exports[_0x8b70('0x19')]=function(_0x538eee){var _0x24cf6c=this;return new Promise(function(_0x522285,_0x5f36a){return db[_0x8b70('0x12')][_0x8b70('0x1a')](_0x538eee[_0x8b70('0x14')],{'raw':_0x538eee['options']?_0x538eee['options'][_0x8b70('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x538eee[_0x8b70('0x1b')]?_0x538eee[_0x8b70('0x1b')][_0x8b70('0x1c')]||null:null,'attributes':_0x538eee[_0x8b70('0x1b')]?_0x538eee[_0x8b70('0x1b')][_0x8b70('0x1d')]||null:null,'limit':_0x538eee[_0x8b70('0x1b')]?_0x538eee['options'][_0x8b70('0x1e')]||null:null})[_0x8b70('0x16')](function(_0x53cedd){logger[_0x8b70('0xa')](_0x8b70('0x19'),_0x538eee);logger['debug'](_0x8b70('0x19'),_0x538eee,JSON[_0x8b70('0x18')](_0x53cedd));_0x522285(_0x53cedd);})[_0x8b70('0x10')](function(_0x139c9a){logger[_0x8b70('0xe')](_0x8b70('0x19'),_0x139c9a[_0x8b70('0xf')],_0x538eee);_0x5f36a(_0x24cf6c[_0x8b70('0xe')](0x1f4,_0x139c9a[_0x8b70('0xf')]));});});}; \ No newline at end of file +var _0x653e=['where','attributes','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateWhatsappQueueReport','create','body','options','raw','then','info','stringify','UpdateWhatsappQueueReport','update'];(function(_0x5c2c7c,_0xa7d3b1){var _0xea7ffe=function(_0x471f17){while(--_0x471f17){_0x5c2c7c['push'](_0x5c2c7c['shift']());}};_0xea7ffe(++_0xa7d3b1);}(_0x653e,0x8b));var _0xe653=function(_0x227c55,_0x49db56){_0x227c55=_0x227c55-0x0;var _0x49e02b=_0x653e[_0x227c55];return _0x49e02b;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe653('0x0'));var BPromise=require(_0xe653('0x1'));var rs=require(_0xe653('0x2'));var fs=require('fs');var Redis=require(_0xe653('0x3'));var db=require(_0xe653('0x4'))['db'];var utils=require(_0xe653('0x5'));var logger=require(_0xe653('0x6'))(_0xe653('0x7'));var config=require(_0xe653('0x8'));var jayson=require(_0xe653('0x9'));var client=jayson[_0xe653('0xa')][_0xe653('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x229399,_0x4391a4,_0x27aa2c){return new BPromise(function(_0x5c31ec,_0x50d7e2){return client[_0xe653('0xc')](_0x229399,_0x27aa2c)['then'](function(_0xaa5b5c){logger['info'](_0xe653('0xd'),_0x4391a4,_0xe653('0xe'));logger[_0xe653('0xf')](_0xe653('0x10'),_0x4391a4,_0xe653('0xe'),JSON['stringify'](_0xaa5b5c));if(_0xaa5b5c[_0xe653('0x11')]){if(_0xaa5b5c['error'][_0xe653('0x12')]===0x1f4){logger['error'](_0xe653('0xd'),_0x4391a4,_0xaa5b5c[_0xe653('0x11')][_0xe653('0x13')]);return _0x50d7e2(_0xaa5b5c[_0xe653('0x11')][_0xe653('0x13')]);}logger[_0xe653('0x11')](_0xe653('0xd'),_0x4391a4,_0xaa5b5c['error']['message']);return _0x5c31ec(_0xaa5b5c[_0xe653('0x11')][_0xe653('0x13')]);}else{logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x4391a4,_0xe653('0xe'));_0x5c31ec(_0xaa5b5c[_0xe653('0x14')]['message']);}})['catch'](function(_0x3088aa){logger[_0xe653('0x11')](_0xe653('0xd'),_0x4391a4,_0x3088aa);_0x50d7e2(_0x3088aa);});});}exports[_0xe653('0x15')]=function(_0x2edbdd){var _0x2fd3a2=this;return new Promise(function(_0x3eb8ef,_0x362763){return db['WhatsappQueueReport'][_0xe653('0x16')](_0x2edbdd[_0xe653('0x17')],{'raw':_0x2edbdd[_0xe653('0x18')]?_0x2edbdd[_0xe653('0x18')][_0xe653('0x19')]===undefined?!![]:![]:!![]})[_0xe653('0x1a')](function(_0x28a31c){logger[_0xe653('0x1b')]('CreateWhatsappQueueReport',_0x2edbdd);logger[_0xe653('0xf')](_0xe653('0x15'),_0x2edbdd,JSON[_0xe653('0x1c')](_0x28a31c));_0x3eb8ef(_0x28a31c);})['catch'](function(_0x8b7b15){logger['error'](_0xe653('0x15'),_0x8b7b15[_0xe653('0x13')],_0x2edbdd);_0x362763(_0x2fd3a2[_0xe653('0x11')](0x1f4,_0x8b7b15[_0xe653('0x13')]));});});};exports[_0xe653('0x1d')]=function(_0x114f55){var _0x1d437a=this;return new Promise(function(_0x1a9894,_0xa74077){return db['WhatsappQueueReport'][_0xe653('0x1e')](_0x114f55[_0xe653('0x17')],{'raw':_0x114f55[_0xe653('0x18')]?_0x114f55[_0xe653('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x114f55[_0xe653('0x18')]?_0x114f55[_0xe653('0x18')][_0xe653('0x1f')]||null:null,'attributes':_0x114f55[_0xe653('0x18')]?_0x114f55['options'][_0xe653('0x20')]||null:null,'limit':_0x114f55[_0xe653('0x18')]?_0x114f55[_0xe653('0x18')]['limit']||null:null})[_0xe653('0x1a')](function(_0x4b1d2b){logger[_0xe653('0x1b')](_0xe653('0x1d'),_0x114f55);logger['debug'](_0xe653('0x1d'),_0x114f55,JSON[_0xe653('0x1c')](_0x4b1d2b));_0x1a9894(_0x4b1d2b);})[_0xe653('0x21')](function(_0x137bc5){logger['error']('UpdateWhatsappQueueReport',_0x137bc5[_0xe653('0x13')],_0x114f55);_0xa74077(_0x1d437a[_0xe653('0x11')](0x1f4,_0x137bc5['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 28a1ad6..c0f27e1 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 _0xe61b=['Router','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','post','put','exports','multer','util','path','connect-timeout','express'];(function(_0x2250da,_0xdb9fe6){var _0x573dc5=function(_0x3f397a){while(--_0x3f397a){_0x2250da['push'](_0x2250da['shift']());}};_0x573dc5(++_0xdb9fe6);}(_0xe61b,0x1cb));var _0xbe61=function(_0x2c534a,_0x18a19e){_0x2c534a=_0x2c534a-0x0;var _0x3f5c99=_0xe61b[_0x2c534a];return _0x3f5c99;};'use strict';var multer=require(_0xbe61('0x0'));var util=require(_0xbe61('0x1'));var path=require(_0xbe61('0x2'));var timeout=require(_0xbe61('0x3'));var express=require(_0xbe61('0x4'));var router=express[_0xbe61('0x5')]();var fs_extra=require(_0xbe61('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbe61('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0xbe61('0x8')]('/',auth[_0xbe61('0x9')](),controller[_0xbe61('0xa')]);router[_0xbe61('0x8')](_0xbe61('0xb'),auth[_0xbe61('0x9')](),controller['describe']);router[_0xbe61('0x8')](_0xbe61('0xc'),auth[_0xbe61('0x9')](),controller['show']);router[_0xbe61('0xd')]('/',auth[_0xbe61('0x9')](),controller['create']);router[_0xbe61('0xe')](_0xbe61('0xc'),auth[_0xbe61('0x9')](),controller['update']);router['delete'](_0xbe61('0xc'),auth[_0xbe61('0x9')](),controller['destroy']);module[_0xbe61('0xf')]=router; \ No newline at end of file +var _0xd8a3=['isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get'];(function(_0x355d8f,_0x1647c8){var _0x4f5a7b=function(_0x1ce4b2){while(--_0x1ce4b2){_0x355d8f['push'](_0x355d8f['shift']());}};_0x4f5a7b(++_0x1647c8);}(_0xd8a3,0x13e));var _0x3d8a=function(_0x25eb9d,_0x44a89b){_0x25eb9d=_0x25eb9d-0x0;var _0x4cf557=_0xd8a3[_0x25eb9d];return _0x4cf557;};'use strict';var multer=require(_0x3d8a('0x0'));var util=require(_0x3d8a('0x1'));var path=require(_0x3d8a('0x2'));var timeout=require(_0x3d8a('0x3'));var express=require(_0x3d8a('0x4'));var router=express[_0x3d8a('0x5')]();var fs_extra=require(_0x3d8a('0x6'));var auth=require(_0x3d8a('0x7'));var interaction=require(_0x3d8a('0x8'));var config=require(_0x3d8a('0x9'));var controller=require(_0x3d8a('0xa'));router[_0x3d8a('0xb')]('/',auth[_0x3d8a('0xc')](),controller[_0x3d8a('0xd')]);router[_0x3d8a('0xb')](_0x3d8a('0xe'),auth[_0x3d8a('0xc')](),controller['describe']);router['get'](_0x3d8a('0xf'),auth[_0x3d8a('0xc')](),controller[_0x3d8a('0x10')]);router[_0x3d8a('0x11')]('/',auth[_0x3d8a('0xc')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x3d8a('0x12')]);router[_0x3d8a('0x13')](_0x3d8a('0xf'),auth[_0x3d8a('0xc')](),controller[_0x3d8a('0x14')]);module[_0x3d8a('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 47adc0e..d181095 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 _0x3609=['STRING','ENUM','account','agent','queue','sequelize','exports'];(function(_0x2f78cb,_0x3bd916){var _0x16d1d7=function(_0x215f90){while(--_0x215f90){_0x2f78cb['push'](_0x2f78cb['shift']());}};_0x16d1d7(++_0x3bd916);}(_0x3609,0x101));var _0x9360=function(_0x16c56f,_0x2b6967){_0x16c56f=_0x16c56f-0x0;var _0x105697=_0x3609[_0x16c56f];return _0x105697;};'use strict';var Sequelize=require(_0x9360('0x0'));module[_0x9360('0x1')]={'uniqueid':{'type':Sequelize[_0x9360('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x9360('0x3')](_0x9360('0x4'),_0x9360('0x5'),_0x9360('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0120=['exports','STRING','ENUM','account','agent','queue','DATE','sequelize'];(function(_0x4d5a4d,_0x1c7249){var _0x55bb93=function(_0x13cc29){while(--_0x13cc29){_0x4d5a4d['push'](_0x4d5a4d['shift']());}};_0x55bb93(++_0x1c7249);}(_0x0120,0x6f));var _0x0012=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x0120[_0x580576];return _0x3f55a0;};'use strict';var Sequelize=require(_0x0012('0x0'));module[_0x0012('0x1')]={'uniqueid':{'type':Sequelize[_0x0012('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x0012('0x3')](_0x0012('0x4'),_0x0012('0x5'),_0x0012('0x6')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0012('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 8ee5328..f3b5cab 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 _0xdc9c=['where','filters','pick','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','create','body','find','describe','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2de6b6,_0x542075){var _0xa4b3d6=function(_0x1e61a6){while(--_0x1e61a6){_0x2de6b6['push'](_0x2de6b6['shift']());}};_0xa4b3d6(++_0x542075);}(_0xdc9c,0xe2));var _0xcdc9=function(_0x1daf8e,_0x3205cc){_0x1daf8e=_0x1daf8e-0x0;var _0x4f4a44=_0xdc9c[_0x1daf8e];return _0x4f4a44;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcdc9('0x0'));var rp=require('request-promise');var moment=require(_0xcdc9('0x1'));var BPromise=require(_0xcdc9('0x2'));var Mustache=require(_0xcdc9('0x3'));var util=require(_0xcdc9('0x4'));var path=require('path');var sox=require(_0xcdc9('0x5'));var csv=require('to-csv');var ejs=require(_0xcdc9('0x6'));var fs=require('fs');var fs_extra=require(_0xcdc9('0x7'));var _=require(_0xcdc9('0x8'));var squel=require(_0xcdc9('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcdc9('0xa'));var Papa=require(_0xcdc9('0xb'));var Redis=require(_0xcdc9('0xc'));var authService=require(_0xcdc9('0xd'));var qs=require(_0xcdc9('0xe'));var as=require(_0xcdc9('0xf'));var hardwareService=require(_0xcdc9('0x10'));var logger=require(_0xcdc9('0x11'))(_0xcdc9('0x12'));var utils=require('../../config/utils');var config=require(_0xcdc9('0x13'));var licenseUtil=require(_0xcdc9('0x14'));var db=require(_0xcdc9('0x15'))['db'];function respondWithStatusCode(_0x55d625,_0x255532){_0x255532=_0x255532||0xcc;return function(_0x11f0e2){if(_0x11f0e2){return _0x55d625[_0xcdc9('0x16')](_0x255532);}return _0x55d625[_0xcdc9('0x17')](_0x255532)[_0xcdc9('0x18')]();};}function respondWithResult(_0x1df9a8,_0x2559dd){_0x2559dd=_0x2559dd||0xc8;return function(_0x397d1e){if(_0x397d1e){return _0x1df9a8[_0xcdc9('0x17')](_0x2559dd)[_0xcdc9('0x19')](_0x397d1e);}};}function respondWithFilteredResult(_0x1df8e6,_0x35303a){return function(_0x100f89){if(_0x100f89){var _0x385770=typeof _0x35303a[_0xcdc9('0x1a')]==='undefined'&&typeof _0x35303a[_0xcdc9('0x1b')]===_0xcdc9('0x1c');var _0x5683c4=_0x100f89[_0xcdc9('0x1d')];var _0x19d34c=_0x385770?0x0:_0x35303a[_0xcdc9('0x1a')];var _0x4ff036=_0x385770?_0x100f89[_0xcdc9('0x1d')]:_0x35303a[_0xcdc9('0x1a')]+_0x35303a[_0xcdc9('0x1b')];var _0x32ca6c;if(_0x4ff036>=_0x5683c4){_0x4ff036=_0x5683c4;_0x32ca6c=0xc8;}else{_0x32ca6c=0xce;}_0x1df8e6[_0xcdc9('0x17')](_0x32ca6c);return _0x1df8e6[_0xcdc9('0x1e')](_0xcdc9('0x1f'),_0x19d34c+'-'+_0x4ff036+'/'+_0x5683c4)[_0xcdc9('0x19')](_0x100f89);}return null;};}function patchUpdates(_0x22a5fe){return function(_0x1809a1){try{jsonpatch[_0xcdc9('0x20')](_0x1809a1,_0x22a5fe,!![]);}catch(_0xd23138){return BPromise[_0xcdc9('0x21')](_0xd23138);}return _0x1809a1[_0xcdc9('0x22')]();};}function saveUpdates(_0x2bffed,_0x1c718a){return function(_0x59cd18){if(_0x59cd18){return _0x59cd18[_0xcdc9('0x23')](_0x2bffed)['then'](function(_0x2c7227){return _0x2c7227;});}return null;};}function removeEntity(_0x2cb3d0,_0x2938cc){return function(_0x23b771){if(_0x23b771){return _0x23b771[_0xcdc9('0x24')]()['then'](function(){_0x2cb3d0[_0xcdc9('0x17')](0xcc)[_0xcdc9('0x18')]();});}};}function handleEntityNotFound(_0x3865be,_0x47b226){return function(_0x2c565c){if(!_0x2c565c){_0x3865be[_0xcdc9('0x16')](0x194);}return _0x2c565c;};}function handleError(_0xe6eab3,_0xad920){_0xad920=_0xad920||0x1f4;return function(_0x187352){logger['error'](_0x187352[_0xcdc9('0x25')]);if(_0x187352[_0xcdc9('0x26')]){delete _0x187352[_0xcdc9('0x26')];}_0xe6eab3[_0xcdc9('0x17')](_0xad920)[_0xcdc9('0x27')](_0x187352);};}exports[_0xcdc9('0x28')]=function(_0x2d8c91,_0x1c75e5){var _0xdead1={},_0x12443f={},_0x464058={'count':0x0,'rows':[]};var _0x502abe=_[_0xcdc9('0x29')](db[_0xcdc9('0x2a')][_0xcdc9('0x2b')],function(_0x1c834d){return{'name':_0x1c834d['fieldName'],'type':_0x1c834d[_0xcdc9('0x2c')][_0xcdc9('0x2d')]};});_0x12443f[_0xcdc9('0x2e')]=_[_0xcdc9('0x29')](_0x502abe,_0xcdc9('0x26'));_0x12443f['query']=_[_0xcdc9('0x2f')](_0x2d8c91[_0xcdc9('0x30')]);_0x12443f['filters']=_['intersection'](_0x12443f[_0xcdc9('0x2e')],_0x12443f['query']);_0xdead1[_0xcdc9('0x31')]=_[_0xcdc9('0x32')](_0x12443f['model'],qs[_0xcdc9('0x33')](_0x2d8c91[_0xcdc9('0x30')][_0xcdc9('0x33')]));_0xdead1[_0xcdc9('0x31')]=_0xdead1[_0xcdc9('0x31')][_0xcdc9('0x34')]?_0xdead1[_0xcdc9('0x31')]:_0x12443f[_0xcdc9('0x2e')];if(!_0x2d8c91[_0xcdc9('0x30')][_0xcdc9('0x35')]('nolimit')){_0xdead1[_0xcdc9('0x1b')]=qs[_0xcdc9('0x1b')](_0x2d8c91[_0xcdc9('0x30')][_0xcdc9('0x1b')]);_0xdead1['offset']=qs[_0xcdc9('0x1a')](_0x2d8c91['query']['offset']);}_0xdead1['order']=qs['sort'](_0x2d8c91[_0xcdc9('0x30')]['sort']);_0xdead1[_0xcdc9('0x36')]=qs[_0xcdc9('0x37')](_[_0xcdc9('0x38')](_0x2d8c91[_0xcdc9('0x30')],_0x12443f[_0xcdc9('0x37')]),_0x502abe);if(_0x2d8c91[_0xcdc9('0x30')]['filter']){_0xdead1['where']=_[_0xcdc9('0x39')](_0xdead1[_0xcdc9('0x36')],{'$or':_[_0xcdc9('0x29')](_0x502abe,function(_0x5db3ab){if(_0x5db3ab[_0xcdc9('0x2c')]!==_0xcdc9('0x3a')){var _0x11935e={};_0x11935e[_0x5db3ab['name']]={'$like':'%'+_0x2d8c91[_0xcdc9('0x30')]['filter']+'%'};return _0x11935e;}})});}_0xdead1=_[_0xcdc9('0x39')]({},_0xdead1,_0x2d8c91[_0xcdc9('0x3b')]);var _0x426c72={'where':_0xdead1[_0xcdc9('0x36')]};return db[_0xcdc9('0x2a')][_0xcdc9('0x1d')](_0x426c72)[_0xcdc9('0x3c')](function(_0x27f438){_0x464058['count']=_0x27f438;if(_0x2d8c91[_0xcdc9('0x30')]['includeAll']){_0xdead1[_0xcdc9('0x3d')]=[{'all':!![]}];}return db[_0xcdc9('0x2a')][_0xcdc9('0x3e')](_0xdead1);})['then'](function(_0x30e353){_0x464058[_0xcdc9('0x3f')]=_0x30e353;return _0x464058;})[_0xcdc9('0x3c')](respondWithFilteredResult(_0x1c75e5,_0xdead1))[_0xcdc9('0x40')](handleError(_0x1c75e5,null));};exports['show']=function(_0x20eae4,_0x13e4cf){var _0x311157={'raw':!![],'where':{'id':_0x20eae4[_0xcdc9('0x41')]['id']}},_0x5c7d01={};_0x5c7d01[_0xcdc9('0x2e')]=_[_0xcdc9('0x2f')](db[_0xcdc9('0x2a')][_0xcdc9('0x2b')]);_0x5c7d01['query']=_[_0xcdc9('0x2f')](_0x20eae4['query']);_0x5c7d01['filters']=_[_0xcdc9('0x32')](_0x5c7d01['model'],_0x5c7d01[_0xcdc9('0x30')]);_0x311157[_0xcdc9('0x31')]=_[_0xcdc9('0x32')](_0x5c7d01[_0xcdc9('0x2e')],qs[_0xcdc9('0x33')](_0x20eae4[_0xcdc9('0x30')][_0xcdc9('0x33')]));_0x311157['attributes']=_0x311157[_0xcdc9('0x31')][_0xcdc9('0x34')]?_0x311157[_0xcdc9('0x31')]:_0x5c7d01[_0xcdc9('0x2e')];if(_0x20eae4[_0xcdc9('0x30')]['includeAll']){_0x311157[_0xcdc9('0x3d')]=[{'all':!![]}];}_0x311157=_['merge']({},_0x311157,_0x20eae4[_0xcdc9('0x3b')]);return db[_0xcdc9('0x2a')]['find'](_0x311157)[_0xcdc9('0x3c')](handleEntityNotFound(_0x13e4cf,null))[_0xcdc9('0x3c')](respondWithResult(_0x13e4cf,null))[_0xcdc9('0x40')](handleError(_0x13e4cf,null));};exports[_0xcdc9('0x42')]=function(_0x1c3c6e,_0x33590d){return db[_0xcdc9('0x2a')]['create'](_0x1c3c6e[_0xcdc9('0x43')],{})[_0xcdc9('0x3c')](respondWithResult(_0x33590d,0xc9))['catch'](handleError(_0x33590d,null));};exports[_0xcdc9('0x23')]=function(_0x40f6ba,_0x14b274){if(_0x40f6ba[_0xcdc9('0x43')]['id']){delete _0x40f6ba[_0xcdc9('0x43')]['id'];}return db['WhatsappTransferReport'][_0xcdc9('0x44')]({'where':{'id':_0x40f6ba[_0xcdc9('0x41')]['id']}})[_0xcdc9('0x3c')](handleEntityNotFound(_0x14b274,null))[_0xcdc9('0x3c')](saveUpdates(_0x40f6ba[_0xcdc9('0x43')],null))[_0xcdc9('0x3c')](respondWithResult(_0x14b274,null))[_0xcdc9('0x40')](handleError(_0x14b274,null));};exports[_0xcdc9('0x24')]=function(_0x526ea6,_0x341c99){return db[_0xcdc9('0x2a')][_0xcdc9('0x44')]({'where':{'id':_0x526ea6[_0xcdc9('0x41')]['id']}})[_0xcdc9('0x3c')](handleEntityNotFound(_0x341c99,null))['then'](removeEntity(_0x341c99,null))[_0xcdc9('0x40')](handleError(_0x341c99,null));};exports['describe']=function(_0xb0a080,_0x39b5e8){return db['WhatsappTransferReport'][_0xcdc9('0x45')]()[_0xcdc9('0x3c')](respondWithResult(_0x39b5e8,null))[_0xcdc9('0x40')](handleError(_0x39b5e8,null));}; \ No newline at end of file +var _0x4cb9=['request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','error','stack','name','map','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','merge','type','VIRTUAL','WhatsappTransferReport','includeAll','include','findAll','catch','show','params','keys','options','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch'];(function(_0x50d40d,_0x1ace27){var _0x5805f7=function(_0x573238){while(--_0x573238){_0x50d40d['push'](_0x50d40d['shift']());}};_0x5805f7(++_0x1ace27);}(_0x4cb9,0x8f));var _0x94cb=function(_0x5e1ca7,_0xfbbac8){_0x5e1ca7=_0x5e1ca7-0x0;var _0x3a50cb=_0x4cb9[_0x5e1ca7];return _0x3a50cb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x94cb('0x0'));var zipdir=require(_0x94cb('0x1'));var jsonpatch=require(_0x94cb('0x2'));var rp=require(_0x94cb('0x3'));var moment=require(_0x94cb('0x4'));var BPromise=require(_0x94cb('0x5'));var Mustache=require(_0x94cb('0x6'));var util=require(_0x94cb('0x7'));var path=require('path');var sox=require(_0x94cb('0x8'));var csv=require(_0x94cb('0x9'));var ejs=require(_0x94cb('0xa'));var fs=require('fs');var fs_extra=require(_0x94cb('0xb'));var _=require(_0x94cb('0xc'));var squel=require(_0x94cb('0xd'));var crypto=require(_0x94cb('0xe'));var jsforce=require(_0x94cb('0xf'));var deskjs=require(_0x94cb('0x10'));var toCsv=require('to-csv');var querystring=require(_0x94cb('0x11'));var Papa=require(_0x94cb('0x12'));var Redis=require(_0x94cb('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x94cb('0x14'));var hardwareService=require(_0x94cb('0x15'));var logger=require('../../config/logger')(_0x94cb('0x16'));var utils=require(_0x94cb('0x17'));var config=require(_0x94cb('0x18'));var licenseUtil=require(_0x94cb('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x275d6d,_0xf9c7dd){_0xf9c7dd=_0xf9c7dd||0xcc;return function(_0x4c5308){if(_0x4c5308){return _0x275d6d[_0x94cb('0x1a')](_0xf9c7dd);}return _0x275d6d[_0x94cb('0x1b')](_0xf9c7dd)[_0x94cb('0x1c')]();};}function respondWithResult(_0x261a97,_0x444332){_0x444332=_0x444332||0xc8;return function(_0x4bfe93){if(_0x4bfe93){return _0x261a97[_0x94cb('0x1b')](_0x444332)[_0x94cb('0x1d')](_0x4bfe93);}};}function respondWithFilteredResult(_0x425996,_0x5ab406){return function(_0x1d8c48){if(_0x1d8c48){var _0x17c6ae=typeof _0x5ab406[_0x94cb('0x1e')]==='undefined'&&typeof _0x5ab406['limit']===_0x94cb('0x1f');var _0x31e3ca=_0x1d8c48['count'];var _0x518239=_0x17c6ae?0x0:_0x5ab406[_0x94cb('0x1e')];var _0x96db62=_0x17c6ae?_0x1d8c48[_0x94cb('0x20')]:_0x5ab406[_0x94cb('0x1e')]+_0x5ab406[_0x94cb('0x21')];var _0x432873;if(_0x96db62>=_0x31e3ca){_0x96db62=_0x31e3ca;_0x432873=0xc8;}else{_0x432873=0xce;}_0x425996[_0x94cb('0x1b')](_0x432873);return _0x425996[_0x94cb('0x22')](_0x94cb('0x23'),_0x518239+'-'+_0x96db62+'/'+_0x31e3ca)['json'](_0x1d8c48);}return null;};}function patchUpdates(_0x5f4c80){return function(_0x2b1c46){try{jsonpatch[_0x94cb('0x24')](_0x2b1c46,_0x5f4c80,!![]);}catch(_0x2f9ebf){return BPromise['reject'](_0x2f9ebf);}return _0x2b1c46['save']();};}function saveUpdates(_0x1dee47,_0x1da4d1){return function(_0x361493){if(_0x361493){return _0x361493['update'](_0x1dee47)[_0x94cb('0x25')](function(_0xcbb185){return _0xcbb185;});}return null;};}function removeEntity(_0x3284ee,_0x20116a){return function(_0x4002d7){if(_0x4002d7){return _0x4002d7[_0x94cb('0x26')]()['then'](function(){_0x3284ee[_0x94cb('0x1b')](0xcc)[_0x94cb('0x1c')]();});}};}function handleEntityNotFound(_0x9baf31,_0x3fedae){return function(_0x290c1d){if(!_0x290c1d){_0x9baf31[_0x94cb('0x1a')](0x194);}return _0x290c1d;};}function handleError(_0x588a79,_0x47a315){_0x47a315=_0x47a315||0x1f4;return function(_0x59152d){logger[_0x94cb('0x27')](_0x59152d[_0x94cb('0x28')]);if(_0x59152d[_0x94cb('0x29')]){delete _0x59152d[_0x94cb('0x29')];}_0x588a79[_0x94cb('0x1b')](_0x47a315)['send'](_0x59152d);};}exports['index']=function(_0x26e9db,_0x468d6a){var _0x4b7a3b={},_0xa63a74={},_0x2a3718={'count':0x0,'rows':[]};var _0x4182f3=_[_0x94cb('0x2a')](db['WhatsappTransferReport']['rawAttributes'],function(_0xfb955){return{'name':_0xfb955[_0x94cb('0x2b')],'type':_0xfb955['type'][_0x94cb('0x2c')]};});_0xa63a74[_0x94cb('0x2d')]=_[_0x94cb('0x2a')](_0x4182f3,_0x94cb('0x29'));_0xa63a74[_0x94cb('0x2e')]=_['keys'](_0x26e9db[_0x94cb('0x2e')]);_0xa63a74['filters']=_[_0x94cb('0x2f')](_0xa63a74[_0x94cb('0x2d')],_0xa63a74[_0x94cb('0x2e')]);_0x4b7a3b[_0x94cb('0x30')]=_[_0x94cb('0x2f')](_0xa63a74[_0x94cb('0x2d')],qs['fields'](_0x26e9db['query'][_0x94cb('0x31')]));_0x4b7a3b[_0x94cb('0x30')]=_0x4b7a3b['attributes'][_0x94cb('0x32')]?_0x4b7a3b[_0x94cb('0x30')]:_0xa63a74[_0x94cb('0x2d')];if(!_0x26e9db[_0x94cb('0x2e')]['hasOwnProperty'](_0x94cb('0x33'))){_0x4b7a3b[_0x94cb('0x21')]=qs[_0x94cb('0x21')](_0x26e9db['query'][_0x94cb('0x21')]);_0x4b7a3b['offset']=qs[_0x94cb('0x1e')](_0x26e9db[_0x94cb('0x2e')]['offset']);}_0x4b7a3b[_0x94cb('0x34')]=qs[_0x94cb('0x35')](_0x26e9db['query'][_0x94cb('0x35')]);_0x4b7a3b[_0x94cb('0x36')]=qs['filters'](_['pick'](_0x26e9db['query'],_0xa63a74[_0x94cb('0x37')]),_0x4182f3);if(_0x26e9db[_0x94cb('0x2e')]['filter']){_0x4b7a3b[_0x94cb('0x36')]=_[_0x94cb('0x38')](_0x4b7a3b[_0x94cb('0x36')],{'$or':_[_0x94cb('0x2a')](_0x4182f3,function(_0x3cb107){if(_0x3cb107[_0x94cb('0x39')]!==_0x94cb('0x3a')){var _0x398f65={};_0x398f65[_0x3cb107['name']]={'$like':'%'+_0x26e9db[_0x94cb('0x2e')]['filter']+'%'};return _0x398f65;}})});}_0x4b7a3b=_['merge']({},_0x4b7a3b,_0x26e9db['options']);var _0x19f214={'where':_0x4b7a3b['where']};return db[_0x94cb('0x3b')]['count'](_0x19f214)[_0x94cb('0x25')](function(_0x271ea8){_0x2a3718[_0x94cb('0x20')]=_0x271ea8;if(_0x26e9db[_0x94cb('0x2e')][_0x94cb('0x3c')]){_0x4b7a3b[_0x94cb('0x3d')]=[{'all':!![]}];}return db[_0x94cb('0x3b')][_0x94cb('0x3e')](_0x4b7a3b);})[_0x94cb('0x25')](function(_0x3712e6){_0x2a3718['rows']=_0x3712e6;return _0x2a3718;})[_0x94cb('0x25')](respondWithFilteredResult(_0x468d6a,_0x4b7a3b))[_0x94cb('0x3f')](handleError(_0x468d6a,null));};exports[_0x94cb('0x40')]=function(_0x5544a2,_0x370b1a){var _0x4976a4={'raw':!![],'where':{'id':_0x5544a2[_0x94cb('0x41')]['id']}},_0x441960={};_0x441960[_0x94cb('0x2d')]=_['keys'](db[_0x94cb('0x3b')]['rawAttributes']);_0x441960[_0x94cb('0x2e')]=_[_0x94cb('0x42')](_0x5544a2[_0x94cb('0x2e')]);_0x441960['filters']=_[_0x94cb('0x2f')](_0x441960['model'],_0x441960[_0x94cb('0x2e')]);_0x4976a4[_0x94cb('0x30')]=_['intersection'](_0x441960['model'],qs['fields'](_0x5544a2[_0x94cb('0x2e')][_0x94cb('0x31')]));_0x4976a4['attributes']=_0x4976a4[_0x94cb('0x30')][_0x94cb('0x32')]?_0x4976a4[_0x94cb('0x30')]:_0x441960[_0x94cb('0x2d')];if(_0x5544a2[_0x94cb('0x2e')][_0x94cb('0x3c')]){_0x4976a4[_0x94cb('0x3d')]=[{'all':!![]}];}_0x4976a4=_['merge']({},_0x4976a4,_0x5544a2[_0x94cb('0x43')]);return db[_0x94cb('0x3b')][_0x94cb('0x44')](_0x4976a4)[_0x94cb('0x25')](handleEntityNotFound(_0x370b1a,null))['then'](respondWithResult(_0x370b1a,null))[_0x94cb('0x3f')](handleError(_0x370b1a,null));};exports[_0x94cb('0x45')]=function(_0x38dd24,_0x274da5){return db['WhatsappTransferReport'][_0x94cb('0x45')](_0x38dd24[_0x94cb('0x46')],{})[_0x94cb('0x25')](respondWithResult(_0x274da5,0xc9))[_0x94cb('0x3f')](handleError(_0x274da5,null));};exports[_0x94cb('0x47')]=function(_0x2d0b91,_0x2c5a2b){if(_0x2d0b91[_0x94cb('0x46')]['id']){delete _0x2d0b91['body']['id'];}return db[_0x94cb('0x3b')][_0x94cb('0x44')]({'where':{'id':_0x2d0b91[_0x94cb('0x41')]['id']}})['then'](handleEntityNotFound(_0x2c5a2b,null))['then'](saveUpdates(_0x2d0b91[_0x94cb('0x46')],null))['then'](respondWithResult(_0x2c5a2b,null))['catch'](handleError(_0x2c5a2b,null));};exports[_0x94cb('0x26')]=function(_0x586734,_0x27b555){return db['WhatsappTransferReport'][_0x94cb('0x44')]({'where':{'id':_0x586734[_0x94cb('0x41')]['id']}})[_0x94cb('0x25')](handleEntityNotFound(_0x27b555,null))[_0x94cb('0x25')](removeEntity(_0x27b555,null))[_0x94cb('0x3f')](handleError(_0x27b555,null));};exports[_0x94cb('0x48')]=function(_0x2ef688,_0x3617ac){return db['WhatsappTransferReport'][_0x94cb('0x48')]()[_0x94cb('0x25')](respondWithResult(_0x3617ac,null))['catch'](handleError(_0x3617ac,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 766ed76..e3988d5 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 _0xc021=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','uniqueid','util'];(function(_0x20a37d,_0x5efaed){var _0x242e8c=function(_0x475639){while(--_0x475639){_0x20a37d['push'](_0x20a37d['shift']());}};_0x242e8c(++_0x5efaed);}(_0xc021,0xaf));var _0x1c02=function(_0x50a5a7,_0x54f4d2){_0x50a5a7=_0x50a5a7-0x0;var _0x49f909=_0xc021[_0x50a5a7];return _0x49f909;};'use strict';var _=require('lodash');var util=require(_0x1c02('0x0'));var logger=require(_0x1c02('0x1'))(_0x1c02('0x2'));var moment=require(_0x1c02('0x3'));var BPromise=require(_0x1c02('0x4'));var rp=require(_0x1c02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1c02('0x6'));var config=require(_0x1c02('0x7'));var attributes=require('./whatsappTransferReport.attributes');module[_0x1c02('0x8')]=function(_0x5f03e,_0x7aa269){return _0x5f03e[_0x1c02('0x9')]('WhatsappTransferReport',attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0x1c02('0xa'),'fields':[_0x1c02('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd1e3=['./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x38d6ca,_0x3aac21){var _0x53c02d=function(_0x5b2064){while(--_0x5b2064){_0x38d6ca['push'](_0x38d6ca['shift']());}};_0x53c02d(++_0x3aac21);}(_0xd1e3,0x6f));var _0x3d1e=function(_0x4456a2,_0x376ff2){_0x4456a2=_0x4456a2-0x0;var _0xf36b56=_0xd1e3[_0x4456a2];return _0xf36b56;};'use strict';var _=require(_0x3d1e('0x0'));var util=require(_0x3d1e('0x1'));var logger=require(_0x3d1e('0x2'))(_0x3d1e('0x3'));var moment=require(_0x3d1e('0x4'));var BPromise=require(_0x3d1e('0x5'));var rp=require(_0x3d1e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3d1e('0x7'));var config=require(_0x3d1e('0x8'));var attributes=require(_0x3d1e('0x9'));module[_0x3d1e('0xa')]=function(_0x110bdc,_0x116db4){return _0x110bdc[_0x3d1e('0xb')](_0x3d1e('0xc'),attributes,{'tableName':_0x3d1e('0xd'),'paranoid':![],'indexes':[{'name':_0x3d1e('0xe'),'fields':[_0x3d1e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 61478db..ac0c154 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 _0xedb1=['code','WhatsappTransferReport,\x20%s,\x20%s','message','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x5362c8,_0x578457){var _0x2eabce=function(_0x4c45ed){while(--_0x4c45ed){_0x5362c8['push'](_0x5362c8['shift']());}};_0x2eabce(++_0x578457);}(_0xedb1,0x179));var _0x1edb=function(_0x110b66,_0x1e73ca){_0x110b66=_0x110b66-0x0;var _0x2b2d06=_0xedb1[_0x110b66];return _0x2b2d06;};'use strict';var _=require(_0x1edb('0x0'));var util=require(_0x1edb('0x1'));var moment=require(_0x1edb('0x2'));var BPromise=require('bluebird');var rs=require(_0x1edb('0x3'));var fs=require('fs');var Redis=require(_0x1edb('0x4'));var db=require(_0x1edb('0x5'))['db'];var utils=require(_0x1edb('0x6'));var logger=require(_0x1edb('0x7'))('rpc');var config=require(_0x1edb('0x8'));var jayson=require(_0x1edb('0x9'));var client=jayson[_0x1edb('0xa')][_0x1edb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b9820,_0xa62ddd,_0x4b2325){return new BPromise(function(_0xeb828a,_0x2d415c){return client[_0x1edb('0xc')](_0x5b9820,_0x4b2325)[_0x1edb('0xd')](function(_0x4b7527){logger[_0x1edb('0xe')]('WhatsappTransferReport,\x20%s,\x20%s',_0xa62ddd,'request\x20sent');logger[_0x1edb('0xf')](_0x1edb('0x10'),_0xa62ddd,_0x1edb('0x11'),JSON['stringify'](_0x4b7527));if(_0x4b7527[_0x1edb('0x12')]){if(_0x4b7527[_0x1edb('0x12')][_0x1edb('0x13')]===0x1f4){logger['error'](_0x1edb('0x14'),_0xa62ddd,_0x4b7527['error'][_0x1edb('0x15')]);return _0x2d415c(_0x4b7527[_0x1edb('0x12')][_0x1edb('0x15')]);}logger['error'](_0x1edb('0x14'),_0xa62ddd,_0x4b7527[_0x1edb('0x12')][_0x1edb('0x15')]);return _0xeb828a(_0x4b7527[_0x1edb('0x12')][_0x1edb('0x15')]);}else{logger[_0x1edb('0xe')](_0x1edb('0x14'),_0xa62ddd,_0x1edb('0x11'));_0xeb828a(_0x4b7527['result'][_0x1edb('0x15')]);}})['catch'](function(_0x4367aa){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0xa62ddd,_0x4367aa);_0x2d415c(_0x4367aa);});});} \ No newline at end of file +var _0x71f8=['message','request\x20sent','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x71f8,0x1b3));var _0x871f=function(_0x520733,_0x45f647){_0x520733=_0x520733-0x0;var _0x58fdf1=_0x71f8[_0x520733];return _0x58fdf1;};'use strict';var _=require(_0x871f('0x0'));var util=require('util');var moment=require(_0x871f('0x1'));var BPromise=require(_0x871f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x871f('0x3'));var db=require(_0x871f('0x4'))['db'];var utils=require(_0x871f('0x5'));var logger=require(_0x871f('0x6'))(_0x871f('0x7'));var config=require(_0x871f('0x8'));var jayson=require(_0x871f('0x9'));var client=jayson[_0x871f('0xa')][_0x871f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x58a3a7,_0x24f239,_0x1d8f0d){return new BPromise(function(_0x32f942,_0x1208d4){return client[_0x871f('0xc')](_0x58a3a7,_0x1d8f0d)[_0x871f('0xd')](function(_0x258d88){logger[_0x871f('0xe')](_0x871f('0xf'),_0x24f239,'request\x20sent');logger[_0x871f('0x10')](_0x871f('0x11'),_0x24f239,'request\x20sent',JSON[_0x871f('0x12')](_0x258d88));if(_0x258d88[_0x871f('0x13')]){if(_0x258d88[_0x871f('0x13')][_0x871f('0x14')]===0x1f4){logger[_0x871f('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x24f239,_0x258d88[_0x871f('0x13')][_0x871f('0x15')]);return _0x1208d4(_0x258d88[_0x871f('0x13')][_0x871f('0x15')]);}logger[_0x871f('0x13')]('WhatsappTransferReport,\x20%s,\x20%s',_0x24f239,_0x258d88[_0x871f('0x13')][_0x871f('0x15')]);return _0x32f942(_0x258d88['error'][_0x871f('0x15')]);}else{logger[_0x871f('0xe')](_0x871f('0xf'),_0x24f239,_0x871f('0x16'));_0x32f942(_0x258d88['result'][_0x871f('0x15')]);}})[_0x871f('0x17')](function(_0x4b471e){logger['error'](_0x871f('0xf'),_0x24f239,_0x4b471e);_0x1208d4(_0x4b471e);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 52317c3..d00c5ff 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x30bc=['status','log','App\x20Ready!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then','seedDB','listen','info','start','filter','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','online','join','Offline\x20apps:'];(function(_0xc0bc7f,_0x51678d){var _0x5a5597=function(_0x3c05a3){while(--_0x3c05a3){_0xc0bc7f['push'](_0xc0bc7f['shift']());}};_0x5a5597(++_0x51678d);}(_0x30bc,0x149));var _0xc30b=function(_0x205852,_0x184d90){_0x205852=_0x205852-0x0;var _0x491d8d=_0x30bc[_0x205852];return _0x491d8d;};'use strict';var _=require(_0xc30b('0x0'));var db=require(_0xc30b('0x1'))['db'];var seedDb=require(_0xc30b('0x2'));var checkLicense=require('./config/license');var rpc=require(_0xc30b('0x3'));var config=require(_0xc30b('0x4'));var logger=require(_0xc30b('0x5'))(_0xc30b('0x6'));var pm2=require(_0xc30b('0x7'));var pm2Config=require(_0xc30b('0x8'));var schedule=require(_0xc30b('0x9'));var chat=require(_0xc30b('0xa'));var whatsapp=require(_0xc30b('0xb'));var transcribe=require(_0xc30b('0xc'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0xc30b('0xd')][_0xc30b('0xe')]()[_0xc30b('0xf')](function(){if(config[_0xc30b('0x10')]){return seedDb['default']();}})[_0xc30b('0xf')](function(){return checkLicense['default']();})[_0xc30b('0xf')](function(){return rpc[_0xc30b('0x11')]();})['then'](function(_0x5a9807){logger[_0xc30b('0x12')](_0x5a9807);return chat[_0xc30b('0x13')]();})[_0xc30b('0xf')](function(){return whatsapp[_0xc30b('0x13')]();})[_0xc30b('0xf')](function(){return schedule[_0xc30b('0x13')]();})['then'](function(){return transcribe[_0xc30b('0x13')]();})[_0xc30b('0xf')](function(){return provider['start']();})[_0xc30b('0xf')](function(_0x45f6b3){logger['info'](_0x45f6b3);return pm2[_0xc30b('0x13')](pm2Config);})['then'](function(_0x58fb81){var _0x4d7725=_0x58fb81[_0xc30b('0x14')](function(_0x56e53c){return typeof _0x56e53c[_0xc30b('0x15')]===_0xc30b('0x16')&&_0x56e53c[_0xc30b('0x15')]>=0x0;});if(_0x4d7725[_0xc30b('0x17')]>0x0){throw new Error(_0x4d7725['length']+_0xc30b('0x18')+_[_0xc30b('0x19')](_0x4d7725,function(_0x1cd5de){return'\x22'+_0x1cd5de[_0xc30b('0x1a')][_0xc30b('0x1b')]+'\x22';}));}logger[_0xc30b('0x12')]('Online\x20apps:',_[_0xc30b('0x19')](_[_0xc30b('0x14')](_0x58fb81,{'status':_0xc30b('0x1c')}),_0xc30b('0x1b'))[_0xc30b('0x1d')]());logger[_0xc30b('0x12')](_0xc30b('0x1e'),_['map'](_[_0xc30b('0x14')](_0x58fb81,function(_0x513d86){return _0x513d86[_0xc30b('0x1f')]!==_0xc30b('0x1c');}),_0xc30b('0x1b'))[_0xc30b('0x1d')]()||'None');console[_0xc30b('0x20')](_0xc30b('0x21'));})['catch'](function(_0x504514){console[_0xc30b('0x20')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x504514);logger['error'](_0xc30b('0x22'),_0x504514);process[_0xc30b('0x23')](0x1);});}main(); \ No newline at end of file +var _0xf842=['seedDB','default','listen','info','start','filter','exitCode','length','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','None','log','App\x20Ready!','catch','error','exit','lodash','./mysqldb','./config/seedDB','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','sequelize','sync','then'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0xf842,0x172));var _0x2f84=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0xf842[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x2f84('0x0'));var db=require(_0x2f84('0x1'))['db'];var seedDb=require(_0x2f84('0x2'));var checkLicense=require(_0x2f84('0x3'));var rpc=require('./rpc');var config=require(_0x2f84('0x4'));var logger=require(_0x2f84('0x5'))(_0x2f84('0x6'));var pm2=require(_0x2f84('0x7'));var pm2Config=require(_0x2f84('0x8'));var schedule=require('./config/schedule');var chat=require(_0x2f84('0x9'));var whatsapp=require(_0x2f84('0xa'));var transcribe=require(_0x2f84('0xb'));var provider=require('./config/schedule/cloud-provider');function main(){return db[_0x2f84('0xc')][_0x2f84('0xd')]()[_0x2f84('0xe')](function(){if(config[_0x2f84('0xf')]){return seedDb[_0x2f84('0x10')]();}})[_0x2f84('0xe')](function(){return checkLicense[_0x2f84('0x10')]();})[_0x2f84('0xe')](function(){return rpc[_0x2f84('0x11')]();})[_0x2f84('0xe')](function(_0x4edf3b){logger[_0x2f84('0x12')](_0x4edf3b);return chat['start']();})[_0x2f84('0xe')](function(){return whatsapp[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(){return schedule[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(){return transcribe[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(){return provider[_0x2f84('0x13')]();})[_0x2f84('0xe')](function(_0x20e0d0){logger[_0x2f84('0x12')](_0x20e0d0);return pm2[_0x2f84('0x13')](pm2Config);})['then'](function(_0x489f51){var _0x50d906=_0x489f51[_0x2f84('0x14')](function(_0x4073d6){return typeof _0x4073d6[_0x2f84('0x15')]==='number'&&_0x4073d6[_0x2f84('0x15')]>=0x0;});if(_0x50d906[_0x2f84('0x16')]>0x0){throw new Error(_0x50d906[_0x2f84('0x16')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x2f84('0x17')](_0x50d906,function(_0xbe3e4f){return'\x22'+_0xbe3e4f[_0x2f84('0x18')][_0x2f84('0x19')]+'\x22';}));}logger['info'](_0x2f84('0x1a'),_['map'](_[_0x2f84('0x14')](_0x489f51,{'status':'online'}),'name')[_0x2f84('0x1b')]());logger[_0x2f84('0x12')](_0x2f84('0x1c'),_[_0x2f84('0x17')](_[_0x2f84('0x14')](_0x489f51,function(_0x4600af){return _0x4600af['status']!=='online';}),_0x2f84('0x19'))[_0x2f84('0x1b')]()||_0x2f84('0x1d'));console[_0x2f84('0x1e')](_0x2f84('0x1f'));})[_0x2f84('0x20')](function(_0x546447){console[_0x2f84('0x1e')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x546447);logger[_0x2f84('0x21')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x546447);process[_0x2f84('0x22')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index db26b12..05eb1a5 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 _0xbf49=['test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','updatePasswordsHistory','length','splice','unshift','sign','session','options','promisify','verify','randomBytes','toString','hex','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','bluebird','util','moment','secrets','role','fullname','name','email','userpic','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','forceDownload','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','Basic','User','then','authenticate','pass','user','Bearer','status','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','Setting','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockedAt','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0x3a76c9,_0xf47eb4){var _0x5d56a3=function(_0x563f6){while(--_0x563f6){_0x3a76c9['push'](_0x3a76c9['shift']());}};_0x5d56a3(++_0xf47eb4);}(_0xbf49,0x11d));var _0x9bf4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbf49[_0x3dd15e];return _0x231fd0;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x9bf4('0x0'));var hardwareConf=require(_0x9bf4('0x1'));var licenseUtil=require(_0x9bf4('0x2'));var encryptor=require(_0x9bf4('0x3'));var _=require(_0x9bf4('0x4'));var jwt=require(_0x9bf4('0x5'));var expressJwt=require('express-jwt');var compose=require(_0x9bf4('0x6'));var basicAuth=require('basic-auth');var crypto=require('crypto');var BPromise=require(_0x9bf4('0x7'));var util=require(_0x9bf4('0x8'));var moment=require(_0x9bf4('0x9'));var validateJwt=expressJwt({'secret':config[_0x9bf4('0xa')]['session']});var userAttributes=['id',_0x9bf4('0xb'),_0x9bf4('0xc'),_0x9bf4('0xd'),'internal',_0x9bf4('0xe'),_0x9bf4('0xf'),'permissions',_0x9bf4('0x10'),_0x9bf4('0x11'),_0x9bf4('0x12'),_0x9bf4('0x13'),_0x9bf4('0x14'),_0x9bf4('0x15'),_0x9bf4('0x16'),_0x9bf4('0x17'),_0x9bf4('0x18'),'lastLoginAt',_0x9bf4('0x19'),_0x9bf4('0x1a'),'allowmessenger',_0x9bf4('0x1b'),'alias',_0x9bf4('0x1c'),'phoneBarAutoAnswerDelay',_0x9bf4('0x1d'),_0x9bf4('0x1e'),_0x9bf4('0x1f'),_0x9bf4('0x20'),_0x9bf4('0x21'),'phoneBarPrefixRequired',_0x9bf4('0x22'),_0x9bf4('0x23'),'hotdesk',_0x9bf4('0x24'),'userProfileId','privacyEnabled',_0x9bf4('0x25'),_0x9bf4('0x26'),_0x9bf4('0x27'),'downloadOmnichannelInteractions',_0x9bf4('0x28'),_0x9bf4('0x29'),_0x9bf4('0x2a'),_0x9bf4('0x2b'),'chatAutoanswerDelay',_0x9bf4('0x2c'),'emailAutoanswerDelay','smsAutoanswer',_0x9bf4('0x2d'),_0x9bf4('0x2e'),_0x9bf4('0x2f'),_0x9bf4('0x30'),'faxAutoanswerDelay',_0x9bf4('0x31'),_0x9bf4('0x32'),_0x9bf4('0x33')];exports[_0x9bf4('0x34')]=function(){return this[_0x9bf4('0x35')](!![])[_0x9bf4('0x36')](function(_0x248335,_0x27c1cf,_0x6efbbb){if(_0x248335['user']){_0x6efbbb();}else{return db[_0x9bf4('0x37')][_0x9bf4('0x38')]({'where':{'id':_0x248335[_0x9bf4('0x39')]['id']},'attributes':['id',_0x9bf4('0x3a'),_0x9bf4('0x3b')],'raw':!![]})['then'](function(_0x445af0){if(_0x445af0&&_0x445af0[_0x9bf4('0x3a')]&&!_0x248335['query'][_0x9bf4('0x3c')]){return _0x27c1cf['status'](_0x445af0[_0x9bf4('0x3b')]===_0x9bf4('0x3d')?0x195:0x193)[_0x9bf4('0x3e')]({'message':_0x445af0[_0x9bf4('0x3b')]===_0x9bf4('0x3d')?_0x9bf4('0x3f'):_0x9bf4('0x40')});}else{_0x6efbbb();}})[_0x9bf4('0x41')](function(_0x2ae91c){_0x6efbbb(_0x2ae91c);});}});};exports['isAuthenticated']=function isAuthenticated(_0xd098e8){return compose()[_0x9bf4('0x36')](function(_0x348cad,_0x1200d6,_0x3d53e1){var _0x57cf4f;if(_0x348cad[_0x9bf4('0x42')][_0x9bf4('0x43')]){if(_[_0x9bf4('0x44')](_0x348cad[_0x9bf4('0x42')][_0x9bf4('0x43')],_0x9bf4('0x45'))){var _0x7f4e3b=basicAuth(_0x348cad);db[_0x9bf4('0x46')]['find']({'where':{'name':_0x7f4e3b[_0x9bf4('0xd')]}})[_0x9bf4('0x47')](function(_0x2f607f){if(!_0x2f607f||!_0x2f607f[_0x9bf4('0x48')](_0x7f4e3b[_0x9bf4('0x49')])){return _0x1200d6['status'](0x191)[_0x9bf4('0x3e')]({'message':'Wrong\x20credentials.'});}_0x348cad[_0x9bf4('0x4a')]={'id':_0x2f607f['id']};_0x3d53e1();})['catch'](function(_0x3af595){_0x3d53e1(_0x3af595);});}else if(_[_0x9bf4('0x44')](_0x348cad[_0x9bf4('0x42')][_0x9bf4('0x43')],_0x9bf4('0x4b'))){validateJwt(_0x348cad,_0x1200d6,_0x3d53e1);}else{if(_0xd098e8){_0x3d53e1();}else{return _0x1200d6[_0x9bf4('0x4c')](0x193)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x4d')});}}}else if(_0x348cad[_0x9bf4('0x4e')][_0x9bf4('0x4f')]){try{var _0x3830f9={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x9bf4('0x50')]()};verifyJwt(_0x348cad[_0x9bf4('0x4e')]['apikey'],_0x3830f9)[_0x9bf4('0x47')](function(_0x363762){return db[_0x9bf4('0x46')][_0x9bf4('0x51')]({'where':{'id':_0x363762[_0x9bf4('0x52')]}})[_0x9bf4('0x47')](function(_0x3818ea){_0x57cf4f=_0x3818ea;return db[_0x9bf4('0x53')][_0x9bf4('0x38')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9bf4('0x54')],'raw':!![]});})[_0x9bf4('0x47')](function(_0x4870a7){if(!_0x57cf4f||!_[_0x9bf4('0x55')](_0x57cf4f[_0x9bf4('0x56')],_0x363762['nonce'])){return _0x1200d6['status'](0x191)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x57')});}if(_0x57cf4f[_0x9bf4('0x58')]){return _0x1200d6[_0x9bf4('0x4c')](0x191)[_0x9bf4('0x3e')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x57cf4f['blocked']){if(_0x4870a7[_0x9bf4('0x54')]>0x0){if(moment(_0x57cf4f[_0x9bf4('0x59')])['add'](_0x4870a7[_0x9bf4('0x54')],'minutes')>moment()){return _0x1200d6[_0x9bf4('0x4c')](0x191)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5a')});}}else{return _0x1200d6['status'](0x191)['json']({'message':_0x9bf4('0x5a')});}}_0x348cad[_0x9bf4('0x4a')]={'id':_0x57cf4f['id']};_0x3d53e1();});})[_0x9bf4('0x41')](function(){return _0x1200d6[_0x9bf4('0x4c')](0x191)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5a')});});}catch(_0x10dca1){_0x3d53e1(_0x10dca1);}}else if(_0xd098e8){_0x3d53e1();}else{return _0x1200d6[_0x9bf4('0x4c')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x9bf4('0x36')](function(_0x2c7959,_0x314459,_0xacd121){if(_0x2c7959[_0x9bf4('0x4a')]){db[_0x9bf4('0x46')][_0x9bf4('0x51')]({'where':{'id':_0x2c7959[_0x9bf4('0x4a')]['id']},'attributes':userAttributes})[_0x9bf4('0x47')](function(_0x18a9bd){if(!_0x18a9bd){return _0x314459[_0x9bf4('0x4c')](0x194)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5b')});}_0x2c7959[_0x9bf4('0x4a')]=_0x18a9bd;_0xacd121();})[_0x9bf4('0x41')](function(_0x550ecd){_0xacd121(_0x550ecd);});}else if(_0xd098e8){_0xacd121();}else{return _0x314459[_0x9bf4('0x4c')](0x194)['json']({'message':_0x9bf4('0x5c')});}});};exports['canUpdate']=function canUpdate(){return compose()['use'](function(_0x5d3ff4,_0x35e3c3,_0x16bc09){return licenseUtil[_0x9bf4('0x5d')]()[_0x9bf4('0x47')](function(_0x3f0fe3){if(_0x3f0fe3[_0x9bf4('0x5e')]){_0x16bc09();}else{return _0x35e3c3[_0x9bf4('0x4c')](0x193)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5f')});}})[_0x9bf4('0x41')](function(_0x599688){_0x16bc09(_0x599688);});});};exports[_0x9bf4('0x60')]=function isWebrtcLicence(){return compose()[_0x9bf4('0x36')](function(_0x19f5cb,_0x3ad773,_0x4589ae){return licenseUtil['getLicense']()[_0x9bf4('0x47')](function(_0x260f5a){if(_0x260f5a['webrtc']){_0x4589ae();}else{return _0x3ad773[_0x9bf4('0x4c')](0x193)[_0x9bf4('0x3e')]({'message':_0x9bf4('0x5f')});}})[_0x9bf4('0x41')](function(_0x514fcd){_0x4589ae(_0x514fcd);});});};exports[_0x9bf4('0x61')]=function(_0x57e7bf,_0x469eac,_0x950c21){_0x57e7bf[_0x9bf4('0x61')]=!![];return _0x950c21();};exports['signToken']=function signToken(_0x3a89ee){return signJwt(_0x3a89ee);};exports[_0x9bf4('0x62')]=function(_0x139f8f,_0x5d6756){if(!_0x139f8f['user']){return _0x5d6756[_0x9bf4('0x4c')](0x194)[_0x9bf4('0x3e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x3a0c14={'payload':{'id':_0x139f8f['user']['id'],'role':_0x139f8f['user'][_0x9bf4('0xb')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3a0c14)['then'](function(_0x3a94b8){_0x5d6756[_0x9bf4('0x63')](_0x9bf4('0x64'),_0x3a94b8);_0x5d6756[_0x9bf4('0x65')](_0x9bf4('0x66'));})[_0x9bf4('0x41')](function(_0x5cecda){return _0x5d6756[_0x9bf4('0x4c')](0x1f4)[_0x9bf4('0x67')](_0x5cecda);});};exports['retrieveApiKey']=function(_0x2fb7a0){if(_[_0x9bf4('0x68')](_0x2fb7a0['apiKeyNonce'])||_[_0x9bf4('0x68')](_0x2fb7a0[_0x9bf4('0x69')])){return null;}else{return createJwt(_0x2fb7a0);}};exports['generateApiKey']=function(_0x38d43f){_0x38d43f[_0x9bf4('0x56')]=generateNonce();_0x38d43f[_0x9bf4('0x69')]=generateIssuedAt();return createJwt(_0x38d43f);};exports[_0x9bf4('0x6a')]=function(_0x75fce8,_0x24334b){var _0x3d729e=_0x75fce8['query'][_0x9bf4('0x4f')];if(_0x3d729e){var _0x5b9862={'nonce':_0x24334b['apiKeyNonce'],'iat':_0x24334b[_0x9bf4('0x69')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x9bf4('0x50')]()};return verifyJwt(_0x3d729e,_0x5b9862)[_0x9bf4('0x47')](function(){return generateApiKey(_0x24334b);});}else{throw{'message':_0x9bf4('0x6b')};}};exports['validatePasswordPattern']=function(_0x3e60de){var _0xa20ec5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xa20ec5[_0x9bf4('0x6c')](_0x3e60de))throw new db[(_0x9bf4('0x6d'))][(_0x9bf4('0x6e'))](_0x9bf4('0x6f'));return;};exports[_0x9bf4('0x70')]=function(_0x3fc29a,_0x4318a4,_0xecc48c){var _0x2b751e=encryptor[_0x9bf4('0x71')](_0x4318a4)[_0x9bf4('0x72')](',');for(var _0x960b81=0x0;_0x960b81<_0xecc48c;_0x960b81++){if(!_0x2b751e[_0x960b81])break;if(_0x3fc29a['toLowerCase']()===_0x2b751e[_0x960b81][_0x9bf4('0x73')]()){var _0x9f41f7=util[_0x9bf4('0x74')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0xecc48c);if(_0xecc48c===0x1){_0x9f41f7='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db['Sequelize'][(_0x9bf4('0x6e'))](_0x9f41f7);}}return;};exports[_0x9bf4('0x75')]=function(_0xfc46a9,_0x318bbd){var _0x25f59e=_0x318bbd?encryptor[_0x9bf4('0x71')](_0x318bbd)[_0x9bf4('0x72')](','):[];if(_0x25f59e[_0x9bf4('0x76')]===0x5){_0x25f59e[_0x9bf4('0x77')](-0x1,0x1);}_0x25f59e[_0x9bf4('0x78')](_0xfc46a9);return encryptor['encryptString'](_0x25f59e['join'](','));};function signJwt(_0x4d0c5d){var _0x27e4aa=BPromise['promisify'](jwt[_0x9bf4('0x79')],{'context':jwt});var _0x4e0b3c=_0x4d0c5d['secret']||config['secrets'][_0x9bf4('0x7a')];return new BPromise(function(_0x5743c0,_0x46fdc2){_0x27e4aa(_0x4d0c5d['payload'],_0x4e0b3c,_0x4d0c5d[_0x9bf4('0x7b')])[_0x9bf4('0x47')](function(_0x1aee50){_0x5743c0(_0x1aee50);})[_0x9bf4('0x41')](function(_0x3495c2){_0x46fdc2(_0x3495c2);});});}function verifyJwt(_0x772a71,_0x1e4127,_0x5050e2){var _0x2c25f1=BPromise[_0x9bf4('0x7c')](jwt[_0x9bf4('0x7d')],{'context':jwt});var _0x7d106d=_0x5050e2||config[_0x9bf4('0xa')][_0x9bf4('0x7a')];return new BPromise(function(_0x310d93,_0x486a83){_0x2c25f1(_0x772a71,_0x7d106d,_0x1e4127)['then'](function(_0x3ab6af){_0x310d93(_0x3ab6af);})[_0x9bf4('0x41')](function(_0x26ad00){_0x486a83(_0x26ad00);});});}function generateNonce(){return crypto[_0x9bf4('0x7e')](0x10)[_0x9bf4('0x7f')](_0x9bf4('0x80'));}function generateIssuedAt(){return Math['floor'](Date[_0x9bf4('0x81')]()/0x3e8)[_0x9bf4('0x7f')]();}function createJwt(_0x37a64a){var _0x39409f={'payload':{'iat':_0x37a64a[_0x9bf4('0x69')],'nonce':_0x37a64a['apiKeyNonce']},'options':{'algorithm':_0x9bf4('0x82'),'subject':_0x37a64a['id'][_0x9bf4('0x7f')](),'issuer':hardwareConf[_0x9bf4('0x50')](),'audience':hardwareConf[_0x9bf4('0x50')]()}};return signJwt(_0x39409f)[_0x9bf4('0x47')](function(_0x4c739f){return{'iat':_0x37a64a[_0x9bf4('0x69')],'nonce':_0x37a64a[_0x9bf4('0x56')],'token':_0x4c739f};});} \ No newline at end of file +var _0x0e22=['../../config/license/util','../encryptor','express-jwt','composable-middleware','basic-auth','crypto','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControlPort','hotdesk','interface','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','user','ChatInteraction','params','closed','disposition','then','query','status','json','unmanaged','Unmanaged.','Forbidden.','catch','isAuthenticated','headers','authorization','startsWith','Basic','User','find','name','Wrong\x20credentials.','Unknown\x20authorization\x20format','apikey','getUuid','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockDuration','blockedAt','add','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','split','length','splice','encryptString','sign','payload','options','promisify','verify','hex','floor','toString','../../mysqldb','../../config/environment','../../config/license/hardware'];(function(_0x41a695,_0xdff070){var _0x248087=function(_0x5d886e){while(--_0x5d886e){_0x41a695['push'](_0x41a695['shift']());}};_0x248087(++_0xdff070);}(_0x0e22,0x195));var _0x20e2=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x0e22[_0x3ec122];return _0x4ecf41;};'use strict';var db=require(_0x20e2('0x0'))['db'];var config=require(_0x20e2('0x1'));var hardwareConf=require(_0x20e2('0x2'));var licenseUtil=require(_0x20e2('0x3'));var encryptor=require(_0x20e2('0x4'));var _=require('lodash');var jwt=require('jsonwebtoken');var expressJwt=require(_0x20e2('0x5'));var compose=require(_0x20e2('0x6'));var basicAuth=require(_0x20e2('0x7'));var crypto=require(_0x20e2('0x8'));var BPromise=require('bluebird');var util=require(_0x20e2('0x9'));var moment=require(_0x20e2('0xa'));var validateJwt=expressJwt({'secret':config[_0x20e2('0xb')][_0x20e2('0xc')]});var userAttributes=['id',_0x20e2('0xd'),_0x20e2('0xe'),'name',_0x20e2('0xf'),_0x20e2('0x10'),_0x20e2('0x11'),_0x20e2('0x12'),_0x20e2('0x13'),_0x20e2('0x14'),_0x20e2('0x15'),_0x20e2('0x16'),_0x20e2('0x17'),'smsPause','openchannelPause',_0x20e2('0x18'),_0x20e2('0x19'),_0x20e2('0x1a'),_0x20e2('0x1b'),_0x20e2('0x1c'),_0x20e2('0x1d'),_0x20e2('0x1e'),_0x20e2('0x1f'),_0x20e2('0x20'),_0x20e2('0x21'),'phoneBarDnd',_0x20e2('0x22'),_0x20e2('0x23'),_0x20e2('0x24'),_0x20e2('0x25'),_0x20e2('0x26'),'phoneBarRemoteControl',_0x20e2('0x27'),_0x20e2('0x28'),_0x20e2('0x29'),'userProfileId','privacyEnabled',_0x20e2('0x2a'),_0x20e2('0x2b'),_0x20e2('0x2c'),_0x20e2('0x2d'),_0x20e2('0x2e'),_0x20e2('0x2f'),_0x20e2('0x30'),'chatAutoanswer',_0x20e2('0x31'),_0x20e2('0x32'),_0x20e2('0x33'),'smsAutoanswer',_0x20e2('0x34'),_0x20e2('0x35'),_0x20e2('0x36'),_0x20e2('0x37'),_0x20e2('0x38'),_0x20e2('0x39'),_0x20e2('0x3a'),_0x20e2('0x3b')];exports[_0x20e2('0x3c')]=function(){return this['isAuthenticated'](!![])[_0x20e2('0x3d')](function(_0x22b38b,_0x3a4ad3,_0x155df5){if(_0x22b38b[_0x20e2('0x3e')]){_0x155df5();}else{return db[_0x20e2('0x3f')]['findOne']({'where':{'id':_0x22b38b[_0x20e2('0x40')]['id']},'attributes':['id',_0x20e2('0x41'),_0x20e2('0x42')],'raw':!![]})[_0x20e2('0x43')](function(_0x9892ac){if(_0x9892ac&&_0x9892ac['closed']&&!_0x22b38b[_0x20e2('0x44')]['forceDownload']){return _0x3a4ad3[_0x20e2('0x45')](_0x9892ac[_0x20e2('0x42')]==='unmanaged'?0x195:0x193)[_0x20e2('0x46')]({'message':_0x9892ac[_0x20e2('0x42')]===_0x20e2('0x47')?_0x20e2('0x48'):_0x20e2('0x49')});}else{_0x155df5();}})[_0x20e2('0x4a')](function(_0x383216){_0x155df5(_0x383216);});}});};exports[_0x20e2('0x4b')]=function isAuthenticated(_0x2a3d97){return compose()['use'](function(_0x1b5352,_0x1bb455,_0x1e2b44){var _0x16a3a9;if(_0x1b5352[_0x20e2('0x4c')][_0x20e2('0x4d')]){if(_[_0x20e2('0x4e')](_0x1b5352['headers'][_0x20e2('0x4d')],_0x20e2('0x4f'))){var _0x528210=basicAuth(_0x1b5352);db[_0x20e2('0x50')][_0x20e2('0x51')]({'where':{'name':_0x528210[_0x20e2('0x52')]}})[_0x20e2('0x43')](function(_0x5023cc){if(!_0x5023cc||!_0x5023cc['authenticate'](_0x528210['pass'])){return _0x1bb455[_0x20e2('0x45')](0x191)[_0x20e2('0x46')]({'message':_0x20e2('0x53')});}_0x1b5352[_0x20e2('0x3e')]={'id':_0x5023cc['id']};_0x1e2b44();})[_0x20e2('0x4a')](function(_0x4fe08c){_0x1e2b44(_0x4fe08c);});}else if(_[_0x20e2('0x4e')](_0x1b5352[_0x20e2('0x4c')][_0x20e2('0x4d')],'Bearer')){validateJwt(_0x1b5352,_0x1bb455,_0x1e2b44);}else{if(_0x2a3d97){_0x1e2b44();}else{return _0x1bb455[_0x20e2('0x45')](0x193)[_0x20e2('0x46')]({'message':_0x20e2('0x54')});}}}else if(_0x1b5352['query'][_0x20e2('0x55')]){try{var _0x2a5975={'audience':hardwareConf[_0x20e2('0x56')](),'issuer':hardwareConf[_0x20e2('0x56')]()};verifyJwt(_0x1b5352[_0x20e2('0x44')][_0x20e2('0x55')],_0x2a5975)[_0x20e2('0x43')](function(_0x2576ad){return db['User'][_0x20e2('0x51')]({'where':{'id':_0x2576ad['sub']}})['then'](function(_0x4e0d9c){_0x16a3a9=_0x4e0d9c;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]});})[_0x20e2('0x43')](function(_0x45047f){if(!_0x16a3a9||!_['isEqual'](_0x16a3a9[_0x20e2('0x57')],_0x2576ad[_0x20e2('0x58')])){return _0x1bb455[_0x20e2('0x45')](0x191)['json']({'message':_0x20e2('0x59')});}if(_0x16a3a9[_0x20e2('0x5a')]){return _0x1bb455['status'](0x191)[_0x20e2('0x46')]({'message':_0x20e2('0x5b')});}if(_0x16a3a9['blocked']){if(_0x45047f[_0x20e2('0x5c')]>0x0){if(moment(_0x16a3a9[_0x20e2('0x5d')])[_0x20e2('0x5e')](_0x45047f[_0x20e2('0x5c')],'minutes')>moment()){return _0x1bb455[_0x20e2('0x45')](0x191)[_0x20e2('0x46')]({'message':_0x20e2('0x5b')});}}else{return _0x1bb455[_0x20e2('0x45')](0x191)[_0x20e2('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1b5352[_0x20e2('0x3e')]={'id':_0x16a3a9['id']};_0x1e2b44();});})[_0x20e2('0x4a')](function(){return _0x1bb455[_0x20e2('0x45')](0x191)[_0x20e2('0x46')]({'message':_0x20e2('0x5b')});});}catch(_0x8ab100){_0x1e2b44(_0x8ab100);}}else if(_0x2a3d97){_0x1e2b44();}else{return _0x1bb455['status'](0x193)['json']({'message':_0x20e2('0x54')});}})[_0x20e2('0x3d')](function(_0x5ae55f,_0x153601,_0x1a7f03){if(_0x5ae55f['user']){db[_0x20e2('0x50')]['find']({'where':{'id':_0x5ae55f[_0x20e2('0x3e')]['id']},'attributes':userAttributes})[_0x20e2('0x43')](function(_0x1b10f4){if(!_0x1b10f4){return _0x153601[_0x20e2('0x45')](0x194)[_0x20e2('0x46')]({'message':_0x20e2('0x5f')});}_0x5ae55f[_0x20e2('0x3e')]=_0x1b10f4;_0x1a7f03();})[_0x20e2('0x4a')](function(_0x30bf74){_0x1a7f03(_0x30bf74);});}else if(_0x2a3d97){_0x1a7f03();}else{return _0x153601[_0x20e2('0x45')](0x194)[_0x20e2('0x46')]({'message':_0x20e2('0x60')});}});};exports[_0x20e2('0x61')]=function canUpdate(){return compose()[_0x20e2('0x3d')](function(_0x515962,_0x3198d5,_0x125642){return licenseUtil[_0x20e2('0x62')]()[_0x20e2('0x43')](function(_0x3935d9){if(_0x3935d9[_0x20e2('0x63')]){_0x125642();}else{return _0x3198d5[_0x20e2('0x45')](0x193)['json']({'message':'Forbidden'});}})[_0x20e2('0x4a')](function(_0x2f356e){_0x125642(_0x2f356e);});});};exports[_0x20e2('0x64')]=function isWebrtcLicence(){return compose()[_0x20e2('0x3d')](function(_0x2d8c4f,_0x230fb6,_0x362d87){return licenseUtil['getLicense']()[_0x20e2('0x43')](function(_0x181698){if(_0x181698['webrtc']){_0x362d87();}else{return _0x230fb6[_0x20e2('0x45')](0x193)[_0x20e2('0x46')]({'message':_0x20e2('0x65')});}})[_0x20e2('0x4a')](function(_0x2686ae){_0x362d87(_0x2686ae);});});};exports[_0x20e2('0x66')]=function(_0x2ed940,_0x1fd0f3,_0x38f258){_0x2ed940[_0x20e2('0x66')]=!![];return _0x38f258();};exports['signToken']=function signToken(_0x220cb1){return signJwt(_0x220cb1);};exports[_0x20e2('0x67')]=function(_0xdf9b67,_0x50bc9c){if(!_0xdf9b67[_0x20e2('0x3e')]){return _0x50bc9c[_0x20e2('0x45')](0x194)[_0x20e2('0x46')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x278e05={'payload':{'id':_0xdf9b67['user']['id'],'role':_0xdf9b67[_0x20e2('0x3e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x278e05)[_0x20e2('0x43')](function(_0x3c47d9){_0x50bc9c[_0x20e2('0x68')](_0x20e2('0x69'),_0x3c47d9);_0x50bc9c[_0x20e2('0x6a')](_0x20e2('0x6b'));})[_0x20e2('0x4a')](function(_0x239b88){return _0x50bc9c[_0x20e2('0x45')](0x1f4)['send'](_0x239b88);});};exports[_0x20e2('0x6c')]=function(_0x2c670c){if(_[_0x20e2('0x6d')](_0x2c670c[_0x20e2('0x57')])||_[_0x20e2('0x6d')](_0x2c670c[_0x20e2('0x6e')])){return null;}else{return createJwt(_0x2c670c);}};exports[_0x20e2('0x6f')]=function(_0x121738){_0x121738[_0x20e2('0x57')]=generateNonce();_0x121738['apiKeyIat']=generateIssuedAt();return createJwt(_0x121738);};exports[_0x20e2('0x70')]=function(_0x5e7f11,_0x176570){var _0x3434f0=_0x5e7f11['query'][_0x20e2('0x55')];if(_0x3434f0){var _0xc8074e={'nonce':_0x176570[_0x20e2('0x57')],'iat':_0x176570[_0x20e2('0x6e')],'audience':hardwareConf[_0x20e2('0x56')](),'issuer':hardwareConf[_0x20e2('0x56')]()};return verifyJwt(_0x3434f0,_0xc8074e)['then'](function(){return generateApiKey(_0x176570);});}else{throw{'message':_0x20e2('0x71')};}};exports[_0x20e2('0x72')]=function(_0x316af0){var _0x396ddb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x396ddb[_0x20e2('0x73')](_0x316af0))throw new db[(_0x20e2('0x74'))]['ValidationError'](_0x20e2('0x75'));return;};exports[_0x20e2('0x76')]=function(_0xe2d360,_0x1a90e3,_0x4c901b){var _0x44ece8=encryptor[_0x20e2('0x77')](_0x1a90e3)['split'](',');for(var _0x4cf6a8=0x0;_0x4cf6a8<_0x4c901b;_0x4cf6a8++){if(!_0x44ece8[_0x4cf6a8])break;if(_0xe2d360[_0x20e2('0x78')]()===_0x44ece8[_0x4cf6a8][_0x20e2('0x78')]()){var _0x3cd9aa=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x4c901b);if(_0x4c901b===0x1){_0x3cd9aa=_0x20e2('0x79');}throw new db[(_0x20e2('0x74'))][(_0x20e2('0x7a'))](_0x3cd9aa);}}return;};exports[_0x20e2('0x7b')]=function(_0x33691f,_0x4c54f3){var _0x2247b2=_0x4c54f3?encryptor[_0x20e2('0x77')](_0x4c54f3)[_0x20e2('0x7c')](','):[];if(_0x2247b2[_0x20e2('0x7d')]===0x5){_0x2247b2[_0x20e2('0x7e')](-0x1,0x1);}_0x2247b2['unshift'](_0x33691f);return encryptor[_0x20e2('0x7f')](_0x2247b2['join'](','));};function signJwt(_0x2ec32e){var _0x5159a3=BPromise['promisify'](jwt[_0x20e2('0x80')],{'context':jwt});var _0x3f6bf4=_0x2ec32e['secret']||config[_0x20e2('0xb')][_0x20e2('0xc')];return new BPromise(function(_0x1c71d8,_0x2a6a03){_0x5159a3(_0x2ec32e[_0x20e2('0x81')],_0x3f6bf4,_0x2ec32e[_0x20e2('0x82')])[_0x20e2('0x43')](function(_0x2f44af){_0x1c71d8(_0x2f44af);})[_0x20e2('0x4a')](function(_0x19a5b5){_0x2a6a03(_0x19a5b5);});});}function verifyJwt(_0x1c8bdb,_0x50ad12,_0x47f6c6){var _0x2908e4=BPromise[_0x20e2('0x83')](jwt[_0x20e2('0x84')],{'context':jwt});var _0x11ca40=_0x47f6c6||config[_0x20e2('0xb')][_0x20e2('0xc')];return new BPromise(function(_0x58ea7e,_0x2da6e4){_0x2908e4(_0x1c8bdb,_0x11ca40,_0x50ad12)[_0x20e2('0x43')](function(_0x2bc5b2){_0x58ea7e(_0x2bc5b2);})[_0x20e2('0x4a')](function(_0x25270b){_0x2da6e4(_0x25270b);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0x20e2('0x85'));}function generateIssuedAt(){return Math[_0x20e2('0x86')](Date['now']()/0x3e8)['toString']();}function createJwt(_0x5391b7){var _0x42e61b={'payload':{'iat':_0x5391b7[_0x20e2('0x6e')],'nonce':_0x5391b7['apiKeyNonce']},'options':{'algorithm':'HS512','subject':_0x5391b7['id'][_0x20e2('0x87')](),'issuer':hardwareConf[_0x20e2('0x56')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x42e61b)[_0x20e2('0x43')](function(_0xdb54c0){return{'iat':_0x5391b7[_0x20e2('0x6e')],'nonce':_0x5391b7[_0x20e2('0x57')],'token':_0xdb54c0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 9b7de2d..9c8c4e7 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 _0xa014=['findAll','getContactsSubquery','resolve','parseAdvancedSearchFilter','search','then','where','default','fields','clause','tags','user','skip','checkListsRestrictions','ids','countFilteredContacts','count','User','buildContactsQuery','getFilteredContacts','rows','catch','describe','keys','filter','startsWith','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','../../mysqldb'];(function(_0x4adc5e,_0x74995){var _0x1cebda=function(_0x435398){while(--_0x435398){_0x4adc5e['push'](_0x4adc5e['shift']());}};_0x1cebda(++_0x74995);}(_0xa014,0x8e));var _0x4a01=function(_0xfd28b7,_0x5afeca){_0xfd28b7=_0xfd28b7-0x0;var _0x158668=_0xa014[_0xfd28b7];return _0x158668;};'use strict';var _=require(_0x4a01('0x0'));var sqlUtils=require('./sql-utils');var db=require(_0x4a01('0x1'))['db'];exports[_0x4a01('0x2')]=function(_0x49e2ab,_0x8e1c22,_0xce9e8c,_0x4ad987){var _0x16c8f8={'count':0x0,'rows':[]};var _0x4551fd=sqlUtils['skipContactsQuery'](_0x8e1c22,_0x49e2ab);if(_0x4551fd){return Promise['resolve'](_0x16c8f8);}var _0x5d25b3=sqlUtils[_0x4a01('0x3')]();var _0x54ddc3={};var _0x228a4d=![];var _0x99bed6=![];return Promise[_0x4a01('0x4')]()['then'](function(){if(_0x49e2ab['search']){return sqlUtils[_0x4a01('0x5')](_0x49e2ab[_0x4a01('0x6')],_0x4ad987);}else{return sqlUtils['parseQueryParameters'](_0x49e2ab,_0x4ad987);}})[_0x4a01('0x7')](function(_0x5dfcd8){_0x5d25b3[_0x4a01('0x8')](_0x5dfcd8[_0x4a01('0x9')]);_0x5d25b3['where'](_0x5dfcd8[_0x4a01('0xa')]);_0x5d25b3[_0x4a01('0x8')](_0x5dfcd8['filter']);_0x5d25b3[_0x4a01('0x8')](_0x5dfcd8['user'][_0x4a01('0xb')]);_0x54ddc3=_0x5dfcd8[_0x4a01('0xc')];_0x99bed6=_0x5dfcd8[_0x4a01('0xd')][_0x4a01('0xe')];return sqlUtils[_0x4a01('0xf')](_0x8e1c22,_0x49e2ab,_0x99bed6);})[_0x4a01('0x7')](function(_0xd735a7){_0x5d25b3[_0x4a01('0x8')](_0xd735a7);var _0xd1eedd=_0x49e2ab[_0x4a01('0x6')]?_0x54ddc3[_0x4a01('0x10')]:_0x49e2ab['tag'];_0x228a4d=_0xd1eedd?!![]:![];return sqlUtils[_0x4a01('0x11')](_0x5d25b3,_0xd1eedd);})[_0x4a01('0x7')](function(_0x193dff){_0x16c8f8[_0x4a01('0x12')]=_0x193dff;if(_0x16c8f8[_0x4a01('0x12')]===0x0){return;}if(_0x49e2ab[_0x4a01('0x13')]){_0x99bed6=!![];}return sqlUtils[_0x4a01('0x14')](_0x5d25b3,_0x49e2ab['fields'],_0xce9e8c,_0x228a4d,_0x54ddc3[_0x4a01('0xb')],_0x99bed6);})[_0x4a01('0x7')](function(_0x1026f3){if(!_0x1026f3){return[];}return sqlUtils[_0x4a01('0x15')](_0x1026f3,_0x49e2ab,_0xce9e8c);})[_0x4a01('0x7')](function(_0x202bb1){_0x16c8f8[_0x4a01('0x16')]=_0x202bb1;return _0x16c8f8;})[_0x4a01('0x17')](function(_0x4601dd){throw _0x4601dd;});};exports[_0x4a01('0x18')]=function(){var _0x31cc35={};var _0x524fa6=[];return db['CmContact'][_0x4a01('0x18')]()[_0x4a01('0x7')](function(_0x3544eb){_0x31cc35=_0x3544eb;var _0x3e1f41=Object[_0x4a01('0x19')](_0x31cc35)[_0x4a01('0x1a')](function(_0x915f1d){return _[_0x4a01('0x1b')](_0x915f1d,_0x4a01('0x1c'))?_0x915f1d:undefined;});var _0x5c9226=_0x3e1f41[_0x4a01('0x1d')](function(_0x3a3459){return db[_0x4a01('0x1e')][_0x4a01('0x1f')]({'where':{'id':_0x3a3459[_0x4a01('0x20')](0x3)},'raw':!![]});});return Promise[_0x4a01('0x21')](_0x5c9226);})[_0x4a01('0x7')](function(_0x360a1b){for(var _0x3a16cc=0x0;_0x3a16cc<_0x360a1b['length'];_0x3a16cc++){if(_0x360a1b[_0x3a16cc]){var _0x4042e0='cf_'+_0x360a1b[_0x3a16cc]['id'];_0x31cc35[_0x4042e0][_0x4a01('0x22')]=_0x360a1b[_0x3a16cc][_0x4a01('0x23')];}}_0x524fa6=_[_0x4a01('0x1d')](Object['keys'](_0x31cc35),function(_0x24939b){return{'name':_0x24939b,'type':_0x31cc35[_0x24939b][_0x4a01('0x23')]};});return _0x524fa6;})['catch'](function(_0x78f6ba){throw _0x78f6ba;});}; \ No newline at end of file +var _0x3e07=['resolve','then','search','parseQueryParameters','where','default','fields','filter','user','clause','tags','skip','checkListsRestrictions','ids','countFilteredContacts','User','getFilteredContacts','rows','catch','describe','keys','startsWith','cf_','CmCustomField','findOne','all','length','fieldType','type','map','lodash','./sql-utils','../../mysqldb','skipContactsQuery'];(function(_0x130307,_0x9de9e2){var _0x2028f5=function(_0x1c8ca8){while(--_0x1c8ca8){_0x130307['push'](_0x130307['shift']());}};_0x2028f5(++_0x9de9e2);}(_0x3e07,0x12e));var _0x73e0=function(_0x3b8dcf,_0xbc517a){_0x3b8dcf=_0x3b8dcf-0x0;var _0x4c8f86=_0x3e07[_0x3b8dcf];return _0x4c8f86;};'use strict';var _=require(_0x73e0('0x0'));var sqlUtils=require(_0x73e0('0x1'));var db=require(_0x73e0('0x2'))['db'];exports['findAll']=function(_0x1d36f4,_0x4e2601,_0x2169a4,_0x33f47b){var _0x3eb24b={'count':0x0,'rows':[]};var _0xfdff14=sqlUtils[_0x73e0('0x3')](_0x4e2601,_0x1d36f4);if(_0xfdff14){return Promise[_0x73e0('0x4')](_0x3eb24b);}var _0x1b5129=sqlUtils['getContactsSubquery']();var _0x5b5af1={};var _0x515552=![];var _0x365846=![];return Promise[_0x73e0('0x4')]()[_0x73e0('0x5')](function(){if(_0x1d36f4[_0x73e0('0x6')]){return sqlUtils['parseAdvancedSearchFilter'](_0x1d36f4[_0x73e0('0x6')],_0x33f47b);}else{return sqlUtils[_0x73e0('0x7')](_0x1d36f4,_0x33f47b);}})['then'](function(_0x23bee9){_0x1b5129[_0x73e0('0x8')](_0x23bee9[_0x73e0('0x9')]);_0x1b5129[_0x73e0('0x8')](_0x23bee9[_0x73e0('0xa')]);_0x1b5129[_0x73e0('0x8')](_0x23bee9[_0x73e0('0xb')]);_0x1b5129[_0x73e0('0x8')](_0x23bee9[_0x73e0('0xc')][_0x73e0('0xd')]);_0x5b5af1=_0x23bee9[_0x73e0('0xe')];_0x365846=_0x23bee9['user'][_0x73e0('0xf')];return sqlUtils[_0x73e0('0x10')](_0x4e2601,_0x1d36f4,_0x365846);})[_0x73e0('0x5')](function(_0x36bc62){_0x1b5129[_0x73e0('0x8')](_0x36bc62);var _0x126464=_0x1d36f4[_0x73e0('0x6')]?_0x5b5af1[_0x73e0('0x11')]:_0x1d36f4['tag'];_0x515552=_0x126464?!![]:![];return sqlUtils[_0x73e0('0x12')](_0x1b5129,_0x126464);})[_0x73e0('0x5')](function(_0x36a155){_0x3eb24b['count']=_0x36a155;if(_0x3eb24b['count']===0x0){return;}if(_0x1d36f4[_0x73e0('0x13')]){_0x365846=!![];}return sqlUtils['buildContactsQuery'](_0x1b5129,_0x1d36f4[_0x73e0('0xa')],_0x2169a4,_0x515552,_0x5b5af1['clause'],_0x365846);})['then'](function(_0x3abda2){if(!_0x3abda2){return[];}return sqlUtils[_0x73e0('0x14')](_0x3abda2,_0x1d36f4,_0x2169a4);})['then'](function(_0x1e7bd5){_0x3eb24b[_0x73e0('0x15')]=_0x1e7bd5;return _0x3eb24b;})[_0x73e0('0x16')](function(_0x280fe6){throw _0x280fe6;});};exports[_0x73e0('0x17')]=function(){var _0x244ef0={};var _0x2354c0=[];return db['CmContact'][_0x73e0('0x17')]()[_0x73e0('0x5')](function(_0x3574a9){_0x244ef0=_0x3574a9;var _0x2b3f14=Object[_0x73e0('0x18')](_0x244ef0)[_0x73e0('0xb')](function(_0x253142){return _[_0x73e0('0x19')](_0x253142,_0x73e0('0x1a'))?_0x253142:undefined;});var _0x1c0de6=_0x2b3f14['map'](function(_0x138419){return db[_0x73e0('0x1b')][_0x73e0('0x1c')]({'where':{'id':_0x138419['slice'](0x3)},'raw':!![]});});return Promise[_0x73e0('0x1d')](_0x1c0de6);})['then'](function(_0x57d59a){for(var _0x5d8f8a=0x0;_0x5d8f8a<_0x57d59a[_0x73e0('0x1e')];_0x5d8f8a++){if(_0x57d59a[_0x5d8f8a]){var _0x23fe4f=_0x73e0('0x1a')+_0x57d59a[_0x5d8f8a]['id'];_0x244ef0[_0x23fe4f][_0x73e0('0x1f')]=_0x57d59a[_0x5d8f8a][_0x73e0('0x20')];}}_0x2354c0=_[_0x73e0('0x21')](Object[_0x73e0('0x18')](_0x244ef0),function(_0x3f00c3){return{'name':_0x3f00c3,'type':_0x244ef0[_0x3f00c3][_0x73e0('0x20')]};});return _0x2354c0;})['catch'](function(_0x1fcd0a){throw _0x1fcd0a;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 5b82b98..702e5de 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 _0x6062=['escapeLIKESpecialChars','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','conditions','length','dateOfBirth','fieldType','castTo','buildExpression','type','default','text','value','end','Tag','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','keys','map','name','compact','Contact','ListId','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','resolve','then','fields','tag','filter','search','getLists','group','c.id','limit','offset','order','DESC','subqry.','from','findAll','color','Sequelize','QueryTypes','CmContact','query','toString','Tags','clone','COUNT(*)','getSelectedTags','t.id\x20IN\x20?','SELECT','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','role','agent','autocomplete','true','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','firstName','lastName','phone','mobile','fax','email','CompanyId','createdAt','updatedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace'];(function(_0x14148e,_0x4d91d1){var _0x410bb6=function(_0x48c50c){while(--_0x48c50c){_0x14148e['push'](_0x14148e['shift']());}};_0x410bb6(++_0x4d91d1);}(_0x6062,0x1dd));var _0x2606=function(_0x25cce5,_0x5647cd){_0x25cce5=_0x25cce5-0x0;var _0x1d2384=_0x6062[_0x25cce5];return _0x1d2384;};'use strict';var _=require(_0x2606('0x0'));var squel=require(_0x2606('0x1'));var as=require(_0x2606('0x2'));var qs=require(_0x2606('0x3'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0xacbced,_0x25c1c3){var _0x42bf3c=![];if(_0xacbced[_0x2606('0x4')]===_0x2606('0x5')&&!_0x25c1c3['search']&&!_0x25c1c3['ListId']&&_0x25c1c3[_0x2606('0x6')]!==_0x2606('0x7')){_0x42bf3c=!![];}return _0x42bf3c;}function getContactsSubquery(){return squel[_0x2606('0x8')]()['from'](_0x2606('0x9'),'c')[_0x2606('0xa')](_0x2606('0xb'));}function applyJoinClauses(_0x5064b5,_0x403c56){var _0x3d541f=_0x403c56?'c':_0x2606('0xc');_0x5064b5['left_join'](_0x2606('0xd'),'uc',_0x2606('0xe')+_0x3d541f+_0x2606('0xf'))[_0x2606('0x10')](_0x2606('0x11'),'ct',_0x2606('0x12')+_0x3d541f+'.id')[_0x2606('0x10')](_0x2606('0x13'),'t','t.id\x20=\x20ct.TagId');return _0x5064b5;}function addFieldsToQuery(_0x2f116c,_0x473633,_0x24ced7,_0x5e7e41,_0x1962ec){var _0x4d20d7=_0x1962ec?'c':'subqry';if(!_0x473633){_0x473633=['id',_0x2606('0x14'),_0x2606('0x15'),_0x2606('0x16'),_0x2606('0x17'),_0x2606('0x18'),_0x2606('0x19'),'ListId',_0x2606('0x1a'),_0x2606('0x1b'),_0x2606('0x1c'),'deletedAt',_0x2606('0x1d')];}else if(!_0x473633[_0x2606('0x1e')]('id')){_0x473633[_0x2606('0x1f')]('id');}var _0x12df9b=_0x24ced7&&_0x1962ec||!_0x24ced7&&!_0x1962ec;if(_0x5e7e41){_0x12df9b=_0x5e7e41&&_0x1962ec||!_0x5e7e41&&!_0x1962ec;}_0x473633[_0x2606('0x20')](function(_0x4d60fe){if(_0x4d60fe===_0x2606('0x1d')){if(_0x12df9b){_0x2f116c['field'](_0x2606('0x21'),_0x4d60fe);}else if(_0x24ced7||_0x5e7e41){_0x2f116c[_0x2606('0x22')](_0x4d20d7+'.'+_0x4d60fe);}}else{_0x2f116c[_0x2606('0x22')](_0x4d20d7+'.'+_0x4d60fe);}});return _0x2f116c;}function getSqlClauses(){var _0x16c277={'default':squel[_0x2606('0x23')](),'fields':squel[_0x2606('0x23')](),'filter':squel[_0x2606('0x23')](),'tags':{'clause':squel[_0x2606('0x23')](),'ids':null},'user':{'clause':squel[_0x2606('0x23')](),'skip':![]}};return _0x16c277;}function parseTagParameter(_0x281761){var _0x2dc8d2=squel[_0x2606('0x23')]();if(_0x281761){var _0x43791a=utils['getSelectedTags'](_0x281761);_0x43791a[_0x2606('0x20')](function(_0x2790ec){_0x2dc8d2['or'](_0x2606('0x24'),'%,'+_0x2790ec+',%');});}return _0x2dc8d2;}function parseSearchFilter(_0x12a983){var _0x56fc1b=squel[_0x2606('0x23')]();if(_0x12a983){var _0x50c9d8=_0x12a983[_0x2606('0x25')]('\x5c','\x5c\x5c')[_0x2606('0x25')](/'/g,'\x27\x27');var _0x140c5b=qs[_0x2606('0x26')](_0x50c9d8);if(_0x50c9d8[_0x2606('0x27')]('\x20')['length']>0x1){_0x56fc1b['or'](_0x2606('0x28'),qs[_0x2606('0x29')](_0x50c9d8,!![]),null);}else{if(qs['isNumeric'](_0x50c9d8)){_0x56fc1b['or'](_0x2606('0x2a'),_0x140c5b+'%');_0x56fc1b['or']('c.phone\x20LIKE\x20?',_0x140c5b+'%');_0x56fc1b['or']('c.mobile\x20LIKE\x20?',_0x140c5b+'%');_0x56fc1b['or'](_0x2606('0x2b'),_0x140c5b+'%');}else if(qs['isEmail'](_0x50c9d8)){_0x56fc1b['or']('c.email\x20LIKE\x20?',_0x140c5b+'%');}else{_0x56fc1b['or'](_0x2606('0x2c'),'%'+_0x140c5b+'%');_0x56fc1b['or']('c.lastName\x20LIKE\x20?','%'+_0x140c5b+'%');_0x56fc1b['or'](_0x2606('0x2d'),'%'+_0x140c5b+'%');}}}return _0x56fc1b;}function parseAdvancedSearchFilter(_0x457169,_0x4a9845){var _0x2f5c4c=getSqlClauses();var _0x352068=as['parseSearch'](_0x457169);var _0x25673c=_0x352068['sqlOperator'];for(var _0x37211b=0x0;_0x37211b<_0x352068[_0x2606('0x2e')][_0x2606('0x2f')];_0x37211b++){var _0x3f3872=_0x352068['conditions'][_0x37211b];var _0x163afd='c';var _0x585858=_['find'](_0x4a9845,['name',_0x3f3872[_0x2606('0x22')]]);if(_0x585858){if(_0x3f3872[_0x2606('0x22')]===_0x2606('0x30')||_0x585858[_0x2606('0x31')]==='datetime'){_0x3f3872[_0x2606('0x32')]='DATE';}var _0x564d08=as[_0x2606('0x33')](_0x163afd,_0x585858[_0x2606('0x34')],_0x3f3872);_0x2f5c4c[_0x2606('0x35')][_0x25673c](_0x564d08[_0x2606('0x36')],_0x564d08[_0x2606('0x37')]['start'],_0x564d08[_0x2606('0x37')][_0x2606('0x38')]);}else{if(_0x3f3872[_0x2606('0x22')]===_0x2606('0x39')){var _0x277b08=_0x3f3872[_0x2606('0x37')][_0x2606('0x27')](',')['map'](function(_0x37bf04){return Number(_0x37bf04);});var _0x3db04d=parseTagParameter(_0x277b08);_0x2f5c4c[_0x2606('0x3a')][_0x2606('0x3b')][_0x2606('0x3c')](_0x3db04d);_0x2f5c4c[_0x2606('0x3a')][_0x2606('0x3d')]=_0x277b08;}else if(_0x3f3872['field']===_0x2606('0x3e')){_0x2f5c4c[_0x2606('0x3f')]['clause'][_0x2606('0x3c')](_0x2606('0x40'),_0x3f3872[_0x2606('0x37')]);_0x2f5c4c[_0x2606('0x3f')]['skip']=!![];}}}return _0x2f5c4c;}function parseModelFields(_0x56f9c6,_0x42d94f){var _0x37d87b=squel[_0x2606('0x23')]();var _0x39783d=_(_0x56f9c6)[_0x2606('0x41')]()[_0x2606('0x42')](function(_0x16b23f){return _['some'](_0x42d94f,[_0x2606('0x43'),_0x16b23f])?_0x16b23f:undefined;})[_0x2606('0x44')]()[_0x2606('0x37')]();if(_0x56f9c6[_0x2606('0x45')]){_0x39783d[_0x2606('0x1f')](_0x2606('0x45'));}if(_0x56f9c6[_0x2606('0x3e')]){_0x39783d[_0x2606('0x1f')](_0x2606('0x3e'));}if(_0x39783d[_0x2606('0x2f')]>0x0){_0x39783d['forEach'](function(_0x31cc15){if(_0x31cc15===_0x2606('0x46')){_0x37d87b['and']('c.ListId\x20IN\x20?',[][_0x2606('0x47')](_0x56f9c6[_0x31cc15]));}else if(_0x31cc15===_0x2606('0x45')){var _0x4fadd9='%'+_0x56f9c6[_0x31cc15]+'%';_0x37d87b[_0x2606('0x3c')](_0x2606('0x48'),_0x4fadd9);}else if(_0x31cc15===_0x2606('0x3e')){_0x37d87b[_0x2606('0x3c')](_0x2606('0x40'),_0x56f9c6[_0x31cc15]);}else{_0x37d87b[_0x2606('0x3c')]('c.'+_0x31cc15+'\x20=\x20?',_0x56f9c6[_0x31cc15]);}});}return _0x37d87b;}function parseQueryParameters(_0x50f183,_0x4b93b2){var _0xf24b=getSqlClauses();return Promise[_0x2606('0x49')]()['then'](function(){return parseModelFields(_0x50f183,_0x4b93b2);})[_0x2606('0x4a')](function(_0x495d83){_0xf24b[_0x2606('0x4b')][_0x2606('0x3c')](_0x495d83);return parseTagParameter(_0x50f183[_0x2606('0x4c')]);})[_0x2606('0x4a')](function(_0x2abc70){_0xf24b[_0x2606('0x3a')][_0x2606('0x3b')][_0x2606('0x3c')](_0x2abc70);return parseSearchFilter(_0x50f183[_0x2606('0x4d')]);})[_0x2606('0x4a')](function(_0x1a8be5){_0xf24b[_0x2606('0x4d')]=_0x1a8be5;return _0xf24b;});}function checkListsRestrictions(_0x40197a,_0x35e822,_0x2d7e6e){var _0x121236=squel[_0x2606('0x23')]();return Promise['resolve']()['then'](function(){if(_0x35e822[_0x2606('0x4e')]&&_0x40197a[_0x2606('0x4')]==='agent'&&!_0x2d7e6e){return _0x40197a[_0x2606('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x2606('0x4a')](function(_0x27af57){if(_0x27af57){if(_0x27af57[_0x2606('0x2f')]===0x0){_0x121236['and']('c.ListId\x20IS\x20NULL');}else{_0x121236[_0x2606('0x3c')]('c.ListId\x20IN\x20?',_[_0x2606('0x42')](_0x27af57,'id'));}}})['then'](function(){return _0x121236;});}function buildContactsQuery(_0x58ab5d,_0x547ced,_0x17069c,_0x59a623,_0x59a3b0,_0x46f31e){if(_0x547ced){_0x547ced=_0x17069c['attributes'];}_0x58ab5d=addFieldsToQuery(_0x58ab5d,_0x547ced,_0x59a623,_0x46f31e,!![]);var _0x31a853=squel['select']();_0x31a853=addFieldsToQuery(_0x31a853,_0x547ced,_0x59a623,_0x46f31e,![]);if(_0x59a623||_0x46f31e){_0x58ab5d=applyJoinClauses(_0x58ab5d,!![]);_0x58ab5d[_0x2606('0x50')](_0x2606('0x51'));if(_0x17069c[_0x2606('0x52')]){_0x31a853[_0x2606('0x52')](_0x17069c[_0x2606('0x52')]);}if(_0x17069c[_0x2606('0x53')]){_0x31a853[_0x2606('0x53')](_0x17069c[_0x2606('0x53')]);}}else{_0x31a853=applyJoinClauses(_0x31a853,![]);_0x31a853[_0x2606('0x50')]('subqry.id');if(_0x17069c[_0x2606('0x52')]){_0x58ab5d['limit'](_0x17069c[_0x2606('0x52')]);}if(_0x17069c[_0x2606('0x53')]){_0x58ab5d['offset'](_0x17069c[_0x2606('0x53')]);}}_0x31a853['having'](_0x59a3b0);if(_0x17069c[_0x2606('0x54')]){_0x17069c[_0x2606('0x54')][_0x2606('0x20')](function(_0x4fb1c8){_0x58ab5d[_0x2606('0x54')]('c.'+_0x4fb1c8[0x0],_0x4fb1c8[0x1]===_0x2606('0x55')?![]:!![]);_0x31a853[_0x2606('0x54')](_0x2606('0x56')+_0x4fb1c8[0x0],_0x4fb1c8[0x1]==='DESC'?![]:!![]);});}_0x31a853[_0x2606('0x57')](_0x58ab5d,_0x2606('0xc'));return _0x31a853;}function getFilteredContacts(_0x4baf46){var _0x440b28=[];return db[_0x2606('0x39')][_0x2606('0x58')]({'attributes':['id',_0x2606('0x43'),_0x2606('0x59')],'raw':!![]})['then'](function(_0x3d2968){_0x440b28=_['keyBy'](_0x3d2968,'id');var _0x584021={'type':db[_0x2606('0x5a')][_0x2606('0x5b')]['SELECT'],'model':db[_0x2606('0x5c')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x2606('0x5d')](_0x4baf46[_0x2606('0x5e')](),_0x584021);})['then'](function(_0x5a644a){_0x5a644a[_0x2606('0x20')](function(_0x353dbe){if(_0x353dbe[_0x2606('0x1d')]){_0x353dbe[_0x2606('0x5f')]=[];_0x353dbe[_0x2606('0x1d')][_0x2606('0x27')](',')[_0x2606('0x20')](function(_0x4a1eac){_0x353dbe['Tags']['push'](_0x440b28[_0x4a1eac]);});}delete _0x353dbe[_0x2606('0x1d')];});return _0x5a644a;});}function countFilteredContacts(_0x11bf6c,_0x5656f1){var _0x250315=_0x11bf6c[_0x2606('0x60')]();_0x250315['field'](_0x2606('0x61'));_0x250315=applyJoinClauses(_0x250315,!![]);_0x11bf6c[_0x2606('0x50')](_0x2606('0x51'));var _0x274977=utils[_0x2606('0x62')](_0x5656f1);if(!_['isEmpty'](_0x274977)){_0x250315[_0x2606('0xa')](_0x2606('0x63'),_0x274977);}var _0x48ca3b={'type':db[_0x2606('0x5a')][_0x2606('0x5b')][_0x2606('0x64')],'raw':!![]};return db[_0x2606('0x65')]['query'](_0x250315[_0x2606('0x5e')](),_0x48ca3b)[_0x2606('0x4a')](function(_0x506350){return _0x506350[0x0][_0x2606('0x61')];});}module[_0x2606('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x181f=['end','Tag','map','tags','clause','ids','User','and','uc.UserId\x20=\x20?','user','some','Contact','ListId','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','filter','agent','c.ListId\x20IS\x20NULL','attributes','select','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','QueryTypes','SELECT','CmContact','sequelize','Tags','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','query','toString','lodash','squel','../parsers/advancedSearch','../interaction/utils','../../mysqldb','role','search','autocomplete','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','.id','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','email','CompanyId','updatedAt','deletedAt','TagIds','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','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.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value'];(function(_0x32aad6,_0x5367bc){var _0x1847db=function(_0x172914){while(--_0x172914){_0x32aad6['push'](_0x32aad6['shift']());}};_0x1847db(++_0x5367bc);}(_0x181f,0xa1));var _0xf181=function(_0x556d8a,_0xffe6d8){_0x556d8a=_0x556d8a-0x0;var _0x5c0c4d=_0x181f[_0x556d8a];return _0x5c0c4d;};'use strict';var _=require(_0xf181('0x0'));var squel=require(_0xf181('0x1'));var as=require(_0xf181('0x2'));var qs=require('../parsers/qs');var utils=require(_0xf181('0x3'));var db=require(_0xf181('0x4'))['db'];function skipContactsQuery(_0x446b2b,_0x1afa87){var _0x404ed9=![];if(_0x446b2b[_0xf181('0x5')]==='agent'&&!_0x1afa87[_0xf181('0x6')]&&!_0x1afa87['ListId']&&_0x1afa87[_0xf181('0x7')]!==_0xf181('0x8')){_0x404ed9=!![];}return _0x404ed9;}function getContactsSubquery(){return squel['select']()['from'](_0xf181('0x9'),'c')[_0xf181('0xa')](_0xf181('0xb'));}function applyJoinClauses(_0x582496,_0x27ec87){var _0x1d0d65=_0x27ec87?'c':_0xf181('0xc');_0x582496[_0xf181('0xd')](_0xf181('0xe'),'uc','uc.CmContactId\x20=\x20'+_0x1d0d65+_0xf181('0xf'))[_0xf181('0xd')]('cm_contact_has_tags','ct',_0xf181('0x10')+_0x1d0d65+'.id')['left_join'](_0xf181('0x11'),'t',_0xf181('0x12'));return _0x582496;}function addFieldsToQuery(_0x4fa824,_0x3e6d3a,_0x21085b,_0x2bfaed,_0x27722a){var _0xe6d010=_0x27722a?'c':'subqry';if(!_0x3e6d3a){_0x3e6d3a=['id',_0xf181('0x13'),_0xf181('0x14'),_0xf181('0x15'),'mobile','fax',_0xf181('0x16'),'ListId',_0xf181('0x17'),'createdAt',_0xf181('0x18'),_0xf181('0x19'),_0xf181('0x1a')];}else if(!_0x3e6d3a['includes']('id')){_0x3e6d3a[_0xf181('0x1b')]('id');}var _0x4a7a1f=_0x21085b&&_0x27722a||!_0x21085b&&!_0x27722a;if(_0x2bfaed){_0x4a7a1f=_0x2bfaed&&_0x27722a||!_0x2bfaed&&!_0x27722a;}_0x3e6d3a[_0xf181('0x1c')](function(_0x329226){if(_0x329226===_0xf181('0x1a')){if(_0x4a7a1f){_0x4fa824[_0xf181('0x1d')](_0xf181('0x1e'),_0x329226);}else if(_0x21085b||_0x2bfaed){_0x4fa824[_0xf181('0x1d')](_0xe6d010+'.'+_0x329226);}}else{_0x4fa824[_0xf181('0x1d')](_0xe6d010+'.'+_0x329226);}});return _0x4fa824;}function getSqlClauses(){var _0x562e92={'default':squel[_0xf181('0x1f')](),'fields':squel[_0xf181('0x1f')](),'filter':squel[_0xf181('0x1f')](),'tags':{'clause':squel[_0xf181('0x1f')](),'ids':null},'user':{'clause':squel[_0xf181('0x1f')](),'skip':![]}};return _0x562e92;}function parseTagParameter(_0x3389ae){var _0x458e68=squel['expr']();if(_0x3389ae){var _0x3525b1=utils['getSelectedTags'](_0x3389ae);_0x3525b1[_0xf181('0x1c')](function(_0xab00c1){_0x458e68['or'](_0xf181('0x20'),'%,'+_0xab00c1+',%');});}return _0x458e68;}function parseSearchFilter(_0x2c08c6){var _0x468a72=squel[_0xf181('0x1f')]();if(_0x2c08c6){var _0x2ac99b=_0x2c08c6[_0xf181('0x21')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');var _0x5c46de=qs['escapeLIKESpecialChars'](_0x2ac99b);if(_0x2ac99b[_0xf181('0x22')]('\x20')[_0xf181('0x23')]>0x1){_0x468a72['or'](_0xf181('0x24'),qs['getFullTextValue'](_0x2ac99b,!![]),null);}else{if(qs['isNumeric'](_0x2ac99b)){_0x468a72['or'](_0xf181('0x25'),_0x5c46de+'%');_0x468a72['or'](_0xf181('0x26'),_0x5c46de+'%');_0x468a72['or'](_0xf181('0x27'),_0x5c46de+'%');_0x468a72['or']('c.fax\x20LIKE\x20?',_0x5c46de+'%');}else if(qs[_0xf181('0x28')](_0x2ac99b)){_0x468a72['or'](_0xf181('0x29'),_0x5c46de+'%');}else{_0x468a72['or'](_0xf181('0x2a'),'%'+_0x5c46de+'%');_0x468a72['or'](_0xf181('0x2b'),'%'+_0x5c46de+'%');_0x468a72['or'](_0xf181('0x29'),'%'+_0x5c46de+'%');}}}return _0x468a72;}function parseAdvancedSearchFilter(_0x26c7c5,_0x26f218){var _0xafeaaf=getSqlClauses();var _0x4aa9bf=as[_0xf181('0x2c')](_0x26c7c5);var _0x1beb0a=_0x4aa9bf[_0xf181('0x2d')];for(var _0x5073ce=0x0;_0x5073ce<_0x4aa9bf[_0xf181('0x2e')][_0xf181('0x23')];_0x5073ce++){var _0x37f699=_0x4aa9bf['conditions'][_0x5073ce];var _0x1613a4='c';var _0x63352c=_[_0xf181('0x2f')](_0x26f218,[_0xf181('0x30'),_0x37f699[_0xf181('0x1d')]]);if(_0x63352c){if(_0x37f699[_0xf181('0x1d')]===_0xf181('0x31')||_0x63352c[_0xf181('0x32')]===_0xf181('0x33')){_0x37f699[_0xf181('0x34')]=_0xf181('0x35');}var _0x28ca68=as[_0xf181('0x36')](_0x1613a4,_0x63352c[_0xf181('0x37')],_0x37f699);_0xafeaaf[_0xf181('0x38')][_0x1beb0a](_0x28ca68[_0xf181('0x39')],_0x28ca68[_0xf181('0x3a')]['start'],_0x28ca68['value'][_0xf181('0x3b')]);}else{if(_0x37f699[_0xf181('0x1d')]===_0xf181('0x3c')){var _0x152894=_0x37f699[_0xf181('0x3a')][_0xf181('0x22')](',')[_0xf181('0x3d')](function(_0x153156){return Number(_0x153156);});var _0x4b2291=parseTagParameter(_0x152894);_0xafeaaf[_0xf181('0x3e')][_0xf181('0x3f')]['and'](_0x4b2291);_0xafeaaf['tags'][_0xf181('0x40')]=_0x152894;}else if(_0x37f699[_0xf181('0x1d')]===_0xf181('0x41')){_0xafeaaf['user'][_0xf181('0x3f')][_0xf181('0x42')](_0xf181('0x43'),_0x37f699[_0xf181('0x3a')]);_0xafeaaf[_0xf181('0x44')]['skip']=!![];}}}return _0xafeaaf;}function parseModelFields(_0x5e523f,_0x3476f6){var _0x137359=squel[_0xf181('0x1f')]();var _0x5841e3=_(_0x5e523f)['keys']()[_0xf181('0x3d')](function(_0x20f269){return _[_0xf181('0x45')](_0x3476f6,[_0xf181('0x30'),_0x20f269])?_0x20f269:undefined;})['compact']()[_0xf181('0x3a')]();if(_0x5e523f[_0xf181('0x46')]){_0x5841e3['push'](_0xf181('0x46'));}if(_0x5e523f[_0xf181('0x41')]){_0x5841e3[_0xf181('0x1b')](_0xf181('0x41'));}if(_0x5841e3['length']>0x0){_0x5841e3[_0xf181('0x1c')](function(_0x1ac1b8){if(_0x1ac1b8===_0xf181('0x47')){_0x137359[_0xf181('0x42')](_0xf181('0x48'),[][_0xf181('0x49')](_0x5e523f[_0x1ac1b8]));}else if(_0x1ac1b8===_0xf181('0x46')){var _0x4876d3='%'+_0x5e523f[_0x1ac1b8]+'%';_0x137359[_0xf181('0x42')](_0xf181('0x4a'),_0x4876d3);}else if(_0x1ac1b8===_0xf181('0x41')){_0x137359[_0xf181('0x42')]('uc.UserId\x20=\x20?',_0x5e523f[_0x1ac1b8]);}else{_0x137359['and']('c.'+_0x1ac1b8+_0xf181('0x4b'),_0x5e523f[_0x1ac1b8]);}});}return _0x137359;}function parseQueryParameters(_0x26b3f3,_0x2306e8){var _0x54246a=getSqlClauses();return Promise[_0xf181('0x4c')]()['then'](function(){return parseModelFields(_0x26b3f3,_0x2306e8);})[_0xf181('0x4d')](function(_0x259544){_0x54246a[_0xf181('0x4e')][_0xf181('0x42')](_0x259544);return parseTagParameter(_0x26b3f3[_0xf181('0x4f')]);})[_0xf181('0x4d')](function(_0x40a31e){_0x54246a[_0xf181('0x3e')][_0xf181('0x3f')][_0xf181('0x42')](_0x40a31e);return parseSearchFilter(_0x26b3f3['filter']);})[_0xf181('0x4d')](function(_0x148790){_0x54246a[_0xf181('0x50')]=_0x148790;return _0x54246a;});}function checkListsRestrictions(_0x14bf3f,_0x446247,_0x51ea85){var _0x481e7d=squel[_0xf181('0x1f')]();return Promise['resolve']()[_0xf181('0x4d')](function(){if(_0x446247[_0xf181('0x6')]&&_0x14bf3f['role']===_0xf181('0x51')&&!_0x51ea85){return _0x14bf3f['getLists']({'attributes':['id'],'raw':!![]});}})[_0xf181('0x4d')](function(_0x397939){if(_0x397939){if(_0x397939[_0xf181('0x23')]===0x0){_0x481e7d[_0xf181('0x42')](_0xf181('0x52'));}else{_0x481e7d[_0xf181('0x42')](_0xf181('0x48'),_['map'](_0x397939,'id'));}}})[_0xf181('0x4d')](function(){return _0x481e7d;});}function buildContactsQuery(_0x4e9600,_0xba0bc0,_0x60f5d9,_0x135dc3,_0x231fe9,_0x515b90){if(_0xba0bc0){_0xba0bc0=_0x60f5d9[_0xf181('0x53')];}_0x4e9600=addFieldsToQuery(_0x4e9600,_0xba0bc0,_0x135dc3,_0x515b90,!![]);var _0x838de9=squel[_0xf181('0x54')]();_0x838de9=addFieldsToQuery(_0x838de9,_0xba0bc0,_0x135dc3,_0x515b90,![]);if(_0x135dc3||_0x515b90){_0x4e9600=applyJoinClauses(_0x4e9600,!![]);_0x4e9600[_0xf181('0x55')](_0xf181('0x56'));if(_0x60f5d9[_0xf181('0x57')]){_0x838de9[_0xf181('0x57')](_0x60f5d9[_0xf181('0x57')]);}if(_0x60f5d9[_0xf181('0x58')]){_0x838de9['offset'](_0x60f5d9[_0xf181('0x58')]);}}else{_0x838de9=applyJoinClauses(_0x838de9,![]);_0x838de9[_0xf181('0x55')](_0xf181('0x59'));if(_0x60f5d9[_0xf181('0x57')]){_0x4e9600['limit'](_0x60f5d9[_0xf181('0x57')]);}if(_0x60f5d9[_0xf181('0x58')]){_0x4e9600[_0xf181('0x58')](_0x60f5d9[_0xf181('0x58')]);}}_0x838de9[_0xf181('0x5a')](_0x231fe9);if(_0x60f5d9[_0xf181('0x5b')]){_0x60f5d9['order'][_0xf181('0x1c')](function(_0x2bb3e5){_0x4e9600[_0xf181('0x5b')]('c.'+_0x2bb3e5[0x0],_0x2bb3e5[0x1]===_0xf181('0x5c')?![]:!![]);_0x838de9[_0xf181('0x5b')](_0xf181('0x5d')+_0x2bb3e5[0x0],_0x2bb3e5[0x1]==='DESC'?![]:!![]);});}_0x838de9[_0xf181('0x5e')](_0x4e9600,_0xf181('0xc'));return _0x838de9;}function getFilteredContacts(_0x34ce0a){var _0x48b1f1=[];return db[_0xf181('0x3c')][_0xf181('0x5f')]({'attributes':['id',_0xf181('0x30'),_0xf181('0x60')],'raw':!![]})['then'](function(_0x525a55){_0x48b1f1=_['keyBy'](_0x525a55,'id');var _0x57d1a7={'type':db['Sequelize'][_0xf181('0x61')][_0xf181('0x62')],'model':db[_0xf181('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xf181('0x64')]['query'](_0x34ce0a['toString'](),_0x57d1a7);})[_0xf181('0x4d')](function(_0x3e5e4f){_0x3e5e4f['forEach'](function(_0x497a74){if(_0x497a74[_0xf181('0x1a')]){_0x497a74[_0xf181('0x65')]=[];_0x497a74[_0xf181('0x1a')][_0xf181('0x22')](',')[_0xf181('0x1c')](function(_0x5b23e6){_0x497a74[_0xf181('0x65')][_0xf181('0x1b')](_0x48b1f1[_0x5b23e6]);});}delete _0x497a74[_0xf181('0x1a')];});return _0x3e5e4f;});}function countFilteredContacts(_0x310c6c,_0x1c7d8b){var _0x2431e4=_0x310c6c[_0xf181('0x66')]();_0x2431e4[_0xf181('0x1d')](_0xf181('0x67'));_0x2431e4=applyJoinClauses(_0x2431e4,!![]);_0x310c6c[_0xf181('0x55')](_0xf181('0x56'));var _0x5b5700=utils[_0xf181('0x68')](_0x1c7d8b);if(!_[_0xf181('0x69')](_0x5b5700)){_0x2431e4[_0xf181('0xa')](_0xf181('0x6a'),_0x5b5700);}var _0x10b1c8={'type':db[_0xf181('0x6b')][_0xf181('0x61')]['SELECT'],'raw':!![]};return db['sequelize'][_0xf181('0x6c')](_0x2431e4[_0xf181('0x6d')](),_0x10b1c8)[_0xf181('0x4d')](function(_0x417412){return _0x417412[0x0][_0xf181('0x67')];});}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 5a56cd2..b6a0d2e 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 _0x145e=['utf8','base64','decryptString','secret','crypto','bluebird','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','write','end','final','close','decryptFile','createWriteStream','createDecipher','update','unlink'];(function(_0x3e4007,_0x5b6da4){var _0x349453=function(_0x26cc4d){while(--_0x26cc4d){_0x3e4007['push'](_0x3e4007['shift']());}};_0x349453(++_0x5b6da4);}(_0x145e,0x6a));var _0xe145=function(_0x36f797,_0x351603){_0x36f797=_0x36f797-0x0;var _0x44ba30=_0x145e[_0x36f797];return _0x44ba30;};'use strict';var crypto=require(_0xe145('0x0'));var fs=require('fs');var BPromise=require(_0xe145('0x1'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0xe145('0x2'))(_0xe145('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xe145('0x4')]['session'],'algorithm':_0xe145('0x5')};const fileOptions={'algorithm':_0xe145('0x6')};if(config[_0xe145('0x7')]&&config[_0xe145('0x7')][_0xe145('0x8')]){var isSupported=isAlgorithmSupported(config[_0xe145('0x7')][_0xe145('0x8')]);if(isSupported){fileOptions[_0xe145('0x8')]=config[_0xe145('0x7')][_0xe145('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xe145('0x9')](',\x20');logger[_0xe145('0xa')](config[_0xe145('0x7')][_0xe145('0x8')],_0xe145('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x8ac26a){return AES_SUPPORTED_RX[_0xe145('0xc')](_0x8ac26a);}function getSupportedCiphers(){return crypto[_0xe145('0xd')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x20c41b){return getSupportedCiphers()[_0xe145('0xe')](_0x20c41b)>-0x1;}function combineOptions(_0x7a9e0d){var _0x5aa550={};for(var _0x376bbc in fileOptions){if(fileOptions[_0xe145('0xf')](_0x376bbc)){_0x5aa550[_0x376bbc]=fileOptions[_0x376bbc];}}if(_0x7a9e0d){for(var _0x1d375d in _0x7a9e0d){if(_0x7a9e0d[_0xe145('0xf')](_0x1d375d)){_0x5aa550[_0x1d375d]=_0x7a9e0d[_0x1d375d];}}}return _0x5aa550;}exports[_0xe145('0x10')]=function(_0x524bbc,_0x32ed0d,_0x50c524,_0x459a1f){return new BPromise(function(_0x465911,_0x139433){_0x459a1f=combineOptions(_0x459a1f);var _0x120873=new Buffer(_0x50c524);var _0x46b580=fs[_0xe145('0x11')](_0x524bbc);var _0x40c365=fs['createWriteStream'](_0x32ed0d);var _0x52a363=crypto[_0xe145('0x12')](_0x459a1f['algorithm'],_0x120873);_0x46b580['on'](_0xe145('0x13'),function(_0x42fd40){var _0x30a0af=new Buffer(_0x52a363['update'](_0x42fd40),_0xe145('0x14'));_0x40c365[_0xe145('0x15')](_0x30a0af);});_0x46b580['on'](_0xe145('0x16'),function(){try{var _0x2cc94b=new Buffer(_0x52a363[_0xe145('0x17')]('binary'),_0xe145('0x14'));_0x40c365[_0xe145('0x15')](_0x2cc94b);_0x40c365[_0xe145('0x16')]();_0x40c365['on'](_0xe145('0x18'),function(){return _0x465911(_0x32ed0d);});}catch(_0x3893ef){fs['unlink'](_0x32ed0d);return _0x139433(_0x3893ef);}});});};exports[_0xe145('0x19')]=function(_0x2c86e6,_0x5e6f62,_0xd8703a,_0x3bc6fc){return new BPromise(function(_0x5770ff,_0x46be7a){_0x3bc6fc=combineOptions(_0x3bc6fc);var _0x1dd524=new Buffer(_0xd8703a);var _0x1fc443=fs[_0xe145('0x11')](_0x2c86e6);var _0x25b455=fs[_0xe145('0x1a')](_0x5e6f62);var _0x133ec2=crypto[_0xe145('0x1b')](_0x3bc6fc[_0xe145('0x8')],_0x1dd524);_0x1fc443['on'](_0xe145('0x13'),function(_0x4280e2){var _0x3ece2c=new Buffer(_0x133ec2[_0xe145('0x1c')](_0x4280e2),_0xe145('0x14'));_0x25b455[_0xe145('0x15')](_0x3ece2c);});_0x1fc443['on'](_0xe145('0x16'),function(){try{var _0x7be48b=new Buffer(_0x133ec2[_0xe145('0x17')](_0xe145('0x14')),'binary');_0x25b455[_0xe145('0x15')](_0x7be48b);_0x25b455[_0xe145('0x16')]();_0x25b455['on'](_0xe145('0x18'),function(){return _0x5770ff(_0x5e6f62);});}catch(_0x14bb7a){fs[_0xe145('0x1d')](_0x5e6f62);return _0x46be7a(_0x14bb7a);}});});};exports['encryptString']=function(_0xa9c75f,_0x36d724,_0x523a85){var _0x1a2acf=_0x523a85||stringOptions['algorithm'];var _0x556233=_0x36d724||stringOptions['secret'];var _0x1d5f0e=crypto['createCipher'](_0x1a2acf,_0x556233);var _0x1a373e=_0x1d5f0e[_0xe145('0x1c')](_0xa9c75f,_0xe145('0x1e'),_0xe145('0x1f'));_0x1a373e+=_0x1d5f0e[_0xe145('0x17')](_0xe145('0x1f'));return _0x1a373e;};exports[_0xe145('0x20')]=function(_0x4a089b,_0x16461a,_0x569bd8){var _0x332a6f=_0x569bd8||stringOptions[_0xe145('0x8')];var _0x3eca02=_0x16461a||stringOptions[_0xe145('0x21')];var _0x3c110e=crypto[_0xe145('0x1b')](_0x332a6f,_0x3eca02);var _0x173854=_0x3c110e[_0xe145('0x1c')](_0x4a089b,'base64','utf8');_0x173854+=_0x3c110e[_0xe145('0x17')](_0xe145('0x1e'));return _0x173854;}; \ No newline at end of file +var _0x0ab0=['utf8','crypto','bluebird','lodash','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','binary','end','write','close','unlink','decryptFile','createDecipher','data','final','encryptString','secret','base64','decryptString'];(function(_0x155c6f,_0x373da6){var _0x221856=function(_0x329221){while(--_0x329221){_0x155c6f['push'](_0x155c6f['shift']());}};_0x221856(++_0x373da6);}(_0x0ab0,0x1c8));var _0x00ab=function(_0x2c5970,_0x250231){_0x2c5970=_0x2c5970-0x0;var _0x404638=_0x0ab0[_0x2c5970];return _0x404638;};'use strict';var crypto=require(_0x00ab('0x0'));var fs=require('fs');var BPromise=require(_0x00ab('0x1'));var _=require(_0x00ab('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x00ab('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x00ab('0x4')][_0x00ab('0x5')],'algorithm':_0x00ab('0x6')};const fileOptions={'algorithm':_0x00ab('0x7')};if(config[_0x00ab('0x8')]&&config['encrypt'][_0x00ab('0x9')]){var isSupported=isAlgorithmSupported(config[_0x00ab('0x8')]['algorithm']);if(isSupported){fileOptions[_0x00ab('0x9')]=config['encrypt'][_0x00ab('0x9')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x00ab('0xa')](',\x20');logger['error'](config[_0x00ab('0x8')][_0x00ab('0x9')],_0x00ab('0xb'),supportedAlgorithms);}}function isASupportedCipher(_0x23da27){return AES_SUPPORTED_RX[_0x00ab('0xc')](_0x23da27);}function getSupportedCiphers(){return crypto[_0x00ab('0xd')]()[_0x00ab('0xe')](isASupportedCipher);}function isAlgorithmSupported(_0x52a3ef){return getSupportedCiphers()['indexOf'](_0x52a3ef)>-0x1;}function combineOptions(_0x5995d5){var _0xdb1b05={};for(var _0x2927f1 in fileOptions){if(fileOptions[_0x00ab('0xf')](_0x2927f1)){_0xdb1b05[_0x2927f1]=fileOptions[_0x2927f1];}}if(_0x5995d5){for(var _0x3d4872 in _0x5995d5){if(_0x5995d5[_0x00ab('0xf')](_0x3d4872)){_0xdb1b05[_0x3d4872]=_0x5995d5[_0x3d4872];}}}return _0xdb1b05;}exports[_0x00ab('0x10')]=function(_0xff0bc5,_0xaee15a,_0x25a867,_0x13da6e){return new BPromise(function(_0x5965d6,_0x2a6a0a){_0x13da6e=combineOptions(_0x13da6e);var _0x3a4087=new Buffer(_0x25a867);var _0xa2c906=fs[_0x00ab('0x11')](_0xff0bc5);var _0x3908a5=fs[_0x00ab('0x12')](_0xaee15a);var _0x288e5c=crypto[_0x00ab('0x13')](_0x13da6e[_0x00ab('0x9')],_0x3a4087);_0xa2c906['on']('data',function(_0x384fb8){var _0x5ca0d4=new Buffer(_0x288e5c[_0x00ab('0x14')](_0x384fb8),_0x00ab('0x15'));_0x3908a5['write'](_0x5ca0d4);});_0xa2c906['on'](_0x00ab('0x16'),function(){try{var _0x4bbc8b=new Buffer(_0x288e5c['final']('binary'),_0x00ab('0x15'));_0x3908a5[_0x00ab('0x17')](_0x4bbc8b);_0x3908a5['end']();_0x3908a5['on'](_0x00ab('0x18'),function(){return _0x5965d6(_0xaee15a);});}catch(_0xd80375){fs[_0x00ab('0x19')](_0xaee15a);return _0x2a6a0a(_0xd80375);}});});};exports[_0x00ab('0x1a')]=function(_0x461eb6,_0x13df24,_0x9f2918,_0x30e3e5){return new BPromise(function(_0x7b354e,_0x548efc){_0x30e3e5=combineOptions(_0x30e3e5);var _0x59c766=new Buffer(_0x9f2918);var _0x338fdd=fs[_0x00ab('0x11')](_0x461eb6);var _0x3a9736=fs[_0x00ab('0x12')](_0x13df24);var _0x4719a3=crypto[_0x00ab('0x1b')](_0x30e3e5[_0x00ab('0x9')],_0x59c766);_0x338fdd['on'](_0x00ab('0x1c'),function(_0x347e97){var _0x5a6d0b=new Buffer(_0x4719a3[_0x00ab('0x14')](_0x347e97),'binary');_0x3a9736['write'](_0x5a6d0b);});_0x338fdd['on'](_0x00ab('0x16'),function(){try{var _0x41bf47=new Buffer(_0x4719a3[_0x00ab('0x1d')](_0x00ab('0x15')),_0x00ab('0x15'));_0x3a9736[_0x00ab('0x17')](_0x41bf47);_0x3a9736['end']();_0x3a9736['on'](_0x00ab('0x18'),function(){return _0x7b354e(_0x13df24);});}catch(_0x1bf692){fs['unlink'](_0x13df24);return _0x548efc(_0x1bf692);}});});};exports[_0x00ab('0x1e')]=function(_0x457c03,_0x413e28,_0x336206){var _0x3728f5=_0x336206||stringOptions[_0x00ab('0x9')];var _0x359ea5=_0x413e28||stringOptions[_0x00ab('0x1f')];var _0x1b1724=crypto[_0x00ab('0x13')](_0x3728f5,_0x359ea5);var _0x29dc84=_0x1b1724[_0x00ab('0x14')](_0x457c03,'utf8',_0x00ab('0x20'));_0x29dc84+=_0x1b1724[_0x00ab('0x1d')](_0x00ab('0x20'));return _0x29dc84;};exports[_0x00ab('0x21')]=function(_0x29990c,_0xedb17c,_0x307a05){var _0x3877b2=_0x307a05||stringOptions[_0x00ab('0x9')];var _0x108233=_0xedb17c||stringOptions['secret'];var _0x102b24=crypto[_0x00ab('0x1b')](_0x3877b2,_0x108233);var _0x7374b=_0x102b24[_0x00ab('0x14')](_0x29990c,_0x00ab('0x20'),_0x00ab('0x22'));_0x7374b+=_0x102b24['final'](_0x00ab('0x22'));return _0x7374b;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9b261f0..0c4f983 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 _0xaa34=['zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','util','path','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','query','format','sequelize','QueryTypes','num','Empty','isInteger','forEach','push','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','length','existsSync','join','%s%d.%s','csv','%s.%s','writeFileSync','zip'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa34,0xc2));var _0x4aa3=function(_0x1594e8,_0x5c037c){_0x1594e8=_0x1594e8-0x0;var _0x47c94d=_0xaa34[_0x1594e8];return _0x47c94d;};'use strict';var util=require(_0x4aa3('0x0'));var path=require(_0x4aa3('0x1'));var _=require('lodash');var csv=require(_0x4aa3('0x2'));var fs=require('fs');var BPromise=require(_0x4aa3('0x3'));var zipdir=require(_0x4aa3('0x4'));var rimraf=require(_0x4aa3('0x5'));var db=require(_0x4aa3('0x6'))['db'];var dbH=require(_0x4aa3('0x6'))['dbH'];var logger=require(_0x4aa3('0x7'))(_0x4aa3('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x4aa3('0x9')][0x2]);var QUERY=process[_0x4aa3('0x9')][0x3];var PATH=process[_0x4aa3('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2ff5f4,_0x5598a7){var _0x1a9551={'status':_0x2ff5f4};var _0xb3006f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5598a7){_0x1a9551[_0x4aa3('0xa')]=_0x5598a7;}return db[_0x4aa3('0xb')][_0x4aa3('0xc')](_0x1a9551,_0xb3006f);}function main(){var _0x17a958=0x1388;var _0x1f9349;logger['info'](util['format'](_0x4aa3('0xd'),EXTRACTED_REPORT_ID,_0x4aa3('0xe')));return db[_0x4aa3('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4aa3('0x10'),_0x4aa3('0x11')]})[_0x4aa3('0x12')](function(_0x5b678e){if(_0x5b678e){_0x1f9349=_0x5b678e;_0x17a958=_0x1f9349[_0x4aa3('0x11')]||0x1388;}})[_0x4aa3('0x12')](function(){return dbH['sequelize'][_0x4aa3('0x13')](util[_0x4aa3('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x4aa3('0x15')][_0x4aa3('0x16')]['SELECT']});})[_0x4aa3('0x12')](function(_0x4e6b97){if(!_0x4e6b97[0x0][_0x4aa3('0x17')]){return analyticExtractedReport(_0x4aa3('0x18'));}var _0x1b355=[];var _0x4e99ed=0x0;if(_0x1f9349['split']){if(_0x4e6b97&&_0x4e6b97['length']){var _0x26d297=_['range'](_0x4e6b97[0x0][_0x4aa3('0x17')]/_0x17a958);var _0x583308=Number[_0x4aa3('0x19')](_0x4e6b97[0x0][_0x4aa3('0x17')]/_0x17a958)?_0x4e6b97[0x0][_0x4aa3('0x17')]%_0x17a958:0x0;_0x26d297[_0x4aa3('0x1a')](function(_0x27b0f8){if(_0x27b0f8>0x0){_0x4e99ed+=_0x17a958;}_0x1b355[_0x4aa3('0x1b')](dbH['sequelize'][_0x4aa3('0x13')](util[_0x4aa3('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17a958,_0x4e99ed),{'type':dbH[_0x4aa3('0x15')][_0x4aa3('0x16')][_0x4aa3('0x1c')]}));});if(_0x583308>0x0){_0x4e99ed+=_0x17a958;_0x1b355[_0x4aa3('0x1b')](dbH[_0x4aa3('0x15')]['query'](util[_0x4aa3('0x14')](_0x4aa3('0x1d'),QUERY,_0x583308,_0x4e99ed),{'type':dbH[_0x4aa3('0x15')][_0x4aa3('0x16')]['SELECT']}));}}}else{_0x1b355['push'](dbH[_0x4aa3('0x15')]['query'](QUERY,{'type':dbH['sequelize'][_0x4aa3('0x16')][_0x4aa3('0x1c')]}));}var _0x1f14e7=path[_0x4aa3('0x1e')](PATH);var _0x37b29d=path[_0x4aa3('0x1f')](PATH,_0x4aa3('0x20'));var _0x50f1e9=_0x1f9349[_0x4aa3('0x10')]&&_0x1b355[_0x4aa3('0x21')]>0x1;var _0x1a1b29=[];if(!fs[_0x4aa3('0x22')](path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d))&&_0x50f1e9){fs['mkdirSync'](path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d));}return BPromise['each'](_0x1b355,function(_0x3b75bc){_0x1a1b29[_0x4aa3('0x1b')](_0x3b75bc);})['then'](function(){for(var _0x57a1e4=0x0;_0x57a1e4<_0x1a1b29['length'];_0x57a1e4+=0x1){var _0x14d5e4;var _0x26051c=_0x1a1b29[_0x57a1e4];if(_0x50f1e9){_0x14d5e4=path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d,util[_0x4aa3('0x14')](_0x4aa3('0x24'),_0x37b29d,_0x57a1e4,_0x4aa3('0x25')));}else{_0x14d5e4=path[_0x4aa3('0x23')](_0x1f14e7,util[_0x4aa3('0x14')](_0x4aa3('0x26'),_0x37b29d,_0x4aa3('0x25')));}fs[_0x4aa3('0x27')](_0x14d5e4,csv(_0x26051c));}})[_0x4aa3('0x12')](function(){if(_0x50f1e9){return new Promise(function(_0x170aac){zipdir(path[_0x4aa3('0x23')](_0x1f14e7,_0x37b29d),{'saveTo':path[_0x4aa3('0x23')](_0x1f14e7,util[_0x4aa3('0x14')](_0x4aa3('0x26'),_0x37b29d,_0x4aa3('0x28')))},function(_0xbd84d3,_0x580d77){rimraf(path['join'](_0x1f14e7,_0x37b29d),function(){});_0x170aac(_0x4aa3('0x29'));});});}})[_0x4aa3('0x12')](function(){logger[_0x4aa3('0x2a')](util[_0x4aa3('0x14')](_0x4aa3('0x2b'),EXTRACTED_REPORT_ID,_0x4aa3('0xe')));return analyticExtractedReport(_0x4aa3('0x2c'),_0x50f1e9?util[_0x4aa3('0x14')]('%s.%s',_0x37b29d,_0x50f1e9?_0x4aa3('0x28'):'csv'):null);});})['catch'](function(_0x13c066){logger[_0x4aa3('0x2a')](util['format'](_0x4aa3('0x2d'),EXTRACTED_REPORT_ID,_0x4aa3('0xe')),util[_0x4aa3('0x2e')](_0x13c066,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x3450=['push','dirname','basename','length','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','util','path','to-csv','zip-dir','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','SELECT','num','Empty','range','forEach','query','QueryTypes'];(function(_0x1f77a2,_0x4d639b){var _0x560005=function(_0x4595dd){while(--_0x4595dd){_0x1f77a2['push'](_0x1f77a2['shift']());}};_0x560005(++_0x4d639b);}(_0x3450,0xd0));var _0x0345=function(_0x4eab61,_0x1a6e6d){_0x4eab61=_0x4eab61-0x0;var _0x342426=_0x3450[_0x4eab61];return _0x342426;};'use strict';var util=require(_0x0345('0x0'));var path=require(_0x0345('0x1'));var _=require('lodash');var csv=require(_0x0345('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0x0345('0x3'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0x0345('0x4'))[_0x0345('0x5')];var logger=require(_0x0345('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x0345('0x7')][0x3];var PATH=process[_0x0345('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x59881d,_0x1ca0db){var _0x3e4d4b={'status':_0x59881d};var _0x8c0ea1={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1ca0db){_0x3e4d4b['savename']=_0x1ca0db;}return db[_0x0345('0x8')][_0x0345('0x9')](_0x3e4d4b,_0x8c0ea1);}function main(){var _0x280799=0x1388;var _0x4fcffb;logger[_0x0345('0xa')](util[_0x0345('0xb')](_0x0345('0xc'),EXTRACTED_REPORT_ID,_0x0345('0xd')));return db[_0x0345('0xe')][_0x0345('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x0345('0x10'),_0x0345('0x11')]})['then'](function(_0x1f5d42){if(_0x1f5d42){_0x4fcffb=_0x1f5d42;_0x280799=_0x4fcffb['splitSizeCsv']||0x1388;}})[_0x0345('0x12')](function(){return dbH[_0x0345('0x13')]['query'](util[_0x0345('0xb')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x0345('0x13')]['QueryTypes'][_0x0345('0x14')]});})[_0x0345('0x12')](function(_0x44d594){if(!_0x44d594[0x0][_0x0345('0x15')]){return analyticExtractedReport(_0x0345('0x16'));}var _0x2b9cf2=[];var _0x66f157=0x0;if(_0x4fcffb[_0x0345('0x10')]){if(_0x44d594&&_0x44d594['length']){var _0x31e0a9=_[_0x0345('0x17')](_0x44d594[0x0][_0x0345('0x15')]/_0x280799);var _0x2b55e0=Number['isInteger'](_0x44d594[0x0]['num']/_0x280799)?_0x44d594[0x0][_0x0345('0x15')]%_0x280799:0x0;_0x31e0a9[_0x0345('0x18')](function(_0x276885){if(_0x276885>0x0){_0x66f157+=_0x280799;}_0x2b9cf2['push'](dbH['sequelize'][_0x0345('0x19')](util[_0x0345('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x280799,_0x66f157),{'type':dbH[_0x0345('0x13')][_0x0345('0x1a')][_0x0345('0x14')]}));});if(_0x2b55e0>0x0){_0x66f157+=_0x280799;_0x2b9cf2['push'](dbH[_0x0345('0x13')][_0x0345('0x19')](util[_0x0345('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x2b55e0,_0x66f157),{'type':dbH[_0x0345('0x13')]['QueryTypes'][_0x0345('0x14')]}));}}}else{_0x2b9cf2[_0x0345('0x1b')](dbH[_0x0345('0x13')][_0x0345('0x19')](QUERY,{'type':dbH[_0x0345('0x13')][_0x0345('0x1a')][_0x0345('0x14')]}));}var _0x335cc4=path[_0x0345('0x1c')](PATH);var _0x2d7e99=path[_0x0345('0x1d')](PATH,'.csv');var _0x1dc83f=_0x4fcffb[_0x0345('0x10')]&&_0x2b9cf2[_0x0345('0x1e')]>0x1;var _0x4e661b=[];if(!fs[_0x0345('0x1f')](path[_0x0345('0x20')](_0x335cc4,_0x2d7e99))&&_0x1dc83f){fs[_0x0345('0x21')](path[_0x0345('0x20')](_0x335cc4,_0x2d7e99));}return BPromise[_0x0345('0x22')](_0x2b9cf2,function(_0x4925e0){_0x4e661b['push'](_0x4925e0);})[_0x0345('0x12')](function(){for(var _0x53b7e9=0x0;_0x53b7e9<_0x4e661b[_0x0345('0x1e')];_0x53b7e9+=0x1){var _0x371652;var _0x20527a=_0x4e661b[_0x53b7e9];if(_0x1dc83f){_0x371652=path[_0x0345('0x20')](_0x335cc4,_0x2d7e99,util[_0x0345('0xb')](_0x0345('0x23'),_0x2d7e99,_0x53b7e9,_0x0345('0x24')));}else{_0x371652=path[_0x0345('0x20')](_0x335cc4,util['format'](_0x0345('0x25'),_0x2d7e99,'csv'));}fs[_0x0345('0x26')](_0x371652,csv(_0x20527a));}})['then'](function(){if(_0x1dc83f){return new Promise(function(_0x14155d){zipdir(path['join'](_0x335cc4,_0x2d7e99),{'saveTo':path[_0x0345('0x20')](_0x335cc4,util[_0x0345('0xb')](_0x0345('0x25'),_0x2d7e99,_0x0345('0x27')))},function(_0x2066f4,_0x49c2a1){rimraf(path[_0x0345('0x20')](_0x335cc4,_0x2d7e99),function(){});_0x14155d('zip\x20finished');});});}})[_0x0345('0x12')](function(){logger[_0x0345('0xa')](util[_0x0345('0xb')](_0x0345('0x28'),EXTRACTED_REPORT_ID,_0x0345('0xd')));return analyticExtractedReport(_0x0345('0x29'),_0x1dc83f?util[_0x0345('0xb')](_0x0345('0x25'),_0x2d7e99,_0x1dc83f?_0x0345('0x27'):_0x0345('0x24')):null);});})[_0x0345('0x2a')](function(_0x2ed0bd){logger['info'](util[_0x0345('0xb')](_0x0345('0x2b'),EXTRACTED_REPORT_ID,_0x0345('0xd')),util[_0x0345('0x2c')](_0x2ed0bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x0345('0x2d'));})[_0x0345('0x2e')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 16c525d..7a3d0b7 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 _0xd019=['find','split','splitSizePdf','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','basename','.pdf','existsSync','join','each','then','flatten','%s%d.%s','pdf','%s.%s','all','zip\x20finished','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','zip-dir','rimraf','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','map','tableHeader','pick','toString','value','fill','auto','body','concat','chunk','keys','forEach','push','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','format','endDate','length','header','before','landscape','\x20/\x20','footer','Arial','black','num','Empty','Setting'];(function(_0x1f44c1,_0x1af55c){var _0x4a5bef=function(_0x16bdfb){while(--_0x16bdfb){_0x1f44c1['push'](_0x1f44c1['shift']());}};_0x4a5bef(++_0x1af55c);}(_0xd019,0x1f1));var _0x9d01=function(_0x10f68e,_0xf198ea){_0x10f68e=_0x10f68e-0x0;var _0x4c8372=_0xd019[_0x10f68e];return _0x4c8372;};'use strict';var _=require(_0x9d01('0x0'));var fs=require('fs');var util=require(_0x9d01('0x1'));var path=require(_0x9d01('0x2'));var moment=require(_0x9d01('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x9d01('0x4'));var rimraf=require(_0x9d01('0x5'));var JSDOM=require('jsdom')['JSDOM'];var window=new JSDOM('')['window'];var BPromise=require(_0x9d01('0x6'));var db=require(_0x9d01('0x7'))['db'];var dbH=require(_0x9d01('0x7'))[_0x9d01('0x8')];var logger=require(_0x9d01('0x9'))(_0x9d01('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x9d01('0xb')][0x2]);var QUERY=process[_0x9d01('0xb')][0x3];var PATH=process[_0x9d01('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x9d01('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3cc2b7,_0xae05c1){var _0x1d79e5={'status':_0x3cc2b7};var _0x12a34e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xae05c1){_0x1d79e5[_0x9d01('0xd')]=_0xae05c1;}return db[_0x9d01('0xe')]['update'](_0x1d79e5,_0x12a34e);}function getHeaders(_0x3b74a4){return _[_0x9d01('0xf')](_0x3b74a4,function(_0x472355){return{'text':_0x472355,'style':_0x9d01('0x10')};});}function getRows(_0x4c75dd,_0x1076de){return _[_0x9d01('0xf')](_0x1076de,function(_0x357aad){return _(_0x357aad)[_0x9d01('0x11')](_0x4c75dd)[_0x9d01('0xf')](function(_0x6801d1){return _0x6801d1?_[_0x9d01('0x12')](_0x6801d1):'';})[_0x9d01('0x13')]();});}function createTable(_0x4036be,_0x56f793){var _0x4b591c={'widths':_[_0x9d01('0x14')](Array(_0x4036be['length']),0x91),'heights':function(_0x39d88f){return _0x39d88f===0x0?_0x9d01('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x50b240=getHeaders(_0x4036be);_0x4b591c[_0x9d01('0x16')]['push'](_0x50b240);var _0x291c52=getRows(_0x4036be,_0x56f793);_0x4b591c[_0x9d01('0x16')]=_0x4b591c['body'][_0x9d01('0x17')](_0x291c52);return _0x4b591c;}function createTables(_0x2b7e31){var _0x13ccaf=[];var _0x4b17b5=_[_0x9d01('0x18')](Object[_0x9d01('0x19')](_0x2b7e31[0x0]),0x5);_0x4b17b5[_0x9d01('0x1a')](function(_0x77c2f){_0x13ccaf[_0x9d01('0x1b')](createTable(_0x77c2f,_0x2b7e31));});return _0x13ccaf;}function getPDFDocDefinition(_0x1fdf45){var _0x4fccd4=util['format'](_0x9d01('0x1c'),NAME,EXTRACTED_REPORT['name'],moment(EXTRACTED_REPORT[_0x9d01('0x1d')])[_0x9d01('0x1e')](FORMAT),moment(EXTRACTED_REPORT[_0x9d01('0x1f')])[_0x9d01('0x1e')](FORMAT));var _0x5d0205=[];for(var _0x380c8c=0x0;_0x380c8c<_0x1fdf45[_0x9d01('0x20')];_0x380c8c++){var _0x280b84=[];if(_0x380c8c===0x0){_0x280b84['push']({'text':_0x4fccd4,'style':_0x9d01('0x21')});}var _0x116162={'table':_0x1fdf45[_0x380c8c]};if(_0x380c8c>0x0){_0x116162['pageBreak']=_0x9d01('0x22');_0x116162['margin']=[0x0,0x46,0x0,0x0];}_0x280b84[_0x9d01('0x1b')](_0x116162);_0x5d0205[_0x9d01('0x1b')](_0x280b84);}return{'pageSize':'A4','pageOrientation':_0x9d01('0x23'),'content':_0x5d0205,'footer':function(_0x1f9817,_0x406045){return{'text':_0x1f9817['toString']()+_0x9d01('0x24')+_0x406045,'style':_0x9d01('0x25')};},'defaultStyle':{'font':_0x9d01('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x9d01('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x2bde31){var _0x3069fa=0x1388;var _0x1a1c17;if(!_0x2bde31[0x0][_0x9d01('0x28')]){return analyticExtractedReport(_0x9d01('0x29'));}return db[_0x9d01('0x2a')][_0x9d01('0x2b')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x9d01('0x2c'),_0x9d01('0x2d')]})['then'](function(_0x53449e){if(_0x53449e){_0x1a1c17=_0x53449e;_0x3069fa=_0x1a1c17[_0x9d01('0x2d')]||0x3e8;}})['then'](function(){var _0x5ef040=[];var _0x3a8a2e=0x0;if(_0x1a1c17[_0x9d01('0x2c')]){if(_0x2bde31&&_0x2bde31[_0x9d01('0x20')]){var _0x27d8f5=_[_0x9d01('0x2e')](_0x2bde31[0x0][_0x9d01('0x28')]/_0x3069fa);var _0x4cfd8f=Number[_0x9d01('0x2f')](_0x2bde31[0x0][_0x9d01('0x28')]/_0x3069fa)?_0x2bde31[0x0][_0x9d01('0x28')]%_0x3069fa:0x0;_0x27d8f5['forEach'](function(_0x352aff){if(_0x352aff>0x0){_0x3a8a2e+=_0x3069fa;}_0x5ef040[_0x9d01('0x1b')](dbH[_0x9d01('0x30')][_0x9d01('0x31')](util[_0x9d01('0x1e')](_0x9d01('0x32'),QUERY,_0x3069fa,_0x3a8a2e),{'type':dbH['sequelize'][_0x9d01('0x33')][_0x9d01('0x34')]}));});if(_0x4cfd8f>0x0){_0x3a8a2e+=_0x3069fa;_0x5ef040[_0x9d01('0x1b')](dbH[_0x9d01('0x30')][_0x9d01('0x31')](util[_0x9d01('0x1e')](_0x9d01('0x32'),QUERY,_0x4cfd8f,_0x3a8a2e),{'type':dbH[_0x9d01('0x30')][_0x9d01('0x33')][_0x9d01('0x34')]}));}}}else{_0x5ef040[_0x9d01('0x1b')](dbH[_0x9d01('0x30')]['query'](QUERY,{'type':dbH[_0x9d01('0x30')][_0x9d01('0x33')][_0x9d01('0x34')]}));}var _0xef338f=path['dirname'](PATH);var _0x53c479=path[_0x9d01('0x35')](PATH,_0x9d01('0x36'));var _0x3fbd4e=_0x1a1c17[_0x9d01('0x2c')]&&_0x5ef040[_0x9d01('0x20')]>0x1;var _0x2b6b55=[];if(!fs[_0x9d01('0x37')](path[_0x9d01('0x38')](_0xef338f,_0x53c479))&&_0x3fbd4e){fs['mkdirSync'](path[_0x9d01('0x38')](_0xef338f,_0x53c479));}return BPromise[_0x9d01('0x39')](_0x5ef040,function(_0x3a9531){_0x2b6b55['push'](_0x3a9531);})[_0x9d01('0x3a')](function(){var _0x190463=[];for(var _0xf24ded=0x0;_0xf24ded<_0x2b6b55['length'];_0xf24ded+=0x1){var _0x761eb8=_0x2b6b55[_0xf24ded];var _0x1d873b=createTables(_[_0x9d01('0x3b')](_0x761eb8));var _0x65f63a;var _0x1beded=getPDFDocDefinition(_0x1d873b);var _0x542ba5=getPDFPrinter();var _0x31b410=_0x542ba5['createPdfKitDocument'](_0x1beded);if(_0x3fbd4e){_0x65f63a=path[_0x9d01('0x38')](_0xef338f,_0x53c479,util[_0x9d01('0x1e')](_0x9d01('0x3c'),_0x53c479,_0xf24ded,_0x9d01('0x3d')));}else{_0x65f63a=path['join'](_0xef338f,util['format'](_0x9d01('0x3e'),_0x53c479,'pdf'));}_0x190463[_0x9d01('0x1b')](writePDFDocument(_0x31b410,_0x65f63a));}return Promise[_0x9d01('0x3f')](_0x190463);})[_0x9d01('0x3a')](function(){if(_0x3fbd4e){return new Promise(function(_0x243ca2){zipdir(path[_0x9d01('0x38')](_0xef338f,_0x53c479),{'saveTo':path[_0x9d01('0x38')](_0xef338f,util[_0x9d01('0x1e')]('%s.%s',_0x53c479,'zip'))},function(){rimraf(path[_0x9d01('0x38')](_0xef338f,_0x53c479),function(){});_0x243ca2(_0x9d01('0x40'));});});}})[_0x9d01('0x3a')](function(){if(!_0x3fbd4e)return;rimraf(path['join'](_0xef338f,_0x53c479),function(){});})[_0x9d01('0x3a')](function(){logger[_0x9d01('0x41')](util[_0x9d01('0x1e')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x9d01('0x42'),_0x3fbd4e?util[_0x9d01('0x1e')](_0x9d01('0x3e'),_0x53c479,_0x3fbd4e?'zip':_0x9d01('0x3d')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x9d01('0x41')](util[_0x9d01('0x1e')](_0x9d01('0x43'),EXTRACTED_REPORT_ID,_0x9d01('0x44')));return db[_0x9d01('0xe')][_0x9d01('0x45')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x9d01('0x3a')](function(_0x17c98c){EXTRACTED_REPORT=_0x17c98c;return dbH[_0x9d01('0x30')][_0x9d01('0x31')](util[_0x9d01('0x1e')](_0x9d01('0x46'),QUERY),{'type':dbH[_0x9d01('0x30')]['QueryTypes']['SELECT']});})['then'](extractReport)[_0x9d01('0x47')](function(_0x148b19){logger['info'](util[_0x9d01('0x1e')](_0x9d01('0x48'),EXTRACTED_REPORT_ID,_0x9d01('0x44')),util[_0x9d01('0x49')](_0x148b19,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x9d01('0x4a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x3a1977=new PdfPrinter({'Arial':{'normal':__dirname+_0x9d01('0x4b'),'bold':__dirname+_0x9d01('0x4c'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x9d01('0x4d')}});return _0x3a1977;}function getPDFDocDefinitionFromHTML(_0x47027f,_0x21f691){var _0x4990f6=util['format'](_0x9d01('0x4e'),_0x21f691['channel'],_0x21f691[_0x9d01('0x4f')]);var _0x3f954c=moment()[_0x9d01('0x1e')](_0x9d01('0x50'))['toString']();var _0x39eb90=htmlToPdfmake(_0x47027f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x39eb90],'defaultStyle':{'font':_0x9d01('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','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':'center'}},'header':function(){return[{'text':_0x9d01('0x51'),'style':_0x9d01('0x21')}];},'footer':function(_0x22453c,_0x344f3c){return[{'text':util['format'](_0x9d01('0x52'),_0x4990f6,_0x22453c,_0x344f3c,_0x3f954c),'style':_0x9d01('0x25')}];}};}function writePDFDocument(_0x517a66,_0x508389){return new Promise(function(_0x2d8e43,_0x3af8b5){var _0x355f75=_0x517a66[_0x9d01('0x53')](fs[_0x9d01('0x54')](_0x508389));_0x355f75['on']('finish',function(){_0x2d8e43(_0x9d01('0x55'));});_0x355f75['on'](_0x9d01('0x56'),function(_0x4a9e75){_0x3af8b5(_0x4a9e75);});_0x517a66[_0x9d01('0x57')]();});}exports[_0x9d01('0x58')]=function(_0x4d7629,_0x398183){var _0x5833be=getPDFPrinter();var _0x1bde44=getPDFDocDefinitionFromHTML(_0x4d7629,_0x398183);var _0x48aefe=_0x5833be[_0x9d01('0x59')](_0x1bde44);return writePDFDocument(_0x48aefe,_0x398183[_0x9d01('0x2')])[_0x9d01('0x47')](function(_0xa9ab99){throw _0xa9ab99;});}; \ No newline at end of file +var _0x1fa1=['join','each','flatten','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','%s.%s','zip','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','YYYY-MM-DD','center','Interaction\x20Transcript','pipe','createWriteStream','finish','error','end','createPdfFromHTML','path','lodash','util','moment','pdfmake/src/printer','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','tableHeader','map','pick','value','length','auto','body','push','concat','chunk','keys','forEach','name','format','endDate','header','pageBreak','before','landscape','toString','footer','Arial','right','num','Empty','Setting','find','split','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','mkdirSync'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0x1fa1,0x119));var _0x11fa=function(_0x403c20,_0x4a7b99){_0x403c20=_0x403c20-0x0;var _0x2b271a=_0x1fa1[_0x403c20];return _0x2b271a;};'use strict';var _=require(_0x11fa('0x0'));var fs=require('fs');var util=require(_0x11fa('0x1'));var path=require('path');var moment=require(_0x11fa('0x2'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x11fa('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x11fa('0x4'));var JSDOM=require(_0x11fa('0x5'))[_0x11fa('0x6')];var window=new JSDOM('')['window'];var BPromise=require(_0x11fa('0x7'));var db=require(_0x11fa('0x8'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x11fa('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x11fa('0xa')][0x2]);var QUERY=process[_0x11fa('0xa')][0x3];var PATH=process[_0x11fa('0xa')][0x4];var NAME=process[_0x11fa('0xa')][0x5];var FORMAT=_0x11fa('0xb');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1945c8,_0x218d1b){var _0x3fa608={'status':_0x1945c8};var _0x2a3395={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x218d1b){_0x3fa608['savename']=_0x218d1b;}return db[_0x11fa('0xc')][_0x11fa('0xd')](_0x3fa608,_0x2a3395);}function getHeaders(_0x4bd4ba){return _['map'](_0x4bd4ba,function(_0x44974f){return{'text':_0x44974f,'style':_0x11fa('0xe')};});}function getRows(_0x1c608d,_0x595693){return _[_0x11fa('0xf')](_0x595693,function(_0x21fbd6){return _(_0x21fbd6)[_0x11fa('0x10')](_0x1c608d)[_0x11fa('0xf')](function(_0x432027){return _0x432027?_['toString'](_0x432027):'';})[_0x11fa('0x11')]();});}function createTable(_0x5145a5,_0x320503){var _0xe810c1={'widths':_['fill'](Array(_0x5145a5[_0x11fa('0x12')]),0x91),'heights':function(_0x50a213){return _0x50a213===0x0?_0x11fa('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x2100ba=getHeaders(_0x5145a5);_0xe810c1[_0x11fa('0x14')][_0x11fa('0x15')](_0x2100ba);var _0x4c2714=getRows(_0x5145a5,_0x320503);_0xe810c1['body']=_0xe810c1[_0x11fa('0x14')][_0x11fa('0x16')](_0x4c2714);return _0xe810c1;}function createTables(_0x189519){var _0x556b11=[];var _0x2fbf2f=_[_0x11fa('0x17')](Object[_0x11fa('0x18')](_0x189519[0x0]),0x5);_0x2fbf2f[_0x11fa('0x19')](function(_0x4d4472){_0x556b11[_0x11fa('0x15')](createTable(_0x4d4472,_0x189519));});return _0x556b11;}function getPDFDocDefinition(_0x879365){var _0x1d8856=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x11fa('0x1a')],moment(EXTRACTED_REPORT['startDate'])[_0x11fa('0x1b')](FORMAT),moment(EXTRACTED_REPORT[_0x11fa('0x1c')])[_0x11fa('0x1b')](FORMAT));var _0x38f7b1=[];for(var _0xa83ee7=0x0;_0xa83ee7<_0x879365[_0x11fa('0x12')];_0xa83ee7++){var _0x2af3e7=[];if(_0xa83ee7===0x0){_0x2af3e7['push']({'text':_0x1d8856,'style':_0x11fa('0x1d')});}var _0x134ccc={'table':_0x879365[_0xa83ee7]};if(_0xa83ee7>0x0){_0x134ccc[_0x11fa('0x1e')]=_0x11fa('0x1f');_0x134ccc['margin']=[0x0,0x46,0x0,0x0];}_0x2af3e7[_0x11fa('0x15')](_0x134ccc);_0x38f7b1[_0x11fa('0x15')](_0x2af3e7);}return{'pageSize':'A4','pageOrientation':_0x11fa('0x20'),'content':_0x38f7b1,'footer':function(_0x318a81,_0x53bfc){return{'text':_0x318a81[_0x11fa('0x21')]()+'\x20/\x20'+_0x53bfc,'style':_0x11fa('0x22')};},'defaultStyle':{'font':_0x11fa('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':_0x11fa('0x24'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x4b6097){var _0x540c6f=0x1388;var _0xfadb0;if(!_0x4b6097[0x0][_0x11fa('0x25')]){return analyticExtractedReport(_0x11fa('0x26'));}return db[_0x11fa('0x27')][_0x11fa('0x28')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x11fa('0x29'),'splitSizePdf']})['then'](function(_0x1ff32a){if(_0x1ff32a){_0xfadb0=_0x1ff32a;_0x540c6f=_0xfadb0['splitSizePdf']||0x3e8;}})[_0x11fa('0x2a')](function(){var _0x42ce23=[];var _0x290639=0x0;if(_0xfadb0[_0x11fa('0x29')]){if(_0x4b6097&&_0x4b6097[_0x11fa('0x12')]){var _0x1c660d=_[_0x11fa('0x2b')](_0x4b6097[0x0][_0x11fa('0x25')]/_0x540c6f);var _0x4081f2=Number[_0x11fa('0x2c')](_0x4b6097[0x0]['num']/_0x540c6f)?_0x4b6097[0x0]['num']%_0x540c6f:0x0;_0x1c660d[_0x11fa('0x19')](function(_0x22be30){if(_0x22be30>0x0){_0x290639+=_0x540c6f;}_0x42ce23[_0x11fa('0x15')](dbH[_0x11fa('0x2d')][_0x11fa('0x2e')](util['format'](_0x11fa('0x2f'),QUERY,_0x540c6f,_0x290639),{'type':dbH[_0x11fa('0x2d')][_0x11fa('0x30')]['SELECT']}));});if(_0x4081f2>0x0){_0x290639+=_0x540c6f;_0x42ce23[_0x11fa('0x15')](dbH[_0x11fa('0x2d')][_0x11fa('0x2e')](util[_0x11fa('0x1b')](_0x11fa('0x2f'),QUERY,_0x4081f2,_0x290639),{'type':dbH['sequelize']['QueryTypes'][_0x11fa('0x31')]}));}}}else{_0x42ce23[_0x11fa('0x15')](dbH[_0x11fa('0x2d')][_0x11fa('0x2e')](QUERY,{'type':dbH[_0x11fa('0x2d')][_0x11fa('0x30')][_0x11fa('0x31')]}));}var _0x1f5d86=path[_0x11fa('0x32')](PATH);var _0x159001=path[_0x11fa('0x33')](PATH,_0x11fa('0x34'));var _0x527ca9=_0xfadb0[_0x11fa('0x29')]&&_0x42ce23['length']>0x1;var _0x1fcb27=[];if(!fs[_0x11fa('0x35')](path['join'](_0x1f5d86,_0x159001))&&_0x527ca9){fs[_0x11fa('0x36')](path[_0x11fa('0x37')](_0x1f5d86,_0x159001));}return BPromise[_0x11fa('0x38')](_0x42ce23,function(_0x4fc25e){_0x1fcb27[_0x11fa('0x15')](_0x4fc25e);})[_0x11fa('0x2a')](function(){var _0x40def3=[];for(var _0x42ec53=0x0;_0x42ec53<_0x1fcb27[_0x11fa('0x12')];_0x42ec53+=0x1){var _0x50f2d4=_0x1fcb27[_0x42ec53];var _0x5a7260=createTables(_[_0x11fa('0x39')](_0x50f2d4));var _0xe730e;var _0x247dc8=getPDFDocDefinition(_0x5a7260);var _0x4e5cfe=getPDFPrinter();var _0x4bafe3=_0x4e5cfe['createPdfKitDocument'](_0x247dc8);if(_0x527ca9){_0xe730e=path[_0x11fa('0x37')](_0x1f5d86,_0x159001,util['format']('%s%d.%s',_0x159001,_0x42ec53,'pdf'));}else{_0xe730e=path[_0x11fa('0x37')](_0x1f5d86,util[_0x11fa('0x1b')]('%s.%s',_0x159001,'pdf'));}_0x40def3['push'](writePDFDocument(_0x4bafe3,_0xe730e));}return Promise['all'](_0x40def3);})[_0x11fa('0x2a')](function(){if(_0x527ca9){return new Promise(function(_0x335bce){zipdir(path['join'](_0x1f5d86,_0x159001),{'saveTo':path[_0x11fa('0x37')](_0x1f5d86,util[_0x11fa('0x1b')]('%s.%s',_0x159001,'zip'))},function(){rimraf(path[_0x11fa('0x37')](_0x1f5d86,_0x159001),function(){});_0x335bce(_0x11fa('0x3a'));});});}})[_0x11fa('0x2a')](function(){if(!_0x527ca9)return;rimraf(path['join'](_0x1f5d86,_0x159001),function(){});})[_0x11fa('0x2a')](function(){logger[_0x11fa('0x3b')](util[_0x11fa('0x1b')](_0x11fa('0x3c'),EXTRACTED_REPORT_ID,_0x11fa('0x3d')));return analyticExtractedReport(_0x11fa('0x3e'),_0x527ca9?util[_0x11fa('0x1b')](_0x11fa('0x3f'),_0x159001,_0x527ca9?_0x11fa('0x40'):_0x11fa('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x11fa('0x3b')](util[_0x11fa('0x1b')](_0x11fa('0x42'),EXTRACTED_REPORT_ID,'PDF'));return db[_0x11fa('0xc')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0xfe0c75){EXTRACTED_REPORT=_0xfe0c75;return dbH[_0x11fa('0x2d')][_0x11fa('0x2e')](util[_0x11fa('0x1b')](_0x11fa('0x43'),QUERY),{'type':dbH[_0x11fa('0x2d')][_0x11fa('0x30')]['SELECT']});})[_0x11fa('0x2a')](extractReport)[_0x11fa('0x44')](function(_0x1f86e1){logger[_0x11fa('0x3b')](util['format'](_0x11fa('0x45'),EXTRACTED_REPORT_ID,_0x11fa('0x3d')),util['inspect'](_0x1f86e1,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x11fa('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x50adfe=new PdfPrinter({'Arial':{'normal':__dirname+_0x11fa('0x47'),'bold':__dirname+_0x11fa('0x48'),'italics':__dirname+_0x11fa('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x50adfe;}function getPDFDocDefinitionFromHTML(_0x3f787a,_0x4951e2){var _0x1ef57e=util[_0x11fa('0x1b')]('%s\x20#%d',_0x4951e2['channel'],_0x4951e2['interactionId']);var _0x20eba4=moment()[_0x11fa('0x1b')](_0x11fa('0x4a'))[_0x11fa('0x21')]();var _0x153406=htmlToPdfmake(_0x3f787a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x153406],'defaultStyle':{'font':_0x11fa('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x11fa('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x11fa('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x11fa('0x4b')}},'header':function(){return[{'text':_0x11fa('0x4c'),'style':_0x11fa('0x1d')}];},'footer':function(_0x550163,_0xbf532a){return[{'text':util['format']('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x1ef57e,_0x550163,_0xbf532a,_0x20eba4),'style':_0x11fa('0x22')}];}};}function writePDFDocument(_0x155048,_0x4be807){return new Promise(function(_0x1e513b,_0x259e62){var _0x444143=_0x155048[_0x11fa('0x4d')](fs[_0x11fa('0x4e')](_0x4be807));_0x444143['on']('finish',function(){_0x1e513b(_0x11fa('0x4f'));});_0x444143['on'](_0x11fa('0x50'),function(_0x40865a){_0x259e62(_0x40865a);});_0x155048[_0x11fa('0x51')]();});}exports[_0x11fa('0x52')]=function(_0x4f60cc,_0x41f44c){var _0x105461=getPDFPrinter();var _0x2280aa=getPDFDocDefinitionFromHTML(_0x4f60cc,_0x41f44c);var _0x3452ea=_0x105461['createPdfKitDocument'](_0x2280aa);return writePDFDocument(_0x3452ea,_0x41f44c[_0x11fa('0x53')])[_0x11fa('0x44')](function(_0x497209){throw _0x497209;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index f2b2868..9a28d8e 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 _0x7f68=['mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','finally','util','lodash','json2xls','bluebird','zip-dir','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','then','splitSizeXlsx','sequelize','query','QueryTypes','SELECT','num','split','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join'];(function(_0x110973,_0x975de7){var _0xcfa20f=function(_0xfa012c){while(--_0xfa012c){_0x110973['push'](_0x110973['shift']());}};_0xcfa20f(++_0x975de7);}(_0x7f68,0xcf));var _0x87f6=function(_0x46ae53,_0x4e490d){_0x46ae53=_0x46ae53-0x0;var _0x498500=_0x7f68[_0x46ae53];return _0x498500;};'use strict';var util=require(_0x87f6('0x0'));var path=require('path');var _=require(_0x87f6('0x1'));var fs=require('fs');var json2xls=require(_0x87f6('0x2'));var BPromise=require(_0x87f6('0x3'));var zipdir=require(_0x87f6('0x4'));var rimraf=require('rimraf');var db=require(_0x87f6('0x5'))['db'];var dbH=require('../../mysqldb')[_0x87f6('0x6')];var logger=require(_0x87f6('0x7'))(_0x87f6('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0x87f6('0x9')][0x2]);var QUERY=process[_0x87f6('0x9')][0x3];var PATH=process[_0x87f6('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5475ed,_0x5a05a8){var _0x397d3e={'status':_0x5475ed};var _0x2fa576={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5a05a8){_0x397d3e[_0x87f6('0xa')]=_0x5a05a8;}return db['AnalyticExtractedReport'][_0x87f6('0xb')](_0x397d3e,_0x2fa576);}function main(){var _0x3d0471=0x1388;var _0x5ddbca;logger['info'](util[_0x87f6('0xc')](_0x87f6('0xd'),EXTRACTED_REPORT_ID,_0x87f6('0xe')));return db[_0x87f6('0xf')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeXlsx']})[_0x87f6('0x10')](function(_0x3392f3){if(_0x3392f3){_0x5ddbca=_0x3392f3;_0x3d0471=_0x5ddbca[_0x87f6('0x11')]||0x1388;}})[_0x87f6('0x10')](function(){return dbH[_0x87f6('0x12')][_0x87f6('0x13')](util[_0x87f6('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x87f6('0x12')][_0x87f6('0x14')][_0x87f6('0x15')]});})[_0x87f6('0x10')](function(_0x5d217f){if(!_0x5d217f[0x0][_0x87f6('0x16')]){return analyticExtractedReport('Empty');}var _0xa9f478=[];var _0x174982=0x0;if(_0x5ddbca[_0x87f6('0x17')]){if(_0x5d217f&&_0x5d217f[_0x87f6('0x18')]){var _0x9c7ec6=_[_0x87f6('0x19')](_0x5d217f[0x0][_0x87f6('0x16')]/_0x3d0471);var _0x1a23b9=Number[_0x87f6('0x1a')](_0x5d217f[0x0]['num']/_0x3d0471)?_0x5d217f[0x0][_0x87f6('0x16')]%_0x3d0471:0x0;_0x9c7ec6['forEach'](function(_0x355648){if(_0x355648>0x0){_0x174982+=_0x3d0471;}_0xa9f478[_0x87f6('0x1b')](dbH[_0x87f6('0x12')]['query'](util['format'](_0x87f6('0x1c'),QUERY,_0x3d0471,_0x174982),{'type':dbH[_0x87f6('0x12')][_0x87f6('0x14')][_0x87f6('0x15')]}));});if(_0x1a23b9>0x0){_0x174982+=_0x3d0471;_0xa9f478[_0x87f6('0x1b')](dbH[_0x87f6('0x12')][_0x87f6('0x13')](util[_0x87f6('0xc')](_0x87f6('0x1c'),QUERY,_0x1a23b9,_0x174982),{'type':dbH[_0x87f6('0x12')][_0x87f6('0x14')][_0x87f6('0x15')]}));}}}else{_0xa9f478['push'](dbH[_0x87f6('0x12')][_0x87f6('0x13')](QUERY,{'type':dbH[_0x87f6('0x12')]['QueryTypes']['SELECT']}));}var _0xe7943b=path[_0x87f6('0x1d')](PATH);var _0x104997=path[_0x87f6('0x1e')](PATH,'.xlsx');var _0x21a3e1=_0x5ddbca[_0x87f6('0x17')]&&_0xa9f478[_0x87f6('0x18')]>0x1;var _0x20e68d=[];if(!fs[_0x87f6('0x1f')](path[_0x87f6('0x20')](_0xe7943b,_0x104997))&&_0x21a3e1){fs[_0x87f6('0x21')](path['join'](_0xe7943b,_0x104997));}return BPromise[_0x87f6('0x22')](_0xa9f478,function(_0x13f7f6){_0x20e68d[_0x87f6('0x1b')](_0x13f7f6);})[_0x87f6('0x10')](function(){for(var _0x543d42=0x0;_0x543d42<_0x20e68d[_0x87f6('0x18')];_0x543d42+=0x1){var _0x2e4b45;var _0x44432f=_0x20e68d[_0x543d42];if(_0x21a3e1){_0x2e4b45=path[_0x87f6('0x20')](_0xe7943b,_0x104997,util[_0x87f6('0xc')](_0x87f6('0x23'),_0x104997,_0x543d42,_0x87f6('0x24')));}else{_0x2e4b45=path['join'](_0xe7943b,util[_0x87f6('0xc')](_0x87f6('0x25'),_0x104997,_0x87f6('0x24')));}fs[_0x87f6('0x26')](_0x2e4b45,json2xls(_0x44432f),_0x87f6('0x27'));}})['then'](function(){if(_0x21a3e1){return new Promise(function(_0x17c2e8){zipdir(path['join'](_0xe7943b,_0x104997),{'saveTo':path[_0x87f6('0x20')](_0xe7943b,util[_0x87f6('0xc')]('%s.%s',_0x104997,_0x87f6('0x28')))},function(_0xe86af2,_0x119f05){rimraf(path[_0x87f6('0x20')](_0xe7943b,_0x104997),function(){});_0x17c2e8(_0x87f6('0x29'));});});}})[_0x87f6('0x10')](function(){logger[_0x87f6('0x2a')](util[_0x87f6('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x87f6('0xe')));return analyticExtractedReport(_0x87f6('0x2b'),_0x21a3e1?util[_0x87f6('0xc')]('%s.%s',_0x104997,_0x21a3e1?_0x87f6('0x28'):_0x87f6('0x24')):null);});})[_0x87f6('0x2c')](function(_0x42fc16){logger[_0x87f6('0x2a')](util['format'](_0x87f6('0x2d'),EXTRACTED_REPORT_ID,_0x87f6('0xe')),util[_0x87f6('0x2e')](_0x42fc16,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0x87f6('0x2f')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xc234=['sequelize','query','SELECT','num','Empty','length','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','dirname','.xlsx','existsSync','join','mkdirSync','%s%d.%s','%s.%s','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','xlsx','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','split','splitSizeXlsx','then'];(function(_0x15529f,_0x3120ac){var _0x1d7a50=function(_0x495443){while(--_0x495443){_0x15529f['push'](_0x15529f['shift']());}};_0x1d7a50(++_0x3120ac);}(_0xc234,0x7f));var _0x4c23=function(_0x50a2db,_0x3f0af9){_0x50a2db=_0x50a2db-0x0;var _0x1c5529=_0xc234[_0x50a2db];return _0x1c5529;};'use strict';var util=require('util');var path=require(_0x4c23('0x0'));var _=require(_0x4c23('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x4c23('0x2'));var zipdir=require(_0x4c23('0x3'));var rimraf=require(_0x4c23('0x4'));var db=require(_0x4c23('0x5'))['db'];var dbH=require(_0x4c23('0x5'))[_0x4c23('0x6')];var logger=require(_0x4c23('0x7'))(_0x4c23('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x4c23('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3dc42b,_0x44d13d){var _0xa2297d={'status':_0x3dc42b};var _0x49a163={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x44d13d){_0xa2297d[_0x4c23('0xa')]=_0x44d13d;}return db[_0x4c23('0xb')][_0x4c23('0xc')](_0xa2297d,_0x49a163);}function main(){var _0x5a1048=0x1388;var _0x49edff;logger[_0x4c23('0xd')](util[_0x4c23('0xe')](_0x4c23('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x4c23('0x10')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4c23('0x11'),_0x4c23('0x12')]})[_0x4c23('0x13')](function(_0x20997e){if(_0x20997e){_0x49edff=_0x20997e;_0x5a1048=_0x49edff['splitSizeXlsx']||0x1388;}})[_0x4c23('0x13')](function(){return dbH[_0x4c23('0x14')][_0x4c23('0x15')](util[_0x4c23('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0x4c23('0x16')]});})[_0x4c23('0x13')](function(_0x4e68cb){if(!_0x4e68cb[0x0][_0x4c23('0x17')]){return analyticExtractedReport(_0x4c23('0x18'));}var _0x1020f9=[];var _0x87b529=0x0;if(_0x49edff[_0x4c23('0x11')]){if(_0x4e68cb&&_0x4e68cb[_0x4c23('0x19')]){var _0x4b6cbd=_['range'](_0x4e68cb[0x0][_0x4c23('0x17')]/_0x5a1048);var _0x16d6c6=Number[_0x4c23('0x1a')](_0x4e68cb[0x0][_0x4c23('0x17')]/_0x5a1048)?_0x4e68cb[0x0][_0x4c23('0x17')]%_0x5a1048:0x0;_0x4b6cbd[_0x4c23('0x1b')](function(_0x4334a4){if(_0x4334a4>0x0){_0x87b529+=_0x5a1048;}_0x1020f9['push'](dbH[_0x4c23('0x14')]['query'](util['format'](_0x4c23('0x1c'),QUERY,_0x5a1048,_0x87b529),{'type':dbH['sequelize'][_0x4c23('0x1d')][_0x4c23('0x16')]}));});if(_0x16d6c6>0x0){_0x87b529+=_0x5a1048;_0x1020f9[_0x4c23('0x1e')](dbH['sequelize'][_0x4c23('0x15')](util[_0x4c23('0xe')](_0x4c23('0x1c'),QUERY,_0x16d6c6,_0x87b529),{'type':dbH[_0x4c23('0x14')]['QueryTypes']['SELECT']}));}}}else{_0x1020f9['push'](dbH[_0x4c23('0x14')][_0x4c23('0x15')](QUERY,{'type':dbH[_0x4c23('0x14')][_0x4c23('0x1d')][_0x4c23('0x16')]}));}var _0x57ef57=path[_0x4c23('0x1f')](PATH);var _0x19a670=path['basename'](PATH,_0x4c23('0x20'));var _0x2f8cd7=_0x49edff[_0x4c23('0x11')]&&_0x1020f9[_0x4c23('0x19')]>0x1;var _0x4646b5=[];if(!fs[_0x4c23('0x21')](path[_0x4c23('0x22')](_0x57ef57,_0x19a670))&&_0x2f8cd7){fs[_0x4c23('0x23')](path[_0x4c23('0x22')](_0x57ef57,_0x19a670));}return BPromise['each'](_0x1020f9,function(_0x521500){_0x4646b5[_0x4c23('0x1e')](_0x521500);})[_0x4c23('0x13')](function(){for(var _0x59f257=0x0;_0x59f257<_0x4646b5[_0x4c23('0x19')];_0x59f257+=0x1){var _0x237cd3;var _0x3bb66a=_0x4646b5[_0x59f257];if(_0x2f8cd7){_0x237cd3=path['join'](_0x57ef57,_0x19a670,util['format'](_0x4c23('0x24'),_0x19a670,_0x59f257,'xlsx'));}else{_0x237cd3=path[_0x4c23('0x22')](_0x57ef57,util[_0x4c23('0xe')](_0x4c23('0x25'),_0x19a670,'xlsx'));}fs['writeFileSync'](_0x237cd3,json2xls(_0x3bb66a),'binary');}})['then'](function(){if(_0x2f8cd7){return new Promise(function(_0x5af8d8){zipdir(path[_0x4c23('0x22')](_0x57ef57,_0x19a670),{'saveTo':path['join'](_0x57ef57,util[_0x4c23('0xe')](_0x4c23('0x25'),_0x19a670,'zip'))},function(_0x34a694,_0x215cd6){rimraf(path[_0x4c23('0x22')](_0x57ef57,_0x19a670),function(){});_0x5af8d8(_0x4c23('0x26'));});});}})[_0x4c23('0x13')](function(){logger[_0x4c23('0xd')](util[_0x4c23('0xe')](_0x4c23('0x27'),EXTRACTED_REPORT_ID,_0x4c23('0x28')));return analyticExtractedReport(_0x4c23('0x29'),_0x2f8cd7?util['format'](_0x4c23('0x25'),_0x19a670,_0x2f8cd7?_0x4c23('0x2a'):_0x4c23('0x2b')):null);});})[_0x4c23('0x2c')](function(_0x54d69a){logger['info'](util[_0x4c23('0xe')](_0x4c23('0x2d'),EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x54d69a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4c23('0x2e'));})[_0x4c23('0x2f')](function(){process[_0x4c23('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 7641499..ac1d30c 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 _0x1e80=['extension','CDR(destination)=','cutdigits','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','length','toLowerCase','createdAt','updatedAt','*,*,*,*','interval','tag','CDR(tag)=','callerID','answer','indexOf','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice',',${EXTEN},','last','Hangup','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','findAll','then','intervals','models','IntervalId','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','playback','priority','extensions','find','push','Set','type','context','VoiceExtensionId','inbound','CDR(routeid)=','outbound'];(function(_0x888931,_0x52f998){var _0x4dac8b=function(_0x6f30d9){while(--_0x6f30d9){_0x888931['push'](_0x888931['shift']());}};_0x4dac8b(++_0x52f998);}(_0x1e80,0x1b0));var _0x01e8=function(_0x26003b,_0x37abc9){_0x26003b=_0x26003b-0x0;var _0x1a8dc9=_0x1e80[_0x26003b];return _0x1a8dc9;};'use strict';var _=require(_0x01e8('0x0'));var util=require('util');function rewrite(_0x3e8267,_0x528e8c){var _0x22218c=this;return _0x3e8267['models']['Interval'][_0x01e8('0x1')]({'raw':!![]})[_0x01e8('0x2')](function(_0x414a41){_0x22218c[_0x01e8('0x3')]=_0x414a41;return _0x3e8267[_0x01e8('0x4')]['VoiceExtension'][_0x01e8('0x1')]({'where':{'IntervalId':_0x528e8c[_0x01e8('0x5')]},'raw':!![]});})[_0x01e8('0x2')](function(_0x1e9837){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x1')]({'where':{'exten':{'$in':_['uniq'](_[_0x01e8('0x7')](_0x1e9837,_0x01e8('0x8')))}},'order':[{'raw':_0x01e8('0x9')}],'raw':!![]});})[_0x01e8('0x2')](function(_0x347d0a){var _0x26febf=_[_0x01e8('0xa')](_0x347d0a,{'priority':'1'});var _0x4a64ac=_['filter'](_0x347d0a,{'isApp':0x1});var _0x1d9c15=_['groupBy'](_0x4a64ac,_0x01e8('0x8'));var _0x5df067=['queue',_0x01e8('0xb')];var _0x30ba4f=[];var _0x16ebea=[];for(var _0xd01c4f in _0x1d9c15){if(_0x1d9c15['hasOwnProperty'](_0xd01c4f)){_0x22218c[_0x01e8('0xc')]=0x2;_0x22218c[_0x01e8('0xd')]=[];_0x22218c['extension']=_[_0x01e8('0xe')](_0x26febf,{'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x10'),'appdata':util['format']('CDR(type)=%s',_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')]),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});if(_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')]===_0x01e8('0x14')){_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x15')+_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}else if(_0x1d9c15[_0xd01c4f][0x0]['type']===_0x01e8('0x16')){if(_0x22218c[_0x01e8('0x17')]){_0x22218c['extensions']['push']({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x18')+(_0x22218c[_0x01e8('0x17')][_0x01e8('0x19')]?_0x01e8('0x1a')+_0x22218c['extension'][_0x01e8('0x19')]+'}':'${EXTEN}'),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x15')+_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});var _0x1508d5=_0x22218c[_0x01e8('0xc')]++;_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':_0x01e8('0x1b'),'appdata':_0x01e8('0x1c')+(_0x1508d5+0x2)+'):Goto('+(_0x1508d5+0x1)+')','context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x1508d5,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});if(_0x22218c[_0x01e8('0x17')]){_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x22218c['extension']['cutdigits']?_0x01e8('0x1d')+_0x22218c['extension'][_0x01e8('0x19')]+'}':_0x01e8('0x1e'),'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});}_0x22218c['extensions']['push']({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x1f')+_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId'],'context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});if(_0x22218c['extension']&&_0x22218c['extension'][_0x01e8('0x20')](_0x01e8('0x21'))&&_0x22218c[_0x01e8('0x17')]['recordingFormat']!==_0x01e8('0x22')){_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x23'),'context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':_0x01e8('0x24')+_0x22218c[_0x01e8('0x17')]['recordingFormat']||'wav','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}}_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0]['type'],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0]['exten'],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']});_0x22218c['extensions'][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c['priority']++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':'Set','appdata':'MONITOR_OPTIONS=ab','context':_0x1d9c15[_0xd01c4f][0x0]['context'],'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'priority':_0x22218c[_0x01e8('0xc')]++,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});for(var _0x2b967a=0x0,_0x5b6bcd=0x0;_0x2b967a<_0x1d9c15[_0xd01c4f][_0x01e8('0x25')];_0x2b967a+=0x1,_0x5b6bcd=0x0){var _0x63aee6=_0x1d9c15[_0xd01c4f][_0x2b967a];if(_0x63aee6[_0x01e8('0x11')]){_0x63aee6['type']=_0x63aee6['type'][_0x01e8('0x26')]();}var _0x3d178a=[];var _0x4565fa=[];delete _0x63aee6['id'];delete _0x63aee6[_0x01e8('0x27')];delete _0x63aee6[_0x01e8('0x28')];var _0x27542d=_0x63aee6['interval']!==_0x01e8('0x29')?[_0x63aee6[_0x01e8('0x2a')]]:_0x63aee6[_0x01e8('0x5')]?_[_0x01e8('0x7')](_[_0x01e8('0xa')](_0x22218c[_0x01e8('0x3')],{'IntervalId':_0x63aee6[_0x01e8('0x5')]}),_0x01e8('0x2a')):[];if(_0x63aee6[_0x01e8('0x20')](_0x01e8('0x2b'))){if(_0x63aee6[_0x01e8('0x2b')]&&_0x63aee6[_0x01e8('0x2b')]!=='--'){_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x2c')+_0x63aee6[_0x01e8('0x2b')],'context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6['VoiceExtensionId']});}}if(_0x63aee6[_0x01e8('0x11')]===_0x01e8('0x16')&&_0x63aee6['hasOwnProperty']('callerID')){if(_0x63aee6[_0x01e8('0x2d')]){_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x63aee6[_0x01e8('0x2d')]+')','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c['priority']+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6['VoiceExtensionId']});}else{_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6['type'],'app':_0x01e8('0x1b'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d['length']+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}}if(_0x63aee6[_0x01e8('0x20')](_0x01e8('0x2e'))){if(_0x5df067[_0x01e8('0x2f')](_0x63aee6[_0x01e8('0x30')][_0x01e8('0x26')]())>=0x0&&_0x63aee6[_0x01e8('0x31')]!==_0x01e8('0x32')){if(_0x63aee6[_0x01e8('0x2e')]){_0x3d178a['push']({'type':_0x63aee6[_0x01e8('0x11')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6['exten'],'priority':_0x27542d['length']+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':_0x01e8('0x33'),'context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}else{_0x3d178a[_0x01e8('0xf')]({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x1b'),'appdata':_0x01e8('0x34'),'context':_0x63aee6['context'],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});_0x3d178a['push']({'type':_0x63aee6[_0x01e8('0x11')],'app':_0x01e8('0x10'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x63aee6[_0x01e8('0x12')],'exten':_0x63aee6[_0x01e8('0x8')],'priority':_0x27542d[_0x01e8('0x25')]+_0x22218c[_0x01e8('0xc')]+_0x5b6bcd++,'VoiceExtensionId':_0x63aee6[_0x01e8('0x13')]});}}}for(var _0x1208c7=0x0;_0x1208c7<_0x27542d[_0x01e8('0x25')];_0x1208c7+=0x1){var _0x3585b4=_0x22218c[_0x01e8('0xc')]+_0x27542d[_0x01e8('0x25')];var _0x23b6c7=_0x1208c7===_0x27542d[_0x01e8('0x25')]-0x1?_0x22218c[_0x01e8('0xc')]+_0x3d178a['length']+_0x4565fa[_0x01e8('0x25')]+0x2:_0x22218c['priority']+_0x1208c7+0x1;_0x3d178a[_0x01e8('0x35')](_0x1208c7,0x0,{'type':_0x63aee6[_0x01e8('0x11')],'app':'GotoIfTime','appdata':_0x27542d[_0x1208c7]+'?'+_0x63aee6[_0x01e8('0x12')]+_0x01e8('0x36')+_0x3585b4+':'+_0x63aee6['context']+_0x01e8('0x36')+_0x23b6c7,'exten':_0x63aee6['exten'],'context':_0x63aee6['context'],'priority':_0x22218c[_0x01e8('0xc')]+_0x1208c7,'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});}_0x63aee6[_0x01e8('0xc')]=_0x3d178a[_0x01e8('0x25')]?_[_0x01e8('0x37')](_0x3d178a)[_0x01e8('0xc')]+0x1:_0x22218c['priority'];_0x22218c[_0x01e8('0xc')]=(_0x4565fa[_0x01e8('0x25')]?_['last'](_0x4565fa)['priority']:_0x63aee6[_0x01e8('0xc')])+0x1;_0x22218c[_0x01e8('0xd')]=_['concat'](_0x22218c['extensions'],_0x3d178a,[_0x63aee6],_0x4565fa);}_0x22218c[_0x01e8('0xd')][_0x01e8('0xf')]({'type':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x11')],'app':_0x01e8('0x38'),'exten':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x8')],'context':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x12')],'priority':_0x22218c[_0x01e8('0xc')],'VoiceExtensionId':_0x1d9c15[_0xd01c4f][0x0][_0x01e8('0x13')]});_0x30ba4f['push'](_0x1d9c15[_0xd01c4f][0x0]['VoiceExtensionId']);_0x16ebea=_[_0x01e8('0x39')](_0x16ebea,_0x22218c[_0x01e8('0xd')]);}}return _0x3e8267[_0x01e8('0x3a')](function(_0x2b5974){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x3b')]({'where':{'VoiceExtensionId':{'$in':_0x30ba4f}},'transaction':_0x2b5974})['then'](function(_0x3dfc4c){return _0x3e8267[_0x01e8('0x4')][_0x01e8('0x6')][_0x01e8('0x3c')](_[_0x01e8('0x3d')](_0x16ebea,_0x01e8('0xc')),{'transaction':_0x2b5974});});});})[_0x01e8('0x3e')](function(_0x40713c){console[_0x01e8('0x3f')](_0x40713c);});}exports[_0x01e8('0x40')]=rewrite; \ No newline at end of file +var _0x7bb0=['):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','indexOf','app','appType','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','catch','error','lodash','util','models','findAll','then','intervals','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','exten','queue','hasOwnProperty','find','extensions','Set','format','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','push','type','CDR(routeid)=','outbound','extension','cutdigits','${EXTEN}','ExecIf'];(function(_0x2fa2b9,_0x289e22){var _0x4d251a=function(_0x519beb){while(--_0x519beb){_0x2fa2b9['push'](_0x2fa2b9['shift']());}};_0x4d251a(++_0x289e22);}(_0x7bb0,0x6e));var _0x07bb=function(_0x445190,_0x49de87){_0x445190=_0x445190-0x0;var _0x23a0c1=_0x7bb0[_0x445190];return _0x23a0c1;};'use strict';var _=require(_0x07bb('0x0'));var util=require(_0x07bb('0x1'));function rewrite(_0x5a21dd,_0x55cc43){var _0x492660=this;return _0x5a21dd[_0x07bb('0x2')]['Interval'][_0x07bb('0x3')]({'raw':!![]})[_0x07bb('0x4')](function(_0x155890){_0x492660[_0x07bb('0x5')]=_0x155890;return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')][_0x07bb('0x3')]({'where':{'IntervalId':_0x55cc43['IntervalId']},'raw':!![]});})['then'](function(_0x36d26f){return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')]['findAll']({'where':{'exten':{'$in':_[_0x07bb('0x7')](_['map'](_0x36d26f,'exten'))}},'order':[{'raw':_0x07bb('0x8')}],'raw':!![]});})[_0x07bb('0x4')](function(_0xad54c3){var _0x1f35eb=_[_0x07bb('0x9')](_0xad54c3,{'priority':'1'});var _0x3ed987=_['filter'](_0xad54c3,{'isApp':0x1});var _0x2d3328=_['groupBy'](_0x3ed987,_0x07bb('0xa'));var _0x3abd7e=[_0x07bb('0xb'),'playback'];var _0x6a3621=[];var _0x446513=[];for(var _0x31b7ac in _0x2d3328){if(_0x2d3328[_0x07bb('0xc')](_0x31b7ac)){_0x492660['priority']=0x2;_0x492660['extensions']=[];_0x492660['extension']=_[_0x07bb('0xd')](_0x1f35eb,{'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')]});_0x492660[_0x07bb('0xe')]['push']({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':util[_0x07bb('0x10')](_0x07bb('0x11'),_0x2d3328[_0x31b7ac][0x0]['type']),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});if(_0x2d3328[_0x31b7ac][0x0]['type']===_0x07bb('0x15')){_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':'Set','appdata':_0x07bb('0x18')+_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId'],'context':_0x2d3328[_0x31b7ac][0x0]['context'],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}else if(_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')]===_0x07bb('0x19')){if(_0x492660['extension']){_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':'CDR(destination)='+(_0x492660[_0x07bb('0x1a')][_0x07bb('0x1b')]?'${EXTEN:'+_0x492660['extension'][_0x07bb('0x1b')]+'}':_0x07bb('0x1c')),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x18')+_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')],'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0]['exten'],'priority':_0x492660['priority']++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});var _0x9e4f11=_0x492660[_0x07bb('0x13')]++;_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x9e4f11+0x2)+_0x07bb('0x1e')+(_0x9e4f11+0x1)+')','context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x9e4f11,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});if(_0x492660[_0x07bb('0x1a')]){_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':_0x492660[_0x07bb('0x1a')][_0x07bb('0x1b')]?_0x07bb('0x1f')+_0x492660[_0x07bb('0x1a')][_0x07bb('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x2d3328[_0x31b7ac][0x0]['context'],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId']});}_0x492660[_0x07bb('0xe')]['push']({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x20')+_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')],'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});if(_0x492660['extension']&&_0x492660['extension'][_0x07bb('0xc')](_0x07bb('0x21'))&&_0x492660[_0x07bb('0x1a')][_0x07bb('0x21')]!==_0x07bb('0x22')){_0x492660['extensions'][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x23'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660['priority']++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});_0x492660['extensions'][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x24')+_0x492660[_0x07bb('0x1a')]['recordingFormat']||_0x07bb('0x25'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}}_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId']});_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x26'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});_0x492660['extensions'][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0]['type'],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x27'),'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'exten':_0x2d3328[_0x31b7ac][0x0]['exten'],'priority':_0x492660[_0x07bb('0x13')]++,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});for(var _0x3d659e=0x0,_0xbb5653=0x0;_0x3d659e<_0x2d3328[_0x31b7ac][_0x07bb('0x28')];_0x3d659e+=0x1,_0xbb5653=0x0){var _0x34ea50=_0x2d3328[_0x31b7ac][_0x3d659e];if(_0x34ea50[_0x07bb('0x17')]){_0x34ea50[_0x07bb('0x17')]=_0x34ea50['type'][_0x07bb('0x29')]();}var _0x1fbfa3=[];var _0x217c06=[];delete _0x34ea50['id'];delete _0x34ea50[_0x07bb('0x2a')];delete _0x34ea50[_0x07bb('0x2b')];var _0x3ff988=_0x34ea50[_0x07bb('0x2c')]!==_0x07bb('0x2d')?[_0x34ea50[_0x07bb('0x2c')]]:_0x34ea50[_0x07bb('0x2e')]?_[_0x07bb('0x2f')](_[_0x07bb('0x9')](_0x492660[_0x07bb('0x5')],{'IntervalId':_0x34ea50[_0x07bb('0x2e')]}),_0x07bb('0x2c')):[];if(_0x34ea50[_0x07bb('0xc')](_0x07bb('0x30'))){if(_0x34ea50['tag']&&_0x34ea50[_0x07bb('0x30')]!=='--'){_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0xf'),'appdata':_0x07bb('0x31')+_0x34ea50[_0x07bb('0x30')],'context':_0x34ea50['context'],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}}if(_0x34ea50[_0x07bb('0x17')]===_0x07bb('0x19')&&_0x34ea50[_0x07bb('0xc')]('callerID')){if(_0x34ea50[_0x07bb('0x32')]){_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x33')+_0x34ea50['callerID']+')','context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}else{_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x34'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}}if(_0x34ea50[_0x07bb('0xc')]('answer')){if(_0x3abd7e[_0x07bb('0x35')](_0x34ea50[_0x07bb('0x36')]['toLowerCase']())>=0x0&&_0x34ea50[_0x07bb('0x37')]!==_0x07bb('0x38')){if(_0x34ea50[_0x07bb('0x39')]){_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x3a'),'context':_0x34ea50['context'],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660['priority']+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':'Set','appdata':_0x07bb('0x3b'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50['exten'],'priority':_0x3ff988['length']+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});}else{_0x1fbfa3[_0x07bb('0x16')]({'type':_0x34ea50[_0x07bb('0x17')],'app':_0x07bb('0x1d'),'appdata':_0x07bb('0x3c'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660['priority']+_0xbb5653++,'VoiceExtensionId':_0x34ea50[_0x07bb('0x14')]});_0x1fbfa3['push']({'type':_0x34ea50[_0x07bb('0x17')],'app':'Set','appdata':_0x07bb('0x3d'),'context':_0x34ea50[_0x07bb('0x12')],'exten':_0x34ea50[_0x07bb('0xa')],'priority':_0x3ff988[_0x07bb('0x28')]+_0x492660[_0x07bb('0x13')]+_0xbb5653++,'VoiceExtensionId':_0x34ea50['VoiceExtensionId']});}}}for(var _0x3ca7c1=0x0;_0x3ca7c1<_0x3ff988['length'];_0x3ca7c1+=0x1){var _0x29a3cc=_0x492660[_0x07bb('0x13')]+_0x3ff988[_0x07bb('0x28')];var _0x3073ef=_0x3ca7c1===_0x3ff988[_0x07bb('0x28')]-0x1?_0x492660[_0x07bb('0x13')]+_0x1fbfa3[_0x07bb('0x28')]+_0x217c06[_0x07bb('0x28')]+0x2:_0x492660[_0x07bb('0x13')]+_0x3ca7c1+0x1;_0x1fbfa3['splice'](_0x3ca7c1,0x0,{'type':_0x34ea50[_0x07bb('0x17')],'app':'GotoIfTime','appdata':_0x3ff988[_0x3ca7c1]+'?'+_0x34ea50[_0x07bb('0x12')]+_0x07bb('0x3e')+_0x29a3cc+':'+_0x34ea50['context']+_0x07bb('0x3e')+_0x3073ef,'exten':_0x34ea50[_0x07bb('0xa')],'context':_0x34ea50[_0x07bb('0x12')],'priority':_0x492660[_0x07bb('0x13')]+_0x3ca7c1,'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});}_0x34ea50['priority']=_0x1fbfa3[_0x07bb('0x28')]?_[_0x07bb('0x3f')](_0x1fbfa3)[_0x07bb('0x13')]+0x1:_0x492660[_0x07bb('0x13')];_0x492660[_0x07bb('0x13')]=(_0x217c06[_0x07bb('0x28')]?_['last'](_0x217c06)['priority']:_0x34ea50[_0x07bb('0x13')])+0x1;_0x492660[_0x07bb('0xe')]=_[_0x07bb('0x40')](_0x492660[_0x07bb('0xe')],_0x1fbfa3,[_0x34ea50],_0x217c06);}_0x492660[_0x07bb('0xe')][_0x07bb('0x16')]({'type':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x17')],'app':_0x07bb('0x41'),'exten':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0xa')],'context':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x12')],'priority':_0x492660[_0x07bb('0x13')],'VoiceExtensionId':_0x2d3328[_0x31b7ac][0x0][_0x07bb('0x14')]});_0x6a3621[_0x07bb('0x16')](_0x2d3328[_0x31b7ac][0x0]['VoiceExtensionId']);_0x446513=_[_0x07bb('0x40')](_0x446513,_0x492660[_0x07bb('0xe')]);}}return _0x5a21dd['transaction'](function(_0x3c1da9){return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')][_0x07bb('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x6a3621}},'transaction':_0x3c1da9})[_0x07bb('0x4')](function(_0x22b3aa){return _0x5a21dd[_0x07bb('0x2')][_0x07bb('0x6')][_0x07bb('0x43')](_['sortBy'](_0x446513,_0x07bb('0x13')),{'transaction':_0x3c1da9});});});})[_0x07bb('0x44')](function(_0x52b029){console[_0x07bb('0x45')](_0x52b029);});}exports['rewrite']=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 61b9d33..8a2608d 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 _0x4f62=['Duplicate\x20Contact','CmContact','create','keys','then','push','catch','stringify','cmContact','checkHopper','inspect','insert','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','from','cm_contacts','where','deletedAt\x20IS\x20NULL','toString','phone\x20IS\x20NOT\x20NULL','cm_hopper','\x20=\x20?','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','calleridnum','id\x20IN\x20?','str','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','CmList','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resolve','Unable\x20to\x20delete\x20temp\x20file:','exit','info','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','defaults','localhost','redis','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate'];(function(_0xb7a307,_0x4a2603){var _0x259d96=function(_0x41e6b8){while(--_0x41e6b8){_0xb7a307['push'](_0xb7a307['shift']());}};_0x259d96(++_0x4a2603);}(_0x4f62,0xab));var _0x24f6=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x4f62[_0x47b58b];return _0x46bebe;};'use strict';var BPromise=require(_0x24f6('0x0'));var util=require(_0x24f6('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0x24f6('0x2'));var Papa=require(_0x24f6('0x3'));var Redis=require(_0x24f6('0x4'));var db=require('../../../mysqldb')['db'];var config=require(_0x24f6('0x5'));var logger=require(_0x24f6('0x6'))(_0x24f6('0x7'));config['redis']=_[_0x24f6('0x8')](config['redis'],{'host':_0x24f6('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x24f6('0xa')]));require(_0x24f6('0xb'))['register'](socket);try{if(!process[_0x24f6('0xc')][0x2]||process['argv'][0x2]===_0x24f6('0xd')||process[_0x24f6('0xc')][0x2]===_0x24f6('0xe')){throw new Error(_0x24f6('0xf'));}var FILEPATH=process[_0x24f6('0xc')][0x2];if(!process[_0x24f6('0xc')][0x3]||process[_0x24f6('0xc')][0x3]==='undefined'||process[_0x24f6('0xc')][0x3]===_0x24f6('0xe')||!process['argv'][0x4]||process['argv'][0x4]===_0x24f6('0xd')||process[_0x24f6('0xc')][0x4]===_0x24f6('0xe')){throw new Error(_0x24f6('0x10'));}var FIELDS=_[_0x24f6('0x11')](process[_0x24f6('0xc')][0x3]['split'](','),process[_0x24f6('0xc')][0x4][_0x24f6('0x12')](','));if(!process[_0x24f6('0xc')][0x5]||process[_0x24f6('0xc')][0x5]==='undefined'||process[_0x24f6('0xc')][0x5]==='null'){throw new Error(_0x24f6('0x13'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x24f6('0xc')][0x6]&&process['argv'][0x6]!==_0x24f6('0xd')&&process['argv'][0x6]!==_0x24f6('0xe')?process[_0x24f6('0xc')][0x6]:null;var DUPLICATES=process[_0x24f6('0xc')][0x7]&&process['argv'][0x7]!==_0x24f6('0xd')&&process['argv'][0x7]!==_0x24f6('0xe')?process[_0x24f6('0xc')][0x7]:null;if(!process[_0x24f6('0xc')][0x8]||process[_0x24f6('0xc')][0x8]===_0x24f6('0xd')||process[_0x24f6('0xc')][0x8]===_0x24f6('0xe')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x24f6('0xc')][0x8];}catch(_0x2683b1){logger[_0x24f6('0x14')](_0x2683b1);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(_0x316fe8,_0x22d7f6,_0x4e11a8,_0x1f51ac){var _0x30c74c={'message':_0x22d7f6};_0x30c74c[_0x316fe8]=!![];if(_0x4e11a8){_0x30c74c['contact']=_0x4e11a8;}if(_0x1f51ac){_0x30c74c['index']=_0x1f51ac;}return _0x30c74c;}function isEmail(_0x5de28c){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'](_0x5de28c);}function checkRow(_0x5ed183,_0x3a03d1,_0x58932c){return new BPromise(function(_0x232961,_0x4d6573){if(_['isNil'](_0x5ed183)){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x15'),null,_0x58932c));}if(_0x5ed183['errors']&&_0x5ed183[_0x24f6('0x16')][_0x24f6('0x17')]){var _0x706681=_[_0x24f6('0x18')](_0x5ed183['errors'],_0x24f6('0x19'))['join'](';');return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x706681,null,_0x58932c));}var _0x186365={};for(var _0x2a2ceb in FIELDS){if(FIELDS[_0x24f6('0x1a')](_0x2a2ceb)&&FIELDS[_0x2a2ceb]){_0x186365[_0x2a2ceb]=_0x5ed183['data'][0x0][FIELDS[_0x2a2ceb]]||_0x5ed183[_0x24f6('0x1b')][0x0]['\ufeff'+FIELDS[_0x2a2ceb]];}}if(!_0x186365[_0x24f6('0x1c')]){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x1d'),null,_0x58932c));}if(!_0x186365[_0x24f6('0x1e')]){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x1f'),null,_0x58932c));}if(_0x186365[_0x24f6('0x20')]){var _0x21909e=moment(_0x186365[_0x24f6('0x20')],_0x24f6('0x21'));if(!_0x21909e[_0x24f6('0x22')]()){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x23'),null,_0x58932c));}}if(_0x186365[_0x24f6('0x24')]){if(!isEmail(_0x186365[_0x24f6('0x24')])){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),_0x24f6('0x25'),null,_0x58932c));}}_0x186365[_0x24f6('0x26')]=LISTID;_0x186365[_0x24f6('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3a03d1){var _0x21495e={};for(var _0x3fcd15=0x0,_0x1f9d57=DUPLICATES[_0x24f6('0x17')];_0x3fcd15<_0x1f9d57;_0x3fcd15+=0x1){_0x21495e[DUPLICATES[_0x3fcd15]]=_0x186365[DUPLICATES[_0x3fcd15]];}var _0x1dccbc=_['find'](_0x3a03d1,_0x21495e);if(_0x1dccbc){return _0x4d6573(handleCheckRowError(_0x24f6('0x28'),_0x24f6('0x29'),_0x1dccbc,_0x58932c));}}return db[_0x24f6('0x2a')][_0x24f6('0x2b')](_0x186365,{'raw':!![],'hooks':![],'fields':_[_0x24f6('0x2c')](_0x186365)})[_0x24f6('0x2d')](function(_0x3036b9){if(DUPLICATES&&DUPLICATES[_0x24f6('0x17')]&&_0x3a03d1){_0x3a03d1[_0x24f6('0x2e')](_['pick'](_0x186365,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x3036b9['id'];return _0x232961();})[_0x24f6('0x2f')](function(_0x25b72e){return _0x4d6573(handleCheckRowError(_0x24f6('0x14'),'Error\x20while\x20creating\x20contact:\x20'+(_0x25b72e[_0x24f6('0x19')]||JSON[_0x24f6('0x30')](_0x25b72e)),null,_0x58932c));});});}function checkHopper(){function _0x4298f3(){return function(_0x1ed7a1){logger[_0x24f6('0x14')](_0x24f6('0x31'),_0x24f6('0x32'),util[_0x24f6('0x33')](_0x1ed7a1,{'showHidden':![],'depth':null}));};}var _0x3d97cd=function(_0x2f91f4,_0x1eca3f){var _0x4ee02d=squel[_0x24f6('0x34')]()[_0x24f6('0x35')]('cm_hopper')[_0x24f6('0x36')]([_0x24f6('0x1e'),_0x24f6('0x37'),_0x24f6('0x38'),_0x24f6('0x26'),_0x1eca3f,_0x24f6('0x39'),_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'),_0x24f6('0x1e'))[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x37'))[_0x24f6('0x3c')]('id',_0x24f6('0x38'))['field'](LISTID['toString'](),_0x24f6('0x26'))['field'](_0x2f91f4['id']['toString'](),_0x1eca3f)[_0x24f6('0x3c')](_0x24f6('0x3d'),'createdAt')[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x3a'))[_0x24f6('0x3e')](_0x24f6('0x3f'))[_0x24f6('0x40')](_0x24f6('0x41'))[_0x24f6('0x40')]('ListId\x20=\x20?',LISTID[_0x24f6('0x42')]())['where'](_0x24f6('0x43'))[_0x24f6('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'))['from'](_0x24f6('0x44'))[_0x24f6('0x40')](_0x1eca3f+_0x24f6('0x45'),_0x2f91f4['id'][_0x24f6('0x42')]())))[_0x24f6('0x42')]();return _0x4ee02d;};var _0x59ce33=function(_0x53c9ee,_0x3c8dba){var _0x339704=squel[_0x24f6('0x34')]()[_0x24f6('0x35')]('cm_hopper')[_0x24f6('0x36')]([_0x24f6('0x1e'),_0x24f6('0x37'),_0x24f6('0x38'),_0x24f6('0x26'),_0x3c8dba,_0x24f6('0x39'),_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()['field'](_0x24f6('0x1e'),_0x24f6('0x1e'))['field'](_0x24f6('0x3d'),_0x24f6('0x37'))[_0x24f6('0x3c')]('id','ContactId')['field'](LISTID[_0x24f6('0x42')](),_0x24f6('0x26'))[_0x24f6('0x3c')](_0x53c9ee['id'][_0x24f6('0x42')](),_0x3c8dba)[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x39'))[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x3a'))['from'](_0x24f6('0x3f'))[_0x24f6('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0x24f6('0x46'),LISTID[_0x24f6('0x42')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x24f6('0x40')](_0x24f6('0x43'))[_0x24f6('0x40')](_0x24f6('0x47'),squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x48'))[_0x24f6('0x3e')]('cm_hopper_final')[_0x24f6('0x40')](_0x3c8dba+'\x20=\x20?',_0x53c9ee['id'][_0x24f6('0x42')]()))[_0x24f6('0x40')](_0x24f6('0x47'),squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')]('phone')[_0x24f6('0x3e')](_0x24f6('0x44'))['where'](_0x3c8dba+_0x24f6('0x45'),_0x53c9ee['id']['toString']())))[_0x24f6('0x42')]();return _0x339704;};function _0x382183(_0x1b3b21,_0x5bc297){var _0x30fbcb=squel['insert']()[_0x24f6('0x35')](_0x24f6('0x44'))['fromQuery']([_0x24f6('0x1e'),_0x24f6('0x37'),'ContactId',_0x24f6('0x26'),_0x5bc297,_0x24f6('0x39'),_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'),_0x24f6('0x1e'))[_0x24f6('0x3c')](_0x24f6('0x3d'),'scheduledAt')[_0x24f6('0x3c')]('id',_0x24f6('0x38'))['field'](LISTID[_0x24f6('0x42')](),'ListId')['field'](_0x1b3b21['id'][_0x24f6('0x42')](),_0x5bc297)['field']('NOW()',_0x24f6('0x39'))['field']('NOW()',_0x24f6('0x3a'))['from']('cm_contacts')[_0x24f6('0x40')]('deletedAt\x20IS\x20NULL')[_0x24f6('0x40')](_0x24f6('0x46'),LISTID[_0x24f6('0x42')]())['where'](_0x24f6('0x49'),squel[_0x24f6('0x4a')](hopperContacts))[_0x24f6('0x40')](_0x24f6('0x43')))[_0x24f6('0x42')]();return _0x30fbcb;}function _0x22dd88(_0x1cc3c0,_0x43d73d){var _0x45147f=squel[_0x24f6('0x34')]()[_0x24f6('0x35')](_0x24f6('0x4b'))[_0x24f6('0x36')]([_0x24f6('0x1e'),'ContactId',_0x24f6('0x26'),_0x43d73d,'createdAt',_0x24f6('0x3a')],squel[_0x24f6('0x3b')]()[_0x24f6('0x3c')](_0x24f6('0x1e'),_0x24f6('0x1e'))[_0x24f6('0x3c')]('id',_0x24f6('0x38'))[_0x24f6('0x3c')](LISTID[_0x24f6('0x42')](),_0x24f6('0x26'))[_0x24f6('0x3c')](_0x1cc3c0['id'][_0x24f6('0x42')](),_0x43d73d)['field'](_0x24f6('0x3d'),'createdAt')[_0x24f6('0x3c')](_0x24f6('0x3d'),_0x24f6('0x3a'))[_0x24f6('0x3e')](_0x24f6('0x3f'))['where']('deletedAt\x20IS\x20NULL')['where']('ListId\x20=\x20?',LISTID[_0x24f6('0x42')]())[_0x24f6('0x40')](_0x24f6('0x49'),squel['str'](hopperContacts))[_0x24f6('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0x24f6('0x42')]();return _0x45147f;}return db[_0x24f6('0x4c')][_0x24f6('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0x24f6('0x4e')],'include':[{'model':db['CmList'],'as':_0x24f6('0x4f'),'where':{'id':LISTID}}]})[_0x24f6('0x2d')](function(_0x4fc99d){var _0x4d99c4=[];if(_0x4fc99d){var _0x2c1866;for(var _0x5bd4b4=0x0,_0x30d344;_0x5bd4b4<_0x4fc99d[_0x24f6('0x17')];_0x5bd4b4+=0x1){_0x30d344=_0x4fc99d[_0x5bd4b4]['get']({'plain':!![]});switch(_0x30d344['dialCheckDuplicateType']){case _0x24f6('0x50'):_0x4d99c4[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x59ce33(_0x30d344,_0x24f6('0x53')))['then'](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;case _0x24f6('0x54'):_0x4d99c4[_0x24f6('0x2e')](db[_0x24f6('0x51')]['query'](_0x3d97cd(_0x30d344,_0x24f6('0x53')))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;default:_0x4d99c4['push'](db['sequelize'][_0x24f6('0x52')](_0x382183(_0x30d344,_0x24f6('0x53')))['then'](function(){})['catch'](_0x4298f3()));}}}return _0x4d99c4;})[_0x24f6('0x55')]()['then'](function(){return db['VoiceQueue']['findAll']({'where':{'type':_0x24f6('0x56')},'attributes':['id'],'include':[{'model':db[_0x24f6('0x57')],'as':_0x24f6('0x58'),'where':{'id':LISTID}}]})[_0x24f6('0x2d')](function(_0x2bd317){var _0x68493a=[];if(_0x2bd317){var _0x173bab;for(var _0x308537=0x0,_0x101dca;_0x308537<_0x2bd317[_0x24f6('0x17')];_0x308537+=0x1){_0x101dca=_0x2bd317[_0x308537][_0x24f6('0x59')]({'plain':!![]});_0x68493a[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x22dd88(_0x101dca,'VoiceQueueId'))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));}}return _0x68493a;})[_0x24f6('0x55')]();})['then'](function(){return db[_0x24f6('0x5a')][_0x24f6('0x4d')]({'attributes':['id',_0x24f6('0x4e')],'include':[{'model':db[_0x24f6('0x57')],'as':_0x24f6('0x4f'),'where':{'id':LISTID}}]})['then'](function(_0x2842ce){var _0x40ea16=[];if(_0x2842ce){for(var _0x2ea737=0x0,_0x492c6e;_0x2ea737<_0x2842ce['length'];_0x2ea737+=0x1){_0x492c6e=_0x2842ce[_0x2ea737]['get']({'plain':!![]});switch(_0x492c6e[_0x24f6('0x4e')]){case'always':_0x40ea16[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x59ce33(_0x492c6e,'CampaignId'))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;case'onlyIfOpen':_0x40ea16[_0x24f6('0x2e')](db[_0x24f6('0x51')]['query'](_0x3d97cd(_0x492c6e,'CampaignId'))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));break;default:_0x40ea16[_0x24f6('0x2e')](db[_0x24f6('0x51')][_0x24f6('0x52')](_0x382183(_0x492c6e,_0x24f6('0x5b')))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));}}}return _0x40ea16;})['all']();})['then'](function(){return db['Campaign'][_0x24f6('0x4d')]({'attributes':['id'],'include':[{'model':db[_0x24f6('0x57')],'as':_0x24f6('0x58'),'where':{'id':LISTID}}]})[_0x24f6('0x2d')](function(_0x64f678){var _0x1fffd7=[];if(_0x64f678){for(var _0x2d2386=0x0,_0x4de9db;_0x2d2386<_0x64f678[_0x24f6('0x17')];_0x2d2386+=0x1){_0x4de9db=_0x64f678[_0x2d2386][_0x24f6('0x59')]({'plain':!![]});_0x1fffd7['push'](db['sequelize'][_0x24f6('0x52')](_0x22dd88(_0x4de9db,_0x24f6('0x5b')))[_0x24f6('0x2d')](function(){})[_0x24f6('0x2f')](_0x4298f3()));}}return _0x1fffd7;})[_0x24f6('0x55')]();})[_0x24f6('0x2f')](function(_0x18a551){logger[_0x24f6('0x14')](_0x24f6('0x5c'),'generalCheckHopper',_0x18a551[_0x24f6('0x19')]);});}var processPromises=function(_0x118912){return BPromise[_0x24f6('0x55')](promises)[_0x24f6('0x2d')](function(_0x12af16){})[_0x24f6('0x2f')](function(_0xb27e29){logger['error'](_0x24f6('0x5d'),JSON[_0x24f6('0x30')](_0xb27e29));})[_0x24f6('0x5e')](function(){socket[_0x24f6('0x5f')](_0x24f6('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x118912){return _0x118912['resume']();}});};var endCsv=function(){return BPromise[_0x24f6('0x61')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x24f6('0x2d')](function(){socket[_0x24f6('0x5f')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x1a5a7f){logger[_0x24f6('0x14')](_0x24f6('0x62'),JSON[_0x24f6('0x30')](_0x1a5a7f));}finally{process[_0x24f6('0x63')](0x0);}});};process['on']('SIGINT',function(){logger[_0x24f6('0x64')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x24f6('0x61')]()[_0x24f6('0x2d')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x24f6('0x12')](',');return db[_0x24f6('0x2a')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1a4117){var _0x4c478e=fs[_0x24f6('0x65')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x24f6('0x66')](_0x4c478e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x42846d,_0x4be29d){total+=0x1;var _0x19486d=total;promises['push'](checkRow(_0x42846d,_0x1a4117,_0x19486d)[_0x24f6('0x2d')](function(){success+=0x1;})[_0x24f6('0x2f')](function(_0x212b5e){if(_0x212b5e[_0x24f6('0x14')]){errors+=0x1;delete _0x212b5e[_0x24f6('0x14')];}else if(_0x212b5e[_0x24f6('0x28')]){duplicates+=0x1;delete _0x212b5e[_0x24f6('0x28')];}rows[_0x24f6('0x2e')](_0x212b5e);}));if(total%0xc8===0x0){_0x4be29d['pause']();return processPromises(_0x4be29d);}},'complete':function(){return processPromises()[_0x24f6('0x2d')](function(){logger[_0x24f6('0x64')](_0x24f6('0x67'));endCsv();});},'error':function(_0x44bd12,_0x5f3e5e){logger[_0x24f6('0x64')](_0x24f6('0x68'),JSON[_0x24f6('0x30')](_0x44bd12));endCsv();}});})[_0x24f6('0x2f')](function(_0x4af2ca){logger['error'](_0x24f6('0x69'),JSON[_0x24f6('0x30')](_0x4af2ca));});}main(); \ No newline at end of file +var _0xce14=['exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','pause','CSV\x20parsed\x20correctly!','Error\x20executing\x20contact\x20csv\x20import:','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','api','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','find','CmContact','keys','then','push','Error\x20while\x20creating\x20contact:\x20','message','stringify','cmContact','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','cm_contacts','deletedAt\x20IS\x20NULL','where','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','ListId\x20=\x20?','calleridnum','\x20=\x20?','str','cm_hopper_black','id\x20IN\x20?','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','get','always','query','catch','onlyIfOpen','VoiceQueueId','sequelize','all','outbound','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:'];(function(_0x22fcfd,_0x3dfb29){var _0x1001e7=function(_0xbda494){while(--_0xbda494){_0x22fcfd['push'](_0x22fcfd['shift']());}};_0x1001e7(++_0x3dfb29);}(_0xce14,0x1c6));var _0x4ce1=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xce14[_0x5b644e];return _0x49c6bf;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var fs=require('fs');var squel=require(_0x4ce1('0x0'));var Papa=require(_0x4ce1('0x1'));var Redis=require('ioredis');var db=require(_0x4ce1('0x2'))['db'];var config=require(_0x4ce1('0x3'));var logger=require(_0x4ce1('0x4'))(_0x4ce1('0x5'));config['redis']=_[_0x4ce1('0x6')](config['redis'],{'host':_0x4ce1('0x7'),'port':0x18eb});var socket=require(_0x4ce1('0x8'))(new Redis(config['redis']));require(_0x4ce1('0x9'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x4ce1('0xa')][0x2]===_0x4ce1('0xb')||process[_0x4ce1('0xa')][0x2]===_0x4ce1('0xc')){throw new Error(_0x4ce1('0xd'));}var FILEPATH=process[_0x4ce1('0xa')][0x2];if(!process[_0x4ce1('0xa')][0x3]||process[_0x4ce1('0xa')][0x3]==='undefined'||process[_0x4ce1('0xa')][0x3]===_0x4ce1('0xc')||!process[_0x4ce1('0xa')][0x4]||process[_0x4ce1('0xa')][0x4]===_0x4ce1('0xb')||process[_0x4ce1('0xa')][0x4]===_0x4ce1('0xc')){throw new Error(_0x4ce1('0xe'));}var FIELDS=_[_0x4ce1('0xf')](process['argv'][0x3]['split'](','),process[_0x4ce1('0xa')][0x4][_0x4ce1('0x10')](','));if(!process['argv'][0x5]||process[_0x4ce1('0xa')][0x5]===_0x4ce1('0xb')||process[_0x4ce1('0xa')][0x5]===_0x4ce1('0xc')){throw new Error(_0x4ce1('0x11'));}var LISTID=process[_0x4ce1('0xa')][0x5];var COMPANYID=process[_0x4ce1('0xa')][0x6]&&process[_0x4ce1('0xa')][0x6]!=='undefined'&&process[_0x4ce1('0xa')][0x6]!==_0x4ce1('0xc')?process[_0x4ce1('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0x4ce1('0xa')][0x7]!==_0x4ce1('0xb')&&process[_0x4ce1('0xa')][0x7]!=='null'?process['argv'][0x7]:null;if(!process['argv'][0x8]||process[_0x4ce1('0xa')][0x8]===_0x4ce1('0xb')||process[_0x4ce1('0xa')][0x8]===_0x4ce1('0xc')){throw new Error(_0x4ce1('0x12'));}var SOCKET_TIMESTAMP=process[_0x4ce1('0xa')][0x8];}catch(_0x110922){logger[_0x4ce1('0x13')](_0x110922);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(_0x5a9fb8,_0x5101ff,_0x3183b8,_0x38ed71){var _0x2b993b={'message':_0x5101ff};_0x2b993b[_0x5a9fb8]=!![];if(_0x3183b8){_0x2b993b[_0x4ce1('0x14')]=_0x3183b8;}if(_0x38ed71){_0x2b993b[_0x4ce1('0x15')]=_0x38ed71;}return _0x2b993b;}function isEmail(_0x573a8f){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))*$/[_0x4ce1('0x16')](_0x573a8f);}function checkRow(_0x4c01d1,_0x802369,_0x1422f9){return new BPromise(function(_0x49d3b2,_0x3bab93){if(_['isNil'](_0x4c01d1)){return _0x3bab93(handleCheckRowError(_0x4ce1('0x13'),_0x4ce1('0x17'),null,_0x1422f9));}if(_0x4c01d1[_0x4ce1('0x18')]&&_0x4c01d1[_0x4ce1('0x18')][_0x4ce1('0x19')]){var _0x460923=_[_0x4ce1('0x1a')](_0x4c01d1[_0x4ce1('0x18')],'message')[_0x4ce1('0x1b')](';');return _0x3bab93(handleCheckRowError(_0x4ce1('0x13'),_0x460923,null,_0x1422f9));}var _0x46aa8d={};for(var _0x32a079 in FIELDS){if(FIELDS['hasOwnProperty'](_0x32a079)&&FIELDS[_0x32a079]){_0x46aa8d[_0x32a079]=_0x4c01d1[_0x4ce1('0x1c')][0x0][FIELDS[_0x32a079]]||_0x4c01d1[_0x4ce1('0x1c')][0x0]['\ufeff'+FIELDS[_0x32a079]];}}if(!_0x46aa8d[_0x4ce1('0x1d')]){return _0x3bab93(handleCheckRowError(_0x4ce1('0x13'),_0x4ce1('0x1e'),null,_0x1422f9));}if(!_0x46aa8d[_0x4ce1('0x1f')]){return _0x3bab93(handleCheckRowError('error',_0x4ce1('0x20'),null,_0x1422f9));}if(_0x46aa8d[_0x4ce1('0x21')]){var _0x158dc4=moment(_0x46aa8d[_0x4ce1('0x21')],_0x4ce1('0x22'));if(!_0x158dc4[_0x4ce1('0x23')]()){return _0x3bab93(handleCheckRowError(_0x4ce1('0x13'),_0x4ce1('0x24'),null,_0x1422f9));}}if(_0x46aa8d[_0x4ce1('0x25')]){if(!isEmail(_0x46aa8d[_0x4ce1('0x25')])){return _0x3bab93(handleCheckRowError(_0x4ce1('0x13'),_0x4ce1('0x26'),null,_0x1422f9));}}_0x46aa8d[_0x4ce1('0x27')]=LISTID;_0x46aa8d['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x4ce1('0x19')]&&_0x802369){var _0x550adc={};for(var _0x3311da=0x0,_0x16f74b=DUPLICATES['length'];_0x3311da<_0x16f74b;_0x3311da+=0x1){_0x550adc[DUPLICATES[_0x3311da]]=_0x46aa8d[DUPLICATES[_0x3311da]];}var _0x532de8=_[_0x4ce1('0x28')](_0x802369,_0x550adc);if(_0x532de8){return _0x3bab93(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x532de8,_0x1422f9));}}return db[_0x4ce1('0x29')]['create'](_0x46aa8d,{'raw':!![],'hooks':![],'fields':_[_0x4ce1('0x2a')](_0x46aa8d)})[_0x4ce1('0x2b')](function(_0x585a71){if(DUPLICATES&&DUPLICATES[_0x4ce1('0x19')]&&_0x802369){_0x802369[_0x4ce1('0x2c')](_['pick'](_0x46aa8d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x585a71['id'];return _0x49d3b2();})['catch'](function(_0x198091){return _0x3bab93(handleCheckRowError(_0x4ce1('0x13'),_0x4ce1('0x2d')+(_0x198091[_0x4ce1('0x2e')]||JSON[_0x4ce1('0x2f')](_0x198091)),null,_0x1422f9));});});}function checkHopper(){function _0x4d5350(){return function(_0x5e4a56){logger[_0x4ce1('0x13')](_0x4ce1('0x30'),_0x4ce1('0x31'),util['inspect'](_0x5e4a56,{'showHidden':![],'depth':null}));};}var _0x1064e8=function(_0x11dd48,_0x492b0a){var _0x5443d0=squel[_0x4ce1('0x32')]()[_0x4ce1('0x33')](_0x4ce1('0x34'))[_0x4ce1('0x35')]([_0x4ce1('0x1f'),_0x4ce1('0x36'),_0x4ce1('0x37'),_0x4ce1('0x27'),_0x492b0a,_0x4ce1('0x38'),_0x4ce1('0x39')],squel[_0x4ce1('0x3a')]()['field'](_0x4ce1('0x1f'),_0x4ce1('0x1f'))[_0x4ce1('0x3b')](_0x4ce1('0x3c'),'scheduledAt')[_0x4ce1('0x3b')]('id',_0x4ce1('0x37'))[_0x4ce1('0x3b')](LISTID[_0x4ce1('0x3d')](),'ListId')[_0x4ce1('0x3b')](_0x11dd48['id']['toString'](),_0x492b0a)['field'](_0x4ce1('0x3c'),_0x4ce1('0x38'))[_0x4ce1('0x3b')](_0x4ce1('0x3c'),_0x4ce1('0x39'))['from'](_0x4ce1('0x3e'))['where'](_0x4ce1('0x3f'))[_0x4ce1('0x40')]('ListId\x20=\x20?',LISTID[_0x4ce1('0x3d')]())['where'](_0x4ce1('0x41'))[_0x4ce1('0x40')](_0x4ce1('0x42'),squel['select']()['field'](_0x4ce1('0x1f'))[_0x4ce1('0x43')]('cm_hopper')[_0x4ce1('0x40')](_0x492b0a+'\x20=\x20?',_0x11dd48['id'][_0x4ce1('0x3d')]())))[_0x4ce1('0x3d')]();return _0x5443d0;};var _0x3128ef=function(_0x310d38,_0xb83bec){var _0x561a2a=squel['insert']()['into']('cm_hopper')[_0x4ce1('0x35')](['phone',_0x4ce1('0x36'),_0x4ce1('0x37'),'ListId',_0xb83bec,_0x4ce1('0x38'),_0x4ce1('0x39')],squel[_0x4ce1('0x3a')]()[_0x4ce1('0x3b')]('phone',_0x4ce1('0x1f'))['field'](_0x4ce1('0x3c'),_0x4ce1('0x36'))['field']('id',_0x4ce1('0x37'))[_0x4ce1('0x3b')](LISTID['toString'](),_0x4ce1('0x27'))[_0x4ce1('0x3b')](_0x310d38['id'][_0x4ce1('0x3d')](),_0xb83bec)['field']('NOW()',_0x4ce1('0x38'))[_0x4ce1('0x3b')](_0x4ce1('0x3c'),'updatedAt')['from'](_0x4ce1('0x3e'))[_0x4ce1('0x40')](_0x4ce1('0x3f'))[_0x4ce1('0x40')](_0x4ce1('0x44'),LISTID[_0x4ce1('0x3d')]())['where']('id\x20IN\x20?',squel['str'](hopperContacts))[_0x4ce1('0x40')](_0x4ce1('0x41'))[_0x4ce1('0x40')](_0x4ce1('0x42'),squel[_0x4ce1('0x3a')]()[_0x4ce1('0x3b')](_0x4ce1('0x45'))[_0x4ce1('0x43')]('cm_hopper_final')[_0x4ce1('0x40')](_0xb83bec+_0x4ce1('0x46'),_0x310d38['id'][_0x4ce1('0x3d')]()))[_0x4ce1('0x40')](_0x4ce1('0x42'),squel[_0x4ce1('0x3a')]()[_0x4ce1('0x3b')](_0x4ce1('0x1f'))[_0x4ce1('0x43')]('cm_hopper')[_0x4ce1('0x40')](_0xb83bec+_0x4ce1('0x46'),_0x310d38['id'][_0x4ce1('0x3d')]())))[_0x4ce1('0x3d')]();return _0x561a2a;};function _0x1fb4f4(_0x37ed26,_0x3b6f15){var _0x51b3cb=squel[_0x4ce1('0x32')]()[_0x4ce1('0x33')](_0x4ce1('0x34'))[_0x4ce1('0x35')]([_0x4ce1('0x1f'),_0x4ce1('0x36'),_0x4ce1('0x37'),_0x4ce1('0x27'),_0x3b6f15,_0x4ce1('0x38'),'updatedAt'],squel[_0x4ce1('0x3a')]()['field']('phone',_0x4ce1('0x1f'))[_0x4ce1('0x3b')]('NOW()',_0x4ce1('0x36'))[_0x4ce1('0x3b')]('id',_0x4ce1('0x37'))['field'](LISTID[_0x4ce1('0x3d')](),_0x4ce1('0x27'))[_0x4ce1('0x3b')](_0x37ed26['id']['toString'](),_0x3b6f15)[_0x4ce1('0x3b')](_0x4ce1('0x3c'),_0x4ce1('0x38'))['field']('NOW()','updatedAt')[_0x4ce1('0x43')]('cm_contacts')[_0x4ce1('0x40')](_0x4ce1('0x3f'))[_0x4ce1('0x40')](_0x4ce1('0x44'),LISTID[_0x4ce1('0x3d')]())[_0x4ce1('0x40')]('id\x20IN\x20?',squel[_0x4ce1('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x51b3cb;}function _0x38f1be(_0x13ecf5,_0x26ed14){var _0x31532c=squel[_0x4ce1('0x32')]()['into'](_0x4ce1('0x48'))[_0x4ce1('0x35')]([_0x4ce1('0x1f'),'ContactId',_0x4ce1('0x27'),_0x26ed14,_0x4ce1('0x38'),_0x4ce1('0x39')],squel[_0x4ce1('0x3a')]()[_0x4ce1('0x3b')](_0x4ce1('0x1f'),_0x4ce1('0x1f'))[_0x4ce1('0x3b')]('id','ContactId')[_0x4ce1('0x3b')](LISTID['toString'](),_0x4ce1('0x27'))[_0x4ce1('0x3b')](_0x13ecf5['id'][_0x4ce1('0x3d')](),_0x26ed14)[_0x4ce1('0x3b')](_0x4ce1('0x3c'),_0x4ce1('0x38'))[_0x4ce1('0x3b')](_0x4ce1('0x3c'),_0x4ce1('0x39'))[_0x4ce1('0x43')]('cm_contacts')[_0x4ce1('0x40')](_0x4ce1('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x4ce1('0x3d')]())[_0x4ce1('0x40')](_0x4ce1('0x49'),squel[_0x4ce1('0x47')](hopperContacts))[_0x4ce1('0x40')](_0x4ce1('0x41')))[_0x4ce1('0x3d')]();return _0x31532c;}return db[_0x4ce1('0x4a')][_0x4ce1('0x4b')]({'where':{'type':'outbound'},'attributes':['id',_0x4ce1('0x4c')],'include':[{'model':db[_0x4ce1('0x4d')],'as':_0x4ce1('0x4e'),'where':{'id':LISTID}}]})[_0x4ce1('0x2b')](function(_0x4edc12){var _0x4be42e=[];if(_0x4edc12){var _0x1ff2a6;for(var _0x43e045=0x0,_0x373fb9;_0x43e045<_0x4edc12[_0x4ce1('0x19')];_0x43e045+=0x1){_0x373fb9=_0x4edc12[_0x43e045][_0x4ce1('0x4f')]({'plain':!![]});switch(_0x373fb9[_0x4ce1('0x4c')]){case _0x4ce1('0x50'):_0x4be42e[_0x4ce1('0x2c')](db['sequelize'][_0x4ce1('0x51')](_0x3128ef(_0x373fb9,'VoiceQueueId'))[_0x4ce1('0x2b')](function(){})[_0x4ce1('0x52')](_0x4d5350()));break;case _0x4ce1('0x53'):_0x4be42e[_0x4ce1('0x2c')](db['sequelize']['query'](_0x1064e8(_0x373fb9,_0x4ce1('0x54')))[_0x4ce1('0x2b')](function(){})[_0x4ce1('0x52')](_0x4d5350()));break;default:_0x4be42e[_0x4ce1('0x2c')](db[_0x4ce1('0x55')][_0x4ce1('0x51')](_0x1fb4f4(_0x373fb9,'VoiceQueueId'))[_0x4ce1('0x2b')](function(){})['catch'](_0x4d5350()));}}}return _0x4be42e;})[_0x4ce1('0x56')]()[_0x4ce1('0x2b')](function(){return db[_0x4ce1('0x4a')][_0x4ce1('0x4b')]({'where':{'type':_0x4ce1('0x57')},'attributes':['id'],'include':[{'model':db[_0x4ce1('0x4d')],'as':_0x4ce1('0x58'),'where':{'id':LISTID}}]})[_0x4ce1('0x2b')](function(_0x437c07){var _0xe0e4e6=[];if(_0x437c07){var _0x3bbfd1;for(var _0x55f9b4=0x0,_0x5bb604;_0x55f9b4<_0x437c07[_0x4ce1('0x19')];_0x55f9b4+=0x1){_0x5bb604=_0x437c07[_0x55f9b4][_0x4ce1('0x4f')]({'plain':!![]});_0xe0e4e6[_0x4ce1('0x2c')](db['sequelize'][_0x4ce1('0x51')](_0x38f1be(_0x5bb604,'VoiceQueueId'))[_0x4ce1('0x2b')](function(){})['catch'](_0x4d5350()));}}return _0xe0e4e6;})[_0x4ce1('0x56')]();})[_0x4ce1('0x2b')](function(){return db[_0x4ce1('0x59')][_0x4ce1('0x4b')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x4ce1('0x4d')],'as':'Lists','where':{'id':LISTID}}]})['then'](function(_0x50dce1){var _0x34cab7=[];if(_0x50dce1){for(var _0x39ec1e=0x0,_0x1b8757;_0x39ec1e<_0x50dce1['length'];_0x39ec1e+=0x1){_0x1b8757=_0x50dce1[_0x39ec1e]['get']({'plain':!![]});switch(_0x1b8757[_0x4ce1('0x4c')]){case _0x4ce1('0x50'):_0x34cab7[_0x4ce1('0x2c')](db[_0x4ce1('0x55')]['query'](_0x3128ef(_0x1b8757,_0x4ce1('0x5a')))[_0x4ce1('0x2b')](function(){})[_0x4ce1('0x52')](_0x4d5350()));break;case _0x4ce1('0x53'):_0x34cab7[_0x4ce1('0x2c')](db[_0x4ce1('0x55')][_0x4ce1('0x51')](_0x1064e8(_0x1b8757,'CampaignId'))[_0x4ce1('0x2b')](function(){})['catch'](_0x4d5350()));break;default:_0x34cab7[_0x4ce1('0x2c')](db[_0x4ce1('0x55')][_0x4ce1('0x51')](_0x1fb4f4(_0x1b8757,_0x4ce1('0x5a')))['then'](function(){})[_0x4ce1('0x52')](_0x4d5350()));}}}return _0x34cab7;})[_0x4ce1('0x56')]();})[_0x4ce1('0x2b')](function(){return db[_0x4ce1('0x59')][_0x4ce1('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x4ce1('0x4d')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x51b236){var _0x2a927a=[];if(_0x51b236){for(var _0xd3dc04=0x0,_0x25c8bd;_0xd3dc04<_0x51b236[_0x4ce1('0x19')];_0xd3dc04+=0x1){_0x25c8bd=_0x51b236[_0xd3dc04][_0x4ce1('0x4f')]({'plain':!![]});_0x2a927a[_0x4ce1('0x2c')](db[_0x4ce1('0x55')][_0x4ce1('0x51')](_0x38f1be(_0x25c8bd,_0x4ce1('0x5a')))[_0x4ce1('0x2b')](function(){})[_0x4ce1('0x52')](_0x4d5350()));}}return _0x2a927a;})['all']();})[_0x4ce1('0x52')](function(_0x2aebe0){logger['error'](_0x4ce1('0x5b'),_0x4ce1('0x5c'),_0x2aebe0[_0x4ce1('0x2e')]);});}var processPromises=function(_0x5898bd){return BPromise[_0x4ce1('0x56')](promises)['then'](function(_0x410b9d){})[_0x4ce1('0x52')](function(_0x4db82a){logger[_0x4ce1('0x13')](_0x4ce1('0x5d'),JSON[_0x4ce1('0x2f')](_0x4db82a));})[_0x4ce1('0x5e')](function(){socket[_0x4ce1('0x5f')](_0x4ce1('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5898bd){return _0x5898bd[_0x4ce1('0x61')]();}});};var endCsv=function(){return BPromise[_0x4ce1('0x62')]()[_0x4ce1('0x2b')](function(){if(hopperContacts){return checkHopper();}})[_0x4ce1('0x2b')](function(){socket[_0x4ce1('0x5f')](_0x4ce1('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4ce1('0x63')](FILEPATH);}catch(_0x2e9183){logger['error'](_0x4ce1('0x64'),JSON[_0x4ce1('0x2f')](_0x2e9183));}finally{process[_0x4ce1('0x65')](0x0);}});};process['on'](_0x4ce1('0x66'),function(){logger[_0x4ce1('0x67')](_0x4ce1('0x68'));endCsv();});function main(){return BPromise[_0x4ce1('0x62')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4ce1('0x10')](',');return db['CmContact'][_0x4ce1('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4ce1('0x2b')](function(_0x783f0f){var _0x67dc57=fs[_0x4ce1('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x4ce1('0x6a')](_0x67dc57,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1fb1ab,_0x214e07){total+=0x1;var _0x36f7f3=total;promises[_0x4ce1('0x2c')](checkRow(_0x1fb1ab,_0x783f0f,_0x36f7f3)['then'](function(){success+=0x1;})[_0x4ce1('0x52')](function(_0x368497){if(_0x368497['error']){errors+=0x1;delete _0x368497['error'];}else if(_0x368497[_0x4ce1('0x6b')]){duplicates+=0x1;delete _0x368497[_0x4ce1('0x6b')];}rows['push'](_0x368497);}));if(total%0xc8===0x0){_0x214e07[_0x4ce1('0x6c')]();return processPromises(_0x214e07);}},'complete':function(){return processPromises()[_0x4ce1('0x2b')](function(){logger['info'](_0x4ce1('0x6d'));endCsv();});},'error':function(_0x256c4e,_0x3ab3fa){logger[_0x4ce1('0x67')]('CSV\x20parse\x20error',JSON[_0x4ce1('0x2f')](_0x256c4e));endCsv();}});})[_0x4ce1('0x52')](function(_0x5f2c28){logger['error'](_0x4ce1('0x6e'),JSON['stringify'](_0x5f2c28));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 857fd86..e03b882 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 _0x378b=['from','join','.id\x20=\x20','where','CmContact','then','length','AdditionalPhones','split','push','isNil','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ListId','priority','select','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.ListId','createdAt','cm_contacts.createdAt\x20=\x20?','\x20=\x20','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','updatedAt','recallme','fields','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','concat','keys','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','errors','code','query','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','all','error','voice_queues.id','voice_queues.dialTimezone','voice_queues_has_cm_lists.CmListId=','sequelize','timezones','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','includes','ContactItemType','findAll','name','_description','parse','createReadStream','data','rows','find','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','itemTypeId','description','contact:import:','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each','dialTimezone,utcOffset','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','contactId','contactTypeId','orderBy','voice_queues','voice_queues_has_cm_blacklists','VoiceQueueId','campaigns_has_cm_blacklists','campaigns','CampaignId','DROP\x20TABLE\x20','finish','affectedRows','emit','unlink','exit','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','squel','../../../mysqldb','redis','defaults','YYYY-MM-DD\x20HH:mm:ss','field','phone'];(function(_0x150f00,_0x55e584){var _0x1d4236=function(_0x1dbf93){while(--_0x1dbf93){_0x150f00['push'](_0x150f00['shift']());}};_0x1d4236(++_0x55e584);}(_0x378b,0xa4));var _0xb378=function(_0x3d7315,_0x56ec93){_0x3d7315=_0x3d7315-0x0;var _0x59e915=_0x378b[_0x3d7315];return _0x59e915;};'use strict';var fs=require('fs');var path=require(_0xb378('0x0'));var _=require(_0xb378('0x1'));var Papa=require('papaparse');var util=require(_0xb378('0x2'));var BPromise=require(_0xb378('0x3'));var moment=require(_0xb378('0x4'));var squel=require(_0xb378('0x5'));var Redis=require('ioredis');var db=require(_0xb378('0x6'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require('../../../config/logger')('import');config[_0xb378('0x7')]=_[_0xb378('0x8')](config[_0xb378('0x7')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb378('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()['format'](_0xb378('0x9'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x5564ff){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'](_0x5564ff);}function selectNotIn(_0x1b5bad,_0x2950ef,_0x832fb7,_0x624218,_0x215a80){return squel['select']()[_0xb378('0xa')](_0xb378('0xb'))[_0xb378('0xc')](_0x624218)[_0xb378('0xd')](_0x2950ef,null,_0x2950ef+_0xb378('0xe')+_0x624218+'.'+_0x832fb7)[_0xb378('0xf')](_0x624218+'.'+_0x832fb7+'\x20=\x20'+_0x1b5bad+'.'+_0x832fb7)[_0xb378('0xf')](_0x2950ef+'.dialCheckDuplicateType\x20IN\x20('+_0x215a80[_0xb378('0xd')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x483598,_0x104f80){promisesAdditionalPhones=[];return db[_0xb378('0x10')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0xb378('0x11')](function(_0x325eec){if(_0x325eec!==null){var _0x4dbed7=[];for(var _0x88938f=0x0;_0x88938f<_0x325eec[_0xb378('0x12')];_0x88938f++){var _0x5ea14c=_0x325eec[_0x88938f];_0x4dbed7['push'](insertAdditionalPhones(_0x5ea14c));}}Promise['all'](_0x4dbed7)['then'](function(){_0x483598({'val':0x1});});});});}function insertAdditionalPhones(_0x4b6543){return new Promise(function(_0xd08c42,_0x3ed843){var _0x5b7f11=_0x4b6543[_0xb378('0x13')];var _0x5c4e4b=_0x5b7f11[_0xb378('0x14')](';');var _0xc988e7=[];orderBy=0x0;for(var _0x263777=0x0;_0x263777<_0x5c4e4b[_0xb378('0x12')];_0x263777++){_0xc988e7[_0xb378('0x15')](splitAdditionalPhone(_0x4b6543['id'],_0x5c4e4b[_0x263777]));}Promise['all'](_0xc988e7)[_0xb378('0x11')](function(){_0xd08c42({'val':_0x5c4e4b[_0xb378('0x12')]});});});}function splitAdditionalPhone(_0x66e6f0,_0x187c6c){return new Promise(function(_0x27171a,_0x340d86){var _0x5522bc=_0x187c6c[_0xb378('0x14')](':');var _0x5e2b4d=_0x5522bc[0x0];var _0x18e6c5=_0x5522bc[0x1];if(!_[_0xb378('0x16')](_0x18e6c5)){var _0x126f31=_0x18e6c5[_0xb378('0x14')]('|');var _0x2e47e7=[];for(var _0xdd4716=0x0;_0xdd4716<_0x126f31[_0xb378('0x12')];_0xdd4716++){if(_0x126f31[_0xdd4716]!==''){var _0x44bc2e=_[_0xb378('0x17')](promisesAdditionalPhones,{'contactId':_0x66e6f0,'phone':_0x126f31[_0xdd4716]});if(_0x44bc2e[_0xb378('0x12')]==0x0){orderBy++;promisesAdditionalPhones[_0xb378('0x15')]({'contactId':_0x66e6f0,'contactTypeId':_0x5e2b4d,'phone':_0x126f31[_0xdd4716],'orderBy':orderBy});}}}_0x27171a({'ok':0x1});}else _0x27171a({'res':0x0});});}function createAdditionalPhone(_0x275c3b,_0x3addc5,_0x4d0b0b,_0x2d53e0){var _0x1390ae='';var _0x50054c='';var _0x746b38=_0x4d0b0b[_0xb378('0x14')]('§');_0x1390ae=_0x746b38[0x0];if(_0x746b38[_0xb378('0x12')]==0x2)_0x50054c=_0x746b38[0x1];return new Promise(function(_0x1a4c59,_0x253909){return db[_0xb378('0x18')][_0xb378('0x19')]({'where':{'CmContactId':_0x275c3b,'item':_0x1390ae}})[_0xb378('0x11')](function(_0x302102){if(_0x302102){return db['CmContactHasItem'][_0xb378('0x1a')]({'ItemTypeId':_0x3addc5,'description':_0x50054c,'OrderBy':_0x2d53e0},{'where':{'CmContactId':_0x275c3b,'item':_0x1390ae}})[_0xb378('0x11')](function(_0x30e457){_0x1a4c59({'res':'updated'});});}else{return db[_0xb378('0x18')][_0xb378('0x1b')]({'CmContactId':_0x275c3b,'item':_0x1390ae,'description':_0x50054c,'ItemTypeId':_0x3addc5,'OrderBy':_0x2d53e0,'ItemClass':_0xb378('0x1c')})[_0xb378('0x11')](function(_0x5e8b52){_0x1a4c59({'res':_0xb378('0x1d')});});}});});}function insertCmHopper(_0x5604db,_0x3a033b,_0x311c35,_0x3331f4,_0x4e281d){var _0x297cb0=[_0xb378('0x1e'),'cm_contacts.scheduledat',_0xb378('0x1f'),'cm_contacts.ListId',_0x3a033b+'.'+_0x3331f4,_0xb378('0x20'),_0xb378('0x21'),_0xb378('0x22'),_0xb378('0x23'),'\x22'+_0x4e281d+'\x22'];return squel[_0xb378('0x24')]()[_0xb378('0x25')]('cm_hopper')[_0xb378('0x26')]([_0xb378('0xb'),_0xb378('0x27'),'ContactId',_0xb378('0x28'),_0x3331f4,'createdAt','updatedAt',_0xb378('0x29'),'UserId','recallme'],squel[_0xb378('0x2a')]()['fields'](_0x297cb0)[_0xb378('0xc')](_0x3a033b)[_0xb378('0xd')](_0xb378('0x2b'),null,_0xb378('0x2c')+_0x3a033b+_0xb378('0x2d'))[_0xb378('0xd')](_0x311c35,null,_0x311c35+_0xb378('0xe')+_0x3a033b+'.'+_0x3331f4)[_0xb378('0xf')](_0x3a033b+_0xb378('0x2e'),_0x5604db)[_0xb378('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0xb378('0x2f'),selectNotIn(_0x3a033b,_0x311c35,_0x3331f4,_0xb378('0x30'),[_0xb378('0x31'),_0xb378('0x32')]))[_0xb378('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3a033b,_0x311c35,_0x3331f4,'cm_hopper',['\x22always\x22'])))[_0xb378('0x33')]();}function insertCmHopperBlack(_0x1c72f0,_0x59c887,_0x3652ed,_0x561395){var _0x34b5e1=[_0xb378('0x1e'),'cm_contacts.id',_0xb378('0x34'),_0x59c887+'.'+_0x561395,_0xb378('0x20'),_0xb378('0x21')];return squel[_0xb378('0x24')]()['into']('cm_hopper_black')['fromQuery'](['phone','ContactId','ListId',_0x561395,_0xb378('0x35'),'updatedAt'],squel[_0xb378('0x2a')]()['fields'](_0x34b5e1)[_0xb378('0xc')](_0x59c887)[_0xb378('0xd')]('cm_contacts',null,_0xb378('0x2c')+_0x59c887+'.CmListId')['join'](_0x3652ed,null,_0x3652ed+_0xb378('0xe')+_0x59c887+'.'+_0x561395)[_0xb378('0xf')](_0x59c887+'.CmListId\x20=\x20?',_0x1c72f0)['where'](_0xb378('0x36'),NOW)[_0xb378('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0xb378('0x2a')]()[_0xb378('0xa')]('phone')[_0xb378('0xc')]('cm_hopper_black')[_0xb378('0xf')]('ListId\x20=\x20?',_0x1c72f0)[_0xb378('0xf')](_0x561395+_0xb378('0x37')+_0x59c887+'.'+_0x561395)))[_0xb378('0x33')]();}function insertTzCmHopper(_0x58bd3e,_0x3297d5,_0x545673,_0x20759c,_0x569981,_0x20d89a){var _0x40360c=[_0xb378('0x1e'),_0xb378('0x38')+_0x20d89a+_0xb378('0x39'),_0xb378('0x1f'),_0xb378('0x34'),_0x3297d5+'.'+_0x20759c,'cm_contacts.createdAt',_0xb378('0x21'),_0xb378('0x22'),_0xb378('0x23'),'\x22'+_0x569981+'\x22'];var _0xfb3ea8=squel[_0xb378('0x24')]()[_0xb378('0x25')](_0xb378('0x30'))[_0xb378('0x26')]([_0xb378('0xb'),_0xb378('0x27'),_0xb378('0x3a'),_0xb378('0x28'),_0x20759c,_0xb378('0x35'),_0xb378('0x3b'),'priority','UserId',_0xb378('0x3c')],squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x40360c)['from'](_0x3297d5)[_0xb378('0xd')](_0xb378('0x2b'),null,_0xb378('0x2c')+_0x3297d5+_0xb378('0x2d'))[_0xb378('0xd')](_0x545673,null,_0x545673+_0xb378('0xe')+_0x3297d5+'.'+_0x20759c)[_0xb378('0xd')](_0x20d89a,null,_0x20d89a+'.id\x20=\x20'+_0x3297d5+'.'+_0x20759c)[_0xb378('0xf')](_0x3297d5+_0xb378('0x2e'),_0x58bd3e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb378('0xf')](_0xb378('0x2f'),selectNotIn(_0x3297d5,_0x545673,_0x20759c,'cm_hopper',[_0xb378('0x31'),_0xb378('0x32')]))[_0xb378('0xf')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3297d5,_0x545673,_0x20759c,_0xb378('0x30'),['\x22always\x22'])))[_0xb378('0x33')]();return _0xfb3ea8;}function insertTzCmHopperBlack(_0x26b5f2,_0x40514b,_0x2ad68f,_0x18289f){var _0x111417=['cm_contacts.phone',_0xb378('0x1f'),_0xb378('0x34'),_0x40514b+'.'+_0x18289f,_0xb378('0x20'),_0xb378('0x21')];return squel[_0xb378('0x24')]()['into']('cm_hopper_black')['fromQuery']([_0xb378('0xb'),'ContactId','ListId',_0x18289f,_0xb378('0x35'),'updatedAt'],squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x111417)[_0xb378('0xc')](_0x40514b)[_0xb378('0xd')](_0xb378('0x2b'),null,'cm_contacts.ListId\x20=\x20'+_0x40514b+_0xb378('0x2d'))['join'](_0x2ad68f,null,_0x2ad68f+_0xb378('0xe')+_0x40514b+'.'+_0x18289f)[_0xb378('0xf')](_0x40514b+_0xb378('0x2e'),_0x26b5f2)[_0xb378('0xf')](_0xb378('0x36'),NOW)[_0xb378('0xf')](_0xb378('0x2f'),squel['select']()['field']('phone')['from']('cm_hopper_black')['where'](_0xb378('0x3e'),_0x26b5f2)[_0xb378('0xf')](_0x18289f+_0xb378('0x37')+_0x40514b+'.'+_0x18289f)))[_0xb378('0x33')]();}function insertCmHopperAdditionalPhones(_0x2c35ec){var _0x3bcc7e=[_0xb378('0x3f'),_0xb378('0x40'),'cm_contact_has_items.OrderBy',_0xb378('0x41'),_0xb378('0x42')];return squel['insert']()[_0xb378('0x25')](_0xb378('0x43'))[_0xb378('0x26')]([_0xb378('0x44'),_0xb378('0xb'),_0xb378('0x45'),_0xb378('0x35'),_0xb378('0x3b')],squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x3bcc7e)[_0xb378('0xc')]('cm_hopper')['join'](_0xb378('0x2b'),null,_0xb378('0x46'))[_0xb378('0xd')](_0xb378('0x47'),null,_0xb378('0x48'))[_0xb378('0xf')]('cm_hopper.ListId\x20=\x20?',_0x2c35ec)[_0xb378('0xf')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb378('0x33')]();}function insertCmContact(_0x244056,_0x211a8a,_0x5bc3f9,_0x20022f){var _0x164b07=_[_0xb378('0x49')](_[_0xb378('0x4a')](_0x20022f),[_0xb378('0x28'),_0xb378('0x4b'),_0xb378('0x35'),'updatedAt',_0xb378('0x4c')]);return squel[_0xb378('0x24')]()[_0xb378('0x25')](_0xb378('0x2b'))[_0xb378('0x26')](_0x164b07,squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x164b07)[_0xb378('0xc')](_0x211a8a)[_0xb378('0xf')]('('+_0x5bc3f9[_0xb378('0xd')](',')+_0xb378('0x4d'),squel[_0xb378('0x2a')]()[_0xb378('0x3d')](_0x5bc3f9)['from'](_0xb378('0x2b'))[_0xb378('0xf')](_0xb378('0x3e'),_0x244056)[_0xb378('0xf')]('deletedAt\x20IS\x20NULL'))[_0xb378('0xf')](_0xb378('0x4e'),squel[_0xb378('0x2a')]()[_0xb378('0xa')](_0xb378('0x4f'),_0xb378('0x50'))[_0xb378('0xc')](_0x211a8a)[_0xb378('0x51')](_0x5bc3f9['join'](','))))[_0xb378('0x33')]();}function handleStop(){logger[_0xb378('0x52')](_0xb378('0x53'));stopped=!![];}function handleUncaughtException(_0x4eed65){logger['error'](_0x4eed65[_0xb378('0x54')]);process['exit'](0x1);}function handleError(_0x514eb0,_0x2df570){stats[_0xb378('0x55')]['push']({'name':_0x2df570[_0xb378('0x56')],'message':_0x2df570[_0xb378('0x54')],'row':_0x514eb0});}function handleQuery(_0x3b6ef6){logger[_0xb378('0x52')](_0x3b6ef6);return db['sequelize'][_0xb378('0x57')](_0x3b6ef6)[_0xb378('0x58')](function(_0x3a6768){results[_0xb378('0x15')](_0x3a6768);})[_0xb378('0x59')](function(_0x3058db){logger['error'](_0x3058db[_0xb378('0x54')]);});}function updateTzCampaigns(_0x6c0be7){return new Promise(function(_0x3159bb,_0x34f05b){var _0x14b45f=squel[_0xb378('0x2a')]()[_0xb378('0x3d')]([_0xb378('0x5a'),_0xb378('0x5b')])[_0xb378('0xc')]('campaigns')[_0xb378('0xd')](_0xb378('0x5c'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0xb378('0xf')](_0xb378('0x5d')+_0x6c0be7);db['sequelize']['query'](_0x14b45f['toString']())[_0xb378('0x58')](function(_0x1b32d3){var _0x22606b=[];for(var _0x4dd32c=0x0;_0x4dd32c<_0x1b32d3[_0xb378('0x12')];_0x4dd32c++){_0x22606b['push'](getTimezoneData(_0x1b32d3[_0x4dd32c],tmp_campaigns));}BPromise[_0xb378('0x5e')](_0x22606b)['then'](function(){_0x3159bb({'val':0x1});});})[_0xb378('0x59')](function(_0x3a9d34){logger[_0xb378('0x5f')](_0x3a9d34['message']);_0x3159bb({'val':0x0});});});}function updateTzVoiceQueues(_0x1eaee9){return new Promise(function(_0xc19b1c,_0x413537){var _0x4b150b=squel[_0xb378('0x2a')]()[_0xb378('0x3d')]([_0xb378('0x60'),_0xb378('0x61')])[_0xb378('0xc')]('voice_queues')[_0xb378('0xd')]('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0xb378('0xf')](_0xb378('0x62')+_0x1eaee9);db[_0xb378('0x63')][_0xb378('0x57')](_0x4b150b[_0xb378('0x33')]())[_0xb378('0x58')](function(_0x3a8159){var _0x54ec36=[];for(var _0x4a240e=0x0;_0x4a240e<_0x3a8159[_0xb378('0x12')];_0x4a240e++){_0x54ec36[_0xb378('0x15')](getTimezoneData(_0x3a8159[_0x4a240e],tmp_voice_queues));}BPromise[_0xb378('0x5e')](_0x54ec36)[_0xb378('0x11')](function(){_0xc19b1c({'val':0x1});});})['catch'](function(_0x6e7f68){logger[_0xb378('0x5f')](_0x6e7f68[_0xb378('0x54')]);_0xc19b1c({'val':0x0});});});}function getTimezoneData(_0x272581,_0x50212a){return new Promise(function(_0x422726,_0x4d6e3b){var _0x4d583b=shared[_0xb378('0x64')];var _0x2fe8f8=_0x4d583b[_0x272581[_0xb378('0x65')]];if(_['isNil'](_0x2fe8f8)){_0x422726({'ret':0x1});}else{var _0x48a27c=_0x2fe8f8[_0xb378('0x66')];var _0x4fc48a=squel[_0xb378('0x24')]()[_0xb378('0x25')](_0x50212a)['set']('id',_0x272581['id'])[_0xb378('0x67')](_0xb378('0x68'),_0x48a27c)[_0xb378('0x67')](_0xb378('0x65'),_0x272581[_0xb378('0x65')])[_0xb378('0x33')]();return db['sequelize'][_0xb378('0x57')](_0x4fc48a)[_0xb378('0x58')](function(_0x37c73d){_0x422726({'ret':0x1});})[_0xb378('0x59')](function(_0x30bdde){logger[_0xb378('0x5f')](_0x30bdde[_0xb378('0x54')]);_0x4d6e3b({'ret':0x1});});}});}function handleTZQuery(_0x51ed90){logger[_0xb378('0x52')](_0x51ed90);return db[_0xb378('0x63')][_0xb378('0x57')](_0x51ed90)[_0xb378('0x58')](function(_0x56f998){})[_0xb378('0x59')](function(_0x165e50){logger[_0xb378('0x5f')](_0x165e50[_0xb378('0x54')]);});}function main(_0x4f99f6,_0x2fda3d,_0xcec325,_0x1d76da){logger['info'](_0xb378('0x69'),_0x4f99f6,JSON['stringify'](_0x2fda3d));process[_0xb378('0x6a')](_0xb378('0x6b'));var _0x53917f=_0x2fda3d[_0xb378('0x6c')];var _0x1f252e=_[_0xb378('0x6d')](_0x53917f);var _0x324eea=_0x2fda3d[_0xb378('0x6e')];var _0x57922d=path[_0xb378('0xd')](config[_0xb378('0x6f')],_0xb378('0x70'),_0x324eea+_0xb378('0x71'));hasTZ=_['keys'](_0x53917f)[_0xb378('0x72')](_0xb378('0x65'));var _0x4a41d0=_[_0xb378('0x4a')](_0x53917f)[_0xb378('0xd')]();logger[_0xb378('0x52')]('header',_0x4a41d0);db[_0xb378('0x73')][_0xb378('0x74')]({'raw':!![],'attributes':['id',_0xb378('0x75')]})[_0xb378('0x11')](function(_0x19ab8b){for(var _0x209041=0x0;_0x209041<_0x19ab8b['length'];_0x209041++){if(_0x19ab8b[_0x209041][_0xb378('0x75')]in _0x53917f){contactItemTypes[_0xb378('0x15')](_0x19ab8b[_0x209041]);delete _0x1f252e[_0x19ab8b[_0x209041][_0xb378('0x75')]];hasAdditionalPhones=!![];}for(var _0x34eacd in _0x53917f){if(_0x19ab8b[_0x209041][_0xb378('0x75')]+_0xb378('0x76')===_0x34eacd){phoneDescriptions[_0xb378('0x15')]({'itemTypeId':_0x19ab8b[_0x209041]['id'],'description':_0x34eacd});delete _0x1f252e[_0x34eacd];}}}if(hasAdditionalPhones)_0x1f252e['AdditionalPhones']='';var _0x309cb2=_['keys'](_0x1f252e)[_0xb378('0xd')]();logger[_0xb378('0x52')]('header',_0x309cb2);fs['writeFileSync'](_0x57922d,_0x309cb2+'\x0a');Papa[_0xb378('0x77')](fs[_0xb378('0x78')](_0x4f99f6),{'header':!![],'skipEmptyLines':!![],'step':function(_0x3d74ac,_0x1abfcc){try{for(var _0x48e6a9=0x0,_0x3f78d8=[];_0x48e6a9<_0x3d74ac[_0xb378('0x79')][_0xb378('0x12')];_0x48e6a9++){stats[_0xb378('0x7a')]+=0x1;if(_0x3d74ac['errors'][_0x48e6a9]){handleError(_0x3d74ac[_0xb378('0x79')][_0x48e6a9],_0x3d74ac[_0xb378('0x55')][_0x48e6a9]);}else{var _0x1909ad=[];var _0x33dec4=[];var _0x3e7f7d={};for(var _0x586dc8 in _0x53917f){let _0x22eba4=contactItemTypes['find'](_0xd187b8=>_0xd187b8[_0xb378('0x75')]===_0x586dc8);let _0x40d45f=contactItemTypes[_0xb378('0x7b')](_0x264daf=>_0x264daf[_0xb378('0x75')]+'_description'===_0x586dc8);if(_[_0xb378('0x16')](_0x22eba4)&&_[_0xb378('0x16')](_0x40d45f)){if(_0x53917f['hasOwnProperty'](_0x586dc8)){if(_0x3d74ac[_0xb378('0x79')][_0x48e6a9][_0x53917f[_0x586dc8]]){var _0xcf4b4d=_[_0xb378('0x7c')](_0x3d74ac[_0xb378('0x79')][_0x48e6a9][_0x53917f[_0x586dc8]][_0xb378('0x7d')](/"/g,'\x27'));switch(_0x586dc8){case _0xb378('0x27'):var _0x57d6e0=moment(_0xcf4b4d,_0xb378('0x9'),!![]);if(_0x57d6e0[_0xb378('0x7e')]()){_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');}else{_0x1909ad[_0xb378('0x15')](_0xb378('0x7f'));}break;case _0xb378('0x29'):var _0x16141c=parseInt(_0xcf4b4d);_0xcf4b4d=_['isNaN'](_0x16141c)||_0x16141c<0x0||_0x16141c>0x4?_0x1d76da?0x3:0x2:_0x16141c;_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');break;case'UserId':var _0x4d1435=parseInt(_0xcf4b4d);if(_[_0xb378('0x80')](_0x4d1435)&&_['includes'](_0xcec325,_0x4d1435)){_0x3f78d8[_0xb378('0x15')]('\x22'+_0x4d1435+'\x22');}else{_0x1909ad[_0xb378('0x15')](_0xb378('0x81'));}break;case _0xb378('0x82'):if(isEmail(_0xcf4b4d)){_0x3f78d8['push']('\x22'+_0xcf4b4d+'\x22');}else{_0x1909ad['push'](_0xb378('0x83'));}break;case _0xb378('0x84'):var _0x20597a=moment(_0xcf4b4d,_0xb378('0x85'),!![]);if(_0x20597a[_0xb378('0x7e')]()){_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');}else{_0x1909ad[_0xb378('0x15')](_0xb378('0x86'));}break;case _0xb378('0x65'):var _0x502c78=shared[_0xb378('0x64')];var _0x49f6be=_0x502c78[_0xcf4b4d];if(!_[_0xb378('0x16')](_0x49f6be)){var _0x12783c=_0x49f6be['utcOffset'];_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');_0x3f78d8[_0xb378('0x15')]('\x22'+_0x12783c+'\x22');}break;default:_0x3f78d8[_0xb378('0x15')]('\x22'+_0xcf4b4d+'\x22');}}else{switch(_0x586dc8){case _0xb378('0x87'):case _0xb378('0xb'):_0x1909ad['push'](_0x586dc8+'\x20not\x20specified');break;default:_0x3f78d8[_0xb378('0x15')]('\x22\x22');}}}}else{var _0x437943='';if(!_[_0xb378('0x16')](_0x22eba4)){if(!_0x3e7f7d['hasOwnProperty'](_0x22eba4['id'])){if(!_[_0xb378('0x16')](_0x3d74ac['data'][_0x48e6a9][_0x53917f[_0x586dc8]])){var _0xcf4b4d=_[_0xb378('0x7c')](_0x3d74ac['data'][_0x48e6a9][_0x53917f[_0x586dc8]][_0xb378('0x7d')](/"/g,'\x27'));var _0x5c55a0=phoneDescriptions[_0xb378('0x7b')](_0x3d7f19=>_0x3d7f19[_0xb378('0x88')]===_0x22eba4['id']);if(!_['isNil'](_0x5c55a0)){var _0x4c3e2a=_[_0xb378('0x7c')](_0x3d74ac[_0xb378('0x79')][_0x48e6a9][_0x53917f[_0x5c55a0[_0xb378('0x89')]]][_0xb378('0x7d')](/"/g,'\x27'));if(!_[_0xb378('0x16')](_0x4c3e2a))_0xcf4b4d=_0xcf4b4d+'§'+_0x4c3e2a;}if(_0x437943=='')_0x437943=_0xcf4b4d;else _0x437943+='|'+_0xcf4b4d;}_0x33dec4[_0xb378('0x15')](_0x22eba4['id']+':'+_0x437943);_0x3e7f7d[_0x22eba4['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3f78d8['push']('\x22'+_0x33dec4['join'](';')+'\x22');}if(_0x1909ad[_0xb378('0x12')]){handleError(_0x3d74ac[_0xb378('0x79')][_0x48e6a9],{'code':'SystemRow','message':_0x1909ad[_0xb378('0xd')]()});}else{fs['appendFileSync'](_0x57922d,_0x3f78d8['join']()+'\x0a');}_0x3f78d8=[];}if(!(stats['rows']%0xc8)){socket['emit'](_0xb378('0x8a')+_0x324eea,stats);stats[_0xb378('0x55')]=[];}}if(stopped){logger[_0xb378('0x52')]('Abort\x20parser');_0x1abfcc['abort']();}}catch(_0x32518b){handleError(_0x3d74ac[_0xb378('0x79')][_0x48e6a9],{'code':_0xb378('0x8b'),'message':_0x32518b['message']});logger['error'](_0xb378('0x8c'),_0x32518b[_0xb378('0x54')]);}},'complete':function(){try{var _0x3d3f6e=[];var _0x5a5d7c=[];var _0xf00ef9=_0xb378('0x2b');if(_0x2fda3d[_0xb378('0x8d')]&&_0x2fda3d[_0xb378('0x8d')][_0xb378('0x12')]){_0xf00ef9=_0xb378('0x8e')+_0x324eea;_0x3d3f6e[_0xb378('0x15')](_0xb378('0x8f')+_0xf00ef9+_0xb378('0x90'));}tmp_campaigns=_0xb378('0x91')+_0x324eea;tmp_voice_queues='voice_queues_'+_0x324eea;_0x5a5d7c[_0xb378('0x15')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xb378('0x92'));_0x5a5d7c['push'](_0xb378('0x8f')+tmp_voice_queues+_0xb378('0x92'));BPromise[_0xb378('0x93')](_0x5a5d7c,handleTZQuery)[_0xb378('0x11')](function(_0x6bd765){updateTzCampaigns(_0x2fda3d[_0xb378('0x28')])[_0xb378('0x11')](function(_0x5212df){updateTzVoiceQueues(_0x2fda3d[_0xb378('0x28')])[_0xb378('0x11')](function(_0x586c20){if(hasTZ)_0x309cb2=_0x309cb2['replace']('dialTimezone',_0xb378('0x94'));var _0x54eff4=util['format'](_0xb378('0x95'),_0x57922d,_0xf00ef9,_0x309cb2,_0x2fda3d[_0xb378('0x28')],_0x2fda3d[_0xb378('0x4b')]||null,NOW,NOW);if(_[_0xb378('0x16')](_0x53917f[_0xb378('0x27')])){_0x54eff4+=',\x20scheduledAt\x20=\x20NOW()';}_0x3d3f6e['push'](_0x54eff4);if(_0x2fda3d['duplicates']&&_0x2fda3d['duplicates'][_0xb378('0x12')]){_0x3d3f6e[_0xb378('0x15')](insertCmContact(_0x2fda3d[_0xb378('0x28')],_0xf00ef9,_0x2fda3d[_0xb378('0x8d')],_0x53917f));_0x3d3f6e[_0xb378('0x15')]('DROP\x20TABLE\x20'+_0xf00ef9+';');}BPromise[_0xb378('0x93')](_0x3d3f6e,handleQuery)[_0xb378('0x11')](function(_0xda9249){BPromise[_0xb378('0x5e')]([handleAdditionalPhones()])[_0xb378('0x11')](function(){_0x3d3f6e=[];for(var _0x3742d0=0x0;_0x3742d0_0x533a64[_0x93b7('0x74')]===_0x360c09);let _0x2d893=contactItemTypes[_0x93b7('0x7a')](_0x486295=>_0x486295[_0x93b7('0x74')]+_0x93b7('0x7b')===_0x360c09);if(_['isNil'](_0x25eb0a)&&_[_0x93b7('0x1b')](_0x2d893)){if(_0x85ec45[_0x93b7('0x7c')](_0x360c09)){if(_0x561c4a[_0x93b7('0x78')][_0x554cc3][_0x85ec45[_0x360c09]]){var _0x59b963=_[_0x93b7('0x7d')](_0x561c4a['data'][_0x554cc3][_0x85ec45[_0x360c09]]['replace'](/"/g,'\x27'));switch(_0x360c09){case _0x93b7('0x2c'):var _0x2ef9a1=moment(_0x59b963,_0x93b7('0xb'),!![]);if(_0x2ef9a1[_0x93b7('0x7e')]()){_0x4478bc[_0x93b7('0x16')]('\x22'+_0x59b963+'\x22');}else{_0x1f77cb[_0x93b7('0x16')](_0x93b7('0x7f'));}break;case _0x93b7('0x46'):var _0x296c96=parseInt(_0x59b963);_0x59b963=_['isNaN'](_0x296c96)||_0x296c96<0x0||_0x296c96>0x4?_0x1e253b?0x3:0x2:_0x296c96;_0x4478bc[_0x93b7('0x16')]('\x22'+_0x59b963+'\x22');break;case _0x93b7('0x31'):var _0x376ea1=parseInt(_0x59b963);if(_[_0x93b7('0x80')](_0x376ea1)&&_[_0x93b7('0x81')](_0x16bea4,_0x376ea1)){_0x4478bc[_0x93b7('0x16')]('\x22'+_0x376ea1+'\x22');}else{_0x1f77cb[_0x93b7('0x16')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x59b963)){_0x4478bc['push']('\x22'+_0x59b963+'\x22');}else{_0x1f77cb[_0x93b7('0x16')]('email\x20wrong\x20format');}break;case _0x93b7('0x82'):var _0x150c06=moment(_0x59b963,_0x93b7('0x83'),!![]);if(_0x150c06[_0x93b7('0x7e')]()){_0x4478bc[_0x93b7('0x16')]('\x22'+_0x59b963+'\x22');}else{_0x1f77cb[_0x93b7('0x16')](_0x93b7('0x84'));}break;case _0x93b7('0x66'):var _0x2eec5f=shared[_0x93b7('0x65')];var _0x1dc163=_0x2eec5f[_0x59b963];if(!_[_0x93b7('0x1b')](_0x1dc163)){var _0x1282aa=_0x1dc163[_0x93b7('0x67')];_0x4478bc['push']('\x22'+_0x59b963+'\x22');_0x4478bc[_0x93b7('0x16')]('\x22'+_0x1282aa+'\x22');}break;default:_0x4478bc[_0x93b7('0x16')]('\x22'+_0x59b963+'\x22');}}else{switch(_0x360c09){case _0x93b7('0x85'):case _0x93b7('0xe'):_0x1f77cb[_0x93b7('0x16')](_0x360c09+'\x20not\x20specified');break;default:_0x4478bc[_0x93b7('0x16')]('\x22\x22');}}}}else{var _0xe5fcde='';if(!_[_0x93b7('0x1b')](_0x25eb0a)){if(!_0x2280ba['hasOwnProperty'](_0x25eb0a['id'])){if(!_['isNil'](_0x561c4a[_0x93b7('0x78')][_0x554cc3][_0x85ec45[_0x360c09]])){var _0x59b963=_['trim'](_0x561c4a[_0x93b7('0x78')][_0x554cc3][_0x85ec45[_0x360c09]][_0x93b7('0x86')](/"/g,'\x27'));var _0x137326=phoneDescriptions[_0x93b7('0x7a')](_0x498e86=>_0x498e86[_0x93b7('0x87')]===_0x25eb0a['id']);if(!_[_0x93b7('0x1b')](_0x137326)){var _0x484561=_[_0x93b7('0x7d')](_0x561c4a[_0x93b7('0x78')][_0x554cc3][_0x85ec45[_0x137326['description']]]['replace'](/"/g,'\x27'));if(!_[_0x93b7('0x1b')](_0x484561))_0x59b963=_0x59b963+'§'+_0x484561;}if(_0xe5fcde=='')_0xe5fcde=_0x59b963;else _0xe5fcde+='|'+_0x59b963;}_0x5d7275['push'](_0x25eb0a['id']+':'+_0xe5fcde);_0x2280ba[_0x25eb0a['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4478bc['push']('\x22'+_0x5d7275[_0x93b7('0x12')](';')+'\x22');}if(_0x1f77cb[_0x93b7('0x1a')]){handleError(_0x561c4a[_0x93b7('0x78')][_0x554cc3],{'code':_0x93b7('0x88'),'message':_0x1f77cb[_0x93b7('0x12')]()});}else{fs[_0x93b7('0x89')](_0xcf4dd0,_0x4478bc[_0x93b7('0x12')]()+'\x0a');}_0x4478bc=[];}if(!(stats[_0x93b7('0x79')]%0xc8)){socket['emit'](_0x93b7('0x8a')+_0x50aa3d,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x93b7('0x8b'));_0x274565[_0x93b7('0x8c')]();}}catch(_0x2f838d){handleError(_0x561c4a['data'][_0x554cc3],{'code':_0x93b7('0x8d'),'message':_0x2f838d[_0x93b7('0x59')]});logger[_0x93b7('0x55')](_0x93b7('0x8e'),_0x2f838d[_0x93b7('0x59')]);}},'complete':function(){try{var _0x59e56f=[];var _0x122427=[];var _0x2e6e13='cm_contacts';if(_0x2cbafa['duplicates']&&_0x2cbafa[_0x93b7('0x8f')][_0x93b7('0x1a')]){_0x2e6e13=_0x93b7('0x90')+_0x50aa3d;_0x59e56f[_0x93b7('0x16')](_0x93b7('0x91')+_0x2e6e13+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0x93b7('0x92')+_0x50aa3d;tmp_voice_queues='voice_queues_'+_0x50aa3d;_0x122427[_0x93b7('0x16')](_0x93b7('0x91')+tmp_campaigns+_0x93b7('0x93'));_0x122427['push'](_0x93b7('0x91')+tmp_voice_queues+_0x93b7('0x93'));BPromise[_0x93b7('0x94')](_0x122427,handleTZQuery)[_0x93b7('0x15')](function(_0x4cc81f){updateTzCampaigns(_0x2cbafa[_0x93b7('0x2e')])[_0x93b7('0x15')](function(_0x302c3c){updateTzVoiceQueues(_0x2cbafa[_0x93b7('0x2e')])[_0x93b7('0x15')](function(_0xa0b945){if(hasTZ)_0x1e2927=_0x1e2927[_0x93b7('0x86')](_0x93b7('0x66'),'dialTimezone,utcOffset');var _0x486fa5=util[_0x93b7('0xa')](_0x93b7('0x95'),_0xcf4dd0,_0x2e6e13,_0x1e2927,_0x2cbafa[_0x93b7('0x2e')],_0x2cbafa[_0x93b7('0x96')]||null,NOW,NOW);if(_[_0x93b7('0x1b')](_0x85ec45[_0x93b7('0x2c')])){_0x486fa5+=_0x93b7('0x97');}_0x59e56f[_0x93b7('0x16')](_0x486fa5);if(_0x2cbafa[_0x93b7('0x8f')]&&_0x2cbafa['duplicates'][_0x93b7('0x1a')]){_0x59e56f[_0x93b7('0x16')](insertCmContact(_0x2cbafa[_0x93b7('0x2e')],_0x2e6e13,_0x2cbafa[_0x93b7('0x8f')],_0x85ec45));_0x59e56f[_0x93b7('0x16')](_0x93b7('0x98')+_0x2e6e13+';');}BPromise['each'](_0x59e56f,handleQuery)[_0x93b7('0x15')](function(_0x5edd69){BPromise[_0x93b7('0x17')]([handleAdditionalPhones()])['then'](function(){_0x59e56f=[];for(var _0x4be9e5=0x0;_0x4be9e5\x20\x20');}var _0x313f63=path[_0x93b7('0x12')](config[_0x93b7('0x70')],'server/files/tmp',process['argv'][0x2]);if(!fs['existsSync'](_0x313f63)){throw new Error(_0x93b7('0xa7'));}var _0x3c7ca6={};try{_0x3c7ca6=JSON['parse'](process['argv'][0x3]);if(!_0x3c7ca6[_0x93b7('0x6d')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x3c7ca6['binding'][_0x93b7('0xe')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x3c7ca6[_0x93b7('0x6d')][_0x93b7('0x85')]){throw new Error(_0x93b7('0xa8'));}var _0x324d06=0x0;if(_0x3c7ca6[_0x93b7('0x6d')][_0x93b7('0x31')]){_0x324d06=0x1;}if(!_0x3c7ca6[_0x93b7('0x2e')]){throw new Error(_0x93b7('0xa9'));}}catch(_0x114250){throw new Error(_0x93b7('0xaa'));}var _0x52c068=[];try{_0x52c068=_['map'](JSON[_0x93b7('0xab')](process[_0x93b7('0xa6')][0x4]),'id');}catch(_0x2cc3e4){logger[_0x93b7('0x54')](_0x93b7('0xac'));}main(_0x313f63,_0x3c7ca6,_0x52c068,_0x324d06);}validate();process['on'](_0x93b7('0xad'),handleStop);process['on'](_0x93b7('0xae'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index b9daffc..114ad4e 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x21c9=['CmHopperId','OrderBy','cm_hopper','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?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','errors','spread','stringify','binding','clone','socket_timestamp','server/files/tmp','.csv','body','ContactItemType','findAll','name','header','writeFileSync','parse','createReadStream','data','rows','find','_description','trim','isValid','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','hasOwnProperty','description','replace','SystemRow','appendFileSync','emit','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','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',',\x20scheduledAt\x20=\x20NOW()','each','contactId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','contact:import:','unlink','complete','argv','arguments\x20\x20\x20','root','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','path','lodash','papaparse','util','moment','squel','../../../mysqldb','import','redis','defaults','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','format','test','field','phone','from','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','join','sequelize','query','push','all','then','catch','error','isNil','length','split','filter','CmContactHasItem','updated','PHONE','CmContact','update','CmHopper','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','into','fromQuery','scheduledat','createdAt','priority','recallme','select','fields','cm_contacts','cm_contacts.ListId\x20=\x20','.id\x20=\x20','.CmListId\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','insert','cm_hopper_black','ContactId','.CmListId','cm_contacts.createdAt\x20=\x20?','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'];(function(_0x5805d7,_0x3d584a){var _0x170fe4=function(_0x3b9b73){while(--_0x3b9b73){_0x5805d7['push'](_0x5805d7['shift']());}};_0x170fe4(++_0x3d584a);}(_0x21c9,0xea));var _0x921c=function(_0x1971d0,_0x4ad9d9){_0x1971d0=_0x1971d0-0x0;var _0x52f42c=_0x21c9[_0x1971d0];return _0x52f42c;};'use strict';var fs=require('fs');var path=require(_0x921c('0x0'));var _=require(_0x921c('0x1'));var Papa=require(_0x921c('0x2'));var util=require(_0x921c('0x3'));var BPromise=require('bluebird');var moment=require(_0x921c('0x4'));var squel=require(_0x921c('0x5'));var Redis=require('ioredis');var db=require(_0x921c('0x6'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x921c('0x7'));config[_0x921c('0x8')]=_[_0x921c('0x9')](config[_0x921c('0x8')],{'host':_0x921c('0xa'),'port':0x18eb});var socket=require(_0x921c('0xb'))(new Redis(config['redis']));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'](_0x921c('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x921c('0xd')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0xbdf09e){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))*$/[_0x921c('0xe')](_0xbdf09e);}function selectNotIn(_0x4aeafa,_0x17e372,_0x29db4d,_0x55da04,_0x36c2b1){return squel['select']()[_0x921c('0xf')](_0x921c('0x10'))[_0x921c('0x11')](_0x55da04)['join'](_0x17e372,null,_0x17e372+'.id\x20=\x20'+_0x55da04+'.'+_0x29db4d)['where'](_0x55da04+'.'+_0x29db4d+_0x921c('0x12')+_0x4aeafa+'.'+_0x29db4d)[_0x921c('0x13')](_0x17e372+_0x921c('0x14')+_0x36c2b1[_0x921c('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x451317,_0x4be115){promisesAdditionalPhones=[];promisesContact=[];return db[_0x921c('0x16')][_0x921c('0x17')]('select\x20*\x20from\x20'+tempTableName)['spread'](function(_0x402ea4){if(_0x402ea4!==null){var _0x32c264=[];for(var _0x348bf7=0x0;_0x348bf7<_0x402ea4['length'];_0x348bf7++){var _0x21b689=_0x402ea4[_0x348bf7];if(!_['isNil'](_0x21b689[_0x921c('0x10')])){if(!_['isNil'](_0x21b689['AdditionalPhones']))_0x32c264[_0x921c('0x18')](insertAdditionalPhones(_0x21b689));promisesContact[_0x921c('0x18')]({'contact':_0x21b689});}}}Promise[_0x921c('0x19')](_0x32c264)[_0x921c('0x1a')](function(){_0x451317({'val':0x1});});})[_0x921c('0x1b')](function(_0x44effc){logger[_0x921c('0x1c')](_0x44effc['message']);});});}function insertAdditionalPhones(_0x31acde){return new Promise(function(_0x4dd1ff,_0x3c2796){var _0x5304b2=_0x31acde['AdditionalPhones'];if(_[_0x921c('0x1d')](_0x5304b2))_0x3c2796({'val':0x0});else{var _0x1d0123=_0x5304b2['split'](';');var _0x42c1e2=[];orderBy=0x0;for(var _0x2890f3=0x0;_0x2890f3<_0x1d0123[_0x921c('0x1e')];_0x2890f3++){_0x42c1e2['push'](splitAdditionalPhone(_0x31acde['id'],_0x1d0123[_0x2890f3]));}Promise[_0x921c('0x19')](_0x42c1e2)[_0x921c('0x1a')](function(){_0x4dd1ff({'val':_0x1d0123[_0x921c('0x1e')]});});}});}function splitAdditionalPhone(_0x815b9b,_0x5e47b6){return new Promise(function(_0x55a32e,_0x22cd7a){var _0x56cf0a=_0x5e47b6[_0x921c('0x1f')](':');var _0x2a3faf=_0x56cf0a[0x0];var _0x491f9c=_0x56cf0a[0x1];if(_0x491f9c!==''){var _0x5f23ee=_0x491f9c[_0x921c('0x1f')]('|');var _0x50d2ce=[];for(var _0x5d4760=0x0;_0x5d4760<_0x5f23ee[_0x921c('0x1e')];_0x5d4760++){if(_0x5f23ee[_0x5d4760]!==''){var _0x498ebb=_[_0x921c('0x20')](promisesAdditionalPhones,{'contactId':_0x815b9b,'phone':_0x5f23ee[_0x5d4760]});if(_0x498ebb[_0x921c('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x921c('0x18')]({'contactId':_0x815b9b,'contactTypeId':_0x2a3faf,'phone':_0x5f23ee[_0x5d4760],'orderBy':orderBy});}}}_0x55a32e({'ok':0x1});}else _0x55a32e({'res':0x0});});}function createAdditionalPhone(_0x6aa9a0,_0x5f5dba,_0x1508d9,_0x3017c5){var _0x46cc65='';var _0x1b3409='';var _0x45d93e=_0x1508d9[_0x921c('0x1f')]('§');_0x46cc65=_0x45d93e[0x0];if(_0x45d93e[_0x921c('0x1e')]==0x2)_0x1b3409=_0x45d93e[0x1];return new Promise(function(_0x36bbf5,_0x7de247){return db[_0x921c('0x21')]['findOne']({'where':{'CmContactId':_0x6aa9a0,'item':_0x46cc65}})['then'](function(_0x49b4a8){if(_0x49b4a8){return db[_0x921c('0x21')]['update']({'ItemTypeId':_0x5f5dba,'description':_0x1b3409,'OrderBy':_0x3017c5},{'where':{'CmContactId':_0x6aa9a0,'item':_0x46cc65}})[_0x921c('0x1a')](function(_0x44dc5e){_0x36bbf5({'res':_0x921c('0x22')});});}else{return db[_0x921c('0x21')]['create']({'CmContactId':_0x6aa9a0,'item':_0x46cc65,'ItemTypeId':_0x5f5dba,'description':_0x1b3409,'OrderBy':_0x3017c5,'ItemClass':_0x921c('0x23')})[_0x921c('0x1a')](function(_0x5e6b9b){_0x36bbf5({'res':'inserted'});});}});});}function updateContact(_0x3c250a){return new Promise(function(_0x332d80,_0x11936e){var _0x168a9f=_0x3c250a['id'];delete _0x3c250a['id'];return db[_0x921c('0x24')][_0x921c('0x25')](_0x3c250a,{'where':{'id':_0x168a9f}})['then'](function(_0x4a9b00){updatedRows+=0x1;return db[_0x921c('0x26')]['update']({'phone':_0x3c250a[_0x921c('0x10')]},{'where':{'ContactId':_0x168a9f}})['then'](function(_0x8e7419){_0x332d80({'ret':'OK'});});});});}function insertCmHopper(_0x4290dc,_0x2f6f93,_0x368ef1,_0x1912de,_0xad7326){var _0x4afca7=[_0x921c('0x27'),'cm_contacts.scheduledat','cm_contacts.id',_0x921c('0x28'),_0x2f6f93+'.'+_0x1912de,_0x921c('0x29'),_0x921c('0x2a'),_0x921c('0x2b'),'cm_contacts.UserId','\x22'+_0xad7326+'\x22'];return squel['insert']()[_0x921c('0x2c')]('cm_hopper')[_0x921c('0x2d')](['phone',_0x921c('0x2e'),'ContactId','ListId',_0x1912de,_0x921c('0x2f'),'updatedAt',_0x921c('0x30'),'UserId',_0x921c('0x31')],squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x4afca7)['from'](_0x2f6f93)['join'](_0x921c('0x34'),null,_0x921c('0x35')+_0x2f6f93+'.CmListId')[_0x921c('0x15')](_0x368ef1,null,_0x368ef1+_0x921c('0x36')+_0x2f6f93+'.'+_0x1912de)[_0x921c('0x13')](_0x2f6f93+_0x921c('0x37'),_0x4290dc)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x921c('0x13')](_0x921c('0x38'),selectNotIn(_0x2f6f93,_0x368ef1,_0x1912de,'cm_hopper',[_0x921c('0x39'),_0x921c('0x3a')]))[_0x921c('0x13')](_0x921c('0x38'),selectNotIn(_0x2f6f93,_0x368ef1,_0x1912de,'cm_hopper',['\x22always\x22'])))[_0x921c('0x3b')]();}function insertCmHopperBlack(_0x40116f,_0x4627c1,_0x524334,_0x3aa17c){var _0x5ddbcf=[_0x921c('0x27'),_0x921c('0x3c'),_0x921c('0x28'),_0x4627c1+'.'+_0x3aa17c,_0x921c('0x29'),'cm_contacts.updatedAt'];return squel[_0x921c('0x3d')]()[_0x921c('0x2c')](_0x921c('0x3e'))['fromQuery']([_0x921c('0x10'),_0x921c('0x3f'),'ListId',_0x3aa17c,_0x921c('0x2f'),'updatedAt'],squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x5ddbcf)[_0x921c('0x11')](_0x4627c1)[_0x921c('0x15')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x4627c1+_0x921c('0x40'))['join'](_0x524334,null,_0x524334+'.id\x20=\x20'+_0x4627c1+'.'+_0x3aa17c)['where'](_0x4627c1+_0x921c('0x37'),_0x40116f)[_0x921c('0x13')](_0x921c('0x41'),NOW)[_0x921c('0x13')](_0x921c('0x38'),squel[_0x921c('0x32')]()[_0x921c('0xf')]('phone')[_0x921c('0x11')](_0x921c('0x3e'))[_0x921c('0x13')](_0x921c('0x42'),_0x40116f)[_0x921c('0x13')](_0x3aa17c+_0x921c('0x43'),_0x4627c1+'.'+_0x3aa17c)))[_0x921c('0x3b')]();}function insertCmHopperAdditionalPhones(_0x1c6327){var _0x4ce8d7=[_0x921c('0x44'),_0x921c('0x45'),_0x921c('0x46'),_0x921c('0x47'),_0x921c('0x48')];return squel[_0x921c('0x3d')]()[_0x921c('0x2c')](_0x921c('0x49'))[_0x921c('0x2d')]([_0x921c('0x4a'),_0x921c('0x10'),_0x921c('0x4b'),_0x921c('0x2f'),'updatedAt'],squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x4ce8d7)['from'](_0x921c('0x4c'))[_0x921c('0x15')](_0x921c('0x34'),null,_0x921c('0x4d'))['join'](_0x921c('0x4e'),null,_0x921c('0x4f'))[_0x921c('0x13')](_0x921c('0x50'),_0x1c6327)[_0x921c('0x13')](_0x921c('0x41'),NOW))[_0x921c('0x3b')]();}function insertCmContact(_0x47eb34,_0x19d029,_0x480b93,_0x541a5d){var _0x2cfce4=_[_0x921c('0x51')](_[_0x921c('0x52')](_0x541a5d),[_0x921c('0x53'),_0x921c('0x54'),'createdAt','updatedAt']);return squel['insert']()[_0x921c('0x2c')](_0x921c('0x34'))[_0x921c('0x2d')](_0x2cfce4,squel[_0x921c('0x32')]()[_0x921c('0x33')](_0x2cfce4)['from'](_0x19d029)[_0x921c('0x13')]('('+_0x480b93[_0x921c('0x15')](',')+_0x921c('0x55'),squel['select']()['fields'](_0x480b93)[_0x921c('0x11')](_0x921c('0x34'))[_0x921c('0x13')]('ListId\x20=\x20?',_0x47eb34))[_0x921c('0x13')]('id\x20IN\x20?',squel[_0x921c('0x32')]()[_0x921c('0xf')](_0x921c('0x56'),_0x921c('0x57'))[_0x921c('0x11')](_0x19d029)[_0x921c('0x58')](_0x480b93['join'](','))))['toString']();}function handleStop(){logger[_0x921c('0x59')](_0x921c('0x5a'));stopped=!![];}function handleUncaughtException(_0x1eed23){logger[_0x921c('0x1c')](_0x1eed23[_0x921c('0x5b')]);process[_0x921c('0x5c')](0x1);}function handleError(_0x4c505d,_0x3cf987){stats[_0x921c('0x5d')]['push']({'name':_0x3cf987['code'],'message':_0x3cf987['message'],'row':_0x4c505d});}function handleQuery(_0x4121fa){logger[_0x921c('0x59')](_0x4121fa);return db['sequelize']['query'](_0x4121fa)[_0x921c('0x5e')](function(_0xcfd81e){results[_0x921c('0x18')](_0xcfd81e);})['catch'](function(_0x4328da){logger[_0x921c('0x1c')](_0x4328da[_0x921c('0x5b')]);});}function main(_0x2b0009,_0x2a1655,_0x309782,_0x3848bc){logger['info']('main',_0x2b0009,JSON[_0x921c('0x5f')](_0x2a1655));process['send']('start');var _0x2d2122=_0x2a1655[_0x921c('0x60')];var _0x1babf7=_[_0x921c('0x61')](_0x2d2122);var _0x28f26e=_0x2a1655[_0x921c('0x62')];var _0x1ad30e=path[_0x921c('0x15')](config['root'],_0x921c('0x63'),_0x28f26e+_0x921c('0x64'));logger[_0x921c('0x59')](_0x921c('0x65'),_0x2a1655);db[_0x921c('0x66')][_0x921c('0x67')]({'raw':!![],'attributes':['id',_0x921c('0x68')]})[_0x921c('0x1a')](function(_0x44a403){for(var _0x4cd7ec=0x0;_0x4cd7ec<_0x44a403[_0x921c('0x1e')];_0x4cd7ec++){if(_0x44a403[_0x4cd7ec]['name']in _0x2d2122){contactItemTypes[_0x921c('0x18')](_0x44a403[_0x4cd7ec]);delete _0x1babf7[_0x44a403[_0x4cd7ec][_0x921c('0x68')]];hasAdditionalPhones=!![];}for(var _0x531a1c in _0x2d2122){if(_0x44a403[_0x4cd7ec][_0x921c('0x68')]+'_description'===_0x531a1c){phoneDescriptions[_0x921c('0x18')]({'itemTypeId':_0x44a403[_0x4cd7ec]['id'],'description':_0x531a1c});delete _0x1babf7[_0x531a1c];}}}if(hasAdditionalPhones)_0x1babf7['AdditionalPhones']='';var _0x4453b8=_[_0x921c('0x52')](_0x1babf7)[_0x921c('0x15')]();logger[_0x921c('0x59')](_0x921c('0x69'),_0x4453b8);fs[_0x921c('0x6a')](_0x1ad30e,_0x4453b8+'\x0a');Papa[_0x921c('0x6b')](fs[_0x921c('0x6c')](_0x2b0009),{'header':!![],'skipEmptyLines':!![],'step':function(_0x12dbaf,_0x4f5397){try{for(var _0x48d2b2=0x0,_0x3dd648=[];_0x48d2b2<_0x12dbaf[_0x921c('0x6d')][_0x921c('0x1e')];_0x48d2b2++){stats[_0x921c('0x6e')]+=0x1;if(_0x12dbaf[_0x921c('0x5d')][_0x48d2b2]){handleError(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2],_0x12dbaf[_0x921c('0x5d')][_0x48d2b2]);}else{var _0x36f715=[];var _0x125621=[];var _0x45edbe={};for(var _0x199522 in _0x2d2122){let _0x34e0c2=contactItemTypes[_0x921c('0x6f')](_0x3ac790=>_0x3ac790['name']===_0x199522);let _0x5d9aa4=contactItemTypes[_0x921c('0x6f')](_0x14e7d2=>_0x14e7d2['name']+_0x921c('0x70')===_0x199522);if(_['isNil'](_0x34e0c2)&&_[_0x921c('0x1d')](_0x5d9aa4)){if(_0x2d2122['hasOwnProperty'](_0x199522)){if(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2][_0x2d2122[_0x199522]]){var _0x42919a=_[_0x921c('0x71')](_0x12dbaf[_0x921c('0x6d')][_0x48d2b2][_0x2d2122[_0x199522]]['replace'](/"/g,'\x27'));switch(_0x199522){case _0x921c('0x2e'):var _0x3813e5=moment(_0x42919a,_0x921c('0xc'),!![]);if(_0x3813e5[_0x921c('0x72')]()){_0x3dd648['push']('\x22'+_0x42919a+'\x22');}else{_0x36f715[_0x921c('0x18')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x921c('0x30'):var _0x5c68cf=parseInt(_0x42919a);_0x42919a=_[_0x921c('0x73')](_0x5c68cf)||_0x5c68cf<0x0||_0x5c68cf>0x4?_0x3848bc?0x3:0x2:_0x5c68cf;_0x3dd648['push']('\x22'+_0x42919a+'\x22');break;case _0x921c('0x74'):var _0x199d50=parseInt(_0x42919a);if(_[_0x921c('0x75')](_0x199d50)&&_[_0x921c('0x76')](_0x309782,_0x199d50)){_0x3dd648[_0x921c('0x18')]('\x22'+_0x199d50+'\x22');}else{_0x36f715[_0x921c('0x18')](_0x921c('0x77'));}break;case _0x921c('0x78'):if(isEmail(_0x42919a)){_0x3dd648[_0x921c('0x18')]('\x22'+_0x42919a+'\x22');}else{_0x36f715[_0x921c('0x18')](_0x921c('0x79'));}break;case'dateOfBirth':var _0x2e1b65=moment(_0x42919a,'YYYY-MM-DD',!![]);if(_0x2e1b65['isValid']()){_0x3dd648[_0x921c('0x18')]('\x22'+_0x42919a+'\x22');}else{_0x36f715[_0x921c('0x18')](_0x921c('0x7a'));}break;default:_0x3dd648[_0x921c('0x18')]('\x22'+_0x42919a+'\x22');}}else{switch(_0x199522){case'firstName':case _0x921c('0x10'):_0x36f715[_0x921c('0x18')](_0x199522+_0x921c('0x7b'));break;default:_0x3dd648['push']('\x22\x22');}}}}else{var _0x5a300b='';if(!_[_0x921c('0x1d')](_0x34e0c2)){if(!_0x45edbe[_0x921c('0x7c')](_0x34e0c2['id'])){for(var _0x355742=0x0;_0x355742<_0x2d2122[_0x199522][_0x921c('0x1e')];_0x355742++){var _0x42919a=_[_0x921c('0x71')](_0x12dbaf['data'][_0x48d2b2][_0x2d2122[_0x199522][_0x355742]]['replace'](/"/g,'\x27'));var _0x254626=phoneDescriptions[_0x921c('0x6f')](_0x4ef417=>_0x4ef417['itemTypeId']===_0x34e0c2['id']);if(!_['isNil'](_0x254626)){var _0x32d63f=_[_0x921c('0x71')](_0x12dbaf[_0x921c('0x6d')][_0x48d2b2][_0x2d2122[_0x254626[_0x921c('0x7d')]][0x0]][_0x921c('0x7e')](/"/g,'\x27'));if(!_[_0x921c('0x1d')](_0x32d63f))_0x42919a=_0x42919a+'§'+_0x32d63f;}if(_0x5a300b=='')_0x5a300b=_0x42919a;else _0x5a300b+='|'+_0x42919a;}_0x125621[_0x921c('0x18')](_0x34e0c2['id']+':'+_0x5a300b);_0x45edbe[_0x34e0c2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x3dd648[_0x921c('0x18')]('\x22'+_0x125621[_0x921c('0x15')](';')+'\x22');}if(_0x36f715[_0x921c('0x1e')]){handleError(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2],{'code':_0x921c('0x7f'),'message':_0x36f715[_0x921c('0x15')]()});}else{fs[_0x921c('0x80')](_0x1ad30e,_0x3dd648[_0x921c('0x15')]()+'\x0a');}_0x3dd648=[];}if(!(stats[_0x921c('0x6e')]%0xc8)){socket[_0x921c('0x81')]('contact:import:'+_0x28f26e,stats);stats[_0x921c('0x5d')]=[];}}if(stopped){logger['info'](_0x921c('0x82'));_0x4f5397[_0x921c('0x83')]();}}catch(_0x41d98b){handleError(_0x12dbaf[_0x921c('0x6d')][_0x48d2b2],{'code':_0x921c('0x84'),'message':_0x41d98b[_0x921c('0x5b')]});logger[_0x921c('0x1c')]('step',_0x41d98b[_0x921c('0x5b')]);}},'complete':function(){try{var _0x430588=[];var _0x458172=tempTableName;_0x430588['push'](_0x921c('0x85')+_0x458172+_0x921c('0x86'));logger[_0x921c('0x59')](_0x921c('0x87'),contactItemTypes[_0x921c('0x1e')]);var _0x2f2c93=util[_0x921c('0xd')](_0x921c('0x88'),_0x1ad30e,_0x458172,_0x4453b8,_0x2a1655[_0x921c('0x53')],_0x2a1655[_0x921c('0x54')]||null,NOW,NOW);if(_['isNil'](_0x2d2122[_0x921c('0x2e')])){_0x2f2c93+=_0x921c('0x89');}_0x430588['push'](_0x2f2c93);BPromise[_0x921c('0x8a')](_0x430588,handleQuery)[_0x921c('0x1a')](function(_0x35fe88){BPromise[_0x921c('0x19')]([handleAdditionalPhones()])['then'](function(){_0x430588=[];for(var _0xb5e7d8=0x0;_0xb5e7d8_0x552fa4[_0x45cb('0x6b')]===_0x352fd2);let _0x40f3dc=contactItemTypes[_0x45cb('0x70')](_0x2ed3aa=>_0x2ed3aa[_0x45cb('0x6b')]+_0x45cb('0x6c')===_0x352fd2);if(_['isNil'](_0x3448da)&&_[_0x45cb('0x1e')](_0x40f3dc)){if(_0x3dd2e6[_0x45cb('0x71')](_0x352fd2)){if(_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x352fd2]]){var _0x50c0ed=_[_0x45cb('0x72')](_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x352fd2]][_0x45cb('0x73')](/"/g,'\x27'));switch(_0x352fd2){case _0x45cb('0x36'):var _0x3f095a=moment(_0x50c0ed,_0x45cb('0xe'),!![]);if(_0x3f095a[_0x45cb('0x74')]()){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}else{_0x39a0ff[_0x45cb('0x20')](_0x45cb('0x75'));}break;case _0x45cb('0x39'):var _0x4d1683=parseInt(_0x50c0ed);_0x50c0ed=_[_0x45cb('0x76')](_0x4d1683)||_0x4d1683<0x0||_0x4d1683>0x4?_0x58b7e0?0x3:0x2:_0x4d1683;_0x45c8d1['push']('\x22'+_0x50c0ed+'\x22');break;case _0x45cb('0x77'):var _0x4dabc1=parseInt(_0x50c0ed);if(_[_0x45cb('0x78')](_0x4dabc1)&&_[_0x45cb('0x79')](_0x3e4900,_0x4dabc1)){_0x45c8d1['push']('\x22'+_0x4dabc1+'\x22');}else{_0x39a0ff['push'](_0x45cb('0x7a'));}break;case _0x45cb('0x7b'):if(isEmail(_0x50c0ed)){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}else{_0x39a0ff['push']('email\x20wrong\x20format');}break;case _0x45cb('0x7c'):var _0x3700e8=moment(_0x50c0ed,'YYYY-MM-DD',!![]);if(_0x3700e8[_0x45cb('0x74')]()){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}else{_0x39a0ff[_0x45cb('0x20')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x50c0ed+'\x22');}}else{switch(_0x352fd2){case _0x45cb('0x7d'):case'phone':_0x39a0ff[_0x45cb('0x20')](_0x352fd2+'\x20not\x20specified');break;default:_0x45c8d1['push']('\x22\x22');}}}}else{var _0x2d9ce4='';if(!_[_0x45cb('0x1e')](_0x3448da)){if(!_0x4e0d86[_0x45cb('0x71')](_0x3448da['id'])){for(var _0x4e3aec=0x0;_0x4e3aec<_0x3dd2e6[_0x352fd2][_0x45cb('0x26')];_0x4e3aec++){var _0x50c0ed=_[_0x45cb('0x72')](_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x352fd2][_0x4e3aec]][_0x45cb('0x73')](/"/g,'\x27'));var _0x5ce238=phoneDescriptions['find'](_0x5d9104=>_0x5d9104['itemTypeId']===_0x3448da['id']);if(!_[_0x45cb('0x1e')](_0x5ce238)){var _0x3c0713=_[_0x45cb('0x72')](_0x44cb0d[_0x45cb('0x6f')][_0x172236][_0x3dd2e6[_0x5ce238[_0x45cb('0x7e')]][0x0]][_0x45cb('0x73')](/"/g,'\x27'));if(!_['isNil'](_0x3c0713))_0x50c0ed=_0x50c0ed+'§'+_0x3c0713;}if(_0x2d9ce4=='')_0x2d9ce4=_0x50c0ed;else _0x2d9ce4+='|'+_0x50c0ed;}_0x3a2649['push'](_0x3448da['id']+':'+_0x2d9ce4);_0x4e0d86[_0x3448da['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45c8d1[_0x45cb('0x20')]('\x22'+_0x3a2649['join'](';')+'\x22');}if(_0x39a0ff[_0x45cb('0x26')]){handleError(_0x44cb0d[_0x45cb('0x6f')][_0x172236],{'code':_0x45cb('0x7f'),'message':_0x39a0ff[_0x45cb('0x15')]()});}else{fs[_0x45cb('0x80')](_0x53ae33,_0x45c8d1['join']()+'\x0a');}_0x45c8d1=[];}if(!(stats['rows']%0xc8)){socket[_0x45cb('0x81')](_0x45cb('0x82')+_0x21c549,stats);stats[_0x45cb('0x5e')]=[];}}if(stopped){logger['info'](_0x45cb('0x83'));_0x30dd81['abort']();}}catch(_0x504cb2){handleError(_0x44cb0d[_0x45cb('0x6f')][_0x172236],{'code':'SystemError','message':_0x504cb2[_0x45cb('0x24')]});logger['error'](_0x45cb('0x84'),_0x504cb2[_0x45cb('0x24')]);}},'complete':function(){try{var _0x1ab418=[];var _0x13dd09=tempTableName;_0x1ab418[_0x45cb('0x20')]('CREATE\x20TABLE\x20'+_0x13dd09+_0x45cb('0x85'));logger[_0x45cb('0x5a')](_0x45cb('0x86'),contactItemTypes[_0x45cb('0x26')]);var _0x22ffec=util[_0x45cb('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',_0x53ae33,_0x13dd09,_0x4209ff,_0x90635a[_0x45cb('0x44')],_0x90635a['CompanyId']||null,NOW,NOW);if(_[_0x45cb('0x1e')](_0x3dd2e6['scheduledat'])){_0x22ffec+=',\x20scheduledAt\x20=\x20NOW()';}_0x1ab418['push'](_0x22ffec);BPromise[_0x45cb('0x87')](_0x1ab418,handleQuery)['then'](function(_0x5d9f17){BPromise[_0x45cb('0x21')]([handleAdditionalPhones()])['then'](function(){_0x1ab418=[];for(var _0x9beb8e=0x0;_0x9beb8e\x20\x20');}var _0x300e98=path['join'](config[_0x45cb('0x67')],_0x45cb('0x90'),process['argv'][0x2]);if(!fs[_0x45cb('0x91')](_0x300e98)){throw new Error(_0x45cb('0x92'));}var _0x4d2932={};try{_0x4d2932=JSON[_0x45cb('0x6e')](process[_0x45cb('0x8f')][0x3]);if(!_0x4d2932['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x3d4f9d=0x0;if(_0x4d2932[_0x45cb('0x64')][_0x45cb('0x77')]){_0x3d4f9d=0x1;}if(!_0x4d2932[_0x45cb('0x44')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x2cfeb2){throw new Error(_0x45cb('0x93'));}var _0x37acd0=[];try{_0x37acd0=_[_0x45cb('0x94')](JSON[_0x45cb('0x6e')](process[_0x45cb('0x8f')][0x4]),'id');}catch(_0x4a36e4){logger[_0x45cb('0x5a')](_0x45cb('0x95'));}main(_0x300e98,_0x4d2932,_0x37acd0,_0x3d4f9d);}validate();process['on'](_0x45cb('0x96'),handleStop);process['on'](_0x45cb('0x97'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 86562cc..4ef7a9f 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d31=['Date','starttime','Answer\x20Time','answertime','Complete\x20Time','Duration','duration','billableseconds','getSubjects','[xCALLY\x20Ticket]','voice','toLowerCase','push','queue','calleridnum','outbound','string','Outbound\x20Call','variable','destcalleridnum','inbound','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Called\x20Number','membername'];(function(_0x5f4b36,_0x18cb34){var _0x4765ec=function(_0x2a6c85){while(--_0x2a6c85){_0x5f4b36['push'](_0x5f4b36['shift']());}};_0x4765ec(++_0x18cb34);}(_0x2d31,0xc4));var _0x12d3=function(_0x4d8789,_0x3fdff1){_0x4d8789=_0x4d8789-0x0;var _0x404e41=_0x2d31[_0x4d8789];return _0x404e41;};'use strict';exports[_0x12d3('0x0')]=function(_0x472a69,_0x3d2459){var _0x202f4d=[{'type':'string','content':_0x12d3('0x1'),'variableName':null}];switch(_0x472a69['toLowerCase']()){case _0x12d3('0x2'):switch(_0x3d2459[_0x12d3('0x3')]()){case'inbound':_0x202f4d[_0x12d3('0x4')]({'type':'variable','content':'','variableName':_0x12d3('0x5')});_0x202f4d[_0x12d3('0x4')]({'type':'variable','content':'','variableName':_0x12d3('0x6')});break;case _0x12d3('0x7'):_0x202f4d[_0x12d3('0x4')]({'type':_0x12d3('0x8'),'content':_0x12d3('0x9'),'variableName':null});_0x202f4d['push']({'type':_0x12d3('0xa'),'content':'','variableName':_0x12d3('0xb')});break;}}return _0x202f4d;};exports['getDescriptions']=function(_0x418503,_0x3ee313){var _0x2a74a1=[];switch(_0x418503[_0x12d3('0x3')]()){case _0x12d3('0x2'):switch(_0x3ee313[_0x12d3('0x3')]()){case _0x12d3('0xc'):_0x2a74a1=[{'type':_0x12d3('0x8'),'content':_0x12d3('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0x12d3('0xe'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x6')},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x10'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x11')},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x12'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x13')},{'type':'keyValue','content':'','key':_0x12d3('0x14'),'keyType':'variable','variableName':_0x12d3('0x5')},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x15'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x16')},{'type':'keyValue','content':'','key':'Date','keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x17')},{'type':_0x12d3('0x8'),'content':_0x12d3('0x18'),'key':null,'keyType':null,'variableName':null},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x19'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x1a')},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x1b'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0xb')},{'type':'string','content':_0x12d3('0x1c'),'key':null,'keyType':null,'variableName':null},{'type':_0x12d3('0xf'),'content':'','key':'Agent\x20Ring','keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x17')},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x1d'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x1e')},{'type':'keyValue','content':'','key':_0x12d3('0x1f'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x20')},{'type':'keyValue','content':'','key':_0x12d3('0x21'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x22')},{'type':'keyValue','content':'','key':_0x12d3('0x23'),'keyType':_0x12d3('0xa'),'variableName':_0x12d3('0x24')}];break;case'outbound':_0x2a74a1=[{'type':_0x12d3('0x8'),'content':_0x12d3('0xd'),'variableName':null},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x25'),'keyType':_0x12d3('0xa'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0x12d3('0xf'),'content':'','key':'Member\x20Name','keyType':_0x12d3('0xa'),'keyContent':'','variableName':_0x12d3('0x26')},{'type':'keyValue','content':'','key':_0x12d3('0x15'),'keyType':_0x12d3('0xa'),'keyContent':'','variableName':'uniqueid'},{'type':'keyValue','content':'','key':_0x12d3('0x27'),'keyType':'variable','keyContent':'','variableName':_0x12d3('0x28')},{'type':'string','content':_0x12d3('0x1c')},{'type':'keyValue','content':'','key':_0x12d3('0x29'),'keyType':_0x12d3('0xa'),'keyContent':'','variableName':_0x12d3('0x2a')},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x2b'),'keyType':'variable','keyContent':'','variableName':'endtime'},{'type':_0x12d3('0xf'),'content':'','key':_0x12d3('0x2c'),'keyType':_0x12d3('0xa'),'keyContent':'','variableName':_0x12d3('0x2d')},{'type':'keyValue','content':'','key':'Billable\x20Time','keyType':_0x12d3('0xa'),'keyContent':'','variableName':_0x12d3('0x2e')}];break;}}return _0x2a74a1;}; \ No newline at end of file +var _0x433b=['holdtime','Talk\x20Time','talktime','membername','starttime','***\x20Time\x20Info\x20***','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','billableseconds','string','[xCALLY\x20Ticket]','toLowerCase','inbound','push','variable','queue','calleridnum','outbound','getDescriptions','voice','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','agentcalledAt','***\x20Agent\x20Info\x20***','destcalleridname','Agent\x20Number','destcalleridnum','Agent\x20Ring','Agent\x20Connect','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time'];(function(_0x3583d3,_0x5ee48b){var _0x3ef352=function(_0x57c446){while(--_0x57c446){_0x3583d3['push'](_0x3583d3['shift']());}};_0x3ef352(++_0x5ee48b);}(_0x433b,0x1da));var _0xb433=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x433b[_0x11a220];return _0x20d8fe;};'use strict';exports['getSubjects']=function(_0x4b3652,_0x52e410){var _0x14a6e0=[{'type':_0xb433('0x0'),'content':_0xb433('0x1'),'variableName':null}];switch(_0x4b3652[_0xb433('0x2')]()){case'voice':switch(_0x52e410[_0xb433('0x2')]()){case _0xb433('0x3'):_0x14a6e0[_0xb433('0x4')]({'type':_0xb433('0x5'),'content':'','variableName':_0xb433('0x6')});_0x14a6e0[_0xb433('0x4')]({'type':_0xb433('0x5'),'content':'','variableName':_0xb433('0x7')});break;case _0xb433('0x8'):_0x14a6e0[_0xb433('0x4')]({'type':'string','content':'Outbound\x20Call','variableName':null});_0x14a6e0[_0xb433('0x4')]({'type':_0xb433('0x5'),'content':'','variableName':'destcalleridnum'});break;}}return _0x14a6e0;};exports[_0xb433('0x9')]=function(_0x3afbf9,_0x401d40){var _0x508907=[];switch(_0x3afbf9[_0xb433('0x2')]()){case _0xb433('0xa'):switch(_0x401d40[_0xb433('0x2')]()){case _0xb433('0x3'):_0x508907=[{'type':_0xb433('0x0'),'content':_0xb433('0xb'),'key':null,'keyType':null,'variableName':null},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0xd'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x7')},{'type':_0xb433('0xc'),'content':'','key':'Caller\x20Name','keyType':_0xb433('0x5'),'variableName':_0xb433('0xe')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0xf'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x10')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0x11'),'keyType':'variable','variableName':_0xb433('0x6')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0x12'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x13')},{'type':'keyValue','content':'','key':_0xb433('0x14'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x15')},{'type':_0xb433('0x0'),'content':_0xb433('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0xb433('0xc'),'content':'','key':'Agent\x20Name','keyType':_0xb433('0x5'),'variableName':_0xb433('0x17')},{'type':'keyValue','content':'','key':_0xb433('0x18'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x19')},{'type':_0xb433('0x0'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xb433('0x1a'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x15')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0x1b'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x1c')},{'type':'keyValue','content':'','key':_0xb433('0x1d'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x1e')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0x1f'),'keyType':_0xb433('0x5'),'variableName':_0xb433('0x20')},{'type':'keyValue','content':'','key':_0xb433('0x21'),'keyType':'variable','variableName':_0xb433('0x22')}];break;case _0xb433('0x8'):_0x508907=[{'type':_0xb433('0x0'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x19')},{'type':_0xb433('0xc'),'content':'','key':'Member\x20Name','keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x23')},{'type':'keyValue','content':'','key':_0xb433('0x12'),'keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x13')},{'type':'keyValue','content':'','key':_0xb433('0x14'),'keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x24')},{'type':_0xb433('0x0'),'content':_0xb433('0x25')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0x26'),'keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x27')},{'type':'keyValue','content':'','key':_0xb433('0x28'),'keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x29')},{'type':'keyValue','content':'','key':_0xb433('0x2a'),'keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x2b')},{'type':_0xb433('0xc'),'content':'','key':_0xb433('0x2c'),'keyType':_0xb433('0x5'),'keyContent':'','variableName':_0xb433('0x2d')}];break;}}return _0x508907;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 9e52e39..2a939fc 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3b03=['findAll','skipInteractionsQuery','getInteractionsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','body','contact','default','fields','filter','user','having','read','tags','checkAccountsRestrictions','tag','countFilteredInteractions','count','length','order','forEach','DESC','closed','getFilteredInteractions','rows','tracked','query','omit','html','phone','fax','updateUser','lodash','./sql-utils'];(function(_0x48a359,_0x35d66d){var _0x332c8c=function(_0x3bab9e){while(--_0x3bab9e){_0x48a359['push'](_0x48a359['shift']());}};_0x332c8c(++_0x35d66d);}(_0x3b03,0x108));var _0x33b0=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0x3b03[_0x298ed3];return _0x5aad28;};'use strict';var _=require(_0x33b0('0x0'));var sqlUtils=require(_0x33b0('0x1'));var utils=require('./utils');exports[_0x33b0('0x2')]=function(_0x44607a,_0x62e40f,_0x43ab7f,_0x5c7e5e,_0x2025e2){var _0x495507={'count':0x0,'rows':[]};var _0x5de46e=sqlUtils[_0x33b0('0x3')](_0x44607a,_0x43ab7f,_0x62e40f);if(_0x5de46e){return Promise['resolve'](_0x495507);}var _0xbc437e=sqlUtils[_0x33b0('0x4')](_0x44607a);var _0x5b0e44={};return Promise[_0x33b0('0x5')]()[_0x33b0('0x6')](function(){if(_0x62e40f[_0x33b0('0x7')]){return sqlUtils[_0x33b0('0x8')](_0x62e40f['search'],_0x2025e2);}else{return sqlUtils[_0x33b0('0x9')](_0x44607a,_0x62e40f,_0x2025e2);}})[_0x33b0('0x6')](function(_0x5c84f3){_0xbc437e[_0x33b0('0xa')](_0x5c84f3[_0x33b0('0xb')]);_0xbc437e[_0x33b0('0xa')](_0x5c84f3[_0x33b0('0xc')]);_0xbc437e['where'](_0x5c84f3[_0x33b0('0xd')]);_0xbc437e[_0x33b0('0xa')](_0x5c84f3[_0x33b0('0xe')]);_0xbc437e[_0x33b0('0xa')](_0x5c84f3[_0x33b0('0xf')]);_0xbc437e[_0x33b0('0xa')](_0x5c84f3[_0x33b0('0x10')]);_0xbc437e[_0x33b0('0x11')](_0x5c84f3[_0x33b0('0x12')]);_0x5b0e44=_0x5c84f3[_0x33b0('0x13')];return sqlUtils[_0x33b0('0x14')](_0x44607a,_0x43ab7f,_0x62e40f);})[_0x33b0('0x6')](function(_0x3d7480){_0xbc437e['where'](_0x3d7480);_0xbc437e['group']('i.id');var _0x568654=_0x62e40f[_0x33b0('0x7')]?_0x5b0e44['ids']:_0x62e40f[_0x33b0('0x15')];return sqlUtils[_0x33b0('0x16')](_0xbc437e,_0x568654);})[_0x33b0('0x6')](function(_0x447545){_0x495507[_0x33b0('0x17')]=_0x447545[_0x33b0('0x18')];if(_0x495507[_0x33b0('0x17')]===0x0){return[];}_0xbc437e[_0x33b0('0x11')](_0x5b0e44['clause']);if(_0x5c7e5e[_0x33b0('0x19')]){_0x5c7e5e[_0x33b0('0x19')][_0x33b0('0x1a')](function(_0x23ac89){var _0x33af9c=_0x23ac89[0x0]==='contactName'?_0x23ac89[0x0]:'i.'+_0x23ac89[0x0];_0xbc437e[_0x33b0('0x19')](_0x33af9c,_0x23ac89[0x1]===_0x33b0('0x1b')?![]:!![]);if(_0x23ac89[0x0]===_0x33b0('0x1c')){var _0x8c09c2=sqlUtils['getClosedOrderClause'](_0x44607a,_0x62e40f);_0xbc437e['order'](_0x8c09c2,_0x23ac89[0x1]===_0x33b0('0x1b')?![]:!![]);}});}return sqlUtils[_0x33b0('0x1d')](_0x44607a,_0xbc437e,_0x62e40f,_0x5c7e5e);})[_0x33b0('0x6')](function(_0x1084c4){_0x495507[_0x33b0('0x1e')]=_0x1084c4;return _0x495507;})['catch'](function(_0x430d0a){throw _0x430d0a;});};exports[_0x33b0('0x1f')]=function(_0x2b8512,_0x5e5a25){return function(_0x254ab5,_0x1bc5c5,_0x192be9){var _0x1b454c=_0x254ab5['user'];var _0x232973={};var _0x42d0fd=_0x254ab5[_0x33b0('0x20')];if(_0x232973){_0x232973=_['clone'](_0x254ab5[_0x33b0('0xb')]);_0x232973=_[_0x33b0('0x21')](_0x232973,[_0x33b0('0xb'),_0x33b0('0x22'),_0x33b0('0x23'),_0x33b0('0x24'),'mobile']);}utils[_0x33b0('0x25')](_0x1b454c,_0x232973,_0x42d0fd,_0x2b8512,_0x5e5a25);_0x192be9(null);};}; \ No newline at end of file +var _0x8500=['group','i.id','ids','tag','countFilteredInteractions','count','length','clause','order','forEach','contactName','DESC','closed','getFilteredInteractions','rows','catch','tracked','user','clone','html','phone','fax','mobile','updateUser','lodash','./sql-utils','./utils','findAll','resolve','getInteractionsQuery','then','search','parseAdvancedSearchFilter','where','body','default','having','tags','checkAccountsRestrictions'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x8500,0xb4));var _0x0850=function(_0x598de2,_0x557f98){_0x598de2=_0x598de2-0x0;var _0x3f2fc3=_0x8500[_0x598de2];return _0x3f2fc3;};'use strict';var _=require(_0x0850('0x0'));var sqlUtils=require(_0x0850('0x1'));var utils=require(_0x0850('0x2'));exports[_0x0850('0x3')]=function(_0x1029c2,_0x2ce055,_0x4eeb16,_0xf38f9f,_0x1e2d17){var _0x59c046={'count':0x0,'rows':[]};var _0xd4bb7a=sqlUtils['skipInteractionsQuery'](_0x1029c2,_0x4eeb16,_0x2ce055);if(_0xd4bb7a){return Promise[_0x0850('0x4')](_0x59c046);}var _0x5e3e19=sqlUtils[_0x0850('0x5')](_0x1029c2);var _0x1bda94={};return Promise[_0x0850('0x4')]()[_0x0850('0x6')](function(){if(_0x2ce055[_0x0850('0x7')]){return sqlUtils[_0x0850('0x8')](_0x2ce055[_0x0850('0x7')],_0x1e2d17);}else{return sqlUtils['parseQueryParameters'](_0x1029c2,_0x2ce055,_0x1e2d17);}})['then'](function(_0x91bace){_0x5e3e19[_0x0850('0x9')](_0x91bace[_0x0850('0xa')]);_0x5e3e19['where'](_0x91bace['contact']);_0x5e3e19['where'](_0x91bace[_0x0850('0xb')]);_0x5e3e19['where'](_0x91bace['fields']);_0x5e3e19[_0x0850('0x9')](_0x91bace['filter']);_0x5e3e19[_0x0850('0x9')](_0x91bace['user']);_0x5e3e19[_0x0850('0xc')](_0x91bace['read']);_0x1bda94=_0x91bace[_0x0850('0xd')];return sqlUtils[_0x0850('0xe')](_0x1029c2,_0x4eeb16,_0x2ce055);})[_0x0850('0x6')](function(_0x5f04ea){_0x5e3e19['where'](_0x5f04ea);_0x5e3e19[_0x0850('0xf')](_0x0850('0x10'));var _0x2cc74e=_0x2ce055[_0x0850('0x7')]?_0x1bda94[_0x0850('0x11')]:_0x2ce055[_0x0850('0x12')];return sqlUtils[_0x0850('0x13')](_0x5e3e19,_0x2cc74e);})['then'](function(_0x3ecaf5){_0x59c046[_0x0850('0x14')]=_0x3ecaf5[_0x0850('0x15')];if(_0x59c046['count']===0x0){return[];}_0x5e3e19[_0x0850('0xc')](_0x1bda94[_0x0850('0x16')]);if(_0xf38f9f[_0x0850('0x17')]){_0xf38f9f['order'][_0x0850('0x18')](function(_0x2b482f){var _0xcbe33c=_0x2b482f[0x0]===_0x0850('0x19')?_0x2b482f[0x0]:'i.'+_0x2b482f[0x0];_0x5e3e19[_0x0850('0x17')](_0xcbe33c,_0x2b482f[0x1]===_0x0850('0x1a')?![]:!![]);if(_0x2b482f[0x0]===_0x0850('0x1b')){var _0x2e513e=sqlUtils['getClosedOrderClause'](_0x1029c2,_0x2ce055);_0x5e3e19[_0x0850('0x17')](_0x2e513e,_0x2b482f[0x1]===_0x0850('0x1a')?![]:!![]);}});}return sqlUtils[_0x0850('0x1c')](_0x1029c2,_0x5e3e19,_0x2ce055,_0xf38f9f);})[_0x0850('0x6')](function(_0x386ab5){_0x59c046[_0x0850('0x1d')]=_0x386ab5;return _0x59c046;})[_0x0850('0x1e')](function(_0x43f6eb){throw _0x43f6eb;});};exports[_0x0850('0x1f')]=function(_0x1393ac,_0x402156){return function(_0x3dcb21,_0x1f24dc,_0x1cae65){var _0x5d3145=_0x3dcb21[_0x0850('0x20')];var _0x143ba4={};var _0x1a6542=_0x3dcb21['query'];if(_0x143ba4){_0x143ba4=_[_0x0850('0x21')](_0x3dcb21[_0x0850('0xa')]);_0x143ba4=_['omit'](_0x143ba4,[_0x0850('0xa'),_0x0850('0x22'),_0x0850('0x23'),_0x0850('0x24'),_0x0850('0x25')]);}utils[_0x0850('0x26')](_0x5d3145,_0x143ba4,_0x1a6542,_0x1393ac,_0x402156);_0x1cae65(null);};}; \ No newline at end of file diff --git a/server/components/interaction/sql-utils.js b/server/components/interaction/sql-utils.js index 1460033..771eb9e 100644 --- a/server/components/interaction/sql-utils.js +++ b/server/components/interaction/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b15=['i.ContactId','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','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','findOne','enableEmailPreview','all','clone','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','../../mysqldb','getAccountFK','agent','search','field','name','color','from','tools_tags','getInteractionFK','_interactions','select','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','map','getInteractionsTables','cm_contacts','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','openchannel','isEmail','mail','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','buildExpression','default','value','unreadMessages','read','and','Contact','operator','$substring','split','contact','find','ContactId','type','text','start','end','Tag','tags','clause','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','keys','\x20IN\x20?','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','tag','filter','get','capitalize','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','a.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.thirdDisposition','i.to'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x4b15,0x160));var _0x54b1=function(_0x428fef,_0x2becf0){_0x428fef=_0x428fef-0x0;var _0x1b5b0c=_0x4b15[_0x428fef];return _0x1b5b0c;};'use strict';var _=require(_0x54b1('0x0'));var squel=require(_0x54b1('0x1'));var as=require(_0x54b1('0x2'));var qs=require(_0x54b1('0x3'));var updateInteraction=require(_0x54b1('0x4'))[_0x54b1('0x5')];var utils=require('./utils');var db=require(_0x54b1('0x6'))['db'];function skipInteractionsQuery(_0x16a070,_0x328dff,_0x41f5cb){var _0x3ea640=![];var _0x5a97f6=utils[_0x54b1('0x7')](_0x16a070);if(_0x328dff['role']===_0x54b1('0x8')&&!_0x41f5cb[_0x54b1('0x9')]&&!_0x41f5cb[_0x5a97f6]){_0x3ea640=!![];}return _0x3ea640;}function getTagsQuery(){return squel['select']()[_0x54b1('0xa')]('id')['field'](_0x54b1('0xb'))['field'](_0x54b1('0xc'))[_0x54b1('0xd')](_0x54b1('0xe'));}function getUsersQuery(_0x701a0c,_0x5d2776){var _0x5d4f37=utils[_0x54b1('0xf')](_0x701a0c);var _0x2d9508='user_has_'+_0x701a0c+_0x54b1('0x10');var _0x297c9c=squel[_0x54b1('0x11')]()['field'](_0x54b1('0x12'))['field'](_0x54b1('0x13'))[_0x54b1('0xa')](_0x54b1('0x14')+_0x5d4f37)[_0x54b1('0xd')](_0x2d9508,'ui')[_0x54b1('0x15')](_0x54b1('0x16'),'u',_0x54b1('0x17'));if(_0x5d2776[_0x54b1('0x18')]>0x0){_0x297c9c[_0x54b1('0x19')](_0x54b1('0x14')+_0x5d4f37+'\x20IN\x20?',_[_0x54b1('0x1a')](_0x5d2776,'id'));}return _0x297c9c;}function getInteractionsQuery(_0x54feb3){var _0x482cd5=utils[_0x54b1('0x1b')](_0x54feb3);var _0x3e517b=utils[_0x54b1('0x7')](_0x54feb3);var _0xf3da4b=utils[_0x54b1('0xf')](_0x54feb3);return squel[_0x54b1('0x11')]()[_0x54b1('0xd')](_0x482cd5['interactions'],'i')[_0x54b1('0x15')](_0x54b1('0x1c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x54b1('0x15')](_0x54b1('0x16'),'o',_0x54b1('0x1d'))[_0x54b1('0x15')](_0x482cd5[_0x54b1('0x1e')],'a','a.id\x20=\x20i.'+_0x3e517b)[_0x54b1('0x15')](_0x482cd5['messages'],'me',_0x54b1('0x1f')+_0xf3da4b+_0x54b1('0x20'))[_0x54b1('0x15')](_0x482cd5[_0x54b1('0x21')],'it',_0x54b1('0x22')+_0xf3da4b+_0x54b1('0x20'))[_0x54b1('0x15')](_0x54b1('0xe'),'t',_0x54b1('0x23'));}function getSqlClauses(){var _0x53ad65={'body':squel[_0x54b1('0x24')](),'contact':squel[_0x54b1('0x24')](),'default':squel[_0x54b1('0x24')](),'fields':squel[_0x54b1('0x24')](),'filter':squel[_0x54b1('0x24')](),'read':squel[_0x54b1('0x24')](),'tags':{'clause':squel[_0x54b1('0x24')](),'ids':null},'user':squel[_0x54b1('0x24')]()};return _0x53ad65;}function parseTagParameter(_0x15a406){var _0x377925=squel[_0x54b1('0x24')]();if(_0x15a406){var _0x19be04=utils[_0x54b1('0x25')](_0x15a406);_0x19be04[_0x54b1('0x26')](function(_0x38faa5){_0x377925['or'](_0x54b1('0x27'),'%,'+_0x38faa5+',%');});}return _0x377925;}function parseReadParameter(_0x41c3d7){var _0x56ca11='';if(_0x41c3d7){_0x56ca11=_0x54b1('0x28');if(_0x41c3d7==='1'){_0x56ca11=_0x56ca11[_0x54b1('0x29')](_0x54b1('0x2a'),'=');}else{_0x56ca11=_0x56ca11[_0x54b1('0x29')](_0x54b1('0x2a'),'>');}}return _0x56ca11;}function parseSearchFilter(_0xc49998,_0x26876a){var _0x38f46e=squel[_0x54b1('0x24')]();if(_0x26876a){var _0x35f14d=_0x26876a[_0x54b1('0x29')]('\x5c','\x5c\x5c')[_0x54b1('0x29')](/'/g,'\x27\x27');var _0xd93cfe=qs['escapeLIKESpecialChars'](_0x35f14d);if(qs[_0x54b1('0x2b')](_0x35f14d)){_0x38f46e['or'](_0x54b1('0x2c'),_0xd93cfe+'%');if([_0x54b1('0x2d'),_0x54b1('0x2e')][_0x54b1('0x2f')](_0xc49998)){_0x38f46e['or'](_0x54b1('0x30'),_0xd93cfe+'%');}else if(_0xc49998===_0x54b1('0x31')){_0x38f46e['or']('i.fax\x20LIKE\x20?',_0xd93cfe+'%');}else if(_0xc49998===_0x54b1('0x32')){_0x38f46e['or']('i.from\x20LIKE\x20?',_0xd93cfe+'%');}}else if(_0xc49998==='mail'&&qs[_0x54b1('0x33')](_0x35f14d)){_0x38f46e['or']('c.email\x20LIKE\x20?',_0xd93cfe+'%');}else{if(_0xc49998===_0x54b1('0x34')){_0x38f46e['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x35f14d,!![]))['or'](_0x54b1('0x35'),qs[_0x54b1('0x36')](_0x35f14d));}else if(_0xc49998!==_0x54b1('0x31')){_0x38f46e['or'](_0x54b1('0x37'),qs['getFullTextValue'](_0x35f14d));}_0x38f46e['or'](_0x54b1('0x38'),qs[_0x54b1('0x36')](_0x35f14d,!![]),null);}}return _0x38f46e;}function parseAdvancedSearchFilter(_0x547db0,_0x526325){var _0xce1e09=getSqlClauses();var _0x1c8537=as[_0x54b1('0x39')](_0x547db0);var _0xa4dace=_0x1c8537[_0x54b1('0x3a')];for(var _0x236f89=0x0;_0x236f89<_0x1c8537[_0x54b1('0x3b')][_0x54b1('0x18')];_0x236f89++){var _0x532cd4=_0x1c8537[_0x54b1('0x3b')][_0x236f89];var _0x54a596='i';var _0x5069f7=_['find'](_0x526325,[_0x54b1('0xb'),_0x532cd4[_0x54b1('0xa')]]);if(_0x5069f7){var _0x22cbf9=as[_0x54b1('0x3c')](_0x54a596,_0x5069f7['type'],_0x532cd4);_0xce1e09[_0x54b1('0x3d')][_0xa4dace](_0x22cbf9['text'],_0x22cbf9[_0x54b1('0x3e')]['start'],_0x22cbf9[_0x54b1('0x3e')]['end']);}else{switch(_0x532cd4[_0x54b1('0xa')]){case _0x54b1('0x3f'):var _0x1718bb=parseReadParameter(_0x532cd4[_0x54b1('0x3e')]);_0xce1e09[_0x54b1('0x40')][_0x54b1('0x41')](_0x1718bb);break;case _0x54b1('0x42'):if(_0x532cd4[_0x54b1('0x43')]===_0x54b1('0x44')){if(_0x532cd4[_0x54b1('0x3e')][_0x54b1('0x45')]('\x20')[_0x54b1('0x18')]>0x1){_0xce1e09[_0x54b1('0x46')][_0xa4dace](_0x54b1('0x38'),qs[_0x54b1('0x36')](_0x532cd4['value'],!![]),null);}else{var _0x5b265a='%'+_0x532cd4['value']+'%';_0xce1e09[_0x54b1('0x46')][_0xa4dace]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5b265a,_0x5b265a,_0x5b265a);}}else{_0x5069f7=_[_0x54b1('0x47')](_0x526325,[_0x54b1('0xb'),_0x54b1('0x48')]);_0x532cd4['field']=_0x54b1('0x48');_0x22cbf9=as['buildExpression'](_0x54a596,_0x5069f7[_0x54b1('0x49')],_0x532cd4);_0xce1e09[_0x54b1('0x46')][_0xa4dace](_0x22cbf9[_0x54b1('0x4a')],_0x22cbf9['value'][_0x54b1('0x4b')],_0x22cbf9['value'][_0x54b1('0x4c')]);}break;case _0x54b1('0x4d'):var _0x456606=_0x532cd4[_0x54b1('0x3e')]['split'](',')[_0x54b1('0x1a')](function(_0x1cc88e){return Number(_0x1cc88e);});var _0x29e577=parseTagParameter(_0x456606);_0xce1e09[_0x54b1('0x4e')][_0x54b1('0x4f')][_0x54b1('0x41')](_0x29e577);_0xce1e09[_0x54b1('0x4e')][_0x54b1('0x50')]=_0x456606;break;case _0x54b1('0x51'):if(_0x532cd4[_0x54b1('0x43')]===_0x54b1('0x44')){_0xce1e09[_0x54b1('0x52')][_0xa4dace](_0x54b1('0x53'),'%'+_0x532cd4['value']+'%',null);}else{_0x5069f7=_[_0x54b1('0x47')](_0x526325,[_0x54b1('0xb'),_0x54b1('0x54')]);_0x532cd4[_0x54b1('0xa')]='UserId';_0x22cbf9=as[_0x54b1('0x3c')](_0x54a596,_0x5069f7['type'],_0x532cd4);_0xce1e09[_0x54b1('0x52')][_0xa4dace](_0x22cbf9['text'],_0x22cbf9[_0x54b1('0x3e')][_0x54b1('0x4b')],_0x22cbf9[_0x54b1('0x3e')][_0x54b1('0x4c')]);}break;case _0x54b1('0x55'):case _0x54b1('0x56'):_0x22cbf9=as[_0x54b1('0x3c')]('me',null,_0x532cd4);_0xce1e09[_0x54b1('0x55')][_0xa4dace](_0x22cbf9[_0x54b1('0x4a')],_0x22cbf9['value'][_0x54b1('0x4b')],_0x22cbf9['value'][_0x54b1('0x4c')]);break;}}}return _0xce1e09;}function parseModelFields(_0x398a6d,_0x4576c1,_0xfa9574){var _0x16b8a7=utils[_0x54b1('0x7')](_0x398a6d);var _0x5e4d1f=squel[_0x54b1('0x24')]();var _0x4f6b59=_(_0x4576c1)[_0x54b1('0x57')]()[_0x54b1('0x1a')](function(_0x197210){return _['some'](_0xfa9574,['name',_0x197210])?_0x197210:undefined;})['compact']()['value']();if(_0x4f6b59['length']>0x0){_0x4f6b59[_0x54b1('0x26')](function(_0x3448f6){if(_0x3448f6===_0x16b8a7){_0x5e4d1f['and']('i.'+_0x16b8a7+_0x54b1('0x58'),[]['concat'](_0x4576c1[_0x3448f6]));}else if(_0x3448f6==='createdAt'){var _0x1bf1f2=JSON[_0x54b1('0x59')](_0x4576c1[_0x3448f6])[_0x54b1('0x5a')];var _0x3de1ac=JSON[_0x54b1('0x59')](_0x4576c1[_0x3448f6])['$lte'];_0x5e4d1f[_0x54b1('0x41')](_0x54b1('0x5b'),_0x1bf1f2,_0x3de1ac);}else{if(_0x4576c1[_0x3448f6]===_0x54b1('0x5c')){_0x5e4d1f[_0x54b1('0x41')]('i.'+_0x3448f6+_0x54b1('0x5d'));}else{_0x5e4d1f[_0x54b1('0x41')]('i.'+_0x3448f6+_0x54b1('0x5e'),_0x4576c1[_0x3448f6]);}}});}return _0x5e4d1f;}function parseQueryParameters(_0xc1a820,_0x1583a6,_0x4e1ae3){var _0x16055e=getSqlClauses();return Promise[_0x54b1('0x5f')]()['then'](function(){return parseModelFields(_0xc1a820,_0x1583a6,_0x4e1ae3);})[_0x54b1('0x60')](function(_0x267b4f){_0x16055e['fields'][_0x54b1('0x41')](_0x267b4f);return parseReadParameter(_0x1583a6['read']);})[_0x54b1('0x60')](function(_0x4e1813){_0x16055e[_0x54b1('0x40')][_0x54b1('0x41')](_0x4e1813);return parseTagParameter(_0x1583a6[_0x54b1('0x61')]);})[_0x54b1('0x60')](function(_0x6914e9){_0x16055e[_0x54b1('0x4e')][_0x54b1('0x4f')][_0x54b1('0x41')](_0x6914e9);return parseSearchFilter(_0xc1a820,_0x1583a6[_0x54b1('0x62')]);})[_0x54b1('0x60')](function(_0x4b2dc0){_0x16055e['filter']=_0x4b2dc0;return _0x16055e;});}function checkAccountsRestrictions(_0x3da2e1,_0x3900fd,_0x8fec1d){var _0x41e572=utils[_0x54b1('0x7')](_0x3da2e1);var _0x489b06=_0x54b1('0x63')+_[_0x54b1('0x64')](_0x3da2e1)+(_0x3da2e1===_0x54b1('0x65')?_0x54b1('0x66'):_0x54b1('0x67'));var _0x40d5f4=squel['expr']();return Promise[_0x54b1('0x5f')]()[_0x54b1('0x60')](function(){if(_0x8fec1d[_0x54b1('0x9')]&&_0x3900fd[_0x54b1('0x68')]===_0x54b1('0x8')){return _0x3900fd[_0x489b06]({'attributes':['id'],'raw':!![]});}})[_0x54b1('0x60')](function(_0x5e6fd5){if(_0x5e6fd5){if(_0x5e6fd5[_0x54b1('0x18')]===0x0){_0x40d5f4[_0x54b1('0x41')]('i.'+_0x41e572+'\x20IS\x20NULL');}else{_0x40d5f4[_0x54b1('0x41')]('i.'+_0x41e572+_0x54b1('0x58'),_[_0x54b1('0x1a')](_0x5e6fd5,'id'));}}else if(!_0x8fec1d[_0x41e572]){_0x40d5f4[_0x54b1('0x41')]('i.'+_0x41e572+_0x54b1('0x69'));}})['then'](function(){return _0x40d5f4;});}function getClosedOrderClause(_0x5b2ed7,_0xf012c){var _0x25b65c='';var _0x6344bc=['i.thirdDisposition','i.secondDisposition',_0x54b1('0x6a')];if(_0x5b2ed7===_0x54b1('0x34')){_0x6344bc[_0x54b1('0x6b')](_0x54b1('0x6c'));}if(_0xf012c['closed']==='0'&&_0x5b2ed7===_0x54b1('0x34')){_0x25b65c=_0x54b1('0x6c');}else{if(_0xf012c[_0x54b1('0x6d')]==='1'){_0x6344bc['shift']();}_0x25b65c=_0x54b1('0x6e')+_0x6344bc[_0x54b1('0x6f')](',\x20')+')';}return _0x25b65c;}function getFilteredInteractions(_0x3959e0,_0x7d78b5,_0x43101e,_0x5661c7){var _0x1ea8f7=utils[_0x54b1('0xf')](_0x3959e0);var _0x141b30=_[_0x54b1('0x64')](_0x3959e0)+_0x54b1('0x70');var _0x4500b8=[];var _0x2d52e9=getTagsQuery();var _0x2114c4={'type':db[_0x54b1('0x71')][_0x54b1('0x72')][_0x54b1('0x73')],'raw':!![]};var _0x2dbace=[];var _0x142d74=[];return db['sequelize'][_0x54b1('0x74')](_0x2d52e9[_0x54b1('0x75')](),_0x2114c4)[_0x54b1('0x60')](function(_0x4a1479){_0x4500b8=_[_0x54b1('0x76')](_0x4a1479,'id');_0x2114c4=_[_0x54b1('0x77')](_0x2114c4,{'model':db[_0x141b30],'mapToModel':!![],'nest':!![]});if(_0x43101e['fields']){_0x5661c7[_0x54b1('0x78')][_0x54b1('0x26')](function(_0x96bc6d){_0x7d78b5[_0x54b1('0xa')]('i.'+_0x96bc6d);});}else{_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x79'),'unreadMessages');_0x7d78b5['field'](_0x54b1('0x7a'),'Account.key');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x7b'),'Account.mandatoryDisposition');if(_0x3959e0===_0x54b1('0x34')){_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x7c'),_0x54b1('0x7d'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x7e'),_0x54b1('0x7f'));_0x7d78b5['field']('i.id');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x80'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x81'));_0x7d78b5['field'](_0x54b1('0x82'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x83'));_0x7d78b5['field'](_0x54b1('0x84'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x85'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x86'));_0x7d78b5[_0x54b1('0xa')]('i.subject');_0x7d78b5[_0x54b1('0xa')]('i.disposition');_0x7d78b5[_0x54b1('0xa')]('i.secondDisposition');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x87'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x6c'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x88'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x89'));_0x7d78b5['field']('i.MailAccountId');_0x7d78b5[_0x54b1('0xa')]('i.UserId');}else if(_0x3959e0===_0x54b1('0x32')){_0x7d78b5['field'](_0x54b1('0x8a'),_0x54b1('0x7f'));}else{_0x7d78b5[_0x54b1('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',_0x54b1('0x7f'));}if(_0x3959e0!==_0x54b1('0x34')){_0x7d78b5[_0x54b1('0xa')]('i.*');}_0x7d78b5[_0x54b1('0xa')]('c.firstName',_0x54b1('0x8b'));_0x7d78b5['field'](_0x54b1('0x8c'),_0x54b1('0x8d'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x8e'),'Contact.email');_0x7d78b5[_0x54b1('0xa')]('c.phone',_0x54b1('0x8f'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x90'),_0x54b1('0x91'));_0x7d78b5['field']('c.fax',_0x54b1('0x92'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x93'),'Owner.fullname');_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x94'),_0x54b1('0x95'));_0x7d78b5[_0x54b1('0xa')](_0x54b1('0x96'),_0x54b1('0x97'));}if(_0x5661c7[_0x54b1('0x98')]){_0x7d78b5[_0x54b1('0x98')](_0x5661c7['limit']);}if(_0x5661c7[_0x54b1('0x99')]){_0x7d78b5[_0x54b1('0x99')](_0x5661c7[_0x54b1('0x99')]);}return db[_0x54b1('0x9a')][_0x54b1('0x74')](_0x7d78b5[_0x54b1('0x75')](),_0x2114c4);})['then'](function(_0xb68857){_0x2dbace=_0xb68857;var _0x1f9e12=getUsersQuery(_0x3959e0,_0x2dbace);return db[_0x54b1('0x9a')][_0x54b1('0x74')](_0x1f9e12[_0x54b1('0x75')](),_0x2114c4);})[_0x54b1('0x60')](function(_0x59bb07){_0x142d74=_[_0x54b1('0x9b')](_0x59bb07,_0x1ea8f7);if(_0x3959e0===_0x54b1('0x34')){return db['Setting'][_0x54b1('0x9c')]({'attributes':[_0x54b1('0x9d')],'raw':!![]});}})[_0x54b1('0x60')](function(_0x28158c){var _0x1c11c0=_0x28158c?_0x28158c['enableEmailPreview']:undefined;var _0x319b9a=_0x2dbace[_0x54b1('0x1a')](function(_0x195da8){return updateInteraction(_0x195da8,_0x4500b8,_0x142d74,_0x1c11c0);});return Promise[_0x54b1('0x9e')](_0x319b9a);});}function countFilteredInteractions(_0x14f411,_0x2995a7){var _0x214535=_0x14f411[_0x54b1('0x9f')]();_0x214535[_0x54b1('0xa')]('COUNT(*)');_0x214535['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x54b1('0x3f'));var _0x205084=utils[_0x54b1('0x25')](_0x2995a7);if(!_[_0x54b1('0xa0')](_0x205084)){_0x214535['where'](_0x54b1('0xa1'),_0x205084);}var _0x21398={'type':db[_0x54b1('0x71')][_0x54b1('0x72')][_0x54b1('0x73')],'raw':!![]};return db[_0x54b1('0x9a')][_0x54b1('0x74')](_0x214535[_0x54b1('0x75')](),_0x21398);}module[_0x54b1('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x6fa4=['length','where','\x20IN\x20?','getInteractionsTables','interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','\x20=\x20i.id','it.','expr','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.fax\x20LIKE\x20?','i.from\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','type','default','text','start','value','read','and','operator','$substring','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','end','Tag','split','map','tags','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','plainBody','some','concat','createdAt','$gte','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','resolve','fields','then','clause','filter','get','capitalize','chat','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','QueryTypes','SELECT','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','a.key','Account.key','a.mandatoryDisposition','a.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.updatedAt','i.closed','i.closedAt','i.lastMsgAt','i.lastMsgDirection','i.to','i.UserId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','o.internal','Owner.internal','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','getSelectedTags','isEmpty','t.id\x20IN\x20?','Sequelize','exports','lodash','squel','./update-interaction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','color','from','tools_tags','getInteractionFK','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId'];(function(_0x4d01c4,_0x4a9db1){var _0x57219d=function(_0x2d9dcb){while(--_0x2d9dcb){_0x4d01c4['push'](_0x4d01c4['shift']());}};_0x57219d(++_0x4a9db1);}(_0x6fa4,0x1dc));var _0x46fa=function(_0x47a397,_0x267dc6){_0x47a397=_0x47a397-0x0;var _0x36d592=_0x6fa4[_0x47a397];return _0x36d592;};'use strict';var _=require(_0x46fa('0x0'));var squel=require(_0x46fa('0x1'));var as=require('../parsers/advancedSearch');var qs=require('../parsers/qs');var updateInteraction=require(_0x46fa('0x2'))['updateInteraction'];var utils=require(_0x46fa('0x3'));var db=require(_0x46fa('0x4'))['db'];function skipInteractionsQuery(_0x9b7ce0,_0x824306,_0x38ce71){var _0x586cb8=![];var _0x3b2d5f=utils[_0x46fa('0x5')](_0x9b7ce0);if(_0x824306[_0x46fa('0x6')]===_0x46fa('0x7')&&!_0x38ce71[_0x46fa('0x8')]&&!_0x38ce71[_0x3b2d5f]){_0x586cb8=!![];}return _0x586cb8;}function getTagsQuery(){return squel[_0x46fa('0x9')]()[_0x46fa('0xa')]('id')['field'](_0x46fa('0xb'))[_0x46fa('0xa')](_0x46fa('0xc'))[_0x46fa('0xd')](_0x46fa('0xe'));}function getUsersQuery(_0x418c39,_0x3656f3){var _0x30802c=utils[_0x46fa('0xf')](_0x418c39);var _0x165469='user_has_'+_0x418c39+'_interactions';var _0x49f444=squel[_0x46fa('0x9')]()[_0x46fa('0xa')](_0x46fa('0x10'))[_0x46fa('0xa')](_0x46fa('0x11'))['field'](_0x46fa('0x12')+_0x30802c)[_0x46fa('0xd')](_0x165469,'ui')[_0x46fa('0x13')](_0x46fa('0x14'),'u',_0x46fa('0x15'));if(_0x3656f3[_0x46fa('0x16')]>0x0){_0x49f444[_0x46fa('0x17')](_0x46fa('0x12')+_0x30802c+_0x46fa('0x18'),_['map'](_0x3656f3,'id'));}return _0x49f444;}function getInteractionsQuery(_0x130aa9){var _0x1cf600=utils[_0x46fa('0x19')](_0x130aa9);var _0x1e1217=utils[_0x46fa('0x5')](_0x130aa9);var _0x3b50b8=utils[_0x46fa('0xf')](_0x130aa9);return squel[_0x46fa('0x9')]()[_0x46fa('0xd')](_0x1cf600[_0x46fa('0x1a')],'i')[_0x46fa('0x13')]('cm_contacts','c',_0x46fa('0x1b'))['left_join'](_0x46fa('0x14'),'o',_0x46fa('0x1c'))[_0x46fa('0x13')](_0x1cf600[_0x46fa('0x1d')],'a',_0x46fa('0x1e')+_0x1e1217)['left_join'](_0x1cf600[_0x46fa('0x1f')],'me','me.'+_0x3b50b8+_0x46fa('0x20'))[_0x46fa('0x13')](_0x1cf600['interactionsTags'],'it',_0x46fa('0x21')+_0x3b50b8+_0x46fa('0x20'))['left_join'](_0x46fa('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3e5343={'body':squel['expr'](),'contact':squel[_0x46fa('0x22')](),'default':squel['expr'](),'fields':squel[_0x46fa('0x22')](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x46fa('0x22')](),'ids':null},'user':squel[_0x46fa('0x22')]()};return _0x3e5343;}function parseTagParameter(_0x2f9ce1){var _0x3bfcb1=squel[_0x46fa('0x22')]();if(_0x2f9ce1){var _0x5a2dca=utils['getSelectedTags'](_0x2f9ce1);_0x5a2dca[_0x46fa('0x23')](function(_0x227be6){_0x3bfcb1['or'](_0x46fa('0x24'),'%,'+_0x227be6+',%');});}return _0x3bfcb1;}function parseReadParameter(_0xa7bc6f){var _0x25ad4e='';if(_0xa7bc6f){_0x25ad4e=_0x46fa('0x25');if(_0xa7bc6f==='1'){_0x25ad4e=_0x25ad4e[_0x46fa('0x26')](_0x46fa('0x27'),'=');}else{_0x25ad4e=_0x25ad4e[_0x46fa('0x26')](_0x46fa('0x27'),'>');}}return _0x25ad4e;}function parseSearchFilter(_0x339675,_0x1de6ae){var _0x38002d=squel[_0x46fa('0x22')]();if(_0x1de6ae){var _0x338aad=_0x1de6ae[_0x46fa('0x26')]('\x5c','\x5c\x5c')[_0x46fa('0x26')](/'/g,'\x27\x27');var _0x13eede=qs[_0x46fa('0x28')](_0x338aad);if(qs[_0x46fa('0x29')](_0x338aad)){_0x38002d['or'](_0x46fa('0x2a'),_0x13eede+'%');if([_0x46fa('0x2b'),_0x46fa('0x2c')][_0x46fa('0x2d')](_0x339675)){_0x38002d['or']('i.phone\x20LIKE\x20?',_0x13eede+'%');}else if(_0x339675==='fax'){_0x38002d['or'](_0x46fa('0x2e'),_0x13eede+'%');}else if(_0x339675==='openchannel'){_0x38002d['or'](_0x46fa('0x2f'),_0x13eede+'%');}}else if(_0x339675==='mail'&&qs[_0x46fa('0x30')](_0x338aad)){_0x38002d['or'](_0x46fa('0x31'),_0x13eede+'%');}else{if(_0x339675===_0x46fa('0x32')){_0x38002d['or'](_0x46fa('0x33'),qs['getFullTextValue'](_0x338aad,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x46fa('0x34')](_0x338aad));}else if(_0x339675!==_0x46fa('0x35')){_0x38002d['or'](_0x46fa('0x36'),qs['getFullTextValue'](_0x338aad));}_0x38002d['or'](_0x46fa('0x37'),qs[_0x46fa('0x34')](_0x338aad,!![]),null);}}return _0x38002d;}function parseAdvancedSearchFilter(_0x1d6721,_0x3ef32c){var _0x3eaed4=getSqlClauses();var _0x2f0a80=as['parseSearch'](_0x1d6721);var _0x573227=_0x2f0a80[_0x46fa('0x38')];for(var _0x3865f2=0x0;_0x3865f2<_0x2f0a80[_0x46fa('0x39')]['length'];_0x3865f2++){var _0x3a3cdc=_0x2f0a80[_0x46fa('0x39')][_0x3865f2];var _0xdba59='i';var _0x25e301=_[_0x46fa('0x3a')](_0x3ef32c,[_0x46fa('0xb'),_0x3a3cdc[_0x46fa('0xa')]]);if(_0x25e301){var _0x3a84bb=as[_0x46fa('0x3b')](_0xdba59,_0x25e301[_0x46fa('0x3c')],_0x3a3cdc);_0x3eaed4[_0x46fa('0x3d')][_0x573227](_0x3a84bb[_0x46fa('0x3e')],_0x3a84bb['value'][_0x46fa('0x3f')],_0x3a84bb[_0x46fa('0x40')]['end']);}else{switch(_0x3a3cdc['field']){case'unreadMessages':var _0x51c902=parseReadParameter(_0x3a3cdc['value']);_0x3eaed4[_0x46fa('0x41')][_0x46fa('0x42')](_0x51c902);break;case'Contact':if(_0x3a3cdc[_0x46fa('0x43')]===_0x46fa('0x44')){if(_0x3a3cdc[_0x46fa('0x40')]['split']('\x20')[_0x46fa('0x16')]>0x1){_0x3eaed4[_0x46fa('0x45')][_0x573227](_0x46fa('0x37'),qs[_0x46fa('0x34')](_0x3a3cdc['value'],!![]),null);}else{var _0x5008c7='%'+_0x3a3cdc['value']+'%';_0x3eaed4['contact'][_0x573227](_0x46fa('0x46'),_0x5008c7,_0x5008c7,_0x5008c7);}}else{_0x25e301=_[_0x46fa('0x3a')](_0x3ef32c,['name',_0x46fa('0x47')]);_0x3a3cdc['field']=_0x46fa('0x47');_0x3a84bb=as[_0x46fa('0x3b')](_0xdba59,_0x25e301[_0x46fa('0x3c')],_0x3a3cdc);_0x3eaed4['contact'][_0x573227](_0x3a84bb[_0x46fa('0x3e')],_0x3a84bb['value'][_0x46fa('0x3f')],_0x3a84bb[_0x46fa('0x40')][_0x46fa('0x48')]);}break;case _0x46fa('0x49'):var _0x3346a4=_0x3a3cdc[_0x46fa('0x40')][_0x46fa('0x4a')](',')[_0x46fa('0x4b')](function(_0x568549){return Number(_0x568549);});var _0x329a68=parseTagParameter(_0x3346a4);_0x3eaed4[_0x46fa('0x4c')]['clause'][_0x46fa('0x42')](_0x329a68);_0x3eaed4['tags'][_0x46fa('0x4d')]=_0x3346a4;break;case _0x46fa('0x4e'):if(_0x3a3cdc[_0x46fa('0x43')]===_0x46fa('0x44')){_0x3eaed4[_0x46fa('0x4f')][_0x573227](_0x46fa('0x50'),'%'+_0x3a3cdc['value']+'%',null);}else{_0x25e301=_[_0x46fa('0x3a')](_0x3ef32c,[_0x46fa('0xb'),_0x46fa('0x51')]);_0x3a3cdc[_0x46fa('0xa')]=_0x46fa('0x51');_0x3a84bb=as[_0x46fa('0x3b')](_0xdba59,_0x25e301[_0x46fa('0x3c')],_0x3a3cdc);_0x3eaed4[_0x46fa('0x4f')][_0x573227](_0x3a84bb['text'],_0x3a84bb[_0x46fa('0x40')][_0x46fa('0x3f')],_0x3a84bb[_0x46fa('0x40')][_0x46fa('0x48')]);}break;case _0x46fa('0x52'):case _0x46fa('0x53'):_0x3a84bb=as['buildExpression']('me',null,_0x3a3cdc);_0x3eaed4[_0x46fa('0x52')][_0x573227](_0x3a84bb[_0x46fa('0x3e')],_0x3a84bb['value'][_0x46fa('0x3f')],_0x3a84bb['value'][_0x46fa('0x48')]);break;}}}return _0x3eaed4;}function parseModelFields(_0x5edd3d,_0x557020,_0x256c05){var _0x3f757f=utils['getAccountFK'](_0x5edd3d);var _0x915a60=squel['expr']();var _0x2bb4ff=_(_0x557020)['keys']()[_0x46fa('0x4b')](function(_0x4e07e0){return _[_0x46fa('0x54')](_0x256c05,[_0x46fa('0xb'),_0x4e07e0])?_0x4e07e0:undefined;})['compact']()['value']();if(_0x2bb4ff[_0x46fa('0x16')]>0x0){_0x2bb4ff[_0x46fa('0x23')](function(_0x576ace){if(_0x576ace===_0x3f757f){_0x915a60[_0x46fa('0x42')]('i.'+_0x3f757f+_0x46fa('0x18'),[][_0x46fa('0x55')](_0x557020[_0x576ace]));}else if(_0x576ace===_0x46fa('0x56')){var _0x2bd0c7=JSON['parse'](_0x557020[_0x576ace])[_0x46fa('0x57')];var _0x4bca1b=JSON[_0x46fa('0x58')](_0x557020[_0x576ace])[_0x46fa('0x59')];_0x915a60[_0x46fa('0x42')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2bd0c7,_0x4bca1b);}else{if(_0x557020[_0x576ace]===_0x46fa('0x5a')){_0x915a60['and']('i.'+_0x576ace+_0x46fa('0x5b'));}else{_0x915a60[_0x46fa('0x42')]('i.'+_0x576ace+_0x46fa('0x5c'),_0x557020[_0x576ace]);}}});}return _0x915a60;}function parseQueryParameters(_0x11e9b0,_0x1cd2c4,_0x5a1d0f){var _0x217942=getSqlClauses();return Promise[_0x46fa('0x5d')]()['then'](function(){return parseModelFields(_0x11e9b0,_0x1cd2c4,_0x5a1d0f);})['then'](function(_0x5f1dbd){_0x217942[_0x46fa('0x5e')][_0x46fa('0x42')](_0x5f1dbd);return parseReadParameter(_0x1cd2c4[_0x46fa('0x41')]);})[_0x46fa('0x5f')](function(_0x575e9b){_0x217942['read'][_0x46fa('0x42')](_0x575e9b);return parseTagParameter(_0x1cd2c4['tag']);})[_0x46fa('0x5f')](function(_0x1e482d){_0x217942['tags'][_0x46fa('0x60')][_0x46fa('0x42')](_0x1e482d);return parseSearchFilter(_0x11e9b0,_0x1cd2c4[_0x46fa('0x61')]);})[_0x46fa('0x5f')](function(_0x8b5002){_0x217942['filter']=_0x8b5002;return _0x217942;});}function checkAccountsRestrictions(_0x297a28,_0x56f85e,_0x211a86){var _0x17213a=utils[_0x46fa('0x5')](_0x297a28);var _0x35578a=_0x46fa('0x62')+_[_0x46fa('0x63')](_0x297a28)+(_0x297a28===_0x46fa('0x64')?_0x46fa('0x65'):_0x46fa('0x66'));var _0x58f7f9=squel[_0x46fa('0x22')]();return Promise[_0x46fa('0x5d')]()[_0x46fa('0x5f')](function(){if(_0x211a86[_0x46fa('0x8')]&&_0x56f85e[_0x46fa('0x6')]===_0x46fa('0x7')){return _0x56f85e[_0x35578a]({'attributes':['id'],'raw':!![]});}})[_0x46fa('0x5f')](function(_0x4fff07){if(_0x4fff07){if(_0x4fff07[_0x46fa('0x16')]===0x0){_0x58f7f9[_0x46fa('0x42')]('i.'+_0x17213a+_0x46fa('0x5b'));}else{_0x58f7f9[_0x46fa('0x42')]('i.'+_0x17213a+_0x46fa('0x18'),_[_0x46fa('0x4b')](_0x4fff07,'id'));}}else if(!_0x211a86[_0x17213a]){_0x58f7f9[_0x46fa('0x42')]('i.'+_0x17213a+_0x46fa('0x67'));}})[_0x46fa('0x5f')](function(){return _0x58f7f9;});}function getClosedOrderClause(_0x166276,_0x9aa0b4){var _0x4277a0='';var _0xfd24fd=['i.thirdDisposition',_0x46fa('0x68'),_0x46fa('0x69')];if(_0x166276==='mail'){_0xfd24fd[_0x46fa('0x6a')](_0x46fa('0x6b'));}if(_0x9aa0b4[_0x46fa('0x6c')]==='0'&&_0x166276===_0x46fa('0x32')){_0x4277a0=_0x46fa('0x6b');}else{if(_0x9aa0b4[_0x46fa('0x6c')]==='1'){_0xfd24fd[_0x46fa('0x6d')]();}_0x4277a0=_0x46fa('0x6e')+_0xfd24fd[_0x46fa('0x6f')](',\x20')+')';}return _0x4277a0;}function getFilteredInteractions(_0x2b7d77,_0x8b880a,_0x4a0bed,_0x1cd2d5){var _0x41179d=utils[_0x46fa('0xf')](_0x2b7d77);var _0x52069f=_[_0x46fa('0x63')](_0x2b7d77)+_0x46fa('0x70');var _0x3d9491=[];var _0x3a4839=getTagsQuery();var _0x36fb2d={'type':db['Sequelize'][_0x46fa('0x71')][_0x46fa('0x72')],'raw':!![]};var _0x170b5b=[];var _0x547cb7=[];return db[_0x46fa('0x73')]['query'](_0x3a4839[_0x46fa('0x74')](),_0x36fb2d)['then'](function(_0xd29bfd){_0x3d9491=_[_0x46fa('0x75')](_0xd29bfd,'id');_0x36fb2d=_[_0x46fa('0x76')](_0x36fb2d,{'model':db[_0x52069f],'mapToModel':!![],'nest':!![]});if(_0x4a0bed[_0x46fa('0x5e')]){_0x1cd2d5['attributes'][_0x46fa('0x23')](function(_0x37923c){_0x8b880a[_0x46fa('0xa')]('i.'+_0x37923c);});}else{_0x8b880a[_0x46fa('0xa')](_0x46fa('0x77'),_0x46fa('0x78'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x79'),_0x46fa('0x7a'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x7b'),'Account.mandatoryDisposition');if(_0x2b7d77===_0x46fa('0x32')){_0x8b880a[_0x46fa('0xa')](_0x46fa('0x7c'),'Account.email');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x7d'),'contactName');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x7e'));_0x8b880a['field']('i.createdAt');_0x8b880a['field'](_0x46fa('0x7f'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x80'));_0x8b880a['field'](_0x46fa('0x81'));_0x8b880a[_0x46fa('0xa')]('i.attach');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x82'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x83'));_0x8b880a[_0x46fa('0xa')]('i.subject');_0x8b880a['field'](_0x46fa('0x69'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x68'));_0x8b880a['field']('i.thirdDisposition');_0x8b880a[_0x46fa('0xa')]('i.substatus');_0x8b880a['field'](_0x46fa('0x84'));_0x8b880a[_0x46fa('0xa')]('i.ContactId');_0x8b880a[_0x46fa('0xa')]('i.MailAccountId');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x85'));}else if(_0x2b7d77===_0x46fa('0x86')){_0x8b880a['field'](_0x46fa('0x87'),_0x46fa('0x88'));}else{_0x8b880a[_0x46fa('0xa')](_0x46fa('0x89'),_0x46fa('0x88'));}if(_0x2b7d77!=='mail'){_0x8b880a[_0x46fa('0xa')]('i.*');}_0x8b880a[_0x46fa('0xa')](_0x46fa('0x8a'),_0x46fa('0x8b'));_0x8b880a['field'](_0x46fa('0x8c'),'Contact.lastName');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x8d'),_0x46fa('0x8e'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x8f'),_0x46fa('0x90'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x91'),'Contact.mobile');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x92'),_0x46fa('0x93'));_0x8b880a[_0x46fa('0xa')](_0x46fa('0x94'),'Owner.fullname');_0x8b880a[_0x46fa('0xa')](_0x46fa('0x95'),_0x46fa('0x96'));_0x8b880a[_0x46fa('0xa')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x46fa('0x97'));}if(_0x1cd2d5['limit']){_0x8b880a['limit'](_0x1cd2d5[_0x46fa('0x98')]);}if(_0x1cd2d5[_0x46fa('0x99')]){_0x8b880a[_0x46fa('0x99')](_0x1cd2d5[_0x46fa('0x99')]);}return db[_0x46fa('0x73')][_0x46fa('0x9a')](_0x8b880a[_0x46fa('0x74')](),_0x36fb2d);})['then'](function(_0x57c5a4){_0x170b5b=_0x57c5a4;var _0x2b2db8=getUsersQuery(_0x2b7d77,_0x170b5b);return db['sequelize'][_0x46fa('0x9a')](_0x2b2db8[_0x46fa('0x74')](),_0x36fb2d);})[_0x46fa('0x5f')](function(_0x486b3d){_0x547cb7=_['groupBy'](_0x486b3d,_0x41179d);if(_0x2b7d77===_0x46fa('0x32')){return db[_0x46fa('0x9b')][_0x46fa('0x9c')]({'attributes':[_0x46fa('0x9d')],'raw':!![]});}})['then'](function(_0x1218e3){var _0x12a53d=_0x1218e3?_0x1218e3[_0x46fa('0x9d')]:undefined;var _0x28d82b=_0x170b5b[_0x46fa('0x4b')](function(_0x19bee1){return updateInteraction(_0x19bee1,_0x3d9491,_0x547cb7,_0x12a53d);});return Promise[_0x46fa('0x9e')](_0x28d82b);});}function countFilteredInteractions(_0xc6cede,_0x5c2fdf){var _0x22e35a=_0xc6cede[_0x46fa('0x9f')]();_0x22e35a[_0x46fa('0xa')](_0x46fa('0xa0'));_0x22e35a[_0x46fa('0xa')](_0x46fa('0x77'),_0x46fa('0x78'));var _0xf3e54d=utils[_0x46fa('0xa1')](_0x5c2fdf);if(!_[_0x46fa('0xa2')](_0xf3e54d)){_0x22e35a[_0x46fa('0x17')](_0x46fa('0xa3'),_0xf3e54d);}var _0x563b54={'type':db[_0x46fa('0xa4')][_0x46fa('0x71')][_0x46fa('0x72')],'raw':!![]};return db[_0x46fa('0x73')]['query'](_0x22e35a[_0x46fa('0x74')](),_0x563b54);}module[_0x46fa('0xa5')]={'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 341d0ab..ec53b9b 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 _0xc7b8=['answered','unmanaged','abandoned','closed','disposition','UserId','talking','total','MailMessage','findOne','out','plainBody','then','lastMsgText','trimStart','catch','Users','TagIds','../../mysqldb','map','split','push','waiting'];(function(_0x35c243,_0x5ace82){var _0x29a1f7=function(_0x188cc3){while(--_0x188cc3){_0x35c243['push'](_0x35c243['shift']());}};_0x29a1f7(++_0x5ace82);}(_0xc7b8,0xca));var _0x8c7b=function(_0x1970c8,_0x4d7336){_0x1970c8=_0x1970c8-0x0;var _0x4acaf6=_0xc7b8[_0x1970c8];return _0x4acaf6;};'use strict';var _=require('lodash');var db=require(_0x8c7b('0x0'))['db'];function getInteractionUsers(_0x6ca84c,_0x435179){return new Promise(function(_0x28654f,_0x48053f){try{var _0x18f08d=[];if(_0x435179[_0x6ca84c]){_0x18f08d=_0x435179[_0x6ca84c][_0x8c7b('0x1')](function(_0x217419){return{'id':_0x217419['id'],'fullname':_0x217419['fullname']};});}return _0x28654f(_0x18f08d);}catch(_0x68aaa2){_0x48053f(_0x68aaa2);}});}function getInteractionTags(_0x16d3ca,_0x4b7e86){var _0x235770=[];if(_0x16d3ca){_0x16d3ca[_0x8c7b('0x2')](',')['forEach'](function(_0x321f96){_0x235770[_0x8c7b('0x3')](_0x4b7e86[_0x321f96]);});}return _0x235770;}function updateWaitingCounter(_0x5a4618){if(_0x5a4618['waiting']){_0x5a4618[_0x8c7b('0x4')]-=0x1;}}function updateInteractionCounters(_0x4b4ef7){_0x4b4ef7[_0x8c7b('0x4')]=0x0;_0x4b4ef7['talking']=0x0;_0x4b4ef7[_0x8c7b('0x5')]=0x0;_0x4b4ef7[_0x8c7b('0x6')]=0x0;_0x4b4ef7[_0x8c7b('0x7')]=0x0;_0x4b4ef7['total']=0x0;if(_0x4b4ef7[_0x8c7b('0x8')]){if(_0x4b4ef7[_0x8c7b('0x9')]===_0x8c7b('0x7')){_0x4b4ef7[_0x8c7b('0x7')]+=0x1;updateWaitingCounter(_0x4b4ef7);}if(_0x4b4ef7[_0x8c7b('0xa')]){_0x4b4ef7['answered']+=0x1;if(_0x4b4ef7[_0x8c7b('0xb')]){_0x4b4ef7[_0x8c7b('0xb')]-=0x1;}}else{if(_0x4b4ef7[_0x8c7b('0x9')]){_0x4b4ef7[_0x8c7b('0x6')]+=0x1;updateWaitingCounter(_0x4b4ef7);}}}else{if(!_0x4b4ef7[_0x8c7b('0xa')]){_0x4b4ef7[_0x8c7b('0x4')]+=0x1;}if(_0x4b4ef7[_0x8c7b('0xa')]){_0x4b4ef7[_0x8c7b('0xb')]+=0x1;updateWaitingCounter(_0x4b4ef7);}}_0x4b4ef7[_0x8c7b('0xc')]+=0x1;return _0x4b4ef7;}function getLastMessageText(_0x30a81d){return db[_0x8c7b('0xd')][_0x8c7b('0xe')]({'where':{'$and':[{'MailInteractionId':_0x30a81d['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x8c7b('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x8c7b('0x10')],'order':'-id','raw':!![]})[_0x8c7b('0x11')](function(_0x39558e){if(_0x39558e&&_0x39558e[_0x8c7b('0x10')]){_0x30a81d[_0x8c7b('0x12')]=_[_0x8c7b('0x13')](_0x39558e[_0x8c7b('0x10')]);}return _0x30a81d;})[_0x8c7b('0x14')](function(_0x1598de){throw _0x1598de;});}exports['updateInteraction']=function(_0x57b015,_0x276409,_0x1f04dd,_0x315783){return new Promise(function(_0x28a3a8,_0x386ae1){return getInteractionUsers(_0x57b015['id'],_0x1f04dd)[_0x8c7b('0x11')](function(_0x148481){_0x57b015[_0x8c7b('0x15')]=_0x148481;return getInteractionTags(_0x57b015[_0x8c7b('0x16')],_0x276409);})[_0x8c7b('0x11')](function(_0x3fea84){_0x57b015['Tags']=_0x3fea84;delete _0x57b015[_0x8c7b('0x16')];return updateInteractionCounters(_0x57b015);})[_0x8c7b('0x11')](function(_0x408043){if(_0x315783){return getLastMessageText(_0x408043);}else{return _0x408043;}})[_0x8c7b('0x11')](function(_0x4b80e6){_0x28a3a8(_0x4b80e6);})[_0x8c7b('0x14')](function(_0x1a57c9){_0x386ae1(_0x1a57c9);});});}; \ No newline at end of file +var _0xa0ee=['push','waiting','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','trimStart','Users','TagIds','Tags','catch','split','forEach'];(function(_0x2e5405,_0x42ec09){var _0x2f0270=function(_0x70c5c8){while(--_0x70c5c8){_0x2e5405['push'](_0x2e5405['shift']());}};_0x2f0270(++_0x42ec09);}(_0xa0ee,0xee));var _0xea0e=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0xa0ee[_0x42d1f8];return _0x40d234;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x5881f8,_0x1e04ef){return new Promise(function(_0x108255,_0x2a16d9){try{var _0x3f702f=[];if(_0x1e04ef[_0x5881f8]){_0x3f702f=_0x1e04ef[_0x5881f8]['map'](function(_0x51dc47){return{'id':_0x51dc47['id'],'fullname':_0x51dc47['fullname']};});}return _0x108255(_0x3f702f);}catch(_0x6a31c){_0x2a16d9(_0x6a31c);}});}function getInteractionTags(_0x1854a3,_0x21c17f){var _0x334d97=[];if(_0x1854a3){_0x1854a3[_0xea0e('0x0')](',')[_0xea0e('0x1')](function(_0x318fce){_0x334d97[_0xea0e('0x2')](_0x21c17f[_0x318fce]);});}return _0x334d97;}function updateWaitingCounter(_0x3dcbc4){if(_0x3dcbc4[_0xea0e('0x3')]){_0x3dcbc4[_0xea0e('0x3')]-=0x1;}}function updateInteractionCounters(_0x54aa5f){_0x54aa5f[_0xea0e('0x3')]=0x0;_0x54aa5f[_0xea0e('0x4')]=0x0;_0x54aa5f[_0xea0e('0x5')]=0x0;_0x54aa5f['unmanaged']=0x0;_0x54aa5f[_0xea0e('0x6')]=0x0;_0x54aa5f[_0xea0e('0x7')]=0x0;if(_0x54aa5f[_0xea0e('0x8')]){if(_0x54aa5f[_0xea0e('0x9')]==='abandoned'){_0x54aa5f[_0xea0e('0x6')]+=0x1;updateWaitingCounter(_0x54aa5f);}if(_0x54aa5f[_0xea0e('0xa')]){_0x54aa5f[_0xea0e('0x5')]+=0x1;if(_0x54aa5f[_0xea0e('0x4')]){_0x54aa5f[_0xea0e('0x4')]-=0x1;}}else{if(_0x54aa5f['disposition']){_0x54aa5f[_0xea0e('0xb')]+=0x1;updateWaitingCounter(_0x54aa5f);}}}else{if(!_0x54aa5f[_0xea0e('0xa')]){_0x54aa5f[_0xea0e('0x3')]+=0x1;}if(_0x54aa5f[_0xea0e('0xa')]){_0x54aa5f[_0xea0e('0x4')]+=0x1;updateWaitingCounter(_0x54aa5f);}}_0x54aa5f[_0xea0e('0x7')]+=0x1;return _0x54aa5f;}function getLastMessageText(_0x34465a){return db[_0xea0e('0xc')][_0xea0e('0xd')]({'where':{'$and':[{'MailInteractionId':_0x34465a['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xea0e('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xea0e('0xf')],'order':_0xea0e('0x10'),'raw':!![]})[_0xea0e('0x11')](function(_0x4882e3){if(_0x4882e3&&_0x4882e3[_0xea0e('0xf')]){_0x34465a[_0xea0e('0x12')]=_[_0xea0e('0x13')](_0x4882e3[_0xea0e('0xf')]);}return _0x34465a;})['catch'](function(_0x191710){throw _0x191710;});}exports['updateInteraction']=function(_0x2ee420,_0x3ad9ff,_0x21e467,_0x2223ce){return new Promise(function(_0x2427c5,_0xf65efa){return getInteractionUsers(_0x2ee420['id'],_0x21e467)[_0xea0e('0x11')](function(_0x2174d2){_0x2ee420[_0xea0e('0x14')]=_0x2174d2;return getInteractionTags(_0x2ee420[_0xea0e('0x15')],_0x3ad9ff);})[_0xea0e('0x11')](function(_0x3bd5a3){_0x2ee420[_0xea0e('0x16')]=_0x3bd5a3;delete _0x2ee420[_0xea0e('0x15')];return updateInteractionCounters(_0x2ee420);})[_0xea0e('0x11')](function(_0x2347bf){if(_0x2223ce){return getLastMessageText(_0x2347bf);}else{return _0x2347bf;}})[_0xea0e('0x11')](function(_0x30ac72){_0x2427c5(_0x30ac72);})[_0xea0e('0x17')](function(_0x1d5785){_0xf65efa(_0x1d5785);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index f2a58fc..6e08a42 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 _0x6c30=['accounts','_interactions','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','null','Interaction','findOne','then','update','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','chat','Account','InteractionId','upperFirst','unknown'];(function(_0x29de36,_0x509410){var _0x4bd731=function(_0xcf9a0e){while(--_0xcf9a0e){_0x29de36['push'](_0x29de36['shift']());}};_0x4bd731(++_0x509410);}(_0x6c30,0x1e0));var _0x06c3=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x6c30[_0x209ec9];return _0x129b1b;};'use strict';var _=require(_0x06c3('0x0'));var db=require(_0x06c3('0x1'))['db'];var loggers={'openchannel':require(_0x06c3('0x2'))(_0x06c3('0x3')),'mail':require(_0x06c3('0x2'))('mail-interactions'),'fax':require('../../config/logger')(_0x06c3('0x4')),'sms':require('../../config/logger')(_0x06c3('0x5')),'chat':require('../../config/logger')(_0x06c3('0x6')),'whatsapp':require(_0x06c3('0x2'))('whatsapp-interactions')};function getAccountFK(_0x5186d5){return _[_0x06c3('0x7')](_0x5186d5)+(_0x5186d5===_0x06c3('0x8')?'Website':_0x06c3('0x9'))+'Id';}function getInteractionFK(_0x1d9d7b){return _[_0x06c3('0x7')](_0x1d9d7b)+_0x06c3('0xa');}function getInteractionId(_0x2fb19f,_0x20bb7a,_0x2a09e5){if(_0x2fb19f&&_0x2fb19f[_[_0x06c3('0xb')](_0x2a09e5)+'InteractionId']){return _0x2fb19f[_[_0x06c3('0xb')](_0x2a09e5)+_0x06c3('0xa')];}else if(_0x2fb19f&&_0x2fb19f['id']){return _0x2fb19f['id'];}else if(_0x20bb7a&&_0x20bb7a['id']){return _0x20bb7a['id'];}else{return _0x06c3('0xc');}}function getInteractionsTables(_0x4f673c){return{'accounts':_0x4f673c+'_'+(_0x4f673c===_0x06c3('0x8')?'websites':_0x06c3('0xd')),'interactions':_0x4f673c+_0x06c3('0xe'),'interactionsTags':_0x4f673c+'_interaction_has_tags','messages':_0x4f673c+_0x06c3('0xf'),'userInteractions':'user_has_'+_0x4f673c+_0x06c3('0xe')};}function getSelectedTags(_0x392ad7){var _0x10054b=[];if(_0x392ad7){_0x10054b=Array[_0x06c3('0x10')](_0x392ad7)?_0x392ad7:[_0x392ad7];}return _0x10054b;}function log(_0x47fa0c,_0x499905,_0xe291c2,_0x1f4567,_0x810583,_0x3430f7){loggers[_0x810583[_0x06c3('0x11')]()][_0x47fa0c](_0x06c3('0x12'),_0x3430f7['toUpperCase'](),_0x499905?_0x499905['id']:null,_0x499905?_0x499905[_0x06c3('0x13')]:null,_0x499905?_0x499905[_0x06c3('0x14')]:null,getInteractionId(_0xe291c2,_0x1f4567,_0x810583),_0xe291c2?JSON[_0x06c3('0x15')](_0xe291c2):_0x06c3('0x16'));}function updateUser(_0x5f21d3,_0x5df3c7,_0x1ba0b1,_0x3a2a8f,_0x2f086d){db[_[_0x06c3('0xb')](_0x3a2a8f)+_0x06c3('0x17')][_0x06c3('0x18')]({'where':{'id':getInteractionId(_0x5df3c7,_0x1ba0b1,_0x3a2a8f)}})[_0x06c3('0x19')](function(_0x10d57d){if(_0x10d57d){return _0x10d57d[_0x06c3('0x1a')]({'UserId':_0x5f21d3?_0x5f21d3['id']:null});}})[_0x06c3('0x19')](function(_0x451e80){if(_0x451e80){log('info',_0x5f21d3,_0x5df3c7,_0x1ba0b1,_0x3a2a8f,_0x2f086d);}})['catch'](function(){log(_0x06c3('0x1b'),_0x5f21d3,_0x5df3c7,_0x1ba0b1,_0x3a2a8f,_0x2f086d);});}module[_0x06c3('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x2f3a=['stringify','null','Interaction','findOne','then','update','info','catch','error','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','chat-interactions','whatsapp-interactions','chat','Account','capitalize','InteractionId','upperFirst','unknown','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name'];(function(_0xd25008,_0x2bfabf){var _0x282447=function(_0xb8fe0b){while(--_0xb8fe0b){_0xd25008['push'](_0xd25008['shift']());}};_0x282447(++_0x2bfabf);}(_0x2f3a,0xf1));var _0xa2f3=function(_0x1521e0,_0x68087b){_0x1521e0=_0x1521e0-0x0;var _0x3dfc85=_0x2f3a[_0x1521e0];return _0x3dfc85;};'use strict';var _=require(_0xa2f3('0x0'));var db=require(_0xa2f3('0x1'))['db'];var loggers={'openchannel':require(_0xa2f3('0x2'))(_0xa2f3('0x3')),'mail':require(_0xa2f3('0x2'))(_0xa2f3('0x4')),'fax':require(_0xa2f3('0x2'))(_0xa2f3('0x5')),'sms':require(_0xa2f3('0x2'))('sms-interactions'),'chat':require(_0xa2f3('0x2'))(_0xa2f3('0x6')),'whatsapp':require(_0xa2f3('0x2'))(_0xa2f3('0x7'))};function getAccountFK(_0xd11610){return _['capitalize'](_0xd11610)+(_0xd11610===_0xa2f3('0x8')?'Website':_0xa2f3('0x9'))+'Id';}function getInteractionFK(_0x4ddcb1){return _[_0xa2f3('0xa')](_0x4ddcb1)+_0xa2f3('0xb');}function getInteractionId(_0x20430f,_0x496d77,_0x1c169d){if(_0x20430f&&_0x20430f[_['upperFirst'](_0x1c169d)+_0xa2f3('0xb')]){return _0x20430f[_[_0xa2f3('0xc')](_0x1c169d)+'InteractionId'];}else if(_0x20430f&&_0x20430f['id']){return _0x20430f['id'];}else if(_0x496d77&&_0x496d77['id']){return _0x496d77['id'];}else{return _0xa2f3('0xd');}}function getInteractionsTables(_0x257d58){return{'accounts':_0x257d58+'_'+(_0x257d58===_0xa2f3('0x8')?_0xa2f3('0xe'):_0xa2f3('0xf')),'interactions':_0x257d58+_0xa2f3('0x10'),'interactionsTags':_0x257d58+_0xa2f3('0x11'),'messages':_0x257d58+_0xa2f3('0x12'),'userInteractions':_0xa2f3('0x13')+_0x257d58+_0xa2f3('0x10')};}function getSelectedTags(_0x436c4a){var _0x7b6a83=[];if(_0x436c4a){_0x7b6a83=Array[_0xa2f3('0x14')](_0x436c4a)?_0x436c4a:[_0x436c4a];}return _0x7b6a83;}function log(_0x5736b6,_0x25d9f7,_0x54ca71,_0x846e8b,_0x33586a,_0x4f3de9){loggers[_0x33586a['toLowerCase']()][_0x5736b6](_0xa2f3('0x15'),_0x4f3de9['toUpperCase'](),_0x25d9f7?_0x25d9f7['id']:null,_0x25d9f7?_0x25d9f7[_0xa2f3('0x16')]:null,_0x25d9f7?_0x25d9f7['role']:null,getInteractionId(_0x54ca71,_0x846e8b,_0x33586a),_0x54ca71?JSON[_0xa2f3('0x17')](_0x54ca71):_0xa2f3('0x18'));}function updateUser(_0x5ec6ec,_0x3ecde2,_0x3fbcf0,_0x1cbdf6,_0x465139){db[_[_0xa2f3('0xc')](_0x1cbdf6)+_0xa2f3('0x19')][_0xa2f3('0x1a')]({'where':{'id':getInteractionId(_0x3ecde2,_0x3fbcf0,_0x1cbdf6)}})[_0xa2f3('0x1b')](function(_0x264b59){if(_0x264b59){return _0x264b59[_0xa2f3('0x1c')]({'UserId':_0x5ec6ec?_0x5ec6ec['id']:null});}})[_0xa2f3('0x1b')](function(_0x23b895){if(_0x23b895){log(_0xa2f3('0x1d'),_0x5ec6ec,_0x3ecde2,_0x3fbcf0,_0x1cbdf6,_0x465139);}})[_0xa2f3('0x1e')](function(){log(_0xa2f3('0x1f'),_0x5ec6ec,_0x3ecde2,_0x3fbcf0,_0x1cbdf6,_0x465139);});}module[_0xa2f3('0x20')]={'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 7c3c03b..7766195 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 _0xe140=['parse','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','user','crypto','util','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','utf8','final'];(function(_0x4fb9ed,_0x187ea0){var _0x263645=function(_0x11c604){while(--_0x11c604){_0x4fb9ed['push'](_0x4fb9ed['shift']());}};_0x263645(++_0x187ea0);}(_0xe140,0x16a));var _0x0e14=function(_0x5a8c60,_0xb4aa8e){_0x5a8c60=_0x5a8c60-0x0;var _0xd4a567=_0xe140[_0x5a8c60];return _0xd4a567;};'use strict';var crypto=require(_0x0e14('0x0'));var util=require(_0x0e14('0x1'));var compose=require('composable-middleware');var db=require(_0x0e14('0x2'))['db'];var config=require(_0x0e14('0x3'));function getValueFromLicense(_0x2f4d6c,_0x24c7e4){if(_0x2f4d6c&&_0x24c7e4){if(_0x24c7e4[_0x0e14('0x4')]&&_0x24c7e4[_0x0e14('0x5')]){var _0x16a295=_0x24c7e4[_0x0e14('0x4')];var _0x11fb2e=_0x24c7e4[_0x0e14('0x5')];var _0x1c9ccd=_0x16a295[_0x0e14('0x6')]('-')[0x4];var _0x200441=_0x16a295['split']('-')[0x0];var _0x52efed=crypto['createDecipher'](_0x0e14('0x7'),util[_0x0e14('0x8')]('%s:%s:%s',_0x1c9ccd,_0x16a295,_0x200441));var _0x1680aa=_0x52efed[_0x0e14('0x9')](_0x11fb2e,_0x0e14('0xa'),_0x0e14('0xb'));_0x1680aa+=_0x52efed[_0x0e14('0xc')](_0x0e14('0xb'));var _0x2b1dda=JSON[_0x0e14('0xd')](_0x1680aa);return _0x2b1dda['hasOwnProperty'](_0x2f4d6c)?_0x2b1dda[_0x2f4d6c]:null;}}return null;}function isLimit(_0x4b26d6,_0xe7a9a,_0x524c84,_0x3a151c){var _0x208b00=_0xe7a9a;return compose()['use'](function(_0x1459cb,_0x558bdc,_0x313b5c){return db[_0x0e14('0xe')][_0x0e14('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x0e14('0x10')](function(_0x1e3998){var _0x5607b0=getValueFromLicense(_0x4b26d6,_0x1e3998);return _0x5607b0?_0x5607b0:_0x208b00;})[_0x0e14('0x10')](function(_0x50aeed){_0x208b00=_0x50aeed;return _0x524c84[_0x0e14('0x11')](_0x3a151c);})['then'](function(_0xcae2fc){if(_0xcae2fc>=_0x208b00){return _0x558bdc[_0x0e14('0x12')](0x193)[_0x0e14('0x13')]({'message':util[_0x0e14('0x8')](_0x0e14('0x14'),_0x4b26d6)});}_0x313b5c();})[_0x0e14('0x15')](function(_0x1bed7b){_0x313b5c(_0x1bed7b);});});}function isUserLimit(){return isLimit(_0x0e14('0x16'),0x1,db[_0x0e14('0x17')],{'where':{'$or':[{'role':'admin'},{'role':_0x0e14('0x18')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x5965=['split','aes-256-ctr','%s:%s:%s','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','format','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','crypto','util','composable-middleware','../../mysqldb','data1','license'];(function(_0x45d451,_0x40bc61){var _0x567998=function(_0x1725f6){while(--_0x1725f6){_0x45d451['push'](_0x45d451['shift']());}};_0x567998(++_0x40bc61);}(_0x5965,0xf6));var _0x5596=function(_0x4e9f74,_0x12b978){_0x4e9f74=_0x4e9f74-0x0;var _0x407917=_0x5965[_0x4e9f74];return _0x407917;};'use strict';var crypto=require(_0x5596('0x0'));var util=require(_0x5596('0x1'));var compose=require(_0x5596('0x2'));var db=require(_0x5596('0x3'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x15d59c,_0x414335){if(_0x15d59c&&_0x414335){if(_0x414335[_0x5596('0x4')]&&_0x414335[_0x5596('0x5')]){var _0x355383=_0x414335[_0x5596('0x4')];var _0xde3870=_0x414335[_0x5596('0x5')];var _0x1245b5=_0x355383[_0x5596('0x6')]('-')[0x4];var _0x373239=_0x355383[_0x5596('0x6')]('-')[0x0];var _0x56c9be=crypto['createDecipher'](_0x5596('0x7'),util['format'](_0x5596('0x8'),_0x1245b5,_0x355383,_0x373239));var _0x21a394=_0x56c9be['update'](_0xde3870,_0x5596('0x9'),_0x5596('0xa'));_0x21a394+=_0x56c9be[_0x5596('0xb')]('utf8');var _0x7e86fc=JSON[_0x5596('0xc')](_0x21a394);return _0x7e86fc[_0x5596('0xd')](_0x15d59c)?_0x7e86fc[_0x15d59c]:null;}}return null;}function isLimit(_0x2dcae4,_0x3e160e,_0x3e3616,_0x3548a9){var _0x16ba4a=_0x3e160e;return compose()[_0x5596('0xe')](function(_0x257aec,_0x35bcb8,_0x5353f0){return db[_0x5596('0xf')][_0x5596('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x5596('0x11')](function(_0x38e468){var _0x544638=getValueFromLicense(_0x2dcae4,_0x38e468);return _0x544638?_0x544638:_0x16ba4a;})['then'](function(_0x28c561){_0x16ba4a=_0x28c561;return _0x3e3616[_0x5596('0x12')](_0x3548a9);})[_0x5596('0x11')](function(_0x77b3ce){if(_0x77b3ce>=_0x16ba4a){return _0x35bcb8[_0x5596('0x13')](0x193)[_0x5596('0x14')]({'message':util[_0x5596('0x15')](_0x5596('0x16'),_0x2dcae4)});}_0x5353f0();})[_0x5596('0x17')](function(_0x2ac950){_0x5353f0(_0x2ac950);});});}function isUserLimit(){return isLimit(_0x5596('0x18'),0x1,db[_0x5596('0x19')],{'where':{'$or':[{'role':_0x5596('0x1a')},{'role':_0x5596('0x1b')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index c32d0bc..b52d4f2 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 _0x4bd9=['match','filter','conditions','push','DATE','operator','$eq','value','includes','$gt','add','days','YYYY-MM-DD','text','CAST(','field','\x20AS\x20','$ne','$notIn','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','$between','start','$endsWith','pop','utcOffset','format','hours','minutes','seconds','lodash','moment','startsWith','[$or]','and','replace','split','length','slice','forEach','shift'];(function(_0x4110b1,_0x1fd4c5){var _0x372a85=function(_0x3accf7){while(--_0x3accf7){_0x4110b1['push'](_0x4110b1['shift']());}};_0x372a85(++_0x1fd4c5);}(_0x4bd9,0x97));var _0x94bd=function(_0x4bc9c3,_0x2b4ee7){_0x4bc9c3=_0x4bc9c3-0x0;var _0x53dfb4=_0x4bd9[_0x4bc9c3];return _0x53dfb4;};'use strict';var _=require(_0x94bd('0x0'));var moment=require(_0x94bd('0x1'));exports['parseSearch']=function(_0x34bbfe){var _0x3dd7ef={'conditions':[]};_0x3dd7ef['sqlOperator']=_[_0x94bd('0x2')](_0x34bbfe,_0x94bd('0x3'))?'or':_0x94bd('0x4');var _0x138d66=_0x34bbfe[_0x94bd('0x5')]('[$and]','')[_0x94bd('0x5')]('[$or]','')[_0x94bd('0x6')]('||');for(var _0x540a4f=0x0;_0x540a4f<_0x138d66[_0x94bd('0x7')];_0x540a4f++){var _0x483695=_0x138d66[_0x540a4f][_0x94bd('0x6')](':=');var _0x2e1abf=_0x483695[0x0];var _0x10da6d=_0x483695[_0x94bd('0x8')](0x1);_0x10da6d[_0x94bd('0x9')](function(_0x264982){var _0x47ff2e=_0x264982[_0x94bd('0x6')]('[')[_0x94bd('0xa')]();var _0x185b4b=_0x264982[_0x94bd('0xb')](/\[(.*?)\]/g);_0x185b4b['forEach'](function(_0x5454b2){var _0x1436d3=_0x5454b2[_0x94bd('0x6')]('[')[_0x94bd('0xc')](function(_0x104e35){return _0x104e35['indexOf'](']')>-0x1;})['map'](function(_0x5ac3a3){return _0x5ac3a3[_0x94bd('0x6')](']')[0x0];})[0x0];_0x3dd7ef[_0x94bd('0xd')][_0x94bd('0xe')]({'field':_0x2e1abf,'operator':_0x47ff2e,'value':_0x1436d3});});});}return _0x3dd7ef;};exports['buildExpression']=function(_0x13a37b,_0x25577c,_0x2b8b8d){var _0x459b0a={};if(_0x25577c===_0x94bd('0xf')){if(_0x2b8b8d[_0x94bd('0x10')]===_0x94bd('0x11')){_0x2b8b8d[_0x94bd('0x10')]='$between';_0x2b8b8d[_0x94bd('0x12')]+=','+_0x2b8b8d[_0x94bd('0x12')];}else if(_[_0x94bd('0x13')]([_0x94bd('0x14'),'$lte'],_0x2b8b8d[_0x94bd('0x10')])){_0x2b8b8d['value']=moment(_0x2b8b8d['value'])[_0x94bd('0x15')](0x1,_0x94bd('0x16'))['format'](_0x94bd('0x17'));}}if(_0x2b8b8d['castTo']){_0x25577c=_0x2b8b8d['castTo'];_0x459b0a[_0x94bd('0x18')]=_0x94bd('0x19')+_0x13a37b+'.'+_0x2b8b8d[_0x94bd('0x1a')]+_0x94bd('0x1b')+_0x2b8b8d['castTo']+')\x20'+parseOperator(_0x2b8b8d[_0x94bd('0x10')]);}else{_0x459b0a[_0x94bd('0x18')]=_0x13a37b+'.'+_0x2b8b8d[_0x94bd('0x1a')]+'\x20'+parseOperator(_0x2b8b8d['operator']);}if(_[_0x94bd('0x13')]([_0x94bd('0x1c'),_0x94bd('0x1d')],_0x2b8b8d[_0x94bd('0x10')]))_0x459b0a[_0x94bd('0x18')]='('+_0x459b0a['text']+'\x20OR\x20'+_0x13a37b+'.'+_0x2b8b8d[_0x94bd('0x1a')]+_0x94bd('0x1e');_0x459b0a['value']=parseValue(_0x25577c,_0x2b8b8d['operator'],_0x2b8b8d[_0x94bd('0x12')]);return _0x459b0a;};function parseOperator(_0x18c188){var _0x30f37c;switch(_0x18c188){case _0x94bd('0x1f'):_0x30f37c=_0x94bd('0x20');break;case _0x94bd('0x1d'):_0x30f37c=_0x94bd('0x21');break;case _0x94bd('0x11'):_0x30f37c=_0x94bd('0x22');break;case'$ne':_0x30f37c=_0x94bd('0x23');break;case _0x94bd('0x24'):case _0x94bd('0x25'):case'$endsWith':_0x30f37c=_0x94bd('0x26');break;case _0x94bd('0x27'):_0x30f37c=_0x94bd('0x28');break;case _0x94bd('0x14'):_0x30f37c=_0x94bd('0x29');break;case'$lte':_0x30f37c=_0x94bd('0x2a');break;case _0x94bd('0x2b'):_0x30f37c=_0x94bd('0x2c');break;case _0x94bd('0x2d'):_0x30f37c='BETWEEN\x20?\x20AND\x20?';break;}return _0x30f37c;}function parseValue(_0x2ab6a4,_0x1176fd,_0x4de104){var _0x148dc8={'start':undefined,'end':undefined};switch(_0x1176fd){case'$in':case'$notIn':_0x148dc8[_0x94bd('0x2e')]=_0x4de104[_0x94bd('0x6')](',');break;case'$substring':_0x148dc8[_0x94bd('0x2e')]='%'+_0x4de104+'%';break;case _0x94bd('0x25'):_0x148dc8[_0x94bd('0x2e')]=_0x4de104+'%';break;case _0x94bd('0x2f'):_0x148dc8['start']='%'+_0x4de104;break;case'$between':var _0x23a1b4=_0x4de104['split'](',');var _0x4de104=_0x23a1b4['shift']();var _0x2403f0=_0x23a1b4[_0x94bd('0x30')]();if(_0x2ab6a4==='DATE'){_0x4de104=moment(_0x4de104)[_0x94bd('0x31')](0x0,!![])[_0x94bd('0x32')]();_0x2403f0=moment(_0x2403f0)['utcOffset'](0x0,!![])['add'](0x17,_0x94bd('0x33'))[_0x94bd('0x15')](0x3b,_0x94bd('0x34'))[_0x94bd('0x15')](0x3b,_0x94bd('0x35'))[_0x94bd('0x32')]();}_0x148dc8={'start':_0x4de104,'end':_0x2403f0};break;default:_0x148dc8[_0x94bd('0x2e')]=_0x4de104;break;}return _0x148dc8;} \ No newline at end of file +var _0x01fd=['text','\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','$ne','<>\x20?','$substring','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','shift','pop','utcOffset','hours','minutes','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','match','indexOf','map','conditions','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','field','\x20AS\x20','includes','$notIn'];(function(_0x3b304e,_0x3e0856){var _0x32ad81=function(_0xbc7b30){while(--_0xbc7b30){_0x3b304e['push'](_0x3b304e['shift']());}};_0x32ad81(++_0x3e0856);}(_0x01fd,0x8c));var _0xd01f=function(_0xe84805,_0x2702d9){_0xe84805=_0xe84805-0x0;var _0x398efd=_0x01fd[_0xe84805];return _0x398efd;};'use strict';var _=require(_0xd01f('0x0'));var moment=require(_0xd01f('0x1'));exports[_0xd01f('0x2')]=function(_0x4b9639){var _0x178164={'conditions':[]};_0x178164[_0xd01f('0x3')]=_[_0xd01f('0x4')](_0x4b9639,_0xd01f('0x5'))?'or':_0xd01f('0x6');var _0x18e212=_0x4b9639[_0xd01f('0x7')](_0xd01f('0x8'),'')[_0xd01f('0x7')](_0xd01f('0x5'),'')[_0xd01f('0x9')]('||');for(var _0x319021=0x0;_0x319021<_0x18e212[_0xd01f('0xa')];_0x319021++){var _0x5af18e=_0x18e212[_0x319021][_0xd01f('0x9')](':=');var _0x123533=_0x5af18e[0x0];var _0xb1be90=_0x5af18e[_0xd01f('0xb')](0x1);_0xb1be90[_0xd01f('0xc')](function(_0x4abfdc){var _0x21e658=_0x4abfdc[_0xd01f('0x9')]('[')['shift']();var _0x2cf0b0=_0x4abfdc[_0xd01f('0xd')](/\[(.*?)\]/g);_0x2cf0b0[_0xd01f('0xc')](function(_0x2b3eb4){var _0x2c3b67=_0x2b3eb4[_0xd01f('0x9')]('[')['filter'](function(_0x23e974){return _0x23e974[_0xd01f('0xe')](']')>-0x1;})[_0xd01f('0xf')](function(_0x22cf59){return _0x22cf59[_0xd01f('0x9')](']')[0x0];})[0x0];_0x178164[_0xd01f('0x10')]['push']({'field':_0x123533,'operator':_0x21e658,'value':_0x2c3b67});});});}return _0x178164;};exports[_0xd01f('0x11')]=function(_0x2ba6bd,_0x50c0aa,_0x45c2f5){var _0x3abade={};if(_0x50c0aa===_0xd01f('0x12')){if(_0x45c2f5[_0xd01f('0x13')]===_0xd01f('0x14')){_0x45c2f5[_0xd01f('0x13')]=_0xd01f('0x15');_0x45c2f5['value']+=','+_0x45c2f5[_0xd01f('0x16')];}else if(_['includes']([_0xd01f('0x17'),_0xd01f('0x18')],_0x45c2f5[_0xd01f('0x13')])){_0x45c2f5[_0xd01f('0x16')]=moment(_0x45c2f5[_0xd01f('0x16')])[_0xd01f('0x19')](0x1,_0xd01f('0x1a'))[_0xd01f('0x1b')](_0xd01f('0x1c'));}}if(_0x45c2f5[_0xd01f('0x1d')]){_0x50c0aa=_0x45c2f5['castTo'];_0x3abade['text']='CAST('+_0x2ba6bd+'.'+_0x45c2f5[_0xd01f('0x1e')]+_0xd01f('0x1f')+_0x45c2f5[_0xd01f('0x1d')]+')\x20'+parseOperator(_0x45c2f5['operator']);}else{_0x3abade['text']=_0x2ba6bd+'.'+_0x45c2f5[_0xd01f('0x1e')]+'\x20'+parseOperator(_0x45c2f5['operator']);}if(_[_0xd01f('0x20')](['$ne',_0xd01f('0x21')],_0x45c2f5[_0xd01f('0x13')]))_0x3abade[_0xd01f('0x22')]='('+_0x3abade['text']+_0xd01f('0x23')+_0x2ba6bd+'.'+_0x45c2f5[_0xd01f('0x1e')]+'\x20IS\x20NULL)';_0x3abade[_0xd01f('0x16')]=parseValue(_0x50c0aa,_0x45c2f5[_0xd01f('0x13')],_0x45c2f5[_0xd01f('0x16')]);return _0x3abade;};function parseOperator(_0xfcf862){var _0x3a2186;switch(_0xfcf862){case _0xd01f('0x24'):_0x3a2186=_0xd01f('0x25');break;case'$notIn':_0x3a2186=_0xd01f('0x26');break;case _0xd01f('0x14'):_0x3a2186='=\x20?';break;case _0xd01f('0x27'):_0x3a2186=_0xd01f('0x28');break;case _0xd01f('0x29'):case _0xd01f('0x2a'):case _0xd01f('0x2b'):_0x3a2186='LIKE\x20?';break;case _0xd01f('0x2c'):_0x3a2186=_0xd01f('0x2d');break;case _0xd01f('0x17'):_0x3a2186=_0xd01f('0x2e');break;case'$lte':_0x3a2186=_0xd01f('0x2f');break;case _0xd01f('0x30'):_0x3a2186=_0xd01f('0x31');break;case _0xd01f('0x15'):_0x3a2186=_0xd01f('0x32');break;}return _0x3a2186;}function parseValue(_0x25cdc0,_0x293a16,_0x310775){var _0x268cf2={'start':undefined,'end':undefined};switch(_0x293a16){case _0xd01f('0x24'):case'$notIn':_0x268cf2[_0xd01f('0x33')]=_0x310775['split'](',');break;case'$substring':_0x268cf2[_0xd01f('0x33')]='%'+_0x310775+'%';break;case _0xd01f('0x2a'):_0x268cf2[_0xd01f('0x33')]=_0x310775+'%';break;case'$endsWith':_0x268cf2[_0xd01f('0x33')]='%'+_0x310775;break;case'$between':var _0x4acfb2=_0x310775[_0xd01f('0x9')](',');var _0x310775=_0x4acfb2[_0xd01f('0x34')]();var _0x67803e=_0x4acfb2[_0xd01f('0x35')]();if(_0x25cdc0==='DATE'){_0x310775=moment(_0x310775)[_0xd01f('0x36')](0x0,!![])['format']();_0x67803e=moment(_0x67803e)[_0xd01f('0x36')](0x0,!![])['add'](0x17,_0xd01f('0x37'))[_0xd01f('0x19')](0x3b,_0xd01f('0x38'))[_0xd01f('0x19')](0x3b,_0xd01f('0x39'))['format']();}_0x268cf2={'start':_0x310775,'end':_0x67803e};break;default:_0x268cf2[_0xd01f('0x33')]=_0x310775;break;}return _0x268cf2;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index d20db18..2f26583 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 _0x6d71=['{EXPR}','trim','match','push','join','query','$id','intersection','attributes','nolimit','where','pick','filter','value','merge','VIRTUAL','lower','options','include','includeAll','lodash','moment','../../mysqldb','parse','includes','keys','model','fields','raw','split','filters','isEmpty','forOwn','type','DATE','isPlainObject','format','YYYY-MM-DD','utc','name','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','DESC','ASC','omit','isObject','isString','length','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22'];(function(_0x534c7a,_0x2d5c89){var _0xf5eb5f=function(_0x9fdd84){while(--_0x9fdd84){_0x534c7a['push'](_0x534c7a['shift']());}};_0xf5eb5f(++_0x2d5c89);}(_0x6d71,0xd4));var _0x16d7=function(_0x410256,_0x4cfe9f){_0x410256=_0x410256-0x0;var _0x18ce0f=_0x6d71[_0x410256];return _0x18ce0f;};'use strict';var _=require(_0x16d7('0x0'));var sequelize=require('sequelize');var moment=require(_0x16d7('0x1'));var db=require(_0x16d7('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x5e77da){var _0x37b2eb=['ne'];try{var _0x5dab2d=JSON[_0x16d7('0x3')](_0x5e77da);var _0x5b9170=Object['keys'](_0x5dab2d)[0x0];return _0x37b2eb[_0x16d7('0x4')](_0x5b9170);}catch(_0x2cf178){return![];}}function getOperatorValue(_0x59e516){var _0x1f06c0=JSON[_0x16d7('0x3')](_0x59e516);var _0x3fbc77=Object[_0x16d7('0x5')](_0x1f06c0)[0x0];var _0x4888fa=_0x1f06c0[_0x3fbc77];return{['$'+_0x3fbc77]:_0x4888fa};}function parseIncludeModel(_0x2efe5a){var _0x4c1500=JSON['parse'](_0x2efe5a);return{'model':db[_0x4c1500[_0x16d7('0x6')]],'as':_0x4c1500['alias'],'attributes':_0x4c1500[_0x16d7('0x7')],'raw':_0x4c1500[_0x16d7('0x8')]};}exports[_0x16d7('0x7')]=function(_0x2d3bc5){var _0x1b7167=null;if(_0x2d3bc5){_0x1b7167=_0x2d3bc5[_0x16d7('0x9')](',');}return _0x1b7167;};exports[_0x16d7('0xa')]=function(_0x4c1331,_0x1098dd){var _0x237f38={};if(!_[_0x16d7('0xb')](_0x4c1331)){_[_0x16d7('0xc')](_0x4c1331,function(_0x329fec,_0x3430fe){try{if(_0x1098dd){var _0x568cc0=_['find'](_0x1098dd,{'name':_0x3430fe})||{};if(hasSequelizeOperator(_0x329fec)){_0x237f38[_0x3430fe]=getOperatorValue(_0x329fec);}else if(_0x568cc0[_0x16d7('0xd')]===_0x16d7('0xe')&&_[_0x16d7('0xf')](_0x329fec)){var _0x28e21e=JSON[_0x16d7('0x3')](_0x329fec);var _0x3ca4ff={'$gte':moment(moment(_0x28e21e['$gte'])[_0x16d7('0x10')](_0x16d7('0x11')))['utc']()[_0x16d7('0x10')](),'$lte':moment(moment(_0x28e21e['$lte'])['format']('YYYY-MM-DD'))[_0x16d7('0x12')]()['subtract'](0x1,'s')[_0x16d7('0x10')]()};_0x237f38[_0x3430fe]=_0x3ca4ff;}else if(_0x568cc0[_0x16d7('0x13')]==='uniqueid'){_0x237f38[_0x3430fe]=_0x329fec;}else{_0x237f38[_0x3430fe]=_[_0x16d7('0x14')](_0x329fec)?_0x329fec:JSON[_0x16d7('0x3')](_0x329fec);}}else{_0x237f38[_0x3430fe]=_[_0x16d7('0x14')](_0x329fec)?_0x329fec:JSON[_0x16d7('0x3')](_0x329fec);}}catch(_0x1a3492){_0x237f38[_0x3430fe]=_0x329fec[_0x16d7('0x9')](',');}});}return _0x237f38;};exports[_0x16d7('0x15')]=function(_0x29f92b){_0x29f92b=parseInt(_0x29f92b,0xa);if(!_0x29f92b||_0x29f92b<0x0){_0x29f92b=LIMIT_VALUE;}return _0x29f92b;};exports[_0x16d7('0x16')]=function(_0x111c14){_0x111c14=parseInt(_0x111c14,0xa);if(!_0x111c14||_0x111c14<0x0){_0x111c14=0x0;}return _0x111c14;};exports[_0x16d7('0x17')]=function(_0x3d6271){var _0x17f093,_0x2679c3=null;if(_0x3d6271){_0x17f093=_0x3d6271[_0x16d7('0x9')](',');_0x2679c3=_[_0x16d7('0x18')](_0x17f093,function(_0x21d0f6){if(_0x21d0f6[_0x16d7('0x19')]('-')===0x0){return[_0x21d0f6===_0x16d7('0x1a')?sequelize[_0x16d7('0x1b')](sequelize[_0x16d7('0x1c')](_0x16d7('0x1a')),_0x16d7('0x1d')):_0x21d0f6[_0x16d7('0x1e')](0x1),_0x16d7('0x1f')];}else{return[_0x21d0f6===_0x16d7('0x1a')?sequelize[_0x16d7('0x1b')](sequelize['col']('priority'),_0x16d7('0x1d')):_0x21d0f6,_0x16d7('0x20')];}});}return _0x2679c3;};exports[_0x16d7('0x21')]=function(_0x1b8e5e,_0x5d466e){if(_[_0x16d7('0xb')](_0x1b8e5e)){return _0x1b8e5e;}if(_[_0x16d7('0x14')](_0x1b8e5e)){for(var _0x129c09=0x0;_0x129c09<_0x1b8e5e['length'];_0x129c09+=0x1){_0x1b8e5e[_0x129c09]=this['omit'](_0x1b8e5e[_0x129c09],_0x5d466e);}return _0x1b8e5e;}if(!_[_0x16d7('0x22')](_0x1b8e5e)){return _0x1b8e5e;}if(_[_0x16d7('0x23')](_0x5d466e)){_0x5d466e=[_0x5d466e];}if(!_[_0x16d7('0x14')](_0x5d466e)){return _0x1b8e5e;}for(var _0xbb7bf9=0x0;_0xbb7bf9<_0x5d466e[_0x16d7('0x24')];_0xbb7bf9+=0x1){_[_0x16d7('0x25')](_0x1b8e5e,_0x5d466e[_0xbb7bf9]);}for(var _0x54a065 in _0x1b8e5e){if(_0x1b8e5e[_0x16d7('0x26')](_0x54a065)){_0x1b8e5e[_0x54a065]=this[_0x16d7('0x21')](_0x1b8e5e[_0x54a065],_0x5d466e);}}return _0x1b8e5e;};exports[_0x16d7('0x27')]=function(_0x1d7395){return _0x1d7395['match'](RegExp(_0x16d7('0x28')))?!![]:![];};exports[_0x16d7('0x29')]=function(_0x63bf28){return _0x63bf28['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x16d7('0x2a')]=function(_0x4afce0,_0x3a9f39){var _0x4012ca=[];var _0x2d0e20=/([^:]")"+/g;var _0x2b5829=/[*<>~@-]/g;var _0x427dbb=/[ `!@#$%^&*()_\-?~<>]/;var _0x172ccd=/[ ,]+/;var _0x22354a=_0x3a9f39?_0x16d7('0x2b'):_0x16d7('0x2c');if(_0x3a9f39){_0x4afce0=_0x4afce0['replace'](_0x2b5829,'\x20')[_0x16d7('0x2d')]();}_0x4afce0['split'](_0x172ccd)['forEach'](function(_0x543724){_0x543724=_0x543724['replace'](_0x2d0e20,'$1');_0x543724='+'+_0x543724+'*';var _0x614339=_0x543724[_0x16d7('0x2e')](_0x427dbb);if(_0x614339){_0x543724='\x22'+_0x543724+'\x22';}_0x4012ca[_0x16d7('0x2f')](_0x543724);});_0x22354a=_0x22354a['replace'](_0x16d7('0x2c'),_0x4012ca[_0x16d7('0x30')]('\x20'));return _0x22354a;};exports['getOptions']=function(_0x28d01a,_0x275747,_0x1c7754){var _0x4123fa={},_0x4e8684={};if(_0x275747[_0x16d7('0x31')][_0x16d7('0x32')]){_0x275747[_0x16d7('0x31')]['id']=_0x275747[_0x16d7('0x31')][_0x16d7('0x32')];delete _0x275747['query'][_0x16d7('0x32')];}_0x4123fa[_0x16d7('0x6')]=_[_0x16d7('0x18')](_0x28d01a,_0x16d7('0x13'));_0x4123fa[_0x16d7('0x31')]=_[_0x16d7('0x5')](_0x275747[_0x16d7('0x31')]);_0x4123fa['filters']=_[_0x16d7('0x33')](_0x4123fa[_0x16d7('0x6')],_0x4123fa[_0x16d7('0x31')]);_0x4e8684['attributes']=_[_0x16d7('0x33')](_0x4123fa['model'],this[_0x16d7('0x7')](_0x275747[_0x16d7('0x31')][_0x16d7('0x7')]));_0x4e8684[_0x16d7('0x34')]=_0x4e8684[_0x16d7('0x34')][_0x16d7('0x24')]?_0x4e8684[_0x16d7('0x34')]:_0x4123fa['model'];if(!_0x275747[_0x16d7('0x31')]['hasOwnProperty'](_0x16d7('0x35'))){_0x4e8684[_0x16d7('0x15')]=this[_0x16d7('0x15')](_0x275747[_0x16d7('0x31')][_0x16d7('0x15')]);_0x4e8684[_0x16d7('0x16')]=this[_0x16d7('0x16')](_0x275747[_0x16d7('0x31')][_0x16d7('0x16')]);}_0x4e8684['order']=this[_0x16d7('0x17')](_0x275747[_0x16d7('0x31')][_0x16d7('0x17')]);_0x4e8684[_0x16d7('0x36')]=this['filters'](_[_0x16d7('0x37')](_0x275747[_0x16d7('0x31')],_0x4123fa[_0x16d7('0xa')]),_0x28d01a);if(_0x275747[_0x16d7('0x31')][_0x16d7('0x38')]){var _0x458765=_0x28d01a;var _0x2362f6=_0x275747[_0x16d7('0x31')][_0x16d7('0x38')];if(typeof _0x2362f6==='object'){_0x458765=_[_0x16d7('0x38')](_0x28d01a,function(_0x20a945){return _['includes'](_0x2362f6['columns'],_0x20a945['name']);});_0x2362f6=_0x2362f6[_0x16d7('0x39')];}_0x4e8684[_0x16d7('0x36')]=_[_0x16d7('0x3a')](_0x4e8684[_0x16d7('0x36')],{'$or':_['map'](_0x458765,function(_0x3db8ec){if(_0x3db8ec[_0x16d7('0xd')]!==_0x16d7('0x3b')){if(_0x1c7754){return sequelize[_0x16d7('0x36')](sequelize['fn'](_0x16d7('0x3c'),sequelize[_0x16d7('0x1c')](_0x3db8ec[_0x16d7('0x13')])),{'$like':sequelize['fn']('lower','%'+_0x275747['query'][_0x16d7('0x38')]+'%')});}else{var _0x273fe5={};_0x273fe5[_0x3db8ec[_0x16d7('0x13')]]={'$like':'%'+_0x275747[_0x16d7('0x31')]['filter']+'%'};return _0x273fe5;}}})});}_0x4e8684=_['merge']({},_0x4e8684,_0x275747[_0x16d7('0x3d')]);return _0x4e8684;};exports[_0x16d7('0x3e')]=function(_0x26629){var _0x1a6fcd=[];if(_0x26629[_0x16d7('0x3f')]){_0x1a6fcd[_0x16d7('0x2f')]({'all':!![]});}else if(_0x26629[_0x16d7('0x3e')]){if(Array[_0x16d7('0x14')](_0x26629[_0x16d7('0x3e')])){_0x1a6fcd=Object['keys'](_0x26629[_0x16d7('0x3e')])[_0x16d7('0x18')](function(_0x57271b){return parseIncludeModel(_0x26629[_0x16d7('0x3e')][_0x57271b]);});}else{var _0x3a475c=parseIncludeModel(_0x26629[_0x16d7('0x3e')]);_0x1a6fcd['push'](_0x3a475c);}}return _0x1a6fcd;};exports['escapeLIKESpecialChars']=function(_0x37634b){return _0x37634b['replace'](/[%_^-]/g,function(_0x4f0f78){return'\x5c'+_0x4f0f78;});}; \ No newline at end of file +var _0xbc26=['isArray','length','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','push','join','getOptions','$id','query','model','filters','attributes','intersection','nolimit','limit','sort','filter','columns','value','where','merge','VIRTUAL','lower','include','includeAll','escapeLIKESpecialChars','replace','sequelize','moment','../../mysqldb','parse','keys','includes','alias','fields','raw','split','isEmpty','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','uniqueid','offset','map','indexOf','cast','col','unsigned','substr','DESC','priority','omit'];(function(_0x43f374,_0x4e3410){var _0x513497=function(_0xd4d3ac){while(--_0xd4d3ac){_0x43f374['push'](_0x43f374['shift']());}};_0x513497(++_0x4e3410);}(_0xbc26,0xeb));var _0x6bc2=function(_0x424ec9,_0x209946){_0x424ec9=_0x424ec9-0x0;var _0x25f750=_0xbc26[_0x424ec9];return _0x25f750;};'use strict';var _=require('lodash');var sequelize=require(_0x6bc2('0x0'));var moment=require(_0x6bc2('0x1'));var db=require(_0x6bc2('0x2'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4a629e){var _0x5d73ae=['ne'];try{var _0x47a7af=JSON[_0x6bc2('0x3')](_0x4a629e);var _0x56735d=Object[_0x6bc2('0x4')](_0x47a7af)[0x0];return _0x5d73ae[_0x6bc2('0x5')](_0x56735d);}catch(_0x203d3a){return![];}}function getOperatorValue(_0x594fef){var _0x5ac803=JSON[_0x6bc2('0x3')](_0x594fef);var _0x4e0b33=Object[_0x6bc2('0x4')](_0x5ac803)[0x0];var _0x255a79=_0x5ac803[_0x4e0b33];return{['$'+_0x4e0b33]:_0x255a79};}function parseIncludeModel(_0x460d10){var _0x3200d9=JSON['parse'](_0x460d10);return{'model':db[_0x3200d9['model']],'as':_0x3200d9[_0x6bc2('0x6')],'attributes':_0x3200d9[_0x6bc2('0x7')],'raw':_0x3200d9[_0x6bc2('0x8')]};}exports[_0x6bc2('0x7')]=function(_0x1ca0b3){var _0x33d203=null;if(_0x1ca0b3){_0x33d203=_0x1ca0b3[_0x6bc2('0x9')](',');}return _0x33d203;};exports['filters']=function(_0x4e6a3a,_0x304294){var _0x541689={};if(!_[_0x6bc2('0xa')](_0x4e6a3a)){_['forOwn'](_0x4e6a3a,function(_0x260ac8,_0xa61646){try{if(_0x304294){var _0x320c02=_[_0x6bc2('0xb')](_0x304294,{'name':_0xa61646})||{};if(hasSequelizeOperator(_0x260ac8)){_0x541689[_0xa61646]=getOperatorValue(_0x260ac8);}else if(_0x320c02[_0x6bc2('0xc')]===_0x6bc2('0xd')&&_[_0x6bc2('0xe')](_0x260ac8)){var _0x4b5341=JSON['parse'](_0x260ac8);var _0x510a1d={'$gte':moment(moment(_0x4b5341[_0x6bc2('0xf')])[_0x6bc2('0x10')](_0x6bc2('0x11')))[_0x6bc2('0x12')]()[_0x6bc2('0x10')](),'$lte':moment(moment(_0x4b5341[_0x6bc2('0x13')])['format'](_0x6bc2('0x11')))[_0x6bc2('0x12')]()[_0x6bc2('0x14')](0x1,'s')[_0x6bc2('0x10')]()};_0x541689[_0xa61646]=_0x510a1d;}else if(_0x320c02[_0x6bc2('0x15')]===_0x6bc2('0x16')){_0x541689[_0xa61646]=_0x260ac8;}else{_0x541689[_0xa61646]=_['isArray'](_0x260ac8)?_0x260ac8:JSON[_0x6bc2('0x3')](_0x260ac8);}}else{_0x541689[_0xa61646]=_['isArray'](_0x260ac8)?_0x260ac8:JSON[_0x6bc2('0x3')](_0x260ac8);}}catch(_0x30fd38){_0x541689[_0xa61646]=_0x260ac8[_0x6bc2('0x9')](',');}});}return _0x541689;};exports['limit']=function(_0x10d57f){_0x10d57f=parseInt(_0x10d57f,0xa);if(!_0x10d57f||_0x10d57f<0x0){_0x10d57f=LIMIT_VALUE;}return _0x10d57f;};exports[_0x6bc2('0x17')]=function(_0x286896){_0x286896=parseInt(_0x286896,0xa);if(!_0x286896||_0x286896<0x0){_0x286896=0x0;}return _0x286896;};exports['sort']=function(_0x2207a1){var _0x127ec1,_0x4037c4=null;if(_0x2207a1){_0x127ec1=_0x2207a1['split'](',');_0x4037c4=_[_0x6bc2('0x18')](_0x127ec1,function(_0x147b33){if(_0x147b33[_0x6bc2('0x19')]('-')===0x0){return[_0x147b33==='priority'?sequelize[_0x6bc2('0x1a')](sequelize[_0x6bc2('0x1b')]('priority'),_0x6bc2('0x1c')):_0x147b33[_0x6bc2('0x1d')](0x1),_0x6bc2('0x1e')];}else{return[_0x147b33==='priority'?sequelize[_0x6bc2('0x1a')](sequelize[_0x6bc2('0x1b')](_0x6bc2('0x1f')),_0x6bc2('0x1c')):_0x147b33,'ASC'];}});}return _0x4037c4;};exports[_0x6bc2('0x20')]=function(_0x15031b,_0xb37b99){if(_['isEmpty'](_0x15031b)){return _0x15031b;}if(_[_0x6bc2('0x21')](_0x15031b)){for(var _0x235fff=0x0;_0x235fff<_0x15031b[_0x6bc2('0x22')];_0x235fff+=0x1){_0x15031b[_0x235fff]=this[_0x6bc2('0x20')](_0x15031b[_0x235fff],_0xb37b99);}return _0x15031b;}if(!_['isObject'](_0x15031b)){return _0x15031b;}if(_['isString'](_0xb37b99)){_0xb37b99=[_0xb37b99];}if(!_[_0x6bc2('0x21')](_0xb37b99)){return _0x15031b;}for(var _0x3e4f0b=0x0;_0x3e4f0b<_0xb37b99['length'];_0x3e4f0b+=0x1){_[_0x6bc2('0x23')](_0x15031b,_0xb37b99[_0x3e4f0b]);}for(var _0x204027 in _0x15031b){if(_0x15031b[_0x6bc2('0x24')](_0x204027)){_0x15031b[_0x204027]=this['omit'](_0x15031b[_0x204027],_0xb37b99);}}return _0x15031b;};exports[_0x6bc2('0x25')]=function(_0xbcff83){return _0xbcff83[_0x6bc2('0x26')](RegExp(_0x6bc2('0x27')))?!![]:![];};exports['isEmail']=function(_0x5cc6d4){return _0x5cc6d4[_0x6bc2('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0x6bc2('0x28')]=function(_0x11289e,_0x1340d1){var _0x1f9893=[];var _0x4ae594=/([^:]")"+/g;var _0x446ebd=/[*<>~@-]/g;var _0x436df2=/[ `!@#$%^&*()_\-?~<>]/;var _0x5e7937=/[ ,]+/;var _0x5b00e0=_0x1340d1?_0x6bc2('0x29'):_0x6bc2('0x2a');if(_0x1340d1){_0x11289e=_0x11289e['replace'](_0x446ebd,'\x20')['trim']();}_0x11289e[_0x6bc2('0x9')](_0x5e7937)[_0x6bc2('0x2b')](function(_0xd8ab89){_0xd8ab89=_0xd8ab89['replace'](_0x4ae594,'$1');_0xd8ab89='+'+_0xd8ab89+'*';var _0x760e2d=_0xd8ab89['match'](_0x436df2);if(_0x760e2d){_0xd8ab89='\x22'+_0xd8ab89+'\x22';}_0x1f9893[_0x6bc2('0x2c')](_0xd8ab89);});_0x5b00e0=_0x5b00e0['replace'](_0x6bc2('0x2a'),_0x1f9893[_0x6bc2('0x2d')]('\x20'));return _0x5b00e0;};exports[_0x6bc2('0x2e')]=function(_0x5571ba,_0x337e47,_0x55a92e){var _0x41bb1f={},_0x33176c={};if(_0x337e47['query'][_0x6bc2('0x2f')]){_0x337e47[_0x6bc2('0x30')]['id']=_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x2f')];delete _0x337e47[_0x6bc2('0x30')][_0x6bc2('0x2f')];}_0x41bb1f[_0x6bc2('0x31')]=_[_0x6bc2('0x18')](_0x5571ba,_0x6bc2('0x15'));_0x41bb1f[_0x6bc2('0x30')]=_[_0x6bc2('0x4')](_0x337e47[_0x6bc2('0x30')]);_0x41bb1f[_0x6bc2('0x32')]=_['intersection'](_0x41bb1f[_0x6bc2('0x31')],_0x41bb1f[_0x6bc2('0x30')]);_0x33176c[_0x6bc2('0x33')]=_[_0x6bc2('0x34')](_0x41bb1f[_0x6bc2('0x31')],this['fields'](_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x7')]));_0x33176c[_0x6bc2('0x33')]=_0x33176c['attributes'][_0x6bc2('0x22')]?_0x33176c[_0x6bc2('0x33')]:_0x41bb1f['model'];if(!_0x337e47[_0x6bc2('0x30')]['hasOwnProperty'](_0x6bc2('0x35'))){_0x33176c[_0x6bc2('0x36')]=this[_0x6bc2('0x36')](_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x36')]);_0x33176c[_0x6bc2('0x17')]=this[_0x6bc2('0x17')](_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x17')]);}_0x33176c['order']=this[_0x6bc2('0x37')](_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x37')]);_0x33176c['where']=this[_0x6bc2('0x32')](_['pick'](_0x337e47[_0x6bc2('0x30')],_0x41bb1f['filters']),_0x5571ba);if(_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x38')]){var _0x23394a=_0x5571ba;var _0x5c0212=_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x38')];if(typeof _0x5c0212==='object'){_0x23394a=_[_0x6bc2('0x38')](_0x5571ba,function(_0x298f27){return _[_0x6bc2('0x5')](_0x5c0212[_0x6bc2('0x39')],_0x298f27[_0x6bc2('0x15')]);});_0x5c0212=_0x5c0212[_0x6bc2('0x3a')];}_0x33176c[_0x6bc2('0x3b')]=_[_0x6bc2('0x3c')](_0x33176c['where'],{'$or':_['map'](_0x23394a,function(_0x58a70e){if(_0x58a70e[_0x6bc2('0xc')]!==_0x6bc2('0x3d')){if(_0x55a92e){return sequelize['where'](sequelize['fn'](_0x6bc2('0x3e'),sequelize['col'](_0x58a70e[_0x6bc2('0x15')])),{'$like':sequelize['fn'](_0x6bc2('0x3e'),'%'+_0x337e47['query'][_0x6bc2('0x38')]+'%')});}else{var _0x168ce0={};_0x168ce0[_0x58a70e[_0x6bc2('0x15')]]={'$like':'%'+_0x337e47[_0x6bc2('0x30')][_0x6bc2('0x38')]+'%'};return _0x168ce0;}}})});}_0x33176c=_[_0x6bc2('0x3c')]({},_0x33176c,_0x337e47['options']);return _0x33176c;};exports[_0x6bc2('0x3f')]=function(_0x54b112){var _0x4197a6=[];if(_0x54b112[_0x6bc2('0x40')]){_0x4197a6['push']({'all':!![]});}else if(_0x54b112['include']){if(Array[_0x6bc2('0x21')](_0x54b112[_0x6bc2('0x3f')])){_0x4197a6=Object['keys'](_0x54b112[_0x6bc2('0x3f')])[_0x6bc2('0x18')](function(_0x103c47){return parseIncludeModel(_0x54b112[_0x6bc2('0x3f')][_0x103c47]);});}else{var _0x2adbc3=parseIncludeModel(_0x54b112[_0x6bc2('0x3f')]);_0x4197a6[_0x6bc2('0x2c')](_0x2adbc3);}}return _0x4197a6;};exports[_0x6bc2('0x41')]=function(_0x2366ff){return _0x2366ff[_0x6bc2('0x42')](/[%_^-]/g,function(_0x4368e6){return'\x5c'+_0x4368e6;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index db06412..3996fcf 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 _0xaf60=['indexOf','sort','pauseType','toLowerCase','userpic','lastLoginAt','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','faxCurrentCapacity','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','pick','filterAgentAttributes','openchannelStatus','faxStatusTime','faxCapacity','smsCapacity','smsCurrentCapacity','whatsappCurrentCapacity','onhold','lodash','jayson/promise','../../mysqldb','client','chatPause','faxPause','mailPause','openchannelPause','smsPause','whatsappPause','every','filter','length','unknown','ringing','voiceStatus','idle','voicePause','pause','chatStatus','mailStatus','smsStatus','whatsappStatus','request','Agents','then','result','catch','*pause','busy','isArray','startCase','map','findOne','getAgents','flatten','uniq','value','includes','getAgentIdsByStatus','User','fullname','find','merge','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','internal','substring'];(function(_0x43cb5d,_0x5cb85c){var _0x21a488=function(_0x34f7ec){while(--_0x34f7ec){_0x43cb5d['push'](_0x43cb5d['shift']());}};_0x21a488(++_0x5cb85c);}(_0xaf60,0x82));var _0x0af6=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xaf60[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0af6('0x0'));var jayson=require(_0x0af6('0x1'));var db=require(_0x0af6('0x2'))['db'];var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x0af6('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x4e62b7,_0xbb4bdd){var _0x3e1023=[_0x4e62b7[_0x0af6('0x4')],_0x4e62b7[_0x0af6('0x5')],_0x4e62b7[_0x0af6('0x6')],_0x4e62b7[_0x0af6('0x7')],_0x4e62b7[_0x0af6('0x8')],_0x4e62b7['voicePause'],_0x4e62b7[_0x0af6('0x9')]];if(!_0xbb4bdd)return _[_0x0af6('0xa')](_0x3e1023);var _0x525bcc=_[_0x0af6('0xb')](_0x3e1023);return _0x525bcc[_0x0af6('0xc')]>0x0&&_0x525bcc[_0x0af6('0xc')]<_0x3e1023['length']?!![]:![];}function isIdle(_0x5f1492){return _0x5f1492==='idle'||_0x5f1492===_0x0af6('0xd')||_0x5f1492==='unavailable'||_0x5f1492===_0x0af6('0xe')||_['isNil'](_0x5f1492);}function isAgentIdle(_0x5d2b35){if(_0x5d2b35[_0x0af6('0xf')]!==_0x0af6('0x10')&&_0x5d2b35[_0x0af6('0x11')]){_0x5d2b35['voiceStatus']=_0x0af6('0x12');return![];}return _[_0x0af6('0xa')]([_0x5d2b35[_0x0af6('0x13')],_0x5d2b35['faxStatus'],_0x5d2b35[_0x0af6('0x14')],_0x5d2b35['openchannelStatus'],_0x5d2b35[_0x0af6('0x15')],_0x5d2b35['voiceStatus'],_0x5d2b35[_0x0af6('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x0af6('0x17')](_0x0af6('0x18'),{})[_0x0af6('0x19')](function(_0x53fb83){if(_0x53fb83['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x48051a=_0x53fb83['result'];return routingClient[_0x0af6('0x17')](_0x0af6('0x18'),{})[_0x0af6('0x19')](function(_0x2bd5c0){if(_0x2bd5c0['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x4bf9b8=_0x2bd5c0[_0x0af6('0x1a')];return _['merge']({},_0x48051a,_0x4bf9b8);});})[_0x0af6('0x1b')](function(_0xa1c5f6){throw _0xa1c5f6;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x1d6b30){var _0x340260=_0x0af6('0xd');if(isAgentPaused(_0x1d6b30))_0x340260='pause';else if(isAgentPaused(_0x1d6b30,!![]))_0x340260=_0x0af6('0x1c');else if(isAgentIdle(_0x1d6b30))_0x340260=_0x0af6('0x10');else _0x340260=_0x0af6('0x1d');return _0x340260;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x48a50f,_0x4adb2b){var _0xfd5351=_[_0x0af6('0x1e')](_0x48a50f)?_0x48a50f:[_0x48a50f];var _0x30c596=_[_0x0af6('0x1f')](_0x4adb2b)+'Queue';var _0x3aae56=_[_0x0af6('0x20')](_0xfd5351,function(_0x3fac44){return db[_0x30c596][_0x0af6('0x21')]({'where':{'id':_0x3fac44}})['then'](function(_0x37d0aa){if(!_0x37d0aa)return[];return _0x37d0aa[_0x0af6('0x22')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3aae56)[_0x0af6('0x19')](function(_0x49e4c8){var _0x5fbff4=_(_0x49e4c8)[_0x0af6('0x23')]()[_0x0af6('0x20')]('id')[_0x0af6('0x24')]()[_0x0af6('0x25')]();return _0x5fbff4;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4f16d5,_0x49a7be,_0x25e378){try{if(_0x49a7be[_0x0af6('0xc')]>0x0){_0x4f16d5=_0x4f16d5[_0x0af6('0xb')](function(_0x4da5d0){return _0x49a7be[_0x0af6('0x26')](_0x4da5d0['id']);});}var _0x29e57b=_0x4f16d5['filter'](function(_0x526998){var _0x47afe2=_0x0af6('0x1d');if(isAgentIdle(_0x526998)){_0x47afe2=_0x0af6('0x10');}return _0x47afe2===_0x25e378;});return _['map'](_0x29e57b,'id');}catch(_0x412388){throw _0x412388;}}exports[_0x0af6('0x27')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4673b8,_0x1dc221,_0x53ec8a){return Promise['resolve']()[_0x0af6('0x19')](function(){if(_0x1dc221[_0x0af6('0xc')]>0x0){_0x4673b8=_0x4673b8['filter'](function(_0x5d9dda){return _0x1dc221[_0x0af6('0x26')](_0x5d9dda['id']);});}return _0x4673b8;})[_0x0af6('0x19')](function(){return db[_0x0af6('0x28')]['findAll']({'attributes':['id','name',_0x0af6('0x29'),_0x0af6('0x4'),_0x0af6('0x5'),'mailPause',_0x0af6('0x7'),_0x0af6('0x8'),'voicePause','whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x0af6('0x20')](_0x4673b8,'id')}},'raw':!![]});})[_0x0af6('0x19')](function(_0x1b723e){return _0x1b723e[_0x0af6('0x20')](function(_0x218d02){var _0x5de5e5=_[_0x0af6('0x2a')](_0x4673b8,['id',_0x218d02['id']]);var _0x1a1f70=filterAgentAttributes(_0x5de5e5);_[_0x0af6('0x2b')](_0x218d02,_0x1a1f70);_0x218d02[_0x0af6('0x2c')]=getAgentStatus(_0x218d02);return _0x218d02;});})['then'](function(_0x396877){var _0x552282=sortAgentsByStatus(_0x396877,_0x53ec8a);return _[_0x0af6('0x20')](_0x552282,'id');})['catch'](function(_0x50cb22){throw _0x50cb22;});}exports[_0x0af6('0x2d')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x160e3b){var _0x174e83={'fields':[],'order':null};var _0x17caf4=_0x160e3b[_0x0af6('0x2e')](',');_0x174e83[_0x0af6('0x2f')]=_[_0x0af6('0xb')](_0x17caf4,function(_0x4e5a0b){if(!_0x4e5a0b[_0x0af6('0x26')](_0x0af6('0x2c'))){return!![];}_0x174e83[_0x0af6('0x30')]=_[_0x0af6('0x31')](_0x4e5a0b,'-')?_0x0af6('0x32'):_0x0af6('0x33');return![];});return _0x174e83;}exports[_0x0af6('0x34')]=getUpdatedSortOptions;function validateSortParameter(_0x133b43){if(!_0x133b43){_0x133b43=_0x0af6('0x35');}if(_0x133b43[_0x0af6('0x26')](_0x0af6('0x29'))&&!_0x133b43[_0x0af6('0x26')](_0x0af6('0x36'))){var _0x279e38=_0x133b43[_0x0af6('0x37')](0x0,_0x133b43[_0x0af6('0x38')](_0x0af6('0x29')));_0x133b43+=','+_0x279e38+_0x0af6('0x36');}return _0x133b43;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x4cf573,_0xbcb362){var _0xba11d6=_0x4cf573[_0x0af6('0x39')](function(_0x18b795,_0x3fceca){if(_0x18b795[_0x0af6('0x2c')]===_0x3fceca['globalStatus']){if(_0x18b795[_0x0af6('0x2c')]===_0x0af6('0x12')){if(_0xbcb362===_0x0af6('0x32')){return(_0x18b795['pauseType']||'')<(_0x3fceca[_0x0af6('0x3a')]||'')||_0x18b795[_0x0af6('0x29')][_0x0af6('0x3b')]()>_0x3fceca[_0x0af6('0x29')][_0x0af6('0x3b')]()?0x1:-0x1;}else{return(_0x18b795['pauseType']||'')<(_0x3fceca['pauseType']||'')||_0x18b795['fullname']['toLowerCase']()>_0x3fceca['fullname'][_0x0af6('0x3b')]()?-0x1:0x1;}}else{if(_0xbcb362===_0x0af6('0x32')){return _0x18b795[_0x0af6('0x29')][_0x0af6('0x3b')]()<_0x3fceca[_0x0af6('0x29')][_0x0af6('0x3b')]()?0x1:-0x1;}else{return _0x18b795[_0x0af6('0x29')][_0x0af6('0x3b')]()<_0x3fceca['fullname'][_0x0af6('0x3b')]()?-0x1:0x1;}}}else{if(_0xbcb362===_0x0af6('0x32')){return _0x18b795[_0x0af6('0x2c')]<_0x3fceca[_0x0af6('0x2c')]?0x1:-0x1;}else{return _0x18b795[_0x0af6('0x2c')]<_0x3fceca[_0x0af6('0x2c')]?-0x1:0x1;}}});return _0xba11d6;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x683464){var _0x317a12=[_0x0af6('0x3c'),'online',_0x0af6('0x3d'),_0x0af6('0x3e'),'pauseType',_0x0af6('0x3e'),'internal',_0x0af6('0x3f'),'chatPause',_0x0af6('0x7'),_0x0af6('0x6'),_0x0af6('0x8'),_0x0af6('0x9'),_0x0af6('0x5'),'voicePause',_0x0af6('0x40'),_0x0af6('0x41'),_0x0af6('0x42'),'smsCapacity',_0x0af6('0x43'),'faxCapacity',_0x0af6('0x44'),_0x0af6('0x45'),_0x0af6('0x46'),'smsCurrentCapacity','whatsappCurrentCapacity',_0x0af6('0x47'),'chatStatus','openchannelStatus',_0x0af6('0x14'),_0x0af6('0x15'),_0x0af6('0x16'),_0x0af6('0x48'),'voiceStatus',_0x0af6('0x49'),_0x0af6('0x4a'),_0x0af6('0x4b'),_0x0af6('0x4c'),_0x0af6('0x4d'),'faxStatusTime',_0x0af6('0x4e'),_0x0af6('0x4f'),'destconnectedlinenum',_0x0af6('0x50'),_0x0af6('0x51'),_0x0af6('0x52')];var _0x350e3a=[_0x0af6('0x4'),_0x0af6('0x7'),_0x0af6('0x6'),'smsPause',_0x0af6('0x9'),_0x0af6('0x5'),'voicePause',_0x0af6('0x53')];var _0x5d3f1a=_(_0x683464)['omit'](_0x350e3a)[_0x0af6('0x54')](_0x317a12)[_0x0af6('0x25')]();return _0x5d3f1a;}exports[_0x0af6('0x55')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name','fullname','role','internal','online','globalStatus',_0x0af6('0x3c'),_0x0af6('0x3d'),_0x0af6('0x3a'),_0x0af6('0x3e'),_0x0af6('0x5'),'chatPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause',_0x0af6('0x13'),'faxStatus','mailStatus',_0x0af6('0x56'),_0x0af6('0x15'),_0x0af6('0xf'),_0x0af6('0x16'),_0x0af6('0x49'),_0x0af6('0x57'),_0x0af6('0x4b'),'openchannelStatusTime','smsStatusTime','voiceStatusTime',_0x0af6('0x4d'),'chatCapacity',_0x0af6('0x58'),_0x0af6('0x42'),_0x0af6('0x41'),_0x0af6('0x59'),'whatsappCapacity',_0x0af6('0x44'),_0x0af6('0x47'),'mailCurrentCapacity','openchannelCurrentCapacity',_0x0af6('0x5a'),_0x0af6('0x5b'),_0x0af6('0x51'),_0x0af6('0x52'),'destconnectedlinenum',_0x0af6('0x5c'),'queue',_0x0af6('0x50')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xc0d7=['address','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','phoneBarEnableAutomaticScreenRecording','omit','pick','role','internal','chatStatus','mailStatusTime','mailCapacity','chatCurrentCapacity','phoneBarEnableScreenRecordingByAgent','onhold','screenrecording','getRealtimeAgentsQueryFields','client','http','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','ringing','isNil','voiceStatus','pause','every','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','getRealtimeAgents','unknown','*pause','isArray','startCase','Queue','map','flatten','uniq','value','includes','busy','getAgentIdsByStatus','fullname','mailPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','ASC','getUpdatedSortOptions','fullname,internal','indexOf','sort','DESC','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt'];(function(_0x38e6f6,_0x3453c7){var _0x14ece7=function(_0x26f3c2){while(--_0x26f3c2){_0x38e6f6['push'](_0x38e6f6['shift']());}};_0x14ece7(++_0x3453c7);}(_0xc0d7,0x7f));var _0x7c0d=function(_0x33d7a9,_0x378351){_0x33d7a9=_0x33d7a9-0x0;var _0x354454=_0xc0d7[_0x33d7a9];return _0x354454;};'use strict';var _=require('lodash');var jayson=require('jayson/promise');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x7c0d('0x0')][_0x7c0d('0x1')]({'port':0x232a});var routingClient=jayson[_0x7c0d('0x0')][_0x7c0d('0x1')]({'port':0x232c});function isAgentPaused(_0x2c03ef,_0x2e1cc8){var _0xfbd3c8=[_0x2c03ef[_0x7c0d('0x2')],_0x2c03ef[_0x7c0d('0x3')],_0x2c03ef['mailPause'],_0x2c03ef[_0x7c0d('0x4')],_0x2c03ef[_0x7c0d('0x5')],_0x2c03ef[_0x7c0d('0x6')],_0x2c03ef[_0x7c0d('0x7')]];if(!_0x2e1cc8)return _['every'](_0xfbd3c8);var _0x35c579=_[_0x7c0d('0x8')](_0xfbd3c8);return _0x35c579[_0x7c0d('0x9')]>0x0&&_0x35c579[_0x7c0d('0x9')]<_0xfbd3c8['length']?!![]:![];}function isIdle(_0x26be1d){return _0x26be1d===_0x7c0d('0xa')||_0x26be1d==='unknown'||_0x26be1d==='unavailable'||_0x26be1d===_0x7c0d('0xb')||_[_0x7c0d('0xc')](_0x26be1d);}function isAgentIdle(_0x496398){if(_0x496398[_0x7c0d('0xd')]!==_0x7c0d('0xa')&&_0x496398[_0x7c0d('0x6')]){_0x496398[_0x7c0d('0xd')]=_0x7c0d('0xe');return![];}return _[_0x7c0d('0xf')]([_0x496398['chatStatus'],_0x496398[_0x7c0d('0x10')],_0x496398[_0x7c0d('0x11')],_0x496398[_0x7c0d('0x12')],_0x496398[_0x7c0d('0x13')],_0x496398[_0x7c0d('0xd')],_0x496398[_0x7c0d('0x14')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x7c0d('0x15')](_0x7c0d('0x16'),{})['then'](function(_0x340937){if(_0x340937['error']){throw new Error(_0x7c0d('0x17'));}var _0x571480=_0x340937[_0x7c0d('0x18')];return routingClient[_0x7c0d('0x15')](_0x7c0d('0x16'),{})[_0x7c0d('0x19')](function(_0x2841e1){if(_0x2841e1[_0x7c0d('0x1a')]){throw new Error(_0x7c0d('0x1b'));}var _0x1fb052=_0x2841e1[_0x7c0d('0x18')];return _[_0x7c0d('0x1c')]({},_0x571480,_0x1fb052);});})[_0x7c0d('0x1d')](function(_0x2e3f30){throw _0x2e3f30;});}exports[_0x7c0d('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x265d48){var _0x407f52=_0x7c0d('0x1f');if(isAgentPaused(_0x265d48))_0x407f52=_0x7c0d('0xe');else if(isAgentPaused(_0x265d48,!![]))_0x407f52=_0x7c0d('0x20');else if(isAgentIdle(_0x265d48))_0x407f52=_0x7c0d('0xa');else _0x407f52='busy';return _0x407f52;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x5dae80,_0x54b14f){var _0x5872fe=_[_0x7c0d('0x21')](_0x5dae80)?_0x5dae80:[_0x5dae80];var _0x2997a7=_[_0x7c0d('0x22')](_0x54b14f)+_0x7c0d('0x23');var _0x1ef191=_[_0x7c0d('0x24')](_0x5872fe,function(_0x360c67){return db[_0x2997a7]['findOne']({'where':{'id':_0x360c67}})[_0x7c0d('0x19')](function(_0xb7d5e4){if(!_0xb7d5e4)return[];return _0xb7d5e4['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x1ef191)[_0x7c0d('0x19')](function(_0x5a0d69){var _0x236973=_(_0x5a0d69)[_0x7c0d('0x25')]()[_0x7c0d('0x24')]('id')[_0x7c0d('0x26')]()[_0x7c0d('0x27')]();return _0x236973;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x27fc36,_0x197530,_0x36a264){try{if(_0x197530[_0x7c0d('0x9')]>0x0){_0x27fc36=_0x27fc36[_0x7c0d('0x8')](function(_0x4aea76){return _0x197530[_0x7c0d('0x28')](_0x4aea76['id']);});}var _0x553627=_0x27fc36[_0x7c0d('0x8')](function(_0x1d2020){var _0x15569b=_0x7c0d('0x29');if(isAgentIdle(_0x1d2020)){_0x15569b=_0x7c0d('0xa');}return _0x15569b===_0x36a264;});return _[_0x7c0d('0x24')](_0x553627,'id');}catch(_0x4f66ef){throw _0x4f66ef;}}exports[_0x7c0d('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x5dbfe1,_0x368e6f,_0x3aaf9d){return Promise['resolve']()['then'](function(){if(_0x368e6f[_0x7c0d('0x9')]>0x0){_0x5dbfe1=_0x5dbfe1['filter'](function(_0x453b8f){return _0x368e6f[_0x7c0d('0x28')](_0x453b8f['id']);});}return _0x5dbfe1;})['then'](function(){return db['User']['findAll']({'attributes':['id','name',_0x7c0d('0x2b'),'chatPause',_0x7c0d('0x3'),_0x7c0d('0x2c'),'openchannelPause',_0x7c0d('0x5'),_0x7c0d('0x6'),_0x7c0d('0x7'),_0x7c0d('0x2d')],'where':{'id':{'$in':_['map'](_0x5dbfe1,'id')}},'raw':!![]});})[_0x7c0d('0x19')](function(_0x3c1f76){return _0x3c1f76[_0x7c0d('0x24')](function(_0xcbcc){var _0x20cbc1=_[_0x7c0d('0x2e')](_0x5dbfe1,['id',_0xcbcc['id']]);var _0x34c2d0=filterAgentAttributes(_0x20cbc1);_[_0x7c0d('0x1c')](_0xcbcc,_0x34c2d0);_0xcbcc[_0x7c0d('0x2f')]=getAgentStatus(_0xcbcc);return _0xcbcc;});})[_0x7c0d('0x19')](function(_0x4c1d20){var _0x692e16=sortAgentsByStatus(_0x4c1d20,_0x3aaf9d);return _[_0x7c0d('0x24')](_0x692e16,'id');})['catch'](function(_0x3ff97b){throw _0x3ff97b;});}exports[_0x7c0d('0x30')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x35f3c3){var _0x1b723b={'fields':[],'order':null};var _0x304606=_0x35f3c3[_0x7c0d('0x31')](',');_0x1b723b['fields']=_[_0x7c0d('0x8')](_0x304606,function(_0x169eff){if(!_0x169eff[_0x7c0d('0x28')](_0x7c0d('0x2f'))){return!![];}_0x1b723b[_0x7c0d('0x32')]=_['startsWith'](_0x169eff,'-')?'DESC':_0x7c0d('0x33');return![];});return _0x1b723b;}exports[_0x7c0d('0x34')]=getUpdatedSortOptions;function validateSortParameter(_0x5c85b6){if(!_0x5c85b6){_0x5c85b6=_0x7c0d('0x35');}if(_0x5c85b6['includes'](_0x7c0d('0x2b'))&&!_0x5c85b6[_0x7c0d('0x28')]('internal')){var _0x33ac68=_0x5c85b6['substring'](0x0,_0x5c85b6[_0x7c0d('0x36')](_0x7c0d('0x2b')));_0x5c85b6+=','+_0x33ac68+'internal';}return _0x5c85b6;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x5ca209,_0x150877){var _0x1acba0=_0x5ca209[_0x7c0d('0x37')](function(_0x1a08e6,_0x5dc200){if(_0x1a08e6['globalStatus']===_0x5dc200[_0x7c0d('0x2f')]){if(_0x1a08e6['globalStatus']==='pause'){if(_0x150877===_0x7c0d('0x38')){return(_0x1a08e6['pauseType']||'')<(_0x5dc200[_0x7c0d('0x2d')]||'')||_0x1a08e6[_0x7c0d('0x2b')]['toLowerCase']()>_0x5dc200[_0x7c0d('0x2b')][_0x7c0d('0x39')]()?0x1:-0x1;}else{return(_0x1a08e6[_0x7c0d('0x2d')]||'')<(_0x5dc200[_0x7c0d('0x2d')]||'')||_0x1a08e6[_0x7c0d('0x2b')]['toLowerCase']()>_0x5dc200[_0x7c0d('0x2b')][_0x7c0d('0x39')]()?-0x1:0x1;}}else{if(_0x150877==='DESC'){return _0x1a08e6[_0x7c0d('0x2b')][_0x7c0d('0x39')]()<_0x5dc200[_0x7c0d('0x2b')][_0x7c0d('0x39')]()?0x1:-0x1;}else{return _0x1a08e6['fullname'][_0x7c0d('0x39')]()<_0x5dc200[_0x7c0d('0x2b')][_0x7c0d('0x39')]()?-0x1:0x1;}}}else{if(_0x150877===_0x7c0d('0x38')){return _0x1a08e6[_0x7c0d('0x2f')]<_0x5dc200['globalStatus']?0x1:-0x1;}else{return _0x1a08e6[_0x7c0d('0x2f')]<_0x5dc200['globalStatus']?-0x1:0x1;}}});return _0x1acba0;}exports[_0x7c0d('0x3a')]=sortAgentsByStatus;function filterAgentAttributes(_0x50d6be){var _0x2e289d=[_0x7c0d('0x3b'),_0x7c0d('0x3c'),_0x7c0d('0x3d'),_0x7c0d('0x3e'),'pauseType',_0x7c0d('0x3e'),'internal',_0x7c0d('0x3f'),_0x7c0d('0x2'),_0x7c0d('0x4'),'mailPause',_0x7c0d('0x5'),'whatsappPause','faxPause',_0x7c0d('0x6'),_0x7c0d('0x40'),_0x7c0d('0x41'),'mailCapacity',_0x7c0d('0x42'),_0x7c0d('0x43'),_0x7c0d('0x44'),'chatCurrentCapacity',_0x7c0d('0x45'),_0x7c0d('0x46'),_0x7c0d('0x47'),_0x7c0d('0x48'),_0x7c0d('0x49'),'chatStatus','openchannelStatus',_0x7c0d('0x11'),_0x7c0d('0x13'),'whatsappStatus','faxStatus',_0x7c0d('0xd'),_0x7c0d('0x4a'),_0x7c0d('0x4b'),'mailStatusTime',_0x7c0d('0x4c'),_0x7c0d('0x4d'),_0x7c0d('0x4e'),_0x7c0d('0x4f'),_0x7c0d('0x50'),_0x7c0d('0x51'),'screenrecording','phoneBarEnableScreenRecordingByAgent',_0x7c0d('0x52')];var _0x21d7fc=[_0x7c0d('0x2'),'openchannelPause',_0x7c0d('0x2c'),_0x7c0d('0x5'),_0x7c0d('0x7'),_0x7c0d('0x3'),'voicePause',_0x7c0d('0x3c')];var _0x2ee8ab=_(_0x50d6be)[_0x7c0d('0x53')](_0x21d7fc)[_0x7c0d('0x54')](_0x2e289d)[_0x7c0d('0x27')]();return _0x2ee8ab;}exports['filterAgentAttributes']=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id','name',_0x7c0d('0x2b'),_0x7c0d('0x55'),_0x7c0d('0x56'),_0x7c0d('0x3c'),_0x7c0d('0x2f'),'userpic',_0x7c0d('0x3d'),_0x7c0d('0x2d'),_0x7c0d('0x3e'),'faxPause',_0x7c0d('0x2'),_0x7c0d('0x2c'),'openchannelPause',_0x7c0d('0x5'),_0x7c0d('0x6'),_0x7c0d('0x7'),_0x7c0d('0x57'),_0x7c0d('0x10'),'mailStatus','openchannelStatus','smsStatus',_0x7c0d('0xd'),'whatsappStatus',_0x7c0d('0x4a'),_0x7c0d('0x4e'),_0x7c0d('0x58'),'openchannelStatusTime',_0x7c0d('0x4c'),_0x7c0d('0x4f'),_0x7c0d('0x4d'),_0x7c0d('0x40'),'faxCapacity',_0x7c0d('0x59'),_0x7c0d('0x41'),_0x7c0d('0x42'),_0x7c0d('0x43'),_0x7c0d('0x5a'),_0x7c0d('0x49'),'mailCurrentCapacity','openchannelCurrentCapacity',_0x7c0d('0x47'),_0x7c0d('0x48'),_0x7c0d('0x5b'),'phoneBarEnableAutomaticScreenRecording',_0x7c0d('0x51'),_0x7c0d('0x5c'),'queue',_0x7c0d('0x5d')];}exports[_0x7c0d('0x5e')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 1ce9c40..badb48c 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe8c9=['client','http','available','paused','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringing','ringInUse','pTalking','message','statusMessage','dialMethod','Trunk','startProgressive','erlangAbandonmentRate','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','talking','originated','find','merge','pick','lodash','util'];(function(_0x5ceea1,_0x41340a){var _0x498e5d=function(_0x221081){while(--_0x221081){_0x5ceea1['push'](_0x5ceea1['shift']());}};_0x498e5d(++_0x41340a);}(_0xe8c9,0x94));var _0x9e8c=function(_0x16a9c5,_0x3f6082){_0x16a9c5=_0x16a9c5-0x0;var _0x1ee255=_0xe8c9[_0x16a9c5];return _0x1ee255;};'use strict';var _=require(_0x9e8c('0x0'));var jayson=require('jayson/promise');var util=require(_0x9e8c('0x1'));var amiClient=jayson[_0x9e8c('0x2')]['http']({'port':0x232a});var routingClient=jayson['client'][_0x9e8c('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9e8c('0x4'),'loggedIn',_0x9e8c('0x5'),_0x9e8c('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0x9e8c('0x7'),_0x9e8c('0x8'),_0x9e8c('0x9'),_0x9e8c('0xa'),_0x9e8c('0xb'),'onHold',_0x9e8c('0xc'),_0x9e8c('0xd'),'talking','unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9e8c('0xe'),'originated',_0x9e8c('0xf'),_0x9e8c('0x10'),'dialActive',_0x9e8c('0x11'),_0x9e8c('0x12'),'startPredictive',_0x9e8c('0x13'),'erlangCalls','erlangCallToSecond',_0x9e8c('0x14'),'erlangBusyFactor','dialPredictiveInterval',_0x9e8c('0x15'),_0x9e8c('0x16'),_0x9e8c('0x17'),_0x9e8c('0x18'),'predictiveIntervalAnsweredCalls',_0x9e8c('0x19'),_0x9e8c('0x1a'),_0x9e8c('0x1b'),_0x9e8c('0x1c')];function getRealtimeQueues(_0x5e5950,_0x7c08c2){var _0x2c1467=_0x7c08c2===_0x9e8c('0x1d')?amiClient:routingClient;return _0x2c1467[_0x9e8c('0x1e')](_[_0x9e8c('0x1f')](_0x7c08c2)+_0x9e8c('0x20'),_0x5e5950)[_0x9e8c('0x21')](function(_0x1e54bd){if(_0x1e54bd['error'])throw new Error(util[_0x9e8c('0x22')](_0x9e8c('0x23'),_0x7c08c2));return _0x1e54bd[_0x9e8c('0x24')];})[_0x9e8c('0x25')](function(_0x3a298b){throw _0x3a298b;});}exports[_0x9e8c('0x26')]=getRealtimeQueues;function initializeQueues(_0x402b65,_0x106329,_0x26a92e,_0x511254){var _0x1d4aa1=DEFAULT_QUEUE_ATTRIBUTES;if(_0x26a92e===_0x9e8c('0x1d')){if(_0x511254===_0x9e8c('0x27')){_0x1d4aa1=_0x1d4aa1[_0x9e8c('0x28')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x511254===_0x9e8c('0x29')){_0x1d4aa1=_0x1d4aa1['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x402b65[_0x9e8c('0x2a')](function(_0x544e37){var _0x284147=_0x544e37[_0x9e8c('0x2b')]({'plain':!![]});_0x284147['paused']=0x0;_0x284147['loggedInDb']=0x0;_0x284147[_0x9e8c('0x2c')]=0x0;_0x284147[_0x9e8c('0x4')]=0x0;_0x284147[_0x9e8c('0x6')]=0x0;if(_0x26a92e===_0x9e8c('0x1d')){_0x284147[_0x9e8c('0x2d')]=0x0;_0x284147[_0x9e8c('0x7')]=0x0;if(_0x511254===_0x9e8c('0x29')){_0x284147['pTalking']=0x0;_0x284147[_0x9e8c('0x2e')]=0x0;}}var _0x147217=_[_0x9e8c('0x2f')](_0x106329,['id',_0x284147['id']]);if(_0x147217){_[_0x9e8c('0x30')](_0x284147,_[_0x9e8c('0x31')](_0x147217,_0x1d4aa1));}return _0x284147;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file +var _0x5f2d=['waiting','busy','find','merge','initializeQueues','jayson/promise','util','client','http','available','loggedIn','paused','inUse','invalid','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','getRealtimeQueues','inbound','outbound','concat','get','loggedInDb'];(function(_0x21ac26,_0x569fda){var _0x26b7e9=function(_0x34dabd){while(--_0x34dabd){_0x21ac26['push'](_0x21ac26['shift']());}};_0x26b7e9(++_0x569fda);}(_0x5f2d,0x1a5));var _0xd5f2=function(_0x28438a,_0x3a3a5e){_0x28438a=_0x28438a-0x0;var _0xaa84b4=_0x5f2d[_0x28438a];return _0xaa84b4;};'use strict';var _=require('lodash');var jayson=require(_0xd5f2('0x0'));var util=require(_0xd5f2('0x1'));var amiClient=jayson[_0xd5f2('0x2')][_0xd5f2('0x3')]({'port':0x232a});var routingClient=jayson[_0xd5f2('0x2')][_0xd5f2('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xd5f2('0x4'),_0xd5f2('0x5'),_0xd5f2('0x6'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xd5f2('0x7'),_0xd5f2('0x8'),'loggedInDb',_0xd5f2('0x9'),_0xd5f2('0xa'),_0xd5f2('0xb'),_0xd5f2('0xc'),_0xd5f2('0xd'),_0xd5f2('0xe'),_0xd5f2('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xd5f2('0x10'),_0xd5f2('0x11'),_0xd5f2('0x12'),_0xd5f2('0x13'),'dialActive',_0xd5f2('0x14'),_0xd5f2('0x15'),_0xd5f2('0x16'),_0xd5f2('0x17'),_0xd5f2('0x18'),'erlangCallToSecond',_0xd5f2('0x19'),_0xd5f2('0x1a'),_0xd5f2('0x1b'),'dialPredictiveIntervalMaxThreshold',_0xd5f2('0x1c'),_0xd5f2('0x1d'),_0xd5f2('0x1e'),'predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout',_0xd5f2('0x1f'),_0xd5f2('0x20'),_0xd5f2('0x21')];function getRealtimeQueues(_0x29618c,_0x47b9e0){var _0x3eea72=_0x47b9e0===_0xd5f2('0x22')?amiClient:routingClient;return _0x3eea72['request'](_['startCase'](_0x47b9e0)+_0xd5f2('0x23'),_0x29618c)[_0xd5f2('0x24')](function(_0x5b8b98){if(_0x5b8b98[_0xd5f2('0x25')])throw new Error(util[_0xd5f2('0x26')](_0xd5f2('0x27'),_0x47b9e0));return _0x5b8b98[_0xd5f2('0x28')];})['catch'](function(_0x3fc00c){throw _0x3fc00c;});}exports[_0xd5f2('0x29')]=getRealtimeQueues;function initializeQueues(_0xa2ba00,_0x218abb,_0x74a796,_0x2d24d6){var _0x200686=DEFAULT_QUEUE_ATTRIBUTES;if(_0x74a796==='voice'){if(_0x2d24d6===_0xd5f2('0x2a')){_0x200686=_0x200686['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x2d24d6===_0xd5f2('0x2b')){_0x200686=_0x200686[_0xd5f2('0x2c')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xa2ba00['map'](function(_0x907b1a){var _0x380acd=_0x907b1a[_0xd5f2('0x2d')]({'plain':!![]});_0x380acd['paused']=0x0;_0x380acd[_0xd5f2('0x2e')]=0x0;_0x380acd[_0xd5f2('0x5')]=0x0;_0x380acd['available']=0x0;_0x380acd[_0xd5f2('0x2f')]=0x0;if(_0x74a796===_0xd5f2('0x22')){_0x380acd[_0xd5f2('0xd')]=0x0;_0x380acd[_0xd5f2('0x30')]=0x0;if(_0x2d24d6===_0xd5f2('0x2b')){_0x380acd['pTalking']=0x0;_0x380acd['originated']=0x0;}}var _0x4fc9bb=_[_0xd5f2('0x31')](_0x218abb,['id',_0x380acd['id']]);if(_0x4fc9bb){_[_0xd5f2('0x32')](_0x380acd,_['pick'](_0x4fc9bb,_0x200686));}return _0x380acd;});}exports[_0xd5f2('0x33')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1350b5c..c4d5d09 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(_0x20038e,_0x4b6981){var _0x425e2e=function(_0xea2c9){while(--_0xea2c9){_0x20038e['push'](_0x20038e['shift']());}};_0x425e2e(++_0x4b6981);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x46a3e8,_0x2e1b35){var _0xf1442e=function(_0x37b5d4){while(--_0x37b5d4){_0x46a3e8['push'](_0x46a3e8['shift']());}};_0xf1442e(++_0x2e1b35);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d6d58b2..aaa05bf 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 _0x4c81=['macAddress','ipAddress','hex','substring','lodash','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','keys','length','filter','family','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','getUuid','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','replace','hostname'];(function(_0x3c296e,_0x40e566){var _0x42d374=function(_0x4124aa){while(--_0x4124aa){_0x3c296e['push'](_0x3c296e['shift']());}};_0x42d374(++_0x40e566);}(_0x4c81,0x73));var _0x14c8=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x4c81[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x14c8('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x14c8('0x1'));var exec=require(_0x14c8('0x2'))[_0x14c8('0x3')];var config=require('../environment');function getInterfaces(){var _0x56d63d=[];var _0x17ffc9=os[_0x14c8('0x4')]();var _0x46c20f=_[_0x14c8('0x5')](_[_0x14c8('0x6')](_0x17ffc9));for(var _0x32bdc4=0x0;_0x32bdc4<_0x46c20f[_0x14c8('0x7')];_0x32bdc4++){var _0x413e82=_0x17ffc9[_0x46c20f[_0x32bdc4]][_0x14c8('0x8')](function(_0x155c73){return _0x155c73[_0x14c8('0x9')]===_0x14c8('0xa')&&_0x155c73[_0x14c8('0xb')]===![];});_0x56d63d=_0x56d63d[_0x14c8('0xc')](_0x413e82);}return _0x56d63d;}function getFirstInterface(){var _0x456c4a=_[_0x14c8('0xd')](getInterfaces());return{'macAddress':_0x456c4a&&_0x456c4a[_0x14c8('0xe')]?_0x456c4a[_0x14c8('0xe')]:_0x14c8('0xf'),'ipAddress':_0x456c4a&&_0x456c4a[_0x14c8('0x10')]?_0x456c4a['address']:_0x14c8('0x11')};}exports[_0x14c8('0x12')]=getFirstInterface;function getCPUhash(){var _0x5d7ea4=_[_0x14c8('0x5')](os[_0x14c8('0x13')]()[_0x14c8('0x14')](function(_0x63a2c3){return _0x63a2c3[_0x14c8('0x15')];}))['join'](':');return crypto[_0x14c8('0x16')](_0x14c8('0x17'))[_0x14c8('0x18')](_0x5d7ea4)[_0x14c8('0x19')]('hex');}exports[_0x14c8('0x1a')]=function(){var _0x16af70=os[_0x14c8('0x1b')]();var _0x1ccce5=/[0-9a-f-]{36}/;if(config[_0x14c8('0x1c')]&&_0x1ccce5['test'](config['licenseToken'])){return config[_0x14c8('0x1c')];}else if(_0x16af70===_0x14c8('0x1d')){return exec(_0x14c8('0x1e'),{'encoding':'utf8'})[_0x14c8('0x1f')]('\x0d\x0a','');}else{var _0x66eae7=getFirstInterface();var _0x1094af=getCPUhash();var _0x3c531f=_0x1094af+'|'+os[_0x14c8('0x20')]()+'|'+_0x66eae7[_0x14c8('0x21')]+'|'+_0x66eae7[_0x14c8('0x22')];var _0x3d3dce=crypto[_0x14c8('0x16')]('md5')[_0x14c8('0x18')](_0x3c531f)[_0x14c8('0x19')](_0x14c8('0x23'));return _0x3d3dce[_0x14c8('0x24')](0x0,0x8)+'-'+_0x3d3dce['substring'](0x8,0xc)+'-'+_0x3d3dce[_0x14c8('0x24')](0xc,0x10)+'-'+_0x3d3dce[_0x14c8('0x24')](0x10,0x14)+'-'+_0x3d3dce[_0x14c8('0x24')](0x14);}}; \ No newline at end of file +var _0x4646=['ipAddress','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','family','IPv4','internal','concat','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress'];(function(_0x2847ec,_0x40ce19){var _0x507988=function(_0x3545a1){while(--_0x3545a1){_0x2847ec['push'](_0x2847ec['shift']());}};_0x507988(++_0x40ce19);}(_0x4646,0x68));var _0x6464=function(_0xa5707d,_0x32e946){_0xa5707d=_0xa5707d-0x0;var _0xb73a8f=_0x4646[_0xa5707d];return _0xb73a8f;};'use strict';var _=require(_0x6464('0x0'));var os=require('os');var crypto=require(_0x6464('0x1'));var machine=require(_0x6464('0x2'));var exec=require(_0x6464('0x3'))[_0x6464('0x4')];var config=require(_0x6464('0x5'));function getInterfaces(){var _0x231fc3=[];var _0x1fe640=os[_0x6464('0x6')]();var _0x14532c=_[_0x6464('0x7')](_['keys'](_0x1fe640));for(var _0x545813=0x0;_0x545813<_0x14532c[_0x6464('0x8')];_0x545813++){var _0x8bea8c=_0x1fe640[_0x14532c[_0x545813]]['filter'](function(_0x101cb0){return _0x101cb0[_0x6464('0x9')]===_0x6464('0xa')&&_0x101cb0[_0x6464('0xb')]===![];});_0x231fc3=_0x231fc3[_0x6464('0xc')](_0x8bea8c);}return _0x231fc3;}function getFirstInterface(){var _0x16bc16=_['head'](getInterfaces());return{'macAddress':_0x16bc16&&_0x16bc16['mac']?_0x16bc16['mac']:_0x6464('0xd'),'ipAddress':_0x16bc16&&_0x16bc16['address']?_0x16bc16[_0x6464('0xe')]:'127.0.0.1'};}exports[_0x6464('0xf')]=getFirstInterface;function getCPUhash(){var _0xa51ebc=_[_0x6464('0x7')](os[_0x6464('0x10')]()[_0x6464('0x11')](function(_0x5d0250){return _0x5d0250[_0x6464('0x12')];}))['join'](':');return crypto[_0x6464('0x13')](_0x6464('0x14'))[_0x6464('0x15')](_0xa51ebc)[_0x6464('0x16')](_0x6464('0x17'));}exports['getUuid']=function(){var _0x4981b3=os['platform']();var _0x1f315f=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x1f315f[_0x6464('0x18')](config[_0x6464('0x19')])){return config[_0x6464('0x19')];}else if(_0x4981b3===_0x6464('0x1a')){return exec(_0x6464('0x1b'),{'encoding':_0x6464('0x1c')})[_0x6464('0x1d')]('\x0d\x0a','');}else{var _0x336242=getFirstInterface();var _0x2e5595=getCPUhash();var _0x4b41ac=_0x2e5595+'|'+os[_0x6464('0x1e')]()+'|'+_0x336242[_0x6464('0x1f')]+'|'+_0x336242[_0x6464('0x20')];var _0x43af5f=crypto['createHash'](_0x6464('0x14'))[_0x6464('0x15')](_0x4b41ac)[_0x6464('0x16')](_0x6464('0x17'));return _0x43af5f[_0x6464('0x21')](0x0,0x8)+'-'+_0x43af5f['substring'](0x8,0xc)+'-'+_0x43af5f[_0x6464('0x21')](0xc,0x10)+'-'+_0x43af5f[_0x6464('0x21')](0x10,0x14)+'-'+_0x43af5f[_0x6464('0x21')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c55c9f6..c462dbd 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 _0xdbf3=['active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','data1','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','default','moment','request-promise','bluebird','version','../../mysqldb','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','get','data2'];(function(_0x3ae055,_0x2908d){var _0x2341a0=function(_0x550f41){while(--_0x550f41){_0x3ae055['push'](_0x3ae055['shift']());}};_0x2341a0(++_0x2908d);}(_0xdbf3,0x1b3));var _0x3dbf=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0xdbf3[_0x29d915];return _0x160f86;};'use strict';var util=require('util');var moment=require(_0x3dbf('0x0'));var rp=require(_0x3dbf('0x1'));var BPromise=require(_0x3dbf('0x2'));var pkginfo=require('pkginfo')(module,_0x3dbf('0x3'));var db=require(_0x3dbf('0x4'))['db'];var encryptor=require('../../components/encryptor');var hardware=require('./hardware');var logger=require(_0x3dbf('0x5'))(_0x3dbf('0x6'));var HOST=_0x3dbf('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x467d7){return new BPromise(function(_0x584371,_0x110fdd){var _0x42605d=util[_0x3dbf('0x8')](_0x3dbf('0x9'),HOST,_0x467d7,module[_0x3dbf('0xa')][_0x3dbf('0x3')]);if(oldToken){_0x42605d=util[_0x3dbf('0x8')](_0x3dbf('0xb'),HOST,_0x467d7,module[_0x3dbf('0xa')]['version'],oldToken);}var _0x15879e={'uri':_0x42605d,'method':_0x3dbf('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x15879e)[_0x3dbf('0xd')](function(_0x5917d3){_0x584371(_0x5917d3);})['catch'](function(_0x2371f5){_0x110fdd(_0x2371f5);});});}function manageLicense(_0x452c87,_0x24a192){var _0x3199a2=_0x24a192[_0x3dbf('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x3199a2['data1']!==_0x452c87&&!_0x3199a2[_0x3dbf('0xf')]){oldToken=_0x3199a2['data1'];}httpRequest(_0x452c87)['then'](function(_0x5c430f){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5c430f[_0x3dbf('0x10')]){isOldTokenSent=![];if(!_0x3199a2['license']&&_0x3199a2[_0x3dbf('0x6')]!=_0x5c430f['license']||_0x3199a2['license']&&_0x3199a2[_0x3dbf('0xf')]){logger[_0x3dbf('0x11')](_0x3dbf('0x12'));}if(_0x3199a2[_0x3dbf('0x6')]&&!_0x3199a2[_0x3dbf('0xf')]&&_0x3199a2[_0x3dbf('0x6')]!=_0x5c430f['license']){logger['info'](_0x3dbf('0x13'));}if(_0x3199a2[_0x3dbf('0x6')]&&!_0x3199a2[_0x3dbf('0xf')]&&_0x3199a2[_0x3dbf('0x6')]==_0x5c430f['license']){return _0x24a192;}return _0x24a192[_0x3dbf('0x14')]({'data1':_0x452c87,'data2':null,'license':_0x5c430f[_0x3dbf('0x6')]});}else{if(_0x5c430f[_0x3dbf('0x6')]||_0x3199a2[_0x3dbf('0x6')]){if(!_0x3199a2[_0x3dbf('0xf')]){if(_0x3199a2['data1']==_0x452c87){GRAY_PERIOD_REASON=_0x3dbf('0x15');logger[_0x3dbf('0x11')](_0x3dbf('0x16'));}else{GRAY_PERIOD_REASON='Changed';logger[_0x3dbf('0x11')](_0x3dbf('0x17'),_0x3199a2[_0x3dbf('0x18')],_0x452c87);}logger[_0x3dbf('0x11')](_0x3dbf('0x19'),GRAY_PERIOD_REASON[_0x3dbf('0x1a')](),moment()[_0x3dbf('0x8')](_0x3dbf('0x1b')));return _0x24a192[_0x3dbf('0x14')]({'data2':encryptor[_0x3dbf('0x1c')](moment()[_0x3dbf('0x8')](_0x3dbf('0x1b')))});}else{if(moment()[_0x3dbf('0x1d')](encryptor[_0x3dbf('0x1e')](_0x3199a2[_0x3dbf('0xf')]),_0x3dbf('0x1f'))>DAYS){logger[_0x3dbf('0x11')]('DEMO\x20START\x20AT\x20%s',moment()[_0x3dbf('0x8')](_0x3dbf('0x1b')));isOldTokenSent=![];return _0x24a192[_0x3dbf('0x14')]({'data1':_0x452c87,'data2':null,'license':null});}}}else{if(_0x3199a2['data1']!=_0x452c87){logger[_0x3dbf('0x11')](_0x3dbf('0x17'),_0x3199a2[_0x3dbf('0x18')],_0x452c87);return _0x24a192[_0x3dbf('0x14')]({'data1':_0x452c87,'data2':null,'license':null});}}}return _0x24a192;})[_0x3dbf('0xd')](function(_0x1171b2){_0x24a192=_0x1171b2;})['catch'](function(_0x5b197f){logger[_0x3dbf('0x20')](_0x5b197f['message']);})[_0x3dbf('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x3dbf('0x22')](),_0x24a192);},TIME);});}function defaultLicense(){var _0x21d2a6=hardware[_0x3dbf('0x22')]();if(_0x21d2a6){return db[_0x3dbf('0x23')][_0x3dbf('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x21d2a6}})[_0x3dbf('0x25')](function(_0x3c9aa5,_0x1a7296){logger[_0x3dbf('0x11')](_0x3dbf('0x26'),_0x21d2a6);manageLicense(_0x21d2a6,_0x3c9aa5);})['catch'](function(_0x425afa){logger['error'](_0x425afa[_0x3dbf('0x27')]);});}}exports[_0x3dbf('0x28')]=defaultLicense; \ No newline at end of file +var _0x385f=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','encryptString','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','error','message','finally','getUuid','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment','version','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','catch','data1','data2','then','active','info','update','Disabled'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0x385f,0x19d));var _0xf385=function(_0x10291b,_0x518773){_0x10291b=_0x10291b-0x0;var _0x1d5fbe=_0x385f[_0x10291b];return _0x1d5fbe;};'use strict';var util=require('util');var moment=require(_0xf385('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require('pkginfo')(module,_0xf385('0x1'));var db=require('../../mysqldb')['db'];var encryptor=require(_0xf385('0x2'));var hardware=require(_0xf385('0x3'));var logger=require('../logger')(_0xf385('0x4'));var HOST=_0xf385('0x5');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xc66627){return new BPromise(function(_0x13fb79,_0x57a9a9){var _0x3ae15c=util[_0xf385('0x6')](_0xf385('0x7'),HOST,_0xc66627,module[_0xf385('0x8')][_0xf385('0x1')]);if(oldToken){_0x3ae15c=util[_0xf385('0x6')](_0xf385('0x9'),HOST,_0xc66627,module[_0xf385('0x8')][_0xf385('0x1')],oldToken);}var _0x5c2bfe={'uri':_0x3ae15c,'method':_0xf385('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x5c2bfe)['then'](function(_0x24537b){_0x13fb79(_0x24537b);})[_0xf385('0xb')](function(_0x589f21){_0x57a9a9(_0x589f21);});});}function manageLicense(_0x4642ac,_0x2d3f96){var _0x4a362a=_0x2d3f96['get']({'plain':!![]});if(!isOldTokenSent&&_0x4a362a[_0xf385('0xc')]!==_0x4642ac&&!_0x4a362a[_0xf385('0xd')]){oldToken=_0x4a362a['data1'];}httpRequest(_0x4642ac)[_0xf385('0xe')](function(_0x49cd32){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x49cd32[_0xf385('0xf')]){isOldTokenSent=![];if(!_0x4a362a['license']&&_0x4a362a[_0xf385('0x4')]!=_0x49cd32[_0xf385('0x4')]||_0x4a362a[_0xf385('0x4')]&&_0x4a362a['data2']){logger[_0xf385('0x10')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x4a362a[_0xf385('0x4')]&&!_0x4a362a[_0xf385('0xd')]&&_0x4a362a[_0xf385('0x4')]!=_0x49cd32[_0xf385('0x4')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED');}if(_0x4a362a[_0xf385('0x4')]&&!_0x4a362a[_0xf385('0xd')]&&_0x4a362a['license']==_0x49cd32[_0xf385('0x4')]){return _0x2d3f96;}return _0x2d3f96[_0xf385('0x11')]({'data1':_0x4642ac,'data2':null,'license':_0x49cd32[_0xf385('0x4')]});}else{if(_0x49cd32['license']||_0x4a362a[_0xf385('0x4')]){if(!_0x4a362a[_0xf385('0xd')]){if(_0x4a362a['data1']==_0x4642ac){GRAY_PERIOD_REASON=_0xf385('0x12');logger[_0xf385('0x10')](_0xf385('0x13'));}else{GRAY_PERIOD_REASON=_0xf385('0x14');logger[_0xf385('0x10')](_0xf385('0x15'),_0x4a362a[_0xf385('0xc')],_0x4642ac);}logger['info'](_0xf385('0x16'),GRAY_PERIOD_REASON[_0xf385('0x17')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x2d3f96[_0xf385('0x11')]({'data2':encryptor[_0xf385('0x18')](moment()[_0xf385('0x6')](_0xf385('0x19')))});}else{if(moment()[_0xf385('0x1a')](encryptor[_0xf385('0x1b')](_0x4a362a[_0xf385('0xd')]),_0xf385('0x1c'))>DAYS){logger[_0xf385('0x10')]('DEMO\x20START\x20AT\x20%s',moment()[_0xf385('0x6')](_0xf385('0x19')));isOldTokenSent=![];return _0x2d3f96[_0xf385('0x11')]({'data1':_0x4642ac,'data2':null,'license':null});}}}else{if(_0x4a362a[_0xf385('0xc')]!=_0x4642ac){logger[_0xf385('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4a362a[_0xf385('0xc')],_0x4642ac);return _0x2d3f96['update']({'data1':_0x4642ac,'data2':null,'license':null});}}}return _0x2d3f96;})[_0xf385('0xe')](function(_0x347a72){_0x2d3f96=_0x347a72;})[_0xf385('0xb')](function(_0x1460ec){logger[_0xf385('0x1d')](_0x1460ec[_0xf385('0x1e')]);})[_0xf385('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0xf385('0x20')](),_0x2d3f96);},TIME);});}function defaultLicense(){var _0x92d7b5=hardware[_0xf385('0x20')]();if(_0x92d7b5){return db['License']['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x92d7b5}})[_0xf385('0x21')](function(_0x2e0630,_0x521802){logger[_0xf385('0x10')](_0xf385('0x22'),_0x92d7b5);manageLicense(_0x92d7b5,_0x2e0630);})[_0xf385('0xb')](function(_0x3c551c){logger[_0xf385('0x1d')](_0x3c551c['message']);});}}exports[_0xf385('0x23')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 1e972ea..4c1f459 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 _0x89d1=['decryptString','gray','deadline','add','days','format','grayReason','changed','message','User','findAll','role','COUNT','sequelize','count','admin','telephone','users','telephones','forEach','pick','countBy','user','exports','util','lodash','moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','then','catch','data1','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','demo','uuid','machineUuid'];(function(_0x416e12,_0x2973f9){var _0x16947e=function(_0x342cd0){while(--_0x342cd0){_0x416e12['push'](_0x416e12['shift']());}};_0x16947e(++_0x2973f9);}(_0x89d1,0x14c));var _0x189d=function(_0x555964,_0x10e06e){_0x555964=_0x555964-0x0;var _0x521e7b=_0x89d1[_0x555964];return _0x521e7b;};'use strict';var util=require(_0x189d('0x0'));var _=require(_0x189d('0x1'));var moment=require(_0x189d('0x2'));var BPromise=require('bluebird');var hardware=require(_0x189d('0x3'));var encryptor=require(_0x189d('0x4'));var db=require(_0x189d('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x189d('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0x189d('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x189d('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x10274a){return new BPromise(function(_0x4235de,_0x4528a3){return db[_0x189d('0x9')]['find'](_['defaults'](_0x10274a,{'raw':!![],'where':{'id':0x1}}))[_0x189d('0xa')](function(_0x4fdb38){return checkLicense(_0x4fdb38,null);})[_0x189d('0xa')](function(_0x53674e){_0x4235de(_0x53674e);return;})[_0x189d('0xb')](function(_0xe628b5){_0x4528a3(_0xe628b5);});});}function checkLicense(_0x1380f0,_0x19fc64){if(!_0x1380f0){demoLicense['uuid']=_0x1380f0[_0x189d('0xc')];return demoLicense;}try{var _0xae0364=_0x19fc64||_0x1380f0['license'];if(_['isEmpty'](_0xae0364)){throw new Error(_0x189d('0xd'));}var _0x1200ab=_0x1380f0[_0x189d('0xc')];var _0x3b1d08=_0x1380f0[_0x189d('0xe')];var _0x45cf3b=_0x1200ab[_0x189d('0xf')]('-')[0x4];var _0x505755=_0x1200ab[_0x189d('0xf')]('-')[0x0];var _0x5c9f31=encryptor['decryptString'](_0xae0364,util['format'](_0x189d('0x10'),_0x45cf3b,_0x1200ab,_0x505755));var _0x28a802=JSON['parse'](_0x5c9f31);_0x28a802[_0x189d('0x11')]=![];_0x28a802[_0x189d('0x12')]=_0x1200ab;_0x28a802[_0x189d('0x13')]=hardware[_0x189d('0x7')]();if(_0x3b1d08){var _0x14e187=encryptor[_0x189d('0x14')](_0x3b1d08);_0x28a802[_0x189d('0x15')]=_0x14e187;_0x28a802[_0x189d('0x16')]=moment(_0x14e187)[_0x189d('0x17')](0x7,_0x189d('0x18'))[_0x189d('0x19')]();_0x28a802[_0x189d('0x1a')]=_0x28a802[_0x189d('0x12')]!=_0x28a802[_0x189d('0x13')]?_0x189d('0x1b'):'disabled';}return _0x28a802;}catch(_0xee6608){breakingLicense['uuid']=_0x1380f0['data1'];breakingLicense['message']=_0xee6608[_0x189d('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4fb3e9,_0x534941){getLicense()[_0x189d('0xa')](function(_0x1ab367){return db[_0x189d('0x1d')][_0x189d('0x1e')]({'attributes':[_0x189d('0x1f'),[db['sequelize']['fn'](_0x189d('0x20'),db[_0x189d('0x21')]['col'](_0x189d('0x1f'))),_0x189d('0x22')]],'group':_0x189d('0x1f'),'where':{'role':{'$or':[_0x189d('0x23'),'user',_0x189d('0x24')]}},'raw':!![]})[_0x189d('0xa')](function(_0x870787){var _0x50ba94={'user':_0x1ab367[_0x189d('0x25')]||0x0,'telephone':_0x1ab367[_0x189d('0x26')]||0x0};_0x870787[_0x189d('0x27')](function(_0x4e47ce){var _0x2851e3=_0x4e47ce[_0x189d('0x1f')]===_0x189d('0x23')?'user':_0x4e47ce[_0x189d('0x1f')];_0x50ba94[_0x2851e3]-=_0x4e47ce[_0x189d('0x22')];if(_0x50ba94[_0x2851e3]<0x0)_0x50ba94[_0x2851e3]=0x0;});_0x4fb3e9(_0x50ba94);return;});})[_0x189d('0xb')](function(_0x41fc11){_0x534941(_0x41fc11);});});}function checkUserLimits(_0x5d4780){return new BPromise(function(_0x31ce23,_0xb4ac49){getLimits()[_0x189d('0xa')](function(_0x323721){var _0x4d43e9=_[_0x189d('0x28')](_[_0x189d('0x29')](_0x5d4780,'role'),[_0x189d('0x23'),_0x189d('0x2a'),_0x189d('0x24')]);var _0x414f83=(_0x4d43e9[_0x189d('0x23')]||0x0)+(_0x4d43e9[_0x189d('0x2a')]||0x0);var _0x5c3afd=_0x4d43e9[_0x189d('0x24')]||0x0;if(_0x414f83>_0x323721[_0x189d('0x2a')])return _0xb4ac49('License\x20limit\x20reached\x20for\x20users');if(_0x5c3afd>_0x323721[_0x189d('0x24')])return _0xb4ac49('License\x20limit\x20reached\x20for\x20telephones');return _0x31ce23();})[_0x189d('0xb')](function(_0x3efe8b){_0xb4ac49(_0x3efe8b);});});}module[_0x189d('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x20fd=['message','findAll','sequelize','COUNT','col','count','role','admin','user','telephone','users','telephones','forEach','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','util','lodash','../../components/encryptor','../../mysqldb','getUuid','2027-01-01T00:00:00.000Z','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','demo','uuid','machineUuid','gray','deadline','add','days','grayReason','changed','disabled'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20fd,0x135));var _0xd20f=function(_0x5c1112,_0xd4a260){_0x5c1112=_0x5c1112-0x0;var _0x55fa4f=_0x20fd[_0x5c1112];return _0x55fa4f;};'use strict';var util=require(_0xd20f('0x0'));var _=require(_0xd20f('0x1'));var moment=require('moment');var BPromise=require('bluebird');var hardware=require('./hardware');var encryptor=require(_0xd20f('0x2'));var db=require(_0xd20f('0x3'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xd20f('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd20f('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0xd20f('0x4')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x50c9c8){return new BPromise(function(_0xb57ed,_0x2f7ccc){return db['License'][_0xd20f('0x6')](_[_0xd20f('0x7')](_0x50c9c8,{'raw':!![],'where':{'id':0x1}}))[_0xd20f('0x8')](function(_0x38d624){return checkLicense(_0x38d624,null);})[_0xd20f('0x8')](function(_0x63bf25){_0xb57ed(_0x63bf25);return;})[_0xd20f('0x9')](function(_0x3b9031){_0x2f7ccc(_0x3b9031);});});}function checkLicense(_0x3b8983,_0x1a2c68){if(!_0x3b8983){demoLicense['uuid']=_0x3b8983[_0xd20f('0xa')];return demoLicense;}try{var _0x11817e=_0x1a2c68||_0x3b8983[_0xd20f('0xb')];if(_[_0xd20f('0xc')](_0x11817e)){throw new Error(_0xd20f('0xd'));}var _0x301c38=_0x3b8983[_0xd20f('0xa')];var _0x3da002=_0x3b8983['data2'];var _0x560239=_0x301c38['split']('-')[0x4];var _0x3ff2d7=_0x301c38[_0xd20f('0xe')]('-')[0x0];var _0x3c0eb1=encryptor[_0xd20f('0xf')](_0x11817e,util[_0xd20f('0x10')]('%s:%s:%s',_0x560239,_0x301c38,_0x3ff2d7));var _0x9ea2de=JSON['parse'](_0x3c0eb1);_0x9ea2de[_0xd20f('0x11')]=![];_0x9ea2de[_0xd20f('0x12')]=_0x301c38;_0x9ea2de[_0xd20f('0x13')]=hardware[_0xd20f('0x4')]();if(_0x3da002){var _0x513bb5=encryptor[_0xd20f('0xf')](_0x3da002);_0x9ea2de[_0xd20f('0x14')]=_0x513bb5;_0x9ea2de[_0xd20f('0x15')]=moment(_0x513bb5)[_0xd20f('0x16')](0x7,_0xd20f('0x17'))[_0xd20f('0x10')]();_0x9ea2de[_0xd20f('0x18')]=_0x9ea2de[_0xd20f('0x12')]!=_0x9ea2de[_0xd20f('0x13')]?_0xd20f('0x19'):_0xd20f('0x1a');}return _0x9ea2de;}catch(_0x365417){breakingLicense['uuid']=_0x3b8983[_0xd20f('0xa')];breakingLicense[_0xd20f('0x1b')]=_0x365417[_0xd20f('0x1b')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4df8ac,_0x4777e2){getLicense()[_0xd20f('0x8')](function(_0x1b3b43){return db['User'][_0xd20f('0x1c')]({'attributes':['role',[db[_0xd20f('0x1d')]['fn'](_0xd20f('0x1e'),db['sequelize'][_0xd20f('0x1f')]('role')),_0xd20f('0x20')]],'group':_0xd20f('0x21'),'where':{'role':{'$or':[_0xd20f('0x22'),_0xd20f('0x23'),_0xd20f('0x24')]}},'raw':!![]})[_0xd20f('0x8')](function(_0x5e10ed){var _0x540deb={'user':_0x1b3b43[_0xd20f('0x25')]||0x0,'telephone':_0x1b3b43[_0xd20f('0x26')]||0x0};_0x5e10ed[_0xd20f('0x27')](function(_0x450238){var _0x5964d2=_0x450238['role']===_0xd20f('0x22')?'user':_0x450238[_0xd20f('0x21')];_0x540deb[_0x5964d2]-=_0x450238['count'];if(_0x540deb[_0x5964d2]<0x0)_0x540deb[_0x5964d2]=0x0;});_0x4df8ac(_0x540deb);return;});})[_0xd20f('0x9')](function(_0x920236){_0x4777e2(_0x920236);});});}function checkUserLimits(_0x5447c3){return new BPromise(function(_0x59d456,_0x20e579){getLimits()[_0xd20f('0x8')](function(_0x5523f5){var _0xa72741=_['pick'](_['countBy'](_0x5447c3,_0xd20f('0x21')),['admin','user',_0xd20f('0x24')]);var _0x2c37a0=(_0xa72741[_0xd20f('0x22')]||0x0)+(_0xa72741[_0xd20f('0x23')]||0x0);var _0x2475a5=_0xa72741[_0xd20f('0x24')]||0x0;if(_0x2c37a0>_0x5523f5[_0xd20f('0x23')])return _0x20e579(_0xd20f('0x28'));if(_0x2475a5>_0x5523f5[_0xd20f('0x24')])return _0x20e579(_0xd20f('0x29'));return _0x59d456();})[_0xd20f('0x9')](function(_0x160e24){_0x20e579(_0x160e24);});});}module['exports']={'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 403d277..df37628 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 _0x57ca=['http://localhost:9000','myappanuglar-secret','secret'];(function(_0x31e00f,_0x1a4e77){var _0x260194=function(_0x58c57a){while(--_0x58c57a){_0x31e00f['push'](_0x31e00f['shift']());}};_0x260194(++_0x1a4e77);}(_0x57ca,0x108));var _0xa57c=function(_0x26942a,_0x2a5ce0){_0x26942a=_0x26942a-0x0;var _0x1f047c=_0x57ca[_0x26942a];return _0x1f047c;};'use strict';module['exports']={'DOMAIN':_0xa57c('0x0'),'SESSION_SECRET':_0xa57c('0x1'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0xa57c('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x0598=['http://localhost:9000','app-id','exports'];(function(_0x384231,_0x50be41){var _0x2480bf=function(_0x1c4838){while(--_0x1c4838){_0x384231['push'](_0x384231['shift']());}};_0x2480bf(++_0x50be41);}(_0x0598,0x92));var _0x8059=function(_0x140865,_0x1fcf16){_0x140865=_0x140865-0x0;var _0x20eef4=_0x0598[_0x140865];return _0x20eef4;};'use strict';module[_0x8059('0x0')]={'DOMAIN':_0x8059('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':_0x8059('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 3fc2593..ecc1dc4 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcde7=['../utils/loggers','fileLogger'];(function(_0x1f2efd,_0x3d1d9e){var _0x19d2a8=function(_0x5b60aa){while(--_0x5b60aa){_0x1f2efd['push'](_0x1f2efd['shift']());}};_0x19d2a8(++_0x3d1d9e);}(_0xcde7,0x1c4));var _0x7cde=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xcde7[_0x59ee6f];return _0x4c0979;};'use strict';var fileLogger=require(_0x7cde('0x0'))[_0x7cde('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0xe10d=['fileLogger'];(function(_0x3c91a6,_0x310415){var _0x1c4712=function(_0x3360a0){while(--_0x3360a0){_0x3c91a6['push'](_0x3c91a6['shift']());}};_0x1c4712(++_0x310415);}(_0xe10d,0x117));var _0xde10=function(_0x4984a1,_0xf4c369){_0x4984a1=_0x4984a1-0x0;var _0x5f43ea=_0xe10d[_0x4984a1];return _0x5f43ea;};'use strict';var fileLogger=require('../utils/loggers')[_0xde10('0x0')];module['exports']=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 00b8d7b..4fb14ae 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 _0xfe05=['exports','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','routing','../../services/routing/index.js','xdr'];(function(_0x55b3e7,_0x5e2030){var _0x1b3461=function(_0x3dced6){while(--_0x3dced6){_0x55b3e7['push'](_0x55b3e7['shift']());}};_0x1b3461(++_0x5e2030);}(_0xfe05,0x79));var _0x5fe0=function(_0xe50edf,_0x12df36){_0xe50edf=_0xe50edf-0x0;var _0x1e3313=_0xfe05[_0xe50edf];return _0x1e3313;};'use strict';var path=require('path');var cfg=require(_0x5fe0('0x0'));var env={'NODE_PATH':path[_0x5fe0('0x1')](path[_0x5fe0('0x2')](cfg[_0x5fe0('0x3')],_0x5fe0('0x4')))};var pm2config={'apps':[{'name':_0x5fe0('0x5'),'script':path[_0x5fe0('0x2')](__dirname,_0x5fe0('0x6')),'env':env},{'name':_0x5fe0('0x7'),'script':path[_0x5fe0('0x2')](__dirname,_0x5fe0('0x8')),'env':env},{'name':_0x5fe0('0x9'),'script':path['join'](__dirname,_0x5fe0('0xa')),'env':env},{'name':'email','script':path['join'](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x5fe0('0xb'),'script':path[_0x5fe0('0x2')](__dirname,_0x5fe0('0xc')),'env':env},{'name':_0x5fe0('0xd'),'script':path[_0x5fe0('0x2')](__dirname,'../../services/xdr/index.js'),'env':env}]};module[_0x5fe0('0xe')]=pm2config; \ No newline at end of file +var _0xc792=['exports','path','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','../../services/ami/index.js','../../services/agi/index.js','../../services/email/index.js','routing','xdr','../../services/xdr/index.js'];(function(_0x3de4f8,_0x336c7d){var _0x3d81fc=function(_0x53b9f9){while(--_0x53b9f9){_0x3de4f8['push'](_0x3de4f8['shift']());}};_0x3d81fc(++_0x336c7d);}(_0xc792,0x178));var _0x2c79=function(_0x1f77b2,_0x281c6c){_0x1f77b2=_0x1f77b2-0x0;var _0x223868=_0xc792[_0x1f77b2];return _0x223868;};'use strict';var path=require(_0x2c79('0x0'));var cfg=require(_0x2c79('0x1'));var env={'NODE_PATH':path[_0x2c79('0x2')](path[_0x2c79('0x3')](cfg[_0x2c79('0x4')],_0x2c79('0x5')))};var pm2config={'apps':[{'name':_0x2c79('0x6'),'script':path[_0x2c79('0x3')](__dirname,_0x2c79('0x7')),'env':env},{'name':'ami','script':path['join'](__dirname,_0x2c79('0x8')),'env':env},{'name':'agi','script':path['join'](__dirname,_0x2c79('0x9')),'env':env},{'name':'email','script':path[_0x2c79('0x3')](__dirname,_0x2c79('0xa')),'env':env},{'name':_0x2c79('0xb'),'script':path[_0x2c79('0x3')](__dirname,'../../services/routing/index.js'),'env':env},{'name':_0x2c79('0xc'),'script':path[_0x2c79('0x3')](__dirname,_0x2c79('0xd')),'env':env}]};module[_0x2c79('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index bb4c326..d2c69bc 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 _0x3628=['then','disconnect','stop','restart','list','describe','dump','saved','pm2','bluebird','./config','connect','connected','start'];(function(_0xcdbe48,_0x318df3){var _0x409123=function(_0x9bfa0d){while(--_0x9bfa0d){_0xcdbe48['push'](_0xcdbe48['shift']());}};_0x409123(++_0x318df3);}(_0x3628,0x19e));var _0x8362=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x3628[_0x2a0350];return _0x425220;};'use strict';var pm2=require(_0x8362('0x0'));var BPromise=require(_0x8362('0x1'));var config=require(_0x8362('0x2'));function connect(){return new BPromise(function(_0x49526f,_0xc52373){return pm2[_0x8362('0x3')](function(_0x2a5599){if(_0x2a5599){return _0xc52373(_0x2a5599);}return _0x49526f(_0x8362('0x4'));});});};exports[_0x8362('0x5')]=function(_0x47b94f){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x1fd181,_0x2ebf87){return pm2[_0x8362('0x5')](_0x47b94f,function(_0x57c2c0,_0x3eeebe){if(_0x57c2c0){return _0x2ebf87(_0x57c2c0);}pm2[_0x8362('0x7')]();return _0x1fd181(_0x3eeebe);});});});};exports[_0x8362('0x8')]=function(_0x1aedb0){return connect()['then'](function(){return new BPromise(function(_0x15835a,_0x45edc5){return pm2['stop'](_0x1aedb0,function(_0x5b1e25,_0x415e84){if(_0x5b1e25){return _0x45edc5(_0x5b1e25);}pm2[_0x8362('0x7')]();return _0x15835a(_0x415e84);});});});};exports[_0x8362('0x9')]=function(_0x2efedd){return connect()['then'](function(){return new BPromise(function(_0x2ebb2a,_0x236af5){return pm2[_0x8362('0x9')](_0x2efedd,function(_0x2a5e58,_0x698b70){if(_0x2a5e58){return _0x236af5(_0x2a5e58);}pm2[_0x8362('0x7')]();return _0x2ebb2a(_0x698b70);});});});};exports[_0x8362('0xa')]=function(){return connect()['then'](function(){return new BPromise(function(_0x583ad3,_0x316b7d){return pm2[_0x8362('0xa')](function(_0xde755f,_0x19b326){if(_0xde755f){return _0x316b7d(_0xde755f);}pm2[_0x8362('0x7')]();return _0x583ad3(_0x19b326);});});});};exports[_0x8362('0xb')]=function(_0x3667d4){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x3a4689,_0x190daf){return pm2[_0x8362('0xb')](_0x3667d4,function(_0x34d7c8,_0x156e83){if(_0x34d7c8){return _0x190daf(_0x34d7c8);}pm2[_0x8362('0x7')]();return _0x3a4689(_0x156e83);});});});};exports['delete']=function(_0x2672e8){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x48ef5d,_0x248fd6){return pm2['delete'](_0x2672e8,function(_0x1317e1,_0x5cd9a6){if(_0x1317e1){return _0x248fd6(_0x1317e1);}pm2['disconnect']();return _0x48ef5d(_0x5cd9a6);});});});};exports[_0x8362('0xc')]=function(){return connect()[_0x8362('0x6')](function(){return new BPromise(function(_0x3f9fca,_0x18d513){return pm2['dump'](function(_0x495316){if(_0x495316){return _0x18d513(_0x495316);}return _0x3f9fca(_0x8362('0xd'));});});});}; \ No newline at end of file +var _0xa92f=['stop','restart','list','then','describe','delete','saved','pm2','bluebird','./config','connected','start','disconnect'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa92f,0xca));var _0xfa92=function(_0x864afc,_0x7a7be2){_0x864afc=_0x864afc-0x0;var _0x2d4b82=_0xa92f[_0x864afc];return _0x2d4b82;};'use strict';var pm2=require(_0xfa92('0x0'));var BPromise=require(_0xfa92('0x1'));var config=require(_0xfa92('0x2'));function connect(){return new BPromise(function(_0xfed458,_0x36be57){return pm2['connect'](function(_0x2e2ab1){if(_0x2e2ab1){return _0x36be57(_0x2e2ab1);}return _0xfed458(_0xfa92('0x3'));});});};exports[_0xfa92('0x4')]=function(_0x3fe9d7){return connect()['then'](function(){return new BPromise(function(_0x522b6a,_0x291f89){return pm2['start'](_0x3fe9d7,function(_0x3b735a,_0x4b8599){if(_0x3b735a){return _0x291f89(_0x3b735a);}pm2[_0xfa92('0x5')]();return _0x522b6a(_0x4b8599);});});});};exports[_0xfa92('0x6')]=function(_0x3b8712){return connect()['then'](function(){return new BPromise(function(_0x9f6f21,_0x4859f4){return pm2[_0xfa92('0x6')](_0x3b8712,function(_0x149594,_0x324cc4){if(_0x149594){return _0x4859f4(_0x149594);}pm2[_0xfa92('0x5')]();return _0x9f6f21(_0x324cc4);});});});};exports[_0xfa92('0x7')]=function(_0x2ff819){return connect()['then'](function(){return new BPromise(function(_0x4d475e,_0x41f503){return pm2['restart'](_0x2ff819,function(_0x334b86,_0x12ae0f){if(_0x334b86){return _0x41f503(_0x334b86);}pm2['disconnect']();return _0x4d475e(_0x12ae0f);});});});};exports[_0xfa92('0x8')]=function(){return connect()[_0xfa92('0x9')](function(){return new BPromise(function(_0x348add,_0x1ca2e5){return pm2['list'](function(_0x3f541b,_0x2cd265){if(_0x3f541b){return _0x1ca2e5(_0x3f541b);}pm2[_0xfa92('0x5')]();return _0x348add(_0x2cd265);});});});};exports[_0xfa92('0xa')]=function(_0x39058c){return connect()['then'](function(){return new BPromise(function(_0x1ca1bb,_0x4a52c3){return pm2[_0xfa92('0xa')](_0x39058c,function(_0xffc841,_0x5692eb){if(_0xffc841){return _0x4a52c3(_0xffc841);}pm2[_0xfa92('0x5')]();return _0x1ca1bb(_0x5692eb);});});});};exports[_0xfa92('0xb')]=function(_0x3c8215){return connect()[_0xfa92('0x9')](function(){return new BPromise(function(_0x53094f,_0x5c7337){return pm2[_0xfa92('0xb')](_0x3c8215,function(_0x23df66,_0x177e05){if(_0x23df66){return _0x5c7337(_0x23df66);}pm2['disconnect']();return _0x53094f(_0x177e05);});});});};exports['dump']=function(){return connect()['then'](function(){return new BPromise(function(_0xd018eb,_0x2eb397){return pm2['dump'](function(_0x28af52){if(_0x28af52){return _0x2eb397(_0x28af52);}return _0xd018eb(_0xfa92('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e051fae..27270c8 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 _0x6465=['moment','ioredis','util','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','lodash'];(function(_0x2700de,_0x4baeac){var _0x4bfc1b=function(_0x1a12f0){while(--_0x1a12f0){_0x2700de['push'](_0x2700de['shift']());}};_0x4bfc1b(++_0x4baeac);}(_0x6465,0xfb));var _0x5646=function(_0x4f7f12,_0x3ab9b8){_0x4f7f12=_0x4f7f12-0x0;var _0x42175d=_0x6465[_0x4f7f12];return _0x42175d;};'use strict';var _=require(_0x5646('0x0'));var moment=require(_0x5646('0x1'));var Redis=require(_0x5646('0x2'));var util=require(_0x5646('0x3'));var config=require(_0x5646('0x4'));var db=require(_0x5646('0x5'))['db'];var logger=require('../logger')('schedule');config[_0x5646('0x6')]=_[_0x5646('0x7')](config[_0x5646('0x6')],{'host':_0x5646('0x8'),'port':0x18eb});var io=require(_0x5646('0x9'))(new Redis(config[_0x5646('0x6')]));function closeInteractions(){var _0x3b7cd3=0x0;var _0x398e3d=[];return db[_0x5646('0xa')][_0x5646('0xb')]({'raw':!![],'attributes':['id',_0x5646('0xc')],'where':{'id':0x1}})[_0x5646('0xd')](function(_0x35f5ec){_0x3b7cd3=_0x35f5ec[_0x5646('0xc')];if(_0x3b7cd3){return db[_0x5646('0xe')][_0x5646('0xf')]({'raw':!![],'attributes':['id',_0x5646('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x5646('0x11')](_0x35f5ec[_0x5646('0xc')],_0x5646('0x12'))}}});}else{return[];}})[_0x5646('0xd')](function(_0x203fd9){if(_0x203fd9&&_0x203fd9[_0x5646('0x13')]){_0x398e3d=_['map'](_0x203fd9||[],'id');logger[_0x5646('0x14')](_0x5646('0x15'),_0x398e3d[_0x5646('0x16')]());return db[_0x5646('0xe')][_0x5646('0x17')]({'closeReason':_0x5646('0x18'),'disposition':_0x5646('0x19'),'closed':!![],'closedAt':moment()['format'](_0x5646('0x1a'))},{'where':{'id':_0x398e3d}});}})[_0x5646('0xd')](function(){if(_0x398e3d&&_0x398e3d[_0x5646('0x13')]){logger['info'](_0x5646('0x1b'),_0x398e3d[_0x5646('0x16')]());for(var _0x2394f6=0x0;_0x2394f6<_0x398e3d[_0x5646('0x13')];_0x2394f6++){io['emit']('chatInteraction:update',{'id':_0x398e3d[_0x2394f6],'closed':!![]});}}})['catch'](function(_0x250d4e){logger['error']('[CHAT]\x20Error\x20closing\x20interactions',_0x250d4e?util['inspect'](_0x250d4e,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x373e=['minutes','map','info','[CHAT]\x20Interactions\x20to\x20close:','system','timeout','format','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll'];(function(_0x182d20,_0x6c112e){var _0x4d745d=function(_0x195eeb){while(--_0x195eeb){_0x182d20['push'](_0x182d20['shift']());}};_0x4d745d(++_0x6c112e);}(_0x373e,0x10f));var _0xe373=function(_0x24c141,_0x3e23b8){_0x24c141=_0x24c141-0x0;var _0x58c642=_0x373e[_0x24c141];return _0x58c642;};'use strict';var _=require(_0xe373('0x0'));var moment=require(_0xe373('0x1'));var Redis=require(_0xe373('0x2'));var util=require(_0xe373('0x3'));var config=require(_0xe373('0x4'));var db=require(_0xe373('0x5'))['db'];var logger=require(_0xe373('0x6'))('schedule');config['redis']=_[_0xe373('0x7')](config[_0xe373('0x8')],{'host':_0xe373('0x9'),'port':0x18eb});var io=require(_0xe373('0xa'))(new Redis(config[_0xe373('0x8')]));function closeInteractions(){var _0xe74c11=0x0;var _0x3a3e0e=[];return db[_0xe373('0xb')][_0xe373('0xc')]({'raw':!![],'attributes':['id',_0xe373('0xd')],'where':{'id':0x1}})[_0xe373('0xe')](function(_0x4bc891){_0xe74c11=_0x4bc891[_0xe373('0xd')];if(_0xe74c11){return db[_0xe373('0xf')][_0xe373('0x10')]({'raw':!![],'attributes':['id','lastMsgAt'],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x4bc891[_0xe373('0xd')],_0xe373('0x11'))}}});}else{return[];}})[_0xe373('0xe')](function(_0x117296){if(_0x117296&&_0x117296['length']){_0x3a3e0e=_[_0xe373('0x12')](_0x117296||[],'id');logger[_0xe373('0x13')](_0xe373('0x14'),_0x3a3e0e['join']());return db[_0xe373('0xf')]['update']({'closeReason':_0xe373('0x15'),'disposition':_0xe373('0x16'),'closed':!![],'closedAt':moment()[_0xe373('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3a3e0e}});}})['then'](function(){if(_0x3a3e0e&&_0x3a3e0e[_0xe373('0x18')]){logger['info'](_0xe373('0x19'),_0x3a3e0e['join']());for(var _0x2daf00=0x0;_0x2daf00<_0x3a3e0e[_0xe373('0x18')];_0x2daf00++){io[_0xe373('0x1a')](_0xe373('0x1b'),{'id':_0x3a3e0e[_0x2daf00],'closed':!![]});}}})[_0xe373('0x1c')](function(_0x194530){logger[_0xe373('0x1d')](_0xe373('0x1e'),_0x194530?util[_0xe373('0x1f')](_0x194530,{'showHidden':![],'depth':null}):'');});}exports['start']=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 89e7a1c..971447b 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 _0x1d1f=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x1d1f,0x15e));var _0xf1d1=function(_0x45862f,_0xf5f0a6){_0x45862f=_0x45862f-0x0;var _0x35b20b=_0x1d1f[_0x45862f];return _0x35b20b;};'use strict';function start(){var _0x259e5c=require(_0xf1d1('0x0'));return _0x259e5c[_0xf1d1('0x1')]();}module[_0xf1d1('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xcbe1=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x32d102,_0x14744c){var _0x5d88fa=function(_0x4a3f85){while(--_0x4a3f85){_0x32d102['push'](_0x32d102['shift']());}};_0x5d88fa(++_0x14744c);}(_0xcbe1,0x1e5));var _0x1cbe=function(_0x650e11,_0x284f86){_0x650e11=_0x650e11-0x0;var _0x1a9b47=_0xcbe1[_0x650e11];return _0x1a9b47;};'use strict';function start(){var _0x39f5c2=require(_0x1cbe('0x0'));return _0x39f5c2[_0x1cbe('0x1')]();}module[_0x1cbe('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 1910748..975494a 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 _0x6cf4=['no\x20report\x20id','Schedule','findAll','CloudProvider','keys','map','toString','difference','intersection','length','exists','deleteJob','resolve','run\x20job','cron','isBetween','startAt','add','start','add\x20cron','stop\x20cron','active','endAt','update','update\x20cron','run','path','lodash','moment','cron-job-manager','jayson/promise','bluebird','schedule','../../mysqldb','retry','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','name','Smtp','user','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','attachments','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','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','stop','still\x20loading','case\x20completed','operation','case\x20empty','case\x20failed','entity','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','CustomReportId','exec\x20custom\x20report\x20id:%s'];(function(_0x1e4f2d,_0x22e2bb){var _0xd05ce5=function(_0x4c7b43){while(--_0x4c7b43){_0x1e4f2d['push'](_0x1e4f2d['shift']());}};_0xd05ce5(++_0x22e2bb);}(_0x6cf4,0x87));var _0x46cf=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0x6cf4[_0x9be28f];return _0xa9f52d;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x46cf('0x0'));var _=require(_0x46cf('0x1'));var moment=require(_0x46cf('0x2'));var CronJobManager=require(_0x46cf('0x3'));var jayson=require(_0x46cf('0x4'));var BPromise=require(_0x46cf('0x5'));var logger=require('../logger')(_0x46cf('0x6'));var db=require(_0x46cf('0x7'))['db'];const retry=require(_0x46cf('0x8'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x46cf('0x9')][_0x46cf('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4c1d20){const _0x754d3f={};if(typeof _0x4c1d20===_0x46cf('0xb')){_0x754d3f['id']=_0x4c1d20;}return db[_0x46cf('0xc')][_0x46cf('0xd')]({'where':_0x754d3f})[_0x46cf('0xe')](function(_0x55b5f9){return _0x55b5f9;})[_0x46cf('0xf')](function(_0x3b43cf){logger[_0x46cf('0x10')](_0x3b43cf);});}function handleSendEmail(_0x194610,_0x5d5775){logger[_0x46cf('0x11')](_0x46cf('0x12'),_0x194610[_0x46cf('0x13')]);var _0x476081=!![];var _0x1f8dad=_0x194610[_0x46cf('0x14')]['getSmtpOptions']();var _0x3960d4={'account':_0x1f8dad,'message':{'from':util[_0x46cf('0x15')](_0x46cf('0x16'),_0x194610[_0x46cf('0x14')][_0x46cf('0x17')],_0x194610[_0x46cf('0x14')]['email']||_0x194610[_0x46cf('0x14')][_0x46cf('0x18')][_0x46cf('0x19')]),'to':_0x194610[_0x46cf('0x13')],'cc':_0x194610['cc'],'bcc':_0x194610['bcc'],'subject':util[_0x46cf('0x15')](_0x46cf('0x1a'),_0x5d5775[_0x46cf('0x17')],_0x194610[_0x46cf('0x1b')],_0x194610[_0x46cf('0x1c')])}};var _0x5b1d06=path[_0x46cf('0x1d')](__dirname,'../../files/reports');var _0x11645e=_0x5d5775[_0x46cf('0x1e')];var _0x33647c=util[_0x46cf('0x15')](_0x46cf('0x1f'),path[_0x46cf('0x20')](_0x5d5775[_0x46cf('0x1e')],path[_0x46cf('0x21')](_0x5d5775[_0x46cf('0x1e')])),_0x46cf('0x22'));var _0x56f8e1=path[_0x46cf('0x1d')](_0x5b1d06,_0x11645e);var _0x52bb73=path['join'](_0x5b1d06,_0x33647c);if(fs[_0x46cf('0x23')](_0x56f8e1)){_0x5d5775['status']='Sent';_0x3960d4['message'][_0x46cf('0x24')]=[{'filename':_0x11645e,'path':_0x56f8e1}];_0x3960d4[_0x46cf('0x25')][_0x46cf('0x26')]=util['format'](_0x46cf('0x27'),JSON[_0x46cf('0x28')](_0x5d5775,null,0x2));}else if(fs['existsSync'](_0x52bb73)){_0x5d5775[_0x46cf('0x29')]=_0x46cf('0x2a');_0x3960d4[_0x46cf('0x25')][_0x46cf('0x24')]=[{'filename':_0x33647c,'path':_0x52bb73}];}else{if(_0x5d5775['status']===_0x46cf('0x2b')){_0x3960d4[_0x46cf('0x25')][_0x46cf('0x26')]=_0x46cf('0x2c');if(!_0x194610[_0x46cf('0x2d')]){_0x476081=![];logger[_0x46cf('0x11')](_0x46cf('0x2e'));}}else if(_0x5d5775[_0x46cf('0x29')]==='Loading'){_0x3960d4['message'][_0x46cf('0x26')]=_0x46cf('0x2f');}else if(_0x5d5775[_0x46cf('0x29')]===_0x46cf('0x30')){_0x3960d4[_0x46cf('0x25')]['text']=_0x46cf('0x31');}else if(_0x5d5775[_0x46cf('0x29')]==='Failed'){_0x3960d4[_0x46cf('0x25')]['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger[_0x46cf('0x10')](_0x46cf('0x32'),_0x5d5775[_0x46cf('0x29')]);}}if(_0x476081){return client[_0x46cf('0x33')](_0x46cf('0x34'),_0x3960d4)['then'](function(_0xb6a3fe){if(_0xb6a3fe[_0x46cf('0x10')]){return logger[_0x46cf('0x10')](_0x46cf('0x35'),JSON[_0x46cf('0x28')](_0xb6a3fe));}return logger[_0x46cf('0x11')](_0x46cf('0x36'));})[_0x46cf('0xf')](function(_0x399178){return logger[_0x46cf('0x10')](_0x46cf('0x35'),JSON[_0x46cf('0x28')](_0x399178));});}}function handleError(){return function(_0x50c2a7){return logger[_0x46cf('0x10')](JSON[_0x46cf('0x28')](_0x50c2a7));};}function loading(_0x84656){logger[_0x46cf('0x11')](_0x46cf('0x37'));if(_0x84656[_0x46cf('0x38')]===_0x84656[_0x46cf('0x39')][_0x46cf('0x3a')]){handleSendEmail(_0x84656[_0x46cf('0x3b')],_0x84656[_0x46cf('0x3c')]);_0x84656['operation'][_0x46cf('0x3d')]();}else{_0x84656['operation'][_0x46cf('0x8')](_0x46cf('0x3e'));}}function completed(_0x141fcc){logger[_0x46cf('0x11')](_0x46cf('0x3f'));handleSendEmail(_0x141fcc[_0x46cf('0x3b')],_0x141fcc[_0x46cf('0x3c')]);_0x141fcc[_0x46cf('0x40')][_0x46cf('0x3d')]();}function empty(_0xfa6ad0){logger['info'](_0x46cf('0x41'));handleSendEmail(_0xfa6ad0['job'],_0xfa6ad0['data']);_0xfa6ad0['operation'][_0x46cf('0x3d')]();}function failed(_0xd7d891){logger[_0x46cf('0x11')](_0x46cf('0x42'));handleSendEmail(_0xd7d891[_0x46cf('0x3b')],_0xd7d891[_0x46cf('0x3c')]);_0xd7d891[_0x46cf('0x40')]['stop']();}function urecognized(_0x2b097c){logger['error']('Unrecognized\x20status:',_0x2b097c[_0x46cf('0x43')][_0x46cf('0x44')][_0x46cf('0x29')]);_0x2b097c[_0x46cf('0x40')][_0x46cf('0x3d')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2ca769,_0x362294){const _0x1752ee={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x3f9d6e=retry[_0x46cf('0x40')](_0x1752ee);_0x3f9d6e['attempt'](_0x39eb3a=>{logger[_0x46cf('0x11')](_0x46cf('0x45')+_0x2ca769['id']+_0x46cf('0x46')+_0x39eb3a);try{getReportData(_0x362294['id'])['then'](function(_0x386cb1){_0x362294=_0x386cb1;logger[_0x46cf('0x11')](_0x46cf('0x47'),_0x386cb1[_0x46cf('0x44')][_0x46cf('0x29')]);if(!reportStatusStrategies[_0x386cb1['dataValues'][_0x46cf('0x29')]]){logger[_0x46cf('0x10')](_0x46cf('0x47'),_0x386cb1[_0x46cf('0x44')][_0x46cf('0x29')]);_0x3f9d6e['retry']();}reportStatusStrategies[_0x386cb1[_0x46cf('0x44')]['status']]({'operation':_0x3f9d6e,'currentAttempt':_0x39eb3a,'retryOptions':_0x1752ee,'job':_0x2ca769,'data':_0x362294,'entity':_0x386cb1});});}catch(_0x312752){_0x3f9d6e[_0x46cf('0x8')](_0x312752);}});}function handleResult(_0x4f8c51){return function(_0x433305){if(_0x4f8c51[_0x46cf('0x48')]&&_0x4f8c51[_0x46cf('0x14')]&&_0x4f8c51[_0x46cf('0x14')][_0x46cf('0x18')]&&!_[_0x46cf('0x49')](_0x4f8c51[_0x46cf('0x13')])){retryer(_0x4f8c51,_0x433305);}};}function handleJob(_0x5971ae){return function(){try{if(_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x1b')])){return logger[_0x46cf('0x11')](_0x46cf('0x4a'));}if(_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x1c')])){return logger[_0x46cf('0x11')](_0x46cf('0x4b'));}var _0x2bff5d={'startDate':moment()['subtract'](_0x5971ae[_0x46cf('0x1b')],_0x5971ae[_0x46cf('0x1c')])[_0x46cf('0x15')](_0x46cf('0x4c')),'endDate':moment()[_0x46cf('0x15')](_0x46cf('0x4c')),'type':_0x46cf('0x4d'),'output':_0x5971ae['output'],'name':_0x5971ae[_0x46cf('0x17')]};if(!_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x4e')])){logger['info'](_0x46cf('0x4f'),_0x5971ae[_0x46cf('0x4e')]);return analyticDefaultReportController[_0x46cf('0x50')]({'id':_0x5971ae[_0x46cf('0x4e')]},_0x2bff5d)[_0x46cf('0xe')](handleResult(_0x5971ae))[_0x46cf('0xf')](handleError());}if(!_[_0x46cf('0x49')](_0x5971ae[_0x46cf('0x51')])){logger[_0x46cf('0x11')](_0x46cf('0x52'),_0x5971ae[_0x46cf('0x51')]);return analyticCustomReportController[_0x46cf('0x50')]({'id':_0x5971ae[_0x46cf('0x51')]},_0x2bff5d)[_0x46cf('0xe')](handleResult(_0x5971ae))['catch'](handleError());}}catch(_0x5e5bac){logger[_0x46cf('0x10')](JSON['stringify'](_0x5e5bac));}return logger[_0x46cf('0x11')](_0x46cf('0x53'));};}function getJobs(_0x2eca2e){var _0x3d2057={};if(_0x2eca2e){_0x3d2057['id']=_0x2eca2e;}return db[_0x46cf('0x54')][_0x46cf('0x55')]({'where':_0x3d2057,'include':[{'model':db[_0x46cf('0x14')],'attributes':['id',_0x46cf('0x17'),_0x46cf('0x13')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x46cf('0x56')],'as':_0x46cf('0x56')}]}]}]})['then'](function(_0x5c3675){var _0x36d31e=_[_0x46cf('0x57')](manager['jobs']);var _0x17097e=_[_0x46cf('0x58')](_0x5c3675,function(_0xf87d20){return _0xf87d20['id'][_0x46cf('0x59')]();});var _0x16f392=_['keyBy'](_0x5c3675,function(_0x22ac68){return _0x22ac68['id'][_0x46cf('0x59')]();});var _0xdbd370=_0x2eca2e?_0x17097e:_[_0x46cf('0x5a')](_0x17097e,_0x36d31e);var _0x27091b=_[_0x46cf('0x5b')](_0x17097e,_0x36d31e);var _0x1fd03b=_['difference'](_0x36d31e,_0x17097e);var _0x2007d1;var _0xb7bfaa;for(_0x2007d1=0x0;_0x2007d1<_0x1fd03b[_0x46cf('0x5c')]&&!_0x2eca2e;_0x2007d1+=0x1){_0xb7bfaa=_0x1fd03b[_0x2007d1]['toString']();if(manager[_0x46cf('0x5d')](_0xb7bfaa)){manager[_0x46cf('0x3d')](_0xb7bfaa);manager[_0x46cf('0x5e')](_0xb7bfaa);logger['info']('delete\x20cron',_0xb7bfaa);}}logger[_0x46cf('0x11')]('toRun',JSON['stringify'](_0xdbd370));for(_0x2007d1=0x0;_0x2007d1<_0xdbd370['length'];_0x2007d1+=0x1){_0xb7bfaa=_0xdbd370[_0x2007d1][_0x46cf('0x59')]();if(_0x2eca2e){logger[_0x46cf('0x11')](JSON[_0x46cf('0x28')](_0x16f392[_0xb7bfaa]));BPromise[_0x46cf('0x5f')]()[_0x46cf('0xe')](handleJob(_0x16f392[_0xb7bfaa]));logger[_0x46cf('0x11')](_0x46cf('0x60'),_0x16f392[_0xb7bfaa]['name'],_0x16f392[_0xb7bfaa]['cron']);}else if(_0x16f392[_0xb7bfaa][_0x46cf('0x61')]&&_0x16f392[_0xb7bfaa]['active']&&moment()[_0x46cf('0x62')](_0x16f392[_0xb7bfaa][_0x46cf('0x63')],_0x16f392[_0xb7bfaa]['endAt'])){manager[_0x46cf('0x64')](_0xb7bfaa,_0x16f392[_0xb7bfaa]['cron'],handleJob(_0x16f392[_0xb7bfaa]));manager[_0x46cf('0x65')](_0xb7bfaa);logger[_0x46cf('0x11')](_0x46cf('0x66'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}else if(manager[_0x46cf('0x5d')](_0xb7bfaa)){manager[_0x46cf('0x3d')](_0xb7bfaa);manager[_0x46cf('0x5e')](_0xb7bfaa);logger[_0x46cf('0x11')](_0x46cf('0x67'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}}for(_0x2007d1=0x0,_0xb7bfaa;_0x2007d1<_0x27091b['length']&&!_0x2eca2e;_0x2007d1+=0x1){_0xb7bfaa=_0x27091b[_0x2007d1][_0x46cf('0x59')]();if(manager[_0x46cf('0x5d')](_0xb7bfaa)){if(_0x16f392[_0xb7bfaa][_0x46cf('0x61')]&&_0x16f392[_0xb7bfaa][_0x46cf('0x68')]&&moment()[_0x46cf('0x62')](_0x16f392[_0xb7bfaa][_0x46cf('0x63')],_0x16f392[_0xb7bfaa][_0x46cf('0x69')])){manager[_0x46cf('0x6a')](_0xb7bfaa,_0x16f392[_0xb7bfaa]['cron'],handleJob(_0x16f392[_0xb7bfaa]));logger[_0x46cf('0x11')](_0x46cf('0x6b'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}else{manager['stop'](_0xb7bfaa);manager[_0x46cf('0x5e')](_0xb7bfaa);logger[_0x46cf('0x11')](_0x46cf('0x67'),_0x16f392[_0xb7bfaa][_0x46cf('0x17')],_0x16f392[_0xb7bfaa][_0x46cf('0x61')]);}}}})[_0x46cf('0xf')](function(_0x31ded8){logger[_0x46cf('0x10')](JSON['stringify'](_0x31ded8));});}exports[_0x46cf('0x6c')]=function(_0x4192cb){return getJobs(_0x4192cb);};exports[_0x46cf('0x65')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xefa1=['map','toString','keyBy','difference','intersection','length','exists','deleteJob','delete\x20cron','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','start','add\x20cron','update\x20cron','run','util','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','client','http','number','AnalyticExtractedReport','then','catch','error','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','existsSync','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','info','email\x20sent','case\x20loading','currentAttempt','retries','data','stop','operation','retry','still\x20loading','case\x20completed','job','case\x20empty','case\x20failed','Unrecognized\x20status:','dataValues','Job\x20ID\x20','\x20Attempt\x20#:','report\x20status:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','runReport','CustomReportId','no\x20report\x20id','Schedule','MailServerOut','keys'];(function(_0x5436f3,_0x36b9b5){var _0x5214e2=function(_0x4d7937){while(--_0x4d7937){_0x5436f3['push'](_0x5436f3['shift']());}};_0x5214e2(++_0x36b9b5);}(_0xefa1,0x15f));var _0x1efa=function(_0x5411b6,_0x362c47){_0x5411b6=_0x5411b6-0x0;var _0x3bd81f=_0xefa1[_0x5411b6];return _0x3bd81f;};'use strict';var fs=require('fs');var util=require(_0x1efa('0x0'));var path=require('path');var _=require(_0x1efa('0x1'));var moment=require('moment');var CronJobManager=require(_0x1efa('0x2'));var jayson=require(_0x1efa('0x3'));var BPromise=require(_0x1efa('0x4'));var logger=require(_0x1efa('0x5'))(_0x1efa('0x6'));var db=require(_0x1efa('0x7'))['db'];const retry=require('retry');var analyticCustomReportController=require(_0x1efa('0x8'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson[_0x1efa('0x9')][_0x1efa('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x4a3f6f){const _0x3f79a9={};if(typeof _0x4a3f6f===_0x1efa('0xb')){_0x3f79a9['id']=_0x4a3f6f;}return db[_0x1efa('0xc')]['findOne']({'where':_0x3f79a9})[_0x1efa('0xd')](function(_0x484443){return _0x484443;})[_0x1efa('0xe')](function(_0x42548b){logger[_0x1efa('0xf')](_0x42548b);});}function handleSendEmail(_0x48f455,_0x95be72){logger['info'](_0x1efa('0x10'),_0x48f455[_0x1efa('0x11')]);var _0x54cb91=!![];var _0x2fab9e=_0x48f455[_0x1efa('0x12')][_0x1efa('0x13')]();var _0x4792b2={'account':_0x2fab9e,'message':{'from':util[_0x1efa('0x14')](_0x1efa('0x15'),_0x48f455[_0x1efa('0x12')]['name'],_0x48f455['MailAccount']['email']||_0x48f455[_0x1efa('0x12')][_0x1efa('0x16')][_0x1efa('0x17')]),'to':_0x48f455[_0x1efa('0x11')],'cc':_0x48f455['cc'],'bcc':_0x48f455[_0x1efa('0x18')],'subject':util[_0x1efa('0x14')](_0x1efa('0x19'),_0x95be72[_0x1efa('0x1a')],_0x48f455[_0x1efa('0x1b')],_0x48f455[_0x1efa('0x1c')])}};var _0x1d1ee9=path[_0x1efa('0x1d')](__dirname,_0x1efa('0x1e'));var _0x39c127=_0x95be72[_0x1efa('0x1f')];var _0x3026c8=util['format'](_0x1efa('0x20'),path[_0x1efa('0x21')](_0x95be72[_0x1efa('0x1f')],path[_0x1efa('0x22')](_0x95be72[_0x1efa('0x1f')])),_0x1efa('0x23'));var _0xb24a6b=path[_0x1efa('0x1d')](_0x1d1ee9,_0x39c127);var _0x482181=path[_0x1efa('0x1d')](_0x1d1ee9,_0x3026c8);if(fs['existsSync'](_0xb24a6b)){_0x95be72[_0x1efa('0x24')]='Sent';_0x4792b2[_0x1efa('0x25')][_0x1efa('0x26')]=[{'filename':_0x39c127,'path':_0xb24a6b}];_0x4792b2['message'][_0x1efa('0x27')]=util['format'](_0x1efa('0x28'),JSON[_0x1efa('0x29')](_0x95be72,null,0x2));}else if(fs[_0x1efa('0x2a')](_0x482181)){_0x95be72[_0x1efa('0x24')]=_0x1efa('0x2b');_0x4792b2[_0x1efa('0x25')][_0x1efa('0x26')]=[{'filename':_0x3026c8,'path':_0x482181}];}else{if(_0x95be72[_0x1efa('0x24')]===_0x1efa('0x2c')){_0x4792b2[_0x1efa('0x25')][_0x1efa('0x27')]=_0x1efa('0x2d');if(!_0x48f455[_0x1efa('0x2e')]){_0x54cb91=![];logger['info'](_0x1efa('0x2f'));}}else if(_0x95be72[_0x1efa('0x24')]===_0x1efa('0x30')){_0x4792b2[_0x1efa('0x25')][_0x1efa('0x27')]=_0x1efa('0x31');}else if(_0x95be72[_0x1efa('0x24')]===_0x1efa('0x32')){_0x4792b2['message'][_0x1efa('0x27')]=_0x1efa('0x33');}else if(_0x95be72['status']===_0x1efa('0x34')){_0x4792b2[_0x1efa('0x25')][_0x1efa('0x27')]=_0x1efa('0x35');}else{logger[_0x1efa('0xf')](_0x1efa('0x36'),_0x95be72['status']);}}if(_0x54cb91){return client[_0x1efa('0x37')](_0x1efa('0x38'),_0x4792b2)['then'](function(_0xc4656){if(_0xc4656['error']){return logger[_0x1efa('0xf')](_0x1efa('0x39'),JSON['stringify'](_0xc4656));}return logger[_0x1efa('0x3a')](_0x1efa('0x3b'));})[_0x1efa('0xe')](function(_0x1fca48){return logger[_0x1efa('0xf')](_0x1efa('0x39'),JSON[_0x1efa('0x29')](_0x1fca48));});}}function handleError(){return function(_0x245df2){return logger['error'](JSON[_0x1efa('0x29')](_0x245df2));};}function loading(_0x474119){logger[_0x1efa('0x3a')](_0x1efa('0x3c'));if(_0x474119[_0x1efa('0x3d')]===_0x474119['retryOptions'][_0x1efa('0x3e')]){handleSendEmail(_0x474119['job'],_0x474119[_0x1efa('0x3f')]);_0x474119['operation'][_0x1efa('0x40')]();}else{_0x474119[_0x1efa('0x41')][_0x1efa('0x42')](_0x1efa('0x43'));}}function completed(_0x16bb12){logger[_0x1efa('0x3a')](_0x1efa('0x44'));handleSendEmail(_0x16bb12[_0x1efa('0x45')],_0x16bb12[_0x1efa('0x3f')]);_0x16bb12[_0x1efa('0x41')][_0x1efa('0x40')]();}function empty(_0x3bb435){logger[_0x1efa('0x3a')](_0x1efa('0x46'));handleSendEmail(_0x3bb435[_0x1efa('0x45')],_0x3bb435[_0x1efa('0x3f')]);_0x3bb435[_0x1efa('0x41')][_0x1efa('0x40')]();}function failed(_0x45536f){logger[_0x1efa('0x3a')](_0x1efa('0x47'));handleSendEmail(_0x45536f[_0x1efa('0x45')],_0x45536f[_0x1efa('0x3f')]);_0x45536f[_0x1efa('0x41')][_0x1efa('0x40')]();}function urecognized(_0x13d0a9){logger[_0x1efa('0xf')](_0x1efa('0x48'),_0x13d0a9['entity'][_0x1efa('0x49')]['status']);_0x13d0a9[_0x1efa('0x41')][_0x1efa('0x40')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x2b231f,_0x44ab29){const _0x56863b={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x15276b=retry['operation'](_0x56863b);_0x15276b['attempt'](_0x2aa593=>{logger[_0x1efa('0x3a')](_0x1efa('0x4a')+_0x2b231f['id']+_0x1efa('0x4b')+_0x2aa593);try{getReportData(_0x44ab29['id'])[_0x1efa('0xd')](function(_0x3d57ea){_0x44ab29=_0x3d57ea;logger[_0x1efa('0x3a')](_0x1efa('0x4c'),_0x3d57ea[_0x1efa('0x49')][_0x1efa('0x24')]);if(!reportStatusStrategies[_0x3d57ea[_0x1efa('0x49')][_0x1efa('0x24')]]){logger[_0x1efa('0xf')](_0x1efa('0x4c'),_0x3d57ea[_0x1efa('0x49')][_0x1efa('0x24')]);_0x15276b['retry']();}reportStatusStrategies[_0x3d57ea['dataValues'][_0x1efa('0x24')]]({'operation':_0x15276b,'currentAttempt':_0x2aa593,'retryOptions':_0x56863b,'job':_0x2b231f,'data':_0x44ab29,'entity':_0x3d57ea});});}catch(_0x4e7aa4){_0x15276b['retry'](_0x4e7aa4);}});}function handleResult(_0x2423cf){return function(_0xcedb4e){if(_0x2423cf[_0x1efa('0x4d')]&&_0x2423cf[_0x1efa('0x12')]&&_0x2423cf[_0x1efa('0x12')][_0x1efa('0x16')]&&!_[_0x1efa('0x4e')](_0x2423cf['email'])){retryer(_0x2423cf,_0xcedb4e);}};}function handleJob(_0x426942){return function(){try{if(_[_0x1efa('0x4e')](_0x426942[_0x1efa('0x1b')])){return logger['info'](_0x1efa('0x4f'));}if(_[_0x1efa('0x4e')](_0x426942[_0x1efa('0x1c')])){return logger[_0x1efa('0x3a')]('subtractUnit\x20null\x20or\x20undefined');}var _0x3e4a0b={'startDate':moment()[_0x1efa('0x50')](_0x426942[_0x1efa('0x1b')],_0x426942['subtractUnit'])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()['format'](_0x1efa('0x51')),'type':'scheduled','output':_0x426942['output'],'name':_0x426942[_0x1efa('0x1a')]};if(!_[_0x1efa('0x4e')](_0x426942[_0x1efa('0x52')])){logger[_0x1efa('0x3a')]('exec\x20defaul\x20report\x20id:%s',_0x426942[_0x1efa('0x52')]);return analyticDefaultReportController[_0x1efa('0x53')]({'id':_0x426942[_0x1efa('0x52')]},_0x3e4a0b)['then'](handleResult(_0x426942))[_0x1efa('0xe')](handleError());}if(!_[_0x1efa('0x4e')](_0x426942[_0x1efa('0x54')])){logger[_0x1efa('0x3a')]('exec\x20custom\x20report\x20id:%s',_0x426942[_0x1efa('0x54')]);return analyticCustomReportController[_0x1efa('0x53')]({'id':_0x426942[_0x1efa('0x54')]},_0x3e4a0b)[_0x1efa('0xd')](handleResult(_0x426942))['catch'](handleError());}}catch(_0x3edf27){logger[_0x1efa('0xf')](JSON[_0x1efa('0x29')](_0x3edf27));}return logger['info'](_0x1efa('0x55'));};}function getJobs(_0x2a8073){var _0xb85d29={};if(_0x2a8073){_0xb85d29['id']=_0x2a8073;}return db[_0x1efa('0x56')]['findAll']({'where':_0xb85d29,'include':[{'model':db[_0x1efa('0x12')],'attributes':['id',_0x1efa('0x1a'),_0x1efa('0x11')],'include':[{'model':db[_0x1efa('0x57')],'as':_0x1efa('0x16'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x1efa('0xd')](function(_0x350e6c){var _0x2bafb2=_[_0x1efa('0x58')](manager['jobs']);var _0xcbbeb6=_[_0x1efa('0x59')](_0x350e6c,function(_0x59e395){return _0x59e395['id'][_0x1efa('0x5a')]();});var _0x43730b=_[_0x1efa('0x5b')](_0x350e6c,function(_0x596665){return _0x596665['id'][_0x1efa('0x5a')]();});var _0x1a328f=_0x2a8073?_0xcbbeb6:_[_0x1efa('0x5c')](_0xcbbeb6,_0x2bafb2);var _0x340df2=_[_0x1efa('0x5d')](_0xcbbeb6,_0x2bafb2);var _0x5a67fe=_[_0x1efa('0x5c')](_0x2bafb2,_0xcbbeb6);var _0x35265b;var _0x4267ce;for(_0x35265b=0x0;_0x35265b<_0x5a67fe[_0x1efa('0x5e')]&&!_0x2a8073;_0x35265b+=0x1){_0x4267ce=_0x5a67fe[_0x35265b][_0x1efa('0x5a')]();if(manager[_0x1efa('0x5f')](_0x4267ce)){manager[_0x1efa('0x40')](_0x4267ce);manager[_0x1efa('0x60')](_0x4267ce);logger[_0x1efa('0x3a')](_0x1efa('0x61'),_0x4267ce);}}logger[_0x1efa('0x3a')]('toRun',JSON[_0x1efa('0x29')](_0x1a328f));for(_0x35265b=0x0;_0x35265b<_0x1a328f[_0x1efa('0x5e')];_0x35265b+=0x1){_0x4267ce=_0x1a328f[_0x35265b][_0x1efa('0x5a')]();if(_0x2a8073){logger[_0x1efa('0x3a')](JSON[_0x1efa('0x29')](_0x43730b[_0x4267ce]));BPromise[_0x1efa('0x62')]()[_0x1efa('0xd')](handleJob(_0x43730b[_0x4267ce]));logger[_0x1efa('0x3a')](_0x1efa('0x63'),_0x43730b[_0x4267ce]['name'],_0x43730b[_0x4267ce][_0x1efa('0x64')]);}else if(_0x43730b[_0x4267ce][_0x1efa('0x64')]&&_0x43730b[_0x4267ce][_0x1efa('0x65')]&&moment()[_0x1efa('0x66')](_0x43730b[_0x4267ce][_0x1efa('0x67')],_0x43730b[_0x4267ce][_0x1efa('0x68')])){manager[_0x1efa('0x69')](_0x4267ce,_0x43730b[_0x4267ce][_0x1efa('0x64')],handleJob(_0x43730b[_0x4267ce]));manager[_0x1efa('0x6a')](_0x4267ce);logger[_0x1efa('0x3a')](_0x1efa('0x6b'),_0x43730b[_0x4267ce][_0x1efa('0x1a')],_0x43730b[_0x4267ce][_0x1efa('0x64')]);}else if(manager['exists'](_0x4267ce)){manager[_0x1efa('0x40')](_0x4267ce);manager[_0x1efa('0x60')](_0x4267ce);logger['info']('stop\x20cron',_0x43730b[_0x4267ce][_0x1efa('0x1a')],_0x43730b[_0x4267ce][_0x1efa('0x64')]);}}for(_0x35265b=0x0,_0x4267ce;_0x35265b<_0x340df2[_0x1efa('0x5e')]&&!_0x2a8073;_0x35265b+=0x1){_0x4267ce=_0x340df2[_0x35265b][_0x1efa('0x5a')]();if(manager[_0x1efa('0x5f')](_0x4267ce)){if(_0x43730b[_0x4267ce][_0x1efa('0x64')]&&_0x43730b[_0x4267ce][_0x1efa('0x65')]&&moment()['isBetween'](_0x43730b[_0x4267ce][_0x1efa('0x67')],_0x43730b[_0x4267ce][_0x1efa('0x68')])){manager['update'](_0x4267ce,_0x43730b[_0x4267ce][_0x1efa('0x64')],handleJob(_0x43730b[_0x4267ce]));logger[_0x1efa('0x3a')](_0x1efa('0x6c'),_0x43730b[_0x4267ce][_0x1efa('0x1a')],_0x43730b[_0x4267ce]['cron']);}else{manager[_0x1efa('0x40')](_0x4267ce);manager['deleteJob'](_0x4267ce);logger[_0x1efa('0x3a')]('stop\x20cron',_0x43730b[_0x4267ce][_0x1efa('0x1a')],_0x43730b[_0x4267ce][_0x1efa('0x64')]);}}}})[_0x1efa('0xe')](function(_0x44574d){logger[_0x1efa('0xf')](JSON['stringify'](_0x44574d));});}exports[_0x1efa('0x6d')]=function(_0x264245){return getJobs(_0x264245);};exports[_0x1efa('0x6a')]=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 4a7d811..08c27f3 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 _0x3715=['Comprehend','detectSentiment','substring','info','format','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','bucket','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','transcribeAccountId','findOne','forEach','inspect','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3715,0xc3));var _0x5371=function(_0xb219c6,_0x2d7100){_0xb219c6=_0xb219c6-0x0;var _0xc188e9=_0x3715[_0xb219c6];return _0xc188e9;};var _=require(_0x5371('0x0'));var AWS=require(_0x5371('0x1'));var rp=require(_0x5371('0x2'));var util=require(_0x5371('0x3'));var BPromise=require(_0x5371('0x4'));var db=require(_0x5371('0x5'))['db'];var logger=require(_0x5371('0x6'))(_0x5371('0x7'));function getTranscriptionJob(_0x3ff067,_0x355d6a,_0x13c458,_0x368886){return new Promise(function(_0x50a759,_0x1ffdcb){var _0x340e44=new AWS['TranscribeService']({'accessKeyId':_0x355d6a,'secretAccessKey':_0x3ff067,'region':_0x13c458});_0x340e44[_0x5371('0x8')]({'TranscriptionJobName':_0x368886},function(_0x16c64a,_0x41d142){if(_0x16c64a){return _0x1ffdcb(_0x16c64a);}else{return _0x50a759(_0x41d142);}});});}function sentiment(_0x56debd,_0xdbc695,_0x48b76c,_0x56e64c,_0x36760c){return new Promise(function(_0x1f7021,_0x6b17f8){var _0x55f6f6=new AWS[(_0x5371('0x9'))]({'accessKeyId':_0xdbc695,'secretAccessKey':_0x56debd,'region':_0x48b76c});_0x55f6f6[_0x5371('0xa')]({'Text':_0x56e64c,'LanguageCode':_0x36760c[_0x5371('0xb')](0x0,0x2)},function(_0x55653f,_0x4df51b){if(_0x55653f){return _0x6b17f8(_0x55653f);}else{return _0x1f7021(_0x4df51b);}});});}function checkTranscribeJob(_0x2207f2,_0x1faac2,_0x1b0a8a){var _0x5b4adf;return new BPromise(function(_0x445408,_0x4c5df6){logger[_0x5371('0xc')](util[_0x5371('0xd')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x2207f2['id'],_0x2207f2[_0x5371('0xe')]));return getTranscriptionJob(_0x1b0a8a[_0x5371('0xf')],_0x1b0a8a[_0x5371('0x10')],_0x1faac2[_0x5371('0x11')],_0x2207f2[_0x5371('0xe')])[_0x5371('0x12')](function(_0x33b592){logger['info'](util[_0x5371('0xd')](_0x5371('0x13'),_0x2207f2['id'],_0x2207f2[_0x5371('0xe')],_0x33b592[_0x5371('0x14')][_0x5371('0x15')]));if(!_0x2207f2[_0x5371('0x16')]){switch(_0x33b592[_0x5371('0x14')]['TranscriptionJobStatus']){case'COMPLETED':var _0x250ca4={'transcribeStatus':_0x33b592['TranscriptionJob'][_0x5371('0x15')],'fileUri':_0x33b592['TranscriptionJob'][_0x5371('0x17')][_0x5371('0x18')]};logger['info'](util[_0x5371('0xd')](_0x5371('0x19'),_0x2207f2['id']));return rp({'uri':_0x33b592['TranscriptionJob'][_0x5371('0x17')][_0x5371('0x18')],'json':!![]})[_0x5371('0x12')](function(_0x5eacf2){logger['info'](util['format'](_0x5371('0x1a'),_0x2207f2['id']));if(_0x5eacf2&&_0x5eacf2[_0x5371('0x1b')]&&_0x5eacf2[_0x5371('0x1b')][_0x5371('0x1c')]&&_0x5eacf2[_0x5371('0x1b')][_0x5371('0x1c')]['length']){_0x250ca4[_0x5371('0x16')]='';for(var _0x4992e4=0x0;_0x4992e4<_0x5eacf2[_0x5371('0x1b')]['transcripts'][_0x5371('0x1d')];_0x4992e4++){_0x250ca4[_0x5371('0x16')]+=_0x5eacf2['results'][_0x5371('0x1c')][_0x4992e4][_0x5371('0x1e')]+'';}}return _0x2207f2[_0x5371('0x1f')](_0x250ca4);})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2207f2['id']));if(!_0x2207f2[_0x5371('0x20')]){throw new db['Sequelize']['ValidationError'](_0x5371('0x21'));}if(!_0x1faac2[_0x5371('0x22')]||!_0x1faac2['sentimentAccountId']||!_0x1faac2[_0x5371('0x23')]||!_0x1faac2[_0x5371('0x24')]||!_0x1faac2[_0x5371('0x25')]){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x28'));}if(!_0x250ca4[_0x5371('0x16')]){throw new Error(_0x5371('0x29'));}if(_0x1faac2[_0x5371('0x2a')]===_0x1b0a8a['id']){return _0x1b0a8a;}else{return db[_0x5371('0x2b')]['findOne']({'where':{'id':_settings[_0x5371('0x2a')]}});}})['then'](function(_0x2f24b1){if(!_0x2f24b1){throw new db['Sequelize']['ValidationError'](_0x5371('0x2c'));}if(!_0x2f24b1[_0x5371('0xf')]||!_0x2f24b1[_0x5371('0x10')]){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x2d'));}_0x5b4adf=_0x2f24b1;logger['info'](util[_0x5371('0xd')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2207f2['id']));return sentiment(_0x5b4adf[_0x5371('0xf')],_0x5b4adf[_0x5371('0x10')],_0x1faac2[_0x5371('0x23')],_0x250ca4[_0x5371('0x16')],_0x1faac2[_0x5371('0x24')]);})[_0x5371('0x12')](function(_0x120ee1){logger['info'](util[_0x5371('0xd')](_0x5371('0x2e'),_0x2207f2['id']));return _0x2207f2[_0x5371('0x1f')]({'sentiment':_0x120ee1[_0x5371('0x2f')],'sPositive':_0x120ee1[_0x5371('0x30')][_0x5371('0x31')],'sNegative':_0x120ee1[_0x5371('0x30')]['Negative'],'sMixed':_0x120ee1[_0x5371('0x30')][_0x5371('0x32')],'sNeutral':_0x120ee1['SentimentScore'][_0x5371('0x33')]});})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util[_0x5371('0xd')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x2207f2['id']));_0x445408();});case _0x5371('0x34'):return _0x2207f2[_0x5371('0x1f')]({'transcribeStatus':'FAILED','failureReason':_0x33b592[_0x5371('0x14')][_0x5371('0x35')]})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util[_0x5371('0xd')](_0x5371('0x36'),_0x2207f2['id']));_0x445408();});default:logger[_0x5371('0xc')](util[_0x5371('0xd')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x2207f2['id']));break;}}else{return BPromise[_0x5371('0x37')]()[_0x5371('0x12')](function(){if(!_0x2207f2[_0x5371('0x20')]){throw new db[(_0x5371('0x26'))]['ValidationError'](_0x5371('0x21'));}if(!_0x1faac2[_0x5371('0x22')]||!_0x1faac2[_0x5371('0x2a')]||!_0x1faac2[_0x5371('0x23')]||!_0x1faac2[_0x5371('0x24')]||!_0x1faac2[_0x5371('0x25')]){throw new db['Sequelize'][(_0x5371('0x27'))](_0x5371('0x28'));}if(!_0x2207f2[_0x5371('0x16')]){throw new Error(_0x5371('0x29'));}if(_0x1faac2[_0x5371('0x2a')]===_0x1b0a8a['id']){return _0x1b0a8a;}else{return db[_0x5371('0x2b')]['findOne']({'where':{'id':_settings[_0x5371('0x2a')]}});}})[_0x5371('0x12')](function(_0x711476){if(!_0x711476){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x2c'));}if(!_0x711476['data1']||!_0x711476[_0x5371('0x10')]){throw new db['Sequelize']['ValidationError'](_0x5371('0x2d'));}_0x5b4adf=_0x711476;logger['info'](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x2207f2['id']));return sentiment(_0x5b4adf[_0x5371('0xf')],_0x5b4adf[_0x5371('0x10')],_0x1faac2[_0x5371('0x23')],_0x2207f2['fileText'],_0x1faac2[_0x5371('0x24')]);})[_0x5371('0x12')](function(_0x5c05d7){logger['info'](util[_0x5371('0xd')](_0x5371('0x2e'),_0x2207f2['id']));return _0x2207f2[_0x5371('0x1f')]({'sentiment':_0x5c05d7[_0x5371('0x2f')],'sPositive':_0x5c05d7['SentimentScore']['Positive'],'sNegative':_0x5c05d7['SentimentScore']['Negative'],'sMixed':_0x5c05d7['SentimentScore'][_0x5371('0x32')],'sNeutral':_0x5c05d7['SentimentScore'][_0x5371('0x33')],'transcribeStatus':'COMPLETED'});})[_0x5371('0x12')](function(){logger[_0x5371('0xc')](util[_0x5371('0xd')](_0x5371('0x36'),_0x2207f2['id']));_0x445408();});}})['catch'](function(_0x434ea9){if(_0x434ea9){if(!_0x434ea9[_0x5371('0x38')]||_0x434ea9['name']!==_0x5371('0x39')){logger[_0x5371('0x3a')](util['format'](_0x5371('0x3b'),_0x2207f2['id']),util['inspect'](_0x434ea9,{'showHidden':![],'depth':null}));}}_0x445408();});});}function checkTranscribe(){var _0x594710;var _0x394fad;var _0x179163;return db[_0x5371('0x3c')][_0x5371('0x3d')]({'where':{'transcribeStatus':_0x5371('0x3e')}})[_0x5371('0x12')](function(_0x10e42f){if(!_0x10e42f||!_0x10e42f['length']){throw new db[(_0x5371('0x26'))][(_0x5371('0x27'))](_0x5371('0x3f'));}_0x594710=_0x10e42f;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x5371('0x12')](function(_0x334b29){if(!_0x334b29){throw new db['Sequelize'][(_0x5371('0x27'))]('Settings\x20not\x20available');}_0x394fad=_0x334b29;if(!_0x394fad[_0x5371('0x7')]||!_0x394fad[_0x5371('0x40')]||!_0x394fad[_0x5371('0x11')]||!_0x394fad[_0x5371('0x24')]||!_0x394fad['bucket']){throw new db[(_0x5371('0x26'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x5371('0x2b')][_0x5371('0x41')]({'where':{'id':_0x394fad[_0x5371('0x40')]}});})['then'](function(_0x1a2512){if(!_0x1a2512){throw new db['Sequelize'][(_0x5371('0x27'))](_0x5371('0x2c'));}if(!_0x1a2512['data1']||!_0x1a2512[_0x5371('0x10')]){throw new db[(_0x5371('0x26'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x179163=_0x1a2512;var _0x343584=[];_0x594710[_0x5371('0x42')](function(_0x17bf6f){_0x343584['push'](checkTranscribeJob(_0x17bf6f,_0x394fad,_0x179163));});return BPromise['all'](_0x343584);})['catch'](function(_0x15e7e1){if(_0x15e7e1){if(!_0x15e7e1[_0x5371('0x38')]||_0x15e7e1[_0x5371('0x38')]!==_0x5371('0x39')){logger[_0x5371('0x3a')](util[_0x5371('0x43')](_0x15e7e1,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x5825=['[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','update','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','catch','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','all','start','lodash','aws-sdk','request-promise','util','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','substring','info','format','transcribeName','data1','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','[RECORDING:%d]\x20Get\x20transcript','TranscriptFileUri','then'];(function(_0x2fc911,_0x519be6){var _0x1cbf74=function(_0x1127a3){while(--_0x1127a3){_0x2fc911['push'](_0x2fc911['shift']());}};_0x1cbf74(++_0x519be6);}(_0x5825,0x78));var _0x5582=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x5825[_0x4a9fb1];return _0x348672;};var _=require(_0x5582('0x0'));var AWS=require(_0x5582('0x1'));var rp=require(_0x5582('0x2'));var util=require(_0x5582('0x3'));var BPromise=require('bluebird');var db=require(_0x5582('0x4'))['db'];var logger=require('../../config/logger')(_0x5582('0x5'));function getTranscriptionJob(_0x2dbcea,_0x3713d6,_0x2d2e03,_0xeba364){return new Promise(function(_0x11eb87,_0x17a897){var _0x5d618a=new AWS[(_0x5582('0x6'))]({'accessKeyId':_0x3713d6,'secretAccessKey':_0x2dbcea,'region':_0x2d2e03});_0x5d618a[_0x5582('0x7')]({'TranscriptionJobName':_0xeba364},function(_0x39b66,_0x5fa603){if(_0x39b66){return _0x17a897(_0x39b66);}else{return _0x11eb87(_0x5fa603);}});});}function sentiment(_0x5e8681,_0x2904ad,_0x3aa455,_0x24413f,_0x4eacaa){return new Promise(function(_0x40215a,_0xd1cc57){var _0x1fb98c=new AWS['Comprehend']({'accessKeyId':_0x2904ad,'secretAccessKey':_0x5e8681,'region':_0x3aa455});_0x1fb98c[_0x5582('0x8')]({'Text':_0x24413f,'LanguageCode':_0x4eacaa[_0x5582('0x9')](0x0,0x2)},function(_0x542179,_0x421f72){if(_0x542179){return _0xd1cc57(_0x542179);}else{return _0x40215a(_0x421f72);}});});}function checkTranscribeJob(_0xac1c6b,_0x4798d6,_0x5a9a4e){var _0x132be7;return new BPromise(function(_0x4fb9a5,_0x583fb7){logger[_0x5582('0xa')](util[_0x5582('0xb')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0xac1c6b['id'],_0xac1c6b[_0x5582('0xc')]));return getTranscriptionJob(_0x5a9a4e[_0x5582('0xd')],_0x5a9a4e['data2'],_0x4798d6[_0x5582('0xe')],_0xac1c6b[_0x5582('0xc')])['then'](function(_0x511268){logger[_0x5582('0xa')](util['format'](_0x5582('0xf'),_0xac1c6b['id'],_0xac1c6b[_0x5582('0xc')],_0x511268[_0x5582('0x10')][_0x5582('0x11')]));if(!_0xac1c6b[_0x5582('0x12')]){switch(_0x511268[_0x5582('0x10')][_0x5582('0x11')]){case _0x5582('0x13'):var _0x563ac0={'transcribeStatus':_0x511268[_0x5582('0x10')][_0x5582('0x11')],'fileUri':_0x511268[_0x5582('0x10')][_0x5582('0x14')]['TranscriptFileUri']};logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x15'),_0xac1c6b['id']));return rp({'uri':_0x511268[_0x5582('0x10')][_0x5582('0x14')][_0x5582('0x16')],'json':!![]})[_0x5582('0x17')](function(_0x3efcfb){logger[_0x5582('0xa')](util['format'](_0x5582('0x18'),_0xac1c6b['id']));if(_0x3efcfb&&_0x3efcfb['results']&&_0x3efcfb[_0x5582('0x19')]['transcripts']&&_0x3efcfb[_0x5582('0x19')]['transcripts']['length']){_0x563ac0[_0x5582('0x12')]='';for(var _0xbd8cb4=0x0;_0xbd8cb4<_0x3efcfb[_0x5582('0x19')][_0x5582('0x1a')][_0x5582('0x1b')];_0xbd8cb4++){_0x563ac0[_0x5582('0x12')]+=_0x3efcfb['results'][_0x5582('0x1a')][_0xbd8cb4]['transcript']+'';}}return _0xac1c6b[_0x5582('0x1c')](_0x563ac0);})[_0x5582('0x17')](function(){logger['info'](util[_0x5582('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xac1c6b['id']));if(!_0xac1c6b[_0x5582('0x1d')]){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))](_0x5582('0x20'));}if(!_0x4798d6[_0x5582('0x21')]||!_0x4798d6[_0x5582('0x22')]||!_0x4798d6[_0x5582('0x23')]||!_0x4798d6[_0x5582('0x24')]||!_0x4798d6[_0x5582('0x25')]){throw new db['Sequelize'][(_0x5582('0x1f'))](_0x5582('0x26'));}if(!_0x563ac0[_0x5582('0x12')]){throw new Error(_0x5582('0x27'));}if(_0x4798d6[_0x5582('0x22')]===_0x5a9a4e['id']){return _0x5a9a4e;}else{return db[_0x5582('0x28')][_0x5582('0x29')]({'where':{'id':_settings[_0x5582('0x22')]}});}})['then'](function(_0xa4b2ca){if(!_0xa4b2ca){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))](_0x5582('0x2a'));}if(!_0xa4b2ca['data1']||!_0xa4b2ca[_0x5582('0x2b')]){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x2c'));}_0x132be7=_0xa4b2ca;logger['info'](util[_0x5582('0xb')](_0x5582('0x2d'),_0xac1c6b['id']));return sentiment(_0x132be7['data1'],_0x132be7[_0x5582('0x2b')],_0x4798d6[_0x5582('0x23')],_0x563ac0[_0x5582('0x12')],_0x4798d6[_0x5582('0x24')]);})[_0x5582('0x17')](function(_0x8fec59){logger[_0x5582('0xa')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0xac1c6b['id']));return _0xac1c6b[_0x5582('0x1c')]({'sentiment':_0x8fec59[_0x5582('0x2e')],'sPositive':_0x8fec59[_0x5582('0x2f')]['Positive'],'sNegative':_0x8fec59['SentimentScore']['Negative'],'sMixed':_0x8fec59['SentimentScore'][_0x5582('0x30')],'sNeutral':_0x8fec59[_0x5582('0x2f')][_0x5582('0x31')]});})[_0x5582('0x17')](function(){logger[_0x5582('0xa')](util[_0x5582('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0xac1c6b['id']));_0x4fb9a5();});case'FAILED':return _0xac1c6b[_0x5582('0x1c')]({'transcribeStatus':_0x5582('0x32'),'failureReason':_0x511268[_0x5582('0x10')][_0x5582('0x33')]})[_0x5582('0x17')](function(){logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x34'),_0xac1c6b['id']));_0x4fb9a5();});default:logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x35'),_0xac1c6b['id']));break;}}else{return BPromise[_0x5582('0x36')]()['then'](function(){if(!_0xac1c6b[_0x5582('0x1d')]){throw new db['Sequelize']['ValidationError'](_0x5582('0x20'));}if(!_0x4798d6['sentiment']||!_0x4798d6[_0x5582('0x22')]||!_0x4798d6[_0x5582('0x23')]||!_0x4798d6[_0x5582('0x24')]||!_0x4798d6[_0x5582('0x25')]){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x26'));}if(!_0xac1c6b[_0x5582('0x12')]){throw new Error('Transcript\x20not\x20available');}if(_0x4798d6[_0x5582('0x22')]===_0x5a9a4e['id']){return _0x5a9a4e;}else{return db[_0x5582('0x28')][_0x5582('0x29')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x5582('0x17')](function(_0x2f394f){if(!_0x2f394f){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))](_0x5582('0x2a'));}if(!_0x2f394f[_0x5582('0xd')]||!_0x2f394f[_0x5582('0x2b')]){throw new db[(_0x5582('0x1e'))][(_0x5582('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x132be7=_0x2f394f;logger['info'](util['format'](_0x5582('0x2d'),_0xac1c6b['id']));return sentiment(_0x132be7['data1'],_0x132be7['data2'],_0x4798d6['sentimentRegion'],_0xac1c6b[_0x5582('0x12')],_0x4798d6[_0x5582('0x24')]);})[_0x5582('0x17')](function(_0x323cb6){logger[_0x5582('0xa')](util['format'](_0x5582('0x37'),_0xac1c6b['id']));return _0xac1c6b[_0x5582('0x1c')]({'sentiment':_0x323cb6[_0x5582('0x2e')],'sPositive':_0x323cb6[_0x5582('0x2f')][_0x5582('0x38')],'sNegative':_0x323cb6[_0x5582('0x2f')]['Negative'],'sMixed':_0x323cb6[_0x5582('0x2f')][_0x5582('0x30')],'sNeutral':_0x323cb6[_0x5582('0x2f')][_0x5582('0x31')],'transcribeStatus':_0x5582('0x13')});})[_0x5582('0x17')](function(){logger[_0x5582('0xa')](util[_0x5582('0xb')](_0x5582('0x34'),_0xac1c6b['id']));_0x4fb9a5();});}})[_0x5582('0x39')](function(_0x154a12){if(_0x154a12){if(!_0x154a12[_0x5582('0x3a')]||_0x154a12['name']!==_0x5582('0x3b')){logger[_0x5582('0x3c')](util[_0x5582('0xb')](_0x5582('0x3d'),_0xac1c6b['id']),util[_0x5582('0x3e')](_0x154a12,{'showHidden':![],'depth':null}));}}_0x4fb9a5();});});}function checkTranscribe(){var _0x2ac99a;var _0x3eb692;var _0x5632ed;return db['VoiceRecording'][_0x5582('0x3f')]({'where':{'transcribeStatus':'IN_PROGRESS'}})[_0x5582('0x17')](function(_0xdff3a0){if(!_0xdff3a0||!_0xdff3a0[_0x5582('0x1b')]){throw new db['Sequelize'][(_0x5582('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2ac99a=_0xdff3a0;return db[_0x5582('0x40')]['findOne']({'where':{'id':0x1}});})[_0x5582('0x17')](function(_0x201bd7){if(!_0x201bd7){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x41'));}_0x3eb692=_0x201bd7;if(!_0x3eb692[_0x5582('0x5')]||!_0x3eb692['transcribeAccountId']||!_0x3eb692[_0x5582('0xe')]||!_0x3eb692[_0x5582('0x24')]||!_0x3eb692[_0x5582('0x25')]){throw new db[(_0x5582('0x1e'))]['ValidationError'](_0x5582('0x42'));}return db[_0x5582('0x28')][_0x5582('0x29')]({'where':{'id':_0x3eb692[_0x5582('0x43')]}});})[_0x5582('0x17')](function(_0x4c23cb){if(!_0x4c23cb){throw new db['Sequelize']['ValidationError'](_0x5582('0x2a'));}if(!_0x4c23cb['data1']||!_0x4c23cb[_0x5582('0x2b')]){throw new db['Sequelize'][(_0x5582('0x1f'))](_0x5582('0x2c'));}_0x5632ed=_0x4c23cb;var _0x178575=[];_0x2ac99a[_0x5582('0x44')](function(_0x3d12b4){_0x178575[_0x5582('0x45')](checkTranscribeJob(_0x3d12b4,_0x3eb692,_0x5632ed));});return BPromise[_0x5582('0x46')](_0x178575);})[_0x5582('0x39')](function(_0x1cc436){if(_0x1cc436){if(!_0x1cc436[_0x5582('0x3a')]||_0x1cc436[_0x5582('0x3a')]!=='SequelizeValidationError'){logger[_0x5582('0x3c')](util['inspect'](_0x1cc436,{'showHidden':![],'depth':null}));}}});}exports[_0x5582('0x47')]=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 87dd02a..2330bd3 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 _0x048d=['length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','update','system','timeout','format','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment','../../mysqldb','../logger','schedule','redis','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then'];(function(_0x495234,_0x5f02a6){var _0x498c37=function(_0x54ac77){while(--_0x54ac77){_0x495234['push'](_0x495234['shift']());}};_0x498c37(++_0x5f02a6);}(_0x048d,0x1c3));var _0xd048=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x048d[_0x4ae459];return _0x51d0c9;};'use strict';var _=require('lodash');var moment=require(_0xd048('0x0'));var Redis=require(_0xd048('0x1'));var util=require(_0xd048('0x2'));var config=require(_0xd048('0x3'));var db=require(_0xd048('0x4'))['db'];var logger=require(_0xd048('0x5'))(_0xd048('0x6'));config['redis']=_['defaults'](config[_0xd048('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0xd048('0x8'))(new Redis(config[_0xd048('0x7')]));function closeInteractions(){var _0x1a50e2=[];return db['WhatsappInteraction'][_0xd048('0x9')]({'raw':!![],'attributes':['id',_0xd048('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xd048('0xb')](0x18,_0xd048('0xc'))}}})[_0xd048('0xd')](function(_0x18f9c1){if(_0x18f9c1&&_0x18f9c1[_0xd048('0xe')]){_0x1a50e2=_[_0xd048('0xf')](_0x18f9c1||[],'id');logger[_0xd048('0x10')](_0xd048('0x11'),_0x1a50e2[_0xd048('0x12')]());return db[_0xd048('0x13')][_0xd048('0x14')]({'closeReason':_0xd048('0x15'),'disposition':_0xd048('0x16'),'closed':!![],'closedAt':moment()[_0xd048('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1a50e2}});}})['then'](function(){if(_0x1a50e2&&_0x1a50e2[_0xd048('0xe')]){logger[_0xd048('0x10')](_0xd048('0x18'),_0x1a50e2[_0xd048('0x12')]());for(var _0x4b660c=0x0;_0x4b660c<_0x1a50e2[_0xd048('0xe')];_0x4b660c++){io[_0xd048('0x19')](_0xd048('0x1a'),{'id':_0x1a50e2[_0x4b660c],'closed':!![]});}}})[_0xd048('0x1b')](function(_0x3b8ae5){logger[_0xd048('0x1c')](_0xd048('0x1d'),_0x3b8ae5?util['inspect'](_0x3b8ae5,{'showHidden':![],'depth':null}):'');});}exports[_0xd048('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xf5a7=['../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','inspect','start','lodash','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf5a7,0xf5));var _0x7f5a=function(_0x55a49b,_0x471c28){_0x55a49b=_0x55a49b-0x0;var _0x24c052=_0xf5a7[_0x55a49b];return _0x24c052;};'use strict';var _=require(_0x7f5a('0x0'));var moment=require(_0x7f5a('0x1'));var Redis=require(_0x7f5a('0x2'));var util=require('util');var config=require(_0x7f5a('0x3'));var db=require(_0x7f5a('0x4'))['db'];var logger=require(_0x7f5a('0x5'))('schedule');config[_0x7f5a('0x6')]=_[_0x7f5a('0x7')](config[_0x7f5a('0x6')],{'host':_0x7f5a('0x8'),'port':0x18eb});var io=require(_0x7f5a('0x9'))(new Redis(config[_0x7f5a('0x6')]));function closeInteractions(){var _0x141f34=[];return db[_0x7f5a('0xa')][_0x7f5a('0xb')]({'raw':!![],'attributes':['id',_0x7f5a('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x7f5a('0xd')](0x18,'hours')}}})[_0x7f5a('0xe')](function(_0x286a54){if(_0x286a54&&_0x286a54[_0x7f5a('0xf')]){_0x141f34=_[_0x7f5a('0x10')](_0x286a54||[],'id');logger[_0x7f5a('0x11')](_0x7f5a('0x12'),_0x141f34[_0x7f5a('0x13')]());return db[_0x7f5a('0xa')][_0x7f5a('0x14')]({'closeReason':_0x7f5a('0x15'),'disposition':_0x7f5a('0x16'),'closed':!![],'closedAt':moment()[_0x7f5a('0x17')](_0x7f5a('0x18'))},{'where':{'id':_0x141f34}});}})[_0x7f5a('0xe')](function(){if(_0x141f34&&_0x141f34[_0x7f5a('0xf')]){logger['info'](_0x7f5a('0x19'),_0x141f34['join']());for(var _0x461730=0x0;_0x461730<_0x141f34['length'];_0x461730++){io[_0x7f5a('0x1a')](_0x7f5a('0x1b'),{'id':_0x141f34[_0x461730],'closed':!![]});}}})[_0x7f5a('0x1c')](function(_0x4213c3){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x4213c3?util[_0x7f5a('0x1d')](_0x4213c3,{'showHidden':![],'depth':null}):'');});}exports[_0x7f5a('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 317610d..6a3938b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe01c=['now','Biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com'];(function(_0x10dbf6,_0x3ff964){var _0x452147=function(_0x7476e0){while(--_0x7476e0){_0x10dbf6['push'](_0x10dbf6['shift']());}};_0x452147(++_0x3ff964);}(_0xe01c,0x1f2));var _0xce01=function(_0x16990f,_0x66dccd){_0x16990f=_0x16990f-0x0;var _0x4efc92=_0xe01c[_0x16990f];return _0x4efc92;};'use strict';var util=require(_0xce01('0x0'));var db=require(_0xce01('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xce01('0x2')]({'id':i,'firstName':_0xce01('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xce01('0x4')+i+_0xce01('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0xce01('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xce01('0x6')](),'updatedAt':Date[_0xce01('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xce01('0x7')+i,'phone':0xf879fb460+i,'email':_0xce01('0x4')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xce01('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xce01('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0xce01('0x6')]()});}db[_0xce01('0x8')][_0xce01('0x9')]({'where':{}})[_0xce01('0xa')](function(){return db[_0xce01('0x8')][_0xce01('0xb')](contacts);})['then'](function(){console[_0xce01('0xc')](_0xce01('0xd'),_0xce01('0xe'));return db[_0xce01('0xf')][_0xce01('0x9')]({'where':{}});})[_0xce01('0xa')](function(){return db[_0xce01('0xf')][_0xce01('0xb')](hopper);})[_0xce01('0xa')](function(){console['log'](_0xce01('0xd'),_0xce01('0x10'));return db[_0xce01('0x8')][_0xce01('0xb')](contacts2);})[_0xce01('0xa')](function(){console['log']('finished\x20populating',_0xce01('0x11'));return db[_0xce01('0xf')]['bulkCreate'](hopper2);})[_0xce01('0xa')](function(){console[_0xce01('0xc')](_0xce01('0xd'),'hopper2');})['catch'](function(_0x186708){console[_0xce01('0xc')](_0x186708);}); \ No newline at end of file +var _0x3efb=['finished\x20populating','hopper2','catch','util','../mysqldb','push','now','Innocenzo','Biondo','innocenzo.biondo','CmContact','destroy','then','contacts1','bulkCreate','log','hopper1','contacts2','CmHopper'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x3efb,0x9b));var _0xb3ef=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0x3efb[_0x55d8c5];return _0x225ae5;};'use strict';var util=require(_0xb3ef('0x0'));var db=require(_0xb3ef('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xb3ef('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb3ef('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xb3ef('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb3ef('0x3')](),'updatedAt':Date[_0xb3ef('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb3ef('0x2')]({'id':i,'firstName':_0xb3ef('0x4')+i,'lastName':_0xb3ef('0x5')+i,'phone':0xf879fb460+i,'email':_0xb3ef('0x6')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0xb3ef('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb3ef('0x3')](),'updatedAt':Date['now']()});}db[_0xb3ef('0x7')][_0xb3ef('0x8')]({'where':{}})[_0xb3ef('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})['then'](function(){console['log']('finished\x20populating',_0xb3ef('0xa'));return db['CmHopper'][_0xb3ef('0x8')]({'where':{}});})[_0xb3ef('0x9')](function(){return db['CmHopper'][_0xb3ef('0xb')](hopper);})[_0xb3ef('0x9')](function(){console[_0xb3ef('0xc')]('finished\x20populating',_0xb3ef('0xd'));return db[_0xb3ef('0x7')]['bulkCreate'](contacts2);})[_0xb3ef('0x9')](function(){console['log']('finished\x20populating',_0xb3ef('0xe'));return db[_0xb3ef('0xf')][_0xb3ef('0xb')](hopper2);})[_0xb3ef('0x9')](function(){console[_0xb3ef('0xc')](_0xb3ef('0x10'),_0xb3ef('0x11'));})[_0xb3ef('0x12')](function(_0x587114){console[_0xb3ef('0xc')](_0x587114);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 7f880bd..3cb8035 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6e7e=['\x22%s\x22\x20<%s>','User','bulkCreate','log','add\x20user','catch','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass'];(function(_0x5ad8d2,_0x3fcef3){var _0x27a8e1=function(_0x5631fb){while(--_0x5631fb){_0x5ad8d2['push'](_0x5ad8d2['shift']());}};_0x27a8e1(++_0x3fcef3);}(_0x6e7e,0x146));var _0xe6e7=function(_0x129102,_0x3ac9c9){_0x129102=_0x129102-0x0;var _0x346551=_0x6e7e[_0x129102];return _0x346551;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xe6e7('0x0')]({'name':util[_0xe6e7('0x1')](_0xe6e7('0x2'),_0xe6e7('0x3'),i),'fullname':util[_0xe6e7('0x1')](_0xe6e7('0x2'),_0xe6e7('0x3'),i),'email':util['format'](_0xe6e7('0x4'),_0xe6e7('0x3'),i),'role':_0xe6e7('0x3'),'password':_0xe6e7('0x5'),'internal':0xfa0+i,'type':_0xe6e7('0x6'),'transport':[_0xe6e7('0x7'),'ws',_0xe6e7('0x8')],'disallow':[_0xe6e7('0x9')],'allow':[_0xe6e7('0xa')],'defaultuser':util[_0xe6e7('0x1')](_0xe6e7('0x2'),'agent',i),'encryption':_0xe6e7('0xb'),'avpf':_0xe6e7('0xb'),'force_avp':_0xe6e7('0xb'),'icesupport':_0xe6e7('0xb'),'dtlsenable':_0xe6e7('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xe6e7('0xc'),'dtlssetup':_0xe6e7('0xd'),'callerid':util[_0xe6e7('0x1')](_0xe6e7('0xe'),util[_0xe6e7('0x1')](_0xe6e7('0x2'),'agent',i),0xfa0+i)});}db[_0xe6e7('0xf')][_0xe6e7('0x10')](users)['then'](function(){console[_0xe6e7('0x11')](_0xe6e7('0x12'));})[_0xe6e7('0x13')](function(_0x2c65b0){console[_0xe6e7('0x11')](_0x2c65b0);}); \ No newline at end of file +var _0x220d=['yes','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','catch','../mysqldb','format','agent','%s%s','%s%s@xcally.com','password','friend','udp','wss','all','ulaw'];(function(_0x27cb48,_0x2e432e){var _0x3387cb=function(_0x3f221f){while(--_0x3f221f){_0x27cb48['push'](_0x27cb48['shift']());}};_0x3387cb(++_0x2e432e);}(_0x220d,0xb3));var _0xd220=function(_0x251941,_0x2ce3f8){_0x251941=_0x251941-0x0;var _0x5029d4=_0x220d[_0x251941];return _0x5029d4;};'use strict';var util=require('util');var db=require(_0xd220('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util[_0xd220('0x1')]('%s%s',_0xd220('0x2'),i),'fullname':util[_0xd220('0x1')](_0xd220('0x3'),_0xd220('0x2'),i),'email':util[_0xd220('0x1')](_0xd220('0x4'),'agent',i),'role':'agent','password':_0xd220('0x5'),'internal':0xfa0+i,'type':_0xd220('0x6'),'transport':[_0xd220('0x7'),'ws',_0xd220('0x8')],'disallow':[_0xd220('0x9')],'allow':[_0xd220('0xa')],'defaultuser':util['format']('%s%s',_0xd220('0x2'),i),'encryption':_0xd220('0xb'),'avpf':_0xd220('0xb'),'force_avp':_0xd220('0xb'),'icesupport':_0xd220('0xb'),'dtlsenable':_0xd220('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xd220('0xc'),'dtlssetup':'actpass','callerid':util[_0xd220('0x1')](_0xd220('0xd'),util['format'](_0xd220('0x3'),_0xd220('0x2'),i),0xfa0+i)});}db['User'][_0xd220('0xe')](users)[_0xd220('0xf')](function(){console[_0xd220('0x10')](_0xd220('0x11'));})[_0xd220('0x12')](function(_0x25891d){console[_0xd220('0x10')](_0x25891d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 5410cfa..493178a 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf37=['user_has_sms_interactions:remove','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','setMaxListeners','address','connection','remoteAddress','request','remotePort','nsp','disconnect','DISCONNECTED','CONNECTED','util','bluebird','../mysqldb','./environment','name','User','role','agent','type','ivr','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','Telephones','Trunks','findAll','UserProfileResource','resourceId','map','where','telephone','%s:queue:%s','Agents','format','user:%s','query','find','userProfileId','handshake','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','VoiceQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms','mail','openchannel','telephone:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','removeSmsInteractions'];(function(_0x3573b9,_0x319527){var _0x13421e=function(_0x1af3a0){while(--_0x1af3a0){_0x3573b9['push'](_0x3573b9['shift']());}};_0x13421e(++_0x319527);}(_0xcf37,0xdc));var _0x7cf3=function(_0xc24ae3,_0x12a04b){_0xc24ae3=_0xc24ae3-0x0;var _0x33f600=_0xcf37[_0xc24ae3];return _0x33f600;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var BPromise=require(_0x7cf3('0x1'));var db=require(_0x7cf3('0x2'))['db'];var config=require(_0x7cf3('0x3'));var queryQueues={'attributes':['id',_0x7cf3('0x4')],'include':[{'as':'Agents','model':db[_0x7cf3('0x5')],'attributes':['id',_0x7cf3('0x4'),_0x7cf3('0x6')],'raw':!![],'where':{'role':_0x7cf3('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7cf3('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7cf3('0x4'),_0x7cf3('0x8')],'where':{'type':_0x7cf3('0x9')}};function getAssociatedResources(_0x589786,_0x1b1c39,_0x377577){return db[_0x7cf3('0xa')][_0x7cf3('0xb')]({'where':{'name':_0x589786,'userProfileId':_0x1b1c39},'raw':!![]})[_0x7cf3('0xc')](function(_0x23fe46){if(_0x23fe46){if(_0x23fe46['autoAssociation']){switch(_0x589786){case _0x7cf3('0xd'):case _0x7cf3('0xe'):case _0x7cf3('0xf'):case _0x7cf3('0x10'):case _0x7cf3('0x11'):case'OpenchannelQueues':case _0x7cf3('0x12'):return db[_0x377577]['findAll'](queryQueues);case _0x7cf3('0x13'):return db[_0x377577]['findAll'](queryTelephones);case _0x7cf3('0x14'):return db[_0x377577][_0x7cf3('0x15')](queryTrunks);case'IvrCampaigns':return db[_0x377577][_0x7cf3('0x15')](queryCampaigns);}}else{return db[_0x7cf3('0x16')][_0x7cf3('0x15')]({'attributes':[_0x7cf3('0x17')],'where':{'sectionId':_0x23fe46['id']},'raw':!![]})['then'](function(_0x34d074){if(_0x34d074){var _0x5d38cd={'where':{'id':_[_0x7cf3('0x18')](_0x34d074,_0x7cf3('0x17'))},'raw':!![]};switch(_0x377577){case _0x7cf3('0x5'):_0x5d38cd[_0x7cf3('0x19')][_0x7cf3('0x6')]=_0x7cf3('0x1a');break;case'Campaign':_0x5d38cd['where'][_0x7cf3('0x8')]=_0x7cf3('0x9');break;}return db[_0x377577][_0x7cf3('0x15')](_0x5d38cd);}else{return[];}});}}else{return[];}})['then'](function(_0x9b14f8){return _0x9b14f8;});}function joinOrLeaveQueues(_0x29e951,_0x36462e,_0x27ef8d,_0x369e30){_0x29e951[_0x36462e](util['format'](_0x7cf3('0x1b'),_0x27ef8d,_0x369e30[_0x7cf3('0x4')]));if(_0x369e30[_0x7cf3('0x1c')]){for(var _0x230a80=0x0;_0x230a80<_0x369e30[_0x7cf3('0x1c')]['length'];_0x230a80+=0x1){_0x29e951[_0x36462e](util[_0x7cf3('0x1d')](_0x7cf3('0x1e'),_0x369e30['Agents'][_0x230a80]['name']));}}}function joinOrLeave(_0x568722,_0x24dc98,_0x5b1f72){var _0x35f8b9;if(_0x568722['handshake'][_0x7cf3('0x1f')]['id']){db['User'][_0x7cf3('0x20')]({'attributes':['id','name',_0x7cf3('0x6'),_0x7cf3('0x21')],'where':{'id':_0x568722[_0x7cf3('0x22')][_0x7cf3('0x1f')]['id']},'include':[{'model':db[_0x7cf3('0x23')],'as':_0x7cf3('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x7cf3('0x25')],'as':_0x7cf3('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x7cf3('0x27')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x7cf3('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0x7cf3('0x29')],'as':_0x7cf3('0x2a'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7cf3('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x7cf3('0xc')](function(_0x565ef7){if(_0x565ef7){_0x35f8b9=_0x565ef7;_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x1e'),_0x565ef7[_0x7cf3('0x4')]));var _0x2fd8f5=[];switch(_0x565ef7[_0x7cf3('0x6')]){case _0x7cf3('0x2c'):_0x568722[_0x24dc98](_0x7cf3('0x2d'));_0x568722[_0x24dc98](_0x7cf3('0x2e'));if(queryQueues[_0x7cf3('0x2f')](_0x7cf3('0x30'))){delete queryQueues['include'];}_0x2fd8f5[_0x7cf3('0x31')](db['VoiceQueue'][_0x7cf3('0x15')](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x32')]['findAll'](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x33')]['findAll'](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x34')][_0x7cf3('0x15')](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x35')][_0x7cf3('0x15')](queryQueues));_0x2fd8f5['push'](db[_0x7cf3('0x36')][_0x7cf3('0x15')](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x37')]['findAll'](queryQueues));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x5')][_0x7cf3('0x15')](queryTelephones));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x38')][_0x7cf3('0x15')](queryTrunks));_0x2fd8f5[_0x7cf3('0x31')](db[_0x7cf3('0x39')][_0x7cf3('0x15')](queryCampaigns));_0x2fd8f5[_0x7cf3('0x31')](db['User']['findAll'](queryAgents));break;case'user':_0x568722[_0x24dc98](_0x7cf3('0x2d'));_0x568722[_0x24dc98](_0x7cf3('0x2e'));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0xd'),_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x3a')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0xe'),_0x565ef7[_0x7cf3('0x21')],'ChatQueue'));_0x2fd8f5['push'](getAssociatedResources(_0x7cf3('0xf'),_0x565ef7['userProfileId'],'FaxQueue'));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources('SmsQueues',_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x34')));_0x2fd8f5['push'](getAssociatedResources(_0x7cf3('0x11'),_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x35')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources('OpenchannelQueues',_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x36')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x12'),_0x565ef7[_0x7cf3('0x21')],'WhatsappQueue'));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x13'),_0x565ef7['userProfileId'],_0x7cf3('0x5')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x14'),_0x565ef7[_0x7cf3('0x21')],_0x7cf3('0x38')));_0x2fd8f5[_0x7cf3('0x31')](getAssociatedResources(_0x7cf3('0x3b'),_0x565ef7['userProfileId'],_0x7cf3('0x39')));_0x2fd8f5[_0x7cf3('0x31')](db['User'][_0x7cf3('0x15')](queryAgents));break;case _0x7cf3('0x7'):_0x568722[_0x24dc98](_0x7cf3('0x2d'));_0x568722[_0x24dc98](_0x7cf3('0x2e'));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x3c')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x3d')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5['push'](_0x565ef7[_0x7cf3('0x3e')]({'attributes':['id','name']}));_0x2fd8f5['push'](_0x565ef7[_0x7cf3('0x3f')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x40')]({'attributes':['id','name']}));_0x2fd8f5['push'](_0x565ef7[_0x7cf3('0x41')]({'attributes':['id',_0x7cf3('0x4')]}));_0x2fd8f5[_0x7cf3('0x31')](_0x565ef7[_0x7cf3('0x42')]({'attributes':['id','name']}));break;}return BPromise[_0x7cf3('0x43')](_0x2fd8f5);}})[_0x7cf3('0xc')](function(_0x2b3346){if(_0x2b3346&&_0x2b3346[_0x7cf3('0x44')]){for(var _0x530cd4=0x0;_0x530cd4<_0x2b3346[_0x7cf3('0x44')];_0x530cd4+=0x1){for(var _0x1cb52c=0x0;_0x1cb52c<_0x2b3346[_0x530cd4][_0x7cf3('0x44')];_0x1cb52c+=0x1){switch(_0x530cd4){case 0x0:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x45'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x1:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x46'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x2:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x47'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x3:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x48'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x4:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x49'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x5:joinOrLeaveQueues(_0x568722,_0x24dc98,_0x7cf3('0x4a'),_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x6:joinOrLeaveQueues(_0x568722,_0x24dc98,'whatsapp',_0x2b3346[_0x530cd4][_0x1cb52c]);break;case 0x7:if(_0x35f8b9['role']!==_0x7cf3('0x7'))_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x4b'),_0x2b3346[_0x530cd4][_0x1cb52c]['name']));break;case 0x8:if(_0x35f8b9['role']!==_0x7cf3('0x7'))_0x568722[_0x24dc98](util[_0x7cf3('0x1d')]('trunk:%s',_0x2b3346[_0x530cd4][_0x1cb52c][_0x7cf3('0x4')]));break;case 0x9:if(_0x35f8b9[_0x7cf3('0x6')]!==_0x7cf3('0x7'))_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x4c'),_0x2b3346[_0x530cd4][_0x1cb52c]['type'],_0x2b3346[_0x530cd4][_0x1cb52c][_0x7cf3('0x4')]));break;case 0xa:_0x568722[_0x24dc98](util[_0x7cf3('0x1d')](_0x7cf3('0x1e'),_0x2b3346[_0x530cd4][_0x1cb52c][_0x7cf3('0x4')]));break;}}}}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x452b07=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x24')],'id');return _0x35f8b9[_0x7cf3('0x4e')](_0x452b07)[_0x7cf3('0xc')](function(){for(var _0x5848c1=0x0;_0x5848c1<_0x452b07[_0x7cf3('0x44')];_0x5848c1+=0x1){_0x5b1f72[_0x7cf3('0x4f')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x452b07[_0x5848c1]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98==='leave'){var _0x360bf1=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x26')],'id');return _0x35f8b9['removeMailInteractions'](_0x360bf1)[_0x7cf3('0xc')](function(){for(var _0x14ee8b=0x0;_0x14ee8b<_0x360bf1[_0x7cf3('0x44')];_0x14ee8b+=0x1){_0x5b1f72[_0x7cf3('0x4f')](_0x7cf3('0x50'),{'MailInteractionId':Number(_0x360bf1[_0x14ee8b]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x57918b=_[_0x7cf3('0x18')](_0x35f8b9['FaxInteractions'],'id');return _0x35f8b9[_0x7cf3('0x51')](_0x57918b)[_0x7cf3('0xc')](function(){for(var _0x22ce86=0x0;_0x22ce86<_0x57918b['length'];_0x22ce86+=0x1){_0x5b1f72[_0x7cf3('0x4f')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x57918b[_0x22ce86]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x449099=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x28')],'id');return _0x35f8b9[_0x7cf3('0x52')](_0x449099)[_0x7cf3('0xc')](function(){for(var _0x40be43=0x0;_0x40be43<_0x449099[_0x7cf3('0x44')];_0x40be43+=0x1){_0x5b1f72['emit'](_0x7cf3('0x53'),{'SmsInteractionId':Number(_0x449099[_0x40be43]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x17beaf=_['map'](_0x35f8b9['OpenchannelInteractions'],'id');return _0x35f8b9[_0x7cf3('0x54')](_0x17beaf)[_0x7cf3('0xc')](function(){for(var _0x518ef6=0x0;_0x518ef6<_0x17beaf['length'];_0x518ef6+=0x1){_0x5b1f72[_0x7cf3('0x4f')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x17beaf[_0x518ef6]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0xc')](function(){if(_0x24dc98===_0x7cf3('0x4d')){var _0x288032=_[_0x7cf3('0x18')](_0x35f8b9[_0x7cf3('0x2b')],'id');return _0x35f8b9[_0x7cf3('0x55')](_0x288032)[_0x7cf3('0xc')](function(){for(var _0x3d7162=0x0;_0x3d7162<_0x288032[_0x7cf3('0x44')];_0x3d7162+=0x1){_0x5b1f72['emit'](_0x7cf3('0x56'),{'WhatsappInteractionId':Number(_0x288032[_0x3d7162]),'UserId':Number(_0x35f8b9['id'])});}});}})[_0x7cf3('0x57')](function(_0x1e7c88){_0x568722[_0x7cf3('0x58')](_0x1e7c88);});}}function onDisconnect(_0x31e339,_0x2afe8d){joinOrLeave(_0x31e339,_0x7cf3('0x4d'),_0x2afe8d);}function onConnect(_0x580617){joinOrLeave(_0x580617,_0x7cf3('0x59'));}exports[_0x7cf3('0x5a')]=function(_0x225921){_0x225921['on']('connection',function(_0x4bb726){_0x4bb726[_0x7cf3('0x5b')](0x0);_0x4bb726[_0x7cf3('0x5c')]=_0x4bb726['request'][_0x7cf3('0x5d')][_0x7cf3('0x5e')]+':'+_0x4bb726[_0x7cf3('0x5f')]['connection'][_0x7cf3('0x60')];_0x4bb726['connectedAt']=new Date();_0x4bb726[_0x7cf3('0x58')]=function(_0x2fcdd9){console[_0x7cf3('0x58')]('SocketIO\x20'+_0x4bb726[_0x7cf3('0x61')]['name']+'['+_0x4bb726['address']+']',_0x2fcdd9);};_0x4bb726['on'](_0x7cf3('0x62'),function(){onDisconnect(_0x4bb726,_0x225921);_0x4bb726['log'](_0x7cf3('0x63'));});onConnect(_0x4bb726);_0x4bb726[_0x7cf3('0x58')](_0x7cf3('0x64'));});}; \ No newline at end of file +var _0xc48d=['then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','Campaign','format','%s:queue:%s','length','user:%s','handshake','query','userProfileId','ChatInteraction','MailInteraction','MailInteractions','FaxInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','SmsQueue','MailQueue','WhatsappQueue','Trunk','voice:outbound','VoiceQueue','MailQueues','OpenchannelQueue','WhatsappQueues','Telephones','getVoiceQueues','getChatQueues','getSmsQueues','getOpenchannelQueues','all','chat','fax','sms','mail','openchannel','trunk:%s','ChatInteractions','removeChatInteractions','leave','removeMailInteractions','user_has_mail_interactions:remove','FaxInteractions','removeFaxInteractions','emit','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','address','request','remoteAddress','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','./environment','name','Agents','User','role','agent','telephone','type','UserProfileSection','findOne'];(function(_0x396dd5,_0x5b027f){var _0x5a0667=function(_0x36a3a0){while(--_0x36a3a0){_0x396dd5['push'](_0x396dd5['shift']());}};_0x5a0667(++_0x5b027f);}(_0xc48d,0x11a));var _0xdc48=function(_0x4e1a49,_0x4da738){_0x4e1a49=_0x4e1a49-0x0;var _0x136aae=_0xc48d[_0x4e1a49];return _0x136aae;};'use strict';var _=require(_0xdc48('0x0'));var util=require(_0xdc48('0x1'));var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var config=require(_0xdc48('0x2'));var queryQueues={'attributes':['id',_0xdc48('0x3')],'include':[{'as':_0xdc48('0x4'),'model':db[_0xdc48('0x5')],'attributes':['id',_0xdc48('0x3'),_0xdc48('0x6')],'raw':!![],'where':{'role':_0xdc48('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xdc48('0x3')],'where':{'role':_0xdc48('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0xdc48('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0xdc48('0x3')],'where':{'role':_0xdc48('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xdc48('0x3'),_0xdc48('0x9')],'where':{'type':'ivr'}};function getAssociatedResources(_0x1e6657,_0x2439ad,_0x44d7b8){return db[_0xdc48('0xa')][_0xdc48('0xb')]({'where':{'name':_0x1e6657,'userProfileId':_0x2439ad},'raw':!![]})[_0xdc48('0xc')](function(_0xfb6101){if(_0xfb6101){if(_0xfb6101[_0xdc48('0xd')]){switch(_0x1e6657){case _0xdc48('0xe'):case _0xdc48('0xf'):case _0xdc48('0x10'):case _0xdc48('0x11'):case'MailQueues':case _0xdc48('0x12'):case'WhatsappQueues':return db[_0x44d7b8][_0xdc48('0x13')](queryQueues);case'Telephones':return db[_0x44d7b8][_0xdc48('0x13')](queryTelephones);case _0xdc48('0x14'):return db[_0x44d7b8][_0xdc48('0x13')](queryTrunks);case _0xdc48('0x15'):return db[_0x44d7b8]['findAll'](queryCampaigns);}}else{return db[_0xdc48('0x16')][_0xdc48('0x13')]({'attributes':[_0xdc48('0x17')],'where':{'sectionId':_0xfb6101['id']},'raw':!![]})[_0xdc48('0xc')](function(_0x10ce35){if(_0x10ce35){var _0x2418ae={'where':{'id':_[_0xdc48('0x18')](_0x10ce35,_0xdc48('0x17'))},'raw':!![]};switch(_0x44d7b8){case _0xdc48('0x5'):_0x2418ae[_0xdc48('0x19')][_0xdc48('0x6')]=_0xdc48('0x8');break;case _0xdc48('0x1a'):_0x2418ae[_0xdc48('0x19')][_0xdc48('0x9')]='ivr';break;}return db[_0x44d7b8]['findAll'](_0x2418ae);}else{return[];}});}}else{return[];}})['then'](function(_0x2b1e2c){return _0x2b1e2c;});}function joinOrLeaveQueues(_0x4b9ef1,_0x76077e,_0x504d24,_0x35c20c){_0x4b9ef1[_0x76077e](util[_0xdc48('0x1b')](_0xdc48('0x1c'),_0x504d24,_0x35c20c[_0xdc48('0x3')]));if(_0x35c20c[_0xdc48('0x4')]){for(var _0x53eeaf=0x0;_0x53eeaf<_0x35c20c[_0xdc48('0x4')][_0xdc48('0x1d')];_0x53eeaf+=0x1){_0x4b9ef1[_0x76077e](util[_0xdc48('0x1b')](_0xdc48('0x1e'),_0x35c20c[_0xdc48('0x4')][_0x53eeaf][_0xdc48('0x3')]));}}}function joinOrLeave(_0x33f038,_0x2e2f08,_0x41b83d){var _0x384581;if(_0x33f038[_0xdc48('0x1f')][_0xdc48('0x20')]['id']){db[_0xdc48('0x5')]['find']({'attributes':['id',_0xdc48('0x3'),_0xdc48('0x6'),_0xdc48('0x21')],'where':{'id':_0x33f038[_0xdc48('0x1f')][_0xdc48('0x20')]['id']},'include':[{'model':db[_0xdc48('0x22')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x23')],'as':_0xdc48('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x25')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0xdc48('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x27')],'as':_0xdc48('0x28'),'attributes':['id'],'raw':!![]},{'model':db[_0xdc48('0x29')],'as':_0xdc48('0x2a'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x38d36e){if(_0x38d36e){_0x384581=_0x38d36e;_0x33f038[_0x2e2f08](util[_0xdc48('0x1b')]('user:%s',_0x38d36e[_0xdc48('0x3')]));var _0x12d8ce=[];switch(_0x38d36e[_0xdc48('0x6')]){case _0xdc48('0x2b'):_0x33f038[_0x2e2f08](_0xdc48('0x2c'));_0x33f038[_0x2e2f08]('voice:outbound');if(queryQueues[_0xdc48('0x2d')](_0xdc48('0x2e'))){delete queryQueues[_0xdc48('0x2e')];}_0x12d8ce[_0xdc48('0x2f')](db['VoiceQueue']['findAll'](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x30')]['findAll'](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db['FaxQueue'][_0xdc48('0x13')](queryQueues));_0x12d8ce['push'](db[_0xdc48('0x31')]['findAll'](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x32')][_0xdc48('0x13')](queryQueues));_0x12d8ce['push'](db['OpenchannelQueue'][_0xdc48('0x13')](queryQueues));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x33')]['findAll'](queryQueues));_0x12d8ce['push'](db[_0xdc48('0x5')][_0xdc48('0x13')](queryTelephones));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x34')][_0xdc48('0x13')](queryTrunks));_0x12d8ce['push'](db[_0xdc48('0x1a')]['findAll'](queryCampaigns));_0x12d8ce[_0xdc48('0x2f')](db['User'][_0xdc48('0x13')](queryAgents));break;case'user':_0x33f038[_0x2e2f08]('voice:inbound');_0x33f038[_0x2e2f08](_0xdc48('0x35'));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0xe'),_0x38d36e['userProfileId'],_0xdc48('0x36')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0xf'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x30')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources('FaxQueues',_0x38d36e[_0xdc48('0x21')],'FaxQueue'));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0x11'),_0x38d36e[_0xdc48('0x21')],'SmsQueue'));_0x12d8ce['push'](getAssociatedResources(_0xdc48('0x37'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x32')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0x12'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x38')));_0x12d8ce['push'](getAssociatedResources(_0xdc48('0x39'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x33')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources(_0xdc48('0x3a'),_0x38d36e[_0xdc48('0x21')],'User'));_0x12d8ce['push'](getAssociatedResources(_0xdc48('0x14'),_0x38d36e[_0xdc48('0x21')],_0xdc48('0x34')));_0x12d8ce[_0xdc48('0x2f')](getAssociatedResources('IvrCampaigns',_0x38d36e[_0xdc48('0x21')],_0xdc48('0x1a')));_0x12d8ce[_0xdc48('0x2f')](db[_0xdc48('0x5')][_0xdc48('0x13')](queryAgents));break;case _0xdc48('0x7'):_0x33f038[_0x2e2f08](_0xdc48('0x2c'));_0x33f038[_0x2e2f08]('voice:outbound');_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3b')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3c')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e['getFaxQueues']({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3d')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e['getMailQueues']({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e[_0xdc48('0x3e')]({'attributes':['id',_0xdc48('0x3')]}));_0x12d8ce[_0xdc48('0x2f')](_0x38d36e['getWhatsappQueues']({'attributes':['id',_0xdc48('0x3')]}));break;}return BPromise[_0xdc48('0x3f')](_0x12d8ce);}})['then'](function(_0x5c0f74){if(_0x5c0f74&&_0x5c0f74[_0xdc48('0x1d')]){for(var _0x5951e1=0x0;_0x5951e1<_0x5c0f74['length'];_0x5951e1+=0x1){for(var _0x43b79b=0x0;_0x43b79b<_0x5c0f74[_0x5951e1][_0xdc48('0x1d')];_0x43b79b+=0x1){switch(_0x5951e1){case 0x0:joinOrLeaveQueues(_0x33f038,_0x2e2f08,'voice',_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x1:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x40'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x2:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x41'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x3:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x42'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x4:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x43'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x5:joinOrLeaveQueues(_0x33f038,_0x2e2f08,_0xdc48('0x44'),_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x6:joinOrLeaveQueues(_0x33f038,_0x2e2f08,'whatsapp',_0x5c0f74[_0x5951e1][_0x43b79b]);break;case 0x7:if(_0x384581['role']!==_0xdc48('0x7'))_0x33f038[_0x2e2f08](util[_0xdc48('0x1b')]('telephone:%s',_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;case 0x8:if(_0x384581[_0xdc48('0x6')]!=='agent')_0x33f038[_0x2e2f08](util[_0xdc48('0x1b')](_0xdc48('0x45'),_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;case 0x9:if(_0x384581[_0xdc48('0x6')]!==_0xdc48('0x7'))_0x33f038[_0x2e2f08](util['format']('campaign:%s:%s',_0x5c0f74[_0x5951e1][_0x43b79b]['type'],_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;case 0xa:_0x33f038[_0x2e2f08](util['format'](_0xdc48('0x1e'),_0x5c0f74[_0x5951e1][_0x43b79b][_0xdc48('0x3')]));break;}}}}})[_0xdc48('0xc')](function(){if(_0x2e2f08==='leave'){var _0x8a71c2=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x46')],'id');return _0x384581[_0xdc48('0x47')](_0x8a71c2)[_0xdc48('0xc')](function(){for(var _0x5d141b=0x0;_0x5d141b<_0x8a71c2[_0xdc48('0x1d')];_0x5d141b+=0x1){_0x41b83d['emit']('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x8a71c2[_0x5d141b]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08===_0xdc48('0x48')){var _0x493cdd=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x24')],'id');return _0x384581[_0xdc48('0x49')](_0x493cdd)[_0xdc48('0xc')](function(){for(var _0x56b8fd=0x0;_0x56b8fd<_0x493cdd[_0xdc48('0x1d')];_0x56b8fd+=0x1){_0x41b83d['emit'](_0xdc48('0x4a'),{'MailInteractionId':Number(_0x493cdd[_0x56b8fd]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08===_0xdc48('0x48')){var _0x41cf4f=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x4b')],'id');return _0x384581[_0xdc48('0x4c')](_0x41cf4f)[_0xdc48('0xc')](function(){for(var _0x51d184=0x0;_0x51d184<_0x41cf4f['length'];_0x51d184+=0x1){_0x41b83d[_0xdc48('0x4d')](_0xdc48('0x4e'),{'FaxInteractionId':Number(_0x41cf4f[_0x51d184]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08===_0xdc48('0x48')){var _0x20c626=_[_0xdc48('0x18')](_0x384581['SmsInteractions'],'id');return _0x384581[_0xdc48('0x4f')](_0x20c626)[_0xdc48('0xc')](function(){for(var _0x26734c=0x0;_0x26734c<_0x20c626[_0xdc48('0x1d')];_0x26734c+=0x1){_0x41b83d[_0xdc48('0x4d')](_0xdc48('0x50'),{'SmsInteractionId':Number(_0x20c626[_0x26734c]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08==='leave'){var _0x49fb6c=_[_0xdc48('0x18')](_0x384581['OpenchannelInteractions'],'id');return _0x384581[_0xdc48('0x51')](_0x49fb6c)[_0xdc48('0xc')](function(){for(var _0x49ca88=0x0;_0x49ca88<_0x49fb6c[_0xdc48('0x1d')];_0x49ca88+=0x1){_0x41b83d[_0xdc48('0x4d')](_0xdc48('0x52'),{'OpenchannelInteractionId':Number(_0x49fb6c[_0x49ca88]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0xc')](function(){if(_0x2e2f08==='leave'){var _0x3da22b=_[_0xdc48('0x18')](_0x384581[_0xdc48('0x2a')],'id');return _0x384581['removeWhatsappInteractions'](_0x3da22b)[_0xdc48('0xc')](function(){for(var _0x4c7869=0x0;_0x4c7869<_0x3da22b[_0xdc48('0x1d')];_0x4c7869+=0x1){_0x41b83d['emit'](_0xdc48('0x53'),{'WhatsappInteractionId':Number(_0x3da22b[_0x4c7869]),'UserId':Number(_0x384581['id'])});}});}})[_0xdc48('0x54')](function(_0x4f8363){_0x33f038[_0xdc48('0x55')](_0x4f8363);});}}function onDisconnect(_0x3ec17b,_0x3dfa72){joinOrLeave(_0x3ec17b,_0xdc48('0x48'),_0x3dfa72);}function onConnect(_0x20606e){joinOrLeave(_0x20606e,_0xdc48('0x56'));}exports['default']=function(_0x1be842){_0x1be842['on'](_0xdc48('0x57'),function(_0x491597){_0x491597[_0xdc48('0x58')](0x0);_0x491597[_0xdc48('0x59')]=_0x491597[_0xdc48('0x5a')][_0xdc48('0x57')][_0xdc48('0x5b')]+':'+_0x491597[_0xdc48('0x5a')][_0xdc48('0x57')]['remotePort'];_0x491597[_0xdc48('0x5c')]=new Date();_0x491597['log']=function(_0x46fc8f){console[_0xdc48('0x55')](_0xdc48('0x5d')+_0x491597[_0xdc48('0x5e')]['name']+'['+_0x491597[_0xdc48('0x59')]+']',_0x46fc8f);};_0x491597['on'](_0xdc48('0x5f'),function(){onDisconnect(_0x491597,_0x1be842);_0x491597[_0xdc48('0x55')](_0xdc48('0x60'));});onConnect(_0x491597);_0x491597[_0xdc48('0x55')](_0xdc48('0x61'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index a31ce02..5d314c0 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 _0x9449=['SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info','Trigger,\x20%s','error','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','SELECT','contact','UserId','interface','format','name','outgoingmessage','AfterCreateMessage','opened','QueryTypes','SIP/%s','agent','changed','closed','substatus','AfterUpdate','find','email','internal','length','model','hook','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','afterCreate','newinteraction','afterUpdate','ChatMessage','newmessage','Sms','SmsInteraction','closedinteraction'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0x9449,0x1a0));var _0x9944=function(_0x2ba494,_0xb03074){_0x2ba494=_0x2ba494-0x0;var _0x2fd0bf=_0x9449[_0x2ba494];return _0x2fd0bf;};'use strict';var util=require(_0x9944('0x0'));var db=require(_0x9944('0x1'))['db'];var jayson=require(_0x9944('0x2'));var logger=require(_0x9944('0x3'))(_0x9944('0x4'));var client=jayson[_0x9944('0x5')][_0x9944('0x6')]({'port':0x232a});var triggers=[{'channel':_0x9944('0x7'),'model':'ChatInteraction','event':_0x9944('0x8'),'condition':_0x9944('0x9'),'callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0x9944('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9944('0x7'),'model':_0x9944('0xb'),'event':_0x9944('0x8'),'condition':_0x9944('0xc'),'callback':afterCreateMessage},{'channel':_0x9944('0x7'),'model':'ChatOfflineMessage','event':_0x9944('0x8'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0x9944('0xd'),'model':_0x9944('0xe'),'event':_0x9944('0x8'),'condition':_0x9944('0x9'),'callback':afterCreate},{'channel':'Sms','model':_0x9944('0xe'),'event':_0x9944('0xa'),'condition':_0x9944('0xf'),'callback':afterUpdate},{'channel':_0x9944('0xd'),'model':_0x9944('0x10'),'event':_0x9944('0x8'),'condition':_0x9944('0xc'),'callback':afterCreateMessage},{'channel':_0x9944('0x11'),'model':_0x9944('0x12'),'event':_0x9944('0x8'),'condition':_0x9944('0x9'),'callback':afterCreate},{'channel':_0x9944('0x11'),'model':_0x9944('0x12'),'event':_0x9944('0xa'),'condition':_0x9944('0xf'),'callback':afterUpdate},{'channel':_0x9944('0x11'),'model':_0x9944('0x13'),'event':_0x9944('0x8'),'condition':_0x9944('0xc'),'callback':afterCreateMessage},{'channel':_0x9944('0x14'),'model':_0x9944('0x15'),'event':_0x9944('0x8'),'condition':_0x9944('0x9'),'callback':afterCreate},{'channel':_0x9944('0x14'),'model':_0x9944('0x15'),'event':'afterUpdate','condition':_0x9944('0xf'),'callback':afterUpdate},{'channel':_0x9944('0x14'),'model':_0x9944('0x16'),'event':_0x9944('0x8'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0x9944('0x17'),'model':'MailInteraction','event':_0x9944('0x8'),'condition':_0x9944('0x9'),'callback':afterCreate},{'channel':_0x9944('0x17'),'model':_0x9944('0x18'),'event':_0x9944('0xa'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0x9944('0x17'),'model':_0x9944('0x19'),'event':_0x9944('0x8'),'condition':_0x9944('0xc'),'callback':afterCreateMessage},{'channel':_0x9944('0x1a'),'model':_0x9944('0x1b'),'event':_0x9944('0x8'),'condition':_0x9944('0x9'),'callback':afterCreate},{'channel':_0x9944('0x1a'),'model':_0x9944('0x1b'),'event':_0x9944('0xa'),'condition':_0x9944('0xf'),'callback':afterUpdate},{'channel':_0x9944('0x1a'),'model':_0x9944('0x1c'),'event':'afterCreate','condition':_0x9944('0xc'),'callback':afterCreateMessage}];function request(_0x3e623a){return client[_0x9944('0x1d')](_0x9944('0x1e'),_0x3e623a)[_0x9944('0x1f')](function(_0x16ddcf){logger[_0x9944('0x20')](_0x9944('0x21'),_0x9944('0x1e'),_0x16ddcf);if(_0x16ddcf[_0x9944('0x22')]){if(_0x16ddcf[_0x9944('0x22')]['code']===0x1f4){logger[_0x9944('0x22')](_0x9944('0x21'),_0x9944('0x1e'),_0x16ddcf[_0x9944('0x22')]);}}})[_0x9944('0x23')](function(_0xa68483){logger['error']('Trigger,\x20%s','EventManager',_0xa68483);});}function afterCreateMessage(_0x2d5cd5){return function(_0x4305f6){_0x4305f6=_0x4305f6[_0x9944('0x24')]({'plain':!![]});_0x4305f6[_0x9944('0x25')]=_0x2d5cd5;_0x4305f6[_0x9944('0x26')]=_0x2d5cd5;_0x4305f6[_0x9944('0x27')]=_0x4305f6[_0x9944('0x28')];Promise[_0x9944('0x29')]()[_0x9944('0x1f')](function(){if(typeof _0x4305f6[_0x9944('0x2a')]===_0x9944('0x2b'))return null;var _0xf3a0d=_0x9944('0x2c')+_0x4305f6['ContactId'];return db[_0x9944('0x2d')][_0x9944('0x2e')](_0xf3a0d,{'type':db[_0x9944('0x2f')]['QueryTypes'][_0x9944('0x30')],'raw':!![]});})['then'](function(_0x1f13fd){if(_0x1f13fd){_0x4305f6[_0x9944('0x31')]=_0x1f13fd[0x0];}if(typeof _0x4305f6[_0x9944('0x32')]===_0x9944('0x2b'))return;return getAgent(_0x4305f6[_0x9944('0x32')]);})[_0x9944('0x1f')](function(_0xdbf230){if(_0xdbf230){_0x4305f6[_0x9944('0x33')]=util[_0x9944('0x34')]('SIP/%s',_0xdbf230[_0x9944('0x35')]);_0x4305f6['agent']=_0xdbf230;_0x4305f6[_0x9944('0x25')]=_0x2d5cd5;return request({'event':'incomingmessage','message':_0x4305f6});}else{return request({'event':_0x9944('0x36'),'message':_0x4305f6});}})[_0x9944('0x23')](function(_0x193033){logger[_0x9944('0x22')](_0x9944('0x21'),_0x9944('0x37'),_0x193033);});};}function afterCreateOfflineMessage(_0x180017){return function(_0x558bbd){_0x558bbd=_0x558bbd['get']({'plain':!![]});_0x558bbd['channel']=_0x180017;_0x558bbd[_0x9944('0x26')]=_0x180017;_0x558bbd[_0x9944('0x27')]='offlineMessage';return request({'event':_0x558bbd[_0x9944('0x27')],'message':_0x558bbd});};}function afterCreate(_0x3b84b,_0x2db2da){return function(_0x1c960b){_0x1c960b=_0x1c960b[_0x9944('0x24')]({'plain':!![]});_0x1c960b['channel']=_0x3b84b;_0x1c960b[_0x9944('0x26')]=_0x3b84b;_0x1c960b['event']=_0x9944('0x38');Promise['resolve']()['then'](function(){var _0x5a5359=_0x9944('0x2c')+_0x1c960b[_0x9944('0x2a')];return db['sequelize'][_0x9944('0x2e')](_0x5a5359,{'type':db[_0x9944('0x2f')][_0x9944('0x39')][_0x9944('0x30')],'raw':!![]});})[_0x9944('0x1f')](function(_0x3a63de){if(_0x3a63de){_0x1c960b[_0x9944('0x31')]=_0x3a63de[0x0];}if(typeof _0x1c960b[_0x9944('0x32')]==='undefined')return;return getAgent(_0x1c960b[_0x9944('0x32')]);})['then'](function(_0x435dce){if(_0x435dce){_0x1c960b[_0x9944('0x33')]=util[_0x9944('0x34')](_0x9944('0x3a'),_0x435dce[_0x9944('0x35')]);_0x1c960b[_0x9944('0x3b')]=_0x435dce;}return request({'event':_0x2db2da,'message':_0x1c960b});})[_0x9944('0x23')](function(_0x4a5fb5){logger[_0x9944('0x22')](_0x9944('0x21'),'AfterCreate',_0x4a5fb5);});};}function afterUpdate(_0x13d029){return function(_0x4165f4){var _0x42d215=_0x4165f4[_0x9944('0x3c')](_0x9944('0x3d'))&&_0x4165f4[_0x9944('0x3d')];var _0x1c2f2b=_0x4165f4[_0x9944('0x3c')](_0x9944('0x3e'));if(_0x42d215||_0x1c2f2b){var _0x2af0a9=_0x42d215?_0x9944('0xf'):'substatus';var _0x3fc083=_0x4165f4['get']({'plain':!![]});_0x3fc083[_0x9944('0x25')]=_0x13d029;_0x3fc083[_0x9944('0x26')]=_0x13d029;_0x3fc083['event']=_0x42d215?_0x9944('0x3d'):_0x9944('0x3e');var _0x28e650=_0x9944('0x2c')+_0x3fc083[_0x9944('0x2a')];return db[_0x9944('0x2d')][_0x9944('0x2e')](_0x28e650,{'type':db[_0x9944('0x2f')]['QueryTypes'][_0x9944('0x30')],'raw':!![]})[_0x9944('0x1f')](function(_0x56eca7){if(_0x56eca7){_0x3fc083[_0x9944('0x31')]=_0x56eca7[0x0];}if(typeof _0x3fc083[_0x9944('0x32')]===_0x9944('0x2b'))return;return getAgent(_0x3fc083[_0x9944('0x32')]);})[_0x9944('0x1f')](function(_0x1c6761){if(_0x1c6761){_0x3fc083[_0x9944('0x33')]=util[_0x9944('0x34')](_0x9944('0x3a'),_0x1c6761[_0x9944('0x35')]);_0x3fc083[_0x9944('0x3b')]=_0x1c6761;}return request({'event':_0x2af0a9,'message':_0x3fc083});})[_0x9944('0x23')](function(_0x441e38){logger[_0x9944('0x22')](_0x9944('0x21'),_0x9944('0x3f'),_0x441e38);});}};}function getAgent(_0x4fa10a){return db['User'][_0x9944('0x40')]({'where':{'id':_0x4fa10a},'attributes':['id',_0x9944('0x35'),'fullname',_0x9944('0x41'),_0x9944('0x42')],'raw':!![]})[_0x9944('0x1f')](function(_0x48e96d){return _0x48e96d;});}exports['default']=function(){for(var _0x436790=0x0;_0x436790=_0x145195[_0xb8e6('0x14')]){throw Error(_0xb8e6('0x15'));}_0x3c34cb(_0x24e1b4);})[_0xb8e6('0x16')](function(_0x4c2045){_0x2972f8(_0x4c2045);});});}; \ No newline at end of file +var _0x2127=['whatsapp','openchannel','getChannels','isValidChannel','toLowerCase','clearBlockUser','isUndefined','getLicense','role','agent','User','count','then','agents','../mysqldb','./license/util','voice','chat','fax'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2127,0x93));var _0x7212=function(_0x1dd3c7,_0x1d8c43){_0x1dd3c7=_0x1dd3c7-0x0;var _0x3cef72=_0x2127[_0x1dd3c7];return _0x3cef72;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require(_0x7212('0x0'))['db'];var util=require(_0x7212('0x1'));var channels=[_0x7212('0x2'),'mail',_0x7212('0x3'),_0x7212('0x4'),'sms',_0x7212('0x5'),_0x7212('0x6')];exports[_0x7212('0x7')]=function(){return channels;};exports[_0x7212('0x8')]=function(_0x4c3e06){_0x4c3e06=_0x4c3e06[_0x7212('0x9')]();return _['includes'](channels,_0x4c3e06);};exports[_0x7212('0xa')]=function(_0x44b04a,_0x29e70c,_0x3e9587,_0x2c13c5){var _0x4737a0={'loginAttempts':_0x29e70c,'blocked':_0x3e9587};if(!_[_0x7212('0xb')](_0x2c13c5)){_0x4737a0['blockedAt']=_0x2c13c5;}return _0x44b04a['updateAttributes'](_0x4737a0);};exports[_0x7212('0xc')]=function(_0x341074){return new BPromise(function(_0x1bf51c,_0x1a4afa){var _0x4ec9b7=0x0;if(_0x341074[_0x7212('0xd')]!==_0x7212('0xe')){_0x1bf51c(_0x341074);}db[_0x7212('0xf')][_0x7212('0x10')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x341074['id']}}})['then'](function(_0x4aff61){_0x4ec9b7=_0x4aff61;return util['getLicense']();})[_0x7212('0x11')](function(_0x3837c1){if(_0x3837c1&&_0x3837c1['agents']&&_0x4ec9b7>=_0x3837c1[_0x7212('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x1bf51c(_0x341074);})['catch'](function(_0x5e8e81){_0x1a4afa(_0x5e8e81);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index af5c5b7..6211919 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90e4=['Bad\x20Request','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','OutOfInterval','Resource\x20Conflict','Conflict','error','stack','status','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','name','inherits'];(function(_0x21cd58,_0x4604d6){var _0x3fba55=function(_0x51922e){while(--_0x51922e){_0x21cd58['push'](_0x21cd58['shift']());}};_0x3fba55(++_0x4604d6);}(_0x90e4,0x89));var _0x490e=function(_0x30c2ae,_0x4c98a2){_0x30c2ae=_0x30c2ae-0x0;var _0x1ee1cc=_0x90e4[_0x30c2ae];return _0x1ee1cc;};'use strict';var util=require(_0x490e('0x0'));var logger=require(_0x490e('0x1'))(_0x490e('0x2'));var APIError=function(_0x120254,_0x1dcb1a){this[_0x490e('0x3')]=_0x120254||_0x490e('0x4');this[_0x490e('0x5')]=_0x1dcb1a||'Error';util[_0x490e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x2d6f27){this[_0x490e('0x3')]=_0x2d6f27||_0x490e('0x7');this[_0x490e('0x5')]=_0x490e('0x7');util[_0x490e('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x39b421){this[_0x490e('0x3')]=_0x39b421||'Forbidden';this[_0x490e('0x5')]='Forbidden';util[_0x490e('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x4b45b3){this[_0x490e('0x3')]=_0x4b45b3||'Entity\x20not\x20found';this[_0x490e('0x5')]=_0x490e('0x8');util[_0x490e('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x17696d){this['message']=_0x17696d||_0x490e('0x9');this['name']=_0x490e('0xa');this['code']=0x193;this['details']={'type':_0x490e('0xb')};util[_0x490e('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x42171d){this[_0x490e('0x3')]=_0x42171d||_0x490e('0xc');this['name']='Conflict';util['inherits'](APIBadRequestError,APIError);};function getStatusCode(_0x5ade06){switch(_0x5ade06){case _0x490e('0x7'):return 0x190;case'Forbidden',_0x490e('0xa'):return 0x193;case _0x490e('0x8'):return 0x194;case _0x490e('0xd'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x525a77){if(_0x525a77===_0x490e('0xa'))return _0x525a77;return null;}function handleError(_0x438fc0){return function(_0xe1ab5f){logger[_0x490e('0xe')](_0xe1ab5f[_0x490e('0xf')]);var _0x21a33b=getStatusCode(_0xe1ab5f[_0x490e('0x5')]);var _0x310ca2=getCustomStatusMessage(_0xe1ab5f[_0x490e('0x5')]);if(_0xe1ab5f[_0x490e('0x5')]){delete _0xe1ab5f['name'];}if(_0x310ca2){_0x438fc0['statusMessage']=_0x310ca2;}return _0x438fc0[_0x490e('0x10')](_0x21a33b)['send'](_0xe1ab5f);};}module[_0x490e('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x0714=['Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','details','Not\x20Found','Conflict','error','stack','statusMessage','status','send','exports','util','../config/logger','api','message','Internal\x20Server\x20Error','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','name'];(function(_0x355b23,_0x4b10e9){var _0x55c62a=function(_0x530414){while(--_0x530414){_0x355b23['push'](_0x355b23['shift']());}};_0x55c62a(++_0x4b10e9);}(_0x0714,0xbb));var _0x4071=function(_0x373f65,_0x335f9a){_0x373f65=_0x373f65-0x0;var _0x58551c=_0x0714[_0x373f65];return _0x58551c;};'use strict';var util=require(_0x4071('0x0'));var logger=require(_0x4071('0x1'))(_0x4071('0x2'));var APIError=function(_0x33280d,_0x4d769b){this[_0x4071('0x3')]=_0x33280d||_0x4071('0x4');this['name']=_0x4d769b||_0x4071('0x5');util[_0x4071('0x6')](APIError,Error);};var APIBadRequestError=function(_0x1cf739){this[_0x4071('0x3')]=_0x1cf739||_0x4071('0x7');this['name']=_0x4071('0x7');util[_0x4071('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0xd5b665){this['message']=_0xd5b665||'Forbidden';this['name']=_0x4071('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x3e4a6f){this['message']=_0x3e4a6f||_0x4071('0x9');this[_0x4071('0xa')]='Not\x20Found';util[_0x4071('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x268dd3){this[_0x4071('0x3')]=_0x268dd3||_0x4071('0xb');this['name']=_0x4071('0xc');this['code']=0x193;this[_0x4071('0xd')]={'type':'OutOfInterval'};util[_0x4071('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x3433fb){this[_0x4071('0x3')]=_0x3433fb||'Resource\x20Conflict';this['name']='Conflict';util[_0x4071('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x29157c){switch(_0x29157c){case _0x4071('0x7'):return 0x190;case _0x4071('0x8'),_0x4071('0xc'):return 0x193;case _0x4071('0xe'):return 0x194;case _0x4071('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x27b53d){if(_0x27b53d===_0x4071('0xc'))return _0x27b53d;return null;}function handleError(_0x28d9ef){return function(_0x24ec18){logger[_0x4071('0x10')](_0x24ec18[_0x4071('0x11')]);var _0x4f0da6=getStatusCode(_0x24ec18[_0x4071('0xa')]);var _0x19cc9c=getCustomStatusMessage(_0x24ec18[_0x4071('0xa')]);if(_0x24ec18['name']){delete _0x24ec18['name'];}if(_0x19cc9c){_0x28d9ef[_0x4071('0x12')]=_0x19cc9c;}return _0x28d9ef[_0x4071('0x13')](_0x4f0da6)[_0x4071('0x14')](_0x24ec18);};}module[_0x4071('0x15')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 6432062..04fb7e6 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x462e=['status','render','json','send','exports','404'];(function(_0xf45dbd,_0xa12f0){var _0x1dc148=function(_0x1c70bc){while(--_0x1c70bc){_0xf45dbd['push'](_0xf45dbd['shift']());}};_0x1dc148(++_0xa12f0);}(_0x462e,0x13c));var _0xe462=function(_0x1ba29,_0x1d30be){_0x1ba29=_0x1ba29-0x0;var _0x2b5527=_0x462e[_0x1ba29];return _0x2b5527;};'use strict';module[_0xe462('0x0')][0x194]=function pageNotFound(_0x43e2d5,_0x12b7fd){var _0x18da95=_0xe462('0x1');var _0x589839=0x194;var _0x3d0c4a={'status':_0x589839};_0x12b7fd[_0xe462('0x2')](_0x3d0c4a[_0xe462('0x2')]);_0x12b7fd[_0xe462('0x3')](_0x18da95,{},function(_0x57f563,_0x11f3a6){if(_0x57f563){return _0x12b7fd[_0xe462('0x2')](_0x3d0c4a[_0xe462('0x2')])[_0xe462('0x4')](_0x3d0c4a);}_0x12b7fd[_0xe462('0x5')](_0x11f3a6);});}; \ No newline at end of file +var _0xa9bf=['send','exports','404','render','status'];(function(_0x37f79a,_0x3d6a30){var _0x198d6d=function(_0x149702){while(--_0x149702){_0x37f79a['push'](_0x37f79a['shift']());}};_0x198d6d(++_0x3d6a30);}(_0xa9bf,0x8d));var _0xfa9b=function(_0xb1b08c,_0x1961a6){_0xb1b08c=_0xb1b08c-0x0;var _0x608518=_0xa9bf[_0xb1b08c];return _0x608518;};'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 312903e..c636791 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8fae=['UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','cascade','User','UserSetting','userSetting','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','CmHopperFinal','HopperFinals','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','CmHopper','Hoppers','SET\x20NULL','belongsTo','UserProfile','belongsToMany','Groups','chat_group_has_users','Contacts','cm_user_has_lists','user_has_teams','user_has_chat_interactions','FaxInteraction','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','WhatsappInteraction','VoiceQueues','UserVoiceQueue','UserVoicePrefix','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueue','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','ReportAgentPreview','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','Pause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','MailServerIn','CloudProvider','CloudProviderId','restrict','Imap','Dispositions','CannedAnswer','Answers','Interactions','ListId','TemplateId','mandatoryDispositionPause','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','user_has_mail_interactions','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessageId','IntervalId','List','FaxAccountId','Exntensions','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ProactiveActions','ChatInteraction','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','CompanyId','CmContactHasItem','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Agent','CampaignId','OwnerId','All','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','Hopper','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','AnalyticMetric','Configurations','Subjects','SubjectId','Descriptions','DescriptionId','AccountId','Subject','Description','Field','FieldId','VariableId','SugarcrmAccount','SugarcrmConfiguration','DeskConfiguration','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','Dynamics365Configuration','Dynamics365Field','SessionId','JscriptyProject','ProjectId','JscriptyQuestionReport','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefixes','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','FromAccount','ToChatWebsiteId','ToAccount','FromFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsQueueId','CustomFields','userProfileId','UserProfileSections','UserProfileResource','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_interactions','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','motion2','xcall','xC@LL1234','127.0.0.1','mysql','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','utf8mb4','database','password','options','username','import','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','MailQueueReport','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxMessage','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsMessage','../api/smsMessage/smsMessage.model','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/pause/pause.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../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','Campaign','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model'];(function(_0x145348,_0x25bb84){var _0x18d11b=function(_0x41a102){while(--_0x41a102){_0x145348['push'](_0x145348['shift']());}};_0x18d11b(++_0x25bb84);}(_0x8fae,0x10d));var _0xe8fa=function(_0x36c50d,_0x981cfd){_0x36c50d=_0x36c50d-0x0;var _0x70ea89=_0x8fae[_0x36c50d];return _0x70ea89;};'use strict';var config=require(_0xe8fa('0x0'));var Sequelize=require(_0xe8fa('0x1'));var _=require(_0xe8fa('0x2'));var jstz=require(_0xe8fa('0x3'));var timezone=jstz[_0xe8fa('0x4')]();config[_0xe8fa('0x1')]=_['defaultsDeep'](config[_0xe8fa('0x1')],{'database':_0xe8fa('0x5'),'username':_0xe8fa('0x6'),'password':_0xe8fa('0x7'),'options':{'host':_0xe8fa('0x8'),'port':0xcea,'dialect':_0xe8fa('0x9'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xe8fa('0xa')](),'define':{'charset':_0xe8fa('0xb'),'collate':_0xe8fa('0xc')}}});config[_0xe8fa('0xd')]=_[_0xe8fa('0xe')](config[_0xe8fa('0xd')],{'database':_0xe8fa('0x5'),'username':_0xe8fa('0x6'),'password':_0xe8fa('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xe8fa('0x9'),'dialectOptions':{'charset':_0xe8fa('0xf')},'logging':![],'timezone':timezone[_0xe8fa('0xa')](),'define':{'charset':'utf8','collate':_0xe8fa('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe8fa('0x1')][_0xe8fa('0x10')],config[_0xe8fa('0x1')]['username'],config[_0xe8fa('0x1')][_0xe8fa('0x11')],config[_0xe8fa('0x1')][_0xe8fa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xe8fa('0xd')][_0xe8fa('0x10')],config['sequelizeHistory'][_0xe8fa('0x13')],config[_0xe8fa('0xd')][_0xe8fa('0x11')],config[_0xe8fa('0xd')][_0xe8fa('0x12')])};db['User']=db['sequelize'][_0xe8fa('0x14')]('../api/user/user.model');db[_0xe8fa('0x15')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xe8fa('0x16')]=db['sequelize']['import'](_0xe8fa('0x17'));db[_0xe8fa('0x18')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x19'));db[_0xe8fa('0x1a')]=db['sequelize'][_0xe8fa('0x14')]('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize'][_0xe8fa('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0xe8fa('0x1b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x1c'));db[_0xe8fa('0x1d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceMail/voiceMail.model');db[_0xe8fa('0x1e')]=db['sequelize'][_0xe8fa('0x14')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xe8fa('0x1f')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x20'));db['VoiceDialReport']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x21'));db['VoiceAgentReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x22'));db[_0xe8fa('0x23')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xe8fa('0x24')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x25'));db[_0xe8fa('0x26')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x27'));db[_0xe8fa('0x28')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x29'));db[_0xe8fa('0x2a')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x2b'));db['UserVoiceQueue']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x2c'));db[_0xe8fa('0x2d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/userChatQueue/userChatQueue.model');db[_0xe8fa('0x2e')]=db['sequelize'][_0xe8fa('0x14')]('../api/userMailQueue/userMailQueue.model');db[_0xe8fa('0x2f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x30'));db[_0xe8fa('0x31')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x32'));db[_0xe8fa('0x33')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x34'));db[_0xe8fa('0x35')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/userWhatsappQueue/userWhatsappQueue.model');db['MailServerIn']=db[_0xe8fa('0x1')]['import']('../api/mailServerIn/mailServerIn.model');db[_0xe8fa('0x36')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x37'));db['MailAccount']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x38'));db[_0xe8fa('0x39')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x3a'));db[_0xe8fa('0x3b')]=db['sequelize'][_0xe8fa('0x14')]('../api/mailSubstatus/mailSubstatus.model');db[_0xe8fa('0x3c')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x3d'));db[_0xe8fa('0x3e')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x3f'));db[_0xe8fa('0x40')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/mailApplication/mailApplication.model');db[_0xe8fa('0x41')]=db['sequelize'][_0xe8fa('0x14')]('../api/mailQueueReport/mailQueueReport.model');db[_0xe8fa('0x42')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x43'));db[_0xe8fa('0x44')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x45'));db[_0xe8fa('0x46')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x47'));db[_0xe8fa('0x48')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x49'));db['FaxInteraction']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/faxInteraction/faxInteraction.model');db[_0xe8fa('0x4a')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/faxMessage/faxMessage.model');db[_0xe8fa('0x4b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x4c'));db[_0xe8fa('0x4d')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x4e'));db[_0xe8fa('0x4f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x50'));db[_0xe8fa('0x51')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x52'));db['SmsInteraction']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/smsInteraction/smsInteraction.model');db[_0xe8fa('0x53')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x54'));db['SmsQueue']=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x55'));db[_0xe8fa('0x56')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x57'));db[_0xe8fa('0x58')]=db['sequelize']['import'](_0xe8fa('0x59'));db[_0xe8fa('0x5a')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x5b'));db[_0xe8fa('0x5c')]=db['sequelize']['import'](_0xe8fa('0x5d'));db['OpenchannelQueue']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/openchannelQueue/openchannelQueue.model');db['ChatWebsite']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x5e'));db[_0xe8fa('0x5f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x60'));db[_0xe8fa('0x61')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x62'));db['ChatInteraction']=db['sequelize'][_0xe8fa('0x14')]('../api/chatInteraction/chatInteraction.model');db[_0xe8fa('0x63')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x64'));db[_0xe8fa('0x65')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x66'));db[_0xe8fa('0x67')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/chatQueue/chatQueue.model');db[_0xe8fa('0x68')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x69'));db[_0xe8fa('0x6a')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x6b'));db[_0xe8fa('0x6c')]=db[_0xe8fa('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xe8fa('0x6d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x6e'));db['CmHopper']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x6f'));db[_0xe8fa('0x70')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x71'));db['CmHopperFinal']=db['sequelize']['import'](_0xe8fa('0x72'));db[_0xe8fa('0x73')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x74'));db['ReportAgentPreview']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x75'));db[_0xe8fa('0x76')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x77'));db['Action']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/action/action.model');db[_0xe8fa('0x78')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x79'));db['CannedAnswer']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7a'));db[_0xe8fa('0x7b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7c'));db[_0xe8fa('0x7d')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/condition/condition.model');db['Interval']=db['sequelize']['import']('../api/interval/interval.model');db['Pause']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7e'));db['Cdr']=db['sequelize'][_0xe8fa('0x14')]('../api/cdr/cdr.model');db['VoiceQueuesLog']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x7f'));db[_0xe8fa('0x80')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x81'));db[_0xe8fa('0x82')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/sound/sound.model');db[_0xe8fa('0x83')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x84'));db[_0xe8fa('0x85')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x86'));db['CmContactHasItem']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x87'));db[_0xe8fa('0x88')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x89'));db[_0xe8fa('0x8a')]=db[_0xe8fa('0x1')]['import']('../api/template/template.model');db[_0xe8fa('0x8b')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x8c'));db[_0xe8fa('0x8d')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x8e'));db[_0xe8fa('0x8f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x90'));db[_0xe8fa('0x91')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x92'));db[_0xe8fa('0x93')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x94'));db[_0xe8fa('0x95')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xe8fa('0x96')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x97'));db['AnalyticMetric']=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x98'));db[_0xe8fa('0x99')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9a'));db['AnalyticTreeReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9b'));db[_0xe8fa('0x9c')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9d'));db[_0xe8fa('0x9e')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x9f'));db[_0xe8fa('0xa0')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa1'));db['SugarcrmAccount']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa2'));db['SugarcrmConfiguration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa3'));db[_0xe8fa('0xa4')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xa5'));db[_0xe8fa('0xa6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xa7'));db['DeskConfiguration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xe8fa('0xa8')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intDeskField/intDeskField.model');db[_0xe8fa('0xa9')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xaa'));db['ZohoConfiguration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xab'));db[_0xe8fa('0xac')]=db[_0xe8fa('0x1')]['import']('../api/intZohoField/intZohoField.model');db['ZendeskAccount']=db['sequelize']['import'](_0xe8fa('0xad'));db[_0xe8fa('0xae')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xe8fa('0xaf')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb0'));db[_0xe8fa('0xb1')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb2'));db[_0xe8fa('0xb3')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb4'));db[_0xe8fa('0xb5')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0xe8fa('0xb6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xb7'));db[_0xe8fa('0xb8')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0xe8fa('0xb9')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xba'));db[_0xe8fa('0xbb')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xbc'));db['ServicenowConfiguration']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xbd'));db[_0xe8fa('0xbe')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intServicenowField/intServicenowField.model');db[_0xe8fa('0xbf')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xc0'));db['Dynamics365Configuration']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db['Dynamics365Field']=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xe8fa('0xc1')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xe8fa('0xc2')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc3'));db[_0xe8fa('0xc4')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc5'));db[_0xe8fa('0x8f')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x90'));db[_0xe8fa('0xc6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc7'));db[_0xe8fa('0xc8')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xc9'));db[_0xe8fa('0xca')]=db[_0xe8fa('0x1')]['import']('../api/chatInternalMessage/chatInternalMessage.model');db[_0xe8fa('0xcb')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize'][_0xe8fa('0x14')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xe8fa('0xcc')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xcd'));db[_0xe8fa('0xce')]=db['sequelize'][_0xe8fa('0x14')]('../api/smsQueueReport/smsQueueReport.model');db['SquareReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/squareReport/squareReport.model');db[_0xe8fa('0xcf')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xd0'));db['JscriptyProject']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xd1'));db[_0xe8fa('0xd2')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xd3'));db[_0xe8fa('0xd4')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xd5'));db[_0xe8fa('0xd6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/squareProject/squareProject.model');db[_0xe8fa('0xd7')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xd8'));db[_0xe8fa('0xd9')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xda'));db[_0xe8fa('0xdb')]=db['sequelize']['import'](_0xe8fa('0xdc'));db[_0xe8fa('0xdd')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/license/license.model');db[_0xe8fa('0xde')]=db['sequelize'][_0xe8fa('0x14')]('../api/campaign/campaign.model');db[_0xe8fa('0xdf')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xe0'));db[_0xe8fa('0xe1')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xe2'));db[_0xe8fa('0xe3')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xe4'));db[_0xe8fa('0xe5')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xe6'));db[_0xe8fa('0xe7')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xe8'));db[_0xe8fa('0xe9')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xea'));db['OpenchannelTransferReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xeb'));db['SmsTransferReport']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/smsTransferReport/smsTransferReport.model');db[_0xe8fa('0xec')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xed'));db[_0xe8fa('0xee')]=db['sequelize'][_0xe8fa('0x14')]('../api/voicePrefix/voicePrefix.model');db['UserProfile']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xef'));db[_0xe8fa('0xf0')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xf1'));db['UserProfileResource']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xf2'));db[_0xe8fa('0xf3')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0xf4'));db[_0xe8fa('0xf5')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/whatsappAccount/whatsappAccount.model');db[_0xe8fa('0xf6')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xf7'));db['WhatsappInteraction']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xf8'));db['WhatsappMessage']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xf9'));db['WhatsappQueueReport']=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xfa'));db[_0xe8fa('0xfb')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0xfc'));db[_0xe8fa('0xfd')]=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0xfe'));db['CloudProvider']=db[_0xe8fa('0x1')][_0xe8fa('0x14')]('../api/cloudProvider/cloudProvider.model');db['TeamVoiceQueue']=db['sequelize']['import'](_0xe8fa('0xff'));db[_0xe8fa('0x100')]=db[_0xe8fa('0x1')]['import'](_0xe8fa('0x101'));db['UserVoicePrefix']=db[_0xe8fa('0x1')]['import']('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0xe8fa('0x1')][_0xe8fa('0x14')](_0xe8fa('0x102'));db[_0xe8fa('0x103')]=db['sequelize'][_0xe8fa('0x14')](_0xe8fa('0x104'));db['User'][_0xe8fa('0x105')](db[_0xe8fa('0x1d')],{'as':_0xe8fa('0x1d'),'onDelete':_0xe8fa('0x106'),'foreignKey':'UserId'});db[_0xe8fa('0x107')][_0xe8fa('0x105')](db[_0xe8fa('0x108')],{'as':_0xe8fa('0x109'),'onDelete':'cascade','foreignKey':_0xe8fa('0x10a')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x10c')],{'as':_0xe8fa('0x10d'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['UserVoiceQueueRt'],{'as':_0xe8fa('0x10e'),'foreignKey':_0xe8fa('0x10a')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'as':'Extensions','onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0x10f')],{'as':_0xe8fa('0x110'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0x73')],{'as':'HopperHistory','foreignKey':_0xe8fa('0x10a')});db['User']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0xe8fa('0x10a')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x5a')],{'as':_0xe8fa('0x111'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['ChatInteraction'],{'as':_0xe8fa('0x112'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xe8fa('0x113')],{'as':_0xe8fa('0x114'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['FaxInteraction'],{'as':_0xe8fa('0x115'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x116'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db['WhatsappInteraction'],{'as':_0xe8fa('0x117'),'foreignKey':'UserId'});db[_0xe8fa('0x107')][_0xe8fa('0x10b')](db[_0xe8fa('0xf3')],{'as':_0xe8fa('0x118'),'foreignKey':_0xe8fa('0x119')});db['User'][_0xe8fa('0x10b')](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x10a'),'onDelete':_0xe8fa('0x11c')});db[_0xe8fa('0x107')][_0xe8fa('0x11d')](db[_0xe8fa('0x11e')],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x68')],{'as':_0xe8fa('0x120'),'through':_0xe8fa('0x121')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db['CmContact'],{'as':_0xe8fa('0x122'),'through':'cm_user_has_contacts'});db['User']['belongsToMany'](db['CmList'],{'as':'Lists','through':_0xe8fa('0x123')});db[_0xe8fa('0x107')]['belongsToMany'](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x124')});db[_0xe8fa('0x107')]['belongsToMany'](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x116'),'through':'user_has_mail_interactions'});db['User'][_0xe8fa('0x11f')](db['ChatInteraction'],{'as':'ChatInteractions','through':_0xe8fa('0x125')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x126')],{'as':_0xe8fa('0x115'),'through':_0xe8fa('0x127')});db[_0xe8fa('0x107')]['belongsToMany'](db[_0xe8fa('0x113')],{'as':_0xe8fa('0x114'),'through':_0xe8fa('0x128')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x5a')],{'as':'OpenchannelInteractions','through':_0xe8fa('0x129')});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0x12a')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x1a')],{'as':_0xe8fa('0x12b'),'through':_0xe8fa('0x12c'),'required':![]});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0xee')],{'as':'VoicePrefixes','through':_0xe8fa('0x12d'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x39')],{'as':'MailQueues','through':_0xe8fa('0x2e'),'required':![]});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0x67')],{'as':_0xe8fa('0x12e'),'through':_0xe8fa('0x2d'),'required':![],'hooks':!![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x4b')],{'as':_0xe8fa('0x12f'),'through':_0xe8fa('0x2f'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x130')],{'as':_0xe8fa('0x131'),'through':_0xe8fa('0x31'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x132')],{'as':_0xe8fa('0x133'),'through':_0xe8fa('0x33'),'required':![]});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0xfd')],{'as':_0xe8fa('0x134'),'through':_0xe8fa('0x35'),'required':![]});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0xec')],{'through':_0xe8fa('0x123')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x136'),'through':_0xe8fa('0x137')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x46')],{'as':'FaxAccounts','through':_0xe8fa('0x138')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x139')],{'as':_0xe8fa('0x13a'),'through':_0xe8fa('0x13b')});db[_0xe8fa('0x107')][_0xe8fa('0x11f')](db[_0xe8fa('0x56')],{'as':'OpenchannelAccounts','through':_0xe8fa('0x13c')});db['User'][_0xe8fa('0x11f')](db[_0xe8fa('0x4f')],{'as':_0xe8fa('0x13d'),'through':_0xe8fa('0x13e')});db[_0xe8fa('0x107')]['belongsToMany'](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0xe8fa('0x13f')});db[_0xe8fa('0x15')]['hasMany'](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':'cascade','foreignKey':_0xe8fa('0x140')});db[_0xe8fa('0x16')][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x18')]['hasMany'](db[_0xe8fa('0x18')],{'as':_0xe8fa('0x141'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x142')]['belongsToMany'](db['Sound'],{'as':_0xe8fa('0x143'),'through':_0xe8fa('0x144')});db['VoiceQueue'][_0xe8fa('0x10b')](db[_0xe8fa('0x2a')],{'as':_0xe8fa('0x145'),'foreignKey':'VoiceQueueId'});db[_0xe8fa('0x1a')]['hasMany'](db['CmHopper'],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db['CmHopperFinal'],{'as':_0xe8fa('0x110'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db['CmHopperHistory'],{'as':_0xe8fa('0x147'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')]['hasMany'](db['ReportAgentPreview'],{'as':_0xe8fa('0x148'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db[_0xe8fa('0x70')],{'as':_0xe8fa('0x149'),'foreignKey':_0xe8fa('0x146')});db[_0xe8fa('0x1a')][_0xe8fa('0x10b')](db[_0xe8fa('0xcc')],{'as':_0xe8fa('0x14a'),'foreignKey':'VoiceQueueId'});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x26'),'foreignKey':_0xe8fa('0x14b')});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x14c'),'foreignKey':_0xe8fa('0x14d')});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'as':_0xe8fa('0x14e'),'foreignKey':'IntervalId'});db[_0xe8fa('0x1a')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8fa('0x150')});db['VoiceQueue'][_0xe8fa('0x11f')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x151'),'through':_0xe8fa('0x152')});db[_0xe8fa('0x1a')]['belongsToMany'](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x12c')});db['VoiceQueue'][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'as':_0xe8fa('0x154'),'through':_0xe8fa('0x155')});db['VoiceQueue']['belongsToMany'](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x156'),'through':_0xe8fa('0x157')});db[_0xe8fa('0x10c')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':'User','foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x1b')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x107'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x1d')][_0xe8fa('0x10b')](db[_0xe8fa('0x1e')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x159'),'sourceKey':_0xe8fa('0x15a')});db['VoiceMailMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x1d')],{'foreignKey':_0xe8fa('0x159'),'targetKey':_0xe8fa('0x15a')});db['VoiceCallReport'][_0xe8fa('0x10b')](db[_0xe8fa('0x23')],{'as':_0xe8fa('0x15b'),'foreignKey':_0xe8fa('0x15c'),'constraints':![]});db[_0xe8fa('0x1f')][_0xe8fa('0x10b')](db[_0xe8fa('0x15d')],{'as':_0xe8fa('0x15e'),'foreignKey':_0xe8fa('0x15c'),'constraints':![]});db['VoiceCallReport'][_0xe8fa('0x11d')](db['User'],{'as':_0xe8fa('0x107'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x1f')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db['MailServerIn'][_0xe8fa('0x11d')](db['MailAccount'],{'as':_0xe8fa('0x139'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x162')][_0xe8fa('0x11d')](db[_0xe8fa('0x163')],{'as':_0xe8fa('0x163'),'foreignKey':_0xe8fa('0x164'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x36')][_0xe8fa('0x11d')](db['MailAccount'],{'as':_0xe8fa('0x139'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x36')][_0xe8fa('0x11d')](db[_0xe8fa('0x163')],{'as':_0xe8fa('0x163'),'foreignKey':_0xe8fa('0x164'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x139')][_0xe8fa('0x105')](db[_0xe8fa('0x162')],{'as':_0xe8fa('0x166'),'onDelete':_0xe8fa('0x106')});db['MailAccount'][_0xe8fa('0x105')](db[_0xe8fa('0x36')],{'as':'Smtp','onDelete':'cascade'});db['MailAccount'][_0xe8fa('0x10b')](db['Disposition'],{'as':_0xe8fa('0x167'),'foreignKey':'MailAccountId','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x139')][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x161')});db['MailAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x3e')],{'as':_0xe8fa('0x158'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x139')][_0xe8fa('0x10b')](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0x139')][_0xe8fa('0x10b')](db[_0xe8fa('0x40')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x161'),'onDelete':_0xe8fa('0x106')});db['MailAccount']['belongsTo'](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db['MailAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0x8a')],{'as':_0xe8fa('0x8a'),'foreignKey':_0xe8fa('0x16c')});db['MailAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db['MailAccount'][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x13b')});db[_0xe8fa('0x39')][_0xe8fa('0x11f')](db['User'],{'as':'Agents','through':_0xe8fa('0x2e')});db[_0xe8fa('0x39')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x16e'),'as':_0xe8fa('0x154')});db['MailInteraction'][_0xe8fa('0x10b')](db[_0xe8fa('0x3e')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x16f')});db[_0xe8fa('0x3c')][_0xe8fa('0x11d')](db['MailAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x161')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x3c')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':'UserId'});db['MailInteraction'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':'mail_interaction_has_tags','as':_0xe8fa('0x172')});db[_0xe8fa('0x3c')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x173'),'as':_0xe8fa('0x174')});db[_0xe8fa('0x3c')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':'Users','through':_0xe8fa('0x175'),'foreignKey':_0xe8fa('0x16f')});db['MailMessage'][_0xe8fa('0x10b')](db['Attachment'],{'as':_0xe8fa('0x176'),'onDelete':_0xe8fa('0x106')});db['MailMessage']['belongsTo'](db['User'],{'as':_0xe8fa('0x107')});db['MailMessage']['belongsTo'](db[_0xe8fa('0x6d')],{'onDelete':'cascade','as':'Contact'});db[_0xe8fa('0x3e')][_0xe8fa('0x11d')](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x16f')});db[_0xe8fa('0x3e')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x3e')]['belongsTo'](db[_0xe8fa('0x135')],{'as':'ChatWebsite','foreignKey':_0xe8fa('0x178')});db['MailMessage'][_0xe8fa('0x11d')](db['ChatOfflineMessage'],{'as':_0xe8fa('0x65'),'foreignKey':_0xe8fa('0x179')});db[_0xe8fa('0x40')]['belongsTo'](db['User'],{'onDelete':_0xe8fa('0x165')});db['MailApplication'][_0xe8fa('0x11d')](db[_0xe8fa('0x39')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x40')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'onDelete':_0xe8fa('0x165')});db['MailApplication'][_0xe8fa('0x11d')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xe8fa('0x17a')});db['MailApplication']['belongsTo'](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':'TagId'});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db['CmList'],{'as':_0xe8fa('0x17b'),'foreignKey':'ListId'});db[_0xe8fa('0x41')]['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':'ContactId'});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db[_0xe8fa('0x3c')],{});db[_0xe8fa('0x41')]['belongsTo'](db[_0xe8fa('0x3e')],{});db[_0xe8fa('0x41')]['belongsTo'](db[_0xe8fa('0x107')],{});db[_0xe8fa('0x41')][_0xe8fa('0x11d')](db['MailQueue'],{});db[_0xe8fa('0x42')][_0xe8fa('0x10b')](db['DashboardItem'],{'as':'Items','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x46')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x17c'),'onDelete':_0xe8fa('0x106')});db['FaxAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x17c')});db['FaxAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x126')],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0x46')][_0xe8fa('0x10b')](db[_0xe8fa('0x48')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x17c'),'onDelete':_0xe8fa('0x106')});db['FaxAccount'][_0xe8fa('0x10b')](db['VoiceExtension'],{'as':_0xe8fa('0x17d'),'onDelete':'cascade'});db[_0xe8fa('0x46')][_0xe8fa('0x10b')](db[_0xe8fa('0x4a')],{'as':_0xe8fa('0x158')});db[_0xe8fa('0x46')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x26')});db[_0xe8fa('0x46')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0x46')][_0xe8fa('0x11d')](db['Pause'],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x46')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x138')});db[_0xe8fa('0x48')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x48')][_0xe8fa('0x11d')](db[_0xe8fa('0x4b')],{'onDelete':'restrict'});db['FaxApplication'][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'onDelete':_0xe8fa('0x165')});db['FaxApplication']['belongsTo'](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db['FaxInteraction'][_0xe8fa('0x10b')](db[_0xe8fa('0x4a')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x17f')});db[_0xe8fa('0x126')][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'as':'Account','foreignKey':_0xe8fa('0x17c')});db[_0xe8fa('0x126')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x126')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db['FaxInteraction']['belongsToMany'](db[_0xe8fa('0x83')],{'through':'fax_interaction_has_tags','as':_0xe8fa('0x172')});db['FaxInteraction'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x180'),'as':_0xe8fa('0x174')});db[_0xe8fa('0x126')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x127'),'foreignKey':_0xe8fa('0x17f')});db[_0xe8fa('0x4a')][_0xe8fa('0x11d')](db['User'],{'onDelete':'cascade','as':_0xe8fa('0x107')});db[_0xe8fa('0x4a')][_0xe8fa('0x11d')](db[_0xe8fa('0x126')],{'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x17f')});db[_0xe8fa('0x4a')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f')});db['FaxMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0xe1')],{'as':'Attachment','foreignKey':_0xe8fa('0x182')});db['FaxMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x17c')});db[_0xe8fa('0x4b')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x2f')});db['FaxQueue'][_0xe8fa('0x11f')](db['Team'],{'through':_0xe8fa('0x183'),'as':_0xe8fa('0x154')});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x4d')]['belongsTo'](db[_0xe8fa('0x126')],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db[_0xe8fa('0x4a')],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db['User'],{});db[_0xe8fa('0x4d')][_0xe8fa('0x11d')](db['FaxQueue'],{});db['SmsAccount'][_0xe8fa('0x10b')](db['Disposition'],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x184'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x4f')][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':'Answers','foreignKey':'SmsAccountId'});db['SmsAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x53')],{'as':_0xe8fa('0x158'),'foreignKey':'SmsAccountId'});db[_0xe8fa('0x4f')][_0xe8fa('0x10b')](db['SmsInteraction'],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0x4f')][_0xe8fa('0x10b')](db[_0xe8fa('0x51')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x184'),'onDelete':_0xe8fa('0x106')});db['SmsAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':'ListId'});db[_0xe8fa('0x4f')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x4f')]['belongsToMany'](db['User'],{'as':'Agents','through':_0xe8fa('0x13e')});db[_0xe8fa('0x51')]['belongsTo'](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x165')});db['SmsApplication']['belongsTo'](db[_0xe8fa('0x130')],{'onDelete':'restrict'});db[_0xe8fa('0x51')][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'onDelete':_0xe8fa('0x165')});db['SmsApplication']['belongsTo'](db[_0xe8fa('0x14e')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x51')][_0xe8fa('0x11d')](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x113')][_0xe8fa('0x10b')](db['SmsMessage'],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':'SmsInteractionId'});db[_0xe8fa('0x113')][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x184')});db['SmsInteraction']['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x113')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':'Owner','foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x113')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x185'),'as':'Tags'});db['SmsInteraction']['belongsToMany'](db[_0xe8fa('0x83')],{'through':'sms_interaction_has_tags','as':_0xe8fa('0x174')});db[_0xe8fa('0x113')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x128'),'foreignKey':_0xe8fa('0x186')});db['SmsMessage'][_0xe8fa('0x11d')](db['User'],{'as':_0xe8fa('0x107')});db['SmsMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':'Contact'});db[_0xe8fa('0x53')]['belongsTo'](db[_0xe8fa('0x113')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x186')});db[_0xe8fa('0x53')][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x184')});db[_0xe8fa('0x130')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x31'),'foreignKey':_0xe8fa('0x187')});db[_0xe8fa('0x130')]['belongsToMany'](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x188'),'as':_0xe8fa('0x154')});db[_0xe8fa('0x56')]['hasMany'](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x189'),'onDelete':'cascade'});db[_0xe8fa('0x56')]['hasMany'](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x189')});db[_0xe8fa('0x56')][_0xe8fa('0x10b')](db[_0xe8fa('0x5a')],{'as':_0xe8fa('0x16a'),'foreignKey':_0xe8fa('0x189')});db['OpenchannelAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x5c')],{'as':_0xe8fa('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0xe8fa('0x56')][_0xe8fa('0x10b')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':'OpenchannelAccountId','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x56')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0x56')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x56')][_0xe8fa('0x11f')](db['User'],{'as':'Agents','through':'user_has_openchannel_accounts'});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x132')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x18a')});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x56')],{'onDelete':'restrict','foreignKey':'OpenchannelAccountId'});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x58')][_0xe8fa('0x11d')](db[_0xe8fa('0x83')],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x5a')][_0xe8fa('0x10b')](db[_0xe8fa('0x5c')],{'as':_0xe8fa('0x158'),'onDelete':'cascade','foreignKey':'OpenchannelInteractionId'});db[_0xe8fa('0x5a')]['belongsTo'](db[_0xe8fa('0x56')],{'as':'Account','foreignKey':_0xe8fa('0x189')});db[_0xe8fa('0x5a')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x5a')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x5a')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x18b'),'as':_0xe8fa('0x172')});db[_0xe8fa('0x5a')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':'openchannel_interaction_has_tags','as':_0xe8fa('0x174')});db[_0xe8fa('0x5a')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x129'),'foreignKey':_0xe8fa('0x18c')});db['OpenchannelMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x106'),'as':'User'});db[_0xe8fa('0x5c')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f')});db[_0xe8fa('0x5c')][_0xe8fa('0x11d')](db[_0xe8fa('0x5a')],{'onDelete':'cascade','as':_0xe8fa('0x177'),'foreignKey':'OpenchannelInteractionId'});db[_0xe8fa('0x5c')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':_0xe8fa('0x182')});db[_0xe8fa('0x5c')]['belongsTo'](db[_0xe8fa('0x56')],{'as':_0xe8fa('0x170'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelQueue']['belongsToMany'](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x33'),'foreignKey':_0xe8fa('0x18a')});db[_0xe8fa('0x132')]['belongsToMany'](db[_0xe8fa('0xdb')],{'through':'team_has_openchannel_queues','as':'Teams'});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':'ChatWebsiteId','onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x135')]['hasMany'](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x6a')],{'as':_0xe8fa('0x18d')});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x18e')],{'as':_0xe8fa('0x16a')});db['ChatWebsite'][_0xe8fa('0x10b')](db[_0xe8fa('0x61')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x178'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x135')][_0xe8fa('0x10b')](db[_0xe8fa('0x63')],{'as':_0xe8fa('0x158')});db[_0xe8fa('0x135')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db['ChatWebsite'][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'as':_0xe8fa('0x14e'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x135')]['belongsTo'](db[_0xe8fa('0x139')],{'as':'MailAccount','foreignKey':_0xe8fa('0x161')});db[_0xe8fa('0x135')][_0xe8fa('0x11d')](db[_0xe8fa('0x14f')],{'as':'mandatoryDispositionPause','foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0x135')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x56')],{});db['OpenchannelQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':'ListId'});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db[_0xe8fa('0x5a')],{});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db[_0xe8fa('0x5c')],{});db[_0xe8fa('0x5f')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{});db['OpenchannelQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x132')],{});db[_0xe8fa('0x61')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':'Agent','foreignKey':_0xe8fa('0x10a'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x61')][_0xe8fa('0x11d')](db[_0xe8fa('0x67')],{'as':_0xe8fa('0x18f'),'foreignKey':_0xe8fa('0x190'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x61')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x191'),'foreignKey':_0xe8fa('0x178'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x61')]['belongsTo'](db['Tag'],{'onDelete':_0xe8fa('0x165'),'foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x18e')][_0xe8fa('0x10b')](db[_0xe8fa('0x63')],{'as':_0xe8fa('0x158'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x192')});db[_0xe8fa('0x18e')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x18e')]['belongsTo'](db['CmContact'],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x18e')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x18e')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x193'),'as':_0xe8fa('0x172')});db[_0xe8fa('0x18e')]['belongsToMany'](db[_0xe8fa('0x83')],{'through':'chat_interaction_has_tags','as':_0xe8fa('0x174')});db[_0xe8fa('0x18e')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x181'),'through':_0xe8fa('0x125'),'foreignKey':_0xe8fa('0x192')});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db['User'],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x107')});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x63')]['belongsTo'](db[_0xe8fa('0x18e')],{'onDelete':_0xe8fa('0x106'),'as':'Interaction','foreignKey':_0xe8fa('0x192')});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db[_0xe8fa('0xe1')],{'as':_0xe8fa('0xe1'),'foreignKey':'AttachmentId'});db[_0xe8fa('0x63')][_0xe8fa('0x11d')](db['ChatWebsite'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x65')][_0xe8fa('0x10b')](db[_0xe8fa('0xe1')],{'as':_0xe8fa('0x176'),'foreignKey':_0xe8fa('0x179'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x65')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x65')][_0xe8fa('0x11d')](db['ChatWebsite'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x67')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x2d'),'hooks':!![]});db[_0xe8fa('0x67')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x194'),'as':'Teams'});db[_0xe8fa('0x68')][_0xe8fa('0x10b')](db[_0xe8fa('0xca')],{'as':_0xe8fa('0x158'),'foreignKey':_0xe8fa('0x195'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x68')][_0xe8fa('0x11f')](db['User'],{'as':_0xe8fa('0x145'),'through':_0xe8fa('0x121')});db[_0xe8fa('0x6a')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{'as':_0xe8fa('0x191'),'foreignKey':_0xe8fa('0x178')});db[_0xe8fa('0x6c')][_0xe8fa('0x10b')](db['CmContact'],{'as':_0xe8fa('0x122'),'foreignKey':_0xe8fa('0x196')});db['CmContact'][_0xe8fa('0x10b')](db[_0xe8fa('0x197')],{'as':_0xe8fa('0x198'),'foreignKey':_0xe8fa('0x199')});db[_0xe8fa('0x6d')]['hasMany'](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db[_0xe8fa('0x10f')],{'as':'HopperFinals','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db['CmHopperHistory'],{'as':_0xe8fa('0x147'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db[_0xe8fa('0x148')],{'as':'ReportAgentPreview','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x6d')]['hasMany'](db[_0xe8fa('0xcc')],{'as':_0xe8fa('0x14a'),'foreignKey':'ContactId'});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db['OpenchannelInteraction'],{'as':_0xe8fa('0x111'),'foreignKey':_0xe8fa('0x160'),'onDelete':_0xe8fa('0x165')});db['CmContact']['hasMany'](db[_0xe8fa('0x18e')],{'as':_0xe8fa('0x112'),'foreignKey':'ContactId','onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')][_0xe8fa('0x10b')](db[_0xe8fa('0x113')],{'as':_0xe8fa('0x114'),'foreignKey':'ContactId','onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')]['hasMany'](db['FaxInteraction'],{'as':_0xe8fa('0x115'),'foreignKey':'ContactId','onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')]['hasMany'](db[_0xe8fa('0x3c')],{'as':_0xe8fa('0x116'),'foreignKey':_0xe8fa('0x160'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x6d')][_0xe8fa('0x11d')](db[_0xe8fa('0x6c')],{'as':_0xe8fa('0x19a'),'foreignKey':_0xe8fa('0x196')});db['CmContact'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b'),'onDelete':'cascade'});db[_0xe8fa('0x6d')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'through':'cm_user_has_contacts'});db['CmContact'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'as':'Tags','through':_0xe8fa('0x19b')});db[_0xe8fa('0x6d')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x19b'),'as':_0xe8fa('0x174')});db[_0xe8fa('0x11a')]['hasMany'](db['CmHopperAdditionalPhone'],{'as':_0xe8fa('0x19c'),'foreignKey':_0xe8fa('0x19d')});db[_0xe8fa('0x11a')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160'),'onDelete':'cascade'});db['CmHopper'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x11a')]['belongsTo'](db['User'],{'as':_0xe8fa('0x19e'),'foreignKey':'UserId'});db['CmHopper'][_0xe8fa('0x11d')](db['VoiceQueue'],{'as':_0xe8fa('0x18f'),'foreignKey':_0xe8fa('0x146'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x11a')]['belongsTo'](db[_0xe8fa('0xde')],{'as':_0xe8fa('0xde'),'foreignKey':_0xe8fa('0x19f'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x11a')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x1a0')});db[_0xe8fa('0x70')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':'Contact','foreignKey':_0xe8fa('0x160'),'onDelete':'cascade'});db[_0xe8fa('0x70')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b'),'onDelete':'cascade'});db[_0xe8fa('0x70')][_0xe8fa('0x11d')](db[_0xe8fa('0x1a')],{'as':_0xe8fa('0x18f'),'foreignKey':_0xe8fa('0x146'),'onDelete':_0xe8fa('0x106')});db['CmHopperBlack'][_0xe8fa('0x11d')](db[_0xe8fa('0xde')],{'as':_0xe8fa('0xde'),'foreignKey':_0xe8fa('0x19f'),'onDelete':'cascade'});db[_0xe8fa('0x78')][_0xe8fa('0x10b')](db['Condition'],{'as':{'plural':_0xe8fa('0x1a1'),'singular':_0xe8fa('0x1a2')},'foreignKey':_0xe8fa('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0xe8fa('0x78')][_0xe8fa('0x10b')](db[_0xe8fa('0x7d')],{'as':{'plural':_0xe8fa('0x1a4'),'singular':_0xe8fa('0x1a5')},'foreignKey':_0xe8fa('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0xe8fa('0x78')][_0xe8fa('0x10b')](db[_0xe8fa('0x1a7')],{'as':_0xe8fa('0x1a8'),'foreignKey':_0xe8fa('0x1a9'),'onDelete':'cascade','hooks':!![]});db[_0xe8fa('0x7b')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':'Dispositions','foreignKey':_0xe8fa('0x1aa'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db['Interval'],{'as':_0xe8fa('0x1ab'),'foreignKey':_0xe8fa('0x17a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'as':_0xe8fa('0x1ac'),'foreignKey':_0xe8fa('0x17a'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db[_0xe8fa('0x40')],{'as':_0xe8fa('0x1ad'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x14e')][_0xe8fa('0x10b')](db['ChatApplication'],{'as':_0xe8fa('0x1ae'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x14e')]['hasMany'](db[_0xe8fa('0x48')],{'as':'FaxApplications','foreignKey':_0xe8fa('0x17a')});db['Interval']['hasMany'](db[_0xe8fa('0x51')],{'as':_0xe8fa('0x1af'),'foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0x80')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{});db['Schedule']['belongsTo'](db[_0xe8fa('0x95')],{'foreignKey':_0xe8fa('0x1b0')});db['Schedule'][_0xe8fa('0x11d')](db[_0xe8fa('0x93')],{'foreignKey':_0xe8fa('0x1b1')});db[_0xe8fa('0x82')]['belongsToMany'](db[_0xe8fa('0x142')],{'as':_0xe8fa('0x1b2'),'through':_0xe8fa('0x144'),'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x3c')],{'through':_0xe8fa('0x173')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x113')],{'through':_0xe8fa('0x185')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x126')],{'through':_0xe8fa('0x180')});db[_0xe8fa('0x83')]['belongsToMany'](db['OpenchannelInteraction'],{'through':_0xe8fa('0x18b')});db[_0xe8fa('0x83')][_0xe8fa('0x11f')](db[_0xe8fa('0x12a')],{'through':_0xe8fa('0x1b3')});db[_0xe8fa('0x197')][_0xe8fa('0x11d')](db[_0xe8fa('0x85')],{'as':_0xe8fa('0x1b4'),'foreignKey':'ItemTypeId'});db['CmHopperAdditionalPhone'][_0xe8fa('0x11d')](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x1b5'),'foreignKey':'CmHopperId'});db['CmContactHasItem'][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x199')});db[_0xe8fa('0x8b')][_0xe8fa('0x10b')](db['Condition'],{'as':{'plural':_0xe8fa('0x1b6'),'singular':_0xe8fa('0x1b7')},'foreignKey':_0xe8fa('0x1b8'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x8b')][_0xe8fa('0x10b')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0xe8fa('0x1b9')},'foreignKey':_0xe8fa('0x1ba'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x8b')][_0xe8fa('0x10b')](db[_0xe8fa('0x1a7')],{'as':_0xe8fa('0x1a8'),'foreignKey':_0xe8fa('0x1bb'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db[_0xe8fa('0x93')][_0xe8fa('0x10b')](db[_0xe8fa('0x99')],{'as':_0xe8fa('0x1bc'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1b1'),'hooks':!![]});db[_0xe8fa('0x95')][_0xe8fa('0x10b')](db[_0xe8fa('0x99')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1b0')});db['AnalyticMetric'][_0xe8fa('0x10b')](db[_0xe8fa('0x99')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1bd')});db[_0xe8fa('0x99')][_0xe8fa('0x11d')](db[_0xe8fa('0x1be')],{'foreignKey':'MetricId'});db[_0xe8fa('0x9c')]['hasMany'](db[_0xe8fa('0x9e')],{'as':_0xe8fa('0x1bf'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xe8fa('0x9e')][_0xe8fa('0x10b')](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c0'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1c1')});db['SalesforceConfiguration'][_0xe8fa('0x10b')](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c2'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c3')});db['SalesforceConfiguration']['hasMany'](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0x9e')]['belongsTo'](db[_0xe8fa('0x9c')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xa0')][_0xe8fa('0x10b')](db['SalesforceField'],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xa0')]['hasMany'](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c6'),'foreignKey':'DescriptionId'});db[_0xe8fa('0xa0')][_0xe8fa('0x10b')](db[_0xe8fa('0xa0')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xa0')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0x1ca')][_0xe8fa('0x10b')](db[_0xe8fa('0x1cb')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0x1cb')]['hasMany'](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c0'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0x1cb')][_0xe8fa('0x10b')](db[_0xe8fa('0xa4')],{'as':'Descriptions','onDelete':_0xe8fa('0x106'),'foreignKey':'DescriptionId'});db[_0xe8fa('0x1cb')]['hasMany'](db['SugarcrmField'],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0x1cb')][_0xe8fa('0x11d')](db['SugarcrmAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xa4')][_0xe8fa('0x10b')](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xa4')]['hasMany'](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c6'),'foreignKey':'DescriptionId'});db['SugarcrmField'][_0xe8fa('0x10b')](db[_0xe8fa('0xa4')],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0xa4')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db['DeskAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x1cc')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db['DeskConfiguration'][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c0'),'onDelete':_0xe8fa('0x106'),'foreignKey':'SubjectId'});db[_0xe8fa('0x1cc')][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c2'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1cc')][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':'Fields','onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0x1cc')][_0xe8fa('0x11d')](db['DeskAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db['DeskConfiguration'][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x1cd')});db[_0xe8fa('0xa8')][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c5'),'foreignKey':'SubjectId'});db['DeskField'][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db['DeskField'][_0xe8fa('0x10b')](db[_0xe8fa('0xa8')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xa8')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xa9')][_0xe8fa('0x10b')](db['ZohoConfiguration'],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':'AccountId'});db[_0xe8fa('0x1ce')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Subjects','onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0x1ce')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':_0xe8fa('0x1c2'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1ce')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xe8fa('0x1c8')});db['ZohoConfiguration'][_0xe8fa('0x11d')](db[_0xe8fa('0xa9')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xac')]['hasMany'](db[_0xe8fa('0xac')],{'as':_0xe8fa('0x1c5'),'foreignKey':'SubjectId'});db[_0xe8fa('0xac')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Description','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xac')][_0xe8fa('0x10b')](db[_0xe8fa('0xac')],{'as':'Field','foreignKey':_0xe8fa('0x1c8')});db['ZohoField']['belongsTo'](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':'VariableId'});db[_0xe8fa('0x1cf')][_0xe8fa('0x10b')](db['ZendeskConfiguration'],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xae')][_0xe8fa('0x10b')](db['ZendeskField'],{'as':'Subjects','foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xae')][_0xe8fa('0x10b')](db['ZendeskField'],{'as':_0xe8fa('0x1c2'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xae')][_0xe8fa('0x10b')](db[_0xe8fa('0xaf')],{'as':_0xe8fa('0x1bc'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xae')][_0xe8fa('0x11d')](db[_0xe8fa('0x1cf')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xae')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':'int_zendesk_configuration_has_tags'});db[_0xe8fa('0xaf')][_0xe8fa('0x10b')](db[_0xe8fa('0xaf')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xaf')][_0xe8fa('0x10b')](db['ZendeskField'],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xaf')][_0xe8fa('0x10b')](db[_0xe8fa('0xaf')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db['ZendeskField'][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xb1')][_0xe8fa('0x10b')](db[_0xe8fa('0xb3')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xb3')][_0xe8fa('0x10b')](db[_0xe8fa('0xb5')],{'as':_0xe8fa('0x1c0'),'onDelete':'cascade','foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xb3')]['hasMany'](db['FreshdeskField'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb3')][_0xe8fa('0x10b')](db['FreshdeskField'],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0xb3')][_0xe8fa('0x11d')](db[_0xe8fa('0xb1')],{'as':_0xe8fa('0x170'),'foreignKey':'AccountId'});db[_0xe8fa('0xb3')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x1d0')});db[_0xe8fa('0xb5')][_0xe8fa('0x10b')](db[_0xe8fa('0xb5')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xb5')]['hasMany'](db[_0xe8fa('0xb5')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb5')][_0xe8fa('0x10b')](db['FreshdeskField'],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xb5')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xb6')][_0xe8fa('0x10b')](db[_0xe8fa('0xb8')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':'AccountId'});db[_0xe8fa('0xb8')][_0xe8fa('0x10b')](db[_0xe8fa('0xb9')],{'as':'Subjects','foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xb8')]['hasMany'](db[_0xe8fa('0xb9')],{'as':_0xe8fa('0x1c2'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb8')][_0xe8fa('0x10b')](db['VtigerField'],{'as':_0xe8fa('0x1bc'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xb8')][_0xe8fa('0x11d')](db['VtigerAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xb9')]['hasMany'](db[_0xe8fa('0xb9')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db['VtigerField'][_0xe8fa('0x10b')](db[_0xe8fa('0xb9')],{'as':'Description','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xb9')][_0xe8fa('0x10b')](db['VtigerField'],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0xb9')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db['ServicenowAccount']['hasMany'](db[_0xe8fa('0x1d1')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0x1d1')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c0'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0x1d1')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c2'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1d1')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1bc'),'foreignKey':_0xe8fa('0x1c8')});db['ServicenowConfiguration'][_0xe8fa('0x11d')](db[_0xe8fa('0xbb')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xbe')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xbe')][_0xe8fa('0x10b')](db['ServicenowField'],{'as':_0xe8fa('0x1c6'),'foreignKey':'DescriptionId'});db[_0xe8fa('0xbe')][_0xe8fa('0x10b')](db[_0xe8fa('0xbe')],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0xbe')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xbf')]['hasMany'](db[_0xe8fa('0x1d2')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c4')});db[_0xe8fa('0xbf')][_0xe8fa('0x11d')](db[_0xe8fa('0x163')],{'as':_0xe8fa('0x163'),'foreignKey':_0xe8fa('0x164')});db['Dynamics365Configuration'][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c0'),'onDelete':_0xe8fa('0x106'),'foreignKey':'SubjectId'});db[_0xe8fa('0x1d2')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c2'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x1c3')});db['Dynamics365Configuration'][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1bc'),'onDelete':_0xe8fa('0x106'),'foreignKey':'FieldId'});db[_0xe8fa('0x1d2')][_0xe8fa('0x11d')](db[_0xe8fa('0xbf')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1c4')});db['Dynamics365Field'][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xe8fa('0x1d3')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0x1d3')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d3')],{'as':_0xe8fa('0x1c7'),'foreignKey':'FieldId'});db[_0xe8fa('0x1d3')]['belongsTo'](db[_0xe8fa('0x8d')],{'as':'Variable','foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xc1')][_0xe8fa('0x10b')](db[_0xe8fa('0xc2')],{'as':_0xe8fa('0x1bf'),'onDelete':_0xe8fa('0x106'),'foreignKey':'AccountId'});db[_0xe8fa('0xc2')][_0xe8fa('0x10b')](db[_0xe8fa('0xc4')],{'as':_0xe8fa('0x1c0'),'foreignKey':_0xe8fa('0x1c1')});db[_0xe8fa('0xc2')]['hasMany'](db[_0xe8fa('0xc4')],{'as':'Descriptions','foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xc2')]['hasMany'](db[_0xe8fa('0xc4')],{'as':'Fields','foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xc2')][_0xe8fa('0x11d')](db[_0xe8fa('0xc1')],{'as':'Account','foreignKey':'AccountId'});db[_0xe8fa('0xc4')]['hasMany'](db['FreshsalesField'],{'as':_0xe8fa('0x1c5'),'foreignKey':_0xe8fa('0x1c1')});db['FreshsalesField'][_0xe8fa('0x10b')](db[_0xe8fa('0xc4')],{'as':_0xe8fa('0x1c6'),'foreignKey':_0xe8fa('0x1c3')});db[_0xe8fa('0xc4')][_0xe8fa('0x10b')](db[_0xe8fa('0xc4')],{'as':_0xe8fa('0x1c7'),'foreignKey':_0xe8fa('0x1c8')});db[_0xe8fa('0xc4')][_0xe8fa('0x11d')](db[_0xe8fa('0x8d')],{'as':_0xe8fa('0x8d'),'foreignKey':_0xe8fa('0x1c9')});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db[_0xe8fa('0x135')],{});db['ChatQueueReport']['belongsTo'](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db['ChatInteraction'],{});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db[_0xe8fa('0x63')],{});db['ChatQueueReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{});db[_0xe8fa('0xc8')][_0xe8fa('0x11d')](db[_0xe8fa('0x67')],{});db[_0xe8fa('0xca')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x106'),'foreignKey':'FromId'});db[_0xe8fa('0xca')]['belongsTo'](db[_0xe8fa('0x107')],{'onDelete':_0xe8fa('0x106'),'foreignKey':'ToId'});db[_0xe8fa('0xcc')]['hasMany'](db['JscriptyQuestionReport'],{'foreignKey':_0xe8fa('0x1d4'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xcc')][_0xe8fa('0x10b')](db[_0xe8fa('0xcb')],{'foreignKey':_0xe8fa('0x1d4'),'onDelete':'cascade'});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db['SmsAccount'],{});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0xce')]['belongsTo'](db[_0xe8fa('0x113')],{});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0x53')],{});db[_0xe8fa('0xce')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{});db[_0xe8fa('0xce')]['belongsTo'](db[_0xe8fa('0x130')],{});db[_0xe8fa('0x1d5')][_0xe8fa('0x10b')](db[_0xe8fa('0xcc')],{'foreignKey':_0xe8fa('0x1d6')});db[_0xe8fa('0x1d5')][_0xe8fa('0x10b')](db[_0xe8fa('0x1d7')],{'foreignKey':_0xe8fa('0x1d6')});db[_0xe8fa('0x1d5')]['hasMany'](db[_0xe8fa('0xcb')],{'foreignKey':_0xe8fa('0x1d6')});db['Team']['belongsToMany'](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x124')});db[_0xe8fa('0xdb')]['belongsToMany'](db[_0xe8fa('0x1a')],{'through':_0xe8fa('0x155'),'as':'VoiceQueues'});db['Team'][_0xe8fa('0x11f')](db[_0xe8fa('0x39')],{'through':'team_has_mail_queues','as':'MailQueues'});db[_0xe8fa('0xdb')]['belongsToMany'](db['ChatQueue'],{'through':'team_has_chat_queues','as':_0xe8fa('0x12e')});db[_0xe8fa('0xdb')][_0xe8fa('0x11f')](db[_0xe8fa('0x4b')],{'through':_0xe8fa('0x183'),'as':_0xe8fa('0x12f')});db['Team']['belongsToMany'](db['SmsQueue'],{'through':_0xe8fa('0x188'),'as':'SmsQueues'});db[_0xe8fa('0xdb')][_0xe8fa('0x11f')](db[_0xe8fa('0x132')],{'through':_0xe8fa('0x1d8'),'as':_0xe8fa('0x133')});db[_0xe8fa('0xdb')]['belongsToMany'](db['WhatsappQueue'],{'through':_0xe8fa('0x1d9'),'as':'WhatsappQueues'});db[_0xe8fa('0xdb')][_0xe8fa('0x11f')](db[_0xe8fa('0xee')],{'through':_0xe8fa('0x100'),'as':_0xe8fa('0x1da')});db[_0xe8fa('0xde')]['hasMany'](db[_0xe8fa('0x11a')],{'as':_0xe8fa('0x11b'),'foreignKey':_0xe8fa('0x19f')});db[_0xe8fa('0xde')]['hasMany'](db[_0xe8fa('0x10f')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xe8fa('0xde')]['hasMany'](db[_0xe8fa('0x73')],{'as':_0xe8fa('0x147'),'foreignKey':_0xe8fa('0x19f')});db[_0xe8fa('0xde')][_0xe8fa('0x10b')](db[_0xe8fa('0x70')],{'as':'HopperBlacks','foreignKey':_0xe8fa('0x19f')});db[_0xe8fa('0xde')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x26'),'foreignKey':_0xe8fa('0x14b')});db[_0xe8fa('0xde')][_0xe8fa('0x11d')](db[_0xe8fa('0x26')],{'as':_0xe8fa('0x14c'),'foreignKey':_0xe8fa('0x14d')});db[_0xe8fa('0xde')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'as':_0xe8fa('0x14e'),'foreignKey':'IntervalId'});db['Campaign'][_0xe8fa('0x11d')](db[_0xe8fa('0xd6')],{'as':_0xe8fa('0xd6'),'foreignKey':_0xe8fa('0x1db')});db[_0xe8fa('0xde')][_0xe8fa('0x11f')](db[_0xe8fa('0xec')],{'as':'Lists','through':_0xe8fa('0x1dc')});db['Campaign']['belongsToMany'](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x156'),'through':_0xe8fa('0x1dd')});db[_0xe8fa('0xe1')][_0xe8fa('0x11d')](db[_0xe8fa('0x65')],{'as':_0xe8fa('0x65'),'foreignKey':_0xe8fa('0x179')});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x3e')],{});db[_0xe8fa('0xe5')]['belongsTo'](db[_0xe8fa('0x3c')],{});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'foreignKey':_0xe8fa('0x1de'),'as':'FromAccount'});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db['User'],{'foreignKey':_0xe8fa('0x1e1'),'as':_0xe8fa('0x1e2')});db['MailTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x39')],{'foreignKey':_0xe8fa('0x1e3'),'as':_0xe8fa('0x1e4')});db[_0xe8fa('0xe5')][_0xe8fa('0x11d')](db[_0xe8fa('0x139')],{'foreignKey':_0xe8fa('0x1e5'),'as':'ToAccount'});db[_0xe8fa('0xe7')][_0xe8fa('0x11d')](db[_0xe8fa('0x63')],{});db[_0xe8fa('0xe7')]['belongsTo'](db['ChatInteraction'],{});db[_0xe8fa('0xe7')][_0xe8fa('0x11d')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xe8fa('0x1e6')});db['ChatTransferReport'][_0xe8fa('0x11d')](db['User'],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0xe7')]['belongsTo'](db['User'],{'foreignKey':_0xe8fa('0x1e1'),'as':_0xe8fa('0x1e2')});db[_0xe8fa('0xe7')]['belongsTo'](db[_0xe8fa('0x67')],{'foreignKey':'ToChatQueueId','as':_0xe8fa('0x1e4')});db[_0xe8fa('0xe7')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0xe8fa('0x1e7'),'as':_0xe8fa('0x1e8')});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x4a')],{});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db['FaxInteraction'],{});db[_0xe8fa('0xe9')]['belongsTo'](db[_0xe8fa('0x46')],{'foreignKey':_0xe8fa('0x1e9'),'as':'FromAccount'});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db['User'],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1e1'),'as':'ToAgent'});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x4b')],{'foreignKey':'ToFaxQueueId','as':_0xe8fa('0x1e4')});db[_0xe8fa('0xe9')][_0xe8fa('0x11d')](db[_0xe8fa('0x46')],{'foreignKey':'ToFaxAccountId','as':_0xe8fa('0x1e8')});db[_0xe8fa('0x1ea')][_0xe8fa('0x11d')](db['OpenchannelMessage'],{});db[_0xe8fa('0x1ea')][_0xe8fa('0x11d')](db[_0xe8fa('0x5a')],{});db[_0xe8fa('0x1ea')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xe8fa('0x1eb'),'as':_0xe8fa('0x1e6')});db[_0xe8fa('0x1ea')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db[_0xe8fa('0x1ea')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':_0xe8fa('0x1e2')});db['OpenchannelTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x132')],{'foreignKey':_0xe8fa('0x1ec'),'as':_0xe8fa('0x1e4')});db['OpenchannelTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x56')],{'foreignKey':_0xe8fa('0x1ed'),'as':'ToAccount'});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db['SmsMessage'],{});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db[_0xe8fa('0x113')],{});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db['SmsAccount'],{'foreignKey':_0xe8fa('0x1ef'),'as':_0xe8fa('0x1e6')});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db['SmsTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1e1'),'as':'ToAgent'});db[_0xe8fa('0x1ee')][_0xe8fa('0x11d')](db[_0xe8fa('0x130')],{'foreignKey':_0xe8fa('0x1f0'),'as':_0xe8fa('0x1e4')});db['SmsTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x4f')],{'foreignKey':'ToSmsAccountId','as':_0xe8fa('0x1e8')});db[_0xe8fa('0xec')]['hasMany'](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x16b'),'onDelete':'cascade'});db[_0xe8fa('0xec')][_0xe8fa('0x10b')](db[_0xe8fa('0x76')],{'as':_0xe8fa('0x1f1'),'foreignKey':'ListId'});db['CmList'][_0xe8fa('0x10b')](db['CmContact'],{'as':_0xe8fa('0x122'),'onDelete':_0xe8fa('0x106'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xec')][_0xe8fa('0x10b')](db[_0xe8fa('0x10f')],{'as':_0xe8fa('0x110'),'foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xec')]['hasMany'](db[_0xe8fa('0x73')],{'as':'HopperHistory','foreignKey':_0xe8fa('0x16b')});db['CmList']['hasMany'](db[_0xe8fa('0x148')],{'as':_0xe8fa('0x148'),'foreignKey':_0xe8fa('0x16b')});db['CmList'][_0xe8fa('0x11f')](db[_0xe8fa('0x1a')],{'as':'Queues','through':_0xe8fa('0x152')});db[_0xe8fa('0xec')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x123')});db[_0xe8fa('0xee')][_0xe8fa('0x10b')](db[_0xe8fa('0x18')],{'as':_0xe8fa('0x1ac'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xee')][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x153'),'through':_0xe8fa('0x12d')});db[_0xe8fa('0xee')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x100'),'as':'Teams'});db[_0xe8fa('0x11e')][_0xe8fa('0x10b')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x181'),'foreignKey':_0xe8fa('0x1f2')});db[_0xe8fa('0x11e')][_0xe8fa('0x10b')](db[_0xe8fa('0xf0')],{'as':_0xe8fa('0x1f3'),'foreignKey':_0xe8fa('0x1f2'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xf0')]['hasMany'](db[_0xe8fa('0x1f4')],{'as':_0xe8fa('0x1f5'),'foreignKey':_0xe8fa('0x1f6'),'onDelete':_0xe8fa('0x106')});db[_0xe8fa('0xf5')][_0xe8fa('0x10b')](db[_0xe8fa('0x7b')],{'as':_0xe8fa('0x167'),'foreignKey':_0xe8fa('0x1f7'),'onDelete':_0xe8fa('0x106')});db['WhatsappAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x168')],{'as':_0xe8fa('0x169'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xe8fa('0x10b')](db[_0xe8fa('0x1f8')],{'as':'Messages','foreignKey':_0xe8fa('0x1f7')});db[_0xe8fa('0xf5')][_0xe8fa('0x10b')](db[_0xe8fa('0x12a')],{'as':_0xe8fa('0x16a')});db[_0xe8fa('0xf5')]['hasMany'](db[_0xe8fa('0xf6')],{'as':_0xe8fa('0x141'),'foreignKey':_0xe8fa('0x1f7'),'onDelete':_0xe8fa('0x106')});db['WhatsappAccount'][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':'List','foreignKey':_0xe8fa('0x16b')});db[_0xe8fa('0xf5')][_0xe8fa('0x11d')](db['Pause'],{'as':_0xe8fa('0x16d'),'foreignKey':_0xe8fa('0x150')});db[_0xe8fa('0xf5')][_0xe8fa('0x11f')](db['User'],{'as':'Agents','through':_0xe8fa('0x13f')});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'onDelete':'restrict'});db[_0xe8fa('0xf6')]['belongsTo'](db['WhatsappQueue'],{'onDelete':'restrict'});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'onDelete':_0xe8fa('0x165')});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0x14e')],{'onDelete':'restrict','foreignKey':_0xe8fa('0x17a')});db[_0xe8fa('0xf6')][_0xe8fa('0x11d')](db[_0xe8fa('0x83')],{'onDelete':'restrict','foreignKey':_0xe8fa('0x17e')});db[_0xe8fa('0x12a')][_0xe8fa('0x10b')](db[_0xe8fa('0x1f8')],{'as':'Messages','onDelete':_0xe8fa('0x106'),'foreignKey':'WhatsappInteractionId'});db[_0xe8fa('0x12a')][_0xe8fa('0x11d')](db['WhatsappAccount'],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1f7')});db['WhatsappInteraction']['belongsTo'](db[_0xe8fa('0x6d')],{'as':_0xe8fa('0x15f'),'foreignKey':'ContactId'});db[_0xe8fa('0x12a')][_0xe8fa('0x11d')](db['User'],{'as':_0xe8fa('0x171'),'foreignKey':_0xe8fa('0x10a')});db[_0xe8fa('0x12a')][_0xe8fa('0x11f')](db[_0xe8fa('0x83')],{'through':_0xe8fa('0x1b3'),'as':_0xe8fa('0x172')});db[_0xe8fa('0x12a')][_0xe8fa('0x11f')](db['Tag'],{'through':_0xe8fa('0x1b3'),'as':_0xe8fa('0x174')});db['WhatsappInteraction'][_0xe8fa('0x11f')](db[_0xe8fa('0x107')],{'as':'Users','through':_0xe8fa('0x1f9'),'foreignKey':_0xe8fa('0x1fa')});db[_0xe8fa('0x1f8')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x107')});db['WhatsappMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x6d')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x15f')});db['WhatsappMessage'][_0xe8fa('0x11d')](db[_0xe8fa('0x12a')],{'onDelete':_0xe8fa('0x106'),'as':_0xe8fa('0x177'),'foreignKey':_0xe8fa('0x1fa')});db[_0xe8fa('0x1f8')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'as':_0xe8fa('0x170'),'foreignKey':_0xe8fa('0x1f7')});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db['WhatsappAccount'],{});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db[_0xe8fa('0xec')],{'as':_0xe8fa('0x17b'),'foreignKey':'ListId'});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db['CmContact'],{'as':'Contact','foreignKey':_0xe8fa('0x160')});db[_0xe8fa('0x1fb')][_0xe8fa('0x11d')](db[_0xe8fa('0x12a')],{});db[_0xe8fa('0x1fb')]['belongsTo'](db[_0xe8fa('0xfd')],{});db[_0xe8fa('0x1fb')]['belongsTo'](db[_0xe8fa('0x1f8')],{});db[_0xe8fa('0x1fb')]['belongsTo'](db[_0xe8fa('0x107')],{});db['WhatsappTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x1f8')],{});db['WhatsappTransferReport']['belongsTo'](db[_0xe8fa('0x12a')],{});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'foreignKey':_0xe8fa('0x1fc'),'as':_0xe8fa('0x1e6')});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db[_0xe8fa('0xf5')],{'foreignKey':'ToWhatsappAccountId','as':_0xe8fa('0x1e8')});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db['WhatsappQueue'],{'foreignKey':_0xe8fa('0x1fd'),'as':_0xe8fa('0x1e4')});db[_0xe8fa('0xfb')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1df'),'as':_0xe8fa('0x1e0')});db['WhatsappTransferReport'][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'foreignKey':_0xe8fa('0x1e1'),'as':_0xe8fa('0x1e2')});db['WhatsappQueue']['belongsToMany'](db[_0xe8fa('0x107')],{'as':'Agents','through':_0xe8fa('0x35'),'foreignKey':'WhatsappQueueId'});db[_0xe8fa('0xfd')][_0xe8fa('0x11f')](db[_0xe8fa('0xdb')],{'through':_0xe8fa('0x1d9'),'as':_0xe8fa('0x154')});db[_0xe8fa('0x108')][_0xe8fa('0x11d')](db[_0xe8fa('0x107')],{'as':_0xe8fa('0x1fe'),'foreignKey':_0xe8fa('0x10a'),'onDelete':_0xe8fa('0x106'),'hooks':!![]});db['CloudProvider'][_0xe8fa('0x105')](db['Dynamics365Account'],{'as':_0xe8fa('0xbf'),'onDelete':_0xe8fa('0x165')});db['CloudProvider'][_0xe8fa('0x105')](db[_0xe8fa('0x162')],{'as':_0xe8fa('0x166'),'onDelete':_0xe8fa('0x165')});db['CloudProvider']['hasOne'](db[_0xe8fa('0x36')],{'as':'Smtp','onDelete':'restrict'});module[_0xe8fa('0x1ff')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x0936=['MailInteractions','WhatsappInteractions','UserNotifications','SenderId','Hoppers','belongsTo','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','MailQueue','MailQueues','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','HopperBlacks','TrunkId','IntervalId','Pause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','TeamVoiceQueue','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','VoiceMailMessage','AgentReports','uniqueid','Contact','ContactId','MailAccountId','restrict','CloudProviderId','Imap','Smtp','Dispositions','Answers','List','TemplateId','mandatoryDispositionPause','Agents','user_has_mail_accounts','team_has_mail_queues','MailInteractionId','Account','Owner','mail_interaction_has_tags','Tags','Users','Interaction','ChatWebsiteId','ChatOfflineMessageId','TagId','ListId','Dashboard','FaxAccount','FaxAccountId','FaxApplication','Exntensions','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','team_has_sms_queues','OpenchannelAccountId','Interactions','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','Agent','Queue','ChatQueueId','Website','chat_interaction_has_tags','ChatInteractionId','Attachments','team_has_chat_queues','ChatGroupId','CompanyId','Phones','CmContactId','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','All','OneAll','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','Extensions','MailApplications','ChatApplications','FaxApplications','CustomReportId','Mohs','sms_interaction_has_tags','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','FieldId','Subject','Description','VariableId','DescriptionId','Field','int_desk_configuration_has_tags','ZohoConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowAccount','ServicenowField','Dynamics365Configuration','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','JscriptyQuestionReport','JscriptyAnswerReport','SessionId','SmsQueueReport','ProjectId','team_has_whatsapp_queues','VoicePrefixes','CampaignId','TrunkBackup','TrunkBackupId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToAccount','FromChatWebsiteId','FromAgent','FromFaxAccountId','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsAccountId','CustomFields','Queues','UserProfileSections','userProfileId','WhatsappAccountId','WhatsappInteractionId','WhatsappQueueReport','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','motion2','utf8_general_ci','database','username','password','options','User','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','DashboardItem','../api/faxAccount/faxAccount.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','Interval','../api/interval/interval.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','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','../api/integration/integration.model','IntegrationReport','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','License','../api/license/license.model','../api/campaign/campaign.model','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../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','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions'];(function(_0x5239e2,_0x2b7488){var _0x1b3ee1=function(_0x2c8413){while(--_0x2c8413){_0x5239e2['push'](_0x5239e2['shift']());}};_0x1b3ee1(++_0x2b7488);}(_0x0936,0xde));var _0x6093=function(_0x451053,_0x4af3f4){_0x451053=_0x451053-0x0;var _0x38c42b=_0x0936[_0x451053];return _0x38c42b;};'use strict';var config=require(_0x6093('0x0'));var Sequelize=require(_0x6093('0x1'));var _=require(_0x6093('0x2'));var jstz=require(_0x6093('0x3'));var timezone=jstz[_0x6093('0x4')]();config[_0x6093('0x1')]=_[_0x6093('0x5')](config['sequelize'],{'database':'motion2','username':_0x6093('0x6'),'password':_0x6093('0x7'),'options':{'host':_0x6093('0x8'),'port':0xcea,'dialect':_0x6093('0x9'),'dialectOptions':{'charset':_0x6093('0xa')},'logging':![],'timezone':timezone[_0x6093('0xb')](),'define':{'charset':_0x6093('0xc'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x6093('0x5')](config[_0x6093('0xd')],{'database':_0x6093('0xe'),'username':_0x6093('0x6'),'password':_0x6093('0x7'),'options':{'host':_0x6093('0x8'),'port':0xcea,'dialect':_0x6093('0x9'),'dialectOptions':{'charset':_0x6093('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':_0x6093('0xf')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6093('0x1')][_0x6093('0x10')],config[_0x6093('0x1')][_0x6093('0x11')],config[_0x6093('0x1')][_0x6093('0x12')],config[_0x6093('0x1')][_0x6093('0x13')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x6093('0xd')][_0x6093('0x10')],config[_0x6093('0xd')][_0x6093('0x11')],config[_0x6093('0xd')][_0x6093('0x12')],config[_0x6093('0xd')][_0x6093('0x13')])};db[_0x6093('0x14')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x16'));db[_0x6093('0x17')]=db['sequelize']['import'](_0x6093('0x18'));db[_0x6093('0x19')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x1a'));db[_0x6093('0x1b')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x1c'));db[_0x6093('0x1d')]=db[_0x6093('0x1')]['import'](_0x6093('0x1e'));db[_0x6093('0x1f')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x20'));db[_0x6093('0x21')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/voiceRecording/voiceRecording.model');db[_0x6093('0x22')]=db[_0x6093('0x1')]['import'](_0x6093('0x23'));db[_0x6093('0x24')]=db['sequelize'][_0x6093('0x15')]('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0x6093('0x1')][_0x6093('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x6093('0x25')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x26'));db[_0x6093('0x27')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x28'));db[_0x6093('0x29')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/voiceAgentReport/voiceAgentReport.model');db[_0x6093('0x2a')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x2b'));db[_0x6093('0x2c')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x2d'));db[_0x6093('0x2e')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/trunk/trunk.model');db[_0x6093('0x2f')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x30'));db[_0x6093('0x31')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x32'));db[_0x6093('0x33')]=db['sequelize'][_0x6093('0x15')]('../api/userVoiceQueue/userVoiceQueue.model');db['UserChatQueue']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x34'));db[_0x6093('0x35')]=db[_0x6093('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0x6093('0x36')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x37'));db[_0x6093('0x38')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/userSmsQueue/userSmsQueue.model');db[_0x6093('0x39')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x3a'));db[_0x6093('0x3b')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x3c'));db[_0x6093('0x3d')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x3e'));db[_0x6093('0x3f')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x40'));db[_0x6093('0x41')]=db[_0x6093('0x1')]['import'](_0x6093('0x42'));db['MailQueue']=db['sequelize'][_0x6093('0x15')]('../api/mailQueue/mailQueue.model');db['MailSubstatus']=db['sequelize']['import'](_0x6093('0x43'));db[_0x6093('0x44')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/mailInteraction/mailInteraction.model');db[_0x6093('0x45')]=db[_0x6093('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0x6093('0x46')]=db[_0x6093('0x1')]['import'](_0x6093('0x47'));db[_0x6093('0x48')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x49'));db['Dashboard']=db[_0x6093('0x1')][_0x6093('0x15')]('../api/dashboard/dashboard.model');db[_0x6093('0x4a')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/dashboardItem/dashboardItem.model');db['FaxAccount']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x4b'));db['FaxApplication']=db[_0x6093('0x1')][_0x6093('0x15')]('../api/faxApplication/faxApplication.model');db[_0x6093('0x4c')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/faxInteraction/faxInteraction.model');db[_0x6093('0x4d')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x4e'));db[_0x6093('0x4f')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x50'));db[_0x6093('0x51')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x52'));db[_0x6093('0x53')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/smsAccount/smsAccount.model');db[_0x6093('0x54')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x55'));db[_0x6093('0x56')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x57'));db[_0x6093('0x58')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/smsMessage/smsMessage.model');db[_0x6093('0x59')]=db['sequelize']['import'](_0x6093('0x5a'));db[_0x6093('0x5b')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x5c'));db[_0x6093('0x5d')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x5e'));db[_0x6093('0x5f')]=db[_0x6093('0x1')]['import'](_0x6093('0x60'));db[_0x6093('0x61')]=db['sequelize'][_0x6093('0x15')]('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x62'));db[_0x6093('0x63')]=db[_0x6093('0x1')]['import'](_0x6093('0x64'));db[_0x6093('0x65')]=db[_0x6093('0x1')]['import'](_0x6093('0x66'));db[_0x6093('0x67')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x68'));db[_0x6093('0x69')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x6a'));db[_0x6093('0x6b')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x6c'));db[_0x6093('0x6d')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x6e'));db[_0x6093('0x6f')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x70'));db[_0x6093('0x71')]=db[_0x6093('0x1')]['import'](_0x6093('0x72'));db['ChatProactiveAction']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x73'));db[_0x6093('0x74')]=db[_0x6093('0x1')]['import'](_0x6093('0x75'));db['CmContact']=db[_0x6093('0x1')]['import'](_0x6093('0x76'));db[_0x6093('0x77')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x78'));db[_0x6093('0x79')]=db[_0x6093('0x1')]['import'](_0x6093('0x7a'));db[_0x6093('0x7b')]=db[_0x6093('0x1')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x6093('0x7c')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x7d'));db[_0x6093('0x7e')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x7f'));db[_0x6093('0x80')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x81'));db[_0x6093('0x82')]=db[_0x6093('0x1')]['import'](_0x6093('0x83'));db[_0x6093('0x84')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x85'));db[_0x6093('0x86')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x87'));db[_0x6093('0x88')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x89'));db[_0x6093('0x8a')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/condition/condition.model');db[_0x6093('0x8b')]=db[_0x6093('0x1')]['import'](_0x6093('0x8c'));db['Pause']=db['sequelize'][_0x6093('0x15')]('../api/pause/pause.model');db[_0x6093('0x8d')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x8e'));db[_0x6093('0x8f')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x90'));db[_0x6093('0x91')]=db['sequelize']['import'](_0x6093('0x92'));db[_0x6093('0x93')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x94'));db[_0x6093('0x95')]=db[_0x6093('0x1')]['import'](_0x6093('0x96'));db[_0x6093('0x97')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/contactItemType/contactItemType.model');db[_0x6093('0x98')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x99'));db[_0x6093('0x9a')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x9b'));db[_0x6093('0x9c')]=db[_0x6093('0x1')]['import'](_0x6093('0x9d'));db[_0x6093('0x9e')]=db['sequelize']['import'](_0x6093('0x9f'));db[_0x6093('0xa0')]=db[_0x6093('0x1')]['import']('../api/variable/variable.model');db[_0x6093('0xa1')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xa2'));db[_0x6093('0xa3')]=db['sequelize'][_0x6093('0x15')]('../api/integrationReport/integrationReport.model');db[_0x6093('0xa4')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x6093('0xa5')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xa6'));db[_0x6093('0xa7')]=db[_0x6093('0x1')]['import'](_0x6093('0xa8'));db['AnalyticMetric']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xa9'));db[_0x6093('0xaa')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xab'));db[_0x6093('0xac')]=db['sequelize'][_0x6093('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x6093('0xad')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xae'));db[_0x6093('0xaf')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xb0'));db[_0x6093('0xb1')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xb2'));db[_0x6093('0xb3')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xb4'));db[_0x6093('0xb5')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xb6'));db[_0x6093('0xb7')]=db[_0x6093('0x1')]['import'](_0x6093('0xb8'));db[_0x6093('0xb9')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xba'));db[_0x6093('0xbb')]=db[_0x6093('0x1')]['import']('../api/intDeskField/intDeskField.model');db[_0x6093('0xbc')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xbd'));db['ZohoConfiguration']=db['sequelize']['import'](_0x6093('0xbe'));db[_0x6093('0xbf')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/intZohoField/intZohoField.model');db[_0x6093('0xc0')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xc1'));db[_0x6093('0xc2')]=db[_0x6093('0x1')]['import'](_0x6093('0xc3'));db[_0x6093('0xc4')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xc5'));db[_0x6093('0xc6')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xc7'));db[_0x6093('0xc8')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xc9'));db[_0x6093('0xca')]=db[_0x6093('0x1')]['import'](_0x6093('0xcb'));db['VtigerAccount']=db['sequelize'][_0x6093('0x15')](_0x6093('0xcc'));db[_0x6093('0xcd')]=db['sequelize'][_0x6093('0x15')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x6093('0xce')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xcf'));db['ServicenowAccount']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xd0'));db[_0x6093('0xd1')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xd2'));db['ServicenowField']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xd3'));db[_0x6093('0xd4')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xd5'));db['Dynamics365Configuration']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xd6'));db[_0x6093('0xd7')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xd8'));db[_0x6093('0xd9')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xda'));db['FreshsalesConfiguration']=db['sequelize']['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0x6093('0xdb')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xdc'));db[_0x6093('0xa1')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xa2'));db[_0x6093('0xdd')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xde'));db['ChatQueueReport']=db[_0x6093('0x1')]['import'](_0x6093('0xdf'));db[_0x6093('0xe0')]=db[_0x6093('0x1')]['import'](_0x6093('0xe1'));db['JscriptyAnswerReport']=db[_0x6093('0x1')][_0x6093('0x15')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db['sequelize']['import'](_0x6093('0xe2'));db[_0x6093('0xe3')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xe4'));db['SmsQueueReport']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xe5'));db[_0x6093('0xe6')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xe7'));db[_0x6093('0xe8')]=db['sequelize']['import'](_0x6093('0xe9'));db[_0x6093('0xea')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xeb'));db[_0x6093('0xec')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xed'));db[_0x6093('0xee')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xef'));db[_0x6093('0xf0')]=db[_0x6093('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x6093('0xf1')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xf2'));db[_0x6093('0xf3')]=db[_0x6093('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x6093('0xf4')]=db['sequelize'][_0x6093('0x15')]('../api/team/team.model');db[_0x6093('0xf5')]=db['sequelize'][_0x6093('0x15')](_0x6093('0xf6'));db['Campaign']=db[_0x6093('0x1')]['import'](_0x6093('0xf7'));db['Migration']=db[_0x6093('0x1')]['import'](_0x6093('0xf8'));db[_0x6093('0xf9')]=db[_0x6093('0x1')]['import'](_0x6093('0xfa'));db[_0x6093('0xfb')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xfc'));db[_0x6093('0xfd')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0xfe'));db[_0x6093('0xff')]=db[_0x6093('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0x6093('0x100')]=db['sequelize']['import'](_0x6093('0x101'));db[_0x6093('0x102')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x103'));db[_0x6093('0x104')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0x6093('0x105')]=db[_0x6093('0x1')]['import'](_0x6093('0x106'));db[_0x6093('0x107')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x108'));db[_0x6093('0x109')]=db[_0x6093('0x1')]['import']('../api/userProfile/userProfile.model');db[_0x6093('0x10a')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x10b'));db[_0x6093('0x10c')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x10d'));db[_0x6093('0x10e')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x10f'));db[_0x6093('0x110')]=db['sequelize']['import'](_0x6093('0x111'));db[_0x6093('0x112')]=db[_0x6093('0x1')]['import'](_0x6093('0x113'));db[_0x6093('0x114')]=db['sequelize'][_0x6093('0x15')](_0x6093('0x115'));db[_0x6093('0x116')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x117'));db['WhatsappQueueReport']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x118'));db['WhatsappTransferReport']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x119'));db[_0x6093('0x11a')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x11b'));db[_0x6093('0x11c')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x11d'));db['TeamVoiceQueue']=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x11e'));db[_0x6093('0x11f')]=db[_0x6093('0x1')][_0x6093('0x15')]('../api/teamVoicePrefix/teamVoicePrefix.model');db[_0x6093('0x120')]=db['sequelize'][_0x6093('0x15')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x6093('0x121')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x122'));db[_0x6093('0x123')]=db[_0x6093('0x1')][_0x6093('0x15')](_0x6093('0x124'));db[_0x6093('0x14')][_0x6093('0x125')](db['VoiceMail'],{'as':_0x6093('0x24'),'onDelete':'cascade','foreignKey':_0x6093('0x126')});db[_0x6093('0x14')][_0x6093('0x125')](db[_0x6093('0x121')],{'as':_0x6093('0x127'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x126')});db['User'][_0x6093('0x129')](db[_0x6093('0x21')],{'as':_0x6093('0x12a'),'foreignKey':'UserId'});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x31')],{'as':'VoiceQueuesRt','foreignKey':'UserId'});db['User'][_0x6093('0x129')](db[_0x6093('0x1b')],{'as':'Extensions','onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0x14')][_0x6093('0x129')](db['CmHopperFinal'],{'as':_0x6093('0x12b'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x7c')],{'as':_0x6093('0x12c'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x7e')],{'as':'ReportAgentPreview','foreignKey':_0x6093('0x126')});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x5f')],{'as':_0x6093('0x12d'),'foreignKey':'UserId'});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x69')],{'as':_0x6093('0x12e'),'foreignKey':_0x6093('0x126')});db['User'][_0x6093('0x129')](db['SmsInteraction'],{'as':_0x6093('0x12f'),'foreignKey':'UserId'});db['User'][_0x6093('0x129')](db['FaxInteraction'],{'as':_0x6093('0x130'),'foreignKey':_0x6093('0x126')});db['User'][_0x6093('0x129')](db[_0x6093('0x44')],{'as':_0x6093('0x131'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x14')]['hasMany'](db[_0x6093('0x114')],{'as':_0x6093('0x132'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x10e')],{'as':_0x6093('0x133'),'foreignKey':_0x6093('0x134')});db[_0x6093('0x14')][_0x6093('0x129')](db[_0x6093('0x77')],{'as':_0x6093('0x135'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x6093('0x14')][_0x6093('0x136')](db['UserProfile'],{'as':_0x6093('0x109'),'foreignKey':'userProfileId'});db['User'][_0x6093('0x137')](db[_0x6093('0x71')],{'as':'Groups','through':_0x6093('0x138')});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x139')],{'as':_0x6093('0x13a'),'through':_0x6093('0x13b')});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x105')],{'as':_0x6093('0x13c'),'through':_0x6093('0x13d')});db[_0x6093('0x14')]['belongsToMany'](db['Team'],{'through':_0x6093('0x13e')});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x44')],{'as':_0x6093('0x131'),'through':_0x6093('0x13f')});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x69')],{'as':'ChatInteractions','through':_0x6093('0x140')});db['User'][_0x6093('0x137')](db[_0x6093('0x4c')],{'as':_0x6093('0x130'),'through':_0x6093('0x141')});db['User'][_0x6093('0x137')](db['SmsInteraction'],{'as':'SmsInteractions','through':_0x6093('0x142')});db['User'][_0x6093('0x137')](db['OpenchannelInteraction'],{'as':_0x6093('0x12d'),'through':_0x6093('0x143')});db[_0x6093('0x14')][_0x6093('0x137')](db['WhatsappInteraction'],{'as':_0x6093('0x132'),'through':_0x6093('0x144')});db[_0x6093('0x14')]['belongsToMany'](db['VoiceQueue'],{'as':_0x6093('0x145'),'through':_0x6093('0x33'),'required':![]});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x107')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x146')],{'as':_0x6093('0x147'),'through':_0x6093('0x35'),'required':![]});db['User'][_0x6093('0x137')](db[_0x6093('0x6f')],{'as':_0x6093('0x148'),'through':_0x6093('0x149'),'required':![],'hooks':!![]});db['User']['belongsToMany'](db[_0x6093('0x4f')],{'as':_0x6093('0x14a'),'through':_0x6093('0x36'),'required':![]});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x59')],{'as':_0x6093('0x14b'),'through':_0x6093('0x38'),'required':![]});db['User'][_0x6093('0x137')](db[_0x6093('0x14c')],{'as':'OpenchannelQueues','through':_0x6093('0x39'),'required':![]});db[_0x6093('0x14')][_0x6093('0x137')](db['WhatsappQueue'],{'as':_0x6093('0x14d'),'through':_0x6093('0x3b'),'required':![]});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x105')],{'through':_0x6093('0x13d')});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x63')],{'as':_0x6093('0x14e'),'through':_0x6093('0x14f')});db['User'][_0x6093('0x137')](db['FaxAccount'],{'as':_0x6093('0x150'),'through':_0x6093('0x151')});db[_0x6093('0x14')][_0x6093('0x137')](db['MailAccount'],{'as':_0x6093('0x152'),'through':'user_has_mail_accounts'});db[_0x6093('0x14')][_0x6093('0x137')](db[_0x6093('0x5b')],{'as':_0x6093('0x153'),'through':_0x6093('0x154')});db[_0x6093('0x14')][_0x6093('0x137')](db['SmsAccount'],{'as':_0x6093('0x155'),'through':_0x6093('0x156')});db[_0x6093('0x14')]['belongsToMany'](db['WhatsappAccount'],{'as':_0x6093('0x157'),'through':_0x6093('0x158')});db[_0x6093('0x17')][_0x6093('0x129')](db[_0x6093('0x1b')],{'as':_0x6093('0x159'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x15a')});db[_0x6093('0x19')]['hasMany'](db[_0x6093('0x1b')],{'onDelete':_0x6093('0x128')});db['VoiceExtension'][_0x6093('0x129')](db[_0x6093('0x1b')],{'as':_0x6093('0x15b'),'onDelete':'cascade'});db[_0x6093('0x1d')]['belongsToMany'](db[_0x6093('0x93')],{'as':_0x6093('0x15c'),'through':_0x6093('0x15d')});db[_0x6093('0x1f')]['hasMany'](db['UserVoiceQueueRt'],{'as':_0x6093('0x15e'),'foreignKey':_0x6093('0x15f')});db['VoiceQueue'][_0x6093('0x129')](db['CmHopper'],{'as':_0x6093('0x135'),'foreignKey':_0x6093('0x15f')});db[_0x6093('0x1f')][_0x6093('0x129')](db[_0x6093('0x7b')],{'as':_0x6093('0x12b'),'foreignKey':_0x6093('0x15f')});db['VoiceQueue'][_0x6093('0x129')](db['CmHopperHistory'],{'as':_0x6093('0x160'),'foreignKey':_0x6093('0x15f')});db['VoiceQueue'][_0x6093('0x129')](db[_0x6093('0x7e')],{'as':_0x6093('0x7e'),'foreignKey':_0x6093('0x15f')});db['VoiceQueue'][_0x6093('0x129')](db[_0x6093('0x79')],{'as':_0x6093('0x161'),'foreignKey':'VoiceQueueId'});db[_0x6093('0x1f')][_0x6093('0x129')](db[_0x6093('0xe3')],{'as':'JscriptySessions','foreignKey':_0x6093('0x15f')});db['VoiceQueue'][_0x6093('0x136')](db[_0x6093('0x2e')],{'as':_0x6093('0x2e'),'foreignKey':_0x6093('0x162')});db[_0x6093('0x1f')][_0x6093('0x136')](db[_0x6093('0x2e')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x6093('0x136')](db['Interval'],{'as':_0x6093('0x8b'),'foreignKey':_0x6093('0x163')});db[_0x6093('0x1f')][_0x6093('0x136')](db[_0x6093('0x164')],{'as':'mandatoryDispositionPause','foreignKey':_0x6093('0x165')});db[_0x6093('0x1f')][_0x6093('0x137')](db[_0x6093('0x105')],{'as':_0x6093('0x13c'),'through':_0x6093('0x166')});db['VoiceQueue'][_0x6093('0x137')](db[_0x6093('0x14')],{'as':'Agents','through':_0x6093('0x33')});db['VoiceQueue'][_0x6093('0x137')](db[_0x6093('0xf4')],{'as':_0x6093('0x167'),'through':_0x6093('0x168')});db[_0x6093('0x1f')][_0x6093('0x137')](db[_0x6093('0x105')],{'as':_0x6093('0x169'),'through':_0x6093('0x16a')});db['VoiceRecording'][_0x6093('0x136')](db['User'],{'as':_0x6093('0x14'),'foreignKey':_0x6093('0x126')});db['ScreenRecording']['belongsTo'](db[_0x6093('0x14')],{'as':_0x6093('0x14'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x24')][_0x6093('0x129')](db['VoiceMailMessage'],{'as':_0x6093('0x16b'),'onDelete':'cascade','foreignKey':_0x6093('0x16c'),'sourceKey':'mailbox'});db[_0x6093('0x16d')]['belongsTo'](db[_0x6093('0x24')],{'foreignKey':_0x6093('0x16c'),'targetKey':'mailbox'});db[_0x6093('0x25')][_0x6093('0x129')](db[_0x6093('0x2a')],{'as':'QueueCalls','foreignKey':'uniqueid','constraints':![]});db[_0x6093('0x25')][_0x6093('0x129')](db[_0x6093('0x29')],{'as':_0x6093('0x16e'),'foreignKey':_0x6093('0x16f'),'constraints':![]});db['VoiceCallReport']['belongsTo'](db[_0x6093('0x14')],{'as':_0x6093('0x14'),'foreignKey':'UserId'});db[_0x6093('0x25')]['belongsTo'](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db['MailServerIn'][_0x6093('0x136')](db[_0x6093('0x41')],{'as':_0x6093('0x41'),'foreignKey':_0x6093('0x172')});db[_0x6093('0x3d')][_0x6093('0x136')](db[_0x6093('0x11c')],{'as':_0x6093('0x11c'),'foreignKey':'CloudProviderId','onDelete':_0x6093('0x173')});db[_0x6093('0x3f')][_0x6093('0x136')](db['MailAccount'],{'as':_0x6093('0x41'),'foreignKey':_0x6093('0x172')});db[_0x6093('0x3f')][_0x6093('0x136')](db[_0x6093('0x11c')],{'as':_0x6093('0x11c'),'foreignKey':_0x6093('0x174'),'onDelete':_0x6093('0x173')});db['MailAccount']['hasOne'](db[_0x6093('0x3d')],{'as':_0x6093('0x175'),'onDelete':_0x6093('0x128')});db[_0x6093('0x41')][_0x6093('0x125')](db[_0x6093('0x3f')],{'as':_0x6093('0x176'),'onDelete':_0x6093('0x128')});db['MailAccount'][_0x6093('0x129')](db[_0x6093('0x88')],{'as':_0x6093('0x177'),'foreignKey':_0x6093('0x172'),'onDelete':_0x6093('0x128')});db[_0x6093('0x41')][_0x6093('0x129')](db[_0x6093('0x86')],{'as':_0x6093('0x178'),'foreignKey':'MailAccountId'});db[_0x6093('0x41')][_0x6093('0x129')](db[_0x6093('0x45')],{'as':_0x6093('0x16b'),'foreignKey':_0x6093('0x172')});db[_0x6093('0x41')][_0x6093('0x129')](db[_0x6093('0x44')],{'as':'Interactions'});db[_0x6093('0x41')][_0x6093('0x129')](db[_0x6093('0x46')],{'as':'Applications','foreignKey':_0x6093('0x172'),'onDelete':_0x6093('0x128')});db[_0x6093('0x41')][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':'ListId'});db['MailAccount'][_0x6093('0x136')](db[_0x6093('0x9c')],{'as':_0x6093('0x9c'),'foreignKey':_0x6093('0x17a')});db[_0x6093('0x41')][_0x6093('0x136')](db[_0x6093('0x164')],{'as':_0x6093('0x17b'),'foreignKey':_0x6093('0x165')});db['MailAccount']['belongsToMany'](db['User'],{'as':_0x6093('0x17c'),'through':_0x6093('0x17d')});db['MailQueue'][_0x6093('0x137')](db[_0x6093('0x14')],{'as':'Agents','through':_0x6093('0x35')});db[_0x6093('0x146')][_0x6093('0x137')](db[_0x6093('0xf4')],{'through':_0x6093('0x17e'),'as':_0x6093('0x167')});db[_0x6093('0x44')][_0x6093('0x129')](db[_0x6093('0x45')],{'as':_0x6093('0x16b'),'onDelete':'cascade','foreignKey':_0x6093('0x17f')});db[_0x6093('0x44')][_0x6093('0x136')](db[_0x6093('0x41')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x172')});db['MailInteraction']['belongsTo'](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x44')][_0x6093('0x136')](db['User'],{'as':_0x6093('0x181'),'foreignKey':'UserId'});db[_0x6093('0x44')][_0x6093('0x137')](db['Tag'],{'through':_0x6093('0x182'),'as':_0x6093('0x183')});db[_0x6093('0x44')][_0x6093('0x137')](db['Tag'],{'through':_0x6093('0x182'),'as':'ThroughTags'});db[_0x6093('0x44')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':_0x6093('0x184'),'through':_0x6093('0x13f'),'foreignKey':_0x6093('0x17f')});db[_0x6093('0x45')][_0x6093('0x129')](db[_0x6093('0xf9')],{'as':'Attachments','onDelete':_0x6093('0x128')});db['MailMessage'][_0x6093('0x136')](db['User'],{'as':_0x6093('0x14')});db['MailMessage'][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x170')});db[_0x6093('0x45')]['belongsTo'](db[_0x6093('0x44')],{'as':_0x6093('0x185'),'foreignKey':_0x6093('0x17f')});db[_0x6093('0x45')]['belongsTo'](db['MailAccount'],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x172')});db[_0x6093('0x45')]['belongsTo'](db[_0x6093('0x63')],{'as':_0x6093('0x63'),'foreignKey':_0x6093('0x186')});db[_0x6093('0x45')][_0x6093('0x136')](db[_0x6093('0x6d')],{'as':_0x6093('0x6d'),'foreignKey':_0x6093('0x187')});db['MailApplication']['belongsTo'](db[_0x6093('0x14')],{'onDelete':_0x6093('0x173')});db[_0x6093('0x46')][_0x6093('0x136')](db[_0x6093('0x146')],{'onDelete':_0x6093('0x173')});db[_0x6093('0x46')][_0x6093('0x136')](db[_0x6093('0x41')],{'onDelete':_0x6093('0x173')});db[_0x6093('0x46')][_0x6093('0x136')](db[_0x6093('0x8b')],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x163')});db[_0x6093('0x46')][_0x6093('0x136')](db[_0x6093('0x95')],{'onDelete':'restrict','foreignKey':_0x6093('0x188')});db['MailQueueReport'][_0x6093('0x136')](db[_0x6093('0x41')],{});db[_0x6093('0x48')]['belongsTo'](db[_0x6093('0x105')],{'as':'List','foreignKey':_0x6093('0x189')});db[_0x6093('0x48')][_0x6093('0x136')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x6093('0x48')][_0x6093('0x136')](db[_0x6093('0x44')],{});db[_0x6093('0x48')]['belongsTo'](db[_0x6093('0x45')],{});db[_0x6093('0x48')][_0x6093('0x136')](db[_0x6093('0x14')],{});db[_0x6093('0x48')][_0x6093('0x136')](db[_0x6093('0x146')],{});db[_0x6093('0x18a')][_0x6093('0x129')](db[_0x6093('0x4a')],{'as':'Items','onDelete':_0x6093('0x128')});db[_0x6093('0x18b')][_0x6093('0x129')](db[_0x6093('0x88')],{'as':_0x6093('0x177'),'foreignKey':_0x6093('0x18c'),'onDelete':_0x6093('0x128')});db['FaxAccount'][_0x6093('0x129')](db[_0x6093('0x86')],{'as':'Answers','foreignKey':_0x6093('0x18c')});db['FaxAccount'][_0x6093('0x129')](db[_0x6093('0x4c')],{'as':'Interactions'});db[_0x6093('0x18b')][_0x6093('0x129')](db[_0x6093('0x18d')],{'as':_0x6093('0x15b'),'foreignKey':_0x6093('0x18c'),'onDelete':'cascade'});db[_0x6093('0x18b')][_0x6093('0x129')](db[_0x6093('0x1b')],{'as':_0x6093('0x18e'),'onDelete':_0x6093('0x128')});db[_0x6093('0x18b')][_0x6093('0x129')](db['FaxMessage'],{'as':'Messages'});db['FaxAccount'][_0x6093('0x136')](db[_0x6093('0x2e')],{'as':_0x6093('0x2e')});db[_0x6093('0x18b')][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189')});db[_0x6093('0x18b')][_0x6093('0x136')](db[_0x6093('0x164')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0x6093('0x18b')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':'Agents','through':_0x6093('0x151')});db['FaxApplication'][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':'restrict'});db[_0x6093('0x18d')][_0x6093('0x136')](db['FaxQueue'],{'onDelete':_0x6093('0x173')});db[_0x6093('0x18d')][_0x6093('0x136')](db[_0x6093('0x18b')],{'onDelete':'restrict'});db[_0x6093('0x18d')][_0x6093('0x136')](db['Tag'],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x188')});db['FaxInteraction'][_0x6093('0x129')](db[_0x6093('0x4d')],{'as':_0x6093('0x16b'),'onDelete':_0x6093('0x128'),'foreignKey':'FaxInteractionId'});db[_0x6093('0x4c')][_0x6093('0x136')](db[_0x6093('0x18b')],{'as':_0x6093('0x180'),'foreignKey':'FaxAccountId'});db[_0x6093('0x4c')][_0x6093('0x136')](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':'ContactId'});db[_0x6093('0x4c')]['belongsTo'](db['User'],{'as':_0x6093('0x181'),'foreignKey':'UserId'});db[_0x6093('0x4c')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':_0x6093('0x18f'),'as':_0x6093('0x183')});db[_0x6093('0x4c')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':'fax_interaction_has_tags','as':_0x6093('0x190')});db[_0x6093('0x4c')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':_0x6093('0x184'),'through':_0x6093('0x141'),'foreignKey':'FaxInteractionId'});db['FaxMessage'][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x14')});db[_0x6093('0x4d')][_0x6093('0x136')](db[_0x6093('0x4c')],{'as':'Interaction','foreignKey':_0x6093('0x191')});db[_0x6093('0x4d')][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':'Contact'});db[_0x6093('0x4d')][_0x6093('0x136')](db[_0x6093('0xf9')],{'as':_0x6093('0xf9'),'foreignKey':_0x6093('0x192')});db['FaxMessage']['belongsTo'](db[_0x6093('0x18b')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x18c')});db[_0x6093('0x4f')]['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':'UserFaxQueue'});db[_0x6093('0x4f')][_0x6093('0x137')](db[_0x6093('0xf4')],{'through':_0x6093('0x193'),'as':_0x6093('0x167')});db[_0x6093('0x51')][_0x6093('0x136')](db['FaxAccount'],{});db[_0x6093('0x51')]['belongsTo'](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189')});db[_0x6093('0x51')]['belongsTo'](db[_0x6093('0x139')],{'as':'Contact','foreignKey':_0x6093('0x171')});db[_0x6093('0x51')][_0x6093('0x136')](db[_0x6093('0x4c')],{});db[_0x6093('0x51')][_0x6093('0x136')](db[_0x6093('0x4d')],{});db[_0x6093('0x51')][_0x6093('0x136')](db[_0x6093('0x14')],{});db[_0x6093('0x51')][_0x6093('0x136')](db[_0x6093('0x4f')],{});db[_0x6093('0x53')][_0x6093('0x129')](db[_0x6093('0x88')],{'as':_0x6093('0x177'),'foreignKey':_0x6093('0x194'),'onDelete':_0x6093('0x128')});db[_0x6093('0x53')][_0x6093('0x129')](db[_0x6093('0x86')],{'as':_0x6093('0x178'),'foreignKey':_0x6093('0x194')});db['SmsAccount'][_0x6093('0x129')](db[_0x6093('0x58')],{'as':'Messages','foreignKey':_0x6093('0x194')});db[_0x6093('0x53')][_0x6093('0x129')](db['SmsInteraction'],{'as':'Interactions'});db[_0x6093('0x53')]['hasMany'](db[_0x6093('0x54')],{'as':_0x6093('0x15b'),'foreignKey':_0x6093('0x194'),'onDelete':_0x6093('0x128')});db[_0x6093('0x53')][_0x6093('0x136')](db['CmList'],{'as':'List','foreignKey':_0x6093('0x189')});db[_0x6093('0x53')][_0x6093('0x136')](db['Pause'],{'as':_0x6093('0x17b'),'foreignKey':_0x6093('0x165')});db[_0x6093('0x53')]['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':_0x6093('0x156')});db[_0x6093('0x54')][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':'restrict'});db['SmsApplication'][_0x6093('0x136')](db[_0x6093('0x59')],{'onDelete':'restrict'});db[_0x6093('0x54')][_0x6093('0x136')](db[_0x6093('0x53')],{'onDelete':_0x6093('0x173')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':'restrict','foreignKey':_0x6093('0x163')});db[_0x6093('0x54')][_0x6093('0x136')](db[_0x6093('0x95')],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x188')});db[_0x6093('0x56')][_0x6093('0x129')](db[_0x6093('0x58')],{'as':'Messages','onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x195')});db['SmsInteraction'][_0x6093('0x136')](db[_0x6093('0x53')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x194')});db[_0x6093('0x56')]['belongsTo'](db[_0x6093('0x139')],{'as':'Contact','foreignKey':_0x6093('0x171')});db['SmsInteraction']['belongsTo'](db[_0x6093('0x14')],{'as':_0x6093('0x181'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x56')]['belongsToMany'](db[_0x6093('0x95')],{'through':'sms_interaction_has_tags','as':_0x6093('0x183')});db[_0x6093('0x56')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':'sms_interaction_has_tags','as':'ThroughTags'});db[_0x6093('0x56')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':'Users','through':_0x6093('0x142'),'foreignKey':_0x6093('0x195')});db[_0x6093('0x58')][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x14')});db[_0x6093('0x58')][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x170')});db[_0x6093('0x58')][_0x6093('0x136')](db['SmsInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x6093('0x195')});db[_0x6093('0x58')][_0x6093('0x136')](db[_0x6093('0x53')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x194')});db[_0x6093('0x59')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':_0x6093('0x38'),'foreignKey':'SmsQueueId'});db[_0x6093('0x59')][_0x6093('0x137')](db[_0x6093('0xf4')],{'through':_0x6093('0x196'),'as':_0x6093('0x167')});db['OpenchannelAccount'][_0x6093('0x129')](db['Disposition'],{'as':_0x6093('0x177'),'foreignKey':_0x6093('0x197'),'onDelete':_0x6093('0x128')});db[_0x6093('0x5b')][_0x6093('0x129')](db[_0x6093('0x86')],{'as':'Answers','foreignKey':_0x6093('0x197')});db['OpenchannelAccount']['hasMany'](db[_0x6093('0x5f')],{'as':_0x6093('0x198'),'foreignKey':_0x6093('0x197')});db[_0x6093('0x5b')][_0x6093('0x129')](db[_0x6093('0x61')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x6093('0x5b')][_0x6093('0x129')](db['OpenchannelApplication'],{'as':'Applications','foreignKey':_0x6093('0x197'),'onDelete':_0x6093('0x128')});db['OpenchannelAccount']['belongsTo'](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189')});db['OpenchannelAccount'][_0x6093('0x136')](db[_0x6093('0x164')],{'as':'mandatoryDispositionPause','foreignKey':_0x6093('0x165')});db['OpenchannelAccount']['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':_0x6093('0x154')});db[_0x6093('0x5d')][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':_0x6093('0x173')});db[_0x6093('0x5d')][_0x6093('0x136')](db[_0x6093('0x14c')],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x199')});db['OpenchannelApplication'][_0x6093('0x136')](db['OpenchannelAccount'],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x197')});db[_0x6093('0x5d')][_0x6093('0x136')](db[_0x6093('0x8b')],{'onDelete':_0x6093('0x173'),'foreignKey':'IntervalId'});db['OpenchannelApplication'][_0x6093('0x136')](db[_0x6093('0x95')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0x6093('0x5f')][_0x6093('0x129')](db[_0x6093('0x61')],{'as':_0x6093('0x16b'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x19a')});db[_0x6093('0x5f')]['belongsTo'](db['OpenchannelAccount'],{'as':_0x6093('0x180'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction'][_0x6093('0x136')](db[_0x6093('0x139')],{'as':'Contact','foreignKey':_0x6093('0x171')});db[_0x6093('0x5f')][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x181'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x5f')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':_0x6093('0x19b'),'as':_0x6093('0x183')});db[_0x6093('0x5f')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':'openchannel_interaction_has_tags','as':_0x6093('0x190')});db[_0x6093('0x5f')]['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x184'),'through':'user_has_openchannel_interactions','foreignKey':_0x6093('0x19a')});db[_0x6093('0x61')][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x14')});db[_0x6093('0x61')][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x170')});db['OpenchannelMessage'][_0x6093('0x136')](db['OpenchannelInteraction'],{'onDelete':_0x6093('0x128'),'as':'Interaction','foreignKey':_0x6093('0x19a')});db['OpenchannelMessage'][_0x6093('0x136')](db[_0x6093('0xf9')],{'as':_0x6093('0xf9'),'foreignKey':'AttachmentId'});db[_0x6093('0x61')][_0x6093('0x136')](db['OpenchannelAccount'],{'as':_0x6093('0x180'),'foreignKey':'OpenchannelAccountId'});db[_0x6093('0x14c')]['belongsToMany'](db['User'],{'as':_0x6093('0x17c'),'through':_0x6093('0x39'),'foreignKey':_0x6093('0x199')});db[_0x6093('0x14c')][_0x6093('0x137')](db[_0x6093('0xf4')],{'through':_0x6093('0x19c'),'as':_0x6093('0x167')});db[_0x6093('0x63')][_0x6093('0x129')](db['Disposition'],{'as':_0x6093('0x177'),'foreignKey':_0x6093('0x186'),'onDelete':_0x6093('0x128')});db[_0x6093('0x63')][_0x6093('0x129')](db[_0x6093('0x86')],{'as':_0x6093('0x178'),'foreignKey':_0x6093('0x186')});db[_0x6093('0x63')]['hasMany'](db[_0x6093('0x19d')],{'as':'ProactiveActions'});db['ChatWebsite'][_0x6093('0x129')](db[_0x6093('0x69')],{'as':_0x6093('0x198')});db[_0x6093('0x63')][_0x6093('0x129')](db[_0x6093('0x67')],{'as':_0x6093('0x15b'),'foreignKey':_0x6093('0x186'),'onDelete':_0x6093('0x128')});db[_0x6093('0x63')][_0x6093('0x129')](db['ChatMessage'],{'as':_0x6093('0x16b')});db[_0x6093('0x63')][_0x6093('0x136')](db['CmList'],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189')});db['ChatWebsite'][_0x6093('0x136')](db[_0x6093('0x8b')],{'as':_0x6093('0x8b'),'foreignKey':_0x6093('0x163')});db['ChatWebsite'][_0x6093('0x136')](db[_0x6093('0x41')],{'as':_0x6093('0x41'),'foreignKey':'MailAccountId'});db[_0x6093('0x63')][_0x6093('0x136')](db[_0x6093('0x164')],{'as':'mandatoryDispositionPause','foreignKey':_0x6093('0x165')});db[_0x6093('0x63')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':'Agents','through':_0x6093('0x14f')});db['OpenchannelQueueReport'][_0x6093('0x136')](db[_0x6093('0x5b')],{});db['OpenchannelQueueReport'][_0x6093('0x136')](db[_0x6093('0x105')],{'as':'List','foreignKey':'ListId'});db[_0x6093('0x65')][_0x6093('0x136')](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db['OpenchannelQueueReport'][_0x6093('0x136')](db[_0x6093('0x5f')],{});db[_0x6093('0x65')][_0x6093('0x136')](db['OpenchannelMessage'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6093('0x14')],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x6093('0x14c')],{});db[_0x6093('0x67')]['belongsTo'](db[_0x6093('0x14')],{'as':_0x6093('0x19e'),'foreignKey':'UserId','onDelete':_0x6093('0x173')});db[_0x6093('0x67')][_0x6093('0x136')](db[_0x6093('0x6f')],{'as':_0x6093('0x19f'),'foreignKey':_0x6093('0x1a0'),'onDelete':'restrict'});db[_0x6093('0x67')][_0x6093('0x136')](db[_0x6093('0x63')],{'as':_0x6093('0x1a1'),'foreignKey':_0x6093('0x186'),'onDelete':_0x6093('0x173')});db[_0x6093('0x67')][_0x6093('0x136')](db['Tag'],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x188')});db[_0x6093('0x69')][_0x6093('0x129')](db[_0x6093('0x6b')],{'as':'Messages','onDelete':'cascade','foreignKey':'ChatInteractionId'});db[_0x6093('0x69')]['belongsTo'](db[_0x6093('0x63')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x186')});db[_0x6093('0x69')][_0x6093('0x136')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x6093('0x69')][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x181'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x69')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':_0x6093('0x1a2'),'as':_0x6093('0x183')});db[_0x6093('0x69')]['belongsToMany'](db[_0x6093('0x95')],{'through':_0x6093('0x1a2'),'as':_0x6093('0x190')});db[_0x6093('0x69')]['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x184'),'through':_0x6093('0x140'),'foreignKey':'ChatInteractionId'});db[_0x6093('0x6b')][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x14')});db[_0x6093('0x6b')][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x170'),'foreignKey':'ContactId'});db['ChatMessage']['belongsTo'](db[_0x6093('0x69')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x6093('0x1a3')});db[_0x6093('0x6b')][_0x6093('0x136')](db['Attachment'],{'as':'Attachment','foreignKey':_0x6093('0x192')});db[_0x6093('0x6b')]['belongsTo'](db['ChatWebsite'],{'as':_0x6093('0x180'),'foreignKey':'ChatWebsiteId'});db[_0x6093('0x6d')][_0x6093('0x129')](db[_0x6093('0xf9')],{'as':_0x6093('0x1a4'),'foreignKey':_0x6093('0x187'),'onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0x6d')][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x170'),'foreignKey':'ContactId'});db[_0x6093('0x6d')]['belongsTo'](db[_0x6093('0x63')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x186')});db[_0x6093('0x6f')]['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':'UserChatQueue','hooks':!![]});db[_0x6093('0x6f')]['belongsToMany'](db[_0x6093('0xf4')],{'through':_0x6093('0x1a5'),'as':_0x6093('0x167')});db[_0x6093('0x71')][_0x6093('0x129')](db[_0x6093('0xe0')],{'as':'Messages','foreignKey':_0x6093('0x1a6'),'onDelete':_0x6093('0x128')});db[_0x6093('0x71')][_0x6093('0x137')](db['User'],{'as':_0x6093('0x15e'),'through':_0x6093('0x138')});db[_0x6093('0x19d')][_0x6093('0x136')](db[_0x6093('0x63')],{'as':_0x6093('0x1a1'),'foreignKey':_0x6093('0x186')});db[_0x6093('0x74')]['hasMany'](db[_0x6093('0x139')],{'as':_0x6093('0x13a'),'foreignKey':_0x6093('0x1a7')});db[_0x6093('0x139')][_0x6093('0x129')](db['CmContactHasItem'],{'as':_0x6093('0x1a8'),'foreignKey':_0x6093('0x1a9')});db['CmContact'][_0x6093('0x129')](db['CmHopper'],{'as':_0x6093('0x135'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0x7b')],{'as':_0x6093('0x12b'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0x7c')],{'as':'HopperHistories','foreignKey':'ContactId'});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0x7e')],{'as':_0x6093('0x7e'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0xe3')],{'as':'JscriptySessions','foreignKey':'ContactId'});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0x5f')],{'as':_0x6093('0x12d'),'foreignKey':_0x6093('0x171'),'onDelete':_0x6093('0x173')});db['CmContact'][_0x6093('0x129')](db[_0x6093('0x69')],{'as':'ChatInteractions','foreignKey':_0x6093('0x171'),'onDelete':_0x6093('0x173')});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0x56')],{'as':_0x6093('0x12f'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x6093('0x139')][_0x6093('0x129')](db[_0x6093('0x4c')],{'as':_0x6093('0x130'),'foreignKey':_0x6093('0x171'),'onDelete':_0x6093('0x173')});db['CmContact'][_0x6093('0x129')](db[_0x6093('0x44')],{'as':_0x6093('0x131'),'foreignKey':_0x6093('0x171'),'onDelete':'restrict'});db[_0x6093('0x139')]['belongsTo'](db[_0x6093('0x74')],{'as':_0x6093('0x1aa'),'foreignKey':'CompanyId'});db['CmContact'][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189'),'onDelete':_0x6093('0x128')});db[_0x6093('0x139')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':_0x6093('0x184'),'through':'cm_user_has_contacts'});db[_0x6093('0x139')][_0x6093('0x137')](db[_0x6093('0x95')],{'as':'Tags','through':_0x6093('0x1ab')});db[_0x6093('0x139')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':'cm_contact_has_tags','as':_0x6093('0x190')});db[_0x6093('0x77')]['hasMany'](db[_0x6093('0x9a')],{'as':_0x6093('0x1ac'),'foreignKey':_0x6093('0x1ad')});db['CmHopper']['belongsTo'](db[_0x6093('0x139')],{'as':'Contact','foreignKey':_0x6093('0x171'),'onDelete':_0x6093('0x128')});db[_0x6093('0x77')][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189'),'onDelete':_0x6093('0x128')});db['CmHopper'][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x19e'),'foreignKey':_0x6093('0x126')});db['CmHopper'][_0x6093('0x136')](db[_0x6093('0x1f')],{'as':'Queue','foreignKey':_0x6093('0x15f'),'onDelete':_0x6093('0x128')});db[_0x6093('0x77')][_0x6093('0x136')](db[_0x6093('0x1ae')],{'as':_0x6093('0x1ae'),'foreignKey':'CampaignId','onDelete':_0x6093('0x128')});db[_0x6093('0x77')][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x181'),'foreignKey':'OwnerId'});db['CmHopperBlack'][_0x6093('0x136')](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171'),'onDelete':_0x6093('0x128')});db[_0x6093('0x79')]['belongsTo'](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':_0x6093('0x189'),'onDelete':_0x6093('0x128')});db[_0x6093('0x79')]['belongsTo'](db[_0x6093('0x1f')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x6093('0x128')});db[_0x6093('0x79')][_0x6093('0x136')](db[_0x6093('0x1ae')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x6093('0x128')});db[_0x6093('0x84')]['hasMany'](db['Condition'],{'as':{'plural':_0x6093('0x1af'),'singular':_0x6093('0x1b0')},'foreignKey':'AutomationAllId','onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0x84')][_0x6093('0x129')](db['Condition'],{'as':{'plural':_0x6093('0x1b1'),'singular':_0x6093('0x1b2')},'foreignKey':_0x6093('0x1b3'),'onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0x84')][_0x6093('0x129')](db['Action'],{'as':_0x6093('0x1b4'),'foreignKey':_0x6093('0x1b5'),'onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0x88')]['hasMany'](db[_0x6093('0x88')],{'as':'Dispositions','foreignKey':_0x6093('0x1b6'),'onDelete':'cascade'});db[_0x6093('0x8b')][_0x6093('0x129')](db['Interval'],{'as':_0x6093('0x1b7'),'foreignKey':_0x6093('0x163'),'onDelete':_0x6093('0x128'),'hooks':!![],'required':![]});db[_0x6093('0x8b')][_0x6093('0x129')](db['VoiceExtension'],{'as':_0x6093('0x1b8'),'foreignKey':_0x6093('0x163'),'onDelete':'restrict'});db[_0x6093('0x8b')][_0x6093('0x129')](db['MailApplication'],{'as':_0x6093('0x1b9'),'foreignKey':_0x6093('0x163')});db[_0x6093('0x8b')][_0x6093('0x129')](db['ChatApplication'],{'as':_0x6093('0x1ba'),'foreignKey':_0x6093('0x163')});db['Interval'][_0x6093('0x129')](db[_0x6093('0x18d')],{'as':_0x6093('0x1bb'),'foreignKey':_0x6093('0x163')});db[_0x6093('0x8b')][_0x6093('0x129')](db[_0x6093('0x54')],{'as':'SmsApplications','foreignKey':'IntervalId'});db[_0x6093('0x91')][_0x6093('0x136')](db['MailAccount'],{});db[_0x6093('0x91')][_0x6093('0x136')](db['AnalyticDefaultReport'],{'foreignKey':'DefaultReportId'});db[_0x6093('0x91')]['belongsTo'](db[_0x6093('0xa4')],{'foreignKey':_0x6093('0x1bc')});db['Sound'][_0x6093('0x137')](db[_0x6093('0x1d')],{'as':_0x6093('0x1bd'),'through':_0x6093('0x15d'),'onDelete':'restrict'});db['Tag']['belongsToMany'](db[_0x6093('0x139')],{'through':_0x6093('0x1ab')});db['Tag']['belongsToMany'](db['ChatInteraction'],{'through':_0x6093('0x1a2')});db['Tag'][_0x6093('0x137')](db[_0x6093('0x44')],{'through':'mail_interaction_has_tags'});db[_0x6093('0x95')][_0x6093('0x137')](db[_0x6093('0x56')],{'through':_0x6093('0x1be')});db[_0x6093('0x95')][_0x6093('0x137')](db[_0x6093('0x4c')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x6093('0x5f')],{'through':'openchannel_interaction_has_tags'});db[_0x6093('0x95')]['belongsToMany'](db[_0x6093('0x114')],{'through':_0x6093('0x1bf')});db['CmContactHasItem'][_0x6093('0x136')](db[_0x6093('0x97')],{'as':_0x6093('0x1c0'),'foreignKey':_0x6093('0x1c1')});db['CmHopperAdditionalPhone'][_0x6093('0x136')](db[_0x6093('0x77')],{'as':_0x6093('0x1c2'),'foreignKey':_0x6093('0x1ad')});db['CmContactHasItem'][_0x6093('0x136')](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x1a9')});db[_0x6093('0x9e')]['hasMany'](db['Condition'],{'as':{'plural':_0x6093('0x1c3'),'singular':_0x6093('0x1c4')},'foreignKey':_0x6093('0x1c5'),'onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0x6093('0x8a')],{'as':{'plural':_0x6093('0x1c6'),'singular':_0x6093('0x1c7')},'foreignKey':_0x6093('0x1c8'),'onDelete':_0x6093('0x128'),'hooks':!![]});db['Trigger'][_0x6093('0x129')](db[_0x6093('0x82')],{'as':_0x6093('0x1b4'),'foreignKey':'TriggerId','onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0xa4')]['hasMany'](db[_0x6093('0xaa')],{'as':'Fields','onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1bc'),'hooks':!![]});db[_0x6093('0xa5')][_0x6093('0x129')](db[_0x6093('0xaa')],{'as':_0x6093('0x1c9'),'onDelete':_0x6093('0x128'),'foreignKey':'DefaultReportId'});db[_0x6093('0x1ca')][_0x6093('0x129')](db[_0x6093('0xaa')],{'as':'Fields','onDelete':_0x6093('0x128'),'foreignKey':'MetricId'});db['AnalyticFieldReport'][_0x6093('0x136')](db[_0x6093('0x1ca')],{'foreignKey':_0x6093('0x1cb')});db[_0x6093('0xad')]['hasMany'](db[_0x6093('0xaf')],{'as':_0x6093('0x1cc'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1cd')});db['SalesforceConfiguration']['hasMany'](db[_0x6093('0x1ce')],{'as':_0x6093('0x1cf'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d0')});db['SalesforceConfiguration'][_0x6093('0x129')](db[_0x6093('0x1ce')],{'as':_0x6093('0x1d1'),'onDelete':_0x6093('0x128'),'foreignKey':'DescriptionId'});db[_0x6093('0xaf')][_0x6093('0x129')](db[_0x6093('0x1ce')],{'as':'Fields','onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xaf')][_0x6093('0x136')](db[_0x6093('0xad')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x1cd')});db['SalesforceField']['hasMany'](db[_0x6093('0x1ce')],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0x1ce')][_0x6093('0x129')](db[_0x6093('0x1ce')],{'as':_0x6093('0x1d4'),'foreignKey':'DescriptionId'});db[_0x6093('0x1ce')][_0x6093('0x129')](db[_0x6093('0x1ce')],{'as':'Field','foreignKey':'FieldId'});db[_0x6093('0x1ce')][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db['SugarcrmAccount'][_0x6093('0x129')](db[_0x6093('0xb3')],{'as':_0x6093('0x1cc'),'onDelete':'cascade','foreignKey':_0x6093('0x1cd')});db[_0x6093('0xb3')]['hasMany'](db['SugarcrmField'],{'as':'Subjects','onDelete':_0x6093('0x128'),'foreignKey':'SubjectId'});db[_0x6093('0xb3')]['hasMany'](db[_0x6093('0xb5')],{'as':_0x6093('0x1d1'),'onDelete':'cascade','foreignKey':'DescriptionId'});db['SugarcrmConfiguration'][_0x6093('0x129')](db[_0x6093('0xb5')],{'as':'Fields','onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d2')});db['SugarcrmConfiguration'][_0x6093('0x136')](db[_0x6093('0xb1')],{'as':'Account','foreignKey':_0x6093('0x1cd')});db[_0x6093('0xb5')][_0x6093('0x129')](db[_0x6093('0xb5')],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0xb5')][_0x6093('0x129')](db[_0x6093('0xb5')],{'as':_0x6093('0x1d4'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0xb5')]['hasMany'](db['SugarcrmField'],{'as':_0x6093('0x1d7'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xb5')][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db[_0x6093('0xb7')][_0x6093('0x129')](db[_0x6093('0xb9')],{'as':_0x6093('0x1cc'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1cd')});db['DeskConfiguration'][_0x6093('0x129')](db['DeskField'],{'as':_0x6093('0x1cf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x6093('0xb9')][_0x6093('0x129')](db[_0x6093('0xbb')],{'as':'Descriptions','onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0xb9')][_0x6093('0x129')](db[_0x6093('0xbb')],{'as':_0x6093('0x1c9'),'onDelete':'cascade','foreignKey':_0x6093('0x1d2')});db['DeskConfiguration'][_0x6093('0x136')](db[_0x6093('0xb7')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x1cd')});db['DeskConfiguration'][_0x6093('0x137')](db[_0x6093('0x95')],{'through':_0x6093('0x1d8')});db['DeskField']['hasMany'](db[_0x6093('0xbb')],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db['DeskField']['hasMany'](db['DeskField'],{'as':_0x6093('0x1d4'),'foreignKey':'DescriptionId'});db[_0x6093('0xbb')][_0x6093('0x129')](db[_0x6093('0xbb')],{'as':_0x6093('0x1d7'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xbb')][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db[_0x6093('0xbc')][_0x6093('0x129')](db['ZohoConfiguration'],{'as':_0x6093('0x1cc'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1cd')});db[_0x6093('0x1d9')][_0x6093('0x129')](db['ZohoField'],{'as':_0x6093('0x1cf'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d0')});db['ZohoConfiguration'][_0x6093('0x129')](db['ZohoField'],{'as':_0x6093('0x1d1'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0x1d9')][_0x6093('0x129')](db[_0x6093('0xbf')],{'as':_0x6093('0x1c9'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0x1d9')][_0x6093('0x136')](db['ZohoAccount'],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x1cd')});db[_0x6093('0xbf')]['hasMany'](db[_0x6093('0xbf')],{'as':'Subject','foreignKey':_0x6093('0x1d0')});db[_0x6093('0xbf')][_0x6093('0x129')](db[_0x6093('0xbf')],{'as':_0x6093('0x1d4'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0xbf')][_0x6093('0x129')](db[_0x6093('0xbf')],{'as':_0x6093('0x1d7'),'foreignKey':_0x6093('0x1d2')});db['ZohoField'][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db[_0x6093('0xc0')][_0x6093('0x129')](db[_0x6093('0xc2')],{'as':_0x6093('0x1cc'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1cd')});db['ZendeskConfiguration']['hasMany'](db[_0x6093('0xc4')],{'as':_0x6093('0x1cf'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0xc2')][_0x6093('0x129')](db[_0x6093('0xc4')],{'as':_0x6093('0x1d1'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0xc2')][_0x6093('0x129')](db[_0x6093('0xc4')],{'as':_0x6093('0x1c9'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xc2')][_0x6093('0x136')](db[_0x6093('0xc0')],{'as':'Account','foreignKey':_0x6093('0x1cd')});db[_0x6093('0xc2')]['belongsToMany'](db['Tag'],{'through':_0x6093('0x1da')});db[_0x6093('0xc4')][_0x6093('0x129')](db[_0x6093('0xc4')],{'as':_0x6093('0x1d3'),'foreignKey':'SubjectId'});db[_0x6093('0xc4')][_0x6093('0x129')](db[_0x6093('0xc4')],{'as':_0x6093('0x1d4'),'foreignKey':_0x6093('0x1d6')});db['ZendeskField'][_0x6093('0x129')](db['ZendeskField'],{'as':_0x6093('0x1d7'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xc4')][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db[_0x6093('0xc6')][_0x6093('0x129')](db[_0x6093('0xc8')],{'as':_0x6093('0x1cc'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1cd')});db[_0x6093('0xc8')][_0x6093('0x129')](db[_0x6093('0xca')],{'as':_0x6093('0x1cf'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0xc8')]['hasMany'](db[_0x6093('0xca')],{'as':_0x6093('0x1d1'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0x6093('0xc8')][_0x6093('0x129')](db[_0x6093('0xca')],{'as':_0x6093('0x1c9'),'onDelete':'cascade','foreignKey':_0x6093('0x1d2')});db['FreshdeskConfiguration'][_0x6093('0x136')](db[_0x6093('0xc6')],{'as':_0x6093('0x180'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x6093('0x137')](db[_0x6093('0x95')],{'through':_0x6093('0x1db')});db[_0x6093('0xca')][_0x6093('0x129')](db['FreshdeskField'],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0xca')][_0x6093('0x129')](db[_0x6093('0xca')],{'as':_0x6093('0x1d4'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0xca')][_0x6093('0x129')](db[_0x6093('0xca')],{'as':_0x6093('0x1d7'),'foreignKey':'FieldId'});db[_0x6093('0xca')]['belongsTo'](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':'VariableId'});db[_0x6093('0x1dc')][_0x6093('0x129')](db[_0x6093('0xcd')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6093('0x1cd')});db[_0x6093('0xcd')]['hasMany'](db[_0x6093('0xce')],{'as':_0x6093('0x1cf'),'foreignKey':'SubjectId'});db[_0x6093('0xcd')][_0x6093('0x129')](db['VtigerField'],{'as':_0x6093('0x1d1'),'foreignKey':_0x6093('0x1d6')});db['VtigerConfiguration'][_0x6093('0x129')](db[_0x6093('0xce')],{'as':_0x6093('0x1c9'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xcd')][_0x6093('0x136')](db['VtigerAccount'],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x1cd')});db['VtigerField'][_0x6093('0x129')](db[_0x6093('0xce')],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0xce')][_0x6093('0x129')](db[_0x6093('0xce')],{'as':_0x6093('0x1d4'),'foreignKey':_0x6093('0x1d6')});db['VtigerField'][_0x6093('0x129')](db[_0x6093('0xce')],{'as':_0x6093('0x1d7'),'foreignKey':'FieldId'});db['VtigerField']['belongsTo'](db[_0x6093('0xa0')],{'as':'Variable','foreignKey':_0x6093('0x1d5')});db[_0x6093('0x1dd')]['hasMany'](db['ServicenowConfiguration'],{'as':_0x6093('0x1cc'),'onDelete':_0x6093('0x128'),'foreignKey':'AccountId'});db[_0x6093('0xd1')]['hasMany'](db[_0x6093('0x1de')],{'as':_0x6093('0x1cf'),'foreignKey':_0x6093('0x1d0')});db['ServicenowConfiguration'][_0x6093('0x129')](db[_0x6093('0x1de')],{'as':_0x6093('0x1d1'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0xd1')][_0x6093('0x129')](db[_0x6093('0x1de')],{'as':'Fields','foreignKey':_0x6093('0x1d2')});db[_0x6093('0xd1')][_0x6093('0x136')](db[_0x6093('0x1dd')],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x1cd')});db[_0x6093('0x1de')][_0x6093('0x129')](db['ServicenowField'],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db['ServicenowField']['hasMany'](db[_0x6093('0x1de')],{'as':_0x6093('0x1d4'),'foreignKey':_0x6093('0x1d6')});db['ServicenowField'][_0x6093('0x129')](db[_0x6093('0x1de')],{'as':_0x6093('0x1d7'),'foreignKey':'FieldId'});db[_0x6093('0x1de')][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':'Variable','foreignKey':'VariableId'});db[_0x6093('0xd4')][_0x6093('0x129')](db[_0x6093('0x1df')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x6093('0x1cd')});db[_0x6093('0xd4')]['belongsTo'](db[_0x6093('0x11c')],{'as':_0x6093('0x11c'),'foreignKey':'CloudProviderId'});db[_0x6093('0x1df')][_0x6093('0x129')](db[_0x6093('0xd7')],{'as':_0x6093('0x1cf'),'onDelete':_0x6093('0x128'),'foreignKey':'SubjectId'});db[_0x6093('0x1df')][_0x6093('0x129')](db['Dynamics365Field'],{'as':_0x6093('0x1d1'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0x1df')]['hasMany'](db[_0x6093('0xd7')],{'as':_0x6093('0x1c9'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0x1df')][_0x6093('0x136')](db['Dynamics365Account'],{'as':'Account','foreignKey':'AccountId'});db[_0x6093('0xd7')]['hasMany'](db['Dynamics365Field'],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db[_0x6093('0xd7')][_0x6093('0x129')](db[_0x6093('0xd7')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x6093('0xd7')][_0x6093('0x129')](db[_0x6093('0xd7')],{'as':_0x6093('0x1d7'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xd7')]['belongsTo'](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db[_0x6093('0xd9')][_0x6093('0x129')](db[_0x6093('0x1e0')],{'as':'Configurations','onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1cd')});db[_0x6093('0x1e0')][_0x6093('0x129')](db[_0x6093('0xdb')],{'as':_0x6093('0x1cf'),'foreignKey':'SubjectId'});db[_0x6093('0x1e0')][_0x6093('0x129')](db['FreshsalesField'],{'as':_0x6093('0x1d1'),'foreignKey':_0x6093('0x1d6')});db[_0x6093('0x1e0')][_0x6093('0x129')](db[_0x6093('0xdb')],{'as':_0x6093('0x1c9'),'foreignKey':_0x6093('0x1d2')});db['FreshsalesConfiguration'][_0x6093('0x136')](db[_0x6093('0xd9')],{'as':_0x6093('0x180'),'foreignKey':'AccountId'});db[_0x6093('0xdb')][_0x6093('0x129')](db[_0x6093('0xdb')],{'as':_0x6093('0x1d3'),'foreignKey':_0x6093('0x1d0')});db['FreshsalesField'][_0x6093('0x129')](db['FreshsalesField'],{'as':'Description','foreignKey':_0x6093('0x1d6')});db['FreshsalesField']['hasMany'](db[_0x6093('0xdb')],{'as':_0x6093('0x1d7'),'foreignKey':_0x6093('0x1d2')});db[_0x6093('0xdb')][_0x6093('0x136')](db[_0x6093('0xa0')],{'as':_0x6093('0xa0'),'foreignKey':_0x6093('0x1d5')});db[_0x6093('0x1e1')][_0x6093('0x136')](db[_0x6093('0x63')],{});db['ChatQueueReport'][_0x6093('0x136')](db[_0x6093('0x105')],{'as':'List','foreignKey':_0x6093('0x189')});db['ChatQueueReport'][_0x6093('0x136')](db['CmContact'],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db['ChatQueueReport']['belongsTo'](db[_0x6093('0x69')],{});db[_0x6093('0x1e1')][_0x6093('0x136')](db[_0x6093('0x6b')],{});db['ChatQueueReport']['belongsTo'](db[_0x6093('0x14')],{});db['ChatQueueReport']['belongsTo'](db[_0x6093('0x6f')],{});db[_0x6093('0xe0')][_0x6093('0x136')](db[_0x6093('0x14')],{'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x1e2')});db['ChatInternalMessage'][_0x6093('0x136')](db['User'],{'onDelete':'cascade','foreignKey':_0x6093('0x1e3')});db[_0x6093('0xe3')][_0x6093('0x129')](db[_0x6093('0x1e4')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x6093('0xe3')][_0x6093('0x129')](db[_0x6093('0x1e5')],{'foreignKey':_0x6093('0x1e6'),'onDelete':'cascade'});db[_0x6093('0x1e7')][_0x6093('0x136')](db[_0x6093('0x53')],{});db['SmsQueueReport'][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':'ListId'});db[_0x6093('0x1e7')][_0x6093('0x136')](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x1e7')]['belongsTo'](db[_0x6093('0x56')],{});db['SmsQueueReport'][_0x6093('0x136')](db[_0x6093('0x58')],{});db[_0x6093('0x1e7')][_0x6093('0x136')](db['User'],{});db[_0x6093('0x1e7')][_0x6093('0x136')](db['SmsQueue'],{});db[_0x6093('0xea')]['hasMany'](db[_0x6093('0xe3')],{'foreignKey':_0x6093('0x1e8')});db[_0x6093('0xea')][_0x6093('0x129')](db[_0x6093('0x1e4')],{'foreignKey':'ProjectId'});db[_0x6093('0xea')]['hasMany'](db[_0x6093('0x1e5')],{'foreignKey':_0x6093('0x1e8')});db[_0x6093('0xf4')][_0x6093('0x137')](db['User'],{'as':_0x6093('0x17c'),'through':_0x6093('0x13e')});db[_0x6093('0xf4')][_0x6093('0x137')](db[_0x6093('0x1f')],{'through':'TeamVoiceQueue','as':_0x6093('0x145')});db[_0x6093('0xf4')][_0x6093('0x137')](db[_0x6093('0x146')],{'through':_0x6093('0x17e'),'as':_0x6093('0x147')});db[_0x6093('0xf4')][_0x6093('0x137')](db['ChatQueue'],{'through':_0x6093('0x1a5'),'as':'ChatQueues'});db['Team'][_0x6093('0x137')](db[_0x6093('0x4f')],{'through':_0x6093('0x193'),'as':_0x6093('0x14a')});db['Team'][_0x6093('0x137')](db[_0x6093('0x59')],{'through':_0x6093('0x196'),'as':_0x6093('0x14b')});db['Team'][_0x6093('0x137')](db[_0x6093('0x14c')],{'through':_0x6093('0x19c'),'as':'OpenchannelQueues'});db[_0x6093('0xf4')][_0x6093('0x137')](db[_0x6093('0x11a')],{'through':_0x6093('0x1e9'),'as':_0x6093('0x14d')});db[_0x6093('0xf4')][_0x6093('0x137')](db[_0x6093('0x107')],{'through':_0x6093('0x11f'),'as':_0x6093('0x1ea')});db[_0x6093('0x1ae')]['hasMany'](db[_0x6093('0x77')],{'as':_0x6093('0x135'),'foreignKey':_0x6093('0x1eb')});db[_0x6093('0x1ae')][_0x6093('0x129')](db['CmHopperFinal'],{'as':_0x6093('0x12b'),'foreignKey':_0x6093('0x1eb')});db['Campaign']['hasMany'](db[_0x6093('0x7c')],{'as':_0x6093('0x160'),'foreignKey':_0x6093('0x1eb')});db[_0x6093('0x1ae')][_0x6093('0x129')](db['CmHopperBlack'],{'as':_0x6093('0x161'),'foreignKey':'CampaignId'});db[_0x6093('0x1ae')][_0x6093('0x136')](db['Trunk'],{'as':_0x6093('0x2e'),'foreignKey':'TrunkId'});db[_0x6093('0x1ae')][_0x6093('0x136')](db[_0x6093('0x2e')],{'as':_0x6093('0x1ec'),'foreignKey':_0x6093('0x1ed')});db['Campaign'][_0x6093('0x136')](db['Interval'],{'as':_0x6093('0x8b'),'foreignKey':_0x6093('0x163')});db[_0x6093('0x1ae')][_0x6093('0x136')](db[_0x6093('0xf0')],{'as':_0x6093('0xf0'),'foreignKey':'SquareProjectId'});db['Campaign'][_0x6093('0x137')](db[_0x6093('0x105')],{'as':_0x6093('0x13c'),'through':_0x6093('0x1ee')});db[_0x6093('0x1ae')][_0x6093('0x137')](db[_0x6093('0x105')],{'as':_0x6093('0x169'),'through':_0x6093('0x1ef')});db[_0x6093('0xf9')]['belongsTo'](db[_0x6093('0x6d')],{'as':_0x6093('0x6d'),'foreignKey':_0x6093('0x187')});db[_0x6093('0xfd')][_0x6093('0x136')](db['MailMessage'],{});db['MailTransferReport'][_0x6093('0x136')](db[_0x6093('0x44')],{});db[_0x6093('0xfd')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x6093('0x1f0'),'as':_0x6093('0x1f1')});db['MailTransferReport'][_0x6093('0x136')](db['User'],{'foreignKey':_0x6093('0x1f2'),'as':'FromAgent'});db[_0x6093('0xfd')][_0x6093('0x136')](db['User'],{'foreignKey':_0x6093('0x1f3'),'as':_0x6093('0x1f4')});db[_0x6093('0xfd')][_0x6093('0x136')](db['MailQueue'],{'foreignKey':_0x6093('0x1f5'),'as':_0x6093('0x1f6')});db[_0x6093('0xfd')][_0x6093('0x136')](db[_0x6093('0x41')],{'foreignKey':'ToMailAccountId','as':_0x6093('0x1f7')});db[_0x6093('0xff')][_0x6093('0x136')](db[_0x6093('0x6b')],{});db[_0x6093('0xff')]['belongsTo'](db[_0x6093('0x69')],{});db[_0x6093('0xff')][_0x6093('0x136')](db[_0x6093('0x63')],{'foreignKey':_0x6093('0x1f8'),'as':_0x6093('0x1f1')});db[_0x6093('0xff')]['belongsTo'](db[_0x6093('0x14')],{'foreignKey':_0x6093('0x1f2'),'as':_0x6093('0x1f9')});db['ChatTransferReport'][_0x6093('0x136')](db[_0x6093('0x14')],{'foreignKey':_0x6093('0x1f3'),'as':'ToAgent'});db[_0x6093('0xff')][_0x6093('0x136')](db[_0x6093('0x6f')],{'foreignKey':'ToChatQueueId','as':_0x6093('0x1f6')});db['ChatTransferReport'][_0x6093('0x136')](db[_0x6093('0x63')],{'foreignKey':'ToChatWebsiteId','as':_0x6093('0x1f7')});db[_0x6093('0x100')]['belongsTo'](db[_0x6093('0x4d')],{});db[_0x6093('0x100')][_0x6093('0x136')](db[_0x6093('0x4c')],{});db[_0x6093('0x100')][_0x6093('0x136')](db['FaxAccount'],{'foreignKey':_0x6093('0x1fa'),'as':_0x6093('0x1f1')});db[_0x6093('0x100')]['belongsTo'](db[_0x6093('0x14')],{'foreignKey':'FromUserId','as':_0x6093('0x1f9')});db['FaxTransferReport'][_0x6093('0x136')](db[_0x6093('0x14')],{'foreignKey':_0x6093('0x1f3'),'as':_0x6093('0x1f4')});db[_0x6093('0x100')][_0x6093('0x136')](db['FaxQueue'],{'foreignKey':_0x6093('0x1fb'),'as':_0x6093('0x1f6')});db[_0x6093('0x100')]['belongsTo'](db[_0x6093('0x18b')],{'foreignKey':'ToFaxAccountId','as':_0x6093('0x1f7')});db[_0x6093('0x102')][_0x6093('0x136')](db[_0x6093('0x61')],{});db[_0x6093('0x102')][_0x6093('0x136')](db['OpenchannelInteraction'],{});db[_0x6093('0x102')]['belongsTo'](db[_0x6093('0x5b')],{'foreignKey':_0x6093('0x1fc'),'as':'FromAccount'});db[_0x6093('0x102')][_0x6093('0x136')](db['User'],{'foreignKey':_0x6093('0x1f2'),'as':_0x6093('0x1f9')});db[_0x6093('0x102')][_0x6093('0x136')](db[_0x6093('0x14')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0x6093('0x102')][_0x6093('0x136')](db[_0x6093('0x14c')],{'foreignKey':_0x6093('0x1fd'),'as':_0x6093('0x1f6')});db[_0x6093('0x102')]['belongsTo'](db[_0x6093('0x5b')],{'foreignKey':_0x6093('0x1fe'),'as':_0x6093('0x1f7')});db['SmsTransferReport']['belongsTo'](db[_0x6093('0x58')],{});db[_0x6093('0x104')][_0x6093('0x136')](db[_0x6093('0x56')],{});db['SmsTransferReport']['belongsTo'](db[_0x6093('0x53')],{'foreignKey':_0x6093('0x1ff'),'as':'FromAccount'});db['SmsTransferReport'][_0x6093('0x136')](db[_0x6093('0x14')],{'foreignKey':_0x6093('0x1f2'),'as':'FromAgent'});db['SmsTransferReport'][_0x6093('0x136')](db[_0x6093('0x14')],{'foreignKey':_0x6093('0x1f3'),'as':_0x6093('0x1f4')});db['SmsTransferReport'][_0x6093('0x136')](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x6093('0x1f6')});db['SmsTransferReport'][_0x6093('0x136')](db[_0x6093('0x53')],{'foreignKey':_0x6093('0x200'),'as':_0x6093('0x1f7')});db[_0x6093('0x105')][_0x6093('0x129')](db[_0x6093('0x88')],{'as':_0x6093('0x177'),'foreignKey':_0x6093('0x189'),'onDelete':_0x6093('0x128')});db['CmList'][_0x6093('0x129')](db['CmCustomField'],{'as':_0x6093('0x201'),'foreignKey':_0x6093('0x189')});db['CmList'][_0x6093('0x129')](db[_0x6093('0x139')],{'as':_0x6093('0x13a'),'onDelete':_0x6093('0x128'),'foreignKey':_0x6093('0x189')});db[_0x6093('0x105')][_0x6093('0x129')](db[_0x6093('0x7b')],{'as':_0x6093('0x12b'),'foreignKey':_0x6093('0x189')});db[_0x6093('0x105')][_0x6093('0x129')](db[_0x6093('0x7c')],{'as':'HopperHistory','foreignKey':'ListId'});db[_0x6093('0x105')][_0x6093('0x129')](db[_0x6093('0x7e')],{'as':_0x6093('0x7e'),'foreignKey':'ListId'});db[_0x6093('0x105')]['belongsToMany'](db[_0x6093('0x1f')],{'as':_0x6093('0x202'),'through':_0x6093('0x166')});db[_0x6093('0x105')][_0x6093('0x137')](db[_0x6093('0x14')],{'as':'Agents','through':_0x6093('0x13d')});db[_0x6093('0x107')][_0x6093('0x129')](db[_0x6093('0x1b')],{'as':_0x6093('0x1b8'),'onDelete':_0x6093('0x128')});db[_0x6093('0x107')]['belongsToMany'](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':'UserVoicePrefix'});db['VoicePrefix']['belongsToMany'](db[_0x6093('0xf4')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x6093('0x109')][_0x6093('0x129')](db['User'],{'as':'Users','foreignKey':'userProfileId'});db[_0x6093('0x109')][_0x6093('0x129')](db[_0x6093('0x10a')],{'as':_0x6093('0x203'),'foreignKey':_0x6093('0x204'),'onDelete':_0x6093('0x128')});db[_0x6093('0x10a')][_0x6093('0x129')](db[_0x6093('0x10c')],{'as':'Resources','foreignKey':'sectionId','onDelete':_0x6093('0x128')});db[_0x6093('0x110')][_0x6093('0x129')](db['Disposition'],{'as':'Dispositions','foreignKey':_0x6093('0x205'),'onDelete':_0x6093('0x128')});db[_0x6093('0x110')]['hasMany'](db[_0x6093('0x86')],{'as':'Answers','foreignKey':_0x6093('0x205')});db[_0x6093('0x110')][_0x6093('0x129')](db['WhatsappMessage'],{'as':_0x6093('0x16b'),'foreignKey':_0x6093('0x205')});db['WhatsappAccount'][_0x6093('0x129')](db['WhatsappInteraction'],{'as':_0x6093('0x198')});db[_0x6093('0x110')][_0x6093('0x129')](db['WhatsappApplication'],{'as':_0x6093('0x15b'),'foreignKey':'WhatsappAccountId','onDelete':_0x6093('0x128')});db[_0x6093('0x110')][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':'ListId'});db[_0x6093('0x110')][_0x6093('0x136')](db[_0x6093('0x164')],{'as':_0x6093('0x17b'),'foreignKey':_0x6093('0x165')});db['WhatsappAccount'][_0x6093('0x137')](db[_0x6093('0x14')],{'as':_0x6093('0x17c'),'through':_0x6093('0x158')});db['WhatsappApplication']['belongsTo'](db[_0x6093('0x14')],{'onDelete':_0x6093('0x173')});db[_0x6093('0x112')][_0x6093('0x136')](db['WhatsappQueue'],{'onDelete':_0x6093('0x173')});db[_0x6093('0x112')][_0x6093('0x136')](db[_0x6093('0x110')],{'onDelete':'restrict'});db[_0x6093('0x112')][_0x6093('0x136')](db[_0x6093('0x8b')],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x163')});db['WhatsappApplication'][_0x6093('0x136')](db[_0x6093('0x95')],{'onDelete':_0x6093('0x173'),'foreignKey':_0x6093('0x188')});db[_0x6093('0x114')][_0x6093('0x129')](db[_0x6093('0x116')],{'as':_0x6093('0x16b'),'onDelete':'cascade','foreignKey':_0x6093('0x206')});db['WhatsappInteraction']['belongsTo'](db['WhatsappAccount'],{'as':'Account','foreignKey':_0x6093('0x205')});db[_0x6093('0x114')][_0x6093('0x136')](db[_0x6093('0x139')],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x114')][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x181'),'foreignKey':_0x6093('0x126')});db[_0x6093('0x114')][_0x6093('0x137')](db['Tag'],{'through':_0x6093('0x1bf'),'as':_0x6093('0x183')});db[_0x6093('0x114')][_0x6093('0x137')](db[_0x6093('0x95')],{'through':_0x6093('0x1bf'),'as':_0x6093('0x190')});db[_0x6093('0x114')]['belongsToMany'](db['User'],{'as':'Users','through':_0x6093('0x144'),'foreignKey':_0x6093('0x206')});db[_0x6093('0x116')][_0x6093('0x136')](db['User'],{'as':'User'});db[_0x6093('0x116')][_0x6093('0x136')](db[_0x6093('0x139')],{'onDelete':_0x6093('0x128'),'as':'Contact'});db[_0x6093('0x116')][_0x6093('0x136')](db[_0x6093('0x114')],{'onDelete':_0x6093('0x128'),'as':_0x6093('0x185'),'foreignKey':_0x6093('0x206')});db['WhatsappMessage']['belongsTo'](db['WhatsappAccount'],{'as':_0x6093('0x180'),'foreignKey':_0x6093('0x205')});db[_0x6093('0x207')][_0x6093('0x136')](db[_0x6093('0x110')],{});db[_0x6093('0x207')][_0x6093('0x136')](db[_0x6093('0x105')],{'as':_0x6093('0x179'),'foreignKey':'ListId'});db[_0x6093('0x207')][_0x6093('0x136')](db['CmContact'],{'as':_0x6093('0x170'),'foreignKey':_0x6093('0x171')});db[_0x6093('0x207')]['belongsTo'](db[_0x6093('0x114')],{});db['WhatsappQueueReport'][_0x6093('0x136')](db['WhatsappQueue'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x6093('0x116')],{});db[_0x6093('0x207')]['belongsTo'](db[_0x6093('0x14')],{});db[_0x6093('0x208')][_0x6093('0x136')](db['WhatsappMessage'],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6093('0x114')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x6093('0x110')],{'foreignKey':_0x6093('0x209'),'as':_0x6093('0x1f1')});db['WhatsappTransferReport'][_0x6093('0x136')](db[_0x6093('0x110')],{'foreignKey':_0x6093('0x20a'),'as':_0x6093('0x1f7')});db['WhatsappTransferReport']['belongsTo'](db[_0x6093('0x11a')],{'foreignKey':_0x6093('0x20b'),'as':_0x6093('0x1f6')});db[_0x6093('0x208')][_0x6093('0x136')](db['User'],{'foreignKey':_0x6093('0x1f2'),'as':_0x6093('0x1f9')});db[_0x6093('0x208')][_0x6093('0x136')](db[_0x6093('0x14')],{'foreignKey':'ToUserId','as':_0x6093('0x1f4')});db[_0x6093('0x11a')][_0x6093('0x137')](db['User'],{'as':_0x6093('0x17c'),'through':_0x6093('0x3b'),'foreignKey':_0x6093('0x20c')});db[_0x6093('0x11a')][_0x6093('0x137')](db['Team'],{'through':_0x6093('0x1e9'),'as':'Teams'});db[_0x6093('0x121')][_0x6093('0x136')](db[_0x6093('0x14')],{'as':_0x6093('0x20d'),'foreignKey':'UserId','onDelete':_0x6093('0x128'),'hooks':!![]});db[_0x6093('0x11c')][_0x6093('0x125')](db[_0x6093('0xd4')],{'as':_0x6093('0xd4'),'onDelete':'restrict'});db['CloudProvider'][_0x6093('0x125')](db['MailServerIn'],{'as':_0x6093('0x175'),'onDelete':_0x6093('0x173')});db[_0x6093('0x11c')][_0x6093('0x125')](db[_0x6093('0x3f')],{'as':_0x6093('0x176'),'onDelete':_0x6093('0x173')});module[_0x6093('0x20e')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index affcda0..4b6e826 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1298=['/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','./api/jscriptySessionReport','/api/sms/reports/queue','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/mailInteractionHasTag','/api/auth/local','/api/auth/google','/api/auth/activedirectory','/api/jira','./api/jira','./api/rpc','/api/version','/api/system','./api/system','/api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.10.1','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','sendFile','resolve','get','express','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','./api/user','./api/voiceChanSpy','use','/api/voice/contexts','./api/voiceContext','./api/voiceMusicOnHold','./api/voiceQueue','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/applications','/api/fax/interactions','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','/api/openchannel/interactions','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/actions','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType'];(function(_0x2a1a31,_0x1b8b1a){var _0xe175e8=function(_0xa6f2c2){while(--_0xa6f2c2){_0x2a1a31['push'](_0x2a1a31['shift']());}};_0xe175e8(++_0x1b8b1a);}(_0x1298,0x19e));var _0x8129=function(_0x5d284c,_0x9654c8){_0x5d284c=_0x5d284c-0x0;var _0x2c6d31=_0x1298[_0x5d284c];return _0x2c6d31;};'use strict';var path=require('path');var express=require(_0x8129('0x0'));var errors=require('./errors');var config=require(_0x8129('0x1'));var setupLoggers=require(_0x8129('0x2'))[_0x8129('0x3')];var clientSideLogs=require(_0x8129('0x4'));exports[_0x8129('0x5')]=function(_0x31d02a){return setupLoggers(_0x31d02a)[_0x8129('0x6')](function(){_0x31d02a['use'](_0x8129('0x7'),require(_0x8129('0x8')));_0x31d02a['use']('/api/voice/chanspy',require(_0x8129('0x9')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb'),require(_0x8129('0xc')));_0x31d02a[_0x8129('0xa')]('/api/voice/extensions',require('./api/voiceExtension'));_0x31d02a['use']('/api/voice/mohs',require(_0x8129('0xd')));_0x31d02a[_0x8129('0xa')]('/api/voice/queues',require(_0x8129('0xe')));_0x31d02a['use']('/api/voice/recordings',require(_0x8129('0xf')));_0x31d02a['use']('/api/screen/recordings',require(_0x8129('0x10')));_0x31d02a[_0x8129('0xa')](_0x8129('0x11'),require(_0x8129('0x12')));_0x31d02a[_0x8129('0xa')](_0x8129('0x13'),require('./api/voiceMailMessage'));_0x31d02a['use'](_0x8129('0x14'),require('./api/voiceCallReport'));_0x31d02a[_0x8129('0xa')]('/api/voice/dials/reports',require(_0x8129('0x15')));_0x31d02a[_0x8129('0xa')]('/api/voice/agents/reports',require(_0x8129('0x16')));_0x31d02a['use'](_0x8129('0x17'),require(_0x8129('0x18')));_0x31d02a[_0x8129('0xa')]('/api/members/reports',require(_0x8129('0x19')));_0x31d02a[_0x8129('0xa')](_0x8129('0x1a'),require(_0x8129('0x1b')));_0x31d02a[_0x8129('0xa')](_0x8129('0x1c'),require('./api/voiceTransferReport'));_0x31d02a['use'](_0x8129('0x1d'),require('./api/mailServerOut'));_0x31d02a[_0x8129('0xa')](_0x8129('0x1e'),require(_0x8129('0x1f')));_0x31d02a[_0x8129('0xa')](_0x8129('0x20'),require(_0x8129('0x21')));_0x31d02a[_0x8129('0xa')](_0x8129('0x22'),require(_0x8129('0x23')));_0x31d02a[_0x8129('0xa')]('/api/mail/interactions',require(_0x8129('0x24')));_0x31d02a[_0x8129('0xa')](_0x8129('0x25'),require(_0x8129('0x26')));_0x31d02a['use'](_0x8129('0x27'),require(_0x8129('0x28')));_0x31d02a['use'](_0x8129('0x29'),require('./api/mailQueueReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0x2a'),require(_0x8129('0x2b')));_0x31d02a['use'](_0x8129('0x2c'),require(_0x8129('0x2d')));_0x31d02a[_0x8129('0xa')]('/api/fax/accounts',require('./api/faxAccount'));_0x31d02a[_0x8129('0xa')](_0x8129('0x2e'),require('./api/faxApplication'));_0x31d02a[_0x8129('0xa')](_0x8129('0x2f'),require('./api/faxInteraction'));_0x31d02a[_0x8129('0xa')](_0x8129('0x30'),require('./api/faxMessage'));_0x31d02a[_0x8129('0xa')](_0x8129('0x31'),require(_0x8129('0x32')));_0x31d02a[_0x8129('0xa')](_0x8129('0x33'),require(_0x8129('0x34')));_0x31d02a[_0x8129('0xa')](_0x8129('0x35'),require(_0x8129('0x36')));_0x31d02a[_0x8129('0xa')](_0x8129('0x37'),require('./api/smsApplication'));_0x31d02a['use'](_0x8129('0x38'),require(_0x8129('0x39')));_0x31d02a[_0x8129('0xa')](_0x8129('0x3a'),require('./api/smsMessage'));_0x31d02a[_0x8129('0xa')](_0x8129('0x3b'),require(_0x8129('0x3c')));_0x31d02a[_0x8129('0xa')](_0x8129('0x3d'),require('./api/openchannelAccount'));_0x31d02a['use'](_0x8129('0x3e'),require(_0x8129('0x3f')));_0x31d02a[_0x8129('0xa')](_0x8129('0x40'),require('./api/openchannelInteraction'));_0x31d02a['use'](_0x8129('0x41'),require('./api/openchannelMessage'));_0x31d02a[_0x8129('0xa')](_0x8129('0x42'),require(_0x8129('0x43')));_0x31d02a[_0x8129('0xa')](_0x8129('0x44'),require(_0x8129('0x45')));_0x31d02a[_0x8129('0xa')](_0x8129('0x46'),require('./api/openchannelQueueReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0x47'),require('./api/chatApplication'));_0x31d02a['use']('/api/chat/interactions',require(_0x8129('0x48')));_0x31d02a[_0x8129('0xa')](_0x8129('0x49'),require('./api/chatMessage'));_0x31d02a[_0x8129('0xa')]('/api/chat/offline_messages',require(_0x8129('0x4a')));_0x31d02a[_0x8129('0xa')](_0x8129('0x4b'),require(_0x8129('0x4c')));_0x31d02a[_0x8129('0xa')]('/api/chat/groups',require(_0x8129('0x4d')));_0x31d02a[_0x8129('0xa')](_0x8129('0x4e'),require(_0x8129('0x4f')));_0x31d02a[_0x8129('0xa')](_0x8129('0x50'),require(_0x8129('0x51')));_0x31d02a[_0x8129('0xa')](_0x8129('0x52'),require(_0x8129('0x53')));_0x31d02a[_0x8129('0xa')](_0x8129('0x54'),require(_0x8129('0x55')));_0x31d02a[_0x8129('0xa')]('/api/cm/hopper_black',require(_0x8129('0x56')));_0x31d02a[_0x8129('0xa')](_0x8129('0x57'),require(_0x8129('0x58')));_0x31d02a['use']('/api/cm/hopper_history',require(_0x8129('0x59')));_0x31d02a[_0x8129('0xa')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x31d02a[_0x8129('0xa')](_0x8129('0x5a'),require(_0x8129('0x5b')));_0x31d02a['use']('/api/automations',require(_0x8129('0x5c')));_0x31d02a['use']('/api/canned_answers',require(_0x8129('0x5d')));_0x31d02a[_0x8129('0xa')](_0x8129('0x5e'),require(_0x8129('0x5f')));_0x31d02a['use']('/api/conditions',require(_0x8129('0x60')));_0x31d02a[_0x8129('0xa')]('/api/intervals',require('./api/interval'));_0x31d02a[_0x8129('0xa')]('/api/pauses',require('./api/pause'));_0x31d02a['use']('/api/cdr',require(_0x8129('0x61')));_0x31d02a[_0x8129('0xa')](_0x8129('0x62'),require(_0x8129('0x63')));_0x31d02a[_0x8129('0xa')](_0x8129('0x64'),require(_0x8129('0x65')));_0x31d02a[_0x8129('0xa')](_0x8129('0x66'),require(_0x8129('0x67')));_0x31d02a['use'](_0x8129('0x68'),require(_0x8129('0x69')));_0x31d02a[_0x8129('0xa')](_0x8129('0x6a'),require(_0x8129('0x6b')));_0x31d02a[_0x8129('0xa')]('/api/cm_contact_has_items',require('./api/cmContactHasItem'));_0x31d02a[_0x8129('0xa')](_0x8129('0x6c'),require(_0x8129('0x6d')));_0x31d02a[_0x8129('0xa')]('/api/templates',require(_0x8129('0x6e')));_0x31d02a[_0x8129('0xa')](_0x8129('0x6f'),require('./api/trigger'));_0x31d02a[_0x8129('0xa')](_0x8129('0x70'),require(_0x8129('0x71')));_0x31d02a[_0x8129('0xa')](_0x8129('0x72'),require('./api/integration'));_0x31d02a['use'](_0x8129('0x73'),require(_0x8129('0x74')));_0x31d02a[_0x8129('0xa')](_0x8129('0x75'),require('./api/analyticCustomReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0x76'),require(_0x8129('0x77')));_0x31d02a[_0x8129('0xa')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x31d02a[_0x8129('0xa')]('/api/analytics/metrics',require(_0x8129('0x78')));_0x31d02a[_0x8129('0xa')]('/api/analytics/field_reports',require(_0x8129('0x79')));_0x31d02a['use'](_0x8129('0x7a'),require(_0x8129('0x7b')));_0x31d02a[_0x8129('0xa')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x31d02a[_0x8129('0xa')](_0x8129('0x7c'),require(_0x8129('0x7d')));_0x31d02a['use'](_0x8129('0x7e'),require(_0x8129('0x7f')));_0x31d02a[_0x8129('0xa')]('/api/integrations/sugarcrm/accounts',require(_0x8129('0x80')));_0x31d02a[_0x8129('0xa')](_0x8129('0x81'),require(_0x8129('0x82')));_0x31d02a[_0x8129('0xa')](_0x8129('0x83'),require(_0x8129('0x84')));_0x31d02a[_0x8129('0xa')]('/api/integrations/desk/accounts',require(_0x8129('0x85')));_0x31d02a[_0x8129('0xa')](_0x8129('0x86'),require(_0x8129('0x87')));_0x31d02a[_0x8129('0xa')](_0x8129('0x88'),require(_0x8129('0x89')));_0x31d02a[_0x8129('0xa')](_0x8129('0x8a'),require('./api/intZohoAccount'));_0x31d02a['use'](_0x8129('0x8b'),require(_0x8129('0x8c')));_0x31d02a[_0x8129('0xa')](_0x8129('0x8d'),require(_0x8129('0x8e')));_0x31d02a['use']('/api/integrations/zendesk/accounts',require(_0x8129('0x8f')));_0x31d02a[_0x8129('0xa')]('/api/integrations/zendesk/configurations',require('./api/intZendeskConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0x90'),require(_0x8129('0x91')));_0x31d02a[_0x8129('0xa')](_0x8129('0x92'),require(_0x8129('0x93')));_0x31d02a[_0x8129('0xa')](_0x8129('0x94'),require('./api/intFreshdeskConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0x95'),require(_0x8129('0x96')));_0x31d02a[_0x8129('0xa')](_0x8129('0x97'),require(_0x8129('0x98')));_0x31d02a[_0x8129('0xa')](_0x8129('0x99'),require('./api/intVtigerConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0x9a'),require(_0x8129('0x9b')));_0x31d02a['use'](_0x8129('0x9c'),require(_0x8129('0x9d')));_0x31d02a[_0x8129('0xa')](_0x8129('0x9e'),require(_0x8129('0x9f')));_0x31d02a[_0x8129('0xa')](_0x8129('0xa0'),require(_0x8129('0xa1')));_0x31d02a[_0x8129('0xa')](_0x8129('0xa2'),require(_0x8129('0xa3')));_0x31d02a[_0x8129('0xa')]('/api/integrations/dynamics365/configurations',require(_0x8129('0xa4')));_0x31d02a[_0x8129('0xa')](_0x8129('0xa5'),require(_0x8129('0xa6')));_0x31d02a['use'](_0x8129('0xa7'),require(_0x8129('0xa8')));_0x31d02a['use'](_0x8129('0xa9'),require('./api/intFreshsalesConfiguration'));_0x31d02a[_0x8129('0xa')](_0x8129('0xaa'),require(_0x8129('0xab')));_0x31d02a['use'](_0x8129('0xac'),require('./api/network'));_0x31d02a[_0x8129('0xa')](_0x8129('0xad'),require(_0x8129('0xae')));_0x31d02a[_0x8129('0xa')](_0x8129('0xaf'),require(_0x8129('0xb0')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb1'),require('./api/jscriptyAnswerReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0xb2'),require(_0x8129('0xb3')));_0x31d02a[_0x8129('0xa')]('/api/jscripty/sessions/reports',require(_0x8129('0xb4')));_0x31d02a['use'](_0x8129('0xb5'),require('./api/smsQueueReport'));_0x31d02a[_0x8129('0xa')]('/api/square/reports',require(_0x8129('0xb6')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb7'),require(_0x8129('0xb8')));_0x31d02a[_0x8129('0xa')](_0x8129('0xb9'),require('./api/jscriptyProject'));_0x31d02a[_0x8129('0xa')](_0x8129('0xba'),require(_0x8129('0xbb')));_0x31d02a[_0x8129('0xa')](_0x8129('0xbc'),require('./api/squareOdbc'));_0x31d02a[_0x8129('0xa')](_0x8129('0xbd'),require(_0x8129('0xbe')));_0x31d02a[_0x8129('0xa')](_0x8129('0xbf'),require(_0x8129('0xc0')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc1'),require(_0x8129('0xc2')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc3'),require(_0x8129('0xc4')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc5'),require(_0x8129('0xc6')));_0x31d02a[_0x8129('0xa')](_0x8129('0xc7'),require(_0x8129('0xc8')));_0x31d02a['use'](_0x8129('0xc9'),require(_0x8129('0xca')));_0x31d02a['use'](_0x8129('0xcb'),require(_0x8129('0xcc')));_0x31d02a[_0x8129('0xa')]('/api/plugins',require('./api/plugin'));_0x31d02a[_0x8129('0xa')](_0x8129('0xcd'),require('./api/mailTransferReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0xce'),require(_0x8129('0xcf')));_0x31d02a[_0x8129('0xa')](_0x8129('0xd0'),require(_0x8129('0xd1')));_0x31d02a[_0x8129('0xa')](_0x8129('0xd2'),require(_0x8129('0xd3')));_0x31d02a['use'](_0x8129('0xd4'),require('./api/smsTransferReport'));_0x31d02a[_0x8129('0xa')]('/api/cm/lists',require(_0x8129('0xd5')));_0x31d02a['use'](_0x8129('0xd6'),require(_0x8129('0xd7')));_0x31d02a[_0x8129('0xa')](_0x8129('0xd8'),require(_0x8129('0xd9')));_0x31d02a['use'](_0x8129('0xda'),require('./api/userProfileSection'));_0x31d02a[_0x8129('0xa')](_0x8129('0xdb'),require(_0x8129('0xdc')));_0x31d02a[_0x8129('0xa')](_0x8129('0xdd'),require('./api/userNotification'));_0x31d02a['use'](_0x8129('0xde'),require('./api/whatsappAccount'));_0x31d02a[_0x8129('0xa')]('/api/whatsapp/applications',require(_0x8129('0xdf')));_0x31d02a[_0x8129('0xa')]('/api/whatsapp/interactions',require(_0x8129('0xe0')));_0x31d02a[_0x8129('0xa')](_0x8129('0xe1'),require(_0x8129('0xe2')));_0x31d02a[_0x8129('0xa')](_0x8129('0xe3'),require(_0x8129('0xe4')));_0x31d02a[_0x8129('0xa')]('/api/whatsapp/reports/transfer',require('./api/whatsappTransferReport'));_0x31d02a[_0x8129('0xa')](_0x8129('0xe5'),require('./api/whatsappQueue'));_0x31d02a['use'](_0x8129('0xe6'),require(_0x8129('0xe7')));_0x31d02a[_0x8129('0xa')](_0x8129('0xe8'),require('./api/realtime'));_0x31d02a[_0x8129('0xa')]('/api/user-settings',require('./api/user-setting'));_0x31d02a[_0x8129('0xa')]('/api/mail_interaction_has_tags',require(_0x8129('0xe9')));_0x31d02a[_0x8129('0xa')](_0x8129('0xea'),require('./api/authLocal'));_0x31d02a[_0x8129('0xa')](_0x8129('0xeb'),require('./api/authGoogle'));_0x31d02a['use'](_0x8129('0xec'),require('./api/authActiveDirectory'));_0x31d02a[_0x8129('0xa')](_0x8129('0xed'),require(_0x8129('0xee')));_0x31d02a[_0x8129('0xa')]('/api/rpc',require(_0x8129('0xef')));_0x31d02a['use'](_0x8129('0xf0'),require('./api/version'));_0x31d02a[_0x8129('0xa')](_0x8129('0xf1'),require(_0x8129('0xf2')));_0x31d02a['use'](_0x8129('0xf3'),require('./api/pm2'));_0x31d02a['use']('/api/webbar',require(_0x8129('0xf4')));_0x31d02a['use'](_0x8129('0xf5'),clientSideLogs);_0x31d02a[_0x8129('0xa')](_0x8129('0xf6'),express[_0x8129('0xf7')](path[_0x8129('0xf8')](config[_0x8129('0xf9')],_0x8129('0xf6'))));_0x31d02a[_0x8129('0xa')](_0x8129('0xfa'),express[_0x8129('0xf7')](path[_0x8129('0xf8')](config[_0x8129('0xf9')],'/www')));_0x31d02a[_0x8129('0xa')](_0x8129('0xfb'),express[_0x8129('0xf7')](path[_0x8129('0xf8')](config['root'],'/demo')));_0x31d02a[_0x8129('0xa')]('/snippet',express[_0x8129('0xf7')](path[_0x8129('0xf8')](config['root'],_0x8129('0xfc'),_0x8129('0xfd'))));_0x31d02a[_0x8129('0xa')](_0x8129('0xfe'),express['static'](path[_0x8129('0xf8')](config['root'],_0x8129('0xff'))));_0x31d02a[_0x8129('0x100')](_0x8129('0x101'))['get'](errors[0x194]);_0x31d02a[_0x8129('0x100')]('/*')['get'](function(_0x6aebf0,_0x566d7d){_0x566d7d[_0x8129('0x102')](path[_0x8129('0x103')](_0x31d02a[_0x8129('0x104')]('appPath')+'/index.html'));});return _0x31d02a;});}; \ No newline at end of file +var _0x47a1=['/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','/api/cm/custom_fields','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','/api/triggers','/api/variables','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/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/integrations/zendesk/fields','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/sms/reports/transfer','/api/cm/lists','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','/api/userNotifications','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/version','./api/system','/api/pm2','./api/pm2','/api/logs','static','join','/apidoc','/www','/demo','/snippet','snippet','3.10.1','/plugins','root','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','./config/environment','setupLoggers','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','/api/voice/mohs','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsMessage','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x47a1,0xbd));var _0x147a=function(_0x434b0c,_0x281b39){_0x434b0c=_0x434b0c-0x0;var _0x4a5e40=_0x47a1[_0x434b0c];return _0x4a5e40;};'use strict';var path=require(_0x147a('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x147a('0x1'));var setupLoggers=require('./utils/client-side-logger')[_0x147a('0x2')];var clientSideLogs=require(_0x147a('0x3'));exports['default']=function(_0xd80e93){return setupLoggers(_0xd80e93)[_0x147a('0x4')](function(){_0xd80e93[_0x147a('0x5')](_0x147a('0x6'),require(_0x147a('0x7')));_0xd80e93['use'](_0x147a('0x8'),require(_0x147a('0x9')));_0xd80e93[_0x147a('0x5')](_0x147a('0xa'),require(_0x147a('0xb')));_0xd80e93[_0x147a('0x5')](_0x147a('0xc'),require('./api/voiceExtension'));_0xd80e93[_0x147a('0x5')](_0x147a('0xd'),require('./api/voiceMusicOnHold'));_0xd80e93[_0x147a('0x5')]('/api/voice/queues',require(_0x147a('0xe')));_0xd80e93[_0x147a('0x5')](_0x147a('0xf'),require('./api/voiceRecording'));_0xd80e93[_0x147a('0x5')](_0x147a('0x10'),require(_0x147a('0x11')));_0xd80e93['use'](_0x147a('0x12'),require(_0x147a('0x13')));_0xd80e93[_0x147a('0x5')](_0x147a('0x14'),require(_0x147a('0x15')));_0xd80e93[_0x147a('0x5')](_0x147a('0x16'),require(_0x147a('0x17')));_0xd80e93[_0x147a('0x5')]('/api/voice/dials/reports',require(_0x147a('0x18')));_0xd80e93['use'](_0x147a('0x19'),require(_0x147a('0x1a')));_0xd80e93[_0x147a('0x5')](_0x147a('0x1b'),require(_0x147a('0x1c')));_0xd80e93[_0x147a('0x5')]('/api/members/reports',require('./api/memberReport'));_0xd80e93['use'](_0x147a('0x1d'),require(_0x147a('0x1e')));_0xd80e93['use'](_0x147a('0x1f'),require('./api/voiceTransferReport'));_0xd80e93[_0x147a('0x5')](_0x147a('0x20'),require(_0x147a('0x21')));_0xd80e93[_0x147a('0x5')](_0x147a('0x22'),require(_0x147a('0x23')));_0xd80e93[_0x147a('0x5')](_0x147a('0x24'),require(_0x147a('0x25')));_0xd80e93[_0x147a('0x5')](_0x147a('0x26'),require('./api/mailSubstatus'));_0xd80e93[_0x147a('0x5')](_0x147a('0x27'),require(_0x147a('0x28')));_0xd80e93[_0x147a('0x5')](_0x147a('0x29'),require(_0x147a('0x2a')));_0xd80e93[_0x147a('0x5')]('/api/mail/applications',require('./api/mailApplication'));_0xd80e93['use'](_0x147a('0x2b'),require('./api/mailQueueReport'));_0xd80e93[_0x147a('0x5')]('/api/dashboards',require(_0x147a('0x2c')));_0xd80e93[_0x147a('0x5')](_0x147a('0x2d'),require('./api/dashboardItem'));_0xd80e93['use'](_0x147a('0x2e'),require(_0x147a('0x2f')));_0xd80e93[_0x147a('0x5')](_0x147a('0x30'),require(_0x147a('0x31')));_0xd80e93[_0x147a('0x5')](_0x147a('0x32'),require(_0x147a('0x33')));_0xd80e93['use'](_0x147a('0x34'),require(_0x147a('0x35')));_0xd80e93[_0x147a('0x5')](_0x147a('0x36'),require('./api/faxQueue'));_0xd80e93['use']('/api/fax/reports/queue',require(_0x147a('0x37')));_0xd80e93[_0x147a('0x5')]('/api/sms/accounts',require(_0x147a('0x38')));_0xd80e93[_0x147a('0x5')](_0x147a('0x39'),require(_0x147a('0x3a')));_0xd80e93[_0x147a('0x5')](_0x147a('0x3b'),require('./api/smsInteraction'));_0xd80e93['use']('/api/sms/messages',require(_0x147a('0x3c')));_0xd80e93[_0x147a('0x5')]('/api/sms/queues',require(_0x147a('0x3d')));_0xd80e93[_0x147a('0x5')]('/api/openchannel/accounts',require(_0x147a('0x3e')));_0xd80e93[_0x147a('0x5')](_0x147a('0x3f'),require('./api/openchannelApplication'));_0xd80e93['use'](_0x147a('0x40'),require('./api/openchannelInteraction'));_0xd80e93[_0x147a('0x5')](_0x147a('0x41'),require(_0x147a('0x42')));_0xd80e93[_0x147a('0x5')](_0x147a('0x43'),require(_0x147a('0x44')));_0xd80e93[_0x147a('0x5')](_0x147a('0x45'),require(_0x147a('0x46')));_0xd80e93[_0x147a('0x5')](_0x147a('0x47'),require(_0x147a('0x48')));_0xd80e93[_0x147a('0x5')](_0x147a('0x49'),require('./api/chatApplication'));_0xd80e93['use'](_0x147a('0x4a'),require(_0x147a('0x4b')));_0xd80e93[_0x147a('0x5')](_0x147a('0x4c'),require(_0x147a('0x4d')));_0xd80e93[_0x147a('0x5')](_0x147a('0x4e'),require(_0x147a('0x4f')));_0xd80e93[_0x147a('0x5')](_0x147a('0x50'),require(_0x147a('0x51')));_0xd80e93['use'](_0x147a('0x52'),require(_0x147a('0x53')));_0xd80e93['use'](_0x147a('0x54'),require(_0x147a('0x55')));_0xd80e93[_0x147a('0x5')](_0x147a('0x56'),require(_0x147a('0x57')));_0xd80e93[_0x147a('0x5')](_0x147a('0x58'),require(_0x147a('0x59')));_0xd80e93[_0x147a('0x5')](_0x147a('0x5a'),require('./api/cmHopper'));_0xd80e93[_0x147a('0x5')](_0x147a('0x5b'),require(_0x147a('0x5c')));_0xd80e93[_0x147a('0x5')](_0x147a('0x5d'),require('./api/cmHopperFinal'));_0xd80e93[_0x147a('0x5')](_0x147a('0x5e'),require('./api/cmHopperHistory'));_0xd80e93[_0x147a('0x5')](_0x147a('0x5f'),require('./api/cmCustomField'));_0xd80e93[_0x147a('0x5')](_0x147a('0x60'),require(_0x147a('0x61')));_0xd80e93[_0x147a('0x5')](_0x147a('0x62'),require(_0x147a('0x63')));_0xd80e93[_0x147a('0x5')](_0x147a('0x64'),require(_0x147a('0x65')));_0xd80e93[_0x147a('0x5')](_0x147a('0x66'),require(_0x147a('0x67')));_0xd80e93['use']('/api/conditions',require(_0x147a('0x68')));_0xd80e93[_0x147a('0x5')]('/api/intervals',require(_0x147a('0x69')));_0xd80e93[_0x147a('0x5')](_0x147a('0x6a'),require(_0x147a('0x6b')));_0xd80e93[_0x147a('0x5')](_0x147a('0x6c'),require(_0x147a('0x6d')));_0xd80e93[_0x147a('0x5')](_0x147a('0x6e'),require(_0x147a('0x6f')));_0xd80e93[_0x147a('0x5')](_0x147a('0x70'),require(_0x147a('0x71')));_0xd80e93[_0x147a('0x5')](_0x147a('0x72'),require(_0x147a('0x73')));_0xd80e93[_0x147a('0x5')](_0x147a('0x74'),require('./api/tag'));_0xd80e93[_0x147a('0x5')](_0x147a('0x75'),require(_0x147a('0x76')));_0xd80e93['use'](_0x147a('0x77'),require(_0x147a('0x78')));_0xd80e93['use'](_0x147a('0x79'),require(_0x147a('0x7a')));_0xd80e93['use'](_0x147a('0x7b'),require('./api/template'));_0xd80e93[_0x147a('0x5')](_0x147a('0x7c'),require('./api/trigger'));_0xd80e93[_0x147a('0x5')](_0x147a('0x7d'),require('./api/variable'));_0xd80e93[_0x147a('0x5')]('/api/integrations',require(_0x147a('0x7e')));_0xd80e93[_0x147a('0x5')](_0x147a('0x7f'),require(_0x147a('0x80')));_0xd80e93[_0x147a('0x5')]('/api/analytics/custom_reports',require(_0x147a('0x81')));_0xd80e93[_0x147a('0x5')](_0x147a('0x82'),require(_0x147a('0x83')));_0xd80e93[_0x147a('0x5')](_0x147a('0x84'),require('./api/analyticExtractedReport'));_0xd80e93[_0x147a('0x5')](_0x147a('0x85'),require(_0x147a('0x86')));_0xd80e93[_0x147a('0x5')]('/api/analytics/field_reports',require(_0x147a('0x87')));_0xd80e93[_0x147a('0x5')](_0x147a('0x88'),require(_0x147a('0x89')));_0xd80e93['use'](_0x147a('0x8a'),require(_0x147a('0x8b')));_0xd80e93[_0x147a('0x5')](_0x147a('0x8c'),require(_0x147a('0x8d')));_0xd80e93[_0x147a('0x5')]('/api/integrations/salesforce/fields',require('./api/intSalesforceField'));_0xd80e93[_0x147a('0x5')](_0x147a('0x8e'),require(_0x147a('0x8f')));_0xd80e93['use'](_0x147a('0x90'),require(_0x147a('0x91')));_0xd80e93[_0x147a('0x5')](_0x147a('0x92'),require('./api/intSugarcrmField'));_0xd80e93[_0x147a('0x5')](_0x147a('0x93'),require(_0x147a('0x94')));_0xd80e93[_0x147a('0x5')](_0x147a('0x95'),require(_0x147a('0x96')));_0xd80e93[_0x147a('0x5')]('/api/integrations/desk/fields',require(_0x147a('0x97')));_0xd80e93[_0x147a('0x5')](_0x147a('0x98'),require(_0x147a('0x99')));_0xd80e93[_0x147a('0x5')](_0x147a('0x9a'),require(_0x147a('0x9b')));_0xd80e93[_0x147a('0x5')](_0x147a('0x9c'),require(_0x147a('0x9d')));_0xd80e93[_0x147a('0x5')]('/api/integrations/zendesk/accounts',require(_0x147a('0x9e')));_0xd80e93[_0x147a('0x5')](_0x147a('0x9f'),require(_0x147a('0xa0')));_0xd80e93[_0x147a('0x5')](_0x147a('0xa1'),require('./api/intZendeskField'));_0xd80e93[_0x147a('0x5')]('/api/integrations/freshdesk/accounts',require(_0x147a('0xa2')));_0xd80e93[_0x147a('0x5')](_0x147a('0xa3'),require('./api/intFreshdeskConfiguration'));_0xd80e93[_0x147a('0x5')](_0x147a('0xa4'),require(_0x147a('0xa5')));_0xd80e93[_0x147a('0x5')](_0x147a('0xa6'),require('./api/intVtigerAccount'));_0xd80e93[_0x147a('0x5')](_0x147a('0xa7'),require(_0x147a('0xa8')));_0xd80e93[_0x147a('0x5')](_0x147a('0xa9'),require(_0x147a('0xaa')));_0xd80e93[_0x147a('0x5')](_0x147a('0xab'),require('./api/intServicenowAccount'));_0xd80e93[_0x147a('0x5')](_0x147a('0xac'),require(_0x147a('0xad')));_0xd80e93['use']('/api/integrations/servicenow/fields',require('./api/intServicenowField'));_0xd80e93[_0x147a('0x5')](_0x147a('0xae'),require(_0x147a('0xaf')));_0xd80e93[_0x147a('0x5')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xd80e93[_0x147a('0x5')](_0x147a('0xb0'),require(_0x147a('0xb1')));_0xd80e93['use'](_0x147a('0xb2'),require('./api/intFreshsalesAccount'));_0xd80e93[_0x147a('0x5')](_0x147a('0xb3'),require('./api/intFreshsalesConfiguration'));_0xd80e93[_0x147a('0x5')](_0x147a('0xb4'),require(_0x147a('0xb5')));_0xd80e93[_0x147a('0x5')](_0x147a('0xb6'),require(_0x147a('0xb7')));_0xd80e93['use'](_0x147a('0xb8'),require('./api/chatQueueReport'));_0xd80e93['use'](_0x147a('0xb9'),require('./api/chatInternalMessage'));_0xd80e93[_0x147a('0x5')]('/api/jscripty/answers/reports',require(_0x147a('0xba')));_0xd80e93[_0x147a('0x5')](_0x147a('0xbb'),require(_0x147a('0xbc')));_0xd80e93[_0x147a('0x5')](_0x147a('0xbd'),require(_0x147a('0xbe')));_0xd80e93[_0x147a('0x5')]('/api/sms/reports/queue',require('./api/smsQueueReport'));_0xd80e93[_0x147a('0x5')](_0x147a('0xbf'),require(_0x147a('0xc0')));_0xd80e93[_0x147a('0x5')](_0x147a('0xc1'),require(_0x147a('0xc2')));_0xd80e93[_0x147a('0x5')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0xd80e93[_0x147a('0x5')](_0x147a('0xc3'),require('./api/setting'));_0xd80e93[_0x147a('0x5')](_0x147a('0xc4'),require(_0x147a('0xc5')));_0xd80e93[_0x147a('0x5')]('/api/square/projects',require('./api/squareProject'));_0xd80e93[_0x147a('0x5')](_0x147a('0xc6'),require(_0x147a('0xc7')));_0xd80e93[_0x147a('0x5')](_0x147a('0xc8'),require(_0x147a('0xc9')));_0xd80e93['use'](_0x147a('0xca'),require(_0x147a('0xcb')));_0xd80e93['use'](_0x147a('0xcc'),require(_0x147a('0xcd')));_0xd80e93['use']('/api/campaigns',require('./api/campaign'));_0xd80e93['use'](_0x147a('0xce'),require(_0x147a('0xcf')));_0xd80e93[_0x147a('0x5')](_0x147a('0xd0'),require(_0x147a('0xd1')));_0xd80e93[_0x147a('0x5')](_0x147a('0xd2'),require(_0x147a('0xd3')));_0xd80e93['use'](_0x147a('0xd4'),require(_0x147a('0xd5')));_0xd80e93[_0x147a('0x5')]('/api/chat/reports/transfer',require(_0x147a('0xd6')));_0xd80e93[_0x147a('0x5')](_0x147a('0xd7'),require(_0x147a('0xd8')));_0xd80e93[_0x147a('0x5')]('/api/openchannel/reports/transfer',require('./api/openchannelTransferReport'));_0xd80e93['use'](_0x147a('0xd9'),require('./api/smsTransferReport'));_0xd80e93[_0x147a('0x5')](_0x147a('0xda'),require('./api/cmList'));_0xd80e93['use'](_0x147a('0xdb'),require(_0x147a('0xdc')));_0xd80e93[_0x147a('0x5')](_0x147a('0xdd'),require(_0x147a('0xde')));_0xd80e93[_0x147a('0x5')](_0x147a('0xdf'),require('./api/userProfileSection'));_0xd80e93[_0x147a('0x5')]('/api/userProfile/resources',require('./api/userProfileResource'));_0xd80e93[_0x147a('0x5')](_0x147a('0xe0'),require('./api/userNotification'));_0xd80e93[_0x147a('0x5')](_0x147a('0xe1'),require(_0x147a('0xe2')));_0xd80e93[_0x147a('0x5')](_0x147a('0xe3'),require(_0x147a('0xe4')));_0xd80e93['use'](_0x147a('0xe5'),require('./api/whatsappInteraction'));_0xd80e93[_0x147a('0x5')]('/api/whatsapp/messages',require(_0x147a('0xe6')));_0xd80e93['use'](_0x147a('0xe7'),require('./api/whatsappQueueReport'));_0xd80e93['use'](_0x147a('0xe8'),require('./api/whatsappTransferReport'));_0xd80e93[_0x147a('0x5')](_0x147a('0xe9'),require(_0x147a('0xea')));_0xd80e93[_0x147a('0x5')](_0x147a('0xeb'),require(_0x147a('0xec')));_0xd80e93[_0x147a('0x5')](_0x147a('0xed'),require(_0x147a('0xee')));_0xd80e93[_0x147a('0x5')](_0x147a('0xef'),require('./api/user-setting'));_0xd80e93['use']('/api/mail_interaction_has_tags',require(_0x147a('0xf0')));_0xd80e93[_0x147a('0x5')](_0x147a('0xf1'),require(_0x147a('0xf2')));_0xd80e93[_0x147a('0x5')](_0x147a('0xf3'),require(_0x147a('0xf4')));_0xd80e93[_0x147a('0x5')](_0x147a('0xf5'),require(_0x147a('0xf6')));_0xd80e93[_0x147a('0x5')](_0x147a('0xf7'),require(_0x147a('0xf8')));_0xd80e93['use'](_0x147a('0xf9'),require('./api/rpc'));_0xd80e93[_0x147a('0x5')]('/api/version',require(_0x147a('0xfa')));_0xd80e93[_0x147a('0x5')]('/api/system',require(_0x147a('0xfb')));_0xd80e93[_0x147a('0x5')](_0x147a('0xfc'),require(_0x147a('0xfd')));_0xd80e93[_0x147a('0x5')]('/api/webbar',require('./api/webbar'));_0xd80e93[_0x147a('0x5')](_0x147a('0xfe'),clientSideLogs);_0xd80e93[_0x147a('0x5')]('/apidoc',express[_0x147a('0xff')](path[_0x147a('0x100')](config['root'],_0x147a('0x101'))));_0xd80e93[_0x147a('0x5')](_0x147a('0x102'),express[_0x147a('0xff')](path[_0x147a('0x100')](config['root'],'/www')));_0xd80e93[_0x147a('0x5')](_0x147a('0x103'),express['static'](path['join'](config['root'],'/demo')));_0xd80e93[_0x147a('0x5')](_0x147a('0x104'),express[_0x147a('0xff')](path[_0x147a('0x100')](config['root'],_0x147a('0x105'),_0x147a('0x106'))));_0xd80e93[_0x147a('0x5')](_0x147a('0x107'),express['static'](path[_0x147a('0x100')](config[_0x147a('0x108')],_0x147a('0x109'))));_0xd80e93[_0x147a('0x10a')](_0x147a('0x10b'))[_0x147a('0x10c')](errors[0x194]);_0xd80e93[_0x147a('0x10a')]('/*')[_0x147a('0x10c')](function(_0x49055d,_0xced75){_0xced75[_0x147a('0x10d')](path[_0x147a('0x10e')](_0xd80e93[_0x147a('0x10c')](_0x147a('0x10f'))+_0x147a('0x110')));});return _0xd80e93;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ea28ba9..6e9f497 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x714b=['../api/variable/variable.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','log','../config/triggers','default','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc'];(function(_0x207099,_0x18e589){var _0x54a298=function(_0x5ccaa0){while(--_0x5ccaa0){_0x207099['push'](_0x207099['shift']());}};_0x54a298(++_0x18e589);}(_0x714b,0xed));var _0xb714=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x714b[_0x2dafbe];return _0x58a45a;};'use strict';var jayson=require('jayson/promise');var _=require(_0xb714('0x0'));var config=require(_0xb714('0x1'));exports[_0xb714('0x2')]=function(){return new Promise(function(_0x26473e,_0x20f04a){var _0x545a83={};_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/user/user.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x4')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x5')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x6')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x7')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x8')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x9')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xa')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xb')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0xc')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xd')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xe')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0xf')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x10')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x11')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x12')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/mailApplication/mailApplication.rpc'));_0x545a83=_['merge'](_0x545a83,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x13')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x14')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x15')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x16')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x17')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x18')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x19')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/smsInteraction/smsInteraction.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1a')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/smsQueue/smsQueue.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1b')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1c')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1d')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1e')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x1f')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x20')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x21')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/cmContact/cmContact.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x22')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x23')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x24')));_0x545a83=_['merge'](_0x545a83,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x25')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x26')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x27')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x28')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x29')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/template/template.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2a')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x2b')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2c')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2d')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2e')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x2f')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x30')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x31')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x32')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x33')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x34')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/squareReport/squareReport.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x35')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x36')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/squareOdbc/squareOdbc.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x37')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x38')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x39')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x3a')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x3b')));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/plugin/plugin.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x545a83=_[_0xb714('0x3')](_0x545a83,require(_0xb714('0x3c')));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x3d')));_0x545a83=_['merge'](_0x545a83,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0x545a83=_['merge'](_0x545a83,require(_0xb714('0x3e')));var _0x573266=jayson[_0xb714('0x3f')](_0x545a83)['http']();var _0x5a8dd6=config[_0xb714('0x40')][_0xb714('0x41')]||config[_0xb714('0x41')]+0x1;var _0x122550=config[_0xb714('0x40')]['ip']||'localhost';_0x573266['on']('error',function(_0xb1de96){return _0x20f04a(_0xb1de96);});_0x573266['listen'](_0x5a8dd6,_0x122550,function(){console[_0xb714('0x42')]('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x122550,_0x5a8dd6);require(_0xb714('0x43'))[_0xb714('0x44')]();return _0x26473e(_0xb714('0x45')+_0x122550+':'+_0x5a8dd6);});});}; \ No newline at end of file +var _0xec36=['../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','server','http','rpc','port','localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','../config/environment','listen','../api/voiceExtension/voiceExtension.rpc','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.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/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/pause/pause.rpc','../api/trigger/trigger.rpc','../api/variable/variable.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/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc'];(function(_0x310fc1,_0x32d346){var _0x3d1e75=function(_0x48bc5f){while(--_0x48bc5f){_0x310fc1['push'](_0x310fc1['shift']());}};_0x3d1e75(++_0x32d346);}(_0xec36,0xda));var _0x6ec3=function(_0x33dcf7,_0x3d5390){_0x33dcf7=_0x33dcf7-0x0;var _0x542d4e=_0xec36[_0x33dcf7];return _0x542d4e;};'use strict';var jayson=require(_0x6ec3('0x0'));var _=require('lodash');var config=require(_0x6ec3('0x1'));exports[_0x6ec3('0x2')]=function(){return new Promise(function(_0x19bcd9,_0x409531){var _0x1ac7cd={};_0x1ac7cd=_['merge'](_0x1ac7cd,require('../api/user/user.rpc'));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x3')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x5')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x6')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x7')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x8')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x9')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0xa')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0xb')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0xc')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0xd')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0xe')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0xf')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x10')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/mailApplication/mailApplication.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x11')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x12')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/faxApplication/faxApplication.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/faxInteraction/faxInteraction.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/faxMessage/faxMessage.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/faxQueue/faxQueue.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x13')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/smsAccount/smsAccount.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x14')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x15')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x16')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x17')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x18')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x19')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x1a')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x1b')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x1c')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x1d')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x1e')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x1f')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x20')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x21')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x22')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x23')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x24')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/interval/interval.rpc'));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x25')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/sound/sound.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/template/template.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x26')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x27')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x28')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x29')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x2a')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x2b')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x2c')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x2d')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x2e')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x2f')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x30')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x31')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/squareReport/squareReport.rpc'));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x32')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x33')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/squareOdbc/squareOdbc.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x34')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/squareRecording/squareRecording.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/squareMessage/squareMessage.rpc'));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x35')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x36')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x37')));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x38')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0x1ac7cd=_['merge'](_0x1ac7cd,require(_0x6ec3('0x39')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require(_0x6ec3('0x3a')));_0x1ac7cd=_[_0x6ec3('0x4')](_0x1ac7cd,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x50e2f4=jayson[_0x6ec3('0x3b')](_0x1ac7cd)[_0x6ec3('0x3c')]();var _0xcd7f6b=config[_0x6ec3('0x3d')][_0x6ec3('0x3e')]||config['port']+0x1;var _0x170e3c=config[_0x6ec3('0x3d')]['ip']||_0x6ec3('0x3f');_0x50e2f4['on'](_0x6ec3('0x40'),function(_0x443aad){return _0x409531(_0x443aad);});_0x50e2f4['listen'](_0xcd7f6b,_0x170e3c,function(){console['log'](_0x6ec3('0x41'),_0x170e3c,_0xcd7f6b);require(_0x6ec3('0x42'))['default']();return _0x19bcd9(_0x6ec3('0x43')+_0x170e3c+':'+_0xcd7f6b);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 6039ca1..c40d83b 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 _0xb344=['join','setContext','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','events','EventEmitter','./reply','./error','setEncoding','utf8','headers','emit','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','indexOf','substr','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','close','E_AGI_SOCKET_CLOSE','timeout','command','write','destroy','inherits','prototype','sendRequest','sync','answer','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s'];(function(_0x4ac40b,_0x44aabb){var _0x5a199d=function(_0x5d4e27){while(--_0x5d4e27){_0x4ac40b['push'](_0x4ac40b['shift']());}};_0x5a199d(++_0x44aabb);}(_0xb344,0x152));var _0x4b34=function(_0x3a7c8a,_0x24eeba){_0x3a7c8a=_0x3a7c8a-0x0;var _0x12ed2c=_0xb344[_0x3a7c8a];return _0x12ed2c;};'use strict';var util=require(_0x4b34('0x0'));var _=require(_0x4b34('0x1'));var EventEmitter=require(_0x4b34('0x2'))[_0x4b34('0x3')];var AGIReply=require(_0x4b34('0x4'));var AGIError=require(_0x4b34('0x5'));function AGIChannel(_0x11b964){var _0x5e7814=this,_0x51f872=new AGIReply(),_0x423b07=![],_0x9f7bf3={};EventEmitter['call'](_0x5e7814);_0x11b964[_0x4b34('0x6')](_0x4b34('0x7'));_0x11b964['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x51f872[_0x4b34('0x6')]('utf8');_0x51f872['on'](_0x4b34('0x8'),function(_0x1a2934){for(var _0x5c0c48 in _0x1a2934){_0x5e7814[_0x5c0c48]=_0x1a2934[_0x5c0c48];}_0x5e7814[_0x4b34('0x9')]('ready');});_0x51f872['on']('line',function(_0x57e24d){if(_0x57e24d['toLowerCase']()==_0x4b34('0xa')){_0x5e7814['emit']('hangup');return;}if(_0x57e24d['substring'](0x0,0xb)==_0x4b34('0xb')){_0x423b07=!![];}if(_0x423b07){_0x9f7bf3['rx']+=_0x57e24d+'\x0a';if(_0x57e24d[_0x4b34('0xc')](_0x4b34('0xd'))!=-0x1){_0x423b07=![];}}else{_0x9f7bf3['rx']=_0x57e24d;}if(_0x423b07){return;}if(typeof _0x9f7bf3['cb']==_0x4b34('0xe')){var _0x24212a=_0x9f7bf3['rx'][_0x4b34('0xf')](0x0,0x3),_0x184fd3=null,_0xfeeaac=null;_0x24212a=parseInt(_0x24212a);if(isNaN(_0x24212a)){_0x9f7bf3['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4b34('0x10')});return;}if(_0x24212a!=0xc8){_0x9f7bf3['cb'](null,{'code':_0x24212a,'result':-0x1,'extra':'KO'});return;}_0x184fd3=_0x9f7bf3['rx'][_0x4b34('0xf')](0x4)[_0x4b34('0x11')]('result=','');if(_0x184fd3[_0x4b34('0x12')]('\x20')!=-0x1){_0x184fd3=_0x184fd3[_0x4b34('0x13')](0x0,_0x184fd3['indexOf']('\x20'));}if(_[_0x4b34('0x14')](_0x184fd3,'-1')){_0x184fd3=parseInt(_0x184fd3);}_0xfeeaac=_0x9f7bf3['rx'][_0x4b34('0x15')]('\x20');if(_0xfeeaac['length']==0x3){_0xfeeaac=_0xfeeaac[0x2]['substring'](0x1,_0xfeeaac[0x2][_0x4b34('0x16')]-0x1);}else if(_0xfeeaac[_0x4b34('0x16')]>0x3){var _0x3597a9=/\((.+)\)/;var _0xa75657=_0x9f7bf3['rx'][_0x4b34('0x17')](_0x3597a9);if(_0xa75657){_0xfeeaac=_0xa75657[0x1];}else{_0xfeeaac=null;}}else{_0xfeeaac=null;}_0x9f7bf3['cb'](null,{'code':_0x24212a,'result':_0x184fd3,'extra':_0xfeeaac});}});_0x11b964['on']('error',function(_0x558485){_0x5e7814['emit'](_0x4b34('0x18'),new AGIError(_0x4b34('0x19'),_0x558485['code']));});_0x11b964['on'](_0x4b34('0x1a'),function(){_0x5e7814[_0x4b34('0x9')](_0x4b34('0x1a'),new AGIError(_0x4b34('0x1b')));});_0x11b964['on'](_0x4b34('0x1c'),function(){_0x5e7814[_0x4b34('0x9')](_0x4b34('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x11b964['destroy']();});_0x11b964['pipe'](_0x51f872);this[_0x4b34('0x1d')]=function(_0x57d5b8,_0x267f25){var _0x57d5b8=_0x57d5b8||'',_0x267f25=typeof _0x267f25==_0x4b34('0xe')?_0x267f25:new Function();_0x9f7bf3={'tx':_0x57d5b8,'rx':'','cb':_0x267f25};_0x11b964[_0x4b34('0x1e')](_0x57d5b8+'\x0a');},this[_0x4b34('0x1a')]=function(){_0x11b964[_0x4b34('0x1f')]();};}util[_0x4b34('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4b34('0x21')][_0x4b34('0x22')]=function(_0x50fc0a){return this[_0x4b34('0x1d')][_0x4b34('0x23')](this,_0x50fc0a);};AGIChannel[_0x4b34('0x21')][_0x4b34('0x24')]=function(){return this[_0x4b34('0x22')]('ANSWER');};AGIChannel[_0x4b34('0x21')][_0x4b34('0x25')]=function(_0xf58c02,_0x3d7b5d,_0x2f7f5e){_0xf58c02=_0xf58c02===undefined?_0x4b34('0x26'):_0xf58c02;_0x3d7b5d=_0x3d7b5d===undefined?'5':_0x3d7b5d;_0x2f7f5e=_0x2f7f5e===undefined?'1':_0x2f7f5e;return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x28'),_0xf58c02,_0x3d7b5d*0x3e8,_0x2f7f5e));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x29')]=function(_0x462e0a){_0x462e0a=_0x462e0a||_0x4b34('0x2a');return this[_0x4b34('0x22')](util['format'](_0x4b34('0x2b'),_0x462e0a));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x2c')]=function(_0x37a011,_0xa37c30){if(_[_0x4b34('0x2d')](_0xa37c30)){return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x2e'),_0x37a011,_0xa37c30[_0x4b34('0x2f')](',')));}return this['sendRequest'](util[_0x4b34('0x27')](_0x4b34('0x2e'),_0x37a011,_0xa37c30));};AGIChannel['prototype'][_0x4b34('0x30')]=function(_0x3c4d77){return this[_0x4b34('0x22')](util['format']('SET\x20CONTEXT\x20%s',_0x3c4d77));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x31')]=function(_0x44f3fd){return this[_0x4b34('0x22')](util[_0x4b34('0x27')]('SET\x20EXTENSION\x20%s',_0x44f3fd));};AGIChannel['prototype'][_0x4b34('0x32')]=function(_0x2624d1){return this['sendRequest'](util[_0x4b34('0x27')](_0x4b34('0x33'),_0x2624d1));};AGIChannel[_0x4b34('0x21')][_0x4b34('0xa')]=function(){return this['sendRequest'](_0x4b34('0x34'));};AGIChannel[_0x4b34('0x21')]['setVariable']=function(_0x27ec77,_0x1fdf3c){var _0x3f24d5=_[_0x4b34('0x35')](_0x1fdf3c)||_[_0x4b34('0x36')](_0x1fdf3c)?_0x1fdf3c[_0x4b34('0x37')]():_0x1fdf3c;return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x38'),_0x27ec77,_0x3f24d5?_0x3f24d5[_0x4b34('0x37')]()[_0x4b34('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x39')]=function(_0x24c1c2,_0x1e8a84){return this[_0x4b34('0x22')](util[_0x4b34('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x24c1c2,_0x1e8a84));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x3a')]=function(_0xebf9f0,_0x151a75){return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x3b'),_0xebf9f0,_0x151a75));};AGIChannel['prototype'][_0x4b34('0x3c')]=function(_0x205567,_0x22f6c5){return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x3d'),_0x205567,_0x22f6c5));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x3e')]=function(_0x7b9df5,_0x3dc5d6,_0x315ff5){_0x3dc5d6=_0x3dc5d6||this[_0x4b34('0x3f')];_0x315ff5=_0x315ff5||0x1;this[_0x4b34('0x30')](_0x7b9df5);this[_0x4b34('0x31')](_0x3dc5d6);this[_0x4b34('0x32')](_0x315ff5);return this['noop'](util[_0x4b34('0x27')](_0x4b34('0x40'),_0x7b9df5,_0x3dc5d6,_0x315ff5));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x41')]=function(_0x9f1d02){return this['sendRequest'](util[_0x4b34('0x27')](_0x4b34('0x42'),_0x9f1d02));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x43')]=function(_0x3f2bfa,_0x474c49,_0x322b15,_0x3d29eb,_0x4f9eee,_0x1a9c93){_0x474c49=_0x474c49||_0x4b34('0x44');_0x322b15=_0x322b15||'';_0x3d29eb=_0x3d29eb===undefined?-0x1:_0x3d29eb==='-1'?-0x1:_0x3d29eb*0x3e8;_0x4f9eee=_0x4f9eee===undefined?'':'s='+_0x4f9eee;_0x1a9c93=_0x1a9c93?_0x4b34('0x45'):'';return this[_0x4b34('0x22')](util[_0x4b34('0x27')](_0x4b34('0x46'),_0x3f2bfa,_0x474c49,_0x322b15,_0x3d29eb,_0x1a9c93,_0x4f9eee));};AGIChannel['prototype']['streamFile']=function(_0x34d317,_0x5e0e97){_0x5e0e97=_0x5e0e97||'';return this['sendRequest'](util[_0x4b34('0x27')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x34d317,_0x5e0e97));};AGIChannel[_0x4b34('0x21')][_0x4b34('0x47')]=function(_0xef62da){return this[_0x4b34('0x2c')]('AGI',_0xef62da);};AGIChannel[_0x4b34('0x21')][_0x4b34('0x48')]=function(_0x28fe0e){return this[_0x4b34('0x2c')](_0x4b34('0x49'),_0x28fe0e);};AGIChannel[_0x4b34('0x21')][_0x4b34('0x18')]=function(_0x3a8c72,_0x26b414){this[_0x4b34('0x29')](util[_0x4b34('0x27')](_0x4b34('0x4a'),_0x3a8c72['id'],_0x3a8c72[_0x4b34('0x4b')],_0x26b414));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4b34('0x4c')]=AGIChannel; \ No newline at end of file +var _0x5d0a=['E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','sendRequest','sync','prototype','answer','ANSWER','getData','beep','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','format','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','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','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','exports','util','lodash','./error','call','setEncoding','setTimeout','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','result=','indexOf','substr','startsWith','split','length','error','code','close','E_AGI_SOCKET_CLOSE','timeout'];(function(_0x31eaa5,_0x182ebb){var _0x522d2e=function(_0xe99b81){while(--_0xe99b81){_0x31eaa5['push'](_0x31eaa5['shift']());}};_0x522d2e(++_0x182ebb);}(_0x5d0a,0x173));var _0xa5d0=function(_0x1757a4,_0x49b813){_0x1757a4=_0x1757a4-0x0;var _0x4c38c6=_0x5d0a[_0x1757a4];return _0x4c38c6;};'use strict';var util=require(_0xa5d0('0x0'));var _=require(_0xa5d0('0x1'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require('./reply');var AGIError=require(_0xa5d0('0x2'));function AGIChannel(_0x45a2b4){var _0x280e7c=this,_0x1fe0f2=new AGIReply(),_0x35851c=![],_0x3e7e1e={};EventEmitter[_0xa5d0('0x3')](_0x280e7c);_0x45a2b4[_0xa5d0('0x4')]('utf8');_0x45a2b4[_0xa5d0('0x5')](0x8*0x3c*0x3c*0x3e8);_0x1fe0f2['setEncoding'](_0xa5d0('0x6'));_0x1fe0f2['on'](_0xa5d0('0x7'),function(_0x372cc5){for(var _0x2df484 in _0x372cc5){_0x280e7c[_0x2df484]=_0x372cc5[_0x2df484];}_0x280e7c[_0xa5d0('0x8')](_0xa5d0('0x9'));});_0x1fe0f2['on'](_0xa5d0('0xa'),function(_0x384e93){if(_0x384e93[_0xa5d0('0xb')]()==_0xa5d0('0xc')){_0x280e7c[_0xa5d0('0x8')](_0xa5d0('0xc'));return;}if(_0x384e93[_0xa5d0('0xd')](0x0,0xb)==_0xa5d0('0xe')){_0x35851c=!![];}if(_0x35851c){_0x3e7e1e['rx']+=_0x384e93+'\x0a';if(_0x384e93['search'](_0xa5d0('0xf'))!=-0x1){_0x35851c=![];}}else{_0x3e7e1e['rx']=_0x384e93;}if(_0x35851c){return;}if(typeof _0x3e7e1e['cb']==_0xa5d0('0x10')){var _0x24f2ba=_0x3e7e1e['rx'][_0xa5d0('0xd')](0x0,0x3),_0x1ab066=null,_0x442b02=null;_0x24f2ba=parseInt(_0x24f2ba);if(isNaN(_0x24f2ba)){_0x3e7e1e['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xa5d0('0x11')});return;}if(_0x24f2ba!=0xc8){_0x3e7e1e['cb'](null,{'code':_0x24f2ba,'result':-0x1,'extra':'KO'});return;}_0x1ab066=_0x3e7e1e['rx'][_0xa5d0('0xd')](0x4)['replace'](_0xa5d0('0x12'),'');if(_0x1ab066[_0xa5d0('0x13')]('\x20')!=-0x1){_0x1ab066=_0x1ab066[_0xa5d0('0x14')](0x0,_0x1ab066['indexOf']('\x20'));}if(_[_0xa5d0('0x15')](_0x1ab066,'-1')){_0x1ab066=parseInt(_0x1ab066);}_0x442b02=_0x3e7e1e['rx'][_0xa5d0('0x16')]('\x20');if(_0x442b02[_0xa5d0('0x17')]==0x3){_0x442b02=_0x442b02[0x2][_0xa5d0('0xd')](0x1,_0x442b02[0x2]['length']-0x1);}else if(_0x442b02[_0xa5d0('0x17')]>0x3){var _0x22fdb8=/\((.+)\)/;var _0x2095f7=_0x3e7e1e['rx']['match'](_0x22fdb8);if(_0x2095f7){_0x442b02=_0x2095f7[0x1];}else{_0x442b02=null;}}else{_0x442b02=null;}_0x3e7e1e['cb'](null,{'code':_0x24f2ba,'result':_0x1ab066,'extra':_0x442b02});}});_0x45a2b4['on'](_0xa5d0('0x18'),function(_0x30faee){_0x280e7c['emit'](_0xa5d0('0x18'),new AGIError('E_AGI_SOCKET_ERROR',_0x30faee[_0xa5d0('0x19')]));});_0x45a2b4['on'](_0xa5d0('0x1a'),function(){_0x280e7c[_0xa5d0('0x8')](_0xa5d0('0x1a'),new AGIError(_0xa5d0('0x1b')));});_0x45a2b4['on'](_0xa5d0('0x1c'),function(){_0x280e7c[_0xa5d0('0x8')](_0xa5d0('0x1c'),new AGIError(_0xa5d0('0x1d')));_0x45a2b4[_0xa5d0('0x1e')]();});_0x45a2b4[_0xa5d0('0x1f')](_0x1fe0f2);this[_0xa5d0('0x20')]=function(_0x9f9c36,_0x17e1a2){var _0x9f9c36=_0x9f9c36||'',_0x17e1a2=typeof _0x17e1a2==_0xa5d0('0x10')?_0x17e1a2:new Function();_0x3e7e1e={'tx':_0x9f9c36,'rx':'','cb':_0x17e1a2};_0x45a2b4[_0xa5d0('0x21')](_0x9f9c36+'\x0a');},this['close']=function(){_0x45a2b4[_0xa5d0('0x1e')]();};}util[_0xa5d0('0x22')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xa5d0('0x23')]=function(_0x9d8a26){return this[_0xa5d0('0x20')][_0xa5d0('0x24')](this,_0x9d8a26);};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x26')]=function(){return this[_0xa5d0('0x23')](_0xa5d0('0x27'));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x28')]=function(_0x126aab,_0xe9e78e,_0x204e42){_0x126aab=_0x126aab===undefined?_0xa5d0('0x29'):_0x126aab;_0xe9e78e=_0xe9e78e===undefined?'5':_0xe9e78e;_0x204e42=_0x204e42===undefined?'1':_0x204e42;return this[_0xa5d0('0x23')](util['format'](_0xa5d0('0x2a'),_0x126aab,_0xe9e78e*0x3e8,_0x204e42));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x2b')]=function(_0x4a4ea4){_0x4a4ea4=_0x4a4ea4||'NO\x20MESSAGE';return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x2d'),_0x4a4ea4));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x2e')]=function(_0x3ac12c,_0x19f977){if(_[_0xa5d0('0x2f')](_0x19f977)){return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x30'),_0x3ac12c,_0x19f977[_0xa5d0('0x31')](',')));}return this[_0xa5d0('0x23')](util['format']('EXEC\x20%s\x20%s',_0x3ac12c,_0x19f977));};AGIChannel['prototype'][_0xa5d0('0x32')]=function(_0x43ccf2){return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')]('SET\x20CONTEXT\x20%s',_0x43ccf2));};AGIChannel['prototype'][_0xa5d0('0x33')]=function(_0x2597b3){return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x34'),_0x2597b3));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x35')]=function(_0x36976c){return this['sendRequest'](util[_0xa5d0('0x2c')](_0xa5d0('0x36'),_0x36976c));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0xc')]=function(){return this['sendRequest'](_0xa5d0('0x37'));};AGIChannel['prototype'][_0xa5d0('0x38')]=function(_0x55e3ce,_0x1b3d2e){var _0x703ed4=_['isBoolean'](_0x1b3d2e)||_[_0xa5d0('0x39')](_0x1b3d2e)?_0x1b3d2e[_0xa5d0('0x3a')]():_0x1b3d2e;return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x3b'),_0x55e3ce,_0x703ed4?_0x703ed4[_0xa5d0('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0xa5d0('0x3c')]=function(_0x126c09,_0xcc9cf2){return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x3d'),_0x126c09,_0xcc9cf2));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x3e')]=function(_0x1f625f,_0x15e1b5){return this['sendRequest'](util[_0xa5d0('0x2c')]('SAY\x20DIGITS\x20%s\x20%s',_0x1f625f,_0x15e1b5));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x3f')]=function(_0x7d5ef,_0x2b47f3){return this['sendRequest'](util['format'](_0xa5d0('0x40'),_0x7d5ef,_0x2b47f3));};AGIChannel['prototype'][_0xa5d0('0x41')]=function(_0x3564dc,_0x44dc3a,_0x128c50){_0x44dc3a=_0x44dc3a||this[_0xa5d0('0x42')];_0x128c50=_0x128c50||0x1;this[_0xa5d0('0x32')](_0x3564dc);this[_0xa5d0('0x33')](_0x44dc3a);this[_0xa5d0('0x35')](_0x128c50);return this[_0xa5d0('0x2b')](util[_0xa5d0('0x2c')](_0xa5d0('0x43'),_0x3564dc,_0x44dc3a,_0x128c50));};AGIChannel[_0xa5d0('0x25')]['getVariable']=function(_0x5e7770){return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x44'),_0x5e7770));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x45')]=function(_0x26dddb,_0x37aae4,_0x352e66,_0x4f1d51,_0x5ea5dc,_0x54c215){_0x37aae4=_0x37aae4||_0xa5d0('0x46');_0x352e66=_0x352e66||'';_0x4f1d51=_0x4f1d51===undefined?-0x1:_0x4f1d51==='-1'?-0x1:_0x4f1d51*0x3e8;_0x5ea5dc=_0x5ea5dc===undefined?'':'s='+_0x5ea5dc;_0x54c215=_0x54c215?_0xa5d0('0x47'):'';return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x48'),_0x26dddb,_0x37aae4,_0x352e66,_0x4f1d51,_0x54c215,_0x5ea5dc));};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x49')]=function(_0x3fc143,_0x4b1eac){_0x4b1eac=_0x4b1eac||'';return this[_0xa5d0('0x23')](util[_0xa5d0('0x2c')](_0xa5d0('0x4a'),_0x3fc143,_0x4b1eac));};AGIChannel[_0xa5d0('0x25')]['agi']=function(_0x52cc74){return this['exec'](_0xa5d0('0x4b'),_0x52cc74);};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x4c')]=function(_0x34a4ee){return this[_0xa5d0('0x2e')](_0xa5d0('0x4d'),_0x34a4ee);};AGIChannel[_0xa5d0('0x25')][_0xa5d0('0x18')]=function(_0x4f4faa,_0x508be3){this[_0xa5d0('0x2b')](util[_0xa5d0('0x2c')](_0xa5d0('0x4e'),_0x4f4faa['id'],_0x4f4faa['label'],_0x508be3));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xa5d0('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 5b1f53b..7515256 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 _0x5221=['Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.'];(function(_0x1201ce,_0x4b01d){var _0x526a56=function(_0xd5a561){while(--_0xd5a561){_0x1201ce['push'](_0x1201ce['shift']());}};_0x526a56(++_0x4b01d);}(_0x5221,0xb1));var _0x1522=function(_0xc2cdba,_0x409cc2){_0xc2cdba=_0xc2cdba-0x0;var _0x19471d=_0x5221[_0xc2cdba];return _0x19471d;};'use strict';var util=require(_0x1522('0x0'));var error={'E_AGI_UNDEFINED':_0x1522('0x1'),'E_AGI_ARGUMENT_PORT':_0x1522('0x2'),'E_AGI_SERVER_ERROR':_0x1522('0x3'),'E_AGI_SERVER_CLOSE':_0x1522('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x1522('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1522('0x6'),'E_AGI_SOCKET_CLOSE':_0x1522('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x1522('0x8'),'E_AGI_COMMAND_EMPTY':_0x1522('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1522('0xa'),'E_AGI_IVR_ENTRY':_0x1522('0xb')};function AGIError(_0x946576){var _0x946576=_0x946576||null,_0x3a1675=_0x3a1675||[],_0x24deab=0x1,_0x1854c3='';if(!error[_0x946576]){_0x946576=_0x1522('0xc');}_0x3a1675[_0x1522('0xd')](error[_0x946576]);while(arguments[_0x24deab]){_0x3a1675[_0x1522('0xd')](arguments[_0x24deab]);_0x24deab++;}_0x1854c3=util[_0x1522('0xe')][_0x1522('0xf')](util,_0x3a1675);this[_0x1522('0x10')]=_0x1854c3;this['name']=_0x946576;}module[_0x1522('0x11')]=AGIError; \ No newline at end of file +var _0xeb26=['push','format','apply','message','name','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.'];(function(_0x34f32b,_0x3bc132){var _0xb1c8f9=function(_0x3dd70a){while(--_0x3dd70a){_0x34f32b['push'](_0x34f32b['shift']());}};_0xb1c8f9(++_0x3bc132);}(_0xeb26,0x139));var _0x6eb2=function(_0x5a1e59,_0x2e62b2){_0x5a1e59=_0x5a1e59-0x0;var _0x137fca=_0xeb26[_0x5a1e59];return _0x137fca;};'use strict';var util=require(_0x6eb2('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x6eb2('0x1'),'E_AGI_SERVER_CLOSE':_0x6eb2('0x2'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6eb2('0x3'),'E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x6eb2('0x4'),'E_AGI_SOCKET_TIMEOUT':_0x6eb2('0x5'),'E_AGI_COMMAND_EMPTY':_0x6eb2('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6eb2('0x7'),'E_AGI_IVR_ENTRY':_0x6eb2('0x8')};function AGIError(_0x24fcb3){var _0x24fcb3=_0x24fcb3||null,_0x317781=_0x317781||[],_0x3340e1=0x1,_0x26392a='';if(!error[_0x24fcb3]){_0x24fcb3='E_AGI_UNDEFINED';}_0x317781[_0x6eb2('0x9')](error[_0x24fcb3]);while(arguments[_0x3340e1]){_0x317781[_0x6eb2('0x9')](arguments[_0x3340e1]);_0x3340e1++;}_0x26392a=util[_0x6eb2('0xa')][_0x6eb2('0xb')](util,_0x317781);this[_0x6eb2('0xc')]=_0x26392a;this[_0x6eb2('0xd')]=_0x24fcb3;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 9f0a7bb..89f2fe7 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 _0xac8e=['agi','error','E_AGI_SERVER_ERROR','message','parse','emit','projectUpdate','exports','events','ioredis','../../config/environment','redis'];(function(_0x485086,_0x54db73){var _0x2432fa=function(_0x2b9289){while(--_0x2b9289){_0x485086['push'](_0x485086['shift']());}};_0x2432fa(++_0x54db73);}(_0xac8e,0x1c4));var _0xeac8=function(_0x43732e,_0x39b51c){_0x43732e=_0x43732e-0x0;var _0x202c74=_0xac8e[_0x43732e];return _0x202c74;};'use strict';var _=require('lodash');var EventEmitter=require(_0xeac8('0x0'))['EventEmitter'];var Redis=require(_0xeac8('0x1'));var AGIError=require('./error');var config=require(_0xeac8('0x2'));config[_0xeac8('0x3')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xeac8('0x3')]);sub['subscribe'](_0xeac8('0x4'),function(_0x23b57f){if(_0x23b57f)return eventEmitter['emit'](_0xeac8('0x5'),new AGIError(_0xeac8('0x6'),_0x23b57f));});sub['on'](_0xeac8('0x7'),function(_0x4884ce,_0x29b6a7){if(_0x4884ce!==_0xeac8('0x4'))return;try{var _0x2cad69=JSON[_0xeac8('0x8')](_0x29b6a7);eventEmitter[_0xeac8('0x9')](_0xeac8('0xa'),_0x2cad69);}catch(_0x5d6abf){eventEmitter[_0xeac8('0x9')](_0xeac8('0x5'),new AGIError('E_AGI_SERVER_ERROR',_0x5d6abf));}});module[_0xeac8('0xb')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x6016=['parse','projectUpdate','emit','error','lodash','ioredis','./error','../../config/environment','redis','localhost','subscribe','agi','E_AGI_SERVER_ERROR'];(function(_0x4145ed,_0x1965e3){var _0x2294a6=function(_0x21c3bb){while(--_0x21c3bb){_0x4145ed['push'](_0x4145ed['shift']());}};_0x2294a6(++_0x1965e3);}(_0x6016,0x156));var _0x6601=function(_0x55c00d,_0x520cb6){_0x55c00d=_0x55c00d-0x0;var _0x254a8f=_0x6016[_0x55c00d];return _0x254a8f;};'use strict';var _=require(_0x6601('0x0'));var EventEmitter=require('events')['EventEmitter'];var Redis=require(_0x6601('0x1'));var AGIError=require(_0x6601('0x2'));var config=require(_0x6601('0x3'));config['redis']=_['defaults'](config[_0x6601('0x4')],{'host':_0x6601('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x6601('0x6')](_0x6601('0x7'),function(_0x1dfe5b){if(_0x1dfe5b)return eventEmitter['emit']('error',new AGIError(_0x6601('0x8'),_0x1dfe5b));});sub['on']('message',function(_0x1699b0,_0x473215){if(_0x1699b0!==_0x6601('0x7'))return;try{var _0x2c644d=JSON[_0x6601('0x9')](_0x473215);eventEmitter['emit'](_0x6601('0xa'),_0x2c644d);}catch(_0x484328){eventEmitter[_0x6601('0xb')](_0x6601('0xc'),new AGIError(_0x6601('0x8'),_0x484328));}});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 8da1e3e..39e4944 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 _0x1f84=['length','no\x20edge/s\x20available','condition','split','agicommand','target','menu','invalid','vswitch','includes','max\x20retry\x20reach','condition\x20not\x20found','lodash','../../../config/logger','agi','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found'];(function(_0x3789d1,_0x30994a){var _0x11c8a0=function(_0x4271b7){while(--_0x4271b7){_0x3789d1['push'](_0x3789d1['shift']());}};_0x11c8a0(++_0x30994a);}(_0x1f84,0x98));var _0x41f8=function(_0x49f30d,_0x50300a){_0x49f30d=_0x49f30d-0x0;var _0x2c75fa=_0x1f84[_0x49f30d];return _0x2c75fa;};'use strict';var _=require(_0x41f8('0x0'));var logger=require(_0x41f8('0x1'))(_0x41f8('0x2'));var verticesWithRetry=['menu','getdigits',_0x41f8('0x3')];var Graph=function(){this[_0x41f8('0x4')]={};this[_0x41f8('0x5')]={};this[_0x41f8('0x6')]=0x0;};Graph['prototype'][_0x41f8('0x7')]=function(_0xbfea79){this[_0x41f8('0x4')][_0xbfea79['id']]=_0xbfea79;this[_0x41f8('0x5')][_0xbfea79['id']]=[];};Graph[_0x41f8('0x8')][_0x41f8('0x9')]=function(_0x2f3767,_0x3e9bae,_0x33769b){this['edges'][_0x2f3767]['push']({'target':_0x3e9bae,'condition':_0x33769b});this['numberOfEdges']+=0x1;};Graph['prototype'][_0x41f8('0xa')]=function(){return _[_0x41f8('0xa')](this[_0x41f8('0x4')]);};Graph[_0x41f8('0x8')][_0x41f8('0xb')]=function(){return this[_0x41f8('0x6')];};Graph[_0x41f8('0x8')][_0x41f8('0xc')]=function(_0x329111){return this[_0x41f8('0x4')][_0x329111];};Graph['prototype'][_0x41f8('0xd')]=function(_0x461740,_0x1aabd3){if(!this['vertices'][_0x461740]){return logger[_0x41f8('0xe')](_0x41f8('0xf'));}var _0xf23d5c=_0x1aabd3(this[_0x41f8('0x4')][_0x461740]);if(!_0xf23d5c){return logger[_0x41f8('0xe')]('stop\x20traverse');}if(this[_0x41f8('0x5')][_0x461740][_0x41f8('0x10')]===0x0){return logger[_0x41f8('0xe')](_0x41f8('0x11'));}for(var _0x49ba00=0x0,_0x5e0fc4=[],_0x3542e6=![];_0x49ba00\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','substring','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','timeout','hangup','find','production','handleUnpublished','getLicense','voice','[LICENSE]\x20CHANNELS:\x20%s','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','listening','connection','close','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./rpc','./events','EventEmitter','127.0.0.1'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb57d,0xdd));var _0xdb57=function(_0x39e3c4,_0x4ed9c6){_0x39e3c4=_0x39e3c4-0x0;var _0x212f26=_0xb57d[_0x39e3c4];return _0x212f26;};'use strict';var _=require(_0xdb57('0x0'));var syncho=require(_0xdb57('0x1'));var util=require(_0xdb57('0x2'));var config=require(_0xdb57('0x3'));var logger=require(_0xdb57('0x4'))(_0xdb57('0x5'));var utilLicense=require(_0xdb57('0x6'));var rpc=require(_0xdb57('0x7'));var Project=require('./project');var AGIEmitter=require(_0xdb57('0x8'))[_0xdb57('0x9')];var projects=[];config[_0xdb57('0x5')]=_['defaults'](config[_0xdb57('0x5')],{'ip':_0xdb57('0xa'),'port':0x11dd});AGIEmitter['on'](_0xdb57('0xb'),projectUpdateHandler);function connectionHandler(_0x4f7b8f){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x4f7b8f);agiHandler(_0x4f7b8f);}catch(_0x3d8cf1){logger[_0xdb57('0xc')](_0x3d8cf1[_0xdb57('0xd')]);}});});}function projectUpdateHandler(_0x11bc93){try{var _0x255b92=_[_0xdb57('0xe')](projects,['id',_0x11bc93['id']]);if(_0x255b92>-0x1){if(_0x11bc93[_0xdb57('0xf')]===!![]){projects[_0xdb57('0x10')](_0x255b92,0x1);}else{projects[_0x255b92]=_0x11bc93;}}else{projects[_0xdb57('0x11')](_0x11bc93);}}catch(_0x2bcbe3){logger[_0xdb57('0xc')](_0x2bcbe3[_0xdb57('0xd')]);}}function listeningHandler(){console[_0xdb57('0x12')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xdb57('0x5')]['port']);logger[_0xdb57('0x13')](util[_0xdb57('0x14')](_0xdb57('0x15'),config[_0xdb57('0x5')]['ip'],config['agi'][_0xdb57('0x16')]));}function errorHandler(_0x57e37a){if(_0x57e37a&&_0x57e37a['name']&&_0x57e37a[_0xdb57('0x17')]){logger['error'](util[_0xdb57('0x14')](_0xdb57('0x18'),_0x57e37a[_0xdb57('0x19')],_0x57e37a[_0xdb57('0x17')]));}else{logger[_0xdb57('0xc')](util[_0xdb57('0x14')](_0xdb57('0x1a'),_0x57e37a[_0xdb57('0xd')]));}}function closeHandler(){logger['info'](util[_0xdb57('0x14')](_0xdb57('0x1b'),this[_0xdb57('0x1c')],this[_0xdb57('0x1d')],this[_0xdb57('0x1e')],this['dnid'],this[_0xdb57('0x1f')]));try{createSquareReport(this);}catch(_0x33f71a){logger[_0xdb57('0xc')](_0x33f71a[_0xdb57('0xd')]);}}function timeoutHandler(){logger[_0xdb57('0x13')](util[_0xdb57('0x14')](_0xdb57('0x20'),this[_0xdb57('0x1c')],this[_0xdb57('0x1d')],this[_0xdb57('0x1e')],this[_0xdb57('0x21')],this[_0xdb57('0x1f')]));}function hangupHandler(){logger[_0xdb57('0x13')](util[_0xdb57('0x14')](_0xdb57('0x22'),this[_0xdb57('0x1c')],this[_0xdb57('0x1d')],this[_0xdb57('0x1e')],this[_0xdb57('0x21')],this[_0xdb57('0x1f')]));this[_0xdb57('0x23')]=!![];}function createSquareReport(_0x4cc687,_0x5820d1){rpc[_0xdb57('0x24')](_0x4cc687)[_0xdb57('0x25')](function(_0x17afbf){if(_0x5820d1){_0x5820d1(null,_0x17afbf);}})[_0xdb57('0x26')](function(_0x4ea513){if(_0x5820d1){_0x5820d1(null,_0x4ea513);}});}function setChannelVariables(_0x53d0ce){for(var _0x40decd in _0x53d0ce){if(_0x53d0ce['hasOwnProperty'](_0x40decd)){if(_0x40decd['indexOf']('agi_')===0x0){_0x53d0ce[_0x40decd[_0xdb57('0x27')](0x4)]=_0x53d0ce[_0x40decd];delete _0x53d0ce[_0x40decd];}}}}function agiHandler(_0x1a3626){logger[_0xdb57('0x28')](_0xdb57('0x29'),JSON['stringify'](_0x1a3626,null,0x2));logger['info'](util['format'](_0xdb57('0x2a'),_0x1a3626[_0xdb57('0x1c')],_0x1a3626[_0xdb57('0x1d')],_0x1a3626[_0xdb57('0x1e')],_0x1a3626[_0xdb57('0x21')],_0x1a3626[_0xdb57('0x1f')]));_0x1a3626['on'](_0xdb57('0xc'),errorHandler);_0x1a3626['on']('close',closeHandler);_0x1a3626['on'](_0xdb57('0x2b'),timeoutHandler);_0x1a3626[_0xdb57('0x23')]=![];_0x1a3626['on'](_0xdb57('0x2c'),hangupHandler);var _0x45fbba=_[_0xdb57('0x2d')](projects,[_0xdb57('0x19'),_0x1a3626[_0xdb57('0x1c')]]);if(!_0x45fbba)return Project['handleNotFound'](_0x1a3626);if(!_0x45fbba[_0xdb57('0x2e')])return Project[_0xdb57('0x2f')](_0x1a3626);return Project['initialize'](_0x45fbba,_0x1a3626);}function main(){var _0x127512;return utilLicense[_0xdb57('0x30')]()[_0xdb57('0x25')](function(_0x485522){if(!_0x485522)return;if(_0x485522[_0xdb57('0x31')]){if(_0x485522['callysquare']&&_0x485522['callysquare']>0x0){logger['info'](util[_0xdb57('0x14')](_0xdb57('0x32'),_0x485522[_0xdb57('0x33')]));_0x127512=_0x485522['callysquare'];}else{logger[_0xdb57('0x13')](_0xdb57('0x34'));}}else{logger['info'](_0xdb57('0x35'));_0x127512=-0x1;}})['then'](function(){return Project['getAll']();})[_0xdb57('0x25')](function(_0x376bcb){projects=_0x376bcb;return;})[_0xdb57('0x26')](function(_0x32bd39){logger[_0xdb57('0xc')](_0xdb57('0x36'),_0x32bd39[_0xdb57('0xd')]);})['finally'](function(){var _0x460f49=require('./server')(config[_0xdb57('0x5')][_0xdb57('0x16')],config[_0xdb57('0x5')]['ip'],_0x127512);_0x460f49['on']('error',errorHandler);_0x460f49['on'](_0xdb57('0x37'),listeningHandler);_0x460f49['on'](_0xdb57('0x38'),connectionHandler);_0x460f49['on'](_0xdb57('0x39'),closeHandler);});}main(); \ No newline at end of file +var _0xe97d=['lodash','syncho','util','../../config/environment','../../config/logger','agi','./rpc','./events','defaults','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','port','name','[%s]\x20%s','message','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','handleUnpublished','initialize','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','[LICENSE]','./server','listening','connection'];(function(_0x4c9b37,_0x29fa6d){var _0x294d64=function(_0x493dc0){while(--_0x493dc0){_0x4c9b37['push'](_0x4c9b37['shift']());}};_0x294d64(++_0x29fa6d);}(_0xe97d,0x131));var _0xde97=function(_0x4a3d06,_0x1c720b){_0x4a3d06=_0x4a3d06-0x0;var _0x3e6a2b=_0xe97d[_0x4a3d06];return _0x3e6a2b;};'use strict';var _=require(_0xde97('0x0'));var syncho=require(_0xde97('0x1'));var util=require(_0xde97('0x2'));var config=require(_0xde97('0x3'));var logger=require(_0xde97('0x4'))(_0xde97('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xde97('0x6'));var Project=require('./project');var AGIEmitter=require(_0xde97('0x7'))['EventEmitter'];var projects=[];config[_0xde97('0x5')]=_[_0xde97('0x8')](config[_0xde97('0x5')],{'ip':_0xde97('0x9'),'port':0x11dd});AGIEmitter['on'](_0xde97('0xa'),projectUpdateHandler);function connectionHandler(_0x5bcfed){process[_0xde97('0xb')](function(){syncho(function(){try{setChannelVariables(_0x5bcfed);agiHandler(_0x5bcfed);}catch(_0x4b5f0a){logger[_0xde97('0xc')](_0x4b5f0a[_0xde97('0xd')]);}});});}function projectUpdateHandler(_0x27afc){try{var _0xf46772=_[_0xde97('0xe')](projects,['id',_0x27afc['id']]);if(_0xf46772>-0x1){if(_0x27afc[_0xde97('0xf')]===!![]){projects['splice'](_0xf46772,0x1);}else{projects[_0xf46772]=_0x27afc;}}else{projects[_0xde97('0x10')](_0x27afc);}}catch(_0x4a2959){logger['error'](_0x4a2959[_0xde97('0xd')]);}}function listeningHandler(){console['log'](_0xde97('0x11'),config[_0xde97('0x5')]['port']);logger['info'](util[_0xde97('0x12')](_0xde97('0x13'),config[_0xde97('0x5')]['ip'],config[_0xde97('0x5')][_0xde97('0x14')]));}function errorHandler(_0x1b14e1){if(_0x1b14e1&&_0x1b14e1[_0xde97('0x15')]&&_0x1b14e1['message']){logger[_0xde97('0xc')](util[_0xde97('0x12')](_0xde97('0x16'),_0x1b14e1[_0xde97('0x15')],_0x1b14e1[_0xde97('0x17')]));}else{logger['error'](util['format'](_0xde97('0x18'),_0x1b14e1[_0xde97('0xd')]));}}function closeHandler(){logger[_0xde97('0x19')](util[_0xde97('0x12')](_0xde97('0x1a'),this[_0xde97('0x1b')],this['calleridname'],this[_0xde97('0x1c')],this[_0xde97('0x1d')],this[_0xde97('0x1e')]));try{createSquareReport(this);}catch(_0x34d423){logger[_0xde97('0xc')](_0x34d423[_0xde97('0xd')]);}}function timeoutHandler(){logger[_0xde97('0x19')](util[_0xde97('0x12')](_0xde97('0x1f'),this[_0xde97('0x1b')],this[_0xde97('0x20')],this[_0xde97('0x1c')],this[_0xde97('0x1d')],this[_0xde97('0x1e')]));}function hangupHandler(){logger[_0xde97('0x19')](util['format'](_0xde97('0x21'),this[_0xde97('0x1b')],this[_0xde97('0x20')],this['callerid'],this[_0xde97('0x1d')],this[_0xde97('0x1e')]));this[_0xde97('0x22')]=!![];}function createSquareReport(_0x16bd85,_0x24f2d4){rpc[_0xde97('0x23')](_0x16bd85)[_0xde97('0x24')](function(_0x3dd12d){if(_0x24f2d4){_0x24f2d4(null,_0x3dd12d);}})[_0xde97('0x25')](function(_0x17f8ed){if(_0x24f2d4){_0x24f2d4(null,_0x17f8ed);}});}function setChannelVariables(_0x27e932){for(var _0x48b86a in _0x27e932){if(_0x27e932[_0xde97('0x26')](_0x48b86a)){if(_0x48b86a['indexOf'](_0xde97('0x27'))===0x0){_0x27e932[_0x48b86a['substring'](0x4)]=_0x27e932[_0x48b86a];delete _0x27e932[_0x48b86a];}}}}function agiHandler(_0x2f773f){logger[_0xde97('0x28')](_0xde97('0x29'),JSON[_0xde97('0x2a')](_0x2f773f,null,0x2));logger['info'](util[_0xde97('0x12')](_0xde97('0x2b'),_0x2f773f[_0xde97('0x1b')],_0x2f773f[_0xde97('0x20')],_0x2f773f['callerid'],_0x2f773f[_0xde97('0x1d')],_0x2f773f[_0xde97('0x1e')]));_0x2f773f['on'](_0xde97('0xc'),errorHandler);_0x2f773f['on'](_0xde97('0x2c'),closeHandler);_0x2f773f['on'](_0xde97('0x2d'),timeoutHandler);_0x2f773f[_0xde97('0x22')]=![];_0x2f773f['on'](_0xde97('0x2e'),hangupHandler);var _0x17583e=_['find'](projects,[_0xde97('0x15'),_0x2f773f[_0xde97('0x1b')]]);if(!_0x17583e)return Project[_0xde97('0x2f')](_0x2f773f);if(!_0x17583e[_0xde97('0x30')])return Project[_0xde97('0x31')](_0x2f773f);return Project[_0xde97('0x32')](_0x17583e,_0x2f773f);}function main(){var _0x189031;return utilLicense['getLicense']()['then'](function(_0x998414){if(!_0x998414)return;if(_0x998414[_0xde97('0x33')]){if(_0x998414[_0xde97('0x34')]&&_0x998414[_0xde97('0x34')]>0x0){logger[_0xde97('0x19')](util[_0xde97('0x12')](_0xde97('0x35'),_0x998414['callysquare']));_0x189031=_0x998414['callysquare'];}else{logger[_0xde97('0x19')](_0xde97('0x36'));}}else{logger[_0xde97('0x19')](_0xde97('0x37'));_0x189031=-0x1;}})[_0xde97('0x24')](function(){return Project[_0xde97('0x38')]();})[_0xde97('0x24')](function(_0x326931){projects=_0x326931;return;})[_0xde97('0x25')](function(_0x254c04){logger['error'](_0xde97('0x39'),_0x254c04[_0xde97('0xd')]);})['finally'](function(){var _0x38012b=require(_0xde97('0x3a'))(config[_0xde97('0x5')]['port'],config[_0xde97('0x5')]['ip'],_0x189031);_0x38012b['on'](_0xde97('0xc'),errorHandler);_0x38012b['on'](_0xde97('0x3b'),listeningHandler);_0x38012b['on'](_0xde97('0x3c'),connectionHandler);_0x38012b['on'](_0xde97('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 b0fc21c..c8cdfe0 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 _0x1d15=['result','sendMailMessage','SendMail','bluebird','jayson/promise','client','then','error','message'];(function(_0x50387a,_0x2eaaf4){var _0x5c3f4d=function(_0x1d490e){while(--_0x1d490e){_0x50387a['push'](_0x50387a['shift']());}};_0x5c3f4d(++_0x2eaaf4);}(_0x1d15,0x66));var _0x51d1=function(_0x471072,_0x27a8e9){_0x471072=_0x471072-0x0;var _0x1e8454=_0x1d15[_0x471072];return _0x1e8454;};'use strict';var BPromise=require(_0x51d1('0x0'));var jayson=require(_0x51d1('0x1'));var client=jayson[_0x51d1('0x2')]['http']({'port':0x232b});function request(_0x49ba36,_0x5cfeac){return new BPromise(function(_0x595cff,_0x47ff07){return client['request'](_0x49ba36,_0x5cfeac)[_0x51d1('0x3')](function(_0x33cd40){if(_0x33cd40[_0x51d1('0x4')]){return _0x47ff07(_0x33cd40['error'][_0x51d1('0x5')]);}else{return _0x595cff(_0x33cd40[_0x51d1('0x6')]);}})['catch'](function(_0x3c808e){return _0x47ff07(_0x3c808e);});});}exports[_0x51d1('0x7')]=function(_0x226e5c,_0x322ac5){return request(_0x51d1('0x8'),{'account':_0x226e5c,'message':_0x322ac5});}; \ No newline at end of file +var _0x2b09=['sendMailMessage','bluebird','client','http','request','then','message','catch'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x2b09,0x89));var _0x92b0=function(_0x49de1a,_0x547689){_0x49de1a=_0x49de1a-0x0;var _0x5da574=_0x2b09[_0x49de1a];return _0x5da574;};'use strict';var BPromise=require(_0x92b0('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x92b0('0x1')][_0x92b0('0x2')]({'port':0x232b});function request(_0x18c9e0,_0x531beb){return new BPromise(function(_0x50d1ec,_0x31561c){return client[_0x92b0('0x3')](_0x18c9e0,_0x531beb)[_0x92b0('0x4')](function(_0x5c0923){if(_0x5c0923['error']){return _0x31561c(_0x5c0923['error'][_0x92b0('0x5')]);}else{return _0x50d1ec(_0x5c0923['result']);}})[_0x92b0('0x6')](function(_0x2c9f62){return _0x31561c(_0x2c9f62);});});}exports[_0x92b0('0x7')]=function(_0x51eb83,_0x47ac6c){return request('SendMail',{'account':_0x51eb83,'message':_0x47ac6c});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index dc6e018..e4b9602 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 _0x2a06=['mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','uniqueid','traverseBFS','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','agicommand','response','code','evtHangup','isUndefined','toString','finally','format','arg_1','dnid','clear','result','agicommand\x20not\x20found','[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','close','Project\x20%s\x20not\x20found','continueAt','Project\x20%s\x20not\x20published','exports','xml2json','../../config/logger','agi','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','stack','hasOwnProperty','retry','omit','length','source','toJson','mxGraphModel','inspect','production','start','debug','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x388e19,_0x1340d5){var _0x239141=function(_0x1261bc){while(--_0x1261bc){_0x388e19['push'](_0x388e19['shift']());}};_0x239141(++_0x1340d5);}(_0x2a06,0x13d));var _0x62a0=function(_0x2121ae,_0x445836){_0x2121ae=_0x2121ae-0x0;var _0x5a9747=_0x2a06[_0x2121ae];return _0x5a9747;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0x62a0('0x0'));var util=require('util');var logger=require(_0x62a0('0x1'))(_0x62a0('0x2'));var rpc=require(_0x62a0('0x3'));var mailRpc=require(_0x62a0('0x4'));var Graph=require(_0x62a0('0x5'));var Vertices=require(_0x62a0('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x62a0('0x7')]()[_0x62a0('0x8')](function(_0x45aeb5){logger[_0x62a0('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x45aeb5[_0x62a0('0xa')]);return[];});}function addVertex(_0x674901,_0x46f6bc,_0x4d65c1){_0x46f6bc['agicommand']=_0x4d65c1;if(_0x46f6bc[_0x62a0('0xb')](_0x62a0('0xc'))){_0x46f6bc['maxRetry']=parseInt(_0x46f6bc[_0x62a0('0xc')],0xa);}_0x674901['addVertex'](_[_0x62a0('0xd')](_0x46f6bc,'mxCell'));}function initGraph(_0x2afc91,_0x4f3bc1){var _0x311813=new Graph();for(var _0x30f2cc in _0x2afc91){if(_0x2afc91['hasOwnProperty'](_0x30f2cc)){if(_['isArray'](_0x2afc91[_0x30f2cc])){for(var _0xacfc00=0x0;_0xacfc00<_0x2afc91[_0x30f2cc]['length'];_0xacfc00+=0x1){addVertex(_0x311813,_0x2afc91[_0x30f2cc][_0xacfc00],_0x30f2cc);}}else{addVertex(_0x311813,_0x2afc91[_0x30f2cc],_0x30f2cc);}}}for(var _0x4e2ea2=0x0;_0x4e2ea2<_0x4f3bc1[_0x62a0('0xe')];_0x4e2ea2+=0x1){if(_0x4f3bc1[_0x4e2ea2][_0x62a0('0xf')]&&_0x4f3bc1[_0x4e2ea2]['target']){_0x311813['addEdge'](_0x4f3bc1[_0x4e2ea2]['source'],_0x4f3bc1[_0x4e2ea2]['target'],_0x4f3bc1[_0x4e2ea2]['value']);}}return _0x311813;}function getRoot(_0xda7860){return parser[_0x62a0('0x10')](_0xda7860,{'object':!![]})[_0x62a0('0x11')]['root'];}function inspect(_0x25af7e){return util[_0x62a0('0x12')](_0x25af7e,{'showHidden':![],'depth':null});}function initialize(_0xce0340,_0x36db68){var _0x55a955=getRoot(_0xce0340[_0x62a0('0x13')]);if(!_0x55a955||!_0x55a955[_0x62a0('0x14')])return;var _0x47ee3b,_0x5ebf38,_0x4197c4;logger[_0x62a0('0x15')]('root',JSON[_0x62a0('0x16')](_0x55a955,null,0x2));_0x36db68[_0x62a0('0x17')]=moment()['format'](_0x62a0('0x18'));_0x47ee3b=initGraph(_[_0x62a0('0xd')](_0x55a955,'mxCell'),_0x55a955[_0x62a0('0x19')]);_0x5ebf38=new Vertices(_0x36db68,rpc,mailRpc);logger[_0x62a0('0x1a')](util['format'](_0x62a0('0x1b'),_0x36db68['arg_1'],_0x36db68[_0x62a0('0x1c')],_0x36db68[_0x62a0('0x1d')],_0x36db68['dnid'],_0x36db68[_0x62a0('0x1e')]));_0x47ee3b[_0x62a0('0x1f')](_0x55a955['start']['id'],function(_0x522160){try{_0x522160=_0x5ebf38['clear'](_0x522160);logger[_0x62a0('0x15')]('vertex',JSON[_0x62a0('0x16')](_0x522160,null,0x2));if(_0x522160['agicommand']===_0x62a0('0x20')){logger[_0x62a0('0x1a')](_0x62a0('0x21'));_0x36db68[_0x62a0('0x22')]=_0x522160['context']||_0x36db68[_0x62a0('0x22')];_0x36db68[_0x62a0('0x23')]=_0x522160['extension'];_0x36db68['priority']=_0x522160['priority']?_0x522160[_0x62a0('0x24')]-0x1:0x1;return null;}else if(_0x522160&&_0x5ebf38[_0x522160[_0x62a0('0x25')]]){_0x4197c4=_0x5ebf38[_0x522160[_0x62a0('0x25')]](_0x522160);logger[_0x62a0('0x1a')](_0x62a0('0x26'),JSON[_0x62a0('0x16')](_0x4197c4,null,0x2));if(_0x4197c4&&_0x4197c4[_0x62a0('0x27')]===AGI_CODE_SUCCESS&&_0x4197c4['result']!==AGI_RESULT_ERROR&&!_0x36db68[_0x62a0('0x28')]){logger[_0x62a0('0x15')](_0x62a0('0x26'),inspect(_0x4197c4));return _[_0x62a0('0x29')](_0x4197c4['result'])?null:_0x4197c4['result'][_0x62a0('0x2a')]();}else{logger[_0x62a0('0x9')]('response',inspect(_0x4197c4));return null;}}else{logger[_0x62a0('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0x42ceaa){logger[_0x62a0('0x9')](_0x42ceaa['stack']);return null;}});if(_0x55a955[_0x62a0('0x2b')]){logger['info'](util[_0x62a0('0x2c')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x36db68[_0x62a0('0x2d')],_0x36db68[_0x62a0('0x1c')],_0x36db68[_0x62a0('0x1d')],_0x36db68[_0x62a0('0x2e')],_0x36db68['uniqueid']));_0x47ee3b[_0x62a0('0x1f')](_0x55a955[_0x62a0('0x2b')]['id'],function(_0x2a2521){try{_0x2a2521=_0x5ebf38[_0x62a0('0x2f')](_0x2a2521);logger[_0x62a0('0x15')]('vertex',JSON[_0x62a0('0x16')](_0x2a2521,null,0x2));if(_0x2a2521&&_0x5ebf38[_0x2a2521[_0x62a0('0x25')]]){_0x4197c4=_0x5ebf38[_0x2a2521[_0x62a0('0x25')]](_0x2a2521);if(_0x4197c4){logger[_0x62a0('0x15')](_0x62a0('0x26'),inspect(_0x4197c4));return _[_0x62a0('0x29')](_0x4197c4[_0x62a0('0x30')])?null:_0x4197c4[_0x62a0('0x30')]['toString']();}else{logger['error']('response',inspect(_0x4197c4));return null;}}else{logger[_0x62a0('0x9')](_0x62a0('0x31'));return null;}}catch(_0xfb5051){logger[_0x62a0('0x9')](_0xfb5051['stack']);return null;}});}logger[_0x62a0('0x1a')](util[_0x62a0('0x2c')](_0x62a0('0x32'),_0x36db68[_0x62a0('0x2d')],_0x36db68['calleridname'],_0x36db68['callerid'],_0x36db68['dnid'],_0x36db68[_0x62a0('0x1e')]));logger[_0x62a0('0x1a')](util[_0x62a0('0x2c')](_0x62a0('0x33'),_0x36db68['context'],_0x36db68['extension'],parseInt(_0x36db68[_0x62a0('0x24')],0xa)+0x1));_0x36db68['continueAt'](_0x36db68[_0x62a0('0x22')],_0x36db68[_0x62a0('0x23')],parseInt(_0x36db68[_0x62a0('0x24')],0xa)+0x1);_0x36db68[_0x62a0('0x34')]();}function handleNotFound(_0x257619){logger[_0x62a0('0x9')](util[_0x62a0('0x2c')](_0x62a0('0x35'),_0x257619['arg_1']));_0x257619[_0x62a0('0x36')](_0x257619[_0x62a0('0x22')],_0x257619[_0x62a0('0x23')],parseInt(_0x257619[_0x62a0('0x24')],0xa)+0x1);_0x257619['close']();}function handleUnpublished(_0x32cfd2){logger[_0x62a0('0x9')](util[_0x62a0('0x2c')](_0x62a0('0x37'),_0x32cfd2[_0x62a0('0x2d')]));_0x32cfd2[_0x62a0('0x36')](_0x32cfd2[_0x62a0('0x22')],_0x32cfd2[_0x62a0('0x23')],parseInt(_0x32cfd2[_0x62a0('0x24')],0xa)+0x1);_0x32cfd2[_0x62a0('0x34')]();}module[_0x62a0('0x38')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0xa86b=['hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','length','source','addEdge','value','toJson','root','start','debug','stringify','joinAt','format','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','result','evtHangup','response','toString','error','agicommand\x20not\x20found','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20found','close','Project\x20%s\x20not\x20published','moment','xml2json','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','catch','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand'];(function(_0xf3efec,_0x4ae730){var _0x264204=function(_0x4824a1){while(--_0x4824a1){_0xf3efec['push'](_0xf3efec['shift']());}};_0x264204(++_0x4ae730);}(_0xa86b,0xe1));var _0xba86=function(_0x5b57c9,_0x590b5d){_0x5b57c9=_0x5b57c9-0x0;var _0x20ad19=_0xa86b[_0x5b57c9];return _0x20ad19;};'use strict';var _=require('lodash');var moment=require(_0xba86('0x0'));var parser=require(_0xba86('0x1'));var util=require(_0xba86('0x2'));var logger=require(_0xba86('0x3'))(_0xba86('0x4'));var rpc=require(_0xba86('0x5'));var mailRpc=require(_0xba86('0x6'));var Graph=require('./graph');var Vertices=require(_0xba86('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()[_0xba86('0x8')](function(_0x5943b2){logger['error'](_0xba86('0x9'),_0x5943b2['stack']);return[];});}function addVertex(_0x2ba1a8,_0x1d2f5e,_0x5433ae){_0x1d2f5e[_0xba86('0xa')]=_0x5433ae;if(_0x1d2f5e[_0xba86('0xb')](_0xba86('0xc'))){_0x1d2f5e[_0xba86('0xd')]=parseInt(_0x1d2f5e[_0xba86('0xc')],0xa);}_0x2ba1a8[_0xba86('0xe')](_[_0xba86('0xf')](_0x1d2f5e,_0xba86('0x10')));}function initGraph(_0x1d11ab,_0x123438){var _0x7b077=new Graph();for(var _0x15bde4 in _0x1d11ab){if(_0x1d11ab[_0xba86('0xb')](_0x15bde4)){if(_['isArray'](_0x1d11ab[_0x15bde4])){for(var _0xb3c146=0x0;_0xb3c146<_0x1d11ab[_0x15bde4]['length'];_0xb3c146+=0x1){addVertex(_0x7b077,_0x1d11ab[_0x15bde4][_0xb3c146],_0x15bde4);}}else{addVertex(_0x7b077,_0x1d11ab[_0x15bde4],_0x15bde4);}}}for(var _0x5a140e=0x0;_0x5a140e<_0x123438[_0xba86('0x11')];_0x5a140e+=0x1){if(_0x123438[_0x5a140e][_0xba86('0x12')]&&_0x123438[_0x5a140e]['target']){_0x7b077[_0xba86('0x13')](_0x123438[_0x5a140e][_0xba86('0x12')],_0x123438[_0x5a140e]['target'],_0x123438[_0x5a140e][_0xba86('0x14')]);}}return _0x7b077;}function getRoot(_0x35c73c){return parser[_0xba86('0x15')](_0x35c73c,{'object':!![]})['mxGraphModel'][_0xba86('0x16')];}function inspect(_0x3ae770){return util['inspect'](_0x3ae770,{'showHidden':![],'depth':null});}function initialize(_0x450416,_0x4fcf43){var _0x16ec3f=getRoot(_0x450416['production']);if(!_0x16ec3f||!_0x16ec3f[_0xba86('0x17')])return;var _0x3215a3,_0x1011f4,_0x388f00;logger[_0xba86('0x18')]('root',JSON[_0xba86('0x19')](_0x16ec3f,null,0x2));_0x4fcf43[_0xba86('0x1a')]=moment()[_0xba86('0x1b')]('YYYY-MM-DD\x20HH:mm:ss');_0x3215a3=initGraph(_['omit'](_0x16ec3f,'mxCell'),_0x16ec3f[_0xba86('0x10')]);_0x1011f4=new Vertices(_0x4fcf43,rpc,mailRpc);logger['info'](util['format'](_0xba86('0x1c'),_0x4fcf43[_0xba86('0x1d')],_0x4fcf43[_0xba86('0x1e')],_0x4fcf43['callerid'],_0x4fcf43[_0xba86('0x1f')],_0x4fcf43[_0xba86('0x20')]));_0x3215a3[_0xba86('0x21')](_0x16ec3f['start']['id'],function(_0x374e34){try{_0x374e34=_0x1011f4[_0xba86('0x22')](_0x374e34);logger[_0xba86('0x18')](_0xba86('0x23'),JSON[_0xba86('0x19')](_0x374e34,null,0x2));if(_0x374e34[_0xba86('0xa')]===_0xba86('0x24')){logger[_0xba86('0x25')](_0xba86('0x26'));_0x4fcf43[_0xba86('0x27')]=_0x374e34[_0xba86('0x27')]||_0x4fcf43[_0xba86('0x27')];_0x4fcf43[_0xba86('0x28')]=_0x374e34['extension'];_0x4fcf43[_0xba86('0x29')]=_0x374e34[_0xba86('0x29')]?_0x374e34[_0xba86('0x29')]-0x1:0x1;return null;}else if(_0x374e34&&_0x1011f4[_0x374e34[_0xba86('0xa')]]){_0x388f00=_0x1011f4[_0x374e34[_0xba86('0xa')]](_0x374e34);logger[_0xba86('0x25')]('response',JSON[_0xba86('0x19')](_0x388f00,null,0x2));if(_0x388f00&&_0x388f00[_0xba86('0x2a')]===AGI_CODE_SUCCESS&&_0x388f00[_0xba86('0x2b')]!==AGI_RESULT_ERROR&&!_0x4fcf43[_0xba86('0x2c')]){logger[_0xba86('0x18')](_0xba86('0x2d'),inspect(_0x388f00));return _['isUndefined'](_0x388f00['result'])?null:_0x388f00[_0xba86('0x2b')][_0xba86('0x2e')]();}else{logger[_0xba86('0x2f')](_0xba86('0x2d'),inspect(_0x388f00));return null;}}else{logger['error'](_0xba86('0x30'));return null;}}catch(_0x62bf83){logger[_0xba86('0x2f')](_0x62bf83[_0xba86('0x31')]);return null;}});if(_0x16ec3f['finally']){logger[_0xba86('0x25')](util[_0xba86('0x1b')](_0xba86('0x32'),_0x4fcf43[_0xba86('0x1d')],_0x4fcf43[_0xba86('0x1e')],_0x4fcf43['callerid'],_0x4fcf43[_0xba86('0x1f')],_0x4fcf43[_0xba86('0x20')]));_0x3215a3[_0xba86('0x21')](_0x16ec3f[_0xba86('0x33')]['id'],function(_0x5d65ec){try{_0x5d65ec=_0x1011f4[_0xba86('0x22')](_0x5d65ec);logger[_0xba86('0x18')](_0xba86('0x23'),JSON['stringify'](_0x5d65ec,null,0x2));if(_0x5d65ec&&_0x1011f4[_0x5d65ec[_0xba86('0xa')]]){_0x388f00=_0x1011f4[_0x5d65ec[_0xba86('0xa')]](_0x5d65ec);if(_0x388f00){logger[_0xba86('0x18')](_0xba86('0x2d'),inspect(_0x388f00));return _['isUndefined'](_0x388f00[_0xba86('0x2b')])?null:_0x388f00[_0xba86('0x2b')][_0xba86('0x2e')]();}else{logger[_0xba86('0x2f')]('response',inspect(_0x388f00));return null;}}else{logger[_0xba86('0x2f')](_0xba86('0x30'));return null;}}catch(_0x53c3f2){logger[_0xba86('0x2f')](_0x53c3f2[_0xba86('0x31')]);return null;}});}logger[_0xba86('0x25')](util['format'](_0xba86('0x34'),_0x4fcf43[_0xba86('0x1d')],_0x4fcf43[_0xba86('0x1e')],_0x4fcf43[_0xba86('0x35')],_0x4fcf43[_0xba86('0x1f')],_0x4fcf43[_0xba86('0x20')]));logger[_0xba86('0x25')](util[_0xba86('0x1b')](_0xba86('0x36'),_0x4fcf43[_0xba86('0x27')],_0x4fcf43[_0xba86('0x28')],parseInt(_0x4fcf43[_0xba86('0x29')],0xa)+0x1));_0x4fcf43[_0xba86('0x37')](_0x4fcf43[_0xba86('0x27')],_0x4fcf43['extension'],parseInt(_0x4fcf43['priority'],0xa)+0x1);_0x4fcf43['close']();}function handleNotFound(_0x27c869){logger['error'](util[_0xba86('0x1b')](_0xba86('0x38'),_0x27c869['arg_1']));_0x27c869[_0xba86('0x37')](_0x27c869[_0xba86('0x27')],_0x27c869[_0xba86('0x28')],parseInt(_0x27c869[_0xba86('0x29')],0xa)+0x1);_0x27c869[_0xba86('0x39')]();}function handleUnpublished(_0xffff45){logger['error'](util[_0xba86('0x1b')](_0xba86('0x3a'),_0xffff45['arg_1']));_0xffff45[_0xba86('0x37')](_0xffff45['context'],_0xffff45[_0xba86('0x28')],parseInt(_0xffff45['priority'],0xa)+0x1);_0xffff45['close']();}module['exports']={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 44024c3..0f138d1 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 _0x4a3d=['exports','util','stream','Transform','call','_localBuffer','_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','substring','length','split','indexOf','slice','trim','emit','line'];(function(_0x59d7da,_0x3a28a1){var _0x59447a=function(_0xbc961d){while(--_0xbc961d){_0x59d7da['push'](_0x59d7da['shift']());}};_0x59447a(++_0x3a28a1);}(_0x4a3d,0x79));var _0xd4a3=function(_0x501c4c,_0x3875a6){_0x501c4c=_0x501c4c-0x0;var _0x514e74=_0x4a3d[_0x501c4c];return _0x514e74;};'use strict';var util=require(_0xd4a3('0x0'));var Transform=require(_0xd4a3('0x1'))[_0xd4a3('0x2')];function AGIReply(_0x2532d2){Transform[_0xd4a3('0x3')](this,_0x2532d2);this[_0xd4a3('0x4')]='';this[_0xd4a3('0x5')]=![];}util[_0xd4a3('0x6')](AGIReply,Transform);AGIReply[_0xd4a3('0x7')][_0xd4a3('0x8')]=function(_0x37c24b,_0x8c176c,_0x52ffaf){var _0x523038='\x0a',_0x2449da=['\x0a\x0a',_0xd4a3('0x9')],_0x45baf1=-0x1,_0x5910aa=-0x1,_0x490bc1='',_0x33c34b=0x0,_0x1ad12e='',_0xd3a874='';this[_0xd4a3('0x4')]+=_0x37c24b[_0xd4a3('0xa')]();_0x1ad12e=this[_0xd4a3('0x4')];if(!this[_0xd4a3('0x5')]){_0x33c34b=0x0;while(_0x2449da[_0x33c34b]){while((_0x5910aa=_0x1ad12e['indexOf'](_0x2449da[_0x33c34b]))!=-0x1){_0x490bc1=_0x2449da[_0x33c34b];_0xd3a874=_0x1ad12e[_0xd4a3('0xb')](0x0,_0x5910aa);_0x1ad12e=_0x1ad12e[_0xd4a3('0xb')](_0x5910aa+_0x490bc1[_0xd4a3('0xc')]);var _0x213577=_0xd3a874[_0xd4a3('0xd')](_0x523038),_0x81079a=0x0,_0x1cb7f9={},_0x3e7728='',_0x57bd90='',_0x3548e4=-0x1;while(_0x213577[_0x81079a]){_0x3548e4=_0x213577[_0x81079a][_0xd4a3('0xe')](':');if(_0x3548e4!=-0x1){_0x3e7728=_0x213577[_0x81079a][_0xd4a3('0xf')](0x0,_0x3548e4)[_0xd4a3('0x10')]();_0x57bd90=_0x213577[_0x81079a][_0xd4a3('0xf')](_0x3548e4+0x1)[_0xd4a3('0x10')]();if(_0x3e7728[_0xd4a3('0xc')]>0x0){_0x1cb7f9[_0x3e7728]=_0x57bd90;}}else{}_0x81079a++;}this['emit']('headers',_0x1cb7f9);this[_0xd4a3('0x5')]=!![];}_0x33c34b++;}this[_0xd4a3('0x4')]=_0x1ad12e;}else{while((_0x45baf1=_0x1ad12e[_0xd4a3('0xe')](_0x523038))!=-0x1){_0xd3a874=_0x1ad12e[_0xd4a3('0xb')](0x0,_0x45baf1);this[_0xd4a3('0x11')](_0xd4a3('0x12'),_0xd3a874);_0x1ad12e=_0x1ad12e['substring'](_0x45baf1+_0x523038[_0xd4a3('0xc')]);}this['_localBuffer']=_0x1ad12e;}_0x52ffaf();};module[_0xd4a3('0x13')]=AGIReply; \ No newline at end of file +var _0x3a61=['prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','headers','emit','line','exports','call','_localBuffer','_inBody','inherits'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3a61,0xd4));var _0x13a6=function(_0x345209,_0x26625d){_0x345209=_0x345209-0x0;var _0x35f98c=_0x3a61[_0x345209];return _0x35f98c;};'use strict';var util=require('util');var Transform=require('stream')['Transform'];function AGIReply(_0xd6d19){Transform[_0x13a6('0x0')](this,_0xd6d19);this[_0x13a6('0x1')]='';this[_0x13a6('0x2')]=![];}util[_0x13a6('0x3')](AGIReply,Transform);AGIReply[_0x13a6('0x4')][_0x13a6('0x5')]=function(_0x3a0c39,_0x7331e2,_0x28feab){var _0x475ec4='\x0a',_0x2f6ed2=['\x0a\x0a',_0x13a6('0x6')],_0x14e075=-0x1,_0x274d05=-0x1,_0xb82e5f='',_0x5a6bb8=0x0,_0x646ae3='',_0x1e798b='';this[_0x13a6('0x1')]+=_0x3a0c39[_0x13a6('0x7')]();_0x646ae3=this['_localBuffer'];if(!this[_0x13a6('0x2')]){_0x5a6bb8=0x0;while(_0x2f6ed2[_0x5a6bb8]){while((_0x274d05=_0x646ae3[_0x13a6('0x8')](_0x2f6ed2[_0x5a6bb8]))!=-0x1){_0xb82e5f=_0x2f6ed2[_0x5a6bb8];_0x1e798b=_0x646ae3['substring'](0x0,_0x274d05);_0x646ae3=_0x646ae3[_0x13a6('0x9')](_0x274d05+_0xb82e5f[_0x13a6('0xa')]);var _0x205c0f=_0x1e798b[_0x13a6('0xb')](_0x475ec4),_0x9d01da=0x0,_0x33df5e={},_0x432b8a='',_0x48ed37='',_0xa2c257=-0x1;while(_0x205c0f[_0x9d01da]){_0xa2c257=_0x205c0f[_0x9d01da][_0x13a6('0x8')](':');if(_0xa2c257!=-0x1){_0x432b8a=_0x205c0f[_0x9d01da][_0x13a6('0xc')](0x0,_0xa2c257)['trim']();_0x48ed37=_0x205c0f[_0x9d01da][_0x13a6('0xc')](_0xa2c257+0x1)[_0x13a6('0xd')]();if(_0x432b8a['length']>0x0){_0x33df5e[_0x432b8a]=_0x48ed37;}}else{}_0x9d01da++;}this['emit'](_0x13a6('0xe'),_0x33df5e);this[_0x13a6('0x2')]=!![];}_0x5a6bb8++;}this[_0x13a6('0x1')]=_0x646ae3;}else{while((_0x14e075=_0x646ae3['indexOf'](_0x475ec4))!=-0x1){_0x1e798b=_0x646ae3[_0x13a6('0x9')](0x0,_0x14e075);this[_0x13a6('0xf')](_0x13a6('0x10'),_0x1e798b);_0x646ae3=_0x646ae3[_0x13a6('0x9')](_0x14e075+_0x475ec4[_0x13a6('0xa')]);}this['_localBuffer']=_0x646ae3;}_0x28feab();};module[_0x13a6('0x11')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 7852f39..4fac33b 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 _0x63b6=['GetSquareProjects','name','production','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','getSquareProjectById','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ListId','CreateCmContact','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','message','catch','getSquareProjects'];(function(_0x3598bb,_0x24befa){var _0x13c837=function(_0x3de578){while(--_0x3de578){_0x3598bb['push'](_0x3598bb['shift']());}};_0x13c837(++_0x24befa);}(_0x63b6,0x127));var _0x663b=function(_0x14cc8e,_0x2d41eb){_0x14cc8e=_0x14cc8e-0x0;var _0x16023c=_0x63b6[_0x14cc8e];return _0x16023c;};'use strict';var _=require(_0x663b('0x0'));var moment=require(_0x663b('0x1'));var jayson=require(_0x663b('0x2'));var client=jayson['client'][_0x663b('0x3')]({'port':0x2329});function request(_0x522472,_0x10dcf6){return new Promise(function(_0x5d9f1d,_0x93bab1){return client[_0x663b('0x4')](_0x522472,_0x10dcf6)[_0x663b('0x5')](function(_0x4c6940){if(_0x4c6940[_0x663b('0x6')]){return _0x93bab1(_0x4c6940['error'][_0x663b('0x7')]);}else{return _0x5d9f1d(_0x4c6940['result']);}})[_0x663b('0x8')](function(_0x2976ff){return _0x93bab1(_0x2976ff);});});}exports[_0x663b('0x9')]=function(){return request(_0x663b('0xa'),{'options':{'raw':![],'attributes':['id',_0x663b('0xb'),_0x663b('0xc')]}});};exports['getSquareProject']=function(_0x31106e){return request(_0x663b('0xd'),{'options':{'raw':![],'where':{'name':_0x31106e},'attributes':[_0x663b('0xc')]}});};exports[_0x663b('0xe')]=function(_0x1dd00c){return request(_0x663b('0xf'),{'options':{'raw':![],'where':{'id':_0x1dd00c},'include':[{'model':_0x663b('0x10'),'as':_0x663b('0x11'),'include':[{'model':_0x663b('0x12'),'as':_0x663b('0x12')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0x663b('0x13')]=function(_0xa5b910){return request(_0x663b('0xd'),{'options':{'where':{'id':_0xa5b910},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x14')]=function(_0x13cb09){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x13cb09},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x15')]=function(_0x4738e2){return request(_0x663b('0x16'),{'options':{'where':{'id':_0x4738e2},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x17')]=function(_0x38578f){return request(_0x663b('0x18'),{'options':{'where':{'id':_0x38578f},'attributes':[_0x663b('0x19')]}});};exports[_0x663b('0x1a')]=function(_0x26a596){return request(_0x663b('0x1b'),{'options':{'where':{'id':_0x26a596},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x1c')]=function(_0x4c8a8a){return request(_0x663b('0x1d'),{'options':{'where':{'phone':_0x4c8a8a[_0x663b('0x1e')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x79a64c){return request(_0x663b('0x1f'),{'options':{'where':{'id':_0x79a64c},'attributes':['name']}});};exports['getSoundById']=function(_0x1f7dd9){return request(_0x663b('0x20'),{'options':{'where':{'id':_0x1f7dd9},'attributes':[_0x663b('0x21')]}});};exports[_0x663b('0x22')]=function(_0x50ecbb){return request(_0x663b('0x23'),{'options':{'raw':![],'where':{'id':_0x50ecbb},'include':[{'model':_0x663b('0x24'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x521a89){return request('ShowSmsAccount',{'options':{'where':{'id':_0x521a89},'attributes':['id',_0x663b('0xb')]}});};exports[_0x663b('0x25')]=function(_0x2d1b52){return request(_0x663b('0x26'),{'body':_0x2d1b52});};exports[_0x663b('0x27')]=function(_0x43b58a){return request(_0x663b('0x28'),{'body':_0x43b58a});};exports[_0x663b('0x29')]=function(_0x3eab48){return request('CreateSquareReport',{'body':_[_0x663b('0x2a')](_0x3eab48,{'project_name':_0x3eab48[_0x663b('0x2b')],'prev_project_name':_0x3eab48['arg_2']||'','is_subproject':_0x3eab48[_0x663b('0x2c')]?!![]:![],'leaveAt':moment()['format'](_0x663b('0x2d'))})});};exports[_0x663b('0x2e')]=function(_0x27dd97){return request('CreateSquareRecording',{'body':_0x27dd97});};exports[_0x663b('0x2f')]=function(_0x10f2e0){return request(_0x663b('0x30'),{'body':_0x10f2e0});};exports[_0x663b('0x31')]=function(_0x5a1580){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x5a1580['phone'],'ListId':_0x5a1580[_0x663b('0x32')]}}})[_0x663b('0x5')](function(_0x5ef7ae){if(_0x5ef7ae){return _0x5ef7ae;}return request(_0x663b('0x33'),{'body':_0x5a1580});});};exports['getPauseById']=function(_0x5134c8){return request(_0x663b('0x34'),{'options':{'where':{'id':_0x5134c8},'attributes':[_0x663b('0xb')]}});};exports[_0x663b('0x35')]=function(_0x588fd1,_0x4a165a){return request(_0x663b('0x36'),{'body':{'interface':_0x4a165a},'options':{'where':_0x588fd1}});};exports[_0x663b('0x37')]=function(_0x2e4c3c,_0x38aeb3,_0x429f56){return request(_0x663b('0x38'),{'body':{'type':_0x38aeb3,'uniqueid':_0x429f56},'options':{'where':_0x2e4c3c}});};exports[_0x663b('0x39')]=function(_0x40cb7f){return request(_0x663b('0x3a'),{'body':{},'options':{'where':_0x40cb7f}});};exports[_0x663b('0x3b')]=function(_0x6e7795){return request(_0x663b('0x3c'),{'body':{},'options':{'where':_0x6e7795}});}; \ No newline at end of file +var _0x5d55=['ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','ShowUser','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','CreateSquareReport','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','CreateCmContact','getPauseById','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','moment','client','http','then','error','message','result','catch','getSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById'];(function(_0xbe200f,_0x4b50eb){var _0x192597=function(_0x106cfd){while(--_0x106cfd){_0xbe200f['push'](_0xbe200f['shift']());}};_0x192597(++_0x4b50eb);}(_0x5d55,0x1a4));var _0x55d5=function(_0x59e51e,_0x5647c8){_0x59e51e=_0x59e51e-0x0;var _0x14d2bd=_0x5d55[_0x59e51e];return _0x14d2bd;};'use strict';var _=require('lodash');var moment=require(_0x55d5('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x55d5('0x1')][_0x55d5('0x2')]({'port':0x2329});function request(_0x47de4d,_0x46c617){return new Promise(function(_0x12beec,_0x3bca0b){return client['request'](_0x47de4d,_0x46c617)[_0x55d5('0x3')](function(_0x41adba){if(_0x41adba[_0x55d5('0x4')]){return _0x3bca0b(_0x41adba[_0x55d5('0x4')][_0x55d5('0x5')]);}else{return _0x12beec(_0x41adba[_0x55d5('0x6')]);}})[_0x55d5('0x7')](function(_0x3937d3){return _0x3bca0b(_0x3937d3);});});}exports[_0x55d5('0x8')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id',_0x55d5('0x9'),_0x55d5('0xa')]}});};exports[_0x55d5('0xb')]=function(_0x64f70a){return request(_0x55d5('0xc'),{'options':{'raw':![],'where':{'name':_0x64f70a},'attributes':['production']}});};exports[_0x55d5('0xd')]=function(_0x5d97d3){return request(_0x55d5('0xe'),{'options':{'raw':![],'where':{'id':_0x5d97d3},'include':[{'model':_0x55d5('0xf'),'as':_0x55d5('0x10'),'include':[{'model':_0x55d5('0x11'),'as':_0x55d5('0x11')}]}],'attributes':['id','name',_0x55d5('0x12')],'smtp':!![]}});};exports[_0x55d5('0x13')]=function(_0x300cc9){return request('ShowSquareProject',{'options':{'where':{'id':_0x300cc9},'attributes':[_0x55d5('0x9')]}});};exports['getVoiceQueueById']=function(_0x6eca0e){return request(_0x55d5('0x14'),{'options':{'where':{'id':_0x6eca0e},'attributes':[_0x55d5('0x9')]}});};exports[_0x55d5('0x15')]=function(_0x529b52){return request(_0x55d5('0x16'),{'options':{'where':{'id':_0x529b52},'attributes':[_0x55d5('0x9')]}});};exports[_0x55d5('0x17')]=function(_0x4b4502){return request(_0x55d5('0x18'),{'options':{'where':{'id':_0x4b4502},'attributes':['dsn']}});};exports[_0x55d5('0x19')]=function(_0x53e3de){return request(_0x55d5('0x1a'),{'options':{'where':{'id':_0x53e3de},'attributes':[_0x55d5('0x9')]}});};exports['getContactByPhone']=function(_0x1ca60c){return request(_0x55d5('0x1b'),{'options':{'where':{'phone':_0x1ca60c[_0x55d5('0x1c')]},'attributes':['id']}});};exports[_0x55d5('0x1d')]=function(_0x50f572){return request(_0x55d5('0x1e'),{'options':{'where':{'id':_0x50f572},'attributes':[_0x55d5('0x9')]}});};exports[_0x55d5('0x1f')]=function(_0x4345a3){return request(_0x55d5('0x20'),{'options':{'where':{'id':_0x4345a3},'attributes':[_0x55d5('0x21')]}});};exports['getIntervalById']=function(_0x404405){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x404405},'include':[{'model':_0x55d5('0x22'),'as':_0x55d5('0x23')}]}});};exports[_0x55d5('0x24')]=function(_0x8dc90c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x8dc90c},'attributes':['id',_0x55d5('0x9')]}});};exports[_0x55d5('0x25')]=function(_0xe6da61){return request(_0x55d5('0x26'),{'body':_0xe6da61});};exports['createSquareDetailsReport']=function(_0x21b1d8){return request('CreateSquareDetailsReport',{'body':_0x21b1d8});};exports['createSquareReport']=function(_0x40959b){return request(_0x55d5('0x27'),{'body':_['merge'](_0x40959b,{'project_name':_0x40959b['arg_1'],'prev_project_name':_0x40959b[_0x55d5('0x28')]||'','is_subproject':_0x40959b[_0x55d5('0x28')]?!![]:![],'leaveAt':moment()[_0x55d5('0x29')](_0x55d5('0x2a'))})});};exports[_0x55d5('0x2b')]=function(_0x290a83){return request(_0x55d5('0x2c'),{'body':_0x290a83});};exports[_0x55d5('0x2d')]=function(_0x1e0e3f){return request('CreateSquareMessage',{'body':_0x1e0e3f});};exports[_0x55d5('0x2e')]=function(_0x1dc8db){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x1dc8db[_0x55d5('0x1c')],'ListId':_0x1dc8db['ListId']}}})[_0x55d5('0x3')](function(_0x2b2806){if(_0x2b2806){return _0x2b2806;}return request(_0x55d5('0x2f'),{'body':_0x1dc8db});});};exports[_0x55d5('0x30')]=function(_0xdfd0ac){return request('ShowPause',{'options':{'where':{'id':_0xdfd0ac},'attributes':[_0x55d5('0x9')]}});};exports['agentLogin']=function(_0x5cd89f,_0x797306){return request(_0x55d5('0x31'),{'body':{'interface':_0x797306},'options':{'where':_0x5cd89f}});};exports[_0x55d5('0x32')]=function(_0x3c7539,_0x31e773,_0x1bc10a){return request(_0x55d5('0x33'),{'body':{'type':_0x31e773,'uniqueid':_0x1bc10a},'options':{'where':_0x3c7539}});};exports[_0x55d5('0x34')]=function(_0x4a41c9){return request(_0x55d5('0x35'),{'body':{},'options':{'where':_0x4a41c9}});};exports['agentLogout']=function(_0x474e98){return request(_0x55d5('0x36'),{'body':{},'options':{'where':_0x474e98}});}; \ 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 5207fc2..ef4ad1a 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 _0x095b=['./polly','exports'];(function(_0xf3df17,_0x986f37){var _0x37766d=function(_0x5a2961){while(--_0x5a2961){_0xf3df17['push'](_0xf3df17['shift']());}};_0x37766d(++_0x986f37);}(_0x095b,0x6e));var _0xb095=function(_0x39d31e,_0x4a822d){_0x39d31e=_0x39d31e-0x0;var _0x467a2b=_0x095b[_0x39d31e];return _0x467a2b;};var polly=require(_0xb095('0x0'));var lex=require('./lex');module[_0xb095('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf417=['exports','./lex'];(function(_0xc37dba,_0x374c5e){var _0x1fb90f=function(_0x5eec64){while(--_0x5eec64){_0xc37dba['push'](_0xc37dba['shift']());}};_0x1fb90f(++_0x374c5e);}(_0xf417,0x8f));var _0x7f41=function(_0x340e24,_0xde71e){_0x340e24=_0x340e24-0x0;var _0x1808a=_0xf417[_0x340e24];return _0x1808a;};var polly=require('./polly');var lex=require(_0x7f41('0x0'));module[_0x7f41('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 a9ec881..ddaddab 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e){return lex(_0x2c1d27,_0x4c4c00,_0x4b5765,_0x29e4c8,_0x110824,_0x394a1e);}; \ No newline at end of file +var _0x96cc=['./lib/api'];(function(_0x9b7030,_0x2d3887){var _0x543ef1=function(_0x293421){while(--_0x293421){_0x9b7030['push'](_0x9b7030['shift']());}};_0x543ef1(++_0x2d3887);}(_0x96cc,0x16c));var _0xc96c=function(_0x450f20,_0x159bb3){_0x450f20=_0x450f20-0x0;var _0x15bd66=_0x96cc[_0x450f20];return _0x15bd66;};'use strict';var lex=require(_0xc96c('0x0'));module['exports']=function(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701){return lex(_0x15025f,_0x5f11f2,_0x30bf8a,_0x3e7a95,_0x107043,_0x421701);}; \ 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 183e9a7..2a5c3f0 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(_0x29fa83,_0x92e849){var _0x2bd96b=function(_0x1899d2){while(--_0x1899d2){_0x29fa83['push'](_0x29fa83['shift']());}};_0x2bd96b(++_0x92e849);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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(_0x59325b,_0x31c1e3){var _0xd63c17=function(_0x239607){while(--_0x239607){_0x59325b['push'](_0x59325b['shift']());}};_0xd63c17(++_0x31c1e3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 c79453f..933d493 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 _0x6b79=['./lib/api'];(function(_0x264329,_0x3fc8a2){var _0x37e3dc=function(_0x1c518c){while(--_0x1c518c){_0x264329['push'](_0x264329['shift']());}};_0x37e3dc(++_0x3fc8a2);}(_0x6b79,0x19c));var _0x96b7=function(_0x1ea0e4,_0x303610){_0x1ea0e4=_0x1ea0e4-0x0;var _0x46bb85=_0x6b79[_0x1ea0e4];return _0x46bb85;};'use strict';var polly=require(_0x96b7('0x0'));module['exports']=function(_0xcf3ef,_0x27a95a,_0x568cde,_0x4bb6b9,_0x917bf3,_0x333756,_0x5143d5){return polly(_0xcf3ef,_0x27a95a,_0x568cde,_0x4bb6b9,_0x917bf3,_0x333756,_0x5143d5);}; \ No newline at end of file +var _0x5680=['./lib/api','exports'];(function(_0x513e13,_0x9e9904){var _0x1412f6=function(_0xbf900e){while(--_0xbf900e){_0x513e13['push'](_0x513e13['shift']());}};_0x1412f6(++_0x9e9904);}(_0x5680,0x110));var _0x0568=function(_0x3ad885,_0x52abac){_0x3ad885=_0x3ad885-0x0;var _0x3dc0a7=_0x5680[_0x3ad885];return _0x3dc0a7;};'use strict';var polly=require(_0x0568('0x0'));module[_0x0568('0x1')]=function(_0x3ec003,_0x46bbb0,_0x5d147c,_0x95bf89,_0x127bef,_0xd373f5,_0x77b740){return polly(_0x3ec003,_0x46bbb0,_0x5d147c,_0x95bf89,_0x127bef,_0xd373f5,_0x77b740);}; \ 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 e1b0ce4..90f03b6 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 _0x1a63=['bluebird','randomstring','aws-sdk','synthesizeSpeech','AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3'];(function(_0x250514,_0x389eda){var _0x59c25b=function(_0x3ad38b){while(--_0x3ad38b){_0x250514['push'](_0x250514['shift']());}};_0x59c25b(++_0x389eda);}(_0x1a63,0xdc));var _0x31a6=function(_0x3d1d8e,_0x533b1c){_0x3d1d8e=_0x3d1d8e-0x0;var _0x175671=_0x1a63[_0x3d1d8e];return _0x175671;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x31a6('0x0'));var rs=require(_0x31a6('0x1'));var AWS=require(_0x31a6('0x2'));function pollyResult(_0x117815,_0x4b74e9,_0xdeba9d){return new BPromise(function(_0x1b3414,_0x234ccd){_0x117815[_0x31a6('0x3')](_0x4b74e9,function(_0x5cde39,_0x41207c){if(_0x5cde39){_0x234ccd(_0x5cde39);}else if(_0x41207c){if(_0x41207c[_0x31a6('0x4')]instanceof Buffer){fs[_0x31a6('0x5')](_0xdeba9d,_0x41207c[_0x31a6('0x4')],function(_0x3b9e01){if(_0x3b9e01){_0x234ccd(_0x3b9e01);}else{_0x1b3414();}});}else{_0x234ccd(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x234ccd(new Error(_0x31a6('0x6')));}});});}module[_0x31a6('0x7')]=function(_0xa6a852,_0x4fb076,_0x55fa37,_0x37c175,_0x17667a,_0x144290,_0x5abea9){var _0x2e8afc=new AWS[(_0x31a6('0x8'))]({'accessKeyId':_0xa6a852,'secretAccessKey':_0x4fb076,'region':_0x55fa37});var _0x574c5f={'Text':_0x17667a,'TextType':_0x144290||_0x31a6('0x9'),'OutputFormat':_0x31a6('0xa'),'VoiceId':_0x37c175};return pollyResult(_0x2e8afc,_0x574c5f,_0x5abea9);}; \ No newline at end of file +var _0xe0f4=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x4f52b,_0x350118){var _0x54bbad=function(_0x4eff13){while(--_0x4eff13){_0x4f52b['push'](_0x4f52b['shift']());}};_0x54bbad(++_0x350118);}(_0xe0f4,0x18d));var _0x4e0f=function(_0x434295,_0x19cda5){_0x434295=_0x434295-0x0;var _0x251e5a=_0xe0f4[_0x434295];return _0x251e5a;};'use strict';var fs=require('fs');var path=require(_0x4e0f('0x0'));var BPromise=require(_0x4e0f('0x1'));var rs=require(_0x4e0f('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x138199,_0x52c0e,_0x4ac618){return new BPromise(function(_0x1505a9,_0x27849a){_0x138199[_0x4e0f('0x3')](_0x52c0e,function(_0x5324ef,_0x5cbdf8){if(_0x5324ef){_0x27849a(_0x5324ef);}else if(_0x5cbdf8){if(_0x5cbdf8[_0x4e0f('0x4')]instanceof Buffer){fs[_0x4e0f('0x5')](_0x4ac618,_0x5cbdf8[_0x4e0f('0x4')],function(_0x42440a){if(_0x42440a){_0x27849a(_0x42440a);}else{_0x1505a9();}});}else{_0x27849a(new Error(_0x4e0f('0x6')));}}else{_0x27849a(new Error(_0x4e0f('0x7')));}});});}module[_0x4e0f('0x8')]=function(_0x27d567,_0x46b2d0,_0x501fc4,_0x18dd2b,_0x5ae3ab,_0x1912ae,_0x146690){var _0x458fa6=new AWS['Polly']({'accessKeyId':_0x27d567,'secretAccessKey':_0x46b2d0,'region':_0x501fc4});var _0xbcf8f8={'Text':_0x5ae3ab,'TextType':_0x1912ae||_0x4e0f('0x9'),'OutputFormat':_0x4e0f('0xa'),'VoiceId':_0x18dd2b};return pollyResult(_0x458fa6,_0xbcf8f8,_0x146690);}; \ 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 72dbf7a..d107714 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 _0xcc69=['exports','./lib/api'];(function(_0x314329,_0x1f7d08){var _0x370e08=function(_0x1184f7){while(--_0x1184f7){_0x314329['push'](_0x314329['shift']());}};_0x370e08(++_0x1f7d08);}(_0xcc69,0xc5));var _0x9cc6=function(_0x167295,_0x555a81){_0x167295=_0x167295-0x0;var _0x400be6=_0xcc69[_0x167295];return _0x400be6;};'use strict';var asr=require(_0x9cc6('0x0'));module[_0x9cc6('0x1')]=function(_0x1de0c8,_0xe03ff2,_0x2a4b5d,_0x242d31){return asr(_0x1de0c8,_0xe03ff2,_0x2a4b5d);}; \ No newline at end of file +var _0x0dc2=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0dc2,0xcf));var _0x20dc=function(_0x7d0525,_0x327525){_0x7d0525=_0x7d0525-0x0;var _0x20bf65=_0x0dc2[_0x7d0525];return _0x20bf65;};'use strict';var asr=require('./lib/api');module[_0x20dc('0x0')]=function(_0x2367c1,_0x4d35ce,_0x50e041,_0x234d15){return asr(_0x2367c1,_0x4d35ce,_0x50e041);}; \ 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 e8307d8..3edad9f 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 _0xe14d=['bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','LINEAR16','8000','url'];(function(_0x59ca6f,_0x355233){var _0x834f04=function(_0x31d0f0){while(--_0x31d0f0){_0x59ca6f['push'](_0x59ca6f['shift']());}};_0x834f04(++_0x355233);}(_0xe14d,0x1ee));var _0xde14=function(_0x2b7764,_0x2606f1){_0x2b7764=_0x2b7764-0x0;var _0x848dcb=_0xe14d[_0x2b7764];return _0x848dcb;};'use strict';var url=require(_0xde14('0x0'));var BPromise=require(_0xde14('0x1'));var fs=require('fs');var host=_0xde14('0x2');module[_0xde14('0x3')]=function(_0x48b392,_0x1c5b4,_0x28965b){return new BPromise(function(_0x4b20e2,_0x1c3e94){var _0x13c24e;if(typeof _0x48b392!==_0xde14('0x4')||_0x48b392[_0xde14('0x5')]===0x0){return _0x1c3e94(_0xde14('0x6'));}if(typeof _0x1c5b4!==_0xde14('0x4')||_0x1c5b4['length']===0x0){return _0x1c3e94('key\x20should\x20be\x20a\x20string');}if(typeof _0x28965b!==_0xde14('0x7')&&(typeof _0x28965b!==_0xde14('0x4')||_0x28965b[_0xde14('0x5')]===0x0)){return _0x1c3e94(_0xde14('0x8'));}try{_0x13c24e=fs[_0xde14('0x9')](_0x48b392)[_0xde14('0xa')](_0xde14('0xb'));}catch(_0x1ce0a2){return _0x1c3e94(_0x1ce0a2);}return _0x4b20e2({'method':'POST','uri':host+_0xde14('0xc')+_0x1c5b4,'body':{'config':{'encoding':_0xde14('0xd'),'sampleRateHertz':_0xde14('0xe'),'languageCode':_0x28965b},'audio':{'content':_0x13c24e}},'json':!![]});});}; \ No newline at end of file +var _0x5fc7=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key=','LINEAR16'];(function(_0xe691cd,_0x285418){var _0x4f50be=function(_0x3f508c){while(--_0x3f508c){_0xe691cd['push'](_0xe691cd['shift']());}};_0x4f50be(++_0x285418);}(_0x5fc7,0x1e1));var _0x75fc=function(_0x3e5bc8,_0x457d89){_0x3e5bc8=_0x3e5bc8-0x0;var _0xfd84bc=_0x5fc7[_0x3e5bc8];return _0xfd84bc;};'use strict';var url=require(_0x75fc('0x0'));var BPromise=require(_0x75fc('0x1'));var fs=require('fs');var host=_0x75fc('0x2');module[_0x75fc('0x3')]=function(_0x196e85,_0xca767f,_0x2e89f5){return new BPromise(function(_0x34103c,_0x756c32){var _0x51e8b4;if(typeof _0x196e85!==_0x75fc('0x4')||_0x196e85[_0x75fc('0x5')]===0x0){return _0x756c32('filepath\x20should\x20be\x20a\x20string');}if(typeof _0xca767f!==_0x75fc('0x4')||_0xca767f[_0x75fc('0x5')]===0x0){return _0x756c32(_0x75fc('0x6'));}if(typeof _0x2e89f5!==_0x75fc('0x7')&&(typeof _0x2e89f5!==_0x75fc('0x4')||_0x2e89f5[_0x75fc('0x5')]===0x0)){return _0x756c32(_0x75fc('0x8'));}try{_0x51e8b4=fs[_0x75fc('0x9')](_0x196e85)[_0x75fc('0xa')](_0x75fc('0xb'));}catch(_0x4d2810){return _0x756c32(_0x4d2810);}return _0x34103c({'method':_0x75fc('0xc'),'uri':host+_0x75fc('0xd')+_0xca767f,'body':{'config':{'encoding':_0x75fc('0xe'),'sampleRateHertz':_0x75fc('0xf'),'languageCode':_0x2e89f5},'audio':{'content':_0x51e8b4}},'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 93a022d..b3ae684 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 _0xb9df=['./asr','exports'];(function(_0x8c096f,_0x3aa782){var _0x499fde=function(_0x127524){while(--_0x127524){_0x8c096f['push'](_0x8c096f['shift']());}};_0x499fde(++_0x3aa782);}(_0xb9df,0x78));var _0xfb9d=function(_0x1f49da,_0x58f6bc){_0x1f49da=_0x1f49da-0x0;var _0x22521f=_0xb9df[_0x1f49da];return _0x22521f;};var asr=require(_0xfb9d('0x0'));module[_0xfb9d('0x1')]={'asr':asr}; \ No newline at end of file +var _0xadf2=['./asr','exports'];(function(_0x494bc1,_0x2ee225){var _0x428faa=function(_0x45a45d){while(--_0x45a45d){_0x494bc1['push'](_0x494bc1['shift']());}};_0x428faa(++_0x2ee225);}(_0xadf2,0xa6));var _0x2adf=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xadf2[_0x4ff09b];return _0x3f5c2e;};var asr=require(_0x2adf('0x0'));module[_0x2adf('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 522e96c..9acc469 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 _0x42ad=['chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','text:synthesize','POST','resolve','generate','.mp3','from','audioContent','tmp','then','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','jQ1olc','stringify','generic','slice','parse\x20response\x20failed:\x0a','length','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','textRequest','result','action','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','awsLex','lex','ispeechTTS','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','sestekNDA','text','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','https','md5','path','request-promise','randomstring','sox','google-tts-api','url','parse','util','./aws','./tilde','../../../config/logger','agi','protocol','https:','host','WHAT_EVER','get','statusCode','error','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','start','.wav','writeFileSync','base64'];(function(_0x68abb4,_0x2f5e53){var _0x214369=function(_0x159a2f){while(--_0x159a2f){_0x68abb4['push'](_0x68abb4['shift']());}};_0x214369(++_0x2f5e53);}(_0x42ad,0x171));var _0xd42a=function(_0x5af717,_0x384580){_0x5af717=_0x5af717-0x0;var _0x4640db=_0x42ad[_0x5af717];return _0x4640db;};'use strict';var apiai=require(_0xd42a('0x0'));var BPromise=require(_0xd42a('0x1'));var dialogflow=require(_0xd42a('0x2'));var fs=require('fs');var http=require(_0xd42a('0x3'));var https=require(_0xd42a('0x4'));var md5=require(_0xd42a('0x5'));var path=require(_0xd42a('0x6'));var querystring=require('querystring');var rp=require(_0xd42a('0x7'));var rs=require(_0xd42a('0x8'));var sox=require(_0xd42a('0x9'));var tts=require(_0xd42a('0xa'));var urlParse=require(_0xd42a('0xb'))[_0xd42a('0xc')];var util=require(_0xd42a('0xd'));var aws=require(_0xd42a('0xe'));var google=require('./google');var sestek=require('./sestek');var tilde=require(_0xd42a('0xf'));var logger=require(_0xd42a('0x10'))(_0xd42a('0x11'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x6ba5e9,_0x4b6d09){return new BPromise(function(_0x2aa1e2,_0x2214bf){var _0x1a33db=urlParse(_0x6ba5e9);var _0x502d2f=_0x1a33db[_0xd42a('0x12')]===_0xd42a('0x13')?https:http;var _0x23b226={'host':_0x1a33db[_0xd42a('0x14')],'path':_0x1a33db[_0xd42a('0x6')],'headers':{'user-agent':_0xd42a('0x15')}};_0x502d2f[_0xd42a('0x16')](_0x23b226,function(_0x3c5cf2){if(_0x3c5cf2[_0xd42a('0x17')]!==0xc8){logger[_0xd42a('0x18')](_0xd42a('0x19')+_0x6ba5e9+'\x20failed,\x20status\x20code\x20=\x20'+_0x3c5cf2[_0xd42a('0x17')]+'\x20('+_0x3c5cf2[_0xd42a('0x1a')]+')');_0x2214bf(new Error(_0xd42a('0x19')+_0x6ba5e9+_0xd42a('0x1b')+_0x3c5cf2[_0xd42a('0x17')]+'\x20('+_0x3c5cf2[_0xd42a('0x1a')]+')'));return;}var _0x1b65f8=fs[_0xd42a('0x1c')](_0x4b6d09);_0x1b65f8['on'](_0xd42a('0x1d'),function(){logger[_0xd42a('0x1e')](_0xd42a('0x1f'));_0x1b65f8['close'](_0x2aa1e2);});_0x1b65f8['on']('error',function(_0x1ccca7){fs[_0xd42a('0x20')](_0x4b6d09);logger[_0xd42a('0x18')](_0xd42a('0x21'),_0x1ccca7);_0x2214bf(_0x1ccca7);});_0x3c5cf2[_0xd42a('0x22')](_0x1b65f8);})['on']('error',function(_0x1203ee){logger[_0xd42a('0x18')](_0x1203ee);_0x2214bf(_0x1203ee);})[_0xd42a('0x23')]();});}function uploadFile(_0xb6c6eb){return new BPromise(function(_0x2756c6,_0x2e4a7a){var _0x125e1a=urlParse(_0xb6c6eb);var _0x1acedf=_0x125e1a[_0xd42a('0x12')]===_0xd42a('0x13')?https:http;var _0x254850={'host':_0x125e1a[_0xd42a('0x14')],'path':_0x125e1a[_0xd42a('0x6')],'headers':{'user-agent':_0xd42a('0x15')}};_0x1acedf[_0xd42a('0x16')](_0x254850,function(_0x463e73){if(_0x463e73[_0xd42a('0x17')]!==0xc8){_0x2e4a7a(new Error(_0xd42a('0x19')+_0xb6c6eb+'\x20failed,\x20status\x20code\x20=\x20'+_0x463e73[_0xd42a('0x17')]+'\x20('+_0x463e73['statusMessage']+')'));return;}var _0x12160a='';_0x463e73['on'](_0xd42a('0x24'),function(_0x1e4f11){_0x12160a+=_0x1e4f11;});_0x463e73['on'](_0xd42a('0x23'),function(){_0x2756c6(_0x12160a);});})['on'](_0xd42a('0x18'),function(_0x14fb95){_0x2e4a7a(_0x14fb95);})[_0xd42a('0x23')]();});}function convertFile(_0x2d0034,_0x24659c){return new BPromise(function(_0xcdc9bb,_0x15d88a){var _0x3b5028=sox[_0xd42a('0x25')](_0x2d0034,_0x24659c,{'sampleRate':0x1f40,'format':_0xd42a('0x26'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3b5028['on'](_0xd42a('0x18'),function(_0x3a099f){logger[_0xd42a('0x18')](_0xd42a('0x27'),_0x3a099f);_0x15d88a(_0x3a099f);});_0x3b5028['on'](_0xd42a('0x23'),function(){logger[_0xd42a('0x1e')](_0xd42a('0x28'));_0xcdc9bb();});_0x3b5028[_0xd42a('0x29')]();});}function base64Decode(_0x1bbaa9,_0x1749b4){var _0x167a0a=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+_0xd42a('0x2a'));fs[_0xd42a('0x2b')](_0x167a0a,_0x1bbaa9,_0xd42a('0x2c'));return convertFile(_0x167a0a,_0x1749b4)['then'](function(){try{fs[_0xd42a('0x20')](_0x167a0a);fs[_0xd42a('0x2d')](_0x1749b4,_0xd42a('0x2e'));}catch(_0x206d8d){logger[_0xd42a('0x18')](_0x206d8d);}return _0x1749b4[_0xd42a('0x2f')]('.')[0x0];});}function base64Encode(_0x1030d5){var _0x4b2595=fs[_0xd42a('0x30')](_0x1030d5);return new Buffer(_0x4b2595)[_0xd42a('0x31')](_0xd42a('0x2c'));}exports['googleCloudTTS']=function(_0x1ad877,_0x3fdf47,_0x2b9aa9,_0x22abb3,_0x259164,_0x268175){var _0x41caab,_0x330ae8;var _0x19815c=_0xd42a('0x32');var _0x159842=_0xd42a('0x33')+_0x1ad877;var _0x207ff4={};if(_0x3fdf47===_0xd42a('0x34')){_0x207ff4[_0xd42a('0x35')]={'ssml':_0x2b9aa9};}else{_0x207ff4[_0xd42a('0x35')]={'text':_0x2b9aa9};};_0x207ff4['voice']={'languageCode':_0x22abb3,'ssmlGender':_0x259164};_0x207ff4[_0xd42a('0x36')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x47eb93={'url':_0x19815c+_0xd42a('0x37')+_0x159842,'method':_0xd42a('0x38'),'json':!![],'body':_0x207ff4};return rp(_0x47eb93)['then'](function(_0x8fc1b2){return new BPromise(function(_0x4c1b5f,_0xeebee){_0x41caab=path[_0xd42a('0x39')](__dirname,'tmp',rs[_0xd42a('0x3a')](0x4)+_0xd42a('0x3b'));var _0xcbade5=Buffer[_0xd42a('0x3c')](_0x8fc1b2[_0xd42a('0x3d')],_0xd42a('0x2c'));return fs['writeFile'](_0x41caab,_0xcbade5,function(_0x45b00b){_0xeebee(_0x45b00b);},function(_0x4887ae){fs[_0xd42a('0x2d')](_0x41caab,_0xd42a('0x2e'));_0x4c1b5f(_0x4887ae);});});})['then'](function(_0x233590){_0x330ae8=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs['generate'](0x4)+_0xd42a('0x2a'));return convertFile(_0x41caab,_0x330ae8);})[_0xd42a('0x3f')](function(){try{fs[_0xd42a('0x20')](_0x41caab);fs[_0xd42a('0x2d')](_0x330ae8,'777');}catch(_0x3c3e96){logger[_0xd42a('0x18')](_0x3c3e96);}logger[_0xd42a('0x1e')](_0xd42a('0x40'),_0x330ae8['split']('.')[0x0]);return _0x330ae8[_0xd42a('0x2f')]('.')[0x0];});};exports['googleTTS']=function(_0x589fbe,_0x55db86){var _0x524fac=_0xd42a('0x41');var _0x1907f2,_0x3894d5;var _0x1ae768;var _0x591246={'encoding':_0xd42a('0x42'),'method':'POST','timeout':0x2710,'url':_0x524fac,'headers':{'Content-Type':_0xd42a('0x43')},'body':'f.req='+encodeURIComponent(JSON['stringify']([[[_0xd42a('0x44'),JSON[_0xd42a('0x45')]([_0x589fbe,_0x55db86||'en',![],'null']),null,_0xd42a('0x46')]]]))};return rp(_0x591246)[_0xd42a('0x3f')](function(_0x3e5cac){try{_0x1ae768=eval(_0x3e5cac[_0xd42a('0x47')](0x5))[0x0][0x2];}catch(_0x518d09){throw new Error(_0xd42a('0x48')+_0x3e5cac[_0xd42a('0x24')]);}if(!_0x1ae768){if(_0x589fbe[_0xd42a('0x49')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xd42a('0x4a')+_0x55db86+_0xd42a('0x4b'));}}try{_0x1ae768=eval(_0x1ae768)[0x0];}catch(_0x1b8001){throw new Error(_0xd42a('0x48')+res[_0xd42a('0x24')]);}const _0x5e905d=_0x1ae768;_0x1907f2=path[_0xd42a('0x39')](__dirname,'tmp',rs[_0xd42a('0x3a')](0x4)+_0xd42a('0x3b'));fs['writeFileSync'](_0x1907f2,_0x1ae768,{'encoding':'base64'});_0x3894d5=path[_0xd42a('0x39')](__dirname,'tmp',rs[_0xd42a('0x3a')](0x4)+'.wav');return convertFile(_0x1907f2,_0x3894d5);})[_0xd42a('0x3f')](function(){try{fs[_0xd42a('0x20')](_0x1907f2);fs[_0xd42a('0x2d')](_0x3894d5,_0xd42a('0x2e'));}catch(_0x47d71b){logger['error'](_0x47d71b);}logger[_0xd42a('0x1e')](_0xd42a('0x4c'),_0x3894d5['split']('.')[0x0]);return _0x3894d5[_0xd42a('0x2f')]('.')[0x0];});};exports[_0xd42a('0x4d')]=function(_0x386f7e,_0x472a77,_0x1a30e5){return google[_0xd42a('0x4e')](_0x386f7e,_0x472a77,_0x1a30e5)[_0xd42a('0x3f')](function(_0x322930){logger[_0xd42a('0x1e')](_0x322930[_0xd42a('0x4f')]);return rp(_0x322930);})[_0xd42a('0x3f')](function(_0x5f1f90){var _0x386a7f='';var _0x47770d=0x0;try{fs[_0xd42a('0x20')](_0x386f7e);}catch(_0x1d9d05){logger[_0xd42a('0x18')](_0x1d9d05);}if(_0x5f1f90&&_0x5f1f90['results']){_0x386a7f=_0x5f1f90[_0xd42a('0x50')][_0xd42a('0x51')](function(_0x2a12b4){return _0x2a12b4&&_0x2a12b4[_0xd42a('0x52')][0x0]&&_0x2a12b4['alternatives'][0x0][_0xd42a('0x53')]?_0x2a12b4['alternatives'][0x0][_0xd42a('0x53')]:'';})[_0xd42a('0x54')]('\x0a');_0x47770d=_0x5f1f90[_0xd42a('0x50')][_0xd42a('0x51')](function(_0x34fc08){return _0x34fc08&&_0x34fc08[_0xd42a('0x52')][0x0]&&_0x34fc08[_0xd42a('0x52')][0x0][_0xd42a('0x55')]?_0x34fc08[_0xd42a('0x52')][0x0][_0xd42a('0x55')]:0x0;})['join']('\x0a');}logger[_0xd42a('0x1e')](_0xd42a('0x56'),_0x386a7f);logger['info'](_0xd42a('0x57'),_0x47770d);return{'transcript':_0x386a7f,'confidence':_0x47770d};})[_0xd42a('0x58')](function(_0x3a7ddc){logger[_0xd42a('0x18')](_0xd42a('0x59'),_0x3a7ddc[_0xd42a('0x17')],_0x3a7ddc[_0xd42a('0x5a')],_0x3a7ddc[_0xd42a('0x5b')]);});};exports['googleDialogflow']=function(_0x344554,_0x5abedc,_0x298d24,_0x254359){var _0x3881c4=apiai(_0x5abedc,{'language':_0x254359||'en'});return _0x3881c4[_0xd42a('0x5c')](_0x298d24,{'sessionId':md5(_0x344554)})[_0xd42a('0x3f')](function(_0x5cc32e){logger['info'](JSON['stringify'](_0x5cc32e));return{'source':_0x5cc32e[_0xd42a('0x5d')]['source'],'resolvedQuery':_0x5cc32e[_0xd42a('0x5d')]['resolvedQuery'],'action':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x5e')],'actionIncomplete':_0x5cc32e[_0xd42a('0x5d')]['actionIncomplete'],'speech':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x5f')][_0xd42a('0x60')],'score':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x61')],'statusCode':_0x5cc32e[_0xd42a('0x62')][_0xd42a('0x63')],'endConversation':_0x5cc32e[_0xd42a('0x5d')][_0xd42a('0x64')]['endConversation']||![],'isFallbackIntent':_0x5cc32e[_0xd42a('0x5d')]['metadata'][_0xd42a('0x65')]};});};exports[_0xd42a('0x66')]=function(_0x48648c,_0x56dc30,_0x29aee7,_0x16280a,_0x1667a5,_0x3b02a0){var _0x2dd4cc=_0x16280a[_0xd42a('0x67')](/\\n/g,'\x0a');var _0x2c43ef={'credentials':{'private_key':_0x2dd4cc,'client_email':_0x29aee7}};var _0x1d6193=new dialogflow[(_0xd42a('0x68'))](_0x2c43ef);var _0x6b0590=_0x1d6193['sessionPath'](_0x56dc30,md5(_0x48648c));var _0xbf77e1={'session':_0x6b0590,'queryInput':{'text':{'text':_0x1667a5,'languageCode':_0x3b02a0}}};return _0x1d6193[_0xd42a('0x69')](_0xbf77e1)[_0xd42a('0x3f')](function(_0x1c20c8){if(_0x1c20c8&&_0x1c20c8[_0xd42a('0x49')]){logger[_0xd42a('0x1e')](_0xd42a('0x6a'),JSON[_0xd42a('0x45')](_0x1c20c8));var _0x395c1d=_0x1c20c8[0x0];if(_0x395c1d){var _0x565bae={'action':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x5e')],'allRequiredParamsPresent':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x6c')],'endConversation':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x6d')]&&_0x395c1d['queryResult'][_0xd42a('0x6d')]['fields']?_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x6d')][_0xd42a('0x6e')][_0xd42a('0x6f')][_0xd42a('0x70')]:![],'fulfillmentText':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x71')],'intentName':_0x395c1d['queryResult'][_0xd42a('0x72')]['name'],'intentDisplayName':_0x395c1d['queryResult'][_0xd42a('0x72')]['displayName'],'isFallbackIntent':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x72')][_0xd42a('0x73')],'languageCode':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x74')],'queryText':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x75')],'responseId':_0x395c1d[_0xd42a('0x76')],'score':_0x395c1d[_0xd42a('0x6b')][_0xd42a('0x77')],'speech':_0x395c1d['queryResult'][_0xd42a('0x71')],'providerResponse':JSON['stringify'](_0x1c20c8)};return _0x565bae;}}});};exports[_0xd42a('0x78')]=function(_0x2ee82b,_0x3abbe6,_0xbd0d6d,_0x4ab708){return tilde[_0xd42a('0x4e')](_0x2ee82b,_0x3abbe6,_0xbd0d6d,_0x4ab708)[_0xd42a('0x3f')](function(_0x5edce2){try{fs[_0xd42a('0x20')](_0x2ee82b);}catch(_0x243717){logger[_0xd42a('0x18')](_0x243717);}logger[_0xd42a('0x1e')](_0xd42a('0x79'),_0x5edce2[_0xd42a('0x53')]);logger[_0xd42a('0x1e')](_0xd42a('0x7a'),_0x5edce2[_0xd42a('0x55')]);return _0x5edce2;});};exports[_0xd42a('0x7b')]=function(_0xc540ca,_0x236766,_0x44a5df,_0x2fecff,_0x415490,_0x36c303){var _0x52ced5=path[_0xd42a('0x39')](__dirname,'tmp',rs['generate'](0x4)+_0xd42a('0x3b'));var _0x1ba942;return aws['polly'](_0xc540ca,_0x236766,_0x44a5df,_0x2fecff,_0x415490,_0x36c303,_0x52ced5)['then'](function(){_0x1ba942=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+'.wav');return convertFile(_0x52ced5,_0x1ba942);})[_0xd42a('0x3f')](function(){try{fs['unlink'](_0x52ced5);fs[_0xd42a('0x2d')](_0x1ba942,_0xd42a('0x2e'));}catch(_0x519d58){logger[_0xd42a('0x18')](_0x519d58);}return _0x1ba942['split']('.')[0x0];});};exports[_0xd42a('0x7c')]=function(_0x202271,_0x8a78a4,_0x2238f7,_0x1b73cd,_0x3c4956,_0x48d32b){return aws[_0xd42a('0x7d')](_0x202271,_0x8a78a4,_0x2238f7,_0x1b73cd,_0x3c4956,_0x48d32b)['then'](function(_0x547679){logger[_0xd42a('0x1e')](JSON['stringify'](_0x547679));return _0x547679;});};exports[_0xd42a('0x7e')]=function(_0x4b6273,_0xca64a0,_0x36b214,_0x6270df){var _0x2c5b5a=util['format'](_0xd42a('0x7f'),ISPEECH_API,_0x4b6273,encodeURIComponent(_0xca64a0),_0x36b214,_0x6270df);var _0x4106cb=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+'.mp3');var _0x5bf2ec;return downloadFile(_0x2c5b5a,_0x4106cb)[_0xd42a('0x3f')](function(){_0x5bf2ec=path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+_0xd42a('0x2a'));return convertFile(_0x4106cb,_0x5bf2ec);})[_0xd42a('0x3f')](function(){try{fs['unlink'](_0x4106cb);fs[_0xd42a('0x2d')](_0x5bf2ec,_0xd42a('0x2e'));}catch(_0x59eb23){logger[_0xd42a('0x18')](_0x59eb23);}return _0x5bf2ec['split']('.')[0x0];});};exports[_0xd42a('0x80')]=function(_0x2a7c75,_0x40022f,_0x415eb5,_0x41f4d0){var _0x3a0189=util[_0xd42a('0x81')](_0xd42a('0x82'),ISPEECH_API,_0x40022f,_0x415eb5,base64Encode(_0x2a7c75),_0x41f4d0?util['format']('model=%s',encodeURIComponent(_0x41f4d0)):'freeform=3');return uploadFile(_0x3a0189)['then'](function(_0x34c31d){return querystring[_0xd42a('0xc')](_0x34c31d);});};exports[_0xd42a('0x83')]=function(_0x41c83c,_0x7df898){return sestek['nda'](_0x41c83c,_0x7df898)['then'](function(_0x157566){logger['info'](JSON[_0xd42a('0x45')](_0x157566));var _0x909e27={'speech':_0x157566[_0xd42a('0x84')],'action':_0x157566[_0xd42a('0x85')]?_0x157566[_0xd42a('0x85')][_0xd42a('0x86')]:undefined,'actiondata':_0x157566[_0xd42a('0x85')]?_0x157566[_0xd42a('0x85')]['CustomActionData']:undefined};if(_0x157566[_0xd42a('0x85')]&&_0x157566['channelData'][_0xd42a('0x87')]){return base64Decode(_0x157566[_0xd42a('0x85')][_0xd42a('0x87')]['Data'],path[_0xd42a('0x39')](__dirname,_0xd42a('0x3e'),rs[_0xd42a('0x3a')](0x4)+'.wav'))[_0xd42a('0x3f')](function(_0x13fc77){_0x909e27[_0xd42a('0x88')]=_0x13fc77;return _0x909e27;});}return _0x909e27;});};exports[_0xd42a('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0xc646=['readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','voice','MP3','text:synthesize','POST','then','tmp','from','audioContent','writeFile','777','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','.mp3','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','source','result','action','actionIncomplete','fulfillment','speech','score','status','code','isFallbackIntent','replace','SessionsClient','sessionPath','Dialogflow\x20V2\x20response:','queryResult','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','https','path','randomstring','sox','parse','./aws','./google','./sestek','./tilde','../../../config/logger','https://api.ispeech.org/api/rest','protocol','https:','host','get','error','request\x20to\x20','statusCode','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','WHAT_EVER','transcode','error\x20convert','finish\x20to\x20convert','start','resolve','generate','.wav','writeFileSync','base64','chmodSync','split'];(function(_0x561e73,_0x13a224){var _0x2dc60d=function(_0xe87c37){while(--_0xe87c37){_0x561e73['push'](_0x561e73['shift']());}};_0x2dc60d(++_0x13a224);}(_0xc646,0x164));var _0x6c64=function(_0x395a03,_0x362943){_0x395a03=_0x395a03-0x0;var _0x8de6f=_0xc646[_0x395a03];return _0x8de6f;};'use strict';var apiai=require(_0x6c64('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x6c64('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x6c64('0x2'));var md5=require('md5');var path=require(_0x6c64('0x3'));var querystring=require('querystring');var rp=require('request-promise');var rs=require(_0x6c64('0x4'));var sox=require(_0x6c64('0x5'));var tts=require('google-tts-api');var urlParse=require('url')[_0x6c64('0x6')];var util=require('util');var aws=require(_0x6c64('0x7'));var google=require(_0x6c64('0x8'));var sestek=require(_0x6c64('0x9'));var tilde=require(_0x6c64('0xa'));var logger=require(_0x6c64('0xb'))('agi');var ISPEECH_API=_0x6c64('0xc');function downloadFile(_0x42b9df,_0x5eecb2){return new BPromise(function(_0x2d89e4,_0x50894f){var _0x296475=urlParse(_0x42b9df);var _0x311e89=_0x296475[_0x6c64('0xd')]===_0x6c64('0xe')?https:http;var _0x45b0bd={'host':_0x296475[_0x6c64('0xf')],'path':_0x296475[_0x6c64('0x3')],'headers':{'user-agent':'WHAT_EVER'}};_0x311e89[_0x6c64('0x10')](_0x45b0bd,function(_0x241db8){if(_0x241db8['statusCode']!==0xc8){logger[_0x6c64('0x11')](_0x6c64('0x12')+_0x42b9df+'\x20failed,\x20status\x20code\x20=\x20'+_0x241db8[_0x6c64('0x13')]+'\x20('+_0x241db8[_0x6c64('0x14')]+')');_0x50894f(new Error(_0x6c64('0x12')+_0x42b9df+_0x6c64('0x15')+_0x241db8[_0x6c64('0x13')]+'\x20('+_0x241db8[_0x6c64('0x14')]+')'));return;}var _0x5d39bd=fs[_0x6c64('0x16')](_0x5eecb2);_0x5d39bd['on'](_0x6c64('0x17'),function(){logger[_0x6c64('0x18')](_0x6c64('0x19'));_0x5d39bd[_0x6c64('0x1a')](_0x2d89e4);});_0x5d39bd['on'](_0x6c64('0x11'),function(_0xf7cf77){fs[_0x6c64('0x1b')](_0x5eecb2);logger[_0x6c64('0x11')](_0x6c64('0x1c'),_0xf7cf77);_0x50894f(_0xf7cf77);});_0x241db8[_0x6c64('0x1d')](_0x5d39bd);})['on']('error',function(_0x28ed7c){logger[_0x6c64('0x11')](_0x28ed7c);_0x50894f(_0x28ed7c);})[_0x6c64('0x1e')]();});}function uploadFile(_0x2d5125){return new BPromise(function(_0xd27440,_0x579260){var _0x3138b5=urlParse(_0x2d5125);var _0x15c75a=_0x3138b5['protocol']===_0x6c64('0xe')?https:http;var _0x113289={'host':_0x3138b5[_0x6c64('0xf')],'path':_0x3138b5[_0x6c64('0x3')],'headers':{'user-agent':_0x6c64('0x1f')}};_0x15c75a[_0x6c64('0x10')](_0x113289,function(_0xbc8db6){if(_0xbc8db6[_0x6c64('0x13')]!==0xc8){_0x579260(new Error(_0x6c64('0x12')+_0x2d5125+_0x6c64('0x15')+_0xbc8db6[_0x6c64('0x13')]+'\x20('+_0xbc8db6[_0x6c64('0x14')]+')'));return;}var _0x1a322c='';_0xbc8db6['on']('data',function(_0x4c3e5f){_0x1a322c+=_0x4c3e5f;});_0xbc8db6['on'](_0x6c64('0x1e'),function(){_0xd27440(_0x1a322c);});})['on'](_0x6c64('0x11'),function(_0x1f3585){_0x579260(_0x1f3585);})[_0x6c64('0x1e')]();});}function convertFile(_0x51e621,_0x3da9b9){return new BPromise(function(_0x261070,_0x237fa8){var _0x2ddc89=sox[_0x6c64('0x20')](_0x51e621,_0x3da9b9,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ddc89['on'](_0x6c64('0x11'),function(_0x3d0291){logger['error'](_0x6c64('0x21'),_0x3d0291);_0x237fa8(_0x3d0291);});_0x2ddc89['on'](_0x6c64('0x1e'),function(){logger[_0x6c64('0x18')](_0x6c64('0x22'));_0x261070();});_0x2ddc89[_0x6c64('0x23')]();});}function base64Decode(_0x2c99f8,_0x5bfb8a){var _0x43cd6a=path[_0x6c64('0x24')](__dirname,'tmp',rs[_0x6c64('0x25')](0x4)+_0x6c64('0x26'));fs[_0x6c64('0x27')](_0x43cd6a,_0x2c99f8,_0x6c64('0x28'));return convertFile(_0x43cd6a,_0x5bfb8a)['then'](function(){try{fs[_0x6c64('0x1b')](_0x43cd6a);fs[_0x6c64('0x29')](_0x5bfb8a,'777');}catch(_0x55a6c1){logger[_0x6c64('0x11')](_0x55a6c1);}return _0x5bfb8a[_0x6c64('0x2a')]('.')[0x0];});}function base64Encode(_0xa7230b){var _0x391656=fs[_0x6c64('0x2b')](_0xa7230b);return new Buffer(_0x391656)[_0x6c64('0x2c')](_0x6c64('0x28'));}exports[_0x6c64('0x2d')]=function(_0x4b3d9a,_0x3c5f1b,_0x4c5cf7,_0x118c20,_0xe7a847,_0x3b405e){var _0x2508f1,_0x243494;var _0x466041=_0x6c64('0x2e');var _0x11f7aa=_0x6c64('0x2f')+_0x4b3d9a;var _0x1c6fbe={};if(_0x3c5f1b==='ssml'){_0x1c6fbe['input']={'ssml':_0x4c5cf7};}else{_0x1c6fbe[_0x6c64('0x30')]={'text':_0x4c5cf7};};_0x1c6fbe[_0x6c64('0x31')]={'languageCode':_0x118c20,'ssmlGender':_0xe7a847};_0x1c6fbe['audioConfig']={'audioEncoding':_0x6c64('0x32'),'sampleRateHertz':0x1f40};var _0x224fea={'url':_0x466041+_0x6c64('0x33')+_0x11f7aa,'method':_0x6c64('0x34'),'json':!![],'body':_0x1c6fbe};return rp(_0x224fea)[_0x6c64('0x35')](function(_0x1fbe97){return new BPromise(function(_0x45892c,_0x5a2aec){_0x2508f1=path[_0x6c64('0x24')](__dirname,_0x6c64('0x36'),rs[_0x6c64('0x25')](0x4)+'.mp3');var _0x5eda39=Buffer[_0x6c64('0x37')](_0x1fbe97[_0x6c64('0x38')],'base64');return fs[_0x6c64('0x39')](_0x2508f1,_0x5eda39,function(_0x4931d1){_0x5a2aec(_0x4931d1);},function(_0x4038cd){fs[_0x6c64('0x29')](_0x2508f1,_0x6c64('0x3a'));_0x45892c(_0x4038cd);});});})[_0x6c64('0x35')](function(_0x39f0c5){_0x243494=path[_0x6c64('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0x6c64('0x26'));return convertFile(_0x2508f1,_0x243494);})[_0x6c64('0x35')](function(){try{fs[_0x6c64('0x1b')](_0x2508f1);fs[_0x6c64('0x29')](_0x243494,_0x6c64('0x3a'));}catch(_0x542e36){logger[_0x6c64('0x11')](_0x542e36);}logger[_0x6c64('0x18')](_0x6c64('0x3b'),_0x243494[_0x6c64('0x2a')]('.')[0x0]);return _0x243494[_0x6c64('0x2a')]('.')[0x0];});};exports['googleTTS']=function(_0x2d5ec1,_0x25558a){var _0x40c1cf=_0x6c64('0x3c');var _0x877145,_0x6fad2c;var _0x57a286;var _0x3092b8={'encoding':_0x6c64('0x3d'),'method':_0x6c64('0x34'),'timeout':0x2710,'url':_0x40c1cf,'headers':{'Content-Type':_0x6c64('0x3e')},'body':_0x6c64('0x3f')+encodeURIComponent(JSON[_0x6c64('0x40')]([[['jQ1olc',JSON[_0x6c64('0x40')]([_0x2d5ec1,_0x25558a||'en',![],_0x6c64('0x41')]),null,'generic']]]))};return rp(_0x3092b8)[_0x6c64('0x35')](function(_0x374662){try{_0x57a286=eval(_0x374662['slice'](0x5))[0x0][0x2];}catch(_0x12c062){throw new Error(_0x6c64('0x42')+_0x374662['data']);}if(!_0x57a286){if(_0x2d5ec1[_0x6c64('0x43')]>0xc8){throw new Error(_0x6c64('0x44'));}else{throw new Error(_0x6c64('0x45')+_0x25558a+'\x22\x20might\x20not\x20exist');}}try{_0x57a286=eval(_0x57a286)[0x0];}catch(_0x364bda){throw new Error(_0x6c64('0x42')+res['data']);}const _0x2afeff=_0x57a286;_0x877145=path['resolve'](__dirname,_0x6c64('0x36'),rs[_0x6c64('0x25')](0x4)+_0x6c64('0x46'));fs[_0x6c64('0x27')](_0x877145,_0x57a286,{'encoding':_0x6c64('0x28')});_0x6fad2c=path[_0x6c64('0x24')](__dirname,'tmp',rs[_0x6c64('0x25')](0x4)+_0x6c64('0x26'));return convertFile(_0x877145,_0x6fad2c);})[_0x6c64('0x35')](function(){try{fs[_0x6c64('0x1b')](_0x877145);fs['chmodSync'](_0x6fad2c,_0x6c64('0x3a'));}catch(_0x30c9a5){logger[_0x6c64('0x11')](_0x30c9a5);}logger[_0x6c64('0x18')](_0x6c64('0x47'),_0x6fad2c[_0x6c64('0x2a')]('.')[0x0]);return _0x6fad2c[_0x6c64('0x2a')]('.')[0x0];});};exports['googleASR']=function(_0x58b05f,_0x30005d,_0x20a31c){return google[_0x6c64('0x48')](_0x58b05f,_0x30005d,_0x20a31c)[_0x6c64('0x35')](function(_0x57669d){logger['info'](_0x57669d[_0x6c64('0x49')]);return rp(_0x57669d);})['then'](function(_0x57bf75){var _0x214c77='';var _0x5dd08a=0x0;try{fs[_0x6c64('0x1b')](_0x58b05f);}catch(_0x45b294){logger['error'](_0x45b294);}if(_0x57bf75&&_0x57bf75[_0x6c64('0x4a')]){_0x214c77=_0x57bf75['results']['map'](function(_0x213bfc){return _0x213bfc&&_0x213bfc['alternatives'][0x0]&&_0x213bfc[_0x6c64('0x4b')][0x0]['transcript']?_0x213bfc[_0x6c64('0x4b')][0x0][_0x6c64('0x4c')]:'';})[_0x6c64('0x4d')]('\x0a');_0x5dd08a=_0x57bf75[_0x6c64('0x4a')][_0x6c64('0x4e')](function(_0x2d2572){return _0x2d2572&&_0x2d2572[_0x6c64('0x4b')][0x0]&&_0x2d2572[_0x6c64('0x4b')][0x0][_0x6c64('0x4f')]?_0x2d2572[_0x6c64('0x4b')][0x0][_0x6c64('0x4f')]:0x0;})[_0x6c64('0x4d')]('\x0a');}logger[_0x6c64('0x18')]('googleASR\x20transcription',_0x214c77);logger['info']('googleASR\x20confidence',_0x5dd08a);return{'transcript':_0x214c77,'confidence':_0x5dd08a};})['catch'](function(_0x5e4862){logger[_0x6c64('0x11')](_0x6c64('0x50'),_0x5e4862['statusCode'],_0x5e4862[_0x6c64('0x51')],_0x5e4862[_0x6c64('0x52')]);});};exports[_0x6c64('0x53')]=function(_0x51f117,_0x5a9a57,_0x21af32,_0x28758e){var _0x4c5e82=apiai(_0x5a9a57,{'language':_0x28758e||'en'});return _0x4c5e82[_0x6c64('0x54')](_0x21af32,{'sessionId':md5(_0x51f117)})['then'](function(_0x47caeb){logger[_0x6c64('0x18')](JSON[_0x6c64('0x40')](_0x47caeb));return{'source':_0x47caeb['result'][_0x6c64('0x55')],'resolvedQuery':_0x47caeb[_0x6c64('0x56')]['resolvedQuery'],'action':_0x47caeb[_0x6c64('0x56')][_0x6c64('0x57')],'actionIncomplete':_0x47caeb[_0x6c64('0x56')][_0x6c64('0x58')],'speech':_0x47caeb[_0x6c64('0x56')][_0x6c64('0x59')][_0x6c64('0x5a')],'score':_0x47caeb['result'][_0x6c64('0x5b')],'statusCode':_0x47caeb[_0x6c64('0x5c')][_0x6c64('0x5d')],'endConversation':_0x47caeb['result']['metadata']['endConversation']||![],'isFallbackIntent':_0x47caeb['result']['metadata'][_0x6c64('0x5e')]};});};exports['googleDialogflowV2']=function(_0x253c18,_0x3c91ff,_0x1906cf,_0x4db75f,_0x1a47df,_0x1d0b5c){var _0x424bb8=_0x4db75f[_0x6c64('0x5f')](/\\n/g,'\x0a');var _0x2bcaf2={'credentials':{'private_key':_0x424bb8,'client_email':_0x1906cf}};var _0x49c5a3=new dialogflow[(_0x6c64('0x60'))](_0x2bcaf2);var _0x25df35=_0x49c5a3[_0x6c64('0x61')](_0x3c91ff,md5(_0x253c18));var _0x52b88d={'session':_0x25df35,'queryInput':{'text':{'text':_0x1a47df,'languageCode':_0x1d0b5c}}};return _0x49c5a3['detectIntent'](_0x52b88d)['then'](function(_0x4de65f){if(_0x4de65f&&_0x4de65f['length']){logger['info'](_0x6c64('0x62'),JSON['stringify'](_0x4de65f));var _0x154d92=_0x4de65f[0x0];if(_0x154d92){var _0x4f4f4b={'action':_0x154d92[_0x6c64('0x63')][_0x6c64('0x57')],'allRequiredParamsPresent':_0x154d92[_0x6c64('0x63')]['allRequiredParamsPresent'],'endConversation':_0x154d92[_0x6c64('0x63')][_0x6c64('0x64')]&&_0x154d92[_0x6c64('0x63')][_0x6c64('0x64')][_0x6c64('0x65')]?_0x154d92[_0x6c64('0x63')][_0x6c64('0x64')][_0x6c64('0x65')][_0x6c64('0x66')][_0x6c64('0x67')]:![],'fulfillmentText':_0x154d92[_0x6c64('0x63')][_0x6c64('0x68')],'intentName':_0x154d92[_0x6c64('0x63')][_0x6c64('0x69')][_0x6c64('0x51')],'intentDisplayName':_0x154d92[_0x6c64('0x63')][_0x6c64('0x69')][_0x6c64('0x6a')],'isFallbackIntent':_0x154d92['queryResult'][_0x6c64('0x69')][_0x6c64('0x6b')],'languageCode':_0x154d92[_0x6c64('0x63')][_0x6c64('0x6c')],'queryText':_0x154d92[_0x6c64('0x63')][_0x6c64('0x6d')],'responseId':_0x154d92[_0x6c64('0x6e')],'score':_0x154d92[_0x6c64('0x63')][_0x6c64('0x6f')],'speech':_0x154d92[_0x6c64('0x63')][_0x6c64('0x68')],'providerResponse':JSON[_0x6c64('0x40')](_0x4de65f)};return _0x4f4f4b;}}});};exports[_0x6c64('0x70')]=function(_0x59adb5,_0x427c28,_0x12a751,_0xa0b3b6){return tilde[_0x6c64('0x48')](_0x59adb5,_0x427c28,_0x12a751,_0xa0b3b6)[_0x6c64('0x35')](function(_0x12132a){try{fs[_0x6c64('0x1b')](_0x59adb5);}catch(_0x554e25){logger['error'](_0x554e25);}logger[_0x6c64('0x18')](_0x6c64('0x71'),_0x12132a[_0x6c64('0x4c')]);logger[_0x6c64('0x18')](_0x6c64('0x72'),_0x12132a[_0x6c64('0x4f')]);return _0x12132a;});};exports[_0x6c64('0x73')]=function(_0x2bca00,_0x26db7a,_0x38e6db,_0x2d2571,_0x4d848d,_0x1a5113){var _0x54f9b7=path[_0x6c64('0x24')](__dirname,'tmp',rs[_0x6c64('0x25')](0x4)+_0x6c64('0x46'));var _0x598874;return aws[_0x6c64('0x74')](_0x2bca00,_0x26db7a,_0x38e6db,_0x2d2571,_0x4d848d,_0x1a5113,_0x54f9b7)[_0x6c64('0x35')](function(){_0x598874=path[_0x6c64('0x24')](__dirname,_0x6c64('0x36'),rs['generate'](0x4)+_0x6c64('0x26'));return convertFile(_0x54f9b7,_0x598874);})[_0x6c64('0x35')](function(){try{fs[_0x6c64('0x1b')](_0x54f9b7);fs[_0x6c64('0x29')](_0x598874,'777');}catch(_0x28d218){logger[_0x6c64('0x11')](_0x28d218);}return _0x598874['split']('.')[0x0];});};exports[_0x6c64('0x75')]=function(_0x99afef,_0x12cc50,_0x4d1dad,_0x20b239,_0x492d2d,_0x53c88b){return aws[_0x6c64('0x76')](_0x99afef,_0x12cc50,_0x4d1dad,_0x20b239,_0x492d2d,_0x53c88b)['then'](function(_0x575f76){logger['info'](JSON[_0x6c64('0x40')](_0x575f76));return _0x575f76;});};exports[_0x6c64('0x77')]=function(_0x2dc9ed,_0x4a568f,_0x55f466,_0x570c94){var _0x3be6e4=util[_0x6c64('0x78')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2dc9ed,encodeURIComponent(_0x4a568f),_0x55f466,_0x570c94);var _0x2f6491=path[_0x6c64('0x24')](__dirname,_0x6c64('0x36'),rs['generate'](0x4)+_0x6c64('0x46'));var _0x1c5b2a;return downloadFile(_0x3be6e4,_0x2f6491)[_0x6c64('0x35')](function(){_0x1c5b2a=path['resolve'](__dirname,_0x6c64('0x36'),rs[_0x6c64('0x25')](0x4)+_0x6c64('0x26'));return convertFile(_0x2f6491,_0x1c5b2a);})[_0x6c64('0x35')](function(){try{fs['unlink'](_0x2f6491);fs[_0x6c64('0x29')](_0x1c5b2a,_0x6c64('0x3a'));}catch(_0x206ab5){logger[_0x6c64('0x11')](_0x206ab5);}return _0x1c5b2a['split']('.')[0x0];});};exports[_0x6c64('0x79')]=function(_0x4b4207,_0x3a9ff4,_0x2a28d5,_0x1fda9c){var _0x1aa6bd=util['format'](_0x6c64('0x7a'),ISPEECH_API,_0x3a9ff4,_0x2a28d5,base64Encode(_0x4b4207),_0x1fda9c?util[_0x6c64('0x78')](_0x6c64('0x7b'),encodeURIComponent(_0x1fda9c)):'freeform=3');return uploadFile(_0x1aa6bd)[_0x6c64('0x35')](function(_0x19f554){return querystring['parse'](_0x19f554);});};exports['sestekNDA']=function(_0x189f1c,_0x2d048a){return sestek[_0x6c64('0x7c')](_0x189f1c,_0x2d048a)[_0x6c64('0x35')](function(_0x15d96f){logger[_0x6c64('0x18')](JSON[_0x6c64('0x40')](_0x15d96f));var _0x1a1ddc={'speech':_0x15d96f[_0x6c64('0x7d')],'action':_0x15d96f[_0x6c64('0x7e')]?_0x15d96f[_0x6c64('0x7e')][_0x6c64('0x7f')]:undefined,'actiondata':_0x15d96f[_0x6c64('0x7e')]?_0x15d96f['channelData'][_0x6c64('0x80')]:undefined};if(_0x15d96f[_0x6c64('0x7e')]&&_0x15d96f[_0x6c64('0x7e')][_0x6c64('0x81')]){return base64Decode(_0x15d96f[_0x6c64('0x7e')]['AudioFromTts'][_0x6c64('0x82')],path['resolve'](__dirname,'tmp',rs[_0x6c64('0x25')](0x4)+_0x6c64('0x26')))[_0x6c64('0x35')](function(_0x4e5b98){_0x1a1ddc[_0x6c64('0x83')]=_0x4e5b98;return _0x1a1ddc;});}return _0x1a1ddc;});};exports[_0x6c64('0x84')]=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 2177e62..0ccf214 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 _0x2c01=['exports','./nda'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2c01,0x171));var _0x12c0=function(_0x57a51d,_0x4d6217){_0x57a51d=_0x57a51d-0x0;var _0x5bb72a=_0x2c01[_0x57a51d];return _0x5bb72a;};var nda=require(_0x12c0('0x0'));module[_0x12c0('0x1')]={'nda':nda}; \ No newline at end of file +var _0x78c6=['./nda','exports'];(function(_0x569caa,_0x5174ce){var _0x44cb5a=function(_0x456df4){while(--_0x456df4){_0x569caa['push'](_0x569caa['shift']());}};_0x44cb5a(++_0x5174ce);}(_0x78c6,0x14e));var _0x678c=function(_0x16f34a,_0x46bd66){_0x16f34a=_0x16f34a-0x0;var _0x1f4a6e=_0x78c6[_0x16f34a];return _0x1f4a6e;};var nda=require(_0x678c('0x0'));module[_0x678c('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index c6d8937..7159d74 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 _0xd49c=['then','resolve','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','body','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','CustomActionData','custom_action_data','info','url','agi','exports','POST','ndauth_url','/token','password','username'];(function(_0x52ca59,_0x279dda){var _0x1ab7e5=function(_0x2b8c74){while(--_0x2b8c74){_0x52ca59['push'](_0x52ca59['shift']());}};_0x1ab7e5(++_0x279dda);}(_0xd49c,0x1d8));var _0xcd49=function(_0x526e0a,_0x2e7c03){_0x526e0a=_0x526e0a-0x0;var _0x5ef692=_0xd49c[_0x526e0a];return _0x5ef692;};'use strict';var rp=require('request-promise');var url=require(_0xcd49('0x0'));var logger=require('../../../../../config/logger')(_0xcd49('0x1'));module[_0xcd49('0x2')]=function(_0x5bda72,_0x1181d4){var _0x52362d={'method':_0xcd49('0x3'),'uri':url['resolve'](_0x1181d4[_0xcd49('0x4')],_0xcd49('0x5')),'form':{'grant_type':_0xcd49('0x6'),'username':_0x1181d4[_0xcd49('0x7')],'password':_0x1181d4[_0xcd49('0x6')]},'json':!![]};return rp(_0x52362d)[_0xcd49('0x8')](function(_0x321013){var _0x17f26f={'method':_0xcd49('0x3'),'uri':url[_0xcd49('0x9')](_0x1181d4[_0xcd49('0xa')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x1181d4[_0xcd49('0xb')]||_0xcd49('0xc'),'channelId':_0xcd49('0xd'),'conversation':{'id':_0x5bda72[_0xcd49('0xe')]},'from':{'id':_0x5bda72[_0xcd49('0xf')],'name':_0x5bda72[_0xcd49('0x10')]},'recipient':{'id':_0x5bda72[_0xcd49('0x11')],'name':_0x5bda72[_0xcd49('0x12')]},'text':_0x1181d4[_0xcd49('0x13')],'channelData':{}},'headers':{'Authorization':_0xcd49('0x14')+_0x321013['access_token']},'json':!![]};if(_0x1181d4['project']){_0x17f26f[_0xcd49('0x15')][_0xcd49('0x16')][_0xcd49('0x17')]=_0x1181d4['project'];}if(_0x1181d4[_0xcd49('0x18')]=='1'){_0x17f26f[_0xcd49('0x15')]['channelData'][_0xcd49('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xcd49('0x1a')};}if(_0x1181d4[_0xcd49('0x1b')]){_0x17f26f[_0xcd49('0x15')][_0xcd49('0x16')][_0xcd49('0x1c')]=_0x1181d4['custom_action'];if(_0x1181d4['custom_action_data']){_0x17f26f['body']['channelData'][_0xcd49('0x1d')]=_0x1181d4[_0xcd49('0x1e')];}}logger[_0xcd49('0x1f')](JSON['stringify'](_0x17f26f));return rp(_0x17f26f);});}; \ No newline at end of file +var _0x6ce9=['../../../../../config/logger','POST','resolve','ndauth_url','password','username','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','project','body','channelData','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','stringify','request-promise','url'];(function(_0x6c823,_0x3f5e35){var _0x1fda1b=function(_0x1eb5b5){while(--_0x1eb5b5){_0x6c823['push'](_0x6c823['shift']());}};_0x1fda1b(++_0x3f5e35);}(_0x6ce9,0x76));var _0x96ce=function(_0x9238ce,_0x384273){_0x9238ce=_0x9238ce-0x0;var _0x4b2806=_0x6ce9[_0x9238ce];return _0x4b2806;};'use strict';var rp=require(_0x96ce('0x0'));var url=require(_0x96ce('0x1'));var logger=require(_0x96ce('0x2'))('agi');module['exports']=function(_0x18bbb2,_0x5bf6d5){var _0x28a6a3={'method':_0x96ce('0x3'),'uri':url[_0x96ce('0x4')](_0x5bf6d5[_0x96ce('0x5')],'/token'),'form':{'grant_type':_0x96ce('0x6'),'username':_0x5bf6d5[_0x96ce('0x7')],'password':_0x5bf6d5[_0x96ce('0x6')]},'json':!![]};return rp(_0x28a6a3)['then'](function(_0x1abd8c){var _0x16a140={'method':_0x96ce('0x3'),'uri':url['resolve'](_0x5bf6d5['ndassistant_url'],_0x96ce('0x8')),'body':{'type':_0x5bf6d5[_0x96ce('0x9')]||_0x96ce('0xa'),'channelId':_0x96ce('0xb'),'conversation':{'id':_0x18bbb2[_0x96ce('0xc')]},'from':{'id':_0x18bbb2[_0x96ce('0xd')],'name':_0x18bbb2[_0x96ce('0xe')]},'recipient':{'id':_0x18bbb2[_0x96ce('0xf')],'name':_0x18bbb2[_0x96ce('0x10')]},'text':_0x5bf6d5[_0x96ce('0x11')],'channelData':{}},'headers':{'Authorization':_0x96ce('0x12')+_0x1abd8c['access_token']},'json':!![]};if(_0x5bf6d5[_0x96ce('0x13')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')]['ProjectName']=_0x5bf6d5[_0x96ce('0x13')];}if(_0x5bf6d5[_0x96ce('0x16')]=='1'){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x17')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x96ce('0x18')};}if(_0x5bf6d5[_0x96ce('0x19')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x1a')]=_0x5bf6d5[_0x96ce('0x19')];if(_0x5bf6d5[_0x96ce('0x1b')]){_0x16a140[_0x96ce('0x14')][_0x96ce('0x15')][_0x96ce('0x1c')]=_0x5bf6d5['custom_action_data'];}}logger['info'](JSON[_0x96ce('0x1d')](_0x16a140));return rp(_0x16a140);});}; \ 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 44ee5dc..87e690c 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 _0x8957=['./lib/api'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x8957,0x167));var _0x7895=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x8957[_0x397e5f];return _0x5302b8;};'use strict';var asr=require(_0x7895('0x0'));module['exports']=function(_0x3ee490,_0x101f62,_0x5be3e4,_0x233fc8){return asr(_0x3ee490,_0x101f62,_0x5be3e4,_0x233fc8);}; \ No newline at end of file +var _0x9112=['./lib/api','exports'];(function(_0x5dbc92,_0x3150c1){var _0x4fdd15=function(_0x4f022b){while(--_0x4f022b){_0x5dbc92['push'](_0x5dbc92['shift']());}};_0x4fdd15(++_0x3150c1);}(_0x9112,0x1b0));var _0x2911=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9112[_0x122ef9];return _0x42fba0;};'use strict';var asr=require(_0x2911('0x0'));module[_0x2911('0x1')]=function(_0x30e4d0,_0x7c96d,_0xd7a358,_0x40197e){return asr(_0x30e4d0,_0x7c96d,_0xd7a358,_0x40197e);}; \ 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 c182b7f..ab76e68 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 _0x0647=['exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','sha1','update','digest','hex','unix','send','stringify','createReadStream','close','EOS','error','terminate','parse','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','message','bluebird','lodash','../../../../../../config/logger','agi'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x0647,0x98));var _0x7064=function(_0x37ffea,_0x25b006){_0x37ffea=_0x37ffea-0x0;var _0x2e2615=_0x0647[_0x37ffea];return _0x2e2615;};'use strict';var BPromise=require(_0x7064('0x0'));var _=require(_0x7064('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x7064('0x2'))(_0x7064('0x3'));module[_0x7064('0x4')]=function(_0x168f74,_0x5137fe,_0x1974a2,_0x284d2d){return new BPromise(function(_0x435e49,_0x21dad9){logger[_0x7064('0x5')](_0x7064('0x6'),_0x284d2d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x3e5366=new WebSocket(_0x284d2d||_0x7064('0x7'),{'perMessageDeflate':![]});var _0x4d75e0='';var _0x241586='0';var _0x2d672d='1';var _0x34299c=_0x7064('0x8');function _0x329b5d(_0x508e77){var _0x32eaa9=crypto[_0x7064('0x9')](_0x7064('0xa'));_0x32eaa9[_0x7064('0xb')](_0x508e77);return _0x32eaa9[_0x7064('0xc')](_0x7064('0xd'));}function _0x5cf33e(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x34222b=moment()[_0x7064('0xe')]();var _0x23068d=_0x329b5d(_0x34222b+_0x5137fe+_0x1974a2);_0x3e5366[_0x7064('0xf')](JSON[_0x7064('0x10')]({'appID':_0x5137fe,'timestamp':_0x34222b,'appKey':_0x23068d}));var _0x709146=fs[_0x7064('0x11')](_0x168f74);_0x709146['on']('data',function(_0x45b1b3){_0x3e5366[_0x7064('0xf')](_0x45b1b3);});_0x709146['on'](_0x7064('0x12'),function(){_0x3e5366[_0x7064('0xf')](_0x7064('0x13'));});}catch(_0x93c758){logger[_0x7064('0x14')]('Tilde\x20ASR\x20send\x20error',JSON[_0x7064('0x10')](_0x93c758));_0x3e5366[_0x7064('0x15')]();}}function _0xa6d383(_0x3d5930){try{if(_0x3d5930){var _0x3c251b=JSON[_0x7064('0x16')](_0x3d5930);switch(_0x3c251b[_0x7064('0x17')]){case 0x0:if(_0x3c251b[_0x7064('0x18')]){if(_0x3c251b['result']['final']){logger['info'](_0x7064('0x19'),JSON[_0x7064('0x10')](_0x3c251b[_0x7064('0x18')]['hypotheses']));_0x4d75e0=_0x3c251b[_0x7064('0x18')][_0x7064('0x1a')][0x0][_0x7064('0x1b')];_0x241586=_0x3c251b[_0x7064('0x18')]['hypotheses'][0x0][_0x7064('0x1c')];_0x2d672d='0';_0x34299c=_0x7064('0x1d');_0x3e5366[_0x7064('0x15')]();}}break;case 0x1:logger[_0x7064('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2d672d='1';_0x34299c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0x7064('0x5')]('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x2d672d='2';_0x34299c=_0x7064('0x1e');break;case 0x9:logger[_0x7064('0x5')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2d672d='9';_0x34299c=_0x7064('0x1f');break;case 0xa:logger[_0x7064('0x5')](_0x7064('0x20'));_0x2d672d='10';_0x34299c=_0x7064('0x20');break;case 0xb:logger['info'](_0x7064('0x21'));_0x2d672d='11';_0x34299c='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x64bf13){logger[_0x7064('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON['stringify'](_0x64bf13));_0x3e5366[_0x7064('0x15')]();}}function _0x38ed60(){logger[_0x7064('0x5')](_0x7064('0x22'));_0x435e49({'transcript':_0x4d75e0,'confidence':_0x241586,'status':_0x2d672d,'status_message':_0x34299c});}function _0x1b2647(_0x71a280){logger[_0x7064('0x14')](_0x7064('0x23'));if(!_[_0x7064('0x24')](_0x71a280)){logger[_0x7064('0x14')](_[_0x7064('0x25')](_0x71a280)?JSON[_0x7064('0x10')](_0x71a280):_0x71a280);}}_0x3e5366['on']('open',_0x5cf33e);_0x3e5366['on'](_0x7064('0x26'),_0xa6d383);_0x3e5366['on'](_0x7064('0x12'),_0x38ed60);_0x3e5366['on']('error',_0x1b2647);});}; \ No newline at end of file +var _0xdf79=['lodash','moment','crypto','../../../../../../config/logger','agi','exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','update','digest','hex','info','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','Tilde\x20ASR\x20hypoteses','hypotheses','result','transcript','Success.','terminate','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Error\x20Tilde\x20ASR\x20socket','isObject','open','message'];(function(_0x31541d,_0x788856){var _0x2ae010=function(_0x7e70c9){while(--_0x7e70c9){_0x31541d['push'](_0x31541d['shift']());}};_0x2ae010(++_0x788856);}(_0xdf79,0x14d));var _0x9df7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdf79[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require('bluebird');var _=require(_0x9df7('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x9df7('0x1'));var crypto=require(_0x9df7('0x2'));var logger=require(_0x9df7('0x3'))(_0x9df7('0x4'));module[_0x9df7('0x5')]=function(_0x37d00b,_0x250c70,_0x47cdc5,_0xb0971a){return new BPromise(function(_0x43541e,_0x5a8d1d){logger['info'](_0x9df7('0x6'),_0xb0971a||_0x9df7('0x7'));var _0x435b43=new WebSocket(_0xb0971a||_0x9df7('0x7'),{'perMessageDeflate':![]});var _0x50bb03='';var _0x57e5b3='0';var _0x3535bd='1';var _0xc3e81b=_0x9df7('0x8');function _0x161fca(_0x49d489){var _0x221275=crypto['createHash'](_0x9df7('0x9'));_0x221275[_0x9df7('0xa')](_0x49d489);return _0x221275[_0x9df7('0xb')](_0x9df7('0xc'));}function _0x39ee3a(){try{logger[_0x9df7('0xd')]('Open\x20Tilde\x20ASR\x20socket');var _0x3a549c=moment()[_0x9df7('0xe')]();var _0x593969=_0x161fca(_0x3a549c+_0x250c70+_0x47cdc5);_0x435b43[_0x9df7('0xf')](JSON[_0x9df7('0x10')]({'appID':_0x250c70,'timestamp':_0x3a549c,'appKey':_0x593969}));var _0x567c05=fs[_0x9df7('0x11')](_0x37d00b);_0x567c05['on']('data',function(_0x56b0d7){_0x435b43[_0x9df7('0xf')](_0x56b0d7);});_0x567c05['on'](_0x9df7('0x12'),function(){_0x435b43[_0x9df7('0xf')](_0x9df7('0x13'));});}catch(_0x2b5e83){logger[_0x9df7('0x14')](_0x9df7('0x15'),JSON[_0x9df7('0x10')](_0x2b5e83));_0x435b43['terminate']();}}function _0x5dee18(_0x15144b){try{if(_0x15144b){var _0x2209ca=JSON[_0x9df7('0x16')](_0x15144b);switch(_0x2209ca['status']){case 0x0:if(_0x2209ca['result']){if(_0x2209ca['result']['final']){logger[_0x9df7('0xd')](_0x9df7('0x17'),JSON[_0x9df7('0x10')](_0x2209ca['result'][_0x9df7('0x18')]));_0x50bb03=_0x2209ca[_0x9df7('0x19')][_0x9df7('0x18')][0x0][_0x9df7('0x1a')];_0x57e5b3=_0x2209ca[_0x9df7('0x19')][_0x9df7('0x18')][0x0]['likelihood'];_0x3535bd='0';_0xc3e81b=_0x9df7('0x1b');_0x435b43[_0x9df7('0x1c')]();}}break;case 0x1:logger[_0x9df7('0xd')](_0x9df7('0x8'));_0x3535bd='1';_0xc3e81b=_0x9df7('0x8');break;case 0x2:logger['info']('Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.');_0x3535bd='2';_0xc3e81b=_0x9df7('0x1d');break;case 0x9:logger[_0x9df7('0xd')](_0x9df7('0x1e'));_0x3535bd='9';_0xc3e81b=_0x9df7('0x1e');break;case 0xa:logger[_0x9df7('0xd')](_0x9df7('0x1f'));_0x3535bd='10';_0xc3e81b=_0x9df7('0x1f');break;case 0xb:logger['info'](_0x9df7('0x20'));_0x3535bd='11';_0xc3e81b=_0x9df7('0x20');}}}catch(_0x2abe5f){logger[_0x9df7('0x14')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x9df7('0x10')](_0x2abe5f));_0x435b43[_0x9df7('0x1c')]();}}function _0x1bcbd7(){logger[_0x9df7('0xd')]('Close\x20Tilde\x20ASR\x20socket');_0x43541e({'transcript':_0x50bb03,'confidence':_0x57e5b3,'status':_0x3535bd,'status_message':_0xc3e81b});}function _0x590c23(_0x830c39){logger[_0x9df7('0x14')](_0x9df7('0x21'));if(!_['isNil'](_0x830c39)){logger[_0x9df7('0x14')](_[_0x9df7('0x22')](_0x830c39)?JSON[_0x9df7('0x10')](_0x830c39):_0x830c39);}}_0x435b43['on'](_0x9df7('0x23'),_0x39ee3a);_0x435b43['on'](_0x9df7('0x24'),_0x5dee18);_0x435b43['on'](_0x9df7('0x12'),_0x1bcbd7);_0x435b43['on']('error',_0x590c23);});}; \ 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 e5d0daf..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 _0x0b41=['exports','./asr'];(function(_0x4ba645,_0x4d4252){var _0x27a868=function(_0x39efa9){while(--_0x39efa9){_0x4ba645['push'](_0x4ba645['shift']());}};_0x27a868(++_0x4d4252);}(_0x0b41,0x12f));var _0x10b4=function(_0x1d7e8b,_0x10236c){_0x1d7e8b=_0x1d7e8b-0x0;var _0x546813=_0x0b41[_0x1d7e8b];return _0x546813;};var asr=require(_0x10b4('0x0'));module[_0x10b4('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 daa643b..db867a9 100644 --- a/server/services/agi/server.js +++ b/server/services/agi/server.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x55c762,_0x2af74b){var _0x2a918f=function(_0x14902f){while(--_0x14902f){_0x55c762['push'](_0x55c762['shift']());}};_0x2a918f(++_0x2af74b);}(_0x34e8,0x12c));var _0x834e=function(_0x4267fd,_0x35d695){_0x4267fd=_0x4267fd-0x0;var _0x17c120=_0x34e8[_0x4267fd];return _0x17c120;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file +var _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(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0xe706,0xa3));var _0x6e70=function(_0x40a0a4,_0x4269e1){_0x40a0a4=_0x40a0a4-0x0;var _0x115c37=_0xe706[_0x40a0a4];return _0x115c37;};'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 5981829..d46bdec 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 _0x72b1=['audioEncoding','google_tts_language','restAPI','url','method','timeout','number','POST','PUT','toUpperCase','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','en-US','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','noop','no\x20text\x20configured','result','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','agi','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_INPUT()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','mindigit','no\x20variable\x20found','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','continueAt','context','condition','no\x20condition\x20configured','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','success','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','Executed\x20command\x20%s\x20%s','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','inspect','no\x20variable\x20selected\x20for\x20the\x20response','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','\x22%s\x22\x20<%s>','email','bcc','subject','template_id','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','sms_account_id','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','subproject','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','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','join','exports','util','shelljs','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','then','name','catch','getVoiceQueue','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','IntervalId','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','callerid','createSquareRecording','uniqueid','calleridname','extension','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','lastName','phone','list_id','scheduledAt','callback_priority','getPause','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE'];(function(_0x5bf2b3,_0xfcd364){var _0x5e8a9b=function(_0x43546b){while(--_0x43546b){_0x5bf2b3['push'](_0x5bf2b3['shift']());}};_0x5e8a9b(++_0xfcd364);}(_0x72b1,0x16e));var _0x172b=function(_0x35b614,_0x1bf17f){_0x35b614=_0x35b614-0x0;var _0x3ff461=_0x72b1[_0x35b614];return _0x3ff461;};'use strict';var fs=require('fs');var util=require(_0x172b('0x0'));var _=require('lodash');var sh=require(_0x172b('0x1'));var odbc=require(_0x172b('0x2'))();var rs=require(_0x172b('0x3'));var moment=require(_0x172b('0x4'));var Mustache=require(_0x172b('0x5'));var rp=require(_0x172b('0x6'));var logger=require(_0x172b('0x7'))('agi');var config=require(_0x172b('0x8'));var scripts=require(_0x172b('0x9'));var FILES_PATH=_0x172b('0xa');var recursiveMapAttributes=[_0x172b('0xb'),'rawBody'];var verticesWithRetry=[_0x172b('0xc'),'getdigits',_0x172b('0xd')];var AGIVertices=function(_0x531b10,_0x6680e0,_0x2238f1){this[_0x172b('0xe')]=_0x531b10;this[_0x172b('0xf')]=_0x6680e0;this['mailRpc']=_0x2238f1;};AGIVertices[_0x172b('0x10')][_0x172b('0x11')]=function(_0x28aaad,_0x161c7c){this[_0x172b('0xf')][_0x172b('0x12')](_0x28aaad)[_0x172b('0x13')](function(_0x5a171f){_0x161c7c(null,_0x5a171f?_0x5a171f[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0xdf832e){_0x161c7c(_0xdf832e);});};AGIVertices['prototype'][_0x172b('0x16')]=function(_0x4a98e2,_0x2611c2){this[_0x172b('0xf')]['getVoiceQueueById'](_0x4a98e2)[_0x172b('0x13')](function(_0x3452f2){_0x2611c2(null,_0x3452f2?_0x3452f2[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x5b0ab1){_0x2611c2(_0x5b0ab1);});};AGIVertices['prototype'][_0x172b('0x17')]=function(_0x34be39,_0x36af74){this[_0x172b('0xf')]['getSquareProjectById'](_0x34be39)['then'](function(_0x10c80b){_0x36af74(null,_0x10c80b?_0x10c80b[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0xba7825){_0x36af74(_0xba7825);});};AGIVertices[_0x172b('0x10')]['getSquareOdbc']=function(_0x304b96,_0x2d24f9){this[_0x172b('0xf')][_0x172b('0x18')](_0x304b96)[_0x172b('0x13')](function(_0x266b13){_0x2d24f9(null,_0x266b13?_0x266b13[_0x172b('0x19')]:![]);})['catch'](function(_0x4edaad){_0x2d24f9(_0x4edaad);});};AGIVertices['prototype']['getUser']=function(_0x13cfc7,_0x4c8090){this[_0x172b('0xf')][_0x172b('0x1a')](_0x13cfc7)[_0x172b('0x13')](function(_0x256fb5){_0x4c8090(null,_0x256fb5?_0x256fb5[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x507b99){_0x4c8090(_0x507b99);});};AGIVertices[_0x172b('0x10')][_0x172b('0x1b')]=function(_0x5ea2b2,_0x3858fc){this[_0x172b('0xf')][_0x172b('0x1c')](_0x5ea2b2)[_0x172b('0x13')](function(_0x356c83){_0x3858fc(null,_0x356c83?_0x356c83[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x5ee442){_0x3858fc(_0x5ee442);});};AGIVertices[_0x172b('0x10')][_0x172b('0x1d')]=function(_0x5c8603,_0x4263a1){var _0x320253=this;this[_0x172b('0xf')][_0x172b('0x1e')](_0x5c8603)[_0x172b('0x13')](function(_0x4bea8e){_0x4263a1(null,_0x4bea8e?_0x320253[_0x172b('0x1f')](_0x4bea8e[_0x172b('0x20')]):![]);})['catch'](function(_0x5db251){_0x4263a1(_0x5db251);});};AGIVertices[_0x172b('0x10')][_0x172b('0x21')]=function(_0x1a80d6,_0x17bce6){this[_0x172b('0xf')][_0x172b('0x22')](_0x1a80d6)[_0x172b('0x13')](function(_0xd4a668){_0x17bce6(null,_0xd4a668?_0xd4a668:![]);})[_0x172b('0x15')](function(_0x239161){_0x17bce6(_0x239161);});};AGIVertices[_0x172b('0x10')][_0x172b('0x23')]=function(_0x289962,_0x30abd3,_0x32e35b){this[_0x172b('0x24')][_0x172b('0x23')](_0x289962,_0x30abd3)[_0x172b('0x13')](function(){_0x32e35b(null);})[_0x172b('0x15')](function(_0x2cd3fd){_0x32e35b(_0x2cd3fd);});};AGIVertices[_0x172b('0x10')][_0x172b('0x25')]=function(_0x1a6707,_0x20f962){this[_0x172b('0xf')]['getIntervalById'](_0x1a6707)[_0x172b('0x13')](function(_0x27e493){if(_0x27e493){if(_0x27e493[_0x172b('0x26')]){_0x20f962(null,[_0x27e493['interval']]);}else{_0x20f962(null,_[_0x172b('0x27')](_0x27e493['Intervals'],'interval'));}}else{_0x20f962(null,![]);}})['catch'](function(_0x1009ae){_0x20f962(_0x1009ae);});};AGIVertices['prototype']['getSoundPath']=function(_0x38e5cb){return util[_0x172b('0x28')](_0x172b('0x29'),FILES_PATH,_0x38e5cb);};AGIVertices['prototype'][_0x172b('0x2a')]=function(_0x1f5516,_0x3ff036,_0x3c0e6a){odbc[_0x172b('0x2b')](_0x1f5516,function(_0x3043ec){if(_0x3043ec){logger[_0x172b('0x2c')](_0x172b('0x2d'),_0x3043ec);_0x3c0e6a(_0x3043ec);}else{logger[_0x172b('0x2e')](_0x172b('0x2f'));odbc[_0x172b('0x30')](_0x3ff036,function(_0x27c5d8,_0x2e45fe){if(_0x27c5d8){logger[_0x172b('0x2e')](_0x172b('0x31'),_0x3ff036);_0x3c0e6a(_0x27c5d8);}else{logger[_0x172b('0x2e')](_0x172b('0x32'),_0x3ff036);odbc[_0x172b('0x33')](function(_0x47821e){if(_0x47821e){logger['error']('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x47821e);}_0x3c0e6a(null,_0x2e45fe);});}});}});};AGIVertices[_0x172b('0x10')]['getSmsAccount']=function(_0x5e8ff6,_0x5321e0){this[_0x172b('0xf')][_0x172b('0x34')](_0x5e8ff6)[_0x172b('0x13')](function(_0x54e62d){_0x5321e0(null,_0x54e62d?_0x54e62d:![]);})[_0x172b('0x15')](function(_0x46d868){_0x5321e0(_0x46d868);});};AGIVertices[_0x172b('0x10')]['createSmsMessage']=function(_0x3cff36,_0x5b2454){this[_0x172b('0xf')][_0x172b('0x35')](_0x3cff36)[_0x172b('0x13')](function(_0xc45ecd){_0x5b2454(null,_0xc45ecd);})[_0x172b('0x15')](function(_0x224c4e){_0x5b2454(_0x224c4e);});};AGIVertices[_0x172b('0x10')]['createSquareDetailsReport']=function(_0x177250,_0x5e036e,_0x370045){this[_0x172b('0xf')][_0x172b('0x36')]({'uniqueid':this[_0x172b('0xe')]['uniqueid'],'node':_0x177250['label'],'application':_0x177250[_0x172b('0x37')],'data':_0x5e036e||null,'project_name':this['channel']['arg_1'],'callerid':this['channel'][_0x172b('0x38')]})[_0x172b('0x13')](function(_0x340bce){if(_0x370045){_0x370045(null,_0x340bce);}})[_0x172b('0x15')](function(_0x4a3e63){if(_0x370045){_0x370045(_0x4a3e63);}});};AGIVertices[_0x172b('0x10')][_0x172b('0x39')]=function(_0x271fc2,_0x17793c,_0x4459d2,_0x464b4d){this[_0x172b('0xf')][_0x172b('0x39')]({'uniqueid':this[_0x172b('0xe')][_0x172b('0x3a')],'callerid':this[_0x172b('0xe')][_0x172b('0x38')],'calleridname':this['channel'][_0x172b('0x3b')],'context':this[_0x172b('0xe')]['context'],'extension':this['channel'][_0x172b('0x3c')],'priority':this[_0x172b('0xe')][_0x172b('0x3d')],'accountcode':this['channel'][_0x172b('0x3e')],'dnid':this['channel']['dnid'],'projectName':this[_0x172b('0xe')][_0x172b('0x3f')],'saveName':_0x17793c,'filename':_0x271fc2[_0x172b('0x40')]||_0x17793c,'savePath':_0x4459d2})[_0x172b('0x13')](function(_0x24ab0c){_0x464b4d(null,_0x24ab0c);})[_0x172b('0x15')](function(_0x3131eb){_0x464b4d(_0x3131eb);});};AGIVertices[_0x172b('0x10')][_0x172b('0x41')]=function(_0x2aeb62,_0x495cca,_0x4c7470,_0x382075,_0x29ee62){this['rpc']['createSquareMessage']({'uniqueid':this[_0x172b('0xe')][_0x172b('0x3a')],'body':_0x2aeb62,'direction':_0x495cca,'providerName':_0x4c7470,'providerResponse':_0x382075})[_0x172b('0x13')](function(_0xe6e09c){if(_0x29ee62){_0x29ee62(null,_0xe6e09c);}})[_0x172b('0x15')](function(_0x1e1793){if(_0x29ee62){_0x29ee62(_0x1e1793);}});};AGIVertices['prototype'][_0x172b('0x42')]=function(_0x5f29d4,_0x5f22eb){this[_0x172b('0xf')][_0x172b('0x42')]({'firstName':_[_0x172b('0x43')](_0x5f29d4['name'])||_[_0x172b('0x44')](_0x5f29d4[_0x172b('0x14')])?_0x172b('0x45')+Math['random']():_0x5f29d4['name'],'lastName':_[_0x172b('0x43')](_0x5f29d4[_0x172b('0x46')])||_[_0x172b('0x44')](_0x5f29d4[_0x172b('0x46')])?null:_0x5f29d4[_0x172b('0x46')],'phone':_0x5f29d4[_0x172b('0x47')],'ListId':_0x5f29d4[_0x172b('0x48')],'scheduledat':_0x5f29d4[_0x172b('0x49')],'callbackUniqueid':this['channel'][_0x172b('0x3a')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x5f29d4[_0x172b('0x49')]['toString'](),'priority':_0x5f29d4[_0x172b('0x4a')]})[_0x172b('0x13')](function(_0xea96a6){_0x5f22eb(null,_0xea96a6);})['catch'](function(_0x2cc8c7){_0x5f22eb(_0x2cc8c7);});};AGIVertices['prototype'][_0x172b('0x4b')]=function(_0x4456b3,_0x567de5){this[_0x172b('0xf')]['getPauseById'](_0x4456b3)[_0x172b('0x13')](function(_0x436ad1){_0x567de5(null,_0x436ad1?_0x436ad1[_0x172b('0x14')]:![]);})[_0x172b('0x15')](function(_0x1831b7){_0x567de5(_0x1831b7);});};AGIVertices['prototype'][_0x172b('0x4c')]=function(_0x151b3b,_0x117afb,_0x23a430){var _0x535c3f={'role':_0x172b('0x4d')};_0x535c3f[_0x151b3b]=this['channel'][_0x172b('0x38')];this[_0x172b('0xf')][_0x172b('0x4c')](_0x535c3f,_0x117afb,this[_0x172b('0xe')][_0x172b('0x3a')])[_0x172b('0x13')](function(_0x595f84){_0x23a430(null,_[_0x172b('0x44')](_0x595f84)?![]:!![]);})[_0x172b('0x15')](function(_0x428b13){logger['error'](_0x428b13);_0x23a430(null,![]);});};AGIVertices[_0x172b('0x10')]['agentUnpause']=function(_0x4eff2b,_0xe975c){var _0x216b6e={'role':_0x172b('0x4d')};_0x216b6e[_0x4eff2b]=this[_0x172b('0xe')][_0x172b('0x38')];this[_0x172b('0xf')][_0x172b('0x4e')](_0x216b6e)[_0x172b('0x13')](function(_0x192cac){_0xe975c(null,_[_0x172b('0x44')](_0x192cac)?![]:!![]);})['catch'](function(_0x3aa5d5){logger[_0x172b('0x2c')](_0x3aa5d5);_0xe975c(null,![]);});};AGIVertices[_0x172b('0x10')][_0x172b('0x4f')]=function(_0x1f1f3c,_0xb4cf50){var _0x32d480={'role':_0x172b('0x4d')};_0x32d480[_0x1f1f3c]=this[_0x172b('0xe')][_0x172b('0x38')];this[_0x172b('0xf')]['agentLogout'](_0x32d480)[_0x172b('0x13')](function(_0x248b32){_0xb4cf50(null,_[_0x172b('0x44')](_0x248b32)?![]:!![]);})[_0x172b('0x15')](function(_0x28f620){logger[_0x172b('0x2c')](_0x28f620);_0xb4cf50(null,![]);});};AGIVertices['prototype'][_0x172b('0x50')]=function(_0x27d20f,_0x3999dc){var _0x114317={'role':_0x172b('0x4d')};_0x114317[_0x27d20f]=this[_0x172b('0xe')][_0x172b('0x38')];var _0x5728d3=_0x27d20f!='internal'?util[_0x172b('0x28')](_0x172b('0x51'),_0x172b('0x52'),this[_0x172b('0xe')][_0x172b('0x38')]):undefined;this['rpc'][_0x172b('0x50')](_0x114317,_0x5728d3)[_0x172b('0x13')](function(_0x493d1d){_0x3999dc(null,_[_0x172b('0x44')](_0x493d1d)?![]:!![]);})[_0x172b('0x15')](function(_0x49cb5b){logger[_0x172b('0x2c')](_0x49cb5b);_0x3999dc(null,![]);});};AGIVertices[_0x172b('0x10')][_0x172b('0x53')]=function(_0x3d7494,_0x52b76e){sh[_0x172b('0x54')](_[_0x172b('0x55')](_0x3d7494),function(_0x4a36d2,_0x8217d5){var _0x4f0ca0=_0x8217d5[_0x172b('0x56')](/(\r\n|\n|\r)/gm,'');_0x52b76e(null,_0x4f0ca0);});};AGIVertices[_0x172b('0x10')]['googleCloudTTS']=function(_0xc173d9,_0x1527f9){scripts[_0x172b('0x57')](_0xc173d9[_0x172b('0x58')],_0xc173d9[_0x172b('0x59')]||'text',_0xc173d9[_0x172b('0x5a')],_0xc173d9[_0x172b('0x5b')]||'en-US',_0xc173d9['ssmlGender']||_0x172b('0x5c'),_0xc173d9[_0x172b('0x5d')]||'MP3')[_0x172b('0x13')](function(_0x2a2a1c){_0x1527f9(null,_0x2a2a1c);})[_0x172b('0x15')](function(_0xf51434){_0x1527f9(_0xf51434);});};AGIVertices[_0x172b('0x10')]['googleTTS']=function(_0x5ceeee,_0x5a84eb){scripts['googleTTS'](_0x5ceeee['text'],_0x5ceeee[_0x172b('0x5e')]||'en',0x1)[_0x172b('0x13')](function(_0x5d278e){_0x5a84eb(null,_0x5d278e);})[_0x172b('0x15')](function(_0x10d665){_0x5a84eb(_0x10d665);});};AGIVertices[_0x172b('0x10')][_0x172b('0x5f')]=function(_0x1d7de8,_0x21e7cb){var _0x5aca7f={'uri':_0x1d7de8[_0x172b('0x60')],'method':_0x1d7de8[_0x172b('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x1d7de8[_0x172b('0x62')])===_0x172b('0x63')&&parseInt(_0x1d7de8[_0x172b('0x62')])>=0x1?parseInt(_0x1d7de8[_0x172b('0x62')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x172b('0x64'),_0x172b('0x65')],_0x5aca7f[_0x172b('0x61')][_0x172b('0x66')]())){try{_0x5aca7f['body']=_0x1d7de8[_0x172b('0x67')]?JSON['parse'](_0x1d7de8[_0x172b('0x67')]):{};}catch(_0x4395a4){logger[_0x172b('0x2c')](_0x172b('0x68'),_0x4395a4);}}try{_0x5aca7f[_0x172b('0x69')]=_0x1d7de8[_0x172b('0xb')]?JSON[_0x172b('0x6a')](_0x1d7de8[_0x172b('0xb')]):{};}catch(_0x18d283){logger['error'](_0x172b('0x6b'),_0x18d283);}if(_0x1d7de8['computedVariables']){try{var _0x14b45a=require(_0x1d7de8[_0x172b('0x6c')])[_0x172b('0x6d')](this,_0x5aca7f);_0x5aca7f[_0x172b('0x6e')]=Mustache[_0x172b('0x6f')](_0x1d7de8['url'],_0x14b45a,{},['$$','$$']);if(_0x5aca7f[_0x172b('0x69')]){_0x5aca7f[_0x172b('0x69')]=JSON['parse'](Mustache[_0x172b('0x6f')](JSON[_0x172b('0x70')](_0x5aca7f[_0x172b('0x69')]),_0x14b45a,{},['$$','$$']));}if(_0x5aca7f['body']){_0x5aca7f[_0x172b('0x71')]=JSON[_0x172b('0x6a')](Mustache[_0x172b('0x6f')](JSON[_0x172b('0x70')](_0x5aca7f[_0x172b('0x71')]),_0x14b45a,{},['$$','$$']));}}catch(_0x297a90){logger[_0x172b('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x297a90);}}rp(_0x5aca7f)[_0x172b('0x13')](function(_0x28cfb1){var _0x3de80c={'statusCode':_0x28cfb1[_0x172b('0x72')]||0xc8,'statusMessage':_0x28cfb1[_0x172b('0x73')]||'OK','headers':_0x28cfb1[_0x172b('0x69')]||{},'body':_0x28cfb1[_0x172b('0x71')]||{}};_0x21e7cb(null,_0x3de80c);})[_0x172b('0x15')](function(_0x4d1c19){var _0x13403a={'statusCode':_0x4d1c19[_0x172b('0x72')]||0x1f4,'statusMessage':_0x4d1c19[_0x172b('0x74')]||_0x172b('0x75'),'headers':_0x4d1c19[_0x172b('0x76')][_0x172b('0x69')]||{},'body':_0x4d1c19[_0x172b('0x76')][_0x172b('0x71')]||{}};_0x21e7cb(null,_0x13403a);});};AGIVertices[_0x172b('0x10')][_0x172b('0x77')]=function(_0x14bf75,_0x5650d8){scripts['googleDialogflow'](this['channel'][_0x172b('0x3a')],_0x14bf75[_0x172b('0x78')],_0x14bf75['text'],_0x14bf75['dialogflow_language']||'en')['then'](function(_0x304086){_0x5650d8(null,_0x304086);})[_0x172b('0x15')](function(_0x2afc0a){_0x5650d8(_0x2afc0a);});};AGIVertices['prototype'][_0x172b('0x79')]=function(_0x400871,_0x465847){scripts[_0x172b('0x79')](this[_0x172b('0xe')]['uniqueid'],_0x400871['dialogflowV2_project_id'],_0x400871[_0x172b('0x7a')],_0x400871['private_key'],_0x400871[_0x172b('0x5a')],_0x400871[_0x172b('0x7b')]||'en')[_0x172b('0x13')](function(_0x158649){_0x465847(null,_0x158649);})['catch'](function(_0x4c3b26){_0x465847(_0x4c3b26);});};AGIVertices[_0x172b('0x10')]['sestekNDA']=function(_0x5e277d,_0x504fa6){scripts[_0x172b('0x7c')](this[_0x172b('0xe')],_0x5e277d)[_0x172b('0x13')](function(_0x13b174){_0x504fa6(null,_0x13b174);})['catch'](function(_0xbcbfb5){_0x504fa6(_0xbcbfb5);});};AGIVertices['prototype'][_0x172b('0x7d')]=function(_0x431f24,_0x4be1c4){scripts[_0x172b('0x7d')](_0x431f24[_0x172b('0x78')],_0x431f24[_0x172b('0x5a')],_0x431f24['ispeech_tts_language']||_0x172b('0x7e'),_0x431f24['speed'])[_0x172b('0x13')](function(_0x2407f3){_0x4be1c4(null,_0x2407f3);})['catch'](function(_0x4e119b){_0x4be1c4(_0x4e119b);});};AGIVertices['prototype'][_0x172b('0x7f')]=function(_0x2d2af4,_0x89a77,_0x2ec91d){scripts[_0x172b('0x7f')](_0x89a77,_0x2d2af4['key'],_0x2d2af4[_0x172b('0x80')]||_0x172b('0x7e'),this[_0x172b('0x81')](_0x2d2af4[_0x172b('0x82')])?_0x2d2af4['model']:undefined)[_0x172b('0x13')](function(_0x3b567b){_0x2ec91d(null,_0x3b567b);})[_0x172b('0x15')](function(_0x35e5e4){_0x2ec91d(_0x35e5e4);});};AGIVertices[_0x172b('0x10')]['awsPolly']=function(_0x47331d,_0x147422){scripts[_0x172b('0x83')](_0x47331d[_0x172b('0x84')],_0x47331d[_0x172b('0x85')],_0x47331d[_0x172b('0x86')],_0x47331d[_0x172b('0x87')]||'Amy',_0x47331d[_0x172b('0x5a')],_0x47331d[_0x172b('0x88')]||'text')[_0x172b('0x13')](function(_0x7c5b38){_0x147422(null,_0x7c5b38);})[_0x172b('0x15')](function(_0x38ff90){_0x147422(_0x38ff90);});};AGIVertices[_0x172b('0x10')]['awsLex']=function(_0x269630,_0x4007d9){scripts[_0x172b('0x89')](this[_0x172b('0xe')][_0x172b('0x3a')],_0x269630['aws_access_key_id'],_0x269630[_0x172b('0x85')],_0x269630[_0x172b('0x8a')],_0x269630[_0x172b('0x5a')],_0x269630[_0x172b('0x8b')])['then'](function(_0x1c3c5d){_0x4007d9(null,_0x1c3c5d);})[_0x172b('0x15')](function(_0x4f0025){_0x4007d9(_0x4f0025);});};AGIVertices[_0x172b('0x10')]['googleASR']=function(_0xec6d1b,_0x2e6d4a,_0x43fc98){scripts[_0x172b('0x8c')](_0x2e6d4a,_0xec6d1b['key'],_0xec6d1b[_0x172b('0x8d')]||'en-US')[_0x172b('0x13')](function(_0x2fdcb8){_0x43fc98(null,_0x2fdcb8);})['catch'](function(_0x3fa922){_0x43fc98(_0x3fa922);});};AGIVertices[_0x172b('0x10')]['tildeASR']=function(_0x2720e,_0x461061,_0x4ad498){scripts[_0x172b('0x8e')](_0x461061,_0x2720e[_0x172b('0x8f')],_0x2720e[_0x172b('0x90')],_0x2720e[_0x172b('0x6e')])[_0x172b('0x13')](function(_0xb033a8){_0x4ad498(null,_0xb033a8);})[_0x172b('0x15')](function(_0xbed80a){_0x4ad498(_0xbed80a);});};AGIVertices[_0x172b('0x10')]['clear']=function(_0x39a707){var _0x36d5a4=_[_0x172b('0x91')](verticesWithRetry,_0x39a707[_0x172b('0x37')])?_0x39a707:_[_0x172b('0x92')](_0x39a707);for(var _0x480be5 in _0x36d5a4){if(_0x36d5a4[_0x172b('0x93')](_0x480be5)){if(_0x36d5a4[_0x480be5]&&_[_0x172b('0x94')](_0x36d5a4[_0x480be5])){if(_[_0x172b('0x91')](recursiveMapAttributes,_0x480be5)){_0x36d5a4[_0x480be5]=this[_0x172b('0x95')](_0x36d5a4[_0x480be5]);}else{_0x36d5a4[_0x480be5]=this[_0x172b('0x96')](_0x36d5a4[_0x480be5]);}}}}return _0x36d5a4;};AGIVertices['prototype'][_0x172b('0x97')]=function(_0xcff71c){for(var _0x167286 in _0xcff71c){if(_0xcff71c['hasOwnProperty'](_0x167286)){if(_[_0x172b('0x98')](_0xcff71c[_0x167286])){this[_0x172b('0x97')](_0xcff71c[_0x167286]);}else if(_[_0x172b('0x99')](_0xcff71c[_0x167286])){for(var _0x525464=0x0;_0x525464<_0xcff71c[_0x167286][_0x172b('0x9a')];_0x525464++){this[_0x172b('0x97')](_0xcff71c[_0x167286][_0x525464]);}}else if(_[_0x172b('0x94')](_0xcff71c[_0x167286])){_0xcff71c[_0x167286]=this[_0x172b('0x96')](_0xcff71c[_0x167286]);}}}};AGIVertices[_0x172b('0x10')]['saveRestApiResult']=function(_0x41a9a4,_0x44fa8e){for(var _0x251df0 in _0x41a9a4){if(_0x41a9a4[_0x172b('0x93')](_0x251df0)){if(_[_0x172b('0x98')](_0x41a9a4[_0x251df0])){if(!_[_0x172b('0x43')](_0x41a9a4[_0x251df0])){this[_0x172b('0x9b')](_0x41a9a4[_0x251df0],util['format'](_0x172b('0x9c'),_0x44fa8e,_0x251df0));}}else if(_[_0x172b('0x99')](_0x41a9a4[_0x251df0])){for(var _0x3d8dd1=0x0;_0x3d8dd1<_0x41a9a4[_0x251df0]['length'];_0x3d8dd1++){this['saveRestApiResult'](_0x41a9a4[_0x251df0][_0x3d8dd1],util[_0x172b('0x28')]('%s.%s',_0x44fa8e,_0x251df0+'['+_0x3d8dd1+']'));}}else{if(!_[_0x172b('0x44')](_0x41a9a4[_0x251df0])){this['channel'][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0x9c'),_0x44fa8e,_0x251df0),_0x41a9a4[_0x251df0]);}}}}};AGIVertices['prototype'][_0x172b('0x95')]=function(_0x2234cc){try{var _0x2981d3=JSON[_0x172b('0x6a')](_0x2234cc);this[_0x172b('0x97')](_0x2981d3);return JSON[_0x172b('0x70')](_0x2981d3);}catch(_0x5227b2){return this[_0x172b('0x96')](_0x2234cc);}};AGIVertices[_0x172b('0x10')][_0x172b('0x96')]=function(_0x3c93f2){var _0xd06ce7=_0x3c93f2[_0x172b('0x9e')]('{');for(var _0x302af1=0x1;_0x302af1<_0xd06ce7['length'];_0x302af1+=0x1){var _0x22100f=_0xd06ce7[_0x302af1]['split']('}');if(_0x22100f[_0x172b('0x9a')]>0x1){_0x3c93f2=_0x3c93f2[_0x172b('0x9f')]('{'+_0x22100f[0x0]+'}',this['channel'][_0x172b('0x11')](_0x22100f[0x0])['extra']||_0x22100f[0x0]);}}if(_0xd06ce7[_0x172b('0x9a')]===0x1){return _0x3c93f2[_0x172b('0xa0')]();}return this[_0x172b('0x96')](_0x3c93f2);};AGIVertices[_0x172b('0x10')][_0x172b('0xa1')]=function(_0x19c318,_0x3a3626){var _0x688079=this[_0x172b('0xe')]['getVariable'](_0x19c318);if(_0x688079['result']===-0x1){return _0x688079;}logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xa2'),_0x3a3626,_0x688079[_0x172b('0xa3')]));return this[_0x172b('0xe')]['setVariable'](_0x3a3626,_0x688079[_0x172b('0xa3')]);};AGIVertices['prototype'][_0x172b('0x81')]=function(_0x3fb683){return _0x3fb683&&_0x3fb683!=='0'&&_0x3fb683!=='-1'&&_0x3fb683!=='';};AGIVertices[_0x172b('0x10')][_0x172b('0xa4')]=function(_0x2ac8de){this['createSquareDetailsReport'][_0x172b('0x6d')](this,_0x2ac8de,'-');_0x2ac8de[_0x172b('0xa5')]=_0x2ac8de[_0x172b('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x172b('0x10')][_0x172b('0xa6')]=function(_0xda2b81){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xa7'),_0xda2b81[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0xda2b81['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}var _0x4fc108='\x22'+_0xda2b81[_0x172b('0x5a')]+'\x22';if(this[_0x172b('0x81')](_0xda2b81[_0x172b('0x76')])){_0x4fc108+=','+_0xda2b81[_0x172b('0x76')];}var _0x2ef854=this['channel'][_0x172b('0x54')]('MRCPSynth',_0x4fc108);if(_0x2ef854[_0x172b('0xab')]===-0x1){return _0x2ef854;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xac'),_0x4fc108));};AGIVertices[_0x172b('0x10')]['mrcprecog']=function(_0x320f83){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x320f83[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x320f83[_0x172b('0xad')])){return this[_0x172b('0xe')]['noop'](_0x172b('0xae'));}var _0x106e9c=_0x320f83['grammar'];if(this[_0x172b('0x81')](_0x320f83[_0x172b('0x76')])){_0x106e9c+=','+_0x320f83[_0x172b('0x76')];}var _0x2f7abc=this[_0x172b('0xe')]['exec'](_0x172b('0xaf'),_0x106e9c);if(_0x2f7abc[_0x172b('0xab')]===-0x1){return _0x2f7abc;}var _0x2a3d38=this[_0x172b('0xa1')](_0x172b('0xb0'),'MRCP_RECOG_CONFIDENCE');if(_0x2a3d38['result']===-0x1){return _0x2a3d38;}var _0x1ff832=this[_0x172b('0xa1')]('RECOG_INPUT()',_0x172b('0xb1'));if(_0x1ff832['result']===-0x1){return _0x1ff832;}var _0x2b5956=this[_0x172b('0xa1')](_0x172b('0xb2'),_0x172b('0xb3'));if(_0x2b5956['result']===-0x1){return _0x2b5956;}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')]('Executed\x20command\x20MRCPRecog\x20%s',_0x106e9c));};AGIVertices['prototype'][_0x172b('0xb4')]=function(_0x2618ab){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xb5'),_0x2618ab[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0xb4')]([_0x2618ab[_0x172b('0xb6')],_0x2618ab[_0x172b('0xb7')]]);};AGIVertices[_0x172b('0x10')][_0x172b('0xb8')]=function(_0x15295a){logger[_0x172b('0x2e')](util['format'](_0x172b('0xb9'),_0x15295a[_0x172b('0xa8')]));if(this[_0x172b('0x81')](_0x15295a[_0x172b('0x62')])){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Wait\x20%s\x20seconds\x20before\x20answer',_0x15295a[_0x172b('0x62')]));var _0x3c1e6d=this[_0x172b('0xe')][_0x172b('0xba')](_0x15295a[_0x172b('0x62')]);if(_0x3c1e6d[_0x172b('0xab')]===-0x1){return _0x3c1e6d;}}return this[_0x172b('0xe')]['answer']();};AGIVertices[_0x172b('0x10')][_0x172b('0xbb')]=function(_0x1f4d11){logger['info'](util[_0x172b('0x28')](_0x172b('0xbc'),_0x1f4d11[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x1f4d11[_0x172b('0x48')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x1f4d11,_0x172b('0xbd'));}_0x1f4d11[_0x172b('0x49')]=moment();if(this[_0x172b('0x81')](_0x1f4d11[_0x172b('0xbe')])){_0x1f4d11[_0x172b('0x49')]=moment()[_0x172b('0xbf')](_0x1f4d11['delay'],_0x172b('0xc0'));}if(!this[_0x172b('0x81')](_0x1f4d11['callback_priority'])){_0x1f4d11['callback_priority']=0x2;}this[_0x172b('0x42')][_0x172b('0x6d')](this,_0x1f4d11);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xc1'),_0x1f4d11[_0x172b('0x47')],_0x1f4d11[_0x172b('0x48')],_0x1f4d11['scheduledAt']));};AGIVertices['prototype'][_0x172b('0xc2')]=function(_0x3e35cb){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xc3'),_0x3e35cb[_0x172b('0xa8')]));var _0x5df397=this[_0x172b('0xe')]['exec'](_0x3e35cb[_0x172b('0xc4')],_0x3e35cb[_0x172b('0x76')]);if(_0x5df397[_0x172b('0xab')]===-0x1){return _0x5df397;}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')]('Executed\x20command\x20%s\x20%s',_0x3e35cb[_0x172b('0xc4')],_0x3e35cb[_0x172b('0x76')]));};AGIVertices[_0x172b('0x10')]['lumenvoxtts']=function(_0x405339){logger['info'](util[_0x172b('0x28')](_0x172b('0xc5'),_0x405339[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x405339[_0x172b('0x5a')])){return this[_0x172b('0xe')]['noop']('no\x20text\x20configured');}var _0x1d3abe='\x22'+_0x405339[_0x172b('0x5a')]+'\x22';if(this[_0x172b('0x81')](_0x405339[_0x172b('0x76')])){_0x1d3abe+=','+_0x405339[_0x172b('0x76')];}var _0x4baa17=this[_0x172b('0xe')][_0x172b('0x54')]('MRCPSynth',_0x1d3abe);if(_0x4baa17['result']===-0x1){return _0x4baa17;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xac'),_0x1d3abe));};AGIVertices[_0x172b('0x10')][_0x172b('0xc6')]=function(_0x5a3d03){logger['info'](util[_0x172b('0x28')](_0x172b('0xc7'),_0x5a3d03[_0x172b('0xa8')]));if(!this['isConfigured'](_0x5a3d03['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}var _0x5a0e3d='\x22'+_0x5a3d03[_0x172b('0x5a')]+'\x22';if(this['isConfigured'](_0x5a3d03[_0x172b('0x76')])){_0x5a0e3d+=','+_0x5a3d03[_0x172b('0x76')];}var _0x3114c3=this[_0x172b('0xe')][_0x172b('0x54')]('MRCPSynth',_0x5a0e3d);if(_0x3114c3[_0x172b('0xab')]===-0x1){return _0x3114c3;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xac'),_0x5a0e3d));};AGIVertices[_0x172b('0x10')][_0x172b('0xc8')]=function(_0x298ece){logger[_0x172b('0x2e')](util['format'](_0x172b('0xc9'),_0x298ece[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x298ece[_0x172b('0xad')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xae'));}var _0x20a31c=_0x298ece[_0x172b('0xad')];if(this[_0x172b('0x81')](_0x298ece['options'])){_0x20a31c+=','+_0x298ece[_0x172b('0x76')];}var _0x201495=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0xaf'),_0x20a31c);if(_0x201495[_0x172b('0xab')]===-0x1){return _0x201495;}var _0x5d74de=this['getAndSetVariable'](_0x172b('0xb0'),'LUMENVOX_ASR_CONFIDENCE');if(_0x5d74de[_0x172b('0xab')]===-0x1){return _0x5d74de;}var _0x556af6=this[_0x172b('0xa1')](_0x172b('0xca'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x556af6[_0x172b('0xab')]===-0x1){return _0x556af6;}var _0x5eb774=this['getAndSetVariable']('RECOG_INSTANCE()',_0x172b('0xcb'));if(_0x5eb774[_0x172b('0xab')]===-0x1){return _0x5eb774;}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xcc'),_0x20a31c));};AGIVertices[_0x172b('0x10')][_0x172b('0xcd')]=function(_0x11bc2b){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xce'),_0x11bc2b[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x11bc2b[_0x172b('0xad')])){return this['channel'][_0x172b('0xa9')]('no\x20grammar\x20configured');}var _0x3cab89=_0x11bc2b[_0x172b('0xad')];if(this[_0x172b('0x81')](_0x11bc2b['options'])){_0x3cab89+=','+_0x11bc2b[_0x172b('0x76')];}var _0x347c7b=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0xaf'),_0x3cab89);if(_0x347c7b[_0x172b('0xab')]===-0x1){return _0x347c7b;}var _0x2f89f8=this['getAndSetVariable'](_0x172b('0xb0'),_0x172b('0xcf'));if(_0x2f89f8[_0x172b('0xab')]===-0x1){return _0x2f89f8;}var _0x17806c=this[_0x172b('0xa1')](_0x172b('0xca'),'SESTEK_ASR_TRANSCRIPT');if(_0x17806c['result']===-0x1){return _0x17806c;}var _0x2de66d=this['getAndSetVariable'](_0x172b('0xb2'),'SESTEK_ASR_INSTANCE');if(_0x2de66d['result']===-0x1){return _0x2de66d;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xcc'),_0x3cab89));};AGIVertices[_0x172b('0x10')]['database']=function(_0x5b86a0){logger['info'](util[_0x172b('0x28')]('Enter\x20in\x20DATABASE\x20(%s)\x20block',_0x5b86a0[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x5b86a0['odbc_id'])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x5b86a0,_0x172b('0xd0'));}var _0x1594f3=this[_0x172b('0xd1')]['sync'](this,_0x5b86a0[_0x172b('0xd2')]);if(!_0x1594f3){return this['channel'][_0x172b('0x2c')](_0x5b86a0,_0x172b('0xd3'));}if(!this[_0x172b('0x81')](_0x5b86a0[_0x172b('0x30')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x5b86a0,_0x172b('0xd4'));}var _0x39abd7=_0x5b86a0[_0x172b('0x30')][_0x172b('0x56')](/(\r\n|\n|\r)/gm,'\x20');this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xd5'),_0x39abd7));var _0x117828=this['getQueryOdbc'][_0x172b('0x6d')](this,_0x1594f3,_0x39abd7);this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x5b86a0,_0x39abd7);if(!this[_0x172b('0x81')](_0x5b86a0[_0x172b('0xd6')])){return this[_0x172b('0xe')]['noop'](_0x172b('0xd7'));}var _0x3dd9e4=this['getVariable'][_0x172b('0x6d')](this,_0x5b86a0['variable_id']);if(!_0x3dd9e4){return this[_0x172b('0xe')]['error'](_0x5b86a0,'no\x20variable\x20found');}var _0x292d70=this;_0x117828[_0x172b('0xd8')](function(_0x55b36d,_0x46eaa4){Object[_0x172b('0xd9')](_0x55b36d)[_0x172b('0xd8')](function(_0x4d67ba){_0x292d70[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0xda'),_0x3dd9e4,_0x46eaa4,_0x4d67ba),_0x55b36d[_0x4d67ba]);});});this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0xdb'),_0x3dd9e4),_0x117828[_0x172b('0x9a')]);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xdc'),_0x3dd9e4));};AGIVertices['prototype'][_0x172b('0xdd')]=function(_0x25c024){logger[_0x172b('0xde')](util[_0x172b('0x28')](_0x172b('0xdf'),_0x25c024['label']));if(!this[_0x172b('0x81')](_0x25c024[_0x172b('0xe0')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x25c024,_0x172b('0xe1'));}var _0x31b436=this[_0x172b('0xe2')][_0x172b('0x6d')](this,_0x25c024['sip_id']);if(!_0x31b436){return this[_0x172b('0xe')]['error'](_0x25c024,'no\x20user\x20found');}var _0x1959dc=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0xe3'),[util[_0x172b('0x28')](_0x172b('0xe4'),_0x31b436),_0x25c024[_0x172b('0x62')],_0x25c024[_0x172b('0xe5')],_0x25c024['url']]);if(_0x1959dc[_0x172b('0xab')]===-0x1){return _0x1959dc;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0xe6'),_0x172b('0xe3')));};AGIVertices[_0x172b('0x10')][_0x172b('0xe7')]=function(_0xdf3b3f){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xe8'),_0xdf3b3f[_0x172b('0xa8')]));if(!this['isConfigured'](_0xdf3b3f[_0x172b('0x78')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xe9'));}if(!this['isConfigured'](_0xdf3b3f[_0x172b('0x5a')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20text\x20configured');}this['channel'][_0x172b('0xea')]=!![];this[_0x172b('0x36')](_0xdf3b3f);this['createSquareMessage'](_0xdf3b3f[_0x172b('0x5a')],'in','','');this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xeb'),_0xdf3b3f[_0x172b('0x5a')]));var _0x6f589e=this[_0x172b('0x77')]['sync'](this,_0xdf3b3f);if(_0x6f589e){for(var _0x26d6a8 in _0x6f589e){if(_0x6f589e[_0x172b('0x93')](_0x26d6a8)){this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0xec'),_0x26d6a8['toUpperCase']()),_0x6f589e[_0x26d6a8]);}}this[_0x172b('0x41')](_0x6f589e[_0x172b('0xed')],_0x172b('0xee'),_0x172b('0xe7'),'');return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xef'),_0x6f589e['speech']));}return this[_0x172b('0xe')][_0x172b('0x2c')](_0xdf3b3f,_0x172b('0xf0'));};AGIVertices[_0x172b('0x10')][_0x172b('0xf1')]=function(_0x4e2647){logger['info'](util[_0x172b('0x28')](_0x172b('0xf2'),_0x4e2647['label']));if(!this[_0x172b('0x81')](_0x4e2647['dialogflowV2_project_id'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf3'));}if(!this[_0x172b('0x81')](_0x4e2647[_0x172b('0x7a')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf4'));}if(!this[_0x172b('0x81')](_0x4e2647[_0x172b('0xf5')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf6'));}if(!this[_0x172b('0x81')](_0x4e2647[_0x172b('0x7b')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xf7'));}if(!this[_0x172b('0x81')](_0x4e2647['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}this['channel']['bot']=!![];this[_0x172b('0x36')](_0x4e2647);this[_0x172b('0x41')](_0x4e2647[_0x172b('0x5a')],'in','','');this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0xf8'),_0x4e2647['text']));var _0xbe95c9=this[_0x172b('0x79')]['sync'](this,_0x4e2647);if(_0xbe95c9){for(var _0x42929a in _0xbe95c9){if(_0xbe95c9[_0x172b('0x93')](_0x42929a)){if(_0x42929a!==_0x172b('0xf9')){this[_0x172b('0xe')]['setVariable'](util[_0x172b('0x28')]('DIALOGFLOW_%s',_0x42929a[_0x172b('0x66')]()),_0xbe95c9[_0x42929a]);}}}this[_0x172b('0x41')](_0xbe95c9['speech'],_0x172b('0xee'),_0x172b('0xf1'),_0xbe95c9[_0x172b('0xf9')]);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xfa'),_0xbe95c9[_0x172b('0xed')]));}return this['channel'][_0x172b('0x2c')](_0x4e2647,_0x172b('0xfb'));};AGIVertices[_0x172b('0x10')][_0x172b('0xfc')]=function(_0xe538e9){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0xfd'),_0xe538e9[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0xe538e9[_0x172b('0xfe')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xff'));}if(!this[_0x172b('0x81')](_0xe538e9['username'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x100'));}if(!this[_0x172b('0x81')](_0xe538e9[_0x172b('0x101')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20password\x20configured');}if(!this[_0x172b('0x81')](_0xe538e9['ndassistant_url'])){return this[_0x172b('0xe')]['noop'](_0x172b('0xaa'));}this[_0x172b('0xe')]['bot']=!![];this[_0x172b('0x36')](_0xe538e9);this['createSquareMessage'](_0xe538e9[_0x172b('0x5a')],'in','','');this['channel'][_0x172b('0xa9')](util['format'](_0x172b('0x102'),_0xe538e9[_0x172b('0x5a')]));var _0x50efdd=this['sestekNDA'][_0x172b('0x6d')](this,_0xe538e9);if(_0x50efdd){for(var _0x281e28 in _0x50efdd){if(_0x50efdd[_0x172b('0x93')](_0x281e28)){this[_0x172b('0xe')][_0x172b('0x9d')](util['format'](_0x172b('0x103'),_0x281e28[_0x172b('0x66')]()),_0x50efdd[_0x281e28]);}}this['createSquareMessage'](_0x50efdd[_0x172b('0xed')],_0x172b('0xee'),_0x172b('0xfc'),'');if(_0x50efdd[_0x172b('0x104')]){this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x105'),_0x50efdd['audiofile']));var _0x37f79a=this[_0x172b('0xe')][_0x172b('0x106')](_0x50efdd[_0x172b('0x104')]);try{fs[_0x172b('0x107')](_0x50efdd[_0x172b('0x104')]+_0x172b('0x108'));}catch(_0x22b7ca){logger[_0x172b('0x2c')](_0x22b7ca);}return _0x37f79a;}else{return this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x109'),_0x50efdd['speech']));}}return this[_0x172b('0xe')][_0x172b('0x2c')](_0xe538e9,_0x172b('0x10a'));};AGIVertices[_0x172b('0x10')][_0x172b('0x10b')]=function(_0x1d791e){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x10c'),_0x1d791e['label']));return this[_0x172b('0xe')]['noop'](_0x172b('0x10b'));};AGIVertices[_0x172b('0x10')]['ext_dial']=function(_0x4d5557){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x10d'),_0x4d5557[_0x172b('0xa8')]));var _0x2d6eca='';if(_0x4d5557[_0x172b('0x10e')]){if(!this['isConfigured'](_0x4d5557['trunk_id'])){return this[_0x172b('0xe')]['error'](_0x4d5557,'no\x20trunk\x20selected');}else{var _0x48b3d6=parseInt(_0x4d5557[_0x172b('0x10e')],0xa);if(isNaN(_0x48b3d6)){_0x2d6eca=_0x4d5557[_0x172b('0x10e')];}else{_0x2d6eca=this[_0x172b('0x1b')][_0x172b('0x6d')](this,_0x4d5557[_0x172b('0x10e')]);if(!_0x2d6eca){return this[_0x172b('0xe')]['error'](_0x4d5557,'no\x20trunk\x20found');}}}}else if(_0x4d5557[_0x172b('0x10f')]){_0x2d6eca=_0x4d5557[_0x172b('0x10f')];}else{return this[_0x172b('0xe')]['error'](_0x4d5557,_0x172b('0x110'));}var _0x3e9e4b=this[_0x172b('0xe')]['exec']('DIAL',[util['format'](_0x172b('0x111'),_0x2d6eca,_0x4d5557[_0x172b('0x47')]),_0x4d5557[_0x172b('0x62')],_0x4d5557[_0x172b('0xe5')],_0x4d5557[_0x172b('0x60')]]);if(_0x3e9e4b['result']===-0x1){return _0x3e9e4b;}return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xe6'),_0x172b('0xe3')));};AGIVertices[_0x172b('0x10')][_0x172b('0x112')]=function(_0x19cb81){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x113'),_0x19cb81['label']));return this[_0x172b('0xe')][_0x172b('0xa9')]('finally');};AGIVertices[_0x172b('0x10')][_0x172b('0x114')]=function(_0x1d47dc){logger['info'](util[_0x172b('0x28')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x1d47dc['label']));if(_0x1d47dc[_0x172b('0xa5')]===0x0){return this[_0x172b('0xa4')](_0x1d47dc);}_0x1d47dc['retry']-=0x1;if(!this['isConfigured'](_0x1d47dc[_0x172b('0x115')])){return this['channel'][_0x172b('0x2c')](_0x1d47dc,_0x172b('0x116'));}var _0x461e16=this[_0x172b('0x1d')][_0x172b('0x6d')](this,_0x1d47dc[_0x172b('0x115')]);if(!_0x461e16){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x1d47dc,_0x172b('0x117'));}if(!this[_0x172b('0x81')](_0x1d47dc[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0x2c')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x459d41=this[_0x172b('0xe')][_0x172b('0x118')](_0x461e16,_0x1d47dc[_0x172b('0x119')],_0x1d47dc[_0x172b('0x11a')]);var _0x14d545=_0x459d41[_0x172b('0xab')]?_0x459d41[_0x172b('0xab')]['toString']():'';logger[_0x172b('0x2e')]('test',JSON['stringify'](_0x459d41));if(_0x459d41[_0x172b('0xab')]===-0x1){this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x1d47dc,_0x14d545);return _0x459d41;}else if(_0x459d41[_0x172b('0xa3')]===_0x172b('0x62')){_0x459d41[_0x172b('0xab')]=_0x14d545[_0x172b('0x9a')]>=parseInt(_0x1d47dc[_0x172b('0x11b')])?'x':'i';}else{_0x459d41[_0x172b('0xab')]=_0x14d545['length']>=parseInt(_0x1d47dc[_0x172b('0x11b')])&&_0x14d545[_0x172b('0x9a')]<=parseInt(_0x1d47dc[_0x172b('0x11a')])?'x':'i';}var _0x2d34d2=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0x1d47dc[_0x172b('0xd6')]);if(!_0x2d34d2){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x1d47dc,_0x172b('0x11c'));}this[_0x172b('0xe')][_0x172b('0x9d')](_0x2d34d2,_0x14d545);if(this[_0x172b('0x81')](_0x1d47dc[_0x172b('0x11d')])){var _0x5988b8=parseInt(_0x1d47dc[_0x172b('0x11d')],0xa);var _0x3e6594=rs['generate']({'charset':'*','length':_0x5988b8});var _0xf78999=_0x14d545[_0x172b('0x9a')];if(_0xf78999>0x0){if(_0xf78999>_0x5988b8){this['createSquareDetailsReport']['sync'](this,_0x1d47dc,_0x1d47dc[_0x172b('0x11e')]===_0x172b('0x11f')?_0x3e6594+_0x14d545[_0x172b('0x120')](_0x5988b8):_0x14d545[_0x172b('0x120')](0x0,_0xf78999-_0x5988b8)+_0x3e6594);}else{this[_0x172b('0x36')]['sync'](this,_0x1d47dc,rs[_0x172b('0x121')]({'charset':'*','length':_0xf78999}));}}else{this['createSquareDetailsReport']['sync'](this,_0x1d47dc,'');}}else{this['createSquareDetailsReport'][_0x172b('0x6d')](this,_0x1d47dc,_0x14d545);}return _0x459d41;};AGIVertices[_0x172b('0x10')][_0x172b('0xd')]=function(_0x4c2f41){logger[_0x172b('0x2e')](util['format'](_0x172b('0x122'),_0x4c2f41[_0x172b('0xa8')]));return this[_0x172b('0x114')](_0x4c2f41);};AGIVertices[_0x172b('0x10')][_0x172b('0x123')]=function(_0x392f65){logger[_0x172b('0x2e')](util['format'](_0x172b('0x124'),_0x392f65[_0x172b('0xa8')]));this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x392f65,_0x392f65[_0x172b('0x125')]);return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x126'),_0x392f65[_0x172b('0x125')]));};AGIVertices[_0x172b('0x10')]['awspolly']=function(_0xd7b8fc){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0xd7b8fc['label']));if(!this['isConfigured'](_0xd7b8fc[_0x172b('0x84')])||!this[_0x172b('0x81')](_0xd7b8fc[_0x172b('0x85')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x127'));}if(!this[_0x172b('0x81')](_0xd7b8fc['text'])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x128'),_0xd7b8fc['text']));var _0x398891=this[_0x172b('0x83')][_0x172b('0x6d')](this,_0xd7b8fc);if(_0x398891){this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x129'),_0x398891));var _0x3bbc67=this[_0x172b('0xe')]['streamFile'](_0x398891);try{fs['unlink'](_0x398891+'.wav');}catch(_0x447162){logger[_0x172b('0x2c')](_0x447162);}return _0x3bbc67;}return this[_0x172b('0xe')]['error'](_0xd7b8fc,_0x172b('0x12a'));};AGIVertices['prototype'][_0x172b('0x12b')]=function(_0x5e751a){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x5e751a[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x84')])||!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x85')])){return this['channel']['noop'](_0x172b('0x127'));}if(!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x8b')])){return this[_0x172b('0xe')]['noop']('no\x20bot\x20name\x20configured');}if(!this[_0x172b('0x81')](_0x5e751a[_0x172b('0x5a')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xaa'));}this['channel'][_0x172b('0xea')]=!![];this[_0x172b('0x36')](_0x5e751a);this[_0x172b('0x41')](_0x5e751a['text'],'in','','');this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x12c'),_0x5e751a[_0x172b('0x5a')]));var _0x13da2d=this['awsLex'][_0x172b('0x6d')](this,_0x5e751a);if(_0x13da2d){for(var _0x3fc4c7 in _0x13da2d){if(_0x13da2d[_0x172b('0x93')](_0x3fc4c7)&&_['isString'](_0x13da2d[_0x3fc4c7])){this['channel'][_0x172b('0x9d')](util['format'](_0x172b('0x12d'),_0x3fc4c7[_0x172b('0x66')]()),_0x13da2d[_0x3fc4c7]);}}if(_['isNil'](_0x13da2d[_0x172b('0x74')])){return this['channel'][_0x172b('0xa9')](_0x172b('0x12e'));}else{this['createSquareMessage'](_0x13da2d[_0x172b('0x74')],_0x172b('0xee'),_0x172b('0x12f'),'');return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('Amazon\x20Lex\x20Result\x20%s',_0x13da2d[_0x172b('0x74')]));}}return this[_0x172b('0xe')][_0x172b('0x2c')](_0x5e751a,_0x172b('0x130'));};AGIVertices['prototype'][_0x172b('0x131')]=function(_0x43a3a0){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x132'),_0x43a3a0[_0x172b('0xa8')],_0x43a3a0[_0x172b('0x62')]));if(!this[_0x172b('0x81')](_0x43a3a0[_0x172b('0x78')])){return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xe9'));}var _0x58cb83=_0x172b('0x133');var _0x41dad8=util[_0x172b('0x28')](_0x172b('0x134'),FILES_PATH,rs['generate'](0x4));var _0x547477=util['format'](_0x172b('0x9c'),_0x41dad8,_0x58cb83);var _0x534f48=!![];if(_0x43a3a0['beep']===_0x172b('0x135')){_0x534f48=![];}var _0x208527=this[_0x172b('0xe')]['recordFile'](_0x41dad8,_0x58cb83,_0x43a3a0[_0x172b('0x136')],_0x43a3a0[_0x172b('0x62')],undefined,_0x534f48);if(_0x208527[_0x172b('0xab')]!==-0x1){this['channel'][_0x172b('0xa9')](util['format'](_0x172b('0x137'),_0x547477));var _0x3318ff=this[_0x172b('0x8c')]['sync'](this,_0x43a3a0,_0x547477);if(_0x3318ff){for(var _0x9eccb7 in _0x3318ff){if(_0x3318ff[_0x172b('0x93')](_0x9eccb7)){this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0x138'),_0x9eccb7[_0x172b('0x66')]()),_0x3318ff[_0x9eccb7]);}}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('GoogleASR\x20Result\x20%s',JSON[_0x172b('0x70')](_0x3318ff)));}}return _0x208527;};AGIVertices[_0x172b('0x10')]['tildeasr']=function(_0x5a13d2){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x139'),_0x5a13d2[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x5a13d2['appid'])){return this[_0x172b('0xe')]['noop'](_0x172b('0x13a'));}if(!this['isConfigured'](_0x5a13d2[_0x172b('0x90')])){return this[_0x172b('0xe')]['noop'](_0x172b('0x13b'));}var _0x1dcf0d=_0x172b('0x133');var _0x1de2d6=util[_0x172b('0x28')](_0x172b('0x134'),FILES_PATH,rs['generate'](0x4));var _0x5c44d2=util['format'](_0x172b('0x9c'),_0x1de2d6,_0x1dcf0d);var _0x2d38ed=!![];if(_0x5a13d2[_0x172b('0x13c')]===_0x172b('0x135')){_0x2d38ed=![];}var _0x33311c=this[_0x172b('0xe')]['recordFile'](_0x1de2d6,_0x1dcf0d,_0x5a13d2['intKey'],_0x5a13d2[_0x172b('0x62')],undefined,_0x2d38ed);if(_0x33311c[_0x172b('0xab')]!==-0x1){this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x13d'),_0x5c44d2));var _0x21b951=this[_0x172b('0x8e')]['sync'](this,_0x5a13d2,_0x5c44d2);if(_0x21b951){for(var _0x3c14b5 in _0x21b951){if(_0x21b951['hasOwnProperty'](_0x3c14b5)){this['channel'][_0x172b('0x9d')](util[_0x172b('0x28')]('TILDE_ASR_%s',_0x3c14b5['toUpperCase']()),_0x21b951[_0x3c14b5]);}}return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x13e'),JSON[_0x172b('0x70')](_0x21b951)));}}return _0x33311c;};AGIVertices[_0x172b('0x10')]['gotoc']=function(_0x23b0a6){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x23b0a6[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0x13f')](_0x23b0a6[_0x172b('0x140')],_0x23b0a6[_0x172b('0x3c')],_0x23b0a6[_0x172b('0x3d')]);};AGIVertices[_0x172b('0x10')]['gotoif']=function(_0x4507dc){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x4507dc[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x4507dc[_0x172b('0x141')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x4507dc,_0x172b('0x142'));}try{var _0x569620=eval(_0x4507dc[_0x172b('0x141')])?_0x172b('0x143'):_0x172b('0x144');this[_0x172b('0xe')][_0x172b('0xa9')](util['format']('EVAL\x20CONDITION\x20%s\x20%s',_0x4507dc['condition'],_0x569620));return{'code':0xc8,'result':_0x569620};}catch(_0x373547){return{'code':0xc8,'result':_0x172b('0x144')};}};AGIVertices[_0x172b('0x10')][_0x172b('0x145')]=function(_0x55def4){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x55def4['label']));if(!this[_0x172b('0x81')](_0x55def4['interval_id'])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x55def4,_0x172b('0x146'));}var _0x87a959=this[_0x172b('0x25')][_0x172b('0x6d')](this,_0x55def4[_0x172b('0x147')]);if(!_0x87a959){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x55def4,'no\x20intervals\x20found');}for(var _0x1a18b1=0x0;_0x1a18b1<_0x87a959[_0x172b('0x9a')];_0x1a18b1+=0x1){var _0x18896b=this['channel'][_0x172b('0x11')](util[_0x172b('0x28')](_0x172b('0x148'),_0x87a959[_0x1a18b1]));if(_0x18896b[_0x172b('0xab')]===-0x1){return _0x18896b;}logger[_0x172b('0x2e')](util[_0x172b('0x28')]('IFTIME\x20%s\x20%s',_0x87a959[_0x1a18b1],_0x18896b[_0x172b('0xa3')]));if(_0x18896b[_0x172b('0xa3')]===_0x172b('0x143')){logger['info'](util['format'](_0x172b('0x149'),_0x87a959[_0x1a18b1],'true'));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x149'),_0x87a959[_0x1a18b1],_0x172b('0x143')));return{'code':0xc8,'result':_0x172b('0x143')};}else{logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x149'),_0x87a959[_0x1a18b1],'false'));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x149'),_0x87a959[_0x1a18b1],_0x172b('0x144')));}}return{'code':0xc8,'result':_0x172b('0x144')};};AGIVertices['prototype'][_0x172b('0x14a')]=function(_0xfd3ba4){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x14b'),_0xfd3ba4[_0x172b('0xa8')]));return this[_0x172b('0xe')]['hangup']();};AGIVertices[_0x172b('0x10')][_0x172b('0x14c')]=function(_0x361e45){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x14d'),_0x361e45[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x361e45[_0x172b('0x78')])){return this['channel'][_0x172b('0xa9')](_0x172b('0xe9'));}var _0x34e57c='wav';var _0x3efe1b=util[_0x172b('0x28')](_0x172b('0x134'),FILES_PATH,rs[_0x172b('0x121')](0x4));var _0x12e61b=util[_0x172b('0x28')]('%s.%s',_0x3efe1b,_0x34e57c);var _0x1cedae=!![];if(_0x361e45[_0x172b('0x13c')]===_0x172b('0x135')){_0x1cedae=![];}var _0x5a33b5=this[_0x172b('0xe')]['recordFile'](_0x3efe1b,_0x34e57c,_0x361e45[_0x172b('0x136')],_0x361e45[_0x172b('0x62')],undefined,_0x1cedae);if(_0x5a33b5[_0x172b('0xab')]!==-0x1){this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x14e'),_0x12e61b));var _0x525e97=this[_0x172b('0x7f')]['sync'](this,_0x361e45,_0x12e61b);if(_0x525e97){for(var _0x3d3907 in _0x525e97){if(_0x525e97[_0x172b('0x93')](_0x3d3907)){this[_0x172b('0xe')]['setVariable'](util[_0x172b('0x28')](_0x172b('0x14f'),_0x3d3907[_0x172b('0x66')]()),_0x525e97[_0x3d3907]);}}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x150'),JSON[_0x172b('0x70')](_0x525e97)));}}return _0x5a33b5;};AGIVertices[_0x172b('0x10')][_0x172b('0x151')]=function(_0x2f2719){logger[_0x172b('0x2e')](util['format'](_0x172b('0x152'),_0x2f2719[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x2f2719[_0x172b('0x78')])){return this['channel'][_0x172b('0xa9')](_0x172b('0xe9'));}if(!this[_0x172b('0x81')](_0x2f2719[_0x172b('0x5a')])){return this['channel'][_0x172b('0xa9')]('no\x20text\x20configured');}this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x153'),_0x2f2719[_0x172b('0x5a')]));var _0x791826=this['ispeechTTS'][_0x172b('0x6d')](this,_0x2f2719);if(_0x791826){this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')](_0x172b('0x14e'),_0x791826));var _0x397c21=this['channel']['streamFile'](_0x791826,_0x2f2719[_0x172b('0x136')]);try{fs['unlink'](_0x791826+_0x172b('0x108'));}catch(_0x1ccb74){logger['error'](_0x1ccb74);}return _0x397c21;}return this[_0x172b('0xe')]['error'](_0x2f2719,_0x172b('0x154'));};AGIVertices['prototype'][_0x172b('0x155')]=function(_0x2fabba){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x2fabba[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x2fabba[_0x172b('0x156')])){return this['channel'][_0x172b('0x2c')](_0x2fabba,_0x172b('0x157'));}logger['info'](util['format'](_0x172b('0x158'),this[_0x172b('0xe')][_0x172b('0x38')],_0x2fabba[_0x172b('0x156')]));var _0x4e0df2=this['agentLogin']['sync'](this,_0x2fabba[_0x172b('0x156')]);if(_0x4e0df2){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x2fabba[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x2fabba['findBy']));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x172b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x172b('0x38')],_0x2fabba['findBy']));this[_0x172b('0xe')]['noop'](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel']['callerid'],_0x2fabba[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices['prototype'][_0x172b('0x15b')]=function(_0x25628e){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x15c'),_0x25628e[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x25628e[_0x172b('0x156')])){return this[_0x172b('0xe')]['error'](_0x25628e,_0x172b('0x157'));}logger['info'](util[_0x172b('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x172b('0xe')]['callerid'],_0x25628e[_0x172b('0x156')]));var _0x167287=this[_0x172b('0x4f')][_0x172b('0x6d')](this,_0x25628e[_0x172b('0x156')]);if(_0x167287){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x25628e[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x25628e['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0x172b('0x2e')](util[_0x172b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x172b('0xe')][_0x172b('0x38')],_0x25628e[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x15d'),this[_0x172b('0xe')]['callerid'],_0x25628e[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices[_0x172b('0x10')]['math']=function(_0x2e346c){logger['info'](util['format'](_0x172b('0x15e'),_0x2e346c['label']));if(!this['isConfigured'](_0x2e346c[_0x172b('0x15f')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x2e346c,_0x172b('0x160'));}this['channel']['noop'](util[_0x172b('0x28')](_0x172b('0x161'),_0x2e346c[_0x172b('0x15f')]));var _0x853cb4=eval(_0x2e346c[_0x172b('0x15f')]);if(!this['isConfigured'](_0x2e346c[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x18a118=this['getVariable'][_0x172b('0x6d')](this,_0x2e346c[_0x172b('0xd6')]);if(!_0x18a118){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x2e346c,_0x172b('0x11c'));}if(_[_0x172b('0x99')](_0x853cb4)){var _0x54a6b9=this;_0x853cb4[_0x172b('0xd8')](function(_0x35d02c,_0x32f6ec){_0x54a6b9['channel']['setVariable'](util[_0x172b('0x28')](_0x172b('0x162'),_0x18a118,_0x32f6ec),_0x35d02c);});return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x163'),_0x18a118));}else{return this['channel'][_0x172b('0x9d')](_0x18a118,_0x853cb4);}};AGIVertices['prototype'][_0x172b('0xc')]=function(_0x17bfe1){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x164'),_0x17bfe1['label']));if(_0x17bfe1[_0x172b('0xa5')]===0x0){return this['maxRetry'](_0x17bfe1);}_0x17bfe1[_0x172b('0xa5')]-=0x1;if(!this[_0x172b('0x81')](_0x17bfe1[_0x172b('0x115')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x17bfe1,_0x172b('0x116'));}var _0x35af96=this['getSound'][_0x172b('0x6d')](this,_0x17bfe1[_0x172b('0x115')]);if(!_0x35af96){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x17bfe1,'no\x20file\x20audio\x20found');}var _0x2b9d0d=this[_0x172b('0xe')][_0x172b('0x118')](_0x35af96,_0x17bfe1['response'],_0x17bfe1[_0x172b('0x165')]);var _0x4e6693=_0x2b9d0d['result'];if(_0x2b9d0d[_0x172b('0xab')]===-0x1){this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x17bfe1,'-1');return _0x2b9d0d;}else if(_0x2b9d0d[_0x172b('0xa3')]===_0x172b('0x62')){_0x2b9d0d['result']=_0x2b9d0d[_0x172b('0xab')][_0x172b('0x9a')]>0x0?_0x2b9d0d[_0x172b('0xab')]:'t';}else if(_[_0x172b('0x43')](_0x2b9d0d[_0x172b('0xab')])){_0x2b9d0d[_0x172b('0xab')]='#';_0x4e6693='#';}if(!this['isConfigured'](_0x17bfe1[_0x172b('0xd6')])){this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0xd7'));}else{var _0x150619=this['getVariable'][_0x172b('0x6d')](this,_0x17bfe1[_0x172b('0xd6')]);if(!_0x150619){return this['channel'][_0x172b('0x2c')](_0x17bfe1,_0x172b('0x11c'));}this[_0x172b('0xe')][_0x172b('0x9d')](_0x150619,_0x4e6693);}this['createSquareDetailsReport'][_0x172b('0x6d')](this,_0x17bfe1,_0x4e6693);return _0x2b9d0d;};AGIVertices[_0x172b('0x10')][_0x172b('0xa9')]=function(_0x4ec96f){logger[_0x172b('0x2e')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x4ec96f[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0xa9')](_0x4ec96f[_0x172b('0x166')]||_0x4ec96f['label']);};AGIVertices['prototype'][_0x172b('0x167')]=function(_0x59f032){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x168'),_0x59f032[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x59f032[_0x172b('0x156')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x59f032,_0x172b('0x157'));}logger[_0x172b('0x2e')](util['format'](_0x172b('0x158'),this[_0x172b('0xe')][_0x172b('0x38')],_0x59f032[_0x172b('0x156')]));var _0xeef729=this['getPause'][_0x172b('0x6d')](this,_0x59f032[_0x172b('0x169')]);var _0x5a86ee=this['agentPause']['sync'](this,_0x59f032[_0x172b('0x156')],_0xeef729);if(_0x5a86ee){logger['info'](util[_0x172b('0x28')](_0x172b('0x159'),this['channel'][_0x172b('0x38')],_0x59f032['findBy']));this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x159'),this['channel'][_0x172b('0x38')],_0x59f032[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x16a')};}else{logger[_0x172b('0x2e')](util['format'](_0x172b('0x15d'),this[_0x172b('0xe')]['callerid'],_0x59f032[_0x172b('0x156')]));this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x59f032[_0x172b('0x156')]));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices[_0x172b('0x10')][_0x172b('0x16b')]=function(_0x13889d){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x16c'),_0x13889d[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x13889d[_0x172b('0x115')])){return this['channel'][_0x172b('0x2c')](_0x13889d,'no\x20file\x20audio\x20selected');}var _0x571299=this[_0x172b('0x1d')][_0x172b('0x6d')](this,_0x13889d[_0x172b('0x115')]);if(!_0x571299){return this[_0x172b('0xe')]['error'](_0x13889d,'no\x20file\x20audio\x20found');}var _0x202e52=this[_0x172b('0xe')][_0x172b('0x54')]('PLAYBACK',[_0x571299,_0x13889d[_0x172b('0xe5')]]);if(_0x202e52[_0x172b('0xab')]===-0x1){return _0x202e52;}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x16d'),_0x172b('0x16e'),_0x571299));};AGIVertices['prototype']['queue']=function(_0x270b8d){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x16f'),_0x270b8d[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x270b8d[_0x172b('0x170')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x270b8d,'no\x20queue\x20selected');}var _0x3e76b7='';var _0x9edd84=parseInt(_0x270b8d[_0x172b('0x170')],0xa);if(isNaN(_0x9edd84)){_0x3e76b7=_0x270b8d[_0x172b('0x170')];}else{_0x3e76b7=this[_0x172b('0x16')][_0x172b('0x6d')](this,_0x270b8d[_0x172b('0x170')]);if(!_0x3e76b7){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x270b8d,_0x172b('0x171'));}}var _0x1e1e5c='';if(this['isConfigured'](_0x270b8d[_0x172b('0x115')])){var _0x4e5041=this[_0x172b('0x1d')][_0x172b('0x6d')](this,_0x270b8d[_0x172b('0x115')]);if(_0x4e5041){_0x1e1e5c=_0x4e5041;}}this[_0x172b('0x36')]['sync'](this,_0x270b8d,_0x3e76b7);if(_0x270b8d[_0x172b('0xe5')]['indexOf']('x')<0x0){_0x270b8d[_0x172b('0xe5')]+='x';}if(_0x270b8d[_0x172b('0xe5')][_0x172b('0x172')]('X')<0x0){_0x270b8d[_0x172b('0xe5')]+='X';}this[_0x172b('0xe')]['setVariable'](_0x172b('0x173'),_0x3e76b7?_0x3e76b7[_0x172b('0x174')]():'');var _0x583441=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0x175'),[_0x3e76b7,_0x270b8d['opts'],_0x270b8d['url'],_0x1e1e5c,_0x270b8d[_0x172b('0x62')],_0x270b8d['agi'],_0x270b8d[_0x172b('0x176')],_0x270b8d[_0x172b('0x177')],'',_0x270b8d[_0x172b('0x178')]]);if(_0x583441[_0x172b('0xab')]===-0x1){return _0x583441;}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x16d'),_0x172b('0x175'),_0x3e76b7));};AGIVertices['prototype'][_0x172b('0x179')]=function(_0xe38d9){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0xe38d9[_0x172b('0xa8')]));var _0x5a4dfe=_0xe38d9[_0x172b('0x17a')]||_0x172b('0x133');var _0x5bc30d=util['format'](_0x172b('0x17b'),this[_0x172b('0xe')][_0x172b('0x3a')],rs[_0x172b('0x121')](0x5));var _0x5767d9=util[_0x172b('0x28')](_0x172b('0x17c'),FILES_PATH,_0x5bc30d,_0x5a4dfe);var _0x51c39a=util[_0x172b('0x28')]('%s/recordings/%s',FILES_PATH,_0x5bc30d);this['createSquareRecording']['sync'](this,_0xe38d9,_0x5bc30d,_0x5767d9);this[_0x172b('0xe')][_0x172b('0x9d')](_0x172b('0x17d'),_0x5bc30d);logger['info'](_0x172b('0x17e'),_0x51c39a,_0x5a4dfe,_0xe38d9[_0x172b('0x17f')],_0xe38d9['timeout']);return this[_0x172b('0xe')][_0x172b('0x180')](_0x51c39a,_0x5a4dfe,_0xe38d9[_0x172b('0x17f')],_0xe38d9[_0x172b('0x62')],undefined,!![]);};AGIVertices[_0x172b('0x10')]['restapi']=function(_0xe3cd4a){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x181'),_0xe3cd4a[_0x172b('0xa8')]));if(!this['isConfigured'](_0xe3cd4a[_0x172b('0x60')])){return this[_0x172b('0xe')]['noop'](_0x172b('0x182'));}var _0x2615f3=this[_0x172b('0x5f')][_0x172b('0x6d')](this,_0xe3cd4a);logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Response:',util[_0x172b('0x183')](_0x2615f3,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0xe3cd4a[_0x172b('0xd6')])){return this[_0x172b('0xe')]['noop'](_0x172b('0x184'));}var _0x4dc66a=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0xe3cd4a[_0x172b('0xd6')]);if(!_0x4dc66a){return this['channel'][_0x172b('0x2c')](_0xe3cd4a,_0x172b('0x11c'));}this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')]('%s_STATUS_CODE',_0x4dc66a),_0x2615f3[_0x172b('0x72')]?_0x2615f3['statusCode']:_0x172b('0x185'));this[_0x172b('0xe')][_0x172b('0x9d')](util[_0x172b('0x28')](_0x172b('0x186'),_0x4dc66a),_0x2615f3['statusMessage']?_0x2615f3['statusMessage']:'OK');if(_0x2615f3['body']){try{this[_0x172b('0x9b')](_0x2615f3[_0x172b('0x71')],_0x4dc66a);}catch(_0x22f589){logger['error'](util['format'](_0x172b('0x187'),_0x4dc66a));}}return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0xdc'),_0x4dc66a));};AGIVertices[_0x172b('0x10')]['saydigits']=function(_0x194089){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x194089[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0x188')](_0x194089['digits'][_0x172b('0x56')](/\s+/g,''),_0x194089[_0x172b('0x17f')]);};AGIVertices[_0x172b('0x10')][_0x172b('0x189')]=function(_0xbd0dd8){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x18a'),_0xbd0dd8[_0x172b('0xa8')]));return this[_0x172b('0xe')][_0x172b('0x18b')](_0xbd0dd8[_0x172b('0x63')][_0x172b('0x56')](/\s+/g,''),_0xbd0dd8['escape_digits']);};AGIVertices[_0x172b('0x10')][_0x172b('0x18c')]=function(_0x4da201){logger['info'](util[_0x172b('0x28')](_0x172b('0x18d'),_0x4da201['label']));return this[_0x172b('0xe')][_0x172b('0x18e')](_0x4da201[_0x172b('0x5a')],_0x4da201['escape_digits']);};AGIVertices[_0x172b('0x10')][_0x172b('0x18f')]=function(_0x56639c){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x190'),_0x56639c[_0x172b('0xa8')]));if(!this['isConfigured'](_0x56639c[_0x172b('0x191')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20mail\x20account\x20configured');}var _0x5ca8a4=this[_0x172b('0x21')][_0x172b('0x6d')](this,_0x56639c[_0x172b('0x191')]);if(!_0x5ca8a4||!_0x5ca8a4[_0x172b('0x192')]){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x56639c,'no\x20mail\x20account\x20found');}var _0x148ffb={'from':util[_0x172b('0x28')](_0x172b('0x193'),_0x5ca8a4[_0x172b('0x14')],_0x5ca8a4[_0x172b('0x194')]||_0x5ca8a4[_0x172b('0x192')]['user']),'to':_0x56639c['to']||'','cc':_0x56639c['cc']||'','bcc':_0x56639c[_0x172b('0x195')]||'','subject':_0x56639c[_0x172b('0x196')],'html':_0x56639c['text'],'text':_0x56639c['text']};if(this['isConfigured'](_0x56639c[_0x172b('0x197')])){}logger[_0x172b('0xde')]('sendMail\x20message',JSON[_0x172b('0x70')](_0x148ffb));this[_0x172b('0x36')]['sync'](this,_0x56639c,_0x56639c[_0x172b('0x191')]);this['channel'][_0x172b('0xa9')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x5ca8a4[_0x172b('0x14')]));this['sendMailMessage'][_0x172b('0x6d')](this,_0x5ca8a4[_0x172b('0x198')],_0x148ffb);return this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x199'));};AGIVertices[_0x172b('0x10')]['sendFax']=function(_0x50f780){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x19a'),_0x50f780['label']));return this[_0x172b('0xe')]['noop'](_0x172b('0x19b'));};AGIVertices[_0x172b('0x10')]['sendSMS']=function(_0x4e68df){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x19c'),_0x4e68df[_0x172b('0xa8')]));if(!this['isConfigured'](_0x4e68df['sms_account_id'])){return this[_0x172b('0xe')]['noop'](_0x172b('0x19d'));}var _0x37c184=this[_0x172b('0x19e')][_0x172b('0x6d')](this,_0x4e68df['sms_account_id']);if(!_0x37c184){return this[_0x172b('0xe')]['error'](_0x4e68df,_0x172b('0x19f'));}var _0x1de3d2={'body':_0x4e68df[_0x172b('0x1a0')],'phone':_0x4e68df['to']||'','SmsAccountId':_0x37c184['id']};logger[_0x172b('0xde')](_0x172b('0x1a1'),JSON['stringify'](_0x1de3d2));this[_0x172b('0x36')][_0x172b('0x6d')](this,_0x4e68df,_0x4e68df[_0x172b('0x1a2')]);this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x37c184[_0x172b('0x14')]));this['createSmsMessage'][_0x172b('0x6d')](this,_0x1de3d2);return this['channel']['noop'](_0x172b('0x1a3'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1a4')]=function(_0x3ca8f5){logger[_0x172b('0x2e')](util['format'](_0x172b('0x1a5'),_0x3ca8f5[_0x172b('0xa8')]));if(!this[_0x172b('0x81')](_0x3ca8f5[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3ca8f5,_0x172b('0x1a6'));}var _0x3f6f23=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0x3ca8f5[_0x172b('0xd6')]);if(!_0x3f6f23){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3ca8f5,_0x172b('0x11c'));}return this[_0x172b('0xe')][_0x172b('0x9d')](_0x3f6f23,_0x3ca8f5[_0x172b('0x1a7')]);};AGIVertices[_0x172b('0x10')]['start']=function(_0x44653c){logger['info'](util[_0x172b('0x28')](_0x172b('0x1a8'),_0x44653c[_0x172b('0xa8')]));this['channel'][_0x172b('0xa9')](_0x172b('0x1a9'));var _0x21f6d0=this['channel'][_0x172b('0x11')](_0x172b('0x1aa'));if(!_[_0x172b('0x43')](_0x21f6d0['extra'])){this[_0x172b('0xe')][_0x172b('0x3a')]=_0x21f6d0['extra'];}if(_0x44653c[_0x172b('0xb8')]==='yes'){this[_0x172b('0xe')][_0x172b('0xa9')](_0x172b('0x1ab'));return this[_0x172b('0xe')]['answer']();}return this['channel'][_0x172b('0xa9')](_0x172b('0x1ac'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1ad')]=function(_0x20b324){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1ae'),_0x20b324[_0x172b('0xa8')]));if(!this['isConfigured'](_0x20b324[_0x172b('0x1af')])){return this[_0x172b('0xe')]['error'](_0x20b324,_0x172b('0x1b0'));}var _0x45f787=this[_0x172b('0x17')][_0x172b('0x6d')](this,_0x20b324[_0x172b('0x1af')]);if(!this[_0x172b('0x81')](_0x45f787)){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x20b324,util[_0x172b('0x28')](_0x172b('0x1b1'),_0x20b324[_0x172b('0x1af')]));}if(_0x45f787===this[_0x172b('0xe')][_0x172b('0x3f')]){return this['channel'][_0x172b('0x2c')](_0x20b324,_0x172b('0x1b2'));}this[_0x172b('0x36')]['sync'](this,_0x20b324,_0x45f787);var _0x1218b4=this[_0x172b('0xe')][_0x172b('0x54')](_0x172b('0x1b3'),util[_0x172b('0x28')](_0x172b('0x1b4'),config[_0x172b('0xb4')][_0x172b('0x1b5')]||_0x172b('0x1b6'),_0x45f787,this[_0x172b('0xe')][_0x172b('0x3f')]));if(_0x1218b4[_0x172b('0xab')]===-0x1){return _0x1218b4;}return this[_0x172b('0xe')][_0x172b('0xa9')](util['format']('Executed\x20command\x20%s\x20%s',_0x172b('0x1b3'),_0x45f787));};AGIVertices[_0x172b('0x10')]['system']=function(_0x597b1c){logger[_0x172b('0x2e')](util['format'](_0x172b('0x1b7'),_0x597b1c['label']));var _0x3a72c5=this[_0x172b('0x53')][_0x172b('0x6d')](this,_0x597b1c[_0x172b('0xb6')]);this[_0x172b('0x36')]['sync'](this,_0x597b1c,_0x597b1c['command']);if(this[_0x172b('0x81')](_0x597b1c[_0x172b('0xd6')])){var _0xdd208a=this[_0x172b('0x11')][_0x172b('0x6d')](this,_0x597b1c[_0x172b('0xd6')]);if(_0xdd208a){this['channel'][_0x172b('0x9d')](_0xdd208a,_0x3a72c5);return this['channel'][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x1b8'),_0x597b1c[_0x172b('0xb6')],_0xdd208a));}}return this[_0x172b('0xe')]['noop'](util[_0x172b('0x28')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x597b1c[_0x172b('0xb6')]));};AGIVertices[_0x172b('0x10')][_0x172b('0x1b9')]=function(_0xdf52a0){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1ba'),_0xdf52a0[_0x172b('0xa8')]));_0xdf52a0[_0x172b('0x5a')]=_0xdf52a0[_0x172b('0x5a')][_0x172b('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0xdf52a0['apiKey'])){return this['channel'][_0x172b('0xa9')](_0x172b('0x1bb'));}if(!this[_0x172b('0x81')](_0xdf52a0[_0x172b('0x5a')])){return this[_0x172b('0xe')][_0x172b('0xa9')]('no\x20text\x20configured');}this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x1bc'),_0xdf52a0['text']));var _0x2e93af=this['googleCloudTTS'][_0x172b('0x6d')](this,_0xdf52a0);if(_0x2e93af){this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x1bd'),_0x2e93af));var _0x3ca278=this['channel']['streamFile'](_0x2e93af);try{fs[_0x172b('0x107')](_0x2e93af+'.wav');}catch(_0x304580){logger[_0x172b('0x2c')](_0x304580);}return _0x3ca278;}return this[_0x172b('0xe')]['error'](_0xdf52a0,_0x172b('0x1be'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1bf')]=function(_0x2b2625){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x2b2625['label']));_0x2b2625['text']=_0x2b2625[_0x172b('0x5a')][_0x172b('0x56')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x172b('0x81')](_0x2b2625[_0x172b('0x5a')])){return this[_0x172b('0xe')]['noop'](_0x172b('0xaa'));}this[_0x172b('0xe')][_0x172b('0xa9')](util['format'](_0x172b('0x1c0'),_0x2b2625[_0x172b('0x5a')]));var _0x349484=this[_0x172b('0x1c1')]['sync'](this,_0x2b2625);if(_0x349484){this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x1c2'),_0x349484));var _0x431f84=this['channel'][_0x172b('0x106')](_0x349484);try{fs[_0x172b('0x107')](_0x349484+'.wav');}catch(_0x3e098e){logger[_0x172b('0x2c')](_0x3e098e);}return _0x431f84;}return this[_0x172b('0xe')][_0x172b('0x2c')](_0x2b2625,_0x172b('0x1c3'));};AGIVertices[_0x172b('0x10')][_0x172b('0x1c4')]=function(_0x7db1f1){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1c5'),_0x7db1f1['label']));if(!this['isConfigured'](_0x7db1f1[_0x172b('0x156')])){return this['channel'][_0x172b('0x2c')](_0x7db1f1,_0x172b('0x157'));}logger['info'](util[_0x172b('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));var _0x1a41bb=this[_0x172b('0x4e')][_0x172b('0x6d')](this,_0x7db1f1[_0x172b('0x156')]);if(_0x1a41bb){logger[_0x172b('0x2e')](util['format'](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x159'),this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));return{'code':0xc8,'result':'success'};}else{logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x15d'),this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1[_0x172b('0x156')]));this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x172b('0xe')][_0x172b('0x38')],_0x7db1f1['findBy']));return{'code':0xc8,'result':_0x172b('0x15a')};}};AGIVertices[_0x172b('0x10')]['voicemail']=function(_0x28d10a){logger[_0x172b('0x2e')](util[_0x172b('0x28')](_0x172b('0x1c6'),_0x28d10a[_0x172b('0xa8')]));var _0x3cddc5=this[_0x172b('0xe')][_0x172b('0x54')]('VOICEMAIL',[_0x28d10a['mailbox'],_0x28d10a[_0x172b('0x76')]]);if(_0x3cddc5[_0x172b('0xab')]===-0x1){return _0x3cddc5;}return this[_0x172b('0xe')][_0x172b('0xa9')](util[_0x172b('0x28')](_0x172b('0x16d'),_0x172b('0x1c7'),_0x28d10a['mailbox']));};AGIVertices[_0x172b('0x10')][_0x172b('0x1c8')]=function(_0x3b669d){logger[_0x172b('0x2e')](util[_0x172b('0x28')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x3b669d['label']));if(!this[_0x172b('0x81')](_0x3b669d[_0x172b('0xd6')])){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3b669d,_0x172b('0x1a6'));}var _0x3032bf=this['getVariable']['sync'](this,_0x3b669d[_0x172b('0xd6')]);if(!_0x3032bf){return this[_0x172b('0xe')][_0x172b('0x2c')](_0x3b669d,'no\x20variable\x20found');}var _0x11d357=this[_0x172b('0xe')]['getVariable'](_0x3032bf);return{'code':0xc8,'result':_0x11d357[_0x172b('0xa3')]?_0x11d357[_0x172b('0xa3')]:'-'};};String[_0x172b('0x10')][_0x172b('0x9f')]=function(_0x2e23e3,_0x369582){return this[_0x172b('0x9e')](_0x2e23e3)[_0x172b('0x1c9')](_0x369582);};module[_0x172b('0x1ca')]=AGIVertices; \ No newline at end of file +var _0xc818=['no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','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','Enter\x20in\x20SYSTEM\x20(%s)\x20block','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','Enter\x20in\x20SWITCH\x20(%s)\x20block','util','lodash','shelljs','odbc','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','rawHeaders','rawBody','menu','getdigits','channel','rpc','mailRpc','prototype','getVariableById','name','catch','getVoiceQueue','getSquareProject','getSquareProjectById','then','dsn','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','IntervalId','interval','Intervals','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','lastName','phone','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','shellCommand','exec','googleCloudTTS','apiKey','text','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','number','includes','POST','method','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','en-US','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','clear','clone','hasOwnProperty','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','stringify','split','replaceAll','getVariable','getAndSetVariable','result','extra','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','MRCPSynth','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','replace','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','response','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','appsecret','NOBEEP','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','no\x20condition\x20configured','condition','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20found','getData','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','gosub','position','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','\x22%s\x22\x20<%s>','email','Smtp','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured'];(function(_0x3a1509,_0x9d763a){var _0x22b165=function(_0x5e3b57){while(--_0x5e3b57){_0x3a1509['push'](_0x3a1509['shift']());}};_0x22b165(++_0x9d763a);}(_0xc818,0x1e3));var _0x8c81=function(_0x4401cb,_0x56938c){_0x4401cb=_0x4401cb-0x0;var _0x5628c7=_0xc818[_0x4401cb];return _0x5628c7;};'use strict';var fs=require('fs');var util=require(_0x8c81('0x0'));var _=require(_0x8c81('0x1'));var sh=require(_0x8c81('0x2'));var odbc=require(_0x8c81('0x3'))();var rs=require('randomstring');var moment=require(_0x8c81('0x4'));var Mustache=require(_0x8c81('0x5'));var rp=require(_0x8c81('0x6'));var logger=require(_0x8c81('0x7'))(_0x8c81('0x8'));var config=require(_0x8c81('0x9'));var scripts=require(_0x8c81('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x8c81('0xb'),_0x8c81('0xc')];var verticesWithRetry=[_0x8c81('0xd'),_0x8c81('0xe'),'getsecretdigits'];var AGIVertices=function(_0x1173cf,_0x448af6,_0x186783){this[_0x8c81('0xf')]=_0x1173cf;this[_0x8c81('0x10')]=_0x448af6;this[_0x8c81('0x11')]=_0x186783;};AGIVertices[_0x8c81('0x12')]['getVariable']=function(_0x3de91f,_0x37dbb4){this[_0x8c81('0x10')][_0x8c81('0x13')](_0x3de91f)['then'](function(_0x5a2d9e){_0x37dbb4(null,_0x5a2d9e?_0x5a2d9e[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x31ff3f){_0x37dbb4(_0x31ff3f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16')]=function(_0x1b7b1b,_0xd04a1){this[_0x8c81('0x10')]['getVoiceQueueById'](_0x1b7b1b)['then'](function(_0x1db769){_0xd04a1(null,_0x1db769?_0x1db769[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x4fa5){_0xd04a1(_0x4fa5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x17')]=function(_0x4f7180,_0x3683f0){this[_0x8c81('0x10')][_0x8c81('0x18')](_0x4f7180)[_0x8c81('0x19')](function(_0x17564e){_0x3683f0(null,_0x17564e?_0x17564e['name']:![]);})[_0x8c81('0x15')](function(_0x4d0b75){_0x3683f0(_0x4d0b75);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x216d29,_0x13e312){this[_0x8c81('0x10')]['getSquareOdbcById'](_0x216d29)[_0x8c81('0x19')](function(_0x2312d5){_0x13e312(null,_0x2312d5?_0x2312d5[_0x8c81('0x1a')]:![]);})['catch'](function(_0x261832){_0x13e312(_0x261832);});};AGIVertices[_0x8c81('0x12')]['getUser']=function(_0x35d61a,_0x31c4a2){this['rpc']['getUserById'](_0x35d61a)[_0x8c81('0x19')](function(_0x4f58ff){_0x31c4a2(null,_0x4f58ff?_0x4f58ff[_0x8c81('0x14')]:![]);})['catch'](function(_0x8c399c){_0x31c4a2(_0x8c399c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b')]=function(_0xa0f0f7,_0x703dba){this[_0x8c81('0x10')][_0x8c81('0x1c')](_0xa0f0f7)[_0x8c81('0x19')](function(_0x4bfa48){_0x703dba(null,_0x4bfa48?_0x4bfa48['name']:![]);})[_0x8c81('0x15')](function(_0x1ee94c){_0x703dba(_0x1ee94c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1d')]=function(_0x3e5ed1,_0x1f9608){var _0x2e7ba2=this;this[_0x8c81('0x10')][_0x8c81('0x1e')](_0x3e5ed1)[_0x8c81('0x19')](function(_0x477a9e){_0x1f9608(null,_0x477a9e?_0x2e7ba2[_0x8c81('0x1f')](_0x477a9e[_0x8c81('0x20')]):![]);})['catch'](function(_0x1d73ac){_0x1f9608(_0x1d73ac);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x21')]=function(_0x29a52c,_0x428aba){this[_0x8c81('0x10')][_0x8c81('0x22')](_0x29a52c)[_0x8c81('0x19')](function(_0x2f419f){_0x428aba(null,_0x2f419f?_0x2f419f:![]);})['catch'](function(_0x2358be){_0x428aba(_0x2358be);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x23')]=function(_0x25654d,_0x1d931f,_0x551f0b){this[_0x8c81('0x11')][_0x8c81('0x23')](_0x25654d,_0x1d931f)[_0x8c81('0x19')](function(){_0x551f0b(null);})[_0x8c81('0x15')](function(_0x267c01){_0x551f0b(_0x267c01);});};AGIVertices['prototype']['getIntervals']=function(_0x1da1f1,_0x45e7fc){this[_0x8c81('0x10')]['getIntervalById'](_0x1da1f1)[_0x8c81('0x19')](function(_0x30b2a1){if(_0x30b2a1){if(_0x30b2a1[_0x8c81('0x24')]){_0x45e7fc(null,[_0x30b2a1[_0x8c81('0x25')]]);}else{_0x45e7fc(null,_['map'](_0x30b2a1[_0x8c81('0x26')],_0x8c81('0x25')));}}else{_0x45e7fc(null,![]);}})['catch'](function(_0x199478){_0x45e7fc(_0x199478);});};AGIVertices['prototype']['getSoundPath']=function(_0x3fc1c0){return util[_0x8c81('0x27')](_0x8c81('0x28'),FILES_PATH,_0x3fc1c0);};AGIVertices[_0x8c81('0x12')]['getQueryOdbc']=function(_0x30fa19,_0x252172,_0x3f14db){odbc['open'](_0x30fa19,function(_0x4c46dd){if(_0x4c46dd){logger[_0x8c81('0x29')](_0x8c81('0x2a'),_0x4c46dd);_0x3f14db(_0x4c46dd);}else{logger[_0x8c81('0x2b')]('ODBC\x20connection\x20successfully');odbc[_0x8c81('0x2c')](_0x252172,function(_0x5a30fa,_0x4ccca3){if(_0x5a30fa){logger['info'](_0x8c81('0x2d'),_0x252172);_0x3f14db(_0x5a30fa);}else{logger['info'](_0x8c81('0x2e'),_0x252172);odbc['close'](function(_0x4b2729){if(_0x4b2729){logger[_0x8c81('0x29')](_0x8c81('0x2f'),_0x4b2729);}_0x3f14db(null,_0x4ccca3);});}});}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x30')]=function(_0x1e070d,_0x232ba7){this[_0x8c81('0x10')]['getSmsAccountById'](_0x1e070d)[_0x8c81('0x19')](function(_0x15e499){_0x232ba7(null,_0x15e499?_0x15e499:![]);})[_0x8c81('0x15')](function(_0x41f9d2){_0x232ba7(_0x41f9d2);});};AGIVertices[_0x8c81('0x12')]['createSmsMessage']=function(_0xc9dd61,_0x202f78){this[_0x8c81('0x10')][_0x8c81('0x31')](_0xc9dd61)[_0x8c81('0x19')](function(_0x2a2b97){_0x202f78(null,_0x2a2b97);})[_0x8c81('0x15')](function(_0x2c9085){_0x202f78(_0x2c9085);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x32')]=function(_0xae952a,_0xc7871,_0x5176d3){this['rpc'][_0x8c81('0x32')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'node':_0xae952a[_0x8c81('0x34')],'application':_0xae952a[_0x8c81('0x35')],'data':_0xc7871||null,'project_name':this[_0x8c81('0xf')][_0x8c81('0x36')],'callerid':this['channel']['callerid']})[_0x8c81('0x19')](function(_0x2a8c67){if(_0x5176d3){_0x5176d3(null,_0x2a8c67);}})[_0x8c81('0x15')](function(_0x21891f){if(_0x5176d3){_0x5176d3(_0x21891f);}});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x37')]=function(_0x349a87,_0x55fe22,_0x41996c,_0xe20dad){this[_0x8c81('0x10')][_0x8c81('0x37')]({'uniqueid':this['channel']['uniqueid'],'callerid':this[_0x8c81('0xf')][_0x8c81('0x38')],'calleridname':this[_0x8c81('0xf')][_0x8c81('0x39')],'context':this[_0x8c81('0xf')][_0x8c81('0x3a')],'extension':this[_0x8c81('0xf')][_0x8c81('0x3b')],'priority':this[_0x8c81('0xf')][_0x8c81('0x3c')],'accountcode':this[_0x8c81('0xf')][_0x8c81('0x3d')],'dnid':this[_0x8c81('0xf')][_0x8c81('0x3e')],'projectName':this[_0x8c81('0xf')][_0x8c81('0x36')],'saveName':_0x55fe22,'filename':_0x349a87[_0x8c81('0x3f')]||_0x55fe22,'savePath':_0x41996c})[_0x8c81('0x19')](function(_0x39dbc8){_0xe20dad(null,_0x39dbc8);})[_0x8c81('0x15')](function(_0x16e822){_0xe20dad(_0x16e822);});};AGIVertices['prototype'][_0x8c81('0x40')]=function(_0x221f4f,_0x5c21f0,_0x18eb31,_0x1b928f,_0x38bb79){this['rpc'][_0x8c81('0x40')]({'uniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'body':_0x221f4f,'direction':_0x5c21f0,'providerName':_0x18eb31,'providerResponse':_0x1b928f})['then'](function(_0x51280e){if(_0x38bb79){_0x38bb79(null,_0x51280e);}})[_0x8c81('0x15')](function(_0x3f1d4c){if(_0x38bb79){_0x38bb79(_0x3f1d4c);}});};AGIVertices[_0x8c81('0x12')]['createCmContact']=function(_0x3c4f19,_0xc4fa7e){this[_0x8c81('0x10')][_0x8c81('0x41')]({'firstName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x14')])||_[_0x8c81('0x43')](_0x3c4f19[_0x8c81('0x14')])?'callback_'+Math['random']():_0x3c4f19[_0x8c81('0x14')],'lastName':_[_0x8c81('0x42')](_0x3c4f19[_0x8c81('0x44')])||_[_0x8c81('0x43')](_0x3c4f19['lastName'])?null:_0x3c4f19[_0x8c81('0x44')],'phone':_0x3c4f19[_0x8c81('0x45')],'ListId':_0x3c4f19[_0x8c81('0x46')],'scheduledat':_0x3c4f19[_0x8c81('0x47')],'callbackUniqueid':this[_0x8c81('0xf')][_0x8c81('0x33')],'tags':'callback','description':_0x8c81('0x48')+_0x3c4f19['scheduledAt'][_0x8c81('0x49')](),'priority':_0x3c4f19[_0x8c81('0x4a')]})[_0x8c81('0x19')](function(_0x5f39ff){_0xc4fa7e(null,_0x5f39ff);})['catch'](function(_0x30b694){_0xc4fa7e(_0x30b694);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x4b')]=function(_0x19d9bb,_0x3357ee){this[_0x8c81('0x10')][_0x8c81('0x4c')](_0x19d9bb)[_0x8c81('0x19')](function(_0x12ed28){_0x3357ee(null,_0x12ed28?_0x12ed28[_0x8c81('0x14')]:![]);})[_0x8c81('0x15')](function(_0x30d6df){_0x3357ee(_0x30d6df);});};AGIVertices[_0x8c81('0x12')]['agentPause']=function(_0x11ef7a,_0x418977,_0x2a11d3){var _0x2bc8ab={'role':_0x8c81('0x4d')};_0x2bc8ab[_0x11ef7a]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4e')](_0x2bc8ab,_0x418977,this[_0x8c81('0xf')][_0x8c81('0x33')])[_0x8c81('0x19')](function(_0x45f92e){_0x2a11d3(null,_[_0x8c81('0x43')](_0x45f92e)?![]:!![]);})['catch'](function(_0x28da6c){logger[_0x8c81('0x29')](_0x28da6c);_0x2a11d3(null,![]);});};AGIVertices[_0x8c81('0x12')]['agentUnpause']=function(_0x5b53f3,_0x4e7bb6){var _0x3d2d0e={'role':_0x8c81('0x4d')};_0x3d2d0e[_0x5b53f3]=this['channel'][_0x8c81('0x38')];this[_0x8c81('0x10')][_0x8c81('0x4f')](_0x3d2d0e)['then'](function(_0x59eaf1){_0x4e7bb6(null,_[_0x8c81('0x43')](_0x59eaf1)?![]:!![]);})[_0x8c81('0x15')](function(_0x111816){logger[_0x8c81('0x29')](_0x111816);_0x4e7bb6(null,![]);});};AGIVertices['prototype'][_0x8c81('0x50')]=function(_0x47ad6f,_0x3589d0){var _0x3deb72={'role':_0x8c81('0x4d')};_0x3deb72[_0x47ad6f]=this[_0x8c81('0xf')]['callerid'];this[_0x8c81('0x10')][_0x8c81('0x50')](_0x3deb72)[_0x8c81('0x19')](function(_0x306a66){_0x3589d0(null,_[_0x8c81('0x43')](_0x306a66)?![]:!![]);})[_0x8c81('0x15')](function(_0x2658e8){logger['error'](_0x2658e8);_0x3589d0(null,![]);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x51')]=function(_0x39c244,_0x36942e){var _0xa91282={'role':_0x8c81('0x4d')};_0xa91282[_0x39c244]=this[_0x8c81('0xf')]['callerid'];var _0x4e6168=_0x39c244!=_0x8c81('0x52')?util[_0x8c81('0x27')](_0x8c81('0x53'),'LOCAL',this[_0x8c81('0xf')][_0x8c81('0x38')]):undefined;this[_0x8c81('0x10')][_0x8c81('0x51')](_0xa91282,_0x4e6168)[_0x8c81('0x19')](function(_0x1a68e8){_0x36942e(null,_[_0x8c81('0x43')](_0x1a68e8)?![]:!![]);})['catch'](function(_0x2a6347){logger[_0x8c81('0x29')](_0x2a6347);_0x36942e(null,![]);});};AGIVertices['prototype'][_0x8c81('0x54')]=function(_0x4f5850,_0x40e5b5){sh[_0x8c81('0x55')](_['trim'](_0x4f5850),function(_0x2d3fa2,_0x40f800){var _0x1b435a=_0x40f800['replace'](/(\r\n|\n|\r)/gm,'');_0x40e5b5(null,_0x1b435a);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x56')]=function(_0x15e71a,_0x19426a){scripts[_0x8c81('0x56')](_0x15e71a[_0x8c81('0x57')],_0x15e71a['google_cloud_tts_text_type']||'text',_0x15e71a[_0x8c81('0x58')],_0x15e71a['languageCode']||'en-US',_0x15e71a[_0x8c81('0x59')]||_0x8c81('0x5a'),_0x15e71a[_0x8c81('0x5b')]||_0x8c81('0x5c'))[_0x8c81('0x19')](function(_0x3984a4){_0x19426a(null,_0x3984a4);})[_0x8c81('0x15')](function(_0x575764){_0x19426a(_0x575764);});};AGIVertices['prototype'][_0x8c81('0x5d')]=function(_0x512e3a,_0x5762db){scripts[_0x8c81('0x5d')](_0x512e3a[_0x8c81('0x58')],_0x512e3a[_0x8c81('0x5e')]||'en',0x1)[_0x8c81('0x19')](function(_0x9728e4){_0x5762db(null,_0x9728e4);})['catch'](function(_0x374795){_0x5762db(_0x374795);});};AGIVertices['prototype'][_0x8c81('0x5f')]=function(_0x22a4aa,_0x198c48){var _0x2e1962={'uri':_0x22a4aa[_0x8c81('0x60')],'method':_0x22a4aa['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x22a4aa[_0x8c81('0x61')])===_0x8c81('0x62')&&parseInt(_0x22a4aa[_0x8c81('0x61')])>=0x1?parseInt(_0x22a4aa[_0x8c81('0x61')])*0x3e8:0x5*0x3e8};if(_[_0x8c81('0x63')]([_0x8c81('0x64'),'PUT'],_0x2e1962[_0x8c81('0x65')][_0x8c81('0x66')]())){try{_0x2e1962[_0x8c81('0x67')]=_0x22a4aa[_0x8c81('0xc')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xc')]):{};}catch(_0x866adb){logger[_0x8c81('0x29')](_0x8c81('0x69'),_0x866adb);}}try{_0x2e1962[_0x8c81('0x6a')]=_0x22a4aa[_0x8c81('0xb')]?JSON[_0x8c81('0x68')](_0x22a4aa[_0x8c81('0xb')]):{};}catch(_0x23b9f6){logger[_0x8c81('0x29')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x23b9f6);}if(_0x22a4aa[_0x8c81('0x6b')]){try{var _0x417163=require(_0x22a4aa[_0x8c81('0x6b')])[_0x8c81('0x6c')](this,_0x2e1962);_0x2e1962[_0x8c81('0x6d')]=Mustache[_0x8c81('0x6e')](_0x22a4aa['url'],_0x417163,{},['$$','$$']);if(_0x2e1962[_0x8c81('0x6a')]){_0x2e1962[_0x8c81('0x6a')]=JSON['parse'](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962[_0x8c81('0x6a')]),_0x417163,{},['$$','$$']));}if(_0x2e1962[_0x8c81('0x67')]){_0x2e1962['body']=JSON[_0x8c81('0x68')](Mustache[_0x8c81('0x6e')](JSON['stringify'](_0x2e1962['body']),_0x417163,{},['$$','$$']));}}catch(_0x9ba52e){logger['error'](_0x8c81('0x6f'),_0x9ba52e);}}rp(_0x2e1962)[_0x8c81('0x19')](function(_0x20df01){var _0x2374a2={'statusCode':_0x20df01[_0x8c81('0x70')]||0xc8,'statusMessage':_0x20df01['statusMessage']||'OK','headers':_0x20df01['headers']||{},'body':_0x20df01[_0x8c81('0x67')]||{}};_0x198c48(null,_0x2374a2);})[_0x8c81('0x15')](function(_0x4aeafe){var _0x58de6a={'statusCode':_0x4aeafe[_0x8c81('0x70')]||0x1f4,'statusMessage':_0x4aeafe['message']||_0x8c81('0x71'),'headers':_0x4aeafe[_0x8c81('0x72')][_0x8c81('0x6a')]||{},'body':_0x4aeafe[_0x8c81('0x72')]['body']||{}};_0x198c48(null,_0x58de6a);});};AGIVertices['prototype']['googleDialogflow']=function(_0xd39626,_0xc2828f){scripts[_0x8c81('0x73')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0xd39626[_0x8c81('0x74')],_0xd39626[_0x8c81('0x58')],_0xd39626['dialogflow_language']||'en')[_0x8c81('0x19')](function(_0x5e3d40){_0xc2828f(null,_0x5e3d40);})['catch'](function(_0x31a3aa){_0xc2828f(_0x31a3aa);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x75')]=function(_0xa0c66e,_0x102d54){scripts['googleDialogflowV2'](this['channel'][_0x8c81('0x33')],_0xa0c66e[_0x8c81('0x76')],_0xa0c66e[_0x8c81('0x77')],_0xa0c66e[_0x8c81('0x78')],_0xa0c66e['text'],_0xa0c66e[_0x8c81('0x79')]||'en')[_0x8c81('0x19')](function(_0x2df0fa){_0x102d54(null,_0x2df0fa);})[_0x8c81('0x15')](function(_0x1d8e1c){_0x102d54(_0x1d8e1c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7a')]=function(_0x1fa933,_0x1936df){scripts[_0x8c81('0x7a')](this[_0x8c81('0xf')],_0x1fa933)[_0x8c81('0x19')](function(_0x3f1dab){_0x1936df(null,_0x3f1dab);})['catch'](function(_0x39a84f){_0x1936df(_0x39a84f);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7b')]=function(_0x27b542,_0x2a4815){scripts[_0x8c81('0x7b')](_0x27b542[_0x8c81('0x74')],_0x27b542[_0x8c81('0x58')],_0x27b542[_0x8c81('0x7c')]||'en-US',_0x27b542[_0x8c81('0x7d')])[_0x8c81('0x19')](function(_0x376b7d){_0x2a4815(null,_0x376b7d);})[_0x8c81('0x15')](function(_0x18ad13){_0x2a4815(_0x18ad13);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x7e')]=function(_0x3183e6,_0x151a69,_0x457e00){scripts[_0x8c81('0x7e')](_0x151a69,_0x3183e6[_0x8c81('0x74')],_0x3183e6[_0x8c81('0x7f')]||_0x8c81('0x80'),this[_0x8c81('0x81')](_0x3183e6[_0x8c81('0x82')])?_0x3183e6[_0x8c81('0x82')]:undefined)[_0x8c81('0x19')](function(_0x2b1832){_0x457e00(null,_0x2b1832);})[_0x8c81('0x15')](function(_0x1db93c){_0x457e00(_0x1db93c);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x83')]=function(_0x1108e6,_0x184a0b){scripts[_0x8c81('0x83')](_0x1108e6['aws_access_key_id'],_0x1108e6[_0x8c81('0x84')],_0x1108e6[_0x8c81('0x85')],_0x1108e6[_0x8c81('0x86')]||_0x8c81('0x87'),_0x1108e6[_0x8c81('0x58')],_0x1108e6[_0x8c81('0x88')]||_0x8c81('0x58'))[_0x8c81('0x19')](function(_0x12d591){_0x184a0b(null,_0x12d591);})[_0x8c81('0x15')](function(_0x3ad4d5){_0x184a0b(_0x3ad4d5);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x89')]=function(_0x23b7c4,_0x37220e){scripts[_0x8c81('0x89')](this[_0x8c81('0xf')][_0x8c81('0x33')],_0x23b7c4[_0x8c81('0x8a')],_0x23b7c4[_0x8c81('0x84')],_0x23b7c4[_0x8c81('0x8b')],_0x23b7c4[_0x8c81('0x58')],_0x23b7c4[_0x8c81('0x8c')])[_0x8c81('0x19')](function(_0x4e1e9d){_0x37220e(null,_0x4e1e9d);})[_0x8c81('0x15')](function(_0x4f9318){_0x37220e(_0x4f9318);});};AGIVertices[_0x8c81('0x12')]['googleASR']=function(_0x47da0c,_0x58a9e7,_0x148ac4){scripts[_0x8c81('0x8d')](_0x58a9e7,_0x47da0c[_0x8c81('0x74')],_0x47da0c[_0x8c81('0x8e')]||_0x8c81('0x80'))[_0x8c81('0x19')](function(_0x288981){_0x148ac4(null,_0x288981);})[_0x8c81('0x15')](function(_0x221988){_0x148ac4(_0x221988);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x8f')]=function(_0x20fdaf,_0x33f9a9,_0x4a19c4){scripts[_0x8c81('0x8f')](_0x33f9a9,_0x20fdaf[_0x8c81('0x90')],_0x20fdaf['appsecret'],_0x20fdaf[_0x8c81('0x6d')])[_0x8c81('0x19')](function(_0x353606){_0x4a19c4(null,_0x353606);})[_0x8c81('0x15')](function(_0x1224af){_0x4a19c4(_0x1224af);});};AGIVertices[_0x8c81('0x12')][_0x8c81('0x91')]=function(_0x4afc4b){var _0x2b8b52=_['includes'](verticesWithRetry,_0x4afc4b['agicommand'])?_0x4afc4b:_[_0x8c81('0x92')](_0x4afc4b);for(var _0x23ea3e in _0x2b8b52){if(_0x2b8b52[_0x8c81('0x93')](_0x23ea3e)){if(_0x2b8b52[_0x23ea3e]&&_['isString'](_0x2b8b52[_0x23ea3e])){if(_[_0x8c81('0x63')](recursiveMapAttributes,_0x23ea3e)){_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x94')](_0x2b8b52[_0x23ea3e]);}else{_0x2b8b52[_0x23ea3e]=this[_0x8c81('0x95')](_0x2b8b52[_0x23ea3e]);}}}}return _0x2b8b52;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x96')]=function(_0xfdc1a2){for(var _0x319fd8 in _0xfdc1a2){if(_0xfdc1a2['hasOwnProperty'](_0x319fd8)){if(_[_0x8c81('0x97')](_0xfdc1a2[_0x319fd8])){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8]);}else if(_[_0x8c81('0x98')](_0xfdc1a2[_0x319fd8])){for(var _0x16a5c4=0x0;_0x16a5c4<_0xfdc1a2[_0x319fd8][_0x8c81('0x99')];_0x16a5c4++){this[_0x8c81('0x96')](_0xfdc1a2[_0x319fd8][_0x16a5c4]);}}else if(_['isString'](_0xfdc1a2[_0x319fd8])){_0xfdc1a2[_0x319fd8]=this[_0x8c81('0x95')](_0xfdc1a2[_0x319fd8]);}}}};AGIVertices['prototype'][_0x8c81('0x9a')]=function(_0x19324a,_0x13b30d){for(var _0x22c0fe in _0x19324a){if(_0x19324a[_0x8c81('0x93')](_0x22c0fe)){if(_[_0x8c81('0x97')](_0x19324a[_0x22c0fe])){if(!_[_0x8c81('0x42')](_0x19324a[_0x22c0fe])){this[_0x8c81('0x9a')](_0x19324a[_0x22c0fe],util[_0x8c81('0x27')]('%s.%s',_0x13b30d,_0x22c0fe));}}else if(_[_0x8c81('0x98')](_0x19324a[_0x22c0fe])){for(var _0x47851a=0x0;_0x47851a<_0x19324a[_0x22c0fe]['length'];_0x47851a++){this['saveRestApiResult'](_0x19324a[_0x22c0fe][_0x47851a],util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe+'['+_0x47851a+']'));}}else{if(!_['isNil'](_0x19324a[_0x22c0fe])){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format'](_0x8c81('0x9b'),_0x13b30d,_0x22c0fe),_0x19324a[_0x22c0fe]);}}}}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x94')]=function(_0x23dcc3){try{var _0x43c3eb=JSON['parse'](_0x23dcc3);this[_0x8c81('0x96')](_0x43c3eb);return JSON[_0x8c81('0x9d')](_0x43c3eb);}catch(_0x2cc3ba){return this['replaceAllVariables'](_0x23dcc3);}};AGIVertices[_0x8c81('0x12')]['replaceAllVariables']=function(_0x24e269){var _0x20230b=_0x24e269[_0x8c81('0x9e')]('{');for(var _0x3f154f=0x1;_0x3f154f<_0x20230b[_0x8c81('0x99')];_0x3f154f+=0x1){var _0x231516=_0x20230b[_0x3f154f][_0x8c81('0x9e')]('}');if(_0x231516[_0x8c81('0x99')]>0x1){_0x24e269=_0x24e269[_0x8c81('0x9f')]('{'+_0x231516[0x0]+'}',this['channel'][_0x8c81('0xa0')](_0x231516[0x0])['extra']||_0x231516[0x0]);}}if(_0x20230b['length']===0x1){return _0x24e269['toString']();}return this[_0x8c81('0x95')](_0x24e269);};AGIVertices['prototype'][_0x8c81('0xa1')]=function(_0x3c7302,_0x2cb331){var _0x534965=this[_0x8c81('0xf')]['getVariable'](_0x3c7302);if(_0x534965[_0x8c81('0xa2')]===-0x1){return _0x534965;}logger[_0x8c81('0x2b')](util['format']('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x2cb331,_0x534965[_0x8c81('0xa3')]));return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x2cb331,_0x534965[_0x8c81('0xa3')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x81')]=function(_0x28aa15){return _0x28aa15&&_0x28aa15!=='0'&&_0x28aa15!=='-1'&&_0x28aa15!=='';};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa4')]=function(_0x4f0f00){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4f0f00,'-');_0x4f0f00['retry']=_0x4f0f00[_0x8c81('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype']['mrcpsynth']=function(_0x4291f8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xa5'),_0x4291f8[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4291f8[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x4adeb1='\x22'+_0x4291f8['text']+'\x22';if(this['isConfigured'](_0x4291f8[_0x8c81('0x72')])){_0x4adeb1+=','+_0x4291f8[_0x8c81('0x72')];}var _0x5d0e21=this[_0x8c81('0xf')][_0x8c81('0x55')]('MRCPSynth',_0x4adeb1);if(_0x5d0e21[_0x8c81('0xa2')]===-0x1){return _0x5d0e21;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xa8'),_0x4adeb1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa9')]=function(_0x7c5c5){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xaa'),_0x7c5c5[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0xab')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20grammar\x20configured');}var _0x1b51f8=_0x7c5c5[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x7c5c5[_0x8c81('0x72')])){_0x1b51f8+=','+_0x7c5c5[_0x8c81('0x72')];}var _0xecf47b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xac'),_0x1b51f8);if(_0xecf47b[_0x8c81('0xa2')]===-0x1){return _0xecf47b;}var _0x5aa1bb=this[_0x8c81('0xa1')](_0x8c81('0xad'),_0x8c81('0xae'));if(_0x5aa1bb[_0x8c81('0xa2')]===-0x1){return _0x5aa1bb;}var _0x4b35f3=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xb0'));if(_0x4b35f3[_0x8c81('0xa2')]===-0x1){return _0x4b35f3;}var _0x3de2c6=this[_0x8c81('0xa1')](_0x8c81('0xb1'),'MRCP_RECOG_INSTANCE');if(_0x3de2c6[_0x8c81('0xa2')]===-0x1){return _0x3de2c6;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xb2'),_0x1b51f8));};AGIVertices['prototype'][_0x8c81('0x8')]=function(_0x57f14c){logger['info'](util['format'](_0x8c81('0xb3'),_0x57f14c['label']));return this[_0x8c81('0xf')][_0x8c81('0x8')]([_0x57f14c[_0x8c81('0xb4')],_0x57f14c[_0x8c81('0xb5')]]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0xb6')]=function(_0x581a09){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb7'),_0x581a09['label']));if(this[_0x8c81('0x81')](_0x581a09[_0x8c81('0x61')])){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xb8'),_0x581a09[_0x8c81('0x61')]));var _0x4a1ea1=this[_0x8c81('0xf')]['wait'](_0x581a09[_0x8c81('0x61')]);if(_0x4a1ea1[_0x8c81('0xa2')]===-0x1){return _0x4a1ea1;}}return this[_0x8c81('0xf')][_0x8c81('0xb6')]();};AGIVertices['prototype']['callback']=function(_0x544990){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xb9'),_0x544990[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x46')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x544990,_0x8c81('0xba'));}_0x544990['scheduledAt']=moment();if(this[_0x8c81('0x81')](_0x544990[_0x8c81('0xbb')])){_0x544990['scheduledAt']=moment()[_0x8c81('0xbc')](_0x544990['delay'],_0x8c81('0xbd'));}if(!this[_0x8c81('0x81')](_0x544990[_0x8c81('0x4a')])){_0x544990[_0x8c81('0x4a')]=0x2;}this['createCmContact']['sync'](this,_0x544990);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x544990[_0x8c81('0x45')],_0x544990[_0x8c81('0x46')],_0x544990[_0x8c81('0x47')]));};AGIVertices[_0x8c81('0x12')]['custom_app']=function(_0x19f29e){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xbe'),_0x19f29e[_0x8c81('0x34')]));var _0x24b481=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x19f29e[_0x8c81('0xbf')],_0x19f29e[_0x8c81('0x72')]);if(_0x24b481[_0x8c81('0xa2')]===-0x1){return _0x24b481;}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x19f29e['application'],_0x19f29e[_0x8c81('0x72')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc1')]=function(_0x1bcb85){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x1bcb85[_0x8c81('0x34')]));if(!this['isConfigured'](_0x1bcb85[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}var _0x38e4a1='\x22'+_0x1bcb85[_0x8c81('0x58')]+'\x22';if(this[_0x8c81('0x81')](_0x1bcb85[_0x8c81('0x72')])){_0x38e4a1+=','+_0x1bcb85[_0x8c81('0x72')];}var _0x25728b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xc2'),_0x38e4a1);if(_0x25728b['result']===-0x1){return _0x25728b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xa8'),_0x38e4a1));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc3')]=function(_0x321819){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x321819[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x321819['text'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xa7'));}var _0x4f1880='\x22'+_0x321819['text']+'\x22';if(this[_0x8c81('0x81')](_0x321819[_0x8c81('0x72')])){_0x4f1880+=','+_0x321819['options'];}var _0x7eec41=this[_0x8c81('0xf')]['exec'](_0x8c81('0xc2'),_0x4f1880);if(_0x7eec41['result']===-0x1){return _0x7eec41;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20MRCPSynth\x20%s',_0x4f1880));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xc4')]=function(_0x65e0fa){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xc5'),_0x65e0fa[_0x8c81('0x34')]));if(!this['isConfigured'](_0x65e0fa['grammar'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xc6'));}var _0xd80cc0=_0x65e0fa[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x65e0fa[_0x8c81('0x72')])){_0xd80cc0+=','+_0x65e0fa[_0x8c81('0x72')];}var _0x30ce49=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0xd80cc0);if(_0x30ce49[_0x8c81('0xa2')]===-0x1){return _0x30ce49;}var _0x1f43ca=this[_0x8c81('0xa1')](_0x8c81('0xad'),'LUMENVOX_ASR_CONFIDENCE');if(_0x1f43ca[_0x8c81('0xa2')]===-0x1){return _0x1f43ca;}var _0x5a8c91=this[_0x8c81('0xa1')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5a8c91[_0x8c81('0xa2')]===-0x1){return _0x5a8c91;}var _0xb2544=this[_0x8c81('0xa1')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0xb2544[_0x8c81('0xa2')]===-0x1){return _0xb2544;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0xd80cc0));};AGIVertices['prototype'][_0x8c81('0xc7')]=function(_0x5bce2b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x5bce2b['label']));if(!this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0xab')])){return this[_0x8c81('0xf')]['noop']('no\x20grammar\x20configured');}var _0x539443=_0x5bce2b[_0x8c81('0xab')];if(this[_0x8c81('0x81')](_0x5bce2b[_0x8c81('0x72')])){_0x539443+=','+_0x5bce2b[_0x8c81('0x72')];}var _0x24f82e=this['channel'][_0x8c81('0x55')](_0x8c81('0xac'),_0x539443);if(_0x24f82e[_0x8c81('0xa2')]===-0x1){return _0x24f82e;}var _0x1eca51=this[_0x8c81('0xa1')]('RECOG_CONFIDENCE()',_0x8c81('0xc8'));if(_0x1eca51[_0x8c81('0xa2')]===-0x1){return _0x1eca51;}var _0x21ca21=this[_0x8c81('0xa1')](_0x8c81('0xaf'),_0x8c81('0xc9'));if(_0x21ca21[_0x8c81('0xa2')]===-0x1){return _0x21ca21;}var _0x29b7b8=this[_0x8c81('0xa1')](_0x8c81('0xb1'),_0x8c81('0xca'));if(_0x29b7b8[_0x8c81('0xa2')]===-0x1){return _0x29b7b8;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xb2'),_0x539443));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xcb')]=function(_0x45cb0a){logger['info'](util[_0x8c81('0x27')](_0x8c81('0xcc'),_0x45cb0a[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x45cb0a['odbc_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xcd'));}var _0x1278f8=this[_0x8c81('0xce')][_0x8c81('0x6c')](this,_0x45cb0a[_0x8c81('0xcf')]);if(!_0x1278f8){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd0'));}if(!this['isConfigured'](_0x45cb0a[_0x8c81('0x2c')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd1'));}var _0x4f962b=_0x45cb0a[_0x8c81('0x2c')][_0x8c81('0xd2')](/(\r\n|\n|\r)/gm,'\x20');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('query:\x20%s',_0x4f962b));var _0x973fbd=this[_0x8c81('0xd3')]['sync'](this,_0x1278f8,_0x4f962b);this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x45cb0a,_0x4f962b);if(!this['isConfigured'](_0x45cb0a[_0x8c81('0xd4')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x4e7221=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x45cb0a['variable_id']);if(!_0x4e7221){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x45cb0a,_0x8c81('0xd6'));}var _0x31c1f9=this;_0x973fbd[_0x8c81('0xd7')](function(_0x5185b2,_0x3f4d52){Object[_0x8c81('0xd8')](_0x5185b2)[_0x8c81('0xd7')](function(_0x4d6c68){_0x31c1f9[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')]('%s[%s][%s]',_0x4e7221,_0x3f4d52,_0x4d6c68),_0x5185b2[_0x4d6c68]);});});this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xd9'),_0x4e7221),_0x973fbd[_0x8c81('0x99')]);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x4e7221));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xdb')]=function(_0x1cdd2d){logger[_0x8c81('0xdc')](util[_0x8c81('0x27')](_0x8c81('0xdd'),_0x1cdd2d[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1cdd2d[_0x8c81('0xde')])){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xdf'));}var _0x58543d=this[_0x8c81('0xe0')][_0x8c81('0x6c')](this,_0x1cdd2d[_0x8c81('0xde')]);if(!_0x58543d){return this['channel'][_0x8c81('0x29')](_0x1cdd2d,_0x8c81('0xe1'));}var _0x5e589b=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0xe3'),_0x58543d),_0x1cdd2d[_0x8c81('0x61')],_0x1cdd2d[_0x8c81('0xe4')],_0x1cdd2d[_0x8c81('0x60')]]);if(_0x5e589b[_0x8c81('0xa2')]===-0x1){return _0x5e589b;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xe5'),'DIAL'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe6')]=function(_0x1d5121){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0xe7'),_0x1d5121['label']));if(!this['isConfigured'](_0x1d5121[_0x8c81('0x74')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0x1d5121[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x1d5121);this[_0x8c81('0x40')](_0x1d5121[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0xea'),_0x1d5121[_0x8c81('0x58')]));var _0x24166d=this[_0x8c81('0x73')][_0x8c81('0x6c')](this,_0x1d5121);if(_0x24166d){for(var _0x1ef06c in _0x24166d){if(_0x24166d[_0x8c81('0x93')](_0x1ef06c)){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x1ef06c[_0x8c81('0x66')]()),_0x24166d[_0x1ef06c]);}}this[_0x8c81('0x40')](_0x24166d[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xe6'),'');return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0xee'),_0x24166d[_0x8c81('0xec')]));}return this['channel'][_0x8c81('0x29')](_0x1d5121,_0x8c81('0xef'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf0')]=function(_0x52b2be){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xf1'),_0x52b2be[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x76')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf2'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x77')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf3'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x78')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xf4'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x79')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xf5'));}if(!this[_0x8c81('0x81')](_0x52b2be[_0x8c81('0x58')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20text\x20configured');}this['channel'][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x52b2be);this[_0x8c81('0x40')](_0x52b2be[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf6'),_0x52b2be[_0x8c81('0x58')]));var _0x3243fe=this['googleDialogflowV2'][_0x8c81('0x6c')](this,_0x52b2be);if(_0x3243fe){for(var _0x3fabfa in _0x3243fe){if(_0x3243fe[_0x8c81('0x93')](_0x3fabfa)){if(_0x3fabfa!=='providerResponse'){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0xeb'),_0x3fabfa[_0x8c81('0x66')]()),_0x3243fe[_0x3fabfa]);}}}this['createSquareMessage'](_0x3243fe[_0x8c81('0xec')],_0x8c81('0xed'),_0x8c81('0xf0'),_0x3243fe[_0x8c81('0xf7')]);return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xf8'),_0x3243fe['speech']));}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x52b2be,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xf9')]=function(_0x262d55){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0xfa'),_0x262d55['label']));if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfb')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x8c81('0x81')](_0x262d55['username'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfc'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xfd')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xfe'));}if(!this[_0x8c81('0x81')](_0x262d55[_0x8c81('0xff')])){return this['channel'][_0x8c81('0xa6')]('no\x20text\x20configured');}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this[_0x8c81('0x32')](_0x262d55);this[_0x8c81('0x40')](_0x262d55[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x100'),_0x262d55['text']));var _0xd5c5e6=this[_0x8c81('0x7a')]['sync'](this,_0x262d55);if(_0xd5c5e6){for(var _0x4af755 in _0xd5c5e6){if(_0xd5c5e6[_0x8c81('0x93')](_0x4af755)){this[_0x8c81('0xf')]['setVariable'](util[_0x8c81('0x27')](_0x8c81('0x101'),_0x4af755[_0x8c81('0x66')]()),_0xd5c5e6[_0x4af755]);}}this['createSquareMessage'](_0xd5c5e6[_0x8c81('0xec')],'out',_0x8c81('0xf9'),'');if(_0xd5c5e6[_0x8c81('0x102')]){this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0xd5c5e6[_0x8c81('0x102')]));var _0x407995=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xd5c5e6[_0x8c81('0x102')]);try{fs[_0x8c81('0x104')](_0xd5c5e6[_0x8c81('0x102')]+'.wav');}catch(_0x4be698){logger['error'](_0x4be698);}return _0x407995;}else{return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x105'),_0xd5c5e6[_0x8c81('0xec')]));}}return this[_0x8c81('0xf')]['error'](_0x262d55,_0x8c81('0x106'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x107')]=function(_0x4af7d8){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x108'),_0x4af7d8[_0x8c81('0x34')]));return this[_0x8c81('0xf')]['noop'](_0x8c81('0x107'));};AGIVertices[_0x8c81('0x12')]['ext_dial']=function(_0x41ba3c){logger['info'](util['format'](_0x8c81('0x109'),_0x41ba3c[_0x8c81('0x34')]));var _0xe364d1='';if(_0x41ba3c[_0x8c81('0x10a')]){if(!this[_0x8c81('0x81')](_0x41ba3c[_0x8c81('0x10a')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}else{var _0x28d85c=parseInt(_0x41ba3c[_0x8c81('0x10a')],0xa);if(isNaN(_0x28d85c)){_0xe364d1=_0x41ba3c[_0x8c81('0x10a')];}else{_0xe364d1=this['getTrunk']['sync'](this,_0x41ba3c[_0x8c81('0x10a')]);if(!_0xe364d1){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10c'));}}}}else if(_0x41ba3c[_0x8c81('0x10d')]){_0xe364d1=_0x41ba3c['trunk_name'];}else{return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x41ba3c,_0x8c81('0x10b'));}var _0x3636ce=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0xe2'),[util[_0x8c81('0x27')](_0x8c81('0x10e'),_0xe364d1,_0x41ba3c['phone']),_0x41ba3c[_0x8c81('0x61')],_0x41ba3c[_0x8c81('0xe4')],_0x41ba3c[_0x8c81('0x60')]]);if(_0x3636ce[_0x8c81('0xa2')]===-0x1){return _0x3636ce;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Executed\x20command\x20%s',_0x8c81('0xe2')));};AGIVertices['prototype']['finally']=function(_0x53a6f6){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x53a6f6[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')]('finally');};AGIVertices[_0x8c81('0x12')][_0x8c81('0xe')]=function(_0x3459a1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x10f'),_0x3459a1[_0x8c81('0x34')]));if(_0x3459a1['retry']===0x0){return this['maxRetry'](_0x3459a1);}_0x3459a1[_0x8c81('0x110')]-=0x1;if(!this[_0x8c81('0x81')](_0x3459a1['file_id'])){return this['channel'][_0x8c81('0x29')](_0x3459a1,_0x8c81('0x111'));}var _0x33f865=this['getSound']['sync'](this,_0x3459a1[_0x8c81('0x112')]);if(!_0x33f865){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,'no\x20file\x20audio\x20found');}if(!this[_0x8c81('0x81')](_0x3459a1[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x8c81('0xd5'));}var _0x1fa6a3=this[_0x8c81('0xf')]['getData'](_0x33f865,_0x3459a1[_0x8c81('0x113')],_0x3459a1['maxdigit']);var _0x263bfb=_0x1fa6a3['result']?_0x1fa6a3[_0x8c81('0xa2')][_0x8c81('0x49')]():'';logger[_0x8c81('0x2b')](_0x8c81('0x114'),JSON[_0x8c81('0x9d')](_0x1fa6a3));if(_0x1fa6a3[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);return _0x1fa6a3;}else if(_0x1fa6a3[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1['mindigit'])?'x':'i';}else{_0x1fa6a3[_0x8c81('0xa2')]=_0x263bfb[_0x8c81('0x99')]>=parseInt(_0x3459a1[_0x8c81('0x115')])&&_0x263bfb[_0x8c81('0x99')]<=parseInt(_0x3459a1['maxdigit'])?'x':'i';}var _0x5587df=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x3459a1[_0x8c81('0xd4')]);if(!_0x5587df){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x3459a1,_0x8c81('0xd6'));}this[_0x8c81('0xf')]['setVariable'](_0x5587df,_0x263bfb);if(this[_0x8c81('0x81')](_0x3459a1['hiddendigitsnum'])){var _0xd71cc4=parseInt(_0x3459a1[_0x8c81('0x116')],0xa);var _0x2a7a39=rs[_0x8c81('0x117')]({'charset':'*','length':_0xd71cc4});var _0x27b0e6=_0x263bfb['length'];if(_0x27b0e6>0x0){if(_0x27b0e6>_0xd71cc4){this['createSquareDetailsReport'][_0x8c81('0x6c')](this,_0x3459a1,_0x3459a1[_0x8c81('0x118')]==='first'?_0x2a7a39+_0x263bfb[_0x8c81('0x119')](_0xd71cc4):_0x263bfb[_0x8c81('0x119')](0x0,_0x27b0e6-_0xd71cc4)+_0x2a7a39);}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,rs[_0x8c81('0x117')]({'charset':'*','length':_0x27b0e6}));}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,'');}}else{this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x3459a1,_0x263bfb);}return _0x1fa6a3;};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11a')]=function(_0x46ae88){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x11b'),_0x46ae88[_0x8c81('0x34')]));return this[_0x8c81('0xe')](_0x46ae88);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x11c')]=function(_0xbbeb50){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x11d'),_0xbbeb50[_0x8c81('0x34')]));this[_0x8c81('0x32')]['sync'](this,_0xbbeb50,_0xbbeb50['goalname']);return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x11e'),_0xbbeb50[_0x8c81('0x11f')]));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x120')]=function(_0x46b98c){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x121'),_0x46b98c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x8a')])||!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x122'));}if(!this[_0x8c81('0x81')](_0x46b98c[_0x8c81('0x58')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x123'),_0x46b98c['text']));var _0x120fea=this['awsPolly'][_0x8c81('0x6c')](this,_0x46b98c);if(_0x120fea){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x124'),_0x120fea));var _0x236bb5=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x120fea);try{fs[_0x8c81('0x104')](_0x120fea+_0x8c81('0x125'));}catch(_0x3a4f36){logger[_0x8c81('0x29')](_0x3a4f36);}return _0x236bb5;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x46b98c,_0x8c81('0x126'));};AGIVertices[_0x8c81('0x12')]['awslex']=function(_0x2f1b04){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x127'),_0x2f1b04[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2f1b04['aws_access_key_id'])||!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x84')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x8c')])){return this['channel']['noop'](_0x8c81('0x128'));}if(!this[_0x8c81('0x81')](_0x2f1b04[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xe9')]=!![];this['createSquareDetailsReport'](_0x2f1b04);this['createSquareMessage'](_0x2f1b04[_0x8c81('0x58')],'in','','');this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('Trying\x20Amazon\x20Lex:\x20%s',_0x2f1b04['text']));var _0x449395=this[_0x8c81('0x89')][_0x8c81('0x6c')](this,_0x2f1b04);if(_0x449395){for(var _0x58daa6 in _0x449395){if(_0x449395['hasOwnProperty'](_0x58daa6)&&_['isString'](_0x449395[_0x58daa6])){this['channel'][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x129'),_0x58daa6[_0x8c81('0x66')]()),_0x449395[_0x58daa6]);}}if(_[_0x8c81('0x43')](_0x449395[_0x8c81('0x12a')])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0x12b'));}else{this['createSquareMessage'](_0x449395[_0x8c81('0x12a')],_0x8c81('0xed'),_0x8c81('0x12c'),'');return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x12d'),_0x449395['message']));}}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2f1b04,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')]['googleasr']=function(_0x6598f0){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x12e'),_0x6598f0[_0x8c81('0x34')],_0x6598f0[_0x8c81('0x61')]));if(!this['isConfigured'](_0x6598f0[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}var _0x280d0d=_0x8c81('0x12f');var _0x1c1896=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x360545=util['format'](_0x8c81('0x9b'),_0x1c1896,_0x280d0d);var _0xfb0b44=!![];if(_0x6598f0[_0x8c81('0x131')]==='NOBEEP'){_0xfb0b44=![];}var _0x4b9e5d=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1c1896,_0x280d0d,_0x6598f0[_0x8c81('0x133')],_0x6598f0[_0x8c81('0x61')],undefined,_0xfb0b44);if(_0x4b9e5d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x134'),_0x360545));var _0x4bf5c6=this[_0x8c81('0x8d')][_0x8c81('0x6c')](this,_0x6598f0,_0x360545);if(_0x4bf5c6){for(var _0x1a7d63 in _0x4bf5c6){if(_0x4bf5c6[_0x8c81('0x93')](_0x1a7d63)){this['channel'][_0x8c81('0x9c')](util['format'](_0x8c81('0x135'),_0x1a7d63[_0x8c81('0x66')]()),_0x4bf5c6[_0x1a7d63]);}}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x136'),JSON[_0x8c81('0x9d')](_0x4bf5c6)));}}return _0x4b9e5d;};AGIVertices['prototype'][_0x8c81('0x137')]=function(_0x20779f){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x138'),_0x20779f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x90')])){return this[_0x8c81('0xf')]['noop']('no\x20appid\x20configured');}if(!this[_0x8c81('0x81')](_0x20779f[_0x8c81('0x139')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20appsecret\x20configured');}var _0x598d66='wav';var _0x1b621c=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x5a3734=util[_0x8c81('0x27')](_0x8c81('0x9b'),_0x1b621c,_0x598d66);var _0x40c6fa=!![];if(_0x20779f[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x40c6fa=![];}var _0x52dbac=this[_0x8c81('0xf')][_0x8c81('0x132')](_0x1b621c,_0x598d66,_0x20779f[_0x8c81('0x133')],_0x20779f[_0x8c81('0x61')],undefined,_0x40c6fa);if(_0x52dbac[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x13b'),_0x5a3734));var _0x3bbea0=this[_0x8c81('0x8f')][_0x8c81('0x6c')](this,_0x20779f,_0x5a3734);if(_0x3bbea0){for(var _0x474dbb in _0x3bbea0){if(_0x3bbea0[_0x8c81('0x93')](_0x474dbb)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util['format']('TILDE_ASR_%s',_0x474dbb[_0x8c81('0x66')]()),_0x3bbea0[_0x474dbb]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x13c'),JSON[_0x8c81('0x9d')](_0x3bbea0)));}}return _0x52dbac;};AGIVertices['prototype'][_0x8c81('0x13d')]=function(_0x22ce14){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x13e'),_0x22ce14[_0x8c81('0x34')]));return this['channel']['continueAt'](_0x22ce14[_0x8c81('0x3a')],_0x22ce14['extension'],_0x22ce14[_0x8c81('0x3c')]);};AGIVertices['prototype'][_0x8c81('0x13f')]=function(_0x50afad){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x140'),_0x50afad[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x50afad['condition'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x50afad,_0x8c81('0x141'));}try{var _0x5b79b9=eval(_0x50afad[_0x8c81('0x142')])?_0x8c81('0x143'):_0x8c81('0x144');this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x145'),_0x50afad[_0x8c81('0x142')],_0x5b79b9));return{'code':0xc8,'result':_0x5b79b9};}catch(_0x568d66){return{'code':0xc8,'result':_0x8c81('0x144')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x146')]=function(_0x2b85fc){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x147'),_0x2b85fc[_0x8c81('0x34')]));if(!this['isConfigured'](_0x2b85fc[_0x8c81('0x148')])){return this['channel'][_0x8c81('0x29')](_0x2b85fc,_0x8c81('0x149'));}var _0x1d8f2c=this[_0x8c81('0x14a')][_0x8c81('0x6c')](this,_0x2b85fc[_0x8c81('0x148')]);if(!_0x1d8f2c){return this['channel']['error'](_0x2b85fc,'no\x20intervals\x20found');}for(var _0x53d4d7=0x0;_0x53d4d7<_0x1d8f2c[_0x8c81('0x99')];_0x53d4d7+=0x1){var _0x343b31=this[_0x8c81('0xf')]['getVariable'](util['format']('IFTIME(%s?true:false)',_0x1d8f2c[_0x53d4d7]));if(_0x343b31['result']===-0x1){return _0x343b31;}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x343b31[_0x8c81('0xa3')]));if(_0x343b31[_0x8c81('0xa3')]===_0x8c81('0x143')){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));this[_0x8c81('0xf')]['noop'](util['format'](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],_0x8c81('0x143')));return{'code':0xc8,'result':_0x8c81('0x143')};}else{logger['info'](util[_0x8c81('0x27')]('IFTIME\x20%s\x20%s',_0x1d8f2c[_0x53d4d7],_0x8c81('0x144')));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x14b'),_0x1d8f2c[_0x53d4d7],'false'));}}return{'code':0xc8,'result':_0x8c81('0x144')};};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14c')]=function(_0x135af4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14d'),_0x135af4[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x14c')]();};AGIVertices[_0x8c81('0x12')][_0x8c81('0x14e')]=function(_0x49df03){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x14f'),_0x49df03[_0x8c81('0x34')]));if(!this['isConfigured'](_0x49df03['key'])){return this[_0x8c81('0xf')]['noop'](_0x8c81('0xe8'));}var _0x5f380b=_0x8c81('0x12f');var _0x43dd88=util['format'](_0x8c81('0x130'),FILES_PATH,rs[_0x8c81('0x117')](0x4));var _0x3dd6ed=util['format']('%s.%s',_0x43dd88,_0x5f380b);var _0x1df8af=!![];if(_0x49df03[_0x8c81('0x131')]===_0x8c81('0x13a')){_0x1df8af=![];}var _0x29148d=this['channel'][_0x8c81('0x132')](_0x43dd88,_0x5f380b,_0x49df03[_0x8c81('0x133')],_0x49df03['timeout'],undefined,_0x1df8af);if(_0x29148d[_0x8c81('0xa2')]!==-0x1){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x150'),_0x3dd6ed));var _0x2f91e7=this[_0x8c81('0x7e')][_0x8c81('0x6c')](this,_0x49df03,_0x3dd6ed);if(_0x2f91e7){for(var _0x8eb411 in _0x2f91e7){if(_0x2f91e7[_0x8c81('0x93')](_0x8eb411)){this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x151'),_0x8eb411[_0x8c81('0x66')]()),_0x2f91e7[_0x8eb411]);}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x152'),JSON['stringify'](_0x2f91e7)));}}return _0x29148d;};AGIVertices['prototype'][_0x8c81('0x153')]=function(_0xe87c0b){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x154'),_0xe87c0b[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xe87c0b[_0x8c81('0x74')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xe8'));}if(!this[_0x8c81('0x81')](_0xe87c0b['text'])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x155'),_0xe87c0b['text']));var _0xcc4bb1=this[_0x8c81('0x7b')][_0x8c81('0x6c')](this,_0xe87c0b);if(_0xcc4bb1){this['channel']['noop'](util[_0x8c81('0x27')](_0x8c81('0x150'),_0xcc4bb1));var _0x5955e3=this[_0x8c81('0xf')][_0x8c81('0x103')](_0xcc4bb1,_0xe87c0b[_0x8c81('0x133')]);try{fs['unlink'](_0xcc4bb1+_0x8c81('0x125'));}catch(_0x26d53d){logger[_0x8c81('0x29')](_0x26d53d);}return _0x5955e3;}return this['channel']['error'](_0xe87c0b,_0x8c81('0x156'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x157')]=function(_0x1cbe58){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20LOGIN\x20(%s)\x20block',_0x1cbe58['label']));if(!this['isConfigured'](_0x1cbe58[_0x8c81('0x158')])){return this['channel'][_0x8c81('0x29')](_0x1cbe58,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58[_0x8c81('0x158')]));var _0x1460c0=this[_0x8c81('0x51')]['sync'](this,_0x1cbe58[_0x8c81('0x158')]);if(_0x1460c0){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1cbe58['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1cbe58['findBy']));this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x8c81('0x38')],_0x1cbe58['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x8c81('0x15d')]=function(_0x549874){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15e'),_0x549874['label']));if(!this[_0x8c81('0x81')](_0x549874['findBy'])){return this[_0x8c81('0xf')]['error'](_0x549874,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')]['callerid'],_0x549874['findBy']));var _0x5a046a=this[_0x8c81('0x50')][_0x8c81('0x6c')](this,_0x549874[_0x8c81('0x158')]);if(_0x5a046a){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));this['channel'][_0x8c81('0xa6')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x549874[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x549874[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')]['math']=function(_0x18f4ff){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x161'),_0x18f4ff[_0x8c81('0x34')]));if(!this['isConfigured'](_0x18f4ff[_0x8c81('0x162')])){return this['channel'][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0x163'));}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('math\x20%s',_0x18f4ff[_0x8c81('0x162')]));var _0x42fa37=eval(_0x18f4ff['operation']);if(!this[_0x8c81('0x81')](_0x18f4ff[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0xd5'));}var _0x3e86af=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x18f4ff[_0x8c81('0xd4')]);if(!_0x3e86af){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x18f4ff,_0x8c81('0xd6'));}if(_[_0x8c81('0x98')](_0x42fa37)){var _0x3468ec=this;_0x42fa37[_0x8c81('0xd7')](function(_0x45f996,_0x36f4dc){_0x3468ec[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')]('%s[%s]',_0x3e86af,_0x36f4dc),_0x45f996);});return this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x164'),_0x3e86af));}else{return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x3e86af,_0x42fa37);}};AGIVertices[_0x8c81('0x12')][_0x8c81('0xd')]=function(_0x4516f1){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x165'),_0x4516f1[_0x8c81('0x34')]));if(_0x4516f1['retry']===0x0){return this[_0x8c81('0xa4')](_0x4516f1);}_0x4516f1['retry']-=0x1;if(!this['isConfigured'](_0x4516f1['file_id'])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x111'));}var _0x417cea=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0x112')]);if(!_0x417cea){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4516f1,_0x8c81('0x166'));}var _0x1292c2=this[_0x8c81('0xf')][_0x8c81('0x167')](_0x417cea,_0x4516f1[_0x8c81('0x113')],_0x4516f1['digit']);var _0x26624f=_0x1292c2[_0x8c81('0xa2')];if(_0x1292c2[_0x8c81('0xa2')]===-0x1){this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,'-1');return _0x1292c2;}else if(_0x1292c2[_0x8c81('0xa3')]===_0x8c81('0x61')){_0x1292c2[_0x8c81('0xa2')]=_0x1292c2[_0x8c81('0xa2')][_0x8c81('0x99')]>0x0?_0x1292c2[_0x8c81('0xa2')]:'t';}else if(_['isEmpty'](_0x1292c2[_0x8c81('0xa2')])){_0x1292c2[_0x8c81('0xa2')]='#';_0x26624f='#';}if(!this['isConfigured'](_0x4516f1[_0x8c81('0xd4')])){this[_0x8c81('0xf')][_0x8c81('0xa6')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x464a9c=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4516f1[_0x8c81('0xd4')]);if(!_0x464a9c){return this['channel']['error'](_0x4516f1,'no\x20variable\x20found');}this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x464a9c,_0x26624f);}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x4516f1,_0x26624f);return _0x1292c2;};AGIVertices[_0x8c81('0x12')][_0x8c81('0xa6')]=function(_0x5a6894){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x5a6894[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x5a6894[_0x8c81('0x168')]||_0x5a6894[_0x8c81('0x34')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x169')]=function(_0x1d4394){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x16a'),_0x1d4394[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x1d4394[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d4394,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));var _0x5ac59a=this[_0x8c81('0x4b')]['sync'](this,_0x1d4394[_0x8c81('0x16b')]);var _0xd2e897=this[_0x8c81('0x4e')][_0x8c81('0x6c')](this,_0x1d4394['findBy'],_0x5ac59a);if(_0xd2e897){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')]['callerid'],_0x1d4394[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0x1d4394['findBy']));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0x1d4394['findBy']));return{'code':0xc8,'result':_0x8c81('0x160')};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x16c')]=function(_0x357694){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x16d'),_0x357694[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x357694[_0x8c81('0x112')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x357694,_0x8c81('0x111'));}var _0x180bd2=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0x357694[_0x8c81('0x112')]);if(!_0x180bd2){return this['channel'][_0x8c81('0x29')](_0x357694,_0x8c81('0x166'));}var _0x197368=this[_0x8c81('0xf')][_0x8c81('0x55')]('PLAYBACK',[_0x180bd2,_0x357694['opts']]);if(_0x197368[_0x8c81('0xa2')]===-0x1){return _0x197368;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x16e'),_0x180bd2));};AGIVertices[_0x8c81('0x12')]['queue']=function(_0xa22de4){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x16f'),_0xa22de4[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x170')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xa22de4,_0x8c81('0x171'));}var _0x45ee0d='';var _0x463de7=parseInt(_0xa22de4[_0x8c81('0x170')],0xa);if(isNaN(_0x463de7)){_0x45ee0d=_0xa22de4[_0x8c81('0x170')];}else{_0x45ee0d=this['getVoiceQueue'][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x170')]);if(!_0x45ee0d){return this[_0x8c81('0xf')]['error'](_0xa22de4,_0x8c81('0x172'));}}var _0xb2c1df='';if(this[_0x8c81('0x81')](_0xa22de4[_0x8c81('0x112')])){var _0x3c6825=this[_0x8c81('0x1d')][_0x8c81('0x6c')](this,_0xa22de4[_0x8c81('0x112')]);if(_0x3c6825){_0xb2c1df=_0x3c6825;}}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0xa22de4,_0x45ee0d);if(_0xa22de4[_0x8c81('0xe4')][_0x8c81('0x173')]('x')<0x0){_0xa22de4['opts']+='x';}if(_0xa22de4['opts'][_0x8c81('0x173')]('X')<0x0){_0xa22de4[_0x8c81('0xe4')]+='X';}this[_0x8c81('0xf')]['setVariable'](_0x8c81('0x174'),_0x45ee0d?_0x45ee0d[_0x8c81('0x175')]():'');var _0x215959=this[_0x8c81('0xf')][_0x8c81('0x55')](_0x8c81('0x176'),[_0x45ee0d,_0xa22de4[_0x8c81('0xe4')],_0xa22de4[_0x8c81('0x60')],_0xb2c1df,_0xa22de4[_0x8c81('0x61')],_0xa22de4[_0x8c81('0x8')],_0xa22de4[_0x8c81('0x177')],_0xa22de4[_0x8c81('0x178')],'',_0xa22de4[_0x8c81('0x179')]]);if(_0x215959['result']===-0x1){return _0x215959;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x176'),_0x45ee0d));};AGIVertices[_0x8c81('0x12')]['record']=function(_0x4b3df1){logger['info'](util['format']('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4b3df1['label']));var _0x47a016=_0x4b3df1[_0x8c81('0x17a')]||_0x8c81('0x12f');var _0x1dac99=util['format'](_0x8c81('0x17b'),this[_0x8c81('0xf')][_0x8c81('0x33')],rs['generate'](0x5));var _0x5c5521=util['format'](_0x8c81('0x17c'),FILES_PATH,_0x1dac99,_0x47a016);var _0x5c56a0=util[_0x8c81('0x27')]('%s/recordings/%s',FILES_PATH,_0x1dac99);this[_0x8c81('0x37')][_0x8c81('0x6c')](this,_0x4b3df1,_0x1dac99,_0x5c5521);this['channel'][_0x8c81('0x9c')](_0x8c81('0x17d'),_0x1dac99);logger[_0x8c81('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x5c56a0,_0x47a016,_0x4b3df1['escape_digits'],_0x4b3df1[_0x8c81('0x61')]);return this[_0x8c81('0xf')][_0x8c81('0x132')](_0x5c56a0,_0x47a016,_0x4b3df1[_0x8c81('0x17e')],_0x4b3df1[_0x8c81('0x61')],undefined,!![]);};AGIVertices[_0x8c81('0x12')]['restapi']=function(_0x4d04b2){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x17f'),_0x4d04b2[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x4d04b2[_0x8c81('0x60')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x180'));}var _0x1fba2c=this['restAPI']['sync'](this,_0x4d04b2);logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x181'),util['inspect'](_0x1fba2c,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x4d04b2[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x182'));}var _0x21e98b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x4d04b2[_0x8c81('0xd4')]);if(!_0x21e98b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x4d04b2,_0x8c81('0xd6'));}this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x183'),_0x21e98b),_0x1fba2c[_0x8c81('0x70')]?_0x1fba2c[_0x8c81('0x70')]:_0x8c81('0x184'));this[_0x8c81('0xf')][_0x8c81('0x9c')](util[_0x8c81('0x27')](_0x8c81('0x185'),_0x21e98b),_0x1fba2c[_0x8c81('0x186')]?_0x1fba2c[_0x8c81('0x186')]:'OK');if(_0x1fba2c[_0x8c81('0x67')]){try{this['saveRestApiResult'](_0x1fba2c[_0x8c81('0x67')],_0x21e98b);}catch(_0x457953){logger[_0x8c81('0x29')](util[_0x8c81('0x27')](_0x8c81('0x187'),_0x21e98b));}}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xda'),_0x21e98b));};AGIVertices['prototype'][_0x8c81('0x188')]=function(_0x593817){logger['info'](util['format'](_0x8c81('0x189'),_0x593817[_0x8c81('0x34')]));return this['channel']['sayDigits'](_0x593817['digits'][_0x8c81('0xd2')](/\s+/g,''),_0x593817['escape_digits']);};AGIVertices[_0x8c81('0x12')]['saynumber']=function(_0x17f6fd){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x18a'),_0x17f6fd[_0x8c81('0x34')]));return this['channel'][_0x8c81('0x18b')](_0x17f6fd[_0x8c81('0x62')][_0x8c81('0xd2')](/\s+/g,''),_0x17f6fd[_0x8c81('0x17e')]);};AGIVertices['prototype']['sayphonetic']=function(_0x278a40){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x18c'),_0x278a40[_0x8c81('0x34')]));return this[_0x8c81('0xf')][_0x8c81('0x18d')](_0x278a40[_0x8c81('0x58')],_0x278a40[_0x8c81('0x17e')]);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x18e')]=function(_0xfd717b){logger['info'](util[_0x8c81('0x27')](_0x8c81('0x18f'),_0xfd717b['label']));if(!this['isConfigured'](_0xfd717b[_0x8c81('0x190')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x191'));}var _0xb67548=this[_0x8c81('0x21')][_0x8c81('0x6c')](this,_0xfd717b[_0x8c81('0x190')]);if(!_0xb67548||!_0xb67548['Smtp']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xfd717b,'no\x20mail\x20account\x20found');}var _0x3fd9ef={'from':util[_0x8c81('0x27')](_0x8c81('0x192'),_0xb67548['name'],_0xb67548[_0x8c81('0x193')]||_0xb67548[_0x8c81('0x194')][_0x8c81('0x195')]),'to':_0xfd717b['to']||'','cc':_0xfd717b['cc']||'','bcc':_0xfd717b[_0x8c81('0x196')]||'','subject':_0xfd717b[_0x8c81('0x197')],'html':_0xfd717b[_0x8c81('0x58')],'text':_0xfd717b[_0x8c81('0x58')]};if(this['isConfigured'](_0xfd717b[_0x8c81('0x198')])){}logger['debug'](_0x8c81('0x199'),JSON[_0x8c81('0x9d')](_0x3fd9ef));this[_0x8c81('0x32')]['sync'](this,_0xfd717b,_0xfd717b[_0x8c81('0x190')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x19a'),_0xb67548['name']));this['sendMailMessage']['sync'](this,_0xb67548[_0x8c81('0x19b')],_0x3fd9ef);return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x19c'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19d')]=function(_0x1224ad){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20SENDFAX\x20(%s)\x20block',_0x1224ad['label']));return this['channel']['noop'](_0x8c81('0x19e'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x19f')]=function(_0x17c22c){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1a0'),_0x17c22c[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x17c22c[_0x8c81('0x1a1')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0x1a2'));}var _0x102a31=this[_0x8c81('0x30')][_0x8c81('0x6c')](this,_0x17c22c[_0x8c81('0x1a1')]);if(!_0x102a31){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x17c22c,_0x8c81('0x1a3'));}var _0x59dc3b={'body':_0x17c22c[_0x8c81('0x1a4')],'phone':_0x17c22c['to']||'','SmsAccountId':_0x102a31['id']};logger[_0x8c81('0xdc')](_0x8c81('0x1a5'),JSON['stringify'](_0x59dc3b));this['createSquareDetailsReport']['sync'](this,_0x17c22c,_0x17c22c[_0x8c81('0x1a1')]);this[_0x8c81('0xf')][_0x8c81('0xa6')](util['format'](_0x8c81('0x1a6'),_0x102a31[_0x8c81('0x14')]));this[_0x8c81('0x31')][_0x8c81('0x6c')](this,_0x59dc3b);return this[_0x8c81('0xf')][_0x8c81('0xa6')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a7')]=function(_0x2027a6){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20SET\x20(%s)\x20block',_0x2027a6[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x2027a6[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,'no\x20variable\x20selected');}var _0x14050b=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x2027a6[_0x8c81('0xd4')]);if(!_0x14050b){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x2027a6,_0x8c81('0xd6'));}return this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x14050b,_0x2027a6['variable_value']);};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1a8')]=function(_0x315899){logger[_0x8c81('0x2b')](util['format']('Enter\x20in\x20START\x20(%s)\x20block',_0x315899[_0x8c81('0x34')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1a9'));var _0x1e0c67=this[_0x8c81('0xf')][_0x8c81('0xa0')](_0x8c81('0x1aa'));if(!_[_0x8c81('0x42')](_0x1e0c67[_0x8c81('0xa3')])){this[_0x8c81('0xf')][_0x8c81('0x33')]=_0x1e0c67[_0x8c81('0xa3')];}if(_0x315899[_0x8c81('0xb6')]==='yes'){this[_0x8c81('0xf')][_0x8c81('0xa6')]('Answer');return this['channel'][_0x8c81('0xb6')]();}return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1ab'));};AGIVertices['prototype']['subproject']=function(_0x283abb){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1ac'),_0x283abb[_0x8c81('0x34')]));if(!this['isConfigured'](_0x283abb[_0x8c81('0x1ad')])){return this['channel'][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1ae'));}var _0x1a3915=this[_0x8c81('0x17')][_0x8c81('0x6c')](this,_0x283abb[_0x8c81('0x1ad')]);if(!this['isConfigured'](_0x1a3915)){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,util['format'](_0x8c81('0x1af'),_0x283abb[_0x8c81('0x1ad')]));}if(_0x1a3915===this['channel']['arg_1']){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x283abb,_0x8c81('0x1b0'));}this[_0x8c81('0x32')][_0x8c81('0x6c')](this,_0x283abb,_0x1a3915);var _0x57cfa5=this[_0x8c81('0xf')]['exec'](_0x8c81('0x1b1'),util[_0x8c81('0x27')](_0x8c81('0x1b2'),config['agi']['host']||'127.0.0.1',_0x1a3915,this[_0x8c81('0xf')][_0x8c81('0x36')]));if(_0x57cfa5['result']===-0x1){return _0x57cfa5;}return this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1b1'),_0x1a3915));};AGIVertices['prototype']['system']=function(_0x284d34){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1b3'),_0x284d34['label']));var _0x334861=this[_0x8c81('0x54')][_0x8c81('0x6c')](this,_0x284d34[_0x8c81('0xb4')]);this[_0x8c81('0x32')]['sync'](this,_0x284d34,_0x284d34[_0x8c81('0xb4')]);if(this[_0x8c81('0x81')](_0x284d34[_0x8c81('0xd4')])){var _0x4fa1ee=this[_0x8c81('0xa0')][_0x8c81('0x6c')](this,_0x284d34['variable_id']);if(_0x4fa1ee){this[_0x8c81('0xf')][_0x8c81('0x9c')](_0x4fa1ee,_0x334861);return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x284d34['command'],_0x4fa1ee));}}return this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1b4'),_0x284d34[_0x8c81('0xb4')]));};AGIVertices['prototype'][_0x8c81('0x1b5')]=function(_0x1d0429){logger['info'](util[_0x8c81('0x27')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x1d0429[_0x8c81('0x34')]));_0x1d0429[_0x8c81('0x58')]=_0x1d0429['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1d0429[_0x8c81('0x57')])){return this[_0x8c81('0xf')][_0x8c81('0xa6')](_0x8c81('0x1b6'));}if(!this['isConfigured'](_0x1d0429[_0x8c81('0x58')])){return this['channel'][_0x8c81('0xa6')](_0x8c81('0xa7'));}this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x1d0429[_0x8c81('0x58')]));var _0x489edc=this[_0x8c81('0x56')][_0x8c81('0x6c')](this,_0x1d0429);if(_0x489edc){this[_0x8c81('0xf')]['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x489edc));var _0xe20d46=this[_0x8c81('0xf')][_0x8c81('0x103')](_0x489edc);try{fs['unlink'](_0x489edc+_0x8c81('0x125'));}catch(_0x41a3d8){logger[_0x8c81('0x29')](_0x41a3d8);}return _0xe20d46;}return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x1d0429,_0x8c81('0x1b7'));};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1b8')]=function(_0x1b2897){logger['info'](util['format'](_0x8c81('0x1b9'),_0x1b2897['label']));_0x1b2897[_0x8c81('0x58')]=_0x1b2897[_0x8c81('0x58')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8c81('0x81')](_0x1b2897[_0x8c81('0x58')])){return this[_0x8c81('0xf')]['noop']('no\x20text\x20configured');}this[_0x8c81('0xf')]['noop'](util[_0x8c81('0x27')](_0x8c81('0x1ba'),_0x1b2897['text']));var _0x6c2163=this[_0x8c81('0x5d')][_0x8c81('0x6c')](this,_0x1b2897);if(_0x6c2163){this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x1bb'),_0x6c2163));var _0x2654ea=this['channel'][_0x8c81('0x103')](_0x6c2163);try{fs['unlink'](_0x6c2163+_0x8c81('0x125'));}catch(_0x2ef1bf){logger[_0x8c81('0x29')](_0x2ef1bf);}return _0x2654ea;}return this['channel'][_0x8c81('0x29')](_0x1b2897,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1bc')]=function(_0xf1ee3f){logger['info'](util['format'](_0x8c81('0x1bd'),_0xf1ee3f[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0xf1ee3f[_0x8c81('0x158')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0xf1ee3f,_0x8c81('0x159'));}logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x15a'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));var _0x38e220=this[_0x8c81('0x4f')][_0x8c81('0x6c')](this,_0xf1ee3f['findBy']);if(_0x38e220){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15b'),this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':_0x8c81('0x15c')};}else{logger[_0x8c81('0x2b')](util[_0x8c81('0x27')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8c81('0xf')][_0x8c81('0x38')],_0xf1ee3f[_0x8c81('0x158')]));this[_0x8c81('0xf')][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0x15f'),this[_0x8c81('0xf')]['callerid'],_0xf1ee3f[_0x8c81('0x158')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8c81('0x12')][_0x8c81('0x1be')]=function(_0x383114){logger[_0x8c81('0x2b')](util['format'](_0x8c81('0x1bf'),_0x383114['label']));var _0xe2fb19=this['channel'][_0x8c81('0x55')](_0x8c81('0x1c0'),[_0x383114[_0x8c81('0x1c1')],_0x383114[_0x8c81('0x72')]]);if(_0xe2fb19[_0x8c81('0xa2')]===-0x1){return _0xe2fb19;}return this['channel'][_0x8c81('0xa6')](util[_0x8c81('0x27')](_0x8c81('0xc0'),_0x8c81('0x1c0'),_0x383114['mailbox']));};AGIVertices['prototype']['vswitch']=function(_0x886c43){logger[_0x8c81('0x2b')](util[_0x8c81('0x27')](_0x8c81('0x1c2'),_0x886c43[_0x8c81('0x34')]));if(!this[_0x8c81('0x81')](_0x886c43[_0x8c81('0xd4')])){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20selected');}var _0x17c9b3=this[_0x8c81('0xa0')]['sync'](this,_0x886c43[_0x8c81('0xd4')]);if(!_0x17c9b3){return this[_0x8c81('0xf')][_0x8c81('0x29')](_0x886c43,'no\x20variable\x20found');}var _0x1792fd=this['channel'][_0x8c81('0xa0')](_0x17c9b3);return{'code':0xc8,'result':_0x1792fd[_0x8c81('0xa3')]?_0x1792fd['extra']:'-'};};String[_0x8c81('0x12')][_0x8c81('0x9f')]=function(_0x5557c9,_0x456b58){return this[_0x8c81('0x9e')](_0x5557c9)['join'](_0x456b58);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index be31d6c..e63c45a 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 _0x7c29=['[%s][UPDATE][ERRORS:%s]','startAcw','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','available','paused','acwTimeout','stopAcw','lastPauseAt','queue','finally','[ACW][START]\x20%s','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','message','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','isNil','origtransfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','info','catch','error'];(function(_0x1ab0e6,_0x17ba8d){var _0x248815=function(_0x5d2b40){while(--_0x5d2b40){_0x1ab0e6['push'](_0x1ab0e6['shift']());}};_0x248815(++_0x17ba8d);}(_0x7c29,0x14a));var _0x97c2=function(_0x136b08,_0x163ae6){_0x136b08=_0x136b08-0x0;var _0x3fcac8=_0x7c29[_0x136b08];return _0x3fcac8;};'use strict';var _=require(_0x97c2('0x0'));var moment=require(_0x97c2('0x1'));var ami=require(_0x97c2('0x2'));var logger=require(_0x97c2('0x3'))(_0x97c2('0x4'));var RpcUser=require(_0x97c2('0x5'));var RpcVoiceAgentReport=require(_0x97c2('0x6'));function Acw(_0x261f5d){this[_0x97c2('0x7')]=_0x261f5d[_0x97c2('0x7')];this[_0x97c2('0x8')]=_0x261f5d['agents'];this['timers']=_0x261f5d[_0x97c2('0x9')];this[_0x97c2('0xa')]={};ami['on'](_0x97c2('0xb'),this[_0x97c2('0xc')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0xe'),this['syncHangupRequest']['bind'](this));ami['on'](_0x97c2('0xf'),this['syncHangup']['bind'](this));ami['on'](_0x97c2('0x10'),this[_0x97c2('0x11')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0x12'),this[_0x97c2('0x13')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0x14'),this[_0x97c2('0x15')][_0x97c2('0xd')](this));ami['on'](_0x97c2('0x16'),this['syncAgentConnectPreview'][_0x97c2('0xd')](this));}function getDiff(_0x1e6b26){var _0xcc9971=moment()[_0x97c2('0x17')](0x0);var _0x222766=moment(_0x1e6b26)[_0x97c2('0x17')](0x0);return _0xcc9971[_0x97c2('0x18')](_0x222766,_0x97c2('0x19'));}Acw[_0x97c2('0x1a')][_0x97c2('0x1b')]=function(_0x3227b7,_0x4c1e12){var _0x101e6f=this;var _0x5305ee=getDiff(_0x101e6f[_0x97c2('0x9')][_0x3227b7]['lastPauseAt']);clearTimeout(_0x101e6f[_0x97c2('0x9')][_0x3227b7][_0x97c2('0x1c')]);_0x101e6f[_0x97c2('0x9')][_0x3227b7][_0x97c2('0x1c')]=![];return RpcVoiceAgentReport[_0x97c2('0x1d')]({'acwtime':_0x5305ee},_0x101e6f[_0x97c2('0x9')][_0x3227b7][_0x97c2('0x1e')],_0x3227b7)['then'](function(_0x204418){logger[_0x97c2('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x4c1e12,_0x5305ee,_0x204418);})[_0x97c2('0x20')](function(_0x333192){logger[_0x97c2('0x21')](_0x97c2('0x22'),_0x4c1e12,_0x333192);})['finally'](function(){delete _0x101e6f[_0x97c2('0x9')][_0x3227b7];});};Acw[_0x97c2('0x1a')][_0x97c2('0x23')]=function(_0x4fc6eb){try{var _0x325d69=this;var _0x8a8359=this[_0x97c2('0xa')][_0x4fc6eb][_0x97c2('0x24')];var _0x2093f5=this[_0x97c2('0xa')][_0x4fc6eb]['queue'];var _0x5772ba=this[_0x97c2('0x7')][_0x2093f5];var _0x4f48a1=![];var _0x1299fb=_0x97c2('0x25');if(_0x5772ba[_0x97c2('0x26')]&&_0x5772ba[_0x97c2('0x27')][_0x97c2('0x28')]){_0x4f48a1=!![];_0x1299fb=_0x5772ba[_0x97c2('0x27')]['name'];}return ami['Action']({'action':_0x97c2('0x29'),'interface':_0x8a8359,'paused':!![],'reason':_0x1299fb})[_0x97c2('0x2a')](function(){if(_0x325d69[_0x97c2('0x8')][_0x8a8359]){return RpcUser[_0x97c2('0x2b')](_0x325d69[_0x97c2('0x8')][_0x8a8359]['id'])[_0x97c2('0x2a')](function(_0x32d869){if(!_0x32d869||_0x32d869[_0x97c2('0x2c')]){logger['info'](_0x97c2('0x2d'),_0x4fc6eb,_0x8a8359,_0x2093f5);return;}logger[_0x97c2('0x1f')](_0x97c2('0x2e'),_0x4fc6eb,_0x8a8359,_0x2093f5);var _0x2af643=_0x325d69[_0x97c2('0xa')][_0x4fc6eb][_0x97c2('0x2f')]&&_0x325d69[_0x97c2('0xa')][_0x4fc6eb]['destlinkedid']?_0x325d69[_0x97c2('0xa')][_0x4fc6eb][_0x97c2('0x30')]:_0x4fc6eb;return RpcUser['savePause'](_0x325d69[_0x97c2('0x8')][_0x8a8359],_0x1299fb,_0x2af643)[_0x97c2('0x2a')](function(_0x1e24ae){_0x325d69['voiceQueues'][_0x2093f5][_0x97c2('0x31')]-=0x1;_0x325d69[_0x97c2('0x7')][_0x2093f5][_0x97c2('0x32')]+=0x1;return _0x1e24ae;});})[_0x97c2('0x2a')](function(_0x162ff7){if(_0x4f48a1||!_0x162ff7){return;}_0x325d69[_0x97c2('0x9')][_0x8a8359]={};logger[_0x97c2('0x1f')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4fc6eb,_0x325d69[_0x97c2('0x7')][_0x2093f5][_0x97c2('0x33')],_0x8a8359,_0x2093f5);_0x325d69['timers'][_0x8a8359]['timer']=setTimeout(_0x325d69[_0x97c2('0x34')][_0x97c2('0xd')](_0x325d69,_0x8a8359),_0x325d69[_0x97c2('0x7')][_0x2093f5]['acwTimeout']*0x3e8);_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x35')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x1e')]=_0x4fc6eb;_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x36')]=_0x2093f5;_0x325d69[_0x97c2('0x9')][_0x8a8359][_0x97c2('0x1b')]=_0x325d69[_0x97c2('0x1b')][_0x97c2('0xd')](_0x325d69,_0x8a8359,_0x4fc6eb);});}})[_0x97c2('0x20')](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x4fc6eb,_0x325d69[_0x97c2('0x7')][_0x2093f5]['acwTimeout'],_0x8a8359,_0x2093f5);})[_0x97c2('0x37')](function(){delete _0x325d69['channels'][_0x4fc6eb];});}catch(_0x1ca49d){logger[_0x97c2('0x21')](_0x97c2('0x38'),_0x1ca49d['message']);}};Acw['prototype']['stopAcw']=function(_0x4c82dc){try{var _0x42199c=this;if(_0x42199c[_0x97c2('0x9')][_0x4c82dc]){_0x42199c[_0x97c2('0x9')][_0x4c82dc]['timer']=![];var _0x3e6b14=_0x42199c[_0x97c2('0x9')][_0x4c82dc][_0x97c2('0x1e')];var _0x43e51d=_0x42199c[_0x97c2('0x9')][_0x4c82dc]['queue'];var _0x34db54=_0x42199c['voiceQueues'][_0x43e51d]['acwTimeout'];logger[_0x97c2('0x1f')](_0x97c2('0x39'),_0x3e6b14,_0x4c82dc);RpcUser[_0x97c2('0x2b')](this[_0x97c2('0x8')][_0x4c82dc]['id'])[_0x97c2('0x2a')](function(_0x33317a){if(_0x33317a[_0x97c2('0x3a')]==='ACW'){return RpcUser[_0x97c2('0x3b')](_0x42199c['agents'][_0x4c82dc]);}});RpcVoiceAgentReport[_0x97c2('0x1d')]({'acwtime':_0x34db54,'agentacw':!![]},_0x3e6b14,_0x4c82dc)[_0x97c2('0x2a')](function(_0x1faae8){logger[_0x97c2('0x1f')](_0x97c2('0x3c'),_0x3e6b14,_0x34db54,_0x1faae8);})[_0x97c2('0x20')](function(_0x10497d){logger[_0x97c2('0x21')](_0x97c2('0x22'),_0x3e6b14,_0x10497d);});}else{logger[_0x97c2('0x21')](_0x97c2('0x3d'),_0x4c82dc);if(_0x42199c[_0x97c2('0x9')]){logger[_0x97c2('0x1f')]('[ACW][TIMERS]',JSON['stringify'](_0x42199c['timers']));}}}catch(_0x46eb0c){logger[_0x97c2('0x21')]('[ACW][STOP]\x20%s',_0x46eb0c[_0x97c2('0x3e')]);}};Acw['prototype'][_0x97c2('0xc')]=function(_0x4966eb){try{if(this[_0x97c2('0x7')][_0x4966eb[_0x97c2('0x36')]]&&(this[_0x97c2('0x7')][_0x4966eb[_0x97c2('0x36')]]['acw']||this[_0x97c2('0x7')][_0x4966eb[_0x97c2('0x36')]][_0x97c2('0x26')])){if(this['agents'][_0x4966eb[_0x97c2('0x24')]]){this[_0x97c2('0xa')][_0x4966eb['uniqueid']]={'queue':_0x4966eb[_0x97c2('0x36')],'interface':_0x4966eb['interface'],'destlinkedid':_0x4966eb['destlinkedid']};}}}catch(_0x179e60){logger['error'](_0x97c2('0x3f'),_0x179e60['message']);}};Acw[_0x97c2('0x1a')][_0x97c2('0x40')]=function(_0xf0f3a9){try{if(this[_0x97c2('0x7')][_0xf0f3a9[_0x97c2('0x36')]]&&(this[_0x97c2('0x7')][_0xf0f3a9[_0x97c2('0x36')]][_0x97c2('0x4')]||this[_0x97c2('0x7')][_0xf0f3a9[_0x97c2('0x36')]][_0x97c2('0x26')])){if(this[_0x97c2('0x8')][_0xf0f3a9['interface']]){this[_0x97c2('0xa')][_0xf0f3a9[_0x97c2('0x1e')]]={'queue':_0xf0f3a9[_0x97c2('0x36')],'interface':_0xf0f3a9['interface']};}}}catch(_0x4e519c){logger['error'](_0x97c2('0x41'),_0x4e519c[_0x97c2('0x3e')]);}};Acw[_0x97c2('0x1a')][_0x97c2('0x42')]=function(_0x52c0ed){try{if(this['channels'][_0x52c0ed[_0x97c2('0x1e')]]&&_[_0x97c2('0x43')](this['channels'][_0x52c0ed[_0x97c2('0x1e')]][_0x97c2('0x2f')])){logger[_0x97c2('0x1f')](_0x97c2('0x44'),_0x52c0ed[_0x97c2('0x1e')]);this[_0x97c2('0x23')](_0x52c0ed[_0x97c2('0x1e')]);}else if(this[_0x97c2('0xa')][_0x52c0ed['linkedid']]&&_['isUndefined'](this[_0x97c2('0xa')][_0x52c0ed[_0x97c2('0x45')]][_0x97c2('0x2f')])){logger['info'](_0x97c2('0x46'),_0x52c0ed[_0x97c2('0x45')]);this[_0x97c2('0x23')](_0x52c0ed[_0x97c2('0x45')]);}}catch(_0x3294d0){logger[_0x97c2('0x21')]('[ACW][syncHangupRequest]\x20%s',_0x3294d0[_0x97c2('0x3e')]);}};Acw['prototype'][_0x97c2('0x47')]=function(_0x598b77){try{if(this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x1e')]]&&this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x1e')]][_0x97c2('0x2f')]){logger[_0x97c2('0x1f')](_0x97c2('0x48'),_0x598b77[_0x97c2('0x1e')]);this['startAcw'](_0x598b77[_0x97c2('0x1e')]);}else if(this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x45')]]&&this[_0x97c2('0xa')][_0x598b77[_0x97c2('0x45')]][_0x97c2('0x2f')]){logger[_0x97c2('0x1f')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x598b77[_0x97c2('0x45')]);this['startAcw'](_0x598b77[_0x97c2('0x45')]);}}catch(_0x107317){logger[_0x97c2('0x21')](_0x97c2('0x49'),_0x107317[_0x97c2('0x3e')]);}};Acw['prototype'][_0x97c2('0x13')]=function(_0x155c1c){try{if(!_['isNil'](this[_0x97c2('0xa')][_0x155c1c['transfereeuniqueid']])){this[_0x97c2('0x23')](_0x155c1c[_0x97c2('0x4a')]);if(this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4b')]]){this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4b')]][_0x97c2('0x2f')]=!![];this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4c')]]=this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4b')]];this[_0x97c2('0x4d')](_0x155c1c[_0x97c2('0x4b')]);}}else if(!_[_0x97c2('0x4e')](this['channels'][_0x155c1c[_0x97c2('0x4c')]])){this[_0x97c2('0x23')](_0x155c1c[_0x97c2('0x4c')]);if(this[_0x97c2('0xa')][_0x155c1c[_0x97c2('0x4f')]]){this[_0x97c2('0xa')][_0x155c1c['origtransfereruniqueid']][_0x97c2('0x2f')]=!![];this[_0x97c2('0xa')][_0x155c1c['transfereeuniqueid']]=this['channels'][_0x155c1c['origtransfereruniqueid']];this[_0x97c2('0x4d')](_0x155c1c['origtransfereruniqueid']);}}}catch(_0x7e3568){logger[_0x97c2('0x21')]('[ACW][syncAttendedTransfer]\x20%s',_0x7e3568['message']);}};Acw[_0x97c2('0x1a')][_0x97c2('0x15')]=function(_0x32a0be){try{if(this[_0x97c2('0xa')][_0x32a0be['transfereruniqueid']]){logger[_0x97c2('0x1f')](_0x97c2('0x50'),JSON[_0x97c2('0x51')](_0x32a0be['transfereruniqueid']));this[_0x97c2('0x23')](_0x32a0be[_0x97c2('0x52')]);}else if(this['channels'][_0x32a0be['transfererlinkedid']]){logger[_0x97c2('0x1f')](_0x97c2('0x53'),JSON['stringify'](_0x32a0be['transfererlinkedid']));this[_0x97c2('0x23')](_0x32a0be[_0x97c2('0x54')]);}}catch(_0x598781){logger[_0x97c2('0x21')](_0x97c2('0x55'),_0x598781['message']);}};Acw[_0x97c2('0x1a')][_0x97c2('0x11')]=function(_0x4dbdec){try{if(this['voiceQueues'][_0x4dbdec['queue']]&&this[_0x97c2('0x7')][_0x4dbdec[_0x97c2('0x36')]][_0x97c2('0x56')]==='all'){if(this[_0x97c2('0x8')][_0x4dbdec[_0x97c2('0x24')]]){logger[_0x97c2('0x1f')](_0x97c2('0x57'),_0x4dbdec[_0x97c2('0x1e')],_0x4dbdec[_0x97c2('0x24')],_0x4dbdec[_0x97c2('0x36')]);return RpcUser[_0x97c2('0x58')](this[_0x97c2('0x8')][_0x4dbdec[_0x97c2('0x24')]],_0x97c2('0x59'),_0x4dbdec[_0x97c2('0x1e')]);}}}catch(_0x5dfef0){logger[_0x97c2('0x21')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5dfef0[_0x97c2('0x3e')]);}};Acw[_0x97c2('0x1a')][_0x97c2('0x4d')]=function(_0x12217b,_0x50ca37=0x2710){if(this[_0x97c2('0xa')][_0x12217b]){setTimeout(()=>{delete this['channels'][_0x12217b];},_0x50ca37);}};module[_0x97c2('0x5a')]=Acw; \ No newline at end of file +var _0x187b=['channels','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','prototype','updateAcw','lastPauseAt','timer','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','QueuePause','then','getAgent','voicePause','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','YYYY-MM-DD\x20HH:mm:ss','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','syncAgentConnect','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','lodash','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers'];(function(_0x546bef,_0xd03c2b){var _0x13250c=function(_0x3b3ab8){while(--_0x3b3ab8){_0x546bef['push'](_0x546bef['shift']());}};_0x13250c(++_0xd03c2b);}(_0x187b,0x156));var _0xb187=function(_0x5e4cf2,_0x1c2cff){_0x5e4cf2=_0x5e4cf2-0x0;var _0x53b18c=_0x187b[_0x5e4cf2];return _0x53b18c;};'use strict';var _=require(_0xb187('0x0'));var moment=require('moment');var ami=require('../ami');var logger=require('../../../config/logger')(_0xb187('0x1'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xb187('0x2'));function Acw(_0x5b86fe){this['voiceQueues']=_0x5b86fe[_0xb187('0x3')];this[_0xb187('0x4')]=_0x5b86fe[_0xb187('0x4')];this['timers']=_0x5b86fe[_0xb187('0x5')];this[_0xb187('0x6')]={};ami['on']('agentconnect',this['syncAgentConnect'][_0xb187('0x7')](this));ami['on'](_0xb187('0x8'),this['syncHangupRequest']['bind'](this));ami['on'](_0xb187('0x9'),this[_0xb187('0xa')][_0xb187('0x7')](this));ami['on'](_0xb187('0xb'),this['syncAgentRingNoAnswer'][_0xb187('0x7')](this));ami['on'](_0xb187('0xc'),this[_0xb187('0xd')][_0xb187('0x7')](this));ami['on']('blindtransfer',this[_0xb187('0xe')][_0xb187('0x7')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0xb187('0x7')](this));}function getDiff(_0x2323f0){var _0x52d78f=moment()[_0xb187('0xf')](0x0);var _0x604608=moment(_0x2323f0)['milliseconds'](0x0);return _0x52d78f[_0xb187('0x10')](_0x604608,'seconds');}Acw[_0xb187('0x11')][_0xb187('0x12')]=function(_0x151803,_0x1d4fe5){var _0x38e3df=this;var _0x235e5=getDiff(_0x38e3df['timers'][_0x151803][_0xb187('0x13')]);clearTimeout(_0x38e3df[_0xb187('0x5')][_0x151803][_0xb187('0x14')]);_0x38e3df[_0xb187('0x5')][_0x151803]['timer']=![];return RpcVoiceAgentReport['update']({'acwtime':_0x235e5},_0x38e3df[_0xb187('0x5')][_0x151803][_0xb187('0x15')],_0x151803)['then'](function(_0x3bb8ab){logger[_0xb187('0x16')](_0xb187('0x17'),_0x1d4fe5,_0x235e5,_0x3bb8ab);})[_0xb187('0x18')](function(_0x12e5a6){logger[_0xb187('0x19')](_0xb187('0x1a'),_0x1d4fe5,_0x12e5a6);})['finally'](function(){delete _0x38e3df[_0xb187('0x5')][_0x151803];});};Acw[_0xb187('0x11')][_0xb187('0x1b')]=function(_0x44de1a){try{var _0x3d18a9=this;var _0x621cdb=this[_0xb187('0x6')][_0x44de1a][_0xb187('0x1c')];var _0x35b058=this[_0xb187('0x6')][_0x44de1a][_0xb187('0x1d')];var _0x55b203=this[_0xb187('0x3')][_0x35b058];var _0x28334b=![];var _0x42e2b0=_0xb187('0x1e');if(_0x55b203[_0xb187('0x1f')]&&_0x55b203[_0xb187('0x20')]['name']){_0x28334b=!![];_0x42e2b0=_0x55b203[_0xb187('0x20')][_0xb187('0x21')];}return ami['Action']({'action':_0xb187('0x22'),'interface':_0x621cdb,'paused':!![],'reason':_0x42e2b0})[_0xb187('0x23')](function(){if(_0x3d18a9[_0xb187('0x4')][_0x621cdb]){return RpcUser[_0xb187('0x24')](_0x3d18a9[_0xb187('0x4')][_0x621cdb]['id'])[_0xb187('0x23')](function(_0x3fb0f3){if(!_0x3fb0f3||_0x3fb0f3[_0xb187('0x25')]){logger[_0xb187('0x16')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x44de1a,_0x621cdb,_0x35b058);return;}logger['info'](_0xb187('0x26'),_0x44de1a,_0x621cdb,_0x35b058);var _0x3f664c=_0x3d18a9[_0xb187('0x6')][_0x44de1a][_0xb187('0x27')]&&_0x3d18a9[_0xb187('0x6')][_0x44de1a][_0xb187('0x28')]?_0x3d18a9['channels'][_0x44de1a]['destlinkedid']:_0x44de1a;return RpcUser[_0xb187('0x29')](_0x3d18a9['agents'][_0x621cdb],_0x42e2b0,_0x3f664c)[_0xb187('0x23')](function(_0x26e651){_0x3d18a9['voiceQueues'][_0x35b058][_0xb187('0x2a')]-=0x1;_0x3d18a9[_0xb187('0x3')][_0x35b058][_0xb187('0x2b')]+=0x1;return _0x26e651;});})[_0xb187('0x23')](function(_0x160cfe){if(_0x28334b||!_0x160cfe){return;}_0x3d18a9['timers'][_0x621cdb]={};logger[_0xb187('0x16')](_0xb187('0x2c'),_0x44de1a,_0x3d18a9['voiceQueues'][_0x35b058][_0xb187('0x2d')],_0x621cdb,_0x35b058);_0x3d18a9[_0xb187('0x5')][_0x621cdb][_0xb187('0x14')]=setTimeout(_0x3d18a9[_0xb187('0x2e')][_0xb187('0x7')](_0x3d18a9,_0x621cdb),_0x3d18a9[_0xb187('0x3')][_0x35b058][_0xb187('0x2d')]*0x3e8);_0x3d18a9[_0xb187('0x5')][_0x621cdb]['lastPauseAt']=moment()[_0xb187('0x2f')](_0xb187('0x30'));_0x3d18a9[_0xb187('0x5')][_0x621cdb][_0xb187('0x15')]=_0x44de1a;_0x3d18a9[_0xb187('0x5')][_0x621cdb]['queue']=_0x35b058;_0x3d18a9[_0xb187('0x5')][_0x621cdb][_0xb187('0x12')]=_0x3d18a9[_0xb187('0x12')][_0xb187('0x7')](_0x3d18a9,_0x621cdb,_0x44de1a);});}})[_0xb187('0x18')](function(){logger[_0xb187('0x19')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x44de1a,_0x3d18a9['voiceQueues'][_0x35b058][_0xb187('0x2d')],_0x621cdb,_0x35b058);})[_0xb187('0x31')](function(){delete _0x3d18a9[_0xb187('0x6')][_0x44de1a];});}catch(_0x143333){logger['error'](_0xb187('0x32'),_0x143333[_0xb187('0x33')]);}};Acw[_0xb187('0x11')]['stopAcw']=function(_0x4f13c3){try{var _0x2683d8=this;if(_0x2683d8['timers'][_0x4f13c3]){_0x2683d8['timers'][_0x4f13c3]['timer']=![];var _0x3ee577=_0x2683d8[_0xb187('0x5')][_0x4f13c3][_0xb187('0x15')];var _0x435bd3=_0x2683d8[_0xb187('0x5')][_0x4f13c3][_0xb187('0x1d')];var _0x599ba0=_0x2683d8[_0xb187('0x3')][_0x435bd3][_0xb187('0x2d')];logger[_0xb187('0x16')](_0xb187('0x34'),_0x3ee577,_0x4f13c3);RpcUser[_0xb187('0x24')](this[_0xb187('0x4')][_0x4f13c3]['id'])[_0xb187('0x23')](function(_0x3b9a7c){if(_0x3b9a7c[_0xb187('0x35')]==='ACW'){return RpcUser[_0xb187('0x36')](_0x2683d8[_0xb187('0x4')][_0x4f13c3]);}});RpcVoiceAgentReport['update']({'acwtime':_0x599ba0,'agentacw':!![]},_0x3ee577,_0x4f13c3)[_0xb187('0x23')](function(_0xf3d83){logger[_0xb187('0x16')]('[%s][UPDATE][ACWTIME:%s]',_0x3ee577,_0x599ba0,_0xf3d83);})['catch'](function(_0x407b03){logger['error'](_0xb187('0x1a'),_0x3ee577,_0x407b03);});}else{logger[_0xb187('0x19')](_0xb187('0x37'),_0x4f13c3);if(_0x2683d8[_0xb187('0x5')]){logger[_0xb187('0x16')](_0xb187('0x38'),JSON['stringify'](_0x2683d8[_0xb187('0x5')]));}}}catch(_0x5cedc6){logger[_0xb187('0x19')](_0xb187('0x39'),_0x5cedc6['message']);}};Acw[_0xb187('0x11')][_0xb187('0x3a')]=function(_0x2a7a91){try{if(this[_0xb187('0x3')][_0x2a7a91[_0xb187('0x1d')]]&&(this[_0xb187('0x3')][_0x2a7a91[_0xb187('0x1d')]]['acw']||this[_0xb187('0x3')][_0x2a7a91[_0xb187('0x1d')]][_0xb187('0x1f')])){if(this[_0xb187('0x4')][_0x2a7a91[_0xb187('0x1c')]]){this[_0xb187('0x6')][_0x2a7a91[_0xb187('0x15')]]={'queue':_0x2a7a91[_0xb187('0x1d')],'interface':_0x2a7a91[_0xb187('0x1c')],'destlinkedid':_0x2a7a91['destlinkedid']};}}}catch(_0x52b8c3){logger[_0xb187('0x19')](_0xb187('0x3b'),_0x52b8c3[_0xb187('0x33')]);}};Acw['prototype'][_0xb187('0x3c')]=function(_0x3e2847){try{if(this['voiceQueues'][_0x3e2847[_0xb187('0x1d')]]&&(this[_0xb187('0x3')][_0x3e2847[_0xb187('0x1d')]]['acw']||this[_0xb187('0x3')][_0x3e2847[_0xb187('0x1d')]]['mandatoryDisposition'])){if(this[_0xb187('0x4')][_0x3e2847[_0xb187('0x1c')]]){this[_0xb187('0x6')][_0x3e2847['uniqueid']]={'queue':_0x3e2847[_0xb187('0x1d')],'interface':_0x3e2847['interface']};}}}catch(_0x1d97c5){logger[_0xb187('0x19')](_0xb187('0x3d'),_0x1d97c5[_0xb187('0x33')]);}};Acw[_0xb187('0x11')][_0xb187('0x3e')]=function(_0x5060d3){try{if(this[_0xb187('0x6')][_0x5060d3['uniqueid']]&&_[_0xb187('0x3f')](this[_0xb187('0x6')][_0x5060d3['uniqueid']][_0xb187('0x27')])){logger[_0xb187('0x16')](_0xb187('0x40'),_0x5060d3[_0xb187('0x15')]);this[_0xb187('0x1b')](_0x5060d3[_0xb187('0x15')]);}else if(this['channels'][_0x5060d3[_0xb187('0x41')]]&&_[_0xb187('0x3f')](this[_0xb187('0x6')][_0x5060d3['linkedid']]['attended'])){logger[_0xb187('0x16')]('[%s][HANGUP:LINKEDID]',_0x5060d3[_0xb187('0x41')]);this['startAcw'](_0x5060d3[_0xb187('0x41')]);}}catch(_0x1c30f6){logger[_0xb187('0x19')](_0xb187('0x42'),_0x1c30f6[_0xb187('0x33')]);}};Acw[_0xb187('0x11')][_0xb187('0xa')]=function(_0xd3d117){try{if(this[_0xb187('0x6')][_0xd3d117[_0xb187('0x15')]]&&this[_0xb187('0x6')][_0xd3d117[_0xb187('0x15')]][_0xb187('0x27')]){logger[_0xb187('0x16')](_0xb187('0x43'),_0xd3d117[_0xb187('0x15')]);this[_0xb187('0x1b')](_0xd3d117['uniqueid']);}else if(this[_0xb187('0x6')][_0xd3d117[_0xb187('0x41')]]&&this[_0xb187('0x6')][_0xd3d117[_0xb187('0x41')]][_0xb187('0x27')]){logger[_0xb187('0x16')](_0xb187('0x44'),_0xd3d117[_0xb187('0x41')]);this[_0xb187('0x1b')](_0xd3d117[_0xb187('0x41')]);}}catch(_0x3e541f){logger[_0xb187('0x19')](_0xb187('0x45'),_0x3e541f[_0xb187('0x33')]);}};Acw[_0xb187('0x11')][_0xb187('0xd')]=function(_0x4bc0bc){try{if(!_[_0xb187('0x46')](this['channels'][_0x4bc0bc[_0xb187('0x47')]])){this[_0xb187('0x1b')](_0x4bc0bc[_0xb187('0x47')]);if(this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x48')]]){this['channels'][_0x4bc0bc[_0xb187('0x48')]]['attended']=!![];this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x49')]]=this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x48')]];this[_0xb187('0x4a')](_0x4bc0bc[_0xb187('0x48')]);}}else if(!_[_0xb187('0x46')](this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x49')]])){this[_0xb187('0x1b')](_0x4bc0bc[_0xb187('0x49')]);if(this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x4b')]]){this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x4b')]][_0xb187('0x27')]=!![];this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x47')]]=this[_0xb187('0x6')][_0x4bc0bc[_0xb187('0x4b')]];this[_0xb187('0x4a')](_0x4bc0bc[_0xb187('0x4b')]);}}}catch(_0xcea17b){logger[_0xb187('0x19')]('[ACW][syncAttendedTransfer]\x20%s',_0xcea17b['message']);}};Acw[_0xb187('0x11')][_0xb187('0xe')]=function(_0x1aa3be){try{if(this[_0xb187('0x6')][_0x1aa3be[_0xb187('0x4c')]]){logger[_0xb187('0x16')](_0xb187('0x4d'),JSON['stringify'](_0x1aa3be[_0xb187('0x4c')]));this[_0xb187('0x1b')](_0x1aa3be['transfereruniqueid']);}else if(this[_0xb187('0x6')][_0x1aa3be[_0xb187('0x4e')]]){logger[_0xb187('0x16')](_0xb187('0x4f'),JSON[_0xb187('0x50')](_0x1aa3be['transfererlinkedid']));this['startAcw'](_0x1aa3be['transfererlinkedid']);}}catch(_0x5ad285){logger['error'](_0xb187('0x51'),_0x5ad285['message']);}};Acw[_0xb187('0x11')][_0xb187('0x52')]=function(_0x3eacdf){try{if(this[_0xb187('0x3')][_0x3eacdf[_0xb187('0x1d')]]&&this['voiceQueues'][_0x3eacdf[_0xb187('0x1d')]][_0xb187('0x53')]===_0xb187('0x54')){if(this[_0xb187('0x4')][_0x3eacdf['interface']]){logger[_0xb187('0x16')](_0xb187('0x55'),_0x3eacdf[_0xb187('0x15')],_0x3eacdf[_0xb187('0x1c')],_0x3eacdf[_0xb187('0x1d')]);return RpcUser[_0xb187('0x29')](this[_0xb187('0x4')][_0x3eacdf[_0xb187('0x1c')]],_0xb187('0x56'),_0x3eacdf['uniqueid']);}}}catch(_0x26a206){logger['error']('[ACW][syncAgentRingNoAnswer]\x20%s',_0x26a206[_0xb187('0x33')]);}};Acw[_0xb187('0x11')][_0xb187('0x4a')]=function(_0x47154d,_0x2e8cc=0x2710){if(this[_0xb187('0x6')][_0x47154d]){setTimeout(()=>{delete this['channels'][_0x47154d];},_0x2e8cc);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 32e155b..fbed70c 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 _0x82dc=['Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','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','actionDeviceStateList','then','actionQueueSummary','once','exports','asterisk-manager','bluebird','util','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error'];(function(_0xf86cb5,_0x1df013){var _0x344176=function(_0x5cc43a){while(--_0x5cc43a){_0xf86cb5['push'](_0xf86cb5['shift']());}};_0x344176(++_0x1df013);}(_0x82dc,0x192));var _0xc82d=function(_0x5dc3c1,_0x139ce3){_0x5dc3c1=_0x5dc3c1-0x0;var _0x247100=_0x82dc[_0x5dc3c1];return _0x247100;};'use strict';var Manager=require(_0xc82d('0x0'));var BPromise=require(_0xc82d('0x1'));var util=require(_0xc82d('0x2'));var logger=require(_0xc82d('0x3'))('ami');var config=require(_0xc82d('0x4'));var ami=new Manager(config[_0xc82d('0x5')][_0xc82d('0x6')],config['asterisk']['ip'],config[_0xc82d('0x5')][_0xc82d('0x7')],config[_0xc82d('0x5')][_0xc82d('0x8')],!![]);ami[_0xc82d('0x9')]();ami[_0xc82d('0xa')]=BPromise['promisify'](ami[_0xc82d('0xb')]);function error(_0x22da39){logger['error'](util[_0xc82d('0xc')](_0xc82d('0xd'),config['asterisk'][_0xc82d('0x7')],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')],util[_0xc82d('0xe')](_0x22da39,![],null)));}function close(){logger[_0xc82d('0xf')](util[_0xc82d('0xc')](_0xc82d('0x10'),config[_0xc82d('0x5')][_0xc82d('0x7')],config['asterisk']['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')]));}ami[_0xc82d('0x11')]=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x12')});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x13')});};};ami[_0xc82d('0x14')]=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x15')});};};ami['actionQueueSummary']=function(){return function(){return ami['Action']({'action':_0xc82d('0x16')});};};ami[_0xc82d('0x17')]=function(){return function(){return ami[_0xc82d('0xa')]({'action':_0xc82d('0x18')});};};function connect(){logger[_0xc82d('0x19')](util[_0xc82d('0xc')](_0xc82d('0x1a'),config['asterisk'][_0xc82d('0x7')],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')]));ami['once'](_0xc82d('0xf'),error);ami['once'](_0xc82d('0x1b'),close);}ami['on'](_0xc82d('0x1c'),connect);ami['on'](_0xc82d('0x1d'),function(_0x49248a){logger[_0xc82d('0x19')](util[_0xc82d('0xc')](_0xc82d('0x1e'),config[_0xc82d('0x5')]['username'],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')],util[_0xc82d('0xe')](_0x49248a,![],null)));});ami['on'](_0xc82d('0x1f'),function(){logger['info'](util[_0xc82d('0xc')](_0xc82d('0x20'),config[_0xc82d('0x5')][_0xc82d('0x7')],config[_0xc82d('0x5')]['ip'],config[_0xc82d('0x5')][_0xc82d('0x6')]));return Promise['resolve']()['then'](ami[_0xc82d('0x11')]())['then'](ami[_0xc82d('0x21')]())['then'](ami['actionSipPeerStatus']())[_0xc82d('0x22')](ami[_0xc82d('0x23')]())[_0xc82d('0x22')](ami['actionCoreShowChannels']())['catch'](function(_0xcbcd40){logger[_0xc82d('0xf')]('[ami.js][fullybooted]',util[_0xc82d('0xe')](_0xcbcd40,{'showHidden':![],'depth':null}));});});ami[_0xc82d('0x24')](_0xc82d('0xf'),error);ami[_0xc82d('0x24')](_0xc82d('0x1b'),close);module[_0xc82d('0x25')]=ami; \ No newline at end of file +var _0xd77b=['util','ami','asterisk','port','username','password','keepConnected','Action','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','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','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','then','[ami.js][fullybooted]','asterisk-manager','bluebird'];(function(_0x2fb457,_0x8f9854){var _0x46ed51=function(_0x2fabf2){while(--_0x2fabf2){_0x2fb457['push'](_0x2fb457['shift']());}};_0x46ed51(++_0x8f9854);}(_0xd77b,0x6a));var _0xbd77=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xd77b[_0x199572];return _0x13cfa3;};'use strict';var Manager=require(_0xbd77('0x0'));var BPromise=require(_0xbd77('0x1'));var util=require(_0xbd77('0x2'));var logger=require('../../config/logger')(_0xbd77('0x3'));var config=require('../../config/environment');var ami=new Manager(config[_0xbd77('0x4')][_0xbd77('0x5')],config['asterisk']['ip'],config['asterisk'][_0xbd77('0x6')],config[_0xbd77('0x4')][_0xbd77('0x7')],!![]);ami[_0xbd77('0x8')]();ami[_0xbd77('0x9')]=BPromise[_0xbd77('0xa')](ami[_0xbd77('0xb')]);function error(_0x3440d8){logger[_0xbd77('0xc')](util[_0xbd77('0xd')](_0xbd77('0xe'),config[_0xbd77('0x4')][_0xbd77('0x6')],config['asterisk']['ip'],config[_0xbd77('0x4')][_0xbd77('0x5')],util[_0xbd77('0xf')](_0x3440d8,![],null)));}function close(){logger['error'](util['format'](_0xbd77('0x10'),config[_0xbd77('0x4')][_0xbd77('0x6')],config['asterisk']['ip'],config['asterisk'][_0xbd77('0x5')]));}ami[_0xbd77('0x11')]=function(){return function(){return ami[_0xbd77('0x9')]({'action':_0xbd77('0x12')});};};ami[_0xbd77('0x13')]=function(){return function(){return ami['Action']({'action':'devicestatelist'});};};ami[_0xbd77('0x14')]=function(){return function(){return ami[_0xbd77('0x9')]({'action':_0xbd77('0x15')});};};ami[_0xbd77('0x16')]=function(){return function(){return ami[_0xbd77('0x9')]({'action':_0xbd77('0x17')});};};ami[_0xbd77('0x18')]=function(){return function(){return ami[_0xbd77('0x9')]({'action':_0xbd77('0x19')});};};function connect(){logger[_0xbd77('0x1a')](util[_0xbd77('0xd')]('Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s',config[_0xbd77('0x4')][_0xbd77('0x6')],config[_0xbd77('0x4')]['ip'],config[_0xbd77('0x4')][_0xbd77('0x5')]));ami[_0xbd77('0x1b')](_0xbd77('0xc'),error);ami[_0xbd77('0x1b')](_0xbd77('0x1c'),close);}ami['on'](_0xbd77('0x1d'),connect);ami['on'](_0xbd77('0x1e'),function(_0x56df22){logger[_0xbd77('0x1a')](util[_0xbd77('0xd')](_0xbd77('0x1f'),config['asterisk'][_0xbd77('0x6')],config[_0xbd77('0x4')]['ip'],config[_0xbd77('0x4')]['port'],util[_0xbd77('0xf')](_0x56df22,![],null)));});ami['on'](_0xbd77('0x20'),function(){logger[_0xbd77('0x1a')](util['format'](_0xbd77('0x21'),config[_0xbd77('0x4')][_0xbd77('0x6')],config[_0xbd77('0x4')]['ip'],config[_0xbd77('0x4')][_0xbd77('0x5')]));return Promise['resolve']()[_0xbd77('0x22')](ami[_0xbd77('0x11')]())[_0xbd77('0x22')](ami[_0xbd77('0x13')]())[_0xbd77('0x22')](ami['actionSipPeerStatus']())[_0xbd77('0x22')](ami['actionQueueSummary']())['then'](ami[_0xbd77('0x18')]())['catch'](function(_0x5b6ad3){logger[_0xbd77('0xc')](_0xbd77('0x23'),util[_0xbd77('0xf')](_0x5b6ad3,{'showHidden':![],'depth':null}));});});ami['once'](_0xbd77('0xc'),error);ami[_0xbd77('0x1b')](_0xbd77('0x1c'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index ab81a2a..a9c4b8f 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0xcb91[_0x44b3bd];return _0x1efc4a;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var client=jayson[_0x1cb9('0x2')][_0x1cb9('0x3')]({'port':0x2329});client['Request']=function(_0x8c392f,_0x2c17b8){return new BPromise(function(_0x545a34,_0x13d5fd){return client[_0x1cb9('0x4')](_0x8c392f,_0x2c17b8)['then'](function(_0x226b69){logger[_0x1cb9('0x5')]('rpc',_0x1cb9('0x6'),_0x8c392f,_0x2c17b8,_0x226b69);if(_0x226b69[_0x1cb9('0x7')]){logger['error'](_0x1cb9('0x8'),'memberReport',_0x8c392f,_0x226b69['error'][_0x1cb9('0x9')],_0x2c17b8);return _0x13d5fd(_0x226b69[_0x1cb9('0x7')][_0x1cb9('0x9')]);}else{return _0x545a34(_0x226b69[_0x1cb9('0xa')]);}})[_0x1cb9('0xb')](function(_0x50ce71){logger[_0x1cb9('0x7')](_0x1cb9('0x8'),_0x1cb9('0x6'),_0x8c392f,_0x50ce71,_0x2c17b8);return _0x13d5fd(_0x50ce71);});});};module[_0x1cb9('0xc')]=client; \ No newline at end of file +var _0x9bde=['message','result','catch','exports','bluebird','ami','http','Request','request','debug','rpc','memberReport','error'];(function(_0x17bb31,_0x2fc6f8){var _0x505c71=function(_0x5013cf){while(--_0x5013cf){_0x17bb31['push'](_0x17bb31['shift']());}};_0x505c71(++_0x2fc6f8);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1d4206,_0x2b388c){_0x1d4206=_0x1d4206-0x0;var _0x1a4097=_0x9bde[_0x1d4206];return _0x1a4097;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var client=jayson['client'][_0xe9bd('0x2')]({'port':0x2329});client[_0xe9bd('0x3')]=function(_0x131f6a,_0x1c1b34){return new BPromise(function(_0x10822d,_0x1a4d14){return client[_0xe9bd('0x4')](_0x131f6a,_0x1c1b34)['then'](function(_0x4763e9){logger[_0xe9bd('0x5')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x1c1b34,_0x4763e9);if(_0x4763e9[_0xe9bd('0x8')]){logger[_0xe9bd('0x8')](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x4763e9[_0xe9bd('0x8')][_0xe9bd('0x9')],_0x1c1b34);return _0x1a4d14(_0x4763e9['error']['message']);}else{return _0x10822d(_0x4763e9[_0xe9bd('0xa')]);}})[_0xe9bd('0xb')](function(_0x2601ac){logger['error'](_0xe9bd('0x6'),_0xe9bd('0x7'),_0x131f6a,_0x2601ac,_0x1c1b34);return _0x1a4d14(_0x2601ac);});});};module[_0xe9bd('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 90d95f9..00d4506 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 _0x3680=['contact\x20is\x20undefine','getCaller','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','custom:agentnoanswer','dialNoAnswerRetryFrequency','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','createStateFinal','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAnsweredCalls','dialPredictiveOptimizationPercentage','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','loggedIn','floor','erlangCallToSecond','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','actionOriginate','scheduledat','voicePause','run','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','checkContactEmpty','NO_AVAILABLE_CONTACTS','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','[countReScheduled]\x20','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','checkContactLowerLimitOriginate','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/voiceQueueRt','../rpc/setting','./models/final','./models/agentComplete','./models/queueCallerAbandon','XCALLY_IP_AGI','enqueue','tail','finally','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','agentconnect','syncAgentConnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','syncHangup','newexten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','name','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','[getContactDialer2][Empty]','state','statedesc','endtime','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','queueStatusComplete','Interval','Intervals','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','reachable','status','unmonitored','prototype','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','interval','timezones','true','iftime\x20%s,%s','content','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','dialMethod','progressive','handlePower','power','dialPowerLevel','Queue','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','silly','isGlobal','AMI\x20IfTime','Error','uniqueId','uniqueid','ivr','updateOriginated','queue','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','getSeconds','dialQueueTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','countdropretry','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','dialDropRetryFrequency','minutes','ContactId','ListId','[rescheduleContact][Drop]','starttime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','add','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','syncNewExten','actions','channel','strategy','rrmemory','roundrobin','actionid','isNil','stateinterface','locked','idHopper','paused','[Catch][Preview][syncQueueStatusComplete]','VoiceQueueId','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock]','[booked][unlock2]','[booked][unlock3]','responsetime','response','Success','[callProgressDetecting]\x20','variable','amdstatus','exten','dialAMDActive','value','HANGUP','HangupInAMD','membername','AMD','custom:amd','buildObj','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','outboundAnswerAgiCallsDay','Machine','countmachineretry','amd','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncAgentComplete][createHistory][0]','countcongestionretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','clearZombieChannels','[uniqueid]','No\x20such\x20channel','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','checkPreviewRecallReminder','launchHandleIvr','originate','voiceQueue\x20is\x20undefine','phone'];(function(_0x10ca66,_0x23a244){var _0x1a7d93=function(_0x408ea5){while(--_0x408ea5){_0x10ca66['push'](_0x10ca66['shift']());}};_0x1a7d93(++_0x23a244);}(_0x3680,0xcd));var _0x0368=function(_0x4a474c,_0x4ca5f5){_0x4a474c=_0x4a474c-0x0;var _0x1958bb=_0x3680[_0x4a474c];return _0x1958bb;};'use strict';var util=require(_0x0368('0x0'));var _=require(_0x0368('0x1'));var uuid=require(_0x0368('0x2'));var moment=require(_0x0368('0x3'));var rr=require('rr');var Redis=require(_0x0368('0x4'));var utils=require(_0x0368('0x5'));var hopperUtils=require('./utils/hopper');var ut=require(_0x0368('0x6'));var config=require(_0x0368('0x7'));var logger=require(_0x0368('0x8'))(_0x0368('0x9'));var loggerBooked=require('../../../config/logger')(_0x0368('0xa'));var loggerPredictive=require(_0x0368('0x8'))(_0x0368('0xb'));var loggerPredictiveCalls=require(_0x0368('0x8'))(_0x0368('0xc'));var loggerSyncQueueSummary=require(_0x0368('0x8'))('syncQueueSummary');var ami=require('../ami');config[_0x0368('0xd')]=_[_0x0368('0xe')](config[_0x0368('0xd')],{'host':_0x0368('0xf'),'port':0x18eb});var io=require(_0x0368('0x10'))(new Redis(config[_0x0368('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require(_0x0368('0x11'));var RpcSetting=require(_0x0368('0x12'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x0368('0x13'));var AgentComplete=require(_0x0368('0x14'));var QueueCallerAbandon=require(_0x0368('0x15'));var Hangup=require('./models/hangup');var ipAgi=process['env'][_0x0368('0x16')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x0368('0x17')]=function(_0x4ca307){this[_0x0368('0x18')]=this['tail']?this[_0x0368('0x18')][_0x0368('0x19')](_0x4ca307):_0x4ca307();};function Dialer(_0x4047b5,_0x9135df){this['sequence']=new Sequence();this[_0x0368('0x1a')]=_0x9135df;this['voiceQueues']=_0x4047b5[_0x0368('0x1b')];this['campaigns']=_0x4047b5[_0x0368('0x1c')];this[_0x0368('0x1d')]=_0x4047b5[_0x0368('0x1d')];this['trunks']=_0x4047b5[_0x0368('0x1e')];this['maxNumberOriginate']=config[_0x0368('0x1f')]||0x2;this[_0x0368('0x20')]={};this['actions']={};this[_0x0368('0x21')]={};this['uniqueId']={};this[_0x0368('0x22')]={};this[_0x0368('0x23')]={};this[_0x0368('0x24')]={};this[_0x0368('0x25')]={};this[_0x0368('0x26')]={};this[_0x0368('0x27')]={};this[_0x0368('0x28')]={};ami['on'](_0x0368('0x29'),this[_0x0368('0x2a')][_0x0368('0x2b')](this));ami['on']('queuecallerabandon',this[_0x0368('0x2c')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x2d'),this[_0x0368('0x2e')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x2f'),this[_0x0368('0x30')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x31'),this[_0x0368('0x32')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x0368('0x33')][_0x0368('0x2b')](this));ami['on']('hangup',this[_0x0368('0x34')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x35'),this['syncNewExten'][_0x0368('0x2b')](this));ami['on'](_0x0368('0x36'),this[_0x0368('0x37')][_0x0368('0x2b')](this));ami['on'](_0x0368('0x38'),this['syncQueueMember']['bind'](this));ami['on'](_0x0368('0x39'),this[_0x0368('0x3a')][_0x0368('0x2b')](this));this[_0x0368('0x3b')]();this[_0x0368('0x3c')]();RpcSetting['getSettings']()[_0x0368('0x3d')](function(_0x4fefcd){previewRecallmeReminderInterval=_0x4fefcd[_0x0368('0x3e')];});}function isNotNull(_0x3ae77c){return _0x3ae77c!==null&&!_[_0x0368('0x3f')](_0x3ae77c);}function msgResponse(_0x3c2ed4,_0x552b58,_0x1d0cc7){return{'action':_0x3c2ed4,'response':_0x552b58,'message':_0x1d0cc7,'stack':_0x1d0cc7};}function emit(_0x5b9c6c,_0x70800c,_0x1fd73a){io['to'](_0x5b9c6c)[_0x0368('0x40')](_0x70800c,_0x1fd73a);}function emitOutboundVoiceQueueSummary(_0x1c7985){if(_0x1c7985[_0x0368('0x41')]===_0x0368('0x42')){logger[_0x0368('0x43')](_0x0368('0x44'),util[_0x0368('0x45')](_0x1c7985,{'showHidden':![],'depth':null}));emit(util[_0x0368('0x46')]('voice:queue:%s',_0x1c7985[_0x0368('0x47')]),'voice_queue:save',_0x1c7985);}}function checkGetDataPredictive(_0x68ad88){if(isNotNull(_0x68ad88)&&!_['isEmpty'](_0x68ad88)){loggerPredictive['info'](_0x0368('0x48'));loggerPredictive[_0x0368('0x49')](_0x0368('0x4a'),_0x68ad88[_0x0368('0x4b')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x4c'),_0x68ad88['predictiveIntervalAnsweredCalls']);loggerPredictive['info'](_0x0368('0x4d'),_0x68ad88[_0x0368('0x4e')]);loggerPredictive['info'](_0x0368('0x4f'),_0x68ad88[_0x0368('0x50')]);loggerPredictive['info'](_0x0368('0x51'),_0x68ad88['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x68ad88[_0x0368('0x52')]);loggerPredictive['info'](_0x0368('0x53'));if(_0x68ad88[_0x0368('0x4b')]>0x0){if(!_[_0x0368('0x3f')](_0x68ad88[_0x0368('0x52')])&&_0x68ad88['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x0368('0x49')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x0368('0x3f')](_0x68ad88[_0x0368('0x54')])&&_0x68ad88['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x0368('0x49')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x0368('0x49')](_0x0368('0x55'));}}else{loggerPredictive[_0x0368('0x49')](_0x0368('0x56'));}return![];}function mergeDataErlangB(_0x422914){return function(_0x206d37){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x0368('0x57'),_0x206d37['erlangCalls']);loggerPredictive['info'](_0x0368('0x58'),_0x206d37['erlangCallToSecond']);loggerPredictive[_0x0368('0x49')](_0x0368('0x59'),_0x206d37[_0x0368('0x5a')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x5b'),_0x206d37[_0x0368('0x5c')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x59'),_0x206d37[_0x0368('0x5a')]);loggerPredictive[_0x0368('0x49')](_0x0368('0x53'));_[_0x0368('0x5d')](_0x422914,_0x206d37);};}function ifInterval(_0x4a4d1f,_0x4d0376){if(_[_0x0368('0x3f')](_0x4d0376)){return![];}return utils['getSeconds'](undefined,_0x4d0376)<_0x4a4d1f*0x3c;}function clearPredictiveAttributes(_0x19f02c){if(_0x19f02c[_0x0368('0x24')]){_0x19f02c[_0x0368('0x24')]=undefined;loggerPredictive['debug'](_0x19f02c[_0x0368('0x47')],_0x0368('0x5e'));}if(_0x19f02c[_0x0368('0x23')]){_0x19f02c[_0x0368('0x23')]=undefined;loggerPredictive['debug'](_0x19f02c[_0x0368('0x47')],'startPredictive\x20value\x20cleared');}if(_0x19f02c[_0x0368('0x5f')]){clearInterval(_0x19f02c[_0x0368('0x5f')]);_0x19f02c[_0x0368('0x5f')]=undefined;loggerPredictive['debug'](_0x19f02c[_0x0368('0x47')],_0x0368('0x60'));}}function loggerCatchPredictive(_0x4d3fac,_0x1e463){return function(_0x1dd82a){loggerPredictive[_0x0368('0x61')](_0x1e463[_0x0368('0x47')],_0x4d3fac);loggerPredictive[_0x0368('0x61')](_0x1dd82a[_0x0368('0x62')]);clearPredictiveAttributes(_0x1e463);};}function loggerCatch(_0x2e2ec3){return function(_0x569222){logger[_0x0368('0x61')](_0x2e2ec3,util['inspect'](_0x569222,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x2e6974,_0xafcc3c,_0x3658c4){return function(_0x4016b3){utils['checkContactLowerLimitOriginate'](_0xafcc3c,_0x3658c4,0x0);_0xafcc3c['temp']=0x0;logger['error'](_0x2e6974,util[_0x0368('0x45')](_0x4016b3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x47ee98){return function(_0x1a5092){if(isNotNull(_0x1a5092)&&isNotNull(_0x1a5092[0x0])){if(_0x1a5092[0x0][_0x0368('0x63')]>0x0){_0x47ee98[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x65')];logger[_0x0368('0x49')](_0x0368('0x66')+_0x47ee98[_0x0368('0x47')],_0x1a5092[0x0][_0x0368('0x63')],_0x0368('0x67'));}else{_0x47ee98[_0x0368('0x64')]=utils[_0x0368('0x68')]['NO_AVAILABLE_CONTACTS'];logger[_0x0368('0x49')](_0x0368('0x69')+_0x47ee98[_0x0368('0x47')]);}}};}function createObjHistory(_0x180749,_0x27a7b0,_0x2413d3,_0x4ff3c0,_0x36213f){_0x180749['message']=_0x2413d3;var _0x33a19d=new Action(_0x180749,_0x27a7b0);var _0x713da0=new History(_0x33a19d);_0x713da0[_0x0368('0x6a')]=_0x4ff3c0;_0x713da0[_0x0368('0x6b')]=_0x36213f;_0x713da0[_0x0368('0x6c')]=_0x33a19d['starttime'];return _0x713da0;}function unlockQueueStatus(_0x4dd499,_0x49e0ee){setTimeout(function(){if(_['isUndefined'](_0x4dd499['queueStatusComplete'])){loggerBooked[_0x0368('0x61')](_0x0368('0x6d'),_0x49e0ee);}_0x4dd499['queueStatusComplete']=!![];loggerBooked['info'](_0x0368('0x6e'),_0x49e0ee,JSON[_0x0368('0x6f')](_[_0x0368('0x70')](_0x4dd499,[_0x0368('0x47'),_0x0368('0x71')])));},0x1f3);}function checkInterval(_0x429afc){return function(){if(!isNotNull(_0x429afc[_0x0368('0x72')])){_0x429afc[_0x0368('0x64')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x429afc[_0x0368('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x429afc[_0x0368('0x72')][_0x0368('0x73')])){_0x429afc[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x74')];throw _0x429afc[_0x0368('0x47')]+_0x0368('0x75');}if(!isNotNull(_[_0x0368('0x76')](_0x429afc[_0x0368('0x72')][_0x0368('0x73')]))){_0x429afc[_0x0368('0x64')]=utils[_0x0368('0x68')]['NULL_INTERVAL'];throw _0x429afc[_0x0368('0x47')]+_0x0368('0x75');}};}function checkIsIVRCampaignActive(_0x41eb62){return function(){if(!utils[_0x0368('0x77')](_0x41eb62)){_0x41eb62[_0x0368('0x64')]=utils['CAMPAIGN_STATUS']['INACTIVE'];throw _0x41eb62['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x273fbf){if(utils[_0x0368('0x78')](_0x273fbf)){emit(util[_0x0368('0x46')](_0x0368('0x79'),_0x273fbf[_0x0368('0x47')]),'campaign:save',_0x273fbf);}}function loggerCatchQueueSummary(_0x5b99f5,_0x3d6fe0){return function(_0x1c8b08){clearPredictiveAttributes(_0x3d6fe0);emitCampaignSummary(_0x3d6fe0);loggerSyncQueueSummary['debug'](_0x5b99f5,util['inspect'](_0x1c8b08,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1d5b63){if(_0x1d5b63[_0x0368('0x7a')]){if(_0x1d5b63['originated']===0x0){_0x1d5b63[_0x0368('0x7a')]=![];_0x1d5b63[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x7b')];loggerSyncQueueSummary[_0x0368('0x43')](_0x0368('0x7c'),_0x1d5b63[_0x0368('0x47')],'is\x20not\x20active');}else{_0x1d5b63[_0x0368('0x64')]=utils[_0x0368('0x68')]['DISACTIVED'];loggerSyncQueueSummary[_0x0368('0x43')](_0x0368('0x7c'),_0x1d5b63['name'],_0x0368('0x7d'));}emitCampaignSummary(_0x1d5b63);}}function myreject(_0x35f1f9){return function(_0x46fc32){return _0x35f1f9(msgResponse(_0x0368('0x7e'),'Error',JSON[_0x0368('0x6f')](_0x46fc32)));};}Dialer['prototype'][_0x0368('0x7f')]=function(_0x553dc5){return!_[_0x0368('0x3f')](_0x553dc5)&&_0x553dc5&&!_[_0x0368('0x3f')](_0x553dc5[_0x0368('0x47')])&&!_[_0x0368('0x3f')](_0x553dc5[_0x0368('0x80')])&&_0x553dc5[_0x0368('0x80')]&&(this[_0x0368('0x1e')][util[_0x0368('0x46')]('SIP/%s',_0x553dc5['name'])]['status']===_0x0368('0x81')||this[_0x0368('0x1e')][util['format']('SIP/%s',_0x553dc5[_0x0368('0x47')])][_0x0368('0x82')]===_0x0368('0x83'));};Dialer[_0x0368('0x84')]['checkIsTrunkReachable']=function(_0x1a3e5f){var _0x8af22=this;return function(){if(!_0x8af22[_0x0368('0x7f')](_0x1a3e5f[_0x0368('0x85')])){if(!_0x8af22[_0x0368('0x7f')](_0x1a3e5f[_0x0368('0x86')])){_0x1a3e5f['message']=utils[_0x0368('0x68')][_0x0368('0x87')];throw _0x1a3e5f[_0x0368('0x47')]+_0x0368('0x88');}}};};Dialer[_0x0368('0x84')][_0x0368('0x89')]=function(_0x20432a,_0x1c598e,_0x20ca1a,_0x35229f){var _0x2fd094=this;return function(){var _0x190aee=!![];return _0x2fd094['ifTimeIvr'](_0x20432a,_0x1c598e,_0x20ca1a,_0x35229f,_0x190aee);};};Dialer[_0x0368('0x84')]['checkIfTimeIntervals']=function(_0x4b1405,_0x36a193,_0x5da592,_0x40d493){var _0x30d189=this;return function(){var _0x5d27b5=![];return _0x30d189[_0x0368('0x8a')](_0x4b1405[_0x0368('0x73')],_0x36a193,_0x5da592,_0x40d493,_0x5d27b5);};};Dialer[_0x0368('0x84')][_0x0368('0x8a')]=function(_0x1e31b0,_0x55c111,_0x2f5494,_0x490c04,_0x19a637){var _0x4c49f2=[];return new Promise(function(_0x503382,_0x33fa5e){if(!isNotNull(_0x1e31b0)){_0x490c04[_0x0368('0x64')]=utils[_0x0368('0x68')][_0x0368('0x74')];return _0x33fa5e(msgResponse(_0x0368('0x8b'),_0x0368('0x8c'),_0x2f5494+_0x0368('0x8d')));}if(_[_0x0368('0x76')](_0x1e31b0)){_0x490c04[_0x0368('0x64')]=utils[_0x0368('0x68')]['EMPTY_INTERVAL'];return _0x33fa5e(msgResponse(_0x0368('0x8b'),_0x0368('0x8c'),_0x2f5494+_0x0368('0x8e')));}if(_0x55c111&&_['isUndefined'](config['timezones'][_0x55c111])){_0x490c04['message']=utils[_0x0368('0x68')][_0x0368('0x8f')];return _0x33fa5e(msgResponse('ifTime','Failure',_0x2f5494+_0x0368('0x90')+_0x55c111));}if(_[_0x0368('0x91')](_0x1e31b0)){for(var _0x3a3b91=0x0;_0x3a3b91<_0x1e31b0[_0x0368('0x92')];_0x3a3b91+=0x1){_0x4c49f2[_0x0368('0x93')](ami[_0x0368('0x94')]({'action':_0x0368('0x95'),'command':util[_0x0368('0x46')]('iftime\x20%s,%s',_0x1e31b0[_0x3a3b91][_0x0368('0x96')],!_[_0x0368('0x3f')](config[_0x0368('0x97')][_0x55c111])?_0x55c111:'')})[_0x0368('0x3d')](function(_0x25d4ab){return _0x25d4ab['content']['indexOf'](_0x0368('0x98'))>=0x0;})['catch'](myreject(_0x33fa5e)));}}else{_0x4c49f2['push'](ami[_0x0368('0x94')]({'action':'command','command':util['format'](_0x0368('0x99'),_0x1e31b0,!_[_0x0368('0x3f')](config[_0x0368('0x97')][_0x55c111])?_0x55c111:'')})[_0x0368('0x3d')](function(_0x17bf29){return _0x17bf29[_0x0368('0x9a')][_0x0368('0x9b')](_0x0368('0x98'))>=0x0;})[_0x0368('0x9c')](myreject(_0x33fa5e)));}Promise[_0x0368('0x9d')](_0x4c49f2)[_0x0368('0x3d')](function(_0x3b0558){var _0xf586eb=_['some'](_0x3b0558);if(_0xf586eb){return _0x503382(_0xf586eb);}else{_0x490c04['message']=_0x19a637?utils[_0x0368('0x68')][_0x0368('0x9e')]:utils[_0x0368('0x68')][_0x0368('0x9f')];return _0x33fa5e(msgResponse('[ifTime][promiseAll]',_0x0368('0x8c'),_0x0368('0xa0')+_0x19a637+'\x20'+_0x2f5494+_0x0368('0xa1')+util[_0x0368('0x45')](_0x1e31b0,{'showHidden':![],'depth':null})+_0x0368('0xa2')+_0x55c111));}})[_0x0368('0x9c')](function(_0x53eadd){return _0x33fa5e(msgResponse(_0x0368('0x8b'),_0x0368('0x8c'),JSON['stringify'](_0x53eadd)));});});};Dialer['prototype']['loopCampaigns']=function(){var _0x2cd2fd=this;return cmHopper[_0x0368('0xa3')]({'active':![]},{'where':{'active':!![]}})[_0x0368('0x3d')](function(){setInterval(function(){_0x2cd2fd[_0x0368('0xa4')]();},0x3e8);});};Dialer[_0x0368('0x84')][_0x0368('0xa4')]=function(){var _0x283aac=this;var _0x5f4609;for(var _0x1b568d in this[_0x0368('0x1c')]){if(typeof this['campaigns'][_0x1b568d]!==_0x0368('0xa5')){_0x5f4609=this['campaigns'][_0x1b568d];if(utils['isIVRCampaign'](_0x5f4609)&&utils[_0x0368('0x77')](_0x5f4609)){_0x5f4609[_0x0368('0x7a')]=!![];Promise[_0x0368('0xa6')]()['then'](checkIsIVRCampaignActive(_0x5f4609))[_0x0368('0x3d')](checkInterval(_0x5f4609))[_0x0368('0x3d')](_0x283aac[_0x0368('0xa7')](_0x5f4609))[_0x0368('0x3d')](_0x283aac[_0x0368('0x89')](_0x5f4609[_0x0368('0xa8')],_0x5f4609[_0x0368('0xa9')],_0x5f4609[_0x0368('0x47')],_0x5f4609))[_0x0368('0x3d')](_0x283aac['checkIfTimeIntervals'](_0x5f4609[_0x0368('0x72')],_0x5f4609['dialTimezone'],_0x5f4609[_0x0368('0x47')],_0x5f4609))[_0x0368('0x3d')](_0x283aac['launchHandleIvr'](_0x5f4609))[_0x0368('0x9c')](loggerCatchQueueSummary(_0x0368('0xaa'),_0x5f4609));}else{notSendMessagesCampaign(_0x5f4609);}}}};Dialer[_0x0368('0x84')]['checkDialMethod']=function(_0x54985a){if(_0x54985a[_0x0368('0xab')]!==_0x0368('0xb')){clearPredictiveAttributes(_0x54985a);}switch(_0x54985a[_0x0368('0xab')]){case _0x0368('0xac'):this[_0x0368('0xad')](_0x54985a,0x1);break;case _0x0368('0xae'):this[_0x0368('0xad')](_0x54985a,_0x54985a[_0x0368('0xaf')]);break;case _0x0368('0xb'):this[_0x0368('0xb')](_0x54985a);break;case'booked':this['handlePower'](_0x54985a,0x1);break;default:logger[_0x0368('0x61')](_0x0368('0xb0'),_0x54985a[_0x0368('0x47')],'method\x20not\x20recognized');}};Dialer['prototype']['ifTime']=function(_0x4cb5a0,_0x34e33b){var _0x27f300=_0x4cb5a0['dialTimezone'];var _0x5b461f=_0x34e33b?_0x4cb5a0[_0x0368('0xa8')]:_0x4cb5a0[_0x0368('0x72')][_0x0368('0x73')];logger['silly'](_0x0368('0xb1'),_0x5b461f,_0x27f300,_0x4cb5a0[_0x0368('0x47')],util[_0x0368('0x46')](_0x0368('0xb2'),_0x4cb5a0[_0x0368('0x47')],_0x4cb5a0['id']));var _0x491896=null;return Interval['intervalIftime'](_0x5b461f,_0x27f300)[_0x0368('0x3d')](function(_0x5082a7){if(_0x5082a7===!![]){return _0x5082a7;}else{_0x4cb5a0[_0x0368('0x64')]=_0x34e33b?utils[_0x0368('0x68')][_0x0368('0x9e')]:utils[_0x0368('0x68')][_0x0368('0x9f')];_0x491896=msgResponse('[ifTime][promiseAll]',_0x0368('0x8c'),_0x0368('0xa0')+_0x34e33b+'\x20'+_0x4cb5a0[_0x0368('0x47')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x0368('0x45')](_0x5b461f,{'showHidden':![],'depth':null})+_0x0368('0xa2')+_0x27f300);}if(_0x491896!==null){logger[_0x0368('0xb3')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x491896);_0x491896[_0x0368('0xb4')]=_0x34e33b;throw _0x491896;}})[_0x0368('0x9c')](function(_0x5683b8){logger[_0x0368('0x61')](_0x0368('0xb5'),_0x5683b8);throw msgResponse(_0x0368('0x7e'),_0x0368('0xb6'),util[_0x0368('0x45')](_0x5683b8,{'showHidden':![],'depth':null}));});};Dialer['prototype'][_0x0368('0x2a')]=function(_0x1dcbe7){if(this[_0x0368('0x1b')][_0x1dcbe7['queue']]){if(this[_0x0368('0xb7')][_0x1dcbe7['uniqueid']]&&this[_0x0368('0xb7')][_0x1dcbe7[_0x0368('0xb8')]][_0x0368('0x41')]!==_0x0368('0xb9')){this[_0x0368('0xba')](this[_0x0368('0x1b')][_0x1dcbe7[_0x0368('0xbb')]]);this[_0x0368('0xb7')][_0x1dcbe7['uniqueid']]['answertime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0x0368('0x84')][_0x0368('0x30')]=function(_0xb22fbc){var _0x54cbc8=this[_0x0368('0xb7')][_0xb22fbc[_0x0368('0xb8')]];if(this[_0x0368('0x1b')][_0xb22fbc['queue']]){if(_0x54cbc8&&_0x54cbc8[_0x0368('0x41')]!==_0x0368('0xb9')){delete this[_0x0368('0xb7')][_0xb22fbc[_0x0368('0xb8')]];this['voiceQueues'][_0xb22fbc[_0x0368('0xbb')]][_0x0368('0xbc')]+=0x1;var _0x292229=new AgentComplete(_0x54cbc8,_0xb22fbc);if(_0xb22fbc['reason']===_0x0368('0xbd')){_0x292229[_0x0368('0xbe')]=this['voiceQueues'][_0xb22fbc[_0x0368('0xbb')]][_0x0368('0xbf')]&&this[_0x0368('0x1b')][_0xb22fbc[_0x0368('0xbb')]]['dialAgiAfterHangupAgent']?moment()[_0x0368('0x46')](_0x0368('0xc0')):undefined;}hopperUtils['createHistory'](_0x292229)['catch'](loggerCatch(_0x0368('0xc1')));hopperUtils[_0x0368('0xc2')](_0x292229)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc3')));}}};Dialer['prototype'][_0x0368('0x2c')]=function(_0x322ab1){var _0x192fc7=this[_0x0368('0xb7')][_0x322ab1[_0x0368('0xb8')]];var _0x47302f=this;var _0x597a41=![];var _0x4cde32;var _0xde1237;if(this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]]){if(_0x192fc7&&_0x192fc7['type']!==_0x0368('0xb9')){delete this[_0x0368('0xb7')][_0x322ab1[_0x0368('0xb8')]];this[_0x0368('0xba')](this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]]);_0x192fc7[_0x0368('0xc4')]=moment()[_0x0368('0x46')](_0x0368('0xc0'));var _0x31ae6d=new QueueCallerAbandon(_0x192fc7,_0x322ab1);if(utils[_0x0368('0xc5')](_0x192fc7['droptime'],_0x192fc7['responsetime'])>=_0x192fc7[_0x0368('0xc6')]){this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0x4e')]+=0x1;this[_0x0368('0x1b')][_0x322ab1['queue']]['outboundDropCallsDayTimeout']+=0x1;this[_0x0368('0x1b')][_0x322ab1['queue']][_0x0368('0xc7')]+=0x1;_0x31ae6d[_0x0368('0x6a')]=0xa;_0x31ae6d[_0x0368('0x6b')]=_0x0368('0xc8');_0x31ae6d[_0x0368('0xc9')]='TIMEOUT';_0x31ae6d[_0x0368('0xbe')]=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xbf')]?moment()[_0x0368('0x46')](_0x0368('0xc0')):undefined;_0x31ae6d[_0x0368('0xca')]+=0x1;_0x31ae6d[_0x0368('0xcb')]+=0x1;_0x4cde32=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]]['dialDropRetryFrequency'];_0xde1237=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xcc')];hopperUtils[_0x0368('0xcd')](_0x31ae6d,_0x31ae6d[_0x0368('0x6a')],_0x192fc7[_0x0368('0xce')])[_0x0368('0x3d')](function(_0x495377){_0x597a41=_0x495377[_0x0368('0xcf')]==0x1;if(_0x31ae6d[_0x0368('0xca')]>=_0x47302f[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xd0')]){_0x47302f[_0x0368('0xd1')](_0x31ae6d,_0x495377[_0x0368('0xcf')]);}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countdropretry':_0x31ae6d[_0x0368('0xca')],'scheduledat':moment()['add'](_0x47302f[_0x0368('0x1b')][_0x322ab1['queue']][_0x0368('0xd3')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x192fc7[_0x0368('0xd5')],'ListId':_0x192fc7[_0x0368('0xd6')],'VoiceQueueId':_0x192fc7['VoiceQueueId']||undefined,'CampaignId':_0x192fc7['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0xd7')));var _0xdc3df0=new History(_0x31ae6d);_0xdc3df0[_0x0368('0x6a')]=0xa;_0xdc3df0[_0x0368('0x6b')]=_0x0368('0xc8');_0xdc3df0[_0x0368('0xd8')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xdc3df0['endtime']=_0xdc3df0[_0x0368('0xd8')];_0xdc3df0[_0x0368('0xd9')]=_0x31ae6d[_0x0368('0xd9')];_0xdc3df0[_0x0368('0xda')]=_0x31ae6d[_0x0368('0xda')];hopperUtils[_0x0368('0xdb')](_0xdc3df0)[_0x0368('0x9c')](loggerCatch(_0x0368('0xdc')));}})[_0x0368('0x3d')](function(){if(_0x597a41)hopperUtils[_0x0368('0xdd')](_0x31ae6d,_0x4cde32,_0xde1237)[_0x0368('0x3d')](function(){return 0x1;});});}else{this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0x50')]+=0x1;this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xde')]+=0x1;_0x31ae6d[_0x0368('0x6a')]=0xb;_0x31ae6d[_0x0368('0x6b')]=_0x0368('0xdf');_0x31ae6d[_0x0368('0xc9')]='CALLEREXIT';_0x31ae6d[_0x0368('0xe0')]+=0x1;_0x31ae6d[_0x0368('0xcb')]+=0x1;_0x4cde32=this[_0x0368('0x1b')][_0x322ab1['queue']][_0x0368('0xe1')];_0xde1237=this[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xcc')];hopperUtils[_0x0368('0xcd')](_0x31ae6d,_0x31ae6d[_0x0368('0x6a')],_0x192fc7['voiceQueue'])[_0x0368('0x3d')](function(_0x46331c){if(_0x31ae6d[_0x0368('0xe0')]>=_0x47302f[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xe2')]){_0x47302f[_0x0368('0xd1')](_0x31ae6d,_0x46331c[_0x0368('0xcf')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x31ae6d[_0x0368('0xe0')],'scheduledat':moment()[_0x0368('0xe3')](_0x47302f[_0x0368('0x1b')][_0x322ab1[_0x0368('0xbb')]][_0x0368('0xe1')],_0x0368('0xd4'))[_0x0368('0x46')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x192fc7[_0x0368('0xd5')],'ListId':_0x192fc7['ListId'],'VoiceQueueId':_0x192fc7['VoiceQueueId']||undefined,'CampaignId':_0x192fc7[_0x0368('0xe4')]||undefined})['catch'](loggerCatch(_0x0368('0xe5')));var _0xb6fd47=new History(_0x31ae6d);_0xb6fd47[_0x0368('0x6a')]=0xb;_0xb6fd47[_0x0368('0x6b')]=_0x0368('0xdf');_0xb6fd47[_0x0368('0xd8')]=moment()[_0x0368('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xb6fd47['endtime']=_0xb6fd47[_0x0368('0xd8')];_0xb6fd47['calleridname']=_0x31ae6d[_0x0368('0xd9')];_0xb6fd47[_0x0368('0xda')]=_0x31ae6d[_0x0368('0xda')];hopperUtils[_0x0368('0xdb')](_0xb6fd47)[_0x0368('0x9c')](loggerCatch(_0x0368('0xe6')));}})[_0x0368('0x3d')](function(){if(_0x597a41)hopperUtils[_0x0368('0xdd')](_0x31ae6d,_0x4cde32,_0xde1237)['then'](function(){return 0x1;});});}}}};Dialer[_0x0368('0x84')][_0x0368('0xe7')]=function(_0x2d6300){if(this[_0x0368('0xe8')][_0x2d6300[_0x0368('0xb8')]]){this[_0x0368('0xe8')][_0x2d6300[_0x0368('0xb8')]]['channel']=_0x2d6300[_0x0368('0xe9')];}if(this['uniqueId'][_0x2d6300[_0x0368('0xb8')]]){this['uniqueId'][_0x2d6300['uniqueid']]['channel']=_0x2d6300[_0x0368('0xe9')];}};Dialer[_0x0368('0x84')]['syncQueueMember']=function(_0x52db78){if(!this[_0x0368('0xe8')][_0x52db78['actionid']]){return;}var _0x525877=this[_0x0368('0x1b')][this[_0x0368('0xe8')][_0x52db78['actionid']][_0x0368('0xbb')]][_0x0368('0xea')]||_0x0368('0xeb');if(_0x525877===_0x0368('0xec')){if(this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]]&&_[_0x0368('0xee')](this[_0x0368('0xe8')][_0x52db78['actionid']]['locked'])&&_0x52db78[_0x0368('0x82')]==='1'&&_0x52db78['paused']==='0'){if(this[_0x0368('0x1d')][_0x52db78['stateinterface']]){if(!this[_0x0368('0x1d')][_0x52db78['stateinterface']]['locked']){this[_0x0368('0x1d')][_0x52db78[_0x0368('0xef')]][_0x0368('0xf0')]=!![];this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]]['locked']=!![];this['actions'][_0x52db78[_0x0368('0xed')]][_0x0368('0xef')]=_0x52db78[_0x0368('0xef')];}}}}else if(_0x525877===_0x0368('0xeb')){if(this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]]){if(this[_0x0368('0x1d')][_0x52db78[_0x0368('0xef')]]){this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]][_0x0368('0xef')]=_0x52db78['stateinterface'];if(_['isNil'](this[_0x0368('0x26')][this['actions'][_0x52db78[_0x0368('0xed')]]['queue']])){this[_0x0368('0x26')][this['actions'][_0x52db78['actionid']][_0x0368('0xbb')]]=[];}this[_0x0368('0x26')][this[_0x0368('0xe8')][_0x52db78['actionid']][_0x0368('0xbb')]][_0x0368('0x93')](_[_0x0368('0x5d')](_[_0x0368('0x70')](this[_0x0368('0xe8')][_0x52db78[_0x0368('0xed')]],[_0x0368('0xf1'),_0x0368('0xef')]),{'status':_0x52db78[_0x0368('0x82')],'paused':_0x52db78[_0x0368('0xf2')]}));}}}};Dialer[_0x0368('0x84')][_0x0368('0x3a')]=function(_0x192574){if(!this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]]){return;}var _0x107a94=this;var _0x3dce49=this[_0x0368('0x1b')][this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]];var _0xb36709=_0x3dce49[_0x0368('0xea')]||_0x0368('0xeb');if(_0xb36709===_0x0368('0xec')){if(this['actions'][_0x192574['actionid']]&&this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xef')]){this['preview']['run'](this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xf1')],this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xef')])[_0x0368('0x9c')](function(_0x1ff975){logger[_0x0368('0x61')](_0x0368('0xf3'),util[_0x0368('0x45')](_0x1ff975,{'showHidden':![],'depth':null}));})[_0x0368('0x19')](function(){_0x107a94[_0x0368('0xba')](_0x107a94[_0x0368('0x1b')][_0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]]);_0x107a94['agents'][_0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xef')]][_0x0368('0xf0')]=![];delete _0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]];unlockQueueStatus(_0x3dce49);});}else{this[_0x0368('0xba')](this[_0x0368('0x1b')][this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]]);hopperUtils[_0x0368('0xd2')]({'active':![],'ContactId':this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xd5')],'ListId':this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xd6')],'VoiceQueueId':this[_0x0368('0xe8')][_0x192574['actionid']][_0x0368('0xf4')]||undefined,'CampaignId':this['actions'][_0x192574[_0x0368('0xed')]][_0x0368('0xe4')]||undefined})['catch'](loggerCatch(_0x0368('0xf5')));delete this[_0x0368('0xe8')][_0x192574['actionid']];unlockQueueStatus(_0x3dce49);}}else if(_0xb36709==='rrmemory'){var _0x2301c6;if(this[_0x0368('0xe8')][_0x192574['actionid']]&&!_[_0x0368('0x76')](this['queueBooked'][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]])){if(this['queueBookedRR'][_0x107a94[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]]){this[_0x0368('0x27')][_0x107a94['actions'][_0x192574['actionid']]['queue']]=this[_0x0368('0x27')][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]]['queue']]?this[_0x0368('0x27')][this[_0x0368('0xe8')][_0x192574['actionid']][_0x0368('0xbb')]]:this[_0x0368('0x26')][this[_0x0368('0xe8')][_0x192574['actionid']][_0x0368('0xbb')]]?this[_0x0368('0x26')][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]][_0x0368('0xf6')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x192574['actionid']][_0x0368('0xbb')]][_0x0368('0xf6')]=this[_0x0368('0x27')][this[_0x0368('0xe8')][_0x192574[_0x0368('0xed')]][_0x0368('0xbb')]];for(var _0x3a69d1=0x0;_0x3a69d1=_0x4c0e75[_0x0368('0x119')]){_0x20d6cc[_0x0368('0x11a')](_0x47df67,_0x57959a,_0xdc233a,'reason19\x20machine....');}else{if(_0x47df67[_0x0368('0x113')]>=_0x4c0e75[_0x0368('0x11b')]){_0x20d6cc['createStateFinal'](_0x47df67,_0x57959a,_0xdc233a,_0x0368('0x11c'));}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countmachineretry':_0x47df67[_0x0368('0x113')],'scheduledat':moment()[_0x0368('0xe3')](_0x4c0e75[_0x0368('0x11d')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x47df67[_0x0368('0xd5')],'ListId':_0x47df67['ListId'],'VoiceQueueId':_0x47df67[_0x0368('0xf4')]||undefined,'CampaignId':_0x47df67['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x11e')));_0x57959a({'reschedule':0x1});}}});}if(_0x26d3d6[_0x0368('0x41')]===_0x0368('0xb9')&&this[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]][_0x0368('0x105')]&&_0xcec864[_0x0368('0x106')]===_0x0368('0x107')){delete this[_0x0368('0xb7')][_0xcec864[_0x0368('0xb8')]];this[_0x0368('0xba')](this[_0x0368('0x1c')][_0x26d3d6['queue']]);_0x18661c=new Hangup(_0x26d3d6,_0xcec864);_0x18661c['state']=0x12;_0x18661c[_0x0368('0x6b')]=_0x0368('0x108');_0x18661c[_0x0368('0x109')]=_0x0368('0x10a');ami[_0x0368('0x40')](_0x0368('0x10b'),ut[_0x0368('0x10c')](_0x18661c,_0x0368('0x114')));this[_0x0368('0x10d')](_0x18661c,_0x0368('0x11f'),'[syncHangupInAMDIvr]');}if(_0x26d3d6[_0x0368('0x41')]==='ivr'&&this[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]][_0x0368('0x105')]&&_0xcec864[_0x0368('0x106')]===_0x0368('0x110')){return new Promise(function(_0x5325a2,_0x3aaaa4){delete _0x20d6cc['uniqueId'][_0xcec864[_0x0368('0xb8')]];_0x20d6cc[_0x0368('0xba')](_0x20d6cc[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]]);_0x20d6cc[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]][_0x0368('0xbc')]+=0x1;_0x20d6cc[_0x0368('0x1c')][_0x26d3d6[_0x0368('0xbb')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x1d08c2=_0x20d6cc['campaigns'][_0x26d3d6[_0x0368('0xbb')]];var _0x3c9e9b=new Hangup(_0x26d3d6,_0xcec864);_0x3c9e9b[_0x0368('0x6a')]=0x13;_0x3c9e9b[_0x0368('0x6b')]='Machine';_0x3c9e9b[_0x0368('0x109')]=_0x0368('0x10a');_0x3c9e9b[_0x0368('0x113')]+=0x1;_0x3c9e9b['countglobal']+=0x1;_0x3c9e9b[_0x0368('0x114')]=!![];ami[_0x0368('0x40')](_0x0368('0x10b'),ut[_0x0368('0x10c')](_0x3c9e9b,_0x0368('0x114')));hopperUtils[_0x0368('0xdb')](_0x3c9e9b)[_0x0368('0x9c')](loggerCatch(_0x0368('0x120')));if(_0x3c9e9b[_0x0368('0x115')]+_0x3c9e9b[_0x0368('0x121')]+_0x3c9e9b[_0x0368('0x116')]+_0x3c9e9b[_0x0368('0x117')]+_0x3c9e9b['countdropretry']+_0x3c9e9b['countabandonedretry']+_0x3c9e9b[_0x0368('0x113')]+_0x3c9e9b[_0x0368('0x118')]>=_0x1d08c2[_0x0368('0x119')]){_0x20d6cc['stateGlobal'](_0x3c9e9b,_0x5325a2,_0x3aaaa4,'reason19\x20machine....');}else{if(_0x3c9e9b['countmachineretry']>=_0x1d08c2[_0x0368('0x11b')]){_0x20d6cc['createStateFinal'](_0x3c9e9b,_0x5325a2,_0x3aaaa4,'reason\x2019\x20machine....');}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countmachineretry':_0x3c9e9b[_0x0368('0x113')],'scheduledat':moment()[_0x0368('0xe3')](_0x1d08c2[_0x0368('0x11d')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x3c9e9b[_0x0368('0xd5')],'ListId':_0x3c9e9b['ListId'],'VoiceQueueId':_0x3c9e9b[_0x0368('0xf4')]||undefined,'CampaignId':_0x3c9e9b[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x11e')));_0x5325a2({'reschedule':0x1});}}});}}};Dialer[_0x0368('0x84')][_0x0368('0x34')]=function(_0x1e6c87){var _0x5a6fb7=this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];var _0x281901;if(_0x5a6fb7&&_0x5a6fb7[_0x0368('0x41')]===_0x0368('0xb9')){delete this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];this[_0x0368('0xba')](this['campaigns'][_0x5a6fb7[_0x0368('0xbb')]]);this['campaigns'][_0x5a6fb7['queue']][_0x0368('0x122')]+=0x1;_0x281901=new Hangup(_0x5a6fb7,_0x1e6c87);hopperUtils['createHistory'](_0x281901)[_0x0368('0x9c')](loggerCatch(_0x0368('0x123')));hopperUtils[_0x0368('0xc2')](_0x281901)[_0x0368('0x9c')](loggerCatch(_0x0368('0x124')));}if(_0x5a6fb7&&_0x5a6fb7[_0x0368('0x41')]!==_0x0368('0xb9')&&isNotNull(this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]['dialQueueProject'])){delete this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];this['updateOriginated'](this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]);this[_0x0368('0x1b')][_0x5a6fb7['queue']]['outboundAnswerCallsDay']+=0x1;this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]][_0x0368('0x111')]+=0x1;_0x281901=new Hangup(_0x5a6fb7,_0x1e6c87);_0x281901[_0x0368('0x6a')]=0x10;_0x281901[_0x0368('0x6b')]=_0x0368('0x125');_0x281901[_0x0368('0x109')]=_0x0368('0x126');hopperUtils[_0x0368('0xdb')](_0x281901)['catch'](loggerCatch(_0x0368('0x123')));hopperUtils['moveContactManagedDialer'](_0x281901)[_0x0368('0x9c')](loggerCatch(_0x0368('0x124')));}if(_0x5a6fb7&&_0x5a6fb7['type']!=='ivr'&&!isNotNull(this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]][_0x0368('0x127')])){if(_0x1e6c87[_0x0368('0x128')]==='Normal\x20Clearing'){delete this[_0x0368('0xb7')][_0x1e6c87[_0x0368('0xb8')]];this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]][_0x0368('0xbc')]+=0x1;const _0x1946f2=new AgentComplete(_0x5a6fb7,_0x1e6c87);_0x1946f2[_0x0368('0xe4')]=this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]['id'];hopperUtils['createHistory'](_0x1946f2)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc1')));hopperUtils[_0x0368('0xc2')](_0x1946f2)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc3')));}else{delete this[_0x0368('0xb7')][_0x1e6c87['uniqueid']];this[_0x0368('0xba')](this['voiceQueues'][_0x5a6fb7[_0x0368('0xbb')]]);this[_0x0368('0x1b')][_0x5a6fb7[_0x0368('0xbb')]]['outboundUnknownCallsDay']+=0x1;_0x281901=new Hangup(_0x5a6fb7,_0x1e6c87);_0x281901[_0x0368('0x6a')]=0xc;_0x281901[_0x0368('0x6b')]=_0x1e6c87[_0x0368('0x128')];_0x281901[_0x0368('0x109')]=_0x0368('0x129');hopperUtils['createHistory'](_0x281901)[_0x0368('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x0368('0xc2')](_0x281901)['catch'](loggerCatch(_0x0368('0x124')));}}};Dialer[_0x0368('0x84')][_0x0368('0x32')]=function(_0x459518){var _0x161b07=this;if(!_0x161b07['queuesSummary'][_0x459518[_0x0368('0x47')]]){_0x161b07[_0x0368('0x28')][_0x459518[_0x0368('0x47')]]={'running':![]};}else if(_0x161b07[_0x0368('0x28')][_0x459518[_0x0368('0x47')]][_0x0368('0x12a')]===!![]){return;}else if(_0x161b07[_0x0368('0x28')][_0x459518[_0x0368('0x47')]][_0x0368('0x12a')]===![]){_0x161b07[_0x0368('0x28')][_0x459518['name']]['running']=!![];}var _0xdf4a2a=_0x161b07[_0x0368('0x1b')][_0x459518[_0x0368('0x47')]];var _0x217fcf=_0xdf4a2a[_0x0368('0x64')]!==utils[_0x0368('0x68')]['INACTIVE'];var _0x2cb352=utils[_0x0368('0x12b')](_0xdf4a2a);_0xdf4a2a[_0x0368('0x12c')]=utils['getQueueCampaignStatusMessage'](_0xdf4a2a,_0x161b07['trunks']);Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](function(){if(_0xdf4a2a[_0x0368('0x12c')]===utils[_0x0368('0x68')][_0x0368('0x7b')]){if(_0x217fcf){clearPredictiveAttributes(_0xdf4a2a);_0x459518[_0x0368('0x23')]=undefined;_0x459518[_0x0368('0x24')]=undefined;}if(_0xdf4a2a[_0x0368('0x12c')]===utils['CAMPAIGN_STATUS'][_0x0368('0x7b')]){_0x459518[_0x0368('0x12d')]=0x0;_0x459518['paused']=0x0;_0x459518[_0x0368('0x12e')]=0x0;_0x459518[_0x0368('0x12f')]=0x0;_0x459518[_0x0368('0x130')]=0x0;}}else if(_0xdf4a2a[_0x0368('0x12c')]===utils['CAMPAIGN_STATUS'][_0x0368('0x131')]&&!_0x2cb352){return _0x161b07[_0x0368('0x8b')](_0xdf4a2a,!![])[_0x0368('0x3d')](function(){return _0x161b07['ifTime'](_0xdf4a2a,![]);})[_0x0368('0x3d')](function(){return _0x161b07[_0x0368('0x132')](_0xdf4a2a);})[_0x0368('0x9c')](function(_0x547417){loggerSyncQueueSummary[_0x0368('0x43')](_0x0368('0x133'),util[_0x0368('0x45')](_0x547417,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0xdf4a2a);});}else{clearPredictiveAttributes(_0xdf4a2a);}})[_0x0368('0x3d')](function(){var _0x5beecf=_0x459518[_0x0368('0x134')](_0xdf4a2a);if(_0x5beecf||_0xdf4a2a[_0x0368('0x135')]){_0xdf4a2a[_0x0368('0x135')]=![];_0x459518[_0x0368('0x136')](_0xdf4a2a);Object[_0x0368('0x137')](_0xdf4a2a,_0x459518);emitOutboundVoiceQueueSummary(_0x459518);}_0x161b07[_0x0368('0x28')][_0xdf4a2a[_0x0368('0x47')]]['running']=![];})['catch'](function(_0x35a609){logger['error'](_0x0368('0x133'),util['inspect'](_0x35a609,{'showHidden':![],'depth':null}));_0x161b07['queuesSummary'][_0xdf4a2a[_0x0368('0x47')]][_0x0368('0x12a')]=![];});};Dialer['prototype'][_0x0368('0x33')]=_[_0x0368('0x138')](function(){var _0x4a2049=_[_0x0368('0x139')](this[_0x0368('0x1b')],function(_0x4ff110){return _0x4ff110['dialPreviewRecallmeReminder'];});var _0x26a74c=_[_0x0368('0x139')](this[_0x0368('0x1d')],function(_0x5df72a){return _0x5df72a[_0x0368('0x13a')]&&_0x5df72a[_0x0368('0x82')]===_0x0368('0x81');});if(_0x4a2049[_0x0368('0x92')]>0x0&&_0x26a74c[_0x0368('0x92')]>0x0){return Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](cmHopper[_0x0368('0x13b')](_[_0x0368('0x13c')](_0x4a2049,'id'),previewRecallmeReminderInterval,_['map'](_0x26a74c,'id')))['then'](function(_0x3023d2){for(var _0x39a8e9=0x0;_0x39a8e9<_0x3023d2[_0x0368('0x92')];_0x39a8e9++){var _0x272ad6=_0x3023d2[_0x39a8e9][_0x0368('0x13d')][_0x0368('0x47')];if(_0x272ad6)io['to'](util[_0x0368('0x46')](_0x0368('0x13e'),_0x272ad6))[_0x0368('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x3023d2[_0x39a8e9]});}})[_0x0368('0x9c')](function(_0x488653){logger[_0x0368('0x61')]('checkPreviewRecallReminder',_0x488653);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0368('0x84')]['loopClearZombieChannels']=function(){var _0x501110=this;setInterval(function(){_0x501110[_0x0368('0x13f')](_0x501110[_0x0368('0xb7')],_0x0368('0x140'));_0x501110[_0x0368('0x13f')](_0x501110[_0x0368('0xe8')],'[actions]');},0x32c8);};Dialer[_0x0368('0x84')][_0x0368('0x13f')]=function(_0x2d928d,_0xb718ee){var _0x556961=this;for(var _0x59c349 in _0x2d928d){if(typeof _0x2d928d[_0x59c349]!=='undefined'){this['sequence']['enqueue'](function(){if(!_[_0x0368('0xee')](_0x2d928d[_0x59c349])){return ami[_0x0368('0x94')]({'action':_0x0368('0x82'),'channel':_0x2d928d[_0x59c349]['channel']})[_0x0368('0x9c')](function(_0x51877f){if(_0x51877f['message']===_0x0368('0x141')){setTimeout(function(){if(_0x2d928d[_0x59c349]&&_0x2d928d[_0x59c349][_0x0368('0x41')]!==_0x0368('0xb9')){_0x556961[_0x0368('0xba')](_0x556961[_0x0368('0x1b')][_0x2d928d[_0x59c349][_0x0368('0xbb')]]);logger['error'](_0x0368('0x142'),_0xb718ee,_0x59c349,_0x2d928d[_0x59c349][_0x0368('0xbb')]);delete _0x2d928d[_0x59c349];}if(_0x2d928d[_0x59c349]&&_0x2d928d[_0x59c349][_0x0368('0x41')]===_0x0368('0xb9')){_0x556961[_0x0368('0xba')](_0x556961['campaigns'][_0x2d928d[_0x59c349]['queue']]);logger[_0x0368('0x61')]('[Dialer][checkChannel][ivr]',_0xb718ee,_0x59c349,_0x2d928d[_0x59c349]['queue']);delete _0x2d928d[_0x59c349];}},0x2328);}});}});}}};Dialer[_0x0368('0x84')][_0x0368('0x143')]=function(_0x433dd8){return Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](voiceQueueRt[_0x0368('0x143')](_0x433dd8))['catch'](loggerCatch(_0x0368('0x144')));};Dialer[_0x0368('0x84')][_0x0368('0xba')]=function(_0x2c8e5b){if(!_[_0x0368('0x3f')](_0x2c8e5b)&&_0x2c8e5b!==null){if(typeof _0x2c8e5b[_0x0368('0x145')]!==_0x0368('0xa5')){if(_0x2c8e5b[_0x0368('0x145')]>0x0){_0x2c8e5b['originated']-=0x1;}else{logger[_0x0368('0x61')](_0x0368('0x146'));}}}else{logger['error'](_0x0368('0x147'));}};Dialer['prototype'][_0x0368('0x148')]=function(_0x3ccba2,_0x3b266a){var _0x24bc69=this;return function(_0x35a14c){_0x24bc69['updateOriginated'](_0x3b266a);logger[_0x0368('0x61')](_0x3ccba2,util['inspect'](_0x35a14c,{'showHidden':![],'depth':null}));};};Dialer[_0x0368('0x84')][_0x0368('0x149')]=function(_0x22ce29,_0x3f438e,_0x2b3267){var _0x4923e8={'state':0x19,'statedesc':_0x0368('0x14a')};this[_0x0368('0xba')](_0x3f438e);this[_0x0368('0x10d')](_['merge'](_0x4923e8,_['pick'](_0x2b3267,[_0x0368('0xd5'),_0x0368('0xd6'),_0x0368('0x14b'),_0x0368('0xf4'),'CampaignId'])),'[emptyContact][createHistory]',_0x0368('0x14c'));logger[_0x0368('0x61')](_0x22ce29);};Dialer[_0x0368('0x84')][_0x0368('0x10d')]=function(_0x1fbb22,_0xfc8d4b,_0x1fdbc6){hopperUtils[_0x0368('0xdb')](_0x1fbb22)['catch'](loggerCatch(_0xfc8d4b));hopperUtils['moveContactManagedDialer'](_0x1fbb22)[_0x0368('0x9c')](loggerCatch(_0x1fdbc6));};Dialer['prototype']['queueCallerAbandonCreateState']=function(_0x52bb15,_0x31d126){hopperUtils[_0x0368('0xdb')](_0x52bb15)[_0x0368('0x9c')](loggerCatch(_0x0368('0xc1')));if(_0x31d126==0x0){hopperUtils[_0x0368('0xc2')](_0x52bb15)[_0x0368('0x9c')](loggerCatch(_0x0368('0x14d')));}};Dialer[_0x0368('0x84')][_0x0368('0x14e')]=function(_0xeaa516){return Promise[_0x0368('0xa6')]()[_0x0368('0x3d')](cmHopper[_0x0368('0x13b')](_0xeaa516['id'],previewRecallmeReminderInterval))[_0x0368('0x3d')](function(_0x4b99c8){for(var _0x56f5d1=0x0;_0x56f5d1<_0x4b99c8[_0x0368('0x92')];_0x56f5d1++){var _0x43a2c7=_0x4b99c8[_0x56f5d1][_0x0368('0x13d')]['name'];if(_0x43a2c7)io['to'](util[_0x0368('0x46')](_0x0368('0x13e'),_0x43a2c7))[_0x0368('0x40')]('user:dialPreviewRecallReminder',{'hopper':_0x4b99c8[_0x56f5d1]});}})[_0x0368('0x9c')](function(){});};Dialer['prototype'][_0x0368('0x14f')]=function(_0x36351f){var _0x195df7=this;return function(){_0x195df7['handleIvr'](_0x36351f);};};Dialer[_0x0368('0x84')]['actionOriginate']=function(_0x2db29e,_0x20a544){var _0x275dff=this;var _0x1ed676=uuid['v4']();this[_0x0368('0xe8')][_0x1ed676]=new Action(_0x2db29e,_0x20a544,_0x1ed676);return new Promise(function(_0x45a2f0,_0x30a785){if(_['isUndefined'](_0x2db29e)&&typeof _0x2db29e!=='object'){return _0x30a785(msgResponse(_0x0368('0x150'),_0x0368('0x8c'),_0x0368('0x151')));}if(_[_0x0368('0x3f')](_0x20a544[_0x0368('0x152')])||_0x20a544['phone']===null){return _0x30a785(msgResponse(_0x0368('0x150'),_0x0368('0x8c'),_0x0368('0x153')));}var _0x3d6491={'XMD-CALLERID':_0x275dff[_0x0368('0xe8')][_0x1ed676][_0x0368('0x154')](),'XMD-AGI':_0x2db29e['dialQueueProject']?util[_0x0368('0x46')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2db29e[_0x0368('0x127')]):_0x0368('0x155'),'XMD-AGIAFTER':_0x2db29e[_0x0368('0xbf')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2db29e[_0x0368('0xbf')]):_0x0368('0x155'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2db29e)?util[_0x0368('0x46')](_0x0368('0x156'),_0x2db29e[_0x0368('0x47')],_0x2db29e[_0x0368('0x157')]||'',_0x2db29e[_0x0368('0x158')]?'c':'',_0x2db29e[_0x0368('0xc6')]||0x3):_0x0368('0x155'),'XMD-CONTACTID':_0x20a544[_0x0368('0xd5')],'XMD-CDRTYPE':_0x0368('0x9'),'CALLERID(all)':_0x275dff[_0x0368('0xe8')][_0x1ed676][_0x0368('0x154')](),'XMD-AMD':_0x2db29e[_0x0368('0x105')]?_0x0368('0x131'):_0x0368('0x155'),'XMD-DESTINATION':_0x0368('0x159')};if(_0x2db29e['dialAMDActive']){_0x3d6491[_0x0368('0x15a')]=_0x2db29e[_0x0368('0x15b')]||0x9c4;_0x3d6491[_0x0368('0x15c')]=_0x2db29e['dialAMDGreeting']||0x5dc;_0x3d6491[_0x0368('0x15d')]=_0x2db29e['dialAMDAfterGreetingSilence']||0x320;_0x3d6491[_0x0368('0x15e')]=_0x2db29e[_0x0368('0x15f')]||0x1388;_0x3d6491['XMD-AMDMINWORDLENGTH']=_0x2db29e[_0x0368('0x160')]||0x64;_0x3d6491[_0x0368('0x161')]=_0x2db29e[_0x0368('0x162')]||0x32;_0x3d6491[_0x0368('0x163')]=_0x2db29e[_0x0368('0x164')]||0x3;_0x3d6491[_0x0368('0x165')]=_0x2db29e[_0x0368('0x166')]||0x100;_0x3d6491[_0x0368('0x167')]=_0x2db29e['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x2db29e)){_0x3d6491[_0x0368('0x168')]=_0x20a544['VoiceQueueId'];}else{_0x3d6491[_0x0368('0x169')]=_0x20a544[_0x0368('0xe4')];}var _0x40ef22=utils[_0x0368('0x16a')](_0x20a544[_0x0368('0x16b')]);Object[_0x0368('0x137')](_0x3d6491,_0x40ef22);var _0x181cd2=_0x275dff[_0x0368('0x7f')](_0x2db29e[_0x0368('0x85')])?utils['getCallerId'](_0x2db29e[_0x0368('0x85')][_0x0368('0x16c')],_0x2db29e[_0x0368('0x16d')],_0x2db29e[_0x0368('0x16e')]>0x0?utils[_0x0368('0x16f')](_0x2db29e[_0x0368('0x170')],_0x2db29e['dialRandomLastDigitCallerIdNumber']):_0x2db29e[_0x0368('0x170')]):utils['getCallerId'](_[_0x0368('0xee')](_0x2db29e[_0x0368('0x86')])?_0x2db29e[_0x0368('0x85')]['callerid']:_0x2db29e[_0x0368('0x86')][_0x0368('0x16c')],_0x2db29e['dialOriginateCallerIdName'],_0x2db29e[_0x0368('0x16e')]>0x0?utils['getCallerIdRandom'](_0x2db29e[_0x0368('0x170')],_0x2db29e[_0x0368('0x16e')]):_0x2db29e[_0x0368('0x170')]);if(_0x181cd2){_0x3d6491[_0x0368('0x171')]=_0x275dff[_0x0368('0xe8')][_0x1ed676][_0x0368('0x172')]=utils[_0x0368('0x173')](_0x181cd2);_0x3d6491[_0x0368('0x174')]=_0x20a544[_0x0368('0x152')];}_0x2db29e['variables']=_0x3d6491;return ami[_0x0368('0x94')]({'actionid':_0x1ed676,'action':_0x0368('0x150'),'channel':_0x275dff['isTrunkReachable'](_0x2db29e[_0x0368('0x85')])?util[_0x0368('0x46')](_0x0368('0x175'),_0x2db29e[_0x0368('0x85')]['name'],isNotNull(_0x2db29e['dialPrefix'])?_0x2db29e[_0x0368('0x176')][_0x0368('0x177')]()||'':'',_0x2db29e[_0x0368('0x178')]>0x0?_0x20a544['phone']['substring'](_0x2db29e[_0x0368('0x178')]):_0x20a544['phone']):util[_0x0368('0x46')](_0x0368('0x175'),_['isNil'](_0x2db29e[_0x0368('0x86')])?_0x2db29e[_0x0368('0x85')]['name']:_0x2db29e['TrunkBackup'][_0x0368('0x47')],isNotNull(_0x2db29e[_0x0368('0x176')])?_0x2db29e[_0x0368('0x176')][_0x0368('0x177')]()||'':'',_0x2db29e['dialCutDigit']>0x0?_0x20a544[_0x0368('0x152')]['substring'](_0x2db29e['dialCutDigit']):_0x20a544[_0x0368('0x152')]),'callerid':_0x181cd2,'Exten':'xcally-motion-dialer','Context':_0x0368('0x179'),'Priority':'1','variable':_0x3d6491,'timeout':(_0x2db29e[_0x0368('0x17a')]||0x1e)*0x3e8,'async':!![],'channelid':_0x1ed676})['then'](function(_0x1d0029){return _0x45a2f0(_0x1d0029);})[_0x0368('0x9c')](function(_0x2d0c57){_0x2db29e[_0x0368('0x17b')]+=0x1;var _0x49a93d=new History(_0x275dff[_0x0368('0xe8')][_0x1ed676]);logger[_0x0368('0x61')](util[_0x0368('0x46')](_0x0368('0x17c'),JSON['stringify'](_0x2d0c57)));_0x49a93d[_0x0368('0x6a')]=0xe;_0x49a93d['statedesc']='OriginateError';_0x49a93d['starttime']=moment()['format'](_0x0368('0xc0'));_0x49a93d[_0x0368('0x6c')]=_0x49a93d[_0x0368('0xd8')];hopperUtils['createHistory'](_0x49a93d)['catch'](loggerCatch(_0x0368('0x17d')));_0x275dff[_0x0368('0xc2')](_0x49a93d)[_0x0368('0x9c')](loggerCatch(_0x0368('0x17d')))['finally'](function(){delete _0x275dff[_0x0368('0xe8')][_0x1ed676];return _0x30a785(msgResponse(_0x0368('0x150'),_0x0368('0xb6'),_0x0368('0x17e')));});});});};Dialer[_0x0368('0x84')][_0x0368('0x17f')]=function(_0xb36c36,_0x261b96,_0x3a5250){var _0x5315b4=new History(_0x261b96);if(_0x5315b4[_0x0368('0x115')]+_0x5315b4[_0x0368('0x121')]+_0x5315b4[_0x0368('0x116')]+_0x5315b4['countnosuchnumberretry']+_0x5315b4['countdropretry']+_0x5315b4[_0x0368('0xe0')]+_0x5315b4[_0x0368('0x113')]+_0x5315b4[_0x0368('0x118')]>=_0x3a5250[_0x0368('0x119')]-0x1){return!![];}switch(_0xb36c36){case 0x3:if(_0x5315b4['countnoanswerretry']>=_0x3a5250['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countnoanswerretry':_0x5315b4[_0x0368('0x116')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250['dialNoAnswerRetryFrequency'],_0x0368('0xd4'))['format'](_0x0368('0xc0')),'ContactId':_0x5315b4['ContactId'],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5315b4[_0x0368('0x115')]>=_0x3a5250[_0x0368('0x180')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x5315b4['countbusyretry']+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0x181')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4['ListId'],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x5315b4['countcongestionretry']>=_0x3a5250[_0x0368('0x182')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x5315b4['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x3a5250[_0x0368('0x183')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4['CampaignId']||undefined})['catch'](loggerCatch(_0x0368('0x184')));break;case 0x0:if(_0x5315b4[_0x0368('0x117')]>=_0x3a5250[_0x0368('0x185')]-0x1){return!![];}else{hopperUtils[_0x0368('0xd2')]({'active':![],'countnosuchnumberretry':_0x5315b4[_0x0368('0x117')]+=0x1,'scheduledat':moment()['add'](_0x3a5250[_0x0368('0x186')],_0x0368('0xd4'))['format'](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x187')));}break;case 0xa:if(_0x5315b4[_0x0368('0xca')]>=_0x3a5250[_0x0368('0xd0')]-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countdropretry':_0x5315b4[_0x0368('0xca')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0xd3')],'minutes')[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4['VoiceQueueId']||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5315b4[_0x0368('0xe0')]>=_0x3a5250[_0x0368('0xe2')]-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countabandonedretry':_0x5315b4[_0x0368('0xe0')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0xe1')],_0x0368('0xd4'))[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4['ContactId'],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4['VoiceQueueId']||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0xe5')));break;case 0x13:if(_0x5315b4[_0x0368('0x113')]>=_0x3a5250['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countmachineretry':_0x5315b4['countmachineretry']+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250[_0x0368('0x11d')],'minutes')[_0x0368('0x46')](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4['ListId'],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x11e')));break;case 0x14:if(_0x5315b4[_0x0368('0x118')]>=_0x3a5250['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x0368('0xd2')]({'active':![],'countagentrejectretry':_0x5315b4[_0x0368('0x118')]+=0x1,'scheduledat':moment()[_0x0368('0xe3')](_0x3a5250['dialAgentRejectRetryFrequency'],'minutes')['format'](_0x0368('0xc0')),'ContactId':_0x5315b4[_0x0368('0xd5')],'ListId':_0x5315b4[_0x0368('0xd6')],'VoiceQueueId':_0x5315b4[_0x0368('0xf4')]||undefined,'CampaignId':_0x5315b4[_0x0368('0xe4')]||undefined})['catch'](loggerCatch(_0x0368('0x188')));break;default:return!![];}};Dialer[_0x0368('0x84')]['callProgressDetecting']=function(_0x5a6252,_0x56ebe9,_0x37d694){var _0x6bc1f1=this;var _0x23ccaf=new History(_0x5a6252);var _0x285f46=![];var _0x5c7409;var _0x5c79eb;return new Promise(function(_0xdf20eb,_0x2f7cb4){if(_[_0x0368('0x3f')](_0x56ebe9)&&typeof _0x56ebe9!==_0x0368('0x189')){return _0x2f7cb4(msgResponse(_0x0368('0x18a'),_0x0368('0x8c'),_0x0368('0x18b')));}if(_[_0x0368('0x3f')](_0x37d694)&&typeof _0x37d694!==_0x0368('0x189')){return _0x2f7cb4(msgResponse(_0x0368('0x18a'),_0x0368('0x8c'),_0x0368('0x18c')));}hopperUtils['verifyAdditionalPhones'](_0x23ccaf,_0x37d694['reason'],_0x56ebe9)[_0x0368('0x3d')](function(_0x3d418e){if(_0x3d418e[_0x0368('0xcf')]==0x1)_0x285f46=!![];switch(_0x37d694[_0x0368('0x18d')]){case'0':_0x56ebe9[_0x0368('0x18e')]+=0x1;_0x23ccaf['state']=0x0;_0x23ccaf[_0x0368('0x6b')]=_0x0368('0x18f');_0x23ccaf[_0x0368('0x117')]+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;ami['emit'](_0x0368('0x190'),ut[_0x0368('0x10c')](_0x5a6252,'nosuchnumber'));_0x5c7409=_0x56ebe9[_0x0368('0x186')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x120')));if(_0x6bc1f1[_0x0368('0x17f')](0x0,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf['countnosuchnumberretry']>=_0x56ebe9[_0x0368('0x185')]){_0x6bc1f1['createStateFinal'](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x191'));}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x191'));}}break;case'3':_0x56ebe9[_0x0368('0x192')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0x3;_0x23ccaf[_0x0368('0x6b')]='NoAnswer';_0x23ccaf[_0x0368('0x116')]+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;var _0x2564ac=ut['buildNoAnswerEventPayload'](_0x5a6252,_0x56ebe9);ami[_0x0368('0x40')](_0x0368('0x193'),_0x2564ac);_0x5c7409=_0x56ebe9[_0x0368('0x194')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x195')));if(_0x6bc1f1[_0x0368('0x17f')](0x3,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x116')]>=_0x56ebe9[_0x0368('0x196')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x198'));}else{_0x6bc1f1['stateGlobal'](_0x23ccaf,_0xdf20eb,_0x2f7cb4,'reason\x203\x20ringing\x20no\x20answer');}}break;case'5':_0x56ebe9['outboundBusyCallsDay']+=0x1;_0x23ccaf[_0x0368('0x6a')]=0x5;_0x23ccaf['statedesc']=_0x0368('0x199');_0x23ccaf['countbusyretry']+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;ami[_0x0368('0x40')](_0x0368('0x19a'),ut[_0x0368('0x10c')](_0x5a6252,_0x0368('0x19b')));_0x5c7409=_0x56ebe9[_0x0368('0x181')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils['createHistory'](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x19c')));if(_0x6bc1f1[_0x0368('0x17f')](0x5,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf['countbusyretry']>=_0x56ebe9[_0x0368('0x180')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x19d'));}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x19d'));}}break;case'8':_0x56ebe9[_0x0368('0x19e')]+=0x1;_0x23ccaf['state']=0x8;_0x23ccaf['statedesc']=_0x0368('0x19f');_0x23ccaf[_0x0368('0x121')]+=0x1;_0x23ccaf[_0x0368('0xcb')]+=0x1;_0x5c7409=_0x56ebe9[_0x0368('0x183')];_0x5c79eb=_0x56ebe9['callAdditionalPhoneAfterMin'];ami[_0x0368('0x40')]('custom:agentcongestion',ut[_0x0368('0x10c')](_0x5a6252,_0x0368('0x1a0')));hopperUtils['createHistory'](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x1a1')));if(_0x6bc1f1[_0x0368('0x17f')](0x8,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x121')]>=_0x56ebe9['dialCongestionMaxRetry']){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1a2'));}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,'reason\x208\x20congestion');}}break;case'11':_0x56ebe9[_0x0368('0x1a3')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0xb;_0x23ccaf[_0x0368('0x6b')]='Abandoned';_0x23ccaf[_0x0368('0xe0')]+=0x1;_0x23ccaf['countglobal']+=0x1;_0x5c7409=_0x56ebe9[_0x0368('0xe1')];_0x5c79eb=_0x56ebe9['callAdditionalPhoneAfterMin'];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0xe6')));if(_0x6bc1f1[_0x0368('0x17f')](0xb,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0xe0')]>=_0x56ebe9[_0x0368('0xe2')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,'reason\x2011\x20abandoned');}else{_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1a4'));}}break;case'20':_0x56ebe9[_0x0368('0x1a5')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0x14;_0x23ccaf[_0x0368('0x6b')]=_0x0368('0x1a6');_0x23ccaf[_0x0368('0x118')]+=0x1;_0x23ccaf['countglobal']+=0x1;_0x5c7409=_0x56ebe9[_0x0368('0x1a7')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];ami['emit'](_0x0368('0x1a8'),ut[_0x0368('0x10c')](_0x5a6252,_0x0368('0x1a9')));hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x1aa')));if(_0x6bc1f1[_0x0368('0x17f')](0x14,_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x118')]>=_0x56ebe9[_0x0368('0x1ab')]){_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1ac'));}else{_0x6bc1f1['stateGlobal'](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x0368('0x1ac'));}}break;default:_0x56ebe9[_0x0368('0x1ad')]+=0x1;_0x23ccaf[_0x0368('0x6a')]=0xc;_0x23ccaf[_0x0368('0x6b')]=_0x37d694[_0x0368('0x18d')];_0x5c7409=_0x56ebe9[_0x0368('0x1a7')];_0x5c79eb=_0x56ebe9[_0x0368('0xcc')];hopperUtils[_0x0368('0xdb')](_0x23ccaf)[_0x0368('0x9c')](loggerCatch(_0x0368('0x1ae')));if(_0x6bc1f1[_0x0368('0x17f')](_0x37d694[_0x0368('0x18d')],_0x5a6252,_0x56ebe9)&&!_0x285f46){if(_0x23ccaf[_0x0368('0x115')]+_0x23ccaf[_0x0368('0x121')]+_0x23ccaf[_0x0368('0x116')]+_0x23ccaf[_0x0368('0x117')]+_0x23ccaf[_0x0368('0xca')]+_0x23ccaf['countabandonedretry']+_0x23ccaf['countmachineretry']+_0x23ccaf[_0x0368('0x118')]>=_0x56ebe9[_0x0368('0x119')]){_0x6bc1f1[_0x0368('0x11a')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x37d694[_0x0368('0x18d')]);}else{_0x6bc1f1[_0x0368('0x197')](_0x23ccaf,_0xdf20eb,_0x2f7cb4,_0x37d694[_0x0368('0x18d')]);}}}})[_0x0368('0x3d')](function(){if(_0x285f46){hopperUtils['swapAdditionalPhones'](_0x23ccaf,_0x5c7409,_0x5c79eb)['then'](function(){return _0xdf20eb(0x1);});}});});};Dialer[_0x0368('0x84')][_0x0368('0x11a')]=function(_0x13ac64,_0x32cda7,_0x384959,_0x46be75){var _0x59f699=new Final(_0x13ac64);_0x59f699[_0x0368('0x6a')]=0xf;_0x59f699['statedesc']=_0x0368('0x1af');this[_0x0368('0x197')](_0x59f699,_0x32cda7,_0x384959,_0x46be75);};Dialer[_0x0368('0x84')]['createStateFinal']=function(_0x2e20b8,_0x5d921d,_0x20e296,_0x50e52e){hopperUtils[_0x0368('0xc2')](_0x2e20b8)[_0x0368('0x3d')](function(){return _0x5d921d(msgResponse(_0x0368('0x18a'),_0x0368('0x100'),_0x50e52e));})['catch'](function(){return _0x20e296(msgResponse(_0x0368('0x1b0'),'Failure',_0x0368('0x1b1')));});};Dialer[_0x0368('0x84')][_0x0368('0xb')]=function(_0x4693ee){var _0x146521=_0x4693ee['dialPredictiveOptimizationPercentage']/0x64;var _0x2ee106=_0x4693ee[_0x0368('0x1b2')]/(_0x4693ee[_0x0368('0x1b2')]+_0x4693ee[_0x0368('0xbc')]);var _0x4168e9=Math[_0x0368('0x1b3')](_0x4693ee[_0x0368('0x1b4')]*(_0x4693ee[_0x0368('0x1b5')]/0x64));var _0x1353fc=Math[_0x0368('0x1b3')](_0x4693ee['predictiveIntervalAvailable']*(_0x4693ee['predictiveIntervalMinThreshold']/0x64));var _0x18af01=_0x4693ee[_0x0368('0x12d')]+_0x4693ee[_0x0368('0x12f')];var _0x261777=Math['floor'](_0x4693ee[_0x0368('0x1b6')]*_0x4693ee[_0x0368('0x5a')]*_0x4693ee[_0x0368('0x1b7')]*_0x4693ee[_0x0368('0x1b8')]);if(_[_0x0368('0x3f')](_0x4693ee[_0x0368('0x24')])){if(!_['isUndefined'](_0x4693ee[_0x0368('0x23')])){_0x4693ee[_0x0368('0x23')]=undefined;loggerPredictive[_0x0368('0x61')]('[startMethodPredictive][StartProgressive]',_0x0368('0x1b9'));}if(!_[_0x0368('0x3f')](_0x4693ee[_0x0368('0x5f')])){loggerPredictive['error'](_0x0368('0x1ba'),_0x0368('0x1bb'));clearInterval(_0x4693ee['handlePredictive']);_0x4693ee[_0x0368('0x5f')]=undefined;}_0x4693ee[_0x0368('0x24')]=moment()[_0x0368('0x46')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],_0x0368('0x1bc'),_0x4693ee[_0x0368('0x24')]);this[_0x0368('0xad')](_0x4693ee,0x1);}else if(ifInterval(_0x4693ee[_0x0368('0x1bd')],_0x4693ee[_0x0368('0x24')])){this[_0x0368('0xad')](_0x4693ee,0x1);loggerPredictiveCalls[_0x0368('0x49')](_0x0368('0x1be'),_0x4693ee[_0x0368('0x24')],_0x4693ee['name']);_0x4693ee['erlangCalls']=0x0;_0x4693ee['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x146521<_0x2ee106&&_0x4693ee[_0x0368('0x1bf')]==='dropRate'){clearPredictiveAttributes(_0x4693ee);loggerPredictive[_0x0368('0x49')](_0x0368('0x1c0'),_0x0368('0x1c1'),_0x2ee106,_0x0368('0x24'),_0x4693ee['name']);}else if(_0x261777<_0x4693ee[_0x0368('0xc7')]&&_0x4693ee['dialPredictiveOptimization']===_0x0368('0x1c2')){clearPredictiveAttributes(_0x4693ee);loggerPredictive['info'](_0x0368('0x1c3'),_0x0368('0x1c4'),_0x261777,_0x0368('0x1c5'),_0x4693ee['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x4693ee[_0x0368('0x47')]);}else if(!ifInterval(_0x4693ee['dialPredictiveInterval'],_0x4693ee[_0x0368('0x24')])&&_[_0x0368('0x3f')](_0x4693ee['startPredictive'])&&!_[_0x0368('0x3f')](_0x4693ee[_0x0368('0x24')])){_0x4693ee[_0x0368('0x23')]=moment()[_0x0368('0x46')](_0x0368('0xc0'));loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],'started\x20in\x20predictive\x20at',_0x4693ee[_0x0368('0x23')]);hopperUtils[_0x0368('0x1c6')](_0x4693ee[_0x0368('0x1bd')])[_0x0368('0x3d')](this['getDataPredictive'](_0x4693ee))['then'](mergeDataErlangB(_0x4693ee))[_0x0368('0x3d')](this[_0x0368('0x1c7')](_0x4693ee))['catch'](loggerCatchPredictive(_0x0368('0x1c8'),_0x4693ee));}else if(!ifInterval(_0x4693ee[_0x0368('0x1bd')],_0x4693ee[_0x0368('0x23')])){_0x4693ee[_0x0368('0xc7')]=0x0;_0x4693ee[_0x0368('0x23')]=moment()['format'](_0x0368('0xc0'));loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],_0x0368('0x1c9'),_0x4693ee[_0x0368('0x23')]);clearInterval(_0x4693ee[_0x0368('0x5f')]);_0x4693ee[_0x0368('0x5f')]=undefined;hopperUtils['avgHandleTime'](_0x4693ee['dialPredictiveInterval'])['then'](this[_0x0368('0x1ca')](_0x4693ee))[_0x0368('0x3d')](mergeDataErlangB(_0x4693ee))[_0x0368('0x3d')](this[_0x0368('0x1c7')](_0x4693ee))['catch'](loggerCatchPredictive(_0x0368('0x1cb'),_0x4693ee));}else if(_0x4693ee['predictiveIntervalAvailable']&&_0x18af01<_0x4693ee[_0x0368('0x1b4')]-_0x1353fc){clearPredictiveAttributes(_0x4693ee);loggerPredictive[_0x0368('0x49')](_0x4693ee[_0x0368('0x47')],_0x0368('0x1cc'),_0x18af01,_0x0368('0x1cd'),_0x4693ee['predictiveIntervalAvailable'],'-',_0x1353fc,'=',_0x4693ee[_0x0368('0x1b4')]-_0x1353fc,')');}else if(_0x4693ee['predictiveIntervalAvailable']&&_0x18af01>_0x4693ee[_0x0368('0x1b4')]+_0x4168e9){clearPredictiveAttributes(_0x4693ee);loggerPredictive['info'](_0x4693ee[_0x0368('0x47')],_0x0368('0x1cc'),_0x18af01,_0x0368('0x1ce'),_0x4693ee['predictiveIntervalAvailable'],'+',_0x4168e9,'=',_0x4693ee['predictiveIntervalAvailable']+_0x4168e9,')');}};Dialer[_0x0368('0x84')][_0x0368('0x1ca')]=function(_0x486d17){var _0x18bd7f=this;return function(_0x383d27){return new Promise(function(_0x4f2b92,_0x40cc2f){_[_0x0368('0x5d')](_0x486d17,_0x383d27[0x0]);if(checkGetDataPredictive(_0x383d27[0x0])){var _0x4f0d70=_0x486d17[_0x0368('0x1b4')]=_0x486d17[_0x0368('0x12f')]+_0x486d17[_0x0368('0x12d')];var _0x1fa563=_0x486d17[_0x0368('0x1bd')]*0x3c;var _0x393e0c=_0x383d27[0x0][_0x0368('0x52')]+_0x383d27[0x0][_0x0368('0x54')];var _0x2dfaca=(_0x383d27[0x0][_0x0368('0x1cf')]+_0x383d27[0x0][_0x0368('0x4e')]+_0x383d27[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x383d27[0x0][_0x0368('0x4b')];_0x486d17[_0x0368('0x1b7')]=_0x2dfaca>0x0?_0x2dfaca:0x1;switch(_0x486d17[_0x0368('0x1bf')]){case _0x0368('0x1c2'):var _0x477182=_0x486d17[_0x0368('0x1d0')]/0x64;return _0x18bd7f['abandonmentRate'](_0x4f0d70,_0x1fa563,_0x393e0c,_0x2dfaca,_0x477182)[_0x0368('0x3d')](function(_0x5af98b){return _0x4f2b92(_0x5af98b);});case _0x0368('0x1d1'):var _0x1d8e84=_0x486d17[_0x0368('0x1d0')]/0x64;return _0x18bd7f[_0x0368('0x1d2')](_0x4f0d70,_0x1fa563,_0x393e0c,_0x2dfaca,_0x1d8e84)[_0x0368('0x3d')](function(_0x2ec4c9){return _0x4f2b92(_0x2ec4c9);});default:return _0x40cc2f(msgResponse(_0x0368('0x1d3'),'Failure',_0x0368('0x1d4')));}}else{return _0x40cc2f(msgResponse('[getDataPredictive]',_0x0368('0x8c'),_0x0368('0x1d5')));}});};};Dialer[_0x0368('0x84')][_0x0368('0x1d6')]=function(_0x7aa4b7){var _0x4715b1=this;return function(_0x345545){return new Promise(function(_0x8bb643,_0x98129f){_[_0x0368('0x5d')](_0x7aa4b7,_0x345545[0x0]);if(checkGetDataPredictive(_0x345545[0x0])){loggerPredictive[_0x0368('0x49')](JSON[_0x0368('0x6f')](_0x345545[0x0]));if(_0x7aa4b7[_0x0368('0x1bf')]==='dropRate'){return _0x4715b1['getVoiceQueueRtPauses'](_0x7aa4b7['id'])[_0x0368('0x3d')](function(_0x51ffb6){var _0x136274=_0x7aa4b7['loggedIn']-_0x51ffb6[0x0][_0x0368('0x1d7')];var _0x45ca99=_0x7aa4b7[_0x0368('0x1bd')]*0x3c;var _0x570310=_0x345545[0x0][_0x0368('0x52')]+_0x345545[0x0][_0x0368('0x54')];var _0x54f9b9=(_0x345545[0x0][_0x0368('0x1cf')]+_0x345545[0x0][_0x0368('0x4e')]+_0x345545[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x345545[0x0][_0x0368('0x4b')];var _0x20a6f=_0x7aa4b7['dialPredictiveOptimizationPercentage']/0x64;_0x7aa4b7[_0x0368('0x1d8')]=_0x51ffb6[0x0][_0x0368('0x1d7')]||0x0;_0x7aa4b7['predictiveIntervalHitRate']=_0x54f9b9>0x0?_0x54f9b9:0x1;return _0x4715b1['abandonmentRate'](_0x136274,_0x45ca99,_0x570310,_0x54f9b9,_0x20a6f);})['then'](function(_0x413e40){return _0x8bb643(_0x413e40);})[_0x0368('0x9c')](function(_0x131bbb){return _0x98129f(msgResponse(_0x0368('0x1d9'),_0x0368('0x8c'),JSON['stringify'](_0x131bbb)));});}if(_0x7aa4b7[_0x0368('0x1bf')]==='agentBusyFactor'){return _0x4715b1['getVoiceQueueRtPauses'](_0x7aa4b7['id'])[_0x0368('0x3d')](function(_0x253bb2){var _0x341ae4=_0x7aa4b7[_0x0368('0x1da')]-_0x253bb2[0x0][_0x0368('0x1d7')];var _0x54ad7e=_0x7aa4b7[_0x0368('0x1bd')]*0x3c;var _0x50d9c6=_0x345545[0x0][_0x0368('0x52')]+_0x345545[0x0][_0x0368('0x54')];var _0x37087d=(_0x345545[0x0][_0x0368('0x1cf')]+_0x345545[0x0][_0x0368('0x4e')]+_0x345545[0x0][_0x0368('0x50')])/_0x345545[0x0][_0x0368('0x4b')];var _0x160cb7=_0x7aa4b7[_0x0368('0x1d0')]/0x64;_0x7aa4b7[_0x0368('0x1d8')]=_0x253bb2[0x0][_0x0368('0x1d7')]||0x0;_0x7aa4b7[_0x0368('0x1b7')]=_0x37087d>0x0?_0x37087d:0x1;return _0x4715b1[_0x0368('0x1d2')](_0x341ae4,_0x54ad7e,_0x50d9c6,_0x37087d,_0x160cb7);})['then'](function(_0x2ca694){return _0x8bb643(_0x2ca694);})[_0x0368('0x9c')](function(_0x3da2d0){return _0x98129f(msgResponse(_0x0368('0x1d9'),_0x0368('0x8c'),JSON[_0x0368('0x6f')](_0x3da2d0)));});}}else{return _0x98129f(msgResponse(_0x0368('0x1d3'),_0x0368('0x8c'),_0x0368('0x1d5')));}});};};Dialer[_0x0368('0x84')][_0x0368('0x1c7')]=function(_0x24ef7a){var _0x501810=this;return function(){var _0x4c6b88=0x0;var _0x55be5a=Math[_0x0368('0x1db')](_0x24ef7a[_0x0368('0x1dc')]*0x3e8);if(_0x55be5a>0x0){_0x55be5a=_0x55be5a<0x64?0x64:_0x55be5a;loggerPredictive[_0x0368('0x49')](_0x24ef7a[_0x0368('0x47')],_0x0368('0x1dd'),_0x55be5a,_0x0368('0x1de'));_0x24ef7a[_0x0368('0x5f')]=setInterval(function(){_0x501810[_0x0368('0x5f')](_0x24ef7a);loggerPredictiveCalls['info']('[handlePredictive]',_0x4c6b88+=0x1);},_0x55be5a);}else{loggerPredictive[_0x0368('0x49')](_0x24ef7a[_0x0368('0x47')],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x0368('0x84')][_0x0368('0x1df')]=function(_0x1548fd,_0x262450){var _0x2da68c=this;return function(_0x730775){if(_[_0x0368('0x76')](_0x730775)){if(_[_0x0368('0xee')](_0x262450['UserId'])||!_0x262450[_0x0368('0x1e0')]){if(_0x1548fd[_0x0368('0xab')]==='booked'){_0x1548fd['queueStatusComplete']=_['isUndefined'](_0x1548fd[_0x0368('0x71')])?!![]:_0x1548fd[_0x0368('0x71')];var _0x33f1f9=uuid['v4']();_0x2da68c[_0x0368('0xe8')][_0x33f1f9]=new Action(_0x1548fd,_0x262450,_0x33f1f9);loggerBooked['info'](_0x0368('0x1e1'),_0x33f1f9,'queueStatusComplete:\x20',JSON['stringify'](_0x1548fd[_0x0368('0x71')]),_0x0368('0x1e2'),_0x1548fd[_0x0368('0x47')]);if(_0x1548fd[_0x0368('0x71')]){_0x1548fd[_0x0368('0x71')]=![];_0x2da68c[_0x0368('0x26')][_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xbb')]]=[];ami[_0x0368('0x94')]({'actionid':_0x33f1f9,'action':_0x0368('0x1e3'),'queue':_0x1548fd[_0x0368('0x47')]})['catch'](function(){_0x2da68c[_0x0368('0xba')](_0x1548fd);hopperUtils[_0x0368('0xd2')]({'active':![],'ContactId':_0x2da68c['actions'][_0x33f1f9][_0x0368('0xd5')],'ListId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xd6')],'VoiceQueueId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xf4')]||undefined,'CampaignId':_0x2da68c['actions'][_0x33f1f9][_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2da68c[_0x0368('0xe8')][_0x33f1f9];});}else{loggerBooked['info'](_0x0368('0x1e4'),JSON['stringify'](_0x1548fd['queueStatusComplete']),'Queue:\x20',_0x1548fd[_0x0368('0x47')]);_0x2da68c[_0x0368('0xba')](_0x1548fd);hopperUtils[_0x0368('0xd2')]({'active':![],'ContactId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9]['ContactId'],'ListId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9][_0x0368('0xd6')],'VoiceQueueId':_0x2da68c[_0x0368('0xe8')][_0x33f1f9]['VoiceQueueId']||undefined,'CampaignId':_0x2da68c['actions'][_0x33f1f9][_0x0368('0xe4')]||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x1e5')));delete _0x2da68c['actions'][_0x33f1f9];}}else{return _0x2da68c[_0x0368('0x1e6')](_0x1548fd,_0x262450);}}else{if(utils['getSeconds'](undefined,_0x262450[_0x0368('0x1e7')])<_0x1548fd['dialRecallMeTimeout']*0x3c){if(_0x262450[_0x0368('0x13d')]&&!_0x262450[_0x0368('0x13d')][_0x0368('0x1e8')]){_0x2da68c[_0x0368('0x1a')][_0x0368('0x1e9')](_0x262450['id'])[_0x0368('0x19')](function(){_0x2da68c[_0x0368('0xba')](_0x1548fd);});}else{hopperUtils[_0x0368('0x1ea')]({'active':![]},_0x262450['id'],0x1)['finally'](function(){_0x2da68c[_0x0368('0xba')](_0x1548fd);});}}else{_0x1548fd[_0x0368('0x1eb')]+=0x1;_0x2da68c['updateOriginated'](_0x1548fd);if(_0x1548fd[_0x0368('0x1ec')]){hopperUtils[_0x0368('0xd2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x262450[_0x0368('0xd5')],'ListId':_0x262450[_0x0368('0xd6')],'VoiceQueueId':_0x262450['VoiceQueueId']||undefined,'CampaignId':_0x262450['CampaignId']||undefined})[_0x0368('0x9c')](loggerCatch(_0x0368('0x1ed')));hopperUtils[_0x0368('0xdb')](createObjHistory(_0x1548fd,_0x262450,utils['CAMPAIGN_STATUS'][_0x0368('0x1ee')],0x17,'RecallInQueue'))['catch'](loggerCatch(_0x0368('0x1ef')));}else{_0x2da68c[_0x0368('0x10d')](createObjHistory(_0x1548fd,_0x262450,utils[_0x0368('0x68')][_0x0368('0x1f0')],0x16,'RecallFailedTimeout'),_0x0368('0x1f1'),'[Originate][HistoryRecallClose]');}}}}else{_0x1548fd[_0x0368('0x1f2')]+=0x1;_0x2da68c['saveInDb'](createObjHistory(_0x1548fd,_0x262450,utils[_0x0368('0x68')][_0x0368('0x1f3')],0xd,_0x0368('0x1f4')),_0x0368('0x1f5'),_0x0368('0x1f6'));throw _0x0368('0x1f7');}};};Dialer[_0x0368('0x84')][_0x0368('0x1f8')]=function(_0x32d6aa){var _0x28e6ec=this;var _0x49b5cd=_0x32d6aa[_0x0368('0x1f9')]-_0x32d6aa['originated'];emitCampaignSummary(_0x32d6aa);if(_0x49b5cd>0x0&&_0x32d6aa[_0x0368('0x1fa')]==0x0){if(_0x49b5cd>this[_0x0368('0x1f')]){_0x49b5cd=this[_0x0368('0x1f')];}_0x32d6aa[_0x0368('0x1fa')]=0x1;hopperUtils['getContactDialerIvr'](_0x32d6aa,_0x49b5cd)[_0x0368('0x3d')](function(_0x106079){_0x32d6aa[_0x0368('0x1fa')]=0x0;if(_0x106079){if(!utils[_0x0368('0x1fb')](_0x106079)){_0x32d6aa[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x1fc')];logger[_0x0368('0x49')]('[getContactCampaign2][Empty]'+_0x32d6aa[_0x0368('0x47')]);}else{_0x32d6aa[_0x0368('0x145')]+=_0x106079[_0x0368('0x92')];_0x32d6aa[_0x0368('0x64')]=utils['CAMPAIGN_STATUS'][_0x0368('0x1fd')];for(var _0x3d7ef8=0x0;_0x3d7ef8<_0x106079['length'];_0x3d7ef8+=0x1){_0x32d6aa[_0x0368('0x1fe')]+=0x1;if(_[_0x0368('0xee')](_0x106079[_0x3d7ef8])||_[_0x0368('0xee')](_0x106079[_0x3d7ef8][_0x0368('0x16b')])||_[_0x0368('0xee')](_0x106079[_0x3d7ef8][_0x0368('0x152')])){_0x28e6ec[_0x0368('0x149')](_0x0368('0x1ff'),_0x32d6aa,_0x106079[_0x3d7ef8]);}else{hopperUtils[_0x0368('0x200')](_[_0x0368('0x70')](_0x106079[_0x3d7ef8],['CampaignId',_0x0368('0x152')]))[_0x0368('0x3d')](_0x28e6ec[_0x0368('0x1df')](_0x32d6aa,_0x106079[_0x3d7ef8]))['catch'](_0x28e6ec[_0x0368('0x148')](_0x0368('0x201'),_0x32d6aa));}}}}})[_0x0368('0x9c')](loggerGetContactDialer('[getContactCampaign2]',_0x32d6aa,_0x49b5cd));}};Dialer[_0x0368('0x84')][_0x0368('0xad')]=function(_0x532677,_0x16a32c){var _0x11b1ba=this;var _0xc3855e=[];if(_0x16a32c<0x1||_0x532677[_0x0368('0xab')]===_0x0368('0xa')){_0x16a32c=0x1;}var _0x3f81e4=Math[_0x0368('0x1db')](_0x532677[_0x0368('0x12d')]*_0x16a32c)-_0x532677[_0x0368('0x145')];if(_0x532677[_0x0368('0x202')]>0x0){var _0x5405ff=_0x532677['dialLimitQueue']-_0x532677[_0x0368('0x145')]-_0x532677[_0x0368('0x12f')]-_0x532677[_0x0368('0x130')];if(_0x3f81e4>_0x5405ff){_0x3f81e4=_0x5405ff;}}if(_0x3f81e4>0x0&&_0x532677[_0x0368('0x1fa')]==0x0){if(_0x532677['dialMethod']===_0x0368('0xa')){_0x3f81e4=0x1;}if(_0x3f81e4>this['maxNumberOriginate']){_0x3f81e4=this['maxNumberOriginate'];}for(var _0x554e28 in this['agents']){if(typeof this[_0x0368('0x1d')][_0x554e28]!==_0x0368('0xa5')){if(this[_0x0368('0x1d')][_0x554e28]['state']===_0x0368('0x203')&&this['agents'][_0x554e28][_0x0368('0x82')]===_0x0368('0x81')){_0xc3855e[_0x0368('0x93')](this[_0x0368('0x1d')][_0x554e28]['id']);}}}_0x532677[_0x0368('0x1fa')]=0x1;hopperUtils[_0x0368('0x204')](_0x532677,_0xc3855e,_0x3f81e4)[_0x0368('0x3d')](function(_0x4620aa){_0x532677[_0x0368('0x1fa')]=0x0;if(_0x4620aa){if(!utils['checkContactEmpty'](_0x4620aa)){hopperUtils['countReScheduled'](_0x532677)[_0x0368('0x3d')](sendMessageReschedule(_0x532677))[_0x0368('0x9c')](loggerCatch(_0x0368('0x205')));}else{_0x532677[_0x0368('0x145')]+=_0x4620aa[_0x0368('0x92')];_0x532677[_0x0368('0x64')]=_0x532677[_0x0368('0xab')]===_0x0368('0xa')?utils[_0x0368('0x68')]['ACTIVE']:utils[_0x0368('0x68')]['RUNNING'];for(var _0x57a2c8=0x0;_0x57a2c8<_0x4620aa['length'];_0x57a2c8+=0x1){if(_[_0x0368('0xee')](_0x4620aa[_0x57a2c8])||_[_0x0368('0xee')](_0x4620aa[_0x57a2c8][_0x0368('0x16b')])||_[_0x0368('0xee')](_0x4620aa[_0x57a2c8][_0x0368('0x152')])){_0x11b1ba[_0x0368('0x149')]('[actionOriginate]\x20',_0x532677,_0x4620aa[_0x57a2c8]);}else{hopperUtils[_0x0368('0x206')](_[_0x0368('0x70')](_0x4620aa[_0x57a2c8],['VoiceQueueId','phone']))['then'](_0x11b1ba['checkContactBlack'](_0x532677,_0x4620aa[_0x57a2c8]))['catch'](_0x11b1ba[_0x0368('0x148')]('[actionOriginate]\x20',_0x532677));}}}}})[_0x0368('0x9c')](loggerGetContactDialer(_0x0368('0x207'),_0x532677,_0x3f81e4));}};Dialer[_0x0368('0x84')][_0x0368('0x5f')]=function(_0x3db8bc){if(_0x3db8bc['dialLimitQueue']>0x0){var _0x2eac4f=_0x3db8bc['dialLimitQueue']-_0x3db8bc[_0x0368('0x145')]-_0x3db8bc[_0x0368('0x12f')];if(_0x2eac4f>0x0&&_0x3db8bc[_0x0368('0x1fa')]==0x0){this[_0x0368('0x208')](_0x3db8bc);}else{loggerPredictiveCalls['info'](_0x0368('0x209'));}}else{this[_0x0368('0x208')](_0x3db8bc);}};Dialer[_0x0368('0x84')][_0x0368('0x208')]=function(_0x5f29f1){var _0x207345=this;var _0xc66f98=[];_0x5f29f1['originated']+=0x1;for(var _0x1aa330 in this[_0x0368('0x1d')]){if(typeof this[_0x0368('0x1d')][_0x1aa330]!==_0x0368('0xa5')){if(this[_0x0368('0x1d')][_0x1aa330]['state']==='not_inuse'&&this[_0x0368('0x1d')][_0x1aa330][_0x0368('0x82')]==='reachable'){_0xc66f98[_0x0368('0x93')](this[_0x0368('0x1d')][_0x1aa330]['id']);}}}_0x5f29f1['temp']=0x1;return this[_0x0368('0x204')](_0x5f29f1['id'],_0xc66f98,0x1,_0x5f29f1['dialOrderByScheduledAt'],_0x5f29f1)[_0x0368('0x3d')](function(_0x4139eb){_0x5f29f1[_0x0368('0x1fa')]=0x1;if(_0x4139eb){if(!utils['checkContactEmpty'](_0x4139eb)){utils[_0x0368('0x20a')](_0x5f29f1,0x1,0x0);return hopperUtils[_0x0368('0x20b')](_0x5f29f1)[_0x0368('0x3d')](sendMessageReschedule(_0x5f29f1))[_0x0368('0x9c')](loggerCatch(_0x0368('0x205')));}else{_0x5f29f1[_0x0368('0x64')]=utils[_0x0368('0x68')][_0x0368('0x1fd')];if(_['isNil'](_0x4139eb[0x0])||_[_0x0368('0xee')](_0x4139eb[0x0][_0x0368('0x16b')])||_[_0x0368('0xee')](_0x4139eb[0x0][_0x0368('0x152')])){_0x207345[_0x0368('0x149')]('[actionOriginate]\x20',_0x5f29f1,_0x4139eb[0x0]);}else{return hopperUtils[_0x0368('0x206')](_['pick'](_0x4139eb[0x0],[_0x0368('0xf4'),_0x0368('0x152')]))[_0x0368('0x3d')](_0x207345['checkContactBlack'](_0x5f29f1,_0x4139eb[0x0]))['catch'](_0x207345[_0x0368('0x148')](_0x0368('0x20c'),_0x5f29f1));}}}})['catch'](loggerGetContactDialer(_0x0368('0x20d'),_0x5f29f1,0x1));};Dialer['prototype'][_0x0368('0x20e')]=function(_0x3fdbe3,_0x4d1786,_0x3de1d5,_0x2ca59c,_0x22921a,_0x13e7cc){loggerPredictive[_0x0368('0x49')](_0x0368('0x20f'));loggerPredictive[_0x0368('0x49')](_0x0368('0x210'),_0x3fdbe3);loggerPredictive[_0x0368('0x49')](_0x0368('0x211'),_0x4d1786);loggerPredictive[_0x0368('0x49')](_0x0368('0x212'),_0x3de1d5);loggerPredictive[_0x0368('0x49')](_0x0368('0x213'),_0x2ca59c);loggerPredictive[_0x0368('0x49')](_0x0368('0x214'),_0x22921a);loggerPredictive[_0x0368('0x49')](_0x0368('0x53'));return new Promise(function(_0x466c6b,_0x505a23){if(_0x3fdbe3<=0x0||isNaN(_0x3fdbe3)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),'m\x20=\x20'+_0x3fdbe3));}if(_0x3de1d5<=0x0||isNaN(_0x3de1d5)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),_0x0368('0x216')+_0x3de1d5));}if(_0x2ca59c<=0x0||isNaN(_0x2ca59c)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),_0x0368('0x217')+_0x2ca59c));}if(_0x4d1786<=0x0||isNaN(_0x4d1786)){return _0x505a23(msgResponse('[abandonmentRate]',_0x0368('0xb6'),_0x0368('0x218')+_0x4d1786));}if(_0x22921a<=0x0||isNaN(_0x22921a)){return _0x505a23(msgResponse(_0x0368('0x215'),_0x0368('0xb6'),_0x0368('0x219')+_0x22921a));}_0x13e7cc=_0x13e7cc||0x0;var _0x170b46=0x1/_0x3de1d5;var _0xc60fec=0x0;var _0x52bb4c=0x0;var _0x4fa9eb=0x0;var _0x1a9fd5=0x0;for(var _0x1c011e=0x0;_0x4fa9eb<_0x22921a;_0x1c011e+=0x1){_0x52bb4c=_0x1c011e/_0x4d1786;_0xc60fec=(_0x2ca59c*_0x52bb4c+_0x13e7cc)/_0x170b46;_0x4fa9eb=utils[_0x0368('0x21a')](_0xc60fec,_0x3fdbe3);_0x1a9fd5=_0xc60fec/_0x3fdbe3*(0x1-utils[_0x0368('0x21a')](_0xc60fec,_0x3fdbe3));}return _0x466c6b({'erlangCalls':_0x1c011e,'erlangCallToSecond':_0x4d1786/_0x1c011e,'erlangAbandonmentRate':_0x4fa9eb,'erlangBusyFactor':_0x1a9fd5});});};Dialer[_0x0368('0x84')][_0x0368('0x1d2')]=function(_0x382411,_0x2beedc,_0x248440,_0x58c096,_0x4bfce8,_0x5a4d39){loggerPredictive['info'](_0x0368('0x21b'));loggerPredictive['info'](_0x0368('0x210'),_0x382411);loggerPredictive[_0x0368('0x49')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2beedc);loggerPredictive[_0x0368('0x49')]('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',_0x248440);loggerPredictive[_0x0368('0x49')](_0x0368('0x213'),_0x58c096);loggerPredictive[_0x0368('0x49')](_0x0368('0x21c'),_0x4bfce8);loggerPredictive[_0x0368('0x49')](_0x0368('0x53'));return new Promise(function(_0x24a36e,_0x13f6b8){if(_0x382411<=0x0||isNaN(_0x382411)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),_0x0368('0xb6'),'m\x20=\x20'+_0x382411));}if(_0x248440<=0x0||isNaN(_0x248440)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),_0x0368('0xb6'),_0x0368('0x216')+_0x248440));}if(_0x58c096<=0x0||isNaN(_0x58c096)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),'Error',_0x0368('0x217')+_0x58c096));}if(_0x2beedc<=0x0||isNaN(_0x2beedc)){return _0x13f6b8(msgResponse('[busyFactor]','Error',_0x0368('0x218')+_0x2beedc));}if(_0x4bfce8<=0x0||isNaN(_0x4bfce8)){return _0x13f6b8(msgResponse(_0x0368('0x21d'),_0x0368('0xb6'),_0x0368('0x21e')+_0x4bfce8));}_0x5a4d39=_0x5a4d39||0x0;var _0x527973=0x1/_0x248440;var _0x507a40=0x0;var _0x2800a2=0x0;var _0x463422=0x0;var _0x3501c7=0x0;for(var _0x5e383b=0x0;_0x3501c7<_0x4bfce8;_0x5e383b+=0x1){_0x2800a2=_0x5e383b/_0x2beedc;_0x507a40=(_0x58c096*_0x2800a2+_0x5a4d39)/_0x527973;_0x463422=utils[_0x0368('0x21a')](_0x507a40,_0x382411);_0x3501c7=_0x507a40/_0x382411*(0x1-utils[_0x0368('0x21a')](_0x507a40,_0x382411));}return _0x24a36e({'erlangCalls':_0x5e383b,'erlangCallToSecond':_0x2beedc/_0x5e383b,'erlangAbandonmentRate':_0x463422,'erlangBusyFactor':_0x3501c7});});};module[_0x0368('0x21f')]=Dialer; \ No newline at end of file +var _0x04e2=['resetActiveCalls','syncCampaigns','undefined','dialGlobalInterval','dialTimezone','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','Queue','method\x20not\x20recognized','Intervals','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','\x20Interval\x20is\x20overtime:\x20','isGlobal','AMI\x20IfTime','queue','updateOriginated','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','reason','agiafterat','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','dropreason','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','VoiceQueueId','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','countglobal','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','CampaignId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','locked','paused','stateinterface','merge','idHopper','[unlock][syncQueueStatusComplete]','_rr','length','isNil','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','response','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','dialAMDActive','value','HANGUP','outboundAnswerCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','outboundAnswerAgiCallsDay','countagentrejectretry','createStateFinal','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','[syncAgentComplete][createHistory]','outboundUnknownCallsDay','Unknow','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','available','inUse','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','syncQueueSummaryComplete','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','launchHandleIvr','handleIvr','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerId','TrunkBackup','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','substring','from-sip','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','agentreject','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval',')\x20are\x20less\x20than\x20threshold\x20(','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalAvgTalktime','predictiveIntervalHitRate','dialPredictiveOptimization','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','erlangCallToSecond','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','run','unlockContact','outboundReCallsDay','QUEUE_RECALL','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','checkIsBlackListIvr','checkContactBlack','[actionOriginateIvr]\x20','floor','booked','not_inuse','reachable','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[getContactDialer2]','dialLimitQueue','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','uuid','./utils','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','./models/action','./models/history','./models/final','./models/agentComplete','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','queuesSummary','syncAgentConnect','bind','syncQueueCallerAbandon','syncAgentComplete','custom:queuesummary','hangup','syncHangup','syncNewExten','varset','queuestatuscomplete','loopClearZombieChannels','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice_queue:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','getSeconds','name','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','state','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','stringify','isTrunkReachable','active','SIP/%s','status','unmonitored','prototype','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','isArray','push','Action','command','iftime\x20%s,%s','true','catch','content','indexOf','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','loopCampaigns'];(function(_0x22fc04,_0x493931){var _0x669dbf=function(_0x453870){while(--_0x453870){_0x22fc04['push'](_0x22fc04['shift']());}};_0x669dbf(++_0x493931);}(_0x04e2,0x17f));var _0x204e=function(_0x538d51,_0x162eb7){_0x538d51=_0x538d51-0x0;var _0x268f99=_0x04e2[_0x538d51];return _0x268f99;};'use strict';var util=require(_0x204e('0x0'));var _=require(_0x204e('0x1'));var uuid=require(_0x204e('0x2'));var moment=require('moment');var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x204e('0x3'));var hopperUtils=require('./utils/hopper');var ut=require(_0x204e('0x4'));var config=require(_0x204e('0x5'));var logger=require(_0x204e('0x6'))(_0x204e('0x7'));var loggerBooked=require(_0x204e('0x6'))('booked');var loggerPredictive=require(_0x204e('0x6'))(_0x204e('0x8'));var loggerPredictiveCalls=require(_0x204e('0x6'))(_0x204e('0x9'));var loggerSyncQueueSummary=require(_0x204e('0x6'))(_0x204e('0xa'));var ami=require(_0x204e('0xb'));config[_0x204e('0xc')]=_[_0x204e('0xd')](config[_0x204e('0xc')],{'host':_0x204e('0xe'),'port':0x18eb});var io=require(_0x204e('0xf'))(new Redis(config['redis']));var cmHopper=require(_0x204e('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x204e('0x11'));var Interval=require('../rpc/interval');var Action=require(_0x204e('0x12'));var History=require(_0x204e('0x13'));var Final=require(_0x204e('0x14'));var AgentComplete=require(_0x204e('0x15'));var QueueCallerAbandon=require('./models/queueCallerAbandon');var Hangup=require(_0x204e('0x16'));var ipAgi=process[_0x204e('0x17')][_0x204e('0x18')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x204e('0x19')]=function(_0x1a195b){this['tail']=this[_0x204e('0x1a')]?this[_0x204e('0x1a')][_0x204e('0x1b')](_0x1a195b):_0x1a195b();};function Dialer(_0x241e39,_0x4337b7){this[_0x204e('0x1c')]=new Sequence();this[_0x204e('0x1d')]=_0x4337b7;this['voiceQueues']=_0x241e39[_0x204e('0x1e')];this[_0x204e('0x1f')]=_0x241e39[_0x204e('0x1f')];this[_0x204e('0x20')]=_0x241e39[_0x204e('0x20')];this[_0x204e('0x21')]=_0x241e39['trunks'];this[_0x204e('0x22')]=config[_0x204e('0x22')]||0x2;this[_0x204e('0x23')]={};this['actions']={};this['contactsId']={};this[_0x204e('0x24')]={};this[_0x204e('0x25')]={};this[_0x204e('0x26')]={};this[_0x204e('0x27')]={};this[_0x204e('0x28')]={};this[_0x204e('0x29')]={};this[_0x204e('0x2a')]={};this[_0x204e('0x2b')]={};ami['on']('agentconnect',this[_0x204e('0x2c')][_0x204e('0x2d')](this));ami['on']('queuecallerabandon',this[_0x204e('0x2e')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x204e('0x2d')](this));ami['on']('agentcomplete',this[_0x204e('0x2f')][_0x204e('0x2d')](this));ami['on'](_0x204e('0x30'),this[_0x204e('0xa')]['bind'](this));ami['on']('custom:queuesummarycomplete',this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0x204e('0x31'),this[_0x204e('0x32')][_0x204e('0x2d')](this));ami['on']('newexten',this[_0x204e('0x33')][_0x204e('0x2d')](this));ami['on'](_0x204e('0x34'),this['syncVarSet'][_0x204e('0x2d')](this));ami['on']('queuemember',this['syncQueueMember'][_0x204e('0x2d')](this));ami['on'](_0x204e('0x35'),this['syncQueueStatusComplete'][_0x204e('0x2d')](this));this['loopCampaigns']();this[_0x204e('0x36')]();RpcSetting['getSettings']()[_0x204e('0x37')](function(_0x819155){previewRecallmeReminderInterval=_0x819155[_0x204e('0x38')];});}function isNotNull(_0x3e9796){return _0x3e9796!==null&&!_[_0x204e('0x39')](_0x3e9796);}function msgResponse(_0x338bdb,_0x7b20ed,_0xd6aa31){return{'action':_0x338bdb,'response':_0x7b20ed,'message':_0xd6aa31,'stack':_0xd6aa31};}function emit(_0xf5674a,_0x46e5fe,_0x577a7a){io['to'](_0xf5674a)[_0x204e('0x3a')](_0x46e5fe,_0x577a7a);}function emitOutboundVoiceQueueSummary(_0x4c3969){if(_0x4c3969[_0x204e('0x3b')]===_0x204e('0x3c')){logger[_0x204e('0x3d')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x204e('0x3e')](_0x4c3969,{'showHidden':![],'depth':null}));emit(util[_0x204e('0x3f')]('voice:queue:%s',_0x4c3969['name']),_0x204e('0x40'),_0x4c3969);}}function checkGetDataPredictive(_0x229cd9){if(isNotNull(_0x229cd9)&&!_['isEmpty'](_0x229cd9)){loggerPredictive['info'](_0x204e('0x41'));loggerPredictive[_0x204e('0x42')](_0x204e('0x43'),_0x229cd9[_0x204e('0x44')]);loggerPredictive[_0x204e('0x42')](_0x204e('0x45'),_0x229cd9[_0x204e('0x46')]);loggerPredictive['info'](_0x204e('0x47'),_0x229cd9[_0x204e('0x48')]);loggerPredictive[_0x204e('0x42')](_0x204e('0x49'),_0x229cd9[_0x204e('0x4a')]);loggerPredictive['info'](_0x204e('0x4b'),_0x229cd9[_0x204e('0x4c')]);loggerPredictive[_0x204e('0x42')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x229cd9['predictiveIntervalAvgTalktime']);loggerPredictive[_0x204e('0x42')](_0x204e('0x4d'));if(_0x229cd9['predictiveIntervalTotalCalls']>0x0){if(!_['isUndefined'](_0x229cd9['predictiveIntervalAvgTalktime'])&&_0x229cd9['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x204e('0x42')](_0x204e('0x4e'));if(!_[_0x204e('0x39')](_0x229cd9[_0x204e('0x4c')])&&_0x229cd9[_0x204e('0x4c')]>0x0){return!![];}loggerPredictive[_0x204e('0x42')](_0x204e('0x4f'));}else{loggerPredictive['info'](_0x204e('0x50'));}}else{loggerPredictive['info'](_0x204e('0x51'));}return![];}function mergeDataErlangB(_0x328194){return function(_0x3564e2){loggerPredictive[_0x204e('0x42')](_0x204e('0x52'));loggerPredictive[_0x204e('0x42')](_0x204e('0x53'),_0x3564e2[_0x204e('0x54')]);loggerPredictive['info'](_0x204e('0x55'),_0x3564e2['erlangCallToSecond']);loggerPredictive['info'](_0x204e('0x56'),_0x3564e2[_0x204e('0x57')]);loggerPredictive[_0x204e('0x42')](_0x204e('0x58'),_0x3564e2[_0x204e('0x59')]);loggerPredictive[_0x204e('0x42')](_0x204e('0x56'),_0x3564e2[_0x204e('0x57')]);loggerPredictive[_0x204e('0x42')](_0x204e('0x4d'));_['merge'](_0x328194,_0x3564e2);};}function ifInterval(_0x2c900b,_0x48ed99){if(_['isUndefined'](_0x48ed99)){return![];}return utils[_0x204e('0x5a')](undefined,_0x48ed99)<_0x2c900b*0x3c;}function clearPredictiveAttributes(_0x275a7c){if(_0x275a7c[_0x204e('0x27')]){_0x275a7c[_0x204e('0x27')]=undefined;loggerPredictive['debug'](_0x275a7c[_0x204e('0x5b')],_0x204e('0x5c'));}if(_0x275a7c[_0x204e('0x26')]){_0x275a7c[_0x204e('0x26')]=undefined;loggerPredictive[_0x204e('0x3d')](_0x275a7c[_0x204e('0x5b')],_0x204e('0x5d'));}if(_0x275a7c[_0x204e('0x5e')]){clearInterval(_0x275a7c[_0x204e('0x5e')]);_0x275a7c[_0x204e('0x5e')]=undefined;loggerPredictive[_0x204e('0x3d')](_0x275a7c[_0x204e('0x5b')],_0x204e('0x5f'));}}function loggerCatchPredictive(_0x5ec3e3,_0x2ddae1){return function(_0x188ade){loggerPredictive[_0x204e('0x60')](_0x2ddae1[_0x204e('0x5b')],_0x5ec3e3);loggerPredictive[_0x204e('0x60')](_0x188ade[_0x204e('0x61')]);clearPredictiveAttributes(_0x2ddae1);};}function loggerCatch(_0x5df305){return function(_0x48d94f){logger[_0x204e('0x60')](_0x5df305,util['inspect'](_0x48d94f,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x44d93c,_0x467d97,_0x439b50){return function(_0x344329){utils[_0x204e('0x62')](_0x467d97,_0x439b50,0x0);_0x467d97[_0x204e('0x63')]=0x0;logger[_0x204e('0x60')](_0x44d93c,util['inspect'](_0x344329,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x4e6e17){return function(_0x2d5a25){if(isNotNull(_0x2d5a25)&&isNotNull(_0x2d5a25[0x0])){if(_0x2d5a25[0x0]['contactsRescheduled']>0x0){_0x4e6e17[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x66')];logger[_0x204e('0x42')](_0x204e('0x67')+_0x4e6e17[_0x204e('0x5b')],_0x2d5a25[0x0][_0x204e('0x68')],_0x204e('0x69'));}else{_0x4e6e17[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x6a')];logger[_0x204e('0x42')]('[getContactDialer2][Empty]'+_0x4e6e17[_0x204e('0x5b')]);}}};}function createObjHistory(_0x5f3e0b,_0x8eb107,_0x3699be,_0x20276c,_0x23a6b8){_0x5f3e0b[_0x204e('0x64')]=_0x3699be;var _0x247235=new Action(_0x5f3e0b,_0x8eb107);var _0x14b8bd=new History(_0x247235);_0x14b8bd[_0x204e('0x6b')]=_0x20276c;_0x14b8bd['statedesc']=_0x23a6b8;_0x14b8bd[_0x204e('0x6c')]=_0x247235[_0x204e('0x6d')];return _0x14b8bd;}function unlockQueueStatus(_0x5c7931,_0x42317a){setTimeout(function(){if(_[_0x204e('0x39')](_0x5c7931['queueStatusComplete'])){loggerBooked[_0x204e('0x60')](_0x204e('0x6e'),_0x42317a);}_0x5c7931[_0x204e('0x6f')]=!![];loggerBooked[_0x204e('0x42')]('[booked][unlockQueueStatus]',_0x42317a,JSON['stringify'](_[_0x204e('0x70')](_0x5c7931,[_0x204e('0x5b'),_0x204e('0x6f')])));},0x1f3);}function checkInterval(_0x1557e4){return function(){if(!isNotNull(_0x1557e4[_0x204e('0x71')])){_0x1557e4['message']=utils[_0x204e('0x65')][_0x204e('0x72')];throw _0x1557e4['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1557e4['Interval']['Intervals'])){_0x1557e4[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x72')];throw _0x1557e4[_0x204e('0x5b')]+_0x204e('0x73');}if(!isNotNull(_[_0x204e('0x74')](_0x1557e4[_0x204e('0x71')]['Intervals']))){_0x1557e4[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x72')];throw _0x1557e4['name']+_0x204e('0x73');}};}function checkIsIVRCampaignActive(_0x291f5b){return function(){if(!utils[_0x204e('0x75')](_0x291f5b)){_0x291f5b[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x76')];throw _0x291f5b[_0x204e('0x5b')]+_0x204e('0x77');}};}function emitCampaignSummary(_0xd144fc){if(utils[_0x204e('0x78')](_0xd144fc)){emit(util[_0x204e('0x3f')](_0x204e('0x79'),_0xd144fc['name']),_0x204e('0x7a'),_0xd144fc);}}function loggerCatchQueueSummary(_0x2e1386,_0xaad6bb){return function(_0x318623){clearPredictiveAttributes(_0xaad6bb);emitCampaignSummary(_0xaad6bb);loggerSyncQueueSummary['debug'](_0x2e1386,util[_0x204e('0x3e')](_0x318623,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x50d45a){if(_0x50d45a[_0x204e('0x7b')]){if(_0x50d45a['originated']===0x0){_0x50d45a['sendMessageOneNotActive']=![];_0x50d45a['message']=utils[_0x204e('0x65')]['INACTIVE'];loggerSyncQueueSummary[_0x204e('0x3d')](_0x204e('0x7c'),_0x50d45a[_0x204e('0x5b')],_0x204e('0x7d'));}else{_0x50d45a[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x7e')];loggerSyncQueueSummary[_0x204e('0x3d')](_0x204e('0x7c'),_0x50d45a['name'],_0x204e('0x7f'));}emitCampaignSummary(_0x50d45a);}}function myreject(_0x51773d){return function(_0x4e4353){return _0x51773d(msgResponse('[ifTime][Action]',_0x204e('0x80'),JSON[_0x204e('0x81')](_0x4e4353)));};}Dialer['prototype'][_0x204e('0x82')]=function(_0x483000){return!_[_0x204e('0x39')](_0x483000)&&_0x483000&&!_['isUndefined'](_0x483000[_0x204e('0x5b')])&&!_['isUndefined'](_0x483000[_0x204e('0x83')])&&_0x483000['active']&&(this[_0x204e('0x21')][util[_0x204e('0x3f')](_0x204e('0x84'),_0x483000['name'])][_0x204e('0x85')]==='reachable'||this['trunks'][util[_0x204e('0x3f')](_0x204e('0x84'),_0x483000[_0x204e('0x5b')])][_0x204e('0x85')]===_0x204e('0x86'));};Dialer[_0x204e('0x87')][_0x204e('0x88')]=function(_0x52b716){var _0x31a747=this;return function(){if(!_0x31a747[_0x204e('0x82')](_0x52b716[_0x204e('0x89')])){if(!_0x31a747[_0x204e('0x82')](_0x52b716['TrunkBackup'])){_0x52b716[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x8a')];throw _0x52b716[_0x204e('0x5b')]+_0x204e('0x8b');}}};};Dialer['prototype'][_0x204e('0x8c')]=function(_0x2146b7,_0x4ac749,_0x5bab0c,_0x2bc657){var _0x42cc17=this;return function(){var _0xef8f7=!![];return _0x42cc17['ifTimeIvr'](_0x2146b7,_0x4ac749,_0x5bab0c,_0x2bc657,_0xef8f7);};};Dialer[_0x204e('0x87')][_0x204e('0x8d')]=function(_0x43ff60,_0x34962c,_0x9978c1,_0x80e669){var _0x35879d=this;return function(){var _0x482f6c=![];return _0x35879d[_0x204e('0x8e')](_0x43ff60['Intervals'],_0x34962c,_0x9978c1,_0x80e669,_0x482f6c);};};Dialer['prototype']['ifTimeIvr']=function(_0x131990,_0x5e01f8,_0x36f3f2,_0x333c86,_0x5c2b69){var _0x26733b=[];return new Promise(function(_0x2f9fcf,_0x303c01){if(!isNotNull(_0x131990)){_0x333c86[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x72')];return _0x303c01(msgResponse(_0x204e('0x8f'),'Failure',_0x36f3f2+_0x204e('0x90')));}if(_['isEmpty'](_0x131990)){_0x333c86[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x91')];return _0x303c01(msgResponse(_0x204e('0x8f'),_0x204e('0x92'),_0x36f3f2+_0x204e('0x93')));}if(_0x5e01f8&&_['isUndefined'](config['timezones'][_0x5e01f8])){_0x333c86[_0x204e('0x64')]=utils[_0x204e('0x65')]['UNKNOWN_TIMEZONE'];return _0x303c01(msgResponse(_0x204e('0x8f'),'Failure',_0x36f3f2+_0x204e('0x94')+_0x5e01f8));}if(_[_0x204e('0x95')](_0x131990)){for(var _0x2ed661=0x0;_0x2ed661<_0x131990['length'];_0x2ed661+=0x1){_0x26733b[_0x204e('0x96')](ami[_0x204e('0x97')]({'action':_0x204e('0x98'),'command':util[_0x204e('0x3f')](_0x204e('0x99'),_0x131990[_0x2ed661]['interval'],!_[_0x204e('0x39')](config['timezones'][_0x5e01f8])?_0x5e01f8:'')})[_0x204e('0x37')](function(_0x6f086b){return _0x6f086b['content']['indexOf'](_0x204e('0x9a'))>=0x0;})[_0x204e('0x9b')](myreject(_0x303c01)));}}else{_0x26733b[_0x204e('0x96')](ami[_0x204e('0x97')]({'action':_0x204e('0x98'),'command':util['format'](_0x204e('0x99'),_0x131990,!_[_0x204e('0x39')](config['timezones'][_0x5e01f8])?_0x5e01f8:'')})[_0x204e('0x37')](function(_0x684de7){return _0x684de7[_0x204e('0x9c')][_0x204e('0x9d')](_0x204e('0x9a'))>=0x0;})[_0x204e('0x9b')](myreject(_0x303c01)));}Promise['all'](_0x26733b)[_0x204e('0x37')](function(_0x169b05){var _0x41f414=_['some'](_0x169b05);if(_0x41f414){return _0x2f9fcf(_0x41f414);}else{_0x333c86[_0x204e('0x64')]=_0x5c2b69?utils['CAMPAIGN_STATUS'][_0x204e('0x9e')]:utils[_0x204e('0x65')][_0x204e('0x9f')];return _0x303c01(msgResponse(_0x204e('0xa0'),_0x204e('0x92'),_0x204e('0xa1')+_0x5c2b69+'\x20'+_0x36f3f2+'\x20Interval\x20is\x20overtime:\x20'+util[_0x204e('0x3e')](_0x131990,{'showHidden':![],'depth':null})+_0x204e('0xa2')+_0x5e01f8));}})['catch'](function(_0x43e574){return _0x303c01(msgResponse(_0x204e('0x8f'),_0x204e('0x92'),JSON[_0x204e('0x81')](_0x43e574)));});});};Dialer[_0x204e('0x87')][_0x204e('0xa3')]=function(){var _0x105763=this;return cmHopper[_0x204e('0xa4')]({'active':![]},{'where':{'active':!![]}})[_0x204e('0x37')](function(){setInterval(function(){_0x105763[_0x204e('0xa5')]();},0x3e8);});};Dialer[_0x204e('0x87')][_0x204e('0xa5')]=function(){var _0x57229e=this;var _0x3b126c;for(var _0xd5aa75 in this[_0x204e('0x1f')]){if(typeof this[_0x204e('0x1f')][_0xd5aa75]!==_0x204e('0xa6')){_0x3b126c=this['campaigns'][_0xd5aa75];if(utils[_0x204e('0x78')](_0x3b126c)&&utils['isIVRCampaignActive'](_0x3b126c)){_0x3b126c[_0x204e('0x7b')]=!![];Promise['resolve']()[_0x204e('0x37')](checkIsIVRCampaignActive(_0x3b126c))[_0x204e('0x37')](checkInterval(_0x3b126c))['then'](_0x57229e[_0x204e('0x88')](_0x3b126c))[_0x204e('0x37')](_0x57229e[_0x204e('0x8c')](_0x3b126c[_0x204e('0xa7')],_0x3b126c[_0x204e('0xa8')],_0x3b126c[_0x204e('0x5b')],_0x3b126c))[_0x204e('0x37')](_0x57229e[_0x204e('0x8d')](_0x3b126c[_0x204e('0x71')],_0x3b126c[_0x204e('0xa8')],_0x3b126c[_0x204e('0x5b')],_0x3b126c))[_0x204e('0x37')](_0x57229e['launchHandleIvr'](_0x3b126c))[_0x204e('0x9b')](loggerCatchQueueSummary(_0x204e('0xa9'),_0x3b126c));}else{notSendMessagesCampaign(_0x3b126c);}}}};Dialer[_0x204e('0x87')][_0x204e('0xaa')]=function(_0x13b6d8){if(_0x13b6d8['dialMethod']!==_0x204e('0x8')){clearPredictiveAttributes(_0x13b6d8);}switch(_0x13b6d8[_0x204e('0xab')]){case _0x204e('0xac'):this[_0x204e('0xad')](_0x13b6d8,0x1);break;case'power':this[_0x204e('0xad')](_0x13b6d8,_0x13b6d8['dialPowerLevel']);break;case'predictive':this[_0x204e('0x8')](_0x13b6d8);break;case'booked':this['handlePower'](_0x13b6d8,0x1);break;default:logger[_0x204e('0x60')](_0x204e('0xae'),_0x13b6d8[_0x204e('0x5b')],_0x204e('0xaf'));}};Dialer['prototype'][_0x204e('0x8f')]=function(_0x457075,_0x5cd67e){var _0x4b3623=_0x457075[_0x204e('0xa8')];var _0x52c4c4=_0x5cd67e?_0x457075[_0x204e('0xa7')]:_0x457075[_0x204e('0x71')][_0x204e('0xb0')];logger['silly'](_0x204e('0xb1'),_0x52c4c4,_0x4b3623,_0x457075[_0x204e('0x5b')],util[_0x204e('0x3f')](_0x204e('0xb2'),_0x457075['name'],_0x457075['id']));var _0x471175=null;return Interval[_0x204e('0xb3')](_0x52c4c4,_0x4b3623)[_0x204e('0x37')](function(_0x105039){if(_0x105039===!![]){return _0x105039;}else{_0x457075['message']=_0x5cd67e?utils[_0x204e('0x65')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x204e('0x65')][_0x204e('0x9f')];_0x471175=msgResponse(_0x204e('0xa0'),'Failure','Global:\x20'+_0x5cd67e+'\x20'+_0x457075[_0x204e('0x5b')]+_0x204e('0xb4')+util[_0x204e('0x3e')](_0x52c4c4,{'showHidden':![],'depth':null})+_0x204e('0xa2')+_0x4b3623);}if(_0x471175!==null){logger['silly']('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x471175);_0x471175[_0x204e('0xb5')]=_0x5cd67e;throw _0x471175;}})[_0x204e('0x9b')](function(_0x26f958){logger['error'](_0x204e('0xb6'),_0x26f958);throw msgResponse('[ifTime][Action]','Error',util['inspect'](_0x26f958,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x1dcdde){if(this[_0x204e('0x1e')][_0x1dcdde[_0x204e('0xb7')]]){if(this[_0x204e('0x24')][_0x1dcdde['uniqueid']]&&this[_0x204e('0x24')][_0x1dcdde['uniqueid']][_0x204e('0x3b')]!=='ivr'){this[_0x204e('0xb8')](this[_0x204e('0x1e')][_0x1dcdde[_0x204e('0xb7')]]);this['uniqueId'][_0x1dcdde[_0x204e('0xb9')]][_0x204e('0xba')]=moment()['format'](_0x204e('0xbb'));}}};Dialer[_0x204e('0x87')][_0x204e('0x2f')]=function(_0x3a050f){var _0x431ddf=this[_0x204e('0x24')][_0x3a050f[_0x204e('0xb9')]];if(this[_0x204e('0x1e')][_0x3a050f['queue']]){if(_0x431ddf&&_0x431ddf['type']!==_0x204e('0xbc')){delete this[_0x204e('0x24')][_0x3a050f[_0x204e('0xb9')]];this[_0x204e('0x1e')][_0x3a050f[_0x204e('0xb7')]]['outboundAnswerCallsDay']+=0x1;var _0x29a7d4=new AgentComplete(_0x431ddf,_0x3a050f);if(_0x3a050f[_0x204e('0xbd')]==='agent'){_0x29a7d4[_0x204e('0xbe')]=this[_0x204e('0x1e')][_0x3a050f['queue']]['dialQueueProject2']&&this[_0x204e('0x1e')][_0x3a050f[_0x204e('0xb7')]]['dialAgiAfterHangupAgent']?moment()[_0x204e('0x3f')](_0x204e('0xbb')):undefined;}hopperUtils['createHistory'](_0x29a7d4)[_0x204e('0x9b')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils[_0x204e('0xbf')](_0x29a7d4)[_0x204e('0x9b')](loggerCatch(_0x204e('0xc0')));}}};Dialer[_0x204e('0x87')][_0x204e('0x2e')]=function(_0x416080){var _0x29156e=this[_0x204e('0x24')][_0x416080[_0x204e('0xb9')]];var _0x589c78=this;var _0x60a6ae=![];var _0x5bb2ab;var _0x4d57b8;if(this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]]){if(_0x29156e&&_0x29156e[_0x204e('0x3b')]!==_0x204e('0xbc')){delete this[_0x204e('0x24')][_0x416080[_0x204e('0xb9')]];this['updateOriginated'](this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]]);_0x29156e[_0x204e('0xc1')]=moment()[_0x204e('0x3f')](_0x204e('0xbb'));var _0x50c28a=new QueueCallerAbandon(_0x29156e,_0x416080);if(utils[_0x204e('0x5a')](_0x29156e[_0x204e('0xc1')],_0x29156e[_0x204e('0xc2')])>=_0x29156e[_0x204e('0xc3')]){this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0x48')]+=0x1;this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xc4')]+=0x1;this['voiceQueues'][_0x416080[_0x204e('0xb7')]][_0x204e('0xc5')]+=0x1;_0x50c28a[_0x204e('0x6b')]=0xa;_0x50c28a[_0x204e('0xc6')]=_0x204e('0xc7');_0x50c28a[_0x204e('0xc8')]='TIMEOUT';_0x50c28a[_0x204e('0xbe')]=this[_0x204e('0x1e')][_0x416080['queue']][_0x204e('0xc9')]?moment()[_0x204e('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x50c28a[_0x204e('0xca')]+=0x1;_0x50c28a['countglobal']+=0x1;_0x5bb2ab=this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xcb')];_0x4d57b8=this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xcc')];hopperUtils[_0x204e('0xcd')](_0x50c28a,_0x50c28a['state'],_0x29156e['voiceQueue'])[_0x204e('0x37')](function(_0x422b22){_0x60a6ae=_0x422b22[_0x204e('0xce')]==0x1;if(_0x50c28a['countdropretry']>=_0x589c78[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xcf')]){_0x589c78[_0x204e('0xd0')](_0x50c28a,_0x422b22[_0x204e('0xce')]);}else{hopperUtils[_0x204e('0xd1')]({'active':![],'countdropretry':_0x50c28a[_0x204e('0xca')],'scheduledat':moment()[_0x204e('0xd2')](_0x589c78[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xcb')],_0x204e('0xd3'))[_0x204e('0x3f')](_0x204e('0xbb')),'ContactId':_0x29156e[_0x204e('0xd4')],'ListId':_0x29156e[_0x204e('0xd5')],'VoiceQueueId':_0x29156e[_0x204e('0xd6')]||undefined,'CampaignId':_0x29156e['CampaignId']||undefined})[_0x204e('0x9b')](loggerCatch('[rescheduleContact][Drop]'));var _0x2d496c=new History(_0x50c28a);_0x2d496c[_0x204e('0x6b')]=0xa;_0x2d496c[_0x204e('0xc6')]='Drop';_0x2d496c[_0x204e('0x6d')]=moment()['format'](_0x204e('0xbb'));_0x2d496c['endtime']=_0x2d496c[_0x204e('0x6d')];_0x2d496c['calleridname']=_0x50c28a[_0x204e('0xd7')];_0x2d496c[_0x204e('0xd8')]=_0x50c28a['calleridnum'];hopperUtils[_0x204e('0xd9')](_0x2d496c)[_0x204e('0x9b')](loggerCatch(_0x204e('0xda')));}})[_0x204e('0x37')](function(){if(_0x60a6ae)hopperUtils[_0x204e('0xdb')](_0x50c28a,_0x5bb2ab,_0x4d57b8)[_0x204e('0x37')](function(){return 0x1;});});}else{this['voiceQueues'][_0x416080[_0x204e('0xb7')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this['voiceQueues'][_0x416080[_0x204e('0xb7')]][_0x204e('0xdc')]+=0x1;_0x50c28a[_0x204e('0x6b')]=0xb;_0x50c28a[_0x204e('0xc6')]=_0x204e('0xdd');_0x50c28a[_0x204e('0xc8')]='CALLEREXIT';_0x50c28a[_0x204e('0xde')]+=0x1;_0x50c28a[_0x204e('0xdf')]+=0x1;_0x5bb2ab=this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xe0')];_0x4d57b8=this[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x50c28a,_0x50c28a[_0x204e('0x6b')],_0x29156e[_0x204e('0xe1')])[_0x204e('0x37')](function(_0x11ce59){if(_0x50c28a[_0x204e('0xde')]>=_0x589c78[_0x204e('0x1e')][_0x416080[_0x204e('0xb7')]][_0x204e('0xe2')]){_0x589c78[_0x204e('0xd0')](_0x50c28a,_0x11ce59[_0x204e('0xce')]);}else{hopperUtils[_0x204e('0xd1')]({'active':![],'countabandonedretry':_0x50c28a[_0x204e('0xde')],'scheduledat':moment()['add'](_0x589c78['voiceQueues'][_0x416080['queue']][_0x204e('0xe0')],_0x204e('0xd3'))[_0x204e('0x3f')](_0x204e('0xbb')),'ContactId':_0x29156e[_0x204e('0xd4')],'ListId':_0x29156e[_0x204e('0xd5')],'VoiceQueueId':_0x29156e[_0x204e('0xd6')]||undefined,'CampaignId':_0x29156e[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch(_0x204e('0xe4')));var _0x27e78e=new History(_0x50c28a);_0x27e78e[_0x204e('0x6b')]=0xb;_0x27e78e[_0x204e('0xc6')]='Abandoned';_0x27e78e[_0x204e('0x6d')]=moment()[_0x204e('0x3f')](_0x204e('0xbb'));_0x27e78e[_0x204e('0x6c')]=_0x27e78e[_0x204e('0x6d')];_0x27e78e[_0x204e('0xd7')]=_0x50c28a[_0x204e('0xd7')];_0x27e78e[_0x204e('0xd8')]=_0x50c28a['calleridnum'];hopperUtils[_0x204e('0xd9')](_0x27e78e)['catch'](loggerCatch(_0x204e('0xe5')));}})[_0x204e('0x37')](function(){if(_0x60a6ae)hopperUtils[_0x204e('0xdb')](_0x50c28a,_0x5bb2ab,_0x4d57b8)[_0x204e('0x37')](function(){return 0x1;});});}}}};Dialer[_0x204e('0x87')][_0x204e('0x33')]=function(_0x46f407){if(this[_0x204e('0xe6')][_0x46f407[_0x204e('0xb9')]]){this[_0x204e('0xe6')][_0x46f407[_0x204e('0xb9')]][_0x204e('0xe7')]=_0x46f407[_0x204e('0xe7')];}if(this[_0x204e('0x24')][_0x46f407[_0x204e('0xb9')]]){this['uniqueId'][_0x46f407['uniqueid']][_0x204e('0xe7')]=_0x46f407['channel'];}};Dialer[_0x204e('0x87')][_0x204e('0xe8')]=function(_0x3c0ca2){if(!this['actions'][_0x3c0ca2[_0x204e('0xe9')]]){return;}var _0x59ea99=this[_0x204e('0x1e')][this[_0x204e('0xe6')][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xb7')]][_0x204e('0xea')]||_0x204e('0xeb');if(_0x59ea99===_0x204e('0xec')){if(this['actions'][_0x3c0ca2['actionid']]&&_['isNil'](this[_0x204e('0xe6')][_0x3c0ca2['actionid']][_0x204e('0xed')])&&_0x3c0ca2['status']==='1'&&_0x3c0ca2[_0x204e('0xee')]==='0'){if(this['agents'][_0x3c0ca2[_0x204e('0xef')]]){if(!this[_0x204e('0x20')][_0x3c0ca2[_0x204e('0xef')]]['locked']){this[_0x204e('0x20')][_0x3c0ca2[_0x204e('0xef')]][_0x204e('0xed')]=!![];this['actions'][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xed')]=!![];this[_0x204e('0xe6')][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xef')]=_0x3c0ca2[_0x204e('0xef')];}}}}else if(_0x59ea99===_0x204e('0xeb')){if(this[_0x204e('0xe6')][_0x3c0ca2[_0x204e('0xe9')]]){if(this['agents'][_0x3c0ca2[_0x204e('0xef')]]){this[_0x204e('0xe6')][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xef')]=_0x3c0ca2[_0x204e('0xef')];if(_['isNil'](this[_0x204e('0x29')][this[_0x204e('0xe6')][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xb7')]])){this[_0x204e('0x29')][this['actions'][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xb7')]]=[];}this[_0x204e('0x29')][this[_0x204e('0xe6')][_0x3c0ca2[_0x204e('0xe9')]][_0x204e('0xb7')]][_0x204e('0x96')](_[_0x204e('0xf0')](_['pick'](this[_0x204e('0xe6')][_0x3c0ca2['actionid']],[_0x204e('0xf1'),'stateinterface']),{'status':_0x3c0ca2['status'],'paused':_0x3c0ca2[_0x204e('0xee')]}));}}}};Dialer[_0x204e('0x87')]['syncQueueStatusComplete']=function(_0x5097f6){if(!this['actions'][_0x5097f6[_0x204e('0xe9')]]){return;}var _0x4ca036=this;var _0x5ecf44=this[_0x204e('0x1e')][this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xb7')]];var _0x1024da=_0x5ecf44['strategy']||'rrmemory';if(_0x1024da===_0x204e('0xec')){if(this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]]&&this['actions'][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xef')]){this[_0x204e('0x1d')]['run'](this[_0x204e('0xe6')][_0x5097f6['actionid']][_0x204e('0xf1')],this[_0x204e('0xe6')][_0x5097f6['actionid']]['stateinterface'])[_0x204e('0x9b')](function(_0x1b880d){logger[_0x204e('0x60')]('[Catch][Preview][syncQueueStatusComplete]',util[_0x204e('0x3e')](_0x1b880d,{'showHidden':![],'depth':null}));})[_0x204e('0x1b')](function(){_0x4ca036[_0x204e('0xb8')](_0x4ca036['voiceQueues'][_0x4ca036['actions'][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xb7')]]);_0x4ca036[_0x204e('0x20')][_0x4ca036[_0x204e('0xe6')][_0x5097f6['actionid']][_0x204e('0xef')]][_0x204e('0xed')]=![];delete _0x4ca036[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]];unlockQueueStatus(_0x5ecf44);});}else{this[_0x204e('0xb8')](this[_0x204e('0x1e')][this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xb7')]]);hopperUtils[_0x204e('0xd1')]({'active':![],'ContactId':this['actions'][_0x5097f6[_0x204e('0xe9')]]['ContactId'],'ListId':this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]]['ListId'],'VoiceQueueId':this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xd6')]||undefined,'CampaignId':this[_0x204e('0xe6')][_0x5097f6['actionid']]['CampaignId']||undefined})[_0x204e('0x9b')](loggerCatch(_0x204e('0xf2')));delete this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]];unlockQueueStatus(_0x5ecf44);}}else if(_0x1024da===_0x204e('0xeb')){var _0x20851e;if(this['actions'][_0x5097f6[_0x204e('0xe9')]]&&!_[_0x204e('0x74')](this[_0x204e('0x29')][this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xb7')]])){if(this[_0x204e('0x2a')][_0x4ca036[_0x204e('0xe6')][_0x5097f6['actionid']][_0x204e('0xb7')]]){this[_0x204e('0x2a')][_0x4ca036[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]]['queue']]=this[_0x204e('0x2a')][this['actions'][_0x5097f6[_0x204e('0xe9')]]['queue']]?this['queueBookedRR'][this[_0x204e('0xe6')][_0x5097f6['actionid']][_0x204e('0xb7')]]:this['queueBooked'][this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xb7')]]?this[_0x204e('0x29')][this[_0x204e('0xe6')][_0x5097f6['actionid']][_0x204e('0xb7')]][_0x204e('0xf3')]||0x0:0x0;}this[_0x204e('0x29')][this[_0x204e('0xe6')][_0x5097f6[_0x204e('0xe9')]][_0x204e('0xb7')]][_0x204e('0xf3')]=this[_0x204e('0x2a')][this['actions'][_0x5097f6['actionid']][_0x204e('0xb7')]];for(var _0x35e048=0x0;_0x35e048=_0x3a1fb9[_0x204e('0x11b')]){_0x29decb[_0x204e('0x11c')](_0x48e80e,_0x23e97b,_0x25349d,_0x204e('0x11d'));}else{if(_0x48e80e['countmachineretry']>=_0x3a1fb9[_0x204e('0x11e')]){_0x29decb['createStateFinal'](_0x48e80e,_0x23e97b,_0x25349d,_0x204e('0x11f'));}else{hopperUtils[_0x204e('0xd1')]({'active':![],'countmachineretry':_0x48e80e[_0x204e('0x114')],'scheduledat':moment()[_0x204e('0xd2')](_0x3a1fb9[_0x204e('0x120')],'minutes')[_0x204e('0x3f')](_0x204e('0xbb')),'ContactId':_0x48e80e['ContactId'],'ListId':_0x48e80e[_0x204e('0xd5')],'VoiceQueueId':_0x48e80e['VoiceQueueId']||undefined,'CampaignId':_0x48e80e[_0x204e('0xe3')]||undefined})['catch'](loggerCatch(_0x204e('0x121')));_0x23e97b({'reschedule':0x1});}}});}if(_0x2c6d32[_0x204e('0x3b')]===_0x204e('0xbc')&&this['campaigns'][_0x2c6d32[_0x204e('0xb7')]][_0x204e('0x106')]&&_0x13ef68[_0x204e('0x107')]===_0x204e('0x108')){delete this['uniqueId'][_0x13ef68['uniqueid']];this[_0x204e('0xb8')](this[_0x204e('0x1f')][_0x2c6d32[_0x204e('0xb7')]]);_0x586c0f=new Hangup(_0x2c6d32,_0x13ef68);_0x586c0f[_0x204e('0x6b')]=0x12;_0x586c0f['statedesc']=_0x204e('0x10a');_0x586c0f[_0x204e('0x10b')]='AMD';ami[_0x204e('0x3a')](_0x204e('0x10d'),ut[_0x204e('0x115')](_0x586c0f,_0x204e('0x10e')));this[_0x204e('0x10f')](_0x586c0f,_0x204e('0x122'),_0x204e('0x123'));}if(_0x2c6d32[_0x204e('0x3b')]===_0x204e('0xbc')&&this[_0x204e('0x1f')][_0x2c6d32[_0x204e('0xb7')]][_0x204e('0x106')]&&_0x13ef68[_0x204e('0x107')]==='MACHINE'){return new Promise(function(_0x83011e,_0x13a47a){delete _0x29decb[_0x204e('0x24')][_0x13ef68[_0x204e('0xb9')]];_0x29decb[_0x204e('0xb8')](_0x29decb[_0x204e('0x1f')][_0x2c6d32[_0x204e('0xb7')]]);_0x29decb['campaigns'][_0x2c6d32[_0x204e('0xb7')]][_0x204e('0x109')]+=0x1;_0x29decb['campaigns'][_0x2c6d32['queue']][_0x204e('0x124')]+=0x1;var _0x511965=_0x29decb[_0x204e('0x1f')][_0x2c6d32[_0x204e('0xb7')]];var _0x2a797d=new Hangup(_0x2c6d32,_0x13ef68);_0x2a797d['state']=0x13;_0x2a797d[_0x204e('0xc6')]=_0x204e('0x113');_0x2a797d[_0x204e('0x10b')]=_0x204e('0x10c');_0x2a797d['countmachineretry']+=0x1;_0x2a797d[_0x204e('0xdf')]+=0x1;_0x2a797d[_0x204e('0x10e')]=!![];ami[_0x204e('0x3a')](_0x204e('0x10d'),ut[_0x204e('0x115')](_0x2a797d,_0x204e('0x10e')));hopperUtils[_0x204e('0xd9')](_0x2a797d)[_0x204e('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2a797d[_0x204e('0x117')]+_0x2a797d[_0x204e('0x118')]+_0x2a797d[_0x204e('0x119')]+_0x2a797d[_0x204e('0x11a')]+_0x2a797d['countdropretry']+_0x2a797d[_0x204e('0xde')]+_0x2a797d[_0x204e('0x114')]+_0x2a797d[_0x204e('0x125')]>=_0x511965[_0x204e('0x11b')]){_0x29decb[_0x204e('0x11c')](_0x2a797d,_0x83011e,_0x13a47a,'reason19\x20machine....');}else{if(_0x2a797d[_0x204e('0x114')]>=_0x511965[_0x204e('0x11e')]){_0x29decb[_0x204e('0x126')](_0x2a797d,_0x83011e,_0x13a47a,_0x204e('0x11f'));}else{hopperUtils[_0x204e('0xd1')]({'active':![],'countmachineretry':_0x2a797d['countmachineretry'],'scheduledat':moment()[_0x204e('0xd2')](_0x511965[_0x204e('0x120')],_0x204e('0xd3'))[_0x204e('0x3f')](_0x204e('0xbb')),'ContactId':_0x2a797d[_0x204e('0xd4')],'ListId':_0x2a797d['ListId'],'VoiceQueueId':_0x2a797d[_0x204e('0xd6')]||undefined,'CampaignId':_0x2a797d[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch('[rescheduleContact][Machine]'));_0x83011e({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x204e('0x32')]=function(_0xa41983){var _0x54e6ba=this['uniqueId'][_0xa41983[_0x204e('0xb9')]];var _0x1bec05;if(_0x54e6ba&&_0x54e6ba[_0x204e('0x3b')]==='ivr'){delete this['uniqueId'][_0xa41983['uniqueid']];this['updateOriginated'](this['campaigns'][_0x54e6ba[_0x204e('0xb7')]]);this[_0x204e('0x1f')][_0x54e6ba[_0x204e('0xb7')]]['ivrAnswerCallsDay']+=0x1;_0x1bec05=new Hangup(_0x54e6ba,_0xa41983);hopperUtils['createHistory'](_0x1bec05)[_0x204e('0x9b')](loggerCatch(_0x204e('0x127')));hopperUtils[_0x204e('0xbf')](_0x1bec05)[_0x204e('0x9b')](loggerCatch(_0x204e('0x128')));}if(_0x54e6ba&&_0x54e6ba[_0x204e('0x3b')]!=='ivr'&&isNotNull(this[_0x204e('0x1e')][_0x54e6ba[_0x204e('0xb7')]][_0x204e('0x129')])){delete this[_0x204e('0x24')][_0xa41983[_0x204e('0xb9')]];this[_0x204e('0xb8')](this[_0x204e('0x1e')][_0x54e6ba['queue']]);this[_0x204e('0x1e')][_0x54e6ba[_0x204e('0xb7')]][_0x204e('0x109')]+=0x1;this['voiceQueues'][_0x54e6ba[_0x204e('0xb7')]][_0x204e('0x124')]+=0x1;_0x1bec05=new Hangup(_0x54e6ba,_0xa41983);_0x1bec05['state']=0x10;_0x1bec05[_0x204e('0xc6')]=_0x204e('0x12a');_0x1bec05[_0x204e('0x10b')]=_0x204e('0x12b');hopperUtils['createHistory'](_0x1bec05)[_0x204e('0x9b')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x204e('0xbf')](_0x1bec05)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x54e6ba&&_0x54e6ba[_0x204e('0x3b')]!==_0x204e('0xbc')&&!isNotNull(this[_0x204e('0x1e')][_0x54e6ba[_0x204e('0xb7')]][_0x204e('0x129')])){if(_0xa41983[_0x204e('0x12c')]==='Normal\x20Clearing'){delete this[_0x204e('0x24')][_0xa41983[_0x204e('0xb9')]];this[_0x204e('0x1e')][_0x54e6ba[_0x204e('0xb7')]]['outboundAnswerCallsDay']+=0x1;const _0xcad79d=new AgentComplete(_0x54e6ba,_0xa41983);_0xcad79d[_0x204e('0xe3')]=this[_0x204e('0x1e')][_0x54e6ba['queue']]['id'];hopperUtils[_0x204e('0xd9')](_0xcad79d)[_0x204e('0x9b')](loggerCatch(_0x204e('0x12d')));hopperUtils[_0x204e('0xbf')](_0xcad79d)[_0x204e('0x9b')](loggerCatch(_0x204e('0xc0')));}else{delete this[_0x204e('0x24')][_0xa41983[_0x204e('0xb9')]];this[_0x204e('0xb8')](this[_0x204e('0x1e')][_0x54e6ba[_0x204e('0xb7')]]);this['voiceQueues'][_0x54e6ba['queue']][_0x204e('0x12e')]+=0x1;_0x1bec05=new Hangup(_0x54e6ba,_0xa41983);_0x1bec05[_0x204e('0x6b')]=0xc;_0x1bec05['statedesc']=_0xa41983['cause-txt'];_0x1bec05[_0x204e('0x10b')]=_0x204e('0x12f');hopperUtils[_0x204e('0xd9')](_0x1bec05)['catch'](loggerCatch(_0x204e('0x127')));hopperUtils['moveContactManagedDialer'](_0x1bec05)[_0x204e('0x9b')](loggerCatch('[syncHangupIvr]'));}}};Dialer[_0x204e('0x87')][_0x204e('0xa')]=function(_0x129645){var _0x14570f=this;if(!_0x14570f[_0x204e('0x2b')][_0x129645[_0x204e('0x5b')]]){_0x14570f['queuesSummary'][_0x129645[_0x204e('0x5b')]]={'running':![]};}else if(_0x14570f[_0x204e('0x2b')][_0x129645[_0x204e('0x5b')]][_0x204e('0x130')]===!![]){return;}else if(_0x14570f[_0x204e('0x2b')][_0x129645[_0x204e('0x5b')]][_0x204e('0x130')]===![]){_0x14570f['queuesSummary'][_0x129645[_0x204e('0x5b')]][_0x204e('0x130')]=!![];}var _0x9b84c9=_0x14570f['voiceQueues'][_0x129645[_0x204e('0x5b')]];var _0x2fea17=_0x9b84c9[_0x204e('0x64')]!==utils[_0x204e('0x65')]['INACTIVE'];var _0xdb1c62=utils[_0x204e('0x131')](_0x9b84c9);_0x9b84c9[_0x204e('0x132')]=utils[_0x204e('0x133')](_0x9b84c9,_0x14570f[_0x204e('0x21')]);Promise[_0x204e('0x134')]()[_0x204e('0x37')](function(){if(_0x9b84c9[_0x204e('0x132')]===utils[_0x204e('0x65')][_0x204e('0x76')]){if(_0x2fea17){clearPredictiveAttributes(_0x9b84c9);_0x129645[_0x204e('0x26')]=undefined;_0x129645[_0x204e('0x27')]=undefined;}if(_0x9b84c9['statusMessage']===utils[_0x204e('0x65')]['INACTIVE']){_0x129645[_0x204e('0x135')]=0x0;_0x129645['paused']=0x0;_0x129645[_0x204e('0x136')]=0x0;_0x129645[_0x204e('0x137')]=0x0;_0x129645[_0x204e('0x138')]=0x0;}}else if(_0x9b84c9[_0x204e('0x132')]===utils[_0x204e('0x65')][_0x204e('0x139')]&&!_0xdb1c62){return _0x14570f[_0x204e('0x8f')](_0x9b84c9,!![])['then'](function(){return _0x14570f[_0x204e('0x8f')](_0x9b84c9,![]);})[_0x204e('0x37')](function(){return _0x14570f[_0x204e('0xaa')](_0x9b84c9);})[_0x204e('0x9b')](function(_0x378565){loggerSyncQueueSummary[_0x204e('0x3d')]('[syncQueueSummary]',util[_0x204e('0x3e')](_0x378565,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x9b84c9);});}else{clearPredictiveAttributes(_0x9b84c9);}})[_0x204e('0x37')](function(){var _0x413538=_0x129645[_0x204e('0x13a')](_0x9b84c9);if(_0x413538||_0x9b84c9['queueSummaryCountersUpdated']){_0x9b84c9[_0x204e('0x13b')]=![];_0x129645[_0x204e('0x13c')](_0x9b84c9);Object[_0x204e('0x13d')](_0x9b84c9,_0x129645);emitOutboundVoiceQueueSummary(_0x129645);}_0x14570f[_0x204e('0x2b')][_0x9b84c9[_0x204e('0x5b')]]['running']=![];})[_0x204e('0x9b')](function(_0x1449ad){logger[_0x204e('0x60')]('[syncQueueSummary]',util[_0x204e('0x3e')](_0x1449ad,{'showHidden':![],'depth':null}));_0x14570f[_0x204e('0x2b')][_0x9b84c9[_0x204e('0x5b')]][_0x204e('0x130')]=![];});};Dialer[_0x204e('0x87')][_0x204e('0x13e')]=_[_0x204e('0x13f')](function(){var _0x45569c=_[_0x204e('0x140')](this[_0x204e('0x1e')],function(_0x479e78){return _0x479e78[_0x204e('0x141')];});var _0x2c6086=_[_0x204e('0x140')](this[_0x204e('0x20')],function(_0x2856f9){return _0x2856f9[_0x204e('0x142')]&&_0x2856f9[_0x204e('0x85')]==='reachable';});if(_0x45569c[_0x204e('0xf4')]>0x0&&_0x2c6086[_0x204e('0xf4')]>0x0){return Promise['resolve']()['then'](cmHopper[_0x204e('0x143')](_[_0x204e('0x144')](_0x45569c,'id'),previewRecallmeReminderInterval,_[_0x204e('0x144')](_0x2c6086,'id')))[_0x204e('0x37')](function(_0x5a14a3){for(var _0x7da12d=0x0;_0x7da12d<_0x5a14a3[_0x204e('0xf4')];_0x7da12d++){var _0x2b5898=_0x5a14a3[_0x7da12d][_0x204e('0x145')][_0x204e('0x5b')];if(_0x2b5898)io['to'](util[_0x204e('0x3f')]('user:%s',_0x2b5898))['emit'](_0x204e('0x146'),{'hopper':_0x5a14a3[_0x7da12d]});}})[_0x204e('0x9b')](function(_0x12dfb0){logger[_0x204e('0x60')](_0x204e('0x147'),_0x12dfb0);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x204e('0x36')]=function(){var _0x351658=this;setInterval(function(){_0x351658['clearZombieChannels'](_0x351658[_0x204e('0x24')],'[uniqueid]');_0x351658[_0x204e('0x148')](_0x351658[_0x204e('0xe6')],_0x204e('0x149'));},0x32c8);};Dialer['prototype'][_0x204e('0x148')]=function(_0x584afc,_0x4bf12e){var _0x1c9812=this;for(var _0x482f25 in _0x584afc){if(typeof _0x584afc[_0x482f25]!=='undefined'){this[_0x204e('0x1c')][_0x204e('0x19')](function(){if(!_['isNil'](_0x584afc[_0x482f25])){return ami[_0x204e('0x97')]({'action':'status','channel':_0x584afc[_0x482f25][_0x204e('0xe7')]})[_0x204e('0x9b')](function(_0x2633d7){if(_0x2633d7['message']===_0x204e('0x14a')){setTimeout(function(){if(_0x584afc[_0x482f25]&&_0x584afc[_0x482f25][_0x204e('0x3b')]!==_0x204e('0xbc')){_0x1c9812['updateOriginated'](_0x1c9812[_0x204e('0x1e')][_0x584afc[_0x482f25][_0x204e('0xb7')]]);logger[_0x204e('0x60')](_0x204e('0x14b'),_0x4bf12e,_0x482f25,_0x584afc[_0x482f25][_0x204e('0xb7')]);delete _0x584afc[_0x482f25];}if(_0x584afc[_0x482f25]&&_0x584afc[_0x482f25][_0x204e('0x3b')]==='ivr'){_0x1c9812['updateOriginated'](_0x1c9812[_0x204e('0x1f')][_0x584afc[_0x482f25][_0x204e('0xb7')]]);logger[_0x204e('0x60')](_0x204e('0x14c'),_0x4bf12e,_0x482f25,_0x584afc[_0x482f25]['queue']);delete _0x584afc[_0x482f25];}},0x2328);}});}});}}};Dialer[_0x204e('0x87')][_0x204e('0x14d')]=function(_0x327382){return Promise[_0x204e('0x134')]()[_0x204e('0x37')](voiceQueueRt['getVoiceQueueRtPauses'](_0x327382))['catch'](loggerCatch(_0x204e('0x14e')));};Dialer[_0x204e('0x87')][_0x204e('0xb8')]=function(_0x4114ad){if(!_[_0x204e('0x39')](_0x4114ad)&&_0x4114ad!==null){if(typeof _0x4114ad[_0x204e('0x14f')]!=='undefined'){if(_0x4114ad[_0x204e('0x14f')]>0x0){_0x4114ad[_0x204e('0x14f')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x204e('0x60')](_0x204e('0x150'));}};Dialer[_0x204e('0x87')][_0x204e('0x151')]=function(_0x2ee68a,_0x3dc8ae){var _0x350298=this;return function(_0x294163){_0x350298[_0x204e('0xb8')](_0x3dc8ae);logger[_0x204e('0x60')](_0x2ee68a,util[_0x204e('0x3e')](_0x294163,{'showHidden':![],'depth':null}));};};Dialer[_0x204e('0x87')]['emptyContact']=function(_0x413f5a,_0x20abeb,_0x5b3f28){var _0x387d4f={'state':0x19,'statedesc':_0x204e('0x152')};this[_0x204e('0xb8')](_0x20abeb);this[_0x204e('0x10f')](_[_0x204e('0xf0')](_0x387d4f,_[_0x204e('0x70')](_0x5b3f28,[_0x204e('0xd4'),_0x204e('0xd5'),_0x204e('0x153'),_0x204e('0xd6'),_0x204e('0xe3')])),_0x204e('0x154'),_0x204e('0x155'));logger[_0x204e('0x60')](_0x413f5a);};Dialer[_0x204e('0x87')][_0x204e('0x10f')]=function(_0x3cce20,_0xa23ec9,_0x3eb24b){hopperUtils[_0x204e('0xd9')](_0x3cce20)[_0x204e('0x9b')](loggerCatch(_0xa23ec9));hopperUtils['moveContactManagedDialer'](_0x3cce20)[_0x204e('0x9b')](loggerCatch(_0x3eb24b));};Dialer[_0x204e('0x87')][_0x204e('0xd0')]=function(_0x4a5dd9,_0x5d2413){hopperUtils[_0x204e('0xd9')](_0x4a5dd9)[_0x204e('0x9b')](loggerCatch(_0x204e('0x12d')));if(_0x5d2413==0x0){hopperUtils['moveContactManagedDialer'](_0x4a5dd9)[_0x204e('0x9b')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x204e('0x87')]['checkPreviewRecallReminder']=function(_0x4939f6){return Promise[_0x204e('0x134')]()[_0x204e('0x37')](cmHopper['handlePreviewRecallNotifications'](_0x4939f6['id'],previewRecallmeReminderInterval))[_0x204e('0x37')](function(_0x1f0572){for(var _0xc15b72=0x0;_0xc15b72<_0x1f0572[_0x204e('0xf4')];_0xc15b72++){var _0x4700ca=_0x1f0572[_0xc15b72][_0x204e('0x145')][_0x204e('0x5b')];if(_0x4700ca)io['to'](util[_0x204e('0x3f')]('user:%s',_0x4700ca))[_0x204e('0x3a')]('user:dialPreviewRecallReminder',{'hopper':_0x1f0572[_0xc15b72]});}})['catch'](function(){});};Dialer[_0x204e('0x87')][_0x204e('0x156')]=function(_0x4266fe){var _0x2b02d2=this;return function(){_0x2b02d2[_0x204e('0x157')](_0x4266fe);};};Dialer['prototype'][_0x204e('0x158')]=function(_0x167de0,_0xba72cb){var _0x33a5fa=this;var _0x4d239e=uuid['v4']();this[_0x204e('0xe6')][_0x4d239e]=new Action(_0x167de0,_0xba72cb,_0x4d239e);return new Promise(function(_0x3e2107,_0x55de0f){if(_[_0x204e('0x39')](_0x167de0)&&typeof _0x167de0!==_0x204e('0x159')){return _0x55de0f(msgResponse(_0x204e('0x15a'),'Failure',_0x204e('0x15b')));}if(_[_0x204e('0x39')](_0xba72cb[_0x204e('0x15c')])||_0xba72cb['phone']===null){return _0x55de0f(msgResponse('originate',_0x204e('0x92'),_0x204e('0x15d')));}var _0x4eea42={'XMD-CALLERID':_0x33a5fa['actions'][_0x4d239e][_0x204e('0x15e')](),'XMD-AGI':_0x167de0[_0x204e('0x129')]?util[_0x204e('0x3f')](_0x204e('0x15f'),ipAgi,_0x167de0[_0x204e('0x129')]):_0x204e('0x160'),'XMD-AGIAFTER':_0x167de0['dialQueueProject2']?util[_0x204e('0x3f')](_0x204e('0x15f'),ipAgi,_0x167de0['dialQueueProject2']):_0x204e('0x160'),'XMD-QUEUE':utils[_0x204e('0x161')](_0x167de0)?util['format'](_0x204e('0x162'),_0x167de0[_0x204e('0x5b')],_0x167de0[_0x204e('0x163')]||'',_0x167de0[_0x204e('0x164')]?'c':'',_0x167de0[_0x204e('0xc3')]||0x3):'NONE','XMD-CONTACTID':_0xba72cb[_0x204e('0xd4')],'XMD-CDRTYPE':_0x204e('0x7'),'CALLERID(all)':_0x33a5fa[_0x204e('0xe6')][_0x4d239e]['getCaller'](),'XMD-AMD':_0x167de0[_0x204e('0x106')]?_0x204e('0x139'):_0x204e('0x160'),'XMD-DESTINATION':_0x204e('0x165')};if(_0x167de0[_0x204e('0x106')]){_0x4eea42[_0x204e('0x166')]=_0x167de0[_0x204e('0x167')]||0x9c4;_0x4eea42[_0x204e('0x168')]=_0x167de0['dialAMDGreeting']||0x5dc;_0x4eea42[_0x204e('0x169')]=_0x167de0[_0x204e('0x16a')]||0x320;_0x4eea42[_0x204e('0x16b')]=_0x167de0[_0x204e('0x16c')]||0x1388;_0x4eea42[_0x204e('0x16d')]=_0x167de0[_0x204e('0x16e')]||0x64;_0x4eea42['XMD-AMDBETWEENWORDSSILENCE']=_0x167de0[_0x204e('0x16f')]||0x32;_0x4eea42[_0x204e('0x170')]=_0x167de0[_0x204e('0x171')]||0x3;_0x4eea42[_0x204e('0x172')]=_0x167de0[_0x204e('0x173')]||0x100;_0x4eea42[_0x204e('0x174')]=_0x167de0[_0x204e('0x175')]||0x1388;}if(utils['isOutboundQueue'](_0x167de0)){_0x4eea42[_0x204e('0x176')]=_0xba72cb[_0x204e('0xd6')];}else{_0x4eea42[_0x204e('0x177')]=_0xba72cb[_0x204e('0xe3')];}var _0x3ea9ac=utils['setXMDContactVariables'](_0xba72cb[_0x204e('0x178')]);Object['assign'](_0x4eea42,_0x3ea9ac);var _0x2c934d=_0x33a5fa[_0x204e('0x82')](_0x167de0[_0x204e('0x89')])?utils['getCallerId'](_0x167de0[_0x204e('0x89')][_0x204e('0x179')],_0x167de0[_0x204e('0x17a')],_0x167de0[_0x204e('0x17b')]>0x0?utils['getCallerIdRandom'](_0x167de0[_0x204e('0x17c')],_0x167de0[_0x204e('0x17b')]):_0x167de0[_0x204e('0x17c')]):utils[_0x204e('0x17d')](_['isNil'](_0x167de0[_0x204e('0x17e')])?_0x167de0['Trunk'][_0x204e('0x179')]:_0x167de0['TrunkBackup'][_0x204e('0x179')],_0x167de0[_0x204e('0x17a')],_0x167de0[_0x204e('0x17b')]>0x0?utils[_0x204e('0x17f')](_0x167de0[_0x204e('0x17c')],_0x167de0[_0x204e('0x17b')]):_0x167de0[_0x204e('0x17c')]);if(_0x2c934d){_0x4eea42[_0x204e('0x180')]=_0x33a5fa[_0x204e('0xe6')][_0x4d239e][_0x204e('0x181')]=utils[_0x204e('0x182')](_0x2c934d);_0x4eea42[_0x204e('0x183')]=_0xba72cb[_0x204e('0x15c')];}_0x167de0[_0x204e('0x184')]=_0x4eea42;return ami[_0x204e('0x97')]({'actionid':_0x4d239e,'action':_0x204e('0x15a'),'channel':_0x33a5fa[_0x204e('0x82')](_0x167de0['Trunk'])?util[_0x204e('0x3f')]('SIP/%s/%s%s',_0x167de0['Trunk'][_0x204e('0x5b')],isNotNull(_0x167de0[_0x204e('0x185')])?_0x167de0[_0x204e('0x185')][_0x204e('0x186')]()||'':'',_0x167de0[_0x204e('0x187')]>0x0?_0xba72cb['phone'][_0x204e('0x188')](_0x167de0[_0x204e('0x187')]):_0xba72cb[_0x204e('0x15c')]):util[_0x204e('0x3f')]('SIP/%s/%s%s',_[_0x204e('0xf5')](_0x167de0[_0x204e('0x17e')])?_0x167de0['Trunk']['name']:_0x167de0[_0x204e('0x17e')][_0x204e('0x5b')],isNotNull(_0x167de0['dialPrefix'])?_0x167de0[_0x204e('0x185')][_0x204e('0x186')]()||'':'',_0x167de0[_0x204e('0x187')]>0x0?_0xba72cb[_0x204e('0x15c')]['substring'](_0x167de0[_0x204e('0x187')]):_0xba72cb[_0x204e('0x15c')]),'callerid':_0x2c934d,'Exten':_0x204e('0x165'),'Context':_0x204e('0x189'),'Priority':'1','variable':_0x4eea42,'timeout':(_0x167de0['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4d239e})['then'](function(_0x5e0ad0){return _0x3e2107(_0x5e0ad0);})['catch'](function(_0x4ef4cd){_0x167de0[_0x204e('0x18a')]+=0x1;var _0x20ba82=new History(_0x33a5fa[_0x204e('0xe6')][_0x4d239e]);logger[_0x204e('0x60')](util[_0x204e('0x3f')]('[originateError]:\x20%s',JSON[_0x204e('0x81')](_0x4ef4cd)));_0x20ba82[_0x204e('0x6b')]=0xe;_0x20ba82[_0x204e('0xc6')]=_0x204e('0x18b');_0x20ba82[_0x204e('0x6d')]=moment()[_0x204e('0x3f')](_0x204e('0xbb'));_0x20ba82[_0x204e('0x6c')]=_0x20ba82[_0x204e('0x6d')];hopperUtils[_0x204e('0xd9')](_0x20ba82)[_0x204e('0x9b')](loggerCatch(_0x204e('0x18c')));_0x33a5fa[_0x204e('0xbf')](_0x20ba82)[_0x204e('0x9b')](loggerCatch(_0x204e('0x18c')))[_0x204e('0x1b')](function(){delete _0x33a5fa[_0x204e('0xe6')][_0x4d239e];return _0x55de0f(msgResponse(_0x204e('0x15a'),'Error',_0x204e('0x18d')));});});});};Dialer[_0x204e('0x87')][_0x204e('0x18e')]=function(_0x564fe7,_0x97ba75,_0x4a4e0){var _0x19d9ae=new History(_0x97ba75);if(_0x19d9ae[_0x204e('0x117')]+_0x19d9ae['countcongestionretry']+_0x19d9ae['countnoanswerretry']+_0x19d9ae[_0x204e('0x11a')]+_0x19d9ae[_0x204e('0xca')]+_0x19d9ae['countabandonedretry']+_0x19d9ae[_0x204e('0x114')]+_0x19d9ae[_0x204e('0x125')]>=_0x4a4e0['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x564fe7){case 0x3:if(_0x19d9ae[_0x204e('0x119')]>=_0x4a4e0[_0x204e('0x18f')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x19d9ae[_0x204e('0x119')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0[_0x204e('0x190')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19d9ae[_0x204e('0xd4')],'ListId':_0x19d9ae[_0x204e('0xd5')],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})['catch'](loggerCatch(_0x204e('0x191')));break;case 0x5:if(_0x19d9ae['countbusyretry']>=_0x4a4e0[_0x204e('0x192')]-0x1){return!![];}hopperUtils[_0x204e('0xd1')]({'active':![],'countbusyretry':_0x19d9ae[_0x204e('0x117')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0[_0x204e('0x193')],_0x204e('0xd3'))['format'](_0x204e('0xbb')),'ContactId':_0x19d9ae[_0x204e('0xd4')],'ListId':_0x19d9ae[_0x204e('0xd5')],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x19d9ae[_0x204e('0x118')]>=_0x4a4e0[_0x204e('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x19d9ae[_0x204e('0x118')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0[_0x204e('0x195')],_0x204e('0xd3'))[_0x204e('0x3f')](_0x204e('0xbb')),'ContactId':_0x19d9ae[_0x204e('0xd4')],'ListId':_0x19d9ae[_0x204e('0xd5')],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch(_0x204e('0x196')));break;case 0x0:if(_0x19d9ae['countnosuchnumberretry']>=_0x4a4e0[_0x204e('0x197')]-0x1){return!![];}else{hopperUtils[_0x204e('0xd1')]({'active':![],'countnosuchnumberretry':_0x19d9ae[_0x204e('0x11a')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0[_0x204e('0x198')],_0x204e('0xd3'))[_0x204e('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19d9ae[_0x204e('0xd4')],'ListId':_0x19d9ae[_0x204e('0xd5')],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})['catch'](loggerCatch(_0x204e('0x199')));}break;case 0xa:if(_0x19d9ae[_0x204e('0xca')]>=_0x4a4e0[_0x204e('0xcf')]-0x1){return!![];}hopperUtils[_0x204e('0xd1')]({'active':![],'countdropretry':_0x19d9ae[_0x204e('0xca')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0[_0x204e('0xcb')],_0x204e('0xd3'))[_0x204e('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19d9ae['ContactId'],'ListId':_0x19d9ae[_0x204e('0xd5')],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch(_0x204e('0x19a')));break;case 0xb:if(_0x19d9ae['countabandonedretry']>=_0x4a4e0['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x204e('0xd1')]({'active':![],'countabandonedretry':_0x19d9ae['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x4a4e0[_0x204e('0xe0')],'minutes')[_0x204e('0x3f')](_0x204e('0xbb')),'ContactId':_0x19d9ae['ContactId'],'ListId':_0x19d9ae['ListId'],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x19d9ae['countmachineretry']>=_0x4a4e0[_0x204e('0x11e')]-0x1){return!![];}hopperUtils[_0x204e('0xd1')]({'active':![],'countmachineretry':_0x19d9ae[_0x204e('0x114')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0['dialMachineRetryFrequency'],'minutes')[_0x204e('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19d9ae['ContactId'],'ListId':_0x19d9ae[_0x204e('0xd5')],'VoiceQueueId':_0x19d9ae[_0x204e('0xd6')]||undefined,'CampaignId':_0x19d9ae[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch(_0x204e('0x121')));break;case 0x14:if(_0x19d9ae[_0x204e('0x125')]>=_0x4a4e0[_0x204e('0x19b')]-0x1){return!![];}hopperUtils[_0x204e('0xd1')]({'active':![],'countagentrejectretry':_0x19d9ae[_0x204e('0x125')]+=0x1,'scheduledat':moment()[_0x204e('0xd2')](_0x4a4e0['dialAgentRejectRetryFrequency'],'minutes')[_0x204e('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x19d9ae['ContactId'],'ListId':_0x19d9ae['ListId'],'VoiceQueueId':_0x19d9ae['VoiceQueueId']||undefined,'CampaignId':_0x19d9ae['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][AgentReject]'));break;default:return!![];}};Dialer['prototype'][_0x204e('0x100')]=function(_0x3f1ea2,_0x16a856,_0xead2e4){var _0x25015b=this;var _0x468b1e=new History(_0x3f1ea2);var _0x175343=![];var _0x487e85;var _0x6e6705;return new Promise(function(_0x2022a2,_0xecc619){if(_[_0x204e('0x39')](_0x16a856)&&typeof _0x16a856!=='object'){return _0xecc619(msgResponse(_0x204e('0x19c'),_0x204e('0x92'),_0x204e('0x19d')));}if(_[_0x204e('0x39')](_0xead2e4)&&typeof _0xead2e4!==_0x204e('0x159')){return _0xecc619(msgResponse(_0x204e('0x19c'),_0x204e('0x92'),_0x204e('0x19e')));}hopperUtils[_0x204e('0xcd')](_0x468b1e,_0xead2e4[_0x204e('0xbd')],_0x16a856)[_0x204e('0x37')](function(_0x5b10ac){if(_0x5b10ac[_0x204e('0xce')]==0x1)_0x175343=!![];switch(_0xead2e4[_0x204e('0xbd')]){case'0':_0x16a856['outboundNoSuchCallsDay']+=0x1;_0x468b1e[_0x204e('0x6b')]=0x0;_0x468b1e[_0x204e('0xc6')]=_0x204e('0x19f');_0x468b1e[_0x204e('0x11a')]+=0x1;_0x468b1e[_0x204e('0xdf')]+=0x1;ami[_0x204e('0x3a')](_0x204e('0x1a0'),ut[_0x204e('0x115')](_0x3f1ea2,_0x204e('0x1a1')));_0x487e85=_0x16a856[_0x204e('0x198')];_0x6e6705=_0x16a856[_0x204e('0xcc')];hopperUtils['createHistory'](_0x468b1e)[_0x204e('0x9b')](loggerCatch(_0x204e('0x116')));if(_0x25015b['checkRetriveMax'](0x0,_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e[_0x204e('0x11a')]>=_0x16a856[_0x204e('0x197')]){_0x25015b[_0x204e('0x126')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1a2'));}else{_0x25015b['stateGlobal'](_0x468b1e,_0x2022a2,_0xecc619,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x16a856[_0x204e('0x1a3')]+=0x1;_0x468b1e[_0x204e('0x6b')]=0x3;_0x468b1e['statedesc']=_0x204e('0x1a4');_0x468b1e[_0x204e('0x119')]+=0x1;_0x468b1e[_0x204e('0xdf')]+=0x1;var _0x1c40f3=ut[_0x204e('0x1a5')](_0x3f1ea2,_0x16a856);ami[_0x204e('0x3a')]('custom:agentnoanswer',_0x1c40f3);_0x487e85=_0x16a856['dialNoAnswerRetryFrequency'];_0x6e6705=_0x16a856[_0x204e('0xcc')];hopperUtils[_0x204e('0xd9')](_0x468b1e)[_0x204e('0x9b')](loggerCatch(_0x204e('0x1a6')));if(_0x25015b['checkRetriveMax'](0x3,_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e[_0x204e('0x119')]>=_0x16a856[_0x204e('0x18f')]){_0x25015b[_0x204e('0x126')](_0x468b1e,_0x2022a2,_0xecc619,'reason\x203\x20ringing\x20no\x20answer');}else{_0x25015b[_0x204e('0x11c')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1a7'));}}break;case'5':_0x16a856[_0x204e('0x1a8')]+=0x1;_0x468b1e['state']=0x5;_0x468b1e['statedesc']='Busy';_0x468b1e[_0x204e('0x117')]+=0x1;_0x468b1e[_0x204e('0xdf')]+=0x1;ami[_0x204e('0x3a')](_0x204e('0x1a9'),ut[_0x204e('0x115')](_0x3f1ea2,_0x204e('0x1aa')));_0x487e85=_0x16a856[_0x204e('0x193')];_0x6e6705=_0x16a856[_0x204e('0xcc')];hopperUtils[_0x204e('0xd9')](_0x468b1e)[_0x204e('0x9b')](loggerCatch(_0x204e('0x1ab')));if(_0x25015b[_0x204e('0x18e')](0x5,_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e[_0x204e('0x117')]>=_0x16a856[_0x204e('0x192')]){_0x25015b['createStateFinal'](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1ac'));}else{_0x25015b[_0x204e('0x11c')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1ac'));}}break;case'8':_0x16a856[_0x204e('0x1ad')]+=0x1;_0x468b1e[_0x204e('0x6b')]=0x8;_0x468b1e[_0x204e('0xc6')]=_0x204e('0x1ae');_0x468b1e[_0x204e('0x118')]+=0x1;_0x468b1e[_0x204e('0xdf')]+=0x1;_0x487e85=_0x16a856[_0x204e('0x195')];_0x6e6705=_0x16a856['callAdditionalPhoneAfterMin'];ami[_0x204e('0x3a')](_0x204e('0x1af'),ut[_0x204e('0x115')](_0x3f1ea2,_0x204e('0x1b0')));hopperUtils[_0x204e('0xd9')](_0x468b1e)['catch'](loggerCatch(_0x204e('0x1b1')));if(_0x25015b['checkRetriveMax'](0x8,_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e[_0x204e('0x118')]>=_0x16a856[_0x204e('0x194')]){_0x25015b[_0x204e('0x126')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1b2'));}else{_0x25015b[_0x204e('0x11c')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1b2'));}}break;case'11':_0x16a856[_0x204e('0x1b3')]+=0x1;_0x468b1e[_0x204e('0x6b')]=0xb;_0x468b1e[_0x204e('0xc6')]=_0x204e('0xdd');_0x468b1e[_0x204e('0xde')]+=0x1;_0x468b1e['countglobal']+=0x1;_0x487e85=_0x16a856[_0x204e('0xe0')];_0x6e6705=_0x16a856['callAdditionalPhoneAfterMin'];hopperUtils[_0x204e('0xd9')](_0x468b1e)[_0x204e('0x9b')](loggerCatch(_0x204e('0xe5')));if(_0x25015b[_0x204e('0x18e')](0xb,_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e[_0x204e('0xde')]>=_0x16a856[_0x204e('0xe2')]){_0x25015b['createStateFinal'](_0x468b1e,_0x2022a2,_0xecc619,'reason\x2011\x20abandoned');}else{_0x25015b[_0x204e('0x11c')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1b4'));}}break;case'20':_0x16a856[_0x204e('0x1b5')]+=0x1;_0x468b1e[_0x204e('0x6b')]=0x14;_0x468b1e[_0x204e('0xc6')]='AgentReject';_0x468b1e[_0x204e('0x125')]+=0x1;_0x468b1e[_0x204e('0xdf')]+=0x1;_0x487e85=_0x16a856['dialAgentRejectRetryFrequency'];_0x6e6705=_0x16a856['callAdditionalPhoneAfterMin'];ami[_0x204e('0x3a')]('custom:agentreject',ut[_0x204e('0x115')](_0x3f1ea2,_0x204e('0x1b6')));hopperUtils['createHistory'](_0x468b1e)[_0x204e('0x9b')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x25015b[_0x204e('0x18e')](0x14,_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e[_0x204e('0x125')]>=_0x16a856[_0x204e('0x19b')]){_0x25015b[_0x204e('0x126')](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1b7'));}else{_0x25015b['stateGlobal'](_0x468b1e,_0x2022a2,_0xecc619,_0x204e('0x1b7'));}}break;default:_0x16a856[_0x204e('0x12e')]+=0x1;_0x468b1e[_0x204e('0x6b')]=0xc;_0x468b1e[_0x204e('0xc6')]=_0xead2e4[_0x204e('0xbd')];_0x487e85=_0x16a856[_0x204e('0x1b8')];_0x6e6705=_0x16a856[_0x204e('0xcc')];hopperUtils['createHistory'](_0x468b1e)['catch'](loggerCatch(_0x204e('0x1b9')));if(_0x25015b[_0x204e('0x18e')](_0xead2e4[_0x204e('0xbd')],_0x3f1ea2,_0x16a856)&&!_0x175343){if(_0x468b1e['countbusyretry']+_0x468b1e['countcongestionretry']+_0x468b1e[_0x204e('0x119')]+_0x468b1e[_0x204e('0x11a')]+_0x468b1e[_0x204e('0xca')]+_0x468b1e['countabandonedretry']+_0x468b1e[_0x204e('0x114')]+_0x468b1e['countagentrejectretry']>=_0x16a856[_0x204e('0x11b')]){_0x25015b['stateGlobal'](_0x468b1e,_0x2022a2,_0xecc619,_0xead2e4[_0x204e('0xbd')]);}else{_0x25015b['createStateFinal'](_0x468b1e,_0x2022a2,_0xecc619,_0xead2e4[_0x204e('0xbd')]);}}}})[_0x204e('0x37')](function(){if(_0x175343){hopperUtils[_0x204e('0xdb')](_0x468b1e,_0x487e85,_0x6e6705)['then'](function(){return _0x2022a2(0x1);});}});});};Dialer[_0x204e('0x87')][_0x204e('0x11c')]=function(_0x3dae2d,_0x3f7ac8,_0x5b7c04,_0x28f887){var _0x1ec1b5=new Final(_0x3dae2d);_0x1ec1b5[_0x204e('0x6b')]=0xf;_0x1ec1b5[_0x204e('0xc6')]=_0x204e('0x1ba');this['createStateFinal'](_0x1ec1b5,_0x3f7ac8,_0x5b7c04,_0x28f887);};Dialer[_0x204e('0x87')][_0x204e('0x126')]=function(_0x568e71,_0x4a0cb3,_0x87eed2,_0x437bc7){hopperUtils[_0x204e('0xbf')](_0x568e71)[_0x204e('0x37')](function(){return _0x4a0cb3(msgResponse(_0x204e('0x19c'),_0x204e('0x1bb'),_0x437bc7));})[_0x204e('0x9b')](function(){return _0x87eed2(msgResponse(_0x204e('0x1bc'),'Failure',_0x204e('0x1bd')));});};Dialer[_0x204e('0x87')][_0x204e('0x8')]=function(_0x5fae82){var _0x156709=_0x5fae82[_0x204e('0x1be')]/0x64;var _0x360aab=_0x5fae82[_0x204e('0xc4')]/(_0x5fae82[_0x204e('0xc4')]+_0x5fae82['outboundAnswerCallsDay']);var _0x3ccc43=Math[_0x204e('0x1bf')](_0x5fae82[_0x204e('0x1c0')]*(_0x5fae82[_0x204e('0x1c1')]/0x64));var _0x3a35d4=Math[_0x204e('0x1bf')](_0x5fae82['predictiveIntervalAvailable']*(_0x5fae82[_0x204e('0x1c2')]/0x64));var _0x57876b=_0x5fae82[_0x204e('0x135')]+_0x5fae82[_0x204e('0x137')];var _0x52eed5=Math['floor'](_0x5fae82['erlangCalls']*_0x5fae82[_0x204e('0x57')]*_0x5fae82['predictiveIntervalHitRate']*_0x5fae82[_0x204e('0x1c3')]);if(_[_0x204e('0x39')](_0x5fae82[_0x204e('0x27')])){if(!_[_0x204e('0x39')](_0x5fae82['startPredictive'])){_0x5fae82[_0x204e('0x26')]=undefined;loggerPredictive[_0x204e('0x60')](_0x204e('0x1c4'),_0x204e('0x1c5'));}if(!_['isUndefined'](_0x5fae82[_0x204e('0x5e')])){loggerPredictive[_0x204e('0x60')]('[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x5fae82[_0x204e('0x5e')]);_0x5fae82[_0x204e('0x5e')]=undefined;}_0x5fae82[_0x204e('0x27')]=moment()[_0x204e('0x3f')](_0x204e('0xbb'));loggerPredictive[_0x204e('0x42')](_0x5fae82[_0x204e('0x5b')],_0x204e('0x1c6'),_0x5fae82[_0x204e('0x27')]);this[_0x204e('0xad')](_0x5fae82,0x1);}else if(ifInterval(_0x5fae82[_0x204e('0x1c7')],_0x5fae82['startProgressive'])){this[_0x204e('0xad')](_0x5fae82,0x1);loggerPredictiveCalls['info'](_0x204e('0x1c8'),_0x5fae82['startProgressive'],_0x5fae82['name']);_0x5fae82['erlangCalls']=0x0;_0x5fae82[_0x204e('0xc5')]=0x0;}else if(_0x156709<_0x360aab&&_0x5fae82['dialPredictiveOptimization']===_0x204e('0x1c9')){clearPredictiveAttributes(_0x5fae82);loggerPredictive[_0x204e('0x42')](_0x204e('0x1ca'),'Dropped\x20calls\x20day',_0x360aab,_0x204e('0x27'),_0x5fae82[_0x204e('0x5b')]);}else if(_0x52eed5<_0x5fae82[_0x204e('0xc5')]&&_0x5fae82['dialPredictiveOptimization']===_0x204e('0x1c9')){clearPredictiveAttributes(_0x5fae82);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x204e('0x1cb'),_0x52eed5,_0x204e('0x1cc'),_0x5fae82[_0x204e('0xc5')],_0x204e('0x27'),_0x5fae82[_0x204e('0x5b')]);}else if(!ifInterval(_0x5fae82[_0x204e('0x1c7')],_0x5fae82[_0x204e('0x27')])&&_[_0x204e('0x39')](_0x5fae82[_0x204e('0x26')])&&!_['isUndefined'](_0x5fae82[_0x204e('0x27')])){_0x5fae82[_0x204e('0x26')]=moment()['format'](_0x204e('0xbb'));loggerPredictive[_0x204e('0x42')](_0x5fae82['name'],_0x204e('0x1cd'),_0x5fae82[_0x204e('0x26')]);hopperUtils[_0x204e('0x1ce')](_0x5fae82[_0x204e('0x1c7')])['then'](this[_0x204e('0x1cf')](_0x5fae82))['then'](mergeDataErlangB(_0x5fae82))[_0x204e('0x37')](this[_0x204e('0x1d0')](_0x5fae82))['catch'](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x5fae82));}else if(!ifInterval(_0x5fae82['dialPredictiveInterval'],_0x5fae82[_0x204e('0x26')])){_0x5fae82[_0x204e('0xc5')]=0x0;_0x5fae82[_0x204e('0x26')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x204e('0x42')](_0x5fae82[_0x204e('0x5b')],_0x204e('0x1d1'),_0x5fae82['startPredictive']);clearInterval(_0x5fae82['handlePredictive']);_0x5fae82[_0x204e('0x5e')]=undefined;hopperUtils[_0x204e('0x1ce')](_0x5fae82[_0x204e('0x1c7')])[_0x204e('0x37')](this[_0x204e('0x1cf')](_0x5fae82))[_0x204e('0x37')](mergeDataErlangB(_0x5fae82))[_0x204e('0x37')](this[_0x204e('0x1d0')](_0x5fae82))[_0x204e('0x9b')](loggerCatchPredictive(_0x204e('0x1d2'),_0x5fae82));}else if(_0x5fae82[_0x204e('0x1c0')]&&_0x57876b<_0x5fae82[_0x204e('0x1c0')]-_0x3a35d4){clearPredictiveAttributes(_0x5fae82);loggerPredictive[_0x204e('0x42')](_0x5fae82[_0x204e('0x5b')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x57876b,_0x204e('0x1d3'),_0x5fae82[_0x204e('0x1c0')],'-',_0x3a35d4,'=',_0x5fae82[_0x204e('0x1c0')]-_0x3a35d4,')');}else if(_0x5fae82['predictiveIntervalAvailable']&&_0x57876b>_0x5fae82[_0x204e('0x1c0')]+_0x3ccc43){clearPredictiveAttributes(_0x5fae82);loggerPredictive[_0x204e('0x42')](_0x5fae82[_0x204e('0x5b')],_0x204e('0x1d4'),_0x57876b,_0x204e('0x1d5'),_0x5fae82[_0x204e('0x1c0')],'+',_0x3ccc43,'=',_0x5fae82[_0x204e('0x1c0')]+_0x3ccc43,')');}};Dialer['prototype'][_0x204e('0x1cf')]=function(_0x4de0e8){var _0x6e254=this;return function(_0x327417){return new Promise(function(_0x2aedc3,_0x555890){_[_0x204e('0xf0')](_0x4de0e8,_0x327417[0x0]);if(checkGetDataPredictive(_0x327417[0x0])){var _0x119186=_0x4de0e8[_0x204e('0x1c0')]=_0x4de0e8[_0x204e('0x137')]+_0x4de0e8[_0x204e('0x135')];var _0x39594b=_0x4de0e8[_0x204e('0x1c7')]*0x3c;var _0x47ec62=_0x327417[0x0][_0x204e('0x1d6')]+_0x327417[0x0]['predictiveIntervalAvgHoldtime'];var _0x13f407=(_0x327417[0x0][_0x204e('0x46')]+_0x327417[0x0][_0x204e('0x48')]+_0x327417[0x0][_0x204e('0x4a')])/_0x327417[0x0][_0x204e('0x44')];_0x4de0e8[_0x204e('0x1d7')]=_0x13f407>0x0?_0x13f407:0x1;switch(_0x4de0e8[_0x204e('0x1d8')]){case'dropRate':var _0x1562d2=_0x4de0e8['dialPredictiveOptimizationPercentage']/0x64;return _0x6e254['abandonmentRate'](_0x119186,_0x39594b,_0x47ec62,_0x13f407,_0x1562d2)[_0x204e('0x37')](function(_0x50c213){return _0x2aedc3(_0x50c213);});case'agentBusyFactor':var _0x38df9a=_0x4de0e8[_0x204e('0x1be')]/0x64;return _0x6e254[_0x204e('0x1d9')](_0x119186,_0x39594b,_0x47ec62,_0x13f407,_0x38df9a)[_0x204e('0x37')](function(_0x41253b){return _0x2aedc3(_0x41253b);});default:return _0x555890(msgResponse('[getDataPredictive]','Failure',_0x204e('0x1da')));}}else{return _0x555890(msgResponse(_0x204e('0x1db'),_0x204e('0x92'),_0x204e('0x1dc')));}});};};Dialer[_0x204e('0x87')][_0x204e('0x1dd')]=function(_0x59d52b){var _0x29668e=this;return function(_0x34c811){return new Promise(function(_0x33783d,_0x553a4){_[_0x204e('0xf0')](_0x59d52b,_0x34c811[0x0]);if(checkGetDataPredictive(_0x34c811[0x0])){loggerPredictive['info'](JSON['stringify'](_0x34c811[0x0]));if(_0x59d52b['dialPredictiveOptimization']===_0x204e('0x1c9')){return _0x29668e['getVoiceQueueRtPauses'](_0x59d52b['id'])[_0x204e('0x37')](function(_0x156a03){var _0x55c78e=_0x59d52b['loggedIn']-_0x156a03[0x0][_0x204e('0x1de')];var _0x479a57=_0x59d52b[_0x204e('0x1c7')]*0x3c;var _0x5ab187=_0x34c811[0x0][_0x204e('0x1d6')]+_0x34c811[0x0][_0x204e('0x4c')];var _0x2fdcab=(_0x34c811[0x0]['predictiveIntervalAnsweredCalls']+_0x34c811[0x0][_0x204e('0x48')]+_0x34c811[0x0][_0x204e('0x4a')])/_0x34c811[0x0][_0x204e('0x44')];var _0x1c8666=_0x59d52b['dialPredictiveOptimizationPercentage']/0x64;_0x59d52b[_0x204e('0x1df')]=_0x156a03[0x0][_0x204e('0x1de')]||0x0;_0x59d52b[_0x204e('0x1d7')]=_0x2fdcab>0x0?_0x2fdcab:0x1;return _0x29668e['abandonmentRate'](_0x55c78e,_0x479a57,_0x5ab187,_0x2fdcab,_0x1c8666);})[_0x204e('0x37')](function(_0x198c2f){return _0x33783d(_0x198c2f);})['catch'](function(_0x1a6f80){return _0x553a4(msgResponse(_0x204e('0x1e0'),_0x204e('0x92'),JSON['stringify'](_0x1a6f80)));});}if(_0x59d52b[_0x204e('0x1d8')]===_0x204e('0x1e1')){return _0x29668e[_0x204e('0x14d')](_0x59d52b['id'])[_0x204e('0x37')](function(_0x351bd4){var _0x75f63b=_0x59d52b['loggedIn']-_0x351bd4[0x0][_0x204e('0x1de')];var _0x58c173=_0x59d52b[_0x204e('0x1c7')]*0x3c;var _0xac1b3b=_0x34c811[0x0][_0x204e('0x1d6')]+_0x34c811[0x0][_0x204e('0x4c')];var _0x159a6e=(_0x34c811[0x0][_0x204e('0x46')]+_0x34c811[0x0][_0x204e('0x48')]+_0x34c811[0x0][_0x204e('0x4a')])/_0x34c811[0x0][_0x204e('0x44')];var _0x1190ec=_0x59d52b[_0x204e('0x1be')]/0x64;_0x59d52b[_0x204e('0x1df')]=_0x351bd4[0x0][_0x204e('0x1de')]||0x0;_0x59d52b[_0x204e('0x1d7')]=_0x159a6e>0x0?_0x159a6e:0x1;return _0x29668e['busyFactor'](_0x75f63b,_0x58c173,_0xac1b3b,_0x159a6e,_0x1190ec);})[_0x204e('0x37')](function(_0x4222f8){return _0x33783d(_0x4222f8);})['catch'](function(_0x2d8386){return _0x553a4(msgResponse('[CatchErlangB]',_0x204e('0x92'),JSON[_0x204e('0x81')](_0x2d8386)));});}}else{return _0x553a4(msgResponse(_0x204e('0x1db'),_0x204e('0x92'),_0x204e('0x1dc')));}});};};Dialer[_0x204e('0x87')][_0x204e('0x1d0')]=function(_0xc6ee21){var _0x2cd8b7=this;return function(){var _0x4b8e0b=0x0;var _0x49f28e=Math['floor'](_0xc6ee21[_0x204e('0x1e2')]*0x3e8);if(_0x49f28e>0x0){_0x49f28e=_0x49f28e<0x64?0x64:_0x49f28e;loggerPredictive[_0x204e('0x42')](_0xc6ee21[_0x204e('0x5b')],_0x204e('0x1e3'),_0x49f28e,_0x204e('0x1e4'));_0xc6ee21['handlePredictive']=setInterval(function(){_0x2cd8b7[_0x204e('0x5e')](_0xc6ee21);loggerPredictiveCalls[_0x204e('0x42')](_0x204e('0x1e5'),_0x4b8e0b+=0x1);},_0x49f28e);}else{loggerPredictive[_0x204e('0x42')](_0xc6ee21[_0x204e('0x5b')],_0x204e('0x1e6'));}};};Dialer[_0x204e('0x87')]['checkContactBlack']=function(_0x105104,_0x332e88){var _0x15d626=this;return function(_0x4e7cdd){if(_[_0x204e('0x74')](_0x4e7cdd)){if(_[_0x204e('0xf5')](_0x332e88['UserId'])||!_0x332e88[_0x204e('0x1e7')]){if(_0x105104[_0x204e('0xab')]==='booked'){_0x105104[_0x204e('0x6f')]=_[_0x204e('0x39')](_0x105104['queueStatusComplete'])?!![]:_0x105104[_0x204e('0x6f')];var _0x2202ef=uuid['v4']();_0x15d626['actions'][_0x2202ef]=new Action(_0x105104,_0x332e88,_0x2202ef);loggerBooked[_0x204e('0x42')](_0x204e('0x1e8'),_0x2202ef,'queueStatusComplete:\x20',JSON[_0x204e('0x81')](_0x105104[_0x204e('0x6f')]),_0x204e('0x1e9'),_0x105104[_0x204e('0x5b')]);if(_0x105104[_0x204e('0x6f')]){_0x105104['queueStatusComplete']=![];_0x15d626['queueBooked'][_0x15d626[_0x204e('0xe6')][_0x2202ef]['queue']]=[];ami[_0x204e('0x97')]({'actionid':_0x2202ef,'action':_0x204e('0x1ea'),'queue':_0x105104[_0x204e('0x5b')]})['catch'](function(){_0x15d626[_0x204e('0xb8')](_0x105104);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x15d626['actions'][_0x2202ef][_0x204e('0xd4')],'ListId':_0x15d626[_0x204e('0xe6')][_0x2202ef]['ListId'],'VoiceQueueId':_0x15d626[_0x204e('0xe6')][_0x2202ef][_0x204e('0xd6')]||undefined,'CampaignId':_0x15d626['actions'][_0x2202ef][_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x15d626[_0x204e('0xe6')][_0x2202ef];});}else{loggerBooked[_0x204e('0x42')](_0x204e('0x1eb'),JSON[_0x204e('0x81')](_0x105104['queueStatusComplete']),_0x204e('0x1e9'),_0x105104[_0x204e('0x5b')]);_0x15d626['updateOriginated'](_0x105104);hopperUtils[_0x204e('0xd1')]({'active':![],'ContactId':_0x15d626[_0x204e('0xe6')][_0x2202ef][_0x204e('0xd4')],'ListId':_0x15d626[_0x204e('0xe6')][_0x2202ef]['ListId'],'VoiceQueueId':_0x15d626[_0x204e('0xe6')][_0x2202ef][_0x204e('0xd6')]||undefined,'CampaignId':_0x15d626['actions'][_0x2202ef][_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x15d626[_0x204e('0xe6')][_0x2202ef];}}else{return _0x15d626[_0x204e('0x158')](_0x105104,_0x332e88);}}else{if(utils[_0x204e('0x5a')](undefined,_0x332e88['scheduledat'])<_0x105104[_0x204e('0x1ec')]*0x3c){if(_0x332e88['Agent']&&!_0x332e88[_0x204e('0x145')][_0x204e('0x1ed')]){_0x15d626[_0x204e('0x1d')][_0x204e('0x1ee')](_0x332e88['id'])[_0x204e('0x1b')](function(){_0x15d626[_0x204e('0xb8')](_0x105104);});}else{hopperUtils[_0x204e('0x1ef')]({'active':![]},_0x332e88['id'],0x1)[_0x204e('0x1b')](function(){_0x15d626[_0x204e('0xb8')](_0x105104);});}}else{_0x105104[_0x204e('0x1f0')]+=0x1;_0x15d626[_0x204e('0xb8')](_0x105104);if(_0x105104['dialRecallInQueue']){hopperUtils[_0x204e('0xd1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x332e88[_0x204e('0xd4')],'ListId':_0x332e88[_0x204e('0xd5')],'VoiceQueueId':_0x332e88[_0x204e('0xd6')]||undefined,'CampaignId':_0x332e88[_0x204e('0xe3')]||undefined})[_0x204e('0x9b')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x204e('0xd9')](createObjHistory(_0x105104,_0x332e88,utils[_0x204e('0x65')][_0x204e('0x1f1')],0x17,_0x204e('0x1f2')))[_0x204e('0x9b')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x15d626[_0x204e('0x10f')](createObjHistory(_0x105104,_0x332e88,utils[_0x204e('0x65')][_0x204e('0x1f3')],0x16,_0x204e('0x1f4')),_0x204e('0x1f5'),_0x204e('0x1f6'));}}}}else{_0x105104[_0x204e('0x1f7')]+=0x1;_0x15d626['saveInDb'](createObjHistory(_0x105104,_0x332e88,utils[_0x204e('0x65')]['BLACKLIST'],0xd,_0x204e('0x1f8')),_0x204e('0x1f9'),_0x204e('0x1fa'));throw'inBlackList';}};};Dialer[_0x204e('0x87')][_0x204e('0x157')]=function(_0x2ede38){var _0x5cc764=this;var _0x6c4045=_0x2ede38['limitCalls']-_0x2ede38[_0x204e('0x14f')];emitCampaignSummary(_0x2ede38);if(_0x6c4045>0x0&&_0x2ede38[_0x204e('0x63')]==0x0){if(_0x6c4045>this[_0x204e('0x22')]){_0x6c4045=this['maxNumberOriginate'];}_0x2ede38['temp']=0x1;hopperUtils[_0x204e('0x1fb')](_0x2ede38,_0x6c4045)[_0x204e('0x37')](function(_0x3d8058){_0x2ede38[_0x204e('0x63')]=0x0;if(_0x3d8058){if(!utils[_0x204e('0x1fc')](_0x3d8058)){_0x2ede38[_0x204e('0x64')]=utils[_0x204e('0x65')][_0x204e('0x6a')];logger[_0x204e('0x42')](_0x204e('0x1fd')+_0x2ede38[_0x204e('0x5b')]);}else{_0x2ede38['originated']+=_0x3d8058[_0x204e('0xf4')];_0x2ede38['message']=utils[_0x204e('0x65')][_0x204e('0x1fe')];for(var _0x54e3b5=0x0;_0x54e3b5<_0x3d8058[_0x204e('0xf4')];_0x54e3b5+=0x1){_0x2ede38[_0x204e('0x1ff')]+=0x1;if(_[_0x204e('0xf5')](_0x3d8058[_0x54e3b5])||_[_0x204e('0xf5')](_0x3d8058[_0x54e3b5][_0x204e('0x178')])||_[_0x204e('0xf5')](_0x3d8058[_0x54e3b5][_0x204e('0x15c')])){_0x5cc764[_0x204e('0x200')]('[actionOriginate]\x20',_0x2ede38,_0x3d8058[_0x54e3b5]);}else{hopperUtils[_0x204e('0x201')](_[_0x204e('0x70')](_0x3d8058[_0x54e3b5],['CampaignId',_0x204e('0x15c')]))[_0x204e('0x37')](_0x5cc764[_0x204e('0x202')](_0x2ede38,_0x3d8058[_0x54e3b5]))[_0x204e('0x9b')](_0x5cc764['loggerHandler'](_0x204e('0x203'),_0x2ede38));}}}}})[_0x204e('0x9b')](loggerGetContactDialer('[getContactCampaign2]',_0x2ede38,_0x6c4045));}};Dialer[_0x204e('0x87')][_0x204e('0xad')]=function(_0x166d62,_0x3d2419){var _0x5026f9=this;var _0x5d70ec=[];if(_0x3d2419<0x1||_0x166d62[_0x204e('0xab')]==='booked'){_0x3d2419=0x1;}var _0x1eef9e=Math[_0x204e('0x204')](_0x166d62[_0x204e('0x135')]*_0x3d2419)-_0x166d62[_0x204e('0x14f')];if(_0x166d62['dialLimitQueue']>0x0){var _0x170bb2=_0x166d62['dialLimitQueue']-_0x166d62['originated']-_0x166d62[_0x204e('0x137')]-_0x166d62[_0x204e('0x138')];if(_0x1eef9e>_0x170bb2){_0x1eef9e=_0x170bb2;}}if(_0x1eef9e>0x0&&_0x166d62[_0x204e('0x63')]==0x0){if(_0x166d62[_0x204e('0xab')]===_0x204e('0x205')){_0x1eef9e=0x1;}if(_0x1eef9e>this[_0x204e('0x22')]){_0x1eef9e=this[_0x204e('0x22')];}for(var _0x40dbe7 in this['agents']){if(typeof this[_0x204e('0x20')][_0x40dbe7]!==_0x204e('0xa6')){if(this[_0x204e('0x20')][_0x40dbe7][_0x204e('0x6b')]===_0x204e('0x206')&&this['agents'][_0x40dbe7][_0x204e('0x85')]===_0x204e('0x207')){_0x5d70ec[_0x204e('0x96')](this[_0x204e('0x20')][_0x40dbe7]['id']);}}}_0x166d62[_0x204e('0x63')]=0x1;hopperUtils['getContactDialer'](_0x166d62,_0x5d70ec,_0x1eef9e)[_0x204e('0x37')](function(_0x21145a){_0x166d62[_0x204e('0x63')]=0x0;if(_0x21145a){if(!utils[_0x204e('0x1fc')](_0x21145a)){hopperUtils[_0x204e('0x208')](_0x166d62)[_0x204e('0x37')](sendMessageReschedule(_0x166d62))[_0x204e('0x9b')](loggerCatch(_0x204e('0x209')));}else{_0x166d62[_0x204e('0x14f')]+=_0x21145a['length'];_0x166d62['message']=_0x166d62[_0x204e('0xab')]===_0x204e('0x205')?utils[_0x204e('0x65')][_0x204e('0x139')]:utils['CAMPAIGN_STATUS'][_0x204e('0x1fe')];for(var _0x4d735e=0x0;_0x4d735e<_0x21145a[_0x204e('0xf4')];_0x4d735e+=0x1){if(_[_0x204e('0xf5')](_0x21145a[_0x4d735e])||_['isNil'](_0x21145a[_0x4d735e][_0x204e('0x178')])||_[_0x204e('0xf5')](_0x21145a[_0x4d735e]['phone'])){_0x5026f9[_0x204e('0x200')](_0x204e('0x20a'),_0x166d62,_0x21145a[_0x4d735e]);}else{hopperUtils[_0x204e('0x20b')](_[_0x204e('0x70')](_0x21145a[_0x4d735e],['VoiceQueueId',_0x204e('0x15c')]))['then'](_0x5026f9[_0x204e('0x202')](_0x166d62,_0x21145a[_0x4d735e]))[_0x204e('0x9b')](_0x5026f9['loggerHandler'](_0x204e('0x20a'),_0x166d62));}}}}})[_0x204e('0x9b')](loggerGetContactDialer(_0x204e('0x20c'),_0x166d62,_0x1eef9e));}};Dialer[_0x204e('0x87')][_0x204e('0x5e')]=function(_0x5400ae){if(_0x5400ae[_0x204e('0x20d')]>0x0){var _0x27cc81=_0x5400ae[_0x204e('0x20d')]-_0x5400ae[_0x204e('0x14f')]-_0x5400ae[_0x204e('0x137')];if(_0x27cc81>0x0&&_0x5400ae[_0x204e('0x63')]==0x0){this['tryOriginatePredictive'](_0x5400ae);}else{loggerPredictiveCalls[_0x204e('0x42')](_0x204e('0x20e'));}}else{this[_0x204e('0x20f')](_0x5400ae);}};Dialer[_0x204e('0x87')][_0x204e('0x20f')]=function(_0x26f496){var _0x530dae=this;var _0x27a502=[];_0x26f496[_0x204e('0x14f')]+=0x1;for(var _0x31d0fd in this[_0x204e('0x20')]){if(typeof this['agents'][_0x31d0fd]!==_0x204e('0xa6')){if(this['agents'][_0x31d0fd][_0x204e('0x6b')]===_0x204e('0x206')&&this[_0x204e('0x20')][_0x31d0fd][_0x204e('0x85')]==='reachable'){_0x27a502[_0x204e('0x96')](this[_0x204e('0x20')][_0x31d0fd]['id']);}}}_0x26f496[_0x204e('0x63')]=0x1;return this['getContactDialer'](_0x26f496['id'],_0x27a502,0x1,_0x26f496[_0x204e('0x210')],_0x26f496)[_0x204e('0x37')](function(_0x47815c){_0x26f496[_0x204e('0x63')]=0x1;if(_0x47815c){if(!utils[_0x204e('0x1fc')](_0x47815c)){utils[_0x204e('0x62')](_0x26f496,0x1,0x0);return hopperUtils['countReScheduled'](_0x26f496)[_0x204e('0x37')](sendMessageReschedule(_0x26f496))[_0x204e('0x9b')](loggerCatch(_0x204e('0x209')));}else{_0x26f496['message']=utils[_0x204e('0x65')]['RUNNING'];if(_[_0x204e('0xf5')](_0x47815c[0x0])||_[_0x204e('0xf5')](_0x47815c[0x0][_0x204e('0x178')])||_[_0x204e('0xf5')](_0x47815c[0x0][_0x204e('0x15c')])){_0x530dae['emptyContact'](_0x204e('0x20a'),_0x26f496,_0x47815c[0x0]);}else{return hopperUtils[_0x204e('0x20b')](_[_0x204e('0x70')](_0x47815c[0x0],[_0x204e('0xd6'),_0x204e('0x15c')]))[_0x204e('0x37')](_0x530dae['checkContactBlack'](_0x26f496,_0x47815c[0x0]))['catch'](_0x530dae[_0x204e('0x151')](_0x204e('0x211'),_0x26f496));}}}})[_0x204e('0x9b')](loggerGetContactDialer(_0x204e('0x212'),_0x26f496,0x1));};Dialer[_0x204e('0x87')]['abandonmentRate']=function(_0x2ed077,_0x5035ee,_0x187879,_0x1dd228,_0x9f514f,_0x39254c){loggerPredictive[_0x204e('0x42')](_0x204e('0x213'));loggerPredictive[_0x204e('0x42')](_0x204e('0x214'),_0x2ed077);loggerPredictive[_0x204e('0x42')](_0x204e('0x215'),_0x5035ee);loggerPredictive[_0x204e('0x42')](_0x204e('0x216'),_0x187879);loggerPredictive[_0x204e('0x42')](_0x204e('0x217'),_0x1dd228);loggerPredictive[_0x204e('0x42')](_0x204e('0x218'),_0x9f514f);loggerPredictive[_0x204e('0x42')]('---------------------------');return new Promise(function(_0x18c330,_0xa7a887){if(_0x2ed077<=0x0||isNaN(_0x2ed077)){return _0xa7a887(msgResponse(_0x204e('0x219'),_0x204e('0x80'),_0x204e('0x21a')+_0x2ed077));}if(_0x187879<=0x0||isNaN(_0x187879)){return _0xa7a887(msgResponse(_0x204e('0x219'),_0x204e('0x80'),_0x204e('0x21b')+_0x187879));}if(_0x1dd228<=0x0||isNaN(_0x1dd228)){return _0xa7a887(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x1dd228));}if(_0x5035ee<=0x0||isNaN(_0x5035ee)){return _0xa7a887(msgResponse(_0x204e('0x219'),_0x204e('0x80'),_0x204e('0x21c')+_0x5035ee));}if(_0x9f514f<=0x0||isNaN(_0x9f514f)){return _0xa7a887(msgResponse(_0x204e('0x219'),_0x204e('0x80'),_0x204e('0x21d')+_0x9f514f));}_0x39254c=_0x39254c||0x0;var _0x42d1f7=0x1/_0x187879;var _0x26bf67=0x0;var _0x16a0f9=0x0;var _0xbdf98d=0x0;var _0x38a917=0x0;for(var _0x4f76f1=0x0;_0xbdf98d<_0x9f514f;_0x4f76f1+=0x1){_0x16a0f9=_0x4f76f1/_0x5035ee;_0x26bf67=(_0x1dd228*_0x16a0f9+_0x39254c)/_0x42d1f7;_0xbdf98d=utils['erlangb'](_0x26bf67,_0x2ed077);_0x38a917=_0x26bf67/_0x2ed077*(0x1-utils[_0x204e('0x21e')](_0x26bf67,_0x2ed077));}return _0x18c330({'erlangCalls':_0x4f76f1,'erlangCallToSecond':_0x5035ee/_0x4f76f1,'erlangAbandonmentRate':_0xbdf98d,'erlangBusyFactor':_0x38a917});});};Dialer[_0x204e('0x87')][_0x204e('0x1d9')]=function(_0x47d653,_0x117ad0,_0x429a2,_0x43df4e,_0x29018f,_0x55e981){loggerPredictive[_0x204e('0x42')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x204e('0x42')](_0x204e('0x214'),_0x47d653);loggerPredictive['info'](_0x204e('0x215'),_0x117ad0);loggerPredictive[_0x204e('0x42')]('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',_0x429a2);loggerPredictive[_0x204e('0x42')](_0x204e('0x217'),_0x43df4e);loggerPredictive[_0x204e('0x42')](_0x204e('0x21f'),_0x29018f);loggerPredictive[_0x204e('0x42')](_0x204e('0x4d'));return new Promise(function(_0x46f674,_0x7a8901){if(_0x47d653<=0x0||isNaN(_0x47d653)){return _0x7a8901(msgResponse(_0x204e('0x220'),'Error',_0x204e('0x21a')+_0x47d653));}if(_0x429a2<=0x0||isNaN(_0x429a2)){return _0x7a8901(msgResponse('[busyFactor]','Error',_0x204e('0x21b')+_0x429a2));}if(_0x43df4e<=0x0||isNaN(_0x43df4e)){return _0x7a8901(msgResponse(_0x204e('0x220'),_0x204e('0x80'),'p\x20=\x20'+_0x43df4e));}if(_0x117ad0<=0x0||isNaN(_0x117ad0)){return _0x7a8901(msgResponse(_0x204e('0x220'),_0x204e('0x80'),'interval\x20=\x20'+_0x117ad0));}if(_0x29018f<=0x0||isNaN(_0x29018f)){return _0x7a8901(msgResponse('[busyFactor]',_0x204e('0x80'),_0x204e('0x221')+_0x29018f));}_0x55e981=_0x55e981||0x0;var _0x106829=0x1/_0x429a2;var _0x73c44f=0x0;var _0x4b6876=0x0;var _0x1f3b78=0x0;var _0x1782e6=0x0;for(var _0x50b4d7=0x0;_0x1782e6<_0x29018f;_0x50b4d7+=0x1){_0x4b6876=_0x50b4d7/_0x117ad0;_0x73c44f=(_0x43df4e*_0x4b6876+_0x55e981)/_0x106829;_0x1f3b78=utils[_0x204e('0x21e')](_0x73c44f,_0x47d653);_0x1782e6=_0x73c44f/_0x47d653*(0x1-utils[_0x204e('0x21e')](_0x73c44f,_0x47d653));}return _0x46f674({'erlangCalls':_0x50b4d7,'erlangCallToSecond':_0x117ad0/_0x50b4d7,'erlangAbandonmentRate':_0x1f3b78,'erlangBusyFactor':_0x1782e6});});};module[_0x204e('0x222')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 508f43f..eb90d41 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb288=['number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','getCaller','dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xb288,0xa5));var _0x8b28=function(_0x1cb10f,_0xa8d671){_0x1cb10f=_0x1cb10f-0x0;var _0x48ae7c=_0xb288[_0x1cb10f];return _0x48ae7c;};'use strict';var util=require('util');var _=require(_0x8b28('0x0'));var moment=require(_0x8b28('0x1'));function checkNameSurname(_0x1aab2f,_0xa978c0,_0x47e6e6){var _0x3da5df='';if(!_[_0x8b28('0x2')](_0xa978c0)&&_0x8b28('0x3')===typeof _0xa978c0){_0x3da5df+=_0xa978c0;}if(!_[_0x8b28('0x2')](_0x47e6e6)&&_0x8b28('0x3')===typeof _0x47e6e6){_0x3da5df+='\x20'+_0x47e6e6;}if(_0x3da5df!==''){return _0x3da5df;}return _0x1aab2f;}function Action(_0x3c9f58,_0x397273,_0x7736db){this[_0x8b28('0x4')]=_0x3c9f58;this[_0x8b28('0x5')]=_0x7736db||undefined;this[_0x8b28('0x6')]=checkNameSurname(_0x397273[_0x8b28('0x7')][_0x8b28('0x8')],_0x397273[_0x8b28('0x7')][_0x8b28('0x9')],_0x397273['Contact'][_0x8b28('0xa')]);this[_0x8b28('0xb')]=_0x397273['phone'];this[_0x8b28('0xc')]=_0x3c9f58[_0x8b28('0x6')];this[_0x8b28('0xd')]=_0x397273[_0x8b28('0xd')]||![];this['type']=_0x3c9f58[_0x8b28('0xe')];this[_0x8b28('0xf')]=_0x3c9f58['dialQueueTimeout']||0x3;this['scheduledat']=_0x397273[_0x8b28('0x10')];this[_0x8b28('0x11')]=_0x397273[_0x8b28('0x11')];this[_0x8b28('0x12')]=_0x397273[_0x8b28('0x12')];this[_0x8b28('0x13')]=_0x397273[_0x8b28('0x13')];this[_0x8b28('0x14')]=_0x397273[_0x8b28('0x14')];this['countdropretry']=_0x397273[_0x8b28('0x15')];this[_0x8b28('0x16')]=_0x397273[_0x8b28('0x16')];this[_0x8b28('0x17')]=_0x397273[_0x8b28('0x17')];this[_0x8b28('0x18')]=_0x397273['countagentrejectretry'];this['ContactId']=_0x397273['ContactId'];this[_0x8b28('0x19')]=_0x397273[_0x8b28('0x19')];this[_0x8b28('0x1a')]=_0x397273[_0x8b28('0x1a')];this[_0x8b28('0x1b')]=_0x397273[_0x8b28('0x1b')];this[_0x8b28('0x1c')]=_0x397273[_0x8b28('0x1c')];this[_0x8b28('0x1d')]=_0x397273['id'];this['ContactFirstName']=_0x397273[_0x8b28('0x7')][_0x8b28('0x9')]||'';this[_0x8b28('0x1e')]=moment()[_0x8b28('0x1f')](_0x8b28('0x20'));this[_0x8b28('0x21')]=_0x397273[_0x8b28('0x21')];this[_0x8b28('0x22')]=_0x397273['callbackuniqueid'];this[_0x8b28('0x23')]=_0x397273['callbackat'];this[_0x8b28('0x24')]=_0x397273[_0x8b28('0x24')];this[_0x8b28('0x25')]='';this['originatecalleridname']='';}Action['prototype'][_0x8b28('0x26')]=function(){return util[_0x8b28('0x1f')]('\x22%s\x22\x20<%s>',this[_0x8b28('0x6')],this['voiceQueue'][_0x8b28('0x27')]>0x0?this[_0x8b28('0xb')][_0x8b28('0x28')](this[_0x8b28('0x4')][_0x8b28('0x27')]):this[_0x8b28('0xb')]);};Action[_0x8b28('0x29')][_0x8b28('0x2a')]=function(){return this[_0x8b28('0xc')];};module[_0x8b28('0x2b')]=Action; \ No newline at end of file +var _0xae80=['lodash','moment','string','voiceQueue','uniqueid','Contact','phone','firstName','number','queue','name','active','type','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','dialCutDigit','prototype','getQueue','exports','util'];(function(_0x3fa69b,_0x174056){var _0x548616=function(_0x3346db){while(--_0x3346db){_0x3fa69b['push'](_0x3fa69b['shift']());}};_0x548616(++_0x174056);}(_0xae80,0xd1));var _0x0ae8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xae80[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0x0ae8('0x0'));var _=require(_0x0ae8('0x1'));var moment=require(_0x0ae8('0x2'));function checkNameSurname(_0x2bdea0,_0xd69a89,_0x58df9e){var _0x4d360c='';if(!_['isNil'](_0xd69a89)&&_0x0ae8('0x3')===typeof _0xd69a89){_0x4d360c+=_0xd69a89;}if(!_['isNil'](_0x58df9e)&&_0x0ae8('0x3')===typeof _0x58df9e){_0x4d360c+='\x20'+_0x58df9e;}if(_0x4d360c!==''){return _0x4d360c;}return _0x2bdea0;}function Action(_0x3c94bf,_0xee2cfd,_0x37bb09){this[_0x0ae8('0x4')]=_0x3c94bf;this[_0x0ae8('0x5')]=_0x37bb09||undefined;this['name']=checkNameSurname(_0xee2cfd[_0x0ae8('0x6')][_0x0ae8('0x7')],_0xee2cfd[_0x0ae8('0x6')][_0x0ae8('0x8')],_0xee2cfd[_0x0ae8('0x6')]['lastName']);this[_0x0ae8('0x9')]=_0xee2cfd[_0x0ae8('0x7')];this[_0x0ae8('0xa')]=_0x3c94bf[_0x0ae8('0xb')];this['active']=_0xee2cfd[_0x0ae8('0xc')]||![];this[_0x0ae8('0xd')]=_0x3c94bf[_0x0ae8('0xd')];this['dialQueueTimeout']=_0x3c94bf['dialQueueTimeout']||0x3;this[_0x0ae8('0xe')]=_0xee2cfd[_0x0ae8('0xe')];this[_0x0ae8('0xf')]=_0xee2cfd[_0x0ae8('0xf')];this[_0x0ae8('0x10')]=_0xee2cfd[_0x0ae8('0x10')];this['countnoanswerretry']=_0xee2cfd[_0x0ae8('0x11')];this[_0x0ae8('0x12')]=_0xee2cfd['countnosuchnumberretry'];this[_0x0ae8('0x13')]=_0xee2cfd[_0x0ae8('0x13')];this[_0x0ae8('0x14')]=_0xee2cfd['countabandonedretry'];this[_0x0ae8('0x15')]=_0xee2cfd[_0x0ae8('0x15')];this[_0x0ae8('0x16')]=_0xee2cfd[_0x0ae8('0x16')];this[_0x0ae8('0x17')]=_0xee2cfd['ContactId'];this[_0x0ae8('0x18')]=_0xee2cfd[_0x0ae8('0x18')];this[_0x0ae8('0x19')]=_0xee2cfd[_0x0ae8('0x19')];this[_0x0ae8('0x1a')]=_0xee2cfd['VoiceQueueId'];this['CampaignId']=_0xee2cfd[_0x0ae8('0x1b')];this['idHopper']=_0xee2cfd['id'];this[_0x0ae8('0x1c')]=_0xee2cfd[_0x0ae8('0x6')][_0x0ae8('0x8')]||'';this[_0x0ae8('0x1d')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x0ae8('0x1e')]=_0xee2cfd['callback'];this[_0x0ae8('0x1f')]=_0xee2cfd[_0x0ae8('0x1f')];this['callbackat']=_0xee2cfd['callbackat'];this[_0x0ae8('0x20')]=_0xee2cfd['recallme'];this[_0x0ae8('0x21')]='';this[_0x0ae8('0x22')]='';}Action['prototype'][_0x0ae8('0x23')]=function(){return util[_0x0ae8('0x24')](_0x0ae8('0x25'),this[_0x0ae8('0xb')],this['voiceQueue'][_0x0ae8('0x26')]>0x0?this[_0x0ae8('0x9')]['substring'](this[_0x0ae8('0x4')][_0x0ae8('0x26')]):this[_0x0ae8('0x9')]);};Action[_0x0ae8('0x27')][_0x0ae8('0x28')]=function(){return this[_0x0ae8('0xa')];};module[_0x0ae8('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 5fd9dac..c79fc7f 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd6fa=['countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','answertime','format','ringtime','holdtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','scheduledat','campaigntype','type','outbound','queue'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xd6fa,0x7c));var _0xad6f=function(_0x2d3d0d,_0x67ac82){_0x2d3d0d=_0x2d3d0d-0x0;var _0xca35b6=_0xd6fa[_0x2d3d0d];return _0xca35b6;};'use strict';var moment=require('moment');var utils=require(_0xad6f('0x0'));function AgentComplete(_0x504cfd,_0x1bd4d1){this[_0xad6f('0x1')]=0x4;this[_0xad6f('0x2')]='Answer';this[_0xad6f('0x3')]=_0x504cfd['scheduledat'];this['type']=_0x504cfd['type'];this[_0xad6f('0x4')]=_0x504cfd[_0xad6f('0x5')]===_0xad6f('0x6')?_0xad6f('0x7'):_0x504cfd[_0xad6f('0x5')];this['countbusyretry']=_0x504cfd['countbusyretry'];this['countcongestionretry']=_0x504cfd[_0xad6f('0x8')];this[_0xad6f('0x9')]=_0x504cfd[_0xad6f('0x9')];this[_0xad6f('0xa')]=_0x504cfd[_0xad6f('0xb')]+_0x504cfd[_0xad6f('0x8')]+_0x504cfd[_0xad6f('0x9')]+_0x504cfd[_0xad6f('0xc')]+_0x504cfd['countdropretry']+_0x504cfd[_0xad6f('0xd')]+_0x504cfd[_0xad6f('0xe')]+_0x504cfd[_0xad6f('0xf')];this[_0xad6f('0xc')]=_0x504cfd['countnosuchnumberretry'];this[_0xad6f('0x10')]=_0x504cfd['countdropretry'];this['countabandonedretry']=_0x504cfd[_0xad6f('0xd')];this[_0xad6f('0xe')]=_0x504cfd['countmachineretry'];this['countagentrejectretry']=_0x504cfd[_0xad6f('0xf')];this[_0xad6f('0x11')]=_0x1bd4d1['uniqueid'];this[_0xad6f('0x12')]=_0x504cfd['name'];this[_0xad6f('0x13')]=_0x504cfd[_0xad6f('0x14')];this[_0xad6f('0x15')]=_0x504cfd[_0xad6f('0x15')];this['responsetime']=_0x504cfd[_0xad6f('0x16')];this[_0xad6f('0x17')]=_0x504cfd['answertime'];this['endtime']=moment()[_0xad6f('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xad6f('0x19')]=utils['getSeconds'](_0x504cfd[_0xad6f('0x16')],_0x504cfd['starttime']);this[_0xad6f('0x1a')]=utils[_0xad6f('0x1b')](_0x504cfd['answertime'],_0x504cfd[_0xad6f('0x16')]);this[_0xad6f('0x1c')]=utils[_0xad6f('0x1b')](this['endtime'],_0x504cfd[_0xad6f('0x17')]);this[_0xad6f('0x7')]=_0x1bd4d1[_0xad6f('0x7')];this[_0xad6f('0x1d')]=_0x1bd4d1[_0xad6f('0x1d')];this[_0xad6f('0x1e')]=_0x1bd4d1[_0xad6f('0x1e')];this['callback']=_0x504cfd[_0xad6f('0x1f')];this[_0xad6f('0x20')]=_0x504cfd['callbackuniqueid'];this['callbackat']=_0x504cfd[_0xad6f('0x21')];this[_0xad6f('0x22')]=_0x504cfd[_0xad6f('0x22')];this[_0xad6f('0x23')]=_0x504cfd[_0xad6f('0x23')];this[_0xad6f('0x24')]=_0x504cfd['ListId'];this[_0xad6f('0x25')]=_0x504cfd[_0xad6f('0x25')];this[_0xad6f('0x26')]=_0x504cfd[_0xad6f('0x26')];this[_0xad6f('0x27')]=_0x504cfd['CampaignId'];this['originatecalleridnum']=_0x504cfd[_0xad6f('0x28')]||'';this[_0xad6f('0x29')]=_0x504cfd[_0xad6f('0x29')]||'';this[_0xad6f('0x2a')]=_0x504cfd[_0xad6f('0x2a')];}module[_0xad6f('0x2b')]=AgentComplete; \ No newline at end of file +var _0xccfe=['countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xccfe,0x1c6));var _0xeccf=function(_0x38cb08,_0x4a19a9){_0x38cb08=_0x38cb08-0x0;var _0x525b03=_0xccfe[_0x38cb08];return _0x525b03;};'use strict';var moment=require('moment');var utils=require(_0xeccf('0x0'));function AgentComplete(_0xaec15e,_0x25a439){this[_0xeccf('0x1')]=0x4;this[_0xeccf('0x2')]=_0xeccf('0x3');this['scheduledat']=_0xaec15e[_0xeccf('0x4')];this[_0xeccf('0x5')]=_0xaec15e[_0xeccf('0x5')];this[_0xeccf('0x6')]=_0xaec15e[_0xeccf('0x5')]===_0xeccf('0x7')?_0xeccf('0x8'):_0xaec15e[_0xeccf('0x5')];this[_0xeccf('0x9')]=_0xaec15e[_0xeccf('0x9')];this[_0xeccf('0xa')]=_0xaec15e[_0xeccf('0xa')];this['countnoanswerretry']=_0xaec15e[_0xeccf('0xb')];this[_0xeccf('0xc')]=_0xaec15e[_0xeccf('0x9')]+_0xaec15e[_0xeccf('0xa')]+_0xaec15e[_0xeccf('0xb')]+_0xaec15e[_0xeccf('0xd')]+_0xaec15e[_0xeccf('0xe')]+_0xaec15e[_0xeccf('0xf')]+_0xaec15e[_0xeccf('0x10')]+_0xaec15e[_0xeccf('0x11')];this[_0xeccf('0xd')]=_0xaec15e[_0xeccf('0xd')];this[_0xeccf('0xe')]=_0xaec15e[_0xeccf('0xe')];this[_0xeccf('0xf')]=_0xaec15e[_0xeccf('0xf')];this[_0xeccf('0x10')]=_0xaec15e[_0xeccf('0x10')];this[_0xeccf('0x11')]=_0xaec15e[_0xeccf('0x11')];this[_0xeccf('0x12')]=_0x25a439['uniqueid'];this[_0xeccf('0x13')]=_0xaec15e[_0xeccf('0x14')];this[_0xeccf('0x15')]=_0xaec15e[_0xeccf('0x16')];this[_0xeccf('0x17')]=_0xaec15e[_0xeccf('0x17')];this['responsetime']=_0xaec15e[_0xeccf('0x18')];this[_0xeccf('0x19')]=_0xaec15e[_0xeccf('0x19')];this[_0xeccf('0x1a')]=moment()[_0xeccf('0x1b')](_0xeccf('0x1c'));this[_0xeccf('0x1d')]=utils[_0xeccf('0x1e')](_0xaec15e[_0xeccf('0x18')],_0xaec15e['starttime']);this['holdtime']=utils[_0xeccf('0x1e')](_0xaec15e[_0xeccf('0x19')],_0xaec15e[_0xeccf('0x18')]);this[_0xeccf('0x1f')]=utils[_0xeccf('0x1e')](this[_0xeccf('0x1a')],_0xaec15e[_0xeccf('0x19')]);this[_0xeccf('0x8')]=_0x25a439['queue'];this[_0xeccf('0x20')]=_0x25a439[_0xeccf('0x20')];this[_0xeccf('0x21')]=_0x25a439[_0xeccf('0x21')];this[_0xeccf('0x22')]=_0xaec15e['callback'];this['callbackuniqueid']=_0xaec15e[_0xeccf('0x23')];this['callbackat']=_0xaec15e[_0xeccf('0x24')];this[_0xeccf('0x25')]=_0xaec15e[_0xeccf('0x25')];this[_0xeccf('0x26')]=_0xaec15e['ContactId'];this['ListId']=_0xaec15e[_0xeccf('0x27')];this[_0xeccf('0x28')]=_0xaec15e[_0xeccf('0x28')];this[_0xeccf('0x29')]=_0xaec15e[_0xeccf('0x29')];this[_0xeccf('0x2a')]=_0xaec15e[_0xeccf('0x2a')];this['originatecalleridnum']=_0xaec15e[_0xeccf('0x2b')]||'';this[_0xeccf('0x2c')]=_0xaec15e[_0xeccf('0x2c')]||'';this['agiafterat']=_0xaec15e[_0xeccf('0x2d')];}module[_0xeccf('0x2e')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 65f203c..152c582 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcde8=['countmachineretry','countagentrejectretry','calleridname','calleridnum','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x17e666,_0x415452){var _0x5e63cb=function(_0x3d2a95){while(--_0x3d2a95){_0x17e666['push'](_0x17e666['shift']());}};_0x5e63cb(++_0x415452);}(_0xcde8,0x15f));var _0x8cde=function(_0x592c46,_0x3255c8){_0x592c46=_0x592c46-0x0;var _0x3decaf=_0xcde8[_0x592c46];return _0x3decaf;};'use strict';function Final(_0x337fe3){this[_0x8cde('0x0')]=_0x337fe3['uniqueid'];this[_0x8cde('0x1')]=_0x337fe3[_0x8cde('0x1')];this[_0x8cde('0x2')]=_0x337fe3['type'];this[_0x8cde('0x3')]=_0x337fe3[_0x8cde('0x2')]===_0x8cde('0x4')?_0x8cde('0x5'):_0x337fe3[_0x8cde('0x2')];this['countbusyretry']=_0x337fe3[_0x8cde('0x6')];this[_0x8cde('0x7')]=_0x337fe3[_0x8cde('0x7')];this[_0x8cde('0x8')]=_0x337fe3[_0x8cde('0x8')];this['countglobal']=_0x337fe3[_0x8cde('0x6')]+_0x337fe3[_0x8cde('0x7')]+_0x337fe3[_0x8cde('0x8')]+_0x337fe3[_0x8cde('0x9')]+_0x337fe3[_0x8cde('0xa')]+_0x337fe3[_0x8cde('0xb')]+_0x337fe3[_0x8cde('0xc')]+_0x337fe3[_0x8cde('0xd')];this[_0x8cde('0x9')]=_0x337fe3[_0x8cde('0x9')];this[_0x8cde('0xa')]=_0x337fe3['countdropretry'];this[_0x8cde('0xb')]=_0x337fe3[_0x8cde('0xb')];this['countmachineretry']=_0x337fe3[_0x8cde('0xc')];this[_0x8cde('0xd')]=_0x337fe3[_0x8cde('0xd')];this['queue']=_0x337fe3[_0x8cde('0x5')];this[_0x8cde('0xe')]=_0x337fe3[_0x8cde('0xe')];this[_0x8cde('0xf')]=_0x337fe3['calleridnum'];this['starttime']=_0x337fe3['starttime'];this[_0x8cde('0x10')]=_0x337fe3[_0x8cde('0x10')];this[_0x8cde('0x11')]=_0x337fe3[_0x8cde('0x10')];this['ringtime']=_0x337fe3['ringtime']||0x0;this[_0x8cde('0x12')]=_0x337fe3[_0x8cde('0x12')]||0x0;this[_0x8cde('0x13')]=_0x337fe3[_0x8cde('0x13')]||0x0;this[_0x8cde('0x14')]=_0x337fe3[_0x8cde('0x14')];this[_0x8cde('0x15')]=_0x337fe3[_0x8cde('0x15')];this[_0x8cde('0x16')]=_0x337fe3[_0x8cde('0x16')];this[_0x8cde('0x17')]=_0x337fe3['recallme'];this[_0x8cde('0x18')]=_0x337fe3['ContactId'];this['ListId']=_0x337fe3['ListId'];this['UserId']=_0x337fe3[_0x8cde('0x19')];this[_0x8cde('0x1a')]=_0x337fe3[_0x8cde('0x1a')];this['CampaignId']=_0x337fe3[_0x8cde('0x1b')];this[_0x8cde('0x1c')]=_0x337fe3['originatecalleridnum']||'';this[_0x8cde('0x1d')]=_0x337fe3['originatecalleridname']||'';this[_0x8cde('0x1e')]=_0x337fe3['state'];this[_0x8cde('0x1f')]=_0x337fe3[_0x8cde('0x1f')];}module[_0x8cde('0x20')]=Final; \ No newline at end of file +var _0x70f5=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','starttime','responsetime','endtime','ringtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x1a017e,_0x349a22){var _0x3cccb4=function(_0x579b4e){while(--_0x579b4e){_0x1a017e['push'](_0x1a017e['shift']());}};_0x3cccb4(++_0x349a22);}(_0x70f5,0x196));var _0x570f=function(_0x1d7b03,_0x330a1a){_0x1d7b03=_0x1d7b03-0x0;var _0x5ee10a=_0x70f5[_0x1d7b03];return _0x5ee10a;};'use strict';function Final(_0x509780){this[_0x570f('0x0')]=_0x509780['uniqueid'];this[_0x570f('0x1')]=_0x509780['scheduledat'];this[_0x570f('0x2')]=_0x509780[_0x570f('0x2')];this[_0x570f('0x3')]=_0x509780[_0x570f('0x2')]==='outbound'?_0x570f('0x4'):_0x509780['type'];this[_0x570f('0x5')]=_0x509780[_0x570f('0x5')];this[_0x570f('0x6')]=_0x509780[_0x570f('0x6')];this['countnoanswerretry']=_0x509780[_0x570f('0x7')];this[_0x570f('0x8')]=_0x509780[_0x570f('0x5')]+_0x509780['countcongestionretry']+_0x509780[_0x570f('0x7')]+_0x509780[_0x570f('0x9')]+_0x509780[_0x570f('0xa')]+_0x509780[_0x570f('0xb')]+_0x509780[_0x570f('0xc')]+_0x509780[_0x570f('0xd')];this[_0x570f('0x9')]=_0x509780[_0x570f('0x9')];this[_0x570f('0xa')]=_0x509780[_0x570f('0xa')];this['countabandonedretry']=_0x509780[_0x570f('0xb')];this['countmachineretry']=_0x509780[_0x570f('0xc')];this['countagentrejectretry']=_0x509780[_0x570f('0xd')];this[_0x570f('0x4')]=_0x509780[_0x570f('0x4')];this['calleridname']=_0x509780[_0x570f('0xe')];this['calleridnum']=_0x509780['calleridnum'];this[_0x570f('0xf')]=_0x509780['starttime'];this[_0x570f('0x10')]=_0x509780[_0x570f('0x10')];this[_0x570f('0x11')]=_0x509780['responsetime'];this[_0x570f('0x12')]=_0x509780['ringtime']||0x0;this['holdtime']=_0x509780['holdtime']||0x0;this[_0x570f('0x13')]=_0x509780[_0x570f('0x13')]||0x0;this[_0x570f('0x14')]=_0x509780[_0x570f('0x14')];this['callbackuniqueid']=_0x509780[_0x570f('0x15')];this[_0x570f('0x16')]=_0x509780[_0x570f('0x16')];this[_0x570f('0x17')]=_0x509780['recallme'];this[_0x570f('0x18')]=_0x509780['ContactId'];this[_0x570f('0x19')]=_0x509780[_0x570f('0x19')];this['UserId']=_0x509780[_0x570f('0x1a')];this[_0x570f('0x1b')]=_0x509780['VoiceQueueId'];this['CampaignId']=_0x509780[_0x570f('0x1c')];this[_0x570f('0x1d')]=_0x509780[_0x570f('0x1d')]||'';this[_0x570f('0x1e')]=_0x509780[_0x570f('0x1e')]||'';this[_0x570f('0x1f')]=_0x509780[_0x570f('0x1f')];this[_0x570f('0x20')]=_0x509780['statedesc'];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index c1efe7a..bc7322c 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9a07=['scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','../utils','state','statedesc','Answer'];(function(_0x2d8a23,_0x522080){var _0xd7bce1=function(_0x6adbdd){while(--_0x6adbdd){_0x2d8a23['push'](_0x2d8a23['shift']());}};_0xd7bce1(++_0x522080);}(_0x9a07,0x175));var _0x79a0=function(_0xc1c1ce,_0x4d7608){_0xc1c1ce=_0xc1c1ce-0x0;var _0x5f3715=_0x9a07[_0xc1c1ce];return _0x5f3715;};'use strict';var moment=require(_0x79a0('0x0'));var utils=require(_0x79a0('0x1'));function Hangup(_0x1763c0,_0x16fae0){this[_0x79a0('0x2')]=0x4;this[_0x79a0('0x3')]=_0x79a0('0x4');this[_0x79a0('0x5')]=_0x1763c0['scheduledat'];this[_0x79a0('0x6')]=_0x1763c0[_0x79a0('0x6')];this['campaigntype']=_0x1763c0['type']===_0x79a0('0x7')?_0x79a0('0x8'):_0x1763c0[_0x79a0('0x6')];this['amd']=_0x1763c0[_0x79a0('0x9')]||![];this[_0x79a0('0xa')]=_0x1763c0['countbusyretry'];this[_0x79a0('0xb')]=_0x1763c0['countcongestionretry'];this['countnoanswerretry']=_0x1763c0[_0x79a0('0xc')];this[_0x79a0('0xd')]=_0x1763c0[_0x79a0('0xa')]+_0x1763c0[_0x79a0('0xb')]+_0x1763c0[_0x79a0('0xc')]+_0x1763c0[_0x79a0('0xe')]+_0x1763c0[_0x79a0('0xf')]+_0x1763c0[_0x79a0('0x10')]+_0x1763c0['countmachineretry']+_0x1763c0[_0x79a0('0x11')];this[_0x79a0('0xe')]=_0x1763c0[_0x79a0('0xe')];this[_0x79a0('0xf')]=_0x1763c0[_0x79a0('0xf')];this[_0x79a0('0x10')]=_0x1763c0[_0x79a0('0x10')];this['countmachineretry']=_0x1763c0[_0x79a0('0x12')];this['countagentrejectretry']=_0x1763c0[_0x79a0('0x11')];this['uniqueid']=_0x16fae0['uniqueid'];this[_0x79a0('0x13')]=_0x1763c0[_0x79a0('0x14')];this[_0x79a0('0x15')]=_0x1763c0['number'];this[_0x79a0('0x16')]=_0x1763c0[_0x79a0('0x16')];this['responsetime']=_0x1763c0[_0x79a0('0x17')];this[_0x79a0('0x18')]=moment()[_0x79a0('0x19')](_0x79a0('0x1a'));this[_0x79a0('0x1b')]=utils[_0x79a0('0x1c')](_0x1763c0[_0x79a0('0x17')],_0x1763c0[_0x79a0('0x16')]);this[_0x79a0('0x1d')]=0x0;this[_0x79a0('0x1e')]=utils['getSeconds'](this[_0x79a0('0x18')],_0x1763c0[_0x79a0('0x17')]);this[_0x79a0('0x8')]=_0x1763c0[_0x79a0('0x8')];this[_0x79a0('0x1f')]='IVR';this['reason']=_0x16fae0[_0x79a0('0x20')];this[_0x79a0('0x21')]=_0x1763c0['callback'];this[_0x79a0('0x22')]=_0x1763c0[_0x79a0('0x22')];this[_0x79a0('0x23')]=_0x1763c0[_0x79a0('0x23')];this['recallme']=_0x1763c0[_0x79a0('0x24')];this[_0x79a0('0x25')]=_0x1763c0[_0x79a0('0x25')];this[_0x79a0('0x26')]=_0x1763c0[_0x79a0('0x26')];this[_0x79a0('0x27')]=_0x1763c0['UserId'];this[_0x79a0('0x28')]=_0x1763c0[_0x79a0('0x28')];this['CampaignId']=_0x1763c0['CampaignId'];}module[_0x79a0('0x29')]=Hangup; \ No newline at end of file +var _0x06c7=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x5b0015,_0x1b7cd2){var _0x3d59f5=function(_0x1fcd1d){while(--_0x1fcd1d){_0x5b0015['push'](_0x5b0015['shift']());}};_0x3d59f5(++_0x1b7cd2);}(_0x06c7,0x125));var _0x706c=function(_0x4ed142,_0x116701){_0x4ed142=_0x4ed142-0x0;var _0x332251=_0x06c7[_0x4ed142];return _0x332251;};'use strict';var moment=require(_0x706c('0x0'));var utils=require('../utils');function Hangup(_0x41bf8e,_0xcfb367){this['state']=0x4;this[_0x706c('0x1')]=_0x706c('0x2');this['scheduledat']=_0x41bf8e[_0x706c('0x3')];this[_0x706c('0x4')]=_0x41bf8e[_0x706c('0x4')];this[_0x706c('0x5')]=_0x41bf8e[_0x706c('0x4')]===_0x706c('0x6')?_0x706c('0x7'):_0x41bf8e[_0x706c('0x4')];this['amd']=_0x41bf8e[_0x706c('0x8')]||![];this['countbusyretry']=_0x41bf8e[_0x706c('0x9')];this['countcongestionretry']=_0x41bf8e[_0x706c('0xa')];this[_0x706c('0xb')]=_0x41bf8e[_0x706c('0xb')];this[_0x706c('0xc')]=_0x41bf8e[_0x706c('0x9')]+_0x41bf8e[_0x706c('0xa')]+_0x41bf8e[_0x706c('0xb')]+_0x41bf8e[_0x706c('0xd')]+_0x41bf8e[_0x706c('0xe')]+_0x41bf8e[_0x706c('0xf')]+_0x41bf8e[_0x706c('0x10')]+_0x41bf8e[_0x706c('0x11')];this[_0x706c('0xd')]=_0x41bf8e['countnosuchnumberretry'];this[_0x706c('0xe')]=_0x41bf8e[_0x706c('0xe')];this[_0x706c('0xf')]=_0x41bf8e[_0x706c('0xf')];this['countmachineretry']=_0x41bf8e[_0x706c('0x10')];this[_0x706c('0x11')]=_0x41bf8e[_0x706c('0x11')];this[_0x706c('0x12')]=_0xcfb367[_0x706c('0x12')];this[_0x706c('0x13')]=_0x41bf8e[_0x706c('0x14')];this['calleridnum']=_0x41bf8e[_0x706c('0x15')];this[_0x706c('0x16')]=_0x41bf8e['starttime'];this[_0x706c('0x17')]=_0x41bf8e['responsetime'];this[_0x706c('0x18')]=moment()['format'](_0x706c('0x19'));this[_0x706c('0x1a')]=utils[_0x706c('0x1b')](_0x41bf8e['responsetime'],_0x41bf8e[_0x706c('0x16')]);this[_0x706c('0x1c')]=0x0;this[_0x706c('0x1d')]=utils['getSeconds'](this[_0x706c('0x18')],_0x41bf8e['responsetime']);this[_0x706c('0x7')]=_0x41bf8e[_0x706c('0x7')];this['membername']=_0x706c('0x1e');this[_0x706c('0x1f')]=_0xcfb367[_0x706c('0x20')];this['callback']=_0x41bf8e[_0x706c('0x21')];this['callbackuniqueid']=_0x41bf8e[_0x706c('0x22')];this[_0x706c('0x23')]=_0x41bf8e[_0x706c('0x23')];this[_0x706c('0x24')]=_0x41bf8e[_0x706c('0x24')];this[_0x706c('0x25')]=_0x41bf8e[_0x706c('0x25')];this[_0x706c('0x26')]=_0x41bf8e['ListId'];this[_0x706c('0x27')]=_0x41bf8e[_0x706c('0x27')];this[_0x706c('0x28')]=_0x41bf8e[_0x706c('0x28')];this[_0x706c('0x29')]=_0x41bf8e['CampaignId'];}module[_0x706c('0x2a')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 84a31d2..015b650 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf22f=['countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','name','calleridnum','number','starttime','endtime','responsetime','ringtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','queue','countcongestionretry','countnoanswerretry'];(function(_0x4b2e6f,_0x1e2bf5){var _0x3bda6f=function(_0x44d545){while(--_0x44d545){_0x4b2e6f['push'](_0x4b2e6f['shift']());}};_0x3bda6f(++_0x1e2bf5);}(_0xf22f,0x94));var _0xff22=function(_0x308888,_0x4610f0){_0x308888=_0x308888-0x0;var _0x4dc534=_0xf22f[_0x308888];return _0x4dc534;};'use strict';var utils=require(_0xff22('0x0'));function History(_0x42634e){this[_0xff22('0x1')]=_0x42634e[_0xff22('0x1')];this[_0xff22('0x2')]=_0x42634e['scheduledat']||undefined;this[_0xff22('0x3')]=_0x42634e[_0xff22('0x3')];this[_0xff22('0x4')]=_0x42634e[_0xff22('0x3')]==='outbound'?_0xff22('0x5'):_0x42634e[_0xff22('0x3')];this['countbusyretry']=_0x42634e['countbusyretry'];this[_0xff22('0x6')]=_0x42634e[_0xff22('0x6')];this[_0xff22('0x7')]=_0x42634e[_0xff22('0x7')];this[_0xff22('0x8')]=_0x42634e[_0xff22('0x9')]+_0x42634e[_0xff22('0x6')]+_0x42634e[_0xff22('0x7')]+_0x42634e[_0xff22('0xa')]+_0x42634e[_0xff22('0xb')]+_0x42634e['countabandonedretry']+_0x42634e[_0xff22('0xc')]+_0x42634e['countagentrejectretry'];this[_0xff22('0xa')]=_0x42634e[_0xff22('0xa')];this[_0xff22('0xb')]=_0x42634e[_0xff22('0xb')];this[_0xff22('0xd')]=_0x42634e['countabandonedretry'];this['countmachineretry']=_0x42634e[_0xff22('0xc')];this[_0xff22('0xe')]=_0x42634e[_0xff22('0xe')];this['queue']=_0x42634e['queue'];this[_0xff22('0xf')]=_0x42634e[_0xff22('0x10')];this[_0xff22('0x11')]=_0x42634e[_0xff22('0x12')];this[_0xff22('0x13')]=_0x42634e[_0xff22('0x13')];this['responsetime']=_0x42634e['responsetime'];this[_0xff22('0x14')]=_0x42634e[_0xff22('0x15')];this[_0xff22('0x16')]=utils[_0xff22('0x17')](_0x42634e[_0xff22('0x15')],_0x42634e[_0xff22('0x13')]);this['holdtime']=0x0;this[_0xff22('0x18')]=0x0;this['callback']=_0x42634e[_0xff22('0x19')];this['callbackuniqueid']=_0x42634e[_0xff22('0x1a')];this[_0xff22('0x1b')]=_0x42634e[_0xff22('0x1b')];this[_0xff22('0x1c')]=_0x42634e[_0xff22('0x1c')];this[_0xff22('0x1d')]=_0x42634e[_0xff22('0x1d')];this[_0xff22('0x1e')]=_0x42634e[_0xff22('0x1e')];this[_0xff22('0x1f')]=_0x42634e['UserId'];this[_0xff22('0x20')]=_0x42634e[_0xff22('0x20')];this[_0xff22('0x21')]=_0x42634e[_0xff22('0x21')];this['originatecalleridnum']=_0x42634e[_0xff22('0x22')]||'';this[_0xff22('0x23')]=_0x42634e[_0xff22('0x23')]||'';this[_0xff22('0x24')]=_0x42634e[_0xff22('0x24')];this[_0xff22('0x25')]=_0x42634e[_0xff22('0x25')];}module[_0xff22('0x26')]=History; \ No newline at end of file +var _0xfd72=['countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','getSeconds','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound'];(function(_0x1ba273,_0x3a200d){var _0x54d83f=function(_0x2422ad){while(--_0x2422ad){_0x1ba273['push'](_0x1ba273['shift']());}};_0x54d83f(++_0x3a200d);}(_0xfd72,0x6f));var _0x2fd7=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfd72[_0x1facfa];return _0x9ec701;};'use strict';var utils=require(_0x2fd7('0x0'));function History(_0x1b1136){this['uniqueid']=_0x1b1136[_0x2fd7('0x1')];this[_0x2fd7('0x2')]=_0x1b1136[_0x2fd7('0x2')]||undefined;this[_0x2fd7('0x3')]=_0x1b1136[_0x2fd7('0x3')];this[_0x2fd7('0x4')]=_0x1b1136[_0x2fd7('0x3')]===_0x2fd7('0x5')?'queue':_0x1b1136[_0x2fd7('0x3')];this[_0x2fd7('0x6')]=_0x1b1136['countbusyretry'];this['countcongestionretry']=_0x1b1136[_0x2fd7('0x7')];this['countnoanswerretry']=_0x1b1136['countnoanswerretry'];this[_0x2fd7('0x8')]=_0x1b1136[_0x2fd7('0x6')]+_0x1b1136[_0x2fd7('0x7')]+_0x1b1136[_0x2fd7('0x9')]+_0x1b1136[_0x2fd7('0xa')]+_0x1b1136['countdropretry']+_0x1b1136[_0x2fd7('0xb')]+_0x1b1136[_0x2fd7('0xc')]+_0x1b1136[_0x2fd7('0xd')];this[_0x2fd7('0xa')]=_0x1b1136[_0x2fd7('0xa')];this[_0x2fd7('0xe')]=_0x1b1136[_0x2fd7('0xe')];this[_0x2fd7('0xb')]=_0x1b1136[_0x2fd7('0xb')];this[_0x2fd7('0xc')]=_0x1b1136[_0x2fd7('0xc')];this[_0x2fd7('0xd')]=_0x1b1136[_0x2fd7('0xd')];this[_0x2fd7('0xf')]=_0x1b1136[_0x2fd7('0xf')];this[_0x2fd7('0x10')]=_0x1b1136[_0x2fd7('0x11')];this[_0x2fd7('0x12')]=_0x1b1136[_0x2fd7('0x13')];this[_0x2fd7('0x14')]=_0x1b1136[_0x2fd7('0x14')];this[_0x2fd7('0x15')]=_0x1b1136[_0x2fd7('0x15')];this[_0x2fd7('0x16')]=_0x1b1136[_0x2fd7('0x15')];this['ringtime']=utils[_0x2fd7('0x17')](_0x1b1136[_0x2fd7('0x15')],_0x1b1136[_0x2fd7('0x14')]);this['holdtime']=0x0;this[_0x2fd7('0x18')]=0x0;this[_0x2fd7('0x19')]=_0x1b1136[_0x2fd7('0x19')];this[_0x2fd7('0x1a')]=_0x1b1136[_0x2fd7('0x1a')];this['callbackat']=_0x1b1136[_0x2fd7('0x1b')];this[_0x2fd7('0x1c')]=_0x1b1136['recallme'];this['ContactId']=_0x1b1136[_0x2fd7('0x1d')];this[_0x2fd7('0x1e')]=_0x1b1136[_0x2fd7('0x1e')];this['UserId']=_0x1b1136[_0x2fd7('0x1f')];this[_0x2fd7('0x20')]=_0x1b1136['VoiceQueueId'];this[_0x2fd7('0x21')]=_0x1b1136['CampaignId'];this[_0x2fd7('0x22')]=_0x1b1136['originatecalleridnum']||'';this[_0x2fd7('0x23')]=_0x1b1136[_0x2fd7('0x23')]||'';this[_0x2fd7('0x24')]=_0x1b1136[_0x2fd7('0x24')];this['statedesc']=_0x1b1136[_0x2fd7('0x25')];}module[_0x2fd7('0x26')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index f374afa..2c6729c 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc281=['callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime','responsetime','droptime','dropreason','getSeconds','talktime','membername','connectedlinename','reason'];(function(_0x5496fa,_0x335f20){var _0x120796=function(_0x34b0b4){while(--_0x34b0b4){_0x5496fa['push'](_0x5496fa['shift']());}};_0x120796(++_0x335f20);}(_0xc281,0x1c7));var _0x1c28=function(_0x529059,_0x294a33){_0x529059=_0x529059-0x0;var _0x156bc2=_0xc281[_0x529059];return _0x156bc2;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x2dcaa4,_0x22b038){this[_0x1c28('0x0')]=_0x2dcaa4[_0x1c28('0x0')];this[_0x1c28('0x1')]=_0x2dcaa4[_0x1c28('0x1')];this[_0x1c28('0x2')]=_0x2dcaa4['type']===_0x1c28('0x3')?_0x1c28('0x4'):_0x2dcaa4[_0x1c28('0x1')];this['countbusyretry']=_0x2dcaa4[_0x1c28('0x5')];this[_0x1c28('0x6')]=_0x2dcaa4['countcongestionretry'];this[_0x1c28('0x7')]=_0x2dcaa4[_0x1c28('0x7')];this[_0x1c28('0x8')]=_0x2dcaa4[_0x1c28('0x5')]+_0x2dcaa4[_0x1c28('0x6')]+_0x2dcaa4[_0x1c28('0x7')]+_0x2dcaa4[_0x1c28('0x9')]+_0x2dcaa4[_0x1c28('0xa')]+_0x2dcaa4[_0x1c28('0xb')]+_0x2dcaa4['countmachineretry']+_0x2dcaa4[_0x1c28('0xc')];this[_0x1c28('0x9')]=_0x2dcaa4[_0x1c28('0x9')];this['countdropretry']=_0x2dcaa4[_0x1c28('0xa')];this['countabandonedretry']=_0x2dcaa4['countabandonedretry'];this['countmachineretry']=_0x2dcaa4['countmachineretry'];this[_0x1c28('0xc')]=_0x2dcaa4['countagentrejectretry'];this[_0x1c28('0xd')]=_0x22b038['uniqueid'];this[_0x1c28('0xe')]=_0x2dcaa4['name'];this[_0x1c28('0xf')]=_0x2dcaa4['number'];this[_0x1c28('0x10')]=_0x2dcaa4[_0x1c28('0x10')];this['responsetime']=_0x2dcaa4[_0x1c28('0x11')];this[_0x1c28('0x12')]=_0x2dcaa4[_0x1c28('0x12')];this[_0x1c28('0x13')]=_0x2dcaa4[_0x1c28('0x13')];this['endtime']=this['droptime'];this['ringtime']=utils[_0x1c28('0x14')](_0x2dcaa4[_0x1c28('0x11')],_0x2dcaa4['starttime']);this['holdtime']=utils[_0x1c28('0x14')](this['droptime'],_0x2dcaa4['responsetime']);this[_0x1c28('0x15')]=0x0;this[_0x1c28('0x4')]=_0x22b038[_0x1c28('0x4')];this[_0x1c28('0x16')]=_0x22b038[_0x1c28('0x17')];this[_0x1c28('0x18')]=_0x22b038[_0x1c28('0x18')];this[_0x1c28('0x19')]=_0x2dcaa4['callback'];this[_0x1c28('0x1a')]=_0x2dcaa4[_0x1c28('0x1a')];this[_0x1c28('0x1b')]=_0x2dcaa4[_0x1c28('0x1b')];this[_0x1c28('0x1c')]=_0x2dcaa4[_0x1c28('0x1c')];this[_0x1c28('0x1d')]=_0x2dcaa4[_0x1c28('0x1d')];this[_0x1c28('0x1e')]=_0x2dcaa4[_0x1c28('0x1e')];this[_0x1c28('0x1f')]=_0x2dcaa4[_0x1c28('0x1f')];this[_0x1c28('0x20')]=_0x2dcaa4[_0x1c28('0x20')];this[_0x1c28('0x21')]=_0x2dcaa4['CampaignId'];this[_0x1c28('0x22')]=_0x2dcaa4['originatecalleridnum']||'';this[_0x1c28('0x23')]=_0x2dcaa4['originatecalleridname']||'';this[_0x1c28('0x24')]=_0x2dcaa4['agiafterat'];this[_0x1c28('0x25')]=_0x2dcaa4[_0x1c28('0x25')];this[_0x1c28('0x26')]=_0x2dcaa4['statedesc'];}module[_0x1c28('0x27')]=QueueCallerAbandon; \ No newline at end of file +var _0x970c=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','number','starttime','responsetime','droptime','dropreason','endtime','getSeconds','holdtime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','outbound'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0x970c,0xce));var _0xc970=function(_0x158591,_0x13818d){_0x158591=_0x158591-0x0;var _0x19ffb7=_0x970c[_0x158591];return _0x19ffb7;};'use strict';var utils=require(_0xc970('0x0'));function QueueCallerAbandon(_0x4a1805,_0x25928f){this[_0xc970('0x1')]=_0x4a1805[_0xc970('0x1')];this[_0xc970('0x2')]=_0x4a1805[_0xc970('0x2')];this['campaigntype']=_0x4a1805[_0xc970('0x2')]===_0xc970('0x3')?_0xc970('0x4'):_0x4a1805[_0xc970('0x2')];this[_0xc970('0x5')]=_0x4a1805[_0xc970('0x5')];this[_0xc970('0x6')]=_0x4a1805['countcongestionretry'];this[_0xc970('0x7')]=_0x4a1805[_0xc970('0x7')];this[_0xc970('0x8')]=_0x4a1805[_0xc970('0x5')]+_0x4a1805[_0xc970('0x6')]+_0x4a1805[_0xc970('0x7')]+_0x4a1805[_0xc970('0x9')]+_0x4a1805['countdropretry']+_0x4a1805['countabandonedretry']+_0x4a1805[_0xc970('0xa')]+_0x4a1805[_0xc970('0xb')];this[_0xc970('0x9')]=_0x4a1805['countnosuchnumberretry'];this['countdropretry']=_0x4a1805[_0xc970('0xc')];this[_0xc970('0xd')]=_0x4a1805['countabandonedretry'];this[_0xc970('0xa')]=_0x4a1805[_0xc970('0xa')];this[_0xc970('0xb')]=_0x4a1805['countagentrejectretry'];this[_0xc970('0xe')]=_0x25928f[_0xc970('0xe')];this[_0xc970('0xf')]=_0x4a1805[_0xc970('0x10')];this['calleridnum']=_0x4a1805[_0xc970('0x11')];this[_0xc970('0x12')]=_0x4a1805[_0xc970('0x12')];this[_0xc970('0x13')]=_0x4a1805[_0xc970('0x13')];this[_0xc970('0x14')]=_0x4a1805[_0xc970('0x14')];this[_0xc970('0x15')]=_0x4a1805[_0xc970('0x15')];this[_0xc970('0x16')]=this[_0xc970('0x14')];this['ringtime']=utils[_0xc970('0x17')](_0x4a1805[_0xc970('0x13')],_0x4a1805[_0xc970('0x12')]);this[_0xc970('0x18')]=utils['getSeconds'](this[_0xc970('0x14')],_0x4a1805['responsetime']);this['talktime']=0x0;this[_0xc970('0x4')]=_0x25928f[_0xc970('0x4')];this[_0xc970('0x19')]=_0x25928f['connectedlinename'];this[_0xc970('0x1a')]=_0x25928f[_0xc970('0x1a')];this[_0xc970('0x1b')]=_0x4a1805[_0xc970('0x1b')];this[_0xc970('0x1c')]=_0x4a1805[_0xc970('0x1c')];this['callbackat']=_0x4a1805[_0xc970('0x1d')];this[_0xc970('0x1e')]=_0x4a1805['recallme'];this[_0xc970('0x1f')]=_0x4a1805[_0xc970('0x1f')];this[_0xc970('0x20')]=_0x4a1805[_0xc970('0x20')];this['UserId']=_0x4a1805[_0xc970('0x21')];this['VoiceQueueId']=_0x4a1805[_0xc970('0x22')];this[_0xc970('0x23')]=_0x4a1805['CampaignId'];this[_0xc970('0x24')]=_0x4a1805['originatecalleridnum']||'';this[_0xc970('0x25')]=_0x4a1805[_0xc970('0x25')]||'';this[_0xc970('0x26')]=_0x4a1805[_0xc970('0x26')];this['state']=_0x4a1805[_0xc970('0x27')];this[_0xc970('0x28')]=_0x4a1805[_0xc970('0x28')];}module[_0xc970('0x29')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index b222263..068356a 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfdbd=['[createHistory]','createHistory','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','error','[getContactDialer]','getContactDialerIvr','catch','temp','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','[unlockContact]','[moveContactManagedDialer]','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','[avgHandleTime]','avgHandleTime'];(function(_0x3d60f3,_0x56afd9){var _0x5b3695=function(_0x25c588){while(--_0x25c588){_0x3d60f3['push'](_0x3d60f3['shift']());}};_0x5b3695(++_0x56afd9);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x548200,_0x3241b8){_0x548200=_0x548200-0x0;var _0x1a6d74=_0xfdbd[_0x548200];return _0x1a6d74;};'use strict';var util=require(_0xdfdb('0x0'));var logger=require(_0xdfdb('0x1'))(_0xdfdb('0x2'));var cmHopper=require(_0xdfdb('0x3'));var cmHopperAdditionalPhone=require(_0xdfdb('0x4'));var cmHopperBlack=require(_0xdfdb('0x5'));var cmHopperHistory=require(_0xdfdb('0x6'));function inspectError(_0x66533b){return util[_0xdfdb('0x7')](_0x66533b,{'showHidden':![],'depth':null});}function getContactDialer(_0x5945e0,_0x3f5b2d,_0x4a4a3f){return cmHopper[_0xdfdb('0x8')](_0x5945e0['id'],_0x3f5b2d,_0x4a4a3f,_0x5945e0[_0xdfdb('0x9')])['catch'](function(_0x556dc0){_0x5945e0['temp']=0x0;logger[_0xdfdb('0xa')](_0xdfdb('0xb'),inspectError(_0x556dc0));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x11d845,_0x444c19){return cmHopper[_0xdfdb('0xc')](_0x11d845['id'],_0x444c19,_0x11d845[_0xdfdb('0x9')])[_0xdfdb('0xd')](function(_0x1ace28){_0x11d845[_0xdfdb('0xe')]=0x0;logger['error'](_0xdfdb('0xf'),inspectError(_0x1ace28));});}exports[_0xdfdb('0xc')]=getContactDialerIvr;function countReScheduled(_0x527c05){return cmHopper[_0xdfdb('0x10')](_0x527c05)[_0xdfdb('0xd')](function(_0x2bee3b){logger[_0xdfdb('0xa')](_0xdfdb('0x11'),inspectError(_0x2bee3b));});}exports[_0xdfdb('0x10')]=countReScheduled;function rescheduleContact(_0xf5d903){return cmHopper[_0xdfdb('0x12')](_0xf5d903)['catch'](function(_0x48a66a){logger[_0xdfdb('0xa')]('[rescheduleContact]',inspectError(_0x48a66a));});}exports[_0xdfdb('0x12')]=rescheduleContact;function unlockContact(_0x9f3039,_0x11a56a,_0x40bc8a){return cmHopper[_0xdfdb('0x13')](_0x9f3039,_0x11a56a,_0x40bc8a)[_0xdfdb('0xd')](function(_0x54ff23){logger['error'](_0xdfdb('0x14'),inspectError(_0x54ff23));});}exports[_0xdfdb('0x13')]=unlockContact;function moveContactManagedDialer(_0x2c1070){return cmHopper['moveContactManagedDialer'](_0x2c1070)[_0xdfdb('0xd')](function(_0xb677b1){logger[_0xdfdb('0xa')](_0xdfdb('0x15'),inspectError(_0xb677b1));});}exports[_0xdfdb('0x16')]=moveContactManagedDialer;function checkIsBlackList(_0x2294de){return cmHopperBlack[_0xdfdb('0x17')](_0x2294de)[_0xdfdb('0xd')](function(_0x5b8cb5){logger[_0xdfdb('0xa')](_0xdfdb('0x18'),inspectError(_0x5b8cb5));});}exports[_0xdfdb('0x17')]=checkIsBlackList;function checkIsBlackListIvr(_0x5cc70b){return cmHopperBlack[_0xdfdb('0x19')](_0x5cc70b)[_0xdfdb('0xd')](function(_0x2c7dd1){logger['error'](_0xdfdb('0x1a'),inspectError(_0x2c7dd1));});}exports[_0xdfdb('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x334cdd,_0x489fd4,_0x2a80c1){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x334cdd,_0x489fd4,_0x2a80c1)[_0xdfdb('0xd')](function(_0x145350){logger[_0xdfdb('0xa')](_0xdfdb('0x1b'),inspectError(_0x145350));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x4c253e,_0x4363d8,_0x956843){return cmHopperAdditionalPhone[_0xdfdb('0x1c')](_0x4c253e,_0x4363d8,_0x956843)[_0xdfdb('0xd')](function(_0x305954){logger['error'](_0xdfdb('0x1d'),inspectError(_0x305954));});}exports[_0xdfdb('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0xdf3a5c){return cmHopperHistory['avgHandleTime'](_0xdf3a5c)[_0xdfdb('0xd')](function(_0x5df454){logger[_0xdfdb('0xa')](_0xdfdb('0x1e'),inspectError(_0x5df454));});}exports[_0xdfdb('0x1f')]=avgHandleTime;function createHistory(_0x513fa0){return cmHopperHistory['createHistory'](_0x513fa0)[_0xdfdb('0xd')](function(_0xc56435){logger[_0xdfdb('0xa')](_0xdfdb('0x20'),inspectError(_0xc56435));});}exports[_0xdfdb('0x21')]=createHistory; \ No newline at end of file +var _0x3a6d=['avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','[countReScheduled]','countReScheduled','rescheduleContact','[rescheduleContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x3a6d,0x143));var _0xd3a6=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x3a6d[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0xd3a6('0x0'));var logger=require(_0xd3a6('0x1'))('dialer');var cmHopper=require(_0xd3a6('0x2'));var cmHopperAdditionalPhone=require(_0xd3a6('0x3'));var cmHopperBlack=require(_0xd3a6('0x4'));var cmHopperHistory=require(_0xd3a6('0x5'));function inspectError(_0x3d37ff){return util['inspect'](_0x3d37ff,{'showHidden':![],'depth':null});}function getContactDialer(_0x1cb966,_0x27d641,_0x1e44bd){return cmHopper[_0xd3a6('0x6')](_0x1cb966['id'],_0x27d641,_0x1e44bd,_0x1cb966[_0xd3a6('0x7')])[_0xd3a6('0x8')](function(_0x58d83a){_0x1cb966[_0xd3a6('0x9')]=0x0;logger[_0xd3a6('0xa')](_0xd3a6('0xb'),inspectError(_0x58d83a));});}exports[_0xd3a6('0x6')]=getContactDialer;function getContactDialerIvr(_0x14b46b,_0xa67661){return cmHopper[_0xd3a6('0xc')](_0x14b46b['id'],_0xa67661,_0x14b46b[_0xd3a6('0x7')])[_0xd3a6('0x8')](function(_0x5ab5a9){_0x14b46b[_0xd3a6('0x9')]=0x0;logger[_0xd3a6('0xa')](_0xd3a6('0xd'),inspectError(_0x5ab5a9));});}exports[_0xd3a6('0xc')]=getContactDialerIvr;function countReScheduled(_0x2bd4f0){return cmHopper['countReScheduled'](_0x2bd4f0)['catch'](function(_0x4b0467){logger[_0xd3a6('0xa')](_0xd3a6('0xe'),inspectError(_0x4b0467));});}exports[_0xd3a6('0xf')]=countReScheduled;function rescheduleContact(_0x41eca8){return cmHopper[_0xd3a6('0x10')](_0x41eca8)[_0xd3a6('0x8')](function(_0xa56452){logger['error'](_0xd3a6('0x11'),inspectError(_0xa56452));});}exports[_0xd3a6('0x10')]=rescheduleContact;function unlockContact(_0x171a8f,_0x500a37,_0x3c2399){return cmHopper[_0xd3a6('0x12')](_0x171a8f,_0x500a37,_0x3c2399)[_0xd3a6('0x8')](function(_0x57d826){logger[_0xd3a6('0xa')]('[unlockContact]',inspectError(_0x57d826));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x28b63c){return cmHopper[_0xd3a6('0x13')](_0x28b63c)[_0xd3a6('0x8')](function(_0xbe58b4){logger[_0xd3a6('0xa')](_0xd3a6('0x14'),inspectError(_0xbe58b4));});}exports[_0xd3a6('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x4ec27c){return cmHopperBlack[_0xd3a6('0x15')](_0x4ec27c)['catch'](function(_0x6c6d21){logger[_0xd3a6('0xa')](_0xd3a6('0x16'),inspectError(_0x6c6d21));});}exports[_0xd3a6('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x465d25){return cmHopperBlack[_0xd3a6('0x17')](_0x465d25)['catch'](function(_0xe7d595){logger[_0xd3a6('0xa')]('[checkIsBlackListIvr]',inspectError(_0xe7d595));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5846bc,_0x573870,_0x5c9075){return cmHopperAdditionalPhone[_0xd3a6('0x18')](_0x5846bc,_0x573870,_0x5c9075)[_0xd3a6('0x8')](function(_0x3d0b28){logger['error'](_0xd3a6('0x19'),inspectError(_0x3d0b28));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0x350a11,_0x16afc8,_0x429079){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x350a11,_0x16afc8,_0x429079)[_0xd3a6('0x8')](function(_0x3bc8d1){logger[_0xd3a6('0xa')](_0xd3a6('0x1a'),inspectError(_0x3bc8d1));});}exports[_0xd3a6('0x1b')]=swapAdditionalPhones;function avgHandleTime(_0x3106f1){return cmHopperHistory['avgHandleTime'](_0x3106f1)[_0xd3a6('0x8')](function(_0x2b5448){logger[_0xd3a6('0xa')](_0xd3a6('0x1c'),inspectError(_0x2b5448));});}exports[_0xd3a6('0x1d')]=avgHandleTime;function createHistory(_0x45c628){return cmHopperHistory['createHistory'](_0x45c628)['catch'](function(_0x1f4859){logger[_0xd3a6('0xa')](_0xd3a6('0x1e'),inspectError(_0x1f4859));});}exports[_0xd3a6('0x1f')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 9882f56..50d7157 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2a65=['AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','includes','status','TrunkBackup','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','createdAt','updatedAt','undefined','description','XMD-','toUpperCase','setXMDContactVariables','moment','util','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE'];(function(_0x1864af,_0x435d6c){var _0x43e614=function(_0x15ee0c){while(--_0x15ee0c){_0x1864af['push'](_0x1864af['shift']());}};_0x43e614(++_0x435d6c);}(_0x2a65,0x101));var _0x52a6=function(_0x5d8987,_0x14d054){_0x5d8987=_0x5d8987-0x0;var _0x2997eb=_0x2a65[_0x5d8987];return _0x2997eb;};'use strict';var _=require('lodash');var moment=require(_0x52a6('0x0'));var util=require(_0x52a6('0x1'));var logger=require('../../../../config/logger')('dialer');var timezones=require('../../../../config/environment/shared')[_0x52a6('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0x52a6('0x3'),'BLACKLIST':_0x52a6('0x4'),'CONTACTS_RESCHEDULED':_0x52a6('0x5'),'DEACTIVATED':_0x52a6('0x6'),'DISACTIVED':_0x52a6('0x7'),'EMPTY_INTERVAL':_0x52a6('0x8'),'INACTIVE':_0x52a6('0x9'),'NO_AGENTS_LOGGED':_0x52a6('0xa'),'NO_AVAILABLE_CONTACTS':_0x52a6('0xb'),'NULL_INTERVAL':_0x52a6('0xc'),'OVERTIME_INTERVAL':_0x52a6('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x52a6('0xe'),'QUEUE_RECALL':_0x52a6('0xf'),'RECALL_TIMEOUT':_0x52a6('0x10'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0x52a6('0x11'),'UNREACHABLE_TRUNK':_0x52a6('0x12')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x28cc4f){return _0x28cc4f[_0x52a6('0x13')]===_0x52a6('0x14');}exports[_0x52a6('0x15')]=isPreviewCampaign;function isIVRCampaign(_0x3c44ca){return _0x3c44ca[_0x52a6('0x16')]===_0x52a6('0x17');}exports[_0x52a6('0x18')]=isIVRCampaign;function isOutboundQueue(_0xa5b702){return _0xa5b702[_0x52a6('0x16')]===_0x52a6('0x19');}exports[_0x52a6('0x1a')]=isOutboundQueue;function isQueueCampaignActive(_0x30f413){return _0x30f413['dialActive'];}exports[_0x52a6('0x1b')]=isQueueCampaignActive;function isIVRCampaignActive(_0x338ac5){return _0x338ac5[_0x52a6('0x1c')];}exports[_0x52a6('0x1d')]=isIVRCampaignActive;function getSeconds(_0x4557c2,_0x152e00){var _0x18b1a0=moment(_0x4557c2)[_0x52a6('0x1e')](0x0);var _0x2cb0fa=moment(_0x152e00)[_0x52a6('0x1e')](0x0);return _0x18b1a0[_0x52a6('0x1f')](_0x2cb0fa,'seconds');}exports[_0x52a6('0x20')]=getSeconds;function hasQueueCampaignDataChanged(_0x43ac50,_0x51c764){var _0x2a614e=![];var _0x52a62d=_0x43ac50['dialMethod']!==_0x51c764[_0x52a6('0x13')]||_0x43ac50[_0x52a6('0x21')]!==_0x51c764[_0x52a6('0x21')]||_0x43ac50[_0x52a6('0x22')]!==_0x51c764[_0x52a6('0x22')];var _0x4ee993=_0x43ac50[_0x52a6('0x23')]!==_0x51c764[_0x52a6('0x23')]||_0x43ac50['loggedIn']!==_0x51c764[_0x52a6('0x24')]||_0x43ac50[_0x52a6('0x25')]!==_0x51c764['loggedInDb']||_0x43ac50[_0x52a6('0x26')]!==_0x51c764[_0x52a6('0x26')]||_0x43ac50[_0x52a6('0x27')]!==_0x51c764[_0x52a6('0x27')]||_0x43ac50[_0x52a6('0x28')]!==_0x51c764[_0x52a6('0x28')]||_0x43ac50[_0x52a6('0x29')]!==_0x51c764[_0x52a6('0x29')]||_0x43ac50[_0x52a6('0x2a')]!==_0x51c764['inUse']||_0x43ac50[_0x52a6('0x2b')]!==_0x51c764[_0x52a6('0x2b')];if(_0x43ac50[_0x52a6('0x2c')]&&_0x51c764[_0x52a6('0x2c')]){_0x2a614e=_0x43ac50[_0x52a6('0x2c')]['name']!==_0x51c764[_0x52a6('0x2c')][_0x52a6('0x2d')]||_0x43ac50[_0x52a6('0x2c')][_0x52a6('0x1c')]!==_0x51c764[_0x52a6('0x2c')][_0x52a6('0x1c')];}return _0x52a62d||_0x4ee993||_0x2a614e;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x1776fb){var _0x2eda17=null;var _0x209b86=_0x1776fb[_0x52a6('0x2e')];if(_[_0x52a6('0x2f')](_0x1776fb[_0x52a6('0x30')])||_[_0x52a6('0x2f')](_0x1776fb[_0x52a6('0x31')])||_[_0x52a6('0x2f')](_0x1776fb['Interval']['Intervals'])){_0x2eda17=CAMPAIGN_STATUS[_0x52a6('0x32')];}else if(_['isEmpty'](_0x1776fb[_0x52a6('0x30')])||_[_0x52a6('0x33')](_0x1776fb[_0x52a6('0x31')][_0x52a6('0x34')])){_0x2eda17=CAMPAIGN_STATUS[_0x52a6('0x35')];}else if(_0x209b86&&!timezones[_0x209b86]){_0x2eda17=CAMPAIGN_STATUS[_0x52a6('0x36')];}return _0x2eda17;}function checkAnyValidTrunk(_0x5ae33e,_0x522881){var _0x52f1c5=null;var _0xd0bfb3='SIP/';var _0x484617=[_0x52a6('0x37'),_0x52a6('0x38')];var _0x3884da=!![];if(_0x5ae33e['Trunk']&&_0x5ae33e[_0x52a6('0x2c')][_0x52a6('0x1c')]){_0xd0bfb3+=_0x5ae33e[_0x52a6('0x2c')][_0x52a6('0x2d')];_0x52f1c5=_0x522881[_0xd0bfb3];_0x3884da=_0x484617[_0x52a6('0x39')](_0x52f1c5[_0x52a6('0x3a')]);}else if(_0x5ae33e[_0x52a6('0x3b')]&&_0x5ae33e[_0x52a6('0x3b')][_0x52a6('0x1c')]){_0xd0bfb3+=_0x5ae33e['TrunkBackup'][_0x52a6('0x2d')];_0x52f1c5=_0x522881[_0xd0bfb3];_0x3884da=_0x484617['includes'](_0x52f1c5[_0x52a6('0x3a')]);}return _0x3884da;}function getQueueCampaignStatusMessage(_0x256b79,_0x35a715){var _0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3')];var _0x58abaa=isPreviewCampaign(_0x256b79);if(!isQueueCampaignActive(_0x256b79)){if(_0x58abaa){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3c')];}else{if(_0x256b79[_0x52a6('0x2b')]===0x0&&_0x256b79[_0x52a6('0x27')]===0x0&&_0x256b79[_0x52a6('0x29')]===0x0&&(_0x256b79[_0x52a6('0x28')]||0x0)===0x0){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3c')];}else{_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3d')];}}}else if(_0x256b79[_0x52a6('0x24')]===0x0){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3e')];}else if(!checkAnyValidTrunk(_0x256b79,_0x35a715)){_0x1229ee=CAMPAIGN_STATUS[_0x52a6('0x3f')];}else if(!isPreviewCampaign(_0x256b79)){var _0x161bb4=checkAnyValidQueueCampaignInterval(_0x256b79);if(_0x161bb4){_0x1229ee=_0x161bb4;}}return _0x1229ee;}exports[_0x52a6('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2e96bc){var _0xfc9e70=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2e96bc[_0x52a6('0x2b')]===0x0&&_0x2e96bc[_0x52a6('0x27')]===0x0&&_0x2e96bc[_0x52a6('0x29')]===0x0&&(_0x2e96bc['pTalking']||0x0)===0x0){_0xfc9e70=CAMPAIGN_STATUS[_0x52a6('0x3c')];}return _0xfc9e70;}exports[_0x52a6('0x41')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0xbc6be0){var _0x16b20d=_0xbc6be0['match'](/"(.*?)"/);return _0x16b20d?_0x16b20d[0x1]:_0xbc6be0;}exports[_0x52a6('0x42')]=extractCalleridName;function getCallerId(_0xed10b9,_0x20d678,_0x20a387){if(!_[_0x52a6('0x43')](_0x20a387)&&typeof _0x20a387===_0x52a6('0x44')&&!_[_0x52a6('0x33')](_0x20a387)){if(!_[_0x52a6('0x43')](_0x20d678)&&typeof _0x20d678==='string'&&!_[_0x52a6('0x33')](_0x20d678)){return util[_0x52a6('0x45')]('\x22%s\x22\x20<%s>',_0x20d678,_0x20a387);}return util[_0x52a6('0x45')]('\x22%s\x22\x20<%s>',_0x20a387,_0x20a387);}if(!_[_0x52a6('0x43')](_0xed10b9)&&typeof _0xed10b9==='string'&&!_[_0x52a6('0x33')](_0xed10b9)){return _0xed10b9;}return'\x22\x22\x20<>';}exports[_0x52a6('0x46')]=getCallerId;function getCallerIdRandom(_0x2fb245,_0xf6e6dd){var _0x467862;var _0x441539;var _0x472eab;if(_0xf6e6dd<=0x0){_0xf6e6dd=0x1;}_0x467862=new RegExp(_0x52a6('0x47')+_0xf6e6dd+'}$');_0x441539=Math[_0x52a6('0x48')](0xa,_0xf6e6dd-0x1);_0x472eab=Math[_0x52a6('0x48')](0xa,_0xf6e6dd)-0x1;return util[_0x52a6('0x45')]('%s',_[_0x52a6('0x49')](_0x2fb245,_0x467862,_[_0x52a6('0x4a')](_0x441539,_0x472eab)[_0x52a6('0x4b')]()));}exports[_0x52a6('0x4c')]=getCallerIdRandom;function decrementOriginate(_0xe8e4cc){if(_0xe8e4cc[_0x52a6('0x2b')]&&_0xe8e4cc[_0x52a6('0x2b')]>0x0){_0xe8e4cc[_0x52a6('0x2b')]-=0x1;}else{logger['error'](_0x52a6('0x4d'));}}exports[_0x52a6('0x4e')]=decrementOriginate;function checkContactEmpty(_0x4b6674){return _0x4b6674&&_0x4b6674[_0x52a6('0x4f')]>0x0;}exports[_0x52a6('0x50')]=checkContactEmpty;function erlangb(_0x56f3b2,_0x4b5cca){if(_0x4b5cca===0x0){return 0x0;}var _0x50b1ba=0x1;for(var _0x59bdf8=0x1;_0x59bdf8<=_0x4b5cca;_0x59bdf8+=0x1){_0x50b1ba=0x1+_0x50b1ba*_0x59bdf8/_0x56f3b2;}return 0x1/_0x50b1ba;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x490b6f,_0x506f99,_0x3fe07a){if(_0x506f99>_0x3fe07a){for(var _0x42b579=0x0;_0x42b579<_0x506f99-_0x3fe07a;_0x42b579+=0x1){decrementOriginate(_0x490b6f);}}}exports[_0x52a6('0x51')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x3655bf){var _0x165987={};var _0x23f90f=['id',_0x52a6('0x52'),'tags',_0x52a6('0x53')];const _0x6673f6=0xfa;if(_0x3655bf){for(var _0x168ee0 in _0x3655bf){if(typeof _0x3655bf[_0x168ee0]!==_0x52a6('0x54')){if(!_[_0x52a6('0x2f')](_0x3655bf[_0x168ee0])&&!_0x23f90f[_0x52a6('0x39')](_0x168ee0)){if(_0x168ee0===_0x52a6('0x55')&&_0x3655bf[_0x168ee0][_0x52a6('0x4f')]>_0x6673f6){_0x165987[_0x52a6('0x56')+_0x168ee0[_0x52a6('0x57')]()]=_0x3655bf[_0x168ee0][_0x52a6('0x4b')]()['substring'](0x0,_0x6673f6);}else{_0x165987[_0x52a6('0x56')+_0x168ee0['toUpperCase']()]=_0x3655bf[_0x168ee0];}}}}}return _0x165987;}exports[_0x52a6('0x58')]=setXMDContactVariables; \ No newline at end of file +var _0x5f4b=['checkContactEmpty','checkContactLowerLimitOriginate','tags','updatedAt','undefined','includes','description','XMD-','substring','toUpperCase','setXMDContactVariables','lodash','util','../../../../config/logger','dialer','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','CAMPAIGN_STATUS','dialMethod','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','UNKNOWN_TIMEZONE','unmonitored','status','TrunkBackup','INACTIVE','DISACTIVED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','isEmpty','getCallerId','\x5cw{0,','pow','replace','random','toString','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length'];(function(_0x2fc4ce,_0xe30d0f){var _0x30b3d4=function(_0x1cf159){while(--_0x1cf159){_0x2fc4ce['push'](_0x2fc4ce['shift']());}};_0x30b3d4(++_0xe30d0f);}(_0x5f4b,0x107));var _0xb5f4=function(_0x403643,_0x4b2eb1){_0x403643=_0x403643-0x0;var _0x175cc5=_0x5f4b[_0x403643];return _0x175cc5;};'use strict';var _=require(_0xb5f4('0x0'));var moment=require('moment');var util=require(_0xb5f4('0x1'));var logger=require(_0xb5f4('0x2'))(_0xb5f4('0x3'));var timezones=require(_0xb5f4('0x4'))[_0xb5f4('0x5')];var CAMPAIGN_STATUS={'ACTIVE':_0xb5f4('0x6'),'BLACKLIST':_0xb5f4('0x7'),'CONTACTS_RESCHEDULED':_0xb5f4('0x8'),'DEACTIVATED':_0xb5f4('0x9'),'DISACTIVED':_0xb5f4('0xa'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xb5f4('0xb'),'NO_AGENTS_LOGGED':_0xb5f4('0xc'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':_0xb5f4('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0xb5f4('0xe'),'QUEUE_RECALL':_0xb5f4('0xf'),'RECALL_TIMEOUT':_0xb5f4('0x10'),'RUNNING':_0xb5f4('0x11'),'UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':'TRUNK_IS_NOT_REACHABLE'};exports[_0xb5f4('0x12')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x140c34){return _0x140c34[_0xb5f4('0x13')]==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x2a51cb){return _0x2a51cb[_0xb5f4('0x14')]===_0xb5f4('0x15');}exports[_0xb5f4('0x16')]=isIVRCampaign;function isOutboundQueue(_0x164925){return _0x164925[_0xb5f4('0x14')]==='outbound';}exports[_0xb5f4('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x34c87f){return _0x34c87f[_0xb5f4('0x18')];}exports[_0xb5f4('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4c3b25){return _0x4c3b25[_0xb5f4('0x1a')];}exports[_0xb5f4('0x1b')]=isIVRCampaignActive;function getSeconds(_0x576d73,_0x2239c5){var _0x415f16=moment(_0x576d73)[_0xb5f4('0x1c')](0x0);var _0x5d0c90=moment(_0x2239c5)[_0xb5f4('0x1c')](0x0);return _0x415f16[_0xb5f4('0x1d')](_0x5d0c90,'seconds');}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x3a7408,_0x591523){var _0xecd6f7=![];var _0x3b8a75=_0x3a7408[_0xb5f4('0x13')]!==_0x591523[_0xb5f4('0x13')]||_0x3a7408[_0xb5f4('0x18')]!==_0x591523[_0xb5f4('0x18')]||_0x3a7408['message']!==_0x591523[_0xb5f4('0x1e')];var _0x5dd9b1=_0x3a7408['available']!==_0x591523[_0xb5f4('0x1f')]||_0x3a7408[_0xb5f4('0x20')]!==_0x591523['loggedIn']||_0x3a7408['loggedInDb']!==_0x591523['loggedInDb']||_0x3a7408[_0xb5f4('0x21')]!==_0x591523[_0xb5f4('0x21')]||_0x3a7408[_0xb5f4('0x22')]!==_0x591523[_0xb5f4('0x22')]||_0x3a7408[_0xb5f4('0x23')]!==_0x591523[_0xb5f4('0x23')]||_0x3a7408[_0xb5f4('0x24')]!==_0x591523[_0xb5f4('0x24')]||_0x3a7408[_0xb5f4('0x25')]!==_0x591523['inUse']||_0x3a7408[_0xb5f4('0x26')]!==_0x591523[_0xb5f4('0x26')];if(_0x3a7408[_0xb5f4('0x27')]&&_0x591523[_0xb5f4('0x27')]){_0xecd6f7=_0x3a7408['Trunk'][_0xb5f4('0x28')]!==_0x591523['Trunk'][_0xb5f4('0x28')]||_0x3a7408[_0xb5f4('0x27')][_0xb5f4('0x1a')]!==_0x591523[_0xb5f4('0x27')][_0xb5f4('0x1a')];}return _0x3b8a75||_0x5dd9b1||_0xecd6f7;}exports[_0xb5f4('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x4859b1){var _0x30f9bd=null;var _0x2c9560=_0x4859b1[_0xb5f4('0x2a')];if(_[_0xb5f4('0x2b')](_0x4859b1[_0xb5f4('0x2c')])||_[_0xb5f4('0x2b')](_0x4859b1[_0xb5f4('0x2d')])||_[_0xb5f4('0x2b')](_0x4859b1[_0xb5f4('0x2d')][_0xb5f4('0x2e')])){_0x30f9bd=CAMPAIGN_STATUS[_0xb5f4('0x2f')];}else if(_['isEmpty'](_0x4859b1[_0xb5f4('0x2c')])||_['isEmpty'](_0x4859b1[_0xb5f4('0x2d')][_0xb5f4('0x2e')])){_0x30f9bd=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x2c9560&&!timezones[_0x2c9560]){_0x30f9bd=CAMPAIGN_STATUS[_0xb5f4('0x30')];}return _0x30f9bd;}function checkAnyValidTrunk(_0x36a0cf,_0x155a6b){var _0x599635=null;var _0x302bfd='SIP/';var _0x5694d7=['reachable',_0xb5f4('0x31')];var _0x34daf9=!![];if(_0x36a0cf[_0xb5f4('0x27')]&&_0x36a0cf[_0xb5f4('0x27')][_0xb5f4('0x1a')]){_0x302bfd+=_0x36a0cf[_0xb5f4('0x27')]['name'];_0x599635=_0x155a6b[_0x302bfd];_0x34daf9=_0x5694d7['includes'](_0x599635[_0xb5f4('0x32')]);}else if(_0x36a0cf[_0xb5f4('0x33')]&&_0x36a0cf[_0xb5f4('0x33')][_0xb5f4('0x1a')]){_0x302bfd+=_0x36a0cf['TrunkBackup'][_0xb5f4('0x28')];_0x599635=_0x155a6b[_0x302bfd];_0x34daf9=_0x5694d7['includes'](_0x599635[_0xb5f4('0x32')]);}return _0x34daf9;}function getQueueCampaignStatusMessage(_0x2bb84a,_0x59d7e2){var _0x508f6b=CAMPAIGN_STATUS[_0xb5f4('0x6')];var _0x2a7c96=isPreviewCampaign(_0x2bb84a);if(!isQueueCampaignActive(_0x2bb84a)){if(_0x2a7c96){_0x508f6b=CAMPAIGN_STATUS[_0xb5f4('0x34')];}else{if(_0x2bb84a['originated']===0x0&&_0x2bb84a[_0xb5f4('0x22')]===0x0&&_0x2bb84a['waiting']===0x0&&(_0x2bb84a['pTalking']||0x0)===0x0){_0x508f6b=CAMPAIGN_STATUS['INACTIVE'];}else{_0x508f6b=CAMPAIGN_STATUS[_0xb5f4('0x35')];}}}else if(_0x2bb84a[_0xb5f4('0x20')]===0x0){_0x508f6b=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0x2bb84a,_0x59d7e2)){_0x508f6b=CAMPAIGN_STATUS[_0xb5f4('0x36')];}else if(!isPreviewCampaign(_0x2bb84a)){var _0x4d5298=checkAnyValidQueueCampaignInterval(_0x2bb84a);if(_0x4d5298){_0x508f6b=_0x4d5298;}}return _0x508f6b;}exports[_0xb5f4('0x37')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x42807f){var _0x40ac16=CAMPAIGN_STATUS[_0xb5f4('0x35')];if(_0x42807f['originated']===0x0&&_0x42807f['talking']===0x0&&_0x42807f['waiting']===0x0&&(_0x42807f[_0xb5f4('0x23')]||0x0)===0x0){_0x40ac16=CAMPAIGN_STATUS[_0xb5f4('0x34')];}return _0x40ac16;}exports[_0xb5f4('0x38')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x37d2c3){var _0x2fd736=_0x37d2c3['match'](/"(.*?)"/);return _0x2fd736?_0x2fd736[0x1]:_0x37d2c3;}exports[_0xb5f4('0x39')]=extractCalleridName;function getCallerId(_0x3e7b70,_0x21a208,_0x31caa4){if(!_['isUndefined'](_0x31caa4)&&typeof _0x31caa4===_0xb5f4('0x3a')&&!_['isEmpty'](_0x31caa4)){if(!_[_0xb5f4('0x3b')](_0x21a208)&&typeof _0x21a208==='string'&&!_['isEmpty'](_0x21a208)){return util[_0xb5f4('0x3c')](_0xb5f4('0x3d'),_0x21a208,_0x31caa4);}return util[_0xb5f4('0x3c')](_0xb5f4('0x3d'),_0x31caa4,_0x31caa4);}if(!_[_0xb5f4('0x3b')](_0x3e7b70)&&typeof _0x3e7b70===_0xb5f4('0x3a')&&!_[_0xb5f4('0x3e')](_0x3e7b70)){return _0x3e7b70;}return'\x22\x22\x20<>';}exports[_0xb5f4('0x3f')]=getCallerId;function getCallerIdRandom(_0x278140,_0x5bcbd5){var _0x9126e;var _0x5c4856;var _0x8665b;if(_0x5bcbd5<=0x0){_0x5bcbd5=0x1;}_0x9126e=new RegExp(_0xb5f4('0x40')+_0x5bcbd5+'}$');_0x5c4856=Math[_0xb5f4('0x41')](0xa,_0x5bcbd5-0x1);_0x8665b=Math[_0xb5f4('0x41')](0xa,_0x5bcbd5)-0x1;return util['format']('%s',_[_0xb5f4('0x42')](_0x278140,_0x9126e,_[_0xb5f4('0x43')](_0x5c4856,_0x8665b)[_0xb5f4('0x44')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x58cd27){if(_0x58cd27[_0xb5f4('0x26')]&&_0x58cd27['originated']>0x0){_0x58cd27[_0xb5f4('0x26')]-=0x1;}else{logger[_0xb5f4('0x45')](_0xb5f4('0x46'));}}exports[_0xb5f4('0x47')]=decrementOriginate;function checkContactEmpty(_0x53d28a){return _0x53d28a&&_0x53d28a[_0xb5f4('0x48')]>0x0;}exports[_0xb5f4('0x49')]=checkContactEmpty;function erlangb(_0x17a3e0,_0x2d8cbe){if(_0x2d8cbe===0x0){return 0x0;}var _0x305b1b=0x1;for(var _0x3ae9f0=0x1;_0x3ae9f0<=_0x2d8cbe;_0x3ae9f0+=0x1){_0x305b1b=0x1+_0x305b1b*_0x3ae9f0/_0x17a3e0;}return 0x1/_0x305b1b;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x1bdec4,_0x37535b,_0xa57e6d){if(_0x37535b>_0xa57e6d){for(var _0x4bd020=0x0;_0x4bd020<_0x37535b-_0xa57e6d;_0x4bd020+=0x1){decrementOriginate(_0x1bdec4);}}}exports[_0xb5f4('0x4a')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x30e3d9){var _0x612cab={};var _0x4b3ce8=['id','createdAt',_0xb5f4('0x4b'),_0xb5f4('0x4c')];const _0x2360b2=0xfa;if(_0x30e3d9){for(var _0x2cfdfa in _0x30e3d9){if(typeof _0x30e3d9[_0x2cfdfa]!==_0xb5f4('0x4d')){if(!_[_0xb5f4('0x2b')](_0x30e3d9[_0x2cfdfa])&&!_0x4b3ce8[_0xb5f4('0x4e')](_0x2cfdfa)){if(_0x2cfdfa===_0xb5f4('0x4f')&&_0x30e3d9[_0x2cfdfa][_0xb5f4('0x48')]>_0x2360b2){_0x612cab[_0xb5f4('0x50')+_0x2cfdfa['toUpperCase']()]=_0x30e3d9[_0x2cfdfa][_0xb5f4('0x44')]()[_0xb5f4('0x51')](0x0,_0x2360b2);}else{_0x612cab[_0xb5f4('0x50')+_0x2cfdfa[_0xb5f4('0x52')]()]=_0x30e3d9[_0x2cfdfa];}}}}}return _0x612cab;}exports[_0xb5f4('0x53')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 5bfb40d..b714793 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(_0xafd01e,_0x3ba3ec){var _0x5e0d3c=function(_0x47ca3d){while(--_0x47ca3d){_0xafd01e['push'](_0xafd01e['shift']());}};_0x5e0d3c(++_0x3ba3ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var 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(_0x17f8fd,_0xc78452){var _0x25f5db=function(_0x156ba7){while(--_0x156ba7){_0x17f8fd['push'](_0x17f8fd['shift']());}};_0x25f5db(++_0xc78452);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 2601099..cf9a880 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 _0x9f09=['notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','Trunk\x20Reachable','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','ext','isNil','active','SIP/%s','reachable','unmonitored','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','path','tiff2pdf','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','newexten','faxstatus','receivefax','syncReceiveFax','syncOriginateResponse','prototype','from-voip-provider','faxAccounts','hasOwnProperty','exten','localstationid','uniqueid','channel','channels','name','info','\x20syncNewchannel\x20','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then'];(function(_0x7c2bce,_0x370cf3){var _0xc7ae58=function(_0x1ad430){while(--_0x1ad430){_0x7c2bce['push'](_0x7c2bce['shift']());}};_0xc7ae58(++_0x370cf3);}(_0x9f09,0xb6));var _0x99f0=function(_0x15d184,_0x27104f){_0x15d184=_0x15d184-0x0;var _0x3b8752=_0x9f09[_0x15d184];return _0x3b8752;};'use strict';var util=require('util');var _=require(_0x99f0('0x0'));var BPromise=require(_0x99f0('0x1'));var uuid=require(_0x99f0('0x2'));var moment=require('moment');var path=require(_0x99f0('0x3'));var tiff2pdf=require(_0x99f0('0x4'));var gs=require('./util/gs');var logger=require('../../../config/logger')(_0x99f0('0x5'));var ami=require(_0x99f0('0x6'));var rpcDb=require(_0x99f0('0x7'));var Channel=require('./channel');var ut=require(_0x99f0('0x8'));var Action=require(_0x99f0('0x9'));var faxAccount=require(_0x99f0('0xa'));var attachment=require(_0x99f0('0xb'));var faxMessage=require(_0x99f0('0xc'));function Fax(_0xc24a25){this['channels']={};this['faxAccounts']=_0xc24a25['faxAccounts'];this[_0x99f0('0xd')]=_0xc24a25['trunks'];this[_0x99f0('0xe')]={};ami['on'](_0x99f0('0xf'),this[_0x99f0('0x10')][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x12'),this[_0x99f0('0x13')][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x14'),this['syncNewState'][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x15'),this['syncNewExten'][_0x99f0('0x11')](this));ami['on'](_0x99f0('0x16'),this['syncFaxStatus']['bind'](this));ami['on'](_0x99f0('0x17'),this[_0x99f0('0x18')][_0x99f0('0x11')](this));ami['on']('hangup',this['syncHangup'][_0x99f0('0x11')](this));ami['on']('originateresponse',this[_0x99f0('0x19')][_0x99f0('0x11')](this));}Fax[_0x99f0('0x1a')]['syncNewchannel']=function(_0x358fe6){if(_0x358fe6['context']===_0x99f0('0x1b')){for(var _0x2f06bc in this[_0x99f0('0x1c')]){if(this[_0x99f0('0x1c')][_0x99f0('0x1d')](_0x2f06bc)){if(_0x358fe6[_0x99f0('0x1e')]===this[_0x99f0('0x1c')][_0x2f06bc][_0x99f0('0x1f')]){this['channels'][_0x358fe6[_0x99f0('0x20')]]={};this['channels'][_0x358fe6[_0x99f0('0x20')]][_0x99f0('0x21')]=_0x358fe6[_0x99f0('0x21')];this['channels'][_0x358fe6[_0x99f0('0x20')]]['id']=this[_0x99f0('0x1c')][_0x2f06bc]['id'];this[_0x99f0('0x22')][_0x358fe6['uniqueid']][_0x99f0('0x23')]=this[_0x99f0('0x1c')][_0x2f06bc]['name'];logger[_0x99f0('0x24')](_0x358fe6[_0x99f0('0x20')],_0x99f0('0x25'));}}}}if(this[_0x99f0('0xe')][_0x358fe6[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x358fe6['uniqueid']]={};this['channels'][_0x358fe6['uniqueid']][_0x99f0('0x21')]=_0x358fe6[_0x99f0('0x21')];logger['info'](_0x358fe6['uniqueid'],_0x99f0('0x25'));}};Fax[_0x99f0('0x1a')][_0x99f0('0x13')]=function(_0x5383d0){if(this[_0x99f0('0x22')][_0x5383d0[_0x99f0('0x20')]]){for(var _0x1d9d22 in _0x5383d0[_0x99f0('0x26')]){if(_0x5383d0[_0x99f0('0x26')][_0x99f0('0x1d')](_0x1d9d22)){this[_0x99f0('0x22')][_0x5383d0[_0x99f0('0x20')]][_0x1d9d22]=_0x5383d0[_0x99f0('0x27')];}}}};Fax[_0x99f0('0x1a')][_0x99f0('0x28')]=function(_0x20de41){if(this['channels'][_0x20de41[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x20de41[_0x99f0('0x20')]][_0x99f0('0x29')]=_0x20de41[_0x99f0('0x29')];this[_0x99f0('0x22')][_0x20de41[_0x99f0('0x20')]][_0x99f0('0x2a')]=_0x20de41[_0x99f0('0x2a')];}};Fax[_0x99f0('0x1a')][_0x99f0('0x2b')]=function(_0x1db94b){if(this[_0x99f0('0x22')][_0x1db94b['uniqueid']]){for(var _0x111766 in _0x1db94b[_0x99f0('0x26')]){if(_0x1db94b[_0x99f0('0x26')][_0x99f0('0x1d')](_0x111766)){this[_0x99f0('0x22')][_0x1db94b[_0x99f0('0x20')]][_0x111766]=_0x1db94b['value'];}}}};Fax[_0x99f0('0x1a')][_0x99f0('0x2c')]=function(_0x260f7f){if(this['channels'][_0x260f7f[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x260f7f['uniqueid']]['operation']=_0x260f7f[_0x99f0('0x2d')];this[_0x99f0('0x22')][_0x260f7f[_0x99f0('0x20')]]['status']=_0x260f7f[_0x99f0('0x2e')];this[_0x99f0('0x22')][_0x260f7f['uniqueid']][_0x99f0('0x1f')]=_0x260f7f['localstationid'];this[_0x99f0('0x22')][_0x260f7f[_0x99f0('0x20')]][_0x99f0('0x2f')]=_0x260f7f['filename'];logger['info'](_0x260f7f['uniqueid'],_0x99f0('0x30'));}};Fax['prototype']['syncReceiveFax']=function(_0x431169){var _0x15cd16=this;if(this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]]){var _0x54f961=this['channels'][_0x431169[_0x99f0('0x20')]]['id'];this[_0x99f0('0x22')][_0x431169['uniqueid']][_0x99f0('0x31')]=_0x431169[_0x99f0('0x31')];this['channels'][_0x431169['uniqueid']][_0x99f0('0x32')]=_0x431169['pagestransferred'];this[_0x99f0('0x22')][_0x431169['uniqueid']]['localstationid']=_0x431169[_0x99f0('0x1f')];this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]]['resolution']=_0x431169['resolution'];this['channels'][_0x431169[_0x99f0('0x20')]][_0x99f0('0x33')]=_0x431169[_0x99f0('0x33')];this[_0x99f0('0x22')][_0x431169['uniqueid']]['filename']=_0x431169[_0x99f0('0x2f')];this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]]['calleridnum']=_0x431169[_0x99f0('0x34')];if(this[_0x99f0('0x22')][_0x431169[_0x99f0('0x20')]][_0x99f0('0x32')]>0x0){tiff2pdf(_0x431169['filename'],_0x99f0('0x35'),function(_0x52f679){logger['info'](_0x431169[_0x99f0('0x20')],_0x99f0('0x36'),_0x52f679[_0x99f0('0x37')]);attachment['create']({'name':path[_0x99f0('0x38')](_0x431169[_0x99f0('0x2f')])['name'],'basename':path[_0x99f0('0x38')](_0x431169[_0x99f0('0x2f')])[_0x99f0('0x23')]+_0x99f0('0x39'),'type':_0x99f0('0x3a')})[_0x99f0('0x3b')](function(_0x187c4c){faxAccount[_0x99f0('0x3c')](_0x54f961,{'from':_0x431169[_0x99f0('0x34')],'mapKey':_0x99f0('0x5'),'body':path[_0x99f0('0x38')](_0x431169['filename'])[_0x99f0('0x23')]+_0x99f0('0x39'),'AttachmentId':_0x187c4c['id']})[_0x99f0('0x3d')](function(_0x58363e){logger[_0x99f0('0x3e')](_0x431169[_0x99f0('0x20')],_0x99f0('0x3f'),JSON[_0x99f0('0x40')](_0x58363e));});})[_0x99f0('0x3d')](function(_0x29152c){logger[_0x99f0('0x3e')](_0x431169[_0x99f0('0x20')],_0x99f0('0x41'),JSON[_0x99f0('0x40')](_0x29152c));});});}logger[_0x99f0('0x24')](_0x431169[_0x99f0('0x20')],_0x99f0('0x41'));}};Fax[_0x99f0('0x1a')][_0x99f0('0x19')]=function(_0x445f3c){if(this[_0x99f0('0xe')][_0x445f3c['uniqueid']]){_[_0x99f0('0x42')](this[_0x99f0('0x22')][_0x445f3c[_0x99f0('0x20')]],_[_0x99f0('0x43')](_0x445f3c,[_0x99f0('0x44'),_0x99f0('0x45')]));}};function updateStatus(_0x77e83d){if(_0x77e83d[_0x99f0('0x46')]){faxMessage[_0x99f0('0x47')](_0x77e83d['AttachmentId'],{'failMessage':_0x99f0('0x48')})[_0x99f0('0x3b')](function(_0x519cb9){ut[_0x99f0('0x49')](_0x99f0('0x4a'),_0x519cb9);})[_0x99f0('0x3d')](function(_0x4536cc){ut[_0x99f0('0x49')](_0x99f0('0x4b'),_0x4536cc);});}else{ut[_0x99f0('0x49')](_0x99f0('0x4c'));}}Fax[_0x99f0('0x1a')][_0x99f0('0x4d')]=function(_0x569144,_0x1d474e,_0x5eefda){var _0x36acf=this;var _0x284173={};if(_0x1d474e){_0x284173={'read':_0x1d474e};}else{_0x284173={'failMessage':_0x5eefda};}if(this[_0x99f0('0xe')][_0x569144]['AttachmentId']){faxMessage['update'](this[_0x99f0('0xe')][_0x569144]['AttachmentId'],_0x284173)[_0x99f0('0x3b')](function(_0x48855f){ut[_0x99f0('0x49')](_0x99f0('0x4e'),_0x48855f);})[_0x99f0('0x3d')](function(_0x4fee93){ut[_0x99f0('0x49')](_0x99f0('0x4f'),_0x4fee93);})[_0x99f0('0x50')](function(){delete _0x36acf[_0x99f0('0x22')][_0x569144];delete _0x36acf[_0x99f0('0xe')][_0x569144];});}else{ut[_0x99f0('0x49')](_0x99f0('0x51'));this[_0x99f0('0x52')](_0x569144);delete this[_0x99f0('0xe')][_0x569144];}};Fax['prototype'][_0x99f0('0x53')]=function(_0x4bf20e){var _0x46d761=this;if(this[_0x99f0('0x22')][_0x4bf20e['uniqueid']]){if(this[_0x99f0('0xe')][_0x4bf20e[_0x99f0('0x20')]]){this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]]['id']=this[_0x99f0('0xe')][_0x4bf20e['uniqueid']]['id'];this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]][_0x99f0('0x23')]=this[_0x99f0('0xe')][_0x4bf20e['uniqueid']][_0x99f0('0x23')];}logger[_0x99f0('0x24')](_0x4bf20e[_0x99f0('0x20')],this[_0x99f0('0xe')][_0x4bf20e[_0x99f0('0x20')]]?_0x99f0('0x54'):_0x99f0('0x55'),JSON[_0x99f0('0x40')](this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]]));if(this[_0x99f0('0xe')][_0x4bf20e[_0x99f0('0x20')]]){if(this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]]['faxpages']>0x0&&this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]][_0x99f0('0x16')]===_0x99f0('0x56')){this[_0x99f0('0x4d')](_0x4bf20e['uniqueid'],!![]);}else{this[_0x99f0('0x4d')](_0x4bf20e[_0x99f0('0x20')],![],this['channels'][_0x4bf20e['uniqueid']][_0x99f0('0x57')]?_0x99f0('0x58')+this[_0x99f0('0x22')][_0x4bf20e[_0x99f0('0x20')]][_0x99f0('0x57')]:_0x99f0('0x59'));}}}};Fax[_0x99f0('0x1a')]['send']=function(_0x3315b9){var _0x313dd4=this;return new BPromise(function(_0x28a48c,_0x403e3d){_0x313dd4['execOriginate'](_0x3315b9,_0x313dd4[_0x99f0('0x1c')][_0x3315b9['FaxAccountId']])[_0x99f0('0x3b')](function(_0x17e176){ut[_0x99f0('0x49')](_0x99f0('0x5a'),_0x17e176);_0x28a48c(ut[_0x99f0('0x37')](_0x99f0('0x5b')));})[_0x99f0('0x3d')](function(_0x5d401c){ut[_0x99f0('0x49')](_0x99f0('0x5c'),_0x5d401c);updateStatus(_0x3315b9);_0x403e3d(ut[_0x99f0('0x37')]('Fax\x20failed'));});});};Fax[_0x99f0('0x1a')]['checkAfterSend']=function(_0x36bd58){var _0x102620=this;return new BPromise(function(_0x4cbd75,_0x9a2bd2){var _0xc2bd07=_0x102620[_0x99f0('0x5d')](_0x102620[_0x99f0('0x1c')][_0x36bd58['FaxAccountId']][_0x99f0('0x5e')],_0x36bd58);if(_0xc2bd07['isValid']){_0x4cbd75(ut[_0x99f0('0x37')](_0x99f0('0x5f')));}else{_0x9a2bd2(ut[_0x99f0('0x37')](_0xc2bd07['message']));}});};function originate(_0x37bd0c,_0x51d3f7,_0x2f2920){return new BPromise(function(_0x27f738,_0xd22ec0){if(_0x2f2920){var _0x5c31ad=util[_0x99f0('0x60')](_0x99f0('0x61'),path['parse'](_0x37bd0c['path'])[_0x99f0('0x23')],_0x37bd0c[_0x99f0('0x3')]);gs[_0x99f0('0x62')](_0x5c31ad)['then'](function(){_0x37bd0c['path']=util[_0x99f0('0x60')](_0x99f0('0x63'),path['parse'](_0x37bd0c[_0x99f0('0x3')])['dir'],path[_0x99f0('0x38')](_0x37bd0c[_0x99f0('0x3')])['name']);_0x51d3f7[_0x99f0('0x64')]=_0x37bd0c[_0x99f0('0x3')];ut['logger'](_0x99f0('0x65'),'');ami[_0x99f0('0x66')](ut['variablesAction'](_0x37bd0c,_0x51d3f7))['then'](function(_0x9f6b8c){_0x27f738(_0x9f6b8c);})['catch'](function(_0x44c87d){_0xd22ec0(_0x44c87d);});})[_0x99f0('0x3d')](function(_0x4cd36b){_0xd22ec0(_0x4cd36b);});}else{ami['Action'](ut[_0x99f0('0x67')](_0x37bd0c,_0x51d3f7))[_0x99f0('0x3b')](function(_0x452827){_0x27f738(_0x452827);})[_0x99f0('0x3d')](function(_0x5ad110){_0xd22ec0(_0x5ad110);});}});}Fax[_0x99f0('0x1a')][_0x99f0('0x68')]=function(_0x528333,_0xbd41a9){var _0x49f44a=this;return new BPromise(function(_0x46d191,_0x62952b){var _0x1eea13=uuid['v4']();var _0xafec9d=ut['addVariables'](_0x528333,_0xbd41a9);_0x49f44a[_0x99f0('0xe')][_0x1eea13]=new Action(_0x1eea13,_0xbd41a9,_0x528333);var _0x3292a4=_0x49f44a['actions'][_0x1eea13];if(path[_0x99f0('0x38')](_0x528333[_0x99f0('0x3')])[_0x99f0('0x69')]===_0x99f0('0x39')){originate(_0x3292a4,_0xafec9d,!![])['then'](function(_0x15339d){_0x46d191(_0x15339d);})[_0x99f0('0x3d')](function(_0x52e98a){_0x62952b(_0x52e98a);});}else{originate(_0x3292a4,_0xafec9d,![])[_0x99f0('0x3b')](function(_0x6eb966){_0x46d191(_0x6eb966);})[_0x99f0('0x3d')](function(_0x54d934){_0x62952b(_0x54d934);});}});};Fax[_0x99f0('0x1a')]['isTrunkReachable']=function(_0x20e5ed){return!_['isNil'](_0x20e5ed)&&!_[_0x99f0('0x6a')](_0x20e5ed[_0x99f0('0x23')])&&!_['isNil'](_0x20e5ed[_0x99f0('0x6b')])&&_0x20e5ed[_0x99f0('0x6b')]&&!_[_0x99f0('0x6a')](this['trunks'][util['format'](_0x99f0('0x6c'),_0x20e5ed[_0x99f0('0x23')])])&&!_[_0x99f0('0x6a')](this[_0x99f0('0xd')][util[_0x99f0('0x60')]('SIP/%s',_0x20e5ed[_0x99f0('0x23')])]['status'])&&(this[_0x99f0('0xd')][util['format'](_0x99f0('0x6c'),_0x20e5ed['name'])]['status']===_0x99f0('0x6d')||this[_0x99f0('0xd')][util[_0x99f0('0x60')](_0x99f0('0x6c'),_0x20e5ed[_0x99f0('0x23')])]['status']===_0x99f0('0x6e'));};Fax[_0x99f0('0x1a')][_0x99f0('0x5d')]=function(_0x12bfe8,_0x166f91){if(!this[_0x99f0('0x6f')](_0x12bfe8)){ut['logger'](_0x99f0('0x70'),_[_0x99f0('0x6a')](_0x12bfe8)?'':_0x12bfe8[_0x99f0('0x23')]+_0x99f0('0x71'));return{'isValid':![],'message':_0x99f0('0x72')};}if(_[_0x99f0('0x6a')](_0x166f91['fax'])){ut['logger'](_0x99f0('0x73'),JSON[_0x99f0('0x40')](_0x166f91));return{'isValid':![],'message':_0x99f0('0x74')};}if(_[_0x99f0('0x6a')](_0x166f91[_0x99f0('0x3')])){ut['logger'](_0x99f0('0x75'),JSON[_0x99f0('0x40')](_0x166f91));return{'isValid':![],'message':_0x99f0('0x76')};}return{'isValid':!![],'message':_0x99f0('0x77')};};Fax['prototype'][_0x99f0('0x52')]=function(_0x43ef03,_0x18bc59=0x2710){if(this['channels'][_0x43ef03]){setTimeout(()=>{delete this[_0x99f0('0x22')][_0x43ef03];},_0x18bc59);}};module[_0x99f0('0x78')]=Fax; \ No newline at end of file +var _0x04fc=['catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','faxpages','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','format','%s/%s.tif','dir','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Is\x20Valid','util','lodash','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','./rpcDb','./util/util','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','syncVarSet','bind','newstate','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','syncNewState','channelstate','channelstatedesc','syncNewExten','status','localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','then','notify'];(function(_0x4479ae,_0x47f981){var _0x6996d9=function(_0xd6f69a){while(--_0xd6f69a){_0x4479ae['push'](_0x4479ae['shift']());}};_0x6996d9(++_0x47f981);}(_0x04fc,0x18e));var _0xc04f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x04fc[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xc04f('0x0'));var _=require(_0xc04f('0x1'));var BPromise=require('bluebird');var uuid=require('uuid');var moment=require(_0xc04f('0x2'));var path=require(_0xc04f('0x3'));var tiff2pdf=require(_0xc04f('0x4'));var gs=require(_0xc04f('0x5'));var logger=require(_0xc04f('0x6'))(_0xc04f('0x7'));var ami=require('../ami');var rpcDb=require(_0xc04f('0x8'));var Channel=require('./channel');var ut=require(_0xc04f('0x9'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xc04f('0xa'));var faxMessage=require(_0xc04f('0xb'));function Fax(_0x8ce2ab){this[_0xc04f('0xc')]={};this[_0xc04f('0xd')]=_0x8ce2ab[_0xc04f('0xd')];this[_0xc04f('0xe')]=_0x8ce2ab[_0xc04f('0xe')];this[_0xc04f('0xf')]={};ami['on'](_0xc04f('0x10'),this[_0xc04f('0x11')]['bind'](this));ami['on']('varset',this[_0xc04f('0x12')][_0xc04f('0x13')](this));ami['on'](_0xc04f('0x14'),this['syncNewState']['bind'](this));ami['on']('newexten',this['syncNewExten']['bind'](this));ami['on'](_0xc04f('0x15'),this[_0xc04f('0x16')][_0xc04f('0x13')](this));ami['on'](_0xc04f('0x17'),this[_0xc04f('0x18')]['bind'](this));ami['on'](_0xc04f('0x19'),this['syncHangup']['bind'](this));ami['on'](_0xc04f('0x1a'),this[_0xc04f('0x1b')]['bind'](this));}Fax[_0xc04f('0x1c')][_0xc04f('0x11')]=function(_0x4d4788){if(_0x4d4788['context']===_0xc04f('0x1d')){for(var _0x550476 in this['faxAccounts']){if(this[_0xc04f('0xd')][_0xc04f('0x1e')](_0x550476)){if(_0x4d4788[_0xc04f('0x1f')]===this[_0xc04f('0xd')][_0x550476]['localstationid']){this[_0xc04f('0xc')][_0x4d4788[_0xc04f('0x20')]]={};this[_0xc04f('0xc')][_0x4d4788[_0xc04f('0x20')]][_0xc04f('0x21')]=_0x4d4788[_0xc04f('0x21')];this['channels'][_0x4d4788['uniqueid']]['id']=this[_0xc04f('0xd')][_0x550476]['id'];this[_0xc04f('0xc')][_0x4d4788[_0xc04f('0x20')]]['name']=this[_0xc04f('0xd')][_0x550476][_0xc04f('0x22')];logger['info'](_0x4d4788[_0xc04f('0x20')],_0xc04f('0x23'));}}}}if(this[_0xc04f('0xf')][_0x4d4788[_0xc04f('0x20')]]){this['channels'][_0x4d4788['uniqueid']]={};this[_0xc04f('0xc')][_0x4d4788[_0xc04f('0x20')]][_0xc04f('0x21')]=_0x4d4788[_0xc04f('0x21')];logger[_0xc04f('0x24')](_0x4d4788[_0xc04f('0x20')],_0xc04f('0x23'));}};Fax[_0xc04f('0x1c')][_0xc04f('0x12')]=function(_0x36b6db){if(this[_0xc04f('0xc')][_0x36b6db[_0xc04f('0x20')]]){for(var _0x5a6b3e in _0x36b6db[_0xc04f('0x25')]){if(_0x36b6db[_0xc04f('0x25')][_0xc04f('0x1e')](_0x5a6b3e)){this[_0xc04f('0xc')][_0x36b6db[_0xc04f('0x20')]][_0x5a6b3e]=_0x36b6db[_0xc04f('0x26')];}}}};Fax['prototype'][_0xc04f('0x27')]=function(_0x3f3382){if(this[_0xc04f('0xc')][_0x3f3382[_0xc04f('0x20')]]){this[_0xc04f('0xc')][_0x3f3382[_0xc04f('0x20')]][_0xc04f('0x28')]=_0x3f3382[_0xc04f('0x28')];this['channels'][_0x3f3382[_0xc04f('0x20')]][_0xc04f('0x29')]=_0x3f3382[_0xc04f('0x29')];}};Fax[_0xc04f('0x1c')][_0xc04f('0x2a')]=function(_0x3687bd){if(this[_0xc04f('0xc')][_0x3687bd[_0xc04f('0x20')]]){for(var _0x576094 in _0x3687bd[_0xc04f('0x25')]){if(_0x3687bd[_0xc04f('0x25')]['hasOwnProperty'](_0x576094)){this[_0xc04f('0xc')][_0x3687bd[_0xc04f('0x20')]][_0x576094]=_0x3687bd['value'];}}}};Fax[_0xc04f('0x1c')][_0xc04f('0x16')]=function(_0xed9f4b){if(this[_0xc04f('0xc')][_0xed9f4b['uniqueid']]){this['channels'][_0xed9f4b['uniqueid']]['operation']=_0xed9f4b['operation'];this['channels'][_0xed9f4b[_0xc04f('0x20')]][_0xc04f('0x2b')]=_0xed9f4b['status'];this[_0xc04f('0xc')][_0xed9f4b[_0xc04f('0x20')]][_0xc04f('0x2c')]=_0xed9f4b[_0xc04f('0x2c')];this[_0xc04f('0xc')][_0xed9f4b['uniqueid']][_0xc04f('0x2d')]=_0xed9f4b['filename'];logger['info'](_0xed9f4b['uniqueid'],'\x20syncFaxStatus\x20');}};Fax['prototype'][_0xc04f('0x18')]=function(_0x191f8d){var _0x4d290f=this;if(this[_0xc04f('0xc')][_0x191f8d[_0xc04f('0x20')]]){var _0xf3995d=this['channels'][_0x191f8d[_0xc04f('0x20')]]['id'];this['channels'][_0x191f8d[_0xc04f('0x20')]][_0xc04f('0x2e')]=_0x191f8d[_0xc04f('0x2e')];this[_0xc04f('0xc')][_0x191f8d['uniqueid']]['pagestransferred']=_0x191f8d[_0xc04f('0x2f')];this['channels'][_0x191f8d['uniqueid']][_0xc04f('0x2c')]=_0x191f8d[_0xc04f('0x2c')];this[_0xc04f('0xc')][_0x191f8d['uniqueid']][_0xc04f('0x30')]=_0x191f8d[_0xc04f('0x30')];this['channels'][_0x191f8d[_0xc04f('0x20')]]['transferrate']=_0x191f8d[_0xc04f('0x31')];this[_0xc04f('0xc')][_0x191f8d[_0xc04f('0x20')]][_0xc04f('0x2d')]=_0x191f8d['filename'];this[_0xc04f('0xc')][_0x191f8d[_0xc04f('0x20')]][_0xc04f('0x32')]=_0x191f8d[_0xc04f('0x32')];if(this['channels'][_0x191f8d[_0xc04f('0x20')]]['pagestransferred']>0x0){tiff2pdf(_0x191f8d['filename'],_0xc04f('0x33'),function(_0x4f4208){logger[_0xc04f('0x24')](_0x191f8d[_0xc04f('0x20')],_0xc04f('0x34'),_0x4f4208['message']);attachment[_0xc04f('0x35')]({'name':path[_0xc04f('0x36')](_0x191f8d[_0xc04f('0x2d')])[_0xc04f('0x22')],'basename':path[_0xc04f('0x36')](_0x191f8d[_0xc04f('0x2d')])[_0xc04f('0x22')]+_0xc04f('0x37'),'type':'application/pdf'})[_0xc04f('0x38')](function(_0x1fd365){faxAccount[_0xc04f('0x39')](_0xf3995d,{'from':_0x191f8d['calleridnum'],'mapKey':_0xc04f('0x7'),'body':path[_0xc04f('0x36')](_0x191f8d[_0xc04f('0x2d')])[_0xc04f('0x22')]+_0xc04f('0x37'),'AttachmentId':_0x1fd365['id']})[_0xc04f('0x3a')](function(_0x5e2698){logger[_0xc04f('0x3b')](_0x191f8d[_0xc04f('0x20')],_0xc04f('0x3c'),JSON[_0xc04f('0x3d')](_0x5e2698));});})[_0xc04f('0x3a')](function(_0x2a2545){logger[_0xc04f('0x3b')](_0x191f8d[_0xc04f('0x20')],_0xc04f('0x3e'),JSON[_0xc04f('0x3d')](_0x2a2545));});});}logger[_0xc04f('0x24')](_0x191f8d[_0xc04f('0x20')],'\x20receiveFax\x20');}};Fax[_0xc04f('0x1c')][_0xc04f('0x1b')]=function(_0x781829){if(this[_0xc04f('0xf')][_0x781829[_0xc04f('0x20')]]){_['merge'](this[_0xc04f('0xc')][_0x781829['uniqueid']],_[_0xc04f('0x3f')](_0x781829,[_0xc04f('0x40'),_0xc04f('0x41')]));}};function updateStatus(_0x5f2320){if(_0x5f2320[_0xc04f('0x42')]){faxMessage[_0xc04f('0x43')](_0x5f2320['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0xc04f('0x38')](function(_0x29224f){ut[_0xc04f('0x44')](_0xc04f('0x45'),_0x29224f);})[_0xc04f('0x3a')](function(_0x480aeb){ut['logger'](_0xc04f('0x46'),_0x480aeb);});}else{ut[_0xc04f('0x44')](_0xc04f('0x47'));}}Fax[_0xc04f('0x1c')][_0xc04f('0x48')]=function(_0x2ec7ad,_0x205803,_0x164f4b){var _0x41ffbb=this;var _0x595471={};if(_0x205803){_0x595471={'read':_0x205803};}else{_0x595471={'failMessage':_0x164f4b};}if(this[_0xc04f('0xf')][_0x2ec7ad][_0xc04f('0x42')]){faxMessage[_0xc04f('0x43')](this['actions'][_0x2ec7ad]['AttachmentId'],_0x595471)['then'](function(_0x3136d6){ut[_0xc04f('0x44')](_0xc04f('0x49'),_0x3136d6);})[_0xc04f('0x3a')](function(_0x55d03a){ut['logger'](_0xc04f('0x4a'),_0x55d03a);})[_0xc04f('0x4b')](function(){delete _0x41ffbb[_0xc04f('0xc')][_0x2ec7ad];delete _0x41ffbb[_0xc04f('0xf')][_0x2ec7ad];});}else{ut[_0xc04f('0x44')](_0xc04f('0x4c'));this[_0xc04f('0x4d')](_0x2ec7ad);delete this['actions'][_0x2ec7ad];}};Fax[_0xc04f('0x1c')][_0xc04f('0x4e')]=function(_0x103dab){var _0x41d551=this;if(this['channels'][_0x103dab['uniqueid']]){if(this[_0xc04f('0xf')][_0x103dab[_0xc04f('0x20')]]){this[_0xc04f('0xc')][_0x103dab[_0xc04f('0x20')]]['id']=this[_0xc04f('0xf')][_0x103dab['uniqueid']]['id'];this['channels'][_0x103dab[_0xc04f('0x20')]][_0xc04f('0x22')]=this[_0xc04f('0xf')][_0x103dab['uniqueid']]['name'];}logger[_0xc04f('0x24')](_0x103dab[_0xc04f('0x20')],this[_0xc04f('0xf')][_0x103dab['uniqueid']]?_0xc04f('0x4f'):'\x20hangup\x20faxRiceive\x20',JSON[_0xc04f('0x3d')](this[_0xc04f('0xc')][_0x103dab[_0xc04f('0x20')]]));if(this['actions'][_0x103dab[_0xc04f('0x20')]]){if(this[_0xc04f('0xc')][_0x103dab[_0xc04f('0x20')]][_0xc04f('0x50')]>0x0&&this['channels'][_0x103dab[_0xc04f('0x20')]][_0xc04f('0x15')]==='SUCCESS'){this[_0xc04f('0x48')](_0x103dab[_0xc04f('0x20')],!![]);}else{this[_0xc04f('0x48')](_0x103dab[_0xc04f('0x20')],![],this['channels'][_0x103dab[_0xc04f('0x20')]][_0xc04f('0x51')]?_0xc04f('0x52')+this['channels'][_0x103dab[_0xc04f('0x20')]][_0xc04f('0x51')]:_0xc04f('0x53'));}}}};Fax[_0xc04f('0x1c')][_0xc04f('0x54')]=function(_0x4ec4d4){var _0x33be1a=this;return new BPromise(function(_0x7bf319,_0x82fcf3){_0x33be1a[_0xc04f('0x55')](_0x4ec4d4,_0x33be1a[_0xc04f('0xd')][_0x4ec4d4['FaxAccountId']])[_0xc04f('0x38')](function(_0x1cf449){ut['logger'](_0xc04f('0x56'),_0x1cf449);_0x7bf319(ut[_0xc04f('0x57')](_0xc04f('0x58')));})[_0xc04f('0x3a')](function(_0x1513bd){ut[_0xc04f('0x44')](_0xc04f('0x59'),_0x1513bd);updateStatus(_0x4ec4d4);_0x82fcf3(ut[_0xc04f('0x57')]('Fax\x20failed'));});});};Fax['prototype'][_0xc04f('0x5a')]=function(_0x15b952){var _0x2e2c91=this;return new BPromise(function(_0x3ea8bf,_0x29dc2b){var _0x246d15=_0x2e2c91[_0xc04f('0x5b')](_0x2e2c91[_0xc04f('0xd')][_0x15b952[_0xc04f('0x5c')]][_0xc04f('0x5d')],_0x15b952);if(_0x246d15[_0xc04f('0x5e')]){_0x3ea8bf(ut[_0xc04f('0x57')]('Trunk\x20Reachable'));}else{_0x29dc2b(ut['message'](_0x246d15[_0xc04f('0x57')]));}});};function originate(_0x3e1bb6,_0x26ca6d,_0x2e82c9){return new BPromise(function(_0x36831e,_0x7fd686){if(_0x2e82c9){var _0x524b41=util['format'](_0xc04f('0x5f'),path[_0xc04f('0x36')](_0x3e1bb6[_0xc04f('0x3')])['name'],_0x3e1bb6[_0xc04f('0x3')]);gs[_0xc04f('0x60')](_0x524b41)[_0xc04f('0x38')](function(){_0x3e1bb6['path']=util[_0xc04f('0x61')](_0xc04f('0x62'),path['parse'](_0x3e1bb6[_0xc04f('0x3')])[_0xc04f('0x63')],path['parse'](_0x3e1bb6['path'])[_0xc04f('0x22')]);_0x26ca6d['XMF-PATH']=_0x3e1bb6[_0xc04f('0x3')];ut[_0xc04f('0x44')]('Convert\x20pdf\x20to\x20tif','');ami[_0xc04f('0x64')](ut[_0xc04f('0x65')](_0x3e1bb6,_0x26ca6d))[_0xc04f('0x38')](function(_0xfd04e6){_0x36831e(_0xfd04e6);})[_0xc04f('0x3a')](function(_0x3b5a88){_0x7fd686(_0x3b5a88);});})[_0xc04f('0x3a')](function(_0x33c38b){_0x7fd686(_0x33c38b);});}else{ami['Action'](ut[_0xc04f('0x65')](_0x3e1bb6,_0x26ca6d))[_0xc04f('0x38')](function(_0x364860){_0x36831e(_0x364860);})[_0xc04f('0x3a')](function(_0x30eece){_0x7fd686(_0x30eece);});}});}Fax[_0xc04f('0x1c')][_0xc04f('0x55')]=function(_0x562f0c,_0x52d5bb){var _0x23abbf=this;return new BPromise(function(_0x3c7e28,_0x27ab61){var _0x32934f=uuid['v4']();var _0x47689d=ut['addVariables'](_0x562f0c,_0x52d5bb);_0x23abbf[_0xc04f('0xf')][_0x32934f]=new Action(_0x32934f,_0x52d5bb,_0x562f0c);var _0x476005=_0x23abbf[_0xc04f('0xf')][_0x32934f];if(path[_0xc04f('0x36')](_0x562f0c[_0xc04f('0x3')])[_0xc04f('0x66')]===_0xc04f('0x37')){originate(_0x476005,_0x47689d,!![])[_0xc04f('0x38')](function(_0x4a4e4d){_0x3c7e28(_0x4a4e4d);})[_0xc04f('0x3a')](function(_0x690402){_0x27ab61(_0x690402);});}else{originate(_0x476005,_0x47689d,![])[_0xc04f('0x38')](function(_0x1b958){_0x3c7e28(_0x1b958);})['catch'](function(_0x3c0903){_0x27ab61(_0x3c0903);});}});};Fax[_0xc04f('0x1c')][_0xc04f('0x67')]=function(_0x2620f6){return!_[_0xc04f('0x68')](_0x2620f6)&&!_[_0xc04f('0x68')](_0x2620f6[_0xc04f('0x22')])&&!_[_0xc04f('0x68')](_0x2620f6['active'])&&_0x2620f6[_0xc04f('0x69')]&&!_[_0xc04f('0x68')](this['trunks'][util[_0xc04f('0x61')](_0xc04f('0x6a'),_0x2620f6['name'])])&&!_['isNil'](this[_0xc04f('0xe')][util[_0xc04f('0x61')]('SIP/%s',_0x2620f6[_0xc04f('0x22')])][_0xc04f('0x2b')])&&(this[_0xc04f('0xe')][util[_0xc04f('0x61')](_0xc04f('0x6a'),_0x2620f6[_0xc04f('0x22')])][_0xc04f('0x2b')]===_0xc04f('0x6b')||this['trunks'][util[_0xc04f('0x61')]('SIP/%s',_0x2620f6['name'])][_0xc04f('0x2b')]==='unmonitored');};Fax[_0xc04f('0x1c')]['checkTrunk']=function(_0x37fdc2,_0x52b7e1){if(!this[_0xc04f('0x67')](_0x37fdc2)){ut[_0xc04f('0x44')](_0xc04f('0x6c'),_[_0xc04f('0x68')](_0x37fdc2)?'':_0x37fdc2[_0xc04f('0x22')]+_0xc04f('0x6d'));return{'isValid':![],'message':_0xc04f('0x6e')};}if(_[_0xc04f('0x68')](_0x52b7e1[_0xc04f('0x7')])){ut[_0xc04f('0x44')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xc04f('0x3d')](_0x52b7e1));return{'isValid':![],'message':_0xc04f('0x6f')};}if(_['isNil'](_0x52b7e1['path'])){ut['logger'](_0xc04f('0x70'),JSON[_0xc04f('0x3d')](_0x52b7e1));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0xc04f('0x71')};};Fax[_0xc04f('0x1c')][_0xc04f('0x4d')]=function(_0x4e48d3,_0x439f06=0x2710){if(this['channels'][_0x4e48d3]){setTimeout(()=>{delete this[_0xc04f('0xc')][_0x4e48d3];},_0x439f06);}};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 3229bcf..55498af 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 _0x82b8=['util','bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','inspect','notify','resolve','then','catch','[Notify]\x20'];(function(_0x877b71,_0x462389){var _0x38e64d=function(_0xf99d03){while(--_0xf99d03){_0x877b71['push'](_0x877b71['shift']());}};_0x38e64d(++_0x462389);}(_0x82b8,0xdd));var _0x882b=function(_0x356dde,_0x32ab07){_0x356dde=_0x356dde-0x0;var _0x316411=_0x82b8[_0x356dde];return _0x316411;};'use strict';var util=require(_0x882b('0x0'));var BPromise=require(_0x882b('0x1'));var logger=require(_0x882b('0x2'))(_0x882b('0x3'));var _=require(_0x882b('0x4'));var faxAccount=require(_0x882b('0x5'));function loggerCatch(_0x316c28){return function(_0x4a1d23){logger[_0x882b('0x6')](_0x316c28,util[_0x882b('0x7')](_0x4a1d23,{'showHidden':![],'depth':null}));};}exports[_0x882b('0x8')]=function(_0x3a3c5a,_0xc8dc4b){return BPromise[_0x882b('0x9')]()[_0x882b('0xa')](faxAccount[_0x882b('0x8')](_0x3a3c5a,_0xc8dc4b))[_0x882b('0xb')](loggerCatch(_0x882b('0xc')));}; \ No newline at end of file +var _0x42a1=['util','bluebird','../../../config/logger','preview','lodash','error','inspect','resolve','catch','[Notify]\x20'];(function(_0x54830e,_0x3db89c){var _0x40ef14=function(_0x49ec24){while(--_0x49ec24){_0x54830e['push'](_0x54830e['shift']());}};_0x40ef14(++_0x3db89c);}(_0x42a1,0x19a));var _0x142a=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0x42a1[_0x99facc];return _0xd39ed0;};'use strict';var util=require(_0x142a('0x0'));var BPromise=require(_0x142a('0x1'));var logger=require(_0x142a('0x2'))(_0x142a('0x3'));var _=require(_0x142a('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x38a14f){return function(_0x3164ad){logger[_0x142a('0x5')](_0x38a14f,util[_0x142a('0x6')](_0x3164ad,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x4f14b0,_0x2efb44){return BPromise[_0x142a('0x7')]()['then'](faxAccount['notify'](_0x4f14b0,_0x2efb44))[_0x142a('0x8')](loggerCatch(_0x142a('0x9')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index c05d3bc..a397016 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 _0x1bc0=['fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0x1bc0,0x11c));var _0x01bc=function(_0x530dad,_0x2797a1){_0x530dad=_0x530dad-0x0;var _0x3357e9=_0x1bc0[_0x530dad];return _0x3357e9;};'use strict';var util=require(_0x01bc('0x0'));var logger=require(_0x01bc('0x1'))(_0x01bc('0x2'));var BPromise=require(_0x01bc('0x3'));var exec=require(_0x01bc('0x4'))[_0x01bc('0x5')];exports[_0x01bc('0x6')]=function(_0x4e2650){return new BPromise(function(_0x56f03f,_0x1e1095){exec(_0x4e2650,function(_0x591b53,_0x511120,_0x29389b){logger[_0x01bc('0x7')]('Exec\x20gs',_0x511120);if(_0x591b53){logger['info'](_0x01bc('0x8'),_0x01bc('0x9'),util[_0x01bc('0xa')](_0x591b53,{'showHidden':![],'depth':null}),_0x511120,_0x29389b);_0x1e1095(_0x591b53);}_0x56f03f(_0x511120);});});}; \ No newline at end of file +var _0xd5f9=['../../../../config/logger','bluebird','child_process','info','Exec\x20gs','\x20Error\x20:','util'];(function(_0x9a3d47,_0x1953a0){var _0xf60b78=function(_0x31575d){while(--_0x31575d){_0x9a3d47['push'](_0x9a3d47['shift']());}};_0xf60b78(++_0x1953a0);}(_0xd5f9,0x18e));var _0x9d5f=function(_0x40ba7c,_0x3622f5){_0x40ba7c=_0x40ba7c-0x0;var _0x59b6b6=_0xd5f9[_0x40ba7c];return _0x59b6b6;};'use strict';var util=require(_0x9d5f('0x0'));var logger=require(_0x9d5f('0x1'))('fax');var BPromise=require(_0x9d5f('0x2'));var exec=require(_0x9d5f('0x3'))['exec'];exports['execute']=function(_0x19cd9a){return new BPromise(function(_0x17937d,_0x1ad601){exec(_0x19cd9a,function(_0x529e5b,_0x47d61c,_0x46862c){logger[_0x9d5f('0x4')](_0x9d5f('0x5'),_0x47d61c);if(_0x529e5b){logger[_0x9d5f('0x4')]('Exec\x20gs',_0x9d5f('0x6'),util['inspect'](_0x529e5b,{'showHidden':![],'depth':null}),_0x47d61c,_0x46862c);_0x1ad601(_0x529e5b);}_0x17937d(_0x47d61c);});});}; \ 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 80d796d..d097bfb 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 _0xb366=['path','variablesAction','uniqueid','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','moment','../../../../config/logger','message','info','inspect','addVariables','minrate','maxrate','format','\x22%s\x22','modem','gateway','t38timeout','localstationid'];(function(_0x5e4f42,_0x296563){var _0x24a54e=function(_0x3e2b49){while(--_0x3e2b49){_0x5e4f42['push'](_0x5e4f42['shift']());}};_0x24a54e(++_0x296563);}(_0xb366,0x1d4));var _0x6b36=function(_0x5f2643,_0x2f987f){_0x5f2643=_0x5f2643-0x0;var _0x2d05dc=_0xb366[_0x5f2643];return _0x2d05dc;};'use strict';var util=require(_0x6b36('0x0'));var _=require('lodash');var moment=require(_0x6b36('0x1'));var logger=require(_0x6b36('0x2'))('fax');exports[_0x6b36('0x3')]=function(_0x442899){return{'message':_0x442899};};exports['logger']=function(_0x565120,_0x436eea){logger[_0x6b36('0x4')](_0x565120,util[_0x6b36('0x5')](_0x436eea,{'showHidden':![],'depth':null}));};exports[_0x6b36('0x6')]=function(_0x36ae1c,_0x203e7c){var _0x1eaff7={'XMF-ECM':_0x203e7c['ecm'],'XMF-HEADERINFO':_0x203e7c['headerinfo'],'XMF-MINRATE':_0x203e7c[_0x6b36('0x7')],'XMF-MAXRATE':_0x203e7c[_0x6b36('0x8')],'XMF-MODEM':util[_0x6b36('0x9')](_0x6b36('0xa'),_0x203e7c[_0x6b36('0xb')]),'XMF-GATEWAY':_0x203e7c[_0x6b36('0xc')],'XMF-FAXDETECT':_0x203e7c['faxdetect'],'XMF-T38TIMEOUT':_0x203e7c[_0x6b36('0xd')],'XMF-LOCALSTATIONID':_0x203e7c[_0x6b36('0xe')],'XMF-PATH':_0x36ae1c[_0x6b36('0xf')]};return _0x1eaff7;};exports[_0x6b36('0x10')]=function(_0x47f194,_0x2f00e1){return{'actionid':_0x47f194[_0x6b36('0x11')],'action':'originate','channel':_0x47f194[_0x6b36('0x12')],'Exten':_0x6b36('0x13'),'Context':_0x6b36('0x14'),'Priority':'1','callerid':util['format'](_0x6b36('0x15'),_0x47f194[_0x6b36('0x16')]?_0x47f194['headerinfo']:'',_0x47f194['localstationid']),'variable':_0x2f00e1,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x47f194[_0x6b36('0x11')]};}; \ No newline at end of file +var _0x579c=['maxrate','format','\x22%s\x22','modem','gateway','faxdetect','t38timeout','path','variablesAction','originate','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','localstationid','uniqueid','moment','../../../../config/logger','fax','message','logger','info','inspect','addVariables','minrate'];(function(_0x308c81,_0x3b1c85){var _0x5cc912=function(_0xbfd935){while(--_0xbfd935){_0x308c81['push'](_0x308c81['shift']());}};_0x5cc912(++_0x3b1c85);}(_0x579c,0x10a));var _0xc579=function(_0x576e49,_0x2455fa){_0x576e49=_0x576e49-0x0;var _0x192a1a=_0x579c[_0x576e49];return _0x192a1a;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xc579('0x0'));var logger=require(_0xc579('0x1'))(_0xc579('0x2'));exports[_0xc579('0x3')]=function(_0x564c74){return{'message':_0x564c74};};exports[_0xc579('0x4')]=function(_0x14f397,_0x37494e){logger[_0xc579('0x5')](_0x14f397,util[_0xc579('0x6')](_0x37494e,{'showHidden':![],'depth':null}));};exports[_0xc579('0x7')]=function(_0x185a56,_0x19231c){var _0x39506b={'XMF-ECM':_0x19231c['ecm'],'XMF-HEADERINFO':_0x19231c['headerinfo'],'XMF-MINRATE':_0x19231c[_0xc579('0x8')],'XMF-MAXRATE':_0x19231c[_0xc579('0x9')],'XMF-MODEM':util[_0xc579('0xa')](_0xc579('0xb'),_0x19231c[_0xc579('0xc')]),'XMF-GATEWAY':_0x19231c[_0xc579('0xd')],'XMF-FAXDETECT':_0x19231c[_0xc579('0xe')],'XMF-T38TIMEOUT':_0x19231c[_0xc579('0xf')],'XMF-LOCALSTATIONID':_0x19231c['localstationid'],'XMF-PATH':_0x185a56[_0xc579('0x10')]};return _0x39506b;};exports[_0xc579('0x11')]=function(_0x143c7e,_0x5d9c5c){return{'actionid':_0x143c7e['uniqueid'],'action':_0xc579('0x12'),'channel':_0x143c7e['channel'],'Exten':_0xc579('0x13'),'Context':_0xc579('0x14'),'Priority':'1','callerid':util['format'](_0xc579('0x15'),_0x143c7e['headerinfo']?_0x143c7e[_0xc579('0x16')]:'',_0x143c7e[_0xc579('0x17')]),'variable':_0x5d9c5c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x143c7e[_0xc579('0x18')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 8a2b0ef..5da7ac0 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 _0x91a7=['inspect','listen','sync','catch','[index.js][main]','util','moment','./server','./realtime','./report','./acw','./trigger','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','initTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','error','[index.js][initParams]'];(function(_0x34ad09,_0xba8f16){var _0x4c8431=function(_0x78b555){while(--_0x78b555){_0x34ad09['push'](_0x34ad09['shift']());}};_0x4c8431(++_0xba8f16);}(_0x91a7,0x129));var _0x791a=function(_0x4bab2c,_0x161460){_0x4bab2c=_0x4bab2c-0x0;var _0x3ddbcf=_0x91a7[_0x4bab2c];return _0x3ddbcf;};'use strict';var util=require(_0x791a('0x0'));var moment=require(_0x791a('0x1'));var server=require(_0x791a('0x2'));var Realtime=require(_0x791a('0x3'));var Report=require(_0x791a('0x4'));var Acw=require(_0x791a('0x5'));var Trigger=require(_0x791a('0x6'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x791a('0x7'));var user=require(_0x791a('0x8'));var voiceQueue=require(_0x791a('0x9'));var voiceQueueReport=require(_0x791a('0xa'));var voiceCallReport=require(_0x791a('0xb'));var trunk=require(_0x791a('0xc'));var trigger=require('./rpc/trigger');var template=require(_0x791a('0xd'));var cmHopperHistory=require(_0x791a('0xe'));var campaign=require(_0x791a('0xf'));var voiceExtension=require(_0x791a('0x10'));var faxAccount=require(_0x791a('0x11'));var zendesk=require(_0x791a('0x12'));var salesforce=require(_0x791a('0x13'));var sugarcrm=require(_0x791a('0x14'));var freshdesk=require(_0x791a('0x15'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x791a('0x16'));var freshsales=require(_0x791a('0x17'));var servicenow=require(_0x791a('0x18'));var dynamics365=require(_0x791a('0x19'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x791a('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x791a('0x1b')](_0x791a('0x1c'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0x791a('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x791a('0x1d')]()[_0x791a('0x1e')](user[_0x791a('0x1f')]())['then'](realtime[_0x791a('0x20')]())[_0x791a('0x1e')](user[_0x791a('0x21')]())['then'](realtime[_0x791a('0x22')]())[_0x791a('0x1e')](trunk['getTrunks']())['then'](realtime[_0x791a('0x23')]())[_0x791a('0x1e')](voiceQueue[_0x791a('0x24')]())[_0x791a('0x1e')](realtime['initVoiceQueues']())['then'](trigger[_0x791a('0x25')]())[_0x791a('0x1e')](realtime[_0x791a('0x26')]())['then'](template[_0x791a('0x27')]())[_0x791a('0x1e')](realtime[_0x791a('0x28')]())[_0x791a('0x1e')](zendesk[_0x791a('0x29')]())['then'](realtime[_0x791a('0x2a')]())[_0x791a('0x1e')](salesforce[_0x791a('0x2b')]())[_0x791a('0x1e')](realtime['initSalesforceAccounts']())[_0x791a('0x1e')](sugarcrm[_0x791a('0x2c')]())[_0x791a('0x1e')](realtime['initSugarcrmAccounts']())[_0x791a('0x1e')](freshdesk[_0x791a('0x2d')]())[_0x791a('0x1e')](realtime[_0x791a('0x2e')]())[_0x791a('0x1e')](desk[_0x791a('0x2f')]())['then'](realtime[_0x791a('0x30')]())[_0x791a('0x1e')](zoho[_0x791a('0x31')]())[_0x791a('0x1e')](realtime[_0x791a('0x32')]())[_0x791a('0x1e')](vtiger[_0x791a('0x33')]())[_0x791a('0x1e')](realtime[_0x791a('0x34')]())[_0x791a('0x1e')](freshsales[_0x791a('0x35')]())[_0x791a('0x1e')](realtime[_0x791a('0x36')]())[_0x791a('0x1e')](servicenow[_0x791a('0x37')]())[_0x791a('0x1e')](realtime['initServicenowAccounts']())[_0x791a('0x1e')](dynamics365[_0x791a('0x38')]())[_0x791a('0x1e')](realtime[_0x791a('0x39')]())[_0x791a('0x1e')](campaign[_0x791a('0x3a')]())['then'](realtime[_0x791a('0x3b')]())['then'](voiceExtension[_0x791a('0x3c')]())['then'](realtime[_0x791a('0x3d')]())['then'](faxAccount[_0x791a('0x3e')]())[_0x791a('0x1e')](realtime['initFaxAccounts']())[_0x791a('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0x791a('0x1d')]()[_0x791a('0x1e')](voiceQueueReport['getVoiceQueueReports']())[_0x791a('0x1e')](realtime['initVoiceQueueReports']())[_0x791a('0x1e')](cmHopperHistory[_0x791a('0x3f')]())[_0x791a('0x1e')](realtime['initVoiceQueueHopperHistory']())[_0x791a('0x1e')](cmHopperHistory['getCampaignHopperHistory']())[_0x791a('0x1e')](realtime['initCampaignHopperHistory']())[_0x791a('0x1e')](voiceCallReport[_0x791a('0x40')]())[_0x791a('0x1e')](realtime[_0x791a('0x41')]())['catch'](function(_0x514239){logger[_0x791a('0x42')](_0x791a('0x43'),util[_0x791a('0x44')](_0x514239,{'showHidden':![],'depth':null}));});}function main(){return server[_0x791a('0x45')](realtime,preview,fax)[_0x791a('0x1e')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x791a('0x1e')](function(){report[_0x791a('0x46')]();setInterval(initRealtime,0x1388);})[_0x791a('0x47')](function(_0x5ac0f1){logger[_0x791a('0x42')](_0x791a('0x48'),util[_0x791a('0x44')](_0x5ac0f1,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xf87f=['../../config/logger','ami','get','hour','resolve','getAgents','then','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','./server','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./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'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf87f,0x18d));var _0xff87=function(_0x5659c0,_0x5f2532){_0x5659c0=_0x5659c0-0x0;var _0x36e3c0=_0xf87f[_0x5659c0];return _0x36e3c0;};'use strict';var util=require(_0xff87('0x0'));var moment=require('moment');var server=require(_0xff87('0x1'));var Realtime=require('./realtime');var Report=require(_0xff87('0x2'));var Acw=require(_0xff87('0x3'));var Trigger=require(_0xff87('0x4'));var Dialer=require('./dialer');var Preview=require(_0xff87('0x5'));var Fax=require(_0xff87('0x6'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0xff87('0x7'));var voiceCallReport=require(_0xff87('0x8'));var trunk=require(_0xff87('0x9'));var trigger=require('./rpc/trigger');var template=require(_0xff87('0xa'));var cmHopperHistory=require(_0xff87('0xb'));var campaign=require(_0xff87('0xc'));var voiceExtension=require(_0xff87('0xd'));var faxAccount=require(_0xff87('0xe'));var zendesk=require(_0xff87('0xf'));var salesforce=require(_0xff87('0x10'));var sugarcrm=require(_0xff87('0x11'));var freshdesk=require(_0xff87('0x12'));var desk=require(_0xff87('0x13'));var zoho=require(_0xff87('0x14'));var vtiger=require(_0xff87('0x15'));var freshsales=require(_0xff87('0x16'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require('./rpc/integrations/dynamics365');var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xff87('0x17'))(_0xff87('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xff87('0x19')](_0xff87('0x1a'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xff87('0x19')](_0xff87('0x1a'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xff87('0x1b')]()['then'](user[_0xff87('0x1c')]())['then'](realtime['initAgents']())[_0xff87('0x1d')](user[_0xff87('0x1e')]())[_0xff87('0x1d')](realtime[_0xff87('0x1f')]())[_0xff87('0x1d')](trunk[_0xff87('0x20')]())[_0xff87('0x1d')](realtime[_0xff87('0x21')]())[_0xff87('0x1d')](voiceQueue['getVoiceQueues']())['then'](realtime[_0xff87('0x22')]())['then'](trigger[_0xff87('0x23')]())[_0xff87('0x1d')](realtime['initTriggers']())[_0xff87('0x1d')](template[_0xff87('0x24')]())['then'](realtime[_0xff87('0x25')]())[_0xff87('0x1d')](zendesk[_0xff87('0x26')]())['then'](realtime[_0xff87('0x27')]())[_0xff87('0x1d')](salesforce[_0xff87('0x28')]())[_0xff87('0x1d')](realtime[_0xff87('0x29')]())[_0xff87('0x1d')](sugarcrm[_0xff87('0x2a')]())[_0xff87('0x1d')](realtime[_0xff87('0x2b')]())[_0xff87('0x1d')](freshdesk[_0xff87('0x2c')]())[_0xff87('0x1d')](realtime[_0xff87('0x2d')]())[_0xff87('0x1d')](desk[_0xff87('0x2e')]())['then'](realtime[_0xff87('0x2f')]())[_0xff87('0x1d')](zoho[_0xff87('0x30')]())[_0xff87('0x1d')](realtime[_0xff87('0x31')]())['then'](vtiger['getVtigerAccounts']())[_0xff87('0x1d')](realtime[_0xff87('0x32')]())[_0xff87('0x1d')](freshsales[_0xff87('0x33')]())[_0xff87('0x1d')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0xff87('0x34')]())[_0xff87('0x1d')](realtime[_0xff87('0x35')]())[_0xff87('0x1d')](dynamics365[_0xff87('0x36')]())[_0xff87('0x1d')](realtime[_0xff87('0x37')]())[_0xff87('0x1d')](campaign[_0xff87('0x38')]())[_0xff87('0x1d')](realtime[_0xff87('0x39')]())[_0xff87('0x1d')](voiceExtension['getVoiceExtensions']())['then'](realtime['initVoiceExtensions']())[_0xff87('0x1d')](faxAccount[_0xff87('0x3a')]())[_0xff87('0x1d')](realtime[_0xff87('0x3b')]())['then'](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0xff87('0x1d')](voiceQueueReport['getVoiceQueueReports']())[_0xff87('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xff87('0x3c')]())[_0xff87('0x1d')](realtime['initVoiceQueueHopperHistory']())[_0xff87('0x1d')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0xff87('0x3d')]())['then'](realtime[_0xff87('0x3e')]())[_0xff87('0x3f')](function(_0x4e69f2){logger[_0xff87('0x40')](_0xff87('0x41'),util[_0xff87('0x42')](_0x4e69f2,{'showHidden':![],'depth':null}));});}function main(){return server[_0xff87('0x43')](realtime,preview,fax)[_0xff87('0x1d')](function(){return initRealtime();})['then'](function(){return initParams();})[_0xff87('0x1d')](function(){report[_0xff87('0x44')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x3aba13){logger[_0xff87('0x40')](_0xff87('0x45'),util[_0xff87('0x42')](_0x3aba13,{'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 d2223b0..e2eb4d1 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 _0x6ac7=['fullname','state','status','address','phone','mobile','interface','online','voiceStatus','unknown','voiceStatusTime','voiceStatusQueue','onhold','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','statePause','toNumber','voiceStatusCallerIdNumber','format','user:%s','emit','user:ami:update','omit','user:presence','exports','lodash','util','moment','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6ac7,0x1e0));var _0x76ac=function(_0x27004a,_0x5a4589){_0x27004a=_0x27004a-0x0;var _0x265821=_0x6ac7[_0x27004a];return _0x265821;};'use strict';var _=require(_0x76ac('0x0'));var util=require(_0x76ac('0x1'));var moment=require(_0x76ac('0x2'));var md5=require(_0x76ac('0x3'));var Redis=require('ioredis');var config=require(_0x76ac('0x4'));config[_0x76ac('0x5')]=_[_0x76ac('0x6')](config[_0x76ac('0x5')],{'host':_0x76ac('0x7'),'port':0x18eb});var io=require(_0x76ac('0x8'))(new Redis(config['redis']));function Agent(_0x3a9456){this['id']=_0x3a9456['id']||0x0;this[_0x76ac('0x9')]=_0x3a9456['name']||'';this[_0x76ac('0xa')]=_0x3a9456[_0x76ac('0xa')]||'';this[_0x76ac('0xb')]=_0x3a9456[_0x76ac('0xb')]||'';this[_0x76ac('0xc')]=_0x3a9456[_0x76ac('0xc')]||'';this[_0x76ac('0xd')]='unknown';this['stateTime']=0x0;this[_0x76ac('0xe')]='unknown';this[_0x76ac('0xf')]='';this[_0x76ac('0x10')]='';this[_0x76ac('0x11')]='';this[_0x76ac('0x12')]='';this[_0x76ac('0x13')]=_0x3a9456['online']||![];this[_0x76ac('0x14')]=_0x76ac('0x15');this[_0x76ac('0x16')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0x76ac('0x17')]='';this[_0x76ac('0x18')]=![];this['local']=![];this[_0x76ac('0x3')]='';}Agent[_0x76ac('0x19')][_0x76ac('0x1a')]=function(_0x16e986){var _0x5cd4b7;if(_0x16e986&&_0x16e986['state']){_0x5cd4b7=_0x16e986[_0x76ac('0xd')][_0x76ac('0x1b')]();switch(_0x5cd4b7){case _0x76ac('0x1c'):_0x5cd4b7=_0x76ac('0x1d');break;case'inuse':_0x5cd4b7=_0x76ac('0x1e');break;}}if(_0x5cd4b7&&this[_0x76ac('0x14')]!==_0x5cd4b7||_0x16e986[_0x76ac('0x1f')]){this[_0x76ac('0x16')]=_[_0x76ac('0x20')](moment()['format']('x'));}if(_0x5cd4b7){this[_0x76ac('0x14')]=_0x5cd4b7;}var _0x560549={'id':this['id'],'name':this[_0x76ac('0x9')],'email':this[_0x76ac('0xa')],'accountcode':this['accountcode'],'fullname':this[_0x76ac('0xc')],'state':this[_0x76ac('0xd')],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0x76ac('0xf')],'online':this['online'],'voiceStatus':this[_0x76ac('0x14')],'voiceStatusTime':this[_0x76ac('0x16')],'voiceStatusCallerIdNumber':this[_0x76ac('0x21')],'voiceStatusQueue':this[_0x76ac('0x17')],'interface':this[_0x76ac('0x12')],'onhold':this[_0x76ac('0x18')]};var _0xbb4a66=md5(JSON['stringify'](_0x560549));if(this[_0x76ac('0x3')]!==_0xbb4a66){this[_0x76ac('0x3')]=_0xbb4a66;io['to'](util[_0x76ac('0x22')](_0x76ac('0x23'),_0x560549[_0x76ac('0x9')]))[_0x76ac('0x24')](_0x76ac('0x25'),_[_0x76ac('0x26')](_0x560549,[_0x76ac('0x13')]));io['emit'](_0x76ac('0x27'),_0x560549);}};module[_0x76ac('0x28')]=Agent; \ No newline at end of file +var _0x2250=['voiceStatus','stringify','format','user:%s','emit','omit','exports','lodash','moment','md5','../../../config/environment','redis','defaults','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking'];(function(_0x755e,_0x140103){var _0x309489=function(_0x3b1c6d){while(--_0x3b1c6d){_0x755e['push'](_0x755e['shift']());}};_0x309489(++_0x140103);}(_0x2250,0xc0));var _0x0225=function(_0x22c393,_0x1f2389){_0x22c393=_0x22c393-0x0;var _0x161580=_0x2250[_0x22c393];return _0x161580;};'use strict';var _=require(_0x0225('0x0'));var util=require('util');var moment=require(_0x0225('0x1'));var md5=require(_0x0225('0x2'));var Redis=require('ioredis');var config=require(_0x0225('0x3'));config[_0x0225('0x4')]=_[_0x0225('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x2339cd){this['id']=_0x2339cd['id']||0x0;this[_0x0225('0x6')]=_0x2339cd['name']||'';this[_0x0225('0x7')]=_0x2339cd[_0x0225('0x7')]||'';this[_0x0225('0x8')]=_0x2339cd['accountcode']||'';this[_0x0225('0x9')]=_0x2339cd[_0x0225('0x9')]||'';this[_0x0225('0xa')]=_0x0225('0xb');this[_0x0225('0xc')]=0x0;this[_0x0225('0xd')]=_0x0225('0xb');this[_0x0225('0xe')]='';this[_0x0225('0xf')]='';this[_0x0225('0x10')]='';this['interface']='';this[_0x0225('0x11')]=_0x2339cd[_0x0225('0x11')]||![];this['voiceStatus']='unknown';this[_0x0225('0x12')]=0x0;this[_0x0225('0x13')]='';this[_0x0225('0x14')]='';this[_0x0225('0x15')]=![];this[_0x0225('0x16')]=![];this[_0x0225('0x2')]='';}Agent[_0x0225('0x17')][_0x0225('0x18')]=function(_0x4a216b){var _0x4a309b;if(_0x4a216b&&_0x4a216b[_0x0225('0xa')]){_0x4a309b=_0x4a216b[_0x0225('0xa')][_0x0225('0x19')]();switch(_0x4a309b){case _0x0225('0x1a'):_0x4a309b=_0x0225('0x1b');break;case _0x0225('0x1c'):_0x4a309b=_0x0225('0x1d');break;}}if(_0x4a309b&&this[_0x0225('0x1e')]!==_0x4a309b||_0x4a216b['statePause']){this[_0x0225('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x4a309b){this[_0x0225('0x1e')]=_0x4a309b;}var _0x4803c6={'id':this['id'],'name':this[_0x0225('0x6')],'email':this['email'],'accountcode':this[_0x0225('0x8')],'fullname':this[_0x0225('0x9')],'state':this[_0x0225('0xa')],'stateTime':this[_0x0225('0xc')],'status':this[_0x0225('0xd')],'address':this[_0x0225('0xe')],'online':this['online'],'voiceStatus':this[_0x0225('0x1e')],'voiceStatusTime':this[_0x0225('0x12')],'voiceStatusCallerIdNumber':this[_0x0225('0x13')],'voiceStatusQueue':this[_0x0225('0x14')],'interface':this['interface'],'onhold':this['onhold']};var _0xa233d3=md5(JSON[_0x0225('0x1f')](_0x4803c6));if(this[_0x0225('0x2')]!==_0xa233d3){this[_0x0225('0x2')]=_0xa233d3;io['to'](util[_0x0225('0x20')](_0x0225('0x21'),_0x4803c6['name']))[_0x0225('0x22')]('user:ami:update',_[_0x0225('0x23')](_0x4803c6,[_0x0225('0x11')]));io[_0x0225('0x22')]('user:presence',_0x4803c6);}};module[_0x0225('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index cf87316..071d12f 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 _0x0591=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','originated','temp','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x4fe17b,_0x3399c9){var _0x2973f3=function(_0x11cb84){while(--_0x11cb84){_0x4fe17b['push'](_0x4fe17b['shift']());}};_0x2973f3(++_0x3399c9);}(_0x0591,0x171));var _0x1059=function(_0x41f2f5,_0x14f33c){_0x41f2f5=_0x41f2f5-0x0;var _0x3d49f1=_0x0591[_0x41f2f5];return _0x3d49f1;};'use strict';function Campaign(_0x73f801){this['id']=_0x73f801['id']||0x0;this[_0x1059('0x0')]=_0x73f801[_0x1059('0x0')]||'';this[_0x1059('0x1')]=_0x73f801[_0x1059('0x1')]||_0x1059('0x2');this[_0x1059('0x3')]=0x0;this[_0x1059('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this['ivrTotalCallsDays']=0x0;this[_0x1059('0x5')]='';this[_0x1059('0x6')]=!![];this[_0x1059('0x7')]=_0x73f801[_0x1059('0x7')];this[_0x1059('0x8')]=_0x73f801['limitCalls'];this[_0x1059('0x9')]=_0x73f801[_0x1059('0x9')]||null;this[_0x1059('0xa')]=_0x73f801['dialGlobalInterval']?_0x73f801[_0x1059('0xa')]:null;this[_0x1059('0xb')]=_0x73f801['dialOriginateCallerIdName'];this[_0x1059('0xc')]=_0x73f801['dialOriginateCallerIdNumber'];this[_0x1059('0xd')]=_0x73f801[_0x1059('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x73f801[_0x1059('0xe')];this[_0x1059('0xf')]=_0x73f801[_0x1059('0xf')];this['dialBusyMaxRetry']=_0x73f801[_0x1059('0x10')];this['dialBusyRetryFrequency']=_0x73f801[_0x1059('0x11')];this[_0x1059('0x12')]=_0x73f801['dialNoAnswerMaxRetry'];this[_0x1059('0x13')]=_0x73f801[_0x1059('0x13')];this[_0x1059('0x14')]=_0x73f801[_0x1059('0x14')];this[_0x1059('0x15')]=_0x73f801[_0x1059('0x15')]||0x3;this[_0x1059('0x16')]=_0x73f801[_0x1059('0x16')]||0x96;this[_0x1059('0x17')]=_0x73f801[_0x1059('0x17')]||0x3;this[_0x1059('0x18')]=_0x73f801[_0x1059('0x18')]||0x96;this[_0x1059('0x19')]=_0x73f801[_0x1059('0x19')]||0x3;this[_0x1059('0x1a')]=_0x73f801[_0x1059('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x73f801[_0x1059('0x1b')]||0x3;this[_0x1059('0x1c')]=_0x73f801[_0x1059('0x1c')]||0x96;this[_0x1059('0x1d')]=_0x73f801[_0x1059('0x1d')]||0x3;this[_0x1059('0x1e')]=_0x73f801[_0x1059('0x1e')]||0x96;this[_0x1059('0x1f')]=_0x73f801[_0x1059('0x1f')]||_0x1059('0x20');this[_0x1059('0x21')]=_0x73f801[_0x1059('0x21')]||undefined;this[_0x1059('0x22')]=_0x73f801[_0x1059('0x22')]||undefined;this[_0x1059('0x23')]=_0x73f801['dialCutDigit']||undefined;this[_0x1059('0x24')]=_0x73f801[_0x1059('0x24')]?_0x73f801['TrunkBackup']:undefined;this[_0x1059('0x25')]=_0x73f801[_0x1059('0x25')]?_0x73f801['Trunk']:undefined;this['Interval']=_0x73f801[_0x1059('0x26')]?_0x73f801['Interval']:undefined;this[_0x1059('0x27')]=_0x73f801[_0x1059('0x27')]?_0x73f801[_0x1059('0x27')]:undefined;this[_0x1059('0x28')]=_0x73f801[_0x1059('0x27')]?_0x73f801[_0x1059('0x27')][_0x1059('0x0')]:undefined;this[_0x1059('0x29')]=_0x73f801[_0x1059('0x29')]||![];this['dialAMDInitialSilence']=_0x73f801[_0x1059('0x2a')];this[_0x1059('0x2b')]=_0x73f801['dialAMDGreeting'];this[_0x1059('0x2c')]=_0x73f801[_0x1059('0x2c')];this[_0x1059('0x2d')]=_0x73f801[_0x1059('0x2d')];this[_0x1059('0x2e')]=_0x73f801[_0x1059('0x2e')];this[_0x1059('0x2f')]=_0x73f801[_0x1059('0x2f')];this[_0x1059('0x30')]=_0x73f801[_0x1059('0x30')];this[_0x1059('0x31')]=_0x73f801[_0x1059('0x31')];this['dialAMDMaximumWordLength']=_0x73f801[_0x1059('0x32')];}module[_0x1059('0x33')]=Campaign; \ No newline at end of file +var _0x4bdb=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','type','campaign','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency'];(function(_0xb26c7a,_0x202458){var _0x539326=function(_0x5b9f10){while(--_0x5b9f10){_0xb26c7a['push'](_0xb26c7a['shift']());}};_0x539326(++_0x202458);}(_0x4bdb,0x142));var _0xb4bd=function(_0x1ea9a3,_0x27d5fb){_0x1ea9a3=_0x1ea9a3-0x0;var _0x3c8ced=_0x4bdb[_0x1ea9a3];return _0x3c8ced;};'use strict';function Campaign(_0x480bfe){this['id']=_0x480bfe['id']||0x0;this[_0xb4bd('0x0')]=_0x480bfe[_0xb4bd('0x0')]||'';this[_0xb4bd('0x1')]=_0x480bfe['type']||_0xb4bd('0x2');this[_0xb4bd('0x3')]=0x0;this[_0xb4bd('0x4')]=0x0;this[_0xb4bd('0x5')]=0x0;this[_0xb4bd('0x6')]=0x0;this[_0xb4bd('0x7')]='';this['sendMessageOneNotActive']=!![];this[_0xb4bd('0x8')]=_0x480bfe['active'];this[_0xb4bd('0x9')]=_0x480bfe[_0xb4bd('0x9')];this[_0xb4bd('0xa')]=_0x480bfe[_0xb4bd('0xa')]||null;this[_0xb4bd('0xb')]=_0x480bfe[_0xb4bd('0xb')]?_0x480bfe['dialGlobalInterval']:null;this[_0xb4bd('0xc')]=_0x480bfe[_0xb4bd('0xc')];this[_0xb4bd('0xd')]=_0x480bfe[_0xb4bd('0xd')];this['dialOriginateTimeout']=_0x480bfe[_0xb4bd('0xe')]||0x1e;this['dialCongestionMaxRetry']=_0x480bfe[_0xb4bd('0xf')];this[_0xb4bd('0x10')]=_0x480bfe[_0xb4bd('0x10')];this['dialBusyMaxRetry']=_0x480bfe[_0xb4bd('0x11')];this[_0xb4bd('0x12')]=_0x480bfe[_0xb4bd('0x12')];this[_0xb4bd('0x13')]=_0x480bfe['dialNoAnswerMaxRetry'];this[_0xb4bd('0x14')]=_0x480bfe[_0xb4bd('0x14')];this['dialGlobalMaxRetry']=_0x480bfe['dialGlobalMaxRetry'];this[_0xb4bd('0x15')]=_0x480bfe['dialNoSuchNumberMaxRetry']||0x3;this[_0xb4bd('0x16')]=_0x480bfe[_0xb4bd('0x16')]||0x96;this['dialDropMaxRetry']=_0x480bfe['dialDropMaxRetry']||0x3;this[_0xb4bd('0x17')]=_0x480bfe[_0xb4bd('0x17')]||0x96;this[_0xb4bd('0x18')]=_0x480bfe[_0xb4bd('0x18')]||0x3;this[_0xb4bd('0x19')]=_0x480bfe[_0xb4bd('0x19')]||0x96;this[_0xb4bd('0x1a')]=_0x480bfe['dialMachineMaxRetry']||0x3;this['dialMachineRetryFrequency']=_0x480bfe[_0xb4bd('0x1b')]||0x96;this[_0xb4bd('0x1c')]=_0x480bfe[_0xb4bd('0x1c')]||0x3;this[_0xb4bd('0x1d')]=_0x480bfe[_0xb4bd('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x480bfe['dialOrderByScheduledAt']||_0xb4bd('0x1e');this[_0xb4bd('0x1f')]=_0x480bfe[_0xb4bd('0x1f')]||undefined;this[_0xb4bd('0x20')]=_0x480bfe[_0xb4bd('0x20')]||undefined;this[_0xb4bd('0x21')]=_0x480bfe['dialCutDigit']||undefined;this[_0xb4bd('0x22')]=_0x480bfe[_0xb4bd('0x22')]?_0x480bfe[_0xb4bd('0x22')]:undefined;this[_0xb4bd('0x23')]=_0x480bfe['Trunk']?_0x480bfe[_0xb4bd('0x23')]:undefined;this[_0xb4bd('0x24')]=_0x480bfe[_0xb4bd('0x24')]?_0x480bfe[_0xb4bd('0x24')]:undefined;this[_0xb4bd('0x25')]=_0x480bfe[_0xb4bd('0x25')]?_0x480bfe[_0xb4bd('0x25')]:undefined;this[_0xb4bd('0x26')]=_0x480bfe['SquareProject']?_0x480bfe[_0xb4bd('0x25')]['name']:undefined;this[_0xb4bd('0x27')]=_0x480bfe[_0xb4bd('0x27')]||![];this[_0xb4bd('0x28')]=_0x480bfe[_0xb4bd('0x28')];this[_0xb4bd('0x29')]=_0x480bfe['dialAMDGreeting'];this[_0xb4bd('0x2a')]=_0x480bfe[_0xb4bd('0x2a')];this[_0xb4bd('0x2b')]=_0x480bfe[_0xb4bd('0x2b')];this['dialAMDMinWordLength']=_0x480bfe[_0xb4bd('0x2c')];this[_0xb4bd('0x2d')]=_0x480bfe[_0xb4bd('0x2d')];this[_0xb4bd('0x2e')]=_0x480bfe['dialAMDMaximumNumberOfWords'];this[_0xb4bd('0x2f')]=_0x480bfe[_0xb4bd('0x2f')];this['dialAMDMaximumWordLength']=_0x480bfe[_0xb4bd('0x30')];}module['exports']=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 1d5593f..b488c11 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 _0xff99=['billableseconds','holdtime','type','tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','channel','calleridnum','accountcode','context','uniqueid','linkedid','answertime','endtime','unmanaged','abandoned','lastdata'];(function(_0x338f73,_0x1945c8){var _0x163fdf=function(_0x4cd033){while(--_0x4cd033){_0x338f73['push'](_0x338f73['shift']());}};_0x163fdf(++_0x1945c8);}(_0xff99,0x129));var _0x9ff9=function(_0x105089,_0x147509){_0x105089=_0x105089-0x0;var _0x3d3eec=_0xff99[_0x105089];return _0x3d3eec;};'use strict';function Channel(){this['starttime']=null;this[_0x9ff9('0x0')]='';this['destinationchannel']='';this[_0x9ff9('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x9ff9('0x2')]=0x0;this[_0x9ff9('0x3')]='';this[_0x9ff9('0x4')]=0x0;this[_0x9ff9('0x5')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x9ff9('0x6')]=null;this[_0x9ff9('0x7')]=null;this[_0x9ff9('0x8')]=![];this[_0x9ff9('0x9')]=![];this['lastapplication']='';this[_0x9ff9('0xa')]='';this['duration']=0x0;this[_0x9ff9('0xb')]=0x0;this[_0x9ff9('0xc')]=0x0;this[_0x9ff9('0xd')]=null;this[_0x9ff9('0xe')]=null;this[_0x9ff9('0xf')]=null;this[_0x9ff9('0x10')]=![];this['monitorFilename']=null;this[_0x9ff9('0x11')]=null;this['monitors']=[];this[_0x9ff9('0x12')]=undefined;this[_0x9ff9('0x13')]=undefined;this[_0x9ff9('0x14')]=undefined;this[_0x9ff9('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x8f22=['disposition','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','answered','answertime','endtime','unmanaged','duration','billableseconds','holdtime','type','tag'];(function(_0x3b3277,_0x2f998e){var _0x31780=function(_0x1ff4d4){while(--_0x1ff4d4){_0x3b3277['push'](_0x3b3277['shift']());}};_0x31780(++_0x2f998e);}(_0x8f22,0x1e3));var _0x28f2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8f22[_0x2641f9];return _0x585741;};'use strict';function Channel(){this[_0x28f2('0x0')]=null;this[_0x28f2('0x1')]='';this[_0x28f2('0x2')]='';this[_0x28f2('0x3')]=0x0;this[_0x28f2('0x4')]='';this[_0x28f2('0x5')]=undefined;this[_0x28f2('0x6')]=undefined;this[_0x28f2('0x7')]=0x0;this[_0x28f2('0x8')]='';this[_0x28f2('0x9')]=0x0;this[_0x28f2('0xa')]=0x0;this[_0x28f2('0xb')]=0x0;this[_0x28f2('0xc')]=![];this[_0x28f2('0xd')]=null;this[_0x28f2('0xe')]=null;this[_0x28f2('0xf')]=![];this['abandoned']=![];this['lastapplication']='';this['lastdata']='';this[_0x28f2('0x10')]=0x0;this[_0x28f2('0x11')]=0x0;this[_0x28f2('0x12')]=0x0;this[_0x28f2('0x13')]=null;this[_0x28f2('0x14')]=null;this[_0x28f2('0x15')]=null;this['monitor']=![];this[_0x28f2('0x16')]=null;this['queue']=null;this[_0x28f2('0x17')]=[];this[_0x28f2('0x18')]=undefined;this[_0x28f2('0x19')]=undefined;this['transferType']=undefined;this[_0x28f2('0x1a')]=0x0;}module[_0x28f2('0x1b')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 72ede85..116de37 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 _0x2e32=['Configurations','exports','name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl'];(function(_0x26991c,_0x522f1d){var _0x5df01f=function(_0x3dd683){while(--_0x3dd683){_0x26991c['push'](_0x26991c['shift']());}};_0x5df01f(++_0x522f1d);}(_0x2e32,0x147));var _0x22e3=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x2e32[_0x4e9d3c];return _0x2d0825;};'use strict';function DeskAccount(_0x24e53b){this['id']=_0x24e53b['id']||0x0;this[_0x22e3('0x0')]=_0x24e53b[_0x22e3('0x0')]||'';this[_0x22e3('0x1')]=_0x24e53b[_0x22e3('0x1')]||'';this[_0x22e3('0x2')]=_0x24e53b[_0x22e3('0x2')]||'';this['authType']=_0x24e53b[_0x22e3('0x3')]||'';this['password']=_0x24e53b[_0x22e3('0x4')]||'';this[_0x22e3('0x5')]=_0x24e53b[_0x22e3('0x5')]||'';this['consumerSecret']=_0x24e53b[_0x22e3('0x6')]||'';this[_0x22e3('0x7')]=_0x24e53b[_0x22e3('0x7')]||'';this[_0x22e3('0x8')]=_0x24e53b[_0x22e3('0x8')]||'';this[_0x22e3('0x9')]=_0x24e53b[_0x22e3('0x9')]||'';this[_0x22e3('0xa')]=_0x24e53b['serverUrl']||'';this[_0x22e3('0xb')]=_0x24e53b[_0x22e3('0xb')]||{};}module[_0x22e3('0xc')]=DeskAccount; \ No newline at end of file +var _0xba88=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password'];(function(_0x3b4493,_0x106e71){var _0x28fc72=function(_0x1c6ec5){while(--_0x1c6ec5){_0x3b4493['push'](_0x3b4493['shift']());}};_0x28fc72(++_0x106e71);}(_0xba88,0x126));var _0x8ba8=function(_0x4c3572,_0x584fb6){_0x4c3572=_0x4c3572-0x0;var _0xe598d4=_0xba88[_0x4c3572];return _0xe598d4;};'use strict';function DeskAccount(_0x2a27d0){this['id']=_0x2a27d0['id']||0x0;this[_0x8ba8('0x0')]=_0x2a27d0[_0x8ba8('0x0')]||'';this[_0x8ba8('0x1')]=_0x2a27d0[_0x8ba8('0x1')]||'';this[_0x8ba8('0x2')]=_0x2a27d0[_0x8ba8('0x2')]||'';this['authType']=_0x2a27d0[_0x8ba8('0x3')]||'';this[_0x8ba8('0x4')]=_0x2a27d0[_0x8ba8('0x4')]||'';this[_0x8ba8('0x5')]=_0x2a27d0[_0x8ba8('0x5')]||'';this[_0x8ba8('0x6')]=_0x2a27d0[_0x8ba8('0x6')]||'';this[_0x8ba8('0x7')]=_0x2a27d0[_0x8ba8('0x7')]||'';this[_0x8ba8('0x8')]=_0x2a27d0[_0x8ba8('0x8')]||'';this['type']=_0x2a27d0[_0x8ba8('0x9')]||'';this[_0x8ba8('0xa')]=_0x2a27d0[_0x8ba8('0xa')]||'';this['Configurations']=_0x2a27d0[_0x8ba8('0xb')]||{};}module[_0x8ba8('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 63347c9..a933149 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 _0x782a=['Configurations','CloudProvider','exports','name','password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication'];(function(_0x18bc67,_0x446533){var _0x22dea0=function(_0x42ab5e){while(--_0x42ab5e){_0x18bc67['push'](_0x18bc67['shift']());}};_0x22dea0(++_0x446533);}(_0x782a,0x1e3));var _0xa782=function(_0x261fc3,_0x2c4a8e){_0x261fc3=_0x261fc3-0x0;var _0x2a6fed=_0x782a[_0x261fc3];return _0x2a6fed;};'use strict';function Dynamics365Account(_0x511827){this['id']=_0x511827['id']||0x0;this['name']=_0x511827[_0xa782('0x0')]||'';this['username']=_0x511827['username']||'';this[_0xa782('0x1')]=_0x511827[_0xa782('0x1')]||'';this[_0xa782('0x2')]=_0x511827[_0xa782('0x2')]||'';this['tenantId']=_0x511827['tenantId']||'';this[_0xa782('0x3')]=_0x511827[_0xa782('0x3')]||'';this[_0xa782('0x4')]=_0x511827[_0xa782('0x4')]||{};this[_0xa782('0x5')]=_0x511827[_0xa782('0x5')]||'';this[_0xa782('0x6')]=_0x511827[_0xa782('0x6')]||![];this[_0xa782('0x7')]=_0x511827[_0xa782('0x7')]||{};this[_0xa782('0x8')]=_0x511827['CloudProvider']||{};}module[_0xa782('0x9')]=Dynamics365Account; \ No newline at end of file +var _0x082b=['clientSecret','modernAuthentication','Configurations','CloudProvider','name','username','password','remoteUri','tenantId','clientId'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x082b,0x1c6));var _0xb082=function(_0x580869,_0x540760){_0x580869=_0x580869-0x0;var _0x3bfc5d=_0x082b[_0x580869];return _0x3bfc5d;};'use strict';function Dynamics365Account(_0x48d7a2){this['id']=_0x48d7a2['id']||0x0;this[_0xb082('0x0')]=_0x48d7a2[_0xb082('0x0')]||'';this['username']=_0x48d7a2[_0xb082('0x1')]||'';this[_0xb082('0x2')]=_0x48d7a2[_0xb082('0x2')]||'';this[_0xb082('0x3')]=_0x48d7a2['remoteUri']||'';this[_0xb082('0x4')]=_0x48d7a2['tenantId']||'';this[_0xb082('0x5')]=_0x48d7a2[_0xb082('0x5')]||'';this[_0xb082('0x6')]=_0x48d7a2[_0xb082('0x6')]||{};this['serverUrl']=_0x48d7a2['serverUrl']||'';this[_0xb082('0x7')]=_0x48d7a2[_0xb082('0x7')]||![];this[_0xb082('0x8')]=_0x48d7a2[_0xb082('0x8')]||{};this[_0xb082('0x9')]=_0x48d7a2[_0xb082('0x9')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index eae183b..7ead9f1 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 _0x64ce=['exports','name','description','ecm','headerinfo','localstationid','minrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x3a9f51,_0x19308a){var _0x314466=function(_0x3ae626){while(--_0x3ae626){_0x3a9f51['push'](_0x3a9f51['shift']());}};_0x314466(++_0x19308a);}(_0x64ce,0x1a1));var _0xe64c=function(_0x41032b,_0x5145d1){_0x41032b=_0x41032b-0x0;var _0x29d8d2=_0x64ce[_0x41032b];return _0x29d8d2;};'use strict';function FaxAccount(_0xe5cafb){this['id']=_0xe5cafb['id']||0x0;this[_0xe64c('0x0')]=_0xe5cafb[_0xe64c('0x0')]||'';this[_0xe64c('0x1')]=_0xe5cafb[_0xe64c('0x1')];this[_0xe64c('0x2')]=_0xe5cafb['ecm'];this[_0xe64c('0x3')]=_0xe5cafb[_0xe64c('0x3')];this['localstationid']=_0xe5cafb[_0xe64c('0x4')];this[_0xe64c('0x5')]=_0xe5cafb[_0xe64c('0x5')]||0x960;this['maxrate']=_0xe5cafb['maxrate']||0x3840;this[_0xe64c('0x6')]=_0xe5cafb[_0xe64c('0x6')]||'v17,v27,v29';this[_0xe64c('0x7')]=_0xe5cafb[_0xe64c('0x7')]||'no';this[_0xe64c('0x8')]=_0xe5cafb[_0xe64c('0x8')]||'no';this['t38timeout']=_0xe5cafb[_0xe64c('0x9')]||0x1388;this['tech']=_0xe5cafb[_0xe64c('0xa')]||_0xe64c('0xb');this[_0xe64c('0xc')]=_0xe5cafb['Trunk']?_0xe5cafb['Trunk']:undefined;this[_0xe64c('0xd')]=_0xe5cafb[_0xe64c('0xd')];this[_0xe64c('0xe')]=_0xe5cafb['key'];}module[_0xe64c('0xf')]=FaxAccount; \ No newline at end of file +var _0x3f21=['minrate','maxrate','modem','v17,v27,v29','faxdetect','t38timeout','tech','SIP','Trunk','ListId','exports','name','description','ecm','headerinfo','localstationid'];(function(_0x570b48,_0x327fb1){var _0x596b2d=function(_0x1888c7){while(--_0x1888c7){_0x570b48['push'](_0x570b48['shift']());}};_0x596b2d(++_0x327fb1);}(_0x3f21,0x7b));var _0x13f2=function(_0x3b9506,_0x8ae86e){_0x3b9506=_0x3b9506-0x0;var _0x527681=_0x3f21[_0x3b9506];return _0x527681;};'use strict';function FaxAccount(_0x2121c9){this['id']=_0x2121c9['id']||0x0;this[_0x13f2('0x0')]=_0x2121c9[_0x13f2('0x0')]||'';this[_0x13f2('0x1')]=_0x2121c9['description'];this[_0x13f2('0x2')]=_0x2121c9[_0x13f2('0x2')];this[_0x13f2('0x3')]=_0x2121c9[_0x13f2('0x3')];this[_0x13f2('0x4')]=_0x2121c9[_0x13f2('0x4')];this[_0x13f2('0x5')]=_0x2121c9[_0x13f2('0x5')]||0x960;this[_0x13f2('0x6')]=_0x2121c9[_0x13f2('0x6')]||0x3840;this[_0x13f2('0x7')]=_0x2121c9[_0x13f2('0x7')]||_0x13f2('0x8');this['gateway']=_0x2121c9['gateway']||'no';this[_0x13f2('0x9')]=_0x2121c9[_0x13f2('0x9')]||'no';this[_0x13f2('0xa')]=_0x2121c9['t38timeout']||0x1388;this[_0x13f2('0xb')]=_0x2121c9[_0x13f2('0xb')]||_0x13f2('0xc');this[_0x13f2('0xd')]=_0x2121c9[_0x13f2('0xd')]?_0x2121c9[_0x13f2('0xd')]:undefined;this[_0x13f2('0xe')]=_0x2121c9['ListId'];this['key']=_0x2121c9['key'];}module[_0x13f2('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 5756e72..5ec07d2 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 _0x7ffa=['Configurations','name','username','apiKey','remoteUri','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7ffa,0x15d));var _0xa7ff=function(_0x2a6393,_0x12a2a8){_0x2a6393=_0x2a6393-0x0;var _0x495588=_0x7ffa[_0x2a6393];return _0x495588;};'use strict';function FreshdeskAccount(_0x22a3ec){this['id']=_0x22a3ec['id']||0x0;this[_0xa7ff('0x0')]=_0x22a3ec[_0xa7ff('0x0')]||'';this[_0xa7ff('0x1')]=_0x22a3ec[_0xa7ff('0x1')]||'';this[_0xa7ff('0x2')]=_0x22a3ec['token']||'';this[_0xa7ff('0x3')]=_0x22a3ec[_0xa7ff('0x3')]||'';this[_0xa7ff('0x4')]=_0x22a3ec[_0xa7ff('0x4')]||'';this[_0xa7ff('0x5')]=_0x22a3ec[_0xa7ff('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xdaec=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x44ce9b,_0x24f475){var _0x547827=function(_0x5960e6){while(--_0x5960e6){_0x44ce9b['push'](_0x44ce9b['shift']());}};_0x547827(++_0x24f475);}(_0xdaec,0x156));var _0xcdae=function(_0x2b84d5,_0x428914){_0x2b84d5=_0x2b84d5-0x0;var _0x51452a=_0xdaec[_0x2b84d5];return _0x51452a;};'use strict';function FreshdeskAccount(_0x2136cd){this['id']=_0x2136cd['id']||0x0;this[_0xcdae('0x0')]=_0x2136cd[_0xcdae('0x0')]||'';this[_0xcdae('0x1')]=_0x2136cd[_0xcdae('0x1')]||'';this[_0xcdae('0x2')]=_0x2136cd[_0xcdae('0x3')]||'';this[_0xcdae('0x4')]=_0x2136cd['remoteUri']||'';this['serverUrl']=_0x2136cd[_0xcdae('0x5')]||'';this[_0xcdae('0x6')]=_0x2136cd[_0xcdae('0x6')]||{};}module[_0xcdae('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 06be999..d4c5dc5 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 _0x79d3=['exports','name','username','apiKey','remoteUri','serverUrl','Configurations'];(function(_0x366120,_0x4fe15f){var _0x5115be=function(_0xb6052a){while(--_0xb6052a){_0x366120['push'](_0x366120['shift']());}};_0x5115be(++_0x4fe15f);}(_0x79d3,0x15f));var _0x379d=function(_0x2a5262,_0x578588){_0x2a5262=_0x2a5262-0x0;var _0x483802=_0x79d3[_0x2a5262];return _0x483802;};'use strict';function FreshsalesAccount(_0x439d8d){this['id']=_0x439d8d['id']||0x0;this['name']=_0x439d8d[_0x379d('0x0')]||'';this['username']=_0x439d8d[_0x379d('0x1')]||'';this[_0x379d('0x2')]=_0x439d8d['token']||'';this[_0x379d('0x3')]=_0x439d8d[_0x379d('0x3')]||'';this[_0x379d('0x4')]=_0x439d8d[_0x379d('0x4')]||'';this[_0x379d('0x5')]=_0x439d8d[_0x379d('0x5')]||{};}module[_0x379d('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x4986=['token','remoteUri','serverUrl','Configurations','exports','name','apiKey'];(function(_0x1f6364,_0x16f8e2){var _0x5f4693=function(_0x1ff460){while(--_0x1ff460){_0x1f6364['push'](_0x1f6364['shift']());}};_0x5f4693(++_0x16f8e2);}(_0x4986,0x6e));var _0x6498=function(_0x154ded,_0x24b366){_0x154ded=_0x154ded-0x0;var _0x52cdd7=_0x4986[_0x154ded];return _0x52cdd7;};'use strict';function FreshsalesAccount(_0x5e3825){this['id']=_0x5e3825['id']||0x0;this[_0x6498('0x0')]=_0x5e3825[_0x6498('0x0')]||'';this['username']=_0x5e3825['username']||'';this[_0x6498('0x1')]=_0x5e3825[_0x6498('0x2')]||'';this['remoteUri']=_0x5e3825[_0x6498('0x3')]||'';this[_0x6498('0x4')]=_0x5e3825[_0x6498('0x4')]||'';this[_0x6498('0x5')]=_0x5e3825[_0x6498('0x5')]||{};}module[_0x6498('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 565d0fa..1776bde 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 _0xa6ab=['position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','accountcode','context','exten','priority','holdtime','assigned','lastAssignedTo','mohtime','variables','exports','type','inbound','calleridnum','queuecallerjoinAt','queuecallerleaveAt'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xa6ab,0xb1));var _0xba6a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa6ab[_0x20a584];return _0x4b41a8;};'use strict';function QueueReport(){this[_0xba6a('0x0')]=_0xba6a('0x1');this['uniqueid']='';this[_0xba6a('0x2')]='';this['calleridname']='';this['queue']='';this[_0xba6a('0x3')]=null;this[_0xba6a('0x4')]=null;this[_0xba6a('0x5')]=0x1;this[_0xba6a('0x6')]=0x1;this[_0xba6a('0x7')]=![];this[_0xba6a('0x8')]=null;this[_0xba6a('0x9')]=![];this[_0xba6a('0xa')]=null;this[_0xba6a('0xb')]=![];this[_0xba6a('0xc')]=null;this[_0xba6a('0xd')]=0x1;this[_0xba6a('0xe')]='';this[_0xba6a('0xf')]='';this['connectedlinename']='';this[_0xba6a('0x10')]='';this[_0xba6a('0x11')]='';this[_0xba6a('0x12')]='';this[_0xba6a('0x13')]='';this[_0xba6a('0x14')]=0x0;this[_0xba6a('0x15')]=![];this[_0xba6a('0x16')]='';this['motionChannel']='voice';this[_0xba6a('0x17')]=0x0;this[_0xba6a('0x18')]={};}module[_0xba6a('0x19')]=QueueReport; \ No newline at end of file +var _0xb3a5=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','voice','mohtime','variables','inbound','uniqueid','calleridname','queue'];(function(_0x58c462,_0x5b5d02){var _0x3628aa=function(_0x3bb79e){while(--_0x3bb79e){_0x58c462['push'](_0x58c462['shift']());}};_0x3628aa(++_0x5b5d02);}(_0xb3a5,0x1ac));var _0x5b3a=function(_0x592b29,_0x215be6){_0x592b29=_0x592b29-0x0;var _0x1046fa=_0xb3a5[_0x592b29];return _0x1046fa;};'use strict';function QueueReport(){this['type']=_0x5b3a('0x0');this[_0x5b3a('0x1')]='';this['calleridnum']='';this[_0x5b3a('0x2')]='';this[_0x5b3a('0x3')]='';this[_0x5b3a('0x4')]=null;this[_0x5b3a('0x5')]=null;this[_0x5b3a('0x6')]=0x1;this[_0x5b3a('0x7')]=0x1;this[_0x5b3a('0x8')]=![];this[_0x5b3a('0x9')]=null;this['queuecallercomplete']=![];this[_0x5b3a('0xa')]=null;this[_0x5b3a('0xb')]=![];this[_0x5b3a('0xc')]=null;this[_0x5b3a('0xd')]=0x1;this['channel']='';this[_0x5b3a('0xe')]='';this[_0x5b3a('0xf')]='';this[_0x5b3a('0x10')]='';this[_0x5b3a('0x11')]='';this[_0x5b3a('0x12')]='';this[_0x5b3a('0x13')]='';this['holdtime']=0x0;this[_0x5b3a('0x14')]=![];this['lastAssignedTo']='';this['motionChannel']=_0x5b3a('0x15');this[_0x5b3a('0x16')]=0x0;this[_0x5b3a('0x17')]={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 90c5177..655ce1e 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 _0x0221=['clientId','clientSecret','securityToken','type','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4666e0,_0x55bc41){var _0x172a88=function(_0x2fab85){while(--_0x2fab85){_0x4666e0['push'](_0x4666e0['shift']());}};_0x172a88(++_0x55bc41);}(_0x0221,0xc5));var _0x1022=function(_0x11b0d8,_0x5591a2){_0x11b0d8=_0x11b0d8-0x0;var _0x1438d3=_0x0221[_0x11b0d8];return _0x1438d3;};'use strict';function SalesforceAccount(_0x1077b2){this['id']=_0x1077b2['id']||0x0;this[_0x1022('0x0')]=_0x1077b2[_0x1022('0x0')]||'';this[_0x1022('0x1')]=_0x1077b2['username']||'';this[_0x1022('0x2')]=_0x1077b2[_0x1022('0x2')]||'';this['password']=_0x1077b2['password']||'';this['clientId']=_0x1077b2[_0x1022('0x3')]||'';this['clientSecret']=_0x1077b2[_0x1022('0x4')]||'';this[_0x1022('0x5')]=_0x1077b2[_0x1022('0x5')]||'';this[_0x1022('0x6')]=_0x1077b2[_0x1022('0x6')]||'integrationTab';this[_0x1022('0x7')]=_0x1077b2[_0x1022('0x7')]||'';this[_0x1022('0x8')]=_0x1077b2[_0x1022('0x8')]||{};}module[_0x1022('0x9')]=SalesforceAccount; \ No newline at end of file +var _0xbc1c=['serverUrl','Configurations','name','username','remoteUri','password','clientId','securityToken','type','integrationTab'];(function(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0xbc1c,0x98));var _0xcbc1=function(_0x19997d,_0x2c92a4){_0x19997d=_0x19997d-0x0;var _0x49be7f=_0xbc1c[_0x19997d];return _0x49be7f;};'use strict';function SalesforceAccount(_0x187888){this['id']=_0x187888['id']||0x0;this[_0xcbc1('0x0')]=_0x187888[_0xcbc1('0x0')]||'';this[_0xcbc1('0x1')]=_0x187888['username']||'';this[_0xcbc1('0x2')]=_0x187888['remoteUri']||'';this[_0xcbc1('0x3')]=_0x187888['password']||'';this['clientId']=_0x187888[_0xcbc1('0x4')]||'';this['clientSecret']=_0x187888['clientSecret']||'';this[_0xcbc1('0x5')]=_0x187888[_0xcbc1('0x5')]||'';this[_0xcbc1('0x6')]=_0x187888[_0xcbc1('0x6')]||_0xcbc1('0x7');this['serverUrl']=_0x187888[_0xcbc1('0x8')]||'';this[_0xcbc1('0x9')]=_0x187888[_0xcbc1('0x9')]||{};}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 912120f..4507742 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 _0x63c1=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x63c1,0x19c));var _0x163c=function(_0x56c04e,_0x555064){_0x56c04e=_0x56c04e-0x0;var _0x43024b=_0x63c1[_0x56c04e];return _0x43024b;};'use strict';function ServicenowAccount(_0x302171){this['id']=_0x302171['id']||0x0;this[_0x163c('0x0')]=_0x302171[_0x163c('0x0')]||'';this[_0x163c('0x1')]=_0x302171[_0x163c('0x1')]||'';this[_0x163c('0x2')]=_0x302171['password']||'';this[_0x163c('0x3')]=_0x302171[_0x163c('0x3')]||'';this[_0x163c('0x4')]=_0x302171[_0x163c('0x4')]||'';this['Configurations']=_0x302171[_0x163c('0x5')]||{};}module[_0x163c('0x6')]=ServicenowAccount; \ No newline at end of file +var _0xefb9=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x29a39d,_0x4aa7e0){var _0x5147d5=function(_0x38197a){while(--_0x38197a){_0x29a39d['push'](_0x29a39d['shift']());}};_0x5147d5(++_0x4aa7e0);}(_0xefb9,0xe9));var _0x9efb=function(_0x2247ab,_0x3f4162){_0x2247ab=_0x2247ab-0x0;var _0x430062=_0xefb9[_0x2247ab];return _0x430062;};'use strict';function ServicenowAccount(_0x4bc913){this['id']=_0x4bc913['id']||0x0;this[_0x9efb('0x0')]=_0x4bc913[_0x9efb('0x0')]||'';this[_0x9efb('0x1')]=_0x4bc913[_0x9efb('0x1')]||'';this[_0x9efb('0x2')]=_0x4bc913[_0x9efb('0x2')]||'';this[_0x9efb('0x3')]=_0x4bc913[_0x9efb('0x3')]||'';this[_0x9efb('0x4')]=_0x4bc913[_0x9efb('0x4')]||'';this['Configurations']=_0x4bc913[_0x9efb('0x5')]||{};}module[_0x9efb('0x6')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index 52bcbb2..ef18628 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 _0x1349=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1349,0x69));var _0x9134=function(_0x2db798,_0x4308c8){_0x2db798=_0x2db798-0x0;var _0x2aaffe=_0x1349[_0x2db798];return _0x2aaffe;};'use strict';function SugarcrmAccount(_0x55aff4){this['id']=_0x55aff4['id']||0x0;this[_0x9134('0x0')]=_0x55aff4[_0x9134('0x0')]||'';this[_0x9134('0x1')]=_0x55aff4[_0x9134('0x1')]||'';this[_0x9134('0x2')]=_0x55aff4[_0x9134('0x2')]||'';this[_0x9134('0x3')]=_0x55aff4[_0x9134('0x3')]||'';this[_0x9134('0x4')]=_0x55aff4[_0x9134('0x4')]||'';this[_0x9134('0x5')]=_0x55aff4['Configurations']||{};}module[_0x9134('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xb51b=['Configurations','name','username','remoteUri','serverUrl'];(function(_0x2ef3a1,_0x29577d){var _0x307ac9=function(_0x23c145){while(--_0x23c145){_0x2ef3a1['push'](_0x2ef3a1['shift']());}};_0x307ac9(++_0x29577d);}(_0xb51b,0x1eb));var _0xbb51=function(_0x1eeb52,_0xd1873e){_0x1eeb52=_0x1eeb52-0x0;var _0x439d8e=_0xb51b[_0x1eeb52];return _0x439d8e;};'use strict';function SugarcrmAccount(_0x1c3608){this['id']=_0x1c3608['id']||0x0;this['name']=_0x1c3608[_0xbb51('0x0')]||'';this['username']=_0x1c3608[_0xbb51('0x1')]||'';this['password']=_0x1c3608['password']||'';this[_0xbb51('0x2')]=_0x1c3608[_0xbb51('0x2')]||'';this[_0xbb51('0x3')]=_0x1c3608['serverUrl']||'';this[_0xbb51('0x4')]=_0x1c3608[_0xbb51('0x4')]||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index e007be8..50d7851 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 _0xa249=['accountcode','unknown','status','name'];(function(_0x479323,_0x1e0eae){var _0x260ea0=function(_0x381dca){while(--_0x381dca){_0x479323['push'](_0x479323['shift']());}};_0x260ea0(++_0x1e0eae);}(_0xa249,0x183));var _0x9a24=function(_0x1700ea,_0x3a4c49){_0x1700ea=_0x1700ea-0x0;var _0x47c2d9=_0xa249[_0x1700ea];return _0x47c2d9;};'use strict';function Telephone(_0x2bc00e){this['id']=_0x2bc00e['id']||0x0;this[_0x9a24('0x0')]=_0x2bc00e['name']||'';this[_0x9a24('0x1')]=_0x2bc00e[_0x9a24('0x1')]||'';this['state']=_0x9a24('0x2');this['stateTime']=0x0;this[_0x9a24('0x3')]='unknown';this['address']='';}module['exports']=Telephone; \ No newline at end of file +var _0xc06d=['exports','name','accountcode','state','unknown'];(function(_0x2abc3d,_0x48edca){var _0x252745=function(_0x32bb6f){while(--_0x32bb6f){_0x2abc3d['push'](_0x2abc3d['shift']());}};_0x252745(++_0x48edca);}(_0xc06d,0x15a));var _0xdc06=function(_0x23bbb1,_0x2ff228){_0x23bbb1=_0x23bbb1-0x0;var _0x4c78ec=_0xc06d[_0x23bbb1];return _0x4c78ec;};'use strict';function Telephone(_0x36cb88){this['id']=_0x36cb88['id']||0x0;this[_0xdc06('0x0')]=_0x36cb88[_0xdc06('0x0')]||'';this[_0xdc06('0x1')]=_0x36cb88['accountcode']||'';this[_0xdc06('0x2')]=_0xdc06('0x3');this['stateTime']=0x0;this['status']=_0xdc06('0x3');this['address']='';}module[_0xdc06('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 7f38d0f..781694a 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(_0x549fee,_0x573e8f){var _0x234388=function(_0x462907){while(--_0x462907){_0x549fee['push'](_0x549fee['shift']());}};_0x234388(++_0x573e8f);}(_0xb10b,0x12a));var _0xbb10=function(_0x10d34b,_0x4fef76){_0x10d34b=_0x10d34b-0x0;var _0x92b0bf=_0xb10b[_0x10d34b];return _0x92b0bf;};'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(_0x527b09,_0x42851b){var _0x5e3b69=function(_0x1cb77d){while(--_0x1cb77d){_0x527b09['push'](_0x527b09['shift']());}};_0x5e3b69(++_0x42851b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 ce2b7d5..2858bb3 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['AnyConditions','Actions','exports','name','channel','voice','status'];(function(_0x1e13fd,_0x4c6abc){var _0x4c7bc8=function(_0x2d3219){while(--_0x2d3219){_0x1e13fd['push'](_0x1e13fd['shift']());}};_0x4c7bc8(++_0x4c6abc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x10304b,_0x507d1d){_0x10304b=_0x10304b-0x0;var _0xa1474e=_0x5f2f[_0x10304b];return _0xa1474e;};'use strict';function Trigger(_0x7c86d8){this['id']=_0x7c86d8['id']||0x0;this[_0xf5f2('0x0')]=_0x7c86d8[_0xf5f2('0x0')]||'';this[_0xf5f2('0x1')]=_0x7c86d8[_0xf5f2('0x1')]||_0xf5f2('0x2');this[_0xf5f2('0x3')]=_0x7c86d8[_0xf5f2('0x3')]||![];this['AllConditions']=_0x7c86d8['AllConditions']||[];this[_0xf5f2('0x4')]=_0x7c86d8[_0xf5f2('0x4')]||[];this[_0xf5f2('0x5')]=_0x7c86d8[_0xf5f2('0x5')]||[];}module[_0xf5f2('0x6')]=Trigger; \ No newline at end of file +var _0xb10b=['AllConditions','AnyConditions','Actions','exports','name','channel','status'];(function(_0x455ee1,_0x27b301){var _0x5f67f1=function(_0x4b3247){while(--_0x4b3247){_0x455ee1['push'](_0x455ee1['shift']());}};_0x5f67f1(++_0x27b301);}(_0xb10b,0x12a));var _0xbb10=function(_0x494f4d,_0x2807fa){_0x494f4d=_0x494f4d-0x0;var _0x3e7dfc=_0xb10b[_0x494f4d];return _0x3e7dfc;};'use strict';function Trigger(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'voice';this[_0xbb10('0x2')]=_0x13ce8d[_0xbb10('0x2')]||![];this[_0xbb10('0x3')]=_0x13ce8d[_0xbb10('0x3')]||[];this[_0xbb10('0x4')]=_0x13ce8d[_0xbb10('0x4')]||[];this['Actions']=_0x13ce8d[_0xbb10('0x5')]||[];}module[_0xbb10('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 49d7d1c..72403d3 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 _0x922e=['indexOf','split','host','port','domainport','refresh','address','defaultuser','exports','active','name','state','unknown','stateTime','status','registry'];(function(_0x2b9a41,_0x4f2b1f){var _0x50d057=function(_0x39b628){while(--_0x39b628){_0x2b9a41['push'](_0x2b9a41['shift']());}};_0x50d057(++_0x4f2b1f);}(_0x922e,0x1c9));var _0xe922=function(_0x1e1bf,_0x4791b5){_0x1e1bf=_0x1e1bf-0x0;var _0x4fa851=_0x922e[_0x1e1bf];return _0x4fa851;};'use strict';function Trunk(_0x5565fc){this['id']=_0x5565fc['id']||0x0;this[_0xe922('0x0')]=_0x5565fc['active']||![];this['name']=_0x5565fc[_0xe922('0x1')]||'';this[_0xe922('0x2')]=_0xe922('0x3');this[_0xe922('0x4')]=0x0;this[_0xe922('0x5')]=_0xe922('0x3');this[_0xe922('0x6')]=_0x5565fc[_0xe922('0x6')]&&_0x5565fc[_0xe922('0x6')][_0xe922('0x7')](':')?_0x5565fc[_0xe922('0x6')][_0xe922('0x8')](':')[0x0]:'';this[_0xe922('0x9')]='';this[_0xe922('0xa')]='';this['domain']='';this[_0xe922('0xb')]='';this[_0xe922('0xc')]='';this['stateRegistry']=_0xe922('0x3');this['registrationtime']='';this[_0xe922('0xd')]='';this['defaultuser']=_0x5565fc[_0xe922('0xe')]||'';}module[_0xe922('0xf')]=Trunk; \ No newline at end of file +var _0x9edd=['defaultuser','active','name','state','unknown','status','registry','indexOf','port','domain','domainport','refresh','stateRegistry','registrationtime','address'];(function(_0x656cf,_0x16e68c){var _0x5d833a=function(_0x32689e){while(--_0x32689e){_0x656cf['push'](_0x656cf['shift']());}};_0x5d833a(++_0x16e68c);}(_0x9edd,0x178));var _0xd9ed=function(_0x2d7da2,_0xbde7d7){_0x2d7da2=_0x2d7da2-0x0;var _0x3c8091=_0x9edd[_0x2d7da2];return _0x3c8091;};'use strict';function Trunk(_0x71acf8){this['id']=_0x71acf8['id']||0x0;this[_0xd9ed('0x0')]=_0x71acf8[_0xd9ed('0x0')]||![];this[_0xd9ed('0x1')]=_0x71acf8[_0xd9ed('0x1')]||'';this[_0xd9ed('0x2')]=_0xd9ed('0x3');this['stateTime']=0x0;this[_0xd9ed('0x4')]=_0xd9ed('0x3');this[_0xd9ed('0x5')]=_0x71acf8[_0xd9ed('0x5')]&&_0x71acf8['registry'][_0xd9ed('0x6')](':')?_0x71acf8[_0xd9ed('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0xd9ed('0x7')]='';this[_0xd9ed('0x8')]='';this[_0xd9ed('0x9')]='';this[_0xd9ed('0xa')]='';this[_0xd9ed('0xb')]=_0xd9ed('0x3');this[_0xd9ed('0xc')]='';this[_0xd9ed('0xd')]='';this[_0xd9ed('0xe')]=_0x71acf8[_0xd9ed('0xe')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index a83504a..e2f0e4f 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 _0xc614=['recordingFormat','none','mandatoryDisposition','exports','exten'];(function(_0x47072e,_0x5da3db){var _0x37822a=function(_0x411f06){while(--_0x411f06){_0x47072e['push'](_0x47072e['shift']());}};_0x37822a(++_0x5da3db);}(_0xc614,0x1b7));var _0x4c61=function(_0x39b95f,_0x2ddcb0){_0x39b95f=_0x39b95f-0x0;var _0x40bfed=_0xc614[_0x39b95f];return _0x40bfed;};'use strict';function voiceExtension(_0x5886cd){this['id']=_0x5886cd['id']||0x0;this[_0x4c61('0x0')]=_0x5886cd['exten']||'';this[_0x4c61('0x1')]=_0x5886cd[_0x4c61('0x1')]||_0x4c61('0x2');this[_0x4c61('0x3')]=_0x5886cd[_0x4c61('0x3')]||![];}module[_0x4c61('0x4')]=voiceExtension; \ No newline at end of file +var _0xe406=['none','mandatoryDisposition','exports','exten','recordingFormat'];(function(_0x3670e4,_0x55c98c){var _0x3a5841=function(_0x48e709){while(--_0x48e709){_0x3670e4['push'](_0x3670e4['shift']());}};_0x3a5841(++_0x55c98c);}(_0xe406,0x8f));var _0x6e40=function(_0x2728bc,_0x424c70){_0x2728bc=_0x2728bc-0x0;var _0x1c49e5=_0xe406[_0x2728bc];return _0x1c49e5;};'use strict';function voiceExtension(_0x321daf){this['id']=_0x321daf['id']||0x0;this[_0x6e40('0x0')]=_0x321daf[_0x6e40('0x0')]||'';this[_0x6e40('0x1')]=_0x321daf[_0x6e40('0x1')]||_0x6e40('0x2');this[_0x6e40('0x3')]=_0x321daf['mandatoryDisposition']||![];}module[_0x6e40('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 853307e..59053b4 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 _0xe202=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','answered','sumHoldTime','sumBillable','unmanaged','abandoned','available','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialRandomLastDigitCallerIdNumber','dialCutDigit','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay'];(function(_0x505df9,_0x14138e){var _0x1cc025=function(_0x5d2a1f){while(--_0x5d2a1f){_0x505df9['push'](_0x505df9['shift']());}};_0x1cc025(++_0x14138e);}(_0xe202,0x194));var _0x2e20=function(_0x13c315,_0x71739b){_0x13c315=_0x13c315-0x0;var _0x4a3246=_0xe202[_0x13c315];return _0x4a3246;};'use strict';var monitorFormat={'wav':_0x2e20('0x0'),'wav49':_0x2e20('0x1'),'gsm':_0x2e20('0x2')};var strategy={'fewestcalls':_0x2e20('0x3'),'leastrecent':_0x2e20('0x4'),'linear':'linear','random':'random','ringall':_0x2e20('0x5'),'rr':_0x2e20('0x6'),'rrmemory':'rrmemory','rrordered':_0x2e20('0x7'),'wrandom':_0x2e20('0x8')};function VoiceQueue(_0xacf618){this['id']=_0xacf618['id']||0x0;this[_0x2e20('0x9')]=_0xacf618[_0x2e20('0x9')]||'';this['monitor_format']=_0xacf618[_0x2e20('0xa')]||'';this['type']=_0xacf618[_0x2e20('0xb')]||_0x2e20('0xc');this[_0x2e20('0xd')]=0x0;this[_0x2e20('0xe')]=0x0;this[_0x2e20('0xf')]=0x0;this['sumDuration']=0x0;this[_0x2e20('0x10')]=0x0;this[_0x2e20('0x11')]=0x0;this[_0x2e20('0x12')]=0x0;this[_0x2e20('0x13')]=0x0;this[_0x2e20('0x14')]=0x0;this['busy']=0x0;this[_0x2e20('0x15')]=0x0;this['invalid']=0x0;this[_0x2e20('0x16')]=0x0;this[_0x2e20('0x17')]=0x0;this[_0x2e20('0x18')]=0x0;this[_0x2e20('0x19')]=0x0;this[_0x2e20('0x1a')]=0x0;this[_0x2e20('0x1b')]=0x0;this[_0x2e20('0x1c')]=0x0;this[_0x2e20('0x1d')]=0x0;this[_0x2e20('0x1e')]=0x0;this[_0x2e20('0x1f')]=_0xacf618[_0x2e20('0x1f')]||![];this[_0x2e20('0x20')]=_0xacf618['acwTimeout']||0xa;this['autopause']=_0xacf618[_0x2e20('0x21')]||'no';this[_0x2e20('0x22')]=!![];this[_0x2e20('0x23')]='';this['statusMessage']='';this['originated']=0x0;this['temp']=0x0;this[_0x2e20('0x24')]=_0xacf618[_0x2e20('0x24')]||null;this[_0x2e20('0x25')]=_0xacf618[_0x2e20('0x25')]?_0xacf618[_0x2e20('0x25')]:null;this['dialActive']=_0xacf618['dialActive'];this['dialMethod']=_0xacf618[_0x2e20('0x26')]||_0x2e20('0x27');this[_0x2e20('0x28')]=_0xacf618['dialLimitChannel']||0x0;this[_0x2e20('0x29')]=_0xacf618[_0x2e20('0x29')]||0x0;this[_0x2e20('0x2a')]=_0xacf618[_0x2e20('0x2a')]||0x1;this[_0x2e20('0x2b')]=_0xacf618[_0x2e20('0x2b')]||_0x2e20('0x2c');this['dialPredictiveOptimizationPercentage']=_0xacf618['dialPredictiveOptimizationPercentage']||0.03;this[_0x2e20('0x2d')]=_0xacf618['dialPredictiveInterval']||0x258;this[_0x2e20('0x2e')]=_0xacf618[_0x2e20('0x2e')]||_0x2e20('0x2f');this[_0x2e20('0x30')]=_0xacf618[_0x2e20('0x30')]||_0x2e20('0x2f');this['dialOriginateTimeout']=_0xacf618['dialOriginateTimeout']||0x1e;this['dialQueueOptions']=_0xacf618[_0x2e20('0x31')]||_0x2e20('0x32');this['dialQueueTimeout']=_0xacf618[_0x2e20('0x33')]||0x3;this[_0x2e20('0x34')]=_0xacf618['dialQueueProject']||undefined;this[_0x2e20('0x35')]=_0xacf618[_0x2e20('0x35')]||0x3;this[_0x2e20('0x36')]=_0xacf618[_0x2e20('0x36')]||0x96;this[_0x2e20('0x37')]=_0xacf618[_0x2e20('0x37')]||0x3;this['dialBusyRetryFrequency']=_0xacf618[_0x2e20('0x38')]||0x96;this['dialNoAnswerMaxRetry']=_0xacf618['dialNoAnswerMaxRetry']||0x3;this[_0x2e20('0x39')]=_0xacf618[_0x2e20('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0xacf618[_0x2e20('0x3a')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0xacf618[_0x2e20('0x3b')]||0x96;this['dialDropMaxRetry']=_0xacf618[_0x2e20('0x3c')]||0x3;this['dialDropRetryFrequency']=_0xacf618[_0x2e20('0x3d')]||0x96;this[_0x2e20('0x3e')]=_0xacf618['dialAbandonedMaxRetry']||0x3;this[_0x2e20('0x3f')]=_0xacf618[_0x2e20('0x3f')]||0x96;this['dialMachineMaxRetry']=_0xacf618[_0x2e20('0x40')]||0x3;this['dialMachineRetryFrequency']=_0xacf618[_0x2e20('0x41')]||0x96;this[_0x2e20('0x42')]=_0xacf618[_0x2e20('0x42')]||0x3;this[_0x2e20('0x43')]=_0xacf618[_0x2e20('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0xacf618[_0x2e20('0x44')]||0x3;this[_0x2e20('0x45')]=_0xacf618[_0x2e20('0x45')]||0x4;this[_0x2e20('0x46')]=_0xacf618[_0x2e20('0x46')]?_0xacf618[_0x2e20('0x46')]:undefined;this[_0x2e20('0x47')]=_0xacf618[_0x2e20('0x47')]?_0xacf618[_0x2e20('0x47')]:undefined;this[_0x2e20('0x48')]=_0xacf618[_0x2e20('0x48')]||undefined;this[_0x2e20('0x49')]=_0xacf618[_0x2e20('0x49')]?_0xacf618['Interval']:undefined;this['dialOrderByScheduledAt']=_0xacf618['dialOrderByScheduledAt']||'DESC';this[_0x2e20('0x4a')]=_0xacf618[_0x2e20('0x4a')]||undefined;this[_0x2e20('0x4b')]=_0xacf618[_0x2e20('0x4b')]||undefined;this['strategy']=strategy[_0xacf618['strategy']];this[_0x2e20('0x4c')]=!![];this[_0x2e20('0x4d')]=_0xacf618['dialAMDActive']||![];this['dialAMDInitialSilence']=_0xacf618[_0x2e20('0x4e')];this[_0x2e20('0x4f')]=_0xacf618['dialAMDGreeting'];this[_0x2e20('0x50')]=_0xacf618[_0x2e20('0x50')];this['dialAMDTotalAnalysisTime']=_0xacf618['dialAMDTotalAnalysisTime'];this[_0x2e20('0x51')]=_0xacf618[_0x2e20('0x51')];this[_0x2e20('0x52')]=_0xacf618[_0x2e20('0x52')];this['dialAMDMaximumNumberOfWords']=_0xacf618['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0xacf618['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xacf618[_0x2e20('0x53')];this['outboundRejectCallsDay']=0x0;this['pTalking']=0x0;this[_0x2e20('0x54')]=_0xacf618[_0x2e20('0x54')];this[_0x2e20('0x55')]=0x0;this[_0x2e20('0x56')]=0x0;this[_0x2e20('0x57')]=0x0;this[_0x2e20('0x58')]=0x0;this[_0x2e20('0x59')]=0x0;this['outboundNoSuchCallsDay']=0x0;this['outboundUnknownCallsDay']=0x0;this[_0x2e20('0x5a')]=0x0;this[_0x2e20('0x5b')]=0x0;this[_0x2e20('0x5c')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x2e20('0x5d')]=0x0;this[_0x2e20('0x5e')]=0x0;this['outboundAbandonedDay']=0x0;this[_0x2e20('0x5f')]=undefined;this[_0x2e20('0x60')]=undefined;this[_0x2e20('0x61')]=undefined;this[_0x2e20('0x62')]=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x2e20('0x63')]=0x0;this[_0x2e20('0x64')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x2e20('0x65')]=0x0;this[_0x2e20('0x66')]=0x0;this[_0x2e20('0x67')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x2e20('0x68')]=_0xacf618[_0x2e20('0x69')]||0x14;this[_0x2e20('0x6a')]=_0xacf618[_0x2e20('0x69')]||0xa;this[_0x2e20('0x6b')]=0x0;this[_0x2e20('0x6c')]=0x0;this[_0x2e20('0x6d')]=0x1;this[_0x2e20('0x6e')]=0x0;this[_0x2e20('0x6f')]=0x0;this[_0x2e20('0x70')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0xacf618[_0x2e20('0x71')]||0x1e;this[_0x2e20('0x72')]=_0xacf618['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0xacf618[_0x2e20('0x73')]||![];this[_0x2e20('0x74')]=!!_0xacf618[_0x2e20('0x74')]||![];this[_0x2e20('0x75')]=_0xacf618[_0x2e20('0x75')]||undefined;this[_0x2e20('0x76')]=_0xacf618['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0xacf618[_0x2e20('0x77')]||![];this[_0x2e20('0xa')]=monitorFormat[_0xacf618['monitor_format']]?monitorFormat[_0xacf618[_0x2e20('0xa')]]:undefined;this['mandatoryDisposition']=_0xacf618['mandatoryDisposition']||![];this[_0x2e20('0x78')]=_0xacf618[_0x2e20('0x78')]?_0xacf618[_0x2e20('0x78')]:undefined;this[_0x2e20('0x79')]=![];}module[_0x2e20('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x8bea=['sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','invalid','loggedIn','notInUse','onHold','paused','ringing','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total'];(function(_0x3463f6,_0x907c11){var _0xd73d93=function(_0x473bb6){while(--_0x473bb6){_0x3463f6['push'](_0x3463f6['shift']());}};_0xd73d93(++_0x907c11);}(_0x8bea,0xfc));var _0xa8be=function(_0x16ddb2,_0x40e6c8){_0x16ddb2=_0x16ddb2-0x0;var _0x247878=_0x8bea[_0x16ddb2];return _0x247878;};'use strict';var monitorFormat={'wav':_0xa8be('0x0'),'wav49':_0xa8be('0x1'),'gsm':_0xa8be('0x2')};var strategy={'fewestcalls':_0xa8be('0x3'),'leastrecent':_0xa8be('0x4'),'linear':_0xa8be('0x5'),'random':'random','ringall':_0xa8be('0x6'),'rr':_0xa8be('0x7'),'rrmemory':_0xa8be('0x8'),'rrordered':_0xa8be('0x9'),'wrandom':_0xa8be('0xa')};function VoiceQueue(_0x39d97b){this['id']=_0x39d97b['id']||0x0;this[_0xa8be('0xb')]=_0x39d97b[_0xa8be('0xb')]||'';this[_0xa8be('0xc')]=_0x39d97b['monitor_format']||'';this[_0xa8be('0xd')]=_0x39d97b[_0xa8be('0xd')]||'inbound';this[_0xa8be('0xe')]=0x0;this[_0xa8be('0xf')]=0x0;this['answered']=0x0;this[_0xa8be('0x10')]=0x0;this[_0xa8be('0x11')]=0x0;this[_0xa8be('0x12')]=0x0;this[_0xa8be('0x13')]=0x0;this[_0xa8be('0x14')]=0x0;this[_0xa8be('0x15')]=0x0;this[_0xa8be('0x16')]=0x0;this['inUse']=0x0;this[_0xa8be('0x17')]=0x0;this[_0xa8be('0x18')]=0x0;this[_0xa8be('0x19')]=0x0;this[_0xa8be('0x1a')]=0x0;this[_0xa8be('0x1b')]=0x0;this[_0xa8be('0x1c')]=0x0;this['ringInUse']=0x0;this['talking']=0x0;this[_0xa8be('0x1d')]=0x0;this[_0xa8be('0x1e')]=0x0;this[_0xa8be('0x1f')]=_0x39d97b[_0xa8be('0x1f')]||![];this[_0xa8be('0x20')]=_0x39d97b[_0xa8be('0x20')]||0xa;this[_0xa8be('0x21')]=_0x39d97b[_0xa8be('0x21')]||'no';this[_0xa8be('0x22')]=!![];this[_0xa8be('0x23')]='';this[_0xa8be('0x24')]='';this[_0xa8be('0x25')]=0x0;this['temp']=0x0;this[_0xa8be('0x26')]=_0x39d97b['dialTimezone']||null;this[_0xa8be('0x27')]=_0x39d97b['dialGlobalInterval']?_0x39d97b[_0xa8be('0x27')]:null;this[_0xa8be('0x28')]=_0x39d97b['dialActive'];this['dialMethod']=_0x39d97b[_0xa8be('0x29')]||_0xa8be('0x2a');this[_0xa8be('0x2b')]=_0x39d97b[_0xa8be('0x2b')]||0x0;this['dialLimitQueue']=_0x39d97b[_0xa8be('0x2c')]||0x0;this[_0xa8be('0x2d')]=_0x39d97b[_0xa8be('0x2d')]||0x1;this[_0xa8be('0x2e')]=_0x39d97b[_0xa8be('0x2e')]||_0xa8be('0x2f');this[_0xa8be('0x30')]=_0x39d97b[_0xa8be('0x30')]||0.03;this['dialPredictiveInterval']=_0x39d97b['dialPredictiveInterval']||0x258;this[_0xa8be('0x31')]=_0x39d97b[_0xa8be('0x31')]||_0xa8be('0x32');this['dialOriginateCallerIdNumber']=_0x39d97b[_0xa8be('0x33')]||_0xa8be('0x32');this[_0xa8be('0x34')]=_0x39d97b[_0xa8be('0x34')]||0x1e;this[_0xa8be('0x35')]=_0x39d97b[_0xa8be('0x35')]||_0xa8be('0x36');this[_0xa8be('0x37')]=_0x39d97b[_0xa8be('0x37')]||0x3;this[_0xa8be('0x38')]=_0x39d97b[_0xa8be('0x38')]||undefined;this['dialCongestionMaxRetry']=_0x39d97b[_0xa8be('0x39')]||0x3;this[_0xa8be('0x3a')]=_0x39d97b[_0xa8be('0x3a')]||0x96;this[_0xa8be('0x3b')]=_0x39d97b[_0xa8be('0x3b')]||0x3;this[_0xa8be('0x3c')]=_0x39d97b[_0xa8be('0x3c')]||0x96;this[_0xa8be('0x3d')]=_0x39d97b['dialNoAnswerMaxRetry']||0x3;this[_0xa8be('0x3e')]=_0x39d97b[_0xa8be('0x3e')]||0x96;this[_0xa8be('0x3f')]=_0x39d97b[_0xa8be('0x3f')]||0x3;this[_0xa8be('0x40')]=_0x39d97b[_0xa8be('0x40')]||0x96;this[_0xa8be('0x41')]=_0x39d97b[_0xa8be('0x41')]||0x3;this[_0xa8be('0x42')]=_0x39d97b[_0xa8be('0x42')]||0x96;this['dialAbandonedMaxRetry']=_0x39d97b[_0xa8be('0x43')]||0x3;this['dialAbandonedRetryFrequency']=_0x39d97b[_0xa8be('0x44')]||0x96;this[_0xa8be('0x45')]=_0x39d97b[_0xa8be('0x45')]||0x3;this[_0xa8be('0x46')]=_0x39d97b['dialMachineRetryFrequency']||0x96;this[_0xa8be('0x47')]=_0x39d97b[_0xa8be('0x47')]||0x3;this[_0xa8be('0x48')]=_0x39d97b[_0xa8be('0x48')]||0x96;this['callAdditionalPhoneAfterMin']=_0x39d97b[_0xa8be('0x49')]||0x3;this[_0xa8be('0x4a')]=_0x39d97b['dialGlobalMaxRetry']||0x4;this[_0xa8be('0x4b')]=_0x39d97b[_0xa8be('0x4b')]?_0x39d97b['Trunk']:undefined;this['TrunkBackup']=_0x39d97b[_0xa8be('0x4c')]?_0x39d97b['TrunkBackup']:undefined;this[_0xa8be('0x4d')]=_0x39d97b['dialPrefix']||undefined;this['Interval']=_0x39d97b[_0xa8be('0x4e')]?_0x39d97b['Interval']:undefined;this[_0xa8be('0x4f')]=_0x39d97b['dialOrderByScheduledAt']||_0xa8be('0x50');this[_0xa8be('0x51')]=_0x39d97b[_0xa8be('0x51')]||undefined;this[_0xa8be('0x52')]=_0x39d97b[_0xa8be('0x52')]||undefined;this[_0xa8be('0x53')]=strategy[_0x39d97b['strategy']];this[_0xa8be('0x54')]=!![];this[_0xa8be('0x55')]=_0x39d97b['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x39d97b['dialAMDInitialSilence'];this[_0xa8be('0x56')]=_0x39d97b[_0xa8be('0x56')];this[_0xa8be('0x57')]=_0x39d97b[_0xa8be('0x57')];this[_0xa8be('0x58')]=_0x39d97b[_0xa8be('0x58')];this[_0xa8be('0x59')]=_0x39d97b['dialAMDMinWordLength'];this[_0xa8be('0x5a')]=_0x39d97b[_0xa8be('0x5a')];this[_0xa8be('0x5b')]=_0x39d97b['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x39d97b[_0xa8be('0x5c')];this[_0xa8be('0x5d')]=_0x39d97b['dialAMDMaximumWordLength'];this[_0xa8be('0x5e')]=0x0;this[_0xa8be('0x5f')]=0x0;this['timeout']=_0x39d97b[_0xa8be('0x60')];this[_0xa8be('0x61')]=0x0;this[_0xa8be('0x62')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xa8be('0x63')]=0x0;this[_0xa8be('0x64')]=0x0;this[_0xa8be('0x65')]=0x0;this[_0xa8be('0x66')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa8be('0x67')]=0x0;this[_0xa8be('0x68')]=0x0;this[_0xa8be('0x69')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xa8be('0x6a')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xa8be('0x6b')]=undefined;this[_0xa8be('0x6c')]=undefined;this[_0xa8be('0x6d')]=undefined;this[_0xa8be('0x6e')]=1.05;this[_0xa8be('0x6f')]=0x0;this[_0xa8be('0x70')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xa8be('0x71')]=0x0;this[_0xa8be('0x72')]=0x0;this[_0xa8be('0x73')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xa8be('0x74')]=_0x39d97b[_0xa8be('0x75')]||0x14;this[_0xa8be('0x76')]=_0x39d97b[_0xa8be('0x75')]||0xa;this[_0xa8be('0x77')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xa8be('0x78')]=0x1;this[_0xa8be('0x79')]=0x0;this[_0xa8be('0x7a')]=0x0;this[_0xa8be('0x7b')]=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x39d97b['dialRecallMeTimeout']||0x1e;this[_0xa8be('0x7c')]=_0x39d97b['dialRecallInQueue']||![];this[_0xa8be('0x7d')]=!!_0x39d97b[_0xa8be('0x7d')]||![];this[_0xa8be('0x7e')]=!!_0x39d97b[_0xa8be('0x7e')]||![];this['dialQueueProject2']=_0x39d97b[_0xa8be('0x7f')]||undefined;this[_0xa8be('0x80')]=_0x39d97b['dialAgiAfterHangupClient']||![];this[_0xa8be('0x81')]=_0x39d97b[_0xa8be('0x81')]||![];this[_0xa8be('0xc')]=monitorFormat[_0x39d97b['monitor_format']]?monitorFormat[_0x39d97b['monitor_format']]:undefined;this['mandatoryDisposition']=_0x39d97b[_0xa8be('0x82')]||![];this[_0xa8be('0x83')]=_0x39d97b[_0xa8be('0x83')]?_0x39d97b['mandatoryDispositionPause']:undefined;this[_0xa8be('0x84')]=![];}module[_0xa8be('0x85')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index bb00747..d53d90e 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x68f5=['active','loggedin','callers','length','SIP/','online','incall','includes','busy','dialMethod','booked','keys','queue','dialer','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','compareToOutboundQueue','preview','available','loggedIn','loggedInDb','ringing','talking','waiting','answered','originated','outboundAbandonedCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','paused','sumBillable','sumDuration','total','name','strategy','abandoned','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','pTalking','dialActive','dialOriginateCallerIdName','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startProgressive','message','statusMessage','Trunk'];(function(_0x4578c8,_0x56ad28){var _0x1dd636=function(_0x381355){while(--_0x381355){_0x4578c8['push'](_0x4578c8['shift']());}};_0x1dd636(++_0x56ad28);}(_0x68f5,0x11a));var _0x568f=function(_0x3508b2,_0x29aaef){_0x3508b2=_0x3508b2-0x0;var _0x10280c=_0x68f5[_0x3508b2];return _0x10280c;};'use strict';var INBOUND_COUNTERS=[_0x568f('0x0'),_0x568f('0x1'),_0x568f('0x2'),'paused',_0x568f('0x3'),_0x568f('0x4'),_0x568f('0x5')];var OUTBOUND_COUNTERS=[_0x568f('0x0'),_0x568f('0x6'),'inUse',_0x568f('0x1'),_0x568f('0x2'),_0x568f('0x7'),_0x568f('0x8'),'outboundAnswerCallsDay','outboundBlacklistCallsDay',_0x568f('0x9'),_0x568f('0xa'),_0x568f('0xb'),'outboundNoSuchCallsDay',_0x568f('0xc'),'outboundRejectCallsDay',_0x568f('0xd'),_0x568f('0xe'),'pTalking',_0x568f('0x4'),_0x568f('0xf'),_0x568f('0x10'),_0x568f('0x11'),_0x568f('0x5')];function VoiceQueueSummary(_0x339bdd){this['id']=_0x339bdd['id'];this[_0x568f('0x12')]=_0x339bdd[_0x568f('0x12')];this[_0x568f('0x13')]=_0x339bdd['strategy'];this[_0x568f('0x14')]=_0x339bdd[_0x568f('0x14')]||0x0;this[_0x568f('0x6')]=_0x339bdd[_0x568f('0x6')]||0x0;this['available']=_0x339bdd[_0x568f('0x0')]||0x0;this['busy']=_0x339bdd['busy']||0x0;this[_0x568f('0x15')]=_0x339bdd[_0x568f('0x15')]||0x0;this[_0x568f('0x16')]=_0x339bdd[_0x568f('0x16')]||0x0;this[_0x568f('0x1')]=_0x339bdd[_0x568f('0x1')]||0x0;this[_0x568f('0x2')]=_0x339bdd[_0x568f('0x2')]||0x0;this[_0x568f('0x17')]=_0x339bdd[_0x568f('0x17')]||0x0;this[_0x568f('0x18')]=_0x339bdd['notInUse']||0x0;this[_0x568f('0xe')]=_0x339bdd[_0x568f('0xe')]||0x0;this[_0x568f('0x3')]=_0x339bdd[_0x568f('0x3')]||0x0;this[_0x568f('0x19')]=_0x339bdd[_0x568f('0x19')];this[_0x568f('0xf')]=_0x339bdd[_0x568f('0xf')];this[_0x568f('0x10')]=_0x339bdd[_0x568f('0x10')];this[_0x568f('0x1a')]=_0x339bdd[_0x568f('0x1a')]||0x0;this[_0x568f('0x4')]=_0x339bdd[_0x568f('0x4')]||0x0;this[_0x568f('0x11')]=_0x339bdd[_0x568f('0x11')]||0x0;this[_0x568f('0x1b')]=_0x339bdd[_0x568f('0x1b')];this[_0x568f('0x1c')]=_0x339bdd[_0x568f('0x1c')]||0x0;this[_0x568f('0x1d')]=_0x339bdd[_0x568f('0x1d')]||0x0;this[_0x568f('0x1e')]=_0x339bdd[_0x568f('0x1e')]||0x0;this[_0x568f('0x5')]=_0x339bdd[_0x568f('0x5')]||0x0;if(_0x339bdd['type']==='outbound'){this[_0x568f('0x1f')]=_0x339bdd[_0x568f('0x1f')]||0x0;this[_0x568f('0x20')]=_0x339bdd[_0x568f('0x20')];this['dialMethod']=_0x339bdd['dialMethod'];this[_0x568f('0x21')]=_0x339bdd['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x339bdd['dialOriginateCallerIdNumber'];this[_0x568f('0x22')]=_0x339bdd['dialOriginateTimeout'];this[_0x568f('0x23')]=_0x339bdd['dialPrefix'];this[_0x568f('0x24')]=_0x339bdd[_0x568f('0x24')];this[_0x568f('0x25')]=_0x339bdd['outboundAnswerAgiCallsDay'];this[_0x568f('0x26')]=_0x339bdd[_0x568f('0x26')];this['outboundBlacklistCallsDay']=_0x339bdd[_0x568f('0x27')];this['outboundBusyCallsDay']=_0x339bdd[_0x568f('0x9')];this['outboundCongestionCallsDay']=_0x339bdd['outboundCongestionCallsDay'];this[_0x568f('0x28')]=_0x339bdd[_0x568f('0x28')];this[_0x568f('0x29')]=_0x339bdd[_0x568f('0x29')];this[_0x568f('0x2a')]=_0x339bdd[_0x568f('0x2a')];this[_0x568f('0xb')]=_0x339bdd[_0x568f('0xb')];this['outboundNoSuchCallsDay']=_0x339bdd[_0x568f('0x2b')];this[_0x568f('0x2c')]=_0x339bdd[_0x568f('0x2c')];this[_0x568f('0xc')]=_0x339bdd['outboundReCallsDay'];this[_0x568f('0x2d')]=_0x339bdd[_0x568f('0x2d')];this[_0x568f('0xd')]=_0x339bdd[_0x568f('0xd')];this[_0x568f('0x2e')]=_0x339bdd[_0x568f('0x2e')];this[_0x568f('0x2f')]=_0x339bdd['predictiveIntervalAvgHoldtime'];this[_0x568f('0x30')]=_0x339bdd[_0x568f('0x30')];this[_0x568f('0x31')]=_0x339bdd[_0x568f('0x31')];this[_0x568f('0x32')]=_0x339bdd['predictiveIntervalDroppedCallsTimeout'];this['predictiveIntervalErlangCalls']=_0x339bdd[_0x568f('0x33')];this[_0x568f('0x34')]=_0x339bdd[_0x568f('0x34')];this[_0x568f('0x35')]=_0x339bdd[_0x568f('0x35')];this['predictiveIntervalMultiplicativeFactor']=_0x339bdd[_0x568f('0x36')];this[_0x568f('0x37')]=_0x339bdd[_0x568f('0x37')];this[_0x568f('0x38')]=_0x339bdd[_0x568f('0x38')];this[_0x568f('0x39')]=_0x339bdd[_0x568f('0x39')];this[_0x568f('0x7')]=_0x339bdd[_0x568f('0x7')];this[_0x568f('0x3a')]=_0x339bdd[_0x568f('0x3a')];this[_0x568f('0x3b')]=_0x339bdd[_0x568f('0x3b')];this[_0x568f('0x3c')]=_0x339bdd[_0x568f('0x3c')];this['erlangBusyFactor']=_0x339bdd[_0x568f('0x3d')];this['startPredictive']=_0x339bdd['startPredictive'];this[_0x568f('0x3e')]=_0x339bdd['startProgressive'];this[_0x568f('0x3f')]=_0x339bdd[_0x568f('0x3f')];this['statusMessage']=_0x339bdd[_0x568f('0x40')];}if(_0x339bdd[_0x568f('0x41')]){this[_0x568f('0x41')]={'id':_0x339bdd[_0x568f('0x41')]['id'],'name':_0x339bdd[_0x568f('0x41')]['name'],'active':_0x339bdd[_0x568f('0x41')][_0x568f('0x42')],'callerid':_0x339bdd['Trunk']['callerid']};}}VoiceQueueSummary['prototype']['createReport']=function(_0x3bcf12,_0x36bd1a,_0x3366e1,_0xead285){this[_0x568f('0x2')]=0x0;this['talking']=0x0;this[_0x568f('0xe')]=0x0;this[_0x568f('0x1d')]=0x0;this[_0x568f('0x18')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0x568f('0x16')]=0x0;this['unavailable']=0x0;this[_0x568f('0x3')]=0x0;this[_0x568f('0x19')]=0x0;this['onHold']=0x0;if(_0x3366e1){if(_0x3366e1[_0x568f('0x0')]){this[_0x568f('0x0')]=Number(_0x3366e1[_0x568f('0x0')]);}if(_0x3366e1['loggedin']){this['loggedIn']=Number(_0x3366e1[_0x568f('0x43')]);}if(_0x3366e1[_0x568f('0x44')]){this['waiting']=Number(_0x3366e1['callers']);}}for(var _0x2c7c78=0x0;_0x2c7c78<_0x3bcf12[_0x568f('0x45')];_0x2c7c78++){var _0x5cd63a=_0x36bd1a[_0x568f('0x46')+_0x3bcf12[_0x2c7c78]['name']];if(_0x5cd63a&&_0x5cd63a[_0x568f('0x47')]){this['loggedInDb']+=0x1;}if(_0x3bcf12[_0x2c7c78][_0x568f('0x48')]==='1'){this[_0x568f('0x4')]+=0x1;}if(_0x3bcf12[_0x2c7c78][_0x568f('0xe')]==='1'&&!['2','7','8'][_0x568f('0x49')](_0x3bcf12[_0x2c7c78]['status'])){this[_0x568f('0xe')]+=0x1;}switch(_0x3bcf12[_0x2c7c78]['status']){case'0':this[_0x568f('0x1d')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x568f('0x4a')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x568f('0x1c')]+=0x1;break;case'6':this[_0x568f('0x3')]+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this[_0x568f('0x17')]+=0x1;break;}}if(this[_0x568f('0x4b')]===_0x568f('0x4c')){var _0x4fa4a4=Object[_0x568f('0x4d')](_0xead285);for(var _0x1fe7c5=0x0;_0x1fe7c5<_0x4fa4a4[_0x568f('0x45')];_0x1fe7c5++){var _0x34336f=_0x4fa4a4[_0x1fe7c5];var _0x4e109e=_0xead285[_0x34336f];if(_0x4e109e[_0x568f('0x4e')]===this[_0x568f('0x12')]&&_0x4e109e['type']===_0x568f('0x4f')&&_0x4e109e[_0x568f('0x50')]===_0x568f('0x51')){this[_0x568f('0x4')]+=0x1;}}if(this[_0x568f('0x4')]>this['inUse']){this[_0x568f('0x4')]=this['inUse'];}this['pTalking']=0x0;}return this;};VoiceQueueSummary[_0x568f('0x52')][_0x568f('0x53')]=function(_0x4513a0){var _0x49943e=![];if(_0x4513a0){_0x49943e=INBOUND_COUNTERS[_0x568f('0x54')](function(_0x379f87){return this[_0x379f87]!==_0x4513a0[_0x379f87];},this);}return _0x49943e;};VoiceQueueSummary['prototype'][_0x568f('0x55')]=function(_0x5ed4d8){var _0x1abd9f=![];var _0x146dc8=![];var _0x28cd48=![];if(_0x5ed4d8){_0x1abd9f=this[_0x568f('0x4b')]!==_0x5ed4d8[_0x568f('0x4b')]||this[_0x568f('0x20')]!==_0x5ed4d8[_0x568f('0x20')]||this[_0x568f('0x3f')]!==_0x5ed4d8[_0x568f('0x3f')]||this[_0x568f('0x40')]!==_0x5ed4d8[_0x568f('0x40')];_0x146dc8=OUTBOUND_COUNTERS[_0x568f('0x54')](function(_0x4fdcd8){return this[_0x4fdcd8]!==_0x5ed4d8[_0x4fdcd8];},this);if(this[_0x568f('0x41')]&&_0x5ed4d8[_0x568f('0x41')]){_0x28cd48=this[_0x568f('0x41')][_0x568f('0x12')]!==_0x5ed4d8[_0x568f('0x41')][_0x568f('0x12')]||this[_0x568f('0x41')]['active']!==_0x5ed4d8[_0x568f('0x41')][_0x568f('0x42')];}}return _0x1abd9f||_0x146dc8||_0x28cd48;};VoiceQueueSummary[_0x568f('0x52')]['updateReportFromOutboundQueue']=function(_0x29cc1f){this[_0x568f('0x6')]=_0x29cc1f[_0x568f('0x6')];this[_0x568f('0x3f')]=_0x29cc1f[_0x568f('0x3f')];this[_0x568f('0x40')]=_0x29cc1f[_0x568f('0x40')];this[_0x568f('0x7')]=_0x29cc1f['originated'];this[_0x568f('0x8')]=_0x29cc1f[_0x568f('0x8')];this[_0x568f('0x26')]=_0x29cc1f['outboundAnswerCallsDay'];this[_0x568f('0x27')]=_0x29cc1f[_0x568f('0x27')];this[_0x568f('0x9')]=_0x29cc1f[_0x568f('0x9')];this[_0x568f('0xa')]=_0x29cc1f[_0x568f('0xa')];this[_0x568f('0xb')]=_0x29cc1f[_0x568f('0xb')];this[_0x568f('0x2b')]=_0x29cc1f[_0x568f('0x2b')];this[_0x568f('0xc')]=_0x29cc1f[_0x568f('0xc')];this[_0x568f('0x2d')]=_0x29cc1f[_0x568f('0x2d')];this[_0x568f('0xd')]=_0x29cc1f[_0x568f('0xd')];this[_0x568f('0xf')]=_0x29cc1f[_0x568f('0xf')];this['sumDuration']=_0x29cc1f[_0x568f('0x10')];this[_0x568f('0x11')]=_0x29cc1f[_0x568f('0x11')];if(this[_0x568f('0x4b')]===_0x568f('0x56')){this[_0x568f('0x1f')]=_0x29cc1f[_0x568f('0x1f')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x7f42=['startPredictive','startProgressive','message','statusMessage','Trunk','name','active','callerid','createReport','busy','loggedin','callers','SIP/','online','incall','status','booked','keys','length','queue','exten','xcally-motion-preview','prototype','compareToInboundQueue','some','updateReportFromOutboundQueue','originated','available','loggedInDb','paused','talking','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','waiting','strategy','abandoned','answered','invalid','loggedIn','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor'];(function(_0x549b56,_0x15b7be){var _0xde5ecb=function(_0x4e4eee){while(--_0x4e4eee){_0x549b56['push'](_0x549b56['shift']());}};_0xde5ecb(++_0x15b7be);}(_0x7f42,0x1dd));var _0x27f4=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0x7f42[_0x5d6456];return _0x4d66c1;};'use strict';var INBOUND_COUNTERS=[_0x27f4('0x0'),'loggedIn',_0x27f4('0x1'),_0x27f4('0x2'),'ringing',_0x27f4('0x3'),'waiting'];var OUTBOUND_COUNTERS=[_0x27f4('0x0'),'answered',_0x27f4('0x4'),'loggedIn',_0x27f4('0x1'),'originated',_0x27f4('0x5'),_0x27f4('0x6'),_0x27f4('0x7'),_0x27f4('0x8'),_0x27f4('0x9'),_0x27f4('0xa'),_0x27f4('0xb'),_0x27f4('0xc'),_0x27f4('0xd'),_0x27f4('0xe'),_0x27f4('0x2'),_0x27f4('0xf'),_0x27f4('0x3'),_0x27f4('0x10'),_0x27f4('0x11'),_0x27f4('0x12'),_0x27f4('0x13')];function VoiceQueueSummary(_0x28465a){this['id']=_0x28465a['id'];this['name']=_0x28465a['name'];this[_0x27f4('0x14')]=_0x28465a[_0x27f4('0x14')];this[_0x27f4('0x15')]=_0x28465a[_0x27f4('0x15')]||0x0;this[_0x27f4('0x16')]=_0x28465a[_0x27f4('0x16')]||0x0;this[_0x27f4('0x0')]=_0x28465a[_0x27f4('0x0')]||0x0;this['busy']=_0x28465a['busy']||0x0;this[_0x27f4('0x4')]=_0x28465a[_0x27f4('0x4')]||0x0;this[_0x27f4('0x17')]=_0x28465a[_0x27f4('0x17')]||0x0;this['loggedIn']=_0x28465a[_0x27f4('0x18')]||0x0;this[_0x27f4('0x1')]=_0x28465a[_0x27f4('0x1')]||0x0;this['onHold']=_0x28465a[_0x27f4('0x19')]||0x0;this[_0x27f4('0x1a')]=_0x28465a[_0x27f4('0x1a')]||0x0;this['paused']=_0x28465a[_0x27f4('0x2')]||0x0;this[_0x27f4('0x1b')]=_0x28465a['ringing']||0x0;this['ringInUse']=_0x28465a[_0x27f4('0x1c')];this[_0x27f4('0x10')]=_0x28465a[_0x27f4('0x10')];this[_0x27f4('0x11')]=_0x28465a[_0x27f4('0x11')];this[_0x27f4('0x1d')]=_0x28465a[_0x27f4('0x1d')]||0x0;this[_0x27f4('0x3')]=_0x28465a[_0x27f4('0x3')]||0x0;this[_0x27f4('0x12')]=_0x28465a[_0x27f4('0x12')]||0x0;this[_0x27f4('0x1e')]=_0x28465a[_0x27f4('0x1e')];this[_0x27f4('0x1f')]=_0x28465a[_0x27f4('0x1f')]||0x0;this['unknown']=_0x28465a[_0x27f4('0x20')]||0x0;this[_0x27f4('0x21')]=_0x28465a[_0x27f4('0x21')]||0x0;this[_0x27f4('0x13')]=_0x28465a[_0x27f4('0x13')]||0x0;if(_0x28465a[_0x27f4('0x1e')]===_0x27f4('0x22')){this[_0x27f4('0xf')]=_0x28465a[_0x27f4('0xf')]||0x0;this[_0x27f4('0x23')]=_0x28465a[_0x27f4('0x23')];this[_0x27f4('0x24')]=_0x28465a[_0x27f4('0x24')];this[_0x27f4('0x25')]=_0x28465a[_0x27f4('0x25')];this[_0x27f4('0x26')]=_0x28465a[_0x27f4('0x26')];this['dialOriginateTimeout']=_0x28465a[_0x27f4('0x27')];this['dialPrefix']=_0x28465a[_0x27f4('0x28')];this[_0x27f4('0x29')]=_0x28465a[_0x27f4('0x29')];this['outboundAnswerAgiCallsDay']=_0x28465a[_0x27f4('0x2a')];this[_0x27f4('0x6')]=_0x28465a['outboundAnswerCallsDay'];this[_0x27f4('0x7')]=_0x28465a[_0x27f4('0x7')];this['outboundBusyCallsDay']=_0x28465a[_0x27f4('0x8')];this[_0x27f4('0x9')]=_0x28465a['outboundCongestionCallsDay'];this[_0x27f4('0x2b')]=_0x28465a[_0x27f4('0x2b')];this['outboundDropCallsDayCallersExit']=_0x28465a[_0x27f4('0x2c')];this[_0x27f4('0x2d')]=_0x28465a[_0x27f4('0x2d')];this['outboundNoAnswerCallsDay']=_0x28465a['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x28465a['outboundNoSuchCallsDay'];this[_0x27f4('0x2e')]=_0x28465a[_0x27f4('0x2e')];this[_0x27f4('0xc')]=_0x28465a[_0x27f4('0xc')];this[_0x27f4('0xd')]=_0x28465a[_0x27f4('0xd')];this[_0x27f4('0xe')]=_0x28465a[_0x27f4('0xe')];this[_0x27f4('0x2f')]=_0x28465a[_0x27f4('0x2f')];this[_0x27f4('0x30')]=_0x28465a['predictiveIntervalAvgHoldtime'];this[_0x27f4('0x31')]=_0x28465a[_0x27f4('0x31')];this[_0x27f4('0x32')]=_0x28465a['predictiveIntervalDroppedCallsCallersExit'];this[_0x27f4('0x33')]=_0x28465a[_0x27f4('0x33')];this[_0x27f4('0x34')]=_0x28465a[_0x27f4('0x34')];this[_0x27f4('0x35')]=_0x28465a[_0x27f4('0x35')];this[_0x27f4('0x36')]=_0x28465a[_0x27f4('0x36')];this[_0x27f4('0x37')]=_0x28465a[_0x27f4('0x37')];this[_0x27f4('0x38')]=_0x28465a[_0x27f4('0x38')];this[_0x27f4('0x39')]=_0x28465a[_0x27f4('0x39')];this[_0x27f4('0x3a')]=_0x28465a[_0x27f4('0x3a')];this['originated']=_0x28465a['originated'];this[_0x27f4('0x3b')]=_0x28465a[_0x27f4('0x3b')];this[_0x27f4('0x3c')]=_0x28465a['erlangCallToSecond'];this[_0x27f4('0x3d')]=_0x28465a[_0x27f4('0x3d')];this[_0x27f4('0x3e')]=_0x28465a['erlangBusyFactor'];this[_0x27f4('0x3f')]=_0x28465a[_0x27f4('0x3f')];this['startProgressive']=_0x28465a[_0x27f4('0x40')];this[_0x27f4('0x41')]=_0x28465a[_0x27f4('0x41')];this[_0x27f4('0x42')]=_0x28465a[_0x27f4('0x42')];}if(_0x28465a['Trunk']){this[_0x27f4('0x43')]={'id':_0x28465a[_0x27f4('0x43')]['id'],'name':_0x28465a[_0x27f4('0x43')][_0x27f4('0x44')],'active':_0x28465a['Trunk'][_0x27f4('0x45')],'callerid':_0x28465a[_0x27f4('0x43')][_0x27f4('0x46')]};}}VoiceQueueSummary['prototype'][_0x27f4('0x47')]=function(_0x5c895f,_0x32f87f,_0x221192,_0x39cd19){this[_0x27f4('0x1')]=0x0;this['talking']=0x0;this[_0x27f4('0x2')]=0x0;this[_0x27f4('0x20')]=0x0;this[_0x27f4('0x1a')]=0x0;this[_0x27f4('0x4')]=0x0;this[_0x27f4('0x48')]=0x0;this['invalid']=0x0;this[_0x27f4('0x1f')]=0x0;this['ringing']=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x221192){if(_0x221192[_0x27f4('0x0')]){this[_0x27f4('0x0')]=Number(_0x221192[_0x27f4('0x0')]);}if(_0x221192[_0x27f4('0x49')]){this['loggedIn']=Number(_0x221192[_0x27f4('0x49')]);}if(_0x221192[_0x27f4('0x4a')]){this[_0x27f4('0x13')]=Number(_0x221192[_0x27f4('0x4a')]);}}for(var _0x53a4f7=0x0;_0x53a4f7<_0x5c895f['length'];_0x53a4f7++){var _0x19e3b8=_0x32f87f[_0x27f4('0x4b')+_0x5c895f[_0x53a4f7][_0x27f4('0x44')]];if(_0x19e3b8&&_0x19e3b8[_0x27f4('0x4c')]){this['loggedInDb']+=0x1;}if(_0x5c895f[_0x53a4f7][_0x27f4('0x4d')]==='1'){this['talking']+=0x1;}if(_0x5c895f[_0x53a4f7]['paused']==='1'&&!['2','7','8']['includes'](_0x5c895f[_0x53a4f7][_0x27f4('0x4e')])){this['paused']+=0x1;}switch(_0x5c895f[_0x53a4f7][_0x27f4('0x4e')]){case'0':this[_0x27f4('0x20')]+=0x1;break;case'1':this['notInUse']+=0x1;break;case'2':this[_0x27f4('0x4')]+=0x1;break;case'3':this[_0x27f4('0x48')]+=0x1;break;case'4':this['invalid']+=0x1;break;case'5':this[_0x27f4('0x1f')]+=0x1;break;case'6':this[_0x27f4('0x1b')]+=0x1;break;case'7':this[_0x27f4('0x1c')]+=0x1;break;case'8':this[_0x27f4('0x19')]+=0x1;break;}}if(this[_0x27f4('0x24')]===_0x27f4('0x4f')){var _0xd4b6f=Object[_0x27f4('0x50')](_0x39cd19);for(var _0x505d5a=0x0;_0x505d5a<_0xd4b6f[_0x27f4('0x51')];_0x505d5a++){var _0x5e78ce=_0xd4b6f[_0x505d5a];var _0x114acd=_0x39cd19[_0x5e78ce];if(_0x114acd[_0x27f4('0x52')]===this[_0x27f4('0x44')]&&_0x114acd['type']==='dialer'&&_0x114acd[_0x27f4('0x53')]===_0x27f4('0x54')){this['talking']+=0x1;}}if(this[_0x27f4('0x3')]>this['inUse']){this[_0x27f4('0x3')]=this[_0x27f4('0x4')];}this[_0x27f4('0xf')]=0x0;}return this;};VoiceQueueSummary[_0x27f4('0x55')][_0x27f4('0x56')]=function(_0x14dba4){var _0x430371=![];if(_0x14dba4){_0x430371=INBOUND_COUNTERS['some'](function(_0x4ef06c){return this[_0x4ef06c]!==_0x14dba4[_0x4ef06c];},this);}return _0x430371;};VoiceQueueSummary[_0x27f4('0x55')]['compareToOutboundQueue']=function(_0x2d54b0){var _0x1ddae2=![];var _0x580903=![];var _0x2b0719=![];if(_0x2d54b0){_0x1ddae2=this[_0x27f4('0x24')]!==_0x2d54b0[_0x27f4('0x24')]||this[_0x27f4('0x23')]!==_0x2d54b0[_0x27f4('0x23')]||this[_0x27f4('0x41')]!==_0x2d54b0[_0x27f4('0x41')]||this[_0x27f4('0x42')]!==_0x2d54b0[_0x27f4('0x42')];_0x580903=OUTBOUND_COUNTERS[_0x27f4('0x57')](function(_0x296636){return this[_0x296636]!==_0x2d54b0[_0x296636];},this);if(this[_0x27f4('0x43')]&&_0x2d54b0[_0x27f4('0x43')]){_0x2b0719=this[_0x27f4('0x43')][_0x27f4('0x44')]!==_0x2d54b0['Trunk'][_0x27f4('0x44')]||this[_0x27f4('0x43')]['active']!==_0x2d54b0[_0x27f4('0x43')]['active'];}}return _0x1ddae2||_0x580903||_0x2b0719;};VoiceQueueSummary['prototype'][_0x27f4('0x58')]=function(_0x4b7783){this['answered']=_0x4b7783['answered'];this['message']=_0x4b7783[_0x27f4('0x41')];this['statusMessage']=_0x4b7783[_0x27f4('0x42')];this['originated']=_0x4b7783[_0x27f4('0x59')];this[_0x27f4('0x5')]=_0x4b7783[_0x27f4('0x5')];this[_0x27f4('0x6')]=_0x4b7783['outboundAnswerCallsDay'];this[_0x27f4('0x7')]=_0x4b7783[_0x27f4('0x7')];this['outboundBusyCallsDay']=_0x4b7783[_0x27f4('0x8')];this[_0x27f4('0x9')]=_0x4b7783['outboundCongestionCallsDay'];this['outboundNoAnswerCallsDay']=_0x4b7783[_0x27f4('0xa')];this[_0x27f4('0xb')]=_0x4b7783['outboundNoSuchCallsDay'];this[_0x27f4('0xc')]=_0x4b7783['outboundReCallsDay'];this[_0x27f4('0xd')]=_0x4b7783[_0x27f4('0xd')];this[_0x27f4('0xe')]=_0x4b7783[_0x27f4('0xe')];this[_0x27f4('0x10')]=_0x4b7783['sumBillable'];this[_0x27f4('0x11')]=_0x4b7783['sumDuration'];this[_0x27f4('0x12')]=_0x4b7783[_0x27f4('0x12')];if(this[_0x27f4('0x24')]==='preview'){this[_0x27f4('0xf')]=_0x4b7783[_0x27f4('0xf')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f97b818..bc98f06 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 _0x547b=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1488cd,_0x25a893){var _0x63fa13=function(_0x57dd1c){while(--_0x57dd1c){_0x1488cd['push'](_0x1488cd['shift']());}};_0x63fa13(++_0x25a893);}(_0x547b,0xd0));var _0xb547=function(_0x5b4c8d,_0x547cb1){_0x5b4c8d=_0x5b4c8d-0x0;var _0x549420=_0x547b[_0x5b4c8d];return _0x549420;};'use strict';function VtigerAccount(_0x5022b1){this['id']=_0x5022b1['id']||0x0;this[_0xb547('0x0')]=_0x5022b1['name']||'';this[_0xb547('0x1')]=_0x5022b1[_0xb547('0x1')]||'';this['accessKey']=_0x5022b1[_0xb547('0x2')]||'';this['remoteUri']=_0x5022b1[_0xb547('0x3')]||'';this['serverUrl']=_0x5022b1[_0xb547('0x4')]||'';this[_0xb547('0x5')]=_0x5022b1[_0xb547('0x5')]||{};}module[_0xb547('0x6')]=VtigerAccount; \ No newline at end of file +var _0xceca=['accessKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1e11a7,_0x2cdd06){var _0x5aa539=function(_0x129af6){while(--_0x129af6){_0x1e11a7['push'](_0x1e11a7['shift']());}};_0x5aa539(++_0x2cdd06);}(_0xceca,0x163));var _0xacec=function(_0x26434e,_0xd7e437){_0x26434e=_0x26434e-0x0;var _0x17d3a9=_0xceca[_0x26434e];return _0x17d3a9;};'use strict';function VtigerAccount(_0x1e1e11){this['id']=_0x1e1e11['id']||0x0;this[_0xacec('0x0')]=_0x1e1e11[_0xacec('0x0')]||'';this[_0xacec('0x1')]=_0x1e1e11['username']||'';this[_0xacec('0x2')]=_0x1e1e11[_0xacec('0x2')]||'';this[_0xacec('0x3')]=_0x1e1e11[_0xacec('0x3')]||'';this[_0xacec('0x4')]=_0x1e1e11[_0xacec('0x4')]||'';this[_0xacec('0x5')]=_0x1e1e11[_0xacec('0x5')]||{};}module[_0xacec('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 ed96a18..98254fc 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 _0x8993=['authType','type','integrationTab','serverUrl','Configurations','exports','name','username','password','token'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x8993,0x1dc));var _0x3899=function(_0x51dfdf,_0x312b0d){_0x51dfdf=_0x51dfdf-0x0;var _0x469694=_0x8993[_0x51dfdf];return _0x469694;};'use strict';function ZendeskAccount(_0x183cd0){this['id']=_0x183cd0['id']||0x0;this[_0x3899('0x0')]=_0x183cd0[_0x3899('0x0')]||'';this[_0x3899('0x1')]=_0x183cd0[_0x3899('0x1')]||'';this[_0x3899('0x2')]=_0x183cd0[_0x3899('0x2')]||'';this['token']=_0x183cd0[_0x3899('0x3')]||'';this['remoteUri']=_0x183cd0['remoteUri']||'';this[_0x3899('0x4')]=_0x183cd0[_0x3899('0x4')]||'';this[_0x3899('0x5')]=_0x183cd0[_0x3899('0x5')]||_0x3899('0x6');this[_0x3899('0x7')]=_0x183cd0['serverUrl']||'';this['Configurations']=_0x183cd0[_0x3899('0x8')]||{};}module[_0x3899('0x9')]=ZendeskAccount; \ No newline at end of file +var _0xafa2=['serverUrl','Configurations','name','username','password','token','authType','type','integrationTab'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xafa2,0x185));var _0x2afa=function(_0x208549,_0x2865e8){_0x208549=_0x208549-0x0;var _0x215b87=_0xafa2[_0x208549];return _0x215b87;};'use strict';function ZendeskAccount(_0x488ac6){this['id']=_0x488ac6['id']||0x0;this['name']=_0x488ac6[_0x2afa('0x0')]||'';this[_0x2afa('0x1')]=_0x488ac6[_0x2afa('0x1')]||'';this[_0x2afa('0x2')]=_0x488ac6[_0x2afa('0x2')]||'';this[_0x2afa('0x3')]=_0x488ac6['token']||'';this['remoteUri']=_0x488ac6['remoteUri']||'';this[_0x2afa('0x4')]=_0x488ac6[_0x2afa('0x4')]||'';this[_0x2afa('0x5')]=_0x488ac6['type']||_0x2afa('0x6');this[_0x2afa('0x7')]=_0x488ac6[_0x2afa('0x7')]||'';this[_0x2afa('0x8')]=_0x488ac6[_0x2afa('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 7219d63..a781b94 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 _0x56de=['clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x56de,0x96));var _0xe56d=function(_0x4cbfe5,_0x5409f8){_0x4cbfe5=_0x4cbfe5-0x0;var _0x3ad670=_0x56de[_0x4cbfe5];return _0x3ad670;};'use strict';function ZohoAccount(_0x43a3ab){this['id']=_0x43a3ab['id']||0x0;this[_0xe56d('0x0')]=_0x43a3ab['name']||'';this[_0xe56d('0x1')]=_0x43a3ab[_0xe56d('0x1')]||'';this[_0xe56d('0x2')]=_0x43a3ab[_0xe56d('0x2')]||'';this[_0xe56d('0x3')]=_0x43a3ab[_0xe56d('0x3')]||'';this[_0xe56d('0x4')]=_0x43a3ab[_0xe56d('0x4')]||'';this[_0xe56d('0x5')]=_0x43a3ab[_0xe56d('0x5')]||'';this[_0xe56d('0x6')]=_0x43a3ab[_0xe56d('0x6')]||'';this['code']=_0x43a3ab[_0xe56d('0x7')]||'';this[_0xe56d('0x8')]=_0x43a3ab['refreshToken']||'';this[_0xe56d('0x9')]=_0x43a3ab[_0xe56d('0x9')]||{};}module[_0xe56d('0xa')]=ZohoAccount; \ No newline at end of file +var _0x312f=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x312f,0x1b2));var _0xf312=function(_0x1c1719,_0x5999d5){_0x1c1719=_0x1c1719-0x0;var _0x4e9357=_0x312f[_0x1c1719];return _0x4e9357;};'use strict';function ZohoAccount(_0x48ed12){this['id']=_0x48ed12['id']||0x0;this[_0xf312('0x0')]=_0x48ed12[_0xf312('0x0')]||'';this[_0xf312('0x1')]=_0x48ed12[_0xf312('0x1')]||'';this['host']=_0x48ed12[_0xf312('0x2')]||'';this[_0xf312('0x3')]=_0x48ed12['zone']||'';this[_0xf312('0x4')]=_0x48ed12['clientId']||'';this[_0xf312('0x5')]=_0x48ed12[_0xf312('0x5')]||'';this[_0xf312('0x6')]=_0x48ed12[_0xf312('0x6')]||'';this[_0xf312('0x7')]=_0x48ed12[_0xf312('0x7')]||'';this[_0xf312('0x8')]=_0x48ed12[_0xf312('0x8')]||'';this[_0xf312('0x9')]=_0x48ed12[_0xf312('0x9')]||{};}module[_0xf312('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 8c63272..c722d9b 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 _0xa456=['originatecalleridnum','originatecalleridname','getCaller','format','\x22%s\x22\x20<%s>','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue','type','campaigntype','dialAnswer','membername','name','channelAgent','calleridname','Contact','phone','lastName','active','calleridnum','scheduledat','countcongestionretry','countnoanswerretry','countbusyretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','Agent','VoiceQueueId'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0xa456,0x142));var _0x6a45=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xa456[_0x2f45ea];return _0x485a84;};'use strict';var util=require(_0x6a45('0x0'));var _=require(_0x6a45('0x1'));var moment=require(_0x6a45('0x2'));function checkNameSurname(_0xd5464e,_0x587626,_0x3bfbe6){var _0x206f6b='';if(!_[_0x6a45('0x3')](_0x587626)&&'string'===typeof _0x587626){_0x206f6b+=_0x587626;}if(!_[_0x6a45('0x3')](_0x3bfbe6)&&_0x6a45('0x4')===typeof _0x3bfbe6){_0x206f6b+='\x20'+_0x3bfbe6;}if(_0x206f6b!==''){return _0x206f6b;}return _0xd5464e;}function Action(_0x1e5882,_0x14da6b,_0x4dfbfa,_0x25cf8d,_0x26bfc0){this[_0x6a45('0x5')]=_0x4dfbfa||undefined;this[_0x6a45('0x6')]=_0x1e5882['id'];this[_0x6a45('0x7')]=_0x14da6b['name'];this[_0x6a45('0x8')]=_0x14da6b['type'];this[_0x6a45('0x9')]=_0x6a45('0x7');this[_0x6a45('0xa')]=![];this[_0x6a45('0xb')]=_[_0x6a45('0x3')](_0x1e5882['Agent'])?undefined:_0x1e5882['Agent'][_0x6a45('0xc')];this[_0x6a45('0xd')]=this['membername']?util['format']('SIP/%s',this[_0x6a45('0xb')]):_0x25cf8d||undefined;this[_0x6a45('0xe')]=checkNameSurname(_0x1e5882[_0x6a45('0xf')][_0x6a45('0x10')],_0x1e5882[_0x6a45('0xf')]['firstName'],_0x1e5882['Contact'][_0x6a45('0x11')]);this[_0x6a45('0x12')]=_0x1e5882['active']||![];this[_0x6a45('0x13')]=_0x1e5882[_0x6a45('0x10')];this[_0x6a45('0x14')]=_0x1e5882[_0x6a45('0x14')];this['countbusyretry']=_0x1e5882['countbusyretry']||0x0;this['countcongestionretry']=_0x1e5882[_0x6a45('0x15')]||0x0;this[_0x6a45('0x16')]=_0x1e5882[_0x6a45('0x16')]||0x0;this['countglobal']=(_0x1e5882[_0x6a45('0x17')]||0x0)+(_0x1e5882[_0x6a45('0x15')]||0x0)+(_0x1e5882[_0x6a45('0x16')]||0x0)+(_0x1e5882['countnosuchnumberretry']||0x0)+(_0x1e5882['countdropretry']||0x0)+(_0x1e5882['countabandonedretry']||0x0)+(_0x1e5882[_0x6a45('0x18')]||0x0)+(_0x1e5882[_0x6a45('0x19')]||0x0);this['countnosuchnumberretry']=_0x1e5882[_0x6a45('0x1a')]||0x0;this[_0x6a45('0x1b')]=_0x1e5882['countdropretry']||0x0;this[_0x6a45('0x1c')]=_0x1e5882[_0x6a45('0x1c')]||0x0;this[_0x6a45('0x18')]=_0x1e5882[_0x6a45('0x18')]||0x0;this[_0x6a45('0x19')]=_0x1e5882['countagentrejectretry']||0x0;this['callback']=_0x1e5882[_0x6a45('0x1d')];this[_0x6a45('0x1e')]=_0x1e5882[_0x6a45('0x1e')];this[_0x6a45('0x1f')]=_0x1e5882[_0x6a45('0x1f')];this[_0x6a45('0x20')]=_0x1e5882[_0x6a45('0x20')];this[_0x6a45('0x21')]=_0x1e5882[_0x6a45('0x21')];this[_0x6a45('0x22')]=_0x1e5882[_0x6a45('0x22')];this[_0x6a45('0x23')]=_['isNil'](_0x1e5882[_0x6a45('0x24')])?_0x1e5882['UserId']:_0x1e5882[_0x6a45('0x24')]['id'];this[_0x6a45('0x25')]=_0x1e5882[_0x6a45('0x25')];this[_0x6a45('0x26')]='';this[_0x6a45('0x27')]='';}Action['prototype'][_0x6a45('0x28')]=function(){return util[_0x6a45('0x29')](_0x6a45('0x2a'),this[_0x6a45('0xe')],this[_0x6a45('0x2b')]);};module[_0x6a45('0x2c')]=Action; \ No newline at end of file +var _0xc2c7=['countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','exports','lodash','moment','isNil','string','idContact','queue','name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x37dc1e,_0x220775){var _0x1961bc=function(_0x264a9f){while(--_0x264a9f){_0x37dc1e['push'](_0x37dc1e['shift']());}};_0x1961bc(++_0x220775);}(_0xc2c7,0x134));var _0x7c2c=function(_0x284997,_0x487ec8){_0x284997=_0x284997-0x0;var _0x2b1bd1=_0xc2c7[_0x284997];return _0x2b1bd1;};'use strict';var util=require('util');var _=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));function checkNameSurname(_0xdb8a29,_0x330870,_0x380d13){var _0x237e4d='';if(!_[_0x7c2c('0x2')](_0x330870)&&_0x7c2c('0x3')===typeof _0x330870){_0x237e4d+=_0x330870;}if(!_['isNil'](_0x380d13)&&'string'===typeof _0x380d13){_0x237e4d+='\x20'+_0x380d13;}if(_0x237e4d!==''){return _0x237e4d;}return _0xdb8a29;}function Action(_0x31dc4e,_0x42ecc9,_0x23c038,_0x54f027,_0x4abe93){this['uniqueid']=_0x23c038||undefined;this[_0x7c2c('0x4')]=_0x31dc4e['id'];this[_0x7c2c('0x5')]=_0x42ecc9[_0x7c2c('0x6')];this[_0x7c2c('0x7')]=_0x42ecc9[_0x7c2c('0x7')];this['campaigntype']=_0x7c2c('0x5');this[_0x7c2c('0x8')]=![];this[_0x7c2c('0x9')]=_[_0x7c2c('0x2')](_0x31dc4e[_0x7c2c('0xa')])?undefined:_0x31dc4e[_0x7c2c('0xa')][_0x7c2c('0x6')];this[_0x7c2c('0xb')]=this[_0x7c2c('0x9')]?util[_0x7c2c('0xc')](_0x7c2c('0xd'),this[_0x7c2c('0x9')]):_0x54f027||undefined;this[_0x7c2c('0xe')]=checkNameSurname(_0x31dc4e[_0x7c2c('0xf')][_0x7c2c('0x10')],_0x31dc4e[_0x7c2c('0xf')]['firstName'],_0x31dc4e['Contact'][_0x7c2c('0x11')]);this[_0x7c2c('0x12')]=_0x31dc4e[_0x7c2c('0x12')]||![];this['calleridnum']=_0x31dc4e[_0x7c2c('0x10')];this[_0x7c2c('0x13')]=_0x31dc4e['scheduledat'];this[_0x7c2c('0x14')]=_0x31dc4e['countbusyretry']||0x0;this[_0x7c2c('0x15')]=_0x31dc4e['countcongestionretry']||0x0;this[_0x7c2c('0x16')]=_0x31dc4e[_0x7c2c('0x16')]||0x0;this[_0x7c2c('0x17')]=(_0x31dc4e[_0x7c2c('0x14')]||0x0)+(_0x31dc4e[_0x7c2c('0x15')]||0x0)+(_0x31dc4e[_0x7c2c('0x16')]||0x0)+(_0x31dc4e[_0x7c2c('0x18')]||0x0)+(_0x31dc4e[_0x7c2c('0x19')]||0x0)+(_0x31dc4e[_0x7c2c('0x1a')]||0x0)+(_0x31dc4e[_0x7c2c('0x1b')]||0x0)+(_0x31dc4e[_0x7c2c('0x1c')]||0x0);this[_0x7c2c('0x18')]=_0x31dc4e['countnosuchnumberretry']||0x0;this[_0x7c2c('0x19')]=_0x31dc4e['countdropretry']||0x0;this['countabandonedretry']=_0x31dc4e[_0x7c2c('0x1a')]||0x0;this[_0x7c2c('0x1b')]=_0x31dc4e[_0x7c2c('0x1b')]||0x0;this[_0x7c2c('0x1c')]=_0x31dc4e[_0x7c2c('0x1c')]||0x0;this[_0x7c2c('0x1d')]=_0x31dc4e[_0x7c2c('0x1d')];this['callbackuniqueid']=_0x31dc4e[_0x7c2c('0x1e')];this['callbackat']=_0x31dc4e[_0x7c2c('0x1f')];this['recallme']=_0x31dc4e[_0x7c2c('0x20')];this[_0x7c2c('0x21')]=_0x31dc4e[_0x7c2c('0x21')];this['ListId']=_0x31dc4e['ListId'];this[_0x7c2c('0x22')]=_[_0x7c2c('0x2')](_0x31dc4e[_0x7c2c('0xa')])?_0x31dc4e[_0x7c2c('0x22')]:_0x31dc4e[_0x7c2c('0xa')]['id'];this[_0x7c2c('0x23')]=_0x31dc4e[_0x7c2c('0x23')];this['originatecalleridnum']='';this[_0x7c2c('0x24')]='';}Action[_0x7c2c('0x25')][_0x7c2c('0x26')]=function(){return util[_0x7c2c('0xc')](_0x7c2c('0x27'),this[_0x7c2c('0xe')],this[_0x7c2c('0x28')]);};module[_0x7c2c('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index abefc29..eaf5daf 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x347516,_0x4bab72){var _0x11f26a=function(_0x2097ce){while(--_0x2097ce){_0x347516['push'](_0x347516['shift']());}};_0x11f26a(++_0x4bab72);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x246ea7,_0x65e50b){var _0x2b0b68=function(_0x283ba2){while(--_0x283ba2){_0x246ea7['push'](_0x246ea7['shift']());}};_0x2b0b68(++_0x65e50b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 6722fed..44b5256 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 _0x22bb=['queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','createHistory','resolve','then','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x3f88bc,_0xe38cf5){var _0x4df1c4=function(_0x111de1){while(--_0x111de1){_0x3f88bc['push'](_0x3f88bc['shift']());}};_0x4df1c4(++_0xe38cf5);}(_0x22bb,0xb7));var _0xb22b=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x22bb[_0x3511d3];return _0x5d6321;};'use strict';var util=require(_0xb22b('0x0'));var BPromise=require(_0xb22b('0x1'));var logger=require(_0xb22b('0x2'))(_0xb22b('0x3'));var cmHopper=require(_0xb22b('0x4'));var cmHopperHistory=require(_0xb22b('0x5'));var cmHopperBlack=require(_0xb22b('0x6'));var agentReportPreview=require(_0xb22b('0x7'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x54d11e){return function(_0x2b6e5d){logger[_0xb22b('0x8')](_0x54d11e,util[_0xb22b('0x9')](_0x2b6e5d,{'showHidden':![],'depth':null}));};}function create(_0x3ab4fb){return cmHopperHistory[_0xb22b('0xa')](_0x3ab4fb)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x487e70){return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](agentReportPreview[_0xb22b('0xa')](_0x487e70))[_0xb22b('0xd')](loggerCatch(_0xb22b('0xe')));}function moveContact(_0x423875){return cmHopper['moveContactManagedDialer'](_0x423875,!![])[_0xb22b('0xd')](loggerCatch(_0xb22b('0xf')));}exports['checkIsBlackList']=function(_0x362e18){return cmHopperBlack[_0xb22b('0x10')](_0x362e18)[_0xb22b('0xd')](loggerCatch(_0xb22b('0x11')));};exports[_0xb22b('0x12')]=function(_0x1485f){return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](cmHopper[_0xb22b('0x12')](_0x1485f))[_0xb22b('0xd')](loggerCatch(_0xb22b('0x13')));};exports[_0xb22b('0xa')]=function(_0x23e2cb,_0xf326e6){create(_0x23e2cb)[_0xb22b('0xd')](loggerCatch(_0xf326e6));moveContact(_0x23e2cb)[_0xb22b('0xd')](loggerCatch(_0xf326e6));};exports[_0xb22b('0x14')]=function(_0x3d2f34,_0x35eaec){createAgent(_0x3d2f34)[_0xb22b('0xd')](loggerCatch(_0x35eaec));};exports[_0xb22b('0x15')]=function(_0x1e3488,_0x59c0db){create(_0x1e3488)[_0xb22b('0xd')](loggerCatch(_0x59c0db));};exports[_0xb22b('0x16')]=function(_0x15f214,_0x4ebc6c){moveContact(_0x15f214)[_0xb22b('0xd')](loggerCatch(_0x4ebc6c));};exports[_0xb22b('0x17')]=function(_0x1647b0,_0x26eac1,_0xda0571){if(_0x26eac1){_0x1647b0[_0xb22b('0x18')]=null;}if(_0xda0571){_0x1647b0[_0xb22b('0x19')]=![];}return cmHopper[_0xb22b('0x17')](_0x1647b0)[_0xb22b('0xd')](loggerCatch(_0xb22b('0x1a')));};exports[_0xb22b('0x1b')]=function(_0x2f6ea3){return cmHopper[_0xb22b('0x1b')](_0x2f6ea3)[_0xb22b('0xd')](loggerCatch(_0xb22b('0x1c')));};exports[_0xb22b('0x1d')]=function(_0x24798b){return cmHopper[_0xb22b('0x1d')]({'UserId':null},_0x24798b,0x1)['catch'](loggerCatch(_0xb22b('0x1e')));};exports['disableContact']=function(_0x242e7e){return cmHopper[_0xb22b('0x1d')]({'active':![]},_0x242e7e,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xb22b('0x1f')]=function(_0x1f8e3b){var _0x20f006={};_0x20f006[_0xb22b('0x20')]=_0x1f8e3b[_0xb22b('0x20')];_0x20f006[_0xb22b('0x21')]=_0x1f8e3b[_0xb22b('0x21')];_0x20f006[_0xb22b('0x22')]=_0x1f8e3b[_0xb22b('0x22')];_0x20f006[_0xb22b('0x23')]=_0x1f8e3b[_0xb22b('0x23')];_0x20f006[_0xb22b('0x24')]=_0x1f8e3b[_0xb22b('0x24')];_0x20f006[_0xb22b('0x25')]=_0x1f8e3b[_0xb22b('0x26')];_0x20f006[_0xb22b('0x27')]=_0x1f8e3b[_0xb22b('0x26')];_0x20f006['queuecallercomplete']=0x1;_0x20f006['queuecallercompleteAt']=_0x1f8e3b[_0xb22b('0x28')];_0x20f006[_0xb22b('0x29')]=_0x1f8e3b[_0xb22b('0x2a')];_0x20f006['context']='from-sip';_0x20f006[_0xb22b('0x2b')]='xcally-motion-preview';_0x20f006[_0xb22b('0x2c')]=0x0;_0x20f006[_0xb22b('0x2d')]=0x1;_0x20f006[_0xb22b('0x2e')]=_0x1f8e3b[_0xb22b('0x2a')];_0x20f006[_0xb22b('0x2f')]=_0xb22b('0x30');return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](voiceQueueReport[_0xb22b('0x31')](_0x20f006))[_0xb22b('0xd')](loggerCatch(_0xb22b('0x32')));};exports[_0xb22b('0x33')]=function(_0x575582,_0x154973){return BPromise[_0xb22b('0xb')]()[_0xb22b('0xc')](cmHopper[_0xb22b('0x33')](_0x575582,_0x154973))[_0xb22b('0xd')](loggerCatch(_0xb22b('0x34')));};exports[_0xb22b('0x35')]=function(_0x298d23){return cmHopper[_0xb22b('0x17')](_0x298d23,!![],!![])['catch'](loggerCatch(_0xb22b('0x36')));}; \ No newline at end of file +var _0xd28d=['holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xd28d,0x1ca));var _0xdd28=function(_0x55632d,_0x3a90e2){_0x55632d=_0x55632d-0x0;var _0x554c83=_0xd28d[_0x55632d];return _0x554c83;};'use strict';var util=require(_0xdd28('0x0'));var BPromise=require(_0xdd28('0x1'));var logger=require('../../../config/logger')(_0xdd28('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xdd28('0x3'));var cmHopperBlack=require(_0xdd28('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xdd28('0x5'));function loggerCatch(_0x4354e0){return function(_0x2eec31){logger[_0xdd28('0x6')](_0x4354e0,util[_0xdd28('0x7')](_0x2eec31,{'showHidden':![],'depth':null}));};}function create(_0x240321){return cmHopperHistory[_0xdd28('0x8')](_0x240321)[_0xdd28('0x9')](loggerCatch(_0xdd28('0xa')));}function createAgent(_0x34d1c3){return BPromise[_0xdd28('0xb')]()[_0xdd28('0xc')](agentReportPreview[_0xdd28('0x8')](_0x34d1c3))['catch'](loggerCatch(_0xdd28('0xa')));}function moveContact(_0x3705da){return cmHopper[_0xdd28('0xd')](_0x3705da,!![])[_0xdd28('0x9')](loggerCatch(_0xdd28('0xe')));}exports[_0xdd28('0xf')]=function(_0x188d2c){return cmHopperBlack[_0xdd28('0xf')](_0x188d2c)['catch'](loggerCatch(_0xdd28('0x10')));};exports['getContactPreview']=function(_0x438b3d){return BPromise[_0xdd28('0xb')]()[_0xdd28('0xc')](cmHopper['getContactPreview'](_0x438b3d))[_0xdd28('0x9')](loggerCatch(_0xdd28('0x11')));};exports['createHistory']=function(_0xde63e8,_0x18254b){create(_0xde63e8)[_0xdd28('0x9')](loggerCatch(_0x18254b));moveContact(_0xde63e8)[_0xdd28('0x9')](loggerCatch(_0x18254b));};exports[_0xdd28('0x12')]=function(_0x1cea92,_0x340af1){createAgent(_0x1cea92)[_0xdd28('0x9')](loggerCatch(_0x340af1));};exports[_0xdd28('0x13')]=function(_0x29fb74,_0x441089){create(_0x29fb74)[_0xdd28('0x9')](loggerCatch(_0x441089));};exports[_0xdd28('0x14')]=function(_0x433635,_0x221179){moveContact(_0x433635)['catch'](loggerCatch(_0x221179));};exports[_0xdd28('0x15')]=function(_0x2693c5,_0x31feed,_0x193125){if(_0x31feed){_0x2693c5[_0xdd28('0x16')]=null;}if(_0x193125){_0x2693c5[_0xdd28('0x17')]=![];}return cmHopper[_0xdd28('0x15')](_0x2693c5)[_0xdd28('0x9')](loggerCatch(_0xdd28('0x18')));};exports[_0xdd28('0x19')]=function(_0x1ca3ec){return cmHopper[_0xdd28('0x19')](_0x1ca3ec)[_0xdd28('0x9')](loggerCatch(_0xdd28('0x1a')));};exports[_0xdd28('0x1b')]=function(_0x5cf3c2){return cmHopper['unlockContact']({'UserId':null},_0x5cf3c2,0x1)[_0xdd28('0x9')](loggerCatch(_0xdd28('0x1c')));};exports['disableContact']=function(_0x611abd){return cmHopper['unlockContact']({'active':![]},_0x611abd,0x1)[_0xdd28('0x9')](loggerCatch(_0xdd28('0x1d')));};exports[_0xdd28('0x1e')]=function(_0x3e892a){var _0x526fa8={};_0x526fa8[_0xdd28('0x1f')]=_0x3e892a[_0xdd28('0x1f')];_0x526fa8[_0xdd28('0x20')]=_0x3e892a[_0xdd28('0x20')];_0x526fa8[_0xdd28('0x21')]=_0x3e892a[_0xdd28('0x21')];_0x526fa8[_0xdd28('0x22')]=_0x3e892a[_0xdd28('0x22')];_0x526fa8['queue']=_0x3e892a[_0xdd28('0x23')];_0x526fa8[_0xdd28('0x24')]=_0x3e892a['answertime'];_0x526fa8['queuecallerleaveAt']=_0x3e892a['answertime'];_0x526fa8[_0xdd28('0x25')]=0x1;_0x526fa8[_0xdd28('0x26')]=_0x3e892a[_0xdd28('0x27')];_0x526fa8[_0xdd28('0x28')]=_0x3e892a[_0xdd28('0x29')];_0x526fa8[_0xdd28('0x2a')]=_0xdd28('0x2b');_0x526fa8[_0xdd28('0x2c')]=_0xdd28('0x2d');_0x526fa8[_0xdd28('0x2e')]=0x0;_0x526fa8['assigned']=0x1;_0x526fa8[_0xdd28('0x2f')]=_0x3e892a[_0xdd28('0x29')];_0x526fa8[_0xdd28('0x30')]=_0xdd28('0x31');return BPromise[_0xdd28('0xb')]()[_0xdd28('0xc')](voiceQueueReport[_0xdd28('0x32')](_0x526fa8))[_0xdd28('0x9')](loggerCatch(_0xdd28('0x33')));};exports[_0xdd28('0x34')]=function(_0x3d0461,_0x559990){return BPromise[_0xdd28('0xb')]()[_0xdd28('0xc')](cmHopper[_0xdd28('0x34')](_0x3d0461,_0x559990))[_0xdd28('0x9')](loggerCatch(_0xdd28('0x35')));};exports[_0xdd28('0x36')]=function(_0xdc4e6d){return cmHopper['rescheduleContact'](_0xdc4e6d,!![],!![])[_0xdd28('0x9')](loggerCatch(_0xdd28('0x37')));}; \ 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 9f99279..2668c9b 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 _0xccd5=['status','reachable','push','getDiff','milliseconds','diff','seconds','createBody','type','campaigntype','dialAnswer','countcongestionretry','countglobal','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialchannel','xmd-contactid','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','keys','forEach','toLowerCase','variables','buildNoAnswerEventPayload','util','moment','../../../../config/logger','preview','env','127.0.0.1','../../dialer/utils','logger','info','inspect','error','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','dialer','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','statedesc','Blacklist','starttime','responsetime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','logLookAgent','membername','UserId','state','endtime','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','timeout','totalGlobal','countnoanswerretry','countnosuchnumberretry','cloneAction','Global','scheduledAt','active','scheduledat','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','agentReadyId','not_inuse'];(function(_0xe2756c,_0x584379){var _0x2f7db3=function(_0x43125e){while(--_0x43125e){_0xe2756c['push'](_0xe2756c['shift']());}};_0x2f7db3(++_0x584379);}(_0xccd5,0xbe));var _0x5ccd=function(_0x458928,_0x18abb0){_0x458928=_0x458928-0x0;var _0x2d584f=_0xccd5[_0x458928];return _0x2d584f;};'use strict';var util=require(_0x5ccd('0x0'));var _=require('lodash');var moment=require(_0x5ccd('0x1'));var logger=require(_0x5ccd('0x2'))(_0x5ccd('0x3'));var ipAgi=process[_0x5ccd('0x4')]['XCALLY_IP_AGI']||_0x5ccd('0x5');var utils=require(_0x5ccd('0x6'));exports['loggerCatch']=function(_0x25fefd){return function(_0x3bce76){logger['error'](_0x25fefd,util['inspect'](_0x3bce76,{'showHidden':![],'depth':null}));};};exports[_0x5ccd('0x7')]=function(_0x355ee0,_0x41e183){logger[_0x5ccd('0x8')](_0x355ee0,util[_0x5ccd('0x9')](_0x41e183,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x587685,_0x2325b1){logger[_0x5ccd('0xa')](_0x587685,util[_0x5ccd('0x9')](_0x2325b1,{'showHidden':![],'depth':null}));};exports[_0x5ccd('0xb')]=function(_0x394ca9){return function(_0x2f25c6){logger[_0x5ccd('0x8')](_0x394ca9,util[_0x5ccd('0x9')](_0x2f25c6,{'showHidden':![],'depth':null}));};};exports[_0x5ccd('0xc')]=function(_0x54e6e1,_0xf2625a,_0x25c62f){return{'message':_0x54e6e1,'unlock':_0xf2625a,'active':_0x25c62f};};exports[_0x5ccd('0xd')]=function(_0x427dbf,_0x639b9e,_0x1ba01f){if(!_[_0x5ccd('0xe')](_0x1ba01f)&&_0x5ccd('0xf')===typeof _0x1ba01f&&!_[_0x5ccd('0x10')](_0x1ba01f)){if(!_[_0x5ccd('0xe')](_0x639b9e)&&_0x5ccd('0xf')===typeof _0x639b9e&&!_['isEmpty'](_0x639b9e)){return util[_0x5ccd('0x11')](_0x5ccd('0x12'),_0x639b9e,_0x1ba01f);}return util[_0x5ccd('0x11')]('\x22%s\x22\x20<%s>',_0x1ba01f,_0x1ba01f);}if(!_['isUndefined'](_0x427dbf)&&_0x5ccd('0xf')===typeof _0x427dbf&&!_[_0x5ccd('0x10')](_0x427dbf)){return _0x427dbf;}return _0x5ccd('0x13');};exports[_0x5ccd('0x14')]=function(_0x254586){if(_['isNil'](_0x254586)){return![];}return _0x254586;};exports[_0x5ccd('0x15')]=function(_0x32c103,_0x4a25d7,_0x2396dc,_0x3bd7aa,_0x435066,_0xf10169){var _0xe0600c={'XMD-QUEUE':_0x4a25d7[_0x5ccd('0x16')]?_0x4a25d7['Queue'][_0x5ccd('0x17')]:'','XMD-CALLERID':_0x3bd7aa,'XMD-CALLERID-PREVIEW':_0xf10169?util[_0x5ccd('0x11')](_0x5ccd('0x12'),_0xf10169[_0x5ccd('0x18')],_0xf10169[_0x5ccd('0x19')]):_0x3bd7aa,'XMD-DIALID':_0x435066,'XMD-CONTACTID':_0x4a25d7['ContactId'],'XMD-CDRTYPE':_0x5ccd('0x1a'),'CALLERID(all)':_0x3bd7aa,'XMD-VOICEQUEUEID':_0x4a25d7[_0x5ccd('0x1b')],'XMD-DIALCHANNEL':_0x2396dc,'XMD-DIALTIMEOUT':_0x32c103['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0x5ccd('0x1c'),_0x32c103[_0x5ccd('0x1d')]?'g':'',_[_0x5ccd('0x10')](_0x32c103[_0x5ccd('0x1e')])?'':_0x5ccd('0x1f')),'XMD-DIALURL':_0x32c103['dialPreviewUrl']||'','XMD-AGI':_0x32c103['dialQueueProject']?util[_0x5ccd('0x11')](_0x5ccd('0x20'),ipAgi,_0x32c103[_0x5ccd('0x21')]):_0x5ccd('0x22'),'XMD-AGIAFTER':_0x32c103['dialQueueProject2']?util[_0x5ccd('0x11')](_0x5ccd('0x20'),ipAgi,_0x32c103[_0x5ccd('0x1d')]):_0x5ccd('0x22'),'XMD-ORIGINATECALLERIDNUM':_0xf10169?_0xf10169[_0x5ccd('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xf10169?_0xf10169[_0x5ccd('0x24')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x5ccd('0x25')};if(!_['isEmpty'](_0x32c103[_0x5ccd('0x1e')])){_0xe0600c[util[_0x5ccd('0x11')]('%s',_0x5ccd('0x26'))]=_0x32c103['monitor_format'];_0xe0600c[util['format']('%s',_0x5ccd('0x27'))]=_0x435066;}return _0xe0600c;};exports[_0x5ccd('0x28')]=function(_0x570226){var _0x1874c2={};for(var _0x1e3cdc in _0x570226){if(_0x570226[_0x5ccd('0x29')](_0x1e3cdc)){_0x1874c2[util[_0x5ccd('0x11')]('%s',_[_0x5ccd('0x2a')](_0x1e3cdc))]=_0x570226[_0x1e3cdc];}}return{'variables':_0x1874c2};};exports[_0x5ccd('0x2b')]=function(_0x2d2fde,_0x1eaf61){if(!_[_0x5ccd('0x2c')](_0x2d2fde)){if(_0x2d2fde['hasOwnProperty'](_0x5ccd('0x2d'))){if(_0x2d2fde[_0x5ccd('0x2d')]>0x0){_0x2d2fde[_0x5ccd('0x2d')]-=0x1;}else{logger[_0x5ccd('0xa')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1eaf61);}}}else{logger[_0x5ccd('0xa')](_0x5ccd('0x2e'),_0x1eaf61);}};exports[_0x5ccd('0x2f')]=function(_0x388a7e){var _0x121e68=moment()[_0x5ccd('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x388a7e['state']=0xd;_0x388a7e[_0x5ccd('0x30')]=_0x5ccd('0x31');_0x388a7e[_0x5ccd('0x32')]=_0x121e68;_0x388a7e[_0x5ccd('0x33')]=_0x121e68;_0x388a7e['endtime']=_0x121e68;};exports[_0x5ccd('0x34')]=function(_0x422844,_0x3db979,_0x1ffb5a){var _0x215e8d=moment()['format'](_0x5ccd('0x35'));_0x422844['state']=_0x3db979;_0x422844[_0x5ccd('0x30')]=_0x1ffb5a;_0x422844[_0x5ccd('0x33')]=_0x215e8d;_0x422844[_0x5ccd('0x36')]=utils[_0x5ccd('0x37')](_0x422844['responsetime'],_0x422844['starttime']);};exports[_0x5ccd('0x38')]=function(_0xb5743c,_0x10c7ac,_0x911426){_0xb5743c[_0x5ccd('0x39')]=_0x10c7ac;_0xb5743c[_0x5ccd('0x3a')]=_0x911426;};exports['logCustomer']=function(_0x743311,_0x25f463,_0x47d77d){var _0x862ee6=moment()[_0x5ccd('0x11')](_0x5ccd('0x35'));_0x743311[_0x5ccd('0x3b')]=_0x25f463;_0x743311['statedesc']=_0x47d77d;_0x743311[_0x5ccd('0x33')]=_0x743311[_0x5ccd('0x33')]?_0x743311[_0x5ccd('0x33')]:_0x862ee6;_0x743311[_0x5ccd('0x3c')]=_0x743311[_0x5ccd('0x3c')]?_0x743311['endtime']:_0x862ee6;_0x743311['ringtime']=utils[_0x5ccd('0x37')](_0x743311[_0x5ccd('0x33')]||0x0,_0x743311[_0x5ccd('0x32')]||0x0);_0x743311[_0x5ccd('0x3d')]=_0x743311[_0x5ccd('0x3e')]?utils[_0x5ccd('0x37')](_0x743311[_0x5ccd('0x3c')],_0x743311[_0x5ccd('0x3e')]):0x0;};exports[_0x5ccd('0x3f')]=function(_0x2b9595){return _0x2b9595===_0x5ccd('0x40');};exports[_0x5ccd('0x41')]=function(_0x11b623,_0x27d40c,_0x3e09f8,_0x5333b1,_0x46ea6b){var _0x38df9c=_0x5333b1?_0x5ccd('0x42'):_0x11b623[_0x5ccd('0x18')];_0x38df9c=_0x46ea6b?_0x5ccd('0x43'):_0x38df9c;return{'actionid':_0x11b623[_0x5ccd('0x44')],'action':_0x5ccd('0x45'),'channel':_0x11b623[_0x5ccd('0x46')],'callerid':util[_0x5ccd('0x11')](_0x5ccd('0x12'),_0x38df9c,_0x11b623[_0x5ccd('0x19')]),'Exten':_0x5ccd('0x47'),'Context':'from-sip','Priority':'1','variable':_0x3e09f8,'timeout':(_0x27d40c[_0x5ccd('0x48')]||0x1e)*0x3e8,'async':!![],'channelid':_0x11b623['uniqueid']};};exports[_0x5ccd('0x49')]=function(_0x10aab5){return _0x10aab5['countbusyretry']+_0x10aab5['countcongestionretry']+_0x10aab5[_0x5ccd('0x4a')]+_0x10aab5['countagentrejectretry']+_0x10aab5[_0x5ccd('0x4b')];};exports[_0x5ccd('0x4c')]=function(_0x35301c){var _0x4be2bf=_['clone'](_0x35301c);_0x4be2bf[_0x5ccd('0x3b')]=0xf;_0x4be2bf[_0x5ccd('0x30')]=_0x5ccd('0x4d');return _0x4be2bf;};exports[_0x5ccd('0x4e')]=function(_0x1beaf8,_0x569153,_0x1cfd08){var _0x43eff0={};_0x43eff0[_0x569153]=_0x1beaf8[_0x569153];_0x43eff0[_0x5ccd('0x4f')]=![];_0x43eff0[_0x5ccd('0x50')]=moment()['add'](_0x1cfd08,_0x5ccd('0x51'))[_0x5ccd('0x11')](_0x5ccd('0x35'));_0x43eff0[_0x5ccd('0x52')]=_0x1beaf8[_0x5ccd('0x52')];_0x43eff0['ListId']=_0x1beaf8[_0x5ccd('0x53')];_0x43eff0[_0x5ccd('0x1b')]=_0x1beaf8[_0x5ccd('0x1b')]||undefined;return _0x43eff0;};exports[_0x5ccd('0x54')]=function(_0x4af79f,_0x39fb12){if(!_['isNil'](_0x4af79f)){if(_0x4af79f[_0x5ccd('0x55')]>0x0){_0x4af79f[_0x5ccd('0x55')]-=0x1;}else{logger[_0x5ccd('0xa')](_0x39fb12,_0x5ccd('0x56'));}}else{logger[_0x5ccd('0xa')](_0x39fb12,_0x5ccd('0x57'));}};exports[_0x5ccd('0x58')]=function(_0x2da3f7){if(_0x2da3f7<=0x0){return!![];}return![];};function buildObj(_0x35797c,_0x33ee4e,_0x33505c){_0x35797c[_0x5ccd('0x59')]=_0x33ee4e;_0x35797c[_0x5ccd('0x17')]=_0x35797c[_0x5ccd('0x5a')];_0x35797c[_0x5ccd('0x5b')]=_0x35797c['channelAgent'];_0x35797c[_0x5ccd('0x5c')]=_0x5ccd('0x5d');if(_0x33505c){_0x35797c['mandatoryDisposition']=_0x33505c['mandatoryDisposition'];}return _0x35797c;}exports['buildObj']=buildObj;exports[_0x5ccd('0x5e')]=function(_0x44043f){var _0x52e55a=[];for(var _0x4e8875 in _0x44043f){if(_0x44043f['hasOwnProperty'](_0x4e8875)){if(!_['isNil'](_0x44043f[_0x4e8875])&&_0x44043f[_0x4e8875][_0x5ccd('0x3b')]===_0x5ccd('0x5f')&&_0x44043f[_0x4e8875][_0x5ccd('0x60')]===_0x5ccd('0x61')){_0x52e55a[_0x5ccd('0x62')](_0x44043f[_0x4e8875]['id']);}}}return _0x52e55a;};exports[_0x5ccd('0x63')]=function(_0x3cf47c){var _0x1e28a5=moment()[_0x5ccd('0x64')](0x0);var _0x2023f5=moment(_0x3cf47c)[_0x5ccd('0x64')](0x0);return _0x1e28a5[_0x5ccd('0x65')](_0x2023f5,_0x5ccd('0x66'));};exports[_0x5ccd('0x67')]=function(_0x439071){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x439071['ContactId'],'ListId':_0x439071[_0x5ccd('0x53')],'VoiceQueueId':_0x439071[_0x5ccd('0x1b')]||undefined,'CampaignId':_0x439071['CampaignId']||undefined};};exports['filterKey']=function(_0x3096cf){if(_0x3096cf==='uniqueid'||_0x3096cf==='idContact'||_0x3096cf===_0x5ccd('0x5a')||_0x3096cf===_0x5ccd('0x68')||_0x3096cf===_0x5ccd('0x69')||_0x3096cf===_0x5ccd('0x6a')||_0x3096cf===_0x5ccd('0x39')||_0x3096cf===_0x5ccd('0x46')||_0x3096cf==='calleridname'||_0x3096cf===_0x5ccd('0x4f')||_0x3096cf==='calleridnum'||_0x3096cf===_0x5ccd('0x50')||_0x3096cf==='countbusyretry'||_0x3096cf===_0x5ccd('0x6b')||_0x3096cf===_0x5ccd('0x4a')||_0x3096cf===_0x5ccd('0x6c')||_0x3096cf===_0x5ccd('0x6d')||_0x3096cf===_0x5ccd('0x6e')||_0x3096cf==='callbackat'||_0x3096cf===_0x5ccd('0x6f')||_0x3096cf==='ContactId'||_0x3096cf===_0x5ccd('0x53')||_0x3096cf===_0x5ccd('0x3a')||_0x3096cf===_0x5ccd('0x1b')||_0x3096cf===_0x5ccd('0x70')||_0x3096cf===_0x5ccd('0x71')||_0x3096cf==='xmd-queue'||_0x3096cf===_0x5ccd('0x72')||_0x3096cf===_0x5ccd('0x73')||_0x3096cf===_0x5ccd('0x74')||_0x3096cf==='xmd-dialtimeout'||_0x3096cf===_0x5ccd('0x75')||_0x3096cf==='xmd-dialid'||_0x3096cf===_0x5ccd('0x76')||_0x3096cf===_0x5ccd('0x77')||_0x3096cf==='xmd-cdrtype'||_0x3096cf===_0x5ccd('0x78')||_0x3096cf===_0x5ccd('0x79')||_0x3096cf===_0x5ccd('0x7a')||_0x3096cf===_0x5ccd('0x7b')||_0x3096cf===_0x5ccd('0x7c')||_0x3096cf===_0x5ccd('0x7d')||_0x3096cf==='rtpaudioqosjitterbridged'||_0x3096cf==='rtpaudioqosloss'||_0x3096cf===_0x5ccd('0x7e')||_0x3096cf===_0x5ccd('0x7f')||_0x3096cf===_0x5ccd('0x80')||_0x3096cf===_0x5ccd('0x7b')||_0x3096cf==='rtpaudioqosbridged'||_0x3096cf===_0x5ccd('0x7d')||_0x3096cf==='rtpaudioqosjitterbridged'||_0x3096cf===_0x5ccd('0x81')||_0x3096cf==='rtpaudioqoslossbridged'||_0x3096cf===_0x5ccd('0x7f')||_0x3096cf===_0x5ccd('0x80')||_0x3096cf===_0x5ccd('0x82')||_0x3096cf==='bridgepvtcallid'||_0x3096cf==='state'||_0x3096cf===_0x5ccd('0x30')){return![];}return!![];};exports[_0x5ccd('0x83')]=function(_0xd04f70,_0x2a26af){var _0x56f59e,_0x452a1b,_0xa2c628;if(_0x2a26af<=0x0){_0x2a26af=0x1;}_0x56f59e=new RegExp(_0x5ccd('0x84')+_0x2a26af+'}$');_0x452a1b=Math[_0x5ccd('0x85')](0xa,_0x2a26af-0x1);_0xa2c628=Math['pow'](0xa,_0x2a26af)-0x1;return util[_0x5ccd('0x11')]('%s',_['replace'](_0xd04f70,_0x56f59e,_[_0x5ccd('0x86')](_0x452a1b,_0xa2c628)));};exports[_0x5ccd('0x87')]=function(_0x2d7e4b){var _0x3e661d=_0x2d7e4b[_0x5ccd('0x88')](/"(.*?)"/);return _0x3e661d?_0x3e661d[0x1]:_0x2d7e4b;};exports[_0x5ccd('0x89')]=function(_0x422f44){var _0xcd3cf5=_0x422f44['match'](/<(.*?)>/);return _0xcd3cf5?_0xcd3cf5[0x1]:_0x422f44;};function buildNoAnswerEventPayload(_0x4391ff,_0x589d7a){var _0x3dac10=buildObj(_0x4391ff,'noanswer');if(!_[_0x5ccd('0x10')](_0x589d7a['variables'])){Object[_0x5ccd('0x8a')](_0x589d7a['variables'])[_0x5ccd('0x8b')](function(_0x316971){_0x3dac10[_0x316971[_0x5ccd('0x8c')]()]=_0x589d7a[_0x5ccd('0x8d')][_0x316971];});}return _0x3dac10;}exports[_0x5ccd('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xfdb0=['\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','starttime','responsetime','endtime','logAgent','ringtime','logLookAgent','UserId','logCustomer','getSeconds','talktime','answertime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','clone','Global','scheduledAt','active','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','not_inuse','status','reachable','push','getDiff','milliseconds','diff','CampaignId','filterKey','idContact','type','campaigntype','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialchannel','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','noanswer','variables','keys','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','inspect','info','loggerError','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>'];(function(_0x516a6d,_0x3956f1){var _0x24c436=function(_0xf77eaf){while(--_0xf77eaf){_0x516a6d['push'](_0x516a6d['shift']());}};_0x24c436(++_0x3956f1);}(_0xfdb0,0x102));var _0x0fdb=function(_0x3bf346,_0x258c12){_0x3bf346=_0x3bf346-0x0;var _0x312576=_0xfdb0[_0x3bf346];return _0x312576;};'use strict';var util=require(_0x0fdb('0x0'));var _=require(_0x0fdb('0x1'));var moment=require('moment');var logger=require(_0x0fdb('0x2'))(_0x0fdb('0x3'));var ipAgi=process[_0x0fdb('0x4')][_0x0fdb('0x5')]||_0x0fdb('0x6');var utils=require('../../dialer/utils');exports[_0x0fdb('0x7')]=function(_0x19ea36){return function(_0x401adc){logger[_0x0fdb('0x8')](_0x19ea36,util[_0x0fdb('0x9')](_0x401adc,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x4b7474,_0x342534){logger[_0x0fdb('0xa')](_0x4b7474,util[_0x0fdb('0x9')](_0x342534,{'showHidden':![],'depth':null}));};exports[_0x0fdb('0xb')]=function(_0x244551,_0x23b841){logger[_0x0fdb('0x8')](_0x244551,util[_0x0fdb('0x9')](_0x23b841,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2b6d16){return function(_0x30edec){logger[_0x0fdb('0xa')](_0x2b6d16,util[_0x0fdb('0x9')](_0x30edec,{'showHidden':![],'depth':null}));};};exports[_0x0fdb('0xc')]=function(_0x5e6785,_0x56e3f0,_0xc44c7){return{'message':_0x5e6785,'unlock':_0x56e3f0,'active':_0xc44c7};};exports[_0x0fdb('0xd')]=function(_0x1b086d,_0x5e40c9,_0x4e47e4){if(!_['isUndefined'](_0x4e47e4)&&_0x0fdb('0xe')===typeof _0x4e47e4&&!_[_0x0fdb('0xf')](_0x4e47e4)){if(!_['isUndefined'](_0x5e40c9)&&_0x0fdb('0xe')===typeof _0x5e40c9&&!_[_0x0fdb('0xf')](_0x5e40c9)){return util[_0x0fdb('0x10')]('\x22%s\x22\x20<%s>',_0x5e40c9,_0x4e47e4);}return util[_0x0fdb('0x10')](_0x0fdb('0x11'),_0x4e47e4,_0x4e47e4);}if(!_['isUndefined'](_0x1b086d)&&_0x0fdb('0xe')===typeof _0x1b086d&&!_[_0x0fdb('0xf')](_0x1b086d)){return _0x1b086d;}return _0x0fdb('0x12');};exports[_0x0fdb('0x13')]=function(_0x23207f){if(_[_0x0fdb('0x14')](_0x23207f)){return![];}return _0x23207f;};exports[_0x0fdb('0x15')]=function(_0x313bf8,_0x5894d2,_0x9bf565,_0x39ae19,_0x41f3d5,_0x81293b){var _0x3a7152={'XMD-QUEUE':_0x5894d2['Queue']?_0x5894d2[_0x0fdb('0x16')][_0x0fdb('0x17')]:'','XMD-CALLERID':_0x39ae19,'XMD-CALLERID-PREVIEW':_0x81293b?util[_0x0fdb('0x10')](_0x0fdb('0x11'),_0x81293b[_0x0fdb('0x18')],_0x81293b[_0x0fdb('0x19')]):_0x39ae19,'XMD-DIALID':_0x41f3d5,'XMD-CONTACTID':_0x5894d2[_0x0fdb('0x1a')],'XMD-CDRTYPE':_0x0fdb('0x1b'),'CALLERID(all)':_0x39ae19,'XMD-VOICEQUEUEID':_0x5894d2[_0x0fdb('0x1c')],'XMD-DIALCHANNEL':_0x9bf565,'XMD-DIALTIMEOUT':_0x313bf8[_0x0fdb('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x0fdb('0x1e'),_0x313bf8[_0x0fdb('0x1f')]?'g':'',_[_0x0fdb('0xf')](_0x313bf8['monitor_format'])?'':_0x0fdb('0x20')),'XMD-DIALURL':_0x313bf8[_0x0fdb('0x21')]||'','XMD-AGI':_0x313bf8['dialQueueProject']?util[_0x0fdb('0x10')]('\x22agi://%s/square,%s\x22',ipAgi,_0x313bf8[_0x0fdb('0x22')]):_0x0fdb('0x23'),'XMD-AGIAFTER':_0x313bf8[_0x0fdb('0x1f')]?util[_0x0fdb('0x10')](_0x0fdb('0x24'),ipAgi,_0x313bf8['dialQueueProject2']):'NONE','XMD-ORIGINATECALLERIDNUM':_0x81293b?_0x81293b[_0x0fdb('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x81293b?_0x81293b['originatecalleridname']:'','XMD-DESTINATION':_0x0fdb('0x26'),'SIPADDHEADER':_0x0fdb('0x27')};if(!_[_0x0fdb('0xf')](_0x313bf8[_0x0fdb('0x28')])){_0x3a7152[util[_0x0fdb('0x10')]('%s',_0x0fdb('0x29'))]=_0x313bf8[_0x0fdb('0x28')];_0x3a7152[util[_0x0fdb('0x10')]('%s',_0x0fdb('0x2a'))]=_0x41f3d5;}return _0x3a7152;};exports[_0x0fdb('0x2b')]=function(_0x1b4ada){var _0x1198a9={};for(var _0x1a2fda in _0x1b4ada){if(_0x1b4ada[_0x0fdb('0x2c')](_0x1a2fda)){_0x1198a9[util[_0x0fdb('0x10')]('%s',_[_0x0fdb('0x2d')](_0x1a2fda))]=_0x1b4ada[_0x1a2fda];}}return{'variables':_0x1198a9};};exports['updateOriginated']=function(_0x3464b7,_0x5db22a){if(!_[_0x0fdb('0x14')](_0x3464b7)){if(_0x3464b7[_0x0fdb('0x2c')](_0x0fdb('0x2e'))){if(_0x3464b7['originated']>0x0){_0x3464b7[_0x0fdb('0x2e')]-=0x1;}else{logger[_0x0fdb('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5db22a);}}}else{logger[_0x0fdb('0x8')](_0x0fdb('0x2f'),_0x5db22a);}};exports[_0x0fdb('0x30')]=function(_0x1f39e3){var _0x578ed6=moment()[_0x0fdb('0x10')](_0x0fdb('0x31'));_0x1f39e3[_0x0fdb('0x32')]=0xd;_0x1f39e3[_0x0fdb('0x33')]='Blacklist';_0x1f39e3[_0x0fdb('0x34')]=_0x578ed6;_0x1f39e3[_0x0fdb('0x35')]=_0x578ed6;_0x1f39e3[_0x0fdb('0x36')]=_0x578ed6;};exports[_0x0fdb('0x37')]=function(_0x487de6,_0x2f1493,_0x4305f6){var _0xc042d5=moment()[_0x0fdb('0x10')](_0x0fdb('0x31'));_0x487de6[_0x0fdb('0x32')]=_0x2f1493;_0x487de6[_0x0fdb('0x33')]=_0x4305f6;_0x487de6[_0x0fdb('0x35')]=_0xc042d5;_0x487de6[_0x0fdb('0x38')]=utils['getSeconds'](_0x487de6[_0x0fdb('0x35')],_0x487de6[_0x0fdb('0x34')]);};exports[_0x0fdb('0x39')]=function(_0x4faf61,_0x348f34,_0x63b6bd){_0x4faf61['membername']=_0x348f34;_0x4faf61[_0x0fdb('0x3a')]=_0x63b6bd;};exports[_0x0fdb('0x3b')]=function(_0x29f80f,_0x4c9ff4,_0x366f90){var _0xebf667=moment()[_0x0fdb('0x10')](_0x0fdb('0x31'));_0x29f80f['state']=_0x4c9ff4;_0x29f80f[_0x0fdb('0x33')]=_0x366f90;_0x29f80f[_0x0fdb('0x35')]=_0x29f80f[_0x0fdb('0x35')]?_0x29f80f[_0x0fdb('0x35')]:_0xebf667;_0x29f80f[_0x0fdb('0x36')]=_0x29f80f[_0x0fdb('0x36')]?_0x29f80f[_0x0fdb('0x36')]:_0xebf667;_0x29f80f[_0x0fdb('0x38')]=utils[_0x0fdb('0x3c')](_0x29f80f[_0x0fdb('0x35')]||0x0,_0x29f80f['starttime']||0x0);_0x29f80f[_0x0fdb('0x3d')]=_0x29f80f[_0x0fdb('0x3e')]?utils[_0x0fdb('0x3c')](_0x29f80f['endtime'],_0x29f80f[_0x0fdb('0x3e')]):0x0;};exports[_0x0fdb('0x3f')]=function(_0x4d007a){return _0x4d007a==='Failure';};exports[_0x0fdb('0x40')]=function(_0x4581a3,_0x2e8df0,_0x250181,_0x22db02,_0x2d2950){var _0x48ef71=_0x22db02?_0x0fdb('0x41'):_0x4581a3[_0x0fdb('0x18')];_0x48ef71=_0x2d2950?_0x0fdb('0x42'):_0x48ef71;return{'actionid':_0x4581a3['uniqueid'],'action':_0x0fdb('0x43'),'channel':_0x4581a3[_0x0fdb('0x44')],'callerid':util[_0x0fdb('0x10')](_0x0fdb('0x11'),_0x48ef71,_0x4581a3[_0x0fdb('0x19')]),'Exten':'xcally-motion-preview','Context':'from-sip','Priority':'1','variable':_0x250181,'timeout':(_0x2e8df0[_0x0fdb('0x45')]||0x1e)*0x3e8,'async':!![],'channelid':_0x4581a3[_0x0fdb('0x46')]};};exports[_0x0fdb('0x47')]=function(_0x2aeda3){return _0x2aeda3[_0x0fdb('0x48')]+_0x2aeda3[_0x0fdb('0x49')]+_0x2aeda3[_0x0fdb('0x4a')]+_0x2aeda3[_0x0fdb('0x4b')]+_0x2aeda3['countnosuchnumberretry'];};exports['cloneAction']=function(_0x44f08a){var _0x1e478a=_[_0x0fdb('0x4c')](_0x44f08a);_0x1e478a['state']=0xf;_0x1e478a[_0x0fdb('0x33')]=_0x0fdb('0x4d');return _0x1e478a;};exports[_0x0fdb('0x4e')]=function(_0x1c97bd,_0x3410fd,_0x5f097a){var _0x3f7535={};_0x3f7535[_0x3410fd]=_0x1c97bd[_0x3410fd];_0x3f7535[_0x0fdb('0x4f')]=![];_0x3f7535['scheduledat']=moment()['add'](_0x5f097a,_0x0fdb('0x50'))[_0x0fdb('0x10')](_0x0fdb('0x31'));_0x3f7535[_0x0fdb('0x1a')]=_0x1c97bd[_0x0fdb('0x1a')];_0x3f7535['ListId']=_0x1c97bd[_0x0fdb('0x51')];_0x3f7535[_0x0fdb('0x1c')]=_0x1c97bd[_0x0fdb('0x1c')]||undefined;return _0x3f7535;};exports[_0x0fdb('0x52')]=function(_0x22777c,_0x3f06af){if(!_['isNil'](_0x22777c)){if(_0x22777c[_0x0fdb('0x53')]>0x0){_0x22777c['pTalking']-=0x1;}else{logger[_0x0fdb('0x8')](_0x3f06af,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x0fdb('0x8')](_0x3f06af,_0x0fdb('0x54'));}};exports['IsNotLoggedIn']=function(_0x18d839){if(_0x18d839<=0x0){return!![];}return![];};function buildObj(_0x36f7bf,_0x4167e1,_0x90f9ab){_0x36f7bf['lastevent']=_0x4167e1;_0x36f7bf['name']=_0x36f7bf[_0x0fdb('0x55')];_0x36f7bf[_0x0fdb('0x56')]=_0x36f7bf[_0x0fdb('0x44')];_0x36f7bf[_0x0fdb('0x57')]=_0x0fdb('0x58');if(_0x90f9ab){_0x36f7bf[_0x0fdb('0x59')]=_0x90f9ab[_0x0fdb('0x59')];}return _0x36f7bf;}exports[_0x0fdb('0x5a')]=buildObj;exports['agentReadyId']=function(_0x4771ce){var _0x42b355=[];for(var _0x372ab9 in _0x4771ce){if(_0x4771ce[_0x0fdb('0x2c')](_0x372ab9)){if(!_[_0x0fdb('0x14')](_0x4771ce[_0x372ab9])&&_0x4771ce[_0x372ab9][_0x0fdb('0x32')]===_0x0fdb('0x5b')&&_0x4771ce[_0x372ab9][_0x0fdb('0x5c')]===_0x0fdb('0x5d')){_0x42b355[_0x0fdb('0x5e')](_0x4771ce[_0x372ab9]['id']);}}}return _0x42b355;};exports[_0x0fdb('0x5f')]=function(_0x4c4a31){var _0x136922=moment()[_0x0fdb('0x60')](0x0);var _0x95bc4a=moment(_0x4c4a31)[_0x0fdb('0x60')](0x0);return _0x136922[_0x0fdb('0x61')](_0x95bc4a,'seconds');};exports['createBody']=function(_0x2f8f14){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2f8f14[_0x0fdb('0x1a')],'ListId':_0x2f8f14[_0x0fdb('0x51')],'VoiceQueueId':_0x2f8f14[_0x0fdb('0x1c')]||undefined,'CampaignId':_0x2f8f14[_0x0fdb('0x62')]||undefined};};exports[_0x0fdb('0x63')]=function(_0x15c275){if(_0x15c275===_0x0fdb('0x46')||_0x15c275===_0x0fdb('0x64')||_0x15c275===_0x0fdb('0x55')||_0x15c275===_0x0fdb('0x65')||_0x15c275===_0x0fdb('0x66')||_0x15c275==='dialAnswer'||_0x15c275===_0x0fdb('0x67')||_0x15c275===_0x0fdb('0x44')||_0x15c275==='calleridname'||_0x15c275===_0x0fdb('0x4f')||_0x15c275==='calleridnum'||_0x15c275==='scheduledat'||_0x15c275===_0x0fdb('0x48')||_0x15c275==='countcongestionretry'||_0x15c275===_0x0fdb('0x4a')||_0x15c275===_0x0fdb('0x68')||_0x15c275===_0x0fdb('0x69')||_0x15c275===_0x0fdb('0x6a')||_0x15c275===_0x0fdb('0x6b')||_0x15c275===_0x0fdb('0x6c')||_0x15c275===_0x0fdb('0x1a')||_0x15c275===_0x0fdb('0x51')||_0x15c275===_0x0fdb('0x3a')||_0x15c275==='VoiceQueueId'||_0x15c275===_0x0fdb('0x6d')||_0x15c275===_0x0fdb('0x6e')||_0x15c275===_0x0fdb('0x6f')||_0x15c275==='xmd-phone'||_0x15c275===_0x0fdb('0x70')||_0x15c275==='xmd-dialurl'||_0x15c275===_0x0fdb('0x71')||_0x15c275==='xmd-dialoptions'||_0x15c275==='xmd-dialid'||_0x15c275===_0x0fdb('0x72')||_0x15c275==='xmd-contactid'||_0x15c275==='xmd-cdrtype'||_0x15c275===_0x0fdb('0x73')||_0x15c275===_0x0fdb('0x74')||_0x15c275===_0x0fdb('0x75')||_0x15c275===_0x0fdb('0x76')||_0x15c275===_0x0fdb('0x77')||_0x15c275===_0x0fdb('0x78')||_0x15c275===_0x0fdb('0x79')||_0x15c275===_0x0fdb('0x7a')||_0x15c275===_0x0fdb('0x7b')||_0x15c275==='rtpaudioqosrtt'||_0x15c275==='rtpaudioqosrttbridged'||_0x15c275===_0x0fdb('0x76')||_0x15c275===_0x0fdb('0x77')||_0x15c275==='rtpaudioqosjitter'||_0x15c275===_0x0fdb('0x79')||_0x15c275===_0x0fdb('0x7a')||_0x15c275===_0x0fdb('0x7b')||_0x15c275==='rtpaudioqosrtt'||_0x15c275==='rtpaudioqosrttbridged'||_0x15c275===_0x0fdb('0x7c')||_0x15c275===_0x0fdb('0x7d')||_0x15c275===_0x0fdb('0x32')||_0x15c275===_0x0fdb('0x33')){return![];}return!![];};exports[_0x0fdb('0x7e')]=function(_0x10d17b,_0x23fe70){var _0xc6c21,_0x20eb04,_0x64a537;if(_0x23fe70<=0x0){_0x23fe70=0x1;}_0xc6c21=new RegExp(_0x0fdb('0x7f')+_0x23fe70+'}$');_0x20eb04=Math['pow'](0xa,_0x23fe70-0x1);_0x64a537=Math[_0x0fdb('0x80')](0xa,_0x23fe70)-0x1;return util['format']('%s',_['replace'](_0x10d17b,_0xc6c21,_[_0x0fdb('0x81')](_0x20eb04,_0x64a537)));};exports[_0x0fdb('0x82')]=function(_0x56f5d8){var _0x44ad2d=_0x56f5d8['match'](/"(.*?)"/);return _0x44ad2d?_0x44ad2d[0x1]:_0x56f5d8;};exports['extractCalleridNumber']=function(_0x278fc4){var _0x279f70=_0x278fc4[_0x0fdb('0x83')](/<(.*?)>/);return _0x279f70?_0x279f70[0x1]:_0x278fc4;};function buildNoAnswerEventPayload(_0x72b82e,_0x82c652){var _0x2ae0a6=buildObj(_0x72b82e,_0x0fdb('0x84'));if(!_[_0x0fdb('0xf')](_0x82c652[_0x0fdb('0x85')])){Object[_0x0fdb('0x86')](_0x82c652['variables'])[_0x0fdb('0x87')](function(_0x505164){_0x2ae0a6[_0x505164[_0x0fdb('0x88')]()]=_0x82c652[_0x0fdb('0x85')][_0x505164];});}return _0x2ae0a6;}exports[_0x0fdb('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index c230e3a..72686ae 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 _0xd3e5=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd3e5,0x115));var _0x5d3e=function(_0x5546f5,_0x53cbed){_0x5546f5=_0x5546f5-0x0;var _0x2227c0=_0xd3e5[_0x5546f5];return _0x2227c0;};'use strict';exports[_0x5d3e('0x0')]={'queue':{'type':_0x5d3e('0x1'),'required':!![]},'interface':{'type':_0x5d3e('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x5d3e('0x2'),'required':![]},'paused':{'type':_0x5d3e('0x3'),'required':![]}};exports[_0x5d3e('0x4')]={'queue':{'type':_0x5d3e('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0x5d3e('0x1'),'required':!![]},'paused':{'type':_0x5d3e('0x3')},'reason':{'type':'string','required':![]}};exports[_0x5d3e('0x5')]={'module':{'type':_0x5d3e('0x1'),'required':![]}};exports[_0x5d3e('0x6')]={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]}};exports[_0x5d3e('0x7')]={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]},'filename':{'type':_0x5d3e('0x1')},'format':{'type':_0x5d3e('0x1')},'mixmonitorid':{'type':_0x5d3e('0x1')}};exports[_0x5d3e('0x8')]={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x5d3e('0x1'),'required':!![]},'exten':{'type':_0x5d3e('0x1'),'required':!![]},'context':{'type':_0x5d3e('0x1')}}; \ No newline at end of file +var _0x4ab2=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','queueremove','queuepause','reload'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0x4ab2,0x176));var _0x24ab=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x4ab2[_0x46698a];return _0x356db0;};'use strict';exports[_0x24ab('0x0')]={'queue':{'type':_0x24ab('0x1'),'required':!![]},'interface':{'type':_0x24ab('0x1'),'required':!![]},'membername':{'type':_0x24ab('0x1'),'required':!![]},'penalty':{'type':_0x24ab('0x2'),'required':![]},'paused':{'type':'boolean','required':![]}};exports[_0x24ab('0x3')]={'queue':{'type':_0x24ab('0x1'),'required':!![]},'interface':{'type':_0x24ab('0x1'),'required':!![]}};exports[_0x24ab('0x4')]={'interface':{'type':_0x24ab('0x1'),'required':!![]},'paused':{'type':'boolean'},'reason':{'type':'string','required':![]}};exports[_0x24ab('0x5')]={'module':{'type':_0x24ab('0x1'),'required':![]}};exports[_0x24ab('0x6')]={'uniqueid':{'type':_0x24ab('0x1'),'required':!![]}};exports[_0x24ab('0x7')]={'uniqueid':{'type':_0x24ab('0x1'),'required':!![]},'filename':{'type':_0x24ab('0x1')},'format':{'type':_0x24ab('0x1')},'mixmonitorid':{'type':_0x24ab('0x1')}};exports[_0x24ab('0x8')]={'uniqueid':{'type':_0x24ab('0x1'),'required':!![]}};exports[_0x24ab('0x9')]={'uniqueid':{'type':_0x24ab('0x1'),'required':!![]},'exten':{'type':_0x24ab('0x1'),'required':!![]},'context':{'type':_0x24ab('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 0089132..888b216 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 _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0b0e,0x187));var _0xe0b0=function(_0x109946,_0x3494b7){_0x109946=_0x109946-0x0;var _0x4ed20b=_0x0b0e[_0x109946];return _0x4ed20b;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file +var _0x0b0e=['total','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','initAgents','length','isNil','SIP/%s','isUndefined','prototype','initTelephones','initTrunks','trunks','initTriggers','initTemplates','salesforceAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','servicenowAccounts','initFreshsalesAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy','queue','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','diff','queuecallercomplete','answered','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','lodash','util','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','agents','telephones','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','dynamics365Accounts','faxAccounts','mapKeys','name','hasOwnProperty','format','interface'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0x0b0e[_0x3b4455];return _0x34dd09;};'use strict';var _=require(_0xe0b0('0x0'));var moment=require('moment');var util=require(_0xe0b0('0x1'));var Agent=require('../model/agent');var Telephone=require(_0xe0b0('0x2'));var Trunk=require(_0xe0b0('0x3'));var VoiceQueue=require(_0xe0b0('0x4'));var Trigger=require(_0xe0b0('0x5'));var Template=require(_0xe0b0('0x6'));var Campaign=require(_0xe0b0('0x7'));var VoiceExtension=require(_0xe0b0('0x8'));var ZendeskAccount=require(_0xe0b0('0x9'));var SalesforceAccount=require(_0xe0b0('0xa'));var FreshdeskAccount=require(_0xe0b0('0xb'));var SugarcrmAccount=require(_0xe0b0('0xc'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xe0b0('0xd'));var ServicenowAccount=require(_0xe0b0('0xe'));var Dynamics365Account=require(_0xe0b0('0xf'));var FreshsalesAccount=require(_0xe0b0('0x10'));var FaxAccount=require('../model/faxAccount');function Realtime(){this[_0xe0b0('0x11')]={};this[_0xe0b0('0x12')]={};this['trunks']={};this[_0xe0b0('0x13')]={};this[_0xe0b0('0x14')]={};this['campaigns']={};this[_0xe0b0('0x15')]={};this[_0xe0b0('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xe0b0('0x17')]={};this['channels']={};this[_0xe0b0('0x18')]={};this[_0xe0b0('0x19')]={};this[_0xe0b0('0x1a')]={};this[_0xe0b0('0x1b')]={};this[_0xe0b0('0x1c')]={};this['salesforceAccounts']={};this[_0xe0b0('0x1d')]={};this[_0xe0b0('0x1e')]={};this[_0xe0b0('0x1f')]={};this[_0xe0b0('0x20')]={};this[_0xe0b0('0x21')]={};this['servicenowAccounts']={};this[_0xe0b0('0x22')]={};this['freshsalesAccounts']={};this[_0xe0b0('0x23')]={};}function freeIsNotKey(_0xadee6e,_0x519ae8,_0x11fdca){var _0x4a4cc0=_[_0xe0b0('0x24')](_0xadee6e,function(_0x100204){return _0x100204[_0x11fdca];});for(var _0x56bcc7 in _0x519ae8){if(_0x519ae8['hasOwnProperty'](_0x56bcc7)){if(!_0x4a4cc0[_0x56bcc7]){delete _0x519ae8[_0x56bcc7];}}}}function freeIsNotKeySip(_0x46bb44,_0x50a441){var _0x4df8da=_['mapKeys'](_0x46bb44,function(_0x1920ee){return util['format']('SIP/%s',_0x1920ee[_0xe0b0('0x25')]);});for(var _0x59dff5 in _0x50a441){if(_0x50a441[_0xe0b0('0x26')](_0x59dff5)){if(!_0x4df8da[_0x59dff5]){delete _0x50a441[_0x59dff5];}}}}function freeIsNotKeyAgent(_0x5dba2f,_0x2c84cc){var _0x1cd7c4=_[_0xe0b0('0x24')](_0x5dba2f,function(_0x310a6d){var _0x2cf6a1=_['isNil'](_0x310a6d['interface'])?util[_0xe0b0('0x27')]('SIP/%s',_0x310a6d[_0xe0b0('0x25')]):_0x310a6d[_0xe0b0('0x28')];return _0x2cf6a1;});for(var _0x513e63 in _0x2c84cc){if(_0x2c84cc[_0xe0b0('0x26')](_0x513e63)){if(!_0x1cd7c4[_0x513e63]){delete _0x2c84cc[_0x513e63];}}}}function clearVoiceCallReports(_0x503883){_0x503883[_0xe0b0('0x29')]=0x0;_0x503883['answered']=0x0;_0x503883[_0xe0b0('0x2a')]=0x0;_0x503883['sumDuration']=0x0;_0x503883[_0xe0b0('0x2b')]=0x0;}function clearCampaigns(_0x4de537){if(!_[_0xe0b0('0x2c')](_0x4de537)){for(var _0x4aafbe in _0x4de537){if(_0x4de537[_0xe0b0('0x26')](_0x4aafbe)){_0x4de537[_0x4aafbe]['ivrTotalCallsDays']=0x0;_0x4de537[_0x4aafbe][_0xe0b0('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x3c3bc2){if(!_[_0xe0b0('0x2c')](_0x3c3bc2)){for(var _0x1d91ad in _0x3c3bc2){if(_0x3c3bc2[_0xe0b0('0x26')](_0x1d91ad)){_0x3c3bc2[_0x1d91ad][_0xe0b0('0x29')]=0x0;_0x3c3bc2[_0x1d91ad]['answered']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2e')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2f')]=0x0;_0x3c3bc2[_0x1d91ad]['sumHoldTime']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x30')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x2b')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x32')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x33')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x34')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x35')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundUnknownCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x36')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x37')]=0x0;_0x3c3bc2[_0x1d91ad]['outboundBlacklistCallsDay']=0x0;_0x3c3bc2[_0x1d91ad]['outboundOriginateFailureCallsDay']=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x38')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x39')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x31')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3a')]=0x0;_0x3c3bc2[_0x1d91ad][_0xe0b0('0x3b')]=!![];}}}}Realtime['prototype'][_0xe0b0('0x3c')]=function(_0x3231fc,_0x7867c4){for(var _0x29d725 in _0x7867c4){if(_0x3231fc[_0xe0b0('0x26')](_0x29d725)){_0x3231fc[_0x29d725]=_0x7867c4[_0x29d725];}}};Realtime['prototype'][_0xe0b0('0x3d')]=function(){var _0x208945=this;return function(_0xfc51d3){if(_0xfc51d3){freeIsNotKeyAgent(_0xfc51d3,_0x208945[_0xe0b0('0x11')]);for(var _0x3575bc=0x0,_0x12eeb8={};_0x3575bc<_0xfc51d3[_0xe0b0('0x3e')];_0x3575bc+=0x1){_0x12eeb8=_0xfc51d3[_0x3575bc];var _0x20908f=_[_0xe0b0('0x3f')](_0x12eeb8[_0xe0b0('0x28')])?util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x12eeb8[_0xe0b0('0x25')]):_0x12eeb8[_0xe0b0('0x28')];if(_[_0xe0b0('0x41')](_0x208945['agents'][_0x20908f])){_0x208945[_0xe0b0('0x11')][_0x20908f]=new Agent(_0x12eeb8);}else{_0x208945[_0xe0b0('0x3c')](_0x208945[_0xe0b0('0x11')][_0x20908f],_0x12eeb8);}}}return _0x208945[_0xe0b0('0x11')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x43')]=function(){var _0x12024d=this;return function(_0x533fc7){if(_0x533fc7){freeIsNotKeySip(_0x533fc7,_0x12024d['telephones']);for(var _0x549d9a=0x0,_0x5317df={};_0x549d9a<_0x533fc7[_0xe0b0('0x3e')];_0x549d9a+=0x1){_0x5317df=_0x533fc7[_0x549d9a];if(_[_0xe0b0('0x41')](_0x12024d[_0xe0b0('0x12')][util['format'](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])])){_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')]('SIP/%s',_0x5317df[_0xe0b0('0x25')])]=new Telephone(_0x5317df);}else{_0x12024d[_0xe0b0('0x3c')](_0x12024d[_0xe0b0('0x12')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x5317df[_0xe0b0('0x25')])],_0x5317df);}}}return _0x12024d[_0xe0b0('0x12')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x44')]=function(){var _0x54f251=this;return function(_0x3e349b){if(_0x3e349b){freeIsNotKeySip(_0x3e349b,_0x54f251['trunks']);for(var _0x34178d=0x0,_0x2d5f47={};_0x34178d<_0x3e349b[_0xe0b0('0x3e')];_0x34178d+=0x1){_0x2d5f47=_0x3e349b[_0x34178d];if(_[_0xe0b0('0x41')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])])){_0x54f251[_0xe0b0('0x45')][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47[_0xe0b0('0x25')])]=new Trunk(_0x2d5f47);}else{_0x54f251[_0xe0b0('0x3c')](_0x54f251['trunks'][util[_0xe0b0('0x27')](_0xe0b0('0x40'),_0x2d5f47['name'])],_0x2d5f47);}}}return _0x54f251['trunks'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x46')]=function(){var _0x56e7df=this;return function(_0x18a59d){if(_0x18a59d){freeIsNotKey(_0x18a59d,_0x56e7df[_0xe0b0('0x14')],'id');for(var _0x6bca5c=0x0,_0x1c869d={};_0x6bca5c<_0x18a59d[_0xe0b0('0x3e')];_0x6bca5c+=0x1){_0x1c869d=_0x18a59d[_0x6bca5c];if(_['isUndefined'](_0x56e7df['triggers'][_0x1c869d['id']])){_0x56e7df['triggers'][_0x1c869d['id']]=new Trigger(_0x1c869d);}else{_0x56e7df[_0xe0b0('0x3c')](_0x56e7df[_0xe0b0('0x14')][_0x1c869d['id']],_0x1c869d);}}}return _0x56e7df['triggers'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x47')]=function(){var _0x14197b=this;return function(_0x5f037d){if(_0x5f037d){freeIsNotKey(_0x5f037d,_0x14197b[_0xe0b0('0x15')],'id');for(var _0x5c6f94=0x0,_0x57d4b0={};_0x5c6f94<_0x5f037d[_0xe0b0('0x3e')];_0x5c6f94+=0x1){_0x57d4b0=_0x5f037d[_0x5c6f94];if(_[_0xe0b0('0x41')](_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']])){_0x14197b[_0xe0b0('0x15')][_0x57d4b0['id']]=new Template(_0x57d4b0);}else{_0x14197b[_0xe0b0('0x3c')](_0x14197b['templates'][_0x57d4b0['id']],_0x57d4b0);}}}return _0x14197b[_0xe0b0('0x15')];};};Realtime[_0xe0b0('0x42')]['initZendeskAccounts']=function(){var _0x50c805=this;return function(_0x5ddad1){if(_0x5ddad1){freeIsNotKey(_0x5ddad1,_0x50c805[_0xe0b0('0x1c')],'id');for(var _0x2184d3=0x0,_0x2419ce={};_0x2184d3<_0x5ddad1[_0xe0b0('0x3e')];_0x2184d3+=0x1){_0x2419ce=_0x5ddad1[_0x2184d3];if(_['isUndefined'](_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']])){_0x50c805[_0xe0b0('0x1c')][_0x2419ce['id']]=new ZendeskAccount(_0x2419ce);}else{_0x50c805['mergeFromDatabase'](_0x50c805['zendeskAccounts'][_0x2419ce['id']],_0x2419ce);}}}return _0x50c805[_0xe0b0('0x1c')];};};Realtime[_0xe0b0('0x42')]['initSalesforceAccounts']=function(){var _0x2b1917=this;return function(_0x27fd31){if(_0x27fd31){freeIsNotKey(_0x27fd31,_0x2b1917['salesforceAccounts'],'id');for(var _0x5cb2b6=0x0,_0x123ad2={};_0x5cb2b6<_0x27fd31['length'];_0x5cb2b6+=0x1){_0x123ad2=_0x27fd31[_0x5cb2b6];if(_[_0xe0b0('0x41')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']])){_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']]=new SalesforceAccount(_0x123ad2);}else{_0x2b1917[_0xe0b0('0x3c')](_0x2b1917[_0xe0b0('0x48')][_0x123ad2['id']],_0x123ad2);}}}return _0x2b1917[_0xe0b0('0x48')];};};Realtime['prototype']['initFreshdeskAccounts']=function(){var _0x2ef908=this;return function(_0x5d380a){if(_0x5d380a){freeIsNotKey(_0x5d380a,_0x2ef908['freshdeskAccounts'],'id');for(var _0x249d9a=0x0,_0x222174={};_0x249d9a<_0x5d380a['length'];_0x249d9a+=0x1){_0x222174=_0x5d380a[_0x249d9a];if(_['isUndefined'](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']])){_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']]=new FreshdeskAccount(_0x222174);}else{_0x2ef908[_0xe0b0('0x3c')](_0x2ef908[_0xe0b0('0x1e')][_0x222174['id']],_0x222174);}}}return _0x2ef908[_0xe0b0('0x1e')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x49')]=function(){var _0x4ebb0f=this;return function(_0x22c7bc){if(_0x22c7bc){freeIsNotKey(_0x22c7bc,_0x4ebb0f['zohoAccounts'],'id');for(var _0x17b3d4=0x0,_0x54106c={};_0x17b3d4<_0x22c7bc['length'];_0x17b3d4+=0x1){_0x54106c=_0x22c7bc[_0x17b3d4];if(_[_0xe0b0('0x41')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']])){_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']]=new ZohoAccount(_0x54106c);}else{_0x4ebb0f[_0xe0b0('0x3c')](_0x4ebb0f[_0xe0b0('0x1f')][_0x54106c['id']],_0x54106c);}}}return _0x4ebb0f[_0xe0b0('0x1f')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4a')]=function(){var _0x2e1c9b=this;return function(_0x4e0d87){if(_0x4e0d87){freeIsNotKey(_0x4e0d87,_0x2e1c9b[_0xe0b0('0x20')],'id');for(var _0x57ccc9=0x0,_0x2b5553={};_0x57ccc9<_0x4e0d87[_0xe0b0('0x3e')];_0x57ccc9+=0x1){_0x2b5553=_0x4e0d87[_0x57ccc9];if(_[_0xe0b0('0x41')](_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']])){_0x2e1c9b[_0xe0b0('0x20')][_0x2b5553['id']]=new DeskAccount(_0x2b5553);}else{_0x2e1c9b[_0xe0b0('0x3c')](_0x2e1c9b['deskAccounts'][_0x2b5553['id']],_0x2b5553);}}}return _0x2e1c9b[_0xe0b0('0x20')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4b')]=function(){var _0x271445=this;return function(_0x3bb6d6){if(_0x3bb6d6){freeIsNotKey(_0x3bb6d6,_0x271445[_0xe0b0('0x1d')],'id');for(var _0x234cb7=0x0,_0x1a60d2={};_0x234cb7<_0x3bb6d6[_0xe0b0('0x3e')];_0x234cb7+=0x1){_0x1a60d2=_0x3bb6d6[_0x234cb7];if(_[_0xe0b0('0x41')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']])){_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']]=new SugarcrmAccount(_0x1a60d2);}else{_0x271445[_0xe0b0('0x3c')](_0x271445[_0xe0b0('0x1d')][_0x1a60d2['id']],_0x1a60d2);}}}return _0x271445[_0xe0b0('0x1d')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4c')]=function(){var _0x155738=this;return function(_0x5aa79b){if(_0x5aa79b){freeIsNotKey(_0x5aa79b,_0x155738[_0xe0b0('0x21')],'id');for(var _0xe7fbac=0x0,_0x1182dc={};_0xe7fbac<_0x5aa79b[_0xe0b0('0x3e')];_0xe7fbac+=0x1){_0x1182dc=_0x5aa79b[_0xe7fbac];if(_[_0xe0b0('0x41')](_0x155738[_0xe0b0('0x21')][_0x1182dc['id']])){_0x155738[_0xe0b0('0x21')][_0x1182dc['id']]=new VtigerAccount(_0x1182dc);}else{_0x155738['mergeFromDatabase'](_0x155738['vtigerAccounts'][_0x1182dc['id']],_0x1182dc);}}}return _0x155738[_0xe0b0('0x21')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4d')]=function(){var _0x47ecc1=this;return function(_0x117d20){if(_0x117d20){freeIsNotKey(_0x117d20,_0x47ecc1[_0xe0b0('0x4e')],'id');for(var _0x309efb=0x0,_0x3d820c={};_0x309efb<_0x117d20[_0xe0b0('0x3e')];_0x309efb+=0x1){_0x3d820c=_0x117d20[_0x309efb];if(_['isUndefined'](_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']])){_0x47ecc1[_0xe0b0('0x4e')][_0x3d820c['id']]=new ServicenowAccount(_0x3d820c);}else{_0x47ecc1[_0xe0b0('0x3c')](_0x47ecc1['servicenowAccounts'][_0x3d820c['id']],_0x3d820c);}}}return _0x47ecc1[_0xe0b0('0x4e')];};};Realtime[_0xe0b0('0x42')]['initDynamics365Accounts']=function(){var _0x1bd249=this;return function(_0x4c5478){if(_0x4c5478){freeIsNotKey(_0x4c5478,_0x1bd249['dynamics365Accounts'],'id');for(var _0x4474ac=0x0,_0x57b51e={};_0x4474ac<_0x4c5478['length'];_0x4474ac+=0x1){_0x57b51e=_0x4c5478[_0x4474ac];if(_[_0xe0b0('0x41')](_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']])){_0x1bd249[_0xe0b0('0x22')][_0x57b51e['id']]=new Dynamics365Account(_0x57b51e);}else{_0x1bd249[_0xe0b0('0x3c')](_0x1bd249['dynamics365Accounts'][_0x57b51e['id']],_0x57b51e);}}}return _0x1bd249[_0xe0b0('0x22')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x4f')]=function(){var _0x41ec8e=this;return function(_0x1b29c){if(_0x1b29c){freeIsNotKey(_0x1b29c,_0x41ec8e[_0xe0b0('0x50')],'id');for(var _0xc5e88c=0x0,_0x224f1e={};_0xc5e88c<_0x1b29c['length'];_0xc5e88c+=0x1){_0x224f1e=_0x1b29c[_0xc5e88c];if(_['isUndefined'](_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']])){_0x41ec8e[_0xe0b0('0x50')][_0x224f1e['id']]=new FreshsalesAccount(_0x224f1e);}else{_0x41ec8e[_0xe0b0('0x3c')](_0x41ec8e['freshsalesAccounts'][_0x224f1e['id']],_0x224f1e);}}}return _0x41ec8e['freshsalesAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x51')]=function(){var _0x5d7cf4=this;return function(_0x5eca3d){for(var _0x691136=0x0;_0x691136<_0x5eca3d[_0xe0b0('0x3e')];_0x691136+=0x1){_[_0xe0b0('0x52')](_0x5d7cf4[_0xe0b0('0x13')][_0x5eca3d[_0x691136][_0xe0b0('0x25')]],_0x5eca3d[_0x691136]);}return _0x5d7cf4[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x53')]=function(){var _0x51f209=this;return function(_0x1daff7){clearVoiceQueues(_0x51f209[_0xe0b0('0x13')]);if(_0x1daff7){_0x1daff7=_[_0xe0b0('0x54')](_0x1daff7,'uniqueid');for(var _0x4fbf44 in _0x1daff7){if(_0x1daff7['hasOwnProperty'](_0x4fbf44)){for(var _0x56ee83=0x0;_0x56ee83<_0x1daff7[_0x4fbf44]['length'];_0x56ee83+=0x1){var _0x567c06=_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x55')];if(_0x51f209['voiceQueues'][_0x567c06]){if(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexit']){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2e')]+=0x1;}if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x56')]){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2f')]+=0x1;}_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')])['diff'](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x58')]),_0xe0b0('0x59'))||0x0;if(_0x56ee83===_0x1daff7[_0x4fbf44][_0xe0b0('0x3e')]-0x1){_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5a')]||_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5b')]||_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerexitAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallerjoinAt']),_0xe0b0('0x59'))||0x0;_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x29')]+=0x1;if(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x5d')]){_0x51f209['voiceQueues'][_0x567c06][_0xe0b0('0x5e')]+=0x1;_0x51f209[_0xe0b0('0x13')][_0x567c06]['sumBillable']+=moment(_0x1daff7[_0x4fbf44][_0x56ee83]['queuecallercompleteAt'])[_0xe0b0('0x5c')](moment(_0x1daff7[_0x4fbf44][_0x56ee83][_0xe0b0('0x57')]),_0xe0b0('0x59'))||0x0;}}else{_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x30')]+=_0x51f209[_0xe0b0('0x13')][_0x567c06][_0xe0b0('0x2a')]||0x0;}}}}}}return _0x51f209[_0xe0b0('0x13')];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x5f')]=function(){var _0x5a63e6=this;return function(_0x4c512b){clearVoiceCallReports(_0x5a63e6[_0xe0b0('0x16')]);if(_0x4c512b){for(var _0x4880d5=0x0;_0x4880d5<_0x4c512b['length'];_0x4880d5+=0x1){_0x5a63e6['outbound']['total']+=0x1;_0x5a63e6[_0xe0b0('0x16')]['sumDuration']+=_0x4c512b[_0x4880d5][_0xe0b0('0x60')];if(_0x4c512b[_0x4880d5][_0xe0b0('0x61')]===_0xe0b0('0x62')){_0x5a63e6[_0xe0b0('0x16')]['answered']+=0x1;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2a')]+=_0x4c512b[_0x4880d5]['duration']-_0x4c512b[_0x4880d5][_0xe0b0('0x63')]||0x0;_0x5a63e6[_0xe0b0('0x16')][_0xe0b0('0x2b')]+=_0x4c512b[_0x4880d5][_0xe0b0('0x63')];}}}return _0x5a63e6[_0xe0b0('0x16')];};};Realtime['prototype']['initCampaigns']=function(){var _0x55aef7=this;return function(_0x545694){if(_0x545694){freeIsNotKey(_0x545694,_0x55aef7['campaigns'],_0xe0b0('0x25'));for(var _0x567e1a=0x0,_0x3c09af={};_0x567e1a<_0x545694['length'];_0x567e1a+=0x1){_0x3c09af=_0x545694[_0x567e1a];if(_[_0xe0b0('0x41')](_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]])){_0x55aef7[_0xe0b0('0x64')][_0x3c09af[_0xe0b0('0x25')]]=new Campaign(_0x3c09af);}else{_0x55aef7[_0xe0b0('0x3c')](_0x55aef7['campaigns'][_0x3c09af['name']],_0x3c09af);_0x55aef7['campaigns'][_0x3c09af['name']][_0xe0b0('0x65')]=_0x3c09af[_0xe0b0('0x66')]?_0x3c09af[_0xe0b0('0x66')][_0xe0b0('0x25')]:undefined;}}}return _0x55aef7[_0xe0b0('0x64')];};};Realtime['prototype'][_0xe0b0('0x67')]=function(){var _0x39a07b=this;return function(_0xf77616){if(_0xf77616){freeIsNotKey(_0xf77616,_0x39a07b[_0xe0b0('0x17')],'id');for(var _0x154e6d=0x0,_0x2a5082={};_0x154e6d<_0xf77616[_0xe0b0('0x3e')];_0x154e6d+=0x1){_0x2a5082=_0xf77616[_0x154e6d];if(_[_0xe0b0('0x41')](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']])){_0x39a07b['voiceExtensions'][_0x2a5082['id']]=new VoiceExtension(_0x2a5082);}else{_0x39a07b['mergeFromDatabase'](_0x39a07b[_0xe0b0('0x17')][_0x2a5082['id']],_0x2a5082);}}}return _0x39a07b[_0xe0b0('0x17')];};};Realtime['prototype'][_0xe0b0('0x68')]=function(){var _0x4593f1=this;return function(_0x44c475){clearCampaigns(_0x4593f1[_0xe0b0('0x64')]);for(var _0x7358ce=0x0;_0x7358ce<_0x44c475[_0xe0b0('0x3e')];_0x7358ce+=0x1){_[_0xe0b0('0x52')](_0x4593f1[_0xe0b0('0x64')][_0x44c475[_0x7358ce]['name']],_0x44c475[_0x7358ce]);}return _0x4593f1['campaigns'];};};Realtime['prototype'][_0xe0b0('0x69')]=function(){var _0x90d471=this;return function(_0x5d2365){if(_0x5d2365){freeIsNotKey(_0x5d2365,_0x90d471[_0xe0b0('0x23')],'id');for(var _0x448694=0x0,_0x396eec={};_0x448694<_0x5d2365[_0xe0b0('0x3e')];_0x448694+=0x1){_0x396eec=_0x5d2365[_0x448694];if(_['isUndefined'](_0x90d471['faxAccounts'][_0x396eec['id']])){_0x90d471['faxAccounts'][_0x396eec['id']]=new FaxAccount(_0x396eec);}else{_0x90d471[_0xe0b0('0x3c')](_0x90d471[_0xe0b0('0x23')][_0x396eec['id']],_0x396eec);}}}return _0x90d471['faxAccounts'];};};Realtime[_0xe0b0('0x42')][_0xe0b0('0x6a')]=function(){var _0x5547ee=this;return function(_0x576482){if(_0x576482){freeIsNotKey(_0x576482,_0x5547ee[_0xe0b0('0x13')],'name');for(var _0x251195=0x0,_0x5f06c0={};_0x251195<_0x576482[_0xe0b0('0x3e')];_0x251195+=0x1){_0x5f06c0=_0x576482[_0x251195];if(_[_0xe0b0('0x41')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]])){_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]]=new VoiceQueue(_0x5f06c0);}else{_0x5547ee[_0xe0b0('0x3c')](_0x5547ee[_0xe0b0('0x13')][_0x5f06c0[_0xe0b0('0x25')]],_0x5f06c0);}}}return _0x5547ee['voiceQueues'];};};module[_0xe0b0('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 39c9adc..2fbe0ed 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2901=['assign','mergeDBDataToRealtime'];(function(_0xbc7f5a,_0x3056fe){var _0x4c0f5f=function(_0x15e1ee){while(--_0x15e1ee){_0xbc7f5a['push'](_0xbc7f5a['shift']());}};_0x4c0f5f(++_0x3056fe);}(_0x2901,0x82));var _0x1290=function(_0x5c4e4b,_0x1cae04){_0x5c4e4b=_0x5c4e4b-0x0;var _0x10680f=_0x2901[_0x5c4e4b];return _0x10680f;};'use strict';function mergeDBDataToRealtime(_0x2e1920,_0xf5aeab){var _0x3ceaf0=Object[_0x1290('0x0')]({},_0x2e1920);for(var _0x1b398e in _0xf5aeab){if(_0x3ceaf0['hasOwnProperty'](_0x1b398e)){_0x3ceaf0[_0x1b398e]=_0xf5aeab[_0x1b398e];}}return _0x3ceaf0;}exports[_0x1290('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xc628=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x4de036,_0x45dbcc){var _0x5711af=function(_0x5cd083){while(--_0x5cd083){_0x4de036['push'](_0x4de036['shift']());}};_0x5711af(++_0x45dbcc);}(_0xc628,0x87));var _0x8c62=function(_0xb91af6,_0x50d5dc){_0xb91af6=_0xb91af6-0x0;var _0x557bba=_0xc628[_0xb91af6];return _0x557bba;};'use strict';function mergeDBDataToRealtime(_0x4a18be,_0x223127){var _0x11c698=Object[_0x8c62('0x0')]({},_0x4a18be);for(var _0x532f78 in _0x223127){if(_0x11c698[_0x8c62('0x1')](_0x532f78)){_0x11c698[_0x532f78]=_0x223127[_0x532f78];}}return _0x11c698;}exports[_0x8c62('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 2ea55af..ab3e8c8 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 _0xd343=['agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','findAgent','accountcode','name','find','interface','format','SIP/%s','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','getAgentByInternal','keys','getCallType','channel','split','calleridnum','destination','exten','type','dialer','queue','from-voip-provider','callerid','context','xcally-motion-preview','calleridpreview','destinationchannel','originatecalleridnum','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','isNil','UserId','membername','monitors','monitorFilename','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','indexOf','mobile','phone','substring','transfererlinkedid','exports','moment','util','../../../config/environment','../ami','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceDialReport','./userReport','realtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd343,0x10d));var _0x3d34=function(_0x178bfb,_0x1091f8){_0x178bfb=_0x178bfb-0x0;var _0xc4c29b=_0xd343[_0x178bfb];return _0xc4c29b;};'use strict';var _=require('lodash');var moment=require(_0x3d34('0x0'));var util=require(_0x3d34('0x1'));var config=require(_0x3d34('0x2'));var ami=require(_0x3d34('0x3'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0x3d34('0x4'));var RpcMemberReport=require(_0x3d34('0x5'));var RpcVoiceQueueReport=require(_0x3d34('0x6'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0x3d34('0x7'));var VoiceQueueReport=require(_0x3d34('0x8'));var VoiceCallReport=require(_0x3d34('0x9'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x3d34('0xa'));var UserReport=require(_0x3d34('0xb'));function Report(_0x2c27a6){this[_0x3d34('0xc')]=_0x2c27a6;this[_0x3d34('0xd')]=_0x2c27a6['agents'];this[_0x3d34('0xe')]=_0x2c27a6[_0x3d34('0xe')];}Report[_0x3d34('0xf')][_0x3d34('0x10')]=function(_0x4419f7){var _0x140edd=new VoiceQueueReport(this[_0x3d34('0xc')]);var _0x21d1e6=new VoiceAgentReport(this[_0x3d34('0xc')]);var _0x5086d7=new VoiceDialReport(this['realtime']);var _0x2c5cde=new VoiceCallReport(this[_0x3d34('0xc')]);var _0x3aa7e8=new UserReport(this[_0x3d34('0xc')]);if(config[_0x3d34('0x11')]&&config[_0x3d34('0x11')][_0x3d34('0x12')]){ami['on'](_0x3d34('0x13'),this['voiceQueueReport'][_0x3d34('0x14')](this));ami['on'](_0x3d34('0x15'),this[_0x3d34('0x16')]['bind'](this));ami['on'](_0x3d34('0x17'),this['voiceAgentReport']['bind'](this));ami['on'](_0x3d34('0x18'),this[_0x3d34('0x19')][_0x3d34('0x14')](this));ami['on'](_0x3d34('0x1a'),this[_0x3d34('0x1b')][_0x3d34('0x14')](this));ami['on'](_0x3d34('0x1c'),this[_0x3d34('0x1d')][_0x3d34('0x14')](this));}};Report['prototype'][_0x3d34('0x1e')]=function(_0x5eb4db){var _0x2fac68;_0x2fac68=_['find'](this[_0x3d34('0xd')],function(_0x4d5f7d){return _0x4d5f7d[_0x3d34('0x1f')]==_0x5eb4db||_0x4d5f7d[_0x3d34('0x20')]==_0x5eb4db;});if(_['isNil'](_0x2fac68)){var _0x5c27fe=_[_0x3d34('0x21')](this['telephones'],function(_0xbf65e){return _0xbf65e[_0x3d34('0x1f')]==_0x5eb4db||_0xbf65e[_0x3d34('0x20')]==_0x5eb4db;});if(_0x5c27fe){_0x2fac68=_[_0x3d34('0x21')](this['agents'],function(_0x3ea737){return _0x3ea737[_0x3d34('0x22')]==util[_0x3d34('0x23')](_0x3d34('0x24'),_0x5c27fe[_0x3d34('0x20')]);});}}return _0x2fac68;};Report[_0x3d34('0xf')][_0x3d34('0x25')]=function(_0xa54f78){for(var _0x42e5b3=0x0;_0x42e5b3<_0xa54f78[_0x3d34('0x26')];_0x42e5b3+=0x1){var _0x21c0f9=this[_0x3d34('0x1e')](_0xa54f78[_0x42e5b3][_0x3d34('0x27')]);if(_0x21c0f9){_0xa54f78[_0x42e5b3]['accountcode']=_0x21c0f9[_0x3d34('0x1f')];_0xa54f78[_0x42e5b3][_0x3d34('0x28')]=!![];_0xa54f78[_0x42e5b3][_0x3d34('0x29')]=_0x21c0f9[_0x3d34('0x20')];_0xa54f78[_0x42e5b3][_0x3d34('0x22')]=_['isNil'](_0x21c0f9[_0x3d34('0x22')])?util[_0x3d34('0x23')]('SIP/%s',_0x21c0f9[_0x3d34('0x20')]):_0x21c0f9[_0x3d34('0x22')];if(_0xa54f78[_0x42e5b3][_0x3d34('0x2a')]){_0xa54f78[_0x42e5b3][_0x3d34('0x2b')]=moment()[_0x3d34('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xa54f78[_0x42e5b3][_0x3d34('0x2c')]){_0xa54f78[_0x42e5b3][_0x3d34('0x2d')]=moment()['format'](_0x3d34('0x2e'));}RpcMemberReport['voiceQueueReport'](_0xa54f78[_0x42e5b3]);}RpcVoiceQueueReport[_0x3d34('0x2f')](_0xa54f78[_0x42e5b3]);}};function extractCalleridNumber(_0x3168bd){var _0x2aa2f8=_0x3168bd[_0x3d34('0x30')](/<(.*?)>/);return _0x2aa2f8?_0x2aa2f8[0x1]:_0x3168bd;}Report[_0x3d34('0xf')][_0x3d34('0x31')]=function(_0x206d2e){for(var _0x4bcb78=0x0;_0x4bcb78','transfers','linkedid','transfereelinkedid','uniqueid','getCallType','UserId','membername','monitor','monitorFilename','monitors','createdAt','connectedlinename','forEach','startsWith','substring','indexOf','lastIndexOf','transfererlinkedid','exports','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceDialReport','./userReport','realtime','agents','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','voiceAgentReport','custom:voiceDialReport'];(function(_0xe0af3e,_0x353e6a){var _0x2891dc=function(_0x30cce2){while(--_0x30cce2){_0xe0af3e['push'](_0xe0af3e['shift']());}};_0x2891dc(++_0x353e6a);}(_0xeed2,0x1e7));var _0x2eed=function(_0x1e6257,_0x328de8){_0x1e6257=_0x1e6257-0x0;var _0x334fc1=_0xeed2[_0x1e6257];return _0x334fc1;};'use strict';var _=require('lodash');var moment=require(_0x2eed('0x0'));var util=require(_0x2eed('0x1'));var config=require(_0x2eed('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x2eed('0x3'));var RpcVoiceCallReport=require(_0x2eed('0x4'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0x2eed('0x5'));var RpcVoiceQueueReport=require(_0x2eed('0x6'));var RpcVoiceRecording=require(_0x2eed('0x7'));var RpcVoiceTransferReport=require(_0x2eed('0x8'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x2eed('0x9'));var UserReport=require(_0x2eed('0xa'));function Report(_0x24e666){this[_0x2eed('0xb')]=_0x24e666;this['agents']=_0x24e666[_0x2eed('0xc')];this['telephones']=_0x24e666['telephones'];}Report[_0x2eed('0xd')][_0x2eed('0xe')]=function(_0x59ae24){var _0x38471f=new VoiceQueueReport(this[_0x2eed('0xb')]);var _0x107897=new VoiceAgentReport(this[_0x2eed('0xb')]);var _0x4e4f98=new VoiceDialReport(this['realtime']);var _0x4e0564=new VoiceCallReport(this[_0x2eed('0xb')]);var _0x58051e=new UserReport(this[_0x2eed('0xb')]);if(config[_0x2eed('0xf')]&&config[_0x2eed('0xf')][_0x2eed('0x10')]){ami['on'](_0x2eed('0x11'),this['voiceQueueReport'][_0x2eed('0x12')](this));ami['on'](_0x2eed('0x13'),this[_0x2eed('0x14')][_0x2eed('0x12')](this));ami['on']('custom:voiceAgentReport',this[_0x2eed('0x15')]['bind'](this));ami['on'](_0x2eed('0x16'),this[_0x2eed('0x17')][_0x2eed('0x12')](this));ami['on'](_0x2eed('0x18'),this[_0x2eed('0x19')][_0x2eed('0x12')](this));ami['on']('attendedtransfer',this[_0x2eed('0x1a')][_0x2eed('0x12')](this));}};Report['prototype'][_0x2eed('0x1b')]=function(_0x3de6ca){var _0x17215c;_0x17215c=_[_0x2eed('0x1c')](this[_0x2eed('0xc')],function(_0x1cdade){return _0x1cdade[_0x2eed('0x1d')]==_0x3de6ca||_0x1cdade[_0x2eed('0x1e')]==_0x3de6ca;});if(_['isNil'](_0x17215c)){var _0x500b4a=_[_0x2eed('0x1c')](this['telephones'],function(_0x3e930f){return _0x3e930f[_0x2eed('0x1d')]==_0x3de6ca||_0x3e930f[_0x2eed('0x1e')]==_0x3de6ca;});if(_0x500b4a){_0x17215c=_['find'](this['agents'],function(_0x4813de){return _0x4813de[_0x2eed('0x1f')]==util[_0x2eed('0x20')](_0x2eed('0x21'),_0x500b4a[_0x2eed('0x1e')]);});}}return _0x17215c;};Report[_0x2eed('0xd')][_0x2eed('0x22')]=function(_0x1b849e){for(var _0x38b71f=0x0;_0x38b71f<_0x1b849e[_0x2eed('0x23')];_0x38b71f+=0x1){var _0x3d9915=this[_0x2eed('0x1b')](_0x1b849e[_0x38b71f][_0x2eed('0x24')]);if(_0x3d9915){_0x1b849e[_0x38b71f][_0x2eed('0x1d')]=_0x3d9915['accountcode'];_0x1b849e[_0x38b71f][_0x2eed('0x25')]=!![];_0x1b849e[_0x38b71f][_0x2eed('0x26')]=_0x3d9915[_0x2eed('0x1e')];_0x1b849e[_0x38b71f][_0x2eed('0x1f')]=_[_0x2eed('0x27')](_0x3d9915[_0x2eed('0x1f')])?util[_0x2eed('0x20')]('SIP/%s',_0x3d9915[_0x2eed('0x1e')]):_0x3d9915[_0x2eed('0x1f')];if(_0x1b849e[_0x38b71f][_0x2eed('0x28')]){_0x1b849e[_0x38b71f]['queuecallercompleteAt']=moment()[_0x2eed('0x20')](_0x2eed('0x29'));}if(_0x1b849e[_0x38b71f][_0x2eed('0x2a')]){_0x1b849e[_0x38b71f][_0x2eed('0x2b')]=moment()[_0x2eed('0x20')](_0x2eed('0x29'));}RpcMemberReport[_0x2eed('0x22')](_0x1b849e[_0x38b71f]);}RpcVoiceQueueReport[_0x2eed('0x2c')](_0x1b849e[_0x38b71f]);}};function extractCalleridNumber(_0x5f4e48){var _0x2489d8=_0x5f4e48['match'](/<(.*?)>/);return _0x2489d8?_0x2489d8[0x1]:_0x5f4e48;}Report['prototype'][_0x2eed('0x2d')]=function(_0xb913a1){for(var _0x5c218a=0x0;_0x5c218a{delete this['channels'][_0x31d94a];},_0x56e980);}};module['exports']=VoiceAgentReport; \ No newline at end of file +var _0x8c1e=['[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','syncMusicOnHoldStop','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]','exports','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','channels','voiceChannels','voiceQueues','agents','variables','syncAgentCalled','bind','agentconnect','syncAgentConnect','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','prototype','isNotNull','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','debug','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','interface','destuniqueid','queue','format','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','omit','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','user:%s','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','info','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','name','exten','custom:agentconnect','agentringnoanswer','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','agentcomplete','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][agentcomplete]\x20event:','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','agentacw','destconnectedlinenum','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s'];(function(_0x34cc89,_0x11b9c7){var _0x5eaadb=function(_0x5b415d){while(--_0x5b415d){_0x34cc89['push'](_0x34cc89['shift']());}};_0x5eaadb(++_0x11b9c7);}(_0x8c1e,0x14c));var _0xe8c1=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x8c1e[_0x2db12b];return _0x20990b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require('util');var Redis=require(_0xe8c1('0x0'));var config=require(_0xe8c1('0x1'));var logger=require(_0xe8c1('0x2'))(_0xe8c1('0x3'));var ami=require('../ami');config[_0xe8c1('0x4')]=_[_0xe8c1('0x5')](config[_0xe8c1('0x4')],{'host':_0xe8c1('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe8c1('0x4')]));function VoiceAgentReport(_0x6950c3){this[_0xe8c1('0x7')]={};this[_0xe8c1('0x8')]=_0x6950c3[_0xe8c1('0x7')];this[_0xe8c1('0x9')]=_0x6950c3[_0xe8c1('0x9')];this[_0xe8c1('0xa')]=_0x6950c3[_0xe8c1('0xa')];this[_0xe8c1('0xb')]={};ami['on']('agentcalled',this[_0xe8c1('0xc')][_0xe8c1('0xd')](this));ami['on'](_0xe8c1('0xe'),this[_0xe8c1('0xf')][_0xe8c1('0xd')](this));ami['on']('agentringnoanswer',this[_0xe8c1('0x10')]['bind'](this));ami['on'](_0xe8c1('0x11'),this[_0xe8c1('0x12')][_0xe8c1('0xd')](this));ami['on']('agentcomplete',this[_0xe8c1('0x13')][_0xe8c1('0xd')](this));ami['on'](_0xe8c1('0x14'),this[_0xe8c1('0x15')][_0xe8c1('0xd')](this));ami['on'](_0xe8c1('0x16'),this[_0xe8c1('0x17')]['bind'](this));ami['on'](_0xe8c1('0x18'),this['syncMusicOnHoldStart'][_0xe8c1('0xd')](this));ami['on'](_0xe8c1('0x19'),this['syncMusicOnHoldStop'][_0xe8c1('0xd')](this));ami['on'](_0xe8c1('0x1a'),this[_0xe8c1('0x1b')][_0xe8c1('0xd')](this));ami['on'](_0xe8c1('0x1c'),this[_0xe8c1('0x1d')][_0xe8c1('0xd')](this));}VoiceAgentReport['prototype'][_0xe8c1('0x1e')]=function(_0x202e6b,_0x538a34,_0xb79654){io['to'](_0x202e6b)[_0xe8c1('0x1e')](_0x538a34,_0xb79654);};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0x20')]=function(_0x5521f2){return _0x5521f2!==null&&!_[_0xe8c1('0x21')](_0x5521f2);};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0xc')]=function(_0xe145e9){try{if(this['isNotNull'](_0xe145e9)){logger['info'](_0xe8c1('0x22'),_0xe145e9[_0xe8c1('0x23')],_0xe145e9[_0xe8c1('0x24')],_0xe145e9['destuniqueid']);logger[_0xe8c1('0x25')](_0xe8c1('0x26'),_0xe145e9[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0xe145e9,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0xe145e9[_0xe8c1('0x23')]])){this[_0xe8c1('0x7')][_0xe145e9[_0xe8c1('0x23')]]={};}var _0x20f751=this[_0xe8c1('0xa')][_0xe145e9[_0xe8c1('0x28')]];var _0x2b4be5=this['channels'][_0xe145e9[_0xe8c1('0x23')]][_0xe145e9[_0xe8c1('0x29')]];var _0xb0ed0=this[_0xe8c1('0x9')][_0xe145e9[_0xe8c1('0x2a')]];var _0xd852e2=this[_0xe8c1('0xb')][_0xe145e9['uniqueid']];if(_[_0xe8c1('0x21')](_0x2b4be5)){_0x2b4be5={'agentcalledAt':moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c')),'lastevent':'called','mandatoryDisposition':_0xb0ed0&&_0xb0ed0['mandatoryDisposition']?_0xb0ed0[_0xe8c1('0x2d')]:![],'type':_0xb0ed0&&_0xb0ed0[_0xe8c1('0x2e')]?_0xb0ed0[_0xe8c1('0x2e')]:_0xe8c1('0x2f'),'variables':_0xd852e2,'motionChannel':_0xe8c1('0x30')};}Object['assign'](_0x2b4be5,_[_0xe8c1('0x31')](_0xe145e9,['event','privilege']));this['channels'][_0xe145e9[_0xe8c1('0x23')]][_0xe145e9[_0xe8c1('0x29')]]=_0x2b4be5;logger[_0xe8c1('0x25')](_0xe8c1('0x32'),_0xe145e9[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x2b4be5,{'showHidden':![],'depth':null}));ami[_0xe8c1('0x1e')](_0xe8c1('0x33'),_0x2b4be5);var _0x5bdb5a={'id':_0x20f751['id'],'calleridnum':_0x2b4be5[_0xe8c1('0x34')],'queue':_0x2b4be5[_0xe8c1('0x2a')],'variables':_0x2b4be5['variables'],'uniqueid':_0xe145e9[_0xe8c1('0x23')]};logger[_0xe8c1('0x25')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0xe145e9[_0xe8c1('0x23')],util['inspect'](_0x5bdb5a,{'showHidden':![],'depth':null}));this[_0xe8c1('0x1e')](util[_0xe8c1('0x2b')](_0xe8c1('0x35'),_0xe145e9[_0xe8c1('0x24')]),_0xe8c1('0x36'),_0x5bdb5a);}}catch(_0x5e0509){logger[_0xe8c1('0x37')](_0xe8c1('0x38'),_0xe145e9[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x5e0509,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0xf')]=function(_0xb1e993){try{if(this[_0xe8c1('0x20')](_0xb1e993)){if(this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]]){for(var _0x36fa31 in this['channels'][_0xb1e993['uniqueid']]){if(this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0xe8c1('0x39')](_0x36fa31)){if(_0xb1e993[_0xe8c1('0x29')]===_0x36fa31){logger[_0xe8c1('0x3a')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0xb1e993[_0xe8c1('0x23')],_0xb1e993[_0xe8c1('0x24')],_0xb1e993[_0xe8c1('0x29')]);this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x3b')]=moment()[_0xe8c1('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xb1e993['uniqueid']][_0x36fa31][_0xe8c1('0x3c')]=_0xb1e993[_0xe8c1('0x3c')];this['channels'][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x3d')]=_0xb1e993[_0xe8c1('0x3d')];this[_0xe8c1('0x7')][_0xb1e993['uniqueid']][_0x36fa31][_0xe8c1('0x3e')]=_0xb1e993[_0xe8c1('0x3e')];this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x3f')]=_0xb1e993[_0xe8c1('0x3f')];this['channels'][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x40')]=_0xb1e993[_0xe8c1('0x40')];this['channels'][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x41')]=_0xe8c1('0x42');_['merge'](this[_0xe8c1('0xa')][_0xb1e993[_0xe8c1('0x28')]],_[_0xe8c1('0x43')](_0xb1e993,[_0xe8c1('0x2a'),'destconnectedlinenum']));var _0x32e933=this[_0xe8c1('0xa')][_0xb1e993[_0xe8c1('0x28')]];var _0x5239d9={'id':_0x32e933['id'],'name':_0x32e933[_0xe8c1('0x44')],'agentconnected':!![],'destaccountcode':_0x32e933['accountcode'],'destconnectedlinenum':this['channels'][_0xb1e993[_0xe8c1('0x23')]][_0xb1e993['destuniqueid']][_0xe8c1('0x45')],'queue':this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0xb1e993['destuniqueid']][_0xe8c1('0x2a')],'uniqueid':this['channels'][_0xb1e993[_0xe8c1('0x23')]][_0xb1e993[_0xe8c1('0x29')]][_0xe8c1('0x23')]};ami[_0xe8c1('0x1e')](_0xe8c1('0x46'),this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0xb1e993[_0xe8c1('0x29')]]);this[_0xe8c1('0x1e')](util[_0xe8c1('0x2b')](_0xe8c1('0x35'),_0xb1e993['membername']),'user:agentconnect',_0x5239d9);}else if(!this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x47')]&&!this[_0xe8c1('0x7')][_0xb1e993['uniqueid']][_0x36fa31]['agentcomplete']){logger['info'](_0xe8c1('0x48'),_0xb1e993[_0xe8c1('0x23')],this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31]['membername'],_0x36fa31);this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x47')]=!![];this[_0xe8c1('0x7')][_0xb1e993['uniqueid']][_0x36fa31][_0xe8c1('0x49')]=moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c'));this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x4a')]=_0xb1e993['destuniqueid'];this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x4b')]=_0xb1e993[_0xe8c1('0x24')];this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x41')]=_0xe8c1('0x4c');this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31][_0xe8c1('0x4d')]=_0xe8c1('0x4c');logger[_0xe8c1('0x25')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0xb1e993[_0xe8c1('0x23')],util[_0xe8c1('0x27')](this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31],{'showHidden':![],'depth':null}));ami[_0xe8c1('0x1e')](_0xe8c1('0x4e'),this[_0xe8c1('0x7')][_0xb1e993[_0xe8c1('0x23')]][_0x36fa31]);}else{logger[_0xe8c1('0x25')](_0xe8c1('0x4f'),_0xb1e993['uniqueid']);}}}}}}catch(_0x3004d9){logger[_0xe8c1('0x37')](_0xe8c1('0x50'),_0xb1e993['uniqueid'],util[_0xe8c1('0x27')](_0x3004d9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')]['syncAgentRingNoAnswer']=function(_0x353b70){try{if(this['isNotNull'](_0x353b70)){logger[_0xe8c1('0x25')](_0xe8c1('0x51'),_0x353b70[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x353b70,{'showHidden':![],'depth':null}));if(this[_0xe8c1('0x7')][_0x353b70[_0xe8c1('0x23')]]&&this[_0xe8c1('0x7')][_0x353b70[_0xe8c1('0x23')]][_0x353b70[_0xe8c1('0x29')]]){logger[_0xe8c1('0x3a')](_0xe8c1('0x52'),_0x353b70[_0xe8c1('0x23')],_0x353b70[_0xe8c1('0x24')],_0x353b70[_0xe8c1('0x29')]);var _0x3e948f=this['agents'][_0x353b70['interface']];var _0x948018=this[_0xe8c1('0x7')][_0x353b70[_0xe8c1('0x23')]][_0x353b70[_0xe8c1('0x29')]];_0x948018[_0xe8c1('0x47')]=!![];_0x948018[_0xe8c1('0x49')]=moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c'));_0x948018[_0xe8c1('0x41')]='rejected';_0x948018[_0xe8c1('0x4d')]='rejected';var _0x2aba07={'id':_0x3e948f['id'],'name':_0x3e948f[_0xe8c1('0x44')],'queue':_0x948018['queue'],'uniqueid':_0x948018[_0xe8c1('0x23')]};logger[_0xe8c1('0x25')](_0xe8c1('0x53'),_0x353b70['uniqueid'],util[_0xe8c1('0x27')](_0x2aba07,{'showHidden':![],'depth':null}));this[_0xe8c1('0x1e')](util[_0xe8c1('0x2b')](_0xe8c1('0x35'),_0x3e948f[_0xe8c1('0x44')]),'user:agentringnoanswer',_0x2aba07);ami[_0xe8c1('0x1e')](_0xe8c1('0x54'),_0x948018);this[_0xe8c1('0x7')][_0x353b70['uniqueid']][_0x353b70[_0xe8c1('0x29')]]=Object['assign']({},_0x948018);}}}catch(_0xb4abe9){logger[_0xe8c1('0x37')](_0xe8c1('0x55'),_0x353b70[_0xe8c1('0x23')],util['inspect'](_0xb4abe9,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncQueueCallerAbandon']=function(_0x611139){try{if(this['isNotNull'](_0x611139)){logger[_0xe8c1('0x25')](_0xe8c1('0x56'),_0x611139[_0xe8c1('0x23')],util['inspect'](_0x611139,{'showHidden':![],'depth':null}));if(this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]]){for(var _0x2391ca in this[_0xe8c1('0x7')][_0x611139['uniqueid']]){if(this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0xe8c1('0x39')](_0x2391ca)&&!this['channels'][_0x611139[_0xe8c1('0x23')]][_0x2391ca][_0xe8c1('0x47')]&&!this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0x2391ca][_0xe8c1('0x57')]){logger[_0xe8c1('0x3a')](_0xe8c1('0x58'),_0x611139[_0xe8c1('0x23')],this['channels'][_0x611139[_0xe8c1('0x23')]][_0x2391ca][_0xe8c1('0x24')],_0x2391ca);this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0x2391ca]['agentringnoanswer']=!![];this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0x2391ca][_0xe8c1('0x49')]=moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c'));this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0x2391ca][_0xe8c1('0x41')]=_0xe8c1('0x59');this['channels'][_0x611139['uniqueid']][_0x2391ca][_0xe8c1('0x4d')]='abandoned';logger[_0xe8c1('0x25')](_0xe8c1('0x5a'),_0x611139[_0xe8c1('0x23')],util[_0xe8c1('0x27')](this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0x2391ca],{'showHidden':![],'depth':null}));ami[_0xe8c1('0x1e')](_0xe8c1('0x5b'),this[_0xe8c1('0x7')][_0x611139[_0xe8c1('0x23')]][_0x2391ca]);}}}}}catch(_0x489d10){logger[_0xe8c1('0x37')]('[%s][voiceAgentReport][queuecallerabandon]',_0x611139[_0xe8c1('0x23')],util['inspect'](_0x489d10,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0x13')]=function(_0x201e6b){try{if(this[_0xe8c1('0x20')](_0x201e6b)){logger[_0xe8c1('0x25')](_0xe8c1('0x5c'),_0x201e6b[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x201e6b,{'showHidden':![],'depth':null}));if(this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]]){for(var _0x38a5f2 in this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]]){if(this['channels'][_0x201e6b[_0xe8c1('0x23')]][_0xe8c1('0x39')](_0x38a5f2)){if(this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x3b')]&&!this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x57')]){logger[_0xe8c1('0x3a')]('[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x201e6b[_0xe8c1('0x23')],this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x24')],_0x38a5f2);this['channels'][_0x201e6b['uniqueid']][_0x38a5f2]['agentcomplete']=!![];this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x5d')]=moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c'));this['channels'][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x41')]=_0xe8c1('0x5e');this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x4d')]=_0x201e6b['reason']==_0xe8c1('0x5f')?_0xe8c1('0x60'):_0x201e6b[_0xe8c1('0x4d')];this['channels'][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x61')]=_0x201e6b[_0xe8c1('0x61')];if(this[_0xe8c1('0x9')][_0x201e6b[_0xe8c1('0x2a')]]&&this['voiceQueues'][_0x201e6b['queue']][_0xe8c1('0x62')]){this['channels'][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x63')]=this[_0xe8c1('0x9')][_0x201e6b[_0xe8c1('0x2a')]]['acwTimeout'];this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2][_0xe8c1('0x64')]=!![];}this['agents'][_0x201e6b[_0xe8c1('0x28')]]=_[_0xe8c1('0x31')](this[_0xe8c1('0xa')][_0x201e6b[_0xe8c1('0x28')]],[_0xe8c1('0x2a'),_0xe8c1('0x65')]);logger[_0xe8c1('0x25')](_0xe8c1('0x66'),_0x201e6b['uniqueid'],util['inspect'](this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2],{'showHidden':![],'depth':null}));ami[_0xe8c1('0x1e')]('custom:agentcomplete',this[_0xe8c1('0x7')][_0x201e6b[_0xe8c1('0x23')]][_0x38a5f2]);logger[_0xe8c1('0x25')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:',_0x201e6b[_0xe8c1('0x23')],util[_0xe8c1('0x27')]({'id':this['agents'][_0x201e6b[_0xe8c1('0x28')]]['id'],'destaccountcode':_0x201e6b[_0xe8c1('0x67')]},{'showHidden':![],'depth':null}));this[_0xe8c1('0x1e')](util[_0xe8c1('0x2b')](_0xe8c1('0x35'),_0x201e6b[_0xe8c1('0x24')]),_0xe8c1('0x68'),{'id':this[_0xe8c1('0xa')][_0x201e6b[_0xe8c1('0x28')]]['id'],'destaccountcode':Number(_0x201e6b[_0xe8c1('0x67')])});}}}}}}catch(_0x52a25f){logger['error']('[%s][voiceAgentReport][agentcomplete]',_0x201e6b[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x52a25f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe8c1('0x15')]=function(_0x52172b){try{if(this[_0xe8c1('0x20')](_0x52172b)){logger[_0xe8c1('0x25')](_0xe8c1('0x69'),_0x52172b[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x52172b,{'showHidden':![],'depth':null}));this['addVariable'](_0x52172b[_0xe8c1('0x23')],_[_0xe8c1('0x6a')](_0x52172b[_0xe8c1('0x6b')])[0x0],_0x52172b[_0xe8c1('0x6c')]);if(this[_0xe8c1('0x7')][_0x52172b[_0xe8c1('0x23')]]){for(var _0x39c9c2 in this[_0xe8c1('0x7')][_0x52172b[_0xe8c1('0x23')]]){if(this['channels'][_0x52172b[_0xe8c1('0x23')]][_0xe8c1('0x39')](_0x39c9c2)){logger[_0xe8c1('0x3a')](_0xe8c1('0x6d'),_0x52172b[_0xe8c1('0x23')],_0x39c9c2,_[_0xe8c1('0x6a')](_0x52172b['variable'])[0x0],_0x52172b[_0xe8c1('0x6c')]);if(_[_0xe8c1('0x21')](this['channels'][_0x52172b['uniqueid']][_0x39c9c2][_0xe8c1('0xb')])){this[_0xe8c1('0x7')][_0x52172b[_0xe8c1('0x23')]][_0x39c9c2][_0xe8c1('0xb')]={};}this[_0xe8c1('0x7')][_0x52172b[_0xe8c1('0x23')]][_0x39c9c2][_0xe8c1('0xb')]=this['variables'][_0x52172b[_0xe8c1('0x23')]];}}}}}catch(_0x2b47b3){logger['error'](_0xe8c1('0x6e'),_0x52172b['uniqueid'],util['inspect'](_0x2b47b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0x6f')]=function(_0x196858,_0x13687d,_0x738808){var _0x10df61=[_0xe8c1('0x70'),_0xe8c1('0x71'),_0xe8c1('0x72'),_0xe8c1('0x73'),'rtpaudioqosloss',_0xe8c1('0x74'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0xe8c1('0x75'),_0xe8c1('0x76'),_0xe8c1('0x77'),_0xe8c1('0x78'),_0xe8c1('0x79'),_0xe8c1('0x7a'),_0xe8c1('0x7b'),_0xe8c1('0x7c'),_0xe8c1('0x24'),'memberpenalty',_0xe8c1('0x7d')];if(!_[_0xe8c1('0x7e')](_0x13687d)&&!_[_0xe8c1('0x7f')](_0x10df61,_0x13687d)){if(_[_0xe8c1('0x21')](this['variables'][_0x196858])){this['variables'][_0x196858]={};}this['variables'][_0x196858][_0x13687d]=_0x738808;}};VoiceAgentReport['prototype'][_0xe8c1('0x17')]=function(_0xcec2bb){try{if(this[_0xe8c1('0x20')](_0xcec2bb)){logger[_0xe8c1('0x25')](_0xe8c1('0x80'),_0xcec2bb[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0xcec2bb,{'showHidden':![],'depth':null}));if(this[_0xe8c1('0x7')][_0xcec2bb[_0xe8c1('0x23')]]){for(var _0x4cae8c in this[_0xe8c1('0x7')][_0xcec2bb['uniqueid']]){if(this['channels'][_0xcec2bb[_0xe8c1('0x23')]][_0xe8c1('0x39')](_0x4cae8c)){if(this[_0xe8c1('0x7')][_0xcec2bb[_0xe8c1('0x23')]][_0x4cae8c][_0xe8c1('0x4d')]=='transfer'&&this[_0xe8c1('0x7')][_0xcec2bb[_0xe8c1('0x23')]][_0x4cae8c][_0xe8c1('0x57')]){logger['info'](_0xe8c1('0x81'),_0xcec2bb[_0xe8c1('0x23')],_0x4cae8c);this['channels'][_0xcec2bb[_0xe8c1('0x23')]][_0x4cae8c][_0xe8c1('0x5d')]=moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c'));}}}logger['debug'](_0xe8c1('0x82'),_0xcec2bb[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_[_0xe8c1('0x83')](this['channels'][_0xcec2bb[_0xe8c1('0x23')]]),{'showHidden':![],'depth':null}));ami[_0xe8c1('0x1e')](_0xe8c1('0x84'),_['values'](this['channels'][_0xcec2bb[_0xe8c1('0x23')]]));this['deleteChannelAfterTimeout'](_0xcec2bb['uniqueid']);}if(this[_0xe8c1('0xb')][_0xcec2bb['uniqueid']]){delete this[_0xe8c1('0xb')][_0xcec2bb[_0xe8c1('0x23')]];}}}catch(_0x40938d){logger[_0xe8c1('0x37')](_0xe8c1('0x85'),_0xcec2bb['uniqueid'],util['inspect'](_0x40938d,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe8c1('0x1b')]=function(_0x459336){try{if(this[_0xe8c1('0x20')](_0x459336)){logger[_0xe8c1('0x25')](_0xe8c1('0x86'),_0x459336[_0xe8c1('0x23')],util['inspect'](_0x459336,{'showHidden':![],'depth':null}));if(this['channels'][_0x459336[_0xe8c1('0x87')]]){for(var _0xd5eb8a in this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x87')]]){if(this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x87')]][_0xe8c1('0x39')](_0xd5eb8a)){if(_0x459336[_0xe8c1('0x88')]===_0xd5eb8a){logger[_0xe8c1('0x3a')](_0xe8c1('0x89'),_0x459336['uniqueid'],this[_0xe8c1('0x7')][_0x459336['transfereeuniqueid']][_0xd5eb8a]['membername'],_0xd5eb8a);var _0x3f71ef=moment();this['channels'][_0x459336[_0xe8c1('0x87')]][_0xd5eb8a][_0xe8c1('0x57')]=!![];this['channels'][_0x459336[_0xe8c1('0x87')]][_0xd5eb8a]['agentcompleteAt']=moment()[_0xe8c1('0x2b')](_0xe8c1('0x2c'));this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x87')]][_0xd5eb8a][_0xe8c1('0x41')]=_0xe8c1('0x5e');this[_0xe8c1('0x7')][_0x459336['transfereeuniqueid']][_0xd5eb8a][_0xe8c1('0x4d')]='transfer';this['channels'][_0x459336[_0xe8c1('0x87')]][_0xd5eb8a]['talktime']=_0x3f71ef[_0xe8c1('0x8a')](this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x87')]][_0xd5eb8a][_0xe8c1('0x3b')],'seconds');}}}}if(this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x8b')]]){var _0x11b265=this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x8b')]];this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x8b')]]=this[_0xe8c1('0x7')][_0x459336['transfereeuniqueid']];this[_0xe8c1('0x7')][_0x459336[_0xe8c1('0x87')]]=_0x11b265;}}}catch(_0x13394e){logger[_0xe8c1('0x37')]('[%s][voiceAgentReport][attendedtransfer]',_0x459336[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x13394e,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xe8c1('0x1d')]=function(_0x1fff54){try{if(this[_0xe8c1('0x20')](_0x1fff54)){logger[_0xe8c1('0x25')](_0xe8c1('0x8c'),_0x1fff54[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x1fff54,{'showHidden':![],'depth':null}));if(this[_0xe8c1('0x7')][_0x1fff54['transfereeuniqueid']]){for(var _0xa579f1 in this[_0xe8c1('0x7')][_0x1fff54[_0xe8c1('0x87')]]){if(this['channels'][_0x1fff54[_0xe8c1('0x87')]]['hasOwnProperty'](_0xa579f1)){if(_0x1fff54[_0xe8c1('0x8d')]===_0xa579f1){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x1fff54[_0xe8c1('0x23')],this[_0xe8c1('0x7')][_0x1fff54[_0xe8c1('0x87')]][_0xa579f1]['membername'],_0xa579f1);var _0x2c202c=moment();this[_0xe8c1('0x7')][_0x1fff54[_0xe8c1('0x87')]][_0xa579f1][_0xe8c1('0x57')]=!![];this[_0xe8c1('0x7')][_0x1fff54['transfereeuniqueid']][_0xa579f1][_0xe8c1('0x5d')]=_0x2c202c;this[_0xe8c1('0x7')][_0x1fff54[_0xe8c1('0x87')]][_0xa579f1]['lastevent']='complete';this['channels'][_0x1fff54[_0xe8c1('0x87')]][_0xa579f1]['reason']='transfer';this[_0xe8c1('0x7')][_0x1fff54['transfereeuniqueid']][_0xa579f1]['talktime']=_0x2c202c[_0xe8c1('0x8a')](this['channels'][_0x1fff54['transfereeuniqueid']][_0xa579f1][_0xe8c1('0x3b')],'seconds');}}}}}}catch(_0x15bedd){logger[_0xe8c1('0x37')](_0xe8c1('0x8e'),_0x1fff54[_0xe8c1('0x23')],util[_0xe8c1('0x27')](_0x15bedd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0x8f')]=function(_0x430195){var _0x4236d3='';try{if(this['isNotNull'](_0x430195)){logger[_0xe8c1('0x25')](_0xe8c1('0x90'),_0x430195['uniqueid'],util[_0xe8c1('0x27')](_0x430195,{'showHidden':![],'depth':null}));if(_0x430195['channel']){_0x4236d3=_0x430195[_0xe8c1('0x91')][_0xe8c1('0x92')](0x0,_0x430195[_0xe8c1('0x91')][_0xe8c1('0x93')]('-'));if(this[_0xe8c1('0xa')][_0x4236d3]){logger[_0xe8c1('0x3a')](_0xe8c1('0x94'),_0x430195['uniqueid'],_0x4236d3);this['agents'][_0x4236d3][_0xe8c1('0x95')]=!![];}}}}catch(_0xfa7b0c){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x430195[_0xe8c1('0x23')],util['inspect'](_0xfa7b0c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')][_0xe8c1('0x96')]=function(_0xc1c12d){var _0x3f2432='';try{if(this['isNotNull'](_0xc1c12d)){logger[_0xe8c1('0x25')](_0xe8c1('0x97'),_0xc1c12d['uniqueid'],util[_0xe8c1('0x27')](_0xc1c12d,{'showHidden':![],'depth':null}));if(_0xc1c12d['channel']){_0x3f2432=_0xc1c12d[_0xe8c1('0x91')][_0xe8c1('0x92')](0x0,_0xc1c12d[_0xe8c1('0x91')][_0xe8c1('0x93')]('-'));if(this[_0xe8c1('0xa')][_0x3f2432]){logger[_0xe8c1('0x3a')]('[%s][voiceAgentReport][musiconholdstop]\x20interface:%s',_0xc1c12d['uniqueid'],_0x3f2432);this[_0xe8c1('0xa')][_0x3f2432][_0xe8c1('0x95')]=![];}}}}catch(_0x111d08){logger['error'](_0xe8c1('0x98'),_0xc1c12d[_0xe8c1('0x23')],util['inspect'](_0x111d08,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xe8c1('0x1f')]['deleteChannelAfterTimeout']=function(_0x339863,_0x53d957=0x2710){if(this[_0xe8c1('0x7')][_0x339863]){setTimeout(()=>{delete this[_0xe8c1('0x7')][_0x339863];},_0x53d957);}};module[_0xe8c1('0x99')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 739bdc0..3ef558a 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d16=['endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','mixmonitor_filename','parse','sipcalllinkedid','[%s][voiceCallReport][hangup]\x20event:','answertime','destinationchannel','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','transferToInternal','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','StopMixMonitor','catch','finally','webbar:stopmonitors','event','outbound','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','ATTENDED','some','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','syncBlindTransfer','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','BLIND','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','deleteChannelAfterTimeout','moment','path','ioredis','../../../config/environment','ami','../ami','../model/channel','../rpc/setting','set','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','BUSY','redis','defaults','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','syncNewState','varset','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isUndefined','emit','isNotNull','uniqueid','calleridname','calleridnum','debug','linkedid','merge','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','format','user:%s','accountcode','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','YYYY-MM-DD\x20HH:mm:ss','disposition','pick','keys','from-sip','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','name','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','subtract','duration','includes','lastapplication','lastdata','startsWith','cdr(','match','type','isNil','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','channelstate','answered','starttime','seconds','connectedlinename','toNumber','UserId','membername','holdtime','diff','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:agentconnect','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor'];(function(_0x6a40a,_0x3264b6){var _0x828d2f=function(_0x53abab){while(--_0x53abab){_0x6a40a['push'](_0x6a40a['shift']());}};_0x828d2f(++_0x3264b6);}(_0x4d16,0x121));var _0x64d1=function(_0x4f6260,_0x229b9d){_0x4f6260=_0x4f6260-0x0;var _0x33bd04=_0x4d16[_0x4f6260];return _0x33bd04;};'use strict';var _=require('lodash');var moment=require(_0x64d1('0x0'));var util=require('util');var path=require(_0x64d1('0x1'));var Redis=require(_0x64d1('0x2'));var config=require(_0x64d1('0x3'));var logger=require('../../../config/logger')(_0x64d1('0x4'));var ami=require(_0x64d1('0x5'));var Channel=require(_0x64d1('0x6'));var RpcSetting=require(_0x64d1('0x7'));var applications=[_0x64d1('0x8'),'queue',_0x64d1('0x9'),_0x64d1('0xa'),_0x64d1('0xb'),_0x64d1('0xc')];var dispositions=['NO\x20ANSWER',_0x64d1('0xd'),_0x64d1('0xd'),_0x64d1('0xe'),_0x64d1('0xe'),'NO\x20ANSWER','ANSWERED',_0x64d1('0xf'),_0x64d1('0xd'),_0x64d1('0xd'),_0x64d1('0xd')];config[_0x64d1('0x10')]=_[_0x64d1('0x11')](config[_0x64d1('0x10')],{'host':'localhost','port':0x18eb});var io=require(_0x64d1('0x12'))(new Redis(config[_0x64d1('0x10')]));function VoiceCallReport(_0x438a2c){this[_0x64d1('0x13')]=_0x438a2c[_0x64d1('0x13')];this[_0x64d1('0x14')]=_0x438a2c['agents'];this['blindTransfers']={};ami['on'](_0x64d1('0x15'),this[_0x64d1('0x16')][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x18'),this['syncNewExten'][_0x64d1('0x17')](this));ami['on']('newchannel',this[_0x64d1('0x19')][_0x64d1('0x17')](this));ami['on']('newstate',this[_0x64d1('0x1a')][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x1b'),this['syncVarSet']['bind'](this));ami['on'](_0x64d1('0x1c'),this[_0x64d1('0x1d')][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x1e'),this[_0x64d1('0x1f')]['bind'](this));ami['on'](_0x64d1('0x20'),this[_0x64d1('0x21')]['bind'](this));ami['on'](_0x64d1('0x22'),this['syncBlindTransfer'][_0x64d1('0x17')](this));ami['on'](_0x64d1('0x23'),this[_0x64d1('0x24')]['bind'](this));ami['on'](_0x64d1('0x25'),this[_0x64d1('0x26')][_0x64d1('0x17')](this));try{logger[_0x64d1('0x27')](_0x64d1('0x28'));ami['actionCoreShowChannels']();}catch(_0x4562bb){logger[_0x64d1('0x29')](_0x64d1('0x2a'),util[_0x64d1('0x2b')](_0x4562bb,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x64d1('0x2c')]['isNotNull']=function(_0x16df5a){return _0x16df5a!==null&&!_[_0x64d1('0x2d')](_0x16df5a);};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x2e')]=function(_0x1c4ee4,_0x5290ef,_0x1c8c28){io['to'](_0x1c4ee4)[_0x64d1('0x2e')](_0x5290ef,_0x1c8c28);};VoiceCallReport['prototype'][_0x64d1('0x1f')]=function(_0x3d19ca){try{if(this[_0x64d1('0x2f')](_0x3d19ca)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3d19ca[_0x64d1('0x30')],_0x3d19ca[_0x64d1('0x31')],_0x3d19ca[_0x64d1('0x32')]);logger[_0x64d1('0x33')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x3d19ca[_0x64d1('0x30')],util['inspect'](_0x3d19ca,{'showHidden':![],'depth':null}));if(_0x3d19ca[_0x64d1('0x30')]===_0x3d19ca[_0x64d1('0x34')]){if(!_[_0x64d1('0x2d')](this['channels'][_0x3d19ca[_0x64d1('0x30')]])){_[_0x64d1('0x35')](this[_0x64d1('0x13')][_0x3d19ca[_0x64d1('0x30')]],_['pick'](_0x3d19ca,_['keys'](this[_0x64d1('0x13')][_0x3d19ca['uniqueid']])));}}if(_0x3d19ca[_0x64d1('0x36')]==='from-sip'){var _0x36def0=this[_0x64d1('0x14')][_0x3d19ca[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]];if(_0x36def0){if(_0x3d19ca[_0x64d1('0x39')]==_0x64d1('0x3a')){_0x36def0[_0x64d1('0x3b')]=_0x3d19ca[_0x64d1('0x3c')];this[_0x64d1('0x2e')](util[_0x64d1('0x3d')](_0x64d1('0x3e'),_0x36def0['name']),'user:agentconnect',{'id':_0x36def0['id'],'destaccountcode':_0x36def0[_0x64d1('0x3f')],'destconnectedlinenum':_0x3d19ca[_0x64d1('0x3c')]});}}}}}catch(_0x30ef68){logger[_0x64d1('0x29')]('[%s][voiceCallReport][newcallerid]',_0x3d19ca[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x30ef68,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x19')]=function(_0x4b50de){try{if(this[_0x64d1('0x2f')](_0x4b50de)){logger[_0x64d1('0x33')](_0x64d1('0x40'),_0x4b50de[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x4b50de,{'showHidden':![],'depth':null}));if(this[_0x64d1('0x13')][_0x4b50de[_0x64d1('0x30')]]){return;}if(_0x4b50de[_0x64d1('0x37')]===_0x64d1('0x41')){return;}if(_0x4b50de[_0x64d1('0x30')]!==_0x4b50de[_0x64d1('0x34')]&&!this[_0x64d1('0x42')][_0x4b50de[_0x64d1('0x34')]]){return;}logger[_0x64d1('0x27')](_0x64d1('0x43'),_0x4b50de['uniqueid'],_0x4b50de[_0x64d1('0x36')],_0x4b50de['exten']);this[_0x64d1('0x13')][_0x4b50de[_0x64d1('0x30')]]=new Channel();this[_0x64d1('0x13')][_0x4b50de[_0x64d1('0x30')]]['starttime']=moment()['format'](_0x64d1('0x44'));this[_0x64d1('0x13')][_0x4b50de['uniqueid']][_0x64d1('0x45')]=dispositions[_['toNumber'](_0x4b50de['channelstate'])];_[_0x64d1('0x35')](this['channels'][_0x4b50de[_0x64d1('0x30')]],_[_0x64d1('0x46')](_0x4b50de,_[_0x64d1('0x47')](this[_0x64d1('0x13')][_0x4b50de['uniqueid']])));if(_0x4b50de[_0x64d1('0x36')]===_0x64d1('0x48')){var _0x4ea157=this[_0x64d1('0x14')][_0x4b50de[_0x64d1('0x37')]['split']('-')[0x0]];if(_0x4ea157&&typeof _0x4ea157['destconnectedlinenum']===_0x64d1('0x49')){_0x4ea157['destconnectedlinenum']=_0x4b50de['exten'];logger[_0x64d1('0x33')](_0x64d1('0x4a'),_0x4b50de['uniqueid'],util[_0x64d1('0x2b')]({'id':_0x4ea157['id'],'destaccountcode':_0x4ea157[_0x64d1('0x3f')],'destconnectedlinenum':_0x4b50de[_0x64d1('0x39')]},{'showHidden':![],'depth':null}));this[_0x64d1('0x2e')](util[_0x64d1('0x3d')]('user:%s',_0x4ea157[_0x64d1('0x4b')]),'user:agentconnect',{'id':_0x4ea157['id'],'destaccountcode':_0x4ea157[_0x64d1('0x3f')],'destconnectedlinenum':_0x4b50de[_0x64d1('0x39')]});}}}}catch(_0x5eb99e){logger['error']('[%s][voiceCallReport][newchannel]',_0x4b50de[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5eb99e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x64d1('0x16')]=function(_0x58bf1f){try{if(this[_0x64d1('0x2f')](_0x58bf1f)){logger[_0x64d1('0x33')](_0x64d1('0x4c'),_0x58bf1f[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x58bf1f,{'showHidden':![],'depth':null}));if(_0x58bf1f['channel']==='OutgoingSpoolFailed'||_0x58bf1f[_0x64d1('0x39')]==='h')return;if(_0x58bf1f[_0x64d1('0x30')]===_0x58bf1f[_0x64d1('0x34')]||this[_0x64d1('0x42')][_0x58bf1f['linkedid']]){_0x58bf1f[_0x64d1('0x4d')]=_0x58bf1f[_0x64d1('0x4d')]?_0x58bf1f[_0x64d1('0x4d')][_0x64d1('0x4e')]():undefined;_0x58bf1f['applicationdata']=_0x58bf1f['appdata']||_0x58bf1f[_0x64d1('0x4f')];if(_0x58bf1f['appdata']&&_0x58bf1f[_0x64d1('0x4d')]!=='queue'){_0x58bf1f['applicationdata']=_0x58bf1f[_0x64d1('0x4f')]['toLowerCase']();}logger['info'](_0x64d1('0x50'),_0x58bf1f[_0x64d1('0x30')],_0x58bf1f[_0x64d1('0x4d')],_0x58bf1f[_0x64d1('0x4f')]);if(_[_0x64d1('0x2d')](this['channels'][_0x58bf1f[_0x64d1('0x30')]])){this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]]=new Channel();this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]]['starttime']=_0x58bf1f['duration']?moment()[_0x64d1('0x51')](moment[_0x64d1('0x52')](_0x58bf1f[_0x64d1('0x52')])['seconds'](),'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x64d1('0x45')]=_0x64d1('0xe');}_['merge'](this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]],_[_0x64d1('0x46')](_0x58bf1f,_['keys'](this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]])));if(_[_0x64d1('0x53')](applications,_0x58bf1f[_0x64d1('0x4d')])){this['channels'][_0x58bf1f['uniqueid']][_0x64d1('0x54')]=_0x58bf1f[_0x64d1('0x4d')];this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x64d1('0x55')]=_0x58bf1f[_0x64d1('0x4f')];if(_0x58bf1f[_0x64d1('0x4d')]===_0x64d1('0x8')&&_[_0x64d1('0x56')](_0x58bf1f['applicationdata']['toLowerCase'](),_0x64d1('0x57'))){var _0x2190ef=_0x58bf1f[_0x64d1('0x4f')][_0x64d1('0x38')]('=');var _0x24c173=_0x2190ef[0x0]['toLowerCase']()[_0x64d1('0x58')](/cdr\((.*)\)/);if(_0x24c173){if(_0x24c173[0x1]===_0x64d1('0x59')&&!_[_0x64d1('0x5a')](this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x24c173[0x1]]))return;this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x24c173[0x1]]=_0x2190ef[0x1];}}else if(_0x58bf1f[_0x64d1('0x4d')]===_0x64d1('0x5b')){this[_0x64d1('0x13')][_0x58bf1f[_0x64d1('0x30')]][_0x64d1('0x5b')]=_0x58bf1f[_0x64d1('0x4f')]['split'](',')[0x0];}}}}}catch(_0x3057d1){logger[_0x64d1('0x29')](_0x64d1('0x5c'),_0x58bf1f[_0x64d1('0x30')],util['inspect'](_0x3057d1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x64d1('0x1a')]=function(_0x5ee8b7){try{if(this[_0x64d1('0x2f')](_0x5ee8b7)){logger[_0x64d1('0x27')](_0x64d1('0x5d'),_0x5ee8b7[_0x64d1('0x30')],_0x5ee8b7[_0x64d1('0x34')],_0x5ee8b7[_0x64d1('0x31')],_0x5ee8b7['calleridnum']);logger[_0x64d1('0x33')](_0x64d1('0x5e'),_0x5ee8b7[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5ee8b7,{'showHidden':![],'depth':null}));if(_0x5ee8b7[_0x64d1('0x5f')]!=='6')return;var _0x171710=this['agents'][_0x5ee8b7[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]];if(_0x5ee8b7['uniqueid']!==_0x5ee8b7[_0x64d1('0x34')]){var _0x29ebab=moment();if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]){if(!this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['answered']){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x60')]=!![];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['answertime']=_0x29ebab[_0x64d1('0x3d')](_0x64d1('0x44'));if(this[_0x64d1('0x13')][_0x5ee8b7['linkedid']][_0x64d1('0x61')]){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['holdtime']=_0x29ebab['diff'](this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x61')],_0x64d1('0x62'));}}this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x34')]=_0x5ee8b7[_0x64d1('0x30')];if(_0x5ee8b7[_0x64d1('0x32')]!=='xcally-motion-preview'){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x3c')]=_0x5ee8b7[_0x64d1('0x32')];}this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x63')]=_0x5ee8b7['calleridname'];this['channels'][_0x5ee8b7['linkedid']]['destinationchannel']=_0x5ee8b7[_0x64d1('0x37')];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['disposition']=dispositions[_[_0x64d1('0x64')](_0x5ee8b7['channelstate'])];if(_0x171710){this['channels'][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x65')]=_0x171710['id'];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]][_0x64d1('0x66')]=_0x171710['name'];}}if(this['channels'][_0x5ee8b7[_0x64d1('0x30')]]){if(!this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x60')]){this['channels'][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x60')]=!![];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]]['answertime']=_0x29ebab['format'](_0x64d1('0x44'));if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x61')]){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x67')]=_0x29ebab[_0x64d1('0x68')](this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x61')],'seconds');}}if(_0x5ee8b7[_0x64d1('0x32')]!=='xcally-motion-preview'){this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']]['connectedlinenum']=_0x5ee8b7[_0x64d1('0x32')];}this['channels'][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x63')]=_0x5ee8b7['calleridname'];this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']]['destinationchannel']=_0x5ee8b7[_0x64d1('0x37')];this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']][_0x64d1('0x45')]=dispositions[_[_0x64d1('0x64')](_0x5ee8b7[_0x64d1('0x5f')])];}}else{if(this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']]){if(_0x171710){this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x65')]=_0x171710['id'];this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]][_0x64d1('0x66')]=_0x171710[_0x64d1('0x4b')];}}}if(_0x5ee8b7[_0x64d1('0x36')]===_0x64d1('0x48')){if(_0x171710){_0x171710[_0x64d1('0x3b')]=_0x5ee8b7[_0x64d1('0x39')];var _0x51695a;if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x30')]]){_0x51695a=this[_0x64d1('0x13')][_0x5ee8b7['uniqueid']][_0x64d1('0x5b')];}else if(this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]){_0x51695a=this[_0x64d1('0x13')][_0x5ee8b7[_0x64d1('0x34')]]['queue'];}_0x171710[_0x64d1('0x5b')]=_0x51695a;var _0x5e0219={'id':_0x171710['id'],'name':_0x171710[_0x64d1('0x4b')],'agentconnected':!![],'destaccountcode':_0x171710[_0x64d1('0x3f')],'destconnectedlinenum':_0x5ee8b7[_0x64d1('0x39')],'queue':_0x51695a||undefined,'uniqueid':_0x5ee8b7[_0x64d1('0x34')]};logger[_0x64d1('0x33')](_0x64d1('0x69'),_0x5ee8b7[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5e0219,{'showHidden':![],'depth':null}));this[_0x64d1('0x2e')](util['format'](_0x64d1('0x3e'),_0x171710['name']),_0x64d1('0x6a'),_0x5e0219);}}}}catch(_0x5bb8dd){logger['error'](_0x64d1('0x6b'),_0x5ee8b7[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x5bb8dd,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x6c')]=function(_0x46c9ec,_0x530f60){try{if(this[_0x64d1('0x13')][_0x46c9ec]){logger[_0x64d1('0x27')](_0x64d1('0x6d'),_0x46c9ec,_0x530f60);this[_0x64d1('0x13')][_0x46c9ec][_0x64d1('0x6e')]=!![];if(_[_0x64d1('0x6f')](_0x530f60,_0x64d1('0x70'))){_0x530f60=_0x530f60[_0x64d1('0x71')](_0x64d1('0x70'),_0x64d1('0x72'));}this['channels'][_0x46c9ec][_0x64d1('0x73')]=_0x530f60;var _0x330477=_[_0x64d1('0x74')](this[_0x64d1('0x13')][_0x46c9ec][_0x64d1('0x75')],{'filename':_0x530f60});if(_[_0x64d1('0x5a')](_0x330477)){this[_0x64d1('0x13')][_0x46c9ec]['monitors'][_0x64d1('0x76')]({'filename':_0x530f60,'createdAt':moment()[_0x64d1('0x3d')](_0x64d1('0x44')),'mixmonitorid':'','status':_0x64d1('0x77')});}}}catch(_0x48405a){logger[_0x64d1('0x29')](_0x64d1('0x78'),_0x46c9ec,util[_0x64d1('0x2b')](_0x48405a,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')][_0x64d1('0x79')]=function(_0x25ffed){try{if(this[_0x64d1('0x2f')](_0x25ffed)){logger[_0x64d1('0x33')](_0x64d1('0x7a'),_0x25ffed[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x25ffed,{'showHidden':![],'depth':null}));if(this['channels'][_0x25ffed[_0x64d1('0x30')]]&&_0x25ffed[_0x64d1('0x37')]!=_0x64d1('0x41')){if(this[_0x64d1('0x2f')](_0x25ffed['variable'])){if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')]['mixmonitor_filename'])){logger[_0x64d1('0x27')](_0x64d1('0x7c'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x6c')](_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);}else if(this['isNotNull'](_0x25ffed['variable'][_0x64d1('0x7e')])){logger[_0x64d1('0x27')](_0x64d1('0x7f'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x32')]=_0x25ffed[_0x64d1('0x7d')];}else if(this['isNotNull'](_0x25ffed[_0x64d1('0x7b')]['xmd-callerid'])){logger[_0x64d1('0x27')](_0x64d1('0x80'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this['channels'][_0x25ffed['uniqueid']]['callerid']=_0x25ffed[_0x64d1('0x7d')];}else if(this[_0x64d1('0x2f')](_0x25ffed['variable']['xmd-cdrtype'])){logger[_0x64d1('0x27')](_0x64d1('0x81'),_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed['uniqueid']][_0x64d1('0x59')]=_0x25ffed['value'];}else if(this[_0x64d1('0x2f')](_0x25ffed['variable'][_0x64d1('0x82')])){logger[_0x64d1('0x27')](_0x64d1('0x83'),_0x25ffed[_0x64d1('0x30')],_0x25ffed['value'][_0x64d1('0x38')](',')[0x0]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x5b')]=_0x25ffed[_0x64d1('0x7d')][_0x64d1('0x38')](',')[0x0];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x84')])){logger[_0x64d1('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x25ffed['uniqueid'],_0x25ffed['value']);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x85')]=_0x25ffed['value'];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x86')])){logger['info'](_0x64d1('0x87'),_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x88')]=_0x25ffed[_0x64d1('0x7d')];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x89')])){logger[_0x64d1('0x27')](_0x64d1('0x8a'),_0x25ffed[_0x64d1('0x30')],_0x25ffed[_0x64d1('0x7d')]);this['channels'][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x8b')]=_0x25ffed[_0x64d1('0x7d')];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')]['xmcs-queue'])){logger['info'](_0x64d1('0x8c'),_0x25ffed['uniqueid'],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x30')]][_0x64d1('0x5b')]=_0x25ffed['value'];}else if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x8d')])){logger[_0x64d1('0x27')](_0x64d1('0x8e'),_0x25ffed['uniqueid'],_0x25ffed['value']);this['channels'][_0x25ffed[_0x64d1('0x30')]]['sipcalluniqueid']=_0x25ffed[_0x64d1('0x7d')];}}}else if(this['isNotNull'](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x8f')])){if(_0x25ffed[_0x64d1('0x7d')]){var _0x57ee58=path[_0x64d1('0x90')](_0x25ffed[_0x64d1('0x7d')])[_0x64d1('0x4b')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x57ee58,_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x6c')](_0x57ee58,_0x25ffed[_0x64d1('0x7d')]);}}else if(this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x34')]]){if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')])){if(this[_0x64d1('0x2f')](_0x25ffed[_0x64d1('0x7b')][_0x64d1('0x8d')])){logger[_0x64d1('0x27')](_0x64d1('0x8e'),_0x25ffed[_0x64d1('0x34')],_0x25ffed[_0x64d1('0x7d')]);this[_0x64d1('0x13')][_0x25ffed[_0x64d1('0x34')]][_0x64d1('0x91')]=_0x25ffed[_0x64d1('0x7d')];}}}}}catch(_0x36bddc){logger[_0x64d1('0x29')]('[%s][voiceCallReport][varset]',_0x25ffed[_0x64d1('0x30')],util[_0x64d1('0x2b')](_0x36bddc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x64d1('0x2c')]['syncHangup']=function(_0x502d32){try{if(this[_0x64d1('0x2f')](_0x502d32)){logger[_0x64d1('0x33')](_0x64d1('0x92'),_0x502d32['uniqueid'],util[_0x64d1('0x2b')](_0x502d32,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x502d32[_0x64d1('0x34')]]){if(this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']]){this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']][_0x64d1('0x30')]=_0x502d32[_0x64d1('0x30')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x34')]][_0x64d1('0x60')]=this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x60')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']][_0x64d1('0x93')]=this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x93')];this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['linkedid']][_0x64d1('0x94')]=this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x34')]]['channel'];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32['linkedid']][_0x64d1('0x34')]][_0x64d1('0x45')]=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x45')];this[_0x64d1('0x13')][_0x502d32['uniqueid']]=this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32['linkedid']][_0x64d1('0x34')]];this['deleteChannelAfterTimeout'](this['blindTransfers'][_0x502d32[_0x64d1('0x34')]]['linkedid']);}else if(this['channels'][this['blindTransfers'][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]]){this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x30')]=[this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x34')],this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x34')]=this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']][_0x64d1('0x30')]][0x0];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]][_0x64d1('0x60')]=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x60')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']][_0x64d1('0x93')]=this['channels'][_0x502d32['uniqueid']][_0x64d1('0x93')];this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32['linkedid']][_0x64d1('0x30')]][_0x64d1('0x94')]=this[_0x64d1('0x13')][this['blindTransfers'][_0x502d32['linkedid']][_0x64d1('0x30')]][_0x64d1('0x37')];this['channels'][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]][_0x64d1('0x30')]]['disposition']=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x45')];this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]]=this[_0x64d1('0x13')][this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0x64d1('0x42')][_0x502d32[_0x64d1('0x34')]]['uniqueid']);}}if(this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]]){logger['info']('[%s][voiceCallReport][hangup]\x20reason:%s',_0x502d32['uniqueid'],_0x502d32[_0x64d1('0x95')]);var _0x103786=moment();this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]]['endtime']=_0x103786[_0x64d1('0x3d')](_0x64d1('0x44'));this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x52')]=_0x103786['diff'](this[_0x64d1('0x13')][_0x502d32['uniqueid']]['starttime'],_0x64d1('0x62'));if(this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x60')]){this[_0x64d1('0x13')][_0x502d32['uniqueid']]['billableseconds']=_0x103786[_0x64d1('0x68')](this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x93')],_0x64d1('0x62'));this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x67')]=this[_0x64d1('0x13')][_0x502d32[_0x64d1('0x30')]][_0x64d1('0x52')]-this[_0x64d1('0x13')][_0x502d32['uniqueid']][_0x64d1('0x96')];}if(_0x502d32[_0x64d1('0x36')]===_0x64d1('0x48')){if(this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]]){this[_0x64d1('0x14')][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]]=_[_0x64d1('0x97')](this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]],['destconnectedlinenum']);logger['debug'](_0x64d1('0x98'),_0x502d32[_0x64d1('0x30')],util['inspect']({'id':this[_0x64d1('0x14')][_0x502d32['channel'][_0x64d1('0x38')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]][_0x64d1('0x3f')]},{'showHidden':![],'depth':null}));this[_0x64d1('0x2e')](util[_0x64d1('0x3d')](_0x64d1('0x3e'),this[_0x64d1('0x14')][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]][_0x64d1('0x4b')]),_0x64d1('0x99'),{'id':this['agents'][_0x502d32[_0x64d1('0x37')][_0x64d1('0x38')]('-')[0x0]]['id'],'destaccountcode':this[_0x64d1('0x14')][_0x502d32[_0x64d1('0x37')]['split']('-')[0x0]][_0x64d1('0x3f')]});for(var _0x3e7dfd=0x0;_0x3e7dfd{delete this['channels'][_0x4ed0d6];},_0x10fd2d);}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0x50cf=['prototype','isNotNull','emit','uniqueid','calleridname','calleridnum','debug','inspect','linkedid','isUndefined','merge','pick','keys','context','from-sip','channel','split','exten','xcally-motion-preview','connectedlinenum','format','user:%s','name','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','destconnectedlinenum','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','includes','lastdata','startsWith','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','answered','diff','seconds','UserId','membername','answertime','holdtime','destinationchannel','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','sipcalluniqueid','mixmonitor_filename','parse','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','user:agentcomplete','resolve','then','transferType','getSettings','stopRecordingOnTransfer','StopMixMonitor','Action','catch','finally','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfercalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','transferToInternal','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','[%s][voiceCallReport][blindtransfer]\x20event:','transfereruniqueid','BLIND','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','../model/channel','../rpc/setting','set','queue','playback','voicemail','NO\x20ANSWER','FAILED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','bind','newexten','syncNewExten','newchannel','syncNewChannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]'];(function(_0x339adb,_0x2d290c){var _0xf32e69=function(_0x5d2162){while(--_0x5d2162){_0x339adb['push'](_0x339adb['shift']());}};_0xf32e69(++_0x2d290c);}(_0x50cf,0x160));var _0xf50c=function(_0x351648,_0x25c49a){_0x351648=_0x351648-0x0;var _0x5c7f57=_0x50cf[_0x351648];return _0x5c7f57;};'use strict';var _=require(_0xf50c('0x0'));var moment=require('moment');var util=require(_0xf50c('0x1'));var path=require(_0xf50c('0x2'));var Redis=require(_0xf50c('0x3'));var config=require(_0xf50c('0x4'));var logger=require(_0xf50c('0x5'))('ami');var ami=require('../ami');var Channel=require(_0xf50c('0x6'));var RpcSetting=require(_0xf50c('0x7'));var applications=[_0xf50c('0x8'),_0xf50c('0x9'),'agi','dial',_0xf50c('0xa'),_0xf50c('0xb')];var dispositions=[_0xf50c('0xc'),_0xf50c('0xd'),_0xf50c('0xd'),_0xf50c('0xc'),_0xf50c('0xc'),_0xf50c('0xc'),'ANSWERED',_0xf50c('0xe'),_0xf50c('0xd'),_0xf50c('0xd'),_0xf50c('0xd')];config['redis']=_[_0xf50c('0xf')](config[_0xf50c('0x10')],{'host':_0xf50c('0x11'),'port':0x18eb});var io=require(_0xf50c('0x12'))(new Redis(config['redis']));function VoiceCallReport(_0x3195d7){this[_0xf50c('0x13')]=_0x3195d7[_0xf50c('0x13')];this[_0xf50c('0x14')]=_0x3195d7[_0xf50c('0x14')];this['blindTransfers']={};ami['on']('coreshowchannel',this['syncNewExten'][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x16'),this[_0xf50c('0x17')][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x18'),this[_0xf50c('0x19')][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x1a'),this[_0xf50c('0x1b')][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x1c'),this[_0xf50c('0x1d')][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x1e'),this[_0xf50c('0x1f')]['bind'](this));ami['on']('newcallerid',this['syncNewCallerId']['bind'](this));ami['on'](_0xf50c('0x20'),this[_0xf50c('0x21')][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x22'),this[_0xf50c('0x23')][_0xf50c('0x15')](this));ami['on']('musiconholdstart',this['syncMusicOnHoldStart'][_0xf50c('0x15')](this));ami['on'](_0xf50c('0x24'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0xf50c('0x25')](_0xf50c('0x26'));ami[_0xf50c('0x27')]();}catch(_0x19a968){logger[_0xf50c('0x28')](_0xf50c('0x29'),util['inspect'](_0x19a968,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf50c('0x2a')][_0xf50c('0x2b')]=function(_0x5d81b6){return _0x5d81b6!==null&&!_['isUndefined'](_0x5d81b6);};VoiceCallReport[_0xf50c('0x2a')]['emit']=function(_0xfcebf4,_0x4fb7cb,_0x2fc885){io['to'](_0xfcebf4)[_0xf50c('0x2c')](_0x4fb7cb,_0x2fc885);};VoiceCallReport[_0xf50c('0x2a')]['syncNewCallerId']=function(_0x530d19){try{if(this['isNotNull'](_0x530d19)){logger[_0xf50c('0x25')]('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x530d19[_0xf50c('0x2d')],_0x530d19[_0xf50c('0x2e')],_0x530d19[_0xf50c('0x2f')]);logger[_0xf50c('0x30')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x530d19[_0xf50c('0x2d')],util[_0xf50c('0x31')](_0x530d19,{'showHidden':![],'depth':null}));if(_0x530d19[_0xf50c('0x2d')]===_0x530d19[_0xf50c('0x32')]){if(!_[_0xf50c('0x33')](this[_0xf50c('0x13')][_0x530d19['uniqueid']])){_[_0xf50c('0x34')](this[_0xf50c('0x13')][_0x530d19['uniqueid']],_[_0xf50c('0x35')](_0x530d19,_[_0xf50c('0x36')](this[_0xf50c('0x13')][_0x530d19[_0xf50c('0x2d')]])));}}if(_0x530d19[_0xf50c('0x37')]===_0xf50c('0x38')){var _0x22fe2b=this[_0xf50c('0x14')][_0x530d19[_0xf50c('0x39')][_0xf50c('0x3a')]('-')[0x0]];if(_0x22fe2b){if(_0x530d19[_0xf50c('0x3b')]==_0xf50c('0x3c')){_0x22fe2b['destconnectedlinenum']=_0x530d19[_0xf50c('0x3d')];this[_0xf50c('0x2c')](util[_0xf50c('0x3e')](_0xf50c('0x3f'),_0x22fe2b[_0xf50c('0x40')]),_0xf50c('0x41'),{'id':_0x22fe2b['id'],'destaccountcode':_0x22fe2b[_0xf50c('0x42')],'destconnectedlinenum':_0x530d19[_0xf50c('0x3d')]});}}}}}catch(_0x53c8d0){logger['error'](_0xf50c('0x43'),_0x530d19[_0xf50c('0x2d')],util[_0xf50c('0x31')](_0x53c8d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf50c('0x2a')][_0xf50c('0x19')]=function(_0x59d49a){try{if(this[_0xf50c('0x2b')](_0x59d49a)){logger[_0xf50c('0x30')](_0xf50c('0x44'),_0x59d49a[_0xf50c('0x2d')],util[_0xf50c('0x31')](_0x59d49a,{'showHidden':![],'depth':null}));if(this[_0xf50c('0x13')][_0x59d49a[_0xf50c('0x2d')]]){return;}if(_0x59d49a[_0xf50c('0x39')]===_0xf50c('0x45')){return;}if(_0x59d49a[_0xf50c('0x2d')]!==_0x59d49a['linkedid']&&!this[_0xf50c('0x46')][_0x59d49a[_0xf50c('0x32')]]){return;}logger[_0xf50c('0x25')](_0xf50c('0x47'),_0x59d49a['uniqueid'],_0x59d49a[_0xf50c('0x37')],_0x59d49a[_0xf50c('0x3b')]);this['channels'][_0x59d49a[_0xf50c('0x2d')]]=new Channel();this[_0xf50c('0x13')][_0x59d49a['uniqueid']][_0xf50c('0x48')]=moment()[_0xf50c('0x3e')](_0xf50c('0x49'));this[_0xf50c('0x13')][_0x59d49a[_0xf50c('0x2d')]][_0xf50c('0x4a')]=dispositions[_[_0xf50c('0x4b')](_0x59d49a[_0xf50c('0x4c')])];_[_0xf50c('0x34')](this[_0xf50c('0x13')][_0x59d49a[_0xf50c('0x2d')]],_[_0xf50c('0x35')](_0x59d49a,_['keys'](this[_0xf50c('0x13')][_0x59d49a[_0xf50c('0x2d')]])));if(_0x59d49a[_0xf50c('0x37')]===_0xf50c('0x38')){var _0x3500c9=this[_0xf50c('0x14')][_0x59d49a[_0xf50c('0x39')][_0xf50c('0x3a')]('-')[0x0]];if(_0x3500c9&&typeof _0x3500c9[_0xf50c('0x4d')]===_0xf50c('0x4e')){_0x3500c9['destconnectedlinenum']=_0x59d49a['exten'];logger[_0xf50c('0x30')](_0xf50c('0x4f'),_0x59d49a[_0xf50c('0x2d')],util[_0xf50c('0x31')]({'id':_0x3500c9['id'],'destaccountcode':_0x3500c9['accountcode'],'destconnectedlinenum':_0x59d49a['exten']},{'showHidden':![],'depth':null}));this[_0xf50c('0x2c')](util['format'](_0xf50c('0x3f'),_0x3500c9['name']),_0xf50c('0x41'),{'id':_0x3500c9['id'],'destaccountcode':_0x3500c9[_0xf50c('0x42')],'destconnectedlinenum':_0x59d49a[_0xf50c('0x3b')]});}}}}catch(_0x1a7a00){logger['error']('[%s][voiceCallReport][newchannel]',_0x59d49a[_0xf50c('0x2d')],util['inspect'](_0x1a7a00,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf50c('0x2a')][_0xf50c('0x17')]=function(_0x8d5111){try{if(this[_0xf50c('0x2b')](_0x8d5111)){logger[_0xf50c('0x30')](_0xf50c('0x50'),_0x8d5111['uniqueid'],util[_0xf50c('0x31')](_0x8d5111,{'showHidden':![],'depth':null}));if(_0x8d5111[_0xf50c('0x39')]==='OutgoingSpoolFailed'||_0x8d5111[_0xf50c('0x3b')]==='h')return;if(_0x8d5111[_0xf50c('0x2d')]===_0x8d5111['linkedid']||this['blindTransfers'][_0x8d5111[_0xf50c('0x32')]]){_0x8d5111[_0xf50c('0x51')]=_0x8d5111['application']?_0x8d5111[_0xf50c('0x51')][_0xf50c('0x52')]():undefined;_0x8d5111[_0xf50c('0x53')]=_0x8d5111[_0xf50c('0x54')]||_0x8d5111[_0xf50c('0x53')];if(_0x8d5111[_0xf50c('0x54')]&&_0x8d5111[_0xf50c('0x51')]!=='queue'){_0x8d5111[_0xf50c('0x53')]=_0x8d5111[_0xf50c('0x53')]['toLowerCase']();}logger[_0xf50c('0x25')](_0xf50c('0x55'),_0x8d5111[_0xf50c('0x2d')],_0x8d5111['application'],_0x8d5111['applicationdata']);if(_[_0xf50c('0x33')](this[_0xf50c('0x13')][_0x8d5111['uniqueid']])){this['channels'][_0x8d5111[_0xf50c('0x2d')]]=new Channel();this[_0xf50c('0x13')][_0x8d5111[_0xf50c('0x2d')]][_0xf50c('0x48')]=_0x8d5111[_0xf50c('0x56')]?moment()[_0xf50c('0x57')](moment[_0xf50c('0x56')](_0x8d5111[_0xf50c('0x56')])['seconds'](),'seconds')[_0xf50c('0x3e')](_0xf50c('0x49')):moment()['format'](_0xf50c('0x49'));this[_0xf50c('0x13')][_0x8d5111['uniqueid']][_0xf50c('0x4a')]=_0xf50c('0xc');}_[_0xf50c('0x34')](this['channels'][_0x8d5111[_0xf50c('0x2d')]],_[_0xf50c('0x35')](_0x8d5111,_['keys'](this['channels'][_0x8d5111[_0xf50c('0x2d')]])));if(_[_0xf50c('0x58')](applications,_0x8d5111[_0xf50c('0x51')])){this[_0xf50c('0x13')][_0x8d5111[_0xf50c('0x2d')]]['lastapplication']=_0x8d5111[_0xf50c('0x51')];this[_0xf50c('0x13')][_0x8d5111[_0xf50c('0x2d')]][_0xf50c('0x59')]=_0x8d5111[_0xf50c('0x53')];if(_0x8d5111['application']===_0xf50c('0x8')&&_[_0xf50c('0x5a')](_0x8d5111[_0xf50c('0x53')][_0xf50c('0x52')](),'cdr(')){var _0x46d6ff=_0x8d5111['applicationdata'][_0xf50c('0x3a')]('=');var _0x13d18b=_0x46d6ff[0x0][_0xf50c('0x52')]()['match'](/cdr\((.*)\)/);if(_0x13d18b){if(_0x13d18b[0x1]===_0xf50c('0x5b')&&!_[_0xf50c('0x5c')](this[_0xf50c('0x13')][_0x8d5111[_0xf50c('0x2d')]][_0x13d18b[0x1]]))return;this['channels'][_0x8d5111[_0xf50c('0x2d')]][_0x13d18b[0x1]]=_0x46d6ff[0x1];}}else if(_0x8d5111[_0xf50c('0x51')]==='queue'){this['channels'][_0x8d5111[_0xf50c('0x2d')]][_0xf50c('0x9')]=_0x8d5111['applicationdata'][_0xf50c('0x3a')](',')[0x0];}}}}}catch(_0x3613c8){logger[_0xf50c('0x28')](_0xf50c('0x5d'),_0x8d5111['uniqueid'],util[_0xf50c('0x31')](_0x3613c8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf50c('0x2a')][_0xf50c('0x1b')]=function(_0x42b0dc){try{if(this[_0xf50c('0x2b')](_0x42b0dc)){logger[_0xf50c('0x25')](_0xf50c('0x5e'),_0x42b0dc[_0xf50c('0x2d')],_0x42b0dc[_0xf50c('0x32')],_0x42b0dc[_0xf50c('0x2e')],_0x42b0dc[_0xf50c('0x2f')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x42b0dc[_0xf50c('0x2d')],util['inspect'](_0x42b0dc,{'showHidden':![],'depth':null}));if(_0x42b0dc[_0xf50c('0x4c')]!=='6')return;var _0x4584ec=this['agents'][_0x42b0dc[_0xf50c('0x39')]['split']('-')[0x0]];if(_0x42b0dc[_0xf50c('0x2d')]!==_0x42b0dc[_0xf50c('0x32')]){var _0x5121aa=moment();if(this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]]){if(!this['channels'][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x5f')]){this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x5f')]=!![];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]]['answertime']=_0x5121aa[_0xf50c('0x3e')](_0xf50c('0x49'));if(this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x48')]){this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]]['holdtime']=_0x5121aa[_0xf50c('0x60')](this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x48')],_0xf50c('0x61'));}}this['channels'][_0x42b0dc['linkedid']][_0xf50c('0x32')]=_0x42b0dc[_0xf50c('0x2d')];if(_0x42b0dc[_0xf50c('0x2f')]!==_0xf50c('0x3c')){this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]]['connectedlinenum']=_0x42b0dc['calleridnum'];}this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]]['connectedlinename']=_0x42b0dc[_0xf50c('0x2e')];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]]['destinationchannel']=_0x42b0dc['channel'];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x4a')]=dispositions[_['toNumber'](_0x42b0dc[_0xf50c('0x4c')])];if(_0x4584ec){this['channels'][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x62')]=_0x4584ec['id'];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x63')]=_0x4584ec[_0xf50c('0x40')];}}if(this[_0xf50c('0x13')][_0x42b0dc['uniqueid']]){if(!this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x5f')]){this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x5f')]=!![];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x64')]=_0x5121aa['format'](_0xf50c('0x49'));if(this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x48')]){this[_0xf50c('0x13')][_0x42b0dc['uniqueid']][_0xf50c('0x65')]=_0x5121aa[_0xf50c('0x60')](this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x48')],'seconds');}}if(_0x42b0dc[_0xf50c('0x2f')]!==_0xf50c('0x3c')){this['channels'][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x3d')]=_0x42b0dc[_0xf50c('0x2f')];}this[_0xf50c('0x13')][_0x42b0dc['uniqueid']]['connectedlinename']=_0x42b0dc['calleridname'];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x66')]=_0x42b0dc[_0xf50c('0x39')];this['channels'][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x4a')]=dispositions[_[_0xf50c('0x4b')](_0x42b0dc[_0xf50c('0x4c')])];}}else{if(this['channels'][_0x42b0dc[_0xf50c('0x2d')]]){if(_0x4584ec){this['channels'][_0x42b0dc['uniqueid']][_0xf50c('0x62')]=_0x4584ec['id'];this[_0xf50c('0x13')][_0x42b0dc[_0xf50c('0x2d')]][_0xf50c('0x63')]=_0x4584ec[_0xf50c('0x40')];}}}if(_0x42b0dc[_0xf50c('0x37')]==='from-sip'){if(_0x4584ec){_0x4584ec[_0xf50c('0x4d')]=_0x42b0dc[_0xf50c('0x3b')];var _0x284fd7;if(this['channels'][_0x42b0dc[_0xf50c('0x2d')]]){_0x284fd7=this['channels'][_0x42b0dc['uniqueid']][_0xf50c('0x9')];}else if(this[_0xf50c('0x13')][_0x42b0dc['linkedid']]){_0x284fd7=this['channels'][_0x42b0dc[_0xf50c('0x32')]][_0xf50c('0x9')];}_0x4584ec[_0xf50c('0x9')]=_0x284fd7;var _0x22dd5a={'id':_0x4584ec['id'],'name':_0x4584ec['name'],'agentconnected':!![],'destaccountcode':_0x4584ec['accountcode'],'destconnectedlinenum':_0x42b0dc[_0xf50c('0x3b')],'queue':_0x284fd7||undefined,'uniqueid':_0x42b0dc[_0xf50c('0x32')]};logger[_0xf50c('0x30')](_0xf50c('0x67'),_0x42b0dc[_0xf50c('0x2d')],util[_0xf50c('0x31')](_0x22dd5a,{'showHidden':![],'depth':null}));this[_0xf50c('0x2c')](util[_0xf50c('0x3e')]('user:%s',_0x4584ec[_0xf50c('0x40')]),_0xf50c('0x41'),_0x22dd5a);}}}}catch(_0x25c01e){logger[_0xf50c('0x28')](_0xf50c('0x68'),_0x42b0dc['uniqueid'],util[_0xf50c('0x31')](_0x25c01e,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf50c('0x69')]=function(_0x193fae,_0x4527f9){try{if(this[_0xf50c('0x13')][_0x193fae]){logger[_0xf50c('0x25')](_0xf50c('0x6a'),_0x193fae,_0x4527f9);this[_0xf50c('0x13')][_0x193fae][_0xf50c('0x6b')]=!![];if(_['endsWith'](_0x4527f9,_0xf50c('0x6c'))){_0x4527f9=_0x4527f9[_0xf50c('0x6d')](_0xf50c('0x6c'),_0xf50c('0x6e'));}this[_0xf50c('0x13')][_0x193fae][_0xf50c('0x6f')]=_0x4527f9;var _0x298a4d=_['find'](this[_0xf50c('0x13')][_0x193fae][_0xf50c('0x70')],{'filename':_0x4527f9});if(_[_0xf50c('0x5c')](_0x298a4d)){this['channels'][_0x193fae][_0xf50c('0x70')][_0xf50c('0x71')]({'filename':_0x4527f9,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xf50c('0x72')});}}}catch(_0x52f0de){logger[_0xf50c('0x28')](_0xf50c('0x73'),_0x193fae,util[_0xf50c('0x31')](_0x52f0de,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf50c('0x2a')][_0xf50c('0x1d')]=function(_0x1bd53b){try{if(this[_0xf50c('0x2b')](_0x1bd53b)){logger[_0xf50c('0x30')](_0xf50c('0x74'),_0x1bd53b[_0xf50c('0x2d')],util['inspect'](_0x1bd53b,{'showHidden':![],'depth':null}));if(this[_0xf50c('0x13')][_0x1bd53b['uniqueid']]&&_0x1bd53b[_0xf50c('0x39')]!=_0xf50c('0x45')){if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')])){if(this[_0xf50c('0x2b')](_0x1bd53b['variable']['mixmonitor_filename'])){logger[_0xf50c('0x25')](_0xf50c('0x76'),_0x1bd53b['uniqueid'],_0x1bd53b[_0xf50c('0x77')]);this[_0xf50c('0x69')](_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b[_0xf50c('0x77')]);}else if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x78')])){logger[_0xf50c('0x25')](_0xf50c('0x79'),_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b[_0xf50c('0x77')]);this[_0xf50c('0x13')][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x2f')]=_0x1bd53b['value'];}else if(this[_0xf50c('0x2b')](_0x1bd53b['variable']['xmd-callerid'])){logger[_0xf50c('0x25')](_0xf50c('0x7a'),_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b[_0xf50c('0x77')]);this['channels'][_0x1bd53b[_0xf50c('0x2d')]]['callerid']=_0x1bd53b[_0xf50c('0x77')];}else if(this['isNotNull'](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x7b')])){logger[_0xf50c('0x25')](_0xf50c('0x7c'),_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b['value']);this['channels'][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x5b')]=_0x1bd53b[_0xf50c('0x77')];}else if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x7d')])){logger[_0xf50c('0x25')](_0xf50c('0x7e'),_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b[_0xf50c('0x77')][_0xf50c('0x3a')](',')[0x0]);this[_0xf50c('0x13')][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x9')]=_0x1bd53b[_0xf50c('0x77')][_0xf50c('0x3a')](',')[0x0];}else if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x7f')])){logger[_0xf50c('0x25')](_0xf50c('0x80'),_0x1bd53b['uniqueid'],_0x1bd53b[_0xf50c('0x77')]);this[_0xf50c('0x13')][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x81')]=_0x1bd53b[_0xf50c('0x77')];}else if(this[_0xf50c('0x2b')](_0x1bd53b['variable'][_0xf50c('0x82')])){logger[_0xf50c('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x1bd53b['uniqueid'],_0x1bd53b[_0xf50c('0x77')]);this['channels'][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x83')]=_0x1bd53b[_0xf50c('0x77')];}else if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x84')])){logger[_0xf50c('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b[_0xf50c('0x77')]);this[_0xf50c('0x13')][_0x1bd53b[_0xf50c('0x2d')]]['calleridpreview']=_0x1bd53b[_0xf50c('0x77')];}else if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x85')])){logger[_0xf50c('0x25')](_0xf50c('0x86'),_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b['value']);this['channels'][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x9')]=_0x1bd53b[_0xf50c('0x77')];}else if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x87')])){logger[_0xf50c('0x25')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x1bd53b[_0xf50c('0x2d')],_0x1bd53b[_0xf50c('0x77')]);this['channels'][_0x1bd53b[_0xf50c('0x2d')]][_0xf50c('0x88')]=_0x1bd53b['value'];}}}else if(this[_0xf50c('0x2b')](_0x1bd53b['variable'][_0xf50c('0x89')])){if(_0x1bd53b[_0xf50c('0x77')]){var _0x479f99=path[_0xf50c('0x8a')](_0x1bd53b[_0xf50c('0x77')])[_0xf50c('0x40')];logger[_0xf50c('0x25')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x479f99,_0x1bd53b[_0xf50c('0x77')]);this[_0xf50c('0x69')](_0x479f99,_0x1bd53b[_0xf50c('0x77')]);}}else if(this['channels'][_0x1bd53b['linkedid']]){if(this['isNotNull'](_0x1bd53b[_0xf50c('0x75')])){if(this[_0xf50c('0x2b')](_0x1bd53b[_0xf50c('0x75')][_0xf50c('0x87')])){logger[_0xf50c('0x25')](_0xf50c('0x8b'),_0x1bd53b['linkedid'],_0x1bd53b[_0xf50c('0x77')]);this[_0xf50c('0x13')][_0x1bd53b[_0xf50c('0x32')]][_0xf50c('0x8c')]=_0x1bd53b[_0xf50c('0x77')];}}}}}catch(_0x273579){logger[_0xf50c('0x28')](_0xf50c('0x8d'),_0x1bd53b[_0xf50c('0x2d')],util[_0xf50c('0x31')](_0x273579,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf50c('0x2a')][_0xf50c('0x1f')]=function(_0xe69bb2){try{if(this['isNotNull'](_0xe69bb2)){logger['debug'](_0xf50c('0x8e'),_0xe69bb2[_0xf50c('0x2d')],util[_0xf50c('0x31')](_0xe69bb2,{'showHidden':![],'depth':null}));if(this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]]){if(this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x32')]]){this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2['linkedid']][_0xf50c('0x32')]][_0xf50c('0x2d')]=_0xe69bb2[_0xf50c('0x2d')];this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2['linkedid']][_0xf50c('0x32')]][_0xf50c('0x5f')]=this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]][_0xf50c('0x5f')];this[_0xf50c('0x13')][this['blindTransfers'][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x32')]][_0xf50c('0x64')]=this[_0xf50c('0x13')][_0xe69bb2['uniqueid']][_0xf50c('0x64')];this[_0xf50c('0x13')][this['blindTransfers'][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x32')]][_0xf50c('0x66')]=this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x32')]][_0xf50c('0x39')];this[_0xf50c('0x13')][this['blindTransfers'][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x32')]][_0xf50c('0x4a')]=this['channels'][_0xe69bb2['uniqueid']]['disposition'];this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]]=this['channels'][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]]['linkedid']];this[_0xf50c('0x8f')](this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x32')]);}else if(this['channels'][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]]){this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]]['uniqueid']=[this[_0xf50c('0x13')][this['blindTransfers'][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]]['linkedid'],this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]][_0xf50c('0x32')]=this['channels'][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]][_0xf50c('0x2d')]][0x0];this['channels'][this['blindTransfers'][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]]['answered']=this['channels'][_0xe69bb2[_0xf50c('0x2d')]]['answered'];this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]]['uniqueid']][_0xf50c('0x64')]=this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]][_0xf50c('0x64')];this['channels'][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]][_0xf50c('0x66')]=this['channels'][this[_0xf50c('0x46')][_0xe69bb2['linkedid']][_0xf50c('0x2d')]][_0xf50c('0x39')];this[_0xf50c('0x13')][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]][_0xf50c('0x4a')]=this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]][_0xf50c('0x4a')];this['channels'][_0xe69bb2['uniqueid']]=this['channels'][this[_0xf50c('0x46')][_0xe69bb2[_0xf50c('0x32')]][_0xf50c('0x2d')]];this['deleteChannelAfterTimeout'](this['blindTransfers'][_0xe69bb2[_0xf50c('0x32')]]['uniqueid']);}}if(this[_0xf50c('0x13')][_0xe69bb2['uniqueid']]){logger['info'](_0xf50c('0x90'),_0xe69bb2['uniqueid'],_0xe69bb2['cause-txt']);var _0x4d6163=moment();this[_0xf50c('0x13')][_0xe69bb2['uniqueid']][_0xf50c('0x91')]=_0x4d6163['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xf50c('0x13')][_0xe69bb2['uniqueid']]['duration']=_0x4d6163[_0xf50c('0x60')](this[_0xf50c('0x13')][_0xe69bb2['uniqueid']][_0xf50c('0x48')],_0xf50c('0x61'));if(this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]][_0xf50c('0x5f')]){this['channels'][_0xe69bb2[_0xf50c('0x2d')]][_0xf50c('0x92')]=_0x4d6163[_0xf50c('0x60')](this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]][_0xf50c('0x64')],_0xf50c('0x61'));this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]]['holdtime']=this[_0xf50c('0x13')][_0xe69bb2[_0xf50c('0x2d')]]['duration']-this[_0xf50c('0x13')][_0xe69bb2['uniqueid']][_0xf50c('0x92')];}if(_0xe69bb2[_0xf50c('0x37')]===_0xf50c('0x38')){if(this[_0xf50c('0x14')][_0xe69bb2['channel'][_0xf50c('0x3a')]('-')[0x0]]){this[_0xf50c('0x14')][_0xe69bb2[_0xf50c('0x39')][_0xf50c('0x3a')]('-')[0x0]]=_[_0xf50c('0x93')](this['agents'][_0xe69bb2['channel'][_0xf50c('0x3a')]('-')[0x0]],[_0xf50c('0x4d')]);logger[_0xf50c('0x30')](_0xf50c('0x94'),_0xe69bb2[_0xf50c('0x2d')],util[_0xf50c('0x31')]({'id':this['agents'][_0xe69bb2[_0xf50c('0x39')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xf50c('0x14')][_0xe69bb2[_0xf50c('0x39')][_0xf50c('0x3a')]('-')[0x0]][_0xf50c('0x42')]},{'showHidden':![],'depth':null}));this[_0xf50c('0x2c')](util[_0xf50c('0x3e')](_0xf50c('0x3f'),this[_0xf50c('0x14')][_0xe69bb2[_0xf50c('0x39')][_0xf50c('0x3a')]('-')[0x0]][_0xf50c('0x40')]),'user:agentcomplete',{'id':this[_0xf50c('0x14')][_0xe69bb2['channel'][_0xf50c('0x3a')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xe69bb2[_0xf50c('0x39')][_0xf50c('0x3a')]('-')[0x0]][_0xf50c('0x42')]});for(var _0x3236c7=0x0;_0x3236c7{delete this['channels'][_0x147945];},_0x5f42c1);}};module[_0xf50c('0xc4')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f4e4b8c..742b873 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5715=['prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','channels','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','omit','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','lastIndexOf','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','keys','variable','outboundrouteid','value','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','starttime','seconds','complete','total','answered','holdtime','billableseconds','sumHoldTime','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','ioredis','../../../config/logger','ami','../ami','redis','defaults','localhost','outbound','applications','variables','dialbegin','syncDialBegin','bind','syncDialEnd','varset','syncVarSet','hangup','syncHangup','isNotNull','isUndefined'];(function(_0x122e11,_0x23aed6){var _0x45388d=function(_0x5b8893){while(--_0x5b8893){_0x122e11['push'](_0x122e11['shift']());}};_0x45388d(++_0x23aed6);}(_0x5715,0xd4));var _0x5571=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0x5715[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0x5571('0x0'));var moment=require(_0x5571('0x1'));var util=require('util');var Redis=require(_0x5571('0x2'));var config=require('../../../config/environment');var logger=require(_0x5571('0x3'))(_0x5571('0x4'));var ami=require(_0x5571('0x5'));config[_0x5571('0x6')]=_[_0x5571('0x7')](config[_0x5571('0x6')],{'host':_0x5571('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5571('0x6')]));function VoiceDialReport(_0x1409f5){this['channels']=_0x1409f5['outboundChannels'];this[_0x5571('0x9')]=_0x1409f5[_0x5571('0x9')];this[_0x5571('0xa')]={};this[_0x5571('0xb')]={};ami['on'](_0x5571('0xc'),this[_0x5571('0xd')][_0x5571('0xe')](this));ami['on']('dialend',this[_0x5571('0xf')][_0x5571('0xe')](this));ami['on'](_0x5571('0x10'),this[_0x5571('0x11')][_0x5571('0xe')](this));ami['on'](_0x5571('0x12'),this[_0x5571('0x13')][_0x5571('0xe')](this));}VoiceDialReport['prototype'][_0x5571('0x14')]=function(_0x434272){return _0x434272!==null&&!_[_0x5571('0x15')](_0x434272);};VoiceDialReport[_0x5571('0x16')][_0x5571('0x17')]=function(_0x4ab197,_0x1958ca,_0x4c91cc){io['to'](_0x4ab197)['emit'](_0x1958ca,_0x4c91cc);};VoiceDialReport[_0x5571('0x16')][_0x5571('0xd')]=function(_0x35474a){try{if(this['isNotNull'](_0x35474a)){logger[_0x5571('0x18')](_0x5571('0x19'),_0x35474a[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x35474a,{'showHidden':![],'depth':null}));if(this['channels'][_0x35474a[_0x5571('0x1a')]]){_[_0x5571('0x1c')](this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]],{'starttime':moment()['format'](_0x5571('0x1e')),'lastevent':_0x5571('0x1f'),'interface':_0x35474a[_0x5571('0x20')]['substring'](0x0,_0x35474a[_0x5571('0x20')]['lastIndexOf']('-')),'membername':_0x35474a['channel'][_0x5571('0x21')](_0x35474a[_0x5571('0x20')]['lastIndexOf']('/')+0x1,_0x35474a[_0x5571('0x20')]['lastIndexOf']('-'))},_[_0x5571('0x22')](_0x35474a,['event','privilege']));logger[_0x5571('0x23')](_0x5571('0x24'),_0x35474a['uniqueid'],this[_0x5571('0x1d')][_0x35474a['uniqueid']][_0x5571('0x25')],this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]][_0x5571('0x26')]);logger[_0x5571('0x18')](_0x5571('0x27'),_0x35474a[_0x5571('0x1a')],util[_0x5571('0x1b')](this['channels'][_0x35474a[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x5571('0xa')][_0x35474a[_0x5571('0x1a')]])_[_0x5571('0x1c')](this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]],this['applications'][_0x35474a['uniqueid']]);this['emit'](_0x5571('0x28'),_0x5571('0x29'),this['channels'][_0x35474a['uniqueid']]);logger[_0x5571('0x18')](_0x5571('0x2a'),_0x35474a['uniqueid'],util['inspect'](this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x2b'),this[_0x5571('0x1d')][_0x35474a[_0x5571('0x1a')]]);}}}catch(_0x2208d9){logger[_0x5571('0x2c')](_0x5571('0x2d'),_0x35474a[_0x5571('0x1a')],util['inspect'](_0x2208d9,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0xf')]=function(_0x38d27b){try{if(this[_0x5571('0x14')](_0x38d27b)){logger[_0x5571('0x18')](_0x5571('0x2e'),_0x38d27b['uniqueid'],util['inspect'](_0x38d27b,{'showHidden':![],'depth':null}));if(this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]){this[_0x5571('0x1d')][_0x38d27b['uniqueid']][_0x5571('0x2f')]=_0x38d27b[_0x5571('0x2f')];if(_0x38d27b['dialstatus']==='ANSWER'){this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]['connectedlinenum']=_0x38d27b[_0x5571('0x30')];this['channels'][_0x38d27b[_0x5571('0x1a')]][_0x5571('0x31')]=_0x38d27b['connectedlinename'];this['channels'][_0x38d27b['uniqueid']][_0x5571('0x32')]=moment()[_0x5571('0x33')](_0x5571('0x1e'));this[_0x5571('0x1d')][_0x38d27b['uniqueid']][_0x5571('0x34')]='connect';logger[_0x5571('0x23')](_0x5571('0x35'),_0x38d27b[_0x5571('0x1a')],_0x38d27b[_0x5571('0x20')][_0x5571('0x21')](_0x38d27b[_0x5571('0x20')]['lastIndexOf']('/')+0x1,_0x38d27b[_0x5571('0x20')][_0x5571('0x36')]('-')));logger['debug'](_0x5571('0x37'),_0x38d27b['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x38d27b['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x38'),this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]);}logger[_0x5571('0x18')](_0x5571('0x39'),_0x38d27b[_0x5571('0x1a')],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this[_0x5571('0x17')](_0x5571('0x28'),_0x5571('0x29'),this[_0x5571('0x1d')][_0x38d27b[_0x5571('0x1a')]]);}}}catch(_0x18b68c){logger[_0x5571('0x2c')]('[%s][voiceDialReport][dialend]',_0x38d27b['uniqueid'],util[_0x5571('0x1b')](_0x18b68c,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x11')]=function(_0x4c4af9){try{if(this[_0x5571('0x14')](_0x4c4af9)){logger[_0x5571('0x18')](_0x5571('0x3a'),_0x4c4af9[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x4c4af9,{'showHidden':![],'depth':null}));this['addVariable'](_0x4c4af9[_0x5571('0x1a')],_[_0x5571('0x3b')](_0x4c4af9['variable'])[0x0],_0x4c4af9['value']);if(this[_0x5571('0x14')](_0x4c4af9[_0x5571('0x3c')])&&this[_0x5571('0x14')](_0x4c4af9[_0x5571('0x3c')][_0x5571('0x3d')])){if(_[_0x5571('0x15')](this['channels'][_0x4c4af9[_0x5571('0x1a')]])){this[_0x5571('0x1d')][_0x4c4af9[_0x5571('0x1a')]]={'routeId':_0x4c4af9[_0x5571('0x3e')],'variables':this['variables'][_0x4c4af9[_0x5571('0x1a')]],'motionChannel':'voice'};logger[_0x5571('0x23')](_0x5571('0x3f'),_0x4c4af9['uniqueid'],_0x4c4af9[_0x5571('0x3c')]['outboundrouteid'],_[_0x5571('0x3b')](_0x4c4af9['variable'])[0x0],_0x4c4af9[_0x5571('0x3e')]);logger[_0x5571('0x18')]('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x4c4af9['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4c4af9[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this[_0x5571('0x17')]('voice:outbound',_0x5571('0x29'),this[_0x5571('0x1d')][_0x4c4af9['uniqueid']]);}}}}catch(_0xf5e32d){logger[_0x5571('0x2c')](_0x5571('0x40'),_0x4c4af9[_0x5571('0x1a')],util[_0x5571('0x1b')](_0xf5e32d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x41')]=function(_0x2a350f,_0x844968,_0x1dc296){var _0xe491d=[_0x5571('0x42'),_0x5571('0x43'),_0x5571('0x44'),'rtpaudioqosjitterbridged',_0x5571('0x45'),_0x5571('0x46'),_0x5571('0x47'),'rtpaudioqosrttbridged',_0x5571('0x48'),_0x5571('0x49'),'bridgepeer',_0x5571('0x4a'),'membercalls',_0x5571('0x4b'),_0x5571('0x4c'),_0x5571('0x4d'),_0x5571('0x25'),_0x5571('0x4e'),_0x5571('0x4f')];if(!_['isNil'](_0x844968)&&!_['includes'](_0xe491d,_0x844968)){if(_['isUndefined'](this[_0x5571('0xb')][_0x2a350f])){this['variables'][_0x2a350f]={};}this[_0x5571('0xb')][_0x2a350f][_0x844968]=_0x1dc296;}};VoiceDialReport[_0x5571('0x16')]['syncHangup']=function(_0x4565b2){try{if(this[_0x5571('0x14')](_0x4565b2)){logger[_0x5571('0x18')](_0x5571('0x50'),_0x4565b2[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x4565b2,{'showHidden':![],'depth':null}));if(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]){logger[_0x5571('0x23')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x4565b2[_0x5571('0x1a')],_0x4565b2[_0x5571('0x51')]);this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x52')]=moment()['format'](_0x5571('0x1e'));this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x53')]=moment(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x52')])[_0x5571('0x54')](this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x55')],_0x5571('0x56'));this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x34')]=_0x5571('0x57');this[_0x5571('0x9')][_0x5571('0x58')]+=0x1;if(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]['answertime']){this[_0x5571('0x9')][_0x5571('0x59')]+=0x1;this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x5a')]=moment(this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x32')])[_0x5571('0x54')](this[_0x5571('0x1d')][_0x4565b2['uniqueid']]['starttime'],'seconds');this[_0x5571('0x1d')][_0x4565b2['uniqueid']][_0x5571('0x5b')]=moment(this[_0x5571('0x1d')][_0x4565b2['uniqueid']][_0x5571('0x52')])['diff'](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x32')],'seconds');this[_0x5571('0x9')][_0x5571('0x5c')]+=this['channels'][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x5a')]||0x0;this['outbound']['sumBillable']+=this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x5b')];}this[_0x5571('0x9')][_0x5571('0x5d')]+=this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]][_0x5571('0x53')];logger['debug'](_0x5571('0x5e'),_0x4565b2['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x5f'),this[_0x5571('0x1d')][_0x4565b2['uniqueid']]);logger[_0x5571('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4565b2['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x5571('0x17')](_0x5571('0x60'),this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]);logger[_0x5571('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x4565b2[_0x5571('0x1a')],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this['emit'](_0x5571('0x28'),'voice_outbound:save',this[_0x5571('0x9')]);logger[_0x5571('0x23')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x5571('0x61')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]]));logger[_0x5571('0x18')](_0x5571('0x62'),_0x4565b2['uniqueid'],util[_0x5571('0x1b')](this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x1a')]],{'showHidden':![],'depth':null}));this[_0x5571('0x17')]('voice:outbound',_0x5571('0x63'),this[_0x5571('0x1d')][_0x4565b2['uniqueid']]);this[_0x5571('0x64')](_0x4565b2[_0x5571('0x1a')]);}else if(this[_0x5571('0x1d')][_0x4565b2['linkedid']]){this['channels'][_0x4565b2[_0x5571('0x65')]]['uniqueid']=this[_0x5571('0x1d')][_0x4565b2[_0x5571('0x65')]][_0x5571('0x66')];}if(this[_0x5571('0xb')][_0x4565b2[_0x5571('0x1a')]]){delete this['variables'][_0x4565b2[_0x5571('0x1a')]];}}}catch(_0x583c5d){logger[_0x5571('0x2c')](_0x5571('0x67'),_0x4565b2['uniqueid'],util['inspect'](_0x583c5d,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x68')]=function(_0x4b69a2){try{if(this[_0x5571('0x14')](_0x4b69a2)){logger[_0x5571('0x18')](_0x5571('0x69'),_0x4b69a2[_0x5571('0x1a')],util[_0x5571('0x1b')](_0x4b69a2,{'showHidden':![],'depth':null}));if(_0x4b69a2[_0x5571('0x6a')][_0x5571('0x6b')]()===_0x5571('0x6c')){_0x4b69a2[_0x5571('0x6d')]=(_0x4b69a2[_0x5571('0x6e')]||_0x4b69a2['applicationdata'])[_0x5571('0x6b')]();if(_[_0x5571('0x6f')](_0x4b69a2[_0x5571('0x6d')],_0x5571('0x70'))){if(_[_0x5571('0x15')](this[_0x5571('0xa')][_0x4b69a2[_0x5571('0x1a')]]))this[_0x5571('0xa')][_0x4b69a2['uniqueid']]={};logger[_0x5571('0x23')](_0x5571('0x71'),_0x4b69a2[_0x5571('0x1a')],_0x4b69a2['application'],_0x4b69a2[_0x5571('0x6d')]);var _0x451a43=_0x4b69a2[_0x5571('0x6d')]['split']('=');var _0x38cc1f=_0x451a43[0x0][_0x5571('0x72')](/cdr\((.*)\)/);if(_0x38cc1f)this[_0x5571('0xa')][_0x4b69a2['uniqueid']][_0x38cc1f[0x1]]=_0x451a43[0x1];}}}}catch(_0x2dc1c8){logger[_0x5571('0x2c')](_0x5571('0x73'),_0x4b69a2[_0x5571('0x1a')],util['inspect'](_0x2dc1c8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5571('0x16')][_0x5571('0x64')]=function(_0x51f656,_0x4081d0=0x2710){if(this[_0x5571('0x1d')][_0x51f656]){setTimeout(()=>{delete this[_0x5571('0x1d')][_0x51f656];},_0x4081d0);}};module[_0x5571('0x74')]=VoiceDialReport; \ No newline at end of file +var _0xb748=['emit','debug','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss','called','substring','channel','lastIndexOf','event','info','membername','interface','voice:outbound','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','seconds','holdtime','diff','starttime','billableseconds','sumHoldTime','sumBillable','sumDuration','duration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','toLowerCase','set','applicationdata','appdata','startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','[%s][voiceDialReport][newexten]','deleteChannelAfterTimeout','exports','lodash','moment','util','../../../config/environment','ami','defaults','redis','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','hangup','syncHangup','prototype','isNotNull','isUndefined'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb748,0xd7));var _0x8b74=function(_0x382cab,_0x2673d6){_0x382cab=_0x382cab-0x0;var _0x47a3b5=_0xb748[_0x382cab];return _0x47a3b5;};'use strict';var _=require(_0x8b74('0x0'));var moment=require(_0x8b74('0x1'));var util=require(_0x8b74('0x2'));var Redis=require('ioredis');var config=require(_0x8b74('0x3'));var logger=require('../../../config/logger')(_0x8b74('0x4'));var ami=require('../ami');config['redis']=_[_0x8b74('0x5')](config[_0x8b74('0x6')],{'host':_0x8b74('0x7'),'port':0x18eb});var io=require(_0x8b74('0x8'))(new Redis(config['redis']));function VoiceDialReport(_0xe9e7ef){this[_0x8b74('0x9')]=_0xe9e7ef[_0x8b74('0xa')];this[_0x8b74('0xb')]=_0xe9e7ef[_0x8b74('0xb')];this[_0x8b74('0xc')]={};this[_0x8b74('0xd')]={};ami['on'](_0x8b74('0xe'),this[_0x8b74('0xf')]['bind'](this));ami['on'](_0x8b74('0x10'),this[_0x8b74('0x11')][_0x8b74('0x12')](this));ami['on'](_0x8b74('0x13'),this['syncVarSet'][_0x8b74('0x12')](this));ami['on'](_0x8b74('0x14'),this[_0x8b74('0x15')][_0x8b74('0x12')](this));}VoiceDialReport[_0x8b74('0x16')][_0x8b74('0x17')]=function(_0xa037af){return _0xa037af!==null&&!_[_0x8b74('0x18')](_0xa037af);};VoiceDialReport[_0x8b74('0x16')][_0x8b74('0x19')]=function(_0x26ad46,_0x4d34bb,_0x294997){io['to'](_0x26ad46)[_0x8b74('0x19')](_0x4d34bb,_0x294997);};VoiceDialReport[_0x8b74('0x16')][_0x8b74('0xf')]=function(_0x171ca7){try{if(this[_0x8b74('0x17')](_0x171ca7)){logger[_0x8b74('0x1a')]('[%s][voiceDialReport][dialbegin]\x20event:',_0x171ca7[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x171ca7,{'showHidden':![],'depth':null}));if(this['channels'][_0x171ca7[_0x8b74('0x1b')]]){_[_0x8b74('0x1d')](this[_0x8b74('0x9')][_0x171ca7[_0x8b74('0x1b')]],{'starttime':moment()['format'](_0x8b74('0x1e')),'lastevent':_0x8b74('0x1f'),'interface':_0x171ca7['channel'][_0x8b74('0x20')](0x0,_0x171ca7[_0x8b74('0x21')][_0x8b74('0x22')]('-')),'membername':_0x171ca7[_0x8b74('0x21')][_0x8b74('0x20')](_0x171ca7['channel']['lastIndexOf']('/')+0x1,_0x171ca7[_0x8b74('0x21')][_0x8b74('0x22')]('-'))},_['omit'](_0x171ca7,[_0x8b74('0x23'),'privilege']));logger[_0x8b74('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x171ca7['uniqueid'],this[_0x8b74('0x9')][_0x171ca7[_0x8b74('0x1b')]][_0x8b74('0x25')],this[_0x8b74('0x9')][_0x171ca7[_0x8b74('0x1b')]][_0x8b74('0x26')]);logger[_0x8b74('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:',_0x171ca7[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this[_0x8b74('0x9')][_0x171ca7[_0x8b74('0x1b')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x171ca7[_0x8b74('0x1b')]])_[_0x8b74('0x1d')](this['channels'][_0x171ca7['uniqueid']],this['applications'][_0x171ca7[_0x8b74('0x1b')]]);this[_0x8b74('0x19')](_0x8b74('0x27'),'voice_outbound_channel:save',this['channels'][_0x171ca7[_0x8b74('0x1b')]]);logger[_0x8b74('0x1a')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x171ca7[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this[_0x8b74('0x9')][_0x171ca7[_0x8b74('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x8b74('0x19')](_0x8b74('0x28'),this[_0x8b74('0x9')][_0x171ca7[_0x8b74('0x1b')]]);}}}catch(_0x40ddab){logger[_0x8b74('0x29')](_0x8b74('0x2a'),_0x171ca7['uniqueid'],util[_0x8b74('0x1c')](_0x40ddab,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8b74('0x16')]['syncDialEnd']=function(_0xa25303){try{if(this['isNotNull'](_0xa25303)){logger[_0x8b74('0x1a')](_0x8b74('0x2b'),_0xa25303[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0xa25303,{'showHidden':![],'depth':null}));if(this[_0x8b74('0x9')][_0xa25303[_0x8b74('0x1b')]]){this['channels'][_0xa25303[_0x8b74('0x1b')]][_0x8b74('0x2c')]=_0xa25303[_0x8b74('0x2c')];if(_0xa25303['dialstatus']===_0x8b74('0x2d')){this[_0x8b74('0x9')][_0xa25303[_0x8b74('0x1b')]]['connectedlinenum']=_0xa25303[_0x8b74('0x2e')];this['channels'][_0xa25303[_0x8b74('0x1b')]][_0x8b74('0x2f')]=_0xa25303['connectedlinename'];this[_0x8b74('0x9')][_0xa25303['uniqueid']][_0x8b74('0x30')]=moment()[_0x8b74('0x31')](_0x8b74('0x1e'));this[_0x8b74('0x9')][_0xa25303['uniqueid']][_0x8b74('0x32')]=_0x8b74('0x33');logger[_0x8b74('0x24')](_0x8b74('0x34'),_0xa25303[_0x8b74('0x1b')],_0xa25303[_0x8b74('0x21')][_0x8b74('0x20')](_0xa25303[_0x8b74('0x21')][_0x8b74('0x22')]('/')+0x1,_0xa25303[_0x8b74('0x21')][_0x8b74('0x22')]('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xa25303['uniqueid'],util[_0x8b74('0x1c')](this['channels'][_0xa25303['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8b74('0x19')](_0x8b74('0x35'),this[_0x8b74('0x9')][_0xa25303[_0x8b74('0x1b')]]);}logger[_0x8b74('0x1a')](_0x8b74('0x36'),_0xa25303[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this[_0x8b74('0x9')][_0xa25303['uniqueid']],{'showHidden':![],'depth':null}));this[_0x8b74('0x19')](_0x8b74('0x27'),'voice_outbound_channel:save',this['channels'][_0xa25303[_0x8b74('0x1b')]]);}}}catch(_0x39ae15){logger[_0x8b74('0x29')](_0x8b74('0x37'),_0xa25303[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x39ae15,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x8b74('0x38')]=function(_0x59e78f){try{if(this[_0x8b74('0x17')](_0x59e78f)){logger['debug'](_0x8b74('0x39'),_0x59e78f[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x59e78f,{'showHidden':![],'depth':null}));this[_0x8b74('0x3a')](_0x59e78f[_0x8b74('0x1b')],_[_0x8b74('0x3b')](_0x59e78f[_0x8b74('0x3c')])[0x0],_0x59e78f[_0x8b74('0x3d')]);if(this[_0x8b74('0x17')](_0x59e78f['variable'])&&this[_0x8b74('0x17')](_0x59e78f[_0x8b74('0x3c')]['outboundrouteid'])){if(_['isUndefined'](this[_0x8b74('0x9')][_0x59e78f[_0x8b74('0x1b')]])){this[_0x8b74('0x9')][_0x59e78f['uniqueid']]={'routeId':_0x59e78f[_0x8b74('0x3d')],'variables':this[_0x8b74('0xd')][_0x59e78f[_0x8b74('0x1b')]],'motionChannel':_0x8b74('0x3e')};logger[_0x8b74('0x24')](_0x8b74('0x3f'),_0x59e78f[_0x8b74('0x1b')],_0x59e78f['variable'][_0x8b74('0x40')],_[_0x8b74('0x3b')](_0x59e78f[_0x8b74('0x3c')])[0x0],_0x59e78f[_0x8b74('0x3d')]);logger['debug'](_0x8b74('0x41'),_0x59e78f['uniqueid'],util['inspect'](this[_0x8b74('0x9')][_0x59e78f[_0x8b74('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8b74('0x19')]('voice:outbound',_0x8b74('0x42'),this[_0x8b74('0x9')][_0x59e78f[_0x8b74('0x1b')]]);}}}}catch(_0x2da7b6){logger[_0x8b74('0x29')]('[%s][voiceDialReport][varset]',_0x59e78f[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x2da7b6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8b74('0x16')]['addVariable']=function(_0x31b67e,_0x3a6eaa,_0x4a7a0c){var _0x2349f9=[_0x8b74('0x43'),_0x8b74('0x44'),_0x8b74('0x45'),_0x8b74('0x46'),_0x8b74('0x47'),'rtpaudioqoslossbridged',_0x8b74('0x48'),_0x8b74('0x49'),'sipcallid',_0x8b74('0x4a'),'bridgepeer',_0x8b74('0x4b'),_0x8b74('0x4c'),_0x8b74('0x4d'),_0x8b74('0x4e'),_0x8b74('0x4f'),_0x8b74('0x25'),_0x8b74('0x50'),'memberrealtime'];if(!_[_0x8b74('0x51')](_0x3a6eaa)&&!_[_0x8b74('0x52')](_0x2349f9,_0x3a6eaa)){if(_['isUndefined'](this[_0x8b74('0xd')][_0x31b67e])){this[_0x8b74('0xd')][_0x31b67e]={};}this['variables'][_0x31b67e][_0x3a6eaa]=_0x4a7a0c;}};VoiceDialReport[_0x8b74('0x16')][_0x8b74('0x15')]=function(_0x454545){try{if(this[_0x8b74('0x17')](_0x454545)){logger['debug'](_0x8b74('0x53'),_0x454545['uniqueid'],util[_0x8b74('0x1c')](_0x454545,{'showHidden':![],'depth':null}));if(this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]]){logger[_0x8b74('0x24')](_0x8b74('0x54'),_0x454545[_0x8b74('0x1b')],_0x454545[_0x8b74('0x55')]);this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x56')]=moment()['format'](_0x8b74('0x1e'));this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]]['duration']=moment(this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]]['endtime'])['diff'](this[_0x8b74('0x9')][_0x454545['uniqueid']]['starttime'],_0x8b74('0x57'));this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x32')]='complete';this['outbound']['total']+=0x1;if(this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x30')]){this[_0x8b74('0xb')]['answered']+=0x1;this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x58')]=moment(this['channels'][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x30')])[_0x8b74('0x59')](this[_0x8b74('0x9')][_0x454545['uniqueid']][_0x8b74('0x5a')],'seconds');this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x5b')]=moment(this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x56')])[_0x8b74('0x59')](this['channels'][_0x454545['uniqueid']][_0x8b74('0x30')],_0x8b74('0x57'));this[_0x8b74('0xb')][_0x8b74('0x5c')]+=this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x58')]||0x0;this[_0x8b74('0xb')][_0x8b74('0x5d')]+=this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x5b')];}this[_0x8b74('0xb')][_0x8b74('0x5e')]+=this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]][_0x8b74('0x5f')];logger[_0x8b74('0x1a')](_0x8b74('0x60'),_0x454545[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this[_0x8b74('0x9')][_0x454545['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8b74('0x19')](_0x8b74('0x61'),this[_0x8b74('0x9')][_0x454545['uniqueid']]);logger[_0x8b74('0x1a')](_0x8b74('0x62'),_0x454545[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x8b74('0x19')](_0x8b74('0x63'),this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]]);logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x454545[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this['channels'][_0x454545[_0x8b74('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8b74('0x19')](_0x8b74('0x27'),'voice_outbound:save',this['outbound']);logger[_0x8b74('0x24')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0x8b74('0x64')](this[_0x8b74('0x9')][_0x454545['uniqueid']]));logger[_0x8b74('0x1a')](_0x8b74('0x65'),_0x454545[_0x8b74('0x1b')],util[_0x8b74('0x1c')](this[_0x8b74('0x9')][_0x454545[_0x8b74('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0x8b74('0x27'),_0x8b74('0x66'),this['channels'][_0x454545[_0x8b74('0x1b')]]);this['deleteChannelAfterTimeout'](_0x454545[_0x8b74('0x1b')]);}else if(this[_0x8b74('0x9')][_0x454545[_0x8b74('0x67')]]){this['channels'][_0x454545[_0x8b74('0x67')]][_0x8b74('0x1b')]=this[_0x8b74('0x9')][_0x454545['linkedid']][_0x8b74('0x68')];}if(this[_0x8b74('0xd')][_0x454545[_0x8b74('0x1b')]]){delete this[_0x8b74('0xd')][_0x454545[_0x8b74('0x1b')]];}}}catch(_0x3d8cd4){logger[_0x8b74('0x29')](_0x8b74('0x69'),_0x454545[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x3d8cd4,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8b74('0x16')][_0x8b74('0x6a')]=function(_0x38b574){try{if(this[_0x8b74('0x17')](_0x38b574)){logger[_0x8b74('0x1a')]('[%s][voiceDialReport][newexten]\x20event:',_0x38b574[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x38b574,{'showHidden':![],'depth':null}));if(_0x38b574['application'][_0x8b74('0x6b')]()===_0x8b74('0x6c')){_0x38b574[_0x8b74('0x6d')]=(_0x38b574[_0x8b74('0x6e')]||_0x38b574[_0x8b74('0x6d')])[_0x8b74('0x6b')]();if(_[_0x8b74('0x6f')](_0x38b574[_0x8b74('0x6d')],_0x8b74('0x70'))){if(_[_0x8b74('0x18')](this[_0x8b74('0xc')][_0x38b574[_0x8b74('0x1b')]]))this[_0x8b74('0xc')][_0x38b574[_0x8b74('0x1b')]]={};logger[_0x8b74('0x24')](_0x8b74('0x71'),_0x38b574[_0x8b74('0x1b')],_0x38b574[_0x8b74('0x72')],_0x38b574[_0x8b74('0x6d')]);var _0x31a25e=_0x38b574[_0x8b74('0x6d')][_0x8b74('0x73')]('=');var _0x404232=_0x31a25e[0x0][_0x8b74('0x74')](/cdr\((.*)\)/);if(_0x404232)this[_0x8b74('0xc')][_0x38b574[_0x8b74('0x1b')]][_0x404232[0x1]]=_0x31a25e[0x1];}}}}catch(_0x4fdf00){logger['error'](_0x8b74('0x75'),_0x38b574[_0x8b74('0x1b')],util[_0x8b74('0x1c')](_0x4fdf00,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8b74('0x16')][_0x8b74('0x76')]=function(_0x3894f2,_0x12b4f2=0x2710){if(this['channels'][_0x3894f2]){setTimeout(()=>{delete this[_0x8b74('0x9')][_0x3894f2];},_0x12b4f2);}};module[_0x8b74('0x77')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 03abcd2..1429f4a 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4e46=['[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','assigned','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','transfertype','FORWARD','transferexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','handleHangup','length','sumHoldTime','diff','sumDuration','milliseconds','total','answered','sumBillable','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfereeuniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','localhost','socket.io-emitter','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','queuesummary','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete','bind','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','hangup','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','isEmpty','originated','hasOwnProperty','talking','pTalking','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','prototype','clearZombieChannels','switch','isNil','channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','variables','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emit','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','voice_queue_presence:save','emitVoiceQueueChannelRemove','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','type','inbound','name','voice_queue:save','isNotNull','isUndefined','Action','queues','catch','[voiceQueueReport][queues]','isRunning','then','actionid','[voiceQueueReport][queuesummary]','summaryEvent','createReport','handleInboundQueueSummaryReport','assign','queuestatus','queue','outbound','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','keys','[%s][voiceQueueReport][queuecallerjoin]','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','info','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','syncQueueCallerLeave','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','COMPLETEDBYAGENT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e46,0x68));var _0x64e4=function(_0x209d87,_0x203554){_0x209d87=_0x209d87-0x0;var _0x17eeb3=_0x4e46[_0x209d87];return _0x17eeb3;};'use strict';var _=require(_0x64e4('0x0'));var moment=require(_0x64e4('0x1'));var util=require(_0x64e4('0x2'));var Redis=require('ioredis');var config=require(_0x64e4('0x3'));var logger=require(_0x64e4('0x4'))(_0x64e4('0x5'));var ami=require(_0x64e4('0x6'));var QueueReport=require(_0x64e4('0x7'));var VoiceQueueSummary=require(_0x64e4('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x64e4('0x9'),'port':0x18eb});var io=require(_0x64e4('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence['prototype'][_0x64e4('0xb')]=function(_0x20a681){this[_0x64e4('0xc')]=this['tail']?this[_0x64e4('0xc')][_0x64e4('0xd')](_0x20a681):_0x20a681();};function VoiceQueueReport(_0x4d5b4c){this[_0x64e4('0xe')]=new Sequence();this[_0x64e4('0xf')]={};this[_0x64e4('0x10')]=_0x4d5b4c;this[_0x64e4('0x11')]=_0x4d5b4c[_0x64e4('0x11')];this[_0x64e4('0x12')]=_0x4d5b4c[_0x64e4('0x13')];this[_0x64e4('0x14')]=_0x4d5b4c['voiceQueues'];this['campaigns']=_0x4d5b4c[_0x64e4('0x15')];this[_0x64e4('0x16')]=initializeSummary();this['variables']={};ami['on'](_0x64e4('0x17'),this[_0x64e4('0x18')]['bind'](this));ami['on'](_0x64e4('0x19'),this[_0x64e4('0x1a')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x1c'),this[_0x64e4('0x1d')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x1e'),this[_0x64e4('0x1f')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x20'),this[_0x64e4('0x21')]['bind'](this));ami['on'](_0x64e4('0x22'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0x64e4('0x23'),this['syncQueueCallerLeave'][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x24'),this[_0x64e4('0x25')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x26'),this[_0x64e4('0x27')]['bind'](this));ami['on'](_0x64e4('0x28'),this[_0x64e4('0x29')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x2a'),this[_0x64e4('0x2b')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x2c'),this[_0x64e4('0x2d')][_0x64e4('0x1b')](this));ami['on']('musiconholdstart',this[_0x64e4('0x2e')][_0x64e4('0x1b')](this));ami['on'](_0x64e4('0x2f'),this[_0x64e4('0x30')]['bind'](this));ami['on']('attendedtransfer',this[_0x64e4('0x31')][_0x64e4('0x1b')](this));ami['on']('blindtransfer',this[_0x64e4('0x32')]['bind'](this));this[_0x64e4('0x33')]();this[_0x64e4('0x34')]();}function clearChannels(_0x3233f3){if(!_[_0x64e4('0x35')](_0x3233f3)){for(var _0x3bee4d in _0x3233f3){if(_0x3233f3['hasOwnProperty'](_0x3bee4d)){delete _0x3233f3[_0x3bee4d];}}}}function clearCampaigns(_0x1ea84f){if(!_[_0x64e4('0x35')](_0x1ea84f)){for(var _0x29ecbd in _0x1ea84f){if(_0x1ea84f['hasOwnProperty'](_0x29ecbd)){_0x1ea84f[_0x29ecbd][_0x64e4('0x36')]=0x0;}}}}function clearVoiceQueues(_0x205e29){if(!_['isEmpty'](_0x205e29)){for(var _0x1e8ff5 in _0x205e29){if(_0x205e29[_0x64e4('0x37')](_0x1e8ff5)){_0x205e29[_0x1e8ff5][_0x64e4('0x36')]=0x0;_0x205e29[_0x1e8ff5][_0x64e4('0x38')]=0x0;_0x205e29[_0x1e8ff5][_0x64e4('0x39')]=0x0;_0x205e29[_0x1e8ff5]['waiting']=0x0;_0x205e29[_0x1e8ff5][_0x64e4('0x3a')]=!![];}}}}function clearAgentBooked(_0x315dd9){if(!_[_0x64e4('0x35')](_0x315dd9)){for(var _0x114ff6 in _0x315dd9){if(_0x315dd9['hasOwnProperty'](_0x114ff6)){_0x315dd9[_0x114ff6][_0x64e4('0x3b')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x2a39cb){return _0x2a39cb[_0x64e4('0x3c')]||_0x2a39cb[_0x64e4('0x22')]||_0x2a39cb[_0x64e4('0x3d')];}VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x3f')]=function(){var _0x51c6dd=this;for(var _0x42d90f in this['channels']){if(this[_0x64e4('0x12')]['hasOwnProperty'](_0x42d90f)&&!this[_0x64e4('0x12')][_0x42d90f][_0x64e4('0x40')]){this[_0x64e4('0xe')]['enqueue'](function(){if(!_[_0x64e4('0x41')](_0x51c6dd[_0x64e4('0x12')][_0x42d90f])){return ami['Action']({'action':'status','channel':_0x51c6dd[_0x64e4('0x12')][_0x42d90f][_0x64e4('0x42')]})['catch'](function(_0xb1f020){if(_0xb1f020['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x51c6dd[_0x64e4('0x12')][_0x42d90f]){delete _0x51c6dd['channels'][_0x42d90f];logger[_0x64e4('0x43')]('[%s][voiceQueueReport][checkChannel]',_0x42d90f,util[_0x64e4('0x44')](_0xb1f020,{'showHidden':![],'depth':null}));}if(_0x51c6dd[_0x64e4('0xf')][_0x42d90f]){delete _0x51c6dd[_0x64e4('0xf')][_0x42d90f];logger[_0x64e4('0x43')](_0x64e4('0x45'),_0x42d90f,util[_0x64e4('0x44')](_0xb1f020,{'showHidden':![],'depth':null}));}if(_0x51c6dd[_0x64e4('0x46')][_0x42d90f]){delete _0x51c6dd[_0x64e4('0x46')][_0x42d90f];logger[_0x64e4('0x43')]('[%s][voiceQueueReport][checkVariables]',_0x42d90f,util[_0x64e4('0x44')](_0xb1f020,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x64e4('0x3e')]['syncFullyBooted']=function(){logger[_0x64e4('0x43')](_0x64e4('0x47'));clearChannels(this[_0x64e4('0x12')]);this[_0x64e4('0x48')](this[_0x64e4('0xf')]);clearAgentBooked(this[_0x64e4('0x11')]);clearVoiceQueues(this[_0x64e4('0x14')]);clearCampaigns(this[_0x64e4('0x15')]);this['summary']=initializeSummary();};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x48')]=function(_0x324038){var _0x33a209=this;if(!_[_0x64e4('0x35')](_0x324038)){for(var _0x467598 in _0x324038){if(_0x324038[_0x64e4('0x37')](_0x467598)){_0x33a209['emitVoiceQueueChannelRemove'](_0x324038[_0x467598],'clearqueuereport');delete _0x324038[_0x467598];}}}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x49')]=function(_0x35ed1f,_0x5914ca,_0x1d4f65){io['to'](_0x35ed1f)[_0x64e4('0x49')](_0x5914ca,_0x1d4f65);};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x4a')]=function(_0x17cf5c,_0x3d63fd){logger['debug']('[%s][voiceQueueReport]['+_0x3d63fd+_0x64e4('0x4b'),_0x17cf5c[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x17cf5c,{'showHidden':![],'depth':null}));this[_0x64e4('0x49')](util[_0x64e4('0x4d')](_0x64e4('0x4e'),_0x17cf5c['queue']),'voice_queue_channel:save',_0x17cf5c);io[_0x64e4('0x49')](_0x64e4('0x4f'),_0x17cf5c);};VoiceQueueReport['prototype'][_0x64e4('0x50')]=function(_0x23102c,_0x3718d4){logger[_0x64e4('0x51')](_0x64e4('0x52')+_0x3718d4+_0x64e4('0x53'),_0x23102c[_0x64e4('0x4c')],util['inspect'](_0x23102c,{'showHidden':![],'depth':null}));if(_0x23102c[_0x64e4('0x54')]===_0x64e4('0x55')){return;}this[_0x64e4('0x49')](util[_0x64e4('0x4d')](_0x64e4('0x4e'),_0x23102c['queue']),_0x64e4('0x56'),_0x23102c);io[_0x64e4('0x49')](_0x64e4('0x57'),_0x23102c);};VoiceQueueReport['prototype']['emitInboundVoiceQueueSummary']=function(_0x3e7d98){if(_0x3e7d98[_0x64e4('0x58')]===_0x64e4('0x59')){logger[_0x64e4('0x51')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x64e4('0x44')](_0x3e7d98,{'showHidden':![],'depth':null}));this[_0x64e4('0x49')](util[_0x64e4('0x4d')](_0x64e4('0x4e'),_0x3e7d98[_0x64e4('0x5a')]),_0x64e4('0x5b'),_0x3e7d98);}};VoiceQueueReport['prototype'][_0x64e4('0x5c')]=function(_0x38ddb2){return _0x38ddb2!==null&&!_[_0x64e4('0x5d')](_0x38ddb2);};VoiceQueueReport[_0x64e4('0x3e')]['loopQueueShow']=function(){var _0x33ebc3=this;setInterval(function(){_0x33ebc3['clearZombieChannels']();ami[_0x64e4('0x5e')]({'action':_0x64e4('0x5f')})[_0x64e4('0x60')](function(_0x353f39){logger['error'](_0x64e4('0x61'),util[_0x64e4('0x44')](_0x353f39,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x33')]=function(){var _0x442cc0=this;setInterval(function(){if(!_0x442cc0['summary'][_0x64e4('0x62')]){return ami[_0x64e4('0x5e')]({'action':_0x64e4('0x17')})[_0x64e4('0x63')](function(_0x261565){_0x442cc0[_0x64e4('0x16')]['id']=_0x261565[_0x64e4('0x64')];_0x442cc0[_0x64e4('0x16')]['isRunning']=!![];_0x442cc0['summary']['queuestatus'][_0x261565[_0x64e4('0x64')]]={};})[_0x64e4('0x60')](function(_0x376392){logger[_0x64e4('0x43')](_0x64e4('0x65'),util[_0x64e4('0x44')](_0x376392,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype']['createQueueSummaryReport']=function(_0x221d05,_0x37abae){var _0x9aa769;if(this['summary']&&this[_0x64e4('0x16')][_0x64e4('0x5f')]&&this['summary'][_0x64e4('0x5f')][_0x221d05['name']]){_0x9aa769=this['summary']['queues'][_0x221d05[_0x64e4('0x5a')]][_0x64e4('0x66')];}var _0x30cf08=new VoiceQueueSummary(_0x221d05);return _0x30cf08[_0x64e4('0x67')](_0x37abae['agents'],this[_0x64e4('0x11')],_0x9aa769,this[_0x64e4('0x10')][_0x64e4('0x12')]);};VoiceQueueReport['prototype'][_0x64e4('0x68')]=function(_0x2291ff,_0x3ffdb2){var _0x5883c1=this['createQueueSummaryReport'](_0x2291ff,_0x3ffdb2);var _0x78b348=![];_0x78b348=_0x5883c1['compareToInboundQueue'](_0x2291ff);if(_0x78b348){Object[_0x64e4('0x69')](_0x2291ff,_0x5883c1);this['realtime'][_0x64e4('0x14')][_0x2291ff['name']]=_0x2291ff;this['emitInboundVoiceQueueSummary'](_0x5883c1);}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x1f')]=function(_0x6e1b35){var _0x1bfaa7=null;var _0x57f036=this[_0x64e4('0x16')]['id'];if(this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x57f036]){_0x1bfaa7=this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x57f036][_0x6e1b35['actionid']];}if(!_0x1bfaa7){this['summary']=initializeSummary();return;}var _0x292d66=this['voiceQueues'][_0x1bfaa7[_0x64e4('0x6b')]];if(_0x292d66['type']===_0x64e4('0x59')){this[_0x64e4('0x68')](_0x292d66,_0x1bfaa7);}else if(_0x292d66[_0x64e4('0x58')]===_0x64e4('0x6c')){var _0x724ee2=this['createQueueSummaryReport'](_0x292d66,_0x1bfaa7);ami[_0x64e4('0x49')](_0x64e4('0x6d'),_0x724ee2);}this[_0x64e4('0x16')][_0x64e4('0x6e')]-=0x1;var _0x49359f=this[_0x64e4('0x16')][_0x64e4('0x6e')]>0x0?!![]:![];if(!_0x49359f){return this[_0x64e4('0x1a')](this[_0x64e4('0x16')][_0x64e4('0x6f')]);}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x1d')]=function(_0x533f6d){var _0x446012=this[_0x64e4('0x16')]['id'];if(this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x446012]&&this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x446012][_0x533f6d[_0x64e4('0x64')]]){this[_0x64e4('0x16')][_0x64e4('0x6a')][_0x446012][_0x533f6d['actionid']][_0x64e4('0x11')][_0x64e4('0x70')](_0x533f6d);}};VoiceQueueReport[_0x64e4('0x3e')]['syncQueueSummary']=function(_0x519817){var _0x1d64aa=this;try{if(this['isNotNull'](_0x519817)&&this[_0x64e4('0x5c')](_0x519817[_0x64e4('0x6b')])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util[_0x64e4('0x44')](_0x519817,{'showHidden':![],'depth':null}));var _0xf2e17f=this[_0x64e4('0x14')][_0x519817[_0x64e4('0x6b')]];if(_0xf2e17f){logger[_0x64e4('0x51')](_0x64e4('0x71'),_0xf2e17f[_0x64e4('0x5a')]);this['summary'][_0x64e4('0x5f')][_0xf2e17f[_0x64e4('0x5a')]]={'summaryEvent':_0x519817};this[_0x64e4('0x16')]['statusRequests']+=0x1;return ami[_0x64e4('0x5e')]({'action':'queuestatus','queue':_0xf2e17f['name']})[_0x64e4('0x63')](function(_0x4ef929){if(!_0x1d64aa[_0x64e4('0x16')][_0x64e4('0x6a')][_0x519817[_0x64e4('0x64')]]){_0x1d64aa[_0x64e4('0x16')][_0x64e4('0x6a')][_0x519817[_0x64e4('0x64')]]={};}_0x1d64aa[_0x64e4('0x16')][_0x64e4('0x6a')][_0x519817[_0x64e4('0x64')]][_0x4ef929[_0x64e4('0x64')]]={'queue':_0xf2e17f[_0x64e4('0x5a')],'agents':[]};})[_0x64e4('0x60')](function(_0x216451){throw _0x216451;});}}}catch(_0x16d78b){logger[_0x64e4('0x43')](_0x64e4('0x65'),util[_0x64e4('0x44')](_0x16d78b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x1a')]=function(_0x452775){if(this[_0x64e4('0x16')][_0x64e4('0x6e')]>0x0){this['summary'][_0x64e4('0x6f')]=_0x452775;return;}logger[_0x64e4('0x51')](_0x64e4('0x72'),util[_0x64e4('0x44')](_0x452775,{'showHidden':![],'depth':null}));this[_0x64e4('0x16')]=initializeSummary();ami['emit'](_0x64e4('0x73'),{});};VoiceQueueReport['prototype'][_0x64e4('0x21')]=function(_0x4562db){try{if(this[_0x64e4('0x5c')](_0x4562db)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][queuecallerjoin]',_0x4562db[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x4562db,{'showHidden':![],'depth':null}));if(_[_0x64e4('0x5d')](this[_0x64e4('0xf')][_0x4562db[_0x64e4('0x4c')]])){this['queueReports'][_0x4562db[_0x64e4('0x4c')]]=[];}if(_[_0x64e4('0x5d')](this[_0x64e4('0x12')][_0x4562db['uniqueid']])){this[_0x64e4('0x12')][_0x4562db[_0x64e4('0x4c')]]={};}var _0x315d5a=new QueueReport();_0x315d5a[_0x64e4('0x6b')]=_0x4562db['queue'];_0x315d5a['type']=this[_0x64e4('0x14')][_0x315d5a[_0x64e4('0x6b')]]&&this[_0x64e4('0x14')][_0x315d5a[_0x64e4('0x6b')]]['type']?this[_0x64e4('0x14')][_0x315d5a[_0x64e4('0x6b')]]['type']||_0x64e4('0x59'):_0x64e4('0x59');_0x315d5a[_0x64e4('0x74')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x315d5a[_0x64e4('0x76')]=_0x4562db['position'];_0x315d5a[_0x64e4('0x77')]=_0x4562db[_0x64e4('0x77')];_0x315d5a[_0x64e4('0x4c')]=_0x4562db['uniqueid'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x315d5a[_0x64e4('0x6b')],_0x315d5a['type']);Object['assign'](_0x315d5a,_['pick'](_0x4562db,_[_0x64e4('0x78')](_0x315d5a)));this[_0x64e4('0xf')][_0x4562db['uniqueid']][_0x64e4('0x70')](_0x315d5a);this[_0x64e4('0x12')][_0x4562db[_0x64e4('0x4c')]]=_0x315d5a;this[_0x64e4('0x4a')](_0x315d5a,_0x64e4('0x20'));}}catch(_0x444ea9){logger[_0x64e4('0x43')](_0x64e4('0x79'),_0x4562db[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x444ea9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x7a')]=function(_0x283b6a){try{if(this[_0x64e4('0x5c')](_0x283b6a)){logger['debug'](_0x64e4('0x7b'),_0x283b6a[_0x64e4('0x4c')],util['inspect'](_0x283b6a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x283b6a[_0x64e4('0x4c')]]){var _0x443ae8=_[_0x64e4('0x7c')](this[_0x64e4('0xf')][_0x283b6a[_0x64e4('0x4c')]]);_0x443ae8[_0x64e4('0x3d')]=![];_0x443ae8['queuecallercompleteAt']=null;_0x443ae8[_0x64e4('0x7d')]=_0x283b6a[_0x64e4('0x7d')];_0x443ae8['originalposition']=_0x283b6a[_0x64e4('0x7e')];_0x443ae8[_0x64e4('0x22')]=!![];_0x443ae8[_0x64e4('0x7f')]=moment()[_0x64e4('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');_0x443ae8[_0x64e4('0x54')]=_0x64e4('0x80');_0x443ae8[_0x64e4('0x81')]=null;logger[_0x64e4('0x82')](_0x64e4('0x83'),_0x443ae8['queue'],_0x443ae8[_0x64e4('0x58')]);this[_0x64e4('0x12')][_0x283b6a['uniqueid']]=_0x443ae8;this['emitVoiceQueueChannelRemove'](_0x443ae8,_0x64e4('0x22'));}}}catch(_0x21ad53){logger[_0x64e4('0x43')](_0x64e4('0x7b'),_0x283b6a[_0x64e4('0x4c')],util['inspect'](_0x21ad53,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x64e4('0x84')]=function(_0x4d5838){try{if(this[_0x64e4('0x5c')](_0x4d5838)){logger[_0x64e4('0x51')](_0x64e4('0x85'),_0x4d5838[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x4d5838,{'showHidden':![],'depth':null}));if(this[_0x64e4('0xf')][_0x4d5838[_0x64e4('0x4c')]]){var _0x3d1363=_[_0x64e4('0x7c')](this[_0x64e4('0xf')][_0x4d5838[_0x64e4('0x4c')]]);_0x3d1363['queuecallerleaveAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x3d1363['connectedlinenum']=_0x4d5838[_0x64e4('0x86')];_0x3d1363[_0x64e4('0x87')]=_0x4d5838[_0x64e4('0x87')];logger[_0x64e4('0x82')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3d1363['queue'],_0x3d1363['type'],_0x4d5838[_0x64e4('0x86')],_0x4d5838[_0x64e4('0x87')]);this[_0x64e4('0x12')][_0x4d5838[_0x64e4('0x4c')]]=_0x3d1363;this[_0x64e4('0x4a')](_0x3d1363,_0x64e4('0x23'));}}}catch(_0x3c5f78){logger[_0x64e4('0x43')](_0x64e4('0x85'),_0x4d5838[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x3c5f78,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x64e4('0x27')]=function(_0x4d12fc){try{if(this[_0x64e4('0x5c')](_0x4d12fc)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][agentconnect]',_0x4d12fc[_0x64e4('0x4c')],util['inspect'](_0x4d12fc,{'showHidden':![],'depth':null}));if(this[_0x64e4('0xf')][_0x4d12fc[_0x64e4('0x4c')]]){var _0x4cb103=_['last'](this[_0x64e4('0xf')][_0x4d12fc[_0x64e4('0x4c')]]);_0x4cb103[_0x64e4('0x3d')]=!![];_0x4cb103[_0x64e4('0x54')]=_0x64e4('0x88');logger[_0x64e4('0x82')](_0x64e4('0x89'),_0x4cb103[_0x64e4('0x6b')],_0x4cb103[_0x64e4('0x58')]);}}}catch(_0x5ea95d){logger[_0x64e4('0x43')](_0x64e4('0x8a'),_0x4d12fc[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x5ea95d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x25')]=function(_0x31c0c7){try{if(this[_0x64e4('0x5c')](_0x31c0c7)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][agentcomplete]',_0x31c0c7[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x31c0c7,{'showHidden':![],'depth':null}));if(this[_0x64e4('0xf')][_0x31c0c7['uniqueid']]){var _0x4d40f2=_['last'](this['queueReports'][_0x31c0c7[_0x64e4('0x4c')]]);_0x4d40f2[_0x64e4('0x22')]=![];_0x4d40f2[_0x64e4('0x7f')]=null;_0x4d40f2[_0x64e4('0x8b')]=!![];_0x4d40f2[_0x64e4('0x81')]=_0x31c0c7[_0x64e4('0x8c')];_0x4d40f2[_0x64e4('0x7d')]=_0x31c0c7[_0x64e4('0x7d')];_0x4d40f2[_0x64e4('0x3d')]=!![];_0x4d40f2[_0x64e4('0x3c')]=![];_0x4d40f2['queuecallerexitAt']=null;if(!_0x4d40f2[_0x64e4('0x8d')]){if(_0x31c0c7[_0x64e4('0x8e')]==_0x64e4('0x8d')){_0x4d40f2[_0x64e4('0x54')]=_0x64e4('0x8f');logger[_0x64e4('0x82')](_0x64e4('0x90'),_0x4d40f2['queue'],_0x4d40f2['type']);}else{if(_[_0x64e4('0x91')](_0x31c0c7[_0x64e4('0x42')][_0x64e4('0x92')](),_0x64e4('0x93'))){if(this[_0x64e4('0xf')][_0x31c0c7['linkedid']]){var _0x21da38=_[_0x64e4('0x7c')](this['queueReports'][_0x31c0c7[_0x64e4('0x94')]]);_0x21da38[_0x64e4('0x3d')]=![];_0x21da38[_0x64e4('0x3c')]=!![];_0x21da38[_0x64e4('0x95')]=moment(_0x4d40f2[_0x64e4('0x74')])[_0x64e4('0x96')](_0x31c0c7[_0x64e4('0x7d')],_0x64e4('0x97'))['format'](_0x64e4('0x75'));_0x21da38[_0x64e4('0x54')]='FORWARDTRANSFER';_0x21da38[_0x64e4('0x8d')]=!![];_0x21da38[_0x64e4('0x98')]=_0x64e4('0x99');_0x21da38[_0x64e4('0x9a')]=_0x31c0c7['destexten'];_0x21da38['transferuniqueid']=_0x31c0c7[_0x64e4('0x4c')];logger[_0x64e4('0x82')](_0x64e4('0x9b'),_0x21da38[_0x64e4('0x6b')],_0x21da38['type']);var _0x37eebf=this[_0x64e4('0xf')][_0x31c0c7[_0x64e4('0x94')]];this[_0x64e4('0xf')][_0x31c0c7[_0x64e4('0x94')]]=this['queueReports'][_0x31c0c7[_0x64e4('0x4c')]];this[_0x64e4('0xf')][_0x31c0c7['uniqueid']]=_0x37eebf;}}else{_0x4d40f2[_0x64e4('0x54')]=_0x64e4('0x9c')+_0x31c0c7[_0x64e4('0x8e')][_0x64e4('0x9d')]();logger[_0x64e4('0x82')](_0x64e4('0x9e'),_0x4d40f2[_0x64e4('0x6b')],_0x4d40f2[_0x64e4('0x58')],_0x4d40f2[_0x64e4('0x54')]);}}}this[_0x64e4('0x12')][_0x31c0c7[_0x64e4('0x4c')]]=_0x4d40f2;}}}catch(_0x9dbbbf){logger[_0x64e4('0x43')]('[%s][voiceQueueReport][agentcomplete]',_0x31c0c7[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x9dbbbf,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')][_0x64e4('0x29')]=function(_0x85d36b){try{if(this['isNotNull'](_0x85d36b)){logger[_0x64e4('0x51')]('[%s][voiceQueueReport][varset]',_0x85d36b[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x85d36b,{'showHidden':![],'depth':null}));this[_0x64e4('0x9f')](_0x85d36b[_0x64e4('0x4c')],_[_0x64e4('0x78')](_0x85d36b[_0x64e4('0xa0')])[0x0],_0x85d36b[_0x64e4('0xa1')]);if(this['queueReports'][_0x85d36b[_0x64e4('0x4c')]]){var _0x2347f0=_[_0x64e4('0x7c')](this[_0x64e4('0xf')][_0x85d36b['uniqueid']]);if(_0x2347f0){if(this[_0x64e4('0x5c')](_0x85d36b[_0x64e4('0xa0')])&&this['isNotNull'](_0x85d36b[_0x64e4('0xa0')]['queuestatus'])){switch(_0x85d36b[_0x64e4('0xa1')]){case _0x64e4('0xa2'):_0x2347f0[_0x64e4('0x3c')]=![];_0x2347f0['queuecallerexitAt']=null;break;case _0x64e4('0xa3'):_0x2347f0[_0x64e4('0xa4')]=_0x64e4('0xa5');_0x2347f0[_0x64e4('0x3c')]=!![];_0x2347f0['queuecallerexitAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x2347f0['queuecallerleaveAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));logger[_0x64e4('0x51')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x85d36b[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x2347f0,{'showHidden':![],'depth':null}));ami[_0x64e4('0x49')](_0x64e4('0xa6'),_0x2347f0);break;default:_0x2347f0[_0x64e4('0x3c')]=!![];_0x2347f0['queuecallerexitAt']=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x2347f0[_0x64e4('0xa7')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));}_0x2347f0[_0x64e4('0x22')]=![];_0x2347f0[_0x64e4('0x7f')]=null;_0x2347f0[_0x64e4('0x54')]=_0x85d36b[_0x64e4('0xa1')];this[_0x64e4('0x12')][_0x85d36b['uniqueid']]=_0x2347f0;this[_0x64e4('0x50')](_0x2347f0,_0x64e4('0x28'));}else if(this['isNotNull'](_0x85d36b['variable'])&&this[_0x64e4('0x5c')](_0x85d36b[_0x64e4('0xa0')]['queueposition'])){if(!_0x2347f0[_0x64e4('0x22')]){_0x2347f0[_0x64e4('0x3c')]=!![];_0x2347f0[_0x64e4('0x95')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));_0x2347f0[_0x64e4('0x54')]='EXITWITHKEY';_0x2347f0[_0x64e4('0xa7')]=moment()[_0x64e4('0x4d')](_0x64e4('0x75'));this[_0x64e4('0x12')][_0x85d36b[_0x64e4('0x4c')]]=_0x2347f0;}}logger[_0x64e4('0x82')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x85d36b['uniqueid'],_0x2347f0['queue'],_0x2347f0[_0x64e4('0x58')],_[_0x64e4('0x78')](_0x85d36b[_0x64e4('0xa0')])[0x0],_0x85d36b[_0x64e4('0xa1')]);_0x2347f0[_0x64e4('0x46')]=this[_0x64e4('0x46')][_0x85d36b['uniqueid']];}}}}catch(_0x3a4134){logger['error'](_0x64e4('0xa8'),_0x85d36b[_0x64e4('0x4c')],util[_0x64e4('0x44')](_0x3a4134,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x64e4('0x3e')]['addVariable']=function(_0x58bf0a,_0x53f38b,_0x55638c){var _0x87d324=[_0x64e4('0xa9'),'rtpaudioqosbridged',_0x64e4('0xaa'),_0x64e4('0xab'),'rtpaudioqosloss',_0x64e4('0xac'),_0x64e4('0xad'),_0x64e4('0xae'),_0x64e4('0xaf'),_0x64e4('0xb0'),_0x64e4('0xb1'),_0x64e4('0xb2'),_0x64e4('0xb3'),_0x64e4('0xb4'),_0x64e4('0xb5'),_0x64e4('0xb6'),_0x64e4('0x8c'),_0x64e4('0xb7'),_0x64e4('0xb8')];if(!_[_0x64e4('0x41')](_0x53f38b)&&!_['includes'](_0x87d324,_0x53f38b)){if(_[_0x64e4('0x5d')](this[_0x64e4('0x46')][_0x58bf0a])){this[_0x64e4('0x46')][_0x58bf0a]={};}this[_0x64e4('0x46')][_0x58bf0a][_0x53f38b]=_0x55638c;}};VoiceQueueReport['prototype'][_0x64e4('0xb9')]=function(_0x4778d3,_0x4a68db,_0x4e47a2){try{var _0x425788={};if(this[_0x64e4('0xf')][_0x4778d3]){for(var _0x28a206=0x0;_0x28a206{delete this[_0x64e4('0x12')][_0x5b8fbd];},_0x3518de);}};module[_0x64e4('0xf0')]=VoiceQueueReport; \ No newline at end of file +var _0x5eee=['queuecallerleaveAt','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','queuecallerexitAt','transfer','reason','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','keys','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','includes','length','diff','sumDuration','milliseconds','answered','sumBillable','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][hangup]','cause-txt','cause','handleHangup','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','origtransfererexten','origtransfereruniqueid','transfertargetuniqueid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','mohtime','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','set','appdata','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','split','match','[%s][voiceQueueReport][newexten]','exports','moment','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','bind','queuesummarycomplete','syncQueueSummaryComplete','queuemember','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','queuecallerexit','queuecallercomplete','clearZombieChannels','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','inspect','[%s][voiceQueueReport][checkQueueReport]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice:queue:%s','voice_queue_channel:remove','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice_queue:save','isNotNull','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','isRunning','queuesummary','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','name','summaryEvent','createReport','assign','emitInboundVoiceQueueSummary','syncQueueStatusComplete','handleInboundQueueSummaryReport','outbound','createQueueSummaryReport','custom:queuesummary','statusRequests','completeEvent','push','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','emitVoiceQueueChannelSave','syncQueueCallerAbandon','queuecallercompleteAt','holdtime','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerabandon]','last'];(function(_0x15c421,_0x6366f7){var _0x5e5ed5=function(_0x206e66){while(--_0x206e66){_0x15c421['push'](_0x15c421['shift']());}};_0x5e5ed5(++_0x6366f7);}(_0x5eee,0x163));var _0xe5ee=function(_0xf7b3d3,_0x3580d1){_0xf7b3d3=_0xf7b3d3-0x0;var _0x190db5=_0x5eee[_0xf7b3d3];return _0x190db5;};'use strict';var _=require('lodash');var moment=require(_0xe5ee('0x0'));var util=require('util');var Redis=require('ioredis');var config=require(_0xe5ee('0x1'));var logger=require(_0xe5ee('0x2'))(_0xe5ee('0x3'));var ami=require(_0xe5ee('0x4'));var QueueReport=require(_0xe5ee('0x5'));var VoiceQueueSummary=require(_0xe5ee('0x6'));config[_0xe5ee('0x7')]=_[_0xe5ee('0x8')](config[_0xe5ee('0x7')],{'host':_0xe5ee('0x9'),'port':0x18eb});var io=require(_0xe5ee('0xa'))(new Redis(config[_0xe5ee('0x7')]));var Sequence=function(){};Sequence[_0xe5ee('0xb')][_0xe5ee('0xc')]=function(_0x391220){this[_0xe5ee('0xd')]=this[_0xe5ee('0xd')]?this['tail'][_0xe5ee('0xe')](_0x391220):_0x391220();};function VoiceQueueReport(_0x470491){this[_0xe5ee('0xf')]=new Sequence();this[_0xe5ee('0x10')]={};this[_0xe5ee('0x11')]=_0x470491;this[_0xe5ee('0x12')]=_0x470491[_0xe5ee('0x12')];this[_0xe5ee('0x13')]=_0x470491[_0xe5ee('0x14')];this[_0xe5ee('0x15')]=_0x470491['voiceQueues'];this[_0xe5ee('0x16')]=_0x470491['campaigns'];this[_0xe5ee('0x17')]=initializeSummary();this[_0xe5ee('0x18')]={};ami['on']('queuesummary',this['syncQueueSummary'][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x1a'),this[_0xe5ee('0x1b')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x1c'),this[_0xe5ee('0x1d')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x1e'),this['syncQueueStatusComplete']['bind'](this));ami['on'](_0xe5ee('0x1f'),this[_0xe5ee('0x20')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x21'),this['syncQueueCallerAbandon'][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x22'),this[_0xe5ee('0x23')]['bind'](this));ami['on'](_0xe5ee('0x24'),this[_0xe5ee('0x25')][_0xe5ee('0x19')](this));ami['on']('agentconnect',this[_0xe5ee('0x26')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x27'),this['syncVarSet'][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x28'),this[_0xe5ee('0x29')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x2a'),this[_0xe5ee('0x2b')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x2c'),this[_0xe5ee('0x2d')][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x2e'),this[_0xe5ee('0x2f')][_0xe5ee('0x19')](this));ami['on']('attendedtransfer',this['syncAttendedTransfer'][_0xe5ee('0x19')](this));ami['on'](_0xe5ee('0x30'),this[_0xe5ee('0x31')][_0xe5ee('0x19')](this));this[_0xe5ee('0x32')]();this['loopQueueShow']();}function clearChannels(_0x49448d){if(!_[_0xe5ee('0x33')](_0x49448d)){for(var _0xdd538b in _0x49448d){if(_0x49448d[_0xe5ee('0x34')](_0xdd538b)){delete _0x49448d[_0xdd538b];}}}}function clearCampaigns(_0x92c476){if(!_[_0xe5ee('0x33')](_0x92c476)){for(var _0x5a4d47 in _0x92c476){if(_0x92c476[_0xe5ee('0x34')](_0x5a4d47)){_0x92c476[_0x5a4d47][_0xe5ee('0x35')]=0x0;}}}}function clearVoiceQueues(_0x5344db){if(!_[_0xe5ee('0x33')](_0x5344db)){for(var _0x5144c8 in _0x5344db){if(_0x5344db['hasOwnProperty'](_0x5144c8)){_0x5344db[_0x5144c8][_0xe5ee('0x35')]=0x0;_0x5344db[_0x5144c8]['talking']=0x0;_0x5344db[_0x5144c8]['pTalking']=0x0;_0x5344db[_0x5144c8]['waiting']=0x0;_0x5344db[_0x5144c8]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x30fea8){if(!_['isEmpty'](_0x30fea8)){for(var _0x5b7faa in _0x30fea8){if(_0x30fea8[_0xe5ee('0x34')](_0x5b7faa)){_0x30fea8[_0x5b7faa]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x5ed81a){return _0x5ed81a[_0xe5ee('0x36')]||_0x5ed81a['queuecallerabandon']||_0x5ed81a[_0xe5ee('0x37')];}VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x38')]=function(){var _0x401111=this;for(var _0x1e9652 in this[_0xe5ee('0x13')]){if(this[_0xe5ee('0x13')][_0xe5ee('0x34')](_0x1e9652)&&!this[_0xe5ee('0x13')][_0x1e9652]['switch']){this['sequence'][_0xe5ee('0xc')](function(){if(!_[_0xe5ee('0x39')](_0x401111[_0xe5ee('0x13')][_0x1e9652])){return ami[_0xe5ee('0x3a')]({'action':_0xe5ee('0x3b'),'channel':_0x401111[_0xe5ee('0x13')][_0x1e9652][_0xe5ee('0x3c')]})[_0xe5ee('0x3d')](function(_0x432a43){if(_0x432a43[_0xe5ee('0x3e')]===_0xe5ee('0x3f')){setTimeout(function(){if(_0x401111['channels'][_0x1e9652]){delete _0x401111[_0xe5ee('0x13')][_0x1e9652];logger[_0xe5ee('0x40')]('[%s][voiceQueueReport][checkChannel]',_0x1e9652,util[_0xe5ee('0x41')](_0x432a43,{'showHidden':![],'depth':null}));}if(_0x401111[_0xe5ee('0x10')][_0x1e9652]){delete _0x401111[_0xe5ee('0x10')][_0x1e9652];logger[_0xe5ee('0x40')](_0xe5ee('0x42'),_0x1e9652,util['inspect'](_0x432a43,{'showHidden':![],'depth':null}));}if(_0x401111[_0xe5ee('0x18')][_0x1e9652]){delete _0x401111['variables'][_0x1e9652];logger[_0xe5ee('0x40')]('[%s][voiceQueueReport][checkVariables]',_0x1e9652,util['inspect'](_0x432a43,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xe5ee('0xb')]['syncFullyBooted']=function(){logger[_0xe5ee('0x40')](_0xe5ee('0x43'));clearChannels(this['channels']);this[_0xe5ee('0x44')](this[_0xe5ee('0x10')]);clearAgentBooked(this[_0xe5ee('0x12')]);clearVoiceQueues(this[_0xe5ee('0x15')]);clearCampaigns(this[_0xe5ee('0x16')]);this[_0xe5ee('0x17')]=initializeSummary();};VoiceQueueReport[_0xe5ee('0xb')]['clearQueueReport']=function(_0x5a3347){var _0x465b57=this;if(!_['isEmpty'](_0x5a3347)){for(var _0x4494dd in _0x5a3347){if(_0x5a3347[_0xe5ee('0x34')](_0x4494dd)){_0x465b57[_0xe5ee('0x45')](_0x5a3347[_0x4494dd],_0xe5ee('0x46'));delete _0x5a3347[_0x4494dd];}}}};VoiceQueueReport[_0xe5ee('0xb')]['emit']=function(_0x4003a3,_0x164dec,_0x46281a){io['to'](_0x4003a3)[_0xe5ee('0x47')](_0x164dec,_0x46281a);};VoiceQueueReport['prototype']['emitVoiceQueueChannelSave']=function(_0x6fd1a,_0x2f1eeb){logger[_0xe5ee('0x48')](_0xe5ee('0x49')+_0x2f1eeb+_0xe5ee('0x4a'),_0x6fd1a[_0xe5ee('0x4b')],util['inspect'](_0x6fd1a,{'showHidden':![],'depth':null}));this[_0xe5ee('0x47')](util['format']('voice:queue:%s',_0x6fd1a[_0xe5ee('0x4c')]),_0xe5ee('0x4d'),_0x6fd1a);io[_0xe5ee('0x47')](_0xe5ee('0x4e'),_0x6fd1a);};VoiceQueueReport['prototype'][_0xe5ee('0x45')]=function(_0x4b5139,_0x18aa49){logger[_0xe5ee('0x48')](_0xe5ee('0x49')+_0x18aa49+_0xe5ee('0x4f'),_0x4b5139[_0xe5ee('0x4b')],util[_0xe5ee('0x41')](_0x4b5139,{'showHidden':![],'depth':null}));if(_0x4b5139[_0xe5ee('0x50')]===_0xe5ee('0x51')){return;}this[_0xe5ee('0x47')](util['format'](_0xe5ee('0x52'),_0x4b5139[_0xe5ee('0x4c')]),_0xe5ee('0x53'),_0x4b5139);io['emit']('voice_queue_presence:remove',_0x4b5139);};VoiceQueueReport[_0xe5ee('0xb')]['emitInboundVoiceQueueSummary']=function(_0x7aac96){if(_0x7aac96[_0xe5ee('0x54')]===_0xe5ee('0x55')){logger[_0xe5ee('0x48')](_0xe5ee('0x56'),util['inspect'](_0x7aac96,{'showHidden':![],'depth':null}));this['emit'](util[_0xe5ee('0x57')]('voice:queue:%s',_0x7aac96['name']),_0xe5ee('0x58'),_0x7aac96);}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x59')]=function(_0x573ee4){return _0x573ee4!==null&&!_[_0xe5ee('0x5a')](_0x573ee4);};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x5b')]=function(){var _0x2edffc=this;setInterval(function(){_0x2edffc[_0xe5ee('0x38')]();ami[_0xe5ee('0x3a')]({'action':_0xe5ee('0x5c')})[_0xe5ee('0x3d')](function(_0x321fe3){logger['error'](_0xe5ee('0x5d'),util[_0xe5ee('0x41')](_0x321fe3,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype']['loopQueueSummary']=function(){var _0x3ec1c5=this;setInterval(function(){if(!_0x3ec1c5['summary'][_0xe5ee('0x5e')]){return ami[_0xe5ee('0x3a')]({'action':_0xe5ee('0x5f')})[_0xe5ee('0x60')](function(_0x252b3a){_0x3ec1c5[_0xe5ee('0x17')]['id']=_0x252b3a[_0xe5ee('0x61')];_0x3ec1c5[_0xe5ee('0x17')]['isRunning']=!![];_0x3ec1c5[_0xe5ee('0x17')][_0xe5ee('0x62')][_0x252b3a[_0xe5ee('0x61')]]={};})['catch'](function(_0x4ac926){logger[_0xe5ee('0x40')](_0xe5ee('0x63'),util[_0xe5ee('0x41')](_0x4ac926,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xe5ee('0xb')]['createQueueSummaryReport']=function(_0x1ec20e,_0x4651e9){var _0xae400f;if(this['summary']&&this[_0xe5ee('0x17')]['queues']&&this[_0xe5ee('0x17')][_0xe5ee('0x5c')][_0x1ec20e[_0xe5ee('0x64')]]){_0xae400f=this['summary']['queues'][_0x1ec20e[_0xe5ee('0x64')]][_0xe5ee('0x65')];}var _0x19fdfb=new VoiceQueueSummary(_0x1ec20e);return _0x19fdfb[_0xe5ee('0x66')](_0x4651e9['agents'],this[_0xe5ee('0x12')],_0xae400f,this[_0xe5ee('0x11')][_0xe5ee('0x13')]);};VoiceQueueReport[_0xe5ee('0xb')]['handleInboundQueueSummaryReport']=function(_0x3c82bd,_0x2293d5){var _0x51376e=this['createQueueSummaryReport'](_0x3c82bd,_0x2293d5);var _0x370486=![];_0x370486=_0x51376e['compareToInboundQueue'](_0x3c82bd);if(_0x370486){Object[_0xe5ee('0x67')](_0x3c82bd,_0x51376e);this[_0xe5ee('0x11')][_0xe5ee('0x15')][_0x3c82bd[_0xe5ee('0x64')]]=_0x3c82bd;this[_0xe5ee('0x68')](_0x51376e);}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x69')]=function(_0x4959e9){var _0x8f6148=null;var _0x2ff2a0=this[_0xe5ee('0x17')]['id'];if(this[_0xe5ee('0x17')][_0xe5ee('0x62')][_0x2ff2a0]){_0x8f6148=this['summary'][_0xe5ee('0x62')][_0x2ff2a0][_0x4959e9[_0xe5ee('0x61')]];}if(!_0x8f6148){this['summary']=initializeSummary();return;}var _0x5002a1=this['voiceQueues'][_0x8f6148['queue']];if(_0x5002a1[_0xe5ee('0x54')]===_0xe5ee('0x55')){this[_0xe5ee('0x6a')](_0x5002a1,_0x8f6148);}else if(_0x5002a1[_0xe5ee('0x54')]===_0xe5ee('0x6b')){var _0x3b1d37=this[_0xe5ee('0x6c')](_0x5002a1,_0x8f6148);ami[_0xe5ee('0x47')](_0xe5ee('0x6d'),_0x3b1d37);}this[_0xe5ee('0x17')]['statusRequests']-=0x1;var _0x4467ad=this[_0xe5ee('0x17')][_0xe5ee('0x6e')]>0x0?!![]:![];if(!_0x4467ad){return this[_0xe5ee('0x1b')](this['summary'][_0xe5ee('0x6f')]);}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x1d')]=function(_0x3907a6){var _0x3d268e=this['summary']['id'];if(this[_0xe5ee('0x17')][_0xe5ee('0x62')][_0x3d268e]&&this[_0xe5ee('0x17')][_0xe5ee('0x62')][_0x3d268e][_0x3907a6['actionid']]){this[_0xe5ee('0x17')][_0xe5ee('0x62')][_0x3d268e][_0x3907a6[_0xe5ee('0x61')]][_0xe5ee('0x12')][_0xe5ee('0x70')](_0x3907a6);}};VoiceQueueReport[_0xe5ee('0xb')]['syncQueueSummary']=function(_0x667f0a){var _0x215b41=this;try{if(this[_0xe5ee('0x59')](_0x667f0a)&&this[_0xe5ee('0x59')](_0x667f0a['queue'])){logger[_0xe5ee('0x48')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x667f0a,{'showHidden':![],'depth':null}));var _0x1a2607=this['voiceQueues'][_0x667f0a['queue']];if(_0x1a2607){logger['debug'](_0xe5ee('0x71'),_0x1a2607[_0xe5ee('0x64')]);this[_0xe5ee('0x17')][_0xe5ee('0x5c')][_0x1a2607['name']]={'summaryEvent':_0x667f0a};this[_0xe5ee('0x17')]['statusRequests']+=0x1;return ami[_0xe5ee('0x3a')]({'action':_0xe5ee('0x62'),'queue':_0x1a2607[_0xe5ee('0x64')]})['then'](function(_0x467f59){if(!_0x215b41[_0xe5ee('0x17')][_0xe5ee('0x62')][_0x667f0a[_0xe5ee('0x61')]]){_0x215b41[_0xe5ee('0x17')]['queuestatus'][_0x667f0a[_0xe5ee('0x61')]]={};}_0x215b41[_0xe5ee('0x17')]['queuestatus'][_0x667f0a[_0xe5ee('0x61')]][_0x467f59[_0xe5ee('0x61')]]={'queue':_0x1a2607[_0xe5ee('0x64')],'agents':[]};})[_0xe5ee('0x3d')](function(_0x4dd2f4){throw _0x4dd2f4;});}}}catch(_0x197882){logger[_0xe5ee('0x40')](_0xe5ee('0x63'),util[_0xe5ee('0x41')](_0x197882,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x1b')]=function(_0x29ed80){if(this[_0xe5ee('0x17')]['statusRequests']>0x0){this[_0xe5ee('0x17')][_0xe5ee('0x6f')]=_0x29ed80;return;}logger[_0xe5ee('0x48')](_0xe5ee('0x72'),util[_0xe5ee('0x41')](_0x29ed80,{'showHidden':![],'depth':null}));this[_0xe5ee('0x17')]=initializeSummary();ami['emit'](_0xe5ee('0x73'),{});};VoiceQueueReport[_0xe5ee('0xb')]['syncQueueCallerJoin']=function(_0x118130){try{if(this[_0xe5ee('0x59')](_0x118130)){logger['debug'](_0xe5ee('0x74'),_0x118130[_0xe5ee('0x4b')],util[_0xe5ee('0x41')](_0x118130,{'showHidden':![],'depth':null}));if(_[_0xe5ee('0x5a')](this[_0xe5ee('0x10')][_0x118130[_0xe5ee('0x4b')]])){this[_0xe5ee('0x10')][_0x118130[_0xe5ee('0x4b')]]=[];}if(_[_0xe5ee('0x5a')](this[_0xe5ee('0x13')][_0x118130[_0xe5ee('0x4b')]])){this[_0xe5ee('0x13')][_0x118130['uniqueid']]={};}var _0x2531cb=new QueueReport();_0x2531cb[_0xe5ee('0x4c')]=_0x118130[_0xe5ee('0x4c')];_0x2531cb[_0xe5ee('0x54')]=this[_0xe5ee('0x15')][_0x2531cb[_0xe5ee('0x4c')]]&&this[_0xe5ee('0x15')][_0x2531cb[_0xe5ee('0x4c')]]['type']?this[_0xe5ee('0x15')][_0x2531cb['queue']][_0xe5ee('0x54')]||_0xe5ee('0x55'):_0xe5ee('0x55');_0x2531cb[_0xe5ee('0x75')]=moment()[_0xe5ee('0x57')](_0xe5ee('0x76'));_0x2531cb[_0xe5ee('0x77')]=_0x118130[_0xe5ee('0x77')];_0x2531cb[_0xe5ee('0x78')]=_0x118130[_0xe5ee('0x78')];_0x2531cb['uniqueid']=_0x118130[_0xe5ee('0x4b')];logger[_0xe5ee('0x79')](_0xe5ee('0x7a'),_0x2531cb[_0xe5ee('0x4c')],_0x2531cb[_0xe5ee('0x54')]);Object[_0xe5ee('0x67')](_0x2531cb,_['pick'](_0x118130,_['keys'](_0x2531cb)));this[_0xe5ee('0x10')][_0x118130[_0xe5ee('0x4b')]][_0xe5ee('0x70')](_0x2531cb);this[_0xe5ee('0x13')][_0x118130[_0xe5ee('0x4b')]]=_0x2531cb;this[_0xe5ee('0x7b')](_0x2531cb,_0xe5ee('0x1f'));}}catch(_0x311fdd){logger[_0xe5ee('0x40')]('[%s][voiceQueueReport][queuecallerjoin]',_0x118130[_0xe5ee('0x4b')],util['inspect'](_0x311fdd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x7c')]=function(_0x21a598){try{if(this[_0xe5ee('0x59')](_0x21a598)){logger['debug']('[%s][voiceQueueReport][queuecallerabandon]',_0x21a598[_0xe5ee('0x4b')],util[_0xe5ee('0x41')](_0x21a598,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x21a598[_0xe5ee('0x4b')]]){var _0x37d953=_['last'](this[_0xe5ee('0x10')][_0x21a598[_0xe5ee('0x4b')]]);_0x37d953[_0xe5ee('0x37')]=![];_0x37d953[_0xe5ee('0x7d')]=null;_0x37d953[_0xe5ee('0x7e')]=_0x21a598['holdtime'];_0x37d953['originalposition']=_0x21a598['originalposition'];_0x37d953[_0xe5ee('0x21')]=!![];_0x37d953[_0xe5ee('0x7f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x37d953[_0xe5ee('0x50')]=_0xe5ee('0x80');_0x37d953[_0xe5ee('0x81')]=null;logger[_0xe5ee('0x79')](_0xe5ee('0x82'),_0x37d953[_0xe5ee('0x4c')],_0x37d953[_0xe5ee('0x54')]);this[_0xe5ee('0x13')][_0x21a598['uniqueid']]=_0x37d953;this[_0xe5ee('0x45')](_0x37d953,_0xe5ee('0x21'));}}}catch(_0x13d88f){logger[_0xe5ee('0x40')](_0xe5ee('0x83'),_0x21a598[_0xe5ee('0x4b')],util['inspect'](_0x13d88f,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe5ee('0x23')]=function(_0xe3b49){try{if(this[_0xe5ee('0x59')](_0xe3b49)){logger[_0xe5ee('0x48')]('[%s][voiceQueueReport][queuecallerleave]',_0xe3b49[_0xe5ee('0x4b')],util['inspect'](_0xe3b49,{'showHidden':![],'depth':null}));if(this[_0xe5ee('0x10')][_0xe3b49[_0xe5ee('0x4b')]]){var _0x555cb1=_[_0xe5ee('0x84')](this[_0xe5ee('0x10')][_0xe3b49[_0xe5ee('0x4b')]]);_0x555cb1[_0xe5ee('0x85')]=moment()[_0xe5ee('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x555cb1[_0xe5ee('0x86')]=_0xe3b49[_0xe5ee('0x86')];_0x555cb1[_0xe5ee('0x87')]=_0xe3b49['connectedlinename'];logger[_0xe5ee('0x79')](_0xe5ee('0x88'),_0x555cb1['queue'],_0x555cb1[_0xe5ee('0x54')],_0xe3b49[_0xe5ee('0x86')],_0xe3b49[_0xe5ee('0x87')]);this['channels'][_0xe3b49[_0xe5ee('0x4b')]]=_0x555cb1;this['emitVoiceQueueChannelSave'](_0x555cb1,'queuecallerleave');}}}catch(_0x3a79c0){logger[_0xe5ee('0x40')](_0xe5ee('0x89'),_0xe3b49['uniqueid'],util[_0xe5ee('0x41')](_0x3a79c0,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xe5ee('0x26')]=function(_0x12202c){try{if(this[_0xe5ee('0x59')](_0x12202c)){logger[_0xe5ee('0x48')](_0xe5ee('0x8a'),_0x12202c['uniqueid'],util[_0xe5ee('0x41')](_0x12202c,{'showHidden':![],'depth':null}));if(this[_0xe5ee('0x10')][_0x12202c['uniqueid']]){var _0x44838d=_[_0xe5ee('0x84')](this[_0xe5ee('0x10')][_0x12202c[_0xe5ee('0x4b')]]);_0x44838d['queuecallercomplete']=!![];_0x44838d[_0xe5ee('0x50')]=_0xe5ee('0x8b');logger[_0xe5ee('0x79')](_0xe5ee('0x8c'),_0x44838d[_0xe5ee('0x4c')],_0x44838d[_0xe5ee('0x54')]);}}}catch(_0x2e10e8){logger[_0xe5ee('0x40')](_0xe5ee('0x8a'),_0x12202c[_0xe5ee('0x4b')],util['inspect'](_0x2e10e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0x25')]=function(_0x45750a){try{if(this[_0xe5ee('0x59')](_0x45750a)){logger['debug'](_0xe5ee('0x8d'),_0x45750a['uniqueid'],util[_0xe5ee('0x41')](_0x45750a,{'showHidden':![],'depth':null}));if(this[_0xe5ee('0x10')][_0x45750a[_0xe5ee('0x4b')]]){var _0x3fd477=_['last'](this['queueReports'][_0x45750a[_0xe5ee('0x4b')]]);_0x3fd477[_0xe5ee('0x21')]=![];_0x3fd477[_0xe5ee('0x7f')]=null;_0x3fd477[_0xe5ee('0x8e')]=!![];_0x3fd477[_0xe5ee('0x81')]=_0x45750a[_0xe5ee('0x8f')];_0x3fd477[_0xe5ee('0x7e')]=_0x45750a['holdtime'];_0x3fd477[_0xe5ee('0x37')]=!![];_0x3fd477[_0xe5ee('0x36')]=![];_0x3fd477[_0xe5ee('0x90')]=null;if(!_0x3fd477[_0xe5ee('0x91')]){if(_0x45750a[_0xe5ee('0x92')]==_0xe5ee('0x91')){_0x3fd477[_0xe5ee('0x50')]='COMPLETED';logger[_0xe5ee('0x79')](_0xe5ee('0x93'),_0x3fd477[_0xe5ee('0x4c')],_0x3fd477[_0xe5ee('0x54')]);}else{if(_[_0xe5ee('0x94')](_0x45750a['channel'][_0xe5ee('0x95')](),'local/')){if(this['queueReports'][_0x45750a[_0xe5ee('0x96')]]){var _0x36eea6=_[_0xe5ee('0x84')](this[_0xe5ee('0x10')][_0x45750a[_0xe5ee('0x96')]]);_0x36eea6[_0xe5ee('0x37')]=![];_0x36eea6[_0xe5ee('0x36')]=!![];_0x36eea6[_0xe5ee('0x90')]=moment(_0x3fd477[_0xe5ee('0x75')])[_0xe5ee('0x97')](_0x45750a[_0xe5ee('0x7e')],_0xe5ee('0x98'))['format'](_0xe5ee('0x76'));_0x36eea6[_0xe5ee('0x50')]=_0xe5ee('0x99');_0x36eea6[_0xe5ee('0x91')]=!![];_0x36eea6[_0xe5ee('0x9a')]=_0xe5ee('0x9b');_0x36eea6[_0xe5ee('0x9c')]=_0x45750a[_0xe5ee('0x9d')];_0x36eea6[_0xe5ee('0x9e')]=_0x45750a[_0xe5ee('0x4b')];logger[_0xe5ee('0x79')](_0xe5ee('0x9f'),_0x36eea6[_0xe5ee('0x4c')],_0x36eea6[_0xe5ee('0x54')]);var _0x2c2bae=this[_0xe5ee('0x10')][_0x45750a['linkedid']];this[_0xe5ee('0x10')][_0x45750a[_0xe5ee('0x96')]]=this[_0xe5ee('0x10')][_0x45750a['uniqueid']];this['queueReports'][_0x45750a['uniqueid']]=_0x2c2bae;}}else{_0x3fd477['queuecallerexitreason']=_0xe5ee('0xa0')+_0x45750a['reason']['toUpperCase']();logger[_0xe5ee('0x79')](_0xe5ee('0xa1'),_0x3fd477['queue'],_0x3fd477[_0xe5ee('0x54')],_0x3fd477[_0xe5ee('0x50')]);}}}this[_0xe5ee('0x13')][_0x45750a['uniqueid']]=_0x3fd477;}}}catch(_0x2d8ab2){logger[_0xe5ee('0x40')](_0xe5ee('0x8d'),_0x45750a[_0xe5ee('0x4b')],util['inspect'](_0x2d8ab2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5ee('0xb')][_0xe5ee('0xa2')]=function(_0x6e446d){try{if(this[_0xe5ee('0x59')](_0x6e446d)){logger[_0xe5ee('0x48')](_0xe5ee('0xa3'),_0x6e446d['uniqueid'],util['inspect'](_0x6e446d,{'showHidden':![],'depth':null}));this[_0xe5ee('0xa4')](_0x6e446d[_0xe5ee('0x4b')],_[_0xe5ee('0xa5')](_0x6e446d[_0xe5ee('0xa6')])[0x0],_0x6e446d[_0xe5ee('0xa7')]);if(this['queueReports'][_0x6e446d[_0xe5ee('0x4b')]]){var _0x3fcad1=_['last'](this[_0xe5ee('0x10')][_0x6e446d[_0xe5ee('0x4b')]]);if(_0x3fcad1){if(this['isNotNull'](_0x6e446d[_0xe5ee('0xa6')])&&this[_0xe5ee('0x59')](_0x6e446d['variable']['queuestatus'])){switch(_0x6e446d[_0xe5ee('0xa7')]){case _0xe5ee('0xa8'):_0x3fcad1[_0xe5ee('0x36')]=![];_0x3fcad1[_0xe5ee('0x90')]=null;break;case _0xe5ee('0xa9'):_0x3fcad1[_0xe5ee('0xaa')]=_0xe5ee('0xab');_0x3fcad1[_0xe5ee('0x36')]=!![];_0x3fcad1[_0xe5ee('0x90')]=moment()[_0xe5ee('0x57')](_0xe5ee('0x76'));_0x3fcad1[_0xe5ee('0x85')]=moment()[_0xe5ee('0x57')](_0xe5ee('0x76'));logger[_0xe5ee('0x48')](_0xe5ee('0xac'),_0x6e446d[_0xe5ee('0x4b')],util[_0xe5ee('0x41')](_0x3fcad1,{'showHidden':![],'depth':null}));ami[_0xe5ee('0x47')](_0xe5ee('0xad'),_0x3fcad1);break;default:_0x3fcad1[_0xe5ee('0x36')]=!![];_0x3fcad1[_0xe5ee('0x90')]=moment()[_0xe5ee('0x57')]('YYYY-MM-DD\x20HH:mm:ss');_0x3fcad1[_0xe5ee('0x85')]=moment()[_0xe5ee('0x57')](_0xe5ee('0x76'));}_0x3fcad1[_0xe5ee('0x21')]=![];_0x3fcad1[_0xe5ee('0x7f')]=null;_0x3fcad1[_0xe5ee('0x50')]=_0x6e446d[_0xe5ee('0xa7')];this[_0xe5ee('0x13')][_0x6e446d[_0xe5ee('0x4b')]]=_0x3fcad1;this['emitVoiceQueueChannelRemove'](_0x3fcad1,_0xe5ee('0x27'));}else if(this[_0xe5ee('0x59')](_0x6e446d[_0xe5ee('0xa6')])&&this['isNotNull'](_0x6e446d[_0xe5ee('0xa6')][_0xe5ee('0xae')])){if(!_0x3fcad1[_0xe5ee('0x21')]){_0x3fcad1[_0xe5ee('0x36')]=!![];_0x3fcad1['queuecallerexitAt']=moment()['format'](_0xe5ee('0x76'));_0x3fcad1[_0xe5ee('0x50')]='EXITWITHKEY';_0x3fcad1[_0xe5ee('0x85')]=moment()[_0xe5ee('0x57')](_0xe5ee('0x76'));this[_0xe5ee('0x13')][_0x6e446d['uniqueid']]=_0x3fcad1;}}logger['info']('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x6e446d['uniqueid'],_0x3fcad1[_0xe5ee('0x4c')],_0x3fcad1[_0xe5ee('0x54')],_[_0xe5ee('0xa5')](_0x6e446d[_0xe5ee('0xa6')])[0x0],_0x6e446d[_0xe5ee('0xa7')]);_0x3fcad1[_0xe5ee('0x18')]=this[_0xe5ee('0x18')][_0x6e446d[_0xe5ee('0x4b')]];}}}}catch(_0x2b959e){logger[_0xe5ee('0x40')](_0xe5ee('0xa3'),_0x6e446d[_0xe5ee('0x4b')],util[_0xe5ee('0x41')](_0x2b959e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xe5ee('0xb')]['addVariable']=function(_0x1509ef,_0xa7e443,_0x58819f){var _0x3a0b1d=[_0xe5ee('0xaf'),_0xe5ee('0xb0'),'rtpaudioqosjitter',_0xe5ee('0xb1'),_0xe5ee('0xb2'),'rtpaudioqoslossbridged',_0xe5ee('0xb3'),_0xe5ee('0xb4'),_0xe5ee('0xb5'),_0xe5ee('0xb6'),_0xe5ee('0xb7'),_0xe5ee('0xb8'),_0xe5ee('0xb9'),_0xe5ee('0xba'),_0xe5ee('0xbb'),_0xe5ee('0xbc'),_0xe5ee('0x8f'),'memberpenalty',_0xe5ee('0xbd')];if(!_['isNil'](_0xa7e443)&&!_[_0xe5ee('0xbe')](_0x3a0b1d,_0xa7e443)){if(_[_0xe5ee('0x5a')](this[_0xe5ee('0x18')][_0x1509ef])){this[_0xe5ee('0x18')][_0x1509ef]={};}this['variables'][_0x1509ef][_0xa7e443]=_0x58819f;}};VoiceQueueReport[_0xe5ee('0xb')]['handleHangup']=function(_0x561151,_0x52e2c6,_0x429292){try{var _0x3d1976={};if(this[_0xe5ee('0x10')][_0x561151]){for(var _0x53cf1b=0x0;_0x53cf1b{delete this[_0xe5ee('0x13')][_0xb1d798];},_0x5d9010);}};module[_0xe5ee('0xf3')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 2d5284b..ffebc6f 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fa0=['queue','Request','CreateReportAgentPreview','../client'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x1fa0,0x107));var _0x01fa=function(_0xbd2a8d,_0x451894){_0xbd2a8d=_0xbd2a8d-0x0;var _0x5dc929=_0x1fa0[_0xbd2a8d];return _0x5dc929;};'use strict';var client=require(_0x01fa('0x0'));exports['createHistory']=function(_0x40d9c7){return function(){_0x40d9c7['campaign']=_0x40d9c7[_0x01fa('0x1')];return client[_0x01fa('0x2')](_0x01fa('0x3'),{'body':_0x40d9c7,'log':_0x01fa('0x3')});};}; \ No newline at end of file +var _0x6fa9=['createHistory','campaign','queue','Request','CreateReportAgentPreview','../client'];(function(_0x11d95f,_0x34f442){var _0x2b1a14=function(_0x3a4fa5){while(--_0x3a4fa5){_0x11d95f['push'](_0x11d95f['shift']());}};_0x2b1a14(++_0x34f442);}(_0x6fa9,0x18b));var _0x96fa=function(_0x2c3828,_0x4cd782){_0x2c3828=_0x2c3828-0x0;var _0xf37f59=_0x6fa9[_0x2c3828];return _0xf37f59;};'use strict';var client=require(_0x96fa('0x0'));exports[_0x96fa('0x1')]=function(_0x2c3ac9){return function(){_0x2c3ac9[_0x96fa('0x2')]=_0x2c3ac9[_0x96fa('0x3')];return client[_0x96fa('0x4')](_0x96fa('0x5'),{'body':_0x2c3ac9,'log':_0x96fa('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index afaac60..ae33fb1 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd3d3=['Request'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd3d3[_0x3ab51d];return _0x29a04e;};'use strict';var client=require('../client');exports['create']=function(_0x12ce2a){return client[_0x3d3d('0x0')]('CreateAttachment',{'body':_0x12ce2a,'log':'CreateAttachment'});}; \ No newline at end of file +var _0x53aa=['CreateAttachment','Request'];(function(_0x5503dc,_0x28259d){var _0x108118=function(_0x48ea41){while(--_0x48ea41){_0x5503dc['push'](_0x5503dc['shift']());}};_0x108118(++_0x28259d);}(_0x53aa,0x6d));var _0xa53a=function(_0x29d94e,_0xf386d6){_0x29d94e=_0x29d94e-0x0;var _0x106237=_0x53aa[_0x29d94e];return _0x106237;};'use strict';var client=require('../client');exports['create']=function(_0x2f2dc1){return client[_0xa53a('0x0')]('CreateAttachment',{'body':_0x2f2dc1,'log':_0xa53a('0x1')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 9c49ffa..5a7aa40 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','Trunk','callerid','TrunkBackup','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','GetCampaign','name','type','active','limitCalls'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f2f,0x73));var _0xf5f2=function(_0x29dfc7,_0x5d32a5){_0x29dfc7=_0x29dfc7-0x0;var _0x22d34a=_0x5f2f[_0x29dfc7];return _0x22d34a;};'use strict';var client=require(_0xf5f2('0x0'));exports[_0xf5f2('0x1')]=function(){return function(){return client[_0xf5f2('0x2')](_0xf5f2('0x3'),{'options':{'raw':![],'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x5'),_0xf5f2('0x6'),_0xf5f2('0x7'),'dialOriginateCallerIdName','dialOriginateCallerIdNumber',_0xf5f2('0x8'),_0xf5f2('0x9'),_0xf5f2('0xa'),_0xf5f2('0xb'),_0xf5f2('0xc'),_0xf5f2('0xd'),'dialNoAnswerRetryFrequency',_0xf5f2('0xe'),_0xf5f2('0xf'),_0xf5f2('0x10'),'dialDropMaxRetry',_0xf5f2('0x11'),_0xf5f2('0x12'),_0xf5f2('0x13'),'dialMachineMaxRetry',_0xf5f2('0x14'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0xf5f2('0x15'),_0xf5f2('0x16'),'dialAMDActive',_0xf5f2('0x17'),_0xf5f2('0x18'),_0xf5f2('0x19'),_0xf5f2('0x1a'),_0xf5f2('0x1b'),_0xf5f2('0x1c'),'dialAMDMaximumNumberOfWords',_0xf5f2('0x1d'),_0xf5f2('0x1e'),_0xf5f2('0x1f'),_0xf5f2('0x20'),_0xf5f2('0x21'),'dialCutDigit'],'include':[{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x22'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x22'),'as':_0xf5f2('0x24'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x23'),_0xf5f2('0x6')]},{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x25'),'attributes':['id',_0xf5f2('0x4')],'include':[{'model':_0xf5f2('0x25'),'as':_0xf5f2('0x26'),'attributes':['id',_0xf5f2('0x4'),_0xf5f2('0x27')]}]},{'model':'SquareProject','as':_0xf5f2('0x28'),'attributes':['id',_0xf5f2('0x4')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0xadb5=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialCutDigit','Trunk','callerid','active','TrunkBackup','Interval','SquareProject','getCampaign','getCampaigns','GetCampaign','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDMinWordLength'];(function(_0x4c7c0d,_0x242781){var _0x6094d2=function(_0x55ea3b){while(--_0x55ea3b){_0x4c7c0d['push'](_0x4c7c0d['shift']());}};_0x6094d2(++_0x242781);}(_0xadb5,0xad));var _0x5adb=function(_0x2f5f62,_0x252099){_0x2f5f62=_0x2f5f62-0x0;var _0x502267=_0xadb5[_0x2f5f62];return _0x502267;};'use strict';var client=require('../client');exports[_0x5adb('0x0')]=function(){return function(){return client['Request'](_0x5adb('0x1'),{'options':{'raw':![],'attributes':['id',_0x5adb('0x2'),_0x5adb('0x3'),'active',_0x5adb('0x4'),_0x5adb('0x5'),_0x5adb('0x6'),'dialOriginateTimeout',_0x5adb('0x7'),_0x5adb('0x8'),_0x5adb('0x9'),_0x5adb('0xa'),_0x5adb('0xb'),_0x5adb('0xc'),_0x5adb('0xd'),_0x5adb('0xe'),_0x5adb('0xf'),_0x5adb('0x10'),_0x5adb('0x11'),_0x5adb('0x12'),_0x5adb('0x13'),_0x5adb('0x14'),'dialMachineRetryFrequency','dialAgentRejectMaxRetry',_0x5adb('0x15'),_0x5adb('0x16'),_0x5adb('0x17'),'dialAMDActive',_0x5adb('0x18'),'dialAMDGreeting',_0x5adb('0x19'),'dialAMDTotalAnalysisTime',_0x5adb('0x1a'),_0x5adb('0x1b'),_0x5adb('0x1c'),'dialAMDSilenceThreshold',_0x5adb('0x1d'),_0x5adb('0x1e'),_0x5adb('0x1f'),'dialRandomLastDigitCallerIdNumber',_0x5adb('0x20')],'include':[{'model':'Trunk','as':_0x5adb('0x21'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':_0x5adb('0x21'),'as':_0x5adb('0x24'),'attributes':['id',_0x5adb('0x2'),_0x5adb('0x22'),_0x5adb('0x23')]},{'model':'Interval','as':_0x5adb('0x25'),'attributes':['id','name'],'include':[{'model':_0x5adb('0x25'),'as':'Intervals','attributes':['id',_0x5adb('0x2'),'interval']}]},{'model':'SquareProject','as':_0x5adb('0x26'),'attributes':['id',_0x5adb('0x2')]}]},'log':_0x5adb('0x27')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 920e3c9..b42892c 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1f14=['GetCmContact','../client','createContact','CreateCmContact','Request'];(function(_0x392bb0,_0xb9b525){var _0x1dbb37=function(_0x2c5e61){while(--_0x2c5e61){_0x392bb0['push'](_0x392bb0['shift']());}};_0x1dbb37(++_0xb9b525);}(_0x1f14,0x8d));var _0x41f1=function(_0x18959c,_0x4e84da){_0x18959c=_0x18959c-0x0;var _0x18c9a7=_0x1f14[_0x18959c];return _0x18c9a7;};'use strict';var client=require(_0x41f1('0x0'));exports[_0x41f1('0x1')]=function(_0x1f1c68){return function(){return client['Request'](_0x41f1('0x2'),{'body':_0x1f1c68,'log':_0x41f1('0x2')});};};exports['getContacts']=function(_0x84d534){return function(){return client[_0x41f1('0x3')](_0x41f1('0x4'),{'options':_0x84d534,'log':_0x41f1('0x4')});};}; \ No newline at end of file +var _0x2976=['CreateCmContact','getContacts','GetCmContact','createContact','Request'];(function(_0x48766a,_0x9bb9d8){var _0x42f5e3=function(_0x5682ef){while(--_0x5682ef){_0x48766a['push'](_0x48766a['shift']());}};_0x42f5e3(++_0x9bb9d8);}(_0x2976,0x139));var _0x6297=function(_0x331a61,_0x46a63a){_0x331a61=_0x331a61-0x0;var _0x7b6d37=_0x2976[_0x331a61];return _0x7b6d37;};'use strict';var client=require('../client');exports[_0x6297('0x0')]=function(_0x18230d){return function(){return client[_0x6297('0x1')](_0x6297('0x2'),{'body':_0x18230d,'log':'CreateCmContact'});};};exports[_0x6297('0x3')]=function(_0x258065){return function(){return client[_0x6297('0x1')](_0x6297('0x4'),{'options':_0x258065,'log':_0x6297('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 1047163..7b46267 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa48=['CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','VoiceQueueId','CountReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','unlockContact','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls'];(function(_0x1b3d5f,_0x463d39){var _0x38ff9f=function(_0x1ca4ee){while(--_0x1ca4ee){_0x1b3d5f['push'](_0x1b3d5f['shift']());}};_0x38ff9f(++_0x463d39);}(_0xaa48,0x15a));var _0x8aa4=function(_0x1c89c2,_0x5efd57){_0x1c89c2=_0x1c89c2-0x0;var _0x219ae8=_0xaa48[_0x1c89c2];return _0x219ae8;};'use strict';var client=require(_0x8aa4('0x0'));var moment=require(_0x8aa4('0x1'));exports[_0x8aa4('0x2')]=function(_0x50d619,_0x1a93a7){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x4'),{'options':{'where':{'VoiceQueueId':_0x50d619},'include':[{'model':_0x8aa4('0x5'),'as':_0x8aa4('0x6')}],'limit':_0x1a93a7,'raw':![]},'log':_0x8aa4('0x7')});};};exports[_0x8aa4('0x8')]=function(_0x469f03,_0x141d8b,_0x14614c){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x9'),{'body':_0x469f03,'options':{'where':{'VoiceQueueId':_0x141d8b,'scheduledat':{'$lte':moment()[_0x8aa4('0xa')](_0x8aa4('0xb'))}},'limit':_0x14614c},'log':_0x8aa4('0x9')});};};exports['rescheduleContact']=function(_0x33a427){return client[_0x8aa4('0x3')]('UpdateCmHopper',{'body':_0x33a427,'options':{'where':{'ContactId':_0x33a427[_0x8aa4('0xc')],'ListId':_0x33a427[_0x8aa4('0xd')],'VoiceQueueId':_0x33a427['VoiceQueueId'],'CampaignId':_0x33a427[_0x8aa4('0xe')]}},'log':_0x8aa4('0xf')});};exports[_0x8aa4('0x10')]=function(_0x38ecc6,_0x1a664b,_0x3a64ed){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x11'),{'options':{'where':{'VoiceQueueId':_0x38ecc6,'ListId':_0x1a664b,'ContactId':_0x3a64ed}},'log':_0x8aa4('0x11')});};};exports[_0x8aa4('0x12')]=function(_0x569c43,_0x5951ce,_0x3143f7,_0x455a80){return client[_0x8aa4('0x3')](_0x8aa4('0x13'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x569c43,'active':![],'scheduledat':{'$lte':moment()[_0x8aa4('0xa')](_0x8aa4('0xb'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5951ce}}]},'order':[[_0x8aa4('0x14'),_0x8aa4('0x15')],[_0x8aa4('0x16'),_0x455a80],['id',_0x8aa4('0x17')]],'raw':!![],'limit':_0x3143f7},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x5d1819,_0x26542e,_0x188e24){return client[_0x8aa4('0x3')](_0x8aa4('0x13'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5d1819,'active':![],'scheduledat':{'$lte':moment()['format'](_0x8aa4('0xb'))}},'include':[{'model':_0x8aa4('0x5'),'as':'Contact'}],'order':[[_0x8aa4('0x14'),'DESC'],['scheduledat',_0x188e24],['id',_0x8aa4('0x17')]],'raw':!![],'limit':_0x26542e},'log':'GetContactDialerIvr'});};exports[_0x8aa4('0x18')]=function(_0x2df294,_0x521b69){_0x2df294[_0x8aa4('0x19')]=_0x2df294[_0x8aa4('0x1a')];return client['Request'](_0x8aa4('0x1b'),{'body':_0x2df294,'options':{'where':{'ContactId':_0x2df294[_0x8aa4('0xc')],'ListId':_0x2df294[_0x8aa4('0xd')],'VoiceQueueId':_0x2df294[_0x8aa4('0x1c')],'CampaignId':_0x2df294[_0x8aa4('0xe')],'active':_0x521b69?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports['countReScheduled']=function(_0x4c429f){return client['Request'](_0x8aa4('0x1d'),{'options':{'where':{'VoiceQueueId':_0x4c429f['id']?_0x4c429f['id']||null:null}},'log':'countReScheduled'});};exports[_0x8aa4('0x1e')]=function(_0x3e4d24){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x1f'),{'options':{'where':{'id':_0x3e4d24},'include':[{'model':'CmContact','as':'Contact'},{'model':_0x8aa4('0x20'),'as':'Agent','attributes':['id',_0x8aa4('0x21')]},{'model':_0x8aa4('0x22'),'as':'Queue','attributes':['id',_0x8aa4('0x21')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x8aa4('0x23')]=function(_0x54aa95,_0x46024e,_0x31ebb4){return client[_0x8aa4('0x3')](_0x8aa4('0x9'),{'body':_0x54aa95,'options':{'where':{'id':_0x46024e},'limit':_0x31ebb4},'log':_0x8aa4('0x9')});};exports['getContactRecallMe']=function(_0x5d4894,_0x5f1028){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5d4894,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x8aa4('0xb'))},'UserId':{'$in':_0x5f1028}},'order':[[_0x8aa4('0x14'),_0x8aa4('0x15')],[_0x8aa4('0x16'),_0x8aa4('0x15')],['id',_0x8aa4('0x17')]],'include':[{'model':'CmContact','as':_0x8aa4('0x6')},{'model':'User','as':'Agent','attributes':['id',_0x8aa4('0x21'),_0x8aa4('0x25')]}],'group':_0x8aa4('0x26'),'raw':!![]},'log':_0x8aa4('0x13')});};};exports[_0x8aa4('0x27')]=function(_0x481800,_0x342938){return client[_0x8aa4('0x3')](_0x8aa4('0x28'),{'body':_0x481800,'options':_0x342938||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x5ab8a3,_0x541cd9,_0x3eceb8){return function(){return client[_0x8aa4('0x3')](_0x8aa4('0x29'),{'body':{'where':{'voiceQueueIds':_0x5ab8a3,'interval':_0x541cd9,'availableAgentsIds':_0x3eceb8}},'log':_0x8aa4('0x2a')});};}; \ No newline at end of file +var _0x49c4=['getContactPreview','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','Contact','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','priority','DESC','scheduledat','ASC','GetContactDialer','getContactDialerIvr','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','CampaignId','countReScheduled','CountReScheduled'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x49c4,0x9b));var _0x449c=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x49c4[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x449c('0x0'));var moment=require('moment');exports[_0x449c('0x1')]=function(_0x2ee18a,_0x17bf65){return function(){return client[_0x449c('0x2')](_0x449c('0x3'),{'options':{'where':{'VoiceQueueId':_0x2ee18a},'include':[{'model':_0x449c('0x4'),'as':_0x449c('0x5')}],'limit':_0x17bf65,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x98afc0,_0x442e56,_0x12586c){return function(){return client[_0x449c('0x2')](_0x449c('0x6'),{'body':_0x98afc0,'options':{'where':{'VoiceQueueId':_0x442e56,'scheduledat':{'$lte':moment()[_0x449c('0x7')](_0x449c('0x8'))}},'limit':_0x12586c},'log':_0x449c('0x6')});};};exports[_0x449c('0x9')]=function(_0x1964a6){return client[_0x449c('0x2')](_0x449c('0x6'),{'body':_0x1964a6,'options':{'where':{'ContactId':_0x1964a6[_0x449c('0xa')],'ListId':_0x1964a6[_0x449c('0xb')],'VoiceQueueId':_0x1964a6[_0x449c('0xc')],'CampaignId':_0x1964a6['CampaignId']}},'log':'rescheduleContact'});};exports[_0x449c('0xd')]=function(_0xca48f,_0x5081d6,_0x590bc7){return function(){return client['Request'](_0x449c('0xe'),{'options':{'where':{'VoiceQueueId':_0xca48f,'ListId':_0x5081d6,'ContactId':_0x590bc7}},'log':_0x449c('0xe')});};};exports[_0x449c('0xf')]=function(_0x2071e2,_0x486d32,_0x467eee,_0x4fce89){return client[_0x449c('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2071e2,'active':![],'scheduledat':{'$lte':moment()[_0x449c('0x7')](_0x449c('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x486d32}}]},'order':[[_0x449c('0x10'),_0x449c('0x11')],[_0x449c('0x12'),_0x4fce89],['id',_0x449c('0x13')]],'raw':!![],'limit':_0x467eee},'log':_0x449c('0x14')});};exports[_0x449c('0x15')]=function(_0x132a5b,_0x3d493a,_0x551b31){return client[_0x449c('0x2')](_0x449c('0x14'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x132a5b,'active':![],'scheduledat':{'$lte':moment()[_0x449c('0x7')](_0x449c('0x8'))}},'include':[{'model':_0x449c('0x4'),'as':'Contact'}],'order':[[_0x449c('0x10'),_0x449c('0x11')],[_0x449c('0x12'),_0x551b31],['id',_0x449c('0x13')]],'raw':!![],'limit':_0x3d493a},'log':_0x449c('0x16')});};exports[_0x449c('0x17')]=function(_0x57c137,_0x3aee9c){_0x57c137[_0x449c('0x18')]=_0x57c137['queue'];return client[_0x449c('0x2')](_0x449c('0x19'),{'body':_0x57c137,'options':{'where':{'ContactId':_0x57c137[_0x449c('0xa')],'ListId':_0x57c137[_0x449c('0xb')],'VoiceQueueId':_0x57c137[_0x449c('0xc')],'CampaignId':_0x57c137[_0x449c('0x1a')],'active':_0x3aee9c?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0x449c('0x1b')]=function(_0x278917){return client['Request'](_0x449c('0x1c'),{'options':{'where':{'VoiceQueueId':_0x278917['id']?_0x278917['id']||null:null}},'log':'countReScheduled'});};exports[_0x449c('0x1d')]=function(_0x47c13d){return function(){return client[_0x449c('0x2')](_0x449c('0x1e'),{'options':{'where':{'id':_0x47c13d},'include':[{'model':_0x449c('0x4'),'as':_0x449c('0x5')},{'model':_0x449c('0x1f'),'as':_0x449c('0x20'),'attributes':['id',_0x449c('0x21')]},{'model':_0x449c('0x22'),'as':_0x449c('0x23'),'attributes':['id',_0x449c('0x21')]}],'raw':!![]},'log':_0x449c('0x24')});};};exports[_0x449c('0x25')]=function(_0x431ce0,_0x52c0f5,_0x586ef6){return client[_0x449c('0x2')](_0x449c('0x6'),{'body':_0x431ce0,'options':{'where':{'id':_0x52c0f5},'limit':_0x586ef6},'log':_0x449c('0x6')});};exports[_0x449c('0x26')]=function(_0x2e9903,_0x45315d){return function(){return client[_0x449c('0x2')](_0x449c('0x27'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2e9903,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x449c('0x7')](_0x449c('0x8'))},'UserId':{'$in':_0x45315d}},'order':[[_0x449c('0x10'),_0x449c('0x11')],[_0x449c('0x12'),_0x449c('0x11')],['id',_0x449c('0x13')]],'include':[{'model':_0x449c('0x4'),'as':_0x449c('0x5')},{'model':_0x449c('0x1f'),'as':_0x449c('0x20'),'attributes':['id',_0x449c('0x21'),_0x449c('0x28')]}],'group':_0x449c('0x29'),'raw':!![]},'log':_0x449c('0x14')});};};exports[_0x449c('0x2a')]=function(_0x104a9a,_0x1b94c0){return client[_0x449c('0x2')]('ResetActiveCalls',{'body':_0x104a9a,'options':_0x1b94c0||{},'log':_0x449c('0x2b')});};exports['handlePreviewRecallNotifications']=function(_0x171226,_0x51fd76,_0x54eeff){return function(){return client['Request'](_0x449c('0x2c'),{'body':{'where':{'voiceQueueIds':_0x171226,'interval':_0x51fd76,'availableAgentsIds':_0x54eeff}},'log':_0x449c('0x2d')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index cb1ca2b..04d0567 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfd8d=['Request','VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xfd8d,0x171));var _0xdfd8=function(_0x47c9b1,_0x5751df){_0x47c9b1=_0x47c9b1-0x0;var _0x432c41=_0xfd8d[_0x47c9b1];return _0x432c41;};'use strict';var client=require(_0xdfd8('0x0'));exports[_0xdfd8('0x1')]=function(_0x30861b,_0x44ab09,_0x431033){return client[_0xdfd8('0x2')](_0xdfd8('0x3'),{'body':_0x30861b,'reason':_0x44ab09,'entity':_0x431033,'log':_0xdfd8('0x3')});};exports['swapAdditionalPhones']=function(_0x27a668,_0xff6728,_0x12d3ae){return client[_0xdfd8('0x2')](_0xdfd8('0x4'),{'body':_0x27a668,'duration':_0xff6728,'waitTime':_0x12d3ae,'log':'SwapAdditionalPhones'});};exports[_0xdfd8('0x5')]=function(_0x4c31a7){return function(){return client['Request'](_0xdfd8('0x6'),{'body':_0x4c31a7,'log':_0xdfd8('0x6')});};}; \ No newline at end of file +var _0xc568=['incrementPreviewCounters','IncrementPreviewCounters','Request','VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones'];(function(_0x2b608e,_0x2b9d76){var _0x2aca67=function(_0x1a6ac5){while(--_0x1a6ac5){_0x2b608e['push'](_0x2b608e['shift']());}};_0x2aca67(++_0x2b9d76);}(_0xc568,0xaa));var _0x8c56=function(_0x5a1299,_0x5c1807){_0x5a1299=_0x5a1299-0x0;var _0x4433fc=_0xc568[_0x5a1299];return _0x4433fc;};'use strict';var client=require('../client');exports['verifyAdditionalPhones']=function(_0x581e35,_0x1ddbc8,_0x1b3558){return client[_0x8c56('0x0')](_0x8c56('0x1'),{'body':_0x581e35,'reason':_0x1ddbc8,'entity':_0x1b3558,'log':_0x8c56('0x1')});};exports[_0x8c56('0x2')]=function(_0x485ba1,_0x34c928,_0x1e57f8){return client[_0x8c56('0x0')](_0x8c56('0x3'),{'body':_0x485ba1,'duration':_0x34c928,'waitTime':_0x1e57f8,'log':_0x8c56('0x3')});};exports[_0x8c56('0x4')]=function(_0x29fa54){return function(){return client[_0x8c56('0x0')](_0x8c56('0x5'),{'body':_0x29fa54,'log':_0x8c56('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index e321a92..8f05ab8 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2f88=['checkIsBlackListIvr','Request','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x2f88,0x1a8));var _0x82f8=function(_0x350c9f,_0x136785){_0x350c9f=_0x350c9f-0x0;var _0x25a5c3=_0x2f88[_0x350c9f];return _0x25a5c3;};'use strict';var client=require(_0x82f8('0x0'));exports[_0x82f8('0x1')]=function(_0x206472){return client['Request']('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x206472['VoiceQueueId'],'phone':_0x206472['phone']},'raw':![]},'log':'GetCmHopperBlack'});};exports[_0x82f8('0x2')]=function(_0x4e745a){return client[_0x82f8('0x3')]('GetCmHopperBlack',{'options':{'where':{'CampaignId':_0x4e745a[_0x82f8('0x4')],'phone':_0x4e745a['phone']},'raw':![]},'log':_0x82f8('0x5')});}; \ No newline at end of file +var _0x8792=['checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x8792,0x133));var _0x2879=function(_0x41747b,_0x10846f){_0x41747b=_0x41747b-0x0;var _0x542ce1=_0x8792[_0x41747b];return _0x542ce1;};'use strict';var client=require('../client');exports[_0x2879('0x0')]=function(_0x1570bd){return client[_0x2879('0x1')](_0x2879('0x2'),{'options':{'where':{'VoiceQueueId':_0x1570bd[_0x2879('0x3')],'phone':_0x1570bd[_0x2879('0x4')]},'raw':![]},'log':_0x2879('0x2')});};exports[_0x2879('0x5')]=function(_0x4afe54){return client[_0x2879('0x1')](_0x2879('0x2'),{'options':{'where':{'CampaignId':_0x4afe54[_0x2879('0x6')],'phone':_0x4afe54['phone']},'raw':![]},'log':_0x2879('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index dfdf0ff..e571ed5 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var client=require('../client');exports['createContact']=function(_0x5a3e52){return function(){_0x5a3e52['campaign']=_0x5a3e52['queue'];return client['Request']('CreateCmHopperFinal',{'body':_0x5a3e52,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file +var _0xd768=['queue','Request','CreateCmHopperFinal','../client','createContact','campaign'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd768,0x13b));var _0x8d76=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xd768[_0x387777];return _0x3f84c0;};'use strict';var client=require(_0x8d76('0x0'));exports[_0x8d76('0x1')]=function(_0x3a79cc){return function(){_0x3a79cc[_0x8d76('0x2')]=_0x3a79cc[_0x8d76('0x3')];return client[_0x8d76('0x4')](_0x8d76('0x5'),{'body':_0x3a79cc,'log':_0x8d76('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index a531ea1..d981e73 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x776b=['minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','GetVoiceQueueHopperHistory','getCampaignHopperHistory','GetCampaignHopperHistory','startOf','endOf','day','ivr','../client','moment','createHistory','campaign','Request','CreateCmHopperHistory','AvgHandleTime'];(function(_0x333940,_0x8ba408){var _0x3f85fa=function(_0x30febb){while(--_0x30febb){_0x333940['push'](_0x333940['shift']());}};_0x3f85fa(++_0x8ba408);}(_0x776b,0x12b));var _0xb776=function(_0x5167e3,_0x1d4dd9){_0x5167e3=_0x5167e3-0x0;var _0x335c8c=_0x776b[_0x5167e3];return _0x335c8c;};'use strict';var client=require(_0xb776('0x0'));var moment=require(_0xb776('0x1'));exports[_0xb776('0x2')]=function(_0x3399cc){_0x3399cc[_0xb776('0x3')]=_0x3399cc['queue'];return client[_0xb776('0x4')](_0xb776('0x5'),{'body':_0x3399cc,'log':_0xb776('0x5')});};exports['avgHandleTime']=function(_0x24d47c){return client[_0xb776('0x4')](_0xb776('0x6'),{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x24d47c,_0xb776('0x7'))[_0xb776('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()['format'](_0xb776('0x9'))]}},'raw':![]},'log':_0xb776('0xa')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client[_0xb776('0x4')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')[_0xb776('0x8')](_0xb776('0x9')),moment()['endOf']('day')['format'](_0xb776('0x9'))]},'campaigntype':'queue'},'raw':![]},'log':_0xb776('0xb')});};};exports[_0xb776('0xc')]=function(){return function(){return client[_0xb776('0x4')](_0xb776('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xb776('0xe')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xb776('0xf')](_0xb776('0x10'))[_0xb776('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0xb776('0x11')},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file +var _0x0333=['avgHandleTime','AvgHandleTime','subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','format','GetCmHopperHistory','getVoiceQueueHopperHistory','startOf','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','moment','createHistory','campaign','queue','Request','CreateCmHopperHistory'];(function(_0x4d61de,_0x54c2cd){var _0xc36951=function(_0x11a426){while(--_0x11a426){_0x4d61de['push'](_0x4d61de['shift']());}};_0xc36951(++_0x54c2cd);}(_0x0333,0xe0));var _0x3033=function(_0x46428c,_0x20ab75){_0x46428c=_0x46428c-0x0;var _0x16a677=_0x0333[_0x46428c];return _0x16a677;};'use strict';var client=require(_0x3033('0x0'));var moment=require(_0x3033('0x1'));exports[_0x3033('0x2')]=function(_0x2f1d9a){_0x2f1d9a[_0x3033('0x3')]=_0x2f1d9a[_0x3033('0x4')];return client[_0x3033('0x5')](_0x3033('0x6'),{'body':_0x2f1d9a,'log':'CreateCmHopperHistory'});};exports[_0x3033('0x7')]=function(_0x4f0457){return client[_0x3033('0x5')](_0x3033('0x8'),{'options':{'where':{'endtime':{'$between':[moment()[_0x3033('0x9')](_0x4f0457,_0x3033('0xa'))['format'](_0x3033('0xb')),moment()[_0x3033('0xc')](_0x3033('0xb'))]}},'raw':![]},'log':_0x3033('0xd')});};exports[_0x3033('0xe')]=function(){return function(){return client[_0x3033('0x5')]('GetVoiceQueueHopperHistory',{'options':{'where':{'createdAt':{'$between':[moment()[_0x3033('0xf')](_0x3033('0x10'))[_0x3033('0xc')](_0x3033('0xb')),moment()[_0x3033('0x11')](_0x3033('0x10'))[_0x3033('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x3033('0x4')},'raw':![]},'log':'GetVoiceQueueHopperHistory'});};};exports[_0x3033('0x12')]=function(){return function(){return client['Request'](_0x3033('0x13'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x3033('0x10'))[_0x3033('0xc')](_0x3033('0xb')),moment()[_0x3033('0x11')](_0x3033('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x3033('0x14')},'raw':![]},'log':_0x3033('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index ee6af65..101751b 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa7b5=['TrunkId','ListId','key','Trunk','getFaxAccount','NotifyFaxAccount','../client','Request','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech'];(function(_0x356ef7,_0x163d2a){var _0x4cec0d=function(_0x390259){while(--_0x390259){_0x356ef7['push'](_0x356ef7['shift']());}};_0x4cec0d(++_0x163d2a);}(_0xa7b5,0x15a));var _0x5a7b=function(_0xde28d8,_0x15c8be){_0xde28d8=_0xde28d8-0x0;var _0x2d221d=_0xa7b5[_0xde28d8];return _0x2d221d;};'use strict';var client=require(_0x5a7b('0x0'));exports['getFaxAccounts']=function(){return function(){return client[_0x5a7b('0x1')]('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0x5a7b('0x2'),_0x5a7b('0x3'),_0x5a7b('0x4'),_0x5a7b('0x5'),_0x5a7b('0x6'),_0x5a7b('0x7'),_0x5a7b('0x8'),_0x5a7b('0x9'),_0x5a7b('0xa'),_0x5a7b('0xb'),_0x5a7b('0xc'),_0x5a7b('0xd'),_0x5a7b('0xe'),_0x5a7b('0xf'),_0x5a7b('0x10')],'include':[{'model':_0x5a7b('0x11'),'as':_0x5a7b('0x11'),'attributes':['id',_0x5a7b('0x2'),'callerid','active']}]},'log':_0x5a7b('0x12')});};};exports['notify']=function(_0xfd7963,_0xe679a2){return client[_0x5a7b('0x1')](_0x5a7b('0x13'),{'account':{'id':_0xfd7963},'body':_0xe679a2,'log':_0x5a7b('0x13')});}; \ No newline at end of file +var _0x5454=['callerid','active','getFaxAccount','Request','NotifyFaxAccount','GetFaxAccount','headerinfo','localstationid','minrate','maxrate','gateway','faxdetect','t38timeout','tech','TrunkId','ListId','key','Trunk','name'];(function(_0x1c4905,_0x3b0e2a){var _0x43c0c6=function(_0x168766){while(--_0x168766){_0x1c4905['push'](_0x1c4905['shift']());}};_0x43c0c6(++_0x3b0e2a);}(_0x5454,0x15b));var _0x4545=function(_0x5dfb32,_0x20f1c7){_0x5dfb32=_0x5dfb32-0x0;var _0x52238d=_0x5454[_0x5dfb32];return _0x52238d;};'use strict';var client=require('../client');exports['getFaxAccounts']=function(){return function(){return client['Request'](_0x4545('0x0'),{'options':{'raw':![],'attributes':['id','name','description','ecm',_0x4545('0x1'),_0x4545('0x2'),_0x4545('0x3'),_0x4545('0x4'),'modem',_0x4545('0x5'),_0x4545('0x6'),_0x4545('0x7'),_0x4545('0x8'),_0x4545('0x9'),_0x4545('0xa'),_0x4545('0xb')],'include':[{'model':_0x4545('0xc'),'as':_0x4545('0xc'),'attributes':['id',_0x4545('0xd'),_0x4545('0xe'),_0x4545('0xf')]}]},'log':_0x4545('0x10')});};};exports['notify']=function(_0x869994,_0x38fc64){return client[_0x4545('0x11')](_0x4545('0x12'),{'account':{'id':_0x869994},'body':_0x38fc64,'log':_0x4545('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index b0b8153..262ab5d 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfaa6=['../client','update','Request','UpdateFaxMessage'];(function(_0x9860e6,_0x238ca3){var _0x49ec8f=function(_0x3c41cd){while(--_0x3c41cd){_0x9860e6['push'](_0x9860e6['shift']());}};_0x49ec8f(++_0x238ca3);}(_0xfaa6,0x1e8));var _0x6faa=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0xfaa6[_0x43b487];return _0x2f707a;};'use strict';var client=require(_0x6faa('0x0'));exports[_0x6faa('0x1')]=function(_0x451a4d,_0x87c535){return client[_0x6faa('0x2')](_0x6faa('0x3'),{'body':_0x87c535,'options':{'where':{'AttachmentId':_0x451a4d}},'log':_0x6faa('0x3')});}; \ No newline at end of file +var _0x7a62=['UpdateFaxMessage','../client','update','Request'];(function(_0x3fdf77,_0x518426){var _0x478b20=function(_0x3f078c){while(--_0x3f078c){_0x3fdf77['push'](_0x3fdf77['shift']());}};_0x478b20(++_0x518426);}(_0x7a62,0x7d));var _0x27a6=function(_0x3871e3,_0x4e5762){_0x3871e3=_0x3871e3-0x0;var _0x44fa61=_0x7a62[_0x3871e3];return _0x44fa61;};'use strict';var client=require(_0x27a6('0x0'));exports[_0x27a6('0x1')]=function(_0x49562f,_0x24485d){return client[_0x27a6('0x2')](_0x27a6('0x3'),{'body':_0x24485d,'options':{'where':{'AttachmentId':_0x49562f}},'log':_0x27a6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 2810586..fd7fcd7 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4832=['content','variableName','Variable','key','keyType','keyContent','Fields','idField','customField','Tags','../../client','getDeskAccounts','GetDeskAccount','name','description','username','password','remoteUri','authType','type','DeskConfiguration','Configurations','DeskField','Subjects'];(function(_0x3976a4,_0x3d2578){var _0x54d528=function(_0x199615){while(--_0x199615){_0x3976a4['push'](_0x3976a4['shift']());}};_0x54d528(++_0x3d2578);}(_0x4832,0xfa));var _0x2483=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x4832[_0x2b10c6];return _0x3789d2;};'use strict';var client=require(_0x2483('0x0'));exports[_0x2483('0x1')]=function(){return function(_0x13b2e6){return client['Request'](_0x2483('0x2'),{'options':{'raw':![],'attributes':['id',_0x2483('0x3'),_0x2483('0x4'),_0x2483('0x5'),_0x2483('0x6'),_0x2483('0x7'),_0x2483('0x8'),_0x2483('0x9'),'serverUrl'],'include':[{'model':_0x2483('0xa'),'as':_0x2483('0xb'),'attributes':['id',_0x2483('0x3')],'include':[{'model':_0x2483('0xc'),'as':_0x2483('0xd'),'attributes':['id','type',_0x2483('0xe'),_0x2483('0xf')],'include':[{'model':'Variable','as':_0x2483('0x10'),'attributes':['id',_0x2483('0x3')]}]},{'model':'DeskField','as':'Descriptions','attributes':['id',_0x2483('0x9'),'content',_0x2483('0x11'),_0x2483('0x12'),_0x2483('0x13'),_0x2483('0xf')],'include':[{'model':'Variable','as':_0x2483('0x10'),'attributes':['id',_0x2483('0x3')]}]},{'model':_0x2483('0xc'),'as':_0x2483('0x14'),'attributes':['id',_0x2483('0x9'),_0x2483('0xe'),_0x2483('0x15'),'nameField',_0x2483('0x16'),_0x2483('0xf')],'include':[{'model':_0x2483('0x10'),'as':_0x2483('0x10'),'attributes':['id',_0x2483('0x3')]}]},{'model':'Tag','as':_0x2483('0x17'),'attributes':['id',_0x2483('0x3')]}]}]},'log':_0x2483('0x2')});};}; \ No newline at end of file +var _0xde8d=['customField','Tag','Tags','../../client','Request','name','description','username','password','remoteUri','authType','serverUrl','DeskConfiguration','Configurations','Subjects','content','variableName','Variable','DeskField','Descriptions','key','keyContent','Fields','idField','nameField'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xde8d,0x116));var _0xdde8=function(_0x36ea59,_0x2caa5b){_0x36ea59=_0x36ea59-0x0;var _0x5c7427=_0xde8d[_0x36ea59];return _0x5c7427;};'use strict';var client=require(_0xdde8('0x0'));exports['getDeskAccounts']=function(){return function(_0x5d168c){return client[_0xdde8('0x1')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0xdde8('0x2'),_0xdde8('0x3'),_0xdde8('0x4'),_0xdde8('0x5'),_0xdde8('0x6'),_0xdde8('0x7'),'type',_0xdde8('0x8')],'include':[{'model':_0xdde8('0x9'),'as':_0xdde8('0xa'),'attributes':['id','name'],'include':[{'model':'DeskField','as':_0xdde8('0xb'),'attributes':['id','type',_0xdde8('0xc'),_0xdde8('0xd')],'include':[{'model':'Variable','as':_0xdde8('0xe'),'attributes':['id',_0xdde8('0x2')]}]},{'model':_0xdde8('0xf'),'as':_0xdde8('0x10'),'attributes':['id','type',_0xdde8('0xc'),_0xdde8('0x11'),'keyType',_0xdde8('0x12'),_0xdde8('0xd')],'include':[{'model':_0xdde8('0xe'),'as':_0xdde8('0xe'),'attributes':['id','name']}]},{'model':_0xdde8('0xf'),'as':_0xdde8('0x13'),'attributes':['id','type',_0xdde8('0xc'),_0xdde8('0x14'),_0xdde8('0x15'),_0xdde8('0x16'),'variableName'],'include':[{'model':'Variable','as':_0xdde8('0xe'),'attributes':['id',_0xdde8('0x2')]}]},{'model':_0xdde8('0x17'),'as':_0xdde8('0x18'),'attributes':['id',_0xdde8('0x2')]}]}]},'log':'GetDeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 1d2c1ae..afb766c 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc06d=['Dynamics365Field','content','Variable','Descriptions','type','keyType','keyContent','variableName','Fields','idField','nameField','customField','CloudProvider','data2','data5','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','tenantId','clientSecret','serverUrl','Dynamics365Configuration','Configurations','ticketType','moduleCreate','additionalSearchContact','openNewTab'];(function(_0x4b1d03,_0x3860f5){var _0x3b799c=function(_0x4863f6){while(--_0x4863f6){_0x4b1d03['push'](_0x4b1d03['shift']());}};_0x3b799c(++_0x3860f5);}(_0xc06d,0x15a));var _0xdc06=function(_0x23c5ac,_0x2945b4){_0x23c5ac=_0x23c5ac-0x0;var _0x2fdba0=_0xc06d[_0x23c5ac];return _0x2fdba0;};'use strict';var client=require(_0xdc06('0x0'));exports[_0xdc06('0x1')]=function(){return function(_0x3d4a6a){return client[_0xdc06('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0xdc06('0x3'),_0xdc06('0x4'),'password','remoteUri',_0xdc06('0x5'),'clientId',_0xdc06('0x6'),_0xdc06('0x7'),'description','modernAuthentication'],'include':[{'model':_0xdc06('0x8'),'as':_0xdc06('0x9'),'attributes':['id','name',_0xdc06('0xa'),_0xdc06('0xb'),_0xdc06('0xc'),_0xdc06('0xd')],'include':[{'model':_0xdc06('0xe'),'as':'Subjects','attributes':['id','type',_0xdc06('0xf'),'variableName'],'include':[{'model':_0xdc06('0x10'),'as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]},{'model':_0xdc06('0xe'),'as':_0xdc06('0x11'),'attributes':['id',_0xdc06('0x12'),'content','key',_0xdc06('0x13'),_0xdc06('0x14'),_0xdc06('0x15')],'include':[{'model':'Variable','as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]},{'model':_0xdc06('0xe'),'as':_0xdc06('0x16'),'attributes':['id',_0xdc06('0x12'),'content',_0xdc06('0x17'),_0xdc06('0x18'),_0xdc06('0x19'),_0xdc06('0x15')],'include':[{'model':_0xdc06('0x10'),'as':_0xdc06('0x10'),'attributes':['id',_0xdc06('0x3')]}]}]},{'model':'CloudProvider','as':_0xdc06('0x1a'),'attributes':['id',_0xdc06('0x1b'),_0xdc06('0x1c'),'data7']}]},'log':_0xdc06('0x1d')});};}; \ No newline at end of file +var _0x34b7=['data2','Request','GetDynamics365Account','name','username','password','clientId','clientSecret','serverUrl','description','modernAuthentication','Dynamics365Configuration','ticketType','Dynamics365Field','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField','CloudProvider'];(function(_0x35dc6a,_0x273cf4){var _0x38425c=function(_0x11522b){while(--_0x11522b){_0x35dc6a['push'](_0x35dc6a['shift']());}};_0x38425c(++_0x273cf4);}(_0x34b7,0x196));var _0x734b=function(_0x538b31,_0x80e294){_0x538b31=_0x538b31-0x0;var _0x4348f0=_0x34b7[_0x538b31];return _0x4348f0;};'use strict';var client=require('../../client');exports['getDynamics365Accounts']=function(){return function(_0x43a5f1){return client[_0x734b('0x0')](_0x734b('0x1'),{'options':{'raw':![],'attributes':['id',_0x734b('0x2'),_0x734b('0x3'),_0x734b('0x4'),'remoteUri','tenantId',_0x734b('0x5'),_0x734b('0x6'),_0x734b('0x7'),_0x734b('0x8'),_0x734b('0x9')],'include':[{'model':_0x734b('0xa'),'as':'Configurations','attributes':['id',_0x734b('0x2'),_0x734b('0xb'),'moduleCreate','additionalSearchContact','openNewTab'],'include':[{'model':_0x734b('0xc'),'as':'Subjects','attributes':['id',_0x734b('0xd'),_0x734b('0xe'),_0x734b('0xf')],'include':[{'model':_0x734b('0x10'),'as':_0x734b('0x10'),'attributes':['id',_0x734b('0x2')]}]},{'model':_0x734b('0xc'),'as':_0x734b('0x11'),'attributes':['id',_0x734b('0xd'),_0x734b('0xe'),_0x734b('0x12'),_0x734b('0x13'),_0x734b('0x14'),_0x734b('0xf')],'include':[{'model':'Variable','as':_0x734b('0x10'),'attributes':['id',_0x734b('0x2')]}]},{'model':_0x734b('0xc'),'as':_0x734b('0x15'),'attributes':['id',_0x734b('0xd'),_0x734b('0xe'),_0x734b('0x16'),_0x734b('0x17'),_0x734b('0x18'),_0x734b('0xf')],'include':[{'model':_0x734b('0x10'),'as':'Variable','attributes':['id',_0x734b('0x2')]}]}]},{'model':_0x734b('0x19'),'as':_0x734b('0x19'),'attributes':['id',_0x734b('0x1a'),'data5','data7']}]},'log':_0x734b('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index be22c2b..39bfd6b 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb264=['name','FreshdeskField','type','content','variableName','Variable','Descriptions','key','keyContent','Fields','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request','username','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations'];(function(_0x30adc4,_0x315a03){var _0x7da095=function(_0x5df479){while(--_0x5df479){_0x30adc4['push'](_0x30adc4['shift']());}};_0x7da095(++_0x315a03);}(_0xb264,0x108));var _0x4b26=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb264[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x4b26('0x0'));exports[_0x4b26('0x1')]=function(){return function(_0x53d2eb){return client[_0x4b26('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id','name',_0x4b26('0x3'),_0x4b26('0x4'),_0x4b26('0x5'),_0x4b26('0x6')],'include':[{'model':_0x4b26('0x7'),'as':_0x4b26('0x8'),'attributes':['id',_0x4b26('0x9')],'include':[{'model':'Tag','attributes':['id',_0x4b26('0x9')]},{'model':_0x4b26('0xa'),'as':'Subjects','attributes':['id',_0x4b26('0xb'),_0x4b26('0xc'),_0x4b26('0xd')],'include':[{'model':'Variable','as':_0x4b26('0xe'),'attributes':['id',_0x4b26('0x9')]}]},{'model':_0x4b26('0xa'),'as':_0x4b26('0xf'),'attributes':['id',_0x4b26('0xb'),'content',_0x4b26('0x10'),'keyType',_0x4b26('0x11'),_0x4b26('0xd')],'include':[{'model':_0x4b26('0xe'),'as':_0x4b26('0xe'),'attributes':['id',_0x4b26('0x9')]}]},{'model':'FreshdeskField','as':_0x4b26('0x12'),'attributes':['id',_0x4b26('0xb'),'content','idField',_0x4b26('0x13'),'customField',_0x4b26('0xd')],'include':[{'model':_0x4b26('0xe'),'as':_0x4b26('0xe'),'attributes':['id','name']}]}]}]},'log':_0x4b26('0x14')});};}; \ No newline at end of file +var _0x0bb4=['Descriptions','type','key','keyType','keyContent','variableName','Fields','nameField','customField','../../client','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','remoteUri','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','content','Variable'];(function(_0x16d10f,_0x2ba2d5){var _0x50c823=function(_0x44e43f){while(--_0x44e43f){_0x16d10f['push'](_0x16d10f['shift']());}};_0x50c823(++_0x2ba2d5);}(_0x0bb4,0x77));var _0x40bb=function(_0x4e1e68,_0x2ca910){_0x4e1e68=_0x4e1e68-0x0;var _0x15639b=_0x0bb4[_0x4e1e68];return _0x15639b;};'use strict';var client=require(_0x40bb('0x0'));exports[_0x40bb('0x1')]=function(){return function(_0x4c9712){return client[_0x40bb('0x2')](_0x40bb('0x3'),{'options':{'raw':![],'attributes':['id',_0x40bb('0x4'),_0x40bb('0x5'),'apiKey',_0x40bb('0x6'),'serverUrl'],'include':[{'model':_0x40bb('0x7'),'as':'Configurations','attributes':['id',_0x40bb('0x4')],'include':[{'model':_0x40bb('0x8'),'attributes':['id','name']},{'model':_0x40bb('0x9'),'as':_0x40bb('0xa'),'attributes':['id','type',_0x40bb('0xb'),'variableName'],'include':[{'model':_0x40bb('0xc'),'as':_0x40bb('0xc'),'attributes':['id',_0x40bb('0x4')]}]},{'model':_0x40bb('0x9'),'as':_0x40bb('0xd'),'attributes':['id',_0x40bb('0xe'),_0x40bb('0xb'),_0x40bb('0xf'),_0x40bb('0x10'),_0x40bb('0x11'),_0x40bb('0x12')],'include':[{'model':_0x40bb('0xc'),'as':_0x40bb('0xc'),'attributes':['id',_0x40bb('0x4')]}]},{'model':_0x40bb('0x9'),'as':_0x40bb('0x13'),'attributes':['id',_0x40bb('0xe'),'content','idField',_0x40bb('0x14'),_0x40bb('0x15'),_0x40bb('0x12')],'include':[{'model':_0x40bb('0xc'),'as':_0x40bb('0xc'),'attributes':['id',_0x40bb('0x4')]}]}]}]},'log':_0x40bb('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index e7a74c5..2714784 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8c46=['FreshsalesField','Subjects','type','variableName','Variable','Descriptions','keyType','keyContent','GetFreshsalesccount','../../client','Request','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0x8c46,0x171));var _0x68c4=function(_0x1035ab,_0x2f9249){_0x1035ab=_0x1035ab-0x0;var _0x451ef1=_0x8c46[_0x1035ab];return _0x451ef1;};'use strict';var client=require(_0x68c4('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x51f442){return client[_0x68c4('0x1')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id','name',_0x68c4('0x2'),_0x68c4('0x3'),_0x68c4('0x4'),_0x68c4('0x5')],'include':[{'model':_0x68c4('0x6'),'as':_0x68c4('0x7'),'attributes':['id',_0x68c4('0x8')],'include':[{'model':_0x68c4('0x9'),'as':_0x68c4('0xa'),'attributes':['id',_0x68c4('0xb'),'content',_0x68c4('0xc')],'include':[{'model':_0x68c4('0xd'),'as':_0x68c4('0xd'),'attributes':['id','name']}]},{'model':_0x68c4('0x9'),'as':_0x68c4('0xe'),'attributes':['id',_0x68c4('0xb'),'content','key',_0x68c4('0xf'),_0x68c4('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x68c4('0xd'),'attributes':['id',_0x68c4('0x8')]}]}]}]},'log':_0x68c4('0x11')});};}; \ No newline at end of file +var _0x0e4b=['getFreshsalesAccounts','GetFreshsalesAccount','serverUrl','FreshsalesConfiguration','name','FreshsalesField','Subjects','type','content','Variable','Descriptions','key','keyType','keyContent','variableName','GetFreshsalesccount','../../client'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5d0e93,_0x46a5e6){_0x5d0e93=_0x5d0e93-0x0;var _0x31890a=_0x0e4b[_0x5d0e93];return _0x31890a;};'use strict';var client=require(_0xb0e4('0x0'));exports[_0xb0e4('0x1')]=function(){return function(_0x65d4d1){return client['Request'](_0xb0e4('0x2'),{'options':{'raw':![],'attributes':['id','name','username','apiKey','remoteUri',_0xb0e4('0x3')],'include':[{'model':_0xb0e4('0x4'),'as':'Configurations','attributes':['id',_0xb0e4('0x5')],'include':[{'model':_0xb0e4('0x6'),'as':_0xb0e4('0x7'),'attributes':['id',_0xb0e4('0x8'),_0xb0e4('0x9'),'variableName'],'include':[{'model':'Variable','as':_0xb0e4('0xa'),'attributes':['id',_0xb0e4('0x5')]}]},{'model':_0xb0e4('0x6'),'as':_0xb0e4('0xb'),'attributes':['id',_0xb0e4('0x8'),_0xb0e4('0x9'),_0xb0e4('0xc'),_0xb0e4('0xd'),_0xb0e4('0xe'),_0xb0e4('0xf')],'include':[{'model':_0xb0e4('0xa'),'as':_0xb0e4('0xa'),'attributes':['id',_0xb0e4('0x5')]}]}]}]},'log':_0xb0e4('0x10')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 1b95123..4dc757b 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa3d4=['type','SalesforceConfiguration','Configurations','name','moduleSearch','moduleCreate','ticketType','leadId','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','Request','GetSalesforceAccount','username','serverUrl'];(function(_0x7bd0ef,_0x4f08dd){var _0x323e43=function(_0xa8b583){while(--_0xa8b583){_0x7bd0ef['push'](_0x7bd0ef['shift']());}};_0x323e43(++_0x4f08dd);}(_0xa3d4,0x151));var _0x4a3d=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xa3d4[_0x4d613c];return _0x301fe3;};'use strict';var client=require(_0x4a3d('0x0'));exports['getSalesforceAccounts']=function(){return function(_0x159971){return client[_0x4a3d('0x1')](_0x4a3d('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x4a3d('0x3'),'password','remoteUri','clientId','clientSecret','securityToken',_0x4a3d('0x4'),_0x4a3d('0x5')],'include':[{'model':_0x4a3d('0x6'),'as':_0x4a3d('0x7'),'attributes':['id',_0x4a3d('0x8'),_0x4a3d('0x9'),_0x4a3d('0xa'),_0x4a3d('0xb'),_0x4a3d('0xc'),'additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x4a3d('0xd'),'as':_0x4a3d('0xe'),'include':[{'model':_0x4a3d('0xf'),'as':_0x4a3d('0xf'),'attributes':['id',_0x4a3d('0x8')]}]},{'model':_0x4a3d('0xd'),'as':_0x4a3d('0x10'),'include':[{'model':_0x4a3d('0xf'),'as':_0x4a3d('0xf'),'attributes':['id',_0x4a3d('0x8')]}]},{'model':_0x4a3d('0xd'),'as':_0x4a3d('0x11'),'include':[{'model':_0x4a3d('0xf'),'as':_0x4a3d('0xf'),'attributes':['id',_0x4a3d('0x8')]}]}]}]},'log':_0x4a3d('0x2')});};}; \ No newline at end of file +var _0x9db7=['type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','additionalSearchAccount','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','GetSalesforceAccount','../../client','getSalesforceAccounts','Request','name','password','remoteUri','clientSecret','securityToken','serverUrl'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9db7,0x1bf));var _0x79db=function(_0x3f52b6,_0x55cafb){_0x3f52b6=_0x3f52b6-0x0;var _0x1d3517=_0x9db7[_0x3f52b6];return _0x1d3517;};'use strict';var client=require(_0x79db('0x0'));exports[_0x79db('0x1')]=function(){return function(_0x435fde){return client[_0x79db('0x2')]('GetSalesforceAccount',{'options':{'raw':![],'attributes':['id',_0x79db('0x3'),'username',_0x79db('0x4'),_0x79db('0x5'),'clientId',_0x79db('0x6'),_0x79db('0x7'),_0x79db('0x8'),_0x79db('0x9')],'include':[{'model':_0x79db('0xa'),'as':_0x79db('0xb'),'attributes':['id',_0x79db('0x3'),_0x79db('0xc'),_0x79db('0xd'),_0x79db('0xe'),_0x79db('0xf'),_0x79db('0x10'),'additionalSearchContact',_0x79db('0x11')],'include':[{'model':_0x79db('0x12'),'as':_0x79db('0x13'),'include':[{'model':_0x79db('0x14'),'as':_0x79db('0x14'),'attributes':['id',_0x79db('0x3')]}]},{'model':_0x79db('0x12'),'as':_0x79db('0x15'),'include':[{'model':_0x79db('0x14'),'as':'Variable','attributes':['id','name']}]},{'model':'SalesforceField','as':_0x79db('0x16'),'include':[{'model':'Variable','as':_0x79db('0x14'),'attributes':['id','name']}]}]}]},'log':_0x79db('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 1223c51..dc00b4b 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabce=['password','email','ServicenowConfiguration','name','Subjects','type','content','Variable','ServicenowField','Descriptions','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','getServicenowAccounts','Request','GetServicenowAccount','username'];(function(_0x1d6a5f,_0x6ad489){var _0x1ad86c=function(_0x562227){while(--_0x562227){_0x1d6a5f['push'](_0x1d6a5f['shift']());}};_0x1ad86c(++_0x6ad489);}(_0xabce,0x103));var _0xeabc=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xabce[_0x32d457];return _0x338386;};'use strict';var client=require(_0xeabc('0x0'));exports[_0xeabc('0x1')]=function(){return function(_0x357cda){return client[_0xeabc('0x2')](_0xeabc('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0xeabc('0x4'),_0xeabc('0x5'),_0xeabc('0x6'),'remoteUri','serverUrl'],'include':[{'model':_0xeabc('0x7'),'as':'Configurations','attributes':['id',_0xeabc('0x8')],'include':[{'model':'ServicenowField','as':_0xeabc('0x9'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),'variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0xe'),'attributes':['id',_0xeabc('0xa'),_0xeabc('0xb'),_0xeabc('0xf'),_0xeabc('0x10'),_0xeabc('0x11'),_0xeabc('0x12')],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]},{'model':_0xeabc('0xd'),'as':_0xeabc('0x13'),'attributes':['id','type',_0xeabc('0xb'),_0xeabc('0x14'),_0xeabc('0x15'),'customField','variableName'],'include':[{'model':_0xeabc('0xc'),'as':_0xeabc('0xc'),'attributes':['id',_0xeabc('0x8')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0xc4aa=['keyContent','Fields','content','idField','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request','GetServicenowAccount','name','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','variableName','Variable','Descriptions','type','key'];(function(_0x1b0050,_0x3b805e){var _0x40933f=function(_0x1566dc){while(--_0x1566dc){_0x1b0050['push'](_0x1b0050['shift']());}};_0x40933f(++_0x3b805e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xc4aa[_0x32f7d7];return _0x133d09;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(_0x40a0d0){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),'description','username','password',_0xac4a('0x5'),_0xac4a('0x6'),_0xac4a('0x7')],'include':[{'model':_0xac4a('0x8'),'as':_0xac4a('0x9'),'attributes':['id',_0xac4a('0x4')],'include':[{'model':_0xac4a('0xa'),'as':_0xac4a('0xb'),'attributes':['id','type','content',_0xac4a('0xc')],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id','name']}]},{'model':_0xac4a('0xa'),'as':_0xac4a('0xe'),'attributes':['id',_0xac4a('0xf'),'content',_0xac4a('0x10'),'keyType',_0xac4a('0x11'),'variableName'],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id',_0xac4a('0x4')]}]},{'model':'ServicenowField','as':_0xac4a('0x12'),'attributes':['id',_0xac4a('0xf'),_0xac4a('0x13'),_0xac4a('0x14'),_0xac4a('0x15'),_0xac4a('0x16'),_0xac4a('0xc')],'include':[{'model':_0xac4a('0xd'),'as':_0xac4a('0xd'),'attributes':['id',_0xac4a('0x4')]}]}]}]},'log':_0xac4a('0x17')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index bf3b821..0b26544 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x2740ec,_0x4629fb){var _0x54daae=function(_0x1b18c0){while(--_0x1b18c0){_0x2740ec['push'](_0x2740ec['shift']());}};_0x54daae(++_0x4629fb);}(_0x2032,0xd9));var _0x2203=function(_0x4f2171,_0x32b221){_0x4f2171=_0x4f2171-0x0;var _0x29db8f=_0x2032[_0x4f2171];return _0x29db8f;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ No newline at end of file +var _0x0b0e=['Configurations','SugarcrmField','Subjects','variableName','Variable','Descriptions','type','key','keyType','Fields','content','idField','customField','../../client','GetSugarcrmAccount','name','username','password','remoteUri','serverUrl','SugarcrmConfiguration'];(function(_0x1814cd,_0x13f4a0){var _0xd1b3ff=function(_0x292fc9){while(--_0x292fc9){_0x1814cd['push'](_0x1814cd['shift']());}};_0xd1b3ff(++_0x13f4a0);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4d35f3,_0x19ba66){_0x4d35f3=_0x4d35f3-0x0;var _0x382fea=_0x0b0e[_0x4d35f3];return _0x382fea;};'use strict';var client=require(_0xe0b0('0x0'));exports['getSugarcrmAccounts']=function(){return function(_0xc416e3){return client['Request'](_0xe0b0('0x1'),{'options':{'raw':![],'attributes':['id',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6')],'include':[{'model':_0xe0b0('0x7'),'as':_0xe0b0('0x8'),'attributes':['id',_0xe0b0('0x2')],'include':[{'model':_0xe0b0('0x9'),'as':_0xe0b0('0xa'),'attributes':['id','type','content',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]},{'model':'SugarcrmField','as':_0xe0b0('0xd'),'attributes':['id',_0xe0b0('0xe'),'content',_0xe0b0('0xf'),_0xe0b0('0x10'),'keyContent',_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id','name']}]},{'model':_0xe0b0('0x9'),'as':_0xe0b0('0x11'),'attributes':['id',_0xe0b0('0xe'),_0xe0b0('0x12'),_0xe0b0('0x13'),'nameField',_0xe0b0('0x14'),_0xe0b0('0xb')],'include':[{'model':_0xe0b0('0xc'),'as':_0xe0b0('0xc'),'attributes':['id',_0xe0b0('0x2')]}]}]}]},'log':'GetSugarcrmAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 8cac27e..973a7f5 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x86eb=['Subjects','variableName','Variable','VtigerField','Descriptions','content','keyType','keyContent','Fields','type','nameField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','username','accessKey','VtigerConfiguration'];(function(_0x46952d,_0x5a4c42){var _0x4652cb=function(_0x254095){while(--_0x254095){_0x46952d['push'](_0x46952d['shift']());}};_0x4652cb(++_0x5a4c42);}(_0x86eb,0x188));var _0xb86e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x86eb[_0x122ef9];return _0x42fba0;};'use strict';var client=require('../../client');exports[_0xb86e('0x0')]=function(){return function(_0x53e535){return client[_0xb86e('0x1')](_0xb86e('0x2'),{'options':{'raw':![],'attributes':['id',_0xb86e('0x3'),'description',_0xb86e('0x4'),_0xb86e('0x5'),'remoteUri','serverUrl'],'include':[{'model':_0xb86e('0x6'),'as':'Configurations','attributes':['id','name'],'include':[{'model':'VtigerField','as':_0xb86e('0x7'),'attributes':['id','type','content',_0xb86e('0x8')],'include':[{'model':_0xb86e('0x9'),'as':_0xb86e('0x9'),'attributes':['id',_0xb86e('0x3')]}]},{'model':_0xb86e('0xa'),'as':_0xb86e('0xb'),'attributes':['id','type',_0xb86e('0xc'),'key',_0xb86e('0xd'),_0xb86e('0xe'),'variableName'],'include':[{'model':_0xb86e('0x9'),'as':_0xb86e('0x9'),'attributes':['id','name']}]},{'model':_0xb86e('0xa'),'as':_0xb86e('0xf'),'attributes':['id',_0xb86e('0x10'),_0xb86e('0xc'),'idField',_0xb86e('0x11'),_0xb86e('0x12'),'variableName'],'include':[{'model':_0xb86e('0x9'),'as':_0xb86e('0x9'),'attributes':['id',_0xb86e('0x3')]}]}]}]},'log':_0xb86e('0x2')});};}; \ No newline at end of file +var _0x0028=['VtigerField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','idField','customField','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','serverUrl','VtigerConfiguration'];(function(_0xbcc6e1,_0x4c42f6){var _0x4985f9=function(_0x2f96ec){while(--_0x2f96ec){_0xbcc6e1['push'](_0xbcc6e1['shift']());}};_0x4985f9(++_0x4c42f6);}(_0x0028,0x15b));var _0x8002=function(_0x237815,_0x1ef2b0){_0x237815=_0x237815-0x0;var _0x5498ee=_0x0028[_0x237815];return _0x5498ee;};'use strict';var client=require('../../client');exports[_0x8002('0x0')]=function(){return function(_0x544602){return client[_0x8002('0x1')](_0x8002('0x2'),{'options':{'raw':![],'attributes':['id',_0x8002('0x3'),_0x8002('0x4'),_0x8002('0x5'),_0x8002('0x6'),_0x8002('0x7'),_0x8002('0x8')],'include':[{'model':_0x8002('0x9'),'as':'Configurations','attributes':['id',_0x8002('0x3')],'include':[{'model':_0x8002('0xa'),'as':_0x8002('0xb'),'attributes':['id',_0x8002('0xc'),_0x8002('0xd'),_0x8002('0xe')],'include':[{'model':'Variable','as':_0x8002('0xf'),'attributes':['id',_0x8002('0x3')]}]},{'model':_0x8002('0xa'),'as':_0x8002('0x10'),'attributes':['id',_0x8002('0xc'),_0x8002('0xd'),_0x8002('0x11'),_0x8002('0x12'),'keyContent',_0x8002('0xe')],'include':[{'model':_0x8002('0xf'),'as':_0x8002('0xf'),'attributes':['id',_0x8002('0x3')]}]},{'model':_0x8002('0xa'),'as':'Fields','attributes':['id','type',_0x8002('0xd'),_0x8002('0x13'),'nameField',_0x8002('0x14'),_0x8002('0xe')],'include':[{'model':_0x8002('0xf'),'as':_0x8002('0xf'),'attributes':['id',_0x8002('0x3')]}]}]}]},'log':_0x8002('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 394baf2..8784f91 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xabdb=['ZendeskField','Subjects','variableName','Variable','Descriptions','content','key','keyType','Fields','idField','customField','getZendeskAccounts','Request','GetZendeskAccount','username','password','token','remoteUri','authType','type','ZendeskConfiguration','name','Tag'];(function(_0x332f74,_0x383385){var _0x3a5115=function(_0x59de59){while(--_0x59de59){_0x332f74['push'](_0x332f74['shift']());}};_0x3a5115(++_0x383385);}(_0xabdb,0x14d));var _0xbabd=function(_0x31e80d,_0x10ef41){_0x31e80d=_0x31e80d-0x0;var _0x4dc249=_0xabdb[_0x31e80d];return _0x4dc249;};'use strict';var client=require('../../client');exports[_0xbabd('0x0')]=function(){return function(_0x36e8b6){return client[_0xbabd('0x1')](_0xbabd('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbabd('0x3'),_0xbabd('0x4'),_0xbabd('0x5'),_0xbabd('0x6'),_0xbabd('0x7'),'serverUrl',_0xbabd('0x8')],'include':[{'model':_0xbabd('0x9'),'as':'Configurations','attributes':['id',_0xbabd('0xa')],'include':[{'model':_0xbabd('0xb'),'attributes':['id',_0xbabd('0xa')]},{'model':_0xbabd('0xc'),'as':_0xbabd('0xd'),'attributes':['id','type','content',_0xbabd('0xe')],'include':[{'model':_0xbabd('0xf'),'as':_0xbabd('0xf'),'attributes':['id','name']}]},{'model':_0xbabd('0xc'),'as':_0xbabd('0x10'),'attributes':['id',_0xbabd('0x8'),_0xbabd('0x11'),_0xbabd('0x12'),_0xbabd('0x13'),'keyContent',_0xbabd('0xe')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0xbabd('0xa')]}]},{'model':_0xbabd('0xc'),'as':_0xbabd('0x14'),'attributes':['id','type','content',_0xbabd('0x15'),'nameField',_0xbabd('0x16'),_0xbabd('0xe')],'include':[{'model':_0xbabd('0xf'),'as':'Variable','attributes':['id',_0xbabd('0xa')]}]}]}]},'log':_0xbabd('0x2')});};}; \ No newline at end of file +var _0x4819=['key','keyType','Fields','idField','Request','GetZendeskAccount','name','password','token','remoteUri','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField','content','variableName','Variable','Descriptions'];(function(_0x3c6476,_0x276086){var _0x6d5e6b=function(_0x2938da){while(--_0x2938da){_0x3c6476['push'](_0x3c6476['shift']());}};_0x6d5e6b(++_0x276086);}(_0x4819,0x130));var _0x9481=function(_0x59fffa,_0x5a61db){_0x59fffa=_0x59fffa-0x0;var _0x281d4e=_0x4819[_0x59fffa];return _0x281d4e;};'use strict';var client=require('../../client');exports['getZendeskAccounts']=function(){return function(_0x3b0582){return client[_0x9481('0x0')](_0x9481('0x1'),{'options':{'raw':![],'attributes':['id',_0x9481('0x2'),'username',_0x9481('0x3'),_0x9481('0x4'),_0x9481('0x5'),'authType',_0x9481('0x6'),_0x9481('0x7')],'include':[{'model':_0x9481('0x8'),'as':_0x9481('0x9'),'attributes':['id','name'],'include':[{'model':_0x9481('0xa'),'attributes':['id',_0x9481('0x2')]},{'model':_0x9481('0xb'),'as':'Subjects','attributes':['id',_0x9481('0x7'),_0x9481('0xc'),_0x9481('0xd')],'include':[{'model':'Variable','as':_0x9481('0xe'),'attributes':['id',_0x9481('0x2')]}]},{'model':_0x9481('0xb'),'as':_0x9481('0xf'),'attributes':['id','type',_0x9481('0xc'),_0x9481('0x10'),_0x9481('0x11'),'keyContent',_0x9481('0xd')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x9481('0x2')]}]},{'model':_0x9481('0xb'),'as':_0x9481('0x12'),'attributes':['id',_0x9481('0x7'),_0x9481('0xc'),_0x9481('0x13'),'nameField','customField','variableName'],'include':[{'model':_0x9481('0xe'),'as':_0x9481('0xe'),'attributes':['id',_0x9481('0x2')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index 9bb6df1..4d08717 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa551=['../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','serverUrl','code','refreshToken','ZohoConfiguration','Configurations','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','keyContent','Fields','nameField','customField'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0xa551,0x96));var _0x1a55=function(_0x117625,_0x11f259){_0x117625=_0x117625-0x0;var _0x137ae3=_0xa551[_0x117625];return _0x137ae3;};'use strict';var client=require(_0x1a55('0x0'));exports[_0x1a55('0x1')]=function(){return function(_0x33454e){return client[_0x1a55('0x2')](_0x1a55('0x3'),{'options':{'raw':![],'attributes':['id',_0x1a55('0x4'),_0x1a55('0x5'),_0x1a55('0x6'),_0x1a55('0x7'),_0x1a55('0x8'),'clientSecret',_0x1a55('0x9'),_0x1a55('0xa'),_0x1a55('0xb')],'include':[{'model':_0x1a55('0xc'),'as':_0x1a55('0xd'),'attributes':['id','name','moduleCreate',_0x1a55('0xe'),_0x1a55('0x5')],'include':[{'model':_0x1a55('0xf'),'as':_0x1a55('0x10'),'attributes':['id',_0x1a55('0x11'),_0x1a55('0x12'),_0x1a55('0x13')],'include':[{'model':_0x1a55('0x14'),'as':_0x1a55('0x14'),'attributes':['id',_0x1a55('0x4')]}]},{'model':_0x1a55('0xf'),'as':'Descriptions','attributes':['id',_0x1a55('0x11'),_0x1a55('0x12'),'key','keyType',_0x1a55('0x15'),_0x1a55('0x13')],'include':[{'model':_0x1a55('0x14'),'as':_0x1a55('0x14'),'attributes':['id',_0x1a55('0x4')]}]},{'model':_0x1a55('0xf'),'as':_0x1a55('0x16'),'attributes':['id','type',_0x1a55('0x12'),'idField',_0x1a55('0x17'),_0x1a55('0x18'),_0x1a55('0x13')],'include':[{'model':'Variable','as':_0x1a55('0x14'),'attributes':['id',_0x1a55('0x4')]}]}]}]},'log':_0x1a55('0x3')});};}; \ No newline at end of file +var _0x7ad8=['variableName','Variable','Descriptions','content','keyContent','Fields','idField','nameField','../../client','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','serverUrl','code','ZohoConfiguration','Configurations','ZohoField'];(function(_0x1bd3dd,_0x4d441b){var _0x25ed52=function(_0x20fda1){while(--_0x20fda1){_0x1bd3dd['push'](_0x1bd3dd['shift']());}};_0x25ed52(++_0x4d441b);}(_0x7ad8,0x64));var _0x87ad=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x7ad8[_0x5550b3];return _0x4b8fc4;};'use strict';var client=require(_0x87ad('0x0'));exports[_0x87ad('0x1')]=function(){return function(_0x4d9970){return client[_0x87ad('0x2')](_0x87ad('0x3'),{'options':{'raw':![],'attributes':['id',_0x87ad('0x4'),_0x87ad('0x5'),_0x87ad('0x6'),_0x87ad('0x7'),_0x87ad('0x8'),_0x87ad('0x9'),_0x87ad('0xa'),_0x87ad('0xb'),'refreshToken'],'include':[{'model':_0x87ad('0xc'),'as':_0x87ad('0xd'),'attributes':['id','name','moduleCreate','moduleSearch',_0x87ad('0x5')],'include':[{'model':_0x87ad('0xe'),'as':'Subjects','attributes':['id','type','content',_0x87ad('0xf')],'include':[{'model':'Variable','as':_0x87ad('0x10'),'attributes':['id','name']}]},{'model':'ZohoField','as':_0x87ad('0x11'),'attributes':['id','type',_0x87ad('0x12'),'key','keyType',_0x87ad('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x87ad('0x10'),'attributes':['id',_0x87ad('0x4')]}]},{'model':'ZohoField','as':_0x87ad('0x14'),'attributes':['id','type',_0x87ad('0x12'),_0x87ad('0x15'),_0x87ad('0x16'),'customField',_0x87ad('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x87ad('0x4')]}]}]}]},'log':_0x87ad('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index 0022a8c..09f2512 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08bc=['../../../config/logger','dialer','replace','trim','silly','isArray','resolve','every','string','map','length','concat','IntervalIftime','intervalIftime'];(function(_0x3cc8b2,_0x18cdb1){var _0x19a23e=function(_0x176fe0){while(--_0x176fe0){_0x3cc8b2['push'](_0x3cc8b2['shift']());}};_0x19a23e(++_0x18cdb1);}(_0x08bc,0x126));var _0xc08b=function(_0x6dfbaa,_0x31eede){_0x6dfbaa=_0x6dfbaa-0x0;var _0xfbe02=_0x08bc[_0x6dfbaa];return _0xfbe02;};var logger=require(_0xc08b('0x0'))(_0xc08b('0x1'));var client=require('../client');function intervalIftime(_0x1b831f,_0x41ed60){const _0x320070=new Error()['stack'][_0xc08b('0x2')](/^Error/,'')[_0xc08b('0x3')]();logger[_0xc08b('0x4')]('intervalIftime\x20called\x20with',_0x1b831f,_0x41ed60,_0x320070);const _0x43469f=Array[_0xc08b('0x5')](_0x1b831f);if(!_0x1b831f||_0x43469f&&_0x1b831f['length']===0x0){return Promise[_0xc08b('0x6')](![]);}else{var _0x27c5a6=[];var _0x1a0447=[];var _0x24c06f=_0x43469f?_0x1b831f:[_0x1b831f];var _0x5941ed=_0x24c06f['every'](function(_0x2ae83c){return typeof _0x2ae83c==='number';});var _0x3d3a4b=_0x24c06f[_0xc08b('0x7')](function(_0x22010d){return typeof _0x22010d===_0xc08b('0x8');});if(!_0x5941ed&&!_0x3d3a4b){_0x27c5a6=_0x24c06f[_0xc08b('0x9')](function(_0x211867){return _0x211867['id'];});if(_0x27c5a6[_0xc08b('0xa')]===0x0){_0x1a0447=_0x24c06f[_0xc08b('0x9')](function(_0x1c3c11){return _0x1c3c11['interval'];});}}else{if(_0x5941ed){_0x27c5a6=_0x27c5a6[_0xc08b('0xb')](_0x24c06f);}if(_0x3d3a4b){_0x1a0447=_0x1a0447[_0xc08b('0xb')](_0x24c06f);}}return client['Request'](_0xc08b('0xc'),{'intervalIds':_0x27c5a6,'intervals':_0x1a0447,'timezone':_0x41ed60,'log':_0xc08b('0xc')});}}exports[_0xc08b('0xd')]=intervalIftime; \ No newline at end of file +var _0x84bf=['interval','concat','Request','IntervalIftime','../../../config/logger','dialer','../client','stack','replace','silly','intervalIftime\x20called\x20with','isArray','length','every','map'];(function(_0x27815d,_0x10ac7d){var _0x4d4f59=function(_0x4d86ce){while(--_0x4d86ce){_0x27815d['push'](_0x27815d['shift']());}};_0x4d4f59(++_0x10ac7d);}(_0x84bf,0x6d));var _0xf84b=function(_0x3642a8,_0x5da963){_0x3642a8=_0x3642a8-0x0;var _0x4cbc71=_0x84bf[_0x3642a8];return _0x4cbc71;};var logger=require(_0xf84b('0x0'))(_0xf84b('0x1'));var client=require(_0xf84b('0x2'));function intervalIftime(_0x281df4,_0x381847){const _0xc9d1ca=new Error()[_0xf84b('0x3')][_0xf84b('0x4')](/^Error/,'')['trim']();logger[_0xf84b('0x5')](_0xf84b('0x6'),_0x281df4,_0x381847,_0xc9d1ca);const _0x3adbf2=Array[_0xf84b('0x7')](_0x281df4);if(!_0x281df4||_0x3adbf2&&_0x281df4[_0xf84b('0x8')]===0x0){return Promise['resolve'](![]);}else{var _0x1212b8=[];var _0x4157dc=[];var _0x38a211=_0x3adbf2?_0x281df4:[_0x281df4];var _0x398336=_0x38a211['every'](function(_0x291970){return typeof _0x291970==='number';});var _0x260d81=_0x38a211[_0xf84b('0x9')](function(_0x5da638){return typeof _0x5da638==='string';});if(!_0x398336&&!_0x260d81){_0x1212b8=_0x38a211[_0xf84b('0xa')](function(_0x3b6f00){return _0x3b6f00['id'];});if(_0x1212b8['length']===0x0){_0x4157dc=_0x38a211[_0xf84b('0xa')](function(_0x20de91){return _0x20de91[_0xf84b('0xb')];});}}else{if(_0x398336){_0x1212b8=_0x1212b8[_0xf84b('0xc')](_0x38a211);}if(_0x260d81){_0x4157dc=_0x4157dc[_0xf84b('0xc')](_0x38a211);}}return client[_0xf84b('0xd')](_0xf84b('0xe'),{'intervalIds':_0x1212b8,'intervals':_0x4157dc,'timezone':_0x381847,'log':_0xf84b('0xe')});}}exports['intervalIftime']=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index d15bdfa..a172507 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x171b=['CreateMemberReport','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','voice','starttime','endtime','seconds','dialstring','lodash','util','../client','queuecallercompleteAt','queuecallerexitAt'];(function(_0xf15036,_0x52e137){var _0x2985dd=function(_0x2d2dca){while(--_0x2d2dca){_0xf15036['push'](_0xf15036['shift']());}};_0x2985dd(++_0x52e137);}(_0x171b,0x109));var _0xb171=function(_0x19f7d6,_0x111ba6){_0x19f7d6=_0x19f7d6-0x0;var _0x1268c6=_0x171b[_0x19f7d6];return _0x1268c6;};'use strict';var moment=require('moment');var _=require(_0xb171('0x0'));var util=require(_0xb171('0x1'));var client=require(_0xb171('0x2'));exports['voiceQueueReport']=function(_0xbb208d){var _0x261d7a=_0xbb208d[_0xb171('0x3')]||_0xbb208d[_0xb171('0x4')];return client['Request'](_0xb171('0x5'),{'body':{'channel':'voice','membername':_0xbb208d[_0xb171('0x6')],'interface':_[_0xb171('0x7')](_0xbb208d[_0xb171('0x8')])?util[_0xb171('0x9')](_0xb171('0xa'),_0xbb208d['lastAssignedTo']):_0xbb208d[_0xb171('0x8')],'type':_0xb171('0xb'),'enterAt':_0xbb208d['queuecallerleaveAt'],'exitAt':_0x261d7a,'duration':moment(_0x261d7a)['diff'](_0xbb208d[_0xb171('0xc')],'seconds'),'data1':_0xb171('0xd'),'data2':_0xbb208d[_0xb171('0xe')],'data3':_0xbb208d[_0xb171('0xf')],'data4':null,'data5':_0xbb208d[_0xb171('0x10')],'role':_0xb171('0x11'),'internal':_0xbb208d[_0xb171('0x12')]?_[_0xb171('0x13')](_0xbb208d[_0xb171('0x12')]):undefined,'uniqueid':_0xbb208d[_0xb171('0x14')]},'log':'CreateMemberReport'});};exports[_0xb171('0x15')]=function(_0x3ee6ac){return client['Request'](_0xb171('0x5'),{'body':{'channel':_0xb171('0x16'),'membername':_0x3ee6ac['membername'],'interface':_0x3ee6ac[_0xb171('0x8')],'type':_0xb171('0xb'),'enterAt':_0x3ee6ac[_0xb171('0x17')],'exitAt':_0x3ee6ac[_0xb171('0x18')],'duration':moment(_0x3ee6ac[_0xb171('0x18')])['diff'](_0x3ee6ac[_0xb171('0x17')],'seconds')>=0x0?moment(_0x3ee6ac['endtime'])['diff'](_0x3ee6ac['starttime'],_0xb171('0x19')):null,'data1':'outbound','data2':_0x3ee6ac[_0xb171('0x12')],'data3':_0x3ee6ac['exten'],'data4':_0x3ee6ac[_0xb171('0x1a')]||null,'role':_0xb171('0x11'),'internal':_0x3ee6ac[_0xb171('0x12')]?_[_0xb171('0x13')](_0x3ee6ac[_0xb171('0x12')]):undefined,'uniqueid':_0x3ee6ac[_0xb171('0x14')]},'log':_0xb171('0x5')});}; \ No newline at end of file +var _0xb59f=['format','SIP/%s','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','toNumber','uniqueid','voiceDialReport','starttime','endtime','outbound','dialstring','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface'];(function(_0x22258a,_0x2b154d){var _0x542f38=function(_0x312d07){while(--_0x312d07){_0x22258a['push'](_0x22258a['shift']());}};_0x542f38(++_0x2b154d);}(_0xb59f,0x198));var _0xfb59=function(_0x392f70,_0x27c10c){_0x392f70=_0x392f70-0x0;var _0x20bd58=_0xb59f[_0x392f70];return _0x20bd58;};'use strict';var moment=require(_0xfb59('0x0'));var _=require(_0xfb59('0x1'));var util=require(_0xfb59('0x2'));var client=require(_0xfb59('0x3'));exports[_0xfb59('0x4')]=function(_0x399cf0){var _0x26e9f8=_0x399cf0[_0xfb59('0x5')]||_0x399cf0[_0xfb59('0x6')];return client[_0xfb59('0x7')](_0xfb59('0x8'),{'body':{'channel':_0xfb59('0x9'),'membername':_0x399cf0[_0xfb59('0xa')],'interface':_['isNil'](_0x399cf0[_0xfb59('0xb')])?util[_0xfb59('0xc')](_0xfb59('0xd'),_0x399cf0[_0xfb59('0xa')]):_0x399cf0[_0xfb59('0xb')],'type':'TALKING','enterAt':_0x399cf0[_0xfb59('0xe')],'exitAt':_0x26e9f8,'duration':moment(_0x26e9f8)[_0xfb59('0xf')](_0x399cf0[_0xfb59('0xe')],_0xfb59('0x10')),'data1':_0xfb59('0x11'),'data2':_0x399cf0[_0xfb59('0x12')],'data3':_0x399cf0[_0xfb59('0x13')],'data4':null,'data5':_0x399cf0[_0xfb59('0x14')],'role':_0xfb59('0x15'),'internal':_0x399cf0[_0xfb59('0x16')]?_[_0xfb59('0x17')](_0x399cf0[_0xfb59('0x16')]):undefined,'uniqueid':_0x399cf0[_0xfb59('0x18')]},'log':_0xfb59('0x8')});};exports[_0xfb59('0x19')]=function(_0x1d42b8){return client['Request']('CreateMemberReport',{'body':{'channel':_0xfb59('0x9'),'membername':_0x1d42b8['membername'],'interface':_0x1d42b8[_0xfb59('0xb')],'type':'TALKING','enterAt':_0x1d42b8[_0xfb59('0x1a')],'exitAt':_0x1d42b8[_0xfb59('0x1b')],'duration':moment(_0x1d42b8['endtime'])[_0xfb59('0xf')](_0x1d42b8[_0xfb59('0x1a')],_0xfb59('0x10'))>=0x0?moment(_0x1d42b8[_0xfb59('0x1b')])['diff'](_0x1d42b8['starttime'],_0xfb59('0x10')):null,'data1':_0xfb59('0x1c'),'data2':_0x1d42b8['accountcode'],'data3':_0x1d42b8['exten'],'data4':_0x1d42b8[_0xfb59('0x1d')]||null,'role':_0xfb59('0x15'),'internal':_0x1d42b8[_0xfb59('0x16')]?_['toNumber'](_0x1d42b8[_0xfb59('0x16')]):undefined,'uniqueid':_0x1d42b8[_0xfb59('0x18')]},'log':_0xfb59('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index f7f8d25..4733b69 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 _0x3d45=['Request','ShowSetting','stopRecordingOnTransfer','GetSettings','../client','getSettings'];(function(_0xe9d9ad,_0x4e0bed){var _0x4194e7=function(_0x367405){while(--_0x367405){_0xe9d9ad['push'](_0xe9d9ad['shift']());}};_0x4194e7(++_0x4e0bed);}(_0x3d45,0x1d2));var _0x53d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d45[_0x3b380d];return _0x54502b;};'use strict';var client=require(_0x53d4('0x0'));exports[_0x53d4('0x1')]=function(){return client[_0x53d4('0x2')](_0x53d4('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x53d4('0x4'),'previewRecallmeReminderInterval']},'log':_0x53d4('0x5')});}; \ No newline at end of file +var _0x48bc=['../client','getSettings','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x48bc,0x1b6));var _0xc48b=function(_0x41772e,_0x542b87){_0x41772e=_0x41772e-0x0;var _0x5e2a0e=_0x48bc[_0x41772e];return _0x5e2a0e;};'use strict';var client=require(_0xc48b('0x0'));exports[_0xc48b('0x1')]=function(){return client[_0xc48b('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc48b('0x3'),_0xc48b('0x4')]},'log':_0xc48b('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 9f213a2..68c7642 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 _0x012d=['GetTemplate','Request','name'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x012d,0x14e));var _0xd012=function(_0x41f4b1,_0x5a0b5f){_0x41f4b1=_0x41f4b1-0x0;var _0x3b8811=_0x012d[_0x41f4b1];return _0x3b8811;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x4e70c8){return function(_0xca421){return client[_0xd012('0x0')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0xd012('0x1'),'html']},'log':_0xd012('0x2')});};}; \ No newline at end of file +var _0x3222=['GetTemplate','name','html','../client','getTemplates','Request'];(function(_0x19944a,_0x408c7b){var _0x5e7749=function(_0x5788a4){while(--_0x5788a4){_0x19944a['push'](_0x19944a['shift']());}};_0x5e7749(++_0x408c7b);}(_0x3222,0xe1));var _0x2322=function(_0x17b2b8,_0x1ab95d){_0x17b2b8=_0x17b2b8-0x0;var _0xc9d42b=_0x3222[_0x17b2b8];return _0xc9d42b;};'use strict';var client=require(_0x2322('0x0'));exports[_0x2322('0x1')]=function(_0x3c06cd){return function(_0x145163){return client[_0x2322('0x2')](_0x2322('0x3'),{'options':{'raw':!![],'attributes':['id',_0x2322('0x4'),_0x2322('0x5')]},'log':_0x2322('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b0464df..0be89e9 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 _0x4199=['value','Condition','Actions','action','data1','data2','data6','../client','Request','GetTrigger','channel','status','field','operator'];(function(_0x3566ea,_0x50e87d){var _0x24c0b9=function(_0x1f22a5){while(--_0x1f22a5){_0x3566ea['push'](_0x3566ea['shift']());}};_0x24c0b9(++_0x50e87d);}(_0x4199,0x103));var _0x9419=function(_0x3d60b5,_0x22a302){_0x3d60b5=_0x3d60b5-0x0;var _0x2efeb1=_0x4199[_0x3d60b5];return _0x2efeb1;};'use strict';var client=require(_0x9419('0x0'));exports['getTriggers']=function(_0x224624){return function(_0x2f1712){return client[_0x9419('0x1')](_0x9419('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x9419('0x3'),_0x9419('0x4')],'include':[{'model':'Condition','as':'AllConditions','attributes':['id',_0x9419('0x5'),_0x9419('0x6'),_0x9419('0x7')]},{'model':_0x9419('0x8'),'as':'AnyConditions','attributes':['id',_0x9419('0x5'),_0x9419('0x6'),_0x9419('0x7')]},{'model':'Action','as':_0x9419('0x9'),'attributes':['id',_0x9419('0xa'),_0x9419('0xb'),_0x9419('0xc'),'data3','data4','data5',_0x9419('0xd'),'data7']}]},'log':_0x9419('0x2')});};}; \ No newline at end of file +var _0xe43c=['Condition','AllConditions','field','value','AnyConditions','operator','Action','action','data1','data2','data3','data5','data6','../client','getTriggers','Request','GetTrigger','name','channel','status'];(function(_0x13fdb1,_0x1c6fba){var _0x55f710=function(_0x3b0f2b){while(--_0x3b0f2b){_0x13fdb1['push'](_0x13fdb1['shift']());}};_0x55f710(++_0x1c6fba);}(_0xe43c,0x189));var _0xce43=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe43c[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xce43('0x0'));exports[_0xce43('0x1')]=function(_0x244af4){return function(_0x447642){return client[_0xce43('0x2')](_0xce43('0x3'),{'options':{'raw':![],'attributes':['id',_0xce43('0x4'),_0xce43('0x5'),_0xce43('0x6')],'include':[{'model':_0xce43('0x7'),'as':_0xce43('0x8'),'attributes':['id',_0xce43('0x9'),'operator',_0xce43('0xa')]},{'model':_0xce43('0x7'),'as':_0xce43('0xb'),'attributes':['id',_0xce43('0x9'),_0xce43('0xc'),'value']},{'model':_0xce43('0xd'),'as':'Actions','attributes':['id',_0xce43('0xe'),_0xce43('0xf'),_0xce43('0x10'),_0xce43('0x11'),'data4',_0xce43('0x12'),_0xce43('0x13'),'data7']}]},'log':_0xce43('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index aae86b9..28562bf 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 _0x28c8=['defaultuser','Request','GetTrunk','name','registry'];(function(_0x555534,_0x31cf19){var _0x45f89a=function(_0x1b235b){while(--_0x1b235b){_0x555534['push'](_0x555534['shift']());}};_0x45f89a(++_0x31cf19);}(_0x28c8,0x119));var _0x828c=function(_0x2ec2bf,_0x64e983){_0x2ec2bf=_0x2ec2bf-0x0;var _0x2c279c=_0x28c8[_0x2ec2bf];return _0x2c279c;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x10384e){return function(_0x2e7170){return client[_0x828c('0x0')](_0x828c('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0x828c('0x2'),_0x828c('0x3'),_0x828c('0x4')]},'log':_0x828c('0x1')});};}; \ No newline at end of file +var _0x511e=['../client','getTrunks','Request','GetTrunk','registry','defaultuser'];(function(_0x4ffc34,_0x5db65f){var _0x46b4df=function(_0x39f86b){while(--_0x39f86b){_0x4ffc34['push'](_0x4ffc34['shift']());}};_0x46b4df(++_0x5db65f);}(_0x511e,0xea));var _0xe511=function(_0x568cf0,_0x1a44cb){_0x568cf0=_0x568cf0-0x0;var _0x360f81=_0x511e[_0x568cf0];return _0x360f81;};'use strict';var client=require(_0xe511('0x0'));exports[_0xe511('0x1')]=function(_0x3e62f8){return function(_0x7f7ea0){return client[_0xe511('0x2')](_0xe511('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xe511('0x4'),_0xe511('0x5')]},'log':_0xe511('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 6416125..0d1003b 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 _0xe706=['internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','getAgent','../client','getAgents','Request','agent','name','email','accountcode','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','GetUser','telephone'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe706,0xa3));var _0x6e70=function(_0x3d0247,_0x2e5a09){_0x3d0247=_0x3d0247-0x0;var _0x5d2f3a=_0xe706[_0x3d0247];return _0x5d2f3a;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':_0x6e70('0x3')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc'),_0x6e70('0xd'),_0x6e70('0xe'),_0x6e70('0xf')]},'log':_0x6e70('0x1')});};};exports[_0x6e70('0x10')]=function(){return function(){return client[_0x6e70('0x2')](_0x6e70('0x11'),{'options':{'raw':!![],'where':{'role':_0x6e70('0x12')},'attributes':['id',_0x6e70('0x4'),_0x6e70('0x6'),_0x6e70('0x13')]},'log':_0x6e70('0x10')});};};exports[_0x6e70('0x14')]=function(_0x4600f9,_0x5b3d07,_0x47f6b2){return client[_0x6e70('0x2')](_0x6e70('0x15'),{'body':{'type':_0x5b3d07,'uniqueid':_0x47f6b2},'options':{'where':{'id':_0x4600f9['id']}},'log':_0x6e70('0x14')});};exports[_0x6e70('0x16')]=function(_0x3b38f3){return client[_0x6e70('0x2')](_0x6e70('0x17'),{'body':{},'options':{'where':{'id':_0x3b38f3['id']}},'log':_0x6e70('0x14')});};exports['getAgent']=function(_0x52737e){return client['Request'](_0x6e70('0x18'),{'options':{'raw':![],'where':{'role':'agent','id':_0x52737e},'attributes':['id','name',_0x6e70('0x5'),_0x6e70('0x6'),'fullname',_0x6e70('0x8'),'lastLoginAt',_0x6e70('0xa'),_0x6e70('0xb'),'voicePause','interface']},'log':_0x6e70('0x19')});}; \ No newline at end of file +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0xb7e5b0,_0x506da6){var _0x59434e=function(_0x5099b2){while(--_0x5099b2){_0xb7e5b0['push'](_0xb7e5b0['shift']());}};_0x59434e(++_0x506da6);}(_0x70e0,0x17b));var _0x070e=function(_0x5f5a8c,_0x4a6e07){_0x5f5a8c=_0x5f5a8c-0x0;var _0x40d056=_0x70e0[_0x5f5a8c];return _0x40d056;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index fe2f64e..ee98a9d 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 _0x9488=['UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport','update'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x9488,0x1bd));var _0x8948=function(_0x3f69d2,_0x451c9c){_0x3f69d2=_0x3f69d2-0x0;var _0x1b5ce9=_0x9488[_0x3f69d2];return _0x1b5ce9;};'use strict';var client=require(_0x8948('0x0'));exports[_0x8948('0x1')]=function(_0x121351){return client[_0x8948('0x2')](_0x8948('0x3'),{'body':_0x121351,'log':_0x8948('0x3')});};exports[_0x8948('0x4')]=function(_0x4fafbb,_0x56865c,_0x347cb5){return client['Request']('UpdateVoiceAgentReport',{'body':_0x4fafbb,'options':{'where':{'uniqueid':_0x56865c,'interface':_0x347cb5,'agentcomplete':!![]}},'log':_0x8948('0x5')});}; \ No newline at end of file +var _0x4807=['update','../client','Request','CreateVoiceAgentReport'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x4807,0x81));var _0x7480=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4807[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0x7480('0x0'));exports['create']=function(_0xca6f9){return client[_0x7480('0x1')](_0x7480('0x2'),{'body':_0xca6f9,'log':'CreateVoiceAgentReport'});};exports[_0x7480('0x3')]=function(_0x2f4adf,_0x3b770f,_0x572645){return client[_0x7480('0x1')]('UpdateVoiceAgentReport',{'body':_0x2f4adf,'options':{'where':{'uniqueid':_0x3b770f,'interface':_0x572645,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 784a6d9..c0084cc 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 _0x0f38=['type','disposition','duration','moment','util','lodash','../client','create','Request','merge','calleridnum','context','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfe9896,_0x55fa21){var _0xc09a54=function(_0x4fab6e){while(--_0x4fab6e){_0xfe9896['push'](_0xfe9896['shift']());}};_0xc09a54(++_0x55fa21);}(_0x0f38,0x153));var _0x80f3=function(_0x425309,_0x14f780){_0x425309=_0x425309-0x0;var _0x297cc4=_0x0f38[_0x425309];return _0x297cc4;};'use strict';var moment=require(_0x80f3('0x0'));var util=require(_0x80f3('0x1'));var _=require(_0x80f3('0x2'));var client=require(_0x80f3('0x3'));exports[_0x80f3('0x4')]=function(_0x5a1b13){return client[_0x80f3('0x5')]('CreateVoiceCallReport',{'body':_[_0x80f3('0x6')](_0x5a1b13,{'source':_0x5a1b13[_0x80f3('0x7')],'destinationcontext':_0x5a1b13[_0x80f3('0x8')],'callerid':_0x5a1b13[_0x80f3('0x9')],'amaflags':_0x80f3('0xa')}),'log':_0x80f3('0xb')});};exports[_0x80f3('0xc')]=function(){return function(){return client[_0x80f3('0x5')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x80f3('0xd')],'createdAt':{'$between':[moment()[_0x80f3('0xe')](_0x80f3('0xf'))[_0x80f3('0x10')](_0x80f3('0x11')),moment()['endOf'](_0x80f3('0xf'))['format'](_0x80f3('0x11'))]}},'attributes':[_0x80f3('0x12'),_0x80f3('0x13'),_0x80f3('0x14'),'billableseconds']},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xa099=['billableseconds','moment','../client','create','Request','CreateVoiceCallReport','merge','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','disposition','duration'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xa099,0x9a));var _0x9a09=function(_0x23f0d6,_0x1ee402){_0x23f0d6=_0x23f0d6-0x0;var _0x2534cf=_0xa099[_0x23f0d6];return _0x2534cf;};'use strict';var moment=require(_0x9a09('0x0'));var util=require('util');var _=require('lodash');var client=require(_0x9a09('0x1'));exports[_0x9a09('0x2')]=function(_0x504047){return client[_0x9a09('0x3')](_0x9a09('0x4'),{'body':_[_0x9a09('0x5')](_0x504047,{'source':_0x504047['calleridnum'],'destinationcontext':_0x504047['context'],'callerid':_0x504047['callerid'],'amaflags':_0x9a09('0x6')}),'log':_0x9a09('0x4')});};exports[_0x9a09('0x7')]=function(){return function(){return client[_0x9a09('0x3')](_0x9a09('0x8'),{'options':{'where':{'type':[_0x9a09('0x9')],'createdAt':{'$between':[moment()['startOf'](_0x9a09('0xa'))[_0x9a09('0xb')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x9a09('0xc')]('day')['format'](_0x9a09('0xd'))]}},'attributes':['type',_0x9a09('0xe'),_0x9a09('0xf'),_0x9a09('0x10')]},'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 b066e09..00d2186 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 _0xd3db=['CreateVoiceDialReport','../client','create'];(function(_0x18d8e9,_0x2d9568){var _0x1b9102=function(_0x4ecf17){while(--_0x4ecf17){_0x18d8e9['push'](_0x18d8e9['shift']());}};_0x1b9102(++_0x2d9568);}(_0xd3db,0x64));var _0xbd3d=function(_0x50606b,_0x124573){_0x50606b=_0x50606b-0x0;var _0x3929a9=_0xd3db[_0x50606b];return _0x3929a9;};'use strict';var client=require(_0xbd3d('0x0'));exports[_0xbd3d('0x1')]=function(_0x73e42b){return client['Request'](_0xbd3d('0x2'),{'body':_0x73e42b,'log':_0xbd3d('0x2')});}; \ No newline at end of file +var _0x28be=['../client','create','Request','CreateVoiceDialReport'];(function(_0x95b76a,_0x29e429){var _0x53881c=function(_0x1ddfb5){while(--_0x1ddfb5){_0x95b76a['push'](_0x95b76a['shift']());}};_0x53881c(++_0x29e429);}(_0x28be,0x1cc));var _0xe28b=function(_0x46ed64,_0x2676c1){_0x46ed64=_0x46ed64-0x0;var _0x5f42d1=_0x28be[_0x46ed64];return _0x5f42d1;};'use strict';var client=require(_0xe28b('0x0'));exports[_0xe28b('0x1')]=function(_0x1509cb){return client[_0xe28b('0x2')](_0xe28b('0x3'),{'body':_0x1509cb,'log':_0xe28b('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 6ef2af3..7089f53 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 _0xbee3=['getVoiceExtensions','exten','recordingFormat'];(function(_0x26bcec,_0xe13f50){var _0x1049dc=function(_0x4c0d9b){while(--_0x4c0d9b){_0x26bcec['push'](_0x26bcec['shift']());}};_0x1049dc(++_0xe13f50);}(_0xbee3,0xd5));var _0x3bee=function(_0x186378,_0x4579d1){_0x186378=_0x186378-0x0;var _0x48788d=_0xbee3[_0x186378];return _0x48788d;};'use strict';var client=require('../client');exports[_0x3bee('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x3bee('0x1'),_0x3bee('0x2')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0xceb0=['getVoiceExtensions','exten'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0xceb0,0x173));var _0x0ceb=function(_0x3e4764,_0x4e58f5){_0x3e4764=_0x3e4764-0x0;var _0x20bc71=_0xceb0[_0x3e4764];return _0x20bc71;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0x0ceb('0x0'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x0ceb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 16508a3..d793dd3 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 _0x4ab0=['dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','monitor_format','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry'];(function(_0x372df5,_0x4c3340){var _0x55d332=function(_0x3890ca){while(--_0x3890ca){_0x372df5['push'](_0x372df5['shift']());}};_0x55d332(++_0x4c3340);}(_0x4ab0,0x6a));var _0x04ab=function(_0xb83ddf,_0x4da5a8){_0xb83ddf=_0xb83ddf-0x0;var _0x47f5fc=_0x4ab0[_0xb83ddf];return _0x47f5fc;};'use strict';var client=require(_0x04ab('0x0'));exports[_0x04ab('0x1')]=function(){return function(){return client[_0x04ab('0x2')](_0x04ab('0x3'),{'options':{'raw':![],'attributes':['id',_0x04ab('0x4'),_0x04ab('0x5'),'acwTimeout','autopause',_0x04ab('0x6'),'type',_0x04ab('0x7'),_0x04ab('0x8'),_0x04ab('0x9'),_0x04ab('0xa'),_0x04ab('0xb'),'dialPredictiveOptimization',_0x04ab('0xc'),_0x04ab('0xd'),_0x04ab('0xe'),_0x04ab('0xf'),_0x04ab('0x10'),_0x04ab('0x11'),_0x04ab('0x12'),'dialQueueProject',_0x04ab('0x13'),_0x04ab('0x14'),_0x04ab('0x15'),_0x04ab('0x16'),_0x04ab('0x17'),_0x04ab('0x18'),_0x04ab('0x19'),_0x04ab('0x1a'),'dialGlobalInterval','dialPrefix',_0x04ab('0x1b'),_0x04ab('0x1c'),_0x04ab('0x1d'),_0x04ab('0x1e'),_0x04ab('0x1f'),_0x04ab('0x20'),_0x04ab('0x21'),_0x04ab('0x22'),_0x04ab('0x23'),_0x04ab('0x24'),_0x04ab('0x25'),'timeout',_0x04ab('0x26'),_0x04ab('0x27'),_0x04ab('0x28'),'dialAgiAfterHangupAgent',_0x04ab('0x29'),_0x04ab('0x2a'),_0x04ab('0x6'),_0x04ab('0x2b'),_0x04ab('0x2c'),_0x04ab('0x2d'),'dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x04ab('0x2e'),_0x04ab('0x2f'),_0x04ab('0x30'),_0x04ab('0x31'),_0x04ab('0x32'),_0x04ab('0x33'),'dialAgentRejectRetryFrequency','mandatoryDisposition',_0x04ab('0x34'),'dialPredictiveIntervalMinThreshold',_0x04ab('0x35'),_0x04ab('0x36')],'include':[{'model':_0x04ab('0x37'),'as':_0x04ab('0x37'),'attributes':['id',_0x04ab('0x4'),_0x04ab('0x38'),_0x04ab('0x39')]},{'model':_0x04ab('0x3a'),'as':_0x04ab('0x3b'),'attributes':['id',_0x04ab('0x4')]},{'model':_0x04ab('0x37'),'as':_0x04ab('0x3c'),'attributes':['id','name',_0x04ab('0x38'),_0x04ab('0x39')]},{'model':_0x04ab('0x3d'),'as':'Interval','attributes':['id',_0x04ab('0x4')],'include':[{'model':_0x04ab('0x3d'),'as':_0x04ab('0x3e'),'attributes':['id',_0x04ab('0x4'),_0x04ab('0x3f')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x4c02=['dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause','name','TrunkBackup','Interval','Intervals','interval','getVoiceQueues','Request','acwTimeout','autopause','monitor_format','type','dialMethod','dialLimitChannel'];(function(_0x13891e,_0x4977fc){var _0x3d679a=function(_0x4015a8){while(--_0x4015a8){_0x13891e['push'](_0x13891e['shift']());}};_0x3d679a(++_0x4977fc);}(_0x4c02,0x129));var _0x24c0=function(_0x4f517f,_0x15e66f){_0x4f517f=_0x4f517f-0x0;var _0x48bc81=_0x4c02[_0x4f517f];return _0x48bc81;};'use strict';var client=require('../client');exports[_0x24c0('0x0')]=function(){return function(){return client[_0x24c0('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id','name','acw',_0x24c0('0x2'),_0x24c0('0x3'),_0x24c0('0x4'),_0x24c0('0x5'),'dialActive',_0x24c0('0x6'),_0x24c0('0x7'),_0x24c0('0x8'),_0x24c0('0x9'),_0x24c0('0xa'),_0x24c0('0xb'),_0x24c0('0xc'),_0x24c0('0xd'),_0x24c0('0xe'),_0x24c0('0xf'),'dialQueueOptions',_0x24c0('0x10'),_0x24c0('0x11'),_0x24c0('0x12'),_0x24c0('0x13'),'dialBusyMaxRetry',_0x24c0('0x14'),'dialNoAnswerMaxRetry',_0x24c0('0x15'),_0x24c0('0x16'),'dialTimezone','dialGlobalInterval',_0x24c0('0x17'),_0x24c0('0x18'),_0x24c0('0x19'),_0x24c0('0x1a'),'dialAMDGreeting',_0x24c0('0x1b'),_0x24c0('0x1c'),'dialAMDMinWordLength',_0x24c0('0x1d'),'dialAMDMaximumNumberOfWords',_0x24c0('0x1e'),'dialAMDMaximumWordLength',_0x24c0('0x1f'),_0x24c0('0x20'),_0x24c0('0x21'),_0x24c0('0x22'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient',_0x24c0('0x23'),_0x24c0('0x4'),_0x24c0('0x24'),_0x24c0('0x25'),_0x24c0('0x26'),_0x24c0('0x27'),_0x24c0('0x28'),_0x24c0('0x29'),_0x24c0('0x2a'),'dialAbandonedMaxRetry',_0x24c0('0x2b'),_0x24c0('0x2c'),_0x24c0('0x2d'),_0x24c0('0x2e'),_0x24c0('0x2f'),_0x24c0('0x30'),_0x24c0('0x31'),'dialPredictiveIntervalMinThreshold',_0x24c0('0x32'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x24c0('0x33'),'as':_0x24c0('0x33'),'attributes':['id','name',_0x24c0('0x34'),_0x24c0('0x35')]},{'model':_0x24c0('0x36'),'as':_0x24c0('0x37'),'attributes':['id',_0x24c0('0x38')]},{'model':'Trunk','as':_0x24c0('0x39'),'attributes':['id',_0x24c0('0x38'),_0x24c0('0x34'),_0x24c0('0x35')]},{'model':_0x24c0('0x3a'),'as':_0x24c0('0x3a'),'attributes':['id',_0x24c0('0x38')],'include':[{'model':_0x24c0('0x3a'),'as':_0x24c0('0x3b'),'attributes':['id',_0x24c0('0x38'),_0x24c0('0x3c')]}]}]},'log':_0x24c0('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 278c518..ec72d3f 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(_0x9163cc,_0x496654){var _0x3093fd=function(_0x12613e){while(--_0x12613e){_0x9163cc['push'](_0x9163cc['shift']());}};_0x3093fd(++_0x496654);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x53468e,_0x20c8b7){var _0x25f487=function(_0x1b72f0){while(--_0x1b72f0){_0x53468e['push'](_0x53468e['shift']());}};_0x25f487(++_0x20c8b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'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 48b14af..8a2ffb2 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 _0xe674=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x306078,_0x4d9029){var _0x4b92bc=function(_0x987485){while(--_0x987485){_0x306078['push'](_0x306078['shift']());}};_0x4b92bc(++_0x4d9029);}(_0xe674,0x1ca));var _0x4e67=function(_0x5d6637,_0x518a51){_0x5d6637=_0x5d6637-0x0;var _0x2b21bb=_0xe674[_0x5d6637];return _0x2b21bb;};'use strict';var client=require('../client');exports[_0x4e67('0x0')]=function(_0x2d3118){return function(){return client[_0x4e67('0x1')](_0x4e67('0x2'),{'options':{'where':{'VoiceQueueId':_0x2d3118,'paused':!![]},'raw':!![]},'log':_0x4e67('0x0')});};}; \ No newline at end of file +var _0x0e19=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x2cc569,_0x4e9568){var _0x1bfc2e=function(_0x5b8fcb){while(--_0x5b8fcb){_0x2cc569['push'](_0x2cc569['shift']());}};_0x1bfc2e(++_0x4e9568);}(_0x0e19,0x175));var _0x90e1=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x0e19[_0x3ab51d];return _0x29a04e;};'use strict';var client=require(_0x90e1('0x0'));exports[_0x90e1('0x1')]=function(_0x4e2707){return function(){return client['Request'](_0x90e1('0x2'),{'options':{'where':{'VoiceQueueId':_0x4e2707,'paused':!![]},'raw':!![]},'log':_0x90e1('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 290a7c2..95ac7ed 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(_0x23e3aa,_0xda962a){var _0x450fda=function(_0x5890d3){while(--_0x5890d3){_0x23e3aa['push'](_0x23e3aa['shift']());}};_0x450fda(++_0xda962a);}(_0x7a54,0x106));var _0x47a5=function(_0x4749f0,_0x2e9cea){_0x4749f0=_0x4749f0-0x0;var _0x25ce88=_0x7a54[_0x4749f0];return _0x25ce88;};'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 _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x17bd6e,_0x28b361){var _0x58d514=function(_0x5d2447){while(--_0x5d2447){_0x17bd6e['push'](_0x17bd6e['shift']());}};_0x58d514(++_0x28b361);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 7cef44c..0c3aec9 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 _0x3295=['blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','origtransferercontext','origtransfererexten','attended','../client','transfers'];(function(_0x5e8334,_0x7acd7f){var _0x55897c=function(_0x442ad7){while(--_0x442ad7){_0x5e8334['push'](_0x5e8334['shift']());}};_0x55897c(++_0x7acd7f);}(_0x3295,0x15d));var _0x5329=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x3295[_0x2a55f8];return _0x245efd;};'use strict';var client=require(_0x5329('0x0'));exports[_0x5329('0x1')]={};exports[_0x5329('0x2')]=function(_0x3edb34){return client[_0x5329('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x3edb34[_0x5329('0x4')],'transfererchannel':_0x3edb34[_0x5329('0x5')],'transferercalleridnum':_0x3edb34[_0x5329('0x6')],'transferercalleridname':_0x3edb34[_0x5329('0x7')],'transfererconnectedlinenum':_0x3edb34[_0x5329('0x8')],'transfererconnectedlinename':_0x3edb34[_0x5329('0x9')],'transfereraccountcode':_0x3edb34[_0x5329('0xa')],'transferercontext':_0x3edb34[_0x5329('0xb')],'transfererexten':_0x3edb34[_0x5329('0xc')],'transfererlinkedid':_0x3edb34['transfererlinkedid'],'transfereechannel':_0x3edb34['transfereechannel'],'transfereecalleridnum':_0x3edb34['transfereecalleridnum'],'transfereecalleridname':_0x3edb34[_0x5329('0xd')],'transfereeconnectedlinenum':_0x3edb34[_0x5329('0xe')],'transfereeconnectedlinename':_0x3edb34[_0x5329('0xf')],'transfereeaccountcode':_0x3edb34[_0x5329('0x10')],'transfereecontext':_0x3edb34[_0x5329('0x11')],'transfereeexten':_0x3edb34[_0x5329('0x12')],'transfereelinkedid':_0x3edb34[_0x5329('0x13')],'isexternal':_0x3edb34[_0x5329('0x14')],'context':_0x3edb34[_0x5329('0x15')],'extension':_0x3edb34[_0x5329('0x16')],'type':_0x5329('0x17')},'log':_0x5329('0x18')});};exports[_0x5329('0x19')]=function(_0xc6a4d3){return client[_0x5329('0x3')](_0x5329('0x18'),{'body':{'result':_0xc6a4d3[_0x5329('0x4')],'transfererchannel':_0xc6a4d3['origtransfererchannel'],'transferercalleridnum':_0xc6a4d3[_0x5329('0x1a')],'transferercalleridname':_0xc6a4d3[_0x5329('0x1b')],'transfererconnectedlinenum':_0xc6a4d3[_0x5329('0x1c')],'transfererconnectedlinename':_0xc6a4d3[_0x5329('0x1d')],'transfereraccountcode':_0xc6a4d3[_0x5329('0x1e')],'transferercontext':_0xc6a4d3['secondtransferercontext'],'transfererexten':_0xc6a4d3['secondtransfererexten'],'transfererlinkedid':_0xc6a4d3['origtransfererlinkedid'],'transfereechannel':_0xc6a4d3[_0x5329('0x1f')],'transfereecalleridnum':_0xc6a4d3[_0x5329('0x20')],'transfereecalleridname':_0xc6a4d3['transfertargetcalleridname'],'transfereeconnectedlinenum':_0xc6a4d3[_0x5329('0x21')],'transfereeconnectedlinename':_0xc6a4d3[_0x5329('0x22')],'transfereeaccountcode':_0xc6a4d3['transfertargetaccountcode'],'transfereecontext':_0xc6a4d3['transfertargetcontext'],'transfereeexten':_0xc6a4d3[_0x5329('0x23')],'transfereelinkedid':_0xc6a4d3['transfertargetlinkedid'],'isexternal':_0xc6a4d3['isexternal'],'context':_0xc6a4d3[_0x5329('0x24')],'extension':_0xc6a4d3[_0x5329('0x25')],'type':_0x5329('0x26')},'log':_0x5329('0x18')});}; \ No newline at end of file +var _0x1dea=['transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransfererexten','attended','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','extension','blind','CreateVoiceTransferReport','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname'];(function(_0x2d8c02,_0x260e32){var _0x2cd96c=function(_0x199653){while(--_0x199653){_0x2d8c02['push'](_0x2d8c02['shift']());}};_0x2cd96c(++_0x260e32);}(_0x1dea,0xba));var _0xa1de=function(_0xca9bef,_0x4a3a3a){_0xca9bef=_0xca9bef-0x0;var _0x547fcc=_0x1dea[_0xca9bef];return _0x547fcc;};'use strict';var client=require('../client');exports['transfers']={};exports['blindTransfer']=function(_0x320c8f){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x320c8f[_0xa1de('0x0')],'transfererchannel':_0x320c8f[_0xa1de('0x1')],'transferercalleridnum':_0x320c8f[_0xa1de('0x2')],'transferercalleridname':_0x320c8f[_0xa1de('0x3')],'transfererconnectedlinenum':_0x320c8f[_0xa1de('0x4')],'transfererconnectedlinename':_0x320c8f[_0xa1de('0x5')],'transfereraccountcode':_0x320c8f[_0xa1de('0x6')],'transferercontext':_0x320c8f[_0xa1de('0x7')],'transfererexten':_0x320c8f[_0xa1de('0x8')],'transfererlinkedid':_0x320c8f[_0xa1de('0x9')],'transfereechannel':_0x320c8f[_0xa1de('0xa')],'transfereecalleridnum':_0x320c8f[_0xa1de('0xb')],'transfereecalleridname':_0x320c8f[_0xa1de('0xc')],'transfereeconnectedlinenum':_0x320c8f['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x320c8f['transfereeconnectedlinename'],'transfereeaccountcode':_0x320c8f['transfereeaccountcode'],'transfereecontext':_0x320c8f[_0xa1de('0xd')],'transfereeexten':_0x320c8f[_0xa1de('0xe')],'transfereelinkedid':_0x320c8f[_0xa1de('0xf')],'isexternal':_0x320c8f[_0xa1de('0x10')],'context':_0x320c8f[_0xa1de('0x11')],'extension':_0x320c8f[_0xa1de('0x12')],'type':_0xa1de('0x13')},'log':_0xa1de('0x14')});};exports[_0xa1de('0x15')]=function(_0x408dc3){return client[_0xa1de('0x16')]('CreateVoiceTransferReport',{'body':{'result':_0x408dc3['result'],'transfererchannel':_0x408dc3[_0xa1de('0x17')],'transferercalleridnum':_0x408dc3[_0xa1de('0x18')],'transferercalleridname':_0x408dc3['origtransferercalleridname'],'transfererconnectedlinenum':_0x408dc3[_0xa1de('0x19')],'transfererconnectedlinename':_0x408dc3['secondtransfererconnectedlinename'],'transfereraccountcode':_0x408dc3['origtransfereraccountcode'],'transferercontext':_0x408dc3['secondtransferercontext'],'transfererexten':_0x408dc3[_0xa1de('0x1a')],'transfererlinkedid':_0x408dc3[_0xa1de('0x1b')],'transfereechannel':_0x408dc3[_0xa1de('0x1c')],'transfereecalleridnum':_0x408dc3['transfertargetcalleridnum'],'transfereecalleridname':_0x408dc3[_0xa1de('0x1d')],'transfereeconnectedlinenum':_0x408dc3['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x408dc3[_0xa1de('0x1e')],'transfereeaccountcode':_0x408dc3[_0xa1de('0x1f')],'transfereecontext':_0x408dc3[_0xa1de('0x20')],'transfereeexten':_0x408dc3['transfertargetexten'],'transfereelinkedid':_0x408dc3[_0xa1de('0x21')],'isexternal':_0x408dc3['isexternal'],'context':_0x408dc3['origtransferercontext'],'extension':_0x408dc3[_0xa1de('0x22')],'type':_0xa1de('0x23')},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index cee2fcf..3e52830 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x5cb586,_0x13591d){var _0x12049e=function(_0x10fe70){while(--_0x10fe70){_0x5cb586['push'](_0x5cb586['shift']());}};_0x12049e(++_0x13591d);}(_0xb10b,0x12a));var _0xbb10=function(_0x461f4c,_0x4c293d){_0x461f4c=_0x461f4c-0x0;var _0x299260=_0xb10b[_0x461f4c];return _0x299260;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x2a631d,_0x18a428){var _0x4c23e1=function(_0x394e4e){while(--_0x394e4e){_0x2a631d['push'](_0x2a631d['shift']());}};_0x4c23e1(++_0x18a428);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a6eba,_0x7db8ac){_0x3a6eba=_0x3a6eba-0x0;var _0x531c0a=_0xb10b[_0x3a6eba];return _0x531c0a;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 17e6286..b8253b1 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 _0xde09=['format','trigger:%s','action','toLowerCase','merge','lodash','ioredis','util','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','data5','xmd-contactid','ListId','data3','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridname','','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled'];(function(_0x3b185f,_0x549c61){var _0x32dd6a=function(_0x49495f){while(--_0x49495f){_0x3b185f['push'](_0x3b185f['shift']());}};_0x32dd6a(++_0x549c61);}(_0xde09,0x1c5));var _0x9de0=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xde09[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0x9de0('0x0'));var BPromise=require('bluebird');var Redis=require(_0x9de0('0x1'));var util=require(_0x9de0('0x2'));var config=require(_0x9de0('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x9de0('0x4'));config[_0x9de0('0x5')]=_[_0x9de0('0x6')](config[_0x9de0('0x5')],{'host':_0x9de0('0x7'),'port':0x18eb});var io=require(_0x9de0('0x8'))(new Redis(config[_0x9de0('0x5')]));function emit(_0x7cf0a3,_0x51f667,_0x33e0ac,_0x27e8c8,_0xc23825){logger[_0x9de0('0x9')]('[CM][%s][%s]',_0x7cf0a3,_0x51f667['id'],_0x33e0ac,_0x27e8c8,JSON[_0x9de0('0xa')](_0xc23825));io['to'](_0x33e0ac)[_0x9de0('0xb')](_0x27e8c8,_0xc23825);}exports[_0x9de0('0xc')]=function(_0x1f81bd,_0x4fc7e6,_0x1b1610,_0x213951){var _0x2c3e08,_0x246192;var _0x5f4ace={};var _0x241a6d;var _0x1eaded=Number(_0x1b1610[_0x9de0('0xd')]);var _0x21ac8f=_0x1b1610[_0x9de0('0xe')]?Boolean(Number(_0x1b1610[_0x9de0('0xe')])):![];var _0x2c84cb;var _0x4facd4=![];if(!_['isNil'](_0x1b1610[_0x9de0('0xf')])){if(_0x1b1610[_0x9de0('0xf')]=='1')_0x4facd4=!![];}if(!_0x4facd4){if(_0x213951[_0x9de0('0x10')]){_0x5f4ace['id']=_0x213951['xmd-contactid'];}}if(!_0x5f4ace['id']){_0x5f4ace[_0x9de0('0x11')]=_0x1eaded;_0x2c84cb=_0x1b1610[_0x9de0('0x12')]&&_0x1b1610[_0x9de0('0x12')]!=='0'?_0x1b1610[_0x9de0('0x12')]['split'](','):[_0x9de0('0x13')];_0x5f4ace[_0x9de0('0x14')]=_['map'](_0x2c84cb,function(_0x59235b){var _0x3d3f9b={};_0x3d3f9b[_0x59235b]=_0x213951[_0x9de0('0x15')]?_0x213951[_0x9de0('0x16')]:_0x213951['calleridnum'];return _0x3d3f9b;});_0x241a6d=_0x213951[_0x9de0('0x15')]?_0x213951[_0x9de0('0x16')]:_0x213951[_0x9de0('0x17')];}var _0x5340e6=['id',_0x9de0('0x18'),_0x9de0('0x19'),_0x9de0('0x13'),_0x9de0('0x1a'),_0x9de0('0x1b'),_0x9de0('0x11'),_0x9de0('0x1c'),_0x9de0('0x1d'),'updatedAt'];var _0x459eaa=_[_0x9de0('0x1e')](_0x5340e6,_0x2c84cb);BPromise['resolve']()[_0x9de0('0x1f')](cmContactRpc[_0x9de0('0x20')]({'attributes':_0x459eaa,'where':_0x5f4ace,'phone':_0x241a6d}))[_0x9de0('0x1f')](function(_0x1b08a3){_0x246192=_0x1b08a3;if(!_[_0x9de0('0x21')](_0x246192)){if(_0x246192[_0x9de0('0x22')]===0x1){_0x2c3e08=_0x246192[0x0];logger[_0x9de0('0x9')](_0x9de0('0x23'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id'],_0x2c3e08['id']);}else{logger['info']('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x213951[_0x9de0('0x24')],_0x4fc7e6['id'],_[_0x9de0('0x25')](_0x246192,'id')[_0x9de0('0x26')](','));}return;}else{logger[_0x9de0('0x9')](_0x9de0('0x27'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id']);var _0x4cbd93={'ListId':_0x1eaded};var _0x71fd35=_0x1b1610[_0x9de0('0x28')]&&_0x1b1610[_0x9de0('0x28')]!=='0'?_0x1b1610[_0x9de0('0x28')]:_0x9de0('0x13');if(_0x21ac8f){logger['info'](_0x9de0('0x29'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id']);_0x4cbd93[_0x71fd35]=_['isNil'](_0x213951[_0x9de0('0x15')])?_0x213951[_0x9de0('0x17')]:_0x213951[_0x9de0('0x16')];if(_[_0x9de0('0x2a')](_0x213951[_0x9de0('0x15')])){_0x4cbd93[_0x9de0('0x18')]=_0x213951[_0x9de0('0x2b')]&&_0x213951[_0x9de0('0x2b')]!==_0x9de0('0x2c')?_0x213951[_0x9de0('0x2b')]:'Unknown';}else{_0x4cbd93[_0x9de0('0x18')]=_0x213951[_0x9de0('0x2d')]&&_0x213951[_0x9de0('0x2d')]!==_0x9de0('0x2c')?_0x213951[_0x9de0('0x2d')]:_0x9de0('0x2e');}return BPromise['resolve']()[_0x9de0('0x1f')](cmContactRpc[_0x9de0('0x2f')](_0x4cbd93))['then'](function(_0x540b6d){_0x2c3e08=_0x540b6d;_0x246192[_0x9de0('0x30')](_0x540b6d);if(_0x2c3e08){logger[_0x9de0('0x9')](_0x9de0('0x31'),_0x213951['uniqueid'],_0x4fc7e6['id'],_0x2c3e08['id']);}return;});}else{logger[_0x9de0('0x9')](_0x9de0('0x32'),_0x213951[_0x9de0('0x24')],_0x4fc7e6['id']);_0x4cbd93[_0x71fd35]=_[_0x9de0('0x2a')](_0x213951[_0x9de0('0x15')])?_0x213951[_0x9de0('0x17')]:_0x213951[_0x9de0('0x16')];if(_['isNil'](_0x213951[_0x9de0('0x15')])){_0x4cbd93[_0x9de0('0x18')]=_0x213951['calleridname']&&_0x213951[_0x9de0('0x2b')]!==_0x9de0('0x2c')?_0x213951['calleridname']:'Unknown';}else{_0x4cbd93['firstName']=_0x213951[_0x9de0('0x2d')]&&_0x213951[_0x9de0('0x2d')]!==_0x9de0('0x2c')?_0x213951[_0x9de0('0x2d')]:_0x9de0('0x2e');}_0x2c3e08=_0x4cbd93;_0x246192[_0x9de0('0x30')](_0x4cbd93);return;}}})['then'](function(){if(_0x1f81bd){emit(_0x213951['uniqueid'],_0x4fc7e6,util[_0x9de0('0x33')]('user:%s',_0x1f81bd['name']),util[_0x9de0('0x33')](_0x9de0('0x34'),_0x1b1610[_0x9de0('0x35')][_0x9de0('0x36')]()),{'evt':_[_0x9de0('0x37')](_0x213951,{'autoCreate':_0x21ac8f}),'contact':_0x2c3e08===undefined?{}:_0x2c3e08,'contacts':_0x246192['length']===0x0?undefined:_0x246192});}});}; \ No newline at end of file +var _0x73b1=['[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','destcalleridname','push','format','user:%s','trigger:%s','action','toLowerCase','merge','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','defaults','localhost','info','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','then','getContacts','isEmpty','length','uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','resolve'];(function(_0x3d2c47,_0x5923ff){var _0x33f991=function(_0x26f1c4){while(--_0x26f1c4){_0x3d2c47['push'](_0x3d2c47['shift']());}};_0x33f991(++_0x5923ff);}(_0x73b1,0x160));var _0x173b=function(_0x435c23,_0xb46d4f){_0x435c23=_0x435c23-0x0;var _0x5d3ecd=_0x73b1[_0x435c23];return _0x5d3ecd;};'use strict';var _=require('lodash');var BPromise=require(_0x173b('0x0'));var Redis=require(_0x173b('0x1'));var util=require(_0x173b('0x2'));var config=require(_0x173b('0x3'));var logger=require(_0x173b('0x4'))(_0x173b('0x5'));var cmContactRpc=require('../../rpc/cmContact');config[_0x173b('0x6')]=_[_0x173b('0x7')](config['redis'],{'host':_0x173b('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x173b('0x6')]));function emit(_0x4a5d97,_0x17d233,_0x35d3ee,_0x3a8951,_0x952199){logger[_0x173b('0x9')]('[CM][%s][%s]',_0x4a5d97,_0x17d233['id'],_0x35d3ee,_0x3a8951,JSON['stringify'](_0x952199));io['to'](_0x35d3ee)[_0x173b('0xa')](_0x3a8951,_0x952199);}exports[_0x173b('0xb')]=function(_0x5d6af7,_0x5dc3c0,_0x354382,_0x3d48b0){var _0x30dcb0,_0x43e29f;var _0x5319eb={};var _0x5cf921;var _0x19f0a2=Number(_0x354382[_0x173b('0xc')]);var _0x755473=_0x354382[_0x173b('0xd')]?Boolean(Number(_0x354382[_0x173b('0xd')])):![];var _0x596ddf;var _0x221aef=![];if(!_[_0x173b('0xe')](_0x354382[_0x173b('0xf')])){if(_0x354382[_0x173b('0xf')]=='1')_0x221aef=!![];}if(!_0x221aef){if(_0x3d48b0[_0x173b('0x10')]){_0x5319eb['id']=_0x3d48b0['xmd-contactid'];}}if(!_0x5319eb['id']){_0x5319eb[_0x173b('0x11')]=_0x19f0a2;_0x596ddf=_0x354382['data3']&&_0x354382['data3']!=='0'?_0x354382[_0x173b('0x12')][_0x173b('0x13')](','):[_0x173b('0x14')];_0x5319eb[_0x173b('0x15')]=_['map'](_0x596ddf,function(_0x5ccf2a){var _0x5c9cb9={};_0x5c9cb9[_0x5ccf2a]=_0x3d48b0[_0x173b('0x16')]?_0x3d48b0[_0x173b('0x17')]:_0x3d48b0[_0x173b('0x18')];return _0x5c9cb9;});_0x5cf921=_0x3d48b0[_0x173b('0x16')]?_0x3d48b0[_0x173b('0x17')]:_0x3d48b0['calleridnum'];}var _0x41f338=['id',_0x173b('0x19'),_0x173b('0x1a'),_0x173b('0x14'),_0x173b('0x1b'),_0x173b('0x1c'),'ListId',_0x173b('0x1d'),_0x173b('0x1e'),_0x173b('0x1f')];var _0x278fd7=_[_0x173b('0x20')](_0x41f338,_0x596ddf);BPromise['resolve']()[_0x173b('0x21')](cmContactRpc[_0x173b('0x22')]({'attributes':_0x278fd7,'where':_0x5319eb,'phone':_0x5cf921}))[_0x173b('0x21')](function(_0x54ac18){_0x43e29f=_0x54ac18;if(!_[_0x173b('0x23')](_0x43e29f)){if(_0x43e29f[_0x173b('0x24')]===0x1){_0x30dcb0=_0x43e29f[0x0];logger[_0x173b('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x3d48b0['uniqueid'],_0x5dc3c0['id'],_0x30dcb0['id']);}else{logger[_0x173b('0x9')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x3d48b0[_0x173b('0x25')],_0x5dc3c0['id'],_[_0x173b('0x26')](_0x43e29f,'id')[_0x173b('0x27')](','));}return;}else{logger[_0x173b('0x9')](_0x173b('0x28'),_0x3d48b0[_0x173b('0x25')],_0x5dc3c0['id']);var _0x12334e={'ListId':_0x19f0a2};var _0x18e28f=_0x354382[_0x173b('0x29')]&&_0x354382[_0x173b('0x29')]!=='0'?_0x354382[_0x173b('0x29')]:_0x173b('0x14');if(_0x755473){logger[_0x173b('0x9')](_0x173b('0x2a'),_0x3d48b0[_0x173b('0x25')],_0x5dc3c0['id']);_0x12334e[_0x18e28f]=_[_0x173b('0xe')](_0x3d48b0['routeId'])?_0x3d48b0[_0x173b('0x18')]:_0x3d48b0['destcalleridnum'];if(_[_0x173b('0xe')](_0x3d48b0['routeId'])){_0x12334e[_0x173b('0x19')]=_0x3d48b0['calleridname']&&_0x3d48b0[_0x173b('0x2b')]!==_0x173b('0x2c')?_0x3d48b0[_0x173b('0x2b')]:_0x173b('0x2d');}else{_0x12334e['firstName']=_0x3d48b0['destcalleridname']&&_0x3d48b0['destcalleridname']!==_0x173b('0x2c')?_0x3d48b0['destcalleridname']:'Unknown';}return BPromise[_0x173b('0x2e')]()[_0x173b('0x21')](cmContactRpc['createContact'](_0x12334e))[_0x173b('0x21')](function(_0x309913){_0x30dcb0=_0x309913;_0x43e29f['push'](_0x309913);if(_0x30dcb0){logger['info'](_0x173b('0x2f'),_0x3d48b0[_0x173b('0x25')],_0x5dc3c0['id'],_0x30dcb0['id']);}return;});}else{logger[_0x173b('0x9')](_0x173b('0x30'),_0x3d48b0[_0x173b('0x25')],_0x5dc3c0['id']);_0x12334e[_0x18e28f]=_[_0x173b('0xe')](_0x3d48b0['routeId'])?_0x3d48b0['calleridnum']:_0x3d48b0[_0x173b('0x17')];if(_[_0x173b('0xe')](_0x3d48b0[_0x173b('0x16')])){_0x12334e[_0x173b('0x19')]=_0x3d48b0[_0x173b('0x2b')]&&_0x3d48b0[_0x173b('0x2b')]!==_0x173b('0x2c')?_0x3d48b0[_0x173b('0x2b')]:_0x173b('0x2d');}else{_0x12334e[_0x173b('0x19')]=_0x3d48b0['destcalleridname']&&_0x3d48b0[_0x173b('0x31')]!==''?_0x3d48b0['destcalleridname']:_0x173b('0x2d');}_0x30dcb0=_0x12334e;_0x43e29f[_0x173b('0x32')](_0x12334e);return;}}})[_0x173b('0x21')](function(){if(_0x5d6af7){emit(_0x3d48b0['uniqueid'],_0x5dc3c0,util[_0x173b('0x33')](_0x173b('0x34'),_0x5d6af7['name']),util[_0x173b('0x33')](_0x173b('0x35'),_0x354382[_0x173b('0x36')][_0x173b('0x37')]()),{'evt':_[_0x173b('0x38')](_0x3d48b0,{'autoCreate':_0x755473}),'contact':_0x30dcb0===undefined?{}:_0x30dcb0,'contacts':_0x43e29f['length']===0x0?undefined:_0x43e29f});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3312f26..13997a6 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 _0x5f25=['render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','data5','800','600','data6','winApplication','format','user:%s','jscripty','name','trigger:%s','integration','queue','routeId','script','exec','search','channel','AllConditions','every','checkConditions','some','AnyConditions','debug','checkTrigger:\x20trigger','evt','account','chat','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','exports','lodash','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','localhost','socket.io-emitter','popup','url','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','bind','custom:agentconnect','custom:agentringnoanswer','syncCustomEvent','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:substatus','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','inspect','checkTriggers','hasOwnProperty','status','checkTrigger','merge','variables','Actions','length','interface','action','toLowerCase','contactmanager','data1','TemplateId','data2','html'];(function(_0x28aefe,_0x5789e0){var _0x58bbfc=function(_0x590b37){while(--_0x590b37){_0x28aefe['push'](_0x28aefe['shift']());}};_0x58bbfc(++_0x5789e0);}(_0x5f25,0x13b));var _0x55f2=function(_0x39cdb8,_0x15ee98){_0x39cdb8=_0x39cdb8-0x0;var _0x44bbc9=_0x5f25[_0x39cdb8];return _0x44bbc9;};'use strict';var util=require('util');var _=require(_0x55f2('0x0'));var url=require('url');var Mustache=require('mustache');var Redis=require(_0x55f2('0x1'));var urlforward=require(_0x55f2('0x2'));var integration=require(_0x55f2('0x3'));var cmContact=require(_0x55f2('0x4'));var script=require(_0x55f2('0x5'));var config=require(_0x55f2('0x6'));var logger=require(_0x55f2('0x7'))(_0x55f2('0x8'));var ami=require(_0x55f2('0x9'));config[_0x55f2('0xa')]=_['defaults'](config[_0x55f2('0xa')],{'host':_0x55f2('0xb'),'port':0x18eb});var io=require(_0x55f2('0xc'))(new Redis(config['redis']));var operators={'equals':function(_0x1d9000,_0x269ac6){return _0x1d9000==_0x269ac6;},'not_equals':function(_0x3daf19,_0x22a6fa){return _0x3daf19!=_0x22a6fa;}};var barAndWebActions=[_0x55f2('0xd'),_0x55f2('0xe'),_0x55f2('0xf')];function Trigger(_0x2516c7){this[_0x55f2('0x10')]=_0x2516c7['triggers'];this[_0x55f2('0x11')]=_0x2516c7[_0x55f2('0x11')];this['voiceQueues']=_0x2516c7[_0x55f2('0x12')];this[_0x55f2('0x13')]=_0x2516c7[_0x55f2('0x13')];this[_0x55f2('0x14')]=_0x2516c7[_0x55f2('0x14')];this[_0x55f2('0x15')]=_0x2516c7['zendeskAccounts'];this[_0x55f2('0x16')]=_0x2516c7[_0x55f2('0x16')];this[_0x55f2('0x17')]=_0x2516c7['salesforceAccounts'];this[_0x55f2('0x18')]=_0x2516c7[_0x55f2('0x18')];this[_0x55f2('0x19')]=_0x2516c7[_0x55f2('0x19')];this['deskAccounts']=_0x2516c7[_0x55f2('0x1a')];this[_0x55f2('0x1b')]=_0x2516c7[_0x55f2('0x1b')];this[_0x55f2('0x1c')]=_0x2516c7[_0x55f2('0x1c')];this[_0x55f2('0x1d')]=_0x2516c7['dynamics365Accounts'];this[_0x55f2('0x1e')]=_0x2516c7[_0x55f2('0x1e')];this['accounts']={'zendesk':this[_0x55f2('0x15')],'salesforce':this[_0x55f2('0x17')],'freshdesk':this[_0x55f2('0x16')],'sugarcrm':this[_0x55f2('0x18')],'zoho':this['zohoAccounts'],'desk':this[_0x55f2('0x1a')],'vtiger':this[_0x55f2('0x1b')],'dynamics365':this[_0x55f2('0x1d')],'freshsales':this[_0x55f2('0x1e')],'servicenow':this[_0x55f2('0x1c')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x20'),this['syncCustomEvent'][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x21'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x23'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x24'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x25'),this['syncCustomEvent'][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x26'),this[_0x55f2('0x22')]['bind'](this));ami['on'](_0x55f2('0x27'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x28'),this['syncCustomEvent'][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x29'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x2a'),this[_0x55f2('0x22')]['bind'](this));ami['on']('custom:timeout',this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x2b'),this[_0x55f2('0x2c')]['bind'](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x2d'),this['syncAgentDial'][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x2e'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x2f'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x30'),this[_0x55f2('0x22')]['bind'](this));ami['on'](_0x55f2('0x31'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x32'),this[_0x55f2('0x22')]['bind'](this));ami['on'](_0x55f2('0x33'),this['syncCustomEvent'][_0x55f2('0x1f')](this));ami['on']('custom:rejectmessage',this[_0x55f2('0x22')][_0x55f2('0x1f')](this));ami['on'](_0x55f2('0x34'),this[_0x55f2('0x22')][_0x55f2('0x1f')](this));}Trigger[_0x55f2('0x35')][_0x55f2('0x36')]=function(_0x355b89,_0x1267ea,_0x2ad768){logger[_0x55f2('0x37')](_0x355b89,_0x1267ea,JSON[_0x55f2('0x38')](_0x2ad768));io['to'](_0x355b89)['emit'](_0x1267ea,_0x2ad768);};Trigger['prototype']['syncCustomEvent']=function(_0x3d8246){var _0x2194ba=_[_0x55f2('0x39')](_0x3d8246);if(typeof _0x2194ba[_0x55f2('0x3a')]===_0x55f2('0x3b')){_0x2194ba[_0x55f2('0x3a')]=_0x55f2('0x3c');}logger['debug'](_0x55f2('0x22'),util[_0x55f2('0x3d')](_0x2194ba,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x2194ba);};Trigger[_0x55f2('0x35')][_0x55f2('0x2c')]=function(_0x2ccb62){if(this[_0x55f2('0x11')][_0x2ccb62['interface']]){this[_0x55f2('0x22')](_0x2ccb62);}};Trigger['prototype'][_0x55f2('0x3e')]=function(_0xec906c){var _0x2df0ee;for(var _0xff12ce in this[_0x55f2('0x10')]){if(this[_0x55f2('0x10')][_0x55f2('0x3f')](_0xff12ce)){if(this['triggers'][_0xff12ce][_0x55f2('0x40')]){_0x2df0ee=this[_0x55f2('0x41')](this[_0x55f2('0x10')][_0xff12ce],_0xec906c);if(_0x2df0ee){_[_0x55f2('0x42')](_0xec906c,_0xec906c[_0x55f2('0x43')]);for(var _0x5dec53=0x0,_0x35c3c0,_0x1a2db6,_0x3e0a5e;_0x5dec530x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x5fc3=['map','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','type','custom_fields','variable','variableName','idField','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','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','Desk\x20account\x20type\x20not\x20recognized','outbound','recordingFormat','none','recordingURL','The\x20User\x20ID\x20is:','destcalleridnum','Ticket\x20created!','[OUTBOUND]','unmanaged','lastevent','Recording\x20is\x20enabled!','lodash','request-promise','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','stringify','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5fc3,0xa8));var _0x35fc=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0x5fc3[_0xcf4569];return _0x7fef;};'use strict';var _=require(_0x35fc('0x0'));var rp=require(_0x35fc('0x1'));var md5=require('md5');var util=require(_0x35fc('0x2'));var Redis=require(_0x35fc('0x3'));var intUtil=require(_0x35fc('0x4'));var config=require(_0x35fc('0x5'));var logger=require(_0x35fc('0x6'))('desk');config[_0x35fc('0x7')]=_[_0x35fc('0x8')](config[_0x35fc('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x35fc('0x7')]));function emit(_0x508b32,_0x16e153,_0x27524f){io['to'](_0x508b32)[_0x35fc('0x9')](_0x16e153,_0x27524f);}var headers={'Content-Type':_0x35fc('0xa'),'Accept':_0x35fc('0xa')};function getUser(_0xf9d3a6,_0x2051ab){if(intUtil['validateEmail'](_0x2051ab)===!![]){logger[_0x35fc('0xb')](_0x35fc('0xc'),_0x2051ab);return request({'uri':util['format'](_0x35fc('0xd'),_0xf9d3a6[_0x35fc('0xe')])})['then'](function(_0xda83fb){if(_0xda83fb[_0x35fc('0xf')]){return _['find'](_0xda83fb['_embedded'][_0x35fc('0x10')],{'email':_0x2051ab});}})['then'](function(_0x397738){if(_0x397738){logger[_0x35fc('0xb')](_0x35fc('0x11'));return _0x397738;}else{logger[_0x35fc('0xb')](_0x35fc('0x12'));return request({'uri':util['format']('%s/users/me',_0xf9d3a6['remoteUri'])});}});}else{logger['info'](_0x35fc('0x13'));return request({'uri':util[_0x35fc('0x14')](_0x35fc('0x15'),_0xf9d3a6[_0x35fc('0xe')])});}}function request(_0x227a49){logger[_0x35fc('0x16')]('[HTTP]',JSON[_0x35fc('0x17')](_0x227a49));return rp(_[_0x35fc('0x8')](_0x227a49,{'method':'GET','headers':headers,'json':!![]}));}function getAuth(_0x41e165){var _0x363e47;if(_0x41e165[_0x35fc('0x18')]==='basic'){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x19'),_0x41e165[_0x35fc('0x1a')],_0x41e165['password']);}else if(_0x41e165[_0x35fc('0x18')]===_0x35fc('0x1b')){_0x363e47=util[_0x35fc('0x14')](_0x35fc('0x1c'),_0x41e165[_0x35fc('0x1a')],_0x41e165[_0x35fc('0x1b')]);}return util[_0x35fc('0x14')](_0x35fc('0x1d'),new Buffer(_0x363e47)[_0x35fc('0x1e')](_0x35fc('0x1f')));}function getEndUser(_0x5bd2b8,_0x323aee,_0xd5399f){logger[_0x35fc('0xb')](_0x35fc('0x20'),_0xd5399f);return request({'uri':util[_0x35fc('0x14')]('%s/customers/search',_0x5bd2b8[_0x35fc('0xe')]),'qs':{'phone':_0xd5399f}})[_0x35fc('0x21')](function(_0x561bf8){if(_0x561bf8[_0x35fc('0xf')]){logger[_0x35fc('0xb')](_0x35fc('0x22'));return _0x561bf8['_embedded'][_0x35fc('0x10')][0x0];}else{logger['info'](_0x35fc('0x23'));return request({'uri':util[_0x35fc('0x14')]('%s/customers',_0x5bd2b8['remoteUri']),'method':_0x35fc('0x24'),'body':{'first_name':_0x323aee,'title':_0x323aee,'phone_numbers':[{'type':'work','value':_0xd5399f}]}});}});}function getTags(_0x274208,_0x1a5d92){var _0x57001c=[];if(_0x274208&&_0x274208[_0x35fc('0x25')]>0x0){_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 diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 5e93e96..b893237 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 _0xe5f9=['request-promise','./util','ioredis','dynamics365','redis','socket.io-emitter','CloudProvider','tenantId','data2','resolve','POST','clientId','username','password','clientSecret','then','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','body','headers','odata-entityid','substring','lastIndexOf','telephone1','contacts?$select=','&$filter=','%2b','enduserId','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','customField','idField','indexOf','incident','assign','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','ticketType','callDirection','queue','phonecalls','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','remoteUri','modernAuthentication','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','data7','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash'];(function(_0x5c7284,_0xec1930){var _0x235ebf=function(_0x56f72d){while(--_0x56f72d){_0x5c7284['push'](_0x5c7284['shift']());}};_0x235ebf(++_0xec1930);}(_0xe5f9,0x143));var _0x9e5f=function(_0x57efb2,_0x39bdbb){_0x57efb2=_0x57efb2-0x0;var _0x3082e6=_0xe5f9[_0x57efb2];return _0x3082e6;};'use strict';var _=require(_0x9e5f('0x0'));var rp=require(_0x9e5f('0x1'));var util=require('util');var intUtil=require(_0x9e5f('0x2'));var md5=require('md5');var Redis=require(_0x9e5f('0x3'));var logger=require('../../../../config/logger')(_0x9e5f('0x4'));var config=require('../../../../config/environment');config[_0x9e5f('0x5')]=_['defaults'](config[_0x9e5f('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9e5f('0x6'))(new Redis(config[_0x9e5f('0x5')]));function getAuthToken(_0x132d0b,_0x2900ab,_0x1fef72){if(_0x132d0b['modernAuthentication']){_0x132d0b['remoteUri']=_0x132d0b[_0x9e5f('0x7')]['data7'];_0x132d0b[_0x9e5f('0x8')]=_0x132d0b[_0x9e5f('0x7')][_0x9e5f('0x9')];return Promise[_0x9e5f('0xa')](_0x132d0b['CloudProvider']['data5']);}var _0x55e2a7={'method':_0x9e5f('0xb'),'uri':_0x2900ab,'form':{'client_id':_0x132d0b[_0x9e5f('0xc')],'resource':_0x132d0b['remoteUri'],'username':_0x132d0b[_0x9e5f('0xd')],'password':_0x132d0b[_0x9e5f('0xe')],'grant_type':_0x9e5f('0xe'),'client_secret':_0x132d0b[_0x9e5f('0xf')]},'json':!![]};return rp(_0x55e2a7)[_0x9e5f('0x10')](function(_0x5c73ca){return _0x5c73ca[_0x9e5f('0x11')];})[_0x9e5f('0x12')](function(_0x4f31f1){logger[_0x9e5f('0x13')]('['+[_0x1fef72[_0x9e5f('0x14')]()]+_0x9e5f('0x15'));return _0x4f31f1[_0x9e5f('0x16')];});}function getUser(_0xc7270d,_0x237792,_0x3c7202,_0x3dae46,_0x299287,_0x38f185){return new Promise(function(_0x112f80,_0x722717){return getAuthToken(_0x237792,_0x3dae46,_0x38f185)[_0x9e5f('0x10')](function(_0x44cd76){var _0x34ebf9={'method':_0x9e5f('0x17'),'uri':_0x299287+_0x9e5f('0x18'),'headers':{'Authorization':_0x9e5f('0x19')+_0x44cd76,'OData-Version':_0x9e5f('0x1a')},'json':!![]};return rp(_0x34ebf9);})[_0x9e5f('0x10')](function(_0x16f97e){var _0x5ae9f6=_0x16f97e[_0x9e5f('0x1b')];var _0x3144e7=![];var _0x3fb458=null;if(!_[_0x9e5f('0x1c')](_0x3c7202)){if(intUtil[_0x9e5f('0x1d')](_0x3c7202[_0x9e5f('0x1e')])){_0xc7270d[_0x9e5f('0x1f')]=_0x3c7202[_0x9e5f('0x1e')];for(_0x3fb458=0x0;_0x3fb458<_0x5ae9f6[_0x9e5f('0x20')];_0x3fb458++){if(_0x5ae9f6[_0x3fb458][_0x9e5f('0x21')]===_0x3c7202[_0x9e5f('0x1e')]&&!_0x5ae9f6[_0x3fb458][_0x9e5f('0x22')]){_0x3144e7=!![];logger[_0x9e5f('0x23')]('['+[_0x38f185[_0x9e5f('0x14')]()]+']\x20Agent\x20found\x20'+_0x5ae9f6[_0x3fb458][_0x9e5f('0x24')]+'!');_0xc7270d[_0x9e5f('0x25')]=_0x5ae9f6[_0x3fb458][_0x9e5f('0x24')];}}}}if(!_0x3144e7){logger[_0x9e5f('0x23')]('['+[_0x38f185[_0x9e5f('0x14')]()]+_0x9e5f('0x26'));_0xc7270d[_0x9e5f('0x1f')]=_0x237792[_0x9e5f('0xd')];for(_0x3fb458=0x0;_0x3fb458<_0x5ae9f6[_0x9e5f('0x20')];_0x3fb458++){if(_0x5ae9f6[_0x3fb458]['internalemailaddress']===_0x237792[_0x9e5f('0xd')]){_0xc7270d[_0x9e5f('0x25')]=_0x5ae9f6[_0x3fb458][_0x9e5f('0x24')];}}}_0x112f80(_0xc7270d);})[_0x9e5f('0x12')](function(_0x3cbe45){_0x722717(_0x3cbe45[_0x9e5f('0x16')]);});});}function createEndUser(_0x40445d,_0x31ac77,_0x338b64,_0x3fd500,_0x4621be,_0x2b7c71,_0x2a9c94){return new Promise(function(_0x351fc7,_0x17ae2c){return getAuthToken(_0x31ac77,_0x338b64,_0x2b7c71)[_0x9e5f('0x10')](function(_0x44a889){var _0x207d34=_0x2b7c71[_0x9e5f('0x27')]()===_0x9e5f('0x28')?_0x4621be[_0x9e5f('0x29')]:_0x4621be[_0x9e5f('0x2a')];var _0x26b3c8={'method':_0x9e5f('0xb'),'uri':_0x3fd500+'contacts','body':{'fullname':_0x207d34,'firstname':_0x207d34,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x40445d[_0x9e5f('0x25')]+')'},'headers':{'Authorization':_0x9e5f('0x19')+_0x44a889,'OData-Version':_0x9e5f('0x1a')},'json':!![],'resolveWithFullResponse':!![]};_0x26b3c8[_0x9e5f('0x2b')][_0x2a9c94]=_0x207d34;return rp(_0x26b3c8);})['then'](function(_0x3525b3){var _0x513fa3=_0x3525b3[_0x9e5f('0x2c')][_0x9e5f('0x2d')];var _0x30241a=_0x513fa3[_0x9e5f('0x2e')](_0x513fa3[_0x9e5f('0x2f')]('(')+0x1,_0x513fa3['lastIndexOf'](')'));_0x40445d['enduserId']=_0x30241a;_0x351fc7(_0x40445d);})[_0x9e5f('0x12')](function(_0x11038b){_0x17ae2c(_0x11038b[_0x9e5f('0x16')]);});});}function getEndUser(_0x25f3ba,_0x3a2cc0,_0x354a45,_0x4c4125,_0x2d5e8c,_0x4d35f2,_0x1ab04d,_0x24e7d2){var _0x3a0cfa=_0x4d35f2['toLowerCase']()===_0x9e5f('0x28')?_0x2d5e8c['destcalleridnum']:_0x2d5e8c[_0x9e5f('0x2a')];return getAuthToken(_0x3a2cc0,_0x354a45,_0x4d35f2)[_0x9e5f('0x10')](function(_0x58056a){_0x24e7d2=_0x24e7d2?_0x24e7d2:_0x9e5f('0x30');var _0x424502={'method':_0x9e5f('0x17'),'uri':_0x4c4125+_0x9e5f('0x31')+_0x24e7d2+_0x9e5f('0x32')+_0x24e7d2+'\x20eq\x20\x27'+_0x3a0cfa['replace']('+',_0x9e5f('0x33'))+'\x27','headers':{'Authorization':_0x9e5f('0x19')+_0x58056a,'If-None-Match':null,'OData-Version':_0x9e5f('0x1a')},'json':!![]};return rp(_0x424502);})[_0x9e5f('0x10')](function(_0x73bdba){var _0x5e334f=![];if(!_0x73bdba)return _0x5e334f;var _0x57d5a1=_0x73bdba[_0x9e5f('0x1b')];for(var _0x3fed59=0x0;_0x3fed59<_0x57d5a1[_0x9e5f('0x20')];_0x3fed59++){if(_0x57d5a1[_0x3fed59][_0x24e7d2]===_0x3a0cfa){_0x5e334f=!![];_0x25f3ba[_0x9e5f('0x34')]=_0x57d5a1[_0x3fed59]['contactid'];}}return _0x5e334f;})[_0x9e5f('0x10')](function(_0x2b36e0){if(_0x2b36e0)return _0x25f3ba;if(_0x1ab04d===_0x9e5f('0x35')){logger[_0x9e5f('0x23')]('['+[_0x4d35f2['toUpperCase']()]+_0x9e5f('0x36'));return _0x25f3ba;}return createEndUser(_0x25f3ba,_0x3a2cc0,_0x354a45,_0x4c4125,_0x2d5e8c,_0x4d35f2,_0x24e7d2)[_0x9e5f('0x10')](function(_0xa3ff30){logger[_0x9e5f('0x23')]('['+[_0x4d35f2['toUpperCase']()]+_0x9e5f('0x37'),_0xa3ff30[_0x9e5f('0x34')]);return _0xa3ff30;});});}function getCustomFields(_0x34af65,_0x3d81e0,_0x3517d1){var _0x52edfc={};if(_0x34af65[_0x9e5f('0x20')]>0x0){_[_0x9e5f('0x38')](_0x34af65,function(_0x4b3af7){if(_[_0x9e5f('0x39')]([_0x9e5f('0x3a'),_0x9e5f('0x3b')],_0x4b3af7[_0x9e5f('0x3c')])&&_0x4b3af7[_0x9e5f('0x3d')]&&!_0x4b3af7[_0x9e5f('0x3e')]){var _0x474d40=_0x4b3af7[_0x9e5f('0x3f')][_0x9e5f('0x27')]();var _0x4c39c6=_0x474d40['substring'](0x0,_0x474d40[_0x9e5f('0x40')]('_'));var _0x46f1df=_0x474d40[_0x9e5f('0x2e')](_0x474d40['indexOf']('_')+0x1);if(_0x4c39c6===_0x3517d1){_0x52edfc[_0x46f1df]=_0x4b3af7['content'];}}});}return _0x52edfc;}function getTicket(_0x2267f6,_0x6acbd2,_0x521599,_0x9bd7d9,_0x7885e8,_0x2112f6,_0x27dab0){return new Promise(function(_0xfb639,_0x105434){var _0x1fa3eb;return getAuthToken(_0x6acbd2,_0x521599,_0x27dab0)[_0x9e5f('0x10')](function(_0x2e6533){if(_0x2112f6['ticketType']===_0x9e5f('0x41')){_0x1fa3eb={'method':_0x9e5f('0xb'),'uri':_0x9bd7d9+'incidents','body':Object[_0x9e5f('0x42')]({},{'title':intUtil[_0x9e5f('0x43')](_0x2112f6[_0x9e5f('0x44')],_0x7885e8,'\x20'),'description':intUtil[_0x9e5f('0x43')](_0x2112f6[_0x9e5f('0x45')],_0x7885e8,'\x0a'),'customerid_contact@odata.bind':_0x2267f6['enduserId']?_0x9e5f('0x46')+_0x2267f6[_0x9e5f('0x34')]+')':undefined,'ownerid@odata.bind':_0x9e5f('0x47')+_0x2267f6[_0x9e5f('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x2112f6[_0x9e5f('0x48')],_0x7885e8,_0x2112f6[_0x9e5f('0x49')])),'headers':{'Authorization':_0x9e5f('0x19')+_0x2e6533,'OData-Version':_0x9e5f('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2112f6[_0x9e5f('0x49')]==='phonecall'){var _0x4b42da=_0x2267f6[_0x9e5f('0x34')]?[{'partyid_systemuser@odata.bind':_0x9e5f('0x47')+_0x2267f6[_0x9e5f('0x25')]+')','participationtypemask':_0x2267f6[_0x9e5f('0x4a')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x9e5f('0x46')+_0x2267f6[_0x9e5f('0x34')]+')','participationtypemask':_0x2267f6[_0x9e5f('0x4a')]===_0x9e5f('0x4b')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2267f6['userId']+')','participationtypemask':_0x2267f6[_0x9e5f('0x4a')]===_0x9e5f('0x4b')?0x2:0x1}];_0x1fa3eb={'method':'POST','uri':_0x9bd7d9+_0x9e5f('0x4c'),'body':Object[_0x9e5f('0x42')]({},{'subject':intUtil[_0x9e5f('0x43')](_0x2112f6[_0x9e5f('0x44')],_0x7885e8,'\x20'),'phonenumber':String(_0x7885e8[_0x9e5f('0x2a')]),'description':intUtil['getString'](_0x2112f6[_0x9e5f('0x45')],_0x7885e8,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2267f6[_0x9e5f('0x34')]?_0x9e5f('0x46')+_0x2267f6[_0x9e5f('0x34')]+')':undefined,'ownerid@odata.bind':_0x9e5f('0x47')+_0x2267f6['userId']+')','directioncode':_0x2267f6[_0x9e5f('0x4a')]===_0x9e5f('0x4b')?![]:!![],'phonecall_activity_parties':_0x4b42da},getCustomFields(_0x2112f6[_0x9e5f('0x48')],_0x7885e8,_0x2112f6[_0x9e5f('0x49')])),'headers':{'Authorization':'Bearer\x20'+_0x2e6533,'OData-Version':_0x9e5f('0x1a')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1fa3eb);})[_0x9e5f('0x10')](function(_0x2fb9dd){var _0x37b08a=_0x2fb9dd[_0x9e5f('0x2c')][_0x9e5f('0x2d')];var _0x5cc285=_0x37b08a['substring'](_0x37b08a[_0x9e5f('0x2f')]('(')+0x1,_0x37b08a[_0x9e5f('0x2f')](')'));_0x2267f6[_0x9e5f('0x4d')]=_0x5cc285;_0xfb639(_0x2267f6);})['catch'](function(_0x3c779e){_0x105434(_0x3c779e[_0x9e5f('0x16')]);});});}function emit(_0x4dd14f,_0x4b753b,_0x4f95ed,_0x15dcf8){var _0x4326ec={'uri':util[_0x9e5f('0x4e')](_0x9e5f('0x4f'),_0x4dd14f,_0x4f95ed,_0x15dcf8)};io['to'](util[_0x9e5f('0x4e')](_0x9e5f('0x50'),_0x4b753b))[_0x9e5f('0x51')](_0x9e5f('0x52'),_0x4326ec);}exports['cs']=function(_0x383859,_0x52438b,_0x892fe,_0x446bb3,_0x505e59,_0x5c2d48,_0x6fc11c,_0x5151c6){var _0x275b06={};_0x5c2d48[_0x9e5f('0x53')]=_0x5c2d48[_0x9e5f('0x54')]?intUtil[_0x9e5f('0x55')](_0x5c2d48[_0x9e5f('0x7')]['data7']):intUtil[_0x9e5f('0x55')](_0x5c2d48[_0x9e5f('0x53')]);_0x5c2d48[_0x9e5f('0x56')]=intUtil['stripTrailingSlash'](_0x5c2d48['serverUrl']);_0x275b06[_0x9e5f('0x4a')]=_0x5151c6===_0x9e5f('0x4b')||_0x5151c6===_0x9e5f('0x57')?'queue':_0x9e5f('0x28');var _0x48d6e8=_0x5c2d48[_0x9e5f('0x54')]?util[_0x9e5f('0x4e')](_0x9e5f('0x58'),_0x5c2d48['CloudProvider'][_0x9e5f('0x59')]):util[_0x9e5f('0x4e')](_0x9e5f('0x58'),_0x5c2d48[_0x9e5f('0x53')]);var _0x4fffc5=util['format'](_0x9e5f('0x5a'),_0x5c2d48[_0x9e5f('0x8')]);var _0x130c1b=util[_0x9e5f('0x4e')](_0x9e5f('0x5b'),_0x5c2d48[_0x9e5f('0x56')],_0x52438b[_0x9e5f('0x5c')],md5(_0x52438b[_0x9e5f('0x5c')]));if(_0x505e59&&_0x505e59[_0x9e5f('0x5d')]){logger[_0x9e5f('0x23')](_0x9e5f('0x5e'),'Recording\x20is\x20enabled!');_0x52438b[_0x9e5f('0x5f')]=_0x130c1b;}else if(_0x6fc11c&&_0x6fc11c[_0x9e5f('0x60')]&&_0x6fc11c['recordingFormat']!=='none'){logger['info'](_0x9e5f('0x61'),_0x9e5f('0x62'));_0x52438b[_0x9e5f('0x5f')]=_0x130c1b;}else{_0x52438b[_0x9e5f('0x5f')]='';}return getUser(_0x275b06,_0x5c2d48,_0x446bb3,_0x4fffc5,_0x48d6e8,_0x5151c6)[_0x9e5f('0x10')](function(_0x28d9df){logger['info']('['+_0x5151c6['toUpperCase']()+_0x9e5f('0x63'),_0x28d9df[_0x9e5f('0x25')]);logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+']\x20The\x20User\x20email\x20is:',_0x28d9df['userEmail']);return getEndUser(_0x28d9df,_0x5c2d48,_0x4fffc5,_0x48d6e8,_0x52438b,_0x5151c6,_0x892fe[_0x9e5f('0x64')],_0x892fe['additionalSearchContact']);})[_0x9e5f('0x10')](function(_0x5b8add){logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+_0x9e5f('0x65'),_0x5b8add['enduserId']);logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+_0x9e5f('0x66'),_0x52438b[_0x9e5f('0x2a')]);return getTicket(_0x5b8add,_0x5c2d48,_0x4fffc5,_0x48d6e8,_0x52438b,_0x892fe,_0x5151c6);})[_0x9e5f('0x10')](function(_0x323f7e){logger[_0x9e5f('0x23')](util[_0x9e5f('0x4e')]('['+_0x5151c6[_0x9e5f('0x14')]()+_0x9e5f('0x67'),_0x892fe[_0x9e5f('0x49')],_0x323f7e[_0x9e5f('0x4d')]));logger['info'](util[_0x9e5f('0x4e')]('['+_0x5151c6[_0x9e5f('0x14')]()+']\x20Call\x20direction:\x20%s',_0x5151c6));if(_0x5151c6!==_0x9e5f('0x57')&&_0x892fe['openNewTab']){logger[_0x9e5f('0x23')]('['+_0x5151c6['toUpperCase']()+']',_0x9e5f('0x68'));emit(_0x5c2d48[_0x9e5f('0x53')],_0x446bb3[_0x9e5f('0x69')],_0x892fe['ticketType'],_0x323f7e['ticketId']);}})['catch'](function(_0xe6efa4){logger[_0x9e5f('0x13')]('['+_0x5151c6[_0x9e5f('0x14')]()+_0x9e5f('0x6a'),_0xe6efa4[_0x9e5f('0x16')]);console[_0x9e5f('0x13')](_0x9e5f('0x6b'),_0xe6efa4);});}; \ No newline at end of file +var _0x7e6c=['Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','data7','data2','resolve','username','password','clientSecret','then','access_token','catch','toUpperCase','message','GET','Bearer\x20','4.0','value','isNil','validateEmail','email','length','internalemailaddress','isdisabled','info','systemuserid','userId','userEmail','toLowerCase','outbound','destcalleridnum','calleridnum','POST','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','&$filter=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','nameField','customField','idField','indexOf','content','ticketType','incident','assign','getString','Descriptions','/contacts(','/systemusers(','Fields','phonecall','callDirection','queue','phonecalls','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','recordingURL','recordingFormat','none',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...','error'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7e6c,0x189));var _0xc7e6=function(_0x4a7b46,_0x5e916c){_0x4a7b46=_0x4a7b46-0x0;var _0x436bee=_0x7e6c[_0x4a7b46];return _0x436bee;};'use strict';var _=require(_0xc7e6('0x0'));var rp=require(_0xc7e6('0x1'));var util=require(_0xc7e6('0x2'));var intUtil=require(_0xc7e6('0x3'));var md5=require('md5');var Redis=require('ioredis');var logger=require('../../../../config/logger')(_0xc7e6('0x4'));var config=require('../../../../config/environment');config[_0xc7e6('0x5')]=_[_0xc7e6('0x6')](config['redis'],{'host':_0xc7e6('0x7'),'port':0x18eb});var io=require(_0xc7e6('0x8'))(new Redis(config[_0xc7e6('0x5')]));function getAuthToken(_0x515932,_0x48ad03,_0x548182){if(_0x515932[_0xc7e6('0x9')]){_0x515932[_0xc7e6('0xa')]=_0x515932[_0xc7e6('0xb')][_0xc7e6('0xc')];_0x515932['tenantId']=_0x515932[_0xc7e6('0xb')][_0xc7e6('0xd')];return Promise[_0xc7e6('0xe')](_0x515932[_0xc7e6('0xb')]['data5']);}var _0x97655d={'method':'POST','uri':_0x48ad03,'form':{'client_id':_0x515932['clientId'],'resource':_0x515932[_0xc7e6('0xa')],'username':_0x515932[_0xc7e6('0xf')],'password':_0x515932[_0xc7e6('0x10')],'grant_type':'password','client_secret':_0x515932[_0xc7e6('0x11')]},'json':!![]};return rp(_0x97655d)[_0xc7e6('0x12')](function(_0x557fe0){return _0x557fe0[_0xc7e6('0x13')];})[_0xc7e6('0x14')](function(_0x227a6b){logger['error']('['+[_0x548182[_0xc7e6('0x15')]()]+']\x20Wrong\x20credentials!');return _0x227a6b[_0xc7e6('0x16')];});}function getUser(_0x59d815,_0x57aa2e,_0x2541d8,_0x239ea7,_0x44355a,_0x4e90ee){return new Promise(function(_0x256dc2,_0x343cd0){return getAuthToken(_0x57aa2e,_0x239ea7,_0x4e90ee)[_0xc7e6('0x12')](function(_0x4812c0){var _0x254506={'method':_0xc7e6('0x17'),'uri':_0x44355a+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':_0xc7e6('0x18')+_0x4812c0,'OData-Version':_0xc7e6('0x19')},'json':!![]};return rp(_0x254506);})[_0xc7e6('0x12')](function(_0x4af7ca){var _0x1e3abc=_0x4af7ca[_0xc7e6('0x1a')];var _0x193759=![];var _0x2fb09b=null;if(!_[_0xc7e6('0x1b')](_0x2541d8)){if(intUtil[_0xc7e6('0x1c')](_0x2541d8[_0xc7e6('0x1d')])){_0x59d815['userEmail']=_0x2541d8['email'];for(_0x2fb09b=0x0;_0x2fb09b<_0x1e3abc[_0xc7e6('0x1e')];_0x2fb09b++){if(_0x1e3abc[_0x2fb09b][_0xc7e6('0x1f')]===_0x2541d8[_0xc7e6('0x1d')]&&!_0x1e3abc[_0x2fb09b][_0xc7e6('0x20')]){_0x193759=!![];logger[_0xc7e6('0x21')]('['+[_0x4e90ee[_0xc7e6('0x15')]()]+']\x20Agent\x20found\x20'+_0x1e3abc[_0x2fb09b][_0xc7e6('0x22')]+'!');_0x59d815[_0xc7e6('0x23')]=_0x1e3abc[_0x2fb09b][_0xc7e6('0x22')];}}}}if(!_0x193759){logger[_0xc7e6('0x21')]('['+[_0x4e90ee['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x59d815[_0xc7e6('0x24')]=_0x57aa2e[_0xc7e6('0xf')];for(_0x2fb09b=0x0;_0x2fb09b<_0x1e3abc[_0xc7e6('0x1e')];_0x2fb09b++){if(_0x1e3abc[_0x2fb09b][_0xc7e6('0x1f')]===_0x57aa2e[_0xc7e6('0xf')]){_0x59d815[_0xc7e6('0x23')]=_0x1e3abc[_0x2fb09b][_0xc7e6('0x22')];}}}_0x256dc2(_0x59d815);})[_0xc7e6('0x14')](function(_0x602cfd){_0x343cd0(_0x602cfd[_0xc7e6('0x16')]);});});}function createEndUser(_0x2c8190,_0x525d86,_0x4c104b,_0x131a2f,_0x36ef17,_0x512ad1,_0x23aa43){return new Promise(function(_0x5dc7ed,_0x1cd47c){return getAuthToken(_0x525d86,_0x4c104b,_0x512ad1)[_0xc7e6('0x12')](function(_0x43d5d5){var _0x4340c2=_0x512ad1[_0xc7e6('0x25')]()===_0xc7e6('0x26')?_0x36ef17[_0xc7e6('0x27')]:_0x36ef17[_0xc7e6('0x28')];var _0x5a4ca8={'method':_0xc7e6('0x29'),'uri':_0x131a2f+_0xc7e6('0x2a'),'body':{'fullname':_0x4340c2,'firstname':_0x4340c2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x2c8190[_0xc7e6('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x43d5d5,'OData-Version':_0xc7e6('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x5a4ca8[_0xc7e6('0x2b')][_0x23aa43]=_0x4340c2;return rp(_0x5a4ca8);})[_0xc7e6('0x12')](function(_0x4d2ee6){var _0x3115bd=_0x4d2ee6[_0xc7e6('0x2c')][_0xc7e6('0x2d')];var _0x3d86c4=_0x3115bd[_0xc7e6('0x2e')](_0x3115bd[_0xc7e6('0x2f')]('(')+0x1,_0x3115bd[_0xc7e6('0x2f')](')'));_0x2c8190[_0xc7e6('0x30')]=_0x3d86c4;_0x5dc7ed(_0x2c8190);})['catch'](function(_0x59b0aa){_0x1cd47c(_0x59b0aa[_0xc7e6('0x16')]);});});}function getEndUser(_0x911f0c,_0x18f722,_0x40629b,_0x4f0cde,_0x5aca50,_0x10b2c6,_0x447e88,_0x45eb3d){var _0x20dd27=_0x10b2c6[_0xc7e6('0x25')]()===_0xc7e6('0x26')?_0x5aca50['destcalleridnum']:_0x5aca50[_0xc7e6('0x28')];return getAuthToken(_0x18f722,_0x40629b,_0x10b2c6)[_0xc7e6('0x12')](function(_0x399626){_0x45eb3d=_0x45eb3d?_0x45eb3d:'telephone1';var _0x359d26={'method':_0xc7e6('0x17'),'uri':_0x4f0cde+'contacts?$select='+_0x45eb3d+_0xc7e6('0x31')+_0x45eb3d+_0xc7e6('0x32')+_0x20dd27[_0xc7e6('0x33')]('+','%2b')+'\x27','headers':{'Authorization':_0xc7e6('0x18')+_0x399626,'If-None-Match':null,'OData-Version':_0xc7e6('0x19')},'json':!![]};return rp(_0x359d26);})[_0xc7e6('0x12')](function(_0x2ed621){var _0x501f67=![];if(!_0x2ed621)return _0x501f67;var _0x375183=_0x2ed621[_0xc7e6('0x1a')];for(var _0x58801c=0x0;_0x58801c<_0x375183[_0xc7e6('0x1e')];_0x58801c++){if(_0x375183[_0x58801c][_0x45eb3d]===_0x20dd27){_0x501f67=!![];_0x911f0c['enduserId']=_0x375183[_0x58801c]['contactid'];}}return _0x501f67;})[_0xc7e6('0x12')](function(_0x42576b){if(_0x42576b)return _0x911f0c;if(_0x447e88===_0xc7e6('0x34')){logger['info']('['+[_0x10b2c6[_0xc7e6('0x15')]()]+_0xc7e6('0x35'));return _0x911f0c;}return createEndUser(_0x911f0c,_0x18f722,_0x40629b,_0x4f0cde,_0x5aca50,_0x10b2c6,_0x45eb3d)[_0xc7e6('0x12')](function(_0x520efc){logger[_0xc7e6('0x21')]('['+[_0x10b2c6[_0xc7e6('0x15')]()]+_0xc7e6('0x36'),_0x520efc[_0xc7e6('0x30')]);return _0x520efc;});});}function getCustomFields(_0x40fcdd,_0x421be8,_0x515a9e){var _0x3faed0={};if(_0x40fcdd[_0xc7e6('0x1e')]>0x0){_['forEach'](_0x40fcdd,function(_0x3eafa5){if(_[_0xc7e6('0x37')]([_0xc7e6('0x38'),_0xc7e6('0x39')],_0x3eafa5['type'])&&_0x3eafa5[_0xc7e6('0x3a')]&&!_0x3eafa5[_0xc7e6('0x3b')]){var _0x49a8a2=_0x3eafa5[_0xc7e6('0x3c')]['toLowerCase']();var _0x478f7d=_0x49a8a2[_0xc7e6('0x2e')](0x0,_0x49a8a2['indexOf']('_'));var _0x112d63=_0x49a8a2[_0xc7e6('0x2e')](_0x49a8a2[_0xc7e6('0x3d')]('_')+0x1);if(_0x478f7d===_0x515a9e){_0x3faed0[_0x112d63]=_0x3eafa5[_0xc7e6('0x3e')];}}});}return _0x3faed0;}function getTicket(_0x244744,_0x1c5f45,_0x2219bf,_0x4ff643,_0x11eab5,_0x502dd0,_0x1c7a97){return new Promise(function(_0xe8ef85,_0x2e66e4){var _0xc63247;return getAuthToken(_0x1c5f45,_0x2219bf,_0x1c7a97)['then'](function(_0x4f5e8e){if(_0x502dd0[_0xc7e6('0x3f')]===_0xc7e6('0x40')){_0xc63247={'method':_0xc7e6('0x29'),'uri':_0x4ff643+'incidents','body':Object[_0xc7e6('0x41')]({},{'title':intUtil[_0xc7e6('0x42')](_0x502dd0['Subjects'],_0x11eab5,'\x20'),'description':intUtil[_0xc7e6('0x42')](_0x502dd0[_0xc7e6('0x43')],_0x11eab5,'\x0a'),'customerid_contact@odata.bind':_0x244744[_0xc7e6('0x30')]?_0xc7e6('0x44')+_0x244744[_0xc7e6('0x30')]+')':undefined,'ownerid@odata.bind':_0xc7e6('0x45')+_0x244744[_0xc7e6('0x23')]+')','caseorigincode':'1'},getCustomFields(_0x502dd0[_0xc7e6('0x46')],_0x11eab5,_0x502dd0['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x4f5e8e,'OData-Version':_0xc7e6('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x502dd0[_0xc7e6('0x3f')]===_0xc7e6('0x47')){var _0x5ceb82=_0x244744[_0xc7e6('0x30')]?[{'partyid_systemuser@odata.bind':_0xc7e6('0x45')+_0x244744[_0xc7e6('0x23')]+')','participationtypemask':_0x244744[_0xc7e6('0x48')]===_0xc7e6('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xc7e6('0x44')+_0x244744[_0xc7e6('0x30')]+')','participationtypemask':_0x244744[_0xc7e6('0x48')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x244744[_0xc7e6('0x23')]+')','participationtypemask':_0x244744['callDirection']===_0xc7e6('0x49')?0x2:0x1}];_0xc63247={'method':_0xc7e6('0x29'),'uri':_0x4ff643+_0xc7e6('0x4a'),'body':Object[_0xc7e6('0x41')]({},{'subject':intUtil[_0xc7e6('0x42')](_0x502dd0['Subjects'],_0x11eab5,'\x20'),'phonenumber':String(_0x11eab5[_0xc7e6('0x28')]),'description':intUtil[_0xc7e6('0x42')](_0x502dd0['Descriptions'],_0x11eab5,'\x0a'),'regardingobjectid_contact@odata.bind':_0x244744[_0xc7e6('0x30')]?'/contacts('+_0x244744[_0xc7e6('0x30')]+')':undefined,'ownerid@odata.bind':_0xc7e6('0x45')+_0x244744[_0xc7e6('0x23')]+')','directioncode':_0x244744['callDirection']===_0xc7e6('0x49')?![]:!![],'phonecall_activity_parties':_0x5ceb82},getCustomFields(_0x502dd0[_0xc7e6('0x46')],_0x11eab5,_0x502dd0[_0xc7e6('0x3f')])),'headers':{'Authorization':_0xc7e6('0x18')+_0x4f5e8e,'OData-Version':_0xc7e6('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0xc63247);})[_0xc7e6('0x12')](function(_0x557f0a){var _0x4fd233=_0x557f0a[_0xc7e6('0x2c')][_0xc7e6('0x2d')];var _0x215139=_0x4fd233['substring'](_0x4fd233[_0xc7e6('0x2f')]('(')+0x1,_0x4fd233[_0xc7e6('0x2f')](')'));_0x244744[_0xc7e6('0x4b')]=_0x215139;_0xe8ef85(_0x244744);})['catch'](function(_0x107a81){_0x2e66e4(_0x107a81['message']);});});}function emit(_0xfbd8ba,_0x4c330c,_0x202ccf,_0x2a0594){var _0x1c467e={'uri':util[_0xc7e6('0x4c')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xfbd8ba,_0x202ccf,_0x2a0594)};io['to'](util[_0xc7e6('0x4c')](_0xc7e6('0x4d'),_0x4c330c))[_0xc7e6('0x4e')](_0xc7e6('0x4f'),_0x1c467e);}exports['cs']=function(_0x31dc21,_0x584765,_0x405069,_0x2b009e,_0x291d4c,_0xc895dc,_0x48e0ff,_0x3dec5d){var _0xde8df0={};_0xc895dc[_0xc7e6('0xa')]=_0xc895dc[_0xc7e6('0x9')]?intUtil[_0xc7e6('0x50')](_0xc895dc[_0xc7e6('0xb')][_0xc7e6('0xc')]):intUtil[_0xc7e6('0x50')](_0xc895dc[_0xc7e6('0xa')]);_0xc895dc[_0xc7e6('0x51')]=intUtil[_0xc7e6('0x50')](_0xc895dc[_0xc7e6('0x51')]);_0xde8df0[_0xc7e6('0x48')]=_0x3dec5d===_0xc7e6('0x49')||_0x3dec5d===_0xc7e6('0x52')?_0xc7e6('0x49'):'outbound';var _0x201313=_0xc895dc[_0xc7e6('0x9')]?util[_0xc7e6('0x4c')](_0xc7e6('0x53'),_0xc895dc[_0xc7e6('0xb')][_0xc7e6('0xc')]):util[_0xc7e6('0x4c')]('%s/api/data/v9.0/',_0xc895dc[_0xc7e6('0xa')]);var _0x4f3e60=util[_0xc7e6('0x4c')]('https://login.microsoftonline.com/%s/oauth2/token',_0xc895dc[_0xc7e6('0x54')]);var _0x34bc69=util[_0xc7e6('0x4c')](_0xc7e6('0x55'),_0xc895dc[_0xc7e6('0x51')],_0x584765['uniqueid'],md5(_0x584765[_0xc7e6('0x56')]));if(_0x291d4c&&_0x291d4c['monitor_format']){logger['info'](_0xc7e6('0x57'),'Recording\x20is\x20enabled!');_0x584765[_0xc7e6('0x58')]=_0x34bc69;}else if(_0x48e0ff&&_0x48e0ff[_0xc7e6('0x59')]&&_0x48e0ff['recordingFormat']!==_0xc7e6('0x5a')){logger[_0xc7e6('0x21')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x584765['recordingURL']=_0x34bc69;}else{_0x584765[_0xc7e6('0x58')]='';}return getUser(_0xde8df0,_0xc895dc,_0x2b009e,_0x4f3e60,_0x201313,_0x3dec5d)[_0xc7e6('0x12')](function(_0x1bafe0){logger[_0xc7e6('0x21')]('['+_0x3dec5d[_0xc7e6('0x15')]()+']\x20The\x20User\x20ID\x20is:',_0x1bafe0['userId']);logger[_0xc7e6('0x21')]('['+_0x3dec5d[_0xc7e6('0x15')]()+_0xc7e6('0x5b'),_0x1bafe0[_0xc7e6('0x24')]);return getEndUser(_0x1bafe0,_0xc895dc,_0x4f3e60,_0x201313,_0x584765,_0x3dec5d,_0x405069['moduleCreate'],_0x405069['additionalSearchContact']);})['then'](function(_0x166588){logger[_0xc7e6('0x21')]('['+_0x3dec5d[_0xc7e6('0x15')]()+_0xc7e6('0x5c'),_0x166588[_0xc7e6('0x30')]);logger['info']('['+_0x3dec5d[_0xc7e6('0x15')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x584765[_0xc7e6('0x28')]);return getTicket(_0x166588,_0xc895dc,_0x4f3e60,_0x201313,_0x584765,_0x405069,_0x3dec5d);})[_0xc7e6('0x12')](function(_0x9dd7b6){logger[_0xc7e6('0x21')](util[_0xc7e6('0x4c')]('['+_0x3dec5d[_0xc7e6('0x15')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x405069[_0xc7e6('0x3f')],_0x9dd7b6[_0xc7e6('0x4b')]));logger['info'](util['format']('['+_0x3dec5d[_0xc7e6('0x15')]()+_0xc7e6('0x5d'),_0x3dec5d));if(_0x3dec5d!=='unmanaged'&&_0x405069[_0xc7e6('0x5e')]){logger[_0xc7e6('0x21')]('['+_0x3dec5d[_0xc7e6('0x15')]()+']',_0xc7e6('0x5f'));emit(_0xc895dc[_0xc7e6('0xa')],_0x2b009e['name'],_0x405069[_0xc7e6('0x3f')],_0x9dd7b6[_0xc7e6('0x4b')]);}})['catch'](function(_0x2c3543){logger[_0xc7e6('0x60')]('['+_0x3dec5d[_0xc7e6('0x15')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x2c3543[_0xc7e6('0x16')]);console[_0xc7e6('0x60')](_0xc7e6('0x61'),_0x2c3543);});}; \ 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 d2cc4f2..f04f968 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 _0x2f75=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','lastevent','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','content','idField','push','variableName','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','unmanaged','toUpperCase'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x2f75,0xba));var _0x52f7=function(_0x41d6dd,_0x2b3b8e){_0x41d6dd=_0x41d6dd-0x0;var _0x5c6146=_0x2f75[_0x41d6dd];return _0x5c6146;};'use strict';var _=require(_0x52f7('0x0'));var rp=require(_0x52f7('0x1'));var md5=require(_0x52f7('0x2'));var util=require(_0x52f7('0x3'));var Redis=require(_0x52f7('0x4'));var intUtil=require(_0x52f7('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x52f7('0x6'));config[_0x52f7('0x7')]=_[_0x52f7('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x52f7('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x52f7('0xa'),'Accept':'application/json'};function emit(_0xd49c93,_0x1f3ea9,_0x317170){io['to'](_0xd49c93)[_0x52f7('0xb')](_0x1f3ea9,_0x317170);}function getTicket(_0xf90ca5,_0x4fddb5,_0x5ae49c,_0x1bc90a,_0x391f64){logger[_0x52f7('0xc')](_0x52f7('0xd'));var _0x4595df=_['merge']({'responder_id':_0x4fddb5['id'],'requester_id':_0x5ae49c['id'],'name':util[_0x52f7('0xe')](_0x52f7('0xf'),_0x391f64[_0x52f7('0x10')]),'phone':_0x391f64[_0x52f7('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x52f7('0x12')](_0x1bc90a[_0x52f7('0x13')],_0x391f64,'\x20'),'description':intUtil[_0x52f7('0x12')](_0x1bc90a[_0x52f7('0x14')],_0x391f64,_0x52f7('0x15')),'tags':getTags(_0x1bc90a[_0x52f7('0x16')],_0x52f7('0x17'))},getCustomFields(_0x1bc90a[_0x52f7('0x18')],_0x391f64));_0x4595df[_0x52f7('0x19')]=_['mapValues'](_[_0x52f7('0x1a')](_0x4595df[_0x52f7('0x19')],'id'),_0x52f7('0x1b'));return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x1c'),_0xf90ca5[_0x52f7('0x1d')]),'method':_0x52f7('0x1e'),'body':_0x4595df})[_0x52f7('0x1f')](function(_0x340219){logger[_0x52f7('0xc')](_0x52f7('0x20'));return _0x340219;});}function getUser(_0x4c6693,_0x27a7df){if(intUtil[_0x52f7('0x21')](_0x27a7df)){return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x22'),_0x4c6693[_0x52f7('0x1d')]),'qs':{'email':_0x27a7df}})[_0x52f7('0x1f')](function(_0x347738){if(_0x347738[_0x52f7('0x23')]){logger[_0x52f7('0xc')](_0x52f7('0x24'));return _[_0x52f7('0x25')](_0x347738,function(_0x9d7b62){return _0x9d7b62['contact'][_0x52f7('0x26')]===_0x27a7df;});}else{logger[_0x52f7('0xc')](_0x52f7('0x27'));return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x28'),_0x4c6693[_0x52f7('0x1d')])})[_0x52f7('0x1f')](function(_0x3af519){logger[_0x52f7('0xc')](_0x52f7('0x29'));return _0x3af519;});}});}else{logger[_0x52f7('0xc')](_0x52f7('0x2a'));return request({'uri':util['format'](_0x52f7('0x28'),_0x4c6693[_0x52f7('0x1d')])})[_0x52f7('0x1f')](function(_0x20a666){logger[_0x52f7('0xc')](_0x52f7('0x29'));return _0x20a666;});}}function getEndUser(_0x4a3af9,_0x43a0ba,_0x469e4e){logger['info'](_0x52f7('0x2b'),_0x469e4e);return request({'uri':util[_0x52f7('0xe')](_0x52f7('0x2c'),_0x4a3af9[_0x52f7('0x1d')]),'qs':{'phone':_0x469e4e}})[_0x52f7('0x1f')](function(_0xf5ecc2){if(_0xf5ecc2[_0x52f7('0x23')]){logger[_0x52f7('0xc')](_0x52f7('0x2d'));return _['find'](_0xf5ecc2,{'phone':_0x469e4e});}else{logger[_0x52f7('0xc')](_0x52f7('0x2e'));return request({'uri':util['format'](_0x52f7('0x2c'),_0x4a3af9[_0x52f7('0x1d')]),'method':_0x52f7('0x1e'),'body':{'name':_0x43a0ba,'phone':_0x469e4e}})[_0x52f7('0x1f')](function(_0x5592ef){logger[_0x52f7('0xc')](_0x52f7('0x2f'));return _0x5592ef;});}});}function getAuth(_0x49805a){return util[_0x52f7('0xe')]('Basic\x20%s',new Buffer(_0x49805a[_0x52f7('0x30')]+':X')[_0x52f7('0x31')]('base64'));}function request(_0x50069c){logger['debug']('[HTTP]',JSON[_0x52f7('0x32')](_0x50069c));return rp(_[_0x52f7('0x8')](_0x50069c,{'method':_0x52f7('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x2cf4a1,_0x48c512){var _0x2a285=[];if(_0x2cf4a1&&_0x2cf4a1[_0x52f7('0x23')]>0x0){_0x2a285=_[_0x52f7('0x34')](_0x2cf4a1,_0x48c512);}return _0x2a285;}function getCustomFields(_0x4dd68d,_0x34ac48){var _0x2e095b=[];var _0x2c5778={'custom_fields':[]};if(_0x4dd68d[_0x52f7('0x23')]>0x0){_[_0x52f7('0x35')](_0x4dd68d,function(_0x13b9c7){if(_[_0x52f7('0x36')]([_0x52f7('0x37'),_0x52f7('0x38')],_0x13b9c7[_0x52f7('0x39')])&&_0x13b9c7[_0x52f7('0x3a')]&&!_0x13b9c7[_0x52f7('0x3b')]){_0x2c5778[_0x13b9c7['nameField']['toLowerCase']()]=_0x13b9c7[_0x52f7('0x3c')]['toString']();}else if(_[_0x52f7('0x36')](['string','picklist'],_0x13b9c7['type'])&&_0x13b9c7[_0x52f7('0x3d')]&&_0x13b9c7['customField']){_0x2c5778[_0x52f7('0x19')][_0x52f7('0x3e')]({'id':_0x13b9c7[_0x52f7('0x3d')],'value':_0x13b9c7['content'][_0x52f7('0x31')]()});}else if(_0x13b9c7[_0x52f7('0x39')]==='variable'&&_0x13b9c7[_0x52f7('0x3f')]&&_0x13b9c7['idField']&&_0x13b9c7['customField']){_0x34ac48[_0x13b9c7['variableName']]&&_0x2c5778['custom_fields']['push']({'id':_0x13b9c7['idField'],'value':_0x34ac48[_0x13b9c7[_0x52f7('0x3f')]][_0x52f7('0x31')]()});}else if(_0x13b9c7['type']===_0x52f7('0x40')&&_0x13b9c7[_0x52f7('0x41')]&&_0x13b9c7[_0x52f7('0x41')][_0x52f7('0x17')]&&_0x13b9c7[_0x52f7('0x3d')]&&_0x13b9c7[_0x52f7('0x3b')]){_0x34ac48[_0x13b9c7[_0x52f7('0x41')][_0x52f7('0x17')][_0x52f7('0x42')]()]&&_0x2c5778[_0x52f7('0x19')][_0x52f7('0x3e')]({'id':_0x13b9c7[_0x52f7('0x3d')],'value':_0x34ac48[_0x13b9c7[_0x52f7('0x41')][_0x52f7('0x17')][_0x52f7('0x42')]()][_0x52f7('0x31')]()});}});}return _0x2c5778;}exports[_0x52f7('0x43')]=function(_0x576ed5,_0x512cc5,_0x91c6fc,_0x26040c,_0x43ad7d,_0x19b3d8){var _0x5c780e,_0x1d3956;_0x19b3d8[_0x52f7('0x1d')]=intUtil[_0x52f7('0x44')](_0x19b3d8[_0x52f7('0x1d')]);_0x19b3d8[_0x52f7('0x45')]=intUtil[_0x52f7('0x44')](_0x19b3d8[_0x52f7('0x45')]);if(_0x43ad7d&&_0x43ad7d[_0x52f7('0x46')]){logger['info']('[QUEUE]',_0x52f7('0x47'));_0x512cc5[_0x52f7('0x48')]=util[_0x52f7('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x19b3d8[_0x52f7('0x45')],_0x512cc5[_0x52f7('0x49')],md5(_0x512cc5[_0x52f7('0x49')]));}else{_0x512cc5[_0x52f7('0x48')]='';}headers[_0x52f7('0x4a')]=getAuth(_0x19b3d8);return getUser(_0x19b3d8,_0x26040c[_0x52f7('0x26')])[_0x52f7('0x1f')](function(_0x55e88e){_0x5c780e=_0x55e88e;logger[_0x52f7('0xc')](_0x52f7('0x4b'),_0x5c780e['id']);return getEndUser(_0x19b3d8,_0x512cc5[_0x52f7('0x10')],_0x512cc5[_0x52f7('0x11')]);})[_0x52f7('0x1f')](function(_0x101df6){_0x1d3956=_0x101df6;logger[_0x52f7('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1d3956['id']);return getTicket(_0x19b3d8,_0x5c780e,_0x1d3956,_0x91c6fc,_0x512cc5);})[_0x52f7('0x1f')](function(_0x511f23){if(_0x511f23&&_0x511f23['id']){logger[_0x52f7('0xc')]('Ticket\x20created!');logger[_0x52f7('0xc')](_0x52f7('0x4c'),_0x511f23['id']);logger[_0x52f7('0xc')](_0x52f7('0x4d'),_0x52f7('0x4e'));emit(util[_0x52f7('0xe')](_0x52f7('0x4f'),_0x26040c['name']),_0x52f7('0x50'),{'uri':util['format'](_0x52f7('0x51'),_0x19b3d8[_0x52f7('0x1d')],_0x511f23['id'])});}})[_0x52f7('0x52')](function(_0x471ba3){logger['error'](_0x52f7('0x4d'),JSON[_0x52f7('0x32')](_0x471ba3));});};exports[_0x52f7('0x53')]=function(_0x3aa42e,_0x5160dc,_0x4082ab,_0x193c4a,_0x7ade,_0x9c25e3,_0x2b1c66){var _0x584e25,_0x39c9e7;_0x9c25e3[_0x52f7('0x1d')]=intUtil['stripTrailingSlash'](_0x9c25e3[_0x52f7('0x1d')]);_0x9c25e3[_0x52f7('0x45')]=intUtil['stripTrailingSlash'](_0x9c25e3[_0x52f7('0x45')]);if(_0x2b1c66&&_0x2b1c66['recordingFormat']&&_0x2b1c66['recordingFormat']!==_0x52f7('0x54')){logger[_0x52f7('0xc')](_0x52f7('0x55'),_0x52f7('0x47'));_0x5160dc['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x9c25e3[_0x52f7('0x45')],_0x5160dc['uniqueid'],md5(_0x5160dc[_0x52f7('0x49')]));}headers[_0x52f7('0x4a')]=getAuth(_0x9c25e3);return getUser(_0x9c25e3,_0x193c4a[_0x52f7('0x26')])[_0x52f7('0x1f')](function(_0x4535db){_0x584e25=_0x4535db;logger[_0x52f7('0xc')]('The\x20User\x20ID\x20is:',_0x584e25['id']);return getEndUser(_0x9c25e3,_0x5160dc[_0x52f7('0x56')],_0x5160dc['destcalleridnum']);})[_0x52f7('0x1f')](function(_0xc0c0d6){_0x39c9e7=_0xc0c0d6;logger['info'](_0x52f7('0x57'),_0x39c9e7['id']);return getTicket(_0x9c25e3,_0x584e25,_0x39c9e7,_0x4082ab,_0x5160dc);})['then'](function(_0x1b6093){if(_0x1b6093&&_0x1b6093['id']){logger[_0x52f7('0xc')]('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x1b6093['id']);logger[_0x52f7('0xc')](_0x52f7('0x55'),_0x52f7('0x4e'));emit(util[_0x52f7('0xe')]('user:%s',_0x193c4a[_0x52f7('0x17')]),_0x52f7('0x50'),{'uri':util[_0x52f7('0xe')]('%s/helpdesk/tickets/%d',_0x9c25e3['remoteUri'],_0x1b6093['id'])});}})[_0x52f7('0x52')](function(_0x2d1cdb){logger['error'](_0x52f7('0x55'),JSON[_0x52f7('0x32')](_0x2d1cdb));});};exports[_0x52f7('0x58')]=function(_0x1bdebf,_0x32e943,_0x4e606e,_0x56cafb,_0x119571,_0x16f491){var _0x29f2d2,_0x4b9043;_0x16f491['remoteUri']=intUtil[_0x52f7('0x44')](_0x16f491[_0x52f7('0x1d')]);_0x16f491[_0x52f7('0x45')]=intUtil[_0x52f7('0x44')](_0x16f491['serverUrl']);if(_0x119571&&_0x119571[_0x52f7('0x46')]){logger[_0x52f7('0xc')]('['+_0x32e943['lastevent'][_0x52f7('0x59')]()+']',_0x52f7('0x47'));_0x32e943[_0x52f7('0x48')]=util[_0x52f7('0xe')](_0x52f7('0x5a'),_0x16f491[_0x52f7('0x45')],_0x32e943[_0x52f7('0x49')],md5(_0x32e943['uniqueid']));}else{_0x32e943[_0x52f7('0x48')]='';}headers[_0x52f7('0x4a')]=getAuth(_0x16f491);return getUser(_0x16f491,'')['then'](function(_0x40b441){_0x29f2d2=_0x40b441;logger['info'](_0x52f7('0x4b'),_0x29f2d2['id']);return getEndUser(_0x16f491,_0x32e943[_0x52f7('0x10')],_0x32e943['calleridnum']);})['then'](function(_0x4bd3d3){_0x4b9043=_0x4bd3d3;logger[_0x52f7('0xc')](_0x52f7('0x57'),_0x4b9043['id']);return getTicket(_0x16f491,_0x29f2d2,_0x4b9043,_0x4e606e,_0x32e943);})['then'](function(_0x62b0f5){if(_0x62b0f5){logger[_0x52f7('0xc')](_0x52f7('0x20'));logger[_0x52f7('0xc')]('The\x20Ticket\x20ID\x20is:',_0x62b0f5['id']);}})[_0x52f7('0x52')](function(_0x37442e){logger['error']('['+_0x32e943[_0x52f7('0x5b')][_0x52f7('0x59')]()+']',JSON[_0x52f7('0x32')](_0x37442e));});}; \ No newline at end of file +var _0x5b01=['defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','%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.','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','GET','map','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','[OUTBOUND]','unmanaged','toUpperCase','lastevent','lodash','request-promise','md5','util','ioredis','./util','freshdesk','redis'];(function(_0x1c4409,_0x3b2e8f){var _0x356d8f=function(_0xae43bf){while(--_0xae43bf){_0x1c4409['push'](_0x1c4409['shift']());}};_0x356d8f(++_0x3b2e8f);}(_0x5b01,0x178));var _0x15b0=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x5b01[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x15b0('0x0'));var rp=require(_0x15b0('0x1'));var md5=require(_0x15b0('0x2'));var util=require(_0x15b0('0x3'));var Redis=require(_0x15b0('0x4'));var intUtil=require(_0x15b0('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x15b0('0x6'));config[_0x15b0('0x7')]=_[_0x15b0('0x8')](config[_0x15b0('0x7')],{'host':_0x15b0('0x9'),'port':0x18eb});var io=require(_0x15b0('0xa'))(new Redis(config[_0x15b0('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x424e9d,_0x475266,_0x1b7591){io['to'](_0x424e9d)[_0x15b0('0xb')](_0x475266,_0x1b7591);}function getTicket(_0x52a9af,_0x44c694,_0x598a32,_0x1a4bf6,_0x2b3938){logger[_0x15b0('0xc')](_0x15b0('0xd'));var _0x420fc6=_[_0x15b0('0xe')]({'responder_id':_0x44c694['id'],'requester_id':_0x598a32['id'],'name':util[_0x15b0('0xf')](_0x15b0('0x10'),_0x2b3938[_0x15b0('0x11')]),'phone':_0x2b3938['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x15b0('0x12')](_0x1a4bf6[_0x15b0('0x13')],_0x2b3938,'\x20'),'description':intUtil[_0x15b0('0x12')](_0x1a4bf6[_0x15b0('0x14')],_0x2b3938,_0x15b0('0x15')),'tags':getTags(_0x1a4bf6[_0x15b0('0x16')],'name')},getCustomFields(_0x1a4bf6[_0x15b0('0x17')],_0x2b3938));_0x420fc6[_0x15b0('0x18')]=_[_0x15b0('0x19')](_[_0x15b0('0x1a')](_0x420fc6[_0x15b0('0x18')],'id'),_0x15b0('0x1b'));return request({'uri':util[_0x15b0('0xf')](_0x15b0('0x1c'),_0x52a9af[_0x15b0('0x1d')]),'method':_0x15b0('0x1e'),'body':_0x420fc6})[_0x15b0('0x1f')](function(_0x5b0c43){logger[_0x15b0('0xc')]('Ticket\x20created!');return _0x5b0c43;});}function getUser(_0x6de32f,_0x1b3b5a){if(intUtil['validateEmail'](_0x1b3b5a)){return request({'uri':util[_0x15b0('0xf')](_0x15b0('0x20'),_0x6de32f[_0x15b0('0x1d')]),'qs':{'email':_0x1b3b5a}})[_0x15b0('0x1f')](function(_0x5493e9){if(_0x5493e9[_0x15b0('0x21')]){logger[_0x15b0('0xc')](_0x15b0('0x22'));return _[_0x15b0('0x23')](_0x5493e9,function(_0x51176b){return _0x51176b[_0x15b0('0x24')][_0x15b0('0x25')]===_0x1b3b5a;});}else{logger[_0x15b0('0xc')](_0x15b0('0x26'));return request({'uri':util['format'](_0x15b0('0x27'),_0x6de32f[_0x15b0('0x1d')])})[_0x15b0('0x1f')](function(_0xcd86ee){logger['info'](_0x15b0('0x28'));return _0xcd86ee;});}});}else{logger[_0x15b0('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x15b0('0x27'),_0x6de32f[_0x15b0('0x1d')])})[_0x15b0('0x1f')](function(_0x212ea4){logger[_0x15b0('0xc')](_0x15b0('0x28'));return _0x212ea4;});}}function getEndUser(_0x30efa1,_0x859296,_0x425cd8){logger[_0x15b0('0xc')](_0x15b0('0x29'),_0x425cd8);return request({'uri':util[_0x15b0('0xf')]('%s/api/v2/contacts',_0x30efa1['remoteUri']),'qs':{'phone':_0x425cd8}})[_0x15b0('0x1f')](function(_0x3ad8e9){if(_0x3ad8e9[_0x15b0('0x21')]){logger[_0x15b0('0xc')](_0x15b0('0x2a'));return _[_0x15b0('0x23')](_0x3ad8e9,{'phone':_0x425cd8});}else{logger[_0x15b0('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x15b0('0x2b'),_0x30efa1[_0x15b0('0x1d')]),'method':_0x15b0('0x1e'),'body':{'name':_0x859296,'phone':_0x425cd8}})[_0x15b0('0x1f')](function(_0x36b891){logger[_0x15b0('0xc')](_0x15b0('0x2c'));return _0x36b891;});}});}function getAuth(_0x37e7c1){return util[_0x15b0('0xf')](_0x15b0('0x2d'),new Buffer(_0x37e7c1[_0x15b0('0x2e')]+':X')[_0x15b0('0x2f')](_0x15b0('0x30')));}function request(_0x1326da){logger[_0x15b0('0x31')](_0x15b0('0x32'),JSON['stringify'](_0x1326da));return rp(_['defaults'](_0x1326da,{'method':_0x15b0('0x33'),'headers':headers,'json':!![]}));}function getTags(_0x40d566,_0x39ae06){var _0x2f5c07=[];if(_0x40d566&&_0x40d566['length']>0x0){_0x2f5c07=_[_0x15b0('0x34')](_0x40d566,_0x39ae06);}return _0x2f5c07;}function getCustomFields(_0x43c894,_0x51fab1){var _0x5d479d=[];var _0x55060c={'custom_fields':[]};if(_0x43c894['length']>0x0){_['forEach'](_0x43c894,function(_0x1859d4){if(_[_0x15b0('0x35')]([_0x15b0('0x36'),_0x15b0('0x37')],_0x1859d4[_0x15b0('0x38')])&&_0x1859d4[_0x15b0('0x39')]&&!_0x1859d4[_0x15b0('0x3a')]){_0x55060c[_0x1859d4[_0x15b0('0x39')][_0x15b0('0x3b')]()]=_0x1859d4[_0x15b0('0x3c')][_0x15b0('0x2f')]();}else if(_[_0x15b0('0x35')]([_0x15b0('0x36'),_0x15b0('0x37')],_0x1859d4['type'])&&_0x1859d4[_0x15b0('0x3d')]&&_0x1859d4[_0x15b0('0x3a')]){_0x55060c['custom_fields'][_0x15b0('0x3e')]({'id':_0x1859d4[_0x15b0('0x3d')],'value':_0x1859d4[_0x15b0('0x3c')]['toString']()});}else if(_0x1859d4['type']==='variable'&&_0x1859d4[_0x15b0('0x3f')]&&_0x1859d4[_0x15b0('0x3d')]&&_0x1859d4[_0x15b0('0x3a')]){_0x51fab1[_0x1859d4['variableName']]&&_0x55060c[_0x15b0('0x18')]['push']({'id':_0x1859d4['idField'],'value':_0x51fab1[_0x1859d4[_0x15b0('0x3f')]][_0x15b0('0x2f')]()});}else if(_0x1859d4[_0x15b0('0x38')]===_0x15b0('0x40')&&_0x1859d4[_0x15b0('0x41')]&&_0x1859d4[_0x15b0('0x41')][_0x15b0('0x42')]&&_0x1859d4['idField']&&_0x1859d4[_0x15b0('0x3a')]){_0x51fab1[_0x1859d4[_0x15b0('0x41')]['name']['toLowerCase']()]&&_0x55060c[_0x15b0('0x18')][_0x15b0('0x3e')]({'id':_0x1859d4['idField'],'value':_0x51fab1[_0x1859d4[_0x15b0('0x41')][_0x15b0('0x42')][_0x15b0('0x3b')]()]['toString']()});}});}return _0x55060c;}exports[_0x15b0('0x43')]=function(_0x1c778f,_0x5be267,_0x2b88fa,_0x2b1a57,_0x34861a,_0x52f72e){var _0x24b837,_0x32f463;_0x52f72e['remoteUri']=intUtil[_0x15b0('0x44')](_0x52f72e[_0x15b0('0x1d')]);_0x52f72e[_0x15b0('0x45')]=intUtil['stripTrailingSlash'](_0x52f72e[_0x15b0('0x45')]);if(_0x34861a&&_0x34861a[_0x15b0('0x46')]){logger[_0x15b0('0xc')]('[QUEUE]',_0x15b0('0x47'));_0x5be267[_0x15b0('0x48')]=util[_0x15b0('0xf')](_0x15b0('0x49'),_0x52f72e[_0x15b0('0x45')],_0x5be267[_0x15b0('0x4a')],md5(_0x5be267[_0x15b0('0x4a')]));}else{_0x5be267[_0x15b0('0x48')]='';}headers[_0x15b0('0x4b')]=getAuth(_0x52f72e);return getUser(_0x52f72e,_0x2b1a57[_0x15b0('0x25')])[_0x15b0('0x1f')](function(_0x44ebfe){_0x24b837=_0x44ebfe;logger[_0x15b0('0xc')]('The\x20User\x20ID\x20is:',_0x24b837['id']);return getEndUser(_0x52f72e,_0x5be267[_0x15b0('0x11')],_0x5be267['calleridnum']);})[_0x15b0('0x1f')](function(_0x3a2697){_0x32f463=_0x3a2697;logger[_0x15b0('0xc')]('The\x20Enduser\x20ID\x20is:',_0x32f463['id']);return getTicket(_0x52f72e,_0x24b837,_0x32f463,_0x2b88fa,_0x5be267);})['then'](function(_0x34d95d){if(_0x34d95d&&_0x34d95d['id']){logger['info']('Ticket\x20created!');logger[_0x15b0('0xc')](_0x15b0('0x4c'),_0x34d95d['id']);logger[_0x15b0('0xc')](_0x15b0('0x4d'),_0x15b0('0x4e'));emit(util[_0x15b0('0xf')](_0x15b0('0x4f'),_0x2b1a57[_0x15b0('0x42')]),_0x15b0('0x50'),{'uri':util['format'](_0x15b0('0x51'),_0x52f72e[_0x15b0('0x1d')],_0x34d95d['id'])});}})[_0x15b0('0x52')](function(_0x189b93){logger[_0x15b0('0x53')](_0x15b0('0x4d'),JSON[_0x15b0('0x54')](_0x189b93));});};exports[_0x15b0('0x55')]=function(_0x4b2f49,_0x215526,_0x3c8ed0,_0x5d8bc5,_0x3f3e4e,_0x2222ed,_0xf5a3a4){var _0x21d2a1,_0x2f499c;_0x2222ed[_0x15b0('0x1d')]=intUtil[_0x15b0('0x44')](_0x2222ed[_0x15b0('0x1d')]);_0x2222ed[_0x15b0('0x45')]=intUtil[_0x15b0('0x44')](_0x2222ed[_0x15b0('0x45')]);if(_0xf5a3a4&&_0xf5a3a4['recordingFormat']&&_0xf5a3a4['recordingFormat']!==_0x15b0('0x56')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x215526[_0x15b0('0x48')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2222ed[_0x15b0('0x45')],_0x215526['uniqueid'],md5(_0x215526[_0x15b0('0x4a')]));}headers[_0x15b0('0x4b')]=getAuth(_0x2222ed);return getUser(_0x2222ed,_0x5d8bc5['email'])[_0x15b0('0x1f')](function(_0x4c9ebb){_0x21d2a1=_0x4c9ebb;logger['info'](_0x15b0('0x57'),_0x21d2a1['id']);return getEndUser(_0x2222ed,_0x215526[_0x15b0('0x58')],_0x215526[_0x15b0('0x59')]);})[_0x15b0('0x1f')](function(_0x1161f7){_0x2f499c=_0x1161f7;logger[_0x15b0('0xc')](_0x15b0('0x5a'),_0x2f499c['id']);return getTicket(_0x2222ed,_0x21d2a1,_0x2f499c,_0x3c8ed0,_0x215526);})[_0x15b0('0x1f')](function(_0x1b389c){if(_0x1b389c&&_0x1b389c['id']){logger[_0x15b0('0xc')](_0x15b0('0x5b'));logger[_0x15b0('0xc')](_0x15b0('0x4c'),_0x1b389c['id']);logger['info'](_0x15b0('0x5c'),_0x15b0('0x4e'));emit(util[_0x15b0('0xf')](_0x15b0('0x4f'),_0x5d8bc5['name']),_0x15b0('0x50'),{'uri':util['format'](_0x15b0('0x51'),_0x2222ed['remoteUri'],_0x1b389c['id'])});}})[_0x15b0('0x52')](function(_0x83bb99){logger[_0x15b0('0x53')](_0x15b0('0x5c'),JSON[_0x15b0('0x54')](_0x83bb99));});};exports[_0x15b0('0x5d')]=function(_0x16f68c,_0x45c721,_0x10d760,_0xb06678,_0x2a9fd8,_0x5783cb){var _0x13281b,_0x3053c3;_0x5783cb['remoteUri']=intUtil[_0x15b0('0x44')](_0x5783cb[_0x15b0('0x1d')]);_0x5783cb['serverUrl']=intUtil[_0x15b0('0x44')](_0x5783cb[_0x15b0('0x45')]);if(_0x2a9fd8&&_0x2a9fd8[_0x15b0('0x46')]){logger[_0x15b0('0xc')]('['+_0x45c721['lastevent'][_0x15b0('0x5e')]()+']',_0x15b0('0x47'));_0x45c721[_0x15b0('0x48')]=util[_0x15b0('0xf')](_0x15b0('0x49'),_0x5783cb[_0x15b0('0x45')],_0x45c721[_0x15b0('0x4a')],md5(_0x45c721[_0x15b0('0x4a')]));}else{_0x45c721[_0x15b0('0x48')]='';}headers['Authorization']=getAuth(_0x5783cb);return getUser(_0x5783cb,'')[_0x15b0('0x1f')](function(_0x20fe83){_0x13281b=_0x20fe83;logger[_0x15b0('0xc')](_0x15b0('0x57'),_0x13281b['id']);return getEndUser(_0x5783cb,_0x45c721[_0x15b0('0x11')],_0x45c721['calleridnum']);})[_0x15b0('0x1f')](function(_0x37ebce){_0x3053c3=_0x37ebce;logger[_0x15b0('0xc')](_0x15b0('0x5a'),_0x3053c3['id']);return getTicket(_0x5783cb,_0x13281b,_0x3053c3,_0x10d760,_0x45c721);})[_0x15b0('0x1f')](function(_0x4ca93){if(_0x4ca93){logger[_0x15b0('0xc')](_0x15b0('0x5b'));logger['info'](_0x15b0('0x4c'),_0x4ca93['id']);}})[_0x15b0('0x52')](function(_0x342245){logger[_0x15b0('0x53')]('['+_0x45c721[_0x15b0('0x5f')][_0x15b0('0x5e')]()+']',JSON[_0x15b0('0x54')](_0x342245));});}; \ 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 31ae3e2..f18f886 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 _0x1b72=['Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','Task\x20created:','toUpperCase','/contacts/','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','name','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/logger','freshsales','localhost','socket.io-emitter','GET','/api/selector/owners','headers','info','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','userEmail','userId','User\x20found:','Admin\x20selected','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:'];(function(_0x50ea6f,_0x39bf1e){var _0x5c52b7=function(_0x26158b){while(--_0x26158b){_0x50ea6f['push'](_0x50ea6f['shift']());}};_0x5c52b7(++_0x39bf1e);}(_0x1b72,0x129));var _0x21b7=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x1b72[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x21b7('0x0'));var rp=require(_0x21b7('0x1'));var md5=require(_0x21b7('0x2'));var util=require(_0x21b7('0x3'));var moment=require(_0x21b7('0x4'));var Promise=require('bluebird');var Redis=require(_0x21b7('0x5'));var intUtil=require(_0x21b7('0x6'));var config=require('../../../../config/environment');var logger=require(_0x21b7('0x7'))(_0x21b7('0x8'));config['redis']=_['defaults'](config['redis'],{'host':_0x21b7('0x9'),'port':0x18eb});var io=require(_0x21b7('0xa'))(new Redis(config['redis']));function getAdminId(_0x2b0ff7,_0x6677d8,_0x2742e0,_0x47af48){return new Promise(function(_0x3fbd9a,_0x3d1404){var _0x49f04c=![];var _0x5e60c8={'method':_0x21b7('0xb'),'uri':_0x47af48+_0x21b7('0xc'),'json':!![]};_0x5e60c8[_0x21b7('0xd')]=_0x2742e0;logger[_0x21b7('0xe')]('Getting\x20admin\x20information');return rp(_0x5e60c8)[_0x21b7('0xf')](function(_0x3a5ba7){if(_0x3a5ba7){var _0x6f2177=_0x3a5ba7[_0x21b7('0x10')];var _0x252996=null;for(_0x252996=0x0;_0x252996<_0x6f2177[_0x21b7('0x11')];_0x252996++){if(_0x6f2177[_0x252996][_0x21b7('0x12')]===_0x2b0ff7[_0x21b7('0x13')]){_0x2b0ff7[_0x21b7('0x14')]=_0x6f2177[_0x252996]['id'];_0x49f04c=!![];}}if(_0x49f04c){logger[_0x21b7('0xe')](_0x21b7('0x15'),_0x2b0ff7[_0x21b7('0x14')]);_0x3fbd9a(_0x2b0ff7);}else{_0x3d1404({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3d1404({'statusCode':0x194,'message':_0x21b7('0x16')});}})[_0x21b7('0x17')](function(_0x5c28c1){logger[_0x21b7('0x18')]('['+[_0x6677d8['toUpperCase']()]+']',_0x5c28c1[_0x21b7('0x19')]);_0x3d1404(_0x5c28c1);});});}function getUser(_0x517b3f,_0x3c248f,_0x428fa7){return function(_0x429721){return new Promise(function(_0x59954f,_0x49e67b){var _0x56e5b1={'method':_0x21b7('0xb'),'uri':_0x428fa7+_0x21b7('0xc'),'json':!![]};_0x56e5b1['headers']=_0x3c248f;logger[_0x21b7('0xe')](_0x21b7('0x1a'));return rp(_0x56e5b1)[_0x21b7('0xf')](function(_0x274201){if(_0x274201){var _0x3bd5f3=_0x274201[_0x21b7('0x10')];var _0x4f28ec=![];var _0x5dc52d=null;if(_0x429721['agentEmail']!==null){logger[_0x21b7('0xe')](_0x21b7('0x1b'),_0x429721[_0x21b7('0x1c')]);_0x429721[_0x21b7('0x1d')]=_0x429721[_0x21b7('0x1c')];for(_0x5dc52d=0x0;_0x5dc52d<_0x3bd5f3[_0x21b7('0x11')];_0x5dc52d++){if(_0x3bd5f3[_0x5dc52d][_0x21b7('0x12')]===_0x429721[_0x21b7('0x1c')]){_0x4f28ec=!![];_0x429721[_0x21b7('0x1e')]=_0x3bd5f3[_0x5dc52d]['id'];logger[_0x21b7('0xe')](_0x21b7('0x1f'),_0x429721[_0x21b7('0x1e')]);}}}if(!_0x4f28ec){logger[_0x21b7('0xe')](_0x21b7('0x20'));_0x429721[_0x21b7('0x1d')]=_0x429721[_0x21b7('0x13')];_0x429721[_0x21b7('0x1e')]=_0x429721[_0x21b7('0x14')];_0x4f28ec=!![];}if(_0x4f28ec){_0x59954f(_0x429721);}else{_0x49e67b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x49e67b({'statusCode':0x194,'message':_0x21b7('0x16')});}})['catch'](function(_0x124f79){logger[_0x21b7('0x18')]('['+[_0x517b3f['toUpperCase']()]+']',_0x124f79['message']);_0x49e67b(_0x124f79);});});};}function searchContact(_0x2c0a65,_0x41b70f,_0x13865f,_0x3df029){return new Promise(function(_0x10dfea,_0x31a335){var _0x3476b5={'method':_0x21b7('0xb'),'headers':_0x41b70f,'uri':_0x2c0a65+'/api/lookup?q='+_0x3df029+_0x21b7('0x21')+_0x13865f+_0x21b7('0x22'),'json':!![]};rp(_0x3476b5)[_0x21b7('0xf')](function(_0x274638){var _0x47fde9=_[_0x21b7('0x23')](_0x274638[_0x21b7('0x24')][_0x21b7('0x24')],[_0x13865f,_0x3df029]);_0x10dfea(_0x47fde9);})[_0x21b7('0x17')](function(_0x1301a8){_0x31a335(_0x1301a8);});});}function getEndUser(_0x3c0efa,_0x48dbd0,_0x5d0d7d){return function(_0x27de18){return new Promise(function(_0x4454fd,_0x4586df){logger[_0x21b7('0xe')](util['format'](_0x21b7('0x25'),_0x27de18['contactNumber']));searchContact(_0x5d0d7d,_0x48dbd0,'mobile_number',_0x27de18[_0x21b7('0x26')])['then'](function(_0x159a73){if(_0x159a73){_0x27de18['endUserId']=_0x159a73['id'];logger[_0x21b7('0xe')](_0x21b7('0x27'),_0x27de18[_0x21b7('0x28')]);return _0x4454fd(_0x27de18);}searchContact(_0x5d0d7d,_0x48dbd0,_0x21b7('0x29'),_0x27de18[_0x21b7('0x26')])[_0x21b7('0xf')](function(_0x4fcea4){if(_0x4fcea4){_0x27de18[_0x21b7('0x28')]=_0x4fcea4['id'];logger[_0x21b7('0xe')](_0x21b7('0x2a'),_0x27de18[_0x21b7('0x28')]);return _0x4454fd(_0x27de18);}createEndUser(_0x27de18,_0x3c0efa,_0x48dbd0,_0x5d0d7d)[_0x21b7('0xf')](function(_0xcbf309){logger[_0x21b7('0xe')](_0x21b7('0x2b'),_0xcbf309['endUserId']);return _0x4454fd(_0xcbf309);});});})[_0x21b7('0x17')](function(_0x30bc1e){_0x4586df(_0x30bc1e);});});};}function createEndUser(_0x335277,_0x31f0ad,_0x5ae707,_0x30dd6d){return new Promise(function(_0x213d70,_0x5a773c){var _0x53ca40=moment();var _0x58f897={'method':'POST','uri':_0x30dd6d+_0x21b7('0x2c'),'body':{'contact':{'last_name':_0x335277['contactNumber'],'work_number':_0x335277[_0x21b7('0x26')],'mobile_number':_0x335277[_0x21b7('0x26')],'owner_id':_0x335277['userId'],'created_at':_0x53ca40[_0x21b7('0x2d')](_0x21b7('0x2e'))}},'json':!![]};_0x58f897[_0x21b7('0xd')]=_0x5ae707;logger[_0x21b7('0xe')](_0x21b7('0x2f'));return rp(_0x58f897)['then'](function(_0x34b2b8){_0x335277[_0x21b7('0x28')]=_0x34b2b8[_0x21b7('0x30')]['id'];_0x213d70(_0x335277);})['catch'](function(_0x33ae67){logger[_0x21b7('0x18')]('['+[_0x31f0ad['toUpperCase']()]+']',_0x33ae67[_0x21b7('0x19')]);_0x5a773c(_0x33ae67['message']);});});}function getTicket(_0x1eefbb,_0x59c746,_0x8bf7b4,_0x3758c3,_0x1a9fc4){return function(_0x501b6c){logger['info'](_0x21b7('0x31'));return new Promise(function(_0x45ad4b,_0x55f309){var _0x49e156=moment();var _0x5395f8={'method':'POST','uri':_0x8bf7b4+_0x21b7('0x32'),'body':{'title':intUtil[_0x21b7('0x33')](_0x3758c3[_0x21b7('0x34')],_0x1a9fc4,'\x20'),'description':intUtil[_0x21b7('0x33')](_0x3758c3[_0x21b7('0x35')],_0x1a9fc4,'\x0a'),'owner_id':_0x501b6c[_0x21b7('0x1e')],'creater_id':_0x501b6c[_0x21b7('0x14')],'targetable_id':_0x501b6c[_0x21b7('0x28')],'targetable_type':_0x21b7('0x36'),'created_at':_0x49e156[_0x21b7('0x2d')](_0x21b7('0x2e')),'due_date':_0x49e156[_0x21b7('0x37')](0x1e,'m')[_0x21b7('0x2d')](_0x21b7('0x2e'))},'json':!![]};_0x5395f8[_0x21b7('0xd')]=_0x59c746;return rp(_0x5395f8)['then'](function(_0x6b6190){_0x501b6c[_0x21b7('0x38')]=_0x6b6190['task']['id'];logger[_0x21b7('0xe')](_0x21b7('0x39'),_0x501b6c[_0x21b7('0x38')]);_0x45ad4b(_0x501b6c);})[_0x21b7('0x17')](function(_0x13faba){logger['error']('['+[_0x1eefbb[_0x21b7('0x3a')]()]+']',_0x13faba['message']);_0x55f309(_0x13faba[_0x21b7('0x19')]);});});};}function emit(_0x341acd,_0x7e1ac6,_0x2c00b9){var _0x9699af={'uri':_0x341acd+_0x21b7('0x3b')+_0x2c00b9};io['to'](util[_0x21b7('0x2d')]('user:%s',_0x7e1ac6))[_0x21b7('0x3c')]('trigger:browser:url',_0x9699af);}exports['cs']=function(_0x35ec88,_0x313217,_0x3f30fb,_0x523c25,_0x5ec787,_0xd461d,_0x2bc9c2,_0x26227e){var _0x1193a0={};var _0x22ba27={'Authorization':_0x21b7('0x3d')+_0xd461d[_0x21b7('0x3e')]};_0xd461d[_0x21b7('0x3f')]=intUtil[_0x21b7('0x40')](_0xd461d[_0x21b7('0x3f')]);_0xd461d['serverUrl']=intUtil[_0x21b7('0x40')](_0xd461d[_0x21b7('0x41')]);var _0x533666=_0xd461d[_0x21b7('0x3f')];_0x1193a0[_0x21b7('0x13')]=_0xd461d[_0x21b7('0x42')];_0x1193a0['contactNumber']=_0x26227e[_0x21b7('0x43')]()===_0x21b7('0x44')?_0x313217[_0x21b7('0x45')]:_0x313217[_0x21b7('0x46')];_0x1193a0[_0x21b7('0x47')]=_0x26227e===_0x21b7('0x48')||_0x26227e===_0x21b7('0x49')?_0x21b7('0x48'):_0x21b7('0x44');if(_0x523c25){_0x1193a0[_0x21b7('0x1c')]=_0x523c25[_0x21b7('0x12')];}var _0x5aab71=util[_0x21b7('0x2d')](_0x21b7('0x4a'),_0xd461d['serverUrl'],_0x313217[_0x21b7('0x4b')],md5(_0x313217['uniqueid']));if(_0x5ec787&&_0x5ec787['monitor_format']){logger[_0x21b7('0xe')](_0x21b7('0x4c'),_0x21b7('0x4d'));_0x313217[_0x21b7('0x4e')]=_0x5aab71;}else if(_0x2bc9c2&&_0x2bc9c2['recordingFormat']&&_0x2bc9c2[_0x21b7('0x4f')]!==_0x21b7('0x50')){logger[_0x21b7('0xe')](_0x21b7('0x51'),'Recording\x20is\x20enabled!');_0x313217[_0x21b7('0x4e')]=_0x5aab71;}else{_0x313217[_0x21b7('0x4e')]='';}return getAdminId(_0x1193a0,_0x26227e,_0x22ba27,_0x533666)[_0x21b7('0xf')](getUser(_0x26227e,_0x22ba27,_0x533666))['then'](getEndUser(_0x26227e,_0x22ba27,_0x533666))[_0x21b7('0xf')](getTicket(_0x26227e,_0x22ba27,_0x533666,_0x3f30fb,_0x313217))['then'](function(_0x552d25){logger['info'](util['format'](_0x21b7('0x52'),_0x552d25[_0x21b7('0x38')]));if(_0x26227e!=='unmanaged'){logger[_0x21b7('0xe')]('['+[_0x26227e[_0x21b7('0x3a')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x533666,_0x523c25[_0x21b7('0x53')],_0x552d25[_0x21b7('0x28')]);}})[_0x21b7('0x17')](function(_0x1d0ceb){logger[_0x21b7('0x18')]('['+[_0x26227e[_0x21b7('0x3a')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x21b7('0x54')](_0x1d0ceb,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x8912=['Contact','ticketId','Task\x20created:','emit','trigger:browser:url','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%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','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/environment','../../../../config/logger','freshsales','socket.io-emitter','/api/selector/owners','info','Getting\x20admin\x20information','then','users','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','email','userId','User\x20found:','Admin\x20selected','GET','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions'];(function(_0x4e12c8,_0x9538e1){var _0x2465e4=function(_0x3d1a1c){while(--_0x3d1a1c){_0x4e12c8['push'](_0x4e12c8['shift']());}};_0x2465e4(++_0x9538e1);}(_0x8912,0x164));var _0x2891=function(_0x3180c9,_0x45406d){_0x3180c9=_0x3180c9-0x0;var _0x2b0e9c=_0x8912[_0x3180c9];return _0x2b0e9c;};'use strict';var _=require(_0x2891('0x0'));var rp=require(_0x2891('0x1'));var md5=require(_0x2891('0x2'));var util=require(_0x2891('0x3'));var moment=require('moment');var Promise=require(_0x2891('0x4'));var Redis=require(_0x2891('0x5'));var intUtil=require('./util');var config=require(_0x2891('0x6'));var logger=require(_0x2891('0x7'))(_0x2891('0x8'));config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x2891('0x9'))(new Redis(config['redis']));function getAdminId(_0x1a5192,_0x37f67c,_0x14e420,_0xcfd223){return new Promise(function(_0x47e4d2,_0x4b52a0){var _0x35ce14=![];var _0x38d1ed={'method':'GET','uri':_0xcfd223+_0x2891('0xa'),'json':!![]};_0x38d1ed['headers']=_0x14e420;logger[_0x2891('0xb')](_0x2891('0xc'));return rp(_0x38d1ed)[_0x2891('0xd')](function(_0x459a99){if(_0x459a99){var _0x585616=_0x459a99[_0x2891('0xe')];var _0x2fde73=null;for(_0x2fde73=0x0;_0x2fde73<_0x585616[_0x2891('0xf')];_0x2fde73++){if(_0x585616[_0x2fde73]['email']===_0x1a5192[_0x2891('0x10')]){_0x1a5192[_0x2891('0x11')]=_0x585616[_0x2fde73]['id'];_0x35ce14=!![];}}if(_0x35ce14){logger[_0x2891('0xb')](_0x2891('0x12'),_0x1a5192['adminId']);_0x47e4d2(_0x1a5192);}else{_0x4b52a0({'statusCode':0x194,'message':_0x2891('0x13')});}}else{_0x4b52a0({'statusCode':0x194,'message':_0x2891('0x13')});}})[_0x2891('0x14')](function(_0x2becc4){logger[_0x2891('0x15')]('['+[_0x37f67c[_0x2891('0x16')]()]+']',_0x2becc4[_0x2891('0x17')]);_0x4b52a0(_0x2becc4);});});}function getUser(_0x5d4033,_0x1c3b6c,_0x516a63){return function(_0x4a3e22){return new Promise(function(_0x468a32,_0x4e75ea){var _0x216cd6={'method':'GET','uri':_0x516a63+_0x2891('0xa'),'json':!![]};_0x216cd6['headers']=_0x1c3b6c;logger[_0x2891('0xb')]('Getting\x20user\x20list');return rp(_0x216cd6)['then'](function(_0x4e924c){if(_0x4e924c){var _0x63f16f=_0x4e924c[_0x2891('0xe')];var _0x2492fb=![];var _0x6cfada=null;if(_0x4a3e22[_0x2891('0x18')]!==null){logger[_0x2891('0xb')](_0x2891('0x19'),_0x4a3e22['agentEmail']);_0x4a3e22[_0x2891('0x1a')]=_0x4a3e22[_0x2891('0x18')];for(_0x6cfada=0x0;_0x6cfada<_0x63f16f[_0x2891('0xf')];_0x6cfada++){if(_0x63f16f[_0x6cfada][_0x2891('0x1b')]===_0x4a3e22[_0x2891('0x18')]){_0x2492fb=!![];_0x4a3e22[_0x2891('0x1c')]=_0x63f16f[_0x6cfada]['id'];logger[_0x2891('0xb')](_0x2891('0x1d'),_0x4a3e22[_0x2891('0x1c')]);}}}if(!_0x2492fb){logger['info'](_0x2891('0x1e'));_0x4a3e22['userEmail']=_0x4a3e22[_0x2891('0x10')];_0x4a3e22[_0x2891('0x1c')]=_0x4a3e22[_0x2891('0x11')];_0x2492fb=!![];}if(_0x2492fb){_0x468a32(_0x4a3e22);}else{_0x4e75ea({'statusCode':0x194,'message':_0x2891('0x13')});}}else{_0x4e75ea({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x27c761){logger[_0x2891('0x15')]('['+[_0x5d4033[_0x2891('0x16')]()]+']',_0x27c761[_0x2891('0x17')]);_0x4e75ea(_0x27c761);});});};}function searchContact(_0x4a2400,_0x118548,_0xcec999,_0x27ee8b){return new Promise(function(_0x3af631,_0x4c641b){var _0x13ff63={'method':_0x2891('0x1f'),'headers':_0x118548,'uri':_0x4a2400+'/api/lookup?q='+_0x27ee8b+_0x2891('0x20')+_0xcec999+_0x2891('0x21'),'json':!![]};rp(_0x13ff63)['then'](function(_0x3e1d02){var _0x47dcb5=_[_0x2891('0x22')](_0x3e1d02[_0x2891('0x23')][_0x2891('0x23')],[_0xcec999,_0x27ee8b]);_0x3af631(_0x47dcb5);})[_0x2891('0x14')](function(_0x30ef2b){_0x4c641b(_0x30ef2b);});});}function getEndUser(_0x5b55e0,_0x33fb02,_0x315350){return function(_0x436afe){return new Promise(function(_0x128ba7,_0x3ce3e3){logger[_0x2891('0xb')](util[_0x2891('0x24')](_0x2891('0x25'),_0x436afe[_0x2891('0x26')]));searchContact(_0x315350,_0x33fb02,_0x2891('0x27'),_0x436afe[_0x2891('0x26')])[_0x2891('0xd')](function(_0x52a777){if(_0x52a777){_0x436afe[_0x2891('0x28')]=_0x52a777['id'];logger[_0x2891('0xb')](_0x2891('0x29'),_0x436afe['endUserId']);return _0x128ba7(_0x436afe);}searchContact(_0x315350,_0x33fb02,_0x2891('0x2a'),_0x436afe[_0x2891('0x26')])[_0x2891('0xd')](function(_0x2f0d77){if(_0x2f0d77){_0x436afe[_0x2891('0x28')]=_0x2f0d77['id'];logger[_0x2891('0xb')](_0x2891('0x2b'),_0x436afe[_0x2891('0x28')]);return _0x128ba7(_0x436afe);}createEndUser(_0x436afe,_0x5b55e0,_0x33fb02,_0x315350)['then'](function(_0x47874c){logger[_0x2891('0xb')]('Contact\x20created:',_0x47874c[_0x2891('0x28')]);return _0x128ba7(_0x47874c);});});})[_0x2891('0x14')](function(_0x293196){_0x3ce3e3(_0x293196);});});};}function createEndUser(_0x53b539,_0x235df9,_0x5d08c5,_0x2b8b04){return new Promise(function(_0x927eef,_0x878ecc){var _0x8b1846=moment();var _0xd742c5={'method':_0x2891('0x2c'),'uri':_0x2b8b04+_0x2891('0x2d'),'body':{'contact':{'last_name':_0x53b539[_0x2891('0x26')],'work_number':_0x53b539[_0x2891('0x26')],'mobile_number':_0x53b539[_0x2891('0x26')],'owner_id':_0x53b539[_0x2891('0x1c')],'created_at':_0x8b1846[_0x2891('0x24')](_0x2891('0x2e'))}},'json':!![]};_0xd742c5[_0x2891('0x2f')]=_0x5d08c5;logger[_0x2891('0xb')](_0x2891('0x30'));return rp(_0xd742c5)[_0x2891('0xd')](function(_0x2f60e1){_0x53b539[_0x2891('0x28')]=_0x2f60e1[_0x2891('0x31')]['id'];_0x927eef(_0x53b539);})[_0x2891('0x14')](function(_0x4a8f75){logger[_0x2891('0x15')]('['+[_0x235df9[_0x2891('0x16')]()]+']',_0x4a8f75['message']);_0x878ecc(_0x4a8f75[_0x2891('0x17')]);});});}function getTicket(_0x225ba6,_0x3d12b4,_0x3fb6c6,_0x2ba17c,_0x2e9a63){return function(_0x394409){logger[_0x2891('0xb')](_0x2891('0x32'));return new Promise(function(_0x419369,_0x30c0b6){var _0x59c4ba=moment();var _0x5e2574={'method':_0x2891('0x2c'),'uri':_0x3fb6c6+_0x2891('0x33'),'body':{'title':intUtil[_0x2891('0x34')](_0x2ba17c['Subjects'],_0x2e9a63,'\x20'),'description':intUtil['getString'](_0x2ba17c[_0x2891('0x35')],_0x2e9a63,'\x0a'),'owner_id':_0x394409[_0x2891('0x1c')],'creater_id':_0x394409[_0x2891('0x11')],'targetable_id':_0x394409['endUserId'],'targetable_type':_0x2891('0x36'),'created_at':_0x59c4ba[_0x2891('0x24')](_0x2891('0x2e')),'due_date':_0x59c4ba['add'](0x1e,'m')[_0x2891('0x24')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x5e2574[_0x2891('0x2f')]=_0x3d12b4;return rp(_0x5e2574)['then'](function(_0x587450){_0x394409[_0x2891('0x37')]=_0x587450['task']['id'];logger[_0x2891('0xb')](_0x2891('0x38'),_0x394409[_0x2891('0x37')]);_0x419369(_0x394409);})[_0x2891('0x14')](function(_0x22a449){logger[_0x2891('0x15')]('['+[_0x225ba6[_0x2891('0x16')]()]+']',_0x22a449[_0x2891('0x17')]);_0x30c0b6(_0x22a449[_0x2891('0x17')]);});});};}function emit(_0x50a83b,_0x5d53d5,_0x44e2d9){var _0x760b40={'uri':_0x50a83b+'/contacts/'+_0x44e2d9};io['to'](util[_0x2891('0x24')]('user:%s',_0x5d53d5))[_0x2891('0x39')](_0x2891('0x3a'),_0x760b40);}exports['cs']=function(_0x40bc37,_0x4f65a7,_0x5342e7,_0x3647bb,_0x372498,_0xbc2b3b,_0x14f6b1,_0x242ddb){var _0x2b07bc={};var _0x2f8495={'Authorization':_0x2891('0x3b')+_0xbc2b3b[_0x2891('0x3c')]};_0xbc2b3b['remoteUri']=intUtil['stripTrailingSlash'](_0xbc2b3b[_0x2891('0x3d')]);_0xbc2b3b[_0x2891('0x3e')]=intUtil[_0x2891('0x3f')](_0xbc2b3b['serverUrl']);var _0x5c3607=_0xbc2b3b[_0x2891('0x3d')];_0x2b07bc['adminEmail']=_0xbc2b3b['username'];_0x2b07bc[_0x2891('0x26')]=_0x242ddb[_0x2891('0x40')]()===_0x2891('0x41')?_0x4f65a7['destcalleridnum']:_0x4f65a7[_0x2891('0x42')];_0x2b07bc[_0x2891('0x43')]=_0x242ddb===_0x2891('0x44')||_0x242ddb===_0x2891('0x45')?_0x2891('0x44'):_0x2891('0x41');if(_0x3647bb){_0x2b07bc[_0x2891('0x18')]=_0x3647bb['email'];}var _0x4453c6=util[_0x2891('0x24')](_0x2891('0x46'),_0xbc2b3b['serverUrl'],_0x4f65a7[_0x2891('0x47')],md5(_0x4f65a7[_0x2891('0x47')]));if(_0x372498&&_0x372498[_0x2891('0x48')]){logger['info'](_0x2891('0x49'),_0x2891('0x4a'));_0x4f65a7[_0x2891('0x4b')]=_0x4453c6;}else if(_0x14f6b1&&_0x14f6b1[_0x2891('0x4c')]&&_0x14f6b1[_0x2891('0x4c')]!==_0x2891('0x4d')){logger[_0x2891('0xb')](_0x2891('0x4e'),_0x2891('0x4a'));_0x4f65a7[_0x2891('0x4b')]=_0x4453c6;}else{_0x4f65a7[_0x2891('0x4b')]='';}return getAdminId(_0x2b07bc,_0x242ddb,_0x2f8495,_0x5c3607)[_0x2891('0xd')](getUser(_0x242ddb,_0x2f8495,_0x5c3607))[_0x2891('0xd')](getEndUser(_0x242ddb,_0x2f8495,_0x5c3607))[_0x2891('0xd')](getTicket(_0x242ddb,_0x2f8495,_0x5c3607,_0x5342e7,_0x4f65a7))[_0x2891('0xd')](function(_0x1384f3){logger[_0x2891('0xb')](util['format'](_0x2891('0x4f'),_0x1384f3['ticketId']));if(_0x242ddb!==_0x2891('0x45')){logger[_0x2891('0xb')]('['+[_0x242ddb[_0x2891('0x16')]()]+']',_0x2891('0x50'));emit(_0x5c3607,_0x3647bb[_0x2891('0x51')],_0x1384f3['endUserId']);}})[_0x2891('0x14')](function(_0x4d378d){logger[_0x2891('0x15')]('['+[_0x242ddb[_0x2891('0x16')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util['inspect'](_0x4d378d,{'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 b4d2617..7e6c8a0 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 _0x7f8c=['./sugarcrm','./desk','./vtiger','./servicenow','./dynamics365','zendesk','sugarcrm','freshdesk','servicenow','includes','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','log','unmanaged','salesforce','zoho','desk','vtiger','freshsales','unknown\x20integration','error','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce'];(function(_0x168a58,_0x1d2ec5){var _0x520033=function(_0x534995){while(--_0x534995){_0x168a58['push'](_0x168a58['shift']());}};_0x520033(++_0x1d2ec5);}(_0x7f8c,0x189));var _0xc7f8=function(_0x77ce34,_0x3b3de7){_0x77ce34=_0x77ce34-0x0;var _0x51ada6=_0x7f8c[_0x77ce34];return _0x51ada6;};'use strict';var _=require('lodash');var util=require(_0xc7f8('0x0'));var zendesk=require(_0xc7f8('0x1'));var salesforce=require(_0xc7f8('0x2'));var sugarcrm=require(_0xc7f8('0x3'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require(_0xc7f8('0x4'));var vtiger=require(_0xc7f8('0x5'));var servicenow=require(_0xc7f8('0x6'));var dynamics365=require(_0xc7f8('0x7'));var freshsales=require('./freshsales');var integrations=[_0xc7f8('0x8'),'salesforce',_0xc7f8('0x9'),_0xc7f8('0xa'),'zoho','desk','vtiger','dynamics365','freshsales',_0xc7f8('0xb')];exports['exec']=function(_0x132ad0,_0x1a25d8,_0x1cf0ee,_0x4ca589,_0x3bea3a,_0x5f52b5){if(_0x1cf0ee){if(_[_0xc7f8('0xc')](integrations,_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]())){try{var _0x5e71f0=null;var _0x4835f0='';var _0x327298=_0x1cf0ee[_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]()];if(_0x327298){var _0x45f7fe=_0x327298[_0x132ad0[_0xc7f8('0xf')]];if(_0x45f7fe){var _0x5bde5a=_[_0xc7f8('0x10')](_0x45f7fe[_0xc7f8('0x11')],{'id':parseInt(_0x132ad0[_0xc7f8('0x12')],0xa)});if(_0x5bde5a){if(_0x4ca589){if(_0x3bea3a&&_0x1a25d8[_0xc7f8('0x13')]){_0x4835f0=_0xc7f8('0x13');}else if(_0x1a25d8[_0xc7f8('0x14')]){_0x4835f0=_0xc7f8('0x15');}else{console[_0xc7f8('0x16')]('EVENT\x20UNKNOWN',_0x1a25d8);}}else{_0x4835f0=_0xc7f8('0x17');}switch(_0x132ad0['data1'][_0xc7f8('0xe')]()){case _0xc7f8('0x8'):zendesk[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x18'):salesforce[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x9'):sugarcrm[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0xa'):freshdesk[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x19'):zoho[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x1a'):desk[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x1b'):vtiger[_0x4835f0](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5);break;case _0xc7f8('0x1c'):freshsales['cs'](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5,_0x4835f0);break;case _0xc7f8('0xb'):servicenow['cs'](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5,_0x4835f0);break;case'dynamics365':dynamics365['cs'](_0x132ad0,_0x1a25d8,_0x5bde5a,_0x4ca589,_0x3bea3a,_0x45f7fe,_0x5f52b5,_0x4835f0);break;default:console['log'](_0xc7f8('0x1d'));}}else{_0x5e71f0=require('../../../../config/logger')(_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]());_0x5e71f0[_0xc7f8('0x1e')]('[EXEC]',util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x132ad0['data1'][_0xc7f8('0xe')](),_0x132ad0[_0xc7f8('0x12')]));}}else{_0x5e71f0=require(_0xc7f8('0x1f'))(_0x132ad0[_0xc7f8('0xd')][_0xc7f8('0xe')]());_0x5e71f0['error']('[EXEC]',util['format'](_0xc7f8('0x20'),_0x132ad0['data1'][_0xc7f8('0xe')](),_0x132ad0[_0xc7f8('0xf')]));}}else{}}catch(_0x5690fd){console[_0xc7f8('0x1e')](_0x5690fd);}}}}; \ No newline at end of file +var _0xc6e4=['unmanaged','salesforce','unknown\x20integration','error','[EXEC]','format','../../../../config/logger','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./vtiger','./servicenow','zendesk','sugarcrm','freshdesk','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','find','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN'];(function(_0x120bc2,_0x57a253){var _0x454a41=function(_0x21adfe){while(--_0x21adfe){_0x120bc2['push'](_0x120bc2['shift']());}};_0x454a41(++_0x57a253);}(_0xc6e4,0x143));var _0x4c6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6e4[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4c6e('0x0'));var util=require(_0x4c6e('0x1'));var zendesk=require(_0x4c6e('0x2'));var salesforce=require(_0x4c6e('0x3'));var sugarcrm=require(_0x4c6e('0x4'));var freshdesk=require('./freshdesk');var zoho=require('./zoho');var desk=require('./desk');var vtiger=require(_0x4c6e('0x5'));var servicenow=require(_0x4c6e('0x6'));var dynamics365=require('./dynamics365');var freshsales=require('./freshsales');var integrations=[_0x4c6e('0x7'),'salesforce',_0x4c6e('0x8'),_0x4c6e('0x9'),'zoho',_0x4c6e('0xa'),_0x4c6e('0xb'),_0x4c6e('0xc'),_0x4c6e('0xd'),_0x4c6e('0xe')];exports[_0x4c6e('0xf')]=function(_0x5110fa,_0xf65a83,_0x13cdbb,_0x1b682b,_0x420f8a,_0x1c298d){if(_0x13cdbb){if(_[_0x4c6e('0x10')](integrations,_0x5110fa[_0x4c6e('0x11')][_0x4c6e('0x12')]())){try{var _0x31f0ea=null;var _0x3ea383='';var _0x329859=_0x13cdbb[_0x5110fa[_0x4c6e('0x11')]['toLowerCase']()];if(_0x329859){var _0x5eb5b5=_0x329859[_0x5110fa[_0x4c6e('0x13')]];if(_0x5eb5b5){var _0x20437f=_[_0x4c6e('0x14')](_0x5eb5b5['Configurations'],{'id':parseInt(_0x5110fa[_0x4c6e('0x15')],0xa)});if(_0x20437f){if(_0x1b682b){if(_0x420f8a&&_0xf65a83[_0x4c6e('0x16')]){_0x3ea383=_0x4c6e('0x16');}else if(_0xf65a83[_0x4c6e('0x17')]){_0x3ea383=_0x4c6e('0x18');}else{console[_0x4c6e('0x19')](_0x4c6e('0x1a'),_0xf65a83);}}else{_0x3ea383=_0x4c6e('0x1b');}switch(_0x5110fa[_0x4c6e('0x11')][_0x4c6e('0x12')]()){case _0x4c6e('0x7'):zendesk[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case _0x4c6e('0x1c'):salesforce[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case _0x4c6e('0x8'):sugarcrm[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case _0x4c6e('0x9'):freshdesk[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case'zoho':zoho[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case'desk':desk[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case _0x4c6e('0xb'):vtiger[_0x3ea383](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d);break;case _0x4c6e('0xd'):freshsales['cs'](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d,_0x3ea383);break;case _0x4c6e('0xe'):servicenow['cs'](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d,_0x3ea383);break;case _0x4c6e('0xc'):dynamics365['cs'](_0x5110fa,_0xf65a83,_0x20437f,_0x1b682b,_0x420f8a,_0x5eb5b5,_0x1c298d,_0x3ea383);break;default:console[_0x4c6e('0x19')](_0x4c6e('0x1d'));}}else{_0x31f0ea=require('../../../../config/logger')(_0x5110fa[_0x4c6e('0x11')][_0x4c6e('0x12')]());_0x31f0ea[_0x4c6e('0x1e')](_0x4c6e('0x1f'),util[_0x4c6e('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x5110fa[_0x4c6e('0x11')][_0x4c6e('0x12')](),_0x5110fa[_0x4c6e('0x15')]));}}else{_0x31f0ea=require(_0x4c6e('0x21'))(_0x5110fa[_0x4c6e('0x11')][_0x4c6e('0x12')]());_0x31f0ea[_0x4c6e('0x1e')]('[EXEC]',util[_0x4c6e('0x20')](_0x4c6e('0x22'),_0x5110fa[_0x4c6e('0x11')][_0x4c6e('0x12')](),_0x5110fa['data2']));}}else{}}catch(_0x1c618c){console[_0x4c6e('0x1e')](_0x1c618c);}}}}; \ 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 02941f5..bb32b9f 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 _0x5979=['picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','trigger:browser:url','%s/%s/e','instanceUrl','catch','error','[QUEUE]','outbound','recordingFormat','none','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','calleridnum','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','assign','getString','Subjects','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Lead','Account','first','Phone','attributes','type','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','Company','No\x20Company','format','upperFirst','forEach','string'];(function(_0x547aae,_0x50f5b1){var _0x2d61af=function(_0x1477d1){while(--_0x1477d1){_0x547aae['push'](_0x547aae['shift']());}};_0x2d61af(++_0x50f5b1);}(_0x5979,0x137));var _0x9597=function(_0x419b6a,_0x265b43){_0x419b6a=_0x419b6a-0x0;var _0x229232=_0x5979[_0x419b6a];return _0x229232;};'use strict';var _=require('lodash');var rp=require(_0x9597('0x0'));var moment=require(_0x9597('0x1'));var BPromise=require(_0x9597('0x2'));var md5=require(_0x9597('0x3'));var jsforce=require(_0x9597('0x4'));var util=require(_0x9597('0x5'));var Redis=require(_0x9597('0x6'));var intUtil=require(_0x9597('0x7'));var config=require(_0x9597('0x8'));var logger=require('../../../../config/logger')(_0x9597('0x9'));config[_0x9597('0xa')]=_[_0x9597('0xb')](config[_0x9597('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x9597('0xc'))(new Redis(config[_0x9597('0xa')]));function emit(_0xa92f93,_0x1c3a10,_0xe0fadf){io['to'](_0xa92f93)['emit'](_0x1c3a10,_0xe0fadf);}function getTicket(_0xf532f1,_0x555574,_0xea3495,_0x2221d5,_0x3ce31a,_0x2451bf,_0x43edda,_0x2d3294){var _0x2c71b0=Object[_0x9597('0xd')]({},{'OwnerId':_0x555574['id'],'Subject':intUtil[_0x9597('0xe')](_0x2221d5[_0x9597('0xf')],_0x3ce31a,'\x20'),'Description':intUtil[_0x9597('0xe')](_0x2221d5['Descriptions'],_0x3ce31a,'\x0a')},getCustomFields(_0x2451bf,_0x3ce31a));if(_0xea3495){if(_0x2221d5[_0x9597('0x10')]===_0x9597('0x11')){_0x2c71b0[_0x9597('0x12')]=moment[_0x9597('0x13')]();_0x2c71b0[_0x9597('0x14')]=![];_0x2c71b0[_0x9597('0x15')]=![];if(_0xea3495[_0x9597('0x16')]===_0x9597('0x17')||_0xea3495[_0x9597('0x16')]===_0x9597('0x18')){_0x2c71b0[_0x9597('0x19')]=_0xea3495['id'];}else if(_0xea3495[_0x9597('0x16')]===_0x9597('0x1a')){_0x2c71b0['WhatId']=_0xea3495['id'];}}else if(_0x2221d5[_0x9597('0x10')]==='Case'){if(_0xea3495[_0x9597('0x16')]===_0x9597('0x17')){_0x2c71b0[_0x9597('0x1b')]=_0xea3495['id'];}else if(_0xea3495[_0x9597('0x16')]===_0x9597('0x1a')){_0x2c71b0[_0x9597('0x1c')]=_0xea3495['id'];}else if(_0xea3495[_0x9597('0x16')]===_0x9597('0x18')&&_0x2221d5['leadId']){_0x2c71b0[_0x2221d5[_0x9597('0x1d')]]=_0xea3495['id'];}else{logger[_0x9597('0x1e')](_0x9597('0x1f'));}}}return _0x43edda[_0x9597('0x20')](_0x2221d5['ticketType'])[_0x9597('0x21')](_0x2c71b0);}function getUser(_0x726e70,_0x798240,_0x4da00b){if(!_[_0x9597('0x22')](_0x798240)&&intUtil[_0x9597('0x23')](_0x798240)){var _0x330713={'Email':_0x798240};var _0x23d91a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x4da00b[_0x9597('0x20')](_0x9597('0x24'))[_0x9597('0x25')](_0x330713,_0x23d91a)[_0x9597('0x26')]()['then'](function(_0x2e8532){if(_0x2e8532[_0x9597('0x27')]){var _0x3f0197=_[_0x9597('0x25')](_0x2e8532,function(_0x559ea6){return _0x559ea6[_0x9597('0x28')]===_0x798240;});if(_0x3f0197){logger[_0x9597('0x1e')](_0x9597('0x29'),_0x798240);return BPromise[_0x9597('0x2a')]({'id':_0x3f0197['Id'],'name':_0x3f0197[_0x9597('0x2b')]});}}else{logger[_0x9597('0x1e')](_0x9597('0x2c'),_0x798240);return _0x4da00b[_0x9597('0x2d')]()[_0x9597('0x2e')](function(_0xa2c1f0){return BPromise[_0x9597('0x2a')]({'id':_0xa2c1f0[_0x9597('0x2f')],'name':_0xa2c1f0[_0x9597('0x30')]});});}});}else{logger[_0x9597('0x1e')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x798240);return _0x4da00b[_0x9597('0x2d')]()[_0x9597('0x2e')](function(_0x416306){return BPromise[_0x9597('0x2a')]({'id':_0x416306[_0x9597('0x2f')],'name':_0x416306['display_name']});});}}function getEndUser(_0x14177d,_0x1efd33,_0x1ef02d,_0x2bd740,_0x17f804){var _0x4f059b={'$or':{'Phone':_0x2bd740}};var _0x474334={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x9597('0x2a')]()['then'](function(){logger[_0x9597('0x1e')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x2bd740,_0x1efd33[_0x9597('0x31')]);switch(_0x1efd33[_0x9597('0x31')]){case _0x9597('0x32'):var _0x36c7be=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x34')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33['additionalSearchContact']]=_0x2bd740;_[_0x9597('0x35')](_0x36c7be[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x37'))[_0x9597('0x25')](_0x36c7be,_0x474334)[_0x9597('0x26')]()[_0x9597('0x2e')](function(_0x41efa4){if(_0x41efa4&&_0x41efa4[_0x9597('0x27')]){return _0x41efa4;}else{var _0x5b1c79=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x38')]){var _0x2ef0bc={};_0x2ef0bc[_0x1efd33[_0x9597('0x38')]]=_0x2bd740;_[_0x9597('0x35')](_0x5b1c79[_0x9597('0x36')],_0x2ef0bc);}return _0x17f804[_0x9597('0x20')]('Lead')[_0x9597('0x25')](_0x5b1c79,_0x474334);}});case _0x9597('0x39'):var _0x2ff72f=_['cloneDeep'](_0x4f059b);if(_0x1efd33['additionalSearchAccount']){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x3a')]]=_0x2bd740;_[_0x9597('0x35')](_0x2ff72f['$or'],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')]('Account')['find'](_0x2ff72f,_0x474334)['execute']()[_0x9597('0x2e')](function(_0xe97c9c){if(_0xe97c9c&&_0xe97c9c[_0x9597('0x27')]){return _0xe97c9c;}else{var _0x556fb3=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33['additionalSearchContact']){var _0x1f8857={};_0x1f8857[_0x1efd33[_0x9597('0x34')]]=_0x2bd740;_[_0x9597('0x35')](_0x556fb3[_0x9597('0x36')],_0x1f8857);}return _0x17f804[_0x9597('0x20')](_0x9597('0x37'))['find'](_0x556fb3,_0x474334)[_0x9597('0x2e')](function(_0x2d4b77){if(_0x2d4b77&&_0x2d4b77[_0x9597('0x27')]){return _0x2d4b77;}else{var _0xd9804d=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x38')]){var _0x131ec2={};_0x131ec2[_0x1efd33[_0x9597('0x38')]]=_0x2bd740;_[_0x9597('0x35')](_0xd9804d[_0x9597('0x36')],_0x131ec2);}return _0x17f804[_0x9597('0x20')]('Lead')['find'](_0xd9804d,_0x474334);}});}});case _0x9597('0x17'):var _0x36c7be=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x34')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x34')]]=_0x2bd740;_[_0x9597('0x35')](_0x36c7be[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x37'))['find'](_0x36c7be,_0x474334)[_0x9597('0x26')]();case _0x9597('0x18'):var _0x59e016=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x38')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x38')]]=_0x2bd740;_[_0x9597('0x35')](_0x59e016[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x3b'))[_0x9597('0x25')](_0x59e016,_0x474334);case'account':var _0x2ff72f=_[_0x9597('0x33')](_0x4f059b);if(_0x1efd33[_0x9597('0x3a')]){var _0x5e0ae8={};_0x5e0ae8[_0x1efd33[_0x9597('0x3a')]]=_0x2bd740;_[_0x9597('0x35')](_0x2ff72f[_0x9597('0x36')],_0x5e0ae8);}return _0x17f804[_0x9597('0x20')](_0x9597('0x3c'))[_0x9597('0x25')](_0x2ff72f,_0x474334);default:return null;}})[_0x9597('0x2e')](function(_0x5bd3a5){if(_0x5bd3a5&&_0x5bd3a5['length']){var _0x4bf2d3=_[_0x9597('0x3d')](_0x5bd3a5);if(_0x4bf2d3){return BPromise[_0x9597('0x2a')]({'id':_0x4bf2d3['Id'],'name':_0x4bf2d3[_0x9597('0x2b')],'phone':_0x4bf2d3[_0x9597('0x3e')],'endUserType':_0x4bf2d3[_0x9597('0x3f')][_0x9597('0x40')]['toLowerCase']()});}}})[_0x9597('0x2e')](function(_0x203e90){if(_0x203e90){logger[_0x9597('0x1e')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x203e90[_0x9597('0x16')],_0x2bd740);return BPromise['resolve'](_0x203e90);}else{logger[_0x9597('0x1e')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x2bd740);var _0x5c2402={'Phone':_0x2bd740};if(_0x1efd33[_0x9597('0x41')]){if(_0x1efd33['moduleCreate']===_0x9597('0x17')){logger[_0x9597('0x1e')](_0x9597('0x42'),_0x2bd740,_0x1efd33['moduleCreate']);_0x5c2402['LastName']=_0x1ef02d!==_0x9597('0x43')?_0x1ef02d:util['format'](_0x9597('0x44'),_0x2bd740);}else if(_0x1efd33[_0x9597('0x41')]==='lead'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x2bd740,_0x1efd33[_0x9597('0x41')]);_0x5c2402[_0x9597('0x45')]=_0x1ef02d!==_0x9597('0x43')?_0x1ef02d:util['format']('Caller\x20-\x20%s',_0x2bd740);_0x5c2402[_0x9597('0x46')]=_0x9597('0x47');}else if(_0x1efd33[_0x9597('0x41')]==='account'){logger[_0x9597('0x1e')](_0x9597('0x42'),_0x2bd740,_0x1efd33[_0x9597('0x41')]);_0x5c2402[_0x9597('0x2b')]=_0x1ef02d!==_0x9597('0x43')?_0x1ef02d:util[_0x9597('0x48')](_0x9597('0x44'),_0x2bd740);}else{return null;}}return _0x17f804[_0x9597('0x20')](_[_0x9597('0x49')](_0x1efd33[_0x9597('0x41')]))['create'](_0x5c2402)[_0x9597('0x2e')](function(_0x28b437){return BPromise[_0x9597('0x2a')]({'id':_0x28b437['id'],'endUserType':_0x1efd33[_0x9597('0x41')]});});}});}function getCustomFields(_0x324a3c,_0x3ed1f4){var _0x1847e6={};if(_0x324a3c[_0x9597('0x27')]>0x0){_[_0x9597('0x4a')](_0x324a3c,function(_0x253f88){if(_['includes']([_0x9597('0x4b'),_0x9597('0x4c')],_0x253f88[_0x9597('0x40')])&&_0x253f88[_0x9597('0x4d')]){_0x1847e6[_0x253f88[_0x9597('0x4d')]]=_0x253f88[_0x9597('0x4e')][_0x9597('0x4f')]();}else if(_0x253f88['type']===_0x9597('0x50')&&_0x253f88[_0x9597('0x51')]&&_0x253f88['idField']){_0x3ed1f4[_0x253f88[_0x9597('0x51')]]&&(_0x1847e6[_0x253f88['idField']]=_0x3ed1f4[_0x253f88[_0x9597('0x51')]][_0x9597('0x4f')]());}else if(_0x253f88[_0x9597('0x40')]===_0x9597('0x52')&&_0x253f88[_0x9597('0x53')]&&_0x253f88[_0x9597('0x53')][_0x9597('0x54')]&&_0x253f88['idField']){_0x3ed1f4[_0x253f88['Variable'][_0x9597('0x54')]['toLowerCase']()]&&(_0x1847e6[_0x253f88[_0x9597('0x4d')]]=_0x3ed1f4[_0x253f88['Variable']['name']['toLowerCase']()][_0x9597('0x4f')]());}});}return _0x1847e6;}function getConnection(_0x3c2c48){var _0x22978d=_0x3c2c48[_0x9597('0x55')][_0x9597('0x56')](_0x3c2c48[_0x9597('0x57')]);var _0x2b8454=new jsforce[(_0x9597('0x58'))]({'oauth2':{'loginUrl':_0x3c2c48[_0x9597('0x59')]||_0x9597('0x5a'),'clientId':_0x3c2c48[_0x9597('0x5b')],'clientSecret':_0x3c2c48[_0x9597('0x5c')]}});return _0x2b8454[_0x9597('0x5d')](_0x3c2c48['username'],_0x22978d)[_0x9597('0x2e')](function(){logger[_0x9597('0x1e')](_0x9597('0x5e'));return _0x2b8454;});}exports[_0x9597('0x5f')]=function(_0x349fdc,_0x4458a0,_0x28db0f,_0x5f118a,_0x46f571,_0x299b33){var _0x2162a6,_0x263f96,_0x428c55,_0xef8b5f;_0x299b33[_0x9597('0x60')]=intUtil[_0x9597('0x61')](_0x299b33[_0x9597('0x60')]);_0x299b33[_0x9597('0x59')]=intUtil['stripTrailingSlash'](_0x299b33[_0x9597('0x59')]);if(_0x46f571&&_0x46f571[_0x9597('0x62')]){logger[_0x9597('0x1e')]('[QUEUE]',_0x9597('0x63'));_0x4458a0['recordingURL']=util[_0x9597('0x48')](_0x9597('0x64'),_0x299b33['serverUrl'],_0x4458a0[_0x9597('0x65')],md5(_0x4458a0['uniqueid']));}else{_0x4458a0[_0x9597('0x66')]='';}return getConnection(_0x299b33)[_0x9597('0x2e')](function(_0x410ac3){_0xef8b5f=_0x410ac3;return getUser(_0x299b33,_0x5f118a[_0x9597('0x67')],_0xef8b5f);})[_0x9597('0x2e')](function(_0x476b16){_0x2162a6=_0x476b16;return getEndUser(_0x299b33,_0x28db0f,_0x4458a0[_0x9597('0x68')],_0x4458a0['calleridnum'],_0xef8b5f);})['then'](function(_0x41e9c0){_0x263f96=_0x41e9c0;return getTicket(_0x299b33,_0x2162a6,_0x263f96,_0x28db0f,_0x4458a0,_0x28db0f[_0x9597('0x69')],_0xef8b5f,_0x9597('0x5f'));})[_0x9597('0x2e')](function(_0x5de754){_0x428c55=_0x5de754;logger[_0x9597('0x1e')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x428c55['id']);logger[_0x9597('0x1e')](_0x9597('0x6a'),_0x428c55['id'],_0x5f118a[_0x9597('0x54')],_0x299b33[_0x9597('0x40')]);switch(_0x299b33[_0x9597('0x40')]){case _0x9597('0x6b'):emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x5f118a[_0x9597('0x54')]),_0x9597('0x6d'),{'recordId':_0x428c55['id']});break;case'newTab':emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x5f118a['name']),_0x9597('0x6e'),{'uri':util[_0x9597('0x48')](_0x9597('0x6f'),_0xef8b5f[_0x9597('0x70')],_0x428c55['id'])});break;default:logger['error']('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0x9597('0x71')](function(_0x4b801f){logger[_0x9597('0x72')](_0x9597('0x73'),_0x4b801f);});};exports[_0x9597('0x74')]=function(_0xf5dab6,_0x4ee318,_0x14f295,_0x2d7983,_0x23a7d3,_0x2e7bfd,_0x3f4575){var _0x4eb8dc,_0x5544ea,_0x4582d3,_0x2f99e8;_0x2e7bfd['serverUrl']=intUtil[_0x9597('0x61')](_0x2e7bfd[_0x9597('0x60')]);_0x2e7bfd['remoteUri']=intUtil[_0x9597('0x61')](_0x2e7bfd[_0x9597('0x59')]);if(_0x3f4575&&_0x3f4575[_0x9597('0x75')]&&_0x3f4575[_0x9597('0x75')]!==_0x9597('0x76')){logger[_0x9597('0x1e')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4ee318[_0x9597('0x66')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e7bfd[_0x9597('0x60')],_0x4ee318[_0x9597('0x65')],md5(_0x4ee318[_0x9597('0x65')]));}return getConnection(_0x2e7bfd)[_0x9597('0x2e')](function(_0x301a9a){_0x2f99e8=_0x301a9a;return getUser(_0x2e7bfd,_0x2d7983[_0x9597('0x67')],_0x2f99e8);})['then'](function(_0x5b9558){_0x4eb8dc=_0x5b9558;return getEndUser(_0x2e7bfd,_0x14f295,_0x4ee318['destcalleridname'],_0x4ee318[_0x9597('0x77')],_0x2f99e8);})[_0x9597('0x2e')](function(_0x5ce3e7){_0x5544ea=_0x5ce3e7;return getTicket(_0x2e7bfd,_0x4eb8dc,_0x5544ea,_0x14f295,_0x4ee318,_0x14f295[_0x9597('0x69')],_0x2f99e8,_0x9597('0x74'));})['then'](function(_0x11a39f){_0x4582d3=_0x11a39f;logger[_0x9597('0x1e')](_0x9597('0x78'),_0x4582d3['id']);logger[_0x9597('0x1e')](_0x9597('0x79'),_0x4582d3['id'],_0x2d7983[_0x9597('0x54')],_0x2e7bfd['type']);switch(_0x2e7bfd[_0x9597('0x40')]){case _0x9597('0x6b'):emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x2d7983[_0x9597('0x54')]),_0x9597('0x6d'),{'recordId':_0x4582d3['id']});break;case'newTab':emit(util[_0x9597('0x48')](_0x9597('0x6c'),_0x2d7983[_0x9597('0x54')]),_0x9597('0x6e'),{'uri':util[_0x9597('0x48')](_0x9597('0x6f'),_0x2f99e8[_0x9597('0x70')],_0x4582d3['id'])});break;default:logger[_0x9597('0x72')](_0x9597('0x7a'),_0x9597('0x7b'));}})[_0x9597('0x71')](function(_0x362d40){logger['error'](_0x9597('0x7a'),_0x362d40);});};exports['unmanaged']=function(_0x2bce29,_0x42f251,_0x66d3f9,_0x4741f8,_0x8bee14,_0x2604ae){var _0x553dee,_0x2abb75,_0x3bbecf,_0x373391;_0x2604ae['serverUrl']=intUtil[_0x9597('0x61')](_0x2604ae[_0x9597('0x60')]);_0x2604ae[_0x9597('0x59')]=intUtil[_0x9597('0x61')](_0x2604ae[_0x9597('0x59')]);if(_0x8bee14&&_0x8bee14[_0x9597('0x62')]){logger[_0x9597('0x1e')]('['+_0x42f251[_0x9597('0x7c')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x42f251[_0x9597('0x66')]=util[_0x9597('0x48')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2604ae['serverUrl'],_0x42f251[_0x9597('0x65')],md5(_0x42f251['uniqueid']));}else{_0x42f251[_0x9597('0x66')]='';}return getConnection(_0x2604ae)[_0x9597('0x2e')](function(_0x17b40f){_0x373391=_0x17b40f;if(!_[_0x9597('0x22')](_0x4741f8)){return getUser(_0x2604ae,_0x4741f8[_0x9597('0x54')],_0x373391);}else{return getUser(_0x2604ae,null,_0x373391);}})[_0x9597('0x2e')](function(_0x2b96b1){_0x553dee=_0x2b96b1;return getEndUser(_0x2604ae,_0x66d3f9,_0x42f251['calleridname'],_0x42f251[_0x9597('0x7d')],_0x373391);})[_0x9597('0x2e')](function(_0x1727bf){_0x2abb75=_0x1727bf;return getTicket(_0x2604ae,_0x553dee,_0x2abb75,_0x66d3f9,_0x42f251,_0x66d3f9[_0x9597('0x69')],_0x373391);})[_0x9597('0x2e')](function(_0x5a2f89){_0x3bbecf=_0x5a2f89;logger[_0x9597('0x1e')]('['+_0x42f251[_0x9597('0x7c')][_0x9597('0x7e')]()+_0x9597('0x7f'),_0x3bbecf['id']);logger[_0x9597('0x1e')]('['+_0x42f251[_0x9597('0x7c')]['toUpperCase']()+_0x9597('0x80'),_0x2604ae[_0x9597('0x40')]);})['catch'](function(_0x3799b5){logger[_0x9597('0x72')]('['+_0x42f251['lastevent'][_0x9597('0x7e')]()+']',_0x3799b5);});}; \ No newline at end of file +var _0x605a=['integrationTab','newTab','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','toUpperCase','isNil','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','assign','getString','Task','ActivityDate','utc','IsReminderSet','endUserType','contact','account','WhatId','ticketType','Case','ContactId','AccountId','leadId','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','validateEmail','User','find','execute','then','length','Email','info','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','identity','user_id','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','Account','Lead','additionalSearchAccount','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','format','Company','No\x20Company','Caller\x20-\x20%s','upperFirst','forEach','string','picklist','idField','content','toString','variableName','Variable','name','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','login','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','user:%s','trigger:salesforce:display','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x540fe9,_0x36bc62){var _0x57c808=function(_0x6be580){while(--_0x6be580){_0x540fe9['push'](_0x540fe9['shift']());}};_0x57c808(++_0x36bc62);}(_0x605a,0x1f0));var _0xa605=function(_0x404614,_0x3c886c){_0x404614=_0x404614-0x0;var _0x2bb43a=_0x605a[_0x404614];return _0x2bb43a;};'use strict';var _=require('lodash');var rp=require(_0xa605('0x0'));var moment=require(_0xa605('0x1'));var BPromise=require('bluebird');var md5=require(_0xa605('0x2'));var jsforce=require(_0xa605('0x3'));var util=require(_0xa605('0x4'));var Redis=require(_0xa605('0x5'));var intUtil=require(_0xa605('0x6'));var config=require(_0xa605('0x7'));var logger=require(_0xa605('0x8'))('salesforce');config[_0xa605('0x9')]=_[_0xa605('0xa')](config[_0xa605('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa605('0x9')]));function emit(_0xcfe676,_0x510026,_0x338fd6){io['to'](_0xcfe676)['emit'](_0x510026,_0x338fd6);}function getTicket(_0x3072a0,_0x18a945,_0x122032,_0x5b4cca,_0x30e776,_0x25127d,_0x58470c,_0x348eea){var _0x4d0e0a=Object[_0xa605('0xb')]({},{'OwnerId':_0x18a945['id'],'Subject':intUtil['getString'](_0x5b4cca['Subjects'],_0x30e776,'\x20'),'Description':intUtil[_0xa605('0xc')](_0x5b4cca['Descriptions'],_0x30e776,'\x0a')},getCustomFields(_0x25127d,_0x30e776));if(_0x122032){if(_0x5b4cca['ticketType']===_0xa605('0xd')){_0x4d0e0a[_0xa605('0xe')]=moment[_0xa605('0xf')]();_0x4d0e0a[_0xa605('0x10')]=![];_0x4d0e0a['IsRecurrence']=![];if(_0x122032[_0xa605('0x11')]===_0xa605('0x12')||_0x122032[_0xa605('0x11')]==='lead'){_0x4d0e0a['WhoId']=_0x122032['id'];}else if(_0x122032[_0xa605('0x11')]===_0xa605('0x13')){_0x4d0e0a[_0xa605('0x14')]=_0x122032['id'];}}else if(_0x5b4cca[_0xa605('0x15')]===_0xa605('0x16')){if(_0x122032['endUserType']==='contact'){_0x4d0e0a[_0xa605('0x17')]=_0x122032['id'];}else if(_0x122032[_0xa605('0x11')]==='account'){_0x4d0e0a[_0xa605('0x18')]=_0x122032['id'];}else if(_0x122032[_0xa605('0x11')]==='lead'&&_0x5b4cca['leadId']){_0x4d0e0a[_0x5b4cca[_0xa605('0x19')]]=_0x122032['id'];}else{logger['info'](_0xa605('0x1a'));}}}return _0x58470c[_0xa605('0x1b')](_0x5b4cca[_0xa605('0x15')])['create'](_0x4d0e0a);}function getUser(_0x3370ad,_0x267417,_0x11a297){if(!_['isNil'](_0x267417)&&intUtil[_0xa605('0x1c')](_0x267417)){var _0x1e64c3={'Email':_0x267417};var _0x357139={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x11a297[_0xa605('0x1b')](_0xa605('0x1d'))[_0xa605('0x1e')](_0x1e64c3,_0x357139)[_0xa605('0x1f')]()[_0xa605('0x20')](function(_0x3506a9){if(_0x3506a9[_0xa605('0x21')]){var _0x50c32f=_[_0xa605('0x1e')](_0x3506a9,function(_0x54ec07){return _0x54ec07[_0xa605('0x22')]===_0x267417;});if(_0x50c32f){logger[_0xa605('0x23')](_0xa605('0x24'),_0x267417);return BPromise['resolve']({'id':_0x50c32f['Id'],'name':_0x50c32f[_0xa605('0x25')]});}}else{logger[_0xa605('0x23')](_0xa605('0x26'),_0x267417);return _0x11a297['identity']()[_0xa605('0x20')](function(_0x126499){return BPromise[_0xa605('0x27')]({'id':_0x126499['user_id'],'name':_0x126499['display_name']});});}});}else{logger['info'](_0xa605('0x26'),_0x267417);return _0x11a297[_0xa605('0x28')]()[_0xa605('0x20')](function(_0x1cd082){return BPromise[_0xa605('0x27')]({'id':_0x1cd082[_0xa605('0x29')],'name':_0x1cd082[_0xa605('0x2a')]});});}}function getEndUser(_0x3a1fa5,_0x51b39a,_0x824da,_0x335c02,_0x1fe185){var _0x46210a={'$or':{'Phone':_0x335c02}};var _0x1a346={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa605('0x27')]()[_0xa605('0x20')](function(){logger[_0xa605('0x23')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x335c02,_0x51b39a[_0xa605('0x2b')]);switch(_0x51b39a[_0xa605('0x2b')]){case _0xa605('0x2c'):var _0x338dea=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a[_0xa605('0x2e')]){var _0x445691={};_0x445691[_0x51b39a['additionalSearchContact']]=_0x335c02;_[_0xa605('0x2f')](_0x338dea[_0xa605('0x30')],_0x445691);}return _0x1fe185[_0xa605('0x1b')](_0xa605('0x31'))[_0xa605('0x1e')](_0x338dea,_0x1a346)['execute']()['then'](function(_0x2bcc8a){if(_0x2bcc8a&&_0x2bcc8a[_0xa605('0x21')]){return _0x2bcc8a;}else{var _0x9e0f4a=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a[_0xa605('0x32')]){var _0x396b9a={};_0x396b9a[_0x51b39a[_0xa605('0x32')]]=_0x335c02;_[_0xa605('0x2f')](_0x9e0f4a['$or'],_0x396b9a);}return _0x1fe185[_0xa605('0x1b')]('Lead')[_0xa605('0x1e')](_0x9e0f4a,_0x1a346);}});case _0xa605('0x33'):var _0x5a2b6d=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a['additionalSearchAccount']){var _0x445691={};_0x445691[_0x51b39a['additionalSearchAccount']]=_0x335c02;_[_0xa605('0x2f')](_0x5a2b6d['$or'],_0x445691);}return _0x1fe185[_0xa605('0x1b')](_0xa605('0x34'))[_0xa605('0x1e')](_0x5a2b6d,_0x1a346)['execute']()[_0xa605('0x20')](function(_0x5268c4){if(_0x5268c4&&_0x5268c4[_0xa605('0x21')]){return _0x5268c4;}else{var _0x2583d2=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a[_0xa605('0x2e')]){var _0x564ee1={};_0x564ee1[_0x51b39a[_0xa605('0x2e')]]=_0x335c02;_['merge'](_0x2583d2[_0xa605('0x30')],_0x564ee1);}return _0x1fe185['sobject'](_0xa605('0x31'))[_0xa605('0x1e')](_0x2583d2,_0x1a346)[_0xa605('0x20')](function(_0x1b5808){if(_0x1b5808&&_0x1b5808[_0xa605('0x21')]){return _0x1b5808;}else{var _0x1c1d4b=_['cloneDeep'](_0x46210a);if(_0x51b39a[_0xa605('0x32')]){var _0x28f59d={};_0x28f59d[_0x51b39a[_0xa605('0x32')]]=_0x335c02;_[_0xa605('0x2f')](_0x1c1d4b['$or'],_0x28f59d);}return _0x1fe185[_0xa605('0x1b')](_0xa605('0x35'))[_0xa605('0x1e')](_0x1c1d4b,_0x1a346);}});}});case _0xa605('0x12'):var _0x338dea=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a[_0xa605('0x2e')]){var _0x445691={};_0x445691[_0x51b39a[_0xa605('0x2e')]]=_0x335c02;_[_0xa605('0x2f')](_0x338dea[_0xa605('0x30')],_0x445691);}return _0x1fe185[_0xa605('0x1b')](_0xa605('0x31'))[_0xa605('0x1e')](_0x338dea,_0x1a346)[_0xa605('0x1f')]();case'lead':var _0xc583cf=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a[_0xa605('0x32')]){var _0x445691={};_0x445691[_0x51b39a['additionalSearchLead']]=_0x335c02;_[_0xa605('0x2f')](_0xc583cf[_0xa605('0x30')],_0x445691);}return _0x1fe185['sobject']('Lead')[_0xa605('0x1e')](_0xc583cf,_0x1a346);case _0xa605('0x13'):var _0x5a2b6d=_[_0xa605('0x2d')](_0x46210a);if(_0x51b39a[_0xa605('0x36')]){var _0x445691={};_0x445691[_0x51b39a[_0xa605('0x36')]]=_0x335c02;_['merge'](_0x5a2b6d['$or'],_0x445691);}return _0x1fe185[_0xa605('0x1b')]('Account')[_0xa605('0x1e')](_0x5a2b6d,_0x1a346);default:return null;}})[_0xa605('0x20')](function(_0x3f7bc9){if(_0x3f7bc9&&_0x3f7bc9['length']){var _0x141790=_[_0xa605('0x37')](_0x3f7bc9);if(_0x141790){return BPromise[_0xa605('0x27')]({'id':_0x141790['Id'],'name':_0x141790['Name'],'phone':_0x141790[_0xa605('0x38')],'endUserType':_0x141790['attributes'][_0xa605('0x39')][_0xa605('0x3a')]()});}}})['then'](function(_0x2dbcc8){if(_0x2dbcc8){logger[_0xa605('0x23')](_0xa605('0x3b'),_0x2dbcc8[_0xa605('0x11')],_0x335c02);return BPromise[_0xa605('0x27')](_0x2dbcc8);}else{logger[_0xa605('0x23')](_0xa605('0x3c'),_0x335c02);var _0x5ff13f={'Phone':_0x335c02};if(_0x51b39a[_0xa605('0x3d')]){if(_0x51b39a[_0xa605('0x3d')]===_0xa605('0x12')){logger[_0xa605('0x23')](_0xa605('0x3e'),_0x335c02,_0x51b39a['moduleCreate']);_0x5ff13f['LastName']=_0x824da!==_0xa605('0x3f')?_0x824da:util[_0xa605('0x40')]('Caller\x20-\x20%s',_0x335c02);}else if(_0x51b39a['moduleCreate']==='lead'){logger[_0xa605('0x23')](_0xa605('0x3e'),_0x335c02,_0x51b39a[_0xa605('0x3d')]);_0x5ff13f['LastName']=_0x824da!==''?_0x824da:util[_0xa605('0x40')]('Caller\x20-\x20%s',_0x335c02);_0x5ff13f[_0xa605('0x41')]=_0xa605('0x42');}else if(_0x51b39a[_0xa605('0x3d')]==='account'){logger[_0xa605('0x23')](_0xa605('0x3e'),_0x335c02,_0x51b39a[_0xa605('0x3d')]);_0x5ff13f[_0xa605('0x25')]=_0x824da!==_0xa605('0x3f')?_0x824da:util[_0xa605('0x40')](_0xa605('0x43'),_0x335c02);}else{return null;}}return _0x1fe185[_0xa605('0x1b')](_[_0xa605('0x44')](_0x51b39a['moduleCreate']))['create'](_0x5ff13f)[_0xa605('0x20')](function(_0xaf6bcd){return BPromise[_0xa605('0x27')]({'id':_0xaf6bcd['id'],'endUserType':_0x51b39a[_0xa605('0x3d')]});});}});}function getCustomFields(_0x2fb6ac,_0x286bc7){var _0x4865e7={};if(_0x2fb6ac[_0xa605('0x21')]>0x0){_[_0xa605('0x45')](_0x2fb6ac,function(_0x395613){if(_['includes']([_0xa605('0x46'),_0xa605('0x47')],_0x395613[_0xa605('0x39')])&&_0x395613['idField']){_0x4865e7[_0x395613[_0xa605('0x48')]]=_0x395613[_0xa605('0x49')][_0xa605('0x4a')]();}else if(_0x395613[_0xa605('0x39')]==='variable'&&_0x395613[_0xa605('0x4b')]&&_0x395613[_0xa605('0x48')]){_0x286bc7[_0x395613['variableName']]&&(_0x4865e7[_0x395613['idField']]=_0x286bc7[_0x395613[_0xa605('0x4b')]][_0xa605('0x4a')]());}else if(_0x395613[_0xa605('0x39')]==='customVariable'&&_0x395613[_0xa605('0x4c')]&&_0x395613[_0xa605('0x4c')][_0xa605('0x4d')]&&_0x395613['idField']){_0x286bc7[_0x395613[_0xa605('0x4c')][_0xa605('0x4d')][_0xa605('0x3a')]()]&&(_0x4865e7[_0x395613[_0xa605('0x48')]]=_0x286bc7[_0x395613['Variable'][_0xa605('0x4d')][_0xa605('0x3a')]()][_0xa605('0x4a')]());}});}return _0x4865e7;}function getConnection(_0x124b89){var _0x413d3a=_0x124b89[_0xa605('0x4e')][_0xa605('0x4f')](_0x124b89[_0xa605('0x50')]);var _0x150636=new jsforce[(_0xa605('0x51'))]({'oauth2':{'loginUrl':_0x124b89[_0xa605('0x52')]||_0xa605('0x53'),'clientId':_0x124b89['clientId'],'clientSecret':_0x124b89['clientSecret']}});return _0x150636[_0xa605('0x54')](_0x124b89['username'],_0x413d3a)[_0xa605('0x20')](function(){logger['info'](_0xa605('0x55'));return _0x150636;});}exports[_0xa605('0x56')]=function(_0x57e567,_0x539242,_0x469963,_0x9c8f55,_0x570d70,_0x1e6ebf){var _0x2535a9,_0x692166,_0x457936,_0x4bbbfa;_0x1e6ebf[_0xa605('0x57')]=intUtil[_0xa605('0x58')](_0x1e6ebf[_0xa605('0x57')]);_0x1e6ebf[_0xa605('0x52')]=intUtil[_0xa605('0x58')](_0x1e6ebf[_0xa605('0x52')]);if(_0x570d70&&_0x570d70[_0xa605('0x59')]){logger[_0xa605('0x23')](_0xa605('0x5a'),_0xa605('0x5b'));_0x539242[_0xa605('0x5c')]=util[_0xa605('0x40')](_0xa605('0x5d'),_0x1e6ebf[_0xa605('0x57')],_0x539242['uniqueid'],md5(_0x539242[_0xa605('0x5e')]));}else{_0x539242[_0xa605('0x5c')]='';}return getConnection(_0x1e6ebf)[_0xa605('0x20')](function(_0x2fd31f){_0x4bbbfa=_0x2fd31f;return getUser(_0x1e6ebf,_0x9c8f55[_0xa605('0x5f')],_0x4bbbfa);})[_0xa605('0x20')](function(_0x95b3ab){_0x2535a9=_0x95b3ab;return getEndUser(_0x1e6ebf,_0x469963,_0x539242[_0xa605('0x60')],_0x539242['calleridnum'],_0x4bbbfa);})[_0xa605('0x20')](function(_0x6417a2){_0x692166=_0x6417a2;return getTicket(_0x1e6ebf,_0x2535a9,_0x692166,_0x469963,_0x539242,_0x469963[_0xa605('0x61')],_0x4bbbfa,_0xa605('0x56'));})[_0xa605('0x20')](function(_0x1fb13e){_0x457936=_0x1fb13e;logger[_0xa605('0x23')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x457936['id']);logger[_0xa605('0x23')](_0xa605('0x62'),_0x457936['id'],_0x9c8f55['name'],_0x1e6ebf[_0xa605('0x39')]);switch(_0x1e6ebf[_0xa605('0x39')]){case'integrationTab':emit(util[_0xa605('0x40')](_0xa605('0x63'),_0x9c8f55[_0xa605('0x4d')]),_0xa605('0x64'),{'recordId':_0x457936['id']});break;case'newTab':emit(util[_0xa605('0x40')](_0xa605('0x63'),_0x9c8f55['name']),'trigger:browser:url',{'uri':util[_0xa605('0x40')](_0xa605('0x65'),_0x4bbbfa[_0xa605('0x66')],_0x457936['id'])});break;default:logger[_0xa605('0x67')](_0xa605('0x68'));}})[_0xa605('0x69')](function(_0x4c3946){logger[_0xa605('0x67')](_0xa605('0x5a'),_0x4c3946);});};exports[_0xa605('0x6a')]=function(_0x504b10,_0x4b7cf6,_0x45fc0,_0x5f40e4,_0x3daf4e,_0x1cbfcf,_0x52cf16){var _0x164f3c,_0x5ddd0a,_0xfa604b,_0x5d80f0;_0x1cbfcf[_0xa605('0x57')]=intUtil[_0xa605('0x58')](_0x1cbfcf[_0xa605('0x57')]);_0x1cbfcf['remoteUri']=intUtil['stripTrailingSlash'](_0x1cbfcf[_0xa605('0x52')]);if(_0x52cf16&&_0x52cf16['recordingFormat']&&_0x52cf16[_0xa605('0x6b')]!==_0xa605('0x6c')){logger[_0xa605('0x23')](_0xa605('0x6d'),_0xa605('0x5b'));_0x4b7cf6['recordingURL']=util['format'](_0xa605('0x5d'),_0x1cbfcf[_0xa605('0x57')],_0x4b7cf6[_0xa605('0x5e')],md5(_0x4b7cf6[_0xa605('0x5e')]));}return getConnection(_0x1cbfcf)[_0xa605('0x20')](function(_0x35e99c){_0x5d80f0=_0x35e99c;return getUser(_0x1cbfcf,_0x5f40e4[_0xa605('0x5f')],_0x5d80f0);})[_0xa605('0x20')](function(_0x25482b){_0x164f3c=_0x25482b;return getEndUser(_0x1cbfcf,_0x45fc0,_0x4b7cf6[_0xa605('0x6e')],_0x4b7cf6[_0xa605('0x6f')],_0x5d80f0);})[_0xa605('0x20')](function(_0x34f757){_0x5ddd0a=_0x34f757;return getTicket(_0x1cbfcf,_0x164f3c,_0x5ddd0a,_0x45fc0,_0x4b7cf6,_0x45fc0[_0xa605('0x61')],_0x5d80f0,_0xa605('0x6a'));})[_0xa605('0x20')](function(_0xd625f8){_0xfa604b=_0xd625f8;logger['info'](_0xa605('0x70'),_0xfa604b['id']);logger[_0xa605('0x23')](_0xa605('0x71'),_0xfa604b['id'],_0x5f40e4[_0xa605('0x4d')],_0x1cbfcf[_0xa605('0x39')]);switch(_0x1cbfcf[_0xa605('0x39')]){case _0xa605('0x72'):emit(util['format'](_0xa605('0x63'),_0x5f40e4[_0xa605('0x4d')]),_0xa605('0x64'),{'recordId':_0xfa604b['id']});break;case _0xa605('0x73'):emit(util[_0xa605('0x40')](_0xa605('0x63'),_0x5f40e4[_0xa605('0x4d')]),'trigger:browser:url',{'uri':util[_0xa605('0x40')](_0xa605('0x65'),_0x5d80f0[_0xa605('0x66')],_0xfa604b['id'])});break;default:logger[_0xa605('0x67')]('[OUTBOUND]',_0xa605('0x74'));}})['catch'](function(_0x32636f){logger[_0xa605('0x67')]('[OUTBOUND]',_0x32636f);});};exports[_0xa605('0x75')]=function(_0xd334e2,_0x3edda9,_0x3ce676,_0x315ccb,_0x5184dd,_0x77b732){var _0x1076c3,_0x1a0d06,_0x77047b,_0x1dca4f;_0x77b732[_0xa605('0x57')]=intUtil[_0xa605('0x58')](_0x77b732[_0xa605('0x57')]);_0x77b732[_0xa605('0x52')]=intUtil[_0xa605('0x58')](_0x77b732[_0xa605('0x52')]);if(_0x5184dd&&_0x5184dd[_0xa605('0x59')]){logger[_0xa605('0x23')]('['+_0x3edda9['lastevent'][_0xa605('0x76')]()+']',_0xa605('0x5b'));_0x3edda9[_0xa605('0x5c')]=util[_0xa605('0x40')](_0xa605('0x5d'),_0x77b732[_0xa605('0x57')],_0x3edda9[_0xa605('0x5e')],md5(_0x3edda9[_0xa605('0x5e')]));}else{_0x3edda9[_0xa605('0x5c')]='';}return getConnection(_0x77b732)[_0xa605('0x20')](function(_0x312b42){_0x1dca4f=_0x312b42;if(!_[_0xa605('0x77')](_0x315ccb)){return getUser(_0x77b732,_0x315ccb[_0xa605('0x4d')],_0x1dca4f);}else{return getUser(_0x77b732,null,_0x1dca4f);}})[_0xa605('0x20')](function(_0x23a667){_0x1076c3=_0x23a667;return getEndUser(_0x77b732,_0x3ce676,_0x3edda9[_0xa605('0x60')],_0x3edda9['calleridnum'],_0x1dca4f);})[_0xa605('0x20')](function(_0xa7342){_0x1a0d06=_0xa7342;return getTicket(_0x77b732,_0x1076c3,_0x1a0d06,_0x3ce676,_0x3edda9,_0x3ce676[_0xa605('0x61')],_0x1dca4f);})[_0xa605('0x20')](function(_0x3c2a39){_0x77047b=_0x3c2a39;logger[_0xa605('0x23')]('['+_0x3edda9['lastevent'][_0xa605('0x76')]()+']\x20Ticket\x20%s\x20created.',_0x77047b['id']);logger[_0xa605('0x23')]('['+_0x3edda9[_0xa605('0x78')][_0xa605('0x76')]()+_0xa605('0x79'),_0x77b732[_0xa605('0x39')]);})[_0xa605('0x69')](function(_0x5f67f3){logger[_0xa605('0x67')]('['+_0x3edda9['lastevent'][_0xa605('0x76')]()+']',_0x5f67f3);});}; \ 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 d89d3ab..3cd5cdd 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 _0x903c=['monitor_format','[QUEUE]','recordingURL','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','adminEmail','],\x20createEndUser\x20input\x20crm','sys_user?','user','System','endUserNumber','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','picklist','type','nameField','content','toString','idField','customField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','POST','incident','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','GET','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','queue','unmanaged','uniqueid'];(function(_0x392350,_0x34b94f){var _0x755a63=function(_0x466ff0){while(--_0x466ff0){_0x392350['push'](_0x392350['shift']());}};_0x755a63(++_0x34b94f);}(_0x903c,0x1c6));var _0xc903=function(_0x5210c7,_0x37ec2f){_0x5210c7=_0x5210c7-0x0;var _0x5ccdea=_0x903c[_0x5210c7];return _0x5ccdea;};'use strict';var _=require(_0xc903('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0xc903('0x1'));var md5=require(_0xc903('0x2'));var Redis=require(_0xc903('0x3'));var intUtil=require(_0xc903('0x4'));var config=require(_0xc903('0x5'));var logger=require(_0xc903('0x6'))(_0xc903('0x7'));config[_0xc903('0x8')]=_['defaults'](config[_0xc903('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xc903('0x9'))(new Redis(config[_0xc903('0x8')]));function getAdminUser(_0x3e7280,_0x362528,_0x16fe34,_0x479b4e,_0x3d9c71,_0x1fbb0d){return new Promise(function(_0x32467a,_0x4835cd){var _0x525484={'method':'GET','uri':_0x479b4e+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x3d9c71+'&'+_0x1fbb0d,'auth':_0x362528,'json':!![]};return rp(_0x525484)[_0xc903('0xa')](function(_0x3ea17c){if(_0x3ea17c[_0xc903('0xb')][_0xc903('0xc')]>0x0){_0x16fe34[_0xc903('0xd')]=_0x3ea17c[_0xc903('0xb')][0x0][_0xc903('0xe')];}logger[_0xc903('0xf')]('['+[_0x3e7280[_0xc903('0x10')]()]+_0xc903('0x11'),_0x16fe34);_0x32467a(_0x16fe34);})[_0xc903('0x12')](function(_0x1517a8){logger[_0xc903('0x13')]('['+[_0x3e7280[_0xc903('0x10')]()]+']',_0x1517a8[_0xc903('0x14')]);_0x4835cd(_0x1517a8[_0xc903('0x14')]);});});}function getUser(_0x9ce7f5,_0x279a4b,_0x516a1a,_0x28ff86,_0x51320a){return function(_0x1e5262){logger[_0xc903('0xf')]('['+[_0x9ce7f5[_0xc903('0x10')]()]+_0xc903('0x15'),_0x1e5262);return new Promise(function(_0xcc1084,_0x3196e7){if(intUtil['validateEmail'](_0x1e5262[_0xc903('0x16')])){var _0x21be43={'method':'GET','uri':_0x516a1a+_0xc903('0x17')+_0x1e5262['userEmail']+'&'+_0x28ff86+'&'+_0x51320a,'auth':_0x279a4b,'json':!![]};logger[_0xc903('0xf')]('['+[_0x9ce7f5['toUpperCase']()]+_0xc903('0x18'),_0x21be43);return rp(_0x21be43)[_0xc903('0xa')](function(_0x7545e1){logger['info']('['+[_0x9ce7f5[_0xc903('0x10')]()]+_0xc903('0x19'),_0x7545e1);if(_0x7545e1['result']['length']>0x0&&String(_0x7545e1[_0xc903('0xb')][0x0][_0xc903('0x1a')])===_0xc903('0x1b')){_0x1e5262[_0xc903('0x1c')]=_0x7545e1[_0xc903('0xb')][0x0][_0xc903('0xe')];}else{_0x1e5262[_0xc903('0x1c')]=_0x1e5262['adminId'];_0x1e5262['userEmail']=_0x1e5262['adminEmail'];}logger[_0xc903('0xf')]('['+[_0x9ce7f5[_0xc903('0x10')]()]+_0xc903('0x1d'),_0x1e5262);_0xcc1084(_0x1e5262);})[_0xc903('0x12')](function(_0x5716d2){logger[_0xc903('0x13')]('['+[_0x9ce7f5['toUpperCase']()]+']',_0x5716d2['message']);_0x3196e7(_0x5716d2[_0xc903('0x14')]);});}else{logger['info']('['+[_0x9ce7f5['toUpperCase']()]+_0xc903('0x1e'));_0x1e5262[_0xc903('0x1c')]=_0x1e5262[_0xc903('0xd')];_0x1e5262['userEmail']=_0x1e5262[_0xc903('0x1f')];_0xcc1084(_0x1e5262);}});};}function createEndUser(_0x4422cb,_0x2d5ad6,_0x33321e,_0x10e29f,_0x3ad32c){logger['info']('['+[_0x4422cb[_0xc903('0x10')]()]+_0xc903('0x20'),_0x33321e);return new Promise(function(_0x4a3705,_0x22c042){var _0x5d8fed={'method':'POST','uri':_0x10e29f+_0xc903('0x21')+_0x3ad32c,'body':{'user_name':_0x33321e['endUserNumber'],'roles':_0xc903('0x22'),'first_name':_0x33321e['endUserNumber'],'active':'true','date_format':_0xc903('0x23'),'phone':_0x33321e[_0xc903('0x24')]},'auth':_0x2d5ad6,'json':!![]};return rp(_0x5d8fed)['then'](function(_0x15b713){logger[_0xc903('0xf')]('['+[_0x4422cb[_0xc903('0x10')]()]+_0xc903('0x25'),_0x15b713['result']);_0x33321e[_0xc903('0x26')]=_0x15b713[_0xc903('0xb')][_0xc903('0xe')];_0x4a3705(_0x33321e);})['catch'](function(_0x5dcaa3){logger[_0xc903('0x13')]('['+[_0x4422cb[_0xc903('0x10')]()]+']',_0x5dcaa3[_0xc903('0x14')]);_0x22c042(_0x5dcaa3['message']);});});}function getEndUser(_0x5328f2,_0x3ca5a5,_0x5811c5,_0x3720a8,_0x1054f9){return function(_0x5a1b17){logger[_0xc903('0xf')]('['+[_0x5328f2[_0xc903('0x10')]()]+_0xc903('0x27'),_0x5a1b17);return new Promise(function(_0x29251d,_0x448fba){var _0x43391e={'method':'GET','uri':_0x5811c5+_0xc903('0x28')+_0x5a1b17['endUserNumber']+'&'+_0x3720a8+'&'+_0x1054f9,'auth':_0x3ca5a5,'json':!![]};return rp(_0x43391e)[_0xc903('0xa')](function(_0x29ecbb){if(_0x29ecbb[_0xc903('0xb')][_0xc903('0xc')]>0x0){_0x5a1b17['endUserId']=_0x29ecbb['result'][0x0][_0xc903('0xe')];logger[_0xc903('0xf')]('['+[_0x5328f2['toUpperCase']()]+_0xc903('0x29'),_0x5a1b17);_0x29251d(_0x5a1b17);}else{return createEndUser(_0x5328f2,_0x3ca5a5,_0x5a1b17,_0x5811c5,_0x3720a8)[_0xc903('0xa')](function(_0x2abdff){logger[_0xc903('0xf')]('['+[_0x5328f2[_0xc903('0x10')]()]+'],\x20createEndUser\x20crm',_0x2abdff);_0x29251d(_0x2abdff);});}})[_0xc903('0x12')](function(_0x19214b){logger[_0xc903('0x13')]('['+[_0x5328f2[_0xc903('0x10')]()]+']',_0x19214b['message']);_0x448fba(_0x19214b[_0xc903('0x14')]);});});};}function getCustomFields(_0x9f5874,_0x3f1bbe){var _0x382cd3={};if(_0x9f5874['length']>0x0){_[_0xc903('0x2a')](_0x9f5874,function(_0xafb2e1){if(_[_0xc903('0x2b')]([_0xc903('0x2c'),_0xc903('0x2d')],_0xafb2e1[_0xc903('0x2e')])&&_0xafb2e1['nameField']&&!_0xafb2e1['customField']){_0x382cd3[_0xafb2e1[_0xc903('0x2f')]['toLowerCase']()]=_0xafb2e1[_0xc903('0x30')][_0xc903('0x31')]();}else if(_['includes']([_0xc903('0x2c'),_0xc903('0x2d')],_0xafb2e1[_0xc903('0x2e')])&&_0xafb2e1[_0xc903('0x32')]&&_0xafb2e1[_0xc903('0x33')]){_0x382cd3[_0xafb2e1[_0xc903('0x32')][_0xc903('0x34')]()]=_0xafb2e1[_0xc903('0x30')]['toString']();}else if(_0xafb2e1['type']===_0xc903('0x35')&&_0xafb2e1[_0xc903('0x36')]&&_0xafb2e1['idField']&&_0xafb2e1['customField']){_0x382cd3[_0xafb2e1[_0xc903('0x32')][_0xc903('0x34')]()]=_0x3f1bbe[_0xafb2e1[_0xc903('0x36')]][_0xc903('0x31')]();}else if(_0xafb2e1[_0xc903('0x2e')]===_0xc903('0x37')&&_0xafb2e1['Variable']&&_0xafb2e1[_0xc903('0x38')][_0xc903('0x39')]&&_0xafb2e1[_0xc903('0x32')]&&_0xafb2e1['customField']){_0x382cd3[_0xafb2e1[_0xc903('0x32')][_0xc903('0x34')]()]=_0x3f1bbe[_0xafb2e1[_0xc903('0x38')][_0xc903('0x39')][_0xc903('0x34')]()]['toString']();}});}return _0x382cd3;}function getTicket(_0x3d711e,_0x35eb4b,_0x4f8ad1,_0x1e267e,_0x1c0b8d,_0x361937){return function(_0x3b5a1f){logger[_0xc903('0xf')]('['+[_0x3d711e[_0xc903('0x10')]()]+']\x20getTicket\x20input\x20crm',_0x3b5a1f);return new Promise(function(_0x48dbc5,_0x2154d5){var _0x1123fa=_0x3d711e['toLowerCase']()===_0xc903('0x3a')?_0x3b5a1f['userId']:_0x3b5a1f[_0xc903('0x26')];var _0xa5efe9={'method':_0xc903('0x3b'),'uri':_0x4f8ad1+_0xc903('0x3c')+'?'+_0x361937,'body':Object[_0xc903('0x3d')]({},{'active':_0xc903('0x1b'),'caller_id':_0x1123fa,'assigned_to':_0x3b5a1f['userId'],'short_description':intUtil[_0xc903('0x3e')](_0x1e267e[_0xc903('0x3f')],_0x1c0b8d,'\x20'),'description':intUtil[_0xc903('0x3e')](_0x1e267e[_0xc903('0x40')],_0x1c0b8d,'\x0a')},getCustomFields(_0x1e267e['Fields'],_0x1c0b8d)),'auth':_0x35eb4b,'json':!![]};return rp(_0xa5efe9)['then'](function(_0x3be0dc){logger[_0xc903('0xf')]('['+[_0x3d711e[_0xc903('0x10')]()]+_0xc903('0x41'),_0x3be0dc[_0xc903('0xb')]);_0x3b5a1f[_0xc903('0x42')]=_0x3be0dc[_0xc903('0xb')]['sys_id'];_0x3b5a1f[_0xc903('0x43')]=_0x3be0dc[_0xc903('0xb')][_0xc903('0x44')];logger[_0xc903('0xf')]('['+[_0x3d711e[_0xc903('0x10')]()]+_0xc903('0x45'),_0x3b5a1f);_0x48dbc5(_0x3b5a1f);})[_0xc903('0x12')](function(_0x281a00){logger[_0xc903('0x13')]('['+[_0x3d711e[_0xc903('0x10')]()]+']',_0x281a00['message']);_0x2154d5(_0x281a00[_0xc903('0x14')]);});});};}function createRemoteTag(_0x3bdd56,_0x8dd566,_0x3e0f10,_0x536af3){return new Promise(function(_0x540dbd,_0x2fe853){var _0x522b62={'method':_0xc903('0x3b'),'uri':_0x3e0f10+_0xc903('0x46')+'?'+_0x536af3,'body':{'short_description':_0x3bdd56,'global':!![],'active':!![],'name':_0x3bdd56},'auth':_0x8dd566,'json':!![]};return rp(_0x522b62)[_0xc903('0xa')](function(_0x5ec426){var _0x14d638=_0x5ec426['result'][_0xc903('0xe')];_0x540dbd(_0x14d638);});});}function getRemoteTag(_0x59e658,_0x1d5756,_0x1a70b6,_0x3f6157,_0x15f9d9){return new Promise(function(_0x239e1c,_0x2c9508){var _0x39dc4d={'method':_0xc903('0x47'),'uri':_0x1a70b6+_0xc903('0x46')+_0xc903('0x48')+_0x59e658+'&'+_0x3f6157,'auth':_0x1d5756,'json':!![]};return rp(_0x39dc4d)[_0xc903('0xa')](function(_0x579b60){if(_0x579b60[_0xc903('0xb')][_0xc903('0xc')]>0x0){var _0x3ecd23=_0x579b60['result'][0x0][_0xc903('0xe')];_0x239e1c(_0x3ecd23);}else{return createRemoteTag(_0x59e658,_0x1d5756,_0x1a70b6,_0x3f6157)['then'](function(_0x10acb7){_0x239e1c(_0x10acb7);});}});});}function assignTagToIncident(_0x2737c3,_0x1f3579,_0xff1c58,_0x1c0844,_0x305d6e){return new Promise(function(_0x19b46e,_0x57d85c){var _0x9376bc={'method':_0xc903('0x3b'),'uri':_0xff1c58+_0xc903('0x49')+'?'+_0x305d6e,'body':{'label':_0x2737c3,'table':_0xc903('0x3c'),'id_type':_0xc903('0x4a'),'table_key':_0x1c0844['ticketId'],'title':_0xc903('0x4b')+_0x1c0844[_0xc903('0x43')],'id_display':_0x1c0844['ticketNumber']},'auth':_0x1f3579,'json':!![]};return rp(_0x9376bc)[_0xc903('0xa')](function(_0xd9d317){_0x19b46e();})[_0xc903('0x12')](function(){_0x19b46e();});});}function manageTags(_0x530597,_0x193b4b,_0x4a330a,_0x28a98e,_0x578571,_0x1337c9,_0x29c79f){return new Promise(function(_0x580750,_0x5906a2){var _0x677597=[];_0x193b4b[_0xc903('0x2a')](function(_0x44cf78){_0x677597[_0xc903('0x4c')](getRemoteTag(_0x44cf78,_0x4a330a,_0x28a98e,_0x1337c9,_0x29c79f));});return Promise[_0xc903('0x4d')](_0x677597)[_0xc903('0xa')](function(_0x393a51){if(_0x393a51[_0xc903('0xc')]){logger[_0xc903('0xf')]('['+[_0x530597[_0xc903('0x10')]()]+_0xc903('0x4e'),_0x393a51);var _0x195c33=[];_0x393a51[_0xc903('0x2a')](function(_0x34e22c){_0x195c33[_0xc903('0x4c')](assignTagToIncident(_0x34e22c,_0x4a330a,_0x28a98e,_0x578571,_0x1337c9));});return Promise[_0xc903('0x4d')](_0x195c33)[_0xc903('0xa')](function(){_0x580750();})[_0xc903('0x12')](function(){_0x580750();});}else{_0x580750();}});});}function getTags(_0x62e663,_0xfcfc43,_0x581837,_0x2bde0d,_0x3087ee,_0x3b40d6){return function(_0x11793f){return new Promise(function(_0x8e1405,_0x4373fb){var _0x26a118=[];var _0x3abe30=_0x2bde0d['Tags'];if(_0x3abe30&&_0x3abe30[_0xc903('0xc')]>0x0){_0x26a118=_['map'](_0x3abe30,'name');}if(_0x26a118[_0xc903('0xc')]>0x0){return manageTags(_0x62e663,_0x26a118,_0xfcfc43,_0x581837,_0x11793f,_0x3087ee,_0x3b40d6)['then'](function(){_0x8e1405(_0x11793f);});}else{_0x8e1405(_0x11793f);}});};}function emit(_0x2e575e,_0x2092a2,_0x44cdf9){var _0x320030=_0xc903('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0xc903('0x50')+_0xc903('0x51');var _0x5219fa={'uri':_0x2e575e+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x44cdf9+_0x320030};io['to'](util['format'](_0xc903('0x52'),_0x2092a2))[_0xc903('0x53')](_0xc903('0x54'),_0x5219fa);}exports['cs']=function(_0x2f8801,_0x31320c,_0x1022d4,_0x335d6b,_0x3571f1,_0x105c41,_0x560b8e,_0x2ce6e1){var _0x49cbe2={};var _0x56aa88={'user':_0x105c41[_0xc903('0x55')],'pass':_0x105c41[_0xc903('0x56')]};var _0x21bc96=_0xc903('0x57');var _0x493856=_0xc903('0x58');_0x105c41['remoteUri']=intUtil[_0xc903('0x59')](_0x105c41[_0xc903('0x5a')]);_0x105c41[_0xc903('0x5b')]=intUtil[_0xc903('0x59')](_0x105c41[_0xc903('0x5b')]);var _0x185685=util[_0xc903('0x5c')](_0xc903('0x5d'),_0x105c41['remoteUri']);_0x49cbe2['userEmail']=!_[_0xc903('0x5e')](_0x335d6b)?_0x335d6b[_0xc903('0x5f')]:null;_0x49cbe2[_0xc903('0x1f')]=_0x105c41[_0xc903('0x5f')];_0x49cbe2['endUserNumber']=_0x2ce6e1['toLowerCase']()===_0xc903('0x3a')?_0x31320c[_0xc903('0x60')]:_0x31320c['calleridnum'];_0x49cbe2[_0xc903('0x61')]=_0x2ce6e1===_0xc903('0x62')||_0x2ce6e1===_0xc903('0x63')?_0xc903('0x62'):_0xc903('0x3a');var _0x444087=util[_0xc903('0x5c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x105c41['serverUrl'],_0x31320c[_0xc903('0x64')],md5(_0x31320c[_0xc903('0x64')]));if(_0x3571f1&&_0x3571f1[_0xc903('0x65')]){logger[_0xc903('0xf')](_0xc903('0x66'),'Recording\x20is\x20enabled!');_0x31320c[_0xc903('0x67')]=_0x444087;}else if(_0x560b8e&&_0x560b8e['recordingFormat']&&_0x560b8e['recordingFormat']!==_0xc903('0x68')){logger[_0xc903('0xf')](_0xc903('0x69'),_0xc903('0x6a'));_0x31320c[_0xc903('0x67')]=_0x444087;}else{_0x31320c[_0xc903('0x67')]='';}return getAdminUser(_0x2ce6e1,_0x56aa88,_0x49cbe2,_0x185685,_0x493856,_0x21bc96)[_0xc903('0xa')](getUser(_0x2ce6e1,_0x56aa88,_0x185685,_0x493856,_0x21bc96))['then'](getEndUser(_0x2ce6e1,_0x56aa88,_0x185685,_0x493856,_0x21bc96))[_0xc903('0xa')](getTicket(_0x2ce6e1,_0x56aa88,_0x185685,_0x1022d4,_0x31320c,_0x493856))['then'](function(_0x3590b6){logger[_0xc903('0xf')](util[_0xc903('0x5c')](_0xc903('0x6b'),_0x3590b6[_0xc903('0x42')]));logger[_0xc903('0xf')](util[_0xc903('0x5c')](_0xc903('0x6c'),_0x2ce6e1));if(_0x2ce6e1!=='unmanaged'){logger[_0xc903('0xf')]('['+[_0x2ce6e1[_0xc903('0x10')]()]+']',_0xc903('0x6d'));emit(_0x105c41[_0xc903('0x5a')],_0x335d6b['name'],_0x3590b6['ticketId']);}})[_0xc903('0x12')](function(_0x12d4d4){logger[_0xc903('0x13')]('['+[_0x2ce6e1['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0xc903('0x6e')](_0x12d4d4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xba54=['active','userId','adminEmail','],\x20getUser\x20crm','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','true','System','then','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','servicenow','redis','localhost','socket.io-emitter','GET','result','length','adminId','sys_id','info','],\x20getAdminUser\x20crm','catch','error','message','toUpperCase','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity'];(function(_0xf55e73,_0x3fecc5){var _0x116b99=function(_0x314e0c){while(--_0x314e0c){_0xf55e73['push'](_0xf55e73['shift']());}};_0x116b99(++_0x3fecc5);}(_0xba54,0xba));var _0x4ba5=function(_0x26d98e,_0x5682f1){_0x26d98e=_0x26d98e-0x0;var _0x3db72c=_0xba54[_0x26d98e];return _0x3db72c;};'use strict';var _=require(_0x4ba5('0x0'));var Promise=require(_0x4ba5('0x1'));var rp=require(_0x4ba5('0x2'));var util=require(_0x4ba5('0x3'));var md5=require(_0x4ba5('0x4'));var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4ba5('0x5'));config[_0x4ba5('0x6')]=_['defaults'](config['redis'],{'host':_0x4ba5('0x7'),'port':0x18eb});var io=require(_0x4ba5('0x8'))(new Redis(config['redis']));function getAdminUser(_0x4b8225,_0x20900d,_0x77038b,_0x25a37b,_0x640d5e,_0x1b49bd){return new Promise(function(_0xef930f,_0x410dea){var _0x43c376={'method':_0x4ba5('0x9'),'uri':_0x25a37b+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x640d5e+'&'+_0x1b49bd,'auth':_0x20900d,'json':!![]};return rp(_0x43c376)['then'](function(_0x2a3d8f){if(_0x2a3d8f[_0x4ba5('0xa')][_0x4ba5('0xb')]>0x0){_0x77038b[_0x4ba5('0xc')]=_0x2a3d8f[_0x4ba5('0xa')][0x0][_0x4ba5('0xd')];}logger[_0x4ba5('0xe')]('['+[_0x4b8225['toUpperCase']()]+_0x4ba5('0xf'),_0x77038b);_0xef930f(_0x77038b);})[_0x4ba5('0x10')](function(_0x2e73df){logger[_0x4ba5('0x11')]('['+[_0x4b8225['toUpperCase']()]+']',_0x2e73df[_0x4ba5('0x12')]);_0x410dea(_0x2e73df['message']);});});}function getUser(_0x23ab24,_0x2aa893,_0x147193,_0x35e7ff,_0x270376){return function(_0x496f95){logger[_0x4ba5('0xe')]('['+[_0x23ab24[_0x4ba5('0x13')]()]+_0x4ba5('0x14'),_0x496f95);return new Promise(function(_0x2e943e,_0x57f5be){if(intUtil[_0x4ba5('0x15')](_0x496f95[_0x4ba5('0x16')])){var _0x251864={'method':'GET','uri':_0x147193+_0x4ba5('0x17')+_0x496f95[_0x4ba5('0x16')]+'&'+_0x35e7ff+'&'+_0x270376,'auth':_0x2aa893,'json':!![]};logger[_0x4ba5('0xe')]('['+[_0x23ab24['toUpperCase']()]+_0x4ba5('0x18'),_0x251864);return rp(_0x251864)['then'](function(_0x8bb2ff){logger[_0x4ba5('0xe')]('['+[_0x23ab24[_0x4ba5('0x13')]()]+_0x4ba5('0x19'),_0x8bb2ff);if(_0x8bb2ff['result'][_0x4ba5('0xb')]>0x0&&String(_0x8bb2ff['result'][0x0][_0x4ba5('0x1a')])==='true'){_0x496f95[_0x4ba5('0x1b')]=_0x8bb2ff['result'][0x0][_0x4ba5('0xd')];}else{_0x496f95[_0x4ba5('0x1b')]=_0x496f95[_0x4ba5('0xc')];_0x496f95[_0x4ba5('0x16')]=_0x496f95[_0x4ba5('0x1c')];}logger[_0x4ba5('0xe')]('['+[_0x23ab24['toUpperCase']()]+_0x4ba5('0x1d'),_0x496f95);_0x2e943e(_0x496f95);})[_0x4ba5('0x10')](function(_0x114e64){logger[_0x4ba5('0x11')]('['+[_0x23ab24[_0x4ba5('0x13')]()]+']',_0x114e64[_0x4ba5('0x12')]);_0x57f5be(_0x114e64['message']);});}else{logger['info']('['+[_0x23ab24[_0x4ba5('0x13')]()]+']\x20using\x20admin\x20profile');_0x496f95['userId']=_0x496f95[_0x4ba5('0xc')];_0x496f95[_0x4ba5('0x16')]=_0x496f95[_0x4ba5('0x1c')];_0x2e943e(_0x496f95);}});};}function createEndUser(_0xf87447,_0x90cae3,_0x2e7e74,_0x57fd12,_0x4c9c80){logger['info']('['+[_0xf87447[_0x4ba5('0x13')]()]+_0x4ba5('0x1e'),_0x2e7e74);return new Promise(function(_0x423ddc,_0x471c13){var _0x4cbdc2={'method':_0x4ba5('0x1f'),'uri':_0x57fd12+_0x4ba5('0x20')+_0x4c9c80,'body':{'user_name':_0x2e7e74[_0x4ba5('0x21')],'roles':_0x4ba5('0x22'),'first_name':_0x2e7e74['endUserNumber'],'active':_0x4ba5('0x23'),'date_format':_0x4ba5('0x24'),'phone':_0x2e7e74[_0x4ba5('0x21')]},'auth':_0x90cae3,'json':!![]};return rp(_0x4cbdc2)[_0x4ba5('0x25')](function(_0x13032d){logger['info']('['+[_0xf87447[_0x4ba5('0x13')]()]+_0x4ba5('0x26'),_0x13032d[_0x4ba5('0xa')]);_0x2e7e74[_0x4ba5('0x27')]=_0x13032d[_0x4ba5('0xa')][_0x4ba5('0xd')];_0x423ddc(_0x2e7e74);})[_0x4ba5('0x10')](function(_0x2f9b49){logger[_0x4ba5('0x11')]('['+[_0xf87447[_0x4ba5('0x13')]()]+']',_0x2f9b49[_0x4ba5('0x12')]);_0x471c13(_0x2f9b49[_0x4ba5('0x12')]);});});}function getEndUser(_0x2baa53,_0x23cfe7,_0x20c33b,_0x3920ff,_0x507c93){return function(_0x47af3b){logger['info']('['+[_0x2baa53[_0x4ba5('0x13')]()]+_0x4ba5('0x28'),_0x47af3b);return new Promise(function(_0x38ff30,_0xd5dfd1){var _0x6d781={'method':_0x4ba5('0x9'),'uri':_0x20c33b+_0x4ba5('0x29')+_0x47af3b[_0x4ba5('0x21')]+'&'+_0x3920ff+'&'+_0x507c93,'auth':_0x23cfe7,'json':!![]};return rp(_0x6d781)[_0x4ba5('0x25')](function(_0x4ddb51){if(_0x4ddb51[_0x4ba5('0xa')][_0x4ba5('0xb')]>0x0){_0x47af3b[_0x4ba5('0x27')]=_0x4ddb51[_0x4ba5('0xa')][0x0]['sys_id'];logger[_0x4ba5('0xe')]('['+[_0x2baa53['toUpperCase']()]+_0x4ba5('0x2a'),_0x47af3b);_0x38ff30(_0x47af3b);}else{return createEndUser(_0x2baa53,_0x23cfe7,_0x47af3b,_0x20c33b,_0x3920ff)[_0x4ba5('0x25')](function(_0x290c48){logger[_0x4ba5('0xe')]('['+[_0x2baa53['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x290c48);_0x38ff30(_0x290c48);});}})[_0x4ba5('0x10')](function(_0x1c3fef){logger['error']('['+[_0x2baa53[_0x4ba5('0x13')]()]+']',_0x1c3fef['message']);_0xd5dfd1(_0x1c3fef[_0x4ba5('0x12')]);});});};}function getCustomFields(_0x445ecb,_0xbe50f3){var _0xcd288e={};if(_0x445ecb[_0x4ba5('0xb')]>0x0){_[_0x4ba5('0x2b')](_0x445ecb,function(_0x7ae5d0){if(_[_0x4ba5('0x2c')](['string',_0x4ba5('0x2d')],_0x7ae5d0[_0x4ba5('0x2e')])&&_0x7ae5d0[_0x4ba5('0x2f')]&&!_0x7ae5d0[_0x4ba5('0x30')]){_0xcd288e[_0x7ae5d0[_0x4ba5('0x2f')][_0x4ba5('0x31')]()]=_0x7ae5d0[_0x4ba5('0x32')][_0x4ba5('0x33')]();}else if(_[_0x4ba5('0x2c')](['string',_0x4ba5('0x2d')],_0x7ae5d0[_0x4ba5('0x2e')])&&_0x7ae5d0[_0x4ba5('0x34')]&&_0x7ae5d0[_0x4ba5('0x30')]){_0xcd288e[_0x7ae5d0[_0x4ba5('0x34')][_0x4ba5('0x31')]()]=_0x7ae5d0[_0x4ba5('0x32')][_0x4ba5('0x33')]();}else if(_0x7ae5d0[_0x4ba5('0x2e')]===_0x4ba5('0x35')&&_0x7ae5d0['variableName']&&_0x7ae5d0[_0x4ba5('0x34')]&&_0x7ae5d0[_0x4ba5('0x30')]){_0xcd288e[_0x7ae5d0[_0x4ba5('0x34')]['toLowerCase']()]=_0xbe50f3[_0x7ae5d0[_0x4ba5('0x36')]][_0x4ba5('0x33')]();}else if(_0x7ae5d0['type']===_0x4ba5('0x37')&&_0x7ae5d0[_0x4ba5('0x38')]&&_0x7ae5d0[_0x4ba5('0x38')][_0x4ba5('0x39')]&&_0x7ae5d0[_0x4ba5('0x34')]&&_0x7ae5d0[_0x4ba5('0x30')]){_0xcd288e[_0x7ae5d0['idField'][_0x4ba5('0x31')]()]=_0xbe50f3[_0x7ae5d0[_0x4ba5('0x38')]['name']['toLowerCase']()][_0x4ba5('0x33')]();}});}return _0xcd288e;}function getTicket(_0x1e7c3f,_0x5e2fe7,_0x5277a8,_0x569909,_0x45cd5d,_0x11625b){return function(_0x4187eb){logger[_0x4ba5('0xe')]('['+[_0x1e7c3f[_0x4ba5('0x13')]()]+_0x4ba5('0x3a'),_0x4187eb);return new Promise(function(_0x3e2b55,_0x4ee84c){var _0x4d8acb=_0x1e7c3f[_0x4ba5('0x31')]()===_0x4ba5('0x3b')?_0x4187eb[_0x4ba5('0x1b')]:_0x4187eb[_0x4ba5('0x27')];var _0x4893ac={'method':'POST','uri':_0x5277a8+_0x4ba5('0x3c')+'?'+_0x11625b,'body':Object[_0x4ba5('0x3d')]({},{'active':'true','caller_id':_0x4d8acb,'assigned_to':_0x4187eb[_0x4ba5('0x1b')],'short_description':intUtil['getString'](_0x569909[_0x4ba5('0x3e')],_0x45cd5d,'\x20'),'description':intUtil[_0x4ba5('0x3f')](_0x569909[_0x4ba5('0x40')],_0x45cd5d,'\x0a')},getCustomFields(_0x569909[_0x4ba5('0x41')],_0x45cd5d)),'auth':_0x5e2fe7,'json':!![]};return rp(_0x4893ac)['then'](function(_0x443f99){logger[_0x4ba5('0xe')]('['+[_0x1e7c3f['toUpperCase']()]+_0x4ba5('0x42'),_0x443f99['result']);_0x4187eb[_0x4ba5('0x43')]=_0x443f99[_0x4ba5('0xa')]['sys_id'];_0x4187eb['ticketNumber']=_0x443f99[_0x4ba5('0xa')]['number'];logger['info']('['+[_0x1e7c3f[_0x4ba5('0x13')]()]+_0x4ba5('0x44'),_0x4187eb);_0x3e2b55(_0x4187eb);})['catch'](function(_0x55ab58){logger[_0x4ba5('0x11')]('['+[_0x1e7c3f[_0x4ba5('0x13')]()]+']',_0x55ab58[_0x4ba5('0x12')]);_0x4ee84c(_0x55ab58[_0x4ba5('0x12')]);});});};}function createRemoteTag(_0x2f7d34,_0x39effc,_0x4fdbdf,_0x1084e5){return new Promise(function(_0x83892f,_0x39b0e8){var _0x213f00={'method':_0x4ba5('0x1f'),'uri':_0x4fdbdf+_0x4ba5('0x45')+'?'+_0x1084e5,'body':{'short_description':_0x2f7d34,'global':!![],'active':!![],'name':_0x2f7d34},'auth':_0x39effc,'json':!![]};return rp(_0x213f00)['then'](function(_0x58c545){var _0x2b5c52=_0x58c545['result'][_0x4ba5('0xd')];_0x83892f(_0x2b5c52);});});}function getRemoteTag(_0x326bea,_0x351771,_0xb889c5,_0x4e325a,_0x2236b3){return new Promise(function(_0x27aab5,_0x2ccc05){var _0x49bc32={'method':_0x4ba5('0x9'),'uri':_0xb889c5+_0x4ba5('0x45')+_0x4ba5('0x46')+_0x326bea+'&'+_0x4e325a,'auth':_0x351771,'json':!![]};return rp(_0x49bc32)['then'](function(_0x486dbc){if(_0x486dbc[_0x4ba5('0xa')][_0x4ba5('0xb')]>0x0){var _0x2be7d1=_0x486dbc[_0x4ba5('0xa')][0x0][_0x4ba5('0xd')];_0x27aab5(_0x2be7d1);}else{return createRemoteTag(_0x326bea,_0x351771,_0xb889c5,_0x4e325a)['then'](function(_0x3a3c62){_0x27aab5(_0x3a3c62);});}});});}function assignTagToIncident(_0x636133,_0x730938,_0x7b640c,_0x1b340e,_0x3f3556){return new Promise(function(_0x234f95,_0x54b615){var _0x3686f4={'method':'POST','uri':_0x7b640c+_0x4ba5('0x47')+'?'+_0x3f3556,'body':{'label':_0x636133,'table':'incident','id_type':_0x4ba5('0x48'),'table_key':_0x1b340e[_0x4ba5('0x43')],'title':_0x4ba5('0x49')+_0x1b340e[_0x4ba5('0x4a')],'id_display':_0x1b340e[_0x4ba5('0x4a')]},'auth':_0x730938,'json':!![]};return rp(_0x3686f4)[_0x4ba5('0x25')](function(_0x522561){_0x234f95();})[_0x4ba5('0x10')](function(){_0x234f95();});});}function manageTags(_0x1fec35,_0x1838ce,_0xbbbdc6,_0x3e814b,_0x36c914,_0x328f4e,_0x40012a){return new Promise(function(_0x5724f1,_0x769be){var _0x3fd142=[];_0x1838ce[_0x4ba5('0x2b')](function(_0x18aed6){_0x3fd142['push'](getRemoteTag(_0x18aed6,_0xbbbdc6,_0x3e814b,_0x328f4e,_0x40012a));});return Promise[_0x4ba5('0x4b')](_0x3fd142)[_0x4ba5('0x25')](function(_0x281374){if(_0x281374[_0x4ba5('0xb')]){logger[_0x4ba5('0xe')]('['+[_0x1fec35[_0x4ba5('0x13')]()]+_0x4ba5('0x4c'),_0x281374);var _0x44423a=[];_0x281374[_0x4ba5('0x2b')](function(_0x3d4828){_0x44423a[_0x4ba5('0x4d')](assignTagToIncident(_0x3d4828,_0xbbbdc6,_0x3e814b,_0x36c914,_0x328f4e));});return Promise['all'](_0x44423a)['then'](function(){_0x5724f1();})[_0x4ba5('0x10')](function(){_0x5724f1();});}else{_0x5724f1();}});});}function getTags(_0x5337a8,_0x291915,_0x47d2fc,_0x4dd456,_0x559c7a,_0x503dae){return function(_0x55a454){return new Promise(function(_0x288387,_0x121454){var _0x5a63fd=[];var _0x32a522=_0x4dd456['Tags'];if(_0x32a522&&_0x32a522[_0x4ba5('0xb')]>0x0){_0x5a63fd=_['map'](_0x32a522,_0x4ba5('0x39'));}if(_0x5a63fd[_0x4ba5('0xb')]>0x0){return manageTags(_0x5337a8,_0x5a63fd,_0x291915,_0x47d2fc,_0x55a454,_0x559c7a,_0x503dae)[_0x4ba5('0x25')](function(){_0x288387(_0x55a454);});}else{_0x288387(_0x55a454);}});};}function emit(_0x5313c8,_0x5be698,_0x5c05c8){var _0x4289f1=_0x4ba5('0x4e')+_0x4ba5('0x4f')+_0x4ba5('0x50')+_0x4ba5('0x51');var _0x81ff3={'uri':_0x5313c8+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x5c05c8+_0x4289f1};io['to'](util[_0x4ba5('0x52')](_0x4ba5('0x53'),_0x5be698))[_0x4ba5('0x54')](_0x4ba5('0x55'),_0x81ff3);}exports['cs']=function(_0x2425c5,_0xa95ba7,_0x5ac61b,_0x438e6b,_0x1cb239,_0x5b6160,_0x1203d7,_0x5f244a){var _0x66778={};var _0x525cc6={'user':_0x5b6160['username'],'pass':_0x5b6160[_0x4ba5('0x56')]};var _0x4a72b4=_0x4ba5('0x57');var _0x126fa3='sysparm_display_value=true';_0x5b6160['remoteUri']=intUtil[_0x4ba5('0x58')](_0x5b6160['remoteUri']);_0x5b6160[_0x4ba5('0x59')]=intUtil['stripTrailingSlash'](_0x5b6160[_0x4ba5('0x59')]);var _0x1317a8=util[_0x4ba5('0x52')](_0x4ba5('0x5a'),_0x5b6160[_0x4ba5('0x5b')]);_0x66778[_0x4ba5('0x16')]=!_['isNil'](_0x438e6b)?_0x438e6b['email']:null;_0x66778[_0x4ba5('0x1c')]=_0x5b6160[_0x4ba5('0x5c')];_0x66778[_0x4ba5('0x21')]=_0x5f244a[_0x4ba5('0x31')]()===_0x4ba5('0x3b')?_0xa95ba7[_0x4ba5('0x5d')]:_0xa95ba7[_0x4ba5('0x5e')];_0x66778[_0x4ba5('0x5f')]=_0x5f244a===_0x4ba5('0x60')||_0x5f244a===_0x4ba5('0x61')?_0x4ba5('0x60'):'outbound';var _0x4e73aa=util['format'](_0x4ba5('0x62'),_0x5b6160[_0x4ba5('0x59')],_0xa95ba7[_0x4ba5('0x63')],md5(_0xa95ba7['uniqueid']));if(_0x1cb239&&_0x1cb239['monitor_format']){logger[_0x4ba5('0xe')]('[QUEUE]',_0x4ba5('0x64'));_0xa95ba7[_0x4ba5('0x65')]=_0x4e73aa;}else if(_0x1203d7&&_0x1203d7[_0x4ba5('0x66')]&&_0x1203d7[_0x4ba5('0x66')]!=='none'){logger[_0x4ba5('0xe')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0xa95ba7[_0x4ba5('0x65')]=_0x4e73aa;}else{_0xa95ba7['recordingURL']='';}return getAdminUser(_0x5f244a,_0x525cc6,_0x66778,_0x1317a8,_0x126fa3,_0x4a72b4)[_0x4ba5('0x25')](getUser(_0x5f244a,_0x525cc6,_0x1317a8,_0x126fa3,_0x4a72b4))[_0x4ba5('0x25')](getEndUser(_0x5f244a,_0x525cc6,_0x1317a8,_0x126fa3,_0x4a72b4))[_0x4ba5('0x25')](getTicket(_0x5f244a,_0x525cc6,_0x1317a8,_0x5ac61b,_0xa95ba7,_0x126fa3))['then'](function(_0x3cfdd5){logger[_0x4ba5('0xe')](util['format'](_0x4ba5('0x67'),_0x3cfdd5[_0x4ba5('0x43')]));logger[_0x4ba5('0xe')](util[_0x4ba5('0x52')]('call\x20direction:\x20%s',_0x5f244a));if(_0x5f244a!=='unmanaged'){logger[_0x4ba5('0xe')]('['+[_0x5f244a[_0x4ba5('0x13')]()]+']',_0x4ba5('0x68'));emit(_0x5b6160['remoteUri'],_0x438e6b[_0x4ba5('0x39')],_0x3cfdd5['ticketId']);}})['catch'](function(_0x2af3f5){logger['error']('['+[_0x5f244a['toUpperCase']()]+_0x4ba5('0x69'),util['inspect'](_0x2af3f5,{'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 8d019a0..fe25dd4 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 _0x347e=['socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','duration_minutes','parent_id','parent_type','Contacts','direction','length','forEach','push','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','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','name_value_list','Agent\x20found!','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','first_name','','Caller\x20-\x20%s','debug','[HTTP]','merge','type','string','customField','toLowerCase','content','idField','custom_fields','variable','variableName','customVariable','Variable','login','username','password','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','trigger:browser:url','catch','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','users','charAt','unmanaged','lastevent','toUpperCase','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x347e,0xe4));var _0xe347=function(_0x159638,_0x554a3a){_0x159638=_0x159638-0x0;var _0x2160f7=_0x347e[_0x159638];return _0x2160f7;};'use strict';var _=require('lodash');var rp=require(_0xe347('0x0'));var BPromise=require(_0xe347('0x1'));var md5=require(_0xe347('0x2'));var util=require(_0xe347('0x3'));var Redis=require(_0xe347('0x4'));var intUtil=require(_0xe347('0x5'));var config=require('../../../../config/environment');var logger=require(_0xe347('0x6'))('sugarcrm');config['redis']=_[_0xe347('0x7')](config[_0xe347('0x8')],{'host':_0xe347('0x9'),'port':0x18eb});var io=require(_0xe347('0xa'))(new Redis(config[_0xe347('0x8')]));var def={'method':_0xe347('0xb'),'json':!![]};function emit(_0x295d30,_0x3795e7,_0x4f1a89){io['to'](_0x295d30)[_0xe347('0xc')](_0x3795e7,_0x4f1a89);}function getTicket(_0xbed0a7,_0x3845e4,_0x3e8e02,_0x5a00ca,_0x19c1e2,_0x210b8f,_0x8dd033,_0x5a0f7a){logger[_0xe347('0xd')](_0xe347('0xe'));var _0x17ff13=new Date();var _0x5b9790=[{'name':_0xe347('0xf'),'value':intUtil['getString'](_0x5a00ca[_0xe347('0x10')],_0x19c1e2,'\x20')},{'name':_0xe347('0x11'),'value':_0x3845e4['id']},{'name':_0xe347('0x12'),'value':_0x3845e4['id']},{'name':'description','value':intUtil['getString'](_0x5a00ca[_0xe347('0x13')],_0x19c1e2,'\x0a')},{'name':_0xe347('0x14'),'value':_0x17ff13[_0xe347('0x15')]()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0xe347('0x16'),'value':'15'},{'name':_0xe347('0x17'),'value':_0x3e8e02['id']},{'name':_0xe347('0x18'),'value':_0xe347('0x19')},{'name':'parent_name','value':_0x3e8e02[_0xe347('0xf')]},{'name':_0xe347('0x1a'),'value':_0x5a0f7a}];if(_0x210b8f[_0xe347('0x1b')]){_[_0xe347('0x1c')](_0x210b8f,function(_0x51a47b){if(_0x19c1e2[_0x51a47b['variableName']]){_0x5b9790[_0xe347('0x1d')]({'name':_0x51a47b['idField'],'value':_0x19c1e2[_0x51a47b['variableName']]});}});}return request({'form':{'method':_0xe347('0x1e'),'input_type':_0xe347('0x1f'),'response_type':'JSON','rest_data':JSON[_0xe347('0x20')]({'session':_0x8dd033['id'],'module_name':_0xe347('0x21'),'name_value_list':_0x5b9790})}});}function getAuth(_0x5dc1cc){return util[_0xe347('0x22')](_0xe347('0x23'),new Buffer(_0x5dc1cc[_0xe347('0x24')]+':X')[_0xe347('0x25')](_0xe347('0x26')));}function getServerInfo(_0x25172a){return request({'form':{'method':'get_server_info','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x25172a['id']})}});}function getUser(_0x4c02da,_0x1e982a,_0x1571b1){if(!_[_0xe347('0x27')](_0x1e982a)){logger[_0xe347('0xd')](_0xe347('0x28'),_0x1e982a);return request({'form':{'method':_0xe347('0x29'),'input_type':'JSON','response_type':_0xe347('0x1f'),'rest_data':JSON[_0xe347('0x20')]({'session':_0x1571b1['id'],'module_name':'Employees','query':util['format'](_0xe347('0x2a'),_0x1e982a),'order_by':'','offset':'0','select_fields':['id','name',_0xe347('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe347('0x2c')](function(_0x470a0d){if(_0x470a0d[_0xe347('0x2d')][_0xe347('0x1b')]){var _0x4b09fe=_['find'](_0x470a0d[_0xe347('0x2d')],function(_0x3aec28){return _0x3aec28[_0xe347('0x2e')][_0xe347('0x2b')]['value']===_0x1e982a;});if(_0x4b09fe){logger[_0xe347('0xd')](_0xe347('0x2f'));return BPromise['resolve']({'id':_0x4b09fe[_0xe347('0x2e')]['id'][_0xe347('0x30')],'name':_0x4b09fe[_0xe347('0x2e')][_0xe347('0xf')][_0xe347('0x30')]});}}logger[_0xe347('0xd')](_0xe347('0x31'));return BPromise[_0xe347('0x32')]({'id':_0x1571b1[_0xe347('0x2e')]['user_id'][_0xe347('0x30')],'name':_0x1571b1[_0xe347('0x2e')][_0xe347('0x2b')][_0xe347('0x30')]});});}else{logger[_0xe347('0xd')](_0xe347('0x33'));return BPromise['resolve']({'id':_0x1571b1[_0xe347('0x2e')]['user_id'][_0xe347('0x30')],'name':_0x1571b1[_0xe347('0x2e')][_0xe347('0x2b')][_0xe347('0x30')]});}}function getEndUser(_0x50332f,_0x36b607,_0x18dc0a,_0x30dccc){logger[_0xe347('0xd')](_0xe347('0x34'),_0x18dc0a);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0xe347('0x1f'),'rest_data':JSON[_0xe347('0x20')]({'session':_0x30dccc['id'],'module_name':'Contacts','query':util['format'](_0xe347('0x35'),_0x18dc0a),'order_by':'','offset':'0','select_fields':['id',_0xe347('0xf'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xe347('0x2c')](function(_0x3fc2c9){if(_0x3fc2c9[_0xe347('0x2d')][_0xe347('0x1b')]){var _0x203e94=_[_0xe347('0x36')](_0x3fc2c9[_0xe347('0x2d')],function(_0x3b360d){return _0x3b360d[_0xe347('0x2e')]['phone_home'][_0xe347('0x30')]===_0x18dc0a;});if(_0x203e94){logger[_0xe347('0xd')]('Enduser\x20found!');return BPromise[_0xe347('0x32')]({'id':_0x203e94[_0xe347('0x2e')]['id'][_0xe347('0x30')],'name':_0x203e94[_0xe347('0x2e')][_0xe347('0xf')][_0xe347('0x30')],'phone':_0x203e94[_0xe347('0x2e')][_0xe347('0x37')][_0xe347('0x30')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xe347('0x1e'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xe347('0x20')]({'session':_0x30dccc['id'],'module_name':_0xe347('0x19'),'name_value_list':[{'name':_0xe347('0x38'),'value':_0x36b607!==_0xe347('0x39')?_0x36b607:util[_0xe347('0x22')](_0xe347('0x3a'),_0x18dc0a)},{'name':_0xe347('0x37'),'value':_0x18dc0a}]})}})[_0xe347('0x2c')](function(_0x316db2){logger[_0xe347('0xd')]('Enduser\x20created.');return BPromise['resolve']({'id':_0x316db2['id'],'name':_0x316db2[_0xe347('0x2d')][_0xe347('0x38')][_0xe347('0x30')],'phone':_0x316db2[_0xe347('0x2d')][_0xe347('0x37')][_0xe347('0x30')]});});}});}function request(_0xa3908b){logger[_0xe347('0x3b')](_0xe347('0x3c'),JSON['stringify'](_0xa3908b));return rp(_[_0xe347('0x3d')](def,_0xa3908b));}function getTags(_0x1aa81f,_0x3014cd){var _0x4d5176=[];if(_0x1aa81f&&_0x1aa81f[_0xe347('0x1b')]>0x0){_0x4d5176=_['map'](_0x1aa81f,_0x3014cd);}return _0x4d5176;}function getCustomFields(_0x486644,_0x238684){var _0x364139=[];var _0x6ba33f={'custom_fields':[]};if(_0x486644[_0xe347('0x1b')]>0x0){_['forEach'](_0x486644,function(_0x56d804){if(_0x56d804[_0xe347('0x3e')]===_0xe347('0x3f')&&_0x56d804['nameField']&&!_0x56d804[_0xe347('0x40')]){_0x6ba33f[_0x56d804['nameField'][_0xe347('0x41')]()]=_0x56d804[_0xe347('0x42')][_0xe347('0x25')]();}else if(_0x56d804[_0xe347('0x3e')]==='string'&&_0x56d804[_0xe347('0x43')]&&_0x56d804[_0xe347('0x40')]){_0x6ba33f[_0xe347('0x44')][_0xe347('0x1d')]({'id':_0x56d804[_0xe347('0x43')],'value':_0x56d804[_0xe347('0x42')][_0xe347('0x25')]()});}else if(_0x56d804['type']===_0xe347('0x45')&&_0x56d804[_0xe347('0x46')]&&_0x56d804[_0xe347('0x43')]&&_0x56d804[_0xe347('0x40')]){_0x238684[_0x56d804[_0xe347('0x46')]]&&_0x6ba33f[_0xe347('0x44')][_0xe347('0x1d')]({'id':_0x56d804[_0xe347('0x43')],'value':_0x238684[_0x56d804[_0xe347('0x46')]][_0xe347('0x25')]()});}else if(_0x56d804[_0xe347('0x3e')]===_0xe347('0x47')&&_0x56d804['Variable']&&_0x56d804[_0xe347('0x48')][_0xe347('0xf')]&&_0x56d804['idField']&&_0x56d804[_0xe347('0x40')]){_0x238684[_0x56d804[_0xe347('0x48')][_0xe347('0xf')][_0xe347('0x41')]()]&&_0x6ba33f['custom_fields']['push']({'id':_0x56d804['idField'],'value':_0x238684[_0x56d804['Variable']['name'][_0xe347('0x41')]()][_0xe347('0x25')]()});}});}return _0x6ba33f;}function getConnection(_0x30d9f9){return request({'method':_0xe347('0xb'),'form':{'method':_0xe347('0x49'),'input_type':_0xe347('0x1f'),'response_type':_0xe347('0x1f'),'rest_data':JSON[_0xe347('0x20')]({'user_auth':{'user_name':_0x30d9f9[_0xe347('0x4a')],'password':_0x30d9f9[_0xe347('0x4b')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xe347('0x2c')](function(_0x10245a){var _0x1c3373=_0x10245a;if(_0x1c3373['id']){def[_0xe347('0x4c')]=_0x1c3373['id'];return BPromise[_0xe347('0x32')](_0x1c3373);}else{throw new Error(util[_0xe347('0x22')](_0xe347('0x4d'),_0x30d9f9['id']));}});}function setRelationship(_0x15143c,_0x54b867,_0x1b7dd0,_0x4d57f6){return request({'form':{'method':_0xe347('0x4e'),'input_type':'JSON','response_type':_0xe347('0x1f'),'rest_data':JSON['stringify']({'session':_0x15143c['id'],'module_name':_0xe347('0x21'),'module_id':_0x1b7dd0['id'],'link_field_name':_0x4d57f6,'related_ids':[_0x54b867['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xe347('0x4f')]=function(_0x2712cf,_0x453d86,_0x1bfc3b,_0x26ace5,_0x1bee52,_0x2b7273){var _0x5b1131,_0x90e73a,_0x3e28dc,_0x16a6b1;_0x2b7273['remoteUri']=intUtil[_0xe347('0x50')](_0x2b7273['remoteUri']);_0x2b7273['serverUrl']=intUtil[_0xe347('0x50')](_0x2b7273[_0xe347('0x51')]);def[_0xe347('0x52')]=util[_0xe347('0x22')]('%s/service/v4_1/rest.php',_0x2b7273[_0xe347('0x53')]);if(_0x1bee52&&_0x1bee52[_0xe347('0x54')]){logger[_0xe347('0xd')](_0xe347('0x55'),_0xe347('0x56'));_0x453d86[_0xe347('0x57')]=util[_0xe347('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b7273[_0xe347('0x51')],_0x453d86['uniqueid'],md5(_0x453d86[_0xe347('0x58')]));}else{_0x453d86[_0xe347('0x57')]='';}return getConnection(_0x2b7273)[_0xe347('0x2c')](function(_0x3b9eeb){_0x16a6b1=_0x3b9eeb;return getUser(_0x2b7273,_0x26ace5[_0xe347('0xf')],_0x16a6b1);})['then'](function(_0x3ea6ce){_0x5b1131=_0x3ea6ce;logger[_0xe347('0xd')]('The\x20User\x20ID\x20is:',_0x5b1131['id']);return getEndUser(_0x2b7273,_0x453d86[_0xe347('0x59')],_0x453d86[_0xe347('0x5a')],_0x16a6b1);})[_0xe347('0x2c')](function(_0x3aa36e){_0x90e73a=_0x3aa36e;logger[_0xe347('0xd')](_0xe347('0x5b'),_0x90e73a['id']);return getTicket(_0x2b7273,_0x5b1131,_0x90e73a,_0x1bfc3b,_0x453d86,_0x1bfc3b['Fields'],_0x16a6b1,_0xe347('0x5c'));})[_0xe347('0x2c')](function(_0x1e3a30){_0x3e28dc=_0x1e3a30;logger[_0xe347('0xd')](_0xe347('0x5d'));logger[_0xe347('0xd')](_0xe347('0x5e'),_0x3e28dc['id']);return setRelationship(_0x16a6b1,_0x5b1131,_0x3e28dc,'users');})[_0xe347('0x2c')](function(){return setRelationship(_0x16a6b1,_0x90e73a,_0x3e28dc,_0xe347('0x5f'));})['then'](function(){return getServerInfo(_0x16a6b1);})[_0xe347('0x2c')](function(_0x4f994c){var _0x23aee5=parseInt(_0x4f994c[_0xe347('0x60')]['charAt'](0x0));var _0x2c9c2a=util[_0xe347('0x22')](_0xe347('0x61'),_0x2b7273[_0xe347('0x53')],_0x3e28dc['id']);if(_0x23aee5>0x6){_0x2c9c2a=util['format'](_0xe347('0x62'),_0x2b7273[_0xe347('0x53')],_0x3e28dc['id']);}logger[_0xe347('0xd')](_0xe347('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe347('0x22')](_0xe347('0x63'),_0x26ace5[_0xe347('0xf')]),_0xe347('0x64'),{'uri':_0x2c9c2a});})[_0xe347('0x65')](function(_0x281882){logger[_0xe347('0x66')](_0xe347('0x55'),JSON[_0xe347('0x20')](_0x281882));});};exports[_0xe347('0x67')]=function(_0x3c0287,_0x4e0d6c,_0x2f0c68,_0x585611,_0x3c31a9,_0x5dc83c,_0x4a7307){var _0x576481,_0x530cc6,_0x2e0ea3,_0x1544f0;_0x5dc83c[_0xe347('0x53')]=intUtil[_0xe347('0x50')](_0x5dc83c[_0xe347('0x53')]);_0x5dc83c['serverUrl']=intUtil[_0xe347('0x50')](_0x5dc83c['serverUrl']);def['uri']=util[_0xe347('0x22')](_0xe347('0x68'),_0x5dc83c[_0xe347('0x53')]);if(_0x4a7307&&_0x4a7307[_0xe347('0x69')]&&_0x4a7307['recordingFormat']!==_0xe347('0x6a')){logger[_0xe347('0xd')](_0xe347('0x6b'),_0xe347('0x56'));_0x4e0d6c[_0xe347('0x57')]=util['format'](_0xe347('0x6c'),_0x5dc83c[_0xe347('0x51')],_0x4e0d6c[_0xe347('0x58')],md5(_0x4e0d6c[_0xe347('0x58')]));}return getConnection(_0x5dc83c)[_0xe347('0x2c')](function(_0xe1e74a){_0x1544f0=_0xe1e74a;return getUser(_0x5dc83c,_0x585611[_0xe347('0xf')],_0x1544f0);})[_0xe347('0x2c')](function(_0x492cfa){_0x576481=_0x492cfa;logger['info'](_0xe347('0x6d'),_0x576481['id']);return getEndUser(_0x5dc83c,_0x4e0d6c[_0xe347('0x6e')],_0x4e0d6c[_0xe347('0x6f')],_0x1544f0);})[_0xe347('0x2c')](function(_0x2a812f){_0x530cc6=_0x2a812f;logger[_0xe347('0xd')](_0xe347('0x5b'),_0x530cc6['id']);return getTicket(_0x5dc83c,_0x576481,_0x530cc6,_0x2f0c68,_0x4e0d6c,_0x2f0c68[_0xe347('0x70')],_0x1544f0,_0xe347('0x71'));})[_0xe347('0x2c')](function(_0x198561){_0x2e0ea3=_0x198561;logger['info']('Ticket\x20created!');logger[_0xe347('0xd')](_0xe347('0x5e'),_0x2e0ea3['id']);return setRelationship(_0x1544f0,_0x576481,_0x2e0ea3,_0xe347('0x72'));})[_0xe347('0x2c')](function(){return setRelationship(_0x1544f0,_0x530cc6,_0x2e0ea3,_0xe347('0x5f'));})[_0xe347('0x2c')](function(){return getServerInfo(_0x1544f0);})[_0xe347('0x2c')](function(_0x373b9f){var _0x57cf0f=parseInt(_0x373b9f[_0xe347('0x60')][_0xe347('0x73')](0x0));var _0x30a143=util[_0xe347('0x22')](_0xe347('0x61'),_0x5dc83c[_0xe347('0x53')],_0x2e0ea3['id']);if(_0x57cf0f>0x6){_0x30a143=util['format'](_0xe347('0x62'),_0x5dc83c[_0xe347('0x53')],_0x2e0ea3['id']);}logger[_0xe347('0xd')](_0xe347('0x6b'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xe347('0x22')](_0xe347('0x63'),_0x585611['name']),'trigger:browser:url',{'uri':_0x30a143});})[_0xe347('0x65')](function(_0x2d45ab){logger['error']('[OUTBOUND]',JSON[_0xe347('0x20')](_0x2d45ab));});};exports[_0xe347('0x74')]=function(_0x1384d6,_0x29645c,_0x5c9f70,_0x5bf857,_0x51f798,_0x36bea5){var _0x11412f,_0x35c5e9,_0x1bc223,_0x52f588;_0x36bea5[_0xe347('0x53')]=intUtil[_0xe347('0x50')](_0x36bea5[_0xe347('0x53')]);_0x36bea5['serverUrl']=intUtil['stripTrailingSlash'](_0x36bea5[_0xe347('0x51')]);def[_0xe347('0x52')]=util[_0xe347('0x22')](_0xe347('0x68'),_0x36bea5[_0xe347('0x53')]);if(_0x51f798&&_0x51f798[_0xe347('0x54')]){logger[_0xe347('0xd')]('['+_0x29645c[_0xe347('0x75')]['toUpperCase']()+']',_0xe347('0x56'));_0x29645c[_0xe347('0x57')]=util[_0xe347('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x36bea5[_0xe347('0x51')],_0x29645c[_0xe347('0x58')],md5(_0x29645c[_0xe347('0x58')]));}else{_0x29645c[_0xe347('0x57')]='';}return getConnection(_0x36bea5)[_0xe347('0x2c')](function(_0x672dca){_0x52f588=_0x672dca;if(!_[_0xe347('0x27')](_0x5bf857)){return getUser(_0x36bea5,_0x5bf857[_0xe347('0xf')],_0x52f588);}else{return getUser(_0x36bea5,null,_0x52f588);}})[_0xe347('0x2c')](function(_0xf01e74){_0x11412f=_0xf01e74;logger[_0xe347('0xd')]('The\x20User\x20ID\x20is:',_0x11412f['id']);return getEndUser(_0x36bea5,_0x29645c[_0xe347('0x59')],_0x29645c['calleridnum'],_0x52f588);})[_0xe347('0x2c')](function(_0x664435){_0x35c5e9=_0x664435;logger[_0xe347('0xd')](_0xe347('0x5b'),_0x35c5e9['id']);return getTicket(_0x36bea5,_0x11412f,_0x35c5e9,_0x5c9f70,_0x29645c,_0x5c9f70['Fields'],_0x52f588,'Inbound');})[_0xe347('0x2c')](function(_0x4fed3c){_0x1bc223=_0x4fed3c;logger[_0xe347('0xd')]('Ticket\x20created!');logger['info'](_0xe347('0x5e'),_0x1bc223['id']);return setRelationship(_0x52f588,_0x11412f,_0x1bc223,_0xe347('0x72'));})[_0xe347('0x2c')](function(){return setRelationship(_0x52f588,_0x35c5e9,_0x1bc223,_0xe347('0x5f'));})[_0xe347('0x2c')](function(){return getServerInfo(_0x52f588);})[_0xe347('0x65')](function(_0x290e19){logger[_0xe347('0x66')]('['+_0x29645c[_0xe347('0x75')][_0xe347('0x76')]()+']',JSON[_0xe347('0x20')](_0x290e19));});}; \ No newline at end of file +var _0x02fa=['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','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridname','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','emit','info','Creating\x20new\x20ticket...','getString','created_by','description','date_start','slice','replace','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','length','forEach','variableName','push','idField','set_entry','JSON','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','entry_list','user_name','value','Agent\x20found!','resolve','name_value_list','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','find','first_name','','Caller\x20-\x20%s','debug','[HTTP]','map','string','nameField','customField','toLowerCase','content','type','custom_fields','variable','customVariable','Variable','POST','login','username','password','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Fields'];(function(_0x5924de,_0x183d00){var _0x54c8f3=function(_0xb1fd1b){while(--_0xb1fd1b){_0x5924de['push'](_0x5924de['shift']());}};_0x54c8f3(++_0x183d00);}(_0x02fa,0x178));var _0xa02f=function(_0x6ae5a2,_0x8a01b9){_0x6ae5a2=_0x6ae5a2-0x0;var _0x38c1fc=_0x02fa[_0x6ae5a2];return _0x38c1fc;};'use strict';var _=require(_0xa02f('0x0'));var rp=require(_0xa02f('0x1'));var BPromise=require(_0xa02f('0x2'));var md5=require('md5');var util=require(_0xa02f('0x3'));var Redis=require(_0xa02f('0x4'));var intUtil=require('./util');var config=require(_0xa02f('0x5'));var logger=require(_0xa02f('0x6'))(_0xa02f('0x7'));config[_0xa02f('0x8')]=_['defaults'](config[_0xa02f('0x8')],{'host':_0xa02f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa02f('0x8')]));var def={'method':'POST','json':!![]};function emit(_0x2b8f75,_0x11e100,_0x3a5e7f){io['to'](_0x2b8f75)[_0xa02f('0xa')](_0x11e100,_0x3a5e7f);}function getTicket(_0x2ed689,_0x27c2d9,_0x188768,_0xc53e32,_0xd1a196,_0x18091c,_0x537322,_0x249fe0){logger[_0xa02f('0xb')](_0xa02f('0xc'));var _0x5c4844=new Date();var _0x415ad3=[{'name':'name','value':intUtil[_0xa02f('0xd')](_0xc53e32['Subjects'],_0xd1a196,'\x20')},{'name':'assigned_user_id','value':_0x27c2d9['id']},{'name':_0xa02f('0xe'),'value':_0x27c2d9['id']},{'name':_0xa02f('0xf'),'value':intUtil[_0xa02f('0xd')](_0xc53e32['Descriptions'],_0xd1a196,'\x0a')},{'name':_0xa02f('0x10'),'value':_0x5c4844['toISOString']()[_0xa02f('0x11')](0x0,0x13)[_0xa02f('0x12')]('T','\x20')},{'name':_0xa02f('0x13'),'value':'0'},{'name':_0xa02f('0x14'),'value':'15'},{'name':_0xa02f('0x15'),'value':_0x188768['id']},{'name':_0xa02f('0x16'),'value':_0xa02f('0x17')},{'name':_0xa02f('0x18'),'value':_0x188768[_0xa02f('0x19')]},{'name':'direction','value':_0x249fe0}];if(_0x18091c[_0xa02f('0x1a')]){_[_0xa02f('0x1b')](_0x18091c,function(_0x3d2af3){if(_0xd1a196[_0x3d2af3[_0xa02f('0x1c')]]){_0x415ad3[_0xa02f('0x1d')]({'name':_0x3d2af3[_0xa02f('0x1e')],'value':_0xd1a196[_0x3d2af3[_0xa02f('0x1c')]]});}});}return request({'form':{'method':_0xa02f('0x1f'),'input_type':_0xa02f('0x20'),'response_type':_0xa02f('0x20'),'rest_data':JSON['stringify']({'session':_0x537322['id'],'module_name':'Calls','name_value_list':_0x415ad3})}});}function getAuth(_0x293d80){return util[_0xa02f('0x21')](_0xa02f('0x22'),new Buffer(_0x293d80[_0xa02f('0x23')]+':X')[_0xa02f('0x24')]('base64'));}function getServerInfo(_0x161198){return request({'form':{'method':_0xa02f('0x25'),'input_type':_0xa02f('0x20'),'response_type':_0xa02f('0x20'),'rest_data':JSON[_0xa02f('0x26')]({'session':_0x161198['id']})}});}function getUser(_0x3aecd0,_0xd2c68b,_0x3f7a05){if(!_[_0xa02f('0x27')](_0xd2c68b)){logger[_0xa02f('0xb')](_0xa02f('0x28'),_0xd2c68b);return request({'form':{'method':_0xa02f('0x29'),'input_type':_0xa02f('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3f7a05['id'],'module_name':'Employees','query':util[_0xa02f('0x21')](_0xa02f('0x2a'),_0xd2c68b),'order_by':'','offset':'0','select_fields':['id','name','user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5a5a3c){if(_0x5a5a3c[_0xa02f('0x2b')][_0xa02f('0x1a')]){var _0x8d48bb=_['find'](_0x5a5a3c[_0xa02f('0x2b')],function(_0x1194ce){return _0x1194ce['name_value_list'][_0xa02f('0x2c')][_0xa02f('0x2d')]===_0xd2c68b;});if(_0x8d48bb){logger[_0xa02f('0xb')](_0xa02f('0x2e'));return BPromise[_0xa02f('0x2f')]({'id':_0x8d48bb[_0xa02f('0x30')]['id'][_0xa02f('0x2d')],'name':_0x8d48bb[_0xa02f('0x30')][_0xa02f('0x19')]['value']});}}logger[_0xa02f('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x3f7a05[_0xa02f('0x30')][_0xa02f('0x31')]['value'],'name':_0x3f7a05['name_value_list'][_0xa02f('0x2c')]['value']});});}else{logger[_0xa02f('0xb')](_0xa02f('0x32'));return BPromise['resolve']({'id':_0x3f7a05[_0xa02f('0x30')]['user_id']['value'],'name':_0x3f7a05[_0xa02f('0x30')][_0xa02f('0x2c')][_0xa02f('0x2d')]});}}function getEndUser(_0x163663,_0x355eb8,_0x3f0e3c,_0x471fa7){logger[_0xa02f('0xb')](_0xa02f('0x33'),_0x3f0e3c);return request({'form':{'method':_0xa02f('0x29'),'input_type':'JSON','response_type':_0xa02f('0x20'),'rest_data':JSON['stringify']({'session':_0x471fa7['id'],'module_name':_0xa02f('0x17'),'query':util[_0xa02f('0x21')](_0xa02f('0x34'),_0x3f0e3c),'order_by':'','offset':'0','select_fields':['id',_0xa02f('0x19'),_0xa02f('0x35')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa02f('0x36')](function(_0xcc5680){if(_0xcc5680[_0xa02f('0x2b')]['length']){var _0x4cce31=_[_0xa02f('0x37')](_0xcc5680[_0xa02f('0x2b')],function(_0x527f50){return _0x527f50['name_value_list']['phone_home']['value']===_0x3f0e3c;});if(_0x4cce31){logger[_0xa02f('0xb')]('Enduser\x20found!');return BPromise['resolve']({'id':_0x4cce31[_0xa02f('0x30')]['id'][_0xa02f('0x2d')],'name':_0x4cce31[_0xa02f('0x30')][_0xa02f('0x19')]['value'],'phone':_0x4cce31['name_value_list'][_0xa02f('0x35')][_0xa02f('0x2d')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xa02f('0x1f'),'input_type':_0xa02f('0x20'),'response_type':_0xa02f('0x20'),'rest_data':JSON[_0xa02f('0x26')]({'session':_0x471fa7['id'],'module_name':_0xa02f('0x17'),'name_value_list':[{'name':_0xa02f('0x38'),'value':_0x355eb8!==_0xa02f('0x39')?_0x355eb8:util[_0xa02f('0x21')](_0xa02f('0x3a'),_0x3f0e3c)},{'name':'phone_home','value':_0x3f0e3c}]})}})[_0xa02f('0x36')](function(_0x1d722b){logger[_0xa02f('0xb')]('Enduser\x20created.');return BPromise[_0xa02f('0x2f')]({'id':_0x1d722b['id'],'name':_0x1d722b[_0xa02f('0x2b')]['first_name'][_0xa02f('0x2d')],'phone':_0x1d722b[_0xa02f('0x2b')]['phone_home'][_0xa02f('0x2d')]});});}});}function request(_0xda9a39){logger[_0xa02f('0x3b')](_0xa02f('0x3c'),JSON[_0xa02f('0x26')](_0xda9a39));return rp(_['merge'](def,_0xda9a39));}function getTags(_0x30867e,_0x354a06){var _0x10eef1=[];if(_0x30867e&&_0x30867e[_0xa02f('0x1a')]>0x0){_0x10eef1=_[_0xa02f('0x3d')](_0x30867e,_0x354a06);}return _0x10eef1;}function getCustomFields(_0x4d634c,_0x25c1da){var _0x5b0b34=[];var _0x3f1cca={'custom_fields':[]};if(_0x4d634c[_0xa02f('0x1a')]>0x0){_[_0xa02f('0x1b')](_0x4d634c,function(_0xaaa4eb){if(_0xaaa4eb['type']===_0xa02f('0x3e')&&_0xaaa4eb[_0xa02f('0x3f')]&&!_0xaaa4eb[_0xa02f('0x40')]){_0x3f1cca[_0xaaa4eb['nameField'][_0xa02f('0x41')]()]=_0xaaa4eb[_0xa02f('0x42')]['toString']();}else if(_0xaaa4eb[_0xa02f('0x43')]===_0xa02f('0x3e')&&_0xaaa4eb['idField']&&_0xaaa4eb[_0xa02f('0x40')]){_0x3f1cca[_0xa02f('0x44')]['push']({'id':_0xaaa4eb[_0xa02f('0x1e')],'value':_0xaaa4eb[_0xa02f('0x42')][_0xa02f('0x24')]()});}else if(_0xaaa4eb[_0xa02f('0x43')]===_0xa02f('0x45')&&_0xaaa4eb['variableName']&&_0xaaa4eb[_0xa02f('0x1e')]&&_0xaaa4eb[_0xa02f('0x40')]){_0x25c1da[_0xaaa4eb[_0xa02f('0x1c')]]&&_0x3f1cca[_0xa02f('0x44')][_0xa02f('0x1d')]({'id':_0xaaa4eb[_0xa02f('0x1e')],'value':_0x25c1da[_0xaaa4eb['variableName']][_0xa02f('0x24')]()});}else if(_0xaaa4eb[_0xa02f('0x43')]===_0xa02f('0x46')&&_0xaaa4eb[_0xa02f('0x47')]&&_0xaaa4eb[_0xa02f('0x47')]['name']&&_0xaaa4eb[_0xa02f('0x1e')]&&_0xaaa4eb[_0xa02f('0x40')]){_0x25c1da[_0xaaa4eb[_0xa02f('0x47')][_0xa02f('0x19')]['toLowerCase']()]&&_0x3f1cca[_0xa02f('0x44')][_0xa02f('0x1d')]({'id':_0xaaa4eb['idField'],'value':_0x25c1da[_0xaaa4eb[_0xa02f('0x47')]['name'][_0xa02f('0x41')]()][_0xa02f('0x24')]()});}});}return _0x3f1cca;}function getConnection(_0x5e9a1c){return request({'method':_0xa02f('0x48'),'form':{'method':_0xa02f('0x49'),'input_type':_0xa02f('0x20'),'response_type':_0xa02f('0x20'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x5e9a1c[_0xa02f('0x4a')],'password':_0x5e9a1c[_0xa02f('0x4b')],'encryption':'PLAIN'},'application':_0xa02f('0x4c')})}})[_0xa02f('0x36')](function(_0x2e4783){var _0x4f907e=_0x2e4783;if(_0x4f907e['id']){def['sessionID']=_0x4f907e['id'];return BPromise[_0xa02f('0x2f')](_0x4f907e);}else{throw new Error(util['format'](_0xa02f('0x4d'),_0x5e9a1c['id']));}});}function setRelationship(_0x43a798,_0x332976,_0xaa6bfe,_0x48251d){return request({'form':{'method':'set_relationship','input_type':_0xa02f('0x20'),'response_type':_0xa02f('0x20'),'rest_data':JSON[_0xa02f('0x26')]({'session':_0x43a798['id'],'module_name':_0xa02f('0x4e'),'module_id':_0xaa6bfe['id'],'link_field_name':_0x48251d,'related_ids':[_0x332976['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xa02f('0x4f')]=function(_0x4fe581,_0x30bb87,_0x1a6c6f,_0x4b20fe,_0x4c54d5,_0x2b4e55){var _0x5c4e85,_0x337f82,_0x469875,_0x4fb637;_0x2b4e55[_0xa02f('0x50')]=intUtil[_0xa02f('0x51')](_0x2b4e55[_0xa02f('0x50')]);_0x2b4e55[_0xa02f('0x52')]=intUtil['stripTrailingSlash'](_0x2b4e55[_0xa02f('0x52')]);def[_0xa02f('0x53')]=util['format'](_0xa02f('0x54'),_0x2b4e55[_0xa02f('0x50')]);if(_0x4c54d5&&_0x4c54d5[_0xa02f('0x55')]){logger[_0xa02f('0xb')](_0xa02f('0x56'),'Recording\x20is\x20enabled!');_0x30bb87['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2b4e55['serverUrl'],_0x30bb87['uniqueid'],md5(_0x30bb87['uniqueid']));}else{_0x30bb87[_0xa02f('0x57')]='';}return getConnection(_0x2b4e55)[_0xa02f('0x36')](function(_0x553fa){_0x4fb637=_0x553fa;return getUser(_0x2b4e55,_0x4b20fe[_0xa02f('0x19')],_0x4fb637);})['then'](function(_0x14725d){_0x5c4e85=_0x14725d;logger[_0xa02f('0xb')](_0xa02f('0x58'),_0x5c4e85['id']);return getEndUser(_0x2b4e55,_0x30bb87['calleridname'],_0x30bb87[_0xa02f('0x59')],_0x4fb637);})[_0xa02f('0x36')](function(_0x484622){_0x337f82=_0x484622;logger[_0xa02f('0xb')](_0xa02f('0x5a'),_0x337f82['id']);return getTicket(_0x2b4e55,_0x5c4e85,_0x337f82,_0x1a6c6f,_0x30bb87,_0x1a6c6f[_0xa02f('0x5b')],_0x4fb637,_0xa02f('0x5c'));})[_0xa02f('0x36')](function(_0x6c751f){_0x469875=_0x6c751f;logger['info'](_0xa02f('0x5d'));logger[_0xa02f('0xb')](_0xa02f('0x5e'),_0x469875['id']);return setRelationship(_0x4fb637,_0x5c4e85,_0x469875,_0xa02f('0x5f'));})[_0xa02f('0x36')](function(){return setRelationship(_0x4fb637,_0x337f82,_0x469875,_0xa02f('0x60'));})[_0xa02f('0x36')](function(){return getServerInfo(_0x4fb637);})['then'](function(_0x77ed1a){var _0xf600df=parseInt(_0x77ed1a[_0xa02f('0x61')][_0xa02f('0x62')](0x0));var _0x34485a=util[_0xa02f('0x21')](_0xa02f('0x63'),_0x2b4e55['remoteUri'],_0x469875['id']);if(_0xf600df>0x6){_0x34485a=util[_0xa02f('0x21')](_0xa02f('0x64'),_0x2b4e55[_0xa02f('0x50')],_0x469875['id']);}logger[_0xa02f('0xb')](_0xa02f('0x56'),_0xa02f('0x65'));emit(util[_0xa02f('0x21')]('user:%s',_0x4b20fe[_0xa02f('0x19')]),_0xa02f('0x66'),{'uri':_0x34485a});})[_0xa02f('0x67')](function(_0x374087){logger[_0xa02f('0x68')]('[QUEUE]',JSON['stringify'](_0x374087));});};exports[_0xa02f('0x69')]=function(_0x46f84d,_0x5bb94d,_0x2301c1,_0x4a8a18,_0xd12a63,_0x4af290,_0x4846e2){var _0x2a5965,_0x52af09,_0x24694a,_0x2f7215;_0x4af290[_0xa02f('0x50')]=intUtil['stripTrailingSlash'](_0x4af290[_0xa02f('0x50')]);_0x4af290[_0xa02f('0x52')]=intUtil[_0xa02f('0x51')](_0x4af290[_0xa02f('0x52')]);def[_0xa02f('0x53')]=util[_0xa02f('0x21')](_0xa02f('0x54'),_0x4af290[_0xa02f('0x50')]);if(_0x4846e2&&_0x4846e2[_0xa02f('0x6a')]&&_0x4846e2[_0xa02f('0x6a')]!==_0xa02f('0x6b')){logger[_0xa02f('0xb')](_0xa02f('0x6c'),_0xa02f('0x6d'));_0x5bb94d[_0xa02f('0x57')]=util[_0xa02f('0x21')](_0xa02f('0x6e'),_0x4af290[_0xa02f('0x52')],_0x5bb94d[_0xa02f('0x6f')],md5(_0x5bb94d['uniqueid']));}return getConnection(_0x4af290)[_0xa02f('0x36')](function(_0x9a1a47){_0x2f7215=_0x9a1a47;return getUser(_0x4af290,_0x4a8a18[_0xa02f('0x19')],_0x2f7215);})[_0xa02f('0x36')](function(_0x20e534){_0x2a5965=_0x20e534;logger['info'](_0xa02f('0x58'),_0x2a5965['id']);return getEndUser(_0x4af290,_0x5bb94d[_0xa02f('0x70')],_0x5bb94d['destcalleridnum'],_0x2f7215);})[_0xa02f('0x36')](function(_0x5b1815){_0x52af09=_0x5b1815;logger[_0xa02f('0xb')](_0xa02f('0x5a'),_0x52af09['id']);return getTicket(_0x4af290,_0x2a5965,_0x52af09,_0x2301c1,_0x5bb94d,_0x2301c1[_0xa02f('0x5b')],_0x2f7215,'Outbound');})[_0xa02f('0x36')](function(_0x92d9d3){_0x24694a=_0x92d9d3;logger[_0xa02f('0xb')](_0xa02f('0x5d'));logger['info'](_0xa02f('0x5e'),_0x24694a['id']);return setRelationship(_0x2f7215,_0x2a5965,_0x24694a,_0xa02f('0x5f'));})[_0xa02f('0x36')](function(){return setRelationship(_0x2f7215,_0x52af09,_0x24694a,_0xa02f('0x60'));})['then'](function(){return getServerInfo(_0x2f7215);})[_0xa02f('0x36')](function(_0x3533a0){var _0x4bc318=parseInt(_0x3533a0[_0xa02f('0x61')][_0xa02f('0x62')](0x0));var _0x19d4c9=util[_0xa02f('0x21')](_0xa02f('0x63'),_0x4af290[_0xa02f('0x50')],_0x24694a['id']);if(_0x4bc318>0x6){_0x19d4c9=util[_0xa02f('0x21')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x4af290[_0xa02f('0x50')],_0x24694a['id']);}logger['info'](_0xa02f('0x6c'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x4a8a18['name']),_0xa02f('0x66'),{'uri':_0x19d4c9});})['catch'](function(_0x1c6375){logger['error'](_0xa02f('0x6c'),JSON['stringify'](_0x1c6375));});};exports[_0xa02f('0x71')]=function(_0x18467f,_0x5117f9,_0x41fc1b,_0x5ddc8c,_0x21256b,_0x4c729a){var _0x5b1c9b,_0x1d02a9,_0x573ecd,_0x57dc9c;_0x4c729a[_0xa02f('0x50')]=intUtil['stripTrailingSlash'](_0x4c729a[_0xa02f('0x50')]);_0x4c729a[_0xa02f('0x52')]=intUtil['stripTrailingSlash'](_0x4c729a[_0xa02f('0x52')]);def['uri']=util[_0xa02f('0x21')]('%s/service/v4_1/rest.php',_0x4c729a['remoteUri']);if(_0x21256b&&_0x21256b[_0xa02f('0x55')]){logger[_0xa02f('0xb')]('['+_0x5117f9[_0xa02f('0x72')][_0xa02f('0x73')]()+']','Recording\x20is\x20enabled!');_0x5117f9[_0xa02f('0x57')]=util['format'](_0xa02f('0x6e'),_0x4c729a['serverUrl'],_0x5117f9[_0xa02f('0x6f')],md5(_0x5117f9['uniqueid']));}else{_0x5117f9[_0xa02f('0x57')]='';}return getConnection(_0x4c729a)['then'](function(_0x5446b8){_0x57dc9c=_0x5446b8;if(!_[_0xa02f('0x27')](_0x5ddc8c)){return getUser(_0x4c729a,_0x5ddc8c[_0xa02f('0x19')],_0x57dc9c);}else{return getUser(_0x4c729a,null,_0x57dc9c);}})[_0xa02f('0x36')](function(_0x465c75){_0x5b1c9b=_0x465c75;logger[_0xa02f('0xb')](_0xa02f('0x58'),_0x5b1c9b['id']);return getEndUser(_0x4c729a,_0x5117f9[_0xa02f('0x74')],_0x5117f9['calleridnum'],_0x57dc9c);})[_0xa02f('0x36')](function(_0xbd388d){_0x1d02a9=_0xbd388d;logger['info']('The\x20Enduser\x20ID\x20is:',_0x1d02a9['id']);return getTicket(_0x4c729a,_0x5b1c9b,_0x1d02a9,_0x41fc1b,_0x5117f9,_0x41fc1b[_0xa02f('0x5b')],_0x57dc9c,_0xa02f('0x5c'));})[_0xa02f('0x36')](function(_0x4790a8){_0x573ecd=_0x4790a8;logger[_0xa02f('0xb')](_0xa02f('0x5d'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x573ecd['id']);return setRelationship(_0x57dc9c,_0x5b1c9b,_0x573ecd,_0xa02f('0x5f'));})['then'](function(){return setRelationship(_0x57dc9c,_0x1d02a9,_0x573ecd,_0xa02f('0x60'));})[_0xa02f('0x36')](function(){return getServerInfo(_0x57dc9c);})[_0xa02f('0x67')](function(_0x496be8){logger[_0xa02f('0x68')]('['+_0x5117f9[_0xa02f('0x72')][_0xa02f('0x73')]()+']',JSON['stringify'](_0x496be8));});}; \ 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 93f173e..1645e4c 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 _0xd03c=['push','content','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','string','key','format','%s:\x20%s','customVariable','stripTrailingSlash','slice','lastIndexOf','validateEmail','lodash','util','getString','length','sortBy','type'];(function(_0x352b8d,_0x440622){var _0x6d658d=function(_0x83f47a){while(--_0x83f47a){_0x352b8d['push'](_0x352b8d['shift']());}};_0x6d658d(++_0x440622);}(_0xd03c,0x1d5));var _0xcd03=function(_0x4b9af7,_0x5beb2c){_0x4b9af7=_0x4b9af7-0x0;var _0x37207d=_0xd03c[_0x4b9af7];return _0x37207d;};'use strict';var _=require(_0xcd03('0x0'));var util=require(_0xcd03('0x1'));exports[_0xcd03('0x2')]=function(_0x19a9aa,_0x311a44,_0x288e17){var _0x22e605=[];if(_0x19a9aa[_0xcd03('0x3')]>0x0){var _0xfc1e59=_[_0xcd03('0x4')](_0x19a9aa,['id']);for(var _0x1b4d1f=0x0;_0x1b4d1f<_0xfc1e59[_0xcd03('0x3')];_0x1b4d1f++){var _0x293e79=_0xfc1e59[_0x1b4d1f];if(_0x293e79[_0xcd03('0x5')]==='string'){_0x22e605[_0xcd03('0x6')](_0x293e79[_0xcd03('0x7')]);}else if(_0x293e79[_0xcd03('0x5')]===_0xcd03('0x8')&&_0x293e79[_0xcd03('0x9')]){_0x311a44[_0x293e79[_0xcd03('0x9')]]&&_0x22e605['push'](_0x311a44[_0x293e79[_0xcd03('0x9')]][_0xcd03('0xa')]());}else if(_0x293e79[_0xcd03('0x5')]==='customVariable'&&_0x293e79[_0xcd03('0xb')]&&_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')]){_0x311a44[_0x293e79[_0xcd03('0xb')]['name'][_0xcd03('0xd')]()]&&_0x22e605[_0xcd03('0x6')](_0x311a44[_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')][_0xcd03('0xd')]()][_0xcd03('0xa')]());}else if(_0x293e79[_0xcd03('0x5')]===_0xcd03('0xe')){if(_0x293e79[_0xcd03('0xf')]===_0xcd03('0x10')&&_0x293e79[_0xcd03('0x11')]){_0x22e605[_0xcd03('0x6')](util[_0xcd03('0x12')](_0xcd03('0x13'),_0x293e79['key'],_0x293e79['keyContent']));}else if(_0x293e79[_0xcd03('0xf')]===_0xcd03('0x8')&&_0x293e79[_0xcd03('0x9')]&&_0x293e79[_0xcd03('0x11')]){_0x311a44[_0x293e79[_0xcd03('0x9')]]&&_0x22e605['push'](util['format'](_0xcd03('0x13'),_0x293e79[_0xcd03('0x11')],_0x311a44[_0x293e79[_0xcd03('0x9')]]));}else if(_0x293e79[_0xcd03('0xf')]===_0xcd03('0x14')&&_0x293e79[_0xcd03('0xb')]&&_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')]&&_0x293e79[_0xcd03('0x11')]){_0x311a44[_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')][_0xcd03('0xd')]()]&&_0x22e605[_0xcd03('0x6')](util['format'](_0xcd03('0x13'),_0x293e79[_0xcd03('0x11')],_0x311a44[_0x293e79[_0xcd03('0xb')][_0xcd03('0xc')][_0xcd03('0xd')]()]));}}}}return _0x22e605['join'](_0x288e17);};exports[_0xcd03('0x15')]=function(_0x1b5408){var _0xeaad61=_0x1b5408[_0xcd03('0x16')](-0x1);if(_0xeaad61==='/'){_0x1b5408=_0x1b5408['substring'](0x0,_0x1b5408[_0xcd03('0x17')](_0xeaad61));}return _0x1b5408;};exports[_0xcd03('0x18')]=function(_0x1b414d){if(!_['isNil'](_0x1b414d)&&_0x1b414d!==''){var _0x446cd4=/^(([^<>()\[\]\\.,;:\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 _0x446cd4['test'](String(_0x1b414d)[_0xcd03('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x1d77=['lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','string','push','content','type','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','format','keyContent','keyType','variable','%s:\x20%s','stripTrailingSlash','slice','substring'];(function(_0x5d8c41,_0x46925b){var _0x1ecceb=function(_0x36ade4){while(--_0x36ade4){_0x5d8c41['push'](_0x5d8c41['shift']());}};_0x1ecceb(++_0x46925b);}(_0x1d77,0x109));var _0x71d7=function(_0x3bf925,_0x4dd8e4){_0x3bf925=_0x3bf925-0x0;var _0x2128a1=_0x1d77[_0x3bf925];return _0x2128a1;};'use strict';var _=require(_0x71d7('0x0'));var util=require(_0x71d7('0x1'));exports[_0x71d7('0x2')]=function(_0x1fec40,_0x3f1616,_0x519bc8){var _0x2085b0=[];if(_0x1fec40[_0x71d7('0x3')]>0x0){var _0x381995=_[_0x71d7('0x4')](_0x1fec40,['id']);for(var _0x12b494=0x0;_0x12b494<_0x381995[_0x71d7('0x3')];_0x12b494++){var _0x4dcf3e=_0x381995[_0x12b494];if(_0x4dcf3e['type']===_0x71d7('0x5')){_0x2085b0[_0x71d7('0x6')](_0x4dcf3e[_0x71d7('0x7')]);}else if(_0x4dcf3e[_0x71d7('0x8')]==='variable'&&_0x4dcf3e[_0x71d7('0x9')]){_0x3f1616[_0x4dcf3e[_0x71d7('0x9')]]&&_0x2085b0[_0x71d7('0x6')](_0x3f1616[_0x4dcf3e[_0x71d7('0x9')]][_0x71d7('0xa')]());}else if(_0x4dcf3e[_0x71d7('0x8')]===_0x71d7('0xb')&&_0x4dcf3e[_0x71d7('0xc')]&&_0x4dcf3e['Variable'][_0x71d7('0xd')]){_0x3f1616[_0x4dcf3e[_0x71d7('0xc')][_0x71d7('0xd')]['toLowerCase']()]&&_0x2085b0['push'](_0x3f1616[_0x4dcf3e[_0x71d7('0xc')][_0x71d7('0xd')][_0x71d7('0xe')]()][_0x71d7('0xa')]());}else if(_0x4dcf3e[_0x71d7('0x8')]===_0x71d7('0xf')){if(_0x4dcf3e['keyType']===_0x71d7('0x5')&&_0x4dcf3e[_0x71d7('0x10')]){_0x2085b0[_0x71d7('0x6')](util[_0x71d7('0x11')]('%s:\x20%s',_0x4dcf3e[_0x71d7('0x10')],_0x4dcf3e[_0x71d7('0x12')]));}else if(_0x4dcf3e[_0x71d7('0x13')]===_0x71d7('0x14')&&_0x4dcf3e[_0x71d7('0x9')]&&_0x4dcf3e[_0x71d7('0x10')]){_0x3f1616[_0x4dcf3e[_0x71d7('0x9')]]&&_0x2085b0[_0x71d7('0x6')](util[_0x71d7('0x11')](_0x71d7('0x15'),_0x4dcf3e[_0x71d7('0x10')],_0x3f1616[_0x4dcf3e[_0x71d7('0x9')]]));}else if(_0x4dcf3e[_0x71d7('0x13')]===_0x71d7('0xb')&&_0x4dcf3e['Variable']&&_0x4dcf3e[_0x71d7('0xc')][_0x71d7('0xd')]&&_0x4dcf3e[_0x71d7('0x10')]){_0x3f1616[_0x4dcf3e[_0x71d7('0xc')]['name'][_0x71d7('0xe')]()]&&_0x2085b0[_0x71d7('0x6')](util[_0x71d7('0x11')](_0x71d7('0x15'),_0x4dcf3e[_0x71d7('0x10')],_0x3f1616[_0x4dcf3e[_0x71d7('0xc')]['name'][_0x71d7('0xe')]()]));}}}}return _0x2085b0['join'](_0x519bc8);};exports[_0x71d7('0x16')]=function(_0x32875a){var _0x19dc42=_0x32875a[_0x71d7('0x17')](-0x1);if(_0x19dc42==='/'){_0x32875a=_0x32875a[_0x71d7('0x18')](0x0,_0x32875a[_0x71d7('0x19')](_0x19dc42));}return _0x32875a;};exports[_0x71d7('0x1a')]=function(_0x4d3282){if(!_[_0x71d7('0x1b')](_0x4d3282)&&_0x4d3282!==''){var _0x19f2a7=/^(([^<>()\[\]\\.,;:\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 _0x19f2a7[_0x71d7('0x1c')](String(_0x4d3282)['toLowerCase']());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 37df93e..d417238 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 _0x34e8=['redis','defaults','localhost','emit','length','forEach','includes','string','picklist','type','idField','toString','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','getString','Subjects','POST','format','remoteUri','create','sessionName','HelpDesk','stringify','success','error','catch','statusCode','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','query','username','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','result','Agent\x20found!','resolve','email1','first_name','last_name','userId','[vTiger],\x20%s,\x20%s,\x20%s','getUser','admin','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!','phone','getEndUser','accessKey','getchallenge','then','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','The\x20User\x20ID\x20is:','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','split','unmanaged','lastevent','toUpperCase','calleridname','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger'];(function(_0x1fd4f3,_0x35a8fe){var _0x1ab246=function(_0x3b1a39){while(--_0x3b1a39){_0x1fd4f3['push'](_0x1fd4f3['shift']());}};_0x1ab246(++_0x35a8fe);}(_0x34e8,0x12c));var _0x834e=function(_0x278176,_0x56dcb1){_0x278176=_0x278176-0x0;var _0x29d62d=_0x34e8[_0x278176];return _0x29d62d;};'use strict';var _=require(_0x834e('0x0'));var rp=require(_0x834e('0x1'));var BPromise=require(_0x834e('0x2'));var md5=require(_0x834e('0x3'));var util=require('util');var Redis=require(_0x834e('0x4'));var intUtil=require(_0x834e('0x5'));var config=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));config[_0x834e('0x9')]=_[_0x834e('0xa')](config['redis'],{'host':_0x834e('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x834e('0x9')]));function emit(_0x3cc2e3,_0x3a3ef6,_0x2e69e2){io['to'](_0x3cc2e3)[_0x834e('0xc')](_0x3a3ef6,_0x2e69e2);}function getCustomFields(_0x23501c,_0x363786){var _0x1af45a={};if(_0x23501c[_0x834e('0xd')]>0x0){_[_0x834e('0xe')](_0x23501c,function(_0x1e41fe){if(_[_0x834e('0xf')]([_0x834e('0x10'),_0x834e('0x11')],_0x1e41fe[_0x834e('0x12')])&&_0x1e41fe[_0x834e('0x13')]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x1e41fe['content'][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='variable'&&_0x1e41fe[_0x834e('0x15')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe[_0x834e('0x15')]]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['variableName']][_0x834e('0x14')]();}else if(_0x1e41fe[_0x834e('0x12')]==='customVariable'&&_0x1e41fe[_0x834e('0x16')]&&_0x1e41fe['Variable'][_0x834e('0x17')]&&_0x1e41fe[_0x834e('0x13')]&&_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()]){_0x1af45a[_0x1e41fe[_0x834e('0x13')]]=_0x363786[_0x1e41fe['Variable'][_0x834e('0x17')][_0x834e('0x18')]()][_0x834e('0x14')]();}});}return _0x1af45a;}function createTicket(_0xb993a1,_0x237947,_0x254677,_0x1dd214,_0x595515,_0x2545b4,_0x1fd2c6){logger[_0x834e('0x19')](_0x834e('0x1a'));var _0x4ab05d=_[_0x834e('0x1b')]({'parent_id':'','assigned_user_id':_0x237947['id'],'ticketpriorities':_0x834e('0x1c'),'ticketstatus':'Open','ticket_title':intUtil[_0x834e('0x1d')](_0x1dd214[_0x834e('0x1e')],_0x595515,'\x20'),'description':intUtil[_0x834e('0x1d')](_0x1dd214['Descriptions'],_0x595515,'\x0a'),'contact_id':_0x254677['id']},getCustomFields(_0x2545b4,_0x595515));var _0x4e3f48={'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0xb993a1[_0x834e('0x21')]),'form':{'operation':_0x834e('0x22'),'username':_0xb993a1['username'],'sessionName':_0x1fd2c6[_0x834e('0x23')],'elementType':_0x834e('0x24'),'element':JSON[_0x834e('0x25')](_0x4ab05d)},'json':!![]};return request(_0x4e3f48)['then'](function(_0x24fcf7){if(_0x24fcf7[_0x834e('0x26')]){return BPromise['resolve']({'id':_0x24fcf7['result']['id']});}else{throw new Error(util[_0x834e('0x20')]('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x834e('0x25')](_0x24fcf7[_0x834e('0x27')])));}})[_0x834e('0x28')](function(_0x2cc2eb){var _0x3cd928=_0x2cc2eb[_0x834e('0x29')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','createTicket',_0x3cd928,JSON['stringify'](_0x2cc2eb));});}function getUser(_0x2c7a8d,_0x567cea,_0x106d6a){if(intUtil['validateEmail'](_0x567cea)){logger[_0x834e('0x19')](_0x834e('0x2a'),_0x567cea);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x2c7a8d[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x2c7a8d[_0x834e('0x2e')],'sessionName':_0x106d6a[_0x834e('0x23')],'query':util['format'](_0x834e('0x2f'),_0x567cea)},'json':!![]})['then'](function(_0x2c75c2){if(_0x2c75c2[_0x834e('0x26')]&&_0x2c75c2[_0x834e('0x30')][_0x834e('0xd')]){logger[_0x834e('0x19')](_0x834e('0x31'));return BPromise[_0x834e('0x32')]({'id':_0x2c75c2[_0x834e('0x30')][0x0]['id'],'email':_0x2c75c2[_0x834e('0x30')][0x0][_0x834e('0x33')],'name':_0x2c75c2['result'][0x0][_0x834e('0x34')]+'\x20'+_0x2c75c2[_0x834e('0x30')][_0x834e('0x35')]});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':'admin'});}})['catch'](function(_0x3e58fa){var _0x41bf4d=_0x3e58fa[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x41bf4d,JSON['stringify'](_0x3e58fa));});}else{logger[_0x834e('0x19')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x834e('0x32')]({'id':_0x106d6a[_0x834e('0x36')],'email':_0x2c7a8d['username'],'name':_0x834e('0x39')})[_0x834e('0x28')](function(_0x491c28){var _0x481f70=_0x491c28[_0x834e('0x29')]||0x1f4;logger[_0x834e('0x27')](_0x834e('0x37'),_0x834e('0x38'),_0x481f70,JSON[_0x834e('0x25')](_0x491c28));});}}function getEndUser(_0x4ca43c,_0x1c5ed6,_0x548d1d,_0x50c243){logger[_0x834e('0x19')]('Searching\x20end\x20user\x20with\x20phone',_0x548d1d);return request({'method':_0x834e('0x2b'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x4ca43c[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x2d'),'username':_0x4ca43c['username'],'sessionName':_0x50c243[_0x834e('0x23')],'query':util[_0x834e('0x20')](_0x834e('0x3a'),_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d,_0x548d1d)},'json':!![]})['then'](function(_0x35380e){if(_0x35380e[_0x834e('0x26')]&&_0x35380e['result'][_0x834e('0xd')]){logger['info'](_0x834e('0x3b'));return BPromise[_0x834e('0x32')]({'id':_0x35380e['result'][0x0]['id'],'name':_0x35380e['result'][0x0][_0x834e('0x3c')]+'\x20'+_0x35380e[_0x834e('0x30')][0x0][_0x834e('0x3d')],'phone':_0x548d1d});}else{logger[_0x834e('0x19')](_0x834e('0x3e'));return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')]('%s/webservice.php',_0x4ca43c[_0x834e('0x21')]),'form':{'operation':'create','sessionName':_0x50c243[_0x834e('0x23')],'elementType':'Contacts','element':JSON[_0x834e('0x25')]({'lastname':_0x1c5ed6,'phone':_0x548d1d,'assigned_user_id':'\x20'})},'json':!![]})['then'](function(_0x361f60){logger[_0x834e('0x19')]('Enduser\x20created.');return BPromise[_0x834e('0x32')]({'id':_0x361f60[_0x834e('0x30')]['id'],'name':_0x361f60[_0x834e('0x30')][_0x834e('0x3d')],'phone':_0x361f60[_0x834e('0x30')][_0x834e('0x3f')]});})[_0x834e('0x28')](function(_0x3ccd8e){var _0x5dc63b=_0x3ccd8e[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x40'),_0x5dc63b,JSON['stringify'](_0x3ccd8e));});}});}function getConnection(_0x112306){var _0x42fd90=_0x112306[_0x834e('0x2e')];var _0x2112d5=_0x112306[_0x834e('0x41')];return request({'method':_0x834e('0x2b'),'uri':util['format']('%s/webservice.php',_0x112306[_0x834e('0x21')]),'qs':{'operation':_0x834e('0x42'),'username':_0x42fd90},'json':!![]})[_0x834e('0x43')](function(_0x40ff5a){if(_0x40ff5a[_0x834e('0x26')]){return request({'method':_0x834e('0x1f'),'uri':util[_0x834e('0x20')](_0x834e('0x2c'),_0x112306[_0x834e('0x21')]),'form':{'operation':_0x834e('0x44'),'username':_0x42fd90,'accessKey':md5(_0x40ff5a[_0x834e('0x30')][_0x834e('0x45')]+_0x2112d5)},'json':!![]});}})[_0x834e('0x43')](function(_0x1a3237){if(_0x1a3237[_0x834e('0x26')]){return BPromise[_0x834e('0x32')](_0x1a3237[_0x834e('0x30')]);}else{throw new Error(util[_0x834e('0x20')](_0x834e('0x46'),_0x112306['id']));}})[_0x834e('0x28')](function(_0x4cfacd){var _0x1cc0b8=_0x4cfacd[_0x834e('0x29')]||0x1f4;logger['error'](_0x834e('0x37'),_0x834e('0x47'),_0x1cc0b8,JSON['stringify'](_0x4cfacd));});}function request(_0x3dcca3){logger[_0x834e('0x19')](_0x834e('0x48'),JSON[_0x834e('0x25')](_0x3dcca3));return rp(_0x3dcca3);}exports[_0x834e('0x49')]=function(_0xb77aab,_0x4549ba,_0x4a8b32,_0x1ad7fe,_0x8bc6c6,_0x3e0550){var _0x363675,_0x86ad2b,_0x396bbe,_0x344b51;_0x3e0550[_0x834e('0x21')]=intUtil['stripTrailingSlash'](_0x3e0550[_0x834e('0x21')]);if(_0x8bc6c6&&_0x8bc6c6['monitor_format']){logger[_0x834e('0x19')]('[QUEUE]',_0x834e('0x4a'));_0x4549ba['recordingURL']=util['format'](_0x834e('0x4b'),_0x3e0550[_0x834e('0x4c')],_0x4549ba['uniqueid'],md5(_0x4549ba['uniqueid']));}else{_0x4549ba[_0x834e('0x4d')]='';}return getConnection(_0x3e0550)[_0x834e('0x43')](function(_0x138ed2){_0x344b51=_0x138ed2;return getUser(_0x3e0550,_0x1ad7fe[_0x834e('0x4e')],_0x344b51);})[_0x834e('0x43')](function(_0x315858){_0x363675=_0x315858;logger[_0x834e('0x19')](_0x834e('0x4f'),_0x363675['id']);return getEndUser(_0x3e0550,_0x4549ba['calleridname'],_0x4549ba[_0x834e('0x50')],_0x344b51);})[_0x834e('0x43')](function(_0x5d5ac2){_0x86ad2b=_0x5d5ac2;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x86ad2b['id']);return createTicket(_0x3e0550,_0x363675,_0x86ad2b,_0x4a8b32,_0x4549ba,_0x4a8b32[_0x834e('0x51')],_0x344b51);})[_0x834e('0x43')](function(_0x5160c4){_0x396bbe=_0x5160c4;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x396bbe['id']);var _0x5a2924=util[_0x834e('0x20')](_0x834e('0x54'),_0x3e0550[_0x834e('0x21')],_['split'](_0x396bbe['id'],'x')[0x1]);logger[_0x834e('0x19')](_0x834e('0x55'),_0x834e('0x56'));emit(util[_0x834e('0x20')](_0x834e('0x57'),_0x1ad7fe[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5a2924});})[_0x834e('0x28')](function(_0x208c21){logger[_0x834e('0x27')](_0x834e('0x55'),JSON[_0x834e('0x25')](_0x208c21));});};exports[_0x834e('0x59')]=function(_0x1659c8,_0x460a7a,_0x17b8e3,_0x297cce,_0x14ed83,_0x193a15,_0x3e3467){var _0xed4081,_0x2cb233,_0x5c83eb,_0x2145cf;_0x193a15[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x193a15[_0x834e('0x21')]);_0x193a15['serverUrl']=intUtil[_0x834e('0x5a')](_0x193a15['serverUrl']);if(_0x3e3467&&_0x3e3467['recordingFormat']&&_0x3e3467[_0x834e('0x5b')]!==_0x834e('0x5c')){logger[_0x834e('0x19')](_0x834e('0x5d'),_0x834e('0x4a'));_0x460a7a[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x193a15['serverUrl'],_0x460a7a[_0x834e('0x5e')],md5(_0x460a7a['uniqueid']));}return getConnection(_0x193a15)[_0x834e('0x43')](function(_0xd35dda){_0x2145cf=_0xd35dda;return getUser(_0x193a15,_0x297cce['email'],_0x2145cf);})['then'](function(_0x4a4def){_0xed4081=_0x4a4def;logger[_0x834e('0x19')](_0x834e('0x4f'),_0xed4081['id']);return getEndUser(_0x193a15,_0x460a7a[_0x834e('0x5f')],_0x460a7a[_0x834e('0x60')],_0x2145cf);})['then'](function(_0x2b0d93){_0x2cb233=_0x2b0d93;logger[_0x834e('0x19')](_0x834e('0x61'),_0x2cb233['id']);return createTicket(_0x193a15,_0xed4081,_0x2cb233,_0x17b8e3,_0x460a7a,_0x17b8e3[_0x834e('0x51')],_0x2145cf);})[_0x834e('0x43')](function(_0x28b5c9){_0x5c83eb=_0x28b5c9;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')](_0x834e('0x53'),_0x5c83eb['id']);var _0x5b2bf6=util[_0x834e('0x20')](_0x834e('0x54'),_0x193a15[_0x834e('0x21')],_[_0x834e('0x62')](_0x5c83eb['id'],'x')[0x1]);logger['info'](_0x834e('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format']('user:%s',_0x297cce[_0x834e('0x17')]),_0x834e('0x58'),{'uri':_0x5b2bf6});})['catch'](function(_0x2645df){logger[_0x834e('0x27')]('[OUTBOUND]',JSON[_0x834e('0x25')](_0x2645df));});};exports[_0x834e('0x63')]=function(_0x4b88e7,_0x5df169,_0x346be5,_0x2a42a3,_0x8bc7d9,_0x44c909){var _0x1d8e7,_0x493239,_0x264a6f,_0x520367;_0x44c909[_0x834e('0x21')]=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x21')]);_0x44c909['serverUrl']=intUtil[_0x834e('0x5a')](_0x44c909[_0x834e('0x4c')]);if(_0x8bc7d9&&_0x8bc7d9['monitor_format']){logger[_0x834e('0x19')]('['+_0x5df169[_0x834e('0x64')][_0x834e('0x65')]()+']','Recording\x20is\x20enabled!');_0x5df169[_0x834e('0x4d')]=util[_0x834e('0x20')](_0x834e('0x4b'),_0x44c909[_0x834e('0x4c')],_0x5df169[_0x834e('0x5e')],md5(_0x5df169[_0x834e('0x5e')]));}else{_0x5df169[_0x834e('0x4d')]='';}return getConnection(_0x44c909)[_0x834e('0x43')](function(_0xd49002){_0x520367=_0xd49002;return getUser(_0x44c909,'',_0x520367);})[_0x834e('0x43')](function(_0x57d898){_0x1d8e7=_0x57d898;logger['info']('The\x20User\x20ID\x20is:',_0x1d8e7['id']);return getEndUser(_0x44c909,_0x5df169[_0x834e('0x66')],_0x5df169[_0x834e('0x50')],_0x520367);})[_0x834e('0x43')](function(_0x37fa2c){_0x493239=_0x37fa2c;logger[_0x834e('0x19')]('The\x20Enduser\x20ID\x20is:',_0x493239['id']);return createTicket(_0x44c909,_0x1d8e7,_0x493239,_0x346be5,_0x5df169,_0x346be5['Fields'],_0x520367);})[_0x834e('0x43')](function(_0x1ad428){_0x264a6f=_0x1ad428;logger[_0x834e('0x19')](_0x834e('0x52'));logger[_0x834e('0x19')]('The\x20Ticket\x20ID\x20is:',_0x264a6f['id']);})[_0x834e('0x28')](function(_0x2b162a){logger[_0x834e('0x27')]('['+_0x5df169['lastevent'][_0x834e('0x65')]()+']',JSON[_0x834e('0x25')](_0x2b162a));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x4d164,_0x3e017){var _0x255655=function(_0x1d1fe1){while(--_0x1d1fe1){_0x4d164['push'](_0x4d164['shift']());}};_0x255655(++_0x3e017);}(_0xe706,0xa3));var _0x6e70=function(_0x5bbf6a,_0x29460a){_0x5bbf6a=_0x5bbf6a-0x0;var _0x5d051a=_0xe706[_0x5bbf6a];return _0x5d051a;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index b3808db..31a904c 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 _0xf9dd=['Tags','name','Subjects','getString','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','forEach','string','picklist','nameField','toLowerCase','content','toString','includes','type','idField','customField','variable','variableName','custom_fields','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridnum','[OUTBOUND]','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge'];(function(_0x30a772,_0x5958db){var _0xf316c8=function(_0x1394b1){while(--_0x1394b1){_0x30a772['push'](_0x30a772['shift']());}};_0xf316c8(++_0x5958db);}(_0xf9dd,0x1c2));var _0xdf9d=function(_0x1b53b7,_0x1d0fc3){_0x1b53b7=_0x1b53b7-0x0;var _0x1f8628=_0xf9dd[_0x1b53b7];return _0x1f8628;};'use strict';var _=require(_0xdf9d('0x0'));var rp=require('request-promise');var md5=require(_0xdf9d('0x1'));var util=require(_0xdf9d('0x2'));var Redis=require(_0xdf9d('0x3'));var intUtil=require(_0xdf9d('0x4'));var config=require(_0xdf9d('0x5'));var logger=require(_0xdf9d('0x6'))(_0xdf9d('0x7'));config[_0xdf9d('0x8')]=_['defaults'](config[_0xdf9d('0x8')],{'host':_0xdf9d('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x78a498,_0x3a7f7e,_0x300ef4){io['to'](_0x78a498)[_0xdf9d('0xa')](_0x3a7f7e,_0x300ef4);}var headers={'Content-Type':_0xdf9d('0xb'),'Accept':_0xdf9d('0xb')};function getTicket(_0x41c35f,_0x550925,_0x42dc2a,_0x526a46,_0x5ace86){logger[_0xdf9d('0xc')](_0xdf9d('0xd'));return request({'uri':util['format'](_0xdf9d('0xe'),_0x41c35f[_0xdf9d('0xf')]),'method':_0xdf9d('0x10'),'body':{'ticket':_[_0xdf9d('0x11')]({'requester_id':_0x42dc2a['id'],'submitter_id':_0x550925?_0x550925['id']:undefined,'assignee_id':_0x550925?_0x550925['id']:undefined,'tags':getTags(_0x526a46[_0xdf9d('0x12')],_0xdf9d('0x13')),'subject':intUtil['getString'](_0x526a46[_0xdf9d('0x14')],_0x5ace86,'\x20'),'description':intUtil[_0xdf9d('0x15')](_0x526a46[_0xdf9d('0x16')],_0x5ace86,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdf9d('0x15')](_0x526a46[_0xdf9d('0x16')],_0x5ace86,'\x0a')}},getCustomFields(_0x526a46[_0xdf9d('0x17')],_0x5ace86))}})[_0xdf9d('0x18')](function(_0x2318a1){logger['info'](_0xdf9d('0x19'));return _0x2318a1[_0xdf9d('0x1a')];});}function getUser(_0x292847,_0x3b1031){if(intUtil[_0xdf9d('0x1b')](_0x3b1031)){logger[_0xdf9d('0xc')](_0xdf9d('0x1c'),_0x3b1031);return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x1e'),_0x292847['remoteUri']),'qs':{'query':util[_0xdf9d('0x1d')](_0xdf9d('0x1f'),_0x3b1031)}})[_0xdf9d('0x18')](function(_0x594fab){if(_0x594fab[_0xdf9d('0x20')]){logger['info'](_0xdf9d('0x21'));return _[_0xdf9d('0x22')](_0x594fab[_0xdf9d('0x23')],{'email':_0x3b1031,'role':_0xdf9d('0x24')});}else{logger[_0xdf9d('0xc')](_0xdf9d('0x25'));return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x26'),_0x292847['remoteUri'])})[_0xdf9d('0x18')](function(_0x3ec6e2){logger[_0xdf9d('0xc')](_0xdf9d('0x27'));return _0x3ec6e2[_0xdf9d('0x28')];});}});}else{logger[_0xdf9d('0xc')](_0xdf9d('0x25'));return request({'uri':util['format'](_0xdf9d('0x26'),_0x292847[_0xdf9d('0xf')])})[_0xdf9d('0x18')](function(_0x3f8096){logger[_0xdf9d('0xc')](_0xdf9d('0x27'));return _0x3f8096[_0xdf9d('0x28')];});}}function getEndUser(_0x1b025b,_0x293ee2,_0x4082ff){logger['info'](_0xdf9d('0x29'),_0x4082ff);return request({'uri':util[_0xdf9d('0x1d')]('%s/search.json',_0x1b025b['remoteUri']),'qs':{'query':util[_0xdf9d('0x1d')](_0xdf9d('0x2a'),_0x4082ff)}})[_0xdf9d('0x18')](function(_0x597d0e){var _0x3fb4ec;if(_0x597d0e[_0xdf9d('0x23')][_0xdf9d('0x2b')]){_0x597d0e['results']=_[_0xdf9d('0x2c')](_0x597d0e[_0xdf9d('0x23')],{'suspended':![],'role':_0xdf9d('0x2d')});if(_0x597d0e[_0xdf9d('0x23')][_0xdf9d('0x2b')]){_0x3fb4ec=_[_0xdf9d('0x2e')](_0x597d0e['results']);}}if(_0x3fb4ec){logger[_0xdf9d('0xc')](_0xdf9d('0x2f'));return _0x3fb4ec;}else{logger[_0xdf9d('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x30'),_0x1b025b[_0xdf9d('0xf')]),'method':_0xdf9d('0x10'),'body':{'user':{'role':_0xdf9d('0x2d'),'name':util[_0xdf9d('0x1d')](_0xdf9d('0x31'),_0x293ee2||_0x4082ff),'phone':_0x4082ff}}})[_0xdf9d('0x18')](function(_0x358b3e){logger[_0xdf9d('0xc')](_0xdf9d('0x32'));return _0x358b3e['user'];});}});}function getAuth(_0x668654){var _0x341980;if(_0x668654[_0xdf9d('0x33')]==='password'){_0x341980=util[_0xdf9d('0x1d')](_0xdf9d('0x34'),_0x668654[_0xdf9d('0x35')],_0x668654['password']);}else if(_0x668654[_0xdf9d('0x33')]===_0xdf9d('0x36')){_0x341980=util[_0xdf9d('0x1d')](_0xdf9d('0x37'),_0x668654[_0xdf9d('0x35')],_0x668654['token']);}return util[_0xdf9d('0x1d')](_0xdf9d('0x38'),new Buffer(_0x341980)['toString'](_0xdf9d('0x39')));}function request(_0x4139d4){logger[_0xdf9d('0x3a')](_0xdf9d('0x3b'),JSON[_0xdf9d('0x3c')](_0x4139d4));return rp(_['defaults'](_0x4139d4,{'method':_0xdf9d('0x3d'),'headers':headers,'json':!![]}));}function getTags(_0x52e1ba,_0x30ec85){var _0x589343=[];if(_0x52e1ba&&_0x52e1ba['length']>0x0){_0x589343=_['map'](_0x52e1ba,_0x30ec85);}return _0x589343;}function getCustomFields(_0x4a0408,_0x3150ba){var _0x254d48=[];var _0x45b21d={'custom_fields':[]};if(_0x4a0408[_0xdf9d('0x2b')]>0x0){_[_0xdf9d('0x3e')](_0x4a0408,function(_0x44c538){if(_['includes']([_0xdf9d('0x3f'),_0xdf9d('0x40')],_0x44c538['type'])&&_0x44c538['nameField']&&!_0x44c538['customField']){_0x45b21d[_0x44c538[_0xdf9d('0x41')][_0xdf9d('0x42')]()]=_0x44c538[_0xdf9d('0x43')][_0xdf9d('0x44')]();}else if(_[_0xdf9d('0x45')]([_0xdf9d('0x3f'),_0xdf9d('0x40')],_0x44c538[_0xdf9d('0x46')])&&_0x44c538[_0xdf9d('0x47')]&&_0x44c538[_0xdf9d('0x48')]){_0x45b21d['custom_fields']['push']({'id':_0x44c538[_0xdf9d('0x47')],'value':_0x44c538[_0xdf9d('0x43')][_0xdf9d('0x44')]()});}else if(_0x44c538['type']===_0xdf9d('0x49')&&_0x44c538[_0xdf9d('0x4a')]&&_0x44c538[_0xdf9d('0x47')]&&_0x44c538[_0xdf9d('0x48')]){_0x3150ba[_0x44c538[_0xdf9d('0x4a')]]&&_0x45b21d[_0xdf9d('0x4b')][_0xdf9d('0x4c')]({'id':_0x44c538[_0xdf9d('0x47')],'value':_0x3150ba[_0x44c538[_0xdf9d('0x4a')]][_0xdf9d('0x44')]()});}else if(_0x44c538[_0xdf9d('0x46')]===_0xdf9d('0x4d')&&_0x44c538[_0xdf9d('0x4e')]&&_0x44c538['Variable'][_0xdf9d('0x13')]&&_0x44c538[_0xdf9d('0x47')]&&_0x44c538[_0xdf9d('0x48')]){_0x3150ba[_0x44c538[_0xdf9d('0x4e')][_0xdf9d('0x13')][_0xdf9d('0x42')]()]&&_0x45b21d[_0xdf9d('0x4b')][_0xdf9d('0x4c')]({'id':_0x44c538[_0xdf9d('0x47')],'value':_0x3150ba[_0x44c538['Variable'][_0xdf9d('0x13')][_0xdf9d('0x42')]()]['toString']()});}});}return _0x45b21d;}exports[_0xdf9d('0x4f')]=function(_0x33716b,_0x77f959,_0x32f86d,_0x89ead4,_0xfabe68,_0x1d97fc){var _0x38283f,_0x42261f;_0x1d97fc['remoteUri']=intUtil[_0xdf9d('0x50')](_0x1d97fc[_0xdf9d('0xf')]);_0x1d97fc['serverUrl']=intUtil[_0xdf9d('0x50')](_0x1d97fc[_0xdf9d('0x51')]);if(_0xfabe68&&_0xfabe68[_0xdf9d('0x52')]){logger[_0xdf9d('0xc')]('[QUEUE]','Recording\x20is\x20enabled!');_0x77f959['recordingURL']=util[_0xdf9d('0x1d')](_0xdf9d('0x53'),_0x1d97fc[_0xdf9d('0x51')],_0x77f959['uniqueid'],md5(_0x77f959[_0xdf9d('0x54')]));}else{_0x77f959[_0xdf9d('0x55')]='';}headers[_0xdf9d('0x56')]=getAuth(_0x1d97fc);return getUser(_0x1d97fc,_0x89ead4[_0xdf9d('0x57')])['then'](function(_0x2c138d){_0x38283f=_0x2c138d;logger[_0xdf9d('0xc')]('The\x20User\x20ID\x20is:',_0x38283f['id']);return getEndUser(_0x1d97fc,_0x77f959[_0xdf9d('0x58')],_0x77f959[_0xdf9d('0x59')]);})[_0xdf9d('0x18')](function(_0x2fd620){_0x42261f=_0x2fd620;logger[_0xdf9d('0xc')](_0xdf9d('0x5a'),_0x42261f['id']);return getTicket(_0x1d97fc,_0x38283f,_0x42261f,_0x32f86d,_0x77f959);})['then'](function(_0x1b2f6b){if(_0x1b2f6b){logger[_0xdf9d('0xc')](_0xdf9d('0x5b'),_0x1b2f6b['id']);switch(_0x1d97fc['type']){case _0xdf9d('0x5c'):logger['info'](_0xdf9d('0x5d'),_0xdf9d('0x5e'));return request({'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x5f'),_0x1d97fc[_0xdf9d('0xf')],_0x38283f['id'],_0x1b2f6b['id']),'method':_0xdf9d('0x10')});case _0xdf9d('0x60'):logger[_0xdf9d('0xc')](_0xdf9d('0x5d'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xdf9d('0x1d')](_0xdf9d('0x61'),_0x89ead4[_0xdf9d('0x13')]),_0xdf9d('0x62'),{'uri':util[_0xdf9d('0x1d')](_0xdf9d('0x63'),_0x1d97fc[_0xdf9d('0xf')][_0xdf9d('0x64')](_0xdf9d('0x65'),''),_0x1b2f6b['id'])});break;default:logger['error'](_0xdf9d('0x5d'),_0xdf9d('0x66'));}}})[_0xdf9d('0x67')](function(_0x4396e5){logger[_0xdf9d('0x68')](_0xdf9d('0x69'),util[_0xdf9d('0x6a')](_0x4396e5,{'showHidden':!![],'depth':null}));});};exports[_0xdf9d('0x6b')]=function(_0x57d798,_0x230e7e,_0x38c276,_0x1b6859,_0x594eac,_0x23c4fe,_0x15e81b){var _0x334d92,_0x3a7914;_0x23c4fe[_0xdf9d('0xf')]=intUtil[_0xdf9d('0x50')](_0x23c4fe[_0xdf9d('0xf')]);_0x23c4fe[_0xdf9d('0x51')]=intUtil['stripTrailingSlash'](_0x23c4fe[_0xdf9d('0x51')]);if(_0x15e81b&&_0x15e81b['recordingFormat']&&_0x15e81b[_0xdf9d('0x6c')]!==_0xdf9d('0x6d')){logger['info']('[OUTBOUND]',_0xdf9d('0x6e'));_0x230e7e[_0xdf9d('0x55')]=util[_0xdf9d('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x23c4fe[_0xdf9d('0x51')],_0x230e7e[_0xdf9d('0x54')],md5(_0x230e7e[_0xdf9d('0x54')]));}headers['Authorization']=getAuth(_0x23c4fe);return getUser(_0x23c4fe,_0x1b6859[_0xdf9d('0x57')])[_0xdf9d('0x18')](function(_0x3ec79b){_0x334d92=_0x3ec79b;logger[_0xdf9d('0xc')](_0xdf9d('0x6f'),_0x334d92['id']);return getEndUser(_0x23c4fe,_0x230e7e['destcalleridname'],_0x230e7e[_0xdf9d('0x70')]);})[_0xdf9d('0x18')](function(_0x212df5){_0x3a7914=_0x212df5;logger[_0xdf9d('0xc')](_0xdf9d('0x5a'),_0x3a7914['id']);return getTicket(_0x23c4fe,_0x334d92,_0x3a7914,_0x38c276,_0x230e7e);})[_0xdf9d('0x18')](function(_0x4f8185){if(_0x4f8185){logger[_0xdf9d('0xc')](_0xdf9d('0x5b'),_0x4f8185['id']);switch(_0x23c4fe['type']){case'integrationTab':logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0xdf9d('0x1d')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x23c4fe[_0xdf9d('0xf')],_0x334d92['id'],_0x4f8185['id']),'method':'POST'});case _0xdf9d('0x60'):logger[_0xdf9d('0xc')](_0xdf9d('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xdf9d('0x61'),_0x1b6859[_0xdf9d('0x13')]),_0xdf9d('0x62'),{'uri':util[_0xdf9d('0x1d')]('%s/agent/tickets/%s',_0x23c4fe[_0xdf9d('0xf')][_0xdf9d('0x64')](_0xdf9d('0x65'),''),_0x4f8185['id'])});break;default:logger[_0xdf9d('0x68')](_0xdf9d('0x71'),_0xdf9d('0x66'));}}})['catch'](function(_0x3ac694){logger[_0xdf9d('0x68')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0xdf9d('0x6a')](_0x3ac694,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0x267e1f,_0x4c9179,_0x32c897,_0x5f40f6,_0x5eab78,_0x24181c){var _0xed50ab,_0x4f2eed;_0x24181c[_0xdf9d('0xf')]=intUtil[_0xdf9d('0x50')](_0x24181c[_0xdf9d('0xf')]);_0x24181c[_0xdf9d('0x51')]=intUtil[_0xdf9d('0x50')](_0x24181c['serverUrl']);if(_0x5eab78&&_0x5eab78['monitor_format']){logger[_0xdf9d('0xc')]('['+_0x4c9179[_0xdf9d('0x72')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4c9179[_0xdf9d('0x55')]=util[_0xdf9d('0x1d')](_0xdf9d('0x53'),_0x24181c[_0xdf9d('0x51')],_0x4c9179['uniqueid'],md5(_0x4c9179['uniqueid']));}else{_0x4c9179['recordingURL']='';}headers[_0xdf9d('0x56')]=getAuth(_0x24181c);return getUser(_0x24181c)[_0xdf9d('0x18')](function(_0x47b9d8){_0xed50ab=_0x47b9d8;logger[_0xdf9d('0xc')](_0xdf9d('0x6f'),_0xed50ab['id']);return getEndUser(_0x24181c,_0x4c9179[_0xdf9d('0x58')],_0x4c9179[_0xdf9d('0x59')]);})[_0xdf9d('0x18')](function(_0x5e5567){_0x4f2eed=_0x5e5567;logger[_0xdf9d('0xc')](_0xdf9d('0x5a'),_0x4f2eed['id']);return getTicket(_0x24181c,_0xed50ab,_0x4f2eed,_0x32c897,_0x4c9179);})[_0xdf9d('0x18')](function(_0x437cc5){if(_0x437cc5){logger[_0xdf9d('0xc')]('The\x20Ticket\x20ID\x20is:',_0x437cc5['id']);}})[_0xdf9d('0x67')](function(_0x44a5dc){logger[_0xdf9d('0x68')]('['+_0x4c9179['lastevent'][_0xdf9d('0x73')]()+']'+_0xdf9d('0x74'),util[_0xdf9d('0x6a')](_0x44a5dc,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9c93=['Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','password','token','%s/token:%s','username','Basic\x20%s','base64','[HTTP]','stringify','map','includes','string','picklist','nameField','content','toString','type','idField','custom_fields','variable','customField','variableName','push','customVariable','Variable','toLowerCase','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','Authorization','email','destcalleridnum','The\x20Enduser\x20ID\x20is:','integrationTab','%s/channels/voice/agents/%d/tickets/%d/display.json','user:%s','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','../../../../config/environment','../../../../config/logger','zendesk','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','Getting\x20agent\x20with\x20email','format','%s/search.json','count','Agent\x20found!','find','results','agent','%s/users/me.json'];(function(_0x54874b,_0x1b69db){var _0xaf6373=function(_0x2d9af5){while(--_0x2d9af5){_0x54874b['push'](_0x54874b['shift']());}};_0xaf6373(++_0x1b69db);}(_0x9c93,0x19a));var _0x39c9=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0x9c93[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x39c9('0x0'));var rp=require(_0x39c9('0x1'));var md5=require(_0x39c9('0x2'));var util=require(_0x39c9('0x3'));var Redis=require(_0x39c9('0x4'));var intUtil=require('./util');var config=require(_0x39c9('0x5'));var logger=require(_0x39c9('0x6'))(_0x39c9('0x7'));config[_0x39c9('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x39c9('0x9'))(new Redis(config[_0x39c9('0x8')]));function emit(_0x345a00,_0x2cbcb5,_0x22bfed){io['to'](_0x345a00)[_0x39c9('0xa')](_0x2cbcb5,_0x22bfed);}var headers={'Content-Type':_0x39c9('0xb'),'Accept':_0x39c9('0xb')};function getTicket(_0x27b413,_0x5aef45,_0xdf56c0,_0x3e747d,_0x30b123){logger[_0x39c9('0xc')](_0x39c9('0xd'));return request({'uri':util['format'](_0x39c9('0xe'),_0x27b413[_0x39c9('0xf')]),'method':'POST','body':{'ticket':_[_0x39c9('0x10')]({'requester_id':_0xdf56c0['id'],'submitter_id':_0x5aef45?_0x5aef45['id']:undefined,'assignee_id':_0x5aef45?_0x5aef45['id']:undefined,'tags':getTags(_0x3e747d['Tags'],_0x39c9('0x11')),'subject':intUtil[_0x39c9('0x12')](_0x3e747d[_0x39c9('0x13')],_0x30b123,'\x20'),'description':intUtil[_0x39c9('0x12')](_0x3e747d[_0x39c9('0x14')],_0x30b123,'\x0a'),'comment':{'public':![],'body':intUtil[_0x39c9('0x12')](_0x3e747d['Descriptions'],_0x30b123,'\x0a')}},getCustomFields(_0x3e747d[_0x39c9('0x15')],_0x30b123))}})[_0x39c9('0x16')](function(_0x32c2ee){logger['info'](_0x39c9('0x17'));return _0x32c2ee[_0x39c9('0x18')];});}function getUser(_0x5a06ff,_0x32fd9b){if(intUtil['validateEmail'](_0x32fd9b)){logger[_0x39c9('0xc')](_0x39c9('0x19'),_0x32fd9b);return request({'uri':util[_0x39c9('0x1a')](_0x39c9('0x1b'),_0x5a06ff['remoteUri']),'qs':{'query':util[_0x39c9('0x1a')]('type:user\x20role:agent\x20email:%s',_0x32fd9b)}})[_0x39c9('0x16')](function(_0x600540){if(_0x600540[_0x39c9('0x1c')]){logger['info'](_0x39c9('0x1d'));return _[_0x39c9('0x1e')](_0x600540[_0x39c9('0x1f')],{'email':_0x32fd9b,'role':_0x39c9('0x20')});}else{logger[_0x39c9('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x39c9('0x1a')](_0x39c9('0x21'),_0x5a06ff[_0x39c9('0xf')])})['then'](function(_0x5eb3fb){logger['info'](_0x39c9('0x22'));return _0x5eb3fb[_0x39c9('0x23')];});}});}else{logger[_0x39c9('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format']('%s/users/me.json',_0x5a06ff['remoteUri'])})[_0x39c9('0x16')](function(_0x2b1139){logger['info'](_0x39c9('0x22'));return _0x2b1139[_0x39c9('0x23')];});}}function getEndUser(_0x5a13d7,_0x28b885,_0xf0d922){logger[_0x39c9('0xc')](_0x39c9('0x24'),_0xf0d922);return request({'uri':util[_0x39c9('0x1a')](_0x39c9('0x1b'),_0x5a13d7[_0x39c9('0xf')]),'qs':{'query':util[_0x39c9('0x1a')](_0x39c9('0x25'),_0xf0d922)}})[_0x39c9('0x16')](function(_0x1b930a){var _0x90c16e;if(_0x1b930a['results'][_0x39c9('0x26')]){_0x1b930a[_0x39c9('0x1f')]=_[_0x39c9('0x27')](_0x1b930a[_0x39c9('0x1f')],{'suspended':![],'role':_0x39c9('0x28')});if(_0x1b930a[_0x39c9('0x1f')][_0x39c9('0x26')]){_0x90c16e=_['first'](_0x1b930a['results']);}}if(_0x90c16e){logger[_0x39c9('0xc')](_0x39c9('0x29'));return _0x90c16e;}else{logger[_0x39c9('0xc')](_0x39c9('0x2a'));return request({'uri':util[_0x39c9('0x1a')](_0x39c9('0x2b'),_0x5a13d7['remoteUri']),'method':'POST','body':{'user':{'role':_0x39c9('0x28'),'name':util[_0x39c9('0x1a')](_0x39c9('0x2c'),_0x28b885||_0xf0d922),'phone':_0xf0d922}}})['then'](function(_0x1fd08e){logger[_0x39c9('0xc')]('Enduser\x20created.');return _0x1fd08e[_0x39c9('0x23')];});}});}function getAuth(_0x3e08cb){var _0xfe0a12;if(_0x3e08cb['authType']===_0x39c9('0x2d')){_0xfe0a12=util['format']('%s:%s',_0x3e08cb['username'],_0x3e08cb[_0x39c9('0x2d')]);}else if(_0x3e08cb['authType']===_0x39c9('0x2e')){_0xfe0a12=util[_0x39c9('0x1a')](_0x39c9('0x2f'),_0x3e08cb[_0x39c9('0x30')],_0x3e08cb[_0x39c9('0x2e')]);}return util[_0x39c9('0x1a')](_0x39c9('0x31'),new Buffer(_0xfe0a12)['toString'](_0x39c9('0x32')));}function request(_0x5bc7c7){logger['debug'](_0x39c9('0x33'),JSON[_0x39c9('0x34')](_0x5bc7c7));return rp(_['defaults'](_0x5bc7c7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5ee4f8,_0x5d2b42){var _0x334f4c=[];if(_0x5ee4f8&&_0x5ee4f8[_0x39c9('0x26')]>0x0){_0x334f4c=_[_0x39c9('0x35')](_0x5ee4f8,_0x5d2b42);}return _0x334f4c;}function getCustomFields(_0x52cbfd,_0x4dea97){var _0x1f0376=[];var _0x368ec9={'custom_fields':[]};if(_0x52cbfd[_0x39c9('0x26')]>0x0){_['forEach'](_0x52cbfd,function(_0x478655){if(_[_0x39c9('0x36')]([_0x39c9('0x37'),_0x39c9('0x38')],_0x478655['type'])&&_0x478655[_0x39c9('0x39')]&&!_0x478655['customField']){_0x368ec9[_0x478655['nameField']['toLowerCase']()]=_0x478655[_0x39c9('0x3a')][_0x39c9('0x3b')]();}else if(_['includes']([_0x39c9('0x37'),'picklist'],_0x478655[_0x39c9('0x3c')])&&_0x478655[_0x39c9('0x3d')]&&_0x478655['customField']){_0x368ec9[_0x39c9('0x3e')]['push']({'id':_0x478655[_0x39c9('0x3d')],'value':_0x478655['content'][_0x39c9('0x3b')]()});}else if(_0x478655['type']===_0x39c9('0x3f')&&_0x478655['variableName']&&_0x478655[_0x39c9('0x3d')]&&_0x478655[_0x39c9('0x40')]){_0x4dea97[_0x478655[_0x39c9('0x41')]]&&_0x368ec9['custom_fields'][_0x39c9('0x42')]({'id':_0x478655['idField'],'value':_0x4dea97[_0x478655[_0x39c9('0x41')]][_0x39c9('0x3b')]()});}else if(_0x478655['type']===_0x39c9('0x43')&&_0x478655['Variable']&&_0x478655[_0x39c9('0x44')][_0x39c9('0x11')]&&_0x478655['idField']&&_0x478655[_0x39c9('0x40')]){_0x4dea97[_0x478655[_0x39c9('0x44')][_0x39c9('0x11')][_0x39c9('0x45')]()]&&_0x368ec9[_0x39c9('0x3e')][_0x39c9('0x42')]({'id':_0x478655[_0x39c9('0x3d')],'value':_0x4dea97[_0x478655[_0x39c9('0x44')][_0x39c9('0x11')]['toLowerCase']()][_0x39c9('0x3b')]()});}});}return _0x368ec9;}exports['queue']=function(_0x56ad2c,_0x5b6c87,_0x166b20,_0x439bd8,_0x1197d8,_0x5046fc){var _0x307035,_0x5aec12;_0x5046fc[_0x39c9('0xf')]=intUtil[_0x39c9('0x46')](_0x5046fc[_0x39c9('0xf')]);_0x5046fc['serverUrl']=intUtil['stripTrailingSlash'](_0x5046fc[_0x39c9('0x47')]);if(_0x1197d8&&_0x1197d8[_0x39c9('0x48')]){logger[_0x39c9('0xc')](_0x39c9('0x49'),_0x39c9('0x4a'));_0x5b6c87['recordingURL']=util[_0x39c9('0x1a')](_0x39c9('0x4b'),_0x5046fc[_0x39c9('0x47')],_0x5b6c87[_0x39c9('0x4c')],md5(_0x5b6c87[_0x39c9('0x4c')]));}else{_0x5b6c87[_0x39c9('0x4d')]='';}headers['Authorization']=getAuth(_0x5046fc);return getUser(_0x5046fc,_0x439bd8['email'])[_0x39c9('0x16')](function(_0x3766c0){_0x307035=_0x3766c0;logger['info'](_0x39c9('0x4e'),_0x307035['id']);return getEndUser(_0x5046fc,_0x5b6c87[_0x39c9('0x4f')],_0x5b6c87[_0x39c9('0x50')]);})[_0x39c9('0x16')](function(_0x31094a){_0x5aec12=_0x31094a;logger['info']('The\x20Enduser\x20ID\x20is:',_0x5aec12['id']);return getTicket(_0x5046fc,_0x307035,_0x5aec12,_0x166b20,_0x5b6c87);})[_0x39c9('0x16')](function(_0x2ed87d){if(_0x2ed87d){logger[_0x39c9('0xc')](_0x39c9('0x51'),_0x2ed87d['id']);switch(_0x5046fc[_0x39c9('0x3c')]){case'integrationTab':logger[_0x39c9('0xc')]('[QUEUE]',_0x39c9('0x52'));return request({'uri':util[_0x39c9('0x1a')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5046fc[_0x39c9('0xf')],_0x307035['id'],_0x2ed87d['id']),'method':_0x39c9('0x53')});case _0x39c9('0x54'):logger[_0x39c9('0xc')](_0x39c9('0x49'),_0x39c9('0x55'));emit(util[_0x39c9('0x1a')]('user:%s',_0x439bd8[_0x39c9('0x11')]),_0x39c9('0x56'),{'uri':util[_0x39c9('0x1a')](_0x39c9('0x57'),_0x5046fc['remoteUri'][_0x39c9('0x58')]('/api/v2',''),_0x2ed87d['id'])});break;default:logger[_0x39c9('0x59')]('[QUEUE]',_0x39c9('0x5a'));}}})[_0x39c9('0x5b')](function(_0x4bb318){logger[_0x39c9('0x59')](_0x39c9('0x5c'),util[_0x39c9('0x5d')](_0x4bb318,{'showHidden':!![],'depth':null}));});};exports[_0x39c9('0x5e')]=function(_0x180528,_0x4105be,_0x579166,_0x4aff0d,_0x90a2f5,_0x35ae0,_0x20a7ea){var _0x41143e,_0x5425e2;_0x35ae0['remoteUri']=intUtil[_0x39c9('0x46')](_0x35ae0[_0x39c9('0xf')]);_0x35ae0[_0x39c9('0x47')]=intUtil[_0x39c9('0x46')](_0x35ae0[_0x39c9('0x47')]);if(_0x20a7ea&&_0x20a7ea[_0x39c9('0x5f')]&&_0x20a7ea[_0x39c9('0x5f')]!==_0x39c9('0x60')){logger[_0x39c9('0xc')](_0x39c9('0x61'),_0x39c9('0x4a'));_0x4105be['recordingURL']=util[_0x39c9('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35ae0['serverUrl'],_0x4105be[_0x39c9('0x4c')],md5(_0x4105be[_0x39c9('0x4c')]));}headers[_0x39c9('0x62')]=getAuth(_0x35ae0);return getUser(_0x35ae0,_0x4aff0d[_0x39c9('0x63')])[_0x39c9('0x16')](function(_0xbac10b){_0x41143e=_0xbac10b;logger[_0x39c9('0xc')](_0x39c9('0x4e'),_0x41143e['id']);return getEndUser(_0x35ae0,_0x4105be['destcalleridname'],_0x4105be[_0x39c9('0x64')]);})['then'](function(_0x1307be){_0x5425e2=_0x1307be;logger[_0x39c9('0xc')](_0x39c9('0x65'),_0x5425e2['id']);return getTicket(_0x35ae0,_0x41143e,_0x5425e2,_0x579166,_0x4105be);})['then'](function(_0x4d0742){if(_0x4d0742){logger[_0x39c9('0xc')](_0x39c9('0x51'),_0x4d0742['id']);switch(_0x35ae0['type']){case _0x39c9('0x66'):logger[_0x39c9('0xc')](_0x39c9('0x61'),_0x39c9('0x52'));return request({'uri':util[_0x39c9('0x1a')](_0x39c9('0x67'),_0x35ae0[_0x39c9('0xf')],_0x41143e['id'],_0x4d0742['id']),'method':_0x39c9('0x53')});case _0x39c9('0x54'):logger[_0x39c9('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x39c9('0x1a')](_0x39c9('0x68'),_0x4aff0d[_0x39c9('0x11')]),_0x39c9('0x56'),{'uri':util[_0x39c9('0x1a')](_0x39c9('0x57'),_0x35ae0[_0x39c9('0xf')][_0x39c9('0x58')](_0x39c9('0x69'),''),_0x4d0742['id'])});break;default:logger['error']('[OUTBOUND]',_0x39c9('0x5a'));}}})['catch'](function(_0xd5f9fe){logger[_0x39c9('0x59')](_0x39c9('0x6a'),util['inspect'](_0xd5f9fe,{'showHidden':!![],'depth':null}));});};exports[_0x39c9('0x6b')]=function(_0x1e4a5e,_0x1e8313,_0x444f62,_0xbd8457,_0x2acd99,_0xc93c23){var _0x867059,_0xc18941;_0xc93c23[_0x39c9('0xf')]=intUtil[_0x39c9('0x46')](_0xc93c23[_0x39c9('0xf')]);_0xc93c23[_0x39c9('0x47')]=intUtil['stripTrailingSlash'](_0xc93c23[_0x39c9('0x47')]);if(_0x2acd99&&_0x2acd99[_0x39c9('0x48')]){logger['info']('['+_0x1e8313[_0x39c9('0x6c')][_0x39c9('0x6d')]()+']',_0x39c9('0x4a'));_0x1e8313['recordingURL']=util['format'](_0x39c9('0x4b'),_0xc93c23[_0x39c9('0x47')],_0x1e8313[_0x39c9('0x4c')],md5(_0x1e8313['uniqueid']));}else{_0x1e8313[_0x39c9('0x4d')]='';}headers[_0x39c9('0x62')]=getAuth(_0xc93c23);return getUser(_0xc93c23)[_0x39c9('0x16')](function(_0x5798c7){_0x867059=_0x5798c7;logger['info']('The\x20User\x20ID\x20is:',_0x867059['id']);return getEndUser(_0xc93c23,_0x1e8313[_0x39c9('0x4f')],_0x1e8313[_0x39c9('0x50')]);})['then'](function(_0x59b738){_0xc18941=_0x59b738;logger[_0x39c9('0xc')]('The\x20Enduser\x20ID\x20is:',_0xc18941['id']);return getTicket(_0xc93c23,_0x867059,_0xc18941,_0x444f62,_0x1e8313);})[_0x39c9('0x16')](function(_0x173125){if(_0x173125){logger[_0x39c9('0xc')](_0x39c9('0x51'),_0x173125['id']);}})[_0x39c9('0x5b')](function(_0x30621d){logger[_0x39c9('0x59')]('['+_0x1e8313[_0x39c9('0x6c')][_0x39c9('0x6d')]()+']'+_0x39c9('0x6e'),util[_0x39c9('0x5d')](_0x30621d,{'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 96f92f9..d20c3ff 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 _0xffab=['https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','details','The\x20failing\x20result\x20is','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','mm:ss','answertime','endtime','diff','starttime','YYYY-MM-DDTHH:mm:ss','lastevent','called','Called','connect','Call_Result','Answered','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','merge','Fields','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/api/voice/recordings/','com','destcalleridname','destcalleridnum','[OUTBOUND]','user:%s','https://crm.','unmanaged','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','refresh_token','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','format'];(function(_0x370beb,_0x1f2e8d){var _0x526edd=function(_0x583d8d){while(--_0x583d8d){_0x370beb['push'](_0x370beb['shift']());}};_0x526edd(++_0x1f2e8d);}(_0xffab,0x1a5));var _0xbffa=function(_0x26cc1c,_0x4f6b44){_0x26cc1c=_0x26cc1c-0x0;var _0x23d79c=_0xffab[_0x26cc1c];return _0x23d79c;};'use strict';var _=require(_0xbffa('0x0'));var rp=require(_0xbffa('0x1'));var md5=require(_0xbffa('0x2'));var util=require('util');var intUtil=require(_0xbffa('0x3'));var moment=require(_0xbffa('0x4'));var Redis=require('ioredis');var BPromise=require(_0xbffa('0x5'));var config=require(_0xbffa('0x6'));var logger=require(_0xbffa('0x7'))(_0xbffa('0x8'));config[_0xbffa('0x9')]=_[_0xbffa('0xa')](config[_0xbffa('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0xbffa('0xb'))(new Redis(config['redis']));function emit(_0x40bc44,_0x574cf4,_0x29acd5){io['to'](_0x40bc44)[_0xbffa('0xc')](_0x574cf4,_0x29acd5);}function request(_0x56c5f3){logger[_0xbffa('0xd')](_0xbffa('0xe'),JSON[_0xbffa('0xf')](_0x56c5f3));return rp(_0x56c5f3);}function getCustomFields(_0x3be05c,_0x464f56){var _0x3bd924={};if(_0x3be05c[_0xbffa('0x10')]>0x0){_[_0xbffa('0x11')](_0x3be05c,function(_0x202098){if(_[_0xbffa('0x12')](['string',_0xbffa('0x13')],_0x202098[_0xbffa('0x14')])&&_0x202098[_0xbffa('0x15')]){_0x3bd924[_0x202098[_0xbffa('0x15')]]=_0x202098[_0xbffa('0x16')][_0xbffa('0x17')]();}else if(_0x202098[_0xbffa('0x14')]===_0xbffa('0x18')&&_0x202098['variableName']&&_0x202098[_0xbffa('0x15')]&&_0x464f56[_0x202098[_0xbffa('0x19')]]){_0x3bd924[_0x202098[_0xbffa('0x15')]]=_0x464f56[_0x202098[_0xbffa('0x19')]][_0xbffa('0x17')]();}else if(_0x202098[_0xbffa('0x14')]===_0xbffa('0x1a')&&_0x202098['Variable']&&_0x202098['Variable']['name']&&_0x202098[_0xbffa('0x15')]&&_0x464f56[_0x202098[_0xbffa('0x1b')][_0xbffa('0x1c')][_0xbffa('0x1d')]()]){_0x3bd924[_0x202098['idField']]=_0x464f56[_0x202098[_0xbffa('0x1b')][_0xbffa('0x1c')]['toLowerCase']()][_0xbffa('0x17')]();}});}return _0x3bd924;}function getName(_0x3225ca){if(_0x3225ca[_0xbffa('0x1e')]('\x20')>0x0){var _0x12fcc8=_0x3225ca[_0xbffa('0x1f')](/ (.+)/);if(_0x12fcc8[0x1]){return _0x12fcc8;}}return[_0x3225ca,_0x3225ca];}var accountsTokens={};function getAccessToken(_0x233108){return new Promise(function(_0x5960e3,_0x2522aa){if(!_[_0xbffa('0x20')](accountsTokens[_0x233108['id']])&&!_['isNil'](accountsTokens[_0x233108['id']][_0xbffa('0x21')])){if(moment()[_0xbffa('0x22')](accountsTokens[_0x233108['id']][_0xbffa('0x23')])){_0x5960e3(accountsTokens[_0x233108['id']]['access_token']);}}var _0x6f6847;switch(_0x233108[_0xbffa('0x24')]){case'US':_0x6f6847=_0xbffa('0x25');break;case'AU':_0x6f6847=_0xbffa('0x26');break;case'EU':_0x6f6847=_0xbffa('0x27');break;case'IN':_0x6f6847=_0xbffa('0x28');break;case'CN':_0x6f6847=_0xbffa('0x29');break;default:_0x6f6847=_0xbffa('0x27');break;}var _0x5a3d68={'method':_0xbffa('0x2a'),'uri':_0x6f6847+_0xbffa('0x2b'),'qs':{'refresh_token':_0x233108[_0xbffa('0x2c')],'client_id':_0x233108[_0xbffa('0x2d')],'client_secret':_0x233108['clientSecret'],'grant_type':_0xbffa('0x2e')},'json':!![]};return rp(_0x5a3d68)['then'](function(_0x24fed0){accountsTokens[_0x233108['id']]={'access_token':_0x24fed0[_0xbffa('0x21')],'expires_in':moment()['add'](_0x24fed0['expires_in'],'seconds')};_0x5960e3(_0x24fed0['access_token']);})['catch'](function(_0xe97470){logger[_0xbffa('0x2f')](_0xbffa('0x30'),_0xe97470[_0xbffa('0x31')]);_0x2522aa(_0xe97470);});});}function getUser(_0x8cd843,_0x3890fb,_0x30e691,_0x5c2a9a){logger[_0xbffa('0x32')](_0xbffa('0x33'));return request({'method':'GET','uri':util[_0xbffa('0x34')](_0xbffa('0x35'),_0x3890fb),'qs':{'type':_0xbffa('0x36')},'headers':{'Authorization':_0xbffa('0x37')+_0x8cd843},'json':!![]})[_0xbffa('0x38')](function(_0xfbc0ab){if(_0xfbc0ab[_0xbffa('0x39')]){var _0xea766=-0x1;if(_[_0xbffa('0x3a')](_0xfbc0ab['users'])){if(!_[_0xbffa('0x20')](_0x5c2a9a)){_0xea766=_['findIndex'](_0xfbc0ab[_0xbffa('0x39')],function(_0x1ba586){return _0x1ba586['email']===_0x5c2a9a;});}if(_0xea766>=0x0){logger['info']('Agent\x20found!');}else{logger[_0xbffa('0x32')](_0xbffa('0x3b'));_0xea766=_[_0xbffa('0x3c')](_0xfbc0ab['users'],function(_0x378760){return _0x378760[_0xbffa('0x3d')][_0xbffa('0x1c')]===_0xbffa('0x3e');});}return _0xfbc0ab['users'][_0xea766];}else{if(_0xfbc0ab[_0xbffa('0x3f')][_0xbffa('0x3d')]['name']===_0xbffa('0x3e')){logger[_0xbffa('0x32')]('Using\x20the\x20admin\x20account!');user=_0xfbc0ab[_0xbffa('0x3f')];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON[_0xbffa('0xf')](_0xfbc0ab));throw new Error(_0xbffa('0x40')+JSON[_0xbffa('0xf')](_0xfbc0ab));}}}else{logger[_0xbffa('0x2f')]('The\x20failing\x20result\x20is',JSON[_0xbffa('0xf')](_0xfbc0ab));throw new Error(_0xbffa('0x40')+JSON[_0xbffa('0xf')](_0xfbc0ab));}})[_0xbffa('0x41')](function(_0x20c1a4){console[_0xbffa('0x2f')](_0x20c1a4);});}function getZohoUser(_0x588547,_0x2e7d7f){return new BPromise(function(_0x5423b5,_0x5565ff){request(_0x588547)[_0xbffa('0x38')](function(_0x2d6628){var _0x3fdfda=null;if(_0x2d6628){_0x3fdfda=_0x2d6628[_0xbffa('0x42')][0x0];_0x3fdfda[_0xbffa('0x43')]=_0x2e7d7f;}_0x5423b5(_0x3fdfda);})['catch'](function(_0x2cd938){_0x5565ff(_0x2cd938);});});}function createEndUser(_0x16aa99,_0x74ded0,_0x546ba2,_0x2f0fc7,_0x1d4b6b,_0x330041){var _0x546ba2=getName(_0x546ba2);return request({'method':_0xbffa('0x2a'),'uri':_0xbffa('0x44')+_0x74ded0+_0xbffa('0x45')+_[_0xbffa('0x46')](_0x330041[_0xbffa('0x47')])+'s','body':{'data':[{'Last_Name':_0x546ba2[0x1],'First_Name':_0x546ba2[0x0],'Phone':_0x2f0fc7,'Owner':{'name':!_[_0xbffa('0x20')](_0x1d4b6b['role'][_0xbffa('0x1c')])?_0x1d4b6b[_0xbffa('0x48')][_0xbffa('0x1c')]:!_[_0xbffa('0x20')](_0x1d4b6b['first_name'])?_0x1d4b6b[_0xbffa('0x49')]+'\x20'+_0x1d4b6b['last_name']:_0x1d4b6b[_0xbffa('0x4a')],'id':_0x1d4b6b['id']}}]},'headers':{'Authorization':_0xbffa('0x37')+_0x16aa99},'json':!![]})['then'](function(_0x5b83bf){if(_0x5b83bf&&_0x5b83bf[_0xbffa('0x42')][0x0]['code']===_0xbffa('0x4b')){var _0x134df3=_0x5b83bf[_0xbffa('0x42')][0x0][_0xbffa('0x4c')];_0x134df3['enduserType']=_['startCase'](_0x330041['moduleCreate'])+'s';return _0x134df3;}logger[_0xbffa('0x2f')](_0xbffa('0x4d'),JSON[_0xbffa('0xf')](data));throw new Error(_0xbffa('0x4e')+JSON[_0xbffa('0xf')](data));})[_0xbffa('0x41')](function(_0x4fbbb3){console[_0xbffa('0x4f')](_0xbffa('0x50'),_0x4fbbb3);});}function getEndUser(_0x1e9192,_0x1b7006,_0x375d9d,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04){var _0x18ffdf={'method':'GET','uri':'','headers':{'Authorization':_0xbffa('0x37')+_0x1e9192},'json':!![]};switch(_0xf43a04[_0xbffa('0x51')]){case'contact_lead':_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x53')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x54'))[_0xbffa('0x38')](function(_0x3d7adf){if(_0x3d7adf)return _0x3d7adf;_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x55')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x56'))[_0xbffa('0x38')](function(_0x3ab5c8){if(_0x3ab5c8)return _0x3ab5c8;if(_0xf43a04[_0xbffa('0x47')]!=_0xbffa('0x57')){return createEndUser(_0x1e9192,_0x1b7006,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04);}else{return{};}});});break;case _0xbffa('0x58'):_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x53')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x54'))[_0xbffa('0x38')](function(_0x2f33ab){if(_0x2f33ab)return _0x2f33ab;if(_0xf43a04[_0xbffa('0x47')]!=_0xbffa('0x57')){return createEndUser(_0x1e9192,_0x1b7006,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04);}else{return{};}});break;case _0xbffa('0x59'):_0x18ffdf[_0xbffa('0x52')]=_0xbffa('0x44')+_0x1b7006+_0xbffa('0x55')+_0x41bc78+'))';return getZohoUser(_0x18ffdf,_0xbffa('0x56'))[_0xbffa('0x38')](function(_0x292add){if(_0x292add)return _0x292add;if(_0xf43a04[_0xbffa('0x47')]!=_0xbffa('0x57')){return createEndUser(_0x1e9192,_0x1b7006,_0x4b224a,_0x41bc78,_0x2a345b,_0xf43a04);}else{return{};}});break;}}function getCall(_0x2ca201,_0x5560a1,_0x8a417f,_0x4b723f,_0x4e9ca6,_0xb8cd74,_0x5a2951,_0x26b510){logger['info'](_0xbffa('0x5a'));var _0x3daeee={};_0x3daeee[_0xbffa('0x5b')]={'name':!_['isNil'](_0x4b723f['role']['name'])&&!_[_0xbffa('0x20')](_0x4b723f[_0xbffa('0x3d')][_0xbffa('0x1c')])&&_0x4b723f[_0xbffa('0x3d')][_0xbffa('0x1c')]===_0xbffa('0x5c')?_0x4b723f[_0xbffa('0x48')][_0xbffa('0x1c')]:!_[_0xbffa('0x20')](_0x4b723f['first_name'])?_0x4b723f[_0xbffa('0x49')]+'\x20'+_0x4b723f[_0xbffa('0x4a')]:_0x4b723f['last_name'],'id':_0x4b723f['id']};_0x3daeee[_0xbffa('0x5d')]=intUtil[_0xbffa('0x5e')](_0xb8cd74[_0xbffa('0x5f')],_0x5a2951,'\x20');_0x3daeee['Description']=intUtil[_0xbffa('0x5e')](_0xb8cd74['Descriptions'],_0x5a2951,'\x0a');if(_0x4e9ca6[_0xbffa('0x43')]===_0xbffa('0x54')){_0x3daeee[_0xbffa('0x60')]={'name':!_[_0xbffa('0x20')](_0x4e9ca6[_0xbffa('0x61')])?_0x4e9ca6[_0xbffa('0x61')]:!_[_0xbffa('0x20')](_0x4e9ca6[_0xbffa('0x62')])?_0x4e9ca6[_0xbffa('0x62')]+'\x20'+_0x4e9ca6[_0xbffa('0x63')]:_0x4e9ca6[_0xbffa('0x63')],'id':_0x4e9ca6['id']};}if(_0x4e9ca6[_0xbffa('0x43')]===_0xbffa('0x56')){_0x3daeee[_0xbffa('0x64')]={'name':!_[_0xbffa('0x20')](_0x4e9ca6[_0xbffa('0x61')])?_0x4e9ca6[_0xbffa('0x61')]:!_['isNil'](_0x4e9ca6[_0xbffa('0x62')])?_0x4e9ca6['First_Name']+'\x20'+_0x4e9ca6[_0xbffa('0x63')]:_0x4e9ca6['Last_Name'],'id':_0x4e9ca6['id']};_0x3daeee[_0xbffa('0x65')]=_['startCase'](_0x4e9ca6['enduserType']);}if(_0x5a2951['talktime']){_0x3daeee[_0xbffa('0x66')]=moment[_0xbffa('0x67')](parseInt(_0x5a2951[_0xbffa('0x68')])*0x3e8)[_0xbffa('0x34')](_0xbffa('0x69'));}else if(_0x5a2951[_0xbffa('0x6a')]&&_0x5a2951[_0xbffa('0x6b')]){_0x3daeee['Call_Duration']=moment[_0xbffa('0x67')](moment(_0x5a2951['endtime'],'YYYY-MM-DDTHH:mm:ss')[_0xbffa('0x6c')](moment(_0x5a2951[_0xbffa('0x6d')],_0xbffa('0x6e'))))[_0xbffa('0x34')](_0xbffa('0x69'));}switch(_0x5a2951[_0xbffa('0x6f')]){case _0xbffa('0x70'):_0x3daeee['Call_Result']=_0xbffa('0x71');break;case'complete':case _0xbffa('0x72'):_0x3daeee[_0xbffa('0x73')]=_0xbffa('0x74');break;case'rejected':_0x3daeee['Call_Result']=_0xbffa('0x75');break;case _0xbffa('0x76'):_0x3daeee[_0xbffa('0x73')]=_0xbffa('0x77');break;case _0xbffa('0x78'):_0x3daeee['Call_Result']=_0xbffa('0x79');default:}_0x3daeee[_0xbffa('0x7a')]=(_0x26b510===_0xbffa('0x7b')?moment(_0x5a2951[_0xbffa('0x6d')])[_0xbffa('0x34')](_0xbffa('0x6e')):moment(_0x5a2951['agentcalledAt'])[_0xbffa('0x34')](_0xbffa('0x6e')))||moment()[_0xbffa('0x34')](_0xbffa('0x6e'));_0x3daeee[_0xbffa('0x7c')]=_0x26b510||'Inbound';_0x3daeee=_[_0xbffa('0x7d')](_0x3daeee,getCustomFields(_0xb8cd74[_0xbffa('0x7e')],_0x5a2951));return request({'method':_0xbffa('0x2a'),'uri':_0xbffa('0x44')+_0x5560a1+'/crm/v2/Calls','headers':{'Authorization':_0xbffa('0x37')+_0x2ca201},'body':{'data':[_0x3daeee]},'json':!![]})['then'](function(_0x3fbfb8){if(_0x3fbfb8&&_0x3fbfb8[_0xbffa('0x42')][0x0]['code']==='SUCCESS'){logger[_0xbffa('0x32')](_0xbffa('0x7f'));return{'id':_0x3fbfb8[_0xbffa('0x42')][0x0]['details']['id']};}})['catch'](function(_0x2150a8){logger['info'](_0xbffa('0x80'),_0x2150a8[_0xbffa('0x31')]);console[_0xbffa('0x4f')](_0xbffa('0x80'),_0x2150a8);});}exports['queue']=function(_0x43367,_0x1c9519,_0x250bcf,_0x5e7f1b,_0x30bad8,_0x4bce65){var _0x41b7dc,_0x81cf64,_0x33954e;_0x4bce65[_0xbffa('0x81')]=intUtil[_0xbffa('0x82')](_0x4bce65[_0xbffa('0x81')]);_0x4bce65['serverUrl']=intUtil['stripTrailingSlash'](_0x4bce65[_0xbffa('0x83')]);if(_0x30bad8&&_0x30bad8[_0xbffa('0x84')]){logger['info']('[QUEUE]',_0xbffa('0x85'));_0x1c9519[_0xbffa('0x86')]=_0x4bce65[_0xbffa('0x83')]+'/api/voice/recordings/'+_0x1c9519[_0xbffa('0x87')]+_0xbffa('0x88')+md5(_0x1c9519[_0xbffa('0x87')]);}else{_0x1c9519[_0xbffa('0x86')]='';}var _0x5e5fa1=_0x4bce65[_0xbffa('0x81')]===_0xbffa('0x89')?'eu':'com';return getAccessToken(_0x4bce65)['then'](function(_0x27c615){_0x33954e=_0x27c615;return getUser(_0x33954e,_0x5e5fa1,_0x4bce65,_0x5e7f1b[_0xbffa('0x8a')]);})[_0xbffa('0x38')](function(_0x17b81d){_0x41b7dc=_0x17b81d;logger[_0xbffa('0x32')](_0xbffa('0x8b'),_0x41b7dc['id']);return getEndUser(_0x33954e,_0x5e5fa1,_0x4bce65,_0x1c9519[_0xbffa('0x8c')],_0x1c9519[_0xbffa('0x8d')],_0x41b7dc,_0x250bcf);})[_0xbffa('0x38')](function(_0xd54745){_0x81cf64=_0xd54745;return getCall(_0x33954e,_0x5e5fa1,_0x4bce65,_0x41b7dc,_0x81cf64,_0x250bcf,_0x1c9519,_0xbffa('0x8e'));})['then'](function(_0x1374c5){if(_0x1374c5){logger[_0xbffa('0x32')](_0xbffa('0x8f'),_0x1374c5['id']);logger[_0xbffa('0x32')]('[QUEUE]',_0xbffa('0x90'));emit(util['format']('user:%s',_0x5e7f1b[_0xbffa('0x1c')]),_0xbffa('0x91'),{'uri':'https://crm.'+_0x4bce65[_0xbffa('0x81')]+_0xbffa('0x92')+_0x1374c5['id']});}})['catch'](function(_0x326b51){logger[_0xbffa('0x2f')]('[QUEUE]',JSON[_0xbffa('0xf')](_0x326b51));});};exports[_0xbffa('0x7b')]=function(_0x446110,_0x12ceb9,_0x7f8188,_0x4cc2a7,_0x32c273,_0x5ec592,_0x2d7623){var _0x4a8c95,_0x451fe2,_0xcc290f;_0x5ec592[_0xbffa('0x81')]=intUtil[_0xbffa('0x82')](_0x5ec592['host']);_0x5ec592[_0xbffa('0x83')]=intUtil[_0xbffa('0x82')](_0x5ec592[_0xbffa('0x83')]);if(_0x2d7623&&_0x2d7623['recordingFormat']&&_0x2d7623[_0xbffa('0x93')]!==_0xbffa('0x94')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x12ceb9[_0xbffa('0x86')]=_0x5ec592[_0xbffa('0x83')]+_0xbffa('0x95')+_0x12ceb9['uniqueid']+_0xbffa('0x88')+md5(_0x12ceb9[_0xbffa('0x87')]);}var _0x2a0319=_0x5ec592[_0xbffa('0x81')]===_0xbffa('0x89')?'eu':_0xbffa('0x96');return getAccessToken(_0x5ec592)[_0xbffa('0x38')](function(_0x3cca12){_0xcc290f=_0x3cca12;return getUser(_0xcc290f,_0x2a0319,_0x5ec592,_0x4cc2a7['email']);})['then'](function(_0x434d67){_0x4a8c95=_0x434d67;logger[_0xbffa('0x32')](_0xbffa('0x8b'),_0x4a8c95['id']);return getEndUser(_0xcc290f,_0x2a0319,_0x5ec592,_0x12ceb9[_0xbffa('0x97')],_0x12ceb9[_0xbffa('0x98')],_0x4a8c95,_0x7f8188);})[_0xbffa('0x38')](function(_0x5aed4d){_0x451fe2=_0x5aed4d;return getCall(_0xcc290f,_0x2a0319,_0x5ec592,_0x4a8c95,_0x451fe2,_0x7f8188,_0x12ceb9,'Outbound');})['then'](function(_0x104a26){if(_0x104a26){logger[_0xbffa('0x32')](_0xbffa('0x8f'),_0x104a26['id']);logger[_0xbffa('0x32')](_0xbffa('0x99'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xbffa('0x9a'),_0x4cc2a7[_0xbffa('0x1c')]),_0xbffa('0x91'),{'uri':_0xbffa('0x9b')+_0x5ec592['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x104a26['id']});}})[_0xbffa('0x41')](function(_0x158d65){logger[_0xbffa('0x2f')](_0xbffa('0x99'),JSON[_0xbffa('0xf')](_0x158d65));});};exports[_0xbffa('0x9c')]=function(_0x436819,_0x441a99,_0x140ff9,_0x3bc7c1,_0x57bcb0,_0x5f524b){var _0x133e4c,_0xc762d,_0x340086;_0x5f524b[_0xbffa('0x81')]=intUtil[_0xbffa('0x82')](_0x5f524b['host']);_0x5f524b[_0xbffa('0x83')]=intUtil[_0xbffa('0x82')](_0x5f524b[_0xbffa('0x83')]);if(_0x57bcb0&&_0x57bcb0[_0xbffa('0x84')]){logger[_0xbffa('0x32')]('['+_0x441a99[_0xbffa('0x6f')]['toUpperCase']()+']',_0xbffa('0x85'));_0x441a99[_0xbffa('0x86')]=_0x5f524b[_0xbffa('0x83')]+_0xbffa('0x95')+_0x441a99[_0xbffa('0x87')]+_0xbffa('0x88')+md5(_0x441a99[_0xbffa('0x87')]);}else{_0x441a99[_0xbffa('0x86')]='';}var _0x3a7e96=_0x5f524b[_0xbffa('0x81')]===_0xbffa('0x89')?'eu':_0xbffa('0x96');return getAccessToken(_0x5f524b)[_0xbffa('0x38')](function(_0x5836b6){_0x340086=_0x5836b6;return getUser(_0x340086,_0x3a7e96,_0x5f524b);})[_0xbffa('0x38')](function(_0x108c5c){_0x133e4c=_0x108c5c;logger['info']('The\x20User\x20ID\x20is:',_0x133e4c['id']);return getEndUser(_0x340086,_0x3a7e96,_0x5f524b,_0x441a99['calleridname'],_0x441a99[_0xbffa('0x8d')],_0x133e4c,_0x140ff9);})[_0xbffa('0x38')](function(_0x23d814){_0xc762d=_0x23d814;return getCall(_0x340086,_0x3a7e96,_0x5f524b,_0x133e4c,_0xc762d,_0x140ff9,_0x441a99,'Inbound');})[_0xbffa('0x38')](function(_0x554cce){if(_0x554cce){logger['info'](_0xbffa('0x8f'),_0x554cce['id']);}})['catch'](function(_0x446910){logger[_0xbffa('0x2f')]('['+_0x441a99[_0xbffa('0x6f')][_0xbffa('0x9d')]()+']',JSON[_0xbffa('0xf')](_0x446910));});}; \ No newline at end of file +var _0x5965=['variable','variableName','toString','Variable','name','toLowerCase','indexOf','isNil','expires_in','access_token','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','POST','/oauth/v2/token','clientId','clientSecret','refresh_token','then','seconds','catch','stack','info','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','stringify','error','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','enduserType','startCase','Error:\x20','log','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','Contacts','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','format','mm:ss','endtime','YYYY-MM-DDTHH:mm:ss','starttime','lastevent','Call_Result','Called','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','Call\x20created!','err','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Call\x20ID\x20is:','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','destcalleridnum','Outbound','unmanaged','zoho.eu','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','forEach','includes','picklist','idField','content','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5965,0x1ac));var _0x5596=function(_0x53a858,_0x297f4a){_0x53a858=_0x53a858-0x0;var _0x432186=_0x5965[_0x53a858];return _0x432186;};'use strict';var _=require(_0x5596('0x0'));var rp=require(_0x5596('0x1'));var md5=require(_0x5596('0x2'));var util=require(_0x5596('0x3'));var intUtil=require(_0x5596('0x4'));var moment=require(_0x5596('0x5'));var Redis=require(_0x5596('0x6'));var BPromise=require(_0x5596('0x7'));var config=require(_0x5596('0x8'));var logger=require(_0x5596('0x9'))('zoho');config[_0x5596('0xa')]=_[_0x5596('0xb')](config['redis'],{'host':_0x5596('0xc'),'port':0x18eb});var io=require(_0x5596('0xd'))(new Redis(config[_0x5596('0xa')]));function emit(_0x4c2f27,_0x50a368,_0x19fc22){io['to'](_0x4c2f27)['emit'](_0x50a368,_0x19fc22);}function request(_0x9d5456){logger[_0x5596('0xe')](_0x5596('0xf'),JSON['stringify'](_0x9d5456));return rp(_0x9d5456);}function getCustomFields(_0x2118b7,_0x2b5f3e){var _0x952b0e={};if(_0x2118b7['length']>0x0){_[_0x5596('0x10')](_0x2118b7,function(_0x2bdfdd){if(_[_0x5596('0x11')](['string',_0x5596('0x12')],_0x2bdfdd['type'])&&_0x2bdfdd[_0x5596('0x13')]){_0x952b0e[_0x2bdfdd['idField']]=_0x2bdfdd[_0x5596('0x14')]['toString']();}else if(_0x2bdfdd[_0x5596('0x15')]===_0x5596('0x16')&&_0x2bdfdd[_0x5596('0x17')]&&_0x2bdfdd[_0x5596('0x13')]&&_0x2b5f3e[_0x2bdfdd[_0x5596('0x17')]]){_0x952b0e[_0x2bdfdd['idField']]=_0x2b5f3e[_0x2bdfdd[_0x5596('0x17')]][_0x5596('0x18')]();}else if(_0x2bdfdd[_0x5596('0x15')]==='customVariable'&&_0x2bdfdd[_0x5596('0x19')]&&_0x2bdfdd['Variable'][_0x5596('0x1a')]&&_0x2bdfdd[_0x5596('0x13')]&&_0x2b5f3e[_0x2bdfdd[_0x5596('0x19')]['name'][_0x5596('0x1b')]()]){_0x952b0e[_0x2bdfdd[_0x5596('0x13')]]=_0x2b5f3e[_0x2bdfdd[_0x5596('0x19')]['name']['toLowerCase']()]['toString']();}});}return _0x952b0e;}function getName(_0x3fe6c0){if(_0x3fe6c0[_0x5596('0x1c')]('\x20')>0x0){var _0x4a5190=_0x3fe6c0['split'](/ (.+)/);if(_0x4a5190[0x1]){return _0x4a5190;}}return[_0x3fe6c0,_0x3fe6c0];}var accountsTokens={};function getAccessToken(_0x4c0386){return new Promise(function(_0x2ae8d2,_0x130dee){if(!_[_0x5596('0x1d')](accountsTokens[_0x4c0386['id']])&&!_[_0x5596('0x1d')](accountsTokens[_0x4c0386['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x4c0386['id']][_0x5596('0x1e')])){_0x2ae8d2(accountsTokens[_0x4c0386['id']][_0x5596('0x1f')]);}}var _0x1b3bf3;switch(_0x4c0386['zone']){case'US':_0x1b3bf3=_0x5596('0x20');break;case'AU':_0x1b3bf3=_0x5596('0x21');break;case'EU':_0x1b3bf3=_0x5596('0x22');break;case'IN':_0x1b3bf3='https://accounts.zoho.in';break;case'CN':_0x1b3bf3='https://accounts.zoho.com.cn';break;default:_0x1b3bf3='https://accounts.zoho.eu';break;}var _0x26da30={'method':_0x5596('0x23'),'uri':_0x1b3bf3+_0x5596('0x24'),'qs':{'refresh_token':_0x4c0386['refreshToken'],'client_id':_0x4c0386[_0x5596('0x25')],'client_secret':_0x4c0386[_0x5596('0x26')],'grant_type':_0x5596('0x27')},'json':!![]};return rp(_0x26da30)[_0x5596('0x28')](function(_0x7b0e1){accountsTokens[_0x4c0386['id']]={'access_token':_0x7b0e1[_0x5596('0x1f')],'expires_in':moment()['add'](_0x7b0e1[_0x5596('0x1e')],_0x5596('0x29'))};_0x2ae8d2(_0x7b0e1[_0x5596('0x1f')]);})[_0x5596('0x2a')](function(_0x2a2d1f){logger['error']('Failing\x20creating\x20the\x20access_token',_0x2a2d1f[_0x5596('0x2b')]);_0x130dee(_0x2a2d1f);});});}function getUser(_0x1cbb4f,_0x1864c7,_0x19c8c5,_0x181d42){logger[_0x5596('0x2c')](_0x5596('0x2d'));return request({'method':_0x5596('0x2e'),'uri':util['format'](_0x5596('0x2f'),_0x1864c7),'qs':{'type':_0x5596('0x30')},'headers':{'Authorization':_0x5596('0x31')+_0x1cbb4f},'json':!![]})[_0x5596('0x28')](function(_0x3676f7){if(_0x3676f7[_0x5596('0x32')]){var _0xd1b789=-0x1;if(_[_0x5596('0x33')](_0x3676f7['users'])){if(!_[_0x5596('0x1d')](_0x181d42)){_0xd1b789=_[_0x5596('0x34')](_0x3676f7[_0x5596('0x32')],function(_0x3d3b73){return _0x3d3b73[_0x5596('0x35')]===_0x181d42;});}if(_0xd1b789>=0x0){logger['info']('Agent\x20found!');}else{logger[_0x5596('0x2c')](_0x5596('0x36'));_0xd1b789=_[_0x5596('0x34')](_0x3676f7[_0x5596('0x32')],function(_0x29d77e){return _0x29d77e[_0x5596('0x37')][_0x5596('0x1a')]===_0x5596('0x38');});}return _0x3676f7[_0x5596('0x32')][_0xd1b789];}else{if(_0x3676f7['user'][_0x5596('0x37')][_0x5596('0x1a')]===_0x5596('0x38')){logger[_0x5596('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x3676f7['user'];return user;}else{logger['error'](_0x5596('0x39'),JSON[_0x5596('0x3a')](_0x3676f7));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x5596('0x3a')](_0x3676f7));}}}else{logger[_0x5596('0x3b')]('The\x20failing\x20result\x20is',JSON[_0x5596('0x3a')](_0x3676f7));throw new Error(_0x5596('0x3c')+JSON[_0x5596('0x3a')](_0x3676f7));}})['catch'](function(_0x1d5b4a){console[_0x5596('0x3b')](_0x1d5b4a);});}function getZohoUser(_0x1cf6a6,_0x9ab6f4){return new BPromise(function(_0x46d067,_0x1beeab){request(_0x1cf6a6)['then'](function(_0x56c4bc){var _0x3450be=null;if(_0x56c4bc){_0x3450be=_0x56c4bc[_0x5596('0x3d')][0x0];_0x3450be['enduserType']=_0x9ab6f4;}_0x46d067(_0x3450be);})[_0x5596('0x2a')](function(_0x7099a8){_0x1beeab(_0x7099a8);});});}function createEndUser(_0x56e0b7,_0x37bcb6,_0x5633ee,_0x2f6c58,_0x41db82,_0x31123c){var _0x5633ee=getName(_0x5633ee);return request({'method':'POST','uri':_0x5596('0x3e')+_0x37bcb6+_0x5596('0x3f')+_['startCase'](_0x31123c[_0x5596('0x40')])+'s','body':{'data':[{'Last_Name':_0x5633ee[0x1],'First_Name':_0x5633ee[0x0],'Phone':_0x2f6c58,'Owner':{'name':!_[_0x5596('0x1d')](_0x41db82[_0x5596('0x41')][_0x5596('0x1a')])?_0x41db82[_0x5596('0x41')][_0x5596('0x1a')]:!_[_0x5596('0x1d')](_0x41db82['first_name'])?_0x41db82[_0x5596('0x42')]+'\x20'+_0x41db82[_0x5596('0x43')]:_0x41db82[_0x5596('0x43')],'id':_0x41db82['id']}}]},'headers':{'Authorization':_0x5596('0x31')+_0x56e0b7},'json':!![]})['then'](function(_0xe9bf27){if(_0xe9bf27&&_0xe9bf27[_0x5596('0x3d')][0x0][_0x5596('0x44')]===_0x5596('0x45')){var _0x183387=_0xe9bf27[_0x5596('0x3d')][0x0][_0x5596('0x46')];_0x183387[_0x5596('0x47')]=_[_0x5596('0x48')](_0x31123c[_0x5596('0x40')])+'s';return _0x183387;}logger['error']('The\x20failing\x20result\x20is',JSON[_0x5596('0x3a')](data));throw new Error(_0x5596('0x49')+JSON[_0x5596('0x3a')](data));})['catch'](function(_0x4bebfb){console[_0x5596('0x4a')]('CREATE\x20ERROR',_0x4bebfb);});}function getEndUser(_0x266dea,_0x359547,_0x51e0c3,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b){var _0x3b8f5b={'method':_0x5596('0x2e'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x266dea},'json':!![]};switch(_0x45f90b['moduleSearch']){case _0x5596('0x4b'):_0x3b8f5b[_0x5596('0x4c')]='https://www.zohoapis.'+_0x359547+_0x5596('0x4d')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,'Contacts')['then'](function(_0x12b553){if(_0x12b553)return _0x12b553;_0x3b8f5b[_0x5596('0x4c')]='https://www.zohoapis.'+_0x359547+_0x5596('0x4e')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,_0x5596('0x4f'))[_0x5596('0x28')](function(_0xce378b){if(_0xce378b)return _0xce378b;if(_0x45f90b[_0x5596('0x40')]!=_0x5596('0x50')){return createEndUser(_0x266dea,_0x359547,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b);}else{return{};}});});break;case _0x5596('0x51'):_0x3b8f5b[_0x5596('0x4c')]=_0x5596('0x3e')+_0x359547+_0x5596('0x4d')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,_0x5596('0x52'))[_0x5596('0x28')](function(_0x5cb096){if(_0x5cb096)return _0x5cb096;if(_0x45f90b[_0x5596('0x40')]!=_0x5596('0x50')){return createEndUser(_0x266dea,_0x359547,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b);}else{return{};}});break;case _0x5596('0x53'):_0x3b8f5b[_0x5596('0x4c')]=_0x5596('0x3e')+_0x359547+_0x5596('0x4e')+_0x46ce5f+'))';return getZohoUser(_0x3b8f5b,_0x5596('0x4f'))[_0x5596('0x28')](function(_0x354727){if(_0x354727)return _0x354727;if(_0x45f90b[_0x5596('0x40')]!=_0x5596('0x50')){return createEndUser(_0x266dea,_0x359547,_0x5b6ce4,_0x46ce5f,_0x1daba3,_0x45f90b);}else{return{};}});break;}}function getCall(_0x13122d,_0x4b95cb,_0x3c291e,_0x2d3c2b,_0x4058ee,_0x158cdf,_0xb570bf,_0x497e40){logger[_0x5596('0x2c')](_0x5596('0x54'));var _0x7f2f76={};_0x7f2f76['Owner']={'name':!_[_0x5596('0x1d')](_0x2d3c2b[_0x5596('0x41')][_0x5596('0x1a')])&&!_[_0x5596('0x1d')](_0x2d3c2b[_0x5596('0x37')]['name'])&&_0x2d3c2b[_0x5596('0x37')][_0x5596('0x1a')]===_0x5596('0x55')?_0x2d3c2b['role'][_0x5596('0x1a')]:!_[_0x5596('0x1d')](_0x2d3c2b['first_name'])?_0x2d3c2b['first_name']+'\x20'+_0x2d3c2b[_0x5596('0x43')]:_0x2d3c2b[_0x5596('0x43')],'id':_0x2d3c2b['id']};_0x7f2f76[_0x5596('0x56')]=intUtil[_0x5596('0x57')](_0x158cdf[_0x5596('0x58')],_0xb570bf,'\x20');_0x7f2f76[_0x5596('0x59')]=intUtil[_0x5596('0x57')](_0x158cdf['Descriptions'],_0xb570bf,'\x0a');if(_0x4058ee[_0x5596('0x47')]===_0x5596('0x52')){_0x7f2f76[_0x5596('0x5a')]={'name':!_[_0x5596('0x1d')](_0x4058ee[_0x5596('0x5b')])?_0x4058ee[_0x5596('0x5b')]:!_['isNil'](_0x4058ee['First_Name'])?_0x4058ee[_0x5596('0x5c')]+'\x20'+_0x4058ee['Last_Name']:_0x4058ee[_0x5596('0x5d')],'id':_0x4058ee['id']};}if(_0x4058ee[_0x5596('0x47')]===_0x5596('0x4f')){_0x7f2f76[_0x5596('0x5e')]={'name':!_[_0x5596('0x1d')](_0x4058ee[_0x5596('0x5b')])?_0x4058ee[_0x5596('0x5b')]:!_['isNil'](_0x4058ee['First_Name'])?_0x4058ee[_0x5596('0x5c')]+'\x20'+_0x4058ee[_0x5596('0x5d')]:_0x4058ee['Last_Name'],'id':_0x4058ee['id']};_0x7f2f76['$se_module']=_[_0x5596('0x48')](_0x4058ee['enduserType']);}if(_0xb570bf[_0x5596('0x5f')]){_0x7f2f76[_0x5596('0x60')]=moment[_0x5596('0x61')](parseInt(_0xb570bf[_0x5596('0x5f')])*0x3e8)[_0x5596('0x62')](_0x5596('0x63'));}else if(_0xb570bf['answertime']&&_0xb570bf[_0x5596('0x64')]){_0x7f2f76[_0x5596('0x60')]=moment[_0x5596('0x61')](moment(_0xb570bf[_0x5596('0x64')],_0x5596('0x65'))['diff'](moment(_0xb570bf[_0x5596('0x66')],_0x5596('0x65'))))['format'](_0x5596('0x63'));}switch(_0xb570bf[_0x5596('0x67')]){case'called':_0x7f2f76[_0x5596('0x68')]=_0x5596('0x69');break;case'complete':case'connect':_0x7f2f76[_0x5596('0x68')]=_0x5596('0x6a');break;case _0x5596('0x6b'):_0x7f2f76[_0x5596('0x68')]=_0x5596('0x6c');break;case _0x5596('0x6d'):_0x7f2f76[_0x5596('0x68')]=_0x5596('0x6e');break;case _0x5596('0x6f'):_0x7f2f76['Call_Result']=_0x5596('0x70');default:}_0x7f2f76['Call_Start_Time']=(_0x497e40===_0x5596('0x71')?moment(_0xb570bf[_0x5596('0x66')])[_0x5596('0x62')](_0x5596('0x65')):moment(_0xb570bf[_0x5596('0x72')])[_0x5596('0x62')](_0x5596('0x65')))||moment()[_0x5596('0x62')](_0x5596('0x65'));_0x7f2f76[_0x5596('0x73')]=_0x497e40||_0x5596('0x74');_0x7f2f76=_[_0x5596('0x75')](_0x7f2f76,getCustomFields(_0x158cdf[_0x5596('0x76')],_0xb570bf));return request({'method':_0x5596('0x23'),'uri':'https://www.zohoapis.'+_0x4b95cb+'/crm/v2/Calls','headers':{'Authorization':_0x5596('0x31')+_0x13122d},'body':{'data':[_0x7f2f76]},'json':!![]})[_0x5596('0x28')](function(_0x5503c8){if(_0x5503c8&&_0x5503c8['data'][0x0][_0x5596('0x44')]===_0x5596('0x45')){logger[_0x5596('0x2c')](_0x5596('0x77'));return{'id':_0x5503c8[_0x5596('0x3d')][0x0][_0x5596('0x46')]['id']};}})[_0x5596('0x2a')](function(_0x21d54c){logger['info'](_0x5596('0x78'),_0x21d54c[_0x5596('0x2b')]);console[_0x5596('0x4a')](_0x5596('0x78'),_0x21d54c);});}exports['queue']=function(_0x28cadd,_0x499478,_0x31dc14,_0x241b57,_0x1301ba,_0x2b0b1b){var _0x581c5e,_0x14fb3b,_0x59824e;_0x2b0b1b[_0x5596('0x79')]=intUtil[_0x5596('0x7a')](_0x2b0b1b[_0x5596('0x79')]);_0x2b0b1b[_0x5596('0x7b')]=intUtil[_0x5596('0x7a')](_0x2b0b1b[_0x5596('0x7b')]);if(_0x1301ba&&_0x1301ba[_0x5596('0x7c')]){logger[_0x5596('0x2c')]('[QUEUE]',_0x5596('0x7d'));_0x499478[_0x5596('0x7e')]=_0x2b0b1b['serverUrl']+_0x5596('0x7f')+_0x499478['uniqueid']+_0x5596('0x80')+md5(_0x499478['uniqueid']);}else{_0x499478[_0x5596('0x7e')]='';}var _0x35302a=_0x2b0b1b[_0x5596('0x79')]==='zoho.eu'?'eu':_0x5596('0x81');return getAccessToken(_0x2b0b1b)['then'](function(_0x3e98a8){_0x59824e=_0x3e98a8;return getUser(_0x59824e,_0x35302a,_0x2b0b1b,_0x241b57[_0x5596('0x35')]);})[_0x5596('0x28')](function(_0x5ba0c1){_0x581c5e=_0x5ba0c1;logger[_0x5596('0x2c')](_0x5596('0x82'),_0x581c5e['id']);return getEndUser(_0x59824e,_0x35302a,_0x2b0b1b,_0x499478[_0x5596('0x83')],_0x499478[_0x5596('0x84')],_0x581c5e,_0x31dc14);})['then'](function(_0xb27f0){_0x14fb3b=_0xb27f0;return getCall(_0x59824e,_0x35302a,_0x2b0b1b,_0x581c5e,_0x14fb3b,_0x31dc14,_0x499478,_0x5596('0x74'));})[_0x5596('0x28')](function(_0x16c2c7){if(_0x16c2c7){logger[_0x5596('0x2c')](_0x5596('0x85'),_0x16c2c7['id']);logger[_0x5596('0x2c')](_0x5596('0x86'),_0x5596('0x87'));emit(util[_0x5596('0x62')](_0x5596('0x88'),_0x241b57[_0x5596('0x1a')]),_0x5596('0x89'),{'uri':_0x5596('0x8a')+_0x2b0b1b['host']+_0x5596('0x8b')+_0x16c2c7['id']});}})[_0x5596('0x2a')](function(_0x44153b){logger[_0x5596('0x3b')](_0x5596('0x86'),JSON['stringify'](_0x44153b));});};exports[_0x5596('0x71')]=function(_0x4145fe,_0x37ae90,_0xe1e4b4,_0x58efce,_0xe77da,_0x32ba16,_0x50cfea){var _0x3b6f9a,_0x55ed0e,_0x4bd511;_0x32ba16[_0x5596('0x79')]=intUtil[_0x5596('0x7a')](_0x32ba16['host']);_0x32ba16[_0x5596('0x7b')]=intUtil[_0x5596('0x7a')](_0x32ba16[_0x5596('0x7b')]);if(_0x50cfea&&_0x50cfea['recordingFormat']&&_0x50cfea[_0x5596('0x8c')]!==_0x5596('0x8d')){logger[_0x5596('0x2c')](_0x5596('0x8e'),'Recording\x20is\x20enabled!');_0x37ae90[_0x5596('0x7e')]=_0x32ba16[_0x5596('0x7b')]+_0x5596('0x7f')+_0x37ae90[_0x5596('0x8f')]+'/downloads?type=uniqueid&token='+md5(_0x37ae90[_0x5596('0x8f')]);}var _0xfa352b=_0x32ba16['host']==='zoho.eu'?'eu':_0x5596('0x81');return getAccessToken(_0x32ba16)['then'](function(_0x2d174f){_0x4bd511=_0x2d174f;return getUser(_0x4bd511,_0xfa352b,_0x32ba16,_0x58efce[_0x5596('0x35')]);})[_0x5596('0x28')](function(_0x44a8fb){_0x3b6f9a=_0x44a8fb;logger['info'](_0x5596('0x82'),_0x3b6f9a['id']);return getEndUser(_0x4bd511,_0xfa352b,_0x32ba16,_0x37ae90[_0x5596('0x90')],_0x37ae90[_0x5596('0x91')],_0x3b6f9a,_0xe1e4b4);})['then'](function(_0x20f02a){_0x55ed0e=_0x20f02a;return getCall(_0x4bd511,_0xfa352b,_0x32ba16,_0x3b6f9a,_0x55ed0e,_0xe1e4b4,_0x37ae90,_0x5596('0x92'));})[_0x5596('0x28')](function(_0x856c19){if(_0x856c19){logger[_0x5596('0x2c')](_0x5596('0x85'),_0x856c19['id']);logger[_0x5596('0x2c')](_0x5596('0x8e'),_0x5596('0x87'));emit(util[_0x5596('0x62')](_0x5596('0x88'),_0x58efce[_0x5596('0x1a')]),_0x5596('0x89'),{'uri':_0x5596('0x8a')+_0x32ba16[_0x5596('0x79')]+_0x5596('0x8b')+_0x856c19['id']});}})[_0x5596('0x2a')](function(_0x33a75a){logger[_0x5596('0x3b')]('[OUTBOUND]',JSON[_0x5596('0x3a')](_0x33a75a));});};exports[_0x5596('0x93')]=function(_0x2795f3,_0x3ff57a,_0x14ae17,_0x6f78ed,_0x302f86,_0x4eaf42){var _0x19eac7,_0x5df9e4,_0x32561a;_0x4eaf42[_0x5596('0x79')]=intUtil['stripTrailingSlash'](_0x4eaf42[_0x5596('0x79')]);_0x4eaf42[_0x5596('0x7b')]=intUtil[_0x5596('0x7a')](_0x4eaf42[_0x5596('0x7b')]);if(_0x302f86&&_0x302f86['monitor_format']){logger[_0x5596('0x2c')]('['+_0x3ff57a[_0x5596('0x67')]['toUpperCase']()+']',_0x5596('0x7d'));_0x3ff57a[_0x5596('0x7e')]=_0x4eaf42[_0x5596('0x7b')]+_0x5596('0x7f')+_0x3ff57a['uniqueid']+_0x5596('0x80')+md5(_0x3ff57a['uniqueid']);}else{_0x3ff57a[_0x5596('0x7e')]='';}var _0x2fb54d=_0x4eaf42['host']===_0x5596('0x94')?'eu':_0x5596('0x81');return getAccessToken(_0x4eaf42)[_0x5596('0x28')](function(_0x3dd983){_0x32561a=_0x3dd983;return getUser(_0x32561a,_0x2fb54d,_0x4eaf42);})[_0x5596('0x28')](function(_0x1cefb9){_0x19eac7=_0x1cefb9;logger[_0x5596('0x2c')](_0x5596('0x82'),_0x19eac7['id']);return getEndUser(_0x32561a,_0x2fb54d,_0x4eaf42,_0x3ff57a[_0x5596('0x83')],_0x3ff57a[_0x5596('0x84')],_0x19eac7,_0x14ae17);})['then'](function(_0x36d1fb){_0x5df9e4=_0x36d1fb;return getCall(_0x32561a,_0x2fb54d,_0x4eaf42,_0x19eac7,_0x5df9e4,_0x14ae17,_0x3ff57a,'Inbound');})[_0x5596('0x28')](function(_0x4765c7){if(_0x4765c7){logger['info'](_0x5596('0x85'),_0x4765c7['id']);}})[_0x5596('0x2a')](function(_0x260277){logger[_0x5596('0x3b')]('['+_0x3ff57a['lastevent'][_0x5596('0x95')]()+']',JSON[_0x5596('0x3a')](_0x260277));});}; \ 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 dbaab79..3940efc 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 _0xbb1b=['../../../../config/logger','trigger','data2','Script','data3','render','exec','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache'];(function(_0x421c11,_0xcf7560){var _0x317709=function(_0x5c8c71){while(--_0x5c8c71){_0x421c11['push'](_0x421c11['shift']());}};_0x317709(++_0xcf7560);}(_0xbb1b,0x105));var _0xbbb1=function(_0x165fc7,_0x5921d2){_0x165fc7=_0x165fc7-0x0;var _0x19e30a=_0xbb1b[_0x165fc7];return _0x19e30a;};'use strict';var util=require(_0xbbb1('0x0'));var sh=require(_0xbbb1('0x1'));var Mustache=require(_0xbbb1('0x2'));var logger=require(_0xbbb1('0x3'))(_0xbbb1('0x4'));exports['exec']=function(_0x5b9a16,_0xb05a8f){var _0x2a2996=_0x5b9a16[_0xbbb1('0x5')]?_0x5b9a16['data2']:_0xbbb1('0x6');var _0x456bf8=_0x5b9a16[_0xbbb1('0x7')]?Mustache[_0xbbb1('0x8')](_0x5b9a16[_0xbbb1('0x7')],_0xb05a8f):_0xb05a8f;sh[_0xbbb1('0x9')](_0x456bf8,function(_0xebca0d,_0x144426,_0x1317d5){if(_0xebca0d!==0x0){logger['error'](util[_0xbbb1('0xa')]('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x2a2996,_0x456bf8,_0xebca0d,_0x1317d5));}else{logger['info'](util[_0xbbb1('0xa')](_0xbbb1('0xb'),_0x2a2996,_0x456bf8,_0x144426));}});}; \ No newline at end of file +var _0xa6f2=['data2','Script','data3','render','exec','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','shelljs','mustache'];(function(_0x3413bd,_0x37373b){var _0xa07c8=function(_0x3d6db8){while(--_0x3d6db8){_0x3413bd['push'](_0x3413bd['shift']());}};_0xa07c8(++_0x37373b);}(_0xa6f2,0x1c1));var _0x2a6f=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa6f2[_0x46aff0];return _0x9d78cf;};'use strict';var util=require('util');var sh=require(_0x2a6f('0x0'));var Mustache=require(_0x2a6f('0x1'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x403f85,_0x3bdd51){var _0x23a2b1=_0x403f85[_0x2a6f('0x2')]?_0x403f85[_0x2a6f('0x2')]:_0x2a6f('0x3');var _0x47d777=_0x403f85[_0x2a6f('0x4')]?Mustache[_0x2a6f('0x5')](_0x403f85['data3'],_0x3bdd51):_0x3bdd51;sh[_0x2a6f('0x6')](_0x47d777,function(_0x92a587,_0xd793e7,_0x43d874){if(_0x92a587!==0x0){logger['error'](util[_0x2a6f('0x7')](_0x2a6f('0x8'),_0x23a2b1,_0x47d777,_0x92a587,_0x43d874));}else{logger[_0x2a6f('0x9')](util[_0x2a6f('0x7')](_0x2a6f('0xa'),_0x23a2b1,_0x47d777,_0xd793e7));}});}; \ 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 cddb2cc..19df722 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 _0x7a77=['stack','DELETE','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','then','isNil',',\x20request\x20body:\x20','object','stringify','format','%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','lodash','trigger','data1','toUpperCase','render','data5','number','data6','parse'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7a77,0x15e));var _0x77a7=function(_0x236712,_0x5c78df){_0x236712=_0x236712-0x0;var _0x2a472c=_0x7a77[_0x236712];return _0x2a472c;};'use strict';var rp=require(_0x77a7('0x0'));var util=require('util');var _=require(_0x77a7('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x77a7('0x2'));exports['exec']=function(_0x160d3f,_0x5bf92e){var _0x400aae,_0x124418;var _0x394c6e={'method':_0x160d3f[_0x77a7('0x3')][_0x77a7('0x4')](),'uri':Mustache[_0x77a7('0x5')](_0x160d3f['data2'],_0x5bf92e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x160d3f[_0x77a7('0x6')])===_0x77a7('0x7')&&parseInt(_0x160d3f[_0x77a7('0x6')])>=0x1&&parseInt(_0x160d3f[_0x77a7('0x6')])<=0xa?parseInt(_0x160d3f[_0x77a7('0x6')])*0x3e8:0x5*0x3e8};try{_0x394c6e['headers']=_0x160d3f[_0x77a7('0x8')]?JSON[_0x77a7('0x9')](Mustache[_0x77a7('0x5')](_0x160d3f[_0x77a7('0x8')],_0x5bf92e)):{};}catch(_0x5d32ba){logger['error'](_0x5d32ba[_0x77a7('0xa')]);}switch(_0x160d3f[_0x77a7('0x3')][_0x77a7('0x4')]()){case'GET':case _0x77a7('0xb'):_0x400aae=null;_0x394c6e['qs']=_0x5bf92e;break;case'POST':case'PUT':if(_0x160d3f['data7']){try{_0x400aae=JSON[_0x77a7('0x9')](Mustache[_0x77a7('0x5')](_0x160d3f['data7'],_0x5bf92e));_0x394c6e['body']=_0x400aae;}catch(_0x49ae5c){logger[_0x77a7('0xc')](_0x49ae5c['stack']);logger['error'](_0x77a7('0xd'));}}else{_0x400aae=_0x5bf92e;_0x394c6e[_0x77a7('0xe')]=_0x400aae;}break;}logger[_0x77a7('0xf')](util['format'](_0x77a7('0x10'),_0x160d3f[_0x77a7('0x3')],_0x160d3f[_0x77a7('0x11')],JSON['stringify'](_0x394c6e)));rp(_0x394c6e)[_0x77a7('0x12')](function(_0x56d7c3){_0x400aae=!_[_0x77a7('0x13')](_0x400aae)?_0x77a7('0x14')+_0x400aae:'';_0x124418=typeof _0x56d7c3[_0x77a7('0xe')]===_0x77a7('0x15')?JSON[_0x77a7('0x16')](_0x56d7c3[_0x77a7('0xe')]):_0x56d7c3[_0x77a7('0xe')];logger[_0x77a7('0xf')](util[_0x77a7('0x17')](_0x77a7('0x18'),_0x160d3f[_0x77a7('0x3')],_0x160d3f[_0x77a7('0x11')],_0x56d7c3[_0x77a7('0x19')],_0x124418));})[_0x77a7('0x1a')](function(_0x466800){logger[_0x77a7('0xc')](util[_0x77a7('0x17')](_0x77a7('0x1b'),_0x160d3f[_0x77a7('0x3')],_0x160d3f[_0x77a7('0x11')],_0x466800[_0x77a7('0x19')],_0x466800[_0x77a7('0x1c')],_0x466800[_0x77a7('0x1d')]));});}; \ No newline at end of file +var _0x5619=['body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','name','message','lodash','mustache','../../../../config/logger','data1','toUpperCase','render','number','data5','parse','error','GET','DELETE','POST','PUT','data7'];(function(_0x187bd9,_0x12a73c){var _0x205209=function(_0x394163){while(--_0x394163){_0x187bd9['push'](_0x187bd9['shift']());}};_0x205209(++_0x12a73c);}(_0x5619,0x1d1));var _0x9561=function(_0x37ce01,_0x48cb7a){_0x37ce01=_0x37ce01-0x0;var _0x2f6f55=_0x5619[_0x37ce01];return _0x2f6f55;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x9561('0x0'));var Mustache=require(_0x9561('0x1'));var logger=require(_0x9561('0x2'))('trigger');exports['exec']=function(_0xd67e6b,_0x1a3ee7){var _0x4c75f4,_0x4533d9;var _0x4d9cc7={'method':_0xd67e6b[_0x9561('0x3')][_0x9561('0x4')](),'uri':Mustache[_0x9561('0x5')](_0xd67e6b['data2'],_0x1a3ee7),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xd67e6b['data5'])===_0x9561('0x6')&&parseInt(_0xd67e6b[_0x9561('0x7')])>=0x1&&parseInt(_0xd67e6b[_0x9561('0x7')])<=0xa?parseInt(_0xd67e6b[_0x9561('0x7')])*0x3e8:0x5*0x3e8};try{_0x4d9cc7['headers']=_0xd67e6b['data6']?JSON[_0x9561('0x8')](Mustache[_0x9561('0x5')](_0xd67e6b['data6'],_0x1a3ee7)):{};}catch(_0x196b70){logger[_0x9561('0x9')](_0x196b70['stack']);}switch(_0xd67e6b['data1'][_0x9561('0x4')]()){case _0x9561('0xa'):case _0x9561('0xb'):_0x4c75f4=null;_0x4d9cc7['qs']=_0x1a3ee7;break;case _0x9561('0xc'):case _0x9561('0xd'):if(_0xd67e6b[_0x9561('0xe')]){try{_0x4c75f4=JSON[_0x9561('0x8')](Mustache['render'](_0xd67e6b[_0x9561('0xe')],_0x1a3ee7));_0x4d9cc7[_0x9561('0xf')]=_0x4c75f4;}catch(_0x55655f){logger[_0x9561('0x9')](_0x55655f[_0x9561('0x10')]);logger[_0x9561('0x9')](_0x9561('0x11'));}}else{_0x4c75f4=_0x1a3ee7;_0x4d9cc7['body']=_0x4c75f4;}break;}logger[_0x9561('0x12')](util[_0x9561('0x13')](_0x9561('0x14'),_0xd67e6b[_0x9561('0x3')],_0xd67e6b[_0x9561('0x15')],JSON[_0x9561('0x16')](_0x4d9cc7)));rp(_0x4d9cc7)['then'](function(_0xc92ad7){_0x4c75f4=!_['isNil'](_0x4c75f4)?_0x9561('0x17')+_0x4c75f4:'';_0x4533d9=typeof _0xc92ad7[_0x9561('0xf')]===_0x9561('0x18')?JSON[_0x9561('0x16')](_0xc92ad7[_0x9561('0xf')]):_0xc92ad7[_0x9561('0xf')];logger[_0x9561('0x12')](util[_0x9561('0x13')](_0x9561('0x19'),_0xd67e6b[_0x9561('0x3')],_0xd67e6b['data2'],_0xc92ad7[_0x9561('0x1a')],_0x4533d9));})[_0x9561('0x1b')](function(_0x1b8cd1){logger[_0x9561('0x9')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0xd67e6b[_0x9561('0x3')],_0xd67e6b[_0x9561('0x15')],_0x1b8cd1[_0x9561('0x1a')],_0x1b8cd1[_0x9561('0x1c')],_0x1b8cd1[_0x9561('0x1d')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index e8114a5..7e25d0d 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 _0xaa32=['bluebird','../../config/logger','routing','client','http','Request','request','then','debug','rpc','error','message','result','jayson/promise'];(function(_0x1db42b,_0x2647e8){var _0x1806f9=function(_0x428c51){while(--_0x428c51){_0x1db42b['push'](_0x1db42b['shift']());}};_0x1806f9(++_0x2647e8);}(_0xaa32,0x195));var _0x2aa3=function(_0xf17ec8,_0x485e7f){_0xf17ec8=_0xf17ec8-0x0;var _0x10db9d=_0xaa32[_0xf17ec8];return _0x10db9d;};'use strict';var jayson=require(_0x2aa3('0x0'));var BPromise=require(_0x2aa3('0x1'));var logger=require(_0x2aa3('0x2'))(_0x2aa3('0x3'));var client=jayson[_0x2aa3('0x4')][_0x2aa3('0x5')]({'port':0x2329});client[_0x2aa3('0x6')]=function(_0x416f8d,_0x2679eb){return new BPromise(function(_0x587544,_0x214298){return client[_0x2aa3('0x7')](_0x416f8d,_0x2679eb)[_0x2aa3('0x8')](function(_0x35f1b5){logger[_0x2aa3('0x9')](_0x2aa3('0xa'),_0x2aa3('0x3'),_0x416f8d,_0x2679eb,_0x35f1b5);if(_0x35f1b5[_0x2aa3('0xb')]){logger['error'](_0x2aa3('0xa'),_0x2aa3('0x3'),_0x416f8d,_0x35f1b5['error'][_0x2aa3('0xc')],_0x2679eb);return _0x214298(_0x35f1b5['error'][_0x2aa3('0xc')]);}else{return _0x587544(_0x35f1b5[_0x2aa3('0xd')]);}})['catch'](function(_0x4f58d7){logger[_0x2aa3('0xb')](_0x2aa3('0xa'),_0x2aa3('0x3'),_0x416f8d,_0x4f58d7,_0x2679eb);return _0x214298(_0x4f58d7);});});};module['exports']=client; \ No newline at end of file +var _0x0617=['../../config/logger','routing','client','http','Request','request','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird'];(function(_0x4b9511,_0x154b0e){var _0x1a8de5=function(_0x207278){while(--_0x207278){_0x4b9511['push'](_0x4b9511['shift']());}};_0x1a8de5(++_0x154b0e);}(_0x0617,0xfd));var _0x7061=function(_0x6b590b,_0x1a8745){_0x6b590b=_0x6b590b-0x0;var _0x518053=_0x0617[_0x6b590b];return _0x518053;};'use strict';var jayson=require(_0x7061('0x0'));var BPromise=require(_0x7061('0x1'));var logger=require(_0x7061('0x2'))(_0x7061('0x3'));var client=jayson[_0x7061('0x4')][_0x7061('0x5')]({'port':0x2329});client[_0x7061('0x6')]=function(_0x227d49,_0x2188c2){return new BPromise(function(_0x1ee953,_0x173a17){return client[_0x7061('0x7')](_0x227d49,_0x2188c2)[_0x7061('0x8')](function(_0x571146){logger['debug'](_0x7061('0x9'),_0x7061('0x3'),_0x227d49,_0x2188c2,_0x571146);if(_0x571146[_0x7061('0xa')]){logger[_0x7061('0xa')]('rpc','routing',_0x227d49,_0x571146[_0x7061('0xa')][_0x7061('0xb')],_0x2188c2);return _0x173a17(_0x571146[_0x7061('0xa')][_0x7061('0xb')]);}else{return _0x1ee953(_0x571146[_0x7061('0xc')]);}})[_0x7061('0xd')](function(_0x41ab3a){logger[_0x7061('0xa')](_0x7061('0x9'),_0x7061('0x3'),_0x227d49,_0x41ab3a,_0x2188c2);return _0x173a17(_0x41ab3a);});});};module[_0x7061('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 6a254f2..86a13bf 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 _0x1ac3=['error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings'];(function(_0x2ecea0,_0x36a83d){var _0x17ab22=function(_0x768e97){while(--_0x768e97){_0x2ecea0['push'](_0x2ecea0['shift']());}};_0x17ab22(++_0x36a83d);}(_0x1ac3,0x1cd));var _0x31ac=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x1ac3[_0x422905];return _0x33dc6c;};'use strict';var server=require(_0x31ac('0x0'));var Realtime=require(_0x31ac('0x1'));var EmailChannel=require(_0x31ac('0x2'));var mailAccount=require(_0x31ac('0x3'));var setting=require(_0x31ac('0x4'));var logger=require(_0x31ac('0x5'))(_0x31ac('0x6'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x31ac('0x7')]()[_0x31ac('0x8')](mailAccount[_0x31ac('0x9')]())['then'](realtime[_0x31ac('0xa')]())[_0x31ac('0x8')](function(){email[_0x31ac('0xb')](realtime[_0x31ac('0xc')]);return realtime;});}function main(){return server[_0x31ac('0xd')](realtime,email)[_0x31ac('0x8')](function(){return initRealtime();})[_0x31ac('0x8')](function(){return setting[_0x31ac('0xe')]();})[_0x31ac('0x8')](function(_0x33263e){return setInterval(initRealtime,_0x33263e['loginMailFrequency']*0x3e8);})['catch'](function(_0x2a3a0e){logger[_0x31ac('0xf')](_0x31ac('0x10'),_0x2a3a0e);});}main(); \ No newline at end of file +var _0x91c4=['../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','mailAccounts','catch','error','Email\x20service\x20initialization','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x91c4,0x6c));var _0x491c=function(_0xa20c09,_0x388640){_0xa20c09=_0xa20c09-0x0;var _0x53b760=_0x91c4[_0xa20c09];return _0x53b760;};'use strict';var server=require('./server');var Realtime=require(_0x491c('0x0'));var EmailChannel=require(_0x491c('0x1'));var mailAccount=require(_0x491c('0x2'));var setting=require(_0x491c('0x3'));var logger=require(_0x491c('0x4'))(_0x491c('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x491c('0x6')]()[_0x491c('0x7')](mailAccount[_0x491c('0x8')]())[_0x491c('0x7')](realtime[_0x491c('0x9')]())['then'](function(){email['refresh'](realtime[_0x491c('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x491c('0x7')](function(){return initRealtime();})[_0x491c('0x7')](function(){return setting['getSettings']();})['then'](function(_0x3ed5a6){return setInterval(initRealtime,_0x3ed5a6['loginMailFrequency']*0x3e8);})[_0x491c('0xb')](function(_0x25b887){logger[_0x491c('0xc')](_0x491c('0xd'),_0x25b887);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index f8c1ea6..6e962f9 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 _0x4a18=['Mail\x20accepted\x20from\x20routing','catch','error','lastSync','sendMail','send','Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','name','key','Imap','status','stringify','md5','emit','mailAccount:update','hasOwnProperty','active','provider','custom','imapAccounts','handleImapBox','bind','handleImapEmail','end','handleImapEnd','handleImapError','isNil','disabled','messageStatus','connected','total','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','then'];(function(_0x39b48a,_0x4e475a){var _0x2577c1=function(_0x201cd7){while(--_0x201cd7){_0x39b48a['push'](_0x39b48a['shift']());}};_0x2577c1(++_0x4e475a);}(_0x4a18,0xf1));var _0x84a1=function(_0x369534,_0x5557c4){_0x369534=_0x369534-0x0;var _0x524bf9=_0x4a18[_0x369534];return _0x524bf9;};'use strict';var _=require(_0x84a1('0x0'));var moment=require(_0x84a1('0x1'));var BPromise=require(_0x84a1('0x2'));var md5=require('md5');var Redis=require(_0x84a1('0x3'));var config=require(_0x84a1('0x4'));var logger=require(_0x84a1('0x5'))(_0x84a1('0x6'));config['redis']=_[_0x84a1('0x7')](config[_0x84a1('0x8')],{'host':_0x84a1('0x9'),'port':0x18eb});var io=require(_0x84a1('0xa'))(new Redis(config[_0x84a1('0x8')]));var EmailImap=require(_0x84a1('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x84a1('0xc'));var md5Accounts={};function EmailChannel(_0x48613f){logger[_0x84a1('0xd')](_0x84a1('0xe'));this[_0x84a1('0xf')]=_0x48613f['mailAccounts'];this['imapAccounts']={};this[_0x84a1('0x10')]=new EmailSmtp();}EmailChannel[_0x84a1('0x11')]['emit']=function(_0x5610a5){var _0x188380=this[_0x84a1('0xf')][_0x5610a5];var _0x325929={'id':_0x188380['id'],'name':_0x188380[_0x84a1('0x12')],'key':_0x188380[_0x84a1('0x13')],'active':_0x188380['active'],'Imap':{'status':_0x188380[_0x84a1('0x14')][_0x84a1('0x15')],'messageStatus':_0x188380[_0x84a1('0x14')]['messageStatus'],'total':_0x188380['Imap']['total']}};if(_['isNil'](md5Accounts[_0x5610a5])){md5Accounts[_0x5610a5]={};}var _0x5a08ee=md5(JSON[_0x84a1('0x16')](_0x325929));if(md5Accounts[_0x5610a5][_0x84a1('0x17')]!==_0x5a08ee){md5Accounts[_0x5610a5]['md5']=_0x5a08ee;io[_0x84a1('0x18')](_0x84a1('0x19'),_0x325929);}};EmailChannel[_0x84a1('0x11')]['refresh']=function(_0xaed53c){for(var _0x260233 in _0xaed53c){if(_0xaed53c[_0x84a1('0x1a')](_0x260233)){if(_0xaed53c[_0x260233][_0x84a1('0x14')]&&_0xaed53c[_0x260233][_0x84a1('0x1b')]){var _0x394956=_0xaed53c[_0x260233][_0x84a1('0x14')];if(!_0x394956['service']&&_0xaed53c[_0x260233][_0x84a1('0x1c')]!==_0x84a1('0x1d'))_0x394956['service']=_0xaed53c[_0x260233][_0x84a1('0x1c')];if(!this[_0x84a1('0x1e')][_0x84a1('0x1a')](_0x394956['id'])){this['imapAccounts'][_0x394956['id']]=new EmailImap(_0x394956,_0xaed53c[_0x260233][_0x84a1('0x6')]);this[_0x84a1('0x1e')][_0x394956['id']]['on']('box',this[_0x84a1('0x1f')][_0x84a1('0x20')](this,_0x260233));this[_0x84a1('0x1e')][_0x394956['id']]['on'](_0x84a1('0x6'),this[_0x84a1('0x21')][_0x84a1('0x20')](this,_0x260233));this['imapAccounts'][_0x394956['id']]['on'](_0x84a1('0x22'),this[_0x84a1('0x23')][_0x84a1('0x20')](this,_0x260233));this['imapAccounts'][_0x394956['id']]['on']('error',this[_0x84a1('0x24')][_0x84a1('0x20')](this,_0x260233));}}else{if(_[_0x84a1('0x25')](this['mailAccounts'][_0x260233][_0x84a1('0x14')])){this[_0x84a1('0xf')][_0x260233][_0x84a1('0x14')]={};}this[_0x84a1('0xf')][_0x260233][_0x84a1('0x14')][_0x84a1('0x15')]=_0x84a1('0x26');this[_0x84a1('0xf')][_0x260233][_0x84a1('0x14')][_0x84a1('0x27')]='';this[_0x84a1('0x18')](_0x260233);}}}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x1f')]=function(_0x3372e0,_0x46429a){if(this[_0x84a1('0xf')][_0x3372e0]){this[_0x84a1('0xf')][_0x3372e0][_0x84a1('0x14')][_0x84a1('0x15')]=_0x84a1('0x28');this[_0x84a1('0xf')][_0x3372e0][_0x84a1('0x14')]['messageStatus']=_0x46429a[_0x84a1('0x12')];if(_0x46429a['messages']){this[_0x84a1('0xf')][_0x3372e0]['Imap'][_0x84a1('0x29')]=_0x46429a[_0x84a1('0x2a')][_0x84a1('0x29')];}return this['emit'](_0x3372e0);}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x21')]=function(_0x498ee3,_0x37432f){logger[_0x84a1('0xd')](_0x84a1('0x2b'),_0x37432f[_0x84a1('0x2c')],_0x37432f[_0x84a1('0x2d')],_0x37432f[_0x84a1('0x2e')],_0x498ee3);if(this[_0x84a1('0xf')][_0x498ee3]){return mailAccount[_0x84a1('0x2f')](_0x498ee3,_0x37432f)[_0x84a1('0x30')](function(_0x4403e4){if(_0x4403e4){logger[_0x84a1('0xd')](_0x84a1('0x31'));}})[_0x84a1('0x32')](function(_0x6f9442){logger[_0x84a1('0x33')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x6f9442));});}};EmailChannel['prototype']['handleImapEnd']=function(_0x3c1087){if(this[_0x84a1('0xf')][_0x3c1087]&&this['mailAccounts'][_0x3c1087][_0x84a1('0x14')]){if(this['imapAccounts'][this[_0x84a1('0xf')][_0x3c1087][_0x84a1('0x14')]['id']]){delete this[_0x84a1('0x1e')][this['mailAccounts'][_0x3c1087][_0x84a1('0x14')]['id']];}this[_0x84a1('0xf')][_0x3c1087][_0x84a1('0x14')][_0x84a1('0x34')]=moment();this[_0x84a1('0x18')](_0x3c1087);}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x24')]=function(_0x49167d,_0x1ccf3e){if(this[_0x84a1('0xf')][_0x49167d]){this['mailAccounts'][_0x49167d][_0x84a1('0x14')]['status']=_0x84a1('0x33');this[_0x84a1('0xf')][_0x49167d]['Imap'][_0x84a1('0x27')]=_0x1ccf3e;return this['emit'](_0x49167d);}};EmailChannel[_0x84a1('0x11')][_0x84a1('0x35')]=function(_0x2d9123,_0x51617d){return this[_0x84a1('0x10')][_0x84a1('0x36')](_0x2d9123,_0x51617d);};EmailChannel['prototype']['verifySmtp']=function(_0x34629f){var _0x45e750=this;if(this[_0x84a1('0xf')][_0x34629f['id']]){if(_[_0x84a1('0x25')](this[_0x84a1('0xf')][_0x34629f['id']]['Smtp'])){this[_0x84a1('0xf')][_0x34629f['id']][_0x84a1('0x37')]={};}this[_0x84a1('0xf')][_0x34629f['id']]['Smtp'][_0x84a1('0x34')]=moment();return new BPromise(function(_0xd93b09,_0x59d9b0){return _0x45e750['smtp']['verify'](_0x34629f)['then'](function(_0x18a853){_0x45e750[_0x84a1('0xf')][_0x34629f['id']][_0x84a1('0x37')][_0x84a1('0x15')]='verified';_0x45e750['mailAccounts'][_0x34629f['id']]['Smtp'][_0x84a1('0x27')]='';_0x45e750[_0x84a1('0x18')](_0x34629f['id']);_0xd93b09(_0x18a853);})[_0x84a1('0x32')](function(_0x67e858){_0x45e750[_0x84a1('0xf')][_0x34629f['id']]['Smtp']['status']='error';_0x45e750[_0x84a1('0xf')][_0x34629f['id']][_0x84a1('0x37')][_0x84a1('0x27')]=_0x67e858;_0x45e750['emit'](_0x34629f['id']);_0x59d9b0(_0x67e858);});});}return this['smtp'][_0x84a1('0x38')](_0x34629f);};module[_0x84a1('0x39')]=EmailChannel; \ No newline at end of file +var _0xaa06=['handleImapEmail','bind','end','handleImapEnd','handleImapError','isNil','disabled','handleImapBox','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','verifySmtp','Smtp','verify','verified','catch','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','name','key','active','status','Imap','messageStatus','total','emit','mailAccount:update','refresh','service','provider','custom','hasOwnProperty','box'];(function(_0x58d5df,_0x45ee2f){var _0x16ca59=function(_0xcc5b08){while(--_0xcc5b08){_0x58d5df['push'](_0x58d5df['shift']());}};_0x16ca59(++_0x45ee2f);}(_0xaa06,0x19f));var _0x6aa0=function(_0xde924a,_0x56556e){_0xde924a=_0xde924a-0x0;var _0xa4bd7e=_0xaa06[_0xde924a];return _0xa4bd7e;};'use strict';var _=require(_0x6aa0('0x0'));var moment=require('moment');var BPromise=require(_0x6aa0('0x1'));var md5=require(_0x6aa0('0x2'));var Redis=require(_0x6aa0('0x3'));var config=require(_0x6aa0('0x4'));var logger=require(_0x6aa0('0x5'))(_0x6aa0('0x6'));config[_0x6aa0('0x7')]=_[_0x6aa0('0x8')](config[_0x6aa0('0x7')],{'host':_0x6aa0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6aa0('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x6aa0('0xa'));var mailAccount=require(_0x6aa0('0xb'));var md5Accounts={};function EmailChannel(_0x522925){logger[_0x6aa0('0xc')](_0x6aa0('0xd'));this[_0x6aa0('0xe')]=_0x522925[_0x6aa0('0xe')];this[_0x6aa0('0xf')]={};this[_0x6aa0('0x10')]=new EmailSmtp();}EmailChannel[_0x6aa0('0x11')]['emit']=function(_0xd3f190){var _0x195702=this['mailAccounts'][_0xd3f190];var _0x3510e5={'id':_0x195702['id'],'name':_0x195702[_0x6aa0('0x12')],'key':_0x195702[_0x6aa0('0x13')],'active':_0x195702[_0x6aa0('0x14')],'Imap':{'status':_0x195702['Imap'][_0x6aa0('0x15')],'messageStatus':_0x195702[_0x6aa0('0x16')][_0x6aa0('0x17')],'total':_0x195702[_0x6aa0('0x16')][_0x6aa0('0x18')]}};if(_['isNil'](md5Accounts[_0xd3f190])){md5Accounts[_0xd3f190]={};}var _0x521676=md5(JSON['stringify'](_0x3510e5));if(md5Accounts[_0xd3f190][_0x6aa0('0x2')]!==_0x521676){md5Accounts[_0xd3f190][_0x6aa0('0x2')]=_0x521676;io[_0x6aa0('0x19')](_0x6aa0('0x1a'),_0x3510e5);}};EmailChannel[_0x6aa0('0x11')][_0x6aa0('0x1b')]=function(_0x1d8fdb){for(var _0x3251f8 in _0x1d8fdb){if(_0x1d8fdb['hasOwnProperty'](_0x3251f8)){if(_0x1d8fdb[_0x3251f8][_0x6aa0('0x16')]&&_0x1d8fdb[_0x3251f8][_0x6aa0('0x14')]){var _0x5a734d=_0x1d8fdb[_0x3251f8][_0x6aa0('0x16')];if(!_0x5a734d[_0x6aa0('0x1c')]&&_0x1d8fdb[_0x3251f8][_0x6aa0('0x1d')]!==_0x6aa0('0x1e'))_0x5a734d[_0x6aa0('0x1c')]=_0x1d8fdb[_0x3251f8]['provider'];if(!this[_0x6aa0('0xf')][_0x6aa0('0x1f')](_0x5a734d['id'])){this['imapAccounts'][_0x5a734d['id']]=new EmailImap(_0x5a734d,_0x1d8fdb[_0x3251f8][_0x6aa0('0x6')]);this['imapAccounts'][_0x5a734d['id']]['on'](_0x6aa0('0x20'),this['handleImapBox']['bind'](this,_0x3251f8));this['imapAccounts'][_0x5a734d['id']]['on']('email',this[_0x6aa0('0x21')][_0x6aa0('0x22')](this,_0x3251f8));this[_0x6aa0('0xf')][_0x5a734d['id']]['on'](_0x6aa0('0x23'),this[_0x6aa0('0x24')][_0x6aa0('0x22')](this,_0x3251f8));this[_0x6aa0('0xf')][_0x5a734d['id']]['on']('error',this[_0x6aa0('0x25')][_0x6aa0('0x22')](this,_0x3251f8));}}else{if(_[_0x6aa0('0x26')](this[_0x6aa0('0xe')][_0x3251f8][_0x6aa0('0x16')])){this[_0x6aa0('0xe')][_0x3251f8][_0x6aa0('0x16')]={};}this[_0x6aa0('0xe')][_0x3251f8][_0x6aa0('0x16')][_0x6aa0('0x15')]=_0x6aa0('0x27');this['mailAccounts'][_0x3251f8]['Imap'][_0x6aa0('0x17')]='';this[_0x6aa0('0x19')](_0x3251f8);}}}};EmailChannel[_0x6aa0('0x11')][_0x6aa0('0x28')]=function(_0x3634bc,_0x55f541){if(this['mailAccounts'][_0x3634bc]){this[_0x6aa0('0xe')][_0x3634bc][_0x6aa0('0x16')][_0x6aa0('0x15')]='connected';this[_0x6aa0('0xe')][_0x3634bc][_0x6aa0('0x16')][_0x6aa0('0x17')]=_0x55f541[_0x6aa0('0x12')];if(_0x55f541['messages']){this[_0x6aa0('0xe')][_0x3634bc][_0x6aa0('0x16')][_0x6aa0('0x18')]=_0x55f541[_0x6aa0('0x29')][_0x6aa0('0x18')];}return this['emit'](_0x3634bc);}};EmailChannel[_0x6aa0('0x11')][_0x6aa0('0x21')]=function(_0x555a37,_0x5ab35c){logger[_0x6aa0('0xc')](_0x6aa0('0x2a'),_0x5ab35c['firstName'],_0x5ab35c['lastName'],_0x5ab35c[_0x6aa0('0x2b')],_0x555a37);if(this[_0x6aa0('0xe')][_0x555a37]){return mailAccount[_0x6aa0('0x2c')](_0x555a37,_0x5ab35c)[_0x6aa0('0x2d')](function(_0x510598){if(_0x510598){logger['info'](_0x6aa0('0x2e'));}})['catch'](function(_0x5250fe){logger[_0x6aa0('0x2f')](_0x6aa0('0x30'),JSON['stringify'](_0x5250fe));});}};EmailChannel[_0x6aa0('0x11')][_0x6aa0('0x24')]=function(_0x58e7bd){if(this['mailAccounts'][_0x58e7bd]&&this[_0x6aa0('0xe')][_0x58e7bd]['Imap']){if(this[_0x6aa0('0xf')][this[_0x6aa0('0xe')][_0x58e7bd][_0x6aa0('0x16')]['id']]){delete this[_0x6aa0('0xf')][this[_0x6aa0('0xe')][_0x58e7bd][_0x6aa0('0x16')]['id']];}this[_0x6aa0('0xe')][_0x58e7bd][_0x6aa0('0x16')][_0x6aa0('0x31')]=moment();this[_0x6aa0('0x19')](_0x58e7bd);}};EmailChannel[_0x6aa0('0x11')][_0x6aa0('0x25')]=function(_0x5e0309,_0x12e51f){if(this[_0x6aa0('0xe')][_0x5e0309]){this[_0x6aa0('0xe')][_0x5e0309][_0x6aa0('0x16')][_0x6aa0('0x15')]=_0x6aa0('0x2f');this[_0x6aa0('0xe')][_0x5e0309][_0x6aa0('0x16')][_0x6aa0('0x17')]=_0x12e51f;return this[_0x6aa0('0x19')](_0x5e0309);}};EmailChannel['prototype'][_0x6aa0('0x32')]=function(_0x1e526c,_0x46559b){return this['smtp']['send'](_0x1e526c,_0x46559b);};EmailChannel[_0x6aa0('0x11')][_0x6aa0('0x33')]=function(_0x2f91bd){var _0x543931=this;if(this[_0x6aa0('0xe')][_0x2f91bd['id']]){if(_[_0x6aa0('0x26')](this['mailAccounts'][_0x2f91bd['id']]['Smtp'])){this[_0x6aa0('0xe')][_0x2f91bd['id']][_0x6aa0('0x34')]={};}this['mailAccounts'][_0x2f91bd['id']][_0x6aa0('0x34')][_0x6aa0('0x31')]=moment();return new BPromise(function(_0x56d7a0,_0x36b427){return _0x543931[_0x6aa0('0x10')][_0x6aa0('0x35')](_0x2f91bd)[_0x6aa0('0x2d')](function(_0x4b99ef){_0x543931[_0x6aa0('0xe')][_0x2f91bd['id']][_0x6aa0('0x34')][_0x6aa0('0x15')]=_0x6aa0('0x36');_0x543931[_0x6aa0('0xe')][_0x2f91bd['id']][_0x6aa0('0x34')][_0x6aa0('0x17')]='';_0x543931['emit'](_0x2f91bd['id']);_0x56d7a0(_0x4b99ef);})[_0x6aa0('0x37')](function(_0x449df5){_0x543931['mailAccounts'][_0x2f91bd['id']][_0x6aa0('0x34')][_0x6aa0('0x15')]=_0x6aa0('0x2f');_0x543931[_0x6aa0('0xe')][_0x2f91bd['id']]['Smtp'][_0x6aa0('0x17')]=_0x449df5;_0x543931[_0x6aa0('0x19')](_0x2f91bd['id']);_0x36b427(_0x449df5);});});}return this[_0x6aa0('0x10')][_0x6aa0('0x35')](_0x2f91bd);};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 1a411d0..4f5576d 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 _0x69dd=['util','mailparser','simpleParser','iconv','Iconv','EventEmitter','../../../config/logger','email','mailbox','imap','account','once','ready','bind','end','handleError','getAccount','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','data5','password','anonymous@xcally.com','host','port','tls','autotls','required','prototype','handleReady','openBox','handleOpenBox','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','error','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','attributes','handleMessageAttributes','handleMessageBody','handleSimpleParser','handleMessageEnd','parser','emit','handleEnd','textCode','upperFirst','exports'];(function(_0x2a6f2a,_0x32336e){var _0x434fc9=function(_0x5b0510){while(--_0x5b0510){_0x2a6f2a['push'](_0x2a6f2a['shift']());}};_0x434fc9(++_0x32336e);}(_0x69dd,0x1b2));var _0xd69d=function(_0x1e0d9a,_0x214450){_0x1e0d9a=_0x1e0d9a-0x0;var _0x36cbe0=_0x69dd[_0x1e0d9a];return _0x36cbe0;};'use strict';var _=require('lodash');var util=require(_0xd69d('0x0'));var Imap=require('imap');var simpleParser=require(_0xd69d('0x1'))[_0xd69d('0x2')];var Iconv=require(_0xd69d('0x3'))[_0xd69d('0x4')];var EventEmitter=require('events')[_0xd69d('0x5')];var utils=require('./utils');var logger=require(_0xd69d('0x6'))(_0xd69d('0x7'));function EmailImap(_0x2ba915,_0x41784c){this[_0xd69d('0x8')]=_0x2ba915['mailbox'];this['account']=this['getAccount'](_0x2ba915,_0x41784c);this[_0xd69d('0x9')]=new Imap(this[_0xd69d('0xa')]);this['imap'][_0xd69d('0xb')](_0xd69d('0xc'),this['handleReady'][_0xd69d('0xd')](this));this[_0xd69d('0x9')]['once'](_0xd69d('0xe'),this['handleEnd'][_0xd69d('0xd')](this));this[_0xd69d('0x9')]['on']('error',this[_0xd69d('0xf')][_0xd69d('0xd')](this));this[_0xd69d('0x9')]['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap['prototype'][_0xd69d('0x10')]=function(_0x36ad89,_0x4ec820){var _0x499639={'connTimeout':_0x36ad89[_0xd69d('0x11')]?_0x36ad89[_0xd69d('0x11')]*0x3e8:0x2710,'authTimeout':_0x36ad89[_0xd69d('0x12')]?_0x36ad89['authTimeout']*0x3e8:0x1388};if(_0x36ad89[_0xd69d('0x13')]){_0x499639[_0xd69d('0x14')]=_0x36ad89['user'];if(_0x36ad89[_0xd69d('0x15')]){_0x499639[_0xd69d('0x16')]=utils[_0xd69d('0x17')](_0x36ad89['CloudProvider'][_0xd69d('0x18')],_0x36ad89['user']);}else{_0x499639[_0xd69d('0x19')]=_0x36ad89[_0xd69d('0x19')];}}else{if(_0x36ad89['authentication']){_0x499639[_0xd69d('0x14')]=_0x36ad89['user'];_0x499639[_0xd69d('0x19')]=_0x36ad89[_0xd69d('0x19')];}}_0x499639[_0xd69d('0x7')]=_0x4ec820||_0x36ad89[_0xd69d('0x14')]||_0xd69d('0x1a');_0x499639[_0xd69d('0x1b')]=_0x36ad89[_0xd69d('0x1b')];_0x499639['port']=_0x36ad89[_0xd69d('0x1c')]||0x3e1;if(_0x36ad89[_0xd69d('0x1d')]){_0x499639[_0xd69d('0x1d')]=!![];}else{_0x499639[_0xd69d('0x1d')]=![];_0x499639[_0xd69d('0x1e')]=_0xd69d('0x1f');}return _0x499639;};EmailImap[_0xd69d('0x20')][_0xd69d('0x21')]=function(){this[_0xd69d('0x9')][_0xd69d('0x22')](this[_0xd69d('0x8')],![],this[_0xd69d('0x23')]['bind'](this));};EmailImap[_0xd69d('0x20')]['handleOpenBox']=function(_0x40d419,_0x25c0ca){if(_0x40d419){this['handleError'](_0x40d419,!![]);}else{this['emit'](_0xd69d('0x24'),_0x25c0ca);this[_0xd69d('0x25')]();}};EmailImap['prototype']['handleCloseBox']=function(_0x5da9c4){if(_0x5da9c4){this[_0xd69d('0xf')](_0x5da9c4,!![]);}else{this[_0xd69d('0x9')][_0xd69d('0xe')]();}};EmailImap[_0xd69d('0x20')]['readUnseen']=function(){this['imap'][_0xd69d('0x26')]([_0xd69d('0x27')],this[_0xd69d('0x28')][_0xd69d('0xd')](this));};EmailImap['prototype'][_0xd69d('0x28')]=function(_0x1c5d92,_0x5171d2){if(_0x1c5d92){this['handleError'](_0x1c5d92,!![]);}else{if(_0x5171d2[_0xd69d('0x29')]){try{var _0x303d72=this[_0xd69d('0x9')][_0xd69d('0x2a')](_0x5171d2,{'bodies':'','markSeen':!![]});_0x303d72['on'](_0xd69d('0x2b'),this[_0xd69d('0x2c')][_0xd69d('0xd')](this));_0x303d72[_0xd69d('0xb')](_0xd69d('0x2d'),this[_0xd69d('0x2e')]['bind'](this));_0x303d72[_0xd69d('0xb')](_0xd69d('0xe'),this[_0xd69d('0x2f')][_0xd69d('0xd')](this));}catch(_0x5504ad){logger[_0xd69d('0x2d')](_0x5504ad);}}else{this['imap'][_0xd69d('0x30')](!![],this[_0xd69d('0x31')][_0xd69d('0xd')](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x259d7e){_0x259d7e['on'](_0xd69d('0x32'),this['handleMessageBody'][_0xd69d('0xd')](this));_0x259d7e[_0xd69d('0xb')](_0xd69d('0x33'),this[_0xd69d('0x34')][_0xd69d('0xd')](this));_0x259d7e[_0xd69d('0xb')](_0xd69d('0xe'),this['handleMessageEnd'][_0xd69d('0xd')](this));};EmailImap[_0xd69d('0x20')][_0xd69d('0x35')]=function(_0x54f0b0){simpleParser(_0x54f0b0,{'Iconv':Iconv},this[_0xd69d('0x36')][_0xd69d('0xd')](this));};EmailImap[_0xd69d('0x20')]['handleMessageAttributes']=function(){};EmailImap[_0xd69d('0x20')][_0xd69d('0x37')]=function(){};EmailImap[_0xd69d('0x20')][_0xd69d('0x36')]=function(_0x42173e,_0x5f27c0){if(_0x42173e){logger[_0xd69d('0x2d')](_0x42173e);}else{var _0x2dcf25=this;utils[_0xd69d('0x38')](this[_0xd69d('0xa')],_0x5f27c0,function(_0x2310b8){_0x2dcf25[_0xd69d('0x39')]('email',_0x2310b8);});}};EmailImap[_0xd69d('0x20')][_0xd69d('0x2f')]=function(){this[_0xd69d('0x9')][_0xd69d('0x30')](!![],this[_0xd69d('0x31')]['bind'](this));};EmailImap['prototype'][_0xd69d('0x2e')]=function(_0x463bf4){this[_0xd69d('0xf')](_0x463bf4);this['imap']['closeBox'](!![],this[_0xd69d('0x31')][_0xd69d('0xd')](this));};EmailImap[_0xd69d('0x20')][_0xd69d('0x3a')]=function(){this['emit'](_0xd69d('0xe'));};EmailImap[_0xd69d('0x20')]['handleError']=function(_0x476b08,_0x18d085){logger['error'](_0xd69d('0xf'),this[_0xd69d('0xa')][_0xd69d('0x7')],JSON['stringify'](_0x476b08));var _0x761ea3='';if(_0x476b08){if(_0x476b08['textCode']){_0x761ea3=_0x476b08[_0xd69d('0x3b')];}else{for(var _0x1c784c in _0x476b08){if(_0x476b08['hasOwnProperty'](_0x1c784c)){_0x761ea3+=_[_0xd69d('0x3c')](_0x1c784c)+':\x20'+_0x476b08[_0x1c784c]+'\x0a';}}}}if(_0x18d085){this[_0xd69d('0x9')][_0xd69d('0xe')]();}else{this['emit'](_0xd69d('0x2d'),_0x761ea3);this[_0xd69d('0x39')](_0xd69d('0xe'));}};module[_0xd69d('0x3d')]=EmailImap; \ No newline at end of file +var _0x2889=['body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchEnd','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','simpleParser','iconv','Iconv','EventEmitter','./utils','mailbox','getAccount','account','imap','ready','handleReady','once','end','bind','error','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','email','host','port','tls','required','openBox','handleOpenBox','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','fetch','slice','handleFetchMessage','handleFetchError','closeBox'];(function(_0x19beab,_0x2c9e3e){var _0x14d7fe=function(_0x96cb5){while(--_0x96cb5){_0x19beab['push'](_0x19beab['shift']());}};_0x14d7fe(++_0x2c9e3e);}(_0x2889,0x14a));var _0x9288=function(_0x4f83fe,_0x16d23f){_0x4f83fe=_0x4f83fe-0x0;var _0xa8fbd9=_0x2889[_0x4f83fe];return _0xa8fbd9;};'use strict';var _=require('lodash');var util=require(_0x9288('0x0'));var Imap=require('imap');var simpleParser=require('mailparser')[_0x9288('0x1')];var Iconv=require(_0x9288('0x2'))[_0x9288('0x3')];var EventEmitter=require('events')[_0x9288('0x4')];var utils=require(_0x9288('0x5'));var logger=require('../../../config/logger')('email');function EmailImap(_0x1fe9e7,_0x39aa29){this['mailbox']=_0x1fe9e7[_0x9288('0x6')];this['account']=this[_0x9288('0x7')](_0x1fe9e7,_0x39aa29);this['imap']=new Imap(this[_0x9288('0x8')]);this[_0x9288('0x9')]['once'](_0x9288('0xa'),this[_0x9288('0xb')]['bind'](this));this[_0x9288('0x9')][_0x9288('0xc')](_0x9288('0xd'),this['handleEnd'][_0x9288('0xe')](this));this[_0x9288('0x9')]['on'](_0x9288('0xf'),this[_0x9288('0x10')][_0x9288('0xe')](this));this['imap'][_0x9288('0x11')]();}util[_0x9288('0x12')](EmailImap,EventEmitter);EmailImap[_0x9288('0x13')][_0x9288('0x7')]=function(_0x4aea33,_0x2bf232){var _0x18f2c5={'connTimeout':_0x4aea33[_0x9288('0x14')]?_0x4aea33[_0x9288('0x14')]*0x3e8:0x2710,'authTimeout':_0x4aea33[_0x9288('0x15')]?_0x4aea33[_0x9288('0x15')]*0x3e8:0x1388};if(_0x4aea33[_0x9288('0x16')]){_0x18f2c5[_0x9288('0x17')]=_0x4aea33[_0x9288('0x17')];if(_0x4aea33[_0x9288('0x18')]){_0x18f2c5[_0x9288('0x19')]=utils[_0x9288('0x1a')](_0x4aea33[_0x9288('0x1b')][_0x9288('0x1c')],_0x4aea33[_0x9288('0x17')]);}else{_0x18f2c5[_0x9288('0x1d')]=_0x4aea33[_0x9288('0x1d')];}}else{if(_0x4aea33['authentication']){_0x18f2c5[_0x9288('0x17')]=_0x4aea33[_0x9288('0x17')];_0x18f2c5[_0x9288('0x1d')]=_0x4aea33['password'];}}_0x18f2c5[_0x9288('0x1e')]=_0x2bf232||_0x4aea33[_0x9288('0x17')]||'anonymous@xcally.com';_0x18f2c5[_0x9288('0x1f')]=_0x4aea33['host'];_0x18f2c5[_0x9288('0x20')]=_0x4aea33[_0x9288('0x20')]||0x3e1;if(_0x4aea33[_0x9288('0x21')]){_0x18f2c5[_0x9288('0x21')]=!![];}else{_0x18f2c5[_0x9288('0x21')]=![];_0x18f2c5['autotls']=_0x9288('0x22');}return _0x18f2c5;};EmailImap[_0x9288('0x13')][_0x9288('0xb')]=function(){this[_0x9288('0x9')][_0x9288('0x23')](this[_0x9288('0x6')],![],this['handleOpenBox'][_0x9288('0xe')](this));};EmailImap[_0x9288('0x13')][_0x9288('0x24')]=function(_0x533921,_0x5285b9){if(_0x533921){this[_0x9288('0x10')](_0x533921,!![]);}else{this['emit'](_0x9288('0x25'),_0x5285b9);this['readUnseen']();}};EmailImap[_0x9288('0x13')][_0x9288('0x26')]=function(_0x2562d9){if(_0x2562d9){this[_0x9288('0x10')](_0x2562d9,!![]);}else{this[_0x9288('0x9')]['end']();}};EmailImap[_0x9288('0x13')][_0x9288('0x27')]=function(){this['imap'][_0x9288('0x28')]([_0x9288('0x29')],this[_0x9288('0x2a')][_0x9288('0xe')](this));};EmailImap['prototype'][_0x9288('0x2a')]=function(_0x3537b6,_0x55948e){if(_0x3537b6){this[_0x9288('0x10')](_0x3537b6,!![]);}else{if(_0x55948e['length']){try{var _0x1a0188=this[_0x9288('0x9')][_0x9288('0x2b')](_0x55948e[_0x9288('0x2c')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x1a0188['on']('message',this[_0x9288('0x2d')][_0x9288('0xe')](this));_0x1a0188['once'](_0x9288('0xf'),this[_0x9288('0x2e')][_0x9288('0xe')](this));_0x1a0188['once'](_0x9288('0xd'),this['handleFetchEnd'][_0x9288('0xe')](this));}catch(_0x38bffa){logger[_0x9288('0xf')](_0x38bffa);}}else{this['imap'][_0x9288('0x2f')](!![],this[_0x9288('0x26')]['bind'](this));}}};EmailImap[_0x9288('0x13')][_0x9288('0x2d')]=function(_0x120f73){_0x120f73['on'](_0x9288('0x30'),this[_0x9288('0x31')][_0x9288('0xe')](this));_0x120f73[_0x9288('0xc')](_0x9288('0x32'),this[_0x9288('0x33')][_0x9288('0xe')](this));_0x120f73['once'](_0x9288('0xd'),this[_0x9288('0x34')][_0x9288('0xe')](this));};EmailImap[_0x9288('0x13')]['handleMessageBody']=function(_0x475582){simpleParser(_0x475582,{'Iconv':Iconv},this[_0x9288('0x35')]['bind'](this));};EmailImap[_0x9288('0x13')][_0x9288('0x33')]=function(){};EmailImap[_0x9288('0x13')][_0x9288('0x34')]=function(){};EmailImap[_0x9288('0x13')][_0x9288('0x35')]=function(_0x36bfa5,_0x443ea8){if(_0x36bfa5){logger[_0x9288('0xf')](_0x36bfa5);}else{var _0x190034=this;utils[_0x9288('0x36')](this[_0x9288('0x8')],_0x443ea8,function(_0x5e88db){_0x190034[_0x9288('0x37')](_0x9288('0x1e'),_0x5e88db);});}};EmailImap[_0x9288('0x13')][_0x9288('0x38')]=function(){this[_0x9288('0x9')][_0x9288('0x2f')](!![],this[_0x9288('0x26')][_0x9288('0xe')](this));};EmailImap[_0x9288('0x13')][_0x9288('0x2e')]=function(_0x293d71){this['handleError'](_0x293d71);this[_0x9288('0x9')][_0x9288('0x2f')](!![],this[_0x9288('0x26')][_0x9288('0xe')](this));};EmailImap[_0x9288('0x13')][_0x9288('0x39')]=function(){this[_0x9288('0x37')](_0x9288('0xd'));};EmailImap[_0x9288('0x13')][_0x9288('0x10')]=function(_0xad7795,_0x4bf3ba){logger[_0x9288('0xf')](_0x9288('0x10'),this[_0x9288('0x8')][_0x9288('0x1e')],JSON[_0x9288('0x3a')](_0xad7795));var _0x571547='';if(_0xad7795){if(_0xad7795[_0x9288('0x3b')]){_0x571547=_0xad7795[_0x9288('0x3b')];}else{for(var _0x45a4ba in _0xad7795){if(_0xad7795[_0x9288('0x3c')](_0x45a4ba)){_0x571547+=_[_0x9288('0x3d')](_0x45a4ba)+':\x20'+_0xad7795[_0x45a4ba]+'\x0a';}}}}if(_0x4bf3ba){this[_0x9288('0x9')]['end']();}else{this[_0x9288('0x37')](_0x9288('0xf'),_0x571547);this[_0x9288('0x37')](_0x9288('0xd'));}};module[_0x9288('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 200e0da..807b7e8 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 _0xdb76=['exports','nodemailer-plugin-inline-base64','prototype','send','createTransport','sendMail','toString','verify','Not\x20verifired'];(function(_0x63aa4b,_0x2079d7){var _0x25bf70=function(_0x3949d3){while(--_0x3949d3){_0x63aa4b['push'](_0x63aa4b['shift']());}};_0x25bf70(++_0x2079d7);}(_0xdb76,0xc7));var _0x6db7=function(_0xf0b070,_0x26d94d){_0xf0b070=_0xf0b070-0x0;var _0x1726e2=_0xdb76[_0xf0b070];return _0x1726e2;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x6db7('0x0'));function EmailSmtp(){}EmailSmtp[_0x6db7('0x1')][_0x6db7('0x2')]=function(_0x1d2fa1,_0x1a68a3){return new Promise(function(_0x36df4d,_0xb212ef){var _0x1ad1f9=nodemailer[_0x6db7('0x3')](_0x1d2fa1);_0x1ad1f9['use']('compile',inlineBase64());_0x1ad1f9[_0x6db7('0x4')](_0x1a68a3,function(_0x1eae01,_0x426cfa){if(_0x1eae01){_0xb212ef(_0x1eae01[_0x6db7('0x5')]());}else{_0x36df4d(_0x426cfa);}});});};EmailSmtp[_0x6db7('0x1')]['verify']=function(_0x2498f8){return new Promise(function(_0x12f128,_0x167cd3){var _0x30f3fb=nodemailer[_0x6db7('0x3')](_0x2498f8);_0x30f3fb[_0x6db7('0x6')](function(_0x55da98,_0x2c7c1b){if(_0x55da98){_0x167cd3(_0x55da98[_0x6db7('0x5')]());}else{if(_0x2c7c1b){_0x12f128(_0x2c7c1b);}else{_0x167cd3(_0x6db7('0x7'));}}});});};module[_0x6db7('0x8')]=EmailSmtp; \ No newline at end of file +var _0xa61b=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','createTransport','compile','sendMail','verify','Not\x20verifired'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xa61b,0x184));var _0xba61=function(_0x2e9378,_0x4fc2ad){_0x2e9378=_0x2e9378-0x0;var _0x19a16e=_0xa61b[_0x2e9378];return _0x19a16e;};'use strict';var nodemailer=require(_0xba61('0x0'));var inlineBase64=require(_0xba61('0x1'));function EmailSmtp(){}EmailSmtp[_0xba61('0x2')]['send']=function(_0x180a8d,_0x31c057){return new Promise(function(_0x334d03,_0x301a53){var _0x576207=nodemailer[_0xba61('0x3')](_0x180a8d);_0x576207['use'](_0xba61('0x4'),inlineBase64());_0x576207[_0xba61('0x5')](_0x31c057,function(_0x386d67,_0x554bfb){if(_0x386d67){_0x301a53(_0x386d67['toString']());}else{_0x334d03(_0x554bfb);}});});};EmailSmtp[_0xba61('0x2')]['verify']=function(_0x1dfc5b){return new Promise(function(_0x1f15c3,_0x1244c2){var _0x1d62f6=nodemailer[_0xba61('0x3')](_0x1dfc5b);_0x1d62f6[_0xba61('0x6')](function(_0x310545,_0x4c85e0){if(_0x310545){_0x1244c2(_0x310545['toString']());}else{if(_0x4c85e0){_0x1f15c3(_0x4c85e0);}else{_0x1244c2(_0xba61('0x7'));}}});});};module[_0xba61('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6a57039..5cd7ba4 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 _0x6e72=['toString','base64','moment','node-tnef','../../../config/environment','head','value','address','anonymous','@xcally.com','name','substring','indexOf','length','slice','join','Anonymous','pop','isEmpty','html','test','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8'];(function(_0x2b0511,_0x127ce8){var _0x5a50d3=function(_0x27d4f4){while(--_0x27d4f4){_0x2b0511['push'](_0x2b0511['shift']());}};_0x5a50d3(++_0x127ce8);}(_0x6e72,0xe3));var _0x26e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e72[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var moment=require(_0x26e7('0x0'));var random=require('randomstring');var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0x26e7('0x1'));var logger=require('../../../config/logger')('email');var config=require(_0x26e7('0x2'));function getAddress(_0x3cd0d9){var _0x26245b=_[_0x26e7('0x3')](_0x3cd0d9[_0x26e7('0x4')]);return _0x26245b&&_0x26245b['address']?_0x26245b[_0x26e7('0x5')]:_0x26e7('0x6')+random['generate'](0x6)+_0x26e7('0x7');}function getFirstName(_0x3138f2){var _0x15d996=_[_0x26e7('0x3')](_0x3138f2[_0x26e7('0x4')]);if(_0x15d996&&_0x15d996['name']){if(_0x15d996[_0x26e7('0x8')]==_0x15d996[_0x26e7('0x5')]){return _0x15d996[_0x26e7('0x8')][_0x26e7('0x9')](0x0,_0x15d996[_0x26e7('0x8')][_0x26e7('0xa')]('@'));}var _0x28fafa=_0x15d996[_0x26e7('0x8')]['split'](/\s+/);return _0x28fafa[_0x26e7('0xb')]>0x1?_0x28fafa[_0x26e7('0xc')](0x0,-0x1)[_0x26e7('0xd')]('\x20'):_0x15d996[_0x26e7('0x8')];}return _0x26e7('0xe');}function getLastName(_0x5b8d69){var _0x3908aa=_[_0x26e7('0x3')](_0x5b8d69[_0x26e7('0x4')]);if(_0x3908aa&&_0x3908aa[_0x26e7('0x8')]){var _0x158757=_0x3908aa[_0x26e7('0x8')]['split'](/\s+/);return _0x158757['length']>0x1?_0x158757[_0x26e7('0xf')]():'';}return'';}function getMails(_0x539f49,_0x3f3933){var _0x545eef='';for(var _0x17cf44=0x0;_0x17cf44<_0x3f3933[_0x26e7('0x4')]['length'];_0x17cf44+=0x1){if(_0x3f3933[_0x26e7('0x4')][_0x17cf44][_0x26e7('0x5')]!==_0x539f49){if(!_[_0x26e7('0x10')](_0x545eef)){_0x545eef+=',';}_0x545eef+=_0x3f3933[_0x26e7('0x4')][_0x17cf44]['name']||_0x3f3933[_0x26e7('0x4')][_0x17cf44][_0x26e7('0x5')]||'';_0x545eef+='\x20<';_0x545eef+=_0x3f3933[_0x26e7('0x4')][_0x17cf44]['address']?_0x3f3933[_0x26e7('0x4')][_0x17cf44][_0x26e7('0x5')]:_0x26e7('0x6')+random['generate'](0x6)+_0x26e7('0x7');_0x545eef+='>';}}return _0x545eef;}function parseEmail(_0x2e38e7,_0x3b9e54,_0x57630a){if(_0x3b9e54[_0x26e7('0x11')]){var _0xbae9e9=/)<[^<]*)*<\/script>/gi;while(_0xbae9e9[_0x26e7('0x12')](_0x3b9e54[_0x26e7('0x11')])){_0x3b9e54[_0x26e7('0x11')]=_0x3b9e54['html'][_0x26e7('0x13')](_0xbae9e9,'');}if(_0x3b9e54[_0x26e7('0x11')][_0x26e7('0x14')](_0x26e7('0x15'))){var _0x16b95c=[];_0x3b9e54[_0x26e7('0x16')][_0x26e7('0x17')](_0x37900b=>{_0x16b95c['push'](_0x37900b[_0x26e7('0x18')]);});var _0x2b224e=/]+>/g;var _0x29112d=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4f6cfc=_0x3b9e54['html'][_0x26e7('0x13')](_0x29112d,'_SRC');var _0x1b46c8=_0x4f6cfc[_0x26e7('0x13')](_0x2b224e,_0x26e7('0x19'));for(let _0x1618c9=0x0;_0x1618c9<_0x16b95c[_0x26e7('0xb')];_0x1618c9++){var _0x38c924=_0x1b46c8[_0x26e7('0x13')](_0x26e7('0x19'),_0x26e7('0x1a')+_0x16b95c[_0x1618c9]+_0x26e7('0x1b'));_0x1b46c8=_0x38c924;}_0x3b9e54[_0x26e7('0x11')]=_0x1b46c8;}_0x57630a[_0x26e7('0x1c')]=_0x3b9e54[_0x26e7('0x11')];}else{_0x57630a[_0x26e7('0x1c')]=_0x3b9e54[_0x26e7('0x1d')];}if(_0x57630a['body']){_0x57630a[_0x26e7('0x1c')]=_0x57630a['body']['replace'](/0x0){var _0x43766d=['Auto-Submitted:\x20auto-replied',_0x26e7('0x31'),_0x26e7('0x32')];for(var _0x2811a8=0x0;_0x2811a8<_0x3b9e54[_0x26e7('0x30')][_0x26e7('0xb')];_0x2811a8++){var _0x733bb4=_['indexOf'](_0x43766d,_0x3b9e54[_0x26e7('0x30')][_0x2811a8]['line']);if(_0x733bb4>=0x0){_0x57630a['isAutoreply']=!![];}}}return _0x57630a;}exports[_0x26e7('0x33')]=function(_0x47b444,_0x11d4bf,_0x125f94){var _0x25a65a={'from':getAddress(_0x11d4bf[_0x26e7('0x34')]),'firstName':getFirstName(_0x11d4bf['from']),'lastName':getLastName(_0x11d4bf[_0x26e7('0x34')]),'mapKey':'email','message':{'from':getMails(_0x47b444['email'],_0x11d4bf[_0x26e7('0x34')]),'to':_0x47b444[_0x26e7('0x21')],'cc':'','subject':_0x11d4bf[_0x26e7('0x35')]||'','messageId':_0x11d4bf[_0x26e7('0x36')],'inReplyTo':_0x11d4bf[_0x26e7('0x37')],'sentAt':moment(_0x11d4bf[_0x26e7('0x38')])[_0x26e7('0x28')](_0x26e7('0x39')),'attach':![],'attachments':[]}};if(!_0x11d4bf['html']&&!_0x11d4bf[_0x26e7('0x1d')]){var _0x26e340=_[_0x26e7('0x3a')](_0x11d4bf[_0x26e7('0x16')],{'contentType':_0x26e7('0x3b')});if(_0x26e340[_0x26e7('0xb')]){logger[_0x26e7('0x3c')](util[_0x26e7('0x28')](_0x26e7('0x3d'),_0x11d4bf['messageId']));tnef[_0x26e7('0x3e')](_[_0x26e7('0x3f')](_0x26e340)[_0x26e7('0x2e')],function(_0x293865,_0x24dcf9){if(_0x24dcf9){_0x11d4bf[_0x26e7('0x11')]=_0x24dcf9[_0x26e7('0x40')]||'

Empty\x20message

';if(_0x24dcf9['Attachments']){for(var _0xfe0fbc=0x0;_0xfe0fbc<_0x24dcf9[_0x26e7('0x41')]['length'];_0xfe0fbc++){var _0x4a128d=_0x24dcf9['Attachments'][_0xfe0fbc];_0x25a65a[_0x26e7('0x1f')][_0x26e7('0x16')][_0x26e7('0x42')]({'filename':_0x4a128d['Title'],'content':Buffer[_0x26e7('0x34')](_0x4a128d[_0x26e7('0x43')])});}}}_0x125f94(parseEmail(_0x47b444,_0x11d4bf,_0x25a65a));});}else{_0x11d4bf[_0x26e7('0x11')]=_0x26e7('0x44');_0x125f94(parseEmail(_0x47b444,_0x11d4bf,_0x25a65a));}}else{_0x125f94(parseEmail(_0x47b444,_0x11d4bf,_0x25a65a));}};exports[_0x26e7('0x45')]=function(_0x1d4ef0,_0x84c253){var _0x41e965=[_0x26e7('0x46')+(_0x84c253||''),_0x26e7('0x47')+_0x1d4ef0,'',''];return Buffer['from'](_0x41e965[_0x26e7('0xd')](''),_0x26e7('0x48'))[_0x26e7('0x49')](_0x26e7('0x4a'));}; \ No newline at end of file +var _0x4680=['_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','base64','moment','path','util','node-tnef','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','split','slice','join','Anonymous','length','pop','html','replace','includes','0x1?_0x458aa1[_0x0468('0x10')](0x0,-0x1)[_0x0468('0x11')]('\x20'):_0x1741e9[_0x0468('0xc')];}return _0x0468('0x12');}function getLastName(_0x397f8c){var _0x5744fd=_[_0x0468('0xb')](_0x397f8c[_0x0468('0x6')]);if(_0x5744fd&&_0x5744fd[_0x0468('0xc')]){var _0x101b15=_0x5744fd[_0x0468('0xc')][_0x0468('0xf')](/\s+/);return _0x101b15[_0x0468('0x13')]>0x1?_0x101b15[_0x0468('0x14')]():'';}return'';}function getMails(_0x3878be,_0x14b978){var _0x18aac5='';for(var _0x225416=0x0;_0x225416<_0x14b978[_0x0468('0x6')][_0x0468('0x13')];_0x225416+=0x1){if(_0x14b978[_0x0468('0x6')][_0x225416][_0x0468('0x7')]!==_0x3878be){if(!_['isEmpty'](_0x18aac5)){_0x18aac5+=',';}_0x18aac5+=_0x14b978['value'][_0x225416][_0x0468('0xc')]||_0x14b978[_0x0468('0x6')][_0x225416]['address']||'';_0x18aac5+='\x20<';_0x18aac5+=_0x14b978[_0x0468('0x6')][_0x225416][_0x0468('0x7')]?_0x14b978['value'][_0x225416]['address']:_0x0468('0x8')+random['generate'](0x6)+_0x0468('0xa');_0x18aac5+='>';}}return _0x18aac5;}function parseEmail(_0xf3ca57,_0x17c212,_0x37ec58){if(_0x17c212[_0x0468('0x15')]){var _0x210b31=/)<[^<]*)*<\/script>/gi;while(_0x210b31['test'](_0x17c212[_0x0468('0x15')])){_0x17c212[_0x0468('0x15')]=_0x17c212[_0x0468('0x15')][_0x0468('0x16')](_0x210b31,'');}if(_0x17c212[_0x0468('0x15')][_0x0468('0x17')](_0x0468('0x18'))){var _0x3ab112=[];_0x17c212[_0x0468('0x19')]['forEach'](_0x16b9b7=>{_0x3ab112[_0x0468('0x1a')](_0x16b9b7[_0x0468('0x1b')]);});var _0x36d163=/]+>/g;var _0x504094=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4b0fd1=_0x17c212['html']['replace'](_0x504094,_0x0468('0x1c'));var _0x3bcda9=_0x4b0fd1[_0x0468('0x16')](_0x36d163,_0x0468('0x1d'));for(let _0x260329=0x0;_0x260329<_0x3ab112[_0x0468('0x13')];_0x260329++){var _0x3d6fb=_0x3bcda9['replace'](_0x0468('0x1d'),_0x0468('0x1e')+_0x3ab112[_0x260329]+_0x0468('0x1f'));_0x3bcda9=_0x3d6fb;}_0x17c212['html']=_0x3bcda9;}_0x37ec58[_0x0468('0x20')]=_0x17c212[_0x0468('0x15')];}else{_0x37ec58[_0x0468('0x20')]=_0x17c212[_0x0468('0x21')];}if(_0x37ec58['body']){_0x37ec58[_0x0468('0x20')]=_0x37ec58[_0x0468('0x20')][_0x0468('0x16')](/0x0){var _0x3fec24=['Auto-Submitted:\x20auto-replied',_0x0468('0x33'),_0x0468('0x34')];for(var _0x4ef2b0=0x0;_0x4ef2b0<_0x17c212[_0x0468('0x32')]['length'];_0x4ef2b0++){var _0x380227=_[_0x0468('0xe')](_0x3fec24,_0x17c212[_0x0468('0x32')][_0x4ef2b0][_0x0468('0x35')]);if(_0x380227>=0x0){_0x37ec58[_0x0468('0x36')]=!![];}}}return _0x37ec58;}exports['parser']=function(_0x357abd,_0x4d6f27,_0x5627f8){var _0x5c33c5={'from':getAddress(_0x4d6f27['from']),'firstName':getFirstName(_0x4d6f27[_0x0468('0x37')]),'lastName':getLastName(_0x4d6f27[_0x0468('0x37')]),'mapKey':_0x0468('0x4'),'message':{'from':getMails(_0x357abd['email'],_0x4d6f27[_0x0468('0x37')]),'to':_0x357abd['email'],'cc':'','subject':_0x4d6f27[_0x0468('0x38')]||'','messageId':_0x4d6f27[_0x0468('0x39')],'inReplyTo':_0x4d6f27['inReplyTo'],'sentAt':moment(_0x4d6f27[_0x0468('0x3a')])[_0x0468('0x2a')](_0x0468('0x3b')),'attach':![],'attachments':[]}};if(!_0x4d6f27[_0x0468('0x15')]&&!_0x4d6f27['textAsHtml']){var _0x309e54=_[_0x0468('0x3c')](_0x4d6f27[_0x0468('0x19')],{'contentType':_0x0468('0x3d')});if(_0x309e54[_0x0468('0x13')]){logger['info'](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x4d6f27[_0x0468('0x39')]));tnef['parseBuffer'](_[_0x0468('0x3e')](_0x309e54)['content'],function(_0x1321b7,_0x4c5fe5){if(_0x4c5fe5){_0x4d6f27[_0x0468('0x15')]=_0x4c5fe5[_0x0468('0x3f')]||_0x0468('0x40');if(_0x4c5fe5[_0x0468('0x41')]){for(var _0xd613ff=0x0;_0xd613ff<_0x4c5fe5[_0x0468('0x41')][_0x0468('0x13')];_0xd613ff++){var _0x44a32b=_0x4c5fe5[_0x0468('0x41')][_0xd613ff];_0x5c33c5['message'][_0x0468('0x19')][_0x0468('0x1a')]({'filename':_0x44a32b[_0x0468('0x42')],'content':Buffer[_0x0468('0x37')](_0x44a32b[_0x0468('0x43')])});}}}_0x5627f8(parseEmail(_0x357abd,_0x4d6f27,_0x5c33c5));});}else{_0x4d6f27[_0x0468('0x15')]=_0x0468('0x40');_0x5627f8(parseEmail(_0x357abd,_0x4d6f27,_0x5c33c5));}}else{_0x5627f8(parseEmail(_0x357abd,_0x4d6f27,_0x5c33c5));}};exports[_0x0468('0x44')]=function(_0x59aabc,_0x2a80e0){var _0x34461b=[_0x0468('0x45')+(_0x2a80e0||''),_0x0468('0x46')+_0x59aabc,'',''];return Buffer['from'](_0x34461b['join'](''),'utf-8')['toString'](_0x0468('0x47'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 679f0f2..9c90d84 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 _0xbbbc=['lodash','name','Service','key','SERV','active','Smtp','exports'];(function(_0x2a9dba,_0x38493a){var _0x3a4c5a=function(_0x22c06e){while(--_0x22c06e){_0x2a9dba['push'](_0x2a9dba['shift']());}};_0x3a4c5a(++_0x38493a);}(_0xbbbc,0x128));var _0xcbbb=function(_0x418fa3,_0x464468){_0x418fa3=_0x418fa3-0x0;var _0x845083=_0xbbbc[_0x418fa3];return _0x845083;};'use strict';var _=require(_0xcbbb('0x0'));function MailAccount(_0x29e2e6){this['id']=_0x29e2e6['id']||0x0;this[_0xcbbb('0x1')]=_0x29e2e6[_0xcbbb('0x1')]||_0xcbbb('0x2');this[_0xcbbb('0x3')]=_0x29e2e6[_0xcbbb('0x3')]||_0xcbbb('0x4');this[_0xcbbb('0x5')]=_0x29e2e6[_0xcbbb('0x5')]||![];this['Imap']=_0x29e2e6['Imap']||[];this['Smtp']=_0x29e2e6[_0xcbbb('0x6')]||[];}module[_0xcbbb('0x7')]=MailAccount; \ No newline at end of file +var _0x9ca5=['SERV','active','Imap','Smtp','exports','name','key'];(function(_0x3bbe89,_0x2e1ba3){var _0x32842b=function(_0x22678f){while(--_0x22678f){_0x3bbe89['push'](_0x3bbe89['shift']());}};_0x32842b(++_0x2e1ba3);}(_0x9ca5,0xbb));var _0x59ca=function(_0x34951f,_0x277327){_0x34951f=_0x34951f-0x0;var _0x487db1=_0x9ca5[_0x34951f];return _0x487db1;};'use strict';var _=require('lodash');function MailAccount(_0x2ad62b){this['id']=_0x2ad62b['id']||0x0;this[_0x59ca('0x0')]=_0x2ad62b[_0x59ca('0x0')]||'Service';this['key']=_0x2ad62b[_0x59ca('0x1')]||_0x59ca('0x2');this[_0x59ca('0x3')]=_0x2ad62b[_0x59ca('0x3')]||![];this[_0x59ca('0x4')]=_0x2ad62b[_0x59ca('0x4')]||[];this[_0x59ca('0x5')]=_0x2ad62b[_0x59ca('0x5')]||[];}module[_0x59ca('0x6')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 1b0c59f..be3c887 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 _0x9f9d=['mailAccounts','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','length','isUndefined','merge','exports','lodash'];(function(_0x4c157b,_0x4e074c){var _0x4a8f27=function(_0x5a0f9d){while(--_0x5a0f9d){_0x4c157b['push'](_0x4c157b['shift']());}};_0x4a8f27(++_0x4e074c);}(_0x9f9d,0x1c2));var _0xd9f9=function(_0x3903f2,_0x59033d){_0x3903f2=_0x3903f2-0x0;var _0x7d0aa=_0x9f9d[_0x3903f2];return _0x7d0aa;};'use strict';var _=require(_0xd9f9('0x0'));var MailAccount=require('../model/mailAccount');var Realtime=function(){this[_0xd9f9('0x1')]={};};function freeIsNotKey(_0x5d509a,_0x304306,_0x4aa4ee){var _0x56b636=_[_0xd9f9('0x2')](_0x5d509a,function(_0x123d30,_0x10fb7e){return _0x123d30[_0x4aa4ee];});for(var _0x1f423e in _0x304306){if(_0x304306[_0xd9f9('0x3')](_0x1f423e)){if(!_0x56b636[_0x1f423e]){delete _0x304306[_0x1f423e];}}}}Realtime[_0xd9f9('0x4')][_0xd9f9('0x5')]=function(_0x107a9b,_0x2ef653){for(var _0x327a5b in _0x2ef653){if(_0x107a9b[_0xd9f9('0x3')](_0x327a5b)){_0x107a9b[_0x327a5b]=_0x2ef653[_0x327a5b];}}};Realtime['prototype'][_0xd9f9('0x6')]=function(){var _0x252c5e=this;return function(_0x4787c9){if(_0x4787c9){freeIsNotKey(_0x4787c9,_0x252c5e[_0xd9f9('0x1')],'id');for(var _0x4a591f=0x0,_0x4df6f0={},_0x43b37c={};_0x4a591f<_0x4787c9[_0xd9f9('0x7')];_0x4a591f+=0x1){_0x4df6f0=_0x4787c9[_0x4a591f];if(_[_0xd9f9('0x8')](_0x252c5e[_0xd9f9('0x1')][_0x4df6f0['id']])){_0x252c5e[_0xd9f9('0x1')][_0x4df6f0['id']]=new MailAccount(_0x4df6f0);}else{_[_0xd9f9('0x9')](_0x252c5e['mailAccounts'][_0x4df6f0['id']],_0x4df6f0);}}}return _0x252c5e[_0xd9f9('0x1')];};};module[_0xd9f9('0xa')]=Realtime; \ No newline at end of file +var _0x5bea=['hasOwnProperty','prototype','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x4d55f1,_0x1a3c97){var _0x32a917=function(_0x5550be){while(--_0x5550be){_0x4d55f1['push'](_0x4d55f1['shift']());}};_0x32a917(++_0x1a3c97);}(_0x5bea,0x8c));var _0xa5be=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x5bea[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xa5be('0x0'));var MailAccount=require(_0xa5be('0x1'));var Realtime=function(){this[_0xa5be('0x2')]={};};function freeIsNotKey(_0x6a5f99,_0x25a972,_0xef91b6){var _0x188690=_[_0xa5be('0x3')](_0x6a5f99,function(_0x376006,_0x23dd3b){return _0x376006[_0xef91b6];});for(var _0x174834 in _0x25a972){if(_0x25a972[_0xa5be('0x4')](_0x174834)){if(!_0x188690[_0x174834]){delete _0x25a972[_0x174834];}}}}Realtime[_0xa5be('0x5')]['mergeFromDatabase']=function(_0x18e6ba,_0x5e3f39){for(var _0x2b4581 in _0x5e3f39){if(_0x18e6ba['hasOwnProperty'](_0x2b4581)){_0x18e6ba[_0x2b4581]=_0x5e3f39[_0x2b4581];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x50dc33=this;return function(_0x4b27a7){if(_0x4b27a7){freeIsNotKey(_0x4b27a7,_0x50dc33['mailAccounts'],'id');for(var _0x4c3095=0x0,_0x5a668e={},_0x49a294={};_0x4c3095<_0x4b27a7[_0xa5be('0x6')];_0x4c3095+=0x1){_0x5a668e=_0x4b27a7[_0x4c3095];if(_[_0xa5be('0x7')](_0x50dc33[_0xa5be('0x2')][_0x5a668e['id']])){_0x50dc33[_0xa5be('0x2')][_0x5a668e['id']]=new MailAccount(_0x5a668e);}else{_['merge'](_0x50dc33[_0xa5be('0x2')][_0x5a668e['id']],_0x5a668e);}}}return _0x50dc33[_0xa5be('0x2')];};};module[_0xa5be('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index f76123d..95b1471 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 _0xc812=['Request','name','provider','service','email','key','ListId','MailServerIn','Imap','CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts'];(function(_0x478e87,_0x1e7a3d){var _0x107532=function(_0x59343e){while(--_0x59343e){_0x478e87['push'](_0x478e87['shift']());}};_0x107532(++_0x1e7a3d);}(_0xc812,0xbc));var _0x2c81=function(_0x273973,_0x7effd2){_0x273973=_0x273973-0x0;var _0x3a2fae=_0xc812[_0x273973];return _0x3a2fae;};'use strict';var client=require(_0x2c81('0x0'));exports[_0x2c81('0x1')]=function(){return function(){return client[_0x2c81('0x2')]('GetMailAccount',{'options':{'attributes':['id',_0x2c81('0x3'),_0x2c81('0x4'),_0x2c81('0x5'),_0x2c81('0x6'),'active',_0x2c81('0x7'),_0x2c81('0x8'),'TemplateId'],'raw':![],'include':[{'model':_0x2c81('0x9'),'as':_0x2c81('0xa'),'include':[{'model':_0x2c81('0xb'),'attributes':['id',_0x2c81('0x3'),_0x2c81('0x5'),_0x2c81('0xc'),'data5'],'as':_0x2c81('0xb')}]},{'model':_0x2c81('0xd'),'as':_0x2c81('0xe'),'include':[{'model':_0x2c81('0xb'),'attributes':['id',_0x2c81('0x3'),'service',_0x2c81('0xc'),_0x2c81('0xf')],'as':_0x2c81('0xb')}]}]},'log':_0x2c81('0x10')});};};exports[_0x2c81('0x11')]=function(_0x2d199c,_0x26683c){return client['Request'](_0x2c81('0x12'),{'account':{'id':_0x2d199c},'body':_0x26683c,'log':_0x2c81('0x12')});}; \ No newline at end of file +var _0x7eff=['provider','service','email','active','TemplateId','MailServerIn','Imap','CloudProvider','name','type','data5','MailServerOut','Smtp','getMailAccount','getMailAccounts','Request','GetMailAccount'];(function(_0x22a11c,_0x491be3){var _0x58a425=function(_0x2b2c50){while(--_0x2b2c50){_0x22a11c['push'](_0x22a11c['shift']());}};_0x58a425(++_0x491be3);}(_0x7eff,0x162));var _0xf7ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7eff[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xf7ef('0x0')]=function(){return function(){return client[_0xf7ef('0x1')](_0xf7ef('0x2'),{'options':{'attributes':['id','name',_0xf7ef('0x3'),_0xf7ef('0x4'),_0xf7ef('0x5'),_0xf7ef('0x6'),'key','ListId',_0xf7ef('0x7')],'raw':![],'include':[{'model':_0xf7ef('0x8'),'as':_0xf7ef('0x9'),'include':[{'model':_0xf7ef('0xa'),'attributes':['id',_0xf7ef('0xb'),_0xf7ef('0x4'),_0xf7ef('0xc'),_0xf7ef('0xd')],'as':'CloudProvider'}]},{'model':_0xf7ef('0xe'),'as':_0xf7ef('0xf'),'include':[{'model':'CloudProvider','attributes':['id',_0xf7ef('0xb'),'service','type',_0xf7ef('0xd')],'as':'CloudProvider'}]}]},'log':_0xf7ef('0x10')});};};exports['notify']=function(_0x5dfa60,_0x4ed444){return client[_0xf7ef('0x1')]('NotifyMailAccount',{'account':{'id':_0x5dfa60},'body':_0x4ed444,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index fc143a1..b06127c 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 _0xf3f6=['getSettings','Request','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf3f6,0x149));var _0x6f3f=function(_0x312da9,_0x4103b2){_0x312da9=_0x312da9-0x0;var _0x4b16a3=_0xf3f6[_0x312da9];return _0x4b16a3;};'use strict';var client=require(_0x6f3f('0x0'));exports[_0x6f3f('0x1')]=function(){return client[_0x6f3f('0x2')](_0x6f3f('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6f3f('0x4')]},'log':_0x6f3f('0x5')});}; \ No newline at end of file +var _0xb0d0=['../client','Request','ShowSetting','loginMailFrequency'];(function(_0x361dff,_0x4e4fbe){var _0x4bd5c3=function(_0x186432){while(--_0x186432){_0x361dff['push'](_0x361dff['shift']());}};_0x4bd5c3(++_0x4e4fbe);}(_0xb0d0,0x1bc));var _0x0b0d=function(_0x10ca92,_0x34c927){_0x10ca92=_0x10ca92-0x0;var _0x5a212b=_0xb0d0[_0x10ca92];return _0x5a212b;};'use strict';var client=require(_0x0b0d('0x0'));exports['getSettings']=function(){return client[_0x0b0d('0x1')](_0x0b0d('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0b0d('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 15c3274..c567f33 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index fcd1a50..1cade21 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 _0x969e=['default','../../config/socketio','../../config/express','../../routes','once','listening','log','port','exports','http','../../config/environment','timeout','listen','polling','defaults','redis','adapter','socket.io-redis'];(function(_0x422d23,_0x3a9056){var _0x465a26=function(_0x4d796e){while(--_0x4d796e){_0x422d23['push'](_0x422d23['shift']());}};_0x465a26(++_0x3a9056);}(_0x969e,0xf3));var _0xe969=function(_0x4426cb,_0x589c33){_0x4426cb=_0x4426cb-0x0;var _0x323e1e=_0x969e[_0x4426cb];return _0x323e1e;};'use strict';var _=require('lodash');var http=require(_0xe969('0x0'));var express=require('express');var sticky=require('sticky-session');var Redis=require('ioredis');var config=require(_0xe969('0x1'));var app=express();var server=http['createServer'](app);server[_0xe969('0x2')]=0xdbba0;if(sticky[_0xe969('0x3')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':['websocket',_0xe969('0x4')]});config['redis']=_[_0xe969('0x5')](config[_0xe969('0x6')],{'host':'localhost','port':0x18eb});socketio[_0xe969('0x7')](require(_0xe969('0x8'))({'pubClient':new Redis(config[_0xe969('0x6')]),'subClient':new Redis(config[_0xe969('0x6')])}));require('../../config/triggers')[_0xe969('0x9')]();require(_0xe969('0xa'))['default'](socketio);require(_0xe969('0xb'))['default'](app);require(_0xe969('0xc'))[_0xe969('0x9')](app);}else{server[_0xe969('0xd')](_0xe969('0xe'),function(){console[_0xe969('0xf')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0xe969('0x10')]);});}exports=module[_0xe969('0x11')]=app; \ No newline at end of file +var _0x721c=['../../config/triggers','default','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','port','exports','lodash','http','sticky-session','ioredis','createServer','timeout','listen','websocket','polling','redis','localhost','adapter'];(function(_0x573ebc,_0x3c3111){var _0x30ab52=function(_0x45b39c){while(--_0x45b39c){_0x573ebc['push'](_0x573ebc['shift']());}};_0x30ab52(++_0x3c3111);}(_0x721c,0x72));var _0xc721=function(_0x3f3c1b,_0x5eb5b0){_0x3f3c1b=_0x3f3c1b-0x0;var _0x8f757f=_0x721c[_0x3f3c1b];return _0x8f757f;};'use strict';var _=require(_0xc721('0x0'));var http=require(_0xc721('0x1'));var express=require('express');var sticky=require(_0xc721('0x2'));var Redis=require(_0xc721('0x3'));var config=require('../../config/environment');var app=express();var server=http[_0xc721('0x4')](app);server[_0xc721('0x5')]=0xdbba0;if(sticky[_0xc721('0x6')](server,config['port'])){var socketio=require('socket.io')(server,{'transports':[_0xc721('0x7'),_0xc721('0x8')]});config[_0xc721('0x9')]=_['defaults'](config[_0xc721('0x9')],{'host':_0xc721('0xa'),'port':0x18eb});socketio[_0xc721('0xb')](require('socket.io-redis')({'pubClient':new Redis(config[_0xc721('0x9')]),'subClient':new Redis(config[_0xc721('0x9')])}));require(_0xc721('0xc'))[_0xc721('0xd')]();require('../../config/socketio')['default'](socketio);require(_0xc721('0xe'))[_0xc721('0xd')](app);require(_0xc721('0xf'))[_0xc721('0xd')](app);}else{server[_0xc721('0x10')](_0xc721('0x11'),function(){console['log'](_0xc721('0x12'),config[_0xc721('0x13')]);});}exports=module[_0xc721('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c753ca1..f0c305b 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 _0x35e0=['client','http','Request','request','error','rpc','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing'];(function(_0x531629,_0x324e7a){var _0x29d370=function(_0x3a5fdd){while(--_0x3a5fdd){_0x531629['push'](_0x531629['shift']());}};_0x29d370(++_0x324e7a);}(_0x35e0,0x1d8));var _0x035e=function(_0x17c53,_0x109296){_0x17c53=_0x17c53-0x0;var _0x54d0d5=_0x35e0[_0x17c53];return _0x54d0d5;};'use strict';var jayson=require(_0x035e('0x0'));var BPromise=require(_0x035e('0x1'));var logger=require(_0x035e('0x2'))(_0x035e('0x3'));var client=jayson[_0x035e('0x4')][_0x035e('0x5')]({'port':0x2329});client[_0x035e('0x6')]=function(_0x5c80b1,_0x31bc6e){return new BPromise(function(_0x41542e,_0x269ac8){return client[_0x035e('0x7')](_0x5c80b1,_0x31bc6e)['then'](function(_0x5c719b){logger['debug']('rpc',_0x035e('0x3'),_0x5c80b1,_0x31bc6e,_0x5c719b);if(_0x5c719b['error']){logger[_0x035e('0x8')](_0x035e('0x9'),_0x035e('0x3'),_0x5c80b1,_0x5c719b[_0x035e('0x8')][_0x035e('0xa')],_0x31bc6e);return _0x269ac8(_0x5c719b['error']['message']);}else{return _0x41542e(_0x5c719b[_0x035e('0xb')]);}})[_0x035e('0xc')](function(_0x3f7608){logger[_0x035e('0x8')]('rpc',_0x035e('0x3'),_0x5c80b1,_0x3f7608,_0x31bc6e);return _0x269ac8(_0x3f7608);});});};module[_0x035e('0xd')]=client; \ No newline at end of file +var _0x53ec=['http','Request','request','then','rpc','error','message','result','catch','exports','../../config/logger','routing','client'];(function(_0x45f870,_0xf9f9fc){var _0x303cf0=function(_0x5e86d6){while(--_0x5e86d6){_0x45f870['push'](_0x45f870['shift']());}};_0x303cf0(++_0xf9f9fc);}(_0x53ec,0xb3));var _0xc53e=function(_0x355494,_0x592917){_0x355494=_0x355494-0x0;var _0x59d215=_0x53ec[_0x355494];return _0x59d215;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0xc53e('0x0'))(_0xc53e('0x1'));var client=jayson[_0xc53e('0x2')][_0xc53e('0x3')]({'port':0x2329});client[_0xc53e('0x4')]=function(_0x2e0f23,_0x5d2225){return new BPromise(function(_0x4b301b,_0x455ec9){return client[_0xc53e('0x5')](_0x2e0f23,_0x5d2225)[_0xc53e('0x6')](function(_0x317f7b){logger['debug'](_0xc53e('0x7'),_0xc53e('0x1'),_0x2e0f23,_0x5d2225,_0x317f7b);if(_0x317f7b[_0xc53e('0x8')]){logger[_0xc53e('0x8')]('rpc','routing',_0x2e0f23,_0x317f7b['error'][_0xc53e('0x9')],_0x5d2225);return _0x455ec9(_0x317f7b['error'][_0xc53e('0x9')]);}else{return _0x4b301b(_0x317f7b[_0xc53e('0xa')]);}})[_0xc53e('0xb')](function(_0x1bf370){logger[_0xc53e('0x8')](_0xc53e('0x7'),_0xc53e('0x1'),_0x2e0f23,_0x1bf370,_0x5d2225);return _0x455ec9(_0x1bf370);});});};module[_0xc53e('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ffb3874..5169817 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 _0x2ecc=['initChatQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','getAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0x1534e9,_0xfaa30c){var _0x306449=function(_0x33fca7){while(--_0x33fca7){_0x1534e9['push'](_0x1534e9['shift']());}};_0x306449(++_0xfaa30c);}(_0x2ecc,0x1b8));var _0xc2ec=function(_0x1443c3,_0x4d9452){_0x1443c3=_0x1443c3-0x0;var _0x4c48d3=_0x2ecc[_0x1443c3];return _0x4c48d3;};'use strict';var BPromise=require('bluebird');var server=require(_0xc2ec('0x0'));var Realtime=require(_0xc2ec('0x1'));var user=require(_0xc2ec('0x2'));var interval=require(_0xc2ec('0x3'));var openchannelQueue=require(_0xc2ec('0x4'));var chatQueue=require(_0xc2ec('0x5'));var smsQueue=require(_0xc2ec('0x6'));var mailQueue=require(_0xc2ec('0x7'));var faxQueue=require(_0xc2ec('0x8'));var whatsappQueue=require(_0xc2ec('0x9'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user[_0xc2ec('0xa')]())['then'](realtime['initAgents']())[_0xc2ec('0xb')](interval['getIntervals']())[_0xc2ec('0xb')](realtime[_0xc2ec('0xc')]())[_0xc2ec('0xb')](openchannelQueue[_0xc2ec('0xd')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0xe')]())[_0xc2ec('0xb')](chatQueue[_0xc2ec('0xf')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0x10')]())[_0xc2ec('0xb')](smsQueue['getSmsQueues']())[_0xc2ec('0xb')](realtime['initSmsQueues']())[_0xc2ec('0xb')](mailQueue['getMailQueues']())[_0xc2ec('0xb')](realtime[_0xc2ec('0x11')]())[_0xc2ec('0xb')](faxQueue[_0xc2ec('0x12')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0x13')]())[_0xc2ec('0xb')](whatsappQueue[_0xc2ec('0x14')]())[_0xc2ec('0xb')](realtime[_0xc2ec('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0xc2ec('0x16')](realtime)[_0xc2ec('0xb')](function(_0x5a78b2){return initRealtime();})[_0xc2ec('0xb')](function(_0x1b872e){return setInterval(initRealtime,0x1388);})[_0xc2ec('0x17')](function(_0x110302){console['log'](_0x110302);});}main(); \ No newline at end of file +var _0x4f9f=['initMailQueues','initFaxQueues','listen','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','./rpc/whatsappQueue','then','initAgents','initIntervals','initOpenchannelQueues','getSmsQueues','initSmsQueues'];(function(_0x33bcf4,_0x19338b){var _0x663c8e=function(_0x23b9ed){while(--_0x23b9ed){_0x33bcf4['push'](_0x33bcf4['shift']());}};_0x663c8e(++_0x19338b);}(_0x4f9f,0xd5));var _0xf4f9=function(_0xa9d6d1,_0x3762b2){_0xa9d6d1=_0xa9d6d1-0x0;var _0x53a4cb=_0x4f9f[_0xa9d6d1];return _0x53a4cb;};'use strict';var BPromise=require(_0xf4f9('0x0'));var server=require(_0xf4f9('0x1'));var Realtime=require(_0xf4f9('0x2'));var user=require(_0xf4f9('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xf4f9('0x4'));var chatQueue=require(_0xf4f9('0x5'));var smsQueue=require(_0xf4f9('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0xf4f9('0x7'));var whatsappQueue=require(_0xf4f9('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise['resolve']()['then'](user['getAgents']())[_0xf4f9('0x9')](realtime[_0xf4f9('0xa')]())[_0xf4f9('0x9')](interval['getIntervals']())[_0xf4f9('0x9')](realtime[_0xf4f9('0xb')]())[_0xf4f9('0x9')](openchannelQueue['getOpenchannelQueues']())['then'](realtime[_0xf4f9('0xc')]())['then'](chatQueue['getChatQueues']())[_0xf4f9('0x9')](realtime['initChatQueues']())['then'](smsQueue[_0xf4f9('0xd')]())[_0xf4f9('0x9')](realtime[_0xf4f9('0xe')]())[_0xf4f9('0x9')](mailQueue['getMailQueues']())[_0xf4f9('0x9')](realtime[_0xf4f9('0xf')]())['then'](faxQueue['getFaxQueues']())['then'](realtime[_0xf4f9('0x10')]())[_0xf4f9('0x9')](whatsappQueue['getWhatsappQueues']())[_0xf4f9('0x9')](realtime['initWhatsappQueues']())[_0xf4f9('0x9')](function(){return realtime;});}function main(){return server[_0xf4f9('0x11')](realtime)[_0xf4f9('0x9')](function(_0x104244){return initRealtime();})['then'](function(_0x41eec3){return setInterval(initRealtime,0x1388);})['catch'](function(_0x1780b3){console[_0xf4f9('0x12')](_0x1780b3);});}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 8e7d59f..a4e0137 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x11f54d,_0x21d717){var _0x22d270=function(_0x277445){while(--_0x277445){_0x11f54d['push'](_0x11f54d['shift']());}};_0x22d270(++_0x21d717);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xc4aa[_0x3511d3];return _0x5d6321;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x814b=['init','parse','map','object','lodash','util','events','EventEmitter','isNil','register','ignoreFactChanges','inherits','prototype','rules','isArray','concat','isObject','push','sync','filter','activeRules','orderBy','asc','execute','result','clone','name','ruleRef','call','next','isEqual','nextTick','restart','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','consequence','fromJSON'];(function(_0x448b31,_0x3680f8){var _0x49798b=function(_0x1a46ef){while(--_0x1a46ef){_0x448b31['push'](_0x448b31['shift']());}};_0x49798b(++_0x3680f8);}(_0x814b,0x1a2));var _0xb814=function(_0x5beda8,_0x1e8554){_0x5beda8=_0x5beda8-0x0;var _0x2aa042=_0x814b[_0x5beda8];return _0x2aa042;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var EventEmitter=require(_0xb814('0x2'))[_0xb814('0x3')];function RuleEngine(_0xfbb64b,_0x477725){this['init']();if(!_[_0xb814('0x4')](_0xfbb64b)){this[_0xb814('0x5')](_0xfbb64b);}if(_0x477725){this[_0xb814('0x6')]=_0x477725[_0xb814('0x6')];}return this;}util[_0xb814('0x7')](RuleEngine,EventEmitter);RuleEngine[_0xb814('0x8')]['init']=function(_0x3b0829){this[_0xb814('0x9')]=[];this['activeRules']=[];};RuleEngine[_0xb814('0x8')][_0xb814('0x5')]=function(_0x186d5a){if(Array[_0xb814('0xa')](_0x186d5a)){this[_0xb814('0x9')]=this[_0xb814('0x9')][_0xb814('0xb')](_0x186d5a);}else if(_0x186d5a!==null&&_[_0xb814('0xc')](_0x186d5a)){this[_0xb814('0x9')][_0xb814('0xd')](_0x186d5a);}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0xe')]=function(){this['activeRules']=this[_0xb814('0x9')][_0xb814('0xf')](function(_0x35b10d){if(_[_0xb814('0x4')](_0x35b10d['on'])){_0x35b10d['on']=!![];}if(_0x35b10d['on']===!![]){return _0x35b10d;}});this[_0xb814('0x10')]=_[_0xb814('0x11')](this[_0xb814('0x10')],['p'],[_0xb814('0x12')]);};RuleEngine[_0xb814('0x8')][_0xb814('0x13')]=function(_0x3f4881,_0x44fb96){var _0x17f5bd=![];_0x3f4881[_0xb814('0x14')]=!![];var _0x303aca=_[_0xb814('0x15')](_0x3f4881);var _0x45e0d0=_[_0xb814('0x15')](_0x3f4881);var _0x125ce2=this[_0xb814('0x10')];var _0x7a21ef=[];var _0x48c9df=this[_0xb814('0x6')];(function FnRuleLoop(_0x55ba16){var _0x270598={'rules':function(){return _0x125ce2;},'rule':function(){return _0x125ce2[_0x55ba16];},'when':function(_0xfac75b){if(_0xfac75b){var _0x4c3007=_0x125ce2[_0x55ba16]['consequence'];_0x4c3007['ruleRef']=_0x125ce2[_0x55ba16]['id']||_0x125ce2[_0x55ba16][_0xb814('0x16')]||'index_'+_0x55ba16;process['nextTick'](function(){_0x7a21ef[_0xb814('0xd')](_0x4c3007[_0xb814('0x17')]);_0x4c3007[_0xb814('0x18')](_0x303aca,_0x270598);});}else{process['nextTick'](function(){_0x270598[_0xb814('0x19')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x17f5bd=!![];return FnRuleLoop(0x0);},'next':function(_0x531032){if(!_0x48c9df&&!_[_0xb814('0x1a')](_0x45e0d0,_0x303aca)){_0x45e0d0=_[_0xb814('0x15')](_0x303aca);process[_0xb814('0x1b')](function(){_0x270598[_0xb814('0x1c')]();});}else{process[_0xb814('0x1b')](function(){if(_[_0xb814('0x4')](_0x531032)){return FnRuleLoop(_0x55ba16+0x1);}else{return FnRuleLoop(_0x531032);}});}}};if(_0x55ba16<_0x125ce2[_0xb814('0x1d')]&&_0x17f5bd===![]){var _0x594470=_0x125ce2[_0x55ba16][_0xb814('0x1e')];_0x594470['call'](_0x303aca,_0x270598);}else{process[_0xb814('0x1b')](function(){_0x303aca[_0xb814('0x1f')]=_0x7a21ef;return _0x44fb96?_0x44fb96(_0x303aca):_[_0xb814('0x20')]();});}}(0x0));};RuleEngine[_0xb814('0x8')][_0xb814('0x21')]=function(_0xb9e57d){if(_[_0xb814('0x4')](_0xb9e57d)){return this['rules'];}else{var _0x392222=_[_0xb814('0x22')](_0xb9e57d);return _[_0xb814('0xf')](this[_0xb814('0x9')],_0x392222);}};RuleEngine[_0xb814('0x8')][_0xb814('0x23')]=function(_0x3f0150,_0x1e4e89){var _0x5a6291=_0x3f0150==='on'||_0x3f0150==='ON'?!![]:![];var _0x271aa8=this[_0xb814('0x21')](_0x1e4e89);for(var _0x52ed64=0x0,_0x9008b2=_0x271aa8[_0xb814('0x1d')];_0x52ed64<_0x9008b2;_0x52ed64+=0x1){_0x271aa8[_0x52ed64]['on']=_0x5a6291;}this[_0xb814('0xe')]();};RuleEngine['prototype'][_0xb814('0x24')]=function(_0x2051d0,_0x58c3ca){_0x2051d0=parseInt(_0x2051d0,0xa);var _0x338a28=this['findRules'](_0x58c3ca);for(var _0x6efe9a=0x0,_0x5f3e9b=_0x338a28['length'];_0x6efe9a<_0x5f3e9b;_0x6efe9a+=0x1){_0x338a28[_0x6efe9a][_0xb814('0x25')]=_0x2051d0;}this['sync']();};RuleEngine[_0xb814('0x8')][_0xb814('0x26')]=function(){var _0x2b91bd=this['rules'];if(_0x2b91bd instanceof Array){_0x2b91bd=_0x2b91bd['map'](function(_0x26d3a9){_0x26d3a9[_0xb814('0x1e')]=_0x26d3a9['condition'][_0xb814('0x27')]();_0x26d3a9[_0xb814('0x28')]=_0x26d3a9[_0xb814('0x28')][_0xb814('0x27')]();return _0x26d3a9;});}else if(!_[_0xb814('0x4')](_0x2b91bd)){_0x2b91bd[_0xb814('0x1e')]=_0x2b91bd[_0xb814('0x1e')]['toString']();_0x2b91bd[_0xb814('0x28')]=_0x2b91bd[_0xb814('0x28')][_0xb814('0x27')]();}return _0x2b91bd;};RuleEngine[_0xb814('0x8')][_0xb814('0x29')]=function(_0x4ff31a){this[_0xb814('0x2a')]();if(_['isString'](_0x4ff31a)){_0x4ff31a=JSON[_0xb814('0x2b')](_0x4ff31a);}if(_0x4ff31a instanceof Array){_0x4ff31a=_0x4ff31a[_0xb814('0x2c')](function(_0xe0f509){_0xe0f509['condition']=eval('('+_0xe0f509[_0xb814('0x1e')]+')');_0xe0f509[_0xb814('0x28')]=eval('('+_0xe0f509['consequence']+')');return _0xe0f509;});}else if(_0x4ff31a!==null&&typeof _0x4ff31a==_0xb814('0x2d')){_0x4ff31a[_0xb814('0x1e')]=eval('('+_0x4ff31a[_0xb814('0x1e')]+')');_0x4ff31a[_0xb814('0x28')]=eval('('+_0x4ff31a[_0xb814('0x28')]+')');}this[_0xb814('0x5')](_0x4ff31a);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index d158656..aaec4ba 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 _0xb94b=['result','sendMailMessage','SendMail','client','request','then','error'];(function(_0x3cf968,_0x1b5822){var _0x1f055d=function(_0x5bbee4){while(--_0x5bbee4){_0x3cf968['push'](_0x3cf968['shift']());}};_0x1f055d(++_0x1b5822);}(_0xb94b,0xc0));var _0xbb94=function(_0x1c04a0,_0x470f56){_0x1c04a0=_0x1c04a0-0x0;var _0x14f909=_0xb94b[_0x1c04a0];return _0x14f909;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0xbb94('0x0')]['http']({'port':0x232b});function request(_0x4f55d3,_0x2d9a8f){return new BPromise(function(_0x2f8bf4,_0x2dcf19){return client[_0xbb94('0x1')](_0x4f55d3,_0x2d9a8f)[_0xbb94('0x2')](function(_0x1b3b1d){if(_0x1b3b1d[_0xbb94('0x3')]){return _0x2dcf19(_0x1b3b1d[_0xbb94('0x3')]['message']);}else{return _0x2f8bf4(_0x1b3b1d[_0xbb94('0x4')]);}})['catch'](function(_0x2bb067){return _0x2dcf19(_0x2bb067);});});}exports[_0xbb94('0x5')]=function(_0x3e3adb,_0xe9da74){return request(_0xbb94('0x6'),{'account':_0x3e3adb,'message':_0xe9da74});}; \ No newline at end of file +var _0x49f9=['jayson/promise','client','http','request','then','error','catch','sendMailMessage','SendMail','bluebird'];(function(_0x201bab,_0x4364bd){var _0x3bd407=function(_0x5d1b61){while(--_0x5d1b61){_0x201bab['push'](_0x201bab['shift']());}};_0x3bd407(++_0x4364bd);}(_0x49f9,0xf9));var _0x949f=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x49f9[_0x193e28];return _0x20ef59;};'use strict';var BPromise=require(_0x949f('0x0'));var jayson=require(_0x949f('0x1'));var client=jayson[_0x949f('0x2')][_0x949f('0x3')]({'port':0x232b});function request(_0x4a09e4,_0x48a16d){return new BPromise(function(_0x3315d6,_0x281f25){return client[_0x949f('0x4')](_0x4a09e4,_0x48a16d)[_0x949f('0x5')](function(_0x2f5e38){if(_0x2f5e38['error']){return _0x281f25(_0x2f5e38[_0x949f('0x6')]['message']);}else{return _0x3315d6(_0x2f5e38['result']);}})[_0x949f('0x7')](function(_0x4fe153){return _0x281f25(_0x4fe153);});});}exports[_0x949f('0x8')]=function(_0x143689,_0x19aef5){return request(_0x949f('0x9'),{'account':_0x143689,'message':_0x19aef5});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 6f21bb2..ba430bc 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 _0x6d11=['md5','moment','../../../config/environment','defaults','redis','name','online','voicePause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','prototype','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','chatPause','chatCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','openchannelStatusTime','busyQueue','emit','user:routing:update','exports','lodash'];(function(_0x35457c,_0x37036e){var _0x14ce1a=function(_0x406e40){while(--_0x406e40){_0x35457c['push'](_0x35457c['shift']());}};_0x14ce1a(++_0x37036e);}(_0x6d11,0xbf));var _0x16d1=function(_0x26deca,_0x4a3b0f){_0x26deca=_0x26deca-0x0;var _0x27cf6e=_0x6d11[_0x26deca];return _0x27cf6e;};'use strict';var _=require(_0x16d1('0x0'));var md5=require(_0x16d1('0x1'));var moment=require(_0x16d1('0x2'));var Redis=require('ioredis');var config=require(_0x16d1('0x3'));config['redis']=_[_0x16d1('0x4')](config[_0x16d1('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x16d1('0x5')]));function Agent(_0x46f7d7){this['id']=_0x46f7d7['id']||0x0;this[_0x16d1('0x6')]=_0x46f7d7[_0x16d1('0x6')]||'';this[_0x16d1('0x7')]=_0x46f7d7[_0x16d1('0x7')]||!![];this[_0x16d1('0x8')]=_0x46f7d7['voicePause']||![];this['chatPause']=_0x46f7d7['chatPause']||![];this[_0x16d1('0x9')]=_0x46f7d7[_0x16d1('0x9')]||![];this[_0x16d1('0xa')]=_0x46f7d7[_0x16d1('0xa')]||![];this['smsPause']=_0x46f7d7[_0x16d1('0xb')]||![];this[_0x16d1('0xc')]=_0x46f7d7[_0x16d1('0xc')]||![];this[_0x16d1('0xd')]=_0x16d1('0xe');this[_0x16d1('0xf')]=0x0;this[_0x16d1('0x10')]=_0x46f7d7[_0x16d1('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x16d1('0x11')]=_0x16d1('0xe');this[_0x16d1('0x12')]=0x0;this[_0x16d1('0x13')]=_0x46f7d7[_0x16d1('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x16d1('0x14')]=_0x16d1('0xe');this[_0x16d1('0x15')]=0x0;this[_0x16d1('0x16')]=_0x46f7d7[_0x16d1('0x16')]||0x0;this[_0x16d1('0x17')]=0x0;this[_0x16d1('0x18')]='unknown';this[_0x16d1('0x19')]=0x0;this[_0x16d1('0x1a')]=_0x46f7d7['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0x16d1('0x1b')]='unknown';this[_0x16d1('0x1c')]=0x0;this['whatsappCapacity']=_0x46f7d7[_0x16d1('0x1d')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x16d1('0x1e')]=_0x16d1('0xe');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x46f7d7['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0x16d1('0x1f')]=![];this['busyQueue']=undefined;this[_0x16d1('0x1')]='';this[_0x16d1('0x20')]={};this[_0x16d1('0x21')]={};this[_0x16d1('0x22')]={};this['openchannelWaitingInteractions']={};this[_0x16d1('0x23')]={};this[_0x16d1('0x24')]={};this[_0x16d1('0x25')]();}Agent['prototype'][_0x16d1('0x26')]=function(_0x8c7266){if(this[_0x8c7266+_0x16d1('0x27')]>0x0){if(this[_0x8c7266+_0x16d1('0x28')]>0x0&&this[_0x8c7266+_0x16d1('0x27')]>=this[_0x8c7266+_0x16d1('0x28')]){return _0x16d1('0x29');}else{return _0x16d1('0x2a');}}else{return _0x16d1('0x2b');}};Agent[_0x16d1('0x2c')][_0x16d1('0x25')]=function(){var _0x15203b=[_0x16d1('0x2d'),_0x16d1('0x2e'),_0x16d1('0x2f'),_0x16d1('0x30'),'sms',_0x16d1('0x31')];for(var _0x440a47=0x0;_0x440a47<_0x15203b[_0x16d1('0x32')];_0x440a47+=0x1){var _0x49fc1b=this[_0x16d1('0x26')](_0x15203b[_0x440a47]);if(this[_0x15203b[_0x440a47]+_0x16d1('0x33')]!==_0x49fc1b){this[_0x15203b[_0x440a47]+_0x16d1('0x34')]=_[_0x16d1('0x35')](moment()[_0x16d1('0x36')]('x'));}this[_0x15203b[_0x440a47]+_0x16d1('0x33')]=_0x49fc1b;}var _0x1dd574={'id':this['id'],'name':this['name'],'online':this[_0x16d1('0x7')],'voicePause':this[_0x16d1('0x8')],'chatPause':this[_0x16d1('0x37')],'mailPause':this[_0x16d1('0x9')],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0x16d1('0xc')],'chatStatus':this[_0x16d1('0xd')],'chatStatusTime':this[_0x16d1('0xf')],'chatCapacity':this[_0x16d1('0x10')],'chatCurrentCapacity':this[_0x16d1('0x38')],'mailStatus':this[_0x16d1('0x11')],'mailStatusTime':this[_0x16d1('0x12')],'mailCapacity':this[_0x16d1('0x13')],'mailCurrentCapacity':this[_0x16d1('0x39')],'faxStatus':this[_0x16d1('0x14')],'faxStatusTime':this[_0x16d1('0x15')],'faxCapacity':this[_0x16d1('0x16')],'faxCurrentCapacity':this[_0x16d1('0x17')],'smsStatus':this[_0x16d1('0x18')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x16d1('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x16d1('0x1b')],'whatsappStatusTime':this[_0x16d1('0x1c')],'whatsappCapacity':this[_0x16d1('0x1d')],'whatsappCurrentCapacity':this[_0x16d1('0x3a')],'openchannelStatus':this[_0x16d1('0x1e')],'openchannelStatusTime':this[_0x16d1('0x3b')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x16d1('0x3c')],'chatWaitingInteractions':this[_0x16d1('0x20')],'faxWaitingInteractions':this[_0x16d1('0x21')],'mailWaitingInteractions':this[_0x16d1('0x22')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x16d1('0x23')],'whatsappWaitingInteractions':this[_0x16d1('0x24')]};var _0x4cbac1=md5(JSON['stringify'](_0x1dd574));if(this['md5']!==_0x4cbac1){this[_0x16d1('0x1')]=_0x4cbac1;io[_0x16d1('0x3d')](_0x16d1('0x3e'),_['omit'](_0x1dd574,[_0x16d1('0x7')]));}};module[_0x16d1('0x3f')]=Agent; \ No newline at end of file +var _0x25e7=['exports','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','prototype','chat','openchannel','sms','whatsapp','length','Status','toNumber','chatStatus','chatCapacity','mailCurrentCapacity','smsStatus','whatsappCurrentCapacity','busy','stringify','emit','user:routing:update','omit'];(function(_0x8869ef,_0x3524c6){var _0xf86a49=function(_0xd95cd7){while(--_0xd95cd7){_0x8869ef['push'](_0x8869ef['shift']());}};_0xf86a49(++_0x3524c6);}(_0x25e7,0x1d6));var _0x725e=function(_0x508abe,_0x37d20c){_0x508abe=_0x508abe-0x0;var _0x23d357=_0x25e7[_0x508abe];return _0x23d357;};'use strict';var _=require(_0x725e('0x0'));var md5=require(_0x725e('0x1'));var moment=require(_0x725e('0x2'));var Redis=require(_0x725e('0x3'));var config=require(_0x725e('0x4'));config[_0x725e('0x5')]=_[_0x725e('0x6')](config[_0x725e('0x5')],{'host':_0x725e('0x7'),'port':0x18eb});var io=require(_0x725e('0x8'))(new Redis(config['redis']));function Agent(_0x5e17a9){this['id']=_0x5e17a9['id']||0x0;this[_0x725e('0x9')]=_0x5e17a9['name']||'';this['online']=_0x5e17a9[_0x725e('0xa')]||!![];this[_0x725e('0xb')]=_0x5e17a9[_0x725e('0xb')]||![];this[_0x725e('0xc')]=_0x5e17a9[_0x725e('0xc')]||![];this[_0x725e('0xd')]=_0x5e17a9[_0x725e('0xd')]||![];this[_0x725e('0xe')]=_0x5e17a9[_0x725e('0xe')]||![];this[_0x725e('0xf')]=_0x5e17a9[_0x725e('0xf')]||![];this[_0x725e('0x10')]=_0x5e17a9['openchannelPause']||![];this['chatStatus']=_0x725e('0x11');this[_0x725e('0x12')]=0x0;this['chatCapacity']=_0x5e17a9['chatCapacity']||0x0;this[_0x725e('0x13')]=0x0;this[_0x725e('0x14')]='unknown';this[_0x725e('0x15')]=0x0;this[_0x725e('0x16')]=_0x5e17a9[_0x725e('0x16')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x725e('0x17')]=_0x725e('0x11');this[_0x725e('0x18')]=0x0;this[_0x725e('0x19')]=_0x5e17a9[_0x725e('0x19')]||0x0;this[_0x725e('0x1a')]=0x0;this['smsStatus']=_0x725e('0x11');this[_0x725e('0x1b')]=0x0;this[_0x725e('0x1c')]=_0x5e17a9['smsCapacity']||0x0;this[_0x725e('0x1d')]=0x0;this[_0x725e('0x1e')]=_0x725e('0x11');this[_0x725e('0x1f')]=0x0;this[_0x725e('0x20')]=_0x5e17a9[_0x725e('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x725e('0x21')]=_0x725e('0x11');this[_0x725e('0x22')]=0x0;this[_0x725e('0x23')]=_0x5e17a9[_0x725e('0x23')]||0x0;this[_0x725e('0x24')]=0x0;this['busy']=![];this[_0x725e('0x25')]=undefined;this[_0x725e('0x1')]='';this[_0x725e('0x26')]={};this[_0x725e('0x27')]={};this[_0x725e('0x28')]={};this[_0x725e('0x29')]={};this[_0x725e('0x2a')]={};this[_0x725e('0x2b')]={};this[_0x725e('0x2c')]();}Agent['prototype'][_0x725e('0x2d')]=function(_0x36cbab){if(this[_0x36cbab+_0x725e('0x2e')]>0x0){if(this[_0x36cbab+_0x725e('0x2f')]>0x0&&this[_0x36cbab+'CurrentCapacity']>=this[_0x36cbab+_0x725e('0x2f')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x725e('0x30')][_0x725e('0x2c')]=function(){var _0x2d3c55=['mail',_0x725e('0x31'),_0x725e('0x32'),'fax',_0x725e('0x33'),_0x725e('0x34')];for(var _0x4b0d0c=0x0;_0x4b0d0c<_0x2d3c55[_0x725e('0x35')];_0x4b0d0c+=0x1){var _0x5daa2d=this['getChannelStatus'](_0x2d3c55[_0x4b0d0c]);if(this[_0x2d3c55[_0x4b0d0c]+_0x725e('0x36')]!==_0x5daa2d){this[_0x2d3c55[_0x4b0d0c]+'StatusTime']=_[_0x725e('0x37')](moment()['format']('x'));}this[_0x2d3c55[_0x4b0d0c]+'Status']=_0x5daa2d;}var _0x9b5b7f={'id':this['id'],'name':this[_0x725e('0x9')],'online':this[_0x725e('0xa')],'voicePause':this['voicePause'],'chatPause':this[_0x725e('0xc')],'mailPause':this['mailPause'],'smsPause':this[_0x725e('0xf')],'faxPause':this[_0x725e('0xe')],'openchannelPause':this[_0x725e('0x10')],'chatStatus':this[_0x725e('0x38')],'chatStatusTime':this[_0x725e('0x12')],'chatCapacity':this[_0x725e('0x39')],'chatCurrentCapacity':this[_0x725e('0x13')],'mailStatus':this[_0x725e('0x14')],'mailStatusTime':this[_0x725e('0x15')],'mailCapacity':this[_0x725e('0x16')],'mailCurrentCapacity':this[_0x725e('0x3a')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x725e('0x18')],'faxCapacity':this[_0x725e('0x19')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x725e('0x3b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x725e('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x725e('0x1e')],'whatsappStatusTime':this[_0x725e('0x1f')],'whatsappCapacity':this[_0x725e('0x20')],'whatsappCurrentCapacity':this[_0x725e('0x3c')],'openchannelStatus':this[_0x725e('0x21')],'openchannelStatusTime':this[_0x725e('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0x725e('0x3d')],'busyQueue':this[_0x725e('0x25')],'chatWaitingInteractions':this[_0x725e('0x26')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x725e('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x725e('0x2a')],'whatsappWaitingInteractions':this[_0x725e('0x2b')]};var _0x386636=md5(JSON[_0x725e('0x3e')](_0x9b5b7f));if(this['md5']!==_0x386636){this['md5']=_0x386636;io[_0x725e('0x3f')](_0x725e('0x40'),_[_0x725e('0x41')](_0x9b5b7f,['online']));}};module[_0x725e('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 13eb090..4bdf52b 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 _0x6013=['name','timeout','strategy','beepall','Agents','waiting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','online','stringify','md5','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','util','../../../config/environment','redis','socket.io-emitter'];(function(_0x581c4b,_0x3fcc7e){var _0x279120=function(_0x4e5213){while(--_0x4e5213){_0x581c4b['push'](_0x581c4b['shift']());}};_0x279120(++_0x3fcc7e);}(_0x6013,0x1a4));var _0x3601=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x6013[_0x4d21ff];return _0x22b554;};'use strict';var _=require(_0x3601('0x0'));var md5=require('md5');var util=require(_0x3601('0x1'));var Redis=require('ioredis');var config=require(_0x3601('0x2'));config[_0x3601('0x3')]=_['defaults'](config[_0x3601('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x3601('0x4'))(new Redis(config['redis']));function ChatQueue(_0x4facb8){this['id']=_0x4facb8['id']||0x0;this[_0x3601('0x5')]=_0x4facb8[_0x3601('0x5')]||'';this[_0x3601('0x6')]=_0x4facb8[_0x3601('0x6')]||0xa;this['strategy']=_0x4facb8[_0x3601('0x7')]||_0x3601('0x8');this[_0x3601('0x9')]=_0x4facb8[_0x3601('0x9')];this['mapAgentsId']={};this[_0x3601('0xa')]=0x0;this['md5']='';this['updateRouting']();this[_0x3601('0xb')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x29f64b=this[_0x3601('0xc')][_0x3601('0xd')];this[_0x3601('0xc')]=_[_0x3601('0xe')](this['Agents'],'id');this[_0x3601('0xc')][_0x3601('0xd')]=_0x29f64b;};ChatQueue['prototype'][_0x3601('0xb')]=function(){this[_0x3601('0xf')]=0x0;this[_0x3601('0x10')]=0x0;for(var _0x2901af=0x0;_0x2901af=0x0?this['available']:0x0;var _0x6e12b1={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3601('0xf')],'name':this[_0x3601('0x5')],'paused':this[_0x3601('0x10')],'waiting':this[_0x3601('0xa')]};var _0x1259c9=md5(JSON[_0x3601('0x12')](_0x6e12b1));if(this[_0x3601('0x13')]!==_0x1259c9){this[_0x3601('0x13')]=_0x1259c9;io['to'](util[_0x3601('0x14')](_0x3601('0x15'),_0x6e12b1['name']))[_0x3601('0x16')](_0x3601('0x17'),_0x6e12b1);}};module[_0x3601('0x18')]=ChatQueue; \ No newline at end of file +var _0xf81f=['ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xf81f,0x159));var _0xff81=function(_0x175a66,_0x55b3f1){_0x175a66=_0x175a66-0x0;var _0x3382f5=_0xf81f[_0x175a66];return _0x3382f5;};'use strict';var _=require(_0xff81('0x0'));var md5=require(_0xff81('0x1'));var util=require(_0xff81('0x2'));var Redis=require(_0xff81('0x3'));var config=require(_0xff81('0x4'));config['redis']=_[_0xff81('0x5')](config['redis'],{'host':_0xff81('0x6'),'port':0x18eb});var io=require(_0xff81('0x7'))(new Redis(config[_0xff81('0x8')]));function ChatQueue(_0xfee7d2){this['id']=_0xfee7d2['id']||0x0;this[_0xff81('0x9')]=_0xfee7d2[_0xff81('0x9')]||'';this[_0xff81('0xa')]=_0xfee7d2['timeout']||0xa;this[_0xff81('0xb')]=_0xfee7d2[_0xff81('0xb')]||'beepall';this[_0xff81('0xc')]=_0xfee7d2[_0xff81('0xc')];this[_0xff81('0xd')]={};this[_0xff81('0xe')]=0x0;this['md5']='';this[_0xff81('0xf')]();this[_0xff81('0x10')]();}ChatQueue[_0xff81('0x11')][_0xff81('0xf')]=function(){var _0x33fc61=this[_0xff81('0xd')]['_rr'];this['mapAgentsId']=_[_0xff81('0x12')](this[_0xff81('0xc')],'id');this[_0xff81('0xd')]['_rr']=_0x33fc61;};ChatQueue[_0xff81('0x11')][_0xff81('0x10')]=function(){this[_0xff81('0x13')]=0x0;this[_0xff81('0x14')]=0x0;for(var _0x444dbf=0x0;_0x444dbf=0x0?this[_0xff81('0x16')]:0x0;var _0x530f4f={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0xff81('0x14')],'waiting':this[_0xff81('0xe')]};var _0x2341e6=md5(JSON[_0xff81('0x17')](_0x530f4f));if(this[_0xff81('0x1')]!==_0x2341e6){this[_0xff81('0x1')]=_0x2341e6;io['to'](util[_0xff81('0x18')](_0xff81('0x19'),_0x530f4f['name']))[_0xff81('0x1a')](_0xff81('0x1b'),_0x530f4f);}};module[_0xff81('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 0932ca8..c853c51 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 _0xfba4=['loggedIn','paused','length','online','faxPause','available','name','md5','format','fax_queue:save','lodash','util','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xfba4,0x1a0));var _0x4fba=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xfba4[_0x469a3c];return _0x968f4;};'use strict';var _=require(_0x4fba('0x0'));var md5=require('md5');var util=require(_0x4fba('0x1'));var Redis=require(_0x4fba('0x2'));var config=require(_0x4fba('0x3'));config['redis']=_[_0x4fba('0x4')](config['redis'],{'host':_0x4fba('0x5'),'port':0x18eb});var io=require(_0x4fba('0x6'))(new Redis(config[_0x4fba('0x7')]));function FaxQueue(_0x41bb2a){this['id']=_0x41bb2a['id']||0x0;this['name']=_0x41bb2a['name']||'';this[_0x4fba('0x8')]=_0x41bb2a[_0x4fba('0x8')]||0xa;this[_0x4fba('0x9')]=_0x41bb2a[_0x4fba('0x9')]||_0x4fba('0xa');this['Agents']=_0x41bb2a[_0x4fba('0xb')];this[_0x4fba('0xc')]={};this[_0x4fba('0xd')]=0x0;this['md5']='';this[_0x4fba('0xe')]();this[_0x4fba('0xf')]();}FaxQueue[_0x4fba('0x10')][_0x4fba('0xe')]=function(){var _0x2ea3ab=this[_0x4fba('0xc')][_0x4fba('0x11')];this[_0x4fba('0xc')]=_[_0x4fba('0x12')](this[_0x4fba('0xb')],'id');this['mapAgentsId'][_0x4fba('0x11')]=_0x2ea3ab;};FaxQueue[_0x4fba('0x10')][_0x4fba('0xf')]=function(){this[_0x4fba('0x13')]=0x0;this[_0x4fba('0x14')]=0x0;for(var _0x292ed2=0x0;_0x292ed2=0x0?this[_0x4fba('0x18')]:0x0;var _0x479ca2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x4fba('0x13')],'name':this[_0x4fba('0x19')],'paused':this[_0x4fba('0x14')],'waiting':this[_0x4fba('0xd')]};var _0x49f1b5=md5(JSON['stringify'](_0x479ca2));if(this['md5']!==_0x49f1b5){this[_0x4fba('0x1a')]=_0x49f1b5;io['to'](util[_0x4fba('0x1b')]('fax:queue:%s',_0x479ca2[_0x4fba('0x19')]))['emit'](_0x4fba('0x1c'),_0x479ca2);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x0161=['../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','online','faxPause','available','format','fax_queue:save','exports','lodash','ioredis'];(function(_0x48e8ae,_0x3ceaeb){var _0x2d8ba2=function(_0x41e899){while(--_0x41e899){_0x48e8ae['push'](_0x48e8ae['shift']());}};_0x2d8ba2(++_0x3ceaeb);}(_0x0161,0xfa));var _0x1016=function(_0x1c92b9,_0x3c2a65){_0x1c92b9=_0x1c92b9-0x0;var _0x4bcf98=_0x0161[_0x1c92b9];return _0x4bcf98;};'use strict';var _=require(_0x1016('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0x1016('0x1'));var config=require(_0x1016('0x2'));config[_0x1016('0x3')]=_[_0x1016('0x4')](config[_0x1016('0x3')],{'host':_0x1016('0x5'),'port':0x18eb});var io=require(_0x1016('0x6'))(new Redis(config[_0x1016('0x3')]));function FaxQueue(_0x54064a){this['id']=_0x54064a['id']||0x0;this[_0x1016('0x7')]=_0x54064a['name']||'';this[_0x1016('0x8')]=_0x54064a[_0x1016('0x8')]||0xa;this[_0x1016('0x9')]=_0x54064a[_0x1016('0x9')]||_0x1016('0xa');this[_0x1016('0xb')]=_0x54064a[_0x1016('0xb')];this[_0x1016('0xc')]={};this[_0x1016('0xd')]=0x0;this[_0x1016('0xe')]='';this['updateRouting']();this[_0x1016('0xf')]();}FaxQueue[_0x1016('0x10')][_0x1016('0x11')]=function(){var _0x22c57a=this['mapAgentsId'][_0x1016('0x12')];this[_0x1016('0xc')]=_[_0x1016('0x13')](this[_0x1016('0xb')],'id');this[_0x1016('0xc')][_0x1016('0x12')]=_0x22c57a;};FaxQueue[_0x1016('0x10')][_0x1016('0xf')]=function(){this[_0x1016('0x14')]=0x0;this[_0x1016('0x15')]=0x0;for(var _0x533d19=0x0;_0x533d19=0x0?this[_0x1016('0x18')]:0x0;var _0x16f627={'id':this['id'],'available':this[_0x1016('0x18')],'loggedIn':this[_0x1016('0x14')],'name':this[_0x1016('0x7')],'paused':this['paused'],'waiting':this[_0x1016('0xd')]};var _0x5cb03d=md5(JSON['stringify'](_0x16f627));if(this['md5']!==_0x5cb03d){this[_0x1016('0xe')]=_0x5cb03d;io['to'](util[_0x1016('0x19')]('fax:queue:%s',_0x16f627[_0x1016('0x7')]))['emit'](_0x1016('0x1a'),_0x16f627);}};module[_0x1016('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 6332906..64d5ca8 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 _0x0672=['Intervals','exports','name'];(function(_0x466e43,_0x165168){var _0x15388d=function(_0x137c2d){while(--_0x137c2d){_0x466e43['push'](_0x466e43['shift']());}};_0x15388d(++_0x165168);}(_0x0672,0x125));var _0x2067=function(_0x65959d,_0x4dd888){_0x65959d=_0x65959d-0x0;var _0x2d71aa=_0x0672[_0x65959d];return _0x2d71aa;};'use strict';function Interval(_0xe862aa){this['id']=_0xe862aa['id']||0x0;this[_0x2067('0x0')]=_0xe862aa[_0x2067('0x0')]||'';this[_0x2067('0x1')]=_0xe862aa[_0x2067('0x1')]||{};}module[_0x2067('0x2')]=Interval; \ No newline at end of file +var _0xdd5c=['Intervals','exports','name'];(function(_0x932134,_0x2eb394){var _0x5d3841=function(_0x1da96b){while(--_0x1da96b){_0x932134['push'](_0x932134['shift']());}};_0x5d3841(++_0x2eb394);}(_0xdd5c,0x7a));var _0xcdd5=function(_0x4812e0,_0x2ccf3c){_0x4812e0=_0x4812e0-0x0;var _0x252e0f=_0xdd5c[_0x4812e0];return _0x252e0f;};'use strict';function Interval(_0x1a7299){this['id']=_0x1a7299['id']||0x0;this[_0xcdd5('0x0')]=_0x1a7299[_0xcdd5('0x0')]||'';this[_0xcdd5('0x1')]=_0x1a7299[_0xcdd5('0x1')]||{};}module[_0xcdd5('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 d4e4371..0b64eca 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 _0x6049=['updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','length','online','mailPause','available','format','emit','mail_queue:save','exports','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5'];(function(_0x370753,_0x49bffe){var _0x563d2e=function(_0x2c5136){while(--_0x2c5136){_0x370753['push'](_0x370753['shift']());}};_0x563d2e(++_0x49bffe);}(_0x6049,0x146));var _0x9604=function(_0x5b7e0a,_0x59c79e){_0x5b7e0a=_0x5b7e0a-0x0;var _0x5d36b3=_0x6049[_0x5b7e0a];return _0x5d36b3;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x9604('0x0'));var Redis=require(_0x9604('0x1'));var config=require('../../../config/environment');config[_0x9604('0x2')]=_[_0x9604('0x3')](config[_0x9604('0x2')],{'host':_0x9604('0x4'),'port':0x18eb});var io=require(_0x9604('0x5'))(new Redis(config[_0x9604('0x2')]));function MailQueue(_0x20f4bf){this['id']=_0x20f4bf['id']||0x0;this[_0x9604('0x6')]=_0x20f4bf[_0x9604('0x6')]||'';this[_0x9604('0x7')]=_0x20f4bf['timeout']||0xa;this['strategy']=_0x20f4bf[_0x9604('0x8')]||'beepall';this[_0x9604('0x9')]=_0x20f4bf[_0x9604('0x9')];this['mapAgentsId']={};this[_0x9604('0xa')]=0x0;this[_0x9604('0xb')]='';this[_0x9604('0xc')]();this['updateRealtime']();}MailQueue[_0x9604('0xd')]['updateRouting']=function(){var _0x377be6=this[_0x9604('0xe')][_0x9604('0xf')];this[_0x9604('0xe')]=_[_0x9604('0x10')](this[_0x9604('0x9')],'id');this[_0x9604('0xe')][_0x9604('0xf')]=_0x377be6;};MailQueue['prototype']['updateRealtime']=function(){this[_0x9604('0x11')]=0x0;this['paused']=0x0;for(var _0x53463e=0x0;_0x53463e=0x0?this[_0x9604('0x15')]:0x0;var _0x1c1410={'id':this['id'],'available':this[_0x9604('0x15')],'loggedIn':this[_0x9604('0x11')],'name':this[_0x9604('0x6')],'paused':this['paused'],'waiting':this[_0x9604('0xa')]};var _0x151a39=md5(JSON['stringify'](_0x1c1410));if(this[_0x9604('0xb')]!==_0x151a39){this[_0x9604('0xb')]=_0x151a39;io['to'](util[_0x9604('0x16')]('mail:queue:%s',_0x1c1410['name']))[_0x9604('0x17')](_0x9604('0x18'),_0x1c1410);}};module[_0x9604('0x19')]=MailQueue; \ No newline at end of file +var _0xa4f8=['updateRouting','mapAgentsId','map','_rr','prototype','updateRealtime','loggedIn','paused','length','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','md5'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa4f8,0x129));var _0x8a4f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa4f8[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8a4f('0x0'));var md5=require('md5');var util=require(_0x8a4f('0x1'));var Redis=require(_0x8a4f('0x2'));var config=require('../../../config/environment');config[_0x8a4f('0x3')]=_[_0x8a4f('0x4')](config[_0x8a4f('0x3')],{'host':_0x8a4f('0x5'),'port':0x18eb});var io=require(_0x8a4f('0x6'))(new Redis(config[_0x8a4f('0x3')]));function MailQueue(_0x4db8af){this['id']=_0x4db8af['id']||0x0;this[_0x8a4f('0x7')]=_0x4db8af['name']||'';this[_0x8a4f('0x8')]=_0x4db8af[_0x8a4f('0x8')]||0xa;this[_0x8a4f('0x9')]=_0x4db8af[_0x8a4f('0x9')]||'beepall';this[_0x8a4f('0xa')]=_0x4db8af['Agents'];this['mapAgentsId']={};this[_0x8a4f('0xb')]=0x0;this[_0x8a4f('0xc')]='';this[_0x8a4f('0xd')]();this['updateRealtime']();}MailQueue['prototype'][_0x8a4f('0xd')]=function(){var _0x58ee4f=this[_0x8a4f('0xe')]['_rr'];this[_0x8a4f('0xe')]=_[_0x8a4f('0xf')](this[_0x8a4f('0xa')],'id');this[_0x8a4f('0xe')][_0x8a4f('0x10')]=_0x58ee4f;};MailQueue[_0x8a4f('0x11')][_0x8a4f('0x12')]=function(){this[_0x8a4f('0x13')]=0x0;this[_0x8a4f('0x14')]=0x0;for(var _0x58526e=0x0;_0x58526e=0x0?this[_0x8a4f('0x18')]:0x0;var _0xb937cb={'id':this['id'],'available':this[_0x8a4f('0x18')],'loggedIn':this[_0x8a4f('0x13')],'name':this['name'],'paused':this[_0x8a4f('0x14')],'waiting':this['waiting']};var _0x2d1f2c=md5(JSON[_0x8a4f('0x19')](_0xb937cb));if(this[_0x8a4f('0xc')]!==_0x2d1f2c){this[_0x8a4f('0xc')]=_0x2d1f2c;io['to'](util[_0x8a4f('0x1a')](_0x8a4f('0x1b'),_0xb937cb['name']))[_0x8a4f('0x1c')](_0x8a4f('0x1d'),_0xb937cb);}};module[_0x8a4f('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 48c3794..4872d9c 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xc4aa[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x1261=['available','stringify','openchannel:queue:%s','openchannel_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','prototype','mapAgentsId','map','_rr','updateRealtime','loggedIn','paused','length','online'];(function(_0x43f881,_0xd6e5a2){var _0x365c14=function(_0x50d386){while(--_0x50d386){_0x43f881['push'](_0x43f881['shift']());}};_0x365c14(++_0xd6e5a2);}(_0x1261,0x144));var _0x1126=function(_0x1fc772,_0x376734){_0x1fc772=_0x1fc772-0x0;var _0x725ba3=_0x1261[_0x1fc772];return _0x725ba3;};'use strict';var _=require('lodash');var md5=require(_0x1126('0x0'));var util=require(_0x1126('0x1'));var Redis=require(_0x1126('0x2'));var config=require(_0x1126('0x3'));config[_0x1126('0x4')]=_[_0x1126('0x5')](config[_0x1126('0x4')],{'host':_0x1126('0x6'),'port':0x18eb});var io=require(_0x1126('0x7'))(new Redis(config[_0x1126('0x4')]));function OpenchannelQueue(_0x5a2189){this['id']=_0x5a2189['id']||0x0;this['name']=_0x5a2189[_0x1126('0x8')]||'';this[_0x1126('0x9')]=_0x5a2189['timeout']||0xa;this[_0x1126('0xa')]=_0x5a2189[_0x1126('0xa')]||_0x1126('0xb');this[_0x1126('0xc')]=_0x5a2189[_0x1126('0xc')];this['mapAgentsId']={};this[_0x1126('0xd')]=0x0;this[_0x1126('0x0')]='';this[_0x1126('0xe')]();this['updateRealtime']();}OpenchannelQueue[_0x1126('0xf')]['updateRouting']=function(){var _0x52ef15=this[_0x1126('0x10')]['_rr'];this[_0x1126('0x10')]=_[_0x1126('0x11')](this[_0x1126('0xc')],'id');this[_0x1126('0x10')][_0x1126('0x12')]=_0x52ef15;};OpenchannelQueue[_0x1126('0xf')][_0x1126('0x13')]=function(){this[_0x1126('0x14')]=0x0;this[_0x1126('0x15')]=0x0;for(var _0x53a8f0=0x0;_0x53a8f0=0x0?this['available']:0x0;var _0x4d2b38={'id':this['id'],'available':this[_0x1126('0x18')],'loggedIn':this[_0x1126('0x14')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x1126('0xd')]};var _0x58b109=md5(JSON[_0x1126('0x19')](_0x4d2b38));if(this[_0x1126('0x0')]!==_0x58b109){this[_0x1126('0x0')]=_0x58b109;io['to'](util['format'](_0x1126('0x1a'),_0x4d2b38['name']))['emit'](_0x1126('0x1b'),_0x4d2b38);}};module[_0x1126('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 7e7dbfb..23f2256 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 _0xbd3b=['updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','online','smsPause','available','waiting','stringify','format','sms:queue:%s','emit','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbd3b,0x1c3));var _0xbbd3=function(_0x395be8,_0x285479){_0x395be8=_0x395be8-0x0;var _0x5ceb20=_0xbd3b[_0x395be8];return _0x5ceb20;};'use strict';var _=require(_0xbbd3('0x0'));var md5=require(_0xbbd3('0x1'));var util=require(_0xbbd3('0x2'));var Redis=require('ioredis');var config=require(_0xbbd3('0x3'));config[_0xbbd3('0x4')]=_[_0xbbd3('0x5')](config[_0xbbd3('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbbd3('0x6'))(new Redis(config[_0xbbd3('0x4')]));function SmsQueue(_0x507a1f){this['id']=_0x507a1f['id']||0x0;this[_0xbbd3('0x7')]=_0x507a1f['name']||'';this[_0xbbd3('0x8')]=_0x507a1f[_0xbbd3('0x8')]||0xa;this[_0xbbd3('0x9')]=_0x507a1f['strategy']||_0xbbd3('0xa');this[_0xbbd3('0xb')]=_0x507a1f[_0xbbd3('0xb')];this[_0xbbd3('0xc')]={};this['waiting']=0x0;this[_0xbbd3('0x1')]='';this[_0xbbd3('0xd')]();this[_0xbbd3('0xe')]();}SmsQueue[_0xbbd3('0xf')]['updateRouting']=function(){var _0x4a3cd6=this['mapAgentsId']['_rr'];this[_0xbbd3('0xc')]=_[_0xbbd3('0x10')](this[_0xbbd3('0xb')],'id');this[_0xbbd3('0xc')][_0xbbd3('0x11')]=_0x4a3cd6;};SmsQueue[_0xbbd3('0xf')][_0xbbd3('0xe')]=function(){this[_0xbbd3('0x12')]=0x0;this[_0xbbd3('0x13')]=0x0;for(var _0xf12c2d=0x0;_0xf12c2d=0x0?this[_0xbbd3('0x16')]:0x0;var _0x5f3952={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbbd3('0x12')],'name':this[_0xbbd3('0x7')],'paused':this['paused'],'waiting':this[_0xbbd3('0x17')]};var _0x52b154=md5(JSON[_0xbbd3('0x18')](_0x5f3952));if(this[_0xbbd3('0x1')]!==_0x52b154){this[_0xbbd3('0x1')]=_0x52b154;io['to'](util[_0xbbd3('0x19')](_0xbbd3('0x1a'),_0x5f3952[_0xbbd3('0x7')]))[_0xbbd3('0x1b')]('sms_queue:save',_0x5f3952);}};module[_0xbbd3('0x1c')]=SmsQueue; \ No newline at end of file +var _0x4016=['smsPause','available','waiting','stringify','format','sms:queue:%s','emit','exports','md5','util','defaults','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online'];(function(_0x4ca6a4,_0x5e9694){var _0x120555=function(_0x56888c){while(--_0x56888c){_0x4ca6a4['push'](_0x4ca6a4['shift']());}};_0x120555(++_0x5e9694);}(_0x4016,0x131));var _0x6401=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4016[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var md5=require(_0x6401('0x0'));var util=require(_0x6401('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0x6401('0x2')](config['redis'],{'host':_0x6401('0x3'),'port':0x18eb});var io=require(_0x6401('0x4'))(new Redis(config['redis']));function SmsQueue(_0x5c5201){this['id']=_0x5c5201['id']||0x0;this[_0x6401('0x5')]=_0x5c5201[_0x6401('0x5')]||'';this['timeout']=_0x5c5201[_0x6401('0x6')]||0xa;this['strategy']=_0x5c5201[_0x6401('0x7')]||'beepall';this[_0x6401('0x8')]=_0x5c5201[_0x6401('0x8')];this[_0x6401('0x9')]={};this['waiting']=0x0;this['md5']='';this[_0x6401('0xa')]();this[_0x6401('0xb')]();}SmsQueue[_0x6401('0xc')]['updateRouting']=function(){var _0x154a67=this['mapAgentsId']['_rr'];this[_0x6401('0x9')]=_[_0x6401('0xd')](this[_0x6401('0x8')],'id');this[_0x6401('0x9')][_0x6401('0xe')]=_0x154a67;};SmsQueue[_0x6401('0xc')][_0x6401('0xb')]=function(){this[_0x6401('0xf')]=0x0;this[_0x6401('0x10')]=0x0;for(var _0x1f6edf=0x0;_0x1f6edf=0x0?this['available']:0x0;var _0x2d8f2d={'id':this['id'],'available':this['available'],'loggedIn':this[_0x6401('0xf')],'name':this[_0x6401('0x5')],'paused':this[_0x6401('0x10')],'waiting':this[_0x6401('0x15')]};var _0x3e2af8=md5(JSON[_0x6401('0x16')](_0x2d8f2d));if(this[_0x6401('0x0')]!==_0x3e2af8){this['md5']=_0x3e2af8;io['to'](util[_0x6401('0x17')](_0x6401('0x18'),_0x2d8f2d[_0x6401('0x5')]))[_0x6401('0x19')]('sms_queue:save',_0x2d8f2d);}};module[_0x6401('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index b724b7d..d79a43c 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 _0x37bb=['_rr','map','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x39ab14,_0x1c6d59){var _0x5a661e=function(_0x39297e){while(--_0x39297e){_0x39ab14['push'](_0x39ab14['shift']());}};_0x5a661e(++_0x1c6d59);}(_0x37bb,0x1b1));var _0xb37b=function(_0x28a0f5,_0x1f511a){_0x28a0f5=_0x28a0f5-0x0;var _0x1481d4=_0x37bb[_0x28a0f5];return _0x1481d4;};'use strict';var _=require(_0xb37b('0x0'));var md5=require(_0xb37b('0x1'));var util=require(_0xb37b('0x2'));var Redis=require(_0xb37b('0x3'));var config=require('../../../config/environment');config[_0xb37b('0x4')]=_['defaults'](config[_0xb37b('0x4')],{'host':_0xb37b('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb37b('0x4')]));function WhatsappQueue(_0x21d65e){this['id']=_0x21d65e['id']||0x0;this['name']=_0x21d65e[_0xb37b('0x6')]||'';this[_0xb37b('0x7')]=_0x21d65e['timeout']||0xa;this[_0xb37b('0x8')]=_0x21d65e[_0xb37b('0x8')]||_0xb37b('0x9');this[_0xb37b('0xa')]=_0x21d65e['Agents'];this[_0xb37b('0xb')]={};this[_0xb37b('0xc')]=0x0;this[_0xb37b('0x1')]='';this[_0xb37b('0xd')]();this[_0xb37b('0xe')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0xd19dc1=this['mapAgentsId'][_0xb37b('0xf')];this['mapAgentsId']=_[_0xb37b('0x10')](this[_0xb37b('0xa')],'id');this[_0xb37b('0xb')][_0xb37b('0xf')]=_0xd19dc1;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0xb37b('0x11')]=0x0;this[_0xb37b('0x12')]=0x0;for(var _0x5a70b6=0x0;_0x5a70b6=0x0?this['available']:0x0;var _0x42d00e={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xb37b('0x6')],'paused':this['paused'],'waiting':this[_0xb37b('0xc')]};var _0x5019fc=md5(JSON[_0xb37b('0x16')](_0x42d00e));if(this[_0xb37b('0x1')]!==_0x5019fc){this[_0xb37b('0x1')]=_0x5019fc;io['to'](util[_0xb37b('0x17')](_0xb37b('0x18'),_0x42d00e[_0xb37b('0x6')]))[_0xb37b('0x19')](_0xb37b('0x1a'),_0x42d00e);}};module[_0xb37b('0x1b')]=WhatsappQueue; \ No newline at end of file +var _0x5e6e=['ioredis','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','waiting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util'];(function(_0x2c2781,_0x5f1153){var _0x3fe469=function(_0x5915df){while(--_0x5915df){_0x2c2781['push'](_0x2c2781['shift']());}};_0x3fe469(++_0x5f1153);}(_0x5e6e,0xab));var _0xe5e6=function(_0x2c7b17,_0x3e4d2c){_0x2c7b17=_0x2c7b17-0x0;var _0x57970a=_0x5e6e[_0x2c7b17];return _0x57970a;};'use strict';var _=require(_0xe5e6('0x0'));var md5=require(_0xe5e6('0x1'));var util=require(_0xe5e6('0x2'));var Redis=require(_0xe5e6('0x3'));var config=require('../../../config/environment');config[_0xe5e6('0x4')]=_[_0xe5e6('0x5')](config[_0xe5e6('0x4')],{'host':_0xe5e6('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe5e6('0x4')]));function WhatsappQueue(_0x23fe88){this['id']=_0x23fe88['id']||0x0;this['name']=_0x23fe88[_0xe5e6('0x7')]||'';this['timeout']=_0x23fe88[_0xe5e6('0x8')]||0xa;this[_0xe5e6('0x9')]=_0x23fe88[_0xe5e6('0x9')]||_0xe5e6('0xa');this[_0xe5e6('0xb')]=_0x23fe88[_0xe5e6('0xb')];this['mapAgentsId']={};this[_0xe5e6('0xc')]=0x0;this[_0xe5e6('0x1')]='';this['updateRouting']();this[_0xe5e6('0xd')]();}WhatsappQueue[_0xe5e6('0xe')]['updateRouting']=function(){var _0x5dd246=this[_0xe5e6('0xf')][_0xe5e6('0x10')];this['mapAgentsId']=_[_0xe5e6('0x11')](this[_0xe5e6('0xb')],'id');this[_0xe5e6('0xf')][_0xe5e6('0x10')]=_0x5dd246;};WhatsappQueue['prototype'][_0xe5e6('0xd')]=function(){this[_0xe5e6('0x12')]=0x0;this[_0xe5e6('0x13')]=0x0;for(var _0xdc6c55=0x0;_0xdc6c55=0x0?this[_0xe5e6('0x16')]:0x0;var _0x21f15d={'id':this['id'],'available':this[_0xe5e6('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xe5e6('0x7')],'paused':this['paused'],'waiting':this[_0xe5e6('0xc')]};var _0x11e7f2=md5(JSON[_0xe5e6('0x17')](_0x21f15d));if(this[_0xe5e6('0x1')]!==_0x11e7f2){this[_0xe5e6('0x1')]=_0x11e7f2;io['to'](util[_0xe5e6('0x18')](_0xe5e6('0x19'),_0x21f15d[_0xe5e6('0x7')]))[_0xe5e6('0x1a')](_0xe5e6('0x1b'),_0x21f15d);}};module[_0xe5e6('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 6fdf601..1f83280 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x3e28f0,_0x4ba77c){var _0x19d7fa=function(_0xacea27){while(--_0xacea27){_0x3e28f0['push'](_0x3e28f0['shift']());}};_0x19d7fa(++_0x4ba77c);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b166b,_0x2c8ba1){_0x3b166b=_0x3b166b-0x0;var _0x579602=_0xb10b[_0x3b166b];return _0x579602;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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 24dd928..dea4d41 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 _0xee3f=['addTags','addTagsToChatInteraction','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x50b8ff,_0x3ab7d9){var _0x31032=function(_0x4d406a){while(--_0x4d406a){_0x50b8ff['push'](_0x50b8ff['shift']());}};_0x31032(++_0x3ab7d9);}(_0xee3f,0x11a));var _0xfee3=function(_0x955da1,_0x141a18){_0x955da1=_0x955da1-0x0;var _0x5968f5=_0xee3f[_0x955da1];return _0x5968f5;};'use strict';var client=require('../client');exports['update']=function(_0x3e8c58,_0x5525a7){return client[_0xfee3('0x0')](_0xfee3('0x1'),{'body':_0x5525a7,'options':{'where':{'id':_0x3e8c58}},'log':_0xfee3('0x2')});};exports[_0xfee3('0x3')]=function(_0x1ca535,_0x2132c3){return client[_0xfee3('0x0')]('AddTagsToChatInteraction',{'body':_0x2132c3,'options':{'where':{'id':_0x1ca535}},'log':_0xfee3('0x4')});}; \ No newline at end of file +var _0xfd40=['Request','UpdateChatInteraction','updateChatInteraction','AddTagsToChatInteraction','../client','update'];(function(_0xec1f31,_0x7dbc13){var _0x2226c9=function(_0x57fdc2){while(--_0x57fdc2){_0xec1f31['push'](_0xec1f31['shift']());}};_0x2226c9(++_0x7dbc13);}(_0xfd40,0x130));var _0x0fd4=function(_0x46b8bd,_0x1a2bb5){_0x46b8bd=_0x46b8bd-0x0;var _0x440803=_0xfd40[_0x46b8bd];return _0x440803;};'use strict';var client=require(_0x0fd4('0x0'));exports[_0x0fd4('0x1')]=function(_0x27574c,_0x4c9d40){return client[_0x0fd4('0x2')](_0x0fd4('0x3'),{'body':_0x4c9d40,'options':{'where':{'id':_0x27574c}},'log':_0x0fd4('0x4')});};exports['addTags']=function(_0x590f7b,_0x33877c){return client[_0x0fd4('0x2')](_0x0fd4('0x5'),{'body':_0x33877c,'options':{'where':{'id':_0x590f7b}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 32d0f9b..ad9baa7 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 _0x6b33=['create','Request','CreateChatMessage','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6b33,0xa3));var _0x36b3=function(_0xc1aa42,_0x137d36){_0xc1aa42=_0xc1aa42-0x0;var _0x3e8b0c=_0x6b33[_0xc1aa42];return _0x3e8b0c;};'use strict';var client=require(_0x36b3('0x0'));exports[_0x36b3('0x1')]=function(_0xae7220){return client[_0x36b3('0x2')](_0x36b3('0x3'),{'body':_0xae7220,'log':'createChatMessage'});}; \ No newline at end of file +var _0xcff2=['../client','create','Request','createChatMessage'];(function(_0x57f9ad,_0x59bd8a){var _0x371ff2=function(_0x9bde58){while(--_0x9bde58){_0x57f9ad['push'](_0x57f9ad['shift']());}};_0x371ff2(++_0x59bd8a);}(_0xcff2,0x130));var _0x2cff=function(_0x3474ac,_0x22d0f7){_0x3474ac=_0x3474ac-0x0;var _0x5345ec=_0xcff2[_0x3474ac];return _0x5345ec;};'use strict';var client=require(_0x2cff('0x0'));exports[_0x2cff('0x1')]=function(_0xeac513){return client[_0x2cff('0x2')]('CreateChatMessage',{'body':_0xeac513,'log':_0x2cff('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 21eabd9..4a38a13 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 _0xd493=['timeout','Agents','name','getChatQueues','../client','Request','GetChatQueue'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xd493,0x1bd));var _0x3d49=function(_0x4e5cd5,_0x506acd){_0x4e5cd5=_0x4e5cd5-0x0;var _0x33028d=_0xd493[_0x4e5cd5];return _0x33028d;};'use strict';var client=require(_0x3d49('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x3d49('0x1')](_0x3d49('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x3d49('0x3'),'strategy'],'include':[{'model':'User','as':_0x3d49('0x4'),'attributes':['id',_0x3d49('0x5'),'online','chatPause']}]},'log':_0x3d49('0x6')});};}; \ No newline at end of file +var _0x919e=['getChatQueues','Request','name','User','Agents','online','chatPause','../client'];(function(_0x465643,_0x44dc4e){var _0x38ab86=function(_0x2d5496){while(--_0x2d5496){_0x465643['push'](_0x465643['shift']());}};_0x38ab86(++_0x44dc4e);}(_0x919e,0x1d7));var _0xe919=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x919e[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xe919('0x0'));exports[_0xe919('0x1')]=function(){return function(){return client[_0xe919('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xe919('0x3'),'timeout','strategy'],'include':[{'model':_0xe919('0x4'),'as':_0xe919('0x5'),'attributes':['id',_0xe919('0x3'),_0xe919('0x6'),_0xe919('0x7')]}]},'log':_0xe919('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 7a05e69..8f639ad 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 _0x37f8=['create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x37f8,0xd2));var _0x837f=function(_0x14460d,_0x30f95c){_0x14460d=_0x14460d-0x0;var _0xe860e9=_0x37f8[_0x14460d];return _0xe860e9;};'use strict';var client=require('../client');exports[_0x837f('0x0')]=function(_0x3755bc){return client[_0x837f('0x1')](_0x837f('0x2'),{'body':_0x3755bc,'log':'CreateChatQueueReport'});};exports[_0x837f('0x3')]=function(_0x5184ad,_0x5f2d01){return client['Request']('UpdateChatQueueReport',{'body':_0x5f2d01,'options':{'where':{'uniqueid':_0x5184ad},'order':[['id','DESC']],'limit':0x1},'log':_0x837f('0x4')});}; \ No newline at end of file +var _0x43fd=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport','DESC'];(function(_0x3eb908,_0x45ed31){var _0x395aa1=function(_0x567657){while(--_0x567657){_0x3eb908['push'](_0x3eb908['shift']());}};_0x395aa1(++_0x45ed31);}(_0x43fd,0x150));var _0xd43f=function(_0x254ed6,_0x35737f){_0x254ed6=_0x254ed6-0x0;var _0x498447=_0x43fd[_0x254ed6];return _0x498447;};'use strict';var client=require(_0xd43f('0x0'));exports[_0xd43f('0x1')]=function(_0x544748){return client[_0xd43f('0x2')]('CreateChatQueueReport',{'body':_0x544748,'log':_0xd43f('0x3')});};exports[_0xd43f('0x4')]=function(_0x2a99a2,_0x466a7a){return client[_0xd43f('0x2')](_0xd43f('0x5'),{'body':_0x466a7a,'options':{'where':{'uniqueid':_0x2a99a2},'order':[['id',_0xd43f('0x6')]],'limit':0x1},'log':_0xd43f('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 0118fda..d06aaa4 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(_0xf4d05,_0x5e601f){var _0x47c971=function(_0x17aae3){while(--_0x17aae3){_0xf4d05['push'](_0xf4d05['shift']());}};_0x47c971(++_0x5e601f);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0x7a54,0x106));var _0x47a5=function(_0x11eb8f,_0x45030c){_0x11eb8f=_0x11eb8f-0x0;var _0x57a92f=_0x7a54[_0x11eb8f];return _0x57a92f;};'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 a4d3dce..6542bf8 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 _0x290e=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0xbcb083,_0x1d99ed){var _0x1b4bff=function(_0xfc5a99){while(--_0xfc5a99){_0xbcb083['push'](_0xbcb083['shift']());}};_0x1b4bff(++_0x1d99ed);}(_0x290e,0x15a));var _0xe290=function(_0xddee6f,_0x51f8dd){_0xddee6f=_0xddee6f-0x0;var _0x5e1408=_0x290e[_0xddee6f];return _0x5e1408;};'use strict';var client=require(_0xe290('0x0'));exports[_0xe290('0x1')]=function(_0x563e70){return client[_0xe290('0x2')](_0xe290('0x3'),{'body':_0x563e70,'log':_0xe290('0x4')});}; \ No newline at end of file +var _0xeb5e=['createFaxMessage','create','Request','CreateFaxMessage'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xeb5e,0xfd));var _0xeeb5=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0xeb5e[_0x279d37];return _0x530173;};'use strict';var client=require('../client');exports[_0xeeb5('0x0')]=function(_0x9cd755){return client[_0xeeb5('0x1')](_0xeeb5('0x2'),{'body':_0x9cd755,'log':_0xeeb5('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 61dcdac..f003044 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 _0x640f=['online','faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','User','Agents'];(function(_0x2127ce,_0x5c951d){var _0x5b5380=function(_0x3b137f){while(--_0x3b137f){_0x2127ce['push'](_0x2127ce['shift']());}};_0x5b5380(++_0x5c951d);}(_0x640f,0x92));var _0xf640=function(_0xf42c57,_0x47ad00){_0xf42c57=_0xf42c57-0x0;var _0x35857c=_0x640f[_0xf42c57];return _0x35857c;};'use strict';var client=require('../client');exports[_0xf640('0x0')]=function(){return function(){return client[_0xf640('0x1')](_0xf640('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xf640('0x3'),_0xf640('0x4')],'include':[{'model':_0xf640('0x5'),'as':_0xf640('0x6'),'attributes':['id','name',_0xf640('0x7'),_0xf640('0x8')]}]},'log':_0xf640('0x0')});};}; \ No newline at end of file +var _0x8272=['Request','GetFaxQueue','timeout','strategy','User','Agents','name','faxPause','../client','getFaxQueues'];(function(_0x169b07,_0xc2718){var _0x10968c=function(_0x2d8255){while(--_0x2d8255){_0x169b07['push'](_0x169b07['shift']());}};_0x10968c(++_0xc2718);}(_0x8272,0x170));var _0x2827=function(_0x1fc91d,_0x144ed1){_0x1fc91d=_0x1fc91d-0x0;var _0x4705ad=_0x8272[_0x1fc91d];return _0x4705ad;};'use strict';var client=require(_0x2827('0x0'));exports[_0x2827('0x1')]=function(){return function(){return client[_0x2827('0x2')](_0x2827('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2827('0x4'),_0x2827('0x5')],'include':[{'model':_0x2827('0x6'),'as':_0x2827('0x7'),'attributes':['id',_0x2827('0x8'),'online',_0x2827('0x9')]}]},'log':_0x2827('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index a176dc3..64823ae 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 _0xf915=['DESC','create','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x37e93c,_0x27d2b0){var _0xfad175=function(_0x46065a){while(--_0x46065a){_0x37e93c['push'](_0x37e93c['shift']());}};_0xfad175(++_0x27d2b0);}(_0xf915,0x1db));var _0x5f91=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf915[_0x57b54c];return _0x59cc19;};'use strict';var client=require('../client');exports[_0x5f91('0x0')]=function(_0x496500){return client['Request'](_0x5f91('0x1'),{'body':_0x496500,'log':_0x5f91('0x1')});};exports[_0x5f91('0x2')]=function(_0x21a07d,_0x1f3117){return client[_0x5f91('0x3')](_0x5f91('0x4'),{'body':_0x1f3117,'options':{'where':{'uniqueid':_0x21a07d},'order':[['id',_0x5f91('0x5')]],'limit':0x1},'log':_0x5f91('0x4')});}; \ No newline at end of file +var _0xc014=['update','Request','DESC','../client','CreateFaxQueueReport'];(function(_0x497b1e,_0x586379){var _0x3f72e1=function(_0x4c227d){while(--_0x4c227d){_0x497b1e['push'](_0x497b1e['shift']());}};_0x3f72e1(++_0x586379);}(_0xc014,0x1c0));var _0x4c01=function(_0x1fdb40,_0x51351c){_0x1fdb40=_0x1fdb40-0x0;var _0x281f93=_0xc014[_0x1fdb40];return _0x281f93;};'use strict';var client=require(_0x4c01('0x0'));exports['create']=function(_0xb00dee){return client['Request'](_0x4c01('0x1'),{'body':_0xb00dee,'log':_0x4c01('0x1')});};exports[_0x4c01('0x2')]=function(_0x2d32c2,_0x511116){return client[_0x4c01('0x3')]('UpdateFaxQueueReport',{'body':_0x511116,'options':{'where':{'uniqueid':_0x2d32c2},'order':[['id',_0x4c01('0x4')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 5f4421c..cbcb69b 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 _0x3936=['Intervals','interval','../client','getIntervals','GetInterval','name','Interval'];(function(_0x55923c,_0x166edb){var _0xf94fbb=function(_0x5d941d){while(--_0x5d941d){_0x55923c['push'](_0x55923c['shift']());}};_0xf94fbb(++_0x166edb);}(_0x3936,0x12f));var _0x6393=function(_0x129d52,_0x1beadf){_0x129d52=_0x129d52-0x0;var _0x79ef89=_0x3936[_0x129d52];return _0x79ef89;};'use strict';var client=require(_0x6393('0x0'));exports[_0x6393('0x1')]=function(){return function(){return client['Request'](_0x6393('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x6393('0x3')],'include':[{'model':_0x6393('0x4'),'as':_0x6393('0x5'),'attributes':['id',_0x6393('0x3'),_0x6393('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0xf1bc=['Interval','Intervals','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0xf1bc,0x12b));var _0xcf1b=function(_0x392e88,_0x9cbbf6){_0x392e88=_0x392e88-0x0;var _0x256621=_0xf1bc[_0x392e88];return _0x256621;};'use strict';var client=require(_0xcf1b('0x0'));exports[_0xcf1b('0x1')]=function(){return function(){return client[_0xcf1b('0x2')](_0xcf1b('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xcf1b('0x4')],'include':[{'model':_0xcf1b('0x5'),'as':_0xcf1b('0x6'),'attributes':['id','name',_0xcf1b('0x7')]}]},'log':_0xcf1b('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 0b42c5f..bcc42bc 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 _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x2199d7,_0xf39337){var _0x4cc7fd=function(_0x6857e){while(--_0x6857e){_0x2199d7['push'](_0x2199d7['shift']());}};_0x4cc7fd(++_0xf39337);}(_0x02ce,0x1ac));var _0xe02c=function(_0x4ece40,_0xdb0765){_0x4ece40=_0x4ece40-0x0;var _0x54db15=_0x02ce[_0x4ece40];return _0x54db15;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file +var _0xd824=['Request','UpdateMailInteraction','updateMailInteraction','addTags','addTagsToChatInteraction','../client','update'];(function(_0x491cbe,_0x45c8ba){var _0x59449d=function(_0x21b463){while(--_0x21b463){_0x491cbe['push'](_0x491cbe['shift']());}};_0x59449d(++_0x45c8ba);}(_0xd824,0xc2));var _0x4d82=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xd824[_0x40a045];return _0x1a687c;};'use strict';var client=require(_0x4d82('0x0'));exports[_0x4d82('0x1')]=function(_0x572eea,_0x53fe9a){return client[_0x4d82('0x2')](_0x4d82('0x3'),{'body':_0x53fe9a,'options':{'where':{'id':_0x572eea}},'log':_0x4d82('0x4')});};exports[_0x4d82('0x5')]=function(_0x287fbf,_0x1c8ad9){return client['Request']('AddTagsToMailInteraction',{'body':_0x1c8ad9,'options':{'where':{'id':_0x287fbf}},'log':_0x4d82('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 9f4fae3..110e40e 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 _0x4da8=['../client','create','Request','CreateMailMessage','createMailMessage'];(function(_0x4b5d23,_0x1797fb){var _0x37bafd=function(_0x5458d7){while(--_0x5458d7){_0x4b5d23['push'](_0x4b5d23['shift']());}};_0x37bafd(++_0x1797fb);}(_0x4da8,0x19f));var _0x84da=function(_0xdcce44,_0x53d035){_0xdcce44=_0xdcce44-0x0;var _0x54ca1b=_0x4da8[_0xdcce44];return _0x54ca1b;};'use strict';var client=require(_0x84da('0x0'));exports[_0x84da('0x1')]=function(_0xc13d3a){return client[_0x84da('0x2')](_0x84da('0x3'),{'body':_0xc13d3a,'log':_0x84da('0x4')});}; \ No newline at end of file +var _0x59ec=['Request','CreateMailMessage','../client'];(function(_0x2c1fc2,_0x150f7d){var _0x5ac13f=function(_0x5c81d7){while(--_0x5c81d7){_0x2c1fc2['push'](_0x2c1fc2['shift']());}};_0x5ac13f(++_0x150f7d);}(_0x59ec,0x188));var _0xc59e=function(_0x195907,_0x141ae0){_0x195907=_0x195907-0x0;var _0x51601a=_0x59ec[_0x195907];return _0x51601a;};'use strict';var client=require(_0xc59e('0x0'));exports['create']=function(_0x423394){return client[_0xc59e('0x1')](_0xc59e('0x2'),{'body':_0x423394,'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 bbc1f92..e13144a 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 _0x7a0e=['Request','GetMailQueue','name','strategy','User','mailPause','../client','getMailQueues'];(function(_0x28139b,_0xac7343){var _0x4d051c=function(_0x1e6da6){while(--_0x1e6da6){_0x28139b['push'](_0x28139b['shift']());}};_0x4d051c(++_0xac7343);}(_0x7a0e,0x17e));var _0xe7a0=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x7a0e[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0xe7a0('0x0'));exports[_0xe7a0('0x1')]=function(){return function(){return client[_0xe7a0('0x2')](_0xe7a0('0x3'),{'options':{'raw':![],'attributes':['id',_0xe7a0('0x4'),'timeout',_0xe7a0('0x5')],'include':[{'model':_0xe7a0('0x6'),'as':'Agents','attributes':['id',_0xe7a0('0x4'),'online',_0xe7a0('0x7')]}]},'log':_0xe7a0('0x1')});};}; \ No newline at end of file +var _0xdcbc=['Agents','online','../client','getMailQueues','Request','name','timeout','User'];(function(_0x10c01a,_0x1202d3){var _0x3a4805=function(_0x3223fa){while(--_0x3223fa){_0x10c01a['push'](_0x10c01a['shift']());}};_0x3a4805(++_0x1202d3);}(_0xdcbc,0xd2));var _0xcdcb=function(_0xb387ce,_0x54c026){_0xb387ce=_0xb387ce-0x0;var _0xc4e4a6=_0xdcbc[_0xb387ce];return _0xc4e4a6;};'use strict';var client=require(_0xcdcb('0x0'));exports[_0xcdcb('0x1')]=function(){return function(){return client[_0xcdcb('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xcdcb('0x3'),_0xcdcb('0x4'),'strategy'],'include':[{'model':_0xcdcb('0x5'),'as':_0xcdcb('0x6'),'attributes':['id',_0xcdcb('0x3'),_0xcdcb('0x7'),'mailPause']}]},'log':_0xcdcb('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 43a48bf..61d1fef 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 _0x1278=['Request','CreateMailQueueReport','update','UpdateMailQueueReport','DESC','../client'];(function(_0x5a8c38,_0x59a704){var _0x40d01d=function(_0x1e22dc){while(--_0x1e22dc){_0x5a8c38['push'](_0x5a8c38['shift']());}};_0x40d01d(++_0x59a704);}(_0x1278,0x1d9));var _0x8127=function(_0x1bae3e,_0x12950c){_0x1bae3e=_0x1bae3e-0x0;var _0x170b37=_0x1278[_0x1bae3e];return _0x170b37;};'use strict';var client=require(_0x8127('0x0'));exports['create']=function(_0x2a7918){return client[_0x8127('0x1')]('CreateMailQueueReport',{'body':_0x2a7918,'log':_0x8127('0x2')});};exports[_0x8127('0x3')]=function(_0x314ba0,_0xda008d){return client[_0x8127('0x1')](_0x8127('0x4'),{'body':_0xda008d,'options':{'where':{'uniqueid':_0x314ba0},'order':[['id',_0x8127('0x5')]],'limit':0x1},'log':'UpdateMailQueueReport'});}; \ No newline at end of file +var _0x6f4e=['DESC','../client','Request','CreateMailQueueReport','UpdateMailQueueReport'];(function(_0x1bacf1,_0x2641cc){var _0x981fdf=function(_0x1d4183){while(--_0x1d4183){_0x1bacf1['push'](_0x1bacf1['shift']());}};_0x981fdf(++_0x2641cc);}(_0x6f4e,0x1b4));var _0xe6f4=function(_0x58a0f2,_0xda36f5){_0x58a0f2=_0x58a0f2-0x0;var _0x590bb=_0x6f4e[_0x58a0f2];return _0x590bb;};'use strict';var client=require(_0xe6f4('0x0'));exports['create']=function(_0x245c33){return client[_0xe6f4('0x1')](_0xe6f4('0x2'),{'body':_0x245c33,'log':_0xe6f4('0x2')});};exports['update']=function(_0x587799,_0x17e587){return client[_0xe6f4('0x1')](_0xe6f4('0x3'),{'body':_0x17e587,'options':{'where':{'uniqueid':_0x587799},'order':[['id',_0xe6f4('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 73f4892..26c324e 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 _0x6ab8=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x575b4c,_0x3f1d33){var _0x169ce9=function(_0x2b2f2c){while(--_0x2b2f2c){_0x575b4c['push'](_0x575b4c['shift']());}};_0x169ce9(++_0x3f1d33);}(_0x6ab8,0x18e));var _0x86ab=function(_0x286595,_0x29f350){_0x286595=_0x286595-0x0;var _0x3ea6b8=_0x6ab8[_0x286595];return _0x3ea6b8;};'use strict';var client=require(_0x86ab('0x0'));exports[_0x86ab('0x1')]=function(_0xe6f92,_0x33c357){return client[_0x86ab('0x2')](_0x86ab('0x3'),{'body':_0x33c357,'options':{'where':{'id':_0xe6f92}},'log':_0x86ab('0x4')});};exports[_0x86ab('0x5')]=function(_0x361ef0,_0x4e1508){return client[_0x86ab('0x2')](_0x86ab('0x6'),{'body':_0x4e1508,'options':{'where':{'id':_0x361ef0}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xe5c0=['addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','update'];(function(_0xcb3c71,_0x285343){var _0x240009=function(_0x42bf28){while(--_0x42bf28){_0xcb3c71['push'](_0xcb3c71['shift']());}};_0x240009(++_0x285343);}(_0xe5c0,0x10d));var _0x0e5c=function(_0x27889f,_0x4809b9){_0x27889f=_0x27889f-0x0;var _0x201713=_0xe5c0[_0x27889f];return _0x201713;};'use strict';var client=require('../client');exports[_0x0e5c('0x0')]=function(_0x266cf6,_0x481c18){return client['Request']('UpdateOpenchannelInteraction',{'body':_0x481c18,'options':{'where':{'id':_0x266cf6}},'log':'updateOpenchannelInteraction'});};exports[_0x0e5c('0x1')]=function(_0x4c36aa,_0x14a6ac){return client[_0x0e5c('0x2')](_0x0e5c('0x3'),{'body':_0x14a6ac,'options':{'where':{'id':_0x4c36aa}},'log':_0x0e5c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 1c967a8..1801786 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 _0xa1df=['create','Request','createOpenchannelMessage','../client'];(function(_0x4e9979,_0x596fed){var _0x3f0400=function(_0x50a68e){while(--_0x50a68e){_0x4e9979['push'](_0x4e9979['shift']());}};_0x3f0400(++_0x596fed);}(_0xa1df,0xfb));var _0xfa1d=function(_0x4755b3,_0x2996c9){_0x4755b3=_0x4755b3-0x0;var _0x17ed1d=_0xa1df[_0x4755b3];return _0x17ed1d;};'use strict';var client=require(_0xfa1d('0x0'));exports[_0xfa1d('0x1')]=function(_0x2cab55){return client[_0xfa1d('0x2')]('CreateOpenchannelMessage',{'body':_0x2cab55,'log':_0xfa1d('0x3')});}; \ No newline at end of file +var _0xf9b8=['CreateOpenchannelMessage','Request'];(function(_0x126fec,_0x1036f6){var _0x2ee4f4=function(_0x2d8ff1){while(--_0x2d8ff1){_0x126fec['push'](_0x126fec['shift']());}};_0x2ee4f4(++_0x1036f6);}(_0xf9b8,0x1c3));var _0x8f9b=function(_0x1dd15d,_0x1f3016){_0x1dd15d=_0x1dd15d-0x0;var _0xa4cb0=_0xf9b8[_0x1dd15d];return _0xa4cb0;};'use strict';var client=require('../client');exports['create']=function(_0x16fb58){return client[_0x8f9b('0x0')](_0x8f9b('0x1'),{'body':_0x16fb58,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index d4ebd9c..ee3a89c 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 _0x2d22=['timeout','User','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x2d22,0x1bd));var _0x22d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2d22[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x22d2('0x0'));exports[_0x22d2('0x1')]=function(){return function(){return client[_0x22d2('0x2')](_0x22d2('0x3'),{'options':{'raw':![],'attributes':['id',_0x22d2('0x4'),_0x22d2('0x5'),'strategy'],'include':[{'model':_0x22d2('0x6'),'as':_0x22d2('0x7'),'attributes':['id',_0x22d2('0x4'),_0x22d2('0x8'),_0x22d2('0x9')]}]},'log':_0x22d2('0x1')});};}; \ No newline at end of file +var _0xb458=['name','timeout','strategy','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue'];(function(_0x250bd3,_0x2f7a0d){var _0x2b8c9a=function(_0x157f70){while(--_0x157f70){_0x250bd3['push'](_0x250bd3['shift']());}};_0x2b8c9a(++_0x2f7a0d);}(_0xb458,0x10a));var _0x8b45=function(_0x132870,_0x1fbbfb){_0x132870=_0x132870-0x0;var _0xea2554=_0xb458[_0x132870];return _0xea2554;};'use strict';var client=require(_0x8b45('0x0'));exports[_0x8b45('0x1')]=function(){return function(){return client[_0x8b45('0x2')](_0x8b45('0x3'),{'options':{'raw':![],'attributes':['id',_0x8b45('0x4'),_0x8b45('0x5'),_0x8b45('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8b45('0x4'),_0x8b45('0x7'),_0x8b45('0x8')]}]},'log':_0x8b45('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 0de9602..71614e0 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 _0xc069=['create','CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x2383c3,_0x4fd9de){var _0x2cadbc=function(_0x2d0810){while(--_0x2d0810){_0x2383c3['push'](_0x2383c3['shift']());}};_0x2cadbc(++_0x4fd9de);}(_0xc069,0x1cd));var _0x9c06=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc069[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x9c06('0x0'));exports[_0x9c06('0x1')]=function(_0x3ceabd){return client['Request'](_0x9c06('0x2'),{'body':_0x3ceabd,'log':_0x9c06('0x2')});};exports[_0x9c06('0x3')]=function(_0x3e22df,_0x3d5c7c){return client[_0x9c06('0x4')](_0x9c06('0x5'),{'body':_0x3d5c7c,'options':{'where':{'uniqueid':_0x3e22df},'order':[['id',_0x9c06('0x6')]],'limit':0x1},'log':_0x9c06('0x5')});}; \ No newline at end of file +var _0x7b84=['UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport','update'];(function(_0x5c4079,_0x4e8d1f){var _0x4424ed=function(_0x10913f){while(--_0x10913f){_0x5c4079['push'](_0x5c4079['shift']());}};_0x4424ed(++_0x4e8d1f);}(_0x7b84,0x99));var _0x47b8=function(_0xa88995,_0x29abc3){_0xa88995=_0xa88995-0x0;var _0x1903e1=_0x7b84[_0xa88995];return _0x1903e1;};'use strict';var client=require('../client');exports[_0x47b8('0x0')]=function(_0x42dfd4){return client['Request'](_0x47b8('0x1'),{'body':_0x42dfd4,'log':'CreateOpenchannelQueueReport'});};exports[_0x47b8('0x2')]=function(_0x42c7cc,_0x4e07d3){return client['Request'](_0x47b8('0x3'),{'body':_0x4e07d3,'options':{'where':{'uniqueid':_0x42c7cc},'order':[['id','DESC']],'limit':0x1},'log':_0x47b8('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index d9a58d7..cc88808 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 _0x88d5=['update','Request','updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client'];(function(_0x9d9049,_0x480f0b){var _0x296774=function(_0x28ebff){while(--_0x28ebff){_0x9d9049['push'](_0x9d9049['shift']());}};_0x296774(++_0x480f0b);}(_0x88d5,0x76));var _0x588d=function(_0x1c0c50,_0xd5c125){_0x1c0c50=_0x1c0c50-0x0;var _0x2db011=_0x88d5[_0x1c0c50];return _0x2db011;};'use strict';var client=require(_0x588d('0x0'));exports[_0x588d('0x1')]=function(_0x3a7368,_0xa4be53){return client[_0x588d('0x2')]('UpdateSmsInteraction',{'body':_0xa4be53,'options':{'where':{'id':_0x3a7368}},'log':_0x588d('0x3')});};exports[_0x588d('0x4')]=function(_0x504b52,_0x474e79){return client[_0x588d('0x2')](_0x588d('0x5'),{'body':_0x474e79,'options':{'where':{'id':_0x504b52}},'log':_0x588d('0x6')});}; \ No newline at end of file +var _0x7c22=['../client','update','Request','updateSmsInteraction','addTags','addTagsToSmsInteraction'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x7c22,0x6c));var _0x27c2=function(_0x272646,_0xfd36c5){_0x272646=_0x272646-0x0;var _0x22c929=_0x7c22[_0x272646];return _0x22c929;};'use strict';var client=require(_0x27c2('0x0'));exports[_0x27c2('0x1')]=function(_0x4b2191,_0x45a700){return client[_0x27c2('0x2')]('UpdateSmsInteraction',{'body':_0x45a700,'options':{'where':{'id':_0x4b2191}},'log':_0x27c2('0x3')});};exports[_0x27c2('0x4')]=function(_0x59004d,_0x4ce950){return client[_0x27c2('0x2')]('AddTagsToSmsInteraction',{'body':_0x4ce950,'options':{'where':{'id':_0x59004d}},'log':_0x27c2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 537ca7c..a5dbcb2 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 _0x4ebc=['Request','createSmsMessage','../client','create'];(function(_0x4876a5,_0x58f4ba){var _0x474ddc=function(_0x49dc75){while(--_0x49dc75){_0x4876a5['push'](_0x4876a5['shift']());}};_0x474ddc(++_0x58f4ba);}(_0x4ebc,0x10a));var _0xc4eb=function(_0x55fc59,_0x484454){_0x55fc59=_0x55fc59-0x0;var _0x238552=_0x4ebc[_0x55fc59];return _0x238552;};'use strict';var client=require(_0xc4eb('0x0'));exports[_0xc4eb('0x1')]=function(_0x523fc4){return client[_0xc4eb('0x2')]('CreateSmsMessage',{'body':_0x523fc4,'log':_0xc4eb('0x3')});}; \ No newline at end of file +var _0x7ab0=['create','Request','CreateSmsMessage','createSmsMessage'];(function(_0xd5c3eb,_0x2d4556){var _0xb5b600=function(_0x25fe9e){while(--_0x25fe9e){_0xd5c3eb['push'](_0xd5c3eb['shift']());}};_0xb5b600(++_0x2d4556);}(_0x7ab0,0x108));var _0x07ab=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7ab0[_0x5b644e];return _0x49c6bf;};'use strict';var client=require('../client');exports[_0x07ab('0x0')]=function(_0x115948){return client[_0x07ab('0x1')](_0x07ab('0x2'),{'body':_0x115948,'log':_0x07ab('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 757d079..e22192d 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x31061a,_0x5ab647){var _0x48d92a=function(_0x421130){while(--_0x421130){_0x31061a['push'](_0x31061a['shift']());}};_0x48d92a(++_0x5ab647);}(_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 +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x23b546,_0x5f00bc){var _0xe9c47a=function(_0x19b29e){while(--_0x19b29e){_0x23b546['push'](_0x23b546['shift']());}};_0xe9c47a(++_0x5f00bc);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xb7e7[_0xf71120];return _0xbe2fd3;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9313aa3..9d75fdd 100644 --- a/server/services/routing/rpc/smsQueueReport.js +++ b/server/services/routing/rpc/smsQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2f0bf1,_0x183ef1){var _0xf1df38=function(_0x56982a){while(--_0x56982a){_0x2f0bf1['push'](_0x2f0bf1['shift']());}};_0xf1df38(++_0x183ef1);}(_0x008c,0x188));var _0xc008=function(_0x353313,_0x5c3686){_0x353313=_0x353313-0x0;var _0x4cb750=_0x008c[_0x353313];return _0x4cb750;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5912a0,_0x1f366f){var _0x1b69ea=function(_0x4bb09e){while(--_0x4bb09e){_0x5912a0['push'](_0x5912a0['shift']());}};_0x1b69ea(++_0x1f366f);}(_0x008c,0x188));var _0xc008=function(_0x512aa7,_0x2be0d9){_0x512aa7=_0x512aa7-0x0;var _0x952539=_0x008c[_0x512aa7];return _0x952539;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 60f2e95..ea0a4f9 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(_0x964735,_0xc670d0){var _0x543ac1=function(_0x3075f3){while(--_0x3075f3){_0x964735['push'](_0x964735['shift']());}};_0x543ac1(++_0xc670d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'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(_0x528576,_0x1db26f){var _0x1da6a1=function(_0x4308d5){while(--_0x4308d5){_0x528576['push'](_0x528576['shift']());}};_0x1da6a1(++_0x1db26f);}(_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'),'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 965fc51..9762cb6 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 _0xed5c=['addTagsToWhatsappInteraction','../client','update','Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction'];(function(_0x1506ef,_0xb470de){var _0x33593d=function(_0x52317c){while(--_0x52317c){_0x1506ef['push'](_0x1506ef['shift']());}};_0x33593d(++_0xb470de);}(_0xed5c,0x81));var _0xced5=function(_0x2c4691,_0x5d1835){_0x2c4691=_0x2c4691-0x0;var _0x429156=_0xed5c[_0x2c4691];return _0x429156;};'use strict';var client=require(_0xced5('0x0'));exports[_0xced5('0x1')]=function(_0x2c59c3,_0x21fae7){return client[_0xced5('0x2')](_0xced5('0x3'),{'body':_0x21fae7,'options':{'where':{'id':_0x2c59c3}},'log':_0xced5('0x4')});};exports[_0xced5('0x5')]=function(_0x2b8184,_0x2ec4f9){return client['Request'](_0xced5('0x6'),{'body':_0x2ec4f9,'options':{'where':{'id':_0x2b8184}},'log':_0xced5('0x7')});}; \ No newline at end of file +var _0x307e=['Request','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update'];(function(_0x414b44,_0x3b95a0){var _0x32fa6b=function(_0x109d96){while(--_0x109d96){_0x414b44['push'](_0x414b44['shift']());}};_0x32fa6b(++_0x3b95a0);}(_0x307e,0xc9));var _0xe307=function(_0x3d143a,_0x57d062){_0x3d143a=_0x3d143a-0x0;var _0x129bc2=_0x307e[_0x3d143a];return _0x129bc2;};'use strict';var client=require(_0xe307('0x0'));exports[_0xe307('0x1')]=function(_0x3104f1,_0x4689ed){return client[_0xe307('0x2')]('UpdateWhatsappInteraction',{'body':_0x4689ed,'options':{'where':{'id':_0x3104f1}},'log':_0xe307('0x3')});};exports[_0xe307('0x4')]=function(_0x516a1d,_0x1eee4d){return client['Request'](_0xe307('0x5'),{'body':_0x1eee4d,'options':{'where':{'id':_0x516a1d}},'log':_0xe307('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index e861ddc..9cb9703 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 _0xe774=['create','Request'];(function(_0x4b0b6c,_0x278350){var _0xf4436a=function(_0x1f8e8c){while(--_0x1f8e8c){_0x4b0b6c['push'](_0x4b0b6c['shift']());}};_0xf4436a(++_0x278350);}(_0xe774,0xc4));var _0x4e77=function(_0x500c60,_0x440c56){_0x500c60=_0x500c60-0x0;var _0x28bb20=_0xe774[_0x500c60];return _0x28bb20;};'use strict';var client=require('../client');exports[_0x4e77('0x0')]=function(_0x4eabd8){return client[_0x4e77('0x1')]('CreateWhatsappMessage',{'body':_0x4eabd8,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x7113=['Request','CreateWhatsappMessage','createWhatsappMessage','../client'];(function(_0x5eabe7,_0x55a5bd){var _0x696eb2=function(_0x4032bb){while(--_0x4032bb){_0x5eabe7['push'](_0x5eabe7['shift']());}};_0x696eb2(++_0x55a5bd);}(_0x7113,0x173));var _0x3711=function(_0x4bf645,_0x40c152){_0x4bf645=_0x4bf645-0x0;var _0x733fde=_0x7113[_0x4bf645];return _0x733fde;};'use strict';var client=require(_0x3711('0x0'));exports['create']=function(_0x536edb){return client[_0x3711('0x1')](_0x3711('0x2'),{'body':_0x536edb,'log':_0x3711('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7c0f5aa..de1da08 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 _0xd5cb=['Request','GetWhatsappQueue','name','timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xd5cb,0x184));var _0xbd5c=function(_0x2f480d,_0x33e159){_0x2f480d=_0x2f480d-0x0;var _0x4329d9=_0xd5cb[_0x2f480d];return _0x4329d9;};'use strict';var client=require(_0xbd5c('0x0'));exports[_0xbd5c('0x1')]=function(){return function(){return client[_0xbd5c('0x2')](_0xbd5c('0x3'),{'options':{'raw':![],'attributes':['id',_0xbd5c('0x4'),_0xbd5c('0x5'),_0xbd5c('0x6')],'include':[{'model':_0xbd5c('0x7'),'as':'Agents','attributes':['id',_0xbd5c('0x4'),_0xbd5c('0x8'),_0xbd5c('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file +var _0x9a82=['strategy','Agents','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue','name','timeout'];(function(_0x4085c5,_0x5615b6){var _0xee1c3d=function(_0x8ad49b){while(--_0x8ad49b){_0x4085c5['push'](_0x4085c5['shift']());}};_0xee1c3d(++_0x5615b6);}(_0x9a82,0x158));var _0x29a8=function(_0x45d7d9,_0x13c12c){_0x45d7d9=_0x45d7d9-0x0;var _0x156258=_0x9a82[_0x45d7d9];return _0x156258;};'use strict';var client=require(_0x29a8('0x0'));exports[_0x29a8('0x1')]=function(){return function(){return client[_0x29a8('0x2')](_0x29a8('0x3'),{'options':{'raw':![],'attributes':['id',_0x29a8('0x4'),_0x29a8('0x5'),_0x29a8('0x6')],'include':[{'model':'User','as':_0x29a8('0x7'),'attributes':['id','name',_0x29a8('0x8'),_0x29a8('0x9')]}]},'log':'getWhatsappQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index b78b899..3378dde 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 _0x3ed2=['CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','create','Request'];(function(_0x37a9d7,_0x2b6fde){var _0x1343d3=function(_0x3bde45){while(--_0x3bde45){_0x37a9d7['push'](_0x37a9d7['shift']());}};_0x1343d3(++_0x2b6fde);}(_0x3ed2,0x70));var _0x23ed=function(_0x1993a8,_0xd34e39){_0x1993a8=_0x1993a8-0x0;var _0x353428=_0x3ed2[_0x1993a8];return _0x353428;};'use strict';var client=require('../client');exports[_0x23ed('0x0')]=function(_0x50b158){return client[_0x23ed('0x1')](_0x23ed('0x2'),{'body':_0x50b158,'log':_0x23ed('0x2')});};exports[_0x23ed('0x3')]=function(_0x46db12,_0x2c1984){return client[_0x23ed('0x1')](_0x23ed('0x4'),{'body':_0x2c1984,'options':{'where':{'uniqueid':_0x46db12},'order':[['id',_0x23ed('0x5')]],'limit':0x1},'log':_0x23ed('0x4')});}; \ No newline at end of file +var _0x14d7=['update','UpdateWhatsappQueueReport','../client','Request','CreateWhatsappQueueReport'];(function(_0x4e3c5b,_0x19468e){var _0x529c6d=function(_0x407633){while(--_0x407633){_0x4e3c5b['push'](_0x4e3c5b['shift']());}};_0x529c6d(++_0x19468e);}(_0x14d7,0x6b));var _0x714d=function(_0x338391,_0x4d5e84){_0x338391=_0x338391-0x0;var _0x363e1c=_0x14d7[_0x338391];return _0x363e1c;};'use strict';var client=require(_0x714d('0x0'));exports['create']=function(_0x40d04a){return client[_0x714d('0x1')](_0x714d('0x2'),{'body':_0x40d04a,'log':_0x714d('0x2')});};exports[_0x714d('0x3')]=function(_0x22c140,_0x725f10){return client[_0x714d('0x1')](_0x714d('0x4'),{'body':_0x725f10,'options':{'where':{'uniqueid':_0x22c140},'order':[['id','DESC']],'limit':0x1},'log':_0x714d('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 178ec86..c089be7 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 _0xcac3=['info','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','stack','util','seq-queue','../../../../config/logger','routing','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','validate','length','error','[%s][AGENT]\x20%s','map','message','join','stop','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end'];(function(_0xd02def,_0x144f25){var _0x2e8374=function(_0x5ceb35){while(--_0x5ceb35){_0xd02def['push'](_0xd02def['shift']());}};_0x2e8374(++_0x144f25);}(_0xcac3,0x194));var _0x3cac=function(_0x423b10,_0x36cad4){_0x423b10=_0x423b10-0x0;var _0x1338d9=_0xcac3[_0x423b10];return _0x1338d9;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x3cac('0x0'));var seqqueue=require(_0x3cac('0x1'));var logger=require(_0x3cac('0x2'))(_0x3cac('0x3'));var strategy=require('./strategy');var queue=schema({'name':{'type':_0x3cac('0x4'),'required':!![],'message':_0x3cac('0x5')},'timeout':{'type':'number','message':_0x3cac('0x6')}});function writeLog(_0x265cd0,_0xf38443,_0x237683){return logger['info'](util[_0x3cac('0x7')](_0x3cac('0x8'),_0x265cd0,_0xf38443[_0x3cac('0x9')],_0x237683));}function handleFindAgent(_0x4eacb4){return function(_0x592495){return _0x592495[_0x3cac('0x9')]['toLowerCase']()===_0x4eacb4[_0x3cac('0xa')]();};}exports[_0x3cac('0xb')]=function(_0x57eb42,_0x5a95a5,_0x410e3d,_0xf5171a){return function(_0x3d4bee){try{var _0x78ff49={'name':_0x5a95a5[0x0],'timeout':_0x5a95a5[0x1]};var _0xa65c1d=queue[_0x3cac('0xc')](_0x78ff49,{'typecast':!![]});if(_0xa65c1d[_0x3cac('0xd')]){logger[_0x3cac('0xe')](_0x3cac('0xf'),_0x57eb42,_[_0x3cac('0x10')](_0xa65c1d,_0x3cac('0x11'))[_0x3cac('0x12')](',\x20'));_0x3d4bee[_0x3cac('0x13')]();}else{var _0x2eff2d=_['find'](_0x410e3d[_0x3cac('0x14')],handleFindAgent(_0x78ff49['name']));if(_0x2eff2d){var _0x360a25=(_0x78ff49[_0x3cac('0x15')]||0xa)*0x3e8;var _0x54c7c1,_0x25d5de;var _0x203ce9=seqqueue[_0x3cac('0x16')](_0x360a25);_0x203ce9['id']=_0x57eb42;_0x203ce9[_0x3cac('0x17')]=_0x360a25;_0x203ce9[_0x3cac('0x18')]=_0xf5171a[_0x3cac('0x18')];writeLog(_0x57eb42,_0x2eff2d,util[_0x3cac('0x7')](_0x3cac('0x19'),_0x360a25));_0x410e3d[_0x3cac('0x1a')][_0x57eb42]['on'](_0x3cac('0x1b'),function(){logger[_0x3cac('0x1c')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x57eb42);clearTimeout(_0x25d5de);_0x25d5de=undefined;_0x203ce9['close']();if(_0x410e3d[_0x3cac('0x1a')][_0x57eb42]){delete _0x410e3d['rules'][_0x57eb42];}_0x3d4bee[_0x3cac('0x13')]();});_0x410e3d[_0x3cac('0x1a')][_0x57eb42]['on'](_0x3cac('0x1d'),function(){if(_0x410e3d['rules'][_0x57eb42]){delete _0x410e3d[_0x3cac('0x1a')][_0x57eb42];}});_0x25d5de=setTimeout(function(){logger[_0x3cac('0x1c')](_0x3cac('0x1e'),_0x57eb42);clearTimeout(_0x25d5de);_0x203ce9['close']();_0x3d4bee[_0x3cac('0x1f')]();},_0x360a25);strategy[_0x3cac('0x20')](_0x203ce9,_0x2eff2d,_0x410e3d,_0xf5171a);}else{logger[_0x3cac('0xe')](_0x3cac('0x21'),_0x57eb42,_0x78ff49[_0x3cac('0x9')]);_0x3d4bee['stop']();}}}catch(_0xda9d9f){console['log'](_0xda9d9f);logger[_0x3cac('0xe')](_0x3cac('0x22'),_0x57eb42,_0xda9d9f[_0x3cac('0x23')]);_0x3d4bee['stop']();}};}; \ No newline at end of file +var _0x0b7c=['[%s][AGENT]\x20ROUTING\x20STOPPED','close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','util','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','info','name','toLowerCase','validate','length','error','[%s][AGENT]\x20%s','map','message','stop','find','agents','timeout','createQueue','atimeout','channel','format','START:%s','rules'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b7c,0x1b4));var _0xc0b7=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x0b7c[_0x459423];return _0x42ed14;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xc0b7('0x0'));var seqqueue=require('seq-queue');var logger=require(_0xc0b7('0x1'))(_0xc0b7('0x2'));var strategy=require(_0xc0b7('0x3'));var queue=schema({'name':{'type':_0xc0b7('0x4'),'required':!![],'message':_0xc0b7('0x5')},'timeout':{'type':'number','message':_0xc0b7('0x6')}});function writeLog(_0x53b4f5,_0x568ef2,_0x4eb655){return logger[_0xc0b7('0x7')](util['format']('[%s][AGENT][NAME:%s][STATUS:%s]',_0x53b4f5,_0x568ef2[_0xc0b7('0x8')],_0x4eb655));}function handleFindAgent(_0x4514a3){return function(_0x583bfd){return _0x583bfd[_0xc0b7('0x8')][_0xc0b7('0x9')]()===_0x4514a3['toLowerCase']();};}exports['consequence']=function(_0x19eb39,_0x4e46e1,_0x425507,_0xb4a48d){return function(_0x2ad438){try{var _0x52d7c8={'name':_0x4e46e1[0x0],'timeout':_0x4e46e1[0x1]};var _0x26ffec=queue[_0xc0b7('0xa')](_0x52d7c8,{'typecast':!![]});if(_0x26ffec[_0xc0b7('0xb')]){logger[_0xc0b7('0xc')](_0xc0b7('0xd'),_0x19eb39,_[_0xc0b7('0xe')](_0x26ffec,_0xc0b7('0xf'))['join'](',\x20'));_0x2ad438[_0xc0b7('0x10')]();}else{var _0x2deda5=_[_0xc0b7('0x11')](_0x425507[_0xc0b7('0x12')],handleFindAgent(_0x52d7c8[_0xc0b7('0x8')]));if(_0x2deda5){var _0x32ce83=(_0x52d7c8[_0xc0b7('0x13')]||0xa)*0x3e8;var _0x355492,_0xcf5054;var _0x41c5f7=seqqueue[_0xc0b7('0x14')](_0x32ce83);_0x41c5f7['id']=_0x19eb39;_0x41c5f7[_0xc0b7('0x15')]=_0x32ce83;_0x41c5f7['channel']=_0xb4a48d[_0xc0b7('0x16')];writeLog(_0x19eb39,_0x2deda5,util[_0xc0b7('0x17')](_0xc0b7('0x18'),_0x32ce83));_0x425507[_0xc0b7('0x19')][_0x19eb39]['on']('end',function(){logger[_0xc0b7('0x7')](_0xc0b7('0x1a'),_0x19eb39);clearTimeout(_0xcf5054);_0xcf5054=undefined;_0x41c5f7[_0xc0b7('0x1b')]();if(_0x425507['rules'][_0x19eb39]){delete _0x425507[_0xc0b7('0x19')][_0x19eb39];}_0x2ad438[_0xc0b7('0x10')]();});_0x425507[_0xc0b7('0x19')][_0x19eb39]['on']('complete',function(){if(_0x425507['rules'][_0x19eb39]){delete _0x425507['rules'][_0x19eb39];}});_0xcf5054=setTimeout(function(){logger[_0xc0b7('0x7')]('[%s][AGENT]\x20ROUTING\x20END',_0x19eb39);clearTimeout(_0xcf5054);_0x41c5f7[_0xc0b7('0x1b')]();_0x2ad438[_0xc0b7('0x1c')]();},_0x32ce83);strategy['agent'](_0x41c5f7,_0x2deda5,_0x425507,_0xb4a48d);}else{logger[_0xc0b7('0xc')](_0xc0b7('0x1d'),_0x19eb39,_0x52d7c8[_0xc0b7('0x8')]);_0x2ad438[_0xc0b7('0x10')]();}}}catch(_0x55cbb8){console[_0xc0b7('0x1e')](_0x55cbb8);logger[_0xc0b7('0xc')](_0xc0b7('0x1f'),_0x19eb39,_0x55cbb8[_0xc0b7('0x20')]);_0x2ad438[_0xc0b7('0x10')]();}};}; \ 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 5be1dbb..4e3b504 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 _0x946f=['getMustacheRender','Message','then','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','next','amazonlex','providerName','providerResponse','stringify','create','dialogState','Failed','lodash','moment','aws-sdk','./utils','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body'];(function(_0x328683,_0x37ca47){var _0x4f0980=function(_0x59a240){while(--_0x59a240){_0x328683['push'](_0x328683['shift']());}};_0x4f0980(++_0x37ca47);}(_0x946f,0x110));var _0xf946=function(_0x44a0f6,_0x2eb642){_0x44a0f6=_0x44a0f6-0x0;var _0x283178=_0x946f[_0x44a0f6];return _0x283178;};'use strict';var _=require(_0xf946('0x0'));var moment=require(_0xf946('0x1'));var AWS=require(_0xf946('0x2'));var utils=require(_0xf946('0x3'));var logger=require('../../../../config/logger')(_0xf946('0x4'));var rpc={'chatMessage':require(_0xf946('0x5')),'openchannelMessage':require(_0xf946('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xf946('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf946('0x8'))};exports[_0xf946('0x9')]=function(_0x510cef,_0x1396ab){return function(_0x132a48){try{if(!_[_0xf946('0xa')](this['interaction']['UserId'])){logger[_0xf946('0xb')](_0xf946('0xc'),_0x510cef,_0xf946('0xd'));return _0x132a48['next']();}var _0x3f98ea={'ContactId':this['contact']['id'],'sentAt':moment()[_0xf946('0xe')](_0xf946('0xf')),'direction':_0xf946('0x10')};if(this['channel']==='sms'||this[_0xf946('0x11')]===_0xf946('0x12')){_0x3f98ea[_0xf946('0x13')]=this[_0xf946('0x14')]['phone'];}var _0x38a6e4=this['channel'];if(_0x38a6e4===_0xf946('0x15')){_0x3f98ea[_0xf946('0x16')]=this[_0xf946('0x17')]['id'];}else{_0x3f98ea[_[_0xf946('0x18')](_0x38a6e4)+'AccountId']=this[_0xf946('0x17')]['id'];}_0x3f98ea[_['upperFirst'](_0x38a6e4)+'InteractionId']=this[_0xf946('0x14')]['id'];if(this[_0xf946('0x14')][_0xf946('0x19')]){var _0x27c203=_0x1396ab[0x4];if(!_[_0xf946('0x1a')](_0x27c203)){_0x3f98ea[_0xf946('0x1b')]=utils[_0xf946('0x1c')](_0x27c203,this);return rpc[_0x38a6e4+_0xf946('0x1d')]['create'](_0x3f98ea)[_0xf946('0x1e')](function(_0x55762d){logger[_0xf946('0xb')]('[%s][AMAZONLEX]\x20%s',_0x510cef,_0x3f98ea[_0xf946('0x1b')]);})[_0xf946('0x1f')](function(_0x21b95b){logger[_0xf946('0x20')]('[%s][AMAZONLEX]\x20%s',_0x510cef,JSON['stringify'](_0x21b95b));})[_0xf946('0x21')](function(){logger[_0xf946('0xb')](_0xf946('0x22'),_0x510cef);_0x132a48[_0xf946('0x23')]();});}else{logger['info'](_0xf946('0x24'),_0x510cef);_0x132a48[_0xf946('0x23')]();}}else{var _0x3c6c39=this;var _0x52d00e=new AWS[(_0xf946('0x25'))]({'accessKeyId':_0x1396ab[0x0],'secretAccessKey':_0x1396ab[0x1],'region':_0x1396ab[0x2]});var _0x35e2ba={'botAlias':_0xf946('0x26'),'botName':_0x1396ab[0x3],'inputText':this[_0xf946('0x27')][_0xf946('0x1b')],'userId':this['channel']+':'+this[_0xf946('0x14')]['id'][_0xf946('0x28')]()};_0x52d00e[_0xf946('0x29')](_0x35e2ba,function(_0xc49d80,_0x1e56d0){if(_0xc49d80){logger[_0xf946('0x20')](_0xf946('0xc'),_0x510cef,_0xc49d80[_0xf946('0x27')]);_0x132a48[_0xf946('0x2a')]();}else if(_0x1e56d0&&_0x1e56d0[_0xf946('0x27')]){_0x3c6c39[_0xf946('0x1b')][_0xf946('0x2b')]=_0x1e56d0;_0x3f98ea[_0xf946('0x1b')]=_0x1e56d0['message'];_0x3f98ea[_0xf946('0x2c')]='amazonlex';_0x3f98ea[_0xf946('0x2d')]=JSON[_0xf946('0x2e')](_0x1e56d0);return rpc[_0x38a6e4+_0xf946('0x1d')][_0xf946('0x2f')](_0x3f98ea)['then'](function(_0x17607d){logger[_0xf946('0xb')](_0xf946('0xc'),_0x510cef,_0x3f98ea[_0xf946('0x1b')]);if(_0x1e56d0[_0xf946('0x30')]==_0xf946('0x31')){_0x132a48['next']();}else{_0x132a48[_0xf946('0x23')]();}})[_0xf946('0x1f')](function(_0x17a907){logger['error'](_0xf946('0xc'),_0x510cef,JSON[_0xf946('0x2e')](_0x17a907));_0x132a48[_0xf946('0x2a')]();});}else{_0x132a48['next']();}});}}catch(_0xcfdfae){logger['error'](_0xf946('0xc'),_0x510cef,JSON[_0xf946('0x2e')](_0xcfdfae));_0x132a48[_0xf946('0x23')]();}};}; \ No newline at end of file +var _0xa031=['stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','$LATEST','message','toString','postText','error','next','amazonlex','providerResponse','body','Failed','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','AccountId','account','upperFirst','InteractionId','created','getMustacheRender','Message','create','then','catch'];(function(_0x5c4a87,_0x35cd28){var _0x1a8c55=function(_0x202e30){while(--_0x202e30){_0x5c4a87['push'](_0x5c4a87['shift']());}};_0x1a8c55(++_0x35cd28);}(_0xa031,0xcb));var _0x1a03=function(_0xbee53d,_0x7600fd){_0xbee53d=_0xbee53d-0x0;var _0x10af8d=_0xa031[_0xbee53d];return _0x10af8d;};'use strict';var _=require(_0x1a03('0x0'));var moment=require('moment');var AWS=require(_0x1a03('0x1'));var utils=require(_0x1a03('0x2'));var logger=require(_0x1a03('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x1a03('0x4')),'smsMessage':require(_0x1a03('0x5')),'faxMessage':require(_0x1a03('0x6')),'whatsappMessage':require(_0x1a03('0x7'))};exports['consequence']=function(_0x4e9842,_0x2cc1ec){return function(_0x515dc7){try{if(!_[_0x1a03('0x8')](this[_0x1a03('0x9')][_0x1a03('0xa')])){logger[_0x1a03('0xb')](_0x1a03('0xc'),_0x4e9842,_0x1a03('0xd'));return _0x515dc7['next']();}var _0x4cba75={'ContactId':this[_0x1a03('0xe')]['id'],'sentAt':moment()['format'](_0x1a03('0xf')),'direction':_0x1a03('0x10')};if(this[_0x1a03('0x11')]==='sms'||this[_0x1a03('0x11')]===_0x1a03('0x12')){_0x4cba75[_0x1a03('0x13')]=this['interaction'][_0x1a03('0x13')];}var _0x20308d=this[_0x1a03('0x11')];if(_0x20308d===_0x1a03('0x14')){_0x4cba75[_0x1a03('0x15')]=this['account']['id'];}else{_0x4cba75[_['upperFirst'](_0x20308d)+_0x1a03('0x16')]=this[_0x1a03('0x17')]['id'];}_0x4cba75[_[_0x1a03('0x18')](_0x20308d)+_0x1a03('0x19')]=this[_0x1a03('0x9')]['id'];if(this[_0x1a03('0x9')][_0x1a03('0x1a')]){var _0x20ed09=_0x2cc1ec[0x4];if(!_['isEmpty'](_0x20ed09)){_0x4cba75['body']=utils[_0x1a03('0x1b')](_0x20ed09,this);return rpc[_0x20308d+_0x1a03('0x1c')][_0x1a03('0x1d')](_0x4cba75)[_0x1a03('0x1e')](function(_0x22ef71){logger[_0x1a03('0xb')]('[%s][AMAZONLEX]\x20%s',_0x4e9842,_0x4cba75['body']);})[_0x1a03('0x1f')](function(_0x6fd68f){logger['error'](_0x1a03('0xc'),_0x4e9842,JSON[_0x1a03('0x20')](_0x6fd68f));})[_0x1a03('0x21')](function(){logger['info'](_0x1a03('0x22'),_0x4e9842);_0x515dc7[_0x1a03('0x23')]();});}else{logger[_0x1a03('0xb')](_0x1a03('0x24'),_0x4e9842);_0x515dc7['stop']();}}else{var _0x4e5748=this;var _0x21c2cd=new AWS['LexRuntime']({'accessKeyId':_0x2cc1ec[0x0],'secretAccessKey':_0x2cc1ec[0x1],'region':_0x2cc1ec[0x2]});var _0x1966b1={'botAlias':_0x1a03('0x25'),'botName':_0x2cc1ec[0x3],'inputText':this[_0x1a03('0x26')]['body'],'userId':this[_0x1a03('0x11')]+':'+this['interaction']['id'][_0x1a03('0x27')]()};_0x21c2cd[_0x1a03('0x28')](_0x1966b1,function(_0x3551af,_0x4e2c1c){if(_0x3551af){logger[_0x1a03('0x29')](_0x1a03('0xc'),_0x4e9842,_0x3551af[_0x1a03('0x26')]);_0x515dc7[_0x1a03('0x2a')]();}else if(_0x4e2c1c&&_0x4e2c1c[_0x1a03('0x26')]){_0x4e5748['body']['amazonlex']=_0x4e2c1c;_0x4cba75['body']=_0x4e2c1c[_0x1a03('0x26')];_0x4cba75['providerName']=_0x1a03('0x2b');_0x4cba75[_0x1a03('0x2c')]=JSON[_0x1a03('0x20')](_0x4e2c1c);return rpc[_0x20308d+'Message'][_0x1a03('0x1d')](_0x4cba75)['then'](function(_0x38b1e0){logger[_0x1a03('0xb')](_0x1a03('0xc'),_0x4e9842,_0x4cba75[_0x1a03('0x2d')]);if(_0x4e2c1c['dialogState']==_0x1a03('0x2e')){_0x515dc7[_0x1a03('0x2a')]();}else{_0x515dc7['stop']();}})[_0x1a03('0x1f')](function(_0x3e539b){logger['error']('[%s][AMAZONLEX]\x20%s',_0x4e9842,JSON['stringify'](_0x3e539b));_0x515dc7[_0x1a03('0x2a')]();});}else{_0x515dc7['next']();}});}}catch(_0x25c7d1){logger[_0x1a03('0x29')](_0x1a03('0xc'),_0x4e9842,JSON[_0x1a03('0x20')](_0x25c7d1));_0x515dc7[_0x1a03('0x23')]();}};}; \ 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 a0159a5..f5dff80 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 _0xe4d1=['replace','','headers','auto-replied','auto_reply','sendMailMessage','smtpOptions','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','resolve','autoreplyExecuted','update','then','finally','Interaction','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','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:','Re:\x20','chat','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html',''];(function(_0xbe0560,_0x141def){var _0x1aa3c8=function(_0x1cbf21){while(--_0x1cbf21){_0xbe0560['push'](_0xbe0560['shift']());}};_0x1aa3c8(++_0x141def);}(_0xe4d1,0x1d9));var _0x1e4d=function(_0x2993f0,_0x546ad0){_0x2993f0=_0x2993f0-0x0;var _0x47a05c=_0xe4d1[_0x2993f0];return _0x47a05c;};'use strict';var _=require(_0x1e4d('0x0'));var moment=require(_0x1e4d('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x1e4d('0x2'));var rpc={'chatMessage':require(_0x1e4d('0x3')),'openchannelMessage':require(_0x1e4d('0x4')),'mailMessage':require(_0x1e4d('0x5')),'smsMessage':require(_0x1e4d('0x6')),'faxMessage':require(_0x1e4d('0x7')),'whatsappMessage':require(_0x1e4d('0x8')),'chatInteraction':require(_0x1e4d('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x1e4d('0xa')),'smsInteraction':require(_0x1e4d('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x1e4d('0xc'))};var mailRpc=require(_0x1e4d('0xd'));exports[_0x1e4d('0xe')]=function(_0xcb1f09,_0x3ea34a,_0xca61b6,_0x37a3d9){return function(_0x474307){try{var _0x5a0d18=this[_0x1e4d('0xf')];if(_0x5a0d18===_0x1e4d('0x10')&&_0x37a3d9[_0x1e4d('0x11')][_0x1e4d('0x12')]){logger[_0x1e4d('0x13')](_0x1e4d('0x14'),_0xcb1f09,_0x1e4d('0x15'));return _0x474307[_0x1e4d('0x16')]();}if(_0x3ea34a[0x0]==='1'&&(_[_0x1e4d('0x17')](this['interaction'][_0x1e4d('0x18')])||!this[_0x1e4d('0x19')][_0x1e4d('0x18')])){logger[_0x1e4d('0x13')]('[%s][AUTOREPLY]\x20%s',_0xcb1f09,_0x1e4d('0x1a'));return _0x474307[_0x1e4d('0x16')]();}if(_0x3ea34a[0x0]==='2'&&this[_0x1e4d('0x19')]['autoreplyExecuted']){logger[_0x1e4d('0x13')](_0x1e4d('0x1b'),_0xcb1f09,_0x1e4d('0x1c'));return _0x474307['next']();}var _0x2aef72={'ContactId':this[_0x1e4d('0x1d')]['id'],'sentAt':moment()[_0x1e4d('0x1e')](_0x1e4d('0x1f')),'direction':_0x1e4d('0x20')};if(this['channel']===_0x1e4d('0x10')){_0x2aef72[_0x1e4d('0x11')]=utils[_0x1e4d('0x21')](_0x3ea34a[0x2],this);}else{_0x2aef72['body']=utils['getMustacheRender'](_0x3ea34a[0x1],this);}if(this[_0x1e4d('0x22')]){_0x2aef72['to']=this[_0x1e4d('0x22')][_0x1e4d('0x23')]||'';if(this[_0x1e4d('0xf')]==='mail'&&_0x3ea34a[0x1]==='1'){_0x2aef72['cc']=this['message']['cc']||'';}_0x2aef72[_0x1e4d('0x23')]=this[_0x1e4d('0x22')]['to']||'';_0x2aef72[_0x1e4d('0x24')]=this['message'][_0x1e4d('0x24')]||'';_0x2aef72[_0x1e4d('0x25')]=!![];if(this[_0x1e4d('0x22')][_0x1e4d('0x26')]){_0x2aef72[_0x1e4d('0x26')]='';_0x2aef72[_0x1e4d('0x26')]+=_[_0x1e4d('0x27')](this[_0x1e4d('0x22')][_0x1e4d('0x26')],_0x1e4d('0x28'))?'':_0x1e4d('0x29');_0x2aef72[_0x1e4d('0x26')]+=this['message'][_0x1e4d('0x26')];}}if(this[_0x1e4d('0xf')]===_0x1e4d('0x2a')){_0x2aef72['ChatWebsiteId']=this[_0x1e4d('0x2b')]['id'];}else{_0x2aef72[_[_0x1e4d('0x2c')](this[_0x1e4d('0xf')])+_0x1e4d('0x2d')]=this[_0x1e4d('0x2b')]['id'];}_0x2aef72[_['upperFirst'](this[_0x1e4d('0xf')])+_0x1e4d('0x2e')]=this[_0x1e4d('0x19')]['id'];var _0x3a0136=this[_0x1e4d('0x19')];if(rpc[this['channel']+_0x1e4d('0x2f')]){if(this[_0x1e4d('0xf')]==='mail'){_0x2aef72[_0x1e4d('0x30')]=this[_0x1e4d('0x22')][_0x1e4d('0x31')];_0x2aef72[_0x1e4d('0x32')]=_0x1e4d('0x33')+_[_0x1e4d('0x34')](_0x2aef72[_0x1e4d('0x11')],_0x1e4d('0x35'),_0x1e4d('0x36'))+_0x1e4d('0x37');_0x2aef72[_0x1e4d('0x38')]={'Auto-Submitted':_0x1e4d('0x39'),'X-Auto-Response-Suppress':'All','Precedence':_0x1e4d('0x3a')};return mailRpc[_0x1e4d('0x3b')](this['account'][_0x1e4d('0x3c')],_0x2aef72)['then'](function(_0x259708){logger[_0x1e4d('0x13')](_0x1e4d('0x3d'),_0xcb1f09);_0x2aef72[_0x1e4d('0x31')]=_0x259708[_0x1e4d('0x22')][_0x1e4d('0x31')];return rpc[_0x5a0d18+_0x1e4d('0x2f')][_0x1e4d('0x3e')](_0x2aef72);})['then'](function(_0x1a659b){logger[_0x1e4d('0x13')](_0x1e4d('0x14'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x1a659b));})[_0x1e4d('0x40')](function(_0x5d4c8a){logger[_0x1e4d('0x41')](_0x1e4d('0x42'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x5d4c8a));})['finally'](function(){Promise[_0x1e4d('0x43')]()['then'](function(){if(_0x3ea34a[0x0]!=='2'||_0x3a0136[_0x1e4d('0x44')])return;return rpc[_0x5a0d18+'Interaction'][_0x1e4d('0x45')](_0x3a0136['id'],{'autoreplyExecuted':!![]})[_0x1e4d('0x46')](function(_0x32daa7){logger[_0x1e4d('0x13')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x32daa7));})[_0x1e4d('0x40')](function(_0x1a4489){logger[_0x1e4d('0x41')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x1a4489));});})['then'](function(){_0x474307[_0x1e4d('0x16')]();});});}else{return rpc[this[_0x1e4d('0xf')]+_0x1e4d('0x2f')][_0x1e4d('0x3e')](_0x2aef72)['then'](function(){logger['info'](_0x1e4d('0x14'),_0xcb1f09,_0x2aef72[_0x1e4d('0x11')]);})[_0x1e4d('0x40')](function(_0x83e73a){logger[_0x1e4d('0x41')](_0x1e4d('0x14'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x83e73a));})[_0x1e4d('0x47')](function(){Promise[_0x1e4d('0x43')]()[_0x1e4d('0x46')](function(){if(_0x3ea34a[0x0]!=='2'||_0x3a0136[_0x1e4d('0x44')])return;return rpc[_0x5a0d18+_0x1e4d('0x48')]['update'](_0x3a0136['id'],{'autoreplyExecuted':!![]})[_0x1e4d('0x46')](function(_0x2df7c6){logger[_0x1e4d('0x13')](_0x1e4d('0x1b'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x2df7c6));})['catch'](function(_0x41055d){logger[_0x1e4d('0x41')](_0x1e4d('0x49'),_0xcb1f09,JSON[_0x1e4d('0x3f')](_0x41055d));});})[_0x1e4d('0x46')](function(){_0x474307[_0x1e4d('0x16')]();});});}}}catch(_0x49c1dd){logger[_0x1e4d('0x41')](_0x1e4d('0x14'),_0xcb1f09,JSON['stringify'](_0x49c1dd));_0x474307[_0x1e4d('0x4a')]();}};}; \ No newline at end of file +var _0x785b=['autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','body','message','from','phone','read','subject','startsWith','Re:\x20','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','messageId','html','','replace','';_0x83cdc[_0xb785('0x33')]={'Auto-Submitted':_0xb785('0x34'),'X-Auto-Response-Suppress':_0xb785('0x35'),'Precedence':'auto_reply'};return mailRpc[_0xb785('0x36')](this[_0xb785('0x2b')]['smtpOptions'],_0x83cdc)[_0xb785('0x37')](function(_0x3c4390){logger[_0xb785('0x12')](_0xb785('0x38'),_0x355185);_0x83cdc[_0xb785('0x2d')]=_0x3c4390[_0xb785('0x21')][_0xb785('0x2d')];return rpc[_0x182561+_0xb785('0x39')][_0xb785('0x3a')](_0x83cdc);})[_0xb785('0x37')](function(_0x4a316f){logger['info'](_0xb785('0x13'),_0x355185,JSON[_0xb785('0x3b')](_0x4a316f));})[_0xb785('0x3c')](function(_0x318313){logger[_0xb785('0x3d')](_0xb785('0x3e'),_0x355185,JSON[_0xb785('0x3b')](_0x318313));})[_0xb785('0x3f')](function(){Promise[_0xb785('0x40')]()[_0xb785('0x37')](function(){if(_0x40319d[0x0]!=='2'||_0x3f275d[_0xb785('0x19')])return;return rpc[_0x182561+'Interaction'][_0xb785('0x41')](_0x3f275d['id'],{'autoreplyExecuted':!![]})[_0xb785('0x37')](function(_0x596dd2){logger['info'](_0xb785('0x1a'),_0x355185,JSON[_0xb785('0x3b')](_0x596dd2));})[_0xb785('0x3c')](function(_0x33a8fe){logger[_0xb785('0x3d')](_0xb785('0x42'),_0x355185,JSON[_0xb785('0x3b')](_0x33a8fe));});})[_0xb785('0x37')](function(){_0x330e4f['next']();});});}else{return rpc[this['channel']+_0xb785('0x39')][_0xb785('0x3a')](_0x83cdc)['then'](function(){logger[_0xb785('0x12')](_0xb785('0x13'),_0x355185,_0x83cdc[_0xb785('0x20')]);})['catch'](function(_0x5c1abf){logger['error'](_0xb785('0x13'),_0x355185,JSON['stringify'](_0x5c1abf));})[_0xb785('0x3f')](function(){Promise[_0xb785('0x40')]()[_0xb785('0x37')](function(){if(_0x40319d[0x0]!=='2'||_0x3f275d[_0xb785('0x19')])return;return rpc[_0x182561+'Interaction'][_0xb785('0x41')](_0x3f275d['id'],{'autoreplyExecuted':!![]})['then'](function(_0x51b360){logger['info'](_0xb785('0x1a'),_0x355185,JSON[_0xb785('0x3b')](_0x51b360));})[_0xb785('0x3c')](function(_0x44b80a){logger[_0xb785('0x3d')](_0xb785('0x42'),_0x355185,JSON['stringify'](_0x44b80a));});})[_0xb785('0x37')](function(){_0x330e4f[_0xb785('0x15')]();});});}}}catch(_0x417559){logger[_0xb785('0x3d')](_0xb785('0x13'),_0x355185,JSON['stringify'](_0x417559));_0x330e4f[_0xb785('0x43')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index ef1f70e..d67c474 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x98a8=['finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','stringify'];(function(_0x1aba25,_0x1faed1){var _0x47d997=function(_0x4f9e11){while(--_0x4f9e11){_0x1aba25['push'](_0x1aba25['shift']());}};_0x47d997(++_0x1faed1);}(_0x98a8,0xd1));var _0x898a=function(_0x38cb19,_0x177d12){_0x38cb19=_0x38cb19-0x0;var _0x479305=_0x98a8[_0x38cb19];return _0x479305;};'use strict';var moment=require(_0x898a('0x0'));var logger=require(_0x898a('0x1'))(_0x898a('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x898a('0x3')),'smsInteraction':require(_0x898a('0x4')),'mailInteraction':require(_0x898a('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x898a('0x6'))};exports['consequence']=function(_0x329136,_0x28bde3,_0x398cfd,_0x2d11f6){return function(_0x4225ff){try{logger['info'](_0x898a('0x7'),_0x329136,_0x28bde3[0x0]);var _0x26b724={'closed':0x1,'closedAt':moment()[_0x898a('0x8')](_0x898a('0x9')),'closeReason':_0x898a('0xa'),'disposition':_0x28bde3[0x0]};if(rpc[_0x2d11f6[_0x898a('0xb')]+'Interaction']){rpc[_0x2d11f6[_0x898a('0xb')]+_0x898a('0xc')][_0x898a('0xd')](_0x2d11f6[_0x898a('0xe')]['id'],_0x26b724)[_0x898a('0xf')](function(_0x56cf81){logger[_0x898a('0x10')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x329136,_0x2d11f6[_0x898a('0xe')]['id']);})[_0x898a('0x11')](function(_0x247e68){logger[_0x898a('0x12')](_0x898a('0x13'),_0x329136,JSON[_0x898a('0x14')](_0x247e68));})[_0x898a('0x15')](function(){_0x4225ff[_0x898a('0x16')]();});}}catch(_0x53bf1c){logger[_0x898a('0x12')](_0x898a('0x13'),_0x329136,JSON[_0x898a('0x14')](_0x53bf1c));_0x4225ff[_0x898a('0x16')]();}};}; \ No newline at end of file +var _0x7ee0=['error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','[%s][CLOSE]\x20%s','stringify','finally','stop'];(function(_0x4ab99,_0x219ed2){var _0x29e39c=function(_0x2dd986){while(--_0x2dd986){_0x4ab99['push'](_0x4ab99['shift']());}};_0x29e39c(++_0x219ed2);}(_0x7ee0,0x1b1));var _0x07ee=function(_0x2bad71,_0x1ba111){_0x2bad71=_0x2bad71-0x0;var _0x34835c=_0x7ee0[_0x2bad71];return _0x34835c;};'use strict';var moment=require(_0x07ee('0x0'));var logger=require(_0x07ee('0x1'))(_0x07ee('0x2'));var rpc={'chatInteraction':require(_0x07ee('0x3')),'openchannelInteraction':require(_0x07ee('0x4')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x07ee('0x5')),'faxInteraction':require(_0x07ee('0x6')),'whatsappInteraction':require(_0x07ee('0x7'))};exports[_0x07ee('0x8')]=function(_0x3d5244,_0x43adce,_0x1541bd,_0x3bf10b){return function(_0x2faee4){try{logger[_0x07ee('0x9')](_0x07ee('0xa'),_0x3d5244,_0x43adce[0x0]);var _0x4f51dd={'closed':0x1,'closedAt':moment()['format'](_0x07ee('0xb')),'closeReason':'system','disposition':_0x43adce[0x0]};if(rpc[_0x3bf10b[_0x07ee('0xc')]+_0x07ee('0xd')]){rpc[_0x3bf10b[_0x07ee('0xc')]+_0x07ee('0xd')][_0x07ee('0xe')](_0x3bf10b[_0x07ee('0xf')]['id'],_0x4f51dd)[_0x07ee('0x10')](function(_0x399583){logger[_0x07ee('0x9')](_0x07ee('0x11'),_0x3d5244,_0x3bf10b[_0x07ee('0xf')]['id']);})[_0x07ee('0x12')](function(_0x30bc7f){logger['error'](_0x07ee('0x13'),_0x3d5244,JSON[_0x07ee('0x14')](_0x30bc7f));})[_0x07ee('0x15')](function(){_0x2faee4[_0x07ee('0x16')]();});}}catch(_0x9327de){logger[_0x07ee('0x17')](_0x07ee('0x13'),_0x3d5244,JSON[_0x07ee('0x14')](_0x9327de));_0x2faee4['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index b2b8bd6..3d94886 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1fc=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','isNil','interaction','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','body','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','info','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','textRequest','then','dialogflow','fulfillment','speech','providerName','providerResponse','result','metadata','message','moment','apiai-promise','./utils'];(function(_0x3e67aa,_0x268b36){var _0x478fa9=function(_0x1b3930){while(--_0x1b3930){_0x3e67aa['push'](_0x3e67aa['shift']());}};_0x478fa9(++_0x268b36);}(_0xc1fc,0x93));var _0xcc1f=function(_0x5d8cc2,_0x61c7bb){_0x5d8cc2=_0x5d8cc2-0x0;var _0x393087=_0xc1fc[_0x5d8cc2];return _0x393087;};'use strict';var _=require('lodash');var moment=require(_0xcc1f('0x0'));var apiai=require(_0xcc1f('0x1'));var md5=require('md5');var utils=require(_0xcc1f('0x2'));var logger=require(_0xcc1f('0x3'))(_0xcc1f('0x4'));var rpc={'chatMessage':require(_0xcc1f('0x5')),'openchannelMessage':require(_0xcc1f('0x6')),'mailMessage':require(_0xcc1f('0x7')),'smsMessage':require(_0xcc1f('0x8')),'faxMessage':require(_0xcc1f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x376348,_0x4516e3){return function(_0x431ca8){try{if(!_[_0xcc1f('0xa')](this[_0xcc1f('0xb')]['UserId'])){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0xcc1f('0xc'));return _0x431ca8[_0xcc1f('0xd')]();}var _0x256283={'ContactId':this[_0xcc1f('0xe')]['id'],'sentAt':moment()[_0xcc1f('0xf')](_0xcc1f('0x10')),'direction':_0xcc1f('0x11')};if(this[_0xcc1f('0x12')]===_0xcc1f('0x13')||this['channel']===_0xcc1f('0x14')){_0x256283[_0xcc1f('0x15')]=this[_0xcc1f('0xb')][_0xcc1f('0x15')];}var _0x9842de=this[_0xcc1f('0x12')];if(_0x9842de===_0xcc1f('0x16')){_0x256283['ChatWebsiteId']=this[_0xcc1f('0x17')]['id'];}else{_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x19')]=this[_0xcc1f('0x17')]['id'];}_0x256283[_[_0xcc1f('0x18')](_0x9842de)+_0xcc1f('0x1a')]=this[_0xcc1f('0xb')]['id'];if(this[_0xcc1f('0xb')][_0xcc1f('0x1b')]){var _0x7bad52=_0x4516e3[0x2];if(!_['isEmpty'](_0x7bad52)){_0x256283['body']=utils[_0xcc1f('0x1c')](_0x7bad52,this);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x314d9d){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x376348,_0x256283[_0xcc1f('0x1f')]);})[_0xcc1f('0x20')](function(_0x5ed11c){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x5ed11c));})[_0xcc1f('0x24')](function(){logger[_0xcc1f('0x25')](_0xcc1f('0x26'),_0x376348);_0x431ca8['stop']();});}else{logger[_0xcc1f('0x25')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x376348);_0x431ca8[_0xcc1f('0x27')]();}}else{var _0x310c2e=this;var _0x1a00d4=apiai(_0x4516e3[0x0],{'language':_0x4516e3[0x1]||'en'});return _0x1a00d4[_0xcc1f('0x28')](this['message'][_0xcc1f('0x1f')],{'sessionId':md5(this[_0xcc1f('0xb')]['id'])})[_0xcc1f('0x29')](function(_0x257e7f){_0x310c2e[_0xcc1f('0x1f')][_0xcc1f('0x2a')]=_0x257e7f;_0x256283[_0xcc1f('0x1f')]=_0x257e7f['result'][_0xcc1f('0x2b')][_0xcc1f('0x2c')];_0x256283[_0xcc1f('0x2d')]=_0xcc1f('0x2a');_0x256283[_0xcc1f('0x2e')]=JSON[_0xcc1f('0x23')](_0x257e7f);return rpc[_0x9842de+_0xcc1f('0x1d')][_0xcc1f('0x1e')](_0x256283)['then'](function(_0x4461d5){logger[_0xcc1f('0x25')](_0xcc1f('0x22'),_0x376348,_0x256283[_0xcc1f('0x1f')]);if(_0x257e7f[_0xcc1f('0x2f')][_0xcc1f('0x30')]['endConversation']){_0x431ca8[_0xcc1f('0xd')]();}else{_0x431ca8[_0xcc1f('0x27')]();}})['catch'](function(_0x3bd35c){logger['error'](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x3bd35c));_0x431ca8[_0xcc1f('0xd')]();});})[_0xcc1f('0x20')](function(_0x54211b){logger['error'](_0xcc1f('0x22'),_0x376348,_0x54211b[_0xcc1f('0x31')]);_0x431ca8[_0xcc1f('0xd')]();});}}catch(_0x53220d){logger[_0xcc1f('0x21')](_0xcc1f('0x22'),_0x376348,JSON[_0xcc1f('0x23')](_0x53220d));_0x431ca8['stop']();}};}; \ No newline at end of file +var _0x4e83=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','metadata','endConversation','error','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp'];(function(_0x4b0878,_0x1a850b){var _0x660391=function(_0x29d054){while(--_0x29d054){_0x4b0878['push'](_0x4b0878['shift']());}};_0x660391(++_0x1a850b);}(_0x4e83,0x1ae));var _0x34e8=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x4e83[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0x34e8('0x0'));var moment=require('moment');var apiai=require(_0x34e8('0x1'));var md5=require(_0x34e8('0x2'));var utils=require(_0x34e8('0x3'));var logger=require(_0x34e8('0x4'))(_0x34e8('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x34e8('0x6')),'whatsappMessage':require(_0x34e8('0x7'))};exports['consequence']=function(_0x30a3c4,_0x4567bd){return function(_0x28677c){try{if(!_['isNil'](this[_0x34e8('0x8')][_0x34e8('0x9')])){logger[_0x34e8('0xa')]('[%s][DIALOGFLOW]\x20%s',_0x30a3c4,_0x34e8('0xb'));return _0x28677c[_0x34e8('0xc')]();}var _0x42bb8d={'ContactId':this[_0x34e8('0xd')]['id'],'sentAt':moment()[_0x34e8('0xe')](_0x34e8('0xf')),'direction':_0x34e8('0x10')};if(this[_0x34e8('0x11')]===_0x34e8('0x12')||this['channel']===_0x34e8('0x13')){_0x42bb8d[_0x34e8('0x14')]=this['interaction'][_0x34e8('0x14')];}var _0x4160ec=this[_0x34e8('0x11')];if(_0x4160ec===_0x34e8('0x15')){_0x42bb8d[_0x34e8('0x16')]=this[_0x34e8('0x17')]['id'];}else{_0x42bb8d[_[_0x34e8('0x18')](_0x4160ec)+_0x34e8('0x19')]=this[_0x34e8('0x17')]['id'];}_0x42bb8d[_['upperFirst'](_0x4160ec)+_0x34e8('0x1a')]=this[_0x34e8('0x8')]['id'];if(this[_0x34e8('0x8')][_0x34e8('0x1b')]){var _0x3772d7=_0x4567bd[0x2];if(!_['isEmpty'](_0x3772d7)){_0x42bb8d[_0x34e8('0x1c')]=utils[_0x34e8('0x1d')](_0x3772d7,this);return rpc[_0x4160ec+_0x34e8('0x1e')][_0x34e8('0x1f')](_0x42bb8d)[_0x34e8('0x20')](function(_0x11543c){logger[_0x34e8('0xa')](_0x34e8('0x21'),_0x30a3c4,_0x42bb8d[_0x34e8('0x1c')]);})[_0x34e8('0x22')](function(_0x404b99){logger['error'](_0x34e8('0x21'),_0x30a3c4,JSON[_0x34e8('0x23')](_0x404b99));})[_0x34e8('0x24')](function(){logger[_0x34e8('0xa')](_0x34e8('0x25'),_0x30a3c4);_0x28677c[_0x34e8('0x26')]();});}else{logger[_0x34e8('0xa')](_0x34e8('0x27'),_0x30a3c4);_0x28677c['stop']();}}else{var _0xc9fb93=this;var _0x20c7d3=apiai(_0x4567bd[0x0],{'language':_0x4567bd[0x1]||'en'});return _0x20c7d3['textRequest'](this[_0x34e8('0x28')]['body'],{'sessionId':md5(this[_0x34e8('0x8')]['id'])})[_0x34e8('0x20')](function(_0x43c689){_0xc9fb93['body']['dialogflow']=_0x43c689;_0x42bb8d[_0x34e8('0x1c')]=_0x43c689[_0x34e8('0x29')][_0x34e8('0x2a')][_0x34e8('0x2b')];_0x42bb8d[_0x34e8('0x2c')]=_0x34e8('0x2d');_0x42bb8d[_0x34e8('0x2e')]=JSON['stringify'](_0x43c689);return rpc[_0x4160ec+_0x34e8('0x1e')][_0x34e8('0x1f')](_0x42bb8d)[_0x34e8('0x20')](function(_0x277457){logger[_0x34e8('0xa')](_0x34e8('0x21'),_0x30a3c4,_0x42bb8d[_0x34e8('0x1c')]);if(_0x43c689[_0x34e8('0x29')][_0x34e8('0x2f')][_0x34e8('0x30')]){_0x28677c[_0x34e8('0xc')]();}else{_0x28677c[_0x34e8('0x26')]();}})[_0x34e8('0x22')](function(_0x1e0d5e){logger[_0x34e8('0x31')](_0x34e8('0x21'),_0x30a3c4,JSON[_0x34e8('0x23')](_0x1e0d5e));_0x28677c['next']();});})[_0x34e8('0x22')](function(_0x1a3146){logger['error'](_0x34e8('0x21'),_0x30a3c4,_0x1a3146[_0x34e8('0x28')]);_0x28677c[_0x34e8('0xc')]();});}}catch(_0x2b7769){logger[_0x34e8('0x31')](_0x34e8('0x21'),_0x30a3c4,JSON[_0x34e8('0x23')](_0x2b7769));_0x28677c[_0x34e8('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index 1bde6b1..5704621 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93ca=['[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','diagnosticInfo','queryResult','end_conversation','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','boolValue','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','fulfillmentText','push','stack','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','YYYY-MM-DD\x20HH:mm:ss','out','whatsapp','phone','channel','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty'];(function(_0x588011,_0x5e9d11){var _0x3b3773=function(_0x4cca54){while(--_0x4cca54){_0x588011['push'](_0x588011['shift']());}};_0x3b3773(++_0x5e9d11);}(_0x93ca,0xfa));var _0xa93c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x93ca[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var dialogflow=require(_0xa93c('0x0'));var md5=require(_0xa93c('0x1'));var moment=require('moment');var Promise=require(_0xa93c('0x2'));var logger=require(_0xa93c('0x3'))(_0xa93c('0x4'));var utils=require(_0xa93c('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa93c('0x6')),'mailMessage':require(_0xa93c('0x7')),'smsMessage':require(_0xa93c('0x8')),'faxMessage':require(_0xa93c('0x9')),'whatsappMessage':require(_0xa93c('0xa'))};function createMessage(_0x5b0a70,_0x125e39,_0x55cc7f,_0x5440b9){return new Promise(function(_0xe9bbae,_0x289426){var _0x5702af=_['clone'](_0x55cc7f);_0x5702af[_0xa93c('0xb')]=_0x5440b9;return rpc[_0x125e39+_0xa93c('0xc')][_0xa93c('0xd')](_0x5702af)[_0xa93c('0xe')](function(){logger[_0xa93c('0xf')](_0xa93c('0x10'),_0x5b0a70,_0x5702af[_0xa93c('0xb')]);_0xe9bbae();})[_0xa93c('0x11')](function(_0x3767d8){logger[_0xa93c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x5b0a70,JSON[_0xa93c('0x13')](_0x3767d8));_0x289426(_0x3767d8);});});}exports[_0xa93c('0x14')]=function(_0x3be470,_0x596231){return function(_0x2bffd1){try{if(!_[_0xa93c('0x15')](this[_0xa93c('0x16')][_0xa93c('0x17')])){logger[_0xa93c('0xf')](_0xa93c('0x10'),_0x3be470,_0xa93c('0x18'));return _0x2bffd1[_0xa93c('0x19')]();}var _0x307725={'ContactId':this[_0xa93c('0x1a')]['id'],'sentAt':moment()['format'](_0xa93c('0x1b')),'direction':_0xa93c('0x1c')};if(this['channel']==='sms'||this['channel']===_0xa93c('0x1d')){_0x307725[_0xa93c('0x1e')]=this[_0xa93c('0x16')]['phone'];}var _0x2ff577=this[_0xa93c('0x1f')];if(_0x2ff577==='chat'){_0x307725[_0xa93c('0x20')]=this[_0xa93c('0x21')]['id'];}else{_0x307725[_[_0xa93c('0x22')](_0x2ff577)+'AccountId']=this[_0xa93c('0x21')]['id'];}_0x307725[_['upperFirst'](_0x2ff577)+_0xa93c('0x23')]=this['interaction']['id'];if(this[_0xa93c('0x16')][_0xa93c('0x24')]){var _0x542b02=_0x596231[0x4];if(!_[_0xa93c('0x25')](_0x542b02)){_0x307725['body']=utils['getMustacheRender'](_0x542b02,this);return rpc[_0x2ff577+_0xa93c('0xc')]['create'](_0x307725)[_0xa93c('0xe')](function(_0x56b22c){logger[_0xa93c('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x3be470,_0x307725[_0xa93c('0xb')]);})[_0xa93c('0x11')](function(_0x1f3c2b){logger[_0xa93c('0x12')](_0xa93c('0x10'),_0x3be470,JSON[_0xa93c('0x13')](_0x1f3c2b));})['finally'](function(){logger['info'](_0xa93c('0x26'),_0x3be470);_0x2bffd1[_0xa93c('0x27')]();});}else{logger[_0xa93c('0xf')](_0xa93c('0x28'),_0x3be470);_0x2bffd1[_0xa93c('0x27')]();}}else{var _0x15a3fc=this;var _0x2eb3db=_0x596231[0x2][_0xa93c('0x29')](/\\n/g,'\x0a');var _0x3f8084={'credentials':{'private_key':_0x2eb3db,'client_email':_0x596231[0x1]}};var _0x129f8e=new dialogflow[(_0xa93c('0x2a'))](_0x3f8084);var _0x5d2643=_0x129f8e[_0xa93c('0x2b')](_0x596231[0x0],md5(_0x15a3fc[_0xa93c('0x16')]['id']));var _0x2250ac={'session':_0x5d2643,'queryInput':{'text':{'text':_0x15a3fc[_0xa93c('0x2c')]['body'],'languageCode':_0x596231[0x3]||'en'}}};return _0x129f8e[_0xa93c('0x2d')](_0x2250ac)[_0xa93c('0xe')](function(_0x1693cc){if(_0x1693cc&&_0x1693cc[_0xa93c('0x2e')]){_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x2f')]=_0x1693cc;var _0x3a0413=_0x1693cc[0x0];var _0x14c14e=_0x3a0413['queryResult'][_0xa93c('0x30')]&&_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')]['fields']?_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')]['fields'][_0xa93c('0x32')]['boolValue']:![];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x33')]=_0x3a0413['queryResult'][_0xa93c('0x34')];_0x15a3fc['body'][_0xa93c('0x35')]=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x36')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x37')]=_0x3a0413[_0xa93c('0x31')]['diagnosticInfo']&&_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')][_0xa93c('0x38')]?_0x3a0413[_0xa93c('0x31')][_0xa93c('0x30')][_0xa93c('0x38')][_0xa93c('0x32')][_0xa93c('0x39')]:![];_0x15a3fc[_0xa93c('0xb')]['DIALOGFLOWV2_INTENTNAME']=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x3a')][_0xa93c('0x3b')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x3c')]=_0x3a0413['queryResult'][_0xa93c('0x3a')][_0xa93c('0x3d')];_0x15a3fc[_0xa93c('0xb')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x3a')][_0xa93c('0x3e')];_0x15a3fc[_0xa93c('0xb')]['DIALOGFLOWV2_LANGUAGECODE']=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x3f')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x40')]=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x41')];_0x15a3fc[_0xa93c('0xb')][_0xa93c('0x42')]=_0x3a0413[_0xa93c('0x31')][_0xa93c('0x43')];_0x307725[_0xa93c('0x44')]='dialogflowV2';_0x307725['providerResponse']=JSON[_0xa93c('0x13')](_0x1693cc);var _0x3b006e=[];for(var _0x311c55=0x0;_0x311c55<_0x1693cc['length'];_0x311c55++){var _0x48f457=_0x1693cc[_0x311c55];if(_0x48f457&&_0x48f457[_0xa93c('0x31')]&&_0x48f457[_0xa93c('0x31')][_0xa93c('0x45')]){_0x3b006e[_0xa93c('0x46')](createMessage(_0x3be470,_0x2ff577,_0x307725,_0x48f457[_0xa93c('0x31')][_0xa93c('0x45')]));}}return Promise['all'](_0x3b006e)[_0xa93c('0xe')](function(){if(_0x14c14e){_0x2bffd1[_0xa93c('0x19')]();}else{_0x2bffd1[_0xa93c('0x27')]();}})[_0xa93c('0x11')](function(_0x53498a){logger[_0xa93c('0x12')](_0xa93c('0x10'),_0x3be470,JSON[_0xa93c('0x13')](_0x53498a));_0x2bffd1[_0xa93c('0x19')]();});}})[_0xa93c('0x11')](function(_0x2f3c97){logger[_0xa93c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x3be470,_0x2f3c97[_0xa93c('0x2c')],_0x2f3c97[_0xa93c('0x47')]);_0x2bffd1[_0xa93c('0x19')]();});}}catch(_0x5077e3){logger[_0xa93c('0x12')]('[%s][DIALOGFLOWV2]\x20%s',_0x3be470,JSON[_0xa93c('0x13')](_0x5077e3));_0x2bffd1[_0xa93c('0x27')]();}};}; \ No newline at end of file +var _0xd646=['Message','create','then','error','stringify','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','getMustacheRender','catch','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','boolValue','DIALOGFLOWV2_ACTION','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','end_conversation','DIALOGFLOWV2_INTENTNAME','name','DIALOGFLOWV2_INTENTDISPLAYNAME','intent','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerResponse','fulfillmentText','push','all','message','lodash','dialogflow','md5','bluebird','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body'];(function(_0x1ae4c0,_0x2212ed){var _0xe6b31b=function(_0x4320a0){while(--_0x4320a0){_0x1ae4c0['push'](_0x1ae4c0['shift']());}};_0xe6b31b(++_0x2212ed);}(_0xd646,0x7c));var _0x6d64=function(_0x39d22c,_0x288d71){_0x39d22c=_0x39d22c-0x0;var _0x56bb90=_0xd646[_0x39d22c];return _0x56bb90;};'use strict';var _=require(_0x6d64('0x0'));var dialogflow=require(_0x6d64('0x1'));var md5=require(_0x6d64('0x2'));var moment=require('moment');var Promise=require(_0x6d64('0x3'));var logger=require('../../../../config/logger')('routing');var utils=require('./utils');var rpc={'chatMessage':require(_0x6d64('0x4')),'openchannelMessage':require(_0x6d64('0x5')),'mailMessage':require(_0x6d64('0x6')),'smsMessage':require(_0x6d64('0x7')),'faxMessage':require(_0x6d64('0x8')),'whatsappMessage':require(_0x6d64('0x9'))};function createMessage(_0x3e2765,_0x18a62c,_0x53287c,_0x148cf6){return new Promise(function(_0x4fb850,_0x1343f9){var _0x143cbb=_[_0x6d64('0xa')](_0x53287c);_0x143cbb[_0x6d64('0xb')]=_0x148cf6;return rpc[_0x18a62c+_0x6d64('0xc')][_0x6d64('0xd')](_0x143cbb)[_0x6d64('0xe')](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x3e2765,_0x143cbb['body']);_0x4fb850();})['catch'](function(_0x414d24){logger[_0x6d64('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x3e2765,JSON[_0x6d64('0x10')](_0x414d24));_0x1343f9(_0x414d24);});});}exports[_0x6d64('0x11')]=function(_0x1ab02f,_0x50c9d4){return function(_0x2caed6){try{if(!_[_0x6d64('0x12')](this[_0x6d64('0x13')][_0x6d64('0x14')])){logger[_0x6d64('0x15')](_0x6d64('0x16'),_0x1ab02f,_0x6d64('0x17'));return _0x2caed6[_0x6d64('0x18')]();}var _0x3ceb20={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x6d64('0x19')),'direction':'out'};if(this[_0x6d64('0x1a')]===_0x6d64('0x1b')||this[_0x6d64('0x1a')]===_0x6d64('0x1c')){_0x3ceb20[_0x6d64('0x1d')]=this[_0x6d64('0x13')][_0x6d64('0x1d')];}var _0x2e0b1c=this[_0x6d64('0x1a')];if(_0x2e0b1c===_0x6d64('0x1e')){_0x3ceb20[_0x6d64('0x1f')]=this[_0x6d64('0x20')]['id'];}else{_0x3ceb20[_[_0x6d64('0x21')](_0x2e0b1c)+'AccountId']=this['account']['id'];}_0x3ceb20[_['upperFirst'](_0x2e0b1c)+'InteractionId']=this[_0x6d64('0x13')]['id'];if(this[_0x6d64('0x13')][_0x6d64('0x22')]){var _0x2638d4=_0x50c9d4[0x4];if(!_['isEmpty'](_0x2638d4)){_0x3ceb20[_0x6d64('0xb')]=utils[_0x6d64('0x23')](_0x2638d4,this);return rpc[_0x2e0b1c+'Message']['create'](_0x3ceb20)[_0x6d64('0xe')](function(_0x186a3a){logger['info'](_0x6d64('0x16'),_0x1ab02f,_0x3ceb20[_0x6d64('0xb')]);})[_0x6d64('0x24')](function(_0x274d27){logger[_0x6d64('0xf')](_0x6d64('0x16'),_0x1ab02f,JSON[_0x6d64('0x10')](_0x274d27));})['finally'](function(){logger[_0x6d64('0x15')](_0x6d64('0x25'),_0x1ab02f);_0x2caed6[_0x6d64('0x26')]();});}else{logger['info'](_0x6d64('0x27'),_0x1ab02f);_0x2caed6[_0x6d64('0x26')]();}}else{var _0x2d3558=this;var _0x322b8d=_0x50c9d4[0x2][_0x6d64('0x28')](/\\n/g,'\x0a');var _0x58dde5={'credentials':{'private_key':_0x322b8d,'client_email':_0x50c9d4[0x1]}};var _0x3c62ce=new dialogflow['SessionsClient'](_0x58dde5);var _0x563125=_0x3c62ce[_0x6d64('0x29')](_0x50c9d4[0x0],md5(_0x2d3558[_0x6d64('0x13')]['id']));var _0x294bbd={'session':_0x563125,'queryInput':{'text':{'text':_0x2d3558['message'][_0x6d64('0xb')],'languageCode':_0x50c9d4[0x3]||'en'}}};return _0x3c62ce[_0x6d64('0x2a')](_0x294bbd)[_0x6d64('0xe')](function(_0x47cad2){if(_0x47cad2&&_0x47cad2[_0x6d64('0x2b')]){_0x2d3558[_0x6d64('0xb')][_0x6d64('0x2c')]=_0x47cad2;var _0x2a6a8f=_0x47cad2[0x0];var _0x1661f3=_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x2e')]&&_0x2a6a8f['queryResult']['diagnosticInfo']['fields']?_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x2e')]['fields']['end_conversation'][_0x6d64('0x2f')]:![];_0x2d3558[_0x6d64('0xb')][_0x6d64('0x30')]=_0x2a6a8f['queryResult']['action'];_0x2d3558[_0x6d64('0xb')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x2a6a8f['queryResult'][_0x6d64('0x31')];_0x2d3558[_0x6d64('0xb')][_0x6d64('0x32')]=_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x2e')]&&_0x2a6a8f['queryResult'][_0x6d64('0x2e')][_0x6d64('0x33')]?_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x2e')][_0x6d64('0x33')][_0x6d64('0x34')][_0x6d64('0x2f')]:![];_0x2d3558[_0x6d64('0xb')][_0x6d64('0x35')]=_0x2a6a8f[_0x6d64('0x2d')]['intent'][_0x6d64('0x36')];_0x2d3558['body'][_0x6d64('0x37')]=_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x38')][_0x6d64('0x39')];_0x2d3558[_0x6d64('0xb')][_0x6d64('0x3a')]=_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x38')][_0x6d64('0x3b')];_0x2d3558[_0x6d64('0xb')][_0x6d64('0x3c')]=_0x2a6a8f[_0x6d64('0x2d')]['languageCode'];_0x2d3558[_0x6d64('0xb')]['DIALOGFLOWV2_QUERYTEXT']=_0x2a6a8f[_0x6d64('0x2d')]['queryText'];_0x2d3558[_0x6d64('0xb')][_0x6d64('0x3d')]=_0x2a6a8f[_0x6d64('0x2d')][_0x6d64('0x3e')];_0x3ceb20['providerName']=_0x6d64('0x2c');_0x3ceb20[_0x6d64('0x3f')]=JSON['stringify'](_0x47cad2);var _0x92b688=[];for(var _0x525562=0x0;_0x525562<_0x47cad2[_0x6d64('0x2b')];_0x525562++){var _0x413547=_0x47cad2[_0x525562];if(_0x413547&&_0x413547['queryResult']&&_0x413547[_0x6d64('0x2d')][_0x6d64('0x40')]){_0x92b688[_0x6d64('0x41')](createMessage(_0x1ab02f,_0x2e0b1c,_0x3ceb20,_0x413547[_0x6d64('0x2d')][_0x6d64('0x40')]));}}return Promise[_0x6d64('0x42')](_0x92b688)[_0x6d64('0xe')](function(){if(_0x1661f3){_0x2caed6[_0x6d64('0x18')]();}else{_0x2caed6[_0x6d64('0x26')]();}})[_0x6d64('0x24')](function(_0x4f9060){logger[_0x6d64('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x1ab02f,JSON['stringify'](_0x4f9060));_0x2caed6[_0x6d64('0x18')]();});}})[_0x6d64('0x24')](function(_0x55c9e5){logger[_0x6d64('0xf')](_0x6d64('0x16'),_0x1ab02f,_0x55c9e5[_0x6d64('0x43')],_0x55c9e5['stack']);_0x2caed6['next']();});}}catch(_0x5b81b1){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1ab02f,JSON[_0x6d64('0x10')](_0x5b81b1));_0x2caed6[_0x6d64('0x26')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 43d596c..74d0858 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8de9=['findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x2329eb,_0x3cb953){var _0x5846aa=function(_0x5aca8f){while(--_0x5aca8f){_0x2329eb['push'](_0x2329eb['shift']());}};_0x5846aa(++_0x3cb953);}(_0x8de9,0x90));var _0x98de=function(_0xf8c6a9,_0x1ecbd9){_0xf8c6a9=_0xf8c6a9-0x0;var _0x12aeaa=_0x8de9[_0xf8c6a9];return _0x12aeaa;};'use strict';var schema=require(_0x98de('0x0'));var _=require('lodash');var htmlToText=require(_0x98de('0x1'));var utils=require(_0x98de('0x2'));var logger=require(_0x98de('0x3'))(_0x98de('0x4'));var gotoif=schema({'condition':{'type':_0x98de('0x5'),'required':!![],'message':_0x98de('0x6')},'priorityTrue':{'type':_0x98de('0x7'),'message':_0x98de('0x8')},'priorityFalse':{'type':_0x98de('0x7'),'message':_0x98de('0x9')}});exports['consequence']=function(_0x3ca289,_0x278805){return function(_0x1ad8c3){try{var _0x36d42d={'condition':htmlToText[_0x98de('0xa')](utils[_0x98de('0xb')](_0x278805[0x0],this),{'wordwrap':![]})[_0x98de('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x278805[0x1],'priorityFalse':_0x278805[0x2]};var _0x325c8c=gotoif[_0x98de('0x0')](_0x36d42d,{'typecast':!![]});if(_0x325c8c[_0x98de('0xd')]){logger[_0x98de('0xe')](_0x98de('0xf'),_0x3ca289,_['map'](_0x325c8c,_0x98de('0x10'))[_0x98de('0x11')](',\x20'));_0x1ad8c3[_0x98de('0x12')]();}else{try{var _0x4b77bd=eval('('+_0x36d42d['condition']+')');var _0x27dcec=_0x4b77bd?_0x36d42d[_0x98de('0x13')]:_0x36d42d[_0x98de('0x14')];logger[_0x98de('0x15')](_0x98de('0x16'),_0x3ca289,_0x36d42d['condition'],_0x4b77bd,_0x27dcec||_0x98de('0x17'));if(_0x27dcec){var _0x4187ac=_[_0x98de('0x18')](_0x1ad8c3['rules'](),{'p':_0x27dcec});if(_0x4187ac>=0x0){logger['info'](_0x98de('0x19'),_0x3ca289,_0x27dcec||_0x98de('0x17'),_0x4187ac);_0x1ad8c3[_0x98de('0x17')](_0x4187ac);}else{logger[_0x98de('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x3ca289,_0x27dcec||_0x98de('0x17'));_0x1ad8c3[_0x98de('0x12')]();}}else{_0x1ad8c3[_0x98de('0x17')]();}}catch(_0x49b35a){logger[_0x98de('0xe')](_0x98de('0x1a'),_0x3ca289,_0x49b35a[_0x98de('0x10')]);_0x1ad8c3[_0x98de('0x12')]();}}}catch(_0x2bc75f){logger[_0x98de('0xe')]('[%s][GOTOIF]\x20%s',_0x3ca289,JSON[_0x98de('0x1b')](_0x2bc75f));_0x1ad8c3[_0x98de('0x12')]();}};}; \ No newline at end of file +var _0x3897=['findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','html-to-text','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next'];(function(_0x49d005,_0x2db7b8){var _0x21a0ea=function(_0x736b7e){while(--_0x736b7e){_0x49d005['push'](_0x49d005['shift']());}};_0x21a0ea(++_0x2db7b8);}(_0x3897,0x165));var _0x7389=function(_0x540160,_0x24c6b6){_0x540160=_0x540160-0x0;var _0x476120=_0x3897[_0x540160];return _0x476120;};'use strict';var schema=require(_0x7389('0x0'));var _=require('lodash');var htmlToText=require(_0x7389('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x7389('0x2'));var gotoif=schema({'condition':{'type':_0x7389('0x3'),'required':!![],'message':_0x7389('0x4')},'priorityTrue':{'type':_0x7389('0x5'),'message':_0x7389('0x6')},'priorityFalse':{'type':_0x7389('0x5'),'message':_0x7389('0x7')}});exports['consequence']=function(_0x56a0d8,_0x52d1f5){return function(_0x2c6666){try{var _0x51f91e={'condition':htmlToText['fromString'](utils[_0x7389('0x8')](_0x52d1f5[0x0],this),{'wordwrap':![]})[_0x7389('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x52d1f5[0x1],'priorityFalse':_0x52d1f5[0x2]};var _0x2ea875=gotoif[_0x7389('0x0')](_0x51f91e,{'typecast':!![]});if(_0x2ea875[_0x7389('0xa')]){logger['error'](_0x7389('0xb'),_0x56a0d8,_[_0x7389('0xc')](_0x2ea875,_0x7389('0xd'))[_0x7389('0xe')](',\x20'));_0x2c6666[_0x7389('0xf')]();}else{try{var _0x3e673b=eval('('+_0x51f91e['condition']+')');var _0x32f54a=_0x3e673b?_0x51f91e[_0x7389('0x10')]:_0x51f91e[_0x7389('0x11')];logger[_0x7389('0x12')](_0x7389('0x13'),_0x56a0d8,_0x51f91e['condition'],_0x3e673b,_0x32f54a||_0x7389('0x14'));if(_0x32f54a){var _0xe88274=_[_0x7389('0x15')](_0x2c6666[_0x7389('0x16')](),{'p':_0x32f54a});if(_0xe88274>=0x0){logger[_0x7389('0x12')](_0x7389('0x17'),_0x56a0d8,_0x32f54a||_0x7389('0x14'),_0xe88274);_0x2c6666[_0x7389('0x14')](_0xe88274);}else{logger[_0x7389('0x12')](_0x7389('0x18'),_0x56a0d8,_0x32f54a||_0x7389('0x14'));_0x2c6666[_0x7389('0xf')]();}}else{_0x2c6666['next']();}}catch(_0x183da9){logger[_0x7389('0x19')](_0x7389('0x1a'),_0x56a0d8,_0x183da9[_0x7389('0xd')]);_0x2c6666['stop']();}}}catch(_0x1f37a8){logger[_0x7389('0x19')](_0x7389('0xb'),_0x56a0d8,JSON['stringify'](_0x1f37a8));_0x2c6666['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 86f116d..0cbfb75 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 _0x0912=['../../../../config/logger','routing','number','consequence','error','[%s][GOTOP]\x20%s','map','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash'];(function(_0x9842c1,_0x1edf79){var _0x5ba376=function(_0x4b88ed){while(--_0x4b88ed){_0x9842c1['push'](_0x9842c1['shift']());}};_0x5ba376(++_0x1edf79);}(_0x0912,0x11c));var _0x2091=function(_0x591448,_0x443a02){_0x591448=_0x591448-0x0;var _0x22da37=_0x0912[_0x591448];return _0x22da37;};'use strict';var schema=require('validate');var _=require(_0x2091('0x0'));var logger=require(_0x2091('0x1'))(_0x2091('0x2'));var gotop=schema({'priority':{'type':_0x2091('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0x2091('0x4')]=function(_0x2e15d9,_0x33f9df){return function(_0x4ba5d2){try{var _0x329407={'priority':_0x33f9df[0x0]};var _0x1bb10d=gotop['validate'](_0x329407,{'typecast':!![]});if(_0x1bb10d['length']){logger[_0x2091('0x5')](_0x2091('0x6'),_0x2e15d9,_[_0x2091('0x7')](_0x1bb10d,_0x2091('0x8'))['join'](',\x20'));_0x4ba5d2[_0x2091('0x9')]();}else{logger[_0x2091('0xa')](_0x2091('0xb'),_0x2e15d9,_0x329407[_0x2091('0xc')]);if(_0x329407[_0x2091('0xc')]){var _0x396422=_[_0x2091('0xd')](_0x4ba5d2[_0x2091('0xe')](),{'p':_0x329407['priority']});if(_0x396422>=0x0){logger[_0x2091('0xa')](_0x2091('0xf'),_0x2e15d9,_0x329407[_0x2091('0xc')]||_0x2091('0x10'),_0x396422);_0x4ba5d2[_0x2091('0x10')](_0x396422);}else{logger[_0x2091('0xa')](_0x2091('0x11'),_0x2e15d9,_0x329407[_0x2091('0xc')]||_0x2091('0x10'));_0x4ba5d2['stop']();}}else{_0x4ba5d2['next']();}}}catch(_0x3cffda){logger[_0x2091('0x5')](_0x2091('0x6'),_0x2e15d9,JSON[_0x2091('0x12')](_0x3cffda));_0x4ba5d2['stop']();}};}; \ No newline at end of file +var _0x64a1=['rules','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','validate','length','[%s][GOTOP]\x20%s','map','join','stop','info','priority','findIndex'];(function(_0x1369b3,_0xebe747){var _0x147607=function(_0x5b2063){while(--_0x5b2063){_0x1369b3['push'](_0x1369b3['shift']());}};_0x147607(++_0xebe747);}(_0x64a1,0xc3));var _0x164a=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x64a1[_0x565ed7];return _0x183ad7;};'use strict';var schema=require('validate');var _=require(_0x164a('0x0'));var logger=require(_0x164a('0x1'))(_0x164a('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x164a('0x3')}});exports[_0x164a('0x4')]=function(_0x574b4d,_0x11d8ed){return function(_0x3c8d6f){try{var _0x3962f5={'priority':_0x11d8ed[0x0]};var _0xad0677=gotop[_0x164a('0x5')](_0x3962f5,{'typecast':!![]});if(_0xad0677[_0x164a('0x6')]){logger['error'](_0x164a('0x7'),_0x574b4d,_[_0x164a('0x8')](_0xad0677,'message')[_0x164a('0x9')](',\x20'));_0x3c8d6f[_0x164a('0xa')]();}else{logger[_0x164a('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x574b4d,_0x3962f5[_0x164a('0xc')]);if(_0x3962f5[_0x164a('0xc')]){var _0x4aa22b=_[_0x164a('0xd')](_0x3c8d6f[_0x164a('0xe')](),{'p':_0x3962f5[_0x164a('0xc')]});if(_0x4aa22b>=0x0){logger['info']('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x574b4d,_0x3962f5['priority']||_0x164a('0xf'),_0x4aa22b);_0x3c8d6f[_0x164a('0xf')](_0x4aa22b);}else{logger[_0x164a('0xb')](_0x164a('0x10'),_0x574b4d,_0x3962f5[_0x164a('0xc')]||_0x164a('0xf'));_0x3c8d6f['stop']();}}else{_0x3c8d6f[_0x164a('0xf')]();}}}catch(_0x589a88){logger[_0x164a('0x11')](_0x164a('0x7'),_0x574b4d,JSON[_0x164a('0x12')](_0x589a88));_0x3c8d6f[_0x164a('0xa')]();}};}; \ 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 d21e755..4283d34 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 _0x1d6a=['./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','stop'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1d6a,0x190));var _0xa1d6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x1d6a[_0x8c43de];return _0xa6591b;};'use strict';var _=require('lodash');var utils=require(_0xa1d6('0x0'));var logger=require(_0xa1d6('0x1'))(_0xa1d6('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xa1d6('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xa1d6('0x4')),'faxMessage':require(_0xa1d6('0x5')),'whatsappMessage':require(_0xa1d6('0x6'))};exports[_0xa1d6('0x7')]=function(_0x370885,_0x3eb7ca){return function(_0x5be9ff){try{var _0x1452e7={'body':utils[_0xa1d6('0x8')](_0x3eb7ca[0x0],this),'ContactId':this['contact']['id']};if(this[_0xa1d6('0x9')]===_0xa1d6('0xa')){_0x1452e7[_0xa1d6('0xb')]=this[_0xa1d6('0xc')]['id'];}else{_0x1452e7[_['upperFirst'](this[_0xa1d6('0x9')])+_0xa1d6('0xd')]=this['account']['id'];}_0x1452e7[_[_0xa1d6('0xe')](this[_0xa1d6('0x9')])+_0xa1d6('0xf')]=this[_0xa1d6('0x10')]['id'];if(rpc[this['channel']+_0xa1d6('0x11')]){return rpc[this[_0xa1d6('0x9')]+_0xa1d6('0x11')][_0xa1d6('0x12')](_0x1452e7)[_0xa1d6('0x13')](function(_0x428629){logger['info'](_0xa1d6('0x14'),_0x370885,_0x1452e7[_0xa1d6('0x15')]);_0x5be9ff[_0xa1d6('0x16')]();})[_0xa1d6('0x17')](function(_0x723996){logger['error']('[%s][MESSAGE]\x20%s',_0x370885,JSON['stringify'](_0x723996));_0x5be9ff[_0xa1d6('0x18')]();});}}catch(_0x321198){logger['error'](_0xa1d6('0x14'),_0x370885,JSON['stringify'](_0x321198));_0x5be9ff[_0xa1d6('0x18')]();}};}; \ No newline at end of file +var _0x783c=['account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','contact','channel'];(function(_0x4a0801,_0x55b298){var _0x47306d=function(_0x415a91){while(--_0x415a91){_0x4a0801['push'](_0x4a0801['shift']());}};_0x47306d(++_0x55b298);}(_0x783c,0xaf));var _0xc783=function(_0x28bac1,_0x2d6250){_0x28bac1=_0x28bac1-0x0;var _0x2a86ad=_0x783c[_0x28bac1];return _0x2a86ad;};'use strict';var _=require(_0xc783('0x0'));var utils=require('./utils');var logger=require(_0xc783('0x1'))(_0xc783('0x2'));var rpc={'chatMessage':require(_0xc783('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xc783('0x4')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xc783('0x5')),'whatsappMessage':require(_0xc783('0x6'))};exports['consequence']=function(_0x55d873,_0x547328){return function(_0x39731f){try{var _0x4f8d2d={'body':utils['getMustacheRender'](_0x547328[0x0],this),'ContactId':this[_0xc783('0x7')]['id']};if(this[_0xc783('0x8')]==='chat'){_0x4f8d2d['ChatWebsiteId']=this[_0xc783('0x9')]['id'];}else{_0x4f8d2d[_[_0xc783('0xa')](this[_0xc783('0x8')])+_0xc783('0xb')]=this[_0xc783('0x9')]['id'];}_0x4f8d2d[_[_0xc783('0xa')](this[_0xc783('0x8')])+'InteractionId']=this[_0xc783('0xc')]['id'];if(rpc[this[_0xc783('0x8')]+_0xc783('0xd')]){return rpc[this['channel']+_0xc783('0xd')][_0xc783('0xe')](_0x4f8d2d)[_0xc783('0xf')](function(_0xfb8f0){logger[_0xc783('0x10')](_0xc783('0x11'),_0x55d873,_0x4f8d2d['body']);_0x39731f[_0xc783('0x12')]();})[_0xc783('0x13')](function(_0x1ba7f6){logger[_0xc783('0x14')](_0xc783('0x11'),_0x55d873,JSON[_0xc783('0x15')](_0x1ba7f6));_0x39731f[_0xc783('0x16')]();});}}catch(_0xb26d99){logger['error'](_0xc783('0x11'),_0x55d873,JSON['stringify'](_0xb26d99));_0x39731f['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index 0bda8bd..4b11cd3 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 _0xe852=['info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','../../../../config/logger','routing','consequence'];(function(_0x234e50,_0x2ce044){var _0x3d7aea=function(_0x396ec5){while(--_0x396ec5){_0x234e50['push'](_0x234e50['shift']());}};_0x3d7aea(++_0x2ce044);}(_0xe852,0xcc));var _0x2e85=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xe852[_0x6cf19c];return _0xce14f3;};'use strict';var utils=require('./utils');var logger=require(_0x2e85('0x0'))(_0x2e85('0x1'));exports[_0x2e85('0x2')]=function(_0xd1158d,_0x26e84e){return function(_0x5481af){try{logger[_0x2e85('0x3')](_0x2e85('0x4'),_0xd1158d,utils[_0x2e85('0x5')](_0x26e84e[0x0],this));_0x5481af[_0x2e85('0x6')]();}catch(_0x7249fd){logger[_0x2e85('0x7')](_0x2e85('0x4'),_0xd1158d,JSON[_0x2e85('0x8')](_0x7249fd));_0x5481af['stop']();}};}; \ No newline at end of file +var _0x4670=['info','[%s][NOOP]\x20%s','next','error','stringify','stop','./utils','../../../../config/logger','routing','consequence'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x4670,0x1e6));var _0x0467=function(_0x1dbf6c,_0x1b0af4){_0x1dbf6c=_0x1dbf6c-0x0;var _0x117f88=_0x4670[_0x1dbf6c];return _0x117f88;};'use strict';var utils=require(_0x0467('0x0'));var logger=require(_0x0467('0x1'))(_0x0467('0x2'));exports[_0x0467('0x3')]=function(_0x27f737,_0x325f4e){return function(_0x1836b7){try{logger[_0x0467('0x4')](_0x0467('0x5'),_0x27f737,utils['getMustacheRender'](_0x325f4e[0x0],this));_0x1836b7[_0x0467('0x6')]();}catch(_0x556760){logger[_0x0467('0x7')](_0x0467('0x5'),_0x27f737,JSON[_0x0467('0x8')](_0x556760));_0x1836b7[_0x0467('0x9')]();}};}; \ 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 45c95d6..f783fe8 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 _0x7130=['rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','seq-queue','moment','ioredis','../../../../config/logger','routing','./strategy','redis','defaults','localhost','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/faxInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','channel','QueueId','upperFirst','interaction','message','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','waiting','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','Queues','atimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy'];(function(_0x570931,_0x594f60){var _0x13b46e=function(_0xc71730){while(--_0xc71730){_0x570931['push'](_0x570931['shift']());}};_0x13b46e(++_0x594f60);}(_0x7130,0x1a7));var _0x0713=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x7130[_0xda464c];return _0x19e222;};'use strict';var schema=require(_0x0713('0x0'));var _=require(_0x0713('0x1'));var util=require('util');var seqqueue=require(_0x0713('0x2'));var moment=require(_0x0713('0x3'));var Redis=require(_0x0713('0x4'));var config=require('../../../../config/environment');var logger=require(_0x0713('0x5'))(_0x0713('0x6'));var strategy=require(_0x0713('0x7'));config[_0x0713('0x8')]=_[_0x0713('0x9')](config[_0x0713('0x8')],{'host':_0x0713('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0713('0x8')]));var attributes=['id',_0x0713('0xb'),_0x0713('0xc'),_0x0713('0xd'),_0x0713('0xe'),_0x0713('0xf')];function emit(_0x385f33,_0x5a9b93,_0x10776e){io['to'](_0x385f33)[_0x0713('0x10')](_0x5a9b93,_0x10776e);}function emitChannelQueueInteraction(_0x5dfcfc,_0x5a3791,_0x5f40c1,_0x1a7e50,_0x1ab3e1,_0x5a6ada,_0x258acb,_0x2ce0ee){var _0x9e3e5c=_[_0x0713('0x11')](_0x5f40c1);_0x9e3e5c[_0x0713('0xb')]=_0x2ce0ee;_0x9e3e5c[_0x0713('0xd')]=_0x5a3791;_0x9e3e5c[_0x0713('0xc')]=_0x1a7e50;_0x9e3e5c['id']=_0x1ab3e1;if(_0x5a6ada){attributes[_0x0713('0x12')](_[_0x0713('0x13')](_0x5dfcfc)+_0x0713('0x14'));_0x258acb[util['format'](_0x0713('0x15'),_0x5dfcfc)][_0x1ab3e1]=_[_0x0713('0x16')](_0x9e3e5c,attributes);}else{delete _0x258acb[util[_0x0713('0x17')](_0x0713('0x15'),_0x5dfcfc)][_0x1ab3e1];}emit(util[_0x0713('0x17')](_0x0713('0x18'),_0x5dfcfc,_0x5a3791),util[_0x0713('0x17')](_0x0713('0x19'),_0x5dfcfc,_0x5a6ada?_0x0713('0x1a'):_0x0713('0x1b')),_['pick'](_0x9e3e5c,attributes));}var rpc={'openchannelQueueReport':require(_0x0713('0x1c')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x0713('0x1d')),'faxQueueReport':require(_0x0713('0x1e')),'whatsappQueueReport':require(_0x0713('0x1f')),'chatInteraction':require(_0x0713('0x20')),'faxInteraction':require(_0x0713('0x21')),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x0713('0x22')),'smsInteraction':require(_0x0713('0x23')),'whatsappInteraction':require(_0x0713('0x24'))};var queue=schema({'name':{'type':_0x0713('0x25'),'required':!![],'message':_0x0713('0x26')},'timeout':{'type':'number','message':_0x0713('0x27')}});function startRouting(_0x5d1db3,_0x321824,_0x17bf55,_0x122532){if(_0x5d1db3&&_0x321824&&_0x17bf55){_0x321824['waiting']+=0x1;var _0x5517ad={'uniqueid':_0x5d1db3,'from':_0x17bf55[_0x0713('0x28')]?_0x17bf55['body'][_0x0713('0xe')]:'','joinAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'ContactId':_0x17bf55[_0x0713('0x2a')]?_0x17bf55[_0x0713('0x2a')]['id']:null,'ListId':_0x17bf55['list']?_0x17bf55['list']['id']:null};_0x5517ad[_['upperFirst'](_0x17bf55[_0x0713('0x2b')])+_0x0713('0x2c')]=_0x321824['id']||null;_0x5517ad[_[_0x0713('0x2d')](_0x17bf55[_0x0713('0x2b')])+'InteractionId']=_0x17bf55[_0x0713('0x2e')]?_0x17bf55[_0x0713('0x2e')]['id']:null;_0x5517ad[_[_0x0713('0x2d')](_0x17bf55[_0x0713('0x2b')])+'MessageId']=_0x17bf55[_0x0713('0x2f')]?_0x17bf55[_0x0713('0x2f')]['id']:null;_0x5517ad[_[_0x0713('0x2d')](_0x17bf55[_0x0713('0x2b')])+(_0x17bf55['channel']!=='chat'?_0x0713('0x30'):'WebsiteId')]=_0x17bf55[_0x0713('0xc')]?_0x17bf55['account']['id']:null;logger[_0x0713('0x31')](util[_0x0713('0x17')](_0x0713('0x32'),_0x5d1db3,_0x321824[_0x0713('0x33')]));emitChannelQueueInteraction(_0x17bf55[_0x0713('0x2b')],_0x321824[_0x0713('0x33')],_0x5517ad,_0x17bf55[_0x0713('0xc')][_0x0713('0x33')],_0x17bf55[_0x0713('0x2f')]['id'],!![],_0x122532,_0x321824['id']);if(rpc[_0x17bf55['channel']+'QueueReport']){return rpc[_0x17bf55[_0x0713('0x2b')]+_0x0713('0x34')][_0x0713('0x35')](_0x5517ad)[_0x0713('0x36')](function(_0x29fd23){logger[_0x0713('0x37')](_0x0713('0x38'),_0x29fd23);});}}}function stopRouting(_0x487bdb,_0x537903,_0x4c73ed,_0x5baaeb){if(_0x487bdb&&_0x537903){_0x537903[_0x0713('0x39')]-=0x1;var _0x3c33ee={'leaveAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'acceptAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'reason':_0x0713('0x3a')};logger[_0x0713('0x31')](util[_0x0713('0x17')](_0x0713('0x3b'),_0x487bdb,_0x537903[_0x0713('0x33')]));emitChannelQueueInteraction(_0x4c73ed['channel'],_0x537903[_0x0713('0x33')],_0x4c73ed[_0x0713('0x28')],_0x4c73ed['account'][_0x0713('0x33')],_0x4c73ed[_0x0713('0x2f')]['id'],![],_0x5baaeb,_0x537903['id']);return rpc[_0x4c73ed[_0x0713('0x2b')]+_0x0713('0x3c')][_0x0713('0x3d')](_0x4c73ed[_0x0713('0x2e')]['id'],{'queueId':_0x537903['id']})[_0x0713('0x3e')](function(){if(rpc[_0x4c73ed[_0x0713('0x2b')]+_0x0713('0x34')]){return rpc[_0x4c73ed['channel']+_0x0713('0x34')]['update'](_0x487bdb,_0x3c33ee)[_0x0713('0x36')](function(_0x3296d3){logger['error'](_0x0713('0x3f'),_0x3296d3);});}});}}function endRouting(_0x39dc80,_0x9bd749,_0x138232,_0x2f0079){if(_0x39dc80&&_0x9bd749){_0x9bd749[_0x0713('0x39')]-=0x1;var _0x22e5ea={'leaveAt':moment()[_0x0713('0x17')](_0x0713('0x29')),'exitAt':moment()['format'](_0x0713('0x29')),'reason':'timeout'};logger[_0x0713('0x31')](util[_0x0713('0x17')](_0x0713('0x40'),_0x39dc80,_0x9bd749['name']));emitChannelQueueInteraction(_0x138232['channel'],_0x9bd749[_0x0713('0x33')],_0x138232[_0x0713('0x28')],_0x138232['account']['name'],_0x138232[_0x0713('0x2f')]['id'],![],_0x2f0079);if(rpc[_0x138232[_0x0713('0x2b')]+_0x0713('0x34')]){return rpc[_0x138232[_0x0713('0x2b')]+_0x0713('0x34')][_0x0713('0x3d')](_0x39dc80,_0x22e5ea)[_0x0713('0x36')](function(_0xfc6727){logger['error']('update\x20queue\x20report',_0xfc6727);});}}}function handleFindQueue(_0x5e61fe){return function(_0x16537e){return _0x16537e[_0x0713('0x33')][_0x0713('0x41')]()===_0x5e61fe[_0x0713('0x41')]();};}exports[_0x0713('0x42')]=function(_0x454708,_0x230143,_0x2f8447,_0x5b4705){return function(_0x39f6fb){try{var _0x531ec9={'name':_0x230143[0x0],'timeout':_0x230143[0x1]};var _0x4fc2cf=queue[_0x0713('0x0')](_0x531ec9,{'typecast':!![]});if(_0x4fc2cf[_0x0713('0x43')]){logger[_0x0713('0x37')](_0x0713('0x44'),_0x454708,_[_0x0713('0x45')](_0x4fc2cf,_0x0713('0x2f'))[_0x0713('0x46')](',\x20'));_0x39f6fb[_0x0713('0x47')]();}else{var _0x67514d=_['find'](_0x2f8447[_0x5b4705[_0x0713('0x2b')]+_0x0713('0x48')],handleFindQueue(_0x531ec9[_0x0713('0x33')]));if(_0x67514d){startRouting(_0x454708,_0x67514d,_0x5b4705,_0x2f8447);var _0x2b88a9=(_0x67514d['timeout']||0xa)*0x3e8;var _0x29ef0d=(_0x531ec9['timeout']||0x14)*0x3e8;var _0x3fa76d;if(_0x2b88a9>_0x29ef0d){_0x29ef0d=_0x2b88a9;}var _0x23bcfb=seqqueue['createQueue'](_0x2b88a9);_0x23bcfb['id']=_0x454708;_0x23bcfb[_0x0713('0x49')]=_0x2b88a9;_0x23bcfb['qtimeout']=_0x29ef0d;_0x23bcfb[_0x0713('0x2b')]=_0x5b4705['channel'];_0x2f8447['rules'][_0x454708]['on'](_0x0713('0x4a'),function(){logger[_0x0713('0x31')](_0x0713('0x4b'),_0x454708);stopRouting(_0x454708,_0x67514d,_0x5b4705,_0x2f8447);clearTimeout(_0x3fa76d);_0x3fa76d=undefined;_0x23bcfb[_0x0713('0x4c')](!![]);if(_0x2f8447['rules'][_0x454708]){delete _0x2f8447[_0x0713('0x4d')][_0x454708];}_0x39f6fb[_0x0713('0x47')]();});_0x2f8447[_0x0713('0x4d')][_0x454708]['on']('complete',function(){if(_0x2f8447['rules'][_0x454708]){delete _0x2f8447['rules'][_0x454708];}});_0x3fa76d=setTimeout(function(){logger[_0x0713('0x31')](_0x0713('0x4e'),_0x454708);endRouting(_0x454708,_0x67514d,_0x5b4705,_0x2f8447);clearTimeout(_0x3fa76d);_0x23bcfb[_0x0713('0x4c')](!![]);_0x39f6fb[_0x0713('0x4f')]();},_0x29ef0d);switch(_0x67514d[_0x0713('0x50')]){case _0x0713('0x51'):strategy[_0x0713('0x51')](_0x23bcfb,_0x67514d,_0x2f8447,_0x5b4705);break;default:strategy['beepall'](_0x23bcfb,_0x67514d,_0x2f8447,_0x5b4705);}}else{logger['error'](_0x0713('0x52'),_0x454708,_0x531ec9[_0x0713('0x33')]);_0x39f6fb[_0x0713('0x47')]();}}}catch(_0x37aa92){logger[_0x0713('0x37')](_0x0713('0x44'),_0x454708,_0x37aa92[_0x0713('0x53')]);_0x39f6fb[_0x0713('0x47')]();}};}; \ No newline at end of file +var _0xf66d=['list','QueueId','upperFirst','channel','interaction','MessageId','message','chat','AccountId','WebsiteId','info','name','QueueReport','create','error','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','next','strategy','rrmemory','beepall','stack','validate','util','seq-queue','routing','./strategy','redis','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/whatsappInteraction','string','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact'];(function(_0xe66f5a,_0x20056b){var _0x9f6f71=function(_0x85f64b){while(--_0x85f64b){_0xe66f5a['push'](_0xe66f5a['shift']());}};_0x9f6f71(++_0x20056b);}(_0xf66d,0x16c));var _0xdf66=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xf66d[_0x24237f];return _0x48298e;};'use strict';var schema=require(_0xdf66('0x0'));var _=require('lodash');var util=require(_0xdf66('0x1'));var seqqueue=require(_0xdf66('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xdf66('0x3'));var strategy=require(_0xdf66('0x4'));config['redis']=_['defaults'](config[_0xdf66('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xdf66('0x6'))(new Redis(config[_0xdf66('0x5')]));var attributes=['id',_0xdf66('0x7'),_0xdf66('0x8'),_0xdf66('0x9'),_0xdf66('0xa'),_0xdf66('0xb')];function emit(_0x29e1a7,_0x41c922,_0x2aac01){io['to'](_0x29e1a7)[_0xdf66('0xc')](_0x41c922,_0x2aac01);}function emitChannelQueueInteraction(_0x4af737,_0x5a5818,_0x35d6c5,_0x2b7214,_0x4e2c8a,_0x1a1788,_0xc11ad1,_0x12321a){var _0x40f66d=_[_0xdf66('0xd')](_0x35d6c5);_0x40f66d[_0xdf66('0x7')]=_0x12321a;_0x40f66d[_0xdf66('0x9')]=_0x5a5818;_0x40f66d[_0xdf66('0x8')]=_0x2b7214;_0x40f66d['id']=_0x4e2c8a;if(_0x1a1788){attributes[_0xdf66('0xe')](_[_0xdf66('0xf')](_0x4af737)+_0xdf66('0x10'));_0xc11ad1[util[_0xdf66('0x11')](_0xdf66('0x12'),_0x4af737)][_0x4e2c8a]=_[_0xdf66('0x13')](_0x40f66d,attributes);}else{delete _0xc11ad1[util[_0xdf66('0x11')](_0xdf66('0x12'),_0x4af737)][_0x4e2c8a];}emit(util['format'](_0xdf66('0x14'),_0x4af737,_0x5a5818),util[_0xdf66('0x11')](_0xdf66('0x15'),_0x4af737,_0x1a1788?'save':'remove'),_[_0xdf66('0x13')](_0x40f66d,attributes));}var rpc={'openchannelQueueReport':require(_0xdf66('0x16')),'mailQueueReport':require(_0xdf66('0x17')),'chatQueueReport':require(_0xdf66('0x18')),'smsQueueReport':require(_0xdf66('0x19')),'faxQueueReport':require(_0xdf66('0x1a')),'whatsappQueueReport':require(_0xdf66('0x1b')),'chatInteraction':require(_0xdf66('0x1c')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'whatsappInteraction':require(_0xdf66('0x1d'))};var queue=schema({'name':{'type':_0xdf66('0x1e'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xdf66('0x1f')}});function startRouting(_0x5ab185,_0x4d0ceb,_0x49d69c,_0x57439f){if(_0x5ab185&&_0x4d0ceb&&_0x49d69c){_0x4d0ceb[_0xdf66('0x20')]+=0x1;var _0xc4b5cd={'uniqueid':_0x5ab185,'from':_0x49d69c['body']?_0x49d69c[_0xdf66('0x21')]['from']:'','joinAt':moment()['format'](_0xdf66('0x22')),'ContactId':_0x49d69c[_0xdf66('0x23')]?_0x49d69c[_0xdf66('0x23')]['id']:null,'ListId':_0x49d69c[_0xdf66('0x24')]?_0x49d69c[_0xdf66('0x24')]['id']:null};_0xc4b5cd[_['upperFirst'](_0x49d69c['channel'])+_0xdf66('0x25')]=_0x4d0ceb['id']||null;_0xc4b5cd[_[_0xdf66('0x26')](_0x49d69c[_0xdf66('0x27')])+'InteractionId']=_0x49d69c[_0xdf66('0x28')]?_0x49d69c[_0xdf66('0x28')]['id']:null;_0xc4b5cd[_[_0xdf66('0x26')](_0x49d69c[_0xdf66('0x27')])+_0xdf66('0x29')]=_0x49d69c[_0xdf66('0x2a')]?_0x49d69c[_0xdf66('0x2a')]['id']:null;_0xc4b5cd[_[_0xdf66('0x26')](_0x49d69c[_0xdf66('0x27')])+(_0x49d69c[_0xdf66('0x27')]!==_0xdf66('0x2b')?_0xdf66('0x2c'):_0xdf66('0x2d'))]=_0x49d69c[_0xdf66('0x8')]?_0x49d69c[_0xdf66('0x8')]['id']:null;logger[_0xdf66('0x2e')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x5ab185,_0x4d0ceb[_0xdf66('0x2f')]));emitChannelQueueInteraction(_0x49d69c[_0xdf66('0x27')],_0x4d0ceb[_0xdf66('0x2f')],_0xc4b5cd,_0x49d69c[_0xdf66('0x8')]['name'],_0x49d69c[_0xdf66('0x2a')]['id'],!![],_0x57439f,_0x4d0ceb['id']);if(rpc[_0x49d69c[_0xdf66('0x27')]+_0xdf66('0x30')]){return rpc[_0x49d69c['channel']+_0xdf66('0x30')][_0xdf66('0x31')](_0xc4b5cd)['catch'](function(_0x341bc4){logger[_0xdf66('0x32')](_0xdf66('0x33'),_0x341bc4);});}}}function stopRouting(_0xcbe8cf,_0x29b168,_0x36129a,_0x47bb20){if(_0xcbe8cf&&_0x29b168){_0x29b168['waiting']-=0x1;var _0x31e8d3={'leaveAt':moment()[_0xdf66('0x11')](_0xdf66('0x22')),'acceptAt':moment()[_0xdf66('0x11')](_0xdf66('0x22')),'reason':_0xdf66('0x34')};logger[_0xdf66('0x2e')](util['format'](_0xdf66('0x35'),_0xcbe8cf,_0x29b168[_0xdf66('0x2f')]));emitChannelQueueInteraction(_0x36129a[_0xdf66('0x27')],_0x29b168['name'],_0x36129a['body'],_0x36129a[_0xdf66('0x8')]['name'],_0x36129a[_0xdf66('0x2a')]['id'],![],_0x47bb20,_0x29b168['id']);return rpc[_0x36129a[_0xdf66('0x27')]+_0xdf66('0x36')][_0xdf66('0x37')](_0x36129a[_0xdf66('0x28')]['id'],{'queueId':_0x29b168['id']})[_0xdf66('0x38')](function(){if(rpc[_0x36129a[_0xdf66('0x27')]+_0xdf66('0x30')]){return rpc[_0x36129a[_0xdf66('0x27')]+_0xdf66('0x30')][_0xdf66('0x37')](_0xcbe8cf,_0x31e8d3)[_0xdf66('0x39')](function(_0x1cf7c8){logger['error'](_0xdf66('0x3a'),_0x1cf7c8);});}});}}function endRouting(_0x3bc437,_0x289645,_0x2249f6,_0x1b97b5){if(_0x3bc437&&_0x289645){_0x289645['waiting']-=0x1;var _0x2e20e0={'leaveAt':moment()['format'](_0xdf66('0x22')),'exitAt':moment()[_0xdf66('0x11')](_0xdf66('0x22')),'reason':_0xdf66('0x3b')};logger['info'](util[_0xdf66('0x11')](_0xdf66('0x3c'),_0x3bc437,_0x289645[_0xdf66('0x2f')]));emitChannelQueueInteraction(_0x2249f6['channel'],_0x289645[_0xdf66('0x2f')],_0x2249f6[_0xdf66('0x21')],_0x2249f6[_0xdf66('0x8')]['name'],_0x2249f6[_0xdf66('0x2a')]['id'],![],_0x1b97b5);if(rpc[_0x2249f6['channel']+_0xdf66('0x30')]){return rpc[_0x2249f6['channel']+'QueueReport'][_0xdf66('0x37')](_0x3bc437,_0x2e20e0)[_0xdf66('0x39')](function(_0xd7cd99){logger[_0xdf66('0x32')](_0xdf66('0x3a'),_0xd7cd99);});}}}function handleFindQueue(_0x2a5446){return function(_0x38048f){return _0x38048f['name'][_0xdf66('0x3d')]()===_0x2a5446['toLowerCase']();};}exports[_0xdf66('0x3e')]=function(_0x1471c0,_0x21ea2b,_0x3702a0,_0x399e1a){return function(_0x2536c9){try{var _0x9056d7={'name':_0x21ea2b[0x0],'timeout':_0x21ea2b[0x1]};var _0x125266=queue[_0xdf66('0x0')](_0x9056d7,{'typecast':!![]});if(_0x125266['length']){logger[_0xdf66('0x32')](_0xdf66('0x3f'),_0x1471c0,_[_0xdf66('0x40')](_0x125266,_0xdf66('0x2a'))[_0xdf66('0x41')](',\x20'));_0x2536c9[_0xdf66('0x42')]();}else{var _0x4c5e71=_[_0xdf66('0x43')](_0x3702a0[_0x399e1a[_0xdf66('0x27')]+_0xdf66('0x44')],handleFindQueue(_0x9056d7['name']));if(_0x4c5e71){startRouting(_0x1471c0,_0x4c5e71,_0x399e1a,_0x3702a0);var _0x4748ee=(_0x4c5e71[_0xdf66('0x3b')]||0xa)*0x3e8;var _0x4febbf=(_0x9056d7[_0xdf66('0x3b')]||0x14)*0x3e8;var _0x58dec8;if(_0x4748ee>_0x4febbf){_0x4febbf=_0x4748ee;}var _0x533554=seqqueue[_0xdf66('0x45')](_0x4748ee);_0x533554['id']=_0x1471c0;_0x533554['atimeout']=_0x4748ee;_0x533554[_0xdf66('0x46')]=_0x4febbf;_0x533554[_0xdf66('0x27')]=_0x399e1a['channel'];_0x3702a0[_0xdf66('0x47')][_0x1471c0]['on'](_0xdf66('0x48'),function(){logger['info'](_0xdf66('0x49'),_0x1471c0);stopRouting(_0x1471c0,_0x4c5e71,_0x399e1a,_0x3702a0);clearTimeout(_0x58dec8);_0x58dec8=undefined;_0x533554[_0xdf66('0x4a')](!![]);if(_0x3702a0[_0xdf66('0x47')][_0x1471c0]){delete _0x3702a0[_0xdf66('0x47')][_0x1471c0];}_0x2536c9['stop']();});_0x3702a0[_0xdf66('0x47')][_0x1471c0]['on']('complete',function(){if(_0x3702a0[_0xdf66('0x47')][_0x1471c0]){delete _0x3702a0[_0xdf66('0x47')][_0x1471c0];}});_0x58dec8=setTimeout(function(){logger['info']('[%s][QUEUE]\x20APPLICATION\x20END',_0x1471c0);endRouting(_0x1471c0,_0x4c5e71,_0x399e1a,_0x3702a0);clearTimeout(_0x58dec8);_0x533554[_0xdf66('0x4a')](!![]);_0x2536c9[_0xdf66('0x4b')]();},_0x4febbf);switch(_0x4c5e71[_0xdf66('0x4c')]){case _0xdf66('0x4d'):strategy[_0xdf66('0x4d')](_0x533554,_0x4c5e71,_0x3702a0,_0x399e1a);break;default:strategy[_0xdf66('0x4e')](_0x533554,_0x4c5e71,_0x3702a0,_0x399e1a);}}else{logger[_0xdf66('0x32')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x1471c0,_0x9056d7[_0xdf66('0x2f')]);_0x2536c9['stop']();}}}catch(_0x2cf1cc){logger[_0xdf66('0x32')](_0xdf66('0x3f'),_0x1471c0,_0x2cf1cc[_0xdf66('0x4f')]);_0x2536c9[_0xdf66('0x42')]();}};}; \ 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 f42a13b..f2d907e 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 _0x0faf=['showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','debug','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification'];(function(_0x44c8e4,_0x1227a8){var _0xb9b8bf=function(_0x248c6a){while(--_0x248c6a){_0x44c8e4['push'](_0x44c8e4['shift']());}};_0xb9b8bf(++_0x1227a8);}(_0x0faf,0x132));var _0xf0fa=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x0faf[_0xf973b7];return _0x499087;};'use strict';var _=require(_0xf0fa('0x0'));var uuid=require('uuid');var util=require(_0xf0fa('0x1'));var logger=require(_0xf0fa('0x2'))(_0xf0fa('0x3'));var Agent=function(_0x35a260,_0xccb93e,_0xdc9ce3,_0x515b12){this[_0xf0fa('0x4')]=uuid['v4']();this[_0xf0fa('0x5')]=_0x35a260;this['agent']=_0xccb93e;this[_0xf0fa('0x6')]=_0xdc9ce3;this[_0xf0fa('0x3')]=_0x515b12;this[_0xf0fa('0x5')][_0xf0fa('0x7')](this[_0xf0fa('0x8')]['bind'](this),this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this['squeue']['on']('timeout',this[_0xf0fa('0x9')][_0xf0fa('0xa')](this));this[_0xf0fa('0x5')]['on'](_0xf0fa('0xb'),this[_0xf0fa('0xc')][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0x7')]=function(){this['squeue'][_0xf0fa('0x7')](this['handleRun'][_0xf0fa('0xa')](this),this['handleTimeout'][_0xf0fa('0xa')](this));};Agent[_0xf0fa('0xd')][_0xf0fa('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0xf0fa('0x8')]=function(){logger['debug'](_0xf0fa('0xe'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);if(_[_0xf0fa('0x10')](this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this[_0xf0fa('0x7')][_0xf0fa('0xa')](this),0x3e8);}else{if(this[_0xf0fa('0x3')][_0xf0fa('0x13')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],this[_0xf0fa('0x5')][_0xf0fa('0x14')],![])){this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x15')]=!![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x17')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this[_0xf0fa('0x5')][_0xf0fa('0x14')]);util[_0xf0fa('0x18')](this[_0xf0fa('0x4')],this['squeue']['id'],this[_0xf0fa('0x6')][_0xf0fa('0x11')][this['agent']['id']],null,this[_0xf0fa('0x3')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0xf0fa('0x1a')+(this[_0xf0fa('0x3')]['forcedOwnership']?':FORCED':''));}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1b'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);setTimeout(this['push'][_0xf0fa('0xa')](this),0x3e8);}}};Agent[_0xf0fa('0xd')][_0xf0fa('0x9')]=function(_0x5a4fd3){if(_[_0xf0fa('0x10')](this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']])){return logger[_0xf0fa('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);}else{logger[_0xf0fa('0x12')](_0xf0fa('0x1c'),this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0xf')]['id']);util['hideNotification'](this['notificationId'],this[_0xf0fa('0x5')]['id'],this[_0xf0fa('0x6')]['agents'][this[_0xf0fa('0xf')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf0fa('0xf')]['id']]['busy']=![];this[_0xf0fa('0x6')][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']][_0xf0fa('0x16')]=undefined;util[_0xf0fa('0x1d')](this[_0xf0fa('0x6')],this[_0xf0fa('0x3')],this[_0xf0fa('0xf')],this['squeue'][_0xf0fa('0x14')]);util[_0xf0fa('0x19')](this[_0xf0fa('0x5')]['id'],this['realtime'][_0xf0fa('0x11')][this[_0xf0fa('0xf')]['id']],_0x5a4fd3?_0xf0fa('0x1e'):_0xf0fa('0x1f'));}if(!_0x5a4fd3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f){return new Agent(_0x2a9f4b,_0x68b3fe,_0x2a6560,_0x47486f);}module[_0xf0fa('0x20')]=agent; \ No newline at end of file +var _0xaba6=['STOP','exports','lodash','uuid','notificationId','squeue','handleRun','bind','handleTimeout','drained','handleDrained','prototype','push','[%s][AGENT]\x20try\x20with\x20%s','agent','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xaba6,0xe2));var _0x6aba=function(_0x3403bd,_0x2231f2){_0x3403bd=_0x3403bd-0x0;var _0x5941f8=_0xaba6[_0x3403bd];return _0x5941f8;};'use strict';var _=require(_0x6aba('0x0'));var uuid=require(_0x6aba('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x596c18,_0x42fd1f,_0x5e8543,_0x58d8a8){this[_0x6aba('0x2')]=uuid['v4']();this[_0x6aba('0x3')]=_0x596c18;this['agent']=_0x42fd1f;this['realtime']=_0x5e8543;this['routing']=_0x58d8a8;this[_0x6aba('0x3')]['push'](this[_0x6aba('0x4')][_0x6aba('0x5')](this),this['handleTimeout'][_0x6aba('0x5')](this));this[_0x6aba('0x3')]['on']('timeout',this[_0x6aba('0x6')][_0x6aba('0x5')](this));this[_0x6aba('0x3')]['on'](_0x6aba('0x7'),this[_0x6aba('0x8')][_0x6aba('0x5')](this));};Agent[_0x6aba('0x9')]['push']=function(){this[_0x6aba('0x3')][_0x6aba('0xa')](this[_0x6aba('0x4')][_0x6aba('0x5')](this),this['handleTimeout'][_0x6aba('0x5')](this));};Agent[_0x6aba('0x9')]['handleDrained']=function(){this[_0x6aba('0x6')](!![]);};Agent[_0x6aba('0x9')][_0x6aba('0x4')]=function(){logger['debug'](_0x6aba('0xb'),this[_0x6aba('0x3')]['id'],this[_0x6aba('0xc')]['id']);if(_['isNil'](this[_0x6aba('0xd')][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']])){logger[_0x6aba('0xf')](_0x6aba('0x10'),this[_0x6aba('0x3')]['id'],this[_0x6aba('0xc')]['id']);setTimeout(this['push'][_0x6aba('0x5')](this),0x3e8);}else{if(this[_0x6aba('0x11')][_0x6aba('0x12')]||util['isAgentAvailable'](this[_0x6aba('0x3')]['id'],this['realtime']['agents'][this[_0x6aba('0xc')]['id']],this['squeue'][_0x6aba('0x13')],![])){this[_0x6aba('0xd')][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']][_0x6aba('0x14')]=!![];this[_0x6aba('0xd')][_0x6aba('0xe')][this['agent']['id']][_0x6aba('0x15')]=undefined;util[_0x6aba('0x16')](this[_0x6aba('0xd')],this[_0x6aba('0x11')],this[_0x6aba('0xc')],this[_0x6aba('0x3')][_0x6aba('0x13')]);util[_0x6aba('0x17')](this[_0x6aba('0x2')],this[_0x6aba('0x3')]['id'],this[_0x6aba('0xd')][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']],null,this[_0x6aba('0x11')]);util[_0x6aba('0x18')](this[_0x6aba('0x3')]['id'],this[_0x6aba('0xd')][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']],'RINGING'+(this['routing'][_0x6aba('0x12')]?':FORCED':''));}else{logger[_0x6aba('0xf')](_0x6aba('0x19'),this[_0x6aba('0x3')]['id'],this[_0x6aba('0xc')]['id']);setTimeout(this['push'][_0x6aba('0x5')](this),0x3e8);}}};Agent[_0x6aba('0x9')][_0x6aba('0x6')]=function(_0x660643){if(_[_0x6aba('0x1a')](this['realtime'][_0x6aba('0xe')][this['agent']['id']])){return logger[_0x6aba('0xf')](_0x6aba('0x10'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x6aba('0xf')](_0x6aba('0x1b'),this[_0x6aba('0x3')]['id'],this[_0x6aba('0xc')]['id']);util[_0x6aba('0x1c')](this[_0x6aba('0x2')],this[_0x6aba('0x3')]['id'],this['realtime'][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']],null,this[_0x6aba('0x11')]);this['realtime'][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']][_0x6aba('0x14')]=![];this['realtime'][_0x6aba('0xe')][this[_0x6aba('0xc')]['id']]['busyQueue']=undefined;util[_0x6aba('0x1d')](this['realtime'],this[_0x6aba('0x11')],this['agent'],this[_0x6aba('0x3')][_0x6aba('0x13')]);util['writeLog'](this['squeue']['id'],this[_0x6aba('0xd')]['agents'][this[_0x6aba('0xc')]['id']],_0x660643?_0x6aba('0x1e'):'TIMEOUT');}if(!_0x660643){setTimeout(this[_0x6aba('0xa')][_0x6aba('0x5')](this),0x3e8);}};function agent(_0x23d34a,_0x2b00f2,_0x8ca947,_0x19478e){return new Agent(_0x23d34a,_0x2b00f2,_0x8ca947,_0x19478e);}module[_0x6aba('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 fcbb15d..911a944 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 _0x8d9e=['busy','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','busyQueue','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','isNil','queue','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING'];(function(_0x42dfd1,_0x13f4d4){var _0x3b573c=function(_0x4de267){while(--_0x4de267){_0x42dfd1['push'](_0x42dfd1['shift']());}};_0x3b573c(++_0x13f4d4);}(_0x8d9e,0x1eb));var _0xe8d9=function(_0x443111,_0x3c94ae){_0x443111=_0x443111-0x0;var _0x3056c5=_0x8d9e[_0x443111];return _0x3056c5;};'use strict';var _=require(_0xe8d9('0x0'));var uuid=require(_0xe8d9('0x1'));var util=require(_0xe8d9('0x2'));var logger=require(_0xe8d9('0x3'))(_0xe8d9('0x4'));var Beepall=function(_0x1551ca,_0x2cb971,_0xdf447d,_0x41f802){this[_0xe8d9('0x5')]=uuid['v4']();this[_0xe8d9('0x6')]=_0x1551ca;this['queue']=_0x2cb971;this[_0xe8d9('0x7')]=_0xdf447d;this[_0xe8d9('0x4')]=_0x41f802;this[_0xe8d9('0x6')]['push'](this[_0xe8d9('0x8')][_0xe8d9('0x9')](this),this[_0xe8d9('0xa')]['bind'](this));this['squeue']['on'](_0xe8d9('0xb'),this[_0xe8d9('0xa')]['bind'](this));this[_0xe8d9('0x6')]['on'](_0xe8d9('0xc'),this[_0xe8d9('0xd')][_0xe8d9('0x9')](this));};Beepall[_0xe8d9('0xe')]['push']=function(){this['squeue'][_0xe8d9('0xf')](this[_0xe8d9('0x8')][_0xe8d9('0x9')](this),this['handleTimeout'][_0xe8d9('0x9')](this));};Beepall[_0xe8d9('0xe')]['handleDrained']=function(){this[_0xe8d9('0xa')](!![]);};Beepall[_0xe8d9('0xe')][_0xe8d9('0x8')]=function(){var _0x650ad7=!![];if(!_[_0xe8d9('0x10')](this[_0xe8d9('0x11')])&&!_['isNil'](this[_0xe8d9('0x11')][_0xe8d9('0x12')])&&this[_0xe8d9('0x11')]['Agents'][_0xe8d9('0x13')]>0x0){for(var _0x2e5f42=0x0,_0x35f684;_0x2e5f420x0){for(var _0x8e1dde=0x0,_0x420d96;_0x8e1dde0x0&&_0x129446[_0x4e264b+_0xee4c('0x1f')]>=_0x129446[_0x4e264b+'Capacity']){writeLog(_0x2fde01,_0x129446,_0x4e264b[_0xee4c('0x20')]()+_0xee4c('0x21'));return![];}}return!![];};exports[_0xee4c('0x22')]=function(_0x36a21c,_0x285a66,_0x3ba9d1,_0x1970b,_0x1c8cda){return sendNotification(!![],_0x36a21c,_0x285a66,_0x3ba9d1,_0x1970b,_0x1c8cda);};exports[_0xee4c('0x23')]=function(_0xd6ec84,_0x185762,_0x2fa82b,_0x5c220d,_0x2ca891){return sendNotification(![],_0xd6ec84,_0x185762,_0x2fa82b,_0x5c220d,_0x2ca891);};exports[_0xee4c('0x24')]=function(_0x182f93,_0x56129c,_0x5e298a){var _0x37dfb7=_0x56129c['interaction'][_0xee4c('0x25')];if(!_0x37dfb7&&_0x5e298a){_0x37dfb7=_0x5e298a['id'];}var _0xb6457f=_['some'](_0x182f93[_0x56129c[_0xee4c('0x26')]+_0xee4c('0x27')],function(_0x48740d){var _0x194493=_[_0xee4c('0x28')](_0x56129c['channel'])+_0xee4c('0x29');return _0x48740d[_0x194493]===_0x56129c['interaction']['id'];});if(!_0xb6457f&&_0x37dfb7&&_0x182f93[_0xee4c('0x2a')][_0x37dfb7]){_0xb6457f=_['some'](_0x182f93[_0xee4c('0x2a')][_0x37dfb7][_0x56129c[_0xee4c('0x26')]+_0xee4c('0x2b')],function(_0x5399ec){return _0x5399ec['id']===_0x56129c[_0xee4c('0x2c')]['id'];});}return _0xb6457f;};exports['saveWaitingNotification']=function(_0x379c9e,_0x5c7bf3,_0x5bd31d,_0xe200bd){if(_0x5bd31d&&_0x5bd31d['id']&&_0x379c9e[_0xee4c('0x2a')]&&_0x379c9e[_0xee4c('0x2a')][_0x5bd31d['id']]){_0x379c9e['agents'][_0x5bd31d['id']][_0xe200bd+_0xee4c('0x2b')][_0x5c7bf3[_0xee4c('0x10')]['id']]={'id':_0x5c7bf3[_0xee4c('0x2c')]['id']};}};exports[_0xee4c('0x2d')]=function(_0x186747,_0x1e91f8,_0x452f5c,_0x5ceace){if(_0x452f5c&&_0x452f5c['id']&&_0x186747['agents']&&_0x186747[_0xee4c('0x2a')][_0x452f5c['id']]){delete _0x186747[_0xee4c('0x2a')][_0x452f5c['id']][_0x5ceace+_0xee4c('0x2b')][_0x1e91f8[_0xee4c('0x10')]['id']];}};exports[_0xee4c('0x2e')]=writeLog; \ No newline at end of file +var _0xd3e7=['some','QueuesWaitingInteractions','capitalize','channel','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','lodash','../utils','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','\x20interaction','name','notificationShake','body','queue','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','emit','notification:%s','save','remove','debug','isAgentAvailable','BUSY','online','OFFLINE','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','interaction','UserId'];(function(_0x44aa01,_0x3a4f45){var _0x24bf84=function(_0x24deba){while(--_0x24deba){_0x44aa01['push'](_0x44aa01['shift']());}};_0x24bf84(++_0x3a4f45);}(_0xd3e7,0xb9));var _0x7d3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3e7[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x7d3e('0x0'));var util=require('util');var utils=require(_0x7d3e('0x1'));var Redis=require('ioredis');var config=require('../../../../../config/environment');var logger=require(_0x7d3e('0x2'))(_0x7d3e('0x3'));config[_0x7d3e('0x4')]=_[_0x7d3e('0x5')](config['redis'],{'host':_0x7d3e('0x6'),'port':0x18eb});var io=require(_0x7d3e('0x7'))(new Redis(config['redis']));function sendNotification(_0x1fc252,_0x356df3,_0x588503,_0x459d90,_0x9513dd,_0x322e34){var _0x49efe2=_0x322e34||{};var _0x1283ce=_0x588503['split']('.');var _0x1cb227={'uniqueid':_0x356df3,'channel':_0x1283ce[0x0],'id':_0x1283ce[0x1],'title':_0x1283ce[0x0]+_0x7d3e('0x8'),'interactionId':_0x1283ce[0x2],'queue':_0x9513dd?_0x9513dd[_0x7d3e('0x9')]:null,'sound':_0x49efe2['account']['notificationSound'],'shake':_0x49efe2['account'][_0x7d3e('0xa')]};try{if(!_0x49efe2[_0x7d3e('0xb')]){_0x49efe2['body']={};}if(_0x9513dd){_0x49efe2[_0x7d3e('0xb')][_0x7d3e('0xc')]=_0x9513dd;}else if(_0x49efe2[_0x7d3e('0xb')][_0x7d3e('0xc')]){delete _0x49efe2['body'][_0x7d3e('0xc')];}_0x1cb227['msg']=utils['getMustacheRender'](_0x49efe2['account']['notificationTemplate'],_0x49efe2);}catch(_0x463dc1){_0x1cb227['msg']=_0x7d3e('0xd');logger[_0x7d3e('0xe')](util[_0x7d3e('0xf')](_0x7d3e('0x10'),_0x356df3,_0x463dc1[_0x7d3e('0x11')]));}io['to'](util['format']('user:%s',_0x459d90[_0x7d3e('0x9')]))[_0x7d3e('0x12')](util['format'](_0x7d3e('0x13'),_0x1fc252?_0x7d3e('0x14'):_0x7d3e('0x15')),_0x1cb227);}function writeLog(_0x2c6ae,_0x448f84,_0x231653){return logger[_0x7d3e('0x16')](util[_0x7d3e('0xf')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2c6ae,_0x448f84[_0x7d3e('0x9')],_0x231653));}exports[_0x7d3e('0x17')]=function(_0x1a3182,_0x1fe449,_0x142c8a,_0x331252){if(_0x1fe449['busy']){writeLog(_0x1a3182,_0x1fe449,_0x7d3e('0x18'));return![];}if(!_0x1fe449[_0x7d3e('0x19')]){writeLog(_0x1a3182,_0x1fe449,_0x7d3e('0x1a'));return![];}if(_0x1fe449[_0x142c8a+'Pause']){writeLog(_0x1a3182,_0x1fe449,_0x7d3e('0x1b'));return![];}if(_0x331252&&_0x1fe449[_0x7d3e('0x1c')](_0x142c8a+_0x7d3e('0x1d'))&&_0x1fe449['hasOwnProperty'](_0x142c8a+_0x7d3e('0x1e'))){if(_0x1fe449[_0x142c8a+'Capacity']>0x0&&_0x1fe449[_0x142c8a+_0x7d3e('0x1e')]>=_0x1fe449[_0x142c8a+_0x7d3e('0x1d')]){writeLog(_0x1a3182,_0x1fe449,_0x142c8a[_0x7d3e('0x1f')]()+_0x7d3e('0x20'));return![];}}return!![];};exports['showNotification']=function(_0x56734e,_0x35056f,_0x273f2c,_0x960cf4,_0x45490b){return sendNotification(!![],_0x56734e,_0x35056f,_0x273f2c,_0x960cf4,_0x45490b);};exports['hideNotification']=function(_0x399a15,_0x5ca798,_0xd7ba93,_0x2f5a92,_0x2e5d59){return sendNotification(![],_0x399a15,_0x5ca798,_0xd7ba93,_0x2f5a92,_0x2e5d59);};exports['checkWaitingNotifications']=function(_0x117faf,_0x1191bd,_0x3bb5c1){var _0xa5b344=_0x1191bd[_0x7d3e('0x21')][_0x7d3e('0x22')];if(!_0xa5b344&&_0x3bb5c1){_0xa5b344=_0x3bb5c1['id'];}var _0x5501a5=_[_0x7d3e('0x23')](_0x117faf[_0x1191bd['channel']+_0x7d3e('0x24')],function(_0x44d6b7){var _0x1dd0ca=_[_0x7d3e('0x25')](_0x1191bd[_0x7d3e('0x26')])+_0x7d3e('0x27');return _0x44d6b7[_0x1dd0ca]===_0x1191bd[_0x7d3e('0x21')]['id'];});if(!_0x5501a5&&_0xa5b344&&_0x117faf['agents'][_0xa5b344]){_0x5501a5=_[_0x7d3e('0x23')](_0x117faf[_0x7d3e('0x28')][_0xa5b344][_0x1191bd['channel']+_0x7d3e('0x29')],function(_0x2a8572){return _0x2a8572['id']===_0x1191bd['interaction']['id'];});}return _0x5501a5;};exports[_0x7d3e('0x2a')]=function(_0x3717d0,_0x280630,_0x1abc6a,_0x3f0e31){if(_0x1abc6a&&_0x1abc6a['id']&&_0x3717d0[_0x7d3e('0x28')]&&_0x3717d0[_0x7d3e('0x28')][_0x1abc6a['id']]){_0x3717d0['agents'][_0x1abc6a['id']][_0x3f0e31+_0x7d3e('0x29')][_0x280630[_0x7d3e('0x11')]['id']]={'id':_0x280630[_0x7d3e('0x21')]['id']};}};exports[_0x7d3e('0x2b')]=function(_0x4c6c9b,_0x3f0832,_0x2e227e,_0x2d011b){if(_0x2e227e&&_0x2e227e['id']&&_0x4c6c9b[_0x7d3e('0x28')]&&_0x4c6c9b[_0x7d3e('0x28')][_0x2e227e['id']]){delete _0x4c6c9b[_0x7d3e('0x28')][_0x2e227e['id']][_0x2d011b+_0x7d3e('0x29')][_0x3f0832['message']['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index f75798d..20e0aa8 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 _0x5210=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','exec','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','message','info'];(function(_0x590a38,_0x2bc65c){var _0xf36626=function(_0x551cd1){while(--_0x551cd1){_0x590a38['push'](_0x590a38['shift']());}};_0xf36626(++_0x2bc65c);}(_0x5210,0x164));var _0x0521=function(_0x582832,_0x275ed9){_0x582832=_0x582832-0x0;var _0x1cb843=_0x5210[_0x582832];return _0x1cb843;};'use strict';var schema=require(_0x0521('0x0'));var sh=require(_0x0521('0x1'));var _=require(_0x0521('0x2'));var utils=require(_0x0521('0x3'));var logger=require('../../../../config/logger')(_0x0521('0x4'));var system=schema({'command':{'type':_0x0521('0x5'),'required':!![],'message':_0x0521('0x6')}});exports[_0x0521('0x7')]=function(_0x59b199,_0x30264f){return function(_0x531bff){try{var _0x430a25={'command':_0x30264f[0x0]};var _0x3d56b4=system[_0x0521('0x0')](_0x430a25,{'typecast':!![]});if(_0x3d56b4[_0x0521('0x8')]){logger[_0x0521('0x9')]('[%s][SYSTEM]\x20%s',_0x59b199,_['map'](_0x3d56b4,_0x0521('0xa'))['join'](',\x20'));logger[_0x0521('0xb')](_0x0521('0xc'),_0x59b199);_0x531bff[_0x0521('0xd')]();}else{var _0x17cbf5=this;var _0x286827=utils['getMustacheRender'](_0x30264f[0x0],this);logger[_0x0521('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x59b199,_0x286827);sh[_0x0521('0xe')](_['trim'](_0x286827),function(_0x250341,_0x21bd6b){logger[_0x0521('0xb')](_0x0521('0xf'),_0x59b199,_0x250341);if(_0x250341==0x0){var _0x14ae00=_0x21bd6b['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x0521('0x10')](_0x30264f[0x1])||_[_0x0521('0x11')](_0x30264f[0x1])){logger[_0x0521('0xb')](_0x0521('0x12'),_0x59b199);_0x17cbf5['body'][_0x30264f[0x1]]=_0x14ae00;}else{logger[_0x0521('0xb')](_0x0521('0x13'),_0x59b199,_0x30264f[0x1],_0x14ae00);_0x17cbf5['body'][_0x30264f[0x1]]=_0x14ae00;}}_0x531bff[_0x0521('0xd')]();});}}catch(_0x38884c){logger[_0x0521('0x9')](_0x0521('0x14'),_0x59b199,_[_0x0521('0x15')](_0x38884c)?JSON[_0x0521('0x16')](_0x38884c):_0x38884c);logger[_0x0521('0xb')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x59b199);_0x531bff[_0x0521('0xd')]();}};}; \ No newline at end of file +var _0x794d=['./utils','../../../../config/logger','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','isObject','stringify','validate','shelljs'];(function(_0x24c3a2,_0x5a4369){var _0x23be42=function(_0x91068f){while(--_0x91068f){_0x24c3a2['push'](_0x24c3a2['shift']());}};_0x23be42(++_0x5a4369);}(_0x794d,0x1c0));var _0xd794=function(_0x51c440,_0x3b6802){_0x51c440=_0x51c440-0x0;var _0x67a2d6=_0x794d[_0x51c440];return _0x67a2d6;};'use strict';var schema=require(_0xd794('0x0'));var sh=require(_0xd794('0x1'));var _=require('lodash');var utils=require(_0xd794('0x2'));var logger=require(_0xd794('0x3'))('routing');var system=schema({'command':{'type':'string','required':!![],'message':_0xd794('0x4')}});exports[_0xd794('0x5')]=function(_0x1160ca,_0x49dee3){return function(_0x5e9649){try{var _0x3bfe93={'command':_0x49dee3[0x0]};var _0x4ac3a9=system[_0xd794('0x0')](_0x3bfe93,{'typecast':!![]});if(_0x4ac3a9['length']){logger[_0xd794('0x6')](_0xd794('0x7'),_0x1160ca,_[_0xd794('0x8')](_0x4ac3a9,_0xd794('0x9'))[_0xd794('0xa')](',\x20'));logger[_0xd794('0xb')](_0xd794('0xc'),_0x1160ca);_0x5e9649[_0xd794('0xd')]();}else{var _0x38dd99=this;var _0x55d262=utils[_0xd794('0xe')](_0x49dee3[0x0],this);logger['info'](_0xd794('0xf'),_0x1160ca,_0x55d262);sh[_0xd794('0x10')](_[_0xd794('0x11')](_0x55d262),function(_0xde0ad6,_0x10ee32){logger[_0xd794('0xb')](_0xd794('0x12'),_0x1160ca,_0xde0ad6);if(_0xde0ad6==0x0){var _0x234a18=_0x10ee32['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0xd794('0x13')](_0x49dee3[0x1])||_[_0xd794('0x14')](_0x49dee3[0x1])){logger[_0xd794('0xb')](_0xd794('0x15'),_0x1160ca);_0x38dd99[_0xd794('0x16')][_0x49dee3[0x1]]=_0x234a18;}else{logger[_0xd794('0xb')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x1160ca,_0x49dee3[0x1],_0x234a18);_0x38dd99[_0xd794('0x16')][_0x49dee3[0x1]]=_0x234a18;}}_0x5e9649[_0xd794('0xd')]();});}}catch(_0x340899){logger[_0xd794('0x6')](_0xd794('0x7'),_0x1160ca,_[_0xd794('0x17')](_0x340899)?JSON[_0xd794('0x18')](_0x340899):_0x340899);logger['info'](_0xd794('0xc'),_0x1160ca);_0x5e9649[_0xd794('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 d1ddae7..1731e83 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 _0x4166=['catch','stringify','finally','isObject','lodash','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4166,0x143));var _0x6416=function(_0x162ef7,_0x4a0cc9){_0x162ef7=_0x162ef7-0x0;var _0x2789e5=_0x4166[_0x162ef7];return _0x2789e5;};'use strict';var schema=require('validate');var _=require(_0x6416('0x0'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6416('0x1')),'mailInteraction':require(_0x6416('0x2')),'faxInteraction':require(_0x6416('0x3')),'whatsappInteraction':require(_0x6416('0x4'))};var logger=require(_0x6416('0x5'))(_0x6416('0x6'));var tag=schema({'tag':{'type':_0x6416('0x7'),'required':!![],'message':_0x6416('0x8')}});exports[_0x6416('0x9')]=function(_0x382587,_0x4ce270,_0x55a045,_0x3079fc){return function(_0x44c24d){try{var _0x3b0fd3={'tag':_0x4ce270[0x0]};var _0x13c40f=tag[_0x6416('0xa')](_0x3b0fd3,{'typecast':!![]});if(_0x13c40f[_0x6416('0xb')]){logger[_0x6416('0xc')](_0x6416('0xd'),_0x382587,_[_0x6416('0xe')](_0x13c40f,_0x6416('0xf'))[_0x6416('0x10')](',\x20'));logger[_0x6416('0x11')](_0x6416('0x12'),_0x382587);_0x44c24d[_0x6416('0x13')]();}else{var _0x2c0627={'ids':[_0x4ce270[0x0]]};if(rpc[_0x3079fc[_0x6416('0x14')]+'Interaction']){rpc[_0x3079fc['channel']+_0x6416('0x15')][_0x6416('0x16')](_0x3079fc[_0x6416('0x17')]['id'],_0x2c0627)[_0x6416('0x18')](function(_0x296719){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x382587,_0x4ce270[0x1],_0x3079fc[_0x6416('0x14')],_0x3079fc[_0x6416('0x17')]['id']);})[_0x6416('0x19')](function(_0x56110e){logger[_0x6416('0xc')]('[%s][TAG]\x20%s',_0x382587,JSON[_0x6416('0x1a')](_0x56110e));logger[_0x6416('0x11')](_0x6416('0x12'),_0x382587);})[_0x6416('0x1b')](function(){_0x44c24d[_0x6416('0x13')]();});}}}catch(_0x766578){logger[_0x6416('0xc')](_0x6416('0xd'),_0x382587,_[_0x6416('0x1c')](_0x766578)?JSON[_0x6416('0x1a')](_0x766578):_0x766578);logger['info'](_0x6416('0x12'),_0x382587);_0x44c24d['next']();}};}; \ No newline at end of file +var _0xda01=['finally','validate','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','info','next','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','channel','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xda01,0x1bb));var _0x1da0=function(_0x5833dd,_0xa5d4ea){_0x5833dd=_0x5833dd-0x0;var _0x57d451=_0xda01[_0x5833dd];return _0x57d451;};'use strict';var schema=require(_0x1da0('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x1da0('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1da0('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x1da0('0x3')),'whatsappInteraction':require(_0x1da0('0x4'))};var logger=require(_0x1da0('0x5'))(_0x1da0('0x6'));var tag=schema({'tag':{'type':_0x1da0('0x7'),'required':!![],'message':_0x1da0('0x8')}});exports[_0x1da0('0x9')]=function(_0x227f05,_0x2b69d4,_0x173404,_0x2e0907){return function(_0x2e8f2b){try{var _0x329c6f={'tag':_0x2b69d4[0x0]};var _0x5e2f69=tag[_0x1da0('0x0')](_0x329c6f,{'typecast':!![]});if(_0x5e2f69['length']){logger[_0x1da0('0xa')](_0x1da0('0xb'),_0x227f05,_[_0x1da0('0xc')](_0x5e2f69,_0x1da0('0xd'))['join'](',\x20'));logger[_0x1da0('0xe')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x227f05);_0x2e8f2b[_0x1da0('0xf')]();}else{var _0x4a83f3={'ids':[_0x2b69d4[0x0]]};if(rpc[_0x2e0907['channel']+'Interaction']){rpc[_0x2e0907['channel']+_0x1da0('0x10')][_0x1da0('0x11')](_0x2e0907[_0x1da0('0x12')]['id'],_0x4a83f3)[_0x1da0('0x13')](function(_0x294c0b){logger['info'](_0x1da0('0x14'),_0x227f05,_0x2b69d4[0x1],_0x2e0907[_0x1da0('0x15')],_0x2e0907[_0x1da0('0x12')]['id']);})[_0x1da0('0x16')](function(_0x5d9c96){logger['error'](_0x1da0('0xb'),_0x227f05,JSON[_0x1da0('0x17')](_0x5d9c96));logger[_0x1da0('0xe')](_0x1da0('0x18'),_0x227f05);})[_0x1da0('0x19')](function(){_0x2e8f2b[_0x1da0('0xf')]();});}}}catch(_0x3e2e3e){logger['error'](_0x1da0('0xb'),_0x227f05,_['isObject'](_0x3e2e3e)?JSON[_0x1da0('0x17')](_0x3e2e3e):_0x3e2e3e);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x227f05);_0x2e8f2b[_0x1da0('0xf')]();}};}; \ 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 2a2d38a..7ab4890 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 _0xf55b=['logged','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','2.0','login','stringify','application/json-rpc','then','parse','result'];(function(_0x3b0731,_0xcf9925){var _0x4204d7=function(_0x635ac5){while(--_0x635ac5){_0x3b0731['push'](_0x3b0731['shift']());}};_0x4204d7(++_0xcf9925);}(_0xf55b,0x11c));var _0xbf55=function(_0x8a9196,_0x2309a3){_0x8a9196=_0x8a9196-0x0;var _0x290b82=_0xf55b[_0x8a9196];return _0x290b82;};'use strict';var rp=require('request-promise');var logger=require(_0xbf55('0x0'))(_0xbf55('0x1'));var _=require(_0xbf55('0x2'));var arr=[];exports['consequence']=function(_0x2a4e56,_0x452466){return function(_0x18b795){var _0x2b7023=_0x452466[0xa];var _0x78f57=_0x452466[0xb];var _0x40b5b0=_0x452466[0xc];var _0x303e75=_0x452466[0xd];var _0x429c23=_0x452466[0xe];var _0x3eba66=_0x452466[0xf][_0xbf55('0x3')](/\n/g,_0xbf55('0x4'));var _0x2c33f5=_0x452466[0x10][_0xbf55('0x3')](/\n/g,'\x20');if(!arr[_0xbf55('0x5')](_0x78f57)){arr[_0xbf55('0x6')](_0x78f57);var _0x259935=_0x452466[0x3];var _0x2ad0ac=_0x452466[0x4];var _0x79fe9e=_0x452466[0x1];var _0x18f333=_0x452466[0x0];var _0x4c3d02={};_0x4c3d02[_0xbf55('0x7')]=_0x452466[0x8]+_0xbf55('0x8')+_0x40b5b0+'|'+_0x2b7023+'|'+_0x303e75+'|'+_0x78f57+'|'+_0x429c23;_0x4c3d02['urlOnRing']=_0x452466[0x7]+'?params='+_0x40b5b0+'|'+_0x2b7023+'|'+_0x303e75+'|'+_0x78f57+'|'+_0x429c23+'|'+_0x3eba66+'|'+_0x2c33f5;_0x4c3d02['title']=_0x452466[0x9];var _0x4ab9fc={};_0x4ab9fc['jsonrpc']=_0xbf55('0x9');_0x4ab9fc['method']=_0xbf55('0xa');var _0x6cc4c=[];_0x6cc4c['push'](_0x452466[0x2]);_0x6cc4c[_0xbf55('0x6')](_0x452466[0x5]);_0x6cc4c[_0xbf55('0x6')](_0x452466[0x6]);_0x4ab9fc['params']=_0x6cc4c;_0x4ab9fc['id']=0x1;var _0x42d410=JSON[_0xbf55('0xb')](_0x4ab9fc);var _0x30fa45={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0x259935,'headers':{'Content-Type':_0xbf55('0xc')},'body':_0x42d410};return rp(_0x30fa45)[_0xbf55('0xd')](function(_0x4ddf95){const _0x5cf800=JSON[_0xbf55('0xe')](_0x4ddf95);if(!_0x5cf800[_0xbf55('0xf')][_0xbf55('0x10')]){throw new Error(_0xbf55('0x11'));}var _0x5136fa=_0x78f57;var _0x59fd89=_0xbf55('0x12')+_0x79fe9e+_0xbf55('0x13')+_0x18f333+_0xbf55('0x14')+_0x5136fa+'&data='+JSON[_0xbf55('0xb')](_0x4c3d02);var _0x4b0693=_0x2ad0ac+'?'+_0x59fd89;return rp(_0x4b0693);})[_0xbf55('0xd')](function(_0x4fdfe7){logger[_0xbf55('0x15')](_0xbf55('0x16'),_0x2a4e56,_0x4fdfe7);_0x18b795['stop']();})[_0xbf55('0x17')](function(_0x48bb92){logger[_0xbf55('0x18')](_0xbf55('0x19'),_0x2a4e56,_[_0xbf55('0x1a')](_0x48bb92)?JSON[_0xbf55('0xb')](_0x48bb92):_0x48bb92);_0x18b795[_0xbf55('0x1b')]();});}else{logger[_0xbf55('0x15')](_0xbf55('0x1c'),_0x2a4e56);_0x18b795[_0xbf55('0x1d')]();}};}; \ No newline at end of file +var _0xe0b3=['&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','error','[%s][TVOX]\x20%s','isObject','next','request-promise','../../../../config/logger','routing','lodash','consequence','\x20-\x20','replace','push','urlOnAnswer','?params=','urlOnRing','title','method','login','stringify','utf8','POST','application/json-rpc','then','parse','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId='];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0xe0b3,0xc3));var _0x3e0b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xe0b3[_0x122ef9];return _0x42fba0;};'use strict';var rp=require(_0x3e0b('0x0'));var logger=require(_0x3e0b('0x1'))(_0x3e0b('0x2'));var _=require(_0x3e0b('0x3'));var arr=[];exports[_0x3e0b('0x4')]=function(_0x1d2651,_0xfb6b79){return function(_0x200e02){var _0x6970e7=_0xfb6b79[0xa];var _0x7305af=_0xfb6b79[0xb];var _0x31cce6=_0xfb6b79[0xc];var _0x27313d=_0xfb6b79[0xd];var _0x4943ea=_0xfb6b79[0xe];var _0x98e007=_0xfb6b79[0xf]['replace'](/\n/g,_0x3e0b('0x5'));var _0x19acd0=_0xfb6b79[0x10][_0x3e0b('0x6')](/\n/g,'\x20');if(!arr['includes'](_0x7305af)){arr[_0x3e0b('0x7')](_0x7305af);var _0x55e9c7=_0xfb6b79[0x3];var _0x2d36bd=_0xfb6b79[0x4];var _0x100301=_0xfb6b79[0x1];var _0x49cae0=_0xfb6b79[0x0];var _0x24fe1a={};_0x24fe1a[_0x3e0b('0x8')]=_0xfb6b79[0x8]+_0x3e0b('0x9')+_0x31cce6+'|'+_0x6970e7+'|'+_0x27313d+'|'+_0x7305af+'|'+_0x4943ea;_0x24fe1a[_0x3e0b('0xa')]=_0xfb6b79[0x7]+_0x3e0b('0x9')+_0x31cce6+'|'+_0x6970e7+'|'+_0x27313d+'|'+_0x7305af+'|'+_0x4943ea+'|'+_0x98e007+'|'+_0x19acd0;_0x24fe1a[_0x3e0b('0xb')]=_0xfb6b79[0x9];var _0x2e9b6f={};_0x2e9b6f['jsonrpc']='2.0';_0x2e9b6f[_0x3e0b('0xc')]=_0x3e0b('0xd');var _0xb1d7e8=[];_0xb1d7e8[_0x3e0b('0x7')](_0xfb6b79[0x2]);_0xb1d7e8['push'](_0xfb6b79[0x5]);_0xb1d7e8['push'](_0xfb6b79[0x6]);_0x2e9b6f['params']=_0xb1d7e8;_0x2e9b6f['id']=0x1;var _0x49e2c4=JSON[_0x3e0b('0xe')](_0x2e9b6f);var _0x4be9ee={'encoding':_0x3e0b('0xf'),'method':_0x3e0b('0x10'),'timeout':0x2710,'url':_0x55e9c7,'headers':{'Content-Type':_0x3e0b('0x11')},'body':_0x49e2c4};return rp(_0x4be9ee)[_0x3e0b('0x12')](function(_0x4701a9){const _0x14a017=JSON[_0x3e0b('0x13')](_0x4701a9);if(!_0x14a017['result']['logged']){throw new Error(_0x3e0b('0x14'));}var _0x64542c=_0x7305af;var _0x4c13c3='channelId='+_0x100301+_0x3e0b('0x15')+_0x49cae0+_0x3e0b('0x16')+_0x64542c+_0x3e0b('0x17')+JSON[_0x3e0b('0xe')](_0x24fe1a);var _0x1e84fb=_0x2d36bd+'?'+_0x4c13c3;return rp(_0x1e84fb);})['then'](function(_0x501a9a){logger[_0x3e0b('0x18')](_0x3e0b('0x19'),_0x1d2651,_0x501a9a);_0x200e02[_0x3e0b('0x1a')]();})['catch'](function(_0x50229d){logger[_0x3e0b('0x1b')](_0x3e0b('0x1c'),_0x1d2651,_[_0x3e0b('0x1d')](_0x50229d)?JSON[_0x3e0b('0xe')](_0x50229d):_0x50229d);_0x200e02[_0x3e0b('0x1a')]();});}else{logger[_0x3e0b('0x18')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x1d2651);_0x200e02[_0x3e0b('0x1e')]();}};}; \ 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 fb8e773..b429e5e 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x1ed1b4,_0x4d4e90){var _0x441e08=function(_0x2612fc){while(--_0x2612fc){_0x1ed1b4['push'](_0x1ed1b4['shift']());}};_0x441e08(++_0x4d4e90);}(_0xe706,0xa3));var _0x6e70=function(_0x1d669e,_0x4921c9){_0x1d669e=_0x1d669e-0x0;var _0x1d1ec7=_0xe706[_0x1d669e];return _0x1d1ec7;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x42610b,_0x3e12d9){var _0x36166b=function(_0x42155f){while(--_0x42155f){_0x42610b['push'](_0x42610b['shift']());}};_0x36166b(++_0x3e12d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 8cd2d25..3ce0ce1 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 _0x6f7c=['whatsappQueuesWaitingInteractions','http','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/whatsappQueueReport','format','isNil','IntervalId','map','Intervals','interval','listen','rules','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','split','mail','push','slice','appdata','dialogflowv2','amazonlex','TagId','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','find','chatQueues','name','paused','waiting','mailQueues','available','loggedIn','openchannelQueues','smsQueues','faxQueues','whatsappQueues','values','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions'];(function(_0x40da5d,_0x2a76fd){var _0x46d172=function(_0x2a1d01){while(--_0x2a1d01){_0x40da5d['push'](_0x40da5d['shift']());}};_0x46d172(++_0x2a76fd);}(_0x6f7c,0x137));var _0xc6f7=function(_0x59d47d,_0x1cd52c){_0x59d47d=_0x59d47d-0x0;var _0x55aa55=_0x6f7c[_0x59d47d];return _0x55aa55;};'use strict';var _=require(_0xc6f7('0x0'));var util=require(_0xc6f7('0x1'));var path=require(_0xc6f7('0x2'));var fs=require('fs');var jayson=require(_0xc6f7('0x3'));var BPromise=require(_0xc6f7('0x4'));var utils=require(_0xc6f7('0x5'));var sUtils=require(_0xc6f7('0x6'));var logger=require(_0xc6f7('0x7'))('routing');var rpc={'openchannelQueueReport':require(_0xc6f7('0x8')),'mailQueueReport':require(_0xc6f7('0x9')),'chatQueueReport':require(_0xc6f7('0xa')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xc6f7('0xb'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3da8fe,_0x5325f8,_0x5406b3){return util[_0xc6f7('0xc')]('%s.%s.%s',_0x3da8fe,_0x5325f8||0x0,_0x5406b3||0x0);}function getIntervals(_0x46c779,_0xaeebac){var _0x1cce28=[];if(!_[_0xc6f7('0xd')](_0xaeebac[_0xc6f7('0xe')])&&!_[_0xc6f7('0xd')](_0x46c779[_0xaeebac[_0xc6f7('0xe')]])&&!_[_0xc6f7('0xd')](_0x46c779[_0xaeebac[_0xc6f7('0xe')]]['Intervals'])){_0x1cce28=_[_0xc6f7('0xf')](_0x46c779[_0xaeebac['IntervalId']][_0xc6f7('0x10')],_0xc6f7('0x11'));}else if(!_[_0xc6f7('0xd')](_0xaeebac[_0xc6f7('0x11')])){_0x1cce28=[_0xaeebac[_0xc6f7('0x11')]];}return _0x1cce28;}exports[_0xc6f7('0x12')]=function(_0x4d08e7){_0x4d08e7[_0xc6f7('0x13')]={};return new BPromise(function(_0x52565d,_0x20b428){var _0x4164b5={'Start':function(_0x468789){var _0x2981e8=this;return new Promise(function(_0x15e1a7,_0x484500){if(_0x468789){try{var _0xe54b8d=[];var _0x31ca50=getId(_0x468789[_0xc6f7('0x14')],_0x468789[_0xc6f7('0x15')]?_0x468789[_0xc6f7('0x15')]['id']:0x0,_0x468789['interaction']?_0x468789[_0xc6f7('0x16')]['id']:0x0);var _0x50bb0c=sUtils['checkWaitingNotifications'](_0x4d08e7,_0x468789);if(_0x468789[_0xc6f7('0x17')]||!_0x50bb0c&&_0x468789[_0xc6f7('0x18')]&&_[_0xc6f7('0x19')](_0x468789[_0xc6f7('0x18')])&&_0x468789[_0xc6f7('0x18')][_0xc6f7('0x1a')]){for(var _0xd2445f=0x0;_0xd2445f<_0x468789['applications'][_0xc6f7('0x1a')];_0xd2445f+=0x1){var _0x2dc376=_0x468789[_0xc6f7('0x18')][_0xd2445f];if(fs[_0xc6f7('0x1b')](path[_0xc6f7('0x1c')](__dirname,_0xc6f7('0x18'),_0x2dc376[_0xc6f7('0x1d')]+_0xc6f7('0x1e')))){var _0x418678=[];switch(_0x2dc376[_0xc6f7('0x1d')][_0xc6f7('0x1f')]()){case'autoreply':var _0x34b52a=_0x2dc376['appdata'][_0xc6f7('0x20')](',');if(_0x468789[_0xc6f7('0x14')]===_0xc6f7('0x21')){_0x418678[_0xc6f7('0x22')](_0x34b52a[0x0]);_0x418678[_0xc6f7('0x22')](_0x34b52a[0x1]);_0x418678[_0xc6f7('0x22')](_0x34b52a[_0xc6f7('0x23')](0x2,_0x34b52a[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));}else{_0x418678[_0xc6f7('0x22')](_0x34b52a[0x0]);_0x418678['push'](_0x34b52a[_0xc6f7('0x23')](0x1,_0x34b52a[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));}break;case'dialogflow':var _0x2e8444=_0x2dc376[_0xc6f7('0x24')][_0xc6f7('0x20')](',');_0x418678['push'](_0x2e8444[0x0]);_0x418678['push'](_0x2e8444[0x1]);_0x418678[_0xc6f7('0x22')](_0x2e8444[_0xc6f7('0x23')](0x2,_0x2e8444[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));break;case _0xc6f7('0x25'):var _0x5befb4=_0x2dc376[_0xc6f7('0x24')][_0xc6f7('0x20')](',');_0x418678[_0xc6f7('0x22')](_0x5befb4[0x0]);_0x418678[_0xc6f7('0x22')](_0x5befb4[0x1]);_0x418678[_0xc6f7('0x22')](_0x5befb4[0x2]);_0x418678[_0xc6f7('0x22')](_0x5befb4[0x3]);_0x418678[_0xc6f7('0x22')](_0x5befb4['slice'](0x4,_0x5befb4[_0xc6f7('0x1a')])['join'](','));break;case _0xc6f7('0x26'):var _0x4b4213=_0x2dc376[_0xc6f7('0x24')][_0xc6f7('0x20')](',');_0x418678['push'](_0x4b4213[0x0]);_0x418678['push'](_0x4b4213[0x1]);_0x418678[_0xc6f7('0x22')](_0x4b4213[0x2]);_0x418678[_0xc6f7('0x22')](_0x4b4213[0x3]);_0x418678[_0xc6f7('0x22')](_0x4b4213[_0xc6f7('0x23')](0x4,_0x4b4213[_0xc6f7('0x1a')])[_0xc6f7('0x1c')](','));break;case _0xc6f7('0x15'):_0x418678['push'](_0x2dc376[_0xc6f7('0x24')]);break;case'tag':_0x418678['push'](_0x2dc376[_0xc6f7('0x27')]);_0x418678[_0xc6f7('0x22')](_0x2dc376[_0xc6f7('0x24')]);break;case'tvox':var _0x2f47b3=utils[_0xc6f7('0x28')](_0x468789[_0xc6f7('0x29')][_0xc6f7('0x2a')],_0x468789);var _0x54cb47=_0x2dc376['appdata'][_0xc6f7('0x20')](',');_0x418678['push'](_0x54cb47[0x0]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x1]);_0x418678['push'](_0x54cb47[0x2]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x3]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x4]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x5]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x6]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x7]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x8]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0x9]);_0x418678[_0xc6f7('0x22')](_0x54cb47[0xa]);_0x418678[_0xc6f7('0x22')](_0x468789['interaction']['id']);_0x418678[_0xc6f7('0x22')](_0x468789[_0xc6f7('0x15')]['id']);_0x418678['push'](_0x2dc376[_0xc6f7('0x2b')]);_0x418678['push'](_0x468789[_0xc6f7('0x16')][_0xc6f7('0x2c')]);_0x418678[_0xc6f7('0x22')](_0x468789[_0xc6f7('0x2d')][_0xc6f7('0x2d')]);_0x418678[_0xc6f7('0x22')](_0x2f47b3);break;default:_0x418678=_[_0xc6f7('0xd')](_0x2dc376[_0xc6f7('0x24')])?[]:_0x2dc376[_0xc6f7('0x24')]['split'](',');}var _0x281c6e={'id':util['format'](_0xc6f7('0x2e'),_0x31ca50,_0x2dc376['id'],_0x2dc376[_0xc6f7('0x1d')]),'condition':require(_0xc6f7('0x2f'))[_0xc6f7('0x30')](_0x31ca50,getIntervals(_0x4d08e7[_0xc6f7('0x31')],_0x2dc376),_0x4d08e7),'consequence':require(_0xc6f7('0x32')+_0x2dc376[_0xc6f7('0x1d')])['consequence'](_0x31ca50,_0x418678,_0x4d08e7,_0x468789),'p':_0x2dc376['priority']||0x0};logger[_0xc6f7('0x33')](_0xc6f7('0x34'),_0x281c6e['id'],_0xc6f7('0x35'),getIntervals(_0x4d08e7[_0xc6f7('0x31')],_0x2dc376)[_0xc6f7('0x1c')](_0xc6f7('0x36')));_0xe54b8d[_0xc6f7('0x22')](_0x281c6e);}else{logger['error'](_0xc6f7('0x37'),path['join'](__dirname,_0xc6f7('0x18'),_0x2dc376[_0xc6f7('0x1d')]+_0xc6f7('0x1e')));}}_0x4d08e7[_0xc6f7('0x13')][_0x31ca50]=new RuleEngine(_0xe54b8d);_0x4d08e7[_0xc6f7('0x13')][_0x31ca50][_0xc6f7('0x38')](_0x468789,function(_0x293373){logger['info'](_0xc6f7('0x39'),JSON[_0xc6f7('0x3a')](_0x293373[_0xc6f7('0x3b')]));if(_0x4d08e7[_0xc6f7('0x13')][_0x31ca50]){_0x4d08e7[_0xc6f7('0x13')][_0x31ca50][_0xc6f7('0x3c')](_0xc6f7('0x3d'));}});return _0x15e1a7({'code':0xc8,'message':_0x468789});}else{if(_0x50bb0c){logger[_0xc6f7('0x33')](util[_0xc6f7('0xc')](_0xc6f7('0x3e'),_0x31ca50));}else{logger[_0xc6f7('0x33')](_0xc6f7('0x3f'));}return _0x15e1a7({'code':0xc8,'message':_0x468789});}}catch(_0x28d4b5){logger[_0xc6f7('0x40')](_0x28d4b5['stack']);return _0x484500(_0x2981e8['error'](0x1f4,_0x28d4b5));}}return _0x484500(_0xc6f7('0x41'));});},'AcceptMessage':function(_0x5d8f55){var _0x186b5b=this;return new Promise(function(_0x37d812,_0x40e0d1){if(_0x5d8f55[_0xc6f7('0x42')]&&_0x5d8f55[_0xc6f7('0x42')]['id']){if(_0x4d08e7['agents'][_0x5d8f55[_0xc6f7('0x42')]['id']]){_0x4d08e7[_0xc6f7('0x43')][_0x5d8f55['agent']['id']][_0xc6f7('0x44')]=![];_0x4d08e7[_0xc6f7('0x43')][_0x5d8f55[_0xc6f7('0x42')]['id']]['busyQueue']=undefined;}}if(_0x5d8f55[_0xc6f7('0x15')]&&_0x5d8f55[_0xc6f7('0x15')]['id']){try{var _0x211285=getId(_0x5d8f55[_0xc6f7('0x14')],_0x5d8f55['message']?_0x5d8f55[_0xc6f7('0x15')]['id']:0x0,_0x5d8f55['interaction']?_0x5d8f55[_0xc6f7('0x16')]['id']:0x0);if(_0x4d08e7[_0xc6f7('0x13')][_0x211285]){_0x4d08e7['rules'][_0x211285][_0xc6f7('0x3c')](_0xc6f7('0x45'));if(rpc[_0x5d8f55[_0xc6f7('0x14')]+_0xc6f7('0x46')]){rpc[_0x5d8f55[_0xc6f7('0x14')]+_0xc6f7('0x46')][_0xc6f7('0x47')](_0x211285,{'UserId':_0x5d8f55[_0xc6f7('0x15')][_0xc6f7('0x48')]})[_0xc6f7('0x49')](function(){logger[_0xc6f7('0x40')](_0xc6f7('0x4a'));});}}return _0x37d812({'code':0xc8,'message':_0x5d8f55});}catch(_0x2ea798){logger[_0xc6f7('0x40')](_0x2ea798[_0xc6f7('0x4b')]);return _0x40e0d1(_0x186b5b[_0xc6f7('0x40')](0x1f4,_0x2ea798));}}logger[_0xc6f7('0x40')](_0xc6f7('0x4c'));return _0x40e0d1(_0x186b5b[_0xc6f7('0x40')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x57f7e1){var _0x5c47c8=this;return new Promise(function(_0xada8e4,_0x2c7836){if(_0x57f7e1[_0xc6f7('0x42')]&&_0x57f7e1['agent']['id']){try{if(_0x4d08e7[_0xc6f7('0x43')][_0x57f7e1[_0xc6f7('0x42')]['id']]){_0x4d08e7[_0xc6f7('0x43')][_0x57f7e1[_0xc6f7('0x42')]['id']][_0xc6f7('0x44')]=![];_0x4d08e7[_0xc6f7('0x43')][_0x57f7e1[_0xc6f7('0x42')]['id']][_0xc6f7('0x4d')]=undefined;}return _0xada8e4({'code':0xc8,'message':_0x57f7e1});}catch(_0x290997){logger[_0xc6f7('0x40')](_0x290997[_0xc6f7('0x4b')]);return _0x2c7836(_0x5c47c8['error'](0x1f4,_0x290997));}}logger[_0xc6f7('0x40')]('message\x20is\x20empty');return _0x2c7836(_0x5c47c8[_0xc6f7('0x40')](0x1f4,_0xc6f7('0x4c')));});},'AbandonInteraction':function(_0x56e8ca){var _0x5ab154=this;return new Promise(function(_0x42439f,_0x4f7913){if(_0x56e8ca[_0xc6f7('0x14')]&&_0x56e8ca[_0xc6f7('0x16')]&&_0x56e8ca['interaction']['id']){try{var _0x47e34c=getId(_0x56e8ca['channel'],_0x56e8ca['message']?_0x56e8ca[_0xc6f7('0x15')]['id']:0x0,_0x56e8ca[_0xc6f7('0x16')]?_0x56e8ca[_0xc6f7('0x16')]['id']:0x0);if(_0x4d08e7[_0xc6f7('0x13')][_0x47e34c]){_0x4d08e7[_0xc6f7('0x13')][_0x47e34c]['emit'](_0xc6f7('0x45'));}return _0x42439f({'code':0xc8,'message':_0x56e8ca});}catch(_0x5ce4a7){logger['error'](_0x5ce4a7[_0xc6f7('0x4b')]);return _0x4f7913(_0x5ab154[_0xc6f7('0x40')](0x1f4,_0x5ce4a7));}}logger['error'](_0xc6f7('0x4c'));return _0x4f7913(_0x5ab154[_0xc6f7('0x40')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x52fc61){var _0x58138a=this;return new Promise(function(_0x21bb2b,_0x5e0f9c){if(_0x4d08e7[_0xc6f7('0x43')][_0xc6f7('0x4e')](_0x52fc61['id'])){for(var _0x4de96a in _0x52fc61[_0xc6f7('0x4f')]){if(_0x52fc61['capacity'][_0xc6f7('0x4e')](_0x4de96a)){if(_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']]['hasOwnProperty'](_0x4de96a+_0xc6f7('0x50'))){_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']][_0x4de96a+_0xc6f7('0x50')]=parseInt(_0x52fc61['capacity'][_0x4de96a],0xa);}}}_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']][_0xc6f7('0x51')]();return _0x21bb2b({'code':0xc8,'message':_0x4d08e7[_0xc6f7('0x43')][_0x52fc61['id']]});}else{return _0x5e0f9c(_0x58138a[_0xc6f7('0x40')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x845f57){return new Promise(function(_0x2973e9){var _0x373768=_['values'](_0x4d08e7[_0xc6f7('0x43')]);if(_0x845f57&&_0x845f57['id']){var _0x14e1ec=_[_0xc6f7('0x52')](_0x373768,function(_0x3cdd4d){return _0x3cdd4d['id']===_0x845f57['id'];});_0x2973e9(_0x14e1ec);}else{_0x2973e9({'count':_0x373768[_0xc6f7('0x1a')],'rows':_0x373768});}});},'ChatQueues':function(){return new Promise(function(_0x40a60d){var _0x19ff19=[];for(var _0x1850c2 in _0x4d08e7[_0xc6f7('0x53')]){if(_0x4d08e7['chatQueues'][_0xc6f7('0x4e')](_0x1850c2)){var _0x2a7294=_0x4d08e7[_0xc6f7('0x53')][_0x1850c2];var _0x346f2f={'id':_0x2a7294['id'],'available':_0x2a7294['available'],'loggedIn':_0x2a7294['loggedIn'],'name':_0x2a7294[_0xc6f7('0x54')],'paused':_0x2a7294[_0xc6f7('0x55')],'waiting':_0x2a7294[_0xc6f7('0x56')]};_0x19ff19[_0xc6f7('0x22')](_0x346f2f);}}_0x40a60d({'count':_0x19ff19['length'],'rows':_0x19ff19});});},'MailQueues':function(){return new Promise(function(_0x39ddb7){var _0x25338f=[];for(var _0x4d80bd in _0x4d08e7[_0xc6f7('0x57')]){if(_0x4d08e7[_0xc6f7('0x57')]['hasOwnProperty'](_0x4d80bd)){var _0x4d1d5f=_0x4d08e7[_0xc6f7('0x57')][_0x4d80bd];var _0x2c338d={'id':_0x4d1d5f['id'],'available':_0x4d1d5f[_0xc6f7('0x58')],'loggedIn':_0x4d1d5f[_0xc6f7('0x59')],'name':_0x4d1d5f[_0xc6f7('0x54')],'paused':_0x4d1d5f[_0xc6f7('0x55')],'waiting':_0x4d1d5f[_0xc6f7('0x56')]};_0x25338f[_0xc6f7('0x22')](_0x2c338d);}}_0x39ddb7({'count':_0x25338f[_0xc6f7('0x1a')],'rows':_0x25338f});});},'OpenchannelQueues':function(){return new Promise(function(_0x40a147){var _0x530fb7=[];for(var _0x2fe4dd in _0x4d08e7[_0xc6f7('0x5a')]){if(_0x4d08e7[_0xc6f7('0x5a')]['hasOwnProperty'](_0x2fe4dd)){var _0x303dc7=_0x4d08e7['openchannelQueues'][_0x2fe4dd];var _0x5192c2={'id':_0x303dc7['id'],'available':_0x303dc7[_0xc6f7('0x58')],'loggedIn':_0x303dc7[_0xc6f7('0x59')],'name':_0x303dc7['name'],'paused':_0x303dc7[_0xc6f7('0x55')],'waiting':_0x303dc7[_0xc6f7('0x56')]};_0x530fb7[_0xc6f7('0x22')](_0x5192c2);}}_0x40a147({'count':_0x530fb7[_0xc6f7('0x1a')],'rows':_0x530fb7});});},'SmsQueues':function(){return new Promise(function(_0x21c960){var _0x5d166e=[];for(var _0x110b44 in _0x4d08e7[_0xc6f7('0x5b')]){if(_0x4d08e7[_0xc6f7('0x5b')][_0xc6f7('0x4e')](_0x110b44)){var _0x2b2bc6=_0x4d08e7[_0xc6f7('0x5b')][_0x110b44];var _0x145821={'id':_0x2b2bc6['id'],'available':_0x2b2bc6[_0xc6f7('0x58')],'loggedIn':_0x2b2bc6[_0xc6f7('0x59')],'name':_0x2b2bc6['name'],'paused':_0x2b2bc6['paused'],'waiting':_0x2b2bc6[_0xc6f7('0x56')]};_0x5d166e['push'](_0x145821);}}_0x21c960({'count':_0x5d166e[_0xc6f7('0x1a')],'rows':_0x5d166e});});},'FaxQueues':function(){return new Promise(function(_0x38aced){var _0x28f133=[];for(var _0x5541bb in _0x4d08e7[_0xc6f7('0x5c')]){if(_0x4d08e7[_0xc6f7('0x5c')][_0xc6f7('0x4e')](_0x5541bb)){var _0x5cc142=_0x4d08e7[_0xc6f7('0x5c')][_0x5541bb];var _0x3ec38a={'id':_0x5cc142['id'],'available':_0x5cc142['available'],'loggedIn':_0x5cc142[_0xc6f7('0x59')],'name':_0x5cc142[_0xc6f7('0x54')],'paused':_0x5cc142[_0xc6f7('0x55')],'waiting':_0x5cc142[_0xc6f7('0x56')]};_0x28f133[_0xc6f7('0x22')](_0x3ec38a);}}_0x38aced({'count':_0x28f133[_0xc6f7('0x1a')],'rows':_0x28f133});});},'WhatsappQueues':function(){return new Promise(function(_0x1b4360){var _0x580dd9=[];for(var _0x4eb879 in _0x4d08e7['whatsappQueues']){if(_0x4d08e7[_0xc6f7('0x5d')][_0xc6f7('0x4e')](_0x4eb879)){var _0xed3020=_0x4d08e7[_0xc6f7('0x5d')][_0x4eb879];var _0x5b0a1c={'id':_0xed3020['id'],'available':_0xed3020[_0xc6f7('0x58')],'loggedIn':_0xed3020[_0xc6f7('0x59')],'name':_0xed3020[_0xc6f7('0x54')],'paused':_0xed3020[_0xc6f7('0x55')],'waiting':_0xed3020[_0xc6f7('0x56')]};_0x580dd9[_0xc6f7('0x22')](_0x5b0a1c);}}_0x1b4360({'count':_0x580dd9[_0xc6f7('0x1a')],'rows':_0x580dd9});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x15dcdc){var _0x5c08c3=_['values'](_0x4d08e7['chatQueuesWaitingInteractions']);_0x15dcdc({'count':_0x5c08c3[_0xc6f7('0x1a')],'rows':_0x5c08c3});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x49df65){var _0x3f41dc=_[_0xc6f7('0x5e')](_0x4d08e7['mailQueuesWaitingInteractions']);_0x49df65({'count':_0x3f41dc[_0xc6f7('0x1a')],'rows':_0x3f41dc});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5be063){var _0x4f983a=_[_0xc6f7('0x5e')](_0x4d08e7['openchannelQueuesWaitingInteractions']);_0x5be063({'count':_0x4f983a[_0xc6f7('0x1a')],'rows':_0x4f983a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x22bec7){var _0x43b61e=_[_0xc6f7('0x5e')](_0x4d08e7[_0xc6f7('0x5f')]);_0x22bec7({'count':_0x43b61e[_0xc6f7('0x1a')],'rows':_0x43b61e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b7a17){var _0x3f23fc=_['values'](_0x4d08e7[_0xc6f7('0x60')]);_0x4b7a17({'count':_0x3f23fc[_0xc6f7('0x1a')],'rows':_0x3f23fc});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x29965d){var _0x41e082=_[_0xc6f7('0x5e')](_0x4d08e7[_0xc6f7('0x61')]);_0x29965d({'count':_0x41e082['length'],'rows':_0x41e082});});}};var _0x17831b=jayson['server'](_0x4164b5)[_0xc6f7('0x62')]();_0x17831b['on'](_0xc6f7('0x40'),function(_0xc61b27){logger['error'](JSON[_0xc6f7('0x3a')](_0xc61b27));return _0x20b428(_0xc61b27);});_0x17831b[_0xc6f7('0x12')](0x232c,'127.0.0.1',function(){console[_0xc6f7('0x63')](_0xc6f7('0x64'),0x232c);return _0x52565d(_0xc6f7('0x65')+0x232c);});});}; \ No newline at end of file +var _0xd185=['stringify','matchPath','complete','Skipped\x20routing\x20for\x20%s','stack','routing\x20is\x20empty','agent','agents','busyQueue','end','QueueReport','update','UserId','catch','message\x20is\x20empty','busy','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','find','chatQueues','available','loggedIn','name','waiting','mailQueues','paused','openchannelQueues','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','transfer','applications','isArray','length','existsSync','join','.js','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','TagId','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body','format','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','execute'];(function(_0x35ddbb,_0x3bb21c){var _0x557430=function(_0x3f00fd){while(--_0x3f00fd){_0x35ddbb['push'](_0x35ddbb['shift']());}};_0x557430(++_0x3bb21c);}(_0xd185,0x92));var _0x5d18=function(_0x322a77,_0x11863a){_0x322a77=_0x322a77-0x0;var _0x1e45a0=_0xd185[_0x322a77];return _0x1e45a0;};'use strict';var _=require(_0x5d18('0x0'));var util=require('util');var path=require('path');var fs=require('fs');var jayson=require(_0x5d18('0x1'));var BPromise=require(_0x5d18('0x2'));var utils=require('./applications/utils');var sUtils=require(_0x5d18('0x3'));var logger=require(_0x5d18('0x4'))(_0x5d18('0x5'));var rpc={'openchannelQueueReport':require(_0x5d18('0x6')),'mailQueueReport':require(_0x5d18('0x7')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x5d18('0x8')),'whatsappQueueReport':require(_0x5d18('0x9'))};var RuleEngine=require(_0x5d18('0xa'));function getId(_0x1dcdd8,_0x4660cc,_0x570e19){return util['format'](_0x5d18('0xb'),_0x1dcdd8,_0x4660cc||0x0,_0x570e19||0x0);}function getIntervals(_0x57e272,_0x276fcb){var _0x30c707=[];if(!_[_0x5d18('0xc')](_0x276fcb[_0x5d18('0xd')])&&!_[_0x5d18('0xc')](_0x57e272[_0x276fcb[_0x5d18('0xd')]])&&!_[_0x5d18('0xc')](_0x57e272[_0x276fcb[_0x5d18('0xd')]][_0x5d18('0xe')])){_0x30c707=_[_0x5d18('0xf')](_0x57e272[_0x276fcb['IntervalId']]['Intervals'],'interval');}else if(!_[_0x5d18('0xc')](_0x276fcb[_0x5d18('0x10')])){_0x30c707=[_0x276fcb[_0x5d18('0x10')]];}return _0x30c707;}exports[_0x5d18('0x11')]=function(_0x1fe54a){_0x1fe54a[_0x5d18('0x12')]={};return new BPromise(function(_0x35a869,_0x56b6e6){var _0x424095={'Start':function(_0x7f6e05){var _0x535b9f=this;return new Promise(function(_0x1fcc3b,_0x380c86){if(_0x7f6e05){try{var _0xf77e10=[];var _0x4a6730=getId(_0x7f6e05[_0x5d18('0x13')],_0x7f6e05[_0x5d18('0x14')]?_0x7f6e05[_0x5d18('0x14')]['id']:0x0,_0x7f6e05[_0x5d18('0x15')]?_0x7f6e05['interaction']['id']:0x0);var _0x6c33e5=sUtils['checkWaitingNotifications'](_0x1fe54a,_0x7f6e05);if(_0x7f6e05[_0x5d18('0x16')]||!_0x6c33e5&&_0x7f6e05[_0x5d18('0x17')]&&_[_0x5d18('0x18')](_0x7f6e05['applications'])&&_0x7f6e05['applications'][_0x5d18('0x19')]){for(var _0x1c7423=0x0;_0x1c7423<_0x7f6e05[_0x5d18('0x17')][_0x5d18('0x19')];_0x1c7423+=0x1){var _0x1e5a26=_0x7f6e05[_0x5d18('0x17')][_0x1c7423];if(fs[_0x5d18('0x1a')](path[_0x5d18('0x1b')](__dirname,_0x5d18('0x17'),_0x1e5a26['app']+_0x5d18('0x1c')))){var _0x1dada0=[];switch(_0x1e5a26[_0x5d18('0x1d')][_0x5d18('0x1e')]()){case _0x5d18('0x1f'):var _0x2cc9a8=_0x1e5a26[_0x5d18('0x20')][_0x5d18('0x21')](',');if(_0x7f6e05[_0x5d18('0x13')]==='mail'){_0x1dada0[_0x5d18('0x22')](_0x2cc9a8[0x0]);_0x1dada0[_0x5d18('0x22')](_0x2cc9a8[0x1]);_0x1dada0['push'](_0x2cc9a8[_0x5d18('0x23')](0x2,_0x2cc9a8[_0x5d18('0x19')])[_0x5d18('0x1b')](','));}else{_0x1dada0[_0x5d18('0x22')](_0x2cc9a8[0x0]);_0x1dada0[_0x5d18('0x22')](_0x2cc9a8[_0x5d18('0x23')](0x1,_0x2cc9a8['length'])[_0x5d18('0x1b')](','));}break;case _0x5d18('0x24'):var _0x522618=_0x1e5a26[_0x5d18('0x20')][_0x5d18('0x21')](',');_0x1dada0[_0x5d18('0x22')](_0x522618[0x0]);_0x1dada0[_0x5d18('0x22')](_0x522618[0x1]);_0x1dada0[_0x5d18('0x22')](_0x522618[_0x5d18('0x23')](0x2,_0x522618[_0x5d18('0x19')])[_0x5d18('0x1b')](','));break;case _0x5d18('0x25'):var _0x473190=_0x1e5a26['appdata']['split'](',');_0x1dada0[_0x5d18('0x22')](_0x473190[0x0]);_0x1dada0[_0x5d18('0x22')](_0x473190[0x1]);_0x1dada0[_0x5d18('0x22')](_0x473190[0x2]);_0x1dada0[_0x5d18('0x22')](_0x473190[0x3]);_0x1dada0['push'](_0x473190[_0x5d18('0x23')](0x4,_0x473190[_0x5d18('0x19')])[_0x5d18('0x1b')](','));break;case _0x5d18('0x26'):var _0x143ed8=_0x1e5a26[_0x5d18('0x20')]['split'](',');_0x1dada0[_0x5d18('0x22')](_0x143ed8[0x0]);_0x1dada0[_0x5d18('0x22')](_0x143ed8[0x1]);_0x1dada0['push'](_0x143ed8[0x2]);_0x1dada0[_0x5d18('0x22')](_0x143ed8[0x3]);_0x1dada0['push'](_0x143ed8[_0x5d18('0x23')](0x4,_0x143ed8[_0x5d18('0x19')])[_0x5d18('0x1b')](','));break;case'message':_0x1dada0[_0x5d18('0x22')](_0x1e5a26['appdata']);break;case'tag':_0x1dada0[_0x5d18('0x22')](_0x1e5a26[_0x5d18('0x27')]);_0x1dada0[_0x5d18('0x22')](_0x1e5a26['appdata']);break;case _0x5d18('0x28'):var _0x329795=utils[_0x5d18('0x29')](_0x7f6e05[_0x5d18('0x2a')][_0x5d18('0x2b')],_0x7f6e05);var _0x539aa8=_0x1e5a26[_0x5d18('0x20')]['split'](',');_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x0]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x1]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x2]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x3]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x4]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x5]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x6]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x7]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x8]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0x9]);_0x1dada0[_0x5d18('0x22')](_0x539aa8[0xa]);_0x1dada0[_0x5d18('0x22')](_0x7f6e05[_0x5d18('0x15')]['id']);_0x1dada0[_0x5d18('0x22')](_0x7f6e05[_0x5d18('0x14')]['id']);_0x1dada0[_0x5d18('0x22')](_0x1e5a26[_0x5d18('0x2c')]);_0x1dada0['push'](_0x7f6e05['interaction']['ContactId']);_0x1dada0[_0x5d18('0x22')](_0x7f6e05[_0x5d18('0x2d')][_0x5d18('0x2d')]);_0x1dada0['push'](_0x329795);break;default:_0x1dada0=_['isNil'](_0x1e5a26[_0x5d18('0x20')])?[]:_0x1e5a26[_0x5d18('0x20')][_0x5d18('0x21')](',');}var _0x5eb566={'id':util[_0x5d18('0x2e')](_0x5d18('0x2f'),_0x4a6730,_0x1e5a26['id'],_0x1e5a26[_0x5d18('0x1d')]),'condition':require(_0x5d18('0x30'))[_0x5d18('0x31')](_0x4a6730,getIntervals(_0x1fe54a[_0x5d18('0x32')],_0x1e5a26),_0x1fe54a),'consequence':require('./applications/'+_0x1e5a26[_0x5d18('0x1d')])[_0x5d18('0x33')](_0x4a6730,_0x1dada0,_0x1fe54a,_0x7f6e05),'p':_0x1e5a26[_0x5d18('0x34')]||0x0};logger[_0x5d18('0x35')](_0x5d18('0x36'),_0x5eb566['id'],'on\x20interval',getIntervals(_0x1fe54a[_0x5d18('0x32')],_0x1e5a26)[_0x5d18('0x1b')]('\x20|\x20'));_0xf77e10[_0x5d18('0x22')](_0x5eb566);}else{logger[_0x5d18('0x37')](_0x5d18('0x38'),path[_0x5d18('0x1b')](__dirname,'applications',_0x1e5a26[_0x5d18('0x1d')]+'.js'));}}_0x1fe54a[_0x5d18('0x12')][_0x4a6730]=new RuleEngine(_0xf77e10);_0x1fe54a['rules'][_0x4a6730][_0x5d18('0x39')](_0x7f6e05,function(_0x41e1c1){logger[_0x5d18('0x35')]('Applications\x20executed',JSON[_0x5d18('0x3a')](_0x41e1c1[_0x5d18('0x3b')]));if(_0x1fe54a[_0x5d18('0x12')][_0x4a6730]){_0x1fe54a[_0x5d18('0x12')][_0x4a6730]['emit'](_0x5d18('0x3c'));}});return _0x1fcc3b({'code':0xc8,'message':_0x7f6e05});}else{if(_0x6c33e5){logger[_0x5d18('0x35')](util['format'](_0x5d18('0x3d'),_0x4a6730));}else{logger['info']('No\x20applications\x20to\x20execute');}return _0x1fcc3b({'code':0xc8,'message':_0x7f6e05});}}catch(_0x24f2d6){logger[_0x5d18('0x37')](_0x24f2d6[_0x5d18('0x3e')]);return _0x380c86(_0x535b9f[_0x5d18('0x37')](0x1f4,_0x24f2d6));}}return _0x380c86(_0x5d18('0x3f'));});},'AcceptMessage':function(_0x44ac84){var _0x3cabca=this;return new Promise(function(_0x41527f,_0x5dfebe){if(_0x44ac84[_0x5d18('0x40')]&&_0x44ac84['agent']['id']){if(_0x1fe54a[_0x5d18('0x41')][_0x44ac84[_0x5d18('0x40')]['id']]){_0x1fe54a['agents'][_0x44ac84[_0x5d18('0x40')]['id']]['busy']=![];_0x1fe54a[_0x5d18('0x41')][_0x44ac84[_0x5d18('0x40')]['id']][_0x5d18('0x42')]=undefined;}}if(_0x44ac84[_0x5d18('0x14')]&&_0x44ac84['message']['id']){try{var _0x22cbf0=getId(_0x44ac84['channel'],_0x44ac84['message']?_0x44ac84[_0x5d18('0x14')]['id']:0x0,_0x44ac84[_0x5d18('0x15')]?_0x44ac84['interaction']['id']:0x0);if(_0x1fe54a['rules'][_0x22cbf0]){_0x1fe54a[_0x5d18('0x12')][_0x22cbf0]['emit'](_0x5d18('0x43'));if(rpc[_0x44ac84['channel']+_0x5d18('0x44')]){rpc[_0x44ac84['channel']+_0x5d18('0x44')][_0x5d18('0x45')](_0x22cbf0,{'UserId':_0x44ac84[_0x5d18('0x14')][_0x5d18('0x46')]})[_0x5d18('0x47')](function(){logger['error']('error\x20update\x20queue\x20report');});}}return _0x41527f({'code':0xc8,'message':_0x44ac84});}catch(_0xf3827b){logger['error'](_0xf3827b[_0x5d18('0x3e')]);return _0x5dfebe(_0x3cabca[_0x5d18('0x37')](0x1f4,_0xf3827b));}}logger[_0x5d18('0x37')]('message\x20is\x20empty');return _0x5dfebe(_0x3cabca[_0x5d18('0x37')](0x1f4,_0x5d18('0x48')));});},'RejectMessage':function(_0xe2c4cd){var _0x41bc0d=this;return new Promise(function(_0x2aed32,_0x600a11){if(_0xe2c4cd[_0x5d18('0x40')]&&_0xe2c4cd[_0x5d18('0x40')]['id']){try{if(_0x1fe54a['agents'][_0xe2c4cd['agent']['id']]){_0x1fe54a[_0x5d18('0x41')][_0xe2c4cd[_0x5d18('0x40')]['id']][_0x5d18('0x49')]=![];_0x1fe54a[_0x5d18('0x41')][_0xe2c4cd[_0x5d18('0x40')]['id']][_0x5d18('0x42')]=undefined;}return _0x2aed32({'code':0xc8,'message':_0xe2c4cd});}catch(_0x2cccf6){logger['error'](_0x2cccf6[_0x5d18('0x3e')]);return _0x600a11(_0x41bc0d['error'](0x1f4,_0x2cccf6));}}logger[_0x5d18('0x37')](_0x5d18('0x48'));return _0x600a11(_0x41bc0d[_0x5d18('0x37')](0x1f4,_0x5d18('0x48')));});},'AbandonInteraction':function(_0x30c6ca){var _0x5797d9=this;return new Promise(function(_0x45ad2e,_0x153bbc){if(_0x30c6ca[_0x5d18('0x13')]&&_0x30c6ca[_0x5d18('0x15')]&&_0x30c6ca[_0x5d18('0x15')]['id']){try{var _0x2a0f9=getId(_0x30c6ca[_0x5d18('0x13')],_0x30c6ca['message']?_0x30c6ca[_0x5d18('0x14')]['id']:0x0,_0x30c6ca[_0x5d18('0x15')]?_0x30c6ca[_0x5d18('0x15')]['id']:0x0);if(_0x1fe54a[_0x5d18('0x12')][_0x2a0f9]){_0x1fe54a['rules'][_0x2a0f9][_0x5d18('0x4a')](_0x5d18('0x43'));}return _0x45ad2e({'code':0xc8,'message':_0x30c6ca});}catch(_0x4fc2b2){logger[_0x5d18('0x37')](_0x4fc2b2[_0x5d18('0x3e')]);return _0x153bbc(_0x5797d9[_0x5d18('0x37')](0x1f4,_0x4fc2b2));}}logger[_0x5d18('0x37')]('message\x20is\x20empty');return _0x153bbc(_0x5797d9[_0x5d18('0x37')](0x1f4,_0x5d18('0x48')));});},'AgentCapacity':function(_0x5397d9){var _0x3d2b8a=this;return new Promise(function(_0x50cde5,_0x3cd210){if(_0x1fe54a[_0x5d18('0x41')][_0x5d18('0x4b')](_0x5397d9['id'])){for(var _0x39daa8 in _0x5397d9[_0x5d18('0x4c')]){if(_0x5397d9[_0x5d18('0x4c')][_0x5d18('0x4b')](_0x39daa8)){if(_0x1fe54a[_0x5d18('0x41')][_0x5397d9['id']]['hasOwnProperty'](_0x39daa8+'CurrentCapacity')){_0x1fe54a[_0x5d18('0x41')][_0x5397d9['id']][_0x39daa8+_0x5d18('0x4d')]=parseInt(_0x5397d9[_0x5d18('0x4c')][_0x39daa8],0xa);}}}_0x1fe54a[_0x5d18('0x41')][_0x5397d9['id']][_0x5d18('0x4e')]();return _0x50cde5({'code':0xc8,'message':_0x1fe54a[_0x5d18('0x41')][_0x5397d9['id']]});}else{return _0x3cd210(_0x3d2b8a[_0x5d18('0x37')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x2a48a1){return new Promise(function(_0x54c06e){var _0x1923ee=_[_0x5d18('0x4f')](_0x1fe54a['agents']);if(_0x2a48a1&&_0x2a48a1['id']){var _0x42a588=_[_0x5d18('0x50')](_0x1923ee,function(_0x4c29dc){return _0x4c29dc['id']===_0x2a48a1['id'];});_0x54c06e(_0x42a588);}else{_0x54c06e({'count':_0x1923ee['length'],'rows':_0x1923ee});}});},'ChatQueues':function(){return new Promise(function(_0x38c448){var _0x2476f2=[];for(var _0x4026bd in _0x1fe54a['chatQueues']){if(_0x1fe54a['chatQueues']['hasOwnProperty'](_0x4026bd)){var _0xdb5acf=_0x1fe54a[_0x5d18('0x51')][_0x4026bd];var _0x5ee1ba={'id':_0xdb5acf['id'],'available':_0xdb5acf[_0x5d18('0x52')],'loggedIn':_0xdb5acf[_0x5d18('0x53')],'name':_0xdb5acf[_0x5d18('0x54')],'paused':_0xdb5acf['paused'],'waiting':_0xdb5acf[_0x5d18('0x55')]};_0x2476f2[_0x5d18('0x22')](_0x5ee1ba);}}_0x38c448({'count':_0x2476f2[_0x5d18('0x19')],'rows':_0x2476f2});});},'MailQueues':function(){return new Promise(function(_0x500538){var _0x2840e4=[];for(var _0x1f9686 in _0x1fe54a[_0x5d18('0x56')]){if(_0x1fe54a[_0x5d18('0x56')][_0x5d18('0x4b')](_0x1f9686)){var _0x46b8d9=_0x1fe54a[_0x5d18('0x56')][_0x1f9686];var _0x78c108={'id':_0x46b8d9['id'],'available':_0x46b8d9[_0x5d18('0x52')],'loggedIn':_0x46b8d9[_0x5d18('0x53')],'name':_0x46b8d9[_0x5d18('0x54')],'paused':_0x46b8d9[_0x5d18('0x57')],'waiting':_0x46b8d9[_0x5d18('0x55')]};_0x2840e4[_0x5d18('0x22')](_0x78c108);}}_0x500538({'count':_0x2840e4[_0x5d18('0x19')],'rows':_0x2840e4});});},'OpenchannelQueues':function(){return new Promise(function(_0x58a1a1){var _0x4fc2b4=[];for(var _0x344c9f in _0x1fe54a[_0x5d18('0x58')]){if(_0x1fe54a[_0x5d18('0x58')][_0x5d18('0x4b')](_0x344c9f)){var _0x1d2139=_0x1fe54a[_0x5d18('0x58')][_0x344c9f];var _0x2fe927={'id':_0x1d2139['id'],'available':_0x1d2139[_0x5d18('0x52')],'loggedIn':_0x1d2139[_0x5d18('0x53')],'name':_0x1d2139[_0x5d18('0x54')],'paused':_0x1d2139['paused'],'waiting':_0x1d2139['waiting']};_0x4fc2b4['push'](_0x2fe927);}}_0x58a1a1({'count':_0x4fc2b4['length'],'rows':_0x4fc2b4});});},'SmsQueues':function(){return new Promise(function(_0x26328){var _0x50e36e=[];for(var _0x1f7084 in _0x1fe54a['smsQueues']){if(_0x1fe54a[_0x5d18('0x59')]['hasOwnProperty'](_0x1f7084)){var _0x3b39ab=_0x1fe54a[_0x5d18('0x59')][_0x1f7084];var _0x5775a1={'id':_0x3b39ab['id'],'available':_0x3b39ab['available'],'loggedIn':_0x3b39ab[_0x5d18('0x53')],'name':_0x3b39ab[_0x5d18('0x54')],'paused':_0x3b39ab[_0x5d18('0x57')],'waiting':_0x3b39ab[_0x5d18('0x55')]};_0x50e36e[_0x5d18('0x22')](_0x5775a1);}}_0x26328({'count':_0x50e36e[_0x5d18('0x19')],'rows':_0x50e36e});});},'FaxQueues':function(){return new Promise(function(_0x2e9d66){var _0x1a6675=[];for(var _0x18049f in _0x1fe54a[_0x5d18('0x5a')]){if(_0x1fe54a[_0x5d18('0x5a')][_0x5d18('0x4b')](_0x18049f)){var _0x3be025=_0x1fe54a[_0x5d18('0x5a')][_0x18049f];var _0x3c0a8c={'id':_0x3be025['id'],'available':_0x3be025[_0x5d18('0x52')],'loggedIn':_0x3be025[_0x5d18('0x53')],'name':_0x3be025['name'],'paused':_0x3be025[_0x5d18('0x57')],'waiting':_0x3be025[_0x5d18('0x55')]};_0x1a6675[_0x5d18('0x22')](_0x3c0a8c);}}_0x2e9d66({'count':_0x1a6675['length'],'rows':_0x1a6675});});},'WhatsappQueues':function(){return new Promise(function(_0x50eb72){var _0x54878b=[];for(var _0x39ca58 in _0x1fe54a[_0x5d18('0x5b')]){if(_0x1fe54a[_0x5d18('0x5b')][_0x5d18('0x4b')](_0x39ca58)){var _0x3290a2=_0x1fe54a[_0x5d18('0x5b')][_0x39ca58];var _0x4ae397={'id':_0x3290a2['id'],'available':_0x3290a2[_0x5d18('0x52')],'loggedIn':_0x3290a2['loggedIn'],'name':_0x3290a2[_0x5d18('0x54')],'paused':_0x3290a2['paused'],'waiting':_0x3290a2[_0x5d18('0x55')]};_0x54878b[_0x5d18('0x22')](_0x4ae397);}}_0x50eb72({'count':_0x54878b[_0x5d18('0x19')],'rows':_0x54878b});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x202afa){var _0x54a1e8=_[_0x5d18('0x4f')](_0x1fe54a['chatQueuesWaitingInteractions']);_0x202afa({'count':_0x54a1e8[_0x5d18('0x19')],'rows':_0x54a1e8});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x257abc){var _0x477038=_[_0x5d18('0x4f')](_0x1fe54a[_0x5d18('0x5c')]);_0x257abc({'count':_0x477038[_0x5d18('0x19')],'rows':_0x477038});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5f4af6){var _0x1d9814=_[_0x5d18('0x4f')](_0x1fe54a[_0x5d18('0x5d')]);_0x5f4af6({'count':_0x1d9814[_0x5d18('0x19')],'rows':_0x1d9814});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1a8887){var _0x334a03=_[_0x5d18('0x4f')](_0x1fe54a[_0x5d18('0x5e')]);_0x1a8887({'count':_0x334a03['length'],'rows':_0x334a03});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x157c17){var _0x59a297=_[_0x5d18('0x4f')](_0x1fe54a[_0x5d18('0x5f')]);_0x157c17({'count':_0x59a297[_0x5d18('0x19')],'rows':_0x59a297});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4f610f){var _0x1970a2=_[_0x5d18('0x4f')](_0x1fe54a[_0x5d18('0x60')]);_0x4f610f({'count':_0x1970a2[_0x5d18('0x19')],'rows':_0x1970a2});});}};var _0x5d7f4c=jayson['server'](_0x424095)[_0x5d18('0x61')]();_0x5d7f4c['on']('error',function(_0x38b149){logger[_0x5d18('0x37')](JSON[_0x5d18('0x3a')](_0x38b149));return _0x56b6e6(_0x38b149);});_0x5d7f4c[_0x5d18('0x11')](0x232c,_0x5d18('0x62'),function(){console[_0x5d18('0x63')](_0x5d18('0x64'),0x232c);return _0x35a869(_0x5d18('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index a9afb98..87558f2 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 _0x77c4=['catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','iftime\x20%s','then','indexOf','true','some','info','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','util','../../../config/logger','routing','client','http','request','error','message','result'];(function(_0x402781,_0x3b3419){var _0x4141b1=function(_0x348f7d){while(--_0x348f7d){_0x402781['push'](_0x402781['shift']());}};_0x4141b1(++_0x3b3419);}(_0x77c4,0x10a));var _0x477c=function(_0x199379,_0x584999){_0x199379=_0x199379-0x0;var _0x19bbce=_0x77c4[_0x199379];return _0x19bbce;};'use strict';var util=require(_0x477c('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require('lodash');var logger=require(_0x477c('0x1'))(_0x477c('0x2'));var client=jayson[_0x477c('0x3')][_0x477c('0x4')]({'port':0x232a});function request(_0x141da8,_0x51cf05){return new BPromise(function(_0x5d87e3,_0x24ed04){return client[_0x477c('0x5')](_0x141da8,_0x51cf05)['then'](function(_0x4a1390){if(_0x4a1390[_0x477c('0x6')]){return _0x24ed04(_0x4a1390[_0x477c('0x6')][_0x477c('0x7')]);}else{return _0x5d87e3(_0x4a1390[_0x477c('0x8')]);}})[_0x477c('0x9')](function(_0x3c4c40){return _0x24ed04(_0x3c4c40);});});}exports[_0x477c('0xa')]=function(_0x166343,_0x2d00b7,_0x1e2f70){return function(_0x2325df){if(_0x1e2f70['rules']&&!_0x1e2f70[_0x477c('0xb')][_0x166343]){logger['info'](_0x477c('0xc'),_0x166343);return _0x2325df[_0x477c('0xd')]();}var _0x2f7dba=[];for(var _0x8a1887=0x0;_0x8a1887<_0x2d00b7['length'];_0x8a1887+=0x1){_0x2f7dba['push'](request('Command',{'command':util['format'](_0x477c('0xe'),_0x2d00b7[_0x8a1887])})[_0x477c('0xf')](function(_0x1481bf){return _0x1481bf&&_0x1481bf[_0x477c('0x7')]&&_0x1481bf['message'][_0x477c('0x10')](_0x477c('0x11'))>=0x0?!![]:![];})['catch'](function(){logger[_0x477c('0x6')]('[%s][INTERVAL]\x20%s',_0x166343,_0x2d00b7[_0x8a1887]);}));}BPromise['all'](_0x2f7dba)[_0x477c('0xf')](function(_0x376ec4){var _0x243907=_[_0x477c('0x12')](_0x376ec4);logger[_0x477c('0x13')](_0x477c('0x14'),_0x166343,_0x2d00b7[_0x477c('0x15')]('\x20|\x20'),_0x243907);_0x2325df[_0x477c('0x16')](_0x243907);})[_0x477c('0x9')](function(_0x37d367){logger[_0x477c('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x166343,_0x2d00b7[_0x477c('0x15')](_0x477c('0x17')),_0x37d367[_0x477c('0x18')]);_0x2325df[_0x477c('0xd')]();});};}; \ No newline at end of file +var _0x1baa=['info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','when','join','\x20|\x20','stack','util','jayson/promise','lodash','../../../config/logger','routing','client','http','then','error','message','result','catch','condition','rules'];(function(_0x56949b,_0x17f8b8){var _0x3cdb97=function(_0x6b203b){while(--_0x6b203b){_0x56949b['push'](_0x56949b['shift']());}};_0x3cdb97(++_0x17f8b8);}(_0x1baa,0x151));var _0xa1ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1baa[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xa1ba('0x0'));var BPromise=require('bluebird');var jayson=require(_0xa1ba('0x1'));var _=require(_0xa1ba('0x2'));var logger=require(_0xa1ba('0x3'))(_0xa1ba('0x4'));var client=jayson[_0xa1ba('0x5')][_0xa1ba('0x6')]({'port':0x232a});function request(_0x478bbe,_0x5ca5ea){return new BPromise(function(_0x3c5f1c,_0x36af5b){return client['request'](_0x478bbe,_0x5ca5ea)[_0xa1ba('0x7')](function(_0x394284){if(_0x394284[_0xa1ba('0x8')]){return _0x36af5b(_0x394284['error'][_0xa1ba('0x9')]);}else{return _0x3c5f1c(_0x394284[_0xa1ba('0xa')]);}})[_0xa1ba('0xb')](function(_0x5d7adb){return _0x36af5b(_0x5d7adb);});});}exports[_0xa1ba('0xc')]=function(_0x420657,_0x285533,_0x2c302f){return function(_0x1e8788){if(_0x2c302f[_0xa1ba('0xd')]&&!_0x2c302f[_0xa1ba('0xd')][_0x420657]){logger[_0xa1ba('0xe')](_0xa1ba('0xf'),_0x420657);return _0x1e8788[_0xa1ba('0x10')]();}var _0x1a5807=[];for(var _0x34a6dd=0x0;_0x34a6dd<_0x285533[_0xa1ba('0x11')];_0x34a6dd+=0x1){_0x1a5807[_0xa1ba('0x12')](request('Command',{'command':util['format']('iftime\x20%s',_0x285533[_0x34a6dd])})[_0xa1ba('0x7')](function(_0x296abd){return _0x296abd&&_0x296abd[_0xa1ba('0x9')]&&_0x296abd[_0xa1ba('0x9')]['indexOf'](_0xa1ba('0x13'))>=0x0?!![]:![];})[_0xa1ba('0xb')](function(){logger[_0xa1ba('0x8')](_0xa1ba('0x14'),_0x420657,_0x285533[_0x34a6dd]);}));}BPromise['all'](_0x1a5807)['then'](function(_0x20644c){var _0x52e15d=_[_0xa1ba('0x15')](_0x20644c);logger['info'](_0xa1ba('0x16'),_0x420657,_0x285533['join']('\x20|\x20'),_0x52e15d);_0x1e8788[_0xa1ba('0x17')](_0x52e15d);})[_0xa1ba('0xb')](function(_0x5acab4){logger['error'](_0xa1ba('0x16'),_0x420657,_0x285533[_0xa1ba('0x18')](_0xa1ba('0x19')),_0x5acab4[_0xa1ba('0x1a')]);_0x1e8788['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 65b9bb3..ccb722d 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 _0x44a3=['agentacw','request','CreateVoiceAgentReport','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','destuniqueid','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','talktime','push','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][agents][queuecallerabandon]','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','lastevent','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','agentcompleteAt','complete','blindtransfer','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','transfertype','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','calleridname','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','then','type','agentcomplete','acw'];(function(_0x39d474,_0x280fb6){var _0x5915ca=function(_0x5233c1){while(--_0x5233c1){_0x39d474['push'](_0x39d474['shift']());}};_0x5915ca(++_0x280fb6);}(_0x44a3,0x1a9));var _0x344a=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0x44a3[_0x25a0b9];return _0x30b9ab;};'use strict';var _=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var utils=require(_0x344a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x23cef2,_0xdffe0b){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x5'),_0x23cef2['uniqueid'],_0x23cef2[_0x344a('0x6')],_0x23cef2[_0x344a('0x7')],_0x23cef2[_0x344a('0x8')],_0x23cef2[_0x344a('0x9')],_0x23cef2[_0x344a('0xa')],_0x23cef2['connectedlinenum'],_0x23cef2['lastevent']));if(_0x23cef2['queue']){utils['getVoiceQueueByName'](_0x23cef2[_0x344a('0x7')])[_0x344a('0xb')](function(_0x3c725e){if(_0x3c725e){_0x23cef2[_0x344a('0xc')]=_0x3c725e[_0x344a('0xc')];_0x23cef2['agentacw']=_0x23cef2[_0x344a('0xd')]?_0x3c725e[_0x344a('0xe')]:![];_0x23cef2['acwtime']=_0x23cef2[_0x344a('0xf')]?_0x3c725e['acwTimeout']:0x0;}utils[_0x344a('0x10')]('CreateVoiceAgentReport',_0x23cef2);});}else{utils[_0x344a('0x10')](_0x344a('0x11'),_0x23cef2);}if(_0xdffe0b){delete transfers[_0x23cef2['uniqueid']];}else{delete agents[_0x23cef2['destuniqueid']];}}exports[_0x344a('0x12')]=function(_0x2ad7eb){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x2ad7eb);agents[_0x2ad7eb['destuniqueid']]=_0x2ad7eb;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x17')]=utils[_0x344a('0x18')]();agents[_0x2ad7eb[_0x344a('0x16')]]['lastevent']='called';agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x19')]=null;agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x1a')]=null;utils['info'](util[_0x344a('0x4')](_0x344a('0x1b'),_0x2ad7eb['uniqueid'],agents[_0x2ad7eb[_0x344a('0x16')]][_0x344a('0x8')],_0x2ad7eb[_0x344a('0x16')]));}catch(_0x45a827){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x14'),_0x2ad7eb[_0x344a('0x15')]),_0x45a827);}};exports[_0x344a('0x1d')]=function(_0x450922){try{if(!_['isNil'](agents[_0x450922[_0x344a('0x16')]])){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x1e'),_0x450922[_0x344a('0x15')]),_0x450922);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x1f'),_0x450922[_0x344a('0x15')],agents[_0x450922[_0x344a('0x16')]][_0x344a('0x8')],_0x450922[_0x344a('0x16')]));agents[_0x450922[_0x344a('0x16')]][_0x344a('0x1d')]=!![];agents[_0x450922['destuniqueid']][_0x344a('0x20')]=utils['now']();agents[_0x450922[_0x344a('0x16')]]['lastevent']=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x22')]=_0x344a('0x21');agents[_0x450922[_0x344a('0x16')]][_0x344a('0x23')]=_0x450922[_0x344a('0x24')]?parseInt(_0x450922[_0x344a('0x24')])/0x3e8:0x0;agents[_0x450922['destuniqueid']][_0x344a('0x25')]=0x0;unanswered[_0x344a('0x26')](_0x450922[_0x344a('0x16')]);}}catch(_0xc02d6){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentringnoanswer]',_0x450922[_0x344a('0x15')]),_0xc02d6);}};exports['queuecallerabandon']=function(_0x593cf6){try{_[_0x344a('0x27')](agents,function(_0x14fa86,_0x5a36bb){if(_0x14fa86['uniqueid']==_0x593cf6['uniqueid']&&!_['includes'](unanswered,_0x14fa86[_0x344a('0x16')])){utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][queuecallerabandon]',_0x593cf6[_0x344a('0x15')]),_0x593cf6);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x28'),_0x593cf6[_0x344a('0x15')],_0x14fa86[_0x344a('0x8')],_0x14fa86[_0x344a('0x16')]));_0x14fa86['agentringnoanswer']=!![];_0x14fa86[_0x344a('0x20')]=utils['now']();_0x14fa86['lastevent']='abandoned';_0x14fa86[_0x344a('0x22')]=_0x344a('0x29');_0x14fa86[_0x344a('0x23')]=_0x593cf6[_0x344a('0x23')];_0x14fa86[_0x344a('0x25')]=0x0;writeDB(_0x14fa86);}});}catch(_0xdf6a8f){utils['error'](util[_0x344a('0x4')](_0x344a('0x2a'),_0x593cf6[_0x344a('0x15')]),_0xdf6a8f);}};exports['agentconnect']=function(_0x3698eb){try{if(agents[_0x3698eb[_0x344a('0x16')]]){utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb['uniqueid']),_0x3698eb);utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x2c'),_0x3698eb[_0x344a('0x15')],agents[_0x3698eb[_0x344a('0x16')]]['membername'],_0x3698eb[_0x344a('0x16')]));agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x2d')]=utils[_0x344a('0x18')]();agents[_0x3698eb[_0x344a('0x16')]]['connectedlinenum']=_0x3698eb[_0x344a('0x19')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x1a')]=_0x3698eb[_0x344a('0x1a')];agents[_0x3698eb[_0x344a('0x16')]][_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];agents[_0x3698eb[_0x344a('0x16')]]['lastevent']=_0x344a('0x2e');_[_0x344a('0x27')](agents,function(_0x3d34c3,_0x28bad9){if(_0x3d34c3[_0x344a('0x16')]!=_0x3698eb['destuniqueid']&&_0x3d34c3[_0x344a('0x15')]==_0x3698eb[_0x344a('0x15')]){_0x3d34c3[_0x344a('0x25')]=0x0;_0x3d34c3[_0x344a('0x23')]=_0x3698eb[_0x344a('0x24')];_0x3d34c3[_0x344a('0x1d')]=!![];_0x3d34c3[_0x344a('0x20')]=utils[_0x344a('0x18')]();_0x3d34c3[_0x344a('0x2f')]='answered_elsewhere';_0x3d34c3[_0x344a('0x22')]=_0x344a('0x30');_0x3d34c3[_0x344a('0x31')]=_0x3698eb[_0x344a('0x16')];_0x3d34c3['answeredelsewheremembername']=_0x3698eb[_0x344a('0x8')];writeDB(_0x3d34c3);}});}}catch(_0x3069ca){utils[_0x344a('0x1c')](util[_0x344a('0x4')](_0x344a('0x2b'),_0x3698eb[_0x344a('0x15')]),_0x3069ca);}};exports[_0x344a('0xd')]=function(_0x372e7d){try{if(!_[_0x344a('0x32')](agents[_0x372e7d[_0x344a('0x16')]])){utils[_0x344a('0x13')](util['format'](_0x344a('0x33'),_0x372e7d[_0x344a('0x15')]),_0x372e7d);utils['info'](util[_0x344a('0x4')](_0x344a('0x34'),_0x372e7d['uniqueid'],agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x8')],_0x372e7d['destuniqueid']));agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0xd')]=!![];agents[_0x372e7d[_0x344a('0x16')]]['agentcompleteAt']=utils[_0x344a('0x18')]();agents[_0x372e7d['destuniqueid']][_0x344a('0x25')]=utils[_0x344a('0x35')](agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x36')],agents[_0x372e7d['destuniqueid']]['agentconnectAt']);agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x22')]=_0x372e7d[_0x344a('0x22')];agents[_0x372e7d[_0x344a('0x16')]][_0x344a('0x2f')]=_0x344a('0x37');writeDB(agents[_0x372e7d[_0x344a('0x16')]]);}}catch(_0x23c214){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][agentcomplete]',_0x372e7d[_0x344a('0x15')]),_0x23c214);}};exports[_0x344a('0x38')]=function(_0x6fad37){try{if(!_[_0x344a('0x32')](agents[_0x6fad37['transfereruniqueid']])){utils[_0x344a('0x13')](util['format']('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x6fad37);utils[_0x344a('0x3')](util['format'](_0x344a('0x39'),_0x6fad37[_0x344a('0x15')],agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x8')],agents[_0x6fad37['transfereruniqueid']][_0x344a('0x15')]));agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3b')]=!![];agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3c')]=_0x344a('0x3d');agents[_0x6fad37[_0x344a('0x3a')]][_0x344a('0x3e')]=_0x6fad37[_0x344a('0x3f')];agents[_0x6fad37[_0x344a('0x3a')]]['transferuniqueid']=agents[_0x6fad37[_0x344a('0x3a')]]['uniqueid'];}}catch(_0x1b7f6c){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][blindtransfer]',_0x6fad37[_0x344a('0x15')]),_0x1b7f6c);}};exports[_0x344a('0x40')]=function(_0x188c6b){try{utils[_0x344a('0x13')](util[_0x344a('0x4')](_0x344a('0x41'),_0x188c6b[_0x344a('0x42')]),_0x188c6b);if(_0x188c6b[_0x344a('0x42')]==_0x188c6b[_0x344a('0x43')]){if(!_['isNil'](agents[_0x188c6b[_0x344a('0x44')]])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b[_0x344a('0x42')],agents[_0x188c6b['secondtransfereruniqueid']][_0x344a('0x8')]));agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x3b')]=!![];agents[_0x188c6b[_0x344a('0x44')]]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x44')]]['transferexten']=_0x188c6b[_0x344a('0x47')];agents[_0x188c6b[_0x344a('0x44')]][_0x344a('0x48')]=_0x188c6b[_0x344a('0x42')];}if(_0x188c6b[_0x344a('0x49')]&&agents[_0x188c6b[_0x344a('0x49')]]){agents[_0x188c6b[_0x344a('0x49')]]['agententerreason']=0x1;transfers[_0x188c6b['transfereeuniqueid']]=_['clone'](agents[_0x188c6b[_0x344a('0x49')]]);transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0xa')]=agents[_0x188c6b[_0x344a('0x44')]]['calleridnum'];transfers[_0x188c6b[_0x344a('0x49')]]['calleridname']=agents[_0x188c6b['secondtransfereruniqueid']]['calleridname'];transfers[_0x188c6b['transfereeuniqueid']][_0x344a('0x17')]=utils[_0x344a('0x18')]();transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x2d')]=utils['now']();transfers[_0x188c6b['transfereeuniqueid']]['holdtime']=0x0;transfers[_0x188c6b[_0x344a('0x49')]][_0x344a('0x4a')]=0x2;}}else if(_0x188c6b[_0x344a('0x44')]==_0x188c6b[_0x344a('0x4b')]){if(!_[_0x344a('0x32')](agents[_0x188c6b['origtransfereruniqueid']])){utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x45'),_0x188c6b['origtransfereruniqueid'],agents[_0x188c6b[_0x344a('0x42')]]['membername']));agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x3b')]=!![];agents[_0x188c6b['origtransfereruniqueid']]['transfertype']=_0x344a('0x46');agents[_0x188c6b[_0x344a('0x42')]]['transferexten']=_0x188c6b[_0x344a('0x4c')];agents[_0x188c6b['origtransfereruniqueid']][_0x344a('0x48')]=_0x188c6b[_0x344a('0x44')];}if(_0x188c6b[_0x344a('0x4d')]&&agents[_0x188c6b['transfertargetuniqueid']]){agents[_0x188c6b['transfertargetuniqueid']][_0x344a('0x4a')]=0x1;transfers[_0x188c6b[_0x344a('0x4d')]]=_[_0x344a('0x4e')](agents[_0x188c6b[_0x344a('0x4d')]]);transfers[_0x188c6b['transfertargetuniqueid']]['calleridnum']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0xa')];transfers[_0x188c6b[_0x344a('0x4d')]]['calleridname']=agents[_0x188c6b[_0x344a('0x42')]][_0x344a('0x4f')];transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x17')]=utils['now']();transfers[_0x188c6b[_0x344a('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x188c6b['transfertargetuniqueid']][_0x344a('0x23')]=0x0;transfers[_0x188c6b[_0x344a('0x4d')]][_0x344a('0x4a')]=0x2;}}}catch(_0xce0446){utils[_0x344a('0x1c')](util[_0x344a('0x4')]('[%s][agents][attendedtransfer]',_0x188c6b[_0x344a('0x42')]),_0xce0446);}};exports[_0x344a('0x50')]=function(_0x20a892){try{utils[_0x344a('0x13')](util[_0x344a('0x4')]('[%s][agents][hangup]',_0x20a892[_0x344a('0x15')]),_0x20a892);if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892['uniqueid']][_0x344a('0x22')]===_0x344a('0x21')){if(_0x20a892[_0x344a('0x51')]==='21'){agents[_0x20a892[_0x344a('0x15')]]['reason']=_0x344a('0x52');agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]=_0x344a('0x52');}utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892['uniqueid']][_0x344a('0x8')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]));writeDB(agents[_0x20a892[_0x344a('0x15')]]);var _0x212b08=unanswered[_0x344a('0x54')](_0x20a892['uniqueid']);if(_0x212b08>-0x1){unanswered[_0x344a('0x55')](_0x212b08,0x1);}}if(transfers[_0x20a892[_0x344a('0x15')]]){transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0xd')]=!![];transfers[_0x20a892['uniqueid']][_0x344a('0x36')]=utils[_0x344a('0x18')]();transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x25')]=utils[_0x344a('0x35')](transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')],transfers[_0x20a892[_0x344a('0x15')]]['agentconnectAt']);transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=_0x344a('0x56');transfers[_0x20a892[_0x344a('0x15')]]['lastevent']=_0x344a('0x37');utils[_0x344a('0x3')](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],transfers[_0x20a892[_0x344a('0x15')]]['membername'],transfers[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],transfers[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(transfers[_0x20a892[_0x344a('0x15')]],!![]);}if(agents[_0x20a892[_0x344a('0x15')]]&&agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]){agents[_0x20a892[_0x344a('0x15')]]['agentcomplete']=!![];agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x36')]=utils[_0x344a('0x18')]();agents[_0x20a892['uniqueid']][_0x344a('0x25')]=utils['diffTime'](agents[_0x20a892['uniqueid']][_0x344a('0x36')],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2d')]);agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')]=agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x3b')]?_0x344a('0x3b'):'agent';agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x2f')]='complete';utils['info'](util[_0x344a('0x4')](_0x344a('0x53'),_0x20a892[_0x344a('0x15')],agents[_0x20a892[_0x344a('0x15')]]['membername'],agents[_0x20a892[_0x344a('0x15')]][_0x344a('0x22')],agents[_0x20a892[_0x344a('0x15')]]['lastevent']));writeDB(agents[_0x20a892[_0x344a('0x15')]]);}}catch(_0x1c50c3){utils[_0x344a('0x1c')](util['format'](_0x344a('0x57'),_0x20a892[_0x344a('0x15')]),_0x1c50c3);}}; \ No newline at end of file +var _0xa5fa=['[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','transfertype','secondtransfererexten','transferuniqueid','transfertargetuniqueid','hangup','[%s][agents][hangup]','cause','rejected','indexOf','splice','agent','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','then','type','acw','acwTimeout','CreateVoiceAgentReport','request','uniqueid','destuniqueid','[%s][agents][agentcalled]','called','connectedlinename','info','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','forIn','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','agentcomplete','[%s][agents][agentcomplete]','agentcompleteAt','diffTime','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferexten','[%s][agents][blindtransfer]','attendedtransfer'];(function(_0x4f54a5,_0x1f8cf5){var _0x1d4fd2=function(_0x29fe6b){while(--_0x29fe6b){_0x4f54a5['push'](_0x4f54a5['shift']());}};_0x1d4fd2(++_0x1f8cf5);}(_0xa5fa,0xc4));var _0xaa5f=function(_0x339f67,_0x3eef63){_0x339f67=_0x339f67-0x0;var _0x9d6b2=_0xa5fa[_0x339f67];return _0x9d6b2;};'use strict';var _=require('lodash');var util=require(_0xaa5f('0x0'));var utils=require(_0xaa5f('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x24d383,_0x1b7e1d){utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x3'),_0x24d383['uniqueid'],_0x24d383[_0xaa5f('0x4')],_0x24d383[_0xaa5f('0x5')],_0x24d383[_0xaa5f('0x6')],_0x24d383[_0xaa5f('0x7')],_0x24d383[_0xaa5f('0x8')],_0x24d383[_0xaa5f('0x9')],_0x24d383[_0xaa5f('0xa')]));if(_0x24d383[_0xaa5f('0x5')]){utils[_0xaa5f('0xb')](_0x24d383[_0xaa5f('0x5')])[_0xaa5f('0xc')](function(_0x4e5257){if(_0x4e5257){_0x24d383[_0xaa5f('0xd')]=_0x4e5257[_0xaa5f('0xd')];_0x24d383['agentacw']=_0x24d383['agentcomplete']?_0x4e5257[_0xaa5f('0xe')]:![];_0x24d383['acwtime']=_0x24d383['agentacw']?_0x4e5257[_0xaa5f('0xf')]:0x0;}utils['request'](_0xaa5f('0x10'),_0x24d383);});}else{utils[_0xaa5f('0x11')](_0xaa5f('0x10'),_0x24d383);}if(_0x1b7e1d){delete transfers[_0x24d383[_0xaa5f('0x12')]];}else{delete agents[_0x24d383[_0xaa5f('0x13')]];}}exports['agentcalled']=function(_0xbd4e10){try{utils['debug'](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0xbd4e10);agents[_0xbd4e10[_0xaa5f('0x13')]]=_0xbd4e10;agents[_0xbd4e10[_0xaa5f('0x13')]]['agentcalledAt']=utils['now']();agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x15');agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x9')]=null;agents[_0xbd4e10[_0xaa5f('0x13')]][_0xaa5f('0x16')]=null;utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x18'),_0xbd4e10[_0xaa5f('0x12')],agents[_0xbd4e10[_0xaa5f('0x13')]]['membername'],_0xbd4e10[_0xaa5f('0x13')]));}catch(_0x4c0a9d){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x14'),_0xbd4e10[_0xaa5f('0x12')]),_0x4c0a9d);}};exports[_0xaa5f('0x1a')]=function(_0x194691){try{if(!_[_0xaa5f('0x1b')](agents[_0x194691[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x1d'),_0x194691['uniqueid']),_0x194691);utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x1e'),_0x194691[_0xaa5f('0x12')],agents[_0x194691['destuniqueid']][_0xaa5f('0x6')],_0x194691[_0xaa5f('0x13')]));agents[_0x194691['destuniqueid']][_0xaa5f('0x1a')]=!![];agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x1f')]=utils[_0xaa5f('0x20')]();agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]]['reason']=_0xaa5f('0x21');agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x194691['ringtime']?parseInt(_0x194691[_0xaa5f('0x23')])/0x3e8:0x0;agents[_0x194691[_0xaa5f('0x13')]][_0xaa5f('0x24')]=0x0;unanswered['push'](_0x194691[_0xaa5f('0x13')]);}}catch(_0x479f29){utils['error'](util[_0xaa5f('0x2')]('[%s][agents][agentringnoanswer]',_0x194691[_0xaa5f('0x12')]),_0x479f29);}};exports['queuecallerabandon']=function(_0x4c5dc0){try{_['forIn'](agents,function(_0x26a90d,_0x4ddebd){if(_0x26a90d[_0xaa5f('0x12')]==_0x4c5dc0[_0xaa5f('0x12')]&&!_['includes'](unanswered,_0x26a90d['destuniqueid'])){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x4c5dc0);utils['info'](util[_0xaa5f('0x2')](_0xaa5f('0x26'),_0x4c5dc0[_0xaa5f('0x12')],_0x26a90d['membername'],_0x26a90d[_0xaa5f('0x13')]));_0x26a90d[_0xaa5f('0x1a')]=!![];_0x26a90d['agentringnoanswerAt']=utils['now']();_0x26a90d['lastevent']='abandoned';_0x26a90d[_0xaa5f('0x27')]=_0xaa5f('0x28');_0x26a90d[_0xaa5f('0x22')]=_0x4c5dc0[_0xaa5f('0x22')];_0x26a90d[_0xaa5f('0x24')]=0x0;writeDB(_0x26a90d);}});}catch(_0x3bcaf6){utils[_0xaa5f('0x19')](util['format'](_0xaa5f('0x25'),_0x4c5dc0[_0xaa5f('0x12')]),_0x3bcaf6);}};exports[_0xaa5f('0x29')]=function(_0x1f3268){try{if(agents[_0x1f3268[_0xaa5f('0x13')]]){utils[_0xaa5f('0x1c')](util['format'](_0xaa5f('0x2a'),_0x1f3268[_0xaa5f('0x12')]),_0x1f3268);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x2b'),_0x1f3268['uniqueid'],agents[_0x1f3268['destuniqueid']][_0xaa5f('0x6')],_0x1f3268[_0xaa5f('0x13')]));agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x2c')]=utils['now']();agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x9')]=_0x1f3268[_0xaa5f('0x9')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x16')]=_0x1f3268[_0xaa5f('0x16')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];agents[_0x1f3268[_0xaa5f('0x13')]][_0xaa5f('0xa')]='connect';_[_0xaa5f('0x2d')](agents,function(_0x2562ce,_0xcd9c30){if(_0x2562ce[_0xaa5f('0x13')]!=_0x1f3268[_0xaa5f('0x13')]&&_0x2562ce[_0xaa5f('0x12')]==_0x1f3268[_0xaa5f('0x12')]){_0x2562ce[_0xaa5f('0x24')]=0x0;_0x2562ce[_0xaa5f('0x22')]=_0x1f3268[_0xaa5f('0x23')];_0x2562ce['agentringnoanswer']=!![];_0x2562ce[_0xaa5f('0x1f')]=utils['now']();_0x2562ce[_0xaa5f('0xa')]=_0xaa5f('0x2e');_0x2562ce[_0xaa5f('0x27')]='answered_elsewhere';_0x2562ce[_0xaa5f('0x2f')]=_0x1f3268[_0xaa5f('0x13')];_0x2562ce[_0xaa5f('0x30')]=_0x1f3268['membername'];writeDB(_0x2562ce);}});}}catch(_0x12a8e4){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x2a'),_0x1f3268['uniqueid']),_0x12a8e4);}};exports[_0xaa5f('0x31')]=function(_0x2b2b4c){try{if(!_[_0xaa5f('0x1b')](agents[_0x2b2b4c[_0xaa5f('0x13')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x2b2b4c);utils['info'](util[_0xaa5f('0x2')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x2b2b4c[_0xaa5f('0x12')],agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x6')],_0x2b2b4c[_0xaa5f('0x13')]));agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x33')]=utils['now']();agents[_0x2b2b4c['destuniqueid']]['talktime']=utils[_0xaa5f('0x34')](agents[_0x2b2b4c['destuniqueid']][_0xaa5f('0x33')],agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0x2c')]);agents[_0x2b2b4c[_0xaa5f('0x13')]]['reason']=_0x2b2b4c[_0xaa5f('0x27')];agents[_0x2b2b4c[_0xaa5f('0x13')]][_0xaa5f('0xa')]=_0xaa5f('0x35');writeDB(agents[_0x2b2b4c[_0xaa5f('0x13')]]);}}catch(_0x1f9629){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x32'),_0x2b2b4c[_0xaa5f('0x12')]),_0x1f9629);}};exports[_0xaa5f('0x36')]=function(_0x2de737){try{if(!_[_0xaa5f('0x1b')](agents[_0x2de737[_0xaa5f('0x37')]])){utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')]('[%s][agents][blindtransfer]',_0x2de737[_0xaa5f('0x12')]),_0x2de737);utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x38'),_0x2de737[_0xaa5f('0x12')],agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x6')],agents[_0x2de737['transfereruniqueid']][_0xaa5f('0x12')]));agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x39')]=!![];agents[_0x2de737[_0xaa5f('0x37')]]['transfertype']=_0xaa5f('0x3a');agents[_0x2de737[_0xaa5f('0x37')]][_0xaa5f('0x3b')]=_0x2de737['extension'];agents[_0x2de737['transfereruniqueid']]['transferuniqueid']=agents[_0x2de737['transfereruniqueid']]['uniqueid'];}}catch(_0x509c61){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3c'),_0x2de737[_0xaa5f('0x12')]),_0x509c61);}};exports[_0xaa5f('0x3d')]=function(_0x17b872){try{utils['debug'](util['format'](_0xaa5f('0x3e'),_0x17b872[_0xaa5f('0x3f')]),_0x17b872);if(_0x17b872['origtransfereruniqueid']==_0x17b872[_0xaa5f('0x40')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872[_0xaa5f('0x41')]])){utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872['secondtransfereruniqueid']]['membername']));agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x39')]=!![];agents[_0x17b872['secondtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x17b872[_0xaa5f('0x41')]]['transferexten']=_0x17b872[_0xaa5f('0x43')];agents[_0x17b872['secondtransfereruniqueid']]['transferuniqueid']=_0x17b872[_0xaa5f('0x3f')];}if(_0x17b872[_0xaa5f('0x44')]&&agents[_0x17b872[_0xaa5f('0x44')]]){agents[_0x17b872['transfereeuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x44')]]=_[_0xaa5f('0x46')](agents[_0x17b872['transfereeuniqueid']]);transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x8')]=agents[_0x17b872['secondtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x47')]=agents[_0x17b872[_0xaa5f('0x41')]][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x48')]=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]]['agentconnectAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872[_0xaa5f('0x44')]][_0xaa5f('0x45')]=0x2;}}else if(_0x17b872[_0xaa5f('0x41')]==_0x17b872[_0xaa5f('0x49')]){if(!_[_0xaa5f('0x1b')](agents[_0x17b872['origtransfereruniqueid']])){utils[_0xaa5f('0x17')](util['format'](_0xaa5f('0x42'),_0x17b872[_0xaa5f('0x3f')],agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x6')]));agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x39')]=!![];agents[_0x17b872[_0xaa5f('0x3f')]][_0xaa5f('0x4a')]='ATTENDED';agents[_0x17b872[_0xaa5f('0x3f')]]['transferexten']=_0x17b872[_0xaa5f('0x4b')];agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x4c')]=_0x17b872[_0xaa5f('0x41')];}if(_0x17b872[_0xaa5f('0x4d')]&&agents[_0x17b872[_0xaa5f('0x4d')]]){agents[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x1;transfers[_0x17b872[_0xaa5f('0x4d')]]=_['clone'](agents[_0x17b872['transfertargetuniqueid']]);transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x8')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x8')];transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x47')]=agents[_0x17b872['origtransfereruniqueid']][_0xaa5f('0x47')];transfers[_0x17b872[_0xaa5f('0x4d')]]['agentcalledAt']=utils[_0xaa5f('0x20')]();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x2c')]=utils['now']();transfers[_0x17b872[_0xaa5f('0x4d')]][_0xaa5f('0x22')]=0x0;transfers[_0x17b872['transfertargetuniqueid']][_0xaa5f('0x45')]=0x2;}}}catch(_0x309605){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')](_0xaa5f('0x3e'),_0x17b872['origtransfereruniqueid']),_0x309605);}};exports[_0xaa5f('0x4e')]=function(_0x2ba378){try{utils[_0xaa5f('0x1c')](util[_0xaa5f('0x2')](_0xaa5f('0x4f'),_0x2ba378['uniqueid']),_0x2ba378);if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378['uniqueid']][_0xaa5f('0x27')]===_0xaa5f('0x21')){if(_0x2ba378[_0xaa5f('0x50')]==='21'){agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=_0xaa5f('0x51');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x51');}utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378['uniqueid'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]]['lastevent']));writeDB(agents[_0x2ba378['uniqueid']]);var _0x104079=unanswered[_0xaa5f('0x52')](_0x2ba378['uniqueid']);if(_0x104079>-0x1){unanswered[_0xaa5f('0x53')](_0x104079,0x1);}}if(transfers[_0x2ba378['uniqueid']]){transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x31')]=!![];transfers[_0x2ba378['uniqueid']][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')],transfers[_0x2ba378['uniqueid']][_0xaa5f('0x2c')]);transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')]='agent';transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x2ba378[_0xaa5f('0x12')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x6')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],transfers[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(transfers[_0x2ba378[_0xaa5f('0x12')]],!![]);}if(agents[_0x2ba378[_0xaa5f('0x12')]]&&agents[_0x2ba378[_0xaa5f('0x12')]]['agentconnectAt']){agents[_0x2ba378['uniqueid']][_0xaa5f('0x31')]=!![];agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x33')]=utils[_0xaa5f('0x20')]();agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x24')]=utils[_0xaa5f('0x34')](agents[_0x2ba378[_0xaa5f('0x12')]]['agentcompleteAt'],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x2c')]);agents[_0x2ba378[_0xaa5f('0x12')]]['reason']=agents[_0x2ba378['uniqueid']][_0xaa5f('0x39')]?_0xaa5f('0x39'):_0xaa5f('0x54');agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]=_0xaa5f('0x35');utils[_0xaa5f('0x17')](util[_0xaa5f('0x2')](_0xaa5f('0x55'),_0x2ba378[_0xaa5f('0x12')],agents[_0x2ba378['uniqueid']][_0xaa5f('0x6')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0x27')],agents[_0x2ba378[_0xaa5f('0x12')]][_0xaa5f('0xa')]));writeDB(agents[_0x2ba378['uniqueid']]);}}catch(_0x4183c0){utils[_0xaa5f('0x19')](util[_0xaa5f('0x2')]('[%s][agents][hangup]',_0x2ba378['uniqueid']),_0x4183c0);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index e509c6d..b5ebd33 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 _0xceef=['[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','varset','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][varset]','newexten','[%s][calls][newexten]','application','appdata','startsWith','toLowerCase','cdr','split','substring','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','newchannel','format','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','now','[%s][calls][newchannel]','newstate','debug','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','duration','diffTime','endtime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt'];(function(_0x511345,_0x32dafe){var _0x24b2c5=function(_0x507388){while(--_0x507388){_0x511345['push'](_0x511345['shift']());}};_0x24b2c5(++_0x32dafe);}(_0xceef,0x1ee));var _0xfcee=function(_0x341a5a,_0x4ae5ed){_0x341a5a=_0x341a5a-0x0;var _0x53f85b=_0xceef[_0x341a5a];return _0x53f85b;};'use strict';var _=require(_0xfcee('0x0'));var util=require(_0xfcee('0x1'));var utils=require(_0xfcee('0x2'));var dispositions=['NO\x20ANSWER','FAILED',_0xfcee('0x3'),_0xfcee('0x4'),_0xfcee('0x4'),_0xfcee('0x4'),_0xfcee('0x5'),_0xfcee('0x6'),_0xfcee('0x3'),_0xfcee('0x3'),_0xfcee('0x3')];var channels={};function writeDB(_0x290b0d){utils[_0xfcee('0x7')](util['format'](_0xfcee('0x8'),_0x290b0d[_0xfcee('0x9')],_0x290b0d[_0xfcee('0xa')],_0x290b0d[_0xfcee('0xb')],_0x290b0d[_0xfcee('0xc')],_0x290b0d[_0xfcee('0xd')],_0x290b0d[_0xfcee('0xe')],_0x290b0d[_0xfcee('0xf')],_0x290b0d[_0xfcee('0x10')]));if(_0x290b0d[_0xfcee('0x11')]){utils[_0xfcee('0x12')](_0x290b0d[_0xfcee('0x11')])[_0xfcee('0x13')](function(_0x4d5e6b){if(_0x4d5e6b){_0x290b0d[_0xfcee('0x14')]=_0x4d5e6b['id'];}utils['request']('CreateVoiceCallReport',_0x290b0d);});}else{utils['request'](_0xfcee('0x15'),_0x290b0d);}if(channels[_0x290b0d[_0xfcee('0x9')]]){delete channels[_0x290b0d[_0xfcee('0x9')]];}}exports[_0xfcee('0x16')]=function(_0x2153d8){try{utils['debug'](util[_0xfcee('0x17')]('[%s][calls][newchannel]',_0x2153d8['uniqueid']),_0x2153d8);if(_0x2153d8[_0xfcee('0x9')]==_0x2153d8['linkedid']&&_0x2153d8['channel']!=_0xfcee('0x18')){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x19'),_0x2153d8[_0xfcee('0x9')],_0x2153d8[_0xfcee('0x1a')],_0x2153d8['exten']));channels[_0x2153d8[_0xfcee('0x9')]]={'uniqueid':_0x2153d8['uniqueid'],'accountcode':_0x2153d8[_0xfcee('0x11')],'source':_0x2153d8[_0xfcee('0xe')],'destination':_0x2153d8['exten'],'destinationcontext':_0x2153d8[_0xfcee('0x1a')],'channel':_0x2153d8[_0xfcee('0xa')],'starttime':utils[_0xfcee('0x1b')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xfcee('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x50424d){utils['error'](util[_0xfcee('0x17')](_0xfcee('0x1c'),_0x2153d8[_0xfcee('0x9')]),_0x50424d);}};exports[_0xfcee('0x1d')]=function(_0x2bd37d){try{utils[_0xfcee('0x1e')](util['format'](_0xfcee('0x1f'),_0x2bd37d[_0xfcee('0x9')]),_0x2bd37d);if(!_['isNil'](channels[_0x2bd37d[_0xfcee('0x9')]])&&_0x2bd37d[_0xfcee('0x20')]==0x6){utils['info'](util[_0xfcee('0x17')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x2bd37d['uniqueid'],_0x2bd37d[_0xfcee('0x1a')],_0x2bd37d[_0xfcee('0xa')]));if(_[_0xfcee('0x21')](channels[_0x2bd37d[_0xfcee('0x9')]][_0xfcee('0x22')])){channels[_0x2bd37d[_0xfcee('0x9')]]['systemanswertime']=utils[_0xfcee('0x1b')]();}}else if(!_[_0xfcee('0x21')](channels[_0x2bd37d['linkedid']])&&_0x2bd37d[_0xfcee('0x20')]==0x6&&_0x2bd37d['context']!=_0xfcee('0x23')){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x24'),_0x2bd37d[_0xfcee('0x9')],_0x2bd37d[_0xfcee('0x25')],_0x2bd37d[_0xfcee('0x1a')],_0x2bd37d[_0xfcee('0xa')]));channels[_0x2bd37d['linkedid']][_0xfcee('0x11')]=_0x2bd37d[_0xfcee('0x11')];channels[_0x2bd37d[_0xfcee('0x25')]][_0xfcee('0x26')]=_0x2bd37d[_0xfcee('0xa')];if(_['isNil'](channels[_0x2bd37d[_0xfcee('0x25')]][_0xfcee('0x27')])){channels[_0x2bd37d['linkedid']][_0xfcee('0x27')]=utils[_0xfcee('0x1b')]();}channels[_0x2bd37d[_0xfcee('0x25')]]['disposition']=dispositions[_[_0xfcee('0x28')](_0x2bd37d['channelstate'])]||_0xfcee('0x5');}}catch(_0x57f6ff){utils['error'](util[_0xfcee('0x17')](_0xfcee('0x1f'),_0x2bd37d['uniqueid']),_0x57f6ff);}};exports[_0xfcee('0x29')]=function(_0x1014f2){try{if(!_[_0xfcee('0x21')](channels[_0x1014f2[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')](_0xfcee('0x2a'),_0x1014f2['uniqueid']),_0x1014f2);if(_[_0xfcee('0x21')](channels[_0x1014f2[_0xfcee('0x9')]]['callerid'])){channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x2b')]=_0x1014f2[_0xfcee('0x2c')]+'\x20<'+_0x1014f2[_0xfcee('0xe')]+'>';}utils['info'](util[_0xfcee('0x17')](_0xfcee('0x2d'),_0x1014f2[_0xfcee('0x9')],channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x2b')],_0x1014f2[_0xfcee('0x2e')]));channels[_0x1014f2[_0xfcee('0x9')]]['endtime']=utils[_0xfcee('0x1b')]();channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x2f')]=utils[_0xfcee('0x30')](channels[_0x1014f2['uniqueid']][_0xfcee('0x31')],channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x32')]);channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x33')]=channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x27')]?utils[_0xfcee('0x30')](channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x31')],channels[_0x1014f2[_0xfcee('0x9')]][_0xfcee('0x27')]):0x0;writeDB(channels[_0x1014f2['uniqueid']]);}}catch(_0x78b584){utils[_0xfcee('0x34')](util['format'](_0xfcee('0x2a'),_0x1014f2['uniqueid']),_0x78b584);}};exports[_0xfcee('0x35')]=function(_0xc63344){try{if(!_['isNil'](channels[_0xc63344[_0xfcee('0x36')]])){utils['debug'](util[_0xfcee('0x17')](_0xfcee('0x37'),_0xc63344[_0xfcee('0x38')]),_0xc63344);if(channels[_0xc63344[_0xfcee('0x36')]][_0xfcee('0xa')]==_0xc63344[_0xfcee('0x39')]){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x3a'),_0xc63344[_0xfcee('0x38')],_0xc63344['localtwolinkedid'],_0xc63344[_0xfcee('0x3b')]));channels[_0xc63344['localtwolinkedid']][_0xfcee('0x26')]=_0xc63344[_0xfcee('0x3b')];channels[_0xc63344[_0xfcee('0x36')]][_0xfcee('0x3c')]=_0xfcee('0x3d');}else if(channels[_0xc63344['localtwolinkedid']][_0xfcee('0xa')]=_0xc63344[_0xfcee('0x3e')]){utils[_0xfcee('0x7')](util['format'](_0xfcee('0x3a'),_0xc63344[_0xfcee('0x38')],_0xc63344['localtwolinkedid'],_0xc63344['origtransfererchannel']));channels[_0xc63344[_0xfcee('0x36')]]['destinationchannel']=_0xc63344[_0xfcee('0x3f')];channels[_0xc63344[_0xfcee('0x36')]][_0xfcee('0x3c')]='_attended';}}}catch(_0x4ecaa8){utils[_0xfcee('0x34')](util[_0xfcee('0x17')](_0xfcee('0x37'),_0xc63344[_0xfcee('0x38')]),_0x4ecaa8);}};exports[_0xfcee('0x40')]=function(_0x3a38de){try{if(!_[_0xfcee('0x21')](channels[_0x3a38de[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')]('[%s][calls][musiconholdstart]',_0x3a38de[_0xfcee('0x9')]),_0x3a38de);channels[_0x3a38de[_0xfcee('0x9')]][_0xfcee('0x41')]=utils[_0xfcee('0x1b')]();utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x42'),_0x3a38de[_0xfcee('0x9')],channels[_0x3a38de[_0xfcee('0x9')]][_0xfcee('0x41')]));}}catch(_0x25befa){utils[_0xfcee('0x34')](util[_0xfcee('0x17')](_0xfcee('0x43'),_0x3a38de['uniqueid']),_0x25befa);}};exports[_0xfcee('0x44')]=function(_0x1632ff){try{if(!_['isNil'](channels[_0x1632ff[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')](_0xfcee('0x45'),_0x1632ff[_0xfcee('0x9')]),_0x1632ff);if(!_[_0xfcee('0x21')](channels[_0x1632ff[_0xfcee('0x9')]][_0xfcee('0x41')])){channels[_0x1632ff[_0xfcee('0x9')]]['mohtime']+=utils['diffTime'](utils[_0xfcee('0x1b')](),channels[_0x1632ff['uniqueid']]['musiconholdstartAt']);utils['info'](util['format'](_0xfcee('0x46'),_0x1632ff[_0xfcee('0x9')],channels[_0x1632ff[_0xfcee('0x9')]][_0xfcee('0x47')]));delete channels[_0x1632ff[_0xfcee('0x9')]]['musiconholdstartAt'];}}}catch(_0x4719a2){utils[_0xfcee('0x34')](util['format'](_0xfcee('0x45'),_0x1632ff[_0xfcee('0x9')]),_0x4719a2);}};exports[_0xfcee('0x48')]=function(_0x1e4d3b){try{if(!_['isNil'](channels[_0x1e4d3b[_0xfcee('0x9')]])){utils['debug'](util[_0xfcee('0x17')]('[%s][calls][varset]',_0x1e4d3b[_0xfcee('0x9')]),_0x1e4d3b);if(!_['isNil'](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x4a')])){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x4b'),_0x1e4d3b[_0xfcee('0x9')],_0x1e4d3b['value']));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x4c')]=_0x1e4d3b[_0xfcee('0x4d')];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x4e')])){utils[_0xfcee('0x7')](util[_0xfcee('0x17')](_0xfcee('0x4f'),_0x1e4d3b[_0xfcee('0x9')],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x50')]=_0x1e4d3b[_0xfcee('0x4d')];channels[_0x1e4d3b['uniqueid']][_0xfcee('0x2b')]='\x22'+_0x1e4d3b[_0xfcee('0x4d')]+_0xfcee('0x51')+_0x1e4d3b[_0xfcee('0x4d')]+'>';}if(!_[_0xfcee('0x21')](_0x1e4d3b['variable'][_0xfcee('0x52')])||!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x53')])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x54'),_0x1e4d3b['uniqueid'],!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x52')])?_0xfcee('0x52'):_0xfcee('0x53'),_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x2b')]=_0x1e4d3b['value'];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')]['xmd-queue'])||!_[_0xfcee('0x21')](_0x1e4d3b['variable'][_0xfcee('0x55')])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x54'),_0x1e4d3b[_0xfcee('0x9')],!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x56')])?_0xfcee('0x56'):_0xfcee('0x55'),_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x57')]=_0xfcee('0x58');channels[_0x1e4d3b['uniqueid']][_0xfcee('0x59')]=_0x1e4d3b[_0xfcee('0x4d')];channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0xb')]=!![];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')][_0xfcee('0x5a')])){utils[_0xfcee('0x7')](util['format'](_0xfcee('0x5b'),_0x1e4d3b['uniqueid'],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x5c')]=_0x1e4d3b[_0xfcee('0x4d')];}if(!_[_0xfcee('0x21')](_0x1e4d3b['variable']['xmd-cdrtype'])){utils['info'](util[_0xfcee('0x17')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1e4d3b['uniqueid'],_0x1e4d3b['value']));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x5d')]=_0x1e4d3b[_0xfcee('0x4d')];}if(!_['isNil'](_0x1e4d3b['variable']['outboundrouteid'])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x5e'),_0x1e4d3b['uniqueid'],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]]['routeid']=_0x1e4d3b['value'];}if(!_[_0xfcee('0x21')](_0x1e4d3b[_0xfcee('0x49')]['sipcallid'])){utils['info'](util[_0xfcee('0x17')](_0xfcee('0x5f'),_0x1e4d3b[_0xfcee('0x9')],_0x1e4d3b[_0xfcee('0x4d')]));channels[_0x1e4d3b[_0xfcee('0x9')]][_0xfcee('0x60')]=_0x1e4d3b['value'];}}}catch(_0x39d3f7){utils['error'](util[_0xfcee('0x17')](_0xfcee('0x61'),_0x1e4d3b[_0xfcee('0x9')]),_0x39d3f7);}};exports[_0xfcee('0x62')]=function(_0x21d048){try{if(!_['isNil'](channels[_0x21d048[_0xfcee('0x9')]])){utils[_0xfcee('0x1e')](util[_0xfcee('0x17')](_0xfcee('0x63'),_0x21d048[_0xfcee('0x9')]),_0x21d048);utils[_0xfcee('0x7')](util[_0xfcee('0x17')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x21d048[_0xfcee('0x9')],_0x21d048[_0xfcee('0x64')],_0x21d048[_0xfcee('0x65')]));if(_0x21d048[_0xfcee('0x64')]['toLowerCase']()=='set'&&_[_0xfcee('0x66')](_0x21d048[_0xfcee('0x65')][_0xfcee('0x67')](),_0xfcee('0x68'))){var _0x3ff3a6=_0x21d048[_0xfcee('0x65')][_0xfcee('0x69')]('=');var _0x17d2f8=_0x3ff3a6[0x0][_0xfcee('0x6a')](_0x3ff3a6[0x0][_0xfcee('0x6b')]('(')+0x1,_0x3ff3a6[0x0][_0xfcee('0x6b')](')'));var _0x2deae3=_0x3ff3a6[0x1];channels[_0x21d048['uniqueid']][_0x17d2f8]=_0x2deae3;}if(!_[_0xfcee('0x6c')](['hangup',_0xfcee('0x6d'),_0xfcee('0x6e'),'set',_0xfcee('0x6f')],_0x21d048['application'][_0xfcee('0x67')]())){channels[_0x21d048[_0xfcee('0x9')]][_0xfcee('0x57')]=_0x21d048[_0xfcee('0x64')];channels[_0x21d048[_0xfcee('0x9')]][_0xfcee('0x59')]=_0x21d048['appdata'];}}}catch(_0x2b0c1c){utils[_0xfcee('0x34')](util['format'](_0xfcee('0x63'),_0x21d048[_0xfcee('0x9')]),_0x2b0c1c);}}; \ No newline at end of file +var _0x9076=['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','mohtime','diffTime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','xmd-phone','value','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','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','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','cdr','split','substring','includes','noop','execif','gotoif','toLowerCase','lastdata','lodash','util','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','context','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','channelstate','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s'];(function(_0x7fcad0,_0x3e75ae){var _0x4123fd=function(_0x1ca4ec){while(--_0x1ca4ec){_0x7fcad0['push'](_0x7fcad0['shift']());}};_0x4123fd(++_0x3e75ae);}(_0x9076,0x10f));var _0x6907=function(_0x5eee8f,_0x1b6324){_0x5eee8f=_0x5eee8f-0x0;var _0x58643d=_0x9076[_0x5eee8f];return _0x58643d;};'use strict';var _=require(_0x6907('0x0'));var util=require(_0x6907('0x1'));var utils=require('./utils');var dispositions=[_0x6907('0x2'),_0x6907('0x3'),_0x6907('0x3'),_0x6907('0x2'),'NO\x20ANSWER',_0x6907('0x2'),_0x6907('0x4'),_0x6907('0x5'),'FAILED',_0x6907('0x3'),'FAILED'];var channels={};function writeDB(_0x58fbf0){utils[_0x6907('0x6')](util[_0x6907('0x7')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x58fbf0[_0x6907('0x8')],_0x58fbf0[_0x6907('0x9')],_0x58fbf0[_0x6907('0xa')],_0x58fbf0[_0x6907('0xb')],_0x58fbf0[_0x6907('0xc')],_0x58fbf0[_0x6907('0xd')],_0x58fbf0[_0x6907('0xe')],_0x58fbf0[_0x6907('0xf')]));if(_0x58fbf0[_0x6907('0x10')]){utils[_0x6907('0x11')](_0x58fbf0['accountcode'])[_0x6907('0x12')](function(_0x52d770){if(_0x52d770){_0x58fbf0[_0x6907('0x13')]=_0x52d770['id'];}utils[_0x6907('0x14')](_0x6907('0x15'),_0x58fbf0);});}else{utils['request'](_0x6907('0x15'),_0x58fbf0);}if(channels[_0x58fbf0[_0x6907('0x8')]]){delete channels[_0x58fbf0['uniqueid']];}}exports['newchannel']=function(_0xc814d9){try{utils[_0x6907('0x16')](util[_0x6907('0x7')](_0x6907('0x17'),_0xc814d9[_0x6907('0x8')]),_0xc814d9);if(_0xc814d9['uniqueid']==_0xc814d9[_0x6907('0x18')]&&_0xc814d9[_0x6907('0x9')]!=_0x6907('0x19')){utils['info'](util[_0x6907('0x7')]('[%s][calls][newchannel]\x20context:%s\x20exten:%s',_0xc814d9['uniqueid'],_0xc814d9[_0x6907('0x1a')],_0xc814d9[_0x6907('0x1b')]));channels[_0xc814d9['uniqueid']]={'uniqueid':_0xc814d9[_0x6907('0x8')],'accountcode':_0xc814d9[_0x6907('0x10')],'source':_0xc814d9[_0x6907('0xd')],'destination':_0xc814d9['exten'],'destinationcontext':_0xc814d9[_0x6907('0x1a')],'channel':_0xc814d9[_0x6907('0x9')],'starttime':utils[_0x6907('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x6907('0x1d')};}}catch(_0x4fc3e6){utils[_0x6907('0x1e')](util[_0x6907('0x7')]('[%s][calls][newchannel]',_0xc814d9[_0x6907('0x8')]),_0x4fc3e6);}};exports[_0x6907('0x1f')]=function(_0x43ccf9){try{utils['debug'](util[_0x6907('0x7')](_0x6907('0x20'),_0x43ccf9[_0x6907('0x8')]),_0x43ccf9);if(!_[_0x6907('0x21')](channels[_0x43ccf9[_0x6907('0x8')]])&&_0x43ccf9['channelstate']==0x6){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x22'),_0x43ccf9[_0x6907('0x8')],_0x43ccf9[_0x6907('0x1a')],_0x43ccf9['channel']));if(_[_0x6907('0x21')](channels[_0x43ccf9[_0x6907('0x8')]][_0x6907('0x23')])){channels[_0x43ccf9['uniqueid']][_0x6907('0x23')]=utils[_0x6907('0x1c')]();}}else if(!_[_0x6907('0x21')](channels[_0x43ccf9['linkedid']])&&_0x43ccf9[_0x6907('0x24')]==0x6&&_0x43ccf9[_0x6907('0x1a')]!=_0x6907('0x25')){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x26'),_0x43ccf9[_0x6907('0x8')],_0x43ccf9[_0x6907('0x18')],_0x43ccf9[_0x6907('0x1a')],_0x43ccf9[_0x6907('0x9')]));channels[_0x43ccf9['linkedid']]['accountcode']=_0x43ccf9[_0x6907('0x10')];channels[_0x43ccf9['linkedid']]['destinationchannel']=_0x43ccf9[_0x6907('0x9')];if(_[_0x6907('0x21')](channels[_0x43ccf9[_0x6907('0x18')]][_0x6907('0x27')])){channels[_0x43ccf9['linkedid']][_0x6907('0x27')]=utils[_0x6907('0x1c')]();}channels[_0x43ccf9[_0x6907('0x18')]][_0x6907('0x28')]=dispositions[_[_0x6907('0x29')](_0x43ccf9['channelstate'])]||'ANSWERED';}}catch(_0x2eca83){utils[_0x6907('0x1e')](util[_0x6907('0x7')](_0x6907('0x20'),_0x43ccf9[_0x6907('0x8')]),_0x2eca83);}};exports[_0x6907('0x2a')]=function(_0x21c93e){try{if(!_[_0x6907('0x21')](channels[_0x21c93e[_0x6907('0x8')]])){utils[_0x6907('0x16')](util[_0x6907('0x7')](_0x6907('0x2b'),_0x21c93e[_0x6907('0x8')]),_0x21c93e);if(_[_0x6907('0x21')](channels[_0x21c93e[_0x6907('0x8')]]['callerid'])){channels[_0x21c93e[_0x6907('0x8')]][_0x6907('0x2c')]=_0x21c93e[_0x6907('0x2d')]+'\x20<'+_0x21c93e[_0x6907('0xd')]+'>';}utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x2e'),_0x21c93e[_0x6907('0x8')],channels[_0x21c93e[_0x6907('0x8')]][_0x6907('0x2c')],_0x21c93e['cause-txt']));channels[_0x21c93e[_0x6907('0x8')]][_0x6907('0x2f')]=utils[_0x6907('0x1c')]();channels[_0x21c93e[_0x6907('0x8')]]['duration']=utils['diffTime'](channels[_0x21c93e[_0x6907('0x8')]][_0x6907('0x2f')],channels[_0x21c93e[_0x6907('0x8')]]['starttime']);channels[_0x21c93e[_0x6907('0x8')]][_0x6907('0x30')]=channels[_0x21c93e[_0x6907('0x8')]]['answertime']?utils['diffTime'](channels[_0x21c93e[_0x6907('0x8')]][_0x6907('0x2f')],channels[_0x21c93e['uniqueid']][_0x6907('0x27')]):0x0;writeDB(channels[_0x21c93e[_0x6907('0x8')]]);}}catch(_0xe5d63d){utils[_0x6907('0x1e')](util[_0x6907('0x7')]('[%s][calls][hangup]',_0x21c93e[_0x6907('0x8')]),_0xe5d63d);}};exports['attendedtransfer']=function(_0x9f4f91){try{if(!_[_0x6907('0x21')](channels[_0x9f4f91[_0x6907('0x31')]])){utils[_0x6907('0x16')](util[_0x6907('0x7')](_0x6907('0x32'),_0x9f4f91[_0x6907('0x33')]),_0x9f4f91);if(channels[_0x9f4f91[_0x6907('0x31')]][_0x6907('0x9')]==_0x9f4f91[_0x6907('0x34')]){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x35'),_0x9f4f91[_0x6907('0x33')],_0x9f4f91['localtwolinkedid'],_0x9f4f91[_0x6907('0x36')]));channels[_0x9f4f91[_0x6907('0x31')]][_0x6907('0x37')]=_0x9f4f91[_0x6907('0x36')];channels[_0x9f4f91[_0x6907('0x31')]][_0x6907('0x38')]=_0x6907('0x39');}else if(channels[_0x9f4f91[_0x6907('0x31')]][_0x6907('0x9')]=_0x9f4f91[_0x6907('0x3a')]){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x35'),_0x9f4f91[_0x6907('0x33')],_0x9f4f91['localtwolinkedid'],_0x9f4f91[_0x6907('0x3b')]));channels[_0x9f4f91[_0x6907('0x31')]][_0x6907('0x37')]=_0x9f4f91[_0x6907('0x3b')];channels[_0x9f4f91[_0x6907('0x31')]][_0x6907('0x38')]=_0x6907('0x39');}}}catch(_0x13b0d2){utils[_0x6907('0x1e')](util[_0x6907('0x7')]('[%s][calls][attendedtransfer]',_0x9f4f91['origtransfereruniqueid']),_0x13b0d2);}};exports[_0x6907('0x3c')]=function(_0x2ed64b){try{if(!_[_0x6907('0x21')](channels[_0x2ed64b['uniqueid']])){utils[_0x6907('0x16')](util[_0x6907('0x7')](_0x6907('0x3d'),_0x2ed64b[_0x6907('0x8')]),_0x2ed64b);channels[_0x2ed64b[_0x6907('0x8')]][_0x6907('0x3e')]=utils['now']();utils['info'](util['format']('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x2ed64b[_0x6907('0x8')],channels[_0x2ed64b['uniqueid']][_0x6907('0x3e')]));}}catch(_0xdee3f){utils[_0x6907('0x1e')](util[_0x6907('0x7')](_0x6907('0x3d'),_0x2ed64b['uniqueid']),_0xdee3f);}};exports[_0x6907('0x3f')]=function(_0x14c831){try{if(!_[_0x6907('0x21')](channels[_0x14c831[_0x6907('0x8')]])){utils[_0x6907('0x16')](util[_0x6907('0x7')]('[%s][calls][musiconholdstop]',_0x14c831['uniqueid']),_0x14c831);if(!_[_0x6907('0x21')](channels[_0x14c831[_0x6907('0x8')]][_0x6907('0x3e')])){channels[_0x14c831[_0x6907('0x8')]][_0x6907('0x40')]+=utils[_0x6907('0x41')](utils[_0x6907('0x1c')](),channels[_0x14c831[_0x6907('0x8')]][_0x6907('0x3e')]);utils[_0x6907('0x6')](util[_0x6907('0x7')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x14c831['uniqueid'],channels[_0x14c831[_0x6907('0x8')]][_0x6907('0x40')]));delete channels[_0x14c831[_0x6907('0x8')]][_0x6907('0x3e')];}}}catch(_0x2c93b6){utils[_0x6907('0x1e')](util[_0x6907('0x7')]('[%s][calls][musiconholdstop]',_0x14c831[_0x6907('0x8')]),_0x2c93b6);}};exports[_0x6907('0x42')]=function(_0x5b1a84){try{if(!_[_0x6907('0x21')](channels[_0x5b1a84[_0x6907('0x8')]])){utils[_0x6907('0x16')](util[_0x6907('0x7')]('[%s][calls][varset]',_0x5b1a84[_0x6907('0x8')]),_0x5b1a84);if(!_[_0x6907('0x21')](_0x5b1a84[_0x6907('0x43')]['xmd-originatecalleridnum'])){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x44'),_0x5b1a84['uniqueid'],_0x5b1a84['value']));channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0x45')]=_0x5b1a84['value'];}if(!_['isNil'](_0x5b1a84[_0x6907('0x43')][_0x6907('0x46')])){utils[_0x6907('0x6')](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x5b1a84['uniqueid'],_0x5b1a84[_0x6907('0x47')]));channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0x48')]=_0x5b1a84[_0x6907('0x47')];channels[_0x5b1a84[_0x6907('0x8')]]['callerid']='\x22'+_0x5b1a84[_0x6907('0x47')]+_0x6907('0x49')+_0x5b1a84[_0x6907('0x47')]+'>';}if(!_['isNil'](_0x5b1a84[_0x6907('0x43')][_0x6907('0x4a')])||!_['isNil'](_0x5b1a84['variable'][_0x6907('0x4b')])){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x4c'),_0x5b1a84['uniqueid'],!_[_0x6907('0x21')](_0x5b1a84[_0x6907('0x43')][_0x6907('0x4a')])?_0x6907('0x4a'):'xmd-callerid',_0x5b1a84['value']));channels[_0x5b1a84['uniqueid']][_0x6907('0x2c')]=_0x5b1a84[_0x6907('0x47')];}if(!_[_0x6907('0x21')](_0x5b1a84[_0x6907('0x43')][_0x6907('0x4d')])||!_[_0x6907('0x21')](_0x5b1a84[_0x6907('0x43')][_0x6907('0x4e')])){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x4c'),_0x5b1a84['uniqueid'],!_[_0x6907('0x21')](_0x5b1a84['variable']['xmd-queue'])?_0x6907('0x4d'):_0x6907('0x4e'),_0x5b1a84[_0x6907('0x47')]));channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0x4f')]='Queue';channels[_0x5b1a84['uniqueid']]['lastdata']=_0x5b1a84[_0x6907('0x47')];channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0xa')]=!![];}if(!_[_0x6907('0x21')](_0x5b1a84[_0x6907('0x43')][_0x6907('0x50')])){utils['info'](util[_0x6907('0x7')](_0x6907('0x51'),_0x5b1a84[_0x6907('0x8')],_0x5b1a84[_0x6907('0x47')]));channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0x52')]=_0x5b1a84['value'];}if(!_[_0x6907('0x21')](_0x5b1a84['variable'][_0x6907('0x53')])){utils['info'](util[_0x6907('0x7')](_0x6907('0x54'),_0x5b1a84['uniqueid'],_0x5b1a84[_0x6907('0x47')]));channels[_0x5b1a84['uniqueid']][_0x6907('0x55')]=_0x5b1a84[_0x6907('0x47')];}if(!_['isNil'](_0x5b1a84[_0x6907('0x43')][_0x6907('0x56')])){utils[_0x6907('0x6')](util[_0x6907('0x7')](_0x6907('0x57'),_0x5b1a84[_0x6907('0x8')],_0x5b1a84[_0x6907('0x47')]));channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0x58')]=_0x5b1a84[_0x6907('0x47')];}if(!_['isNil'](_0x5b1a84[_0x6907('0x43')]['sipcallid'])){utils['info'](util[_0x6907('0x7')]('[%s][calls][varset]\x20variable:sipcallid\x20value:%s',_0x5b1a84[_0x6907('0x8')],_0x5b1a84[_0x6907('0x47')]));channels[_0x5b1a84[_0x6907('0x8')]][_0x6907('0x59')]=_0x5b1a84[_0x6907('0x47')];}}}catch(_0x7e542e){utils[_0x6907('0x1e')](util[_0x6907('0x7')]('[%s][calls][varset]',_0x5b1a84[_0x6907('0x8')]),_0x7e542e);}};exports[_0x6907('0x5a')]=function(_0x2e8792){try{if(!_[_0x6907('0x21')](channels[_0x2e8792[_0x6907('0x8')]])){utils[_0x6907('0x16')](util['format'](_0x6907('0x5b'),_0x2e8792[_0x6907('0x8')]),_0x2e8792);utils['info'](util[_0x6907('0x7')](_0x6907('0x5c'),_0x2e8792[_0x6907('0x8')],_0x2e8792[_0x6907('0x5d')],_0x2e8792[_0x6907('0x5e')]));if(_0x2e8792[_0x6907('0x5d')]['toLowerCase']()==_0x6907('0x5f')&&_[_0x6907('0x60')](_0x2e8792[_0x6907('0x5e')]['toLowerCase'](),_0x6907('0x61'))){var _0x2f84ce=_0x2e8792[_0x6907('0x5e')][_0x6907('0x62')]('=');var _0x2fc663=_0x2f84ce[0x0][_0x6907('0x63')](_0x2f84ce[0x0]['lastIndexOf']('(')+0x1,_0x2f84ce[0x0]['lastIndexOf'](')'));var _0x59ab6b=_0x2f84ce[0x1];channels[_0x2e8792['uniqueid']][_0x2fc663]=_0x59ab6b;}if(!_[_0x6907('0x64')]([_0x6907('0x2a'),_0x6907('0x65'),_0x6907('0x66'),_0x6907('0x5f'),_0x6907('0x67')],_0x2e8792['application'][_0x6907('0x68')]())){channels[_0x2e8792[_0x6907('0x8')]][_0x6907('0x4f')]=_0x2e8792[_0x6907('0x5d')];channels[_0x2e8792['uniqueid']][_0x6907('0x69')]=_0x2e8792[_0x6907('0x5e')];}}}catch(_0x5bdeff){utils[_0x6907('0x1e')](util[_0x6907('0x7')]('[%s][calls][newexten]',_0x2e8792[_0x6907('0x8')]),_0x5bdeff);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d662113..1dac055 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 _0x12c3=['managerevent','./utils','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x12c3,0x10f));var _0x312c=function(_0x608461,_0x276844){_0x608461=_0x608461-0x0;var _0x3ad81b=_0x12c3[_0x608461];return _0x3ad81b;};'use strict';var utils=require(_0x312c('0x0'));exports['connect']=function(){utils[_0x312c('0x1')](_0x312c('0x2'));};exports['shutdown']=function(){utils[_0x312c('0x1')](_0x312c('0x3'));};exports[_0x312c('0x4')]=function(){utils[_0x312c('0x1')](_0x312c('0x5'));};exports[_0x312c('0x6')]=function(_0x20159c){utils['error'](_0x312c('0x7'),_0x20159c);};exports['close']=function(){utils[_0x312c('0x1')](_0x312c('0x8'));};exports[_0x312c('0x9')]=function(_0x35cf70){}; \ No newline at end of file +var _0x143c=['[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x143c,0xe9));var _0xc143=function(_0x5a5083,_0x1f786d){_0x5a5083=_0x5a5083-0x0;var _0x474f36=_0x143c[_0x5a5083];return _0x474f36;};'use strict';var utils=require('./utils');exports[_0xc143('0x0')]=function(){utils['info'](_0xc143('0x1'));};exports[_0xc143('0x2')]=function(){utils[_0xc143('0x3')](_0xc143('0x4'));};exports[_0xc143('0x5')]=function(){utils['info'](_0xc143('0x6'));};exports[_0xc143('0x7')]=function(_0x416d6c){utils[_0xc143('0x7')](_0xc143('0x8'),_0x416d6c);};exports['close']=function(){utils['info'](_0xc143('0x9'));};exports[_0xc143('0xa')]=function(_0x31f485){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index c69884e..446256d 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 _0xbf1d=['[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','startsWith','toLowerCase','cdr(routeid)','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','[%s][dials][varset]','dialbegin','assign','starttime','now','lastevent','called','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','diffTime','holdtime','endtime','lodash','util','./utils','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','format'];(function(_0x5f5660,_0x3b21a7){var _0x2b02be=function(_0x1ef451){while(--_0x1ef451){_0x5f5660['push'](_0x5f5660['shift']());}};_0x2b02be(++_0x3b21a7);}(_0xbf1d,0x16c));var _0xdbf1=function(_0x3fe358,_0x18c552){_0x3fe358=_0x3fe358-0x0;var _0x14e020=_0xbf1d[_0x3fe358];return _0x14e020;};'use strict';var _=require(_0xdbf1('0x0'));var util=require(_0xdbf1('0x1'));var utils=require(_0xdbf1('0x2'));var dials={};function writeDB(_0xe189c9){utils['info'](util['format'](_0xdbf1('0x3'),_0xe189c9[_0xdbf1('0x4')],_0xe189c9[_0xdbf1('0x5')],_0xe189c9[_0xdbf1('0x6')],_0xe189c9[_0xdbf1('0x7')],_0xe189c9[_0xdbf1('0x8')],_0xe189c9['dialstatus']));utils[_0xdbf1('0x9')](_0xdbf1('0xa'),_0xe189c9);delete dials[_0xe189c9[_0xdbf1('0x4')]];}exports[_0xdbf1('0xb')]=function(_0x546be){try{utils[_0xdbf1('0xc')](util[_0xdbf1('0xd')](_0xdbf1('0xe'),_0x546be['uniqueid']),_0x546be);utils[_0xdbf1('0xf')](util[_0xdbf1('0xd')](_0xdbf1('0x10'),_0x546be[_0xdbf1('0x4')],_0x546be[_0xdbf1('0x11')],_0x546be[_0xdbf1('0x12')]));if(_0x546be[_0xdbf1('0x11')]['toLowerCase']()==_0xdbf1('0x13')&&_[_0xdbf1('0x14')](_0x546be['appdata'][_0xdbf1('0x15')](),_0xdbf1('0x16'))){var _0x4255f0=_0x546be[_0xdbf1('0x12')]['split']('=');dials[_0x546be['uniqueid']]={'routeId':_0x4255f0[0x1]};}}catch(_0x3048a7){utils['error'](util[_0xdbf1('0xd')](_0xdbf1('0xe'),_0x546be[_0xdbf1('0x4')]),_0x3048a7);}};exports[_0xdbf1('0x17')]=function(_0x261488){try{utils[_0xdbf1('0xc')](util[_0xdbf1('0xd')]('[%s][dials][varset]',_0x261488[_0xdbf1('0x4')]),_0x261488);if(!_[_0xdbf1('0x18')](_0x261488[_0xdbf1('0x19')][_0xdbf1('0x1a')])){utils[_0xdbf1('0xf')](util['format'](_0xdbf1('0x1b'),_0x261488[_0xdbf1('0x4')],_0x261488[_0xdbf1('0x1c')]));dials[_0x261488[_0xdbf1('0x4')]]={'routeId':_0x261488[_0xdbf1('0x1c')]};}}catch(_0x386610){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')](_0xdbf1('0x1e'),_0x261488[_0xdbf1('0x4')]),_0x386610);}};exports[_0xdbf1('0x1f')]=function(_0xd31b47){try{if(!_['isNil'](dials[_0xd31b47[_0xdbf1('0x4')]])){utils[_0xdbf1('0xc')](util[_0xdbf1('0xd')]('[%s][dials][dialbegin]',_0xd31b47[_0xdbf1('0x4')]),_0xd31b47);dials[_0xd31b47['uniqueid']]=_[_0xdbf1('0x20')](dials[_0xd31b47[_0xdbf1('0x4')]],_0xd31b47);dials[_0xd31b47[_0xdbf1('0x4')]][_0xdbf1('0x21')]=utils[_0xdbf1('0x22')]();dials[_0xd31b47[_0xdbf1('0x4')]][_0xdbf1('0x23')]=_0xdbf1('0x24');utils['info'](util[_0xdbf1('0xd')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0xd31b47[_0xdbf1('0x4')],dials[_0xd31b47['uniqueid']][_0xdbf1('0x21')]));}}catch(_0x1b34df){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')](_0xdbf1('0x25'),_0xd31b47[_0xdbf1('0x4')]),_0x1b34df);}};exports[_0xdbf1('0x26')]=function(_0x2f7a8e){try{if(!_[_0xdbf1('0x18')](dials[_0x2f7a8e['uniqueid']])){utils[_0xdbf1('0xc')](util['format'](_0xdbf1('0x27'),_0x2f7a8e[_0xdbf1('0x4')]),_0x2f7a8e);dials[_0x2f7a8e[_0xdbf1('0x4')]][_0xdbf1('0x28')]=_0x2f7a8e[_0xdbf1('0x28')];if(_0x2f7a8e[_0xdbf1('0x28')]=='ANSWER'){dials[_0x2f7a8e[_0xdbf1('0x4')]]=_[_0xdbf1('0x20')](dials[_0x2f7a8e['uniqueid']],_0x2f7a8e);dials[_0x2f7a8e['uniqueid']][_0xdbf1('0x29')]=utils['now']();dials[_0x2f7a8e[_0xdbf1('0x4')]]['lastevent']='connect';utils[_0xdbf1('0xf')](util[_0xdbf1('0xd')](_0xdbf1('0x2a'),_0x2f7a8e['uniqueid'],_0x2f7a8e[_0xdbf1('0x28')],dials[_0x2f7a8e[_0xdbf1('0x4')]][_0xdbf1('0x29')]));}else{utils[_0xdbf1('0xf')](util[_0xdbf1('0xd')](_0xdbf1('0x2b'),_0x2f7a8e[_0xdbf1('0x4')],_0x2f7a8e[_0xdbf1('0x28')]));}}}catch(_0x26fdb0){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')](_0xdbf1('0x27'),_0x2f7a8e[_0xdbf1('0x4')]),_0x26fdb0);}};exports[_0xdbf1('0x2c')]=function(_0x49578f){try{if(!_[_0xdbf1('0x18')](dials[_0x49578f[_0xdbf1('0x4')]])){utils[_0xdbf1('0xc')](util['format'](_0xdbf1('0x2d'),_0x49578f[_0xdbf1('0x4')]),_0x49578f);utils['info'](util[_0xdbf1('0xd')](_0xdbf1('0x2e'),_0x49578f[_0xdbf1('0x4')],_0x49578f[_0xdbf1('0x7')],_0x49578f[_0xdbf1('0x2f')],_0x49578f[_0xdbf1('0x30')]));dials[_0x49578f[_0xdbf1('0x4')]]=_[_0xdbf1('0x20')](dials[_0x49578f['uniqueid']],{'endtime':utils[_0xdbf1('0x22')](),'lastevent':_0xdbf1('0x31')});dials[_0x49578f['uniqueid']][_0xdbf1('0x32')]=utils[_0xdbf1('0x33')](dials[_0x49578f['uniqueid']]['endtime'],dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x21')]);dials[_0x49578f['uniqueid']][_0xdbf1('0x34')]=utils[_0xdbf1('0x33')](dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x29')]||dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x35')],dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x21')]);dials[_0x49578f[_0xdbf1('0x4')]]['billableseconds']=dials[_0x49578f['uniqueid']][_0xdbf1('0x29')]?utils[_0xdbf1('0x33')](dials[_0x49578f[_0xdbf1('0x4')]]['endtime'],dials[_0x49578f[_0xdbf1('0x4')]][_0xdbf1('0x29')]):0x0;writeDB(dials[_0x49578f[_0xdbf1('0x4')]]);}}catch(_0x46ffe8){utils[_0xdbf1('0x1d')](util[_0xdbf1('0xd')]('[%s][dials][hangup]',_0x49578f['uniqueid']),_0x46ffe8);}}; \ No newline at end of file +var _0x6b48=['outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][dialbegin]','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','diffTime','endtime','holdtime','billableseconds','lodash','util','./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil'];(function(_0x1ce3cf,_0x2e0bf4){var _0x168e8d=function(_0x1ce6cf){while(--_0x1ce6cf){_0x1ce3cf['push'](_0x1ce3cf['shift']());}};_0x168e8d(++_0x2e0bf4);}(_0x6b48,0x88));var _0x86b4=function(_0x46e310,_0x12c74e){_0x46e310=_0x46e310-0x0;var _0x3a9ae3=_0x6b48[_0x46e310];return _0x3a9ae3;};'use strict';var _=require(_0x86b4('0x0'));var util=require(_0x86b4('0x1'));var utils=require(_0x86b4('0x2'));var dials={};function writeDB(_0xd5f14d){utils[_0x86b4('0x3')](util['format'](_0x86b4('0x4'),_0xd5f14d[_0x86b4('0x5')],_0xd5f14d[_0x86b4('0x6')],_0xd5f14d[_0x86b4('0x7')],_0xd5f14d[_0x86b4('0x8')],_0xd5f14d[_0x86b4('0x9')],_0xd5f14d[_0x86b4('0xa')]));utils[_0x86b4('0xb')](_0x86b4('0xc'),_0xd5f14d);delete dials[_0xd5f14d[_0x86b4('0x5')]];}exports[_0x86b4('0xd')]=function(_0x2a5f6e){try{utils[_0x86b4('0xe')](util[_0x86b4('0xf')](_0x86b4('0x10'),_0x2a5f6e[_0x86b4('0x5')]),_0x2a5f6e);utils['info'](util[_0x86b4('0xf')](_0x86b4('0x11'),_0x2a5f6e[_0x86b4('0x5')],_0x2a5f6e[_0x86b4('0x12')],_0x2a5f6e[_0x86b4('0x13')]));if(_0x2a5f6e['application'][_0x86b4('0x14')]()==_0x86b4('0x15')&&_[_0x86b4('0x16')](_0x2a5f6e[_0x86b4('0x13')][_0x86b4('0x14')](),_0x86b4('0x17'))){var _0x3e9c64=_0x2a5f6e[_0x86b4('0x13')][_0x86b4('0x18')]('=');dials[_0x2a5f6e[_0x86b4('0x5')]]={'routeId':_0x3e9c64[0x1]};}}catch(_0x3d4d0a){utils[_0x86b4('0x19')](util[_0x86b4('0xf')](_0x86b4('0x10'),_0x2a5f6e[_0x86b4('0x5')]),_0x3d4d0a);}};exports[_0x86b4('0x1a')]=function(_0x26e5b6){try{utils[_0x86b4('0xe')](util[_0x86b4('0xf')](_0x86b4('0x1b'),_0x26e5b6['uniqueid']),_0x26e5b6);if(!_[_0x86b4('0x1c')](_0x26e5b6['variable'][_0x86b4('0x1d')])){utils['info'](util[_0x86b4('0xf')](_0x86b4('0x1e'),_0x26e5b6[_0x86b4('0x5')],_0x26e5b6[_0x86b4('0x1f')]));dials[_0x26e5b6[_0x86b4('0x5')]]={'routeId':_0x26e5b6[_0x86b4('0x1f')]};}}catch(_0x2f42b5){utils[_0x86b4('0x19')](util[_0x86b4('0xf')](_0x86b4('0x1b'),_0x26e5b6[_0x86b4('0x5')]),_0x2f42b5);}};exports['dialbegin']=function(_0x294247){try{if(!_[_0x86b4('0x1c')](dials[_0x294247[_0x86b4('0x5')]])){utils[_0x86b4('0xe')](util[_0x86b4('0xf')](_0x86b4('0x20'),_0x294247[_0x86b4('0x5')]),_0x294247);dials[_0x294247[_0x86b4('0x5')]]=_['assign'](dials[_0x294247[_0x86b4('0x5')]],_0x294247);dials[_0x294247['uniqueid']]['starttime']=utils[_0x86b4('0x21')]();dials[_0x294247[_0x86b4('0x5')]][_0x86b4('0x22')]=_0x86b4('0x23');utils[_0x86b4('0x3')](util['format'](_0x86b4('0x24'),_0x294247[_0x86b4('0x5')],dials[_0x294247[_0x86b4('0x5')]][_0x86b4('0x25')]));}}catch(_0x31da94){utils[_0x86b4('0x19')](util[_0x86b4('0xf')](_0x86b4('0x20'),_0x294247['uniqueid']),_0x31da94);}};exports[_0x86b4('0x26')]=function(_0x4cb17b){try{if(!_['isNil'](dials[_0x4cb17b[_0x86b4('0x5')]])){utils[_0x86b4('0xe')](util[_0x86b4('0xf')](_0x86b4('0x27'),_0x4cb17b['uniqueid']),_0x4cb17b);dials[_0x4cb17b[_0x86b4('0x5')]][_0x86b4('0xa')]=_0x4cb17b['dialstatus'];if(_0x4cb17b[_0x86b4('0xa')]==_0x86b4('0x28')){dials[_0x4cb17b[_0x86b4('0x5')]]=_[_0x86b4('0x29')](dials[_0x4cb17b[_0x86b4('0x5')]],_0x4cb17b);dials[_0x4cb17b[_0x86b4('0x5')]][_0x86b4('0x2a')]=utils[_0x86b4('0x21')]();dials[_0x4cb17b['uniqueid']]['lastevent']=_0x86b4('0x2b');utils[_0x86b4('0x3')](util[_0x86b4('0xf')](_0x86b4('0x2c'),_0x4cb17b['uniqueid'],_0x4cb17b[_0x86b4('0xa')],dials[_0x4cb17b[_0x86b4('0x5')]][_0x86b4('0x2a')]));}else{utils[_0x86b4('0x3')](util['format'](_0x86b4('0x2d'),_0x4cb17b['uniqueid'],_0x4cb17b[_0x86b4('0xa')]));}}}catch(_0x1851c0){utils[_0x86b4('0x19')](util[_0x86b4('0xf')](_0x86b4('0x27'),_0x4cb17b[_0x86b4('0x5')]),_0x1851c0);}};exports[_0x86b4('0x2e')]=function(_0x1e38f0){try{if(!_['isNil'](dials[_0x1e38f0['uniqueid']])){utils[_0x86b4('0xe')](util['format'](_0x86b4('0x2f'),_0x1e38f0[_0x86b4('0x5')]),_0x1e38f0);utils[_0x86b4('0x3')](util['format'](_0x86b4('0x30'),_0x1e38f0[_0x86b4('0x5')],_0x1e38f0[_0x86b4('0x8')],_0x1e38f0[_0x86b4('0x31')],_0x1e38f0['cause-txt']));dials[_0x1e38f0[_0x86b4('0x5')]]=_[_0x86b4('0x29')](dials[_0x1e38f0['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x86b4('0x32')});dials[_0x1e38f0[_0x86b4('0x5')]]['duration']=utils[_0x86b4('0x33')](dials[_0x1e38f0['uniqueid']][_0x86b4('0x34')],dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x25')]);dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x35')]=utils[_0x86b4('0x33')](dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x2a')]||dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x34')],dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x25')]);dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x36')]=dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x2a')]?utils[_0x86b4('0x33')](dials[_0x1e38f0[_0x86b4('0x5')]][_0x86b4('0x34')],dials[_0x1e38f0['uniqueid']][_0x86b4('0x2a')]):0x0;writeDB(dials[_0x1e38f0[_0x86b4('0x5')]]);}}catch(_0x185f46){utils['error'](util['format'](_0x86b4('0x2f'),_0x1e38f0[_0x86b4('0x5')]),_0x185f46);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index cae7c79..1050d8f 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 _0x97b2=['XDR\x20DISABLED','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','debug','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','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]','origtransfereruniqueid','attendedtransfer','[%s][index][attendedtransfer]','[%s][index][varset]','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','../../config/environment','./utils','util','xdr','disabled','production','local','port','asterisk','password','info'];(function(_0x53bd01,_0x4a67c0){var _0x55c7f2=function(_0x31723c){while(--_0x31723c){_0x53bd01['push'](_0x53bd01['shift']());}};_0x55c7f2(++_0x4a67c0);}(_0x97b2,0x193));var _0x297b=function(_0x25248b,_0x3c8491){_0x25248b=_0x25248b-0x0;var _0x509939=_0x97b2[_0x25248b];return _0x509939;};var AsteriskManager=require('asterisk-manager');var config=require(_0x297b('0x0'));var utils=require(_0x297b('0x1'));var util=require(_0x297b('0x2'));var isXDREnabled=config[_0x297b('0x3')]&&config[_0x297b('0x3')][_0x297b('0x4')]?!config[_0x297b('0x3')]['disabled']:!![];var isProduction=config['env']===_0x297b('0x5')||![];var isLocalAsterisk=config[_0x297b('0x3')]&&config[_0x297b('0x3')][_0x297b('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x297b('0x7')],config[_0x297b('0x8')]['ip'],config[_0x297b('0x8')]['username'],config[_0x297b('0x8')][_0x297b('0x9')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x297b('0xa')](_0x297b('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x297b('0xa')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require('./agents.controller');var calls=require(_0x297b('0xc'));var queues=require('./queues.controller');var recordings=require(_0x297b('0xd'));var members=require(_0x297b('0xe'));var dials=require(_0x297b('0xf'));var transfers=require(_0x297b('0x10'));var core=require(_0x297b('0x11'));ami['on']('connect',core[_0x297b('0x12')]);ami['on'](_0x297b('0x13'),core[_0x297b('0x13')]);ami['on'](_0x297b('0x14'),core[_0x297b('0x14')]);ami['on'](_0x297b('0x15'),core['error']);ami['on'](_0x297b('0x16'),core[_0x297b('0x16')]);ami['on'](_0x297b('0x17'),core[_0x297b('0x17')]);ami['on'](_0x297b('0x18'),function(_0x1b0f03){try{utils['debug'](util[_0x297b('0x19')](_0x297b('0x1a'),_0x1b0f03[_0x297b('0x1b')]),_0x1b0f03);members['devicestatechange'](_0x1b0f03);}catch(_0x410c7f){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x1a'),_0x1b0f03[_0x297b('0x1b')]),_0x410c7f);}});ami['on']('agentcalled',function(_0x2bbceb){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x1d'),_0x2bbceb[_0x297b('0x1e')]),_0x2bbceb);agents[_0x297b('0x1f')](_0x2bbceb);}catch(_0x4498c1){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x1d'),_0x2bbceb[_0x297b('0x1e')]),_0x4498c1);}});ami['on'](_0x297b('0x20'),function(_0x2379c1){try{utils[_0x297b('0x1c')](util['format'](_0x297b('0x21'),_0x2379c1['uniqueid']),_0x2379c1);agents[_0x297b('0x20')](_0x2379c1);}catch(_0x3a5cb2){utils['error'](util[_0x297b('0x19')](_0x297b('0x21'),_0x2379c1[_0x297b('0x1e')]),_0x3a5cb2);}});ami['on'](_0x297b('0x22'),function(_0x2b937f){try{utils[_0x297b('0x1c')](util['format']('[%s][index][agentconnect]',_0x2b937f[_0x297b('0x1e')]),_0x2b937f);agents[_0x297b('0x22')](_0x2b937f);queues[_0x297b('0x22')](_0x2b937f);}catch(_0x596483){utils['error'](util[_0x297b('0x19')](_0x297b('0x23'),_0x2b937f[_0x297b('0x1e')]),_0x596483);}});ami['on']('agentcomplete',function(_0x5775db){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x24'),_0x5775db[_0x297b('0x1e')]),_0x5775db);agents['agentcomplete'](_0x5775db);queues['agentcomplete'](_0x5775db);members[_0x297b('0x25')](_0x5775db);}catch(_0x2a48cf){utils[_0x297b('0x15')](util['format'](_0x297b('0x24'),_0x5775db['uniqueid']),_0x2a48cf);}});ami['on'](_0x297b('0x26'),function(_0x24c4de){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x27'),_0x24c4de[_0x297b('0x1e')]),_0x24c4de);agents[_0x297b('0x26')](_0x24c4de);queues[_0x297b('0x26')](_0x24c4de);}catch(_0x55dca1){utils['error'](util[_0x297b('0x19')](_0x297b('0x27'),_0x24c4de['uniqueid']),_0x55dca1);}});ami['on'](_0x297b('0x28'),function(_0x189b7c){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x29'),_0x189b7c['uniqueid']),_0x189b7c);queues[_0x297b('0x28')](_0x189b7c);recordings['queuecallerjoin'](_0x189b7c);}catch(_0x4a464b){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x29'),_0x189b7c[_0x297b('0x1e')]),_0x4a464b);}});ami['on']('queuecallerleave',function(_0xeb9fb1){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x2a'),_0xeb9fb1[_0x297b('0x1e')]),_0xeb9fb1);queues['queuecallerleave'](_0xeb9fb1);}catch(_0x53db82){utils[_0x297b('0x15')](util[_0x297b('0x19')]('[%s][index][queuecallerleave]',_0xeb9fb1[_0x297b('0x1e')]),_0x53db82);}});ami['on'](_0x297b('0x2b'),function(_0x2849fc){try{utils['debug'](util[_0x297b('0x19')]('[%s][index][musiconholdstart]',_0x2849fc['uniqueid']),_0x2849fc);queues[_0x297b('0x2b')](_0x2849fc);calls[_0x297b('0x2b')](_0x2849fc);}catch(_0x4169c6){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x2c'),_0x2849fc[_0x297b('0x1e')]),_0x4169c6);}});ami['on'](_0x297b('0x2d'),function(_0x2d9128){try{utils['debug'](util['format'](_0x297b('0x2e'),_0x2d9128[_0x297b('0x1e')]),_0x2d9128);queues[_0x297b('0x2d')](_0x2d9128);calls['musiconholdstop'](_0x2d9128);}catch(_0x23ce52){utils[_0x297b('0x15')](util[_0x297b('0x19')]('[%s][index][musiconholdstop]',_0x2d9128['uniqueid']),_0x23ce52);}});ami['on'](_0x297b('0x2f'),function(_0x59bbd6){try{utils['debug'](util['format']('[%s][index][newstate]',_0x59bbd6['uniqueid']),_0x59bbd6);calls['newstate'](_0x59bbd6);recordings['newstate'](_0x59bbd6);}catch(_0x34a196){utils['error'](util[_0x297b('0x19')](_0x297b('0x30'),_0x59bbd6[_0x297b('0x1e')]),_0x34a196);}});ami['on'](_0x297b('0x31'),function(_0x3b822b){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x32'),_0x3b822b[_0x297b('0x1e')]),_0x3b822b);calls[_0x297b('0x31')](_0x3b822b);recordings[_0x297b('0x31')](_0x3b822b);dials['hangup'](_0x3b822b);agents[_0x297b('0x31')](_0x3b822b);queues['hangup'](_0x3b822b);}catch(_0x572a75){utils['error'](util[_0x297b('0x19')](_0x297b('0x32'),_0x3b822b[_0x297b('0x1e')]),_0x572a75);}});ami['on'](_0x297b('0x33'),function(_0x2520b1){try{utils['debug'](util[_0x297b('0x19')](_0x297b('0x34'),_0x2520b1[_0x297b('0x1e')]),_0x2520b1);members['cdr'](_0x2520b1);}catch(_0x599ec8){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x34'),_0x2520b1['uniqueid']),_0x599ec8);}});ami['on'](_0x297b('0x35'),function(_0x5e860c){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x36'),_0x5e860c[_0x297b('0x1e')]),_0x5e860c);queues[_0x297b('0x35')](_0x5e860c);agents[_0x297b('0x35')](_0x5e860c);transfers[_0x297b('0x35')](_0x5e860c);}catch(_0x554ee9){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x36'),_0x5e860c[_0x297b('0x1e')]),_0x554ee9);}});ami['on']('attendedtransfer',function(_0x5e9dd9){try{utils[_0x297b('0x1c')](util['format']('[%s][index][attendedtransfer]',_0x5e9dd9[_0x297b('0x37')]),_0x5e9dd9);queues[_0x297b('0x38')](_0x5e9dd9);transfers[_0x297b('0x38')](_0x5e9dd9);agents[_0x297b('0x38')](_0x5e9dd9);calls[_0x297b('0x38')](_0x5e9dd9);}catch(_0x192fdf){utils[_0x297b('0x15')](util['format'](_0x297b('0x39'),_0x5e9dd9[_0x297b('0x37')]),_0x192fdf);}});ami['on']('varset',function(_0x4ed3db){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x3a'),_0x4ed3db[_0x297b('0x1e')]),_0x4ed3db);queues[_0x297b('0x3b')](_0x4ed3db);recordings[_0x297b('0x3b')](_0x4ed3db);calls['varset'](_0x4ed3db);dials[_0x297b('0x3b')](_0x4ed3db);}catch(_0x5bd73f){utils['error'](util['format'](_0x297b('0x3a'),_0x4ed3db[_0x297b('0x1e')]),_0x5bd73f);}});ami['on']('newexten',function(_0x15bb7a){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')](_0x297b('0x3c'),_0x15bb7a[_0x297b('0x1e')]),_0x15bb7a);calls['newexten'](_0x15bb7a);recordings['newexten'](_0x15bb7a);dials[_0x297b('0x3d')](_0x15bb7a);}catch(_0x1c775c){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x3c'),_0x15bb7a[_0x297b('0x1e')]),_0x1c775c);}});ami['on'](_0x297b('0x3e'),function(_0x113454){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')]('[%s][index][newchannel]',_0x113454[_0x297b('0x1e')]),_0x113454);calls[_0x297b('0x3e')](_0x113454);recordings['newchannel'](_0x113454);}catch(_0x344a0f){utils['error'](util[_0x297b('0x19')](_0x297b('0x3f'),_0x113454[_0x297b('0x1e')]),_0x344a0f);}});ami['on']('dialbegin',function(_0x5491ec){try{utils[_0x297b('0x1c')](util['format'](_0x297b('0x40'),_0x5491ec[_0x297b('0x1e')]),_0x5491ec);dials[_0x297b('0x41')](_0x5491ec);}catch(_0x2a4e4f){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x42'),_0x5491ec[_0x297b('0x1e')]),_0x2a4e4f);}});ami['on'](_0x297b('0x43'),function(_0x2f968e){try{utils[_0x297b('0x1c')](util[_0x297b('0x19')]('[%s][index][dialend]',_0x2f968e[_0x297b('0x1e')]),_0x2f968e);dials[_0x297b('0x43')](_0x2f968e);}catch(_0x203d46){utils[_0x297b('0x15')](util[_0x297b('0x19')](_0x297b('0x44'),_0x2f968e[_0x297b('0x1e')]),_0x203d46);}});} \ No newline at end of file +var _0xfa7f=['[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','debug','format','devicestatechange','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentringnoanswer','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][queuecallerabandon]','queuecallerabandon','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend'];(function(_0x2b7c56,_0x15c19f){var _0x2ee233=function(_0x40c6de){while(--_0x40c6de){_0x2b7c56['push'](_0x2b7c56['shift']());}};_0x2ee233(++_0x15c19f);}(_0xfa7f,0x15f));var _0xffa7=function(_0x4809a8,_0x335c11){_0x4809a8=_0x4809a8-0x0;var _0x2745bf=_0xfa7f[_0x4809a8];return _0x2745bf;};var AsteriskManager=require(_0xffa7('0x0'));var config=require(_0xffa7('0x1'));var utils=require(_0xffa7('0x2'));var util=require(_0xffa7('0x3'));var isXDREnabled=config['xdr']&&config[_0xffa7('0x4')]['disabled']?!config[_0xffa7('0x4')][_0xffa7('0x5')]:!![];var isProduction=config[_0xffa7('0x6')]==='production'||![];var isLocalAsterisk=config[_0xffa7('0x4')]&&config[_0xffa7('0x4')][_0xffa7('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xffa7('0x8')]['port'],config[_0xffa7('0x8')]['ip'],config[_0xffa7('0x8')][_0xffa7('0x9')],config[_0xffa7('0x8')][_0xffa7('0xa')],!![]);ami[_0xffa7('0xb')]();if(!isXDREnabled){utils[_0xffa7('0xc')](_0xffa7('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xffa7('0xc')](_0xffa7('0xe'));}else{var agents=require(_0xffa7('0xf'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require(_0xffa7('0x10'));var members=require(_0xffa7('0x11'));var dials=require(_0xffa7('0x12'));var transfers=require(_0xffa7('0x13'));var core=require(_0xffa7('0x14'));ami['on'](_0xffa7('0x15'),core[_0xffa7('0x15')]);ami['on'](_0xffa7('0x16'),core[_0xffa7('0x16')]);ami['on'](_0xffa7('0x17'),core['fullybooted']);ami['on'](_0xffa7('0x18'),core[_0xffa7('0x18')]);ami['on'](_0xffa7('0x19'),core[_0xffa7('0x19')]);ami['on'](_0xffa7('0x1a'),core['managerevent']);ami['on']('devicestatechange',function(_0x1ad0fb){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')]('[%s][index][devicestatechange]',_0x1ad0fb['device']),_0x1ad0fb);members[_0xffa7('0x1d')](_0x1ad0fb);}catch(_0x4239ef){utils[_0xffa7('0x18')](util['format'](_0xffa7('0x1e'),_0x1ad0fb[_0xffa7('0x1f')]),_0x4239ef);}});ami['on'](_0xffa7('0x20'),function(_0xab736a){try{utils['debug'](util[_0xffa7('0x1c')](_0xffa7('0x21'),_0xab736a[_0xffa7('0x22')]),_0xab736a);agents['agentcalled'](_0xab736a);}catch(_0x32f4e1){utils['error'](util['format'](_0xffa7('0x21'),_0xab736a['uniqueid']),_0x32f4e1);}});ami['on']('agentringnoanswer',function(_0x3e5cd7){try{utils[_0xffa7('0x1b')](util['format'](_0xffa7('0x23'),_0x3e5cd7[_0xffa7('0x22')]),_0x3e5cd7);agents[_0xffa7('0x24')](_0x3e5cd7);}catch(_0x24c465){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')]('[%s][index][agentringnoanswer]',_0x3e5cd7[_0xffa7('0x22')]),_0x24c465);}});ami['on'](_0xffa7('0x25'),function(_0x58138f){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x26'),_0x58138f[_0xffa7('0x22')]),_0x58138f);agents['agentconnect'](_0x58138f);queues[_0xffa7('0x25')](_0x58138f);}catch(_0x2252fc){utils[_0xffa7('0x18')](util['format'](_0xffa7('0x26'),_0x58138f['uniqueid']),_0x2252fc);}});ami['on'](_0xffa7('0x27'),function(_0x24a466){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')]('[%s][index][agentcomplete]',_0x24a466[_0xffa7('0x22')]),_0x24a466);agents[_0xffa7('0x27')](_0x24a466);queues[_0xffa7('0x27')](_0x24a466);members[_0xffa7('0x27')](_0x24a466);}catch(_0x45b499){utils[_0xffa7('0x18')](util['format']('[%s][index][agentcomplete]',_0x24a466[_0xffa7('0x22')]),_0x45b499);}});ami['on']('queuecallerabandon',function(_0x47d4e0){try{utils[_0xffa7('0x1b')](util['format'](_0xffa7('0x28'),_0x47d4e0[_0xffa7('0x22')]),_0x47d4e0);agents['queuecallerabandon'](_0x47d4e0);queues[_0xffa7('0x29')](_0x47d4e0);}catch(_0x564ae6){utils['error'](util['format'](_0xffa7('0x28'),_0x47d4e0[_0xffa7('0x22')]),_0x564ae6);}});ami['on']('queuecallerjoin',function(_0x5b8d1e){try{utils[_0xffa7('0x1b')](util['format'](_0xffa7('0x2a'),_0x5b8d1e[_0xffa7('0x22')]),_0x5b8d1e);queues[_0xffa7('0x2b')](_0x5b8d1e);recordings[_0xffa7('0x2b')](_0x5b8d1e);}catch(_0x5bb7b9){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x2a'),_0x5b8d1e[_0xffa7('0x22')]),_0x5bb7b9);}});ami['on'](_0xffa7('0x2c'),function(_0x187ba1){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x2d'),_0x187ba1[_0xffa7('0x22')]),_0x187ba1);queues[_0xffa7('0x2c')](_0x187ba1);}catch(_0x5b01da){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x2d'),_0x187ba1[_0xffa7('0x22')]),_0x5b01da);}});ami['on']('musiconholdstart',function(_0x21d1e6){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x2e'),_0x21d1e6[_0xffa7('0x22')]),_0x21d1e6);queues['musiconholdstart'](_0x21d1e6);calls[_0xffa7('0x2f')](_0x21d1e6);}catch(_0x41b0dc){utils['error'](util['format'](_0xffa7('0x2e'),_0x21d1e6['uniqueid']),_0x41b0dc);}});ami['on'](_0xffa7('0x30'),function(_0x551589){try{utils['debug'](util[_0xffa7('0x1c')](_0xffa7('0x31'),_0x551589[_0xffa7('0x22')]),_0x551589);queues[_0xffa7('0x30')](_0x551589);calls[_0xffa7('0x30')](_0x551589);}catch(_0x5d66ec){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x31'),_0x551589[_0xffa7('0x22')]),_0x5d66ec);}});ami['on']('newstate',function(_0x5be8e9){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x32'),_0x5be8e9[_0xffa7('0x22')]),_0x5be8e9);calls['newstate'](_0x5be8e9);recordings['newstate'](_0x5be8e9);}catch(_0x3a7044){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')]('[%s][index][newstate]',_0x5be8e9[_0xffa7('0x22')]),_0x3a7044);}});ami['on'](_0xffa7('0x33'),function(_0x49e3c1){try{utils[_0xffa7('0x1b')](util['format'](_0xffa7('0x34'),_0x49e3c1[_0xffa7('0x22')]),_0x49e3c1);calls[_0xffa7('0x33')](_0x49e3c1);recordings[_0xffa7('0x33')](_0x49e3c1);dials[_0xffa7('0x33')](_0x49e3c1);agents[_0xffa7('0x33')](_0x49e3c1);queues[_0xffa7('0x33')](_0x49e3c1);}catch(_0x245c95){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x34'),_0x49e3c1[_0xffa7('0x22')]),_0x245c95);}});ami['on'](_0xffa7('0x35'),function(_0x2ba8b8){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x36'),_0x2ba8b8[_0xffa7('0x22')]),_0x2ba8b8);members[_0xffa7('0x35')](_0x2ba8b8);}catch(_0x7bd74d){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x36'),_0x2ba8b8[_0xffa7('0x22')]),_0x7bd74d);}});ami['on'](_0xffa7('0x37'),function(_0x391d0a){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x38'),_0x391d0a['uniqueid']),_0x391d0a);queues[_0xffa7('0x37')](_0x391d0a);agents[_0xffa7('0x37')](_0x391d0a);transfers[_0xffa7('0x37')](_0x391d0a);}catch(_0x265c3){utils[_0xffa7('0x18')](util['format'](_0xffa7('0x38'),_0x391d0a['uniqueid']),_0x265c3);}});ami['on'](_0xffa7('0x39'),function(_0x44d2fa){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')]('[%s][index][attendedtransfer]',_0x44d2fa[_0xffa7('0x3a')]),_0x44d2fa);queues[_0xffa7('0x39')](_0x44d2fa);transfers[_0xffa7('0x39')](_0x44d2fa);agents[_0xffa7('0x39')](_0x44d2fa);calls[_0xffa7('0x39')](_0x44d2fa);}catch(_0x36dfef){utils[_0xffa7('0x18')](util['format'](_0xffa7('0x3b'),_0x44d2fa[_0xffa7('0x3a')]),_0x36dfef);}});ami['on'](_0xffa7('0x3c'),function(_0x44976e){try{utils[_0xffa7('0x1b')](util['format'](_0xffa7('0x3d'),_0x44976e[_0xffa7('0x22')]),_0x44976e);queues['varset'](_0x44976e);recordings[_0xffa7('0x3c')](_0x44976e);calls[_0xffa7('0x3c')](_0x44976e);dials[_0xffa7('0x3c')](_0x44976e);}catch(_0x2f1276){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x3d'),_0x44976e[_0xffa7('0x22')]),_0x2f1276);}});ami['on'](_0xffa7('0x3e'),function(_0x4479c9){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x3f'),_0x4479c9[_0xffa7('0x22')]),_0x4479c9);calls[_0xffa7('0x3e')](_0x4479c9);recordings[_0xffa7('0x3e')](_0x4479c9);dials[_0xffa7('0x3e')](_0x4479c9);}catch(_0x88df03){utils[_0xffa7('0x18')](util['format'](_0xffa7('0x3f'),_0x4479c9[_0xffa7('0x22')]),_0x88df03);}});ami['on'](_0xffa7('0x40'),function(_0x489c14){try{utils['debug'](util[_0xffa7('0x1c')]('[%s][index][newchannel]',_0x489c14['uniqueid']),_0x489c14);calls[_0xffa7('0x40')](_0x489c14);recordings[_0xffa7('0x40')](_0x489c14);}catch(_0x16b156){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x41'),_0x489c14[_0xffa7('0x22')]),_0x16b156);}});ami['on']('dialbegin',function(_0x523bcd){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')](_0xffa7('0x42'),_0x523bcd[_0xffa7('0x22')]),_0x523bcd);dials['dialbegin'](_0x523bcd);}catch(_0x1cb442){utils['error'](util[_0xffa7('0x1c')](_0xffa7('0x43'),_0x523bcd[_0xffa7('0x22')]),_0x1cb442);}});ami['on'](_0xffa7('0x44'),function(_0x54ce48){try{utils[_0xffa7('0x1b')](util[_0xffa7('0x1c')]('[%s][index][dialend]',_0x54ce48['uniqueid']),_0x54ce48);dials[_0xffa7('0x44')](_0x54ce48);}catch(_0x58fc3a){utils[_0xffa7('0x18')](util[_0xffa7('0x1c')](_0xffa7('0x45'),_0x54ce48[_0xffa7('0x22')]),_0x58fc3a);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 1a8177c..008bed2 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 _0xb09d=['device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','NOT_INUSE','isNil','exitAt','duration','diffTime','format','queue','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','channel','split','data1','data2','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','util','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','type','getUserByInterface','interface','then','membername','name','internal','request','CreateMemberReport','catch','error','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]'];(function(_0x48e0eb,_0x4fc40b){var _0xd36dc=function(_0x4df508){while(--_0x4df508){_0x48e0eb['push'](_0x48e0eb['shift']());}};_0xd36dc(++_0x4fc40b);}(_0xb09d,0x171));var _0xdb09=function(_0x4a5a15,_0x5a1082){_0x4a5a15=_0x4a5a15-0x0;var _0xf292a2=_0xb09d[_0x4a5a15];return _0xf292a2;};'use strict';var _=require('lodash');var util=require(_0xdb09('0x0'));var utils=require(_0xdb09('0x1'));var members={};var exclude=[_0xdb09('0x2'),_0xdb09('0x3')];function writeDB(_0x24d974){utils[_0xdb09('0x4')](util['format'](_0xdb09('0x5'),_0x24d974[_0xdb09('0x6')],_0x24d974['interface'],_0x24d974['channel'],_0x24d974['data2'],_0x24d974['membername'],_0x24d974[_0xdb09('0x7')]));if(_0x24d974['interface']){utils[_0xdb09('0x8')](_0x24d974[_0xdb09('0x9')])[_0xdb09('0xa')](function(_0x4291ef){if(_0x4291ef){_0x24d974[_0xdb09('0xb')]=_0x4291ef[_0xdb09('0xc')];_0x24d974[_0xdb09('0xd')]=_0x4291ef[_0xdb09('0xd')];utils[_0xdb09('0xe')](_0xdb09('0xf'),_0x24d974);}else{utils['getUserByName'](_0x24d974[_0xdb09('0x9')]['split']('/')[0x1])['then'](function(_0x361aac){if(_0x361aac){_0x24d974[_0xdb09('0xb')]=_0x361aac[_0xdb09('0xc')];_0x24d974[_0xdb09('0xd')]=_0x361aac['internal'];utils[_0xdb09('0xe')](_0xdb09('0xf'),_0x24d974);}});}})[_0xdb09('0x10')](function(_0x5e120a){utils[_0xdb09('0x11')](util['format'](_0xdb09('0x12'),_0x24d974[_0xdb09('0x6')]),_0x5e120a);});}delete members[_0x24d974[_0xdb09('0x9')]];}function startsWith(_0x5c07e1,_0x45d5cb){return _[_0xdb09('0x13')](_0x5c07e1,function(_0x1c7cf2){return _[_0xdb09('0x14')](_0x45d5cb,_0x1c7cf2);});}exports['devicestatechange']=function(_0x1fdc26){try{utils[_0xdb09('0x15')](util['format'](_0xdb09('0x16'),members[_0x1fdc26[_0xdb09('0x17')]]?members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x6')]:_0x1fdc26[_0xdb09('0x17')]),_0x1fdc26);utils[_0xdb09('0x4')](util['format'](_0xdb09('0x18'),members[_0x1fdc26[_0xdb09('0x17')]]?members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x6')]:_0x1fdc26['device'],_0x1fdc26[_0xdb09('0x19')],_0x1fdc26[_0xdb09('0x17')]));switch(_0x1fdc26[_0xdb09('0x19')]){case _0xdb09('0x1a'):case _0xdb09('0x1b'):if(!startsWith(exclude,_0x1fdc26[_0xdb09('0x17')])){members[_0x1fdc26[_0xdb09('0x17')]]={'channel':_0xdb09('0x1c'),'interface':_0x1fdc26['device'],'type':'TALKING','enterAt':utils[_0xdb09('0x1d')](),'role':_0xdb09('0x1e')};}break;case _0xdb09('0x1f'):if(!_[_0xdb09('0x20')](members[_0x1fdc26['device']])){members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x21')]=utils[_0xdb09('0x1d')]();members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x22')]=utils[_0xdb09('0x23')](members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x21')],members[_0x1fdc26[_0xdb09('0x17')]]['enterAt']);if(members[_0x1fdc26['device']][_0xdb09('0x6')]){writeDB(members[_0x1fdc26[_0xdb09('0x17')]]);}}break;default:break;}}catch(_0x289bf4){utils['error'](util[_0xdb09('0x24')]('[%s][members][devicestatechange]',members[_0x1fdc26[_0xdb09('0x17')]]?members[_0x1fdc26[_0xdb09('0x17')]][_0xdb09('0x6')]:_0x1fdc26['device']),_0x289bf4);}};exports['agentcomplete']=function(_0x200b17){try{if(!_[_0xdb09('0x20')](members[_0x200b17[_0xdb09('0x9')]])){utils[_0xdb09('0x15')](util[_0xdb09('0x24')]('[%s][members][agentcomplete]',_0x200b17[_0xdb09('0x6')]),_0x200b17);utils[_0xdb09('0x4')](util[_0xdb09('0x24')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x200b17['uniqueid'],_0x200b17[_0xdb09('0x9')],_0x200b17[_0xdb09('0x25')]));members[_0x200b17[_0xdb09('0x9')]]=_['assign'](members[_0x200b17[_0xdb09('0x9')]],{'data4':_0x200b17[_0xdb09('0x25')],'uniqueid':_0x200b17['uniqueid']});}}catch(_0x480581){utils[_0xdb09('0x11')](util['format'](_0xdb09('0x26'),_0x200b17[_0xdb09('0x6')]),_0x480581);}};exports[_0xdb09('0x27')]=function(_0x2f2547){try{utils['debug'](util[_0xdb09('0x24')](_0xdb09('0x28'),_0x2f2547['uniqueid']),_0x2f2547);if(_0x2f2547[_0xdb09('0x29')]){var _0x1d469d=_0x2f2547[_0xdb09('0x29')][_0xdb09('0x2a')]('-')[0x0];if(!_[_0xdb09('0x20')](members[_0x1d469d])){members[_0x1d469d]=_['assign'](members[_0x1d469d],{'data1':members[_0x1d469d][_0xdb09('0x2b')]||_0x2f2547[_0xdb09('0x7')],'data2':members[_0x1d469d][_0xdb09('0x2c')]||_0x2f2547[_0xdb09('0x2d')],'data3':members[_0x1d469d][_0xdb09('0x2e')]||_0x2f2547[_0xdb09('0x2f')],'uniqueid':members[_0x1d469d][_0xdb09('0x6')]||_0x2f2547[_0xdb09('0x6')]});utils['info'](util[_0xdb09('0x24')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x2f2547[_0xdb09('0x6')],members[_0x1d469d][_0xdb09('0x2b')],members[_0x1d469d]['data2'],members[_0x1d469d]['data3']));if(members[_0x1d469d][_0xdb09('0x21')]){writeDB(members[_0x1d469d]);}}}if(_0x2f2547['destinationchannel']){var _0x4ad146=_0x2f2547['destinationchannel'][_0xdb09('0x2a')]('-')[0x0];if(!_[_0xdb09('0x20')](members[_0x4ad146])){members[_0x4ad146]=_['assign'](members[_0x4ad146],{'data1':members[_0x4ad146][_0xdb09('0x2b')]||_0x2f2547[_0xdb09('0x7')],'data2':members[_0x4ad146][_0xdb09('0x2c')]||_0x2f2547[_0xdb09('0x2d')],'data3':members[_0x4ad146][_0xdb09('0x2e')]||_0x2f2547[_0xdb09('0x2f')],'uniqueid':members[_0x4ad146][_0xdb09('0x6')]||_0x2f2547[_0xdb09('0x6')]});utils['info'](util['format'](_0xdb09('0x30'),_0x2f2547[_0xdb09('0x6')],members[_0x4ad146][_0xdb09('0x2b')],members[_0x4ad146]['data2'],members[_0x4ad146][_0xdb09('0x2e')]));if(members[_0x4ad146][_0xdb09('0x21')]){writeDB(members[_0x4ad146]);}}}}catch(_0x3f5f7){utils[_0xdb09('0x11')](util['format']('[%s][members][cdr]',_0x2f2547[_0xdb09('0x6')]),_0x3f5f7);}}; \ No newline at end of file +var _0x27c9=['exitAt','destinationchannel','lodash','util','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','membername','type','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','[%s][members][writeDB]','startsWith','devicestatechange','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','NOT_INUSE','isNil','duration','diffTime','enterAt','error','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','queue','assign','[%s][members][cdr]','data1','data2','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s'];(function(_0x298dd7,_0x579273){var _0x995c4a=function(_0xccbb73){while(--_0xccbb73){_0x298dd7['push'](_0x298dd7['shift']());}};_0x995c4a(++_0x579273);}(_0x27c9,0x12e));var _0x927c=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x27c9[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x927c('0x0'));var util=require(_0x927c('0x1'));var utils=require('./utils');var members={};var exclude=[_0x927c('0x2'),_0x927c('0x3')];function writeDB(_0x2b1e06){utils['info'](util[_0x927c('0x4')](_0x927c('0x5'),_0x2b1e06[_0x927c('0x6')],_0x2b1e06[_0x927c('0x7')],_0x2b1e06[_0x927c('0x8')],_0x2b1e06['data2'],_0x2b1e06[_0x927c('0x9')],_0x2b1e06[_0x927c('0xa')]));if(_0x2b1e06[_0x927c('0x7')]){utils[_0x927c('0xb')](_0x2b1e06[_0x927c('0x7')])[_0x927c('0xc')](function(_0x4b4513){if(_0x4b4513){_0x2b1e06[_0x927c('0x9')]=_0x4b4513[_0x927c('0xd')];_0x2b1e06[_0x927c('0xe')]=_0x4b4513[_0x927c('0xe')];utils[_0x927c('0xf')](_0x927c('0x10'),_0x2b1e06);}else{utils[_0x927c('0x11')](_0x2b1e06['interface'][_0x927c('0x12')]('/')[0x1])[_0x927c('0xc')](function(_0x214104){if(_0x214104){_0x2b1e06[_0x927c('0x9')]=_0x214104[_0x927c('0xd')];_0x2b1e06[_0x927c('0xe')]=_0x214104[_0x927c('0xe')];utils[_0x927c('0xf')]('CreateMemberReport',_0x2b1e06);}});}})['catch'](function(_0x2174dc){utils['error'](util[_0x927c('0x4')](_0x927c('0x13'),_0x2b1e06[_0x927c('0x6')]),_0x2174dc);});}delete members[_0x2b1e06[_0x927c('0x7')]];}function startsWith(_0x5ca021,_0x98ecb1){return _['some'](_0x5ca021,function(_0x7ae73a){return _[_0x927c('0x14')](_0x98ecb1,_0x7ae73a);});}exports[_0x927c('0x15')]=function(_0x4d5d93){try{utils[_0x927c('0x16')](util[_0x927c('0x4')]('[%s][members][devicestatechange]',members[_0x4d5d93['device']]?members[_0x4d5d93[_0x927c('0x17')]]['uniqueid']:_0x4d5d93[_0x927c('0x17')]),_0x4d5d93);utils[_0x927c('0x18')](util[_0x927c('0x4')](_0x927c('0x19'),members[_0x4d5d93[_0x927c('0x17')]]?members[_0x4d5d93['device']][_0x927c('0x6')]:_0x4d5d93['device'],_0x4d5d93['state'],_0x4d5d93[_0x927c('0x17')]));switch(_0x4d5d93[_0x927c('0x1a')]){case _0x927c('0x1b'):case _0x927c('0x1c'):if(!startsWith(exclude,_0x4d5d93[_0x927c('0x17')])){members[_0x4d5d93[_0x927c('0x17')]]={'channel':_0x927c('0x1d'),'interface':_0x4d5d93[_0x927c('0x17')],'type':'TALKING','enterAt':utils[_0x927c('0x1e')](),'role':'agent'};}break;case _0x927c('0x1f'):if(!_[_0x927c('0x20')](members[_0x4d5d93[_0x927c('0x17')]])){members[_0x4d5d93['device']]['exitAt']=utils[_0x927c('0x1e')]();members[_0x4d5d93[_0x927c('0x17')]][_0x927c('0x21')]=utils[_0x927c('0x22')](members[_0x4d5d93[_0x927c('0x17')]]['exitAt'],members[_0x4d5d93[_0x927c('0x17')]][_0x927c('0x23')]);if(members[_0x4d5d93[_0x927c('0x17')]]['uniqueid']){writeDB(members[_0x4d5d93['device']]);}}break;default:break;}}catch(_0x90027c){utils[_0x927c('0x24')](util[_0x927c('0x4')](_0x927c('0x25'),members[_0x4d5d93['device']]?members[_0x4d5d93[_0x927c('0x17')]]['uniqueid']:_0x4d5d93[_0x927c('0x17')]),_0x90027c);}};exports[_0x927c('0x26')]=function(_0x166d0a){try{if(!_[_0x927c('0x20')](members[_0x166d0a[_0x927c('0x7')]])){utils[_0x927c('0x16')](util[_0x927c('0x4')](_0x927c('0x27'),_0x166d0a[_0x927c('0x6')]),_0x166d0a);utils[_0x927c('0x18')](util[_0x927c('0x4')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x166d0a[_0x927c('0x6')],_0x166d0a[_0x927c('0x7')],_0x166d0a[_0x927c('0x28')]));members[_0x166d0a[_0x927c('0x7')]]=_[_0x927c('0x29')](members[_0x166d0a[_0x927c('0x7')]],{'data4':_0x166d0a[_0x927c('0x28')],'uniqueid':_0x166d0a['uniqueid']});}}catch(_0x9582d2){utils[_0x927c('0x24')](util['format'](_0x927c('0x27'),_0x166d0a[_0x927c('0x6')]),_0x9582d2);}};exports['cdr']=function(_0x57b6ee){try{utils[_0x927c('0x16')](util['format'](_0x927c('0x2a'),_0x57b6ee[_0x927c('0x6')]),_0x57b6ee);if(_0x57b6ee[_0x927c('0x8')]){var _0x1534d4=_0x57b6ee[_0x927c('0x8')][_0x927c('0x12')]('-')[0x0];if(!_[_0x927c('0x20')](members[_0x1534d4])){members[_0x1534d4]=_['assign'](members[_0x1534d4],{'data1':members[_0x1534d4][_0x927c('0x2b')]||_0x57b6ee[_0x927c('0xa')],'data2':members[_0x1534d4][_0x927c('0x2c')]||_0x57b6ee[_0x927c('0x2d')],'data3':members[_0x1534d4][_0x927c('0x2e')]||_0x57b6ee['destination'],'uniqueid':members[_0x1534d4][_0x927c('0x6')]||_0x57b6ee[_0x927c('0x6')]});utils[_0x927c('0x18')](util[_0x927c('0x4')](_0x927c('0x2f'),_0x57b6ee[_0x927c('0x6')],members[_0x1534d4][_0x927c('0x2b')],members[_0x1534d4][_0x927c('0x2c')],members[_0x1534d4][_0x927c('0x2e')]));if(members[_0x1534d4][_0x927c('0x30')]){writeDB(members[_0x1534d4]);}}}if(_0x57b6ee[_0x927c('0x31')]){var _0x2abade=_0x57b6ee['destinationchannel']['split']('-')[0x0];if(!_[_0x927c('0x20')](members[_0x2abade])){members[_0x2abade]=_['assign'](members[_0x2abade],{'data1':members[_0x2abade]['data1']||_0x57b6ee['type'],'data2':members[_0x2abade][_0x927c('0x2c')]||_0x57b6ee[_0x927c('0x2d')],'data3':members[_0x2abade]['data3']||_0x57b6ee['destination'],'uniqueid':members[_0x2abade][_0x927c('0x6')]||_0x57b6ee[_0x927c('0x6')]});utils[_0x927c('0x18')](util[_0x927c('0x4')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x57b6ee[_0x927c('0x6')],members[_0x2abade][_0x927c('0x2b')],members[_0x2abade][_0x927c('0x2c')],members[_0x2abade][_0x927c('0x2e')]));if(members[_0x2abade][_0x927c('0x30')]){writeDB(members[_0x2abade]);}}}}catch(_0x293492){utils[_0x927c('0x24')](util[_0x927c('0x4')](_0x927c('0x2a'),_0x57b6ee[_0x927c('0x6')]),_0x293492);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index fcbf18e..7fabbe8 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 _0x8c42=['name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','debug','[%s][queues][varset]','variable','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerexitAt','queueposition','queuecallerabandonAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','holdtime','diffTime','queuecallerjoinAt','count','connectedlinename','agentconnect','[%s][queues][agentconnect]','membername','assigned','accountcode','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','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','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','./utils','info','format','channel','queue','lastAssignedTo','calleridnum','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s'];(function(_0x5e4368,_0x18566d){var _0x16e816=function(_0x2df9ed){while(--_0x2df9ed){_0x5e4368['push'](_0x5e4368['shift']());}};_0x16e816(++_0x18566d);}(_0x8c42,0x190));var _0x28c4=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x8c42[_0x152136];return _0x20df44;};'use strict';var _=require(_0x28c4('0x0'));var util=require(_0x28c4('0x1'));var utils=require(_0x28c4('0x2'));var queues={};function writeDB(_0xebdad){utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0xebdad['uniqueid'],_0xebdad[_0x28c4('0x5')],_0xebdad[_0x28c4('0x6')],_0xebdad[_0x28c4('0x7')],_0xebdad[_0x28c4('0x8')],_0xebdad['accountcode'],_0xebdad['queuecallerexitreason']));if(_0xebdad[_0x28c4('0x6')]){utils[_0x28c4('0x9')](_0xebdad[_0x28c4('0x6')])[_0x28c4('0xa')](function(_0x5456e7){if(_0x5456e7){_0xebdad[_0x28c4('0xb')]=_0x5456e7[_0x28c4('0xb')];}utils[_0x28c4('0xc')](_0x28c4('0xd'),_0xebdad);});}else{utils[_0x28c4('0xc')](_0x28c4('0xd'),_0xebdad);}if(_0xebdad[_0x28c4('0xe')]){delete queues[_0xebdad[_0x28c4('0xe')]];}else{delete queues[_0xebdad[_0x28c4('0xf')]];}}exports[_0x28c4('0x10')]=function(_0x30da13){try{utils['debug'](util[_0x28c4('0x4')](_0x28c4('0x11'),_0x30da13['uniqueid']),_0x30da13);utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x12'),_0x30da13[_0x28c4('0xf')],_0x30da13[_0x28c4('0x6')],_0x30da13[_0x28c4('0x13')]));queues[_0x30da13[_0x28c4('0xf')]]=_[_0x28c4('0x14')](_0x30da13,{'originalposition':_0x30da13['position'],'queuecallerjoinAt':utils[_0x28c4('0x15')](),'mohtime':0x0});}catch(_0x427f2c){utils[_0x28c4('0x16')](util['format']('[%s][queues][queuecallerjoin]',_0x30da13[_0x28c4('0xf')]),_0x427f2c);}};exports[_0x28c4('0x17')]=function(_0x43d1ca){try{if(!_[_0x28c4('0x18')](queues[_0x43d1ca[_0x28c4('0xf')]])){utils['debug'](util[_0x28c4('0x4')](_0x28c4('0x19'),_0x43d1ca[_0x28c4('0xf')]),_0x43d1ca);if(queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1a')]){if(!queues[_0x43d1ca[_0x28c4('0xf')]]['queuecallerabandon']&&!queues[_0x43d1ca['uniqueid']][_0x28c4('0x1b')]){queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1c')]=!![];queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1d')]=utils[_0x28c4('0x15')]();queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0x1e')]='COMPLETEDBYAGENT';}utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x1f'),_0x43d1ca[_0x28c4('0xf')],queues[_0x43d1ca['uniqueid']][_0x28c4('0x20')],queues[_0x43d1ca['uniqueid']][_0x28c4('0x1e')]));writeDB(queues[_0x43d1ca[_0x28c4('0xf')]]);}else if(queues[_0x43d1ca[_0x28c4('0xf')]]['transfereduniqueid']){utils['info'](util[_0x28c4('0x4')](_0x28c4('0x21'),_0x43d1ca[_0x28c4('0xf')],queues[_0x43d1ca['uniqueid']]['name'],queues[_0x43d1ca[_0x28c4('0xf')]]['transfereduniqueid']));queues[queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0xe')]]=queues[_0x43d1ca['uniqueid']];queues[queues[_0x43d1ca[_0x28c4('0xf')]][_0x28c4('0xe')]][_0x28c4('0x22')]=0x2;delete queues[_0x43d1ca[_0x28c4('0xf')]];}}}catch(_0x54f089){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x19'),_0x43d1ca[_0x28c4('0xf')]),_0x54f089);}};exports[_0x28c4('0x23')]=function(_0x183b56){try{utils[_0x28c4('0x24')](util['format'](_0x28c4('0x25'),_0x183b56['uniqueid']),_0x183b56);if(!_['isNil'](_0x183b56[_0x28c4('0x26')]['queuestatus'])&&_0x183b56[_0x28c4('0x27')][_0x28c4('0x28')]()!==_0x28c4('0x29')){if(!_[_0x28c4('0x18')](queues[_0x183b56[_0x28c4('0xf')]])){queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x183b56[_0x28c4('0xf')]]['queuecallerabandonAt']=null;queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1b')]=!![];queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2b')]=utils['now']();queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1e')]=_0x183b56[_0x28c4('0x27')][_0x28c4('0x28')]();utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s',_0x183b56[_0x28c4('0xf')],queues[_0x183b56['uniqueid']][_0x28c4('0x20')],_0x183b56[_0x28c4('0x27')],queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1e')]));writeDB(queues[_0x183b56[_0x28c4('0xf')]]);}}else if(!_[_0x28c4('0x18')](_0x183b56[_0x28c4('0x26')][_0x28c4('0x2c')])){if(!_['isNil'](queues[_0x183b56[_0x28c4('0xf')]])&&!queues[_0x183b56[_0x28c4('0xf')]]['queuecallerabandon']){queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2d')]=null;queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1b')]=!![];queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x2b')]=utils['now']();queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x1e')]=_0x28c4('0x2e');utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x2f'),_0x183b56[_0x28c4('0xf')],queues[_0x183b56[_0x28c4('0xf')]][_0x28c4('0x20')],_0x183b56['value'],queues[_0x183b56['uniqueid']]['queuecallerexitreason']));}}}catch(_0x596f36){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x25'),_0x183b56['uniqueid']),_0x596f36);}};exports[_0x28c4('0x2a')]=function(_0x3376da){try{if(!_[_0x28c4('0x18')](queues[_0x3376da[_0x28c4('0xf')]])){utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x30'),_0x3376da['uniqueid']),_0x3376da);queues[_0x3376da['uniqueid']][_0x28c4('0x1b')]=![];queues[_0x3376da[_0x28c4('0xf')]][_0x28c4('0x2b')]=null;queues[_0x3376da[_0x28c4('0xf')]]['queuecallerabandon']=!![];queues[_0x3376da[_0x28c4('0xf')]][_0x28c4('0x2d')]=utils[_0x28c4('0x15')]();queues[_0x3376da['uniqueid']][_0x28c4('0x1e')]='ABANDONED';utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x3376da[_0x28c4('0xf')],queues[_0x3376da['uniqueid']][_0x28c4('0x20')],queues[_0x3376da[_0x28c4('0xf')]][_0x28c4('0x1e')]));}}catch(_0x4e6128){utils['error'](util[_0x28c4('0x4')](_0x28c4('0x30'),_0x3376da[_0x28c4('0xf')]),_0x4e6128);}};exports[_0x28c4('0x31')]=function(_0x1e57a7){try{if(!_['isNil'](queues[_0x1e57a7['uniqueid']])){utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x32'),_0x1e57a7[_0x28c4('0xf')]),_0x1e57a7);utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x33'),_0x1e57a7[_0x28c4('0xf')],queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x20')],_0x1e57a7[_0x28c4('0x34')],_0x1e57a7['connectedlinename']));queues[_0x1e57a7[_0x28c4('0xf')]]['queuecallerleave']=!![];queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x1a')]=utils[_0x28c4('0x15')]();queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x35')]=utils[_0x28c4('0x36')](queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x1a')],queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x37')]);queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x13')]=_0x1e57a7[_0x28c4('0x13')];queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x38')]=_0x1e57a7[_0x28c4('0x38')];queues[_0x1e57a7[_0x28c4('0xf')]][_0x28c4('0x34')]=_0x1e57a7[_0x28c4('0x34')];queues[_0x1e57a7['uniqueid']]['connectedlinename']=_0x1e57a7[_0x28c4('0x39')];}}catch(_0x22fe81){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x32'),_0x1e57a7[_0x28c4('0xf')]),_0x22fe81);}};exports[_0x28c4('0x3a')]=function(_0x3791f6){try{if(!_[_0x28c4('0x18')](queues[_0x3791f6[_0x28c4('0xf')]])){utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x3b'),_0x3791f6['uniqueid']),_0x3791f6);utils[_0x28c4('0x3')](util[_0x28c4('0x4')]('[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s',_0x3791f6[_0x28c4('0xf')],queues[_0x3791f6[_0x28c4('0xf')]]['name'],_0x3791f6[_0x28c4('0x3c')],_0x3791f6['destaccountcode']));queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2d')]=null;queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x1b')]=![];queues[_0x3791f6['uniqueid']][_0x28c4('0x1e')]=null;queues[_0x3791f6[_0x28c4('0xf')]][_0x28c4('0x2b')]=null;queues[_0x3791f6['uniqueid']][_0x28c4('0x3d')]=!![];queues[_0x3791f6['uniqueid']][_0x28c4('0x3e')]=_0x3791f6[_0x28c4('0x3f')];queues[_0x3791f6[_0x28c4('0xf')]]['lastAssignedTo']=_0x3791f6[_0x28c4('0x3c')];}}catch(_0x491650){utils[_0x28c4('0x16')](util[_0x28c4('0x4')](_0x28c4('0x3b'),_0x3791f6[_0x28c4('0xf')]),_0x491650);}};exports[_0x28c4('0x40')]=function(_0x2728b6){try{if(!_[_0x28c4('0x18')](queues[_0x2728b6['uniqueid']])){if(queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1a')]){utils[_0x28c4('0x24')](util['format'](_0x28c4('0x41'),_0x2728b6[_0x28c4('0xf')]),_0x2728b6);queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x2a')]=![];queues[_0x2728b6[_0x28c4('0xf')]]['queuecallerabandonAt']=null;queues[_0x2728b6['uniqueid']][_0x28c4('0x1b')]=![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x2b')]=null;queues[_0x2728b6['uniqueid']][_0x28c4('0x3d')]=!![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x7')]=_0x2728b6[_0x28c4('0x3c')];queues[_0x2728b6[_0x28c4('0xf')]]['queuecallercomplete']=!![];queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1d')]=utils[_0x28c4('0x15')]();if(_0x2728b6[_0x28c4('0x42')]=='transfer'){if(!queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x43')]){queues[_0x2728b6['uniqueid']][_0x28c4('0x1e')]=_0x28c4('0x44');}}else{queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1e')]='COMPLETEDBY'+_0x2728b6[_0x28c4('0x42')][_0x28c4('0x28')]();}utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x45'),_0x2728b6['uniqueid'],queues[_0x2728b6['uniqueid']]['name'],_0x2728b6['membername'],queues[_0x2728b6[_0x28c4('0xf')]][_0x28c4('0x1e')]));writeDB(queues[_0x2728b6[_0x28c4('0xf')]]);}}}catch(_0x517161){utils['error'](util[_0x28c4('0x4')](_0x28c4('0x41'),_0x2728b6[_0x28c4('0xf')]),_0x517161);}};exports[_0x28c4('0x46')]=function(_0x19df07){try{if(!_[_0x28c4('0x18')](queues[_0x19df07[_0x28c4('0x47')]])){utils[_0x28c4('0x24')](util['format'](_0x28c4('0x48'),_0x19df07[_0x28c4('0xf')]),_0x19df07);queues[_0x19df07[_0x28c4('0x47')]][_0x28c4('0x43')]=!![];queues[_0x19df07[_0x28c4('0x47')]][_0x28c4('0x49')]=_0x28c4('0x4a');queues[_0x19df07['transfereeuniqueid']][_0x28c4('0x4b')]=_0x19df07[_0x28c4('0x4c')];queues[_0x19df07['transfereeuniqueid']][_0x28c4('0x4d')]=_0x19df07[_0x28c4('0x47')];queues[_0x19df07[_0x28c4('0x47')]][_0x28c4('0x1e')]=_0x28c4('0x4e');utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x4f'),_0x19df07[_0x28c4('0xf')],queues[_0x19df07['transfereeuniqueid']][_0x28c4('0x20')],_0x19df07[_0x28c4('0x47')],_0x19df07['extension']));}}catch(_0x5468d2){utils['error'](util['format'](_0x28c4('0x48'),_0x19df07[_0x28c4('0xf')]),_0x5468d2);}};exports[_0x28c4('0x50')]=function(_0x1374fc){try{utils[_0x28c4('0x24')](util[_0x28c4('0x4')](_0x28c4('0x51'),_0x1374fc[_0x28c4('0x52')]),_0x1374fc);if(_0x1374fc[_0x28c4('0x52')]==_0x1374fc[_0x28c4('0x53')]){if(!_[_0x28c4('0x18')](queues[_0x1374fc['secondtransfererlinkedid']])){utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x54'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x20')],_0x1374fc[_0x28c4('0x56')]));queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x43')]=!![];queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x49')]=_0x28c4('0x57');queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x4b')]=_0x1374fc[_0x28c4('0x56')];queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x4d')]=_0x1374fc[_0x28c4('0x52')];queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0x1e')]=_0x28c4('0x58');}if(!_[_0x28c4('0x18')](queues[_0x1374fc['origtransfererlinkedid']])){if(_0x1374fc[_0x28c4('0x59')]&&queues[_0x1374fc[_0x28c4('0x59')]]){queues[_0x1374fc[_0x28c4('0x59')]][_0x28c4('0x22')]=0x1;queues[_0x1374fc[_0x28c4('0x47')]]=_[_0x28c4('0x5a')](queues[_0x1374fc[_0x28c4('0x59')]]);queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0xe')]=_0x1374fc[_0x28c4('0x5b')];queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0x22')]=0x2;queues[_0x1374fc['transfereeuniqueid']]['calleridnum']=queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x8')];queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x5c')]=queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x5c')];queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x37')]=utils['now']();queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0x1a')]=utils['now']();queues[_0x1374fc[_0x28c4('0x47')]]['holdtime']=0x0;queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x5d')]=0x0;utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x5e'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc[_0x28c4('0x47')]]['name'],queues[_0x1374fc['transfereeuniqueid']][_0x28c4('0x8')],queues[_0x1374fc[_0x28c4('0x47')]][_0x28c4('0x5c')]));}else{utils[_0x28c4('0x3')](util['format'](_0x28c4('0x5f'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x20')],_0x1374fc[_0x28c4('0x55')]));queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0xe')]=_0x1374fc['secondtransfererlinkedid'];}}}else if(_0x1374fc[_0x28c4('0x60')]==_0x1374fc[_0x28c4('0x55')]){if(!_[_0x28c4('0x18')](queues[_0x1374fc[_0x28c4('0x53')]])){utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x61'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc['origtransfererlinkedid']][_0x28c4('0x20')],_0x1374fc['secondtransfereruniqueid'],_0x1374fc['secondtransfererexten']));queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x43')]=!![];queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x49')]=_0x28c4('0x57');queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x4b')]=_0x1374fc[_0x28c4('0x62')];queues[_0x1374fc[_0x28c4('0x53')]][_0x28c4('0x4d')]=_0x1374fc['secondtransfereruniqueid'];queues[_0x1374fc[_0x28c4('0x53')]]['queuecallerexitreason']=_0x28c4('0x58');}if(!_['isNil'](queues[_0x1374fc[_0x28c4('0x55')]])){if(_0x1374fc['transfertargetlinkedid']&&queues[_0x1374fc[_0x28c4('0x63')]]){queues[_0x1374fc['transfertargetlinkedid']][_0x28c4('0x22')]=0x1;queues[_0x1374fc[_0x28c4('0x5b')]]=_[_0x28c4('0x5a')](queues[_0x1374fc[_0x28c4('0x63')]]);queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0xe')]=_0x1374fc[_0x28c4('0x5b')];queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x22')]=0x2;queues[_0x1374fc['transfertargetuniqueid']][_0x28c4('0x8')]=queues[_0x1374fc[_0x28c4('0x53')]]['calleridnum'];queues[_0x1374fc[_0x28c4('0x5b')]]['calleridname']=queues[_0x1374fc['origtransfererlinkedid']][_0x28c4('0x5c')];queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x37')]=utils[_0x28c4('0x15')]();queues[_0x1374fc['transfertargetuniqueid']][_0x28c4('0x1a')]=utils[_0x28c4('0x15')]();queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x35')]=0x0;queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x5d')]=0x0;utils[_0x28c4('0x3')](util['format'](_0x28c4('0x64'),_0x1374fc['origtransfereruniqueid'],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x20')],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0xe')],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x8')],queues[_0x1374fc[_0x28c4('0x5b')]][_0x28c4('0x5c')]));}else{utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x5f'),_0x1374fc[_0x28c4('0x52')],queues[_0x1374fc['secondtransfererlinkedid']][_0x28c4('0x20')],_0x1374fc[_0x28c4('0x53')]));queues[_0x1374fc[_0x28c4('0x55')]][_0x28c4('0xe')]=_0x1374fc[_0x28c4('0x53')];}}}}catch(_0x2e469c){utils[_0x28c4('0x16')](util[_0x28c4('0x4')]('[%s][queues][attendedtransfer]',_0x1374fc['origtransfereruniqueid']),_0x2e469c);}};exports[_0x28c4('0x65')]=function(_0x3d5bd5){try{if(!_['isNil'](queues[_0x3d5bd5['uniqueid']])){utils[_0x28c4('0x24')](util['format'](_0x28c4('0x66'),_0x3d5bd5[_0x28c4('0xf')]),_0x3d5bd5);queues[_0x3d5bd5[_0x28c4('0xf')]]['musiconholdstartAt']=utils['now']();utils[_0x28c4('0x3')](util[_0x28c4('0x4')](_0x28c4('0x67'),_0x3d5bd5['uniqueid'],queues[_0x3d5bd5[_0x28c4('0xf')]][_0x28c4('0x20')],queues[_0x3d5bd5[_0x28c4('0xf')]]['musiconholdstartAt']));}}catch(_0x3e522d){utils['error'](util[_0x28c4('0x4')]('[%s][queues][musiconholdstart]',_0x3d5bd5['uniqueid']),_0x3e522d);}};exports[_0x28c4('0x68')]=function(_0x5274d3){try{if(!_[_0x28c4('0x18')](queues[_0x5274d3[_0x28c4('0xf')]])){if(!_[_0x28c4('0x18')](queues[_0x5274d3[_0x28c4('0xf')]][_0x28c4('0x69')])){utils['debug'](util[_0x28c4('0x4')]('[%s][queues][musiconholdstop]',_0x5274d3[_0x28c4('0xf')]),_0x5274d3);queues[_0x5274d3[_0x28c4('0xf')]]['mohtime']+=utils[_0x28c4('0x36')](utils['now'](),queues[_0x5274d3['uniqueid']][_0x28c4('0x69')]);utils[_0x28c4('0x3')](util['format'](_0x28c4('0x6a'),_0x5274d3[_0x28c4('0xf')],queues[_0x5274d3[_0x28c4('0xf')]]['name'],queues[_0x5274d3[_0x28c4('0xf')]][_0x28c4('0x5d')]));delete queues[_0x5274d3['uniqueid']][_0x28c4('0x69')];}}}catch(_0x55c6bf){utils['error'](util[_0x28c4('0x4')](_0x28c4('0x6b'),_0x5274d3[_0x28c4('0xf')]),_0x55c6bf);}}; \ No newline at end of file +var _0x6d7d=['secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','[%s][queues][musiconholdstop]','lodash','util','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','queue','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','info','position','assign','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerexitreason','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','varset','queuestatus','value','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','holdtime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','assigned','membername','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','transfertargetuniqueid','calleridname','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s'];(function(_0x11fb3e,_0x5e876e){var _0x38f317=function(_0x3444b4){while(--_0x3444b4){_0x11fb3e['push'](_0x11fb3e['shift']());}};_0x38f317(++_0x5e876e);}(_0x6d7d,0x6f));var _0xd6d7=function(_0x115286,_0x1dc33a){_0x115286=_0x115286-0x0;var _0x4dc381=_0x6d7d[_0x115286];return _0x4dc381;};'use strict';var _=require(_0xd6d7('0x0'));var util=require(_0xd6d7('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x50ffc6){utils['info'](util[_0xd6d7('0x2')](_0xd6d7('0x3'),_0x50ffc6[_0xd6d7('0x4')],_0x50ffc6[_0xd6d7('0x5')],_0x50ffc6['queue'],_0x50ffc6[_0xd6d7('0x6')],_0x50ffc6[_0xd6d7('0x7')],_0x50ffc6[_0xd6d7('0x8')],_0x50ffc6['queuecallerexitreason']));if(_0x50ffc6['queue']){utils[_0xd6d7('0x9')](_0x50ffc6[_0xd6d7('0xa')])[_0xd6d7('0xb')](function(_0x5815d7){if(_0x5815d7){_0x50ffc6[_0xd6d7('0xc')]=_0x5815d7[_0xd6d7('0xc')];}utils[_0xd6d7('0xd')](_0xd6d7('0xe'),_0x50ffc6);});}else{utils['request'](_0xd6d7('0xe'),_0x50ffc6);}if(_0x50ffc6[_0xd6d7('0xf')]){delete queues[_0x50ffc6[_0xd6d7('0xf')]];}else{delete queues[_0x50ffc6[_0xd6d7('0x4')]];}}exports[_0xd6d7('0x10')]=function(_0x5af471){try{utils[_0xd6d7('0x11')](util[_0xd6d7('0x2')](_0xd6d7('0x12'),_0x5af471[_0xd6d7('0x4')]),_0x5af471);utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x5af471['uniqueid'],_0x5af471[_0xd6d7('0xa')],_0x5af471[_0xd6d7('0x14')]));queues[_0x5af471[_0xd6d7('0x4')]]=_[_0xd6d7('0x15')](_0x5af471,{'originalposition':_0x5af471[_0xd6d7('0x14')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x3ae85){utils[_0xd6d7('0x16')](util[_0xd6d7('0x2')](_0xd6d7('0x12'),_0x5af471[_0xd6d7('0x4')]),_0x3ae85);}};exports[_0xd6d7('0x17')]=function(_0x2a3665){try{if(!_[_0xd6d7('0x18')](queues[_0x2a3665[_0xd6d7('0x4')]])){utils[_0xd6d7('0x11')](util[_0xd6d7('0x2')](_0xd6d7('0x19'),_0x2a3665[_0xd6d7('0x4')]),_0x2a3665);if(queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0x1a')]){if(!queues[_0x2a3665[_0xd6d7('0x4')]]['queuecallerabandon']&&!queues[_0x2a3665['uniqueid']][_0xd6d7('0x1b')]){queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0x1c')]=!![];queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0x1d')]=utils[_0xd6d7('0x1e')]();queues[_0x2a3665[_0xd6d7('0x4')]]['queuecallerexitreason']=_0xd6d7('0x1f');}utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')](_0xd6d7('0x20'),_0x2a3665[_0xd6d7('0x4')],queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0x21')],queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0x22')]));writeDB(queues[_0x2a3665[_0xd6d7('0x4')]]);}else if(queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0xf')]){utils[_0xd6d7('0x13')](util['format'](_0xd6d7('0x23'),_0x2a3665[_0xd6d7('0x4')],queues[_0x2a3665['uniqueid']]['name'],queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0xf')]));queues[queues[_0x2a3665[_0xd6d7('0x4')]]['transfereduniqueid']]=queues[_0x2a3665[_0xd6d7('0x4')]];queues[queues[_0x2a3665[_0xd6d7('0x4')]][_0xd6d7('0xf')]]['queuecallerenterreason']=0x2;delete queues[_0x2a3665[_0xd6d7('0x4')]];}}}catch(_0x373c44){utils['error'](util['format'](_0xd6d7('0x19'),_0x2a3665[_0xd6d7('0x4')]),_0x373c44);}};exports[_0xd6d7('0x24')]=function(_0x316cdd){try{utils[_0xd6d7('0x11')](util[_0xd6d7('0x2')]('[%s][queues][varset]',_0x316cdd['uniqueid']),_0x316cdd);if(!_[_0xd6d7('0x18')](_0x316cdd['variable'][_0xd6d7('0x25')])&&_0x316cdd[_0xd6d7('0x26')]['toUpperCase']()!=='CONTINUE'){if(!_[_0xd6d7('0x18')](queues[_0x316cdd[_0xd6d7('0x4')]])){queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x27')]=![];queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x28')]=null;queues[_0x316cdd['uniqueid']][_0xd6d7('0x1b')]=!![];queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x29')]=utils[_0xd6d7('0x1e')]();queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x22')]=_0x316cdd[_0xd6d7('0x26')]['toUpperCase']();utils[_0xd6d7('0x13')](util['format'](_0xd6d7('0x2a'),_0x316cdd[_0xd6d7('0x4')],queues[_0x316cdd[_0xd6d7('0x4')]]['name'],_0x316cdd[_0xd6d7('0x26')],queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x22')]));writeDB(queues[_0x316cdd['uniqueid']]);}}else if(!_[_0xd6d7('0x18')](_0x316cdd['variable'][_0xd6d7('0x2b')])){if(!_[_0xd6d7('0x18')](queues[_0x316cdd[_0xd6d7('0x4')]])&&!queues[_0x316cdd['uniqueid']][_0xd6d7('0x27')]){queues[_0x316cdd['uniqueid']][_0xd6d7('0x27')]=![];queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x28')]=null;queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x1b')]=!![];queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x29')]=utils[_0xd6d7('0x1e')]();queues[_0x316cdd[_0xd6d7('0x4')]]['queuecallerexitreason']=_0xd6d7('0x2c');utils[_0xd6d7('0x13')](util['format'](_0xd6d7('0x2d'),_0x316cdd[_0xd6d7('0x4')],queues[_0x316cdd['uniqueid']][_0xd6d7('0x21')],_0x316cdd['value'],queues[_0x316cdd[_0xd6d7('0x4')]][_0xd6d7('0x22')]));}}}catch(_0x3e47c5){utils['error'](util[_0xd6d7('0x2')](_0xd6d7('0x2e'),_0x316cdd[_0xd6d7('0x4')]),_0x3e47c5);}};exports[_0xd6d7('0x27')]=function(_0x6765ca){try{if(!_['isNil'](queues[_0x6765ca[_0xd6d7('0x4')]])){utils[_0xd6d7('0x11')](util['format']('[%s][queues][queuecallerabandon]',_0x6765ca['uniqueid']),_0x6765ca);queues[_0x6765ca[_0xd6d7('0x4')]][_0xd6d7('0x1b')]=![];queues[_0x6765ca[_0xd6d7('0x4')]][_0xd6d7('0x29')]=null;queues[_0x6765ca[_0xd6d7('0x4')]]['queuecallerabandon']=!![];queues[_0x6765ca[_0xd6d7('0x4')]][_0xd6d7('0x28')]=utils[_0xd6d7('0x1e')]();queues[_0x6765ca[_0xd6d7('0x4')]][_0xd6d7('0x22')]='ABANDONED';utils['info'](util[_0xd6d7('0x2')](_0xd6d7('0x2f'),_0x6765ca[_0xd6d7('0x4')],queues[_0x6765ca[_0xd6d7('0x4')]][_0xd6d7('0x21')],queues[_0x6765ca['uniqueid']][_0xd6d7('0x22')]));}}catch(_0x38c3cd){utils[_0xd6d7('0x16')](util[_0xd6d7('0x2')]('[%s][queues][queuecallerabandon]',_0x6765ca[_0xd6d7('0x4')]),_0x38c3cd);}};exports[_0xd6d7('0x30')]=function(_0x4d14e6){try{if(!_['isNil'](queues[_0x4d14e6[_0xd6d7('0x4')]])){utils['debug'](util[_0xd6d7('0x2')](_0xd6d7('0x31'),_0x4d14e6['uniqueid']),_0x4d14e6);utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')](_0xd6d7('0x32'),_0x4d14e6['uniqueid'],queues[_0x4d14e6['uniqueid']][_0xd6d7('0x21')],_0x4d14e6['connectedlinenum'],_0x4d14e6['connectedlinename']));queues[_0x4d14e6['uniqueid']][_0xd6d7('0x30')]=!![];queues[_0x4d14e6['uniqueid']][_0xd6d7('0x1a')]=utils[_0xd6d7('0x1e')]();queues[_0x4d14e6[_0xd6d7('0x4')]][_0xd6d7('0x33')]=utils['diffTime'](queues[_0x4d14e6['uniqueid']][_0xd6d7('0x1a')],queues[_0x4d14e6[_0xd6d7('0x4')]][_0xd6d7('0x34')]);queues[_0x4d14e6[_0xd6d7('0x4')]][_0xd6d7('0x14')]=_0x4d14e6[_0xd6d7('0x14')];queues[_0x4d14e6['uniqueid']][_0xd6d7('0x35')]=_0x4d14e6[_0xd6d7('0x35')];queues[_0x4d14e6[_0xd6d7('0x4')]][_0xd6d7('0x36')]=_0x4d14e6['connectedlinenum'];queues[_0x4d14e6['uniqueid']]['connectedlinename']=_0x4d14e6['connectedlinename'];}}catch(_0x22f501){utils['error'](util['format']('[%s][queues][queuecallerleave]',_0x4d14e6[_0xd6d7('0x4')]),_0x22f501);}};exports[_0xd6d7('0x37')]=function(_0x105991){try{if(!_[_0xd6d7('0x18')](queues[_0x105991[_0xd6d7('0x4')]])){utils['debug'](util[_0xd6d7('0x2')](_0xd6d7('0x38'),_0x105991[_0xd6d7('0x4')]),_0x105991);utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')](_0xd6d7('0x39'),_0x105991[_0xd6d7('0x4')],queues[_0x105991[_0xd6d7('0x4')]][_0xd6d7('0x21')],_0x105991['membername'],_0x105991['destaccountcode']));queues[_0x105991[_0xd6d7('0x4')]][_0xd6d7('0x27')]=![];queues[_0x105991[_0xd6d7('0x4')]]['queuecallerabandon']=![];queues[_0x105991['uniqueid']]['queuecallerabandonAt']=null;queues[_0x105991[_0xd6d7('0x4')]][_0xd6d7('0x1b')]=![];queues[_0x105991[_0xd6d7('0x4')]][_0xd6d7('0x22')]=null;queues[_0x105991[_0xd6d7('0x4')]][_0xd6d7('0x29')]=null;queues[_0x105991[_0xd6d7('0x4')]][_0xd6d7('0x3a')]=!![];queues[_0x105991[_0xd6d7('0x4')]]['accountcode']=_0x105991['destaccountcode'];queues[_0x105991[_0xd6d7('0x4')]]['lastAssignedTo']=_0x105991[_0xd6d7('0x3b')];}}catch(_0x59404b){utils['error'](util[_0xd6d7('0x2')](_0xd6d7('0x38'),_0x105991['uniqueid']),_0x59404b);}};exports['agentcomplete']=function(_0x5e479c){try{if(!_[_0xd6d7('0x18')](queues[_0x5e479c[_0xd6d7('0x4')]])){if(queues[_0x5e479c['uniqueid']]['queuecallerleaveAt']){utils[_0xd6d7('0x11')](util['format'](_0xd6d7('0x3c'),_0x5e479c[_0xd6d7('0x4')]),_0x5e479c);queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x27')]=![];queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x27')]=![];queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x28')]=null;queues[_0x5e479c['uniqueid']][_0xd6d7('0x1b')]=![];queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x29')]=null;queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x3a')]=!![];queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x6')]=_0x5e479c[_0xd6d7('0x3b')];queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x1c')]=!![];queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x1d')]=utils['now']();if(_0x5e479c[_0xd6d7('0x3d')]==_0xd6d7('0x3e')){if(!queues[_0x5e479c[_0xd6d7('0x4')]]['transfer']){queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x22')]=_0xd6d7('0x3f');}}else{queues[_0x5e479c[_0xd6d7('0x4')]][_0xd6d7('0x22')]=_0xd6d7('0x40')+_0x5e479c[_0xd6d7('0x3d')]['toUpperCase']();}utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')](_0xd6d7('0x41'),_0x5e479c[_0xd6d7('0x4')],queues[_0x5e479c['uniqueid']][_0xd6d7('0x21')],_0x5e479c[_0xd6d7('0x3b')],queues[_0x5e479c[_0xd6d7('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x5e479c[_0xd6d7('0x4')]]);}}}catch(_0x41c32f){utils[_0xd6d7('0x16')](util['format'](_0xd6d7('0x3c'),_0x5e479c['uniqueid']),_0x41c32f);}};exports['blindtransfer']=function(_0x5d3ade){try{if(!_[_0xd6d7('0x18')](queues[_0x5d3ade[_0xd6d7('0x42')]])){utils['debug'](util['format'](_0xd6d7('0x43'),_0x5d3ade['uniqueid']),_0x5d3ade);queues[_0x5d3ade[_0xd6d7('0x42')]][_0xd6d7('0x3e')]=!![];queues[_0x5d3ade[_0xd6d7('0x42')]][_0xd6d7('0x44')]=_0xd6d7('0x45');queues[_0x5d3ade[_0xd6d7('0x42')]][_0xd6d7('0x46')]=_0x5d3ade[_0xd6d7('0x47')];queues[_0x5d3ade['transfereeuniqueid']][_0xd6d7('0x48')]=_0x5d3ade[_0xd6d7('0x42')];queues[_0x5d3ade[_0xd6d7('0x42')]][_0xd6d7('0x22')]='BLINDTRANSFER';utils[_0xd6d7('0x13')](util['format'](_0xd6d7('0x49'),_0x5d3ade[_0xd6d7('0x4')],queues[_0x5d3ade[_0xd6d7('0x42')]][_0xd6d7('0x21')],_0x5d3ade[_0xd6d7('0x42')],_0x5d3ade['extension']));}}catch(_0x236a7e){utils[_0xd6d7('0x16')](util[_0xd6d7('0x2')](_0xd6d7('0x43'),_0x5d3ade['uniqueid']),_0x236a7e);}};exports[_0xd6d7('0x4a')]=function(_0x45bb83){try{utils[_0xd6d7('0x11')](util[_0xd6d7('0x2')]('[%s][queues][attendedtransfer]',_0x45bb83[_0xd6d7('0x4b')]),_0x45bb83);if(_0x45bb83[_0xd6d7('0x4b')]==_0x45bb83[_0xd6d7('0x4c')]){if(!_[_0xd6d7('0x18')](queues[_0x45bb83[_0xd6d7('0x4d')]])){utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x45bb83[_0xd6d7('0x4b')],queues[_0x45bb83[_0xd6d7('0x4d')]][_0xd6d7('0x21')],_0x45bb83[_0xd6d7('0x4e')]));queues[_0x45bb83[_0xd6d7('0x4d')]][_0xd6d7('0x3e')]=!![];queues[_0x45bb83['secondtransfererlinkedid']]['transfertype']='ATTENDED';queues[_0x45bb83['secondtransfererlinkedid']][_0xd6d7('0x46')]=_0x45bb83['origtransfererexten'];queues[_0x45bb83[_0xd6d7('0x4d')]]['transferuniqueid']=_0x45bb83[_0xd6d7('0x4b')];queues[_0x45bb83[_0xd6d7('0x4d')]]['queuecallerexitreason']=_0xd6d7('0x4f');}if(!_[_0xd6d7('0x18')](queues[_0x45bb83[_0xd6d7('0x4c')]])){if(_0x45bb83[_0xd6d7('0x50')]&&queues[_0x45bb83[_0xd6d7('0x50')]]){queues[_0x45bb83[_0xd6d7('0x50')]][_0xd6d7('0x51')]=0x1;queues[_0x45bb83[_0xd6d7('0x42')]]=_[_0xd6d7('0x52')](queues[_0x45bb83[_0xd6d7('0x50')]]);queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0xf')]=_0x45bb83[_0xd6d7('0x53')];queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x51')]=0x2;queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x7')]=queues[_0x45bb83[_0xd6d7('0x4d')]]['calleridnum'];queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x54')]=queues[_0x45bb83['secondtransfererlinkedid']][_0xd6d7('0x54')];queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x34')]=utils[_0xd6d7('0x1e')]();queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x1a')]=utils['now']();queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x33')]=0x0;queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x55')]=0x0;utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x45bb83[_0xd6d7('0x4b')],queues[_0x45bb83[_0xd6d7('0x42')]]['name'],queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x7')],queues[_0x45bb83[_0xd6d7('0x42')]][_0xd6d7('0x54')]));}else{utils[_0xd6d7('0x13')](util['format'](_0xd6d7('0x56'),_0x45bb83[_0xd6d7('0x4b')],queues[_0x45bb83['origtransfererlinkedid']]['name'],_0x45bb83[_0xd6d7('0x4d')]));queues[_0x45bb83[_0xd6d7('0x4c')]][_0xd6d7('0xf')]=_0x45bb83['secondtransfererlinkedid'];}}}else if(_0x45bb83[_0xd6d7('0x57')]==_0x45bb83[_0xd6d7('0x4d')]){if(!_[_0xd6d7('0x18')](queues[_0x45bb83[_0xd6d7('0x4c')]])){utils['info'](util[_0xd6d7('0x2')](_0xd6d7('0x58'),_0x45bb83[_0xd6d7('0x4b')],queues[_0x45bb83[_0xd6d7('0x4c')]][_0xd6d7('0x21')],_0x45bb83[_0xd6d7('0x57')],_0x45bb83[_0xd6d7('0x59')]));queues[_0x45bb83[_0xd6d7('0x4c')]][_0xd6d7('0x3e')]=!![];queues[_0x45bb83[_0xd6d7('0x4c')]][_0xd6d7('0x44')]='ATTENDED';queues[_0x45bb83['origtransfererlinkedid']][_0xd6d7('0x46')]=_0x45bb83[_0xd6d7('0x59')];queues[_0x45bb83['origtransfererlinkedid']]['transferuniqueid']=_0x45bb83[_0xd6d7('0x57')];queues[_0x45bb83[_0xd6d7('0x4c')]][_0xd6d7('0x22')]=_0xd6d7('0x4f');}if(!_[_0xd6d7('0x18')](queues[_0x45bb83['secondtransfererlinkedid']])){if(_0x45bb83['transfertargetlinkedid']&&queues[_0x45bb83[_0xd6d7('0x5a')]]){queues[_0x45bb83['transfertargetlinkedid']][_0xd6d7('0x51')]=0x1;queues[_0x45bb83[_0xd6d7('0x53')]]=_[_0xd6d7('0x52')](queues[_0x45bb83[_0xd6d7('0x5a')]]);queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0xf')]=_0x45bb83[_0xd6d7('0x53')];queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0x51')]=0x2;queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0x7')]=queues[_0x45bb83[_0xd6d7('0x4c')]]['calleridnum'];queues[_0x45bb83[_0xd6d7('0x53')]]['calleridname']=queues[_0x45bb83['origtransfererlinkedid']][_0xd6d7('0x54')];queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0x34')]=utils[_0xd6d7('0x1e')]();queues[_0x45bb83['transfertargetuniqueid']][_0xd6d7('0x1a')]=utils[_0xd6d7('0x1e')]();queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0x33')]=0x0;queues[_0x45bb83[_0xd6d7('0x53')]]['mohtime']=0x0;utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')](_0xd6d7('0x5b'),_0x45bb83[_0xd6d7('0x4b')],queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0x21')],queues[_0x45bb83['transfertargetuniqueid']]['transfereduniqueid'],queues[_0x45bb83[_0xd6d7('0x53')]]['calleridnum'],queues[_0x45bb83[_0xd6d7('0x53')]][_0xd6d7('0x54')]));}else{utils['info'](util[_0xd6d7('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x45bb83['origtransfereruniqueid'],queues[_0x45bb83[_0xd6d7('0x4d')]][_0xd6d7('0x21')],_0x45bb83['origtransfererlinkedid']));queues[_0x45bb83[_0xd6d7('0x4d')]][_0xd6d7('0xf')]=_0x45bb83[_0xd6d7('0x4c')];}}}}catch(_0x2addc1){utils[_0xd6d7('0x16')](util[_0xd6d7('0x2')](_0xd6d7('0x5c'),_0x45bb83[_0xd6d7('0x4b')]),_0x2addc1);}};exports[_0xd6d7('0x5d')]=function(_0x21630b){try{if(!_['isNil'](queues[_0x21630b[_0xd6d7('0x4')]])){utils[_0xd6d7('0x11')](util[_0xd6d7('0x2')](_0xd6d7('0x5e'),_0x21630b[_0xd6d7('0x4')]),_0x21630b);queues[_0x21630b['uniqueid']][_0xd6d7('0x5f')]=utils[_0xd6d7('0x1e')]();utils[_0xd6d7('0x13')](util[_0xd6d7('0x2')](_0xd6d7('0x60'),_0x21630b[_0xd6d7('0x4')],queues[_0x21630b[_0xd6d7('0x4')]]['name'],queues[_0x21630b['uniqueid']]['musiconholdstartAt']));}}catch(_0x4a41cb){utils[_0xd6d7('0x16')](util['format'](_0xd6d7('0x5e'),_0x21630b[_0xd6d7('0x4')]),_0x4a41cb);}};exports['musiconholdstop']=function(_0x4892e3){try{if(!_[_0xd6d7('0x18')](queues[_0x4892e3[_0xd6d7('0x4')]])){if(!_[_0xd6d7('0x18')](queues[_0x4892e3['uniqueid']][_0xd6d7('0x5f')])){utils[_0xd6d7('0x11')](util[_0xd6d7('0x2')]('[%s][queues][musiconholdstop]',_0x4892e3[_0xd6d7('0x4')]),_0x4892e3);queues[_0x4892e3['uniqueid']][_0xd6d7('0x55')]+=utils['diffTime'](utils[_0xd6d7('0x1e')](),queues[_0x4892e3[_0xd6d7('0x4')]][_0xd6d7('0x5f')]);utils[_0xd6d7('0x13')](util['format'](_0xd6d7('0x61'),_0x4892e3[_0xd6d7('0x4')],queues[_0x4892e3['uniqueid']]['name'],queues[_0x4892e3[_0xd6d7('0x4')]]['mohtime']));delete queues[_0x4892e3[_0xd6d7('0x4')]]['musiconholdstartAt'];}}}catch(_0x46d576){utils[_0xd6d7('0x16')](util[_0xd6d7('0x2')](_0xd6d7('0x62'),_0x4892e3[_0xd6d7('0x4')]),_0x46d576);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 63fd7aa..c8df1a5 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 _0x8532=['channel','error','channelstate','isNil','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','[%s][recordings][varset]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','debug','linkedid','exten','context'];(function(_0x37c4f3,_0x1acd04){var _0x262974=function(_0x17f067){while(--_0x17f067){_0x37c4f3['push'](_0x37c4f3['shift']());}};_0x262974(++_0x1acd04);}(_0x8532,0x15a));var _0x2853=function(_0xfef1da,_0x409405){_0xfef1da=_0xfef1da-0x0;var _0x44abe5=_0x8532[_0xfef1da];return _0x44abe5;};'use strict';var _=require(_0x2853('0x0'));var util=require(_0x2853('0x1'));var utils=require(_0x2853('0x2'));var recordings={};function writeDB(_0x45ccbe){utils[_0x2853('0x3')](util[_0x2853('0x4')](_0x2853('0x5'),_0x45ccbe[_0x2853('0x6')]));if(_0x45ccbe['accountcode']){utils[_0x2853('0x7')](_0x45ccbe[_0x2853('0x8')])[_0x2853('0x9')](function(_0x2bb118){if(_0x2bb118){_0x45ccbe[_0x2853('0xa')]=_0x2bb118[_0x2853('0xb')];_0x45ccbe[_0x2853('0xc')]=_0x2bb118['id'];}utils[_0x2853('0xd')](_0x2853('0xe'),_0x45ccbe);});}else{utils[_0x2853('0xd')](_0x2853('0xe'),_0x45ccbe);}}exports[_0x2853('0xf')]=function(_0x55f5ca){try{utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][newchannel]',_0x55f5ca[_0x2853('0x6')]),_0x55f5ca);if(_0x55f5ca['uniqueid']==_0x55f5ca[_0x2853('0x11')]){utils[_0x2853('0x3')](util[_0x2853('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x55f5ca[_0x2853('0x6')],_0x55f5ca['context'],_0x55f5ca[_0x2853('0x12')]));recordings[_0x55f5ca[_0x2853('0x6')]]={'uniqueid':_0x55f5ca[_0x2853('0x6')],'accountcode':_0x55f5ca[_0x2853('0x8')],'exten':_0x55f5ca[_0x2853('0x12')],'context':_0x55f5ca[_0x2853('0x13')],'channel':_0x55f5ca[_0x2853('0x14')],'monitors':[]};}}catch(_0x4c03e1){utils[_0x2853('0x15')](util[_0x2853('0x4')]('[%s][recordings][newchannel]',_0x55f5ca['uniqueid']),_0x4c03e1);}};exports['newstate']=function(_0xcf47e1){try{utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][newstate]',_0xcf47e1['uniqueid']),_0xcf47e1);if(!_['isNil'](recordings[_0xcf47e1['uniqueid']])&&_0xcf47e1[_0x2853('0x16')]==0x6){utils[_0x2853('0x3')](util[_0x2853('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0xcf47e1[_0x2853('0x6')],_0xcf47e1[_0x2853('0x13')],_0xcf47e1['channel']));}else if(!_[_0x2853('0x17')](recordings[_0xcf47e1[_0x2853('0x11')]])&&_0xcf47e1[_0x2853('0x16')]==0x6&&_0xcf47e1[_0x2853('0x13')]!=_0x2853('0x18')){utils[_0x2853('0x3')](util['format'](_0x2853('0x19'),_0xcf47e1['uniqueid'],_0xcf47e1['linkedid'],_0xcf47e1[_0x2853('0x13')],_0xcf47e1[_0x2853('0x14')]));recordings[_0xcf47e1[_0x2853('0x11')]]['accountcode']=_0xcf47e1[_0x2853('0x8')];}}catch(_0x238b9d){utils[_0x2853('0x15')](util[_0x2853('0x4')]('[%s][recordings][newstate]',_0xcf47e1[_0x2853('0x6')]),_0x238b9d);}};exports[_0x2853('0x1a')]=function(_0x4ff180){try{if(!_[_0x2853('0x17')](_0x4ff180['variable'])&&!_[_0x2853('0x17')](_0x4ff180[_0x2853('0x1b')][_0x2853('0x1c')])){utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][varset]',_0x4ff180['uniqueid']),_0x4ff180);utils[_0x2853('0x3')](util[_0x2853('0x4')](_0x2853('0x1d'),_0x4ff180['uniqueid'],_0x4ff180['variable'],_0x4ff180[_0x2853('0x1e')]));if(_[_0x2853('0x1f')](_0x4ff180[_0x2853('0x1e')],_0x2853('0x20'))){_0x4ff180[_0x2853('0x1e')]=_0x4ff180[_0x2853('0x1e')][_0x2853('0x21')](_0x2853('0x20'),_0x2853('0x22'));}if(recordings[_0x4ff180[_0x2853('0x11')]]){var _0x1dd6ed=_['find'](recordings[_0x4ff180['linkedid']][_0x2853('0x23')],{'value':_0x4ff180[_0x2853('0x1e')]});if(_['isNil'](_0x1dd6ed)){recordings[_0x4ff180[_0x2853('0x11')]][_0x2853('0x23')][_0x2853('0x24')]({'value':_0x4ff180['value']});}}}}catch(_0xefb824){utils[_0x2853('0x15')](util['format'](_0x2853('0x25'),_0x4ff180[_0x2853('0x6')]),_0xefb824);}};exports['hangup']=function(_0xbb4453){try{if(!_[_0x2853('0x17')](recordings[_0xbb4453[_0x2853('0x6')]])){utils['debug'](util[_0x2853('0x4')]('[%s][recordings][hangup]',_0xbb4453[_0x2853('0x6')]),_0xbb4453);utils[_0x2853('0x3')](util[_0x2853('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0xbb4453['uniqueid'],_0xbb4453[_0x2853('0x26')],_0xbb4453[_0x2853('0x27')],_0xbb4453[_0x2853('0x28')]));recordings[_0xbb4453['uniqueid']][_0x2853('0x26')]=_0xbb4453[_0x2853('0x26')];recordings[_0xbb4453[_0x2853('0x6')]][_0x2853('0x27')]=_0xbb4453[_0x2853('0x27')];recordings[_0xbb4453['uniqueid']][_0x2853('0x29')]=_0xbb4453[_0x2853('0x29')];recordings[_0xbb4453['uniqueid']][_0x2853('0x2a')]=_0xbb4453[_0x2853('0x2a')];if(recordings[_0xbb4453['uniqueid']][_0x2853('0x2b')]==_0x2853('0x2c')&&recordings[_0xbb4453['uniqueid']][_0x2853('0x8')]){recordings[_0xbb4453['uniqueid']][_0x2853('0x29')]=recordings[_0xbb4453[_0x2853('0x6')]][_0x2853('0x8')];recordings[_0xbb4453['uniqueid']]['connectedlinename']='';}recordings[_0xbb4453[_0x2853('0x6')]]['monitors'][_0x2853('0x2d')](function(_0x492567){var _0x294827=_[_0x2853('0x2e')](recordings[_0xbb4453['uniqueid']]);_0x294827[_0x2853('0x1e')]=_0x492567[_0x2853('0x1e')];writeDB(_0x294827);});delete recordings[_0xbb4453['uniqueid']];}}catch(_0x4fe6fc){utils[_0x2853('0x15')](util[_0x2853('0x4')]('[%s][recordings][hangup]',_0xbb4453[_0x2853('0x6')]),_0x4fe6fc);}};exports[_0x2853('0x2f')]=function(_0x3ae4a1){try{if(!_[_0x2853('0x17')](recordings[_0x3ae4a1[_0x2853('0x6')]])){utils[_0x2853('0x10')](util[_0x2853('0x4')](_0x2853('0x30'),_0x3ae4a1[_0x2853('0x6')]),_0x3ae4a1);utils[_0x2853('0x3')](util['format'](_0x2853('0x31'),_0x3ae4a1[_0x2853('0x6')],_0x3ae4a1[_0x2853('0x32')],_0x3ae4a1[_0x2853('0x33')]));if(_0x3ae4a1[_0x2853('0x32')][_0x2853('0x34')]()==_0x2853('0x35')&&_[_0x2853('0x36')](_0x3ae4a1['appdata'][_0x2853('0x34')](),'cdr')){var _0x5b7867=_0x3ae4a1[_0x2853('0x33')][_0x2853('0x37')]('=');var _0x2a20be=_0x5b7867[0x0][_0x2853('0x38')](_0x5b7867[0x0][_0x2853('0x39')]('(')+0x1,_0x5b7867[0x0][_0x2853('0x39')](')'));var _0x15a3fc=_0x5b7867[0x1];recordings[_0x3ae4a1[_0x2853('0x6')]][_0x2a20be]=_0x15a3fc;}}}catch(_0x3ab4d0){utils[_0x2853('0x15')](util['format'](_0x2853('0x30'),_0x3ae4a1[_0x2853('0x6')]),_0x3ab4d0);}};exports[_0x2853('0x3a')]=function(_0x4178e9){try{if(!_[_0x2853('0x17')](recordings[_0x4178e9[_0x2853('0x6')]])){utils[_0x2853('0x10')](util[_0x2853('0x4')]('[%s][recordings][queuecallerjoin]',_0x4178e9[_0x2853('0x6')]),_0x4178e9);utils[_0x2853('0x3')](util[_0x2853('0x4')](_0x2853('0x3b'),_0x4178e9[_0x2853('0x6')],_0x4178e9[_0x2853('0x3c')]));recordings[_0x4178e9['uniqueid']]['queue']=_0x4178e9['queue'];}}catch(_0x1a62e3){utils['error'](util[_0x2853('0x4')]('[%s][recordings][queuecallerjoin]',_0x4178e9[_0x2853('0x6')]),_0x1a62e3);}}; \ No newline at end of file +var _0xa531=['name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','info','exten','context','error','newstate','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','mixmonitor_filename','[%s][recordings][varset]','value','endsWith','replace','.wav49','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','connectedlinenum','connectedlinename','type','forEach','clone','[%s][recordings][hangup]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','format','uniqueid','accountcode','getUserByInternal','membername'];(function(_0x240cab,_0x2d1428){var _0x3cab1d=function(_0x250179){while(--_0x250179){_0x240cab['push'](_0x240cab['shift']());}};_0x3cab1d(++_0x2d1428);}(_0xa531,0x12e));var _0x1a53=function(_0x525910,_0x2d3743){_0x525910=_0x525910-0x0;var _0x464c8f=_0xa531[_0x525910];return _0x464c8f;};'use strict';var _=require(_0x1a53('0x0'));var util=require(_0x1a53('0x1'));var utils=require(_0x1a53('0x2'));var recordings={};function writeDB(_0x4d811c){utils['info'](util[_0x1a53('0x3')]('[%s][recordings][writeDB]',_0x4d811c[_0x1a53('0x4')]));if(_0x4d811c[_0x1a53('0x5')]){utils[_0x1a53('0x6')](_0x4d811c[_0x1a53('0x5')])['then'](function(_0x2dcf22){if(_0x2dcf22){_0x4d811c[_0x1a53('0x7')]=_0x2dcf22[_0x1a53('0x8')];_0x4d811c[_0x1a53('0x9')]=_0x2dcf22['id'];}utils['request']('CreateVoiceRecording',_0x4d811c);});}else{utils[_0x1a53('0xa')](_0x1a53('0xb'),_0x4d811c);}}exports[_0x1a53('0xc')]=function(_0x10012d){try{utils[_0x1a53('0xd')](util['format'](_0x1a53('0xe'),_0x10012d[_0x1a53('0x4')]),_0x10012d);if(_0x10012d['uniqueid']==_0x10012d['linkedid']){utils[_0x1a53('0xf')](util[_0x1a53('0x3')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x10012d[_0x1a53('0x4')],_0x10012d['context'],_0x10012d[_0x1a53('0x10')]));recordings[_0x10012d[_0x1a53('0x4')]]={'uniqueid':_0x10012d[_0x1a53('0x4')],'accountcode':_0x10012d[_0x1a53('0x5')],'exten':_0x10012d[_0x1a53('0x10')],'context':_0x10012d[_0x1a53('0x11')],'channel':_0x10012d['channel'],'monitors':[]};}}catch(_0x1e6d1b){utils[_0x1a53('0x12')](util[_0x1a53('0x3')](_0x1a53('0xe'),_0x10012d[_0x1a53('0x4')]),_0x1e6d1b);}};exports[_0x1a53('0x13')]=function(_0x49ae97){try{utils[_0x1a53('0xd')](util[_0x1a53('0x3')](_0x1a53('0x14'),_0x49ae97[_0x1a53('0x4')]),_0x49ae97);if(!_[_0x1a53('0x15')](recordings[_0x49ae97['uniqueid']])&&_0x49ae97['channelstate']==0x6){utils['info'](util[_0x1a53('0x3')](_0x1a53('0x16'),_0x49ae97[_0x1a53('0x4')],_0x49ae97[_0x1a53('0x11')],_0x49ae97[_0x1a53('0x17')]));}else if(!_[_0x1a53('0x15')](recordings[_0x49ae97[_0x1a53('0x18')]])&&_0x49ae97['channelstate']==0x6&&_0x49ae97[_0x1a53('0x11')]!=_0x1a53('0x19')){utils[_0x1a53('0xf')](util[_0x1a53('0x3')](_0x1a53('0x1a'),_0x49ae97[_0x1a53('0x4')],_0x49ae97[_0x1a53('0x18')],_0x49ae97[_0x1a53('0x11')],_0x49ae97[_0x1a53('0x17')]));recordings[_0x49ae97[_0x1a53('0x18')]]['accountcode']=_0x49ae97[_0x1a53('0x5')];}}catch(_0x4920e3){utils[_0x1a53('0x12')](util['format']('[%s][recordings][newstate]',_0x49ae97['uniqueid']),_0x4920e3);}};exports[_0x1a53('0x1b')]=function(_0x56dd59){try{if(!_[_0x1a53('0x15')](_0x56dd59['variable'])&&!_[_0x1a53('0x15')](_0x56dd59[_0x1a53('0x1c')][_0x1a53('0x1d')])){utils[_0x1a53('0xd')](util[_0x1a53('0x3')](_0x1a53('0x1e'),_0x56dd59['uniqueid']),_0x56dd59);utils[_0x1a53('0xf')](util[_0x1a53('0x3')]('[%s][recordings][varset]\x20variable:%s\x20value:%s',_0x56dd59[_0x1a53('0x4')],_0x56dd59[_0x1a53('0x1c')],_0x56dd59[_0x1a53('0x1f')]));if(_[_0x1a53('0x20')](_0x56dd59['value'],'.wav49')){_0x56dd59[_0x1a53('0x1f')]=_0x56dd59['value'][_0x1a53('0x21')](_0x1a53('0x22'),_0x1a53('0x23'));}if(recordings[_0x56dd59[_0x1a53('0x18')]]){var _0x4dbda4=_[_0x1a53('0x24')](recordings[_0x56dd59['linkedid']][_0x1a53('0x25')],{'value':_0x56dd59[_0x1a53('0x1f')]});if(_['isNil'](_0x4dbda4)){recordings[_0x56dd59[_0x1a53('0x18')]][_0x1a53('0x25')][_0x1a53('0x26')]({'value':_0x56dd59[_0x1a53('0x1f')]});}}}}catch(_0x194d20){utils[_0x1a53('0x12')](util[_0x1a53('0x3')]('[%s][recordings][varset]',_0x56dd59[_0x1a53('0x4')]),_0x194d20);}};exports[_0x1a53('0x27')]=function(_0x210234){try{if(!_[_0x1a53('0x15')](recordings[_0x210234['uniqueid']])){utils['debug'](util[_0x1a53('0x3')]('[%s][recordings][hangup]',_0x210234[_0x1a53('0x4')]),_0x210234);utils[_0x1a53('0xf')](util[_0x1a53('0x3')](_0x1a53('0x28'),_0x210234[_0x1a53('0x4')],_0x210234[_0x1a53('0x29')],_0x210234[_0x1a53('0x2a')],_0x210234['cause-txt']));recordings[_0x210234[_0x1a53('0x4')]][_0x1a53('0x29')]=_0x210234[_0x1a53('0x29')];recordings[_0x210234[_0x1a53('0x4')]][_0x1a53('0x2a')]=_0x210234[_0x1a53('0x2a')];recordings[_0x210234[_0x1a53('0x4')]][_0x1a53('0x2b')]=_0x210234[_0x1a53('0x2b')];recordings[_0x210234[_0x1a53('0x4')]]['connectedlinename']=_0x210234[_0x1a53('0x2c')];if(recordings[_0x210234['uniqueid']][_0x1a53('0x2d')]=='outbound'&&recordings[_0x210234[_0x1a53('0x4')]][_0x1a53('0x5')]){recordings[_0x210234['uniqueid']][_0x1a53('0x2b')]=recordings[_0x210234[_0x1a53('0x4')]][_0x1a53('0x5')];recordings[_0x210234[_0x1a53('0x4')]]['connectedlinename']='';}recordings[_0x210234[_0x1a53('0x4')]][_0x1a53('0x25')][_0x1a53('0x2e')](function(_0x5d4f14){var _0x3c6282=_[_0x1a53('0x2f')](recordings[_0x210234[_0x1a53('0x4')]]);_0x3c6282[_0x1a53('0x1f')]=_0x5d4f14[_0x1a53('0x1f')];writeDB(_0x3c6282);});delete recordings[_0x210234['uniqueid']];}}catch(_0x5f15e7){utils['error'](util['format'](_0x1a53('0x30'),_0x210234[_0x1a53('0x4')]),_0x5f15e7);}};exports['newexten']=function(_0xbb5f8e){try{if(!_[_0x1a53('0x15')](recordings[_0xbb5f8e['uniqueid']])){utils[_0x1a53('0xd')](util[_0x1a53('0x3')]('[%s][recordings][newexten]',_0xbb5f8e[_0x1a53('0x4')]),_0xbb5f8e);utils[_0x1a53('0xf')](util['format']('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0xbb5f8e[_0x1a53('0x4')],_0xbb5f8e[_0x1a53('0x31')],_0xbb5f8e[_0x1a53('0x32')]));if(_0xbb5f8e[_0x1a53('0x31')][_0x1a53('0x33')]()==_0x1a53('0x34')&&_[_0x1a53('0x35')](_0xbb5f8e['appdata'][_0x1a53('0x33')](),_0x1a53('0x36'))){var _0x27f81b=_0xbb5f8e['appdata'][_0x1a53('0x37')]('=');var _0x5835f2=_0x27f81b[0x0][_0x1a53('0x38')](_0x27f81b[0x0][_0x1a53('0x39')]('(')+0x1,_0x27f81b[0x0]['lastIndexOf'](')'));var _0x26f3c8=_0x27f81b[0x1];recordings[_0xbb5f8e['uniqueid']][_0x5835f2]=_0x26f3c8;}}}catch(_0x29bc6a){utils['error'](util[_0x1a53('0x3')](_0x1a53('0x3a'),_0xbb5f8e[_0x1a53('0x4')]),_0x29bc6a);}};exports[_0x1a53('0x3b')]=function(_0x3622a2){try{if(!_[_0x1a53('0x15')](recordings[_0x3622a2['uniqueid']])){utils[_0x1a53('0xd')](util[_0x1a53('0x3')](_0x1a53('0x3c'),_0x3622a2[_0x1a53('0x4')]),_0x3622a2);utils[_0x1a53('0xf')](util[_0x1a53('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x3622a2[_0x1a53('0x4')],_0x3622a2['queue']));recordings[_0x3622a2['uniqueid']][_0x1a53('0x3d')]=_0x3622a2[_0x1a53('0x3d')];}}catch(_0x570bf8){utils[_0x1a53('0x12')](util[_0x1a53('0x3')](_0x1a53('0x3c'),_0x3622a2[_0x1a53('0x4')]),_0x570bf8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 80a1ab7..291f783 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 _0xd2e8=['origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','lodash','util','./utils','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','error','attendedtransfer','debug','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s'];(function(_0x3e8d4d,_0x55cd8f){var _0x3f4d24=function(_0x1cf516){while(--_0x1cf516){_0x3e8d4d['push'](_0x3e8d4d['shift']());}};_0x3f4d24(++_0x55cd8f);}(_0xd2e8,0x92));var _0x8d2e=function(_0x4b775b,_0x2aadc6){_0x4b775b=_0x4b775b-0x0;var _0xf84d39=_0xd2e8[_0x4b775b];return _0xf84d39;};'use strict';var _=require(_0x8d2e('0x0'));var util=require(_0x8d2e('0x1'));var utils=require(_0x8d2e('0x2'));function writeDB(_0x5533a8){utils['info'](util[_0x8d2e('0x3')](_0x8d2e('0x4'),_0x5533a8[_0x8d2e('0x5')]===_0x8d2e('0x6')?_0x5533a8[_0x8d2e('0x7')]:_0x5533a8[_0x8d2e('0x8')],_0x5533a8[_0x8d2e('0x5')]));utils[_0x8d2e('0x9')](_0x8d2e('0xa'),_0x5533a8);}exports['blindtransfer']=function(_0x336aea){try{utils['debug'](util[_0x8d2e('0x3')](_0x8d2e('0xb'),_0x336aea[_0x8d2e('0x8')]),_0x336aea);utils[_0x8d2e('0xc')](util[_0x8d2e('0x3')](_0x8d2e('0xd'),_0x336aea[_0x8d2e('0x8')],_0x336aea[_0x8d2e('0xe')],_0x336aea[_0x8d2e('0xf')],_0x336aea[_0x8d2e('0x10')],_0x336aea['transfereecalleridname']));_0x336aea[_0x8d2e('0x5')]='blind';writeDB(_0x336aea);}catch(_0xcc1c44){utils[_0x8d2e('0x11')](util[_0x8d2e('0x3')](_0x8d2e('0xb'),_0x336aea['uniqueid']),_0xcc1c44);}};exports[_0x8d2e('0x12')]=function(_0x19d1a9){try{utils[_0x8d2e('0x13')](util['format'](_0x8d2e('0x14'),_0x19d1a9['origtransfereruniqueid']),_0x19d1a9);utils[_0x8d2e('0xc')](util['format'](_0x8d2e('0x15'),_0x19d1a9['origtransfereruniqueid'],_0x19d1a9[_0x8d2e('0x16')],_0x19d1a9[_0x8d2e('0x17')],_0x19d1a9[_0x8d2e('0x18')],_0x19d1a9[_0x8d2e('0x19')]));_0x19d1a9=_[_0x8d2e('0x1a')](_0x19d1a9,{'transfererchannel':_0x19d1a9[_0x8d2e('0x1b')],'transferercalleridnum':_0x19d1a9[_0x8d2e('0x16')],'transferercalleridname':_0x19d1a9[_0x8d2e('0x17')],'transfererconnectedlinenum':_0x19d1a9[_0x8d2e('0x1c')],'transfererconnectedlinename':_0x19d1a9['secondtransfererconnectedlinename'],'transfereraccountcode':_0x19d1a9[_0x8d2e('0x1d')],'transferercontext':_0x19d1a9[_0x8d2e('0x1e')],'transfererexten':_0x19d1a9[_0x8d2e('0x1f')],'transfererlinkedid':_0x19d1a9[_0x8d2e('0x20')],'context':_0x19d1a9[_0x8d2e('0x21')],'extension':_0x19d1a9[_0x8d2e('0x22')],'type':_0x8d2e('0x6')});if(_['isNil'](_0x19d1a9[_0x8d2e('0x23')])){_0x19d1a9=_[_0x8d2e('0x1a')](_0x19d1a9,{'transfereechannel':_0x19d1a9[_0x8d2e('0x24')],'transfereecalleridnum':_0x19d1a9['transfertargetcalleridnum'],'transfereecalleridname':_0x19d1a9[_0x8d2e('0x19')],'transfereeconnectedlinenum':_0x19d1a9[_0x8d2e('0x25')],'transfereeconnectedlinename':_0x19d1a9[_0x8d2e('0x26')],'transfereeaccountcode':_0x19d1a9[_0x8d2e('0x27')],'transfereecontext':_0x19d1a9['transfertargetcontext'],'transfereeexten':_0x19d1a9[_0x8d2e('0x28')],'transfereelinkedid':_0x19d1a9[_0x8d2e('0x29')]});}writeDB(_0x19d1a9);}catch(_0x4f3778){utils[_0x8d2e('0x11')](util[_0x8d2e('0x3')](_0x8d2e('0x14'),_0x19d1a9[_0x8d2e('0x7')]),_0x4f3778);}}; \ No newline at end of file +var _0x8f6a=['transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','CreateVoiceTransferReport','blindtransfer','debug','[%s][transfers][blindtransfer]','uniqueid','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','transfertargetcalleridnum','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign'];(function(_0x4fdc35,_0x3fd0c6){var _0x1e2efd=function(_0x4564d9){while(--_0x4564d9){_0x4fdc35['push'](_0x4fdc35['shift']());}};_0x1e2efd(++_0x3fd0c6);}(_0x8f6a,0x12d));var _0xa8f6=function(_0x4f8890,_0x500069){_0x4f8890=_0x4f8890-0x0;var _0x4cf911=_0x8f6a[_0x4f8890];return _0x4cf911;};'use strict';var _=require(_0xa8f6('0x0'));var util=require(_0xa8f6('0x1'));var utils=require(_0xa8f6('0x2'));function writeDB(_0x569832){utils[_0xa8f6('0x3')](util[_0xa8f6('0x4')](_0xa8f6('0x5'),_0x569832[_0xa8f6('0x6')]===_0xa8f6('0x7')?_0x569832[_0xa8f6('0x8')]:_0x569832['uniqueid'],_0x569832[_0xa8f6('0x6')]));utils['request'](_0xa8f6('0x9'),_0x569832);}exports[_0xa8f6('0xa')]=function(_0x4f732b){try{utils[_0xa8f6('0xb')](util['format'](_0xa8f6('0xc'),_0x4f732b[_0xa8f6('0xd')]),_0x4f732b);utils[_0xa8f6('0x3')](util[_0xa8f6('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4f732b[_0xa8f6('0xd')],_0x4f732b[_0xa8f6('0xe')],_0x4f732b[_0xa8f6('0xf')],_0x4f732b[_0xa8f6('0x10')],_0x4f732b[_0xa8f6('0x11')]));_0x4f732b[_0xa8f6('0x6')]=_0xa8f6('0x12');writeDB(_0x4f732b);}catch(_0x2a4f99){utils[_0xa8f6('0x13')](util[_0xa8f6('0x4')](_0xa8f6('0xc'),_0x4f732b[_0xa8f6('0xd')]),_0x2a4f99);}};exports[_0xa8f6('0x14')]=function(_0x4bba56){try{utils[_0xa8f6('0xb')](util['format']('[%s][transfers][attendedtransfer]',_0x4bba56[_0xa8f6('0x8')]),_0x4bba56);utils[_0xa8f6('0x3')](util['format'](_0xa8f6('0x15'),_0x4bba56[_0xa8f6('0x8')],_0x4bba56[_0xa8f6('0x16')],_0x4bba56['origtransferercalleridname'],_0x4bba56[_0xa8f6('0x17')],_0x4bba56['transfertargetcalleridname']));_0x4bba56=_['assign'](_0x4bba56,{'transfererchannel':_0x4bba56[_0xa8f6('0x18')],'transferercalleridnum':_0x4bba56[_0xa8f6('0x16')],'transferercalleridname':_0x4bba56['origtransferercalleridname'],'transfererconnectedlinenum':_0x4bba56[_0xa8f6('0x19')],'transfererconnectedlinename':_0x4bba56[_0xa8f6('0x1a')],'transfereraccountcode':_0x4bba56[_0xa8f6('0x1b')],'transferercontext':_0x4bba56['secondtransferercontext'],'transfererexten':_0x4bba56[_0xa8f6('0x1c')],'transfererlinkedid':_0x4bba56[_0xa8f6('0x1d')],'context':_0x4bba56[_0xa8f6('0x1e')],'extension':_0x4bba56[_0xa8f6('0x1f')],'type':_0xa8f6('0x7')});if(_[_0xa8f6('0x20')](_0x4bba56[_0xa8f6('0x21')])){_0x4bba56=_[_0xa8f6('0x22')](_0x4bba56,{'transfereechannel':_0x4bba56[_0xa8f6('0x23')],'transfereecalleridnum':_0x4bba56[_0xa8f6('0x17')],'transfereecalleridname':_0x4bba56[_0xa8f6('0x24')],'transfereeconnectedlinenum':_0x4bba56[_0xa8f6('0x25')],'transfereeconnectedlinename':_0x4bba56[_0xa8f6('0x26')],'transfereeaccountcode':_0x4bba56[_0xa8f6('0x27')],'transfereecontext':_0x4bba56['transfertargetcontext'],'transfereeexten':_0x4bba56['transfertargetexten'],'transfereelinkedid':_0x4bba56[_0xa8f6('0x28')]});}writeDB(_0x4bba56);}catch(_0x313637){utils[_0xa8f6('0x13')](util['format'](_0xa8f6('0x29'),_0x4bba56[_0xa8f6('0x8')]),_0x313637);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 5a1e37c..ed6986b 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 _0xf2a0=['GetUser','internal','name','interface','then','[utils][getUser]\x20where:%s','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','getUserByInterface','found','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','format','isAfter','isBefore','jayson/promise','moment','util','client','../../config/logger','xdr','info','debug','inspect','error','request','[utils][request]\x20name:%s','catch'];(function(_0x551bc1,_0x47cff3){var _0x12ea5e=function(_0x2d4c10){while(--_0x2d4c10){_0x551bc1['push'](_0x551bc1['shift']());}};_0x12ea5e(++_0x47cff3);}(_0xf2a0,0x7d));var _0x0f2a=function(_0x377217,_0x26b013){_0x377217=_0x377217-0x0;var _0x26258d=_0xf2a0[_0x377217];return _0x26258d;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x0f2a('0x0'));var moment=require(_0x0f2a('0x1'));var util=require(_0x0f2a('0x2'));var client=jayson[_0x0f2a('0x3')]['http']({'port':0x2329});var logger=require(_0x0f2a('0x4'))(_0x0f2a('0x5'));exports[_0x0f2a('0x6')]=function(_0x56095c,_0x452b83){logger[_0x0f2a('0x6')](_0x56095c,_0x452b83?util['inspect'](_0x452b83,{'showHidden':![],'depth':null}):'');};exports[_0x0f2a('0x7')]=function(_0x3bba9e,_0x4c685e){logger[_0x0f2a('0x7')](_0x3bba9e,_0x4c685e?util[_0x0f2a('0x8')](_0x4c685e,{'showHidden':![],'depth':null}):'');};exports[_0x0f2a('0x9')]=function(_0x507230,_0x3858d8){logger[_0x0f2a('0x9')](_0x507230,_0x3858d8?util[_0x0f2a('0x8')](_0x3858d8,{'showHidden':![],'depth':null}):'');};exports[_0x0f2a('0xa')]=function(_0x41b52c,_0x579b54){return client[_0x0f2a('0xa')](_0x41b52c,{'body':_0x579b54})['then'](function(_0x28051f){logger[_0x0f2a('0x7')](_0x0f2a('0xb'),_0x41b52c,_0x28051f?util[_0x0f2a('0x8')](_0x28051f,{'showHidden':![],'depth':null}):'');})[_0x0f2a('0xc')](function(_0x3378d7){logger[_0x0f2a('0x9')](_0x0f2a('0xb'),_0x41b52c,_0x3378d7?util[_0x0f2a('0x8')](_0x3378d7,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3c3828){return client[_0x0f2a('0xa')](_0x0f2a('0xd'),{'options':{'raw':!![],'attributes':['id',_0x0f2a('0xe'),_0x0f2a('0xf'),_0x0f2a('0x10')],'where':_0x3c3828,'limit':0x1}})[_0x0f2a('0x11')](function(_0x59bc4f){logger['debug'](_0x0f2a('0x12'),JSON['stringify'](_0x3c3828),_0x59bc4f?util[_0x0f2a('0x8')](_0x59bc4f,{'showHidden':![],'depth':null}):'');return _0x59bc4f[_0x0f2a('0x13')][_0x0f2a('0x14')]?_0x59bc4f[_0x0f2a('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0xc7cdac){return new BPromise(function(_0x2ae7f5,_0x2f56b7){if(_0xc7cdac){return getUser({'internal':_0xc7cdac})[_0x0f2a('0x11')](function(_0x31a089){logger['info'](_0x0f2a('0x15'),_0xc7cdac,_0x31a089?'found':_0x0f2a('0x16'));return _0x2ae7f5(_0x31a089);})['catch'](function(_0x5b71e6){logger[_0x0f2a('0x9')](_0x0f2a('0x17'),_0x5b71e6?util['inspect'](_0x5b71e6,{'showHidden':![],'depth':null}):'');return _0x2ae7f5(null);});}return _0x2ae7f5(null);});};exports[_0x0f2a('0x18')]=function(_0x27b95d){return new BPromise(function(_0x593c1d,_0x3f930c){if(_0x27b95d){return getUser({'interface':_0x27b95d})[_0x0f2a('0x11')](function(_0x15e239){logger[_0x0f2a('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x27b95d,_0x15e239?_0x0f2a('0x19'):_0x0f2a('0x16'));return _0x593c1d(_0x15e239);})[_0x0f2a('0xc')](function(_0x2ff25c){logger['error']('[utils][getUserByInterface]',_0x2ff25c?util[_0x0f2a('0x8')](_0x2ff25c,{'showHidden':![],'depth':null}):'');return _0x593c1d(null);});}return _0x593c1d(null);});};exports[_0x0f2a('0x1a')]=function(_0x7a2b49){return new BPromise(function(_0x3cbf6b,_0x51fb52){if(_0x7a2b49){return getUser({'name':_0x7a2b49})[_0x0f2a('0x11')](function(_0x36a0b4){logger[_0x0f2a('0x6')](_0x0f2a('0x1b'),_0x7a2b49,_0x36a0b4?'found':_0x0f2a('0x16'));return _0x3cbf6b(_0x36a0b4);})[_0x0f2a('0xc')](function(_0x2eb659){logger[_0x0f2a('0x9')](_0x0f2a('0x1c'),_0x2eb659?util[_0x0f2a('0x8')](_0x2eb659,{'showHidden':![],'depth':null}):'');return _0x3cbf6b(null);});}return _0x3cbf6b(null);});};exports['getVoiceQueueByName']=function(_0x226b5f){return new BPromise(function(_0x20f1d3,_0x2f910e){if(_0x226b5f){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id','name',_0x0f2a('0x1d'),_0x0f2a('0x1e'),_0x0f2a('0x1f')],'where':{'name':_0x226b5f},'limit':0x1}})[_0x0f2a('0x11')](function(_0x3f83b6){logger[_0x0f2a('0x7')](_0x0f2a('0x20'),_0x226b5f,_0x3f83b6?util['inspect'](_0x3f83b6,{'showHidden':![],'depth':null}):'');logger[_0x0f2a('0x6')](_0x0f2a('0x21'),_0x226b5f,_0x3f83b6?_0x0f2a('0x19'):'notfound');return _0x20f1d3(_0x3f83b6[_0x0f2a('0x13')][_0x0f2a('0x14')]?_0x3f83b6[_0x0f2a('0x13')][0x0]:null);})[_0x0f2a('0xc')](function(_0x512d81){logger[_0x0f2a('0x9')]('[utils][getVoiceQueueByName]',_0x512d81?util[_0x0f2a('0x8')](_0x512d81,{'showHidden':![],'depth':null}):'');return _0x20f1d3(null);});}return _0x20f1d3(null);});};exports[_0x0f2a('0x22')]=function(_0x45bcbb,_0x20a1bd){return moment(_0x45bcbb)[_0x0f2a('0x23')](_0x20a1bd,_0x0f2a('0x24'))['format'](_0x0f2a('0x25'));};exports[_0x0f2a('0x26')]=function(_0x12aff2,_0x131063){return moment(_0x12aff2)[_0x0f2a('0x27')](_0x131063,'seconds')['format'](_0x0f2a('0x25'));};exports[_0x0f2a('0x28')]=function(_0x53e672,_0x5c9803){return moment(_0x53e672)[_0x0f2a('0x29')](moment(_0x5c9803),_0x0f2a('0x24'));};exports[_0x0f2a('0x2a')]=function(_0x3b8cad,_0x498bd1){return parseInt(_0x3b8cad,0xa)+parseInt(_0x498bd1,0xa);};exports['now']=function(){return moment()[_0x0f2a('0x2b')](_0x0f2a('0x25'));};exports[_0x0f2a('0x2c')]=function(_0x2fc760,_0x40b5c6){if(_0x40b5c6){return moment(_0x2fc760)[_0x0f2a('0x2c')](_0x40b5c6);}return!![];};exports[_0x0f2a('0x2d')]=function(_0x313464,_0x1d2a52){if(_0x1d2a52){return moment(_0x313464)['isBefore'](_0x1d2a52);}else if(_0x313464){return!![];}return![];}; \ No newline at end of file +var _0x1b42=['getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','isAfter','isBefore','moment','client','http','../../config/logger','xdr','info','inspect','debug','error','request','then','[utils][request]\x20name:%s','catch','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByInterface]','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]'];(function(_0x267cf4,_0xcbcf72){var _0x4824cf=function(_0x3e53d6){while(--_0x3e53d6){_0x267cf4['push'](_0x267cf4['shift']());}};_0x4824cf(++_0xcbcf72);}(_0x1b42,0x1c2));var _0x21b4=function(_0x218601,_0x59f302){_0x218601=_0x218601-0x0;var _0x8a4e68=_0x1b42[_0x218601];return _0x8a4e68;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x21b4('0x0'));var util=require('util');var client=jayson[_0x21b4('0x1')][_0x21b4('0x2')]({'port':0x2329});var logger=require(_0x21b4('0x3'))(_0x21b4('0x4'));exports['info']=function(_0x6faa99,_0x41a087){logger[_0x21b4('0x5')](_0x6faa99,_0x41a087?util[_0x21b4('0x6')](_0x41a087,{'showHidden':![],'depth':null}):'');};exports[_0x21b4('0x7')]=function(_0x49fe71,_0x3509ab){logger[_0x21b4('0x7')](_0x49fe71,_0x3509ab?util['inspect'](_0x3509ab,{'showHidden':![],'depth':null}):'');};exports[_0x21b4('0x8')]=function(_0x2f1849,_0x1b4151){logger[_0x21b4('0x8')](_0x2f1849,_0x1b4151?util['inspect'](_0x1b4151,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x23b7e5,_0x3e5029){return client[_0x21b4('0x9')](_0x23b7e5,{'body':_0x3e5029})[_0x21b4('0xa')](function(_0x396f10){logger['debug'](_0x21b4('0xb'),_0x23b7e5,_0x396f10?util['inspect'](_0x396f10,{'showHidden':![],'depth':null}):'');})[_0x21b4('0xc')](function(_0x2466ed){logger[_0x21b4('0x8')](_0x21b4('0xb'),_0x23b7e5,_0x2466ed?util[_0x21b4('0x6')](_0x2466ed,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1398dc){return client[_0x21b4('0x9')](_0x21b4('0xd'),{'options':{'raw':!![],'attributes':['id',_0x21b4('0xe'),_0x21b4('0xf'),_0x21b4('0x10')],'where':_0x1398dc,'limit':0x1}})[_0x21b4('0xa')](function(_0x462fc6){logger['debug'](_0x21b4('0x11'),JSON[_0x21b4('0x12')](_0x1398dc),_0x462fc6?util[_0x21b4('0x6')](_0x462fc6,{'showHidden':![],'depth':null}):'');return _0x462fc6['result'][_0x21b4('0x13')]?_0x462fc6['result'][0x0]:null;});}exports[_0x21b4('0x14')]=function(_0x29a1c2){return new BPromise(function(_0x1eabd8,_0xb3f4cf){if(_0x29a1c2){return getUser({'internal':_0x29a1c2})[_0x21b4('0xa')](function(_0x2c349a){logger[_0x21b4('0x5')](_0x21b4('0x15'),_0x29a1c2,_0x2c349a?_0x21b4('0x16'):'notfound');return _0x1eabd8(_0x2c349a);})['catch'](function(_0x282514){logger['error'](_0x21b4('0x17'),_0x282514?util[_0x21b4('0x6')](_0x282514,{'showHidden':![],'depth':null}):'');return _0x1eabd8(null);});}return _0x1eabd8(null);});};exports[_0x21b4('0x18')]=function(_0x3efaac){return new BPromise(function(_0x59862a,_0x36f15b){if(_0x3efaac){return getUser({'interface':_0x3efaac})[_0x21b4('0xa')](function(_0x15dea9){logger[_0x21b4('0x5')](_0x21b4('0x19'),_0x3efaac,_0x15dea9?'found':_0x21b4('0x1a'));return _0x59862a(_0x15dea9);})['catch'](function(_0x2a9f34){logger[_0x21b4('0x8')](_0x21b4('0x1b'),_0x2a9f34?util['inspect'](_0x2a9f34,{'showHidden':![],'depth':null}):'');return _0x59862a(null);});}return _0x59862a(null);});};exports['getUserByName']=function(_0x257cf4){return new BPromise(function(_0x5a6176,_0x4350a5){if(_0x257cf4){return getUser({'name':_0x257cf4})[_0x21b4('0xa')](function(_0x36b061){logger[_0x21b4('0x5')](_0x21b4('0x1c'),_0x257cf4,_0x36b061?_0x21b4('0x16'):'notfound');return _0x5a6176(_0x36b061);})[_0x21b4('0xc')](function(_0x3b90d2){logger[_0x21b4('0x8')](_0x21b4('0x1d'),_0x3b90d2?util[_0x21b4('0x6')](_0x3b90d2,{'showHidden':![],'depth':null}):'');return _0x5a6176(null);});}return _0x5a6176(null);});};exports[_0x21b4('0x1e')]=function(_0x60100a){return new BPromise(function(_0x5a9434,_0x1a26b4){if(_0x60100a){return client[_0x21b4('0x9')](_0x21b4('0x1f'),{'options':{'raw':!![],'attributes':['id',_0x21b4('0xf'),_0x21b4('0x20'),_0x21b4('0x21'),_0x21b4('0x22')],'where':{'name':_0x60100a},'limit':0x1}})[_0x21b4('0xa')](function(_0x19e16f){logger[_0x21b4('0x7')](_0x21b4('0x23'),_0x60100a,_0x19e16f?util[_0x21b4('0x6')](_0x19e16f,{'showHidden':![],'depth':null}):'');logger[_0x21b4('0x5')](_0x21b4('0x24'),_0x60100a,_0x19e16f?'found':_0x21b4('0x1a'));return _0x5a9434(_0x19e16f['result'][_0x21b4('0x13')]?_0x19e16f[_0x21b4('0x25')][0x0]:null);})['catch'](function(_0x1d5a23){logger[_0x21b4('0x8')]('[utils][getVoiceQueueByName]',_0x1d5a23?util[_0x21b4('0x6')](_0x1d5a23,{'showHidden':![],'depth':null}):'');return _0x5a9434(null);});}return _0x5a9434(null);});};exports[_0x21b4('0x26')]=function(_0xeb18c8,_0x4af25c){return moment(_0xeb18c8)[_0x21b4('0x27')](_0x4af25c,_0x21b4('0x28'))[_0x21b4('0x29')]('YYYY-MM-DD\x20HH:mm:ss');};exports['subtractTime']=function(_0x18573f,_0x1a18cf){return moment(_0x18573f)['subtract'](_0x1a18cf,_0x21b4('0x28'))[_0x21b4('0x29')](_0x21b4('0x2a'));};exports[_0x21b4('0x2b')]=function(_0xda82ca,_0x270be5){return moment(_0xda82ca)[_0x21b4('0x2c')](moment(_0x270be5),_0x21b4('0x28'));};exports[_0x21b4('0x2d')]=function(_0x5a24f5,_0x29c0fa){return parseInt(_0x5a24f5,0xa)+parseInt(_0x29c0fa,0xa);};exports['now']=function(){return moment()[_0x21b4('0x29')](_0x21b4('0x2a'));};exports[_0x21b4('0x2e')]=function(_0x57ca36,_0x958567){if(_0x958567){return moment(_0x57ca36)[_0x21b4('0x2e')](_0x958567);}return!![];};exports[_0x21b4('0x2f')]=function(_0x56d0db,_0x1b9907){if(_0x1b9907){return moment(_0x56d0db)['isBefore'](_0x1b9907);}else if(_0x56d0db){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 403a2ba..c9f1314 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 _0xa0c4=['maskSensitiveData','join','log','xcally','role','name','then','client','catch','user','data','timestamp','error','auth','set','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','x-forwarded-for','remoteAddress','url','statusCode','responseTime','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','other','agent_name','test','lodash','path','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data'];(function(_0x47302c,_0x5ce3cf){var _0x483028=function(_0x5ab314){while(--_0x5ab314){_0x47302c['push'](_0x47302c['shift']());}};_0x483028(++_0x5ce3cf);}(_0xa0c4,0x118));var _0x4a0c=function(_0x4a9b6a,_0x5cb8fc){_0x4a9b6a=_0x4a9b6a-0x0;var _0x305551=_0xa0c4[_0x4a9b6a];return _0x305551;};var fs=require('fs-extra');var _=require(_0x4a0c('0x0'));var ewinston=require('express-winston');var path=require(_0x4a0c('0x1'));var util=require('util');var fileLogger=require(_0x4a0c('0x2'))[_0x4a0c('0x3')];var safeTemplate=require(_0x4a0c('0x4'))[_0x4a0c('0x5')];var maskSensitiveData=require(_0x4a0c('0x6'))[_0x4a0c('0x7')];function ClientSideLogger(){function _0x52e5e2(_0x22f7ea){var _0x19ba5a=path[_0x4a0c('0x8')]('/var',_0x4a0c('0x9'),_0x4a0c('0xa'));var _0x19239e=path[_0x4a0c('0x8')]('client',_0x22f7ea[_0x4a0c('0xb')]+'-'+_0x22f7ea[_0x4a0c('0xc')]);return fs['ensureDir'](path[_0x4a0c('0x8')](_0x19ba5a,_0x19239e))[_0x4a0c('0xd')](function(){var _0x2764bf=fileLogger(_0x4a0c('0xe'),path['join'](_0x19ba5a,_0x19239e));return _0x2764bf;})[_0x4a0c('0xf')](function(_0x1aeddb){throw _0x1aeddb;});}this[_0x4a0c('0x9')]=function(_0x522387,_0x2e4ccd,_0x139e76,_0x3821a8){return _0x52e5e2(_0x522387[_0x4a0c('0x10')])[_0x4a0c('0xd')](function(_0x349399){var _0x1a4741=_0x349399[_0x2e4ccd];return _0x1a4741;})[_0x4a0c('0xd')](function(_0x4c3561){var _0x1b432f=_0x522387['user']?_0x522387['user']['id']:'no-user';var _0x12f449=_0x3821a8[_0x4a0c('0x11')];var _0xcf2846=_0x3821a8[_0x4a0c('0x12')];var _0x57fe81=new Date(Number(_0xcf2846));return _0x4c3561(_0x1b432f,_0x57fe81,_0x139e76,_0x12f449);})[_0x4a0c('0xf')](function(_0x138786){fileLogger('client')[_0x4a0c('0x13')](_0x138786);});};}function setupLoggers(_0xa421d8){return new Promise(function(_0x4f4156){var _0x4c57a6=new ClientSideLogger();var _0x2ec2a1=fileLogger('api');var _0x59c30d=fileLogger(_0x4a0c('0x14'));_0xa421d8[_0x4a0c('0x15')]('client-side-logger',_0x4c57a6);_0xa421d8[_0x4a0c('0x16')](ewinston[_0x4a0c('0x17')]({'winstonInstance':_0x2ec2a1,'meta':![],'statusLevels':!![],'msg':function(_0x563c3d,_0x28a92b){var _0x39fa77=_0x4a0c('0x18');if(!_[_0x4a0c('0x19')](_0x563c3d[_0x4a0c('0x1a')])){_0x39fa77+=_0x4a0c('0x1b');var _0x2c2dc1=_0x563c3d[_0x4a0c('0x1a')];maskSensitiveData(_0x2c2dc1);}return safeTemplate(util[_0x4a0c('0x1c')](_0x39fa77,_0x563c3d[_0x4a0c('0x1d')],_0x563c3d['headers']['x-forwarded-for']?_0x563c3d['headers'][_0x4a0c('0x1e')]:_0x563c3d['connection'][_0x4a0c('0x1f')]||_0x563c3d['ip'],_0x563c3d[_0x4a0c('0x20')],_0x28a92b[_0x4a0c('0x21')],_0x28a92b[_0x4a0c('0x22')],_0x563c3d[_0x4a0c('0x10')]?_0x563c3d[_0x4a0c('0x10')]['id']:null,_0x563c3d['user']?_0x563c3d[_0x4a0c('0x10')][_0x4a0c('0xc')]:null,_0x563c3d[_0x4a0c('0x10')]?_0x563c3d[_0x4a0c('0x10')][_0x4a0c('0xb')]:null,_0x2c2dc1?util['inspect'](_0x2c2dc1,![],null):''));}}));_0xa421d8[_0x4a0c('0x16')](ewinston[_0x4a0c('0x17')]({'winstonInstance':_0x59c30d,'meta':![],'statusLevels':!![],'msg':function(_0x17be85,_0x354bfa){var _0x1b64db=_0x4a0c('0x23');if(_0x17be85['body']&&_0x17be85['body'][_0x4a0c('0x24')]&&_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x25')]){_0x1b64db='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x4a0c('0x1c')](_0x1b64db,_0x17be85[_0x4a0c('0x1d')],_0x17be85['headers'][_0x4a0c('0x1e')]?_0x17be85['headers']['x-forwarded-for']:_0x17be85['connection'][_0x4a0c('0x1f')]||_0x17be85['ip'],_0x17be85['url'],_0x354bfa[_0x4a0c('0x21')],_0x354bfa[_0x4a0c('0x22')],_0x17be85[_0x4a0c('0x10')]?_0x17be85[_0x4a0c('0x10')]['id']:null,_0x17be85[_0x4a0c('0x10')]?_0x17be85['user'][_0x4a0c('0xc')]:null,_0x17be85[_0x4a0c('0x10')]?_0x17be85[_0x4a0c('0x10')][_0x4a0c('0xb')]:null,_0x17be85['body']&&_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x24')]?_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x24')]:_0x4a0c('0x26'),_0x17be85[_0x4a0c('0x1a')]&&_0x17be85[_0x4a0c('0x1a')]['agent_id']?_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x25')]:'',_0x17be85['body']&&_0x17be85[_0x4a0c('0x1a')][_0x4a0c('0x27')]?_0x17be85[_0x4a0c('0x1a')]['agent_name']:'');},'ignoreRoute':function(_0x6574d0){var _0x5be06e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x5be06e[_0x4a0c('0x28')](_0x6574d0[_0x4a0c('0x20')]);}}));return _0x4f4156();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file +var _0x47a2=['remoteAddress','agent_id','agent_name','setupLoggers','util','./loggers','fileLogger','./safe-template','safeTemplate','maskSensitiveData','join','log','xcally','client','name','then','user','no-user','data','timestamp','error','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','x-forwarded-for','headers','connection','url','statusCode','responseTime','role','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)'];(function(_0x3b8499,_0x44020a){var _0x1eb32f=function(_0x9de490){while(--_0x9de490){_0x3b8499['push'](_0x3b8499['shift']());}};_0x1eb32f(++_0x44020a);}(_0x47a2,0x85));var _0x247a=function(_0x17e005,_0x961d3){_0x17e005=_0x17e005-0x0;var _0x6d0f1a=_0x47a2[_0x17e005];return _0x6d0f1a;};var fs=require('fs-extra');var _=require('lodash');var ewinston=require('express-winston');var path=require('path');var util=require(_0x247a('0x0'));var fileLogger=require(_0x247a('0x1'))[_0x247a('0x2')];var safeTemplate=require(_0x247a('0x3'))[_0x247a('0x4')];var maskSensitiveData=require('./mask-sensitive-data')[_0x247a('0x5')];function ClientSideLogger(){function _0x443ae6(_0x171a78){var _0x1c0123=path[_0x247a('0x6')]('/var',_0x247a('0x7'),_0x247a('0x8'));var _0x7818e9=path[_0x247a('0x6')](_0x247a('0x9'),_0x171a78['role']+'-'+_0x171a78[_0x247a('0xa')]);return fs['ensureDir'](path['join'](_0x1c0123,_0x7818e9))['then'](function(){var _0x28c78f=fileLogger(_0x247a('0x9'),path[_0x247a('0x6')](_0x1c0123,_0x7818e9));return _0x28c78f;})['catch'](function(_0x45e039){throw _0x45e039;});}this[_0x247a('0x7')]=function(_0x1ae8cf,_0x1543be,_0x180f27,_0x3f5951){return _0x443ae6(_0x1ae8cf['user'])[_0x247a('0xb')](function(_0x314e04){var _0x138c7b=_0x314e04[_0x1543be];return _0x138c7b;})[_0x247a('0xb')](function(_0x272e07){var _0x46a7c1=_0x1ae8cf[_0x247a('0xc')]?_0x1ae8cf[_0x247a('0xc')]['id']:_0x247a('0xd');var _0x6da076=_0x3f5951[_0x247a('0xe')];var _0x163ada=_0x3f5951[_0x247a('0xf')];var _0xb1fe45=new Date(Number(_0x163ada));return _0x272e07(_0x46a7c1,_0xb1fe45,_0x180f27,_0x6da076);})['catch'](function(_0x41a967){fileLogger(_0x247a('0x9'))[_0x247a('0x10')](_0x41a967);});};}function setupLoggers(_0x375480){return new Promise(function(_0x41e718){var _0x205d98=new ClientSideLogger();var _0x2bedd4=fileLogger('api');var _0x4dc2d2=fileLogger(_0x247a('0x11'));_0x375480[_0x247a('0x12')](_0x247a('0x13'),_0x205d98);_0x375480[_0x247a('0x14')](ewinston[_0x247a('0x15')]({'winstonInstance':_0x2bedd4,'meta':![],'statusLevels':!![],'msg':function(_0x47fc3f,_0x3eb55e){var _0x38877c=_0x247a('0x16');if(!_[_0x247a('0x17')](_0x47fc3f['body'])){_0x38877c+=_0x247a('0x18');var _0x287c99=_0x47fc3f[_0x247a('0x19')];maskSensitiveData(_0x287c99);}return safeTemplate(util[_0x247a('0x1a')](_0x38877c,_0x47fc3f[_0x247a('0x1b')],_0x47fc3f['headers'][_0x247a('0x1c')]?_0x47fc3f[_0x247a('0x1d')][_0x247a('0x1c')]:_0x47fc3f[_0x247a('0x1e')]['remoteAddress']||_0x47fc3f['ip'],_0x47fc3f[_0x247a('0x1f')],_0x3eb55e[_0x247a('0x20')],_0x3eb55e[_0x247a('0x21')],_0x47fc3f[_0x247a('0xc')]?_0x47fc3f['user']['id']:null,_0x47fc3f['user']?_0x47fc3f[_0x247a('0xc')]['name']:null,_0x47fc3f[_0x247a('0xc')]?_0x47fc3f['user'][_0x247a('0x22')]:null,_0x287c99?util[_0x247a('0x23')](_0x287c99,![],null):''));}}));_0x375480[_0x247a('0x14')](ewinston[_0x247a('0x15')]({'winstonInstance':_0x4dc2d2,'meta':![],'statusLevels':!![],'msg':function(_0x1445d1,_0x306371){var _0x47e3a4=_0x247a('0x24');if(_0x1445d1[_0x247a('0x19')]&&_0x1445d1[_0x247a('0x19')][_0x247a('0x25')]&&_0x1445d1['body']['agent_id']){_0x47e3a4=_0x247a('0x26');}return util['format'](_0x47e3a4,_0x1445d1[_0x247a('0x1b')],_0x1445d1[_0x247a('0x1d')][_0x247a('0x1c')]?_0x1445d1['headers'][_0x247a('0x1c')]:_0x1445d1[_0x247a('0x1e')][_0x247a('0x27')]||_0x1445d1['ip'],_0x1445d1[_0x247a('0x1f')],_0x306371[_0x247a('0x20')],_0x306371[_0x247a('0x21')],_0x1445d1['user']?_0x1445d1[_0x247a('0xc')]['id']:null,_0x1445d1['user']?_0x1445d1['user']['name']:null,_0x1445d1[_0x247a('0xc')]?_0x1445d1[_0x247a('0xc')][_0x247a('0x22')]:null,_0x1445d1['body']&&_0x1445d1['body']['device']?_0x1445d1[_0x247a('0x19')]['device']:'other',_0x1445d1[_0x247a('0x19')]&&_0x1445d1[_0x247a('0x19')]['agent_id']?_0x1445d1[_0x247a('0x19')][_0x247a('0x28')]:'',_0x1445d1[_0x247a('0x19')]&&_0x1445d1['body'][_0x247a('0x29')]?_0x1445d1[_0x247a('0x19')]['agent_name']:'');},'ignoreRoute':function(_0x1c0352){var _0x45fe40=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x45fe40['test'](_0x1c0352['url']);}}));return _0x41e718();});}exports[_0x247a('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 4a642a4..6db1aa4 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc567=['isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','circularMonthInterval','clone','minutes','hours','isBefore','startOf','day','isBetween','timeCompare','format','dowCompare','daysInMonth','min','max','MMM','includes','monthCompare','test','isMoment','length','padStart','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid'];(function(_0x1992f1,_0x5c61f0){var _0x413dfe=function(_0x2136e5){while(--_0x2136e5){_0x1992f1['push'](_0x1992f1['shift']());}};_0x413dfe(++_0x5c61f0);}(_0xc567,0x71));var _0x7c56=function(_0xbbf129,_0x37ac07){_0xbbf129=_0xbbf129-0x0;var _0x2a1c83=_0xc567[_0xbbf129];return _0x2a1c83;};var _=require(_0x7c56('0x0'));var moment=require(_0x7c56('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x7c56('0x2')](function(_0x3b3779){return _0x3b3779[_0x7c56('0x3')];})[_0x7c56('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x7c56('0x5');var EINVALID_DATE=_0x7c56('0x6');function throwIfDateNotValid(_0x6715df){if(!_0x6715df[_0x7c56('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x1d6036){var _0x5b4818=_0x1d6036[_0x7c56('0x8')](':')['map'](function(_0x221224){return parseInt(_0x221224,0xa);});var _0x344ac3=_0x5b4818[0x0];var _0x4dcf83=_0x5b4818[0x1];if(_0x344ac3<0x0||_0x344ac3>0x17||_0x4dcf83<0x0||_0x4dcf83>0x3b){throw new Error(EINVALID_DATE);}return[_0x344ac3,_0x4dcf83];}function circularDoWInterval(_0x2aa782,_0x25342a){if(_0x2aa782===_0x25342a){return[_0x2aa782];}else{var _0x5c0f4e=moment[_0x7c56('0x9')]();moment['locale']('en');var _0x5ba772=moment[_0x7c56('0xa')]()[_0x7c56('0x2')](function(_0x34ffa1){return _0x34ffa1[_0x7c56('0xb')]();});moment['locale'](_0x5c0f4e);var _0x409d29=_0x5ba772[_0x7c56('0xc')](_0x2aa782);var _0x4bd592=_0x5ba772[_0x7c56('0xc')](_0x25342a);if(_0x4bd592>_0x409d29){return _0x5ba772[_0x7c56('0xd')](_0x409d29,_0x4bd592+0x1);}else{var _0x1d65b7=_0x5ba772[_0x7c56('0xd')](0x0,_0x4bd592+0x1);var _0x3b2511=_0x5ba772[_0x7c56('0xd')](_0x409d29);return _0x3b2511[_0x7c56('0xe')](_0x1d65b7);}}}module[_0x7c56('0xf')][_0x7c56('0x10')]=circularDoWInterval;function circularMonthInterval(_0x1207da,_0x197553){if(_0x1207da===_0x197553){return[_0x1207da];}else{var _0xf2b418=moment[_0x7c56('0x9')]();moment[_0x7c56('0x9')]('en');var _0x3098e8=moment[_0x7c56('0x11')]()['map'](function(_0x2fa4b0){return _0x2fa4b0['toLowerCase']();});moment[_0x7c56('0x9')](_0xf2b418);var _0x5a978c=_0x3098e8[_0x7c56('0xc')](_0x1207da);var _0x59a0e7=_0x3098e8[_0x7c56('0xc')](_0x197553);if(_0x59a0e7>_0x5a978c){return _0x3098e8['slice'](_0x5a978c,_0x59a0e7+0x1);}else{var _0x383a4b=_0x3098e8[_0x7c56('0xd')](0x0,_0x59a0e7+0x1);var _0x51f0ee=_0x3098e8[_0x7c56('0xd')](_0x5a978c);return _0x51f0ee[_0x7c56('0xe')](_0x383a4b);}}}module[_0x7c56('0xf')][_0x7c56('0x12')]=circularMonthInterval;function parseDom(_0x1d8d30){var _0x1ad578=parseInt(_0x1d8d30,0xa);if(_0x1ad578<0x1||_0x1ad578>0x1f){throw new Error(EINVALID_DATE);}return _0x1ad578;}function timeCompare(_0x52a481,_0x21ccf3,_0xd93e05){var _0x1b45b6=_0x52a481['clone']();var _0x10901e=extractTime(_0x21ccf3);var _0x3b9191=_0x10901e[0x0];var _0x2d2721=_0x10901e[0x1];var _0x31b047=_0x52a481[_0x7c56('0x13')]()['hours'](_0x3b9191)[_0x7c56('0x14')](_0x2d2721);throwIfDateNotValid(_0x31b047);var _0x348f60=extractTime(_0xd93e05);var _0xb70611=_0x348f60[0x0];var _0x415608=_0x348f60[0x1];var _0x2f1728=_0x52a481[_0x7c56('0x13')]()[_0x7c56('0x15')](_0xb70611)[_0x7c56('0x14')](_0x415608);throwIfDateNotValid(_0x2f1728);if(_0x2f1728[_0x7c56('0x16')](_0x31b047)){var _0xbeb90a=_0x1b45b6[_0x7c56('0x13')]()[_0x7c56('0x17')](_0x7c56('0x18'));var _0x57b022=_0x1b45b6[_0x7c56('0x13')]()['endOf']('day');return _0x1b45b6['isBetween'](_0x31b047,_0x57b022,undefined,'[]')||_0x1b45b6[_0x7c56('0x19')](_0xbeb90a,_0x2f1728,undefined,'[]');}else{return _0x1b45b6['isBetween'](_0x31b047,_0x2f1728,undefined,'[]');}}module[_0x7c56('0xf')][_0x7c56('0x1a')]=timeCompare;function dowCompare(_0x2969fe,_0x212779,_0x1dadf6){var _0xdb3e98=_0x2969fe[_0x7c56('0x9')]('en')[_0x7c56('0x1b')]('ddd')['toLowerCase']();return circularDoWInterval(_0x212779,_0x1dadf6)['includes'](_0xdb3e98);}module[_0x7c56('0xf')][_0x7c56('0x1c')]=dowCompare;function domCompare(_0x5c2091,_0x560741,_0x3fbe1a){var _0x124cb1=_0x5c2091['date']();if(_0x560741===_0x3fbe1a){return _0x124cb1===_0x560741;}else{var _0x361157=_0x5c2091[_0x7c56('0x1d')]();var _0x2893ca=_0x560741<_0x3fbe1a;let _0x3ec895=![];var _0x475c0b=0x0;var _0x250616=0x0;if(_0x2893ca){_0x475c0b=Math['max'](0x1,_0x560741);_0x250616=Math[_0x7c56('0x1e')](_0x3fbe1a,_0x361157);_0x3ec895=_0x124cb1>=_0x475c0b&&_0x124cb1<=_0x250616;}else{_0x475c0b=Math[_0x7c56('0x1e')](_0x560741,_0x361157);_0x250616=Math[_0x7c56('0x1f')](0x1,_0x3fbe1a);_0x3ec895=_0x124cb1>=_0x475c0b||_0x124cb1<=_0x250616;}return _0x3ec895;}}module[_0x7c56('0xf')]['domCompare']=domCompare;function monthCompare(_0x2ae523,_0x207928,_0x263fec){var _0x39d999=_0x2ae523[_0x7c56('0x9')]('en')['format'](_0x7c56('0x20'))[_0x7c56('0xb')]();return circularMonthInterval(_0x207928,_0x263fec)[_0x7c56('0x21')](_0x39d999);}module[_0x7c56('0xf')][_0x7c56('0x22')]=monthCompare;function iftime(_0xd5abed,_0x660671=moment['tz']['guess'](),_0x3d36d7=moment()){if(!validateRx[_0x7c56('0x23')](_0xd5abed)){throw new Error(EINVALID_STRING);}else{var _0x38f781=(moment[_0x7c56('0x24')](_0x3d36d7)?_0x3d36d7['clone']():moment(_0x3d36d7))['tz'](_0x660671)['locale']('en');throwIfDateNotValid(_0x38f781);var _0x543048=_0xd5abed['split'](',');var _0x20d5b1=_0x543048[0x0];var _0x2a5b9d=_0x543048[0x1];var _0x2a2f92=_0x543048[0x2];var _0x47565d=_0x543048[0x3];let _0x52597d=!![];if(_0x20d5b1!=='*'){var _0x168588=_0x20d5b1[_0x7c56('0x8')]('-');var _0xa22da7=_['padStart'](_0x168588[0x0],0x5,'0');var _0x3952dc=_0x168588[_0x7c56('0x25')]===0x2?_[_0x7c56('0x26')](_0x168588[0x1],0x5,'0'):_0xa22da7;_0x52597d=timeCompare(_0x38f781,_0xa22da7,_0x3952dc);}let _0x1b4c1e=!![];if(_0x2a5b9d!=='*'){var _0x1c8113=_0x2a5b9d[_0x7c56('0x8')]('-');var _0x3aacde=_0x1c8113[0x0];var _0x1124ce=_0x1c8113[_0x7c56('0x25')]===0x2?_0x1c8113[0x1]:_0x3aacde;_0x1b4c1e=dowCompare(_0x38f781,_0x3aacde,_0x1124ce);}let _0x318dff=!![];if(_0x2a2f92!=='*'){var _0x15e1db=_0x2a2f92[_0x7c56('0x8')]('-');var _0xae3d2a=parseDom(_0x15e1db[0x0]);var _0x3e8dd1=_0x15e1db['length']===0x2?parseDom(_0x15e1db[0x1]):_0xae3d2a;_0x318dff=domCompare(_0x38f781,_0xae3d2a,_0x3e8dd1);}let _0x2adf2f=!![];if(_0x47565d!=='*'){var _0x5337d4=_0x47565d[_0x7c56('0x8')]('-');var _0x296334=_0x5337d4[0x0];var _0x2e7043=_0x5337d4[_0x7c56('0x25')]===0x2?_0x5337d4[0x1]:_0x5337d4[0x0];_0x2adf2f=monthCompare(_0x38f781,_0x296334,_0x2e7043);}return _0x52597d&&_0x1b4c1e&&_0x318dff&&_0x2adf2f;}}module[_0x7c56('0xf')][_0x7c56('0x27')]=iftime; \ No newline at end of file +var _0xbd7b=['lodash','moment-timezone','map','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','circularDoWInterval','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','isBetween','timeCompare','format','ddd','dowCompare','date','min','max','domCompare','includes','monthCompare','guess','isMoment','padStart','length','iftime'];(function(_0x3ec0b8,_0x2457dd){var _0x2688f0=function(_0x257893){while(--_0x257893){_0x3ec0b8['push'](_0x3ec0b8['shift']());}};_0x2688f0(++_0x2457dd);}(_0xbd7b,0xa0));var _0xbbd7=function(_0x53ab1b,_0x52355b){_0x53ab1b=_0x53ab1b-0x0;var _0x5d2916=_0xbd7b[_0x53ab1b];return _0x5d2916;};var _=require(_0xbbd7('0x0'));var moment=require(_0xbbd7('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xbbd7('0x2')](function(_0x43c4cf){return _0x43c4cf[_0xbbd7('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xbbd7('0x4');var EINVALID_DATE=_0xbbd7('0x5');function throwIfDateNotValid(_0x22fa9b){if(!_0x22fa9b[_0xbbd7('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x37f16a){var _0x1e527c=_0x37f16a[_0xbbd7('0x7')](':')[_0xbbd7('0x2')](function(_0x1d1e13){return parseInt(_0x1d1e13,0xa);});var _0x443126=_0x1e527c[0x0];var _0x203956=_0x1e527c[0x1];if(_0x443126<0x0||_0x443126>0x17||_0x203956<0x0||_0x203956>0x3b){throw new Error(EINVALID_DATE);}return[_0x443126,_0x203956];}function circularDoWInterval(_0x261782,_0x281f5f){if(_0x261782===_0x281f5f){return[_0x261782];}else{var _0x49665e=moment['locale']();moment[_0xbbd7('0x8')]('en');var _0x1df593=moment[_0xbbd7('0x9')]()['map'](function(_0x34b76f){return _0x34b76f[_0xbbd7('0xa')]();});moment['locale'](_0x49665e);var _0xca39f=_0x1df593[_0xbbd7('0xb')](_0x261782);var _0x2c77b6=_0x1df593[_0xbbd7('0xb')](_0x281f5f);if(_0x2c77b6>_0xca39f){return _0x1df593[_0xbbd7('0xc')](_0xca39f,_0x2c77b6+0x1);}else{var _0xf13acc=_0x1df593[_0xbbd7('0xc')](0x0,_0x2c77b6+0x1);var _0x2f5b38=_0x1df593['slice'](_0xca39f);return _0x2f5b38[_0xbbd7('0xd')](_0xf13acc);}}}module['exports'][_0xbbd7('0xe')]=circularDoWInterval;function circularMonthInterval(_0x2078f2,_0x48d53a){if(_0x2078f2===_0x48d53a){return[_0x2078f2];}else{var _0x25a51f=moment[_0xbbd7('0x8')]();moment[_0xbbd7('0x8')]('en');var _0x51a276=moment[_0xbbd7('0xf')]()['map'](function(_0x529f9d){return _0x529f9d[_0xbbd7('0xa')]();});moment[_0xbbd7('0x8')](_0x25a51f);var _0x32b72b=_0x51a276[_0xbbd7('0xb')](_0x2078f2);var _0xfdf299=_0x51a276[_0xbbd7('0xb')](_0x48d53a);if(_0xfdf299>_0x32b72b){return _0x51a276['slice'](_0x32b72b,_0xfdf299+0x1);}else{var _0x568264=_0x51a276[_0xbbd7('0xc')](0x0,_0xfdf299+0x1);var _0x51b376=_0x51a276[_0xbbd7('0xc')](_0x32b72b);return _0x51b376['concat'](_0x568264);}}}module[_0xbbd7('0x10')][_0xbbd7('0x11')]=circularMonthInterval;function parseDom(_0x5c6aed){var _0x1d5409=parseInt(_0x5c6aed,0xa);if(_0x1d5409<0x1||_0x1d5409>0x1f){throw new Error(EINVALID_DATE);}return _0x1d5409;}function timeCompare(_0x26562b,_0x478612,_0x497afe){var _0x57d245=_0x26562b[_0xbbd7('0x12')]();var _0x2db96f=extractTime(_0x478612);var _0x3682e1=_0x2db96f[0x0];var _0x28945a=_0x2db96f[0x1];var _0x122d14=_0x26562b[_0xbbd7('0x12')]()[_0xbbd7('0x13')](_0x3682e1)['minutes'](_0x28945a);throwIfDateNotValid(_0x122d14);var _0x2e8fa7=extractTime(_0x497afe);var _0x4bf000=_0x2e8fa7[0x0];var _0x598332=_0x2e8fa7[0x1];var _0x4f1f07=_0x26562b[_0xbbd7('0x12')]()[_0xbbd7('0x13')](_0x4bf000)[_0xbbd7('0x14')](_0x598332);throwIfDateNotValid(_0x4f1f07);if(_0x4f1f07[_0xbbd7('0x15')](_0x122d14)){var _0x3d64e8=_0x57d245[_0xbbd7('0x12')]()[_0xbbd7('0x16')]('day');var _0x524dd6=_0x57d245[_0xbbd7('0x12')]()[_0xbbd7('0x17')]('day');return _0x57d245[_0xbbd7('0x18')](_0x122d14,_0x524dd6,undefined,'[]')||_0x57d245['isBetween'](_0x3d64e8,_0x4f1f07,undefined,'[]');}else{return _0x57d245[_0xbbd7('0x18')](_0x122d14,_0x4f1f07,undefined,'[]');}}module['exports'][_0xbbd7('0x19')]=timeCompare;function dowCompare(_0x19e79,_0x123fdb,_0x2e6a2e){var _0x1e0bdf=_0x19e79[_0xbbd7('0x8')]('en')[_0xbbd7('0x1a')](_0xbbd7('0x1b'))[_0xbbd7('0xa')]();return circularDoWInterval(_0x123fdb,_0x2e6a2e)['includes'](_0x1e0bdf);}module[_0xbbd7('0x10')][_0xbbd7('0x1c')]=dowCompare;function domCompare(_0x26ebb2,_0x527728,_0x13b784){var _0x367389=_0x26ebb2[_0xbbd7('0x1d')]();if(_0x527728===_0x13b784){return _0x367389===_0x527728;}else{var _0xb62e67=_0x26ebb2['daysInMonth']();var _0x3c2495=_0x527728<_0x13b784;let _0x1435cf=![];var _0xb2b80f=0x0;var _0x22bb80=0x0;if(_0x3c2495){_0xb2b80f=Math['max'](0x1,_0x527728);_0x22bb80=Math[_0xbbd7('0x1e')](_0x13b784,_0xb62e67);_0x1435cf=_0x367389>=_0xb2b80f&&_0x367389<=_0x22bb80;}else{_0xb2b80f=Math[_0xbbd7('0x1e')](_0x527728,_0xb62e67);_0x22bb80=Math[_0xbbd7('0x1f')](0x1,_0x13b784);_0x1435cf=_0x367389>=_0xb2b80f||_0x367389<=_0x22bb80;}return _0x1435cf;}}module['exports'][_0xbbd7('0x20')]=domCompare;function monthCompare(_0x193411,_0x5eba75,_0xa0dabe){var _0xb1d8c=_0x193411[_0xbbd7('0x8')]('en')[_0xbbd7('0x1a')]('MMM')[_0xbbd7('0xa')]();return circularMonthInterval(_0x5eba75,_0xa0dabe)[_0xbbd7('0x21')](_0xb1d8c);}module['exports'][_0xbbd7('0x22')]=monthCompare;function iftime(_0x3510aa,_0x2717a1=moment['tz'][_0xbbd7('0x23')](),_0x2fd30d=moment()){if(!validateRx['test'](_0x3510aa)){throw new Error(EINVALID_STRING);}else{var _0x37b31f=(moment[_0xbbd7('0x24')](_0x2fd30d)?_0x2fd30d[_0xbbd7('0x12')]():moment(_0x2fd30d))['tz'](_0x2717a1)['locale']('en');throwIfDateNotValid(_0x37b31f);var _0x5c2bca=_0x3510aa[_0xbbd7('0x7')](',');var _0x3f78c4=_0x5c2bca[0x0];var _0x4d7288=_0x5c2bca[0x1];var _0x38a04f=_0x5c2bca[0x2];var _0x152833=_0x5c2bca[0x3];let _0x3aef0b=!![];if(_0x3f78c4!=='*'){var _0x2b0c48=_0x3f78c4[_0xbbd7('0x7')]('-');var _0xc71df1=_[_0xbbd7('0x25')](_0x2b0c48[0x0],0x5,'0');var _0x48c904=_0x2b0c48['length']===0x2?_['padStart'](_0x2b0c48[0x1],0x5,'0'):_0xc71df1;_0x3aef0b=timeCompare(_0x37b31f,_0xc71df1,_0x48c904);}let _0x5c30ae=!![];if(_0x4d7288!=='*'){var _0x1e2b98=_0x4d7288[_0xbbd7('0x7')]('-');var _0xbdad2b=_0x1e2b98[0x0];var _0x56848d=_0x1e2b98[_0xbbd7('0x26')]===0x2?_0x1e2b98[0x1]:_0xbdad2b;_0x5c30ae=dowCompare(_0x37b31f,_0xbdad2b,_0x56848d);}let _0x467941=!![];if(_0x38a04f!=='*'){var _0x3d5a21=_0x38a04f['split']('-');var _0x245346=parseDom(_0x3d5a21[0x0]);var _0x389806=_0x3d5a21[_0xbbd7('0x26')]===0x2?parseDom(_0x3d5a21[0x1]):_0x245346;_0x467941=domCompare(_0x37b31f,_0x245346,_0x389806);}let _0x24ecb7=!![];if(_0x152833!=='*'){var _0xde4f44=_0x152833[_0xbbd7('0x7')]('-');var _0x1803c1=_0xde4f44[0x0];var _0x21363d=_0xde4f44[_0xbbd7('0x26')]===0x2?_0xde4f44[0x1]:_0xde4f44[0x0];_0x24ecb7=monthCompare(_0x37b31f,_0x1803c1,_0x21363d);}return _0x3aef0b&&_0x5c30ae&&_0x467941&&_0x24ecb7;}}module['exports'][_0xbbd7('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 1d2b36a..dfb8b3c 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee6a=['../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','format','toUpperCase','}}}','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','YYYY-MM-DD\x20HH:mm:ss','Logger','transports','Console','warn','error','File','%s-%s','path','moment','winston'];(function(_0x4ec043,_0x2f109f){var _0x1b208c=function(_0x315476){while(--_0x315476){_0x4ec043['push'](_0x4ec043['shift']());}};_0x1b208c(++_0x2f109f);}(_0xee6a,0x9d));var _0xaee6=function(_0x5a3bb8,_0x278e56){_0x5a3bb8=_0x5a3bb8-0x0;var _0x4e259e=_0xee6a[_0x5a3bb8];return _0x4e259e;};'use strict';var path=require(_0xaee6('0x0'));var util=require('util');var moment=require(_0xaee6('0x1'));var winston=require(_0xaee6('0x2'));var config=require(_0xaee6('0x3'));var debugLevel=config[_0xaee6('0x4')]?config[_0xaee6('0x4')][_0xaee6('0x5')]():_0xaee6('0x6');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':_0xaee6('0x7'),'error':_0xaee6('0x8'),'warn':_0xaee6('0x9'),'info':_0xaee6('0xa'),'print':_0xaee6('0xb'),'success':_0xaee6('0xc'),'http':_0xaee6('0xd'),'verbose':_0xaee6('0xe'),'debug':_0xaee6('0xf'),'silly':_0xaee6('0x10')};winston[_0xaee6('0x11')](XC_LOG_COLORS);function getLogFileName(_0x3d966a,_0x17f69b,_0x5011cf){var _0xfaa7a5=_0x3d966a||_0xaee6('0x12');return path[_0xaee6('0x13')](_0xfaa7a5,util['format'](_0xaee6('0x14'),_0x17f69b,_0x5011cf));}function formatter(_0x4aeddb,_0x331cac){_0x331cac[_0xaee6('0x15')]=_0x331cac[_0xaee6('0x15')][_0xaee6('0x16')](/@@{/g,_0xaee6('0x17'))['replace'](/}@@/g,'}}}')[_0xaee6('0x16')](/@{/g,'{{')[_0xaee6('0x16')](/}@/g,'}}');return util['format'](_0xaee6('0x18'),moment()[_0xaee6('0x19')]('YYYY-MM-DD\x20HH:mm:ss'),_0x331cac['level'][_0xaee6('0x1a')](),_0x4aeddb,_0x331cac[_0xaee6('0x15')]);}function fileFormat(_0x2d7d18,_0x468d09){_0x468d09[_0xaee6('0x15')]=_0x468d09[_0xaee6('0x15')][_0xaee6('0x16')](/@@{/g,'{{{')[_0xaee6('0x16')](/}@@/g,_0xaee6('0x1b'))[_0xaee6('0x16')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1d89ec=_0x468d09[_0xaee6('0x1c')]&&Object['keys'](_0x468d09['meta'])[_0xaee6('0x1d')]?'\x0a\x09'+JSON[_0xaee6('0x1e')](_0x468d09[_0xaee6('0x1c')]):'';return util['format'](_0xaee6('0x1f'),moment()[_0xaee6('0x19')](_0xaee6('0x20')),_0x468d09['level'][_0xaee6('0x1a')](),_0x2d7d18,_0x468d09['message'],_0x1d89ec);}function consoleLogger(){var _0x4c060b=new winston[(_0xaee6('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xaee6('0x22'))][(_0xaee6('0x23'))]({'level':_0xaee6('0x24'),'json':![],'formatter':function(_0x1de5a6){return formatter('',_0x1de5a6);}})]});return _0x4c060b;}function fileLogger(_0x551033,_0x426c79){var _0x28749d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xaee6('0x22'))]['File']({'name':util[_0xaee6('0x19')]('%s-%s',_0x551033,_0xaee6('0x25')),'filename':getLogFileName(_0x426c79,_0x551033,_0xaee6('0x25')),'level':_0xaee6('0x25'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4d7dfd){return fileFormat(_0x551033,_0x4d7dfd);}}),new winston['transports'][(_0xaee6('0x26'))]({'name':util[_0xaee6('0x19')](_0xaee6('0x27'),_0x551033,debugLevel),'filename':getLogFileName(_0x426c79,_0x551033,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4c96c1){return fileFormat(_0x551033,_0x4c96c1);}}),new winston[(_0xaee6('0x22'))]['Console']({'level':_0xaee6('0x24'),'json':![],'formatter':function(_0x4d8527){return fileFormat(_0x551033,_0x4d8527);}})]});return _0x28749d;}exports['consoleLogger']=consoleLogger;exports['fileLogger']=fileLogger; \ No newline at end of file +var _0x9eab=['white','bold\x20white','bold\x20green','gray','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','length','stringify','Logger','transports','File','error','%s-%s','Console','warn','consoleLogger','fileLogger','path','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow'];(function(_0x3f0dbb,_0x51d879){var _0x39e977=function(_0x15da8b){while(--_0x15da8b){_0x3f0dbb['push'](_0x3f0dbb['shift']());}};_0x39e977(++_0x51d879);}(_0x9eab,0xbd));var _0xb9ea=function(_0x527b82,_0x2cb813){_0x527b82=_0x527b82-0x0;var _0x1ab989=_0x9eab[_0x527b82];return _0x1ab989;};'use strict';var path=require(_0xb9ea('0x0'));var util=require(_0xb9ea('0x1'));var moment=require(_0xb9ea('0x2'));var winston=require(_0xb9ea('0x3'));var config=require(_0xb9ea('0x4'));var debugLevel=config[_0xb9ea('0x5')]?config[_0xb9ea('0x5')][_0xb9ea('0x6')]():_0xb9ea('0x7');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':_0xb9ea('0x8'),'error':_0xb9ea('0x9'),'warn':_0xb9ea('0xa'),'info':_0xb9ea('0xb'),'print':_0xb9ea('0xc'),'success':_0xb9ea('0xd'),'http':_0xb9ea('0xe'),'verbose':'bold\x20magenta','debug':'bold\x20blue','silly':'bold\x20cyan'};winston[_0xb9ea('0xf')](XC_LOG_COLORS);function getLogFileName(_0x15eb1d,_0x15377f,_0x177026){var _0x6ac964=_0x15eb1d||_0xb9ea('0x10');return path[_0xb9ea('0x11')](_0x6ac964,util[_0xb9ea('0x12')](_0xb9ea('0x13'),_0x15377f,_0x177026));}function formatter(_0x5f2ac8,_0x3dd619){_0x3dd619['message']=_0x3dd619[_0xb9ea('0x14')][_0xb9ea('0x15')](/@@{/g,_0xb9ea('0x16'))['replace'](/}@@/g,_0xb9ea('0x17'))[_0xb9ea('0x15')](/@{/g,'{{')[_0xb9ea('0x15')](/}@/g,'}}');return util['format'](_0xb9ea('0x18'),moment()[_0xb9ea('0x12')](_0xb9ea('0x19')),_0x3dd619[_0xb9ea('0x1a')][_0xb9ea('0x1b')](),_0x5f2ac8,_0x3dd619[_0xb9ea('0x14')]);}function fileFormat(_0x54b757,_0x3c09d5){_0x3c09d5[_0xb9ea('0x14')]=_0x3c09d5['message'][_0xb9ea('0x15')](/@@{/g,_0xb9ea('0x16'))[_0xb9ea('0x15')](/}@@/g,'}}}')['replace'](/@{/g,'{{')[_0xb9ea('0x15')](/}@/g,'}}');var _0x3d7f0f=_0x3c09d5[_0xb9ea('0x1c')]&&Object['keys'](_0x3c09d5[_0xb9ea('0x1c')])[_0xb9ea('0x1d')]?'\x0a\x09'+JSON[_0xb9ea('0x1e')](_0x3c09d5[_0xb9ea('0x1c')]):'';return util[_0xb9ea('0x12')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xb9ea('0x12')](_0xb9ea('0x19')),_0x3c09d5['level'][_0xb9ea('0x1b')](),_0x54b757,_0x3c09d5[_0xb9ea('0x14')],_0x3d7f0f);}function consoleLogger(){var _0x560c22=new winston[(_0xb9ea('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb9ea('0x20'))]['Console']({'level':'warn','json':![],'formatter':function(_0x3b273c){return formatter('',_0x3b273c);}})]});return _0x560c22;}function fileLogger(_0x33165e,_0x1a12d7){var _0x1f9419=new winston[(_0xb9ea('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xb9ea('0x20'))][(_0xb9ea('0x21'))]({'name':util[_0xb9ea('0x12')]('%s-%s',_0x33165e,_0xb9ea('0x22')),'filename':getLogFileName(_0x1a12d7,_0x33165e,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3d8537){return fileFormat(_0x33165e,_0x3d8537);}}),new winston['transports'][(_0xb9ea('0x21'))]({'name':util[_0xb9ea('0x12')](_0xb9ea('0x23'),_0x33165e,debugLevel),'filename':getLogFileName(_0x1a12d7,_0x33165e,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d8125){return fileFormat(_0x33165e,_0x5d8125);}}),new winston[(_0xb9ea('0x20'))][(_0xb9ea('0x24'))]({'level':_0xb9ea('0x25'),'json':![],'formatter':function(_0x1fff69){return fileFormat(_0x33165e,_0x1fff69);}})]});return _0x1f9419;}exports[_0xb9ea('0x26')]=consoleLogger;exports[_0xb9ea('0x27')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 648b832..8b8ea0c 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 _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(_0x5bbaa8,_0xbd7509){var _0x529189=function(_0x2d1414){while(--_0x2d1414){_0x5bbaa8['push'](_0x5bbaa8['shift']());}};_0x529189(++_0xbd7509);}(_0x5f66,0x1a0));var _0x65f6=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x5f66[_0x2f5ac5];return _0x37c9a8;};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 +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x57ca,0x108));var _0xa57c=function(_0x2dfc74,_0x429cdb){_0x2dfc74=_0x2dfc74-0x0;var _0x19a277=_0x57ca[_0x2dfc74];return _0x19a277;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index a2c5cdc..defe2ae 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['exports','replace','\x5c$&'];(function(_0x248407,_0x213775){var _0x33c29b=function(_0x54ada0){while(--_0x54ada0){_0x248407['push'](_0x248407['shift']());}};_0x33c29b(++_0x213775);}(_0x53ec,0x192));var _0xc53e=function(_0x9a62de,_0x127f28){_0x9a62de=_0x9a62de-0x0;var _0x14d7b3=_0x53ec[_0x9a62de];return _0x14d7b3;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file +var _0x53ec=['exports','replace','\x5c$&'];(function(_0x448aec,_0x2b257e){var _0x440b77=function(_0x442c1b){while(--_0x442c1b){_0x448aec['push'](_0x448aec['shift']());}};_0x440b77(++_0x2b257e);}(_0x53ec,0x192));var _0xc53e=function(_0x33392d,_0x43d006){_0x33392d=_0x33392d-0x0;var _0x3fe2d5=_0x53ec[_0x33392d];return _0x3fe2d5;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ec9352c..8d6df19 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 _0xa571=['reduce','exports','lodash','{\x20{\x20','\x20}\x20}','string','map','isPlainObject','keys'];(function(_0x4431ca,_0xc881c7){var _0x54de54=function(_0x555ad7){while(--_0x555ad7){_0x4431ca['push'](_0x4431ca['shift']());}};_0x54de54(++_0xc881c7);}(_0xa571,0x107));var _0x1a57=function(_0x2ea900,_0xd4c112){_0x2ea900=_0x2ea900-0x0;var _0x20ab6e=_0xa571[_0x2ea900];return _0x20ab6e;};var _=require(_0x1a57('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x289e99){return _0x289e99==='{{'?_0x1a57('0x1'):_0x1a57('0x2');}function safeTemplate(_0x48485e){var _0x1a071f=_0x48485e;if(typeof _0x48485e===_0x1a57('0x3')){_0x1a071f=_0x48485e['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x48485e)){_0x1a071f=_0x48485e[_0x1a57('0x4')](function(_0x5067fa){return safeTemplate(_0x5067fa);});}else if(_[_0x1a57('0x5')](_0x48485e)){_0x1a071f=Object[_0x1a57('0x6')](_0x48485e)[_0x1a57('0x7')](function(_0x3c5352,_0x2492f5){_0x3c5352[_0x2492f5]=safeTemplate(_0x48485e[_0x2492f5]);return _0x3c5352;},{});}return _0x1a071f;}module[_0x1a57('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file +var _0xb688=['{\x20{\x20','\x20}\x20}','string','isArray','map','isPlainObject','reduce','exports','safeTemplate'];(function(_0x316e99,_0x16cc2a){var _0x24d3a8=function(_0x220645){while(--_0x220645){_0x316e99['push'](_0x316e99['shift']());}};_0x24d3a8(++_0x16cc2a);}(_0xb688,0xcf));var _0x8b68=function(_0x2b423d,_0x4dc29b){_0x2b423d=_0x2b423d-0x0;var _0x4ec13a=_0xb688[_0x2b423d];return _0x4ec13a;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x39c8c5){return _0x39c8c5==='{{'?_0x8b68('0x0'):_0x8b68('0x1');}function safeTemplate(_0x1080e8){var _0x23bbaa=_0x1080e8;if(typeof _0x1080e8===_0x8b68('0x2')){_0x23bbaa=_0x1080e8['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x8b68('0x3')](_0x1080e8)){_0x23bbaa=_0x1080e8[_0x8b68('0x4')](function(_0x30f33d){return safeTemplate(_0x30f33d);});}else if(_[_0x8b68('0x5')](_0x1080e8)){_0x23bbaa=Object['keys'](_0x1080e8)[_0x8b68('0x6')](function(_0x57ee56,_0x37677d){_0x57ee56[_0x37677d]=safeTemplate(_0x1080e8[_0x37677d]);return _0x57ee56;},{});}return _0x23bbaa;}module[_0x8b68('0x7')][_0x8b68('0x8')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index fc64cdf..3034ca4 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x969f=['NODE_PATH','then','readJSON','updated','info','path','root','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','motion2','env','string'];(function(_0x1562a2,_0x2e4655){var _0x39a636=function(_0x25483a){while(--_0x25483a){_0x1562a2['push'](_0x1562a2['shift']());}};_0x39a636(++_0x2e4655);}(_0x969f,0x75));var _0xf969=function(_0x34aec4,_0x3801da){_0x34aec4=_0x34aec4-0x0;var _0x51e1a7=_0x969f[_0x34aec4];return _0x51e1a7;};var fs=require('fs-extra');var path=require(_0xf969('0x0'));var config=require('../config/environment');var root=config[_0xf969('0x1')];var APP_JSON_PATH=path['resolve'](root,_0xf969('0x2'));var NODEPATH=path[_0xf969('0x3')](root,_0xf969('0x4'));function setLegacyLibsNodeEnvPath(_0x2526ba){let _0x14b0e8=![];if(Array[_0xf969('0x5')](_0x2526ba['apps'])){var _0x4a4d8b=_0x2526ba[_0xf969('0x6')][_0xf969('0x7')](function(_0x55bb0c){return _0x55bb0c['name']===_0xf969('0x8');});if(_0x4a4d8b>-0x1){var _0x348179=_0x2526ba['apps'][_0x4a4d8b];if(typeof _0x348179[_0xf969('0x9')]['NODE_PATH']!==_0xf969('0xa')){_0x348179[_0xf969('0x9')][_0xf969('0xb')]=NODEPATH;_0x14b0e8=!![];}}return{'appConfig':_0x2526ba,'updated':_0x14b0e8};}}function updateAppConfig(_0x2c83fd){return fs['pathExists'](APP_JSON_PATH)[_0xf969('0xc')](function(_0x4b44f8){if(_0x4b44f8){return fs[_0xf969('0xd')](APP_JSON_PATH)['then'](function(_0x4d8769){var _0x3b8488=setLegacyLibsNodeEnvPath(_0x4d8769);if(_0x3b8488[_0xf969('0xe')]){_0x2c83fd[_0xf969('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x4d8769,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xf969('0x3')]();}});}module['exports']=updateAppConfig; \ No newline at end of file +var _0x4a71=['info','exports','fs-extra','path','../config/environment','resolve','legacy-libs','isArray','apps','name','motion2','env','NODE_PATH','then','readJSON'];(function(_0x896b15,_0x2c0ae6){var _0x152b50=function(_0x10415b){while(--_0x10415b){_0x896b15['push'](_0x896b15['shift']());}};_0x152b50(++_0x2c0ae6);}(_0x4a71,0x1f1));var _0x14a7=function(_0x3392cb,_0xb7cdbe){_0x3392cb=_0x3392cb-0x0;var _0x18d4ba=_0x4a71[_0x3392cb];return _0x18d4ba;};var fs=require(_0x14a7('0x0'));var path=require(_0x14a7('0x1'));var config=require(_0x14a7('0x2'));var root=config['root'];var APP_JSON_PATH=path[_0x14a7('0x3')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x14a7('0x4'));function setLegacyLibsNodeEnvPath(_0x442727){let _0x14b0dc=![];if(Array[_0x14a7('0x5')](_0x442727[_0x14a7('0x6')])){var _0x3f35f2=_0x442727['apps']['findIndex'](function(_0x893423){return _0x893423[_0x14a7('0x7')]===_0x14a7('0x8');});if(_0x3f35f2>-0x1){var _0x4ed1a9=_0x442727[_0x14a7('0x6')][_0x3f35f2];if(typeof _0x4ed1a9[_0x14a7('0x9')][_0x14a7('0xa')]!=='string'){_0x4ed1a9[_0x14a7('0x9')][_0x14a7('0xa')]=NODEPATH;_0x14b0dc=!![];}}return{'appConfig':_0x442727,'updated':_0x14b0dc};}}function updateAppConfig(_0x5f3af3){return fs['pathExists'](APP_JSON_PATH)[_0x14a7('0xb')](function(_0x27d347){if(_0x27d347){return fs[_0x14a7('0xc')](APP_JSON_PATH)['then'](function(_0x158fbc){var _0x5efb41=setLegacyLibsNodeEnvPath(_0x158fbc);if(_0x5efb41['updated']){_0x5f3af3[_0x14a7('0xd')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x158fbc,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise['resolve']();}});}module[_0x14a7('0xe')]=updateAppConfig; \ No newline at end of file